diff --git a/.clang-format b/.clang-format index 30216bc10f..d9e1846d21 100644 --- a/.clang-format +++ b/.clang-format @@ -7,4 +7,4 @@ ColumnLimit: 100 IndentWidth: 4 ObjCBlockIndentWidth: 4 AccessModifierOffset: -2 - +InsertBraces: true \ No newline at end of file diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000000..1dc5f3b8e5 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,163 @@ +FormatStyle: file +Checks: "-*,\ + abseil-*,\ + -abseil-string-find-startswith,\ + -abseil-string-find-str-contains,\ + bugprone-*,\ + -bugprone-branch-clone,\ + -bugprone-copy-constructor-init,\ + -bugprone-easily-swappable-parameters,\ + -bugprone-forwarding-reference-overload,\ + -bugprone-implicit-widening-of-multiplication-result,\ + -bugprone-lambda-function-name,\ + -bugprone-macro-parentheses,\ + -bugprone-misplaced-widening-cast,\ + -bugprone-narrowing-conversions,\ + -bugprone-parent-virtual-call,\ + -bugprone-reserved-identifier,\ + -bugprone-signed-char-misuse,\ + -bugprone-sizeof-expression,\ + -bugprone-string-constructor,\ + -bugprone-suspicious-include,\ + -bugprone-too-small-loop-variable,\ + -bugprone-unhandled-self-assignment,\ + -bugprone-use-after-move,\ + cert-*,\ + -cert-dcl16-c,\ + -cert-dcl21-cpp,\ + -cert-dcl37-c,\ + -cert-dcl50-cpp,\ + -cert-dcl51-cpp,\ + -cert-dcl54-cpp,\ + -cert-dcl58-cpp,\ + -cert-err33-c,\ + -cert-msc30-c,\ + -cert-msc32-c,\ + -cert-msc50-cpp,\ + -cert-msc51-cpp,\ + -cert-oop54-cpp,\ + -cert-str34-c,\ + -cert-str34-c,\ + -cert-str34-c,\ + -cert-str34-c,\ + -clang-analyzer-*,\ + concurrency-*,\ + -concurrency-mt-unsafe,\ + cppcoreguidelines-*,\ + -concurrency-mt-unsafe,\ + -cppcoreguidelines-avoid-c-arrays,\ + -cppcoreguidelines-avoid-goto,\ + -cppcoreguidelines-avoid-magic-numbers,\ + -cppcoreguidelines-avoid-non-const-global-variables,\ + -cppcoreguidelines-c-copy-assignment-signature,\ + -cppcoreguidelines-explicit-virtual-functions,\ + -cppcoreguidelines-init-variables,\ + -cppcoreguidelines-interfaces-global-init,\ + -cppcoreguidelines-macro-usage,\ + -cppcoreguidelines-narrowing-conversions,\ + -cppcoreguidelines-no-malloc,\ + -cppcoreguidelines-non-private-member-variables-in-classes,\ + -cppcoreguidelines-owning-memory,\ + -cppcoreguidelines-prefer-member-initializer,\ + -cppcoreguidelines-pro-bounds-array-to-pointer-decay,\ + -cppcoreguidelines-pro-bounds-constant-array-index,\ + -cppcoreguidelines-pro-bounds-pointer-arithmetic,\ + -cppcoreguidelines-pro-type-const-cast,\ + -cppcoreguidelines-pro-type-member-init,\ + -cppcoreguidelines-pro-type-reinterpret-cast,\ + -cppcoreguidelines-pro-type-static-cast-downcast,\ + -cppcoreguidelines-pro-type-union-access,\ + -cppcoreguidelines-pro-type-vararg,\ + -cppcoreguidelines-slicing,\ + -cppcoreguidelines-special-member-functions,\ + -cppcoreguidelines-virtual-class-destructor,\ + google-*,\ + -google-default-arguments,\ + -google-explicit-constructor,\ + -google-readability-avoid-underscore-in-googletest-name,\ + -google-readability-braces-around-statements,\ + -google-readability-casting,\ + -google-readability-namespace-comments,\ + -google-readability-todo,\ + -google-runtime-int,\ + -google-upgrade-googletest-case,\ + misc-*,\ + -misc-misplaced-const,\ + -misc-new-delete-overloads,\ + -misc-non-private-member-variables-in-classes,\ + -misc-no-recursion,\ + -misc-redundant-expression,\ + -misc-uniqueptr-reset-release,\ + -misc-unconventional-assign-operator,\ + -misc-unused-parameters,\ + -misc-unused-using-decls,\ + modernize-*,\ + -modernize-avoid-c-arrays,\ + -modernize-concat-nested-namespaces,\ + -modernize-deprecated-headers,\ + -modernize-loop-convert,\ + -modernize-macro-to-enum,\ + -modernize-make-unique,\ + -modernize-pass-by-value,\ + -modernize-raw-string-literal,\ + -modernize-redundant-void-arg,\ + -modernize-return-braced-init-list,\ + -modernize-unary-static-assert,\ + -modernize-use-auto,\ + -modernize-use-bool-literals,\ + -modernize-use-default-member-init,\ + -modernize-use-emplace,\ + -modernize-use-equals-default,\ + -modernize-use-equals-delete,\ + -modernize-use-nodiscard,\ + -modernize-use-nullptr,\ + -modernize-use-override,\ + -modernize-use-trailing-return-type,\ + -modernize-use-transparent-functors,\ + -modernize-use-using,\ + performance-*,\ + -performance-faster-string-find,\ + -performance-for-range-copy,\ + -performance-inefficient-algorithm,\ + -performance-inefficient-string-concatenation,\ + -performance-inefficient-vector-operation,\ + -performance-move-const-arg,\ + -performance-no-automatic-move,\ + -performance-noexcept-move-constructor,\ + -performance-no-int-to-ptr,\ + -performance-trivially-destructible,\ + -performance-unnecessary-copy-initialization,\ + -performance-unnecessary-value-param,\ + portability-*,\ + readability-*,\ + -readability-avoid-const-params-in-decls,\ + -readability-braces-around-statements,\ + -readability-const-return-type,\ + -readability-container-data-pointer,\ + -readability-container-size-empty,\ + -readability-convert-member-functions-to-static,\ + -readability-else-after-return,\ + -readability-function-cognitive-complexity,\ + -readability-identifier-length,\ + -readability-implicit-bool-conversion,\ + -readability-inconsistent-declaration-parameter-name,\ + -readability-isolate-declaration,\ + -readability-magic-numbers,\ + -readability-make-member-function-const,\ + -readability-named-parameter,\ + -readability-non-const-parameter,\ + -readability-qualified-auto,\ + -readability-redundant-access-specifiers,\ + -readability-redundant-control-flow,\ + -readability-redundant-declaration,\ + -readability-redundant-member-init,\ + -readability-redundant-smartptr-get,\ + -readability-redundant-string-cstr,\ + -readability-redundant-string-init,\ + -readability-simplify-boolean-expr,\ + -readability-static-accessed-through-instance,\ + -readability-static-definition-in-anonymous-namespace,\ + -readability-suspicious-call-argument,\ + -readability-uppercase-literal-suffix,\ + -readability-use-anyofallof + " diff --git a/.gitattributes b/.gitattributes index 5333936d7e..a0a0cf37d3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,3 +7,5 @@ *.sh eol=lf *.spvasm eol=lf *.wgsl eol=lf +*.h eol=lf +*.cpp eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9de9f9a255..552e96f650 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /.cipd /.gclient /.gclient_entries +/.gclient_previous_sync_commits /build /buildtools /testing @@ -97,4 +98,9 @@ coverage.summary default.profraw lcov.info /cmake-build-*/ +/build-*/ /testing + +### Clang-Tidy files +all_findings.json + diff --git a/.gn b/.gn index 7726b98afc..9b9c5b82be 100644 --- a/.gn +++ b/.gn @@ -23,6 +23,7 @@ default_args = { angle_enable_abseil = false angle_standalone = false angle_build_all = false + angle_build_tests = false angle_has_rapidjson = false angle_use_wayland = false angle_vulkan_headers_dir = "//third_party/vulkan-deps/vulkan-headers/src" @@ -33,8 +34,3 @@ default_args = { vma_vulkan_headers_dir = "//third_party/vulkan-deps/vulkan-headers/src" } - -no_check_targets = [ - # TODO(crbug.com/dawn/1404): Issue with the Absl headers - "//src/dawn/tests:dawn_unittests", -] diff --git a/BUILD.gn b/BUILD.gn index 7502fb75a9..f8c951333a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -20,10 +20,9 @@ group("all") { "src/dawn/fuzzers", "src/dawn/native:webgpu_dawn", "src/dawn/tests", - "src/fuzzers/dawn:dawn_fuzzers", "src/tint:libtint", + "src/tint:tint_unittests", "src/tint/fuzzers", - "test/tint:tint_unittests", ] if (dawn_standalone) { deps += [ diff --git a/CMakeLists.txt b/CMakeLists.txt index aae27a5a13..0bc5978783 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,7 @@ set(ENABLE_METAL OFF) set(ENABLE_OPENGLES OFF) set(ENABLE_DESKTOP_GL OFF) set(ENABLE_VULKAN OFF) +set(USE_WAYLAND OFF) set(USE_X11 OFF) set(BUILD_SAMPLES OFF) if (WIN32) @@ -113,8 +114,9 @@ if (DAWN_SUPPORTS_GLFW_FOR_WINDOWING) set(BUILD_SAMPLES ON) endif() -option_if_not_defined(DAWN_ENABLE_MSAN "Enable memory sanitizer" OFF) option_if_not_defined(DAWN_ENABLE_ASAN "Enable address sanitizer" OFF) +option_if_not_defined(DAWN_ENABLE_TSAN "Enable thread sanitizer" OFF) +option_if_not_defined(DAWN_ENABLE_MSAN "Enable memory sanitizer" OFF) option_if_not_defined(DAWN_ENABLE_UBSAN "Enable undefined behaviour sanitizer" OFF) option_if_not_defined(DAWN_ENABLE_D3D12 "Enable compilation of the D3D12 backend" ${ENABLE_D3D12}) @@ -123,7 +125,9 @@ option_if_not_defined(DAWN_ENABLE_NULL "Enable compilation of the Null backend" option_if_not_defined(DAWN_ENABLE_DESKTOP_GL "Enable compilation of the OpenGL backend" ${ENABLE_DESKTOP_GL}) option_if_not_defined(DAWN_ENABLE_OPENGLES "Enable compilation of the OpenGL ES backend" ${ENABLE_OPENGLES}) option_if_not_defined(DAWN_ENABLE_VULKAN "Enable compilation of the Vulkan backend" ${ENABLE_VULKAN}) + option_if_not_defined(DAWN_ALWAYS_ASSERT "Enable assertions on all build types" OFF) +option_if_not_defined(DAWN_USE_WAYLAND "Enable support for Wayland surface" ${USE_WAYLAND}) option_if_not_defined(DAWN_USE_X11 "Enable support for X11 surface" ${USE_X11}) option_if_not_defined(DAWN_BUILD_SAMPLES "Enables building Dawn's samples" ${BUILD_SAMPLES}) @@ -132,14 +136,46 @@ option_if_not_defined(DAWN_ENABLE_SWIFTSHADER "Enables building Swiftshader as p option_if_not_defined(DAWN_ENABLE_PIC "Build with Position-Independent-Code enabled" OFF) -set_if_not_defined(DAWN_THIRD_PARTY_DIR "${Dawn_SOURCE_DIR}/third_party" "Directory in which to find third-party dependencies.") +if (DAWN_ENABLE_OPENGLES OR DAWN_ENABLE_DESKTOP_GL) + set(TINT_DEFAULT_GLSL ON) +else() + set(TINT_DEFAULT_GLSL OFF) +endif() + +option_if_not_defined(TINT_BUILD_SAMPLES "Build samples" ${DAWN_BUILD_SAMPLES}) +option_if_not_defined(TINT_BUILD_DOCS "Build documentation" ON) +option_if_not_defined(TINT_DOCS_WARN_AS_ERROR "When building documentation, treat warnings as errors" OFF) + +option_if_not_defined(TINT_BUILD_SPV_READER "Build the SPIR-V input reader" ${DAWN_ENABLE_VULKAN}) +option_if_not_defined(TINT_BUILD_WGSL_READER "Build the WGSL input reader" ON) +option_if_not_defined(TINT_BUILD_GLSL_WRITER "Build the GLSL output writer" ${TINT_DEFAULT_GLSL}) +option_if_not_defined(TINT_BUILD_HLSL_WRITER "Build the HLSL output writer" ${DAWN_ENABLE_D3D12}) +option_if_not_defined(TINT_BUILD_MSL_WRITER "Build the MSL output writer" ${DAWN_ENABLE_METAL}) +option_if_not_defined(TINT_BUILD_SPV_WRITER "Build the SPIR-V output writer" ${DAWN_ENABLE_VULKAN}) +option_if_not_defined(TINT_BUILD_WGSL_WRITER "Build the WGSL output writer" ON) + +option_if_not_defined(TINT_BUILD_FUZZERS "Build fuzzers" OFF) +option_if_not_defined(TINT_BUILD_SPIRV_TOOLS_FUZZER "Build SPIRV-Tools fuzzer" OFF) +option_if_not_defined(TINT_BUILD_AST_FUZZER "Build AST fuzzer" OFF) +option_if_not_defined(TINT_BUILD_REGEX_FUZZER "Build regex fuzzer" OFF) +option_if_not_defined(TINT_BUILD_BENCHMARKS "Build benchmarks" OFF) +option_if_not_defined(TINT_BUILD_TESTS "Build tests" ON) +option_if_not_defined(TINT_BUILD_AS_OTHER_OS "Override OS detection to force building of *_other.cc files" OFF) +option_if_not_defined(TINT_BUILD_REMOTE_COMPILE "Build the remote-compile tool for validating shaders on a remote machine" OFF) + +option_if_not_defined(TINT_ENABLE_BREAK_IN_DEBUGGER "Enable tint::debugger::Break()" OFF) +option_if_not_defined(TINT_EMIT_COVERAGE "Emit code coverage information" OFF) +option_if_not_defined(TINT_CHECK_CHROMIUM_STYLE "Check for [chromium-style] issues during build" OFF) +option_if_not_defined(TINT_SYMBOL_STORE_DEBUG_NAME "Enable storing of name in tint::ast::Symbol to help debugging the AST" OFF) # Recommended setting for compability with future abseil releases. set(ABSL_PROPAGATE_CXX_STD ON) +set_if_not_defined(DAWN_THIRD_PARTY_DIR "${Dawn_SOURCE_DIR}/third_party" "Directory in which to find third-party dependencies.") set_if_not_defined(DAWN_ABSEIL_DIR "${DAWN_THIRD_PARTY_DIR}/abseil-cpp" "Directory in which to find Abseil") set_if_not_defined(DAWN_GLFW_DIR "${DAWN_THIRD_PARTY_DIR}/glfw" "Directory in which to find GLFW") set_if_not_defined(DAWN_JINJA2_DIR "${DAWN_THIRD_PARTY_DIR}/jinja2" "Directory in which to find Jinja2") +set_if_not_defined(DAWN_KHRONOS_DIR "${DAWN_THIRD_PARTY_DIR}/khronos" "Directory in which to find Khronos GL headers") set_if_not_defined(DAWN_SPIRV_HEADERS_DIR "${DAWN_THIRD_PARTY_DIR}/vulkan-deps/spirv-headers/src" "Directory in which to find SPIRV-Headers") set_if_not_defined(DAWN_SPIRV_TOOLS_DIR "${DAWN_THIRD_PARTY_DIR}/vulkan-deps/spirv-tools/src" "Directory in which to find SPIRV-Tools") set_if_not_defined(DAWN_SWIFTSHADER_DIR "${DAWN_THIRD_PARTY_DIR}/swiftshader" "Directory in which to find swiftshader") @@ -163,160 +199,6 @@ if(DAWN_ENABLE_PIC) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -################################################################################ -# common_compile_options - sets compiler and linker options common for dawn and -# tint on the given target -################################################################################ -function(common_compile_options TARGET) - if (COMPILER_IS_LIKE_GNU) - target_compile_options(${TARGET} PRIVATE - -fno-exceptions - -fno-rtti - ) - - if (${DAWN_ENABLE_MSAN}) - target_compile_options(${TARGET} PRIVATE -fsanitize=memory) - target_link_options(${TARGET} PRIVATE -fsanitize=memory) - elseif (${DAWN_ENABLE_ASAN}) - target_compile_options(${TARGET} PRIVATE -fsanitize=address) - target_link_options(${TARGET} PRIVATE -fsanitize=address) - elseif (${DAWN_ENABLE_UBSAN}) - target_compile_options(${TARGET} PRIVATE -fsanitize=undefined) - target_link_options(${TARGET} PRIVATE -fsanitize=undefined) - endif() - endif(COMPILER_IS_LIKE_GNU) -endfunction() - -################################################################################ -# Dawn's public and internal "configs" -################################################################################ - -# The public config contains only the include paths for the Dawn headers. -add_library(dawn_public_config INTERFACE) -target_include_directories(dawn_public_config INTERFACE - "${DAWN_INCLUDE_DIR}" - "${DAWN_BUILD_GEN_DIR}/include" -) - -# The internal config conatins additional path but includes the dawn_public_config include paths -add_library(dawn_internal_config INTERFACE) -target_include_directories(dawn_internal_config INTERFACE - "${DAWN_SRC_DIR}" - "${DAWN_BUILD_GEN_DIR}/src" -) -target_link_libraries(dawn_internal_config INTERFACE dawn_public_config) - -# Compile definitions for the internal config -if (DAWN_ALWAYS_ASSERT OR CMAKE_BUILD_TYPE STREQUAL Debug) - target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_ASSERTS") -endif() -if (DAWN_ENABLE_D3D12) - target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_D3D12") -endif() -if (DAWN_ENABLE_METAL) - target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_METAL") -endif() -if (DAWN_ENABLE_NULL) - target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_NULL") -endif() -if (DAWN_ENABLE_DESKTOP_GL) - target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_DESKTOP_GL") -endif() -if (DAWN_ENABLE_OPENGLES) - target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_OPENGLES") -endif() -if (DAWN_ENABLE_OPENGL) - target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_OPENGL") -endif() -if (DAWN_ENABLE_VULKAN) - target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_VULKAN") -endif() -if (DAWN_USE_X11) - target_compile_definitions(dawn_internal_config INTERFACE "DAWN_USE_X11") -endif() -if (WIN32) - target_compile_definitions(dawn_internal_config INTERFACE "NOMINMAX" "WIN32_LEAN_AND_MEAN") -endif() - -set(CMAKE_CXX_STANDARD "17") - -################################################################################ -# Tint -################################################################################ - -# TINT_IS_SUBPROJECT is 1 if added via add_subdirectory() from another project. -get_directory_property(TINT_IS_SUBPROJECT PARENT_DIRECTORY) -if(TINT_IS_SUBPROJECT) - set(TINT_IS_SUBPROJECT 1) - - # If tint is used as a subproject, default to disabling the building of - # documentation and tests. These are unlikely to be desirable, but can be - # enabled. - set(TINT_BUILD_DOCS_DEFAULT OFF) - set(TINT_BUILD_TESTS_DEFAULT OFF) -else() - set(TINT_BUILD_DOCS_DEFAULT OFF) - set(TINT_BUILD_TESTS_DEFAULT OFF) -endif() - -option_if_not_defined(TINT_BUILD_SAMPLES "Build samples" OFF) -option_if_not_defined(TINT_BUILD_DOCS "Build documentation" ${TINT_BUILD_DOCS_DEFAULT}) -option_if_not_defined(TINT_DOCS_WARN_AS_ERROR "When building documentation, treat warnings as errors" OFF) -option_if_not_defined(TINT_BUILD_SPV_READER "Build the SPIR-V input reader" ON) -option_if_not_defined(TINT_BUILD_WGSL_READER "Build the WGSL input reader" ON) -option_if_not_defined(TINT_BUILD_GLSL_WRITER "Build the GLSL output writer" ON) -option_if_not_defined(TINT_BUILD_HLSL_WRITER "Build the HLSL output writer" ON) -option_if_not_defined(TINT_BUILD_MSL_WRITER "Build the MSL output writer" ON) -option_if_not_defined(TINT_BUILD_SPV_WRITER "Build the SPIR-V output writer" ON) -option_if_not_defined(TINT_BUILD_WGSL_WRITER "Build the WGSL output writer" ON) -option_if_not_defined(TINT_BUILD_FUZZERS "Build fuzzers" OFF) -option_if_not_defined(TINT_BUILD_SPIRV_TOOLS_FUZZER "Build SPIRV-Tools fuzzer" OFF) -option_if_not_defined(TINT_BUILD_AST_FUZZER "Build AST fuzzer" OFF) -option_if_not_defined(TINT_BUILD_REGEX_FUZZER "Build regex fuzzer" OFF) -option_if_not_defined(TINT_BUILD_BENCHMARKS "Build benchmarks" OFF) -option_if_not_defined(TINT_BUILD_TESTS "Build tests" ${TINT_BUILD_TESTS_DEFAULT}) -option_if_not_defined(TINT_BUILD_AS_OTHER_OS "Override OS detection to force building of *_other.cc files" OFF) -option_if_not_defined(TINT_BUILD_REMOTE_COMPILE "Build the remote-compile tool for validating shaders on a remote machine" OFF) - -set(TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS "" CACHE STRING "Used by OSS-Fuzz to control, via link options, which fuzzing engine should be used") - -option_if_not_defined(TINT_ENABLE_BREAK_IN_DEBUGGER "Enable tint::debugger::Break()" OFF) - -option_if_not_defined(TINT_EMIT_COVERAGE "Emit code coverage information" OFF) - -option_if_not_defined(TINT_CHECK_CHROMIUM_STYLE "Check for [chromium-style] issues during build" OFF) - -option_if_not_defined(TINT_SYMBOL_STORE_DEBUG_NAME "Enable storing of name in tint::ast::Symbol to help debugging the AST" OFF) - -message(STATUS "Tint build samples: ${TINT_BUILD_SAMPLES}") -message(STATUS "Tint build docs: ${TINT_BUILD_DOCS}") -message(STATUS "Tint build docs with warn as error: ${TINT_DOCS_WARN_AS_ERROR}") -message(STATUS "Tint build SPIR-V reader: ${TINT_BUILD_SPV_READER}") -message(STATUS "Tint build WGSL reader: ${TINT_BUILD_WGSL_READER}") -message(STATUS "Tint build GLSL writer: ${TINT_BUILD_GLSL_WRITER}") -message(STATUS "Tint build HLSL writer: ${TINT_BUILD_HLSL_WRITER}") -message(STATUS "Tint build MSL writer: ${TINT_BUILD_MSL_WRITER}") -message(STATUS "Tint build SPIR-V writer: ${TINT_BUILD_SPV_WRITER}") -message(STATUS "Tint build WGSL writer: ${TINT_BUILD_WGSL_WRITER}") -message(STATUS "Tint build fuzzers: ${TINT_BUILD_FUZZERS}") -message(STATUS "Tint build SPIRV-Tools fuzzer: ${TINT_BUILD_SPIRV_TOOLS_FUZZER}") -message(STATUS "Tint build AST fuzzer: ${TINT_BUILD_AST_FUZZER}") -message(STATUS "Tint build regex fuzzer: ${TINT_BUILD_REGEX_FUZZER}") -message(STATUS "Tint build benchmarks: ${TINT_BUILD_BENCHMARKS}") -message(STATUS "Tint build tests: ${TINT_BUILD_TESTS}") -message(STATUS "Tint build with ASAN: ${DAWN_ENABLE_ASAN}") -message(STATUS "Tint build with MSAN: ${DAWN_ENABLE_MSAN}") -message(STATUS "Tint build with UBSAN: ${DAWN_ENABLE_UBSAN}") -message(STATUS "Tint build checking [chromium-style]: ${TINT_CHECK_CHROMIUM_STYLE}") -message(STATUS "Tint build remote-compile tool: ${TINT_BUILD_REMOTE_COMPILE}") - -if (NOT ${TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS} STREQUAL "") - message(STATUS "Using provided LIB_FUZZING_ENGINE options: ${TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS}") -endif() - -message(STATUS "Using python3") -find_package(PythonInterp 3 REQUIRED) - if (${TINT_BUILD_SPIRV_TOOLS_FUZZER}) message(STATUS "TINT_BUILD_SPIRV_TOOLS_FUZZER is ON - setting TINT_BUILD_FUZZERS @@ -373,6 +255,150 @@ if (${TINT_BUILD_REGEX_FUZZER}) set(TINT_BUILD_HLSL_WRITER ON CACHE BOOL "Build HLSL writer" FORCE) endif() +message(STATUS "Dawn build D3D12 backend: ${DAWN_ENABLE_D3D12}") +message(STATUS "Dawn build Metal backend: ${DAWN_ENABLE_METAL}") +message(STATUS "Dawn build Vulkan backend: ${DAWN_ENABLE_VULKAN}") +message(STATUS "Dawn build OpenGL backend: ${DAWN_ENABLE_DESKTOP_GL}") +message(STATUS "Dawn build OpenGL ES backend: ${DAWN_ENABLE_OPENGLES}") +message(STATUS "Dawn build Null backend: ${DAWN_ENABLE_NULL}") + +message(STATUS "Dawn build with asserts in all configurations: ${DAWN_ALWAYS_ASSERT}") +message(STATUS "Dawn build Wayland support: ${DAWN_USE_WAYLAND}") +message(STATUS "Dawn build X11 support: ${DAWN_USE_X11}") + +message(STATUS "Dawn build samples: ${DAWN_BUILD_SAMPLES}") +message(STATUS "Dawn build Node bindings: ${DAWN_BUILD_NODE_BINDINGS}") +message(STATUS "Dawn build Swiftshader: ${DAWN_ENABLE_SWIFTSHADER}") + +message(STATUS "Dawn build PIC: ${DAWN_ENABLE_PIC}") + +message(STATUS "Dawn build with ASAN: ${DAWN_ENABLE_ASAN}") +message(STATUS "Dawn build with TSAN: ${DAWN_ENABLE_TSAN}") +message(STATUS "Dawn build with MSAN: ${DAWN_ENABLE_MSAN}") +message(STATUS "Dawn build with UBSAN: ${DAWN_ENABLE_UBSAN}") + +message(STATUS "Tint build samples: ${TINT_BUILD_SAMPLES}") +message(STATUS "Tint build docs: ${TINT_BUILD_DOCS}") +message(STATUS "Tint build docs with warn as error: ${TINT_DOCS_WARN_AS_ERROR}") +message(STATUS "Tint build SPIR-V reader: ${TINT_BUILD_SPV_READER}") +message(STATUS "Tint build WGSL reader: ${TINT_BUILD_WGSL_READER}") +message(STATUS "Tint build GLSL writer: ${TINT_BUILD_GLSL_WRITER}") +message(STATUS "Tint build HLSL writer: ${TINT_BUILD_HLSL_WRITER}") +message(STATUS "Tint build MSL writer: ${TINT_BUILD_MSL_WRITER}") +message(STATUS "Tint build SPIR-V writer: ${TINT_BUILD_SPV_WRITER}") +message(STATUS "Tint build WGSL writer: ${TINT_BUILD_WGSL_WRITER}") +message(STATUS "Tint build fuzzers: ${TINT_BUILD_FUZZERS}") +message(STATUS "Tint build SPIRV-Tools fuzzer: ${TINT_BUILD_SPIRV_TOOLS_FUZZER}") +message(STATUS "Tint build AST fuzzer: ${TINT_BUILD_AST_FUZZER}") +message(STATUS "Tint build regex fuzzer: ${TINT_BUILD_REGEX_FUZZER}") +message(STATUS "Tint build benchmarks: ${TINT_BUILD_BENCHMARKS}") +message(STATUS "Tint build tests: ${TINT_BUILD_TESTS}") +message(STATUS "Tint build checking [chromium-style]: ${TINT_CHECK_CHROMIUM_STYLE}") +message(STATUS "Tint build remote-compile tool: ${TINT_BUILD_REMOTE_COMPILE}") + +if (NOT ${TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS} STREQUAL "") + message(STATUS "Using provided LIB_FUZZING_ENGINE options: ${TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS}") +endif() + +message(STATUS "Using python3") +find_package(PythonInterp 3 REQUIRED) + + +################################################################################ +# common_compile_options - sets compiler and linker options common for dawn and +# tint on the given target +################################################################################ +function(common_compile_options TARGET) + if (COMPILER_IS_LIKE_GNU) + target_compile_options(${TARGET} PRIVATE + -fno-exceptions + -fno-rtti + -fvisibility-inlines-hidden + ) + + if (${DAWN_ENABLE_MSAN}) + target_compile_options(${TARGET} PUBLIC -fsanitize=memory) + target_link_options(${TARGET} PUBLIC -fsanitize=memory) + elseif (${DAWN_ENABLE_ASAN}) + target_compile_options(${TARGET} PUBLIC -fsanitize=address) + target_link_options(${TARGET} PUBLIC -fsanitize=address) + elseif (${DAWN_ENABLE_TSAN}) + target_compile_options(${TARGET} PUBLIC -fsanitize=thread) + target_link_options(${TARGET} PUBLIC -fsanitize=thread) + elseif (${DAWN_ENABLE_UBSAN}) + target_compile_options(${TARGET} PUBLIC -fsanitize=undefined) + target_link_options(${TARGET} PUBLIC -fsanitize=undefined) + endif() + endif(COMPILER_IS_LIKE_GNU) +endfunction() + +if (${DAWN_ENABLE_TSAN}) + add_compile_options(-stdlib=libc++) + add_link_options(-stdlib=libc++) +endif() + +################################################################################ +# Dawn's public and internal "configs" +################################################################################ + +# The public config contains only the include paths for the Dawn headers. +add_library(dawn_public_config INTERFACE) +target_include_directories(dawn_public_config INTERFACE + "${DAWN_INCLUDE_DIR}" + "${DAWN_BUILD_GEN_DIR}/include" +) + +# The internal config conatins additional path but includes the dawn_public_config include paths +add_library(dawn_internal_config INTERFACE) +target_include_directories(dawn_internal_config INTERFACE + "${DAWN_SRC_DIR}" + "${DAWN_BUILD_GEN_DIR}/src" +) +target_link_libraries(dawn_internal_config INTERFACE dawn_public_config) + +# Compile definitions for the internal config +if (DAWN_ALWAYS_ASSERT OR CMAKE_BUILD_TYPE STREQUAL Debug) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_ASSERTS") +endif() +if (DAWN_ENABLE_D3D12) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_D3D12") +endif() +if (DAWN_ENABLE_METAL) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_METAL") +endif() +if (DAWN_ENABLE_NULL) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_NULL") +endif() +if (DAWN_ENABLE_DESKTOP_GL) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_DESKTOP_GL") +endif() +if (DAWN_ENABLE_OPENGLES) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_OPENGLES") +endif() +if (DAWN_ENABLE_OPENGL) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_OPENGL") +endif() +if (DAWN_ENABLE_VULKAN) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_ENABLE_BACKEND_VULKAN") +endif() +if (DAWN_USE_WAYLAND) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_USE_WAYLAND") +endif() +if (DAWN_USE_X11) + target_compile_definitions(dawn_internal_config INTERFACE "DAWN_USE_X11") +endif() +if (WIN32) + target_compile_definitions(dawn_internal_config INTERFACE "NOMINMAX" "WIN32_LEAN_AND_MEAN") +endif() + +set(CMAKE_CXX_STANDARD "17") + +################################################################################ +# Tint +################################################################################ + +set(TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS "" CACHE STRING "Used by OSS-Fuzz to control, via link options, which fuzzing engine should be used") + set(TINT_ROOT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) # CMake < 3.15 sets /W3 in CMAKE_CXX_FLAGS. Remove it if it's there. @@ -564,7 +590,14 @@ endfunction() ################################################################################ add_subdirectory(third_party) + +# TODO(crbug.com/tint/455): Tint does not currently build with CMake when +# BUILD_SHARED_LIBS=1, so always build it as static for now. +set(BUILD_SHARED_LIBS_SAVED ${BUILD_SHARED_LIBS}) +set(BUILD_SHARED_LIBS 0) add_subdirectory(src/tint) +set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_SAVED}) + add_subdirectory(generator) add_subdirectory(src/dawn) diff --git a/DEPS b/DEPS index fab4b99073..44c173ca51 100644 --- a/DEPS +++ b/DEPS @@ -14,10 +14,10 @@ vars = { 'dawn_standalone': True, 'dawn_node': False, # Also fetches dependencies required for building NodeJS bindings. - 'dawn_cmake_version': 'version:3.13.5', + 'dawn_cmake_version': 'version:2@3.23.3', 'dawn_cmake_win32_sha1': 'b106d66bcdc8a71ea2cdf5446091327bfdb1bcd7', 'dawn_gn_version': 'git_revision:bd99dbf98cbdefe18a4128189665c5761263bcfb', - 'dawn_go_version': 'version:1.16', + 'dawn_go_version': 'version:2@1.18.4', 'node_darwin_arm64_sha': '31859fc1fa0994a95f44f09c367d6ff63607cfde', 'node_darwin_x64_sha': '16dfd094763b71988933a31735f9dea966f9abd6', @@ -26,20 +26,23 @@ vars = { # GN variable required by //testing that will be output in the gclient_args.gni 'generate_location_tags': False, + + # Fetch clang-tidy into the same bin/ directory as our clang binary. + 'checkout_clang_tidy': False, } deps = { # Dependencies required to use GN/Clang in standalone 'build': { - 'url': '{chromium_git}/chromium/src/build@87b04ad66530e4a571cef36d6e71ef737d23a887', + 'url': '{chromium_git}/chromium/src/build@f14f6d206b9a0c81a0fefba487bcba0d90ddb5fe', 'condition': 'dawn_standalone', }, 'buildtools': { - 'url': '{chromium_git}/chromium/src/buildtools@f0d740e4e2f803e39dfd5d8d11f7d87bdf489514', + 'url': '{chromium_git}/chromium/src/buildtools@fe57e98eeb2172d7517f6dec1072ca641a019893', 'condition': 'dawn_standalone', }, 'buildtools/clang_format/script': { - 'url': '{chromium_git}/external/github.com/llvm/llvm-project/clang/tools/clang-format.git@99803d74e35962f63a775f29477882afd4d57d94', + 'url': '{chromium_git}/external/github.com/llvm/llvm-project/clang/tools/clang-format.git@8b525d2747f2584fc35d8c7e612e66f377858df7', 'condition': 'dawn_standalone', }, 'buildtools/linux64': { @@ -68,17 +71,17 @@ deps = { }, 'buildtools/third_party/libc++/trunk': { - 'url': '{chromium_git}/external/github.com/llvm/llvm-project/libcxx.git@79a2e924d96e2fc1e4b937c42efd08898fa472d7', + 'url': '{chromium_git}/external/github.com/llvm/llvm-project/libcxx.git@eb79671bfbedd77b747d01dee8c0479ff1693f88', 'condition': 'dawn_standalone', }, 'buildtools/third_party/libc++abi/trunk': { - 'url': '{chromium_git}/external/github.com/llvm/llvm-project/libcxxabi.git@edde7bbc4049ae4a32257d9f16451312c763c601', + 'url': '{chromium_git}/external/github.com/llvm/llvm-project/libcxxabi.git@b954e3e65634a9e2f7b595598a30c455f5f2eb26', 'condition': 'dawn_standalone', }, 'tools/clang': { - 'url': '{chromium_git}/chromium/src/tools/clang@3c4a622d9f0b0ce5ec2a438189d46c695216b324', + 'url': '{chromium_git}/chromium/src/tools/clang@3d8d88e8bb600789ba3e798f38ff314521aac524', 'condition': 'dawn_standalone', }, 'tools/clang/dsymutil': { @@ -92,11 +95,11 @@ deps = { # Testing, GTest and GMock 'testing': { - 'url': '{chromium_git}/chromium/src/testing@d485ae97b7900c1fb7edfbe2901ae5adcb120865', + 'url': '{chromium_git}/chromium/src/testing@1f497ac0b0afc242222780a4789d13fbf00073eb', 'condition': 'dawn_standalone', }, 'third_party/googletest': { - 'url': '{chromium_git}/external/github.com/google/googletest@6b74da4757a549563d7c37c8fae3e704662a043b', + 'url': '{chromium_git}/external/github.com/google/googletest@bda85449f48f2d80a494c8c07766b6aba3170f3b', 'condition': 'dawn_standalone', }, # This is a dependency of //testing @@ -117,8 +120,7 @@ deps = { # GLFW for tests and samples 'third_party/glfw': { - 'url': '{chromium_git}/external/github.com/glfw/glfw@94773111300fee0453844a4c9407af7e880b4df8', - 'condition': 'dawn_standalone', + 'url': '{chromium_git}/external/github.com/glfw/glfw@62e175ef9fae75335575964c845a302447c012c7', }, 'third_party/vulkan_memory_allocator': { @@ -127,33 +129,33 @@ deps = { }, 'third_party/angle': { - 'url': '{chromium_git}/angle/angle@e316203a6a2f07b865fe6808d4fc8528cf0199fa', + 'url': '{chromium_git}/angle/angle@5ef3960bc1f10d180331a8134b0d11139fa1f913', 'condition': 'dawn_standalone', }, 'third_party/swiftshader': { - 'url': '{swiftshader_git}/SwiftShader@1dd93361b1d9a1755f73faac4cb2db8feb83a871', + 'url': '{swiftshader_git}/SwiftShader@476165cc7c0c7247869c13f7f80dd25ec1fd2b03', 'condition': 'dawn_standalone', }, 'third_party/vulkan-deps': { - 'url': '{chromium_git}/vulkan-deps@626b2fd72bdeabfee53df69a1831f3f4b0e75e8b', + 'url': '{chromium_git}/vulkan-deps@c5f01bfc31ec5b7165eebf9f241890744edc7789', 'condition': 'dawn_standalone', }, 'third_party/zlib': { - 'url': '{chromium_git}/chromium/src/third_party/zlib@c29ee8c9c3824ca013479bf8115035527967fe02', + 'url': '{chromium_git}/chromium/src/third_party/zlib@64bbf988543996eb8df9a86877b32917187eba8f', 'condition': 'dawn_standalone', }, 'third_party/abseil-cpp': { - 'url': '{chromium_git}/chromium/src/third_party/abseil-cpp@789af048b388657987c59d4da406859034fe310f', + 'url': '{chromium_git}/chromium/src/third_party/abseil-cpp@bc3ab29356a081d0b5dd4ac55e30f4b45d8794cc', 'condition': 'dawn_standalone', }, # WebGPU CTS - not used directly by Dawn, only transitively by Chromium. 'third_party/webgpu-cts': { - 'url': '{chromium_git}/external/github.com/gpuweb/cts@ecf4804228d1473df8596c3c87e5b7e32649e2de', + 'url': '{chromium_git}/external/github.com/gpuweb/cts@27dc745ca167d1e9eb956947f2109441dca0b4f7', 'condition': 'build_with_chromium', }, @@ -167,13 +169,9 @@ deps = { 'condition': 'dawn_node', }, 'third_party/gpuweb': { - 'url': '{github_git}/gpuweb/gpuweb.git@16df823c91c9045b7cdf9bd0f2c0ef6d43ac95e7', + 'url': '{github_git}/gpuweb/gpuweb.git@3c4734b09c68eb800b15da5e9ecefeca735fa7df', 'condition': 'dawn_node', }, - 'third_party/gpuweb-cts': { - 'url': '{chromium_git}/external/github.com/gpuweb/cts@ecf4804228d1473df8596c3c87e5b7e32649e2de', - 'condition': 'dawn_standalone', - }, 'tools/golang': { 'condition': 'dawn_node', @@ -242,6 +240,15 @@ hooks = [ 'action': ['python3', 'tools/clang/scripts/update.py'], 'condition': 'dawn_standalone', }, + { + # This is also supposed to support the same set of platforms as 'clang' + # above. LLVM ToT support isn't provided at the moment. + 'name': 'clang_tidy', + 'pattern': '.', + 'condition': 'dawn_standalone and checkout_clang_tidy', + 'action': ['python3', 'tools/clang/scripts/update.py', + '--package=clang-tidy'], + }, { # Pull rc binaries using checked-in hashes. 'name': 'rc_win', diff --git a/Doxyfile b/Doxyfile index c28c2680e5..cb5c12042c 100644 --- a/Doxyfile +++ b/Doxyfile @@ -2078,7 +2078,8 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = DOXYGEN +PREDEFINED = DOXYGEN \ + TESTING_LIBFUZZER_LIBFUZZER_EXPORTS_H_ # See: crbug.com/tint/1647 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/OWNERS b/OWNERS index 86fea581df..4686b3edf9 100644 --- a/OWNERS +++ b/OWNERS @@ -1,4 +1,5 @@ # Top level owners, if you can, try to look at more targeted OWNERS +bclayton@chromium.org bclayton@google.com cwallez@chromium.org dneto@google.com diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 7cfb3ae309..ecd0c624b0 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -117,6 +117,7 @@ def _NonInclusiveFileFilter(file): "src/dawn/node/tools/src/cmd/run-cts/main.go", # Terminal type name "src/dawn/samples/ComputeBoids.cpp", # External URL "src/dawn/tests/end2end/DepthBiasTests.cpp", # External URL + "src/tint/transform/canonicalize_entry_point_io.cc", # External URL "test/tint/samples/compute_boids.wgsl", # External URL "third_party/khronos/KHR/khrplatform.h", # Third party file "tools/roll-all", # Branch name diff --git a/README.md b/README.md index 56c75409d2..4fb672fd5e 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,9 @@ Dawn provides several WebGPU building blocks: - **WebGPU C/C++ headers** that applications and other building blocks use. - The `webgpu.h` version that Dawn implements. - A C++ wrapper for the `webgpu.h`. - - **A "native" implementation of WebGPU** using platforms' GPU APIs: - - **D3D12** on Windows 10 - - **Metal** on macOS and iOS - - **Vulkan** on Windows, Linux, ChromeOS, Android and Fuchsia - - OpenGL as best effort where available + - **A "native" implementation of WebGPU** using platforms' GPU APIs: D3D12, Metal, Vulkan and OpenGL. See [per API support](docs/support.md) for more details. - **A client-server implementation of WebGPU** for applications that are in a sandbox without access to native drivers - - **Tint** is a compiler for the WebGPU Shader Language (WGSL). + - **Tint** is a compiler for the WebGPU Shader Language (WGSL) that can be used in standalone to convert shaders from and to WGSL. Helpful links: diff --git a/build_overrides/dawn.gni b/build_overrides/dawn.gni index 87e1ded268..6440625c53 100644 --- a/build_overrides/dawn.gni +++ b/build_overrides/dawn.gni @@ -37,3 +37,7 @@ dawn_swiftshader_dir = "//third_party/swiftshader" dawn_vulkan_loader_dir = "//third_party/vulkan-deps/vulkan-loader/src" dawn_vulkan_validation_layers_dir = "//third_party/vulkan-deps/vulkan-validation-layers/src" + +# Optional path to a one-liner version file. Default is empty path indicating +# that git should be used to figure out the version. +dawn_version_file = "" diff --git a/build_overrides/tint.gni b/build_overrides/tint.gni index 8349998e9f..6a6556644e 100644 --- a/build_overrides/tint.gni +++ b/build_overrides/tint.gni @@ -19,3 +19,5 @@ tint_build_spv_reader = true tint_build_spv_writer = true tint_build_wgsl_reader = true tint_build_wgsl_writer = true + +tint_build_unittests = true diff --git a/build_overrides/wayland.gni b/build_overrides/wayland.gni new file mode 100644 index 0000000000..fa71520150 --- /dev/null +++ b/build_overrides/wayland.gni @@ -0,0 +1,19 @@ +# Copyright 2022 The Dawn Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/config/ozone.gni") + +# Dawn has no wayland third-party dir +use_system_libwayland = true +wayland_gn_dir = "" diff --git a/dawn.json b/dawn.json index 7d8a79ee91..e07bb57b75 100644 --- a/dawn.json +++ b/dawn.json @@ -108,7 +108,7 @@ { "name": "request device", "args": [ - {"name": "descriptor", "type": "device descriptor", "annotation": "const*"}, + {"name": "descriptor", "type": "device descriptor", "annotation": "const*", "optional": true, "no_default": true}, {"name": "callback", "type": "request device callback"}, {"name": "userdata", "type": "void", "annotation": "*"} ] @@ -118,7 +118,7 @@ "tags": ["dawn"], "returns": "device", "args": [ - {"name": "descriptor", "type": "device descriptor", "annotation": "const*", "optional": "true"} + {"name": "descriptor", "type": "device descriptor", "annotation": "const*", "optional": true} ] } ] @@ -128,6 +128,8 @@ "extensible": "out", "members": [ {"name": "vendor ID", "type": "uint32_t"}, + {"name": "vendor name", "type": "char", "annotation": "const*", "length": "strlen"}, + {"name": "architecture", "type": "char", "annotation": "const*", "length": "strlen"}, {"name": "device ID", "type": "uint32_t"}, {"name": "name", "type": "char", "annotation": "const*", "length": "strlen"}, {"name": "driver description", "type": "char", "annotation": "const*", "length": "strlen"}, @@ -160,6 +162,7 @@ "tags": ["dawn", "native"], "category": "structure", "chained": "in", + "chain roots": ["device descriptor"], "members": [ {"name": "force enabled toggles count", "type": "uint32_t", "default": 0}, {"name": "force enabled toggles", "type": "char", "annotation": "const*const*", "length": "force enabled toggles count"}, @@ -171,6 +174,7 @@ "tags": ["dawn", "native"], "category": "structure", "chained": "in", + "chain roots": ["device descriptor"], "members": [ {"name": "isolation key", "type": "char", "annotation": "const*", "length": "strlen", "default": "\"\""} ] @@ -304,6 +308,7 @@ "external texture binding entry": { "category": "structure", "chained": "in", + "chain roots": ["bind group entry"], "tags": ["dawn"], "members": [ {"name": "external texture", "type": "external texture"} @@ -313,6 +318,7 @@ "external texture binding layout": { "category": "structure", "chained": "in", + "chain roots": ["bind group layout entry"], "tags": ["dawn"], "members": [] }, @@ -431,6 +437,14 @@ {"name": "label", "type": "char", "annotation": "const*", "length": "strlen"} ] }, + { + "name": "get usage", + "returns": "buffer usage" + }, + { + "name": "get size", + "returns": "uint64_t" + }, { "name": "unmap" }, @@ -894,7 +908,8 @@ "tags": ["dawn"], "values": [ {"value": 0, "name": "premultiplied"}, - {"value": 1, "name": "unpremultiplied"} + {"value": 1, "name": "unpremultiplied"}, + {"value": 2, "name": "opaque"} ] }, "copy texture for browser options": { @@ -912,7 +927,8 @@ "length": 9, "optional": true}, {"name": "dst transfer function parameters", "type": "float", "annotation": "const*", "length": 7, "optional": true}, - {"name": "dst alpha mode", "type": "alpha mode", "default": "unpremultiplied"} + {"name": "dst alpha mode", "type": "alpha mode", "default": "unpremultiplied"}, + {"name": "internal usage", "type": "bool", "default": "false"} ] }, "create compute pipeline async callback": { @@ -1012,6 +1028,11 @@ {"name": "external texture descriptor", "type": "external texture descriptor", "annotation": "const*"} ] }, + { + "name": "create error external texture", + "returns": "external texture", + "tags": ["dawn"] + }, { "name": "create pipeline layout", "returns": "pipeline layout", @@ -1065,12 +1086,22 @@ }, { "name": "create swap chain", + "tags": ["dawn"], "returns": "swap chain", "args": [ {"name": "surface", "type": "surface", "optional": true}, {"name": "descriptor", "type": "swap chain descriptor", "annotation": "const*"} ] }, + { + "name": "create swap chain", + "tags": ["upstream", "emscripten"], + "returns": "swap chain", + "args": [ + {"name": "surface", "type": "surface"}, + {"name": "descriptor", "type": "swap chain descriptor", "annotation": "const*"} + ] + }, { "name": "create texture", "returns": "texture", @@ -1078,6 +1109,14 @@ {"name": "descriptor", "type": "texture descriptor", "annotation": "const*"} ] }, + { + "name": "create error texture", + "returns": "texture", + "tags": ["dawn"], + "args": [ + {"name": "descriptor", "type": "texture descriptor", "annotation": "const*"} + ] + }, { "name": "destroy" }, @@ -1102,6 +1141,11 @@ {"name": "features", "type": "feature name", "annotation": "*"} ] }, + { + "name": "get adapter", + "returns": "adapter", + "tags": ["dawn"] + }, { "name": "get queue", "returns": "queue" @@ -1183,30 +1227,6 @@ {"value": 1, "name": "destroyed"} ] }, - "device properties": { - "category": "structure", - "extensible": false, - "tags": ["dawn"], - "members": [ - {"name": "device ID", "type": "uint32_t"}, - {"name": "vendor ID", "type": "uint32_t"}, - {"name": "adapter type", "type": "adapter type"}, - {"name": "texture compression BC", "type": "bool", "default": "false"}, - {"name": "texture compression ETC2", "type": "bool", "default": "false"}, - {"name": "texture compression ASTC", "type": "bool", "default": "false"}, - {"name": "shader float16", "type": "bool", "default": "false"}, - {"name": "pipeline statistics query", "type": "bool", "default": "false"}, - {"name": "timestamp query", "type": "bool", "default": "false"}, - {"name": "multi planar formats", "type": "bool", "default": "false"}, - {"name": "depth clamping", "type": "bool", "default": "false"}, - {"name": "depth24 unorm stencil8", "type": "bool", "default": "false"}, - {"name": "depth32 float stencil8", "type": "bool", "default": "false"}, - {"name": "invalid feature", "type": "bool", "default": "false"}, - {"name": "dawn internal usages", "type": "bool", "default": "false"}, - {"name": "dawn native", "type": "bool", "default": "false"}, - {"name": "limits", "type": "supported limits"} - ] - }, "double": { "category": "native" }, @@ -1241,6 +1261,8 @@ {"name": "max vertex attributes", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"}, {"name": "max vertex buffer array stride", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"}, {"name": "max inter stage shader components", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"}, + {"name": "max inter stage shader variables", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"}, + {"name": "max color attachments", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"}, {"name": "max compute workgroup storage size", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"}, {"name": "max compute invocations per workgroup", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"}, {"name": "max compute workgroup size x", "type": "uint32_t", "default": "WGPU_LIMIT_U32_UNDEFINED"}, @@ -1333,35 +1355,34 @@ {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "plane 0", "type": "texture view"}, {"name": "plane 1", "type": "texture view", "optional": true}, + {"name": "do yuv to rgb conversion only", "type": "bool", "default": "false"}, {"name": "yuv to rgb conversion matrix", "type": "float", "annotation": "const*", "length": 12, "optional": true}, {"name": "src transfer function parameters", "type": "float", "annotation": "const*", - "length": 7, "optional": true}, + "length": 7}, {"name": "dst transfer function parameters", "type": "float", "annotation": "const*", - "length": 7, "optional": true}, + "length": 7}, {"name": "gamut conversion matrix", "type": "float", "annotation": "const*", - "length": 9, "optional": true}, - {"name": "color space", "type": "predefined color space", "default": "srgb"} + "length": 9} ] }, "feature name": { "category": "enum", "values": [ {"value": 0, "name": "undefined", "jsrepr": "undefined"}, - {"value": 1, "name": "depth clip control", "tags": ["upstream", "emscripten"]}, - {"value": 2, "name": "depth24 unorm stencil8"}, - {"value": 3, "name": "depth32 float stencil8"}, - {"value": 4, "name": "timestamp query"}, - {"value": 5, "name": "pipeline statistics query"}, - {"value": 6, "name": "texture compression BC"}, - {"value": 7, "name": "texture compression ETC2"}, - {"value": 8, "name": "texture compression ASTC"}, - {"value": 9, "name": "indirect first instance"}, - {"value": 1000, "name": "depth clamping", "tags": ["emscripten", "dawn"]}, + {"value": 1, "name": "depth clip control"}, + {"value": 2, "name": "depth32 float stencil8"}, + {"value": 3, "name": "timestamp query"}, + {"value": 4, "name": "pipeline statistics query"}, + {"value": 5, "name": "texture compression BC"}, + {"value": 6, "name": "texture compression ETC2"}, + {"value": 7, "name": "texture compression ASTC"}, + {"value": 8, "name": "indirect first instance"}, {"value": 1001, "name": "dawn shader float 16", "tags": ["dawn"]}, {"value": 1002, "name": "dawn internal usages", "tags": ["dawn"]}, {"value": 1003, "name": "dawn multi planar formats", "tags": ["dawn"]}, - {"value": 1004, "name": "dawn native", "tags": ["dawn", "native"]} + {"value": 1004, "name": "dawn native", "tags": ["dawn", "native"]}, + {"value": 1005, "name": "chromium experimental dp4a", "tags": ["dawn"]} ] }, "filter mode": { @@ -1424,7 +1445,7 @@ { "name": "request adapter", "args": [ - {"name": "options", "type": "request adapter options", "annotation": "const*"}, + {"name": "options", "type": "request adapter options", "annotation": "const*", "optional": true, "no_default": true}, {"name": "callback", "type": "request adapter callback"}, {"name": "userdata", "type": "void", "annotation": "*"} ] @@ -1440,6 +1461,7 @@ "tags": ["dawn", "native"], "category": "structure", "chained": "in", + "chain roots": ["instance descriptor"], "members": [ {"name": "additional runtime search paths count", "type": "uint32_t", "default": 0}, {"name": "additional runtime search paths", "type": "char", "annotation": "const*const*", "length": "additional runtime search paths count"} @@ -1468,7 +1490,8 @@ "category": "enum", "values": [ {"value": 0, "name": "vertex"}, - {"value": 1, "name": "instance"} + {"value": 1, "name": "instance"}, + {"value": 2, "name": "vertex buffer not used", "jsrepr": "undefined", "valid": true} ] }, "load op": { @@ -1550,13 +1573,6 @@ {"value": 2, "name": "high performance"} ] }, - "predefined color space": { - "category": "enum", - "values": [ - {"value": 0, "name": "undefined", "jsrepr": "undefined"}, - {"value": 1, "name": "srgb"} - ] - }, "present mode": { "category": "enum", "emscripten_no_enum_table": true, @@ -1596,6 +1612,14 @@ {"name": "label", "type": "char", "annotation": "const*", "length": "strlen"} ] }, + { + "name": "get type", + "returns": "query type" + }, + { + "name": "get count", + "returns": "uint32_t" + }, { "name": "destroy" } @@ -1881,6 +1905,14 @@ {"name": "timestamp writes", "type": "render pass timestamp write", "annotation": "const*", "length": "timestamp write count"} ] }, + "render pass descriptor max draw count": { + "category": "structure", + "chained": "in", + "chain roots": ["render pass descriptor"], + "members": [ + {"name": "max draw count", "type": "uint64_t", "default": 50000000} + ] + }, "render pass encoder": { "category": "object", "methods": [ @@ -2130,19 +2162,10 @@ ] }, - "primitive depth clamping state": { - "category": "structure", - "chained": "in", - "tags": ["dawn", "emscripten"], - "members": [ - {"name": "clamp depth", "type": "bool", "default": "false"} - ] - }, - "primitive depth clip control": { "category": "structure", "chained": "in", - "tags": ["upstream", "emscripten"], + "chain roots": ["primitive state"], "members": [ {"name": "unclipped depth", "type": "bool", "default": "false"} ] @@ -2289,6 +2312,7 @@ "shader module SPIRV descriptor": { "category": "structure", "chained": "in", + "chain roots": ["shader module descriptor"], "members": [ {"name": "code size", "type": "uint32_t"}, {"name": "code", "type": "uint32_t", "annotation": "const*", "length": "code size"} @@ -2297,6 +2321,7 @@ "shader module WGSL descriptor": { "category": "structure", "chained": "in", + "chain roots": ["shader module descriptor"], "members": [ {"name": "source", "type": "char", "annotation": "const*", "length": "strlen", "tags": ["dawn", "emscripten"]}, {"name": "code", "type": "char", "annotation": "const*", "length": "strlen", "tags": ["upstream"]} @@ -2357,6 +2382,7 @@ "surface descriptor from android native window": { "category": "structure", "chained": "in", + "chain roots": ["surface descriptor"], "tags": ["native"], "members": [ {"name": "window", "type": "void", "annotation": "*"} @@ -2365,6 +2391,7 @@ "surface descriptor from canvas HTML selector": { "category": "structure", "chained": "in", + "chain roots": ["surface descriptor"], "members": [ {"name": "selector", "type": "char", "annotation": "const*", "length": "strlen"} ] @@ -2372,6 +2399,7 @@ "surface descriptor from metal layer": { "category": "structure", "chained": "in", + "chain roots": ["surface descriptor"], "tags": ["native"], "members": [ {"name": "layer", "type": "void", "annotation": "*"} @@ -2380,6 +2408,7 @@ "surface descriptor from windows HWND": { "category": "structure", "chained": "in", + "chain roots": ["surface descriptor"], "tags": ["native"], "members": [ {"name": "hinstance", "type": "void", "annotation": "*"}, @@ -2389,6 +2418,7 @@ "surface descriptor from xcb window": { "category": "structure", "chained": "in", + "chain roots": ["surface descriptor"], "tags": ["upstream"], "members": [ {"name": "connection", "type": "void", "annotation": "*"}, @@ -2398,6 +2428,7 @@ "surface descriptor from xlib window": { "category": "structure", "chained": "in", + "chain roots": ["surface descriptor"], "tags": ["native"], "members": [ {"name": "display", "type": "void", "annotation": "*"}, @@ -2407,6 +2438,7 @@ "surface descriptor from wayland surface": { "category": "structure", "chained": "in", + "chain roots": ["surface descriptor"], "tags": ["native"], "members": [ {"name": "display", "type": "void", "annotation": "*"}, @@ -2416,6 +2448,7 @@ "surface descriptor from windows core window": { "category": "structure", "chained": "in", + "chain roots": ["surface descriptor"], "tags": ["dawn"], "members": [ {"name": "core window", "type": "void", "annotation": "*"} @@ -2424,6 +2457,7 @@ "surface descriptor from windows swap chain panel": { "category": "structure", "chained": "in", + "chain roots": ["surface descriptor"], "tags": ["dawn"], "members": [ {"name": "swap chain panel", "type": "void", "annotation": "*"} @@ -2470,7 +2504,7 @@ {"value": 4, "name": "surface descriptor from canvas HTML selector"}, {"value": 5, "name": "shader module SPIRV descriptor"}, {"value": 6, "name": "shader module WGSL descriptor"}, - {"value": 7, "name": "primitive depth clip control", "tags": ["upstream", "emscripten"]}, + {"value": 7, "name": "primitive depth clip control"}, {"value": 8, "name": "surface descriptor from wayland surface", "tags": ["native"]}, {"value": 9, "name": "surface descriptor from android native window", "tags": ["native"]}, {"value": 10, "name": "surface descriptor from xcb window", "tags": ["upstream"]}, @@ -2478,8 +2512,8 @@ {"value": 12, "name": "external texture binding entry", "tags": ["dawn"]}, {"value": 13, "name": "external texture binding layout", "tags": ["dawn"]}, {"value": 14, "name": "surface descriptor from windows swap chain panel", "tags": ["dawn"]}, + {"value": 15, "name": "render pass descriptor max draw count"}, {"value": 1000, "name": "dawn texture internal usage descriptor", "tags": ["dawn"]}, - {"value": 1001, "name": "primitive depth clamping state", "tags": ["dawn", "emscripten"]}, {"value": 1002, "name": "dawn toggles device descriptor", "tags": ["dawn", "native"]}, {"value": 1003, "name": "dawn encoder internal usage descriptor", "tags": ["dawn"]}, {"value": 1004, "name": "dawn instance descriptor", "tags": ["dawn", "native"]}, @@ -2503,6 +2537,38 @@ {"name": "label", "type": "char", "annotation": "const*", "length": "strlen"} ] }, + { + "name": "get width", + "returns": "uint32_t" + }, + { + "name": "get height", + "returns": "uint32_t" + }, + { + "name": "get depth or array layers", + "returns": "uint32_t" + }, + { + "name": "get mip level count", + "returns": "uint32_t" + }, + { + "name": "get sample count", + "returns": "uint32_t" + }, + { + "name": "get dimension", + "returns": "texture dimension" + }, + { + "name": "get format", + "returns": "texture format" + }, + { + "name": "get usage", + "returns": "texture usage" + }, { "name": "destroy" } @@ -2609,66 +2675,65 @@ {"value": 38, "name": "depth16 unorm"}, {"value": 39, "name": "depth24 plus"}, {"value": 40, "name": "depth24 plus stencil8"}, - {"value": 41, "name": "depth24 unorm stencil8"}, - {"value": 42, "name": "depth32 float"}, - {"value": 43, "name": "depth32 float stencil8"}, + {"value": 41, "name": "depth32 float"}, + {"value": 42, "name": "depth32 float stencil8"}, - {"value": 44, "name": "BC1 RGBA unorm", "jsrepr": "'bc1-rgba-unorm'"}, - {"value": 45, "name": "BC1 RGBA unorm srgb", "jsrepr": "'bc1-rgba-unorm-srgb'"}, - {"value": 46, "name": "BC2 RGBA unorm", "jsrepr": "'bc2-rgba-unorm'"}, - {"value": 47, "name": "BC2 RGBA unorm srgb", "jsrepr": "'bc2-rgba-unorm-srgb'"}, - {"value": 48, "name": "BC3 RGBA unorm", "jsrepr": "'bc3-rgba-unorm'"}, - {"value": 49, "name": "BC3 RGBA unorm srgb", "jsrepr": "'bc3-rgba-unorm-srgb'"}, - {"value": 50, "name": "BC4 R unorm", "jsrepr": "'bc4-r-unorm'"}, - {"value": 51, "name": "BC4 R snorm", "jsrepr": "'bc4-r-snorm'"}, - {"value": 52, "name": "BC5 RG unorm", "jsrepr": "'bc5-rg-unorm'"}, - {"value": 53, "name": "BC5 RG snorm", "jsrepr": "'bc5-rg-snorm'"}, - {"value": 54, "name": "BC6H RGB ufloat", "jsrepr": "'bc6h-rgb-ufloat'"}, - {"value": 55, "name": "BC6H RGB float", "jsrepr": "'bc6h-rgb-float'"}, - {"value": 56, "name": "BC7 RGBA unorm", "jsrepr": "'bc7-rgba-unorm'"}, - {"value": 57, "name": "BC7 RGBA unorm srgb", "jsrepr": "'bc7-rgba-unorm-srgb'"}, + {"value": 43, "name": "BC1 RGBA unorm", "jsrepr": "'bc1-rgba-unorm'"}, + {"value": 44, "name": "BC1 RGBA unorm srgb", "jsrepr": "'bc1-rgba-unorm-srgb'"}, + {"value": 45, "name": "BC2 RGBA unorm", "jsrepr": "'bc2-rgba-unorm'"}, + {"value": 46, "name": "BC2 RGBA unorm srgb", "jsrepr": "'bc2-rgba-unorm-srgb'"}, + {"value": 47, "name": "BC3 RGBA unorm", "jsrepr": "'bc3-rgba-unorm'"}, + {"value": 48, "name": "BC3 RGBA unorm srgb", "jsrepr": "'bc3-rgba-unorm-srgb'"}, + {"value": 49, "name": "BC4 R unorm", "jsrepr": "'bc4-r-unorm'"}, + {"value": 50, "name": "BC4 R snorm", "jsrepr": "'bc4-r-snorm'"}, + {"value": 51, "name": "BC5 RG unorm", "jsrepr": "'bc5-rg-unorm'"}, + {"value": 52, "name": "BC5 RG snorm", "jsrepr": "'bc5-rg-snorm'"}, + {"value": 53, "name": "BC6H RGB ufloat", "jsrepr": "'bc6h-rgb-ufloat'"}, + {"value": 54, "name": "BC6H RGB float", "jsrepr": "'bc6h-rgb-float'"}, + {"value": 55, "name": "BC7 RGBA unorm", "jsrepr": "'bc7-rgba-unorm'"}, + {"value": 56, "name": "BC7 RGBA unorm srgb", "jsrepr": "'bc7-rgba-unorm-srgb'"}, - {"value": 58, "name": "ETC2 RGB8 unorm", "jsrepr": "'etc2-rgb8unorm'"}, - {"value": 59, "name": "ETC2 RGB8 unorm srgb", "jsrepr": "'etc2-rgb8unorm-srgb'"}, - {"value": 60, "name": "ETC2 RGB8A1 unorm", "jsrepr": "'etc2-rgb8a1unorm'"}, - {"value": 61, "name": "ETC2 RGB8A1 unorm srgb", "jsrepr": "'etc2-rgb8a1unorm-srgb'"}, - {"value": 62, "name": "ETC2 RGBA8 unorm", "jsrepr": "'etc2-rgba8unorm'"}, - {"value": 63, "name": "ETC2 RGBA8 unorm srgb", "jsrepr": "'etc2-rgba8unorm-srgb'"}, - {"value": 64, "name": "EAC R11 unorm", "jsrepr": "'eac-r11unorm'"}, - {"value": 65, "name": "EAC R11 snorm", "jsrepr": "'eac-r11snorm'"}, - {"value": 66, "name": "EAC RG11 unorm", "jsrepr": "'eac-rg11unorm'"}, - {"value": 67, "name": "EAC RG11 snorm", "jsrepr": "'eac-rg11snorm'"}, + {"value": 57, "name": "ETC2 RGB8 unorm", "jsrepr": "'etc2-rgb8unorm'"}, + {"value": 58, "name": "ETC2 RGB8 unorm srgb", "jsrepr": "'etc2-rgb8unorm-srgb'"}, + {"value": 59, "name": "ETC2 RGB8A1 unorm", "jsrepr": "'etc2-rgb8a1unorm'"}, + {"value": 60, "name": "ETC2 RGB8A1 unorm srgb", "jsrepr": "'etc2-rgb8a1unorm-srgb'"}, + {"value": 61, "name": "ETC2 RGBA8 unorm", "jsrepr": "'etc2-rgba8unorm'"}, + {"value": 62, "name": "ETC2 RGBA8 unorm srgb", "jsrepr": "'etc2-rgba8unorm-srgb'"}, + {"value": 63, "name": "EAC R11 unorm", "jsrepr": "'eac-r11unorm'"}, + {"value": 64, "name": "EAC R11 snorm", "jsrepr": "'eac-r11snorm'"}, + {"value": 65, "name": "EAC RG11 unorm", "jsrepr": "'eac-rg11unorm'"}, + {"value": 66, "name": "EAC RG11 snorm", "jsrepr": "'eac-rg11snorm'"}, - {"value": 68, "name": "ASTC 4x4 unorm", "jsrepr": "'astc-4x4-unorm'"}, - {"value": 69, "name": "ASTC 4x4 unorm srgb", "jsrepr": "'astc-4x4-unorm-srgb'"}, - {"value": 70, "name": "ASTC 5x4 unorm", "jsrepr": "'astc-5x4-unorm'"}, - {"value": 71, "name": "ASTC 5x4 unorm srgb", "jsrepr": "'astc-5x4-unorm-srgb'"}, - {"value": 72, "name": "ASTC 5x5 unorm", "jsrepr": "'astc-5x5-unorm'"}, - {"value": 73, "name": "ASTC 5x5 unorm srgb", "jsrepr": "'astc-5x5-unorm-srgb'"}, - {"value": 74, "name": "ASTC 6x5 unorm", "jsrepr": "'astc-6x5-unorm'"}, - {"value": 75, "name": "ASTC 6x5 unorm srgb", "jsrepr": "'astc-6x5-unorm-srgb'"}, - {"value": 76, "name": "ASTC 6x6 unorm", "jsrepr": "'astc-6x6-unorm'"}, - {"value": 77, "name": "ASTC 6x6 unorm srgb", "jsrepr": "'astc-6x6-unorm-srgb'"}, - {"value": 78, "name": "ASTC 8x5 unorm", "jsrepr": "'astc-8x5-unorm'"}, - {"value": 79, "name": "ASTC 8x5 unorm srgb", "jsrepr": "'astc-8x5-unorm-srgb'"}, - {"value": 80, "name": "ASTC 8x6 unorm", "jsrepr": "'astc-8x6-unorm'"}, - {"value": 81, "name": "ASTC 8x6 unorm srgb", "jsrepr": "'astc-8x6-unorm-srgb'"}, - {"value": 82, "name": "ASTC 8x8 unorm", "jsrepr": "'astc-8x8-unorm'"}, - {"value": 83, "name": "ASTC 8x8 unorm srgb", "jsrepr": "'astc-8x8-unorm-srgb'"}, - {"value": 84, "name": "ASTC 10x5 unorm", "jsrepr": "'astc-10x5-unorm'"}, - {"value": 85, "name": "ASTC 10x5 unorm srgb", "jsrepr": "'astc-10x5-unorm-srgb'"}, - {"value": 86, "name": "ASTC 10x6 unorm", "jsrepr": "'astc-10x6-unorm'"}, - {"value": 87, "name": "ASTC 10x6 unorm srgb", "jsrepr": "'astc-10x6-unorm-srgb'"}, - {"value": 88, "name": "ASTC 10x8 unorm", "jsrepr": "'astc-10x8-unorm'"}, - {"value": 89, "name": "ASTC 10x8 unorm srgb", "jsrepr": "'astc-10x8-unorm-srgb'"}, - {"value": 90, "name": "ASTC 10x10 unorm", "jsrepr": "'astc-10x10-unorm'"}, - {"value": 91, "name": "ASTC 10x10 unorm srgb", "jsrepr": "'astc-10x10-unorm-srgb'"}, - {"value": 92, "name": "ASTC 12x10 unorm", "jsrepr": "'astc-12x10-unorm'"}, - {"value": 93, "name": "ASTC 12x10 unorm srgb", "jsrepr": "'astc-12x10-unorm-srgb'"}, - {"value": 94, "name": "ASTC 12x12 unorm", "jsrepr": "'astc-12x12-unorm'"}, - {"value": 95, "name": "ASTC 12x12 unorm srgb", "jsrepr": "'astc-12x12-unorm-srgb'"}, + {"value": 67, "name": "ASTC 4x4 unorm", "jsrepr": "'astc-4x4-unorm'"}, + {"value": 68, "name": "ASTC 4x4 unorm srgb", "jsrepr": "'astc-4x4-unorm-srgb'"}, + {"value": 69, "name": "ASTC 5x4 unorm", "jsrepr": "'astc-5x4-unorm'"}, + {"value": 70, "name": "ASTC 5x4 unorm srgb", "jsrepr": "'astc-5x4-unorm-srgb'"}, + {"value": 71, "name": "ASTC 5x5 unorm", "jsrepr": "'astc-5x5-unorm'"}, + {"value": 72, "name": "ASTC 5x5 unorm srgb", "jsrepr": "'astc-5x5-unorm-srgb'"}, + {"value": 73, "name": "ASTC 6x5 unorm", "jsrepr": "'astc-6x5-unorm'"}, + {"value": 74, "name": "ASTC 6x5 unorm srgb", "jsrepr": "'astc-6x5-unorm-srgb'"}, + {"value": 75, "name": "ASTC 6x6 unorm", "jsrepr": "'astc-6x6-unorm'"}, + {"value": 76, "name": "ASTC 6x6 unorm srgb", "jsrepr": "'astc-6x6-unorm-srgb'"}, + {"value": 77, "name": "ASTC 8x5 unorm", "jsrepr": "'astc-8x5-unorm'"}, + {"value": 78, "name": "ASTC 8x5 unorm srgb", "jsrepr": "'astc-8x5-unorm-srgb'"}, + {"value": 79, "name": "ASTC 8x6 unorm", "jsrepr": "'astc-8x6-unorm'"}, + {"value": 80, "name": "ASTC 8x6 unorm srgb", "jsrepr": "'astc-8x6-unorm-srgb'"}, + {"value": 81, "name": "ASTC 8x8 unorm", "jsrepr": "'astc-8x8-unorm'"}, + {"value": 82, "name": "ASTC 8x8 unorm srgb", "jsrepr": "'astc-8x8-unorm-srgb'"}, + {"value": 83, "name": "ASTC 10x5 unorm", "jsrepr": "'astc-10x5-unorm'"}, + {"value": 84, "name": "ASTC 10x5 unorm srgb", "jsrepr": "'astc-10x5-unorm-srgb'"}, + {"value": 85, "name": "ASTC 10x6 unorm", "jsrepr": "'astc-10x6-unorm'"}, + {"value": 86, "name": "ASTC 10x6 unorm srgb", "jsrepr": "'astc-10x6-unorm-srgb'"}, + {"value": 87, "name": "ASTC 10x8 unorm", "jsrepr": "'astc-10x8-unorm'"}, + {"value": 88, "name": "ASTC 10x8 unorm srgb", "jsrepr": "'astc-10x8-unorm-srgb'"}, + {"value": 89, "name": "ASTC 10x10 unorm", "jsrepr": "'astc-10x10-unorm'"}, + {"value": 90, "name": "ASTC 10x10 unorm srgb", "jsrepr": "'astc-10x10-unorm-srgb'"}, + {"value": 91, "name": "ASTC 12x10 unorm", "jsrepr": "'astc-12x10-unorm'"}, + {"value": 92, "name": "ASTC 12x10 unorm srgb", "jsrepr": "'astc-12x10-unorm-srgb'"}, + {"value": 93, "name": "ASTC 12x12 unorm", "jsrepr": "'astc-12x12-unorm'"}, + {"value": 94, "name": "ASTC 12x12 unorm srgb", "jsrepr": "'astc-12x12-unorm-srgb'"}, - {"value": 96, "name": "R8 BG8 Biplanar 420 unorm", "tags": ["dawn"]} + {"value": 95, "name": "R8 BG8 Biplanar 420 unorm", "tags": ["dawn"]} ] }, "texture usage": { @@ -2841,6 +2906,7 @@ "dawn texture internal usage descriptor": { "category": "structure", "chained": "in", + "chain roots": ["texture descriptor"], "tags": ["dawn"], "members": [ {"name": "internal usage", "type": "texture usage", "default": "none"} @@ -2849,6 +2915,7 @@ "dawn encoder internal usage descriptor": { "category": "structure", "chained": "in", + "chain roots": ["command encoder descriptor"], "tags": ["dawn"], "members": [ {"name": "use internal usages", "type": "bool", "default": "false"} diff --git a/dawn_wire.json b/dawn_wire.json index 2e2318efb1..c26d4cdcad 100644 --- a/dawn_wire.json +++ b/dawn_wire.json @@ -189,6 +189,8 @@ "BufferMapAsync", "BufferGetConstMappedRange", "BufferGetMappedRange", + "BufferGetSize", + "BufferGetUsage", "DeviceCreateBuffer", "DeviceCreateComputePipelineAsync", "DeviceCreateRenderPipelineAsync", @@ -201,14 +203,28 @@ "DeviceSetLoggingCallback", "InstanceRequestAdapter", "ShaderModuleGetCompilationInfo", + "QuerySetGetType", + "QuerySetGetCount", "QueueOnSubmittedWorkDone", "QueueWriteBuffer", - "QueueWriteTexture" + "QueueWriteTexture", + "TextureGetWidth", + "TextureGetHeight", + "TextureGetDepthOrArrayLayers", + "TextureGetMipLevelCount", + "TextureGetSampleCount", + "TextureGetDimension", + "TextureGetFormat", + "TextureGetUsage" ], "client_handwritten_commands": [ "BufferDestroy", "BufferUnmap", "DeviceCreateErrorBuffer", + "DeviceCreateQuerySet", + "DeviceCreateTexture", + "DeviceCreateErrorTexture", + "DeviceGetAdapter", "DeviceGetQueue", "DeviceInjectError" ], @@ -217,8 +233,10 @@ "Buffer", "Device", "Instance", + "QuerySet", "Queue", - "ShaderModule" + "ShaderModule", + "Texture" ], "server_custom_pre_handler_commands": [ "BufferDestroy", diff --git a/docs/clang-tidy.md b/docs/clang-tidy.md new file mode 100644 index 0000000000..e2f9738c7f --- /dev/null +++ b/docs/clang-tidy.md @@ -0,0 +1,37 @@ +# Running clang-tidy + +* Add `"checkout_clang_tidy": True` to `.gclient` file in the `custom_vars`. + ``` + { + "custom_vars": { + "checkout_clang_tidy": True, + } + } + ``` +* `gclient sync` + +There should now be `third_party/llvm-build/Release+Asserts/bin/clang-tidy` + +* `cd out` +* `git clone https://chromium.googlesource.com/chromium/tools/build` + +The Chromium build folder contains the `tricium` files used to run `clang-tidy` + +Running clang-tidy over all the source can be done with: + +``` +cd .. +out/build/recipes/recipe_modules/tricium_clang_tidy/resources/tricium_clang_tidy_script.py \ +--base_path $PWD \ +--out_dir out/Debug \ +--findings_file all_findings.json \ +--clang_tidy_binary $PWD/third_party/llvm-build/Release+Asserts/bin/clang-tidy \ +--all +``` + +`--all` can be replaced by specific files if desired to run on individual source +files. + + +## References +* https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/clang_tidy.md diff --git a/docs/dawn/codegen.md b/docs/dawn/codegen.md index 315364c07b..1bded3f7a7 100644 --- a/docs/dawn/codegen.md +++ b/docs/dawn/codegen.md @@ -42,7 +42,7 @@ A **record** is a list of **record members**, each of which is a dictionary with - `"type"` a string, the name of the base type for this member - `"annotation"` a string, default to "value". Define the C annotation to apply to the base type. Allowed annotations are `"value"` (the default), `"*"`, `"const*"` - `"length"` (default to 1 if not set), a string. Defines length of the array pointed to for pointer arguments. If not set the length is implicitly 1 (so not an array), but otherwise it can be set to the name of another member in the same record that will contain the length of the array (this is heavily used in the `fooCount` `foos` pattern in the API). As a special case `"strlen"` can be used for `const char*` record members to denote that the length should be determined with `strlen`. - - `"optional"` (default to false) a boolean that says whether this member is optional. Member records can be optional if they are pointers (otherwise dawn_wire will always try to dereference them), objects (otherwise dawn_wire will always try to encode their ID and crash), or if they have a `"default"` key. Optional pointers and objects will always default to `nullptr`. + - `"optional"` (default to false) a boolean that says whether this member is optional. Member records can be optional if they are pointers (otherwise dawn_wire will always try to dereference them), objects (otherwise dawn_wire will always try to encode their ID and crash), or if they have a `"default"` key. Optional pointers and objects will always default to `nullptr` (unless `"no_default"` is set to `true`). - `"default"` (optional) a number or string. If set the record member will use that value as default value. Depending on the member's category it can be a number, a string containing a number, or the name of an enum/bitmask value. - `"wire_is_data_only"` (default to false) a boolean that says whether it is safe to directly return a pointer of this member that is pointing to a piece of memory in the transfer buffer into dawn_wire. To prevent TOCTOU attacks, by default in dawn_wire we must ensure every single value returned to dawn_native a copy of what's in the wire, so `"wire_is_data_only"` is set to true only when the member is data-only and don't impact control flow. @@ -68,7 +68,8 @@ A **record** is a list of **record members**, each of which is a dictionary with **`"structure"`** - `"members"` a **record**, so an array of **record members** - `"extensible"` (defaults to false) a boolean defining if this is an "extensible" WebGPU structure (i.e. has `nextInChain`). "descriptor" structures should usually have this set to true. - - `"chained"` (defaults to false) a boolean defining if this is a structure that can be "chained" in a WebGPU structure (i.e. has `nextInChain` and `sType`) + - `"chained"` (defaults to None) a string defining if this is a structure that can be "chained" in a WebGPU structure (i.e. has `nextInChain` and `sType`) and in which direction ('in' for inputs to WebGPU, 'out' for outputs) + - `"chain roots"` (defaults to []) a list of strings that are the canonical names of structures that can be extended by this structure. **`"object"`** - `**methods**` an array of methods for this object. Note that "release" and "reference" don't need to be specified. Each method is a dictionary containing: diff --git a/docs/support.md b/docs/support.md new file mode 100644 index 0000000000..c4e38bff53 --- /dev/null +++ b/docs/support.md @@ -0,0 +1,54 @@ +# Platform and API support for Dawn/Tint + +## Khronos's Vulkan + +Vulkan is supported with minimal features, limits and extensions being required (what's required has been measured to be wildly available). +Vulkan is the preferred target API on platforms that don't have other "modern" GPU APIs. +Vulkan is supported as best effort on other platforms (e.g. Windows and macOS). + +**Required version**: Vulkan 1.0 is supported with some required extensions (`VK_KHR_maintenance1`), or Vulkan 1.1 and above without extensions. + +**Required features**: `depthBiasClamp`, `fragmentStoresAndAtomics`, `fullDrawIndexUint32`, `imageCubeArray`, `independentBlend`, `sampleRateShading`, and either `textureCompressionBC` or both of `textureCompressionETC` and `textureCompressionASTC_LDR`. + +**Required limites**: they are too detailed to describe here, but in general should be wildly supported. +See the [WebGPU limits](https://gpuweb.github.io/gpuweb/#limits) that mostly correspond to Vulkan limits. + +**Operating system support**: + + - Linux: Supported. + - ChromeOS: Supported. + - Android: Work in progress. + - Fuchsia: Work in progress. + +## Microsoft's D3D12 + +D3D12 is supported with feature level 11.1, or feature level 11.0 with Resource Binding Tier 2. +This is the vast majority of D3D12 devices. +Supported shader models are 5.1 and above. It is the preferred target API when available. + +**Windows flavor support**: + + - Win32: Supported. + - UWP: Supported, best effort. + - Xbox: Not supported, contributions welcome. + +## Apple's Metal + +Metal is supported and is the preferred target API when available. + +**Apple OS support:** + + - macOS: supported. + - iOS: supported, best effort. + - tvOS/ipadOS/...: Not supported, contributions welcome. + +## Khronos's OpenGL family + +Support for OpenGL is in progress with the aim to make OpenGL ES 3.1 (with extensions and limits) supported through EGL. +Other flavors of OpenGL (desktop OpenGL) or binding APIs (GLX, WGL, EAGL, CGL) are supported as best effort with contributions welcome. + + +## Microsoft's D3D12 + +Dawn doesn't have a D3D11 backend at the moment, but D3D11 support can be achieved with the OpenGL ES backend through ANGLE's OpenGL ES to D3D11 translation. +There might be a D3D11 backend in the future. diff --git a/docs/tint/arch.md b/docs/tint/arch.md index 204ff647b8..704e7c48fe 100644 --- a/docs/tint/arch.md +++ b/docs/tint/arch.md @@ -16,13 +16,13 @@ ┏━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┓ ┃ ProgramBuilder ┃ ┃ (mutable) ┃ - ┏━━━━━━━━━━━━►┫ ┏━━━━━┓ ┏━━━━━━━┓ ┏━━━━━━━━━┓ ┃ - ┃ ┃ ┃ AST ┃ ┃ Types ┃ ┃ Symbols ┃ ┃ - ┃ ┃ ┗━━━━━┛ ┗━━━━━━━┛ ┗━━━━━━━━━┛ ┃ + ┏━━━━━━━━━━━━►┫ ┏━━━━━┓ ┏━━━━━━━━━┓ ┃ + ┃ ┃ ┃ AST ┃ ┃ Symbols ┃ ┃ + ┃ ┃ ┗━━━━━┛ ┗━━━━━━━━━┛ ┃ ┃ ┗━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┛ ┃ ▼ ┃ ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┃┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐ - ▲ ┆ Build ▼ ┆ + ▲ ┆ Resolve ▼ ┆ ┏━━━┻━━━┓ ┆ ┏━━━━━━━━┻━━━━━━━━┓ ┆ ┃ Clone ┃ ┆ ┃ Resolver ┃ ┆ ┗━━━┳━━━┛ ┆ ┗━━━━━━━━━━━━━━━━━┛ ┆ @@ -31,9 +31,9 @@ ┃ ┏━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━┓ ┃ ┃ Program ┃ ┃ ┃ (immutable) ┃ - ┣━━━━━━◄┫ ┏━━━━━┓ ┏━━━━━━━┓ ┏━━━━━━━━━━┓ ┏━━━━━━━━━┓ ┃ - ┃ ┃ ┃ AST ┃ ┃ Types ┃ ┃ Semantic ┃ ┃ Symbols ┃ ┃ - ┃ ┃ ┗━━━━━┛ ┗━━━━━━━┛ ┗━━━━━━━━━━┛ ┗━━━━━━━━━┛ ┃ + ┣━━━━━━◄┫ ┏━━━━━┓ ┏━━━━━━━━━━┓ ┏━━━━━━━━━┓ ┃ + ┃ ┃ ┃ AST ┃ ┃ Semantic ┃ ┃ Symbols ┃ ┃ + ┃ ┃ ┗━━━━━┛ ┗━━━━━━━━━━┛ ┗━━━━━━━━━┛ ┃ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┛ ▲ ▼ ┏━━━━━┻━━━━━┓ ┃ ┏━━━━━━━━━━━┓ @@ -56,16 +56,16 @@ ## Reader Readers are responsible for parsing a shader program and populating a -`ProgramBuilder` with the parsed AST, type and symbol information. +`ProgramBuilder` with the parsed AST and symbol information. The WGSL reader is a recursive descent parser. It closely follows the WGSL grammar in the naming of the parse methods. ## ProgramBuilder -A `ProgramBuilder` is the primary interface to construct an immutable `Program`. -There are a number of methods exposed which make creating of the `Program` -simpler. A `ProgramBuilder` can only be used once, and must be discarded after +A `ProgramBuilder` is the interface to construct an immutable `Program`. +There are a large number of helper methods for simplifying the creation of the +AST nodes. A `ProgramBuilder` can only be used once, and must be discarded after the `Program` is constructed. A `Program` is built from the `ProgramBuilder` by `std::move()`ing the @@ -73,8 +73,9 @@ A `Program` is built from the `ProgramBuilder` by `std::move()`ing the so the produced `Program` will contain all the needed semantic information. At any time before building the `Program`, `ProgramBuilder::IsValid()` may be -called to ensure the AST is **structurally** correct. This checks that things -like `if` statements have a condition and body attached. +called to ensure that no error diagnostics have been raised during the +construction of the AST. This includes parser syntax errors, but not semantic +validation which happens during the `Resolve` phase. If further changes to the `Program` are needed (say via a `Transform`) then a new `ProgramBuilder` can be produced by cloning the `Program` into a new @@ -88,30 +89,14 @@ The Abstract Syntax Tree is a directed acyclic graph of `ast::Node`s which encode the syntactic structure of the WGSL program. The root of the AST is the `ast::Module` class which holds each of the declared -functions, variables and user defined types (type aliases and structures). +functions, variables and user declared types (type aliases and structures). Each `ast::Node` represents a **single** part of the program's source, and so `ast::Node`s are not shared. The AST does not perform any verification of its content. For example, the -`ast::StrideAttribute` node has numeric stride parameter, which is a count of -the number of bytes from the start of one array element to the start of the -next. The AST node itself does not constrain the set of stride values that you -can set, aside from storing it as an unsigned integer. - -## Types - -Types are constructed during the Reader and resolution phases, and are -held by the `Program` or `ProgramBuilder`. AST and semantic nodes can both -reference types. - -Each `type::Type` node **uniquely** represents a particular spelling of a WGSL -type within the program, so you can compare `type::Type*` pointers to check for -equivalence of type expressions. -For example, there is only one `type::Type` node for the `i32` type, no matter -how many times it is mentioned in the source program. -However, if `MyI32` is a type alias for `i32`, then they will have two different -type nodes. +`ast::Array` node has numeric size parameter, which is not validated to be +within the WGSL specification limits until validation of the `Resolver`. ## Semantic information @@ -133,6 +118,32 @@ and so the `sem::Variable` does not have a single corresponding Unlike `ast::Node`s, semantic nodes may not necessarily form a directed acyclic graph, and the semantic graph may contain diamonds. +## Types + +AST types are regular AST nodes, in that they uniquely represent a single part +of the parsed source code. Unlike semantic types, identical AST types are not +de-duplicated as they refer to the source usage of the type. + +Semantic types are constructed during the `Resolver` phase, and are held by +the `Program` or `ProgramBuilder`. + +Each `sem::Type` node **uniquely** represents a particular WGSL type within the +program, so you can compare `type::Type*` pointers to check for type +equivalence. For example, a `Program` will only hold one instance of the +`sem::I32` semantic type, no matter how many times an `i32` is mentioned in the +source program. + +WGSL type aliases resolve to their target semantic type. For example, given: + +```wgsl +type MyI32 = i32; +const a : i32 = 1; +const b : MyI32 = 2; +``` + +The **semantic** types for the variables `a` and `b` will both be the same +`sem::I32` node pointer. + ## Symbols Symbols represent a unique string identifier in the source program. These string @@ -157,9 +168,9 @@ A `Program` holds an immutable version of the information from the `ProgramBuilder` along with semantic information generated by the `Resolver`. -Like `ProgramBuilder`, `Program::IsValid()` may be called to ensure the AST is -structurally correct and semantically valid, and that the `Resolver` did not -report any errors. +`Program::IsValid()` may be called to ensure the program is structurally correct +**and** semantically valid, and that the `Resolver` did not report any errors +during validation. Unlike the `ProgramBuilder`, a `Program` is fully immutable, and is part of the public Tint API. The immutable nature of `Program`s make these entirely safe diff --git a/docs/tint/compound_statements.md b/docs/tint/compound_statements.md index 1d75415e14..123f432d55 100644 --- a/docs/tint/compound_statements.md +++ b/docs/tint/compound_statements.md @@ -58,6 +58,26 @@ sem::ForLoopStatement { } ``` +## while + +WGSL: +``` +while (condition) { + statement; +} +``` + +Semantic tree: +``` +sem::WhileStatement { + sem::Expression condition + + sem::LoopBlockStatement { + sem::Statement statement + } +} +``` + ## loop WGSL: diff --git a/docs/tint/extensions/chromium_experimental_push_constant.md b/docs/tint/extensions/chromium_experimental_push_constant.md new file mode 100644 index 0000000000..d10e1eeb59 --- /dev/null +++ b/docs/tint/extensions/chromium_experimental_push_constant.md @@ -0,0 +1,28 @@ +# Chromium Experimental Push Constant + +The `chromium_experimental_push_constant` extension adds support for push constant global variables to WGSL. +Push constants are small amounts of data that are passed to the shader and are expected to be more lightweight to set / modify than uniform buffer bindings. +The concept of push constant comes from Vulkan but D3D12 has similar "root constants". +Metal doesn't have the same concept but push constants can be efficiently implemented with the `setBytes` family of command encoder methods. + +## Status + +Push constant support in Tint is highly experimental and only meant to be used in internal transforms at this stage. +Specification work in the WebGPU group hasn't started. + +## Pseudo-specification + +This extension adds a new `push_constant` storage class that's only allowed on global variable declarations. +Push constant variables must only contain 32bit data types (or aggregates of such types). +Push constant variable declarations must not have an initializer. +It is an error for a entry point to statically use more than one `push_constant` variable. + +## Example usage + +``` +var draw_id : u32; + +@fragment fn main() -> u32 { + return draw_id; +} +``` diff --git a/docs/tint/origin-trial-changes.md b/docs/tint/origin-trial-changes.md index 31f91ceb81..93c53e5161 100644 --- a/docs/tint/origin-trial-changes.md +++ b/docs/tint/origin-trial-changes.md @@ -1,5 +1,55 @@ # Tint changes during Origin Trial +## Changes for M106 + +### New features + +* `array()` constructor can now infer type and count. [tint:1628](crbug.com/tint/1628) +* `static_assert` statement has been added. [tint:1625](crbug.com/tint/1625) + +### Deprecated Features + +* The list of reserved words has been sync'd to the WGSL specification. [tint:1463](crbug.com/tint/1463) + +## Changes for M105 + +### New features + +* Module-scope `var` can now infer the storage type, like function-scope `var`. [tint:1584](crbug.com/tint/1584) +* The `acosh`, `asinh`, and `atanh` builtin functions are now supported [tint:1465](crbug.com/tint/1465) + +### Breaking changes + +* The `smoothStep()` builtin has been removed (use `smoothstep` instead). [tint:1483](crbug.com/tint/1483) +* Module-scope `let` has been replaced with module-scope `const`. [tint:1580](crbug.com/tint/1584) + * Note: Module-scope `const` does not support structure types. Use `var` if you need a module-scope structure type. +* Struct members can no longer be separated with semicolons (use commas instead). [tint:1475](crbug.com/tint/1475) +* Single scalar matrix constructors have been removed. These were never part of the WGSL spec. [tint:1597](crbug.com/tint/1597) + +### Deprecated Features + +* The `@stage` attribute has been deprecated. The short forms should be used + instead (`@vertex`, `@fragment`, or `@compute`). [tint:1503](crbug.com/tint/1503) + +## Changes for M104 + +### New features + +* Tint now supports abstract-numerics, removing the need to always suffix unsigned integers with `u` [tint:1504](crbug.com/tint/1504) +* Parsing of `@compute`, `@fragment` and `@vertex` added. + +## Changes for M103 + +### New features + +* Produce warnings for when calling barriers, textureSample, and derivative +builtins in non-uniform control flow [tint:880](crbug.com/tint/880) +* Matrix identity constructors and constructors for a single scalar value are now supported [tint:1545](crbug.com/tint/1545) + +### Breaking changes + +* Builtin `atomicCompareExchangeWeak` returns a struct instead of a vec2. [tint:1185](crbug.com/tint/1185) + ## Changes for M102 ### New Features diff --git a/docs/tint/spirv-input-output-variables.md b/docs/tint/spirv-input-output-variables.md index 0f149e072c..0ba4ae46b9 100644 --- a/docs/tint/spirv-input-output-variables.md +++ b/docs/tint/spirv-input-output-variables.md @@ -94,7 +94,7 @@ Current translation, through SPIR-V, SPIR-V reader, WGSL writer: return; } - @stage(fragment) + @fragment fn main() -> void { bar_(); return; @@ -126,7 +126,7 @@ Proposed translation, through SPIR-V, SPIR-V reader, WGSL writer: @location(0) frag_color : vec4; }; - @stage(fragment) + @fragment fn main( // 'in' variables are entry point parameters diff --git a/generator/CMakeLists.txt b/generator/CMakeLists.txt index a2d67844ff..ea87236f82 100644 --- a/generator/CMakeLists.txt +++ b/generator/CMakeLists.txt @@ -26,7 +26,7 @@ if (NOT DAWN_JINJA2_DIR) message(FATAL_ERROR "Dawn: Missing dependencies for code generation, please ensure you have python-jinja2 installed.") endif() else() - message(STATUS "Dawn: Using jinja2 at ${DAWN_JINJA2_DIR}") + message(STATUS "Dawn: using jinja2 at ${DAWN_JINJA2_DIR}") endif() # Function to invoke a generator_lib.py generator. diff --git a/generator/dawn_gpu_info_generator.py b/generator/dawn_gpu_info_generator.py new file mode 100644 index 0000000000..c059afbfd7 --- /dev/null +++ b/generator/dawn_gpu_info_generator.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python3 +# Copyright 2022 The Dawn Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json, os, sys +from collections import namedtuple + +from generator_lib import Generator, run_generator, FileRender + + +def parse_mask(mask): + if mask: + return int(mask, 0) + return 0xffffffff + + +class Name: + def __init__(self, name): + self.name = name + self.chunks = name.split(' ') + + def get(self): + return self.name + + def CamelChunk(self, chunk): + return chunk[0].upper() + chunk[1:] + + def canonical_case(self): + return (' '.join(self.chunks)).lower() + + def concatcase(self): + return ''.join(self.chunks) + + def camelCase(self): + return self.chunks[0] + ''.join( + [self.CamelChunk(chunk) for chunk in self.chunks[1:]]) + + def CamelCase(self): + return ''.join([self.CamelChunk(chunk) for chunk in self.chunks]) + + def SNAKE_CASE(self): + return '_'.join([chunk.upper() for chunk in self.chunks]) + + def snake_case(self): + return '_'.join(self.chunks) + + def js_enum_case(self): + result = self.chunks[0].lower() + for chunk in self.chunks[1:]: + if not result[-1].isdigit(): + result += '-' + result += chunk.lower() + return result + + +class Architecture: + def __init__(self, name, json_data, mask): + self.name = Name(name) + self.devices = [] + + mask_num = parse_mask(mask) + + for device in json_data: + device_num = int(device, 0) + + # Don't allow duplicate entries + assert device not in self.devices, 'Architecture "{}" contained duplicate deviceID "{}"'.format( + self.name.get(), device) + # Ensure that all device IDs don't contain bits outside the mask + assert device_num & mask_num == device_num, 'Architecture "{}" contained deviceID "{}" which doesn\'t match the given mask of "{}"'.format( + self.name.get(), device, mask) + + self.devices.append(device) + + +class DeviceSet: + def __init__(self, json_data): + self.mask = None + self.internal = False + + if 'mask' in json_data: + self.mask = json_data['mask'] + + if 'internal' in json_data: + self.internal = json_data['internal'] + + self.architectures = [] + if 'architecture' in json_data: + for (arch_name, arch_data) in json_data['architecture'].items(): + # Skip any entries that start with an underscore. Used for comments. + if arch_name[0] == '_': + continue + + architecture = Architecture(arch_name, arch_data, self.mask) + + # Validate that deviceIDs are only allowed to be in one Architecture at a time + for other_architecture in self.architectures: + for device in architecture.devices: + assert device not in other_architecture.devices, 'Architectures "{}" and "{}" both contain deviceID "{}"'.format( + architecture.name.get(), + other_architecture.name.get(), device) + + self.architectures.append(architecture) + + def validate_devices(self, other_devices, other_mask): + combined_mask = parse_mask(self.mask) & parse_mask(other_mask) + + for other_device in other_devices: + other_device_num = int(other_device, 0) & combined_mask + for architecture in self.architectures: + for device in architecture.devices: + device_num = int(device, 0) & combined_mask + assert device_num != other_device_num, 'DeviceID "{}" & mask "{}" conflicts with deviceId "{}" & mask "{}" in architecture "{}"'.format( + other_device, other_mask, device, self.mask, + architecture.name.get()) + + def maskDeviceId(self): + if not self.mask: + return '' + return ' & ' + self.mask + + +class Vendor: + def __init__(self, name, json_data): + self.name = Name(name) + self.id = json_data['id'] + + architecture_dict = {} + internal_architecture_dict = {} + + self.device_sets = [] + if 'devices' in json_data: + for device_data in json_data['devices']: + device_set = DeviceSet(device_data) + + for architecture in device_set.architectures: + + # Validate that deviceIDs are unique across device sets + for other_device_set in self.device_sets: + # Only validate device IDs between internal and public device sets. + if other_device_set.internal == device_set.internal: + assert device_set.mask != other_device_set.mask, 'Vendor "{}" contained duplicate device masks "{}"'.format( + self.name.get(), device_set.mask) + other_device_set.validate_devices( + architecture.devices, device_set.mask) + + # Validate that architecture names are unique between internal and public device sets. + else: + for other_architecture in other_device_set.architectures: + assert architecture.name.canonical_case( + ) != other_architecture.name.canonical_case( + ), '"{}" is defined as both an internal and public architecture'.format( + architecture.name.get()) + + if device_set.internal: + internal_architecture_dict[ + architecture.name.canonical_case( + )] = architecture.name + else: + architecture_dict[architecture.name.canonical_case( + )] = architecture.name + + self.device_sets.append(device_set) + + # List of unique architecture names under this vendor + self.architecture_names = architecture_dict.values() + self.internal_architecture_names = internal_architecture_dict.values() + + +def parse_json(json): + vendors = [] + internal_architecture_count = 0 + + for (vendor_name, vendor_data) in json['vendors'].items(): + # Skip vendors that have a leading underscore. Those are intended to be "comments". + if vendor_name[0] == '_': + continue + + vendor = Vendor(vendor_name, vendor_data) + vendors.append(vendor) + internal_architecture_count += len(vendor.internal_architecture_names) + + return { + 'vendors': vendors, + 'has_internal': internal_architecture_count > 0 + } + + +class DawnGpuInfoGenerator(Generator): + def get_description(self): + return "Generates GPU Info Dawn code." + + def add_commandline_arguments(self, parser): + parser.add_argument('--gpu-info-json', + required=True, + type=str, + help='The GPU Info JSON definition to use.') + + def get_dependencies(self, args): + return [os.path.abspath(args.gpu_info_json)] + + def get_file_renders(self, args): + with open(args.gpu_info_json) as f: + loaded_json = json.loads(f.read()) + + params = parse_json(loaded_json) + + return [ + FileRender("dawn/common/GPUInfo.h", + "src/dawn/common/GPUInfo_autogen.h", [params]), + FileRender("dawn/common/GPUInfo.cpp", + "src/dawn/common/GPUInfo_autogen.cpp", [params]), + ] + + +if __name__ == "__main__": + sys.exit(run_generator(DawnGpuInfoGenerator())) diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py index d02213de35..e818d2a2e9 100644 --- a/generator/dawn_json_generator.py +++ b/generator/dawn_json_generator.py @@ -237,12 +237,13 @@ class StructureType(Record, Type): m for m in json_data['members'] if is_enabled(m) ] Type.__init__(self, name, dict(json_data, **json_data_override)) - self.chained = json_data.get("chained", None) - self.extensible = json_data.get("extensible", None) + self.chained = json_data.get('chained', None) + self.extensible = json_data.get('extensible', None) if self.chained: - assert (self.chained == "in" or self.chained == "out") + assert self.chained == 'in' or self.chained == 'out' + assert 'chain roots' in json_data if self.extensible: - assert (self.extensible == "in" or self.extensible == "out") + assert self.extensible == 'in' or self.extensible == 'out' # Chained structs inherit from wgpu::ChainedStruct, which has # nextInChain, so setting both extensible and chained would result in # two nextInChain members. @@ -348,6 +349,8 @@ def link_object(obj, types): def link_structure(struct, types): struct.members = linked_record_members(struct.json_data['members'], types) + struct.chain_roots = [types[root] for root in struct.json_data.get('chain roots', [])] + assert all((root.category == 'structure' for root in struct.chain_roots)) def link_function_pointer(function_pointer, types): @@ -947,6 +950,10 @@ class MultiGeneratorFromDawnJSON(Generator): FileRender('dawn/native/api_absl_format.cpp', 'src/' + native_dir + '/' + api + '_absl_format_autogen.cpp', frontend_params)) + renders.append( + FileRender( + 'dawn/native/api_StreamImpl.cpp', 'src/' + native_dir + + '/' + api + '_StreamImpl_autogen.cpp', frontend_params)) renders.append( FileRender('dawn/native/ObjectType.h', 'src/' + native_dir + '/ObjectType_autogen.h', @@ -955,10 +962,6 @@ class MultiGeneratorFromDawnJSON(Generator): FileRender('dawn/native/ObjectType.cpp', 'src/' + native_dir + '/ObjectType_autogen.cpp', frontend_params)) - renders.append( - FileRender('dawn/native/CacheKey.cpp', - 'src/' + native_dir + '/CacheKey_autogen.cpp', - frontend_params)) if 'wire' in targets: params_dawn_wire = parse_json(loaded_json, diff --git a/generator/dawn_version_generator.py b/generator/dawn_version_generator.py index 120be495bd..96d61291f9 100644 --- a/generator/dawn_version_generator.py +++ b/generator/dawn_version_generator.py @@ -26,11 +26,11 @@ def get_git(): return git_exec -def get_gitHash(dawnDir): +def get_git_hash(dawn_dir): try: result = subprocess.run([get_git(), "rev-parse", "HEAD"], stdout=subprocess.PIPE, - cwd=dawnDir) + cwd=dawn_dir) if result.returncode == 0: return result.stdout.decode("utf-8").strip() except Exception: @@ -40,15 +40,15 @@ def get_gitHash(dawnDir): return "" -def get_gitHead(dawnDir): - return os.path.join(dawnDir, ".git", "HEAD") +def get_git_head(dawn_dir): + return os.path.join(dawn_dir, ".git", "HEAD") -def gitExists(dawnDir): - return os.path.exists(get_gitHead(dawnDir)) +def git_exists(dawn_dir): + return os.path.exists(get_git_head(dawn_dir)) -def unpackGitRef(packed, resolved): +def unpack_git_ref(packed, resolved): with open(packed) as fin: refs = fin.read().strip().split("\n") @@ -64,20 +64,20 @@ def unpackGitRef(packed, resolved): return False -def get_gitResolvedHead(dawnDir): +def get_git_resolved_head(dawn_dir): result = subprocess.run( [get_git(), "rev-parse", "--symbolic-full-name", "HEAD"], stdout=subprocess.PIPE, - cwd=dawnDir) + cwd=dawn_dir) if result.returncode != 0: raise Exception("Failed to execute git rev-parse to resolve git head:", result.stdout) - resolved = os.path.join(dawnDir, ".git", + resolved = os.path.join(dawn_dir, ".git", result.stdout.decode("utf-8").strip()) # Check a packed-refs file exists. If so, we need to potentially unpack and include it as a dep. - packed = os.path.join(dawnDir, ".git", "packed-refs") - if os.path.exists(packed) and unpackGitRef(packed, resolved): + packed = os.path.join(dawn_dir, ".git", "packed-refs") + if os.path.exists(packed) and unpack_git_ref(packed, resolved): return [packed, resolved] if not os.path.exists(resolved): @@ -85,15 +85,25 @@ def get_gitResolvedHead(dawnDir): return [resolved] +def get_version(args): + version_file = args.version_file + if version_file: + with open(version_file) as f: + return f.read() + return get_git_hash(os.path.abspath(args.dawn_dir)) + + def compute_params(args): return { - "get_gitHash": lambda: get_gitHash(os.path.abspath(args.dawn_dir)), + "get_version": lambda: get_version(args), } class DawnVersionGenerator(Generator): def get_description(self): - return "Generates version dependent Dawn code. Currently regenerated dependent on git hash." + return ( + "Generates version dependent Dawn code. Currently regenerated dependent on the version " + "header (if available), otherwise tries to use git hash.") def add_commandline_arguments(self, parser): parser.add_argument( @@ -102,12 +112,24 @@ class DawnVersionGenerator(Generator): type=str, help="The Dawn root directory path to use", ) + parser.add_argument( + "--version-file", + required=False, + type=str, + help= + ("Path to one-liner version string file used when git may not be present. " + "In general the version string is a git hash.")) def get_dependencies(self, args): - dawnDir = os.path.abspath(args.dawn_dir) - if gitExists(dawnDir): + dawn_dir = os.path.abspath(args.dawn_dir) + version_file = args.version_file + + if version_file: + return [version_file] + if git_exists(dawn_dir): try: - return [get_gitHead(dawnDir)] + get_gitResolvedHead(dawnDir) + return [get_git_head(dawn_dir) + ] + get_git_resolved_head(dawn_dir) except Exception: return [] return [] diff --git a/generator/remove_files.py b/generator/remove_files.py index 21eef8410b..6ddf463667 100644 --- a/generator/remove_files.py +++ b/generator/remove_files.py @@ -78,7 +78,6 @@ def run(): for candidate in get_all_files_in_dir(stale_dir): if not check_is_allowed(candidate, allowed_dirs): - print("Warning: remove_files.py removed " + candidate) os.remove(candidate) # Finished! Write the stamp file so ninja knows to not run this again. diff --git a/generator/templates/api.h b/generator/templates/api.h index db9d94a81b..c4def22d65 100644 --- a/generator/templates/api.h +++ b/generator/templates/api.h @@ -89,6 +89,9 @@ typedef struct {{c_prefix}}ChainedStructOut { } {{c_prefix}}ChainedStructOut; {% for type in by_category["structure"] %} + {% for root in type.chain_roots %} + // Can be chained in {{as_cType(root.name)}} + {% endfor %} typedef struct {{as_cType(type.name)}} { {% set Out = "Out" if type.output else "" %} {% set const = "const " if not type.output else "" %} @@ -100,6 +103,7 @@ typedef struct {{c_prefix}}ChainedStructOut { {% endif %} {% for member in type.members %} {{as_annotated_cType(member)}}; + {%- if member.optional %} // nullable{% endif %}{{""}} {% endfor %} } {{as_cType(type.name)}}; @@ -143,6 +147,7 @@ extern "C" { {{-as_cType(type.name)}} {{as_varName(type.name)}} {%- for arg in method.arguments -%} , {{as_annotated_cType(arg)}} + {%- if arg.optional %} /* nullable */{% endif %} {%- endfor -%} ); {% endfor %} @@ -167,6 +172,7 @@ extern "C" { {{-as_cType(type.name)}} {{as_varName(type.name)}} {%- for arg in method.arguments -%} , {{as_annotated_cType(arg)}} + {%- if arg.optional %} /* nullable */{% endif %} {%- endfor -%} ); {% endfor %} diff --git a/generator/templates/api_cpp.h b/generator/templates/api_cpp.h index c3b21fbe79..2bd475eeb2 100644 --- a/generator/templates/api_cpp.h +++ b/generator/templates/api_cpp.h @@ -27,6 +27,12 @@ namespace {{metadata.namespace}} { + namespace detail { + constexpr size_t ConstexprMax(size_t a, size_t b) { + return a > b ? a : b; + } + } // namespace detail + {% set c_prefix = metadata.c_prefix %} {% for constant in by_category["constant"] %} {% set type = as_cppType(constant.type.name) %} @@ -146,7 +152,8 @@ namespace {{metadata.namespace}} { }; {% macro render_cpp_default_value(member, is_struct=True) -%} - {%- if member.annotation in ["*", "const*"] and member.optional or member.default_value == "nullptr" -%} + {%- if member.json_data.get("no_default", false) -%} + {%- elif member.annotation in ["*", "const*"] and member.optional or member.default_value == "nullptr" -%} {{" "}}= nullptr {%- elif member.type.category == "object" and member.optional and is_struct -%} {{" "}}= nullptr @@ -219,6 +226,9 @@ namespace {{metadata.namespace}} { {% set Out = "Out" if type.output else "" %} {% set const = "const" if not type.output else "" %} {% if type.chained %} + {% for root in type.chain_roots %} + // Can be chained in {{as_cppType(root.name)}} + {% endfor %} struct {{as_cppType(type.name)}} : ChainedStruct{{Out}} { {{as_cppType(type.name)}}() { sType = SType::{{type.name.CamelCase()}}; @@ -232,8 +242,10 @@ namespace {{metadata.namespace}} { {% for member in type.members %} {% set member_declaration = as_annotated_cppType(member) + render_cpp_default_value(member) %} {% if type.chained and loop.first %} - //* Align the first member to ChainedStruct to match the C struct layout. - alignas(ChainedStruct{{Out}}) {{member_declaration}}; + //* Align the first member after ChainedStruct to match the C struct layout. + //* It has to be aligned both to its natural and ChainedStruct's alignment. + static constexpr size_t kFirstMemberAlignment = detail::ConstexprMax(alignof(ChainedStruct{{out}}), alignof({{decorate("", as_cppType(member.type.name), member)}})); + alignas(kFirstMemberAlignment) {{member_declaration}}; {% else %} {{member_declaration}}; {% endif %} diff --git a/generator/templates/dawn/common/GPUInfo.cpp b/generator/templates/dawn/common/GPUInfo.cpp new file mode 100644 index 0000000000..f24c26255f --- /dev/null +++ b/generator/templates/dawn/common/GPUInfo.cpp @@ -0,0 +1,154 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include + +#include "dawn/common/GPUInfo_autogen.h" + +#include "dawn/common/Assert.h" + +namespace gpu_info { + +namespace { + +enum class Architecture { + Unknown, + {% for vendor in vendors %} + {% for architecture_name in vendor.architecture_names %} + {{vendor.name.CamelCase()}}_{{architecture_name.CamelCase()}}, + {% endfor %} + {% endfor %} +}; + +Architecture GetArchitecture(PCIVendorID vendorId, PCIDeviceID deviceId) { + switch(vendorId) { + {% for vendor in vendors %} + {% if len(vendor.device_sets) %} + case kVendorID_{{vendor.name.CamelCase()}}: { + {% for device_set in vendor.device_sets %} + {% if not device_set.internal %} + switch (deviceId{{device_set.maskDeviceId()}}) { + {% for architecture in device_set.architectures %} + {% for device in architecture.devices %} + case {{device}}: + {% endfor %} + return Architecture::{{vendor.name.CamelCase()}}_{{architecture.name.CamelCase()}}; + {% endfor %} + } + {% endif %} + {% endfor %} + } break; + {% endif %} + {% endfor %} + } + + return Architecture::Unknown; +} + +{% if has_internal %} + + enum class InternalArchitecture { + Unknown, + {% for vendor in vendors %} + {% for architecture_name in vendor.internal_architecture_names %} + {{vendor.name.CamelCase()}}_{{architecture_name.CamelCase()}}, + {% endfor %} + {% endfor %} + }; + + InternalArchitecture GetInternalArchitecture(PCIVendorID vendorId, PCIDeviceID deviceId) { + switch(vendorId) { + {% for vendor in vendors %} + {% if len(vendor.device_sets) %} + case kVendorID_{{vendor.name.CamelCase()}}: { + {% for device_set in vendor.device_sets %} + {% if device_set.internal %} + switch (deviceId{{device_set.maskDeviceId()}}) { + {% for architecture in device_set.architectures %} + {% for device in architecture.devices %} + case {{device}}: + {% endfor %} + return InternalArchitecture::{{vendor.name.CamelCase()}}_{{architecture.name.CamelCase()}}; + {% endfor %} + } + {% endif %} + {% endfor %} + } break; + {% endif %} + {% endfor %} + } + + return InternalArchitecture::Unknown; + } + +{% endif %} + +} // namespace + +// Vendor checks +{% for vendor in vendors %} + bool Is{{vendor.name.CamelCase()}}(PCIVendorID vendorId) { + return vendorId == kVendorID_{{vendor.name.CamelCase()}}; + } +{% endfor %} + +// Architecture checks + +{% for vendor in vendors %} + {% if len(vendor.architecture_names) %} + // {{vendor.name.get()}} architectures + {% for architecture_name in vendor.architecture_names %} + bool Is{{vendor.name.CamelCase()}}{{architecture_name.CamelCase()}}(PCIVendorID vendorId, PCIDeviceID deviceId) { + return GetArchitecture(vendorId, deviceId) == Architecture::{{vendor.name.CamelCase()}}_{{architecture_name.CamelCase()}}; + } + {% endfor %} + {% for architecture_name in vendor.internal_architecture_names %} + bool Is{{vendor.name.CamelCase()}}{{architecture_name.CamelCase()}}(PCIVendorID vendorId, PCIDeviceID deviceId) { + return GetInternalArchitecture(vendorId, deviceId) == InternalArchitecture::{{vendor.name.CamelCase()}}_{{architecture_name.CamelCase()}}; + } + {% endfor %} + {% endif %} +{% endfor %} + +// GPUAdapterInfo fields +std::string GetVendorName(PCIVendorID vendorId) { + switch(vendorId) { + {% for vendor in vendors %} + case kVendorID_{{vendor.name.CamelCase()}}: return "{{vendor.name.js_enum_case()}}"; + {% endfor %} + } + + return ""; +} + +std::string GetArchitectureName(PCIVendorID vendorId, PCIDeviceID deviceId) { + Architecture arch = GetArchitecture(vendorId, deviceId); + switch(arch) { + case Architecture::Unknown: + return ""; + {% for vendor in vendors %} + {% for architecture_name in vendor.architecture_names %} + case Architecture::{{vendor.name.CamelCase()}}_{{architecture_name.CamelCase()}}: + return "{{architecture_name.js_enum_case()}}"; + {% endfor %} + {% endfor %} + } + + return ""; +} + +} // namespace gpu_info diff --git a/generator/templates/dawn/common/GPUInfo.h b/generator/templates/dawn/common/GPUInfo.h new file mode 100644 index 0000000000..f058008cd4 --- /dev/null +++ b/generator/templates/dawn/common/GPUInfo.h @@ -0,0 +1,55 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_COMMON_GPUINFO_AUTOGEN_H_ +#define SRC_DAWN_COMMON_GPUINFO_AUTOGEN_H_ + +#include +#include + +using PCIVendorID = uint32_t; +using PCIDeviceID = uint32_t; + +namespace gpu_info { + +// Vendor IDs +{% for vendor in vendors %} + static constexpr PCIVendorID kVendorID_{{vendor.name.CamelCase()}} = {{vendor.id}}; +{% endfor %} + +// Vendor checks +{% for vendor in vendors %} + bool Is{{vendor.name.CamelCase()}}(PCIVendorID vendorId); +{% endfor %} + +// Architecture checks +{% for vendor in vendors %} + {% if len(vendor.architecture_names) %} + + // {{vendor.name.get()}} architectures + {% for architecture_name in vendor.architecture_names %} + bool Is{{vendor.name.CamelCase()}}{{architecture_name.CamelCase()}}(PCIVendorID vendorId, PCIDeviceID deviceId); + {% endfor %} + {% for architecture_name in vendor.internal_architecture_names %} + bool Is{{vendor.name.CamelCase()}}{{architecture_name.CamelCase()}}(PCIVendorID vendorId, PCIDeviceID deviceId); + {% endfor %} + {% endif %} +{% endfor %} + +// GPUAdapterInfo fields +std::string GetVendorName(PCIVendorID vendorId); +std::string GetArchitectureName(PCIVendorID vendorId, PCIDeviceID deviceId); + +} // namespace gpu_info +#endif // SRC_DAWN_COMMON_GPUINFO_AUTOGEN_H_ diff --git a/generator/templates/dawn/common/Version.h b/generator/templates/dawn/common/Version.h index f9f67e726c..26e19867d7 100644 --- a/generator/templates/dawn/common/Version.h +++ b/generator/templates/dawn/common/Version.h @@ -15,9 +15,13 @@ #ifndef COMMON_VERISON_AUTOGEN_H_ #define COMMON_VERISON_AUTOGEN_H_ +#include + namespace dawn { -static constexpr char kGitHash[] = "{{get_gitHash()}}"; +// The version string should either be a valid git hash or empty. +static constexpr std::string_view kDawnVersion("{{get_version()}}"); +static_assert(kDawnVersion.size() == 40 || kDawnVersion.size() == 0); } // namespace dawn diff --git a/generator/templates/dawn/native/CacheKey.cpp b/generator/templates/dawn/native/CacheKey.cpp deleted file mode 100644 index cf31449967..0000000000 --- a/generator/templates/dawn/native/CacheKey.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//* Copyright 2022 The Dawn Authors -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %} -{% set namespace_name = Name(metadata.native_namespace) %} -{% set native_namespace = namespace_name.namespace_case() %} -{% set native_dir = impl_dir + namespace_name.Dirs() %} -{% set prefix = metadata.proc_table_prefix.lower() %} -#include "{{native_dir}}/CacheKey.h" -#include "{{native_dir}}/{{prefix}}_platform.h" - -#include - -namespace {{native_namespace}} { - -// -// Cache key serializers for wgpu structures used in caching. -// -{% macro render_serializer(member) %} - {%- set name = member.name.camelCase() -%} - {% if member.length == None %} - key->Record(t.{{name}}); - {% elif member.length == "strlen" %} - key->RecordIterable(t.{{name}}, strlen(t.{{name}})); - {% else %} - key->RecordIterable(t.{{name}}, t.{{member.length.name.camelCase()}}); - {% endif %} -{% endmacro %} - -{# Helper macro to render serializers. Should be used in a call block to provide additional custom - handling when necessary. The optional `omit` field can be used to omit fields that are either - handled in the custom code, or unnecessary in the serialized output. - Example: - {% call render_cache_key_serializer("struct name", omits=["omit field"]) %} - // Custom C++ code to handle special types/members that are hard to generate code for - {% endcall %} -#} -{% macro render_cache_key_serializer(json_type, omits=[]) %} - {%- set cpp_type = types[json_type].name.CamelCase() -%} - template <> - void CacheKeySerializer<{{cpp_type}}>::Serialize(CacheKey* key, const {{cpp_type}}& t) { - {{ caller() }} - {% for member in types[json_type].members %} - {%- if not member.name.get() in omits %} - {{render_serializer(member)}} - {%- endif %} - {% endfor %} - } -{% endmacro %} - -{% call render_cache_key_serializer("adapter properties") %} -{% endcall %} - -{% call render_cache_key_serializer("dawn cache device descriptor") %} -{% endcall %} - -} // namespace {{native_namespace}} diff --git a/generator/templates/dawn/native/ProcTable.cpp b/generator/templates/dawn/native/ProcTable.cpp index cd829e3031..f9980ffc61 100644 --- a/generator/templates/dawn/native/ProcTable.cpp +++ b/generator/templates/dawn/native/ProcTable.cpp @@ -66,7 +66,7 @@ namespace {{native_namespace}} { {%- endfor -%} ); {% if method.return_type.name.canonical_case() != "void" %} - {% if method.return_type.category == "object" %} + {% if method.return_type.category in ["object", "enum", "bitmask"] %} return ToAPI(result); {% else %} return result; @@ -104,7 +104,7 @@ namespace {{native_namespace}} { {%- endfor -%} ); {% if function.return_type.name.canonical_case() != "void" %} - {% if function.return_type.category == "object" %} + {% if function.return_type.category in ["object", "enum", "bitmask"] %} return ToAPI(result); {% else %} return result; diff --git a/generator/templates/dawn/native/api_StreamImpl.cpp b/generator/templates/dawn/native/api_StreamImpl.cpp new file mode 100644 index 0000000000..82b64043c2 --- /dev/null +++ b/generator/templates/dawn/native/api_StreamImpl.cpp @@ -0,0 +1,68 @@ +//* Copyright 2022 The Dawn Authors +//* +//* Licensed under the Apache License, Version 2.0 (the "License"); +//* you may not use this file except in compliance with the License. +//* You may obtain a copy of the License at +//* +//* http://www.apache.org/licenses/LICENSE-2.0 +//* +//* Unless required by applicable law or agreed to in writing, software +//* distributed under the License is distributed on an "AS IS" BASIS, +//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//* See the License for the specific language governing permissions and +//* limitations under the License. + +{% set impl_dir = metadata.impl_dir + "/" if metadata.impl_dir else "" %} +{% set namespace_name = Name(metadata.native_namespace) %} +{% set native_namespace = namespace_name.namespace_case() %} +{% set native_dir = impl_dir + namespace_name.Dirs() %} +{% set prefix = metadata.proc_table_prefix.lower() %} +#include "{{native_dir}}/CacheKey.h" +#include "{{native_dir}}/{{prefix}}_platform.h" + +#include + +namespace {{native_namespace}} { + +// +// Cache key writers for wgpu structures used in caching. +// +{% macro render_writer(member) %} + {%- set name = member.name.camelCase() -%} + {% if member.length == None %} + StreamIn(sink, t.{{name}}); + {% elif member.length == "strlen" %} + StreamIn(sink, Iterable(t.{{name}}, strlen(t.{{name}}))); + {% else %} + StreamIn(sink, Iterable(t.{{name}}, t.{{member.length.name.camelCase()}})); + {% endif %} +{% endmacro %} + +{# Helper macro to render writers. Should be used in a call block to provide additional custom + handling when necessary. The optional `omit` field can be used to omit fields that are either + handled in the custom code, or unnecessary in the serialized output. + Example: + {% call render_cache_key_writer("struct name", omits=["omit field"]) %} + // Custom C++ code to handle special types/members that are hard to generate code for + {% endcall %} +#} +{% macro render_cache_key_writer(json_type, omits=[]) %} + {%- set cpp_type = types[json_type].name.CamelCase() -%} + template <> + void stream::Stream<{{cpp_type}}>::Write(stream::Sink* sink, const {{cpp_type}}& t) { + {{ caller() }} + {% for member in types[json_type].members %} + {%- if not member.name.get() in omits %} + {{render_writer(member)}} + {%- endif %} + {% endfor %} + } +{% endmacro %} + +{% call render_cache_key_writer("adapter properties") %} +{% endcall %} + +{% call render_cache_key_writer("dawn cache device descriptor") %} +{% endcall %} + +} // namespace {{native_namespace}} diff --git a/generator/templates/dawn/native/api_structs.h b/generator/templates/dawn/native/api_structs.h index d6553445c9..232d2861d8 100644 --- a/generator/templates/dawn/native/api_structs.h +++ b/generator/templates/dawn/native/api_structs.h @@ -64,8 +64,9 @@ namespace {{native_namespace}} { {% for member in type.members %} {% set member_declaration = as_annotated_frontendType(member) + render_cpp_default_value(member) %} {% if type.chained and loop.first %} - //* Align the first member to ChainedStruct to match the C struct layout. - alignas(ChainedStruct) {{member_declaration}}; + //* Align the first member after ChainedStruct to match the C struct layout. + //* It has to be aligned both to its natural and ChainedStruct's alignment. + alignas({{namespace}}::{{as_cppType(type.name)}}::kFirstMemberAlignment) {{member_declaration}}; {% else %} {{member_declaration}}; {% endif %} diff --git a/generator/templates/dawn/native/dawn_platform.h b/generator/templates/dawn/native/dawn_platform.h index e3f1c91a33..1bb5426991 100644 --- a/generator/templates/dawn/native/dawn_platform.h +++ b/generator/templates/dawn/native/dawn_platform.h @@ -77,6 +77,16 @@ namespace {{native_namespace}} { static constexpr uint32_t value = {{len(e.values)}}; }; {% endfor %} + + {% for type in by_category["enum"] + by_category["bitmask"] %} + inline {{as_cType(type.name)}} ToAPI({{namespace}}::{{as_cppType(type.name)}} rhs) { + return static_cast<{{as_cType(type.name)}}>(rhs); + } + + inline {{namespace}}::{{as_cppType(type.name)}} FromAPI({{as_cType(type.name)}} rhs) { + return static_cast<{{namespace}}::{{as_cppType(type.name)}}>(rhs); + } + {% endfor %} } #endif // {{NATIVE_DIR}}_{{PREFIX}}_PLATFORM_AUTOGEN_H_ diff --git a/generator/templates/dawn/wire/WireCmd.cpp b/generator/templates/dawn/wire/WireCmd.cpp index c945bee871..fd51af28a0 100644 --- a/generator/templates/dawn/wire/WireCmd.cpp +++ b/generator/templates/dawn/wire/WireCmd.cpp @@ -651,31 +651,6 @@ namespace dawn::wire { - ObjectHandle::ObjectHandle() = default; - ObjectHandle::ObjectHandle(ObjectId id, ObjectGeneration generation) - : id(id), generation(generation) { - } - - ObjectHandle::ObjectHandle(const volatile ObjectHandle& rhs) - : id(rhs.id), generation(rhs.generation) { - } - ObjectHandle& ObjectHandle::operator=(const volatile ObjectHandle& rhs) { - id = rhs.id; - generation = rhs.generation; - return *this; - } - - ObjectHandle& ObjectHandle::AssignFrom(const ObjectHandle& rhs) { - id = rhs.id; - generation = rhs.generation; - return *this; - } - ObjectHandle& ObjectHandle::AssignFrom(const volatile ObjectHandle& rhs) { - id = rhs.id; - generation = rhs.generation; - return *this; - } - namespace { // Allocates enough space from allocator to countain T[count] and return it in out. // Return FatalError if the allocator couldn't allocate the memory. @@ -784,72 +759,4 @@ namespace dawn::wire { {{ write_command_serialization_methods(command, True) }} {% endfor %} - // Implementations of serialization/deserialization of WPGUDeviceProperties. - size_t SerializedWGPUDevicePropertiesSize(const WGPUDeviceProperties* deviceProperties) { - return sizeof(WGPUDeviceProperties) + - WGPUDevicePropertiesGetExtraRequiredSize(*deviceProperties); - } - - void SerializeWGPUDeviceProperties(const WGPUDeviceProperties* deviceProperties, - char* buffer) { - SerializeBuffer serializeBuffer(buffer, SerializedWGPUDevicePropertiesSize(deviceProperties)); - - WGPUDevicePropertiesTransfer* transfer; - - WireResult result = serializeBuffer.Next(&transfer); - ASSERT(result == WireResult::Success); - - ErrorObjectIdProvider provider; - result = WGPUDevicePropertiesSerialize(*deviceProperties, transfer, &serializeBuffer, provider); - ASSERT(result == WireResult::Success); - } - - bool DeserializeWGPUDeviceProperties(WGPUDeviceProperties* deviceProperties, - const volatile char* buffer, - size_t size) { - const volatile WGPUDevicePropertiesTransfer* transfer; - DeserializeBuffer deserializeBuffer(buffer, size); - if (deserializeBuffer.Read(&transfer) != WireResult::Success) { - return false; - } - - ErrorObjectIdResolver resolver; - return WGPUDevicePropertiesDeserialize(deviceProperties, transfer, &deserializeBuffer, - nullptr, resolver) == WireResult::Success; - } - - size_t SerializedWGPUSupportedLimitsSize(const WGPUSupportedLimits* supportedLimits) { - return sizeof(WGPUSupportedLimits) + - WGPUSupportedLimitsGetExtraRequiredSize(*supportedLimits); - } - - void SerializeWGPUSupportedLimits( - const WGPUSupportedLimits* supportedLimits, - char* buffer) { - SerializeBuffer serializeBuffer(buffer, SerializedWGPUSupportedLimitsSize(supportedLimits)); - - WGPUSupportedLimitsTransfer* transfer; - - WireResult result = serializeBuffer.Next(&transfer); - ASSERT(result == WireResult::Success); - - ErrorObjectIdProvider provider; - result = WGPUSupportedLimitsSerialize(*supportedLimits, transfer, &serializeBuffer, provider); - ASSERT(result == WireResult::Success); - } - - bool DeserializeWGPUSupportedLimits(WGPUSupportedLimits* supportedLimits, - const volatile char* buffer, - size_t size) { - const volatile WGPUSupportedLimitsTransfer* transfer; - DeserializeBuffer deserializeBuffer(buffer, size); - if (deserializeBuffer.Read(&transfer) != WireResult::Success) { - return false; - } - - ErrorObjectIdResolver resolver; - return WGPUSupportedLimitsDeserialize(supportedLimits, transfer, &deserializeBuffer, - nullptr, resolver) == WireResult::Success; - } - } // namespace dawn::wire diff --git a/generator/templates/dawn/wire/WireCmd.h b/generator/templates/dawn/wire/WireCmd.h index 23a8685e7d..e4b4444d5d 100644 --- a/generator/templates/dawn/wire/WireCmd.h +++ b/generator/templates/dawn/wire/WireCmd.h @@ -19,32 +19,11 @@ #include "dawn/wire/BufferConsumer.h" #include "dawn/wire/ObjectType_autogen.h" +#include "dawn/wire/ObjectHandle.h" #include "dawn/wire/WireResult.h" namespace dawn::wire { - using ObjectId = uint32_t; - using ObjectGeneration = uint32_t; - struct ObjectHandle { - ObjectId id; - ObjectGeneration generation; - - ObjectHandle(); - ObjectHandle(ObjectId id, ObjectGeneration generation); - - ObjectHandle(const volatile ObjectHandle& rhs); - ObjectHandle& operator=(const volatile ObjectHandle& rhs); - - // MSVC has a bug where it thinks the volatile copy assignment is a duplicate. - // Workaround this by forwarding to a different function AssignFrom. - template - ObjectHandle& operator=(const T& rhs) { - return AssignFrom(rhs); - } - ObjectHandle& AssignFrom(const ObjectHandle& rhs); - ObjectHandle& AssignFrom(const volatile ObjectHandle& rhs); - }; - // Interface to allocate more space to deserialize pointed-to data. // nullptr is treated as an error. class DeserializeAllocator { diff --git a/generator/templates/dawn/wire/client/ApiObjects.h b/generator/templates/dawn/wire/client/ApiObjects.h index 8c1729d81b..da199cfc67 100644 --- a/generator/templates/dawn/wire/client/ApiObjects.h +++ b/generator/templates/dawn/wire/client/ApiObjects.h @@ -20,10 +20,8 @@ namespace dawn::wire::client { - template - struct ObjectTypeToTypeEnum { - static constexpr ObjectType value = static_cast(-1); - }; + template + inline constexpr ObjectType ObjectTypeToTypeEnum = static_cast(-1); {% for type in by_category["object"] %} {% set Type = type.name.CamelCase() %} @@ -43,9 +41,7 @@ namespace dawn::wire::client { } template <> - struct ObjectTypeToTypeEnum<{{Type}}> { - static constexpr ObjectType value = ObjectType::{{Type}}; - }; + inline constexpr ObjectType ObjectTypeToTypeEnum<{{Type}}> = ObjectType::{{Type}}; {% endfor %} } // namespace dawn::wire::client diff --git a/generator/templates/dawn/wire/client/ApiProcs.cpp b/generator/templates/dawn/wire/client/ApiProcs.cpp index f9b4ccf46f..85fe15d421 100644 --- a/generator/templates/dawn/wire/client/ApiProcs.cpp +++ b/generator/templates/dawn/wire/client/ApiProcs.cpp @@ -58,8 +58,8 @@ namespace dawn::wire::client { //* For object creation, store the object ID the client will use for the result. {% if method.return_type.category == "object" %} - auto* allocation = self->client->{{method.return_type.name.CamelCase()}}Allocator().New(self->client); - cmd.result = ObjectHandle{allocation->object->id, allocation->generation}; + auto* returnObject = self->GetClient()->Make<{{method.return_type.name.CamelCase()}}>(); + cmd.result = returnObject->GetWireHandle(); {% endif %} {% for arg in method.arguments %} @@ -69,10 +69,10 @@ namespace dawn::wire::client { {% endfor %} //* Allocate space to send the command and copy the value args over. - self->client->SerializeCommand(cmd); + self->GetClient()->SerializeCommand(cmd); {% if method.return_type.category == "object" %} - return reinterpret_cast<{{as_cType(method.return_type.name)}}>(allocation->object.get()); + return ToAPI(returnObject); {% endif %} {% else %} return self->{{method.name.CamelCase()}}( @@ -86,23 +86,22 @@ namespace dawn::wire::client { //* When an object's refcount reaches 0, notify the server side of it and delete it. void Client{{as_MethodSuffix(type.name, Name("release"))}}({{cType}} cObj) { {{Type}}* obj = reinterpret_cast<{{Type}}*>(cObj); - obj->refcount --; - if (obj->refcount > 0) { + if (!obj->Release()) { return; } DestroyObjectCmd cmd; cmd.objectType = ObjectType::{{type.name.CamelCase()}}; - cmd.objectId = obj->id; + cmd.objectId = obj->GetWireId(); - obj->client->SerializeCommand(cmd); - obj->client->{{type.name.CamelCase()}}Allocator().Free(obj); + Client* client = obj->GetClient(); + client->SerializeCommand(cmd); + client->Free(obj); } void Client{{as_MethodSuffix(type.name, Name("reference"))}}({{cType}} cObj) { - {{Type}}* obj = reinterpret_cast<{{Type}}*>(cObj); - obj->refcount ++; + reinterpret_cast<{{Type}}*>(cObj)->Reference(); } {% endfor %} diff --git a/generator/templates/dawn/wire/client/ClientBase.h b/generator/templates/dawn/wire/client/ClientBase.h index 0f9cbfe338..03d08e9b30 100644 --- a/generator/templates/dawn/wire/client/ClientBase.h +++ b/generator/templates/dawn/wire/client/ClientBase.h @@ -18,33 +18,13 @@ #include "dawn/wire/ChunkedCommandHandler.h" #include "dawn/wire/WireCmd_autogen.h" #include "dawn/wire/client/ApiObjects.h" -#include "dawn/wire/client/ObjectAllocator.h" namespace dawn::wire::client { class ClientBase : public ChunkedCommandHandler, public ObjectIdProvider { public: ClientBase() = default; - virtual ~ClientBase() = default; - - {% for type in by_category["object"] %} - const ObjectAllocator<{{type.name.CamelCase()}}>& {{type.name.CamelCase()}}Allocator() const { - return m{{type.name.CamelCase()}}Allocator; - } - ObjectAllocator<{{type.name.CamelCase()}}>& {{type.name.CamelCase()}}Allocator() { - return m{{type.name.CamelCase()}}Allocator; - } - {% endfor %} - - void FreeObject(ObjectType objectType, ObjectBase* obj) { - switch (objectType) { - {% for type in by_category["object"] %} - case ObjectType::{{type.name.CamelCase()}}: - m{{type.name.CamelCase()}}Allocator.Free(static_cast<{{type.name.CamelCase()}}*>(obj)); - break; - {% endfor %} - } - } + ~ClientBase() override = default; private: // Implementation of the ObjectIdProvider interface @@ -54,19 +34,15 @@ namespace dawn::wire::client { if (object == nullptr) { return WireResult::FatalError; } - *out = reinterpret_cast<{{as_wireType(type)}}>(object)->id; + *out = reinterpret_cast<{{as_wireType(type)}}>(object)->GetWireId(); return WireResult::Success; } WireResult GetOptionalId({{as_cType(type.name)}} object, ObjectId* out) const final { ASSERT(out != nullptr); - *out = (object == nullptr ? 0 : reinterpret_cast<{{as_wireType(type)}}>(object)->id); + *out = (object == nullptr ? 0 : reinterpret_cast<{{as_wireType(type)}}>(object)->GetWireId()); return WireResult::Success; } {% endfor %} - - {% for type in by_category["object"] %} - ObjectAllocator<{{type.name.CamelCase()}}> m{{type.name.CamelCase()}}Allocator; - {% endfor %} }; } // namespace dawn::wire::client diff --git a/generator/templates/dawn/wire/client/ClientHandlers.cpp b/generator/templates/dawn/wire/client/ClientHandlers.cpp index ace847556d..d09c0f54b1 100644 --- a/generator/templates/dawn/wire/client/ClientHandlers.cpp +++ b/generator/templates/dawn/wire/client/ClientHandlers.cpp @@ -21,7 +21,7 @@ namespace dawn::wire::client { {% for command in cmd_records["return command"] %} bool Client::Handle{{command.name.CamelCase()}}(DeserializeBuffer* deserializeBuffer) { Return{{command.name.CamelCase()}}Cmd cmd; - WireResult deserializeResult = cmd.Deserialize(deserializeBuffer, &mAllocator); + WireResult deserializeResult = cmd.Deserialize(deserializeBuffer, &mWireCommandAllocator); if (deserializeResult == WireResult::FatalError) { return false; @@ -32,9 +32,8 @@ namespace dawn::wire::client { {% set name = as_varName(member.name) %} {% if member.type.dict_name == "ObjectHandle" %} - {{Type}}* {{name}} = {{Type}}Allocator().GetObject(cmd.{{name}}.id); - uint32_t {{name}}Generation = {{Type}}Allocator().GetGeneration(cmd.{{name}}.id); - if ({{name}}Generation != cmd.{{name}}.generation) { + {{Type}}* {{name}} = Get<{{Type}}>(cmd.{{name}}.id); + if ({{name}} != nullptr && {{name}}->GetWireGeneration() != cmd.{{name}}.generation) { {{name}} = nullptr; } {% endif %} @@ -85,7 +84,7 @@ namespace dawn::wire::client { if (!success) { return nullptr; } - mAllocator.Reset(); + mWireCommandAllocator.Reset(); } if (deserializeBuffer.AvailableSize() != 0) { diff --git a/generator/templates/dawn/wire/server/ServerBase.h b/generator/templates/dawn/wire/server/ServerBase.h index 8fef34aee4..35011324f6 100644 --- a/generator/templates/dawn/wire/server/ServerBase.h +++ b/generator/templates/dawn/wire/server/ServerBase.h @@ -27,7 +27,7 @@ namespace dawn::wire::server { class ServerBase : public ChunkedCommandHandler, public ObjectIdResolver { public: ServerBase() = default; - virtual ~ServerBase() = default; + ~ServerBase() override = default; protected: void DestroyAllObjects(const DawnProcTable& procs) { diff --git a/generator/templates/dawn/wire/server/ServerDoers.cpp b/generator/templates/dawn/wire/server/ServerDoers.cpp index 9c6df80132..11776e2417 100644 --- a/generator/templates/dawn/wire/server/ServerDoers.cpp +++ b/generator/templates/dawn/wire/server/ServerDoers.cpp @@ -77,11 +77,6 @@ namespace dawn::wire::server { if (data == nullptr) { return false; } - if (data->deviceInfo != nullptr) { - if (!UntrackDeviceChild(data->deviceInfo, objectType, objectId)) { - return false; - } - } if (data->state == AllocationState::Allocated) { ASSERT(data->handle != nullptr); {% if type.name.CamelCase() in server_reverse_lookup_objects %} @@ -89,17 +84,6 @@ namespace dawn::wire::server { {% endif %} {% if type.name.get() == "device" %} - //* TODO(crbug.com/dawn/384): This is a hack to make sure that all child objects - //* are destroyed before their device. We should have a solution in - //* Dawn native that makes all child objects internally null if their - //* Device is destroyed. - while (data->info->childObjectTypesAndIds.size() > 0) { - auto [childObjectType, childObjectId] = UnpackObjectTypeAndId( - *data->info->childObjectTypesAndIds.begin()); - if (!DoDestroyObject(childObjectType, childObjectId)) { - return false; - } - } if (data->handle != nullptr) { //* Deregisters uncaptured error and device lost callbacks since //* they should not be forwarded if the device no longer exists on the wire. diff --git a/generator/templates/dawn/wire/server/ServerHandlers.cpp b/generator/templates/dawn/wire/server/ServerHandlers.cpp index 5514a3370c..9a9f05a6b5 100644 --- a/generator/templates/dawn/wire/server/ServerHandlers.cpp +++ b/generator/templates/dawn/wire/server/ServerHandlers.cpp @@ -52,24 +52,6 @@ namespace dawn::wire::server { return false; } {{name}}Data->generation = cmd.{{name}}.generation; - - //* TODO(crbug.com/dawn/384): This is a hack to make sure that all child objects - //* are destroyed before their device. The dawn_native device needs to track all child objects so - //* it can destroy them if the device is destroyed first. - {% if command.derived_object %} - {% set type = command.derived_object %} - {% if type.name.get() == "device" %} - {{name}}Data->deviceInfo = DeviceObjects().Get(cmd.selfId)->info.get(); - {% else %} - auto* selfData = {{type.name.CamelCase()}}Objects().Get(cmd.selfId); - {{name}}Data->deviceInfo = selfData->deviceInfo; - {% endif %} - if ({{name}}Data->deviceInfo != nullptr) { - if (!TrackDeviceChild({{name}}Data->deviceInfo, ObjectType::{{Type}}, cmd.{{name}}.id)) { - return false; - } - } - {% endif %} {% endfor %} //* Do command diff --git a/include/dawn/BUILD.gn b/include/dawn/BUILD.gn index d493820b2c..94a8a570a2 100644 --- a/include/dawn/BUILD.gn +++ b/include/dawn/BUILD.gn @@ -67,18 +67,5 @@ config("public") { include_dirs = [ "${target_gen_dir}/../../include", "${dawn_root}/include", - - "${dawn_root}/src/include", # TODO(crbug.com/dawn/1275) - remove ] } - -################################################################################ -# Build target aliases -# TODO(crbug.com/dawn/1275) - remove these -################################################################################ -group("dawncpp_headers") { - public_deps = [ ":cpp_headers" ] -} -group("dawn_headers") { - public_deps = [ ":headers" ] -} diff --git a/include/dawn/native/D3D12Backend.h b/include/dawn/native/D3D12Backend.h index 2cff0f2d5b..611ac80620 100644 --- a/include/dawn/native/D3D12Backend.h +++ b/include/dawn/native/D3D12Backend.h @@ -31,6 +31,8 @@ struct ID3D12Resource; namespace dawn::native::d3d12 { class D3D11on12ResourceCache; +class Device; +class ExternalImageDXGIImpl; DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr GetD3D12Device(WGPUDevice device); DAWN_NATIVE_EXPORT DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device, @@ -52,51 +54,67 @@ struct DAWN_NATIVE_EXPORT ExternalImageDescriptorDXGISharedHandle : ExternalImag ExternalImageDescriptorDXGISharedHandle(); // Note: SharedHandle must be a handle to a texture object. - HANDLE sharedHandle; + // TODO(dawn:576): Remove after changing Chromium code to set textureSharedHandle. + HANDLE sharedHandle = nullptr; + HANDLE textureSharedHandle = nullptr; + + // Optional shared handle to a D3D11/12 fence which can be used to synchronize using wait/signal + // values specified in the access descriptor below. If null, the texture will be assumed to have + // an associated DXGI keyed mutex which will be used with a fixed key of 0 for synchronization. + HANDLE fenceSharedHandle = nullptr; }; // Keyed mutex acquire/release uses a fixed key of 0 to match Chromium behavior. constexpr UINT64 kDXGIKeyedMutexAcquireReleaseKey = 0; -struct DAWN_NATIVE_EXPORT ExternalImageAccessDescriptorDXGIKeyedMutex +struct DAWN_NATIVE_EXPORT ExternalImageAccessDescriptorDXGISharedHandle : ExternalImageAccessDescriptor { + public: + // Value used for fence wait. A value of 0 is valid, but essentially a no-op since the fence + // lifetime starts with the 0 value signaled. A value of UINT64_MAX is ignored since it's also + // used by the D3D runtime to indicate that the device was removed. + uint64_t fenceWaitValue = 0; + + // Value to signal the fence with after the texture is destroyed. A value of 0 means the fence + // will not be signaled. + uint64_t fenceSignalValue = 0; + + // Whether the texture is for a WebGPU swap chain. + bool isSwapChainTexture = false; +}; + +// TODO(dawn:576): Remove after changing Chromium code to use the new struct name. +struct DAWN_NATIVE_EXPORT ExternalImageAccessDescriptorDXGIKeyedMutex + : ExternalImageAccessDescriptorDXGISharedHandle { public: // TODO(chromium:1241533): Remove deprecated keyed mutex params after removing associated // code from Chromium - we use a fixed key of 0 for acquire and release everywhere now. uint64_t acquireMutexKey; uint64_t releaseMutexKey; - bool isSwapChainTexture = false; }; class DAWN_NATIVE_EXPORT ExternalImageDXGI { public: ~ExternalImageDXGI(); - // Note: SharedHandle must be a handle to a texture object. static std::unique_ptr Create( WGPUDevice device, const ExternalImageDescriptorDXGISharedHandle* descriptor); + // Returns true if the external image resources are still valid, otherwise ProduceTexture() is + // guaranteed to fail e.g. after device destruction. + bool IsValid() const; + + // TODO(sunnyps): |device| is ignored - remove after Chromium migrates to single parameter call. WGPUTexture ProduceTexture(WGPUDevice device, - const ExternalImageAccessDescriptorDXGIKeyedMutex* descriptor); + const ExternalImageAccessDescriptorDXGISharedHandle* descriptor); + + WGPUTexture ProduceTexture(const ExternalImageAccessDescriptorDXGISharedHandle* descriptor); private: - ExternalImageDXGI(Microsoft::WRL::ComPtr d3d12Resource, - const WGPUTextureDescriptor* descriptor); + explicit ExternalImageDXGI(std::unique_ptr impl); - Microsoft::WRL::ComPtr mD3D12Resource; - - // Contents of WGPUTextureDescriptor are stored individually since the descriptor - // could outlive this image. - WGPUTextureUsageFlags mUsage; - WGPUTextureUsageFlags mUsageInternal = WGPUTextureUsage_None; - WGPUTextureDimension mDimension; - WGPUExtent3D mSize; - WGPUTextureFormat mFormat; - uint32_t mMipLevelCount; - uint32_t mSampleCount; - - std::unique_ptr mD3D11on12ResourceCache; + std::unique_ptr mImpl; }; struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptionsBase { diff --git a/include/dawn/native/DawnNative.h b/include/dawn/native/DawnNative.h index 35410837e4..0d0df145d4 100644 --- a/include/dawn/native/DawnNative.h +++ b/include/dawn/native/DawnNative.h @@ -39,6 +39,9 @@ class AdapterBase; // An optional parameter of Adapter::CreateDevice() to send additional information when creating // a Device. For example, we can use it to enable a workaround, optimization or feature. struct DAWN_NATIVE_EXPORT DawnDeviceDescriptor { + DawnDeviceDescriptor(); + ~DawnDeviceDescriptor(); + std::vector requiredFeatures; std::vector forceEnabledToggles; std::vector forceDisabledToggles; @@ -83,7 +86,6 @@ class DAWN_NATIVE_EXPORT Adapter { std::vector GetSupportedExtensions() const; std::vector GetSupportedFeatures() const; - WGPUDeviceProperties GetAdapterProperties() const; bool GetLimits(WGPUSupportedLimits* limits) const; void SetUseTieredLimits(bool useTieredLimits); @@ -167,6 +169,8 @@ class DAWN_NATIVE_EXPORT Instance { // TODO(dawn:1374) Deprecate this once it is passed via the descriptor. void SetPlatform(dawn::platform::Platform* platform); + uint64_t GetDeviceCountForTesting() const; + // Returns the underlying WGPUInstance object. WGPUInstance Get() const; @@ -186,6 +190,9 @@ DAWN_NATIVE_EXPORT size_t GetLazyClearCountForTesting(WGPUDevice device); // Backdoor to get the number of deprecation warnings for testing DAWN_NATIVE_EXPORT size_t GetDeprecationWarningCountForTesting(WGPUDevice device); +// Backdoor to get the number of adapters an instance knows about for testing +DAWN_NATIVE_EXPORT size_t GetAdapterCountForTesting(WGPUInstance instance); + // Query if texture has been initialized DAWN_NATIVE_EXPORT bool IsTextureSubresourceInitialized( WGPUTexture texture, @@ -232,13 +239,13 @@ struct DAWN_NATIVE_EXPORT ExternalImageDescriptor { struct DAWN_NATIVE_EXPORT ExternalImageAccessDescriptor { public: - bool isInitialized; // Whether the texture is initialized on import - WGPUTextureUsageFlags usage; + bool isInitialized = false; // Whether the texture is initialized on import + WGPUTextureUsageFlags usage = WGPUTextureUsage_None; }; struct DAWN_NATIVE_EXPORT ExternalImageExportInfo { public: - bool isInitialized; // Whether the texture is initialized after export + bool isInitialized = false; // Whether the texture is initialized after export ExternalImageType GetType() const; protected: @@ -248,6 +255,8 @@ struct DAWN_NATIVE_EXPORT ExternalImageExportInfo { ExternalImageType mType; }; +DAWN_NATIVE_EXPORT bool CheckIsErrorForTesting(void* objectHandle); + DAWN_NATIVE_EXPORT const char* GetObjectLabelForTesting(void* objectHandle); DAWN_NATIVE_EXPORT uint64_t GetAllocatedSizeForTesting(WGPUBuffer buffer); diff --git a/include/dawn/native/MetalBackend.h b/include/dawn/native/MetalBackend.h index 20c80484fd..72a9cb0090 100644 --- a/include/dawn/native/MetalBackend.h +++ b/include/dawn/native/MetalBackend.h @@ -60,14 +60,6 @@ DAWN_NATIVE_EXPORT void WaitForCommandsToBeScheduled(WGPUDevice device); } // namespace dawn::native::metal -#ifdef __OBJC__ -namespace dawn::native::metal { - -DAWN_NATIVE_EXPORT id GetMetalDevice(WGPUDevice device); - -} // namespace dawn::native::metal -#endif // __OBJC__ - #pragma clang diagnostic pop #endif // INCLUDE_DAWN_NATIVE_METALBACKEND_H_ diff --git a/include/dawn/native/OpenGLBackend.h b/include/dawn/native/OpenGLBackend.h index bee9daeae9..cceaab85e7 100644 --- a/include/dawn/native/OpenGLBackend.h +++ b/include/dawn/native/OpenGLBackend.h @@ -23,15 +23,14 @@ typedef void* EGLImage; namespace dawn::native::opengl { struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptionsBase { - AdapterDiscoveryOptions(); + explicit AdapterDiscoveryOptions(WGPUBackendType type); void* (*getProc)(const char*); }; -struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptionsES : public AdapterDiscoveryOptionsBase { +// TODO(crbug.com/dawn/810): This struct can be removed once Chrome is no longer using it. +struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptionsES : public AdapterDiscoveryOptions { AdapterDiscoveryOptionsES(); - - void* (*getProc)(const char*); }; using PresentCallback = void (*)(void*); diff --git a/include/dawn/native/VulkanBackend.h b/include/dawn/native/VulkanBackend.h index 3885dad556..9ee4125809 100644 --- a/include/dawn/native/VulkanBackend.h +++ b/include/dawn/native/VulkanBackend.h @@ -17,6 +17,7 @@ #include +#include #include #include "dawn/dawn_wsi.h" @@ -68,7 +69,7 @@ struct ExternalImageExportInfoVk : ExternalImageExportInfo { using ExternalImageExportInfo::ExternalImageExportInfo; }; -// Can't use DAWN_PLATFORM_LINUX since header included in both Dawn and Chrome +// Can't use DAWN_PLATFORM_IS(LINUX) since header included in both Dawn and Chrome #ifdef __linux__ // Common properties of external images represented by FDs. On successful import the file @@ -92,11 +93,18 @@ struct DAWN_NATIVE_EXPORT ExternalImageDescriptorOpaqueFD : ExternalImageDescrip uint32_t memoryTypeIndex; // Must match VkMemoryAllocateInfo from image creation }; +// The plane-wise offset and stride. +struct DAWN_NATIVE_EXPORT PlaneLayout { + uint64_t offset; + uint32_t stride; +}; + // Descriptor for dma-buf file descriptor image import struct DAWN_NATIVE_EXPORT ExternalImageDescriptorDmaBuf : ExternalImageDescriptorFD { ExternalImageDescriptorDmaBuf(); - uint32_t stride; // Stride of the buffer in bytes + static constexpr uint32_t kMaxPlanes = 3; + std::array planeLayouts; uint64_t drmModifier; // DRM modifier of the buffer }; diff --git a/include/dawn/platform/DawnPlatform.h b/include/dawn/platform/DawnPlatform.h index 5c616d1bbc..0645441d5f 100644 --- a/include/dawn/platform/DawnPlatform.h +++ b/include/dawn/platform/DawnPlatform.h @@ -93,10 +93,10 @@ class DAWN_PLATFORM_EXPORT Platform { const uint64_t* argValues, unsigned char flags); - // The |fingerprint| is provided by Dawn to inform the client to discard the Dawn caches - // when the fingerprint changes. The returned CachingInterface is expected to outlive the - // device which uses it to persistently cache objects. - virtual CachingInterface* GetCachingInterface(const void* fingerprint, size_t fingerprintSize); + // The returned CachingInterface is expected to outlive the device which uses it to persistently + // cache objects. + virtual CachingInterface* GetCachingInterface(); + virtual std::unique_ptr CreateWorkerTaskPool(); private: diff --git a/include/dawn/wire/Wire.h b/include/dawn/wire/Wire.h index 1f8e96b42f..e866db3dd8 100644 --- a/include/dawn/wire/Wire.h +++ b/include/dawn/wire/Wire.h @@ -50,26 +50,6 @@ class DAWN_WIRE_EXPORT CommandHandler { virtual const volatile char* HandleCommands(const volatile char* commands, size_t size) = 0; }; -DAWN_WIRE_EXPORT size_t -SerializedWGPUDevicePropertiesSize(const WGPUDeviceProperties* deviceProperties); - -DAWN_WIRE_EXPORT void SerializeWGPUDeviceProperties(const WGPUDeviceProperties* deviceProperties, - char* serializeBuffer); - -DAWN_WIRE_EXPORT bool DeserializeWGPUDeviceProperties(WGPUDeviceProperties* deviceProperties, - const volatile char* deserializeBuffer, - size_t deserializeBufferSize); - -DAWN_WIRE_EXPORT size_t -SerializedWGPUSupportedLimitsSize(const WGPUSupportedLimits* supportedLimits); - -DAWN_WIRE_EXPORT void SerializeWGPUSupportedLimits(const WGPUSupportedLimits* supportedLimits, - char* serializeBuffer); - -DAWN_WIRE_EXPORT bool DeserializeWGPUSupportedLimits(WGPUSupportedLimits* supportedLimits, - const volatile char* deserializeBuffer, - size_t deserializeBufferSize); - } // namespace dawn::wire // TODO(dawn:824): Remove once the deprecation period is passed. diff --git a/include/dawn/wire/WireClient.h b/include/dawn/wire/WireClient.h index 26e1f1deab..93cc199990 100644 --- a/include/dawn/wire/WireClient.h +++ b/include/dawn/wire/WireClient.h @@ -68,9 +68,10 @@ class DAWN_WIRE_EXPORT WireClient : public CommandHandler { explicit WireClient(const WireClientDescriptor& descriptor); ~WireClient() override; - const volatile char* HandleCommands(const volatile char* commands, size_t size) final; + const volatile char* HandleCommands(const volatile char* commands, size_t size) override; - ReservedTexture ReserveTexture(WGPUDevice device); + ReservedTexture ReserveTexture(WGPUDevice device, + const WGPUTextureDescriptor* descriptor); ReservedSwapChain ReserveSwapChain(WGPUDevice device); ReservedDevice ReserveDevice(); ReservedInstance ReserveInstance(); diff --git a/include/dawn/wire/WireServer.h b/include/dawn/wire/WireServer.h index 99056089a5..9fc2ab3973 100644 --- a/include/dawn/wire/WireServer.h +++ b/include/dawn/wire/WireServer.h @@ -39,7 +39,7 @@ class DAWN_WIRE_EXPORT WireServer : public CommandHandler { explicit WireServer(const WireServerDescriptor& descriptor); ~WireServer() override; - const volatile char* HandleCommands(const volatile char* commands, size_t size) final; + const volatile char* HandleCommands(const volatile char* commands, size_t size) override; bool InjectTexture(WGPUTexture texture, uint32_t id, @@ -65,6 +65,11 @@ class DAWN_WIRE_EXPORT WireServer : public CommandHandler { // previously injected devices, and observing if GetDevice(id, generation) returns non-null. WGPUDevice GetDevice(uint32_t id, uint32_t generation); + // Check if a device handle is known by the wire. + // In Chrome, we need to know the list of live devices so we can call device.Tick() on all of + // them periodically to ensure progress on asynchronous work is made. + bool IsDeviceKnown(WGPUDevice device) const; + private: std::unique_ptr mImpl; }; diff --git a/include/tint/override_id.h b/include/tint/override_id.h new file mode 100644 index 0000000000..957673de19 --- /dev/null +++ b/include/tint/override_id.h @@ -0,0 +1,60 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_OVERRIDE_ID_H_ +#define SRC_TINT_OVERRIDE_ID_H_ + +#include + +namespace tint { + +/// OverrideId is a numerical identifier for an override variable, unique per program. +struct OverrideId { + uint16_t value = 0; +}; + +/// Equality operator for OverrideId +/// @param lhs the OverrideId on the left of the '=' operator +/// @param rhs the OverrideId on the right of the '=' operator +/// @returns true if `lhs` is equal to `rhs` +inline bool operator==(OverrideId lhs, OverrideId rhs) { + return lhs.value == rhs.value; +} + +/// Less-than operator for OverrideId +/// @param lhs the OverrideId on the left of the '<' operator +/// @param rhs the OverrideId on the right of the '<' operator +/// @returns true if `lhs` comes before `rhs` +inline bool operator<(OverrideId lhs, OverrideId rhs) { + return lhs.value < rhs.value; +} + +} // namespace tint + +namespace std { + +/// Custom std::hash specialization for tint::OverrideId. +template <> +class hash { + public: + /// @param id the override identifier + /// @return the hash of the override identifier + inline std::size_t operator()(tint::OverrideId id) const { + return std::hash()(id.value); + } +}; + +} // namespace std + +#endif // SRC_TINT_OVERRIDE_ID_H_ diff --git a/include/tint/tint.h b/include/tint/tint.h index 2b8430e01d..a6ab6caf47 100644 --- a/include/tint/tint.h +++ b/include/tint/tint.h @@ -18,7 +18,6 @@ // TODO(tint:88): When implementing support for an install target, all of these // headers will need to be moved to include/tint/. -#include "src/tint/ast/pipeline_stage.h" #include "src/tint/demangler.h" #include "src/tint/diagnostic/printer.h" #include "src/tint/inspector/inspector.h" @@ -32,7 +31,9 @@ #include "src/tint/transform/renamer.h" #include "src/tint/transform/robustness.h" #include "src/tint/transform/single_entry_point.h" +#include "src/tint/transform/substitute_override.h" #include "src/tint/transform/vertex_pulling.h" +#include "src/tint/writer/flatten_bindings.h" #include "src/tint/writer/writer.h" #if TINT_BUILD_SPV_READER diff --git a/include/webgpu/webgpu_glfw.h b/include/webgpu/webgpu_glfw.h new file mode 100644 index 0000000000..5d3f4e3c7c --- /dev/null +++ b/include/webgpu/webgpu_glfw.h @@ -0,0 +1,58 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDE_WEBGPU_WEBGPU_GLFW_H_ +#define INCLUDE_WEBGPU_WEBGPU_GLFW_H_ + +#include + +#include "webgpu/webgpu_cpp.h" + +#if defined(WGPU_GLFW_SHARED_LIBRARY) +#if defined(_WIN32) +#if defined(WGPU_GLFW_IMPLEMENTATION) +#define WGPU_GLFW_EXPORT __declspec(dllexport) +#else +#define WGPU_GLFW_EXPORT __declspec(dllimport) +#endif +#else // defined(_WIN32) +#if defined(WGPU_GLFW_IMPLEMENTATION) +#define WGPU_GLFW_EXPORT __attribute__((visibility("default"))) +#else +#define WGPU_GLFW_EXPORT +#endif +#endif // defined(_WIN32) +#else // defined(WGPU_GLFW_SHARED_LIBRARY) +#define WGPU_GLFW_EXPORT +#endif // defined(WGPU_GLFW_SHARED_LIBRARY) + +struct GLFWwindow; + +namespace wgpu::glfw { + +// Does the necessary setup on the GLFWwindow to allow creating a wgpu::Surface with it and +// calls `instance.CreateSurface` with the correct descriptor for this window. +// Returns a null wgpu::Surface on failure. +WGPU_GLFW_EXPORT wgpu::Surface CreateSurfaceForWindow(const wgpu::Instance& instance, + GLFWwindow* window); + +// Use for testing only. Does everything that CreateSurfaceForWindow does except the call to +// CreateSurface. Useful to be able to modify the descriptor for testing, or when trying to +// avoid using the global proc table. +WGPU_GLFW_EXPORT std::unique_ptr SetupWindowAndGetSurfaceDescriptor( + GLFWwindow* window); + +} // namespace wgpu::glfw + +#endif // INCLUDE_WEBGPU_WEBGPU_GLFW_H_ diff --git a/infra/config/global/generated/cr-buildbucket.cfg b/infra/config/global/generated/cr-buildbucket.cfg index 9c58b0180f..ba6a2f0e90 100644 --- a/infra/config/global/generated/cr-buildbucket.cfg +++ b/infra/config/global/generated/cr-buildbucket.cfg @@ -20,7 +20,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:false" properties_j: "gen_fuzz_corpus:true" @@ -42,7 +42,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:true" properties_j: "target_cpu:\"x64\"" @@ -63,7 +63,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:true" properties_j: "target_cpu:\"x86\"" @@ -84,7 +84,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:false" properties_j: "target_cpu:\"x64\"" @@ -105,7 +105,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:false" properties_j: "target_cpu:\"x86\"" @@ -126,7 +126,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:true" properties_j: "target_cpu:\"x64\"" @@ -151,7 +151,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:false" properties_j: "target_cpu:\"x64\"" @@ -176,7 +176,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:true" properties_j: "target_cpu:\"x64\"" @@ -201,7 +201,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:true" properties_j: "target_cpu:\"x86\"" @@ -226,7 +226,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:false" properties_j: "target_cpu:\"x64\"" @@ -251,7 +251,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "clang:true" properties_j: "debug:false" properties_j: "target_cpu:\"x86\"" @@ -332,7 +332,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:true" @@ -354,7 +354,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:true" @@ -376,7 +376,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:false" @@ -398,7 +398,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:false" @@ -420,7 +420,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:true" @@ -446,7 +446,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:false" @@ -492,7 +492,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:true" @@ -518,7 +518,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:true" @@ -544,7 +544,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:false" @@ -570,7 +570,7 @@ buckets { name: "dawn" cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/main" - properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\"}" + properties_j: "$build/goma:{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true}" properties_j: "$depot_tools/bot_update:{\"apply_patch_on_gclient\":true}" properties_j: "clang:true" properties_j: "debug:false" diff --git a/infra/config/global/generated/project.cfg b/infra/config/global/generated/project.cfg index 19abc318fd..acfee71cf0 100644 --- a/infra/config/global/generated/project.cfg +++ b/infra/config/global/generated/project.cfg @@ -7,7 +7,7 @@ name: "dawn" access: "group:all" lucicfg { - version: "1.30.11" + version: "1.31.3" package_dir: ".." config_dir: "generated" entry_point: "main.star" diff --git a/infra/config/global/main.star b/infra/config/global/main.star index 051e75799a..d774c4fa1c 100755 --- a/infra/config/global/main.star +++ b/infra/config/global/main.star @@ -226,6 +226,7 @@ def get_default_properties(os, clang, debug, cpu, fuzzer): goma_props.update({ "server_host": "goma.chromium.org", "rpc_extra_params": "?prod", + "use_luci_auth": True, }) if os.category != os_category.MAC: goma_props["enable_ats"] = True diff --git a/infra/kokoro/linux/build.sh b/infra/kokoro/linux/build.sh index c8f8ff5f4e..6d05eaacb0 100755 --- a/infra/kokoro/linux/build.sh +++ b/infra/kokoro/linux/build.sh @@ -30,6 +30,12 @@ else TMP_DIR=/tmp fi +echo "*****************************************************************" +echo "* build.sh" +echo "*" +echo "* df:" +df +echo "*****************************************************************" # --privileged is required for some sanitizer builds, as they seem to require PTRACE privileges docker run --rm -i \ diff --git a/infra/kokoro/linux/docker.sh b/infra/kokoro/linux/docker.sh index 8cbf85be6d..c2bcb77793 100755 --- a/infra/kokoro/linux/docker.sh +++ b/infra/kokoro/linux/docker.sh @@ -50,6 +50,9 @@ function status { echo "" echo "*****************************************************************" echo "* $@" + echo "*" + echo "* df:" + df echo "*****************************************************************" echo "" task_begin $@ @@ -119,6 +122,13 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then COMMON_CMAKE_FLAGS+=" -DCMAKE_BUILD_TYPE=${BUILD_TYPE}" COMMON_CMAKE_FLAGS+=" -DTINT_DOCS_WARN_AS_ERROR=1" COMMON_CMAKE_FLAGS+=" -DTINT_BUILD_BENCHMARKS=1" + COMMON_CMAKE_FLAGS+=" -DTINT_BUILD_SPV_READER=1" + COMMON_CMAKE_FLAGS+=" -DTINT_BUILD_WGSL_READER=1" + COMMON_CMAKE_FLAGS+=" -DTINT_BUILD_GLSL_WRITER=1" + COMMON_CMAKE_FLAGS+=" -DTINT_BUILD_HLSL_WRITER=1" + COMMON_CMAKE_FLAGS+=" -DTINT_BUILD_MSL_WRITER=1" + COMMON_CMAKE_FLAGS+=" -DTINT_BUILD_SPV_WRITER=1" + COMMON_CMAKE_FLAGS+=" -DTINT_BUILD_WGSL_WRITER=1" if [ "$BUILD_TOOLCHAIN" == "clang" ]; then using clang-10.0.0 diff --git a/infra/kokoro/windows/build.bat b/infra/kokoro/windows/build.bat index 54c180b891..9a355c9716 100644 --- a/infra/kokoro/windows/build.bat +++ b/infra/kokoro/windows/build.bat @@ -62,18 +62,11 @@ mkdir %TEMP_DIR% || goto :error call :status "Fetching and installing DXC" @echo on -set DXC_RELEASE="https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.6.2112/dxc_2021_12_08.zip" +set DXC_RELEASE="https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.7.2207/dxc_2022_07_18.zip" curl -k -L %DXC_RELEASE% --output "%TEMP_DIR%\dxc_release.zip" || goto :error powershell.exe -Command "Expand-Archive -LiteralPath '%TEMP_DIR%\dxc_release.zip' -DestinationPath '%TEMP_DIR%\dxc'" || goto :error set DXC_PATH=%TEMP_DIR%\dxc\bin\x64 -rem Patch with artifact build that contains fixes not present in the release build -set DXC_ARTIFACT="https://ci.appveyor.com/api/projects/dnovillo/directxshadercompiler/artifacts/build%%2FRelease%%2Fdxc-artifacts.zip?branch=master&pr=false&job=image%%3A%%20Visual%%20Studio%%202019" -curl -k -L %DXC_ARTIFACT% --output "%TEMP_DIR%\dxc_artifact.zip" || goto :error -powershell.exe -Command "Expand-Archive -Force -LiteralPath '%TEMP_DIR%\dxc_artifact.zip' -DestinationPath '%TEMP_DIR%\dxc_artifact'" || goto :error -move /Y %TEMP_DIR%\dxc_artifact\bin\* %DXC_PATH% -@echo off - call :status "Fetching and installing Windows SDK for d3dcompiler DLL" @echo on set WINSDK_DLL_INSTALLER=https://go.microsoft.com/fwlink/?linkid=2164145 @@ -116,7 +109,7 @@ call :status "Configuring build system" @echo on mkdir %BUILD_DIR% cd /d %BUILD_DIR% -set COMMON_CMAKE_FLAGS=-DTINT_BUILD_DOCS=O -DTINT_BUILD_BENCHMARKS=1 -DCMAKE_BUILD_TYPE=%BUILD_TYPE% +set COMMON_CMAKE_FLAGS=-DTINT_BUILD_DOCS=O -DTINT_BUILD_BENCHMARKS=1 -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DTINT_BUILD_BENCHMARKS=1 -DTINT_BUILD_SPV_READER=1 -DTINT_BUILD_WGSL_READER=1 -DTINT_BUILD_GLSL_WRITER=1 -DTINT_BUILD_HLSL_WRITER=1 -DTINT_BUILD_MSL_WRITER=1 -DTINT_BUILD_SPV_WRITER=1 -DTINT_BUILD_WGSL_WRITER=1 @echo off call :status "Building dawn" @@ -142,20 +135,12 @@ tint_unittests.exe || goto :error call :status "Testing test/tint/test-all.sh" @echo on cd /d %SRC_DIR% || goto :error -rem Run tests with DXC and Metal validation +rem Run tests with DXC, FXC and Metal validation set OLD_PATH=%PATH% set PATH=C:\Program Files\Metal Developer Tools\macos\bin;%PATH% where metal.exe -set PATH=%DXC_PATH%;%OLD_PATH% -where dxc.exe dxil.dll +set PATH=%DXC_PATH%;%D3DCOMPILER_PATH%;%OLD_PATH% call git bash -- ./test/tint/test-all.sh ../dawn-build/tint.exe --verbose || goto :error -@echo on -set PATH=%OLD_PATH% -rem Run again to test with FXC validation -set PATH=%D3DCOMPILER_PATH%;%OLD_PATH% -where d3dcompiler_47.dll -call git bash -- ./test/tint/test-all.sh ../dawn-build/tint.exe --verbose --format hlsl --fxc || goto :error -@echo on set PATH=%OLD_PATH% @echo off diff --git a/scripts/dawn_features.gni b/scripts/dawn_features.gni index 234791cf0d..57227dea12 100644 --- a/scripts/dawn_features.gni +++ b/scripts/dawn_features.gni @@ -19,10 +19,12 @@ if (build_with_chromium) { import("//build/config/sanitizers/sanitizers.gni") dawn_use_x11 = ozone_platform_x11 + dawn_use_wayland = false } else { declare_args() { # Whether Dawn should enable X11 support. dawn_use_x11 = is_linux && !is_chromeos + dawn_use_wayland = false } } diff --git a/scripts/dawn_overrides_with_defaults.gni b/scripts/dawn_overrides_with_defaults.gni index b4142ac6eb..bbe79e18c4 100644 --- a/scripts/dawn_overrides_with_defaults.gni +++ b/scripts/dawn_overrides_with_defaults.gni @@ -85,3 +85,7 @@ if (!defined(dawn_vulkan_validation_layers_dir)) { if (!defined(dawn_abseil_dir)) { dawn_abseil_dir = "//third_party/abseil-cpp" } + +if (!defined(dawn_version_file)) { + dawn_version_file = "" +} diff --git a/src/dawn/BUILD.gn b/src/dawn/BUILD.gn index 67991adbac..83e1b40bb2 100644 --- a/src/dawn/BUILD.gn +++ b/src/dawn/BUILD.gn @@ -77,23 +77,3 @@ dawn_json_generator("emscripten_bits_gen") { "emscripten-bits/library_webgpu_enum_tables.js", ] } - -################################################################################ -# Build target aliases -# TODO(crbug.com/dawn/1275) - remove these -################################################################################ -group("dawncpp") { - public_deps = [ ":cpp" ] -} -group("dawncpp_headers") { - public_deps = [ "${dawn_root}/include/dawn:cpp_headers" ] -} -group("dawn_proc") { - public_deps = [ ":proc" ] -} -group("dawn_headers") { - public_deps = [ "${dawn_root}/include/dawn:headers" ] -} -group("dawn_cpp") { - public_deps = [ ":cpp" ] -} diff --git a/src/dawn/CMakeLists.txt b/src/dawn/CMakeLists.txt index f1f834eea1..73f465fc77 100644 --- a/src/dawn/CMakeLists.txt +++ b/src/dawn/CMakeLists.txt @@ -22,6 +22,7 @@ add_subdirectory(native) add_subdirectory(wire) # TODO(dawn:269): Remove once the implementation-based swapchains are removed. add_subdirectory(utils) +add_subdirectory(glfw) if (DAWN_BUILD_SAMPLES) #TODO(dawn:269): Add this once implementation-based swapchains are removed. @@ -112,6 +113,8 @@ common_compile_options(dawncpp) target_sources(dawncpp PRIVATE ${DAWNCPP_GEN_SOURCES}) target_link_libraries(dawncpp PUBLIC dawncpp_headers) +add_library(webgpu_cpp ALIAS dawncpp) + ############################################################################### # libdawn_proc ############################################################################### diff --git a/src/dawn/OWNERS b/src/dawn/OWNERS index fdc046d6a6..65efb86493 100644 --- a/src/dawn/OWNERS +++ b/src/dawn/OWNERS @@ -3,4 +3,4 @@ cwallez@chromium.org enga@chromium.org kainino@chromium.org jiawei.shao@intel.com -lokokun@google.com +lokokung@google.com diff --git a/src/dawn/common/Alloc.h b/src/dawn/common/Alloc.h index c13b33b24a..23bc92d934 100644 --- a/src/dawn/common/Alloc.h +++ b/src/dawn/common/Alloc.h @@ -20,9 +20,9 @@ template T* AllocNoThrow(size_t count) { -#if defined(ADDRESS_SANITIZER) +#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) if (count * sizeof(T) >= 0x70000000) { - // std::nothrow isn't implemented on ASAN and it has a 2GB allocation limit. + // std::nothrow isn't implemented in sanitizers and they often have a 2GB allocation limit. // Catch large allocations and error out so fuzzers make progress. return nullptr; } diff --git a/src/dawn/common/Assert.cpp b/src/dawn/common/Assert.cpp index 2599e12417..ecc92dfc83 100644 --- a/src/dawn/common/Assert.cpp +++ b/src/dawn/common/Assert.cpp @@ -17,6 +17,38 @@ #include #include "dawn/common/Log.h" +#include "dawn/common/Platform.h" + +#if DAWN_COMPILER_IS(CLANG) || DAWN_COMPILER_IS(GCC) +void BreakPoint() { +#if DAWN_PLATFORM_IS(X86) + __asm__ __volatile__("int $3\n\t"); +#elif DAWN_PLATFORM_IS(ARM32) + __asm__ __volatile__("bkpt 0"); +#elif DAWN_PLATFORM_IS(ARM64) + __asm__ __volatile__("brk 0"); +#elif DAWN_PLATFORM_IS(RISCV) + __asm__ __volatile__("ebreak"); +#elif DAWN_PLATFORM_IS(MIPS) + __asm__ __volatile__("break"); +#elif DAWN_PLATFORM_IS(S390) || DAWN_PLATFORM_IS_(S390X) + __asm__ __volatile__(".word 0x0001"); +#elif DAWN_PLATFORM_IS(PPC) || DAWN_PLATFORM_IS_(PPC64) + __asm__ __volatile__("twge 2,2"); +#else +#error "Unsupported platform" +#endif +} + +#elif DAWN_COMPILER_IS(MSVC) +extern void __cdecl __debugbreak(void); +void BreakPoint() { + __debugbreak(); +} + +#else +#error "Unsupported compiler" +#endif void HandleAssertionFailure(const char* file, const char* function, @@ -27,6 +59,6 @@ void HandleAssertionFailure(const char* file, #if defined(DAWN_ABORT_ON_ASSERT) abort(); #else - DAWN_BREAKPOINT(); + BreakPoint(); #endif } diff --git a/src/dawn/common/Assert.h b/src/dawn/common/Assert.h index ba4a429bb3..244cd41e95 100644 --- a/src/dawn/common/Assert.h +++ b/src/dawn/common/Assert.h @@ -31,7 +31,7 @@ // MSVC triggers a warning in /W4 for do {} while(0). SDL worked around this by using (0,0) and // points out that it looks like an owl face. -#if defined(DAWN_COMPILER_MSVC) +#if DAWN_COMPILER_IS(MSVC) #define DAWN_ASSERT_LOOP_CONDITION (0, 0) #else #define DAWN_ASSERT_LOOP_CONDITION (0) @@ -48,9 +48,9 @@ } \ } while (DAWN_ASSERT_LOOP_CONDITION) #else -#if defined(DAWN_COMPILER_MSVC) +#if DAWN_COMPILER_IS(MSVC) #define DAWN_ASSERT_CALLSITE_HELPER(file, func, line, condition) __assume(condition) -#elif defined(DAWN_COMPILER_CLANG) && defined(__builtin_assume) +#elif DAWN_COMPILER_IS(CLANG) && defined(__builtin_assume) #define DAWN_ASSERT_CALLSITE_HELPER(file, func, line, condition) __builtin_assume(condition) #else #define DAWN_ASSERT_CALLSITE_HELPER(file, func, line, condition) \ diff --git a/src/dawn/common/BUILD.gn b/src/dawn/common/BUILD.gn index 8a9c26db1f..f46d108747 100644 --- a/src/dawn/common/BUILD.gn +++ b/src/dawn/common/BUILD.gn @@ -49,8 +49,13 @@ config("internal_config") { } if (use_fuzzing_engine) { - # Does a hard abort when an assertion fails so that fuzzers catch and parse the failure. - defines += [ "DAWN_ABORT_ON_ASSERT" ] + defines += [ + # Does a hard abort when an assertion fails so that fuzzers catch and parse the failure. + "DAWN_ABORT_ON_ASSERT", + + # Disable logging to make fuzzing more efficient. + "DAWN_DISABLE_LOGGING", + ] } if (dawn_enable_d3d12) { @@ -75,6 +80,9 @@ config("internal_config") { defines += [ "DAWN_ENABLE_BACKEND_VULKAN" ] } + if (dawn_use_wayland) { + defines += [ "DAWN_USE_WAYLAND" ] + } if (dawn_use_x11) { defines += [ "DAWN_USE_X11" ] } @@ -107,6 +115,7 @@ config("internal_config") { "-Wdeprecated-copy", "-Wdeprecated-copy-dtor", "-Wduplicate-enum", + "-Wextra-semi", "-Wextra-semi-stmt", "-Wimplicit-fallthrough", "-Winconsistent-missing-destructor-override", @@ -118,9 +127,12 @@ config("internal_config") { "-Wredundant-move", "-Wshadow-field", "-Wstrict-prototypes", + "-Wsuggest-destructor-override", + "-Wsuggest-override", "-Wtautological-unsigned-zero-compare", "-Wunreachable-code-aggressive", "-Wunused-but-set-variable", + "-Wunused-macros", ] if (is_win) { @@ -174,9 +186,31 @@ dawn_generator("dawn_version_gen") { "--dawn-dir", rebase_path("${dawn_root}", root_build_dir), ] + + # We can use the explicit version file if it is generated instead of relying + # on the existence of git. + if (dawn_version_file != "") { + args += [ + "--version-file", + rebase_path(dawn_version_file, root_build_dir), + ] + } + outputs = [ "src/dawn/common/Version_autogen.h" ] } +dawn_generator("dawn_gpu_info_gen") { + script = "${dawn_root}/generator/dawn_gpu_info_generator.py" + args = [ + "--gpu-info-json", + rebase_path("${dawn_root}/src/dawn/gpu_info.json", root_build_dir), + ] + outputs = [ + "src/dawn/common/GPUInfo_autogen.h", + "src/dawn/common/GPUInfo_autogen.cpp", + ] +} + # This GN file is discovered by all Chromium builds, but common doesn't support # all of Chromium's OSes so we explicitly make the target visible only on # systems we know Dawn is able to compile on. @@ -233,13 +267,20 @@ if (is_win || is_linux || is_chromeos || is_mac || is_fuchsia || is_android) { "vulkan_platform.h", "xlib_with_undefs.h", ] + sources += get_target_outputs(":dawn_gpu_info_gen") - public_deps = [ ":dawn_version_gen" ] + public_deps = [ + ":dawn_gpu_info_gen", + ":dawn_version_gen", + ] if (is_mac) { sources += [ "SystemUtils_mac.mm" ] } + # Note that while this doesn't make `internal_config` a public config of + # Dawn libraries because `:common` is only used as a private deps of Dawn + # targets, so `internal_config` doesn't leak out of Dawn. public_configs = [ ":internal_config" ] deps = [ "${dawn_root}/include/dawn:cpp_headers", diff --git a/src/dawn/common/CMakeLists.txt b/src/dawn/common/CMakeLists.txt index e455d49203..a2741d1ad4 100644 --- a/src/dawn/common/CMakeLists.txt +++ b/src/dawn/common/CMakeLists.txt @@ -20,10 +20,19 @@ DawnGenerator( RESULT_VARIABLE "DAWN_VERSION_AUTOGEN_SOURCES" ) +DawnGenerator( + SCRIPT "${Dawn_SOURCE_DIR}/generator/dawn_gpu_info_generator.py" + PRINT_NAME "Dawn GPU info utilities" + ARGS "--gpu-info-json" + "${Dawn_SOURCE_DIR}/src/dawn/gpu_info.json" + RESULT_VARIABLE "DAWN_GPU_INFO_AUTOGEN_SOURCES" +) + add_library(dawn_common STATIC ${DAWN_PLACEHOLDER_FILE}) common_compile_options(dawn_common) target_sources(dawn_common PRIVATE ${DAWN_VERSION_AUTOGEN_SOURCES} + ${DAWN_GPU_INFO_AUTOGEN_SOURCES} "Alloc.h" "Assert.cpp" "Assert.h" diff --git a/src/dawn/common/Compiler.h b/src/dawn/common/Compiler.h index fc29c405d3..e55f969698 100644 --- a/src/dawn/common/Compiler.h +++ b/src/dawn/common/Compiler.h @@ -16,8 +16,7 @@ #define SRC_DAWN_COMMON_COMPILER_H_ // Defines macros for compiler-specific functionality -// - DAWN_COMPILER_[CLANG|GCC|MSVC]: Compiler detection -// - DAWN_BREAKPOINT(): Raises an exception and breaks in the debugger +// - DAWN_COMPILER_IS(CLANG|GCC|MSVC): Compiler detection // - DAWN_BUILTIN_UNREACHABLE(): Hints the compiler that a code path is unreachable // - DAWN_(UN)?LIKELY(EXPR): Where available, hints the compiler that the expression will be true // (resp. false) to help it generate code that leads to better branch prediction. @@ -30,16 +29,9 @@ // Clang and GCC, check for __clang__ too to catch clang-cl masquarading as MSVC #if defined(__GNUC__) || defined(__clang__) #if defined(__clang__) -#define DAWN_COMPILER_CLANG +#define DAWN_COMPILER_IS_CLANG 1 #else -#define DAWN_COMPILER_GCC -#endif - -#if defined(__i386__) || defined(__x86_64__) -#define DAWN_BREAKPOINT() __asm__ __volatile__("int $3\n\t") -#else -// TODO(cwallez@chromium.org): Implement breakpoint on all supported architectures -#define DAWN_BREAKPOINT() +#define DAWN_COMPILER_IS_GCC 1 #endif #define DAWN_BUILTIN_UNREACHABLE() __builtin_unreachable() @@ -58,10 +50,7 @@ // MSVC #elif defined(_MSC_VER) -#define DAWN_COMPILER_MSVC - -extern void __cdecl __debugbreak(void); -#define DAWN_BREAKPOINT() __debugbreak() +#define DAWN_COMPILER_IS_MSVC 1 #define DAWN_BUILTIN_UNREACHABLE() __assume(false) @@ -75,6 +64,23 @@ extern void __cdecl __debugbreak(void); #error "Unsupported compiler" #endif +// This section defines other compiler macros to 0 to avoid undefined macro usage error. +#if !defined(DAWN_COMPILER_IS_CLANG) +#define DAWN_COMPILER_IS_CLANG 0 +#endif +#if !defined(DAWN_COMPILER_IS_GCC) +#define DAWN_COMPILER_IS_GCC 0 +#endif +#if !defined(DAWN_COMPILER_IS_MSVC) +#define DAWN_COMPILER_IS_MSVC 0 +#endif + +// Use #if DAWN_COMPILER_IS(XXX) for compiler specific code. +// Do not use #ifdef or the naked macro DAWN_COMPILER_IS_XXX. +// This can help avoid common mistakes like not including "Compiler.h" and falling into unwanted +// code block as usage of undefined macro "function" will be blocked by the compiler. +#define DAWN_COMPILER_IS(X) (1 == DAWN_COMPILER_IS_##X) + // It seems that (void) EXPR works on all compilers to silence the unused variable warning. #define DAWN_UNUSED(EXPR) (void)EXPR // Likewise using static asserting on sizeof(&FUNC) seems to make it tagged as used diff --git a/src/dawn/common/DynamicLib.cpp b/src/dawn/common/DynamicLib.cpp index 8767ec4264..479ca653c6 100644 --- a/src/dawn/common/DynamicLib.cpp +++ b/src/dawn/common/DynamicLib.cpp @@ -18,12 +18,12 @@ #include "dawn/common/Platform.h" -#if DAWN_PLATFORM_WINDOWS +#if DAWN_PLATFORM_IS(WINDOWS) #include "dawn/common/windows_with_undefs.h" -#if DAWN_PLATFORM_WINUWP +#if DAWN_PLATFORM_IS(WINUWP) #include "dawn/common/WindowsUtils.h" #endif -#elif DAWN_PLATFORM_POSIX +#elif DAWN_PLATFORM_IS(POSIX) #include #else #error "Unsupported platform for DynamicLib" @@ -47,8 +47,8 @@ bool DynamicLib::Valid() const { } bool DynamicLib::Open(const std::string& filename, std::string* error) { -#if DAWN_PLATFORM_WINDOWS -#if DAWN_PLATFORM_WINUWP +#if DAWN_PLATFORM_IS(WINDOWS) +#if DAWN_PLATFORM_IS(WINUWP) mHandle = LoadPackagedLibrary(UTF8ToWStr(filename.c_str()).c_str(), 0); #else mHandle = LoadLibraryA(filename.c_str()); @@ -56,7 +56,7 @@ bool DynamicLib::Open(const std::string& filename, std::string* error) { if (mHandle == nullptr && error != nullptr) { *error = "Windows Error: " + std::to_string(GetLastError()); } -#elif DAWN_PLATFORM_POSIX +#elif DAWN_PLATFORM_IS(POSIX) mHandle = dlopen(filename.c_str(), RTLD_NOW); if (mHandle == nullptr && error != nullptr) { @@ -74,9 +74,9 @@ void DynamicLib::Close() { return; } -#if DAWN_PLATFORM_WINDOWS +#if DAWN_PLATFORM_IS(WINDOWS) FreeLibrary(static_cast(mHandle)); -#elif DAWN_PLATFORM_POSIX +#elif DAWN_PLATFORM_IS(POSIX) dlclose(mHandle); #else #error "Unsupported platform for DynamicLib" @@ -88,13 +88,13 @@ void DynamicLib::Close() { void* DynamicLib::GetProc(const std::string& procName, std::string* error) const { void* proc = nullptr; -#if DAWN_PLATFORM_WINDOWS +#if DAWN_PLATFORM_IS(WINDOWS) proc = reinterpret_cast(GetProcAddress(static_cast(mHandle), procName.c_str())); if (proc == nullptr && error != nullptr) { *error = "Windows Error: " + std::to_string(GetLastError()); } -#elif DAWN_PLATFORM_POSIX +#elif DAWN_PLATFORM_IS(POSIX) proc = reinterpret_cast(dlsym(mHandle, procName.c_str())); if (proc == nullptr && error != nullptr) { diff --git a/src/dawn/common/GPUInfo.cpp b/src/dawn/common/GPUInfo.cpp index 014297d349..8a6f75d6b8 100644 --- a/src/dawn/common/GPUInfo.cpp +++ b/src/dawn/common/GPUInfo.cpp @@ -12,34 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include - #include "dawn/common/GPUInfo.h" +#include + #include "dawn/common/Assert.h" namespace gpu_info { namespace { // Intel // Referenced from the following Mesa source code: -// https://github.com/mesa3d/mesa/blob/master/include/pci_ids/i965_pci_ids.h +// https://github.com/mesa3d/mesa/blob/main/include/pci_ids/iris_pci_ids.h // gen9 const std::array Skylake = {{0x1902, 0x1906, 0x190A, 0x190B, 0x190E, 0x1912, 0x1913, 0x1915, 0x1916, 0x1917, 0x191A, 0x191B, 0x191D, 0x191E, 0x1921, 0x1923, 0x1926, 0x1927, 0x192A, 0x192B, 0x192D, 0x1932, 0x193A, 0x193B, 0x193D}}; -// gen9p5 -const std::array Kabylake = {{0x5916, 0x5913, 0x5906, 0x5926, 0x5921, 0x5915, 0x590E, - 0x591E, 0x5912, 0x5917, 0x5902, 0x591B, 0x593B, 0x590B, - 0x591A, 0x590A, 0x591D, 0x5908, 0x5923, 0x5927}}; -const std::array Coffeelake = {{0x87CA, 0x3E90, 0x3E93, 0x3E99, 0x3E9C, 0x3E91, - 0x3E92, 0x3E96, 0x3E98, 0x3E9A, 0x3E9B, 0x3E94, - 0x3EA9, 0x3EA5, 0x3EA6, 0x3EA7, 0x3EA8}}; -const std::array Whiskylake = {{0x3EA1, 0x3EA4, 0x3EA0, 0x3EA3, 0x3EA2}}; -const std::array Cometlake = { - {0x9B21, 0x9BA0, 0x9BA2, 0x9BA4, 0x9BA5, 0x9BA8, 0x9BAA, 0x9BAB, 0x9BAC, 0x9B41, 0x9BC0, - 0x9BC2, 0x9BC4, 0x9BC5, 0x9BC6, 0x9BC8, 0x9BCA, 0x9BCB, 0x9BCC, 0x9BE6, 0x9BF6}}; // According to Intel graphics driver version schema, build number is generated from the // last two fields. @@ -51,34 +39,6 @@ uint32_t GetIntelD3DDriverBuildNumber(const D3DDriverVersion& driverVersion) { } // anonymous namespace -bool IsAMD(PCIVendorID vendorId) { - return vendorId == kVendorID_AMD; -} -bool IsARM(PCIVendorID vendorId) { - return vendorId == kVendorID_ARM; -} -bool IsImgTec(PCIVendorID vendorId) { - return vendorId == kVendorID_ImgTec; -} -bool IsIntel(PCIVendorID vendorId) { - return vendorId == kVendorID_Intel; -} -bool IsMesa(PCIVendorID vendorId) { - return vendorId == kVendorID_Mesa; -} -bool IsNvidia(PCIVendorID vendorId) { - return vendorId == kVendorID_Nvidia; -} -bool IsQualcomm(PCIVendorID vendorId) { - return vendorId == kVendorID_Qualcomm; -} -bool IsSwiftshader(PCIVendorID vendorId, PCIDeviceID deviceId) { - return vendorId == kVendorID_Google && deviceId == kDeviceID_Swiftshader; -} -bool IsWARP(PCIVendorID vendorId, PCIDeviceID deviceId) { - return vendorId == kVendorID_Microsoft && deviceId == kDeviceID_WARP; -} - int CompareD3DDriverVersion(PCIVendorID vendorId, const D3DDriverVersion& version1, const D3DDriverVersion& version2) { @@ -97,12 +57,5 @@ int CompareD3DDriverVersion(PCIVendorID vendorId, bool IsSkylake(PCIDeviceID deviceId) { return std::find(Skylake.cbegin(), Skylake.cend(), deviceId) != Skylake.cend(); } -bool IsKabylake(PCIDeviceID deviceId) { - return std::find(Kabylake.cbegin(), Kabylake.cend(), deviceId) != Kabylake.cend(); -} -bool IsCoffeelake(PCIDeviceID deviceId) { - return (std::find(Coffeelake.cbegin(), Coffeelake.cend(), deviceId) != Coffeelake.cend()) || - (std::find(Whiskylake.cbegin(), Whiskylake.cend(), deviceId) != Whiskylake.cend()) || - (std::find(Cometlake.cbegin(), Cometlake.cend(), deviceId) != Cometlake.cend()); -} + } // namespace gpu_info diff --git a/src/dawn/common/GPUInfo.h b/src/dawn/common/GPUInfo.h index 9b7f4c0dc6..a96b907251 100644 --- a/src/dawn/common/GPUInfo.h +++ b/src/dawn/common/GPUInfo.h @@ -15,37 +15,12 @@ #ifndef SRC_DAWN_COMMON_GPUINFO_H_ #define SRC_DAWN_COMMON_GPUINFO_H_ -#include -#include +#include "dawn/common/GPUInfo_autogen.h" -using PCIVendorID = uint32_t; -using PCIDeviceID = uint32_t; +#include namespace gpu_info { -static constexpr PCIVendorID kVendorID_AMD = 0x1002; -static constexpr PCIVendorID kVendorID_ARM = 0x13B5; -static constexpr PCIVendorID kVendorID_ImgTec = 0x1010; -static constexpr PCIVendorID kVendorID_Intel = 0x8086; -static constexpr PCIVendorID kVendorID_Mesa = 0x10005; -static constexpr PCIVendorID kVendorID_Nvidia = 0x10DE; -static constexpr PCIVendorID kVendorID_Qualcomm = 0x5143; -static constexpr PCIVendorID kVendorID_Google = 0x1AE0; -static constexpr PCIVendorID kVendorID_Microsoft = 0x1414; - -static constexpr PCIDeviceID kDeviceID_Swiftshader = 0xC0DE; -static constexpr PCIDeviceID kDeviceID_WARP = 0x8c; - -bool IsAMD(PCIVendorID vendorId); -bool IsARM(PCIVendorID vendorId); -bool IsImgTec(PCIVendorID vendorId); -bool IsIntel(PCIVendorID vendorId); -bool IsMesa(PCIVendorID vendorId); -bool IsNvidia(PCIVendorID vendorId); -bool IsQualcomm(PCIVendorID vendorId); -bool IsSwiftshader(PCIVendorID vendorId, PCIDeviceID deviceId); -bool IsWARP(PCIVendorID vendorId, PCIDeviceID deviceId); - using D3DDriverVersion = std::array; // Do comparison between two driver versions. Currently we only support the comparison between @@ -59,8 +34,6 @@ int CompareD3DDriverVersion(PCIVendorID vendorId, // Intel architectures bool IsSkylake(PCIDeviceID deviceId); -bool IsKabylake(PCIDeviceID deviceId); -bool IsCoffeelake(PCIDeviceID deviceId); } // namespace gpu_info #endif // SRC_DAWN_COMMON_GPUINFO_H_ diff --git a/src/dawn/common/HashUtils.h b/src/dawn/common/HashUtils.h index 342c9b6016..e8d17821f4 100644 --- a/src/dawn/common/HashUtils.h +++ b/src/dawn/common/HashUtils.h @@ -45,9 +45,9 @@ size_t Hash(const TypedInteger& value) { // return hash; template void HashCombine(size_t* hash, const T& value) { -#if defined(DAWN_PLATFORM_64_BIT) +#if DAWN_PLATFORM_IS(64_BIT) const size_t offset = 0x9e3779b97f4a7c16; -#elif defined(DAWN_PLATFORM_32_BIT) +#elif DAWN_PLATFORM_IS(32_BIT) const size_t offset = 0x9e3779b9; #else #error "Unsupported platform" diff --git a/src/dawn/common/Log.cpp b/src/dawn/common/Log.cpp index ab1eb07e8b..265d156bff 100644 --- a/src/dawn/common/Log.cpp +++ b/src/dawn/common/Log.cpp @@ -20,7 +20,7 @@ #include "dawn/common/Assert.h" #include "dawn/common/Platform.h" -#if defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(ANDROID) #include #endif @@ -28,6 +28,7 @@ namespace dawn { namespace { +#if !defined(DAWN_DISABLE_LOGGING) const char* SeverityName(LogSeverity severity) { switch (severity) { case LogSeverity::Debug: @@ -43,8 +44,9 @@ const char* SeverityName(LogSeverity severity) { return ""; } } +#endif -#if defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(ANDROID) android_LogPriority AndroidLogPriority(LogSeverity severity) { switch (severity) { case LogSeverity::Debug: @@ -60,12 +62,24 @@ android_LogPriority AndroidLogPriority(LogSeverity severity) { return ANDROID_LOG_ERROR; } } -#endif // defined(DAWN_PLATFORM_ANDROID) +#endif // DAWN_PLATFORM_IS(ANDROID) } // anonymous namespace LogMessage::LogMessage(LogSeverity severity) : mSeverity(severity) {} +LogMessage::LogMessage(LogMessage&& other) = default; + +LogMessage& LogMessage::operator=(LogMessage&& other) = default; + +#if defined(DAWN_DISABLE_LOGGING) +LogMessage::~LogMessage() { + (void)mSeverity; + // Don't print logs to make fuzzing more efficient. Implemented as + // an early return to avoid warnings about unused member variables. + return; +} +#else // defined(DAWN_DISABLE_LOGGING) LogMessage::~LogMessage() { std::string fullMessage = mStream.str(); @@ -76,10 +90,10 @@ LogMessage::~LogMessage() { const char* severityName = SeverityName(mSeverity); -#if defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(ANDROID) android_LogPriority androidPriority = AndroidLogPriority(mSeverity); __android_log_print(androidPriority, "Dawn", "%s: %s\n", severityName, fullMessage.c_str()); -#else // defined(DAWN_PLATFORM_ANDROID) +#else // DAWN_PLATFORM_IS(ANDROID) FILE* outputStream = stdout; if (mSeverity == LogSeverity::Warning || mSeverity == LogSeverity::Error) { outputStream = stderr; @@ -88,8 +102,9 @@ LogMessage::~LogMessage() { // Note: we use fprintf because includes static initializers. fprintf(outputStream, "%s: %s\n", severityName, fullMessage.c_str()); fflush(outputStream); -#endif // defined(DAWN_PLATFORM_ANDROID) +#endif // DAWN_PLATFORM_IS(ANDROID) } +#endif // defined(DAWN_DISABLE_LOGGING) LogMessage DebugLog() { return LogMessage(LogSeverity::Debug); diff --git a/src/dawn/common/Log.h b/src/dawn/common/Log.h index 3b338b3827..2f56ce53ae 100644 --- a/src/dawn/common/Log.h +++ b/src/dawn/common/Log.h @@ -62,8 +62,8 @@ class LogMessage { explicit LogMessage(LogSeverity severity); ~LogMessage(); - LogMessage(LogMessage&& other) = default; - LogMessage& operator=(LogMessage&& other) = default; + LogMessage(LogMessage&& other); + LogMessage& operator=(LogMessage&& other); template LogMessage& operator<<(T&& value) { diff --git a/src/dawn/common/Math.cpp b/src/dawn/common/Math.cpp index 3ee1ba32a8..a3794e2502 100644 --- a/src/dawn/common/Math.cpp +++ b/src/dawn/common/Math.cpp @@ -21,13 +21,13 @@ #include "dawn/common/Assert.h" #include "dawn/common/Platform.h" -#if defined(DAWN_COMPILER_MSVC) +#if DAWN_COMPILER_IS(MSVC) #include #endif uint32_t ScanForward(uint32_t bits) { ASSERT(bits != 0); -#if defined(DAWN_COMPILER_MSVC) +#if DAWN_COMPILER_IS(MSVC) // NOLINTNEXTLINE(runtime/int) unsigned long firstBitIndex = 0ul; unsigned char ret = _BitScanForward(&firstBitIndex, bits); @@ -40,7 +40,7 @@ uint32_t ScanForward(uint32_t bits) { uint32_t Log2(uint32_t value) { ASSERT(value != 0); -#if defined(DAWN_COMPILER_MSVC) +#if DAWN_COMPILER_IS(MSVC) // NOLINTNEXTLINE(runtime/int) unsigned long firstBitIndex = 0ul; unsigned char ret = _BitScanReverse(&firstBitIndex, value); @@ -53,14 +53,14 @@ uint32_t Log2(uint32_t value) { uint32_t Log2(uint64_t value) { ASSERT(value != 0); -#if defined(DAWN_COMPILER_MSVC) -#if defined(DAWN_PLATFORM_64_BIT) +#if DAWN_COMPILER_IS(MSVC) +#if DAWN_PLATFORM_IS(64_BIT) // NOLINTNEXTLINE(runtime/int) unsigned long firstBitIndex = 0ul; unsigned char ret = _BitScanReverse64(&firstBitIndex, value); ASSERT(ret != 0); return firstBitIndex; -#else // defined(DAWN_PLATFORM_64_BIT) +#else // DAWN_PLATFORM_IS(64_BIT) // NOLINTNEXTLINE(runtime/int) unsigned long firstBitIndex = 0ul; if (_BitScanReverse(&firstBitIndex, value >> 32)) { @@ -69,10 +69,10 @@ uint32_t Log2(uint64_t value) { unsigned char ret = _BitScanReverse(&firstBitIndex, value & 0xFFFFFFFF); ASSERT(ret != 0); return firstBitIndex; -#endif // defined(DAWN_PLATFORM_64_BIT) -#else // defined(DAWN_COMPILER_MSVC) +#endif // DAWN_PLATFORM_IS(64_BIT) +#else // DAWN_COMPILER_IS(MSVC) return 63 - static_cast(__builtin_clzll(value)); -#endif // defined(DAWN_COMPILER_MSVC) +#endif // DAWN_COMPILER_IS(MSVC) } uint64_t NextPowerOfTwo(uint64_t n) { diff --git a/src/dawn/common/Numeric.h b/src/dawn/common/Numeric.h index 50f6d40ba7..f4b084b4da 100644 --- a/src/dawn/common/Numeric.h +++ b/src/dawn/common/Numeric.h @@ -15,6 +15,7 @@ #ifndef SRC_DAWN_COMMON_NUMERIC_H_ #define SRC_DAWN_COMMON_NUMERIC_H_ +#include #include #include diff --git a/src/dawn/common/Platform.h b/src/dawn/common/Platform.h index 83aa25144d..9900154fc2 100644 --- a/src/dawn/common/Platform.h +++ b/src/dawn/common/Platform.h @@ -15,71 +15,250 @@ #ifndef SRC_DAWN_COMMON_PLATFORM_H_ #define SRC_DAWN_COMMON_PLATFORM_H_ +// Use #if DAWN_PLATFORM_IS(X) for platform specific code. +// Do not use #ifdef or the naked macro DAWN_PLATFORM_IS_X. +// This can help avoid common mistakes like not including "Platform.h" and falling into unwanted +// code block as usage of undefined macro "function" will be blocked by the compiler. +#define DAWN_PLATFORM_IS(X) (1 == DAWN_PLATFORM_IS_##X) + +// Define platform macros for OSes: +// +// - WINDOWS +// - WIN32 +// - WINUWP +// - POSIX +// - LINUX +// - ANDROID +// - APPLE +// - IOS +// - MACOS +// - TVOS +// - FUCHSIA +// - EMSCRIPTEN #if defined(_WIN32) || defined(_WIN64) #include -#define DAWN_PLATFORM_WINDOWS 1 +#define DAWN_PLATFORM_IS_WINDOWS 1 #if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP -#define DAWN_PLATFORM_WIN32 1 +#define DAWN_PLATFORM_IS_WIN32 1 #elif WINAPI_FAMILY == WINAPI_FAMILY_PC_APP -#define DAWN_PLATFORM_WINUWP 1 +#define DAWN_PLATFORM_IS_WINUWP 1 #else #error "Unsupported Windows platform." #endif #elif defined(__linux__) -#define DAWN_PLATFORM_LINUX 1 -#define DAWN_PLATFORM_POSIX 1 +#define DAWN_PLATFORM_IS_LINUX 1 +#define DAWN_PLATFORM_IS_POSIX 1 #if defined(__ANDROID__) -#define DAWN_PLATFORM_ANDROID 1 +#define DAWN_PLATFORM_IS_ANDROID 1 #endif #elif defined(__APPLE__) -#define DAWN_PLATFORM_APPLE 1 -#define DAWN_PLATFORM_POSIX 1 +#define DAWN_PLATFORM_IS_APPLE 1 +#define DAWN_PLATFORM_IS_POSIX 1 #include #if TARGET_OS_TV -#define DAWN_PLATFORM_TVOS -#define DAWN_PLATFORM_IOS +#define DAWN_PLATFORM_IS_TVOS 1 +#define DAWN_PLATFORM_IS_IOS 1 #elif TARGET_OS_IPHONE -#define DAWN_PLATFORM_IOS +#define DAWN_PLATFORM_IS_IOS 1 #elif TARGET_OS_MAC -#define DAWN_PLATFORM_MACOS +#define DAWN_PLATFORM_IS_MACOS 1 #else #error "Unsupported Apple platform." #endif #elif defined(__Fuchsia__) -#define DAWN_PLATFORM_FUCHSIA 1 -#define DAWN_PLATFORM_POSIX 1 +#define DAWN_PLATFORM_IS_FUCHSIA 1 +#define DAWN_PLATFORM_IS_POSIX 1 #elif defined(__EMSCRIPTEN__) -#define DAWN_PLATFORM_EMSCRIPTEN 1 -#define DAWN_PLATFORM_POSIX 1 +#define DAWN_PLATFORM_IS_EMSCRIPTEN 1 +#define DAWN_PLATFORM_IS_POSIX 1 #else #error "Unsupported platform." #endif -// Distinguish mips32. -#if defined(__mips__) && (_MIPS_SIM == _ABIO32) && !defined(__mips32__) -#define __mips32__ +// Define platform macros for CPU architectures: +// +// - X86 +// - I386 +// - X86_64 +// - ARM +// - ARM32 +// - ARM64 +// - RISCV +// - RISCV32 +// - RISCV64 +// - MIPS +// - MIPS32 +// - MIPS64 +// - S390 +// - S390X +// - PPC +// - PPC64 +#if defined(__i386__) || defined(_M_IX86) +#define DAWN_PLATFORM_IS_X86 1 +#define DAWN_PLATFORM_IS_I386 1 +#elif defined(__x86_64__) || defined(_M_X64) +#define DAWN_PLATFORM_IS_X86 1 +#define DAWN_PLATFORM_IS_X86_64 1 + +#elif defined(__arm__) || defined(_M_ARM) +#define DAWN_PLATFORM_IS_ARM 1 +#define DAWN_PLATFORM_IS_ARM32 1 +#elif defined(__aarch64__) || defined(_M_ARM64) +#define DAWN_PLATFORM_IS_ARM 1 +#define DAWN_PLATFORM_IS_ARM64 1 + +#elif defined(__riscv) +#define DAWN_PLATFORM_IS_RISCV 1 +#if __riscv_xlen == 32 +#define DAWN_PLATFORM_IS_RISCV32 1 +#else +#define DAWN_PLATFORM_IS_RISCV64 1 #endif -// Distinguish mips64. -#if defined(__mips__) && (_MIPS_SIM == _ABI64) && !defined(__mips64__) -#define __mips64__ +#elif defined(__mips__) +#define DAWN_PLATFORM_IS_MIPS 1 +#if _MIPS_SIM == _ABIO32 +#define DAWN_PLATFORM_IS_MIPS32 1 +#else +#define DAWN_PLATFORM_IS_MIPS64 1 #endif -#if defined(_WIN64) || defined(__aarch64__) || defined(__x86_64__) || defined(__mips64__) || \ - defined(__s390x__) || defined(__PPC64__) -#define DAWN_PLATFORM_64_BIT 1 +#elif defiend(__s390__) +#define DAWN_PLATFORM_IS_S390 1 +#elif defiend(__s390x__) +#define DAWN_PLATFORM_IS_S390X 1 + +#elif defined(__PPC__) +#define DAWN_PLATFORM_IS_PPC 1 +#elif defined(__PPC64__) +#define DAWN_PLATFORM_IS_PPC64 1 + +#else +#error "Unsupported platform." +#endif + +// Define platform macros for pointer width: +// +// - 64_BIT +// - 32_BIT +#if defined(DAWN_PLATFORM_IS_X86_64) || defined(DAWN_PLATFORM_IS_ARM64) || \ + defined(DAWN_PLATFORM_IS_RISCV64) || defined(DAWN_PLATFORM_IS_MIPS64) || \ + defined(DAWN_PLATFORM_IS_S390X) || defined(DAWN_PLATFORM_IS_PPC64) +#define DAWN_PLATFORM_IS_64_BIT 1 static_assert(sizeof(sizeof(char)) == 8, "Expect sizeof(size_t) == 8"); -#elif defined(_WIN32) || defined(__arm__) || defined(__i386__) || defined(__mips32__) || \ - defined(__s390__) || defined(__EMSCRIPTEN__) -#define DAWN_PLATFORM_32_BIT 1 +#elif defined(DAWN_PLATFORM_IS_I386) || defined(DAWN_PLATFORM_IS_ARM32) || \ + defined(DAWN_PLATFORM_IS_RISCV32) || defined(DAWN_PLATFORM_IS_MIPS32) || \ + defined(DAWN_PLATFORM_IS_S390) || defined(DAWN_PLATFORM_IS_PPC32) || \ + defined(DAWN_PLATFORM_IS_EMSCRIPTEN) +#define DAWN_PLATFORM_IS_32_BIT 1 static_assert(sizeof(sizeof(char)) == 4, "Expect sizeof(size_t) == 4"); #else #error "Unsupported platform" #endif +// This section define other platform macros to 0 to avoid undefined macro usage error. +#if !defined(DAWN_PLATFORM_IS_WINDOWS) +#define DAWN_PLATFORM_IS_WINDOWS 0 +#endif +#if !defined(DAWN_PLATFORM_IS_WIN32) +#define DAWN_PLATFORM_IS_WIN32 0 +#endif +#if !defined(DAWN_PLATFORM_IS_WINUWP) +#define DAWN_PLATFORM_IS_WINUWP 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_POSIX) +#define DAWN_PLATFORM_IS_POSIX 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_LINUX) +#define DAWN_PLATFORM_IS_LINUX 0 +#endif +#if !defined(DAWN_PLATFORM_IS_ANDROID) +#define DAWN_PLATFORM_IS_ANDROID 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_APPLE) +#define DAWN_PLATFORM_IS_APPLE 0 +#endif +#if !defined(DAWN_PLATFORM_IS_IOS) +#define DAWN_PLATFORM_IS_IOS 0 +#endif +#if !defined(DAWN_PLATFORM_IS_MACOS) +#define DAWN_PLATFORM_IS_MACOS 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_FUCHSIA) +#define DAWN_PLATFORM_IS_FUCHSIA 0 +#endif +#if !defined(DAWN_PLATFORM_IS_EMSCRIPTEN) +#define DAWN_PLATFORM_IS_EMSCRIPTEN 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_X86) +#define DAWN_PLATFORM_IS_X86 0 +#endif +#if !defined(DAWN_PLATFORM_IS_I386) +#define DAWN_PLATFORM_IS_I386 0 +#endif +#if !defined(DAWN_PLATFORM_IS_X86_64) +#define DAWN_PLATFORM_IS_X86_64 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_ARM) +#define DAWN_PLATFORM_IS_ARM 0 +#endif +#if !defined(DAWN_PLATFORM_IS_ARM32) +#define DAWN_PLATFORM_IS_ARM32 0 +#endif +#if !defined(DAWN_PLATFORM_IS_ARM64) +#define DAWN_PLATFORM_IS_ARM64 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_RISCV) +#define DAWN_PLATFORM_IS_RISCV 0 +#endif +#if !defined(DAWN_PLATFORM_IS_RISCV32) +#define DAWN_PLATFORM_IS_RISCV32 0 +#endif +#if !defined(DAWN_PLATFORM_IS_RISCV64) +#define DAWN_PLATFORM_IS_RISCV64 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_MIPS) +#define DAWN_PLATFORM_IS_MIPS 0 +#endif +#if !defined(DAWN_PLATFORM_IS_MIPS32) +#define DAWN_PLATFORM_IS_MIPS32 0 +#endif +#if !defined(DAWN_PLATFORM_IS_MIPS64) +#define DAWN_PLATFORM_IS_MIPS64 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_S390) +#define DAWN_PLATFORM_IS_S390 0 +#endif +#if !defined(DAWN_PLATFORM_IS_S390X) +#define DAWN_PLATFORM_IS_S390X 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_PPC) +#define DAWN_PLATFORM_IS_PPC 0 +#endif +#if !defined(DAWN_PLATFORM_IS_PPC64) +#define DAWN_PLATFORM_IS_PPC64 0 +#endif + +#if !defined(DAWN_PLATFORM_IS_64_BIT) +#define DAWN_PLATFORM_IS_64_BIT 0 +#endif +#if !defined(DAWN_PLATFORM_IS_32_BIT) +#define DAWN_PLATFORM_IS_32_BIT 0 +#endif + #endif // SRC_DAWN_COMMON_PLATFORM_H_ diff --git a/src/dawn/common/RefCounted.cpp b/src/dawn/common/RefCounted.cpp index 0d77d3f5d2..14bd0b1df7 100644 --- a/src/dawn/common/RefCounted.cpp +++ b/src/dawn/common/RefCounted.cpp @@ -22,15 +22,15 @@ static constexpr size_t kPayloadBits = 1; static constexpr uint64_t kPayloadMask = (uint64_t(1) << kPayloadBits) - 1; static constexpr uint64_t kRefCountIncrement = (uint64_t(1) << kPayloadBits); -RefCounted::RefCounted(uint64_t payload) : mRefCount(kRefCountIncrement + payload) { +RefCount::RefCount(uint64_t payload) : mRefCount(kRefCountIncrement + payload) { ASSERT((payload & kPayloadMask) == payload); } -uint64_t RefCounted::GetRefCountForTesting() const { +uint64_t RefCount::GetValueForTesting() const { return mRefCount >> kPayloadBits; } -uint64_t RefCounted::GetRefCountPayload() const { +uint64_t RefCount::GetPayload() const { // We only care about the payload bits of the refcount. These never change after // initialization so we can use the relaxed memory order. The order doesn't guarantee // anything except the atomicity of the load, which is enough since any past values of the @@ -38,7 +38,7 @@ uint64_t RefCounted::GetRefCountPayload() const { return kPayloadMask & mRefCount.load(std::memory_order_relaxed); } -void RefCounted::Reference() { +void RefCount::Increment() { ASSERT((mRefCount & ~kPayloadMask) != 0); // The relaxed ordering guarantees only the atomicity of the update, which is enough here @@ -49,7 +49,7 @@ void RefCounted::Reference() { mRefCount.fetch_add(kRefCountIncrement, std::memory_order_relaxed); } -void RefCounted::Release() { +bool RefCount::Decrement() { ASSERT((mRefCount & ~kPayloadMask) != 0); // The release fence here is to make sure all accesses to the object on a thread A @@ -69,18 +69,32 @@ void RefCounted::Release() { // memory barrier, when an acquire load on mRefCount (using the `ldar` instruction) // should be enough and could end up being faster. std::atomic_thread_fence(std::memory_order_acquire); + return true; + } + return false; +} + +RefCounted::RefCounted(uint64_t payload) : mRefCount(payload) {} +RefCounted::~RefCounted() = default; + +uint64_t RefCounted::GetRefCountForTesting() const { + return mRefCount.GetValueForTesting(); +} + +uint64_t RefCounted::GetRefCountPayload() const { + return mRefCount.GetPayload(); +} + +void RefCounted::Reference() { + mRefCount.Increment(); +} + +void RefCounted::Release() { + if (mRefCount.Decrement()) { DeleteThis(); } } -void RefCounted::APIReference() { - Reference(); -} - -void RefCounted::APIRelease() { - Release(); -} - void RefCounted::DeleteThis() { delete this; } diff --git a/src/dawn/common/RefCounted.h b/src/dawn/common/RefCounted.h index 1ee413dfc8..b5d74f70ea 100644 --- a/src/dawn/common/RefCounted.h +++ b/src/dawn/common/RefCounted.h @@ -20,6 +20,24 @@ #include "dawn/common/RefBase.h" +class RefCount { + public: + // Create a refcount with a payload. The refcount starts initially at one. + explicit RefCount(uint64_t payload = 0); + + uint64_t GetValueForTesting() const; + uint64_t GetPayload() const; + + // Add a reference. + void Increment(); + + // Remove a reference. Returns true if this was the last reference. + bool Decrement(); + + private: + std::atomic mRefCount; +}; + class RefCounted { public: explicit RefCounted(uint64_t payload = 0); @@ -30,16 +48,17 @@ class RefCounted { void Reference(); void Release(); - void APIReference(); - void APIRelease(); + void APIReference() { Reference(); } + void APIRelease() { Release(); } protected: - virtual ~RefCounted() = default; + virtual ~RefCounted(); + // A Derived class may override this if they require a custom deleter. virtual void DeleteThis(); private: - std::atomic mRefCount; + RefCount mRefCount; }; template diff --git a/src/dawn/common/StackContainer.h b/src/dawn/common/StackContainer.h index 9788510c73..1d1d7ca401 100644 --- a/src/dawn/common/StackContainer.h +++ b/src/dawn/common/StackContainer.h @@ -51,7 +51,7 @@ class StackAllocator : public std::allocator { // constructors and destructors to be automatically called. Define a POD // buffer of the right size instead. alignas(T) char stack_buffer_[sizeof(T[stack_capacity])]; -#if defined(DAWN_COMPILER_GCC) && !defined(__x86_64__) && !defined(__i386__) +#if DAWN_COMPILER_IS(GCC) && !defined(__x86_64__) && !defined(__i386__) static_assert(alignof(T) <= 16, "http://crbug.com/115612"); #endif @@ -103,10 +103,11 @@ class StackAllocator : public std::allocator { // Free: when trying to free the stack buffer, just mark it as free. For // non-stack-buffer pointers, just fall though to the standard allocator. void deallocate(pointer p, size_type n) { - if (source_ && p == source_->stack_buffer()) + if (source_ && p == source_->stack_buffer()) { source_->used_stack_buffer_ = false; - else + } else { std::allocator::deallocate(p, n); + } } private: diff --git a/src/dawn/common/SystemUtils.cpp b/src/dawn/common/SystemUtils.cpp index 2d47fd12db..cad35955d6 100644 --- a/src/dawn/common/SystemUtils.cpp +++ b/src/dawn/common/SystemUtils.cpp @@ -17,15 +17,15 @@ #include "dawn/common/Assert.h" #include "dawn/common/Log.h" -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) #include #include -#elif defined(DAWN_PLATFORM_LINUX) +#elif DAWN_PLATFORM_IS(LINUX) #include #include #include #include -#elif defined(DAWN_PLATFORM_MACOS) || defined(DAWN_PLATFORM_IOS) +#elif DAWN_PLATFORM_IS(MACOS) || DAWN_PLATFORM_IS(IOS) #include #include #include @@ -33,7 +33,7 @@ #include -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) const char* GetPathSeparator() { return "\\"; } @@ -66,7 +66,7 @@ std::pair GetEnvironmentVar(const char* variableName) { bool SetEnvironmentVar(const char* variableName, const char* value) { return SetEnvironmentVariableA(variableName, value) == TRUE; } -#elif defined(DAWN_PLATFORM_POSIX) +#elif DAWN_PLATFORM_IS(POSIX) const char* GetPathSeparator() { return "/"; } @@ -87,7 +87,7 @@ bool SetEnvironmentVar(const char* variableName, const char* value) { #error "Implement Get/SetEnvironmentVar for your platform." #endif -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) std::optional GetHModulePath(HMODULE module) { std::array executableFileBuf; DWORD executablePathLen = GetModuleFileNameA(nullptr, executableFileBuf.data(), @@ -100,7 +100,7 @@ std::optional GetHModulePath(HMODULE module) { std::optional GetExecutablePath() { return GetHModulePath(nullptr); } -#elif defined(DAWN_PLATFORM_LINUX) +#elif DAWN_PLATFORM_IS(LINUX) std::optional GetExecutablePath() { std::array path; ssize_t result = readlink("/proc/self/exe", path.data(), PATH_MAX - 1); @@ -111,7 +111,7 @@ std::optional GetExecutablePath() { path[result] = '\0'; return path.data(); } -#elif defined(DAWN_PLATFORM_MACOS) || defined(DAWN_PLATFORM_IOS) +#elif DAWN_PLATFORM_IS(MACOS) || DAWN_PLATFORM_IS(IOS) std::optional GetExecutablePath() { uint32_t size = 0; _NSGetExecutablePath(nullptr, &size); @@ -124,12 +124,12 @@ std::optional GetExecutablePath() { buffer[size] = '\0'; return buffer.data(); } -#elif defined(DAWN_PLATFORM_FUCHSIA) +#elif DAWN_PLATFORM_IS(FUCHSIA) std::optional GetExecutablePath() { // UNIMPLEMENTED return {}; } -#elif defined(DAWN_PLATFORM_EMSCRIPTEN) +#elif DAWN_PLATFORM_IS(EMSCRIPTEN) std::optional GetExecutablePath() { return {}; } @@ -149,7 +149,7 @@ std::optional GetExecutableDirectory() { return exePath->substr(0, lastPathSepLoc + 1); } -#if defined(DAWN_PLATFORM_LINUX) || defined(DAWN_PLATFORM_MACOS) || defined(DAWN_PLATFORM_IOS) +#if DAWN_PLATFORM_IS(LINUX) || DAWN_PLATFORM_IS(MACOS) || DAWN_PLATFORM_IS(IOS) std::optional GetModulePath() { static int placeholderSymbol = 0; Dl_info dlInfo; @@ -163,7 +163,7 @@ std::optional GetModulePath() { } return absolutePath.data(); } -#elif defined(DAWN_PLATFORM_WINDOWS) +#elif DAWN_PLATFORM_IS(WINDOWS) std::optional GetModulePath() { static int placeholderSymbol = 0; HMODULE module = nullptr; @@ -179,11 +179,11 @@ std::optional GetModulePath() { #endif return GetHModulePath(module); } -#elif defined(DAWN_PLATFORM_FUCHSIA) +#elif DAWN_PLATFORM_IS(FUCHSIA) std::optional GetModulePath() { return {}; } -#elif defined(DAWN_PLATFORM_EMSCRIPTEN) +#elif DAWN_PLATFORM_IS(EMSCRIPTEN) std::optional GetModulePath() { return {}; } @@ -205,6 +205,8 @@ std::optional GetModuleDirectory() { // ScopedEnvironmentVar +ScopedEnvironmentVar::ScopedEnvironmentVar() = default; + ScopedEnvironmentVar::ScopedEnvironmentVar(const char* variableName, const char* value) : mName(variableName), mOriginalValue(GetEnvironmentVar(variableName)), diff --git a/src/dawn/common/SystemUtils.h b/src/dawn/common/SystemUtils.h index ddb74e4467..ed37085348 100644 --- a/src/dawn/common/SystemUtils.h +++ b/src/dawn/common/SystemUtils.h @@ -33,14 +33,14 @@ bool SetEnvironmentVar(const char* variableName, const char* value); std::optional GetExecutableDirectory(); std::optional GetModuleDirectory(); -#ifdef DAWN_PLATFORM_MACOS +#if DAWN_PLATFORM_IS(MACOS) void GetMacOSVersion(int32_t* majorVersion, int32_t* minorVersion = nullptr); bool IsMacOSVersionAtLeast(uint32_t majorVersion, uint32_t minorVersion = 0); #endif class ScopedEnvironmentVar { public: - ScopedEnvironmentVar() = default; + ScopedEnvironmentVar(); ScopedEnvironmentVar(const char* variableName, const char* value); ~ScopedEnvironmentVar(); diff --git a/src/dawn/common/ityp_bitset.h b/src/dawn/common/ityp_bitset.h index e9cfa050fe..0be94a7e72 100644 --- a/src/dawn/common/ityp_bitset.h +++ b/src/dawn/common/ityp_bitset.h @@ -16,6 +16,7 @@ #define SRC_DAWN_COMMON_ITYP_BITSET_H_ #include "dawn/common/BitSetIterator.h" +#include "dawn/common/Platform.h" #include "dawn/common/TypedInteger.h" #include "dawn/common/UnderlyingType.h" @@ -124,9 +125,9 @@ class bitset : private std::bitset { template Index GetHighestBitIndexPlusOne(const ityp::bitset& bitset) { using I = UnderlyingType; -#if defined(DAWN_COMPILER_MSVC) +#if DAWN_COMPILER_IS(MSVC) if constexpr (N > 32) { -#if defined(DAWN_PLATFORM_64_BIT) +#if DAWN_PLATFORM_IS(64_BIT) // NOLINTNEXTLINE(runtime/int) unsigned long firstBitIndex = 0ul; unsigned char ret = _BitScanReverse64(&firstBitIndex, bitset.to_ullong()); @@ -134,7 +135,7 @@ Index GetHighestBitIndexPlusOne(const ityp::bitset& bitset) { return Index(static_cast(0)); } return Index(static_cast(firstBitIndex + 1)); -#else // defined(DAWN_PLATFORM_64_BIT) +#else // DAWN_PLATFORM_IS(64_BIT) if (bitset.none()) { return Index(static_cast(0)); } @@ -144,7 +145,7 @@ Index GetHighestBitIndexPlusOne(const ityp::bitset& bitset) { } } UNREACHABLE(); -#endif // defined(DAWN_PLATFORM_64_BIT) +#endif // DAWN_PLATFORM_IS(64_BIT) } else { // NOLINTNEXTLINE(runtime/int) unsigned long firstBitIndex = 0ul; @@ -154,7 +155,7 @@ Index GetHighestBitIndexPlusOne(const ityp::bitset& bitset) { } return Index(static_cast(firstBitIndex + 1)); } -#else // defined(DAWN_COMPILER_MSVC) +#else // DAWN_COMPILER_IS(MSVC) if (bitset.none()) { return Index(static_cast(0)); } @@ -164,7 +165,7 @@ Index GetHighestBitIndexPlusOne(const ityp::bitset& bitset) { } else { return Index(static_cast(32 - static_cast(__builtin_clz(bitset.to_ulong())))); } -#endif // defined(DAWN_COMPILER_MSVC) +#endif // DAWN_COMPILER_IS(MSVC) } #endif // SRC_DAWN_COMMON_ITYP_BITSET_H_ diff --git a/src/dawn/common/vulkan_platform.h b/src/dawn/common/vulkan_platform.h index c4bff86008..d38d4ca9a9 100644 --- a/src/dawn/common/vulkan_platform.h +++ b/src/dawn/common/vulkan_platform.h @@ -35,7 +35,7 @@ // redefined to be nullptr). This keeps the type-safety of having the handles be different types // (like vulkan.h on 64 bit) but makes sure the types are different on 32 bit architectures. -#if defined(DAWN_PLATFORM_64_BIT) +#if DAWN_PLATFORM_IS(64_BIT) #define DAWN_DEFINE_NATIVE_NON_DISPATCHABLE_HANDLE(object) using object = struct object##_T*; // This function is needed because MSVC doesn't accept reinterpret_cast from uint64_t from uint64_t // TODO(cwallez@chromium.org): Remove this once we rework vulkan_platform.h @@ -43,7 +43,7 @@ template T NativeNonDispatachableHandleFromU64(uint64_t u64) { return reinterpret_cast(u64); } -#elif defined(DAWN_PLATFORM_32_BIT) +#elif DAWN_PLATFORM_IS(32_BIT) #define DAWN_DEFINE_NATIVE_NON_DISPATCHABLE_HANDLE(object) using object = uint64_t; template T NativeNonDispatachableHandleFromU64(uint64_t u64) { @@ -138,12 +138,12 @@ HandleType* AsVkArray(detail::VkHandle* handle) { // headers that vulkan.h includes that we have "undefs" for. Note that some of the VK_USE_PLATFORM_* // defines are defined already in the Vulkan-Header BUILD.gn, but are needed when building with // CMake, hence they cannot be removed at the moment. -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) #ifndef VK_USE_PLATFORM_WIN32_KHR #define VK_USE_PLATFORM_WIN32_KHR #endif #include "dawn/common/windows_with_undefs.h" -#endif // DAWN_PLATFORM_WINDOWS +#endif // DAWN_PLATFORM_IS(WINDOWS) #if defined(DAWN_USE_X11) #define VK_USE_PLATFORM_XLIB_KHR @@ -153,23 +153,29 @@ HandleType* AsVkArray(detail::VkHandle* handle) { #include "dawn/common/xlib_with_undefs.h" #endif // defined(DAWN_USE_X11) +#if defined(DAWN_USE_WAYLAND) +#ifndef VK_USE_PLATFORM_WAYLAND_KHR +#define VK_USE_PLATFORM_WAYLAND_KHR +#endif +#endif // defined(DAWN_USE_WAYLAND) + #if defined(DAWN_ENABLE_BACKEND_METAL) #ifndef VK_USE_PLATFORM_METAL_EXT #define VK_USE_PLATFORM_METAL_EXT #endif #endif // defined(DAWN_ENABLE_BACKEND_METAL) -#if defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(ANDROID) #ifndef VK_USE_PLATFORM_ANDROID_KHR #define VK_USE_PLATFORM_ANDROID_KHR #endif -#endif // defined(DAWN_PLATFORM_ANDROID) +#endif // DAWN_PLATFORM_IS(ANDROID) -#if defined(DAWN_PLATFORM_FUCHSIA) +#if DAWN_PLATFORM_IS(FUCHSIA) #ifndef VK_USE_PLATFORM_FUCHSIA #define VK_USE_PLATFORM_FUCHSIA #endif -#endif // defined(DAWN_PLATFORM_FUCHSIA) +#endif // DAWN_PLATFORM_IS(FUCHSIA) // The actual inclusion of vulkan.h! #define VK_NO_PROTOTYPES diff --git a/src/dawn/common/windows_with_undefs.h b/src/dawn/common/windows_with_undefs.h index 63c27db722..858234fa0b 100644 --- a/src/dawn/common/windows_with_undefs.h +++ b/src/dawn/common/windows_with_undefs.h @@ -17,7 +17,7 @@ #include "dawn/common/Platform.h" -#if !defined(DAWN_PLATFORM_WINDOWS) +#if !DAWN_PLATFORM_IS(WINDOWS) #error "windows_with_undefs.h included on non-Windows" #endif diff --git a/src/dawn/common/xlib_with_undefs.h b/src/dawn/common/xlib_with_undefs.h index f9db481a44..4835513463 100644 --- a/src/dawn/common/xlib_with_undefs.h +++ b/src/dawn/common/xlib_with_undefs.h @@ -17,7 +17,7 @@ #include "dawn/common/Platform.h" -#if !defined(DAWN_PLATFORM_LINUX) +#if !DAWN_PLATFORM_IS(LINUX) #error "xlib_with_undefs.h included on non-Linux" #endif diff --git a/src/dawn/fuzzers/DawnWireServerAndD3D12BackendFuzzer.cpp b/src/dawn/fuzzers/DawnWireServerAndD3D12BackendFuzzer.cpp index a2cb8e2bc3..55d26f2a88 100644 --- a/src/dawn/fuzzers/DawnWireServerAndD3D12BackendFuzzer.cpp +++ b/src/dawn/fuzzers/DawnWireServerAndD3D12BackendFuzzer.cpp @@ -25,21 +25,11 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return DawnWireServerFuzzer::Run( data, size, - [](dawn::native::Instance* instance) { - std::vector adapters = instance->GetAdapters(); - - wgpu::Device device; - for (dawn::native::Adapter adapter : adapters) { - wgpu::AdapterProperties properties; - adapter.GetProperties(&properties); - - if (properties.backendType == wgpu::BackendType::D3D12 && - properties.adapterType == wgpu::AdapterType::CPU) { - device = wgpu::Device::Acquire(adapter.CreateDevice()); - break; - } - } - return device; + [](const dawn::native::Adapter& adapter) { + wgpu::AdapterProperties properties; + adapter.GetProperties(&properties); + return properties.backendType == wgpu::BackendType::D3D12 && + properties.adapterType == wgpu::AdapterType::CPU; }, true /* supportsErrorInjection */); } diff --git a/src/dawn/fuzzers/DawnWireServerAndFrontendFuzzer.cpp b/src/dawn/fuzzers/DawnWireServerAndFrontendFuzzer.cpp index 86a2b6bc4b..0978c1e9f9 100644 --- a/src/dawn/fuzzers/DawnWireServerAndFrontendFuzzer.cpp +++ b/src/dawn/fuzzers/DawnWireServerAndFrontendFuzzer.cpp @@ -26,22 +26,10 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return DawnWireServerFuzzer::Run( data, size, - [](dawn::native::Instance* instance) { - std::vector adapters = instance->GetAdapters(); - - wgpu::Device nullDevice; - for (dawn::native::Adapter adapter : adapters) { - wgpu::AdapterProperties properties; - adapter.GetProperties(&properties); - - if (properties.backendType == wgpu::BackendType::Null) { - nullDevice = wgpu::Device::Acquire(adapter.CreateDevice()); - break; - } - } - - ASSERT(nullDevice.Get() != nullptr); - return nullDevice; + [](const dawn::native::Adapter& adapter) { + wgpu::AdapterProperties properties; + adapter.GetProperties(&properties); + return properties.backendType == wgpu::BackendType::Null; }, false /* supportsErrorInjection */); } diff --git a/src/dawn/fuzzers/DawnWireServerAndVulkanBackendFuzzer.cpp b/src/dawn/fuzzers/DawnWireServerAndVulkanBackendFuzzer.cpp index 1e55f06ff4..36ac282936 100644 --- a/src/dawn/fuzzers/DawnWireServerAndVulkanBackendFuzzer.cpp +++ b/src/dawn/fuzzers/DawnWireServerAndVulkanBackendFuzzer.cpp @@ -15,6 +15,7 @@ #include #include "DawnWireServerFuzzer.h" +#include "dawn/common/GPUInfo.h" #include "dawn/native/DawnNative.h" #include "testing/libfuzzer/libfuzzer_exports.h" @@ -25,21 +26,11 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return DawnWireServerFuzzer::Run( data, size, - [](dawn::native::Instance* instance) { - std::vector adapters = instance->GetAdapters(); + [](const dawn::native::Adapter& adapter) { + wgpu::AdapterProperties properties; + adapter.GetProperties(&properties); - wgpu::Device device; - for (dawn::native::Adapter adapter : adapters) { - wgpu::AdapterProperties properties; - adapter.GetProperties(&properties); - - if (properties.backendType == wgpu::BackendType::Vulkan && - properties.adapterType == wgpu::AdapterType::CPU) { - device = wgpu::Device::Acquire(adapter.CreateDevice()); - break; - } - } - return device; + return gpu_info::IsGoogleSwiftshader(properties.vendorID, properties.deviceID); }, true /* supportsErrorInjection */); } diff --git a/src/dawn/fuzzers/DawnWireServerFuzzer.cpp b/src/dawn/fuzzers/DawnWireServerFuzzer.cpp index 1d325d4c27..89f1a3c682 100644 --- a/src/dawn/fuzzers/DawnWireServerFuzzer.cpp +++ b/src/dawn/fuzzers/DawnWireServerFuzzer.cpp @@ -49,8 +49,7 @@ class DevNull : public dawn::wire::CommandSerializer { std::unique_ptr sInstance; WGPUProcDeviceCreateSwapChain sOriginalDeviceCreateSwapChain = nullptr; - -bool sCommandsComplete = false; +static bool (*sAdapterSupported)(const dawn::native::Adapter&) = nullptr; WGPUSwapChain ErrorDeviceCreateSwapChain(WGPUDevice device, WGPUSurface surface, @@ -75,7 +74,7 @@ int DawnWireServerFuzzer::Initialize(int* argc, char*** argv) { int DawnWireServerFuzzer::Run(const uint8_t* data, size_t size, - MakeDeviceFn MakeDevice, + bool (*AdapterSupported)(const dawn::native::Adapter&), bool supportsErrorInjection) { // We require at least the injected error index. if (size < sizeof(uint64_t)) { @@ -96,6 +95,8 @@ int DawnWireServerFuzzer::Run(const uint8_t* data, dawn::native::InjectErrorAt(injectedErrorIndex); } + sAdapterSupported = AdapterSupported; + DawnProcTable procs = dawn::native::GetProcs(); // Swapchains receive a pointer to an implementation. The fuzzer will pass garbage in so we @@ -105,14 +106,23 @@ int DawnWireServerFuzzer::Run(const uint8_t* data, sOriginalDeviceCreateSwapChain = procs.deviceCreateSwapChain; procs.deviceCreateSwapChain = ErrorDeviceCreateSwapChain; - dawnProcSetProcs(&procs); + // Override requestAdapter to find an adapter that the fuzzer supports. + procs.instanceRequestAdapter = [](WGPUInstance cInstance, + const WGPURequestAdapterOptions* options, + WGPURequestAdapterCallback callback, void* userdata) { + std::vector adapters = sInstance->GetAdapters(); + for (dawn::native::Adapter adapter : adapters) { + if (sAdapterSupported(adapter)) { + WGPUAdapter cAdapter = adapter.Get(); + dawn::native::GetProcs().adapterReference(cAdapter); + callback(WGPURequestAdapterStatus_Success, cAdapter, nullptr, userdata); + return; + } + } + callback(WGPURequestAdapterStatus_Unavailable, nullptr, "No supported adapter.", userdata); + }; - wgpu::Device device = MakeDevice(sInstance.get()); - if (!device) { - // We should only ever fail device creation if an error was injected. - ASSERT(supportsErrorInjection); - return 0; - } + dawnProcSetProcs(&procs); DevNull devNull; dawn::wire::WireServerDescriptor serverDesc = {}; @@ -120,21 +130,11 @@ int DawnWireServerFuzzer::Run(const uint8_t* data, serverDesc.serializer = &devNull; std::unique_ptr wireServer(new dawn_wire::WireServer(serverDesc)); - wireServer->InjectDevice(device.Get(), 1, 0); - + wireServer->InjectInstance(sInstance->Get(), 1, 0); wireServer->HandleCommands(reinterpret_cast(data), size); - // Wait for all previous commands before destroying the server. - // TODO(enga): Improve this when we improve/finalize how processing events happens. - { - device.GetQueue().OnSubmittedWorkDone( - 0u, [](WGPUQueueWorkDoneStatus, void*) { sCommandsComplete = true; }, nullptr); - while (!sCommandsComplete) { - device.Tick(); - utils::USleep(100); - } - } - + // Note: Deleting the server will release all created objects. + // Deleted devices will wait for idle on destruction. wireServer = nullptr; return 0; } diff --git a/src/dawn/fuzzers/DawnWireServerFuzzer.h b/src/dawn/fuzzers/DawnWireServerFuzzer.h index 5ebc6b36e5..f076b67f81 100644 --- a/src/dawn/fuzzers/DawnWireServerFuzzer.h +++ b/src/dawn/fuzzers/DawnWireServerFuzzer.h @@ -22,17 +22,18 @@ namespace dawn::native { -class Instance; +class Adapter; } // namespace dawn::native namespace DawnWireServerFuzzer { -using MakeDeviceFn = std::function; - int Initialize(int* argc, char*** argv); -int Run(const uint8_t* data, size_t size, MakeDeviceFn MakeDevice, bool supportsErrorInjection); +int Run(const uint8_t* data, + size_t size, + bool (*AdapterSupported)(const dawn::native::Adapter&), + bool supportsErrorInjection); } // namespace DawnWireServerFuzzer diff --git a/src/dawn/glfw/BUILD.gn b/src/dawn/glfw/BUILD.gn new file mode 100644 index 0000000000..4c7c82595f --- /dev/null +++ b/src/dawn/glfw/BUILD.gn @@ -0,0 +1,51 @@ +# Copyright 2022 The Dawn Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../scripts/dawn_overrides_with_defaults.gni") + +import("${dawn_root}/scripts/dawn_component.gni") +import("${dawn_root}/scripts/dawn_features.gni") + +############################################################################### +# GLFW utils +############################################################################### + +if (dawn_supports_glfw_for_windowing) { + static_library("glfw") { + defines = [ "WGPU_GLFW_IMPLEMENTATION" ] + + sources = [ "utils.cpp" ] + deps = [ + "${dawn_root}/src/dawn:cpp", + "${dawn_root}/src/dawn:proc", + "${dawn_root}/src/dawn/common", + ] + + if (dawn_enable_metal) { + sources += [ "utils_metal.mm" ] + frameworks = [ + "Metal.framework", + "QuartzCore.framework", + ] + } + + public_deps = [ + "${dawn_root}/include/dawn:cpp_headers", + "${dawn_root}/third_party/gn/glfw", + ] + } +} else { + group("glfw") { + } +} diff --git a/src/dawn/glfw/CMakeLists.txt b/src/dawn/glfw/CMakeLists.txt new file mode 100644 index 0000000000..74062a3583 --- /dev/null +++ b/src/dawn/glfw/CMakeLists.txt @@ -0,0 +1,45 @@ +# Copyright 2022 The Dawn Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if(DAWN_SUPPORTS_GLFW_FOR_WINDOWING) + +add_library(dawn_glfw STATIC ${DAWN_PLACEHOLDER_FILE}) +common_compile_options(dawn_glfw) +target_sources(dawn_glfw PRIVATE + "utils.cpp" +) +target_link_libraries(dawn_glfw + PUBLIC + glfw + dawncpp_headers + dawn_common + PRIVATE + dawn_internal_config +) + +target_compile_definitions(dawn_glfw PRIVATE "WGPU_IMPLEMENTATION") +if(BUILD_SHARED_LIBS) + target_compile_definitions(dawn_glfw PRIVATE "WGPU_SHARED_LIBRARY") +endif() + +if (DAWN_ENABLE_METAL) + target_link_libraries(dawn_glfw PRIVATE "-framework Metal") + target_sources(dawn_glfw PRIVATE + "utils_metal.mm" + ) +endif() + +add_library(webgpu_glfw ALIAS dawn_glfw) + +endif() diff --git a/src/dawn/glfw/README.md b/src/dawn/glfw/README.md new file mode 100644 index 0000000000..f38624c54b --- /dev/null +++ b/src/dawn/glfw/README.md @@ -0,0 +1,5 @@ +In order to use Dawn WebGPU implementation with GLFW there is some +boilerplate code needed in order to create the WebGPU surface. This repo +contains an implementation of that boilerplate which can be used by +downstream applications. It can also serve as an example of how to +integrate Dawn and GLFW if there is desire to not use this helper. diff --git a/src/dawn/glfw/utils.cpp b/src/dawn/glfw/utils.cpp new file mode 100644 index 0000000000..0ae95ff589 --- /dev/null +++ b/src/dawn/glfw/utils.cpp @@ -0,0 +1,85 @@ +// Copyright 2020 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include + +#include "GLFW/glfw3.h" +#include "dawn/common/Platform.h" +#include "webgpu/webgpu_glfw.h" + +#if DAWN_PLATFORM_IS(WINDOWS) +#define GLFW_EXPOSE_NATIVE_WIN32 +#endif +#if defined(DAWN_USE_X11) +#define GLFW_EXPOSE_NATIVE_X11 +#endif +#if defined(DAWN_USE_WAYLAND) +#define GLFW_EXPOSE_NATIVE_WAYLAND +#endif +#include "GLFW/glfw3native.h" + +namespace wgpu::glfw { + +wgpu::Surface CreateSurfaceForWindow(const wgpu::Instance& instance, GLFWwindow* window) { + std::unique_ptr chainedDescriptor = + SetupWindowAndGetSurfaceDescriptor(window); + + wgpu::SurfaceDescriptor descriptor; + descriptor.nextInChain = chainedDescriptor.get(); + wgpu::Surface surface = instance.CreateSurface(&descriptor); + + return surface; +} + +// SetupWindowAndGetSurfaceDescriptorCocoa defined in GLFWUtils_metal.mm +std::unique_ptr SetupWindowAndGetSurfaceDescriptorCocoa(GLFWwindow* window); + +std::unique_ptr SetupWindowAndGetSurfaceDescriptor(GLFWwindow* window) { +#if DAWN_PLATFORM_IS(WINDOWS) + std::unique_ptr desc = + std::make_unique(); + desc->hwnd = glfwGetWin32Window(window); + desc->hinstance = GetModuleHandle(nullptr); + return std::move(desc); +#elif defined(DAWN_ENABLE_BACKEND_METAL) + return SetupWindowAndGetSurfaceDescriptorCocoa(window); +#elif defined(DAWN_USE_WAYLAND) || defined(DAWN_USE_X11) +#if defined(GLFW_PLATFORM_WAYLAND) && defined(DAWN_USE_WAYLAND) + if (glfwGetPlatform() == GLFW_PLATFORM_WAYLAND) { + std::unique_ptr desc = + std::make_unique(); + desc->display = glfwGetWaylandDisplay(); + desc->surface = glfwGetWaylandWindow(window); + return std::move(desc); + } else // NOLINT(readability/braces) +#endif +#if defined(DAWN_USE_X11) + { + std::unique_ptr desc = + std::make_unique(); + desc->display = glfwGetX11Display(); + desc->window = glfwGetX11Window(window); + return std::move(desc); + } +#else + { return nullptr; } +#endif +#else + return nullptr; +#endif +} + +} // namespace wgpu::glfw diff --git a/src/dawn/glfw/utils_metal.mm b/src/dawn/glfw/utils_metal.mm new file mode 100644 index 0000000000..d5576f9118 --- /dev/null +++ b/src/dawn/glfw/utils_metal.mm @@ -0,0 +1,49 @@ +// Copyright 2020 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#if !defined(DAWN_ENABLE_BACKEND_METAL) +#error "utils_metal.mm requires the Metal backend to be enabled." +#endif // !defined(DAWN_ENABLE_BACKEND_METAL) + +#include "webgpu/webgpu_glfw.h" + +#import +#include "GLFW/glfw3.h" + +#include + +#define GLFW_EXPOSE_NATIVE_COCOA +#include "GLFW/glfw3native.h" + +namespace wgpu::glfw { + +std::unique_ptr SetupWindowAndGetSurfaceDescriptorCocoa(GLFWwindow* window) { + NSWindow* nsWindow = glfwGetCocoaWindow(window); + NSView* view = [nsWindow contentView]; + + // Create a CAMetalLayer that covers the whole window that will be passed to + // CreateSurface. + [view setWantsLayer:YES]; + [view setLayer:[CAMetalLayer layer]]; + + // Use retina if the window was created with retina support. + [[view layer] setContentsScale:[nsWindow backingScaleFactor]]; + + std::unique_ptr desc = + std::make_unique(); + desc->layer = [view layer]; + return std::move(desc); +} + +} // namespace wgpu::glfw diff --git a/src/dawn/gpu_info.json b/src/dawn/gpu_info.json new file mode 100644 index 0000000000..64643b4af7 --- /dev/null +++ b/src/dawn/gpu_info.json @@ -0,0 +1,219 @@ +{ + "_comment": [ + "Copyright 2022 The Dawn Authors", + "", + "Licensed under the Apache License, Version 2.0 (the \"License\");", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + " http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an \"AS IS\" BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + + "vendors": { + + "_Example Vendor": { + "_comment": [ + "Each vendor must have an `id` field, which is it's PCI Vendor ID, and may optionally ", + "have a `devices` field which defines device -> architecture mappings which will be ", + "when populating the GPUAdapterInfo. Keys that begin with an `_` (like this one) denote ", + "commnents, and will be ignored by the parser." + ], + + "id": "0xDEAD", + + "devices": [{ + "_comment": [ + "The `devices` is an array of 'Device Sets', each of which contains an `architecture` ", + "object which defines an architecture name as a key followed by an array of ", + "PCI device IDs that map to that architecture. The architecture name is what will be ", + "reported to the GPUAdapterInfo, made lower-case and with spaces converted to hyphens." + ], + + "architecture": { + "Alpha": ["0x0A01", "0x0A02"], + "Beta": ["0x0B01", "0x0B02", "0x0B03"] + } + }, { + "_comment": [ + "A Device Set can also define a binary `mask`, which will be be applied to any device ", + "ID prior to comparison, making it easier to capture ranges of device IDs. ", + "Architectures may be duplicated between Device Sets as long as the device ID values ", + "Don't overlap." + ], + + "mask": "0xFF00", + "architecture": { + "Beta": ["0x1B00"], + "Gamma": ["0x0C00", "0x1C00"] + } + }, { + "_comment": [ + "Finally, Device Sets may be flagged as `internal`. Architectures defined in an ", + "internal device set will never be reported in the GPUAdapterInfo, but will generate ", + "appropriate helper functions in Dawn (such as `IsExampleVendorDelta()`) in order to ", + "aid in applying workarounds. Device IDs of internal device sets may overlap with ", + "ones defined in non-internal device sets, but architectures must be unique between ", + "internal and non-internal device sets.", + + "Internal architectures facilitate the (hopefully rare) cases where more targeted ", + "GPU identification is required by Dawn's implementation than is provided by the normal ", + "architecture groupings. When possible, however, using non-internal architectures ", + "should be preferred when applying workarounds." + ], + + "internal": true, + "mask": "0xFFF0", + "architecture": { + "Beta Rev 3": ["0x1B30"] + } + }] + }, + + "AMD": { + "id": "0x1002", + + "devices": [{ + "mask": "0xFF00", + "architecture": { + "GCN 2": ["0x1300"], + "GCN 5": ["0x1500", "0x1600"], + "RDNA 2": ["0x7400"] + } + }, { + "mask": "0xFFF0", + "architecture": { + "GCN 1": ["0x6600", "0x6610", "0x6660", "0x6790", "0x6800", "0x6810", "0x6820", "0x6830"], + "GCN 2": ["0x6640", "0x6650", "0x67A0", "0x67B0", "0x9830", "0x9850"], + "GCN 3": ["0x6900", "0x6920", "0x6930", "0x7300", "0x9870", "0x98E0"], + "GCN 4": ["0x67C0", "0x67D0", "0x67E0", "0x67F0", "0x6980", "0x6990"], + "GCN 5": ["0x66A0", "0x6860", "0x6870", "0x6940", "0x69A0"], + "RDNA 1": ["0x7310", "0x7340", "0x7360"], + "RDNA 2": ["0x73A0", "0x73B0", "0x73D0", "0x73E0", "0x73F0"] + } + }] + }, + + "Apple": { + "id": "0x106b", + + "_comment": [ + "Apple GPUs do not report a DeviceID via the Metal API, and as such the typical device", + "pattern matching does not work for them. The recommended approach is to find the highest", + "supported 'common' family supported and report it as the architecture.", + "Examples: 'common-1', 'common-3'", + "https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/detecting_gpu_features_and_metal_software_versions" + ] + }, + + "ARM": { + "id": "0x13B5", + + "devices": [{ + "mask": "0xF0000000", + "architecture": { + "_comment": [ + "The Midgard GPUs have device IDs like 0x07______ and 0x08______, but it's easiest to", + "mask those values out and simply check for the highest octet being zero, since that", + "distinguishes it from the other architectures." + ], + + "Midgard": ["0x00000000"], + "Bifrost": ["0x60000000", "0x70000000"], + "Valhall": ["0x90000000", "0xA0000000"] + } + }] + }, + + "Google": { + "id": "0x1AE0", + + "devices": [{ + "architecture": { + "Swiftshader": ["0xC0DE"] + } + }] + }, + + "Img Tec": { + "id": "0x1010" + }, + + "Intel": { + "id": "0x8086", + + "devices": [{ + "mask": "0xFF00", + "architecture": { + "Gen 7": ["0x0100", "0x0400", "0x0A00", "0x0D00", "0x0F00"], + "Gen 8": ["0x1600", "0x2200"], + "Gen 9": ["0x1900", "0x3100", "0x3E00", "0x5A00", "0x5900", "0x9B00"], + "Gen 11": ["0x8A00"], + "Gen 12 LP": ["0x4600", "0x4C00", "0x4900", "0x9A00"], + "Gen 12 HP": ["0x4F00", "0x5600"] + } + }] + }, + + "Mesa": { + "id": "0x10005" + }, + + "Microsoft": { + "id": "0x1414", + + "devices": [{ + "architecture": { + "WARP": ["0x8c"] + } + }] + }, + + "Nvidia": { + "id": "0x10DE", + + "devices": [{ + "mask": "0xFF00", + "architecture": { + "Fermi": ["0x0D00"], + "Kepler": ["0x0F00", "0x1000", "0x1100", "0x1200"], + "Maxwell": ["0x1300", "0x1400", "0x1600", "0x1700"], + "Pascal": ["0x1500", "0x1B00", "0x1C00", "0x1D00"], + "Turing": ["0x1E00", "0x1F00", "0x2100"], + "Ampere": ["0x2200", "0x2400", "0x2500"] + } + }] + }, + + "Qualcomm": { + "id": "0x5143", + + "devices": [{ + "mask": "0xFF000000", + "architecture": { + "Adreno 4xx": ["0x04000000"], + "Adreno 5xx": ["0x05000000"], + "Adreno 6xx": ["0x06000000"], + "Adreno 7xx": ["0x07000000"] + } + }] + }, + + "Samsung": { + "id": "0x144d", + + "devices": [{ + "architecture": { + "RDNA 2": ["0x73A0"] + } + }] + } + + } + +} diff --git a/src/dawn/native/Adapter.cpp b/src/dawn/native/Adapter.cpp index b24e920c1e..741531281b 100644 --- a/src/dawn/native/Adapter.cpp +++ b/src/dawn/native/Adapter.cpp @@ -18,6 +18,7 @@ #include #include "dawn/common/Constants.h" +#include "dawn/common/GPUInfo.h" #include "dawn/native/Device.h" #include "dawn/native/Instance.h" #include "dawn/native/ValidationUtils_autogen.h" @@ -30,8 +31,12 @@ AdapterBase::AdapterBase(InstanceBase* instance, wgpu::BackendType backend) mSupportedFeatures.EnableFeature(Feature::DawnInternalUsages); } +AdapterBase::~AdapterBase() = default; + MaybeError AdapterBase::Initialize() { DAWN_TRY_CONTEXT(InitializeImpl(), "initializing adapter (backend=%s)", mBackend); + InitializeVendorArchitectureImpl(); + DAWN_TRY_CONTEXT( InitializeSupportedFeaturesImpl(), "gathering supported features for \"%s\" - \"%s\" (vendorId=%#06x deviceId=%#06x " @@ -46,6 +51,8 @@ MaybeError AdapterBase::Initialize() { // Enforce internal Dawn constants. mLimits.v1.maxVertexBufferArrayStride = std::min(mLimits.v1.maxVertexBufferArrayStride, kMaxVertexBufferArrayStride); + mLimits.v1.maxColorAttachments = + std::min(mLimits.v1.maxColorAttachments, uint32_t(kMaxColorAttachments)); mLimits.v1.maxBindGroups = std::min(mLimits.v1.maxBindGroups, kMaxBindGroups); mLimits.v1.maxVertexAttributes = std::min(mLimits.v1.maxVertexAttributes, uint32_t(kMaxVertexAttributes)); @@ -79,6 +86,8 @@ bool AdapterBase::APIGetLimits(SupportedLimits* limits) const { void AdapterBase::APIGetProperties(AdapterProperties* properties) const { properties->vendorID = mVendorId; + properties->vendorName = mVendorName.c_str(); + properties->architecture = mArchitectureName.c_str(); properties->deviceID = mDeviceId; properties->name = mName.c_str(); properties->driverDescription = mDriverDescription.c_str(); @@ -132,6 +141,11 @@ void AdapterBase::APIRequestDevice(const DeviceDescriptor* descriptor, callback(status, ToAPI(device.Detach()), nullptr, userdata); } +void AdapterBase::InitializeVendorArchitectureImpl() { + mVendorName = gpu_info::GetVendorName(mVendorId); + mArchitectureName = gpu_info::GetArchitectureName(mVendorId, mDeviceId); +} + uint32_t AdapterBase::GetVendorId() const { return mVendorId; } @@ -145,7 +159,7 @@ wgpu::BackendType AdapterBase::GetBackendType() const { } InstanceBase* AdapterBase::GetInstance() const { - return mInstance; + return mInstance.Get(); } FeaturesSet AdapterBase::GetSupportedFeatures() const { @@ -162,22 +176,6 @@ bool AdapterBase::SupportsAllRequiredFeatures( return true; } -WGPUDeviceProperties AdapterBase::GetAdapterProperties() const { - WGPUDeviceProperties adapterProperties = {}; - adapterProperties.deviceID = mDeviceId; - adapterProperties.vendorID = mVendorId; - adapterProperties.adapterType = static_cast(mAdapterType); - - mSupportedFeatures.InitializeDeviceProperties(&adapterProperties); - // This is OK for now because there are no limit feature structs. - // If we add additional structs, the caller will need to provide memory - // to store them (ex. by calling GetLimits directly instead). Currently, - // we keep this function as it's only used internally in Chromium to - // send the adapter properties across the wire. - GetLimits(FromAPI(&adapterProperties.limits)); - return adapterProperties; -} - bool AdapterBase::GetLimits(SupportedLimits* limits) const { ASSERT(limits != nullptr); if (limits->nextInChain != nullptr) { diff --git a/src/dawn/native/Adapter.h b/src/dawn/native/Adapter.h index 9a1b24f86b..6b6448f956 100644 --- a/src/dawn/native/Adapter.h +++ b/src/dawn/native/Adapter.h @@ -33,7 +33,7 @@ class DeviceBase; class AdapterBase : public RefCounted { public: AdapterBase(InstanceBase* instance, wgpu::BackendType backend); - virtual ~AdapterBase() = default; + ~AdapterBase() override; MaybeError Initialize(); @@ -57,7 +57,6 @@ class AdapterBase : public RefCounted { FeaturesSet GetSupportedFeatures() const; bool SupportsAllRequiredFeatures( const ityp::span& features) const; - WGPUDeviceProperties GetAdapterProperties() const; bool GetLimits(SupportedLimits* limits) const; @@ -67,6 +66,8 @@ class AdapterBase : public RefCounted { protected: uint32_t mVendorId = 0xFFFFFFFF; + std::string mVendorName; + std::string mArchitectureName; uint32_t mDeviceId = 0xFFFFFFFF; std::string mName; wgpu::AdapterType mAdapterType = wgpu::AdapterType::Unknown; @@ -84,10 +85,12 @@ class AdapterBase : public RefCounted { // Check base WebGPU limits and populate supported limits. virtual MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) = 0; + virtual void InitializeVendorArchitectureImpl(); + ResultOrError> CreateDeviceInternal(const DeviceDescriptor* descriptor); virtual MaybeError ResetInternalDeviceForTestingImpl(); - InstanceBase* mInstance = nullptr; + Ref mInstance; wgpu::BackendType mBackend; CombinedLimits mLimits; bool mUseTieredLimits = false; diff --git a/src/dawn/native/ApplyClearColorValueWithDrawHelper.cpp b/src/dawn/native/ApplyClearColorValueWithDrawHelper.cpp new file mode 100644 index 0000000000..02f83ad866 --- /dev/null +++ b/src/dawn/native/ApplyClearColorValueWithDrawHelper.cpp @@ -0,0 +1,396 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/ApplyClearColorValueWithDrawHelper.h" + +#include +#include +#include +#include + +#include "dawn/native/BindGroup.h" +#include "dawn/native/BindGroupLayout.h" +#include "dawn/native/Device.h" +#include "dawn/native/InternalPipelineStore.h" +#include "dawn/native/ObjectContentHasher.h" +#include "dawn/native/RenderPassEncoder.h" +#include "dawn/native/RenderPipeline.h" +#include "dawn/native/utils/WGPUHelpers.h" + +namespace dawn::native { + +namespace { + +// General helper functions and data structures for applying clear values with draw +static const char kVSSource[] = R"( +@vertex +fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { + var pos = array, 6>( + vec2( 0.0, -1.0), + vec2( 1.0, -1.0), + vec2( 0.0, 1.0), + vec2( 0.0, 1.0), + vec2( 1.0, -1.0), + vec2( 1.0, 1.0)); + return vec4(pos[VertexIndex], 0.0, 1.0); +})"; + +const char* GetTextureComponentTypeString(DeviceBase* device, wgpu::TextureFormat format) { + ASSERT(format != wgpu::TextureFormat::Undefined); + + const Format& formatInfo = device->GetValidInternalFormat(format); + switch (formatInfo.GetAspectInfo(Aspect::Color).baseType) { + case wgpu::TextureComponentType::Sint: + return "i32"; + case wgpu::TextureComponentType::Uint: + return "u32"; + case wgpu::TextureComponentType::Float: + case wgpu::TextureComponentType::DepthComparison: + default: + UNREACHABLE(); + return ""; + } +} + +// Construct the fragment shader to apply the input color values to the corresponding color +// attachments of KeyOfApplyClearColorValueWithDrawPipelines. +std::string ConstructFragmentShader(DeviceBase* device, + const KeyOfApplyClearColorValueWithDrawPipelines& key) { + std::ostringstream outputColorDeclarationStream; + std::ostringstream clearValueUniformBufferDeclarationStream; + std::ostringstream assignOutputColorStream; + + outputColorDeclarationStream << "struct OutputColor {" << std::endl; + clearValueUniformBufferDeclarationStream << "struct ClearColors {" << std::endl; + + // Only generate the assignments we need. + for (uint32_t i : IterateBitSet(key.colorTargetsToApplyClearColorValue)) { + wgpu::TextureFormat currentFormat = key.colorTargetFormats[i]; + ASSERT(currentFormat != wgpu::TextureFormat::Undefined); + + const char* type = GetTextureComponentTypeString(device, currentFormat); + + outputColorDeclarationStream << "@location(" << i << ") output" << i << " : vec4<" << type + << ">," << std::endl; + clearValueUniformBufferDeclarationStream << "color" << i << " : vec4<" << type << ">," + << std::endl; + assignOutputColorStream << "outputColor.output" << i << " = clearColors.color" << i << ";" + << std::endl; + } + outputColorDeclarationStream << "}" << std::endl; + clearValueUniformBufferDeclarationStream << "}" << std::endl; + + std::ostringstream fragmentShaderStream; + fragmentShaderStream << outputColorDeclarationStream.str() + << clearValueUniformBufferDeclarationStream.str() << R"( +@group(0) @binding(0) var clearColors : ClearColors; + +@fragment +fn main() -> OutputColor { + var outputColor : OutputColor; +)" << assignOutputColorStream.str() + << R"( +return outputColor; +})"; + + return fragmentShaderStream.str(); +} + +RenderPipelineBase* GetCachedPipeline(InternalPipelineStore* store, + const KeyOfApplyClearColorValueWithDrawPipelines& key) { + auto iter = store->applyClearColorValueWithDrawPipelines.find(key); + if (iter != store->applyClearColorValueWithDrawPipelines.end()) { + return iter->second.Get(); + } + return nullptr; +} + +ResultOrError GetOrCreateApplyClearValueWithDrawPipeline( + DeviceBase* device, + const KeyOfApplyClearColorValueWithDrawPipelines& key) { + InternalPipelineStore* store = device->GetInternalPipelineStore(); + RenderPipelineBase* cachedPipeline = GetCachedPipeline(store, key); + if (cachedPipeline != nullptr) { + return cachedPipeline; + } + + // Prepare the vertex stage + Ref vertexModule; + DAWN_TRY_ASSIGN(vertexModule, utils::CreateShaderModule(device, kVSSource)); + VertexState vertex = {}; + vertex.module = vertexModule.Get(); + vertex.entryPoint = "main"; + + // Prepare the fragment stage + std::string fragmentShader = ConstructFragmentShader(device, key); + Ref fragmentModule; + DAWN_TRY_ASSIGN(fragmentModule, utils::CreateShaderModule(device, fragmentShader.c_str())); + FragmentState fragment = {}; + fragment.module = fragmentModule.Get(); + fragment.entryPoint = "main"; + + // Prepare the color states + std::array colorTargets = {}; + for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { + colorTargets[i].format = key.colorTargetFormats[i]; + // We shouldn't change the color targets that are not involved in. + if (!key.colorTargetsToApplyClearColorValue[i]) { + colorTargets[i].writeMask = wgpu::ColorWriteMask::None; + } + } + + // Create RenderPipeline + RenderPipelineDescriptor renderPipelineDesc = {}; + + renderPipelineDesc.vertex = vertex; + renderPipelineDesc.fragment = &fragment; + renderPipelineDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList; + fragment.targetCount = key.colorAttachmentCount; + fragment.targets = colorTargets.data(); + + Ref pipeline; + DAWN_TRY_ASSIGN(pipeline, device->CreateRenderPipeline(&renderPipelineDesc)); + store->applyClearColorValueWithDrawPipelines.insert({key, std::move(pipeline)}); + + return GetCachedPipeline(store, key); +} + +Color GetClearColorValue(const RenderPassColorAttachment& attachment) { + return HasDeprecatedColor(attachment) ? attachment.clearColor : attachment.clearValue; +} + +ResultOrError> CreateUniformBufferWithClearValues( + DeviceBase* device, + const RenderPassDescriptor* renderPassDescriptor, + const KeyOfApplyClearColorValueWithDrawPipelines& key) { + std::array clearValues = {}; + uint32_t offset = 0; + for (uint32_t i : IterateBitSet(key.colorTargetsToApplyClearColorValue)) { + const Format& format = renderPassDescriptor->colorAttachments[i].view->GetFormat(); + wgpu::TextureComponentType baseType = format.GetAspectInfo(Aspect::Color).baseType; + + Color initialClearValue = GetClearColorValue(renderPassDescriptor->colorAttachments[i]); + Color clearValue = ClampClearColorValueToLegalRange(initialClearValue, format); + switch (baseType) { + case wgpu::TextureComponentType::Uint: { + uint32_t* clearValuePtr = reinterpret_cast(clearValues.data() + offset); + clearValuePtr[0] = static_cast(clearValue.r); + clearValuePtr[1] = static_cast(clearValue.g); + clearValuePtr[2] = static_cast(clearValue.b); + clearValuePtr[3] = static_cast(clearValue.a); + break; + } + case wgpu::TextureComponentType::Sint: { + int32_t* clearValuePtr = reinterpret_cast(clearValues.data() + offset); + clearValuePtr[0] = static_cast(clearValue.r); + clearValuePtr[1] = static_cast(clearValue.g); + clearValuePtr[2] = static_cast(clearValue.b); + clearValuePtr[3] = static_cast(clearValue.a); + break; + } + case wgpu::TextureComponentType::Float: { + float* clearValuePtr = reinterpret_cast(clearValues.data() + offset); + clearValuePtr[0] = static_cast(clearValue.r); + clearValuePtr[1] = static_cast(clearValue.g); + clearValuePtr[2] = static_cast(clearValue.b); + clearValuePtr[3] = static_cast(clearValue.a); + break; + } + + case wgpu::TextureComponentType::DepthComparison: + default: + UNREACHABLE(); + break; + } + offset += sizeof(uint32_t) * 4; + } + + ASSERT(offset > 0); + + Ref outputBuffer; + DAWN_TRY_ASSIGN( + outputBuffer, + utils::CreateBufferFromData(device, wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Uniform, + clearValues.data(), offset)); + + return std::move(outputBuffer); +} + +// Helper functions for applying big integer clear values with draw +bool ShouldApplyClearBigIntegerColorValueWithDraw( + const RenderPassColorAttachment& colorAttachmentInfo) { + if (colorAttachmentInfo.view == nullptr) { + return false; + } + + if (colorAttachmentInfo.loadOp != wgpu::LoadOp::Clear) { + return false; + } + + // We should only apply this workaround on 32-bit signed and unsigned integer formats. + const Format& format = colorAttachmentInfo.view->GetFormat(); + switch (format.format) { + case wgpu::TextureFormat::R32Sint: + case wgpu::TextureFormat::RG32Sint: + case wgpu::TextureFormat::RGBA32Sint: + case wgpu::TextureFormat::R32Uint: + case wgpu::TextureFormat::RG32Uint: + case wgpu::TextureFormat::RGBA32Uint: + break; + default: + return false; + } + + // TODO(dawn:537): only check the color channels that are available in the current color format. + Color clearValue = GetClearColorValue(colorAttachmentInfo); + switch (format.GetAspectInfo(Aspect::Color).baseType) { + case wgpu::TextureComponentType::Uint: { + constexpr double kMaxUintRepresentableInFloat = 1 << std::numeric_limits::digits; + if (clearValue.r <= kMaxUintRepresentableInFloat && + clearValue.g <= kMaxUintRepresentableInFloat && + clearValue.b <= kMaxUintRepresentableInFloat && + clearValue.a <= kMaxUintRepresentableInFloat) { + return false; + } + break; + } + case wgpu::TextureComponentType::Sint: { + constexpr double kMaxSintRepresentableInFloat = 1 << std::numeric_limits::digits; + constexpr double kMinSintRepresentableInFloat = -kMaxSintRepresentableInFloat; + if (clearValue.r <= kMaxSintRepresentableInFloat && + clearValue.r >= kMinSintRepresentableInFloat && + clearValue.g <= kMaxSintRepresentableInFloat && + clearValue.g >= kMinSintRepresentableInFloat && + clearValue.b <= kMaxSintRepresentableInFloat && + clearValue.b >= kMinSintRepresentableInFloat && + clearValue.a <= kMaxSintRepresentableInFloat && + clearValue.a >= kMinSintRepresentableInFloat) { + return false; + } + break; + } + case wgpu::TextureComponentType::Float: + case wgpu::TextureComponentType::DepthComparison: + default: + UNREACHABLE(); + return false; + } + + return true; +} + +KeyOfApplyClearColorValueWithDrawPipelines GetKeyOfApplyClearColorValueWithDrawPipelines( + const RenderPassDescriptor* renderPassDescriptor) { + KeyOfApplyClearColorValueWithDrawPipelines key; + key.colorAttachmentCount = renderPassDescriptor->colorAttachmentCount; + + key.colorTargetFormats.fill(wgpu::TextureFormat::Undefined); + for (uint32_t i = 0; i < renderPassDescriptor->colorAttachmentCount; ++i) { + if (renderPassDescriptor->colorAttachments[i].view != nullptr) { + key.colorTargetFormats[i] = + renderPassDescriptor->colorAttachments[i].view->GetFormat().format; + } + + if (ShouldApplyClearBigIntegerColorValueWithDraw( + renderPassDescriptor->colorAttachments[i])) { + key.colorTargetsToApplyClearColorValue.set(i); + } + } + return key; +} + +} // namespace + +size_t KeyOfApplyClearColorValueWithDrawPipelinesHashFunc::operator()( + KeyOfApplyClearColorValueWithDrawPipelines key) const { + size_t hash = 0; + + HashCombine(&hash, key.colorAttachmentCount); + + HashCombine(&hash, key.colorTargetsToApplyClearColorValue); + + for (wgpu::TextureFormat format : key.colorTargetFormats) { + HashCombine(&hash, format); + } + + return hash; +} + +bool KeyOfApplyClearColorValueWithDrawPipelinesEqualityFunc::operator()( + KeyOfApplyClearColorValueWithDrawPipelines key1, + KeyOfApplyClearColorValueWithDrawPipelines key2) const { + if (key1.colorAttachmentCount != key2.colorAttachmentCount) { + return false; + } + + if (key1.colorTargetsToApplyClearColorValue != key2.colorTargetsToApplyClearColorValue) { + return false; + } + + for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { + if (key1.colorTargetFormats[i] != key2.colorTargetFormats[i]) { + return false; + } + } + return true; +} + +bool ShouldApplyClearBigIntegerColorValueWithDraw( + const DeviceBase* device, + const RenderPassDescriptor* renderPassDescriptor) { + if (!device->IsToggleEnabled(Toggle::ApplyClearBigIntegerColorValueWithDraw)) { + return false; + } + + for (uint32_t i = 0; i < renderPassDescriptor->colorAttachmentCount; ++i) { + if (ShouldApplyClearBigIntegerColorValueWithDraw( + renderPassDescriptor->colorAttachments[i])) { + return true; + } + } + + return false; +} + +MaybeError ApplyClearBigIntegerColorValueWithDraw( + RenderPassEncoder* renderPassEncoder, + const RenderPassDescriptor* renderPassDescriptor) { + DeviceBase* device = renderPassEncoder->GetDevice(); + + KeyOfApplyClearColorValueWithDrawPipelines key = + GetKeyOfApplyClearColorValueWithDrawPipelines(renderPassDescriptor); + + RenderPipelineBase* pipeline = nullptr; + DAWN_TRY_ASSIGN(pipeline, GetOrCreateApplyClearValueWithDrawPipeline(device, key)); + + Ref layout; + DAWN_TRY_ASSIGN(layout, pipeline->GetBindGroupLayout(0)); + + Ref uniformBufferWithClearColorValues; + DAWN_TRY_ASSIGN(uniformBufferWithClearColorValues, + CreateUniformBufferWithClearValues(device, renderPassDescriptor, key)); + + Ref bindGroup; + DAWN_TRY_ASSIGN(bindGroup, + utils::MakeBindGroup(device, layout, {{0, uniformBufferWithClearColorValues}}, + UsageValidationMode::Internal)); + + renderPassEncoder->APISetBindGroup(0, bindGroup.Get()); + renderPassEncoder->APISetPipeline(pipeline); + renderPassEncoder->APIDraw(6); + + return {}; +} + +} // namespace dawn::native diff --git a/src/dawn/native/ApplyClearColorValueWithDrawHelper.h b/src/dawn/native/ApplyClearColorValueWithDrawHelper.h new file mode 100644 index 0000000000..60fce8b433 --- /dev/null +++ b/src/dawn/native/ApplyClearColorValueWithDrawHelper.h @@ -0,0 +1,55 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_APPLYCLEARVALUEWITHDRAWHELPER_H_ +#define SRC_DAWN_NATIVE_APPLYCLEARVALUEWITHDRAWHELPER_H_ + +#include +#include +#include "dawn/common/Constants.h" +#include "dawn/native/Error.h" + +namespace dawn::native { +class BufferBase; +class RenderPassEncoder; +struct RenderPassDescriptor; + +struct KeyOfApplyClearColorValueWithDrawPipelines { + uint8_t colorAttachmentCount; + std::array colorTargetFormats; + std::bitset colorTargetsToApplyClearColorValue; +}; + +struct KeyOfApplyClearColorValueWithDrawPipelinesHashFunc { + size_t operator()(KeyOfApplyClearColorValueWithDrawPipelines key) const; +}; +struct KeyOfApplyClearColorValueWithDrawPipelinesEqualityFunc { + bool operator()(KeyOfApplyClearColorValueWithDrawPipelines key1, + const KeyOfApplyClearColorValueWithDrawPipelines key2) const; +}; +using ApplyClearColorValueWithDrawPipelinesCache = + std::unordered_map, + KeyOfApplyClearColorValueWithDrawPipelinesHashFunc, + KeyOfApplyClearColorValueWithDrawPipelinesEqualityFunc>; + +bool ShouldApplyClearBigIntegerColorValueWithDraw(const DeviceBase* device, + const RenderPassDescriptor* renderPassDescriptor); + +MaybeError ApplyClearBigIntegerColorValueWithDraw(RenderPassEncoder* renderPassEncoder, + const RenderPassDescriptor* renderPassDescriptor); + +} // namespace dawn::native + +#endif diff --git a/src/dawn/native/AsyncTask.cpp b/src/dawn/native/AsyncTask.cpp index 00e6a6466c..2f0facef3e 100644 --- a/src/dawn/native/AsyncTask.cpp +++ b/src/dawn/native/AsyncTask.cpp @@ -77,4 +77,8 @@ void AsyncTaskManager::DoWaitableTask(void* task) { waitableTask->taskManager->HandleTaskCompletion(waitableTask.Get()); } +AsyncTaskManager::WaitableTask::WaitableTask() = default; + +AsyncTaskManager::WaitableTask::~WaitableTask() = default; + } // namespace dawn::native diff --git a/src/dawn/native/AsyncTask.h b/src/dawn/native/AsyncTask.h index d2c28fa890..78fc8af1f3 100644 --- a/src/dawn/native/AsyncTask.h +++ b/src/dawn/native/AsyncTask.h @@ -47,6 +47,9 @@ class AsyncTaskManager { private: class WaitableTask : public RefCounted { public: + WaitableTask(); + ~WaitableTask() override; + AsyncTask asyncTask; AsyncTaskManager* taskManager; std::unique_ptr waitableEvent; diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn index d0a33e95d3..19ca4d4b85 100644 --- a/src/dawn/native/BUILD.gn +++ b/src/dawn/native/BUILD.gn @@ -51,7 +51,10 @@ group("abseil") { if (build_with_chromium) { public_deps = [ "$dawn_abseil_dir:absl" ] } else { - public_deps = [ "${dawn_root}/third_party/gn/abseil-cpp:str_format" ] + public_deps = [ + "${dawn_root}/third_party/gn/abseil-cpp:str_format", + "${dawn_root}/third_party/gn/abseil-cpp:strings", + ] } } @@ -94,9 +97,9 @@ dawn_json_generator("utils_gen") { "src/dawn/native/ValidationUtils_autogen.cpp", "src/dawn/native/webgpu_absl_format_autogen.h", "src/dawn/native/webgpu_absl_format_autogen.cpp", + "src/dawn/native/webgpu_StreamImpl_autogen.cpp", "src/dawn/native/ObjectType_autogen.h", "src/dawn/native/ObjectType_autogen.cpp", - "src/dawn/native/CacheKey_autogen.cpp", ] } @@ -154,6 +157,12 @@ source_set("sources") { configs += [ ":internal" ] + # Enable -Wglobal-constructors here only, instead of in internal_config, + # because gtest and some other targets don't build with it. + if (is_clang) { + cflags = [ "-Wglobal-constructors" ] + } + # Dependencies that are needed to compile dawn native entry points in # FooBackend.cpp need to be public deps so they are propagated to the # dawn native target @@ -166,6 +175,8 @@ source_set("sources") { sources += [ "Adapter.cpp", "Adapter.h", + "ApplyClearColorValueWithDrawHelper.cpp", + "ApplyClearColorValueWithDrawHelper.h", "AsyncTask.cpp", "AsyncTask.h", "AttachmentState.cpp", @@ -179,6 +190,8 @@ source_set("sources") { "BindGroupTracker.h", "BindingInfo.cpp", "BindingInfo.h", + "Blob.cpp", + "Blob.h", "BlobCache.cpp", "BlobCache.h", "BuddyAllocator.cpp", @@ -189,6 +202,9 @@ source_set("sources") { "Buffer.h", "CacheKey.cpp", "CacheKey.h", + "CacheRequest.cpp", + "CacheRequest.h", + "CacheResult.h", "CachedObject.cpp", "CachedObject.h", "CallbackTaskManager.cpp", @@ -253,6 +269,7 @@ source_set("sources") { "ObjectBase.h", "ObjectContentHasher.cpp", "ObjectContentHasher.h", + "PassResourceUsage.cpp", "PassResourceUsage.h", "PassResourceUsageTracker.cpp", "PassResourceUsageTracker.h", @@ -274,6 +291,8 @@ source_set("sources") { "QuerySet.h", "Queue.cpp", "Queue.h", + "RefCountedWithExternalCount.cpp", + "RefCountedWithExternalCount.h", "RenderBundle.cpp", "RenderBundle.h", "RenderBundleEncoder.cpp", @@ -294,10 +313,12 @@ source_set("sources") { "Sampler.h", "ScratchBuffer.cpp", "ScratchBuffer.h", + "Serializable.h", "ShaderModule.cpp", "ShaderModule.h", "StagingBuffer.cpp", "StagingBuffer.h", + "StreamImplTint.cpp", "Subresource.cpp", "Subresource.h", "SubresourceStorage.h", @@ -312,9 +333,19 @@ source_set("sources") { "ToBackend.h", "Toggles.cpp", "Toggles.h", + "UsageValidationMode.h", "VertexFormat.cpp", "VertexFormat.h", + "VisitableMembers.h", "dawn_platform.h", + "stream/BlobSource.cpp", + "stream/BlobSource.h", + "stream/ByteVectorSink.cpp", + "stream/ByteVectorSink.h", + "stream/Sink.h", + "stream/Source.h", + "stream/Stream.cpp", + "stream/Stream.h", "utils/WGPUHelpers.cpp", "utils/WGPUHelpers.h", "webgpu_absl_format.cpp", @@ -362,6 +393,8 @@ source_set("sources") { "d3d12/BindGroupD3D12.h", "d3d12/BindGroupLayoutD3D12.cpp", "d3d12/BindGroupLayoutD3D12.h", + "d3d12/BlobD3D12.cpp", + "d3d12/BlobD3D12.h", "d3d12/BufferD3D12.cpp", "d3d12/BufferD3D12.h", "d3d12/CPUDescriptorHeapAllocationD3D12.cpp", @@ -382,6 +415,8 @@ source_set("sources") { "d3d12/D3D12Info.h", "d3d12/DeviceD3D12.cpp", "d3d12/DeviceD3D12.h", + "d3d12/ExternalImageDXGIImpl.cpp", + "d3d12/ExternalImageDXGIImpl.h", "d3d12/Forward.h", "d3d12/GPUDescriptorHeapAllocationD3D12.cpp", "d3d12/GPUDescriptorHeapAllocationD3D12.h", @@ -424,6 +459,7 @@ source_set("sources") { "d3d12/StagingBufferD3D12.h", "d3d12/StagingDescriptorAllocatorD3D12.cpp", "d3d12/StagingDescriptorAllocatorD3D12.h", + "d3d12/StreamImplD3D12.cpp", "d3d12/SwapChainD3D12.cpp", "d3d12/SwapChainD3D12.h", "d3d12/TextureCopySplitter.cpp", @@ -506,6 +542,8 @@ source_set("sources") { ] sources += get_target_outputs(":opengl_loader_gen") sources += [ + "opengl/AdapterGL.cpp", + "opengl/AdapterGL.h", "opengl/BackendGL.cpp", "opengl/BackendGL.h", "opengl/BindGroupGL.cpp", @@ -518,8 +556,12 @@ source_set("sources") { "opengl/CommandBufferGL.h", "opengl/ComputePipelineGL.cpp", "opengl/ComputePipelineGL.h", + "opengl/ContextEGL.cpp", + "opengl/ContextEGL.h", "opengl/DeviceGL.cpp", "opengl/DeviceGL.h", + "opengl/EGLFunctions.cpp", + "opengl/EGLFunctions.h", "opengl/Forward.h", "opengl/GLFormat.cpp", "opengl/GLFormat.h", @@ -549,10 +591,13 @@ source_set("sources") { "opengl/SwapChainGL.h", "opengl/TextureGL.cpp", "opengl/TextureGL.h", + "opengl/UtilsEGL.cpp", + "opengl/UtilsEGL.h", "opengl/UtilsGL.cpp", "opengl/UtilsGL.h", "opengl/opengl_platform.h", ] + include_dirs = [ "//third_party/khronos" ] } if (dawn_enable_vulkan) { @@ -570,8 +615,6 @@ source_set("sources") { "vulkan/BindGroupVk.h", "vulkan/BufferVk.cpp", "vulkan/BufferVk.h", - "vulkan/CacheKeyVk.cpp", - "vulkan/CacheKeyVk.h", "vulkan/CommandBufferVk.cpp", "vulkan/CommandBufferVk.h", "vulkan/CommandRecordingContext.h", @@ -610,6 +653,7 @@ source_set("sources") { "vulkan/ShaderModuleVk.h", "vulkan/StagingBufferVk.cpp", "vulkan/StagingBufferVk.h", + "vulkan/StreamImplVk.cpp", "vulkan/SwapChainVk.cpp", "vulkan/SwapChainVk.h", "vulkan/TextureVk.cpp", diff --git a/src/dawn/native/BindGroup.cpp b/src/dawn/native/BindGroup.cpp index a4c92d24db..37ec0367d9 100644 --- a/src/dawn/native/BindGroup.cpp +++ b/src/dawn/native/BindGroup.cpp @@ -20,12 +20,14 @@ #include "dawn/native/BindGroupLayout.h" #include "dawn/native/Buffer.h" #include "dawn/native/ChainUtils_autogen.h" +#include "dawn/native/CommandValidation.h" #include "dawn/native/Device.h" #include "dawn/native/ExternalTexture.h" #include "dawn/native/ObjectBase.h" #include "dawn/native/ObjectType_autogen.h" #include "dawn/native/Sampler.h" #include "dawn/native/Texture.h" +#include "dawn/native/utils/WGPUHelpers.h" namespace dawn::native { @@ -114,7 +116,8 @@ MaybeError ValidateBufferBinding(const DeviceBase* device, MaybeError ValidateTextureBinding(DeviceBase* device, const BindGroupEntry& entry, - const BindingInfo& bindingInfo) { + const BindingInfo& bindingInfo, + UsageValidationMode mode) { DAWN_INVALID_IF(entry.textureView == nullptr, "Binding entry textureView not set."); DAWN_INVALID_IF(entry.sampler != nullptr || entry.buffer != nullptr, @@ -136,9 +139,7 @@ MaybeError ValidateTextureBinding(DeviceBase* device, texture->GetFormat().GetAspectInfo(aspect).supportedSampleTypes; SampleTypeBit requiredType = SampleTypeToSampleTypeBit(bindingInfo.texture.sampleType); - DAWN_INVALID_IF(!(texture->GetUsage() & wgpu::TextureUsage::TextureBinding), - "Usage (%s) of %s doesn't include TextureUsage::TextureBinding.", - texture->GetUsage(), texture); + DAWN_TRY(ValidateCanUseAs(texture, wgpu::TextureUsage::TextureBinding, mode)); DAWN_INVALID_IF(texture->IsMultisampledTexture() != bindingInfo.texture.multisampled, "Sample count (%u) of %s doesn't match expectation (multisampled: %d).", @@ -157,9 +158,7 @@ MaybeError ValidateTextureBinding(DeviceBase* device, break; } case BindingInfoType::StorageTexture: { - DAWN_INVALID_IF(!(texture->GetUsage() & wgpu::TextureUsage::StorageBinding), - "Usage (%s) of %s doesn't include TextureUsage::StorageBinding.", - texture->GetUsage(), texture); + DAWN_TRY(ValidateCanUseAs(texture, wgpu::TextureUsage::StorageBinding, mode)); ASSERT(!texture->IsMultisampledTexture()); @@ -253,7 +252,9 @@ MaybeError ValidateExternalTextureBinding( } // anonymous namespace -MaybeError ValidateBindGroupDescriptor(DeviceBase* device, const BindGroupDescriptor* descriptor) { +MaybeError ValidateBindGroupDescriptor(DeviceBase* device, + const BindGroupDescriptor* descriptor, + UsageValidationMode mode) { DAWN_INVALID_IF(descriptor->nextInChain != nullptr, "nextInChain must be nullptr."); DAWN_TRY(device->ValidateObject(descriptor->layout)); @@ -301,6 +302,12 @@ MaybeError ValidateBindGroupDescriptor(DeviceBase* device, const BindGroupDescri device, entry, externalTextureBindingEntry, descriptor->layout->GetExternalTextureBindingExpansionMap())); continue; + } else { + DAWN_INVALID_IF(descriptor->layout->GetExternalTextureBindingExpansionMap().count( + BindingNumber(entry.binding)), + "entries[%u] is not an ExternalTexture when the layout contains an " + "ExternalTexture entry.", + i); } const BindingInfo& bindingInfo = descriptor->layout->GetBindingInfo(bindingIndex); @@ -308,6 +315,7 @@ MaybeError ValidateBindGroupDescriptor(DeviceBase* device, const BindGroupDescri // Perform binding-type specific validation. switch (bindingInfo.bindingType) { case BindingInfoType::Buffer: + // TODO(dawn:1485): Validate buffer binding with usage validation mode. DAWN_TRY_CONTEXT(ValidateBufferBinding(device, entry, bindingInfo), "validating entries[%u] as a Buffer." "\nExpected entry layout: %s", @@ -315,7 +323,7 @@ MaybeError ValidateBindGroupDescriptor(DeviceBase* device, const BindGroupDescri break; case BindingInfoType::Texture: case BindingInfoType::StorageTexture: - DAWN_TRY_CONTEXT(ValidateTextureBinding(device, entry, bindingInfo), + DAWN_TRY_CONTEXT(ValidateTextureBinding(device, entry, bindingInfo, mode), "validating entries[%u] as a Texture." "\nExpected entry layout: %s", i, bindingInfo); diff --git a/src/dawn/native/BindGroup.h b/src/dawn/native/BindGroup.h index 236e4fb977..34c122b0c1 100644 --- a/src/dawn/native/BindGroup.h +++ b/src/dawn/native/BindGroup.h @@ -24,6 +24,7 @@ #include "dawn/native/Error.h" #include "dawn/native/Forward.h" #include "dawn/native/ObjectBase.h" +#include "dawn/native/UsageValidationMode.h" #include "dawn/native/dawn_platform.h" @@ -31,7 +32,9 @@ namespace dawn::native { class DeviceBase; -MaybeError ValidateBindGroupDescriptor(DeviceBase* device, const BindGroupDescriptor* descriptor); +MaybeError ValidateBindGroupDescriptor(DeviceBase* device, + const BindGroupDescriptor* descriptor, + UsageValidationMode mode); struct BufferBinding { BufferBase* buffer; diff --git a/src/dawn/native/Blob.cpp b/src/dawn/native/Blob.cpp new file mode 100644 index 0000000000..78b18e7d60 --- /dev/null +++ b/src/dawn/native/Blob.cpp @@ -0,0 +1,128 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "dawn/common/Assert.h" +#include "dawn/common/Math.h" +#include "dawn/native/Blob.h" +#include "dawn/native/stream/Stream.h" + +namespace dawn::native { + +Blob CreateBlob(size_t size, size_t alignment) { + ASSERT(IsPowerOfTwo(alignment)); + ASSERT(alignment != 0); + if (size > 0) { + // Allocate extra space so that there will be sufficient space for |size| even after + // the |data| pointer is aligned. + // TODO(crbug.com/dawn/824): Use aligned_alloc when possible. It should be available + // with C++17 but on macOS it also requires macOS 10.15 to work. + size_t allocatedSize = size + alignment - 1; + uint8_t* data = new uint8_t[allocatedSize]; + uint8_t* ptr = AlignPtr(data, alignment); + ASSERT(ptr + size <= data + allocatedSize); + return Blob::UnsafeCreateWithDeleter(ptr, size, [=]() { delete[] data; }); + } else { + return Blob(); + } +} + +// static +Blob Blob::UnsafeCreateWithDeleter(uint8_t* data, size_t size, std::function deleter) { + return Blob(data, size, deleter); +} + +Blob::Blob() : mData(nullptr), mSize(0), mDeleter({}) {} + +Blob::Blob(uint8_t* data, size_t size, std::function deleter) + : mData(data), mSize(size), mDeleter(std::move(deleter)) { + // It is invalid to make a blob that has null data unless its size is also zero. + ASSERT(data != nullptr || size == 0); +} + +Blob::Blob(Blob&& rhs) : mData(rhs.mData), mSize(rhs.mSize) { + mDeleter = std::move(rhs.mDeleter); + rhs.mDeleter = nullptr; +} + +Blob& Blob::operator=(Blob&& rhs) { + mData = rhs.mData; + mSize = rhs.mSize; + if (mDeleter) { + mDeleter(); + } + mDeleter = std::move(rhs.mDeleter); + rhs.mDeleter = nullptr; + return *this; +} + +Blob::~Blob() { + if (mDeleter) { + mDeleter(); + } +} + +bool Blob::Empty() const { + return mSize == 0; +} + +const uint8_t* Blob::Data() const { + return mData; +} + +uint8_t* Blob::Data() { + return mData; +} + +size_t Blob::Size() const { + return mSize; +} + +void Blob::AlignTo(size_t alignment) { + if (IsPtrAligned(mData, alignment)) { + return; + } + + Blob blob = CreateBlob(mSize, alignment); + memcpy(blob.Data(), mData, mSize); + *this = std::move(blob); +} + +template <> +void stream::Stream::Write(stream::Sink* s, const Blob& b) { + size_t size = b.Size(); + StreamIn(s, size); + if (size > 0) { + void* ptr = s->GetSpace(size); + memcpy(ptr, b.Data(), size); + } +} + +template <> +MaybeError stream::Stream::Read(stream::Source* s, Blob* b) { + size_t size; + DAWN_TRY(StreamOut(s, &size)); + if (size > 0) { + const void* ptr; + DAWN_TRY(s->Read(&ptr, size)); + *b = CreateBlob(size); + memcpy(b->Data(), ptr, size); + } else { + *b = Blob(); + } + return {}; +} + +} // namespace dawn::native diff --git a/src/dawn/native/Blob.h b/src/dawn/native/Blob.h new file mode 100644 index 0000000000..807082c728 --- /dev/null +++ b/src/dawn/native/Blob.h @@ -0,0 +1,76 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_BLOB_H_ +#define SRC_DAWN_NATIVE_BLOB_H_ + +#include +#include +#include +#include +#include + +namespace dawn::native { + +// Blob represents a block of bytes. It may be constructed from +// various other container types and uses type erasure to take +// ownership of the container and release its memory on destruction. +class Blob { + public: + // This function is used to create Blob with actual data. + // Make sure the creation and deleter handles the data ownership and lifetime correctly. + static Blob UnsafeCreateWithDeleter(uint8_t* data, size_t size, std::function deleter); + + Blob(); + ~Blob(); + + Blob(const Blob&) = delete; + Blob& operator=(const Blob&) = delete; + + Blob(Blob&&); + Blob& operator=(Blob&&); + + bool Empty() const; + const uint8_t* Data() const; + uint8_t* Data(); + size_t Size() const; + + // If the blob data is not aligned to |alignment|, copy it into a new backing store which + // is aligned. + void AlignTo(size_t alignment); + + private: + // The constructor should be responsible to take ownership of |data| and releases ownership by + // calling |deleter|. The deleter function is called at ~Blob() and during std::move. + explicit Blob(uint8_t* data, size_t size, std::function deleter); + + uint8_t* mData; + size_t mSize; + std::function mDeleter; +}; + +Blob CreateBlob(size_t size, size_t alignment = 1); + +template >> +Blob CreateBlob(std::vector vec) { + uint8_t* data = reinterpret_cast(vec.data()); + size_t size = vec.size() * sizeof(T); + // Move the vector into a new allocation so we can destruct it in the deleter. + auto* wrapped_vec = new std::vector(std::move(vec)); + return Blob::UnsafeCreateWithDeleter(data, size, [wrapped_vec]() { delete wrapped_vec; }); +} + +} // namespace dawn::native + +#endif // SRC_DAWN_NATIVE_BLOB_H_ diff --git a/src/dawn/native/BlobCache.cpp b/src/dawn/native/BlobCache.cpp index 9ec4750244..a919318420 100644 --- a/src/dawn/native/BlobCache.cpp +++ b/src/dawn/native/BlobCache.cpp @@ -14,44 +14,20 @@ #include "dawn/native/BlobCache.h" +#include + #include "dawn/common/Assert.h" +#include "dawn/common/Version_autogen.h" #include "dawn/native/CacheKey.h" #include "dawn/native/Instance.h" #include "dawn/platform/DawnPlatform.h" namespace dawn::native { -CachedBlob::CachedBlob(size_t size) { - if (size != 0) { - Reset(size); - } -} - -bool CachedBlob::Empty() const { - return mSize == 0; -} - -const uint8_t* CachedBlob::Data() const { - return mData.get(); -} - -uint8_t* CachedBlob::Data() { - return mData.get(); -} - -size_t CachedBlob::Size() const { - return mSize; -} - -void CachedBlob::Reset(size_t size) { - mSize = size; - mData = std::make_unique(size); -} - BlobCache::BlobCache(dawn::platform::CachingInterface* cachingInterface) : mCache(cachingInterface) {} -CachedBlob BlobCache::Load(const CacheKey& key) { +Blob BlobCache::Load(const CacheKey& key) { std::lock_guard lock(mMutex); return LoadInternal(key); } @@ -61,26 +37,29 @@ void BlobCache::Store(const CacheKey& key, size_t valueSize, const void* value) StoreInternal(key, valueSize, value); } -void BlobCache::Store(const CacheKey& key, const CachedBlob& value) { +void BlobCache::Store(const CacheKey& key, const Blob& value) { Store(key, value.Size(), value.Data()); } -CachedBlob BlobCache::LoadInternal(const CacheKey& key) { - CachedBlob result; +Blob BlobCache::LoadInternal(const CacheKey& key) { + ASSERT(ValidateCacheKey(key)); if (mCache == nullptr) { - return result; + return Blob(); } const size_t expectedSize = mCache->LoadData(key.data(), key.size(), nullptr, 0); if (expectedSize > 0) { - result.Reset(expectedSize); + // Need to put this inside to trigger copy elision. + Blob result = CreateBlob(expectedSize); const size_t actualSize = mCache->LoadData(key.data(), key.size(), result.Data(), expectedSize); ASSERT(expectedSize == actualSize); + return result; } - return result; + return Blob(); } void BlobCache::StoreInternal(const CacheKey& key, size_t valueSize, const void* value) { + ASSERT(ValidateCacheKey(key)); ASSERT(value != nullptr); ASSERT(valueSize > 0); if (mCache == nullptr) { @@ -89,4 +68,9 @@ void BlobCache::StoreInternal(const CacheKey& key, size_t valueSize, const void* mCache->StoreData(key.data(), key.size(), value, valueSize); } +bool BlobCache::ValidateCacheKey(const CacheKey& key) { + return std::search(key.begin(), key.end(), kDawnVersion.begin(), kDawnVersion.end()) != + key.end(); +} + } // namespace dawn::native diff --git a/src/dawn/native/BlobCache.h b/src/dawn/native/BlobCache.h index 8565429799..e3035cd862 100644 --- a/src/dawn/native/BlobCache.h +++ b/src/dawn/native/BlobCache.h @@ -15,34 +15,21 @@ #ifndef SRC_DAWN_NATIVE_BLOBCACHE_H_ #define SRC_DAWN_NATIVE_BLOBCACHE_H_ -#include #include +#include "dawn/common/Platform.h" +#include "dawn/native/Blob.h" +#include "dawn/native/CacheResult.h" + namespace dawn::platform { class CachingInterface; } namespace dawn::native { -class BlobCache; class CacheKey; class InstanceBase; -class CachedBlob { - public: - explicit CachedBlob(size_t size = 0); - - bool Empty() const; - const uint8_t* Data() const; - uint8_t* Data(); - size_t Size() const; - void Reset(size_t size); - - private: - std::unique_ptr mData = nullptr; - size_t mSize = 0; -}; - // This class should always be thread-safe because it may be called asynchronously. Its purpose // is to wrap the CachingInterface provided via a platform. class BlobCache { @@ -50,18 +37,31 @@ class BlobCache { explicit BlobCache(dawn::platform::CachingInterface* cachingInterface = nullptr); // Returns empty blob if the key is not found in the cache. - CachedBlob Load(const CacheKey& key); + Blob Load(const CacheKey& key); // Value to store must be non-empty/non-null. void Store(const CacheKey& key, size_t valueSize, const void* value); - void Store(const CacheKey& key, const CachedBlob& value); + void Store(const CacheKey& key, const Blob& value); + + // Store a CacheResult into the cache if it isn't cached yet. + // Calls T::ToBlob which should be defined elsewhere. + template + void EnsureStored(const CacheResult& cacheResult) { + if (!cacheResult.IsCached()) { + Store(cacheResult.GetCacheKey(), cacheResult->ToBlob()); + } + } private: // Non-thread safe internal implementations of load and store. Exposed callers that use // these helpers need to make sure that these are entered with `mMutex` held. - CachedBlob LoadInternal(const CacheKey& key); + Blob LoadInternal(const CacheKey& key); void StoreInternal(const CacheKey& key, size_t valueSize, const void* value); + // Validates the cache key for this version of Dawn. At the moment, this is naively checking + // that the cache key contains the dawn version string in it. + bool ValidateCacheKey(const CacheKey& key); + // Protects thread safety of access to mCache. std::mutex mMutex; dawn::platform::CachingInterface* mCache; diff --git a/src/dawn/native/BuddyMemoryAllocator.cpp b/src/dawn/native/BuddyMemoryAllocator.cpp index d21ecf1ab3..f744440f3a 100644 --- a/src/dawn/native/BuddyMemoryAllocator.cpp +++ b/src/dawn/native/BuddyMemoryAllocator.cpp @@ -34,6 +34,8 @@ BuddyMemoryAllocator::BuddyMemoryAllocator(uint64_t maxSystemSize, mTrackedSubAllocations.resize(maxSystemSize / mMemoryBlockSize); } +BuddyMemoryAllocator::~BuddyMemoryAllocator() = default; + uint64_t BuddyMemoryAllocator::GetMemoryIndex(uint64_t offset) const { ASSERT(offset != BuddyAllocator::kInvalidOffset); return offset / mMemoryBlockSize; diff --git a/src/dawn/native/BuddyMemoryAllocator.h b/src/dawn/native/BuddyMemoryAllocator.h index a58cbaecbc..adbcc96074 100644 --- a/src/dawn/native/BuddyMemoryAllocator.h +++ b/src/dawn/native/BuddyMemoryAllocator.h @@ -42,7 +42,7 @@ class BuddyMemoryAllocator { BuddyMemoryAllocator(uint64_t maxSystemSize, uint64_t memoryBlockSize, ResourceHeapAllocator* heapAllocator); - ~BuddyMemoryAllocator() = default; + ~BuddyMemoryAllocator(); ResultOrError Allocate(uint64_t allocationSize, uint64_t alignment); void Deallocate(const ResourceMemoryAllocation& allocation); diff --git a/src/dawn/native/Buffer.cpp b/src/dawn/native/Buffer.cpp index 80e905b00f..b9b2e3dbb0 100644 --- a/src/dawn/native/Buffer.cpp +++ b/src/dawn/native/Buffer.cpp @@ -158,7 +158,10 @@ BufferBase::BufferBase(DeviceBase* device, const BufferDescriptor* descriptor) BufferBase::BufferBase(DeviceBase* device, const BufferDescriptor* descriptor, ObjectBase::ErrorTag tag) - : ApiObjectBase(device, tag), mSize(descriptor->size), mState(BufferState::Unmapped) { + : ApiObjectBase(device, tag), + mSize(descriptor->size), + mUsage(descriptor->usage), + mState(BufferState::Unmapped) { if (descriptor->mappedAtCreation) { mState = BufferState::MappedAtCreation; mMapOffset = 0; @@ -215,9 +218,14 @@ wgpu::BufferUsage BufferBase::GetUsage() const { } wgpu::BufferUsage BufferBase::GetUsageExternalOnly() const { + ASSERT(!IsError()); return GetUsage() & ~kAllInternalBufferUsages; } +wgpu::BufferUsage BufferBase::APIGetUsage() const { + return mUsage & ~kAllInternalBufferUsages; +} + MaybeError BufferBase::MapAtCreation() { DAWN_TRY(MapAtCreationInternal()); @@ -378,6 +386,10 @@ void BufferBase::APIDestroy() { Destroy(); } +uint64_t BufferBase::APIGetSize() const { + return mSize; +} + MaybeError BufferBase::CopyFromStagingBuffer() { ASSERT(mStagingBuffer); if (mSize == 0) { diff --git a/src/dawn/native/Buffer.h b/src/dawn/native/Buffer.h index e5c6150584..6bb1503340 100644 --- a/src/dawn/native/Buffer.h +++ b/src/dawn/native/Buffer.h @@ -48,8 +48,6 @@ class BufferBase : public ApiObjectBase { MappedAtCreation, Destroyed, }; - BufferBase(DeviceBase* device, const BufferDescriptor* descriptor); - static BufferBase* MakeError(DeviceBase* device, const BufferDescriptor* descriptor); ObjectType GetType() const override; @@ -86,12 +84,15 @@ class BufferBase : public ApiObjectBase { const void* APIGetConstMappedRange(size_t offset, size_t size); void APIUnmap(); void APIDestroy(); + wgpu::BufferUsage APIGetUsage() const; + uint64_t APIGetSize() const; protected: + BufferBase(DeviceBase* device, const BufferDescriptor* descriptor); BufferBase(DeviceBase* device, const BufferDescriptor* descriptor, ObjectBase::ErrorTag tag); - // Constructor used only for mocking and testing. BufferBase(DeviceBase* device, BufferState state); + void DestroyImpl() override; ~BufferBase() override; diff --git a/src/dawn/native/CMakeLists.txt b/src/dawn/native/CMakeLists.txt index 72a520130b..9f95fa49a9 100644 --- a/src/dawn/native/CMakeLists.txt +++ b/src/dawn/native/CMakeLists.txt @@ -32,6 +32,8 @@ target_sources(dawn_native PRIVATE ${DAWN_NATIVE_UTILS_GEN_SOURCES} "Adapter.cpp" "Adapter.h" + "ApplyClearColorValueWithDrawHelper.cpp" + "ApplyClearColorValueWithDrawHelper.h" "AsyncTask.cpp" "AsyncTask.h" "AttachmentState.cpp" @@ -45,6 +47,8 @@ target_sources(dawn_native PRIVATE "BindGroupTracker.h" "BindingInfo.cpp" "BindingInfo.h" + "Blob.cpp" + "Blob.h" "BlobCache.cpp" "BlobCache.h" "BuddyAllocator.cpp" @@ -57,6 +61,9 @@ target_sources(dawn_native PRIVATE "CachedObject.h" "CacheKey.cpp" "CacheKey.h" + "CacheRequest.cpp" + "CacheRequest.h" + "CacheResult.h" "CallbackTaskManager.cpp" "CallbackTaskManager.h" "CommandAllocator.cpp" @@ -119,6 +126,7 @@ target_sources(dawn_native PRIVATE "Limits.h" "ObjectBase.cpp" "ObjectBase.h" + "PassResourceUsage.cpp" "PassResourceUsage.h" "PassResourceUsageTracker.cpp" "PassResourceUsageTracker.h" @@ -140,6 +148,8 @@ target_sources(dawn_native PRIVATE "QuerySet.h" "Queue.cpp" "Queue.h" + "RefCountedWithExternalCount.cpp" + "RefCountedWithExternalCount.h" "RenderBundle.cpp" "RenderBundle.h" "RenderBundleEncoder.cpp" @@ -160,10 +170,12 @@ target_sources(dawn_native PRIVATE "Sampler.h" "ScratchBuffer.cpp" "ScratchBuffer.h" + "Serializable.h" "ShaderModule.cpp" "ShaderModule.h" "StagingBuffer.cpp" "StagingBuffer.h" + "StreamImplTint.cpp" "Subresource.cpp" "Subresource.h" "SubresourceStorage.h" @@ -178,11 +190,21 @@ target_sources(dawn_native PRIVATE "ToBackend.h" "Toggles.cpp" "Toggles.h" + "UsageValidationMode.h" "VertexFormat.cpp" "VertexFormat.h" + "VisitableMembers.h" "dawn_platform.h" "webgpu_absl_format.cpp" "webgpu_absl_format.h" + "stream/BlobSource.cpp" + "stream/BlobSource.h" + "stream/ByteVectorSink.cpp" + "stream/ByteVectorSink.h" + "stream/Sink.h" + "stream/Source.h" + "stream/Stream.cpp" + "stream/Stream.h" "utils/WGPUHelpers.cpp" "utils/WGPUHelpers.h" ) @@ -238,6 +260,8 @@ if (DAWN_ENABLE_D3D12) "d3d12/BindGroupD3D12.h" "d3d12/BindGroupLayoutD3D12.cpp" "d3d12/BindGroupLayoutD3D12.h" + "d3d12/BlobD3D12.cpp" + "d3d12/BlobD3D12.h" "d3d12/BufferD3D12.cpp" "d3d12/BufferD3D12.h" "d3d12/CPUDescriptorHeapAllocationD3D12.cpp" @@ -258,6 +282,8 @@ if (DAWN_ENABLE_D3D12) "d3d12/D3D12Info.h" "d3d12/DeviceD3D12.cpp" "d3d12/DeviceD3D12.h" + "d3d12/ExternalImageDXGIImpl.cpp" + "d3d12/ExternalImageDXGIImpl.h" "d3d12/Forward.h" "d3d12/GPUDescriptorHeapAllocationD3D12.cpp" "d3d12/GPUDescriptorHeapAllocationD3D12.h" @@ -300,6 +326,7 @@ if (DAWN_ENABLE_D3D12) "d3d12/StagingBufferD3D12.h" "d3d12/StagingDescriptorAllocatorD3D12.cpp" "d3d12/StagingDescriptorAllocatorD3D12.h" + "d3d12/StreamImplD3D12.cpp" "d3d12/SwapChainD3D12.cpp" "d3d12/SwapChainD3D12.h" "d3d12/TextureCopySplitter.cpp" @@ -401,6 +428,8 @@ if (DAWN_ENABLE_OPENGL) target_sources(dawn_native PRIVATE "${DAWN_INCLUDE_DIR}/dawn/native/OpenGLBackend.h" ${DAWN_NATIVE_OPENGL_AUTOGEN_SOURCES} + "opengl/AdapterGL.cpp" + "opengl/AdapterGL.h" "opengl/BackendGL.cpp" "opengl/BackendGL.h" "opengl/BindGroupGL.cpp" @@ -413,8 +442,12 @@ if (DAWN_ENABLE_OPENGL) "opengl/CommandBufferGL.h" "opengl/ComputePipelineGL.cpp" "opengl/ComputePipelineGL.h" + "opengl/ContextEGL.cpp" + "opengl/ContextEGL.h" "opengl/DeviceGL.cpp" "opengl/DeviceGL.h" + "opengl/EGLFunctions.cpp" + "opengl/EGLFunctions.h" "opengl/Forward.h" "opengl/GLFormat.cpp" "opengl/GLFormat.h" @@ -444,11 +477,14 @@ if (DAWN_ENABLE_OPENGL) "opengl/SwapChainGL.h" "opengl/TextureGL.cpp" "opengl/TextureGL.h" + "opengl/UtilsEGL.cpp" + "opengl/UtilsEGL.h" "opengl/UtilsGL.cpp" "opengl/UtilsGL.h" "opengl/opengl_platform.h" ) + target_include_directories(dawn_native PRIVATE ${DAWN_KHRONOS_DIR}) target_link_libraries(dawn_native PRIVATE dawn_khronos_platform) endif() @@ -469,8 +505,6 @@ if (DAWN_ENABLE_VULKAN) "vulkan/BindGroupVk.h" "vulkan/BufferVk.cpp" "vulkan/BufferVk.h" - "vulkan/CacheKeyVk.cpp" - "vulkan/CacheKeyVk.h" "vulkan/CommandBufferVk.cpp" "vulkan/CommandBufferVk.h" "vulkan/CommandRecordingContext.h" @@ -509,6 +543,7 @@ if (DAWN_ENABLE_VULKAN) "vulkan/ShaderModuleVk.h" "vulkan/StagingBufferVk.cpp" "vulkan/StagingBufferVk.h" + "vulkan/StreamImplVk.cpp" "vulkan/SwapChainVk.cpp" "vulkan/SwapChainVk.h" "vulkan/TextureVk.cpp" @@ -570,6 +605,7 @@ DawnJSONGenerator( add_library(webgpu_dawn ${DAWN_PLACEHOLDER_FILE}) common_compile_options(webgpu_dawn) target_link_libraries(webgpu_dawn PRIVATE dawn_native) +target_link_libraries(webgpu_dawn PUBLIC dawn_headers) target_compile_definitions(webgpu_dawn PRIVATE "WGPU_IMPLEMENTATION") if(BUILD_SHARED_LIBS) target_compile_definitions(webgpu_dawn PRIVATE "WGPU_SHARED_LIBRARY") diff --git a/src/dawn/native/CacheKey.cpp b/src/dawn/native/CacheKey.cpp index 495b013ed9..de1a75e3b8 100644 --- a/src/dawn/native/CacheKey.cpp +++ b/src/dawn/native/CacheKey.cpp @@ -14,30 +14,11 @@ #include "dawn/native/CacheKey.h" -#include - namespace dawn::native { -std::ostream& operator<<(std::ostream& os, const CacheKey& key) { - os << std::hex; - for (const int b : key) { - os << std::setfill('0') << std::setw(2) << b << " "; - } - os << std::dec; - return os; -} - template <> -void CacheKeySerializer::Serialize(CacheKey* key, const std::string& t) { - key->Record(static_cast(t.length())); - key->insert(key->end(), t.begin(), t.end()); -} - -template <> -void CacheKeySerializer::Serialize(CacheKey* key, const CacheKey& t) { - // For nested cache keys, we do not record the length, and just copy the key so that it - // appears we just flatten the keys into a single key. - key->insert(key->end(), t.begin(), t.end()); +void stream::Stream::Write(stream::Sink* sink, const CacheKey& t) { + StreamIn(sink, static_cast(t)); } } // namespace dawn::native diff --git a/src/dawn/native/CacheKey.h b/src/dawn/native/CacheKey.h index 357ce4b325..6cec3b6b8f 100644 --- a/src/dawn/native/CacheKey.h +++ b/src/dawn/native/CacheKey.h @@ -15,187 +15,41 @@ #ifndef SRC_DAWN_NATIVE_CACHEKEY_H_ #define SRC_DAWN_NATIVE_CACHEKEY_H_ -#include -#include -#include -#include -#include -#include +#include -#include "dawn/common/TypedInteger.h" -#include "dawn/common/ityp_array.h" +#include "dawn/native/stream/ByteVectorSink.h" +#include "dawn/native/stream/Stream.h" namespace dawn::native { -// Forward declare classes because of co-dependency. -class CacheKey; -class CachedObject; - -// Stream operator for CacheKey for debugging. -std::ostream& operator<<(std::ostream& os, const CacheKey& key); - -// Overridable serializer struct that should be implemented for cache key serializable -// types/classes. -template -class CacheKeySerializer { +class CacheKey : public stream::ByteVectorSink { public: - static void Serialize(CacheKey* key, const T& t); -}; - -class CacheKey : public std::vector { - public: - using std::vector::vector; + using stream::ByteVectorSink::ByteVectorSink; enum class Type { ComputePipeline, RenderPipeline, Shader }; template - CacheKey& Record(const T& t) { - CacheKeySerializer::Serialize(this, t); - return *this; - } - template - CacheKey& Record(const T& t, const Args&... args) { - CacheKeySerializer::Serialize(this, t); - return Record(args...); - } + class UnsafeUnkeyedValue { + public: + UnsafeUnkeyedValue() = default; + // NOLINTNEXTLINE(runtime/explicit) allow implicit construction to decrease verbosity + UnsafeUnkeyedValue(T&& value) : mValue(std::forward(value)) {} - // Records iterables by prepending the number of elements. Some common iterables are have a - // CacheKeySerializer implemented to avoid needing to split them out when recording, i.e. - // strings and CacheKeys, but they fundamentally do the same as this function. - template - CacheKey& RecordIterable(const IterableT& iterable) { - // Always record the size of generic iterables as a size_t for now. - Record(static_cast(iterable.size())); - for (auto it = iterable.begin(); it != iterable.end(); ++it) { - Record(*it); - } - return *this; - } - template - CacheKey& RecordIterable(const ityp::array& iterable) { - Record(static_cast(iterable.size())); - for (auto it = iterable.begin(); it != iterable.end(); ++it) { - Record(*it); - } - return *this; - } - template - CacheKey& RecordIterable(const Ptr* ptr, size_t n) { - Record(n); - for (size_t i = 0; i < n; ++i) { - Record(ptr[i]); - } - return *this; - } + const T& UnsafeGetValue() const { return mValue; } + + // Friend definition of StreamIn which can be found by ADL to override + // stream::StreamIn. + friend constexpr void StreamIn(stream::Sink*, const UnsafeUnkeyedValue&) {} + + private: + T mValue; + }; }; -// Specialized overload for fundamental types. template -class CacheKeySerializer>> { - public: - static void Serialize(CacheKey* key, const T t) { - const char* it = reinterpret_cast(&t); - key->insert(key->end(), it, (it + sizeof(T))); - } -}; - -// Specialized overload for bitsets that are smaller than 64. -template -class CacheKeySerializer, std::enable_if_t<(N <= 64)>> { - public: - static void Serialize(CacheKey* key, const std::bitset& t) { key->Record(t.to_ullong()); } -}; - -// Specialized overload for bitsets since using the built-in to_ullong have a size limit. -template -class CacheKeySerializer, std::enable_if_t<(N > 64)>> { - public: - static void Serialize(CacheKey* key, const std::bitset& t) { - // Serializes the bitset into series of uint8_t, along with recording the size. - static_assert(N > 0); - key->Record(static_cast(N)); - uint8_t value = 0; - for (size_t i = 0; i < N; i++) { - value <<= 1; - // Explicitly convert to numeric since MSVC doesn't like mixing of bools. - value |= t[i] ? 1 : 0; - if (i % 8 == 7) { - // Whenever we fill an 8 bit value, record it and zero it out. - key->Record(value); - value = 0; - } - } - // Serialize the last value if we are not a multiple of 8. - if (N % 8 != 0) { - key->Record(value); - } - } -}; - -// Specialized overload for enums. -template -class CacheKeySerializer>> { - public: - static void Serialize(CacheKey* key, const T t) { - CacheKeySerializer>::Serialize( - key, static_cast>(t)); - } -}; - -// Specialized overload for TypedInteger. -template -class CacheKeySerializer<::detail::TypedIntegerImpl> { - public: - static void Serialize(CacheKey* key, const ::detail::TypedIntegerImpl t) { - CacheKeySerializer::Serialize(key, static_cast(t)); - } -}; - -// Specialized overload for pointers. Since we are serializing for a cache key, we always -// serialize via value, not by pointer. To handle nullptr scenarios, we always serialize whether -// the pointer was nullptr followed by the contents if applicable. -template -class CacheKeySerializer>> { - public: - static void Serialize(CacheKey* key, const T t) { - key->Record(t == nullptr); - if (t != nullptr) { - CacheKeySerializer>>::Serialize(key, *t); - } - } -}; - -// Specialized overload for fixed arrays of primitives. -template -class CacheKeySerializer>> { - public: - static void Serialize(CacheKey* key, const T (&t)[N]) { - static_assert(N > 0); - key->Record(static_cast(N)); - const char* it = reinterpret_cast(t); - key->insert(key->end(), it, it + sizeof(t)); - } -}; - -// Specialized overload for fixed arrays of non-primitives. -template -class CacheKeySerializer>> { - public: - static void Serialize(CacheKey* key, const T (&t)[N]) { - static_assert(N > 0); - key->Record(static_cast(N)); - for (size_t i = 0; i < N; i++) { - key->Record(t[i]); - } - } -}; - -// Specialized overload for CachedObjects. -template -class CacheKeySerializer>> { - public: - static void Serialize(CacheKey* key, const T& t) { key->Record(t.GetCacheKey()); } -}; +CacheKey::UnsafeUnkeyedValue UnsafeUnkeyedValue(T&& value) { + return CacheKey::UnsafeUnkeyedValue(std::forward(value)); +} } // namespace dawn::native diff --git a/src/dawn/native/CacheRequest.cpp b/src/dawn/native/CacheRequest.cpp new file mode 100644 index 0000000000..2b35b1224d --- /dev/null +++ b/src/dawn/native/CacheRequest.cpp @@ -0,0 +1,25 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/CacheRequest.h" + +#include "dawn/common/Log.h" + +namespace dawn::native::detail { + +void LogCacheHitError(std::unique_ptr error) { + dawn::ErrorLog() << error->GetFormattedMessage(); +} + +} // namespace dawn::native::detail diff --git a/src/dawn/native/CacheRequest.h b/src/dawn/native/CacheRequest.h new file mode 100644 index 0000000000..cdaa117494 --- /dev/null +++ b/src/dawn/native/CacheRequest.h @@ -0,0 +1,193 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_CACHEREQUEST_H_ +#define SRC_DAWN_NATIVE_CACHEREQUEST_H_ + +#include +#include + +#include "dawn/common/Assert.h" +#include "dawn/common/Compiler.h" +#include "dawn/native/Blob.h" +#include "dawn/native/BlobCache.h" +#include "dawn/native/CacheKey.h" +#include "dawn/native/CacheResult.h" +#include "dawn/native/Device.h" +#include "dawn/native/Error.h" +#include "dawn/native/VisitableMembers.h" + +namespace dawn::native { + +namespace detail { + +template +struct UnwrapResultOrError { + using type = T; +}; + +template +struct UnwrapResultOrError> { + using type = T; +}; + +template +struct IsResultOrError { + static constexpr bool value = false; +}; + +template +struct IsResultOrError> { + static constexpr bool value = true; +}; + +void LogCacheHitError(std::unique_ptr error); + +} // namespace detail + +// Implementation of a CacheRequest which provides a LoadOrRun friend function which can be found +// via argument-dependent lookup. So, it doesn't need to be called with a fully qualified function +// name. +// +// Example usage: +// Request r = { ... }; +// ResultOrError> cacheResult = +// LoadOrRun(device, std::move(r), +// [](Blob blob) -> T { /* handle cache hit */ }, +// [](Request r) -> ResultOrError { /* handle cache miss */ } +// ); +// Or with free functions: +/// T OnCacheHit(Blob blob) { ... } +// ResultOrError OnCacheMiss(Request r) { ... } +// // ... +// Request r = { ... }; +// auto result = LoadOrRun(device, std::move(r), OnCacheHit, OnCacheMiss); +// +// LoadOrRun generates a CacheKey from the request and loads from the device's BlobCache. On cache +// hit, calls CacheHitFn and returns a CacheResult. On cache miss or if CacheHitFn returned an +// Error, calls CacheMissFn -> ResultOrError with the request data and returns a +// ResultOrError>. CacheHitFn must return the same unwrapped type as CacheMissFn. +// i.e. it doesn't need to be wrapped in ResultOrError. +// +// CacheMissFn may not have any additional data bound to it. It may not be a lambda or std::function +// which captures additional information, so it can only operate on the request data. This is +// enforced with a compile-time static_assert, and ensures that the result created from the +// computation is exactly the data included in the CacheKey. +template +class CacheRequestImpl { + public: + CacheRequestImpl() = default; + + // Require CacheRequests to be move-only to avoid unnecessary copies. + CacheRequestImpl(CacheRequestImpl&&) = default; + CacheRequestImpl& operator=(CacheRequestImpl&&) = default; + CacheRequestImpl(const CacheRequestImpl&) = delete; + CacheRequestImpl& operator=(const CacheRequestImpl&) = delete; + + // Create a CacheKey from the request type and all members + CacheKey CreateCacheKey(const DeviceBase* device) const { + CacheKey key = device->GetCacheKey(); + StreamIn(&key, Request::kName); + static_cast(this)->VisitAll( + [&](const auto&... members) { StreamIn(&key, members...); }); + return key; + } + + template + friend auto LoadOrRun(DeviceBase* device, + Request&& r, + CacheHitFn cacheHitFn, + CacheMissFn cacheMissFn) { + // Get return types and check that CacheMissReturnType can be cast to a raw function + // pointer. This means it's not a std::function or lambda that captures additional data. + using CacheHitReturnType = decltype(cacheHitFn(std::declval())); + using CacheMissReturnType = decltype(cacheMissFn(std::declval())); + static_assert( + std::is_convertible_v, + "CacheMissFn function signature does not match, or it is not a free function."); + + static_assert(detail::IsResultOrError::value, + "CacheMissFn should return a ResultOrError."); + using UnwrappedReturnType = typename detail::UnwrapResultOrError::type; + + static_assert(std::is_same_v::type, + UnwrappedReturnType>, + "If CacheMissFn returns T, CacheHitFn must return T or ResultOrError."); + + using CacheResultType = CacheResult; + using ReturnType = ResultOrError; + + CacheKey key = r.CreateCacheKey(device); + BlobCache* cache = device->GetBlobCache(); + Blob blob; + if (cache != nullptr) { + blob = cache->Load(key); + } + + if (!blob.Empty()) { + // Cache hit. Handle the cached blob. + auto result = cacheHitFn(std::move(blob)); + + if constexpr (!detail::IsResultOrError::value) { + // If the result type is not a ResultOrError, return it. + return ReturnType(CacheResultType::CacheHit(std::move(key), std::move(result))); + } else { + // Otherwise, if the value is a success, also return it. + if (DAWN_LIKELY(result.IsSuccess())) { + return ReturnType( + CacheResultType::CacheHit(std::move(key), result.AcquireSuccess())); + } + // On error, continue to the cache miss path and log the error. + detail::LogCacheHitError(result.AcquireError()); + } + } + // Cache miss, or the CacheHitFn failed. + auto result = cacheMissFn(std::move(r)); + if (DAWN_LIKELY(result.IsSuccess())) { + return ReturnType(CacheResultType::CacheMiss(std::move(key), result.AcquireSuccess())); + } + return ReturnType(result.AcquireError()); + } +}; + +} // namespace dawn::native + +// Helper for X macro to declare a struct member. +#define DAWN_INTERNAL_CACHE_REQUEST_DECL_STRUCT_MEMBER(type, name) type name{}; + +// Helper for X macro for recording cache request fields into a CacheKey. +#define DAWN_INTERNAL_CACHE_REQUEST_RECORD_KEY(type, name) StreamIn(&key, name); + +// Helper X macro to define a CacheRequest struct. +// Example usage: +// #define REQUEST_MEMBERS(X) \ +// X(int, a) \ +// X(float, b) \ +// X(Foo, foo) \ +// X(Bar, bar) +// DAWN_MAKE_CACHE_REQUEST(MyCacheRequest, REQUEST_MEMBERS) +// #undef REQUEST_MEMBERS +#define DAWN_MAKE_CACHE_REQUEST(Request, MEMBERS) \ + class Request : public ::dawn::native::CacheRequestImpl { \ + public: \ + static constexpr char kName[] = #Request; \ + Request() = default; \ + DAWN_VISITABLE_MEMBERS(MEMBERS) \ + } + +// Helper macro for the common pattern of DAWN_TRY_ASSIGN around LoadOrRun. +// Requires an #include of dawn/native/Error.h +#define DAWN_TRY_LOAD_OR_RUN(var, ...) DAWN_TRY_ASSIGN(var, LoadOrRun(__VA_ARGS__)) + +#endif // SRC_DAWN_NATIVE_CACHEREQUEST_H_ diff --git a/src/dawn/native/CacheResult.h b/src/dawn/native/CacheResult.h new file mode 100644 index 0000000000..138d9f8151 --- /dev/null +++ b/src/dawn/native/CacheResult.h @@ -0,0 +1,77 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_CACHERESULT_H_ +#define SRC_DAWN_NATIVE_CACHERESULT_H_ + +#include +#include + +#include "dawn/common/Assert.h" +#include "dawn/native/CacheKey.h" + +namespace dawn::native { + +template +class CacheResult { + public: + static CacheResult CacheHit(CacheKey key, T value) { + return CacheResult(std::move(key), std::move(value), true); + } + + static CacheResult CacheMiss(CacheKey key, T value) { + return CacheResult(std::move(key), std::move(value), false); + } + + CacheResult() : mKey(), mValue(), mIsCached(false), mIsValid(false) {} + + bool IsCached() const { + ASSERT(mIsValid); + return mIsCached; + } + const CacheKey& GetCacheKey() const { + ASSERT(mIsValid); + return mKey; + } + + // Note: Getting mValue is always const, since mutating it would invalidate consistency with + // mKey. + const T* operator->() const { + ASSERT(mIsValid); + return &mValue; + } + const T& operator*() const { + ASSERT(mIsValid); + return mValue; + } + + T Acquire() { + ASSERT(mIsValid); + mIsValid = false; + return std::move(mValue); + } + + private: + CacheResult(CacheKey key, T value, bool isCached) + : mKey(std::move(key)), mValue(std::move(value)), mIsCached(isCached), mIsValid(true) {} + + CacheKey mKey; + T mValue; + bool mIsCached; + bool mIsValid; +}; + +} // namespace dawn::native + +#endif // SRC_DAWN_NATIVE_CACHERESULT_H_ diff --git a/src/dawn/native/CachedObject.cpp b/src/dawn/native/CachedObject.cpp index 5fa6a0affd..249b0d6b37 100644 --- a/src/dawn/native/CachedObject.cpp +++ b/src/dawn/native/CachedObject.cpp @@ -46,4 +46,10 @@ const CacheKey& CachedObject::GetCacheKey() const { return mCacheKey; } +// static +template <> +void stream::Stream::Write(stream::Sink* sink, const CachedObject& obj) { + StreamIn(sink, obj.GetCacheKey()); +} + } // namespace dawn::native diff --git a/src/dawn/native/CallbackTaskManager.cpp b/src/dawn/native/CallbackTaskManager.cpp index 40146f87cf..51a9b86b61 100644 --- a/src/dawn/native/CallbackTaskManager.cpp +++ b/src/dawn/native/CallbackTaskManager.cpp @@ -18,6 +18,10 @@ namespace dawn::native { +CallbackTaskManager::CallbackTaskManager() = default; + +CallbackTaskManager::~CallbackTaskManager() = default; + bool CallbackTaskManager::IsEmpty() { std::lock_guard lock(mCallbackTaskQueueMutex); return mCallbackTaskQueue.empty(); diff --git a/src/dawn/native/CallbackTaskManager.h b/src/dawn/native/CallbackTaskManager.h index 479ba01ff0..aceea0a49e 100644 --- a/src/dawn/native/CallbackTaskManager.h +++ b/src/dawn/native/CallbackTaskManager.h @@ -31,6 +31,9 @@ struct CallbackTask { class CallbackTaskManager { public: + CallbackTaskManager(); + ~CallbackTaskManager(); + void AddCallbackTask(std::unique_ptr callbackTask); bool IsEmpty(); std::vector> AcquireCallbackTasks(); diff --git a/src/dawn/native/CommandBuffer.cpp b/src/dawn/native/CommandBuffer.cpp index b5ae04a07e..ab22dea037 100644 --- a/src/dawn/native/CommandBuffer.cpp +++ b/src/dawn/native/CommandBuffer.cpp @@ -73,7 +73,7 @@ CommandIterator* CommandBufferBase::GetCommandIteratorForTesting() { bool IsCompleteSubresourceCopiedTo(const TextureBase* texture, const Extent3D copySize, const uint32_t mipLevel) { - Extent3D extent = texture->GetMipLevelPhysicalSize(mipLevel); + Extent3D extent = texture->GetMipLevelSingleSubresourcePhysicalSize(mipLevel); switch (texture->GetDimension()) { case wgpu::TextureDimension::e1D: diff --git a/src/dawn/native/CommandBufferStateTracker.cpp b/src/dawn/native/CommandBufferStateTracker.cpp index b0624a3fcf..3a213fe48b 100644 --- a/src/dawn/native/CommandBufferStateTracker.cpp +++ b/src/dawn/native/CommandBufferStateTracker.cpp @@ -70,6 +70,20 @@ static constexpr CommandBufferStateTracker::ValidationAspects kLazyAspects = 1 << VALIDATION_ASPECT_BIND_GROUPS | 1 << VALIDATION_ASPECT_VERTEX_BUFFERS | 1 << VALIDATION_ASPECT_INDEX_BUFFER; +CommandBufferStateTracker::CommandBufferStateTracker() = default; + +CommandBufferStateTracker::CommandBufferStateTracker(const CommandBufferStateTracker&) = default; + +CommandBufferStateTracker::CommandBufferStateTracker(CommandBufferStateTracker&&) = default; + +CommandBufferStateTracker::~CommandBufferStateTracker() = default; + +CommandBufferStateTracker& CommandBufferStateTracker::operator=(const CommandBufferStateTracker&) = + default; + +CommandBufferStateTracker& CommandBufferStateTracker::operator=(CommandBufferStateTracker&&) = + default; + MaybeError CommandBufferStateTracker::ValidateCanDispatch() { return ValidateOperation(kDispatchAspects); } @@ -84,6 +98,13 @@ MaybeError CommandBufferStateTracker::ValidateCanDrawIndexed() { MaybeError CommandBufferStateTracker::ValidateBufferInRangeForVertexBuffer(uint32_t vertexCount, uint32_t firstVertex) { + uint64_t strideCount = static_cast(firstVertex) + vertexCount; + + if (strideCount == 0) { + // All vertex step mode buffers are always in range if stride count is zero + return {}; + } + RenderPipelineBase* lastRenderPipeline = GetRenderPipeline(); const ityp::bitset& vertexBufferSlotsUsedAsVertexBuffer = @@ -101,23 +122,21 @@ MaybeError CommandBufferStateTracker::ValidateBufferInRangeForVertexBuffer(uint3 bufferSize, static_cast(usedSlotVertex), vertexBuffer.usedBytesInStride); } else { - uint64_t strideCount = static_cast(firstVertex) + vertexCount; - if (strideCount != 0u) { - uint64_t requiredSize = (strideCount - 1u) * arrayStride + vertexBuffer.lastStride; - // firstVertex and vertexCount are in uint32_t, - // arrayStride must not be larger than kMaxVertexBufferArrayStride, which is - // currently 2048, and vertexBuffer.lastStride = max(attribute.offset + - // sizeof(attribute.format)) with attribute.offset being no larger than - // kMaxVertexBufferArrayStride, so by doing checks in uint64_t we avoid - // overflows. - DAWN_INVALID_IF( - requiredSize > bufferSize, - "Vertex range (first: %u, count: %u) requires a larger buffer (%u) than " - "the " - "bound buffer size (%u) of the vertex buffer at slot %u with stride %u.", - firstVertex, vertexCount, requiredSize, bufferSize, - static_cast(usedSlotVertex), arrayStride); - } + DAWN_ASSERT(strideCount != 0u); + uint64_t requiredSize = (strideCount - 1u) * arrayStride + vertexBuffer.lastStride; + // firstVertex and vertexCount are in uint32_t, + // arrayStride must not be larger than kMaxVertexBufferArrayStride, which is + // currently 2048, and vertexBuffer.lastStride = max(attribute.offset + + // sizeof(attribute.format)) with attribute.offset being no larger than + // kMaxVertexBufferArrayStride, so by doing checks in uint64_t we avoid + // overflows. + DAWN_INVALID_IF( + requiredSize > bufferSize, + "Vertex range (first: %u, count: %u) requires a larger buffer (%u) than " + "the " + "bound buffer size (%u) of the vertex buffer at slot %u with stride %u.", + firstVertex, vertexCount, requiredSize, bufferSize, + static_cast(usedSlotVertex), arrayStride); } } @@ -127,6 +146,13 @@ MaybeError CommandBufferStateTracker::ValidateBufferInRangeForVertexBuffer(uint3 MaybeError CommandBufferStateTracker::ValidateBufferInRangeForInstanceBuffer( uint32_t instanceCount, uint32_t firstInstance) { + uint64_t strideCount = static_cast(firstInstance) + instanceCount; + + if (strideCount == 0) { + // All instance step mode buffers are always in range if stride count is zero + return {}; + } + RenderPipelineBase* lastRenderPipeline = GetRenderPipeline(); const ityp::bitset& vertexBufferSlotsUsedAsInstanceBuffer = @@ -144,23 +170,21 @@ MaybeError CommandBufferStateTracker::ValidateBufferInRangeForInstanceBuffer( bufferSize, static_cast(usedSlotInstance), vertexBuffer.usedBytesInStride); } else { - uint64_t strideCount = static_cast(firstInstance) + instanceCount; - if (strideCount != 0u) { - uint64_t requiredSize = (strideCount - 1u) * arrayStride + vertexBuffer.lastStride; - // firstInstance and instanceCount are in uint32_t, - // arrayStride must not be larger than kMaxVertexBufferArrayStride, which is - // currently 2048, and vertexBuffer.lastStride = max(attribute.offset + - // sizeof(attribute.format)) with attribute.offset being no larger than - // kMaxVertexBufferArrayStride, so by doing checks in uint64_t we avoid - // overflows. - DAWN_INVALID_IF( - requiredSize > bufferSize, - "Instance range (first: %u, count: %u) requires a larger buffer (%u) than " - "the " - "bound buffer size (%u) of the vertex buffer at slot %u with stride %u.", - firstInstance, instanceCount, requiredSize, bufferSize, - static_cast(usedSlotInstance), arrayStride); - } + DAWN_ASSERT(strideCount != 0u); + uint64_t requiredSize = (strideCount - 1u) * arrayStride + vertexBuffer.lastStride; + // firstInstance and instanceCount are in uint32_t, + // arrayStride must not be larger than kMaxVertexBufferArrayStride, which is + // currently 2048, and vertexBuffer.lastStride = max(attribute.offset + + // sizeof(attribute.format)) with attribute.offset being no larger than + // kMaxVertexBufferArrayStride, so by doing checks in uint64_t we avoid + // overflows. + DAWN_INVALID_IF( + requiredSize > bufferSize, + "Instance range (first: %u, count: %u) requires a larger buffer (%u) than " + "the " + "bound buffer size (%u) of the vertex buffer at slot %u with stride %u.", + firstInstance, instanceCount, requiredSize, bufferSize, + static_cast(usedSlotInstance), arrayStride); } } diff --git a/src/dawn/native/CommandBufferStateTracker.h b/src/dawn/native/CommandBufferStateTracker.h index a29d8d19ae..43ac23834b 100644 --- a/src/dawn/native/CommandBufferStateTracker.h +++ b/src/dawn/native/CommandBufferStateTracker.h @@ -28,6 +28,14 @@ namespace dawn::native { class CommandBufferStateTracker { public: + CommandBufferStateTracker(); + CommandBufferStateTracker(const CommandBufferStateTracker&); + CommandBufferStateTracker(CommandBufferStateTracker&&); + ~CommandBufferStateTracker(); + + CommandBufferStateTracker& operator=(const CommandBufferStateTracker&); + CommandBufferStateTracker& operator=(CommandBufferStateTracker&&); + // Non-state-modifying validation functions MaybeError ValidateCanDispatch(); MaybeError ValidateCanDraw(); diff --git a/src/dawn/native/CommandEncoder.cpp b/src/dawn/native/CommandEncoder.cpp index 3900d07b75..9bb8c0dd86 100644 --- a/src/dawn/native/CommandEncoder.cpp +++ b/src/dawn/native/CommandEncoder.cpp @@ -14,11 +14,13 @@ #include "dawn/native/CommandEncoder.h" +#include #include #include #include "dawn/common/BitSetIterator.h" #include "dawn/common/Math.h" +#include "dawn/native/ApplyClearColorValueWithDrawHelper.h" #include "dawn/native/BindGroup.h" #include "dawn/native/Buffer.h" #include "dawn/native/ChainUtils_autogen.h" @@ -43,11 +45,6 @@ namespace dawn::native { namespace { -bool HasDeprecatedColor(const RenderPassColorAttachment& attachment) { - return !std::isnan(attachment.clearColor.r) || !std::isnan(attachment.clearColor.g) || - !std::isnan(attachment.clearColor.b) || !std::isnan(attachment.clearColor.a); -} - MaybeError ValidateB2BCopyAlignment(uint64_t dataSize, uint64_t srcOffset, uint64_t dstOffset) { // Copy size must be a multiple of 4 bytes on macOS. DAWN_INVALID_IF(dataSize % 4 != 0, "Copy size (%u) is not a multiple of 4.", dataSize); @@ -91,7 +88,6 @@ MaybeError ValidateTextureDepthStencilToBufferCopyRestrictions(const ImageCopyTe switch (src.texture->GetFormat().format) { case wgpu::TextureFormat::Depth24Plus: case wgpu::TextureFormat::Depth24PlusStencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: return DAWN_FORMAT_VALIDATION_ERROR( "The depth aspect of %s format %s cannot be selected in a texture to " "buffer copy.", @@ -126,7 +122,8 @@ MaybeError ValidateOrSetAttachmentSize(const TextureViewBase* attachment, uint32_t* width, uint32_t* height) { const Extent3D& attachmentSize = - attachment->GetTexture()->GetMipLevelVirtualSize(attachment->GetBaseMipLevel()); + attachment->GetTexture()->GetMipLevelSingleSubresourceVirtualSize( + attachment->GetBaseMipLevel()); if (*width == 0) { DAWN_ASSERT(*height == 0); @@ -190,9 +187,11 @@ MaybeError ValidateResolveTarget(const DeviceBase* device, resolveTarget->GetLevelCount()); const Extent3D& colorTextureSize = - attachment->GetTexture()->GetMipLevelVirtualSize(attachment->GetBaseMipLevel()); + attachment->GetTexture()->GetMipLevelSingleSubresourceVirtualSize( + attachment->GetBaseMipLevel()); const Extent3D& resolveTextureSize = - resolveTarget->GetTexture()->GetMipLevelVirtualSize(resolveTarget->GetBaseMipLevel()); + resolveTarget->GetTexture()->GetMipLevelSingleSubresourceVirtualSize( + resolveTarget->GetBaseMipLevel()); DAWN_INVALID_IF(colorTextureSize.width != resolveTextureSize.width || colorTextureSize.height != resolveTextureSize.height, "The Resolve target %s size (width: %u, height: %u) does not match the color " @@ -277,7 +276,16 @@ MaybeError ValidateRenderPassDepthStencilAttachment( DAWN_TRY(ValidateCanUseAs(attachment->GetTexture(), wgpu::TextureUsage::RenderAttachment, usageValidationMode)); - const Format& format = attachment->GetFormat(); + // DS attachments must encompass all aspects of the texture, so we first check that this is + // true, which means that in the rest of the function we can assume that the view's format is + // the same as the texture's format. + const Format& format = attachment->GetTexture()->GetFormat(); + DAWN_INVALID_IF( + attachment->GetAspects() != format.aspects, + "The depth stencil attachment %s must encompass all aspects of it's texture's format (%s).", + attachment, format.format); + ASSERT(attachment->GetFormat().format == format.format); + DAWN_INVALID_IF(!format.HasDepthOrStencil(), "The depth stencil attachment %s format (%s) is not a depth stencil format.", attachment, format.format); @@ -286,9 +294,6 @@ MaybeError ValidateRenderPassDepthStencilAttachment( "The depth stencil attachment %s format (%s) is not renderable.", attachment, format.format); - DAWN_INVALID_IF(attachment->GetAspects() != format.aspects, - "The depth stencil attachment %s must encompass all aspects.", attachment); - DAWN_INVALID_IF( attachment->GetAspects() == (Aspect::Depth | Aspect::Stencil) && depthStencilAttachment->depthReadOnly != depthStencilAttachment->stencilReadOnly, @@ -373,10 +378,16 @@ MaybeError ValidateRenderPassDepthStencilAttachment( if (!std::isnan(depthStencilAttachment->clearDepth)) { // TODO(dawn:1269): Remove this branch after the deprecation period. device->EmitDeprecationWarning("clearDepth is deprecated, prefer depthClearValue instead."); - } else { - DAWN_INVALID_IF(depthStencilAttachment->depthLoadOp == wgpu::LoadOp::Clear && - std::isnan(depthStencilAttachment->depthClearValue), + DAWN_INVALID_IF( + depthStencilAttachment->clearDepth < 0.0f || depthStencilAttachment->clearDepth > 1.0f, + "clearDepth is not between 0.0 and 1.0"); + + } else if (depthStencilAttachment->depthLoadOp == wgpu::LoadOp::Clear) { + DAWN_INVALID_IF(std::isnan(depthStencilAttachment->depthClearValue), "depthClearValue is NaN."); + DAWN_INVALID_IF(depthStencilAttachment->depthClearValue < 0.0f || + depthStencilAttachment->depthClearValue > 1.0f, + "depthClearValue is not between 0.0 and 1.0"); } // TODO(dawn:1269): Remove after the deprecation period. @@ -405,16 +416,44 @@ MaybeError ValidateRenderPassDepthStencilAttachment( return {}; } +MaybeError ValidateTimestampLocationOnRenderPass( + wgpu::RenderPassTimestampLocation location, + const std::unordered_set& writtenLocations) { + DAWN_TRY(ValidateRenderPassTimestampLocation(location)); + + DAWN_INVALID_IF(writtenLocations.find(location) != writtenLocations.end(), + "There are two same RenderPassTimestampLocation %u in a render pass.", + location); + + return {}; +} + +MaybeError ValidateTimestampLocationOnComputePass( + wgpu::ComputePassTimestampLocation location, + const std::unordered_set& writtenLocations) { + DAWN_TRY(ValidateComputePassTimestampLocation(location)); + + DAWN_INVALID_IF(writtenLocations.find(location) != writtenLocations.end(), + "There are two same ComputePassTimestampLocation %u in a compute pass.", + location); + + return {}; +} + MaybeError ValidateRenderPassDescriptor(DeviceBase* device, const RenderPassDescriptor* descriptor, uint32_t* width, uint32_t* height, uint32_t* sampleCount, UsageValidationMode usageValidationMode) { + DAWN_TRY(ValidateSingleSType(descriptor->nextInChain, + wgpu::SType::RenderPassDescriptorMaxDrawCount)); + + uint32_t maxColorAttachments = device->GetLimits().v1.maxColorAttachments; DAWN_INVALID_IF( - descriptor->colorAttachmentCount > kMaxColorAttachments, + descriptor->colorAttachmentCount > maxColorAttachments, "Color attachment count (%u) exceeds the maximum number of color attachments (%u).", - descriptor->colorAttachmentCount, kMaxColorAttachments); + descriptor->colorAttachmentCount, maxColorAttachments); bool isAllColorAttachmentNull = true; for (uint32_t i = 0; i < descriptor->colorAttachmentCount; ++i) { @@ -456,15 +495,22 @@ MaybeError ValidateRenderPassDescriptor(DeviceBase* device, // not validated and encoded one by one, but encoded together after passing the // validation. QueryAvailabilityMap usedQueries; + // TODO(https://crbug.com/dawn/1452): + // 1. Add an enum that's TimestampLocationMask and has bit values. + // 2. Add a function with a switch that converts from one to the other. + // 3. type alias the ityp::bitset for that to call it TimestampLocationSet. + // 4. Use it here. + std::unordered_set writtenLocations; for (uint32_t i = 0; i < descriptor->timestampWriteCount; ++i) { QuerySetBase* querySet = descriptor->timestampWrites[i].querySet; DAWN_ASSERT(querySet != nullptr); uint32_t queryIndex = descriptor->timestampWrites[i].queryIndex; DAWN_TRY_CONTEXT(ValidateTimestampQuery(device, querySet, queryIndex), "validating querySet and queryIndex of timestampWrites[%u].", i); - DAWN_TRY_CONTEXT( - ValidateRenderPassTimestampLocation(descriptor->timestampWrites[i].location), - "validating location of timestampWrites[%u].", i); + DAWN_TRY_CONTEXT(ValidateTimestampLocationOnRenderPass( + descriptor->timestampWrites[i].location, writtenLocations), + "validating location of timestampWrites[%u].", i); + writtenLocations.insert(descriptor->timestampWrites[i].location); auto checkIt = usedQueries.find(querySet); DAWN_INVALID_IF(checkIt != usedQueries.end() && checkIt->second[queryIndex], @@ -494,14 +540,21 @@ MaybeError ValidateComputePassDescriptor(const DeviceBase* device, if (descriptor->timestampWriteCount > 0) { DAWN_ASSERT(descriptor->timestampWrites != nullptr); + // TODO(https://crbug.com/dawn/1452): + // 1. Add an enum that's TimestampLocationMask and has bit values. + // 2. Add a function with a switch that converts from one to the other. + // 3. type alias the ityp::bitset for that to call it TimestampLocationSet. + // 4. Use it here. + std::unordered_set writtenLocations; for (uint32_t i = 0; i < descriptor->timestampWriteCount; ++i) { DAWN_ASSERT(descriptor->timestampWrites[i].querySet != nullptr); DAWN_TRY_CONTEXT(ValidateTimestampQuery(device, descriptor->timestampWrites[i].querySet, descriptor->timestampWrites[i].queryIndex), "validating querySet and queryIndex of timestampWrites[%u].", i); - DAWN_TRY_CONTEXT( - ValidateComputePassTimestampLocation(descriptor->timestampWrites[i].location), - "validating location of timestampWrites[%u].", i); + DAWN_TRY_CONTEXT(ValidateTimestampLocationOnComputePass( + descriptor->timestampWrites[i].location, writtenLocations), + "validating location of timestampWrites[%u].", i); + writtenLocations.insert(descriptor->timestampWrites[i].location); } } @@ -599,6 +652,45 @@ bool IsReadOnlyDepthStencilAttachment( } // namespace +bool HasDeprecatedColor(const RenderPassColorAttachment& attachment) { + return !std::isnan(attachment.clearColor.r) || !std::isnan(attachment.clearColor.g) || + !std::isnan(attachment.clearColor.b) || !std::isnan(attachment.clearColor.a); +} + +Color ClampClearColorValueToLegalRange(const Color& originalColor, const Format& format) { + const AspectInfo& aspectInfo = format.GetAspectInfo(Aspect::Color); + double minValue = 0; + double maxValue = 0; + switch (aspectInfo.baseType) { + case wgpu::TextureComponentType::Float: { + return originalColor; + } + case wgpu::TextureComponentType::Sint: { + const uint32_t bitsPerComponent = + (aspectInfo.block.byteSize * 8 / format.componentCount); + maxValue = + static_cast((static_cast(1) << (bitsPerComponent - 1)) - 1); + minValue = -static_cast(static_cast(1) << (bitsPerComponent - 1)); + break; + } + case wgpu::TextureComponentType::Uint: { + const uint32_t bitsPerComponent = + (aspectInfo.block.byteSize * 8 / format.componentCount); + maxValue = static_cast((static_cast(1) << bitsPerComponent) - 1); + break; + } + case wgpu::TextureComponentType::DepthComparison: + default: + UNREACHABLE(); + break; + } + + return {std::clamp(originalColor.r, minValue, maxValue), + std::clamp(originalColor.g, minValue, maxValue), + std::clamp(originalColor.b, minValue, maxValue), + std::clamp(originalColor.a, minValue, maxValue)}; +} + MaybeError ValidateCommandEncoderDescriptor(const DeviceBase* device, const CommandEncoderDescriptor* descriptor) { DAWN_TRY(ValidateSingleSType(descriptor->nextInChain, @@ -687,8 +779,6 @@ ComputePassEncoder* CommandEncoder::APIBeginComputePass(const ComputePassDescrip Ref CommandEncoder::BeginComputePass(const ComputePassDescriptor* descriptor) { DeviceBase* device = GetDevice(); - std::vector timestampWritesAtBeginning; - std::vector timestampWritesAtEnd; bool success = mEncodingContext.TryEncode( this, [&](CommandAllocator* allocator) -> MaybeError { @@ -701,27 +791,27 @@ Ref CommandEncoder::BeginComputePass(const ComputePassDescri return {}; } - // Split the timestampWrites used in BeginComputePassCmd and EndComputePassCmd + // Record timestamp writes at the beginning and end of compute pass. The timestamp write + // at the end also be needed in BeginComputePassCmd because it's required by compute + // pass descriptor when beginning compute pass on Metal. for (uint32_t i = 0; i < descriptor->timestampWriteCount; i++) { QuerySetBase* querySet = descriptor->timestampWrites[i].querySet; uint32_t queryIndex = descriptor->timestampWrites[i].queryIndex; switch (descriptor->timestampWrites[i].location) { case wgpu::ComputePassTimestampLocation::Beginning: - timestampWritesAtBeginning.push_back({querySet, queryIndex}); + cmd->beginTimestamp.querySet = querySet; + cmd->beginTimestamp.queryIndex = queryIndex; break; case wgpu::ComputePassTimestampLocation::End: - timestampWritesAtEnd.push_back({querySet, queryIndex}); - break; - default: + cmd->endTimestamp.querySet = querySet; + cmd->endTimestamp.queryIndex = queryIndex; break; } TrackQueryAvailability(querySet, queryIndex); } - cmd->timestampWrites = std::move(timestampWritesAtBeginning); - return {}; }, "encoding %s.BeginComputePass(%s).", this, descriptor); @@ -732,8 +822,8 @@ Ref CommandEncoder::BeginComputePass(const ComputePassDescri descriptor = &defaultDescriptor; } - Ref passEncoder = ComputePassEncoder::Create( - device, descriptor, this, &mEncodingContext, std::move(timestampWritesAtEnd)); + Ref passEncoder = + ComputePassEncoder::Create(device, descriptor, this, &mEncodingContext); mEncodingContext.EnterPass(passEncoder.Get()); return passEncoder; } @@ -755,8 +845,6 @@ Ref CommandEncoder::BeginRenderPass(const RenderPassDescripto bool depthReadOnly = false; bool stencilReadOnly = false; Ref attachmentState; - std::vector timestampWritesAtBeginning; - std::vector timestampWritesAtEnd; bool success = mEncodingContext.TryEncode( this, [&](CommandAllocator* allocator) -> MaybeError { @@ -774,28 +862,6 @@ Ref CommandEncoder::BeginRenderPass(const RenderPassDescripto cmd->attachmentState = device->GetOrCreateAttachmentState(descriptor); attachmentState = cmd->attachmentState; - // Split the timestampWrites used in BeginRenderPassCmd and EndRenderPassCmd - for (uint32_t i = 0; i < descriptor->timestampWriteCount; i++) { - QuerySetBase* querySet = descriptor->timestampWrites[i].querySet; - uint32_t queryIndex = descriptor->timestampWrites[i].queryIndex; - - switch (descriptor->timestampWrites[i].location) { - case wgpu::RenderPassTimestampLocation::Beginning: - timestampWritesAtBeginning.push_back({querySet, queryIndex}); - break; - case wgpu::RenderPassTimestampLocation::End: - timestampWritesAtEnd.push_back({querySet, queryIndex}); - break; - default: - break; - } - - TrackQueryAvailability(querySet, queryIndex); - // Track the query availability with true on render pass again for rewrite - // validation and query reset on Vulkan - usageTracker.TrackQueryAvailability(querySet, queryIndex); - } - for (ColorAttachmentIndex index : IterateBitSet(cmd->attachmentState->GetColorAttachmentsMask())) { uint8_t i = static_cast(index); @@ -807,10 +873,12 @@ Ref CommandEncoder::BeginRenderPass(const RenderPassDescripto cmd->colorAttachments[index].loadOp = descriptor->colorAttachments[i].loadOp; cmd->colorAttachments[index].storeOp = descriptor->colorAttachments[i].storeOp; + Color color = HasDeprecatedColor(descriptor->colorAttachments[i]) + ? descriptor->colorAttachments[i].clearColor + : descriptor->colorAttachments[i].clearValue; + cmd->colorAttachments[index].clearColor = - HasDeprecatedColor(descriptor->colorAttachments[i]) - ? descriptor->colorAttachments[i].clearColor - : descriptor->colorAttachments[i].clearValue; + ClampClearColorValueToLegalRange(color, view->GetFormat()); usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::RenderAttachment); @@ -843,6 +911,15 @@ Ref CommandEncoder::BeginRenderPass(const RenderPassDescripto cmd->depthStencilAttachment.clearStencil = descriptor->depthStencilAttachment->stencilClearValue; } + if (view->GetFormat().HasStencil()) { + // GPURenderPassDepthStencilAttachment.stencilClearValue will be converted to + // the type of the stencil aspect of view by taking the same number of LSBs as + // the number of bits in the stencil aspect of one texel block of view. + ASSERT(view->GetFormat() + .GetAspectInfo(dawn::native::Aspect::Stencil) + .block.byteSize == 1u); + cmd->depthStencilAttachment.clearStencil &= 0xFF; + } cmd->depthStencilAttachment.depthReadOnly = descriptor->depthStencilAttachment->depthReadOnly; @@ -888,7 +965,29 @@ Ref CommandEncoder::BeginRenderPass(const RenderPassDescripto cmd->occlusionQuerySet = descriptor->occlusionQuerySet; - cmd->timestampWrites = std::move(timestampWritesAtBeginning); + // Record timestamp writes at the beginning and end of render pass. The timestamp write + // at the end also be needed in BeginComputePassCmd because it's required by render pass + // descriptor when beginning render pass on Metal. + for (uint32_t i = 0; i < descriptor->timestampWriteCount; i++) { + QuerySetBase* querySet = descriptor->timestampWrites[i].querySet; + uint32_t queryIndex = descriptor->timestampWrites[i].queryIndex; + + switch (descriptor->timestampWrites[i].location) { + case wgpu::RenderPassTimestampLocation::Beginning: + cmd->beginTimestamp.querySet = querySet; + cmd->beginTimestamp.queryIndex = queryIndex; + break; + case wgpu::RenderPassTimestampLocation::End: + cmd->endTimestamp.querySet = querySet; + cmd->endTimestamp.queryIndex = queryIndex; + break; + } + + TrackQueryAvailability(querySet, queryIndex); + // Track the query availability with true on render pass again for rewrite + // validation and query reset on Vulkan + usageTracker.TrackQueryAvailability(querySet, queryIndex); + } return {}; }, @@ -897,9 +996,17 @@ Ref CommandEncoder::BeginRenderPass(const RenderPassDescripto if (success) { Ref passEncoder = RenderPassEncoder::Create( device, descriptor, this, &mEncodingContext, std::move(usageTracker), - std::move(attachmentState), std::move(timestampWritesAtEnd), width, height, - depthReadOnly, stencilReadOnly); + std::move(attachmentState), width, height, depthReadOnly, stencilReadOnly); mEncodingContext.EnterPass(passEncoder.Get()); + + if (ShouldApplyClearBigIntegerColorValueWithDraw(device, descriptor)) { + MaybeError error = + ApplyClearBigIntegerColorValueWithDraw(passEncoder.Get(), descriptor); + if (error.IsError()) { + return RenderPassEncoder::MakeError(device, this, &mEncodingContext); + } + } + return passEncoder; } diff --git a/src/dawn/native/CommandEncoder.h b/src/dawn/native/CommandEncoder.h index 79e6e96f34..e43c6e77ce 100644 --- a/src/dawn/native/CommandEncoder.h +++ b/src/dawn/native/CommandEncoder.h @@ -29,6 +29,10 @@ namespace dawn::native { enum class UsageValidationMode; +bool HasDeprecatedColor(const RenderPassColorAttachment& attachment); + +Color ClampClearColorValueToLegalRange(const Color& originalColor, const Format& format); + MaybeError ValidateCommandEncoderDescriptor(const DeviceBase* device, const CommandEncoderDescriptor* descriptor); diff --git a/src/dawn/native/CommandValidation.cpp b/src/dawn/native/CommandValidation.cpp index 3df90f1047..d0bdb0c3b0 100644 --- a/src/dawn/native/CommandValidation.cpp +++ b/src/dawn/native/CommandValidation.cpp @@ -275,7 +275,8 @@ MaybeError ValidateImageCopyTexture(DeviceBase const* device, texture->GetFormat().format, textureCopy.aspect); if (texture->GetSampleCount() > 1 || texture->GetFormat().HasDepthOrStencil()) { - Extent3D subresourceSize = texture->GetMipLevelPhysicalSize(textureCopy.mipLevel); + Extent3D subresourceSize = + texture->GetMipLevelSingleSubresourcePhysicalSize(textureCopy.mipLevel); ASSERT(texture->GetDimension() == wgpu::TextureDimension::e2D); DAWN_INVALID_IF( textureCopy.origin.x != 0 || textureCopy.origin.y != 0 || @@ -297,7 +298,7 @@ MaybeError ValidateTextureCopyRange(DeviceBase const* device, const TextureBase* texture = textureCopy.texture; // Validation for the copy being in-bounds: - Extent3D mipSize = texture->GetMipLevelPhysicalSize(textureCopy.mipLevel); + Extent3D mipSize = texture->GetMipLevelSingleSubresourcePhysicalSize(textureCopy.mipLevel); // For 1D/2D textures, include the array layer as depth so it can be checked with other // dimensions. if (texture->GetDimension() != wgpu::TextureDimension::e3D) { @@ -470,7 +471,6 @@ MaybeError ValidateCanUseAs(const TextureBase* texture, texture->GetInternalUsage(), usage); break; } - return {}; } diff --git a/src/dawn/native/CommandValidation.h b/src/dawn/native/CommandValidation.h index ede6b310b4..bf4e8aabef 100644 --- a/src/dawn/native/CommandValidation.h +++ b/src/dawn/native/CommandValidation.h @@ -20,6 +20,7 @@ #include "dawn/native/CommandAllocator.h" #include "dawn/native/Error.h" #include "dawn/native/Texture.h" +#include "dawn/native/UsageValidationMode.h" namespace dawn::native { @@ -82,11 +83,6 @@ MaybeError ValidateTextureToTextureCopyRestrictions(const ImageCopyTexture& src, const ImageCopyTexture& dst, const Extent3D& copySize); -enum class UsageValidationMode { - Default, - Internal, -}; - MaybeError ValidateCanUseAs(const TextureBase* texture, wgpu::TextureUsage usage, UsageValidationMode mode); diff --git a/src/dawn/native/Commands.cpp b/src/dawn/native/Commands.cpp index 019da13be0..c1be63922f 100644 --- a/src/dawn/native/Commands.cpp +++ b/src/dawn/native/Commands.cpp @@ -361,4 +361,74 @@ void SkipCommand(CommandIterator* commands, Command type) { } } +TimestampWrite::TimestampWrite() = default; +TimestampWrite::~TimestampWrite() = default; + +BeginComputePassCmd::BeginComputePassCmd() = default; +BeginComputePassCmd::~BeginComputePassCmd() = default; + +BeginOcclusionQueryCmd::BeginOcclusionQueryCmd() = default; +BeginOcclusionQueryCmd::~BeginOcclusionQueryCmd() = default; + +RenderPassColorAttachmentInfo::RenderPassColorAttachmentInfo() = default; +RenderPassColorAttachmentInfo::~RenderPassColorAttachmentInfo() = default; + +RenderPassDepthStencilAttachmentInfo::RenderPassDepthStencilAttachmentInfo() = default; +RenderPassDepthStencilAttachmentInfo::~RenderPassDepthStencilAttachmentInfo() = default; + +BeginRenderPassCmd::BeginRenderPassCmd() = default; +BeginRenderPassCmd::~BeginRenderPassCmd() = default; + +BufferCopy::BufferCopy() = default; +BufferCopy::~BufferCopy() = default; + +TextureCopy::TextureCopy() = default; +TextureCopy::TextureCopy(const TextureCopy&) = default; +TextureCopy::~TextureCopy() = default; + +CopyBufferToBufferCmd::CopyBufferToBufferCmd() = default; +CopyBufferToBufferCmd::~CopyBufferToBufferCmd() = default; + +DispatchIndirectCmd::DispatchIndirectCmd() = default; +DispatchIndirectCmd::~DispatchIndirectCmd() = default; + +DrawIndirectCmd::DrawIndirectCmd() = default; +DrawIndirectCmd::~DrawIndirectCmd() = default; + +EndComputePassCmd::EndComputePassCmd() = default; +EndComputePassCmd::~EndComputePassCmd() = default; + +EndOcclusionQueryCmd::EndOcclusionQueryCmd() = default; +EndOcclusionQueryCmd::~EndOcclusionQueryCmd() = default; + +EndRenderPassCmd::EndRenderPassCmd() = default; +EndRenderPassCmd::~EndRenderPassCmd() = default; + +ClearBufferCmd::ClearBufferCmd() = default; +ClearBufferCmd::~ClearBufferCmd() = default; + +ResolveQuerySetCmd::ResolveQuerySetCmd() = default; +ResolveQuerySetCmd::~ResolveQuerySetCmd() = default; + +SetComputePipelineCmd::SetComputePipelineCmd() = default; +SetComputePipelineCmd::~SetComputePipelineCmd() = default; + +SetRenderPipelineCmd::SetRenderPipelineCmd() = default; +SetRenderPipelineCmd::~SetRenderPipelineCmd() = default; + +SetBindGroupCmd::SetBindGroupCmd() = default; +SetBindGroupCmd::~SetBindGroupCmd() = default; + +SetIndexBufferCmd::SetIndexBufferCmd() = default; +SetIndexBufferCmd::~SetIndexBufferCmd() = default; + +SetVertexBufferCmd::SetVertexBufferCmd() = default; +SetVertexBufferCmd::~SetVertexBufferCmd() = default; + +WriteBufferCmd::WriteBufferCmd() = default; +WriteBufferCmd::~WriteBufferCmd() = default; + +WriteTimestampCmd::WriteTimestampCmd() = default; +WriteTimestampCmd::~WriteTimestampCmd() = default; + } // namespace dawn::native diff --git a/src/dawn/native/Commands.h b/src/dawn/native/Commands.h index 1c7024ac79..456a1b5961 100644 --- a/src/dawn/native/Commands.h +++ b/src/dawn/native/Commands.h @@ -70,20 +70,33 @@ enum class Command { }; struct TimestampWrite { + TimestampWrite(); + ~TimestampWrite(); + Ref querySet; uint32_t queryIndex; }; struct BeginComputePassCmd { - std::vector timestampWrites; + BeginComputePassCmd(); + ~BeginComputePassCmd(); + + TimestampWrite beginTimestamp; + TimestampWrite endTimestamp; }; struct BeginOcclusionQueryCmd { + BeginOcclusionQueryCmd(); + ~BeginOcclusionQueryCmd(); + Ref querySet; uint32_t queryIndex; }; struct RenderPassColorAttachmentInfo { + RenderPassColorAttachmentInfo(); + ~RenderPassColorAttachmentInfo(); + Ref view; Ref resolveTarget; wgpu::LoadOp loadOp; @@ -92,6 +105,9 @@ struct RenderPassColorAttachmentInfo { }; struct RenderPassDepthStencilAttachmentInfo { + RenderPassDepthStencilAttachmentInfo(); + ~RenderPassDepthStencilAttachmentInfo(); + Ref view; wgpu::LoadOp depthLoadOp; wgpu::StoreOp depthStoreOp; @@ -104,6 +120,9 @@ struct RenderPassDepthStencilAttachmentInfo { }; struct BeginRenderPassCmd { + BeginRenderPassCmd(); + ~BeginRenderPassCmd(); + Ref attachmentState; ityp::array colorAttachments; @@ -114,10 +133,14 @@ struct BeginRenderPassCmd { uint32_t height; Ref occlusionQuerySet; - std::vector timestampWrites; + TimestampWrite beginTimestamp; + TimestampWrite endTimestamp; }; struct BufferCopy { + BufferCopy(); + ~BufferCopy(); + Ref buffer; uint64_t offset; uint32_t bytesPerRow; @@ -125,6 +148,10 @@ struct BufferCopy { }; struct TextureCopy { + TextureCopy(); + TextureCopy(const TextureCopy&); + ~TextureCopy(); + Ref texture; uint32_t mipLevel; Origin3D origin; // Texels / array layer @@ -132,6 +159,9 @@ struct TextureCopy { }; struct CopyBufferToBufferCmd { + CopyBufferToBufferCmd(); + ~CopyBufferToBufferCmd(); + Ref source; uint64_t sourceOffset; Ref destination; @@ -164,6 +194,9 @@ struct DispatchCmd { }; struct DispatchIndirectCmd { + DispatchIndirectCmd(); + ~DispatchIndirectCmd(); + Ref indirectBuffer; uint64_t indirectOffset; }; @@ -184,6 +217,9 @@ struct DrawIndexedCmd { }; struct DrawIndirectCmd { + DrawIndirectCmd(); + ~DrawIndirectCmd(); + Ref indirectBuffer; uint64_t indirectOffset; }; @@ -191,16 +227,21 @@ struct DrawIndirectCmd { struct DrawIndexedIndirectCmd : DrawIndirectCmd {}; struct EndComputePassCmd { - std::vector timestampWrites; + EndComputePassCmd(); + ~EndComputePassCmd(); }; struct EndOcclusionQueryCmd { + EndOcclusionQueryCmd(); + ~EndOcclusionQueryCmd(); + Ref querySet; uint32_t queryIndex; }; struct EndRenderPassCmd { - std::vector timestampWrites; + EndRenderPassCmd(); + ~EndRenderPassCmd(); }; struct ExecuteBundlesCmd { @@ -208,6 +249,9 @@ struct ExecuteBundlesCmd { }; struct ClearBufferCmd { + ClearBufferCmd(); + ~ClearBufferCmd(); + Ref buffer; uint64_t offset; uint64_t size; @@ -224,6 +268,9 @@ struct PushDebugGroupCmd { }; struct ResolveQuerySetCmd { + ResolveQuerySetCmd(); + ~ResolveQuerySetCmd(); + Ref querySet; uint32_t firstQuery; uint32_t queryCount; @@ -232,10 +279,16 @@ struct ResolveQuerySetCmd { }; struct SetComputePipelineCmd { + SetComputePipelineCmd(); + ~SetComputePipelineCmd(); + Ref pipeline; }; struct SetRenderPipelineCmd { + SetRenderPipelineCmd(); + ~SetRenderPipelineCmd(); + Ref pipeline; }; @@ -256,12 +309,18 @@ struct SetBlendConstantCmd { }; struct SetBindGroupCmd { + SetBindGroupCmd(); + ~SetBindGroupCmd(); + BindGroupIndex index; Ref group; uint32_t dynamicOffsetCount; }; struct SetIndexBufferCmd { + SetIndexBufferCmd(); + ~SetIndexBufferCmd(); + Ref buffer; wgpu::IndexFormat format; uint64_t offset; @@ -269,6 +328,9 @@ struct SetIndexBufferCmd { }; struct SetVertexBufferCmd { + SetVertexBufferCmd(); + ~SetVertexBufferCmd(); + VertexBufferSlot slot; Ref buffer; uint64_t offset; @@ -276,12 +338,18 @@ struct SetVertexBufferCmd { }; struct WriteBufferCmd { + WriteBufferCmd(); + ~WriteBufferCmd(); + Ref buffer; uint64_t offset; uint64_t size; }; struct WriteTimestampCmd { + WriteTimestampCmd(); + ~WriteTimestampCmd(); + Ref querySet; uint32_t queryIndex; }; diff --git a/src/dawn/native/CompilationMessages.cpp b/src/dawn/native/CompilationMessages.cpp index 0eae1a6b44..a605b299f8 100644 --- a/src/dawn/native/CompilationMessages.cpp +++ b/src/dawn/native/CompilationMessages.cpp @@ -42,6 +42,8 @@ OwnedCompilationMessages::OwnedCompilationMessages() { mCompilationInfo.messages = nullptr; } +OwnedCompilationMessages::~OwnedCompilationMessages() = default; + void OwnedCompilationMessages::AddMessageForTesting(std::string message, wgpu::CompilationMessageType type, uint64_t lineNum, @@ -174,6 +176,10 @@ void OwnedCompilationMessages::AddFormattedTintMessages(const tint::diag::List& messageList.add(tint::diag::Diagnostic(diag)); break; } + case (tint::diag::Severity::Note): { + messageList.add(tint::diag::Diagnostic(diag)); + break; + } default: break; } diff --git a/src/dawn/native/CompilationMessages.h b/src/dawn/native/CompilationMessages.h index 188d1caa96..13d30b2ddc 100644 --- a/src/dawn/native/CompilationMessages.h +++ b/src/dawn/native/CompilationMessages.h @@ -32,7 +32,7 @@ namespace dawn::native { class OwnedCompilationMessages : public NonCopyable { public: OwnedCompilationMessages(); - ~OwnedCompilationMessages() = default; + ~OwnedCompilationMessages(); void AddMessageForTesting( std::string message, diff --git a/src/dawn/native/ComputePassEncoder.cpp b/src/dawn/native/ComputePassEncoder.cpp index aeaa875a2c..65d00cbc91 100644 --- a/src/dawn/native/ComputePassEncoder.cpp +++ b/src/dawn/native/ComputePassEncoder.cpp @@ -46,25 +46,25 @@ ResultOrError GetOrCreateIndirectDispatchValidationPipelin Ref shaderModule; DAWN_TRY_ASSIGN(shaderModule, utils::CreateShaderModule(device, R"( struct UniformParams { - maxComputeWorkgroupsPerDimension: u32; - clientOffsetInU32: u32; - enableValidation: u32; - duplicateNumWorkgroups: u32; - }; + maxComputeWorkgroupsPerDimension: u32, + clientOffsetInU32: u32, + enableValidation: u32, + duplicateNumWorkgroups: u32, + } struct IndirectParams { - data: array; - }; + data: array + } struct ValidatedParams { - data: array; - }; + data: array + } @group(0) @binding(0) var uniformParams: UniformParams; @group(0) @binding(1) var clientParams: IndirectParams; - @group(0) @binding(2) var validatedParams: ValidatedParams; + @group(0) @binding(2) var validatedParams: ValidatedParams; - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main() { for (var i = 0u; i < 3u; i = i + 1u) { var numWorkgroups = clientParams.data[uniformParams.clientOffsetInU32 + i]; @@ -111,23 +111,18 @@ ResultOrError GetOrCreateIndirectDispatchValidationPipelin ComputePassEncoder::ComputePassEncoder(DeviceBase* device, const ComputePassDescriptor* descriptor, CommandEncoder* commandEncoder, - EncodingContext* encodingContext, - std::vector timestampWritesAtEnd) + EncodingContext* encodingContext) : ProgrammableEncoder(device, descriptor->label, encodingContext), - mCommandEncoder(commandEncoder), - mTimestampWritesAtEnd(std::move(timestampWritesAtEnd)) { + mCommandEncoder(commandEncoder) { TrackInDevice(); } // static -Ref ComputePassEncoder::Create( - DeviceBase* device, - const ComputePassDescriptor* descriptor, - CommandEncoder* commandEncoder, - EncodingContext* encodingContext, - std::vector timestampWritesAtEnd) { - return AcquireRef(new ComputePassEncoder(device, descriptor, commandEncoder, encodingContext, - std::move(timestampWritesAtEnd))); +Ref ComputePassEncoder::Create(DeviceBase* device, + const ComputePassDescriptor* descriptor, + CommandEncoder* commandEncoder, + EncodingContext* encodingContext) { + return AcquireRef(new ComputePassEncoder(device, descriptor, commandEncoder, encodingContext)); } ComputePassEncoder::ComputePassEncoder(DeviceBase* device, @@ -162,11 +157,7 @@ void ComputePassEncoder::APIEnd() { DAWN_TRY(ValidateProgrammableEncoderEnd()); } - EndComputePassCmd* cmd = - allocator->Allocate(Command::EndComputePass); - // The query availability has already been updated at the beginning of compute - // pass, and no need to do update here. - cmd->timestampWrites = std::move(mTimestampWritesAtEnd); + allocator->Allocate(Command::EndComputePass); return {}; }, @@ -306,7 +297,8 @@ ComputePassEncoder::TransformIndirectDispatchBuffer(Ref indirectBuff {1, indirectBuffer, clientIndirectBindingOffset, clientIndirectBindingSize}, {2, validatedIndirectBuffer, 0, scratchBufferSize}, - })); + }, + UsageValidationMode::Internal)); // Issue commands to validate the indirect buffer. APISetPipeline(validationPipeline.Get()); diff --git a/src/dawn/native/ComputePassEncoder.h b/src/dawn/native/ComputePassEncoder.h index ad950964b2..f48ef94cb7 100644 --- a/src/dawn/native/ComputePassEncoder.h +++ b/src/dawn/native/ComputePassEncoder.h @@ -33,8 +33,7 @@ class ComputePassEncoder final : public ProgrammableEncoder { static Ref Create(DeviceBase* device, const ComputePassDescriptor* descriptor, CommandEncoder* commandEncoder, - EncodingContext* encodingContext, - std::vector timestampWritesAtEnd); + EncodingContext* encodingContext); static Ref MakeError(DeviceBase* device, CommandEncoder* commandEncoder, EncodingContext* encodingContext); @@ -72,8 +71,7 @@ class ComputePassEncoder final : public ProgrammableEncoder { ComputePassEncoder(DeviceBase* device, const ComputePassDescriptor* descriptor, CommandEncoder* commandEncoder, - EncodingContext* encodingContext, - std::vector timestampWritesAtEnd); + EncodingContext* encodingContext); ComputePassEncoder(DeviceBase* device, CommandEncoder* commandEncoder, EncodingContext* encodingContext, @@ -98,8 +96,6 @@ class ComputePassEncoder final : public ProgrammableEncoder { // For render and compute passes, the encoding context is borrowed from the command encoder. // Keep a reference to the encoder to make sure the context isn't freed. Ref mCommandEncoder; - - std::vector mTimestampWritesAtEnd; }; } // namespace dawn::native diff --git a/src/dawn/native/ComputePipeline.cpp b/src/dawn/native/ComputePipeline.cpp index a1dcf15a48..b0b574d043 100644 --- a/src/dawn/native/ComputePipeline.cpp +++ b/src/dawn/native/ComputePipeline.cpp @@ -50,7 +50,7 @@ ComputePipelineBase::ComputePipelineBase(DeviceBase* device, TrackInDevice(); // Initialize the cache key to include the cache type and device information. - mCacheKey.Record(CacheKey::Type::ComputePipeline, device->GetCacheKey()); + StreamIn(&mCacheKey, CacheKey::Type::ComputePipeline, device->GetCacheKey()); } ComputePipelineBase::ComputePipelineBase(DeviceBase* device) : PipelineBase(device) { diff --git a/src/dawn/native/CopyTextureForBrowserHelper.cpp b/src/dawn/native/CopyTextureForBrowserHelper.cpp index 528f740ef6..f8cece17da 100644 --- a/src/dawn/native/CopyTextureForBrowserHelper.cpp +++ b/src/dawn/native/CopyTextureForBrowserHelper.cpp @@ -85,7 +85,7 @@ static const char sCopyTextureForBrowserShader[] = R"( return sign(v) * (pow(params.A * abs(v) + params.B, params.G) + params.E); } - @stage(vertex) + @vertex fn vs_main( @builtin(vertex_index) VertexIndex : u32 ) -> VertexOutputs { @@ -123,7 +123,7 @@ static const char sCopyTextureForBrowserShader[] = R"( @binding(1) @group(0) var mySampler: sampler; @binding(2) @group(0) var myTexture: texture_2d; - @stage(fragment) + @fragment fn fs_main( @location(0) texcoord : vec2 ) -> @location(0) vec4 { @@ -145,9 +145,11 @@ static const char sCopyTextureForBrowserShader[] = R"( let kEncodeToGammaStep = 0x08u; let kPremultiplyStep = 0x10u; let kDecodeForSrgbDstFormat = 0x20u; + let kClearSrcAlphaToOne = 0x40u; // Unpremultiply step. Appling color space conversion op on premultiplied source texture // also needs to unpremultiply first. + // This step is exclusive with clear src alpha to one step. if (bool(uniforms.steps_mask & kUnpremultiplyStep)) { if (color.a != 0.0) { color = vec4(color.rgb / color.a, color.a); @@ -180,6 +182,7 @@ static const char sCopyTextureForBrowserShader[] = R"( } // Premultiply step. + // This step is exclusive with clear src alpha to one step. if (bool(uniforms.steps_mask & kPremultiplyStep)) { color = vec4(color.rgb * color.a, color.a); } @@ -192,6 +195,12 @@ static const char sCopyTextureForBrowserShader[] = R"( color.a); } + // Clear alpha to one step. + // This step is exclusive with premultiply/unpremultiply step. + if (bool(uniforms.steps_mask & kClearSrcAlphaToOne)) { + color.a = 1.0; + } + return color; } )"; @@ -230,6 +239,7 @@ MaybeError ValidateCopyTextureFormatConversion(const wgpu::TextureFormat srcForm switch (srcFormat) { case wgpu::TextureFormat::BGRA8Unorm: case wgpu::TextureFormat::RGBA8Unorm: + case wgpu::TextureFormat::RGBA16Float: break; default: return DAWN_FORMAT_VALIDATION_ERROR("Source texture format (%s) is not supported.", @@ -354,15 +364,15 @@ MaybeError ValidateCopyTextureForBrowser(DeviceBase* device, "not 1.", source->texture->GetSampleCount(), destination->texture->GetSampleCount()); - DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc, - UsageValidationMode::Default)); - DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::TextureBinding, - UsageValidationMode::Default)); - - DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst, - UsageValidationMode::Default)); - DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::RenderAttachment, - UsageValidationMode::Default)); + DAWN_INVALID_IF( + options->internalUsage && !device->IsFeatureEnabled(Feature::DawnInternalUsages), + "The internalUsage is true while the dawn-internal-usages feature is not enabled."); + UsageValidationMode mode = + options->internalUsage ? UsageValidationMode::Internal : UsageValidationMode::Default; + DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc, mode)); + DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::TextureBinding, mode)); + DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst, mode)); + DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::RenderAttachment, mode)); DAWN_TRY(ValidateCopyTextureFormatConversion(source->texture->GetFormat().format, destination->texture->GetFormat().format)); @@ -456,11 +466,16 @@ MaybeError DoCopyTextureForBrowser(DeviceBase* device, constexpr uint32_t kEncodeToGammaStep = 0x08; constexpr uint32_t kPremultiplyStep = 0x10; constexpr uint32_t kDecodeForSrgbDstFormat = 0x20; + constexpr uint32_t kClearSrcAlphaToOne = 0x40; if (options->srcAlphaMode == wgpu::AlphaMode::Premultiplied) { - if (options->needsColorSpaceConversion || options->srcAlphaMode != options->dstAlphaMode) { + if (options->needsColorSpaceConversion || + options->dstAlphaMode == wgpu::AlphaMode::Unpremultiplied) { stepsMask |= kUnpremultiplyStep; } + } else if (options->srcAlphaMode == wgpu::AlphaMode::Opaque) { + // Simply clear src alpha channel to 1.0 + stepsMask |= kClearSrcAlphaToOne; } if (options->needsColorSpaceConversion) { @@ -497,7 +512,8 @@ MaybeError DoCopyTextureForBrowser(DeviceBase* device, } if (options->dstAlphaMode == wgpu::AlphaMode::Premultiplied) { - if (options->needsColorSpaceConversion || options->srcAlphaMode != options->dstAlphaMode) { + if (options->needsColorSpaceConversion || + options->srcAlphaMode == wgpu::AlphaMode::Unpremultiplied) { stepsMask |= kPremultiplyStep; } } @@ -537,6 +553,7 @@ MaybeError DoCopyTextureForBrowser(DeviceBase* device, // Prepare binding 2 resource: sampled texture TextureViewDescriptor srcTextureViewDesc = {}; + srcTextureViewDesc.dimension = wgpu::TextureViewDimension::e2D; srcTextureViewDesc.baseMipLevel = source->mipLevel; srcTextureViewDesc.mipLevelCount = 1; srcTextureViewDesc.arrayLayerCount = 1; @@ -545,17 +562,26 @@ MaybeError DoCopyTextureForBrowser(DeviceBase* device, device->CreateTextureView(source->texture, &srcTextureViewDesc)); // Create bind group after all binding entries are set. + UsageValidationMode mode = + options->internalUsage ? UsageValidationMode::Internal : UsageValidationMode::Default; Ref bindGroup; - DAWN_TRY_ASSIGN(bindGroup, - utils::MakeBindGroup(device, layout, - {{0, uniformBuffer}, {1, sampler}, {2, srcTextureView}})); + DAWN_TRY_ASSIGN(bindGroup, utils::MakeBindGroup( + device, layout, + {{0, uniformBuffer}, {1, sampler}, {2, srcTextureView}}, mode)); // Create command encoder. + CommandEncoderDescriptor commandEncoderDesc; + DawnEncoderInternalUsageDescriptor internalUsageDesc; + if (options->internalUsage) { + internalUsageDesc.useInternalUsages = true; + commandEncoderDesc.nextInChain = &internalUsageDesc; + } Ref encoder; - DAWN_TRY_ASSIGN(encoder, device->CreateCommandEncoder()); + DAWN_TRY_ASSIGN(encoder, device->CreateCommandEncoder(&commandEncoderDesc)); // Prepare dst texture view as color Attachment. TextureViewDescriptor dstTextureViewDesc; + dstTextureViewDesc.dimension = wgpu::TextureViewDimension::e2D; dstTextureViewDesc.baseMipLevel = destination->mipLevel; dstTextureViewDesc.mipLevelCount = 1; dstTextureViewDesc.baseArrayLayer = destination->origin.z; @@ -577,7 +603,7 @@ MaybeError DoCopyTextureForBrowser(DeviceBase* device, renderPassDesc.colorAttachments = &colorAttachmentDesc; Ref passEncoder = encoder->BeginRenderPass(&renderPassDesc); - // Start pipeline and encode commands to complete + // Start pipeline and encode commands to complete // the copy from src texture to dst texture with transformation. passEncoder->APISetPipeline(pipeline); passEncoder->APISetBindGroup(0, bindGroup.Get()); diff --git a/src/dawn/native/CreatePipelineAsyncTask.cpp b/src/dawn/native/CreatePipelineAsyncTask.cpp index 9ecd048602..e7319abc27 100644 --- a/src/dawn/native/CreatePipelineAsyncTask.cpp +++ b/src/dawn/native/CreatePipelineAsyncTask.cpp @@ -30,6 +30,8 @@ CreatePipelineAsyncCallbackTaskBase::CreatePipelineAsyncCallbackTaskBase(std::st void* userdata) : mErrorMessage(errorMessage), mUserData(userdata) {} +CreatePipelineAsyncCallbackTaskBase::~CreatePipelineAsyncCallbackTaskBase() = default; + CreateComputePipelineAsyncCallbackTask::CreateComputePipelineAsyncCallbackTask( Ref pipeline, std::string errorMessage, @@ -39,6 +41,8 @@ CreateComputePipelineAsyncCallbackTask::CreateComputePipelineAsyncCallbackTask( mPipeline(std::move(pipeline)), mCreateComputePipelineAsyncCallback(callback) {} +CreateComputePipelineAsyncCallbackTask::~CreateComputePipelineAsyncCallbackTask() = default; + void CreateComputePipelineAsyncCallbackTask::Finish() { ASSERT(mCreateComputePipelineAsyncCallback != nullptr); @@ -74,6 +78,8 @@ CreateRenderPipelineAsyncCallbackTask::CreateRenderPipelineAsyncCallbackTask( mPipeline(std::move(pipeline)), mCreateRenderPipelineAsyncCallback(callback) {} +CreateRenderPipelineAsyncCallbackTask::~CreateRenderPipelineAsyncCallbackTask() = default; + void CreateRenderPipelineAsyncCallbackTask::Finish() { ASSERT(mCreateRenderPipelineAsyncCallback != nullptr); @@ -110,6 +116,8 @@ CreateComputePipelineAsyncTask::CreateComputePipelineAsyncTask( ASSERT(mComputePipeline != nullptr); } +CreateComputePipelineAsyncTask::~CreateComputePipelineAsyncTask() = default; + void CreateComputePipelineAsyncTask::Run() { const char* eventLabel = utils::GetLabelForTrace(mComputePipeline->GetLabel().c_str()); @@ -160,6 +168,8 @@ CreateRenderPipelineAsyncTask::CreateRenderPipelineAsyncTask( ASSERT(mRenderPipeline != nullptr); } +CreateRenderPipelineAsyncTask::~CreateRenderPipelineAsyncTask() = default; + void CreateRenderPipelineAsyncTask::Run() { const char* eventLabel = utils::GetLabelForTrace(mRenderPipeline->GetLabel().c_str()); diff --git a/src/dawn/native/CreatePipelineAsyncTask.h b/src/dawn/native/CreatePipelineAsyncTask.h index cd98154074..f461c1d180 100644 --- a/src/dawn/native/CreatePipelineAsyncTask.h +++ b/src/dawn/native/CreatePipelineAsyncTask.h @@ -34,6 +34,7 @@ struct FlatComputePipelineDescriptor; struct CreatePipelineAsyncCallbackTaskBase : CallbackTask { CreatePipelineAsyncCallbackTaskBase(std::string errorMessage, void* userData); + ~CreatePipelineAsyncCallbackTaskBase() override; protected: std::string mErrorMessage; @@ -45,6 +46,7 @@ struct CreateComputePipelineAsyncCallbackTask : CreatePipelineAsyncCallbackTaskB std::string errorMessage, WGPUCreateComputePipelineAsyncCallback callback, void* userdata); + ~CreateComputePipelineAsyncCallbackTask() override; void Finish() override; void HandleShutDown() final; @@ -60,6 +62,7 @@ struct CreateRenderPipelineAsyncCallbackTask : CreatePipelineAsyncCallbackTaskBa std::string errorMessage, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata); + ~CreateRenderPipelineAsyncCallbackTask() override; void Finish() override; void HandleShutDown() final; @@ -77,6 +80,7 @@ class CreateComputePipelineAsyncTask { CreateComputePipelineAsyncTask(Ref nonInitializedComputePipeline, WGPUCreateComputePipelineAsyncCallback callback, void* userdata); + ~CreateComputePipelineAsyncTask(); void Run(); @@ -95,6 +99,7 @@ class CreateRenderPipelineAsyncTask { CreateRenderPipelineAsyncTask(Ref nonInitializedRenderPipeline, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata); + ~CreateRenderPipelineAsyncTask(); void Run(); diff --git a/src/dawn/native/DawnNative.cpp b/src/dawn/native/DawnNative.cpp index e17c0549f7..89c48ac9ac 100644 --- a/src/dawn/native/DawnNative.cpp +++ b/src/dawn/native/DawnNative.cpp @@ -70,6 +70,12 @@ std::vector GetTogglesUsed(WGPUDevice device) { return FromAPI(device)->GetTogglesUsed(); } +// DawnDeviceDescriptor + +DawnDeviceDescriptor::DawnDeviceDescriptor() = default; + +DawnDeviceDescriptor::~DawnDeviceDescriptor() = default; + // Adapter Adapter::Adapter() = default; @@ -119,10 +125,6 @@ std::vector Adapter::GetSupportedFeatures() const { return supportedFeaturesSet.GetEnabledFeatureNames(); } -WGPUDeviceProperties Adapter::GetAdapterProperties() const { - return mImpl->GetAdapterProperties(); -} - bool Adapter::GetLimits(WGPUSupportedLimits* limits) const { return mImpl->GetLimits(FromAPI(limits)); } @@ -189,7 +191,7 @@ Instance::Instance(const WGPUInstanceDescriptor* desc) Instance::~Instance() { if (mImpl != nullptr) { - mImpl->Release(); + mImpl->APIRelease(); mImpl = nullptr; } } @@ -238,6 +240,10 @@ void Instance::SetPlatform(dawn::platform::Platform* platform) { mImpl->SetPlatform(platform); } +uint64_t Instance::GetDeviceCountForTesting() const { + return mImpl->GetDeviceCountForTesting(); +} + WGPUInstance Instance::Get() const { return ToAPI(mImpl); } @@ -250,6 +256,10 @@ size_t GetDeprecationWarningCountForTesting(WGPUDevice device) { return FromAPI(device)->GetDeprecationWarningCountForTesting(); } +size_t GetAdapterCountForTesting(WGPUInstance instance) { + return FromAPI(instance)->GetAdapters().size(); +} + bool IsTextureSubresourceInitialized(WGPUTexture texture, uint32_t baseMipLevel, uint32_t levelCount, @@ -290,6 +300,10 @@ ExternalImageType ExternalImageExportInfo::GetType() const { return mType; } +bool CheckIsErrorForTesting(void* objectHandle) { + return reinterpret_cast(objectHandle)->IsError(); +} + const char* GetObjectLabelForTesting(void* objectHandle) { ApiObjectBase* object = reinterpret_cast(objectHandle); return object->GetLabel().c_str(); diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp index e5cd483815..a83d1853bb 100644 --- a/src/dawn/native/Device.cpp +++ b/src/dawn/native/Device.cpp @@ -20,6 +20,7 @@ #include #include "dawn/common/Log.h" +#include "dawn/common/Version_autogen.h" #include "dawn/native/Adapter.h" #include "dawn/native/AsyncTask.h" #include "dawn/native/AttachmentState.h" @@ -170,7 +171,8 @@ ResultOrError> ValidateLayoutAndGetRenderPipelineDescrip // DeviceBase DeviceBase::DeviceBase(AdapterBase* adapter, const DeviceDescriptor* descriptor) - : mInstance(adapter->GetInstance()), mAdapter(adapter), mNextPipelineCompatibilityToken(1) { + : mAdapter(adapter), mNextPipelineCompatibilityToken(1) { + mAdapter->GetInstance()->IncrementDeviceCountForTesting(); ASSERT(descriptor != nullptr); AdapterProperties adapterProperties; @@ -181,6 +183,8 @@ DeviceBase::DeviceBase(AdapterBase* adapter, const DeviceDescriptor* descriptor) if (togglesDesc != nullptr) { ApplyToggleOverrides(togglesDesc); } + + SetDefaultToggles(); ApplyFeatures(descriptor); DawnCacheDeviceDescriptor defaultCacheDesc = {}; @@ -197,9 +201,6 @@ DeviceBase::DeviceBase(AdapterBase* adapter, const DeviceDescriptor* descriptor) } mFormatTable = BuildFormatTable(this); - SetDefaultToggles(); - - SetWGSLExtensionAllowList(); if (descriptor->label != nullptr && strlen(descriptor->label) != 0) { mLabel = descriptor->label; @@ -208,8 +209,8 @@ DeviceBase::DeviceBase(AdapterBase* adapter, const DeviceDescriptor* descriptor) // Record the cache key from the properties. Note that currently, if a new extension // descriptor is added (and probably handled here), the cache key recording needs to be // updated. - mDeviceCacheKey.Record(adapterProperties, mEnabledFeatures.featuresBitSet, - mEnabledToggles.toggleBitset, cacheDesc); + StreamIn(&mDeviceCacheKey, kDawnVersion, adapterProperties, mEnabledFeatures.featuresBitSet, + mEnabledToggles.toggleBitset, cacheDesc); } DeviceBase::DeviceBase() : mState(State::Alive) { @@ -220,9 +221,15 @@ DeviceBase::~DeviceBase() { // We need to explicitly release the Queue before we complete the destructor so that the // Queue does not get destroyed after the Device. mQueue = nullptr; + // mAdapter is not set for mock test devices. + if (mAdapter != nullptr) { + mAdapter->GetInstance()->DecrementDeviceCountForTesting(); + } } MaybeError DeviceBase::Initialize(Ref defaultQueue) { + SetWGSLExtensionAllowList(); + mQueue = std::move(defaultQueue); #if defined(DAWN_ENABLE_ASSERTS) @@ -268,7 +275,7 @@ MaybeError DeviceBase::Initialize(Ref defaultQueue) { if (IsToggleEnabled(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline)) { // The empty fragment shader, used as a work around for vertex-only render pipeline constexpr char kEmptyFragmentShader[] = R"( - @stage(fragment) fn fs_empty_main() {} + @fragment fn fs_empty_main() {} )"; ShaderModuleDescriptor descriptor; ShaderModuleWGSLDescriptor wgslDesc; @@ -282,6 +289,43 @@ MaybeError DeviceBase::Initialize(Ref defaultQueue) { return {}; } +void DeviceBase::WillDropLastExternalRef() { + // DeviceBase uses RefCountedWithExternalCount to break refcycles. + // + // DeviceBase holds multiple Refs to various API objects (pipelines, buffers, etc.) which are + // used to implement various device-level facilities. These objects are cached on the device, + // so we want to keep them around instead of making transient allocations. However, many of + // the objects also hold a Ref back to their parent device. + // + // In order to break this cycle and prevent leaks, when the application drops the last external + // ref and WillDropLastExternalRef is called, the device clears out any member refs to API + // objects that hold back-refs to the device - thus breaking any reference cycles. + // + // Currently, this is done by calling Destroy on the device to cease all in-flight work and + // drop references to internal objects. We may want to lift this in the future, but it would + // make things more complex because there might be pending tasks which hold a ref back to the + // device - either directly or indirectly. We would need to ensure those tasks don't create new + // reference cycles, and we would need to continuously try draining the pending tasks to clear + // out all remaining refs. + Destroy(); + + // Drop te device's reference to the queue. Because the application dropped the last external + // references, they can no longer get the queue from APIGetQueue(). + mQueue = nullptr; + + // Reset callbacks since after this, since after dropping the last external reference, the + // application may have freed any device-scope memory needed to run the callback. + mUncapturedErrorCallback = [](WGPUErrorType, char const* message, void*) { + dawn::WarningLog() << "Uncaptured error after last external device reference dropped.\n" + << message; + }; + + mDeviceLostCallback = [](WGPUDeviceLostReason, char const* message, void*) { + dawn::WarningLog() << "Device lost after last external device reference dropped.\n" + << message; + }; +} + void DeviceBase::DestroyObjects() { // List of object types in reverse "dependency" order so we can iterate and delete the // objects safely. We define dependent here such that if B has a ref to A, then B depends on @@ -339,6 +383,15 @@ void DeviceBase::Destroy() { return; } + // This function may be called re-entrantly inside APITick(). Tick triggers callbacks + // inside which the application may destroy the device. Thus, we should be careful not + // to delete objects that are needed inside Tick after callbacks have been called. + // - mCallbackTaskManager is not deleted since we flush the callback queue at the end + // of Tick(). Note: that flush should always be emtpy since all callbacks are drained + // inside Destroy() so there should be no outstanding tasks holding objects alive. + // - Similiarly, mAsyncTaskManager is not deleted since we use it to return a status + // from Tick() whether or not there is any more pending work. + // Skip handling device facilities if they haven't even been created (or failed doing so) if (mState != State::BeingCreated) { // The device is being destroyed so it will be lost, call the application callback. @@ -406,9 +459,9 @@ void DeviceBase::Destroy() { // implementations of DestroyImpl checks that we are disconnected before doing work. mState = State::Disconnected; + // Note: mQueue is not released here since the application may still get it after calling + // Destroy() via APIGetQueue. mDynamicUploader = nullptr; - mCallbackTaskManager = nullptr; - mAsyncTaskManager = nullptr; mEmptyBindGroupLayout = nullptr; mInternalPipelineStore = nullptr; mExternalTexturePlaceholderView = nullptr; @@ -570,12 +623,34 @@ bool DeviceBase::APIPopErrorScope(wgpu::ErrorCallback callback, void* userdata) } BlobCache* DeviceBase::GetBlobCache() { +#if TINT_BUILD_WGSL_WRITER + // TODO(crbug.com/dawn/1481): Shader caching currently has a dependency on the WGSL writer to + // generate cache keys. We can lift the dependency once we also cache frontend parsing, + // transformations, and reflection. if (IsToggleEnabled(Toggle::EnableBlobCache)) { - return mInstance->GetBlobCache(); + return mAdapter->GetInstance()->GetBlobCache(); } +#endif return nullptr; } +Blob DeviceBase::LoadCachedBlob(const CacheKey& key) { + BlobCache* blobCache = GetBlobCache(); + if (!blobCache) { + return Blob(); + } + return blobCache->Load(key); +} + +void DeviceBase::StoreCachedBlob(const CacheKey& key, const Blob& blob) { + if (!blob.Empty()) { + BlobCache* blobCache = GetBlobCache(); + if (blobCache) { + blobCache->Store(key, blob); + } + } +} + MaybeError DeviceBase::ValidateObject(const ApiObjectBase* object) const { ASSERT(object != nullptr); DAWN_INVALID_IF(object->GetDevice() != this, @@ -621,7 +696,7 @@ std::mutex* DeviceBase::GetObjectListMutex(ObjectType type) { } AdapterBase* DeviceBase::GetAdapter() const { - return mAdapter; + return mAdapter.Get(); } dawn::platform::Platform* DeviceBase::GetPlatform() const { @@ -1057,7 +1132,7 @@ QuerySetBase* DeviceBase::APICreateQuerySet(const QuerySetDescriptor* descriptor Ref result; if (ConsumedError(CreateQuerySet(descriptor), &result, "calling %s.CreateQuerySet(%s).", this, descriptor)) { - return QuerySetBase::MakeError(this); + return QuerySetBase::MakeError(this, descriptor); } return result.Detach(); } @@ -1140,7 +1215,7 @@ TextureBase* DeviceBase::APICreateTexture(const TextureDescriptor* descriptor) { Ref result; if (ConsumedError(CreateTexture(descriptor), &result, "calling %s.CreateTexture(%s).", this, descriptor)) { - return TextureBase::MakeError(this); + return TextureBase::MakeError(this, descriptor); } return result.Detach(); } @@ -1152,10 +1227,21 @@ BufferBase* DeviceBase::APICreateErrorBuffer() { return BufferBase::MakeError(this, &desc); } +ExternalTextureBase* DeviceBase::APICreateErrorExternalTexture() { + return ExternalTextureBase::MakeError(this); +} + +TextureBase* DeviceBase::APICreateErrorTexture(const TextureDescriptor* desc) { + return TextureBase::MakeError(this, desc); +} + // Other Device API methods // Returns true if future ticking is needed. bool DeviceBase::APITick() { + // Tick may trigger callbacks which drop a ref to the device itself. Hold a Ref to ourselves + // to avoid deleting |this| in the middle of this function call. + Ref self(this); if (IsLost() || ConsumedError(Tick())) { return false; } @@ -1198,6 +1284,11 @@ MaybeError DeviceBase::Tick() { return {}; } +AdapterBase* DeviceBase::APIGetAdapter() { + mAdapter->Reference(); + return mAdapter.Get(); +} + QueueBase* DeviceBase::APIGetQueue() { // Backends gave the primary queue during initialization. ASSERT(mQueue != nullptr); @@ -1236,9 +1327,12 @@ void DeviceBase::SetWGSLExtensionAllowList() { // Set the WGSL extensions allow list based on device's enabled features and other // propority. For example: // mWGSLExtensionAllowList.insert("InternalExtensionForTesting"); + if (IsFeatureEnabled(Feature::ChromiumExperimentalDp4a)) { + mWGSLExtensionAllowList.insert("chromium_experimental_dp4a"); + } } -WGSLExtensionsSet DeviceBase::GetWGSLExtensionAllowList() const { +WGSLExtensionSet DeviceBase::GetWGSLExtensionAllowList() const { return mWGSLExtensionAllowList; } @@ -1316,17 +1410,18 @@ void DeviceBase::APIInjectError(wgpu::ErrorType type, const char* message) { } QueueBase* DeviceBase::GetQueue() const { + ASSERT(mQueue != nullptr); return mQueue.Get(); } // Implementation details of object creation -ResultOrError> DeviceBase::CreateBindGroup( - const BindGroupDescriptor* descriptor) { +ResultOrError> DeviceBase::CreateBindGroup(const BindGroupDescriptor* descriptor, + UsageValidationMode mode) { DAWN_TRY(ValidateIsAlive()); if (IsValidationEnabled()) { - DAWN_TRY_CONTEXT(ValidateBindGroupDescriptor(this, descriptor), "validating %s against %s", - descriptor, descriptor->layout); + DAWN_TRY_CONTEXT(ValidateBindGroupDescriptor(this, descriptor, mode), + "validating %s against %s", descriptor, descriptor->layout); } return CreateBindGroupImpl(descriptor); } @@ -1492,6 +1587,7 @@ ResultOrError> DeviceBase::CreatePipelineLayout( ResultOrError> DeviceBase::CreateExternalTextureImpl( const ExternalTextureDescriptor* descriptor) { + DAWN_TRY(ValidateIsAlive()); if (IsValidationEnabled()) { DAWN_TRY_CONTEXT(ValidateExternalTextureDescriptor(this, descriptor), "validating %s", descriptor); @@ -1837,4 +1933,10 @@ bool DeviceBase::ShouldDuplicateParametersForDrawIndirect( return false; } +uint64_t DeviceBase::GetBufferCopyOffsetAlignmentForDepthStencil() const { + // For depth-stencil texture, buffer offset must be a multiple of 4, which is required + // by WebGPU and Vulkan SPEC. + return 4u; +} + } // namespace dawn::native diff --git a/src/dawn/native/Device.h b/src/dawn/native/Device.h index 37e65d304b..9e4fe037db 100644 --- a/src/dawn/native/Device.h +++ b/src/dawn/native/Device.h @@ -32,8 +32,10 @@ #include "dawn/native/Limits.h" #include "dawn/native/ObjectBase.h" #include "dawn/native/ObjectType_autogen.h" +#include "dawn/native/RefCountedWithExternalCount.h" #include "dawn/native/StagingBuffer.h" #include "dawn/native/Toggles.h" +#include "dawn/native/UsageValidationMode.h" #include "dawn/native/DawnNative.h" #include "dawn/native/dawn_platform.h" @@ -46,6 +48,7 @@ namespace dawn::native { class AsyncTaskManager; class AttachmentState; class AttachmentStateBlueprint; +class Blob; class BlobCache; class CallbackTaskManager; class DynamicUploader; @@ -55,12 +58,12 @@ struct CallbackTask; struct InternalPipelineStore; struct ShaderModuleParseResult; -using WGSLExtensionsSet = std::unordered_set; +using WGSLExtensionSet = std::unordered_set; -class DeviceBase : public RefCounted { +class DeviceBase : public RefCountedWithExternalCount { public: DeviceBase(AdapterBase* adapter, const DeviceDescriptor* descriptor); - virtual ~DeviceBase(); + ~DeviceBase() override; void HandleError(InternalErrorType type, const char* message); @@ -201,7 +204,9 @@ class DeviceBase : public RefCounted { Ref GetOrCreatePipelineCache(const CacheKey& key); // Object creation methods that be used in a reentrant manner. - ResultOrError> CreateBindGroup(const BindGroupDescriptor* descriptor); + ResultOrError> CreateBindGroup( + const BindGroupDescriptor* descriptor, + UsageValidationMode mode = UsageValidationMode::Default); ResultOrError> CreateBindGroupLayout( const BindGroupLayoutDescriptor* descriptor, bool allowInternalBinding = false); @@ -261,11 +266,18 @@ class DeviceBase : public RefCounted { // For Dawn Wire BufferBase* APICreateErrorBuffer(); + ExternalTextureBase* APICreateErrorExternalTexture(); + TextureBase* APICreateErrorTexture(const TextureDescriptor* desc); + AdapterBase* APIGetAdapter(); QueueBase* APIGetQueue(); bool APIGetLimits(SupportedLimits* limits) const; + // Note that we should not use this function to query the features which can only be enabled + // behind toggles (use IsFeatureEnabled() instead). bool APIHasFeature(wgpu::FeatureName feature) const; + // Note that we should not use this function to query the features which can only be enabled + // behind toggles (use IsFeatureEnabled() instead). size_t APIEnumerateFeatures(wgpu::FeatureName* features) const; void APIInjectError(wgpu::ErrorType type, const char* message); bool APITick(); @@ -279,6 +291,8 @@ class DeviceBase : public RefCounted { MaybeError ValidateIsAlive() const; BlobCache* GetBlobCache(); + Blob LoadCachedBlob(const CacheKey& key); + void StoreCachedBlob(const CacheKey& key, const Blob& blob); virtual ResultOrError> CreateStagingBuffer(size_t size) = 0; virtual MaybeError CopyFromStagingToBuffer(StagingBufferBase* source, @@ -319,8 +333,7 @@ class DeviceBase : public RefCounted { std::mutex* GetObjectListMutex(ObjectType type); std::vector GetTogglesUsed() const; - WGSLExtensionsSet GetWGSLExtensionAllowList() const; - bool IsFeatureEnabled(Feature feature) const; + WGSLExtensionSet GetWGSLExtensionAllowList() const; bool IsToggleEnabled(Toggle toggle) const; bool IsValidationEnabled() const; bool IsRobustnessEnabled() const; @@ -350,6 +363,7 @@ class DeviceBase : public RefCounted { // BackendMetadata that we can query from the device. virtual uint32_t GetOptimalBytesPerRowAlignment() const = 0; virtual uint64_t GetOptimalBufferToTextureCopyOffsetAlignment() const = 0; + virtual uint64_t GetBufferCopyOffsetAlignmentForDepthStencil() const; virtual float GetTimestampPeriodInNS() const = 0; @@ -361,6 +375,10 @@ class DeviceBase : public RefCounted { virtual bool ShouldDuplicateParametersForDrawIndirect( const RenderPipelineBase* renderPipelineBase) const; + // TODO(crbug.com/dawn/1434): Make this function non-overridable when we support requesting + // Adapter with toggles. + virtual bool IsFeatureEnabled(Feature feature) const; + const CombinedLimits& GetLimits() const; AsyncTaskManager* GetAsyncTaskManager() const; @@ -400,6 +418,8 @@ class DeviceBase : public RefCounted { void IncrementLastSubmittedCommandSerial(); private: + void WillDropLastExternalRef() override; + virtual ResultOrError> CreateBindGroupImpl( const BindGroupDescriptor* descriptor) = 0; virtual ResultOrError> CreateBindGroupLayoutImpl( @@ -507,12 +527,7 @@ class DeviceBase : public RefCounted { std::unique_ptr mErrorScopeStack; - // The Device keeps a ref to the Instance so that any live Device keeps the Instance alive. - // The Instance shouldn't need to ref child objects so this shouldn't introduce ref cycles. - // The Device keeps a simple pointer to the Adapter because the Adapter is owned by the - // Instance. - Ref mInstance; - AdapterBase* mAdapter = nullptr; + Ref mAdapter; // The object caches aren't exposed in the header as they would require a lot of // additional includes. @@ -549,7 +564,7 @@ class DeviceBase : public RefCounted { CombinedLimits mLimits; FeaturesSet mEnabledFeatures; - WGSLExtensionsSet mWGSLExtensionAllowList; + WGSLExtensionSet mWGSLExtensionAllowList; std::unique_ptr mInternalPipelineStore; diff --git a/src/dawn/native/EncodingContext.cpp b/src/dawn/native/EncodingContext.cpp index 1a91a8e733..d22292716e 100644 --- a/src/dawn/native/EncodingContext.cpp +++ b/src/dawn/native/EncodingContext.cpp @@ -25,7 +25,10 @@ namespace dawn::native { EncodingContext::EncodingContext(DeviceBase* device, const ApiObjectBase* initialEncoder) - : mDevice(device), mTopLevelEncoder(initialEncoder), mCurrentEncoder(initialEncoder) {} + : mDevice(device), + mTopLevelEncoder(initialEncoder), + mCurrentEncoder(initialEncoder), + mDestroyed(device->IsLost()) {} EncodingContext::~EncodingContext() { Destroy(); diff --git a/src/dawn/native/EncodingContext.h b/src/dawn/native/EncodingContext.h index 360790a2a8..020132e527 100644 --- a/src/dawn/native/EncodingContext.h +++ b/src/dawn/native/EncodingContext.h @@ -79,10 +79,13 @@ class EncodingContext { } inline bool CheckCurrentEncoder(const ApiObjectBase* encoder) { + if (mDestroyed) { + HandleError( + DAWN_FORMAT_VALIDATION_ERROR("Recording in a destroyed %s.", mCurrentEncoder)); + return false; + } if (DAWN_UNLIKELY(encoder != mCurrentEncoder)) { - if (mDestroyed) { - HandleError(DAWN_FORMAT_VALIDATION_ERROR("Recording in a destroyed %s.", encoder)); - } else if (mCurrentEncoder != mTopLevelEncoder) { + if (mCurrentEncoder != mTopLevelEncoder) { // The top level encoder was used when a pass encoder was current. HandleError(DAWN_FORMAT_VALIDATION_ERROR( "Command cannot be recorded while %s is active.", mCurrentEncoder)); diff --git a/src/dawn/native/ErrorData.cpp b/src/dawn/native/ErrorData.cpp index 951200b653..ee962403b4 100644 --- a/src/dawn/native/ErrorData.cpp +++ b/src/dawn/native/ErrorData.cpp @@ -35,6 +35,8 @@ std::unique_ptr ErrorData::Create(InternalErrorType type, ErrorData::ErrorData(InternalErrorType type, std::string message) : mType(type), mMessage(std::move(message)) {} +ErrorData::~ErrorData() = default; + void ErrorData::AppendBacktrace(const char* file, const char* function, int line) { BacktraceRecord record; record.file = file; diff --git a/src/dawn/native/ErrorData.h b/src/dawn/native/ErrorData.h index 30e33c6e8a..936252f827 100644 --- a/src/dawn/native/ErrorData.h +++ b/src/dawn/native/ErrorData.h @@ -41,6 +41,7 @@ class [[nodiscard]] ErrorData { const char* function, int line); ErrorData(InternalErrorType type, std::string message); + ~ErrorData(); struct BacktraceRecord { const char* file; diff --git a/src/dawn/native/ErrorScope.cpp b/src/dawn/native/ErrorScope.cpp index fe40d2d17b..b90fb13b6d 100644 --- a/src/dawn/native/ErrorScope.cpp +++ b/src/dawn/native/ErrorScope.cpp @@ -45,6 +45,10 @@ const char* ErrorScope::GetErrorMessage() const { return mErrorMessage.c_str(); } +ErrorScopeStack::ErrorScopeStack() = default; + +ErrorScopeStack::~ErrorScopeStack() = default; + void ErrorScopeStack::Push(wgpu::ErrorFilter filter) { mScopes.push_back(ErrorScope(filter)); } diff --git a/src/dawn/native/ErrorScope.h b/src/dawn/native/ErrorScope.h index 3ffb510a1a..7901d1883b 100644 --- a/src/dawn/native/ErrorScope.h +++ b/src/dawn/native/ErrorScope.h @@ -38,6 +38,9 @@ class ErrorScope { class ErrorScopeStack { public: + ErrorScopeStack(); + ~ErrorScopeStack(); + void Push(wgpu::ErrorFilter errorFilter); ErrorScope Pop(); diff --git a/src/dawn/native/ExternalTexture.cpp b/src/dawn/native/ExternalTexture.cpp index 1cbcb6fdf3..a23faa7bdc 100644 --- a/src/dawn/native/ExternalTexture.cpp +++ b/src/dawn/native/ExternalTexture.cpp @@ -14,6 +14,7 @@ #include "dawn/native/ExternalTexture.h" +#include #include #include "dawn/native/Buffer.h" @@ -56,14 +57,19 @@ MaybeError ValidateExternalTextureDescriptor(const DeviceBase* device, wgpu::TextureFormat plane0Format = descriptor->plane0->GetFormat().format; + DAWN_INVALID_IF(!descriptor->gamutConversionMatrix, + "The gamut conversion matrix must be non-null."); + + DAWN_INVALID_IF(!descriptor->srcTransferFunctionParameters, + "The source transfer function parameters must be non-null."); + + DAWN_INVALID_IF(!descriptor->dstTransferFunctionParameters, + "The destination transfer function parameters must be non-null."); + if (descriptor->plane1) { DAWN_INVALID_IF( - device->IsToggleEnabled(Toggle::DisallowUnsafeAPIs), - "Bi-planar external textures are disabled until the implementation is completed."); - - DAWN_INVALID_IF(descriptor->colorSpace != wgpu::PredefinedColorSpace::Srgb, - "The specified color space (%s) is not %s.", descriptor->colorSpace, - wgpu::PredefinedColorSpace::Srgb); + !descriptor->yuvToRgbConversionMatrix, + "When more than one plane is set, the YUV-to-RGB conversion matrix must be non-null."); DAWN_TRY(device->ValidateObject(descriptor->plane1)); wgpu::TextureFormat plane1Format = descriptor->plane1->GetFormat().format; @@ -117,8 +123,9 @@ ExternalTextureBase::ExternalTextureBase(DeviceBase* device) TrackInDevice(); } +// Error external texture cannot be used in bind group. ExternalTextureBase::ExternalTextureBase(DeviceBase* device, ObjectBase::ErrorTag tag) - : ApiObjectBase(device, tag) {} + : ApiObjectBase(device, tag), mState(ExternalTextureState::Destroyed) {} ExternalTextureBase::~ExternalTextureBase() = default; @@ -143,47 +150,41 @@ MaybeError ExternalTextureBase::Initialize(DeviceBase* device, DAWN_TRY_ASSIGN(mParamsBuffer, device->CreateBuffer(&bufferDesc)); - // Dawn & Tint's YUV-to-RGB conversion implementation is a simple 3x4 matrix multiplication - // using a standard conversion matrix. These matrices can be found in - // chromium/src/third_party/skia/src/core/SkYUVMath.cpp ExternalTextureParams params; params.numPlanes = descriptor->plane1 == nullptr ? 1 : 2; - // TODO(dawn:1082): Make this field configurable from outside of Dawn. - // Conversion matrix for BT.709 limited range. Columns 1, 2 and 3 are copied - // directly from the corresponding matrix in SkYUVMath.cpp. Column 4 is the range - // bias (for RGB) found in column 5 of the same SkYUVMath.cpp matrix. - params.yuvToRgbConversionMatrix = {1.164384f, 0.0f, 1.792741f, -0.972945f, - 1.164384f, -0.213249f, -0.532909f, 0.301483f, - 1.164384f, 2.112402f, 0.0f, -1.133402f}; + params.doYuvToRgbConversionOnly = descriptor->doYuvToRgbConversionOnly ? 1 : 0; - // TODO(dawn:1082): Make this field configurable from outside of Dawn. - // Use an identity matrix when converting BT.709 to sRGB because they shared the - // same primaries. - params.gamutConversionMatrix = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f}; - - switch (descriptor->colorSpace) { - case wgpu::PredefinedColorSpace::Undefined: - // Undefined color space should eventually produce an error. For now, these - // constants will effectively perform no gamma correction so tests can continue - // passing. - params.gammaDecodingParams = {1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0}; - params.gammaEncodingParams = {1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0}; - break; - case wgpu::PredefinedColorSpace::Srgb: - // TODO(dawn:1082): Make this field configurable from outside of Dawn. - // These are the inverted parameters as specified by Rec. ITU-R BT.1886 for BT.709 - params.gammaDecodingParams = {2.2, 1.0 / 1.099, 0.099 / 1.099, 1 / 4.5, 0.081, - 0.0, 0.0}; - - // Constants for sRGB transfer function pulled from - // https://en.wikipedia.org/wiki/SRGB - params.gammaEncodingParams = { - 1 / 2.4, 1.137119 /*1.055^2.4*/, 0.0, 12.92, 0.0031308, -0.055, 0.0}; - break; + // YUV-to-RGB conversion is performed by multiplying the source YUV values with a 4x3 matrix + // passed from Chromium. The matrix was originally sourced from /skia/src/core/SkYUVMath.cpp. + // This matrix is only used in multiplanar scenarios. + if (params.numPlanes == 2) { + ASSERT(descriptor->yuvToRgbConversionMatrix); + const float* yMat = descriptor->yuvToRgbConversionMatrix; + std::copy(yMat, yMat + 12, params.yuvToRgbConversionMatrix.begin()); } + // Gamut correction is performed by multiplying a 3x3 matrix passed from Chromium. The + // matrix was computed by multiplying the appropriate source and destination gamut + // matrices sourced from ui/gfx/color_space.cc. + const float* gMat = descriptor->gamutConversionMatrix; + params.gamutConversionMatrix = {gMat[0], gMat[1], gMat[2], 0.0f, // + gMat[3], gMat[4], gMat[5], 0.0f, // + gMat[6], gMat[7], gMat[8], 0.0f}; + + // Gamma decode/encode is performed by the logic: + // if (abs(v) < params.D) { + // return sign(v) * (params.C * abs(v) + params.F); + // } + // return pow(A * x + B, G) + E + // + // Constants are passed from Chromium and originally sourced from ui/gfx/color_space.cc + const float* srcFn = descriptor->srcTransferFunctionParameters; + std::copy(srcFn, srcFn + 7, params.gammaDecodingParams.begin()); + + const float* dstFn = descriptor->dstTransferFunctionParameters; + std::copy(dstFn, dstFn + 7, params.gammaEncodingParams.begin()); + DAWN_TRY(device->GetQueue()->WriteBuffer(mParamsBuffer.Get(), 0, ¶ms, sizeof(ExternalTextureParams))); diff --git a/src/dawn/native/ExternalTexture.h b/src/dawn/native/ExternalTexture.h index fcb8390780..509a7ee930 100644 --- a/src/dawn/native/ExternalTexture.h +++ b/src/dawn/native/ExternalTexture.h @@ -26,23 +26,14 @@ namespace dawn::native { class TextureViewBase; -struct GammaTransferParams { - float G = 0.0; - float A = 0.0; - float B = 0.0; - float C = 0.0; - float D = 0.0; - float E = 0.0; - float F = 0.0; - uint32_t padding = 0; -}; - struct ExternalTextureParams { uint32_t numPlanes; - std::array padding; + // TODO(crbug.com/dawn/1466): Only go as few steps as necessary. + uint32_t doYuvToRgbConversionOnly; + std::array padding; std::array yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodingParams = {}; - GammaTransferParams gammaEncodingParams = {}; + std::array gammaDecodingParams = {}; + std::array gammaEncodingParams = {}; std::array gamutConversionMatrix = {}; }; diff --git a/src/dawn/native/Features.cpp b/src/dawn/native/Features.cpp index 5621b63071..e43da124e8 100644 --- a/src/dawn/native/Features.cpp +++ b/src/dawn/native/Features.cpp @@ -26,70 +26,61 @@ namespace { struct FeatureEnumAndInfo { Feature feature; FeatureInfo info; - bool WGPUDeviceProperties::*memberInWGPUDeviceProperties; }; using FeatureEnumAndInfoList = std::array(Feature::EnumCount)>; -static constexpr FeatureEnumAndInfoList kFeatureNameAndInfoList = { - {{Feature::TextureCompressionBC, - {"texture-compression-bc", "Support Block Compressed (BC) texture formats", - "https://bugs.chromium.org/p/dawn/issues/detail?id=42"}, - &WGPUDeviceProperties::textureCompressionBC}, - {Feature::TextureCompressionETC2, - {"texture-compression-etc2", - "Support Ericsson Texture Compressed (ETC2/EAC) texture " - "formats", - "https://bugs.chromium.org/p/dawn/issues/detail?id=955"}, - &WGPUDeviceProperties::textureCompressionETC2}, - {Feature::TextureCompressionASTC, - {"texture-compression-astc", - "Support Adaptable Scalable Texture Compressed (ASTC) " - "texture formats", - "https://bugs.chromium.org/p/dawn/issues/detail?id=955"}, - &WGPUDeviceProperties::textureCompressionASTC}, - {Feature::ShaderFloat16, - {"shader-float16", - "Support 16bit float arithmetic and declarations in uniform and storage buffers", - "https://bugs.chromium.org/p/dawn/issues/detail?id=426"}, - &WGPUDeviceProperties::shaderFloat16}, - {Feature::PipelineStatisticsQuery, - {"pipeline-statistics-query", "Support Pipeline Statistics Query", - "https://bugs.chromium.org/p/dawn/issues/detail?id=434"}, - &WGPUDeviceProperties::pipelineStatisticsQuery}, - {Feature::TimestampQuery, - {"timestamp-query", "Support Timestamp Query", - "https://bugs.chromium.org/p/dawn/issues/detail?id=434"}, - &WGPUDeviceProperties::timestampQuery}, - {Feature::DepthClamping, - {"depth-clamping", "Clamp depth to [0, 1] in NDC space instead of clipping", - "https://bugs.chromium.org/p/dawn/issues/detail?id=716"}, - &WGPUDeviceProperties::depthClamping}, - {Feature::Depth24UnormStencil8, - {"depth24unorm-stencil8", "Support depth24unorm-stencil8 texture format", - "https://bugs.chromium.org/p/dawn/issues/detail?id=690"}, - &WGPUDeviceProperties::depth24UnormStencil8}, - {Feature::Depth32FloatStencil8, - {"depth32float-stencil8", "Support depth32float-stencil8 texture format", - "https://bugs.chromium.org/p/dawn/issues/detail?id=690"}, - &WGPUDeviceProperties::depth32FloatStencil8}, - {Feature::DawnInternalUsages, - {"dawn-internal-usages", - "Add internal usages to resources to affect how the texture is allocated, but not " - "frontend validation. Other internal commands may access this usage.", - "https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/dawn/features/" - "dawn_internal_usages.md"}, - &WGPUDeviceProperties::dawnInternalUsages}, - {Feature::MultiPlanarFormats, - {"multiplanar-formats", "Import and use multi-planar texture formats with per plane views", - "https://bugs.chromium.org/p/dawn/issues/detail?id=551"}, - &WGPUDeviceProperties::multiPlanarFormats}, - {Feature::DawnNative, - {"dawn-native", "WebGPU is running on top of dawn_native.", - "https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/dawn/features/" - "dawn_native.md"}, - &WGPUDeviceProperties::dawnNative}}}; +static constexpr FeatureEnumAndInfoList kFeatureNameAndInfoList = {{ + {Feature::TextureCompressionBC, + {"texture-compression-bc", "Support Block Compressed (BC) texture formats", + "https://bugs.chromium.org/p/dawn/issues/detail?id=42"}}, + {Feature::TextureCompressionETC2, + {"texture-compression-etc2", + "Support Ericsson Texture Compressed (ETC2/EAC) texture " + "formats", + "https://bugs.chromium.org/p/dawn/issues/detail?id=955"}}, + {Feature::TextureCompressionASTC, + {"texture-compression-astc", + "Support Adaptable Scalable Texture Compressed (ASTC) " + "texture formats", + "https://bugs.chromium.org/p/dawn/issues/detail?id=955"}}, + {Feature::ShaderFloat16, + {"shader-float16", + "Support 16bit float arithmetic and declarations in uniform and storage buffers", + "https://bugs.chromium.org/p/dawn/issues/detail?id=426"}}, + {Feature::PipelineStatisticsQuery, + {"pipeline-statistics-query", "Support Pipeline Statistics Query", + "https://bugs.chromium.org/p/dawn/issues/detail?id=434"}}, + {Feature::TimestampQuery, + {"timestamp-query", "Support Timestamp Query", + "https://bugs.chromium.org/p/dawn/issues/detail?id=434"}}, + {Feature::DepthClipControl, + {"depth-clip-control", "Disable depth clipping of primitives to the clip volume", + "https://bugs.chromium.org/p/dawn/issues/detail?id=1178"}}, + {Feature::Depth32FloatStencil8, + {"depth32float-stencil8", "Support depth32float-stencil8 texture format", + "https://bugs.chromium.org/p/dawn/issues/detail?id=690"}}, + {Feature::ChromiumExperimentalDp4a, + {"chromium-experimental-dp4a", "Support experimental DP4a instructions in WGSL", + "https://bugs.chromium.org/p/tint/issues/detail?id=1497"}}, + {Feature::IndirectFirstInstance, + {"indirect-first-instance", "Support non-zero first instance values on indirect draw calls", + "https://bugs.chromium.org/p/dawn/issues/detail?id=1197"}}, + {Feature::DawnInternalUsages, + {"dawn-internal-usages", + "Add internal usages to resources to affect how the texture is allocated, but not " + "frontend validation. Other internal commands may access this usage.", + "https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/dawn/features/" + "dawn_internal_usages.md"}}, + {Feature::MultiPlanarFormats, + {"multiplanar-formats", "Import and use multi-planar texture formats with per plane views", + "https://bugs.chromium.org/p/dawn/issues/detail?id=551"}}, + {Feature::DawnNative, + {"dawn-native", "WebGPU is running on top of dawn_native.", + "https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/dawn/features/" + "dawn_native.md"}}, +}}; Feature FromAPIFeature(wgpu::FeatureName feature) { switch (feature) { @@ -106,12 +97,12 @@ Feature FromAPIFeature(wgpu::FeatureName feature) { return Feature::TextureCompressionETC2; case wgpu::FeatureName::TextureCompressionASTC: return Feature::TextureCompressionASTC; - case wgpu::FeatureName::DepthClamping: - return Feature::DepthClamping; - case wgpu::FeatureName::Depth24UnormStencil8: - return Feature::Depth24UnormStencil8; + case wgpu::FeatureName::DepthClipControl: + return Feature::DepthClipControl; case wgpu::FeatureName::Depth32FloatStencil8: return Feature::Depth32FloatStencil8; + case wgpu::FeatureName::IndirectFirstInstance: + return Feature::IndirectFirstInstance; case wgpu::FeatureName::DawnShaderFloat16: return Feature::ShaderFloat16; case wgpu::FeatureName::DawnInternalUsages: @@ -120,9 +111,8 @@ Feature FromAPIFeature(wgpu::FeatureName feature) { return Feature::MultiPlanarFormats; case wgpu::FeatureName::DawnNative: return Feature::DawnNative; - - case wgpu::FeatureName::IndirectFirstInstance: - return Feature::InvalidEnum; + case wgpu::FeatureName::ChromiumExperimentalDp4a: + return Feature::ChromiumExperimentalDp4a; } return Feature::InvalidEnum; } @@ -139,12 +129,12 @@ wgpu::FeatureName ToAPIFeature(Feature feature) { return wgpu::FeatureName::PipelineStatisticsQuery; case Feature::TimestampQuery: return wgpu::FeatureName::TimestampQuery; - case Feature::DepthClamping: - return wgpu::FeatureName::DepthClamping; - case Feature::Depth24UnormStencil8: - return wgpu::FeatureName::Depth24UnormStencil8; + case Feature::DepthClipControl: + return wgpu::FeatureName::DepthClipControl; case Feature::Depth32FloatStencil8: return wgpu::FeatureName::Depth32FloatStencil8; + case Feature::IndirectFirstInstance: + return wgpu::FeatureName::IndirectFirstInstance; case Feature::ShaderFloat16: return wgpu::FeatureName::DawnShaderFloat16; case Feature::DawnInternalUsages: @@ -153,6 +143,8 @@ wgpu::FeatureName ToAPIFeature(Feature feature) { return wgpu::FeatureName::DawnMultiPlanarFormats; case Feature::DawnNative: return wgpu::FeatureName::DawnNative; + case Feature::ChromiumExperimentalDp4a: + return wgpu::FeatureName::ChromiumExperimentalDp4a; case Feature::EnumCount: break; @@ -211,14 +203,6 @@ std::vector FeaturesSet::GetEnabledFeatureNames() const { return enabledFeatureNames; } -void FeaturesSet::InitializeDeviceProperties(WGPUDeviceProperties* properties) const { - ASSERT(properties != nullptr); - - for (uint32_t i : IterateBitSet(featuresBitSet)) { - properties->*(kFeatureNameAndInfoList[i].memberInWGPUDeviceProperties) = true; - } -} - wgpu::FeatureName FeatureEnumToAPIFeature(Feature feature) { ASSERT(feature != Feature::InvalidEnum); return ToAPIFeature(feature); @@ -232,6 +216,8 @@ FeaturesInfo::FeaturesInfo() { } } +FeaturesInfo::~FeaturesInfo() = default; + const FeatureInfo* FeaturesInfo::GetFeatureInfo(wgpu::FeatureName feature) const { Feature f = FromAPIFeature(feature); if (f == Feature::InvalidEnum) { diff --git a/src/dawn/native/Features.h b/src/dawn/native/Features.h index bb1f015ddd..f97fd9df67 100644 --- a/src/dawn/native/Features.h +++ b/src/dawn/native/Features.h @@ -33,9 +33,10 @@ enum class Feature { ShaderFloat16, PipelineStatisticsQuery, TimestampQuery, - DepthClamping, - Depth24UnormStencil8, + DepthClipControl, Depth32FloatStencil8, + ChromiumExperimentalDp4a, + IndirectFirstInstance, // Dawn-specific DawnInternalUsages, @@ -60,7 +61,6 @@ struct FeaturesSet { // non-null. size_t EnumerateFeatures(wgpu::FeatureName* features) const; std::vector GetEnabledFeatureNames() const; - void InitializeDeviceProperties(WGPUDeviceProperties* properties) const; }; wgpu::FeatureName FeatureEnumToAPIFeature(Feature feature); @@ -68,6 +68,7 @@ wgpu::FeatureName FeatureEnumToAPIFeature(Feature feature); class FeaturesInfo { public: FeaturesInfo(); + ~FeaturesInfo(); // Used to query the details of an feature. Return nullptr if featureName is not a valid // name of an feature supported in Dawn diff --git a/src/dawn/native/Format.cpp b/src/dawn/native/Format.cpp index 905d2900a8..8905b27a5a 100644 --- a/src/dawn/native/Format.cpp +++ b/src/dawn/native/Format.cpp @@ -245,7 +245,7 @@ FormatTable BuildFormatTable(const DeviceBase* device) { firstAspect->block.width = 1; firstAspect->block.height = 1; firstAspect->baseType = wgpu::TextureComponentType::Float; - firstAspect->supportedSampleTypes = SampleTypeBit::Depth; + firstAspect->supportedSampleTypes = SampleTypeBit::Depth | SampleTypeBit::UnfilterableFloat; firstAspect->format = format; AddFormat(internalFormat); }; @@ -403,9 +403,6 @@ FormatTable BuildFormatTable(const DeviceBase* device) { AddDepthFormat(wgpu::TextureFormat::Depth24Plus, 4, true); AddMultiAspectFormat(wgpu::TextureFormat::Depth24PlusStencil8, Aspect::Depth | Aspect::Stencil, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Stencil8, true, true, true, 2); - bool isD24S8Supported = device->IsFeatureEnabled(Feature::Depth24UnormStencil8); - AddMultiAspectFormat(wgpu::TextureFormat::Depth24UnormStencil8, - Aspect::Depth | Aspect::Stencil, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Stencil8, true, isD24S8Supported, true, 2); AddDepthFormat(wgpu::TextureFormat::Depth32Float, 4, true); bool isD32S8Supported = device->IsFeatureEnabled(Feature::Depth32FloatStencil8); AddMultiAspectFormat(wgpu::TextureFormat::Depth32FloatStencil8, @@ -480,7 +477,8 @@ FormatTable BuildFormatTable(const DeviceBase* device) { // clang-format on // This checks that each format is set at least once, the second part of checking that all - // formats are checked exactly once. + // formats are checked exactly once. If this assertion is failing and texture formats have been + // added or removed recently, check that kKnownFormatCount has been updated. ASSERT(formatsSet.all()); return table; diff --git a/src/dawn/native/Format.h b/src/dawn/native/Format.h index b48e998f1d..e192a2ce83 100644 --- a/src/dawn/native/Format.h +++ b/src/dawn/native/Format.h @@ -72,14 +72,14 @@ struct AspectInfo { TexelBlockInfo block; // TODO(crbug.com/dawn/367): Replace TextureComponentType with TextureSampleType, or make it // an internal Dawn enum. - wgpu::TextureComponentType baseType; - SampleTypeBit supportedSampleTypes; + wgpu::TextureComponentType baseType{}; + SampleTypeBit supportedSampleTypes{}; wgpu::TextureFormat format = wgpu::TextureFormat::Undefined; }; // The number of formats Dawn knows about. Asserts in BuildFormatTable ensure that this is the // exact number of known format. -static constexpr uint32_t kKnownFormatCount = 96; +static constexpr uint32_t kKnownFormatCount = 95; using FormatIndex = TypedInteger; @@ -88,19 +88,19 @@ using FormatTable = ityp::array; // A wgpu::TextureFormat along with all the information about it necessary for validation. struct Format { - wgpu::TextureFormat format; + wgpu::TextureFormat format = wgpu::TextureFormat::Undefined; // TODO(crbug.com/dawn/1332): These members could be stored in a Format capability matrix. - bool isRenderable; - bool isCompressed; + bool isRenderable = false; + bool isCompressed = false; // A format can be known but not supported because it is part of a disabled extension. - bool isSupported; - bool supportsStorageUsage; - bool supportsMultisample; - bool supportsResolveTarget; - Aspect aspects; + bool isSupported = false; + bool supportsStorageUsage = false; + bool supportsMultisample = false; + bool supportsResolveTarget = false; + Aspect aspects{}; // Only used for renderable color formats, number of color channels. - uint8_t componentCount; + uint8_t componentCount = 0; bool IsColor() const; bool HasDepth() const; @@ -121,7 +121,7 @@ struct Format { // baseFormat represents the memory layout of the format. // If two formats has the same baseFormat, they could copy to and be viewed as the other // format. Currently two formats have the same baseFormat if they differ only in sRGB-ness. - wgpu::TextureFormat baseFormat; + wgpu::TextureFormat baseFormat = wgpu::TextureFormat::Undefined; // Returns true if the formats are copy compatible. // Currently means they differ only in sRGB-ness. @@ -136,7 +136,7 @@ struct Format { // only the first aspect info or aspectInfo[0] is valid. For depth-stencil, the first aspect // info is depth and the second aspect info is stencil. For multi-planar formats, // aspectInfo[i] is the ith plane. - std::array aspectInfo; + std::array aspectInfo{}; friend FormatTable BuildFormatTable(const DeviceBase* device); }; diff --git a/src/dawn/native/IndirectDrawValidationEncoder.cpp b/src/dawn/native/IndirectDrawValidationEncoder.cpp index 2c20820ad3..abd09cd112 100644 --- a/src/dawn/native/IndirectDrawValidationEncoder.cpp +++ b/src/dawn/native/IndirectDrawValidationEncoder.cpp @@ -43,6 +43,7 @@ constexpr uint64_t kWorkgroupSize = 64; constexpr uint32_t kDuplicateBaseVertexInstance = 1; constexpr uint32_t kIndexedDraw = 2; constexpr uint32_t kValidationEnabled = 4; +constexpr uint32_t kIndirectFirstInstanceEnabled = 8; // Equivalent to the BatchInfo struct defined in the shader below. struct BatchInfo { @@ -64,6 +65,7 @@ static const char sRenderValidationShaderSource[] = R"( let kDuplicateBaseVertexInstance = 1u; let kIndexedDraw = 2u; let kValidationEnabled = 4u; + let kIndirectFirstInstanceEnabled = 8u; struct BatchInfo { numIndexBufferElementsLow: u32, @@ -79,7 +81,7 @@ static const char sRenderValidationShaderSource[] = R"( @group(0) @binding(0) var batch: BatchInfo; @group(0) @binding(1) var inputParams: IndirectParams; - @group(0) @binding(2) var outputParams: IndirectParams; + @group(0) @binding(2) var outputParams: IndirectParams; fn numIndirectParamsPerDrawCallInput() -> u32 { var numParams = kNumDrawIndirectParams; @@ -128,7 +130,7 @@ static const char sRenderValidationShaderSource[] = R"( } } - @stage(compute) @workgroup_size(64, 1, 1) + @compute @workgroup_size(64, 1, 1) fn main(@builtin(global_invocation_id) id : vec3) { if (id.x >= batch.numDraws) { return; @@ -140,11 +142,13 @@ static const char sRenderValidationShaderSource[] = R"( } let inputIndex = batch.indirectOffsets[id.x]; - // firstInstance is always the last parameter - let firstInstance = inputParams.data[inputIndex + numIndirectParamsPerDrawCallInput() - 1u]; - if (firstInstance != 0u) { - fail(id.x); - return; + if(!bool(batch.flags & kIndirectFirstInstanceEnabled)) { + // firstInstance is always the last parameter + let firstInstance = inputParams.data[inputIndex + numIndirectParamsPerDrawCallInput() - 1u]; + if (firstInstance != 0u) { + fail(id.x); + return; + } } if (!bool(batch.flags & kIndexedDraw)) { @@ -334,6 +338,9 @@ MaybeError EncodeIndirectDrawValidationCommands(DeviceBase* device, if (device->IsValidationEnabled()) { newPass.flags |= kValidationEnabled; } + if (device->IsFeatureEnabled(Feature::IndirectFirstInstance)) { + newPass.flags |= kIndirectFirstInstanceEnabled; + } passes.push_back(std::move(newPass)); } } diff --git a/src/dawn/native/Instance.cpp b/src/dawn/native/Instance.cpp index 34436b2798..78afd8ed8e 100644 --- a/src/dawn/native/Instance.cpp +++ b/src/dawn/native/Instance.cpp @@ -95,8 +95,7 @@ BackendsBitset GetEnabledBackends() { dawn::platform::CachingInterface* GetCachingInterface(dawn::platform::Platform* platform) { if (platform != nullptr) { - return platform->GetCachingInterface(/*fingerprint*/ nullptr, - /*fingerprintSize*/ 0); + return platform->GetCachingInterface(); } return nullptr; } @@ -104,7 +103,7 @@ dawn::platform::CachingInterface* GetCachingInterface(dawn::platform::Platform* } // anonymous namespace InstanceBase* APICreateInstance(const InstanceDescriptor* descriptor) { - return InstanceBase::Create().Detach(); + return InstanceBase::Create(descriptor).Detach(); } // InstanceBase @@ -122,6 +121,21 @@ Ref InstanceBase::Create(const InstanceDescriptor* descriptor) { return instance; } +InstanceBase::InstanceBase() = default; + +InstanceBase::~InstanceBase() = default; + +void InstanceBase::WillDropLastExternalRef() { + // InstanceBase uses RefCountedWithExternalCount to break refcycles. + // + // InstanceBase holds Refs to AdapterBases it has discovered, which hold Refs back to the + // InstanceBase. + // In order to break this cycle and prevent leaks, when the application drops the last external + // ref and WillDropLastExternalRef is called, the instance clears out any member refs to + // adapters that hold back-refs to the instance - thus breaking any reference cycles. + mAdapters.clear(); +} + // TODO(crbug.com/dawn/832): make the platform an initialization parameter of the instance. MaybeError InstanceBase::Initialize(const InstanceDescriptor* descriptor) { DAWN_TRY(ValidateSingleSType(descriptor->nextInChain, wgpu::SType::DawnInstanceDescriptor)); @@ -177,7 +191,14 @@ ResultOrError> InstanceBase::RequestAdapterInternal( if (GetEnabledBackends()[wgpu::BackendType::Vulkan]) { dawn_native::vulkan::AdapterDiscoveryOptions vulkanOptions; vulkanOptions.forceSwiftShader = true; - DAWN_TRY(DiscoverAdaptersInternal(&vulkanOptions)); + + MaybeError result = DiscoverAdaptersInternal(&vulkanOptions); + if (result.IsError()) { + dawn::WarningLog() << absl::StrFormat( + "Skipping Vulkan Swiftshader adapter because initialization failed: %s", + result.AcquireError()->GetFormattedMessage()); + return Ref(nullptr); + } } #else return Ref(nullptr); @@ -207,7 +228,7 @@ ResultOrError> InstanceBase::RequestAdapterInternal( mAdapters[i]->APIGetProperties(&properties); if (options->forceFallbackAdapter) { - if (!gpu_info::IsSwiftshader(properties.vendorID, properties.deviceID)) { + if (!gpu_info::IsGoogleSwiftshader(properties.vendorID, properties.deviceID)) { continue; } return mAdapters[i]; @@ -273,7 +294,16 @@ void InstanceBase::DiscoverDefaultAdapters() { // This is just a wrapper around the real logic that uses Error.h error handling. bool InstanceBase::DiscoverAdapters(const AdapterDiscoveryOptionsBase* options) { - return !ConsumedError(DiscoverAdaptersInternal(options)); + MaybeError result = DiscoverAdaptersInternal(options); + + if (result.IsError()) { + dawn::WarningLog() << absl::StrFormat( + "Skipping %s adapter because initialization failed: %s", FromAPI(options->backendType), + result.AcquireError()->GetFormattedMessage()); + return false; + } + + return true; } const ToggleInfo* InstanceBase::GetToggleInfo(const char* toggleName) { @@ -383,10 +413,7 @@ MaybeError InstanceBase::DiscoverAdaptersInternal(const AdapterDiscoveryOptionsB bool InstanceBase::ConsumedError(MaybeError maybeError) { if (maybeError.IsError()) { - std::unique_ptr error = maybeError.AcquireError(); - - ASSERT(error != nullptr); - dawn::ErrorLog() << error->GetFormattedMessage(); + ConsumeError(maybeError.AcquireError()); return true; } return false; @@ -433,10 +460,27 @@ BlobCache* InstanceBase::GetBlobCache() { return mBlobCache.get(); } +uint64_t InstanceBase::GetDeviceCountForTesting() const { + return mDeviceCountForTesting.load(); +} + +void InstanceBase::IncrementDeviceCountForTesting() { + mDeviceCountForTesting++; +} + +void InstanceBase::DecrementDeviceCountForTesting() { + mDeviceCountForTesting--; +} + const std::vector& InstanceBase::GetRuntimeSearchPaths() const { return mRuntimeSearchPaths; } +void InstanceBase::ConsumeError(std::unique_ptr error) { + ASSERT(error != nullptr); + dawn::ErrorLog() << error->GetFormattedMessage(); +} + const XlibXcbFunctions* InstanceBase::GetOrCreateXlibXcbFunctions() { #if defined(DAWN_USE_X11) if (mXlibXcbFunctions == nullptr) { @@ -450,7 +494,7 @@ const XlibXcbFunctions* InstanceBase::GetOrCreateXlibXcbFunctions() { Surface* InstanceBase::APICreateSurface(const SurfaceDescriptor* descriptor) { if (ConsumedError(ValidateSurfaceDescriptor(this, descriptor))) { - return nullptr; + return Surface::MakeError(this); } return new Surface(this, descriptor); diff --git a/src/dawn/native/Instance.h b/src/dawn/native/Instance.h index 578ee695b1..0589061069 100644 --- a/src/dawn/native/Instance.h +++ b/src/dawn/native/Instance.h @@ -27,6 +27,7 @@ #include "dawn/native/BackendConnection.h" #include "dawn/native/BlobCache.h" #include "dawn/native/Features.h" +#include "dawn/native/RefCountedWithExternalCount.h" #include "dawn/native/Toggles.h" #include "dawn/native/dawn_platform.h" @@ -45,7 +46,7 @@ InstanceBase* APICreateInstance(const InstanceDescriptor* descriptor); // This is called InstanceBase for consistency across the frontend, even if the backends don't // specialize this class. -class InstanceBase final : public RefCounted { +class InstanceBase final : public RefCountedWithExternalCount { public: static Ref Create(const InstanceDescriptor* descriptor = nullptr); @@ -61,6 +62,16 @@ class InstanceBase final : public RefCounted { // Used to handle error that happen up to device creation. bool ConsumedError(MaybeError maybeError); + template + bool ConsumedError(ResultOrError resultOrError, T* result) { + if (resultOrError.IsError()) { + ConsumeError(resultOrError.AcquireError()); + return true; + } + *result = resultOrError.AcquireSuccess(); + return false; + } + // Used to query the details of a toggle. Return nullptr if toggleName is not a valid name // of a toggle supported in Dawn. const ToggleInfo* GetToggleInfo(const char* toggleName); @@ -84,6 +95,10 @@ class InstanceBase final : public RefCounted { dawn::platform::Platform* GetPlatform(); BlobCache* GetBlobCache(); + uint64_t GetDeviceCountForTesting() const; + void IncrementDeviceCountForTesting(); + void DecrementDeviceCountForTesting(); + const std::vector& GetRuntimeSearchPaths() const; // Get backend-independent libraries that need to be loaded dynamically. @@ -93,8 +108,10 @@ class InstanceBase final : public RefCounted { Surface* APICreateSurface(const SurfaceDescriptor* descriptor); private: - InstanceBase() = default; - ~InstanceBase() = default; + InstanceBase(); + ~InstanceBase() override; + + void WillDropLastExternalRef() override; InstanceBase(const InstanceBase& other) = delete; InstanceBase& operator=(const InstanceBase& other) = delete; @@ -108,6 +125,8 @@ class InstanceBase final : public RefCounted { ResultOrError> RequestAdapterInternal(const RequestAdapterOptions* options); + void ConsumeError(std::unique_ptr error); + std::vector mRuntimeSearchPaths; BackendsBitset mBackendsConnected; @@ -130,6 +149,8 @@ class InstanceBase final : public RefCounted { #if defined(DAWN_USE_X11) std::unique_ptr mXlibXcbFunctions; #endif // defined(DAWN_USE_X11) + + std::atomic_uint64_t mDeviceCountForTesting{0}; }; } // namespace dawn::native diff --git a/src/dawn/native/InternalPipelineStore.h b/src/dawn/native/InternalPipelineStore.h index 3defe67260..b8386d5d1d 100644 --- a/src/dawn/native/InternalPipelineStore.h +++ b/src/dawn/native/InternalPipelineStore.h @@ -17,6 +17,7 @@ #include +#include "dawn/native/ApplyClearColorValueWithDrawHelper.h" #include "dawn/native/ObjectBase.h" #include "dawn/native/ScratchBuffer.h" #include "dawn/native/dawn_platform.h" @@ -40,6 +41,8 @@ struct InternalPipelineStore { Ref timestampComputePipeline; Ref timestampCS; + ApplyClearColorValueWithDrawPipelinesCache applyClearColorValueWithDrawPipelines; + Ref placeholderFragmentShader; // A scratch buffer suitable for use as a copy destination and storage binding. diff --git a/src/dawn/native/Limits.cpp b/src/dawn/native/Limits.cpp index 2ee5d69e6b..ef285b2a4d 100644 --- a/src/dawn/native/Limits.cpp +++ b/src/dawn/native/Limits.cpp @@ -23,7 +23,7 @@ // TODO(crbug.com/dawn/685): // For now, only expose these tiers until metrics can determine better ones. #define LIMITS_WORKGROUP_STORAGE_SIZE(X) \ - X(Maximum, maxComputeWorkgroupStorageSize, 16352, 32768, 49152, 65536) + X(Maximum, maxComputeWorkgroupStorageSize, 16384, 32768, 49152, 65536) #define LIMITS_STORAGE_BUFFER_BINDING_SIZE(X) \ X(Maximum, maxStorageBufferBindingSize, 134217728, 1073741824, 2147483647, 4294967295) @@ -51,6 +51,8 @@ X(Maximum, maxVertexAttributes, 16, 16) \ X(Maximum, maxVertexBufferArrayStride, 2048, 2048) \ X(Maximum, maxInterStageShaderComponents, 60, 60) \ + X(Maximum, maxInterStageShaderVariables, 16, 16) \ + X(Maximum, maxColorAttachments, 8, 8) \ X(Maximum, maxComputeInvocationsPerWorkgroup, 256, 256) \ X(Maximum, maxComputeWorkgroupSizeX, 256, 256) \ X(Maximum, maxComputeWorkgroupSizeY, 256, 256) \ diff --git a/src/dawn/native/ObjectBase.cpp b/src/dawn/native/ObjectBase.cpp index d549195760..763129bf10 100644 --- a/src/dawn/native/ObjectBase.cpp +++ b/src/dawn/native/ObjectBase.cpp @@ -22,16 +22,19 @@ namespace dawn::native { static constexpr uint64_t kErrorPayload = 0; static constexpr uint64_t kNotErrorPayload = 1; -ObjectBase::ObjectBase(DeviceBase* device) : RefCounted(kNotErrorPayload), mDevice(device) {} +ErrorMonad::ErrorMonad() : RefCounted(kNotErrorPayload) {} +ErrorMonad::ErrorMonad(ErrorTag) : RefCounted(kErrorPayload) {} -ObjectBase::ObjectBase(DeviceBase* device, ErrorTag) : RefCounted(kErrorPayload), mDevice(device) {} - -DeviceBase* ObjectBase::GetDevice() const { - return mDevice; +bool ErrorMonad::IsError() const { + return GetRefCountPayload() == kErrorPayload; } -bool ObjectBase::IsError() const { - return GetRefCountPayload() == kErrorPayload; +ObjectBase::ObjectBase(DeviceBase* device) : ErrorMonad(), mDevice(device) {} + +ObjectBase::ObjectBase(DeviceBase* device, ErrorTag) : ErrorMonad(kError), mDevice(device) {} + +DeviceBase* ObjectBase::GetDevice() const { + return mDevice.Get(); } ApiObjectBase::ApiObjectBase(DeviceBase* device, const char* label) : ObjectBase(device) { diff --git a/src/dawn/native/ObjectBase.h b/src/dawn/native/ObjectBase.h index 1060f01313..5ebaad0b90 100644 --- a/src/dawn/native/ObjectBase.h +++ b/src/dawn/native/ObjectBase.h @@ -25,20 +25,27 @@ namespace dawn::native { class DeviceBase; -class ObjectBase : public RefCounted { +class ErrorMonad : public RefCounted { public: struct ErrorTag {}; static constexpr ErrorTag kError = {}; + ErrorMonad(); + explicit ErrorMonad(ErrorTag tag); + + bool IsError() const; +}; + +class ObjectBase : public ErrorMonad { + public: explicit ObjectBase(DeviceBase* device); ObjectBase(DeviceBase* device, ErrorTag tag); DeviceBase* GetDevice() const; - bool IsError() const; private: - // Pointer to owning device. - DeviceBase* mDevice; + // Ref to owning device. + Ref mDevice; }; class ApiObjectBase : public ObjectBase, public LinkNode { diff --git a/src/dawn/native/PassResourceUsage.cpp b/src/dawn/native/PassResourceUsage.cpp new file mode 100644 index 0000000000..fc9ed33de8 --- /dev/null +++ b/src/dawn/native/PassResourceUsage.cpp @@ -0,0 +1,23 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/PassResourceUsage.h" + +namespace dawn::native { + +ComputePassResourceUsage::ComputePassResourceUsage() = default; + +ComputePassResourceUsage::ComputePassResourceUsage(ComputePassResourceUsage&&) = default; + +} // namespace dawn::native diff --git a/src/dawn/native/PassResourceUsage.h b/src/dawn/native/PassResourceUsage.h index 1fa4130503..c22498fb32 100644 --- a/src/dawn/native/PassResourceUsage.h +++ b/src/dawn/native/PassResourceUsage.h @@ -58,8 +58,8 @@ struct ComputePassResourceUsage { // Somehow without this defaulted constructor, MSVC or its STDlib have an issue where they // use the copy constructor (that's deleted) when doing operations on a // vector - ComputePassResourceUsage(ComputePassResourceUsage&&) = default; - ComputePassResourceUsage() = default; + ComputePassResourceUsage(ComputePassResourceUsage&&); + ComputePassResourceUsage(); std::vector dispatchUsages; diff --git a/src/dawn/native/PassResourceUsageTracker.cpp b/src/dawn/native/PassResourceUsageTracker.cpp index f6c56a2ee2..e1f1ae6b32 100644 --- a/src/dawn/native/PassResourceUsageTracker.cpp +++ b/src/dawn/native/PassResourceUsageTracker.cpp @@ -26,6 +26,14 @@ namespace dawn::native { +SyncScopeUsageTracker::SyncScopeUsageTracker() = default; + +SyncScopeUsageTracker::SyncScopeUsageTracker(SyncScopeUsageTracker&&) = default; + +SyncScopeUsageTracker::~SyncScopeUsageTracker() = default; + +SyncScopeUsageTracker& SyncScopeUsageTracker::operator=(SyncScopeUsageTracker&&) = default; + void SyncScopeUsageTracker::BufferUsedAs(BufferBase* buffer, wgpu::BufferUsage usage) { // std::map's operator[] will create the key and return 0 if the key didn't exist // before. @@ -154,7 +162,7 @@ SyncScopeResourceUsage SyncScopeUsageTracker::AcquireSyncScopeUsage() { result.textureUsages.push_back(std::move(usage)); } - for (auto& it : mExternalTextureUsages) { + for (auto* const it : mExternalTextureUsages) { result.externalTextures.push_back(it); } @@ -165,6 +173,10 @@ SyncScopeResourceUsage SyncScopeUsageTracker::AcquireSyncScopeUsage() { return result; } +ComputePassResourceUsageTracker::ComputePassResourceUsageTracker() = default; + +ComputePassResourceUsageTracker::~ComputePassResourceUsageTracker() = default; + void ComputePassResourceUsageTracker::AddDispatch(SyncScopeResourceUsage scope) { mUsage.dispatchUsages.push_back(std::move(scope)); } @@ -206,6 +218,16 @@ ComputePassResourceUsage ComputePassResourceUsageTracker::AcquireResourceUsage() return std::move(mUsage); } +RenderPassResourceUsageTracker::RenderPassResourceUsageTracker() = default; + +RenderPassResourceUsageTracker::RenderPassResourceUsageTracker(RenderPassResourceUsageTracker&&) = + default; + +RenderPassResourceUsageTracker::~RenderPassResourceUsageTracker() = default; + +RenderPassResourceUsageTracker& RenderPassResourceUsageTracker::operator=( + RenderPassResourceUsageTracker&&) = default; + RenderPassResourceUsage RenderPassResourceUsageTracker::AcquireResourceUsage() { RenderPassResourceUsage result; *static_cast(&result) = AcquireSyncScopeUsage(); diff --git a/src/dawn/native/PassResourceUsageTracker.h b/src/dawn/native/PassResourceUsageTracker.h index 89ae2a9fc8..c18d52efba 100644 --- a/src/dawn/native/PassResourceUsageTracker.h +++ b/src/dawn/native/PassResourceUsageTracker.h @@ -36,6 +36,12 @@ using QueryAvailabilityMap = std::map>; // Helper class to build SyncScopeResourceUsages class SyncScopeUsageTracker { public: + SyncScopeUsageTracker(); + SyncScopeUsageTracker(SyncScopeUsageTracker&&); + ~SyncScopeUsageTracker(); + + SyncScopeUsageTracker& operator=(SyncScopeUsageTracker&&); + void BufferUsedAs(BufferBase* buffer, wgpu::BufferUsage usage); void TextureViewUsedAs(TextureViewBase* texture, wgpu::TextureUsage usage); void AddRenderBundleTextureUsage(TextureBase* texture, @@ -56,6 +62,9 @@ class SyncScopeUsageTracker { // Helper class to build ComputePassResourceUsages class ComputePassResourceUsageTracker { public: + ComputePassResourceUsageTracker(); + ~ComputePassResourceUsageTracker(); + void AddDispatch(SyncScopeResourceUsage scope); void AddReferencedBuffer(BufferBase* buffer); void AddResourcesReferencedByBindGroup(BindGroupBase* group); @@ -69,6 +78,12 @@ class ComputePassResourceUsageTracker { // Helper class to build RenderPassResourceUsages class RenderPassResourceUsageTracker : public SyncScopeUsageTracker { public: + RenderPassResourceUsageTracker(); + RenderPassResourceUsageTracker(RenderPassResourceUsageTracker&&); + ~RenderPassResourceUsageTracker(); + + RenderPassResourceUsageTracker& operator=(RenderPassResourceUsageTracker&&); + void TrackQueryAvailability(QuerySetBase* querySet, uint32_t queryIndex); const QueryAvailabilityMap& GetQueryAvailabilityMap() const; diff --git a/src/dawn/native/Pipeline.cpp b/src/dawn/native/Pipeline.cpp index 6bee1eb5a5..513bd2ac4c 100644 --- a/src/dawn/native/Pipeline.cpp +++ b/src/dawn/native/Pipeline.cpp @@ -66,16 +66,16 @@ MaybeError ValidateProgrammableStage(DeviceBase* device, // Validate if overridable constants exist in shader module // pipelineBase is not yet constructed at this moment so iterate constants from descriptor - size_t numUninitializedConstants = metadata.uninitializedOverridableConstants.size(); + size_t numUninitializedConstants = metadata.uninitializedOverrides.size(); // Keep an initialized constants sets to handle duplicate initialization cases std::unordered_set stageInitializedConstantIdentifiers; for (uint32_t i = 0; i < constantCount; i++) { - DAWN_INVALID_IF(metadata.overridableConstants.count(constants[i].key) == 0, + DAWN_INVALID_IF(metadata.overrides.count(constants[i].key) == 0, "Pipeline overridable constant \"%s\" not found in %s.", constants[i].key, module); if (stageInitializedConstantIdentifiers.count(constants[i].key) == 0) { - if (metadata.uninitializedOverridableConstants.count(constants[i].key) > 0) { + if (metadata.uninitializedOverrides.count(constants[i].key) > 0) { numUninitializedConstants--; } stageInitializedConstantIdentifiers.insert(constants[i].key); @@ -91,7 +91,7 @@ MaybeError ValidateProgrammableStage(DeviceBase* device, if (DAWN_UNLIKELY(numUninitializedConstants > 0)) { std::string uninitializedConstantsArray; bool isFirst = true; - for (std::string identifier : metadata.uninitializedOverridableConstants) { + for (std::string identifier : metadata.uninitializedOverrides) { if (stageInitializedConstantIdentifiers.count(identifier) > 0) { continue; } diff --git a/src/dawn/native/PipelineCache.cpp b/src/dawn/native/PipelineCache.cpp index 19b8b7bd75..762e08526d 100644 --- a/src/dawn/native/PipelineCache.cpp +++ b/src/dawn/native/PipelineCache.cpp @@ -19,9 +19,9 @@ namespace dawn::native { PipelineCacheBase::PipelineCacheBase(BlobCache* cache, const CacheKey& key) : mCache(cache), mKey(key) {} -CachedBlob PipelineCacheBase::Initialize() { +Blob PipelineCacheBase::Initialize() { ASSERT(!mInitialized); - CachedBlob blob = mCache != nullptr ? mCache->Load(mKey) : CachedBlob(); + Blob blob = mCache != nullptr ? mCache->Load(mKey) : Blob(); mCacheHit = !blob.Empty(); mInitialized = true; return blob; @@ -37,8 +37,8 @@ MaybeError PipelineCacheBase::Flush() { return {}; } // Try to write the data out to the persistent cache. - CachedBlob blob; - DAWN_TRY_ASSIGN(blob, SerializeToBlobImpl()); + Blob blob; + DAWN_TRY(SerializeToBlobImpl(&blob)); if (blob.Size() > 0) { // Using a simple heuristic to decide whether to write out the blob right now. May need // smarter tracking when we are dealing with monolithic caches. diff --git a/src/dawn/native/PipelineCache.h b/src/dawn/native/PipelineCache.h index e69386e0d6..5b44a60138 100644 --- a/src/dawn/native/PipelineCache.h +++ b/src/dawn/native/PipelineCache.h @@ -42,12 +42,13 @@ class PipelineCacheBase : public RefCounted { // Initializes and returns the cached blob given the cache and keys. Used by backend // implementations to get the cache and set the cache hit state. Should only be called once. - CachedBlob Initialize(); + Blob Initialize(); private: - // Backend implementation of serialization of the cache into a blob. Note that an empty - // blob may be returned. - virtual ResultOrError SerializeToBlobImpl() = 0; + // Backend implementation of serialization of the cache into a blob. + // Note: given that no local cached blob should be destructed and copy elision has strict + // requirement cached blob is passed in as a pointer to be assigned. + virtual MaybeError SerializeToBlobImpl(Blob* blob) = 0; // The blob cache is owned by the Adapter and pipeline caches are owned/created by devices // or adapters. Since the device owns a reference to the Instance which owns the Adapter, diff --git a/src/dawn/native/PooledResourceMemoryAllocator.cpp b/src/dawn/native/PooledResourceMemoryAllocator.cpp index 95bca8cfdd..96b10c6981 100644 --- a/src/dawn/native/PooledResourceMemoryAllocator.cpp +++ b/src/dawn/native/PooledResourceMemoryAllocator.cpp @@ -23,6 +23,8 @@ namespace dawn::native { PooledResourceMemoryAllocator::PooledResourceMemoryAllocator(ResourceHeapAllocator* heapAllocator) : mHeapAllocator(heapAllocator) {} +PooledResourceMemoryAllocator::~PooledResourceMemoryAllocator() = default; + void PooledResourceMemoryAllocator::DestroyPool() { for (auto& resourceHeap : mPool) { ASSERT(resourceHeap != nullptr); diff --git a/src/dawn/native/PooledResourceMemoryAllocator.h b/src/dawn/native/PooledResourceMemoryAllocator.h index e75ad5511f..073ea26545 100644 --- a/src/dawn/native/PooledResourceMemoryAllocator.h +++ b/src/dawn/native/PooledResourceMemoryAllocator.h @@ -32,7 +32,7 @@ class DeviceBase; class PooledResourceMemoryAllocator : public ResourceHeapAllocator { public: explicit PooledResourceMemoryAllocator(ResourceHeapAllocator* heapAllocator); - ~PooledResourceMemoryAllocator() override = default; + ~PooledResourceMemoryAllocator() override; ResultOrError> AllocateResourceHeap(uint64_t size) override; void DeallocateResourceHeap(std::unique_ptr allocation) override; diff --git a/src/dawn/native/QueryHelper.cpp b/src/dawn/native/QueryHelper.cpp index e151d2fa85..d8f64813f3 100644 --- a/src/dawn/native/QueryHelper.cpp +++ b/src/dawn/native/QueryHelper.cpp @@ -40,25 +40,25 @@ static_assert(offsetof(dawn::native::TimestampParams, rightShift) == 16); static const char sConvertTimestampsToNanoseconds[] = R"( struct Timestamp { - low : u32; - high : u32; - }; + low : u32, + high : u32, + } struct TimestampArr { - t : array; - }; + t : array + } struct AvailabilityArr { - v : array; - }; + v : array + } struct TimestampParams { - first : u32; - count : u32; - offset : u32; - multiplier : u32; - right_shift : u32; - }; + first : u32, + count : u32, + offset : u32, + multiplier : u32, + right_shift : u32, + } @group(0) @binding(0) var timestamps : TimestampArr; @group(0) @binding(1) var availability : AvailabilityArr; @@ -66,7 +66,7 @@ static const char sConvertTimestampsToNanoseconds[] = R"( let sizeofTimestamp : u32 = 8u; - @stage(compute) @workgroup_size(8, 1, 1) + @compute @workgroup_size(8, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { if (GlobalInvocationID.x >= params.count) { return; } @@ -199,7 +199,8 @@ MaybeError EncodeConvertTimestampsToNanoseconds(CommandEncoder* encoder, Ref bindGroup; DAWN_TRY_ASSIGN( bindGroup, - utils::MakeBindGroup(device, layout, {{0, timestamps}, {1, availability}, {2, params}})); + utils::MakeBindGroup(device, layout, {{0, timestamps}, {1, availability}, {2, params}}, + UsageValidationMode::Internal)); // Create compute encoder and issue dispatch. Ref pass = encoder->BeginComputePass(); diff --git a/src/dawn/native/QuerySet.cpp b/src/dawn/native/QuerySet.cpp index b798266026..a5031659c6 100644 --- a/src/dawn/native/QuerySet.cpp +++ b/src/dawn/native/QuerySet.cpp @@ -27,7 +27,8 @@ namespace { class ErrorQuerySet final : public QuerySetBase { public: - explicit ErrorQuerySet(DeviceBase* device) : QuerySetBase(device, ObjectBase::kError) {} + explicit ErrorQuerySet(DeviceBase* device, const QuerySetDescriptor* descriptor) + : QuerySetBase(device, descriptor, ObjectBase::kError) {} private: void DestroyImpl() override { UNREACHABLE(); } @@ -113,8 +114,10 @@ QuerySetBase::QuerySetBase(DeviceBase* device) : ApiObjectBase(device, kLabelNot TrackInDevice(); } -QuerySetBase::QuerySetBase(DeviceBase* device, ObjectBase::ErrorTag tag) - : ApiObjectBase(device, tag) {} +QuerySetBase::QuerySetBase(DeviceBase* device, + const QuerySetDescriptor* descriptor, + ObjectBase::ErrorTag tag) + : ApiObjectBase(device, tag), mQueryType(descriptor->type), mQueryCount(descriptor->count) {} QuerySetBase::~QuerySetBase() { // Uninitialized or already destroyed @@ -126,8 +129,8 @@ void QuerySetBase::DestroyImpl() { } // static -QuerySetBase* QuerySetBase::MakeError(DeviceBase* device) { - return new ErrorQuerySet(device); +QuerySetBase* QuerySetBase::MakeError(DeviceBase* device, const QuerySetDescriptor* descriptor) { + return new ErrorQuerySet(device, descriptor); } ObjectType QuerySetBase::GetType() const { @@ -167,6 +170,14 @@ void QuerySetBase::APIDestroy() { Destroy(); } +wgpu::QueryType QuerySetBase::APIGetType() const { + return mQueryType; +} + +uint32_t QuerySetBase::APIGetCount() const { + return mQueryCount; +} + MaybeError QuerySetBase::ValidateDestroy() const { DAWN_TRY(GetDevice()->ValidateObject(this)); return {}; diff --git a/src/dawn/native/QuerySet.h b/src/dawn/native/QuerySet.h index db8512023d..fa288a0248 100644 --- a/src/dawn/native/QuerySet.h +++ b/src/dawn/native/QuerySet.h @@ -29,9 +29,7 @@ MaybeError ValidateQuerySetDescriptor(DeviceBase* device, const QuerySetDescript class QuerySetBase : public ApiObjectBase { public: - QuerySetBase(DeviceBase* device, const QuerySetDescriptor* descriptor); - - static QuerySetBase* MakeError(DeviceBase* device); + static QuerySetBase* MakeError(DeviceBase* device, const QuerySetDescriptor* descriptor); ObjectType GetType() const override; @@ -45,9 +43,14 @@ class QuerySetBase : public ApiObjectBase { MaybeError ValidateCanUseInSubmitNow() const; void APIDestroy(); + wgpu::QueryType APIGetType() const; + uint32_t APIGetCount() const; protected: - QuerySetBase(DeviceBase* device, ObjectBase::ErrorTag tag); + QuerySetBase(DeviceBase* device, const QuerySetDescriptor* descriptor); + QuerySetBase(DeviceBase* device, + const QuerySetDescriptor* descriptor, + ObjectBase::ErrorTag tag); // Constructor used only for mocking and testing. explicit QuerySetBase(DeviceBase* device); diff --git a/src/dawn/native/Queue.cpp b/src/dawn/native/Queue.cpp index c17ed8f4d9..9881d65897 100644 --- a/src/dawn/native/Queue.cpp +++ b/src/dawn/native/Queue.cpp @@ -97,11 +97,11 @@ ResultOrError UploadTextureDataAligningBytesPerRowAndOffset( // since both of them are powers of two, we only need to align to the max value. uint64_t offsetAlignment = std::max(optimalOffsetAlignment, uint64_t(blockInfo.byteSize)); - // For depth-stencil texture, buffer offset must be a multiple of 4, which is required - // by WebGPU and Vulkan SPEC. + // Buffer offset alignments must follow additional restrictions when we copy with depth stencil + // formats. if (hasDepthOrStencil) { - constexpr uint64_t kOffsetAlignmentForDepthStencil = 4; - offsetAlignment = std::max(offsetAlignment, kOffsetAlignmentForDepthStencil); + offsetAlignment = + std::max(offsetAlignment, device->GetBufferCopyOffsetAlignmentForDepthStencil()); } UploadHandle uploadHandle; diff --git a/src/dawn/native/RefCountedWithExternalCount.cpp b/src/dawn/native/RefCountedWithExternalCount.cpp new file mode 100644 index 0000000000..523b3a5d79 --- /dev/null +++ b/src/dawn/native/RefCountedWithExternalCount.cpp @@ -0,0 +1,31 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/RefCountedWithExternalCount.h" + +namespace dawn::native { + +void RefCountedWithExternalCount::APIReference() { + mExternalRefCount.Increment(); + RefCounted::APIReference(); +} + +void RefCountedWithExternalCount::APIRelease() { + if (mExternalRefCount.Decrement()) { + WillDropLastExternalRef(); + } + RefCounted::APIRelease(); +} + +} // namespace dawn::native diff --git a/src/dawn/native/RefCountedWithExternalCount.h b/src/dawn/native/RefCountedWithExternalCount.h new file mode 100644 index 0000000000..d38c7e3e15 --- /dev/null +++ b/src/dawn/native/RefCountedWithExternalCount.h @@ -0,0 +1,45 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_REFCOUNTEDWITHEXTERNALCOUNT_H_ +#define SRC_DAWN_NATIVE_REFCOUNTEDWITHEXTERNALCOUNT_H_ + +#include "dawn/common/RefCounted.h" + +namespace dawn::native { + +// RecCountedWithExternalCount is a version of RefCounted which tracks a separate +// refcount for calls to APIReference/APIRelease (refs added/removed by the application). +// The external refcount starts at 1, and the total refcount starts at 1 - i.e. the first +// ref is the external ref. +// Then, when the external refcount drops to zero, WillDropLastExternalRef is called. +// The derived class should override the behavior of WillDropLastExternalRef. +class RefCountedWithExternalCount : private RefCounted { + public: + using RefCounted::RefCounted; + using RefCounted::Reference; + using RefCounted::Release; + + void APIReference(); + void APIRelease(); + + private: + virtual void WillDropLastExternalRef() = 0; + + RefCount mExternalRefCount; +}; + +} // namespace dawn::native + +#endif // SRC_DAWN_NATIVE_REFCOUNTEDWITHEXTERNALCOUNT_H_ diff --git a/src/dawn/native/RenderBundle.cpp b/src/dawn/native/RenderBundle.cpp index 2781983d82..d2e3d6939c 100644 --- a/src/dawn/native/RenderBundle.cpp +++ b/src/dawn/native/RenderBundle.cpp @@ -37,6 +37,7 @@ RenderBundleBase::RenderBundleBase(RenderBundleEncoder* encoder, mAttachmentState(std::move(attachmentState)), mDepthReadOnly(depthReadOnly), mStencilReadOnly(stencilReadOnly), + mDrawCount(encoder->GetDrawCount()), mResourceUsage(std::move(resourceUsage)) { TrackInDevice(); } @@ -80,6 +81,11 @@ bool RenderBundleBase::IsStencilReadOnly() const { return mStencilReadOnly; } +uint64_t RenderBundleBase::GetDrawCount() const { + ASSERT(!IsError()); + return mDrawCount; +} + const RenderPassResourceUsage& RenderBundleBase::GetResourceUsage() const { ASSERT(!IsError()); return mResourceUsage; diff --git a/src/dawn/native/RenderBundle.h b/src/dawn/native/RenderBundle.h index 9297e01527..f86eb5fbf1 100644 --- a/src/dawn/native/RenderBundle.h +++ b/src/dawn/native/RenderBundle.h @@ -52,6 +52,7 @@ class RenderBundleBase final : public ApiObjectBase { const AttachmentState* GetAttachmentState() const; bool IsDepthReadOnly() const; bool IsStencilReadOnly() const; + uint64_t GetDrawCount() const; const RenderPassResourceUsage& GetResourceUsage() const; const IndirectDrawMetadata& GetIndirectDrawMetadata(); @@ -65,6 +66,7 @@ class RenderBundleBase final : public ApiObjectBase { Ref mAttachmentState; bool mDepthReadOnly; bool mStencilReadOnly; + uint64_t mDrawCount; RenderPassResourceUsage mResourceUsage; }; diff --git a/src/dawn/native/RenderBundleEncoder.cpp b/src/dawn/native/RenderBundleEncoder.cpp index 56a9d666ff..02cc54c134 100644 --- a/src/dawn/native/RenderBundleEncoder.cpp +++ b/src/dawn/native/RenderBundleEncoder.cpp @@ -62,9 +62,10 @@ MaybeError ValidateRenderBundleEncoderDescriptor(const DeviceBase* device, DAWN_INVALID_IF(!IsValidSampleCount(descriptor->sampleCount), "Sample count (%u) is not supported.", descriptor->sampleCount); - DAWN_INVALID_IF(descriptor->colorFormatsCount > kMaxColorAttachments, + uint32_t maxColorAttachments = device->GetLimits().v1.maxColorAttachments; + DAWN_INVALID_IF(descriptor->colorFormatsCount > maxColorAttachments, "Color formats count (%u) exceeds maximum number of color attachements (%u).", - descriptor->colorFormatsCount, kMaxColorAttachments); + descriptor->colorFormatsCount, maxColorAttachments); bool allColorFormatsUndefined = true; for (uint32_t i = 0; i < descriptor->colorFormatsCount; ++i) { diff --git a/src/dawn/native/RenderEncoderBase.cpp b/src/dawn/native/RenderEncoderBase.cpp index 06e14582ab..36aa9e12b7 100644 --- a/src/dawn/native/RenderEncoderBase.cpp +++ b/src/dawn/native/RenderEncoderBase.cpp @@ -75,6 +75,11 @@ bool RenderEncoderBase::IsStencilReadOnly() const { return mStencilReadOnly; } +uint64_t RenderEncoderBase::GetDrawCount() const { + ASSERT(!IsError()); + return mDrawCount; +} + Ref RenderEncoderBase::AcquireAttachmentState() { return std::move(mAttachmentState); } @@ -104,6 +109,8 @@ void RenderEncoderBase::APIDraw(uint32_t vertexCount, draw->firstVertex = firstVertex; draw->firstInstance = firstInstance; + mDrawCount++; + return {}; }, "encoding %s.Draw(%u, %u, %u, %u).", this, vertexCount, instanceCount, firstVertex, @@ -129,10 +136,7 @@ void RenderEncoderBase::APIDrawIndexed(uint32_t indexCount, DAWN_TRY(mCommandBufferState.ValidateIndexBufferInRange(indexCount, firstIndex)); - // Although we don't know actual vertex access range in CPU, we still call the - // ValidateBufferInRangeForVertexBuffer in order to deal with those vertex step - // mode vertex buffer with an array stride of zero. - DAWN_TRY(mCommandBufferState.ValidateBufferInRangeForVertexBuffer(0, 0)); + // DrawIndexed only validate instance step mode vertex buffer DAWN_TRY(mCommandBufferState.ValidateBufferInRangeForInstanceBuffer(instanceCount, firstInstance)); } @@ -144,6 +148,8 @@ void RenderEncoderBase::APIDrawIndexed(uint32_t indexCount, draw->baseVertex = baseVertex; draw->firstInstance = firstInstance; + mDrawCount++; + return {}; }, "encoding %s.DrawIndexed(%u, %u, %u, %i, %u).", this, indexCount, instanceCount, firstIndex, @@ -194,6 +200,8 @@ void RenderEncoderBase::APIDrawIndirect(BufferBase* indirectBuffer, uint64_t ind // backend. mUsageTracker.BufferUsedAs(indirectBuffer, wgpu::BufferUsage::Indirect); + mDrawCount++; + return {}; }, "encoding %s.DrawIndirect(%s, %u).", this, indirectBuffer, indirectOffset); @@ -246,6 +254,8 @@ void RenderEncoderBase::APIDrawIndexedIndirect(BufferBase* indirectBuffer, // backend. mUsageTracker.BufferUsedAs(indirectBuffer, wgpu::BufferUsage::Indirect); + mDrawCount++; + return {}; }, "encoding %s.DrawIndexedIndirect(%s, %u).", this, indirectBuffer, indirectOffset); diff --git a/src/dawn/native/RenderEncoderBase.h b/src/dawn/native/RenderEncoderBase.h index 0bdcc4d16a..0cb675a719 100644 --- a/src/dawn/native/RenderEncoderBase.h +++ b/src/dawn/native/RenderEncoderBase.h @@ -62,6 +62,7 @@ class RenderEncoderBase : public ProgrammableEncoder { const AttachmentState* GetAttachmentState() const; bool IsDepthReadOnly() const; bool IsStencilReadOnly() const; + uint64_t GetDrawCount() const; Ref AcquireAttachmentState(); protected: @@ -74,6 +75,8 @@ class RenderEncoderBase : public ProgrammableEncoder { RenderPassResourceUsageTracker mUsageTracker; IndirectDrawMetadata mIndirectDrawMetadata; + uint64_t mDrawCount = 0; + private: Ref mAttachmentState; const bool mDisableBaseVertex; diff --git a/src/dawn/native/RenderPassEncoder.cpp b/src/dawn/native/RenderPassEncoder.cpp index 716ce97bad..b066655f37 100644 --- a/src/dawn/native/RenderPassEncoder.cpp +++ b/src/dawn/native/RenderPassEncoder.cpp @@ -20,6 +20,7 @@ #include "dawn/common/Constants.h" #include "dawn/native/Buffer.h" +#include "dawn/native/ChainUtils_autogen.h" #include "dawn/native/CommandEncoder.h" #include "dawn/native/CommandValidation.h" #include "dawn/native/Commands.h" @@ -55,7 +56,6 @@ RenderPassEncoder::RenderPassEncoder(DeviceBase* device, EncodingContext* encodingContext, RenderPassResourceUsageTracker usageTracker, Ref attachmentState, - std::vector timestampWritesAtEnd, uint32_t renderTargetWidth, uint32_t renderTargetHeight, bool depthReadOnly, @@ -69,9 +69,13 @@ RenderPassEncoder::RenderPassEncoder(DeviceBase* device, mCommandEncoder(commandEncoder), mRenderTargetWidth(renderTargetWidth), mRenderTargetHeight(renderTargetHeight), - mOcclusionQuerySet(descriptor->occlusionQuerySet), - mTimestampWritesAtEnd(std::move(timestampWritesAtEnd)) { + mOcclusionQuerySet(descriptor->occlusionQuerySet) { mUsageTracker = std::move(usageTracker); + const RenderPassDescriptorMaxDrawCount* maxDrawCountInfo = nullptr; + FindInChain(descriptor->nextInChain, &maxDrawCountInfo); + if (maxDrawCountInfo) { + mMaxDrawCount = maxDrawCountInfo->maxDrawCount; + } TrackInDevice(); } @@ -82,15 +86,14 @@ Ref RenderPassEncoder::Create(DeviceBase* device, EncodingContext* encodingContext, RenderPassResourceUsageTracker usageTracker, Ref attachmentState, - std::vector timestampWritesAtEnd, uint32_t renderTargetWidth, uint32_t renderTargetHeight, bool depthReadOnly, bool stencilReadOnly) { return AcquireRef(new RenderPassEncoder(device, descriptor, commandEncoder, encodingContext, std::move(usageTracker), std::move(attachmentState), - std::move(timestampWritesAtEnd), renderTargetWidth, - renderTargetHeight, depthReadOnly, stencilReadOnly)); + renderTargetWidth, renderTargetHeight, depthReadOnly, + stencilReadOnly)); } RenderPassEncoder::RenderPassEncoder(DeviceBase* device, @@ -140,12 +143,13 @@ void RenderPassEncoder::APIEnd() { mOcclusionQueryActive, "Render pass %s ended with incomplete occlusion query index %u of %s.", this, mCurrentOcclusionQueryIndex, mOcclusionQuerySet.Get()); + + DAWN_INVALID_IF(mDrawCount > mMaxDrawCount, + "The drawCount (%u) of %s is greater than the maxDrawCount (%u).", + mDrawCount, this, mMaxDrawCount); } - EndRenderPassCmd* cmd = allocator->Allocate(Command::EndRenderPass); - // The query availability has already been updated at the beginning of render - // pass, and no need to do update here. - cmd->timestampWrites = std::move(mTimestampWritesAtEnd); + allocator->Allocate(Command::EndRenderPass); DAWN_TRY(mEncodingContext->ExitRenderPass(this, std::move(mUsageTracker), mCommandEncoder.Get(), @@ -320,6 +324,8 @@ void RenderPassEncoder::APIExecuteBundles(uint32_t count, RenderBundleBase* cons if (IsValidationEnabled()) { mIndirectDrawMetadata.AddBundle(renderBundles[i]); } + + mDrawCount += bundles[i]->GetDrawCount(); } return {}; diff --git a/src/dawn/native/RenderPassEncoder.h b/src/dawn/native/RenderPassEncoder.h index ad4c1300aa..32199f1654 100644 --- a/src/dawn/native/RenderPassEncoder.h +++ b/src/dawn/native/RenderPassEncoder.h @@ -33,7 +33,6 @@ class RenderPassEncoder final : public RenderEncoderBase { EncodingContext* encodingContext, RenderPassResourceUsageTracker usageTracker, Ref attachmentState, - std::vector timestampWritesAtEnd, uint32_t renderTargetWidth, uint32_t renderTargetHeight, bool depthReadOnly, @@ -70,7 +69,6 @@ class RenderPassEncoder final : public RenderEncoderBase { EncodingContext* encodingContext, RenderPassResourceUsageTracker usageTracker, Ref attachmentState, - std::vector timestampWritesAtEnd, uint32_t renderTargetWidth, uint32_t renderTargetHeight, bool depthReadOnly, @@ -97,7 +95,8 @@ class RenderPassEncoder final : public RenderEncoderBase { uint32_t mCurrentOcclusionQueryIndex = 0; bool mOcclusionQueryActive = false; - std::vector mTimestampWritesAtEnd; + // This is the hardcoded value in the WebGPU spec. + uint64_t mMaxDrawCount = 50000000; }; } // namespace dawn::native diff --git a/src/dawn/native/RenderPipeline.cpp b/src/dawn/native/RenderPipeline.cpp index 6894bdbac6..5c24d00ba8 100644 --- a/src/dawn/native/RenderPipeline.cpp +++ b/src/dawn/native/RenderPipeline.cpp @@ -99,6 +99,11 @@ MaybeError ValidateVertexBufferLayout( DAWN_INVALID_IF(buffer->arrayStride % 4 != 0, "Vertex buffer arrayStride (%u) is not a multiple of 4.", buffer->arrayStride); + DAWN_INVALID_IF( + buffer->stepMode == wgpu::VertexStepMode::VertexBufferNotUsed && buffer->attributeCount > 0, + "attributeCount (%u) is not zero although vertex buffer stepMode is %s.", + buffer->attributeCount, wgpu::VertexStepMode::VertexBufferNotUsed); + for (uint32_t i = 0; i < buffer->attributeCount; ++i) { DAWN_TRY_CONTEXT(ValidateVertexAttribute(device, &buffer->attributes[i], metadata, buffer->arrayStride, attributesSetMask), @@ -148,13 +153,11 @@ MaybeError ValidateVertexState(DeviceBase* device, } MaybeError ValidatePrimitiveState(const DeviceBase* device, const PrimitiveState* descriptor) { - DAWN_TRY( - ValidateSingleSType(descriptor->nextInChain, wgpu::SType::PrimitiveDepthClampingState)); - const PrimitiveDepthClampingState* clampInfo = nullptr; - FindInChain(descriptor->nextInChain, &clampInfo); - if (clampInfo && !device->IsFeatureEnabled(Feature::DepthClamping)) { - return DAWN_VALIDATION_ERROR("The depth clamping feature is not supported"); - } + DAWN_TRY(ValidateSingleSType(descriptor->nextInChain, wgpu::SType::PrimitiveDepthClipControl)); + const PrimitiveDepthClipControl* depthClipControl = nullptr; + FindInChain(descriptor->nextInChain, &depthClipControl); + DAWN_INVALID_IF(depthClipControl && !device->IsFeatureEnabled(Feature::DepthClipControl), + "%s is not supported", wgpu::FeatureName::DepthClipControl); DAWN_TRY(ValidatePrimitiveTopology(descriptor->topology)); DAWN_TRY(ValidateIndexFormat(descriptor->stripIndexFormat)); DAWN_TRY(ValidateFrontFace(descriptor->frontFace)); @@ -321,7 +324,8 @@ MaybeError ValidateColorTargetState( MaybeError ValidateFragmentState(DeviceBase* device, const FragmentState* descriptor, - const PipelineLayoutBase* layout) { + const PipelineLayoutBase* layout, + bool alphaToCoverageEnabled) { DAWN_INVALID_IF(descriptor->nextInChain != nullptr, "nextInChain must be nullptr."); DAWN_TRY_CONTEXT(ValidateProgrammableStage(device, descriptor->module, descriptor->entryPoint, @@ -330,9 +334,10 @@ MaybeError ValidateFragmentState(DeviceBase* device, "validating fragment stage (module: %s, entryPoint: %s).", descriptor->module, descriptor->entryPoint); - DAWN_INVALID_IF(descriptor->targetCount > kMaxColorAttachments, + uint32_t maxColorAttachments = device->GetLimits().v1.maxColorAttachments; + DAWN_INVALID_IF(descriptor->targetCount > maxColorAttachments, "Number of targets (%u) exceeds the maximum (%u).", descriptor->targetCount, - kMaxColorAttachments); + maxColorAttachments); const EntryPointMetadata& fragmentMetadata = descriptor->module->GetEntryPoint(descriptor->entryPoint); @@ -348,13 +353,14 @@ MaybeError ValidateFragmentState(DeviceBase* device, DAWN_INVALID_IF(target->blend, "Color target[%u] blend state is set when the format is undefined.", static_cast(i)); - DAWN_INVALID_IF( - target->writeMask != wgpu::ColorWriteMask::None, - "Color target[%u] write mask is set to (%s) when the format is undefined.", - static_cast(i), target->writeMask); } } + DAWN_INVALID_IF(fragmentMetadata.usesSampleMaskOutput && alphaToCoverageEnabled, + "alphaToCoverageEnabled is true when the sample_mask builtin is a " + "pipeline output of fragment stage of %s.", + descriptor->module); + return {}; } @@ -445,7 +451,8 @@ MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device, "validating multisample state."); if (descriptor->fragment != nullptr) { - DAWN_TRY_CONTEXT(ValidateFragmentState(device, descriptor->fragment, descriptor->layout), + DAWN_TRY_CONTEXT(ValidateFragmentState(device, descriptor->fragment, descriptor->layout, + descriptor->multisample.alphaToCoverageEnabled), "validating fragment state."); DAWN_INVALID_IF(descriptor->fragment->targetCount == 0 && !descriptor->depthStencil, @@ -502,7 +509,8 @@ RenderPipelineBase::RenderPipelineBase(DeviceBase* device, mVertexBufferCount = descriptor->vertex.bufferCount; const VertexBufferLayout* buffers = descriptor->vertex.buffers; for (uint8_t slot = 0; slot < mVertexBufferCount; ++slot) { - if (buffers[slot].attributeCount == 0) { + // Skip unused slots + if (buffers[slot].stepMode == wgpu::VertexStepMode::VertexBufferNotUsed) { continue; } @@ -551,11 +559,12 @@ RenderPipelineBase::RenderPipelineBase(DeviceBase* device, } mPrimitive = descriptor->primitive; - const PrimitiveDepthClampingState* clampInfo = nullptr; - FindInChain(mPrimitive.nextInChain, &clampInfo); - if (clampInfo) { - mClampDepth = clampInfo->clampDepth; + const PrimitiveDepthClipControl* depthClipControl = nullptr; + FindInChain(mPrimitive.nextInChain, &depthClipControl); + if (depthClipControl) { + mUnclippedDepth = depthClipControl->unclippedDepth; } + mMultisample = descriptor->multisample; if (mAttachmentState->HasDepthStencilAttachment()) { @@ -613,7 +622,7 @@ RenderPipelineBase::RenderPipelineBase(DeviceBase* device, TrackInDevice(); // Initialize the cache key to include the cache type and device information. - mCacheKey.Record(CacheKey::Type::RenderPipeline, device->GetCacheKey()); + StreamIn(&mCacheKey, CacheKey::Type::RenderPipeline, device->GetCacheKey()); } RenderPipelineBase::RenderPipelineBase(DeviceBase* device) : PipelineBase(device) { @@ -750,9 +759,9 @@ float RenderPipelineBase::GetDepthBiasClamp() const { return mDepthStencil.depthBiasClamp; } -bool RenderPipelineBase::ShouldClampDepth() const { +bool RenderPipelineBase::HasUnclippedDepth() const { ASSERT(!IsError()); - return mClampDepth; + return mUnclippedDepth; } ityp::bitset @@ -859,7 +868,7 @@ size_t RenderPipelineBase::ComputeContentHash() { // Record primitive state recorder.Record(mPrimitive.topology, mPrimitive.stripIndexFormat, mPrimitive.frontFace, - mPrimitive.cullMode, mClampDepth); + mPrimitive.cullMode, mUnclippedDepth); // Record multisample state // Sample count hashed as part of the attachment state @@ -976,7 +985,7 @@ bool RenderPipelineBase::EqualityFunc::operator()(const RenderPipelineBase* a, if (stateA.topology != stateB.topology || stateA.stripIndexFormat != stateB.stripIndexFormat || stateA.frontFace != stateB.frontFace || stateA.cullMode != stateB.cullMode || - a->mClampDepth != b->mClampDepth) { + a->mUnclippedDepth != b->mUnclippedDepth) { return false; } } diff --git a/src/dawn/native/RenderPipeline.h b/src/dawn/native/RenderPipeline.h index f904f8a893..afba4a7590 100644 --- a/src/dawn/native/RenderPipeline.h +++ b/src/dawn/native/RenderPipeline.h @@ -90,7 +90,7 @@ class RenderPipelineBase : public PipelineBase { int32_t GetDepthBias() const; float GetDepthBiasSlopeScale() const; float GetDepthBiasClamp() const; - bool ShouldClampDepth() const; + bool HasUnclippedDepth() const; ityp::bitset GetColorAttachmentsMask() const; bool HasDepthStencilAttachment() const; @@ -137,7 +137,7 @@ class RenderPipelineBase : public PipelineBase { PrimitiveState mPrimitive; DepthStencilState mDepthStencil; MultisampleState mMultisample; - bool mClampDepth = false; + bool mUnclippedDepth = false; bool mWritesDepth = false; bool mWritesStencil = false; }; diff --git a/src/dawn/native/RingBufferAllocator.cpp b/src/dawn/native/RingBufferAllocator.cpp index d3843830f8..01e23e7c15 100644 --- a/src/dawn/native/RingBufferAllocator.cpp +++ b/src/dawn/native/RingBufferAllocator.cpp @@ -30,8 +30,16 @@ // used bytes. namespace dawn::native { +RingBufferAllocator::RingBufferAllocator() = default; + RingBufferAllocator::RingBufferAllocator(uint64_t maxSize) : mMaxBlockSize(maxSize) {} +RingBufferAllocator::RingBufferAllocator(const RingBufferAllocator&) = default; + +RingBufferAllocator::~RingBufferAllocator() = default; + +RingBufferAllocator& RingBufferAllocator::operator=(const RingBufferAllocator&) = default; + void RingBufferAllocator::Deallocate(ExecutionSerial lastCompletedSerial) { // Reclaim memory from previously recorded blocks. for (Request& request : mInflightRequests.IterateUpTo(lastCompletedSerial)) { diff --git a/src/dawn/native/RingBufferAllocator.h b/src/dawn/native/RingBufferAllocator.h index cbb01b7b35..6aeb1427be 100644 --- a/src/dawn/native/RingBufferAllocator.h +++ b/src/dawn/native/RingBufferAllocator.h @@ -26,11 +26,12 @@ namespace dawn::native { class RingBufferAllocator { public: - RingBufferAllocator() = default; + RingBufferAllocator(); explicit RingBufferAllocator(uint64_t maxSize); - ~RingBufferAllocator() = default; - RingBufferAllocator(const RingBufferAllocator&) = default; - RingBufferAllocator& operator=(const RingBufferAllocator&) = default; + RingBufferAllocator(const RingBufferAllocator&); + ~RingBufferAllocator(); + + RingBufferAllocator& operator=(const RingBufferAllocator&); uint64_t Allocate(uint64_t allocationSize, ExecutionSerial serial); void Deallocate(ExecutionSerial lastCompletedSerial); diff --git a/src/dawn/native/Serializable.h b/src/dawn/native/Serializable.h new file mode 100644 index 0000000000..80d8339e2d --- /dev/null +++ b/src/dawn/native/Serializable.h @@ -0,0 +1,74 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_SERIALIZABLE_H_ +#define SRC_DAWN_NATIVE_SERIALIZABLE_H_ + +#include + +#include "dawn/native/VisitableMembers.h" +#include "dawn/native/stream/BlobSource.h" +#include "dawn/native/stream/ByteVectorSink.h" +#include "dawn/native/stream/Stream.h" + +namespace dawn::native { + +// Base CRTP for implementing StreamIn/StreamOut/FromBlob/ToBlob for Derived, +// assuming Derived has VisitAll methods provided by DAWN_VISITABLE_MEMBERS. +template +class Serializable { + public: + friend void StreamIn(stream::Sink* s, const Derived& in) { + in.VisitAll([&](const auto&... members) { StreamIn(s, members...); }); + } + + friend MaybeError StreamOut(stream::Source* s, Derived* out) { + return out->VisitAll([&](auto&... members) { return StreamOut(s, &members...); }); + } + + static ResultOrError FromBlob(Blob blob) { + stream::BlobSource source(std::move(blob)); + Derived out; + DAWN_TRY(StreamOut(&source, &out)); + return out; + } + + Blob ToBlob() const { + stream::ByteVectorSink sink; + StreamIn(&sink, static_cast(*this)); + return CreateBlob(std::move(sink)); + } +}; +} // namespace dawn::native + +// Helper macro to define a struct or class along with VisitAll methods to call +// a functor on all members. Derives from Visitable which provides +// implementations of StreamIn/StreamOut/FromBlob/ToBlob. +// Example usage: +// #define MEMBERS(X) \ +// X(int, a) \ +// X(float, b) \ +// X(Foo, foo) \ +// X(Bar, bar) +// DAWN_SERIALIZABLE(struct, MyStruct, MEMBERS) { +// void SomeAdditionalMethod(); +// }; +// #undef MEMBERS +#define DAWN_SERIALIZABLE(qualifier, Name, MEMBERS) \ + struct Name##__Contents { \ + DAWN_VISITABLE_MEMBERS(MEMBERS) \ + }; \ + qualifier Name : Name##__Contents, public ::dawn::native::Serializable + +#endif // SRC_DAWN_NATIVE_SERIALIZABLE_H_ diff --git a/src/dawn/native/ShaderModule.cpp b/src/dawn/native/ShaderModule.cpp index 13de350603..d1785c0a6d 100644 --- a/src/dawn/native/ShaderModule.cpp +++ b/src/dawn/native/ShaderModule.cpp @@ -37,95 +37,15 @@ namespace dawn::native { namespace { -tint::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) { - switch (format) { - case wgpu::VertexFormat::Uint8x2: - return tint::transform::VertexFormat::kUint8x2; - case wgpu::VertexFormat::Uint8x4: - return tint::transform::VertexFormat::kUint8x4; - case wgpu::VertexFormat::Sint8x2: - return tint::transform::VertexFormat::kSint8x2; - case wgpu::VertexFormat::Sint8x4: - return tint::transform::VertexFormat::kSint8x4; - case wgpu::VertexFormat::Unorm8x2: - return tint::transform::VertexFormat::kUnorm8x2; - case wgpu::VertexFormat::Unorm8x4: - return tint::transform::VertexFormat::kUnorm8x4; - case wgpu::VertexFormat::Snorm8x2: - return tint::transform::VertexFormat::kSnorm8x2; - case wgpu::VertexFormat::Snorm8x4: - return tint::transform::VertexFormat::kSnorm8x4; - case wgpu::VertexFormat::Uint16x2: - return tint::transform::VertexFormat::kUint16x2; - case wgpu::VertexFormat::Uint16x4: - return tint::transform::VertexFormat::kUint16x4; - case wgpu::VertexFormat::Sint16x2: - return tint::transform::VertexFormat::kSint16x2; - case wgpu::VertexFormat::Sint16x4: - return tint::transform::VertexFormat::kSint16x4; - case wgpu::VertexFormat::Unorm16x2: - return tint::transform::VertexFormat::kUnorm16x2; - case wgpu::VertexFormat::Unorm16x4: - return tint::transform::VertexFormat::kUnorm16x4; - case wgpu::VertexFormat::Snorm16x2: - return tint::transform::VertexFormat::kSnorm16x2; - case wgpu::VertexFormat::Snorm16x4: - return tint::transform::VertexFormat::kSnorm16x4; - case wgpu::VertexFormat::Float16x2: - return tint::transform::VertexFormat::kFloat16x2; - case wgpu::VertexFormat::Float16x4: - return tint::transform::VertexFormat::kFloat16x4; - case wgpu::VertexFormat::Float32: - return tint::transform::VertexFormat::kFloat32; - case wgpu::VertexFormat::Float32x2: - return tint::transform::VertexFormat::kFloat32x2; - case wgpu::VertexFormat::Float32x3: - return tint::transform::VertexFormat::kFloat32x3; - case wgpu::VertexFormat::Float32x4: - return tint::transform::VertexFormat::kFloat32x4; - case wgpu::VertexFormat::Uint32: - return tint::transform::VertexFormat::kUint32; - case wgpu::VertexFormat::Uint32x2: - return tint::transform::VertexFormat::kUint32x2; - case wgpu::VertexFormat::Uint32x3: - return tint::transform::VertexFormat::kUint32x3; - case wgpu::VertexFormat::Uint32x4: - return tint::transform::VertexFormat::kUint32x4; - case wgpu::VertexFormat::Sint32: - return tint::transform::VertexFormat::kSint32; - case wgpu::VertexFormat::Sint32x2: - return tint::transform::VertexFormat::kSint32x2; - case wgpu::VertexFormat::Sint32x3: - return tint::transform::VertexFormat::kSint32x3; - case wgpu::VertexFormat::Sint32x4: - return tint::transform::VertexFormat::kSint32x4; - - case wgpu::VertexFormat::Undefined: - break; - } - UNREACHABLE(); -} - -tint::transform::VertexStepMode ToTintVertexStepMode(wgpu::VertexStepMode mode) { - switch (mode) { - case wgpu::VertexStepMode::Vertex: - return tint::transform::VertexStepMode::kVertex; - case wgpu::VertexStepMode::Instance: - return tint::transform::VertexStepMode::kInstance; - } - UNREACHABLE(); -} - -ResultOrError TintPipelineStageToShaderStage(tint::ast::PipelineStage stage) { +ResultOrError TintPipelineStageToShaderStage( + tint::inspector::PipelineStage stage) { switch (stage) { - case tint::ast::PipelineStage::kVertex: + case tint::inspector::PipelineStage::kVertex: return SingleShaderStage::Vertex; - case tint::ast::PipelineStage::kFragment: + case tint::inspector::PipelineStage::kFragment: return SingleShaderStage::Fragment; - case tint::ast::PipelineStage::kCompute: + case tint::inspector::PipelineStage::kCompute: return SingleShaderStage::Compute; - case tint::ast::PipelineStage::kNone: - break; } UNREACHABLE(); } @@ -357,17 +277,16 @@ ResultOrError TintInterpolationSamplingToInterpolationSam UNREACHABLE(); } -EntryPointMetadata::OverridableConstant::Type FromTintOverridableConstantType( - tint::inspector::OverridableConstant::Type type) { +EntryPointMetadata::Override::Type FromTintOverrideType(tint::inspector::Override::Type type) { switch (type) { - case tint::inspector::OverridableConstant::Type::kBool: - return EntryPointMetadata::OverridableConstant::Type::Boolean; - case tint::inspector::OverridableConstant::Type::kFloat32: - return EntryPointMetadata::OverridableConstant::Type::Float32; - case tint::inspector::OverridableConstant::Type::kInt32: - return EntryPointMetadata::OverridableConstant::Type::Int32; - case tint::inspector::OverridableConstant::Type::kUint32: - return EntryPointMetadata::OverridableConstant::Type::Uint32; + case tint::inspector::Override::Type::kBool: + return EntryPointMetadata::Override::Type::Boolean; + case tint::inspector::Override::Type::kFloat32: + return EntryPointMetadata::Override::Type::Float32; + case tint::inspector::Override::Type::kInt32: + return EntryPointMetadata::Override::Type::Int32; + case tint::inspector::Override::Type::kUint32: + return EntryPointMetadata::Override::Type::Uint32; } UNREACHABLE(); } @@ -380,8 +299,8 @@ ResultOrError ParseWGSL(const tint::Source::File* file, outMessages->AddMessages(program.Diagnostics()); } if (!program.IsValid()) { - return DAWN_FORMAT_VALIDATION_ERROR("Tint WGSL reader failure:\nParser: %s\nShader:\n%s\n", - program.Diagnostics().str(), file->content.data); + return DAWN_FORMAT_VALIDATION_ERROR("Tint WGSL reader failure: %s\n", + program.Diagnostics().str()); } return std::move(program); @@ -609,17 +528,17 @@ ResultOrError> ReflectEntryPointUsingTint( return invalid; \ })() - if (!entryPoint.overridable_constants.empty()) { + if (!entryPoint.overrides.empty()) { DAWN_INVALID_IF(device->IsToggleEnabled(Toggle::DisallowUnsafeAPIs), "Pipeline overridable constants are disallowed because they " "are partially implemented."); - const auto& name2Id = inspector->GetConstantNameToIdMap(); - const auto& id2Scalar = inspector->GetConstantIDs(); + const auto& name2Id = inspector->GetNamedOverrideIds(); + const auto& id2Scalar = inspector->GetOverrideDefaultValues(); - for (auto& c : entryPoint.overridable_constants) { - uint32_t id = name2Id.at(c.name); - OverridableConstantScalar defaultValue; + for (auto& c : entryPoint.overrides) { + auto id = name2Id.at(c.name); + OverrideScalar defaultValue; if (c.is_initialized) { // if it is initialized, the scalar must exist const auto& scalar = id2Scalar.at(id); @@ -635,21 +554,19 @@ ResultOrError> ReflectEntryPointUsingTint( UNREACHABLE(); } } - EntryPointMetadata::OverridableConstant constant = { - id, FromTintOverridableConstantType(c.type), c.is_initialized, defaultValue}; + EntryPointMetadata::Override override = {id.value, FromTintOverrideType(c.type), + c.is_initialized, defaultValue}; - std::string identifier = - c.is_numeric_id_specified ? std::to_string(constant.id) : c.name; - metadata->overridableConstants[identifier] = constant; + std::string identifier = c.is_id_specified ? std::to_string(override.id) : c.name; + metadata->overrides[identifier] = override; if (!c.is_initialized) { auto [_, inserted] = - metadata->uninitializedOverridableConstants.emplace(std::move(identifier)); + metadata->uninitializedOverrides.emplace(std::move(identifier)); // The insertion should have taken place ASSERT(inserted); } else { - auto [_, inserted] = - metadata->initializedOverridableConstants.emplace(std::move(identifier)); + auto [_, inserted] = metadata->initializedOverrides.emplace(std::move(identifier)); // The insertion should have taken place ASSERT(inserted); } @@ -659,19 +576,24 @@ ResultOrError> ReflectEntryPointUsingTint( DAWN_TRY_ASSIGN(metadata->stage, TintPipelineStageToShaderStage(entryPoint.stage)); if (metadata->stage == SingleShaderStage::Compute) { - DelayedInvalidIf(entryPoint.workgroup_size_x > limits.v1.maxComputeWorkgroupSizeX || - entryPoint.workgroup_size_y > limits.v1.maxComputeWorkgroupSizeY || - entryPoint.workgroup_size_z > limits.v1.maxComputeWorkgroupSizeZ, + auto workgroup_size = entryPoint.workgroup_size; + DAWN_INVALID_IF( + !workgroup_size.has_value(), + "TODO(crbug.com/dawn/1504): Dawn does not currently support @workgroup_size " + "attributes using override-expressions"); + DelayedInvalidIf(workgroup_size->x > limits.v1.maxComputeWorkgroupSizeX || + workgroup_size->y > limits.v1.maxComputeWorkgroupSizeY || + workgroup_size->z > limits.v1.maxComputeWorkgroupSizeZ, "Entry-point uses workgroup_size(%u, %u, %u) that exceeds the " "maximum allowed (%u, %u, %u).", - entryPoint.workgroup_size_x, entryPoint.workgroup_size_y, - entryPoint.workgroup_size_z, limits.v1.maxComputeWorkgroupSizeX, - limits.v1.maxComputeWorkgroupSizeY, limits.v1.maxComputeWorkgroupSizeZ); + workgroup_size->x, workgroup_size->y, workgroup_size->z, + limits.v1.maxComputeWorkgroupSizeX, limits.v1.maxComputeWorkgroupSizeY, + limits.v1.maxComputeWorkgroupSizeZ); // Dimensions have already been validated against their individual limits above. // Cast to uint64_t to avoid overflow in this multiplication. - uint64_t numInvocations = static_cast(entryPoint.workgroup_size_x) * - entryPoint.workgroup_size_y * entryPoint.workgroup_size_z; + uint64_t numInvocations = + static_cast(workgroup_size->x) * workgroup_size->y * workgroup_size->z; DelayedInvalidIf(numInvocations > limits.v1.maxComputeInvocationsPerWorkgroup, "The total number of workgroup invocations (%u) exceeds the " "maximum allowed (%u).", @@ -683,9 +605,9 @@ ResultOrError> ReflectEntryPointUsingTint( "the maximum allowed (%u bytes).", workgroupStorageSize, limits.v1.maxComputeWorkgroupStorageSize); - metadata->localWorkgroupSize.x = entryPoint.workgroup_size_x; - metadata->localWorkgroupSize.y = entryPoint.workgroup_size_y; - metadata->localWorkgroupSize.z = entryPoint.workgroup_size_z; + metadata->localWorkgroupSize.x = workgroup_size->x; + metadata->localWorkgroupSize.y = workgroup_size->y; + metadata->localWorkgroupSize.z = workgroup_size->z; metadata->usesNumWorkgroups = entryPoint.num_workgroups_used; } @@ -772,6 +694,7 @@ ResultOrError> ReflectEntryPointUsingTint( if (entryPoint.input_sample_mask_used) { totalInterStageShaderComponents += 1; } + metadata->usesSampleMaskOutput = entryPoint.output_sample_mask_used; if (entryPoint.sample_index_used) { totalInterStageShaderComponents += 1; } @@ -783,6 +706,7 @@ ResultOrError> ReflectEntryPointUsingTint( "Total fragment input components count (%u) exceeds the maximum (%u).", totalInterStageShaderComponents, kMaxInterStageShaderComponents); + uint32_t maxColorAttachments = device->GetLimits().v1.maxColorAttachments; for (const auto& outputVar : entryPoint.output_variables) { EntryPointMetadata::FragmentOutputVariableInfo variable; DAWN_TRY_ASSIGN(variable.baseType, @@ -792,10 +716,10 @@ ResultOrError> ReflectEntryPointUsingTint( ASSERT(variable.componentCount <= 4); uint32_t unsanitizedAttachment = outputVar.location_decoration; - if (DelayedInvalidIf(unsanitizedAttachment >= kMaxColorAttachments, + if (DelayedInvalidIf(unsanitizedAttachment >= maxColorAttachments, "Fragment output variable \"%s\" has a location (%u) that " "exceeds the maximum (%u).", - outputVar.name, unsanitizedAttachment, kMaxColorAttachments)) { + outputVar.name, unsanitizedAttachment, maxColorAttachments)) { continue; } @@ -882,9 +806,8 @@ ResultOrError> ReflectEntryPointUsingTint( resource.binding, resource.bind_group); } - std::vector samplerTextureUses = - inspector->GetSamplerTextureUses(entryPoint.name); - metadata->samplerTexturePairs.reserve(samplerTextureUses.size()); + auto samplerTextureUses = inspector->GetSamplerTextureUses(entryPoint.name); + metadata->samplerTexturePairs.reserve(samplerTextureUses.Length()); std::transform(samplerTextureUses.begin(), samplerTextureUses.end(), std::back_inserter(metadata->samplerTexturePairs), [](const tint::inspector::SamplerTexturePair& pair) { @@ -901,25 +824,20 @@ ResultOrError> ReflectEntryPointUsingTint( } MaybeError ValidateWGSLProgramExtension(const DeviceBase* device, - const tint::Program* program, + const WGSLExtensionSet* enabledExtensions, OwnedCompilationMessages* outMessages) { - DAWN_ASSERT(program->IsValid()); - tint::inspector::Inspector inspector(program); - auto enableDirectives = inspector.GetEnableDirectives(); - - auto extensionAllowList = device->GetWGSLExtensionAllowList(); + const WGSLExtensionSet& extensionAllowList = device->GetWGSLExtensionAllowList(); bool hasDisallowedExtension = false; tint::diag::List messages; - for (auto enable : enableDirectives) { - if (extensionAllowList.count(enable.first)) { + for (const std::string& extension : *enabledExtensions) { + if (extensionAllowList.count(extension)) { continue; } hasDisallowedExtension = true; messages.add_error(tint::diag::System::Program, - "Extension " + enable.first + " is not allowed on the Device.", - enable.second); + "Extension " + extension + " is not allowed on the Device."); } if (hasDisallowedExtension) { @@ -936,8 +854,8 @@ MaybeError ValidateWGSLProgramExtension(const DeviceBase* device, MaybeError ReflectShaderUsingTint(const DeviceBase* device, const tint::Program* program, OwnedCompilationMessages* compilationMessages, - EntryPointMetadataTable& entryPointMetadataTable, - WGSLExtensionsSet* enabledWGSLExtensions) { + EntryPointMetadataTable* entryPointMetadataTable, + WGSLExtensionSet* enabledWGSLExtensions) { ASSERT(program->IsValid()); tint::inspector::Inspector inspector(program); @@ -947,8 +865,7 @@ MaybeError ReflectShaderUsingTint(const DeviceBase* device, for (std::string name : usedExtensionNames) { enabledWGSLExtensions->insert(name); } - - DAWN_TRY(ValidateWGSLProgramExtension(device, program, compilationMessages)); + DAWN_TRY(ValidateWGSLProgramExtension(device, enabledWGSLExtensions, compilationMessages)); std::vector entryPoints = inspector.GetEntryPoints(); DAWN_INVALID_IF(inspector.has_error(), "Tint Reflection failure: Inspector: %s\n", @@ -960,8 +877,8 @@ MaybeError ReflectShaderUsingTint(const DeviceBase* device, ReflectEntryPointUsingTint(device, &inspector, entryPoint), "processing entry point \"%s\".", entryPoint.name); - ASSERT(entryPointMetadataTable.count(entryPoint.name) == 0); - entryPointMetadataTable[entryPoint.name] = std::move(metadata); + ASSERT(entryPointMetadataTable->count(entryPoint.name) == 0); + (*entryPointMetadataTable)[entryPoint.name] = std::move(metadata); } return {}; } @@ -1089,39 +1006,6 @@ ResultOrError RunTransforms(tint::transform::Transform* transform return std::move(output.program); } -void AddVertexPullingTransformConfig(const RenderPipelineBase& renderPipeline, - const std::string& entryPoint, - BindGroupIndex pullingBufferBindingSet, - tint::transform::DataMap* transformInputs) { - tint::transform::VertexPulling::Config cfg; - cfg.entry_point_name = entryPoint; - cfg.pulling_group = static_cast(pullingBufferBindingSet); - - cfg.vertex_state.resize(renderPipeline.GetVertexBufferCount()); - for (VertexBufferSlot slot : IterateBitSet(renderPipeline.GetVertexBufferSlotsUsed())) { - const VertexBufferInfo& dawnInfo = renderPipeline.GetVertexBuffer(slot); - tint::transform::VertexBufferLayoutDescriptor* tintInfo = - &cfg.vertex_state[static_cast(slot)]; - - tintInfo->array_stride = dawnInfo.arrayStride; - tintInfo->step_mode = ToTintVertexStepMode(dawnInfo.stepMode); - } - - for (VertexAttributeLocation location : - IterateBitSet(renderPipeline.GetAttributeLocationsUsed())) { - const VertexAttributeInfo& dawnInfo = renderPipeline.GetAttribute(location); - tint::transform::VertexAttributeDescriptor tintInfo; - tintInfo.format = ToTintVertexFormat(dawnInfo.format); - tintInfo.offset = dawnInfo.offset; - tintInfo.shader_location = static_cast(static_cast(location)); - - uint8_t vertexBufferSlot = static_cast(dawnInfo.vertexBufferSlot); - cfg.vertex_state[vertexBufferSlot].attributes.push_back(tintInfo); - } - - transformInputs->Add(cfg); -} - MaybeError ValidateCompatibilityWithPipelineLayout(DeviceBase* device, const EntryPointMetadata& entryPoint, const PipelineLayoutBase* layout) { @@ -1307,36 +1191,13 @@ OwnedCompilationMessages* ShaderModuleBase::GetCompilationMessages() const { return mCompilationMessages.get(); } -// static -void ShaderModuleBase::AddExternalTextureTransform(const PipelineLayoutBase* layout, - tint::transform::Manager* transformManager, - tint::transform::DataMap* transformInputs) { - tint::transform::MultiplanarExternalTexture::BindingsMap newBindingsMap; - for (BindGroupIndex i : IterateBitSet(layout->GetBindGroupLayoutsMask())) { - const BindGroupLayoutBase* bgl = layout->GetBindGroupLayout(i); - - for (const auto& expansion : bgl->GetExternalTextureBindingExpansionMap()) { - newBindingsMap[{static_cast(i), - static_cast(expansion.second.plane0)}] = { - {static_cast(i), static_cast(expansion.second.plane1)}, - {static_cast(i), static_cast(expansion.second.params)}}; - } - } - - if (!newBindingsMap.empty()) { - transformManager->Add(); - transformInputs->Add( - newBindingsMap); - } -} - MaybeError ShaderModuleBase::InitializeBase(ShaderModuleParseResult* parseResult, OwnedCompilationMessages* compilationMessages) { mTintProgram = std::move(parseResult->tintProgram); mTintSource = std::move(parseResult->tintSource); DAWN_TRY(ReflectShaderUsingTint(GetDevice(), mTintProgram.get(), compilationMessages, - mEntryPoints, &mEnabledWGSLExtensions)); + &mEntryPoints, &mEnabledWGSLExtensions)); return {}; } diff --git a/src/dawn/native/ShaderModule.h b/src/dawn/native/ShaderModule.h index e7068c9228..170b388000 100644 --- a/src/dawn/native/ShaderModule.h +++ b/src/dawn/native/ShaderModule.h @@ -53,7 +53,7 @@ class VertexPulling; namespace dawn::native { -using WGSLExtensionsSet = std::unordered_set; +using WGSLExtensionSet = std::unordered_set; struct EntryPointMetadata; // Base component type of an inter-stage variable @@ -116,12 +116,6 @@ ResultOrError RunTransforms(tint::transform::Transform* transform tint::transform::DataMap* outputs, OwnedCompilationMessages* messages); -/// Creates and adds the tint::transform::VertexPulling::Config to transformInputs. -void AddVertexPullingTransformConfig(const RenderPipelineBase& renderPipeline, - const std::string& entryPoint, - BindGroupIndex pullingBufferBindingSet, - tint::transform::DataMap* transformInputs); - // Mirrors wgpu::SamplerBindingLayout but instead stores a single boolean // for isComparison instead of a wgpu::SamplerBindingType enum. struct ShaderSamplerBindingInfo { @@ -155,8 +149,8 @@ struct ShaderBindingInfo { using BindingGroupInfoMap = std::map; using BindingInfoArray = ityp::array; -// The WebGPU overridable constants only support these scalar types -union OverridableConstantScalar { +// The WebGPU override variables only support these scalar types +union OverrideScalar { // Use int32_t for boolean to initialize the full 32bit int32_t b; float f32; @@ -216,9 +210,9 @@ struct EntryPointMetadata { // The shader stage for this binding. SingleShaderStage stage; - struct OverridableConstant { + struct Override { uint32_t id; - // Match tint::inspector::OverridableConstant::Type + // Match tint::inspector::Override::Type // Bool is defined as a macro on linux X11 and cannot compile enum class Type { Boolean, Float32, Uint32, Int32 } type; @@ -230,25 +224,27 @@ struct EntryPointMetadata { // Store the default initialized value in shader // This is used by metal backend as the function_constant does not have dafault values // Initialized when isInitialized == true - OverridableConstantScalar defaultValue; + OverrideScalar defaultValue; }; - using OverridableConstantsMap = std::unordered_map; + using OverridesMap = std::unordered_map; - // Map identifier to overridable constant + // Map identifier to override variable // Identifier is unique: either the variable name or the numeric ID if specified - OverridableConstantsMap overridableConstants; + OverridesMap overrides; - // Overridable constants that are not initialized in shaders + // Override variables that are not initialized in shaders // They need value initialization from pipeline stage or it is a validation error - std::unordered_set uninitializedOverridableConstants; + std::unordered_set uninitializedOverrides; // Store constants with shader initialized values as well // This is used by metal backend to set values with default initializers that are not // overridden - std::unordered_set initializedOverridableConstants; + std::unordered_set initializedOverrides; bool usesNumWorkgroups = false; + // Used at render pipeline validation. + bool usesSampleMaskOutput = false; }; class ShaderModuleBase : public ApiObjectBase, public CachedObject { @@ -293,10 +289,6 @@ class ShaderModuleBase : public ApiObjectBase, public CachedObject { MaybeError InitializeBase(ShaderModuleParseResult* parseResult, OwnedCompilationMessages* compilationMessages); - static void AddExternalTextureTransform(const PipelineLayoutBase* layout, - tint::transform::Manager* transformManager, - tint::transform::DataMap* transformInputs); - private: ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag); @@ -307,7 +299,7 @@ class ShaderModuleBase : public ApiObjectBase, public CachedObject { std::string mWgsl; EntryPointMetadataTable mEntryPoints; - WGSLExtensionsSet mEnabledWGSLExtensions; + WGSLExtensionSet mEnabledWGSLExtensions; std::unique_ptr mTintProgram; std::unique_ptr mTintSource; // Keep the tint::Source::File alive diff --git a/src/dawn/native/SpirvValidation.cpp b/src/dawn/native/SpirvValidation.cpp index b40a80390e..235fdbb346 100644 --- a/src/dawn/native/SpirvValidation.cpp +++ b/src/dawn/native/SpirvValidation.cpp @@ -23,7 +23,10 @@ namespace dawn::native { -MaybeError ValidateSpirv(DeviceBase* device, const std::vector& spirv, bool dumpSpirv) { +MaybeError ValidateSpirv(DeviceBase* device, + const uint32_t* spirv, + size_t wordCount, + bool dumpSpirv) { spvtools::SpirvTools spirvTools(SPV_ENV_VULKAN_1_1); spirvTools.SetMessageConsumer([device](spv_message_level_t level, const char*, const spv_position_t& position, const char* message) { @@ -50,12 +53,12 @@ MaybeError ValidateSpirv(DeviceBase* device, const std::vector& spirv, device->EmitLog(wgpuLogLevel, ss.str().c_str()); }); - const bool valid = spirvTools.Validate(spirv); + const bool valid = spirvTools.Validate(spirv, wordCount); if (dumpSpirv || !valid) { std::ostringstream dumpedMsg; std::string disassembly; if (spirvTools.Disassemble( - spirv, &disassembly, + spirv, wordCount, &disassembly, SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES | SPV_BINARY_TO_TEXT_OPTION_INDENT)) { dumpedMsg << "/* Dumped generated SPIRV disassembly */" << std::endl << disassembly; } else { diff --git a/src/dawn/native/SpirvValidation.h b/src/dawn/native/SpirvValidation.h index b50d38af77..b73d5f06ad 100644 --- a/src/dawn/native/SpirvValidation.h +++ b/src/dawn/native/SpirvValidation.h @@ -15,15 +15,16 @@ #ifndef SRC_DAWN_NATIVE_SPIRVVALIDATION_H_ #define SRC_DAWN_NATIVE_SPIRVVALIDATION_H_ -#include - #include "dawn/native/Error.h" namespace dawn::native { class DeviceBase; -MaybeError ValidateSpirv(DeviceBase* device, const std::vector& spirv, bool dumpSpirv); +MaybeError ValidateSpirv(DeviceBase* device, + const uint32_t* spirv, + size_t wordCount, + bool dumpSpirv); } // namespace dawn::native diff --git a/src/dawn/native/StreamImplTint.cpp b/src/dawn/native/StreamImplTint.cpp new file mode 100644 index 0000000000..13a70cabb5 --- /dev/null +++ b/src/dawn/native/StreamImplTint.cpp @@ -0,0 +1,117 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/stream/Stream.h" + +#include "dawn/native/TintUtils.h" +#include "tint/writer/array_length_from_uniform_options.h" + +namespace dawn::native { + +// static +template <> +void stream::Stream::Write(stream::Sink* sink, const tint::Program& p) { +#if TINT_BUILD_WGSL_WRITER + tint::writer::wgsl::Options options{}; + StreamIn(sink, tint::writer::wgsl::Generate(&p, options).wgsl); +#else + // TODO(crbug.com/dawn/1481): We shouldn't need to write back to WGSL if we have a CacheKey + // built from the initial shader module input. Then, we would never need to parse the program + // and write back out to WGSL. + UNREACHABLE(); +#endif +} + +// static +template <> +void stream::Stream::Write(stream::Sink* sink, + const tint::sem::BindingPoint& p) { + static_assert(offsetof(tint::sem::BindingPoint, group) == 0, + "Please update serialization for tint::sem::BindingPoint"); + static_assert(offsetof(tint::sem::BindingPoint, binding) == 4, + "Please update serialization for tint::sem::BindingPoint"); + static_assert(sizeof(tint::sem::BindingPoint) == 8, + "Please update serialization for tint::sem::BindingPoint"); + StreamIn(sink, p.group, p.binding); +} + +// static +template <> +void stream::Stream::Write( + stream::Sink* sink, + const tint::transform::BindingPoints& points) { + static_assert(offsetof(tint::transform::BindingPoints, plane_1) == 0, + "Please update serialization for tint::transform::BindingPoints"); + static_assert(offsetof(tint::transform::BindingPoints, params) == 8, + "Please update serialization for tint::transform::BindingPoints"); + static_assert(sizeof(tint::transform::BindingPoints) == 16, + "Please update serialization for tint::transform::BindingPoints"); + StreamIn(sink, points.plane_1, points.params); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const tint::transform::VertexPulling::Config& cfg) { + StreamIn(sink, cfg.entry_point_name, cfg.vertex_state, cfg.pulling_group); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const tint::transform::VertexBufferLayoutDescriptor& layout) { + using Layout = tint::transform::VertexBufferLayoutDescriptor; + static_assert(offsetof(Layout, array_stride) == 0, + "Please update serialization for tint::transform::VertexBufferLayoutDescriptor"); + static_assert(offsetof(Layout, step_mode) == 4, + "Please update serialization for tint::transform::VertexBufferLayoutDescriptor"); + static_assert(offsetof(Layout, attributes) == 8, + "Please update serialization for tint::transform::VertexBufferLayoutDescriptor"); + StreamIn(sink, layout.array_stride, layout.step_mode, layout.attributes); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const tint::transform::VertexAttributeDescriptor& attrib) { + using Attrib = tint::transform::VertexAttributeDescriptor; + static_assert(offsetof(Attrib, format) == 0, + "Please update serialization for tint::transform::VertexAttributeDescriptor"); + static_assert(offsetof(Attrib, offset) == 4, + "Please update serialization for tint::transform::VertexAttributeDescriptor"); + static_assert(offsetof(Attrib, shader_location) == 8, + "Please update serialization for tint::transform::VertexAttributeDescriptor"); + static_assert(sizeof(Attrib) == 12, + "Please update serialization for tint::transform::VertexAttributeDescriptor"); + StreamIn(sink, attrib.format, attrib.offset, attrib.shader_location); +} + +// static +template <> +void stream::Stream::Write( + stream::Sink* sink, + const tint::writer::ArrayLengthFromUniformOptions& o) { + static_assert(offsetof(tint::writer::ArrayLengthFromUniformOptions, ubo_binding) == 0, + "Please update serialization for tint::writer::ArrayLengthFromUniformOptions"); + static_assert( + offsetof(tint::writer::ArrayLengthFromUniformOptions, bindpoint_to_size_index) == 8, + "Please update serialization for tint::writer::ArrayLengthFromUniformOptions"); + static_assert( + sizeof(tint::writer::ArrayLengthFromUniformOptions) == + 8 + sizeof(tint::writer::ArrayLengthFromUniformOptions::bindpoint_to_size_index), + "Please update serialization for tint::writer::ArrayLengthFromUniformOptions"); + StreamIn(sink, o.ubo_binding, o.bindpoint_to_size_index); +} + +} // namespace dawn::native diff --git a/src/dawn/native/Surface.cpp b/src/dawn/native/Surface.cpp index 6fc1e80fc3..6822dbbe48 100644 --- a/src/dawn/native/Surface.cpp +++ b/src/dawn/native/Surface.cpp @@ -19,10 +19,10 @@ #include "dawn/native/Instance.h" #include "dawn/native/SwapChain.h" -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) #include #include -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) #if defined(DAWN_USE_X11) #include "dawn/common/xlib_with_undefs.h" @@ -41,6 +41,9 @@ absl::FormatConvertResult AbslFormatConv case Surface::Type::MetalLayer: s->Append("MetalLayer"); break; + case Surface::Type::WaylandSurface: + s->Append("WaylandSurface"); + break; case Surface::Type::WindowsHWND: s->Append("WindowsHWND"); break; @@ -84,7 +87,7 @@ MaybeError ValidateSurfaceDescriptor(const InstanceBase* instance, } #endif // defined(DAWN_ENABLE_BACKEND_METAL) -#if defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(ANDROID) const SurfaceDescriptorFromAndroidNativeWindow* androidDesc = nullptr; FindInChain(descriptor->nextInChain, &androidDesc); // Currently the best validation we can do since it's not possible to check if the pointer @@ -93,17 +96,17 @@ MaybeError ValidateSurfaceDescriptor(const InstanceBase* instance, DAWN_INVALID_IF(androidDesc->window == nullptr, "Android window is not set."); return {}; } -#endif // defined(DAWN_PLATFORM_ANDROID) +#endif // DAWN_PLATFORM_IS(ANDROID) -#if defined(DAWN_PLATFORM_WINDOWS) -#if defined(DAWN_PLATFORM_WIN32) +#if DAWN_PLATFORM_IS(WINDOWS) +#if DAWN_PLATFORM_IS(WIN32) const SurfaceDescriptorFromWindowsHWND* hwndDesc = nullptr; FindInChain(descriptor->nextInChain, &hwndDesc); if (hwndDesc) { DAWN_INVALID_IF(IsWindow(static_cast(hwndDesc->hwnd)) == 0, "Invalid HWND"); return {}; } -#endif // defined(DAWN_PLATFORM_WIN32) +#endif // DAWN_PLATFORM_IS(WIN32) const SurfaceDescriptorFromWindowsCoreWindow* coreWindowDesc = nullptr; FindInChain(descriptor->nextInChain, &coreWindowDesc); if (coreWindowDesc) { @@ -126,7 +129,19 @@ MaybeError ValidateSurfaceDescriptor(const InstanceBase* instance, "Invalid SwapChainPanel"); return {}; } -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) + +#if defined(DAWN_USE_WAYLAND) + const SurfaceDescriptorFromWaylandSurface* waylandDesc = nullptr; + FindInChain(descriptor->nextInChain, &waylandDesc); + if (waylandDesc) { + // Unfortunately we can't check the validity of wayland objects. Only that they + // aren't nullptr. + DAWN_INVALID_IF(waylandDesc->display == nullptr, "Wayland display is nullptr."); + DAWN_INVALID_IF(waylandDesc->surface == nullptr, "Wayland surface is nullptr."); + return {}; + } +#endif // defined(DAWN_USE_X11) #if defined(DAWN_USE_X11) const SurfaceDescriptorFromXlibWindow* xDesc = nullptr; @@ -150,14 +165,22 @@ MaybeError ValidateSurfaceDescriptor(const InstanceBase* instance, return DAWN_FORMAT_VALIDATION_ERROR("Unsupported sType (%s)", descriptor->nextInChain->sType); } +// static +Surface* Surface::MakeError(InstanceBase* instance) { + return new Surface(instance, ErrorMonad::kError); +} + +Surface::Surface(InstanceBase* instance, ErrorTag tag) : ErrorMonad(tag), mInstance(instance) {} + Surface::Surface(InstanceBase* instance, const SurfaceDescriptor* descriptor) - : mInstance(instance) { + : ErrorMonad(), mInstance(instance) { ASSERT(descriptor->nextInChain != nullptr); const SurfaceDescriptorFromAndroidNativeWindow* androidDesc = nullptr; const SurfaceDescriptorFromMetalLayer* metalDesc = nullptr; const SurfaceDescriptorFromWindowsHWND* hwndDesc = nullptr; const SurfaceDescriptorFromWindowsCoreWindow* coreWindowDesc = nullptr; const SurfaceDescriptorFromWindowsSwapChainPanel* swapChainPanelDesc = nullptr; + const SurfaceDescriptorFromWaylandSurface* waylandDesc = nullptr; const SurfaceDescriptorFromXlibWindow* xDesc = nullptr; FindInChain(descriptor->nextInChain, &androidDesc); FindInChain(descriptor->nextInChain, &metalDesc); @@ -171,20 +194,24 @@ Surface::Surface(InstanceBase* instance, const SurfaceDescriptor* descriptor) } else if (androidDesc) { mType = Type::AndroidWindow; mAndroidNativeWindow = androidDesc->window; + } else if (waylandDesc) { + mType = Type::WaylandSurface; + mWaylandDisplay = waylandDesc->display; + mWaylandSurface = waylandDesc->surface; } else if (hwndDesc) { mType = Type::WindowsHWND; mHInstance = hwndDesc->hinstance; mHWND = hwndDesc->hwnd; } else if (coreWindowDesc) { -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) mType = Type::WindowsCoreWindow; mCoreWindow = static_cast(coreWindowDesc->coreWindow); -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) } else if (swapChainPanelDesc) { -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) mType = Type::WindowsSwapChainPanel; mSwapChainPanel = static_cast(swapChainPanelDesc->swapChainPanel); -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) } else if (xDesc) { mType = Type::XlibWindow; mXDisplay = xDesc->display; @@ -202,43 +229,61 @@ Surface::~Surface() { } NewSwapChainBase* Surface::GetAttachedSwapChain() { + ASSERT(!IsError()); return mSwapChain.Get(); } void Surface::SetAttachedSwapChain(NewSwapChainBase* swapChain) { + ASSERT(!IsError()); mSwapChain = swapChain; } -InstanceBase* Surface::GetInstance() { +InstanceBase* Surface::GetInstance() const { return mInstance.Get(); } Surface::Type Surface::GetType() const { + ASSERT(!IsError()); return mType; } void* Surface::GetAndroidNativeWindow() const { + ASSERT(!IsError()); ASSERT(mType == Type::AndroidWindow); return mAndroidNativeWindow; } void* Surface::GetMetalLayer() const { + ASSERT(!IsError()); ASSERT(mType == Type::MetalLayer); return mMetalLayer; } +void* Surface::GetWaylandDisplay() const { + ASSERT(mType == Type::WaylandSurface); + return mWaylandDisplay; +} + +void* Surface::GetWaylandSurface() const { + ASSERT(mType == Type::WaylandSurface); + return mWaylandSurface; +} + void* Surface::GetHInstance() const { + ASSERT(!IsError()); ASSERT(mType == Type::WindowsHWND); return mHInstance; } void* Surface::GetHWND() const { + ASSERT(!IsError()); ASSERT(mType == Type::WindowsHWND); return mHWND; } IUnknown* Surface::GetCoreWindow() const { + ASSERT(!IsError()); ASSERT(mType == Type::WindowsCoreWindow); -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) return mCoreWindow.Get(); #else return nullptr; @@ -246,8 +291,9 @@ IUnknown* Surface::GetCoreWindow() const { } IUnknown* Surface::GetSwapChainPanel() const { + ASSERT(!IsError()); ASSERT(mType == Type::WindowsSwapChainPanel); -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) return mSwapChainPanel.Get(); #else return nullptr; @@ -255,10 +301,12 @@ IUnknown* Surface::GetSwapChainPanel() const { } void* Surface::GetXDisplay() const { + ASSERT(!IsError()); ASSERT(mType == Type::XlibWindow); return mXDisplay; } uint32_t Surface::GetXWindow() const { + ASSERT(!IsError()); ASSERT(mType == Type::XlibWindow); return mXWindow; } diff --git a/src/dawn/native/Surface.h b/src/dawn/native/Surface.h index b3430f8c63..96da3c2549 100644 --- a/src/dawn/native/Surface.h +++ b/src/dawn/native/Surface.h @@ -15,17 +15,17 @@ #ifndef SRC_DAWN_NATIVE_SURFACE_H_ #define SRC_DAWN_NATIVE_SURFACE_H_ -#include "dawn/common/RefCounted.h" #include "dawn/native/Error.h" #include "dawn/native/Forward.h" +#include "dawn/native/ObjectBase.h" #include "dawn/native/dawn_platform.h" #include "dawn/common/Platform.h" -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) #include "dawn/native/d3d12/d3d12_platform.h" -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) // Forward declare IUnknown // GetCoreWindow needs to return an IUnknown pointer @@ -42,8 +42,10 @@ MaybeError ValidateSurfaceDescriptor(const InstanceBase* instance, // ObjectiveC). // The surface is also used to store the current swapchain so that we can detach it when it is // replaced. -class Surface final : public RefCounted { +class Surface final : public ErrorMonad { public: + static Surface* MakeError(InstanceBase* instance); + Surface(InstanceBase* instance, const SurfaceDescriptor* descriptor); void SetAttachedSwapChain(NewSwapChainBase* swapChain); @@ -53,13 +55,14 @@ class Surface final : public RefCounted { enum class Type { AndroidWindow, MetalLayer, + WaylandSurface, WindowsHWND, WindowsCoreWindow, WindowsSwapChainPanel, XlibWindow, }; Type GetType() const; - InstanceBase* GetInstance(); + InstanceBase* GetInstance() const; // Valid to call if the type is MetalLayer void* GetMetalLayer() const; @@ -67,6 +70,10 @@ class Surface final : public RefCounted { // Valid to call if the type is Android void* GetAndroidNativeWindow() const; + // Valid to call if the type is WaylandSurface + void* GetWaylandDisplay() const; + void* GetWaylandSurface() const; + // Valid to call if the type is WindowsHWND void* GetHInstance() const; void* GetHWND() const; @@ -82,6 +89,7 @@ class Surface final : public RefCounted { uint32_t GetXWindow() const; private: + Surface(InstanceBase* instance, ErrorMonad::ErrorTag tag); ~Surface() override; Ref mInstance; @@ -96,17 +104,21 @@ class Surface final : public RefCounted { // ANativeWindow void* mAndroidNativeWindow = nullptr; + // Wayland + void* mWaylandDisplay = nullptr; + void* mWaylandSurface = nullptr; + // WindowsHwnd void* mHInstance = nullptr; void* mHWND = nullptr; -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) // WindowsCoreWindow ComPtr mCoreWindow; // WindowsSwapChainPanel ComPtr mSwapChainPanel; -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) // Xlib void* mXDisplay = nullptr; diff --git a/src/dawn/native/SwapChain.cpp b/src/dawn/native/SwapChain.cpp index 12d09f0f80..41eaf59c71 100644 --- a/src/dawn/native/SwapChain.cpp +++ b/src/dawn/native/SwapChain.cpp @@ -66,17 +66,18 @@ MaybeError ValidateSwapChainDescriptor(const DeviceBase* device, } else { DAWN_INVALID_IF(surface == nullptr, "At least one of surface or implementation must be set"); + DAWN_INVALID_IF(surface->IsError(), "[Surface] is invalid."); DAWN_TRY(ValidatePresentMode(descriptor->presentMode)); // TODO(crbug.com/dawn/160): Lift this restriction once wgpu::Instance::GetPreferredSurfaceFormat is // implemented. // TODO(dawn:286): -#if defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(ANDROID) constexpr wgpu::TextureFormat kRequireSwapChainFormat = wgpu::TextureFormat::RGBA8Unorm; #else constexpr wgpu::TextureFormat kRequireSwapChainFormat = wgpu::TextureFormat::BGRA8Unorm; -#endif // !defined(DAWN_PLATFORM_ANDROID) +#endif // !DAWN_PLATFORM_IS(ANDROID) DAWN_INVALID_IF(descriptor->format != kRequireSwapChainFormat, "Format (%s) is not %s, which is (currently) the only accepted format.", descriptor->format, kRequireSwapChainFormat); @@ -334,10 +335,10 @@ ResultOrError> NewSwapChainBase::GetCurrentTextureView() { ASSERT(mCurrentTextureView->GetLayerCount() == 1); ASSERT(mCurrentTextureView->GetDimension() == wgpu::TextureViewDimension::e2D); ASSERT(mCurrentTextureView->GetTexture() - ->GetMipLevelVirtualSize(mCurrentTextureView->GetBaseMipLevel()) + ->GetMipLevelSingleSubresourceVirtualSize(mCurrentTextureView->GetBaseMipLevel()) .width == mWidth); ASSERT(mCurrentTextureView->GetTexture() - ->GetMipLevelVirtualSize(mCurrentTextureView->GetBaseMipLevel()) + ->GetMipLevelSingleSubresourceVirtualSize(mCurrentTextureView->GetBaseMipLevel()) .height == mHeight); return mCurrentTextureView; diff --git a/src/dawn/native/Texture.cpp b/src/dawn/native/Texture.cpp index a2b18f4722..72b6051274 100644 --- a/src/dawn/native/Texture.cpp +++ b/src/dawn/native/Texture.cpp @@ -169,6 +169,10 @@ MaybeError ValidateSampleCount(const TextureDescriptor* descriptor, DAWN_INVALID_IF(usage & wgpu::TextureUsage::StorageBinding, "The sample count (%u) of a storage textures is not 1.", descriptor->sampleCount); + + DAWN_INVALID_IF((usage & wgpu::TextureUsage::RenderAttachment) == 0, + "The usage (%s) of a multisampled texture doesn't include (%s).", + descriptor->usage, wgpu::TextureUsage::RenderAttachment); } return {}; @@ -336,7 +340,7 @@ MaybeError ValidateTextureDescriptor(const DeviceBase* device, DAWN_INVALID_IF( internalUsageDesc != nullptr && !device->IsFeatureEnabled(Feature::DawnInternalUsages), - "The dawn-internal-usages feature is not enabled"); + "The internalUsageDesc is not empty while the dawn-internal-usages feature is not enabled"); const Format* format; DAWN_TRY_ASSIGN(format, device->GetInternalFormat(descriptor->format)); @@ -441,7 +445,7 @@ ResultOrError GetTextureViewDescriptorWithDefaults( } // The default value for the view dimension depends on the texture's dimension with a - // special case for 2DArray being chosen automatically if arrayLayerCount is unspecified. + // special case for 2DArray being chosen if texture is 2D but has more than one array layer. if (desc.dimension == wgpu::TextureViewDimension::Undefined) { switch (texture->GetDimension()) { case wgpu::TextureDimension::e1D: @@ -449,7 +453,11 @@ ResultOrError GetTextureViewDescriptorWithDefaults( break; case wgpu::TextureDimension::e2D: - desc.dimension = wgpu::TextureViewDimension::e2D; + if (texture->GetArrayLayers() == 1) { + desc.dimension = wgpu::TextureViewDimension::e2D; + } else { + desc.dimension = wgpu::TextureViewDimension::e2DArray; + } break; case wgpu::TextureDimension::e3D: @@ -525,7 +533,8 @@ TextureBase::TextureBase(DeviceBase* device, mSampleCount(descriptor->sampleCount), mUsage(descriptor->usage), mInternalUsage(mUsage), - mState(state) { + mState(state), + mFormatEnumForReflection(descriptor->format) { uint32_t subresourceCount = mMipLevelCount * GetArrayLayers() * GetAspectCount(mFormat.aspects); mIsSubresourceContentInitializedAtIndex = std::vector(subresourceCount, false); @@ -546,23 +555,34 @@ TextureBase::TextureBase(DeviceBase* device, TrackInDevice(); } -static Format kUnusedFormat; +TextureBase::~TextureBase() = default; + +static constexpr Format kUnusedFormat; TextureBase::TextureBase(DeviceBase* device, TextureState state) : ApiObjectBase(device, kLabelNotImplemented), mFormat(kUnusedFormat), mState(state) { TrackInDevice(); } -TextureBase::TextureBase(DeviceBase* device, ObjectBase::ErrorTag tag) - : ApiObjectBase(device, tag), mFormat(kUnusedFormat) {} +TextureBase::TextureBase(DeviceBase* device, + const TextureDescriptor* descriptor, + ObjectBase::ErrorTag tag) + : ApiObjectBase(device, tag), + mDimension(descriptor->dimension), + mFormat(kUnusedFormat), + mSize(descriptor->size), + mMipLevelCount(descriptor->mipLevelCount), + mSampleCount(descriptor->sampleCount), + mUsage(descriptor->usage), + mFormatEnumForReflection(descriptor->format) {} void TextureBase::DestroyImpl() { mState = TextureState::Destroyed; } // static -TextureBase* TextureBase::MakeError(DeviceBase* device) { - return new TextureBase(device, ObjectBase::kError); +TextureBase* TextureBase::MakeError(DeviceBase* device, const TextureDescriptor* descriptor) { + return new TextureBase(device, descriptor, ObjectBase::kError); } ObjectType TextureBase::GetType() const { @@ -630,6 +650,10 @@ wgpu::TextureUsage TextureBase::GetInternalUsage() const { ASSERT(!IsError()); return mInternalUsage; } +void TextureBase::AddInternalUsage(wgpu::TextureUsage usage) { + ASSERT(!IsError()); + mInternalUsage |= usage; +} TextureBase::TextureState TextureBase::GetTextureState() const { ASSERT(!IsError()); @@ -689,7 +713,7 @@ bool TextureBase::IsMultisampledTexture() const { return mSampleCount > 1; } -Extent3D TextureBase::GetMipLevelVirtualSize(uint32_t level) const { +Extent3D TextureBase::GetMipLevelSingleSubresourceVirtualSize(uint32_t level) const { Extent3D extent = {std::max(mSize.width >> level, 1u), 1u, 1u}; if (mDimension == wgpu::TextureDimension::e1D) { return extent; @@ -704,8 +728,8 @@ Extent3D TextureBase::GetMipLevelVirtualSize(uint32_t level) const { return extent; } -Extent3D TextureBase::GetMipLevelPhysicalSize(uint32_t level) const { - Extent3D extent = GetMipLevelVirtualSize(level); +Extent3D TextureBase::GetMipLevelSingleSubresourcePhysicalSize(uint32_t level) const { + Extent3D extent = GetMipLevelSingleSubresourceVirtualSize(level); // Compressed Textures will have paddings if their width or height is not a multiple of // 4 at non-zero mipmap levels. @@ -725,7 +749,7 @@ Extent3D TextureBase::GetMipLevelPhysicalSize(uint32_t level) const { Extent3D TextureBase::ClampToMipLevelVirtualSize(uint32_t level, const Origin3D& origin, const Extent3D& extent) const { - const Extent3D virtualSizeAtLevel = GetMipLevelVirtualSize(level); + const Extent3D virtualSizeAtLevel = GetMipLevelSingleSubresourceVirtualSize(level); ASSERT(origin.x <= virtualSizeAtLevel.width); ASSERT(origin.y <= virtualSizeAtLevel.height); uint32_t clampedCopyExtentWidth = (extent.width > virtualSizeAtLevel.width - origin.x) @@ -761,6 +785,37 @@ void TextureBase::APIDestroy() { Destroy(); } +uint32_t TextureBase::APIGetWidth() const { + return mSize.width; +} + +uint32_t TextureBase::APIGetHeight() const { + return mSize.height; +} +uint32_t TextureBase::APIGetDepthOrArrayLayers() const { + return mSize.depthOrArrayLayers; +} + +uint32_t TextureBase::APIGetMipLevelCount() const { + return mMipLevelCount; +} + +uint32_t TextureBase::APIGetSampleCount() const { + return mSampleCount; +} + +wgpu::TextureDimension TextureBase::APIGetDimension() const { + return mDimension; +} + +wgpu::TextureFormat TextureBase::APIGetFormat() const { + return mFormatEnumForReflection; +} + +wgpu::TextureUsage TextureBase::APIGetUsage() const { + return mUsage; +} + MaybeError TextureBase::ValidateDestroy() const { DAWN_TRY(GetDevice()->ValidateObject(this)); return {}; @@ -789,6 +844,8 @@ TextureViewBase::TextureViewBase(TextureBase* texture) TextureViewBase::TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag) : ApiObjectBase(device, tag), mFormat(kUnusedFormat) {} +TextureViewBase::~TextureViewBase() = default; + void TextureViewBase::DestroyImpl() {} // static diff --git a/src/dawn/native/Texture.h b/src/dawn/native/Texture.h index 9cf5f53fd6..84faa6914d 100644 --- a/src/dawn/native/Texture.h +++ b/src/dawn/native/Texture.h @@ -46,9 +46,8 @@ class TextureBase : public ApiObjectBase { public: enum class TextureState { OwnedInternal, OwnedExternal, Destroyed }; enum class ClearValue { Zero, NonZero }; - TextureBase(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state); - static TextureBase* MakeError(DeviceBase* device); + static TextureBase* MakeError(DeviceBase* device, const TextureDescriptor* descriptor); ObjectType GetType() const override; @@ -85,8 +84,8 @@ class TextureBase : public ApiObjectBase { // size is the one with paddings if necessary, which is always a multiple of the block size // and used in texture copying. The virtual size is the one without paddings, which is not // required to be a multiple of the block size and used in texture sampling. - Extent3D GetMipLevelPhysicalSize(uint32_t level) const; - Extent3D GetMipLevelVirtualSize(uint32_t level) const; + Extent3D GetMipLevelSingleSubresourcePhysicalSize(uint32_t level) const; + Extent3D GetMipLevelSingleSubresourceVirtualSize(uint32_t level) const; Extent3D ClampToMipLevelVirtualSize(uint32_t level, const Origin3D& origin, const Extent3D& extent) const; @@ -97,14 +96,26 @@ class TextureBase : public ApiObjectBase { // Dawn API TextureViewBase* APICreateView(const TextureViewDescriptor* descriptor = nullptr); void APIDestroy(); + uint32_t APIGetWidth() const; + uint32_t APIGetHeight() const; + uint32_t APIGetDepthOrArrayLayers() const; + uint32_t APIGetMipLevelCount() const; + uint32_t APIGetSampleCount() const; + wgpu::TextureDimension APIGetDimension() const; + wgpu::TextureFormat APIGetFormat() const; + wgpu::TextureUsage APIGetUsage() const; protected: + TextureBase(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state); // Constructor used only for mocking and testing. TextureBase(DeviceBase* device, TextureState state); + ~TextureBase() override; + void DestroyImpl() override; + void AddInternalUsage(wgpu::TextureUsage usage); private: - TextureBase(DeviceBase* device, ObjectBase::ErrorTag tag); + TextureBase(DeviceBase* device, const TextureDescriptor* descriptor, ObjectBase::ErrorTag tag); MaybeError ValidateDestroy() const; wgpu::TextureDimension mDimension; @@ -116,6 +127,7 @@ class TextureBase : public ApiObjectBase { wgpu::TextureUsage mUsage = wgpu::TextureUsage::None; wgpu::TextureUsage mInternalUsage = wgpu::TextureUsage::None; TextureState mState; + wgpu::TextureFormat mFormatEnumForReflection; // TODO(crbug.com/dawn/845): Use a more optimized data structure to save space std::vector mIsSubresourceContentInitializedAtIndex; @@ -124,6 +136,7 @@ class TextureBase : public ApiObjectBase { class TextureViewBase : public ApiObjectBase { public: TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor); + ~TextureViewBase() override; static TextureViewBase* MakeError(DeviceBase* device); diff --git a/src/dawn/native/TintUtils.cpp b/src/dawn/native/TintUtils.cpp index ca4aea40e4..f59e6e5cd1 100644 --- a/src/dawn/native/TintUtils.cpp +++ b/src/dawn/native/TintUtils.cpp @@ -14,7 +14,10 @@ #include "dawn/native/TintUtils.h" +#include "dawn/native/BindGroupLayout.h" #include "dawn/native/Device.h" +#include "dawn/native/PipelineLayout.h" +#include "dawn/native/RenderPipeline.h" #include "tint/tint.h" @@ -35,6 +38,87 @@ bool InitializeTintErrorReporter() { return true; } +tint::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) { + switch (format) { + case wgpu::VertexFormat::Uint8x2: + return tint::transform::VertexFormat::kUint8x2; + case wgpu::VertexFormat::Uint8x4: + return tint::transform::VertexFormat::kUint8x4; + case wgpu::VertexFormat::Sint8x2: + return tint::transform::VertexFormat::kSint8x2; + case wgpu::VertexFormat::Sint8x4: + return tint::transform::VertexFormat::kSint8x4; + case wgpu::VertexFormat::Unorm8x2: + return tint::transform::VertexFormat::kUnorm8x2; + case wgpu::VertexFormat::Unorm8x4: + return tint::transform::VertexFormat::kUnorm8x4; + case wgpu::VertexFormat::Snorm8x2: + return tint::transform::VertexFormat::kSnorm8x2; + case wgpu::VertexFormat::Snorm8x4: + return tint::transform::VertexFormat::kSnorm8x4; + case wgpu::VertexFormat::Uint16x2: + return tint::transform::VertexFormat::kUint16x2; + case wgpu::VertexFormat::Uint16x4: + return tint::transform::VertexFormat::kUint16x4; + case wgpu::VertexFormat::Sint16x2: + return tint::transform::VertexFormat::kSint16x2; + case wgpu::VertexFormat::Sint16x4: + return tint::transform::VertexFormat::kSint16x4; + case wgpu::VertexFormat::Unorm16x2: + return tint::transform::VertexFormat::kUnorm16x2; + case wgpu::VertexFormat::Unorm16x4: + return tint::transform::VertexFormat::kUnorm16x4; + case wgpu::VertexFormat::Snorm16x2: + return tint::transform::VertexFormat::kSnorm16x2; + case wgpu::VertexFormat::Snorm16x4: + return tint::transform::VertexFormat::kSnorm16x4; + case wgpu::VertexFormat::Float16x2: + return tint::transform::VertexFormat::kFloat16x2; + case wgpu::VertexFormat::Float16x4: + return tint::transform::VertexFormat::kFloat16x4; + case wgpu::VertexFormat::Float32: + return tint::transform::VertexFormat::kFloat32; + case wgpu::VertexFormat::Float32x2: + return tint::transform::VertexFormat::kFloat32x2; + case wgpu::VertexFormat::Float32x3: + return tint::transform::VertexFormat::kFloat32x3; + case wgpu::VertexFormat::Float32x4: + return tint::transform::VertexFormat::kFloat32x4; + case wgpu::VertexFormat::Uint32: + return tint::transform::VertexFormat::kUint32; + case wgpu::VertexFormat::Uint32x2: + return tint::transform::VertexFormat::kUint32x2; + case wgpu::VertexFormat::Uint32x3: + return tint::transform::VertexFormat::kUint32x3; + case wgpu::VertexFormat::Uint32x4: + return tint::transform::VertexFormat::kUint32x4; + case wgpu::VertexFormat::Sint32: + return tint::transform::VertexFormat::kSint32; + case wgpu::VertexFormat::Sint32x2: + return tint::transform::VertexFormat::kSint32x2; + case wgpu::VertexFormat::Sint32x3: + return tint::transform::VertexFormat::kSint32x3; + case wgpu::VertexFormat::Sint32x4: + return tint::transform::VertexFormat::kSint32x4; + + case wgpu::VertexFormat::Undefined: + break; + } + UNREACHABLE(); +} + +tint::transform::VertexStepMode ToTintVertexStepMode(wgpu::VertexStepMode mode) { + switch (mode) { + case wgpu::VertexStepMode::Vertex: + return tint::transform::VertexStepMode::kVertex; + case wgpu::VertexStepMode::Instance: + return tint::transform::VertexStepMode::kInstance; + case wgpu::VertexStepMode::VertexBufferNotUsed: + break; + } + UNREACHABLE(); +} + } // namespace ScopedTintICEHandler::ScopedTintICEHandler(DeviceBase* device) { @@ -53,4 +137,58 @@ ScopedTintICEHandler::~ScopedTintICEHandler() { tlDevice = nullptr; } +tint::transform::MultiplanarExternalTexture::BindingsMap BuildExternalTextureTransformBindings( + const PipelineLayoutBase* layout) { + tint::transform::MultiplanarExternalTexture::BindingsMap newBindingsMap; + for (BindGroupIndex i : IterateBitSet(layout->GetBindGroupLayoutsMask())) { + const BindGroupLayoutBase* bgl = layout->GetBindGroupLayout(i); + for (const auto& [_, expansion] : bgl->GetExternalTextureBindingExpansionMap()) { + newBindingsMap[{static_cast(i), static_cast(expansion.plane0)}] = { + {static_cast(i), static_cast(expansion.plane1)}, + {static_cast(i), static_cast(expansion.params)}}; + } + } + return newBindingsMap; +} + +tint::transform::VertexPulling::Config BuildVertexPullingTransformConfig( + const RenderPipelineBase& renderPipeline, + const std::string_view& entryPoint, + BindGroupIndex pullingBufferBindingSet) { + tint::transform::VertexPulling::Config cfg; + cfg.entry_point_name = entryPoint; + cfg.pulling_group = static_cast(pullingBufferBindingSet); + + cfg.vertex_state.resize(renderPipeline.GetVertexBufferCount()); + for (VertexBufferSlot slot : IterateBitSet(renderPipeline.GetVertexBufferSlotsUsed())) { + const VertexBufferInfo& dawnInfo = renderPipeline.GetVertexBuffer(slot); + tint::transform::VertexBufferLayoutDescriptor* tintInfo = + &cfg.vertex_state[static_cast(slot)]; + + tintInfo->array_stride = dawnInfo.arrayStride; + tintInfo->step_mode = ToTintVertexStepMode(dawnInfo.stepMode); + } + + for (VertexAttributeLocation location : + IterateBitSet(renderPipeline.GetAttributeLocationsUsed())) { + const VertexAttributeInfo& dawnInfo = renderPipeline.GetAttribute(location); + tint::transform::VertexAttributeDescriptor tintInfo; + tintInfo.format = ToTintVertexFormat(dawnInfo.format); + tintInfo.offset = dawnInfo.offset; + tintInfo.shader_location = static_cast(static_cast(location)); + + uint8_t vertexBufferSlot = static_cast(dawnInfo.vertexBufferSlot); + cfg.vertex_state[vertexBufferSlot].attributes.push_back(tintInfo); + } + return cfg; +} + } // namespace dawn::native + +namespace tint::sem { + +bool operator<(const BindingPoint& a, const BindingPoint& b) { + return std::tie(a.group, a.binding) < std::tie(b.group, b.binding); +} + +} // namespace tint::sem diff --git a/src/dawn/native/TintUtils.h b/src/dawn/native/TintUtils.h index 4a2df60d75..7c03881502 100644 --- a/src/dawn/native/TintUtils.h +++ b/src/dawn/native/TintUtils.h @@ -15,11 +15,18 @@ #ifndef SRC_DAWN_NATIVE_TINTUTILS_H_ #define SRC_DAWN_NATIVE_TINTUTILS_H_ +#include + #include "dawn/common/NonCopyable.h" +#include "dawn/native/IntegerTypes.h" + +#include "tint/tint.h" namespace dawn::native { class DeviceBase; +class PipelineLayoutBase; +class RenderPipelineBase; // Indicates that for the lifetime of this object tint internal compiler errors should be // reported to the given device. @@ -32,6 +39,21 @@ class ScopedTintICEHandler : public NonCopyable { ScopedTintICEHandler(ScopedTintICEHandler&&) = delete; }; +tint::transform::MultiplanarExternalTexture::BindingsMap BuildExternalTextureTransformBindings( + const PipelineLayoutBase* layout); + +tint::transform::VertexPulling::Config BuildVertexPullingTransformConfig( + const RenderPipelineBase& renderPipeline, + const std::string_view& entryPoint, + BindGroupIndex pullingBufferBindingSet); + } // namespace dawn::native +namespace tint::sem { + +// Defin operator< for std::map containing BindingPoint +bool operator<(const BindingPoint& a, const BindingPoint& b); + +} // namespace tint::sem + #endif // SRC_DAWN_NATIVE_TINTUTILS_H_ diff --git a/src/dawn/native/Toggles.cpp b/src/dawn/native/Toggles.cpp index bc2fcbd3fa..8fbf0e3e81 100644 --- a/src/dawn/native/Toggles.cpp +++ b/src/dawn/native/Toggles.cpp @@ -182,9 +182,8 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{ "Split texture-to-texture copy into two copies: copy from source texture into a temporary " "buffer, and copy from the temporary buffer into the destination texture under specific " "situations. This workaround is by default enabled on some Intel GPUs which have a driver " - "bug " - "in the execution of CopyTextureRegion() when we copy with the formats whose texel block " - "sizes are less than 4 bytes from a greater mip level to a smaller mip level on D3D12 " + "bug in the execution of CopyTextureRegion() when we copy with the formats whose texel " + "block sizes are less than 4 bytes from a greater mip level to a smaller mip level on D3D12 " "backends.", "https://crbug.com/1161355"}}, {Toggle::EmitHLSLDebugSymbols, @@ -203,8 +202,6 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{ "Dump shaders for debugging purposes. Dumped shaders will be log via EmitLog, thus printed " "in Chrome console or consumed by user-defined callback function.", "https://crbug.com/dawn/792"}}, - {Toggle::DEPRECATED_DumpTranslatedShaders, - {"dump_translated_shaders", "Deprecated. Use dump_shaders", "https://crbug.com/dawn/792"}}, {Toggle::ForceWGSLStep, {"force_wgsl_step", "When ingesting SPIR-V shaders, force a first conversion to WGSL. This allows testing Tint's " @@ -268,24 +265,57 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{ "Enables usage of the blob cache (backed by the platform cache if set/passed). Necessary for " "any persistent caching capabilities, i.e. pipeline caching.", "https://crbug.com/dawn/549"}}, + {Toggle::D3D12ForceClearCopyableDepthStencilTextureOnCreation, + {"d3d12_force_clear_copyable_depth_stencil_texture_on_creation", + "Always clearing copyable depth stencil textures when creating them instead of skipping the " + "initialization when the entire subresource is the copy destination as a workaround on Intel " + "D3D12 drivers.", + "https://crbug.com/dawn/1487"}}, + {Toggle::D3D12DontSetClearValueOnDepthTextureCreation, + {"d3d12_dont_set_clear_value_on_depth_texture_creation", + "Don't set D3D12_CLEAR_VALUE when creating depth textures with CreatePlacedResource() or " + "CreateCommittedResource() as a workaround on Intel Gen12 D3D12 drivers.", + "https://crbug.com/dawn/1487"}}, + {Toggle::D3D12AlwaysUseTypelessFormatsForCastableTexture, + {"d3d12_always_use_typeless_formats_for_castable_texture", + "Always use the typeless DXGI format when we create a texture with valid viewFormat. This " + "Toggle is enabled by default on the D3D12 platforms where CastingFullyTypedFormatSupported " + "is false.", + "https://crbug.com/dawn/1276"}}, + {Toggle::D3D12AllocateExtraMemoryFor2DArrayTexture, + {"d3d12_allocate_extra_memory_for_2d_array_texture", + "Memory allocation for 2D array texture may be smaller than it should be on D3D12 on some " + "Intel devices. So texture access can be out-of-bound, which may cause critical security " + "issue. We can workaround this security issue via allocating extra memory and limiting its " + "access in itself.", + "https://crbug.com/dawn/949"}}, + {Toggle::D3D12UseTempBufferInDepthStencilTextureAndBufferCopyWithNonZeroBufferOffset, + {"d3d12_use_temp_buffer_in_depth_stencil_texture_and_buffer_copy_with_non_zero_buffer_offset", + "Split buffer-texture copy into two copies: do first copy with a temporary buffer at offset " + "0, then copy from the temporary buffer to the destination. Now this toggle must be enabled " + "on the D3D12 platforms where programmable MSAA is not supported.", + "https://crbug.com/dawn/727"}}, + {Toggle::ApplyClearBigIntegerColorValueWithDraw, + {"apply_clear_big_integer_color_value_with_draw", + "Apply the clear value of the color attachment with a draw call when load op is 'clear'. " + "This toggle is enabled by default on D3D12 backends when we set large integer values " + "(> 2^24 or < -2^24 for signed integer formats) as the clear value of a color attachment " + "with 32-bit integer or unsigned integer formats because D3D12 APIs only support using " + "float numbers as clear values, while a float number cannot always precisely represent an " + "integer that is greater than 2^24 or smaller than -2^24). This toggle is also enabled on " + "Intel GPUs on Metal backend due to a driver issue on Intel Metal driver.", + "https://crbug.com/dawn/537"}}, // Comment to separate the }} so it is clearer what to copy-paste to add a toggle. }}; } // anonymous namespace void TogglesSet::Set(Toggle toggle, bool enabled) { - if (toggle == Toggle::DEPRECATED_DumpTranslatedShaders) { - Set(Toggle::DumpShaders, enabled); - return; - } ASSERT(toggle != Toggle::InvalidEnum); const size_t toggleIndex = static_cast(toggle); toggleBitset.set(toggleIndex, enabled); } bool TogglesSet::Has(Toggle toggle) const { - if (toggle == Toggle::DEPRECATED_DumpTranslatedShaders) { - return Has(Toggle::DumpShaders); - } ASSERT(toggle != Toggle::InvalidEnum); const size_t toggleIndex = static_cast(toggle); return toggleBitset.test(toggleIndex); @@ -313,6 +343,10 @@ const char* ToggleEnumToName(Toggle toggle) { return toggleNameAndInfo.info.name; } +TogglesInfo::TogglesInfo() = default; + +TogglesInfo::~TogglesInfo() = default; + const ToggleInfo* TogglesInfo::GetToggleInfo(const char* toggleName) { ASSERT(toggleName); diff --git a/src/dawn/native/Toggles.h b/src/dawn/native/Toggles.h index 2d8d286882..5e000f9f6e 100644 --- a/src/dawn/native/Toggles.h +++ b/src/dawn/native/Toggles.h @@ -59,7 +59,6 @@ enum class Toggle { EmitHLSLDebugSymbols, DisallowSpirv, DumpShaders, - DEPRECATED_DumpTranslatedShaders, // Use DumpShaders ForceWGSLStep, DisableWorkgroupInit, DisableSymbolRenaming, @@ -72,6 +71,12 @@ enum class Toggle { D3D12SplitBufferTextureCopyForRowsPerImagePaddings, MetalRenderR8RG8UnormSmallMipToTempTexture, EnableBlobCache, + D3D12ForceClearCopyableDepthStencilTextureOnCreation, + D3D12DontSetClearValueOnDepthTextureCreation, + D3D12AlwaysUseTypelessFormatsForCastableTexture, + D3D12AllocateExtraMemoryFor2DArrayTexture, + D3D12UseTempBufferInDepthStencilTextureAndBufferCopyWithNonZeroBufferOffset, + ApplyClearBigIntegerColorValueWithDraw, EnumCount, InvalidEnum = EnumCount, @@ -91,6 +96,9 @@ const char* ToggleEnumToName(Toggle toggle); class TogglesInfo { public: + TogglesInfo(); + ~TogglesInfo(); + // Used to query the details of a toggle. Return nullptr if toggleName is not a valid name // of a toggle supported in Dawn. const ToggleInfo* GetToggleInfo(const char* toggleName); diff --git a/src/dawn/native/UsageValidationMode.h b/src/dawn/native/UsageValidationMode.h new file mode 100644 index 0000000000..2228bb46e3 --- /dev/null +++ b/src/dawn/native/UsageValidationMode.h @@ -0,0 +1,27 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_USAGEVALIDATIONMODE_H_ +#define SRC_DAWN_NATIVE_USAGEVALIDATIONMODE_H_ + +namespace dawn::native { + +enum class UsageValidationMode { + Default, + Internal, +}; + +} // namespace dawn::native + +#endif // SRC_DAWN_NATIVE_USAGEVALIDATIONMODE_H_ diff --git a/src/dawn/native/VisitableMembers.h b/src/dawn/native/VisitableMembers.h new file mode 100644 index 0000000000..82fb58d535 --- /dev/null +++ b/src/dawn/native/VisitableMembers.h @@ -0,0 +1,65 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_VISITABLE_H_ +#define SRC_DAWN_NATIVE_VISITABLE_H_ + +#include + +#include "dawn/native/stream/BlobSource.h" +#include "dawn/native/stream/ByteVectorSink.h" +#include "dawn/native/stream/Stream.h" + +// Helper for X macro to declare a visitable member. +#define DAWN_INTERNAL_VISITABLE_MEMBER_DECL(type, name) type name{}; + +// Helper for X macro for visiting a visitable member. +#define DAWN_INTERNAL_VISITABLE_MEMBER_ARG(type, name) , name + +namespace dawn::native::detail { +constexpr int kInternalVisitableUnusedForComma = 0; +} // namespace dawn::native::detail + +// Helper X macro to declare members of a class or struct, along with VisitAll +// methods to call a functor on all members. +// Example usage: +// #define MEMBERS(X) \ +// X(int, a) \ +// X(float, b) \ +// X(Foo, foo) \ +// X(Bar, bar) +// struct MyStruct { +// DAWN_VISITABLE_MEMBERS(MEMBERS) +// }; +// #undef MEMBERS +#define DAWN_VISITABLE_MEMBERS(MEMBERS) \ + MEMBERS(DAWN_INTERNAL_VISITABLE_MEMBER_DECL) \ + \ + template \ + constexpr auto VisitAll(V&& visit) const { \ + return [&](int, const auto&... ms) { \ + return visit(ms...); \ + }(::dawn::native::detail::kInternalVisitableUnusedForComma MEMBERS( \ + DAWN_INTERNAL_VISITABLE_MEMBER_ARG)); \ + } \ + \ + template \ + constexpr auto VisitAll(V&& visit) { \ + return [&](int, auto&... ms) { \ + return visit(ms...); \ + }(::dawn::native::detail::kInternalVisitableUnusedForComma MEMBERS( \ + DAWN_INTERNAL_VISITABLE_MEMBER_ARG)); \ + } + +#endif // SRC_DAWN_NATIVE_VISITABLE_H_ diff --git a/src/dawn/native/d3d12/AdapterD3D12.cpp b/src/dawn/native/d3d12/AdapterD3D12.cpp index 5f48014de2..e23830e899 100644 --- a/src/dawn/native/d3d12/AdapterD3D12.cpp +++ b/src/dawn/native/d3d12/AdapterD3D12.cpp @@ -23,6 +23,7 @@ #include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/UtilsD3D12.h" namespace dawn::native::d3d12 { @@ -66,7 +67,7 @@ MaybeError Adapter::InitializeImpl() { // rendering. const PlatformFunctions* functions = GetBackend()->GetFunctions(); if (FAILED(functions->d3d12CreateDevice(GetHardwareAdapter(), D3D_FEATURE_LEVEL_11_0, - _uuidof(ID3D12Device), &mD3d12Device))) { + __uuidof(ID3D12Device), &mD3d12Device))) { return DAWN_INTERNAL_ERROR("D3D12CreateDevice failed"); } @@ -134,8 +135,19 @@ MaybeError Adapter::InitializeSupportedFeaturesImpl() { mSupportedFeatures.EnableFeature(Feature::TextureCompressionBC); mSupportedFeatures.EnableFeature(Feature::PipelineStatisticsQuery); mSupportedFeatures.EnableFeature(Feature::MultiPlanarFormats); - mSupportedFeatures.EnableFeature(Feature::Depth24UnormStencil8); mSupportedFeatures.EnableFeature(Feature::Depth32FloatStencil8); + mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance); + + if (GetBackend()->GetFunctions()->IsDXCAvailable()) { + uint64_t dxcVersion = 0; + DAWN_TRY_ASSIGN(dxcVersion, GetBackend()->GetDXCompilerVersion()); + constexpr uint64_t kLeastMajorVersionForDP4a = 1; + constexpr uint64_t kLeastMinorVersionForDP4a = 4; + if (mDeviceInfo.supportsDP4a && + dxcVersion >= MakeDXCVersion(kLeastMajorVersionForDP4a, kLeastMinorVersionForDP4a)) { + mSupportedFeatures.EnableFeature(Feature::ChromiumExperimentalDp4a); + } + } return {}; } @@ -228,6 +240,8 @@ MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) { limits->v1.maxSampledTexturesPerShaderStage = maxSRVsPerStage; limits->v1.maxSamplersPerShaderStage = maxSamplersPerStage; + limits->v1.maxColorAttachments = D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; + // https://docs.microsoft.com/en-us/windows/win32/direct3d12/root-signature-limits // In DWORDS. Descriptor tables cost 1, Root constants cost 1, Root descriptors cost 2. static constexpr uint32_t kMaxRootSignatureSize = 64u; @@ -287,11 +301,14 @@ MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) { // D3D12 has no documented limit on the size of a storage buffer binding. limits->v1.maxStorageBufferBindingSize = 4294967295; + // Using base limits for: // TODO(crbug.com/dawn/685): - // LIMITS NOT SET: // - maxInterStageShaderComponents // - maxVertexBufferArrayStride + // TODO(crbug.com/dawn/1448): + // - maxInterStageShaderVariables + return {}; } diff --git a/src/dawn/native/d3d12/BackendD3D12.cpp b/src/dawn/native/d3d12/BackendD3D12.cpp index 1232dbfe88..3d0b13f491 100644 --- a/src/dawn/native/d3d12/BackendD3D12.cpp +++ b/src/dawn/native/d3d12/BackendD3D12.cpp @@ -21,6 +21,7 @@ #include "dawn/native/d3d12/AdapterD3D12.h" #include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/UtilsD3D12.h" namespace dawn::native::d3d12 { @@ -141,6 +142,21 @@ ComPtr Backend::GetDxcValidator() const { return mDxcValidator; } +ResultOrError Backend::GetDXCompilerVersion() { + DAWN_TRY(EnsureDxcValidator()); + + ComPtr versionInfo; + DAWN_TRY(CheckHRESULT(mDxcValidator.As(&versionInfo), + "D3D12 QueryInterface IDxcValidator to IDxcVersionInfo")); + + uint32_t compilerMajor, compilerMinor; + DAWN_TRY(CheckHRESULT(versionInfo->GetVersion(&compilerMajor, &compilerMinor), + "IDxcVersionInfo::GetVersion")); + + // Pack both into a single version number. + return MakeDXCVersion(compilerMajor, compilerMinor); +} + const PlatformFunctions* Backend::GetFunctions() const { return mFunctions.get(); } diff --git a/src/dawn/native/d3d12/BackendD3D12.h b/src/dawn/native/d3d12/BackendD3D12.h index 9a983f21dc..1bf1ead583 100644 --- a/src/dawn/native/d3d12/BackendD3D12.h +++ b/src/dawn/native/d3d12/BackendD3D12.h @@ -40,6 +40,7 @@ class Backend : public BackendConnection { ComPtr GetDxcLibrary() const; ComPtr GetDxcCompiler() const; ComPtr GetDxcValidator() const; + ResultOrError GetDXCompilerVersion(); const PlatformFunctions* GetFunctions() const; diff --git a/src/dawn/native/d3d12/BlobD3D12.cpp b/src/dawn/native/d3d12/BlobD3D12.cpp new file mode 100644 index 0000000000..3b5965758d --- /dev/null +++ b/src/dawn/native/d3d12/BlobD3D12.cpp @@ -0,0 +1,43 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/d3d12/BlobD3D12.h" + +namespace dawn::native { + +Blob CreateBlob(ComPtr blob) { + // Detach so the deleter callback can "own" the reference + ID3DBlob* ptr = blob.Detach(); + return Blob::UnsafeCreateWithDeleter(reinterpret_cast(ptr->GetBufferPointer()), + ptr->GetBufferSize(), [=]() { + // Reattach and drop to delete it. + ComPtr b; + b.Attach(ptr); + b = nullptr; + }); +} + +Blob CreateBlob(ComPtr blob) { + // Detach so the deleter callback can "own" the reference + IDxcBlob* ptr = blob.Detach(); + return Blob::UnsafeCreateWithDeleter(reinterpret_cast(ptr->GetBufferPointer()), + ptr->GetBufferSize(), [=]() { + // Reattach and drop to delete it. + ComPtr b; + b.Attach(ptr); + b = nullptr; + }); +} + +} // namespace dawn::native diff --git a/src/dawn/native/d3d12/BlobD3D12.h b/src/dawn/native/d3d12/BlobD3D12.h new file mode 100644 index 0000000000..cc8c99c902 --- /dev/null +++ b/src/dawn/native/d3d12/BlobD3D12.h @@ -0,0 +1,23 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/Blob.h" +#include "dawn/native/d3d12/d3d12_platform.h" + +namespace dawn::native { + +Blob CreateBlob(ComPtr blob); +Blob CreateBlob(ComPtr blob); + +} // namespace dawn::native diff --git a/src/dawn/native/d3d12/CommandBufferD3D12.cpp b/src/dawn/native/d3d12/CommandBufferD3D12.cpp index 77c7ba3ca7..08aad3418e 100644 --- a/src/dawn/native/d3d12/CommandBufferD3D12.cpp +++ b/src/dawn/native/d3d12/CommandBufferD3D12.cpp @@ -90,10 +90,12 @@ bool CanUseCopyResource(const TextureCopy& src, const TextureCopy& dst, const Ex copySize.depthOrArrayLayers == srcSize.depthOrArrayLayers; } -void RecordWriteTimestampCmd(ID3D12GraphicsCommandList* commandList, WriteTimestampCmd* cmd) { - QuerySet* querySet = ToBackend(cmd->querySet.Get()); - ASSERT(D3D12QueryType(querySet->GetQueryType()) == D3D12_QUERY_TYPE_TIMESTAMP); - commandList->EndQuery(querySet->GetQueryHeap(), D3D12_QUERY_TYPE_TIMESTAMP, cmd->queryIndex); +void RecordWriteTimestampCmd(ID3D12GraphicsCommandList* commandList, + QuerySetBase* querySet, + uint32_t queryIndex) { + ASSERT(D3D12QueryType(ToBackend(querySet)->GetQueryType()) == D3D12_QUERY_TYPE_TIMESTAMP); + commandList->EndQuery(ToBackend(querySet)->GetQueryHeap(), D3D12_QUERY_TYPE_TIMESTAMP, + queryIndex); } void RecordResolveQuerySetCmd(ID3D12GraphicsCommandList* commandList, @@ -223,6 +225,87 @@ MaybeError RecordCopyTextureWithTemporaryBuffer(CommandRecordingContext* recordi return {}; } +bool ShouldCopyUsingTemporaryBuffer(DeviceBase* device, + const BufferCopy& bufferCopy, + const TextureCopy& textureCopy) { + // Currently we only need the workaround for some D3D12 platforms. + if (device->IsToggleEnabled( + Toggle::D3D12UseTempBufferInDepthStencilTextureAndBufferCopyWithNonZeroBufferOffset)) { + if ((ToBackend(textureCopy.texture)->GetD3D12ResourceFlags() & + D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) && + bufferCopy.offset % D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT > 0) { + return true; + } + } + return false; +} + +MaybeError RecordBufferTextureCopyWithTemporaryBuffer(CommandRecordingContext* recordingContext, + BufferTextureCopyDirection copyDirection, + const BufferCopy& bufferCopy, + const TextureCopy& textureCopy, + const Extent3D& copySize) { + dawn::native::Format format = textureCopy.texture->GetFormat(); + const TexelBlockInfo& blockInfo = format.GetAspectInfo(textureCopy.aspect).block; + + // Create tempBuffer + // The size of temporary buffer isn't needed to be a multiple of 4 because we don't + // need to set mappedAtCreation to be true. + auto tempBufferSize = ComputeRequiredBytesInCopy(blockInfo, copySize, bufferCopy.bytesPerRow, + bufferCopy.rowsPerImage); + + BufferDescriptor tempBufferDescriptor; + tempBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + tempBufferDescriptor.size = tempBufferSize.AcquireSuccess(); + Device* device = ToBackend(textureCopy.texture->GetDevice()); + Ref tempBufferBase; + DAWN_TRY_ASSIGN(tempBufferBase, device->CreateBuffer(&tempBufferDescriptor)); + // D3D12 aligns the entire buffer to at least 64KB, so the virtual address of tempBuffer will + // always be aligned to D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT (512). + Ref tempBuffer = ToBackend(std::move(tempBufferBase)); + ASSERT(tempBuffer->GetVA() % D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT == 0); + + BufferCopy tempBufferCopy; + tempBufferCopy.buffer = tempBuffer; + tempBufferCopy.offset = 0; + tempBufferCopy.bytesPerRow = bufferCopy.bytesPerRow; + tempBufferCopy.rowsPerImage = bufferCopy.rowsPerImage; + + tempBuffer->TrackUsageAndTransitionNow(recordingContext, wgpu::BufferUsage::CopyDst); + + ID3D12GraphicsCommandList* commandList = recordingContext->GetCommandList(); + switch (copyDirection) { + case BufferTextureCopyDirection::B2T: { + commandList->CopyBufferRegion(tempBuffer->GetD3D12Resource(), 0, + ToBackend(bufferCopy.buffer)->GetD3D12Resource(), + bufferCopy.offset, tempBufferDescriptor.size); + tempBuffer->TrackUsageAndTransitionNow(recordingContext, wgpu::BufferUsage::CopySrc); + RecordBufferTextureCopy(BufferTextureCopyDirection::B2T, + recordingContext->GetCommandList(), tempBufferCopy, textureCopy, + copySize); + break; + } + case BufferTextureCopyDirection::T2B: { + RecordBufferTextureCopy(BufferTextureCopyDirection::T2B, + recordingContext->GetCommandList(), tempBufferCopy, textureCopy, + copySize); + tempBuffer->TrackUsageAndTransitionNow(recordingContext, wgpu::BufferUsage::CopySrc); + commandList->CopyBufferRegion(ToBackend(bufferCopy.buffer)->GetD3D12Resource(), + bufferCopy.offset, tempBuffer->GetD3D12Resource(), 0, + tempBufferDescriptor.size); + break; + } + default: + UNREACHABLE(); + break; + } + + // Save tempBuffer into recordingContext + recordingContext->AddToTempBuffers(std::move(tempBuffer)); + + return {}; +} + void RecordNumWorkgroupsForDispatch(ID3D12GraphicsCommandList* commandList, ComputePipeline* pipeline, DispatchCmd* dispatch) { @@ -653,11 +736,12 @@ MaybeError CommandBuffer::RecordCommands(CommandRecordingContext* commandContext while (mCommands.NextCommandId(&type)) { switch (type) { case Command::BeginComputePass: { - mCommands.NextCommand(); + BeginComputePassCmd* cmd = mCommands.NextCommand(); bindingTracker.SetInComputePass(true); + DAWN_TRY( - RecordComputePass(commandContext, &bindingTracker, + RecordComputePass(commandContext, &bindingTracker, cmd, GetResourceUsages().computePasses[nextComputePassNumber])); nextComputePassNumber++; @@ -730,6 +814,12 @@ MaybeError CommandBuffer::RecordCommands(CommandRecordingContext* commandContext texture->TrackUsageAndTransitionNow(commandContext, wgpu::TextureUsage::CopyDst, subresources); + if (ShouldCopyUsingTemporaryBuffer(GetDevice(), copy->source, copy->destination)) { + DAWN_TRY(RecordBufferTextureCopyWithTemporaryBuffer( + commandContext, BufferTextureCopyDirection::B2T, copy->source, + copy->destination, copy->copySize)); + break; + } RecordBufferTextureCopy(BufferTextureCopyDirection::B2T, commandList, copy->source, copy->destination, copy->copySize); @@ -757,6 +847,12 @@ MaybeError CommandBuffer::RecordCommands(CommandRecordingContext* commandContext subresources); buffer->TrackUsageAndTransitionNow(commandContext, wgpu::BufferUsage::CopyDst); + if (ShouldCopyUsingTemporaryBuffer(GetDevice(), copy->destination, copy->source)) { + DAWN_TRY(RecordBufferTextureCopyWithTemporaryBuffer( + commandContext, BufferTextureCopyDirection::T2B, copy->destination, + copy->source, copy->copySize)); + break; + } RecordBufferTextureCopy(BufferTextureCopyDirection::T2B, commandList, copy->destination, copy->source, copy->copySize); @@ -942,7 +1038,7 @@ MaybeError CommandBuffer::RecordCommands(CommandRecordingContext* commandContext case Command::WriteTimestamp: { WriteTimestampCmd* cmd = mCommands.NextCommand(); - RecordWriteTimestampCmd(commandList, cmd); + RecordWriteTimestampCmd(commandList, cmd->querySet.Get(), cmd->queryIndex); break; } @@ -1023,10 +1119,17 @@ MaybeError CommandBuffer::RecordCommands(CommandRecordingContext* commandContext MaybeError CommandBuffer::RecordComputePass(CommandRecordingContext* commandContext, BindGroupStateTracker* bindingTracker, + BeginComputePassCmd* computePass, const ComputePassResourceUsage& resourceUsages) { uint64_t currentDispatch = 0; ID3D12GraphicsCommandList* commandList = commandContext->GetCommandList(); + // Write timestamp at the beginning of compute pass if it's set. + if (computePass->beginTimestamp.querySet.Get() != nullptr) { + RecordWriteTimestampCmd(commandList, computePass->beginTimestamp.querySet.Get(), + computePass->beginTimestamp.queryIndex); + } + Command type; ComputePipeline* lastPipeline = nullptr; while (mCommands.NextCommandId(&type)) { @@ -1068,6 +1171,12 @@ MaybeError CommandBuffer::RecordComputePass(CommandRecordingContext* commandCont case Command::EndComputePass: { mCommands.NextCommand(); + + // Write timestamp at the end of compute pass if it's set. + if (computePass->endTimestamp.querySet.Get() != nullptr) { + RecordWriteTimestampCmd(commandList, computePass->endTimestamp.querySet.Get(), + computePass->endTimestamp.queryIndex); + } return {}; } @@ -1136,7 +1245,7 @@ MaybeError CommandBuffer::RecordComputePass(CommandRecordingContext* commandCont case Command::WriteTimestamp: { WriteTimestampCmd* cmd = mCommands.NextCommand(); - RecordWriteTimestampCmd(commandList, cmd); + RecordWriteTimestampCmd(commandList, cmd->querySet.Get(), cmd->queryIndex); break; } @@ -1339,6 +1448,12 @@ MaybeError CommandBuffer::RecordRenderPass(CommandRecordingContext* commandConte ID3D12GraphicsCommandList* commandList = commandContext->GetCommandList(); + // Write timestamp at the beginning of render pass if it's set. + if (renderPass->beginTimestamp.querySet.Get() != nullptr) { + RecordWriteTimestampCmd(commandList, renderPass->beginTimestamp.querySet.Get(), + renderPass->beginTimestamp.queryIndex); + } + // Set up default dynamic state { uint32_t width = renderPass->width; @@ -1511,6 +1626,13 @@ MaybeError CommandBuffer::RecordRenderPass(CommandRecordingContext* commandConte switch (type) { case Command::EndRenderPass: { mCommands.NextCommand(); + + // Write timestamp at the end of render pass if it's set. + if (renderPass->endTimestamp.querySet.Get() != nullptr) { + RecordWriteTimestampCmd(commandList, renderPass->endTimestamp.querySet.Get(), + renderPass->endTimestamp.queryIndex); + } + if (useRenderPass) { commandContext->GetCommandList4()->EndRenderPass(); } else if (renderPass->attachmentState->GetSampleCount() > 1) { @@ -1596,7 +1718,7 @@ MaybeError CommandBuffer::RecordRenderPass(CommandRecordingContext* commandConte case Command::WriteTimestamp: { WriteTimestampCmd* cmd = mCommands.NextCommand(); - RecordWriteTimestampCmd(commandList, cmd); + RecordWriteTimestampCmd(commandList, cmd->querySet.Get(), cmd->queryIndex); break; } diff --git a/src/dawn/native/d3d12/CommandBufferD3D12.h b/src/dawn/native/d3d12/CommandBufferD3D12.h index ea0bb704ac..10523950a8 100644 --- a/src/dawn/native/d3d12/CommandBufferD3D12.h +++ b/src/dawn/native/d3d12/CommandBufferD3D12.h @@ -19,6 +19,7 @@ #include "dawn/native/Error.h" namespace dawn::native { +struct BeginComputePassCmd; struct BeginRenderPassCmd; } // namespace dawn::native @@ -40,6 +41,7 @@ class CommandBuffer final : public CommandBufferBase { MaybeError RecordComputePass(CommandRecordingContext* commandContext, BindGroupStateTracker* bindingTracker, + BeginComputePassCmd* computePass, const ComputePassResourceUsage& resourceUsages); MaybeError RecordRenderPass(CommandRecordingContext* commandContext, BindGroupStateTracker* bindingTracker, diff --git a/src/dawn/native/d3d12/CommandRecordingContext.cpp b/src/dawn/native/d3d12/CommandRecordingContext.cpp index d4fa04d525..1f7e2766f5 100644 --- a/src/dawn/native/d3d12/CommandRecordingContext.cpp +++ b/src/dawn/native/d3d12/CommandRecordingContext.cpp @@ -71,7 +71,7 @@ MaybeError CommandRecordingContext::ExecuteCommandList(Device* device) { // common state right before command list submission. TransitionUsageNow itself ensures // no unnecessary transitions happen if the resources is already in the common state. for (Texture* texture : mSharedTextures) { - DAWN_TRY(texture->AcquireKeyedMutex()); + DAWN_TRY(texture->SynchronizeImportedTextureBeforeUse()); texture->TrackAllUsageAndTransitionNow(this, D3D12_RESOURCE_STATE_COMMON); } @@ -124,12 +124,13 @@ MaybeError CommandRecordingContext::ExecuteCommandList(Device* device) { device->GetCommandQueue()->ExecuteCommandLists(1, &d3d12CommandList); for (Texture* texture : mSharedTextures) { - texture->ReleaseKeyedMutex(); + texture->SynchronizeImportedTextureAfterUse(); } mIsOpen = false; mSharedTextures.clear(); mHeapsPendingUsage.clear(); + mTempBuffers.clear(); } return {}; } diff --git a/src/dawn/native/d3d12/ComputePipelineD3D12.cpp b/src/dawn/native/d3d12/ComputePipelineD3D12.cpp index cad0ce5352..8dc05fce3b 100644 --- a/src/dawn/native/d3d12/ComputePipelineD3D12.cpp +++ b/src/dawn/native/d3d12/ComputePipelineD3D12.cpp @@ -18,6 +18,7 @@ #include #include "dawn/native/CreatePipelineAsyncTask.h" +#include "dawn/native/d3d12/BlobD3D12.h" #include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/PipelineLayoutD3D12.h" @@ -55,15 +56,36 @@ MaybeError ComputePipeline::Initialize() { D3D12_COMPUTE_PIPELINE_STATE_DESC d3dDesc = {}; d3dDesc.pRootSignature = ToBackend(GetLayout())->GetRootSignature(); + // TODO(dawn:549): Compile shader everytime before we implement compiled shader cache CompiledShader compiledShader; DAWN_TRY_ASSIGN(compiledShader, module->Compile(computeStage, SingleShaderStage::Compute, ToBackend(GetLayout()), compileFlags)); d3dDesc.CS = compiledShader.GetD3D12ShaderBytecode(); + + StreamIn(&mCacheKey, d3dDesc, ToBackend(GetLayout())->GetRootSignatureBlob()); + + // Try to see if we have anything in the blob cache. + Blob blob = device->LoadCachedBlob(GetCacheKey()); + const bool cacheHit = !blob.Empty(); + if (cacheHit) { + // Cache hits, attach cached blob to descriptor. + d3dDesc.CachedPSO.pCachedBlob = blob.Data(); + d3dDesc.CachedPSO.CachedBlobSizeInBytes = blob.Size(); + } + auto* d3d12Device = device->GetD3D12Device(); DAWN_TRY(CheckHRESULT( d3d12Device->CreateComputePipelineState(&d3dDesc, IID_PPV_ARGS(&mPipelineState)), "D3D12 creating pipeline state")); + if (!cacheHit) { + // Cache misses, need to get pipeline cached blob and store. + ComPtr d3dBlob; + DAWN_TRY(CheckHRESULT(GetPipelineState()->GetCachedBlob(&d3dBlob), + "D3D12 compute pipeline state get cached blob")); + device->StoreCachedBlob(GetCacheKey(), CreateBlob(std::move(d3dBlob))); + } + SetLabelImpl(); return {}; diff --git a/src/dawn/native/d3d12/D3D11on12Util.cpp b/src/dawn/native/d3d12/D3D11on12Util.cpp index a31c833d80..01a0081bf7 100644 --- a/src/dawn/native/d3d12/D3D11on12Util.cpp +++ b/src/dawn/native/d3d12/D3D11on12Util.cpp @@ -128,9 +128,8 @@ D3D11on12ResourceCache::D3D11on12ResourceCache() = default; D3D11on12ResourceCache::~D3D11on12ResourceCache() = default; Ref D3D11on12ResourceCache::GetOrCreateD3D11on12Resource( - WGPUDevice device, + Device* backendDevice, ID3D12Resource* d3d12Resource) { - Device* backendDevice = reinterpret_cast(device); // The Dawn and 11on12 device share the same D3D12 command queue whereas this external image // could be accessed/produced with multiple Dawn devices. To avoid cross-queue sharing // restrictions, the 11 wrapped resource is forbidden to be shared between Dawn devices by diff --git a/src/dawn/native/d3d12/D3D11on12Util.h b/src/dawn/native/d3d12/D3D11on12Util.h index 9e28c8b3fa..92dde83f64 100644 --- a/src/dawn/native/d3d12/D3D11on12Util.h +++ b/src/dawn/native/d3d12/D3D11on12Util.h @@ -28,13 +28,15 @@ struct IDXGIKeyedMutex; namespace dawn::native::d3d12 { +class Device; + // Wraps 11 wrapped resources in a cache. class D3D11on12ResourceCacheEntry : public RefCounted { public: explicit D3D11on12ResourceCacheEntry(ComPtr d3d11on12Device); D3D11on12ResourceCacheEntry(ComPtr d3d11on12Resource, ComPtr d3d11on12Device); - ~D3D11on12ResourceCacheEntry(); + ~D3D11on12ResourceCacheEntry() override; MaybeError AcquireKeyedMutex(); void ReleaseKeyedMutex(); @@ -69,7 +71,7 @@ class D3D11on12ResourceCache { D3D11on12ResourceCache(); ~D3D11on12ResourceCache(); - Ref GetOrCreateD3D11on12Resource(WGPUDevice device, + Ref GetOrCreateD3D11on12Resource(Device* backendDevice, ID3D12Resource* d3d12Resource); private: diff --git a/src/dawn/native/d3d12/D3D12Backend.cpp b/src/dawn/native/d3d12/D3D12Backend.cpp index 9747b41c0e..05ddd6b4c0 100644 --- a/src/dawn/native/d3d12/D3D12Backend.cpp +++ b/src/dawn/native/d3d12/D3D12Backend.cpp @@ -25,6 +25,7 @@ #include "dawn/common/SwapChainUtils.h" #include "dawn/native/d3d12/D3D11on12Util.h" #include "dawn/native/d3d12/DeviceD3D12.h" +#include "dawn/native/d3d12/ExternalImageDXGIImpl.h" #include "dawn/native/d3d12/NativeSwapChainImplD3D12.h" #include "dawn/native/d3d12/ResidencyManagerD3D12.h" #include "dawn/native/d3d12/TextureD3D12.h" @@ -53,65 +54,30 @@ WGPUTextureFormat GetNativeSwapChainPreferredFormat(const DawnSwapChainImplement ExternalImageDescriptorDXGISharedHandle::ExternalImageDescriptorDXGISharedHandle() : ExternalImageDescriptor(ExternalImageType::DXGISharedHandle) {} -ExternalImageDXGI::ExternalImageDXGI(ComPtr d3d12Resource, - const WGPUTextureDescriptor* descriptor) - : mD3D12Resource(std::move(d3d12Resource)), - mUsage(descriptor->usage), - mDimension(descriptor->dimension), - mSize(descriptor->size), - mFormat(descriptor->format), - mMipLevelCount(descriptor->mipLevelCount), - mSampleCount(descriptor->sampleCount) { - ASSERT(!descriptor->nextInChain || - descriptor->nextInChain->sType == WGPUSType_DawnTextureInternalUsageDescriptor); - if (descriptor->nextInChain) { - mUsageInternal = - reinterpret_cast(descriptor->nextInChain) - ->internalUsage; - } - mD3D11on12ResourceCache = std::make_unique(); +ExternalImageDXGI::ExternalImageDXGI(std::unique_ptr impl) + : mImpl(std::move(impl)) { + ASSERT(mImpl != nullptr); } ExternalImageDXGI::~ExternalImageDXGI() = default; +bool ExternalImageDXGI::IsValid() const { + return mImpl->IsValid(); +} + WGPUTexture ExternalImageDXGI::ProduceTexture( WGPUDevice device, - const ExternalImageAccessDescriptorDXGIKeyedMutex* descriptor) { - Device* backendDevice = ToBackend(FromAPI(device)); + const ExternalImageAccessDescriptorDXGISharedHandle* descriptor) { + return ProduceTexture(descriptor); +} - // Ensure the texture usage is allowed - if (!IsSubset(descriptor->usage, mUsage)) { - dawn::ErrorLog() << "Texture usage is not valid for external image"; +WGPUTexture ExternalImageDXGI::ProduceTexture( + const ExternalImageAccessDescriptorDXGISharedHandle* descriptor) { + if (!IsValid()) { + dawn::ErrorLog() << "Cannot produce texture from external image after device destruction"; return nullptr; } - - TextureDescriptor textureDescriptor = {}; - textureDescriptor.usage = static_cast(descriptor->usage); - textureDescriptor.dimension = static_cast(mDimension); - textureDescriptor.size = {mSize.width, mSize.height, mSize.depthOrArrayLayers}; - textureDescriptor.format = static_cast(mFormat); - textureDescriptor.mipLevelCount = mMipLevelCount; - textureDescriptor.sampleCount = mSampleCount; - - DawnTextureInternalUsageDescriptor internalDesc = {}; - if (mUsageInternal) { - textureDescriptor.nextInChain = &internalDesc; - internalDesc.internalUsage = static_cast(mUsageInternal); - internalDesc.sType = wgpu::SType::DawnTextureInternalUsageDescriptor; - } - - Ref d3d11on12Resource = - mD3D11on12ResourceCache->GetOrCreateD3D11on12Resource(device, mD3D12Resource.Get()); - if (d3d11on12Resource == nullptr) { - dawn::ErrorLog() << "Unable to create 11on12 resource for external image"; - return nullptr; - } - - Ref texture = backendDevice->CreateD3D12ExternalTexture( - &textureDescriptor, mD3D12Resource, std::move(d3d11on12Resource), - descriptor->isSwapChainTexture, descriptor->isInitialized); - - return ToAPI(texture.Detach()); + return mImpl->ProduceTexture(descriptor); } // static @@ -119,44 +85,13 @@ std::unique_ptr ExternalImageDXGI::Create( WGPUDevice device, const ExternalImageDescriptorDXGISharedHandle* descriptor) { Device* backendDevice = ToBackend(FromAPI(device)); - - Microsoft::WRL::ComPtr d3d12Resource; - if (FAILED(backendDevice->GetD3D12Device()->OpenSharedHandle(descriptor->sharedHandle, - IID_PPV_ARGS(&d3d12Resource)))) { + std::unique_ptr impl = + backendDevice->CreateExternalImageDXGIImpl(descriptor); + if (!impl) { + dawn::ErrorLog() << "Failed to create DXGI external image"; return nullptr; } - - const TextureDescriptor* textureDescriptor = FromAPI(descriptor->cTextureDescriptor); - - if (backendDevice->ConsumedError(ValidateTextureDescriptor(backendDevice, textureDescriptor))) { - return nullptr; - } - - if (backendDevice->ConsumedError( - ValidateTextureDescriptorCanBeWrapped(textureDescriptor), - "validating that a D3D12 external image can be wrapped with %s", textureDescriptor)) { - return nullptr; - } - - if (backendDevice->ConsumedError( - ValidateD3D12TextureCanBeWrapped(d3d12Resource.Get(), textureDescriptor))) { - return nullptr; - } - - // Shared handle is assumed to support resource sharing capability. The resource - // shared capability tier must agree to share resources between D3D devices. - const Format* format = - backendDevice->GetInternalFormat(textureDescriptor->format).AcquireSuccess(); - if (format->IsMultiPlanar()) { - if (backendDevice->ConsumedError(ValidateD3D12VideoTextureCanBeShared( - backendDevice, D3D12TextureFormat(textureDescriptor->format)))) { - return nullptr; - } - } - - std::unique_ptr result( - new ExternalImageDXGI(std::move(d3d12Resource), descriptor->cTextureDescriptor)); - return result; + return std::unique_ptr(new ExternalImageDXGI(std::move(impl))); } uint64_t SetExternalMemoryReservation(WGPUDevice device, diff --git a/src/dawn/native/d3d12/D3D12Info.cpp b/src/dawn/native/d3d12/D3D12Info.cpp index b8fc896834..3d3470c173 100644 --- a/src/dawn/native/d3d12/D3D12Info.cpp +++ b/src/dawn/native/d3d12/D3D12Info.cpp @@ -38,12 +38,37 @@ ResultOrError GatherDeviceInfo(const Adapter& adapter) { info.isUMA = arch.UMA; - D3D12_FEATURE_DATA_D3D12_OPTIONS options = {}; - DAWN_TRY(CheckHRESULT(adapter.GetDevice()->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, - &options, sizeof(options)), + D3D12_FEATURE_DATA_D3D12_OPTIONS featureOptions = {}; + DAWN_TRY(CheckHRESULT(adapter.GetDevice()->CheckFeatureSupport( + D3D12_FEATURE_D3D12_OPTIONS, &featureOptions, sizeof(featureOptions)), "ID3D12Device::CheckFeatureSupport")); + info.resourceHeapTier = featureOptions.ResourceHeapTier; - info.resourceHeapTier = options.ResourceHeapTier; + D3D12_FEATURE_DATA_D3D12_OPTIONS2 featureOptions2 = {}; + if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport( + D3D12_FEATURE_D3D12_OPTIONS2, &featureOptions2, sizeof(featureOptions2)))) { + info.programmableSamplePositionsTier = featureOptions2.ProgrammableSamplePositionsTier; + } + + D3D12_FEATURE_DATA_D3D12_OPTIONS3 featureOptions3 = {}; + if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport( + D3D12_FEATURE_D3D12_OPTIONS3, &featureOptions3, sizeof(featureOptions3)))) { + info.supportsCastingFullyTypedFormat = featureOptions3.CastingFullyTypedFormatSupported; + } + + // Used to share resources cross-API. If we query CheckFeatureSupport for + // D3D12_FEATURE_D3D12_OPTIONS4 successfully, then we can use cross-API sharing. + info.supportsSharedResourceCapabilityTier1 = false; + D3D12_FEATURE_DATA_D3D12_OPTIONS4 featureOptions4 = {}; + if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport( + D3D12_FEATURE_D3D12_OPTIONS4, &featureOptions4, sizeof(featureOptions4)))) { + // Tier 1 support additionally enables the NV12 format. Since only the NV12 format + // is used by Dawn, check for Tier 1. + if (featureOptions4.SharedResourceCompatibilityTier >= + D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1) { + info.supportsSharedResourceCapabilityTier1 = true; + } + } // Windows builds 1809 and above can use the D3D12 render pass API. If we query // CheckFeatureSupport for D3D12_FEATURE_D3D12_OPTIONS5 successfully, then we can use @@ -61,24 +86,9 @@ ResultOrError GatherDeviceInfo(const Adapter& adapter) { } } - // Used to share resources cross-API. If we query CheckFeatureSupport for - // D3D12_FEATURE_D3D12_OPTIONS4 successfully, then we can use cross-API sharing. - info.supportsSharedResourceCapabilityTier1 = false; - D3D12_FEATURE_DATA_D3D12_OPTIONS4 featureOptions4 = {}; - if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport( - D3D12_FEATURE_D3D12_OPTIONS4, &featureOptions4, sizeof(featureOptions4)))) { - // Tier 1 support additionally enables the NV12 format. Since only the NV12 format - // is used by Dawn, check for Tier 1. - if (featureOptions4.SharedResourceCompatibilityTier >= - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1) { - info.supportsSharedResourceCapabilityTier1 = true; - } - } - - D3D12_FEATURE_DATA_SHADER_MODEL knownShaderModels[] = {{D3D_SHADER_MODEL_6_2}, - {D3D_SHADER_MODEL_6_1}, - {D3D_SHADER_MODEL_6_0}, - {D3D_SHADER_MODEL_5_1}}; + D3D12_FEATURE_DATA_SHADER_MODEL knownShaderModels[] = { + {D3D_SHADER_MODEL_6_4}, {D3D_SHADER_MODEL_6_3}, {D3D_SHADER_MODEL_6_2}, + {D3D_SHADER_MODEL_6_1}, {D3D_SHADER_MODEL_6_0}, {D3D_SHADER_MODEL_5_1}}; uint32_t driverShaderModel = 0; for (D3D12_FEATURE_DATA_SHADER_MODEL shaderModel : knownShaderModels) { if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport( @@ -111,12 +121,10 @@ ResultOrError GatherDeviceInfo(const Adapter& adapter) { info.shaderProfiles[SingleShaderStage::Fragment] = L"p" + profileSuffix; info.shaderProfiles[SingleShaderStage::Compute] = L"c" + profileSuffix; - D3D12_FEATURE_DATA_D3D12_OPTIONS4 featureData4 = {}; - if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS4, - &featureData4, sizeof(featureData4)))) { - info.supportsShaderFloat16 = - driverShaderModel >= D3D_SHADER_MODEL_6_2 && featureData4.Native16BitShaderOpsSupported; - } + info.supportsShaderFloat16 = + driverShaderModel >= D3D_SHADER_MODEL_6_2 && featureOptions4.Native16BitShaderOpsSupported; + + info.supportsDP4a = driverShaderModel >= D3D_SHADER_MODEL_6_4; return std::move(info); } diff --git a/src/dawn/native/d3d12/D3D12Info.h b/src/dawn/native/d3d12/D3D12Info.h index c0ffc47b16..f81e28de11 100644 --- a/src/dawn/native/d3d12/D3D12Info.h +++ b/src/dawn/native/d3d12/D3D12Info.h @@ -33,6 +33,9 @@ struct D3D12DeviceInfo { uint32_t shaderModel; PerStage shaderProfiles; bool supportsSharedResourceCapabilityTier1; + bool supportsDP4a; + bool supportsCastingFullyTypedFormat; + uint32_t programmableSamplePositionsTier; }; ResultOrError GatherDeviceInfo(const Adapter& adapter); diff --git a/src/dawn/native/d3d12/DeviceD3D12.cpp b/src/dawn/native/d3d12/DeviceD3D12.cpp index 96fbb3f6fe..214fa67f84 100644 --- a/src/dawn/native/d3d12/DeviceD3D12.cpp +++ b/src/dawn/native/d3d12/DeviceD3D12.cpp @@ -20,6 +20,7 @@ #include #include "dawn/common/GPUInfo.h" +#include "dawn/native/D3D12Backend.h" #include "dawn/native/DynamicUploader.h" #include "dawn/native/Instance.h" #include "dawn/native/d3d12/AdapterD3D12.h" @@ -31,6 +32,7 @@ #include "dawn/native/d3d12/ComputePipelineD3D12.h" #include "dawn/native/d3d12/D3D11on12Util.h" #include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d12/ExternalImageDXGIImpl.h" #include "dawn/native/d3d12/PipelineLayoutD3D12.h" #include "dawn/native/d3d12/PlatformFunctions.h" #include "dawn/native/d3d12/QuerySetD3D12.h" @@ -217,9 +219,6 @@ ComPtr Device::GetFactory() const { MaybeError Device::ApplyUseDxcToggle() { if (!ToBackend(GetAdapter())->GetBackend()->GetFunctions()->IsDXCAvailable()) { ForceSetToggle(Toggle::UseDXC, false); - } else if (IsFeatureEnabled(Feature::ShaderFloat16)) { - // Currently we can only use DXC to compile HLSL shaders using float16. - ForceSetToggle(Toggle::UseDXC, true); } if (IsToggleEnabled(Toggle::UseDXC)) { @@ -535,16 +534,80 @@ ResultOrError Device::AllocateMemory( return mResourceAllocatorManager->AllocateMemory(heapType, resourceDescriptor, initialUsage); } +std::unique_ptr Device::CreateExternalImageDXGIImpl( + const ExternalImageDescriptorDXGISharedHandle* descriptor) { + // ExternalImageDXGIImpl holds a weak reference to the device. If the device is destroyed before + // the image is created, the image will have a dangling reference to the device which can cause + // a use-after-free. + if (ConsumedError(ValidateIsAlive())) { + return nullptr; + } + + // Use sharedHandle as a fallback until Chromium code is changed to set textureSharedHandle. + HANDLE textureSharedHandle = descriptor->textureSharedHandle; + if (!textureSharedHandle) { + textureSharedHandle = descriptor->sharedHandle; + } + + Microsoft::WRL::ComPtr d3d12Resource; + if (FAILED(GetD3D12Device()->OpenSharedHandle(textureSharedHandle, + IID_PPV_ARGS(&d3d12Resource)))) { + return nullptr; + } + + Microsoft::WRL::ComPtr d3d12Fence; + if (descriptor->fenceSharedHandle && + FAILED(GetD3D12Device()->OpenSharedHandle(descriptor->fenceSharedHandle, + IID_PPV_ARGS(&d3d12Fence)))) { + return nullptr; + } + + const TextureDescriptor* textureDescriptor = FromAPI(descriptor->cTextureDescriptor); + + if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) { + return nullptr; + } + + if (ConsumedError(ValidateTextureDescriptorCanBeWrapped(textureDescriptor), + "validating that a D3D12 external image can be wrapped with %s", + textureDescriptor)) { + return nullptr; + } + + if (ConsumedError(ValidateD3D12TextureCanBeWrapped(d3d12Resource.Get(), textureDescriptor))) { + return nullptr; + } + + // Shared handle is assumed to support resource sharing capability. The resource + // shared capability tier must agree to share resources between D3D devices. + const Format* format = GetInternalFormat(textureDescriptor->format).AcquireSuccess(); + if (format->IsMultiPlanar()) { + if (ConsumedError(ValidateD3D12VideoTextureCanBeShared( + this, D3D12TextureFormat(textureDescriptor->format)))) { + return nullptr; + } + } + + auto impl = std::make_unique( + this, std::move(d3d12Resource), std::move(d3d12Fence), descriptor->cTextureDescriptor); + mExternalImageList.Append(impl.get()); + return impl; +} + Ref Device::CreateD3D12ExternalTexture( const TextureDescriptor* descriptor, ComPtr d3d12Texture, + ComPtr d3d12Fence, Ref d3d11on12Resource, + uint64_t fenceWaitValue, + uint64_t fenceSignalValue, bool isSwapChainTexture, bool isInitialized) { Ref dawnTexture; - if (ConsumedError(Texture::CreateExternalImage(this, descriptor, std::move(d3d12Texture), - std::move(d3d11on12Resource), isSwapChainTexture, - isInitialized), + if (ConsumedError(Texture::CreateExternalImage( + this, descriptor, std::move(d3d12Texture), std::move(d3d12Fence), + std::move(d3d11on12Resource), fenceWaitValue, fenceSignalValue, + isSwapChainTexture, isInitialized), &dawnTexture)) { return nullptr; } @@ -581,6 +644,15 @@ void Device::InitTogglesFromDriver() { SetToggle(Toggle::UseD3D12RenderPass, GetDeviceInfo().supportsRenderPass); SetToggle(Toggle::UseD3D12ResidencyManagement, true); SetToggle(Toggle::UseDXC, false); + SetToggle(Toggle::D3D12AlwaysUseTypelessFormatsForCastableTexture, + !GetDeviceInfo().supportsCastingFullyTypedFormat); + SetToggle(Toggle::ApplyClearBigIntegerColorValueWithDraw, true); + + // The restriction on the source box specifying a portion of the depth stencil texture in + // CopyTextureRegion() is only available on the D3D12 platforms which doesn't support + // programmable sample positions. + SetToggle(Toggle::D3D12UseTempBufferInDepthStencilTextureAndBufferCopyWithNonZeroBufferOffset, + GetDeviceInfo().programmableSamplePositionsTier == 0); // Disable optimizations when using FXC // See https://crbug.com/dawn/1203 @@ -592,24 +664,42 @@ void Device::InitTogglesFromDriver() { uint32_t deviceId = GetAdapter()->GetDeviceId(); uint32_t vendorId = GetAdapter()->GetVendorId(); - // Currently this workaround is only needed on Intel Gen9 and Gen9.5 GPUs. + // Currently this workaround is only needed on Intel Gen9, Gen9.5 and Gen11 GPUs. // See http://crbug.com/1161355 for more information. - if (gpu_info::IsIntel(vendorId) && - (gpu_info::IsSkylake(deviceId) || gpu_info::IsKabylake(deviceId) || - gpu_info::IsCoffeelake(deviceId))) { - constexpr gpu_info::D3DDriverVersion kFirstDriverVersionWithFix = {30, 0, 100, 9864}; - if (gpu_info::CompareD3DDriverVersion(vendorId, ToBackend(GetAdapter())->GetDriverVersion(), - kFirstDriverVersionWithFix) < 0) { - SetToggle( - Toggle::UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel, - true); - } + if (gpu_info::IsIntelGen9(vendorId, deviceId) || gpu_info::IsIntelGen11(vendorId, deviceId)) { + SetToggle(Toggle::UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel, + true); + } + + // Currently this workaround is only needed on Intel GPUs. + // See http://crbug.com/dawn/1487 for more information. + if (gpu_info::IsIntel(vendorId)) { + SetToggle(Toggle::D3D12ForceClearCopyableDepthStencilTextureOnCreation, true); + } + + // Currently this workaround is only needed on Intel Gen12 GPUs. + // See http://crbug.com/dawn/1487 for more information. + if (gpu_info::IsIntelGen12LP(vendorId, deviceId) || + gpu_info::IsIntelGen12HP(vendorId, deviceId)) { + SetToggle(Toggle::D3D12DontSetClearValueOnDepthTextureCreation, true); } // Currently this workaround is needed on any D3D12 backend for some particular situations. // But we may need to limit it if D3D12 runtime fixes the bug on its new release. See // https://crbug.com/dawn/1289 for more information. + // TODO(dawn:1289): Unset this toggle when we skip the split on the buffer-texture copy + // on the platforms where UnrestrictedBufferTextureCopyPitchSupported is true. SetToggle(Toggle::D3D12SplitBufferTextureCopyForRowsPerImagePaddings, true); + + // This workaround is only needed on Intel Gen12LP with driver prior to 30.0.101.1960. + // See http://crbug.com/dawn/949 for more information. + if (gpu_info::IsIntelGen12LP(vendorId, deviceId)) { + const gpu_info::D3DDriverVersion version = {30, 0, 101, 1960}; + if (gpu_info::CompareD3DDriverVersion(vendorId, ToBackend(GetAdapter())->GetDriverVersion(), + version) == -1) { + SetToggle(Toggle::D3D12AllocateExtraMemoryFor2DArrayTexture, true); + } + } } MaybeError Device::WaitForIdleForDestruction() { @@ -707,6 +797,14 @@ void Device::AppendDebugLayerMessages(ErrorData* error) { void Device::DestroyImpl() { ASSERT(GetState() == State::Disconnected); + while (!mExternalImageList.empty()) { + ExternalImageDXGIImpl* externalImage = mExternalImageList.head()->value(); + // ExternalImageDXGIImpl::Destroy() calls RemoveFromList(). + externalImage->Destroy(); + } + + mZeroBuffer = nullptr; + // Immediately forget about all pending commands for the case where device is lost on its // own and WaitForIdleForDestruction isn't called. mPendingCommands.Release(); @@ -784,6 +882,17 @@ bool Device::ShouldDuplicateNumWorkgroupsForDispatchIndirect( return ToBackend(computePipeline)->UsesNumWorkgroups(); } +bool Device::IsFeatureEnabled(Feature feature) const { + // Currently we can only use DXC to compile HLSL shaders using float16, and + // ChromiumExperimentalDp4a is an experimental feature which can only be enabled with toggle + // "use_dxc". + if ((feature == Feature::ChromiumExperimentalDp4a || feature == Feature::ShaderFloat16) && + !IsToggleEnabled(Toggle::UseDXC)) { + return false; + } + return DeviceBase::IsFeatureEnabled(feature); +} + void Device::SetLabelImpl() { SetDebugName(this, mD3d12Device.Get(), "Dawn_Device", GetLabel()); } @@ -797,4 +906,17 @@ bool Device::ShouldDuplicateParametersForDrawIndirect( return ToBackend(renderPipelineBase)->UsesVertexOrInstanceIndex(); } +uint64_t Device::GetBufferCopyOffsetAlignmentForDepthStencil() const { + // On the D3D12 platforms where programmable MSAA is not supported, the source box specifying a + // portion of the depth texture must all be 0, or an error and a device lost will occur, so on + // these platforms the buffer copy offset must be a multiple of 512 when the texture is created + // with D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL. See https://crbug.com/dawn/727 for more + // details. + if (IsToggleEnabled( + Toggle::D3D12UseTempBufferInDepthStencilTextureAndBufferCopyWithNonZeroBufferOffset)) { + return D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT; + } + return DeviceBase::GetBufferCopyOffsetAlignmentForDepthStencil(); +} + } // namespace dawn::native::d3d12 diff --git a/src/dawn/native/d3d12/DeviceD3D12.h b/src/dawn/native/d3d12/DeviceD3D12.h index 041bae1fdd..0373cf9d82 100644 --- a/src/dawn/native/d3d12/DeviceD3D12.h +++ b/src/dawn/native/d3d12/DeviceD3D12.h @@ -16,6 +16,7 @@ #define SRC_DAWN_NATIVE_D3D12_DEVICED3D12_H_ #include +#include #include "dawn/common/SerialQueue.h" #include "dawn/native/Device.h" @@ -27,6 +28,8 @@ namespace dawn::native::d3d12 { class CommandAllocatorManager; +struct ExternalImageDescriptorDXGISharedHandle; +class ExternalImageDXGIImpl; class PlatformFunctions; class ResidencyManager; class ResourceAllocatorManager; @@ -128,9 +131,15 @@ class Device final : public DeviceBase { StagingDescriptorAllocator* GetDepthStencilViewAllocator() const; + std::unique_ptr CreateExternalImageDXGIImpl( + const ExternalImageDescriptorDXGISharedHandle* descriptor); + Ref CreateD3D12ExternalTexture(const TextureDescriptor* descriptor, ComPtr d3d12Texture, + ComPtr d3d12Fence, Ref d3d11on12Resource, + uint64_t fenceWaitValue, + uint64_t fenceSignalValue, bool isSwapChainTexture, bool isInitialized); @@ -151,6 +160,10 @@ class Device final : public DeviceBase { bool ShouldDuplicateParametersForDrawIndirect( const RenderPipelineBase* renderPipelineBase) const override; + bool IsFeatureEnabled(Feature feature) const override; + + uint64_t GetBufferCopyOffsetAlignmentForDepthStencil() const override; + // Dawn APIs void SetLabelImpl() override; @@ -263,6 +276,9 @@ class Device final : public DeviceBase { // The number of nanoseconds required for a timestamp query to be incremented by 1 float mTimestampPeriod = 1.0f; + + // List of external image resources opened using this device. + LinkedList mExternalImageList; }; } // namespace dawn::native::d3d12 diff --git a/src/dawn/native/d3d12/ExternalImageDXGIImpl.cpp b/src/dawn/native/d3d12/ExternalImageDXGIImpl.cpp new file mode 100644 index 0000000000..8bf2c6c8f8 --- /dev/null +++ b/src/dawn/native/d3d12/ExternalImageDXGIImpl.cpp @@ -0,0 +1,119 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/d3d12/ExternalImageDXGIImpl.h" + +#include + +#include + +#include "dawn/common/Log.h" +#include "dawn/native/D3D12Backend.h" +#include "dawn/native/DawnNative.h" +#include "dawn/native/d3d12/D3D11on12Util.h" +#include "dawn/native/d3d12/DeviceD3D12.h" + +namespace dawn::native::d3d12 { + +ExternalImageDXGIImpl::ExternalImageDXGIImpl(Device* backendDevice, + Microsoft::WRL::ComPtr d3d12Resource, + Microsoft::WRL::ComPtr d3d12Fence, + const WGPUTextureDescriptor* descriptor) + : mBackendDevice(backendDevice), + mD3D12Resource(std::move(d3d12Resource)), + mD3D12Fence(std::move(d3d12Fence)), + mD3D11on12ResourceCache(std::make_unique()), + mUsage(descriptor->usage), + mDimension(descriptor->dimension), + mSize(descriptor->size), + mFormat(descriptor->format), + mMipLevelCount(descriptor->mipLevelCount), + mSampleCount(descriptor->sampleCount) { + ASSERT(mBackendDevice != nullptr); + ASSERT(mD3D12Resource != nullptr); + ASSERT(!descriptor->nextInChain || + descriptor->nextInChain->sType == WGPUSType_DawnTextureInternalUsageDescriptor); + if (descriptor->nextInChain) { + mUsageInternal = + reinterpret_cast(descriptor->nextInChain) + ->internalUsage; + } +} + +ExternalImageDXGIImpl::~ExternalImageDXGIImpl() { + Destroy(); +} + +bool ExternalImageDXGIImpl::IsValid() const { + return IsInList(); +} + +void ExternalImageDXGIImpl::Destroy() { + if (IsInList()) { + RemoveFromList(); + + // Keep fence alive until any pending signal calls are done on the GPU. + mBackendDevice->ConsumedError(mBackendDevice->ExecutePendingCommandContext()); + mBackendDevice->ConsumedError(mBackendDevice->NextSerial()); + mBackendDevice->ReferenceUntilUnused(mD3D12Fence.Get()); + mBackendDevice = nullptr; + + mD3D12Resource.Reset(); + mD3D12Fence.Reset(); + mD3D11on12ResourceCache.reset(); + } +} + +WGPUTexture ExternalImageDXGIImpl::ProduceTexture( + const ExternalImageAccessDescriptorDXGISharedHandle* descriptor) { + ASSERT(mBackendDevice != nullptr); + // Ensure the texture usage is allowed + if (!IsSubset(descriptor->usage, mUsage)) { + dawn::ErrorLog() << "Texture usage is not valid for external image"; + return nullptr; + } + + TextureDescriptor textureDescriptor = {}; + textureDescriptor.usage = static_cast(descriptor->usage); + textureDescriptor.dimension = static_cast(mDimension); + textureDescriptor.size = {mSize.width, mSize.height, mSize.depthOrArrayLayers}; + textureDescriptor.format = static_cast(mFormat); + textureDescriptor.mipLevelCount = mMipLevelCount; + textureDescriptor.sampleCount = mSampleCount; + + DawnTextureInternalUsageDescriptor internalDesc = {}; + if (mUsageInternal) { + textureDescriptor.nextInChain = &internalDesc; + internalDesc.internalUsage = static_cast(mUsageInternal); + internalDesc.sType = wgpu::SType::DawnTextureInternalUsageDescriptor; + } + + Ref d3d11on12Resource; + if (!mD3D12Fence) { + d3d11on12Resource = mD3D11on12ResourceCache->GetOrCreateD3D11on12Resource( + mBackendDevice, mD3D12Resource.Get()); + if (d3d11on12Resource == nullptr) { + dawn::ErrorLog() << "Unable to create 11on12 resource for external image"; + return nullptr; + } + } + + Ref texture = mBackendDevice->CreateD3D12ExternalTexture( + &textureDescriptor, mD3D12Resource, mD3D12Fence, std::move(d3d11on12Resource), + descriptor->fenceWaitValue, descriptor->fenceSignalValue, descriptor->isSwapChainTexture, + descriptor->isInitialized); + return ToAPI(texture.Detach()); +} + +} // namespace dawn::native::d3d12 diff --git a/src/dawn/native/d3d12/ExternalImageDXGIImpl.h b/src/dawn/native/d3d12/ExternalImageDXGIImpl.h new file mode 100644 index 0000000000..016ce4a0e5 --- /dev/null +++ b/src/dawn/native/d3d12/ExternalImageDXGIImpl.h @@ -0,0 +1,72 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_D3D12_EXTERNALIMAGEDXGIIMPL_H_ +#define SRC_DAWN_NATIVE_D3D12_EXTERNALIMAGEDXGIIMPL_H_ + +#include + +#include + +#include "dawn/common/LinkedList.h" +#include "dawn/dawn_wsi.h" +#include "dawn/native/Forward.h" + +struct ID3D12Resource; +struct ID3D12Fence; + +namespace dawn::native::d3d12 { + +class D3D11on12ResourceCache; +class Device; +struct ExternalImageAccessDescriptorDXGISharedHandle; +struct ExternalImageDescriptorDXGISharedHandle; + +class ExternalImageDXGIImpl : public LinkNode { + public: + ExternalImageDXGIImpl(Device* backendDevice, + Microsoft::WRL::ComPtr d3d12Resource, + Microsoft::WRL::ComPtr d3d12Fence, + const WGPUTextureDescriptor* descriptor); + ~ExternalImageDXGIImpl(); + + ExternalImageDXGIImpl(const ExternalImageDXGIImpl&) = delete; + ExternalImageDXGIImpl& operator=(const ExternalImageDXGIImpl&) = delete; + + void Destroy(); + + bool IsValid() const; + + WGPUTexture ProduceTexture(const ExternalImageAccessDescriptorDXGISharedHandle* descriptor); + + private: + Device* mBackendDevice; + Microsoft::WRL::ComPtr mD3D12Resource; + Microsoft::WRL::ComPtr mD3D12Fence; + std::unique_ptr mD3D11on12ResourceCache; + + // Contents of WGPUTextureDescriptor are stored individually since the descriptor + // could outlive this image. + WGPUTextureUsageFlags mUsage; + WGPUTextureUsageFlags mUsageInternal = WGPUTextureUsage_None; + WGPUTextureDimension mDimension; + WGPUExtent3D mSize; + WGPUTextureFormat mFormat; + uint32_t mMipLevelCount; + uint32_t mSampleCount; +}; + +} // namespace dawn::native::d3d12 + +#endif // SRC_DAWN_NATIVE_D3D12_EXTERNALIMAGEDXGIIMPL_H_ diff --git a/src/dawn/native/d3d12/Forward.h b/src/dawn/native/d3d12/Forward.h index ecb10aa614..13f7c81e4a 100644 --- a/src/dawn/native/d3d12/Forward.h +++ b/src/dawn/native/d3d12/Forward.h @@ -27,6 +27,7 @@ class CommandBuffer; class ComputePipeline; class Device; class Heap; +class PipelineCache; class PipelineLayout; class QuerySet; class Queue; @@ -46,6 +47,7 @@ struct D3D12BackendTraits { using CommandBufferType = CommandBuffer; using ComputePipelineType = ComputePipeline; using DeviceType = Device; + using PipelineCacheType = PipelineCache; using PipelineLayoutType = PipelineLayout; using QuerySetType = QuerySet; using QueueType = Queue; diff --git a/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp b/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp index b710069a63..aca85e83f8 100644 --- a/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp +++ b/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp @@ -252,10 +252,9 @@ MaybeError PipelineLayout::Initialize() { rootSignatureDescriptor.pStaticSamplers = nullptr; rootSignatureDescriptor.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT; - ComPtr signature; ComPtr error; HRESULT hr = device->GetFunctions()->d3d12SerializeRootSignature( - &rootSignatureDescriptor, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error); + &rootSignatureDescriptor, D3D_ROOT_SIGNATURE_VERSION_1, &mRootSignatureBlob, &error); if (DAWN_UNLIKELY(FAILED(hr))) { std::ostringstream messageStream; if (error) { @@ -269,12 +268,34 @@ MaybeError PipelineLayout::Initialize() { DAWN_TRY(CheckHRESULT(hr, messageStream.str().c_str())); } DAWN_TRY(CheckHRESULT(device->GetD3D12Device()->CreateRootSignature( - 0, signature->GetBufferPointer(), signature->GetBufferSize(), - IID_PPV_ARGS(&mRootSignature)), + 0, mRootSignatureBlob->GetBufferPointer(), + mRootSignatureBlob->GetBufferSize(), IID_PPV_ARGS(&mRootSignature)), "D3D12 create root signature")); + StreamIn(&mCacheKey, mRootSignatureBlob.Get()); return {}; } +void PipelineLayout::DestroyImpl() { + PipelineLayoutBase::DestroyImpl(); + + Device* device = ToBackend(GetDevice()); + device->ReferenceUntilUnused(mRootSignature); + + // The ID3D12CommandSignature object should not be referenced by GPU operations in-flight on + // Command Queue when it is being deleted. According to D3D12 debug layer, "it is not safe to + // final-release objects that may have GPU operations pending. This can result in application + // instability (921)". + if (mDispatchIndirectCommandSignatureWithNumWorkgroups.Get()) { + device->ReferenceUntilUnused(mDispatchIndirectCommandSignatureWithNumWorkgroups); + } + if (mDrawIndirectCommandSignatureWithInstanceVertexOffsets.Get()) { + device->ReferenceUntilUnused(mDrawIndirectCommandSignatureWithInstanceVertexOffsets); + } + if (mDrawIndexedIndirectCommandSignatureWithInstanceVertexOffsets.Get()) { + device->ReferenceUntilUnused(mDrawIndexedIndirectCommandSignatureWithInstanceVertexOffsets); + } +} + uint32_t PipelineLayout::GetCbvUavSrvRootParameterIndex(BindGroupIndex group) const { ASSERT(group < kMaxBindGroupsTyped); return mCbvUavSrvRootParameterInfo[group]; @@ -289,6 +310,10 @@ ID3D12RootSignature* PipelineLayout::GetRootSignature() const { return mRootSignature.Get(); } +ID3DBlob* PipelineLayout::GetRootSignatureBlob() const { + return mRootSignatureBlob.Get(); +} + const PipelineLayout::DynamicStorageBufferLengthInfo& PipelineLayout::GetDynamicStorageBufferLengthInfo() const { return mDynamicStorageBufferLengthInfo; diff --git a/src/dawn/native/d3d12/PipelineLayoutD3D12.h b/src/dawn/native/d3d12/PipelineLayoutD3D12.h index 69d9095b09..204741265c 100644 --- a/src/dawn/native/d3d12/PipelineLayoutD3D12.h +++ b/src/dawn/native/d3d12/PipelineLayoutD3D12.h @@ -52,6 +52,8 @@ class PipelineLayout final : public PipelineLayoutBase { ID3D12RootSignature* GetRootSignature() const; + ID3DBlob* GetRootSignatureBlob() const; + ID3D12CommandSignature* GetDispatchIndirectCommandSignatureWithNumWorkgroups(); ID3D12CommandSignature* GetDrawIndirectCommandSignatureWithInstanceVertexOffsets(); @@ -85,6 +87,8 @@ class PipelineLayout final : public PipelineLayoutBase { ~PipelineLayout() override = default; using PipelineLayoutBase::PipelineLayoutBase; MaybeError Initialize(); + void DestroyImpl() override; + ityp::array mCbvUavSrvRootParameterInfo; ityp::array mSamplerRootParameterInfo; ityp::array mRootSignature; + // Store the root signature blob to put in pipeline cachekey + ComPtr mRootSignatureBlob; ComPtr mDispatchIndirectCommandSignatureWithNumWorkgroups; ComPtr mDrawIndirectCommandSignatureWithInstanceVertexOffsets; ComPtr mDrawIndexedIndirectCommandSignatureWithInstanceVertexOffsets; diff --git a/src/dawn/native/d3d12/PlatformFunctions.cpp b/src/dawn/native/d3d12/PlatformFunctions.cpp index ffd65c33e2..70b66d8efb 100644 --- a/src/dawn/native/d3d12/PlatformFunctions.cpp +++ b/src/dawn/native/d3d12/PlatformFunctions.cpp @@ -111,7 +111,7 @@ MaybeError PlatformFunctions::LoadFunctions() { } MaybeError PlatformFunctions::LoadD3D12() { -#if DAWN_PLATFORM_WINUWP +#if DAWN_PLATFORM_IS(WINUWP) d3d12CreateDevice = &D3D12CreateDevice; d3d12GetDebugInterface = &D3D12GetDebugInterface; d3d12SerializeRootSignature = &D3D12SerializeRootSignature; @@ -138,7 +138,7 @@ MaybeError PlatformFunctions::LoadD3D12() { } MaybeError PlatformFunctions::LoadD3D11() { -#if DAWN_PLATFORM_WINUWP +#if DAWN_PLATFORM_IS(WINUWP) d3d11on12CreateDevice = &D3D11On12CreateDevice; #else std::string error; @@ -152,7 +152,7 @@ MaybeError PlatformFunctions::LoadD3D11() { } MaybeError PlatformFunctions::LoadDXGI() { -#if DAWN_PLATFORM_WINUWP +#if DAWN_PLATFORM_IS(WINUWP) #if defined(_DEBUG) // DXGIGetDebugInterface1 is tagged as a development-only capability // which implies that linking to this function will cause @@ -226,7 +226,7 @@ void PlatformFunctions::LoadDXCompiler(const std::string& baseWindowsSDKPath) { } MaybeError PlatformFunctions::LoadFXCompiler() { -#if DAWN_PLATFORM_WINUWP +#if DAWN_PLATFORM_IS(WINUWP) d3dCompile = &D3DCompile; d3dDisassemble = &D3DDisassemble; #else diff --git a/src/dawn/native/d3d12/RenderPipelineD3D12.cpp b/src/dawn/native/d3d12/RenderPipelineD3D12.cpp index 9f513cf76d..b1da726691 100644 --- a/src/dawn/native/d3d12/RenderPipelineD3D12.cpp +++ b/src/dawn/native/d3d12/RenderPipelineD3D12.cpp @@ -22,6 +22,7 @@ #include "dawn/common/Assert.h" #include "dawn/common/Log.h" #include "dawn/native/CreatePipelineAsyncTask.h" +#include "dawn/native/d3d12/BlobD3D12.h" #include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/PipelineLayoutD3D12.h" @@ -106,6 +107,8 @@ D3D12_INPUT_CLASSIFICATION VertexStepModeFunction(wgpu::VertexStepMode mode) { return D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA; case wgpu::VertexStepMode::Instance: return D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA; + case wgpu::VertexStepMode::VertexBufferNotUsed: + UNREACHABLE(); } } @@ -232,7 +235,7 @@ uint8_t D3D12RenderTargetWriteMask(wgpu::ColorWriteMask writeMask) { } D3D12_RENDER_TARGET_BLEND_DESC ComputeColorDesc(const ColorTargetState* state) { - D3D12_RENDER_TARGET_BLEND_DESC blendDesc; + D3D12_RENDER_TARGET_BLEND_DESC blendDesc = {}; blendDesc.BlendEnable = state->blend != nullptr; if (blendDesc.BlendEnable) { blendDesc.SrcBlend = D3D12Blend(state->blend->color.srcFactor); @@ -270,7 +273,7 @@ D3D12_STENCIL_OP StencilOp(wgpu::StencilOperation op) { } D3D12_DEPTH_STENCILOP_DESC StencilOpDesc(const StencilFaceState& descriptor) { - D3D12_DEPTH_STENCILOP_DESC desc; + D3D12_DEPTH_STENCILOP_DESC desc = {}; desc.StencilFailOp = StencilOp(descriptor.failOp); desc.StencilDepthFailOp = StencilOp(descriptor.depthFailOp); @@ -281,23 +284,23 @@ D3D12_DEPTH_STENCILOP_DESC StencilOpDesc(const StencilFaceState& descriptor) { } D3D12_DEPTH_STENCIL_DESC ComputeDepthStencilDesc(const DepthStencilState* descriptor) { - D3D12_DEPTH_STENCIL_DESC mDepthStencilDescriptor; - mDepthStencilDescriptor.DepthEnable = + D3D12_DEPTH_STENCIL_DESC depthStencilDescriptor = {}; + depthStencilDescriptor.DepthEnable = (descriptor->depthCompare == wgpu::CompareFunction::Always && !descriptor->depthWriteEnabled) ? FALSE : TRUE; - mDepthStencilDescriptor.DepthWriteMask = + depthStencilDescriptor.DepthWriteMask = descriptor->depthWriteEnabled ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO; - mDepthStencilDescriptor.DepthFunc = ToD3D12ComparisonFunc(descriptor->depthCompare); + depthStencilDescriptor.DepthFunc = ToD3D12ComparisonFunc(descriptor->depthCompare); - mDepthStencilDescriptor.StencilEnable = StencilTestEnabled(descriptor) ? TRUE : FALSE; - mDepthStencilDescriptor.StencilReadMask = static_cast(descriptor->stencilReadMask); - mDepthStencilDescriptor.StencilWriteMask = static_cast(descriptor->stencilWriteMask); + depthStencilDescriptor.StencilEnable = StencilTestEnabled(descriptor) ? TRUE : FALSE; + depthStencilDescriptor.StencilReadMask = static_cast(descriptor->stencilReadMask); + depthStencilDescriptor.StencilWriteMask = static_cast(descriptor->stencilWriteMask); - mDepthStencilDescriptor.FrontFace = StencilOpDesc(descriptor->stencilFront); - mDepthStencilDescriptor.BackFace = StencilOpDesc(descriptor->stencilBack); - return mDepthStencilDescriptor; + depthStencilDescriptor.FrontFace = StencilOpDesc(descriptor->stencilFront); + depthStencilDescriptor.BackFace = StencilOpDesc(descriptor->stencilBack); + return depthStencilDescriptor; } D3D12_INDEX_BUFFER_STRIP_CUT_VALUE ComputeIndexBufferStripCutValue( @@ -386,7 +389,7 @@ MaybeError RenderPipeline::Initialize() { descriptorD3D12.RasterizerState.DepthBias = GetDepthBias(); descriptorD3D12.RasterizerState.DepthBiasClamp = GetDepthBiasClamp(); descriptorD3D12.RasterizerState.SlopeScaledDepthBias = GetDepthBiasSlopeScale(); - descriptorD3D12.RasterizerState.DepthClipEnable = TRUE; + descriptorD3D12.RasterizerState.DepthClipEnable = !HasUnclippedDepth(); descriptorD3D12.RasterizerState.MultisampleEnable = (GetSampleCount() > 1) ? TRUE : FALSE; descriptorD3D12.RasterizerState.AntialiasedLineEnable = FALSE; descriptorD3D12.RasterizerState.ForcedSampleCount = 0; @@ -399,9 +402,6 @@ MaybeError RenderPipeline::Initialize() { static_assert(kMaxColorAttachments == 8); for (uint8_t i = 0; i < kMaxColorAttachments; i++) { descriptorD3D12.RTVFormats[i] = DXGI_FORMAT_UNKNOWN; - descriptorD3D12.BlendState.RenderTarget[i].BlendEnable = false; - descriptorD3D12.BlendState.RenderTarget[i].RenderTargetWriteMask = 0; - descriptorD3D12.BlendState.RenderTarget[i].LogicOpEnable = false; descriptorD3D12.BlendState.RenderTarget[i].LogicOp = D3D12_LOGIC_OP_NOOP; } ColorAttachmentIndex highestColorAttachmentIndexPlusOne = @@ -427,10 +427,29 @@ MaybeError RenderPipeline::Initialize() { mD3d12PrimitiveTopology = D3D12PrimitiveTopology(GetPrimitiveTopology()); + StreamIn(&mCacheKey, descriptorD3D12, *layout->GetRootSignatureBlob()); + + // Try to see if we have anything in the blob cache. + Blob blob = device->LoadCachedBlob(GetCacheKey()); + const bool cacheHit = !blob.Empty(); + if (cacheHit) { + // Cache hits, attach cached blob to descriptor. + descriptorD3D12.CachedPSO.pCachedBlob = blob.Data(); + descriptorD3D12.CachedPSO.CachedBlobSizeInBytes = blob.Size(); + } + DAWN_TRY(CheckHRESULT(device->GetD3D12Device()->CreateGraphicsPipelineState( &descriptorD3D12, IID_PPV_ARGS(&mPipelineState)), "D3D12 create graphics pipeline state")); + if (!cacheHit) { + // Cache misses, need to get pipeline cached blob and store. + ComPtr d3dBlob; + DAWN_TRY(CheckHRESULT(GetPipelineState()->GetCachedBlob(&d3dBlob), + "D3D12 render pipeline state get cached blob")); + device->StoreCachedBlob(GetCacheKey(), CreateBlob(std::move(d3dBlob))); + } + SetLabelImpl(); return {}; diff --git a/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.cpp b/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.cpp index dbcea824cd..d1f8b2640d 100644 --- a/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.cpp +++ b/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.cpp @@ -24,6 +24,8 @@ #include "dawn/native/d3d12/ResidencyManagerD3D12.h" #include "dawn/native/d3d12/UtilsD3D12.h" +static constexpr uint32_t kExtraMemoryToMitigateTextureCorruption = 24576u; + namespace dawn::native::d3d12 { namespace { MemorySegment GetMemorySegment(Device* device, D3D12_HEAP_TYPE heapType) { @@ -152,7 +154,19 @@ uint64_t GetResourcePlacementAlignment(ResourceHeapKind resourceHeapKind, } } -bool IsClearValueOptimizable(const D3D12_RESOURCE_DESC& resourceDescriptor) { +bool IsClearValueOptimizable(DeviceBase* device, const D3D12_RESOURCE_DESC& resourceDescriptor) { + if (device->IsToggleEnabled(Toggle::D3D12DontSetClearValueOnDepthTextureCreation)) { + switch (resourceDescriptor.Format) { + case DXGI_FORMAT_D16_UNORM: + case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_D24_UNORM_S8_UINT: + case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: + return false; + default: + break; + } + } + // Optimized clear color cannot be set on buffers, non-render-target/depth-stencil // textures, or typeless resources // https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createcommittedresource @@ -192,7 +206,7 @@ ResultOrError ResourceAllocatorManager::AllocateMemory( // some architectures. D3D12_CLEAR_VALUE zero{}; D3D12_CLEAR_VALUE* optimizedClearValue = nullptr; - if (IsClearValueOptimizable(resourceDescriptor)) { + if (IsClearValueOptimizable(mDevice, resourceDescriptor)) { zero.Format = resourceDescriptor.Format; optimizedClearValue = &zero; } @@ -299,6 +313,8 @@ ResultOrError ResourceAllocatorManager::CreatePlacedReso mDevice->GetD3D12Device()->GetResourceAllocationInfo(0, 1, &resourceDescriptor); } + resourceInfo.SizeInBytes += GetResourcePadding(resourceDescriptor); + // If d3d tells us the resource size is invalid, treat the error as OOM. // Otherwise, creating the resource could cause a device loss (too large). // This is because NextPowerOfTwo(UINT64_MAX) overflows and proceeds to @@ -321,6 +337,21 @@ ResultOrError ResourceAllocatorManager::CreatePlacedReso Heap* heap = ToBackend(allocation.GetResourceHeap()); + ComPtr placedResource; + DAWN_TRY_ASSIGN(placedResource, + CreatePlacedResourceInHeap(heap, allocation.GetOffset(), resourceDescriptor, + optimizedClearValue, initialUsage)); + return ResourceHeapAllocation{allocation.GetInfo(), allocation.GetOffset(), + std::move(placedResource), heap}; +} + +ResultOrError> ResourceAllocatorManager::CreatePlacedResourceInHeap( + Heap* heap, + const uint64_t offset, + const D3D12_RESOURCE_DESC& resourceDescriptor, + const D3D12_CLEAR_VALUE* optimizedClearValue, + D3D12_RESOURCE_STATES initialUsage) { + ComPtr placedResource; // Before calling CreatePlacedResource, we must ensure the target heap is resident. // CreatePlacedResource will fail if it is not. DAWN_TRY(mDevice->GetResidencyManager()->LockAllocation(heap)); @@ -332,19 +363,16 @@ ResultOrError ResourceAllocatorManager::CreatePlacedReso // within the same command-list and does not require additional synchronization (aliasing // barrier). // https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createplacedresource - ComPtr placedResource; - DAWN_TRY(CheckOutOfMemoryHRESULT( - mDevice->GetD3D12Device()->CreatePlacedResource( - heap->GetD3D12Heap(), allocation.GetOffset(), &resourceDescriptor, initialUsage, - optimizedClearValue, IID_PPV_ARGS(&placedResource)), - "ID3D12Device::CreatePlacedResource")); + DAWN_TRY( + CheckOutOfMemoryHRESULT(mDevice->GetD3D12Device()->CreatePlacedResource( + heap->GetD3D12Heap(), offset, &resourceDescriptor, initialUsage, + optimizedClearValue, IID_PPV_ARGS(&placedResource)), + "ID3D12Device::CreatePlacedResource")); // After CreatePlacedResource has finished, the heap can be unlocked from residency. This // will insert it into the residency LRU. mDevice->GetResidencyManager()->UnlockAllocation(heap); - - return ResourceHeapAllocation{allocation.GetInfo(), allocation.GetOffset(), - std::move(placedResource), heap}; + return std::move(placedResource); } ResultOrError ResourceAllocatorManager::CreateCommittedResource( @@ -365,6 +393,10 @@ ResultOrError ResourceAllocatorManager::CreateCommittedR // incorrectly allocate a mismatched size. D3D12_RESOURCE_ALLOCATION_INFO resourceInfo = mDevice->GetD3D12Device()->GetResourceAllocationInfo(0, 1, &resourceDescriptor); + + uint64_t extraMemory = GetResourcePadding(resourceDescriptor); + resourceInfo.SizeInBytes += extraMemory; + if (resourceInfo.SizeInBytes == 0 || resourceInfo.SizeInBytes == std::numeric_limits::max()) { return DAWN_OUT_OF_MEMORY_ERROR("Resource allocation size was invalid."); @@ -383,11 +415,23 @@ ResultOrError ResourceAllocatorManager::CreateCommittedR // Note: Heap flags are inferred by the resource descriptor and do not need to be explicitly // provided to CreateCommittedResource. ComPtr committedResource; - DAWN_TRY(CheckOutOfMemoryHRESULT( - mDevice->GetD3D12Device()->CreateCommittedResource( - &heapProperties, D3D12_HEAP_FLAG_NONE, &resourceDescriptor, initialUsage, - optimizedClearValue, IID_PPV_ARGS(&committedResource)), - "ID3D12Device::CreateCommittedResource")); + if (extraMemory > 0) { + const ResourceHeapKind resourceHeapKind = GetResourceHeapKind( + resourceDescriptor.Dimension, heapType, resourceDescriptor.Flags, mResourceHeapTier); + std::unique_ptr heapBase; + DAWN_TRY_ASSIGN(heapBase, mPooledHeapAllocators[resourceHeapKind]->AllocateResourceHeap( + resourceInfo.SizeInBytes)); + Heap* heap = ToBackend(heapBase.get()); + DAWN_TRY_ASSIGN(committedResource, + CreatePlacedResourceInHeap(heap, 0, resourceDescriptor, optimizedClearValue, + initialUsage)); + } else { + DAWN_TRY(CheckOutOfMemoryHRESULT( + mDevice->GetD3D12Device()->CreateCommittedResource( + &heapProperties, D3D12_HEAP_FLAG_NONE, &resourceDescriptor, initialUsage, + optimizedClearValue, IID_PPV_ARGS(&committedResource)), + "ID3D12Device::CreateCommittedResource")); + } // When using CreateCommittedResource, D3D12 creates an implicit heap that contains the // resource allocation. Because Dawn's memory residency management occurs at the resource @@ -408,6 +452,17 @@ ResultOrError ResourceAllocatorManager::CreateCommittedR /*offset*/ 0, std::move(committedResource), heap}; } +uint64_t ResourceAllocatorManager::GetResourcePadding( + const D3D12_RESOURCE_DESC& resourceDescriptor) const { + // If we are allocating memory for a 2D array texture on D3D12 backend, we need to allocate + // extra memory on some devices, see crbug.com/dawn/949 for details. + if (mDevice->IsToggleEnabled(Toggle::D3D12AllocateExtraMemoryFor2DArrayTexture) && + resourceDescriptor.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D && + resourceDescriptor.DepthOrArraySize > 1) { + return kExtraMemoryToMitigateTextureCorruption; + } + return 0; +} void ResourceAllocatorManager::DestroyPool() { for (auto& alloc : mPooledHeapAllocators) { alloc->DestroyPool(); diff --git a/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.h b/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.h index 5b6dfd8460..7bb454d9cf 100644 --- a/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.h +++ b/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.h @@ -86,6 +86,15 @@ class ResourceAllocatorManager { const D3D12_CLEAR_VALUE* optimizedClearValue, D3D12_RESOURCE_STATES initialUsage); + ResultOrError> CreatePlacedResourceInHeap( + Heap* heap, + const uint64_t offset, + const D3D12_RESOURCE_DESC& resourceDescriptor, + const D3D12_CLEAR_VALUE* optimizedClearValue, + D3D12_RESOURCE_STATES initialUsage); + + uint64_t GetResourcePadding(const D3D12_RESOURCE_DESC& resourceDescriptor) const; + Device* mDevice; uint32_t mResourceHeapTier; diff --git a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp index 1a9592c561..ce83dbefee 100644 --- a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp +++ b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp @@ -29,90 +29,41 @@ #include "dawn/common/Log.h" #include "dawn/common/WindowsUtils.h" #include "dawn/native/CacheKey.h" +#include "dawn/native/CacheRequest.h" #include "dawn/native/Pipeline.h" #include "dawn/native/TintUtils.h" +#include "dawn/native/d3d12/AdapterD3D12.h" +#include "dawn/native/d3d12/BackendD3D12.h" #include "dawn/native/d3d12/BindGroupLayoutD3D12.h" +#include "dawn/native/d3d12/BlobD3D12.h" #include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/PipelineLayoutD3D12.h" #include "dawn/native/d3d12/PlatformFunctions.h" #include "dawn/native/d3d12/UtilsD3D12.h" +#include "dawn/native/stream/BlobSource.h" +#include "dawn/native/stream/ByteVectorSink.h" #include "dawn/platform/DawnPlatform.h" #include "dawn/platform/tracing/TraceEvent.h" #include "tint/tint.h" +namespace dawn::native::stream { + +// Define no-op serializations for pD3DCompile, IDxcLibrary, and IDxcCompiler. +// These are output-only interfaces used to generate bytecode. +template <> +void Stream::Write(Sink*, IDxcLibrary* const&) {} +template <> +void Stream::Write(Sink*, IDxcCompiler* const&) {} +template <> +void Stream::Write(Sink*, pD3DCompile const&) {} + +} // namespace dawn::native::stream + namespace dawn::native::d3d12 { namespace { -ResultOrError GetDXCompilerVersion(ComPtr dxcValidator) { - ComPtr versionInfo; - DAWN_TRY(CheckHRESULT(dxcValidator.As(&versionInfo), - "D3D12 QueryInterface IDxcValidator to IDxcVersionInfo")); - - uint32_t compilerMajor, compilerMinor; - DAWN_TRY(CheckHRESULT(versionInfo->GetVersion(&compilerMajor, &compilerMinor), - "IDxcVersionInfo::GetVersion")); - - // Pack both into a single version number. - return (uint64_t(compilerMajor) << uint64_t(32)) + compilerMinor; -} - -uint64_t GetD3DCompilerVersion() { - return D3D_COMPILER_VERSION; -} - -struct CompareBindingPoint { - constexpr bool operator()(const tint::transform::BindingPoint& lhs, - const tint::transform::BindingPoint& rhs) const { - if (lhs.group != rhs.group) { - return lhs.group < rhs.group; - } else { - return lhs.binding < rhs.binding; - } - } -}; - -void Serialize(std::stringstream& output, const tint::ast::Access& access) { - output << access; -} - -void Serialize(std::stringstream& output, const tint::transform::BindingPoint& binding_point) { - output << "(BindingPoint"; - output << " group=" << binding_point.group; - output << " binding=" << binding_point.binding; - output << ")"; -} - -template ::value>::type> -void Serialize(std::stringstream& output, const T& val) { - output << val; -} - -template -void Serialize(std::stringstream& output, - const std::unordered_map& map) { - output << "(map"; - - std::map sorted(map.begin(), map.end()); - for (auto& [bindingPoint, value] : sorted) { - output << " "; - Serialize(output, bindingPoint); - output << "="; - Serialize(output, value); - } - output << ")"; -} - -void Serialize(std::stringstream& output, - const tint::writer::ArrayLengthFromUniformOptions& arrayLengthFromUniform) { - output << "(ArrayLengthFromUniformOptions"; - output << " ubo_binding="; - Serialize(output, arrayLengthFromUniform.ubo_binding); - output << " bindpoint_to_size_index="; - Serialize(output, arrayLengthFromUniform.bindpoint_to_size_index); - output << ")"; -} // 32 bit float has 7 decimal digits of precision so setting n to 8 should be enough std::string FloatToStringWithPrecision(float v, std::streamsize n = 8) { @@ -122,17 +73,17 @@ std::string FloatToStringWithPrecision(float v, std::streamsize n = 8) { return out.str(); } -std::string GetHLSLValueString(EntryPointMetadata::OverridableConstant::Type dawnType, - const OverridableConstantScalar* entry, +std::string GetHLSLValueString(EntryPointMetadata::Override::Type dawnType, + const OverrideScalar* entry, double value = 0) { switch (dawnType) { - case EntryPointMetadata::OverridableConstant::Type::Boolean: + case EntryPointMetadata::Override::Type::Boolean: return std::to_string(entry ? entry->b : static_cast(value)); - case EntryPointMetadata::OverridableConstant::Type::Float32: + case EntryPointMetadata::Override::Type::Float32: return FloatToStringWithPrecision(entry ? entry->f32 : static_cast(value)); - case EntryPointMetadata::OverridableConstant::Type::Int32: + case EntryPointMetadata::Override::Type::Int32: return std::to_string(entry ? entry->i32 : static_cast(value)); - case EntryPointMetadata::OverridableConstant::Type::Uint32: + case EntryPointMetadata::Override::Type::Uint32: return std::to_string(entry ? entry->u32 : static_cast(value)); default: UNREACHABLE(); @@ -141,252 +92,102 @@ std::string GetHLSLValueString(EntryPointMetadata::OverridableConstant::Type daw constexpr char kSpecConstantPrefix[] = "WGSL_SPEC_CONSTANT_"; -void GetOverridableConstantsDefines( - std::vector>* defineStrings, - const PipelineConstantEntries* pipelineConstantEntries, - const EntryPointMetadata::OverridableConstantsMap* shaderEntryPointConstants) { +using DefineStrings = std::vector>; + +DefineStrings GetOverridableConstantsDefines( + const PipelineConstantEntries& pipelineConstantEntries, + const EntryPointMetadata::OverridesMap& shaderEntryPointConstants) { + DefineStrings defineStrings; std::unordered_set overriddenConstants; // Set pipeline overridden values - for (const auto& [name, value] : *pipelineConstantEntries) { + for (const auto& [name, value] : pipelineConstantEntries) { overriddenConstants.insert(name); // This is already validated so `name` must exist - const auto& moduleConstant = shaderEntryPointConstants->at(name); + const auto& moduleConstant = shaderEntryPointConstants.at(name); - defineStrings->emplace_back( + defineStrings.emplace_back( kSpecConstantPrefix + std::to_string(static_cast(moduleConstant.id)), GetHLSLValueString(moduleConstant.type, nullptr, value)); } // Set shader initialized default values - for (const auto& iter : *shaderEntryPointConstants) { + for (const auto& iter : shaderEntryPointConstants) { const std::string& name = iter.first; if (overriddenConstants.count(name) != 0) { // This constant already has overridden value continue; } - const auto& moduleConstant = shaderEntryPointConstants->at(name); + const auto& moduleConstant = shaderEntryPointConstants.at(name); // Uninitialized default values are okay since they ar only defined to pass // compilation but not used - defineStrings->emplace_back( + defineStrings.emplace_back( kSpecConstantPrefix + std::to_string(static_cast(moduleConstant.id)), GetHLSLValueString(moduleConstant.type, &moduleConstant.defaultValue)); } + return defineStrings; } -// The inputs to a shader compilation. These have been intentionally isolated from the -// device to help ensure that the pipeline cache key contains all inputs for compilation. -struct ShaderCompilationRequest { - enum Compiler { FXC, DXC }; +enum class Compiler { FXC, DXC }; - // Common inputs - Compiler compiler; - const tint::Program* program; - const char* entryPointName; - SingleShaderStage stage; - uint32_t compileFlags; - bool disableSymbolRenaming; - tint::transform::BindingRemapper::BindingPoints remappedBindingPoints; - tint::transform::BindingRemapper::AccessControls remappedAccessControls; - bool isRobustnessEnabled; - bool usesNumWorkgroups; - uint32_t numWorkgroupsRegisterSpace; - uint32_t numWorkgroupsShaderRegister; - tint::writer::ArrayLengthFromUniformOptions arrayLengthFromUniform; - std::vector> defineStrings; +#define HLSL_COMPILATION_REQUEST_MEMBERS(X) \ + X(const tint::Program*, inputProgram) \ + X(std::string_view, entryPointName) \ + X(SingleShaderStage, stage) \ + X(uint32_t, shaderModel) \ + X(uint32_t, compileFlags) \ + X(Compiler, compiler) \ + X(uint64_t, compilerVersion) \ + X(std::wstring_view, dxcShaderProfile) \ + X(std::string_view, fxcShaderProfile) \ + X(pD3DCompile, d3dCompile) \ + X(IDxcLibrary*, dxcLibrary) \ + X(IDxcCompiler*, dxcCompiler) \ + X(uint32_t, firstIndexOffsetShaderRegister) \ + X(uint32_t, firstIndexOffsetRegisterSpace) \ + X(bool, usesNumWorkgroups) \ + X(uint32_t, numWorkgroupsShaderRegister) \ + X(uint32_t, numWorkgroupsRegisterSpace) \ + X(DefineStrings, defineStrings) \ + X(tint::transform::MultiplanarExternalTexture::BindingsMap, newBindingsMap) \ + X(tint::writer::ArrayLengthFromUniformOptions, arrayLengthFromUniform) \ + X(tint::transform::BindingRemapper::BindingPoints, remappedBindingPoints) \ + X(tint::transform::BindingRemapper::AccessControls, remappedAccessControls) \ + X(bool, disableSymbolRenaming) \ + X(bool, isRobustnessEnabled) \ + X(bool, disableWorkgroupInit) \ + X(bool, dumpShaders) - // FXC/DXC common inputs - bool disableWorkgroupInit; +#define D3D_BYTECODE_COMPILATION_REQUEST_MEMBERS(X) \ + X(bool, hasShaderFloat16Feature) \ + X(uint32_t, compileFlags) \ + X(Compiler, compiler) \ + X(uint64_t, compilerVersion) \ + X(std::wstring_view, dxcShaderProfile) \ + X(std::string_view, fxcShaderProfile) \ + X(pD3DCompile, d3dCompile) \ + X(IDxcLibrary*, dxcLibrary) \ + X(IDxcCompiler*, dxcCompiler) \ + X(DefineStrings, defineStrings) - // FXC inputs - uint64_t fxcVersion; +DAWN_SERIALIZABLE(struct, HlslCompilationRequest, HLSL_COMPILATION_REQUEST_MEMBERS){}; +#undef HLSL_COMPILATION_REQUEST_MEMBERS - // DXC inputs - uint64_t dxcVersion; - const D3D12DeviceInfo* deviceInfo; - bool hasShaderFloat16Feature; +DAWN_SERIALIZABLE(struct, + D3DBytecodeCompilationRequest, + D3D_BYTECODE_COMPILATION_REQUEST_MEMBERS){}; +#undef D3D_BYTECODE_COMPILATION_REQUEST_MEMBERS - static ResultOrError Create( - const char* entryPointName, - SingleShaderStage stage, - const PipelineLayout* layout, - uint32_t compileFlags, - const Device* device, - const tint::Program* program, - const EntryPointMetadata& entryPoint, - const ProgrammableStage& programmableStage) { - Compiler compiler; - uint64_t dxcVersion = 0; - if (device->IsToggleEnabled(Toggle::UseDXC)) { - compiler = Compiler::DXC; - DAWN_TRY_ASSIGN(dxcVersion, GetDXCompilerVersion(device->GetDxcValidator())); - } else { - compiler = Compiler::FXC; - } +#define D3D_COMPILATION_REQUEST_MEMBERS(X) \ + X(HlslCompilationRequest, hlsl) \ + X(D3DBytecodeCompilationRequest, bytecode) \ + X(CacheKey::UnsafeUnkeyedValue, tracePlatform) - using tint::transform::BindingPoint; - using tint::transform::BindingRemapper; - - BindingRemapper::BindingPoints remappedBindingPoints; - BindingRemapper::AccessControls remappedAccessControls; - - tint::writer::ArrayLengthFromUniformOptions arrayLengthFromUniform; - arrayLengthFromUniform.ubo_binding = { - layout->GetDynamicStorageBufferLengthsRegisterSpace(), - layout->GetDynamicStorageBufferLengthsShaderRegister()}; - - const BindingInfoArray& moduleBindingInfo = entryPoint.bindings; - for (BindGroupIndex group : IterateBitSet(layout->GetBindGroupLayoutsMask())) { - const BindGroupLayout* bgl = ToBackend(layout->GetBindGroupLayout(group)); - const auto& groupBindingInfo = moduleBindingInfo[group]; - - // d3d12::BindGroupLayout packs the bindings per HLSL register-space. We modify - // the Tint AST to make the "bindings" decoration match the offset chosen by - // d3d12::BindGroupLayout so that Tint produces HLSL with the correct registers - // assigned to each interface variable. - for (const auto& [binding, bindingInfo] : groupBindingInfo) { - BindingIndex bindingIndex = bgl->GetBindingIndex(binding); - BindingPoint srcBindingPoint{static_cast(group), - static_cast(binding)}; - BindingPoint dstBindingPoint{static_cast(group), - bgl->GetShaderRegister(bindingIndex)}; - if (srcBindingPoint != dstBindingPoint) { - remappedBindingPoints.emplace(srcBindingPoint, dstBindingPoint); - } - - // Declaring a read-only storage buffer in HLSL but specifying a storage - // buffer in the BGL produces the wrong output. Force read-only storage - // buffer bindings to be treated as UAV instead of SRV. Internal storage - // buffer is a storage buffer used in the internal pipeline. - const bool forceStorageBufferAsUAV = - (bindingInfo.buffer.type == wgpu::BufferBindingType::ReadOnlyStorage && - (bgl->GetBindingInfo(bindingIndex).buffer.type == - wgpu::BufferBindingType::Storage || - bgl->GetBindingInfo(bindingIndex).buffer.type == - kInternalStorageBufferBinding)); - if (forceStorageBufferAsUAV) { - remappedAccessControls.emplace(srcBindingPoint, tint::ast::Access::kReadWrite); - } - } - - // Add arrayLengthFromUniform options - { - for (const auto& bindingAndRegisterOffset : - layout->GetDynamicStorageBufferLengthInfo()[group].bindingAndRegisterOffsets) { - BindingNumber binding = bindingAndRegisterOffset.binding; - uint32_t registerOffset = bindingAndRegisterOffset.registerOffset; - - BindingPoint bindingPoint{static_cast(group), - static_cast(binding)}; - // Get the renamed binding point if it was remapped. - auto it = remappedBindingPoints.find(bindingPoint); - if (it != remappedBindingPoints.end()) { - bindingPoint = it->second; - } - - arrayLengthFromUniform.bindpoint_to_size_index.emplace(bindingPoint, - registerOffset); - } - } - } - - ShaderCompilationRequest request; - request.compiler = compiler; - request.program = program; - request.entryPointName = entryPointName; - request.stage = stage; - request.compileFlags = compileFlags; - request.disableSymbolRenaming = device->IsToggleEnabled(Toggle::DisableSymbolRenaming); - request.remappedBindingPoints = std::move(remappedBindingPoints); - request.remappedAccessControls = std::move(remappedAccessControls); - request.isRobustnessEnabled = device->IsRobustnessEnabled(); - request.disableWorkgroupInit = device->IsToggleEnabled(Toggle::DisableWorkgroupInit); - request.usesNumWorkgroups = entryPoint.usesNumWorkgroups; - request.numWorkgroupsShaderRegister = layout->GetNumWorkgroupsShaderRegister(); - request.numWorkgroupsRegisterSpace = layout->GetNumWorkgroupsRegisterSpace(); - request.arrayLengthFromUniform = std::move(arrayLengthFromUniform); - request.fxcVersion = compiler == Compiler::FXC ? GetD3DCompilerVersion() : 0; - request.dxcVersion = compiler == Compiler::DXC ? dxcVersion : 0; - request.deviceInfo = &device->GetDeviceInfo(); - request.hasShaderFloat16Feature = device->IsFeatureEnabled(Feature::ShaderFloat16); - - GetOverridableConstantsDefines( - &request.defineStrings, &programmableStage.constants, - &programmableStage.module->GetEntryPoint(programmableStage.entryPoint) - .overridableConstants); - - return std::move(request); - } - - // TODO(dawn:1341): Move to use CacheKey instead of the vector. - ResultOrError> CreateCacheKey() const { - // Generate the WGSL from the Tint program so it's normalized. - // TODO(tint:1180): Consider using a binary serialization of the tint AST for a more - // compact representation. - auto result = tint::writer::wgsl::Generate(program, tint::writer::wgsl::Options{}); - if (!result.success) { - std::ostringstream errorStream; - errorStream << "Tint WGSL failure:" << std::endl; - errorStream << "Generator: " << result.error << std::endl; - return DAWN_INTERNAL_ERROR(errorStream.str().c_str()); - } - - std::stringstream stream; - - // Prefix the key with the type to avoid collisions from another type that could - // have the same key. - stream << static_cast(CacheKey::Type::Shader); - stream << "\n"; - - stream << result.wgsl.length(); - stream << "\n"; - - stream << result.wgsl; - stream << "\n"; - - stream << "(ShaderCompilationRequest"; - stream << " compiler=" << compiler; - stream << " entryPointName=" << entryPointName; - stream << " stage=" << uint32_t(stage); - stream << " compileFlags=" << compileFlags; - stream << " disableSymbolRenaming=" << disableSymbolRenaming; - - stream << " remappedBindingPoints="; - Serialize(stream, remappedBindingPoints); - - stream << " remappedAccessControls="; - Serialize(stream, remappedAccessControls); - - stream << " useNumWorkgroups=" << usesNumWorkgroups; - stream << " numWorkgroupsRegisterSpace=" << numWorkgroupsRegisterSpace; - stream << " numWorkgroupsShaderRegister=" << numWorkgroupsShaderRegister; - - stream << " arrayLengthFromUniform="; - Serialize(stream, arrayLengthFromUniform); - - stream << " shaderModel=" << deviceInfo->shaderModel; - stream << " disableWorkgroupInit=" << disableWorkgroupInit; - stream << " isRobustnessEnabled=" << isRobustnessEnabled; - stream << " fxcVersion=" << fxcVersion; - stream << " dxcVersion=" << dxcVersion; - stream << " hasShaderFloat16Feature=" << hasShaderFloat16Feature; - - stream << " defines={"; - for (const auto& [name, value] : defineStrings) { - stream << " <" << name << "," << value << ">"; - } - stream << " }"; - - stream << ")"; - stream << "\n"; - - return std::vector(std::istreambuf_iterator{stream}, - std::istreambuf_iterator{}); - } -}; +DAWN_MAKE_CACHE_REQUEST(D3DCompilationRequest, D3D_COMPILATION_REQUEST_MEMBERS); +#undef D3D_COMPILATION_REQUEST_MEMBERS std::vector GetDXCArguments(uint32_t compileFlags, bool enable16BitTypes) { std::vector arguments; @@ -440,25 +241,24 @@ std::vector GetDXCArguments(uint32_t compileFlags, bool enable16 return arguments; } -ResultOrError> CompileShaderDXC(IDxcLibrary* dxcLibrary, - IDxcCompiler* dxcCompiler, - const ShaderCompilationRequest& request, +ResultOrError> CompileShaderDXC(const D3DBytecodeCompilationRequest& r, + const std::string& entryPointName, const std::string& hlslSource) { ComPtr sourceBlob; - DAWN_TRY(CheckHRESULT(dxcLibrary->CreateBlobWithEncodingOnHeapCopy( + DAWN_TRY(CheckHRESULT(r.dxcLibrary->CreateBlobWithEncodingFromPinned( hlslSource.c_str(), hlslSource.length(), CP_UTF8, &sourceBlob), "DXC create blob")); std::wstring entryPointW; - DAWN_TRY_ASSIGN(entryPointW, ConvertStringToWstring(request.entryPointName)); + DAWN_TRY_ASSIGN(entryPointW, ConvertStringToWstring(entryPointName)); std::vector arguments = - GetDXCArguments(request.compileFlags, request.hasShaderFloat16Feature); + GetDXCArguments(r.compileFlags, r.hasShaderFloat16Feature); // Build defines for overridable constants std::vector> defineStrings; - defineStrings.reserve(request.defineStrings.size()); - for (const auto& [name, value] : request.defineStrings) { + defineStrings.reserve(r.defineStrings.size()); + for (const auto& [name, value] : r.defineStrings) { defineStrings.emplace_back(UTF8ToWStr(name.c_str()), UTF8ToWStr(value.c_str())); } @@ -469,12 +269,11 @@ ResultOrError> CompileShaderDXC(IDxcLibrary* dxcLibrary, } ComPtr result; - DAWN_TRY( - CheckHRESULT(dxcCompiler->Compile(sourceBlob.Get(), nullptr, entryPointW.c_str(), - request.deviceInfo->shaderProfiles[request.stage].c_str(), - arguments.data(), arguments.size(), dxcDefines.data(), - dxcDefines.size(), nullptr, &result), - "DXC compile")); + DAWN_TRY(CheckHRESULT( + r.dxcCompiler->Compile(sourceBlob.Get(), nullptr, entryPointW.c_str(), + r.dxcShaderProfile.data(), arguments.data(), arguments.size(), + dxcDefines.data(), dxcDefines.size(), nullptr, &result), + "DXC compile")); HRESULT hr; DAWN_TRY(CheckHRESULT(result->GetStatus(&hr), "DXC get status")); @@ -554,31 +353,18 @@ std::string CompileFlagsToStringFXC(uint32_t compileFlags) { return result; } -ResultOrError> CompileShaderFXC(const PlatformFunctions* functions, - const ShaderCompilationRequest& request, +ResultOrError> CompileShaderFXC(const D3DBytecodeCompilationRequest& r, + const std::string& entryPointName, const std::string& hlslSource) { - const char* targetProfile = nullptr; - switch (request.stage) { - case SingleShaderStage::Vertex: - targetProfile = "vs_5_1"; - break; - case SingleShaderStage::Fragment: - targetProfile = "ps_5_1"; - break; - case SingleShaderStage::Compute: - targetProfile = "cs_5_1"; - break; - } - ComPtr compiledShader; ComPtr errors; // Build defines for overridable constants const D3D_SHADER_MACRO* pDefines = nullptr; std::vector fxcDefines; - if (request.defineStrings.size() > 0) { - fxcDefines.reserve(request.defineStrings.size() + 1); - for (const auto& [name, value] : request.defineStrings) { + if (r.defineStrings.size() > 0) { + fxcDefines.reserve(r.defineStrings.size() + 1); + for (const auto& [name, value] : r.defineStrings) { fxcDefines.push_back({name.c_str(), value.c_str()}); } // d3dCompile D3D_SHADER_MACRO* pDefines is a nullptr terminated array @@ -586,36 +372,49 @@ ResultOrError> CompileShaderFXC(const PlatformFunctions* functi pDefines = fxcDefines.data(); } - DAWN_INVALID_IF( - FAILED(functions->d3dCompile(hlslSource.c_str(), hlslSource.length(), nullptr, pDefines, - nullptr, request.entryPointName, targetProfile, - request.compileFlags, 0, &compiledShader, &errors)), - "D3D compile failed with: %s", static_cast(errors->GetBufferPointer())); + DAWN_INVALID_IF(FAILED(r.d3dCompile(hlslSource.c_str(), hlslSource.length(), nullptr, pDefines, + nullptr, entryPointName.c_str(), r.fxcShaderProfile.data(), + r.compileFlags, 0, &compiledShader, &errors)), + "D3D compile failed with: %s", static_cast(errors->GetBufferPointer())); return std::move(compiledShader); } -ResultOrError TranslateToHLSL(dawn::platform::Platform* platform, - const ShaderCompilationRequest& request, - std::string* remappedEntryPointName) { +ResultOrError TranslateToHLSL( + HlslCompilationRequest r, + CacheKey::UnsafeUnkeyedValue tracePlatform, + std::string* remappedEntryPointName, + bool* usesVertexOrInstanceIndex) { std::ostringstream errorStream; errorStream << "Tint HLSL failure:" << std::endl; tint::transform::Manager transformManager; tint::transform::DataMap transformInputs; - if (request.isRobustnessEnabled) { + if (!r.newBindingsMap.empty()) { + transformManager.Add(); + transformInputs.Add( + std::move(r.newBindingsMap)); + } + + if (r.stage == SingleShaderStage::Vertex) { + transformManager.Add(); + transformInputs.Add( + r.firstIndexOffsetShaderRegister, r.firstIndexOffsetRegisterSpace); + } + + if (r.isRobustnessEnabled) { transformManager.Add(); } transformManager.Add(); transformManager.Add(); - transformInputs.Add(request.entryPointName); + transformInputs.Add(r.entryPointName.data()); transformManager.Add(); - if (request.disableSymbolRenaming) { + if (r.disableSymbolRenaming) { // We still need to rename HLSL reserved keywords transformInputs.Add( tint::transform::Renamer::Target::kHlslKeywords); @@ -626,104 +425,92 @@ ResultOrError TranslateToHLSL(dawn::platform::Platform* platform, // different types. const bool mayCollide = true; transformInputs.Add( - std::move(request.remappedBindingPoints), std::move(request.remappedAccessControls), - mayCollide); + std::move(r.remappedBindingPoints), std::move(r.remappedAccessControls), mayCollide); tint::Program transformedProgram; tint::transform::DataMap transformOutputs; { - TRACE_EVENT0(platform, General, "RunTransforms"); + TRACE_EVENT0(tracePlatform.UnsafeGetValue(), General, "RunTransforms"); DAWN_TRY_ASSIGN(transformedProgram, - RunTransforms(&transformManager, request.program, transformInputs, + RunTransforms(&transformManager, r.inputProgram, transformInputs, &transformOutputs, nullptr)); } if (auto* data = transformOutputs.Get()) { - auto it = data->remappings.find(request.entryPointName); + auto it = data->remappings.find(r.entryPointName.data()); if (it != data->remappings.end()) { *remappedEntryPointName = it->second; } else { - DAWN_INVALID_IF(!request.disableSymbolRenaming, + DAWN_INVALID_IF(!r.disableSymbolRenaming, "Could not find remapped name for entry point."); - *remappedEntryPointName = request.entryPointName; + *remappedEntryPointName = r.entryPointName; } } else { return DAWN_FORMAT_VALIDATION_ERROR("Transform output missing renamer data."); } + if (r.stage == SingleShaderStage::Vertex) { + if (auto* data = transformOutputs.Get()) { + *usesVertexOrInstanceIndex = data->has_vertex_or_instance_index; + } else { + return DAWN_FORMAT_VALIDATION_ERROR( + "Transform output missing first index offset data."); + } + } + tint::writer::hlsl::Options options; - options.disable_workgroup_init = request.disableWorkgroupInit; - if (request.usesNumWorkgroups) { - options.root_constant_binding_point.group = request.numWorkgroupsRegisterSpace; - options.root_constant_binding_point.binding = request.numWorkgroupsShaderRegister; + options.disable_workgroup_init = r.disableWorkgroupInit; + if (r.usesNumWorkgroups) { + options.root_constant_binding_point = + tint::sem::BindingPoint{r.numWorkgroupsRegisterSpace, r.numWorkgroupsShaderRegister}; } // TODO(dawn:549): HLSL generation outputs the indices into the // array_length_from_uniform buffer that were actually used. When the blob cache can // store more than compiled shaders, we should reflect these used indices and store // them as well. This would allow us to only upload root constants that are actually // read by the shader. - options.array_length_from_uniform = request.arrayLengthFromUniform; - TRACE_EVENT0(platform, General, "tint::writer::hlsl::Generate"); + options.array_length_from_uniform = r.arrayLengthFromUniform; + TRACE_EVENT0(tracePlatform.UnsafeGetValue(), General, "tint::writer::hlsl::Generate"); auto result = tint::writer::hlsl::Generate(&transformedProgram, options); DAWN_INVALID_IF(!result.success, "An error occured while generating HLSL: %s", result.error); return std::move(result.hlsl); } -template -MaybeError CompileShader(dawn::platform::Platform* platform, - const PlatformFunctions* functions, - IDxcLibrary* dxcLibrary, - IDxcCompiler* dxcCompiler, - ShaderCompilationRequest&& request, - bool dumpShaders, - F&& DumpShadersEmitLog, - CompiledShader* compiledShader) { +ResultOrError CompileShader(D3DCompilationRequest r) { + CompiledShader compiledShader; // Compile the source shader to HLSL. - std::string hlslSource; std::string remappedEntryPoint; - DAWN_TRY_ASSIGN(hlslSource, TranslateToHLSL(platform, request, &remappedEntryPoint)); - if (dumpShaders) { - std::ostringstream dumpedMsg; - dumpedMsg << "/* Dumped generated HLSL */" << std::endl << hlslSource; - DumpShadersEmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str()); - } - request.entryPointName = remappedEntryPoint.c_str(); - switch (request.compiler) { - case ShaderCompilationRequest::Compiler::DXC: { - TRACE_EVENT0(platform, General, "CompileShaderDXC"); - DAWN_TRY_ASSIGN(compiledShader->compiledDXCShader, - CompileShaderDXC(dxcLibrary, dxcCompiler, request, hlslSource)); + DAWN_TRY_ASSIGN(compiledShader.hlslSource, + TranslateToHLSL(std::move(r.hlsl), r.tracePlatform, &remappedEntryPoint, + &compiledShader.usesVertexOrInstanceIndex)); + + switch (r.bytecode.compiler) { + case Compiler::DXC: { + TRACE_EVENT0(r.tracePlatform.UnsafeGetValue(), General, "CompileShaderDXC"); + ComPtr compiledDXCShader; + DAWN_TRY_ASSIGN(compiledDXCShader, CompileShaderDXC(r.bytecode, remappedEntryPoint, + compiledShader.hlslSource)); + compiledShader.shaderBlob = CreateBlob(std::move(compiledDXCShader)); break; } - case ShaderCompilationRequest::Compiler::FXC: { - TRACE_EVENT0(platform, General, "CompileShaderFXC"); - DAWN_TRY_ASSIGN(compiledShader->compiledFXCShader, - CompileShaderFXC(functions, request, hlslSource)); + case Compiler::FXC: { + TRACE_EVENT0(r.tracePlatform.UnsafeGetValue(), General, "CompileShaderFXC"); + ComPtr compiledFXCShader; + DAWN_TRY_ASSIGN(compiledFXCShader, CompileShaderFXC(r.bytecode, remappedEntryPoint, + compiledShader.hlslSource)); + compiledShader.shaderBlob = CreateBlob(std::move(compiledFXCShader)); break; } } - if (dumpShaders && request.compiler == ShaderCompilationRequest::Compiler::FXC) { - std::ostringstream dumpedMsg; - dumpedMsg << "/* FXC compile flags */ " << std::endl - << CompileFlagsToStringFXC(request.compileFlags) << std::endl; - - dumpedMsg << "/* Dumped disassembled DXBC */" << std::endl; - - ComPtr disassembly; - if (FAILED(functions->d3dDisassemble(compiledShader->compiledFXCShader->GetBufferPointer(), - compiledShader->compiledFXCShader->GetBufferSize(), 0, - nullptr, &disassembly))) { - dumpedMsg << "D3D disassemble failed" << std::endl; - } else { - dumpedMsg << reinterpret_cast(disassembly->GetBufferPointer()); - } - DumpShadersEmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str()); + // If dumpShaders is false, we don't need the HLSL for logging. Clear the contents so it + // isn't stored into the cache. + if (!r.hlsl.dumpShaders) { + compiledShader.hlslSource = ""; } - - return {}; + return compiledShader; } } // anonymous namespace @@ -752,69 +539,181 @@ ResultOrError ShaderModule::Compile(const ProgrammableStage& pro SingleShaderStage stage, const PipelineLayout* layout, uint32_t compileFlags) { - TRACE_EVENT0(GetDevice()->GetPlatform(), General, "ShaderModuleD3D12::Compile"); + Device* device = ToBackend(GetDevice()); + TRACE_EVENT0(device->GetPlatform(), General, "ShaderModuleD3D12::Compile"); ASSERT(!IsError()); - ScopedTintICEHandler scopedICEHandler(GetDevice()); + ScopedTintICEHandler scopedICEHandler(device); + const EntryPointMetadata& entryPoint = GetEntryPoint(programmableStage.entryPoint); - Device* device = ToBackend(GetDevice()); + D3DCompilationRequest req = {}; + req.tracePlatform = UnsafeUnkeyedValue(device->GetPlatform()); + req.hlsl.shaderModel = device->GetDeviceInfo().shaderModel; + req.hlsl.disableSymbolRenaming = device->IsToggleEnabled(Toggle::DisableSymbolRenaming); + req.hlsl.isRobustnessEnabled = device->IsRobustnessEnabled(); + req.hlsl.disableWorkgroupInit = device->IsToggleEnabled(Toggle::DisableWorkgroupInit); + req.hlsl.dumpShaders = device->IsToggleEnabled(Toggle::DumpShaders); - CompiledShader compiledShader = {}; - - tint::transform::Manager transformManager; - tint::transform::DataMap transformInputs; - - const tint::Program* program = GetTintProgram(); - tint::Program programAsValue; - - AddExternalTextureTransform(layout, &transformManager, &transformInputs); - - if (stage == SingleShaderStage::Vertex) { - transformManager.Add(); - transformInputs.Add( - layout->GetFirstIndexOffsetShaderRegister(), - layout->GetFirstIndexOffsetRegisterSpace()); - } - - tint::transform::DataMap transformOutputs; - DAWN_TRY_ASSIGN(programAsValue, RunTransforms(&transformManager, program, transformInputs, - &transformOutputs, nullptr)); - program = &programAsValue; - - if (stage == SingleShaderStage::Vertex) { - if (auto* data = transformOutputs.Get()) { - // TODO(dawn:549): Consider adding this information to the pipeline cache once we - // can store more than the shader blob in it. - compiledShader.usesVertexOrInstanceIndex = data->has_vertex_or_instance_index; + req.bytecode.hasShaderFloat16Feature = device->IsFeatureEnabled(Feature::ShaderFloat16); + req.bytecode.compileFlags = compileFlags; + req.bytecode.defineStrings = + GetOverridableConstantsDefines(programmableStage.constants, entryPoint.overrides); + if (device->IsToggleEnabled(Toggle::UseDXC)) { + req.bytecode.compiler = Compiler::DXC; + req.bytecode.dxcLibrary = device->GetDxcLibrary().Get(); + req.bytecode.dxcCompiler = device->GetDxcCompiler().Get(); + DAWN_TRY_ASSIGN(req.bytecode.compilerVersion, + ToBackend(device->GetAdapter())->GetBackend()->GetDXCompilerVersion()); + req.bytecode.dxcShaderProfile = device->GetDeviceInfo().shaderProfiles[stage]; + } else { + req.bytecode.compiler = Compiler::FXC; + req.bytecode.d3dCompile = device->GetFunctions()->d3dCompile; + req.bytecode.compilerVersion = D3D_COMPILER_VERSION; + switch (stage) { + case SingleShaderStage::Vertex: + req.bytecode.fxcShaderProfile = "vs_5_1"; + break; + case SingleShaderStage::Fragment: + req.bytecode.fxcShaderProfile = "ps_5_1"; + break; + case SingleShaderStage::Compute: + req.bytecode.fxcShaderProfile = "cs_5_1"; + break; } } - ShaderCompilationRequest request; - DAWN_TRY_ASSIGN(request, - ShaderCompilationRequest::Create( - programmableStage.entryPoint.c_str(), stage, layout, compileFlags, device, - program, GetEntryPoint(programmableStage.entryPoint), programmableStage)); + using tint::transform::BindingPoint; + using tint::transform::BindingRemapper; - // TODO(dawn:1341): Add shader cache key generation and caching for the compiled shader. - DAWN_TRY(CompileShader( - device->GetPlatform(), device->GetFunctions(), - device->IsToggleEnabled(Toggle::UseDXC) ? device->GetDxcLibrary().Get() : nullptr, - device->IsToggleEnabled(Toggle::UseDXC) ? device->GetDxcCompiler().Get() : nullptr, - std::move(request), device->IsToggleEnabled(Toggle::DumpShaders), - [&](WGPULoggingType loggingType, const char* message) { - GetDevice()->EmitLog(loggingType, message); - }, - &compiledShader)); - return std::move(compiledShader); + BindingRemapper::BindingPoints remappedBindingPoints; + BindingRemapper::AccessControls remappedAccessControls; + + tint::writer::ArrayLengthFromUniformOptions arrayLengthFromUniform; + arrayLengthFromUniform.ubo_binding = {layout->GetDynamicStorageBufferLengthsRegisterSpace(), + layout->GetDynamicStorageBufferLengthsShaderRegister()}; + + const BindingInfoArray& moduleBindingInfo = entryPoint.bindings; + for (BindGroupIndex group : IterateBitSet(layout->GetBindGroupLayoutsMask())) { + const BindGroupLayout* bgl = ToBackend(layout->GetBindGroupLayout(group)); + const auto& groupBindingInfo = moduleBindingInfo[group]; + + // d3d12::BindGroupLayout packs the bindings per HLSL register-space. We modify + // the Tint AST to make the "bindings" decoration match the offset chosen by + // d3d12::BindGroupLayout so that Tint produces HLSL with the correct registers + // assigned to each interface variable. + for (const auto& [binding, bindingInfo] : groupBindingInfo) { + BindingIndex bindingIndex = bgl->GetBindingIndex(binding); + BindingPoint srcBindingPoint{static_cast(group), + static_cast(binding)}; + BindingPoint dstBindingPoint{static_cast(group), + bgl->GetShaderRegister(bindingIndex)}; + if (srcBindingPoint != dstBindingPoint) { + remappedBindingPoints.emplace(srcBindingPoint, dstBindingPoint); + } + + // Declaring a read-only storage buffer in HLSL but specifying a storage + // buffer in the BGL produces the wrong output. Force read-only storage + // buffer bindings to be treated as UAV instead of SRV. Internal storage + // buffer is a storage buffer used in the internal pipeline. + const bool forceStorageBufferAsUAV = + (bindingInfo.buffer.type == wgpu::BufferBindingType::ReadOnlyStorage && + (bgl->GetBindingInfo(bindingIndex).buffer.type == + wgpu::BufferBindingType::Storage || + bgl->GetBindingInfo(bindingIndex).buffer.type == kInternalStorageBufferBinding)); + if (forceStorageBufferAsUAV) { + remappedAccessControls.emplace(srcBindingPoint, tint::ast::Access::kReadWrite); + } + } + + // Add arrayLengthFromUniform options + { + for (const auto& bindingAndRegisterOffset : + layout->GetDynamicStorageBufferLengthInfo()[group].bindingAndRegisterOffsets) { + BindingNumber binding = bindingAndRegisterOffset.binding; + uint32_t registerOffset = bindingAndRegisterOffset.registerOffset; + + BindingPoint bindingPoint{static_cast(group), + static_cast(binding)}; + // Get the renamed binding point if it was remapped. + auto it = remappedBindingPoints.find(bindingPoint); + if (it != remappedBindingPoints.end()) { + bindingPoint = it->second; + } + + arrayLengthFromUniform.bindpoint_to_size_index.emplace(bindingPoint, + registerOffset); + } + } + } + + req.hlsl.inputProgram = GetTintProgram(); + req.hlsl.entryPointName = programmableStage.entryPoint.c_str(); + req.hlsl.stage = stage; + req.hlsl.firstIndexOffsetShaderRegister = layout->GetFirstIndexOffsetShaderRegister(); + req.hlsl.firstIndexOffsetRegisterSpace = layout->GetFirstIndexOffsetRegisterSpace(); + req.hlsl.usesNumWorkgroups = entryPoint.usesNumWorkgroups; + req.hlsl.numWorkgroupsShaderRegister = layout->GetNumWorkgroupsShaderRegister(); + req.hlsl.numWorkgroupsRegisterSpace = layout->GetNumWorkgroupsRegisterSpace(); + req.hlsl.remappedBindingPoints = std::move(remappedBindingPoints); + req.hlsl.remappedAccessControls = std::move(remappedAccessControls); + req.hlsl.newBindingsMap = BuildExternalTextureTransformBindings(layout); + req.hlsl.arrayLengthFromUniform = std::move(arrayLengthFromUniform); + + CacheResult compiledShader; + DAWN_TRY_LOAD_OR_RUN(compiledShader, device, std::move(req), CompiledShader::FromBlob, + CompileShader); + + if (device->IsToggleEnabled(Toggle::DumpShaders)) { + std::ostringstream dumpedMsg; + dumpedMsg << "/* Dumped generated HLSL */" << std::endl + << compiledShader->hlslSource << std::endl; + device->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str()); + + if (device->IsToggleEnabled(Toggle::UseDXC)) { + dumpedMsg << "/* Dumped disassembled DXIL */" << std::endl; + D3D12_SHADER_BYTECODE code = compiledShader->GetD3D12ShaderBytecode(); + ComPtr dxcBlob; + ComPtr disassembly; + if (FAILED(device->GetDxcLibrary()->CreateBlobWithEncodingFromPinned( + code.pShaderBytecode, code.BytecodeLength, 0, &dxcBlob)) || + FAILED(device->GetDxcCompiler()->Disassemble(dxcBlob.Get(), &disassembly))) { + dumpedMsg << "DXC disassemble failed" << std::endl; + } else { + dumpedMsg << std::string_view( + static_cast(disassembly->GetBufferPointer()), + disassembly->GetBufferSize()); + } + } else { + dumpedMsg << "/* FXC compile flags */ " << std::endl + << CompileFlagsToStringFXC(compileFlags) << std::endl; + dumpedMsg << "/* Dumped disassembled DXBC */" << std::endl; + ComPtr disassembly; + D3D12_SHADER_BYTECODE code = compiledShader->GetD3D12ShaderBytecode(); + if (FAILED(device->GetFunctions()->d3dDisassemble( + code.pShaderBytecode, code.BytecodeLength, 0, nullptr, &disassembly))) { + dumpedMsg << "D3D disassemble failed" << std::endl; + } else { + dumpedMsg << std::string_view( + static_cast(disassembly->GetBufferPointer()), + disassembly->GetBufferSize()); + } + } + device->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str()); + } + + if (BlobCache* cache = device->GetBlobCache()) { + cache->EnsureStored(compiledShader); + } + + // Clear the hlslSource. It is only used for logging and should not be used + // outside of the compilation. + CompiledShader result = compiledShader.Acquire(); + result.hlslSource = ""; + return result; } D3D12_SHADER_BYTECODE CompiledShader::GetD3D12ShaderBytecode() const { - if (compiledFXCShader != nullptr) { - return {compiledFXCShader->GetBufferPointer(), compiledFXCShader->GetBufferSize()}; - } else if (compiledDXCShader != nullptr) { - return {compiledDXCShader->GetBufferPointer(), compiledDXCShader->GetBufferSize()}; - } - UNREACHABLE(); - return {}; + return {shaderBlob.Data(), shaderBlob.Size()}; } + } // namespace dawn::native::d3d12 diff --git a/src/dawn/native/d3d12/ShaderModuleD3D12.h b/src/dawn/native/d3d12/ShaderModuleD3D12.h index 7f68b10221..8c70bb45a4 100644 --- a/src/dawn/native/d3d12/ShaderModuleD3D12.h +++ b/src/dawn/native/d3d12/ShaderModuleD3D12.h @@ -15,8 +15,11 @@ #ifndef SRC_DAWN_NATIVE_D3D12_SHADERMODULED3D12_H_ #define SRC_DAWN_NATIVE_D3D12_SHADERMODULED3D12_H_ -#include "dawn/native/ShaderModule.h" +#include +#include "dawn/native/Blob.h" +#include "dawn/native/Serializable.h" +#include "dawn/native/ShaderModule.h" #include "dawn/native/d3d12/d3d12_platform.h" namespace dawn::native { @@ -28,15 +31,19 @@ namespace dawn::native::d3d12 { class Device; class PipelineLayout; -// Manages a ref to one of the various representations of shader blobs and information used to -// emulate vertex/instance index starts -struct CompiledShader { - ComPtr compiledFXCShader; - ComPtr compiledDXCShader; - D3D12_SHADER_BYTECODE GetD3D12ShaderBytecode() const; +#define COMPILED_SHADER_MEMBERS(X) \ + X(Blob, shaderBlob) \ + X(std::string, hlslSource) \ + X(bool, usesVertexOrInstanceIndex) - bool usesVertexOrInstanceIndex; +// `CompiledShader` holds a ref to one of the various representations of shader blobs and +// information used to emulate vertex/instance index starts. It also holds the `hlslSource` for the +// shader compilation, which is only transiently available during Compile, and cleared before it +// returns. It is not written to or loaded from the cache unless Toggle dump_shaders is true. +DAWN_SERIALIZABLE(struct, CompiledShader, COMPILED_SHADER_MEMBERS) { + D3D12_SHADER_BYTECODE GetD3D12ShaderBytecode() const; }; +#undef COMPILED_SHADER_MEMBERS class ShaderModule final : public ShaderModuleBase { public: diff --git a/src/dawn/native/d3d12/StreamImplD3D12.cpp b/src/dawn/native/d3d12/StreamImplD3D12.cpp new file mode 100644 index 0000000000..7fce45a527 --- /dev/null +++ b/src/dawn/native/d3d12/StreamImplD3D12.cpp @@ -0,0 +1,122 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/common/Assert.h" +#include "dawn/common/Constants.h" +#include "dawn/native/d3d12/d3d12_platform.h" +#include "dawn/native/stream/Stream.h" + +namespace dawn::native { + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const D3D12_RENDER_TARGET_BLEND_DESC& t) { + StreamIn(sink, t.BlendEnable, t.LogicOpEnable, t.SrcBlend, t.DestBlend, t.BlendOp, + t.SrcBlendAlpha, t.DestBlendAlpha, t.BlendOpAlpha, t.LogicOp, t.RenderTargetWriteMask); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const D3D12_BLEND_DESC& t) { + StreamIn(sink, t.AlphaToCoverageEnable, t.IndependentBlendEnable, t.RenderTarget); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const D3D12_DEPTH_STENCILOP_DESC& t) { + StreamIn(sink, t.StencilFailOp, t.StencilDepthFailOp, t.StencilPassOp, t.StencilFunc); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const D3D12_DEPTH_STENCIL_DESC& t) { + StreamIn(sink, t.DepthEnable, t.DepthWriteMask, t.DepthFunc, t.StencilEnable, t.StencilReadMask, + t.StencilWriteMask, t.FrontFace, t.BackFace); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const D3D12_RASTERIZER_DESC& t) { + StreamIn(sink, t.FillMode, t.CullMode, t.FrontCounterClockwise, t.DepthBias, t.DepthBiasClamp, + t.SlopeScaledDepthBias, t.DepthClipEnable, t.MultisampleEnable, + t.AntialiasedLineEnable, t.ForcedSampleCount, t.ConservativeRaster); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const D3D12_INPUT_ELEMENT_DESC& t) { + StreamIn(sink, std::string_view(t.SemanticName), t.SemanticIndex, t.Format, t.InputSlot, + t.AlignedByteOffset, t.InputSlotClass, t.InstanceDataStepRate); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const D3D12_INPUT_LAYOUT_DESC& t) { + StreamIn(sink, Iterable(t.pInputElementDescs, t.NumElements)); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const D3D12_SO_DECLARATION_ENTRY& t) { + StreamIn(sink, t.Stream, std::string_view(t.SemanticName), t.SemanticIndex, t.StartComponent, + t.ComponentCount, t.OutputSlot); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const D3D12_STREAM_OUTPUT_DESC& t) { + StreamIn(sink, Iterable(t.pSODeclaration, t.NumEntries), + Iterable(t.pBufferStrides, t.NumStrides), t.RasterizedStream); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const DXGI_SAMPLE_DESC& t) { + StreamIn(sink, t.Count, t.Quality); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const D3D12_SHADER_BYTECODE& t) { + StreamIn(sink, Iterable(reinterpret_cast(t.pShaderBytecode), t.BytecodeLength)); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const D3D12_GRAPHICS_PIPELINE_STATE_DESC& t) { + // Don't Serialize pRootSignature as we already serialize the signature blob in pipline layout. + // Don't Serialize CachedPSO as it is in the cached blob. + StreamIn(sink, t.VS, t.PS, t.DS, t.HS, t.GS, t.StreamOutput, t.BlendState, t.SampleMask, + t.RasterizerState, t.DepthStencilState, t.InputLayout, t.IBStripCutValue, + t.PrimitiveTopologyType, Iterable(t.RTVFormats, t.NumRenderTargets), t.DSVFormat, + t.SampleDesc, t.NodeMask, t.Flags); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const D3D12_COMPUTE_PIPELINE_STATE_DESC& t) { + // Don't Serialize pRootSignature as we already serialize the signature blob in pipline layout. + StreamIn(sink, t.CS, t.NodeMask, t.Flags); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const ID3DBlob& t) { + // Workaround: GetBufferPointer and GetbufferSize are not marked as const + ID3DBlob* pBlob = const_cast(&t); + StreamIn(sink, Iterable(reinterpret_cast(pBlob->GetBufferPointer()), + pBlob->GetBufferSize())); +} + +} // namespace dawn::native diff --git a/src/dawn/native/d3d12/TextureD3D12.cpp b/src/dawn/native/d3d12/TextureD3D12.cpp index 59e27a516a..41bc0a099c 100644 --- a/src/dawn/native/d3d12/TextureD3D12.cpp +++ b/src/dawn/native/d3d12/TextureD3D12.cpp @@ -77,19 +77,14 @@ D3D12_RESOURCE_STATES D3D12TextureUsage(wgpu::TextureUsage usage, const Format& return resourceState; } -D3D12_RESOURCE_FLAGS D3D12ResourceFlags(wgpu::TextureUsage usage, - const Format& format, - bool isMultisampledTexture) { +D3D12_RESOURCE_FLAGS D3D12ResourceFlags(wgpu::TextureUsage usage, const Format& format) { D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE; if (usage & wgpu::TextureUsage::StorageBinding) { flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; } - // A multisampled resource must have either D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET or - // D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL set in D3D12_RESOURCE_DESC::Flags. - // https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/ns-d3d12-d3d12_resource_desc - if ((usage & wgpu::TextureUsage::RenderAttachment) != 0 || isMultisampledTexture) { + if (usage & wgpu::TextureUsage::RenderAttachment) { if (format.HasDepthOrStencil()) { flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; } else { @@ -181,9 +176,9 @@ DXGI_FORMAT D3D12TypelessTextureFormat(wgpu::TextureFormat format) { case wgpu::TextureFormat::Depth24Plus: return DXGI_FORMAT_R32_TYPELESS; - // Depth24UnormStencil8 is the smallest format supported on D3D12 that has stencil. + // DXGI_FORMAT_D24_UNORM_S8_UINT is the smallest format supported on D3D12 that has stencil, + // for which the typeless equivalent is DXGI_FORMAT_R24G8_TYPELESS. case wgpu::TextureFormat::Stencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: return DXGI_FORMAT_R24G8_TYPELESS; case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: @@ -349,9 +344,8 @@ DXGI_FORMAT D3D12TextureFormat(wgpu::TextureFormat format) { case wgpu::TextureFormat::Depth32Float: case wgpu::TextureFormat::Depth24Plus: return DXGI_FORMAT_D32_FLOAT; - // Depth24UnormStencil8 is the smallest format supported on D3D12 that has stencil. + // DXGI_FORMAT_D24_UNORM_S8_UINT is the smallest format supported on D3D12 that has stencil. case wgpu::TextureFormat::Stencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: return DXGI_FORMAT_D24_UNORM_S8_UINT; case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: @@ -516,13 +510,17 @@ ResultOrError> Texture::CreateExternalImage( Device* device, const TextureDescriptor* descriptor, ComPtr d3d12Texture, + ComPtr d3d12Fence, Ref d3d11on12Resource, + uint64_t fenceWaitValue, + uint64_t fenceSignalValue, bool isSwapChainTexture, bool isInitialized) { Ref dawnTexture = AcquireRef(new Texture(device, descriptor, TextureState::OwnedExternal)); DAWN_TRY(dawnTexture->InitializeAsExternalTexture( - descriptor, std::move(d3d12Texture), std::move(d3d11on12Resource), isSwapChainTexture)); + std::move(d3d12Texture), std::move(d3d12Fence), std::move(d3d11on12Resource), + fenceWaitValue, fenceSignalValue, isSwapChainTexture)); // Importing a multi-planar format must be initialized. This is required because // a shared multi-planar format cannot be initialized by Dawn. @@ -546,13 +544,12 @@ ResultOrError> Texture::Create(Device* device, return std::move(dawnTexture); } -MaybeError Texture::InitializeAsExternalTexture(const TextureDescriptor* descriptor, - ComPtr d3d12Texture, +MaybeError Texture::InitializeAsExternalTexture(ComPtr d3d12Texture, + ComPtr d3d12Fence, Ref d3d11on12Resource, + uint64_t fenceWaitValue, + uint64_t fenceSignalValue, bool isSwapChainTexture) { - mD3D11on12Resource = std::move(d3d11on12Resource); - mSwapChainTexture = isSwapChainTexture; - D3D12_RESOURCE_DESC desc = d3d12Texture->GetDesc(); mD3D12ResourceFlags = desc.Flags; @@ -563,6 +560,12 @@ MaybeError Texture::InitializeAsExternalTexture(const TextureDescriptor* descrip // memory management. mResourceAllocation = {info, 0, std::move(d3d12Texture), nullptr}; + mD3D12Fence = std::move(d3d12Fence); + mD3D11on12Resource = std::move(d3d11on12Resource); + mFenceWaitValue = fenceWaitValue; + mFenceSignalValue = fenceSignalValue; + mSwapChainTexture = isSwapChainTexture; + SetLabelHelper("Dawn_ExternalTexture"); return {}; @@ -578,10 +581,21 @@ MaybeError Texture::InitializeAsInternalTexture() { resourceDescriptor.Height = size.height; resourceDescriptor.DepthOrArraySize = size.depthOrArrayLayers; + Device* device = ToBackend(GetDevice()); + bool applyForceClearCopyableDepthStencilTextureOnCreationToggle = + device->IsToggleEnabled(Toggle::D3D12ForceClearCopyableDepthStencilTextureOnCreation) && + GetFormat().HasDepthOrStencil() && (GetInternalUsage() & wgpu::TextureUsage::CopyDst); + if (applyForceClearCopyableDepthStencilTextureOnCreationToggle) { + AddInternalUsage(wgpu::TextureUsage::RenderAttachment); + } + // This will need to be much more nuanced when WebGPU has // texture view compatibility rules. - const bool needsTypelessFormat = GetFormat().HasDepthOrStencil() && - (GetInternalUsage() & wgpu::TextureUsage::TextureBinding) != 0; + const bool needsTypelessFormat = + (GetDevice()->IsToggleEnabled(Toggle::D3D12AlwaysUseTypelessFormatsForCastableTexture) && + GetViewFormats().any()) || + (GetFormat().HasDepthOrStencil() && + (GetInternalUsage() & wgpu::TextureUsage::TextureBinding) != 0); DXGI_FORMAT dxgiFormat = needsTypelessFormat ? D3D12TypelessTextureFormat(GetFormat().format) : D3D12TextureFormat(GetFormat().format); @@ -591,18 +605,20 @@ MaybeError Texture::InitializeAsInternalTexture() { resourceDescriptor.SampleDesc.Count = GetSampleCount(); resourceDescriptor.SampleDesc.Quality = 0; resourceDescriptor.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; - resourceDescriptor.Flags = - D3D12ResourceFlags(GetInternalUsage(), GetFormat(), IsMultisampledTexture()); + resourceDescriptor.Flags = D3D12ResourceFlags(GetInternalUsage(), GetFormat()); mD3D12ResourceFlags = resourceDescriptor.Flags; DAWN_TRY_ASSIGN(mResourceAllocation, - ToBackend(GetDevice()) - ->AllocateMemory(D3D12_HEAP_TYPE_DEFAULT, resourceDescriptor, - D3D12_RESOURCE_STATE_COMMON)); + device->AllocateMemory(D3D12_HEAP_TYPE_DEFAULT, resourceDescriptor, + D3D12_RESOURCE_STATE_COMMON)); SetLabelImpl(); - Device* device = ToBackend(GetDevice()); + if (applyForceClearCopyableDepthStencilTextureOnCreationToggle) { + CommandRecordingContext* commandContext; + DAWN_TRY_ASSIGN(commandContext, device->GetPendingCommandContext()); + DAWN_TRY(ClearTexture(commandContext, GetAllSubresources(), TextureBase::ClearValue::Zero)); + } if (device->IsToggleEnabled(Toggle::NonzeroClearResourcesOnCreationForTesting)) { CommandRecordingContext* commandContext; @@ -663,9 +679,23 @@ void Texture::DestroyImpl() { // ID3D12SharingContract::Present. mSwapChainTexture = false; - // Now that the texture has been destroyed. It should release the refptr - // of the d3d11on12 resource. + // Signal the fence on destroy after all uses of the texture. + if (mD3D12Fence != nullptr && mFenceSignalValue != 0) { + // Enqueue a fence wait if we haven't already; otherwise the fence signal will be racy. + if (mFenceWaitValue != UINT64_MAX) { + device->ConsumedError( + CheckHRESULT(device->GetCommandQueue()->Wait(mD3D12Fence.Get(), mFenceWaitValue), + "D3D12 fence wait")); + } + device->ConsumedError( + CheckHRESULT(device->GetCommandQueue()->Signal(mD3D12Fence.Get(), mFenceSignalValue), + "D3D12 fence signal")); + } + + // Now that the texture has been destroyed. It should release the refptr of the d3d11on12 + // resource and the fence. mD3D11on12Resource = nullptr; + mD3D12Fence = nullptr; } DXGI_FORMAT Texture::GetD3D12Format() const { @@ -676,11 +706,14 @@ ID3D12Resource* Texture::GetD3D12Resource() const { return mResourceAllocation.GetD3D12Resource(); } +D3D12_RESOURCE_FLAGS Texture::GetD3D12ResourceFlags() const { + return mD3D12ResourceFlags; +} + DXGI_FORMAT Texture::GetD3D12CopyableSubresourceFormat(Aspect aspect) const { ASSERT(GetFormat().aspects & aspect); switch (GetFormat().format) { - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: case wgpu::TextureFormat::Stencil8: @@ -698,14 +731,27 @@ DXGI_FORMAT Texture::GetD3D12CopyableSubresourceFormat(Aspect aspect) const { } } -MaybeError Texture::AcquireKeyedMutex() { - ASSERT(mD3D11on12Resource != nullptr); - return mD3D11on12Resource->AcquireKeyedMutex(); +MaybeError Texture::SynchronizeImportedTextureBeforeUse() { + if (mD3D11on12Resource != nullptr) { + DAWN_TRY(mD3D11on12Resource->AcquireKeyedMutex()); + } + // Perform the wait only on the first call. We can use UINT64_MAX as a sentinel value since it's + // also used by the D3D runtime to indicate device removed according to: + // https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12fence-getcompletedvalue#return-value + if (mD3D12Fence != nullptr && mFenceWaitValue != UINT64_MAX) { + DAWN_TRY(CheckHRESULT( + ToBackend(GetDevice())->GetCommandQueue()->Wait(mD3D12Fence.Get(), mFenceWaitValue), + "D3D12 fence wait")); + mFenceWaitValue = UINT64_MAX; + } + return {}; } -void Texture::ReleaseKeyedMutex() { - ASSERT(mD3D11on12Resource != nullptr); - mD3D11on12Resource->ReleaseKeyedMutex(); +void Texture::SynchronizeImportedTextureAfterUse() { + if (mD3D11on12Resource != nullptr) { + mD3D11on12Resource->ReleaseKeyedMutex(); + } + // Defer signaling the fence until destroy after all uses of the fence. } void Texture::TrackUsageAndTransitionNow(CommandRecordingContext* commandContext, @@ -804,7 +850,7 @@ void Texture::TransitionSubresourceRange(std::vector* ba // non-simultaneous-access texture: NON_PIXEL_SHADER_RESOURCE, // PIXEL_SHADER_RESOURCE, COPY_SRC, COPY_DEST. { - static constexpr D3D12_RESOURCE_STATES kD3D12PromotableReadOnlyStates = + const D3D12_RESOURCE_STATES kD3D12PromotableReadOnlyStates = D3D12_RESOURCE_STATE_COPY_SOURCE | D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE | D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE; @@ -856,10 +902,10 @@ void Texture::TransitionSubresourceRange(std::vector* ba } void Texture::HandleTransitionSpecialCases(CommandRecordingContext* commandContext) { - // Textures with keyed mutexes can be written from other graphics queues. Hence, they - // must be acquired before command list submission to ensure work from the other queues - // has finished. See Device::ExecuteCommandContext. - if (mD3D11on12Resource != nullptr) { + // Externally allocated textures can be written from other graphics queues. Hence, they must be + // acquired before command list submission to ensure work from the other queues has finished. + // See CommandRecordingContext::ExecuteCommandList. + if (mResourceAllocation.GetInfo().mMethod == AllocationMethod::kExternal) { commandContext->AddToSharedTextureList(this); } } @@ -1080,13 +1126,15 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* commandContext, } } } else { + ASSERT(!IsMultisampledTexture()); + // create temp buffer with clear color to copy to the texture image TrackUsageAndTransitionNow(commandContext, D3D12_RESOURCE_STATE_COPY_DEST, range); for (Aspect aspect : IterateEnumMask(range.aspects)) { const TexelBlockInfo& blockInfo = GetFormat().GetAspectInfo(aspect).block; - Extent3D largestMipSize = GetMipLevelPhysicalSize(range.baseMipLevel); + Extent3D largestMipSize = GetMipLevelSingleSubresourcePhysicalSize(range.baseMipLevel); uint32_t bytesPerRow = Align((largestMipSize.width / blockInfo.width) * blockInfo.byteSize, @@ -1103,7 +1151,7 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* commandContext, for (uint32_t level = range.baseMipLevel; level < range.baseMipLevel + range.levelCount; ++level) { // compute d3d12 texture copy locations for texture and buffer - Extent3D copySize = GetMipLevelPhysicalSize(level); + Extent3D copySize = GetMipLevelSingleSubresourcePhysicalSize(level); for (uint32_t layer = range.baseArrayLayer; layer < range.baseArrayLayer + range.layerCount; ++layer) { @@ -1122,7 +1170,8 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* commandContext, RecordBufferTextureCopyWithBufferHandle( BufferTextureCopyDirection::B2T, commandList, ToBackend(uploadHandle.stagingBuffer)->GetResource(), - uploadHandle.startOffset, bytesPerRow, GetHeight(), textureCopy, copySize); + uploadHandle.startOffset, bytesPerRow, largestMipSize.height, textureCopy, + copySize); } } } @@ -1185,8 +1234,7 @@ TextureView::TextureView(TextureBase* texture, const TextureViewDescriptor* desc case wgpu::TextureFormat::Depth16Unorm: mSrvDesc.Format = DXGI_FORMAT_R16_UNORM; break; - case wgpu::TextureFormat::Stencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: { + case wgpu::TextureFormat::Stencil8: { Aspect aspects = SelectFormatAspects(textureFormat, descriptor->aspect); ASSERT(aspects != Aspect::None); if (!HasZeroOrOneBits(aspects)) { diff --git a/src/dawn/native/d3d12/TextureD3D12.h b/src/dawn/native/d3d12/TextureD3D12.h index 05b80db12b..3e49bc232b 100644 --- a/src/dawn/native/d3d12/TextureD3D12.h +++ b/src/dawn/native/d3d12/TextureD3D12.h @@ -45,7 +45,10 @@ class Texture final : public TextureBase { Device* device, const TextureDescriptor* descriptor, ComPtr d3d12Texture, + ComPtr d3d12Fence, Ref d3d11on12Resource, + uint64_t fenceWaitValue, + uint64_t fenceSignalValue, bool isSwapChainTexture, bool isInitialized); static ResultOrError> Create(Device* device, @@ -55,6 +58,7 @@ class Texture final : public TextureBase { DXGI_FORMAT GetD3D12Format() const; ID3D12Resource* GetD3D12Resource() const; DXGI_FORMAT GetD3D12CopyableSubresourceFormat(Aspect aspect) const; + D3D12_RESOURCE_FLAGS GetD3D12ResourceFlags() const; D3D12_RENDER_TARGET_VIEW_DESC GetRTVDescriptor(const Format& format, uint32_t mipLevel, @@ -70,8 +74,8 @@ class Texture final : public TextureBase { void EnsureSubresourceContentInitialized(CommandRecordingContext* commandContext, const SubresourceRange& range); - MaybeError AcquireKeyedMutex(); - void ReleaseKeyedMutex(); + MaybeError SynchronizeImportedTextureBeforeUse(); + void SynchronizeImportedTextureAfterUse(); void TrackUsageAndGetResourceBarrierForPass(CommandRecordingContext* commandContext, std::vector* barrier, @@ -97,9 +101,11 @@ class Texture final : public TextureBase { using TextureBase::TextureBase; MaybeError InitializeAsInternalTexture(); - MaybeError InitializeAsExternalTexture(const TextureDescriptor* descriptor, - ComPtr d3d12Texture, + MaybeError InitializeAsExternalTexture(ComPtr d3d12Texture, + ComPtr d3d12Fence, Ref d3d11on12Resource, + uint64_t fenceWaitValue, + uint64_t fenceSignalValue, bool isSwapChainTexture); MaybeError InitializeAsSwapChainTexture(ComPtr d3d12Texture); @@ -132,13 +138,17 @@ class Texture final : public TextureBase { ExecutionSerial pendingCommandSerial) const; void HandleTransitionSpecialCases(CommandRecordingContext* commandContext); - SubresourceStorage mSubresourceStateAndDecay; - - ResourceHeapAllocation mResourceAllocation; - bool mSwapChainTexture = false; D3D12_RESOURCE_FLAGS mD3D12ResourceFlags; + ResourceHeapAllocation mResourceAllocation; + // TODO(dawn:1460): Encapsulate imported image fields e.g. std::unique_ptr. + ComPtr mD3D12Fence; Ref mD3D11on12Resource; + uint64_t mFenceWaitValue = 0; + uint64_t mFenceSignalValue = 0; + bool mSwapChainTexture = false; + + SubresourceStorage mSubresourceStateAndDecay; }; class TextureView final : public TextureViewBase { diff --git a/src/dawn/native/d3d12/UtilsD3D12.cpp b/src/dawn/native/d3d12/UtilsD3D12.cpp index 0833e01a88..e706d8f658 100644 --- a/src/dawn/native/d3d12/UtilsD3D12.cpp +++ b/src/dawn/native/d3d12/UtilsD3D12.cpp @@ -81,19 +81,19 @@ bool NeedBufferSizeWorkaroundForBufferTextureCopyOnD3D12(const BufferCopy& buffe } // anonymous namespace -ResultOrError ConvertStringToWstring(const char* str) { - size_t len = strlen(str); +ResultOrError ConvertStringToWstring(std::string_view s) { + size_t len = s.length(); if (len == 0) { return std::wstring(); } - int numChars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, len, nullptr, 0); + int numChars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), len, nullptr, 0); if (numChars == 0) { return DAWN_INTERNAL_ERROR("Failed to convert string to wide string"); } std::wstring result; result.resize(numChars); int numConvertedChars = - MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, len, &result[0], numChars); + MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), len, &result[0], numChars); if (numConvertedChars != numChars) { return DAWN_INTERNAL_ERROR("Failed to convert string to wide string"); } @@ -386,4 +386,8 @@ void SetDebugName(Device* device, ID3D12Object* object, const char* prefix, std: object->SetPrivateData(WKPDID_D3DDebugObjectName, objectName.length(), objectName.c_str()); } +uint64_t MakeDXCVersion(uint64_t majorVersion, uint64_t minorVersion) { + return (majorVersion << 32) + minorVersion; +} + } // namespace dawn::native::d3d12 diff --git a/src/dawn/native/d3d12/UtilsD3D12.h b/src/dawn/native/d3d12/UtilsD3D12.h index 0bc5afb0cd..dcbe782cbe 100644 --- a/src/dawn/native/d3d12/UtilsD3D12.h +++ b/src/dawn/native/d3d12/UtilsD3D12.h @@ -26,7 +26,7 @@ namespace dawn::native::d3d12 { -ResultOrError ConvertStringToWstring(const char* str); +ResultOrError ConvertStringToWstring(std::string_view s); D3D12_COMPARISON_FUNC ToD3D12ComparisonFunc(wgpu::CompareFunction func); @@ -68,6 +68,8 @@ void RecordBufferTextureCopy(BufferTextureCopyDirection direction, void SetDebugName(Device* device, ID3D12Object* object, const char* prefix, std::string label = ""); +uint64_t MakeDXCVersion(uint64_t majorVersion, uint64_t minorVersion); + } // namespace dawn::native::d3d12 #endif // SRC_DAWN_NATIVE_D3D12_UTILSD3D12_H_ diff --git a/src/dawn/native/metal/BackendMTL.h b/src/dawn/native/metal/BackendMTL.h index fe6908fdd8..75be73040e 100644 --- a/src/dawn/native/metal/BackendMTL.h +++ b/src/dawn/native/metal/BackendMTL.h @@ -24,6 +24,7 @@ namespace dawn::native::metal { class Backend : public BackendConnection { public: explicit Backend(InstanceBase* instance); + ~Backend() override; std::vector> DiscoverDefaultAdapters() override; ResultOrError>> DiscoverAdapters( diff --git a/src/dawn/native/metal/BackendMTL.mm b/src/dawn/native/metal/BackendMTL.mm index 8b5c35bb2d..278f48d320 100644 --- a/src/dawn/native/metal/BackendMTL.mm +++ b/src/dawn/native/metal/BackendMTL.mm @@ -25,7 +25,7 @@ #include "dawn/native/metal/BufferMTL.h" #include "dawn/native/metal/DeviceMTL.h" -#if defined(DAWN_PLATFORM_MACOS) +#if DAWN_PLATFORM_IS(MACOS) #import #include "dawn/common/IOKitRef.h" #endif @@ -46,12 +46,11 @@ struct Vendor { uint32_t vendorId; }; -#if defined(DAWN_PLATFORM_MACOS) -const Vendor kVendors[] = {{"AMD", gpu_info::kVendorID_AMD}, - {"Radeon", gpu_info::kVendorID_AMD}, - {"Intel", gpu_info::kVendorID_Intel}, - {"Geforce", gpu_info::kVendorID_Nvidia}, - {"Quadro", gpu_info::kVendorID_Nvidia}}; +#if DAWN_PLATFORM_IS(MACOS) +const Vendor kVendors[] = { + {"AMD", gpu_info::kVendorID_AMD}, {"Apple", gpu_info::kVendorID_Apple}, + {"Radeon", gpu_info::kVendorID_AMD}, {"Intel", gpu_info::kVendorID_Intel}, + {"Geforce", gpu_info::kVendorID_Nvidia}, {"Quadro", gpu_info::kVendorID_Nvidia}}; // Find vendor ID from MTLDevice name. MaybeError GetVendorIdFromVendors(id device, PCIIDs* ids) { @@ -147,28 +146,26 @@ MaybeError GetDevicePCIInfo(id device, PCIIDs* ids) { // [device registryID] is introduced on macOS 10.13+, otherwise workaround to get vendor // id by vendor name on old macOS if (@available(macos 10.13, *)) { - return GetDeviceIORegistryPCIInfo(device, ids); - } else { - return GetVendorIdFromVendors(device, ids); + auto result = GetDeviceIORegistryPCIInfo(device, ids); + if (result.IsError()) { + dawn::WarningLog() << "GetDeviceIORegistryPCIInfo failed: " + << result.AcquireError()->GetFormattedMessage(); + } else if (ids->vendorId != 0) { + return result; + } } + + return GetVendorIdFromVendors(device, ids); } -bool IsMetalSupported() { - // Metal was first introduced in macOS 10.11 - // WebGPU is targeted at macOS 10.12+ - // TODO(dawn:1181): Dawn native should allow non-conformant WebGPU on macOS 10.11 - return IsMacOSVersionAtLeast(10, 12); -} -#elif defined(DAWN_PLATFORM_IOS) +#elif DAWN_PLATFORM_IS(IOS) + MaybeError GetDevicePCIInfo(id device, PCIIDs* ids) { DAWN_UNUSED(device); *ids = PCIIDs{0, 0}; return {}; } -bool IsMetalSupported() { - return true; -} #else #error "Unsupported Apple platform." #endif @@ -277,10 +274,10 @@ class Adapter : public AdapterBase { mDeviceId = ids.deviceId; } -#if defined(DAWN_PLATFORM_IOS) +#if DAWN_PLATFORM_IS(IOS) mAdapterType = wgpu::AdapterType::IntegratedGPU; const char* systemName = "iOS "; -#elif defined(DAWN_PLATFORM_MACOS) +#elif DAWN_PLATFORM_IS(MACOS) if ([device isLowPower]) { mAdapterType = wgpu::AdapterType::IntegratedGPU; } else { @@ -310,12 +307,12 @@ class Adapter : public AdapterBase { MaybeError InitializeSupportedFeaturesImpl() override { // Check compressed texture format with deprecated MTLFeatureSet way. -#if defined(DAWN_PLATFORM_MACOS) +#if DAWN_PLATFORM_IS(MACOS) if ([*mDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) { mSupportedFeatures.EnableFeature(Feature::TextureCompressionBC); } #endif -#if defined(DAWN_PLATFORM_IOS) && !defined(DAWN_PLATFORM_TVOS) +#if DAWN_PLATFORM_IS(IOS) && !DAWN_PLATFORM_IS(TVOS) if ([*mDevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v1]) { mSupportedFeatures.EnableFeature(Feature::TextureCompressionETC2); } @@ -350,7 +347,7 @@ class Adapter : public AdapterBase { {MTLCommonCounterTimestamp})) { bool enableTimestampQuery = true; -#if defined(DAWN_PLATFORM_MACOS) +#if DAWN_PLATFORM_IS(MACOS) // Disable timestamp query on < macOS 11.0 on AMD GPU because WriteTimestamp // fails to call without any copy commands on MTLBlitCommandEncoder. This issue // has been fixed on macOS 11.0. See crbug.com/dawn/545. @@ -366,7 +363,7 @@ class Adapter : public AdapterBase { } if (@available(macOS 10.11, iOS 11.0, *)) { - mSupportedFeatures.EnableFeature(Feature::DepthClamping); + mSupportedFeatures.EnableFeature(Feature::DepthClipControl); } if (@available(macOS 10.11, iOS 9.0, *)) { @@ -379,16 +376,38 @@ class Adapter : public AdapterBase { mSupportedFeatures.EnableFeature(Feature::MultiPlanarFormats); } -#if defined(DAWN_PLATFORM_MACOS) - // MTLPixelFormatDepth24Unorm_Stencil8 is only available on macOS 10.11+ - if ([*mDevice isDepth24Stencil8PixelFormatSupported]) { - mSupportedFeatures.EnableFeature(Feature::Depth24UnormStencil8); - } -#endif + mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance); return {}; } + void InitializeVendorArchitectureImpl() override { + if (@available(macOS 10.15, iOS 13.0, *)) { + // According to Apple's documentation: + // https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/detecting_gpu_features_and_metal_software_versions + // - "Use the Common family to create apps that target a range of GPUs on multiple + // platforms."" + // - "A GPU can be a member of more than one family; in most cases, a GPU supports one + // of the Common families and then one or more families specific to the build target." + // So we'll use the highest supported common family as the reported "architecture" on + // devices where a deviceID isn't available. + if (mDeviceId == 0) { + if ([*mDevice supportsFamily:MTLGPUFamilyCommon3]) { + mArchitectureName = "common-3"; + } else if ([*mDevice supportsFamily:MTLGPUFamilyCommon2]) { + mArchitectureName = "common-2"; + } else if ([*mDevice supportsFamily:MTLGPUFamilyCommon1]) { + mArchitectureName = "common-1"; + } + } + } + + mVendorName = gpu_info::GetVendorName(mVendorId); + if (mDeviceId != 0) { + mArchitectureName = gpu_info::GetArchitectureName(mVendorId, mDeviceId); + } + } + enum class MTLGPUFamily { Apple1, Apple2, @@ -404,7 +423,7 @@ class Adapter : public AdapterBase { ResultOrError GetMTLGPUFamily() const { // https://developer.apple.com/documentation/metal/mtldevice/detecting_gpu_features_and_metal_software_versions?language=objc -#if defined(DAWN_PLATFORM_TVOS) +#if DAWN_PLATFORM_IS(TVOS) if ([*mDevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]) { return MTLGPUFamily::Apple3; } @@ -449,10 +468,8 @@ class Adapter : public AdapterBase { return MTLGPUFamily::Mac2; } } - if (@available(macOS 10.11, *)) { - if ([*mDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) { - return MTLGPUFamily::Mac1; - } + if ([*mDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) { + return MTLGPUFamily::Mac1; } #elif TARGET_OS_IOS if (@available(iOS 10.11, *)) { @@ -493,6 +510,7 @@ class Adapter : public AdapterBase { uint32_t max3DTextureSize; uint32_t maxTextureArrayLayers; uint32_t minBufferOffsetAlignment; + uint32_t maxColorRenderTargets; }; struct LimitsForFamily { @@ -504,7 +522,7 @@ class Adapter : public AdapterBase { // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf // Apple Mac // 1, 2, 3, 4, 5, 6, 7, 1, 2 - constexpr LimitsForFamily kMTLLimits[12] = { + constexpr LimitsForFamily kMTLLimits[13] = { {&MTLDeviceLimits::maxVertexAttribsPerDescriptor, { 31u, 31u, 31u, 31u, 31u, 31u, 31u, 31u, 31u }}, {&MTLDeviceLimits::maxBufferArgumentEntriesPerFunc, { 31u, 31u, 31u, 31u, 31u, 31u, 31u, 31u, 31u }}, {&MTLDeviceLimits::maxTextureArgumentEntriesPerFunc, { 31u, 31u, 31u, 96u, 96u, 128u, 128u, 128u, 128u }}, @@ -517,6 +535,7 @@ class Adapter : public AdapterBase { {&MTLDeviceLimits::max3DTextureSize, { 2048u, 2048u, 2048u, 2048u, 2048u, 2048u, 2048u, 2048u, 2048u }}, {&MTLDeviceLimits::maxTextureArrayLayers, { 2048u, 2048u, 2048u, 2048u, 2048u, 2048u, 2048u, 2048u, 2048u }}, {&MTLDeviceLimits::minBufferOffsetAlignment, { 4u, 4u, 4u, 4u, 4u, 4u, 4u, 256u, 256u }}, + {&MTLDeviceLimits::maxColorRenderTargets, { 4u, 8u, 8u, 8u, 8u, 8u, 8u, 8u, 8u }}, }; // clang-format on @@ -534,6 +553,7 @@ class Adapter : public AdapterBase { limits->v1.maxTextureDimension2D = mtlLimits.max2DTextureSize; limits->v1.maxTextureDimension3D = mtlLimits.max3DTextureSize; limits->v1.maxTextureArrayLayers = mtlLimits.maxTextureArrayLayers; + limits->v1.maxColorAttachments = mtlLimits.maxColorRenderTargets; uint32_t maxBuffersPerStage = mtlLimits.maxBufferArgumentEntriesPerFunc; maxBuffersPerStage -= 1; // One slot is reserved to store buffer lengths. @@ -598,11 +618,14 @@ class Adapter : public AdapterBase { limits->v1.maxUniformBufferBindingSize = maxBufferSize; limits->v1.maxStorageBufferBindingSize = maxBufferSize; + // Using base limits for: // TODO(crbug.com/dawn/685): - // LIMITS NOT SET: // - maxBindGroups // - maxVertexBufferArrayStride + // TODO(crbug.com/dawn/1448): + // - maxInterStageShaderVariables + return {}; } @@ -617,6 +640,8 @@ Backend::Backend(InstanceBase* instance) : BackendConnection(instance, wgpu::Bac } } +Backend::~Backend() = default; + std::vector> Backend::DiscoverDefaultAdapters() { AdapterDiscoveryOptions options; auto result = DiscoverAdapters(&options); @@ -632,43 +657,30 @@ ResultOrError>> Backend::DiscoverAdapters( ASSERT(optionsBase->backendType == WGPUBackendType_Metal); std::vector> adapters; - BOOL supportedVersion = NO; -#if defined(DAWN_PLATFORM_MACOS) - if (@available(macOS 10.11, *)) { - supportedVersion = YES; +#if DAWN_PLATFORM_IS(MACOS) + NSRef>> devices = AcquireNSRef(MTLCopyAllDevices()); - NSRef>> devices = AcquireNSRef(MTLCopyAllDevices()); - - for (id device in devices.Get()) { - Ref adapter = AcquireRef(new Adapter(GetInstance(), device)); - if (!GetInstance()->ConsumedError(adapter->Initialize())) { - adapters.push_back(std::move(adapter)); - } - } - } -#endif - -#if defined(DAWN_PLATFORM_IOS) - if (@available(iOS 8.0, *)) { - supportedVersion = YES; - // iOS only has a single device so MTLCopyAllDevices doesn't exist there. - Ref adapter = - AcquireRef(new Adapter(GetInstance(), MTLCreateSystemDefaultDevice())); + for (id device in devices.Get()) { + Ref adapter = AcquireRef(new Adapter(GetInstance(), device)); if (!GetInstance()->ConsumedError(adapter->Initialize())) { adapters.push_back(std::move(adapter)); } } #endif - if (!supportedVersion) { - UNREACHABLE(); + + // iOS only has a single device so MTLCopyAllDevices doesn't exist there. +#if defined(DAWN_PLATFORM_IOS) + Ref adapter = + AcquireRef(new Adapter(GetInstance(), MTLCreateSystemDefaultDevice())); + if (!GetInstance()->ConsumedError(adapter->Initialize())) { + adapters.push_back(std::move(adapter)); } +#endif + return adapters; } BackendConnection* Connect(InstanceBase* instance) { - if (!IsMetalSupported()) { - return nullptr; - } return new Backend(instance); } diff --git a/src/dawn/native/metal/BindGroupLayoutMTL.h b/src/dawn/native/metal/BindGroupLayoutMTL.h index 97688eba8d..ab2abefc00 100644 --- a/src/dawn/native/metal/BindGroupLayoutMTL.h +++ b/src/dawn/native/metal/BindGroupLayoutMTL.h @@ -36,7 +36,7 @@ class BindGroupLayout final : public BindGroupLayoutBase { BindGroupLayout(DeviceBase* device, const BindGroupLayoutDescriptor* descriptor, PipelineCompatibilityToken pipelineCompatibilityToken); - ~BindGroupLayout() override = default; + ~BindGroupLayout() override; SlabAllocator mBindGroupAllocator; }; diff --git a/src/dawn/native/metal/BindGroupLayoutMTL.mm b/src/dawn/native/metal/BindGroupLayoutMTL.mm index 2f1012cd13..6c1a7acb3e 100644 --- a/src/dawn/native/metal/BindGroupLayoutMTL.mm +++ b/src/dawn/native/metal/BindGroupLayoutMTL.mm @@ -32,6 +32,8 @@ BindGroupLayout::BindGroupLayout(DeviceBase* device, : BindGroupLayoutBase(device, descriptor, pipelineCompatibilityToken), mBindGroupAllocator(MakeFrontendBindGroupAllocator(4096)) {} +BindGroupLayout::~BindGroupLayout() = default; + Ref BindGroupLayout::AllocateBindGroup(Device* device, const BindGroupDescriptor* descriptor) { return AcquireRef(mBindGroupAllocator.Allocate(device, descriptor)); diff --git a/src/dawn/native/metal/BufferMTL.h b/src/dawn/native/metal/BufferMTL.h index 096237b822..f36ebe8948 100644 --- a/src/dawn/native/metal/BufferMTL.h +++ b/src/dawn/native/metal/BufferMTL.h @@ -29,6 +29,9 @@ class Device; class Buffer final : public BufferBase { public: static ResultOrError> Create(Device* device, const BufferDescriptor* descriptor); + + Buffer(DeviceBase* device, const BufferDescriptor* descriptor); + id GetMTLBuffer() const; bool EnsureDataInitialized(CommandRecordingContext* commandContext); @@ -45,6 +48,7 @@ class Buffer final : public BufferBase { MaybeError Initialize(bool mappedAtCreation); ~Buffer() override; + MaybeError MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) override; void UnmapImpl() override; void DestroyImpl() override; diff --git a/src/dawn/native/metal/BufferMTL.mm b/src/dawn/native/metal/BufferMTL.mm index e8d74c1b2e..92a808841f 100644 --- a/src/dawn/native/metal/BufferMTL.mm +++ b/src/dawn/native/metal/BufferMTL.mm @@ -15,6 +15,7 @@ #include "dawn/native/metal/BufferMTL.h" #include "dawn/common/Math.h" +#include "dawn/common/Platform.h" #include "dawn/native/CommandBuffer.h" #include "dawn/native/metal/CommandRecordingContext.h" #include "dawn/native/metal/DeviceMTL.h" @@ -41,7 +42,7 @@ uint64_t Buffer::QueryMaxBufferLength(id mtlDevice) { // Earlier versions of Metal had maximums defined in the Metal feature set tables // https://metalbyexample.com/wp-content/uploads/Metal-Feature-Set-Tables-2018.pdf -#if defined(DAWN_PLATFORM_MACOS) +#if DAWN_PLATFORM_IS(MACOS) // 10.12 and 10.13 have a 1Gb limit. if (@available(macOS 10.12, *)) { // |maxBufferLength| isn't always available on older systems. If available, use @@ -50,15 +51,19 @@ uint64_t Buffer::QueryMaxBufferLength(id mtlDevice) { return 1024 * 1024 * 1024; } // 10.11 has a 256Mb limit - if (@available(maxOS 10.11, *)) { + if (@available(macOS 10.11, *)) { return 256 * 1024 * 1024; } + // 256Mb for other platform if any. (Need to have a return for all branches). + return 256 * 1024 * 1024; #else // macOS / tvOS: 256Mb limit in versions without [MTLDevice maxBufferLength] return 256 * 1024 * 1024; #endif } +Buffer::Buffer(DeviceBase* dev, const BufferDescriptor* desc) : BufferBase(dev, desc) {} + MaybeError Buffer::Initialize(bool mappedAtCreation) { MTLResourceOptions storageMode; if (GetUsage() & kMappableBufferUsages) { @@ -68,7 +73,7 @@ MaybeError Buffer::Initialize(bool mappedAtCreation) { } uint32_t alignment = 1; -#ifdef DAWN_PLATFORM_MACOS +#if DAWN_PLATFORM_IS(MACOS) // [MTLBlitCommandEncoder fillBuffer] requires the size to be a multiple of 4 on MacOS. alignment = 4; #endif diff --git a/src/dawn/native/metal/CommandBufferMTL.h b/src/dawn/native/metal/CommandBufferMTL.h index 8f7a9835c5..0f95ef4243 100644 --- a/src/dawn/native/metal/CommandBufferMTL.h +++ b/src/dawn/native/metal/CommandBufferMTL.h @@ -47,6 +47,9 @@ class CommandBuffer final : public CommandBufferBase { static Ref Create(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor); + CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor); + ~CommandBuffer() override; + MaybeError FillCommands(CommandRecordingContext* commandContext); private: diff --git a/src/dawn/native/metal/CommandBufferMTL.mm b/src/dawn/native/metal/CommandBufferMTL.mm index 121198f255..66a4569277 100644 --- a/src/dawn/native/metal/CommandBufferMTL.mm +++ b/src/dawn/native/metal/CommandBufferMTL.mm @@ -577,6 +577,11 @@ Ref CommandBuffer::Create(CommandEncoder* encoder, return AcquireRef(new CommandBuffer(encoder, descriptor)); } +CommandBuffer::CommandBuffer(CommandEncoder* enc, const CommandBufferDescriptor* desc) + : CommandBufferBase(enc, desc) {} + +CommandBuffer::~CommandBuffer() = default; + MaybeError CommandBuffer::FillCommands(CommandRecordingContext* commandContext) { size_t nextComputePassNumber = 0; size_t nextRenderPassNumber = 0; @@ -605,7 +610,12 @@ MaybeError CommandBuffer::FillCommands(CommandRecordingContext* commandContext) while (mCommands.NextCommandId(&type)) { switch (type) { case Command::BeginComputePass: { - mCommands.NextCommand(); + BeginComputePassCmd* cmd = mCommands.NextCommand(); + + if (cmd->beginTimestamp.querySet.Get() != nullptr || + cmd->endTimestamp.querySet.Get() != nullptr) { + return DAWN_UNIMPLEMENTED_ERROR("timestampWrites unimplemented."); + } for (const SyncScopeResourceUsage& scope : GetResourceUsages().computePasses[nextComputePassNumber].dispatchUsages) { @@ -622,6 +632,11 @@ MaybeError CommandBuffer::FillCommands(CommandRecordingContext* commandContext) case Command::BeginRenderPass: { BeginRenderPassCmd* cmd = mCommands.NextCommand(); + if (cmd->beginTimestamp.querySet.Get() != nullptr || + cmd->endTimestamp.querySet.Get() != nullptr) { + return DAWN_UNIMPLEMENTED_ERROR("timestampWrites unimplemented."); + } + LazyClearSyncScope(GetResourceUsages().renderPasses[nextRenderPassNumber], commandContext); commandContext->EndBlit(); @@ -1237,7 +1252,7 @@ MaybeError CommandBuffer::EncodeRenderPass(id encoder) slopeScale:newPipeline->GetDepthBiasSlopeScale() clamp:newPipeline->GetDepthBiasClamp()]; if (@available(macOS 10.11, iOS 11.0, *)) { - MTLDepthClipMode clipMode = newPipeline->ShouldClampDepth() + MTLDepthClipMode clipMode = newPipeline->HasUnclippedDepth() ? MTLDepthClipModeClamp : MTLDepthClipModeClip; [encoder setDepthClipMode:clipMode]; diff --git a/src/dawn/native/metal/ComputePipelineMTL.h b/src/dawn/native/metal/ComputePipelineMTL.h index 22ac6356f0..48a723dabf 100644 --- a/src/dawn/native/metal/ComputePipelineMTL.h +++ b/src/dawn/native/metal/ComputePipelineMTL.h @@ -35,6 +35,9 @@ class ComputePipeline final : public ComputePipelineBase { WGPUCreateComputePipelineAsyncCallback callback, void* userdata); + ComputePipeline(DeviceBase* device, const ComputePipelineDescriptor* descriptor); + ~ComputePipeline() override; + void Encode(id encoder); MTLSize GetLocalWorkGroupSize() const; bool RequiresStorageBufferLength() const; diff --git a/src/dawn/native/metal/ComputePipelineMTL.mm b/src/dawn/native/metal/ComputePipelineMTL.mm index f350071c8e..855cd7b4bf 100644 --- a/src/dawn/native/metal/ComputePipelineMTL.mm +++ b/src/dawn/native/metal/ComputePipelineMTL.mm @@ -29,6 +29,11 @@ Ref ComputePipeline::CreateUninitialized( return AcquireRef(new ComputePipeline(device, descriptor)); } +ComputePipeline::ComputePipeline(DeviceBase* dev, const ComputePipelineDescriptor* desc) + : ComputePipelineBase(dev, desc) {} + +ComputePipeline::~ComputePipeline() = default; + MaybeError ComputePipeline::Initialize() { auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice(); diff --git a/src/dawn/native/metal/DeviceMTL.mm b/src/dawn/native/metal/DeviceMTL.mm index 383662b1c8..f3ee299572 100644 --- a/src/dawn/native/metal/DeviceMTL.mm +++ b/src/dawn/native/metal/DeviceMTL.mm @@ -158,33 +158,33 @@ MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { void Device::InitTogglesFromDriver() { { bool haveStoreAndMSAAResolve = false; -#if defined(DAWN_PLATFORM_MACOS) +#if DAWN_PLATFORM_IS(MACOS) if (@available(macOS 10.12, *)) { haveStoreAndMSAAResolve = [*mMtlDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v2]; } -#elif defined(DAWN_PLATFORM_TVOS) +#elif DAWN_PLATFORM_IS(TVOS) haveStoreAndMSAAResolve = [*mMtlDevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]; -#elif defined(DAWN_PLATFORM_IOS) +#elif DAWN_PLATFORM_IS(IOS) haveStoreAndMSAAResolve = [*mMtlDevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v2]; #endif // On tvOS, we would need MTLFeatureSet_tvOS_GPUFamily2_v1. SetToggle(Toggle::EmulateStoreAndMSAAResolve, !haveStoreAndMSAAResolve); bool haveSamplerCompare = true; -#if defined(DAWN_PLATFORM_TVOS) +#if DAWN_PLATFORM_IS(TVOS) haveSamplerCompare = [*mMtlDevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]; -#elif defined(DAWN_PLATFORM_IOS) +#elif DAWN_PLATFORM_IS(IOS) haveSamplerCompare = [*mMtlDevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]; #endif // TODO(crbug.com/dawn/342): Investigate emulation -- possibly expensive. SetToggle(Toggle::MetalDisableSamplerCompare, !haveSamplerCompare); bool haveBaseVertexBaseInstance = true; -#if defined(DAWN_PLATFORM_TVOS) +#if DAWN_PLATFORM_IS(TVOS) haveBaseVertexBaseInstance = [*mMtlDevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]; -#elif defined(DAWN_PLATFORM_IOS) +#elif DAWN_PLATFORM_IS(IOS) haveBaseVertexBaseInstance = [*mMtlDevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]; #endif @@ -219,7 +219,7 @@ void Device::InitTogglesFromDriver() { SetToggle(Toggle::MetalRenderR8RG8UnormSmallMipToTempTexture, true); } - // On some Intel GPU vertex only render pipeline get wrong depth result if no fragment + // On some Intel GPUs vertex only render pipeline get wrong depth result if no fragment // shader provided. Create a placeholder fragment shader module to work around this issue. if (gpu_info::IsIntel(vendorId)) { bool usePlaceholderFragmentShader = true; @@ -228,6 +228,14 @@ void Device::InitTogglesFromDriver() { } SetToggle(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline, usePlaceholderFragmentShader); } + + // On some Intel GPUs using big integer values as clear values in render pass doesn't work + // correctly. Currently we have to add workaround for this issue by enabling the toggle + // "apply_clear_big_integer_color_value_with_draw". See https://crbug.com/dawn/1109 and + // https://crbug.com/dawn/1463 for more details. + if (gpu_info::IsIntel(vendorId)) { + SetToggle(Toggle::ApplyClearBigIntegerColorValueWithDraw, true); + } } ResultOrError> Device::CreateBindGroupImpl( @@ -302,13 +310,18 @@ void Device::InitializeRenderPipelineAsyncImpl(Ref renderPip ResultOrError Device::CheckAndUpdateCompletedSerials() { uint64_t frontendCompletedSerial{GetCompletedCommandSerial()}; - if (frontendCompletedSerial > mCompletedSerial) { - // sometimes we increase the serials, in which case the completed serial in - // the device base will surpass the completed serial we have in the metal backend, so we - // must update ours when we see that the completed serial from device base has - // increased. - mCompletedSerial = frontendCompletedSerial; + // sometimes we increase the serials, in which case the completed serial in + // the device base will surpass the completed serial we have in the metal backend, so we + // must update ours when we see that the completed serial from device base has + // increased. + // + // This update has to be atomic otherwise there is a race with the `addCompletedHandler` + // call below and this call could set the mCompletedSerial backwards. + uint64_t current = mCompletedSerial.load(); + while (frontendCompletedSerial > current && + !mCompletedSerial.compare_exchange_weak(current, frontendCompletedSerial)) { } + return ExecutionSerial(mCompletedSerial.load()); } diff --git a/src/dawn/native/metal/MetalBackend.mm b/src/dawn/native/metal/MetalBackend.mm index f6cbbdce74..d4140205bb 100644 --- a/src/dawn/native/metal/MetalBackend.mm +++ b/src/dawn/native/metal/MetalBackend.mm @@ -22,10 +22,6 @@ namespace dawn::native::metal { -id GetMetalDevice(WGPUDevice device) { - return ToBackend(FromAPI(device))->GetMTLDevice(); -} - AdapterDiscoveryOptions::AdapterDiscoveryOptions() : AdapterDiscoveryOptionsBase(WGPUBackendType_Metal) {} diff --git a/src/dawn/native/metal/PipelineLayoutMTL.h b/src/dawn/native/metal/PipelineLayoutMTL.h index 16519543a1..48711e7693 100644 --- a/src/dawn/native/metal/PipelineLayoutMTL.h +++ b/src/dawn/native/metal/PipelineLayoutMTL.h @@ -51,7 +51,7 @@ class PipelineLayout final : public PipelineLayoutBase { private: PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor); - ~PipelineLayout() override = default; + ~PipelineLayout() override; PerStage mIndexInfo; PerStage mBufferBindingCount; }; diff --git a/src/dawn/native/metal/PipelineLayoutMTL.mm b/src/dawn/native/metal/PipelineLayoutMTL.mm index 2dfad2e059..800db51a7c 100644 --- a/src/dawn/native/metal/PipelineLayoutMTL.mm +++ b/src/dawn/native/metal/PipelineLayoutMTL.mm @@ -70,6 +70,8 @@ PipelineLayout::PipelineLayout(Device* device, const PipelineLayoutDescriptor* d } } +PipelineLayout::~PipelineLayout() = default; + const PipelineLayout::BindingIndexInfo& PipelineLayout::GetBindingIndexInfo( SingleShaderStage stage) const { return mIndexInfo[stage]; diff --git a/src/dawn/native/metal/QuerySetMTL.h b/src/dawn/native/metal/QuerySetMTL.h index 9f0e6bb605..c8b4c73afa 100644 --- a/src/dawn/native/metal/QuerySetMTL.h +++ b/src/dawn/native/metal/QuerySetMTL.h @@ -30,15 +30,18 @@ class QuerySet final : public QuerySetBase { static ResultOrError> Create(Device* device, const QuerySetDescriptor* descriptor); + QuerySet(DeviceBase* device, const QuerySetDescriptor* descriptor); + id GetVisibilityBuffer() const; id GetCounterSampleBuffer() const API_AVAILABLE(macos(10.15), ios(14.0)); private: - ~QuerySet() override; using QuerySetBase::QuerySetBase; MaybeError Initialize(); + ~QuerySet() override; + // Dawn API void DestroyImpl() override; diff --git a/src/dawn/native/metal/QuerySetMTL.mm b/src/dawn/native/metal/QuerySetMTL.mm index 2e8fec8102..80cddc72c3 100644 --- a/src/dawn/native/metal/QuerySetMTL.mm +++ b/src/dawn/native/metal/QuerySetMTL.mm @@ -68,6 +68,8 @@ ResultOrError> QuerySet::Create(Device* device, return queryset; } +QuerySet::QuerySet(DeviceBase* dev, const QuerySetDescriptor* desc) : QuerySetBase(dev, desc) {} + MaybeError QuerySet::Initialize() { Device* device = ToBackend(GetDevice()); diff --git a/src/dawn/native/metal/QueueMTL.h b/src/dawn/native/metal/QueueMTL.h index e1a37b97f9..5f95921916 100644 --- a/src/dawn/native/metal/QueueMTL.h +++ b/src/dawn/native/metal/QueueMTL.h @@ -24,6 +24,7 @@ class Device; class Queue final : public QueueBase { public: Queue(Device* device, const QueueDescriptor* descriptor); + ~Queue() override; private: MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override; diff --git a/src/dawn/native/metal/QueueMTL.mm b/src/dawn/native/metal/QueueMTL.mm index c129c5d51d..f6cfa4cdf5 100644 --- a/src/dawn/native/metal/QueueMTL.mm +++ b/src/dawn/native/metal/QueueMTL.mm @@ -28,6 +28,8 @@ namespace dawn::native::metal { Queue::Queue(Device* device, const QueueDescriptor* descriptor) : QueueBase(device, descriptor) {} +Queue::~Queue() = default; + MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) { Device* device = ToBackend(GetDevice()); diff --git a/src/dawn/native/metal/RenderPipelineMTL.h b/src/dawn/native/metal/RenderPipelineMTL.h index cd8111dff7..23268aea03 100644 --- a/src/dawn/native/metal/RenderPipelineMTL.h +++ b/src/dawn/native/metal/RenderPipelineMTL.h @@ -33,6 +33,9 @@ class RenderPipeline final : public RenderPipelineBase { WGPUCreateRenderPipelineAsyncCallback callback, void* userdata); + RenderPipeline(DeviceBase* device, const RenderPipelineDescriptor* descriptor); + ~RenderPipeline() override; + MTLPrimitiveType GetMTLPrimitiveTopology() const; MTLWinding GetMTLFrontFace() const; MTLCullMode GetMTLCullMode() const; diff --git a/src/dawn/native/metal/RenderPipelineMTL.mm b/src/dawn/native/metal/RenderPipelineMTL.mm index 2e10ed999c..6e5afd54fe 100644 --- a/src/dawn/native/metal/RenderPipelineMTL.mm +++ b/src/dawn/native/metal/RenderPipelineMTL.mm @@ -98,6 +98,8 @@ MTLVertexStepFunction VertexStepModeFunction(wgpu::VertexStepMode mode) { return MTLVertexStepFunctionPerVertex; case wgpu::VertexStepMode::Instance: return MTLVertexStepFunctionPerInstance; + case wgpu::VertexStepMode::VertexBufferNotUsed: + UNREACHABLE(); } } @@ -310,6 +312,11 @@ Ref RenderPipeline::CreateUninitialized( return AcquireRef(new RenderPipeline(device, descriptor)); } +RenderPipeline::RenderPipeline(DeviceBase* dev, const RenderPipelineDescriptor* desc) + : RenderPipelineBase(dev, desc) {} + +RenderPipeline::~RenderPipeline() = default; + MaybeError RenderPipeline::Initialize() { mMtlPrimitiveTopology = MTLPrimitiveTopology(GetPrimitiveTopology()); mMtlFrontFace = MTLFrontFace(GetFrontFace()); diff --git a/src/dawn/native/metal/SamplerMTL.h b/src/dawn/native/metal/SamplerMTL.h index 2960817cd9..fb7b1fcb90 100644 --- a/src/dawn/native/metal/SamplerMTL.h +++ b/src/dawn/native/metal/SamplerMTL.h @@ -29,6 +29,9 @@ class Sampler final : public SamplerBase { public: static ResultOrError> Create(Device* device, const SamplerDescriptor* descriptor); + Sampler(DeviceBase* device, const SamplerDescriptor* descriptor); + ~Sampler() override; + id GetMTLSamplerState(); private: diff --git a/src/dawn/native/metal/SamplerMTL.mm b/src/dawn/native/metal/SamplerMTL.mm index 329cd28848..97b3046511 100644 --- a/src/dawn/native/metal/SamplerMTL.mm +++ b/src/dawn/native/metal/SamplerMTL.mm @@ -64,6 +64,10 @@ ResultOrError> Sampler::Create(Device* device, const SamplerDescrip return sampler; } +Sampler::Sampler(DeviceBase* dev, const SamplerDescriptor* desc) : SamplerBase(dev, desc) {} + +Sampler::~Sampler() = default; + MaybeError Sampler::Initialize(const SamplerDescriptor* descriptor) { NSRef mtlDescRef = AcquireNSRef([MTLSamplerDescriptor new]); MTLSamplerDescriptor* mtlDesc = mtlDescRef.Get(); diff --git a/src/dawn/native/metal/ShaderModuleMTL.h b/src/dawn/native/metal/ShaderModuleMTL.h index dc0ea0bbf4..27f1def213 100644 --- a/src/dawn/native/metal/ShaderModuleMTL.h +++ b/src/dawn/native/metal/ShaderModuleMTL.h @@ -55,17 +55,8 @@ class ShaderModule final : public ShaderModuleBase { const RenderPipeline* renderPipeline = nullptr); private: - ResultOrError TranslateToMSL(const char* entryPointName, - SingleShaderStage stage, - const PipelineLayout* layout, - uint32_t sampleMask, - const RenderPipeline* renderPipeline, - std::string* remappedEntryPointName, - bool* needsStorageBufferLength, - bool* hasInvariantAttribute, - std::vector* workgroupAllocations); ShaderModule(Device* device, const ShaderModuleDescriptor* descriptor); - ~ShaderModule() override = default; + ~ShaderModule() override; MaybeError Initialize(ShaderModuleParseResult* parseResult, OwnedCompilationMessages* compilationMessages); }; diff --git a/src/dawn/native/metal/ShaderModuleMTL.mm b/src/dawn/native/metal/ShaderModuleMTL.mm index 7b17c56d3c..e56eb22d9b 100644 --- a/src/dawn/native/metal/ShaderModuleMTL.mm +++ b/src/dawn/native/metal/ShaderModuleMTL.mm @@ -15,10 +15,14 @@ #include "dawn/native/metal/ShaderModuleMTL.h" #include "dawn/native/BindGroupLayout.h" +#include "dawn/native/CacheRequest.h" +#include "dawn/native/Serializable.h" #include "dawn/native/TintUtils.h" #include "dawn/native/metal/DeviceMTL.h" #include "dawn/native/metal/PipelineLayoutMTL.h" #include "dawn/native/metal/RenderPipelineMTL.h" +#include "dawn/native/stream/BlobSource.h" +#include "dawn/native/stream/ByteVectorSink.h" #include "dawn/platform/DawnPlatform.h" #include "dawn/platform/tracing/TraceEvent.h" @@ -26,6 +30,42 @@ #include +namespace dawn::native::metal { +namespace { + +using OptionalVertexPullingTransformConfig = std::optional; + +#define MSL_COMPILATION_REQUEST_MEMBERS(X) \ + X(const tint::Program*, inputProgram) \ + X(tint::transform::BindingRemapper::BindingPoints, bindingPoints) \ + X(tint::transform::MultiplanarExternalTexture::BindingsMap, externalTextureBindings) \ + X(OptionalVertexPullingTransformConfig, vertexPullingTransformConfig) \ + X(std::string, entryPointName) \ + X(uint32_t, sampleMask) \ + X(bool, emitVertexPointSize) \ + X(bool, isRobustnessEnabled) \ + X(bool, disableSymbolRenaming) \ + X(bool, disableWorkgroupInit) \ + X(CacheKey::UnsafeUnkeyedValue, tracePlatform) + +DAWN_MAKE_CACHE_REQUEST(MslCompilationRequest, MSL_COMPILATION_REQUEST_MEMBERS); +#undef MSL_COMPILATION_REQUEST_MEMBERS + +using WorkgroupAllocations = std::vector; + +#define MSL_COMPILATION_MEMBERS(X) \ + X(std::string, msl) \ + X(std::string, remappedEntryPointName) \ + X(bool, needsStorageBufferLength) \ + X(bool, hasInvariantAttribute) \ + X(WorkgroupAllocations, workgroupAllocations) + +DAWN_SERIALIZABLE(struct, MslCompilation, MSL_COMPILATION_MEMBERS){}; +#undef MSL_COMPILATION_MEMBERS + +} // namespace +} // namespace dawn::native::metal + namespace dawn::native::metal { // static @@ -42,23 +82,24 @@ ResultOrError> ShaderModule::Create( ShaderModule::ShaderModule(Device* device, const ShaderModuleDescriptor* descriptor) : ShaderModuleBase(device, descriptor) {} +ShaderModule::~ShaderModule() = default; + MaybeError ShaderModule::Initialize(ShaderModuleParseResult* parseResult, OwnedCompilationMessages* compilationMessages) { ScopedTintICEHandler scopedICEHandler(GetDevice()); return InitializeBase(parseResult, compilationMessages); } -ResultOrError ShaderModule::TranslateToMSL( - const char* entryPointName, - SingleShaderStage stage, - const PipelineLayout* layout, - uint32_t sampleMask, - const RenderPipeline* renderPipeline, - std::string* remappedEntryPointName, - bool* needsStorageBufferLength, - bool* hasInvariantAttribute, - std::vector* workgroupAllocations) { - ScopedTintICEHandler scopedICEHandler(GetDevice()); +namespace { + +ResultOrError> TranslateToMSL(DeviceBase* device, + const tint::Program* inputProgram, + const char* entryPointName, + SingleShaderStage stage, + const PipelineLayout* layout, + uint32_t sampleMask, + const RenderPipeline* renderPipeline) { + ScopedTintICEHandler scopedICEHandler(device); std::ostringstream errorStream; errorStream << "Tint MSL failure:" << std::endl; @@ -67,7 +108,6 @@ ResultOrError ShaderModule::TranslateToMSL( using BindingRemapper = tint::transform::BindingRemapper; using BindingPoint = tint::transform::BindingPoint; BindingRemapper::BindingPoints bindingPoints; - BindingRemapper::AccessControls accessControls; for (BindGroupIndex group : IterateBitSet(layout->GetBindGroupLayoutsMask())) { const BindGroupLayoutBase::BindingMap& bindingMap = @@ -91,21 +131,13 @@ ResultOrError ShaderModule::TranslateToMSL( } } - tint::transform::Manager transformManager; - tint::transform::DataMap transformInputs; - - // We only remap bindings for the target entry point, so we need to strip all other entry - // points to avoid generating invalid bindings for them. - transformManager.Add(); - transformInputs.Add(entryPointName); - - AddExternalTextureTransform(layout, &transformManager, &transformInputs); + auto externalTextureBindings = BuildExternalTextureTransformBindings(layout); + std::optional vertexPullingTransformConfig; if (stage == SingleShaderStage::Vertex && - GetDevice()->IsToggleEnabled(Toggle::MetalEnableVertexPulling)) { - transformManager.Add(); - AddVertexPullingTransformConfig(*renderPipeline, entryPointName, kPullingBufferBindingSet, - &transformInputs); + device->IsToggleEnabled(Toggle::MetalEnableVertexPulling)) { + vertexPullingTransformConfig = BuildVertexPullingTransformConfig( + *renderPipeline, entryPointName, kPullingBufferBindingSet); for (VertexBufferSlot slot : IterateBitSet(renderPipeline->GetVertexBufferSlotsUsed())) { uint32_t metalIndex = renderPipeline->GetMtlVertexBufferIndex(slot); @@ -119,62 +151,127 @@ ResultOrError ShaderModule::TranslateToMSL( } } } - if (GetDevice()->IsRobustnessEnabled()) { - transformManager.Add(); - } - transformManager.Add(); - transformManager.Add(); - if (GetDevice()->IsToggleEnabled(Toggle::DisableSymbolRenaming)) { - // We still need to rename MSL reserved keywords - transformInputs.Add( - tint::transform::Renamer::Target::kMslKeywords); - } - - transformInputs.Add(std::move(bindingPoints), - std::move(accessControls), - /* mayCollide */ true); - - tint::Program program; - tint::transform::DataMap transformOutputs; - { - TRACE_EVENT0(GetDevice()->GetPlatform(), General, "RunTransforms"); - DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, GetTintProgram(), transformInputs, - &transformOutputs, nullptr)); - } - - if (auto* data = transformOutputs.Get()) { - auto it = data->remappings.find(entryPointName); - if (it != data->remappings.end()) { - *remappedEntryPointName = it->second; - } else { - DAWN_INVALID_IF(!GetDevice()->IsToggleEnabled(Toggle::DisableSymbolRenaming), - "Could not find remapped name for entry point."); - - *remappedEntryPointName = entryPointName; - } - } else { - return DAWN_FORMAT_VALIDATION_ERROR("Transform output missing renamer data."); - } - - tint::writer::msl::Options options; - options.buffer_size_ubo_index = kBufferLengthBufferSlot; - options.fixed_sample_mask = sampleMask; - options.disable_workgroup_init = GetDevice()->IsToggleEnabled(Toggle::DisableWorkgroupInit); - options.emit_vertex_point_size = + MslCompilationRequest req = {}; + req.inputProgram = inputProgram; + req.bindingPoints = std::move(bindingPoints); + req.externalTextureBindings = std::move(externalTextureBindings); + req.vertexPullingTransformConfig = std::move(vertexPullingTransformConfig); + req.entryPointName = entryPointName; + req.sampleMask = sampleMask; + req.emitVertexPointSize = stage == SingleShaderStage::Vertex && renderPipeline->GetPrimitiveTopology() == wgpu::PrimitiveTopology::PointList; - TRACE_EVENT0(GetDevice()->GetPlatform(), General, "tint::writer::msl::Generate"); - auto result = tint::writer::msl::Generate(&program, options); - DAWN_INVALID_IF(!result.success, "An error occured while generating MSL: %s.", result.error); + req.isRobustnessEnabled = device->IsRobustnessEnabled(); + req.disableSymbolRenaming = device->IsToggleEnabled(Toggle::DisableSymbolRenaming); + req.tracePlatform = UnsafeUnkeyedValue(device->GetPlatform()); - *needsStorageBufferLength = result.needs_storage_buffer_sizes; - *hasInvariantAttribute = result.has_invariant_attribute; - *workgroupAllocations = std::move(result.workgroup_allocations[*remappedEntryPointName]); + CacheResult mslCompilation; + DAWN_TRY_LOAD_OR_RUN( + mslCompilation, device, std::move(req), MslCompilation::FromBlob, + [](MslCompilationRequest r) -> ResultOrError { + tint::transform::Manager transformManager; + tint::transform::DataMap transformInputs; - return std::move(result.msl); + // We only remap bindings for the target entry point, so we need to strip all other + // entry points to avoid generating invalid bindings for them. + transformManager.Add(); + transformInputs.Add(r.entryPointName); + + if (!r.externalTextureBindings.empty()) { + transformManager.Add(); + transformInputs.Add( + std::move(r.externalTextureBindings)); + } + + if (r.vertexPullingTransformConfig) { + transformManager.Add(); + transformInputs.Add( + std::move(r.vertexPullingTransformConfig).value()); + } + + if (r.isRobustnessEnabled) { + transformManager.Add(); + } + transformManager.Add(); + transformInputs.Add(std::move(r.bindingPoints), + BindingRemapper::AccessControls{}, + /* mayCollide */ true); + + transformManager.Add(); + + if (r.disableSymbolRenaming) { + // We still need to rename MSL reserved keywords + transformInputs.Add( + tint::transform::Renamer::Target::kMslKeywords); + } + + tint::Program program; + tint::transform::DataMap transformOutputs; + { + TRACE_EVENT0(r.tracePlatform.UnsafeGetValue(), General, "RunTransforms"); + DAWN_TRY_ASSIGN(program, + RunTransforms(&transformManager, r.inputProgram, transformInputs, + &transformOutputs, nullptr)); + } + + std::string remappedEntryPointName; + if (auto* data = transformOutputs.Get()) { + auto it = data->remappings.find(r.entryPointName); + if (it != data->remappings.end()) { + remappedEntryPointName = it->second; + } else { + DAWN_INVALID_IF(!r.disableSymbolRenaming, + "Could not find remapped name for entry point."); + + remappedEntryPointName = r.entryPointName; + } + } else { + return DAWN_FORMAT_VALIDATION_ERROR("Transform output missing renamer data."); + } + + tint::writer::msl::Options options; + options.buffer_size_ubo_index = kBufferLengthBufferSlot; + options.fixed_sample_mask = r.sampleMask; + options.disable_workgroup_init = r.disableWorkgroupInit; + options.emit_vertex_point_size = r.emitVertexPointSize; + TRACE_EVENT0(r.tracePlatform.UnsafeGetValue(), General, "tint::writer::msl::Generate"); + auto result = tint::writer::msl::Generate(&program, options); + DAWN_INVALID_IF(!result.success, "An error occured while generating MSL: %s.", + result.error); + + // Metal uses Clang to compile the shader as C++14. Disable everything in the -Wall + // category. -Wunused-variable in particular comes up a lot in generated code, and some + // (old?) Metal drivers accidentally treat it as a MTLLibraryErrorCompileError instead + // of a warning. + result.msl = R"( + #ifdef __clang__ + #pragma clang diagnostic ignored "-Wall" + #endif + )" + result.msl; + + auto workgroupAllocations = + std::move(result.workgroup_allocations[remappedEntryPointName]); + return MslCompilation{{ + std::move(result.msl), + std::move(remappedEntryPointName), + result.needs_storage_buffer_sizes, + result.has_invariant_attribute, + std::move(workgroupAllocations), + }}; + }); + + if (device->IsToggleEnabled(Toggle::DumpShaders)) { + std::ostringstream dumpedMsg; + dumpedMsg << "/* Dumped generated MSL */" << std::endl << mslCompilation->msl; + device->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str()); + } + + return mslCompilation; } +} // namespace + MaybeError ShaderModule::CreateFunction(const char* entryPointName, SingleShaderStage stage, const PipelineLayout* layout, @@ -192,33 +289,17 @@ MaybeError ShaderModule::CreateFunction(const char* entryPointName, ASSERT(renderPipeline != nullptr); } - std::string remappedEntryPointName; - std::string msl; - bool hasInvariantAttribute = false; - DAWN_TRY_ASSIGN(msl, TranslateToMSL(entryPointName, stage, layout, sampleMask, renderPipeline, - &remappedEntryPointName, &out->needsStorageBufferLength, - &hasInvariantAttribute, &out->workgroupAllocations)); + CacheResult mslCompilation; + DAWN_TRY_ASSIGN(mslCompilation, TranslateToMSL(GetDevice(), GetTintProgram(), entryPointName, + stage, layout, sampleMask, renderPipeline)); + out->needsStorageBufferLength = mslCompilation->needsStorageBufferLength; + out->workgroupAllocations = std::move(mslCompilation->workgroupAllocations); - // Metal uses Clang to compile the shader as C++14. Disable everything in the -Wall - // category. -Wunused-variable in particular comes up a lot in generated code, and some - // (old?) Metal drivers accidentally treat it as a MTLLibraryErrorCompileError instead - // of a warning. - msl = R"( -#ifdef __clang__ -#pragma clang diagnostic ignored "-Wall" -#endif -)" + msl; - - if (GetDevice()->IsToggleEnabled(Toggle::DumpShaders)) { - std::ostringstream dumpedMsg; - dumpedMsg << "/* Dumped generated MSL */" << std::endl << msl; - GetDevice()->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str()); - } - - NSRef mslSource = AcquireNSRef([[NSString alloc] initWithUTF8String:msl.c_str()]); + NSRef mslSource = + AcquireNSRef([[NSString alloc] initWithUTF8String:mslCompilation->msl.c_str()]); NSRef compileOptions = AcquireNSRef([[MTLCompileOptions alloc] init]); - if (hasInvariantAttribute) { + if (mslCompilation->hasInvariantAttribute) { if (@available(macOS 11.0, iOS 13.0, *)) { (*compileOptions).preserveInvariance = true; } @@ -241,8 +322,8 @@ MaybeError ShaderModule::CreateFunction(const char* entryPointName, } ASSERT(library != nil); - NSRef name = - AcquireNSRef([[NSString alloc] initWithUTF8String:remappedEntryPointName.c_str()]); + NSRef name = AcquireNSRef( + [[NSString alloc] initWithUTF8String:mslCompilation->remappedEntryPointName.c_str()]); { TRACE_EVENT0(GetDevice()->GetPlatform(), General, "MTLLibrary::newFunctionWithName"); @@ -267,6 +348,10 @@ MaybeError ShaderModule::CreateFunction(const char* entryPointName, } } + if (BlobCache* cache = GetDevice()->GetBlobCache()) { + cache->EnsureStored(mslCompilation); + } + if (GetDevice()->IsToggleEnabled(Toggle::MetalEnableVertexPulling) && GetEntryPoint(entryPointName).usedVertexInputs.any()) { out->needsStorageBufferLength = true; diff --git a/src/dawn/native/metal/StagingBufferMTL.h b/src/dawn/native/metal/StagingBufferMTL.h index afd2eac6dd..bbad022d5a 100644 --- a/src/dawn/native/metal/StagingBufferMTL.h +++ b/src/dawn/native/metal/StagingBufferMTL.h @@ -28,6 +28,7 @@ class Device; class StagingBuffer : public StagingBufferBase { public: StagingBuffer(size_t size, Device* device); + ~StagingBuffer() override; id GetBufferHandle() const; diff --git a/src/dawn/native/metal/StagingBufferMTL.mm b/src/dawn/native/metal/StagingBufferMTL.mm index 6bdc9e3db7..f4255f1324 100644 --- a/src/dawn/native/metal/StagingBufferMTL.mm +++ b/src/dawn/native/metal/StagingBufferMTL.mm @@ -20,6 +20,8 @@ namespace dawn::native::metal { StagingBuffer::StagingBuffer(size_t size, Device* device) : StagingBufferBase(size), mDevice(device) {} +StagingBuffer::~StagingBuffer() = default; + MaybeError StagingBuffer::Initialize() { const size_t bufferSize = GetSize(); mBuffer = diff --git a/src/dawn/native/metal/SwapChainMTL.h b/src/dawn/native/metal/SwapChainMTL.h index 003629cd5f..de5cd5c5d4 100644 --- a/src/dawn/native/metal/SwapChainMTL.h +++ b/src/dawn/native/metal/SwapChainMTL.h @@ -44,6 +44,8 @@ class SwapChain final : public NewSwapChainBase { Surface* surface, NewSwapChainBase* previousSwapChain, const SwapChainDescriptor* descriptor); + + SwapChain(DeviceBase* device, Surface* surface, const SwapChainDescriptor* descriptor); ~SwapChain() override; private: diff --git a/src/dawn/native/metal/SwapChainMTL.mm b/src/dawn/native/metal/SwapChainMTL.mm index bf688841ec..60fb77e4f1 100644 --- a/src/dawn/native/metal/SwapChainMTL.mm +++ b/src/dawn/native/metal/SwapChainMTL.mm @@ -72,6 +72,9 @@ ResultOrError> SwapChain::Create(Device* device, return swapchain; } +SwapChain::SwapChain(DeviceBase* dev, Surface* sur, const SwapChainDescriptor* desc) + : NewSwapChainBase(dev, sur, desc) {} + SwapChain::~SwapChain() = default; void SwapChain::DestroyImpl() { @@ -105,11 +108,11 @@ MaybeError SwapChain::Initialize(NewSwapChainBase* previousSwapChain) { [*mLayer setDevice:ToBackend(GetDevice())->GetMTLDevice()]; [*mLayer setPixelFormat:MetalPixelFormat(GetFormat())]; -#if defined(DAWN_PLATFORM_MACOS) +#if DAWN_PLATFORM_IS(MACOS) if (@available(macos 10.13, *)) { [*mLayer setDisplaySyncEnabled:(GetPresentMode() != wgpu::PresentMode::Immediate)]; } -#endif // defined(DAWN_PLATFORM_MACOS) +#endif // DAWN_PLATFORM_IS(MACOS) // There is no way to control Fifo vs. Mailbox in Metal. diff --git a/src/dawn/native/metal/TextureMTL.h b/src/dawn/native/metal/TextureMTL.h index d8b8ccd2ff..3a9c3d8f35 100644 --- a/src/dawn/native/metal/TextureMTL.h +++ b/src/dawn/native/metal/TextureMTL.h @@ -45,6 +45,8 @@ class Texture final : public TextureBase { const TextureDescriptor* descriptor, NSPRef> wrapped); + Texture(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state); + id GetMTLTexture() const; IOSurfaceRef GetIOSurface(); NSPRef> CreateFormatView(wgpu::TextureFormat format); diff --git a/src/dawn/native/metal/TextureMTL.mm b/src/dawn/native/metal/TextureMTL.mm index 429d60ce15..a508b656bf 100644 --- a/src/dawn/native/metal/TextureMTL.mm +++ b/src/dawn/native/metal/TextureMTL.mm @@ -29,9 +29,7 @@ namespace dawn::native::metal { namespace { -MTLTextureUsage MetalTextureUsage(const Format& format, - wgpu::TextureUsage usage, - uint32_t sampleCount) { +MTLTextureUsage MetalTextureUsage(const Format& format, wgpu::TextureUsage usage) { MTLTextureUsage result = MTLTextureUsageUnknown; // This is 0 if (usage & (wgpu::TextureUsage::StorageBinding)) { @@ -52,8 +50,7 @@ MTLTextureUsage MetalTextureUsage(const Format& format, } } - // MTLTextureUsageRenderTarget is needed to clear multisample textures. - if (usage & (wgpu::TextureUsage::RenderAttachment) || sampleCount > 1) { + if (usage & wgpu::TextureUsage::RenderAttachment) { result |= MTLTextureUsageRenderTarget; } @@ -120,8 +117,7 @@ bool RequiresCreatingNewTextureView(const TextureBase* texture, // If the texture is created with MTLTextureUsagePixelFormatView, we need // a new view to perform format reinterpretation. - if ((MetalTextureUsage(texture->GetFormat(), texture->GetInternalUsage(), - texture->GetSampleCount()) & + if ((MetalTextureUsage(texture->GetFormat(), texture->GetInternalUsage()) & MTLTextureUsagePixelFormatView) != 0) { return true; } @@ -156,7 +152,7 @@ bool AllowFormatReinterpretationWithoutFlag(MTLPixelFormat origin, case MTLPixelFormatBGRA8Unorm_sRGB: return reinterpretation == MTLPixelFormatRGBA8Unorm_sRGB || reinterpretation == MTLPixelFormatBGRA8Unorm; -#if defined(DAWN_PLATFORM_MACOS) +#if DAWN_PLATFORM_IS(MACOS) case MTLPixelFormatBC1_RGBA: return reinterpretation == MTLPixelFormatBC1_RGBA_sRGB; case MTLPixelFormatBC1_RGBA_sRGB: @@ -216,9 +212,9 @@ uint32_t GetIOSurfacePlane(wgpu::TextureAspect aspect) { } } -#if defined(DAWN_PLATFORM_MACOS) +#if DAWN_PLATFORM_IS(MACOS) MTLStorageMode kIOSurfaceStorageMode = MTLStorageModeManaged; -#elif defined(DAWN_PLATFORM_IOS) +#elif DAWN_PLATFORM_IS(IOS) MTLStorageMode kIOSurfaceStorageMode = MTLStorageModePrivate; #else #error "Unsupported Apple platform." @@ -321,10 +317,7 @@ MTLPixelFormat MetalPixelFormat(wgpu::TextureFormat format) { case wgpu::TextureFormat::Stencil8: return MTLPixelFormatStencil8; -#if defined(DAWN_PLATFORM_MACOS) - case wgpu::TextureFormat::Depth24UnormStencil8: - return MTLPixelFormatDepth24Unorm_Stencil8; - +#if DAWN_PLATFORM_IS(MACOS) case wgpu::TextureFormat::BC1RGBAUnorm: return MTLPixelFormatBC1_RGBA; case wgpu::TextureFormat::BC1RGBAUnormSrgb: @@ -354,8 +347,6 @@ MTLPixelFormat MetalPixelFormat(wgpu::TextureFormat format) { case wgpu::TextureFormat::BC7RGBAUnormSrgb: return MTLPixelFormatBC7_RGBAUnorm_sRGB; #else - case wgpu::TextureFormat::Depth24UnormStencil8: - case wgpu::TextureFormat::BC1RGBAUnorm: case wgpu::TextureFormat::BC1RGBAUnormSrgb: case wgpu::TextureFormat::BC2RGBAUnorm: @@ -652,7 +643,7 @@ NSRef Texture::CreateMetalTextureDescriptor() const { // Metal only allows format reinterpretation to happen on swizzle pattern or conversion // between linear space and sRGB. For example, creating bgra8Unorm texture view on // rgba8Unorm texture or creating rgba8Unorm_srgb texture view on rgab8Unorm texture. - mtlDesc.usage = MetalTextureUsage(GetFormat(), GetInternalUsage(), GetSampleCount()); + mtlDesc.usage = MetalTextureUsage(GetFormat(), GetInternalUsage()); mtlDesc.pixelFormat = MetalPixelFormat(GetFormat().format); mtlDesc.mipmapLevelCount = GetNumMipLevels(); mtlDesc.storageMode = MTLStorageModePrivate; @@ -772,6 +763,9 @@ MaybeError Texture::InitializeFromIOSurface(const ExternalImageDescriptor* descr return {}; } +Texture::Texture(DeviceBase* dev, const TextureDescriptor* desc, TextureState st) + : TextureBase(dev, desc, st) {} + Texture::~Texture() {} void Texture::DestroyImpl() { @@ -866,8 +860,9 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* commandContext, } } - DAWN_TRY(EncodeEmptyMetalRenderPass(device, commandContext, descriptor, - GetMipLevelVirtualSize(level))); + DAWN_TRY( + EncodeEmptyMetalRenderPass(device, commandContext, descriptor, + GetMipLevelSingleSubresourceVirtualSize(level))); } } } else { @@ -880,7 +875,7 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* commandContext, NSRef descriptor; uint32_t attachment = 0; - uint32_t numZSlices = GetMipLevelVirtualSize(level).depthOrArrayLayers; + uint32_t depth = GetMipLevelSingleSubresourceVirtualSize(level).depthOrArrayLayers; for (uint32_t arrayLayer = range.baseArrayLayer; arrayLayer < range.baseArrayLayer + range.layerCount; arrayLayer++) { @@ -891,7 +886,7 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* commandContext, continue; } - for (uint32_t z = 0; z < numZSlices; ++z) { + for (uint32_t z = 0; z < depth; ++z) { if (descriptor == nullptr) { // Note that this creates a descriptor that's autoreleased so we // don't use AcquireNSRef @@ -912,38 +907,36 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* commandContext, if (attachment == kMaxColorAttachments) { attachment = 0; - DAWN_TRY(EncodeEmptyMetalRenderPass(device, commandContext, - descriptor.Get(), - GetMipLevelVirtualSize(level))); + DAWN_TRY(EncodeEmptyMetalRenderPass( + device, commandContext, descriptor.Get(), + GetMipLevelSingleSubresourceVirtualSize(level))); descriptor = nullptr; } } } if (descriptor != nullptr) { - DAWN_TRY(EncodeEmptyMetalRenderPass(device, commandContext, descriptor.Get(), - GetMipLevelVirtualSize(level))); + DAWN_TRY( + EncodeEmptyMetalRenderPass(device, commandContext, descriptor.Get(), + GetMipLevelSingleSubresourceVirtualSize(level))); } } } } else { - Extent3D largestMipSize = GetMipLevelVirtualSize(range.baseMipLevel); + ASSERT(!IsMultisampledTexture()); // Encode a buffer to texture copy to clear each subresource. for (Aspect aspect : IterateEnumMask(range.aspects)) { // Compute the buffer size big enough to fill the largest mip. const TexelBlockInfo& blockInfo = GetFormat().GetAspectInfo(aspect).block; - // Metal validation layers: sourceBytesPerRow must be at least 64. + // Computations for the bytes per row / image height are done using the physical size + // so that enough data is reserved for compressed textures. + Extent3D largestMipSize = GetMipLevelSingleSubresourcePhysicalSize(range.baseMipLevel); uint32_t largestMipBytesPerRow = - std::max((largestMipSize.width / blockInfo.width) * blockInfo.byteSize, 64u); - - // Metal validation layers: sourceBytesPerImage must be at least 512. - uint64_t largestMipBytesPerImage = - std::max(static_cast(largestMipBytesPerRow) * - (largestMipSize.height / blockInfo.height), - 512llu); - + (largestMipSize.width / blockInfo.width) * blockInfo.byteSize; + uint64_t largestMipBytesPerImage = static_cast(largestMipBytesPerRow) * + (largestMipSize.height / blockInfo.height); uint64_t bufferSize = largestMipBytesPerImage * largestMipSize.depthOrArrayLayers; if (bufferSize > std::numeric_limits::max()) { @@ -961,7 +954,7 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* commandContext, for (uint32_t level = range.baseMipLevel; level < range.baseMipLevel + range.levelCount; ++level) { - Extent3D virtualSize = GetMipLevelVirtualSize(level); + Extent3D virtualSize = GetMipLevelSingleSubresourceVirtualSize(level); for (uint32_t arrayLayer = range.baseArrayLayer; arrayLayer < range.baseArrayLayer + range.layerCount; ++arrayLayer) { @@ -1035,8 +1028,7 @@ MaybeError TextureView::Initialize(const TextureViewDescriptor* descriptor) { MTLTextureDescriptor* mtlDesc = mtlDescRef.Get(); mtlDesc.sampleCount = texture->GetSampleCount(); - mtlDesc.usage = MetalTextureUsage(texture->GetFormat(), texture->GetInternalUsage(), - texture->GetSampleCount()); + mtlDesc.usage = MetalTextureUsage(texture->GetFormat(), texture->GetInternalUsage()); mtlDesc.pixelFormat = MetalPixelFormat(descriptor->format); mtlDesc.mipmapLevelCount = texture->GetNumMipLevels(); mtlDesc.storageMode = kIOSurfaceStorageMode; @@ -1069,11 +1061,6 @@ MaybeError TextureView::Initialize(const TextureViewDescriptor* descriptor) { if (textureFormat == MTLPixelFormatDepth32Float_Stencil8) { viewFormat = MTLPixelFormatX32_Stencil8; } -#if defined(DAWN_PLATFORM_MACOS) - else if (textureFormat == MTLPixelFormatDepth24Unorm_Stencil8) { - viewFormat = MTLPixelFormatX24_Stencil8; - } -#endif else { UNREACHABLE(); } diff --git a/src/dawn/native/metal/UtilsMetal.mm b/src/dawn/native/metal/UtilsMetal.mm index 339b8872db..df122f3e3e 100644 --- a/src/dawn/native/metal/UtilsMetal.mm +++ b/src/dawn/native/metal/UtilsMetal.mm @@ -262,7 +262,7 @@ TextureBufferCopySplit ComputeTextureBufferCopySplit(const Texture* texture, origin.z + copyExtent.depthOrArrayLayers - 1}; ASSERT(copyExtent.height - blockInfo.height < - texture->GetMipLevelVirtualSize(mipLevel).height); + texture->GetMipLevelSingleSubresourceVirtualSize(mipLevel).height); copy.copies[copy.count].copyExtent = {clampedCopyExtent.width, copyExtent.height - blockInfo.height, 1}; @@ -332,7 +332,7 @@ MaybeError CreateMTLFunction(const ProgrammableStage& programmableStage, ShaderModule* shaderModule = ToBackend(programmableStage.module.Get()); const char* shaderEntryPoint = programmableStage.entryPoint.c_str(); const auto& entryPointMetadata = programmableStage.module->GetEntryPoint(shaderEntryPoint); - if (entryPointMetadata.overridableConstants.size() == 0) { + if (entryPointMetadata.overrides.size() == 0) { DAWN_TRY(shaderModule->CreateFunction(shaderEntryPoint, singleShaderStage, pipelineLayout, functionData, nil, sampleMask, renderPipeline)); return {}; @@ -345,29 +345,29 @@ MaybeError CreateMTLFunction(const ProgrammableStage& programmableStage, std::unordered_set overriddenConstants; - auto switchType = [&](EntryPointMetadata::OverridableConstant::Type dawnType, - MTLDataType* type, OverridableConstantScalar* entry, + auto switchType = [&](EntryPointMetadata::Override::Type dawnType, + MTLDataType* type, OverrideScalar* entry, double value = 0) { switch (dawnType) { - case EntryPointMetadata::OverridableConstant::Type::Boolean: + case EntryPointMetadata::Override::Type::Boolean: *type = MTLDataTypeBool; if (entry) { entry->b = static_cast(value); } break; - case EntryPointMetadata::OverridableConstant::Type::Float32: + case EntryPointMetadata::Override::Type::Float32: *type = MTLDataTypeFloat; if (entry) { entry->f32 = static_cast(value); } break; - case EntryPointMetadata::OverridableConstant::Type::Int32: + case EntryPointMetadata::Override::Type::Int32: *type = MTLDataTypeInt; if (entry) { entry->i32 = static_cast(value); } break; - case EntryPointMetadata::OverridableConstant::Type::Uint32: + case EntryPointMetadata::Override::Type::Uint32: *type = MTLDataTypeUInt; if (entry) { entry->u32 = static_cast(value); @@ -382,10 +382,10 @@ MaybeError CreateMTLFunction(const ProgrammableStage& programmableStage, overriddenConstants.insert(name); // This is already validated so `name` must exist - const auto& moduleConstant = entryPointMetadata.overridableConstants.at(name); + const auto& moduleConstant = entryPointMetadata.overrides.at(name); MTLDataType type; - OverridableConstantScalar entry{}; + OverrideScalar entry{}; switchType(moduleConstant.type, &type, &entry, value); @@ -394,14 +394,14 @@ MaybeError CreateMTLFunction(const ProgrammableStage& programmableStage, // Set shader initialized default values because MSL function_constant // has no default value - for (const std::string& name : entryPointMetadata.initializedOverridableConstants) { + for (const std::string& name : entryPointMetadata.initializedOverrides) { if (overriddenConstants.count(name) != 0) { // This constant already has overridden value continue; } // Must exist because it is validated - const auto& moduleConstant = entryPointMetadata.overridableConstants.at(name); + const auto& moduleConstant = entryPointMetadata.overrides.at(name); ASSERT(moduleConstant.isInitialized); MTLDataType type; diff --git a/src/dawn/native/null/DeviceNull.cpp b/src/dawn/native/null/DeviceNull.cpp index a7451b185e..04069211b0 100644 --- a/src/dawn/native/null/DeviceNull.cpp +++ b/src/dawn/native/null/DeviceNull.cpp @@ -89,7 +89,7 @@ BackendConnection* Connect(InstanceBase* instance) { } struct CopyFromStagingToBufferOperation : PendingOperation { - virtual void Execute() { + void Execute() override { destination->CopyFromStaging(staging, sourceOffset, destinationOffset, size); } @@ -506,4 +506,7 @@ float Device::GetTimestampPeriodInNS() const { return 1.0f; } +Texture::Texture(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state) + : TextureBase(device, descriptor, state) {} + } // namespace dawn::native::null diff --git a/src/dawn/native/null/DeviceNull.h b/src/dawn/native/null/DeviceNull.h index 68f56d0183..74da890354 100644 --- a/src/dawn/native/null/DeviceNull.h +++ b/src/dawn/native/null/DeviceNull.h @@ -55,7 +55,7 @@ class RenderPipeline; using Sampler = SamplerBase; class ShaderModule; class SwapChain; -using Texture = TextureBase; +class Texture; using TextureView = TextureViewBase; struct NullBackendTraits { @@ -335,6 +335,11 @@ class StagingBuffer : public StagingBufferBase { std::unique_ptr mBuffer; }; +class Texture : public TextureBase { + public: + Texture(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state); +}; + } // namespace dawn::native::null #endif // SRC_DAWN_NATIVE_NULL_DEVICENULL_H_ diff --git a/src/dawn/native/opengl/AdapterGL.cpp b/src/dawn/native/opengl/AdapterGL.cpp new file mode 100644 index 0000000000..7a4f336078 --- /dev/null +++ b/src/dawn/native/opengl/AdapterGL.cpp @@ -0,0 +1,160 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/opengl/AdapterGL.h" + +#include +#include +#include + +#include "dawn/common/GPUInfo.h" +#include "dawn/native/Instance.h" +#include "dawn/native/opengl/ContextEGL.h" +#include "dawn/native/opengl/DeviceGL.h" + +namespace dawn::native::opengl { + +namespace { + +struct Vendor { + const char* vendorName; + uint32_t vendorId; +}; + +const Vendor kVendors[] = {{"ATI", gpu_info::kVendorID_AMD}, + {"ARM", gpu_info::kVendorID_ARM}, + {"Imagination", gpu_info::kVendorID_ImgTec}, + {"Intel", gpu_info::kVendorID_Intel}, + {"NVIDIA", gpu_info::kVendorID_Nvidia}, + {"Qualcomm", gpu_info::kVendorID_Qualcomm}}; + +uint32_t GetVendorIdFromVendors(const char* vendor) { + uint32_t vendorId = 0; + for (const auto& it : kVendors) { + // Matching vendor name with vendor string + if (strstr(vendor, it.vendorName) != nullptr) { + vendorId = it.vendorId; + break; + } + } + return vendorId; +} + +} // anonymous namespace + +Adapter::Adapter(InstanceBase* instance, wgpu::BackendType backendType) + : AdapterBase(instance, backendType) {} + +MaybeError Adapter::InitializeGLFunctions(void* (*getProc)(const char*)) { + // Use getProc to populate the dispatch table + mEGLFunctions.Init(getProc); + return mFunctions.Initialize(getProc); +} + +bool Adapter::SupportsExternalImages() const { + // Via dawn::native::opengl::WrapExternalEGLImage + return GetBackendType() == wgpu::BackendType::OpenGLES; +} + +MaybeError Adapter::InitializeImpl() { + if (mFunctions.GetVersion().IsES()) { + ASSERT(GetBackendType() == wgpu::BackendType::OpenGLES); + } else { + ASSERT(GetBackendType() == wgpu::BackendType::OpenGL); + } + + mName = reinterpret_cast(mFunctions.GetString(GL_RENDERER)); + + // Workaroud to find vendor id from vendor name + const char* vendor = reinterpret_cast(mFunctions.GetString(GL_VENDOR)); + mVendorId = GetVendorIdFromVendors(vendor); + + mDriverDescription = std::string("OpenGL version ") + + reinterpret_cast(mFunctions.GetString(GL_VERSION)); + + if (mName.find("SwiftShader") != std::string::npos) { + mAdapterType = wgpu::AdapterType::CPU; + } + + return {}; +} + +MaybeError Adapter::InitializeSupportedFeaturesImpl() { + // TextureCompressionBC + { + // BC1, BC2 and BC3 are not supported in OpenGL or OpenGL ES core features. + bool supportsS3TC = + mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_s3tc") || + (mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_dxt1") && + mFunctions.IsGLExtensionSupported("GL_ANGLE_texture_compression_dxt3") && + mFunctions.IsGLExtensionSupported("GL_ANGLE_texture_compression_dxt5")); + + // COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT and + // COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT requires both GL_EXT_texture_sRGB and + // GL_EXT_texture_compression_s3tc on desktop OpenGL drivers. + // (https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB.txt) + bool supportsTextureSRGB = mFunctions.IsGLExtensionSupported("GL_EXT_texture_sRGB"); + + // GL_EXT_texture_compression_s3tc_srgb is an extension in OpenGL ES. + // NVidia GLES drivers don't support this extension, but they do support + // GL_NV_sRGB_formats. (Note that GL_EXT_texture_sRGB does not exist on ES. + // GL_EXT_sRGB does (core in ES 3.0), but it does not automatically provide S3TC + // SRGB support even if S3TC is supported; see + // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_sRGB.txt.) + bool supportsS3TCSRGB = + mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_s3tc_srgb") || + mFunctions.IsGLExtensionSupported("GL_NV_sRGB_formats"); + + // BC4 and BC5 + bool supportsRGTC = mFunctions.IsAtLeastGL(3, 0) || + mFunctions.IsGLExtensionSupported("GL_ARB_texture_compression_rgtc") || + mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_rgtc"); + + // BC6 and BC7 + bool supportsBPTC = mFunctions.IsAtLeastGL(4, 2) || + mFunctions.IsGLExtensionSupported("GL_ARB_texture_compression_bptc") || + mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_bptc"); + + if (supportsS3TC && (supportsTextureSRGB || supportsS3TCSRGB) && supportsRGTC && + supportsBPTC) { + mSupportedFeatures.EnableFeature(dawn::native::Feature::TextureCompressionBC); + } + } + + // Non-zero baseInstance requires at least desktop OpenGL 4.2, and it is not supported in + // OpenGL ES OpenGL: + // https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glDrawElementsIndirect.xhtml + // OpenGL ES: + // https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawElementsIndirect.xhtml + if (mFunctions.IsAtLeastGL(4, 2)) { + mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance); + } + + return {}; +} + +MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) { + GetDefaultLimits(&limits->v1); + return {}; +} + +ResultOrError> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor) { + EGLenum api = + GetBackendType() == wgpu::BackendType::OpenGL ? EGL_OPENGL_API : EGL_OPENGL_ES_API; + std::unique_ptr context; + DAWN_TRY_ASSIGN(context, ContextEGL::Create(mEGLFunctions, api)); + return Device::Create(this, descriptor, mFunctions, std::move(context)); +} + +} // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/AdapterGL.h b/src/dawn/native/opengl/AdapterGL.h new file mode 100644 index 0000000000..6e354b2d03 --- /dev/null +++ b/src/dawn/native/opengl/AdapterGL.h @@ -0,0 +1,47 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_OPENGL_ADAPTERGL_H_ +#define SRC_DAWN_NATIVE_OPENGL_ADAPTERGL_H_ + +#include "dawn/native/Adapter.h" +#include "dawn/native/opengl/EGLFunctions.h" +#include "dawn/native/opengl/OpenGLFunctions.h" + +namespace dawn::native::opengl { + +class Adapter : public AdapterBase { + public: + Adapter(InstanceBase* instance, wgpu::BackendType backendType); + + MaybeError InitializeGLFunctions(void* (*getProc)(const char*)); + + ~Adapter() override = default; + + // AdapterBase Implementation + bool SupportsExternalImages() const override; + + private: + MaybeError InitializeImpl() override; + MaybeError InitializeSupportedFeaturesImpl() override; + MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override; + ResultOrError> CreateDeviceImpl(const DeviceDescriptor* descriptor) override; + + OpenGLFunctions mFunctions; + EGLFunctions mEGLFunctions; +}; + +} // namespace dawn::native::opengl + +#endif // SRC_DAWN_NATIVE_OPENGL_ADAPTERGL_H_ diff --git a/src/dawn/native/opengl/BackendGL.cpp b/src/dawn/native/opengl/BackendGL.cpp index c8abaff89e..ac4e374e0d 100644 --- a/src/dawn/native/opengl/BackendGL.cpp +++ b/src/dawn/native/opengl/BackendGL.cpp @@ -14,264 +14,73 @@ #include "dawn/native/opengl/BackendGL.h" -#include -#include +#include + +#include #include -#include "dawn/common/GPUInfo.h" -#include "dawn/common/Log.h" +#include "dawn/common/SystemUtils.h" #include "dawn/native/Instance.h" #include "dawn/native/OpenGLBackend.h" -#include "dawn/native/opengl/DeviceGL.h" +#include "dawn/native/opengl/AdapterGL.h" +#include "dawn/native/opengl/ContextEGL.h" +#include "dawn/native/opengl/EGLFunctions.h" namespace dawn::native::opengl { -namespace { - -struct Vendor { - const char* vendorName; - uint32_t vendorId; -}; - -const Vendor kVendors[] = {{"ATI", gpu_info::kVendorID_AMD}, - {"ARM", gpu_info::kVendorID_ARM}, - {"Imagination", gpu_info::kVendorID_ImgTec}, - {"Intel", gpu_info::kVendorID_Intel}, - {"NVIDIA", gpu_info::kVendorID_Nvidia}, - {"Qualcomm", gpu_info::kVendorID_Qualcomm}}; - -uint32_t GetVendorIdFromVendors(const char* vendor) { - uint32_t vendorId = 0; - for (const auto& it : kVendors) { - // Matching vendor name with vendor string - if (strstr(vendor, it.vendorName) != nullptr) { - vendorId = it.vendorId; - break; - } - } - return vendorId; -} - -void KHRONOS_APIENTRY OnGLDebugMessage(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - GLsizei length, - const GLchar* message, - const void* userParam) { - const char* sourceText; - switch (source) { - case GL_DEBUG_SOURCE_API: - sourceText = "OpenGL"; - break; - case GL_DEBUG_SOURCE_WINDOW_SYSTEM: - sourceText = "Window System"; - break; - case GL_DEBUG_SOURCE_SHADER_COMPILER: - sourceText = "Shader Compiler"; - break; - case GL_DEBUG_SOURCE_THIRD_PARTY: - sourceText = "Third Party"; - break; - case GL_DEBUG_SOURCE_APPLICATION: - sourceText = "Application"; - break; - case GL_DEBUG_SOURCE_OTHER: - sourceText = "Other"; - break; - default: - sourceText = "UNKNOWN"; - break; - } - - const char* severityText; - switch (severity) { - case GL_DEBUG_SEVERITY_HIGH: - severityText = "High"; - break; - case GL_DEBUG_SEVERITY_MEDIUM: - severityText = "Medium"; - break; - case GL_DEBUG_SEVERITY_LOW: - severityText = "Low"; - break; - case GL_DEBUG_SEVERITY_NOTIFICATION: - severityText = "Notification"; - break; - default: - severityText = "UNKNOWN"; - break; - } - - if (type == GL_DEBUG_TYPE_ERROR) { - dawn::WarningLog() << "OpenGL error:" - << "\n Source: " << sourceText // - << "\n ID: " << id // - << "\n Severity: " << severityText // - << "\n Message: " << message; - - // Abort on an error when in Debug mode. - UNREACHABLE(); - } -} - -} // anonymous namespace - -// The OpenGL backend's Adapter. - -class Adapter : public AdapterBase { - public: - Adapter(InstanceBase* instance, wgpu::BackendType backendType) - : AdapterBase(instance, backendType) {} - - MaybeError InitializeGLFunctions(void* (*getProc)(const char*)) { - // Use getProc to populate the dispatch table - return mFunctions.Initialize(getProc); - } - - ~Adapter() override = default; - - // AdapterBase Implementation - bool SupportsExternalImages() const override { - // Via dawn::native::opengl::WrapExternalEGLImage - return GetBackendType() == wgpu::BackendType::OpenGLES; - } - - private: - MaybeError InitializeImpl() override { - if (mFunctions.GetVersion().IsES()) { - ASSERT(GetBackendType() == wgpu::BackendType::OpenGLES); - } else { - ASSERT(GetBackendType() == wgpu::BackendType::OpenGL); - } - - // Use the debug output functionality to get notified about GL errors - // TODO(cwallez@chromium.org): add support for the KHR_debug and ARB_debug_output - // extensions - bool hasDebugOutput = mFunctions.IsAtLeastGL(4, 3) || mFunctions.IsAtLeastGLES(3, 2); - - if (GetInstance()->IsBackendValidationEnabled() && hasDebugOutput) { - mFunctions.Enable(GL_DEBUG_OUTPUT); - mFunctions.Enable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - - // Any GL error; dangerous undefined behavior; any shader compiler and linker errors - mFunctions.DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, - nullptr, GL_TRUE); - - // Severe performance warnings; GLSL or other shader compiler and linker warnings; - // use of currently deprecated behavior - mFunctions.DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_MEDIUM, 0, - nullptr, GL_TRUE); - - // Performance warnings from redundant state changes; trivial undefined behavior - // This is disabled because we do an incredible amount of redundant state changes. - mFunctions.DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW, 0, - nullptr, GL_FALSE); - - // Any message which is not an error or performance concern - mFunctions.DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, - GL_DEBUG_SEVERITY_NOTIFICATION, 0, nullptr, GL_FALSE); - mFunctions.DebugMessageCallback(&OnGLDebugMessage, nullptr); - } - - // Set state that never changes between devices. - mFunctions.Enable(GL_DEPTH_TEST); - mFunctions.Enable(GL_SCISSOR_TEST); - mFunctions.Enable(GL_PRIMITIVE_RESTART_FIXED_INDEX); - if (mFunctions.GetVersion().IsDesktop()) { - // These are not necessary on GLES. The functionality is enabled by default, and - // works by specifying sample counts and SRGB textures, respectively. - mFunctions.Enable(GL_MULTISAMPLE); - // mFunctions.Enable(GL_FRAMEBUFFER_SRGB); - } - mFunctions.Enable(GL_SAMPLE_MASK); - - mName = reinterpret_cast(mFunctions.GetString(GL_RENDERER)); - - // Workaroud to find vendor id from vendor name - const char* vendor = reinterpret_cast(mFunctions.GetString(GL_VENDOR)); - mVendorId = GetVendorIdFromVendors(vendor); - - mDriverDescription = std::string("OpenGL version ") + - reinterpret_cast(mFunctions.GetString(GL_VERSION)); - - if (mName.find("SwiftShader") != std::string::npos) { - mAdapterType = wgpu::AdapterType::CPU; - } - - return {}; - } - - MaybeError InitializeSupportedFeaturesImpl() override { - // TextureCompressionBC - { - // BC1, BC2 and BC3 are not supported in OpenGL or OpenGL ES core features. - bool supportsS3TC = - mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_s3tc") || - (mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_dxt1") && - mFunctions.IsGLExtensionSupported("GL_ANGLE_texture_compression_dxt3") && - mFunctions.IsGLExtensionSupported("GL_ANGLE_texture_compression_dxt5")); - - // COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT and - // COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT requires both GL_EXT_texture_sRGB and - // GL_EXT_texture_compression_s3tc on desktop OpenGL drivers. - // (https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB.txt) - bool supportsTextureSRGB = mFunctions.IsGLExtensionSupported("GL_EXT_texture_sRGB"); - - // GL_EXT_texture_compression_s3tc_srgb is an extension in OpenGL ES. - // NVidia GLES drivers don't support this extension, but they do support - // GL_NV_sRGB_formats. (Note that GL_EXT_texture_sRGB does not exist on ES. - // GL_EXT_sRGB does (core in ES 3.0), but it does not automatically provide S3TC - // SRGB support even if S3TC is supported; see - // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_sRGB.txt.) - bool supportsS3TCSRGB = - mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_s3tc_srgb") || - mFunctions.IsGLExtensionSupported("GL_NV_sRGB_formats"); - - // BC4 and BC5 - bool supportsRGTC = - mFunctions.IsAtLeastGL(3, 0) || - mFunctions.IsGLExtensionSupported("GL_ARB_texture_compression_rgtc") || - mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_rgtc"); - - // BC6 and BC7 - bool supportsBPTC = - mFunctions.IsAtLeastGL(4, 2) || - mFunctions.IsGLExtensionSupported("GL_ARB_texture_compression_bptc") || - mFunctions.IsGLExtensionSupported("GL_EXT_texture_compression_bptc"); - - if (supportsS3TC && (supportsTextureSRGB || supportsS3TCSRGB) && supportsRGTC && - supportsBPTC) { - mSupportedFeatures.EnableFeature(dawn::native::Feature::TextureCompressionBC); - } - mSupportedFeatures.EnableFeature(Feature::Depth24UnormStencil8); - } - - return {}; - } - - MaybeError InitializeSupportedLimitsImpl(CombinedLimits* limits) override { - GetDefaultLimits(&limits->v1); - return {}; - } - - ResultOrError> CreateDeviceImpl(const DeviceDescriptor* descriptor) override { - // There is no limit on the number of devices created from this adapter because they can - // all share the same backing OpenGL context. - return Device::Create(this, descriptor, mFunctions); - } - - OpenGLFunctions mFunctions; -}; - // Implementation of the OpenGL backend's BackendConnection Backend::Backend(InstanceBase* instance, wgpu::BackendType backendType) : BackendConnection(instance, backendType) {} std::vector> Backend::DiscoverDefaultAdapters() { - // The OpenGL backend needs at least "getProcAddress" to discover an adapter. - return {}; + std::vector> adapters; +#if DAWN_PLATFORM_IS(WINDOWS) + const char* eglLib = "libEGL.dll"; +#elif DAWN_PLATFORM_IS(MACOS) + const char* eglLib = "libEGL.dylib"; +#else + const char* eglLib = "libEGL.so"; +#endif + if (!mLibEGL.Valid() && !mLibEGL.Open(eglLib)) { + return {}; + } + + AdapterDiscoveryOptions options(ToAPI(GetType())); + options.getProc = + reinterpret_cast(mLibEGL.GetProc("eglGetProcAddress")); + if (!options.getProc) { + return {}; + } + + EGLFunctions egl; + egl.Init(options.getProc); + + EGLenum api = GetType() == wgpu::BackendType::OpenGLES ? EGL_OPENGL_ES_API : EGL_OPENGL_API; + std::unique_ptr context; + if (GetInstance()->ConsumedError(ContextEGL::Create(egl, api), &context)) { + return {}; + } + + EGLDisplay prevDisplay = egl.GetCurrentDisplay(); + EGLContext prevDrawSurface = egl.GetCurrentSurface(EGL_DRAW); + EGLContext prevReadSurface = egl.GetCurrentSurface(EGL_READ); + EGLContext prevContext = egl.GetCurrentContext(); + + context->MakeCurrent(); + + auto result = DiscoverAdapters(&options); + + if (result.IsError()) { + GetInstance()->ConsumedError(result.AcquireError()); + } else { + auto value = result.AcquireSuccess(); + adapters.insert(adapters.end(), value.begin(), value.end()); + } + + egl.MakeCurrent(prevDisplay, prevDrawSurface, prevReadSurface, prevContext); + + return adapters; } ResultOrError>> Backend::DiscoverAdapters( diff --git a/src/dawn/native/opengl/BackendGL.h b/src/dawn/native/opengl/BackendGL.h index 591672809e..dc8fea5d6c 100644 --- a/src/dawn/native/opengl/BackendGL.h +++ b/src/dawn/native/opengl/BackendGL.h @@ -17,6 +17,7 @@ #include +#include "dawn/common/DynamicLib.h" #include "dawn/native/BackendConnection.h" namespace dawn::native::opengl { @@ -31,6 +32,7 @@ class Backend : public BackendConnection { private: bool mCreatedAdapter = false; + DynamicLib mLibEGL; }; } // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/BufferGL.cpp b/src/dawn/native/opengl/BufferGL.cpp index c05730bbdd..5fce54f6dd 100644 --- a/src/dawn/native/opengl/BufferGL.cpp +++ b/src/dawn/native/opengl/BufferGL.cpp @@ -39,21 +39,22 @@ ResultOrError> Buffer::CreateInternalBuffer(Device* device, Buffer::Buffer(Device* device, const BufferDescriptor* descriptor) : BufferBase(device, descriptor) { + const OpenGLFunctions& gl = device->GetGL(); // Allocate at least 4 bytes so clamped accesses are always in bounds. mAllocatedSize = std::max(GetSize(), uint64_t(4u)); - device->gl.GenBuffers(1, &mBuffer); - device->gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer); + gl.GenBuffers(1, &mBuffer); + gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer); // The buffers with mappedAtCreation == true will be initialized in // BufferBase::MapAtCreation(). if (device->IsToggleEnabled(Toggle::NonzeroClearResourcesOnCreationForTesting) && !descriptor->mappedAtCreation) { std::vector clearValues(mAllocatedSize, 1u); - device->gl.BufferData(GL_ARRAY_BUFFER, mAllocatedSize, clearValues.data(), GL_STATIC_DRAW); + gl.BufferData(GL_ARRAY_BUFFER, mAllocatedSize, clearValues.data(), GL_STATIC_DRAW); } else { // Buffers start zeroed if you pass nullptr to glBufferData. - device->gl.BufferData(GL_ARRAY_BUFFER, mAllocatedSize, nullptr, GL_STATIC_DRAW); + gl.BufferData(GL_ARRAY_BUFFER, mAllocatedSize, nullptr, GL_STATIC_DRAW); } } @@ -112,10 +113,11 @@ void Buffer::InitializeToZero() { const uint64_t size = GetAllocatedSize(); Device* device = ToBackend(GetDevice()); + const OpenGLFunctions& gl = device->GetGL(); const std::vector clearValues(size, 0u); - device->gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer); - device->gl.BufferSubData(GL_ARRAY_BUFFER, 0, size, clearValues.data()); + gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer); + gl.BufferSubData(GL_ARRAY_BUFFER, 0, size, clearValues.data()); device->IncrementLazyClearCountForTesting(); SetIsDataInitialized(); @@ -128,14 +130,14 @@ bool Buffer::IsCPUWritableAtCreation() const { } MaybeError Buffer::MapAtCreationImpl() { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer); mMappedData = gl.MapBufferRange(GL_ARRAY_BUFFER, 0, GetSize(), GL_MAP_WRITE_BIT); return {}; } MaybeError Buffer::MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); // It is an error to map an empty range in OpenGL. We always have at least a 4-byte buffer // so we extend the range to be 4 bytes. @@ -171,7 +173,7 @@ void* Buffer::GetMappedPointerImpl() { } void Buffer::UnmapImpl() { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); gl.BindBuffer(GL_ARRAY_BUFFER, mBuffer); gl.UnmapBuffer(GL_ARRAY_BUFFER); @@ -179,8 +181,10 @@ void Buffer::UnmapImpl() { } void Buffer::DestroyImpl() { + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); + BufferBase::DestroyImpl(); - ToBackend(GetDevice())->gl.DeleteBuffers(1, &mBuffer); + gl.DeleteBuffers(1, &mBuffer); mBuffer = 0; } diff --git a/src/dawn/native/opengl/CommandBufferGL.cpp b/src/dawn/native/opengl/CommandBufferGL.cpp index 9931163741..f0ea75b641 100644 --- a/src/dawn/native/opengl/CommandBufferGL.cpp +++ b/src/dawn/native/opengl/CommandBufferGL.cpp @@ -422,7 +422,8 @@ void ResolveMultisampledRenderTargets(const OpenGLFunctions& gl, Extent3D ComputeTextureCopyExtent(const TextureCopy& textureCopy, const Extent3D& copySize) { Extent3D validTextureCopyExtent = copySize; const TextureBase* texture = textureCopy.texture.Get(); - Extent3D virtualSizeAtLevel = texture->GetMipLevelVirtualSize(textureCopy.mipLevel); + Extent3D virtualSizeAtLevel = + texture->GetMipLevelSingleSubresourceVirtualSize(textureCopy.mipLevel); ASSERT(textureCopy.origin.x <= virtualSizeAtLevel.width); ASSERT(textureCopy.origin.y <= virtualSizeAtLevel.height); if (copySize.width > virtualSizeAtLevel.width - textureCopy.origin.x) { @@ -447,7 +448,7 @@ CommandBuffer::CommandBuffer(CommandEncoder* encoder, const CommandBufferDescrip : CommandBufferBase(encoder, descriptor) {} MaybeError CommandBuffer::Execute() { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); auto LazyClearSyncScope = [](const SyncScopeResourceUsage& scope) { for (size_t i = 0; i < scope.textures.size(); i++) { @@ -766,7 +767,7 @@ MaybeError CommandBuffer::Execute() { } MaybeError CommandBuffer::ExecuteComputePass() { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); ComputePipeline* lastPipeline = nullptr; BindGroupTracker bindGroupTracker = {}; @@ -843,7 +844,7 @@ MaybeError CommandBuffer::ExecuteComputePass() { } MaybeError CommandBuffer::ExecuteRenderPass(BeginRenderPassCmd* renderPass) { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); GLuint fbo = 0; // Create the framebuffer used for this render pass and calls the correct glDrawBuffers @@ -1240,7 +1241,7 @@ void DoTexSubImage(const OpenGLFunctions& gl, uint32_t z = destination.origin.z; if (texture->GetFormat().isCompressed) { size_t rowSize = copySize.width / blockInfo.width * blockInfo.byteSize; - Extent3D virtSize = texture->GetMipLevelVirtualSize(destination.mipLevel); + Extent3D virtSize = texture->GetMipLevelSingleSubresourceVirtualSize(destination.mipLevel); uint32_t width = std::min(copySize.width, virtSize.width - x); // In GLES glPixelStorei() doesn't affect CompressedTexSubImage*D() and diff --git a/src/dawn/native/opengl/ComputePipelineGL.cpp b/src/dawn/native/opengl/ComputePipelineGL.cpp index 35d2abda2f..08a7c89dde 100644 --- a/src/dawn/native/opengl/ComputePipelineGL.cpp +++ b/src/dawn/native/opengl/ComputePipelineGL.cpp @@ -29,16 +29,17 @@ ComputePipeline::~ComputePipeline() = default; void ComputePipeline::DestroyImpl() { ComputePipelineBase::DestroyImpl(); - DeleteProgram(ToBackend(GetDevice())->gl); + DeleteProgram(ToBackend(GetDevice())->GetGL()); } MaybeError ComputePipeline::Initialize() { - DAWN_TRY(InitializeBase(ToBackend(GetDevice())->gl, ToBackend(GetLayout()), GetAllStages())); + DAWN_TRY( + InitializeBase(ToBackend(GetDevice())->GetGL(), ToBackend(GetLayout()), GetAllStages())); return {}; } void ComputePipeline::ApplyNow() { - PipelineGL::ApplyNow(ToBackend(GetDevice())->gl); + PipelineGL::ApplyNow(ToBackend(GetDevice())->GetGL()); } } // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/ContextEGL.cpp b/src/dawn/native/opengl/ContextEGL.cpp new file mode 100644 index 0000000000..b2618a32c8 --- /dev/null +++ b/src/dawn/native/opengl/ContextEGL.cpp @@ -0,0 +1,81 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/opengl/ContextEGL.h" + +#include +#include + +#include "dawn/native/opengl/UtilsEGL.h" + +namespace dawn::native::opengl { + +ResultOrError> ContextEGL::Create(const EGLFunctions& egl, + EGLenum api) { + EGLDisplay display = egl.GetCurrentDisplay(); + + if (display == EGL_NO_DISPLAY) { + display = egl.GetDisplay(EGL_DEFAULT_DISPLAY); + } + + DAWN_INVALID_IF(display == EGL_NO_DISPLAY, "eglGetDisplay"); + + EGLint renderableType = api == EGL_OPENGL_ES_API ? EGL_OPENGL_ES3_BIT : EGL_OPENGL_BIT; + + EGLint major, minor; + + DAWN_TRY(CheckEGL(egl, egl.Initialize(display, &major, &minor), "eglInitialize")); + + // We use EGLImage unconditionally, which only became core in 1.5. + DAWN_INVALID_IF(major < 1 || (major == 1 && minor < 5), + "EGL version (%u.%u) must be at least 1.5", major, minor); + + // Since we're creating a surfaceless context, the only thing we really care + // about is the RENDERABLE_TYPE. + EGLint config_attribs[] = {EGL_RENDERABLE_TYPE, renderableType, EGL_NONE}; + + EGLint num_config; + EGLConfig config; + DAWN_TRY(CheckEGL(egl, egl.ChooseConfig(display, config_attribs, &config, 1, &num_config), + "eglChooseConfig")); + + DAWN_INVALID_IF(num_config == 0, "eglChooseConfig returned zero configs"); + + DAWN_TRY(CheckEGL(egl, egl.BindAPI(api), "eglBindAPI")); + + if (api == EGL_OPENGL_ES_API) { + major = 3; + minor = 1; + } else { + major = 4; + minor = 4; + } + EGLint attrib_list[] = { + EGL_CONTEXT_MAJOR_VERSION, major, EGL_CONTEXT_MINOR_VERSION, minor, EGL_NONE, EGL_NONE, + }; + EGLContext context = egl.CreateContext(display, config, EGL_NO_CONTEXT, attrib_list); + DAWN_TRY(CheckEGL(egl, context != EGL_NO_CONTEXT, "eglCreateContext")); + + return std::unique_ptr(new ContextEGL(egl, display, context)); +} + +void ContextEGL::MakeCurrent() { + egl.MakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, mContext); +} + +ContextEGL::~ContextEGL() { + egl.DestroyContext(mDisplay, mContext); +} + +} // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/ContextEGL.h b/src/dawn/native/opengl/ContextEGL.h new file mode 100644 index 0000000000..99fe5993dd --- /dev/null +++ b/src/dawn/native/opengl/ContextEGL.h @@ -0,0 +1,45 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_OPENGL_CONTEXTEGL_H_ +#define SRC_DAWN_NATIVE_OPENGL_CONTEXTEGL_H_ + +#include + +#include + +#include "dawn/native/opengl/DeviceGL.h" +#include "dawn/native/opengl/EGLFunctions.h" + +namespace dawn::native::opengl { + +class ContextEGL : public Device::Context { + public: + static ResultOrError> Create(const EGLFunctions& functions, + EGLenum api); + void MakeCurrent() override; + ~ContextEGL() override; + + private: + ContextEGL(const EGLFunctions& functions, EGLDisplay display, EGLContext context) + : egl(functions), mDisplay(display), mContext(context) {} + + const EGLFunctions egl; + EGLDisplay mDisplay; + EGLContext mContext; +}; + +} // namespace dawn::native::opengl + +#endif // SRC_DAWN_NATIVE_OPENGL_CONTEXTEGL_H_ diff --git a/src/dawn/native/opengl/DeviceGL.cpp b/src/dawn/native/opengl/DeviceGL.cpp index 274cc1aed5..0f2f5828bb 100644 --- a/src/dawn/native/opengl/DeviceGL.cpp +++ b/src/dawn/native/opengl/DeviceGL.cpp @@ -14,9 +14,12 @@ #include "dawn/native/opengl/DeviceGL.h" +#include "dawn/common/Log.h" + #include "dawn/native/BackendConnection.h" #include "dawn/native/BindGroupLayout.h" #include "dawn/native/ErrorData.h" +#include "dawn/native/Instance.h" #include "dawn/native/StagingBuffer.h" #include "dawn/native/opengl/BindGroupGL.h" #include "dawn/native/opengl/BindGroupLayoutGL.h" @@ -32,34 +35,146 @@ #include "dawn/native/opengl/SwapChainGL.h" #include "dawn/native/opengl/TextureGL.h" +namespace { + +void KHRONOS_APIENTRY OnGLDebugMessage(GLenum source, + GLenum type, + GLuint id, + GLenum severity, + GLsizei length, + const GLchar* message, + const void* userParam) { + const char* sourceText; + switch (source) { + case GL_DEBUG_SOURCE_API: + sourceText = "OpenGL"; + break; + case GL_DEBUG_SOURCE_WINDOW_SYSTEM: + sourceText = "Window System"; + break; + case GL_DEBUG_SOURCE_SHADER_COMPILER: + sourceText = "Shader Compiler"; + break; + case GL_DEBUG_SOURCE_THIRD_PARTY: + sourceText = "Third Party"; + break; + case GL_DEBUG_SOURCE_APPLICATION: + sourceText = "Application"; + break; + case GL_DEBUG_SOURCE_OTHER: + sourceText = "Other"; + break; + default: + sourceText = "UNKNOWN"; + break; + } + + const char* severityText; + switch (severity) { + case GL_DEBUG_SEVERITY_HIGH: + severityText = "High"; + break; + case GL_DEBUG_SEVERITY_MEDIUM: + severityText = "Medium"; + break; + case GL_DEBUG_SEVERITY_LOW: + severityText = "Low"; + break; + case GL_DEBUG_SEVERITY_NOTIFICATION: + severityText = "Notification"; + break; + default: + severityText = "UNKNOWN"; + break; + } + + if (type == GL_DEBUG_TYPE_ERROR) { + dawn::WarningLog() << "OpenGL error:" + << "\n Source: " << sourceText // + << "\n ID: " << id // + << "\n Severity: " << severityText // + << "\n Message: " << message; + + // Abort on an error when in Debug mode. + UNREACHABLE(); + } +} + +} // anonymous namespace + namespace dawn::native::opengl { // static ResultOrError> Device::Create(AdapterBase* adapter, const DeviceDescriptor* descriptor, - const OpenGLFunctions& functions) { - Ref device = AcquireRef(new Device(adapter, descriptor, functions)); + const OpenGLFunctions& functions, + std::unique_ptr context) { + Ref device = AcquireRef(new Device(adapter, descriptor, functions, std::move(context))); DAWN_TRY(device->Initialize(descriptor)); return device; } Device::Device(AdapterBase* adapter, const DeviceDescriptor* descriptor, - const OpenGLFunctions& functions) - : DeviceBase(adapter, descriptor), gl(functions) {} + const OpenGLFunctions& functions, + std::unique_ptr context) + : DeviceBase(adapter, descriptor), mGL(functions), mContext(std::move(context)) {} Device::~Device() { Destroy(); } MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { + const OpenGLFunctions& gl = GetGL(); InitTogglesFromDriver(); mFormatTable = BuildGLFormatTable(GetBGRAInternalFormat()); + // Use the debug output functionality to get notified about GL errors + // TODO(crbug.com/dawn/1475): add support for the KHR_debug and ARB_debug_output + // extensions + bool hasDebugOutput = gl.IsAtLeastGL(4, 3) || gl.IsAtLeastGLES(3, 2); + + if (GetAdapter()->GetInstance()->IsBackendValidationEnabled() && hasDebugOutput) { + gl.Enable(GL_DEBUG_OUTPUT); + gl.Enable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + + // Any GL error; dangerous undefined behavior; any shader compiler and linker errors + gl.DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, nullptr, + GL_TRUE); + + // Severe performance warnings; GLSL or other shader compiler and linker warnings; + // use of currently deprecated behavior + gl.DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_MEDIUM, 0, nullptr, + GL_TRUE); + + // Performance warnings from redundant state changes; trivial undefined behavior + // This is disabled because we do an incredible amount of redundant state changes. + gl.DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW, 0, nullptr, + GL_FALSE); + + // Any message which is not an error or performance concern + gl.DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_NOTIFICATION, 0, + nullptr, GL_FALSE); + gl.DebugMessageCallback(&OnGLDebugMessage, nullptr); + } + + // Set initial state. + gl.Enable(GL_DEPTH_TEST); + gl.Enable(GL_SCISSOR_TEST); + gl.Enable(GL_PRIMITIVE_RESTART_FIXED_INDEX); + if (gl.GetVersion().IsDesktop()) { + // These are not necessary on GLES. The functionality is enabled by default, and + // works by specifying sample counts and SRGB textures, respectively. + gl.Enable(GL_MULTISAMPLE); + // gl.Enable(GL_FRAMEBUFFER_SRGB); + } + gl.Enable(GL_SAMPLE_MASK); + return DeviceBase::Initialize(AcquireRef(new Queue(this, &descriptor->defaultQueue))); } void Device::InitTogglesFromDriver() { + const OpenGLFunctions& gl = GetGL(); bool supportsBaseVertex = gl.IsAtLeastGLES(3, 2) || gl.IsAtLeastGL(3, 2); bool supportsBaseInstance = gl.IsAtLeastGLES(3, 2) || gl.IsAtLeastGL(4, 2); @@ -124,6 +239,7 @@ const GLFormat& Device::GetGLFormat(const Format& format) { } GLenum Device::GetBGRAInternalFormat() const { + const OpenGLFunctions& gl = GetGL(); if (gl.IsGLExtensionSupported("GL_EXT_texture_format_BGRA8888") || gl.IsGLExtensionSupported("GL_APPLE_texture_format_BGRA8888")) { return GL_BGRA8_EXT; @@ -195,6 +311,7 @@ ResultOrError> Device::CreateTextureViewImpl( } void Device::SubmitFenceSync() { + const OpenGLFunctions& gl = GetGL(); GLsync sync = gl.FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); IncrementLastSubmittedCommandSerial(); mFencesInFlight.emplace(sync, GetLastSubmittedCommandSerial()); @@ -224,6 +341,7 @@ MaybeError Device::ValidateEGLImageCanBeWrapped(const TextureDescriptor* descrip } TextureBase* Device::CreateTextureWrappingEGLImage(const ExternalImageDescriptor* descriptor, ::EGLImage image) { + const OpenGLFunctions& gl = GetGL(); const TextureDescriptor* textureDescriptor = FromAPI(descriptor->cTextureDescriptor); if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) { @@ -264,6 +382,7 @@ MaybeError Device::TickImpl() { ResultOrError Device::CheckAndUpdateCompletedSerials() { ExecutionSerial fenceSerial{0}; + const OpenGLFunctions& gl = GetGL(); while (!mFencesInFlight.empty()) { auto [sync, tentativeSerial] = mFencesInFlight.front(); @@ -314,6 +433,7 @@ void Device::DestroyImpl() { } MaybeError Device::WaitForIdleForDestruction() { + const OpenGLFunctions& gl = GetGL(); gl.Finish(); DAWN_TRY(CheckPassedSerials()); ASSERT(mFencesInFlight.empty()); @@ -333,4 +453,11 @@ float Device::GetTimestampPeriodInNS() const { return 1.0f; } +const OpenGLFunctions& Device::GetGL() const { + if (mContext) { + mContext->MakeCurrent(); + } + return mGL; +} + } // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/DeviceGL.h b/src/dawn/native/opengl/DeviceGL.h index fb1f235efe..78abf1147a 100644 --- a/src/dawn/native/opengl/DeviceGL.h +++ b/src/dawn/native/opengl/DeviceGL.h @@ -29,7 +29,7 @@ #include "dawn/native/opengl/OpenGLFunctions.h" // Remove windows.h macros after glad's include of windows.h -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) #include "dawn/common/windows_with_undefs.h" #endif @@ -39,15 +39,18 @@ namespace dawn::native::opengl { class Device final : public DeviceBase { public: + class Context; static ResultOrError> Create(AdapterBase* adapter, const DeviceDescriptor* descriptor, - const OpenGLFunctions& functions); + const OpenGLFunctions& functions, + std::unique_ptr context); ~Device() override; MaybeError Initialize(const DeviceDescriptor* descriptor); - // Contains all the OpenGL entry points, glDoFoo is called via device->gl.DoFoo. - const OpenGLFunctions gl; + // Returns all the OpenGL entry points and ensures that the associated + // Context is current. + const OpenGLFunctions& GetGL() const; const GLFormat& GetGLFormat(const Format& format); @@ -80,10 +83,17 @@ class Device final : public DeviceBase { float GetTimestampPeriodInNS() const override; + class Context { + public: + virtual ~Context() {} + virtual void MakeCurrent() = 0; + }; + private: Device(AdapterBase* adapter, const DeviceDescriptor* descriptor, - const OpenGLFunctions& functions); + const OpenGLFunctions& functions, + std::unique_ptr context); ResultOrError> CreateBindGroupImpl( const BindGroupDescriptor* descriptor) override; @@ -121,9 +131,12 @@ class Device final : public DeviceBase { void DestroyImpl() override; MaybeError WaitForIdleForDestruction() override; + const OpenGLFunctions mGL; + std::queue> mFencesInFlight; GLFormatTable mFormatTable; + std::unique_ptr mContext = nullptr; }; } // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/EGLFunctions.cpp b/src/dawn/native/opengl/EGLFunctions.cpp new file mode 100644 index 0000000000..5796131d42 --- /dev/null +++ b/src/dawn/native/opengl/EGLFunctions.cpp @@ -0,0 +1,43 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/opengl/EGLFunctions.h" + +namespace dawn::native::opengl { + +void EGLFunctions::Init(void* (*getProc)(const char*)) { + GetProcAddress = reinterpret_cast(getProc); + BindAPI = reinterpret_cast(GetProcAddress("eglBindAPI")); + ChooseConfig = reinterpret_cast(GetProcAddress("eglChooseConfig")); + CreateContext = reinterpret_cast(GetProcAddress("eglCreateContext")); + CreatePbufferSurface = + reinterpret_cast(GetProcAddress("eglCreatePbufferSurface")); + CreatePlatformWindowSurface = reinterpret_cast( + GetProcAddress("eglCreatePlatformWindowSurface")); + DestroyContext = + reinterpret_cast(GetProcAddress("eglDestroyContext")); + GetConfigs = reinterpret_cast(GetProcAddress("eglGetConfigs")); + GetCurrentContext = + reinterpret_cast(GetProcAddress("eglGetCurrentContext")); + GetCurrentDisplay = + reinterpret_cast(GetProcAddress("eglGetCurrentDisplay")); + GetCurrentSurface = + reinterpret_cast(GetProcAddress("eglGetCurrentSurface")); + GetDisplay = reinterpret_cast(GetProcAddress("eglGetDisplay")); + GetError = reinterpret_cast(GetProcAddress("eglGetError")); + Initialize = reinterpret_cast(GetProcAddress("eglInitialize")); + MakeCurrent = reinterpret_cast(GetProcAddress("eglMakeCurrent")); +} + +} // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/EGLFunctions.h b/src/dawn/native/opengl/EGLFunctions.h new file mode 100644 index 0000000000..5c2688fb66 --- /dev/null +++ b/src/dawn/native/opengl/EGLFunctions.h @@ -0,0 +1,43 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_OPENGL_EGLFUNCTIONS_H_ +#define SRC_DAWN_NATIVE_OPENGL_EGLFUNCTIONS_H_ + +#include + +namespace dawn::native::opengl { + +struct EGLFunctions { + void Init(void* (*getProc)(const char*)); + PFNEGLBINDAPIPROC BindAPI; + PFNEGLCHOOSECONFIGPROC ChooseConfig; + PFNEGLCREATECONTEXTPROC CreateContext; + PFNEGLCREATEPLATFORMWINDOWSURFACEPROC CreatePlatformWindowSurface; + PFNEGLCREATEPBUFFERSURFACEPROC CreatePbufferSurface; + PFNEGLDESTROYCONTEXTPROC DestroyContext; + PFNEGLGETCONFIGSPROC GetConfigs; + PFNEGLGETCURRENTCONTEXTPROC GetCurrentContext; + PFNEGLGETCURRENTDISPLAYPROC GetCurrentDisplay; + PFNEGLGETCURRENTSURFACEPROC GetCurrentSurface; + PFNEGLGETDISPLAYPROC GetDisplay; + PFNEGLGETERRORPROC GetError; + PFNEGLGETPROCADDRESSPROC GetProcAddress; + PFNEGLINITIALIZEPROC Initialize; + PFNEGLMAKECURRENTPROC MakeCurrent; +}; + +} // namespace dawn::native::opengl + +#endif // SRC_DAWN_NATIVE_OPENGL_EGLFUNCTIONS_H_ diff --git a/src/dawn/native/opengl/GLFormat.cpp b/src/dawn/native/opengl/GLFormat.cpp index 6fbca79728..529cc35add 100644 --- a/src/dawn/native/opengl/GLFormat.cpp +++ b/src/dawn/native/opengl/GLFormat.cpp @@ -92,7 +92,6 @@ GLFormatTable BuildGLFormatTable(GLenum internalFormatForBGRA) { // Depth stencil formats AddFormat(wgpu::TextureFormat::Depth32Float, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, Type::DepthStencil); AddFormat(wgpu::TextureFormat::Depth24Plus, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, Type::DepthStencil); - AddFormat(wgpu::TextureFormat::Depth24UnormStencil8, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, Type::DepthStencil); AddFormat(wgpu::TextureFormat::Depth24PlusStencil8, GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, Type::DepthStencil); AddFormat(wgpu::TextureFormat::Depth16Unorm, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, Type::DepthStencil); AddFormat(wgpu::TextureFormat::Stencil8, GL_STENCIL_INDEX8, GL_STENCIL, GL_UNSIGNED_BYTE, Type::DepthStencil); diff --git a/src/dawn/native/opengl/GLFormat.h b/src/dawn/native/opengl/GLFormat.h index ea3db9aa86..6d1d81e58e 100644 --- a/src/dawn/native/opengl/GLFormat.h +++ b/src/dawn/native/opengl/GLFormat.h @@ -20,8 +20,6 @@ namespace dawn::native::opengl { -class Device; - struct GLFormat { GLenum internalFormat = 0; GLenum format = 0; diff --git a/src/dawn/native/opengl/NativeSwapChainImplGL.cpp b/src/dawn/native/opengl/NativeSwapChainImplGL.cpp index 409acf1ed7..05e377a076 100644 --- a/src/dawn/native/opengl/NativeSwapChainImplGL.cpp +++ b/src/dawn/native/opengl/NativeSwapChainImplGL.cpp @@ -24,13 +24,13 @@ NativeSwapChainImpl::NativeSwapChainImpl(Device* device, : mPresentCallback(present), mPresentUserdata(presentUserdata), mDevice(device) {} NativeSwapChainImpl::~NativeSwapChainImpl() { - const OpenGLFunctions& gl = mDevice->gl; + const OpenGLFunctions& gl = mDevice->GetGL(); gl.DeleteTextures(1, &mBackTexture); gl.DeleteFramebuffers(1, &mBackFBO); } void NativeSwapChainImpl::Init(DawnWSIContextGL* /*context*/) { - const OpenGLFunctions& gl = mDevice->gl; + const OpenGLFunctions& gl = mDevice->GetGL(); gl.GenTextures(1, &mBackTexture); gl.BindTexture(GL_TEXTURE_2D, mBackTexture); gl.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); @@ -53,7 +53,7 @@ DawnSwapChainError NativeSwapChainImpl::Configure(WGPUTextureFormat format, mWidth = width; mHeight = height; - const OpenGLFunctions& gl = mDevice->gl; + const OpenGLFunctions& gl = mDevice->GetGL(); gl.BindTexture(GL_TEXTURE_2D, mBackTexture); // Reallocate the texture gl.TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); @@ -67,7 +67,7 @@ DawnSwapChainError NativeSwapChainImpl::GetNextTexture(DawnSwapChainNextTexture* } DawnSwapChainError NativeSwapChainImpl::Present() { - const OpenGLFunctions& gl = mDevice->gl; + const OpenGLFunctions& gl = mDevice->GetGL(); gl.BindFramebuffer(GL_READ_FRAMEBUFFER, mBackFBO); gl.BindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); gl.Scissor(0, 0, mWidth, mHeight); diff --git a/src/dawn/native/opengl/OpenGLBackend.cpp b/src/dawn/native/opengl/OpenGLBackend.cpp index c77c1d0f79..87cd37f765 100644 --- a/src/dawn/native/opengl/OpenGLBackend.cpp +++ b/src/dawn/native/opengl/OpenGLBackend.cpp @@ -23,11 +23,11 @@ namespace dawn::native::opengl { -AdapterDiscoveryOptions::AdapterDiscoveryOptions() - : AdapterDiscoveryOptionsBase(WGPUBackendType_OpenGL) {} +AdapterDiscoveryOptions::AdapterDiscoveryOptions(WGPUBackendType type) + : AdapterDiscoveryOptionsBase(type) {} AdapterDiscoveryOptionsES::AdapterDiscoveryOptionsES() - : AdapterDiscoveryOptionsBase(WGPUBackendType_OpenGLES) {} + : AdapterDiscoveryOptions(WGPUBackendType_OpenGLES) {} DawnSwapChainImplementation CreateNativeSwapChainImpl(WGPUDevice device, PresentCallback present, diff --git a/src/dawn/native/opengl/OpenGLVersion.cpp b/src/dawn/native/opengl/OpenGLVersion.cpp index 297b5fb7b6..80857064bd 100644 --- a/src/dawn/native/opengl/OpenGLVersion.cpp +++ b/src/dawn/native/opengl/OpenGLVersion.cpp @@ -26,9 +26,9 @@ MaybeError OpenGLVersion::Initialize(GetProcAddress getProc) { return DAWN_INTERNAL_ERROR("Couldn't load glGetString"); } - std::string version = reinterpret_cast(getString(GL_VERSION)); + const char* version = reinterpret_cast(getString(GL_VERSION)); - if (version.find("OpenGL ES") != std::string::npos) { + if (strstr(version, "OpenGL ES") != nullptr) { // ES spec states that the GL_VERSION string will be in the following format: // "OpenGL ES N.M vendor-specific information" mStandard = Standard::ES; @@ -36,7 +36,7 @@ MaybeError OpenGLVersion::Initialize(GetProcAddress getProc) { mMinorVersion = version[12] - '0'; // The minor version shouldn't get to two digits. - ASSERT(version.size() <= 13 || !isdigit(version[13])); + ASSERT(strlen(version) <= 13 || !isdigit(version[13])); } else { // OpenGL spec states the GL_VERSION string will be in the following format: // @@ -48,7 +48,7 @@ MaybeError OpenGLVersion::Initialize(GetProcAddress getProc) { mMinorVersion = version[2] - '0'; // The minor version shouldn't get to two digits. - ASSERT(version.size() <= 3 || !isdigit(version[3])); + ASSERT(strlen(version) <= 3 || !isdigit(version[3])); } return {}; @@ -62,6 +62,10 @@ bool OpenGLVersion::IsES() const { return mStandard == Standard::ES; } +OpenGLVersion::Standard OpenGLVersion::GetStandard() const { + return mStandard; +} + uint32_t OpenGLVersion::GetMajor() const { return mMajorVersion; } diff --git a/src/dawn/native/opengl/OpenGLVersion.h b/src/dawn/native/opengl/OpenGLVersion.h index a9a296fb1f..5f490abc99 100644 --- a/src/dawn/native/opengl/OpenGLVersion.h +++ b/src/dawn/native/opengl/OpenGLVersion.h @@ -21,19 +21,21 @@ namespace dawn::native::opengl { struct OpenGLVersion { public: + enum class Standard { + Desktop, + ES, + }; + MaybeError Initialize(GetProcAddress getProc); bool IsDesktop() const; bool IsES() const; + Standard GetStandard() const; uint32_t GetMajor() const; uint32_t GetMinor() const; bool IsAtLeast(uint32_t majorVersion, uint32_t minorVersion) const; private: - enum class Standard { - Desktop, - ES, - }; uint32_t mMajorVersion; uint32_t mMinorVersion; Standard mStandard; diff --git a/src/dawn/native/opengl/PipelineGL.cpp b/src/dawn/native/opengl/PipelineGL.cpp index 2ddabce665..701102c6bc 100644 --- a/src/dawn/native/opengl/PipelineGL.cpp +++ b/src/dawn/native/opengl/PipelineGL.cpp @@ -30,22 +30,6 @@ namespace dawn::native::opengl { -namespace { - -GLenum GLShaderType(SingleShaderStage stage) { - switch (stage) { - case SingleShaderStage::Vertex: - return GL_VERTEX_SHADER; - case SingleShaderStage::Fragment: - return GL_FRAGMENT_SHADER; - case SingleShaderStage::Compute: - return GL_COMPUTE_SHADER; - } - UNREACHABLE(); -} - -} // namespace - PipelineGL::PipelineGL() : mProgram(0) {} PipelineGL::~PipelineGL() = default; @@ -53,28 +37,6 @@ PipelineGL::~PipelineGL() = default; MaybeError PipelineGL::InitializeBase(const OpenGLFunctions& gl, const PipelineLayout* layout, const PerStage& stages) { - auto CreateShader = [](const OpenGLFunctions& gl, GLenum type, - const char* source) -> ResultOrError { - GLuint shader = gl.CreateShader(type); - gl.ShaderSource(shader, 1, &source, nullptr); - gl.CompileShader(shader); - - GLint compileStatus = GL_FALSE; - gl.GetShaderiv(shader, GL_COMPILE_STATUS, &compileStatus); - if (compileStatus == GL_FALSE) { - GLint infoLogLength = 0; - gl.GetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength); - - if (infoLogLength > 1) { - std::vector buffer(infoLogLength); - gl.GetShaderInfoLog(shader, infoLogLength, nullptr, &buffer[0]); - return DAWN_FORMAT_VALIDATION_ERROR("%s\nProgram compilation failed:\n%s", source, - buffer.data()); - } - } - return shader; - }; - mProgram = gl.CreateProgram(); // Compute the set of active stages. @@ -91,12 +53,10 @@ MaybeError PipelineGL::InitializeBase(const OpenGLFunctions& gl, std::vector glShaders; for (SingleShaderStage stage : IterateStages(activeStages)) { const ShaderModule* module = ToBackend(stages[stage].module.Get()); - std::string glsl; - DAWN_TRY_ASSIGN(glsl, module->TranslateToGLSL(stages[stage].entryPoint.c_str(), stage, - &combinedSamplers[stage], layout, - &needsPlaceholderSampler)); GLuint shader; - DAWN_TRY_ASSIGN(shader, CreateShader(gl, GLShaderType(stage), glsl.c_str())); + DAWN_TRY_ASSIGN(shader, + module->CompileShader(gl, stages[stage], stage, &combinedSamplers[stage], + layout, &needsPlaceholderSampler)); gl.AttachShader(mProgram, shader); glShaders.push_back(shader); } diff --git a/src/dawn/native/opengl/QueueGL.cpp b/src/dawn/native/opengl/QueueGL.cpp index 68eb918ba7..38fec619a0 100644 --- a/src/dawn/native/opengl/QueueGL.cpp +++ b/src/dawn/native/opengl/QueueGL.cpp @@ -42,7 +42,7 @@ MaybeError Queue::WriteBufferImpl(BufferBase* buffer, uint64_t bufferOffset, const void* data, size_t size) { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); ToBackend(buffer)->EnsureDataInitializedAsDestination(bufferOffset, size); @@ -70,7 +70,7 @@ MaybeError Queue::WriteTextureImpl(const ImageCopyTexture& destination, } else { ToBackend(destination.texture)->EnsureSubresourceContentInitialized(range); } - DoTexSubImage(ToBackend(GetDevice())->gl, textureCopy, data, dataLayout, writeSizePixel); + DoTexSubImage(ToBackend(GetDevice())->GetGL(), textureCopy, data, dataLayout, writeSizePixel); ToBackend(destination.texture)->Touch(); return {}; } diff --git a/src/dawn/native/opengl/RenderPipelineGL.cpp b/src/dawn/native/opengl/RenderPipelineGL.cpp index 6f93260e3b..59927297fa 100644 --- a/src/dawn/native/opengl/RenderPipelineGL.cpp +++ b/src/dawn/native/opengl/RenderPipelineGL.cpp @@ -226,7 +226,8 @@ RenderPipeline::RenderPipeline(Device* device, const RenderPipelineDescriptor* d mGlPrimitiveTopology(GLPrimitiveTopology(GetPrimitiveTopology())) {} MaybeError RenderPipeline::Initialize() { - DAWN_TRY(InitializeBase(ToBackend(GetDevice())->gl, ToBackend(GetLayout()), GetAllStages())); + DAWN_TRY( + InitializeBase(ToBackend(GetDevice())->GetGL(), ToBackend(GetLayout()), GetAllStages())); CreateVAOForVertexState(); return {}; } @@ -235,7 +236,7 @@ RenderPipeline::~RenderPipeline() = default; void RenderPipeline::DestroyImpl() { RenderPipelineBase::DestroyImpl(); - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); gl.DeleteVertexArrays(1, &mVertexArrayObject); gl.BindVertexArray(0); DeleteProgram(gl); @@ -252,7 +253,7 @@ RenderPipeline::GetAttributesUsingVertexBuffer(VertexBufferSlot slot) const { } void RenderPipeline::CreateVAOForVertexState() { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); gl.GenVertexArrays(1, &mVertexArrayObject); gl.BindVertexArray(mVertexArrayObject); @@ -276,13 +277,15 @@ void RenderPipeline::CreateVAOForVertexState() { case wgpu::VertexStepMode::Instance: gl.VertexAttribDivisor(glAttrib, 1); break; + case wgpu::VertexStepMode::VertexBufferNotUsed: + UNREACHABLE(); } } } } void RenderPipeline::ApplyNow(PersistentPipelineState& persistentPipelineState) { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); PipelineGL::ApplyNow(gl); ASSERT(mVertexArrayObject); diff --git a/src/dawn/native/opengl/SamplerGL.cpp b/src/dawn/native/opengl/SamplerGL.cpp index b40e1d6592..2f8c59b948 100644 --- a/src/dawn/native/opengl/SamplerGL.cpp +++ b/src/dawn/native/opengl/SamplerGL.cpp @@ -67,7 +67,7 @@ GLenum WrapMode(wgpu::AddressMode mode) { Sampler::Sampler(Device* device, const SamplerDescriptor* descriptor) : SamplerBase(device, descriptor) { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); gl.GenSamplers(1, &mFilteringHandle); SetupGLSampler(mFilteringHandle, descriptor, false); @@ -80,7 +80,7 @@ Sampler::~Sampler() = default; void Sampler::DestroyImpl() { SamplerBase::DestroyImpl(); - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); gl.DeleteSamplers(1, &mFilteringHandle); gl.DeleteSamplers(1, &mNonFilteringHandle); } @@ -89,7 +89,7 @@ void Sampler::SetupGLSampler(GLuint sampler, const SamplerDescriptor* descriptor, bool forceNearest) { Device* device = ToBackend(GetDevice()); - const OpenGLFunctions& gl = device->gl; + const OpenGLFunctions& gl = device->GetGL(); if (forceNearest) { gl.SamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, GL_NEAREST); diff --git a/src/dawn/native/opengl/ShaderModuleGL.cpp b/src/dawn/native/opengl/ShaderModuleGL.cpp index 253600b6c3..6c427eeb03 100644 --- a/src/dawn/native/opengl/ShaderModuleGL.cpp +++ b/src/dawn/native/opengl/ShaderModuleGL.cpp @@ -18,14 +18,68 @@ #include #include "dawn/native/BindGroupLayout.h" +#include "dawn/native/CacheRequest.h" +#include "dawn/native/Pipeline.h" #include "dawn/native/TintUtils.h" #include "dawn/native/opengl/DeviceGL.h" #include "dawn/native/opengl/PipelineLayoutGL.h" +#include "dawn/native/stream/BlobSource.h" +#include "dawn/native/stream/ByteVectorSink.h" #include "dawn/platform/DawnPlatform.h" #include "dawn/platform/tracing/TraceEvent.h" #include "tint/tint.h" +namespace dawn::native { +namespace { + +GLenum GLShaderType(SingleShaderStage stage) { + switch (stage) { + case SingleShaderStage::Vertex: + return GL_VERTEX_SHADER; + case SingleShaderStage::Fragment: + return GL_FRAGMENT_SHADER; + case SingleShaderStage::Compute: + return GL_COMPUTE_SHADER; + } + UNREACHABLE(); +} + +tint::writer::glsl::Version::Standard ToTintGLStandard(opengl::OpenGLVersion::Standard standard) { + switch (standard) { + case opengl::OpenGLVersion::Standard::Desktop: + return tint::writer::glsl::Version::Standard::kDesktop; + case opengl::OpenGLVersion::Standard::ES: + return tint::writer::glsl::Version::Standard::kES; + } + UNREACHABLE(); +} + +using BindingMap = std::unordered_map; + +#define GLSL_COMPILATION_REQUEST_MEMBERS(X) \ + X(const tint::Program*, inputProgram) \ + X(std::string, entryPointName) \ + X(tint::transform::MultiplanarExternalTexture::BindingsMap, externalTextureBindings) \ + X(BindingMap, glBindings) \ + X(opengl::OpenGLVersion::Standard, glVersionStandard) \ + X(uint32_t, glVersionMajor) \ + X(uint32_t, glVersionMinor) + +DAWN_MAKE_CACHE_REQUEST(GLSLCompilationRequest, GLSL_COMPILATION_REQUEST_MEMBERS); +#undef GLSL_COMPILATION_REQUEST_MEMBERS + +#define GLSL_COMPILATION_MEMBERS(X) \ + X(std::string, glsl) \ + X(bool, needsPlaceholderSampler) \ + X(opengl::CombinedSamplerInfo, combinedSamplerInfo) + +DAWN_SERIALIZABLE(struct, GLSLCompilation, GLSL_COMPILATION_MEMBERS){}; +#undef GLSL_COMPILATION_MEMBERS + +} // namespace +} // namespace dawn::native + namespace dawn::native::opengl { std::string GetBindingName(BindGroupIndex group, BindingNumber bindingNumber) { @@ -81,99 +135,146 @@ MaybeError ShaderModule::Initialize(ShaderModuleParseResult* parseResult, return {}; } -ResultOrError ShaderModule::TranslateToGLSL(const char* entryPointName, - SingleShaderStage stage, - CombinedSamplerInfo* combinedSamplers, - const PipelineLayout* layout, - bool* needsPlaceholderSampler) const { +ResultOrError ShaderModule::CompileShader(const OpenGLFunctions& gl, + const ProgrammableStage& programmableStage, + SingleShaderStage stage, + CombinedSamplerInfo* combinedSamplers, + const PipelineLayout* layout, + bool* needsPlaceholderSampler) const { TRACE_EVENT0(GetDevice()->GetPlatform(), General, "TranslateToGLSL"); - tint::transform::Manager transformManager; - tint::transform::DataMap transformInputs; - AddExternalTextureTransform(layout, &transformManager, &transformInputs); - - tint::Program program; - DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, GetTintProgram(), transformInputs, - nullptr, nullptr)); - const OpenGLVersion& version = ToBackend(GetDevice())->gl.GetVersion(); - - tint::writer::glsl::Options tintOptions; - using Version = tint::writer::glsl::Version; - tintOptions.version = - Version(version.IsDesktop() ? Version::Standard::kDesktop : Version::Standard::kES, - version.GetMajor(), version.GetMinor()); + const OpenGLVersion& version = ToBackend(GetDevice())->GetGL().GetVersion(); using tint::transform::BindingPoint; - // When textures are accessed without a sampler (e.g., textureLoad()), - // GetSamplerTextureUses() will return this sentinel value. - BindingPoint placeholderBindingPoint{static_cast(kMaxBindGroupsTyped), 0}; - - tint::inspector::Inspector inspector(&program); - // Find all the sampler/texture pairs for this entry point, and create - // CombinedSamplers for them. CombinedSampler records the binding points - // of the original texture and sampler, and generates a unique name. The - // corresponding uniforms will be retrieved by these generated names - // in PipelineGL. Any texture-only references will have - // "usePlaceholderSampler" set to true, and only the texture binding point - // will be used in naming them. In addition, Dawn will bind a - // non-filtering sampler for them (see PipelineGL). - auto uses = inspector.GetSamplerTextureUses(entryPointName, placeholderBindingPoint); - for (const auto& use : uses) { - combinedSamplers->emplace_back(); - - CombinedSampler* info = &combinedSamplers->back(); - if (use.sampler_binding_point == placeholderBindingPoint) { - info->usePlaceholderSampler = true; - *needsPlaceholderSampler = true; - } else { - info->usePlaceholderSampler = false; - } - info->samplerLocation.group = BindGroupIndex(use.sampler_binding_point.group); - info->samplerLocation.binding = BindingNumber(use.sampler_binding_point.binding); - info->textureLocation.group = BindGroupIndex(use.texture_binding_point.group); - info->textureLocation.binding = BindingNumber(use.texture_binding_point.binding); - tintOptions.binding_map[use] = info->GetName(); - } - if (*needsPlaceholderSampler) { - tintOptions.placeholder_binding_point = placeholderBindingPoint; - } - // Since (non-Vulkan) GLSL does not support descriptor sets, generate a // mapping from the original group/binding pair to a binding-only // value. This mapping will be used by Tint to remap all global // variables to the 1D space. + const BindingInfoArray& moduleBindingInfo = + GetEntryPoint(programmableStage.entryPoint).bindings; + std::unordered_map glBindings; for (BindGroupIndex group : IterateBitSet(layout->GetBindGroupLayoutsMask())) { - const BindGroupLayoutBase::BindingMap& bindingMap = - layout->GetBindGroupLayout(group)->GetBindingMap(); - for (const auto& it : bindingMap) { - BindingNumber bindingNumber = it.first; - BindingIndex bindingIndex = it.second; - const BindingInfo& bindingInfo = - layout->GetBindGroupLayout(group)->GetBindingInfo(bindingIndex); - if (!(bindingInfo.visibility & StageBit(stage))) { - continue; - } - - uint32_t shaderIndex = layout->GetBindingIndexInfo()[group][bindingIndex]; + const BindGroupLayoutBase* bgl = layout->GetBindGroupLayout(group); + const auto& groupBindingInfo = moduleBindingInfo[group]; + for (const auto& [bindingNumber, bindingInfo] : groupBindingInfo) { + BindingIndex bindingIndex = bgl->GetBindingIndex(bindingNumber); + GLuint shaderIndex = layout->GetBindingIndexInfo()[group][bindingIndex]; BindingPoint srcBindingPoint{static_cast(group), static_cast(bindingNumber)}; BindingPoint dstBindingPoint{0, shaderIndex}; - tintOptions.binding_points.emplace(srcBindingPoint, dstBindingPoint); + if (srcBindingPoint != dstBindingPoint) { + glBindings.emplace(srcBindingPoint, dstBindingPoint); + } } - tintOptions.allow_collisions = true; } - auto result = tint::writer::glsl::Generate(&program, tintOptions, entryPointName); - DAWN_INVALID_IF(!result.success, "An error occured while generating GLSL: %s.", result.error); - std::string glsl = std::move(result.glsl); + + GLSLCompilationRequest req = {}; + req.inputProgram = GetTintProgram(); + req.entryPointName = programmableStage.entryPoint; + req.externalTextureBindings = BuildExternalTextureTransformBindings(layout); + req.glBindings = std::move(glBindings); + req.glVersionStandard = version.GetStandard(); + req.glVersionMajor = version.GetMajor(); + req.glVersionMinor = version.GetMinor(); + + CacheResult compilationResult; + DAWN_TRY_LOAD_OR_RUN( + compilationResult, GetDevice(), std::move(req), GLSLCompilation::FromBlob, + [](GLSLCompilationRequest r) -> ResultOrError { + tint::transform::Manager transformManager; + tint::transform::DataMap transformInputs; + + if (!r.externalTextureBindings.empty()) { + transformManager.Add(); + transformInputs.Add( + std::move(r.externalTextureBindings)); + } + + tint::Program program; + DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, r.inputProgram, + transformInputs, nullptr, nullptr)); + + tint::writer::glsl::Options tintOptions; + tintOptions.version = tint::writer::glsl::Version(ToTintGLStandard(r.glVersionStandard), + r.glVersionMajor, r.glVersionMinor); + + // When textures are accessed without a sampler (e.g., textureLoad()), + // GetSamplerTextureUses() will return this sentinel value. + BindingPoint placeholderBindingPoint{static_cast(kMaxBindGroupsTyped), 0}; + + bool needsPlaceholderSampler = false; + tint::inspector::Inspector inspector(&program); + // Find all the sampler/texture pairs for this entry point, and create + // CombinedSamplers for them. CombinedSampler records the binding points + // of the original texture and sampler, and generates a unique name. The + // corresponding uniforms will be retrieved by these generated names + // in PipelineGL. Any texture-only references will have + // "usePlaceholderSampler" set to true, and only the texture binding point + // will be used in naming them. In addition, Dawn will bind a + // non-filtering sampler for them (see PipelineGL). + auto uses = inspector.GetSamplerTextureUses(r.entryPointName, placeholderBindingPoint); + CombinedSamplerInfo combinedSamplerInfo; + for (const auto& use : uses) { + combinedSamplerInfo.emplace_back(); + + CombinedSampler* info = &combinedSamplerInfo.back(); + if (use.sampler_binding_point == placeholderBindingPoint) { + info->usePlaceholderSampler = true; + needsPlaceholderSampler = true; + tintOptions.placeholder_binding_point = placeholderBindingPoint; + } else { + info->usePlaceholderSampler = false; + } + info->samplerLocation.group = BindGroupIndex(use.sampler_binding_point.group); + info->samplerLocation.binding = BindingNumber(use.sampler_binding_point.binding); + info->textureLocation.group = BindGroupIndex(use.texture_binding_point.group); + info->textureLocation.binding = BindingNumber(use.texture_binding_point.binding); + tintOptions.binding_map[use] = info->GetName(); + } + tintOptions.binding_points = std::move(r.glBindings); + tintOptions.allow_collisions = true; + + auto result = tint::writer::glsl::Generate(&program, tintOptions, r.entryPointName); + DAWN_INVALID_IF(!result.success, "An error occured while generating GLSL: %s.", + result.error); + + return GLSLCompilation{ + {std::move(result.glsl), needsPlaceholderSampler, std::move(combinedSamplerInfo)}}; + }); if (GetDevice()->IsToggleEnabled(Toggle::DumpShaders)) { std::ostringstream dumpedMsg; - dumpedMsg << "/* Dumped generated GLSL */" << std::endl << glsl; + dumpedMsg << "/* Dumped generated GLSL */" << std::endl << compilationResult->glsl; GetDevice()->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str()); } - return glsl; + GLuint shader = gl.CreateShader(GLShaderType(stage)); + const char* source = compilationResult->glsl.c_str(); + gl.ShaderSource(shader, 1, &source, nullptr); + gl.CompileShader(shader); + + GLint compileStatus = GL_FALSE; + gl.GetShaderiv(shader, GL_COMPILE_STATUS, &compileStatus); + if (compileStatus == GL_FALSE) { + GLint infoLogLength = 0; + gl.GetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength); + + if (infoLogLength > 1) { + std::vector buffer(infoLogLength); + gl.GetShaderInfoLog(shader, infoLogLength, nullptr, &buffer[0]); + gl.DeleteShader(shader); + return DAWN_FORMAT_VALIDATION_ERROR("%s\nProgram compilation failed:\n%s", source, + buffer.data()); + } + } + + if (BlobCache* cache = GetDevice()->GetBlobCache()) { + cache->EnsureStored(compilationResult); + } + *needsPlaceholderSampler = compilationResult->needsPlaceholderSampler; + *combinedSamplers = std::move(compilationResult->combinedSamplerInfo); + return shader; } } // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/ShaderModuleGL.h b/src/dawn/native/opengl/ShaderModuleGL.h index 4dcff097fe..b19b4c62c8 100644 --- a/src/dawn/native/opengl/ShaderModuleGL.h +++ b/src/dawn/native/opengl/ShaderModuleGL.h @@ -20,38 +20,52 @@ #include #include +#include "dawn/native/Serializable.h" #include "dawn/native/ShaderModule.h" - #include "dawn/native/opengl/opengl_platform.h" -namespace dawn::native::opengl { +namespace dawn::native { + +struct ProgrammableStage; + +namespace stream { +class Sink; +class Source; +} // namespace stream + +namespace opengl { class Device; class PipelineLayout; +struct OpenGLFunctions; std::string GetBindingName(BindGroupIndex group, BindingNumber bindingNumber); -struct BindingLocation { - BindGroupIndex group; - BindingNumber binding; -}; +#define BINDING_LOCATION_MEMBERS(X) \ + X(BindGroupIndex, group) \ + X(BindingNumber, binding) +DAWN_SERIALIZABLE(struct, BindingLocation, BINDING_LOCATION_MEMBERS){}; +#undef BINDING_LOCATION_MEMBERS + bool operator<(const BindingLocation& a, const BindingLocation& b); -struct CombinedSampler { - BindingLocation samplerLocation; - BindingLocation textureLocation; - // OpenGL requires a sampler with texelFetch. If this is true, the developer did not provide - // one and Dawn should bind a placeholder non-filtering sampler. |samplerLocation| is - // unused. - bool usePlaceholderSampler; +#define COMBINED_SAMPLER_MEMBERS(X) \ + X(BindingLocation, samplerLocation) \ + X(BindingLocation, textureLocation) \ + /* OpenGL requires a sampler with texelFetch. If this is true, the developer did not */ \ + /* provide one and Dawn should bind a placeholder non-filtering sampler; */ \ + /* |samplerLocation| is unused. */ \ + X(bool, usePlaceholderSampler) + +DAWN_SERIALIZABLE(struct, CombinedSampler, COMBINED_SAMPLER_MEMBERS) { std::string GetName() const; }; +#undef COMBINED_SAMPLER_MEMBERS + bool operator<(const CombinedSampler& a, const CombinedSampler& b); using CombinedSamplerInfo = std::vector; -using BindingInfoArrayTable = std::unordered_map>; - class ShaderModule final : public ShaderModuleBase { public: static ResultOrError> Create(Device* device, @@ -59,11 +73,12 @@ class ShaderModule final : public ShaderModuleBase { ShaderModuleParseResult* parseResult, OwnedCompilationMessages* compilationMessages); - ResultOrError TranslateToGLSL(const char* entryPointName, - SingleShaderStage stage, - CombinedSamplerInfo* combinedSamplers, - const PipelineLayout* layout, - bool* needsPlaceholderSampler) const; + ResultOrError CompileShader(const OpenGLFunctions& gl, + const ProgrammableStage& programmableStage, + SingleShaderStage stage, + CombinedSamplerInfo* combinedSamplers, + const PipelineLayout* layout, + bool* needsPlaceholderSampler) const; private: ShaderModule(Device* device, const ShaderModuleDescriptor* descriptor); @@ -72,6 +87,7 @@ class ShaderModule final : public ShaderModuleBase { OwnedCompilationMessages* compilationMessages); }; -} // namespace dawn::native::opengl +} // namespace opengl +} // namespace dawn::native #endif // SRC_DAWN_NATIVE_OPENGL_SHADERMODULEGL_H_ diff --git a/src/dawn/native/opengl/TextureGL.cpp b/src/dawn/native/opengl/TextureGL.cpp index a6bea67422..246b515595 100644 --- a/src/dawn/native/opengl/TextureGL.cpp +++ b/src/dawn/native/opengl/TextureGL.cpp @@ -83,12 +83,6 @@ GLenum TargetForTextureViewDimension(wgpu::TextureViewDimension dimension, UNREACHABLE(); } -GLuint GenTexture(const OpenGLFunctions& gl) { - GLuint handle = 0; - gl.GenTextures(1, &handle); - return handle; -} - bool RequiresCreatingNewTextureView(const TextureBase* texture, const TextureViewDescriptor* textureViewDescriptor) { constexpr wgpu::TextureUsage kShaderUsageNeedsView = @@ -179,9 +173,10 @@ void AllocateTexture(const OpenGLFunctions& gl, // Texture Texture::Texture(Device* device, const TextureDescriptor* descriptor) - : Texture(device, descriptor, GenTexture(device->gl), TextureState::OwnedInternal) { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + : Texture(device, descriptor, 0, TextureState::OwnedInternal) { + const OpenGLFunctions& gl = device->GetGL(); + gl.GenTextures(1, &mHandle); uint32_t levels = GetNumMipLevels(); const GLFormat& glFormat = GetGLFormat(); @@ -221,7 +216,8 @@ Texture::~Texture() {} void Texture::DestroyImpl() { TextureBase::DestroyImpl(); if (GetTextureState() == TextureState::OwnedInternal) { - ToBackend(GetDevice())->gl.DeleteTextures(1, &mHandle); + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); + gl.DeleteTextures(1, &mHandle); mHandle = 0; } } @@ -246,7 +242,7 @@ MaybeError Texture::ClearTexture(const SubresourceRange& range, } Device* device = ToBackend(GetDevice()); - const OpenGLFunctions& gl = device->gl; + const OpenGLFunctions& gl = device->GetGL(); uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1; float fClearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0.f : 1.f; @@ -378,7 +374,7 @@ MaybeError Texture::ClearTexture(const SubresourceRange& range, const GLFormat& glFormat = GetGLFormat(); for (uint32_t level = range.baseMipLevel; level < range.baseMipLevel + range.levelCount; ++level) { - Extent3D mipSize = GetMipLevelPhysicalSize(level); + Extent3D mipSize = GetMipLevelSingleSubresourcePhysicalSize(level); for (uint32_t layer = range.baseArrayLayer; layer < range.baseArrayLayer + range.layerCount; ++layer) { if (clearValue == TextureBase::ClearValue::Zero && @@ -448,7 +444,8 @@ MaybeError Texture::ClearTexture(const SubresourceRange& range, DoClear(); break; case wgpu::TextureDimension::e3D: - uint32_t depth = GetMipLevelVirtualSize(level).depthOrArrayLayers; + uint32_t depth = GetMipLevelSingleSubresourceVirtualSize(level) + .depthOrArrayLayers; for (GLint z = 0; z < static_cast(depth); ++z) { gl.FramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, attachment, GetHandle(), level, z); @@ -477,7 +474,7 @@ MaybeError Texture::ClearTexture(const SubresourceRange& range, const TexelBlockInfo& blockInfo = GetFormat().GetAspectInfo(Aspect::Color).block; ASSERT(kTextureBytesPerRowAlignment % blockInfo.byteSize == 0); - Extent3D largestMipSize = GetMipLevelPhysicalSize(range.baseMipLevel); + Extent3D largestMipSize = GetMipLevelSingleSubresourcePhysicalSize(range.baseMipLevel); uint32_t bytesPerRow = Align((largestMipSize.width / blockInfo.width) * blockInfo.byteSize, 4); @@ -521,7 +518,7 @@ MaybeError Texture::ClearTexture(const SubresourceRange& range, dataLayout.bytesPerRow = bytesPerRow; dataLayout.rowsPerImage = largestMipSize.height; - Extent3D mipSize = GetMipLevelPhysicalSize(level); + Extent3D mipSize = GetMipLevelSingleSubresourcePhysicalSize(level); for (uint32_t layer = range.baseArrayLayer; layer < range.baseArrayLayer + range.layerCount; ++layer) { @@ -533,7 +530,7 @@ MaybeError Texture::ClearTexture(const SubresourceRange& range, } textureCopy.origin.z = layer; - DoTexSubImage(ToBackend(GetDevice())->gl, textureCopy, 0, dataLayout, mipSize); + DoTexSubImage(gl, textureCopy, 0, dataLayout, mipSize); } } gl.BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); @@ -570,9 +567,9 @@ TextureView::TextureView(TextureBase* texture, const TextureViewDescriptor* desc if (!RequiresCreatingNewTextureView(texture, descriptor)) { mHandle = ToBackend(texture)->GetHandle(); } else { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); if (gl.IsAtLeastGL(4, 3)) { - mHandle = GenTexture(gl); + gl.GenTextures(1, &mHandle); const Texture* textureGL = ToBackend(texture); gl.TextureView(mHandle, mTarget, textureGL->GetHandle(), GetInternalFormat(), descriptor->baseMipLevel, descriptor->mipLevelCount, @@ -591,7 +588,8 @@ TextureView::~TextureView() {} void TextureView::DestroyImpl() { TextureViewBase::DestroyImpl(); if (mOwnsHandle) { - ToBackend(GetDevice())->gl.DeleteTextures(1, &mHandle); + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); + gl.DeleteTextures(1, &mHandle); } } @@ -605,7 +603,7 @@ GLenum TextureView::GetGLTarget() const { } void TextureView::BindToFramebuffer(GLenum target, GLenum attachment) { - const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; + const OpenGLFunctions& gl = ToBackend(GetDevice())->GetGL(); // Use the base texture where possible to minimize the amount of copying required on GLES. bool useOwnView = GetFormat().format != GetTexture()->GetFormat().format && @@ -647,7 +645,7 @@ void TextureView::CopyIfNeeded() { } Device* device = ToBackend(GetDevice()); - const OpenGLFunctions& gl = device->gl; + const OpenGLFunctions& gl = device->GetGL(); uint32_t srcLevel = GetBaseMipLevel(); uint32_t numLevels = GetLevelCount(); @@ -656,7 +654,7 @@ void TextureView::CopyIfNeeded() { Extent3D size{width, height, GetLayerCount()}; if (mHandle == 0) { - mHandle = GenTexture(gl); + gl.GenTextures(1, &mHandle); gl.BindTexture(mTarget, mHandle); AllocateTexture(gl, mTarget, texture->GetSampleCount(), numLevels, GetInternalFormat(), size); diff --git a/src/dawn/native/opengl/UtilsEGL.cpp b/src/dawn/native/opengl/UtilsEGL.cpp new file mode 100644 index 0000000000..479923e1e1 --- /dev/null +++ b/src/dawn/native/opengl/UtilsEGL.cpp @@ -0,0 +1,75 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/opengl/UtilsEGL.h" + +#include + +#include "dawn/native/opengl/EGLFunctions.h" + +namespace dawn::native::opengl { + +const char* EGLErrorAsString(EGLint error) { + switch (error) { + case EGL_SUCCESS: + return "EGL_SUCCESS"; + case EGL_NOT_INITIALIZED: + return "EGL_NOT_INITIALIZED"; + case EGL_BAD_ACCESS: + return "EGL_BAD_ACCESS"; + case EGL_BAD_ALLOC: + return "EGL_BAD_ALLOC"; + case EGL_BAD_ATTRIBUTE: + return "EGL_BAD_ATTRIBUTE"; + case EGL_BAD_CONTEXT: + return "EGL_BAD_CONTEXT"; + case EGL_BAD_CONFIG: + return "EGL_BAD_CONFIG"; + case EGL_BAD_CURRENT_SURFACE: + return "EGL_BAD_CURRENT_SURFACE"; + case EGL_BAD_DISPLAY: + return "EGL_BAD_DISPLAY"; + case EGL_BAD_SURFACE: + return "EGL_BAD_SURFACE"; + case EGL_BAD_MATCH: + return "EGL_BAD_MATCH"; + case EGL_BAD_PARAMETER: + return "EGL_BAD_PARAMETER"; + case EGL_BAD_NATIVE_PIXMAP: + return "EGL_BAD_NATIVE_PIXMAP"; + case EGL_BAD_NATIVE_WINDOW: + return "EGL_BAD_NATIVE_WINDOW"; + case EGL_CONTEXT_LOST: + return "EGL_CONTEXT_LOST"; + default: + return ""; + } +} + +MaybeError CheckEGL(const EGLFunctions& egl, EGLBoolean result, const char* context) { + if (DAWN_LIKELY(result == EGL_TRUE)) { + return {}; + } + EGLint error = egl.GetError(); + std::string message = std::string(context) + " failed with " + EGLErrorAsString(error); + if (error == EGL_BAD_ALLOC) { + return DAWN_OUT_OF_MEMORY_ERROR(message); + } else if (error == EGL_CONTEXT_LOST) { + return DAWN_DEVICE_LOST_ERROR(message); + } else { + return DAWN_INTERNAL_ERROR(message); + } +} + +} // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/UtilsEGL.h b/src/dawn/native/opengl/UtilsEGL.h new file mode 100644 index 0000000000..cf631455d5 --- /dev/null +++ b/src/dawn/native/opengl/UtilsEGL.h @@ -0,0 +1,31 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_OPENGL_UTILSEGL_H_ +#define SRC_DAWN_NATIVE_OPENGL_UTILSEGL_H_ + +#include + +#include "dawn/native/Error.h" + +namespace dawn::native::opengl { + +struct EGLFunctions; + +const char* EGLErrorAsString(EGLint error); +MaybeError CheckEGL(const EGLFunctions& egl, EGLBoolean result, const char* context); + +} // namespace dawn::native::opengl + +#endif // SRC_DAWN_NATIVE_OPENGL_UTILSEGL_H_ diff --git a/src/dawn/native/opengl/UtilsGL.cpp b/src/dawn/native/opengl/UtilsGL.cpp index e35b9a14aa..d5dd34d5e4 100644 --- a/src/dawn/native/opengl/UtilsGL.cpp +++ b/src/dawn/native/opengl/UtilsGL.cpp @@ -48,7 +48,6 @@ GLuint ToOpenGLCompareFunction(wgpu::CompareFunction compareFunction) { GLint GetStencilMaskFromStencilFormat(wgpu::TextureFormat depthStencilFormat) { switch (depthStencilFormat) { case wgpu::TextureFormat::Depth24PlusStencil8: - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: case wgpu::TextureFormat::Stencil8: return 0xFF; diff --git a/src/dawn/native/stream/BlobSource.cpp b/src/dawn/native/stream/BlobSource.cpp new file mode 100644 index 0000000000..deeaf12450 --- /dev/null +++ b/src/dawn/native/stream/BlobSource.cpp @@ -0,0 +1,30 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/stream/BlobSource.h" + +#include + +namespace dawn::native::stream { + +BlobSource::BlobSource(Blob&& blob) : mBlob(std::move(blob)) {} + +MaybeError BlobSource::Read(const void** ptr, size_t bytes) { + DAWN_INVALID_IF(bytes > mBlob.Size() - mOffset, "Out of bounds."); + *ptr = mBlob.Data() + mOffset; + mOffset += bytes; + return {}; +} + +} // namespace dawn::native::stream diff --git a/src/dawn/native/stream/BlobSource.h b/src/dawn/native/stream/BlobSource.h new file mode 100644 index 0000000000..d93478e712 --- /dev/null +++ b/src/dawn/native/stream/BlobSource.h @@ -0,0 +1,38 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_STREAM_BLOBSOURCE_H_ +#define SRC_DAWN_NATIVE_STREAM_BLOBSOURCE_H_ + +#include "dawn/native/Blob.h" +#include "dawn/native/Error.h" +#include "dawn/native/stream/Source.h" + +namespace dawn::native::stream { + +class BlobSource : public Source { + public: + explicit BlobSource(Blob&& blob); + + // stream::Source implementation. + MaybeError Read(const void** ptr, size_t bytes) override; + + private: + const Blob mBlob; + size_t mOffset = 0; +}; + +} // namespace dawn::native::stream + +#endif // SRC_DAWN_NATIVE_STREAM_BLOBSOURCE_H_ diff --git a/src/dawn/native/stream/ByteVectorSink.cpp b/src/dawn/native/stream/ByteVectorSink.cpp new file mode 100644 index 0000000000..20c27f2369 --- /dev/null +++ b/src/dawn/native/stream/ByteVectorSink.cpp @@ -0,0 +1,47 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/stream/ByteVectorSink.h" + +#include "dawn/native/stream/Stream.h" + +namespace dawn::native::stream { + +void* ByteVectorSink::GetSpace(size_t bytes) { + size_t currentSize = this->size(); + this->resize(currentSize + bytes); + return &this->operator[](currentSize); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const ByteVectorSink& vec) { + // For nested sinks, we do not record the length, and just copy the data so that it + // appears flattened. + size_t size = vec.size(); + if (size > 0) { + void* ptr = sink->GetSpace(size); + memcpy(ptr, vec.data(), size); + } +} + +std::ostream& operator<<(std::ostream& os, const ByteVectorSink& vec) { + os << std::hex; + for (const int b : vec) { + os << std::setfill('0') << std::setw(2) << b << " "; + } + os << std::dec; + return os; +} + +} // namespace dawn::native::stream diff --git a/src/dawn/native/stream/ByteVectorSink.h b/src/dawn/native/stream/ByteVectorSink.h new file mode 100644 index 0000000000..3b6016c082 --- /dev/null +++ b/src/dawn/native/stream/ByteVectorSink.h @@ -0,0 +1,39 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_STREAM_BYTEVECTORSINK_H_ +#define SRC_DAWN_NATIVE_STREAM_BYTEVECTORSINK_H_ + +#include +#include + +#include "dawn/native/stream/Sink.h" + +namespace dawn::native::stream { + +// Implementation of stream::Sink backed by a byte vector. +class ByteVectorSink : public std::vector, public Sink { + public: + using std::vector::vector; + + // Implementation of stream::Sink + void* GetSpace(size_t bytes) override; +}; + +// Stream operator for ByteVectorSink for debugging. +std::ostream& operator<<(std::ostream& os, const ByteVectorSink& key); + +} // namespace dawn::native::stream + +#endif // SRC_DAWN_NATIVE_STREAM_BYTEVECTORSINK_H_ diff --git a/src/dawn/native/stream/Sink.h b/src/dawn/native/stream/Sink.h new file mode 100644 index 0000000000..caf1ba4fff --- /dev/null +++ b/src/dawn/native/stream/Sink.h @@ -0,0 +1,32 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_STREAM_SINK_H_ +#define SRC_DAWN_NATIVE_STREAM_SINK_H_ + +#include + +namespace dawn::native::stream { + +// Interface for a serialization sink. +class Sink { + public: + // Allocate `bytes` space in the sink. Returns the pointer to the start + // of the allocation. + virtual void* GetSpace(size_t bytes) = 0; +}; + +} // namespace dawn::native::stream + +#endif // SRC_DAWN_NATIVE_STREAM_SINK_H_ diff --git a/src/dawn/native/stream/Source.h b/src/dawn/native/stream/Source.h new file mode 100644 index 0000000000..c7b19d092c --- /dev/null +++ b/src/dawn/native/stream/Source.h @@ -0,0 +1,34 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_STREAM_SOURCE_H_ +#define SRC_DAWN_NATIVE_STREAM_SOURCE_H_ + +#include + +namespace dawn::native::stream { + +// Interface for a deserialization source. +class Source { + public: + // Try to read `bytes` space from the source. The data must live as long as `Source. + // Returns MaybeError and writes result to |ptr| because ResultOrError uses + // a tagged pointer that must be 4-byte aligned. This function writes out |ptr| + // which may not be aligned. + virtual MaybeError Read(const void** ptr, size_t bytes) = 0; +}; + +} // namespace dawn::native::stream + +#endif // SRC_DAWN_NATIVE_STREAM_SOURCE_H_ diff --git a/src/dawn/native/stream/Stream.cpp b/src/dawn/native/stream/Stream.cpp new file mode 100644 index 0000000000..beb3823da0 --- /dev/null +++ b/src/dawn/native/stream/Stream.cpp @@ -0,0 +1,61 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/stream/Stream.h" + +#include + +namespace dawn::native::stream { + +template <> +void Stream::Write(Sink* s, const std::string& t) { + StreamIn(s, t.length()); + size_t size = t.length() * sizeof(char); + if (size > 0) { + void* ptr = s->GetSpace(size); + memcpy(ptr, t.data(), size); + } +} + +template <> +MaybeError Stream::Read(Source* s, std::string* t) { + size_t length; + DAWN_TRY(StreamOut(s, &length)); + const void* ptr; + DAWN_TRY(s->Read(&ptr, length)); + *t = std::string(static_cast(ptr), length); + return {}; +} + +template <> +void Stream::Write(Sink* s, const std::string_view& t) { + StreamIn(s, t.length()); + size_t size = t.length() * sizeof(char); + if (size > 0) { + void* ptr = s->GetSpace(size); + memcpy(ptr, t.data(), size); + } +} + +template <> +void Stream::Write(Sink* s, const std::wstring_view& t) { + StreamIn(s, t.length()); + size_t size = t.length() * sizeof(wchar_t); + if (size > 0) { + void* ptr = s->GetSpace(size); + memcpy(ptr, t.data(), size); + } +} + +} // namespace dawn::native::stream diff --git a/src/dawn/native/stream/Stream.h b/src/dawn/native/stream/Stream.h new file mode 100644 index 0000000000..d077cccc60 --- /dev/null +++ b/src/dawn/native/stream/Stream.h @@ -0,0 +1,338 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_STREAM_STREAM_H_ +#define SRC_DAWN_NATIVE_STREAM_STREAM_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "dawn/common/Platform.h" +#include "dawn/common/TypedInteger.h" +#include "dawn/native/Error.h" +#include "dawn/native/stream/Sink.h" +#include "dawn/native/stream/Source.h" + +namespace dawn::native::stream { + +// Base Stream template for specialization. Specializations may define static methods: +// static void Write(Sink* s, const T& v); +// static MaybeError Read(Source* s, T* v); +template +class Stream { + public: + static void Write(Sink* s, const T& v); + static MaybeError Read(Source* s, T* v); +}; + +// Helper to call Stream::Write. +// By default, calling StreamIn will call this overload inside the stream namespace. +// Other definitons of StreamIn found by ADL may override this one. +template +constexpr void StreamIn(Sink* s, const T& v) { + Stream::Write(s, v); +} + +// Helper to call Stream::Read +// By default, calling StreamOut will call this overload inside the stream namespace. +// Other definitons of StreamOut found by ADL may override this one. +template +MaybeError StreamOut(Source* s, T* v) { + return Stream::Read(s, v); +} + +// Helper to take an rvalue passed to StreamOut and forward it as a pointer. +// This makes it possible to pass output wrappers like stream::StructMembers inline. +// For example: `DAWN_TRY(StreamOut(&source, stream::StructMembers(...)));` +template +MaybeError StreamOut(Source* s, T&& v) { + return StreamOut(s, &v); +} + +// Helper to call StreamIn on a parameter pack. +template +constexpr void StreamIn(Sink* s, const T& v, const Ts&... vs) { + StreamIn(s, v); + (StreamIn(s, vs), ...); +} + +// Helper to call StreamOut on a parameter pack. +template +MaybeError StreamOut(Source* s, T* v, Ts*... vs) { + DAWN_TRY(StreamOut(s, v)); + return StreamOut(s, vs...); +} + +// Stream specialization for fundamental types. +template +class Stream>> { + public: + static void Write(Sink* s, const T& v) { memcpy(s->GetSpace(sizeof(T)), &v, sizeof(T)); } + static MaybeError Read(Source* s, T* v) { + const void* ptr; + DAWN_TRY(s->Read(&ptr, sizeof(T))); + memcpy(v, ptr, sizeof(T)); + return {}; + } +}; + +namespace detail { +// NOLINTNEXTLINE(runtime/int) Alias "unsigned long long" type to match std::bitset to_ullong +using BitsetUllong = unsigned long long; +constexpr size_t kBitsPerUllong = 8 * sizeof(BitsetUllong); +constexpr bool BitsetSupportsToUllong(size_t N) { + return N <= kBitsPerUllong; +} +} // namespace detail + +// Stream specialization for bitsets that are smaller than BitsetUllong. +template +class Stream, std::enable_if_t> { + public: + static void Write(Sink* s, const std::bitset& t) { StreamIn(s, t.to_ullong()); } + static MaybeError Read(Source* s, std::bitset* v) { + detail::BitsetUllong value; + DAWN_TRY(StreamOut(s, &value)); + *v = std::bitset(value); + return {}; + } +}; + +// Stream specialization for bitsets since using the built-in to_ullong has a size limit. +template +class Stream, std::enable_if_t> { + public: + static void Write(Sink* s, const std::bitset& t) { + // Iterate in chunks of detail::BitsetUllong. + static std::bitset mask(std::numeric_limits::max()); + + std::bitset bits = t; + for (size_t offset = 0; offset < N; + offset += detail::kBitsPerUllong, bits >>= detail::kBitsPerUllong) { + StreamIn(s, (mask & bits).to_ullong()); + } + } + + static MaybeError Read(Source* s, std::bitset* v) { + static_assert(N > 0); + *v = {}; + + // Iterate in chunks of detail::BitsetUllong. + for (size_t offset = 0; offset < N; + offset += detail::kBitsPerUllong, (*v) <<= detail::kBitsPerUllong) { + detail::BitsetUllong ullong; + DAWN_TRY(StreamOut(s, &ullong)); + *v |= std::bitset(ullong); + } + return {}; + } +}; + +// Stream specialization for enums. +template +class Stream>> { + using U = std::underlying_type_t; + + public: + static void Write(Sink* s, const T& v) { StreamIn(s, static_cast(v)); } + + static MaybeError Read(Source* s, T* v) { + U out; + DAWN_TRY(StreamOut(s, &out)); + *v = static_cast(out); + return {}; + } +}; + +// Stream specialization for TypedInteger. +template +class Stream<::detail::TypedIntegerImpl> { + using T = ::detail::TypedIntegerImpl; + + public: + static void Write(Sink* s, const T& t) { StreamIn(s, static_cast(t)); } + + static MaybeError Read(Source* s, T* v) { + Integer out; + DAWN_TRY(StreamOut(s, &out)); + *v = T(out); + return {}; + } +}; + +// Stream specialization for pointers. We always serialize via value, not by pointer. +// To handle nullptr scenarios, we always serialize whether the pointer was not nullptr, +// followed by the contents if applicable. +template +class Stream>> { + public: + static void Write(stream::Sink* sink, const T& t) { + using Pointee = std::decay_t>; + static_assert(!std::is_same_v && !std::is_same_v && + !std::is_same_v && !std::is_same_v, + "C-str like type likely has ambiguous serialization. For a string, wrap with " + "std::string_view instead."); + StreamIn(sink, t != nullptr); + if (t != nullptr) { + StreamIn(sink, *t); + } + } +}; + +// Stream specialization for std::optional +template +class Stream> { + public: + static void Write(stream::Sink* sink, const std::optional& t) { + bool hasValue = t.has_value(); + StreamIn(sink, hasValue); + if (hasValue) { + StreamIn(sink, *t); + } + } +}; + +// Stream specialization for fixed arrays of fundamental types. +template +class Stream>> { + public: + static void Write(Sink* s, const T (&t)[N]) { + static_assert(N > 0); + memcpy(s->GetSpace(sizeof(t)), &t, sizeof(t)); + } + + static MaybeError Read(Source* s, T (*t)[N]) { + static_assert(N > 0); + const void* ptr; + DAWN_TRY(s->Read(&ptr, sizeof(*t))); + memcpy(*t, ptr, sizeof(*t)); + return {}; + } +}; + +// Specialization for fixed arrays of non-fundamental types. +template +class Stream>> { + public: + static void Write(Sink* s, const T (&t)[N]) { + static_assert(N > 0); + for (size_t i = 0; i < N; i++) { + StreamIn(s, t[i]); + } + } + + static MaybeError Read(Source* s, T (*t)[N]) { + static_assert(N > 0); + for (size_t i = 0; i < N; i++) { + DAWN_TRY(StreamOut(s, &(*t)[i])); + } + return {}; + } +}; + +// Stream specialization for std::vector. +template +class Stream> { + public: + static void Write(Sink* s, const std::vector& v) { + StreamIn(s, v.size()); + for (const T& it : v) { + StreamIn(s, it); + } + } + + static MaybeError Read(Source* s, std::vector* v) { + using SizeT = decltype(std::declval>().size()); + SizeT size; + DAWN_TRY(StreamOut(s, &size)); + *v = {}; + v->reserve(size); + for (SizeT i = 0; i < size; ++i) { + T el; + DAWN_TRY(StreamOut(s, &el)); + v->push_back(std::move(el)); + } + return {}; + } +}; + +// Stream specialization for std::pair. +template +class Stream> { + public: + static void Write(Sink* s, const std::pair& v) { + StreamIn(s, v.first); + StreamIn(s, v.second); + } + + static MaybeError Read(Source* s, std::pair* v) { + DAWN_TRY(StreamOut(s, &v->first)); + DAWN_TRY(StreamOut(s, &v->second)); + return {}; + } +}; + +// Stream specialization for std::unordered_map which sorts the entries +// to provide a stable ordering. +template +class Stream> { + public: + static void Write(stream::Sink* sink, const std::unordered_map& m) { + std::vector> ordered(m.begin(), m.end()); + std::sort( + ordered.begin(), ordered.end(), + [](const std::pair& a, const std::pair& b) { return a.first < b.first; }); + StreamIn(sink, ordered); + } +}; + +// Helper class to contain the begin/end iterators of an iterable. +namespace detail { +template +struct Iterable { + Iterator begin; + Iterator end; +}; +} // namespace detail + +// Helper for making detail::Iterable from a pointer and count. +template +auto Iterable(const T* ptr, size_t count) { + using Iterator = const T*; + return detail::Iterable{ptr, ptr + count}; +} + +// Stream specialization for detail::Iterable which writes the number of elements, +// followed by the elements. +template +class Stream> { + public: + static void Write(stream::Sink* sink, const detail::Iterable& iter) { + StreamIn(sink, std::distance(iter.begin, iter.end)); + for (auto it = iter.begin; it != iter.end; ++it) { + StreamIn(sink, *it); + } + } +}; + +} // namespace dawn::native::stream + +#endif // SRC_DAWN_NATIVE_STREAM_STREAM_H_ diff --git a/src/dawn/native/utils/WGPUHelpers.cpp b/src/dawn/native/utils/WGPUHelpers.cpp index 722476e8cc..2a7a5e0a3c 100644 --- a/src/dawn/native/utils/WGPUHelpers.cpp +++ b/src/dawn/native/utils/WGPUHelpers.cpp @@ -165,7 +165,8 @@ BindGroupEntry BindingInitializationHelper::GetAsBinding() const { ResultOrError> MakeBindGroup( DeviceBase* device, const Ref& layout, - std::initializer_list entriesInitializer) { + std::initializer_list entriesInitializer, + UsageValidationMode mode) { std::vector entries; for (const BindingInitializationHelper& helper : entriesInitializer) { entries.push_back(helper.GetAsBinding()); @@ -176,7 +177,7 @@ ResultOrError> MakeBindGroup( descriptor.entryCount = entries.size(); descriptor.entries = entries.data(); - return device->CreateBindGroup(&descriptor); + return device->CreateBindGroup(&descriptor, mode); } const char* GetLabelForTrace(const char* label) { diff --git a/src/dawn/native/utils/WGPUHelpers.h b/src/dawn/native/utils/WGPUHelpers.h index 9eab990668..45cfa46e2b 100644 --- a/src/dawn/native/utils/WGPUHelpers.h +++ b/src/dawn/native/utils/WGPUHelpers.h @@ -21,6 +21,7 @@ #include "dawn/common/RefCounted.h" #include "dawn/native/Error.h" +#include "dawn/native/UsageValidationMode.h" #include "dawn/native/dawn_platform.h" namespace dawn::native::utils { @@ -110,10 +111,12 @@ struct BindingInitializationHelper { uint64_t size = 0; }; +// This helper is only used inside dawn native. ResultOrError> MakeBindGroup( DeviceBase* device, const Ref& layout, - std::initializer_list entriesInitializer); + std::initializer_list entriesInitializer, + UsageValidationMode mode); const char* GetLabelForTrace(const char* label); diff --git a/src/dawn/native/vulkan/AdapterVk.cpp b/src/dawn/native/vulkan/AdapterVk.cpp index 6b0d770a3e..9ccc4d6514 100644 --- a/src/dawn/native/vulkan/AdapterVk.cpp +++ b/src/dawn/native/vulkan/AdapterVk.cpp @@ -32,6 +32,8 @@ Adapter::Adapter(InstanceBase* instance, mPhysicalDevice(physicalDevice), mVulkanInstance(vulkanInstance) {} +Adapter::~Adapter() = default; + const VulkanDeviceInfo& Adapter::GetDeviceInfo() const { return mDeviceInfo; } @@ -145,22 +147,31 @@ MaybeError Adapter::InitializeSupportedFeaturesImpl() { mSupportedFeatures.EnableFeature(Feature::PipelineStatisticsQuery); } - if (mDeviceInfo.features.depthClamp == VK_TRUE) { - mSupportedFeatures.EnableFeature(Feature::DepthClamping); - } - if (mDeviceInfo.properties.limits.timestampComputeAndGraphics == VK_TRUE) { mSupportedFeatures.EnableFeature(Feature::TimestampQuery); } - if (IsDepthStencilFormatSupported(VK_FORMAT_D24_UNORM_S8_UINT)) { - mSupportedFeatures.EnableFeature(Feature::Depth24UnormStencil8); - } - if (IsDepthStencilFormatSupported(VK_FORMAT_D32_SFLOAT_S8_UINT)) { mSupportedFeatures.EnableFeature(Feature::Depth32FloatStencil8); } + if (mDeviceInfo.features.drawIndirectFirstInstance == VK_TRUE) { + mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance); + } + + if (mDeviceInfo.HasExt(DeviceExt::ShaderIntegerDotProduct) && + mDeviceInfo.shaderIntegerDotProductProperties + .integerDotProduct4x8BitPackedSignedAccelerated == VK_TRUE && + mDeviceInfo.shaderIntegerDotProductProperties + .integerDotProduct4x8BitPackedUnsignedAccelerated == VK_TRUE) { + mSupportedFeatures.EnableFeature(Feature::ChromiumExperimentalDp4a); + } + + if (mDeviceInfo.HasExt(DeviceExt::DepthClipEnable) && + mDeviceInfo.depthClipEnableFeatures.depthClipEnable == VK_TRUE) { + mSupportedFeatures.EnableFeature(Feature::DepthClipControl); + } + #if defined(DAWN_USE_SYNC_FDS) // TODO(chromium:1258986): Precisely enable the feature by querying the device's format // features. @@ -267,9 +278,7 @@ MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) { vkLimits.maxComputeWorkGroupCount[2], }); - if (vkLimits.maxColorAttachments < kMaxColorAttachments) { - return DAWN_INTERNAL_ERROR("Insufficient Vulkan limits for maxColorAttachments"); - } + CHECK_AND_SET_V1_MAX_LIMIT(maxColorAttachments, maxColorAttachments); if (!IsSubset(VkSampleCountFlags(VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT), vkLimits.framebufferColorSampleCounts)) { return DAWN_INTERNAL_ERROR("Insufficient Vulkan limits for framebufferColorSampleCounts"); @@ -331,6 +340,10 @@ MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) { } } + // Using base limits for: + // TODO(crbug.com/dawn/1448): + // - maxInterStageShaderVariables + return {}; } diff --git a/src/dawn/native/vulkan/AdapterVk.h b/src/dawn/native/vulkan/AdapterVk.h index 2d9ce45a5a..9cb5234a65 100644 --- a/src/dawn/native/vulkan/AdapterVk.h +++ b/src/dawn/native/vulkan/AdapterVk.h @@ -30,7 +30,7 @@ class Adapter : public AdapterBase { Adapter(InstanceBase* instance, VulkanInstance* vulkanInstance, VkPhysicalDevice physicalDevice); - ~Adapter() override = default; + ~Adapter() override; // AdapterBase Implementation bool SupportsExternalImages() const override; diff --git a/src/dawn/native/vulkan/BackendVk.cpp b/src/dawn/native/vulkan/BackendVk.cpp index bc8efa9756..de2c2c7cfc 100644 --- a/src/dawn/native/vulkan/BackendVk.cpp +++ b/src/dawn/native/vulkan/BackendVk.cpp @@ -14,6 +14,7 @@ #include "dawn/native/vulkan/BackendVk.h" +#include #include #include @@ -29,28 +30,28 @@ // TODO(crbug.com/dawn/283): Link against the Vulkan Loader and remove this. #if defined(DAWN_ENABLE_SWIFTSHADER) -#if defined(DAWN_PLATFORM_LINUX) || defined(DAWN_PLATFORM_FUSCHIA) +#if DAWN_PLATFORM_IS(LINUX) || DAWN_PLATFORM_IS(FUSCHIA) constexpr char kSwiftshaderLibName[] = "libvk_swiftshader.so"; -#elif defined(DAWN_PLATFORM_WINDOWS) +#elif DAWN_PLATFORM_IS(WINDOWS) constexpr char kSwiftshaderLibName[] = "vk_swiftshader.dll"; -#elif defined(DAWN_PLATFORM_MACOS) +#elif DAWN_PLATFORM_IS(MACOS) constexpr char kSwiftshaderLibName[] = "libvk_swiftshader.dylib"; #else #error "Unimplemented Swiftshader Vulkan backend platform" #endif #endif -#if defined(DAWN_PLATFORM_LINUX) -#if defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(LINUX) +#if DAWN_PLATFORM_IS(ANDROID) constexpr char kVulkanLibName[] = "libvulkan.so"; #else constexpr char kVulkanLibName[] = "libvulkan.so.1"; #endif -#elif defined(DAWN_PLATFORM_WINDOWS) +#elif DAWN_PLATFORM_IS(WINDOWS) constexpr char kVulkanLibName[] = "vulkan-1.dll"; -#elif defined(DAWN_PLATFORM_MACOS) +#elif DAWN_PLATFORM_IS(MACOS) constexpr char kVulkanLibName[] = "libvulkan.dylib"; -#elif defined(DAWN_PLATFORM_FUCHSIA) +#elif DAWN_PLATFORM_IS(FUCHSIA) constexpr char kVulkanLibName[] = "libvulkan.so"; #else #error "Unimplemented Vulkan backend platform" @@ -81,6 +82,10 @@ constexpr SkippedMessage kSkippedMessages[] = { "stencil aspect during store with stencilStoreOp VK_ATTACHMENT_STORE_OP_STORE. Access info " "(usage: SYNC_LATE_FRAGMENT_TESTS_DEPTH_STENCIL_ATTACHMENT_WRITE, prior_usage: " "SYNC_FRAGMENT_SHADER_SHADER_STORAGE_READ, read_barriers: VK_PIPELINE_STAGE_2_NONE"}, + + // http://anglebug.com/7513 + {"VUID-VkGraphicsPipelineCreateInfo-pStages-06896", + "contains fragment shader state, but stages"}, }; namespace dawn::native::vulkan { @@ -88,7 +93,12 @@ namespace dawn::native::vulkan { namespace { static constexpr ICD kICDs[] = { +// Other drivers should not be loaded with MSAN because they don't have MSAN instrumentation. +// MSAN will produce false positives since it cannot detect changes to memory that the driver +// has made. +#if !defined(MEMORY_SANITIZER) ICD::None, +#endif #if defined(DAWN_ENABLE_SWIFTSHADER) ICD::SwiftShader, #endif // defined(DAWN_ENABLE_SWIFTSHADER) @@ -328,17 +338,7 @@ ResultOrError VulkanInstance::CreateVkInstance(const Instance appInfo.applicationVersion = 0; appInfo.pEngineName = nullptr; appInfo.engineVersion = 0; - // Vulkan 1.0 implementations were required to return VK_ERROR_INCOMPATIBLE_DRIVER if - // apiVersion was larger than 1.0. Meanwhile, as long as the instance supports at least - // Vulkan 1.1, an application can use different versions of Vulkan with an instance than - // it does with a device or physical device. So we should set apiVersion to Vulkan 1.0 - // if the instance only supports Vulkan 1.0. Otherwise we set apiVersion to Vulkan 1.2, - // treat 1.2 as the highest API version dawn targets. - if (mGlobalInfo.apiVersion == VK_MAKE_VERSION(1, 0, 0)) { - appInfo.apiVersion = VK_MAKE_VERSION(1, 0, 0); - } else { - appInfo.apiVersion = VK_MAKE_VERSION(1, 2, 0); - } + appInfo.apiVersion = std::min(mGlobalInfo.apiVersion, VK_API_VERSION_1_3); VkInstanceCreateInfo createInfo; createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; @@ -449,12 +449,12 @@ ResultOrError>> Backend::DiscoverAdapters( InstanceBase* instance = GetInstance(); for (ICD icd : kICDs) { -#if defined(DAWN_PLATFORM_MACOS) +#if DAWN_PLATFORM_IS(MACOS) // On Mac, we don't expect non-Swiftshader Vulkan to be available. if (icd == ICD::None) { continue; } -#endif // defined(DAWN_PLATFORM_MACOS) +#endif // DAWN_PLATFORM_IS(MACOS) if (options->forceSwiftShader && icd != ICD::SwiftShader) { continue; } diff --git a/src/dawn/native/vulkan/BackendVk.h b/src/dawn/native/vulkan/BackendVk.h index 7b3e430c03..f912344d31 100644 --- a/src/dawn/native/vulkan/BackendVk.h +++ b/src/dawn/native/vulkan/BackendVk.h @@ -48,7 +48,7 @@ class Device; class VulkanInstance : public RefCounted { public: static ResultOrError> Create(const InstanceBase* instance, ICD icd); - ~VulkanInstance(); + ~VulkanInstance() override; const VulkanFunctions& GetFunctions() const; VkInstance GetVkInstance() const; diff --git a/src/dawn/native/vulkan/BindGroupLayoutVk.cpp b/src/dawn/native/vulkan/BindGroupLayoutVk.cpp index a87a91fc98..94b5a7dc6b 100644 --- a/src/dawn/native/vulkan/BindGroupLayoutVk.cpp +++ b/src/dawn/native/vulkan/BindGroupLayoutVk.cpp @@ -117,7 +117,7 @@ MaybeError BindGroupLayout::Initialize() { createInfo.pBindings = bindings.data(); // Record cache key information now since the createInfo is not stored. - mCacheKey.Record(createInfo); + StreamIn(&mCacheKey, createInfo); Device* device = ToBackend(GetDevice()); DAWN_TRY(CheckVkSuccess(device->fn.CreateDescriptorSetLayout(device->GetVkDevice(), &createInfo, diff --git a/src/dawn/native/vulkan/CacheKeyVk.cpp b/src/dawn/native/vulkan/CacheKeyVk.cpp deleted file mode 100644 index d89649e746..0000000000 --- a/src/dawn/native/vulkan/CacheKeyVk.cpp +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -#include "dawn/native/vulkan/CacheKeyVk.h" -#include "dawn/native/vulkan/RenderPassCache.h" - -namespace dawn::native { - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkDescriptorSetLayoutBinding& t) { - key->Record(t.binding, t.descriptorType, t.descriptorCount, t.stageFlags); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkDescriptorSetLayoutCreateInfo& t) { - key->Record(t.flags).RecordIterable(t.pBindings, t.bindingCount); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize(CacheKey* key, - const VkPushConstantRange& t) { - key->Record(t.stageFlags, t.offset, t.size); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineLayoutCreateInfo& t) { - // The set layouts are not serialized here because they are pointers to backend objects. - // They need to be cross-referenced with the frontend objects and serialized from there. - key->Record(t.flags).RecordIterable(t.pPushConstantRanges, t.pushConstantRangeCount); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT& t) { - key->Record(t.requiredSubgroupSize); -} - -template <> -void CacheKeySerializer::Serialize(CacheKey* key, - const VkSpecializationMapEntry& t) { - key->Record(t.constantID, t.offset, t.size); -} - -template <> -void CacheKeySerializer::Serialize(CacheKey* key, - const VkSpecializationInfo& t) { - key->RecordIterable(t.pMapEntries, t.mapEntryCount) - .RecordIterable(static_cast(t.pData), t.dataSize); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineShaderStageCreateInfo& t) { - // The shader module is not serialized here because it is a pointer to a backend object. - key->Record(t.flags, t.stage) - .RecordIterable(t.pName, strlen(t.pName)) - .Record(t.pSpecializationInfo); - vulkan::SerializePnext(key, &t); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkComputePipelineCreateInfo& t) { - // The pipeline layout is not serialized here because it is a pointer to a backend object. - // It needs to be cross-referenced with the frontend objects and serialized from there. The - // base pipeline information is also currently not recorded since we do not use them in our - // backend implementation. If we decide to use them later on, they also need to be - // cross-referenced from the frontend. - key->Record(t.flags, t.stage); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkVertexInputBindingDescription& t) { - key->Record(t.binding, t.stride, t.inputRate); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkVertexInputAttributeDescription& t) { - key->Record(t.location, t.binding, t.format, t.offset); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineVertexInputStateCreateInfo& t) { - key->Record(t.flags) - .RecordIterable(t.pVertexBindingDescriptions, t.vertexBindingDescriptionCount) - .RecordIterable(t.pVertexAttributeDescriptions, t.vertexAttributeDescriptionCount); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineInputAssemblyStateCreateInfo& t) { - key->Record(t.flags, t.topology, t.primitiveRestartEnable); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineTessellationStateCreateInfo& t) { - key->Record(t.flags, t.patchControlPoints); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize(CacheKey* key, const VkViewport& t) { - key->Record(t.x, t.y, t.width, t.height, t.minDepth, t.maxDepth); -} - -template <> -void CacheKeySerializer::Serialize(CacheKey* key, const VkOffset2D& t) { - key->Record(t.x, t.y); -} - -template <> -void CacheKeySerializer::Serialize(CacheKey* key, const VkExtent2D& t) { - key->Record(t.width, t.height); -} - -template <> -void CacheKeySerializer::Serialize(CacheKey* key, const VkRect2D& t) { - key->Record(t.offset, t.extent); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineViewportStateCreateInfo& t) { - key->Record(t.flags) - .RecordIterable(t.pViewports, t.viewportCount) - .RecordIterable(t.pScissors, t.scissorCount); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineRasterizationStateCreateInfo& t) { - key->Record(t.flags, t.depthClampEnable, t.rasterizerDiscardEnable, t.polygonMode, t.cullMode, - t.frontFace, t.depthBiasEnable, t.depthBiasConstantFactor, t.depthBiasClamp, - t.depthBiasSlopeFactor, t.lineWidth); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineMultisampleStateCreateInfo& t) { - key->Record(t.flags, t.rasterizationSamples, t.sampleShadingEnable, t.minSampleShading, - t.pSampleMask, t.alphaToCoverageEnable, t.alphaToOneEnable); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize(CacheKey* key, const VkStencilOpState& t) { - key->Record(t.failOp, t.passOp, t.depthFailOp, t.compareOp, t.compareMask, t.writeMask, - t.reference); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineDepthStencilStateCreateInfo& t) { - key->Record(t.flags, t.depthTestEnable, t.depthWriteEnable, t.depthCompareOp, - t.depthBoundsTestEnable, t.stencilTestEnable, t.front, t.back, t.minDepthBounds, - t.maxDepthBounds); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineColorBlendAttachmentState& t) { - key->Record(t.blendEnable, t.srcColorBlendFactor, t.dstColorBlendFactor, t.colorBlendOp, - t.srcAlphaBlendFactor, t.dstAlphaBlendFactor, t.alphaBlendOp, t.colorWriteMask); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineColorBlendStateCreateInfo& t) { - key->Record(t.flags, t.logicOpEnable, t.logicOp) - .RecordIterable(t.pAttachments, t.attachmentCount) - .Record(t.blendConstants); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkPipelineDynamicStateCreateInfo& t) { - key->Record(t.flags).RecordIterable(t.pDynamicStates, t.dynamicStateCount); - vulkan::SerializePnext<>(key, &t); -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const vulkan::RenderPassCacheQuery& t) { - key->Record(t.colorMask.to_ulong(), t.resolveTargetMask.to_ulong(), t.sampleCount); - - // Manually iterate the color attachment indices and their corresponding format/load/store - // ops because the data is sparse and may be uninitialized. Since we record the colorMask - // member above, recording sparse data should be fine here. - for (ColorAttachmentIndex i : IterateBitSet(t.colorMask)) { - key->Record(t.colorFormats[i], t.colorLoadOp[i], t.colorStoreOp[i]); - } - - // Serialize the depth-stencil toggle bit, and the parameters if applicable. - key->Record(t.hasDepthStencil); - if (t.hasDepthStencil) { - key->Record(t.depthStencilFormat, t.depthLoadOp, t.depthStoreOp, t.stencilLoadOp, - t.stencilStoreOp, t.readOnlyDepthStencil); - } -} - -template <> -void CacheKeySerializer::Serialize( - CacheKey* key, - const VkGraphicsPipelineCreateInfo& t) { - // The pipeline layout and render pass are not serialized here because they are pointers to - // backend objects. They need to be cross-referenced with the frontend objects and - // serialized from there. The base pipeline information is also currently not recorded since - // we do not use them in our backend implementation. If we decide to use them later on, they - // also need to be cross-referenced from the frontend. - key->Record(t.flags) - .RecordIterable(t.pStages, t.stageCount) - .Record(t.pVertexInputState, t.pInputAssemblyState, t.pTessellationState, t.pViewportState, - t.pRasterizationState, t.pMultisampleState, t.pDepthStencilState, - t.pColorBlendState, t.pDynamicState, t.subpass); - vulkan::SerializePnext<>(key, &t); -} - -} // namespace dawn::native diff --git a/src/dawn/native/vulkan/CacheKeyVk.h b/src/dawn/native/vulkan/CacheKeyVk.h deleted file mode 100644 index 80b04dbd9a..0000000000 --- a/src/dawn/native/vulkan/CacheKeyVk.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_DAWN_NATIVE_VULKAN_CACHEKEYVK_H_ -#define SRC_DAWN_NATIVE_VULKAN_CACHEKEYVK_H_ - -#include - -#include "dawn/common/Assert.h" -#include "dawn/common/vulkan_platform.h" -#include "dawn/native/CacheKey.h" - -#include "icd/generated/vk_typemap_helper.h" - -namespace dawn::native::vulkan { - -namespace detail { - -template -void ValidatePnextImpl(const VkBaseOutStructure* root) { - const VkBaseOutStructure* next = reinterpret_cast(root->pNext); - while (next != nullptr) { - // Assert that the type of each pNext struct is exactly one of the specified - // templates. - ASSERT(((LvlTypeMap::kSType == next->sType ? 1 : 0) + ... + 0) == 1); - next = reinterpret_cast(next->pNext); - } -} - -template -void SerializePnextImpl(CacheKey* key, const VkBaseOutStructure* root) { - const VkBaseOutStructure* next = reinterpret_cast(root->pNext); - const VK_STRUCT_TYPE* found = nullptr; - while (next != nullptr) { - if (LvlTypeMap::kSType == next->sType) { - if (found == nullptr) { - found = reinterpret_cast(next); - } else { - // Fail an assert here since that means that the chain had more than one of - // the same typed chained object. - ASSERT(false); - } - } - next = reinterpret_cast(next->pNext); - } - if (found != nullptr) { - key->Record(found); - } -} - -template 0)>> -void SerializePnextImpl(CacheKey* key, const VkBaseOutStructure* root) { - SerializePnextImpl(key, root); - SerializePnextImpl(key, root); -} - -template -const VkBaseOutStructure* ToVkBaseOutStructure(const VK_STRUCT_TYPE* t) { - // Checks to ensure proper type safety. - static_assert(offsetof(VK_STRUCT_TYPE, sType) == offsetof(VkBaseOutStructure, sType) && - offsetof(VK_STRUCT_TYPE, pNext) == offsetof(VkBaseOutStructure, pNext), - "Argument type is not a proper Vulkan structure type"); - return reinterpret_cast(t); -} - -} // namespace detail - -template 0)>> -void SerializePnext(CacheKey* key, const VK_STRUCT_TYPE* t) { - const VkBaseOutStructure* root = detail::ToVkBaseOutStructure(t); - detail::ValidatePnextImpl(root); - detail::SerializePnextImpl(key, root); -} - -// Empty template specialization so that we can put this in to ensure failures occur if new -// extensions are added without updating serialization. -template -void SerializePnext(CacheKey* key, const VK_STRUCT_TYPE* t) { - const VkBaseOutStructure* root = detail::ToVkBaseOutStructure(t); - detail::ValidatePnextImpl<>(root); -} - -} // namespace dawn::native::vulkan - -#endif // SRC_DAWN_NATIVE_VULKAN_CACHEKEYVK_H_ diff --git a/src/dawn/native/vulkan/CommandBufferVk.cpp b/src/dawn/native/vulkan/CommandBufferVk.cpp index fca86c2db7..a61a800d98 100644 --- a/src/dawn/native/vulkan/CommandBufferVk.cpp +++ b/src/dawn/native/vulkan/CommandBufferVk.cpp @@ -377,12 +377,19 @@ void ResetUsedQuerySetsOnRenderPass(Device* device, void RecordWriteTimestampCmd(CommandRecordingContext* recordingContext, Device* device, - WriteTimestampCmd* cmd) { + QuerySetBase* querySet, + uint32_t queryIndex, + bool isRenderPass) { VkCommandBuffer commands = recordingContext->commandBuffer; - QuerySet* querySet = ToBackend(cmd->querySet.Get()); + + // The queries must be reset between uses, and the reset command cannot be called in render + // pass. + if (!isRenderPass) { + device->fn.CmdResetQueryPool(commands, ToBackend(querySet)->GetHandle(), queryIndex, 1); + } device->fn.CmdWriteTimestamp(commands, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, - querySet->GetHandle(), cmd->queryIndex); + ToBackend(querySet)->GetHandle(), queryIndex); } void RecordResolveQuerySetCmd(VkCommandBuffer commands, @@ -735,10 +742,11 @@ MaybeError CommandBuffer::RecordCommands(CommandRecordingContext* recordingConte } case Command::BeginComputePass: { - mCommands.NextCommand(); + BeginComputePassCmd* cmd = mCommands.NextCommand(); - DAWN_TRY(RecordComputePass( - recordingContext, GetResourceUsages().computePasses[nextComputePassNumber])); + DAWN_TRY( + RecordComputePass(recordingContext, cmd, + GetResourceUsages().computePasses[nextComputePassNumber])); nextComputePassNumber++; break; @@ -777,11 +785,8 @@ MaybeError CommandBuffer::RecordCommands(CommandRecordingContext* recordingConte case Command::WriteTimestamp: { WriteTimestampCmd* cmd = mCommands.NextCommand(); - // The query must be reset between uses. - device->fn.CmdResetQueryPool(commands, ToBackend(cmd->querySet)->GetHandle(), - cmd->queryIndex, 1); - - RecordWriteTimestampCmd(recordingContext, device, cmd); + RecordWriteTimestampCmd(recordingContext, device, cmd->querySet.Get(), + cmd->queryIndex, false); break; } @@ -878,8 +883,17 @@ MaybeError CommandBuffer::RecordCommands(CommandRecordingContext* recordingConte } MaybeError CommandBuffer::RecordComputePass(CommandRecordingContext* recordingContext, + BeginComputePassCmd* computePassCmd, const ComputePassResourceUsage& resourceUsages) { Device* device = ToBackend(GetDevice()); + + // Write timestamp at the beginning of compute pass if it's set + if (computePassCmd->beginTimestamp.querySet.Get() != nullptr) { + RecordWriteTimestampCmd(recordingContext, device, + computePassCmd->beginTimestamp.querySet.Get(), + computePassCmd->beginTimestamp.queryIndex, false); + } + VkCommandBuffer commands = recordingContext->commandBuffer; uint64_t currentDispatch = 0; @@ -890,6 +904,13 @@ MaybeError CommandBuffer::RecordComputePass(CommandRecordingContext* recordingCo switch (type) { case Command::EndComputePass: { mCommands.NextCommand(); + + // Write timestamp at the end of compute pass if it's set. + if (computePassCmd->endTimestamp.querySet.Get() != nullptr) { + RecordWriteTimestampCmd(recordingContext, device, + computePassCmd->endTimestamp.querySet.Get(), + computePassCmd->endTimestamp.queryIndex, false); + } return {}; } @@ -996,11 +1017,8 @@ MaybeError CommandBuffer::RecordComputePass(CommandRecordingContext* recordingCo case Command::WriteTimestamp: { WriteTimestampCmd* cmd = mCommands.NextCommand(); - // The query must be reset between uses. - device->fn.CmdResetQueryPool(commands, ToBackend(cmd->querySet)->GetHandle(), - cmd->queryIndex, 1); - - RecordWriteTimestampCmd(recordingContext, device, cmd); + RecordWriteTimestampCmd(recordingContext, device, cmd->querySet.Get(), + cmd->queryIndex, false); break; } @@ -1020,6 +1038,13 @@ MaybeError CommandBuffer::RecordRenderPass(CommandRecordingContext* recordingCon DAWN_TRY(RecordBeginRenderPass(recordingContext, device, renderPassCmd)); + // Write timestamp at the beginning of render pass if it's set. + if (renderPassCmd->beginTimestamp.querySet.Get() != nullptr) { + RecordWriteTimestampCmd(recordingContext, device, + renderPassCmd->beginTimestamp.querySet.Get(), + renderPassCmd->beginTimestamp.queryIndex, true); + } + // Set the default value for the dynamic state { device->fn.CmdSetLineWidth(commands, 1.0f); @@ -1203,6 +1228,14 @@ MaybeError CommandBuffer::RecordRenderPass(CommandRecordingContext* recordingCon switch (type) { case Command::EndRenderPass: { mCommands.NextCommand(); + + // Write timestamp at the end of render pass if it's set. + if (renderPassCmd->endTimestamp.querySet.Get() != nullptr) { + RecordWriteTimestampCmd(recordingContext, device, + renderPassCmd->endTimestamp.querySet.Get(), + renderPassCmd->endTimestamp.queryIndex, true); + } + device->fn.CmdEndRenderPass(commands); return {}; } @@ -1290,7 +1323,8 @@ MaybeError CommandBuffer::RecordRenderPass(CommandRecordingContext* recordingCon case Command::WriteTimestamp: { WriteTimestampCmd* cmd = mCommands.NextCommand(); - RecordWriteTimestampCmd(recordingContext, device, cmd); + RecordWriteTimestampCmd(recordingContext, device, cmd->querySet.Get(), + cmd->queryIndex, true); break; } diff --git a/src/dawn/native/vulkan/CommandBufferVk.h b/src/dawn/native/vulkan/CommandBufferVk.h index dbb7fdcd7f..b748f0daac 100644 --- a/src/dawn/native/vulkan/CommandBufferVk.h +++ b/src/dawn/native/vulkan/CommandBufferVk.h @@ -21,6 +21,7 @@ #include "dawn/common/vulkan_platform.h" namespace dawn::native { +struct BeginComputePassCmd; struct BeginRenderPassCmd; struct TextureCopy; } // namespace dawn::native @@ -41,6 +42,7 @@ class CommandBuffer final : public CommandBufferBase { CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor); MaybeError RecordComputePass(CommandRecordingContext* recordingContext, + BeginComputePassCmd* computePass, const ComputePassResourceUsage& resourceUsages); MaybeError RecordRenderPass(CommandRecordingContext* recordingContext, BeginRenderPassCmd* renderPass); diff --git a/src/dawn/native/vulkan/CommandRecordingContext.h b/src/dawn/native/vulkan/CommandRecordingContext.h index b5ced101eb..ab43ae2d71 100644 --- a/src/dawn/native/vulkan/CommandRecordingContext.h +++ b/src/dawn/native/vulkan/CommandRecordingContext.h @@ -14,23 +14,30 @@ #ifndef SRC_DAWN_NATIVE_VULKAN_COMMANDRECORDINGCONTEXT_H_ #define SRC_DAWN_NATIVE_VULKAN_COMMANDRECORDINGCONTEXT_H_ +#include #include #include "dawn/common/vulkan_platform.h" #include "dawn/native/vulkan/BufferVk.h" namespace dawn::native::vulkan { + +class Texture; + // Used to track operations that are handled after recording. // Currently only tracks semaphores, but may be used to do barrier coalescing in the future. struct CommandRecordingContext { VkCommandBuffer commandBuffer = VK_NULL_HANDLE; std::vector waitSemaphores = {}; - std::vector signalSemaphores = {}; // The internal buffers used in the workaround of texture-to-texture copies with compressed // formats. std::vector> tempBuffers; + // External textures that will be eagerly transitioned just before VkSubmit. The textures are + // kept alive by the CommandBuffer so they don't need to be Ref-ed. + std::set externalTexturesForEagerTransition; + // For Device state tracking only. VkCommandPool commandPool = VK_NULL_HANDLE; bool used = false; diff --git a/src/dawn/native/vulkan/ComputePipelineVk.cpp b/src/dawn/native/vulkan/ComputePipelineVk.cpp index 21937981dd..ad6fbf8410 100644 --- a/src/dawn/native/vulkan/ComputePipelineVk.cpp +++ b/src/dawn/native/vulkan/ComputePipelineVk.cpp @@ -41,7 +41,7 @@ MaybeError ComputePipeline::Initialize() { const PipelineLayout* layout = ToBackend(GetLayout()); // Vulkan devices need cache UUID field to be serialized into pipeline cache keys. - mCacheKey.Record(device->GetDeviceInfo().properties.pipelineCacheUUID); + StreamIn(&mCacheKey, device->GetDeviceInfo().properties.pipelineCacheUUID); VkComputePipelineCreateInfo createInfo; createInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO; @@ -58,13 +58,15 @@ MaybeError ComputePipeline::Initialize() { // Generate a new VkShaderModule with BindingRemapper tint transform for each pipeline const ProgrammableStage& computeStage = GetStage(SingleShaderStage::Compute); ShaderModule* module = ToBackend(computeStage.module.Get()); - const ShaderModule::Spirv* spirv; - DAWN_TRY_ASSIGN((std::tie(createInfo.stage.module, spirv)), + + ShaderModule::ModuleAndSpirv moduleAndSpirv; + DAWN_TRY_ASSIGN(moduleAndSpirv, module->GetHandleAndSpirv(computeStage.entryPoint.c_str(), layout)); + createInfo.stage.module = moduleAndSpirv.module; createInfo.stage.pName = computeStage.entryPoint.c_str(); - std::vector specializationDataEntries; + std::vector specializationDataEntries; std::vector specializationMapEntries; VkSpecializationInfo specializationInfo{}; createInfo.stage.pSpecializationInfo = GetVkSpecializationInfo( @@ -83,7 +85,8 @@ MaybeError ComputePipeline::Initialize() { } // Record cache key information now since the createInfo is not stored. - mCacheKey.Record(createInfo, layout).RecordIterable(*spirv); + StreamIn(&mCacheKey, createInfo, layout, + stream::Iterable(moduleAndSpirv.spirv, moduleAndSpirv.wordCount)); // Try to see if we have anything in the blob cache. Ref cache = ToBackend(GetDevice()->GetOrCreatePipelineCache(GetCacheKey())); diff --git a/src/dawn/native/vulkan/DescriptorSetAllocator.h b/src/dawn/native/vulkan/DescriptorSetAllocator.h index c9060fe9d5..98664374a6 100644 --- a/src/dawn/native/vulkan/DescriptorSetAllocator.h +++ b/src/dawn/native/vulkan/DescriptorSetAllocator.h @@ -45,7 +45,7 @@ class DescriptorSetAllocator : public ObjectBase { private: DescriptorSetAllocator(BindGroupLayout* layout, std::map descriptorCountPerType); - ~DescriptorSetAllocator(); + ~DescriptorSetAllocator() override; MaybeError AllocateDescriptorPool(); diff --git a/src/dawn/native/vulkan/DeviceVk.cpp b/src/dawn/native/vulkan/DeviceVk.cpp index 2b13830093..662fa5a1cd 100644 --- a/src/dawn/native/vulkan/DeviceVk.cpp +++ b/src/dawn/native/vulkan/DeviceVk.cpp @@ -15,6 +15,7 @@ #include "dawn/native/vulkan/DeviceVk.h" #include "dawn/common/Log.h" +#include "dawn/common/NonCopyable.h" #include "dawn/common/Platform.h" #include "dawn/native/BackendConnection.h" #include "dawn/native/ChainUtils_autogen.h" @@ -47,6 +48,35 @@ namespace dawn::native::vulkan { +namespace { + +// Destroy the semaphore when out of scope. +class ScopedSignalSemaphore : public NonMovable { + public: + ScopedSignalSemaphore(Device* device, VkSemaphore semaphore) + : mDevice(device), mSemaphore(semaphore) {} + ~ScopedSignalSemaphore() { + if (mSemaphore != VK_NULL_HANDLE) { + ASSERT(mDevice); + mDevice->fn.DestroySemaphore(mDevice->GetVkDevice(), mSemaphore, nullptr); + } + } + + VkSemaphore Get() { return mSemaphore; } + VkSemaphore Detach() { + VkSemaphore semaphore = mSemaphore; + mSemaphore = VK_NULL_HANDLE; + return semaphore; + } + VkSemaphore* InitializeInto() { return &mSemaphore; } + + private: + Device* mDevice = nullptr; + VkSemaphore mSemaphore = VK_NULL_HANDLE; +}; + +} // namespace + // static ResultOrError> Device::Create(Adapter* adapter, const DeviceDescriptor* descriptor) { Ref device = AcquireRef(new Device(adapter, descriptor)); @@ -245,6 +275,10 @@ ResourceMemoryAllocator* Device::GetResourceMemoryAllocator() const { return mResourceMemoryAllocator.get(); } +external_semaphore::Service* Device::GetExternalSemaphoreService() const { + return mExternalSemaphoreService.get(); +} + void Device::EnqueueDeferredDeallocation(DescriptorSetAllocator* allocator) { mDescriptorAllocatorsPendingDeallocation.Enqueue(allocator, GetPendingCommandSerial()); } @@ -260,6 +294,19 @@ MaybeError Device::SubmitPendingCommands() { return {}; } + ScopedSignalSemaphore scopedSignalSemaphore(this, VK_NULL_HANDLE); + if (mRecordingContext.externalTexturesForEagerTransition.size() > 0) { + // Create an external semaphore for all external textures that have been used in the pending + // submit. + DAWN_TRY_ASSIGN(*scopedSignalSemaphore.InitializeInto(), + mExternalSemaphoreService->CreateExportableSemaphore()); + } + + // Transition eagerly all used external textures for export. + for (auto* texture : mRecordingContext.externalTexturesForEagerTransition) { + texture->TransitionEagerlyForExport(&mRecordingContext); + } + DAWN_TRY( CheckVkSuccess(fn.EndCommandBuffer(mRecordingContext.commandBuffer), "vkEndCommandBuffer")); @@ -274,9 +321,8 @@ MaybeError Device::SubmitPendingCommands() { submitInfo.pWaitDstStageMask = dstStageMasks.data(); submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = &mRecordingContext.commandBuffer; - submitInfo.signalSemaphoreCount = - static_cast(mRecordingContext.signalSemaphores.size()); - submitInfo.pSignalSemaphores = AsVkArray(mRecordingContext.signalSemaphores.data()); + submitInfo.signalSemaphoreCount = (scopedSignalSemaphore.Get() == VK_NULL_HANDLE ? 0 : 1); + submitInfo.pSignalSemaphores = AsVkArray(scopedSignalSemaphore.InitializeInto()); VkFence fence = VK_NULL_HANDLE; DAWN_TRY_ASSIGN(fence, GetUnusedFence()); @@ -293,10 +339,6 @@ MaybeError Device::SubmitPendingCommands() { for (VkSemaphore semaphore : mRecordingContext.waitSemaphores) { mDeleter->DeleteWhenUnused(semaphore); } - for (VkSemaphore semaphore : mRecordingContext.signalSemaphores) { - mDeleter->DeleteWhenUnused(semaphore); - } - IncrementLastSubmittedCommandSerial(); ExecutionSerial lastSubmittedSerial = GetLastSubmittedCommandSerial(); mFencesInFlight.emplace(fence, lastSubmittedSerial); @@ -304,6 +346,26 @@ MaybeError Device::SubmitPendingCommands() { CommandPoolAndBuffer submittedCommands = {mRecordingContext.commandPool, mRecordingContext.commandBuffer}; mCommandsInFlight.Enqueue(submittedCommands, lastSubmittedSerial); + + if (mRecordingContext.externalTexturesForEagerTransition.size() > 0) { + // Export the signal semaphore. + ExternalSemaphoreHandle semaphoreHandle; + DAWN_TRY_ASSIGN(semaphoreHandle, + mExternalSemaphoreService->ExportSemaphore(scopedSignalSemaphore.Get())); + // The ownership of signal semaphore has been transferred, we no longer need to track it. + scopedSignalSemaphore.Detach(); + // Update all external textures, eagerly transitioned in the submit, with the exported + // handle, and the duplicated handles. + bool first = true; + for (auto* texture : mRecordingContext.externalTexturesForEagerTransition) { + ExternalSemaphoreHandle handle = + (first ? semaphoreHandle + : mExternalSemaphoreService->DuplicateHandle(semaphoreHandle)); + first = false; + texture->UpdateExternalSemaphoreHandle(handle); + } + } + mRecordingContext = CommandRecordingContext(); DAWN_TRY(PrepareRecordingContext()); @@ -373,6 +435,16 @@ ResultOrError Device::CreateDevice(VkPhysicalDevice physicalD featuresChain.Add(&usedKnobs.zeroInitializeWorkgroupMemoryFeatures); } + if (mDeviceInfo.HasExt(DeviceExt::ShaderIntegerDotProduct)) { + ASSERT(usedKnobs.HasExt(DeviceExt::ShaderIntegerDotProduct)); + + usedKnobs.shaderIntegerDotProductFeatures.sType = + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES; + + usedKnobs.shaderIntegerDotProductFeatures.shaderIntegerDotProduct = VK_TRUE; + featuresChain.Add(&usedKnobs.shaderIntegerDotProductFeatures); + } + if (mDeviceInfo.features.samplerAnisotropy == VK_TRUE) { usedKnobs.features.samplerAnisotropy = VK_TRUE; } @@ -399,6 +471,16 @@ ResultOrError Device::CreateDevice(VkPhysicalDevice physicalD usedKnobs.features.pipelineStatisticsQuery = VK_TRUE; } + if (IsFeatureEnabled(Feature::DepthClipControl)) { + const VulkanDeviceInfo& deviceInfo = ToBackend(GetAdapter())->GetDeviceInfo(); + ASSERT(deviceInfo.HasExt(DeviceExt::DepthClipEnable) && + deviceInfo.depthClipEnableFeatures.depthClipEnable == VK_TRUE); + + usedKnobs.depthClipEnableFeatures.depthClipEnable = VK_TRUE; + featuresChain.Add(&usedKnobs.depthClipEnableFeatures, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT); + } + if (IsFeatureEnabled(Feature::ShaderFloat16)) { const VulkanDeviceInfo& deviceInfo = ToBackend(GetAdapter())->GetDeviceInfo(); ASSERT(deviceInfo.HasExt(DeviceExt::ShaderFloat16Int8) && @@ -417,11 +499,6 @@ ResultOrError Device::CreateDevice(VkPhysicalDevice physicalD VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES); } - if (IsFeatureEnabled(Feature::DepthClamping)) { - ASSERT(ToBackend(GetAdapter())->GetDeviceInfo().features.depthClamp == VK_TRUE); - usedKnobs.features.depthClamp = VK_TRUE; - } - // Find a universal queue family { // Note that GRAPHICS and COMPUTE imply TRANSFER so we don't need to check for it. @@ -755,7 +832,6 @@ MaybeError Device::ImportExternalImage(const ExternalImageDescriptorVk* descript ExternalMemoryHandle memoryHandle, VkImage image, const std::vector& waitHandles, - VkSemaphore* outSignalSemaphore, VkDeviceMemory* outAllocation, std::vector* outWaitSemaphores) { const TextureDescriptor* textureDescriptor = FromAPI(descriptor->cTextureDescriptor); @@ -779,9 +855,6 @@ MaybeError Device::ImportExternalImage(const ExternalImageDescriptorVk* descript VK_IMAGE_CREATE_ALIAS_BIT_KHR), "External memory usage not supported"); - // Create an external semaphore to signal when the texture is done being used - DAWN_TRY_ASSIGN(*outSignalSemaphore, mExternalSemaphoreService->CreateExportableSemaphore()); - // Import the external image's memory external_memory::MemoryImportParams importParams; DAWN_TRY_ASSIGN(importParams, mExternalMemoryService->GetMemoryImportParams(descriptor, image)); @@ -806,15 +879,12 @@ bool Device::SignalAndExportExternalTexture( return !ConsumedError([&]() -> MaybeError { DAWN_TRY(ValidateObject(texture)); - VkSemaphore signalSemaphore; + ExternalSemaphoreHandle semaphoreHandle; VkImageLayout releasedOldLayout; VkImageLayout releasedNewLayout; - DAWN_TRY(texture->ExportExternalTexture(desiredLayout, &signalSemaphore, &releasedOldLayout, + DAWN_TRY(texture->ExportExternalTexture(desiredLayout, &semaphoreHandle, &releasedOldLayout, &releasedNewLayout)); - ExternalSemaphoreHandle semaphoreHandle; - DAWN_TRY_ASSIGN(semaphoreHandle, - mExternalSemaphoreService->ExportSemaphore(signalSemaphore)); semaphoreHandles->push_back(semaphoreHandle); info->releasedOldLayout = releasedOldLayout; info->releasedNewLayout = releasedNewLayout; @@ -841,7 +911,6 @@ TextureBase* Device::CreateTextureWrappingVulkanImage( return nullptr; } - VkSemaphore signalSemaphore = VK_NULL_HANDLE; VkDeviceMemory allocation = VK_NULL_HANDLE; std::vector waitSemaphores; waitSemaphores.reserve(waitHandles.size()); @@ -854,18 +923,13 @@ TextureBase* Device::CreateTextureWrappingVulkanImage( mExternalMemoryService.get()), &result) || ConsumedError(ImportExternalImage(descriptor, memoryHandle, result->GetHandle(), - waitHandles, &signalSemaphore, &allocation, - &waitSemaphores)) || - ConsumedError( - result->BindExternalMemory(descriptor, signalSemaphore, allocation, waitSemaphores))) { + waitHandles, &allocation, &waitSemaphores)) || + ConsumedError(result->BindExternalMemory(descriptor, allocation, waitSemaphores))) { // Delete the Texture if it was created if (result != nullptr) { result->Release(); } - // Clear the signal semaphore - fn.DestroySemaphore(GetVkDevice(), signalSemaphore, nullptr); - // Clear image memory fn.FreeMemory(GetVkDevice(), allocation, nullptr); @@ -1000,11 +1064,6 @@ void Device::DestroyImpl() { } mRecordingContext.waitSemaphores.clear(); - for (VkSemaphore semaphore : mRecordingContext.signalSemaphores) { - fn.DestroySemaphore(mVkDevice, semaphore, nullptr); - } - mRecordingContext.signalSemaphores.clear(); - // Some commands might still be marked as in-flight if we shut down because of a device // loss. Recycle them as unused so that we free them below. RecycleCompletedCommands(); diff --git a/src/dawn/native/vulkan/DeviceVk.h b/src/dawn/native/vulkan/DeviceVk.h index b0638379bc..6e88d4cf86 100644 --- a/src/dawn/native/vulkan/DeviceVk.h +++ b/src/dawn/native/vulkan/DeviceVk.h @@ -61,6 +61,7 @@ class Device final : public DeviceBase { FencedDeleter* GetFencedDeleter() const; RenderPassCache* GetRenderPassCache() const; ResourceMemoryAllocator* GetResourceMemoryAllocator() const; + external_semaphore::Service* GetExternalSemaphoreService() const; CommandRecordingContext* GetPendingRecordingContext(); MaybeError SubmitPendingCommands(); @@ -216,7 +217,6 @@ class Device final : public DeviceBase { ExternalMemoryHandle memoryHandle, VkImage image, const std::vector& waitHandles, - VkSemaphore* outSignalSemaphore, VkDeviceMemory* outAllocation, std::vector* outWaitSemaphores); }; diff --git a/src/dawn/native/vulkan/ExternalHandle.h b/src/dawn/native/vulkan/ExternalHandle.h index 309262d72d..7b3ed9d291 100644 --- a/src/dawn/native/vulkan/ExternalHandle.h +++ b/src/dawn/native/vulkan/ExternalHandle.h @@ -19,20 +19,23 @@ namespace dawn::native::vulkan { -#if DAWN_PLATFORM_LINUX +#if DAWN_PLATFORM_IS(LINUX) // File descriptor using ExternalMemoryHandle = int; // File descriptor using ExternalSemaphoreHandle = int; -#elif DAWN_PLATFORM_FUCHSIA +const ExternalSemaphoreHandle kNullExternalSemaphoreHandle = -1; +#elif DAWN_PLATFORM_IS(FUCHSIA) // Really a Zircon vmo handle. using ExternalMemoryHandle = zx_handle_t; // Really a Zircon event handle. using ExternalSemaphoreHandle = zx_handle_t; +const ExternalSemaphoreHandle kNullExternalSemaphoreHandle = ZX_HANDLE_INVALID; #else // Generic types so that the Null service can compile, not used for real handles using ExternalMemoryHandle = void*; using ExternalSemaphoreHandle = void*; +const ExternalSemaphoreHandle kNullExternalSemaphoreHandle = nullptr; #endif } // namespace dawn::native::vulkan diff --git a/src/dawn/native/vulkan/NativeSwapChainImplVk.cpp b/src/dawn/native/vulkan/NativeSwapChainImplVk.cpp index 7deb1dbed9..836e6f5773 100644 --- a/src/dawn/native/vulkan/NativeSwapChainImplVk.cpp +++ b/src/dawn/native/vulkan/NativeSwapChainImplVk.cpp @@ -187,7 +187,7 @@ DawnSwapChainError NativeSwapChainImpl::GetNextTexture(DawnSwapChainNextTexture* } nextTexture->texture.u64 = -#if defined(DAWN_PLATFORM_64_BIT) +#if DAWN_PLATFORM_IS(64_BIT) reinterpret_cast #endif (*mSwapChainImages[mLastImageIndex]); diff --git a/src/dawn/native/vulkan/PipelineCacheVk.cpp b/src/dawn/native/vulkan/PipelineCacheVk.cpp index 60617ec17e..28aedbcd86 100644 --- a/src/dawn/native/vulkan/PipelineCacheVk.cpp +++ b/src/dawn/native/vulkan/PipelineCacheVk.cpp @@ -50,10 +50,10 @@ VkPipelineCache PipelineCache::GetHandle() const { return mHandle; } -ResultOrError PipelineCache::SerializeToBlobImpl() { - CachedBlob emptyBlob; +MaybeError PipelineCache::SerializeToBlobImpl(Blob* blob) { if (mHandle == VK_NULL_HANDLE) { - return emptyBlob; + // Pipeline cache isn't created successfully + return {}; } size_t bufferSize; @@ -61,16 +61,18 @@ ResultOrError PipelineCache::SerializeToBlobImpl() { DAWN_TRY(CheckVkSuccess( device->fn.GetPipelineCacheData(device->GetVkDevice(), mHandle, &bufferSize, nullptr), "GetPipelineCacheData")); - - CachedBlob blob(bufferSize); + if (bufferSize == 0) { + return {}; + } + *blob = CreateBlob(bufferSize); DAWN_TRY(CheckVkSuccess( - device->fn.GetPipelineCacheData(device->GetVkDevice(), mHandle, &bufferSize, blob.Data()), + device->fn.GetPipelineCacheData(device->GetVkDevice(), mHandle, &bufferSize, blob->Data()), "GetPipelineCacheData")); - return blob; + return {}; } void PipelineCache::Initialize() { - CachedBlob blob = PipelineCacheBase::Initialize(); + Blob blob = PipelineCacheBase::Initialize(); VkPipelineCacheCreateInfo createInfo; createInfo.flags = 0; diff --git a/src/dawn/native/vulkan/PipelineCacheVk.h b/src/dawn/native/vulkan/PipelineCacheVk.h index 7e56175a96..605991f3b7 100644 --- a/src/dawn/native/vulkan/PipelineCacheVk.h +++ b/src/dawn/native/vulkan/PipelineCacheVk.h @@ -38,7 +38,7 @@ class PipelineCache final : public PipelineCacheBase { ~PipelineCache() override; void Initialize(); - ResultOrError SerializeToBlobImpl() override; + MaybeError SerializeToBlobImpl(Blob* blob) override; DeviceBase* mDevice; VkPipelineCache mHandle = VK_NULL_HANDLE; diff --git a/src/dawn/native/vulkan/PipelineLayoutVk.cpp b/src/dawn/native/vulkan/PipelineLayoutVk.cpp index 48ffc0f000..a47c4eda27 100644 --- a/src/dawn/native/vulkan/PipelineLayoutVk.cpp +++ b/src/dawn/native/vulkan/PipelineLayoutVk.cpp @@ -56,7 +56,7 @@ MaybeError PipelineLayout::Initialize() { createInfo.pPushConstantRanges = nullptr; // Record cache key information now since the createInfo is not stored. - mCacheKey.RecordIterable(cachedObjects.data(), numSetLayouts).Record(createInfo); + StreamIn(&mCacheKey, stream::Iterable(cachedObjects.data(), numSetLayouts), createInfo); Device* device = ToBackend(GetDevice()); DAWN_TRY(CheckVkSuccess( diff --git a/src/dawn/native/vulkan/PipelineLayoutVk.h b/src/dawn/native/vulkan/PipelineLayoutVk.h index ca157f8d3d..2b8f5cf72a 100644 --- a/src/dawn/native/vulkan/PipelineLayoutVk.h +++ b/src/dawn/native/vulkan/PipelineLayoutVk.h @@ -31,6 +31,11 @@ class PipelineLayout final : public PipelineLayoutBase { VkPipelineLayout GetHandle() const; + // Friend definition of StreamIn which can be found by ADL to override stream::StreamIn. + friend void StreamIn(stream::Sink* sink, const PipelineLayout& obj) { + StreamIn(sink, static_cast(obj)); + } + private: ~PipelineLayout() override; void DestroyImpl() override; diff --git a/src/dawn/native/vulkan/RenderPipelineVk.cpp b/src/dawn/native/vulkan/RenderPipelineVk.cpp index 8a808a1414..372abb515b 100644 --- a/src/dawn/native/vulkan/RenderPipelineVk.cpp +++ b/src/dawn/native/vulkan/RenderPipelineVk.cpp @@ -39,6 +39,8 @@ VkVertexInputRate VulkanInputRate(wgpu::VertexStepMode stepMode) { return VK_VERTEX_INPUT_RATE_VERTEX; case wgpu::VertexStepMode::Instance: return VK_VERTEX_INPUT_RATE_INSTANCE; + case wgpu::VertexStepMode::VertexBufferNotUsed: + break; } UNREACHABLE(); } @@ -335,11 +337,11 @@ MaybeError RenderPipeline::Initialize() { const PipelineLayout* layout = ToBackend(GetLayout()); // Vulkan devices need cache UUID field to be serialized into pipeline cache keys. - mCacheKey.Record(device->GetDeviceInfo().properties.pipelineCacheUUID); + StreamIn(&mCacheKey, device->GetDeviceInfo().properties.pipelineCacheUUID); // There are at most 2 shader stages in render pipeline, i.e. vertex and fragment std::array shaderStages; - std::array, 2> specializationDataEntriesPerStages; + std::array, 2> specializationDataEntriesPerStages; std::array, 2> specializationMapEntriesPerStages; std::array specializationInfoPerStages; uint32_t stageCount = 0; @@ -349,10 +351,12 @@ MaybeError RenderPipeline::Initialize() { const ProgrammableStage& programmableStage = GetStage(stage); ShaderModule* module = ToBackend(programmableStage.module.Get()); - const ShaderModule::Spirv* spirv; - DAWN_TRY_ASSIGN(std::tie(shaderStage.module, spirv), + + ShaderModule::ModuleAndSpirv moduleAndSpirv; + DAWN_TRY_ASSIGN(moduleAndSpirv, module->GetHandleAndSpirv(programmableStage.entryPoint.c_str(), layout)); + shaderStage.module = moduleAndSpirv.module; shaderStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; shaderStage.pNext = nullptr; shaderStage.flags = 0; @@ -385,7 +389,7 @@ MaybeError RenderPipeline::Initialize() { stageCount++; // Record cache key for each shader since it will become inaccessible later on. - mCacheKey.Record(stage).RecordIterable(*spirv); + StreamIn(&mCacheKey, stream::Iterable(moduleAndSpirv.spirv, moduleAndSpirv.wordCount)); } PipelineVertexInputStateCreateInfoTemporaryAllocations tempAllocations; @@ -426,7 +430,7 @@ MaybeError RenderPipeline::Initialize() { rasterization.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rasterization.pNext = nullptr; rasterization.flags = 0; - rasterization.depthClampEnable = ShouldClampDepth() ? VK_TRUE : VK_FALSE; + rasterization.depthClampEnable = VK_FALSE; rasterization.rasterizerDiscardEnable = VK_FALSE; rasterization.polygonMode = VK_POLYGON_MODE_FILL; rasterization.cullMode = VulkanCullMode(GetCullMode()); @@ -437,6 +441,18 @@ MaybeError RenderPipeline::Initialize() { rasterization.depthBiasSlopeFactor = GetDepthBiasSlopeScale(); rasterization.lineWidth = 1.0f; + PNextChainBuilder rasterizationChain(&rasterization); + VkPipelineRasterizationDepthClipStateCreateInfoEXT depthClipState; + if (HasUnclippedDepth()) { + ASSERT(device->IsFeatureEnabled(Feature::DepthClipControl)); + depthClipState.pNext = nullptr; + depthClipState.depthClipEnable = VK_FALSE; + depthClipState.flags = 0; + rasterizationChain.Add( + &depthClipState, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT); + } + VkPipelineMultisampleStateCreateInfo multisample; multisample.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; multisample.pNext = nullptr; @@ -532,7 +548,7 @@ MaybeError RenderPipeline::Initialize() { query.SetSampleCount(GetSampleCount()); - mCacheKey.Record(query); + StreamIn(&mCacheKey, query); DAWN_TRY_ASSIGN(renderPass, device->GetRenderPassCache()->GetRenderPass(query)); } @@ -561,7 +577,7 @@ MaybeError RenderPipeline::Initialize() { createInfo.basePipelineIndex = -1; // Record cache key information now since createInfo is not stored. - mCacheKey.Record(createInfo, layout->GetCacheKey()); + StreamIn(&mCacheKey, createInfo, layout->GetCacheKey()); // Try to see if we have anything in the blob cache. Ref cache = ToBackend(GetDevice()->GetOrCreatePipelineCache(GetCacheKey())); diff --git a/src/dawn/native/vulkan/ResourceHeapVk.h b/src/dawn/native/vulkan/ResourceHeapVk.h index a148334a1e..d1c2d4aa12 100644 --- a/src/dawn/native/vulkan/ResourceHeapVk.h +++ b/src/dawn/native/vulkan/ResourceHeapVk.h @@ -24,7 +24,7 @@ namespace dawn::native::vulkan { class ResourceHeap : public ResourceHeapBase { public: ResourceHeap(VkDeviceMemory memory, size_t memoryType); - ~ResourceHeap() = default; + ~ResourceHeap() override = default; VkDeviceMemory GetMemory() const; size_t GetMemoryType() const; diff --git a/src/dawn/native/vulkan/ShaderModuleVk.cpp b/src/dawn/native/vulkan/ShaderModuleVk.cpp index e93ad87766..5477d84784 100644 --- a/src/dawn/native/vulkan/ShaderModuleVk.cpp +++ b/src/dawn/native/vulkan/ShaderModuleVk.cpp @@ -17,7 +17,10 @@ #include #include +#include +#include +#include "dawn/native/CacheRequest.h" #include "dawn/native/SpirvValidation.h" #include "dawn/native/TintUtils.h" #include "dawn/native/vulkan/BindGroupLayoutVk.h" @@ -32,6 +35,50 @@ namespace dawn::native::vulkan { +// Spirv is a wrapper around Blob that exposes the data as uint32_t words. +class ShaderModule::Spirv : private Blob { + public: + static Spirv FromBlob(Blob&& blob) { + // Vulkan drivers expect the SPIRV to be aligned like an array of uint32_t values. + blob.AlignTo(alignof(uint32_t)); + return static_cast(blob); + } + + const Blob& ToBlob() const { return *this; } + + static Spirv Create(std::vector code) { + Blob blob = CreateBlob(std::move(code)); + ASSERT(IsPtrAligned(blob.Data(), alignof(uint32_t))); + return static_cast(std::move(blob)); + } + + const uint32_t* Code() const { return reinterpret_cast(Data()); } + size_t WordCount() const { return Size() / sizeof(uint32_t); } +}; + +} // namespace dawn::native::vulkan + +namespace dawn::native::vulkan { + +class ShaderModule::ConcurrentTransformedShaderModuleCache { + public: + explicit ConcurrentTransformedShaderModuleCache(Device* device); + ~ConcurrentTransformedShaderModuleCache(); + + std::optional Find(const PipelineLayoutEntryPointPair& key); + ModuleAndSpirv AddOrGet(const PipelineLayoutEntryPointPair& key, + VkShaderModule module, + Spirv&& spirv); + + private: + using Entry = std::pair; + + Device* mDevice; + std::mutex mMutex; + std::unordered_map + mTransformedShaderModuleCache; +}; + ShaderModule::ConcurrentTransformedShaderModuleCache::ConcurrentTransformedShaderModuleCache( Device* device) : mDevice(device) {} @@ -49,7 +96,11 @@ ShaderModule::ConcurrentTransformedShaderModuleCache::Find( std::lock_guard lock(mMutex); auto iter = mTransformedShaderModuleCache.find(key); if (iter != mTransformedShaderModuleCache.end()) { - return std::make_pair(iter->second.first, iter->second.second.get()); + return ModuleAndSpirv{ + iter->second.first, + iter->second.second.Code(), + iter->second.second.WordCount(), + }; } return {}; } @@ -57,19 +108,22 @@ ShaderModule::ConcurrentTransformedShaderModuleCache::Find( ShaderModule::ModuleAndSpirv ShaderModule::ConcurrentTransformedShaderModuleCache::AddOrGet( const PipelineLayoutEntryPointPair& key, VkShaderModule module, - std::vector&& spirv) { + Spirv&& spirv) { ASSERT(module != VK_NULL_HANDLE); std::lock_guard lock(mMutex); auto iter = mTransformedShaderModuleCache.find(key); if (iter == mTransformedShaderModuleCache.end()) { - mTransformedShaderModuleCache.emplace( - key, std::make_pair(module, std::unique_ptr(new Spirv(spirv)))); + mTransformedShaderModuleCache.emplace(key, std::make_pair(module, std::move(spirv))); } else { mDevice->GetFencedDeleter()->DeleteWhenUnused(module); } // Now the key should exist in the map, so find it again and return it. iter = mTransformedShaderModuleCache.find(key); - return std::make_pair(iter->second.first, iter->second.second.get()); + return ModuleAndSpirv{ + iter->second.first, + iter->second.second.Code(), + iter->second.second.WordCount(), + }; } // static @@ -114,6 +168,18 @@ void ShaderModule::DestroyImpl() { ShaderModule::~ShaderModule() = default; +#define SPIRV_COMPILATION_REQUEST_MEMBERS(X) \ + X(const tint::Program*, inputProgram) \ + X(tint::transform::BindingRemapper::BindingPoints, bindingPoints) \ + X(tint::transform::MultiplanarExternalTexture::BindingsMap, newBindingsMap) \ + X(std::string_view, entryPointName) \ + X(bool, disableWorkgroupInit) \ + X(bool, useZeroInitializeWorkgroupMemoryExtension) \ + X(CacheKey::UnsafeUnkeyedValue, tracePlatform) + +DAWN_MAKE_CACHE_REQUEST(SpirvCompilationRequest, SPIRV_COMPILATION_REQUEST_MEMBERS); +#undef SPIRV_COMPILATION_REQUEST_MEMBERS + ResultOrError ShaderModule::GetHandleAndSpirv( const char* entryPointName, const PipelineLayout* layout) { @@ -137,15 +203,13 @@ ResultOrError ShaderModule::GetHandleAndSpirv( using BindingRemapper = tint::transform::BindingRemapper; using BindingPoint = tint::transform::BindingPoint; BindingRemapper::BindingPoints bindingPoints; - BindingRemapper::AccessControls accessControls; const BindingInfoArray& moduleBindingInfo = GetEntryPoint(entryPointName).bindings; for (BindGroupIndex group : IterateBitSet(layout->GetBindGroupLayoutsMask())) { const BindGroupLayout* bgl = ToBackend(layout->GetBindGroupLayout(group)); const auto& groupBindingInfo = moduleBindingInfo[group]; - for (const auto& it : groupBindingInfo) { - BindingNumber binding = it.first; + for (const auto& [binding, _] : groupBindingInfo) { BindingIndex bindingIndex = bgl->GetBindingIndex(binding); BindingPoint srcBindingPoint{static_cast(group), static_cast(binding)}; @@ -158,78 +222,84 @@ ResultOrError ShaderModule::GetHandleAndSpirv( } } - tint::transform::Manager transformManager; - transformManager.append(std::make_unique()); - // Many Vulkan drivers can't handle multi-entrypoint shader modules. - transformManager.append(std::make_unique()); - - tint::transform::DataMap transformInputs; - transformInputs.Add(std::move(bindingPoints), - std::move(accessControls), - /* mayCollide */ false); - transformInputs.Add(entryPointName); - // Transform external textures into the binding locations specified in the bgl - // TODO(dawn:1082): Replace this block with ShaderModuleBase::AddExternalTextureTransform. + // TODO(dawn:1082): Replace this block with BuildExternalTextureTransformBindings. tint::transform::MultiplanarExternalTexture::BindingsMap newBindingsMap; for (BindGroupIndex i : IterateBitSet(layout->GetBindGroupLayoutsMask())) { const BindGroupLayoutBase* bgl = layout->GetBindGroupLayout(i); - ExternalTextureBindingExpansionMap expansions = - bgl->GetExternalTextureBindingExpansionMap(); - - std::map::iterator it = - expansions.begin(); - - while (it != expansions.end()) { + for (const auto& [_, expansion] : bgl->GetExternalTextureBindingExpansionMap()) { newBindingsMap[{static_cast(i), - static_cast(bgl->GetBindingIndex(it->second.plane0))}] = { + static_cast(bgl->GetBindingIndex(expansion.plane0))}] = { {static_cast(i), - static_cast(bgl->GetBindingIndex(it->second.plane1))}, + static_cast(bgl->GetBindingIndex(expansion.plane1))}, {static_cast(i), - static_cast(bgl->GetBindingIndex(it->second.params))}}; - it++; + static_cast(bgl->GetBindingIndex(expansion.params))}}; } } - if (!newBindingsMap.empty()) { - transformManager.Add(); - transformInputs.Add( - newBindingsMap); - } - - tint::Program program; - { - TRACE_EVENT0(GetDevice()->GetPlatform(), General, "RunTransforms"); - DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, GetTintProgram(), transformInputs, - nullptr, nullptr)); - } - #if TINT_BUILD_SPV_WRITER - tint::writer::spirv::Options options; - options.emit_vertex_point_size = true; - options.disable_workgroup_init = GetDevice()->IsToggleEnabled(Toggle::DisableWorkgroupInit); - options.use_zero_initialize_workgroup_memory_extension = + SpirvCompilationRequest req = {}; + req.inputProgram = GetTintProgram(); + req.bindingPoints = std::move(bindingPoints); + req.newBindingsMap = std::move(newBindingsMap); + req.entryPointName = entryPointName; + req.disableWorkgroupInit = GetDevice()->IsToggleEnabled(Toggle::DisableWorkgroupInit); + req.useZeroInitializeWorkgroupMemoryExtension = GetDevice()->IsToggleEnabled(Toggle::VulkanUseZeroInitializeWorkgroupMemoryExtension); + req.tracePlatform = UnsafeUnkeyedValue(GetDevice()->GetPlatform()); - Spirv spirv; - { - TRACE_EVENT0(GetDevice()->GetPlatform(), General, "tint::writer::spirv::Generate()"); - auto result = tint::writer::spirv::Generate(&program, options); - DAWN_INVALID_IF(!result.success, "An error occured while generating SPIR-V: %s.", - result.error); + CacheResult spirv; + DAWN_TRY_LOAD_OR_RUN( + spirv, GetDevice(), std::move(req), Spirv::FromBlob, + [](SpirvCompilationRequest r) -> ResultOrError { + tint::transform::Manager transformManager; + // Many Vulkan drivers can't handle multi-entrypoint shader modules. + transformManager.append(std::make_unique()); + // Run the binding remapper after SingleEntryPoint to avoid collisions with + // unused entryPoints. + transformManager.append(std::make_unique()); + tint::transform::DataMap transformInputs; + transformInputs.Add( + std::string(r.entryPointName)); + transformInputs.Add(std::move(r.bindingPoints), + BindingRemapper::AccessControls{}, + /* mayCollide */ false); + if (!r.newBindingsMap.empty()) { + transformManager.Add(); + transformInputs.Add( + r.newBindingsMap); + } + tint::Program program; + { + TRACE_EVENT0(r.tracePlatform.UnsafeGetValue(), General, "RunTransforms"); + DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, r.inputProgram, + transformInputs, nullptr, nullptr)); + } + tint::writer::spirv::Options options; + options.emit_vertex_point_size = true; + options.disable_workgroup_init = r.disableWorkgroupInit; + options.use_zero_initialize_workgroup_memory_extension = + r.useZeroInitializeWorkgroupMemoryExtension; - spirv = std::move(result.spirv); - } + TRACE_EVENT0(r.tracePlatform.UnsafeGetValue(), General, + "tint::writer::spirv::Generate()"); + auto result = tint::writer::spirv::Generate(&program, options); + DAWN_INVALID_IF(!result.success, "An error occured while generating SPIR-V: %s.", + result.error); - DAWN_TRY(ValidateSpirv(GetDevice(), spirv, GetDevice()->IsToggleEnabled(Toggle::DumpShaders))); + return Spirv::Create(std::move(result.spirv)); + }); + + DAWN_TRY(ValidateSpirv(GetDevice(), spirv->Code(), spirv->WordCount(), + GetDevice()->IsToggleEnabled(Toggle::DumpShaders))); VkShaderModuleCreateInfo createInfo; createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; createInfo.pNext = nullptr; createInfo.flags = 0; - createInfo.codeSize = spirv.size() * sizeof(uint32_t); - createInfo.pCode = spirv.data(); + createInfo.codeSize = spirv->WordCount() * sizeof(uint32_t); + createInfo.pCode = spirv->Code(); Device* device = ToBackend(GetDevice()); @@ -240,13 +310,17 @@ ResultOrError ShaderModule::GetHandleAndSpirv( device->fn.CreateShaderModule(device->GetVkDevice(), &createInfo, nullptr, &*newHandle), "CreateShaderModule")); } + ModuleAndSpirv moduleAndSpirv; if (newHandle != VK_NULL_HANDLE) { + if (BlobCache* cache = device->GetBlobCache()) { + cache->EnsureStored(spirv); + } moduleAndSpirv = - mTransformedShaderModuleCache->AddOrGet(cacheKey, newHandle, std::move(spirv)); + mTransformedShaderModuleCache->AddOrGet(cacheKey, newHandle, spirv.Acquire()); } - SetDebugName(ToBackend(GetDevice()), moduleAndSpirv.first, "Dawn_ShaderModule", GetLabel()); + SetDebugName(ToBackend(GetDevice()), moduleAndSpirv.module, "Dawn_ShaderModule", GetLabel()); return std::move(moduleAndSpirv); #else diff --git a/src/dawn/native/vulkan/ShaderModuleVk.h b/src/dawn/native/vulkan/ShaderModuleVk.h index bd1c686b8b..c0741eff6e 100644 --- a/src/dawn/native/vulkan/ShaderModuleVk.h +++ b/src/dawn/native/vulkan/ShaderModuleVk.h @@ -17,16 +17,13 @@ #include #include -// TODO(https://crbug.com/dawn/1379) Update cpplint and remove NOLINT -#include // NOLINT(build/include_order)) +#include #include #include -#include - -#include "dawn/native/ShaderModule.h" #include "dawn/common/vulkan_platform.h" #include "dawn/native/Error.h" +#include "dawn/native/ShaderModule.h" namespace dawn::native::vulkan { @@ -35,8 +32,12 @@ class PipelineLayout; class ShaderModule final : public ShaderModuleBase { public: - using Spirv = std::vector; - using ModuleAndSpirv = std::pair; + class Spirv; + struct ModuleAndSpirv { + VkShaderModule module; + const uint32_t* spirv; + size_t wordCount; + }; static ResultOrError> Create(Device* device, const ShaderModuleDescriptor* descriptor, @@ -54,25 +55,7 @@ class ShaderModule final : public ShaderModuleBase { void DestroyImpl() override; // New handles created by GetHandleAndSpirv at pipeline creation time. - class ConcurrentTransformedShaderModuleCache { - public: - explicit ConcurrentTransformedShaderModuleCache(Device* device); - ~ConcurrentTransformedShaderModuleCache(); - - std::optional Find(const PipelineLayoutEntryPointPair& key); - ModuleAndSpirv AddOrGet(const PipelineLayoutEntryPointPair& key, - VkShaderModule module, - std::vector&& spirv); - - private: - using Entry = std::pair>; - - Device* mDevice; - std::mutex mMutex; - std:: - unordered_map - mTransformedShaderModuleCache; - }; + class ConcurrentTransformedShaderModuleCache; std::unique_ptr mTransformedShaderModuleCache; }; diff --git a/src/dawn/native/vulkan/StreamImplVk.cpp b/src/dawn/native/vulkan/StreamImplVk.cpp new file mode 100644 index 0000000000..4ed4aec46b --- /dev/null +++ b/src/dawn/native/vulkan/StreamImplVk.cpp @@ -0,0 +1,339 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include "dawn/common/Assert.h" +#include "dawn/common/vulkan_platform.h" +#include "dawn/native/stream/Stream.h" +#include "dawn/native/vulkan/RenderPassCache.h" + +#include "icd/generated/vk_typemap_helper.h" + +namespace dawn::native { + +namespace { + +namespace detail { + +template +void ValidatePnextImpl(const VkBaseOutStructure* root) { + const VkBaseOutStructure* next = reinterpret_cast(root->pNext); + while (next != nullptr) { + // Assert that the type of each pNext struct is exactly one of the specified + // templates. + ASSERT(((LvlTypeMap::kSType == next->sType ? 1 : 0) + ... + 0) == 1); + next = reinterpret_cast(next->pNext); + } +} + +template +void SerializePnextImpl(stream::Sink* sink, const VkBaseOutStructure* root) { + const VkBaseOutStructure* next = reinterpret_cast(root->pNext); + const VK_STRUCT_TYPE* found = nullptr; + while (next != nullptr) { + if (LvlTypeMap::kSType == next->sType) { + if (found == nullptr) { + found = reinterpret_cast(next); + } else { + // Fail an assert here since that means that the chain had more than one of + // the same typed chained object. + ASSERT(false); + } + } + next = reinterpret_cast(next->pNext); + } + if (found != nullptr) { + StreamIn(sink, found); + } +} + +template 0)>> +void SerializePnextImpl(stream::Sink* sink, const VkBaseOutStructure* root) { + SerializePnextImpl(sink, root); + SerializePnextImpl(sink, root); +} + +template +const VkBaseOutStructure* ToVkBaseOutStructure(const VK_STRUCT_TYPE* t) { + // Checks to ensure proper type safety. + static_assert(offsetof(VK_STRUCT_TYPE, sType) == offsetof(VkBaseOutStructure, sType) && + offsetof(VK_STRUCT_TYPE, pNext) == offsetof(VkBaseOutStructure, pNext), + "Argument type is not a proper Vulkan structure type"); + return reinterpret_cast(t); +} + +} // namespace detail + +template 0)>> +void SerializePnext(stream::Sink* sink, const VK_STRUCT_TYPE* t) { + const VkBaseOutStructure* root = detail::ToVkBaseOutStructure(t); + detail::ValidatePnextImpl(root); + detail::SerializePnextImpl(sink, root); +} + +// Empty template specialization so that we can put this in to ensure failures occur if new +// extensions are added without updating serialization. +template +void SerializePnext(stream::Sink* sink, const VK_STRUCT_TYPE* t) { + const VkBaseOutStructure* root = detail::ToVkBaseOutStructure(t); + detail::ValidatePnextImpl<>(root); +} + +} // namespace + +template <> +void stream::Stream::Write(stream::Sink* sink, + const VkDescriptorSetLayoutBinding& t) { + StreamIn(sink, t.binding, t.descriptorType, t.descriptorCount, t.stageFlags); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkDescriptorSetLayoutCreateInfo& t) { + StreamIn(sink, t.flags, Iterable(t.pBindings, t.bindingCount)); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const VkPushConstantRange& t) { + StreamIn(sink, t.stageFlags, t.offset, t.size); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const VkPipelineLayoutCreateInfo& t) { + // The set layouts are not serialized here because they are pointers to backend objects. + // They need to be cross-referenced with the frontend objects and serialized from there. + StreamIn(sink, t.flags, Iterable(t.pPushConstantRanges, t.pushConstantRangeCount)); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT& t) { + StreamIn(sink, t.requiredSubgroupSize); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineRasterizationDepthClipStateCreateInfoEXT& t) { + StreamIn(sink, t.depthClipEnable, t.flags); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const VkSpecializationMapEntry& t) { + StreamIn(sink, t.constantID, t.offset, t.size); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const VkSpecializationInfo& t) { + StreamIn(sink, Iterable(t.pMapEntries, t.mapEntryCount), + Iterable(static_cast(t.pData), t.dataSize)); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineShaderStageCreateInfo& t) { + // The shader module is not serialized here because it is a pointer to a backend object. + StreamIn(sink, t.flags, t.stage, Iterable(t.pName, strlen(t.pName)), t.pSpecializationInfo); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const VkComputePipelineCreateInfo& t) { + // The pipeline layout is not serialized here because it is a pointer to a backend object. + // It needs to be cross-referenced with the frontend objects and serialized from there. The + // base pipeline information is also currently not serialized since we do not use them in our + // backend implementation. If we decide to use them later on, they also need to be + // cross-referenced from the frontend. + StreamIn(sink, t.flags, t.stage); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkVertexInputBindingDescription& t) { + StreamIn(sink, t.binding, t.stride, t.inputRate); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkVertexInputAttributeDescription& t) { + StreamIn(sink, t.location, t.binding, t.format, t.offset); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineVertexInputStateCreateInfo& t) { + StreamIn(sink, t.flags, Iterable(t.pVertexBindingDescriptions, t.vertexBindingDescriptionCount), + Iterable(t.pVertexAttributeDescriptions, t.vertexAttributeDescriptionCount)); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineInputAssemblyStateCreateInfo& t) { + StreamIn(sink, t.flags, t.topology, t.primitiveRestartEnable); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineTessellationStateCreateInfo& t) { + StreamIn(sink, t.flags, t.patchControlPoints); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const VkViewport& t) { + StreamIn(sink, t.x, t.y, t.width, t.height, t.minDepth, t.maxDepth); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const VkOffset2D& t) { + StreamIn(sink, t.x, t.y); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const VkExtent2D& t) { + StreamIn(sink, t.width, t.height); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const VkRect2D& t) { + StreamIn(sink, t.offset, t.extent); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineViewportStateCreateInfo& t) { + StreamIn(sink, t.flags, Iterable(t.pViewports, t.viewportCount), + Iterable(t.pScissors, t.scissorCount)); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineRasterizationStateCreateInfo& t) { + StreamIn(sink, t.flags, t.depthClampEnable, t.rasterizerDiscardEnable, t.polygonMode, + t.cullMode, t.frontFace, t.depthBiasEnable, t.depthBiasConstantFactor, + t.depthBiasClamp, t.depthBiasSlopeFactor, t.lineWidth); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineMultisampleStateCreateInfo& t) { + StreamIn(sink, t.flags, t.rasterizationSamples, t.sampleShadingEnable, t.minSampleShading, + t.pSampleMask, t.alphaToCoverageEnable, t.alphaToOneEnable); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, const VkStencilOpState& t) { + StreamIn(sink, t.failOp, t.passOp, t.depthFailOp, t.compareOp, t.compareMask, t.writeMask, + t.reference); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineDepthStencilStateCreateInfo& t) { + StreamIn(sink, t.flags, t.depthTestEnable, t.depthWriteEnable, t.depthCompareOp, + t.depthBoundsTestEnable, t.stencilTestEnable, t.front, t.back, t.minDepthBounds, + t.maxDepthBounds); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineColorBlendAttachmentState& t) { + StreamIn(sink, t.blendEnable, t.srcColorBlendFactor, t.dstColorBlendFactor, t.colorBlendOp, + t.srcAlphaBlendFactor, t.dstAlphaBlendFactor, t.alphaBlendOp, t.colorWriteMask); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineColorBlendStateCreateInfo& t) { + StreamIn(sink, t.flags, t.logicOpEnable, t.logicOp, Iterable(t.pAttachments, t.attachmentCount), + t.blendConstants); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write( + stream::Sink* sink, + const VkPipelineDynamicStateCreateInfo& t) { + StreamIn(sink, t.flags, Iterable(t.pDynamicStates, t.dynamicStateCount)); + SerializePnext(sink, &t); +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const vulkan::RenderPassCacheQuery& t) { + StreamIn(sink, t.colorMask.to_ulong(), t.resolveTargetMask.to_ulong(), t.sampleCount); + + // Manually iterate the color attachment indices and their corresponding format/load/store + // ops because the data is sparse and may be uninitialized. Since we serialize the colorMask + // member above, serializing sparse data should be fine here. + for (ColorAttachmentIndex i : IterateBitSet(t.colorMask)) { + StreamIn(sink, t.colorFormats[i], t.colorLoadOp[i], t.colorStoreOp[i]); + } + + // Serialize the depth-stencil toggle bit, and the parameters if applicable. + StreamIn(sink, t.hasDepthStencil); + if (t.hasDepthStencil) { + StreamIn(sink, t.depthStencilFormat, t.depthLoadOp, t.depthStoreOp, t.stencilLoadOp, + t.stencilStoreOp, t.readOnlyDepthStencil); + } +} + +template <> +void stream::Stream::Write(stream::Sink* sink, + const VkGraphicsPipelineCreateInfo& t) { + // The pipeline layout and render pass are not serialized here because they are pointers to + // backend objects. They need to be cross-referenced with the frontend objects and + // serialized from there. The base pipeline information is also currently not serialized since + // we do not use them in our backend implementation. If we decide to use them later on, they + // also need to be cross-referenced from the frontend. + StreamIn(sink, t.flags, Iterable(t.pStages, t.stageCount), t.pVertexInputState, + t.pInputAssemblyState, t.pTessellationState, t.pViewportState, t.pRasterizationState, + t.pMultisampleState, t.pDepthStencilState, t.pColorBlendState, t.pDynamicState, + t.subpass); + SerializePnext(sink, &t); +} + +} // namespace dawn::native diff --git a/src/dawn/native/vulkan/SwapChainVk.cpp b/src/dawn/native/vulkan/SwapChainVk.cpp index 24a45eb163..209c403f13 100644 --- a/src/dawn/native/vulkan/SwapChainVk.cpp +++ b/src/dawn/native/vulkan/SwapChainVk.cpp @@ -117,7 +117,7 @@ ResultOrError CreateVulkanSurface(Adapter* adapter, Surface* surfa break; #endif // defined(DAWN_ENABLE_BACKEND_METAL) -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) case Surface::Type::WindowsHWND: if (info.HasExt(InstanceExt::Win32Surface)) { VkWin32SurfaceCreateInfoKHR createInfo; @@ -134,9 +134,9 @@ ResultOrError CreateVulkanSurface(Adapter* adapter, Surface* surfa return vkSurface; } break; -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) -#if defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(ANDROID) case Surface::Type::AndroidWindow: { if (info.HasExt(InstanceExt::AndroidSurface)) { ASSERT(surface->GetAndroidNativeWindow() != nullptr); @@ -158,7 +158,27 @@ ResultOrError CreateVulkanSurface(Adapter* adapter, Surface* surfa break; } -#endif // defined(DAWN_PLATFORM_ANDROID) +#endif // DAWN_PLATFORM_IS(ANDROID) + +#if defined(DAWN_USE_WAYLAND) + case Surface::Type::WaylandSurface: { + if (info.HasExt(InstanceExt::XlibSurface)) { + VkWaylandSurfaceCreateInfoKHR createInfo; + createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = nullptr; + createInfo.flags = 0; + createInfo.display = static_cast(surface->GetWaylandDisplay()); + createInfo.surface = static_cast(surface->GetWaylandSurface()); + + VkSurfaceKHR vkSurface = VK_NULL_HANDLE; + DAWN_TRY(CheckVkSuccess( + fn.CreateWaylandSurfaceKHR(instance, &createInfo, nullptr, &*vkSurface), + "CreateWaylandSurface")); + return vkSurface; + } + break; + } +#endif // defined(DAWN_USE_WAYLAND) #if defined(DAWN_USE_X11) case Surface::Type::XlibWindow: { @@ -431,7 +451,7 @@ ResultOrError SwapChain::ChooseConfig( config.transform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; config.alphaMode = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; -#if !defined(DAWN_PLATFORM_ANDROID) +#if !DAWN_PLATFORM_IS(ANDROID) DAWN_INVALID_IF( (surfaceInfo.capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR) == 0, "Vulkan SwapChain must support opaque alpha."); @@ -449,7 +469,7 @@ ResultOrError SwapChain::ChooseConfig( break; } } -#endif // #if !defined(DAWN_PLATFORM_ANDROID) +#endif // #if !DAWN_PLATFORM_IS(ANDROID) // Choose the number of images for the swapchain= and clamp it to the min and max from the // surface capabilities. maxImageCount = 0 means there is no limit. diff --git a/src/dawn/native/vulkan/TextureVk.cpp b/src/dawn/native/vulkan/TextureVk.cpp index 050050a7c4..49df3ed7f0 100644 --- a/src/dawn/native/vulkan/TextureVk.cpp +++ b/src/dawn/native/vulkan/TextureVk.cpp @@ -314,8 +314,6 @@ VkFormat VulkanImageFormat(const Device* device, wgpu::TextureFormat format) { } else { return VK_FORMAT_D24_UNORM_S8_UINT; } - case wgpu::TextureFormat::Depth24UnormStencil8: - return VK_FORMAT_D24_UNORM_S8_UINT; case wgpu::TextureFormat::Depth32FloatStencil8: return VK_FORMAT_D32_SFLOAT_S8_UINT; case wgpu::TextureFormat::Stencil8: @@ -785,7 +783,6 @@ void Texture::InitializeForSwapChain(VkImage nativeImage) { } MaybeError Texture::BindExternalMemory(const ExternalImageDescriptorVk* descriptor, - VkSemaphore signalSemaphore, VkDeviceMemory externalMemoryAllocation, std::vector waitSemaphores) { Device* device = ToBackend(GetDevice()); @@ -800,17 +797,53 @@ MaybeError Texture::BindExternalMemory(const ExternalImageDescriptorVk* descript // Success, acquire all the external objects. mExternalAllocation = externalMemoryAllocation; - mSignalSemaphore = signalSemaphore; mWaitRequirements = std::move(waitSemaphores); return {}; } +void Texture::TransitionEagerlyForExport(CommandRecordingContext* recordingContext) { + mExternalState = ExternalState::EagerlyTransitioned; + + Aspect aspects = ComputeAspectsForSubresourceStorage(); + ASSERT(GetNumMipLevels() == 1 && GetArrayLayers() == 1); + SubresourceRange range = {aspects, {0, 1}, {0, 1}}; + + wgpu::TextureUsage usage = mSubresourceLastUsages->Get(aspects, 0, 0); + + std::vector barriers; + VkPipelineStageFlags srcStages = 0; + VkPipelineStageFlags dstStages = 0; + + // Same usage as last. + TransitionUsageAndGetResourceBarrier(usage, range, &barriers, &srcStages, &dstStages); + + ASSERT(barriers.size() == 1); + VkImageMemoryBarrier& barrier = barriers[0]; + // The barrier must be paired with another barrier that will specify the dst access mask on the + // importing queue. + barrier.dstAccessMask = 0; + + if (mDesiredExportLayout != VK_IMAGE_LAYOUT_UNDEFINED) { + barrier.newLayout = mDesiredExportLayout; + } + + Device* device = ToBackend(GetDevice()); + barrier.srcQueueFamilyIndex = device->GetGraphicsQueueFamily(); + barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_EXTERNAL_KHR; + + // We don't know when the importing queue will need the texture, so pass + // VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT to ensure the barrier happens-before any usage in the + // importing queue. + dstStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + + device->fn.CmdPipelineBarrier(recordingContext->commandBuffer, srcStages, dstStages, 0, 0, + nullptr, 0, nullptr, 1, &barrier); +} + MaybeError Texture::ExportExternalTexture(VkImageLayout desiredLayout, - VkSemaphore* signalSemaphore, + ExternalSemaphoreHandle* handle, VkImageLayout* releasedOldLayout, VkImageLayout* releasedNewLayout) { - Device* device = ToBackend(GetDevice()); - DAWN_INVALID_IF(mExternalState == ExternalState::Released, "Can't export a signal semaphore from signaled texture %s.", this); @@ -818,8 +851,6 @@ MaybeError Texture::ExportExternalTexture(VkImageLayout desiredLayout, "Can't export a signal semaphore from destroyed or non-external texture %s.", this); - ASSERT(mSignalSemaphore != VK_NULL_HANDLE); - // Release the texture mExternalState = ExternalState::Released; @@ -827,54 +858,28 @@ MaybeError Texture::ExportExternalTexture(VkImageLayout desiredLayout, ASSERT(GetNumMipLevels() == 1 && GetArrayLayers() == 1); wgpu::TextureUsage usage = mSubresourceLastUsages->Get(aspects, 0, 0); - VkImageMemoryBarrier barrier; - barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barrier.pNext = nullptr; - barrier.image = GetHandle(); - barrier.subresourceRange.aspectMask = VulkanAspectMask(aspects); - barrier.subresourceRange.baseMipLevel = 0; - barrier.subresourceRange.levelCount = 1; - barrier.subresourceRange.baseArrayLayer = 0; - barrier.subresourceRange.layerCount = 1; - - barrier.srcAccessMask = VulkanAccessFlags(usage, GetFormat()); - barrier.dstAccessMask = 0; // The barrier must be paired with another barrier that will - // specify the dst access mask on the importing queue. - - barrier.oldLayout = VulkanImageLayout(this, usage); - if (desiredLayout == VK_IMAGE_LAYOUT_UNDEFINED) { - // VK_IMAGE_LAYOUT_UNDEFINED is invalid here. We use it as a - // special value to indicate no layout transition should be done. - barrier.newLayout = barrier.oldLayout; - } else { - barrier.newLayout = desiredLayout; - } - - barrier.srcQueueFamilyIndex = device->GetGraphicsQueueFamily(); - barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_EXTERNAL_KHR; - - VkPipelineStageFlags srcStages = VulkanPipelineStage(usage, GetFormat()); - VkPipelineStageFlags dstStages = - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; // We don't know when the importing queue will need - // the texture, so pass - // VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT to ensure - // the barrier happens-before any usage in the - // importing queue. - - CommandRecordingContext* recordingContext = device->GetPendingRecordingContext(); - device->fn.CmdPipelineBarrier(recordingContext->commandBuffer, srcStages, dstStages, 0, 0, - nullptr, 0, nullptr, 1, &barrier); - - // Queue submit to signal we are done with the texture - recordingContext->signalSemaphores.push_back(mSignalSemaphore); - DAWN_TRY(device->SubmitPendingCommands()); + VkImageLayout layout = VulkanImageLayout(this, usage); // Write out the layouts and signal semaphore - *releasedOldLayout = barrier.oldLayout; - *releasedNewLayout = barrier.newLayout; - *signalSemaphore = mSignalSemaphore; + *releasedOldLayout = layout; + *releasedNewLayout = (desiredLayout == VK_IMAGE_LAYOUT_UNDEFINED ? layout : desiredLayout); - mSignalSemaphore = VK_NULL_HANDLE; + mDesiredExportLayout = desiredLayout; + + // We have to manually trigger a transition if the texture hasn't been actually used, or the + // desired layout is not VK_IMAGE_LAYOUT_UNDEFINED. + // TODO(dawn:1509): Avoid the empty submit. + if (mExternalSemaphoreHandle == kNullExternalSemaphoreHandle || + desiredLayout != VK_IMAGE_LAYOUT_UNDEFINED) { + Device* device = ToBackend(GetDevice()); + CommandRecordingContext* recordingContext = device->GetPendingRecordingContext(); + recordingContext->externalTexturesForEagerTransition.insert(this); + DAWN_TRY(device->SubmitPendingCommands()); + } + ASSERT(mExternalSemaphoreHandle != kNullExternalSemaphoreHandle); + + *handle = mExternalSemaphoreHandle; + mExternalSemaphoreHandle = kNullExternalSemaphoreHandle; // Destroy the texture so it can't be used again Destroy(); @@ -909,8 +914,11 @@ void Texture::DestroyImpl() { mHandle = VK_NULL_HANDLE; mExternalAllocation = VK_NULL_HANDLE; - // If a signal semaphore exists it should be requested before we delete the texture - ASSERT(mSignalSemaphore == VK_NULL_HANDLE); + + if (mExternalSemaphoreHandle != kNullExternalSemaphoreHandle) { + device->GetExternalSemaphoreService()->CloseHandle(mExternalSemaphoreHandle); + } + mExternalSemaphoreHandle = kNullExternalSemaphoreHandle; } // For Vulkan, we currently run the base destruction code after the internal changes because // of the dependency on the texture state which the base code overwrites too early. @@ -931,7 +939,9 @@ void Texture::TweakTransitionForExternalUsage(CommandRecordingContext* recording // have already added into the vector during current transition. ASSERT(barriers->size() - transitionBarrierStart <= 1); - if (mExternalState == ExternalState::PendingAcquire) { + if (mExternalState == ExternalState::PendingAcquire || + mExternalState == ExternalState::EagerlyTransitioned) { + recordingContext->externalTexturesForEagerTransition.insert(this); if (barriers->size() == transitionBarrierStart) { barriers->push_back(BuildMemoryBarrier( this, wgpu::TextureUsage::None, wgpu::TextureUsage::None, @@ -948,27 +958,35 @@ void Texture::TweakTransitionForExternalUsage(CommandRecordingContext* recording // this. barrier->srcAccessMask = 0; - // This should be the first barrier after import. - ASSERT(barrier->oldLayout == VK_IMAGE_LAYOUT_UNDEFINED); - // Save the desired layout. We may need to transition through an intermediate // |mPendingAcquireLayout| first. VkImageLayout desiredLayout = barrier->newLayout; - bool isInitialized = IsSubresourceContentInitialized(GetAllSubresources()); + if (mExternalState == ExternalState::PendingAcquire) { + bool isInitialized = IsSubresourceContentInitialized(GetAllSubresources()); - // We don't care about the pending old layout if the texture is uninitialized. The - // driver is free to discard it. Also it is invalid to transition to layout UNDEFINED or - // PREINITIALIZED. If the embedder provided no new layout, or we don't care about the - // previous contents, we can skip the layout transition. - // https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkImageMemoryBarrier-newLayout-01198 - if (!isInitialized || mPendingAcquireNewLayout == VK_IMAGE_LAYOUT_UNDEFINED || - mPendingAcquireNewLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) { - barrier->oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - barrier->newLayout = desiredLayout; + // We don't care about the pending old layout if the texture is uninitialized. The + // driver is free to discard it. Also it is invalid to transition to layout UNDEFINED or + // PREINITIALIZED. If the embedder provided no new layout, or we don't care about the + // previous contents, we can skip the layout transition. + // https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkImageMemoryBarrier-newLayout-01198 + if (!isInitialized || mPendingAcquireNewLayout == VK_IMAGE_LAYOUT_UNDEFINED || + mPendingAcquireNewLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) { + barrier->oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + barrier->newLayout = desiredLayout; + } else { + barrier->oldLayout = mPendingAcquireOldLayout; + barrier->newLayout = mPendingAcquireNewLayout; + } } else { - barrier->oldLayout = mPendingAcquireOldLayout; - barrier->newLayout = mPendingAcquireNewLayout; + // In case of ExternalState::EagerlyTransitioned, the layouts of the texture's queue + // release were always same. So we exactly match that here for the queue acquire. + // The spec text: + // If the transfer is via an image memory barrier, and an image layout transition is + // desired, then the values of oldLayout and newLayout in the release operation's memory + // barrier must be equal to values of oldLayout and newLayout in the acquire operation's + // memory barrier. + barrier->newLayout = barrier->oldLayout; } // If these are unequal, we need an another barrier to transition the layout. @@ -983,9 +1001,8 @@ void Texture::TweakTransitionForExternalUsage(CommandRecordingContext* recording layoutBarrier.oldLayout = barrier->newLayout; layoutBarrier.newLayout = desiredLayout; - // We already transitioned these. layoutBarrier.srcAccessMask = 0; - layoutBarrier.dstAccessMask = 0; + layoutBarrier.dstAccessMask = barrier->dstAccessMask; layoutBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; layoutBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; @@ -1195,7 +1212,7 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* recordingContext, ASSERT(range.aspects == Aspect::Color); const TexelBlockInfo& blockInfo = GetFormat().GetAspectInfo(range.aspects).block; - Extent3D largestMipSize = GetMipLevelPhysicalSize(range.baseMipLevel); + Extent3D largestMipSize = GetMipLevelSingleSubresourcePhysicalSize(range.baseMipLevel); uint32_t bytesPerRow = Align((largestMipSize.width / blockInfo.width) * blockInfo.byteSize, device->GetOptimalBytesPerRowAlignment()); @@ -1211,7 +1228,7 @@ MaybeError Texture::ClearTexture(CommandRecordingContext* recordingContext, std::vector regions; for (uint32_t level = range.baseMipLevel; level < range.baseMipLevel + range.levelCount; ++level) { - Extent3D copySize = GetMipLevelPhysicalSize(level); + Extent3D copySize = GetMipLevelSingleSubresourcePhysicalSize(level); imageRange.baseMipLevel = level; for (uint32_t layer = range.baseArrayLayer; layer < range.baseArrayLayer + range.layerCount; ++layer) { @@ -1324,6 +1341,14 @@ void Texture::EnsureSubresourceContentInitialized(CommandRecordingContext* recor } } +void Texture::UpdateExternalSemaphoreHandle(ExternalSemaphoreHandle handle) { + if (mExternalSemaphoreHandle != kNullExternalSemaphoreHandle) { + Device* device = ToBackend(GetDevice()); + device->GetExternalSemaphoreService()->CloseHandle(mExternalSemaphoreHandle); + } + mExternalSemaphoreHandle = handle; +} + VkImageLayout Texture::GetCurrentLayoutForSwapChain() const { ASSERT(GetFormat().aspects == Aspect::Color); return VulkanImageLayout(this, mSubresourceLastUsages->Get(Aspect::Color, 0, 0)); diff --git a/src/dawn/native/vulkan/TextureVk.h b/src/dawn/native/vulkan/TextureVk.h index 4be64775c5..4caf11b774 100644 --- a/src/dawn/native/vulkan/TextureVk.h +++ b/src/dawn/native/vulkan/TextureVk.h @@ -24,6 +24,7 @@ #include "dawn/native/Texture.h" #include "dawn/native/vulkan/ExternalHandle.h" #include "dawn/native/vulkan/external_memory/MemoryService.h" +#include "dawn/native/vulkan/external_semaphore/SemaphoreService.h" namespace dawn::native::vulkan { @@ -77,6 +78,9 @@ class Texture final : public TextureBase { VkPipelineStageFlags* srcStages, VkPipelineStageFlags* dstStages); + // Eagerly transition the texture for export. + void TransitionEagerlyForExport(CommandRecordingContext* recordingContext); + void EnsureSubresourceContentInitialized(CommandRecordingContext* recordingContext, const SubresourceRange& range); @@ -85,12 +89,12 @@ class Texture final : public TextureBase { // Binds externally allocated memory to the VkImage and on success, takes ownership of // semaphores. MaybeError BindExternalMemory(const ExternalImageDescriptorVk* descriptor, - VkSemaphore signalSemaphore, VkDeviceMemory externalMemoryAllocation, std::vector waitSemaphores); - + // Update the 'ExternalSemaphoreHandle' to be used for export with the newly submitted one. + void UpdateExternalSemaphoreHandle(ExternalSemaphoreHandle handle); MaybeError ExportExternalTexture(VkImageLayout desiredLayout, - VkSemaphore* signalSemaphore, + ExternalSemaphoreHandle* handle, VkImageLayout* releasedOldLayout, VkImageLayout* releasedNewLayout); @@ -156,14 +160,30 @@ class Texture final : public TextureBase { ResourceMemoryAllocation mMemoryAllocation; VkDeviceMemory mExternalAllocation = VK_NULL_HANDLE; - enum class ExternalState { InternalOnly, PendingAcquire, Acquired, Released }; + // The states of an external texture: + // InternalOnly: Not initialized as an external texture yet. + // PendingAcquire: Intialized as an external texture already, but unavailable for access yet. + // Acquired: Ready for access. + // EagerlyTransitioned: The texture has ever been used, and eagerly transitioned for export. + // Now it can be acquired for access again, or directly exported. Released: The texture has + // been destoried, and should no longer be used. + enum class ExternalState { + InternalOnly, + PendingAcquire, + Acquired, + EagerlyTransitioned, + Released + }; ExternalState mExternalState = ExternalState::InternalOnly; ExternalState mLastExternalState = ExternalState::InternalOnly; VkImageLayout mPendingAcquireOldLayout; VkImageLayout mPendingAcquireNewLayout; - VkSemaphore mSignalSemaphore = VK_NULL_HANDLE; + VkImageLayout mDesiredExportLayout = VK_IMAGE_LAYOUT_UNDEFINED; + + ExternalSemaphoreHandle mExternalSemaphoreHandle = kNullExternalSemaphoreHandle; + std::vector mWaitRequirements; // Note that in early Vulkan versions it is not possible to transition depth and stencil diff --git a/src/dawn/native/vulkan/UtilsVulkan.cpp b/src/dawn/native/vulkan/UtilsVulkan.cpp index fe034244fd..ca8b4052ca 100644 --- a/src/dawn/native/vulkan/UtilsVulkan.cpp +++ b/src/dawn/native/vulkan/UtilsVulkan.cpp @@ -114,7 +114,8 @@ VkImageAspectFlags VulkanAspectMask(const Aspect& aspects) { Extent3D ComputeTextureCopyExtent(const TextureCopy& textureCopy, const Extent3D& copySize) { Extent3D validTextureCopyExtent = copySize; const TextureBase* texture = textureCopy.texture.Get(); - Extent3D virtualSizeAtLevel = texture->GetMipLevelVirtualSize(textureCopy.mipLevel); + Extent3D virtualSizeAtLevel = + texture->GetMipLevelSingleSubresourceVirtualSize(textureCopy.mipLevel); ASSERT(textureCopy.origin.x <= virtualSizeAtLevel.width); ASSERT(textureCopy.origin.y <= virtualSizeAtLevel.height); if (copySize.width > virtualSizeAtLevel.width - textureCopy.origin.x) { @@ -260,7 +261,7 @@ std::string GetDeviceDebugPrefixFromDebugName(const char* debugName) { VkSpecializationInfo* GetVkSpecializationInfo( const ProgrammableStage& programmableStage, VkSpecializationInfo* specializationInfo, - std::vector* specializationDataEntries, + std::vector* specializationDataEntries, std::vector* specializationMapEntries) { ASSERT(specializationInfo); ASSERT(specializationDataEntries); @@ -278,26 +279,25 @@ VkSpecializationInfo* GetVkSpecializationInfo( double value = pipelineConstant.second; // This is already validated so `identifier` must exist - const auto& moduleConstant = entryPointMetaData.overridableConstants.at(identifier); + const auto& moduleConstant = entryPointMetaData.overrides.at(identifier); - specializationMapEntries->push_back( - VkSpecializationMapEntry{moduleConstant.id, - static_cast(specializationDataEntries->size() * - sizeof(OverridableConstantScalar)), - sizeof(OverridableConstantScalar)}); + specializationMapEntries->push_back(VkSpecializationMapEntry{ + moduleConstant.id, + static_cast(specializationDataEntries->size() * sizeof(OverrideScalar)), + sizeof(OverrideScalar)}); - OverridableConstantScalar entry{}; + OverrideScalar entry{}; switch (moduleConstant.type) { - case EntryPointMetadata::OverridableConstant::Type::Boolean: + case EntryPointMetadata::Override::Type::Boolean: entry.b = static_cast(value); break; - case EntryPointMetadata::OverridableConstant::Type::Float32: + case EntryPointMetadata::Override::Type::Float32: entry.f32 = static_cast(value); break; - case EntryPointMetadata::OverridableConstant::Type::Int32: + case EntryPointMetadata::Override::Type::Int32: entry.i32 = static_cast(value); break; - case EntryPointMetadata::OverridableConstant::Type::Uint32: + case EntryPointMetadata::Override::Type::Uint32: entry.u32 = static_cast(value); break; default: @@ -308,8 +308,7 @@ VkSpecializationInfo* GetVkSpecializationInfo( specializationInfo->mapEntryCount = static_cast(specializationMapEntries->size()); specializationInfo->pMapEntries = specializationMapEntries->data(); - specializationInfo->dataSize = - specializationDataEntries->size() * sizeof(OverridableConstantScalar); + specializationInfo->dataSize = specializationDataEntries->size() * sizeof(OverrideScalar); specializationInfo->pData = specializationDataEntries->data(); return specializationInfo; diff --git a/src/dawn/native/vulkan/UtilsVulkan.h b/src/dawn/native/vulkan/UtilsVulkan.h index 7c63b1dfcd..3e2748e173 100644 --- a/src/dawn/native/vulkan/UtilsVulkan.h +++ b/src/dawn/native/vulkan/UtilsVulkan.h @@ -24,7 +24,7 @@ namespace dawn::native { struct ProgrammableStage; -union OverridableConstantScalar; +union OverrideScalar; } // namespace dawn::native namespace dawn::native::vulkan { @@ -150,7 +150,7 @@ std::string GetDeviceDebugPrefixFromDebugName(const char* debugName); VkSpecializationInfo* GetVkSpecializationInfo( const ProgrammableStage& programmableStage, VkSpecializationInfo* specializationInfo, - std::vector* specializationDataEntries, + std::vector* specializationDataEntries, std::vector* specializationMapEntries); } // namespace dawn::native::vulkan diff --git a/src/dawn/native/vulkan/VulkanBackend.cpp b/src/dawn/native/vulkan/VulkanBackend.cpp index 1b18e452df..0f460abe30 100644 --- a/src/dawn/native/vulkan/VulkanBackend.cpp +++ b/src/dawn/native/vulkan/VulkanBackend.cpp @@ -60,7 +60,7 @@ WGPUTextureFormat GetNativeSwapChainPreferredFormat(const DawnSwapChainImplement AdapterDiscoveryOptions::AdapterDiscoveryOptions() : AdapterDiscoveryOptionsBase(WGPUBackendType_Vulkan) {} -#if defined(DAWN_PLATFORM_LINUX) +#if DAWN_PLATFORM_IS(LINUX) ExternalImageDescriptorOpaqueFD::ExternalImageDescriptorOpaqueFD() : ExternalImageDescriptorFD(ExternalImageType::OpaqueFD) {} @@ -72,10 +72,10 @@ ExternalImageExportInfoOpaqueFD::ExternalImageExportInfoOpaqueFD() ExternalImageExportInfoDmaBuf::ExternalImageExportInfoDmaBuf() : ExternalImageExportInfoFD(ExternalImageType::DmaBuf) {} -#endif // DAWN_PLATFORM_LINUX +#endif // DAWN_PLATFORM_IS(LINUX) WGPUTexture WrapVulkanImage(WGPUDevice device, const ExternalImageDescriptorVk* descriptor) { -#if defined(DAWN_PLATFORM_LINUX) +#if DAWN_PLATFORM_IS(LINUX) switch (descriptor->GetType()) { case ExternalImageType::OpaqueFD: case ExternalImageType::DmaBuf: { @@ -91,7 +91,7 @@ WGPUTexture WrapVulkanImage(WGPUDevice device, const ExternalImageDescriptorVk* } #else return nullptr; -#endif // DAWN_PLATFORM_LINUX +#endif // DAWN_PLATFORM_IS(LINUX) } bool ExportVulkanImage(WGPUTexture texture, @@ -100,7 +100,7 @@ bool ExportVulkanImage(WGPUTexture texture, if (texture == nullptr) { return false; } -#if defined(DAWN_PLATFORM_LINUX) +#if DAWN_PLATFORM_IS(LINUX) switch (info->GetType()) { case ExternalImageType::OpaqueFD: case ExternalImageType::DmaBuf: { @@ -116,7 +116,7 @@ bool ExportVulkanImage(WGPUTexture texture, } #else return false; -#endif // DAWN_PLATFORM_LINUX +#endif // DAWN_PLATFORM_IS(LINUX) } } // namespace dawn::native::vulkan diff --git a/src/dawn/native/vulkan/VulkanExtensions.cpp b/src/dawn/native/vulkan/VulkanExtensions.cpp index 6f6ab1d3b0..aaf3e65830 100644 --- a/src/dawn/native/vulkan/VulkanExtensions.cpp +++ b/src/dawn/native/vulkan/VulkanExtensions.cpp @@ -22,9 +22,9 @@ namespace dawn::native::vulkan { -static constexpr uint32_t VulkanVersion_1_1 = VK_MAKE_VERSION(1, 1, 0); -static constexpr uint32_t VulkanVersion_1_2 = VK_MAKE_VERSION(1, 2, 0); -static constexpr uint32_t VulkanVersion_1_3 = VK_MAKE_VERSION(1, 3, 0); +static constexpr uint32_t VulkanVersion_1_1 = VK_API_VERSION_1_1; +static constexpr uint32_t VulkanVersion_1_2 = VK_API_VERSION_1_2; +static constexpr uint32_t VulkanVersion_1_3 = VK_API_VERSION_1_3; static constexpr uint32_t NeverPromoted = std::numeric_limits::max(); // A static array for InstanceExtInfo that can be indexed with InstanceExts. @@ -152,6 +152,7 @@ static constexpr std::array sDeviceExtInfos{{ {DeviceExt::ImageFormatList, "VK_KHR_image_format_list", VulkanVersion_1_2}, {DeviceExt::ShaderFloat16Int8, "VK_KHR_shader_float16_int8", VulkanVersion_1_2}, + {DeviceExt::ShaderIntegerDotProduct, "VK_KHR_shader_integer_dot_product", VulkanVersion_1_3}, {DeviceExt::ZeroInitializeWorkgroupMemory, "VK_KHR_zero_initialize_workgroup_memory", VulkanVersion_1_3}, @@ -161,6 +162,7 @@ static constexpr std::array sDeviceExtInfos{{ {DeviceExt::ExternalSemaphoreFD, "VK_KHR_external_semaphore_fd", NeverPromoted}, {DeviceExt::ExternalSemaphoreZirconHandle, "VK_FUCHSIA_external_semaphore", NeverPromoted}, + {DeviceExt::DepthClipEnable, "VK_EXT_depth_clip_enable", NeverPromoted}, {DeviceExt::ImageDrmFormatModifier, "VK_EXT_image_drm_format_modifier", NeverPromoted}, {DeviceExt::Swapchain, "VK_KHR_swapchain", NeverPromoted}, {DeviceExt::SubgroupSizeControl, "VK_EXT_subgroup_size_control", NeverPromoted}, @@ -282,6 +284,8 @@ DeviceExtSet EnsureDependencies(const DeviceExtSet& advertisedExts, hasDependencies = icdVersion >= VulkanVersion_1_1; break; + case DeviceExt::DepthClipEnable: + case DeviceExt::ShaderIntegerDotProduct: case DeviceExt::ZeroInitializeWorkgroupMemory: hasDependencies = HasDep(DeviceExt::GetPhysicalDeviceProperties2); break; diff --git a/src/dawn/native/vulkan/VulkanExtensions.h b/src/dawn/native/vulkan/VulkanExtensions.h index 78189a13f4..eb6ef49a42 100644 --- a/src/dawn/native/vulkan/VulkanExtensions.h +++ b/src/dawn/native/vulkan/VulkanExtensions.h @@ -54,7 +54,7 @@ using InstanceExtSet = ityp::bitset(InstanceE struct InstanceExtInfo { InstanceExt index; const char* name; - // The version in which this extension was promoted as built with VK_MAKE_VERSION, + // The version in which this extension was promoted as built with VK_API_VERSION_1_x, // or NeverPromoted if it was never promoted. uint32_t versionPromoted; }; @@ -92,6 +92,7 @@ enum class DeviceExt { ShaderFloat16Int8, // Promoted to 1.3 + ShaderIntegerDotProduct, ZeroInitializeWorkgroupMemory, // External* extensions @@ -102,6 +103,7 @@ enum class DeviceExt { ExternalSemaphoreZirconHandle, // Others + DepthClipEnable, ImageDrmFormatModifier, Swapchain, SubgroupSizeControl, @@ -116,7 +118,7 @@ using DeviceExtSet = ityp::bitset(DeviceExt::En struct DeviceExtInfo { DeviceExt index; const char* name; - // The version in which this extension was promoted as built with VK_MAKE_VERSION, + // The version in which this extension was promoted as built with VK_API_VERSION_1_x, // or NeverPromoted if it was never promoted. uint32_t versionPromoted; }; diff --git a/src/dawn/native/vulkan/VulkanFunctions.cpp b/src/dawn/native/vulkan/VulkanFunctions.cpp index 630ff132b9..1bb163727b 100644 --- a/src/dawn/native/vulkan/VulkanFunctions.cpp +++ b/src/dawn/native/vulkan/VulkanFunctions.cpp @@ -15,18 +15,64 @@ #include "dawn/native/vulkan/VulkanFunctions.h" #include +#include #include "dawn/common/DynamicLib.h" #include "dawn/native/vulkan/VulkanInfo.h" namespace dawn::native::vulkan { -#define GET_GLOBAL_PROC(name) \ - do { \ - name = reinterpret_cast(GetInstanceProcAddr(nullptr, "vk" #name)); \ - if (name == nullptr) { \ - return DAWN_INTERNAL_ERROR(std::string("Couldn't get proc vk") + #name); \ - } \ +namespace { + +#if DAWN_NO_SANITIZE_VK_FN + +template +struct AsVkNoSanitizeFn; + +// SwiftShader does not export function pointer type information. +// So, when fuzzing with UBSAN, fuzzers break whenever calling +// a vk* function since it thinks the type of the function pointer +// does not match. Context: crbug.com/1296934. + +// Workaround this problem by proxying through a std::function +// in UBSAN builds. The std::function delegates to a Call method +// which does the same cast of the function pointer type, however +// the Call method is tagged with +// `__attribute__((no_sanitize("function")))` to silence the error. +template +struct AsVkNoSanitizeFn { + auto operator()(void(VKAPI_PTR* addr)()) { + return [addr](Args&&... args) -> R { return Call(addr, std::forward(args)...); }; + } + + private: + __attribute__((no_sanitize("function"))) static R Call(void(VKAPI_PTR* addr)(), + Args&&... args) { + return reinterpret_cast(addr)(std::forward(args)...); + } +}; +template +auto AsVkFn(void(VKAPI_PTR* addr)()) { + return AsVkNoSanitizeFn{}(addr); +} + +#else + +template +F AsVkFn(void(VKAPI_PTR* addr)()) { + return reinterpret_cast(addr); +} + +#endif + +} // anonymous namespace + +#define GET_GLOBAL_PROC(name) \ + do { \ + name = AsVkFn(GetInstanceProcAddr(nullptr, "vk" #name)); \ + if (name == nullptr) { \ + return DAWN_INTERNAL_ERROR(std::string("Couldn't get proc vk") + #name); \ + } \ } while (0) MaybeError VulkanFunctions::LoadGlobalProcs(const DynamicLib& vulkanLib) { @@ -39,18 +85,18 @@ MaybeError VulkanFunctions::LoadGlobalProcs(const DynamicLib& vulkanLib) { GET_GLOBAL_PROC(EnumerateInstanceLayerProperties); // Is not available in Vulkan 1.0, so allow nullptr - EnumerateInstanceVersion = reinterpret_cast( + EnumerateInstanceVersion = AsVkFn( GetInstanceProcAddr(nullptr, "vkEnumerateInstanceVersion")); return {}; } -#define GET_INSTANCE_PROC_BASE(name, procName) \ - do { \ - name = reinterpret_cast(GetInstanceProcAddr(instance, "vk" #procName)); \ - if (name == nullptr) { \ - return DAWN_INTERNAL_ERROR(std::string("Couldn't get proc vk") + #procName); \ - } \ +#define GET_INSTANCE_PROC_BASE(name, procName) \ + do { \ + name = AsVkFn(GetInstanceProcAddr(instance, "vk" #procName)); \ + if (name == nullptr) { \ + return DAWN_INTERNAL_ERROR(std::string("Couldn't get proc vk") + #procName); \ + } \ } while (0) #define GET_INSTANCE_PROC(name) GET_INSTANCE_PROC_BASE(name, name) @@ -92,19 +138,19 @@ MaybeError VulkanFunctions::LoadInstanceProcs(VkInstance instance, // Vulkan 1.1 is not required to report promoted extensions from 1.0 and is not required to // support the vendor entrypoint in GetProcAddress. - if (globalInfo.apiVersion >= VK_MAKE_VERSION(1, 1, 0)) { + if (globalInfo.apiVersion >= VK_API_VERSION_1_1) { GET_INSTANCE_PROC(GetPhysicalDeviceExternalBufferProperties); } else if (globalInfo.HasExt(InstanceExt::ExternalMemoryCapabilities)) { GET_INSTANCE_PROC_VENDOR(GetPhysicalDeviceExternalBufferProperties, KHR); } - if (globalInfo.apiVersion >= VK_MAKE_VERSION(1, 1, 0)) { + if (globalInfo.apiVersion >= VK_API_VERSION_1_1) { GET_INSTANCE_PROC(GetPhysicalDeviceExternalSemaphoreProperties); } else if (globalInfo.HasExt(InstanceExt::ExternalSemaphoreCapabilities)) { GET_INSTANCE_PROC_VENDOR(GetPhysicalDeviceExternalSemaphoreProperties, KHR); } - if (globalInfo.apiVersion >= VK_MAKE_VERSION(1, 1, 0)) { + if (globalInfo.apiVersion >= VK_API_VERSION_1_1) { GET_INSTANCE_PROC(GetPhysicalDeviceFeatures2); GET_INSTANCE_PROC(GetPhysicalDeviceProperties2); GET_INSTANCE_PROC(GetPhysicalDeviceFormatProperties2); @@ -142,18 +188,25 @@ MaybeError VulkanFunctions::LoadInstanceProcs(VkInstance instance, } #endif // defined(DAWN_ENABLE_BACKEND_METAL) -#if defined(DAWN_PLATFORM_WINDOWS) +#if defined(DAWN_USE_WAYLAND) + if (globalInfo.HasExt(InstanceExt::WaylandSurface)) { + GET_INSTANCE_PROC(CreateWaylandSurfaceKHR); + GET_INSTANCE_PROC(GetPhysicalDeviceWaylandPresentationSupportKHR); + } +#endif // defined(DAWN_USE_WAYLAND) + +#if DAWN_PLATFORM_IS(WINDOWS) if (globalInfo.HasExt(InstanceExt::Win32Surface)) { GET_INSTANCE_PROC(CreateWin32SurfaceKHR); GET_INSTANCE_PROC(GetPhysicalDeviceWin32PresentationSupportKHR); } -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) -#if defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(ANDROID) if (globalInfo.HasExt(InstanceExt::AndroidSurface)) { GET_INSTANCE_PROC(CreateAndroidSurfaceKHR); } -#endif // defined(DAWN_PLATFORM_ANDROID) +#endif // DAWN_PLATFORM_IS(ANDROID) #if defined(DAWN_USE_X11) if (globalInfo.HasExt(InstanceExt::XlibSurface)) { @@ -168,12 +221,12 @@ MaybeError VulkanFunctions::LoadInstanceProcs(VkInstance instance, return {}; } -#define GET_DEVICE_PROC(name) \ - do { \ - name = reinterpret_cast(GetDeviceProcAddr(device, "vk" #name)); \ - if (name == nullptr) { \ - return DAWN_INTERNAL_ERROR(std::string("Couldn't get proc vk") + #name); \ - } \ +#define GET_DEVICE_PROC(name) \ + do { \ + name = AsVkFn(GetDeviceProcAddr(device, "vk" #name)); \ + if (name == nullptr) { \ + return DAWN_INTERNAL_ERROR(std::string("Couldn't get proc vk") + #name); \ + } \ } while (0) MaybeError VulkanFunctions::LoadDeviceProcs(VkDevice device, const VulkanDeviceInfo& deviceInfo) { diff --git a/src/dawn/native/vulkan/VulkanFunctions.h b/src/dawn/native/vulkan/VulkanFunctions.h index ea6cd2e2d9..c4988e91ea 100644 --- a/src/dawn/native/vulkan/VulkanFunctions.h +++ b/src/dawn/native/vulkan/VulkanFunctions.h @@ -15,6 +15,7 @@ #ifndef SRC_DAWN_NATIVE_VULKAN_VULKANFUNCTIONS_H_ #define SRC_DAWN_NATIVE_VULKAN_VULKANFUNCTIONS_H_ +#include "dawn/common/Compiler.h" #include "dawn/common/vulkan_platform.h" #include "dawn/native/Error.h" @@ -26,6 +27,30 @@ namespace dawn::native::vulkan { struct VulkanGlobalInfo; struct VulkanDeviceInfo; +#if defined(UNDEFINED_SANITIZER) && DAWN_COMPILER_IS(CLANG) +#define DAWN_NO_SANITIZE_VK_FN 1 +#else +#define DAWN_NO_SANITIZE_VK_FN 0 +#endif + +template +struct VkFnImpl; + +// Override the type of Vulkan functions to be a bound std::function if +// DAWN_NO_SANITIZE_VK_FN is set. See comment at AsVkNoSanitizeFn in VulkanFunctions.cpp +// for more information. +template +struct VkFnImpl { +#if DAWN_NO_SANITIZE_VK_FN + using type = std::function; +#else + using type = R(VKAPI_PTR*)(Args...); +#endif +}; + +template +using VkFn = typename VkFnImpl::type; + // Stores the Vulkan entry points. Also loads them from the dynamic library // and the vkGet*ProcAddress entry points. struct VulkanFunctions { @@ -38,261 +63,275 @@ struct VulkanFunctions { // Initial proc from which we can get all the others PFN_vkGetInstanceProcAddr GetInstanceProcAddr = nullptr; - PFN_vkCreateInstance CreateInstance = nullptr; - PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties = nullptr; - PFN_vkEnumerateInstanceLayerProperties EnumerateInstanceLayerProperties = nullptr; + VkFn CreateInstance = nullptr; + VkFn EnumerateInstanceExtensionProperties = nullptr; + VkFn EnumerateInstanceLayerProperties = nullptr; // DestroyInstance isn't technically a global proc but we want to be able to use it // before querying the instance procs in case we need to error out during initialization. - PFN_vkDestroyInstance DestroyInstance = nullptr; + VkFn DestroyInstance = nullptr; // Core Vulkan 1.1 - PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion = nullptr; + VkFn EnumerateInstanceVersion = nullptr; // ---------- Instance procs // Core Vulkan 1.0 - PFN_vkCreateDevice CreateDevice = nullptr; - PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties = nullptr; - PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties = nullptr; - PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices = nullptr; - PFN_vkGetDeviceProcAddr GetDeviceProcAddr = nullptr; - PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures = nullptr; - PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties = nullptr; - PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties = nullptr; - PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties = nullptr; - PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties = nullptr; - PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties = nullptr; - PFN_vkGetPhysicalDeviceSparseImageFormatProperties + VkFn CreateDevice = nullptr; + VkFn EnumerateDeviceExtensionProperties = nullptr; + VkFn EnumerateDeviceLayerProperties = nullptr; + VkFn EnumeratePhysicalDevices = nullptr; + VkFn GetDeviceProcAddr = nullptr; + VkFn GetPhysicalDeviceFeatures = nullptr; + VkFn GetPhysicalDeviceFormatProperties = nullptr; + VkFn GetPhysicalDeviceImageFormatProperties = + nullptr; + VkFn GetPhysicalDeviceMemoryProperties = nullptr; + VkFn GetPhysicalDeviceProperties = nullptr; + VkFn GetPhysicalDeviceQueueFamilyProperties = + nullptr; + VkFn GetPhysicalDeviceSparseImageFormatProperties = nullptr; // Not technically an instance proc but we want to be able to use it as soon as the // device is created. - PFN_vkDestroyDevice DestroyDevice = nullptr; + VkFn DestroyDevice = nullptr; // VK_EXT_debug_utils - PFN_vkCmdBeginDebugUtilsLabelEXT CmdBeginDebugUtilsLabelEXT = nullptr; - PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT = nullptr; - PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT = nullptr; - PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT = nullptr; - PFN_vkDestroyDebugUtilsMessengerEXT DestroyDebugUtilsMessengerEXT = nullptr; - PFN_vkQueueBeginDebugUtilsLabelEXT QueueBeginDebugUtilsLabelEXT = nullptr; - PFN_vkQueueEndDebugUtilsLabelEXT QueueEndDebugUtilsLabelEXT = nullptr; - PFN_vkQueueInsertDebugUtilsLabelEXT QueueInsertDebugUtilsLabelEXT = nullptr; - PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT = nullptr; - PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT = nullptr; - PFN_vkSubmitDebugUtilsMessageEXT SubmitDebugUtilsMessageEXT = nullptr; + VkFn CmdBeginDebugUtilsLabelEXT = nullptr; + VkFn CmdEndDebugUtilsLabelEXT = nullptr; + VkFn CmdInsertDebugUtilsLabelEXT = nullptr; + VkFn CreateDebugUtilsMessengerEXT = nullptr; + VkFn DestroyDebugUtilsMessengerEXT = nullptr; + VkFn QueueBeginDebugUtilsLabelEXT = nullptr; + VkFn QueueEndDebugUtilsLabelEXT = nullptr; + VkFn QueueInsertDebugUtilsLabelEXT = nullptr; + VkFn SetDebugUtilsObjectNameEXT = nullptr; + VkFn SetDebugUtilsObjectTagEXT = nullptr; + VkFn SubmitDebugUtilsMessageEXT = nullptr; // VK_KHR_surface - PFN_vkDestroySurfaceKHR DestroySurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR = nullptr; - PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR = nullptr; - PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR = nullptr; - PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR = nullptr; + VkFn DestroySurfaceKHR = nullptr; + VkFn GetPhysicalDeviceSurfaceSupportKHR = nullptr; + VkFn GetPhysicalDeviceSurfaceCapabilitiesKHR = + nullptr; + VkFn GetPhysicalDeviceSurfaceFormatsKHR = nullptr; + VkFn GetPhysicalDeviceSurfacePresentModesKHR = + nullptr; // Core Vulkan 1.1 promoted extensions, set if either the core version or the extension is // present. // VK_KHR_external_memory_capabilities - PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties = - nullptr; + VkFn + GetPhysicalDeviceExternalBufferProperties = nullptr; // VK_KHR_external_semaphore_capabilities - PFN_vkGetPhysicalDeviceExternalSemaphoreProperties + VkFn GetPhysicalDeviceExternalSemaphoreProperties = nullptr; // VK_KHR_get_physical_device_properties2 - PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2 = nullptr; - PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2 = nullptr; - PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2 = nullptr; - PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysicalDeviceImageFormatProperties2 = nullptr; - PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2 = nullptr; - PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysicalDeviceMemoryProperties2 = nullptr; - PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 + VkFn GetPhysicalDeviceFeatures2 = nullptr; + VkFn GetPhysicalDeviceProperties2 = nullptr; + VkFn GetPhysicalDeviceFormatProperties2 = nullptr; + VkFn GetPhysicalDeviceImageFormatProperties2 = + nullptr; + VkFn GetPhysicalDeviceQueueFamilyProperties2 = + nullptr; + VkFn GetPhysicalDeviceMemoryProperties2 = nullptr; + VkFn GetPhysicalDeviceSparseImageFormatProperties2 = nullptr; #if defined(VK_USE_PLATFORM_FUCHSIA) // FUCHSIA_image_pipe_surface - PFN_vkCreateImagePipeSurfaceFUCHSIA CreateImagePipeSurfaceFUCHSIA = nullptr; + VkFn CreateImagePipeSurfaceFUCHSIA = nullptr; #endif // defined(VK_USE_PLATFORM_FUCHSIA) #if defined(DAWN_ENABLE_BACKEND_METAL) // EXT_metal_surface - PFN_vkCreateMetalSurfaceEXT CreateMetalSurfaceEXT = nullptr; + VkFn CreateMetalSurfaceEXT = nullptr; #endif // defined(DAWN_ENABLE_BACKEND_METAL) -#if defined(DAWN_PLATFORM_WINDOWS) - // KHR_win32_surface - PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR - GetPhysicalDeviceWin32PresentationSupportKHR = nullptr; -#endif // defined(DAWN_PLATFORM_WINDOWS) +#if defined(DAWN_USE_WAYLAND) + // KHR_wayland_surface + PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR = nullptr; + PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR + GetPhysicalDeviceWaylandPresentationSupportKHR = nullptr; +#endif // defined(DAWN_USE_WAYLAND) -#if defined(DAWN_PLATFORM_ANDROID) - PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR = nullptr; -#endif // defined(DAWN_PLATFORM_ANDROID) +#if DAWN_PLATFORM_IS(WINDOWS) + // KHR_win32_surface + VkFn CreateWin32SurfaceKHR = nullptr; + VkFn + GetPhysicalDeviceWin32PresentationSupportKHR = nullptr; +#endif // DAWN_PLATFORM_IS(WINDOWS) + +#if DAWN_PLATFORM_IS(ANDROID) + VkFn CreateAndroidSurfaceKHR = nullptr; +#endif // DAWN_PLATFORM_IS(ANDROID) #if defined(DAWN_USE_X11) // KHR_xlib_surface - PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR = - nullptr; + VkFn CreateXlibSurfaceKHR = nullptr; + VkFn + GetPhysicalDeviceXlibPresentationSupportKHR = nullptr; // KHR_xcb_surface - PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR = nullptr; - PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupportKHR = - nullptr; + VkFn CreateXcbSurfaceKHR = nullptr; + VkFn + GetPhysicalDeviceXcbPresentationSupportKHR = nullptr; #endif // defined(DAWN_USE_X11) // ---------- Device procs // Core Vulkan 1.0 - PFN_vkAllocateCommandBuffers AllocateCommandBuffers = nullptr; - PFN_vkAllocateDescriptorSets AllocateDescriptorSets = nullptr; - PFN_vkAllocateMemory AllocateMemory = nullptr; - PFN_vkBeginCommandBuffer BeginCommandBuffer = nullptr; - PFN_vkBindBufferMemory BindBufferMemory = nullptr; - PFN_vkBindImageMemory BindImageMemory = nullptr; - PFN_vkCmdBeginQuery CmdBeginQuery = nullptr; - PFN_vkCmdBeginRenderPass CmdBeginRenderPass = nullptr; - PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets = nullptr; - PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer = nullptr; - PFN_vkCmdBindPipeline CmdBindPipeline = nullptr; - PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers = nullptr; - PFN_vkCmdBlitImage CmdBlitImage = nullptr; - PFN_vkCmdClearAttachments CmdClearAttachments = nullptr; - PFN_vkCmdClearColorImage CmdClearColorImage = nullptr; - PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage = nullptr; - PFN_vkCmdCopyBuffer CmdCopyBuffer = nullptr; - PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage = nullptr; - PFN_vkCmdCopyImage CmdCopyImage = nullptr; - PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer = nullptr; - PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults = nullptr; - PFN_vkCmdDispatch CmdDispatch = nullptr; - PFN_vkCmdDispatchIndirect CmdDispatchIndirect = nullptr; - PFN_vkCmdDraw CmdDraw = nullptr; - PFN_vkCmdDrawIndexed CmdDrawIndexed = nullptr; - PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect = nullptr; - PFN_vkCmdDrawIndirect CmdDrawIndirect = nullptr; - PFN_vkCmdEndQuery CmdEndQuery = nullptr; - PFN_vkCmdEndRenderPass CmdEndRenderPass = nullptr; - PFN_vkCmdExecuteCommands CmdExecuteCommands = nullptr; - PFN_vkCmdFillBuffer CmdFillBuffer = nullptr; - PFN_vkCmdNextSubpass CmdNextSubpass = nullptr; - PFN_vkCmdPipelineBarrier CmdPipelineBarrier = nullptr; - PFN_vkCmdPushConstants CmdPushConstants = nullptr; - PFN_vkCmdResetEvent CmdResetEvent = nullptr; - PFN_vkCmdResetQueryPool CmdResetQueryPool = nullptr; - PFN_vkCmdResolveImage CmdResolveImage = nullptr; - PFN_vkCmdSetBlendConstants CmdSetBlendConstants = nullptr; - PFN_vkCmdSetDepthBias CmdSetDepthBias = nullptr; - PFN_vkCmdSetDepthBounds CmdSetDepthBounds = nullptr; - PFN_vkCmdSetEvent CmdSetEvent = nullptr; - PFN_vkCmdSetLineWidth CmdSetLineWidth = nullptr; - PFN_vkCmdSetScissor CmdSetScissor = nullptr; - PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask = nullptr; - PFN_vkCmdSetStencilReference CmdSetStencilReference = nullptr; - PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask = nullptr; - PFN_vkCmdSetViewport CmdSetViewport = nullptr; - PFN_vkCmdUpdateBuffer CmdUpdateBuffer = nullptr; - PFN_vkCmdWaitEvents CmdWaitEvents = nullptr; - PFN_vkCmdWriteTimestamp CmdWriteTimestamp = nullptr; - PFN_vkCreateBuffer CreateBuffer = nullptr; - PFN_vkCreateBufferView CreateBufferView = nullptr; - PFN_vkCreateCommandPool CreateCommandPool = nullptr; - PFN_vkCreateComputePipelines CreateComputePipelines = nullptr; - PFN_vkCreateDescriptorPool CreateDescriptorPool = nullptr; - PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout = nullptr; - PFN_vkCreateEvent CreateEvent = nullptr; - PFN_vkCreateFence CreateFence = nullptr; - PFN_vkCreateFramebuffer CreateFramebuffer = nullptr; - PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines = nullptr; - PFN_vkCreateImage CreateImage = nullptr; - PFN_vkCreateImageView CreateImageView = nullptr; - PFN_vkCreatePipelineCache CreatePipelineCache = nullptr; - PFN_vkCreatePipelineLayout CreatePipelineLayout = nullptr; - PFN_vkCreateQueryPool CreateQueryPool = nullptr; - PFN_vkCreateRenderPass CreateRenderPass = nullptr; - PFN_vkCreateSampler CreateSampler = nullptr; - PFN_vkCreateSemaphore CreateSemaphore = nullptr; - PFN_vkCreateShaderModule CreateShaderModule = nullptr; - PFN_vkDestroyBuffer DestroyBuffer = nullptr; - PFN_vkDestroyBufferView DestroyBufferView = nullptr; - PFN_vkDestroyCommandPool DestroyCommandPool = nullptr; - PFN_vkDestroyDescriptorPool DestroyDescriptorPool = nullptr; - PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout = nullptr; - PFN_vkDestroyEvent DestroyEvent = nullptr; - PFN_vkDestroyFence DestroyFence = nullptr; - PFN_vkDestroyFramebuffer DestroyFramebuffer = nullptr; - PFN_vkDestroyImage DestroyImage = nullptr; - PFN_vkDestroyImageView DestroyImageView = nullptr; - PFN_vkDestroyPipeline DestroyPipeline = nullptr; - PFN_vkDestroyPipelineCache DestroyPipelineCache = nullptr; - PFN_vkDestroyPipelineLayout DestroyPipelineLayout = nullptr; - PFN_vkDestroyQueryPool DestroyQueryPool = nullptr; - PFN_vkDestroyRenderPass DestroyRenderPass = nullptr; - PFN_vkDestroySampler DestroySampler = nullptr; - PFN_vkDestroySemaphore DestroySemaphore = nullptr; - PFN_vkDestroyShaderModule DestroyShaderModule = nullptr; - PFN_vkDeviceWaitIdle DeviceWaitIdle = nullptr; - PFN_vkEndCommandBuffer EndCommandBuffer = nullptr; - PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges = nullptr; - PFN_vkFreeCommandBuffers FreeCommandBuffers = nullptr; - PFN_vkFreeDescriptorSets FreeDescriptorSets = nullptr; - PFN_vkFreeMemory FreeMemory = nullptr; - PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements = nullptr; - PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment = nullptr; - PFN_vkGetDeviceQueue GetDeviceQueue = nullptr; - PFN_vkGetEventStatus GetEventStatus = nullptr; - PFN_vkGetFenceStatus GetFenceStatus = nullptr; - PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements = nullptr; - PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements = nullptr; - PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout = nullptr; - PFN_vkGetPipelineCacheData GetPipelineCacheData = nullptr; - PFN_vkGetQueryPoolResults GetQueryPoolResults = nullptr; - PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity = nullptr; - PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges = nullptr; - PFN_vkMapMemory MapMemory = nullptr; - PFN_vkMergePipelineCaches MergePipelineCaches = nullptr; - PFN_vkQueueBindSparse QueueBindSparse = nullptr; - PFN_vkQueueSubmit QueueSubmit = nullptr; - PFN_vkQueueWaitIdle QueueWaitIdle = nullptr; - PFN_vkResetCommandBuffer ResetCommandBuffer = nullptr; - PFN_vkResetCommandPool ResetCommandPool = nullptr; - PFN_vkResetDescriptorPool ResetDescriptorPool = nullptr; - PFN_vkResetEvent ResetEvent = nullptr; - PFN_vkResetFences ResetFences = nullptr; - PFN_vkSetEvent SetEvent = nullptr; - PFN_vkUnmapMemory UnmapMemory = nullptr; - PFN_vkUpdateDescriptorSets UpdateDescriptorSets = nullptr; - PFN_vkWaitForFences WaitForFences = nullptr; + VkFn AllocateCommandBuffers = nullptr; + VkFn AllocateDescriptorSets = nullptr; + VkFn AllocateMemory = nullptr; + VkFn BeginCommandBuffer = nullptr; + VkFn BindBufferMemory = nullptr; + VkFn BindImageMemory = nullptr; + VkFn CmdBeginQuery = nullptr; + VkFn CmdBeginRenderPass = nullptr; + VkFn CmdBindDescriptorSets = nullptr; + VkFn CmdBindIndexBuffer = nullptr; + VkFn CmdBindPipeline = nullptr; + VkFn CmdBindVertexBuffers = nullptr; + VkFn CmdBlitImage = nullptr; + VkFn CmdClearAttachments = nullptr; + VkFn CmdClearColorImage = nullptr; + VkFn CmdClearDepthStencilImage = nullptr; + VkFn CmdCopyBuffer = nullptr; + VkFn CmdCopyBufferToImage = nullptr; + VkFn CmdCopyImage = nullptr; + VkFn CmdCopyImageToBuffer = nullptr; + VkFn CmdCopyQueryPoolResults = nullptr; + VkFn CmdDispatch = nullptr; + VkFn CmdDispatchIndirect = nullptr; + VkFn CmdDraw = nullptr; + VkFn CmdDrawIndexed = nullptr; + VkFn CmdDrawIndexedIndirect = nullptr; + VkFn CmdDrawIndirect = nullptr; + VkFn CmdEndQuery = nullptr; + VkFn CmdEndRenderPass = nullptr; + VkFn CmdExecuteCommands = nullptr; + VkFn CmdFillBuffer = nullptr; + VkFn CmdNextSubpass = nullptr; + VkFn CmdPipelineBarrier = nullptr; + VkFn CmdPushConstants = nullptr; + VkFn CmdResetEvent = nullptr; + VkFn CmdResetQueryPool = nullptr; + VkFn CmdResolveImage = nullptr; + VkFn CmdSetBlendConstants = nullptr; + VkFn CmdSetDepthBias = nullptr; + VkFn CmdSetDepthBounds = nullptr; + VkFn CmdSetEvent = nullptr; + VkFn CmdSetLineWidth = nullptr; + VkFn CmdSetScissor = nullptr; + VkFn CmdSetStencilCompareMask = nullptr; + VkFn CmdSetStencilReference = nullptr; + VkFn CmdSetStencilWriteMask = nullptr; + VkFn CmdSetViewport = nullptr; + VkFn CmdUpdateBuffer = nullptr; + VkFn CmdWaitEvents = nullptr; + VkFn CmdWriteTimestamp = nullptr; + VkFn CreateBuffer = nullptr; + VkFn CreateBufferView = nullptr; + VkFn CreateCommandPool = nullptr; + VkFn CreateComputePipelines = nullptr; + VkFn CreateDescriptorPool = nullptr; + VkFn CreateDescriptorSetLayout = nullptr; + VkFn CreateEvent = nullptr; + VkFn CreateFence = nullptr; + VkFn CreateFramebuffer = nullptr; + VkFn CreateGraphicsPipelines = nullptr; + VkFn CreateImage = nullptr; + VkFn CreateImageView = nullptr; + VkFn CreatePipelineCache = nullptr; + VkFn CreatePipelineLayout = nullptr; + VkFn CreateQueryPool = nullptr; + VkFn CreateRenderPass = nullptr; + VkFn CreateSampler = nullptr; + VkFn CreateSemaphore = nullptr; + VkFn CreateShaderModule = nullptr; + VkFn DestroyBuffer = nullptr; + VkFn DestroyBufferView = nullptr; + VkFn DestroyCommandPool = nullptr; + VkFn DestroyDescriptorPool = nullptr; + VkFn DestroyDescriptorSetLayout = nullptr; + VkFn DestroyEvent = nullptr; + VkFn DestroyFence = nullptr; + VkFn DestroyFramebuffer = nullptr; + VkFn DestroyImage = nullptr; + VkFn DestroyImageView = nullptr; + VkFn DestroyPipeline = nullptr; + VkFn DestroyPipelineCache = nullptr; + VkFn DestroyPipelineLayout = nullptr; + VkFn DestroyQueryPool = nullptr; + VkFn DestroyRenderPass = nullptr; + VkFn DestroySampler = nullptr; + VkFn DestroySemaphore = nullptr; + VkFn DestroyShaderModule = nullptr; + VkFn DeviceWaitIdle = nullptr; + VkFn EndCommandBuffer = nullptr; + VkFn FlushMappedMemoryRanges = nullptr; + VkFn FreeCommandBuffers = nullptr; + VkFn FreeDescriptorSets = nullptr; + VkFn FreeMemory = nullptr; + VkFn GetBufferMemoryRequirements = nullptr; + VkFn GetDeviceMemoryCommitment = nullptr; + VkFn GetDeviceQueue = nullptr; + VkFn GetEventStatus = nullptr; + VkFn GetFenceStatus = nullptr; + VkFn GetImageMemoryRequirements = nullptr; + VkFn GetImageSparseMemoryRequirements = nullptr; + VkFn GetImageSubresourceLayout = nullptr; + VkFn GetPipelineCacheData = nullptr; + VkFn GetQueryPoolResults = nullptr; + VkFn GetRenderAreaGranularity = nullptr; + VkFn InvalidateMappedMemoryRanges = nullptr; + VkFn MapMemory = nullptr; + VkFn MergePipelineCaches = nullptr; + VkFn QueueBindSparse = nullptr; + VkFn QueueSubmit = nullptr; + VkFn QueueWaitIdle = nullptr; + VkFn ResetCommandBuffer = nullptr; + VkFn ResetCommandPool = nullptr; + VkFn ResetDescriptorPool = nullptr; + VkFn ResetEvent = nullptr; + VkFn ResetFences = nullptr; + VkFn SetEvent = nullptr; + VkFn UnmapMemory = nullptr; + VkFn UpdateDescriptorSets = nullptr; + VkFn WaitForFences = nullptr; // VK_KHR_external_memory_fd - PFN_vkGetMemoryFdKHR GetMemoryFdKHR = nullptr; - PFN_vkGetMemoryFdPropertiesKHR GetMemoryFdPropertiesKHR = nullptr; + VkFn GetMemoryFdKHR = nullptr; + VkFn GetMemoryFdPropertiesKHR = nullptr; // VK_KHR_external_semaphore_fd - PFN_vkImportSemaphoreFdKHR ImportSemaphoreFdKHR = nullptr; - PFN_vkGetSemaphoreFdKHR GetSemaphoreFdKHR = nullptr; + VkFn ImportSemaphoreFdKHR = nullptr; + VkFn GetSemaphoreFdKHR = nullptr; // VK_KHR_get_memory_requirements2 - PFN_vkGetBufferMemoryRequirements2KHR GetBufferMemoryRequirements2 = nullptr; - PFN_vkGetImageMemoryRequirements2KHR GetImageMemoryRequirements2 = nullptr; - PFN_vkGetImageSparseMemoryRequirements2KHR GetImageSparseMemoryRequirements2 = nullptr; + VkFn GetBufferMemoryRequirements2 = nullptr; + VkFn GetImageMemoryRequirements2 = nullptr; + VkFn GetImageSparseMemoryRequirements2 = nullptr; // VK_KHR_swapchain - PFN_vkCreateSwapchainKHR CreateSwapchainKHR = nullptr; - PFN_vkDestroySwapchainKHR DestroySwapchainKHR = nullptr; - PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR = nullptr; - PFN_vkAcquireNextImageKHR AcquireNextImageKHR = nullptr; - PFN_vkQueuePresentKHR QueuePresentKHR = nullptr; + VkFn CreateSwapchainKHR = nullptr; + VkFn DestroySwapchainKHR = nullptr; + VkFn GetSwapchainImagesKHR = nullptr; + VkFn AcquireNextImageKHR = nullptr; + VkFn QueuePresentKHR = nullptr; #if VK_USE_PLATFORM_FUCHSIA // VK_FUCHSIA_external_memory - PFN_vkGetMemoryZirconHandleFUCHSIA GetMemoryZirconHandleFUCHSIA = nullptr; - PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA GetMemoryZirconHandlePropertiesFUCHSIA = nullptr; + VkFn GetMemoryZirconHandleFUCHSIA = nullptr; + VkFn GetMemoryZirconHandlePropertiesFUCHSIA = + nullptr; // VK_FUCHSIA_external_semaphore - PFN_vkImportSemaphoreZirconHandleFUCHSIA ImportSemaphoreZirconHandleFUCHSIA = nullptr; - PFN_vkGetSemaphoreZirconHandleFUCHSIA GetSemaphoreZirconHandleFUCHSIA = nullptr; + VkFn ImportSemaphoreZirconHandleFUCHSIA = nullptr; + VkFn GetSemaphoreZirconHandleFUCHSIA = nullptr; #endif }; diff --git a/src/dawn/native/vulkan/VulkanInfo.cpp b/src/dawn/native/vulkan/VulkanInfo.cpp index ebcf3ea125..d033e291ca 100644 --- a/src/dawn/native/vulkan/VulkanInfo.cpp +++ b/src/dawn/native/vulkan/VulkanInfo.cpp @@ -68,7 +68,7 @@ ResultOrError GatherGlobalInfo(const VulkanFunctions& vkFuncti VulkanGlobalInfo info = {}; // Gather info on available API version { - info.apiVersion = VK_MAKE_VERSION(1, 0, 0); + info.apiVersion = VK_API_VERSION_1_0; if (vkFunctions.EnumerateInstanceVersion != nullptr) { DAWN_TRY(CheckVkSuccess(vkFunctions.EnumerateInstanceVersion(&info.apiVersion), "vkEnumerateInstanceVersion")); @@ -248,6 +248,17 @@ ResultOrError GatherDeviceInfo(const Adapter& adapter) { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES); } + if (info.extensions[DeviceExt::ShaderIntegerDotProduct]) { + propertiesChain.Add( + &info.shaderIntegerDotProductProperties, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES_KHR); + } + + if (info.extensions[DeviceExt::DepthClipEnable]) { + featuresChain.Add(&info.depthClipEnableFeatures, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT); + } + // If we have DeviceExt::GetPhysicalDeviceProperties2, use features2 and properties2 so // that features no covered by VkPhysicalDevice{Features,Properties} can be queried. // diff --git a/src/dawn/native/vulkan/VulkanInfo.h b/src/dawn/native/vulkan/VulkanInfo.h index 961a2adb33..5bb925736c 100644 --- a/src/dawn/native/vulkan/VulkanInfo.h +++ b/src/dawn/native/vulkan/VulkanInfo.h @@ -52,6 +52,8 @@ struct VulkanDeviceKnobs { VkPhysicalDevice16BitStorageFeaturesKHR _16BitStorageFeatures; VkPhysicalDeviceSubgroupSizeControlFeaturesEXT subgroupSizeControlFeatures; VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR zeroInitializeWorkgroupMemoryFeatures; + VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR shaderIntegerDotProductFeatures; + VkPhysicalDeviceDepthClipEnableFeaturesEXT depthClipEnableFeatures; bool HasExt(DeviceExt ext) const; DeviceExtSet extensions; @@ -61,6 +63,7 @@ struct VulkanDeviceInfo : VulkanDeviceKnobs { VkPhysicalDeviceProperties properties; VkPhysicalDeviceDriverProperties driverProperties; VkPhysicalDeviceSubgroupSizeControlPropertiesEXT subgroupSizeControlProperties; + VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR shaderIntegerDotProductProperties; std::vector queueFamilies; diff --git a/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp b/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp index bbbd2cace2..0729d4713c 100644 --- a/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp +++ b/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp @@ -311,37 +311,27 @@ ResultOrError Service::CreateImage(const ExternalImageDescriptor* descr createInfoChain.Add(&externalMemoryImageCreateInfo, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO); - // For single plane formats. - VkSubresourceLayout planeLayout = {}; - planeLayout.offset = 0; - planeLayout.size = 0; // VK_EXT_image_drm_format_modifier mandates size = 0. - planeLayout.rowPitch = dmaBufDescriptor->stride; - planeLayout.arrayPitch = 0; // Not an array texture - planeLayout.depthPitch = 0; // Not a depth texture + VkSubresourceLayout planeLayouts[ExternalImageDescriptorDmaBuf::kMaxPlanes]; + for (uint32_t plane = 0u; plane < planeCount; ++plane) { + planeLayouts[plane].offset = dmaBufDescriptor->planeLayouts[plane].offset; + planeLayouts[plane].size = 0; // VK_EXT_image_drm_format_modifier mandates size = 0. + planeLayouts[plane].rowPitch = dmaBufDescriptor->planeLayouts[plane].stride; + planeLayouts[plane].arrayPitch = 0; // Not an array texture + planeLayouts[plane].depthPitch = 0; // Not a depth texture + } VkImageDrmFormatModifierExplicitCreateInfoEXT explicitCreateInfo = {}; explicitCreateInfo.drmFormatModifier = dmaBufDescriptor->drmModifier; - explicitCreateInfo.drmFormatModifierPlaneCount = 1; - explicitCreateInfo.pPlaneLayouts = &planeLayout; - - // For multi-planar formats, we can't explicitly specify VkSubresourceLayout for each plane - // due to the lack of knowledge about the required 'offset'. Alternatively - // VkImageDrmFormatModifierListCreateInfoEXT can be used to create image with the DRM format - // modifier. - VkImageDrmFormatModifierListCreateInfoEXT listCreateInfo = {}; - listCreateInfo.drmFormatModifierCount = 1; - listCreateInfo.pDrmFormatModifiers = &dmaBufDescriptor->drmModifier; + explicitCreateInfo.drmFormatModifierPlaneCount = planeCount; + explicitCreateInfo.pPlaneLayouts = &planeLayouts[0]; if (planeCount > 1) { // For multi-planar formats, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT specifies that a // VkImageView can be plane's format which might differ from the image's format. createInfo.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; - createInfoChain.Add(&listCreateInfo, - VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT); - } else { - createInfoChain.Add(&explicitCreateInfo, - VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT); } + createInfoChain.Add(&explicitCreateInfo, + VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT); // Create a new VkImage with tiling equal to the DRM format modifier. VkImage image; diff --git a/src/dawn/native/vulkan/external_semaphore/SemaphoreService.h b/src/dawn/native/vulkan/external_semaphore/SemaphoreService.h index e27689fbf4..18043e405d 100644 --- a/src/dawn/native/vulkan/external_semaphore/SemaphoreService.h +++ b/src/dawn/native/vulkan/external_semaphore/SemaphoreService.h @@ -48,6 +48,12 @@ class Service { // Export a VkSemaphore into an external handle ResultOrError ExportSemaphore(VkSemaphore semaphore); + // Duplicate a new external handle from the given one. + ExternalSemaphoreHandle DuplicateHandle(ExternalSemaphoreHandle handle); + + // Close an external handle. + void CloseHandle(ExternalSemaphoreHandle handle); + private: Device* mDevice = nullptr; diff --git a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp index 9c1d923dae..d424e62537 100644 --- a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp +++ b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include "dawn/native/vulkan/AdapterVk.h" @@ -135,4 +136,15 @@ ResultOrError Service::ExportSemaphore(VkSemaphore sema return fd; } +ExternalSemaphoreHandle Service::DuplicateHandle(ExternalSemaphoreHandle handle) { + int fd = dup(handle); + ASSERT(fd >= 0); + return fd; +} + +void Service::CloseHandle(ExternalSemaphoreHandle handle) { + int ret = close(handle); + ASSERT(ret == 0); +} + } // namespace dawn::native::vulkan::external_semaphore diff --git a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp index 1963524c82..370db872af 100644 --- a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp +++ b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp @@ -47,4 +47,10 @@ ResultOrError Service::ExportSemaphore(VkSemaphore sema return DAWN_UNIMPLEMENTED_ERROR("Using null semaphore service to interop inside Vulkan"); } +ExternalSemaphoreHandle Service::DuplicateHandle(ExternalSemaphoreHandle handle) { + return kNullExternalSemaphoreHandle; +} + +void Service::CloseHandle(ExternalSemaphoreHandle handle) {} + } // namespace dawn::native::vulkan::external_semaphore diff --git a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp index af1f3f3e77..12d776e311 100644 --- a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp +++ b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include "dawn/native/vulkan/AdapterVk.h" @@ -129,4 +130,16 @@ ResultOrError Service::ExportSemaphore(VkSemaphore sema return handle; } +ExternalSemaphoreHandle Service::DuplicateHandle(ExternalSemaphoreHandle handle) { + zx_handle_t out_handle = ZX_HANDLE_INVALID; + zx_status_t status = zx_handle_duplicate(handle, ZX_RIGHT_SAME_RIGHTS, &out_handle); + ASSERT(status == ZX_OK); + return out_handle; +} + +void Service::CloseHandle(ExternalSemaphoreHandle handle) { + zx_status_t status = zx_handle_close(handle); + ASSERT(status == ZX_OK); +} + } // namespace dawn::native::vulkan::external_semaphore diff --git a/src/dawn/native/webgpu_absl_format.cpp b/src/dawn/native/webgpu_absl_format.cpp index 2550f4b1f5..8eddf467bb 100644 --- a/src/dawn/native/webgpu_absl_format.cpp +++ b/src/dawn/native/webgpu_absl_format.cpp @@ -181,16 +181,16 @@ absl::FormatConvertResult AbslFormatConv bool needsComma = false; for (ColorAttachmentIndex i : IterateBitSet(value->GetColorAttachmentsMask())) { + if (needsComma) { + s->Append(", "); + } + while (nextColorIndex < i) { s->Append(absl::StrFormat("%s, ", wgpu::TextureFormat::Undefined)); nextColorIndex++; needsComma = false; } - if (needsComma) { - s->Append(", "); - } - s->Append(absl::StrFormat("%s", value->GetColorAttachmentFormat(i))); nextColorIndex++; diff --git a/src/dawn/node/README.md b/src/dawn/node/README.md index 03c93512a7..623d35bf38 100644 --- a/src/dawn/node/README.md +++ b/src/dawn/node/README.md @@ -17,7 +17,7 @@ Dawn uses the Chromium build system and dependency management so you need to [in ### Fetch dependencies -First, the steps are similar to [`doc/building.md`](../../docs/dawn/building.md), but instead of the `Get the code` step, run: +First, the steps are similar to [`docs/building.md`](../../../docs/building.md), but instead of the `Get the code` step, run: ```sh # Clone the repo as "dawn" @@ -77,7 +77,7 @@ The `--flag` parameter must be passed in multiple times, once for each flag begi For example, on Windows, to use the d3dcompiler_47.dll from a Chromium checkout, and to dump shader output, we could run the following using Git Bash: ```sh -./src/dawn/node/tools/run-cts --verbose --dawn-node=/c/src/dawn/build/Debug/dawn.node --cts=/c/src/gpuweb-cts --flag=dlldir="C:\src\chromium\src\out\Release" --flag=enable-dawn-features=dump_shaders 'webgpu:shader,execution,builtin,abs:integer_builtin_functions,abs_unsigned:storageClass="storage";storageMode="read_write";containerType="vector";isAtomic=false;baseType="u32";type="vec2%3Cu32%3E"' +./src/dawn/node/tools/run-cts --verbose --dawn-node=/c/src/dawn/build/Debug/dawn.node --cts=/c/src/webgpu-cts --flag=dlldir="C:\src\chromium\src\out\Release" --flag=enable-dawn-features=dump_shaders 'webgpu:shader,execution,builtin,abs:integer_builtin_functions,abs_unsigned:storageClass="storage";storageMode="read_write";containerType="vector";isAtomic=false;baseType="u32";type="vec2%3Cu32%3E"' ``` Note that we pass `--verbose` above so that all test output, including the dumped shader, is written to stdout. diff --git a/src/dawn/node/binding/Converter.cpp b/src/dawn/node/binding/Converter.cpp index 65c59a5bde..f06a6af70c 100644 --- a/src/dawn/node/binding/Converter.cpp +++ b/src/dawn/node/binding/Converter.cpp @@ -295,9 +295,6 @@ bool Converter::Convert(wgpu::TextureFormat& out, const interop::GPUTextureForma case interop::GPUTextureFormat::kDepth32Float: out = wgpu::TextureFormat::Depth32Float; return true; - case interop::GPUTextureFormat::kDepth24UnormStencil8: - out = wgpu::TextureFormat::Depth24UnormStencil8; - return true; case interop::GPUTextureFormat::kDepth32FloatStencil8: out = wgpu::TextureFormat::Depth32FloatStencil8; return true; @@ -462,11 +459,309 @@ bool Converter::Convert(wgpu::TextureFormat& out, const interop::GPUTextureForma return false; } +bool Converter::Convert(interop::GPUTextureFormat& out, wgpu::TextureFormat in) { + switch (in) { + case wgpu::TextureFormat::R8Unorm: + out = interop::GPUTextureFormat::kR8Unorm; + return true; + case wgpu::TextureFormat::R8Snorm: + out = interop::GPUTextureFormat::kR8Snorm; + return true; + case wgpu::TextureFormat::R8Uint: + out = interop::GPUTextureFormat::kR8Uint; + return true; + case wgpu::TextureFormat::R8Sint: + out = interop::GPUTextureFormat::kR8Sint; + return true; + case wgpu::TextureFormat::R16Uint: + out = interop::GPUTextureFormat::kR16Uint; + return true; + case wgpu::TextureFormat::R16Sint: + out = interop::GPUTextureFormat::kR16Sint; + return true; + case wgpu::TextureFormat::R16Float: + out = interop::GPUTextureFormat::kR16Float; + return true; + case wgpu::TextureFormat::RG8Unorm: + out = interop::GPUTextureFormat::kRg8Unorm; + return true; + case wgpu::TextureFormat::RG8Snorm: + out = interop::GPUTextureFormat::kRg8Snorm; + return true; + case wgpu::TextureFormat::RG8Uint: + out = interop::GPUTextureFormat::kRg8Uint; + return true; + case wgpu::TextureFormat::RG8Sint: + out = interop::GPUTextureFormat::kRg8Sint; + return true; + case wgpu::TextureFormat::R32Uint: + out = interop::GPUTextureFormat::kR32Uint; + return true; + case wgpu::TextureFormat::R32Sint: + out = interop::GPUTextureFormat::kR32Sint; + return true; + case wgpu::TextureFormat::R32Float: + out = interop::GPUTextureFormat::kR32Float; + return true; + case wgpu::TextureFormat::RG16Uint: + out = interop::GPUTextureFormat::kRg16Uint; + return true; + case wgpu::TextureFormat::RG16Sint: + out = interop::GPUTextureFormat::kRg16Sint; + return true; + case wgpu::TextureFormat::RG16Float: + out = interop::GPUTextureFormat::kRg16Float; + return true; + case wgpu::TextureFormat::RGBA8Unorm: + out = interop::GPUTextureFormat::kRgba8Unorm; + return true; + case wgpu::TextureFormat::RGBA8UnormSrgb: + out = interop::GPUTextureFormat::kRgba8UnormSrgb; + return true; + case wgpu::TextureFormat::RGBA8Snorm: + out = interop::GPUTextureFormat::kRgba8Snorm; + return true; + case wgpu::TextureFormat::RGBA8Uint: + out = interop::GPUTextureFormat::kRgba8Uint; + return true; + case wgpu::TextureFormat::RGBA8Sint: + out = interop::GPUTextureFormat::kRgba8Sint; + return true; + case wgpu::TextureFormat::BGRA8Unorm: + out = interop::GPUTextureFormat::kBgra8Unorm; + return true; + case wgpu::TextureFormat::BGRA8UnormSrgb: + out = interop::GPUTextureFormat::kBgra8UnormSrgb; + return true; + case wgpu::TextureFormat::RGB9E5Ufloat: + out = interop::GPUTextureFormat::kRgb9E5Ufloat; + return true; + case wgpu::TextureFormat::RGB10A2Unorm: + out = interop::GPUTextureFormat::kRgb10A2Unorm; + return true; + case wgpu::TextureFormat::RG11B10Ufloat: + out = interop::GPUTextureFormat::kRg11B10Ufloat; + return true; + case wgpu::TextureFormat::RG32Uint: + out = interop::GPUTextureFormat::kRg32Uint; + return true; + case wgpu::TextureFormat::RG32Sint: + out = interop::GPUTextureFormat::kRg32Sint; + return true; + case wgpu::TextureFormat::RG32Float: + out = interop::GPUTextureFormat::kRg32Float; + return true; + case wgpu::TextureFormat::RGBA16Uint: + out = interop::GPUTextureFormat::kRgba16Uint; + return true; + case wgpu::TextureFormat::RGBA16Sint: + out = interop::GPUTextureFormat::kRgba16Sint; + return true; + case wgpu::TextureFormat::RGBA16Float: + out = interop::GPUTextureFormat::kRgba16Float; + return true; + case wgpu::TextureFormat::RGBA32Uint: + out = interop::GPUTextureFormat::kRgba32Uint; + return true; + case wgpu::TextureFormat::RGBA32Sint: + out = interop::GPUTextureFormat::kRgba32Sint; + return true; + case wgpu::TextureFormat::RGBA32Float: + out = interop::GPUTextureFormat::kRgba32Float; + return true; + case wgpu::TextureFormat::Stencil8: + out = interop::GPUTextureFormat::kStencil8; + return true; + case wgpu::TextureFormat::Depth16Unorm: + out = interop::GPUTextureFormat::kDepth16Unorm; + return true; + case wgpu::TextureFormat::Depth24Plus: + out = interop::GPUTextureFormat::kDepth24Plus; + return true; + case wgpu::TextureFormat::Depth24PlusStencil8: + out = interop::GPUTextureFormat::kDepth24PlusStencil8; + return true; + case wgpu::TextureFormat::Depth32Float: + out = interop::GPUTextureFormat::kDepth32Float; + return true; + case wgpu::TextureFormat::Depth32FloatStencil8: + out = interop::GPUTextureFormat::kDepth32FloatStencil8; + return true; + case wgpu::TextureFormat::BC1RGBAUnorm: + out = interop::GPUTextureFormat::kBc1RgbaUnorm; + return true; + case wgpu::TextureFormat::BC1RGBAUnormSrgb: + out = interop::GPUTextureFormat::kBc1RgbaUnormSrgb; + return true; + case wgpu::TextureFormat::BC2RGBAUnorm: + out = interop::GPUTextureFormat::kBc2RgbaUnorm; + return true; + case wgpu::TextureFormat::BC2RGBAUnormSrgb: + out = interop::GPUTextureFormat::kBc2RgbaUnormSrgb; + return true; + case wgpu::TextureFormat::BC3RGBAUnorm: + out = interop::GPUTextureFormat::kBc3RgbaUnorm; + return true; + case wgpu::TextureFormat::BC3RGBAUnormSrgb: + out = interop::GPUTextureFormat::kBc3RgbaUnormSrgb; + return true; + case wgpu::TextureFormat::BC4RUnorm: + out = interop::GPUTextureFormat::kBc4RUnorm; + return true; + case wgpu::TextureFormat::BC4RSnorm: + out = interop::GPUTextureFormat::kBc4RSnorm; + return true; + case wgpu::TextureFormat::BC5RGUnorm: + out = interop::GPUTextureFormat::kBc5RgUnorm; + return true; + case wgpu::TextureFormat::BC5RGSnorm: + out = interop::GPUTextureFormat::kBc5RgSnorm; + return true; + case wgpu::TextureFormat::BC6HRGBUfloat: + out = interop::GPUTextureFormat::kBc6HRgbUfloat; + return true; + case wgpu::TextureFormat::BC6HRGBFloat: + out = interop::GPUTextureFormat::kBc6HRgbFloat; + return true; + case wgpu::TextureFormat::BC7RGBAUnorm: + out = interop::GPUTextureFormat::kBc7RgbaUnorm; + return true; + case wgpu::TextureFormat::BC7RGBAUnormSrgb: + out = interop::GPUTextureFormat::kBc7RgbaUnormSrgb; + return true; + case wgpu::TextureFormat::ETC2RGB8Unorm: + out = interop::GPUTextureFormat::kEtc2Rgb8Unorm; + return true; + case wgpu::TextureFormat::ETC2RGB8UnormSrgb: + out = interop::GPUTextureFormat::kEtc2Rgb8UnormSrgb; + return true; + case wgpu::TextureFormat::ETC2RGB8A1Unorm: + out = interop::GPUTextureFormat::kEtc2Rgb8A1Unorm; + return true; + case wgpu::TextureFormat::ETC2RGB8A1UnormSrgb: + out = interop::GPUTextureFormat::kEtc2Rgb8A1UnormSrgb; + return true; + case wgpu::TextureFormat::ETC2RGBA8Unorm: + out = interop::GPUTextureFormat::kEtc2Rgba8Unorm; + return true; + case wgpu::TextureFormat::ETC2RGBA8UnormSrgb: + out = interop::GPUTextureFormat::kEtc2Rgba8UnormSrgb; + return true; + case wgpu::TextureFormat::EACR11Unorm: + out = interop::GPUTextureFormat::kEacR11Unorm; + return true; + case wgpu::TextureFormat::EACR11Snorm: + out = interop::GPUTextureFormat::kEacR11Snorm; + return true; + case wgpu::TextureFormat::EACRG11Unorm: + out = interop::GPUTextureFormat::kEacRg11Unorm; + return true; + case wgpu::TextureFormat::EACRG11Snorm: + out = interop::GPUTextureFormat::kEacRg11Snorm; + return true; + case wgpu::TextureFormat::ASTC4x4Unorm: + out = interop::GPUTextureFormat::kAstc4X4Unorm; + return true; + case wgpu::TextureFormat::ASTC4x4UnormSrgb: + out = interop::GPUTextureFormat::kAstc4X4UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC5x4Unorm: + out = interop::GPUTextureFormat::kAstc5X4Unorm; + return true; + case wgpu::TextureFormat::ASTC5x4UnormSrgb: + out = interop::GPUTextureFormat::kAstc5X4UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC5x5Unorm: + out = interop::GPUTextureFormat::kAstc5X5Unorm; + return true; + case wgpu::TextureFormat::ASTC5x5UnormSrgb: + out = interop::GPUTextureFormat::kAstc5X5UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC6x5Unorm: + out = interop::GPUTextureFormat::kAstc6X5Unorm; + return true; + case wgpu::TextureFormat::ASTC6x5UnormSrgb: + out = interop::GPUTextureFormat::kAstc6X5UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC6x6Unorm: + out = interop::GPUTextureFormat::kAstc6X6Unorm; + return true; + case wgpu::TextureFormat::ASTC6x6UnormSrgb: + out = interop::GPUTextureFormat::kAstc6X6UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC8x5Unorm: + out = interop::GPUTextureFormat::kAstc8X5Unorm; + return true; + case wgpu::TextureFormat::ASTC8x5UnormSrgb: + out = interop::GPUTextureFormat::kAstc8X5UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC8x6Unorm: + out = interop::GPUTextureFormat::kAstc8X6Unorm; + return true; + case wgpu::TextureFormat::ASTC8x6UnormSrgb: + out = interop::GPUTextureFormat::kAstc8X6UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC8x8Unorm: + out = interop::GPUTextureFormat::kAstc8X8Unorm; + return true; + case wgpu::TextureFormat::ASTC8x8UnormSrgb: + out = interop::GPUTextureFormat::kAstc8X8UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC10x5Unorm: + out = interop::GPUTextureFormat::kAstc10X5Unorm; + return true; + case wgpu::TextureFormat::ASTC10x5UnormSrgb: + out = interop::GPUTextureFormat::kAstc10X5UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC10x6Unorm: + out = interop::GPUTextureFormat::kAstc10X6Unorm; + return true; + case wgpu::TextureFormat::ASTC10x6UnormSrgb: + out = interop::GPUTextureFormat::kAstc10X6UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC10x8Unorm: + out = interop::GPUTextureFormat::kAstc10X8Unorm; + return true; + case wgpu::TextureFormat::ASTC10x8UnormSrgb: + out = interop::GPUTextureFormat::kAstc10X8UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC10x10Unorm: + out = interop::GPUTextureFormat::kAstc10X10Unorm; + return true; + case wgpu::TextureFormat::ASTC10x10UnormSrgb: + out = interop::GPUTextureFormat::kAstc10X10UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC12x10Unorm: + out = interop::GPUTextureFormat::kAstc12X10Unorm; + return true; + case wgpu::TextureFormat::ASTC12x10UnormSrgb: + out = interop::GPUTextureFormat::kAstc12X10UnormSrgb; + return true; + case wgpu::TextureFormat::ASTC12x12Unorm: + out = interop::GPUTextureFormat::kAstc12X12Unorm; + return true; + case wgpu::TextureFormat::ASTC12x12UnormSrgb: + out = interop::GPUTextureFormat::kAstc12X12UnormSrgb; + return true; + + case wgpu::TextureFormat::Undefined: + case wgpu::TextureFormat::R8BG8Biplanar420Unorm: + return false; + } + + return false; +} + bool Converter::Convert(wgpu::TextureUsage& out, const interop::GPUTextureUsageFlags& in) { out = static_cast(in.value); return true; } +bool Converter::Convert(interop::GPUTextureUsageFlags& out, wgpu::TextureUsage in) { + out = interop::GPUTextureUsageFlags(static_cast(out)); + return true; +} + bool Converter::Convert(wgpu::ColorWriteMask& out, const interop::GPUColorWriteFlags& in) { out = static_cast(in.value); return true; @@ -477,6 +772,11 @@ bool Converter::Convert(wgpu::BufferUsage& out, const interop::GPUBufferUsageFla return true; } +bool Converter::Convert(interop::GPUBufferUsageFlags& out, wgpu::BufferUsage in) { + out = interop::GPUBufferUsageFlags(static_cast(out)); + return true; +} + bool Converter::Convert(wgpu::MapMode& out, const interop::GPUMapModeFlags& in) { out = static_cast(in.value); return true; @@ -504,6 +804,21 @@ bool Converter::Convert(wgpu::TextureDimension& out, const interop::GPUTextureDi return false; } +bool Converter::Convert(interop::GPUTextureDimension& out, wgpu::TextureDimension in) { + switch (in) { + case wgpu::TextureDimension::e1D: + out = interop::GPUTextureDimension::k1D; + return true; + case wgpu::TextureDimension::e2D: + out = interop::GPUTextureDimension::k2D; + return true; + case wgpu::TextureDimension::e3D: + out = interop::GPUTextureDimension::k3D; + return true; + } + return false; +} + bool Converter::Convert(wgpu::TextureViewDimension& out, const interop::GPUTextureViewDimension& in) { out = wgpu::TextureViewDimension::Undefined; @@ -1153,6 +1468,21 @@ bool Converter::Convert(wgpu::QueryType& out, const interop::GPUQueryType& in) { return false; } +bool Converter::Convert(interop::GPUQueryType& out, wgpu::QueryType in) { + switch (in) { + case wgpu::QueryType::Occlusion: + out = interop::GPUQueryType::kOcclusion; + return true; + case wgpu::QueryType::Timestamp: + out = interop::GPUQueryType::kTimestamp; + return true; + case wgpu::QueryType::PipelineStatistics: + // TODO(dawn:1123): Add support for pipeline statistics if they are in WebGPU one day. + return false; + } + return false; +} + bool Converter::Convert(wgpu::AddressMode& out, const interop::GPUAddressMode& in) { out = wgpu::AddressMode::Repeat; switch (in) { @@ -1217,4 +1547,9 @@ bool Converter::Convert(wgpu::RenderPipelineDescriptor& out, Convert(out.fragment, in.fragment); } +bool Converter::Convert(wgpu::PipelineLayout& out, const interop::GPUAutoLayoutMode& in) { + out = nullptr; + return true; +} + } // namespace wgpu::binding diff --git a/src/dawn/node/binding/Converter.h b/src/dawn/node/binding/Converter.h index fb94598376..0c8a232a87 100644 --- a/src/dawn/node/binding/Converter.h +++ b/src/dawn/node/binding/Converter.h @@ -243,6 +243,19 @@ class Converter { [[nodiscard]] bool Convert(wgpu::RenderPipelineDescriptor& out, const interop::GPURenderPipelineDescriptor& in); + [[nodiscard]] bool Convert(wgpu::PipelineLayout& out, const interop::GPUAutoLayoutMode& in); + + // Below are the various overloads of Convert() used to convert the Dawn types -> interop. + [[nodiscard]] bool Convert(interop::GPUTextureDimension& out, wgpu::TextureDimension in); + + [[nodiscard]] bool Convert(interop::GPUTextureFormat& out, wgpu::TextureFormat in); + + [[nodiscard]] bool Convert(interop::GPUTextureUsageFlags& out, wgpu::TextureUsage in); + + [[nodiscard]] bool Convert(interop::GPUBufferUsageFlags& out, wgpu::BufferUsage in); + + [[nodiscard]] bool Convert(interop::GPUQueryType& out, wgpu::QueryType in); + // std::string to C string inline bool Convert(const char*& out, const std::string& in) { out = in.c_str(); diff --git a/src/dawn/node/binding/GPU.cpp b/src/dawn/node/binding/GPU.cpp index 1b147ed37f..beeaa83863 100644 --- a/src/dawn/node/binding/GPU.cpp +++ b/src/dawn/node/binding/GPU.cpp @@ -165,4 +165,8 @@ interop::Promise>> GPU::re return promise; } +interop::GPUTextureFormat GPU::getPreferredCanvasFormat(Napi::Env) { + UNIMPLEMENTED(); +} + } // namespace wgpu::binding diff --git a/src/dawn/node/binding/GPU.h b/src/dawn/node/binding/GPU.h index 8ccafff99b..aa6956e5a8 100644 --- a/src/dawn/node/binding/GPU.h +++ b/src/dawn/node/binding/GPU.h @@ -32,6 +32,7 @@ class GPU final : public interop::GPU { interop::Promise>> requestAdapter( Napi::Env env, interop::GPURequestAdapterOptions options) override; + interop::GPUTextureFormat getPreferredCanvasFormat(Napi::Env) override; private: const Flags flags_; diff --git a/src/dawn/node/binding/GPUAdapter.cpp b/src/dawn/node/binding/GPUAdapter.cpp index bbed35de88..a2d7248c0d 100644 --- a/src/dawn/node/binding/GPUAdapter.cpp +++ b/src/dawn/node/binding/GPUAdapter.cpp @@ -15,6 +15,7 @@ #include "src/dawn/node/binding/GPUAdapter.h" #include +#include #include #include "src/dawn/node/binding/Errors.h" @@ -25,8 +26,9 @@ namespace { // TODO(amaiorano): Move to utility header std::vector Split(const std::string& s, char delim) { - if (s.empty()) + if (s.empty()) { return {}; + } std::vector result; const size_t lastIndex = s.length() - 1; @@ -36,13 +38,15 @@ std::vector Split(const std::string& s, char delim) { while (i <= lastIndex) { if (s[i] == delim) { auto token = s.substr(startIndex, i - startIndex); - if (!token.empty()) // Discard empty tokens + if (!token.empty()) { // Discard empty tokens result.push_back(token); + } startIndex = i + 1; } else if (i == lastIndex) { auto token = s.substr(startIndex, i - startIndex + 1); - if (!token.empty()) // Discard empty tokens + if (!token.empty()) { // Discard empty tokens result.push_back(token); + } } ++i; } @@ -88,32 +92,37 @@ namespace { //////////////////////////////////////////////////////////////////////////////// class Features : public interop::GPUSupportedFeatures { public: - explicit Features(WGPUDeviceProperties properties) { - if (properties.depth24UnormStencil8) { - enabled_.emplace(interop::GPUFeatureName::kDepth24UnormStencil8); + explicit Features(std::vector features) { + for (wgpu::FeatureName feature : features) { + switch (feature) { + case wgpu::FeatureName::Depth32FloatStencil8: + enabled_.emplace(interop::GPUFeatureName::kDepth32FloatStencil8); + break; + case wgpu::FeatureName::TimestampQuery: + enabled_.emplace(interop::GPUFeatureName::kTimestampQuery); + break; + case wgpu::FeatureName::TextureCompressionBC: + enabled_.emplace(interop::GPUFeatureName::kTextureCompressionBc); + break; + case wgpu::FeatureName::TextureCompressionETC2: + enabled_.emplace(interop::GPUFeatureName::kTextureCompressionEtc2); + break; + case wgpu::FeatureName::TextureCompressionASTC: + enabled_.emplace(interop::GPUFeatureName::kTextureCompressionAstc); + break; + case wgpu::FeatureName::IndirectFirstInstance: + enabled_.emplace(interop::GPUFeatureName::kIndirectFirstInstance); + break; + case wgpu::FeatureName::DepthClipControl: + enabled_.emplace(interop::GPUFeatureName::kDepthClipControl); + break; + default: + break; + } } - if (properties.depth32FloatStencil8) { - enabled_.emplace(interop::GPUFeatureName::kDepth32FloatStencil8); - } - if (properties.timestampQuery) { - enabled_.emplace(interop::GPUFeatureName::kTimestampQuery); - } - if (properties.textureCompressionBC) { - enabled_.emplace(interop::GPUFeatureName::kTextureCompressionBc); - } - if (properties.textureCompressionETC2) { - enabled_.emplace(interop::GPUFeatureName::kTextureCompressionEtc2); - } - if (properties.textureCompressionASTC) { - enabled_.emplace(interop::GPUFeatureName::kTextureCompressionAstc); - } - if (properties.timestampQuery) { - enabled_.emplace(interop::GPUFeatureName::kTimestampQuery); - } - // TODO(dawn:1123) add support for these extensions when possible. - // wgpu::interop::GPUFeatureName::kIndirectFirstInstance - // wgpu::interop::GPUFeatureName::kDepthClipControl + // wgpu::interop::GPUFeatureName::kShaderF16 + // wgpu::interop::GPUFeatureName::kBgra8UnormStorage } bool has(interop::GPUFeatureName feature) { return enabled_.count(feature) != 0; } @@ -147,12 +156,14 @@ class Features : public interop::GPUSupportedFeatures { //////////////////////////////////////////////////////////////////////////////// GPUAdapter::GPUAdapter(dawn::native::Adapter a, const Flags& flags) : adapter_(a), flags_(flags) {} -std::string GPUAdapter::getName(Napi::Env) { - return "dawn-adapter"; -} - +// TODO(dawn:1133): Avoid the extra copy by making the generator make a virtual method with const +// std::string& interop::Interface GPUAdapter::getFeatures(Napi::Env env) { - return interop::GPUSupportedFeatures::Create(env, adapter_.GetAdapterProperties()); + wgpu::Adapter adapter(adapter_.Get()); + size_t count = adapter.EnumerateFeatures(nullptr); + std::vector features(count); + adapter.EnumerateFeatures(&features[0]); + return interop::GPUSupportedFeatures::Create(env, std::move(features)); } interop::Interface GPUAdapter::getLimits(Napi::Env env) { @@ -196,14 +207,13 @@ interop::Promise> GPUAdapter::requestDevi case interop::GPUFeatureName::kTimestampQuery: requiredFeatures.emplace_back(wgpu::FeatureName::TimestampQuery); continue; - case interop::GPUFeatureName::kDepth24UnormStencil8: - requiredFeatures.emplace_back(wgpu::FeatureName::Depth24UnormStencil8); - continue; case interop::GPUFeatureName::kDepth32FloatStencil8: requiredFeatures.emplace_back(wgpu::FeatureName::Depth32FloatStencil8); continue; case interop::GPUFeatureName::kDepthClipControl: + case interop::GPUFeatureName::kShaderF16: case interop::GPUFeatureName::kIndirectFirstInstance: + case interop::GPUFeatureName::kBgra8UnormStorage: // TODO(dawn:1123) Add support for these extensions when possible. continue; } @@ -264,4 +274,11 @@ interop::Promise> GPUAdapter::requestDevi } return promise; } + +interop::Promise> GPUAdapter::requestAdapterInfo( + Napi::Env, + std::vector unmaskHints) { + UNIMPLEMENTED(); +} + } // namespace wgpu::binding diff --git a/src/dawn/node/binding/GPUAdapter.h b/src/dawn/node/binding/GPUAdapter.h index 3249232ef2..60b8436ab0 100644 --- a/src/dawn/node/binding/GPUAdapter.h +++ b/src/dawn/node/binding/GPUAdapter.h @@ -16,6 +16,7 @@ #define SRC_DAWN_NODE_BINDING_GPUADAPTER_H_ #include +#include #include "dawn/native/DawnNative.h" #include "dawn/webgpu_cpp.h" @@ -31,13 +32,15 @@ class GPUAdapter final : public interop::GPUAdapter { GPUAdapter(dawn::native::Adapter a, const Flags& flags); // interop::GPUAdapter interface compliance - std::string getName(Napi::Env) override; - interop::Interface getFeatures(Napi::Env) override; - interop::Interface getLimits(Napi::Env) override; - bool getIsFallbackAdapter(Napi::Env) override; interop::Promise> requestDevice( Napi::Env env, interop::GPUDeviceDescriptor descriptor) override; + interop::Promise> requestAdapterInfo( + Napi::Env, + std::vector unmaskHints) override; + interop::Interface getFeatures(Napi::Env) override; + interop::Interface getLimits(Napi::Env) override; + bool getIsFallbackAdapter(Napi::Env) override; private: dawn::native::Adapter adapter_; diff --git a/src/dawn/node/binding/GPUBuffer.cpp b/src/dawn/node/binding/GPUBuffer.cpp index 4c2a90e54c..0d9718d574 100644 --- a/src/dawn/node/binding/GPUBuffer.cpp +++ b/src/dawn/node/binding/GPUBuffer.cpp @@ -162,6 +162,23 @@ void GPUBuffer::destroy(Napi::Env) { state_ = State::Destroyed; } +interop::GPUSize64 GPUBuffer::getSize(Napi::Env) { + return buffer_.GetSize(); +} + +interop::GPUBufferUsageFlags GPUBuffer::getUsage(Napi::Env env) { + interop::GPUBufferUsageFlags result; + + Converter conv(env); + if (!conv(result, buffer_.GetUsage())) { + Napi::Error::New(env, "Couldn't convert usage to a JavaScript value.") + .ThrowAsJavaScriptException(); + return {0u}; // Doesn't get used. + } + + return result; +} + void GPUBuffer::DetachMappings() { for (auto& mapping : mapped_) { mapping.buffer.Value().Detach(); diff --git a/src/dawn/node/binding/GPUBuffer.h b/src/dawn/node/binding/GPUBuffer.h index f4e1b30e38..250f41b7f5 100644 --- a/src/dawn/node/binding/GPUBuffer.h +++ b/src/dawn/node/binding/GPUBuffer.h @@ -51,6 +51,8 @@ class GPUBuffer final : public interop::GPUBuffer { std::optional size) override; void unmap(Napi::Env) override; void destroy(Napi::Env) override; + interop::GPUSize64 getSize(Napi::Env) override; + interop::GPUBufferUsageFlags getUsage(Napi::Env) override; std::string getLabel(Napi::Env) override; void setLabel(Napi::Env, std::string value) override; diff --git a/src/dawn/node/binding/GPUDevice.cpp b/src/dawn/node/binding/GPUDevice.cpp index 163acd829e..9ac8c2808a 100644 --- a/src/dawn/node/binding/GPUDevice.cpp +++ b/src/dawn/node/binding/GPUDevice.cpp @@ -41,6 +41,53 @@ namespace wgpu::binding { namespace { +// Returns a string representation of the WGPULoggingType +const char* str(WGPULoggingType ty) { + switch (ty) { + case WGPULoggingType_Verbose: + return "verbose"; + case WGPULoggingType_Info: + return "info"; + case WGPULoggingType_Warning: + return "warning"; + case WGPULoggingType_Error: + return "error"; + default: + return "unknown"; + } +} + +// Returns a string representation of the WGPUErrorType +const char* str(WGPUErrorType ty) { + switch (ty) { + case WGPUErrorType_NoError: + return "no error"; + case WGPUErrorType_Validation: + return "validation"; + case WGPUErrorType_OutOfMemory: + return "out of memory"; + case WGPUErrorType_Unknown: + return "unknown"; + case WGPUErrorType_DeviceLost: + return "device lost"; + default: + return "unknown"; + } +} + +// There's something broken with Node when attempting to write more than 65536 bytes to cout. +// Split the string up into writes of 4k chunks . +// Likely related: https://github.com/nodejs/node/issues/12921 +void chunkedWrite(const char* msg) { + while (true) { + auto n = printf("%.4096s", msg); + if (n == 0) { + break; + } + msg += n; + } +} + class DeviceLostInfo : public interop::GPUDeviceLostInfo { public: DeviceLostInfo(interop::GPUDeviceLostReason reason, std::string message) @@ -56,7 +103,16 @@ class DeviceLostInfo : public interop::GPUDeviceLostInfo { std::string message_; }; -class OOMError : public interop::GPUOutOfMemoryError {}; +class OOMError : public interop::GPUOutOfMemoryError { + public: + explicit OOMError(std::string message) : message_(std::move(message)) {} + + std::string getMessage(Napi::Env) override { return message_; }; + + private: + std::string message_; +}; + class ValidationError : public interop::GPUValidationError { public: explicit ValidationError(std::string message) : message_(std::move(message)) {} @@ -79,12 +135,14 @@ GPUDevice::GPUDevice(Napi::Env env, wgpu::Device device) lost_promise_(env, PROMISE_INFO) { device_.SetLoggingCallback( [](WGPULoggingType type, char const* message, void* userdata) { - std::cout << type << ": " << message << std::endl; + printf("%s:\n", str(type)); + chunkedWrite(message); }, nullptr); device_.SetUncapturedErrorCallback( [](WGPUErrorType type, char const* message, void* userdata) { - std::cout << type << ": " << message << std::endl; + printf("%s:\n", str(type)); + chunkedWrite(message); }, nullptr); @@ -109,7 +167,15 @@ GPUDevice::GPUDevice(Napi::Env env, wgpu::Device device) this); } -GPUDevice::~GPUDevice() {} +GPUDevice::~GPUDevice() { + // A bit of a fudge to work around the fact that the CTS doesn't destroy GPU devices. + // Without this, we'll get a 'Promise not resolved or rejected' fatal message as the + // lost_promise_ is left hanging. We'll also not clean up any GPU objects before terminating the + // process, which is not a good idea. + if (!destroyed_) { + destroy(env_); + } +} interop::Interface GPUDevice::getFeatures(Napi::Env env) { class Features : public interop::GPUSupportedFeatures { @@ -138,6 +204,7 @@ void GPUDevice::destroy(Napi::Env env) { env_, interop::GPUDeviceLostReason::kDestroyed, "device was destroyed")); } device_.Destroy(); + destroyed_ = true; } interop::Interface GPUDevice::createBuffer( @@ -166,7 +233,8 @@ interop::Interface GPUDevice::createTexture( !conv(desc.dimension, descriptor.dimension) || // !conv(desc.mipLevelCount, descriptor.mipLevelCount) || // !conv(desc.sampleCount, descriptor.sampleCount) || // - !conv(desc.format, descriptor.format)) { + !conv(desc.format, descriptor.format) || // + !conv(desc.viewFormats, desc.viewFormatCount, descriptor.viewFormats)) { return {}; } return interop::GPUTexture::Create(env, device_.CreateTexture(&desc)); @@ -435,8 +503,9 @@ void GPUDevice::pushErrorScope(Napi::Env env, interop::GPUErrorFilter filter) { device_.PushErrorScope(f); } -interop::Promise> GPUDevice::popErrorScope(Napi::Env env) { - using Promise = interop::Promise>; +interop::Promise>> GPUDevice::popErrorScope( + Napi::Env env) { + using Promise = interop::Promise>>; struct Context { Napi::Env env; Promise promise; @@ -453,13 +522,18 @@ interop::Promise> GPUDevice::popErrorScope(Napi case WGPUErrorType::WGPUErrorType_NoError: c->promise.Resolve({}); break; - case WGPUErrorType::WGPUErrorType_OutOfMemory: - c->promise.Resolve(interop::GPUOutOfMemoryError::Create(env)); + case WGPUErrorType::WGPUErrorType_OutOfMemory: { + interop::Interface err{ + interop::GPUOutOfMemoryError::Create(env, message)}; + c->promise.Resolve(err); break; - case WGPUErrorType::WGPUErrorType_Validation: - c->promise.Resolve( - interop::GPUValidationError::Create(env, message)); + } + case WGPUErrorType::WGPUErrorType_Validation: { + interop::Interface err{ + interop::GPUValidationError::Create(env, message)}; + c->promise.Resolve(err); break; + } case WGPUErrorType::WGPUErrorType_Unknown: case WGPUErrorType::WGPUErrorType_DeviceLost: c->promise.Reject(Errors::OperationError(env, message)); diff --git a/src/dawn/node/binding/GPUDevice.h b/src/dawn/node/binding/GPUDevice.h index 57a4c2ca51..9c53e9a444 100644 --- a/src/dawn/node/binding/GPUDevice.h +++ b/src/dawn/node/binding/GPUDevice.h @@ -83,7 +83,8 @@ class GPUDevice final : public interop::GPUDevice { interop::Promise> getLost( Napi::Env env) override; void pushErrorScope(Napi::Env, interop::GPUErrorFilter filter) override; - interop::Promise> popErrorScope(Napi::Env env) override; + interop::Promise>> popErrorScope( + Napi::Env env) override; std::string getLabel(Napi::Env) override; void setLabel(Napi::Env, std::string value) override; interop::Interface getOnuncapturederror(Napi::Env) override; @@ -110,6 +111,8 @@ class GPUDevice final : public interop::GPUDevice { // This promise's JS object lives as long as the device because it is stored in .lost // of the wrapper JS object. interop::Promise> lost_promise_; + + bool destroyed_ = false; }; } // namespace wgpu::binding diff --git a/src/dawn/node/binding/GPUQuerySet.cpp b/src/dawn/node/binding/GPUQuerySet.cpp index 3197d987e4..c02bdb6b6a 100644 --- a/src/dawn/node/binding/GPUQuerySet.cpp +++ b/src/dawn/node/binding/GPUQuerySet.cpp @@ -16,6 +16,7 @@ #include +#include "src/dawn/node/binding/Converter.h" #include "src/dawn/node/utils/Debug.h" namespace wgpu::binding { @@ -29,6 +30,23 @@ void GPUQuerySet::destroy(Napi::Env) { query_set_.Destroy(); } +interop::GPUQueryType GPUQuerySet::getType(Napi::Env env) { + interop::GPUQueryType result; + + Converter conv(env); + if (!conv(result, query_set_.GetType())) { + Napi::Error::New(env, "Couldn't convert type to a JavaScript value.") + .ThrowAsJavaScriptException(); + return interop::GPUQueryType::kOcclusion; // Doesn't get used. + } + + return result; +} + +interop::GPUSize32 GPUQuerySet::getCount(Napi::Env) { + return query_set_.GetCount(); +} + std::string GPUQuerySet::getLabel(Napi::Env) { UNIMPLEMENTED(); } diff --git a/src/dawn/node/binding/GPUQuerySet.h b/src/dawn/node/binding/GPUQuerySet.h index 7c0e9dd163..d2bced17fa 100644 --- a/src/dawn/node/binding/GPUQuerySet.h +++ b/src/dawn/node/binding/GPUQuerySet.h @@ -34,6 +34,8 @@ class GPUQuerySet final : public interop::GPUQuerySet { // interop::GPUQuerySet interface compliance void destroy(Napi::Env) override; + interop::GPUQueryType getType(Napi::Env) override; + interop::GPUSize32 getCount(Napi::Env) override; std::string getLabel(Napi::Env) override; void setLabel(Napi::Env, std::string value) override; diff --git a/src/dawn/node/binding/GPUSupportedLimits.cpp b/src/dawn/node/binding/GPUSupportedLimits.cpp index 341385f89e..83a5cb2b29 100644 --- a/src/dawn/node/binding/GPUSupportedLimits.cpp +++ b/src/dawn/node/binding/GPUSupportedLimits.cpp @@ -104,6 +104,11 @@ uint32_t GPUSupportedLimits::getMaxInterStageShaderComponents(Napi::Env) { return limits_.limits.maxInterStageShaderComponents; } +uint32_t GPUSupportedLimits::getMaxInterStageShaderVariables(Napi::Env) { + UNIMPLEMENTED(); + // return limits_.limits.maxInterStageShaderVariables; +} + uint32_t GPUSupportedLimits::getMaxComputeWorkgroupStorageSize(Napi::Env) { return limits_.limits.maxComputeWorkgroupStorageSize; } diff --git a/src/dawn/node/binding/GPUSupportedLimits.h b/src/dawn/node/binding/GPUSupportedLimits.h index 337db00d8c..246da4d41f 100644 --- a/src/dawn/node/binding/GPUSupportedLimits.h +++ b/src/dawn/node/binding/GPUSupportedLimits.h @@ -49,6 +49,7 @@ class GPUSupportedLimits final : public interop::GPUSupportedLimits { uint32_t getMaxVertexAttributes(Napi::Env) override; uint32_t getMaxVertexBufferArrayStride(Napi::Env) override; uint32_t getMaxInterStageShaderComponents(Napi::Env) override; + uint32_t getMaxInterStageShaderVariables(Napi::Env) override; uint32_t getMaxComputeWorkgroupStorageSize(Napi::Env) override; uint32_t getMaxComputeInvocationsPerWorkgroup(Napi::Env) override; uint32_t getMaxComputeWorkgroupSizeX(Napi::Env) override; diff --git a/src/dawn/node/binding/GPUTexture.cpp b/src/dawn/node/binding/GPUTexture.cpp index 61ca716b35..24c682d87d 100644 --- a/src/dawn/node/binding/GPUTexture.cpp +++ b/src/dawn/node/binding/GPUTexture.cpp @@ -54,6 +54,65 @@ void GPUTexture::destroy(Napi::Env) { texture_.Destroy(); } +interop::GPUIntegerCoordinate GPUTexture::getWidth(Napi::Env) { + return texture_.GetWidth(); +} + +interop::GPUIntegerCoordinate GPUTexture::getHeight(Napi::Env) { + return texture_.GetHeight(); +} + +interop::GPUIntegerCoordinate GPUTexture::getDepthOrArrayLayers(Napi::Env) { + return texture_.GetDepthOrArrayLayers(); +} + +interop::GPUIntegerCoordinate GPUTexture::getMipLevelCount(Napi::Env) { + return texture_.GetMipLevelCount(); +} + +interop::GPUSize32 GPUTexture::getSampleCount(Napi::Env) { + return texture_.GetSampleCount(); +} + +interop::GPUTextureDimension GPUTexture::getDimension(Napi::Env env) { + interop::GPUTextureDimension result; + + Converter conv(env); + if (!conv(result, texture_.GetDimension())) { + Napi::Error::New(env, "Couldn't convert dimension to a JavaScript value.") + .ThrowAsJavaScriptException(); + return interop::GPUTextureDimension::k1D; // Doesn't get used. + } + + return result; +} + +interop::GPUTextureFormat GPUTexture::getFormat(Napi::Env env) { + interop::GPUTextureFormat result; + + Converter conv(env); + if (!conv(result, texture_.GetFormat())) { + Napi::Error::New(env, "Couldn't convert format to a JavaScript value.") + .ThrowAsJavaScriptException(); + return interop::GPUTextureFormat::kR32Float; // Doesn't get used. + } + + return result; +} + +interop::GPUTextureUsageFlags GPUTexture::getUsage(Napi::Env env) { + interop::GPUTextureUsageFlags result; + + Converter conv(env); + if (!conv(result, texture_.GetUsage())) { + Napi::Error::New(env, "Couldn't convert usage to a JavaScript value.") + .ThrowAsJavaScriptException(); + return {0u}; // Doesn't get used. + } + + return result; +} + std::string GPUTexture::getLabel(Napi::Env) { UNIMPLEMENTED(); } diff --git a/src/dawn/node/binding/GPUTexture.h b/src/dawn/node/binding/GPUTexture.h index edc96d103a..e108d78184 100644 --- a/src/dawn/node/binding/GPUTexture.h +++ b/src/dawn/node/binding/GPUTexture.h @@ -37,6 +37,14 @@ class GPUTexture final : public interop::GPUTexture { Napi::Env, interop::GPUTextureViewDescriptor descriptor) override; void destroy(Napi::Env) override; + interop::GPUIntegerCoordinate getWidth(Napi::Env) override; + interop::GPUIntegerCoordinate getHeight(Napi::Env) override; + interop::GPUIntegerCoordinate getDepthOrArrayLayers(Napi::Env) override; + interop::GPUIntegerCoordinate getMipLevelCount(Napi::Env) override; + interop::GPUSize32 getSampleCount(Napi::Env) override; + interop::GPUTextureDimension getDimension(Napi::Env) override; + interop::GPUTextureFormat getFormat(Napi::Env) override; + interop::GPUTextureUsageFlags getUsage(Napi::Env) override; std::string getLabel(Napi::Env) override; void setLabel(Napi::Env, std::string value) override; diff --git a/src/dawn/node/interop/Browser.idl b/src/dawn/node/interop/Browser.idl index b36c667b2d..44638f62ab 100644 --- a/src/dawn/node/interop/Browser.idl +++ b/src/dawn/node/interop/Browser.idl @@ -86,3 +86,5 @@ typedef(ArrayBufferView or ArrayBuffer) BufferSource; }; [LegacyNoInterfaceObject] interface EventHandler{}; + +enum PredefinedColorSpace { "srgb", "display-p3" }; diff --git a/src/dawn/node/interop/Core.h b/src/dawn/node/interop/Core.h index 4bf9ee7965..be1b4ac495 100644 --- a/src/dawn/node/interop/Core.h +++ b/src/dawn/node/interop/Core.h @@ -20,14 +20,12 @@ #include #include -// TODO(https://crbug.com/dawn/1379) Update cpplint and remove NOLINT -#include // NOLINT(build/include_order) +#include #include #include #include #include -// TODO(https://crbug.com/dawn/1379) Update cpplint and remove NOLINT -#include // NOLINT(build/include_order) +#include #include #include "src/dawn/node/interop/Napi.h" diff --git a/src/dawn/node/tools/src/cmd/run-cts/main.go b/src/dawn/node/tools/src/cmd/run-cts/main.go index afbe830045..090f2dbe54 100644 --- a/src/dawn/node/tools/src/cmd/run-cts/main.go +++ b/src/dawn/node/tools/src/cmd/run-cts/main.go @@ -129,7 +129,7 @@ func run() error { } var dawnNode, cts, node, npx, resultsPath, expectationsPath, logFilename, backend string - var printStdout, verbose, isolated, build bool + var printStdout, verbose, isolated, build, dumpShaders bool var numRunners int var flags dawnNodeFlags flag.StringVar(&dawnNode, "dawn-node", "", "path to dawn.node module") @@ -148,6 +148,7 @@ func run() error { flag.Var(&flags, "flag", "flag to pass to dawn-node as flag=value. multiple flags must be passed in individually") flag.StringVar(&backend, "backend", backendDefault, "backend to use: default|null|webgpu|d3d11|d3d12|metal|vulkan|opengl|opengles."+ " set to 'vulkan' if VK_ICD_FILENAMES environment variable is set, 'default' otherwise") + flag.BoolVar(&dumpShaders, "dump-shaders", false, "dump WGSL shaders. Enables --verbose") flag.Parse() // Create a thread-safe, color supporting stdout wrapper. @@ -219,6 +220,10 @@ func run() error { if !disableDawnFeaturesFound { flags = append(flags, "disable-dawn-features=disallow_unsafe_apis") } + if dumpShaders { + flags = append(flags, "enable-dawn-features=dump_shaders") + verbose = true + } r := runner{ numRunners: numRunners, @@ -972,7 +977,9 @@ func (r *runner) runTestcase(query string) result { msg := buf.String() switch { case errors.Is(err, context.DeadlineExceeded): - return result{testcase: query, status: timeout, message: msg} + return result{testcase: query, status: timeout, message: msg, error: err} + case err != nil: + break case strings.Contains(msg, "[fail]"): return result{testcase: query, status: fail, message: msg} case strings.Contains(msg, "[warn]"): diff --git a/src/dawn/node/utils/Debug.h b/src/dawn/node/utils/Debug.h index c68b858c69..66cd4da0e5 100644 --- a/src/dawn/node/utils/Debug.h +++ b/src/dawn/node/utils/Debug.h @@ -16,13 +16,11 @@ #define SRC_DAWN_NODE_UTILS_DEBUG_H_ #include -// TODO(https://crbug.com/dawn/1379) Update cpplint and remove NOLINT -#include // NOLINT(build/include_order) +#include #include #include #include -// TODO(https://crbug.com/dawn/1379) Update cpplint and remove NOLINT -#include // NOLINT(build/include_order) +#include #include #include "dawn/webgpu_cpp_print.h" diff --git a/src/dawn/platform/DawnPlatform.cpp b/src/dawn/platform/DawnPlatform.cpp index 0d52a33f4c..3b22ade0cd 100644 --- a/src/dawn/platform/DawnPlatform.cpp +++ b/src/dawn/platform/DawnPlatform.cpp @@ -53,8 +53,7 @@ uint64_t Platform::AddTraceEvent(char phase, return 0; } -dawn::platform::CachingInterface* Platform::GetCachingInterface(const void* fingerprint, - size_t fingerprintSize) { +dawn::platform::CachingInterface* Platform::GetCachingInterface() { return nullptr; } diff --git a/src/dawn/platform/tracing/TraceEvent.h b/src/dawn/platform/tracing/TraceEvent.h index d50305d8c4..76cbc56037 100644 --- a/src/dawn/platform/tracing/TraceEvent.h +++ b/src/dawn/platform/tracing/TraceEvent.h @@ -921,8 +921,9 @@ class TraceEndOnScopeClose { // Note: members of m_data intentionally left uninitialized. See initialize. TraceEndOnScopeClose() : m_pdata(0) {} ~TraceEndOnScopeClose() { - if (m_pdata) + if (m_pdata) { addEventIfEnabled(); + } } void initialize(dawn::platform::Platform* platform, diff --git a/src/dawn/samples/Animometer.cpp b/src/dawn/samples/Animometer.cpp index 41d59c8973..2138bb9b62 100644 --- a/src/dawn/samples/Animometer.cpp +++ b/src/dawn/samples/Animometer.cpp @@ -72,7 +72,7 @@ void init() { @builtin(position) Position : vec4; }; - @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var positions : array, 3> = array, 3>( vec4( 0.0, 0.1, 0.0, 1.0), vec4(-0.1, -0.1, 0.0, 1.0), @@ -112,7 +112,7 @@ void init() { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main(@location(0) v_color : vec4) -> @location(0) vec4 { + @fragment fn main(@location(0) v_color : vec4) -> @location(0) vec4 { return v_color; })"); diff --git a/src/dawn/samples/BUILD.gn b/src/dawn/samples/BUILD.gn index 58874cf623..f78498eae3 100644 --- a/src/dawn/samples/BUILD.gn +++ b/src/dawn/samples/BUILD.gn @@ -36,10 +36,10 @@ static_library("utils") { "${dawn_root}/src/dawn:cpp", "${dawn_root}/src/dawn:proc_shared", "${dawn_root}/src/dawn/common", + "${dawn_root}/src/dawn/glfw", "${dawn_root}/src/dawn/native", "${dawn_root}/src/dawn/utils", "${dawn_root}/src/dawn/utils:bindings", - "${dawn_root}/src/dawn/utils:glfw", "${dawn_root}/src/dawn/wire", ] public_configs = [ "${dawn_root}/src/dawn/common:internal_config" ] diff --git a/src/dawn/samples/CHelloTriangle.cpp b/src/dawn/samples/CHelloTriangle.cpp index ed1507e4bb..a912b00f1d 100644 --- a/src/dawn/samples/CHelloTriangle.cpp +++ b/src/dawn/samples/CHelloTriangle.cpp @@ -32,7 +32,7 @@ void init() { swapChainFormat = static_cast(GetPreferredSwapChainTextureFormat()); const char* vs = R"( - @stage(vertex) fn main( + @vertex fn main( @builtin(vertex_index) VertexIndex : u32 ) -> @builtin(position) vec4 { var pos = array, 3>( @@ -45,7 +45,7 @@ void init() { WGPUShaderModule vsModule = utils::CreateShaderModule(device, vs).Release(); const char* fs = R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"; WGPUShaderModule fsModule = utils::CreateShaderModule(device, fs).Release(); diff --git a/src/dawn/samples/CMakeLists.txt b/src/dawn/samples/CMakeLists.txt index 1a8e007dd9..9f358681b6 100644 --- a/src/dawn/samples/CMakeLists.txt +++ b/src/dawn/samples/CMakeLists.txt @@ -23,6 +23,7 @@ target_link_libraries(dawn_sample_utils PUBLIC dawncpp dawn_proc dawn_common + dawn_glfw dawn_native dawn_wire dawn_utils diff --git a/src/dawn/samples/ComputeBoids.cpp b/src/dawn/samples/ComputeBoids.cpp index 2652ebe73e..8237db41e3 100644 --- a/src/dawn/samples/ComputeBoids.cpp +++ b/src/dawn/samples/ComputeBoids.cpp @@ -102,7 +102,7 @@ void initRender() { @location(2) a_pos : vec2; }; - @stage(vertex) + @vertex fn main(input : VertexIn) -> @builtin(position) vec4 { var angle : f32 = -atan2(input.a_particleVel.x, input.a_particleVel.y); var pos : vec2 = vec2( @@ -113,7 +113,7 @@ void initRender() { )"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } @@ -170,7 +170,7 @@ void initSim() { @binding(2) @group(0) var particlesB : Particles; // https://github.com/austinEng/Project6-Vulkan-Flocking/blob/master/data/shaders/computeparticles/particle.comp - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var index : u32 = GlobalInvocationID.x; if (index >= params.particleCount) { diff --git a/src/dawn/samples/CppHelloTriangle.cpp b/src/dawn/samples/CppHelloTriangle.cpp index 66e1ec79d3..5202f0d473 100644 --- a/src/dawn/samples/CppHelloTriangle.cpp +++ b/src/dawn/samples/CppHelloTriangle.cpp @@ -95,7 +95,7 @@ void init() { initTextures(); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(@location(0) pos : vec4) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); @@ -104,7 +104,7 @@ void init() { @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture : texture_2d; - @stage(fragment) fn main(@builtin(position) FragCoord : vec4) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSample(myTexture, mySampler, FragCoord.xy / vec2(640.0, 480.0)); })"); diff --git a/src/dawn/samples/ManualSwapChainTest.cpp b/src/dawn/samples/ManualSwapChainTest.cpp index 397842d8a6..bed9f12124 100644 --- a/src/dawn/samples/ManualSwapChainTest.cpp +++ b/src/dawn/samples/ManualSwapChainTest.cpp @@ -63,10 +63,10 @@ #include "dawn/dawn_proc.h" #include "dawn/native/DawnNative.h" #include "dawn/utils/ComboRenderPipelineDescriptor.h" -#include "dawn/utils/GLFWUtils.h" #include "dawn/utils/ScopedAutoreleasePool.h" #include "dawn/utils/WGPUHelpers.h" #include "dawn/webgpu_cpp.h" +#include "webgpu/webgpu_glfw.h" struct WindowData { GLFWwindow* window = nullptr; @@ -123,7 +123,7 @@ void AddWindow() { std::unique_ptr data = std::make_unique(); data->window = window; data->serial = windowSerial++; - data->surface = utils::CreateSurfaceForWindow(instance->Get(), window); + data->surface = wgpu::glfw::CreateSurfaceForWindow(instance->Get(), window); data->currentDesc = descriptor; data->targetDesc = descriptor; SyncFromWindow(data.get()); @@ -316,7 +316,7 @@ int main(int argc, const char* argv[]) { // The hacky pipeline to render a triangle. utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2( 0.0, 0.5), @@ -326,7 +326,7 @@ int main(int argc, const char* argv[]) { return vec4(pos[VertexIndex], 0.0, 1.0); })"); pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); // BGRA shouldn't be hardcoded. Consider having a map[format -> pipeline]. diff --git a/src/dawn/samples/SampleUtils.cpp b/src/dawn/samples/SampleUtils.cpp index ac102a67d6..1aab2498d0 100644 --- a/src/dawn/samples/SampleUtils.cpp +++ b/src/dawn/samples/SampleUtils.cpp @@ -28,10 +28,10 @@ #include "dawn/dawn_proc.h" #include "dawn/dawn_wsi.h" #include "dawn/native/DawnNative.h" -#include "dawn/utils/GLFWUtils.h" #include "dawn/utils/TerribleCommandBuffer.h" #include "dawn/wire/WireClient.h" #include "dawn/wire/WireServer.h" +#include "webgpu/webgpu_glfw.h" void PrintDeviceError(WGPUErrorType errorType, const char* message, void*) { const char* errorTypeName = ""; @@ -103,8 +103,8 @@ wgpu::Device CreateCppDawnDevice() { return wgpu::Device(); } - // Create the test window and discover adapters using it (esp. for OpenGL) - utils::SetupGLFWWindowHintsForBackend(backendType); + // Create the test window with no client API. + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_FALSE); window = glfwCreateWindow(640, 480, "Dawn window", nullptr, nullptr); if (!window) { @@ -132,7 +132,7 @@ wgpu::Device CreateCppDawnDevice() { DawnProcTable backendProcs = dawn::native::GetProcs(); // Create the swapchain - auto surfaceChainedDesc = utils::SetupWindowAndGetSurfaceDescriptor(window); + auto surfaceChainedDesc = wgpu::glfw::SetupWindowAndGetSurfaceDescriptor(window); WGPUSurfaceDescriptor surfaceDesc; surfaceDesc.nextInChain = reinterpret_cast(surfaceChainedDesc.get()); WGPUSurface surface = backendProcs.instanceCreateSurface(instance->Get(), &surfaceDesc); diff --git a/src/dawn/tests/AdapterTestConfig.cpp b/src/dawn/tests/AdapterTestConfig.cpp new file mode 100644 index 0000000000..454b9b1495 --- /dev/null +++ b/src/dawn/tests/AdapterTestConfig.cpp @@ -0,0 +1,130 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/AdapterTestConfig.h" + +#include +#include +#include +#include + +#include "dawn/common/Assert.h" +#include "dawn/webgpu_cpp.h" + +BackendTestConfig::BackendTestConfig(wgpu::BackendType backendType, + std::initializer_list forceEnabledWorkarounds, + std::initializer_list forceDisabledWorkarounds) + : backendType(backendType), + forceEnabledWorkarounds(forceEnabledWorkarounds), + forceDisabledWorkarounds(forceDisabledWorkarounds) {} + +BackendTestConfig D3D12Backend(std::initializer_list forceEnabledWorkarounds, + std::initializer_list forceDisabledWorkarounds) { + return BackendTestConfig(wgpu::BackendType::D3D12, forceEnabledWorkarounds, + forceDisabledWorkarounds); +} + +BackendTestConfig MetalBackend(std::initializer_list forceEnabledWorkarounds, + std::initializer_list forceDisabledWorkarounds) { + return BackendTestConfig(wgpu::BackendType::Metal, forceEnabledWorkarounds, + forceDisabledWorkarounds); +} + +BackendTestConfig NullBackend(std::initializer_list forceEnabledWorkarounds, + std::initializer_list forceDisabledWorkarounds) { + return BackendTestConfig(wgpu::BackendType::Null, forceEnabledWorkarounds, + forceDisabledWorkarounds); +} + +BackendTestConfig OpenGLBackend(std::initializer_list forceEnabledWorkarounds, + std::initializer_list forceDisabledWorkarounds) { + return BackendTestConfig(wgpu::BackendType::OpenGL, forceEnabledWorkarounds, + forceDisabledWorkarounds); +} + +BackendTestConfig OpenGLESBackend(std::initializer_list forceEnabledWorkarounds, + std::initializer_list forceDisabledWorkarounds) { + return BackendTestConfig(wgpu::BackendType::OpenGLES, forceEnabledWorkarounds, + forceDisabledWorkarounds); +} + +BackendTestConfig VulkanBackend(std::initializer_list forceEnabledWorkarounds, + std::initializer_list forceDisabledWorkarounds) { + return BackendTestConfig(wgpu::BackendType::Vulkan, forceEnabledWorkarounds, + forceDisabledWorkarounds); +} + +TestAdapterProperties::TestAdapterProperties(const wgpu::AdapterProperties& properties, + bool selected) + : wgpu::AdapterProperties(properties), adapterName(properties.name), selected(selected) {} + +std::string TestAdapterProperties::ParamName() const { + switch (backendType) { + case wgpu::BackendType::D3D12: + return "D3D12"; + case wgpu::BackendType::Metal: + return "Metal"; + case wgpu::BackendType::Null: + return "Null"; + case wgpu::BackendType::OpenGL: + return "OpenGL"; + case wgpu::BackendType::OpenGLES: + return "OpenGLES"; + case wgpu::BackendType::Vulkan: + return "Vulkan"; + default: + UNREACHABLE(); + } +} + +std::string TestAdapterProperties::AdapterTypeName() const { + switch (adapterType) { + case wgpu::AdapterType::DiscreteGPU: + return "Discrete GPU"; + case wgpu::AdapterType::IntegratedGPU: + return "Integrated GPU"; + case wgpu::AdapterType::CPU: + return "CPU"; + case wgpu::AdapterType::Unknown: + return "Unknown"; + default: + UNREACHABLE(); + } +} + +AdapterTestParam::AdapterTestParam(const BackendTestConfig& config, + const TestAdapterProperties& adapterProperties) + : adapterProperties(adapterProperties), + forceEnabledWorkarounds(config.forceEnabledWorkarounds), + forceDisabledWorkarounds(config.forceDisabledWorkarounds) {} + +std::ostream& operator<<(std::ostream& os, const AdapterTestParam& param) { + os << param.adapterProperties.ParamName() << " " << param.adapterProperties.adapterName; + + // In a Windows Remote Desktop session there are two adapters named "Microsoft Basic Render + // Driver" with different adapter types. We must differentiate them to avoid any tests using the + // same name. + if (param.adapterProperties.deviceID == 0x008C) { + std::string adapterType = param.adapterProperties.AdapterTypeName(); + os << " " << adapterType; + } + + for (const char* forceEnabledWorkaround : param.forceEnabledWorkarounds) { + os << "; e:" << forceEnabledWorkaround; + } + for (const char* forceDisabledWorkaround : param.forceDisabledWorkarounds) { + os << "; d:" << forceDisabledWorkaround; + } + return os; +} diff --git a/src/dawn/tests/AdapterTestConfig.h b/src/dawn/tests/AdapterTestConfig.h new file mode 100644 index 0000000000..2e978ec673 --- /dev/null +++ b/src/dawn/tests/AdapterTestConfig.h @@ -0,0 +1,80 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_TESTS_ADAPTERTESTCONFIG_H_ +#define SRC_DAWN_TESTS_ADAPTERTESTCONFIG_H_ + +#include + +#include +#include +#include +#include + +#include "dawn/webgpu_cpp.h" + +struct BackendTestConfig { + BackendTestConfig(wgpu::BackendType backendType, + std::initializer_list forceEnabledWorkarounds = {}, + std::initializer_list forceDisabledWorkarounds = {}); + + wgpu::BackendType backendType; + + std::vector forceEnabledWorkarounds; + std::vector forceDisabledWorkarounds; +}; + +struct TestAdapterProperties : wgpu::AdapterProperties { + TestAdapterProperties(const wgpu::AdapterProperties& properties, bool selected); + std::string adapterName; + bool selected; + + std::string ParamName() const; + std::string AdapterTypeName() const; + + private: + // This may be temporary, so it is copied into |adapterName| and made private. + using wgpu::AdapterProperties::name; +}; + +struct AdapterTestParam { + AdapterTestParam(const BackendTestConfig& config, + const TestAdapterProperties& adapterProperties); + + TestAdapterProperties adapterProperties; + std::vector forceEnabledWorkarounds; + std::vector forceDisabledWorkarounds; +}; + +std::ostream& operator<<(std::ostream& os, const AdapterTestParam& param); + +BackendTestConfig D3D12Backend(std::initializer_list forceEnabledWorkarounds = {}, + std::initializer_list forceDisabledWorkarounds = {}); + +BackendTestConfig MetalBackend(std::initializer_list forceEnabledWorkarounds = {}, + std::initializer_list forceDisabledWorkarounds = {}); + +BackendTestConfig NullBackend(std::initializer_list forceEnabledWorkarounds = {}, + std::initializer_list forceDisabledWorkarounds = {}); + +BackendTestConfig OpenGLBackend(std::initializer_list forceEnabledWorkarounds = {}, + std::initializer_list forceDisabledWorkarounds = {}); + +BackendTestConfig OpenGLESBackend(std::initializer_list forceEnabledWorkarounds = {}, + std::initializer_list forceDisabledWorkarounds = {}); + +BackendTestConfig VulkanBackend(std::initializer_list forceEnabledWorkarounds = {}, + std::initializer_list forceDisabledWorkarounds = {}); + +#endif // SRC_DAWN_TESTS_ADAPTERTESTCONFIG_H_ diff --git a/src/dawn/tests/BUILD.gn b/src/dawn/tests/BUILD.gn index 59ec9f15b0..eb1ed6c186 100644 --- a/src/dawn/tests/BUILD.gn +++ b/src/dawn/tests/BUILD.gn @@ -157,19 +157,32 @@ source_set("native_mocks_sources") { configs += [ "${dawn_root}/src/dawn/native:internal" ] sources = [ + "unittests/native/mocks/BindGroupLayoutMock.cpp", "unittests/native/mocks/BindGroupLayoutMock.h", + "unittests/native/mocks/BindGroupMock.cpp", "unittests/native/mocks/BindGroupMock.h", + "unittests/native/mocks/BufferMock.cpp", + "unittests/native/mocks/BufferMock.h", + "unittests/native/mocks/CommandBufferMock.cpp", "unittests/native/mocks/CommandBufferMock.h", + "unittests/native/mocks/ComputePipelineMock.cpp", "unittests/native/mocks/ComputePipelineMock.h", "unittests/native/mocks/DeviceMock.h", + "unittests/native/mocks/ExternalTextureMock.cpp", "unittests/native/mocks/ExternalTextureMock.h", + "unittests/native/mocks/PipelineLayoutMock.cpp", "unittests/native/mocks/PipelineLayoutMock.h", + "unittests/native/mocks/QuerySetMock.cpp", "unittests/native/mocks/QuerySetMock.h", + "unittests/native/mocks/RenderPipelineMock.cpp", "unittests/native/mocks/RenderPipelineMock.h", + "unittests/native/mocks/SamplerMock.cpp", "unittests/native/mocks/SamplerMock.h", "unittests/native/mocks/ShaderModuleMock.cpp", "unittests/native/mocks/ShaderModuleMock.h", + "unittests/native/mocks/SwapChainMock.cpp", "unittests/native/mocks/SwapChainMock.h", + "unittests/native/mocks/TextureMock.cpp", "unittests/native/mocks/TextureMock.h", ] } @@ -179,6 +192,7 @@ dawn_test("dawn_unittests") { ":gmock_and_gtest", ":mock_webgpu_gen", ":native_mocks_sources", + ":platform_mocks_sources", "${dawn_root}/src/dawn:cpp", "${dawn_root}/src/dawn:proc", "${dawn_root}/src/dawn/common", @@ -191,6 +205,13 @@ dawn_test("dawn_unittests") { # Add internal dawn native config for internal unittests. configs = [ "${dawn_root}/src/dawn/native:internal" ] + # Add Tint public+common configs so can be included to test + # the Dawn/Tint boundary. + configs += [ + "${dawn_root}/src/tint:tint_public_config", + "${dawn_root}/src/tint:tint_common_config", + ] + sources = get_target_outputs(":mock_webgpu_gen") sources += [ "${dawn_root}/src/dawn/wire/client/ClientMemoryTransferService_mock.cpp", @@ -238,12 +259,13 @@ dawn_test("dawn_unittests") { "unittests/SystemUtilsTests.cpp", "unittests/ToBackendTests.cpp", "unittests/TypedIntegerTests.cpp", - "unittests/VersionTests.cpp", - "unittests/native/CacheKeyTests.cpp", + "unittests/native/BlobTests.cpp", + "unittests/native/CacheRequestTests.cpp", "unittests/native/CommandBufferEncodingTests.cpp", "unittests/native/CreatePipelineAsyncTaskTests.cpp", "unittests/native/DestroyObjectTests.cpp", "unittests/native/DeviceCreationTests.cpp", + "unittests/native/StreamTests.cpp", "unittests/validation/BindGroupValidationTests.cpp", "unittests/validation/BufferValidationTests.cpp", "unittests/validation/CommandBufferValidationTests.cpp", @@ -294,7 +316,6 @@ dawn_test("dawn_unittests") { "unittests/wire/WireBasicTests.cpp", "unittests/wire/WireBufferMappingTests.cpp", "unittests/wire/WireCreatePipelineAsyncTests.cpp", - "unittests/wire/WireDestroyObjectTests.cpp", "unittests/wire/WireDisconnectTests.cpp", "unittests/wire/WireErrorCallbackTests.cpp", "unittests/wire/WireExtensionTests.cpp", @@ -309,7 +330,6 @@ dawn_test("dawn_unittests") { "unittests/wire/WireShaderModuleTests.cpp", "unittests/wire/WireTest.cpp", "unittests/wire/WireTest.h", - "unittests/wire/WireWGPUDevicePropertiesTests.cpp", ] if (is_win) { @@ -351,10 +371,12 @@ source_set("test_infra_sources") { if (dawn_supports_glfw_for_windowing || dawn_enable_opengl) { assert(dawn_supports_glfw_for_windowing) - public_deps += [ "${dawn_root}/src/dawn/utils:glfw" ] + public_deps += [ "${dawn_root}/src/dawn/glfw" ] } sources = [ + "AdapterTestConfig.cpp", + "AdapterTestConfig.h", "DawnTest.cpp", "DawnTest.h", "MockCallback.h", @@ -368,20 +390,21 @@ source_set("test_infra_sources") { # Dawn end2end tests targets ############################################################################### -# Source code for mocks used for end2end testing are separated from the rest of +# Source code for mocks used for platform testing are separated from the rest of # sources so that they aren't included in non-test builds. -source_set("end2end_mocks_sources") { +source_set("platform_mocks_sources") { configs += [ "${dawn_root}/src/dawn/native:internal" ] testonly = true deps = [ ":gmock_and_gtest", + "${dawn_root}/src/dawn/common", "${dawn_root}/src/dawn/platform", ] sources = [ - "end2end/mocks/CachingInterfaceMock.cpp", - "end2end/mocks/CachingInterfaceMock.h", + "mocks/platform/CachingInterfaceMock.cpp", + "mocks/platform/CachingInterfaceMock.h", ] } @@ -389,7 +412,7 @@ source_set("end2end_tests_sources") { testonly = true deps = [ - ":end2end_mocks_sources", + ":platform_mocks_sources", ":test_infra_sources", "${dawn_root}/src/dawn:cpp", "${dawn_root}/src/dawn:proc", @@ -427,6 +450,7 @@ source_set("end2end_tests_sources") { "end2end/DepthStencilStateTests.cpp", "end2end/DestroyTests.cpp", "end2end/DeviceInitializationTests.cpp", + "end2end/DeviceLifetimeTests.cpp", "end2end/DeviceLostTests.cpp", "end2end/DrawIndexedIndirectTests.cpp", "end2end/DrawIndexedTests.cpp", @@ -434,6 +458,7 @@ source_set("end2end_tests_sources") { "end2end/DrawTests.cpp", "end2end/DynamicBufferOffsetTests.cpp", "end2end/EntryPointTests.cpp", + "end2end/ExperimentalDP4aTests.cpp", "end2end/ExternalTextureTests.cpp", "end2end/FirstIndexOffsetTests.cpp", "end2end/GpuMemorySynchronizationTests.cpp", @@ -467,6 +492,7 @@ source_set("end2end_tests_sources") { "end2end/StorageTextureTests.cpp", "end2end/SubresourceRenderAttachmentTests.cpp", "end2end/Texture3DTests.cpp", + "end2end/TextureCorruptionTests.cpp", "end2end/TextureFormatTests.cpp", "end2end/TextureSubresourceTests.cpp", "end2end/TextureViewTests.cpp", @@ -478,12 +504,6 @@ source_set("end2end_tests_sources") { "end2end/ViewportTests.cpp", ] - # Validation tests that need OS windows live in end2end tests. - sources += [ - "unittests/validation/ValidationTest.cpp", - "unittests/validation/ValidationTest.h", - ] - libs = [] if (dawn_enable_d3d12) { @@ -588,9 +608,9 @@ source_set("white_box_tests_sources") { sources += [ "white_box/MetalAutoreleasePoolTests.mm" ] } - if (dawn_enable_opengles && defined(dawn_angle_dir)) { + if (dawn_enable_opengles) { sources += [ "white_box/EGLImageWrappingTests.cpp" ] - deps += [ "${dawn_angle_dir}:libEGL" ] + include_dirs = [ "//third_party/khronos" ] } libs = [] diff --git a/src/dawn/tests/DawnNativeTest.cpp b/src/dawn/tests/DawnNativeTest.cpp index c07c5c27d8..fbf8030ab3 100644 --- a/src/dawn/tests/DawnNativeTest.cpp +++ b/src/dawn/tests/DawnNativeTest.cpp @@ -20,6 +20,9 @@ #include "dawn/common/Assert.h" #include "dawn/dawn_proc.h" #include "dawn/native/ErrorData.h" +#include "dawn/native/Instance.h" +#include "dawn/native/dawn_platform.h" +#include "dawn/platform/DawnPlatform.h" namespace dawn::native { @@ -43,6 +46,9 @@ DawnNativeTest::~DawnNativeTest() { void DawnNativeTest::SetUp() { instance = std::make_unique(); + platform = CreateTestPlatform(); + dawn::native::FromAPI(instance->Get())->SetPlatformForTesting(platform.get()); + instance->DiscoverDefaultAdapters(); std::vector adapters = instance->GetAdapters(); @@ -62,11 +68,13 @@ void DawnNativeTest::SetUp() { ASSERT(foundNullAdapter); - device = wgpu::Device(CreateTestDevice()); + device = wgpu::Device::Acquire(CreateTestDevice()); device.SetUncapturedErrorCallback(DawnNativeTest::OnDeviceError, nullptr); } -void DawnNativeTest::TearDown() {} +std::unique_ptr DawnNativeTest::CreateTestPlatform() { + return nullptr; +} WGPUDevice DawnNativeTest::CreateTestDevice() { // Disabled disallowing unsafe APIs so we can test them. diff --git a/src/dawn/tests/DawnNativeTest.h b/src/dawn/tests/DawnNativeTest.h index e92bf67f4a..dd3532f723 100644 --- a/src/dawn/tests/DawnNativeTest.h +++ b/src/dawn/tests/DawnNativeTest.h @@ -38,12 +38,13 @@ class DawnNativeTest : public ::testing::Test { ~DawnNativeTest() override; void SetUp() override; - void TearDown() override; + virtual std::unique_ptr CreateTestPlatform(); virtual WGPUDevice CreateTestDevice(); protected: std::unique_ptr instance; + std::unique_ptr platform; dawn::native::Adapter adapter; wgpu::Device device; diff --git a/src/dawn/tests/DawnTest.cpp b/src/dawn/tests/DawnTest.cpp index 816dbee89f..4cd35fdc44 100644 --- a/src/dawn/tests/DawnTest.cpp +++ b/src/dawn/tests/DawnTest.cpp @@ -50,46 +50,13 @@ namespace { -std::string ParamName(wgpu::BackendType type) { - switch (type) { - case wgpu::BackendType::D3D12: - return "D3D12"; - case wgpu::BackendType::Metal: - return "Metal"; - case wgpu::BackendType::Null: - return "Null"; - case wgpu::BackendType::OpenGL: - return "OpenGL"; - case wgpu::BackendType::OpenGLES: - return "OpenGLES"; - case wgpu::BackendType::Vulkan: - return "Vulkan"; - default: - UNREACHABLE(); - } -} - -const char* AdapterTypeName(wgpu::AdapterType type) { - switch (type) { - case wgpu::AdapterType::DiscreteGPU: - return "Discrete GPU"; - case wgpu::AdapterType::IntegratedGPU: - return "Integrated GPU"; - case wgpu::AdapterType::CPU: - return "CPU"; - case wgpu::AdapterType::Unknown: - return "Unknown"; - default: - UNREACHABLE(); - } -} - struct MapReadUserdata { DawnTestBase* test; size_t slot; }; DawnTestEnvironment* gTestEnv = nullptr; +DawnTestBase* gCurrentTest = nullptr; template void printBuffer(testing::AssertionResult& result, const T* buffer, const size_t count) { @@ -108,88 +75,6 @@ void printBuffer(testing::AssertionResult& result, const T* buffer, const size_t } // anonymous namespace -const RGBA8 RGBA8::kZero = RGBA8(0, 0, 0, 0); -const RGBA8 RGBA8::kBlack = RGBA8(0, 0, 0, 255); -const RGBA8 RGBA8::kRed = RGBA8(255, 0, 0, 255); -const RGBA8 RGBA8::kGreen = RGBA8(0, 255, 0, 255); -const RGBA8 RGBA8::kBlue = RGBA8(0, 0, 255, 255); -const RGBA8 RGBA8::kYellow = RGBA8(255, 255, 0, 255); -const RGBA8 RGBA8::kWhite = RGBA8(255, 255, 255, 255); - -BackendTestConfig::BackendTestConfig(wgpu::BackendType backendType, - std::initializer_list forceEnabledWorkarounds, - std::initializer_list forceDisabledWorkarounds) - : backendType(backendType), - forceEnabledWorkarounds(forceEnabledWorkarounds), - forceDisabledWorkarounds(forceDisabledWorkarounds) {} - -BackendTestConfig D3D12Backend(std::initializer_list forceEnabledWorkarounds, - std::initializer_list forceDisabledWorkarounds) { - return BackendTestConfig(wgpu::BackendType::D3D12, forceEnabledWorkarounds, - forceDisabledWorkarounds); -} - -BackendTestConfig MetalBackend(std::initializer_list forceEnabledWorkarounds, - std::initializer_list forceDisabledWorkarounds) { - return BackendTestConfig(wgpu::BackendType::Metal, forceEnabledWorkarounds, - forceDisabledWorkarounds); -} - -BackendTestConfig NullBackend(std::initializer_list forceEnabledWorkarounds, - std::initializer_list forceDisabledWorkarounds) { - return BackendTestConfig(wgpu::BackendType::Null, forceEnabledWorkarounds, - forceDisabledWorkarounds); -} - -BackendTestConfig OpenGLBackend(std::initializer_list forceEnabledWorkarounds, - std::initializer_list forceDisabledWorkarounds) { - return BackendTestConfig(wgpu::BackendType::OpenGL, forceEnabledWorkarounds, - forceDisabledWorkarounds); -} - -BackendTestConfig OpenGLESBackend(std::initializer_list forceEnabledWorkarounds, - std::initializer_list forceDisabledWorkarounds) { - return BackendTestConfig(wgpu::BackendType::OpenGLES, forceEnabledWorkarounds, - forceDisabledWorkarounds); -} - -BackendTestConfig VulkanBackend(std::initializer_list forceEnabledWorkarounds, - std::initializer_list forceDisabledWorkarounds) { - return BackendTestConfig(wgpu::BackendType::Vulkan, forceEnabledWorkarounds, - forceDisabledWorkarounds); -} - -TestAdapterProperties::TestAdapterProperties(const wgpu::AdapterProperties& properties, - bool selected) - : wgpu::AdapterProperties(properties), adapterName(properties.name), selected(selected) {} - -AdapterTestParam::AdapterTestParam(const BackendTestConfig& config, - const TestAdapterProperties& adapterProperties) - : adapterProperties(adapterProperties), - forceEnabledWorkarounds(config.forceEnabledWorkarounds), - forceDisabledWorkarounds(config.forceDisabledWorkarounds) {} - -std::ostream& operator<<(std::ostream& os, const AdapterTestParam& param) { - os << ParamName(param.adapterProperties.backendType) << " " - << param.adapterProperties.adapterName; - - // In a Windows Remote Desktop session there are two adapters named "Microsoft Basic Render - // Driver" with different adapter types. We must differentiate them to avoid any tests using the - // same name. - if (param.adapterProperties.deviceID == 0x008C) { - std::string adapterType = AdapterTypeName(param.adapterProperties.adapterType); - os << " " << adapterType; - } - - for (const char* forceEnabledWorkaround : param.forceEnabledWorkarounds) { - os << "; e:" << forceEnabledWorkaround; - } - for (const char* forceDisabledWorkaround : param.forceDisabledWorkarounds) { - os << "; d:" << forceDisabledWorkaround; - } - return os; -} - DawnTestBase::PrintToStringParamName::PrintToStringParamName(const char* test) : mTest(test) {} std::string DawnTestBase::PrintToStringParamName::SanitizeParamName(std::string paramName, @@ -313,6 +198,13 @@ void DawnTestEnvironment::ParseArgs(int argc, char** argv) { continue; } + constexpr const char kUseAngleArg[] = "--use-angle="; + argLen = sizeof(kUseAngleArg) - 1; + if (strncmp(argv[i], kUseAngleArg, argLen) == 0) { + mANGLEBackend = argv[i] + argLen; + continue; + } + constexpr const char kExclusiveDeviceTypePreferenceArg[] = "--exclusive-device-type-preference="; argLen = sizeof(kExclusiveDeviceTypePreferenceArg) - 1; @@ -414,66 +306,28 @@ std::unique_ptr DawnTestEnvironment::CreateInstanceAndDi auto instance = std::make_unique(); instance->EnableBeginCaptureOnStartup(mBeginCaptureOnStartup); instance->SetBackendValidationLevel(mBackendValidationLevel); - instance->DiscoverDefaultAdapters(); - -#ifdef DAWN_ENABLE_BACKEND_DESKTOP_GL - if (!glfwInit()) { - return instance; - } - glfwDefaultWindowHints(); - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - - mOpenGLWindow = glfwCreateWindow(400, 400, "Dawn OpenGL test window", nullptr, nullptr); - if (mOpenGLWindow != nullptr) { - glfwMakeContextCurrent(mOpenGLWindow); - dawn::native::opengl::AdapterDiscoveryOptions adapterOptions; - adapterOptions.getProc = reinterpret_cast(glfwGetProcAddress); - instance->DiscoverAdapters(&adapterOptions); - } -#endif // DAWN_ENABLE_BACKEND_DESKTOP_GL #ifdef DAWN_ENABLE_BACKEND_OPENGLES - - ScopedEnvironmentVar angleDefaultPlatform; if (GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").first.empty()) { - angleDefaultPlatform.Set("ANGLE_DEFAULT_PLATFORM", "swiftshader"); - } - - if (!glfwInit()) { - return instance; - } - glfwDefaultWindowHints(); - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); - glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); - glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - - mOpenGLESWindow = glfwCreateWindow(400, 400, "Dawn OpenGLES test window", nullptr, nullptr); - if (mOpenGLESWindow != nullptr) { - glfwMakeContextCurrent(mOpenGLESWindow); - dawn::native::opengl::AdapterDiscoveryOptionsES adapterOptionsES; - adapterOptionsES.getProc = reinterpret_cast(glfwGetProcAddress); - instance->DiscoverAdapters(&adapterOptionsES); - glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); + const char* platform; + if (!mANGLEBackend.empty()) { + platform = mANGLEBackend.c_str(); + } else { +#if DAWN_PLATFORM_IS(WINDOWS) + platform = "d3d11"; +#else + platform = "swiftshader"; +#endif + } + SetEnvironmentVar("ANGLE_DEFAULT_PLATFORM", platform); } #endif // DAWN_ENABLE_BACKEND_OPENGLES + instance->DiscoverDefaultAdapters(); + return instance; } -GLFWwindow* DawnTestEnvironment::GetOpenGLWindow() const { - return mOpenGLWindow; -} - -GLFWwindow* DawnTestEnvironment::GetOpenGLESWindow() const { - return mOpenGLESWindow; -} - void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn::native::Instance* instance) { // Get the first available preferred device type. wgpu::AdapterType preferredDeviceType = static_cast(-1); @@ -533,6 +387,16 @@ void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn::native::I (properties.backendType == wgpu::BackendType::Null); } +#if DAWN_PLATFORM_IS(WINDOWS) + if (selected && !mRunSuppressedTests && + properties.backendType == wgpu::BackendType::Vulkan && + gpu_info::IsIntel(properties.vendorID)) { + dawn::WarningLog() + << "Deselecting Windows Intel Vulkan adapter. See https://crbug.com/1338622."; + selected &= false; + } +#endif + // In Windows Remote Desktop sessions we may be able to discover multiple adapters that // have the same name and backend type. We will just choose one adapter from them in our // tests. @@ -627,10 +491,15 @@ void DawnTestEnvironment::PrintTestConfigurationAndAdapterInfo( << " - \"" << properties.adapterName << "\" - \"" << properties.driverDescription << "\"\n" - << " type: " << AdapterTypeName(properties.adapterType) - << ", backend: " << ParamName(properties.backendType) << "\n" + << " type: " << properties.AdapterTypeName() + << ", backend: " << properties.ParamName() << "\n" << " vendorId: 0x" << vendorId.str() << ", deviceId: 0x" << deviceId.str() << (properties.selected ? " [Selected]" : "") << "\n"; + + if (strlen(properties.vendorName) || strlen(properties.architecture)) { + log << " vendorName: " << properties.vendorName + << ", architecture: " << properties.architecture << "\n"; + } } } @@ -694,15 +563,68 @@ const std::vector& DawnTestEnvironment::GetDisabledToggles() const // Implementation of DawnTest -DawnTestBase::DawnTestBase(const AdapterTestParam& param) - : mParam(param), - mWireHelper(utils::CreateWireHelper(gTestEnv->UsesWire(), gTestEnv->GetWireTraceDir())) {} +DawnTestBase::DawnTestBase(const AdapterTestParam& param) : mParam(param) { + gCurrentTest = this; + + DawnProcTable procs = dawn::native::GetProcs(); + // Override procs to provide harness-specific behavior to always select the null adapter, + // and to allow fixture-specific overriding of the test device with CreateDeviceImpl. + procs.instanceRequestAdapter = [](WGPUInstance instance, const WGPURequestAdapterOptions*, + WGPURequestAdapterCallback callback, void* userdata) { + ASSERT(gCurrentTest); + + // Find the adapter that exactly matches our adapter properties. + const auto& adapters = gTestEnv->GetInstance()->GetAdapters(); + const auto& it = std::find_if( + adapters.begin(), adapters.end(), [&](const dawn::native::Adapter& adapter) { + wgpu::AdapterProperties properties; + adapter.GetProperties(&properties); + + const auto& param = gCurrentTest->mParam; + return (param.adapterProperties.selected && + properties.deviceID == param.adapterProperties.deviceID && + properties.vendorID == param.adapterProperties.vendorID && + properties.adapterType == param.adapterProperties.adapterType && + properties.backendType == param.adapterProperties.backendType && + strcmp(properties.name, param.adapterProperties.adapterName.c_str()) == 0); + }); + ASSERT(it != adapters.end()); + gCurrentTest->mBackendAdapter = *it; + + WGPUAdapter cAdapter = it->Get(); + ASSERT(cAdapter); + dawn::native::GetProcs().adapterReference(cAdapter); + callback(WGPURequestAdapterStatus_Success, cAdapter, nullptr, userdata); + }; + + procs.adapterRequestDevice = [](WGPUAdapter adapter, const WGPUDeviceDescriptor*, + WGPURequestDeviceCallback callback, void* userdata) { + ASSERT(gCurrentTest); + + // Isolation keys may be enqueued by CreateDevice(std::string isolationKey). + // CreateDevice calls requestAdapter, so consume them there and forward them + // to CreateDeviceImpl. + std::string isolationKey; + if (!gCurrentTest->mNextIsolationKeyQueue.empty()) { + isolationKey = std::move(gCurrentTest->mNextIsolationKeyQueue.front()); + gCurrentTest->mNextIsolationKeyQueue.pop(); + } + WGPUDevice cDevice = gCurrentTest->CreateDeviceImpl(std::move(isolationKey)); + ASSERT(cDevice != nullptr); + + gCurrentTest->mLastCreatedBackendDevice = cDevice; + callback(WGPURequestDeviceStatus_Success, cDevice, nullptr, userdata); + }; + + mWireHelper = utils::CreateWireHelper(procs, gTestEnv->UsesWire(), gTestEnv->GetWireTraceDir()); +} DawnTestBase::~DawnTestBase() { - // We need to destroy child objects before the Device mReadbackSlots.clear(); - queue = wgpu::Queue(); - device = wgpu::Device(); + queue = nullptr; + device = nullptr; + mAdapter = nullptr; + mInstance = nullptr; // D3D12's GPU-based validation will accumulate objects over time if the backend device is not // destroyed and recreated, so we reset it here. @@ -710,6 +632,11 @@ DawnTestBase::~DawnTestBase() { mBackendAdapter.ResetInternalDeviceForTesting(); } mWireHelper.reset(); + + // Check that all devices were destructed. + EXPECT_EQ(gTestEnv->GetInstance()->GetDeviceCountForTesting(), 0u); + + gCurrentTest = nullptr; } bool DawnTestBase::IsD3D12() const { @@ -761,8 +688,8 @@ bool DawnTestBase::IsQualcomm() const { } bool DawnTestBase::IsSwiftshader() const { - return gpu_info::IsSwiftshader(mParam.adapterProperties.vendorID, - mParam.adapterProperties.deviceID); + return gpu_info::IsGoogleSwiftshader(mParam.adapterProperties.vendorID, + mParam.adapterProperties.deviceID); } bool DawnTestBase::IsANGLE() const { @@ -770,11 +697,12 @@ bool DawnTestBase::IsANGLE() const { } bool DawnTestBase::IsWARP() const { - return gpu_info::IsWARP(mParam.adapterProperties.vendorID, mParam.adapterProperties.deviceID); + return gpu_info::IsMicrosoftWARP(mParam.adapterProperties.vendorID, + mParam.adapterProperties.deviceID); } bool DawnTestBase::IsWindows() const { -#ifdef DAWN_PLATFORM_WINDOWS +#if DAWN_PLATFORM_IS(WINDOWS) return true; #else return false; @@ -782,7 +710,7 @@ bool DawnTestBase::IsWindows() const { } bool DawnTestBase::IsLinux() const { -#ifdef DAWN_PLATFORM_LINUX +#if DAWN_PLATFORM_IS(LINUX) return true; #else return false; @@ -790,7 +718,7 @@ bool DawnTestBase::IsLinux() const { } bool DawnTestBase::IsMacOS(int32_t majorVersion, int32_t minorVersion) const { -#ifdef DAWN_PLATFORM_MACOS +#if DAWN_PLATFORM_IS(MACOS) if (majorVersion == -1 && minorVersion == -1) { return true; } @@ -811,6 +739,10 @@ bool DawnTestBase::IsBackendValidationEnabled() const { return gTestEnv->GetBackendValidationLevel() != dawn::native::BackendValidationLevel::Disabled; } +bool DawnTestBase::IsFullBackendValidationEnabled() const { + return gTestEnv->GetBackendValidationLevel() == dawn::native::BackendValidationLevel::Full; +} + bool DawnTestBase::RunSuppressedTests() const { return gTestEnv->RunSuppressedTests(); } @@ -871,10 +803,9 @@ const wgpu::AdapterProperties& DawnTestBase::GetAdapterProperties() const { } wgpu::SupportedLimits DawnTestBase::GetSupportedLimits() { - WGPUSupportedLimits supportedLimits; - supportedLimits.nextInChain = nullptr; - dawn::native::GetProcs().deviceGetLimits(backendDevice, &supportedLimits); - return *reinterpret_cast(&supportedLimits); + wgpu::SupportedLimits supportedLimits = {}; + device.GetLimits(&supportedLimits); + return supportedLimits; } bool DawnTestBase::SupportsFeatures(const std::vector& features) { @@ -899,10 +830,7 @@ bool DawnTestBase::SupportsFeatures(const std::vector& featur return true; } -std::pair DawnTestBase::CreateDeviceImpl(std::string isolationKey) { - // TODO(dawn:1399) Always flush wire before creating to avoid reuse of the same handle. - FlushWire(); - +WGPUDevice DawnTestBase::CreateDeviceImpl(std::string isolationKey) { // Create the device from the adapter for (const char* forceEnabledWorkaround : mParam.forceEnabledWorkarounds) { ASSERT(gTestEnv->GetInstance()->GetToggleInfo(forceEnabledWorkaround) != nullptr); @@ -953,13 +881,38 @@ std::pair DawnTestBase::CreateDeviceImpl(std::string i togglesDesc.nextInChain = &cacheDesc; cacheDesc.isolationKey = isolationKey.c_str(); - auto devices = mWireHelper->RegisterDevice(mBackendAdapter.CreateDevice(&deviceDescriptor)); - wgpu::Device device = devices.first; - device.SetUncapturedErrorCallback(mDeviceErrorCallback.Callback(), - mDeviceErrorCallback.MakeUserdata(device.Get())); - device.SetDeviceLostCallback(mDeviceLostCallback.Callback(), - mDeviceLostCallback.MakeUserdata(device.Get())); - device.SetLoggingCallback( + return mBackendAdapter.CreateDevice(&deviceDescriptor); +} + +wgpu::Device DawnTestBase::CreateDevice(std::string isolationKey) { + wgpu::Device apiDevice; + + // The isolation key will be consumed inside adapterRequestDevice and passed + // to CreateDeviceImpl. + mNextIsolationKeyQueue.push(std::move(isolationKey)); + + // This descriptor doesn't matter since device selection is overriden by CreateDeviceImpl. + wgpu::DeviceDescriptor deviceDesc = {}; + mAdapter.RequestDevice( + &deviceDesc, + [](WGPURequestDeviceStatus, WGPUDevice cDevice, const char*, void* userdata) { + *static_cast(userdata) = wgpu::Device::Acquire(cDevice); + }, + &apiDevice); + FlushWire(); + ASSERT(apiDevice); + + // Set up the mocks for uncaptured errors and device loss. The loss of the device is expected + // to happen at the end of the test so at it directly. + apiDevice.SetUncapturedErrorCallback(mDeviceErrorCallback.Callback(), + mDeviceErrorCallback.MakeUserdata(apiDevice.Get())); + apiDevice.SetDeviceLostCallback(mDeviceLostCallback.Callback(), + mDeviceLostCallback.MakeUserdata(apiDevice.Get())); + EXPECT_CALL(mDeviceLostCallback, + Call(WGPUDeviceLostReason_Destroyed, testing::_, apiDevice.Get())) + .Times(testing::AtMost(1)); + + apiDevice.SetLoggingCallback( [](WGPULoggingType type, char const* message, void*) { switch (type) { case WGPULoggingType_Verbose: @@ -977,106 +930,73 @@ std::pair DawnTestBase::CreateDeviceImpl(std::string i } }, nullptr); - return devices; -} -wgpu::Device DawnTestBase::CreateDevice(std::string isolationKey) { - return CreateDeviceImpl(isolationKey).first; + return apiDevice; } void DawnTestBase::SetUp() { - { - // Find the adapter that exactly matches our adapter properties. - const auto& adapters = gTestEnv->GetInstance()->GetAdapters(); - const auto& it = std::find_if( - adapters.begin(), adapters.end(), [&](const dawn::native::Adapter& adapter) { - wgpu::AdapterProperties properties; - adapter.GetProperties(&properties); - - return (mParam.adapterProperties.selected && - properties.deviceID == mParam.adapterProperties.deviceID && - properties.vendorID == mParam.adapterProperties.vendorID && - properties.adapterType == mParam.adapterProperties.adapterType && - properties.backendType == mParam.adapterProperties.backendType && - strcmp(properties.name, mParam.adapterProperties.adapterName.c_str()) == 0); - }); - ASSERT(it != adapters.end()); - mBackendAdapter = *it; - } - // Setup the per-test platform. Tests can provide one by overloading CreateTestPlatform. This is // NOT a thread-safe operation and is allowed here for testing only. mTestPlatform = CreateTestPlatform(); dawn::native::FromAPI(gTestEnv->GetInstance()->Get()) ->SetPlatformForTesting(mTestPlatform.get()); + mInstance = mWireHelper->RegisterInstance(gTestEnv->GetInstance()->Get()); + std::string traceName = std::string(::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name()) + "_" + ::testing::UnitTest::GetInstance()->current_test_info()->name(); mWireHelper->BeginWireTrace(traceName.c_str()); - // Create the device from the adapter - std::tie(device, backendDevice) = CreateDeviceImpl(); - ASSERT_NE(nullptr, backendDevice); + // These options are unused since adapter selection is overriden to use the test params + wgpu::RequestAdapterOptions options = {}; + mInstance.RequestAdapter( + &options, + [](WGPURequestAdapterStatus, WGPUAdapter cAdapter, const char*, void* userdata) { + *static_cast(userdata) = wgpu::Adapter::Acquire(cAdapter); + }, + &mAdapter); + FlushWire(); + ASSERT(mAdapter); + + device = CreateDevice(); + backendDevice = mLastCreatedBackendDevice; + ASSERT(backendDevice); + ASSERT(device); queue = device.GetQueue(); - -#if defined(DAWN_ENABLE_BACKEND_DESKTOP_GL) - if (IsOpenGL()) { - glfwMakeContextCurrent(gTestEnv->GetOpenGLWindow()); - } -#endif // defined(DAWN_ENABLE_BACKEND_DESKTOP_GL) -#if defined(DAWN_ENABLE_BACKEND_OPENGLES) - if (IsOpenGLES()) { - glfwMakeContextCurrent(gTestEnv->GetOpenGLESWindow()); - } -#endif // defined(DAWN_ENABLE_BACKEND_OPENGLES) } void DawnTestBase::TearDown() { - FlushWire(); + ResolveDeferredExpectationsNow(); - MapSlotsSynchronously(); - ResolveExpectations(); - - for (size_t i = 0; i < mReadbackSlots.size(); ++i) { - mReadbackSlots[i].buffer.Unmap(); - } - - if (!UsesWire()) { + if (!UsesWire() && device) { EXPECT_EQ(mLastWarningCount, dawn::native::GetDeprecationWarningCountForTesting(device.Get())); } } void DawnTestBase::DestroyDevice(wgpu::Device device) { - wgpu::Device resolvedDevice; - if (device != nullptr) { - resolvedDevice = device; - } else { + wgpu::Device resolvedDevice = device; + if (resolvedDevice == nullptr) { resolvedDevice = this->device; } - EXPECT_CALL(mDeviceLostCallback, - Call(WGPUDeviceLostReason_Destroyed, testing::_, resolvedDevice.Get())) - .Times(1); + + // No expectation is added because the expectations for this kind of destruction is set up as + // soon as the device is created. resolvedDevice.Destroy(); - FlushWire(); - testing::Mock::VerifyAndClearExpectations(&mDeviceLostCallback); } void DawnTestBase::LoseDeviceForTesting(wgpu::Device device) { - wgpu::Device resolvedDevice; - if (device != nullptr) { - resolvedDevice = device; - } else { + wgpu::Device resolvedDevice = device; + if (resolvedDevice == nullptr) { resolvedDevice = this->device; } + EXPECT_CALL(mDeviceLostCallback, Call(WGPUDeviceLostReason_Undefined, testing::_, resolvedDevice.Get())) .Times(1); resolvedDevice.LoseForTesting(); - FlushWire(); - testing::Mock::VerifyAndClearExpectations(&mDeviceLostCallback); } std::ostringstream& DawnTestBase::AddBufferExpectation(const char* file, @@ -1198,7 +1118,7 @@ std::ostringstream& DawnTestBase::ExpectSampledFloatDataImpl(wgpu::TextureView t } } shaderSource << R"( - @stage(compute) @workgroup_size(1) fn main( + @compute @workgroup_size(1) fn main( @builtin(global_invocation_id) GlobalInvocationId : vec3 ) { let baseOutIndex = GlobalInvocationId.y * width + GlobalInvocationId.x; @@ -1342,7 +1262,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData( utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, -1.0), @@ -1362,7 +1282,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData( @builtin(frag_depth) fragDepth : f32, } - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> FragmentOut { var output : FragmentOut; output.result = 1u; @@ -1371,7 +1291,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData( })"); } else { pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main() -> @location(0) u32 { return 1u; })"); @@ -1438,7 +1358,9 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData( } void DawnTestBase::WaitABit() { - device.Tick(); + if (device) { + device.Tick(); + } FlushWire(); utils::USleep(100); @@ -1560,27 +1482,34 @@ std::unique_ptr DawnTestBase::CreateTestPlatform() { return nullptr; } -bool RGBA8::operator==(const RGBA8& other) const { +void DawnTestBase::ResolveDeferredExpectationsNow() { + FlushWire(); + + MapSlotsSynchronously(); + ResolveExpectations(); + + mDeferredExpectations.clear(); + for (size_t i = 0; i < mReadbackSlots.size(); ++i) { + mReadbackSlots[i].buffer.Unmap(); + } +} + +bool utils::RGBA8::operator==(const utils::RGBA8& other) const { return r == other.r && g == other.g && b == other.b && a == other.a; } -bool RGBA8::operator!=(const RGBA8& other) const { +bool utils::RGBA8::operator!=(const utils::RGBA8& other) const { return !(*this == other); } -bool RGBA8::operator<=(const RGBA8& other) const { +bool utils::RGBA8::operator<=(const utils::RGBA8& other) const { return (r <= other.r && g <= other.g && b <= other.b && a <= other.a); } -bool RGBA8::operator>=(const RGBA8& other) const { +bool utils::RGBA8::operator>=(const utils::RGBA8& other) const { return (r >= other.r && g >= other.g && b >= other.b && a >= other.a); } -std::ostream& operator<<(std::ostream& stream, const RGBA8& color) { - return stream << "RGBA8(" << static_cast(color.r) << ", " << static_cast(color.g) - << ", " << static_cast(color.b) << ", " << static_cast(color.a) << ")"; -} - namespace detail { std::vector GetAvailableAdapterTestParamsForBackends( const BackendTestConfig* params, @@ -1673,7 +1602,7 @@ template class ExpectEq; template class ExpectEq; template class ExpectEq; template class ExpectEq; -template class ExpectEq; +template class ExpectEq; template class ExpectEq; template class ExpectEq; @@ -1730,5 +1659,5 @@ testing::AssertionResult ExpectBetweenColors::Check(const void* data, size_t return testing::AssertionSuccess(); } -template class ExpectBetweenColors; +template class ExpectBetweenColors; } // namespace detail diff --git a/src/dawn/tests/DawnTest.h b/src/dawn/tests/DawnTest.h index bcd83e4be6..d374652a37 100644 --- a/src/dawn/tests/DawnTest.h +++ b/src/dawn/tests/DawnTest.h @@ -16,6 +16,7 @@ #define SRC_DAWN_TESTS_DAWNTEST_H_ #include +#include #include #include #include @@ -27,10 +28,12 @@ #include "dawn/dawn_proc_table.h" #include "dawn/native/DawnNative.h" #include "dawn/platform/DawnPlatform.h" +#include "dawn/tests/AdapterTestConfig.h" #include "dawn/tests/MockCallback.h" #include "dawn/tests/ParamGenerator.h" #include "dawn/tests/ToggleParser.h" #include "dawn/utils/ScopedAutoreleasePool.h" +#include "dawn/utils/TestUtils.h" #include "dawn/utils/TextureUtils.h" #include "dawn/webgpu_cpp.h" #include "dawn/webgpu_cpp_print.h" @@ -119,76 +122,6 @@ #define ASSERT_DEVICE_ERROR(statement) ASSERT_DEVICE_ERROR_MSG(statement, testing::_) -struct RGBA8 { - constexpr RGBA8() : RGBA8(0, 0, 0, 0) {} - constexpr RGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a) : r(r), g(g), b(b), a(a) {} - bool operator==(const RGBA8& other) const; - bool operator!=(const RGBA8& other) const; - bool operator<=(const RGBA8& other) const; - bool operator>=(const RGBA8& other) const; - - uint8_t r, g, b, a; - - static const RGBA8 kZero; - static const RGBA8 kBlack; - static const RGBA8 kRed; - static const RGBA8 kGreen; - static const RGBA8 kBlue; - static const RGBA8 kYellow; - static const RGBA8 kWhite; -}; -std::ostream& operator<<(std::ostream& stream, const RGBA8& color); - -struct BackendTestConfig { - BackendTestConfig(wgpu::BackendType backendType, - std::initializer_list forceEnabledWorkarounds = {}, - std::initializer_list forceDisabledWorkarounds = {}); - - wgpu::BackendType backendType; - - std::vector forceEnabledWorkarounds; - std::vector forceDisabledWorkarounds; -}; - -struct TestAdapterProperties : wgpu::AdapterProperties { - TestAdapterProperties(const wgpu::AdapterProperties& properties, bool selected); - std::string adapterName; - bool selected; - - private: - // This may be temporary, so it is copied into |adapterName| and made private. - using wgpu::AdapterProperties::name; -}; - -struct AdapterTestParam { - AdapterTestParam(const BackendTestConfig& config, - const TestAdapterProperties& adapterProperties); - - TestAdapterProperties adapterProperties; - std::vector forceEnabledWorkarounds; - std::vector forceDisabledWorkarounds; -}; - -std::ostream& operator<<(std::ostream& os, const AdapterTestParam& param); - -BackendTestConfig D3D12Backend(std::initializer_list forceEnabledWorkarounds = {}, - std::initializer_list forceDisabledWorkarounds = {}); - -BackendTestConfig MetalBackend(std::initializer_list forceEnabledWorkarounds = {}, - std::initializer_list forceDisabledWorkarounds = {}); - -BackendTestConfig NullBackend(std::initializer_list forceEnabledWorkarounds = {}, - std::initializer_list forceDisabledWorkarounds = {}); - -BackendTestConfig OpenGLBackend(std::initializer_list forceEnabledWorkarounds = {}, - std::initializer_list forceDisabledWorkarounds = {}); - -BackendTestConfig OpenGLESBackend(std::initializer_list forceEnabledWorkarounds = {}, - std::initializer_list forceDisabledWorkarounds = {}); - -BackendTestConfig VulkanBackend(std::initializer_list forceEnabledWorkarounds = {}, - std::initializer_list forceDisabledWorkarounds = {}); - struct GLFWwindow; namespace utils { @@ -257,6 +190,7 @@ class DawnTestEnvironment : public testing::Environment { bool mUseWire = false; dawn::native::BackendValidationLevel mBackendValidationLevel = dawn::native::BackendValidationLevel::Disabled; + std::string mANGLEBackend; bool mBeginCaptureOnStartup = false; bool mHasVendorIdFilter = false; uint32_t mVendorIdFilter = 0; @@ -271,8 +205,6 @@ class DawnTestEnvironment : public testing::Environment { std::vector mAdapterProperties; std::unique_ptr mPlatformDebugLogger; - GLFWwindow* mOpenGLWindow; - GLFWwindow* mOpenGLESWindow; }; class DawnTestBase { @@ -308,6 +240,7 @@ class DawnTestBase { bool UsesWire() const; bool IsBackendValidationEnabled() const; + bool IsFullBackendValidationEnabled() const; bool RunSuppressedTests() const; bool IsDXC() const; @@ -342,6 +275,10 @@ class DawnTestBase { std::string mTest; }; + // Resolve all the deferred expectations in mDeferredExpectations now to avoid letting + // mDeferredExpectations get too big. + void ResolveDeferredExpectationsNow(); + protected: wgpu::Device device; wgpu::Queue queue; @@ -351,10 +288,11 @@ class DawnTestBase { size_t mLastWarningCount = 0; - // Mock callbacks tracking errors and destruction. Device lost is a nice mock since tests that - // do not care about device destruction can ignore the callback entirely. - testing::MockCallback mDeviceErrorCallback; - testing::NiceMock> mDeviceLostCallback; + // Mock callbacks tracking errors and destruction. These are strict mocks because any errors or + // device loss that aren't expected should result in test failures and not just some warnings + // printed to stdout. + testing::StrictMock> mDeviceErrorCallback; + testing::StrictMock> mDeviceLostCallback; // Helper methods to implement the EXPECT_ macros std::ostringstream& AddBufferExpectation(const char* file, @@ -533,18 +471,21 @@ class DawnTestBase { const wgpu::AdapterProperties& GetAdapterProperties() const; - // TODO(crbug.com/dawn/689): Use limits returned from the wire - // This is implemented here because tests need to always query - // the |backendDevice| since limits are not implemented in the wire. wgpu::SupportedLimits GetSupportedLimits(); private: utils::ScopedAutoreleasePool mObjCAutoreleasePool; AdapterTestParam mParam; std::unique_ptr mWireHelper; + wgpu::Instance mInstance; + wgpu::Adapter mAdapter; + + // Isolation keys are not exposed to the wire client. Device creation in the tests from + // the client first push the key into this queue, which is then consumed by the server. + std::queue mNextIsolationKeyQueue; // Internal device creation function for default device creation with some optional overrides. - std::pair CreateDeviceImpl(std::string isolationKey = ""); + WGPUDevice CreateDeviceImpl(std::string isolationKey); std::ostringstream& AddTextureExpectationImpl(const char* file, int line, @@ -605,6 +546,7 @@ class DawnTestBase { void ResolveExpectations(); dawn::native::Adapter mBackendAdapter; + WGPUDevice mLastCreatedBackendDevice; std::unique_ptr mTestPlatform; }; @@ -764,7 +706,7 @@ extern template class ExpectEq; extern template class ExpectEq; extern template class ExpectEq; extern template class ExpectEq; -extern template class ExpectEq; +extern template class ExpectEq; extern template class ExpectEq; extern template class ExpectEq; @@ -786,11 +728,11 @@ class ExpectBetweenColors : public Expectation { // A color is considered between color0 and color1 when all channel values are within range of // each counterparts. It doesn't matter which value is higher or lower. Essentially color = // lerp(color0, color1, t) where t is [0,1]. But I don't want to be too strict here. -extern template class ExpectBetweenColors; +extern template class ExpectBetweenColors; class CustomTextureExpectation : public Expectation { public: - virtual ~CustomTextureExpectation() = default; + ~CustomTextureExpectation() override = default; virtual uint32_t DataSize() = 0; }; diff --git a/src/dawn/tests/ParamGenerator.h b/src/dawn/tests/ParamGenerator.h index 4e6a6f3b8a..f6c314de1f 100644 --- a/src/dawn/tests/ParamGenerator.h +++ b/src/dawn/tests/ParamGenerator.h @@ -19,6 +19,8 @@ #include #include +#include "dawn/tests/AdapterTestConfig.h" + // ParamStruct is a custom struct which ParamStruct will yield when iterating. // The types Params... should be the same as the types passed to the constructor // of ParamStruct. @@ -116,9 +118,6 @@ class ParamGenerator { bool mIsEmpty; }; -struct BackendTestConfig; -struct AdapterTestParam; - namespace detail { std::vector GetAvailableAdapterTestParamsForBackends( const BackendTestConfig* params, diff --git a/src/dawn/tests/end2end/AdapterDiscoveryTests.cpp b/src/dawn/tests/end2end/AdapterDiscoveryTests.cpp index 6e85b6a345..7f3669a4fe 100644 --- a/src/dawn/tests/end2end/AdapterDiscoveryTests.cpp +++ b/src/dawn/tests/end2end/AdapterDiscoveryTests.cpp @@ -68,7 +68,7 @@ TEST(AdapterDiscoveryTests, OnlySwiftShader) { EXPECT_EQ(properties.backendType, wgpu::BackendType::Vulkan); EXPECT_EQ(properties.adapterType, wgpu::AdapterType::CPU); - EXPECT_TRUE(gpu_info::IsSwiftshader(properties.vendorID, properties.deviceID)); + EXPECT_TRUE(gpu_info::IsGoogleSwiftshader(properties.vendorID, properties.deviceID)); } } @@ -155,81 +155,6 @@ TEST(AdapterDiscoveryTests, OnlyMetal) { } #endif // defined(DAWN_ENABLE_BACKEND_METAL) -#if defined(DAWN_ENABLE_BACKEND_DESKTOP_GL) -// Test discovering only desktop OpenGL adapters -TEST(AdapterDiscoveryTests, OnlyDesktopGL) { - if (!glfwInit()) { - GTEST_SKIP() << "glfwInit() failed"; - } - glfwDefaultWindowHints(); - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - - GLFWwindow* window = glfwCreateWindow(400, 400, "Dawn OpenGL test window", nullptr, nullptr); - glfwMakeContextCurrent(window); - - dawn::native::Instance instance; - - dawn::native::opengl::AdapterDiscoveryOptions options; - options.getProc = reinterpret_cast(glfwGetProcAddress); - instance.DiscoverAdapters(&options); - glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); - - const auto& adapters = instance.GetAdapters(); - for (const auto& adapter : adapters) { - wgpu::AdapterProperties properties; - adapter.GetProperties(&properties); - - EXPECT_EQ(properties.backendType, wgpu::BackendType::OpenGL); - } - - glfwDestroyWindow(window); -} -#endif // defined(DAWN_ENABLE_BACKEND_DESKTOP_GL) - -#if defined(DAWN_ENABLE_BACKEND_OPENGLES) -// Test discovering only OpenGLES adapters -TEST(AdapterDiscoveryTests, OnlyOpenGLES) { - ScopedEnvironmentVar angleDefaultPlatform; - if (GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").first.empty()) { - angleDefaultPlatform.Set("ANGLE_DEFAULT_PLATFORM", "swiftshader"); - } - - if (!glfwInit()) { - GTEST_SKIP() << "glfwInit() failed"; - } - glfwDefaultWindowHints(); - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); - glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); - glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - - GLFWwindow* window = glfwCreateWindow(400, 400, "Dawn OpenGLES test window", nullptr, nullptr); - glfwMakeContextCurrent(window); - - dawn::native::Instance instance; - - dawn::native::opengl::AdapterDiscoveryOptionsES options; - options.getProc = reinterpret_cast(glfwGetProcAddress); - instance.DiscoverAdapters(&options); - glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); - - const auto& adapters = instance.GetAdapters(); - for (const auto& adapter : adapters) { - wgpu::AdapterProperties properties; - adapter.GetProperties(&properties); - - EXPECT_EQ(properties.backendType, wgpu::BackendType::OpenGLES); - } - - glfwDestroyWindow(window); -} -#endif // defined(DAWN_ENABLE_BACKEND_OPENGLES) - #if defined(DAWN_ENABLE_BACKEND_METAL) && defined(DAWN_ENABLE_BACKEND_VULKAN) // Test discovering the Metal backend, then the Vulkan backend // does not duplicate adapters. @@ -285,7 +210,7 @@ class AdapterCreationTest : public ::testing::Test { nativeAdapter.GetProperties(&properties); swiftShaderAvailable = swiftShaderAvailable || - gpu_info::IsSwiftshader(properties.vendorID, properties.deviceID); + gpu_info::IsGoogleSwiftshader(properties.vendorID, properties.deviceID); discreteGPUAvailable = discreteGPUAvailable || properties.adapterType == wgpu::AdapterType::DiscreteGPU; integratedGPUAvailable = integratedGPUAvailable || @@ -364,7 +289,7 @@ TEST_F(AdapterCreationTest, FallbackAdapter) { adapter.GetProperties(&properties); EXPECT_EQ(properties.adapterType, wgpu::AdapterType::CPU); - EXPECT_TRUE(gpu_info::IsSwiftshader(properties.vendorID, properties.deviceID)); + EXPECT_TRUE(gpu_info::IsGoogleSwiftshader(properties.vendorID, properties.deviceID)); } } diff --git a/src/dawn/tests/end2end/BindGroupTests.cpp b/src/dawn/tests/end2end/BindGroupTests.cpp index e9dfc6c88e..8a20bcd95c 100644 --- a/src/dawn/tests/end2end/BindGroupTests.cpp +++ b/src/dawn/tests/end2end/BindGroupTests.cpp @@ -54,7 +54,7 @@ class BindGroupTests : public DawnTest { wgpu::ShaderModule MakeSimpleVSModule() const { return utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -88,7 +88,7 @@ class BindGroupTests : public DawnTest { } } - fs << "\n@stage(fragment) fn main() -> @location(0) vec4{\n"; + fs << "\n@fragment fn main() -> @location(0) vec4{\n"; fs << "var fragColor : vec4 = vec4();\n"; for (size_t i = 0; i < bindingTypes.size(); ++i) { fs << "fragColor = fragColor + buffer" << i << ".color;\n"; @@ -137,7 +137,7 @@ TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) { } @group(0) @binding(0) var contents: Contents; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { var f : f32 = contents.f; })"); @@ -173,7 +173,7 @@ TEST_P(BindGroupTests, ReusedUBO) { @group(0) @binding(0) var vertexUbo : VertexUniformBuffer; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -190,7 +190,7 @@ TEST_P(BindGroupTests, ReusedUBO) { } @group(0) @binding(1) var fragmentUbo : FragmentUniformBuffer; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return fragmentUbo.color; })"); @@ -228,8 +228,8 @@ TEST_P(BindGroupTests, ReusedUBO) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); uint32_t min = 1, max = kRTSize - 3; EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min); @@ -250,7 +250,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { } @group(0) @binding(0) var vertexUbo : VertexUniformBuffer; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -265,7 +265,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { @group(0) @binding(1) var samp : sampler; @group(0) @binding(2) var tex : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSample(tex, samp, FragCoord.xy); })"); @@ -304,13 +304,13 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { wgpu::TextureView textureView = texture.CreateView(); uint32_t width = kRTSize, height = kRTSize; - uint32_t widthInBytes = width * sizeof(RGBA8); + uint32_t widthInBytes = width * sizeof(utils::RGBA8); widthInBytes = (widthInBytes + 255) & ~255; uint32_t sizeInBytes = widthInBytes * height; - uint32_t size = sizeInBytes / sizeof(RGBA8); - std::vector data = std::vector(size); + uint32_t size = sizeInBytes / sizeof(utils::RGBA8); + std::vector data = std::vector(size); for (uint32_t i = 0; i < size; i++) { - data[i] = RGBA8(0, 255, 0, 255); + data[i] = utils::RGBA8(0, 255, 0, 255); } wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), sizeInBytes, wgpu::BufferUsage::CopySrc); @@ -334,8 +334,8 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); uint32_t min = 1, max = kRTSize - 3; EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min); @@ -355,7 +355,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) { @group(0) @binding(0) var vertexUbo1 : VertexUniformBuffer; @group(1) @binding(0) var vertexUbo2 : VertexUniformBuffer; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -376,7 +376,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) { @group(0) @binding(1) var fragmentUbo1 : FragmentUniformBuffer; @group(1) @binding(1) var fragmentUbo2 : FragmentUniformBuffer; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return fragmentUbo1.color + fragmentUbo2.color; })"); @@ -422,8 +422,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 filled(255, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(255, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); uint32_t min = 1, max = kRTSize - 3; EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min); @@ -445,16 +445,16 @@ TEST_P(BindGroupTests, MultipleEntryPointsWithMultipleNonZeroGroups) { @group(1) @binding(0) var contents1: Contents; @group(2) @binding(0) var contents2: Contents; - @stage(compute) @workgroup_size(1) fn main0() { + @compute @workgroup_size(1) fn main0() { var a : f32 = contents0.f; } - @stage(compute) @workgroup_size(1) fn main1() { + @compute @workgroup_size(1) fn main1() { var a : f32 = contents1.f; var b : f32 = contents2.f; } - @stage(compute) @workgroup_size(1) fn main2() { + @compute @workgroup_size(1) fn main2() { var a : f32 = contents0.f; var b : f32 = contents1.f; var c : f32 = contents2.f; @@ -590,8 +590,8 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 filled(255, 0, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(255, 0, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); uint32_t min = 1, max = kRTSize - 3; EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min); @@ -632,8 +632,8 @@ TEST_P(BindGroupTests, SetBindGroupBeforePipeline) { queue.Submit(1, &commands); // The result should be red. - RGBA8 filled(255, 0, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(255, 0, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); uint32_t min = 1, max = kRTSize - 3; EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min); @@ -693,8 +693,8 @@ TEST_P(BindGroupTests, SetDynamicBindGroupBeforePipeline) { queue.Submit(1, &commands); // The result should be RGBAunorm(1, 0, 0, 0.5) + RGBAunorm(0, 1, 0, 0.5) - RGBA8 filled(255, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(255, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); uint32_t min = 1, max = kRTSize - 3; EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min); @@ -770,8 +770,8 @@ TEST_P(BindGroupTests, BindGroupsPersistAfterPipelineChange) { queue.Submit(1, &commands); // The result should be RGBAunorm(1, 0, 0, 0.5) + RGBAunorm(0, 1, 0, 0.5) - RGBA8 filled(255, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(255, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); uint32_t min = 1, max = kRTSize - 3; EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min); @@ -782,6 +782,9 @@ TEST_P(BindGroupTests, BindGroupsPersistAfterPipelineChange) { // Do a successful draw. Then, change the pipeline and one bind group. // Draw to check that the all bind groups are set. TEST_P(BindGroupTests, DrawThenChangePipelineAndBindGroup) { + // TODO(anglebug.com/3032): fix failure in ANGLE/D3D11 + DAWN_SUPPRESS_TEST_IF(IsANGLE() && IsWindows()); + utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); // Create a bind group layout which uses a single dynamic uniform buffer. @@ -875,8 +878,8 @@ TEST_P(BindGroupTests, DrawThenChangePipelineAndBindGroup) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 filled(255, 255, 255, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(255, 255, 255, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); uint32_t min = 1, max = kRTSize - 3; EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min); @@ -977,8 +980,8 @@ TEST_P(BindGroupTests, DrawThenChangePipelineTwiceAndBindGroup) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 filled(255, 255, 255, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(255, 255, 255, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); uint32_t min = 1, max = kRTSize - 3; EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min); @@ -1051,7 +1054,7 @@ TEST_P(BindGroupTests, DynamicOffsetOrder) { @group(0) @binding(0) var buffer0 : Buffer; @group(0) @binding(4) var outputBuffer : OutputBuffer; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { outputBuffer.value = vec3(buffer0.value, buffer2.value, buffer3.value); })"); pipelineDescriptor.compute.entryPoint = "main"; @@ -1133,7 +1136,7 @@ TEST_P(BindGroupTests, DynamicAndNonDynamicBindingsDoNotConflictAfterRemapping) @group(0) @binding(1) var buffer1 : Buffer; @group(0) @binding(2) var outputBuffer : OutputBuffer; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { outputBuffer.value = vec2(buffer0.value, buffer1.value); })"); pipelineDescriptor.compute.entryPoint = "main"; @@ -1236,7 +1239,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -1255,7 +1258,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) { @group(0) @binding(47) var ubo2 : Ubo; @group(0) @binding(111) var ubo3 : Ubo; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return ubo1.color + 2.0 * ubo2.color + 4.0 * ubo3.color; })"); @@ -1275,7 +1278,8 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) { wgpu::Buffer blue = utils::CreateBufferFromData(device, wgpu::BufferUsage::Uniform, {0.0f, 0.0f, 0.251f, 0.0f}); - auto DoTest = [&](wgpu::Buffer color1, wgpu::Buffer color2, wgpu::Buffer color3, RGBA8 filled) { + auto DoTest = [&](wgpu::Buffer color1, wgpu::Buffer color2, wgpu::Buffer color3, + utils::RGBA8 filled) { auto DoTestInner = [&](wgpu::BindGroup bindGroup) { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); @@ -1306,25 +1310,25 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) { }; // first color is normal, second is 2x, third is 3x. - DoTest(black, black, black, RGBA8(0, 0, 0, 0)); + DoTest(black, black, black, utils::RGBA8(0, 0, 0, 0)); // Check the first binding maps to the first slot. We know this because the colors are // multiplied 1x. - DoTest(red, black, black, RGBA8(64, 0, 0, 0)); - DoTest(green, black, black, RGBA8(0, 64, 0, 0)); - DoTest(blue, black, black, RGBA8(0, 0, 64, 0)); + DoTest(red, black, black, utils::RGBA8(64, 0, 0, 0)); + DoTest(green, black, black, utils::RGBA8(0, 64, 0, 0)); + DoTest(blue, black, black, utils::RGBA8(0, 0, 64, 0)); // Use multiple bindings and check the second color maps to the second slot. // We know this because the second slot is multiplied 2x. - DoTest(green, blue, black, RGBA8(0, 64, 128, 0)); - DoTest(blue, green, black, RGBA8(0, 128, 64, 0)); - DoTest(red, green, black, RGBA8(64, 128, 0, 0)); + DoTest(green, blue, black, utils::RGBA8(0, 64, 128, 0)); + DoTest(blue, green, black, utils::RGBA8(0, 128, 64, 0)); + DoTest(red, green, black, utils::RGBA8(64, 128, 0, 0)); // Use multiple bindings and check the third color maps to the third slot. // We know this because the third slot is multiplied 4x. - DoTest(black, blue, red, RGBA8(255, 0, 128, 0)); - DoTest(blue, black, green, RGBA8(0, 255, 64, 0)); - DoTest(red, black, blue, RGBA8(64, 0, 255, 0)); + DoTest(black, blue, red, utils::RGBA8(255, 0, 128, 0)); + DoTest(blue, black, green, utils::RGBA8(0, 255, 64, 0)); + DoTest(red, black, blue, utils::RGBA8(64, 0, 255, 0)); } // This is a regression test for crbug.com/dawn/355 which tests that destruction of a bind group @@ -1355,7 +1359,7 @@ TEST_P(BindGroupTests, EmptyLayout) { pipelineDesc.layout = utils::MakeBasicPipelineLayout(device, &bgl); pipelineDesc.compute.entryPoint = "main"; pipelineDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc); @@ -1378,7 +1382,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) { utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -1394,7 +1398,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) { } @group(0) @binding(0) var buffer0 : Buffer0; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return buffer0.color; })"); @@ -1424,7 +1428,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 0, 0); } // Test that creating a large bind group, with each binding type at the max count, works and can be @@ -1547,7 +1551,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) { body << "result.value = 1u;\n"; std::string shader = - interface.str() + "@stage(compute) @workgroup_size(1) fn main() {\n" + body.str() + "}\n"; + interface.str() + "@compute @workgroup_size(1) fn main() {\n" + body.str() + "}\n"; wgpu::ComputePipelineDescriptor cpDesc; cpDesc.compute.module = utils::CreateShaderModule(device, shader.c_str()); cpDesc.compute.entryPoint = "main"; diff --git a/src/dawn/tests/end2end/BufferZeroInitTests.cpp b/src/dawn/tests/end2end/BufferZeroInitTests.cpp index 71100b7e7a..18cfeaddd4 100644 --- a/src/dawn/tests/end2end/BufferZeroInitTests.cpp +++ b/src/dawn/tests/end2end/BufferZeroInitTests.cpp @@ -199,7 +199,7 @@ class BufferZeroInitTest : public DawnTest { EXPECT_LAZY_CLEAR(0u, EXPECT_BUFFER_U32_RANGE_EQ(expectedBufferData.data(), buffer, 0, expectedBufferData.size())); - constexpr RGBA8 kExpectedColor = {0, 255, 0, 255}; + constexpr utils::RGBA8 kExpectedColor = {0, 255, 0, 255}; EXPECT_PIXEL_RGBA8_EQ(kExpectedColor, outputTexture, 0u, 0u); } @@ -212,7 +212,7 @@ class BufferZeroInitTest : public DawnTest { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexShader); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) i_color : vec4) -> @location(0) vec4 { return i_color; })"); @@ -243,7 +243,7 @@ class BufferZeroInitTest : public DawnTest { EXPECT_LAZY_CLEAR(0u, EXPECT_BUFFER_U32_RANGE_EQ(expectedBufferData.data(), buffer, 0, expectedBufferData.size())); - const RGBA8 kExpectedPixelValue = {0, 255, 0, 255}; + const utils::RGBA8 kExpectedPixelValue = {0, 255, 0, 255}; EXPECT_PIXEL_RGBA8_EQ(kExpectedPixelValue, colorAttachment, 0, 0); } @@ -256,7 +256,7 @@ class BufferZeroInitTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) fn main(@location(0) pos : vec4) -> VertexOut { + @vertex fn main(@location(0) pos : vec4) -> VertexOut { var output : VertexOut; if (all(pos == vec4(0.0, 0.0, 0.0, 0.0))) { output.color = vec4(0.0, 1.0, 0.0, 1.0); @@ -300,7 +300,7 @@ class BufferZeroInitTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var output : VertexOut; if (VertexIndex == 0u) { @@ -350,7 +350,7 @@ class BufferZeroInitTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) fn main() -> VertexOut { + @vertex fn main() -> VertexOut { var output : VertexOut; output.color = vec4(1.0, 0.0, 0.0, 1.0); output.position = vec4(0.0, 0.0, 0.0, 1.0); @@ -391,7 +391,7 @@ class BufferZeroInitTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) fn main() -> VertexOut { + @vertex fn main() -> VertexOut { var output : VertexOut; output.color = vec4(1.0, 0.0, 0.0, 1.0); output.position = vec4(0.0, 0.0, 0.0, 1.0); @@ -432,7 +432,7 @@ class BufferZeroInitTest : public DawnTest { const char* computeShader = R"( @group(0) @binding(0) var outImage : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { textureStore(outImage, vec2(0, 0), vec4(1.0, 0.0, 0.0, 1.0)); })"; @@ -1001,7 +1001,7 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) { @group(0) @binding(0) var ubo : UBO; @group(0) @binding(1) var outImage : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { if (all(ubo.value == vec4(0u, 0u, 0u, 0u))) { textureStore(outImage, vec2(0, 0), vec4(0.0, 1.0, 0.0, 1.0)); } else { @@ -1040,7 +1040,7 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) { @group(0) @binding(0) var ssbo : SSBO; @group(0) @binding(1) var outImage : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { if (all(ssbo.value == vec4(0u, 0u, 0u, 0u))) { textureStore(outImage, vec2(0, 0), vec4(0.0, 1.0, 0.0, 1.0)); } else { @@ -1079,7 +1079,7 @@ TEST_P(BufferZeroInitTest, BoundAsStorageBuffer) { @group(0) @binding(0) var ssbo : SSBO; @group(0) @binding(1) var outImage : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { if (all(ssbo.value[0] == vec4(0u, 0u, 0u, 0u)) && all(ssbo.value[1] == vec4(0u, 0u, 0u, 0u))) { textureStore(outImage, vec2(0, 0), vec4(0.0, 1.0, 0.0, 1.0)); @@ -1152,7 +1152,7 @@ TEST_P(BufferZeroInitTest, PaddingInitialized) { @builtin(position) position : vec4, } - @stage(vertex) fn main(@location(0) pos : vec2) -> VertexOut { + @vertex fn main(@location(0) pos : vec2) -> VertexOut { var output : VertexOut; if (all(pos == vec2(0.0, 0.0))) { output.color = vec4(0.0, 1.0, 0.0, 1.0); @@ -1231,7 +1231,7 @@ TEST_P(BufferZeroInitTest, PaddingInitialized) { EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commandBuffer)); - constexpr RGBA8 kExpectedPixelValue = {0, 255, 0, 255}; + constexpr utils::RGBA8 kExpectedPixelValue = {0, 255, 0, 255}; EXPECT_PIXEL_RGBA8_EQ(kExpectedPixelValue, colorAttachment, 0, 0); } } diff --git a/src/dawn/tests/end2end/ClipSpaceTests.cpp b/src/dawn/tests/end2end/ClipSpaceTests.cpp index 098913a03c..6a5b87f8b3 100644 --- a/src/dawn/tests/end2end/ClipSpaceTests.cpp +++ b/src/dawn/tests/end2end/ClipSpaceTests.cpp @@ -26,7 +26,7 @@ class ClipSpaceTest : public DawnTest { // 1. The depth value of the top-left one is >= 0.5 // 2. The depth value of the bottom-right one is <= 0.5 pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec3(-1.0, 1.0, 1.0), @@ -39,7 +39,7 @@ class ClipSpaceTest : public DawnTest { })"); pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); @@ -88,8 +88,8 @@ TEST_P(ClipSpaceTest, ClipSpace) { wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); queue.Submit(1, &commandBuffer); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, colorTexture, kSize - 1, kSize - 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, colorTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, colorTexture, kSize - 1, kSize - 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, colorTexture, 0, 0); } DAWN_INSTANTIATE_TEST(ClipSpaceTest, diff --git a/src/dawn/tests/end2end/ColorStateTests.cpp b/src/dawn/tests/end2end/ColorStateTests.cpp index 1753c9a749..f1cd42d10f 100644 --- a/src/dawn/tests/end2end/ColorStateTests.cpp +++ b/src/dawn/tests/end2end/ColorStateTests.cpp @@ -40,7 +40,7 @@ class ColorStateTest : public DawnTest { DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsWARP()); vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, -1.0), @@ -54,7 +54,7 @@ class ColorStateTest : public DawnTest { } struct TriangleSpec { - RGBA8 color; + utils::RGBA8 color; std::array blendFactor = {}; }; @@ -68,7 +68,7 @@ class ColorStateTest : public DawnTest { @group(0) @binding(0) var myUbo : MyBlock; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return myUbo.color; } )"); @@ -93,7 +93,7 @@ class ColorStateTest : public DawnTest { // Create a bind group to set the colors as a uniform buffer template - wgpu::BindGroup MakeBindGroupForColors(std::array colors) { + wgpu::BindGroup MakeBindGroupForColors(std::array colors) { std::array data; for (unsigned int i = 0; i < N; ++i) { data[4 * i + 0] = static_cast(colors[i].r) / 255.f; @@ -112,7 +112,9 @@ class ColorStateTest : public DawnTest { // Test that after drawing a triangle with the base color, and then the given triangle spec, the // color is as expected - void DoSingleSourceTest(RGBA8 base, const TriangleSpec& triangle, const RGBA8& expected) { + void DoSingleSourceTest(utils::RGBA8 base, + const TriangleSpec& triangle, + const utils::RGBA8& expected) { wgpu::Color blendConstant{triangle.blendFactor[0], triangle.blendFactor[1], triangle.blendFactor[2], triangle.blendFactor[3]}; @@ -121,12 +123,13 @@ class ColorStateTest : public DawnTest { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); // First use the base pipeline to draw a triangle with no blending pass.SetPipeline(basePipeline); - pass.SetBindGroup(0, MakeBindGroupForColors(std::array({{base}}))); + pass.SetBindGroup(0, MakeBindGroupForColors(std::array({{base}}))); pass.Draw(3); // Then use the test pipeline to draw the test triangle with blending pass.SetPipeline(testPipeline); - pass.SetBindGroup(0, MakeBindGroupForColors(std::array({{triangle.color}}))); + pass.SetBindGroup( + 0, MakeBindGroupForColors(std::array({{triangle.color}}))); pass.SetBlendConstant(&blendConstant); pass.Draw(3); pass.End(); @@ -140,9 +143,9 @@ class ColorStateTest : public DawnTest { // Given a vector of tests where each element is , check that all // expectations are true for the given blend operation - void CheckBlendOperation(RGBA8 base, + void CheckBlendOperation(utils::RGBA8 base, wgpu::BlendOperation operation, - std::vector> tests) { + std::vector> tests) { wgpu::BlendComponent blendComponent; blendComponent.operation = operation; blendComponent.srcFactor = wgpu::BlendFactor::One; @@ -165,12 +168,12 @@ class ColorStateTest : public DawnTest { // Given a vector of tests where each element is , check that all // expectations are true for the given blend factors - void CheckBlendFactor(RGBA8 base, + void CheckBlendFactor(utils::RGBA8 base, wgpu::BlendFactor colorSrcFactor, wgpu::BlendFactor colorDstFactor, wgpu::BlendFactor alphaSrcFactor, wgpu::BlendFactor alphaDstFactor, - std::vector> tests) { + std::vector> tests) { wgpu::BlendComponent colorBlend; colorBlend.operation = wgpu::BlendOperation::Add; colorBlend.srcFactor = colorSrcFactor; @@ -196,18 +199,18 @@ class ColorStateTest : public DawnTest { } } - void CheckSrcBlendFactor(RGBA8 base, + void CheckSrcBlendFactor(utils::RGBA8 base, wgpu::BlendFactor colorFactor, wgpu::BlendFactor alphaFactor, - std::vector> tests) { + std::vector> tests) { CheckBlendFactor(base, colorFactor, wgpu::BlendFactor::One, alphaFactor, wgpu::BlendFactor::One, tests); } - void CheckDstBlendFactor(RGBA8 base, + void CheckDstBlendFactor(utils::RGBA8 base, wgpu::BlendFactor colorFactor, wgpu::BlendFactor alphaFactor, - std::vector> tests) { + std::vector> tests) { CheckBlendFactor(base, wgpu::BlendFactor::One, colorFactor, wgpu::BlendFactor::One, alphaFactor, tests); } @@ -221,7 +224,7 @@ class ColorStateTest : public DawnTest { namespace { // Add two colors and clamp -constexpr RGBA8 operator+(const RGBA8& col1, const RGBA8& col2) { +constexpr utils::RGBA8 operator+(const utils::RGBA8& col1, const utils::RGBA8& col2) { int r = static_cast(col1.r) + static_cast(col2.r); int g = static_cast(col1.g) + static_cast(col2.g); int b = static_cast(col1.b) + static_cast(col2.b); @@ -231,12 +234,12 @@ constexpr RGBA8 operator+(const RGBA8& col1, const RGBA8& col2) { b = (b > 255 ? 255 : (b < 0 ? 0 : b)); a = (a > 255 ? 255 : (a < 0 ? 0 : a)); - return RGBA8(static_cast(r), static_cast(g), static_cast(b), - static_cast(a)); + return utils::RGBA8(static_cast(r), static_cast(g), static_cast(b), + static_cast(a)); } // Subtract two colors and clamp -constexpr RGBA8 operator-(const RGBA8& col1, const RGBA8& col2) { +constexpr utils::RGBA8 operator-(const utils::RGBA8& col1, const utils::RGBA8& col2) { int r = static_cast(col1.r) - static_cast(col2.r); int g = static_cast(col1.g) - static_cast(col2.g); int b = static_cast(col1.b) - static_cast(col2.b); @@ -246,35 +249,35 @@ constexpr RGBA8 operator-(const RGBA8& col1, const RGBA8& col2) { b = (b > 255 ? 255 : (b < 0 ? 0 : b)); a = (a > 255 ? 255 : (a < 0 ? 0 : a)); - return RGBA8(static_cast(r), static_cast(g), static_cast(b), - static_cast(a)); + return utils::RGBA8(static_cast(r), static_cast(g), static_cast(b), + static_cast(a)); } // Get the component-wise minimum of two colors -RGBA8 min(const RGBA8& col1, const RGBA8& col2) { - return RGBA8(std::min(col1.r, col2.r), std::min(col1.g, col2.g), std::min(col1.b, col2.b), - std::min(col1.a, col2.a)); +utils::RGBA8 min(const utils::RGBA8& col1, const utils::RGBA8& col2) { + return utils::RGBA8(std::min(col1.r, col2.r), std::min(col1.g, col2.g), + std::min(col1.b, col2.b), std::min(col1.a, col2.a)); } // Get the component-wise maximum of two colors -RGBA8 max(const RGBA8& col1, const RGBA8& col2) { - return RGBA8(std::max(col1.r, col2.r), std::max(col1.g, col2.g), std::max(col1.b, col2.b), - std::max(col1.a, col2.a)); +utils::RGBA8 max(const utils::RGBA8& col1, const utils::RGBA8& col2) { + return utils::RGBA8(std::max(col1.r, col2.r), std::max(col1.g, col2.g), + std::max(col1.b, col2.b), std::max(col1.a, col2.a)); } // Blend two RGBA8 color values parameterized by the provided factors in the range [0.f, 1.f] -RGBA8 mix(const RGBA8& col1, const RGBA8& col2, std::array fac) { +utils::RGBA8 mix(const utils::RGBA8& col1, const utils::RGBA8& col2, std::array fac) { float r = static_cast(col1.r) * (1.f - fac[0]) + static_cast(col2.r) * fac[0]; float g = static_cast(col1.g) * (1.f - fac[1]) + static_cast(col2.g) * fac[1]; float b = static_cast(col1.b) * (1.f - fac[2]) + static_cast(col2.b) * fac[2]; float a = static_cast(col1.a) * (1.f - fac[3]) + static_cast(col2.a) * fac[3]; - return RGBA8({static_cast(std::round(r)), static_cast(std::round(g)), - static_cast(std::round(b)), static_cast(std::round(a))}); + return utils::RGBA8({static_cast(std::round(r)), static_cast(std::round(g)), + static_cast(std::round(b)), static_cast(std::round(a))}); } // Blend two RGBA8 color values parameterized by the provided RGBA8 factor -RGBA8 mix(const RGBA8& col1, const RGBA8& col2, const RGBA8& fac) { +utils::RGBA8 mix(const utils::RGBA8& col1, const utils::RGBA8& col2, const utils::RGBA8& fac) { std::array f = {{ static_cast(fac.r) / 255.f, static_cast(fac.g) / 255.f, @@ -284,18 +287,18 @@ RGBA8 mix(const RGBA8& col1, const RGBA8& col2, const RGBA8& fac) { return mix(col1, col2, f); } -constexpr std::array kColors = {{ +constexpr std::array kColors = {{ // check operations over multiple channels - RGBA8(64, 0, 0, 0), - RGBA8(0, 64, 0, 0), - RGBA8(64, 0, 32, 0), - RGBA8(0, 64, 32, 0), - RGBA8(128, 0, 128, 128), - RGBA8(0, 128, 128, 128), + utils::RGBA8(64, 0, 0, 0), + utils::RGBA8(0, 64, 0, 0), + utils::RGBA8(64, 0, 32, 0), + utils::RGBA8(0, 64, 32, 0), + utils::RGBA8(128, 0, 128, 128), + utils::RGBA8(0, 128, 128, 128), // check cases that may cause overflow - RGBA8(0, 0, 0, 0), - RGBA8(255, 255, 255, 255), + utils::RGBA8(0, 0, 0, 0), + utils::RGBA8(255, 255, 255, 255), }}; } // namespace @@ -316,114 +319,119 @@ TEST_P(ColorStateTest, Basic) { SetupSingleSourcePipelines(descriptor); - DoSingleSourceTest(RGBA8(0, 0, 0, 0), {RGBA8(255, 0, 0, 0)}, RGBA8(255, 0, 0, 0)); + DoSingleSourceTest(utils::RGBA8(0, 0, 0, 0), {utils::RGBA8(255, 0, 0, 0)}, + utils::RGBA8(255, 0, 0, 0)); } // The following tests check test that the blend operation works TEST_P(ColorStateTest, BlendOperationAdd) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { return std::make_pair(color, base + color); }); + [&](const utils::RGBA8& color) { return std::make_pair(color, base + color); }); CheckBlendOperation(base, wgpu::BlendOperation::Add, tests); } TEST_P(ColorStateTest, BlendOperationSubtract) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { return std::make_pair(color, color - base); }); + [&](const utils::RGBA8& color) { return std::make_pair(color, color - base); }); CheckBlendOperation(base, wgpu::BlendOperation::Subtract, tests); } TEST_P(ColorStateTest, BlendOperationReverseSubtract) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { return std::make_pair(color, base - color); }); + [&](const utils::RGBA8& color) { return std::make_pair(color, base - color); }); CheckBlendOperation(base, wgpu::BlendOperation::ReverseSubtract, tests); } TEST_P(ColorStateTest, BlendOperationMin) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; - std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { return std::make_pair(color, min(base, color)); }); + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; + std::transform( + kColors.begin(), kColors.end(), std::back_inserter(tests), + [&](const utils::RGBA8& color) { return std::make_pair(color, min(base, color)); }); CheckBlendOperation(base, wgpu::BlendOperation::Min, tests); } TEST_P(ColorStateTest, BlendOperationMax) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; - std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { return std::make_pair(color, max(base, color)); }); + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; + std::transform( + kColors.begin(), kColors.end(), std::back_inserter(tests), + [&](const utils::RGBA8& color) { return std::make_pair(color, max(base, color)); }); CheckBlendOperation(base, wgpu::BlendOperation::Max, tests); } // The following tests check that the Source blend factor works TEST_P(ColorStateTest, SrcBlendFactorZero) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform( kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { return std::make_pair(TriangleSpec({{color}}), base); }); + [&](const utils::RGBA8& color) { return std::make_pair(TriangleSpec({{color}}), base); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::Zero, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, SrcBlendFactorOne) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; - std::transform( - kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { return std::make_pair(TriangleSpec({{color}}), base + color); }); + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; + std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), + [&](const utils::RGBA8& color) { + return std::make_pair(TriangleSpec({{color}}), base + color); + }); CheckSrcBlendFactor(base, wgpu::BlendFactor::One, wgpu::BlendFactor::One, tests); } TEST_P(ColorStateTest, SrcBlendFactorSrc) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac = color; + [&](const utils::RGBA8& color) { + utils::RGBA8 fac = color; fac.a = 0; - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::Src, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, SrcBlendFactorOneMinusSrc) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac = RGBA8(255, 255, 255, 255) - color; + [&](const utils::RGBA8& color) { + utils::RGBA8 fac = utils::RGBA8(255, 255, 255, 255) - color; fac.a = 0; - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::OneMinusSrc, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, SrcBlendFactorSrcAlpha) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac(color.a, color.a, color.a, color.a); - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); + [&](const utils::RGBA8& color) { + utils::RGBA8 fac(color.a, color.a, color.a, color.a); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::SrcAlpha, wgpu::BlendFactor::SrcAlpha, tests); } TEST_P(ColorStateTest, SrcBlendFactorOneMinusSrcAlpha) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform( - kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { - RGBA8 fac = RGBA8(255, 255, 255, 255) - RGBA8(color.a, color.a, color.a, color.a); - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); + kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const utils::RGBA8& color) { + utils::RGBA8 fac = + utils::RGBA8(255, 255, 255, 255) - utils::RGBA8(color.a, color.a, color.a, color.a); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::OneMinusSrcAlpha, @@ -431,50 +439,51 @@ TEST_P(ColorStateTest, SrcBlendFactorOneMinusSrcAlpha) { } TEST_P(ColorStateTest, SrcBlendFactorDst) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac = base; + [&](const utils::RGBA8& color) { + utils::RGBA8 fac = base; fac.a = 0; - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::Dst, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, SrcBlendFactorOneMinusDst) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac = RGBA8(255, 255, 255, 255) - base; + [&](const utils::RGBA8& color) { + utils::RGBA8 fac = utils::RGBA8(255, 255, 255, 255) - base; fac.a = 0; - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::OneMinusDst, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, SrcBlendFactorDstAlpha) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac(base.a, base.a, base.a, base.a); - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); + [&](const utils::RGBA8& color) { + utils::RGBA8 fac(base.a, base.a, base.a, base.a); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::DstAlpha, wgpu::BlendFactor::DstAlpha, tests); } TEST_P(ColorStateTest, SrcBlendFactorOneMinusDstAlpha) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform( - kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { - RGBA8 fac = RGBA8(255, 255, 255, 255) - RGBA8(base.a, base.a, base.a, base.a); - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); + kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const utils::RGBA8& color) { + utils::RGBA8 fac = + utils::RGBA8(255, 255, 255, 255) - utils::RGBA8(base.a, base.a, base.a, base.a); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::OneMinusDstAlpha, @@ -482,13 +491,13 @@ TEST_P(ColorStateTest, SrcBlendFactorOneMinusDstAlpha) { } TEST_P(ColorStateTest, SrcBlendFactorSrcAlphaSaturated) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { + [&](const utils::RGBA8& color) { uint8_t f = std::min(color.a, static_cast(255 - base.a)); - RGBA8 fac(f, f, f, 255); - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); + utils::RGBA8 fac(f, f, f, 255); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::SrcAlphaSaturated, @@ -496,25 +505,26 @@ TEST_P(ColorStateTest, SrcBlendFactorSrcAlphaSaturated) { } TEST_P(ColorStateTest, SrcBlendFactorConstant) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; - std::transform( - kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { - auto triangleSpec = TriangleSpec({{color}, {{0.2f, 0.4f, 0.6f, 0.8f}}}); - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, triangleSpec.blendFactor); - return std::make_pair(triangleSpec, expected); - }); + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; + std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), + [&](const utils::RGBA8& color) { + auto triangleSpec = TriangleSpec({{color}, {{0.2f, 0.4f, 0.6f, 0.8f}}}); + utils::RGBA8 expected = + base + mix(utils::RGBA8(0, 0, 0, 0), color, triangleSpec.blendFactor); + return std::make_pair(triangleSpec, expected); + }); CheckSrcBlendFactor(base, wgpu::BlendFactor::Constant, wgpu::BlendFactor::Constant, tests); } TEST_P(ColorStateTest, SrcBlendFactorOneMinusConstant) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { + [&](const utils::RGBA8& color) { auto triangleSpec = TriangleSpec({{color}, {{0.2f, 0.4f, 0.6f, 0.8f}}}); std::array f = {{0.8f, 0.6f, 0.4f, 0.2f}}; - RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, f); + utils::RGBA8 expected = base + mix(utils::RGBA8(0, 0, 0, 0), color, f); return std::make_pair(triangleSpec, expected); }); CheckSrcBlendFactor(base, wgpu::BlendFactor::OneMinusConstant, @@ -523,68 +533,70 @@ TEST_P(ColorStateTest, SrcBlendFactorOneMinusConstant) { // The following tests check that the Destination blend factor works TEST_P(ColorStateTest, DstBlendFactorZero) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform( kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { return std::make_pair(TriangleSpec({{color}}), color); }); + [&](const utils::RGBA8& color) { return std::make_pair(TriangleSpec({{color}}), color); }); CheckDstBlendFactor(base, wgpu::BlendFactor::Zero, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, DstBlendFactorOne) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; - std::transform( - kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { return std::make_pair(TriangleSpec({{color}}), base + color); }); + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; + std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), + [&](const utils::RGBA8& color) { + return std::make_pair(TriangleSpec({{color}}), base + color); + }); CheckDstBlendFactor(base, wgpu::BlendFactor::One, wgpu::BlendFactor::One, tests); } TEST_P(ColorStateTest, DstBlendFactorSrc) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac = color; + [&](const utils::RGBA8& color) { + utils::RGBA8 fac = color; fac.a = 0; - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::Src, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, DstBlendFactorOneMinusSrc) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac = RGBA8(255, 255, 255, 255) - color; + [&](const utils::RGBA8& color) { + utils::RGBA8 fac = utils::RGBA8(255, 255, 255, 255) - color; fac.a = 0; - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::OneMinusSrc, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, DstBlendFactorSrcAlpha) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac(color.a, color.a, color.a, color.a); - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); + [&](const utils::RGBA8& color) { + utils::RGBA8 fac(color.a, color.a, color.a, color.a); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::SrcAlpha, wgpu::BlendFactor::SrcAlpha, tests); } TEST_P(ColorStateTest, DstBlendFactorOneMinusSrcAlpha) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform( - kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { - RGBA8 fac = RGBA8(255, 255, 255, 255) - RGBA8(color.a, color.a, color.a, color.a); - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); + kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const utils::RGBA8& color) { + utils::RGBA8 fac = + utils::RGBA8(255, 255, 255, 255) - utils::RGBA8(color.a, color.a, color.a, color.a); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::OneMinusSrcAlpha, @@ -592,50 +604,51 @@ TEST_P(ColorStateTest, DstBlendFactorOneMinusSrcAlpha) { } TEST_P(ColorStateTest, DstBlendFactorDst) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac = base; + [&](const utils::RGBA8& color) { + utils::RGBA8 fac = base; fac.a = 0; - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::Dst, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, DstBlendFactorOneMinusDst) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac = RGBA8(255, 255, 255, 255) - base; + [&](const utils::RGBA8& color) { + utils::RGBA8 fac = utils::RGBA8(255, 255, 255, 255) - base; fac.a = 0; - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::OneMinusDst, wgpu::BlendFactor::Zero, tests); } TEST_P(ColorStateTest, DstBlendFactorDstAlpha) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { - RGBA8 fac(base.a, base.a, base.a, base.a); - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); + [&](const utils::RGBA8& color) { + utils::RGBA8 fac(base.a, base.a, base.a, base.a); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::DstAlpha, wgpu::BlendFactor::DstAlpha, tests); } TEST_P(ColorStateTest, DstBlendFactorOneMinusDstAlpha) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform( - kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { - RGBA8 fac = RGBA8(255, 255, 255, 255) - RGBA8(base.a, base.a, base.a, base.a); - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); + kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const utils::RGBA8& color) { + utils::RGBA8 fac = + utils::RGBA8(255, 255, 255, 255) - utils::RGBA8(base.a, base.a, base.a, base.a); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::OneMinusDstAlpha, @@ -643,13 +656,13 @@ TEST_P(ColorStateTest, DstBlendFactorOneMinusDstAlpha) { } TEST_P(ColorStateTest, DstBlendFactorSrcAlphaSaturated) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { + [&](const utils::RGBA8& color) { uint8_t f = std::min(color.a, static_cast(255 - base.a)); - RGBA8 fac(f, f, f, 255); - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); + utils::RGBA8 fac(f, f, f, 255); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({{color}}), expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::SrcAlphaSaturated, @@ -657,25 +670,26 @@ TEST_P(ColorStateTest, DstBlendFactorSrcAlphaSaturated) { } TEST_P(ColorStateTest, DstBlendFactorConstant) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; - std::transform( - kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { - auto triangleSpec = TriangleSpec({{color}, {{0.2f, 0.4f, 0.6f, 0.8f}}}); - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, triangleSpec.blendFactor); - return std::make_pair(triangleSpec, expected); - }); + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; + std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), + [&](const utils::RGBA8& color) { + auto triangleSpec = TriangleSpec({{color}, {{0.2f, 0.4f, 0.6f, 0.8f}}}); + utils::RGBA8 expected = + color + mix(utils::RGBA8(0, 0, 0, 0), base, triangleSpec.blendFactor); + return std::make_pair(triangleSpec, expected); + }); CheckDstBlendFactor(base, wgpu::BlendFactor::Constant, wgpu::BlendFactor::Constant, tests); } TEST_P(ColorStateTest, DstBlendFactorOneMinusConstant) { - RGBA8 base(32, 64, 128, 192); - std::vector> tests; + utils::RGBA8 base(32, 64, 128, 192); + std::vector> tests; std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), - [&](const RGBA8& color) { + [&](const utils::RGBA8& color) { auto triangleSpec = TriangleSpec({{color}, {{0.2f, 0.4f, 0.6f, 0.8f}}}); std::array f = {{0.8f, 0.6f, 0.4f, 0.2f}}; - RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, f); + utils::RGBA8 expected = color + mix(utils::RGBA8(0, 0, 0, 0), base, f); return std::make_pair(triangleSpec, expected); }); CheckDstBlendFactor(base, wgpu::BlendFactor::OneMinusConstant, @@ -700,9 +714,9 @@ TEST_P(ColorStateTest, ColorWriteMask) { descriptor.writeMask = wgpu::ColorWriteMask::Red; SetupSingleSourcePipelines(descriptor); - RGBA8 base(32, 64, 128, 192); + utils::RGBA8 base(32, 64, 128, 192); for (auto& color : kColors) { - RGBA8 expected = base + RGBA8(color.r, 0, 0, 0); + utils::RGBA8 expected = base + utils::RGBA8(color.r, 0, 0, 0); DoSingleSourceTest(base, {color}, expected); } } @@ -712,9 +726,9 @@ TEST_P(ColorStateTest, ColorWriteMask) { descriptor.writeMask = wgpu::ColorWriteMask::Green | wgpu::ColorWriteMask::Alpha; SetupSingleSourcePipelines(descriptor); - RGBA8 base(32, 64, 128, 192); + utils::RGBA8 base(32, 64, 128, 192); for (auto& color : kColors) { - RGBA8 expected = base + RGBA8(0, color.g, 0, color.a); + utils::RGBA8 expected = base + utils::RGBA8(0, color.g, 0, color.a); DoSingleSourceTest(base, {color}, expected); } } @@ -724,7 +738,7 @@ TEST_P(ColorStateTest, ColorWriteMask) { descriptor.writeMask = wgpu::ColorWriteMask::None; SetupSingleSourcePipelines(descriptor); - RGBA8 base(32, 64, 128, 192); + utils::RGBA8 base(32, 64, 128, 192); for (auto& color : kColors) { DoSingleSourceTest(base, {color}, base); } @@ -748,14 +762,14 @@ TEST_P(ColorStateTest, ColorWriteMaskBlendingDisabled) { descriptor.writeMask = wgpu::ColorWriteMask::Red; SetupSingleSourcePipelines(descriptor); - RGBA8 base(32, 64, 128, 192); - RGBA8 expected(32, 0, 0, 0); + utils::RGBA8 base(32, 64, 128, 192); + utils::RGBA8 expected(32, 0, 0, 0); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); pass.SetPipeline(testPipeline); - pass.SetBindGroup(0, MakeBindGroupForColors(std::array({{base}}))); + pass.SetBindGroup(0, MakeBindGroupForColors(std::array({{base}}))); pass.Draw(3); pass.End(); } @@ -808,7 +822,7 @@ TEST_P(ColorStateTest, IndependentColorState) { @location(3) fragColor3 : vec4, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.fragColor0 = myUbo.color0; output.fragColor1 = myUbo.color1; @@ -869,28 +883,28 @@ TEST_P(ColorStateTest, IndependentColorState) { testPipeline = device.CreateRenderPipeline(&testDescriptor); for (unsigned int c = 0; c < kColors.size(); ++c) { - RGBA8 base = kColors[((c + 31) * 29) % kColors.size()]; - RGBA8 color0 = kColors[((c + 19) * 13) % kColors.size()]; - RGBA8 color1 = kColors[((c + 11) * 43) % kColors.size()]; - RGBA8 color2 = kColors[((c + 7) * 3) % kColors.size()]; - RGBA8 color3 = kColors[((c + 13) * 71) % kColors.size()]; + utils::RGBA8 base = kColors[((c + 31) * 29) % kColors.size()]; + utils::RGBA8 color0 = kColors[((c + 19) * 13) % kColors.size()]; + utils::RGBA8 color1 = kColors[((c + 11) * 43) % kColors.size()]; + utils::RGBA8 color2 = kColors[((c + 7) * 3) % kColors.size()]; + utils::RGBA8 color3 = kColors[((c + 13) * 71) % kColors.size()]; - RGBA8 expected0 = color0 + base; - RGBA8 expected1 = color1 - base; - RGBA8 expected2 = color2; - RGBA8 expected3 = min(color3, base); + utils::RGBA8 expected0 = color0 + base; + utils::RGBA8 expected1 = color1 - base; + utils::RGBA8 expected2 = color2; + utils::RGBA8 expected3 = min(color3, base); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); pass.SetPipeline(basePipeline); pass.SetBindGroup( - 0, MakeBindGroupForColors(std::array({{base, base, base, base}}))); + 0, MakeBindGroupForColors(std::array({{base, base, base, base}}))); pass.Draw(3); pass.SetPipeline(testPipeline); - pass.SetBindGroup(0, MakeBindGroupForColors( - std::array({{color0, color1, color2, color3}}))); + pass.SetBindGroup(0, MakeBindGroupForColors(std::array( + {{color0, color1, color2, color3}}))); pass.Draw(3); pass.End(); } @@ -922,7 +936,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) { @group(0) @binding(0) var myUbo : MyBlock; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return myUbo.color; } )"); @@ -961,12 +975,12 @@ TEST_P(ColorStateTest, DefaultBlendColor) { { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); pass.SetPipeline(basePipeline); - pass.SetBindGroup(0, - MakeBindGroupForColors(std::array({{RGBA8(0, 0, 0, 0)}}))); + pass.SetBindGroup(0, MakeBindGroupForColors( + std::array({{utils::RGBA8(0, 0, 0, 0)}}))); pass.Draw(3); pass.SetPipeline(testPipeline); - pass.SetBindGroup( - 0, MakeBindGroupForColors(std::array({{RGBA8(255, 255, 255, 255)}}))); + pass.SetBindGroup(0, MakeBindGroupForColors(std::array( + {{utils::RGBA8(255, 255, 255, 255)}}))); pass.Draw(3); pass.End(); } @@ -974,7 +988,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, kRTSize / 2, kRTSize / 2); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 0, 0, 0), renderPass.color, kRTSize / 2, kRTSize / 2); } // Check that setting the blend color works @@ -983,13 +997,13 @@ TEST_P(ColorStateTest, DefaultBlendColor) { { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); pass.SetPipeline(basePipeline); - pass.SetBindGroup(0, - MakeBindGroupForColors(std::array({{RGBA8(0, 0, 0, 0)}}))); + pass.SetBindGroup(0, MakeBindGroupForColors( + std::array({{utils::RGBA8(0, 0, 0, 0)}}))); pass.Draw(3); pass.SetPipeline(testPipeline); pass.SetBlendConstant(&kWhite); - pass.SetBindGroup( - 0, MakeBindGroupForColors(std::array({{RGBA8(255, 255, 255, 255)}}))); + pass.SetBindGroup(0, MakeBindGroupForColors(std::array( + {{utils::RGBA8(255, 255, 255, 255)}}))); pass.Draw(3); pass.End(); } @@ -997,7 +1011,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(255, 255, 255, 255), renderPass.color, kRTSize / 2, + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(255, 255, 255, 255), renderPass.color, kRTSize / 2, kRTSize / 2); } @@ -1007,25 +1021,25 @@ TEST_P(ColorStateTest, DefaultBlendColor) { { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); pass.SetPipeline(basePipeline); - pass.SetBindGroup(0, - MakeBindGroupForColors(std::array({{RGBA8(0, 0, 0, 0)}}))); + pass.SetBindGroup(0, MakeBindGroupForColors( + std::array({{utils::RGBA8(0, 0, 0, 0)}}))); pass.Draw(3); pass.SetPipeline(testPipeline); pass.SetBlendConstant(&kWhite); - pass.SetBindGroup( - 0, MakeBindGroupForColors(std::array({{RGBA8(255, 255, 255, 255)}}))); + pass.SetBindGroup(0, MakeBindGroupForColors(std::array( + {{utils::RGBA8(255, 255, 255, 255)}}))); pass.Draw(3); pass.End(); } { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); pass.SetPipeline(basePipeline); - pass.SetBindGroup(0, - MakeBindGroupForColors(std::array({{RGBA8(0, 0, 0, 0)}}))); + pass.SetBindGroup(0, MakeBindGroupForColors( + std::array({{utils::RGBA8(0, 0, 0, 0)}}))); pass.Draw(3); pass.SetPipeline(testPipeline); - pass.SetBindGroup( - 0, MakeBindGroupForColors(std::array({{RGBA8(255, 255, 255, 255)}}))); + pass.SetBindGroup(0, MakeBindGroupForColors(std::array( + {{utils::RGBA8(255, 255, 255, 255)}}))); pass.Draw(3); pass.End(); } @@ -1033,7 +1047,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, kRTSize / 2, kRTSize / 2); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 0, 0, 0), renderPass.color, kRTSize / 2, kRTSize / 2); } } @@ -1048,7 +1062,7 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) { @group(0) @binding(0) var myUbo : MyBlock; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return myUbo.color; } )"); @@ -1070,15 +1084,15 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) { testPipeline = device.CreateRenderPipeline(&testDescriptor); - RGBA8 base(32, 64, 128, 192); - RGBA8 expected(0, 0, 0, 0); + utils::RGBA8 base(32, 64, 128, 192); + utils::RGBA8 expected(0, 0, 0, 0); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { // Clear the render attachment to |base| wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); pass.SetPipeline(basePipeline); - pass.SetBindGroup(0, MakeBindGroupForColors(std::array({{base}}))); + pass.SetBindGroup(0, MakeBindGroupForColors(std::array({{base}}))); pass.Draw(3); // Set a pipeline that will dirty the color write mask @@ -1105,7 +1119,7 @@ TEST_P(ColorStateTest, SparseAttachmentsDifferentColorMask) { @location(3) o3 : vec4, } - @stage(fragment) fn main() -> Outputs { + @fragment fn main() -> Outputs { return Outputs(vec4(1.0), vec4(0.0, 1.0, 1.0, 1.0)); } )"); @@ -1155,8 +1169,8 @@ TEST_P(ColorStateTest, SparseAttachmentsDifferentColorMask) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kWhite, attachment1, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, attachment3, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kWhite, attachment1, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, attachment3, 0, 0); } DAWN_INSTANTIATE_TEST(ColorStateTest, diff --git a/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp b/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp index 310a534613..aea386914c 100644 --- a/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp +++ b/src/dawn/tests/end2end/CompressedTextureFormatTests.cpp @@ -168,7 +168,7 @@ class CompressedTextureFormatTest : public DawnTestWithParams, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var pos = array, 3>( vec2(-3.0, 1.0), @@ -184,7 +184,7 @@ class CompressedTextureFormatTest : public DawnTestWithParams; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord); })"); @@ -201,7 +201,7 @@ class CompressedTextureFormatTest : public DawnTestWithParams& expected) { + const std::vector& expected) { ASSERT(IsFormatSupported()); utils::BasicRenderPass renderPass = @@ -250,7 +250,7 @@ class CompressedTextureFormatTest : public DawnTestWithParams expectedData = GetExpectedData(noPaddingExtent3D); + std::vector expectedData = GetExpectedData(noPaddingExtent3D); wgpu::Origin3D firstLayerCopyOrigin = {config.copyOrigin3D.x, config.copyOrigin3D.y, 0}; for (uint32_t layer = config.copyOrigin3D.z; @@ -447,24 +447,24 @@ class CompressedTextureFormatTest : public DawnTestWithParams GetExpectedData(const wgpu::Extent3D& testRegion) { + std::vector GetExpectedData(const wgpu::Extent3D& testRegion) { constexpr uint8_t kLeftAlpha = 0x88; constexpr uint8_t kRightAlpha = 0xFF; - constexpr RGBA8 kBCDarkRed(198, 0, 0, 255); - constexpr RGBA8 kBCDarkGreen(0, 207, 0, 255); - constexpr RGBA8 kBCDarkRedSRGB(144, 0, 0, 255); - constexpr RGBA8 kBCDarkGreenSRGB(0, 159, 0, 255); + constexpr utils::RGBA8 kBCDarkRed(198, 0, 0, 255); + constexpr utils::RGBA8 kBCDarkGreen(0, 207, 0, 255); + constexpr utils::RGBA8 kBCDarkRedSRGB(144, 0, 0, 255); + constexpr utils::RGBA8 kBCDarkGreenSRGB(0, 159, 0, 255); - constexpr RGBA8 kETC2DarkRed(204, 0, 0, 255); - constexpr RGBA8 kETC2DarkGreen(0, 204, 0, 255); - constexpr RGBA8 kETC2DarkRedSRGB(154, 0, 0, 255); - constexpr RGBA8 kETC2DarkGreenSRGB(0, 154, 0, 255); + constexpr utils::RGBA8 kETC2DarkRed(204, 0, 0, 255); + constexpr utils::RGBA8 kETC2DarkGreen(0, 204, 0, 255); + constexpr utils::RGBA8 kETC2DarkRedSRGB(154, 0, 0, 255); + constexpr utils::RGBA8 kETC2DarkGreenSRGB(0, 154, 0, 255); - constexpr RGBA8 kASTCDarkRed(244, 0, 0, 128); - constexpr RGBA8 kASTCDarkGreen(0, 244, 0, 255); - constexpr RGBA8 kASTCDarkRedSRGB(231, 0, 0, 128); - constexpr RGBA8 kASTCDarkGreenSRGB(0, 231, 0, 255); + constexpr utils::RGBA8 kASTCDarkRed(244, 0, 0, 128); + constexpr utils::RGBA8 kASTCDarkGreen(0, 244, 0, 255); + constexpr utils::RGBA8 kASTCDarkRedSRGB(231, 0, 0, 128); + constexpr utils::RGBA8 kASTCDarkGreenSRGB(0, 231, 0, 255); switch (GetParam().mTextureFormat) { case wgpu::TextureFormat::BC1RGBAUnorm: @@ -473,8 +473,9 @@ class CompressedTextureFormatTest : public DawnTestWithParams FillExpectedData(const wgpu::Extent3D& testRegion, - RGBA8 leftColorInBlock, - RGBA8 rightColorInBlock) { + std::vector FillExpectedData(const wgpu::Extent3D& testRegion, + utils::RGBA8 leftColorInBlock, + utils::RGBA8 rightColorInBlock) { ASSERT(testRegion.depthOrArrayLayers == 1); - std::vector expectedData(testRegion.width * testRegion.height, leftColorInBlock); + std::vector expectedData(testRegion.width * testRegion.height, + leftColorInBlock); for (uint32_t y = 0; y < testRegion.height; ++y) { for (uint32_t x = 0; x < testRegion.width; ++x) { if (x % BlockWidthInTexels() >= BlockWidthInTexels() / 2) { @@ -760,7 +767,7 @@ TEST_P(CompressedTextureFormatTest, CopyWholeTextureSubResourceIntoNonZeroMipmap CreateBindGroupForTest(renderPipeline.GetBindGroupLayout(0), textureDst, config.copyOrigin3D.z, config.viewMipmapLevel); - std::vector expectedData = GetExpectedData(kVirtualSize); + std::vector expectedData = GetExpectedData(kVirtualSize); VerifyCompressedTexturePixelValues(renderPipeline, bindGroup, kVirtualSize, config.copyOrigin3D, kVirtualSize, expectedData); } @@ -800,7 +807,7 @@ TEST_P(CompressedTextureFormatTest, CopyIntoSubresourceWithPhysicalSizeNotEqualT CreateBindGroupForTest(renderPipeline.GetBindGroupLayout(0), textureDst, dstConfig.copyOrigin3D.z, dstConfig.viewMipmapLevel); - std::vector expectedData = GetExpectedData(kDstVirtualSize); + std::vector expectedData = GetExpectedData(kDstVirtualSize); VerifyCompressedTexturePixelValues(renderPipeline, bindGroup, kDstVirtualSize, dstConfig.copyOrigin3D, kDstVirtualSize, expectedData); } @@ -841,7 +848,7 @@ TEST_P(CompressedTextureFormatTest, CopyFromSubresourceWithPhysicalSizeNotEqualT CreateBindGroupForTest(renderPipeline.GetBindGroupLayout(0), textureDst, dstConfig.copyOrigin3D.z, dstConfig.viewMipmapLevel); - std::vector expectedData = GetExpectedData(kDstVirtualSize); + std::vector expectedData = GetExpectedData(kDstVirtualSize); VerifyCompressedTexturePixelValues(renderPipeline, bindGroup, kDstVirtualSize, dstConfig.copyOrigin3D, kDstVirtualSize, expectedData); } @@ -900,7 +907,7 @@ TEST_P(CompressedTextureFormatTest, MultipleCopiesWithPhysicalSizeNotEqualToVirt CreateBindGroupForTest(renderPipeline.GetBindGroupLayout(0), dstTextures[i], dstConfigs[i].copyOrigin3D.z, dstConfigs[i].viewMipmapLevel); - std::vector expectedData = GetExpectedData(dstVirtualSizes[i]); + std::vector expectedData = GetExpectedData(dstVirtualSizes[i]); VerifyCompressedTexturePixelValues(renderPipeline, bindGroup0, dstVirtualSizes[i], dstConfigs[i].copyOrigin3D, dstVirtualSizes[i], expectedData); @@ -954,7 +961,7 @@ TEST_P(CompressedTextureFormatTest, CopyWithMultipleLayerAndPhysicalSizeNotEqual const wgpu::Extent3D kExpectedDataRegionPerLayer = {kDstVirtualSize.width, kDstVirtualSize.height, 1u}; - std::vector kExpectedDataPerLayer = GetExpectedData(kExpectedDataRegionPerLayer); + std::vector kExpectedDataPerLayer = GetExpectedData(kExpectedDataRegionPerLayer); const wgpu::Origin3D kCopyOriginPerLayer = {dstConfig.copyOrigin3D.x, dstConfig.copyOrigin3D.y, 0}; for (uint32_t copyLayer = 0; copyLayer < kArrayLayerCount; ++copyLayer) { diff --git a/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp index 13252023cd..2dee70014c 100644 --- a/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp +++ b/src/dawn/tests/end2end/ComputeCopyStorageBufferTests.cpp @@ -95,7 +95,7 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfBasic) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let index : u32 = GlobalInvocationID.x; if (index >= 4u) { return; } @@ -118,7 +118,7 @@ TEST_P(ComputeCopyStorageBufferTests, SizedArrayOfStruct) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let index : u32 = GlobalInvocationID.x; if (index >= 4u) { return; } @@ -136,7 +136,7 @@ TEST_P(ComputeCopyStorageBufferTests, UnsizedArrayOfBasic) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let index : u32 = GlobalInvocationID.x; if (index >= 4u) { return; } diff --git a/src/dawn/tests/end2end/ComputeDispatchTests.cpp b/src/dawn/tests/end2end/ComputeDispatchTests.cpp index 4e089f8c9c..1cdf75971c 100644 --- a/src/dawn/tests/end2end/ComputeDispatchTests.cpp +++ b/src/dawn/tests/end2end/ComputeDispatchTests.cpp @@ -34,7 +34,7 @@ class ComputeDispatchTests : public DawnTest { @group(0) @binding(0) var output : OutputBuf; - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3, @builtin(num_workgroups) dispatch : vec3) { if (dispatch.x == 0u || dispatch.y == 0u || dispatch.z == 0u) { @@ -64,7 +64,7 @@ class ComputeDispatchTests : public DawnTest { @group(0) @binding(0) var input : InputBuf; @group(0) @binding(1) var output : OutputBuf; - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let dispatch : vec3 = input.expectedDispatch; @@ -214,12 +214,12 @@ TEST_P(ComputeDispatchTests, DirectNoop) { // Test basic indirect TEST_P(ComputeDispatchTests, IndirectBasic) { -#ifdef DAWN_PLATFORM_32_BIT +#if DAWN_PLATFORM_IS(32_BIT) // TODO(crbug.com/dawn/1196): Fails on Chromium's Quadro P400 bots DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsNvidia()); #endif // TODO(crbug.com/dawn/1262): Fails with the full validation turned on. - DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsBackendValidationEnabled()); + DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsFullBackendValidationEnabled()); IndirectTest({2, 3, 4}, 0); } @@ -246,12 +246,12 @@ TEST_P(ComputeDispatchTests, IndirectNoop) { // Test indirect with buffer offset TEST_P(ComputeDispatchTests, IndirectOffset) { -#ifdef DAWN_PLATFORM_32_BIT +#if DAWN_PLATFORM_IS(32_BIT) // TODO(crbug.com/dawn/1196): Fails on Chromium's Quadro P400 bots DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsNvidia()); #endif // TODO(crbug.com/dawn/1262): Fails with the full validation turned on. - DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsBackendValidationEnabled()); + DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsFullBackendValidationEnabled()); IndirectTest({0, 0, 0, 2, 3, 4}, 3 * sizeof(uint32_t)); } @@ -263,12 +263,12 @@ TEST_P(ComputeDispatchTests, IndirectOffsetWithoutNumWorkgroups) { // Test indirect dispatches at max limit. TEST_P(ComputeDispatchTests, MaxWorkgroups) { -#ifdef DAWN_PLATFORM_32_BIT +#if DAWN_PLATFORM_IS(32_BIT) // TODO(crbug.com/dawn/1196): Fails on Chromium's Quadro P400 bots DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsNvidia()); #endif // TODO(crbug.com/dawn/1262): Fails with the full validation turned on. - DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsBackendValidationEnabled()); + DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsFullBackendValidationEnabled()); // TODO(crbug.com/dawn/1165): Fails with WARP DAWN_SUPPRESS_TEST_IF(IsWARP()); diff --git a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp index 41a88d03a1..9fa3af98de 100644 --- a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp +++ b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp @@ -137,6 +137,9 @@ class ComputeLayoutMemoryBufferTests }; TEST_P(ComputeLayoutMemoryBufferTests, Fields) { + // TODO(tint:1632) Re-enable after the bug is fixed for Vulkan. + DAWN_SUPPRESS_TEST_IF(IsVulkan()); + // Sentinel value markers codes used to check that the start and end of // structures are correctly aligned. Each of these codes are distinct and // are not likely to be confused with data. @@ -190,7 +193,7 @@ struct Status { @group(0) @binding(1) var output : Output; @group(0) @binding(2) var status : Status; -@stage(compute) @workgroup_size(1,1,1) +@compute @workgroup_size(1,1,1) fn main() { if (input.header != {input_header_code}u) { status.code = {status_bad_input_header}u; diff --git a/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp b/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp index d7f161a681..c63e762285 100644 --- a/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp +++ b/src/dawn/tests/end2end/ComputeSharedMemoryTests.cpp @@ -78,10 +78,10 @@ TEST_P(ComputeSharedMemoryTests, Basic) { x : u32 } - @group(0) @binding(0) var dst : Dst; + @group(0) @binding(0) var dst : Dst; var tmp : u32; - @stage(compute) @workgroup_size(4,4,1) + @compute @workgroup_size(4,4,1) fn main(@builtin(local_invocation_id) LocalInvocationID : vec3) { let index : u32 = LocalInvocationID.y * kTileSize + LocalInvocationID.x; if (index == 0u) { @@ -117,14 +117,14 @@ TEST_P(ComputeSharedMemoryTests, AssortedTypes) { d_vector : vec4, } - @group(0) @binding(0) var dst : Dst; + @group(0) @binding(0) var dst : Dst; var wg_struct : StructValues; var wg_matrix : mat2x2; var wg_array : array; var wg_vector : vec4; - @stage(compute) @workgroup_size(4,1,1) + @compute @workgroup_size(4,1,1) fn main(@builtin(local_invocation_id) LocalInvocationID : vec3) { let i = 4u * LocalInvocationID.x; diff --git a/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp b/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp index c8a9f5158d..e98253ebcd 100644 --- a/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp +++ b/src/dawn/tests/end2end/ComputeStorageBufferBarrierTests.cpp @@ -39,7 +39,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) { @group(0) @binding(0) var buf : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { buf.data[GlobalInvocationID.x] = buf.data[GlobalInvocationID.x] + 0x1234u; } @@ -90,7 +90,7 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + 0x1234u; } @@ -156,7 +156,7 @@ TEST_P(ComputeStorageBufferBarrierTests, StorageAndReadonlyStoragePingPongInOneP @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + 0x1234u; } @@ -224,7 +224,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + vec4(0x1234u, 0x1234u, 0x1234u, 0x1234u); @@ -292,7 +292,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) { @group(0) @binding(0) var src : Buf; @group(0) @binding(1) var dst : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] + vec4(0x1234u, 0x1234u, 0x1234u, 0x1234u); @@ -348,7 +348,7 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) { } @group(0) @binding(0) var buf : Buf; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { buf.data = array(1u, 1u, 1u); } )"); @@ -367,7 +367,7 @@ TEST_P(ComputeStorageBufferBarrierTests, IndirectBufferCorrectBarrier) { } @group(0) @binding(1) var result : Result; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { result.data = 2u; if (buf.data[0] == 1u && buf.data[1] == 1u && buf.data[2] == 1u) { result.data = 1u; diff --git a/src/dawn/tests/end2end/CopyTests.cpp b/src/dawn/tests/end2end/CopyTests.cpp index 295ad526fe..310fc9f737 100644 --- a/src/dawn/tests/end2end/CopyTests.cpp +++ b/src/dawn/tests/end2end/CopyTests.cpp @@ -63,18 +63,18 @@ class CopyTests { // TODO(crbug.com/dawn/818): remove this function when all the tests in this file support // testing arbitrary formats. - static std::vector GetExpectedTextureDataRGBA8( + static std::vector GetExpectedTextureDataRGBA8( const utils::TextureDataCopyLayout& layout) { - std::vector textureData(layout.texelBlockCount); + std::vector textureData(layout.texelBlockCount); for (uint32_t layer = 0; layer < layout.mipSize.depthOrArrayLayers; ++layer) { const uint32_t texelIndexOffsetPerSlice = layout.texelBlocksPerImage * layer; for (uint32_t y = 0; y < layout.mipSize.height; ++y) { for (uint32_t x = 0; x < layout.mipSize.width; ++x) { uint32_t i = x + y * layout.texelBlocksPerRow; textureData[texelIndexOffsetPerSlice + i] = - RGBA8(static_cast((x + layer * x) % 256), - static_cast((y + layer * y) % 256), - static_cast(x / 256), static_cast(y / 256)); + utils::RGBA8(static_cast((x + layer * x) % 256), + static_cast((y + layer * y) % 256), + static_cast(x / 256), static_cast(y / 256)); } } } @@ -157,7 +157,7 @@ class CopyTests_T2B : public CopyTests, public DawnTest { textureSpec.format, textureSpec.textureSize, textureSpec.copyLevel, dimension); // Initialize the source texture - std::vector textureArrayData = GetExpectedTextureDataRGBA8(copyLayout); + std::vector textureArrayData = GetExpectedTextureDataRGBA8(copyLayout); { wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, textureSpec.copyLevel, {0, 0, 0}); @@ -203,11 +203,11 @@ class CopyTests_T2B : public CopyTests, public DawnTest { const uint32_t texelCountInCopyRegion = utils::GetTexelCountInCopyRegion( bufferSpec.bytesPerRow, bufferSpec.rowsPerImage, copySizePerLayer, textureSpec.format); const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copyLayer; - std::vector expected(texelCountInCopyRegion); + std::vector expected(texelCountInCopyRegion); for (uint32_t layer = textureSpec.copyOrigin.z; layer < maxArrayLayer; ++layer) { // Copy the data used to create the upload buffer in the specified copy region to have // the same format as the expected buffer data. - std::fill(expected.begin(), expected.end(), RGBA8()); + std::fill(expected.begin(), expected.end(), utils::RGBA8()); const uint32_t texelIndexOffset = copyLayout.texelBlocksPerImage * layer; const uint32_t expectedTexelArrayDataStartIndex = texelIndexOffset + (textureSpec.copyOrigin.x + @@ -238,10 +238,11 @@ class CopyTests_T2B : public CopyTests, public DawnTest { class CopyTests_B2T : public CopyTests, public DawnTest { protected: - static void FillBufferData(RGBA8* data, size_t count) { + static void FillBufferData(utils::RGBA8* data, size_t count) { for (size_t i = 0; i < count; ++i) { - data[i] = RGBA8(static_cast(i % 256), static_cast((i / 256) % 256), - static_cast((i / 256 / 256) % 256), 255); + data[i] = + utils::RGBA8(static_cast(i % 256), static_cast((i / 256) % 256), + static_cast((i / 256 / 256) % 256), 255); } } @@ -253,7 +254,7 @@ class CopyTests_B2T : public CopyTests, public DawnTest { ASSERT_EQ(kDefaultFormat, textureSpec.format); // Create a buffer of size `size` and populate it with data const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(textureSpec.format); - std::vector bufferData(bufferSpec.size / bytesPerTexel); + std::vector bufferData(bufferSpec.size / bytesPerTexel); FillBufferData(bufferData.data(), bufferData.size()); wgpu::Buffer buffer = utils::CreateBufferFromData(device, bufferData.data(), bufferSpec.size, @@ -301,7 +302,7 @@ class CopyTests_B2T : public CopyTests, public DawnTest { for (uint32_t layer = 0; layer < copyLayer; ++layer) { // Copy and pack the data used to create the buffer in the specified copy region to have // the same format as the expected texture data. - std::vector expected(texelCountPerLayer); + std::vector expected(texelCountPerLayer); CopyTextureData(bytesPerTexel, bufferData.data() + bufferOffset / bytesPerTexel, copySize.width, copySize.height, copyDepth, bufferSpec.bytesPerRow, bufferSpec.rowsPerImage, expected.data(), @@ -1028,9 +1029,6 @@ TEST_P(CopyTests_T2B, CopyOneRowWithDepth32Float) { // depth. DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_depth_read")); - // TODO(crbug.com/dawn/727): currently this test fails on many D3D12 drivers. - DAWN_SUPPRESS_TEST_IF(IsD3D12()); - constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::Depth32Float; constexpr uint32_t kPixelsPerRow = 4u; @@ -2185,9 +2183,6 @@ TEST_P(CopyTests_T2T, CopyFromNonZeroMipLevelWithTexelBlockSizeLessThan4Bytes) { // try bots. DAWN_SUPPRESS_TEST_IF(IsVulkan() && IsWindows() && IsIntel()); - // This test also fails on D3D12 on Intel Windows. See http://crbug.com/1312066 for details. - DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsWindows() && IsIntel()); - constexpr std::array kFormats = { {wgpu::TextureFormat::RG8Sint, wgpu::TextureFormat::RG8Uint, wgpu::TextureFormat::RG8Snorm, wgpu::TextureFormat::RG8Unorm, wgpu::TextureFormat::R16Float, wgpu::TextureFormat::R16Sint, @@ -2235,6 +2230,10 @@ TEST_P(CopyTests_T2T, CopyFromNonZeroMipLevelWithTexelBlockSizeLessThan4Bytes) { DoTest(srcSpec, dstSpec, kUploadSize); } } + + // Resolve all the deferred expectations now to avoid allocating too much memory + // in mDeferredExpectations. + ResolveDeferredExpectationsNow(); } } } @@ -2290,6 +2289,9 @@ TEST_P(CopyTests_T2T, Texture3DSameTextureDifferentMipLevels) { // Test that copying whole 3D texture to a 2D array in one texture-to-texture-copy works. TEST_P(CopyTests_T2T, Texture3DTo2DArrayFull) { + // TODO(crbug.com/dawn/1425): Remove this suppression. + DAWN_SUPPRESS_TEST_IF(IsANGLE() && IsWindows() && IsIntel()); + constexpr uint32_t kWidth = 256; constexpr uint32_t kHeight = 128; constexpr uint32_t kDepth = 6u; @@ -2307,6 +2309,9 @@ TEST_P(CopyTests_T2T, Texture3DAnd2DArraySubRegion) { // TODO(crbug.com/dawn/1216): Remove this suppression. DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsNvidia()); + // TODO(crbug.com/dawn/1426): Remove this suppression. + DAWN_SUPPRESS_TEST_IF(IsANGLE() && IsWindows() && IsIntel()); + constexpr uint32_t kWidth = 8; constexpr uint32_t kHeight = 4; constexpr uint32_t kDepth = 2u; @@ -2544,3 +2549,186 @@ DAWN_INSTANTIATE_TEST(ClearBufferTests, OpenGLBackend(), OpenGLESBackend(), VulkanBackend()); + +// Regression tests to reproduce a flaky failure when running whole WebGPU CTS on Intel GPUs. +// See crbug.com/dawn/1487 for more details. +namespace { +using TextureFormat = wgpu::TextureFormat; + +enum class InitializationMethod { + CopyBufferToTexture, + WriteTexture, + CopyTextureToTexture, +}; + +std::ostream& operator<<(std::ostream& o, InitializationMethod method) { + switch (method) { + case InitializationMethod::CopyBufferToTexture: + o << "CopyBufferToTexture"; + break; + case InitializationMethod::WriteTexture: + o << "WriteTexture"; + break; + case InitializationMethod::CopyTextureToTexture: + o << "CopyTextureToTexture"; + break; + default: + UNREACHABLE(); + break; + } + + return o; +} + +using AddRenderAttachmentUsage = bool; + +DAWN_TEST_PARAM_STRUCT(CopyToDepthStencilTextureAfterDestroyingBigBufferTestsParams, + TextureFormat, + InitializationMethod, + AddRenderAttachmentUsage); + +} // anonymous namespace + +class CopyToDepthStencilTextureAfterDestroyingBigBufferTests + : public DawnTestWithParams {}; + +TEST_P(CopyToDepthStencilTextureAfterDestroyingBigBufferTests, DoTest) { + // TODO(crbug.com/dawn/1492): Support CopyBufferToTexture() with Depth16Unorm on OpenGL / + // OpenGL ES backends. + DAWN_SUPPRESS_TEST_IF(GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm && + (IsOpenGL() || IsOpenGLES())); + + // Copies to stencil textures are unsupported on the OpenGL backend. + DAWN_TEST_UNSUPPORTED_IF(GetParam().mTextureFormat == wgpu::TextureFormat::Stencil8 && + (IsOpenGL() || IsOpenGLES())); + + wgpu::TextureFormat format = GetParam().mTextureFormat; + + const uint32_t texelBlockSize = utils::GetTexelBlockSizeInBytes(format); + const uint32_t expectedDataSize = Align(texelBlockSize, 4u); + + // First, create a big buffer and fill some garbage data on DEFAULT heap. + constexpr size_t kBigBufferSize = 159740u; + constexpr uint8_t kGarbageData = 255u; + std::array garbageData; + garbageData.fill(kGarbageData); + + wgpu::Buffer bigBuffer = + utils::CreateBufferFromData(device, garbageData.data(), garbageData.size(), + wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst); + // Next, destroy the buffer. Its heap is still alive and contains the garbage data. + bigBuffer.Destroy(); + + // Ensure the underlying ID3D12Resource of bigBuffer is deleted. + bool submittedWorkDone = false; + queue.OnSubmittedWorkDone( + 0, + [](WGPUQueueWorkDoneStatus status, void* userdata) { + EXPECT_EQ(status, WGPUQueueWorkDoneStatus_Success); + *static_cast(userdata) = true; + }, + &submittedWorkDone); + while (!submittedWorkDone) { + WaitABit(); + } + + // Then, create a small texture, which should be allocated on the heap that contains the + // garbage data. + wgpu::TextureDescriptor textureDescriptor = {}; + textureDescriptor.format = format; + textureDescriptor.size = {1, 1, 1}; + textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst; + if (GetParam().mAddRenderAttachmentUsage) { + textureDescriptor.usage |= wgpu::TextureUsage::RenderAttachment; + } + wgpu::Texture texture = device.CreateTexture(&textureDescriptor); + + // Finally, upload valid data into the texture and validate its contents. + std::vector expectedData(expectedDataSize); + constexpr uint8_t kBaseValue = 204u; + for (uint32_t i = 0; i < texelBlockSize; ++i) { + expectedData[i] = static_cast(i + kBaseValue); + } + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::Extent3D copySize = {1, 1, 1}; + + auto EncodeUploadDataToTexture = [this, copySize](wgpu::CommandEncoder encoder, + wgpu::Texture destinationTexture, + const std::vector& expectedData) { + wgpu::BufferDescriptor bufferDescriptor = {}; + bufferDescriptor.size = expectedData.size(); + bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::MapWrite; + wgpu::Buffer uploadBuffer = device.CreateBuffer(&bufferDescriptor); + bool done = false; + uploadBuffer.MapAsync( + wgpu::MapMode::Write, 0, static_cast(expectedData.size()), + [](WGPUBufferMapAsyncStatus status, void* userdata) { + ASSERT_EQ(WGPUBufferMapAsyncStatus_Success, status); + *static_cast(userdata) = true; + }, + &done); + while (!done) { + WaitABit(); + } + + uint8_t* uploadData = static_cast(uploadBuffer.GetMappedRange()); + memcpy(uploadData, expectedData.data(), expectedData.size()); + uploadBuffer.Unmap(); + + wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(uploadBuffer); + wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(destinationTexture); + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size); + }; + + switch (GetParam().mInitializationMethod) { + case InitializationMethod::CopyBufferToTexture: { + EncodeUploadDataToTexture(encoder, texture, expectedData); + break; + } + case InitializationMethod::WriteTexture: { + wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture); + wgpu::TextureDataLayout layout; + queue.WriteTexture(&imageCopyTexture, expectedData.data(), texelBlockSize, &layout, + ©Size); + break; + } + case InitializationMethod::CopyTextureToTexture: { + wgpu::Texture stagingTexture = device.CreateTexture(&textureDescriptor); + EncodeUploadDataToTexture(encoder, stagingTexture, expectedData); + + wgpu::ImageCopyTexture imageCopyStagingTexture = + utils::CreateImageCopyTexture(stagingTexture); + wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture); + encoder.CopyTextureToTexture(&imageCopyStagingTexture, &imageCopyTexture, ©Size); + break; + } + default: + UNREACHABLE(); + break; + } + + wgpu::BufferDescriptor destinationBufferDescriptor = {}; + destinationBufferDescriptor.size = expectedDataSize; + destinationBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + wgpu::Buffer destinationBuffer = device.CreateBuffer(&destinationBufferDescriptor); + + wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture); + wgpu::ImageCopyBuffer imageCopyDestinationBuffer = + utils::CreateImageCopyBuffer(destinationBuffer); + encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyDestinationBuffer, ©Size); + + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + + EXPECT_BUFFER_U8_RANGE_EQ(expectedData.data(), destinationBuffer, 0, expectedDataSize); +} + +DAWN_INSTANTIATE_TEST_P( + CopyToDepthStencilTextureAfterDestroyingBigBufferTests, + {D3D12Backend(), D3D12Backend({"d3d12_force_clear_copyable_depth_stencil_texture_on_creation"}), + MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, + {wgpu::TextureFormat::Depth16Unorm, wgpu::TextureFormat::Stencil8}, + {InitializationMethod::CopyBufferToTexture, InitializationMethod::WriteTexture, + InitializationMethod::CopyTextureToTexture}, + {true, false}); diff --git a/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp b/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp index 736b4bb8ce..9302cfd4e7 100644 --- a/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp +++ b/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp @@ -166,13 +166,13 @@ class CopyTextureForBrowserTests : public Parent { }; // Source texture contains red pixels and dst texture contains green pixels at start. - static std::vector GetTextureData( + static std::vector GetTextureData( const utils::TextureDataCopyLayout& layout, TextureCopyRole textureRole, wgpu::AlphaMode srcAlphaMode = wgpu::AlphaMode::Premultiplied, wgpu::AlphaMode dstAlphaMode = wgpu::AlphaMode::Unpremultiplied) { std::array alpha = {0, 102, 153, 255}; // 0.0, 0.4, 0.6, 1.0 - std::vector textureData(layout.texelBlockCount); + std::vector textureData(layout.texelBlockCount); for (uint32_t layer = 0; layer < layout.mipSize.depthOrArrayLayers; ++layer) { const uint32_t sliceOffset = layout.texelBlocksPerImage * layer; for (uint32_t y = 0; y < layout.mipSize.height; ++y) { @@ -181,36 +181,33 @@ class CopyTextureForBrowserTests : public Parent { // Source textures will have variable pixel data to cover cases like // flipY. if (textureRole == TextureCopyRole::SOURCE) { - if (srcAlphaMode != dstAlphaMode) { - if (dstAlphaMode == wgpu::AlphaMode::Premultiplied) { - // For premultiply alpha test cases, we expect each channel in dst - // texture will equal to the alpha channel value. - ASSERT(srcAlphaMode == wgpu::AlphaMode::Unpremultiplied); - textureData[sliceOffset + rowOffset + x] = RGBA8( - static_cast(255), static_cast(255), - static_cast(255), static_cast(alpha[x % 4])); - } else { - // For unpremultiply alpha test cases, we expect each channel in dst - // texture will equal to 1.0. - ASSERT(srcAlphaMode == wgpu::AlphaMode::Premultiplied); - textureData[sliceOffset + rowOffset + x] = - RGBA8(static_cast(alpha[x % 4]), - static_cast(alpha[x % 4]), - static_cast(alpha[x % 4]), - static_cast(alpha[x % 4])); - } - - } else { + if (srcAlphaMode == wgpu::AlphaMode::Unpremultiplied && + dstAlphaMode == wgpu::AlphaMode::Premultiplied) { + // We expect each channel in dst + // texture will equal to the alpha channel value. + textureData[sliceOffset + rowOffset + x] = utils::RGBA8( + static_cast(255), static_cast(255), + static_cast(255), static_cast(alpha[x % 4])); + } else if (srcAlphaMode == wgpu::AlphaMode::Premultiplied && + dstAlphaMode == wgpu::AlphaMode::Unpremultiplied) { + // We expect each channel in dst + // texture will equal to 1.0. textureData[sliceOffset + rowOffset + x] = - RGBA8(static_cast((x + layer * x) % 256), - static_cast((y + layer * y) % 256), - static_cast(x % 256), static_cast(x % 256)); + utils::RGBA8(static_cast(alpha[x % 4]), + static_cast(alpha[x % 4]), + static_cast(alpha[x % 4]), + static_cast(alpha[x % 4])); + } else { + textureData[sliceOffset + rowOffset + x] = utils::RGBA8( + static_cast((x + layer * x) % 256), + static_cast((y + layer * y) % 256), + static_cast(x % 256), static_cast(x % 256)); } } else { // Dst textures will have be init as `green` to ensure subrect // copy not cross bound. textureData[sliceOffset + rowOffset + x] = - RGBA8(static_cast(0), static_cast(255), - static_cast(0), static_cast(255)); + utils::RGBA8(static_cast(0), static_cast(255), + static_cast(0), static_cast(255)); } } } @@ -267,7 +264,7 @@ class CopyTextureForBrowserTests : public Parent { // The value diff should be smaller than the hard coded tolerance. return abs(value - expect) < 0.01; } - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let srcSize = textureDimensions(src); let dstSize = textureDimensions(dst); @@ -300,17 +297,18 @@ class CopyTextureForBrowserTests : public Parent { // after premultiply. let premultiplied = 0u; let unpremultiplied = 1u; - if (uniforms.srcAlphaMode != uniforms.dstAlphaMode) { - if (uniforms.dstAlphaMode == premultiplied) { - // srcAlphaMode == unpremultiplied - srcColor = vec4(srcColor.rgb * srcColor.a, srcColor.a); - } + let opaque = 2u; + if (uniforms.srcAlphaMode == opaque) { + srcColor.a = 1.0; + } - if (uniforms.dstAlphaMode == unpremultiplied) { - // srcAlphaMode == premultiplied - if (srcColor.a != 0.0) { - srcColor = vec4(srcColor.rgb / srcColor.a, srcColor.a); - } + if (uniforms.srcAlphaMode == unpremultiplied && uniforms.dstAlphaMode == premultiplied) { + srcColor = vec4(srcColor.rgb * srcColor.a, srcColor.a); + } + + if (uniforms.srcAlphaMode == premultiplied && uniforms.dstAlphaMode == unpremultiplied) { + if (srcColor.a != 0.0) { + srcColor = vec4(srcColor.rgb / srcColor.a, srcColor.a); } } @@ -501,14 +499,14 @@ class CopyTextureForBrowserTests : public Parent { copySize.depthOrArrayLayers}, srcSpec.level); - std::vector srcTextureArrayCopyData = GetTextureData( + std::vector srcTextureArrayCopyData = GetTextureData( srcCopyLayout, TextureCopyRole::SOURCE, options.srcAlphaMode, options.dstAlphaMode); wgpu::TextureUsage srcUsage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding; wgpu::Texture srcTexture = CreateAndInitTexture(srcSpec, srcUsage, srcCopyLayout, srcTextureArrayCopyData.data(), - srcTextureArrayCopyData.size() * sizeof(RGBA8)); + srcTextureArrayCopyData.size() * sizeof(utils::RGBA8)); bool testSubRectCopy = srcSpec.copyOrigin.x > 0 || srcSpec.copyOrigin.y > 0 || dstSpec.copyOrigin.x > 0 || dstSpec.copyOrigin.y > 0 || @@ -532,11 +530,11 @@ class CopyTextureForBrowserTests : public Parent { copySize.depthOrArrayLayers}, dstSpec.level); - const std::vector dstTextureArrayCopyData = + const std::vector dstTextureArrayCopyData = GetTextureData(dstCopyLayout, TextureCopyRole::DEST); - dstTexture = CreateAndInitTexture(dstSpec, dstUsage, dstCopyLayout, - dstTextureArrayCopyData.data(), - dstTextureArrayCopyData.size() * sizeof(RGBA8)); + dstTexture = CreateAndInitTexture( + dstSpec, dstUsage, dstCopyLayout, dstTextureArrayCopyData.data(), + dstTextureArrayCopyData.size() * sizeof(utils::RGBA8)); } else { dstTexture = CreateTexture(dstSpec, dstUsage); } @@ -583,6 +581,94 @@ class CopyTextureForBrowser_Formats } } + wgpu::Texture CreateAndInitSourceTextureForColorFormatConversion( + const TextureSpec& srcSpec, + wgpu::TextureUsage srcUsage, + utils::TextureDataCopyLayout srcCopyLayout) { + // Create and init source texture. + // This fixed source texture data is for color conversion tests. + // The source data can fill a texture in default width and height. + std::vector srcRGBA8UnormTextureArrayCopyData{ + // Take RGBA8Unorm as example: + // R channel has different values + utils::RGBA8(0, 255, 255, 255), // r = 0.0 + utils::RGBA8(102, 255, 255, 255), // r = 0.4 + utils::RGBA8(153, 255, 255, 255), // r = 0.6 + + // G channel has different values + utils::RGBA8(255, 0, 255, 255), // g = 0.0 + utils::RGBA8(255, 102, 255, 255), // g = 0.4 + utils::RGBA8(255, 153, 255, 255), // g = 0.6 + + // B channel has different values + utils::RGBA8(255, 255, 0, 255), // b = 0.0 + utils::RGBA8(255, 255, 102, 255), // b = 0.4 + utils::RGBA8(255, 255, 153, 255), // b = 0.6 + + // A channel set to 0 + utils::RGBA8(255, 255, 255, 0) // a = 0 + }; + + std::vector srcRGBA16FloatTextureArrayCopyData{ + // R channel has different values + // r = 0.0 + Float32ToFloat16(0.0), Float32ToFloat16(1.0), Float32ToFloat16(1.0), + Float32ToFloat16(1.0), + + // r = 0.4 + Float32ToFloat16(0.4), Float32ToFloat16(1.0), Float32ToFloat16(1.0), + Float32ToFloat16(1.0), + + // r = 0.6 + Float32ToFloat16(0.6), Float32ToFloat16(1.0), Float32ToFloat16(1.0), + Float32ToFloat16(1.0), + + // G channel has different values + // g = 0.0 + Float32ToFloat16(1.0), Float32ToFloat16(0.0), Float32ToFloat16(1.0), + Float32ToFloat16(1.0), + + // g = 0.4 + Float32ToFloat16(1.0), Float32ToFloat16(0.4), Float32ToFloat16(1.0), + Float32ToFloat16(1.0), + + // g = 0.6 + Float32ToFloat16(1.0), Float32ToFloat16(0.6), Float32ToFloat16(1.0), + Float32ToFloat16(1.0), + + // B channel has different values + // b = 0.0 + Float32ToFloat16(1.0), Float32ToFloat16(1.0), Float32ToFloat16(0.0), + Float32ToFloat16(1.0), + + // b = 0.4 + Float32ToFloat16(1.0), Float32ToFloat16(1.0), Float32ToFloat16(0.4), + Float32ToFloat16(1.0), + + // b = 0.6 + Float32ToFloat16(1.0), Float32ToFloat16(1.0), Float32ToFloat16(0.6), + Float32ToFloat16(1.0), + + // A channel set to 0 + // a = 0 + Float32ToFloat16(1.0), Float32ToFloat16(1.0), Float32ToFloat16(1.0), + Float32ToFloat16(0.0)}; + + switch (srcSpec.format) { + case wgpu::TextureFormat::RGBA8Unorm: + case wgpu::TextureFormat::BGRA8Unorm: + return CreateAndInitTexture( + srcSpec, srcUsage, srcCopyLayout, srcRGBA8UnormTextureArrayCopyData.data(), + srcRGBA8UnormTextureArrayCopyData.size() * sizeof(utils::RGBA8)); + case wgpu::TextureFormat::RGBA16Float: + return CreateAndInitTexture( + srcSpec, srcUsage, srcCopyLayout, srcRGBA16FloatTextureArrayCopyData.data(), + srcRGBA16FloatTextureArrayCopyData.size() * sizeof(uint16_t)); + default: + UNREACHABLE(); + } + } + void DoColorConversionTest() { TextureSpec srcTextureSpec; srcTextureSpec.format = GetParam().mSrcFormat; @@ -593,42 +679,17 @@ class CopyTextureForBrowser_Formats wgpu::Extent3D copySize = {kDefaultTextureWidth, kDefaultTextureHeight}; wgpu::CopyTextureForBrowserOptions options = {}; - // Create and init source texture. - // This fixed source texture data is for color conversion tests. - // The source data can fill a texture in default width and height. - std::vector srcTextureArrayCopyData{ - // Take RGBA8Unorm as example: - // R channel has different values - RGBA8(0, 255, 255, 255), // r = 0.0 - RGBA8(102, 255, 255, 255), // r = 0.4 - RGBA8(153, 255, 255, 255), // r = 0.6 - - // G channel has different values - RGBA8(255, 0, 255, 255), // g = 0.0 - RGBA8(255, 102, 255, 255), // g = 0.4 - RGBA8(255, 153, 255, 255), // g = 0.6 - - // B channel has different values - RGBA8(255, 255, 0, 255), // b = 0.0 - RGBA8(255, 255, 102, 255), // b = 0.4 - RGBA8(255, 255, 153, 255), // b = 0.6 - - // A channel set to 0 - RGBA8(255, 255, 255, 0) // a = 0 - }; - const utils::TextureDataCopyLayout srcCopyLayout = utils::GetTextureDataCopyLayoutForTextureAtLevel( - kTextureFormat, + srcTextureSpec.format, {srcTextureSpec.textureSize.width, srcTextureSpec.textureSize.height, copySize.depthOrArrayLayers}, srcTextureSpec.level); wgpu::TextureUsage srcUsage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding; - wgpu::Texture srcTexture = CreateAndInitTexture( - srcTextureSpec, srcUsage, srcCopyLayout, srcTextureArrayCopyData.data(), - srcTextureArrayCopyData.size() * sizeof(RGBA8)); + wgpu::Texture srcTexture = CreateAndInitSourceTextureForColorFormatConversion( + srcTextureSpec, srcUsage, srcCopyLayout); // Create dst texture. wgpu::Texture dstTexture = CreateTexture( @@ -752,45 +813,45 @@ class CopyTextureForBrowser_ColorSpace } // TODO(crbug.com/dawn/1140): Generate source data automatically. - std::vector GetSourceData(wgpu::AlphaMode srcTextureAlphaMode) { + std::vector GetSourceData(wgpu::AlphaMode srcTextureAlphaMode) { if (srcTextureAlphaMode == wgpu::AlphaMode::Premultiplied) { - return std::vector{ - RGBA8(0, 102, 102, 102), // a = 0.4 - RGBA8(102, 0, 0, 102), // a = 0.4 - RGBA8(153, 0, 0, 153), // a = 0.6 - RGBA8(255, 0, 0, 255), // a = 1.0 + return std::vector{ + utils::RGBA8(0, 102, 102, 102), // a = 0.4 + utils::RGBA8(102, 0, 0, 102), // a = 0.4 + utils::RGBA8(153, 0, 0, 153), // a = 0.6 + utils::RGBA8(255, 0, 0, 255), // a = 1.0 - RGBA8(153, 0, 153, 153), // a = 0.6 - RGBA8(0, 102, 0, 102), // a = 0.4 - RGBA8(0, 153, 0, 153), // a = 0.6 - RGBA8(0, 255, 0, 255), // a = 1.0 + utils::RGBA8(153, 0, 153, 153), // a = 0.6 + utils::RGBA8(0, 102, 0, 102), // a = 0.4 + utils::RGBA8(0, 153, 0, 153), // a = 0.6 + utils::RGBA8(0, 255, 0, 255), // a = 1.0 - RGBA8(255, 255, 0, 255), // a = 1.0 - RGBA8(0, 0, 102, 102), // a = 0.4 - RGBA8(0, 0, 153, 153), // a = 0.6 - RGBA8(0, 0, 255, 255), // a = 1.0 + utils::RGBA8(255, 255, 0, 255), // a = 1.0 + utils::RGBA8(0, 0, 102, 102), // a = 0.4 + utils::RGBA8(0, 0, 153, 153), // a = 0.6 + utils::RGBA8(0, 0, 255, 255), // a = 1.0 }; } - return std::vector{ + return std::vector{ // Take RGBA8Unorm as example: // R channel has different values - RGBA8(0, 255, 255, 255), // r = 0.0 - RGBA8(102, 0, 0, 255), // r = 0.4 - RGBA8(153, 0, 0, 255), // r = 0.6 - RGBA8(255, 0, 0, 255), // r = 1.0 + utils::RGBA8(0, 255, 255, 255), // r = 0.0 + utils::RGBA8(102, 0, 0, 255), // r = 0.4 + utils::RGBA8(153, 0, 0, 255), // r = 0.6 + utils::RGBA8(255, 0, 0, 255), // r = 1.0 // G channel has different values - RGBA8(255, 0, 255, 255), // g = 0.0 - RGBA8(0, 102, 0, 255), // g = 0.4 - RGBA8(0, 153, 0, 255), // g = 0.6 - RGBA8(0, 255, 0, 255), // g = 1.0 + utils::RGBA8(255, 0, 255, 255), // g = 0.0 + utils::RGBA8(0, 102, 0, 255), // g = 0.4 + utils::RGBA8(0, 153, 0, 255), // g = 0.6 + utils::RGBA8(0, 255, 0, 255), // g = 1.0 // B channel has different values - RGBA8(255, 255, 0, 255), // b = 0.0 - RGBA8(0, 0, 102, 255), // b = 0.4 - RGBA8(0, 0, 153, 255), // b = 0.6 - RGBA8(0, 0, 255, 255), // b = 1.0 + utils::RGBA8(255, 255, 0, 255), // b = 0.0 + utils::RGBA8(0, 0, 102, 255), // b = 0.4 + utils::RGBA8(0, 0, 153, 255), // b = 0.6 + utils::RGBA8(0, 0, 255, 255), // b = 1.0 }; } @@ -960,7 +1021,7 @@ class CopyTextureForBrowser_ColorSpace options.dstTransferFunctionParameters = dstColorSpaceInfo.gammaEncodingParams.data(); options.dstAlphaMode = GetParam().mDstAlphaMode; - std::vector sourceTextureData = GetSourceData(options.srcAlphaMode); + std::vector sourceTextureData = GetSourceData(options.srcAlphaMode); const wgpu::Extent3D& copySize = {kWidth, kHeight}; const utils::TextureDataCopyLayout srcCopyLayout = @@ -973,7 +1034,7 @@ class CopyTextureForBrowser_ColorSpace wgpu::TextureUsage::TextureBinding; wgpu::Texture srcTexture = this->CreateAndInitTexture( srcTextureSpec, srcUsage, srcCopyLayout, sourceTextureData.data(), - sourceTextureData.size() * sizeof(RGBA8)); + sourceTextureData.size() * sizeof(utils::RGBA8)); // Create dst texture. wgpu::Texture dstTexture = this->CreateTexture( @@ -1084,7 +1145,8 @@ DAWN_INSTANTIATE_TEST_P( CopyTextureForBrowser_Formats, {D3D12Backend(), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, std::vector({wgpu::TextureFormat::RGBA8Unorm, - wgpu::TextureFormat::BGRA8Unorm}), + wgpu::TextureFormat::BGRA8Unorm, + wgpu::TextureFormat::RGBA16Float}), std::vector( {wgpu::TextureFormat::R8Unorm, wgpu::TextureFormat::R16Float, wgpu::TextureFormat::R32Float, wgpu::TextureFormat::RG8Unorm, wgpu::TextureFormat::RG16Float, @@ -1134,13 +1196,13 @@ TEST_P(CopyTextureForBrowser_AlphaMode, alphaMode) { DoAlphaModeTest(); } -DAWN_INSTANTIATE_TEST_P(CopyTextureForBrowser_AlphaMode, - {D3D12Backend(), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), - VulkanBackend()}, - std::vector({wgpu::AlphaMode::Premultiplied, - wgpu::AlphaMode::Unpremultiplied}), - std::vector({wgpu::AlphaMode::Premultiplied, - wgpu::AlphaMode::Unpremultiplied})); +DAWN_INSTANTIATE_TEST_P( + CopyTextureForBrowser_AlphaMode, + {D3D12Backend(), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, + std::vector({wgpu::AlphaMode::Premultiplied, wgpu::AlphaMode::Unpremultiplied, + wgpu::AlphaMode::Opaque}), + std::vector({wgpu::AlphaMode::Premultiplied, wgpu::AlphaMode::Unpremultiplied, + wgpu::AlphaMode::Opaque})); // Verify |CopyTextureForBrowser| doing color space conversion. TEST_P(CopyTextureForBrowser_ColorSpace, colorSpaceConversion) { diff --git a/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp b/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp index 6b9575533c..3dd5ee23c8 100644 --- a/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp +++ b/src/dawn/tests/end2end/CreatePipelineAsyncTests.cpp @@ -101,7 +101,7 @@ class CreatePipelineAsyncTest : public DawnTest { queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), outputTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 255, 0, 255), outputTexture, 0, 0); } void ValidateCreateRenderPipelineAsync() { ValidateCreateRenderPipelineAsync(&task); } @@ -135,7 +135,7 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateComputePipelineAsync) { } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); csDesc.compute.entryPoint = "main"; @@ -165,7 +165,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseEntryPointAfterCreatComputePipelineAsync) } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); @@ -204,7 +204,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) { } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); csDesc.compute.entryPoint = "main0"; @@ -236,11 +236,11 @@ TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateRenderPipelineAsync) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -260,11 +260,11 @@ TEST_P(CreatePipelineAsyncTest, ReleaseEntryPointsAfterCreateRenderPipelineAsync utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -311,7 +311,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseEntryPointsAfterCreateRenderPipelineAsync queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), outputTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 255, 0, 255), outputTexture, 0, 0); } // Verify CreateRenderPipelineAsync() works as expected when there is any error that happens during @@ -325,11 +325,11 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -363,7 +363,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) { TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipelineAsync) { wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); csDesc.compute.entryPoint = "main"; @@ -387,11 +387,11 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipeli TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelineAsync) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -419,7 +419,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelin TEST_P(CreatePipelineAsyncTest, DestroyDeviceBeforeCallbackOfCreateComputePipelineAsync) { wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); csDesc.compute.entryPoint = "main"; @@ -444,11 +444,11 @@ TEST_P(CreatePipelineAsyncTest, DestroyDeviceBeforeCallbackOfCreateComputePipeli TEST_P(CreatePipelineAsyncTest, DestroyDeviceBeforeCallbackOfCreateRenderPipelineAsync) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -482,7 +482,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwice) { } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); csDesc.compute.entryPoint = "main"; @@ -541,7 +541,7 @@ TEST_P(CreatePipelineAsyncTest, CreateSameComputePipelineTwiceAtSameTime) { } @group(0) @binding(0) var ssbo : SSBO; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { ssbo.value = 1u; })"); csDesc.compute.entryPoint = "main"; @@ -578,11 +578,11 @@ TEST_P(CreatePipelineAsyncTest, CreateSameRenderPipelineTwiceAtSameTime) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); renderPipelineDescriptor.vertex.module = vsModule; @@ -639,7 +639,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithVertexBufferLayouts @builtin(position) position: vec4, } - @stage(vertex) + @vertex fn main(vertexInput : VertexInput) -> VertexOutput { var vertexOutput : VertexOutput; vertexOutput.position = vec4(0.0, 0.0, 0.0, 1.0); @@ -651,7 +651,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithVertexBufferLayouts return vertexOutput; })"); renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) fragColorIn : vec4) -> @location(0) vec4 { return fragColorIn; })"); @@ -703,7 +703,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithVertexBufferLayouts // The color attachment will have the expected color when the vertex attribute values are // fetched correctly. - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderTarget, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 255, 0, 255), renderTarget, 0, 0); } // Verify calling CreateRenderPipelineAsync() with valid depthStencilState works on all backends. @@ -731,12 +731,12 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithDepthStencilState) { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); @@ -776,7 +776,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithDepthStencilState) // The color in the color attachment should not be changed after the draw call as no pixel can // pass the stencil test. - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderTarget, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 255, 0, 255), renderTarget, 0, 0); } // Verify calling CreateRenderPipelineAsync() with multisample.Count > 1 works on all backends. @@ -803,12 +803,12 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineWithMultisampleState) { { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -842,7 +842,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineWithMultisampleState) { queue.Submit(1, &commands); // The color in resolveTarget should be the expected color (0, 1, 0, 1). - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), resolveTarget, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 255, 0, 255), resolveTarget, 0, 0); } // Verify calling CreateRenderPipelineAsync() with valid BlendState works on all backends. @@ -875,7 +875,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithBlendState) { { utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -885,7 +885,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithBlendState) { @location(1) fragColor1 : vec4, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.fragColor0 = vec4(0.4, 0.0, 0.0, 0.4); output.fragColor1 = vec4(0.0, 1.0, 0.0, 1.0); @@ -946,8 +946,8 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithBlendState) { // When the blend states are all set correctly, the color of renderTargets[0] should be // (0.6, 0, 0, 0.6) = colorAttachment0.clearValue + (0.4, 0.0, 0.0, 0.4), and the color of // renderTargets[1] should be (0.8, 0, 0, 0.8) = (1, 0, 0, 1) - colorAttachment1.clearValue. - RGBA8 expected0 = {153, 0, 0, 153}; - RGBA8 expected1 = {0, 204, 0, 204}; + utils::RGBA8 expected0 = {153, 0, 0, 153}; + utils::RGBA8 expected1 = {0, 204, 0, 204}; EXPECT_PIXEL_RGBA8_EQ(expected0, renderTargets[0], 0, 0); EXPECT_PIXEL_RGBA8_EQ(expected1, renderTargets[1], 0, 0); } diff --git a/src/dawn/tests/end2end/CullingTests.cpp b/src/dawn/tests/end2end/CullingTests.cpp index d37a70b824..8364271013 100644 --- a/src/dawn/tests/end2end/CullingTests.cpp +++ b/src/dawn/tests/end2end/CullingTests.cpp @@ -26,7 +26,7 @@ class CullingTest : public DawnTest { // 1. The top-left one is counterclockwise (CCW) // 2. The bottom-right one is clockwise (CW) pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, 1.0), @@ -42,7 +42,7 @@ class CullingTest : public DawnTest { // RGBA8 format for the back buffer. So (FragCoord.xy - vec2(0.5)) / 255 in shader code // will make the pixel's R and G channels exactly equal to the pixel's x and y coordinates. pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return vec4( (FragCoord.xy - vec2(0.5, 0.5)) / vec2(255.0, 255.0), @@ -86,14 +86,15 @@ class CullingTest : public DawnTest { wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); queue.Submit(1, &commandBuffer); - const RGBA8 kBackgroundColor = RGBA8::kBlue; - const RGBA8 kTopLeftColor = RGBA8::kBlack; - constexpr RGBA8 kBottomRightColor = RGBA8(3, 3, 0, 255); + const utils::RGBA8 kBackgroundColor = utils::RGBA8::kBlue; + const utils::RGBA8 kTopLeftColor = utils::RGBA8::kBlack; + constexpr utils::RGBA8 kBottomRightColor = utils::RGBA8(3, 3, 0, 255); - RGBA8 kCCWTriangleTopLeftColor = isCCWTriangleCulled ? kBackgroundColor : kTopLeftColor; + utils::RGBA8 kCCWTriangleTopLeftColor = + isCCWTriangleCulled ? kBackgroundColor : kTopLeftColor; EXPECT_PIXEL_RGBA8_EQ(kCCWTriangleTopLeftColor, colorTexture, 0, 0); - RGBA8 kCWTriangleBottomRightColor = + utils::RGBA8 kCWTriangleBottomRightColor = isCWTriangleCulled ? kBackgroundColor : kBottomRightColor; EXPECT_PIXEL_RGBA8_EQ(kCWTriangleBottomRightColor, colorTexture, kSize - 1, kSize - 1); } diff --git a/src/dawn/tests/end2end/D3D12CachingTests.cpp b/src/dawn/tests/end2end/D3D12CachingTests.cpp index c895a534b0..0d3bcdf024 100644 --- a/src/dawn/tests/end2end/D3D12CachingTests.cpp +++ b/src/dawn/tests/end2end/D3D12CachingTests.cpp @@ -17,7 +17,7 @@ #include #include "dawn/tests/DawnTest.h" -#include "dawn/tests/end2end/mocks/CachingInterfaceMock.h" +#include "dawn/tests/mocks/platform/CachingInterfaceMock.h" #include "dawn/utils/ComboRenderPipelineDescriptor.h" #include "dawn/utils/WGPUHelpers.h" @@ -45,11 +45,11 @@ TEST_P(D3D12CachingTests, SameShaderNoCache) { mMockCache.Disable(); wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -82,11 +82,11 @@ TEST_P(D3D12CachingTests, SameShaderNoCache) { // entrypoints) TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -115,11 +115,11 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) { // Modify the WGSL shader functions and make sure it doesn't hit. wgpu::ShaderModule newModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } )"); @@ -144,11 +144,11 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) { } @binding(0) @group(0) var data : Data; - @stage(compute) @workgroup_size(1) fn write1() { + @compute @workgroup_size(1) fn write1() { data.data = 1u; } - @stage(compute) @workgroup_size(1) fn write42() { + @compute @workgroup_size(1) fn write42() { data.data = 42u; } )"); diff --git a/src/dawn/tests/end2end/D3D12ResourceWrappingTests.cpp b/src/dawn/tests/end2end/D3D12ResourceWrappingTests.cpp index ce81ec2d3f..d3112fe1e4 100644 --- a/src/dawn/tests/end2end/D3D12ResourceWrappingTests.cpp +++ b/src/dawn/tests/end2end/D3D12ResourceWrappingTests.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include #include #include @@ -30,9 +31,28 @@ using Microsoft::WRL::ComPtr; namespace { +enum class SyncMode { + kKeyedMutex, + kFence, +}; + +std::ostream& operator<<(std::ostream& o, const SyncMode& m) { + switch (m) { + case SyncMode::kKeyedMutex: + o << "KeyedMutex"; + break; + case SyncMode::kFence: + o << "Fence"; + break; + } + return o; +} + +DAWN_TEST_PARAM_STRUCT(D3D12ResourceTestParams, SyncMode); + using dawn::native::d3d12::kDXGIKeyedMutexAcquireReleaseKey; -class D3D12ResourceTestBase : public DawnTest { +class D3D12ResourceTestBase : public DawnTestWithParams { protected: std::vector GetRequiredFeatures() override { return {wgpu::FeatureName::DawnInternalUsages}; @@ -40,7 +60,7 @@ class D3D12ResourceTestBase : public DawnTest { public: void SetUp() override { - DawnTest::SetUp(); + DawnTestWithParams::SetUp(); if (UsesWire()) { return; } @@ -88,8 +108,12 @@ class D3D12ResourceTestBase : public DawnTest { baseD3dDescriptor.Usage = D3D11_USAGE_DEFAULT; baseD3dDescriptor.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; baseD3dDescriptor.CPUAccessFlags = 0; - baseD3dDescriptor.MiscFlags = - D3D11_RESOURCE_MISC_SHARED_NTHANDLE | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX; + baseD3dDescriptor.MiscFlags = D3D11_RESOURCE_MISC_SHARED_NTHANDLE; + if (GetParam().mSyncMode == SyncMode::kKeyedMutex) { + baseD3dDescriptor.MiscFlags |= D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX; + } else { + baseD3dDescriptor.MiscFlags |= D3D11_RESOURCE_MISC_SHARED; + } } protected: @@ -98,7 +122,8 @@ class D3D12ResourceTestBase : public DawnTest { const D3D11_TEXTURE2D_DESC* baseD3dDescriptor, wgpu::Texture* dawnTexture, ID3D11Texture2D** d3d11TextureOut, - std::unique_ptr* externalImageOut = nullptr) const { + std::unique_ptr* externalImageOut = nullptr, + uint64_t fenceSignalValue = 1) const { ComPtr d3d11Texture; HRESULT hr = mD3d11Device->CreateTexture2D(baseD3dDescriptor, nullptr, &d3d11Texture); ASSERT_EQ(hr, S_OK); @@ -107,34 +132,56 @@ class D3D12ResourceTestBase : public DawnTest { hr = d3d11Texture.As(&dxgiResource); ASSERT_EQ(hr, S_OK); - HANDLE sharedHandle; + HANDLE textureSharedHandle; hr = dxgiResource->CreateSharedHandle( nullptr, DXGI_SHARED_RESOURCE_READ | DXGI_SHARED_RESOURCE_WRITE, nullptr, - &sharedHandle); + &textureSharedHandle); ASSERT_EQ(hr, S_OK); + HANDLE fenceSharedHandle = nullptr; + ComPtr d3d11Fence; + + if (GetParam().mSyncMode == SyncMode::kFence) { + ComPtr d3d11Device5; + hr = mD3d11Device.As(&d3d11Device5); + ASSERT_EQ(hr, S_OK); + + hr = d3d11Device5->CreateFence(0, D3D11_FENCE_FLAG_SHARED, IID_PPV_ARGS(&d3d11Fence)); + ASSERT_EQ(hr, S_OK); + + hr = d3d11Fence->CreateSharedHandle(nullptr, GENERIC_ALL, nullptr, &fenceSharedHandle); + ASSERT_EQ(hr, S_OK); + } + dawn::native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc; externalImageDesc.cTextureDescriptor = reinterpret_cast(dawnDesc); - externalImageDesc.sharedHandle = sharedHandle; + externalImageDesc.textureSharedHandle = textureSharedHandle; + externalImageDesc.fenceSharedHandle = fenceSharedHandle; std::unique_ptr externalImage = dawn::native::d3d12::ExternalImageDXGI::Create(device.Get(), &externalImageDesc); // Now that we've created all of our resources, we can close the handle // since we no longer need it. - ::CloseHandle(sharedHandle); + ::CloseHandle(textureSharedHandle); + if (fenceSharedHandle != nullptr) { + ::CloseHandle(fenceSharedHandle); + } // Cannot access a non-existent external image (ex. validation error). if (externalImage == nullptr) { return; } - dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + dawn::native::d3d12::ExternalImageAccessDescriptorDXGISharedHandle externalAccessDesc; externalAccessDesc.usage = static_cast(dawnDesc->usage); + if (d3d11Fence != nullptr) { + externalAccessDesc.fenceWaitValue = 0; + externalAccessDesc.fenceSignalValue = fenceSignalValue; + } - *dawnTexture = wgpu::Texture::Acquire( - externalImage->ProduceTexture(device.Get(), &externalAccessDesc)); + *dawnTexture = wgpu::Texture::Acquire(externalImage->ProduceTexture(&externalAccessDesc)); *d3d11TextureOut = d3d11Texture.Detach(); if (externalImageOut != nullptr) { @@ -340,70 +387,113 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase { queue.Submit(1, &commands); } - void WrapAndClearD3D11Texture(const wgpu::TextureDescriptor* dawnDescriptor, - const D3D11_TEXTURE2D_DESC* d3dDescriptor, - wgpu::Texture* dawnTextureOut, + void WrapAndClearD3D11Texture(const wgpu::TextureDescriptor& dawnDescriptor, + const D3D11_TEXTURE2D_DESC& d3dDescriptor, const wgpu::Color& clearColor, + wgpu::Texture* dawnTextureOut, ID3D11Texture2D** d3d11TextureOut, - IDXGIKeyedMutex** dxgiKeyedMutexOut, - bool isInitialized = true) const { + bool isInitialized = true, + IDXGIKeyedMutex** dxgiKeyedMutexOut = nullptr, + ID3D11Fence** d3d11FenceOut = nullptr, + uint64_t* nextFenceWaitValue = nullptr) const { ComPtr d3d11Texture; - HRESULT hr = mD3d11Device->CreateTexture2D(d3dDescriptor, nullptr, &d3d11Texture); + HRESULT hr = mD3d11Device->CreateTexture2D(&d3dDescriptor, nullptr, &d3d11Texture); ASSERT_EQ(hr, S_OK); ComPtr dxgiResource; hr = d3d11Texture.As(&dxgiResource); ASSERT_EQ(hr, S_OK); - HANDLE sharedHandle; + HANDLE textureSharedHandle; hr = dxgiResource->CreateSharedHandle( nullptr, DXGI_SHARED_RESOURCE_READ | DXGI_SHARED_RESOURCE_WRITE, nullptr, - &sharedHandle); + &textureSharedHandle); ASSERT_EQ(hr, S_OK); ComPtr dxgiKeyedMutex; - hr = d3d11Texture.As(&dxgiKeyedMutex); - ASSERT_EQ(hr, S_OK); + + HANDLE fenceSharedHandle = nullptr; + ComPtr d3d11Fence; + + ComPtr d3d11DeviceContext4; + + if (GetParam().mSyncMode == SyncMode::kKeyedMutex) { + hr = d3d11Texture.As(&dxgiKeyedMutex); + ASSERT_EQ(hr, S_OK); + + hr = dxgiKeyedMutex->AcquireSync(kDXGIKeyedMutexAcquireReleaseKey, INFINITE); + ASSERT_EQ(hr, S_OK); + } else { + ComPtr d3d11Device5; + hr = mD3d11Device.As(&d3d11Device5); + ASSERT_EQ(hr, S_OK); + + hr = d3d11Device5->CreateFence(0, D3D11_FENCE_FLAG_SHARED, IID_PPV_ARGS(&d3d11Fence)); + ASSERT_EQ(hr, S_OK); + + hr = d3d11Fence->CreateSharedHandle(nullptr, GENERIC_ALL, nullptr, &fenceSharedHandle); + ASSERT_EQ(hr, S_OK); + } ComPtr d3d11RTV; hr = mD3d11Device->CreateRenderTargetView(d3d11Texture.Get(), nullptr, &d3d11RTV); ASSERT_EQ(hr, S_OK); - hr = dxgiKeyedMutex->AcquireSync(kDXGIKeyedMutexAcquireReleaseKey, INFINITE); - ASSERT_EQ(hr, S_OK); - const float colorRGBA[] = { static_cast(clearColor.r), static_cast(clearColor.g), static_cast(clearColor.b), static_cast(clearColor.a)}; mD3d11DeviceContext->ClearRenderTargetView(d3d11RTV.Get(), colorRGBA); - hr = dxgiKeyedMutex->ReleaseSync(kDXGIKeyedMutexAcquireReleaseKey); - ASSERT_EQ(hr, S_OK); - dawn::native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc = {}; - externalImageDesc.sharedHandle = sharedHandle; + externalImageDesc.textureSharedHandle = textureSharedHandle; + externalImageDesc.fenceSharedHandle = fenceSharedHandle; externalImageDesc.cTextureDescriptor = - reinterpret_cast(dawnDescriptor); + reinterpret_cast(&dawnDescriptor); + + dawn::native::d3d12::ExternalImageAccessDescriptorDXGISharedHandle externalAccessDesc; + externalAccessDesc.isInitialized = isInitialized; + externalAccessDesc.usage = static_cast(dawnDescriptor.usage); + + if (dxgiKeyedMutex) { + hr = dxgiKeyedMutex->ReleaseSync(kDXGIKeyedMutexAcquireReleaseKey); + ASSERT_EQ(hr, S_OK); + } else { + hr = mD3d11DeviceContext.As(&d3d11DeviceContext4); + ASSERT_EQ(hr, S_OK); + + // The fence starts with 0 signaled, but that won't capture the render target view clear + // above, so signal explicitly with 1 and make the next Dawn access wait on 1. + d3d11DeviceContext4->Signal(d3d11Fence.Get(), 1); + + externalAccessDesc.fenceWaitValue = 1; + externalAccessDesc.fenceSignalValue = 2; + } std::unique_ptr externalImage = dawn::native::d3d12::ExternalImageDXGI::Create(device.Get(), &externalImageDesc); - dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; - externalAccessDesc.isInitialized = isInitialized; - externalAccessDesc.usage = static_cast(dawnDescriptor->usage); - - *dawnTextureOut = wgpu::Texture::Acquire( - externalImage->ProduceTexture(device.Get(), &externalAccessDesc)); + *dawnTextureOut = + wgpu::Texture::Acquire(externalImage->ProduceTexture(&externalAccessDesc)); *d3d11TextureOut = d3d11Texture.Detach(); - *dxgiKeyedMutexOut = dxgiKeyedMutex.Detach(); + + if (dxgiKeyedMutexOut != nullptr) { + *dxgiKeyedMutexOut = dxgiKeyedMutex.Detach(); + } + + if (d3d11FenceOut != nullptr) { + *d3d11FenceOut = d3d11Fence.Detach(); + } + + if (nextFenceWaitValue != nullptr) { + *nextFenceWaitValue = externalAccessDesc.fenceSignalValue; + } } void ExpectPixelRGBA8EQ(ID3D11Texture2D* d3d11Texture, IDXGIKeyedMutex* dxgiKeyedMutex, + ID3D11Fence* d3d11Fence, + uint64_t fenceWaitValue, const wgpu::Color& color) { - HRESULT hr = dxgiKeyedMutex->AcquireSync(kDXGIKeyedMutexAcquireReleaseKey, INFINITE); - ASSERT_EQ(hr, S_OK); - D3D11_TEXTURE2D_DESC texture2DDesc; d3d11Texture->GetDesc(&texture2DDesc); @@ -418,7 +508,8 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase { D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE); // CPUAccessFlags ComPtr spD3DTextureStaging; - hr = mD3d11Device->CreateTexture2D(&texture2DStagingDesc, nullptr, &spD3DTextureStaging); + HRESULT hr = + mD3d11Device->CreateTexture2D(&texture2DStagingDesc, nullptr, &spD3DTextureStaging); ASSERT_EQ(hr, S_OK); D3D11_BOX d3dRc; @@ -429,6 +520,19 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase { d3dRc.bottom = texture2DDesc.Height; d3dRc.right = texture2DDesc.Width; + if (dxgiKeyedMutex != nullptr) { + hr = dxgiKeyedMutex->AcquireSync(kDXGIKeyedMutexAcquireReleaseKey, INFINITE); + ASSERT_EQ(hr, S_OK); + } + if (d3d11Fence != nullptr) { + ComPtr d3d11DeviceContext4; + hr = mD3d11DeviceContext.As(&d3d11DeviceContext4); + ASSERT_EQ(hr, S_OK); + + hr = d3d11DeviceContext4->Wait(d3d11Fence, fenceWaitValue); + ASSERT_EQ(hr, S_OK); + } + mD3d11DeviceContext->CopySubresourceRegion(spD3DTextureStaging.Get(), // pDstResource 0, // DstSubresource 0, // DstX @@ -451,8 +555,10 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase { mD3d11DeviceContext->Unmap(spD3DTextureStaging.Get(), 0); - hr = dxgiKeyedMutex->ReleaseSync(kDXGIKeyedMutexAcquireReleaseKey); - ASSERT_EQ(hr, S_OK); + if (dxgiKeyedMutex != nullptr) { + hr = dxgiKeyedMutex->ReleaseSync(kDXGIKeyedMutexAcquireReleaseKey); + ASSERT_EQ(hr, S_OK); + } } }; @@ -465,9 +571,8 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11CopyAndReadbackInD3D12) { const wgpu::Color clearColor{1.0f, 1.0f, 0.0f, 1.0f}; wgpu::Texture dawnSrcTexture; ComPtr d3d11Texture; - ComPtr dxgiKeyedMutex; - WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnSrcTexture, clearColor, - &d3d11Texture, &dxgiKeyedMutex); + WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, clearColor, &dawnSrcTexture, + &d3d11Texture); ASSERT_NE(dawnSrcTexture.Get(), nullptr); // Create a texture on the device and copy the source texture to it. @@ -476,9 +581,9 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11CopyAndReadbackInD3D12) { // Readback the destination texture and ensure it contains the colors we used // to clear the source texture on the D3D device. - EXPECT_PIXEL_RGBA8_EQ( - RGBA8(clearColor.r * 255u, clearColor.g * 255u, clearColor.b * 255u, clearColor.a * 255u), - dawnCopyDestTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(clearColor.r * 255u, clearColor.g * 255u, + clearColor.b * 255u, clearColor.a * 255u), + dawnCopyDestTexture, 0, 0); } // 1. Create and clear a D3D11 texture @@ -489,16 +594,15 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D11ReadbackInD3D12) { const wgpu::Color clearColor{1.0f, 1.0f, 0.0f, 1.0f}; wgpu::Texture dawnTexture; ComPtr d3d11Texture; - ComPtr dxgiKeyedMutex; - WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, clearColor, - &d3d11Texture, &dxgiKeyedMutex); + WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, clearColor, &dawnTexture, + &d3d11Texture); ASSERT_NE(dawnTexture.Get(), nullptr); // Readback the destination texture and ensure it contains the colors we used // to clear the source texture on the D3D device. - EXPECT_PIXEL_RGBA8_EQ( - RGBA8(clearColor.r * 255, clearColor.g * 255, clearColor.b * 255, clearColor.a * 255), - dawnTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(clearColor.r * 255, clearColor.g * 255, clearColor.b * 255, + clearColor.a * 255), + dawnTexture, 0, 0); } // 1. Create and clear a D3D11 texture @@ -515,8 +619,11 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D12ReadbackInD3D11) { wgpu::Texture dawnTexture; ComPtr d3d11Texture; ComPtr dxgiKeyedMutex; - WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, d3d11ClearColor, - &d3d11Texture, &dxgiKeyedMutex); + ComPtr d3d11Fence; + uint64_t nextFenceWaitValue; + WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, d3d11ClearColor, &dawnTexture, + &d3d11Texture, /*isInitialized=*/true, &dxgiKeyedMutex, &d3d11Fence, + &nextFenceWaitValue); ASSERT_NE(dawnTexture.Get(), nullptr); const wgpu::Color d3d12ClearColor{0.0f, 0.0f, 1.0f, 1.0f}; @@ -527,7 +634,8 @@ TEST_P(D3D12SharedHandleUsageTests, ClearInD3D12ReadbackInD3D11) { // Now that Dawn (via D3D12) has finished writing to the texture, we should be // able to read it back by copying it to a staging texture and verifying the // color matches the D3D12 clear color. - ExpectPixelRGBA8EQ(d3d11Texture.Get(), dxgiKeyedMutex.Get(), d3d12ClearColor); + ExpectPixelRGBA8EQ(d3d11Texture.Get(), dxgiKeyedMutex.Get(), d3d11Fence.Get(), + nextFenceWaitValue, d3d12ClearColor); } // 1. Create and clear a D3D11 texture @@ -545,8 +653,11 @@ TEST_P(D3D12SharedHandleUsageTests, ClearTwiceInD3D12ReadbackInD3D11) { wgpu::Texture dawnTexture; ComPtr d3d11Texture; ComPtr dxgiKeyedMutex; - WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, d3d11ClearColor, - &d3d11Texture, &dxgiKeyedMutex); + ComPtr d3d11Fence; + uint64_t nextFenceWaitValue; + WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, d3d11ClearColor, &dawnTexture, + &d3d11Texture, /*isInitialized=*/true, &dxgiKeyedMutex, &d3d11Fence, + &nextFenceWaitValue); ASSERT_NE(dawnTexture.Get(), nullptr); const wgpu::Color d3d12ClearColor1{0.0f, 0.0f, 1.0f, 1.0f}; @@ -560,7 +671,8 @@ TEST_P(D3D12SharedHandleUsageTests, ClearTwiceInD3D12ReadbackInD3D11) { // Now that Dawn (via D3D12) has finished writing to the texture, we should be // able to read it back by copying it to a staging texture and verifying the // color matches the last D3D12 clear color. - ExpectPixelRGBA8EQ(d3d11Texture.Get(), dxgiKeyedMutex.Get(), d3d12ClearColor2); + ExpectPixelRGBA8EQ(d3d11Texture.Get(), dxgiKeyedMutex.Get(), d3d11Fence.Get(), + nextFenceWaitValue, d3d12ClearColor2); } // 1. Create and clear a D3D11 texture with clearColor @@ -572,14 +684,13 @@ TEST_P(D3D12SharedHandleUsageTests, UninitializedTextureIsCleared) { const wgpu::Color clearColor{1.0f, 0.0f, 0.0f, 1.0f}; wgpu::Texture dawnTexture; ComPtr d3d11Texture; - ComPtr dxgiKeyedMutex; - WrapAndClearD3D11Texture(&baseDawnDescriptor, &baseD3dDescriptor, &dawnTexture, clearColor, - &d3d11Texture, &dxgiKeyedMutex, false); + WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, clearColor, &dawnTexture, + &d3d11Texture, /*isInitialized=*/false); ASSERT_NE(dawnTexture.Get(), nullptr); // Readback the destination texture and ensure it contains the colors we used // to clear the source texture on the D3D device. - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), dawnTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 0, 0, 0), dawnTexture, 0, 0); } // 1. Create an external image from the DX11 texture. @@ -593,13 +704,13 @@ TEST_P(D3D12SharedHandleUsageTests, ReuseExternalImage) { ComPtr d3d11Texture; std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, - &externalImage); + &externalImage, /*fenceSignalValue=*/1); { const wgpu::Color solidRed{1.0f, 0.0f, 0.0f, 1.0f}; ASSERT_NE(texture.Get(), nullptr); ClearImage(texture.Get(), solidRed, device); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0xFF, 0, 0, 0xFF), texture.Get(), 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0xFF, 0, 0, 0xFF), texture.Get(), 0, 0); } // Once finished with the first texture, destroy it so we may re-acquire the external image @@ -607,15 +718,16 @@ TEST_P(D3D12SharedHandleUsageTests, ReuseExternalImage) { texture.Destroy(); // Create another Dawn texture then clear it with another color. - dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + dawn::native::d3d12::ExternalImageAccessDescriptorDXGISharedHandle externalAccessDesc; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = static_cast(baseDawnDescriptor.usage); + externalAccessDesc.fenceWaitValue = 1; + externalAccessDesc.fenceSignalValue = 2; - texture = - wgpu::Texture::Acquire(externalImage->ProduceTexture(device.Get(), &externalAccessDesc)); + texture = wgpu::Texture::Acquire(externalImage->ProduceTexture(&externalAccessDesc)); // Check again that the new texture is still red - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0xFF, 0, 0, 0xFF), texture.Get(), 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0xFF, 0, 0, 0xFF), texture.Get(), 0, 0); // Clear the new texture to blue { @@ -623,50 +735,47 @@ TEST_P(D3D12SharedHandleUsageTests, ReuseExternalImage) { ASSERT_NE(texture.Get(), nullptr); ClearImage(texture.Get(), solidBlue, device); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0xFF, 0xFF), texture.Get(), 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 0, 0xFF, 0xFF), texture.Get(), 0, 0); } + + texture.Destroy(); } -TEST_P(D3D12SharedHandleUsageTests, RecursiveExternalImageAccess) { +TEST_P(D3D12SharedHandleUsageTests, ConcurrentExternalImageReadAccess) { DAWN_TEST_UNSUPPORTED_IF(UsesWire()); - // Create the first Dawn texture then clear it to red. - wgpu::Texture texture1; + // Create Dawn texture with write access, then clear it to red. + wgpu::Texture texture; ComPtr d3d11Texture; std::unique_ptr externalImage; - WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture1, &d3d11Texture, - &externalImage); + WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, + &externalImage, /*fenceSignalValue=*/1); { const wgpu::Color solidRed{1.0f, 0.0f, 0.0f, 1.0f}; - ASSERT_NE(texture1.Get(), nullptr); - ClearImage(texture1.Get(), solidRed, device); + ASSERT_NE(texture.Get(), nullptr); + ClearImage(texture.Get(), solidRed, device); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0xFF, 0, 0, 0xFF), texture1.Get(), 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0xFF, 0, 0, 0xFF), texture.Get(), 0, 0); } - // Create another Dawn texture then clear it with another color. - dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + texture.Destroy(); + + // Create two Dawn textures for concurrent read. + dawn::native::d3d12::ExternalImageAccessDescriptorDXGISharedHandle externalAccessDesc; externalAccessDesc.isInitialized = true; - externalAccessDesc.usage = static_cast(baseDawnDescriptor.usage); + externalAccessDesc.usage = WGPUTextureUsage_CopySrc; + externalAccessDesc.fenceWaitValue = 1; + externalAccessDesc.fenceSignalValue = 2; + + wgpu::Texture texture1 = + wgpu::Texture::Acquire(externalImage->ProduceTexture(&externalAccessDesc)); - // Acquire the ExternalImageDXGI again without destroying the original texture. wgpu::Texture texture2 = - wgpu::Texture::Acquire(externalImage->ProduceTexture(device.Get(), &externalAccessDesc)); + wgpu::Texture::Acquire(externalImage->ProduceTexture(&externalAccessDesc)); - // Check again that the new texture is still red - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0xFF, 0, 0, 0xFF), texture2.Get(), 0, 0); - - // Clear the new texture to blue - { - const wgpu::Color solidBlue{0.0f, 0.0f, 1.0f, 1.0f}; - ASSERT_NE(texture2.Get(), nullptr); - ClearImage(texture2.Get(), solidBlue, device); - - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0xFF, 0xFF), texture2.Get(), 0, 0); - } - - // Check that the original texture is also blue - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0xFF, 0xFF), texture1.Get(), 0, 0); + // Check again that the new textures are also red. + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0xFF, 0, 0, 0xFF), texture1.Get(), 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0xFF, 0, 0, 0xFF), texture2.Get(), 0, 0); texture1.Destroy(); texture2.Destroy(); @@ -676,72 +785,95 @@ TEST_P(D3D12SharedHandleUsageTests, RecursiveExternalImageAccess) { TEST_P(D3D12SharedHandleUsageTests, ExternalImageUsage) { DAWN_TEST_UNSUPPORTED_IF(UsesWire()); - dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; - externalAccessDesc.isInitialized = true; - wgpu::Texture texture; ComPtr d3d11Texture; std::unique_ptr externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, - &externalImage); + &externalImage, /*fenceSignalValue=*/1); ASSERT_NE(texture.Get(), nullptr); + dawn::native::d3d12::ExternalImageAccessDescriptorDXGISharedHandle externalAccessDesc; + externalAccessDesc.isInitialized = true; externalAccessDesc.usage = WGPUTextureUsage_StorageBinding; - texture = - wgpu::Texture::Acquire(externalImage->ProduceTexture(device.Get(), &externalAccessDesc)); + externalAccessDesc.fenceWaitValue = 1; + externalAccessDesc.fenceSignalValue = 0; // No need to signal + texture = wgpu::Texture::Acquire(externalImage->ProduceTexture(&externalAccessDesc)); ASSERT_EQ(texture.Get(), nullptr); externalAccessDesc.usage = WGPUTextureUsage_TextureBinding; - texture = - wgpu::Texture::Acquire(externalImage->ProduceTexture(device.Get(), &externalAccessDesc)); + texture = wgpu::Texture::Acquire(externalImage->ProduceTexture(&externalAccessDesc)); ASSERT_NE(texture.Get(), nullptr); } -// Verify two Dawn devices can reuse the same external image. -TEST_P(D3D12SharedHandleUsageTests, ReuseExternalImageWithMultipleDevices) { +// Verify external image cannot be used after its creating device is destroyed. +TEST_P(D3D12SharedHandleUsageTests, InvalidateExternalImageOnDestroyDevice) { DAWN_TEST_UNSUPPORTED_IF(UsesWire()); wgpu::Texture texture; ComPtr d3d11Texture; std::unique_ptr externalImage; - // Create the Dawn texture then clear it to red using the first (default) device. + // Create the Dawn texture then clear it to red. WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, - &externalImage); + &externalImage, /*fenceSignalValue=*/1); const wgpu::Color solidRed{1.0f, 0.0f, 0.0f, 1.0f}; ASSERT_NE(texture.Get(), nullptr); ClearImage(texture.Get(), solidRed, device); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0xFF, 0, 0, 0xFF), texture.Get(), 0, 0); + // Do not readback pixels since that requires device to be alive during DawnTest::TearDown(). + DestroyDevice(); - // Release the texture so we can re-acquire another one from the same external image. - texture.Destroy(); - - // Create the Dawn texture then clear it to blue using the second device. - dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; - externalAccessDesc.usage = static_cast(baseDawnDescriptor.usage); - - wgpu::Device otherDevice = wgpu::Device::Acquire(GetAdapter().CreateDevice()); - - wgpu::Texture otherTexture = wgpu::Texture::Acquire( - externalImage->ProduceTexture(otherDevice.Get(), &externalAccessDesc)); - - ASSERT_NE(otherTexture.Get(), nullptr); - const wgpu::Color solidBlue{0.0f, 0.0f, 1.0f, 1.0f}; - ClearImage(otherTexture.Get(), solidBlue, otherDevice); - - otherTexture.Destroy(); - - // Re-create the Dawn texture using the first (default) device. + dawn::native::d3d12::ExternalImageAccessDescriptorDXGISharedHandle externalAccessDesc; externalAccessDesc.isInitialized = true; - texture = - wgpu::Texture::Acquire(externalImage->ProduceTexture(device.Get(), &externalAccessDesc)); - ASSERT_NE(texture.Get(), nullptr); + externalAccessDesc.usage = static_cast(baseDawnDescriptor.usage); + externalAccessDesc.fenceWaitValue = 1; + externalAccessDesc.fenceSignalValue = 2; - // Ensure the texture is still blue. - - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0xFF, 0xFF), texture.Get(), 0, 0); + EXPECT_EQ(wgpu::Texture::Acquire(externalImage->ProduceTexture(&externalAccessDesc)), nullptr); } -DAWN_INSTANTIATE_TEST(D3D12SharedHandleValidation, D3D12Backend()); -DAWN_INSTANTIATE_TEST(D3D12SharedHandleUsageTests, D3D12Backend()); +// Verify external image cannot be created after the target device is destroyed. +TEST_P(D3D12SharedHandleUsageTests, DisallowExternalImageAfterDestroyDevice) { + DAWN_TEST_UNSUPPORTED_IF(UsesWire()); + + wgpu::Texture texture; + ComPtr d3d11Texture; + std::unique_ptr externalImage; + + DestroyDevice(); + + ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, + &d3d11Texture, &externalImage, /*fenceSignalValue=*/1)); + + EXPECT_EQ(externalImage, nullptr); + EXPECT_EQ(texture, nullptr); +} + +// Verify there is no error generated when we destroy an external image with CommandRecordingContext +// open. +TEST_P(D3D12SharedHandleUsageTests, CallWriteBufferBeforeDestroyingExternalImage) { + DAWN_TEST_UNSUPPORTED_IF(UsesWire()); + + wgpu::Texture texture; + ComPtr d3d11Texture; + std::unique_ptr externalImage; + WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, + &externalImage, /*fenceSignalValue=*/1); + + // In utils::CreateBufferFromData() we will call queue.WriteBuffer(), which will make a + // recording context pending. + constexpr uint32_t kExpected = 1u; + wgpu::Buffer buffer = utils::CreateBufferFromData( + device, wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst, {kExpected}); + + externalImage = nullptr; + + EXPECT_BUFFER_U32_EQ(kExpected, buffer, 0); +} + +DAWN_INSTANTIATE_TEST_P(D3D12SharedHandleValidation, + {D3D12Backend()}, + {SyncMode::kKeyedMutex, SyncMode::kFence}); +DAWN_INSTANTIATE_TEST_P(D3D12SharedHandleUsageTests, + {D3D12Backend()}, + {SyncMode::kKeyedMutex, SyncMode::kFence}); diff --git a/src/dawn/tests/end2end/DeprecatedAPITests.cpp b/src/dawn/tests/end2end/DeprecatedAPITests.cpp index 0c6d00b1b2..28960b4e5f 100644 --- a/src/dawn/tests/end2end/DeprecatedAPITests.cpp +++ b/src/dawn/tests/end2end/DeprecatedAPITests.cpp @@ -142,7 +142,7 @@ TEST_P(DeprecationTests, EndPass) { // Test that dispatch() and dispatchIndirect() is deprecated. TEST_P(DeprecationTests, Dispatch) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main() { })"); diff --git a/src/dawn/tests/end2end/DepthBiasTests.cpp b/src/dawn/tests/end2end/DepthBiasTests.cpp index 5a6134b0e6..675d7da161 100644 --- a/src/dawn/tests/end2end/DepthBiasTests.cpp +++ b/src/dawn/tests/end2end/DepthBiasTests.cpp @@ -39,7 +39,7 @@ class DepthBiasTests : public DawnTest { case QuadAngle::Flat: // Draw a square at z = 0.25 vertexSource = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -55,7 +55,7 @@ class DepthBiasTests : public DawnTest { case QuadAngle::TiltedX: // Draw a square ranging from 0 to 0.5, bottom to top vertexSource = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec3(-1.0, -1.0, 0.0), @@ -72,7 +72,7 @@ class DepthBiasTests : public DawnTest { wgpu::ShaderModule vertexModule = utils::CreateShaderModule(device, vertexSource); wgpu::ShaderModule fragmentModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); @@ -345,9 +345,9 @@ TEST_P(DepthBiasTests, PositiveBiasOn24bit) { // Only the bottom left quad has colors. 0.5 quad > 0.4 clear. // TODO(crbug.com/dawn/820): Switch to depth sampling once feature has been enabled. - std::vector expected = { - RGBA8::kRed, RGBA8::kRed, // - RGBA8::kRed, RGBA8::kRed, // + std::vector expected = { + utils::RGBA8::kRed, utils::RGBA8::kRed, // + utils::RGBA8::kRed, utils::RGBA8::kRed, // }; EXPECT_TEXTURE_EQ(expected.data(), mRenderTarget, {0, 0}, {kRTSize, kRTSize}); @@ -366,9 +366,9 @@ TEST_P(DepthBiasTests, PositiveBiasOn24bitWithClamp) { // Since we cleared with a depth of 0.4 and clamped bias at 0.4, the depth test will fail. 0.25 // + 0.125 < 0.4 clear. // TODO(crbug.com/dawn/820): Switch to depth sampling once feature has been enabled. - std::vector zero = { - RGBA8::kZero, RGBA8::kZero, // - RGBA8::kZero, RGBA8::kZero, // + std::vector zero = { + utils::RGBA8::kZero, utils::RGBA8::kZero, // + utils::RGBA8::kZero, utils::RGBA8::kZero, // }; EXPECT_TEXTURE_EQ(zero.data(), mRenderTarget, {0, 0}, {kRTSize, kRTSize}); @@ -381,9 +381,9 @@ TEST_P(DepthBiasTests, PositiveSlopeBiasOn24bit) { // Only the top half of the quad has a depth > 0.4 clear // TODO(crbug.com/dawn/820): Switch to depth sampling once feature has been enabled. - std::vector expected = { - RGBA8::kRed, RGBA8::kRed, // - RGBA8::kZero, RGBA8::kZero, // + std::vector expected = { + utils::RGBA8::kRed, utils::RGBA8::kRed, // + utils::RGBA8::kZero, utils::RGBA8::kZero, // }; EXPECT_TEXTURE_EQ(expected.data(), mRenderTarget, {0, 0}, {kRTSize, kRTSize}); diff --git a/src/dawn/tests/end2end/DepthStencilCopyTests.cpp b/src/dawn/tests/end2end/DepthStencilCopyTests.cpp index aef6c3c5e9..1bcd45117b 100644 --- a/src/dawn/tests/end2end/DepthStencilCopyTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilCopyTests.cpp @@ -48,7 +48,7 @@ class DepthStencilCopyTests : public DawnTestWithParams @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -63,12 +63,6 @@ class DepthStencilCopyTests : public DawnTestWithParams GetRequiredFeatures() override { switch (GetParam().mTextureFormat) { - case wgpu::TextureFormat::Depth24UnormStencil8: - if (SupportsFeatures({wgpu::FeatureName::Depth24UnormStencil8})) { - mIsFormatSupported = true; - return {wgpu::FeatureName::Depth24UnormStencil8}; - } - return {}; case wgpu::TextureFormat::Depth32FloatStencil8: if (SupportsFeatures({wgpu::FeatureName::Depth32FloatStencil8})) { mIsFormatSupported = true; @@ -148,12 +142,12 @@ class DepthStencilCopyTests : public DawnTestWithParamsdepthCompare = wgpu::CompareFunction::Always; renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() {} + @fragment fn main() {} )"); } else { depthStencil->depthWriteEnabled = true; renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, std::string(R"( - @stage(fragment) fn main() -> @builtin(frag_depth) f32 { + @fragment fn main() -> @builtin(frag_depth) f32 { return )" + std::to_string(regionDepth) + R"(; })") .c_str()); @@ -221,12 +215,37 @@ class DepthStencilCopyTests : public DawnTestWithParams> testLevel; + uint32_t copyHeight = textureHeight >> testLevel; + wgpu::Extent3D copySize = {copyWidth, copyHeight, 1}; + + constexpr uint32_t kBytesPerRow = kTextureBytesPerRowAlignment; + wgpu::BufferDescriptor bufferDescriptor = {}; + bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + bufferDescriptor.size = + bufferCopyOffset + BufferSizeForTextureCopy(copyWidth, copyHeight, 1, + GetParam().mTextureFormat, + wgpu::TextureAspect::DepthOnly); + wgpu::Buffer destinationBuffer = device.CreateBuffer(&bufferDescriptor); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture( + texture, testLevel, {0, 0, 0}, wgpu::TextureAspect::DepthOnly); + wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer( + destinationBuffer, bufferCopyOffset, kBytesPerRow, copyHeight); + encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size); + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + + if (GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm) { + uint16_t expected = FloatToUnorm(initDepth); + std::vector expectedData = { + 0, 0, 0, 0, // + 0, 0, 0, 0, // + expected, expected, 0, 0, // + expected, expected, 0, 0, // + }; + + for (uint32_t y = 0; y < copyHeight; ++y) { + EXPECT_BUFFER_U16_RANGE_EQ(expectedData.data() + copyWidth * y, destinationBuffer, + bufferCopyOffset + y * kBytesPerRow, copyWidth); + } + + } else { + std::vector expectedData = { + 0.0, 0.0, 0.0, 0.0, // + 0.0, 0.0, 0.0, 0.0, // + initDepth, initDepth, 0.0, 0.0, // + initDepth, initDepth, 0.0, 0.0, // + }; + + for (uint32_t y = 0; y < copyHeight; ++y) { + EXPECT_BUFFER_FLOAT_RANGE_EQ(expectedData.data() + copyWidth * y, destinationBuffer, + bufferCopyOffset + y * kBytesPerRow, copyWidth); + } + } + } +}; // Test copying the depth-only aspect into a buffer. TEST_P(DepthCopyTests, FromDepthAspect) { - // TODO(crbug.com/dawn/1237): Depth16Unorm test failed on OpenGL and OpenGLES which says - // Invalid format and type combination in glReadPixels - DAWN_TEST_UNSUPPORTED_IF(GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm && - (IsOpenGL() || IsOpenGLES())); - - // TODO(crbug.com/dawn/1291): These tests are failing on NVidia GLES - // when using Tint/GLSL. - DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES() && IsNvidia()); - + constexpr float kInitDepth = 0.2f; + constexpr uint32_t kBufferCopyOffset = 0; constexpr uint32_t kWidth = 4; constexpr uint32_t kHeight = 4; + constexpr uint32_t kTestLevel = 0; + DoCopyFromDepthTest(kBufferCopyOffset, kInitDepth, kWidth, kHeight, kTestLevel); +} - wgpu::Texture texture = CreateTexture( - kWidth, kHeight, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc); - +// Test copying the depth-only aspect into a buffer at a non-zero offset. +TEST_P(DepthCopyTests, FromDepthAspectToBufferAtNonZeroOffset) { constexpr float kInitDepth = 0.2f; - InitializeDepthStencilTextureRegion(texture, 0.f, kInitDepth, 0, 0); - - // This expectation is the test as it performs the CopyTextureToBuffer. - if (GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm) { - uint16_t expected = FloatToUnorm(kInitDepth); - std::vector expectedData = { - 0, 0, 0, 0, // - 0, 0, 0, 0, // - expected, expected, 0, 0, // - expected, expected, 0, 0, // - }; - EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, - wgpu::TextureAspect::DepthOnly); - } else { - std::vector expectedData = { - 0.0, 0.0, 0.0, 0.0, // - 0.0, 0.0, 0.0, 0.0, // - kInitDepth, kInitDepth, 0.0, 0.0, // - kInitDepth, kInitDepth, 0.0, 0.0, // - }; - EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, - wgpu::TextureAspect::DepthOnly); + constexpr uint32_t kWidth = 4; + constexpr uint32_t kHeight = 4; + constexpr uint32_t kTestLevel = 0; + constexpr std::array kBufferCopyOffsets = {4u, 512u}; + for (uint32_t offset : kBufferCopyOffsets) { + DoCopyFromDepthTest(offset, kInitDepth, kWidth, kHeight, kTestLevel); } } // Test copying the non-zero mip, depth-only aspect into a buffer. TEST_P(DepthCopyTests, FromNonZeroMipDepthAspect) { - // TODO(crbug.com/dawn/1237): Depth16Unorm test failed on OpenGL and OpenGLES which says - // Invalid format and type combination in glReadPixels - DAWN_TEST_UNSUPPORTED_IF(GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm && - (IsOpenGL() || IsOpenGLES())); - - // TODO(crbug.com/dawn/1291): These tests are failing on NVidia GLES - // when using Tint/GLSL. - DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES() && IsNvidia()); - - wgpu::Texture depthTexture = CreateDepthTexture( - 9, 9, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, 2); - - constexpr float kInitDepth = 0.4f; - InitializeDepthStencilTextureRegion(depthTexture, 0.f, kInitDepth, 0, 0, /*mipLevel*/ 1); - - // This expectation is the test as it performs the CopyTextureToBuffer. - if (GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm) { - uint16_t expected = FloatToUnorm(kInitDepth); - std::vector expectedData = { - 0, 0, 0, 0, // - 0, 0, 0, 0, // - expected, expected, 0, 0, // - expected, expected, 0, 0, // - }; - EXPECT_TEXTURE_EQ(expectedData.data(), depthTexture, {0, 0}, {4, 4}, 1, - wgpu::TextureAspect::DepthOnly); - } else { - std::vector expectedData = { - 0.0, 0.0, 0.0, 0.0, // - 0.0, 0.0, 0.0, 0.0, // - kInitDepth, kInitDepth, 0.0, 0.0, // - kInitDepth, kInitDepth, 0.0, 0.0, // - }; - EXPECT_TEXTURE_EQ(expectedData.data(), depthTexture, {0, 0}, {4, 4}, 1, - wgpu::TextureAspect::DepthOnly); - } + constexpr float kInitDepth = 0.2f; + constexpr uint32_t kBufferCopyOffset = 0; + constexpr uint32_t kWidth = 9; + constexpr uint32_t kHeight = 9; + constexpr uint32_t kTestLevel = 1; + DoCopyFromDepthTest(kBufferCopyOffset, kInitDepth, kWidth, kHeight, kTestLevel); } -class DepthCopyFromBufferTests : public DepthStencilCopyTests {}; +class DepthCopyFromBufferTests : public DepthStencilCopyTests { + public: + void DoTest(uint32_t bufferCopyOffset, bool hasRenderAttachmentUsage) { + // TODO(crbug.com/dawn/1237): Depth16Unorm test failed on OpenGL and OpenGLES which says + // Invalid format and type combination in glReadPixels + DAWN_TEST_UNSUPPORTED_IF(GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm && + (IsOpenGL() || IsOpenGLES())); + + constexpr uint32_t kWidth = 8; + constexpr uint32_t kHeight = 1; + + wgpu::TextureUsage textureUsage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc; + // On D3D12 backend the resource flag D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL is set only + // when wgpu::TextureUsage::RenderAttachment is set on the creation of a depth stencil + // texture. + if (hasRenderAttachmentUsage) { + textureUsage |= wgpu::TextureUsage::RenderAttachment; + } + wgpu::Texture destTexture = CreateTexture(kWidth, kHeight, textureUsage); + + wgpu::BufferDescriptor descriptor; + descriptor.size = bufferCopyOffset + + BufferSizeForTextureCopy(kWidth, kHeight, 1, GetParam().mTextureFormat); + descriptor.usage = wgpu::BufferUsage::CopySrc; + descriptor.mappedAtCreation = true; + wgpu::Buffer srcBuffer = device.CreateBuffer(&descriptor); + + constexpr uint32_t kBytesPerRow = kTextureBytesPerRowAlignment; + wgpu::ImageCopyBuffer imageCopyBuffer = + utils::CreateImageCopyBuffer(srcBuffer, bufferCopyOffset, kBytesPerRow, kHeight); + wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture( + destTexture, 0, {0, 0, 0}, wgpu::TextureAspect::DepthOnly); + wgpu::Extent3D extent = {kWidth, kHeight, 1}; + + constexpr float kInitDepth = 0.2f; + + // This expectation is the test as it performs the CopyTextureToBuffer. + if (GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm) { + uint16_t expected = FloatToUnorm(kInitDepth); + std::vector expectedData = { + 0, 0, expected, expected, 0, 0, expected, expected, + }; + size_t expectedSize = expectedData.size() * sizeof(uint16_t); + memcpy(srcBuffer.GetMappedRange(bufferCopyOffset, expectedSize), expectedData.data(), + expectedSize); + srcBuffer.Unmap(); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &extent); + wgpu::CommandBuffer commands = encoder.Finish(); + queue.Submit(1, &commands); + + EXPECT_TEXTURE_EQ(expectedData.data(), destTexture, {0, 0}, {kWidth, kHeight}, 0, + wgpu::TextureAspect::DepthOnly); + } else { + std::vector expectedData = { + 0.0, 0.0, kInitDepth, kInitDepth, 0.0, 0.0, kInitDepth, kInitDepth, + }; + size_t expectedSize = expectedData.size() * sizeof(float); + + memcpy(srcBuffer.GetMappedRange(bufferCopyOffset, expectedSize), expectedData.data(), + expectedSize); + srcBuffer.Unmap(); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &extent); + wgpu::CommandBuffer commands = encoder.Finish(); + queue.Submit(1, &commands); + + EXPECT_TEXTURE_EQ(expectedData.data(), destTexture, {0, 0}, {kWidth, kHeight}, 0, + wgpu::TextureAspect::DepthOnly); + } + } +}; // Test copying the depth-only aspect from a buffer. TEST_P(DepthCopyFromBufferTests, BufferToDepthAspect) { - // TODO(crbug.com/dawn/1237): Depth16Unorm test failed on OpenGL and OpenGLES which says - // Invalid format and type combination in glReadPixels - DAWN_TEST_UNSUPPORTED_IF(GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm && - (IsOpenGL() || IsOpenGLES())); + constexpr uint32_t kBufferCopyOffset = 0; + constexpr bool kIsRenderable = false; + DoTest(kBufferCopyOffset, kIsRenderable); +} - constexpr uint32_t kWidth = 8; - constexpr uint32_t kHeight = 1; - - wgpu::Texture destTexture = - CreateTexture(kWidth, kHeight, wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc); - - wgpu::BufferDescriptor descriptor; - descriptor.size = BufferSizeForTextureCopy(kWidth, kHeight, 1, GetParam().mTextureFormat); - descriptor.usage = wgpu::BufferUsage::CopySrc; - descriptor.mappedAtCreation = true; - wgpu::Buffer srcBuffer = device.CreateBuffer(&descriptor); - - wgpu::ImageCopyBuffer imageCopyBuffer = - utils::CreateImageCopyBuffer(srcBuffer, 0, 256, kHeight); - wgpu::ImageCopyTexture imageCopyTexture = - utils::CreateImageCopyTexture(destTexture, 0, {0, 0, 0}, wgpu::TextureAspect::DepthOnly); - wgpu::Extent3D extent = {kWidth, kHeight, 1}; - - constexpr float kInitDepth = 0.2f; - - // This expectation is the test as it performs the CopyTextureToBuffer. - if (GetParam().mTextureFormat == wgpu::TextureFormat::Depth16Unorm) { - uint16_t expected = FloatToUnorm(kInitDepth); - std::vector expectedData = { - 0, 0, expected, expected, 0, 0, expected, expected, - }; - size_t expectedSize = expectedData.size() * sizeof(uint16_t); - - memcpy(srcBuffer.GetMappedRange(0, expectedSize), expectedData.data(), expectedSize); - srcBuffer.Unmap(); - - wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &extent); - wgpu::CommandBuffer commands = encoder.Finish(); - queue.Submit(1, &commands); - - EXPECT_TEXTURE_EQ(expectedData.data(), destTexture, {0, 0}, {kWidth, kHeight}, 0, - wgpu::TextureAspect::DepthOnly); - } else { - std::vector expectedData = { - 0.0, 0.0, kInitDepth, kInitDepth, 0.0, 0.0, kInitDepth, kInitDepth, - }; - size_t expectedSize = expectedData.size() * sizeof(float); - - memcpy(srcBuffer.GetMappedRange(0, expectedSize), expectedData.data(), expectedSize); - srcBuffer.Unmap(); - - wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &extent); - wgpu::CommandBuffer commands = encoder.Finish(); - queue.Submit(1, &commands); - - EXPECT_TEXTURE_EQ(expectedData.data(), destTexture, {0, 0}, {kWidth, kHeight}, 0, - wgpu::TextureAspect::DepthOnly); +// Test copying the depth-only aspect from a buffer at a non-zero offset. +TEST_P(DepthCopyFromBufferTests, BufferToNonRenderableDepthAspectAtNonZeroOffset) { + constexpr std::array kBufferCopyOffsets = {8, 512}; + constexpr bool kIsRenderable = false; + for (uint32_t offset : kBufferCopyOffsets) { + DoTest(offset, kIsRenderable); } } -class StencilCopyTests : public DepthStencilCopyTests {}; +// Test copying the depth-only aspect from a buffer at a non-zero offset. +TEST_P(DepthCopyFromBufferTests, BufferToRenderableDepthAspectAtNonZeroOffset) { + constexpr std::array kBufferCopyOffsets = {8, 512}; + constexpr bool kIsRenderable = true; + for (uint32_t offset : kBufferCopyOffsets) { + DoTest(offset, kIsRenderable); + } +} + +class StencilCopyTests : public DepthStencilCopyTests { + public: + void DoCopyFromStencilTest(uint32_t bufferCopyOffset, + uint32_t textureWidth, + uint32_t textureHeight, + uint32_t testLevel) { + // TODO(crbug.com/dawn/1497): glReadPixels: GL error: HIGH: Invalid format and type + // combination. + DAWN_SUPPRESS_TEST_IF(IsANGLE()); + + // TODO(crbug.com/dawn/667): Work around the fact that some platforms are unable to read + // stencil. + DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_depth_stencil_read")); + + uint32_t mipLevelCount = testLevel + 1; + wgpu::Texture depthStencilTexture = CreateDepthStencilTexture( + textureWidth, textureHeight, + wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, mipLevelCount); + + InitializeDepthStencilTextureRegion(depthStencilTexture, 0.f, 0.3f, 0u, 1u, testLevel); + + std::vector expectedData = { + 0u, 0u, 0u, 0u, // + 0u, 0u, 0u, 0u, // + 1u, 1u, 0u, 0u, // + 1u, 1u, 0u, 0u, // + }; + + uint32_t copyWidth = textureWidth >> testLevel; + uint32_t copyHeight = textureHeight >> testLevel; + ASSERT_EQ(expectedData.size(), copyWidth * copyHeight); + wgpu::Extent3D copySize = {copyWidth, copyHeight, 1}; + + constexpr uint32_t kBytesPerRow = kTextureBytesPerRowAlignment; + wgpu::BufferDescriptor bufferDescriptor = {}; + bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + bufferDescriptor.size = + bufferCopyOffset + BufferSizeForTextureCopy(copyWidth, copyHeight, 1, + GetParam().mTextureFormat, + wgpu::TextureAspect::StencilOnly); + wgpu::Buffer destinationBuffer = device.CreateBuffer(&bufferDescriptor); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture( + depthStencilTexture, testLevel, {0, 0, 0}, wgpu::TextureAspect::StencilOnly); + wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer( + destinationBuffer, bufferCopyOffset, kBytesPerRow, copyHeight); + encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size); + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + + for (uint32_t y = 0; y < copyHeight; ++y) { + EXPECT_BUFFER_U8_RANGE_EQ(expectedData.data() + copyWidth * y, destinationBuffer, + bufferCopyOffset + y * kBytesPerRow, copyWidth); + } + } + + void DoCopyToStencilTest(uint32_t bufferCopyOffset) { + // Copies to a single aspect are unsupported on OpenGL. + DAWN_TEST_UNSUPPORTED_IF(IsOpenGL()); + DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES()); + + // TODO(crbug.com/dawn/704): Readback after clear via stencil copy does not work + // on some Intel drivers. + DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel()); + + // TODO(crbug.com/dawn/1273): Fails on Win11 with D3D12 debug layer and full validation + DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsBackendValidationEnabled()); + + // Create a stencil texture + constexpr uint32_t kWidth = 4; + constexpr uint32_t kHeight = 4; + const bool hasDepth = !utils::IsStencilOnlyFormat(GetParam().mTextureFormat); + + wgpu::Texture depthStencilTexture = CreateDepthStencilTexture( + kWidth, kHeight, + wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc | + wgpu::TextureUsage::CopyDst); + + if (hasDepth) { + wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); + + // Clear depth to 0.7, so we can check that the stencil copy doesn't mutate the depth. + utils::ComboRenderPassDescriptor passDescriptor({}, depthStencilTexture.CreateView()); + passDescriptor.UnsetDepthStencilLoadStoreOpsForFormat(GetParam().mTextureFormat); + passDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.7; + + wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&passDescriptor); + pass.End(); + + wgpu::CommandBuffer commands = commandEncoder.Finish(); + queue.Submit(1, &commands); + } + + std::vector stencilData = { + 1u, 2u, 3u, 4u, // + 5u, 6u, 7u, 8u, // + 9u, 10u, 11u, 12u, // + 13u, 14u, 15u, 16u, // + }; + + // After copying stencil data in, we will decrement stencil values in the bottom left + // of the screen. This is the expected result. + std::vector expectedStencilData = { + 1u, 2u, 3u, 4u, // + 5u, 6u, 7u, 8u, // + 8u, 9u, 11u, 12u, // + 12u, 13u, 15u, 16u, // + }; + + // Upload the stencil data. + { + wgpu::BufferDescriptor descriptor; + descriptor.size = bufferCopyOffset + BufferSizeForTextureCopy( + kWidth, kHeight, 1, GetParam().mTextureFormat, + wgpu::TextureAspect::StencilOnly); + descriptor.usage = wgpu::BufferUsage::CopySrc; + descriptor.mappedAtCreation = true; + wgpu::Buffer srcBuffer = device.CreateBuffer(&descriptor); + uint8_t* mappedPtr = static_cast(srcBuffer.GetMappedRange(bufferCopyOffset)); + constexpr uint32_t kBytesPerRow = kTextureBytesPerRowAlignment; + for (uint32_t y = 0; y < kHeight; ++y) { + memcpy(mappedPtr + y * kBytesPerRow, stencilData.data() + y * kWidth, kWidth); + } + srcBuffer.Unmap(); + + wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); + wgpu::ImageCopyBuffer imageCopyBuffer = + utils::CreateImageCopyBuffer(srcBuffer, bufferCopyOffset, kBytesPerRow, kHeight); + wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture( + depthStencilTexture, 0, {0, 0, 0}, wgpu::TextureAspect::StencilOnly); + wgpu::Extent3D copySize = {kWidth, kHeight, 1}; + commandEncoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size); + wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); + queue.Submit(1, &commandBuffer); + } + + // Decrement the stencil value in a render pass to ensure the data is visible to the + // pipeline. + { + wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); + // Create a render pipline which decrements the stencil value for passing fragments. + // A quad is drawn in the bottom left. + utils::ComboRenderPipelineDescriptor renderPipelineDesc; + renderPipelineDesc.vertex.module = mVertexModule; + renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( + @fragment fn main() { + })"); + renderPipelineDesc.cFragment.targetCount = 0; + wgpu::DepthStencilState* depthStencil = + renderPipelineDesc.EnableDepthStencil(GetParam().mTextureFormat); + depthStencil->stencilFront.passOp = wgpu::StencilOperation::DecrementClamp; + if (!hasDepth) { + depthStencil->depthWriteEnabled = false; + depthStencil->depthCompare = wgpu::CompareFunction::Always; + } + + wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc); + + // Create a render pass which loads the stencil. We want to load the values we + // copied in. Also load the canary depth values so they're not lost. + utils::ComboRenderPassDescriptor passDescriptor({}, depthStencilTexture.CreateView()); + passDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Load; + passDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Load; + passDescriptor.UnsetDepthStencilLoadStoreOpsForFormat(GetParam().mTextureFormat); + + // Draw the quad in the bottom left (two triangles). + wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&passDescriptor); + pass.SetPipeline(pipeline); + pass.Draw(6); + pass.End(); + + wgpu::CommandBuffer commands = commandEncoder.Finish(); + queue.Submit(1, &commands); + } + + // Copy back the stencil data and check it is correct. + EXPECT_TEXTURE_EQ(expectedStencilData.data(), depthStencilTexture, {0, 0}, + {kWidth, kHeight}, 0, wgpu::TextureAspect::StencilOnly); + + if (hasDepth) { + ExpectAttachmentDepthTestData(depthStencilTexture, GetParam().mTextureFormat, kWidth, + kHeight, 0, 0, + { + 0.7, 0.7, 0.7, 0.7, // + 0.7, 0.7, 0.7, 0.7, // + 0.7, 0.7, 0.7, 0.7, // + 0.7, 0.7, 0.7, 0.7, // + }); + } + } +}; // Test copying the stencil-only aspect into a buffer. TEST_P(StencilCopyTests, FromStencilAspect) { - // TODO(crbug.com/dawn/667): Work around the fact that some platforms are unable to read - // stencil. - DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_depth_stencil_read")); - constexpr uint32_t kWidth = 4; constexpr uint32_t kHeight = 4; + constexpr uint32_t kTestLevel = 0; + constexpr uint32_t kBufferCopyOffset = 0; + DoCopyFromStencilTest(kBufferCopyOffset, kWidth, kHeight, kTestLevel); +} - wgpu::Texture depthStencilTexture = CreateDepthStencilTexture( - kWidth, kHeight, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc); - - InitializeDepthStencilTextureRegion(depthStencilTexture, 0.f, 0.3f, 0u, 1u); - - // This expectation is the test as it performs the CopyTextureToBuffer. - std::vector expectedData = { - 0u, 0u, 0u, 0u, // - 0u, 0u, 0u, 0u, // - 1u, 1u, 0u, 0u, // - 1u, 1u, 0u, 0u, // - }; - EXPECT_TEXTURE_EQ(expectedData.data(), depthStencilTexture, {0, 0}, {kWidth, kHeight}, 0, - wgpu::TextureAspect::StencilOnly); +// Test copying the stencil-only aspect into a buffer at a non-zero offset +TEST_P(StencilCopyTests, FromStencilAspectAtNonZeroOffset) { + constexpr uint32_t kWidth = 4; + constexpr uint32_t kHeight = 4; + constexpr uint32_t kTestLevel = 0; + constexpr std::array kBufferCopyOffsets = {4u, 512u}; + for (uint32_t offset : kBufferCopyOffsets) { + DoCopyFromStencilTest(offset, kWidth, kHeight, kTestLevel); + } } // Test copying the non-zero mip, stencil-only aspect into a buffer. TEST_P(StencilCopyTests, FromNonZeroMipStencilAspect) { - // TODO(crbug.com/dawn/704): Readback after clear via stencil copy does not work - // on some Intel drivers. - DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel()); - - // TODO(crbug.com/dawn/667): Work around some platforms' inability to read back stencil. - DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_depth_stencil_read")); - - wgpu::Texture depthStencilTexture = CreateDepthStencilTexture( - 9, 9, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, 2); - - InitializeDepthStencilTextureRegion(depthStencilTexture, 0.f, 0.3f, 0u, 1u, 1u); - - // This expectation is the test as it performs the CopyTextureToBuffer. - std::vector expectedData = { - 0u, 0u, 0u, 0u, // - 0u, 0u, 0u, 0u, // - 1u, 1u, 0u, 0u, // - 1u, 1u, 0u, 0u, // - }; - EXPECT_TEXTURE_EQ(expectedData.data(), depthStencilTexture, {0, 0}, {4, 4}, 1, - wgpu::TextureAspect::StencilOnly); + constexpr uint32_t kWidth = 9; + constexpr uint32_t kHeight = 9; + constexpr uint32_t kTestLevel = 1; + constexpr uint32_t kBufferCopyOffset = 0; + DoCopyFromStencilTest(kBufferCopyOffset, kWidth, kHeight, kTestLevel); } -// Test copying to the stencil-aspect of a buffer +// Test copying to the stencil-aspect of a texture TEST_P(StencilCopyTests, ToStencilAspect) { - // Copies to a single aspect are unsupported on OpenGL. - DAWN_TEST_UNSUPPORTED_IF(IsOpenGL()); - DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES()); + constexpr uint32_t kBufferCopyOffset = 0; + DoCopyToStencilTest(kBufferCopyOffset); +} - // TODO(crbug.com/dawn/704): Readback after clear via stencil copy does not work - // on some Intel drivers. - DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel()); - - // TODO(crbug.com/dawn/1273): Fails on Win11 with D3D12 debug layer and full validation - DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsBackendValidationEnabled()); - - // Create a stencil texture - constexpr uint32_t kWidth = 4; - constexpr uint32_t kHeight = 4; - const bool hasDepth = !utils::IsStencilOnlyFormat(GetParam().mTextureFormat); - - wgpu::Texture depthStencilTexture = - CreateDepthStencilTexture(kWidth, kHeight, - wgpu::TextureUsage::RenderAttachment | - wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst); - - if (hasDepth) { - wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); - - // Clear depth to 0.7, so we can check that the stencil copy doesn't mutate the depth. - utils::ComboRenderPassDescriptor passDescriptor({}, depthStencilTexture.CreateView()); - passDescriptor.UnsetDepthStencilLoadStoreOpsForFormat(GetParam().mTextureFormat); - passDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.7; - - wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&passDescriptor); - pass.End(); - - wgpu::CommandBuffer commands = commandEncoder.Finish(); - queue.Submit(1, &commands); - } - - std::vector stencilData = { - 1u, 2u, 3u, 4u, // - 5u, 6u, 7u, 8u, // - 9u, 10u, 11u, 12u, // - 13u, 14u, 15u, 16u, // - }; - - // After copying stencil data in, we will decrement stencil values in the bottom left - // of the screen. This is the expected result. - std::vector expectedStencilData = { - 1u, 2u, 3u, 4u, // - 5u, 6u, 7u, 8u, // - 8u, 9u, 11u, 12u, // - 12u, 13u, 15u, 16u, // - }; - - // Upload the stencil data. - wgpu::TextureDataLayout stencilDataLayout = {}; - stencilDataLayout.bytesPerRow = kWidth * sizeof(uint8_t); - - wgpu::ImageCopyTexture stencilDataCopyTexture = utils::CreateImageCopyTexture( - depthStencilTexture, 0, {0, 0, 0}, wgpu::TextureAspect::StencilOnly); - - wgpu::Extent3D writeSize = {kWidth, kHeight, 1}; - queue.WriteTexture(&stencilDataCopyTexture, stencilData.data(), - stencilData.size() * sizeof(uint8_t), &stencilDataLayout, &writeSize); - - // Decrement the stencil value in a render pass to ensure the data is visible to the pipeline. - { - wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); - // Create a render pipline which decrements the stencil value for passing fragments. - // A quad is drawn in the bottom left. - utils::ComboRenderPipelineDescriptor renderPipelineDesc; - renderPipelineDesc.vertex.module = mVertexModule; - renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { - })"); - renderPipelineDesc.cFragment.targetCount = 0; - wgpu::DepthStencilState* depthStencil = - renderPipelineDesc.EnableDepthStencil(GetParam().mTextureFormat); - depthStencil->stencilFront.passOp = wgpu::StencilOperation::DecrementClamp; - if (!hasDepth) { - depthStencil->depthWriteEnabled = false; - depthStencil->depthCompare = wgpu::CompareFunction::Always; - } - - wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc); - - // Create a render pass which loads the stencil. We want to load the values we - // copied in. Also load the canary depth values so they're not lost. - utils::ComboRenderPassDescriptor passDescriptor({}, depthStencilTexture.CreateView()); - passDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Load; - passDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Load; - passDescriptor.UnsetDepthStencilLoadStoreOpsForFormat(GetParam().mTextureFormat); - - // Draw the quad in the bottom left (two triangles). - wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&passDescriptor); - pass.SetPipeline(pipeline); - pass.Draw(6); - pass.End(); - - wgpu::CommandBuffer commands = commandEncoder.Finish(); - queue.Submit(1, &commands); - } - - // Copy back the stencil data and check it is correct. - EXPECT_TEXTURE_EQ(expectedStencilData.data(), depthStencilTexture, {0, 0}, {kWidth, kHeight}, 0, - wgpu::TextureAspect::StencilOnly); - - if (hasDepth) { - ExpectAttachmentDepthTestData(depthStencilTexture, GetParam().mTextureFormat, kWidth, - kHeight, 0, 0, - { - 0.7, 0.7, 0.7, 0.7, // - 0.7, 0.7, 0.7, 0.7, // - 0.7, 0.7, 0.7, 0.7, // - 0.7, 0.7, 0.7, 0.7, // - }); +// Test copying to the stencil-aspect of a texture at non-zero offset +TEST_P(StencilCopyTests, ToStencilAspectAtNonZeroOffset) { + constexpr std::array kBufferCopyOffsets = {8, 512}; + for (uint32_t offset : kBufferCopyOffsets) { + DoCopyToStencilTest(offset); } } @@ -759,19 +908,26 @@ DAWN_INSTANTIATE_TEST_P(DepthStencilCopyTests, utils::kDepthAndStencilFormats.end())); DAWN_INSTANTIATE_TEST_P(DepthCopyTests, - {D3D12Backend(), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), - VulkanBackend()}, + {D3D12Backend(), + D3D12Backend({"d3d12_use_temp_buffer_in_depth_stencil_texture_and_buffer_" + "copy_with_non_zero_buffer_offset"}), + MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, std::vector(kValidDepthCopyTextureFormats.begin(), kValidDepthCopyTextureFormats.end())); DAWN_INSTANTIATE_TEST_P(DepthCopyFromBufferTests, - {D3D12Backend(), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), - VulkanBackend()}, + {D3D12Backend(), + D3D12Backend({"d3d12_use_temp_buffer_in_depth_stencil_texture_and_buffer_" + "copy_with_non_zero_buffer_offset"}), + MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, std::vector(kValidDepthCopyFromBufferFormats.begin(), kValidDepthCopyFromBufferFormats.end())); DAWN_INSTANTIATE_TEST_P(StencilCopyTests, - {D3D12Backend(), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), + {D3D12Backend(), + D3D12Backend({"d3d12_use_temp_buffer_in_depth_stencil_texture_and_buffer_" + "copy_with_non_zero_buffer_offset"}), + MetalBackend(), OpenGLBackend(), OpenGLESBackend(), // Test with the vulkan_use_s8 toggle forced on and off. VulkanBackend({"vulkan_use_s8"}, {}), VulkanBackend({}, {"vulkan_use_s8"})}, diff --git a/src/dawn/tests/end2end/DepthStencilLoadOpTests.cpp b/src/dawn/tests/end2end/DepthStencilLoadOpTests.cpp index 9f2726366b..5e1a33445b 100644 --- a/src/dawn/tests/end2end/DepthStencilLoadOpTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilLoadOpTests.cpp @@ -98,12 +98,6 @@ class DepthStencilLoadOpTests : public DawnTestWithParams GetRequiredFeatures() override { switch (GetParam().mFormat) { - case wgpu::TextureFormat::Depth24UnormStencil8: - if (SupportsFeatures({wgpu::FeatureName::Depth24UnormStencil8})) { - mIsFormatSupported = true; - return {wgpu::FeatureName::Depth24UnormStencil8}; - } - return {}; case wgpu::TextureFormat::Depth32FloatStencil8: if (SupportsFeatures({wgpu::FeatureName::Depth32FloatStencil8})) { mIsFormatSupported = true; @@ -184,11 +178,6 @@ class DepthStencilLoadOpTests : public DawnTestWithParams( {D3D12Backend(), D3D12Backend({}, {"use_d3d12_render_pass"}), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, @@ -267,8 +246,7 @@ auto GenerateParams() { auto params2 = MakeParamGenerator( {D3D12Backend(), D3D12Backend({}, {"use_d3d12_render_pass"}), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, - {wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth24UnormStencil8, - wgpu::TextureFormat::Depth32FloatStencil8}, + {wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth32FloatStencil8}, {Check::CopyStencil, Check::StencilTest, Check::DepthTest, Check::SampleDepth}); std::vector allParams; @@ -280,8 +258,169 @@ auto GenerateParams() { INSTANTIATE_TEST_SUITE_P(, DepthStencilLoadOpTests, - ::testing::ValuesIn(GenerateParams()), + ::testing::ValuesIn(GenerateParam()), DawnTestBase::PrintToStringParamName("DepthStencilLoadOpTests")); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DepthStencilLoadOpTests); +class StencilClearValueOverflowTest : public DepthStencilLoadOpTests {}; + +// Test when stencilClearValue overflows uint8_t (>255), only the last 8 bits will be applied as the +// stencil clear value in encoder.BeginRenderPass() (currently Dawn only supports 8-bit stencil +// format). +TEST_P(StencilClearValueOverflowTest, StencilClearValueOverFlowUint8) { + constexpr uint32_t kOverflowedStencilValue = kStencilValues[0] + 0x100; + renderPassDescriptors[0].cDepthStencilAttachmentInfo.stencilClearValue = + kOverflowedStencilValue; + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.BeginRenderPass(&renderPassDescriptors[0]).End(); + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + + CheckMipLevel(0u); +} + +// Test when stencilClearValue overflows uint16_t(>65535), only the last 8 bits will be applied as +// the stencil clear value in encoder.BeginRenderPass() (currently Dawn only supports 8-bit stencil +// format). +TEST_P(StencilClearValueOverflowTest, StencilClearValueOverFlowUint16) { + constexpr uint32_t kOverflowedStencilValue = kStencilValues[0] + 0x10000; + renderPassDescriptors[0].cDepthStencilAttachmentInfo.stencilClearValue = + kOverflowedStencilValue; + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.BeginRenderPass(&renderPassDescriptors[0]).End(); + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + + CheckMipLevel(0u); +} + +DAWN_INSTANTIATE_TEST_P(StencilClearValueOverflowTest, + {D3D12Backend(), D3D12Backend({}, {"use_d3d12_render_pass"}), + MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()}, + {wgpu::TextureFormat::Depth24PlusStencil8, + wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureFormat::Stencil8}, + {Check::CopyStencil, Check::StencilTest}); + +// Regression tests to reproduce a flaky failure when running whole WebGPU CTS on Intel Gen12 GPUs. +// See crbug.com/dawn/1487 for more details. +using SupportsTextureBinding = bool; +DAWN_TEST_PARAM_STRUCT(DepthTextureClearTwiceTestParams, Format, SupportsTextureBinding); + +class DepthTextureClearTwiceTest : public DawnTestWithParams { + public: + void RecordClearDepthAspectAtLevel(wgpu::CommandEncoder encoder, + wgpu::Texture depthTexture, + uint32_t level, + float clearValue) { + wgpu::TextureViewDescriptor viewDescriptor = {}; + viewDescriptor.baseArrayLayer = 0; + viewDescriptor.arrayLayerCount = 1; + viewDescriptor.baseMipLevel = level; + viewDescriptor.mipLevelCount = 1; + wgpu::TextureView view = depthTexture.CreateView(&viewDescriptor); + + wgpu::RenderPassDescriptor renderPassDescriptor = {}; + renderPassDescriptor.colorAttachmentCount = 0; + + wgpu::RenderPassDepthStencilAttachment depthStencilAttachment = {}; + depthStencilAttachment.view = view; + depthStencilAttachment.depthClearValue = clearValue; + depthStencilAttachment.depthLoadOp = wgpu::LoadOp::Clear; + depthStencilAttachment.depthStoreOp = wgpu::StoreOp::Store; + + if (!utils::IsDepthOnlyFormat(GetParam().mFormat)) { + depthStencilAttachment.stencilLoadOp = wgpu::LoadOp::Load; + depthStencilAttachment.stencilStoreOp = wgpu::StoreOp::Store; + } + + renderPassDescriptor.depthStencilAttachment = &depthStencilAttachment; + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.End(); + } + + protected: + std::vector GetRequiredFeatures() override { + switch (GetParam().mFormat) { + case wgpu::TextureFormat::Depth32FloatStencil8: + if (SupportsFeatures({wgpu::FeatureName::Depth32FloatStencil8})) { + mIsFormatSupported = true; + return {wgpu::FeatureName::Depth32FloatStencil8}; + } + return {}; + default: + mIsFormatSupported = true; + return {}; + } + } + + bool mIsFormatSupported = false; +}; + +TEST_P(DepthTextureClearTwiceTest, ClearDepthAspectTwice) { + DAWN_SUPPRESS_TEST_IF(!mIsFormatSupported); + + constexpr uint32_t kSize = 64; + constexpr uint32_t kLevelCount = 5; + + wgpu::TextureFormat depthFormat = GetParam().mFormat; + + wgpu::TextureDescriptor descriptor; + descriptor.size = {kSize, kSize}; + descriptor.format = depthFormat; + descriptor.mipLevelCount = kLevelCount; + + // The toggle "d3d12_force_initialize_copyable_depth_stencil_texture_on_creation" is not related + // to this test as we don't specify wgpu::TextureUsage::CopyDst in the test. + descriptor.usage = wgpu::TextureUsage::RenderAttachment; + if (GetParam().mSupportsTextureBinding) { + descriptor.usage |= wgpu::TextureUsage::TextureBinding; + } + wgpu::Texture depthTexture = device.CreateTexture(&descriptor); + + // First, clear all the subresources to 0. + { + constexpr float kClearValue = 0.f; + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + for (uint32_t level = 0; level < kLevelCount; ++level) { + RecordClearDepthAspectAtLevel(encoder, depthTexture, level, kClearValue); + } + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + } + + // Then, clear several mipmap levels to 0.8. + { + constexpr float kClearValue = 0.8f; + constexpr std::array kLevelsToSet = {2u, 4u}; + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + for (uint32_t level : kLevelsToSet) { + RecordClearDepthAspectAtLevel(encoder, depthTexture, level, kClearValue); + } + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + } + + // Check if the data in remaining mipmap levels is still 0. + { + constexpr std::array kLevelsToTest = {0, 1u, 3u}; + for (uint32_t level : kLevelsToTest) { + uint32_t sizeAtLevel = kSize >> level; + std::vector expectedValue(sizeAtLevel * sizeAtLevel, 0.f); + ExpectAttachmentDepthTestData(depthTexture, GetParam().mFormat, sizeAtLevel, + sizeAtLevel, 0, level, expectedValue); + } + } +} + +DAWN_INSTANTIATE_TEST_P(DepthTextureClearTwiceTest, + {D3D12Backend(), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), + VulkanBackend()}, + {wgpu::TextureFormat::Depth16Unorm, wgpu::TextureFormat::Depth24Plus, + wgpu::TextureFormat::Depth32Float, + wgpu::TextureFormat::Depth32FloatStencil8, + wgpu::TextureFormat::Depth24PlusStencil8}, + {true, false}); + } // namespace diff --git a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp index 574573cb35..760a0ab8b8 100644 --- a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp @@ -44,9 +44,10 @@ const std::vector kStencilValues = {0, 1, 38, 255}; class DepthStencilSamplingTest : public DawnTestWithParams { protected: - enum class TestAspect { - Depth, - Stencil, + enum class TestAspectAndSamplerType { + DepthAsDepth, + DepthAsFloat, + StencilAsUint, }; void SetUp() override { @@ -62,12 +63,6 @@ class DepthStencilSamplingTest : public DawnTestWithParams GetRequiredFeatures() override { switch (GetParam().mTextureFormat) { - case wgpu::TextureFormat::Depth24UnormStencil8: - if (SupportsFeatures({wgpu::FeatureName::Depth24UnormStencil8})) { - mIsFormatSupported = true; - return {wgpu::FeatureName::Depth24UnormStencil8}; - } - return {}; case wgpu::TextureFormat::Depth32FloatStencil8: if (SupportsFeatures({wgpu::FeatureName::Depth32FloatStencil8})) { mIsFormatSupported = true; @@ -80,7 +75,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams& aspects, + void GenerateSamplingShader(const std::vector& aspectAndSamplerTypes, const std::vector components, std::ostringstream& shaderSource, std::ostringstream& shaderBody) { @@ -95,9 +90,9 @@ class DepthStencilSamplingTest : public DawnTestWithParams(0, 0), 0);"; break; - case TestAspect::Stencil: + case TestAspectAndSamplerType::DepthAsFloat: + shaderSource << "@group(0) @binding(" << 2 * index << ") var tex" << index + << " : texture_2d;\n"; + + shaderSource << "@group(0) @binding(" << 2 * index + 1 + << ") var result" << index + << " : DepthResult;\n"; + + ASSERT(components.size() == 1 && components[0] == 0); + shaderBody << "\nresult" << index << ".value = textureLoad(tex" << index + << ", vec2(0, 0), 0)[0];"; + break; + case TestAspectAndSamplerType::StencilAsUint: shaderSource << "@group(0) @binding(" << 2 * index << ") var tex" << index << " : texture_2d;\n"; @@ -131,10 +138,11 @@ class DepthStencilSamplingTest : public DawnTestWithParams aspects, - std::vector components) { + wgpu::RenderPipeline CreateSamplingRenderPipeline( + std::vector aspectAndSamplerTypes, + std::vector components) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -144,9 +152,9 @@ class DepthStencilSamplingTest : public DawnTestWithParams @location(0) vec4 {\n"; + shaderSource << "@fragment fn main() -> @location(0) vec4 {\n"; shaderSource << shaderBody.str() << "return vec4();\n }"; wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shaderSource.str().c_str()); @@ -158,14 +166,14 @@ class DepthStencilSamplingTest : public DawnTestWithParams aspects, - std::vector components) { + wgpu::ComputePipeline CreateSamplingComputePipeline( + std::vector aspectAndSamplerTypes, + std::vector components) { std::ostringstream shaderSource; std::ostringstream shaderBody; - GenerateSamplingShader(aspects, components, shaderSource, shaderBody); + GenerateSamplingShader(aspectAndSamplerTypes, components, shaderSource, shaderBody); - shaderSource << "@stage(compute) @workgroup_size(1) fn main() { " << shaderBody.str() - << "\n}"; + shaderSource << "@compute @workgroup_size(1) fn main() { " << shaderBody.str() << "\n}"; wgpu::ShaderModule csModule = utils::CreateShaderModule(device, shaderSource.str().c_str()); @@ -176,21 +184,23 @@ class DepthStencilSamplingTest : public DawnTestWithParams aspects, - uint32_t componentIndex) { - return CreateSamplingRenderPipeline(std::move(aspects), + wgpu::RenderPipeline CreateSamplingRenderPipeline( + std::vector aspectAndSamplerTypes, + uint32_t componentIndex) { + return CreateSamplingRenderPipeline(std::move(aspectAndSamplerTypes), std::vector{componentIndex}); } - wgpu::ComputePipeline CreateSamplingComputePipeline(std::vector aspects, - uint32_t componentIndex) { - return CreateSamplingComputePipeline(std::move(aspects), + wgpu::ComputePipeline CreateSamplingComputePipeline( + std::vector aspectAndSamplerTypes, + uint32_t componentIndex) { + return CreateSamplingComputePipeline(std::move(aspectAndSamplerTypes), std::vector{componentIndex}); } wgpu::RenderPipeline CreateComparisonRenderPipeline() { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -202,7 +212,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams uniforms : Uniforms; - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { return textureSampleCompare(tex, samp, vec2(0.5, 0.5), uniforms.compareRef); })"); @@ -229,7 +239,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams samplerResult : SamplerResult; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { samplerResult.value = textureSampleCompare(tex, samp, vec2(0.5, 0.5), uniforms.compareRef); })"); @@ -290,7 +300,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams - void DoSamplingTestImpl(TestAspect aspect, + void DoSamplingTestImpl(TestAspectAndSamplerType aspectAndSamplerType, wgpu::RenderPipeline pipeline, wgpu::TextureFormat format, std::vector textureValues, @@ -298,11 +308,12 @@ class DepthStencilSamplingTest : public DawnTestWithParams - void DoSamplingTestImpl(TestAspect aspect, + void DoSamplingTestImpl(TestAspectAndSamplerType aspectAndSamplerType, wgpu::ComputePipeline pipeline, wgpu::TextureFormat format, std::vector textureValues, @@ -353,11 +365,12 @@ class DepthStencilSamplingTest : public DawnTestWithParams - void DoSamplingTest(TestAspect aspect, + void DoSamplingTest(TestAspectAndSamplerType aspectAndSamplerType, wgpu::RenderPipeline pipeline, wgpu::TextureFormat format, std::vector textureValues, T tolerance = {}) { - DoSamplingTestImpl(aspect, pipeline, format, textureValues, 1, + DoSamplingTestImpl(aspectAndSamplerType, pipeline, format, textureValues, 1, [this, tolerance](T expected, wgpu::Buffer buffer) { EXPECT_BUFFER(buffer, 0, sizeof(T), new ::detail::ExpectEq(expected, tolerance)); @@ -410,12 +424,12 @@ class DepthStencilSamplingTest : public DawnTestWithParams - void DoSamplingTest(TestAspect aspect, + void DoSamplingTest(TestAspectAndSamplerType aspectAndSamplerType, wgpu::ComputePipeline pipeline, wgpu::TextureFormat format, std::vector textureValues, T tolerance = {}) { - DoSamplingTestImpl(aspect, pipeline, format, textureValues, 1, + DoSamplingTestImpl(aspectAndSamplerType, pipeline, format, textureValues, 1, [this, tolerance](T expected, wgpu::Buffer buffer) { EXPECT_BUFFER(buffer, 0, sizeof(T), new ::detail::ExpectEq(expected, tolerance)); @@ -454,22 +468,24 @@ class DepthStencilSamplingTest : public DawnTestWithParams textureValues) { - DoSamplingTestImpl(aspect, - CreateSamplingRenderPipeline({TestAspect::Stencil}, {0, 1, 2, 3}), + DoSamplingTestImpl(aspectAndSamplerType, + CreateSamplingRenderPipeline({TestAspectAndSamplerType::StencilAsUint}, + {0, 1, 2, 3}), format, textureValues, 4, [&](uint32_t expected, wgpu::Buffer buffer) { EXPECT_BUFFER(buffer, 0, 4 * sizeof(uint32_t), new ExtraStencilComponentsExpectation(expected)); }); } - void DoSamplingExtraStencilComponentsComputeTest(TestAspect aspect, + void DoSamplingExtraStencilComponentsComputeTest(TestAspectAndSamplerType aspectAndSamplerType, wgpu::TextureFormat format, std::vector textureValues) { - DoSamplingTestImpl(aspect, - CreateSamplingComputePipeline({TestAspect::Stencil}, {0, 1, 2, 3}), + DoSamplingTestImpl(aspectAndSamplerType, + CreateSamplingComputePipeline({TestAspectAndSamplerType::StencilAsUint}, + {0, 1, 2, 3}), format, textureValues, 4, [&](uint32_t expected, wgpu::Buffer buffer) { EXPECT_BUFFER(buffer, 0, 4 * sizeof(uint32_t), new ExtraStencilComponentsExpectation(expected)); @@ -606,19 +622,15 @@ class DepthStencilSamplingTest : public DawnTestWithParams(expectedDepth, tolerance)); + EXPECT_BUFFER(depthOutput, 0, sizeof(float), new ::detail::ExpectEq(expectedDepth)); uint8_t expectedStencil = 0; memcpy(&expectedStencil, &passDescriptor.cDepthStencilAttachmentInfo.stencilClearValue, @@ -695,8 +704,8 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) { // With compute pipeline { - wgpu::ComputePipeline pipeline = - CreateSamplingComputePipeline({TestAspect::Depth, TestAspect::Stencil}, 0); + wgpu::ComputePipeline pipeline = CreateSamplingComputePipeline( + {TestAspectAndSamplerType::DepthAsDepth, TestAspectAndSamplerType::StencilAsUint}, 0); wgpu::Buffer depthOutput = CreateOutputBuffer(); wgpu::Buffer stencilOutput = CreateOutputBuffer(); @@ -732,8 +741,7 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) { float expectedDepth = 0.0f; memcpy(&expectedDepth, &passDescriptor.cDepthStencilAttachmentInfo.depthClearValue, sizeof(float)); - EXPECT_BUFFER(depthOutput, 0, sizeof(float), - new ::detail::ExpectEq(expectedDepth, tolerance)); + EXPECT_BUFFER(depthOutput, 0, sizeof(float), new ::detail::ExpectEq(expectedDepth)); uint8_t expectedStencil = 0; memcpy(&expectedStencil, &passDescriptor.cDepthStencilAttachmentInfo.stencilClearValue, @@ -747,17 +755,22 @@ class DepthSamplingTest : public DepthStencilSamplingTest {}; // Test that sampling a depth texture with a render/compute pipeline works TEST_P(DepthSamplingTest, SampleDepthOnly) { wgpu::TextureFormat format = GetParam().mTextureFormat; - float tolerance = format == wgpu::TextureFormat::Depth16Unorm || - format == wgpu::TextureFormat::Depth24UnormStencil8 - ? 0.001f - : 0.0f; + float tolerance = format == wgpu::TextureFormat::Depth16Unorm ? 0.001f : 0.0f; // Test 0, between [0, 1], and 1. - DoSamplingTest(TestAspect::Depth, CreateSamplingRenderPipeline({TestAspect::Depth}, 0), format, - kNormalizedTextureValues, tolerance); + DoSamplingTest(TestAspectAndSamplerType::DepthAsDepth, + CreateSamplingRenderPipeline({TestAspectAndSamplerType::DepthAsDepth}, 0), + format, kNormalizedTextureValues, tolerance); + DoSamplingTest(TestAspectAndSamplerType::DepthAsFloat, + CreateSamplingRenderPipeline({TestAspectAndSamplerType::DepthAsFloat}, 0), + format, kNormalizedTextureValues, tolerance); - DoSamplingTest(TestAspect::Depth, CreateSamplingComputePipeline({TestAspect::Depth}, 0), format, - kNormalizedTextureValues, tolerance); + DoSamplingTest(TestAspectAndSamplerType::DepthAsDepth, + CreateSamplingComputePipeline({TestAspectAndSamplerType::DepthAsDepth}, 0), + format, kNormalizedTextureValues, tolerance); + DoSamplingTest(TestAspectAndSamplerType::DepthAsFloat, + CreateSamplingComputePipeline({TestAspectAndSamplerType::DepthAsFloat}, 0), + format, kNormalizedTextureValues, tolerance); } // Test that sampling in a render pipeline with all of the compare functions works. @@ -766,10 +779,8 @@ TEST_P(DepthSamplingTest, CompareFunctionsRender) { DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel()); wgpu::TextureFormat format = GetParam().mTextureFormat; - // Test does not account for precision issues when comparison testing Depth16Unorm and - // Depth24UnormStencil8. - DAWN_TEST_UNSUPPORTED_IF(format == wgpu::TextureFormat::Depth16Unorm || - format == wgpu::TextureFormat::Depth24UnormStencil8); + // Test does not account for precision issues when comparison testing Depth16Unorm. + DAWN_TEST_UNSUPPORTED_IF(format == wgpu::TextureFormat::Depth16Unorm); wgpu::RenderPipeline pipeline = CreateComparisonRenderPipeline(); @@ -791,10 +802,12 @@ TEST_P(StencilSamplingTest, SampleStencilOnly) { wgpu::TextureFormat format = GetParam().mTextureFormat; - DoSamplingTest(TestAspect::Stencil, CreateSamplingRenderPipeline({TestAspect::Stencil}, 0), + DoSamplingTest(TestAspectAndSamplerType::StencilAsUint, + CreateSamplingRenderPipeline({TestAspectAndSamplerType::StencilAsUint}, 0), format, kStencilValues); - DoSamplingTest(TestAspect::Stencil, CreateSamplingComputePipeline({TestAspect::Stencil}, 0), + DoSamplingTest(TestAspectAndSamplerType::StencilAsUint, + CreateSamplingComputePipeline({TestAspectAndSamplerType::StencilAsUint}, 0), format, kStencilValues); } diff --git a/src/dawn/tests/end2end/DepthStencilStateTests.cpp b/src/dawn/tests/end2end/DepthStencilStateTests.cpp index 8690751462..c4bc01c2fc 100644 --- a/src/dawn/tests/end2end/DepthStencilStateTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilStateTests.cpp @@ -63,7 +63,7 @@ class DepthStencilStateTest : public DawnTest { } @group(0) @binding(0) var ubo : UBO; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, 1.0), @@ -82,14 +82,14 @@ class DepthStencilStateTest : public DawnTest { } @group(0) @binding(0) var ubo : UBO; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(ubo.color, 1.0); })"); } struct TestSpec { const wgpu::DepthStencilState& depthStencil; - RGBA8 color; + utils::RGBA8 color; float depth; uint32_t stencil; wgpu::FrontFace frontFace = wgpu::FrontFace::CCW; @@ -125,10 +125,10 @@ class DepthStencilStateTest : public DawnTest { state.stencilReadMask = 0xff; state.stencilWriteMask = 0xff; - RGBA8 baseColor = RGBA8(255, 255, 255, 255); - RGBA8 lessColor = RGBA8(255, 0, 0, 255); - RGBA8 equalColor = RGBA8(0, 255, 0, 255); - RGBA8 greaterColor = RGBA8(0, 0, 255, 255); + utils::RGBA8 baseColor = utils::RGBA8(255, 255, 255, 255); + utils::RGBA8 lessColor = utils::RGBA8(255, 0, 0, 255); + utils::RGBA8 equalColor = utils::RGBA8(0, 255, 0, 255); + utils::RGBA8 greaterColor = utils::RGBA8(0, 0, 255, 255); // Base triangle at depth 0.5, depth always, depth write enabled TestSpec base = {baseState, baseColor, 0.5f, 0u}; @@ -179,10 +179,10 @@ class DepthStencilStateTest : public DawnTest { state.stencilReadMask = 0xff; state.stencilWriteMask = 0xff; - RGBA8 baseColor = RGBA8(255, 255, 255, 255); - RGBA8 lessColor = RGBA8(255, 0, 0, 255); - RGBA8 equalColor = RGBA8(0, 255, 0, 255); - RGBA8 greaterColor = RGBA8(0, 0, 255, 255); + utils::RGBA8 baseColor = utils::RGBA8(255, 255, 255, 255); + utils::RGBA8 lessColor = utils::RGBA8(255, 0, 0, 255); + utils::RGBA8 equalColor = utils::RGBA8(0, 255, 0, 255); + utils::RGBA8 greaterColor = utils::RGBA8(0, 0, 255, 255); // Base triangle with stencil reference 1 TestSpec base = {baseState, baseColor, 0.0f, 1u}; @@ -235,10 +235,10 @@ class DepthStencilStateTest : public DawnTest { CheckStencil( { // Wipe the stencil buffer with the initialStencil value - {baseState, RGBA8(255, 255, 255, 255), 0.f, initialStencil}, + {baseState, utils::RGBA8(255, 255, 255, 255), 0.f, initialStencil}, // Draw a triangle with the provided stencil operation and reference - {state, RGBA8(255, 0, 0, 255), 0.f, reference}, + {state, utils::RGBA8(255, 0, 0, 255), 0.f, reference}, }, expectedStencil); } @@ -258,16 +258,16 @@ class DepthStencilStateTest : public DawnTest { state.stencilReadMask = 0xff; state.stencilWriteMask = 0xff; - testParams.push_back({state, RGBA8(0, 255, 0, 255), 0, expectedStencil}); - DoTest(testParams, RGBA8(0, 255, 0, 255)); + testParams.push_back({state, utils::RGBA8(0, 255, 0, 255), 0, expectedStencil}); + DoTest(testParams, utils::RGBA8(0, 255, 0, 255)); } // Each test param represents a pair of triangles with a color, depth, stencil value, and // depthStencil state, one frontfacing, one backfacing Draw the triangles in order and check the // expected colors for the frontfaces and backfaces void DoTest(const std::vector& testParams, - const RGBA8& expectedFront, - const RGBA8& expectedBack, + const utils::RGBA8& expectedFront, + const utils::RGBA8& expectedBack, bool isSingleEncoderMultiplePass = false) { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -355,7 +355,7 @@ class DepthStencilStateTest : public DawnTest { } void DoTest(const std::vector& testParams, - const RGBA8& expected, + const utils::RGBA8& expected, bool isSingleEncoderMultiplePass = false) { DoTest(testParams, expected, expected, isSingleEncoderMultiplePass); } @@ -386,9 +386,9 @@ TEST_P(DepthStencilStateTest, Basic) { DoTest( { - {state, RGBA8(0, 255, 0, 255), 0.5f, 0u}, + {state, utils::RGBA8(0, 255, 0, 255), 0.5f, 0u}, }, - RGBA8(0, 255, 0, 255)); + utils::RGBA8(0, 255, 0, 255)); } // Test defaults: depth and stencil tests disabled @@ -408,9 +408,9 @@ TEST_P(DepthStencilStateTest, DepthStencilDisabled) { state.stencilWriteMask = 0xff; TestSpec specs[3] = { - {state, RGBA8(255, 0, 0, 255), 0.0f, 0u}, - {state, RGBA8(0, 255, 0, 255), 0.5f, 0u}, - {state, RGBA8(0, 0, 255, 255), 1.0f, 0u}, + {state, utils::RGBA8(255, 0, 0, 255), 0.0f, 0u}, + {state, utils::RGBA8(0, 255, 0, 255), 0.5f, 0u}, + {state, utils::RGBA8(0, 0, 255, 255), 1.0f, 0u}, }; // Test that for all combinations, the last triangle drawn is the one visible @@ -490,15 +490,15 @@ TEST_P(DepthStencilStateTest, DepthWriteDisabled) { DoTest( { - {baseState, RGBA8(255, 255, 255, 255), 1.f, + {baseState, utils::RGBA8(255, 255, 255, 255), 1.f, 0u}, // Draw a base triangle with depth enabled - {noDepthWrite, RGBA8(0, 0, 0, 255), 0.f, + {noDepthWrite, utils::RGBA8(0, 0, 0, 255), 0.f, 0u}, // Draw a second triangle without depth enabled - {checkState, RGBA8(0, 255, 0, 255), 1.f, + {checkState, utils::RGBA8(0, 255, 0, 255), 1.f, 0u}, // Draw a third triangle which should occlude the second even though it is behind // it }, - RGBA8(0, 255, 0, 255)); + utils::RGBA8(0, 255, 0, 255)); } // The following tests check that each stencil comparison function works @@ -599,9 +599,9 @@ TEST_P(DepthStencilStateTest, StencilReadMask) { state.stencilReadMask = 0x2; state.stencilWriteMask = 0xff; - RGBA8 baseColor = RGBA8(255, 255, 255, 255); - RGBA8 red = RGBA8(255, 0, 0, 255); - RGBA8 green = RGBA8(0, 255, 0, 255); + utils::RGBA8 baseColor = utils::RGBA8(255, 255, 255, 255); + utils::RGBA8 red = utils::RGBA8(255, 0, 0, 255); + utils::RGBA8 green = utils::RGBA8(0, 255, 0, 255); TestSpec base = {baseState, baseColor, 0.5f, 3u}; // Base triangle to set the stencil to 3 DoTest({base, {state, red, 0.f, 1u}}, baseColor); // Triangle with stencil reference 1 and read @@ -638,8 +638,8 @@ TEST_P(DepthStencilStateTest, StencilWriteMask) { state.stencilReadMask = 0xff; state.stencilWriteMask = 0xff; - RGBA8 baseColor = RGBA8(255, 255, 255, 255); - RGBA8 green = RGBA8(0, 255, 0, 255); + utils::RGBA8 baseColor = utils::RGBA8(255, 255, 255, 255); + utils::RGBA8 green = utils::RGBA8(0, 255, 0, 255); TestSpec base = {baseState, baseColor, 0.5f, 3u}; // Base triangle with stencil reference 3 and mask 1 to set the stencil 1 @@ -679,8 +679,9 @@ TEST_P(DepthStencilStateTest, StencilFail) { CheckStencil( { - {baseState, RGBA8(255, 255, 255, 255), 1.f, 1}, // Triangle to set stencil value to 1 - {state, RGBA8(0, 0, 0, 255), 0.f, + {baseState, utils::RGBA8(255, 255, 255, 255), 1.f, + 1}, // Triangle to set stencil value to 1 + {state, utils::RGBA8(0, 0, 0, 255), 0.f, 2} // Triangle with stencil reference 2 fails the Less comparison function }, 2); // Replace the stencil on failure, so it should be 2 @@ -714,9 +715,9 @@ TEST_P(DepthStencilStateTest, StencilDepthFail) { state.stencilReadMask = 0xff; state.stencilWriteMask = 0xff; - CheckStencil({{baseState, RGBA8(255, 255, 255, 255), 0.f, + CheckStencil({{baseState, utils::RGBA8(255, 255, 255, 255), 0.f, 1}, // Triangle to set stencil value to 1. Depth is 0 - {state, RGBA8(0, 0, 0, 255), 1.f, + {state, utils::RGBA8(0, 0, 0, 255), 1.f, 2}}, // Triangle with stencil reference 2 passes the Greater comparison // function. At depth 1, it fails the Less depth test 2); // Replace the stencil on stencil pass, depth failure, so it should be 2 @@ -750,9 +751,9 @@ TEST_P(DepthStencilStateTest, StencilDepthPass) { state.stencilReadMask = 0xff; state.stencilWriteMask = 0xff; - CheckStencil({{baseState, RGBA8(255, 255, 255, 255), 1.f, + CheckStencil({{baseState, utils::RGBA8(255, 255, 255, 255), 1.f, 1}, // Triangle to set stencil value to 1. Depth is 0 - {state, RGBA8(0, 0, 0, 255), 0.f, + {state, utils::RGBA8(0, 0, 0, 255), 0.f, 2}}, // Triangle with stencil reference 2 passes the Greater comparison // function. At depth 0, it pass the Less depth test 2); // Replace the stencil on stencil pass, depth pass, so it should be 2 @@ -784,8 +785,10 @@ TEST_P(DepthStencilStateTest, StencilFrontAndBackFace) { state.stencilBack.compare = wgpu::CompareFunction::Never; // The front facing triangle passes the stencil comparison but the back facing one doesn't. - DoTest({{state, RGBA8::kRed, 0.f, 0u, wgpu::FrontFace::CCW}}, RGBA8::kRed, RGBA8::kZero); - DoTest({{state, RGBA8::kRed, 0.f, 0u, wgpu::FrontFace::CW}}, RGBA8::kZero, RGBA8::kRed); + DoTest({{state, utils::RGBA8::kRed, 0.f, 0u, wgpu::FrontFace::CCW}}, utils::RGBA8::kRed, + utils::RGBA8::kZero); + DoTest({{state, utils::RGBA8::kRed, 0.f, 0u, wgpu::FrontFace::CW}}, utils::RGBA8::kZero, + utils::RGBA8::kRed); } // Test that the depth reference of a new render pass is initialized to default value 0 @@ -808,11 +811,11 @@ TEST_P(DepthStencilStateTest, StencilReferenceInitialized) { // Only set the stencil reference in the first pass, and test that for other pass it should // be default value rather than inherited std::vector testParams = { - {stencilAlwaysReplaceState, RGBA8::kRed, 0.f, 0x1, wgpu::FrontFace::CCW, true}, - {stencilEqualKeepState, RGBA8::kGreen, 0.f, 0x0, wgpu::FrontFace::CCW, false}}; + {stencilAlwaysReplaceState, utils::RGBA8::kRed, 0.f, 0x1, wgpu::FrontFace::CCW, true}, + {stencilEqualKeepState, utils::RGBA8::kGreen, 0.f, 0x0, wgpu::FrontFace::CCW, false}}; // Since the stencil reference is not inherited, second draw won't pass the stencil test - DoTest(testParams, RGBA8::kZero, RGBA8::kZero, true); + DoTest(testParams, utils::RGBA8::kZero, utils::RGBA8::kZero, true); } // Test that stencil reference is initialized as zero for new render pass @@ -820,12 +823,13 @@ TEST_P(DepthStencilStateTest, StencilReferenceInitialized) { // First pass sets the stencil to 0x1, the second pass sets the stencil to its default // value, and the third pass tests if the stencil is zero std::vector testParams = { - {stencilAlwaysReplaceState, RGBA8::kRed, 0.f, 0x1, wgpu::FrontFace::CCW, true}, - {stencilAlwaysReplaceState, RGBA8::kGreen, 0.f, 0x1, wgpu::FrontFace::CCW, false}, - {stencilEqualKeepState, RGBA8::kBlue, 0.f, 0x0, wgpu::FrontFace::CCW, true}}; + {stencilAlwaysReplaceState, utils::RGBA8::kRed, 0.f, 0x1, wgpu::FrontFace::CCW, true}, + {stencilAlwaysReplaceState, utils::RGBA8::kGreen, 0.f, 0x1, wgpu::FrontFace::CCW, + false}, + {stencilEqualKeepState, utils::RGBA8::kBlue, 0.f, 0x0, wgpu::FrontFace::CCW, true}}; // The third draw should pass the stencil test since the second pass set it to default zero - DoTest(testParams, RGBA8::kBlue, RGBA8::kBlue, true); + DoTest(testParams, utils::RGBA8::kBlue, utils::RGBA8::kBlue, true); } } diff --git a/src/dawn/tests/end2end/DestroyTests.cpp b/src/dawn/tests/end2end/DestroyTests.cpp index 89450cfafd..fcf53b2a0b 100644 --- a/src/dawn/tests/end2end/DestroyTests.cpp +++ b/src/dawn/tests/end2end/DestroyTests.cpp @@ -31,13 +31,13 @@ class DestroyTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -84,7 +84,7 @@ class DestroyTest : public DawnTest { // Destroy before submit will result in error, and nothing drawn TEST_P(DestroyTest, BufferDestroyBeforeSubmit) { - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::CommandBuffer commands = CreateTriangleCommandBuffer(); vertexBuffer.Destroy(); @@ -95,7 +95,7 @@ TEST_P(DestroyTest, BufferDestroyBeforeSubmit) { // Destroy after submit will draw successfully TEST_P(DestroyTest, BufferDestroyAfterSubmit) { - RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 filled(0, 255, 0, 255); wgpu::CommandBuffer commands = CreateTriangleCommandBuffer(); queue.Submit(1, &commands); @@ -107,7 +107,7 @@ TEST_P(DestroyTest, BufferDestroyAfterSubmit) { // First submit succeeds, draws triangle, second submit fails // after destroy is called on the buffer, pixel does not change TEST_P(DestroyTest, BufferSubmitDestroySubmit) { - RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 filled(0, 255, 0, 255); wgpu::CommandBuffer commands = CreateTriangleCommandBuffer(); queue.Submit(1, &commands); @@ -131,7 +131,7 @@ TEST_P(DestroyTest, TextureDestroyBeforeSubmit) { // Destroy after submit will draw successfully TEST_P(DestroyTest, TextureDestroyAfterSubmit) { - RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 filled(0, 255, 0, 255); wgpu::CommandBuffer commands = CreateTriangleCommandBuffer(); queue.Submit(1, &commands); @@ -143,7 +143,7 @@ TEST_P(DestroyTest, TextureDestroyAfterSubmit) { // First submit succeeds, draws triangle, second submit fails // after destroy is called on the texture TEST_P(DestroyTest, TextureSubmitDestroySubmit) { - RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 filled(0, 255, 0, 255); wgpu::CommandBuffer commands = CreateTriangleCommandBuffer(); queue.Submit(1, &commands); @@ -190,6 +190,20 @@ TEST_P(DestroyTest, DestroyDeviceLingeringBGL) { DestroyDevice(); } +// Regression test for crbug.com/1327865 where the device set the queue to null +// inside Destroy() such that it could no longer return it to a call to GetQueue(). +TEST_P(DestroyTest, GetQueueAfterDeviceDestroy) { + DestroyDevice(); + + wgpu::Queue queue = device.GetQueue(); + ASSERT_DEVICE_ERROR(queue.OnSubmittedWorkDone( + 0u, + [](WGPUQueueWorkDoneStatus status, void* userdata) { + EXPECT_EQ(status, WGPUQueueWorkDoneStatus_DeviceLost); + }, + nullptr)); +} + DAWN_INSTANTIATE_TEST(DestroyTest, D3D12Backend(), MetalBackend(), diff --git a/src/dawn/tests/end2end/DeviceInitializationTests.cpp b/src/dawn/tests/end2end/DeviceInitializationTests.cpp index 0c7e62163b..023b7acc53 100644 --- a/src/dawn/tests/end2end/DeviceInitializationTests.cpp +++ b/src/dawn/tests/end2end/DeviceInitializationTests.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include #include "dawn/dawn_proc.h" @@ -21,9 +22,48 @@ #include "dawn/utils/WGPUHelpers.h" class DeviceInitializationTest : public testing::Test { + protected: void SetUp() override { dawnProcSetProcs(&dawn::native::GetProcs()); } void TearDown() override { dawnProcSetProcs(nullptr); } + + // Test that the device can still be used by testing a buffer copy. + void ExpectDeviceUsable(wgpu::Device device) { + wgpu::Buffer src = + utils::CreateBufferFromData(device, wgpu::BufferUsage::CopySrc, {1, 2, 3, 4}); + + wgpu::Buffer dst = utils::CreateBufferFromData( + device, wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::MapRead, {0, 0, 0, 0}); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyBufferToBuffer(src, 0, dst, 0, 4 * sizeof(uint32_t)); + + wgpu::CommandBuffer commands = encoder.Finish(); + device.GetQueue().Submit(1, &commands); + + bool done = false; + dst.MapAsync( + wgpu::MapMode::Read, 0, 4 * sizeof(uint32_t), + [](WGPUBufferMapAsyncStatus status, void* userdata) { + EXPECT_EQ(status, WGPUBufferMapAsyncStatus_Success); + *static_cast(userdata) = true; + }, + &done); + + // Note: we can't actually test this if Tick moves over to + // wgpuInstanceProcessEvents. We can still test that object creation works + // without crashing. + while (!done) { + device.Tick(); + utils::USleep(100); + } + + const uint32_t* mapping = static_cast(dst.GetConstMappedRange()); + EXPECT_EQ(mapping[0], 1u); + EXPECT_EQ(mapping[1], 2u); + EXPECT_EQ(mapping[2], 3u); + EXPECT_EQ(mapping[3], 4u); + } }; // Test that device operations are still valid if the reference to the instance @@ -66,40 +106,64 @@ TEST_F(DeviceInitializationTest, DeviceOutlivesInstance) { } } - // Now, test that the device can still be used by testing a buffer copy. - wgpu::Buffer src = - utils::CreateBufferFromData(device, wgpu::BufferUsage::CopySrc, {1, 2, 3, 4}); - - wgpu::Buffer dst = utils::CreateBufferFromData( - device, wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::MapRead, {0, 0, 0, 0}); - - wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.CopyBufferToBuffer(src, 0, dst, 0, 4 * sizeof(uint32_t)); - - wgpu::CommandBuffer commands = encoder.Finish(); - device.GetQueue().Submit(1, &commands); - - bool done = false; - dst.MapAsync( - wgpu::MapMode::Read, 0, 4 * sizeof(uint32_t), - [](WGPUBufferMapAsyncStatus status, void* userdata) { - EXPECT_EQ(status, WGPUBufferMapAsyncStatus_Success); - *static_cast(userdata) = true; - }, - &done); - - // Note: we can't actually test this if Tick moves over to - // wgpuInstanceProcessEvents. We can still test that object creation works - // without crashing. - while (!done) { - device.Tick(); - utils::USleep(100); + if (device) { + ExpectDeviceUsable(std::move(device)); + } + } +} + +// Test that it is still possible to create a device from an adapter after the reference to the +// instance is dropped. +TEST_F(DeviceInitializationTest, AdapterOutlivesInstance) { + // Get properties of all available adapters and then free the instance. + // We want to create a device on a fresh instance and adapter each time. + std::vector availableAdapterProperties; + { + auto instance = std::make_unique(); + instance->DiscoverDefaultAdapters(); + for (const dawn::native::Adapter& adapter : instance->GetAdapters()) { + wgpu::AdapterProperties properties; + adapter.GetProperties(&properties); + + if (properties.backendType == wgpu::BackendType::Null) { + continue; + } + availableAdapterProperties.push_back(properties); + } + } + + for (const wgpu::AdapterProperties& desiredProperties : availableAdapterProperties) { + wgpu::Adapter adapter; + + auto instance = std::make_unique(); + // Save a pointer to the instance. + // It will only be valid as long as the instance is alive. + WGPUInstance unsafeInstancePtr = instance->Get(); + + instance->DiscoverDefaultAdapters(); + for (dawn::native::Adapter& nativeAdapter : instance->GetAdapters()) { + wgpu::AdapterProperties properties; + nativeAdapter.GetProperties(&properties); + + if (properties.deviceID == desiredProperties.deviceID && + properties.vendorID == desiredProperties.vendorID && + properties.adapterType == desiredProperties.adapterType && + properties.backendType == desiredProperties.backendType) { + // Save the adapter, and reset the instance. + // Check that the number of adapters before the reset is > 0, and after the reset + // is 0. Unsafe, but we assume the pointer is still valid since the adapter is + // holding onto the instance. The instance should have cleared all internal + // references to adapters when the last external ref is dropped. + adapter = wgpu::Adapter(nativeAdapter.Get()); + EXPECT_GT(dawn::native::GetAdapterCountForTesting(unsafeInstancePtr), 0u); + instance.reset(); + EXPECT_EQ(dawn::native::GetAdapterCountForTesting(unsafeInstancePtr), 0u); + break; + } + } + + if (adapter) { + ExpectDeviceUsable(adapter.CreateDevice()); } - - const uint32_t* mapping = static_cast(dst.GetConstMappedRange()); - EXPECT_EQ(mapping[0], 1u); - EXPECT_EQ(mapping[1], 2u); - EXPECT_EQ(mapping[2], 3u); - EXPECT_EQ(mapping[3], 4u); } } diff --git a/src/dawn/tests/end2end/DeviceLifetimeTests.cpp b/src/dawn/tests/end2end/DeviceLifetimeTests.cpp new file mode 100644 index 0000000000..d96ae911c3 --- /dev/null +++ b/src/dawn/tests/end2end/DeviceLifetimeTests.cpp @@ -0,0 +1,481 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "dawn/tests/DawnTest.h" +#include "dawn/utils/WGPUHelpers.h" + +class DeviceLifetimeTests : public DawnTest {}; + +// Test that the device can be dropped before its queue. +TEST_P(DeviceLifetimeTests, DroppedBeforeQueue) { + wgpu::Queue queue = device.GetQueue(); + + device = nullptr; +} + +// Test that the device can be dropped while an onSubmittedWorkDone callback is in flight. +TEST_P(DeviceLifetimeTests, DroppedWhileQueueOnSubmittedWorkDone) { + // Submit some work. + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(nullptr); + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + + // Ask for an onSubmittedWorkDone callback and drop the device. + queue.OnSubmittedWorkDone( + 0, + [](WGPUQueueWorkDoneStatus status, void*) { + EXPECT_EQ(status, WGPUQueueWorkDoneStatus_Success); + }, + nullptr); + + device = nullptr; +} + +// Test that the device can be dropped inside an onSubmittedWorkDone callback. +TEST_P(DeviceLifetimeTests, DroppedInsideQueueOnSubmittedWorkDone) { + // Submit some work. + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(nullptr); + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + + struct Userdata { + wgpu::Device device; + bool done; + }; + // Ask for an onSubmittedWorkDone callback and drop the device inside the callback. + Userdata data = Userdata{std::move(device), false}; + queue.OnSubmittedWorkDone( + 0, + [](WGPUQueueWorkDoneStatus status, void* userdata) { + EXPECT_EQ(status, WGPUQueueWorkDoneStatus_Success); + static_cast(userdata)->device = nullptr; + static_cast(userdata)->done = true; + }, + &data); + + while (!data.done) { + // WaitABit no longer can call tick since we've moved the device from the fixture into the + // userdata. + if (data.device) { + data.device.Tick(); + } + WaitABit(); + } +} + +// Test that the device can be dropped while a popErrorScope callback is in flight. +TEST_P(DeviceLifetimeTests, DroppedWhilePopErrorScope) { + device.PushErrorScope(wgpu::ErrorFilter::Validation); + bool wire = UsesWire(); + device.PopErrorScope( + [](WGPUErrorType type, const char*, void* userdata) { + const bool wire = *static_cast(userdata); + // On the wire, all callbacks get rejected immediately with once the device is deleted. + // In native, popErrorScope is called synchronously. + // TODO(crbug.com/dawn/1122): These callbacks should be made consistent. + EXPECT_EQ(type, wire ? WGPUErrorType_Unknown : WGPUErrorType_NoError); + }, + &wire); + device = nullptr; +} + +// Test that the device can be dropped inside an onSubmittedWorkDone callback. +TEST_P(DeviceLifetimeTests, DroppedInsidePopErrorScope) { + struct Userdata { + wgpu::Device device; + bool done; + }; + device.PushErrorScope(wgpu::ErrorFilter::Validation); + + // Ask for a popErrorScope callback and drop the device inside the callback. + Userdata data = Userdata{std::move(device), false}; + data.device.PopErrorScope( + [](WGPUErrorType type, const char*, void* userdata) { + EXPECT_EQ(type, WGPUErrorType_NoError); + static_cast(userdata)->device = nullptr; + static_cast(userdata)->done = true; + }, + &data); + + while (!data.done) { + // WaitABit no longer can call tick since we've moved the device from the fixture into the + // userdata. + if (data.device) { + data.device.Tick(); + } + WaitABit(); + } +} + +// Test that the device can be dropped before a buffer created from it. +TEST_P(DeviceLifetimeTests, DroppedBeforeBuffer) { + wgpu::BufferDescriptor desc = {}; + desc.size = 4; + desc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + wgpu::Buffer buffer = device.CreateBuffer(&desc); + + device = nullptr; +} + +// Test that the device can be dropped while a buffer created from it is being mapped. +TEST_P(DeviceLifetimeTests, DroppedWhileMappingBuffer) { + wgpu::BufferDescriptor desc = {}; + desc.size = 4; + desc.usage = wgpu::BufferUsage::MapRead | wgpu::BufferUsage::CopyDst; + wgpu::Buffer buffer = device.CreateBuffer(&desc); + + buffer.MapAsync( + wgpu::MapMode::Read, 0, wgpu::kWholeMapSize, + [](WGPUBufferMapAsyncStatus status, void*) { + EXPECT_EQ(status, WGPUBufferMapAsyncStatus_DestroyedBeforeCallback); + }, + nullptr); + + device = nullptr; +} + +// Test that the device can be dropped before a mapped buffer created from it. +TEST_P(DeviceLifetimeTests, DroppedBeforeMappedBuffer) { + wgpu::BufferDescriptor desc = {}; + desc.size = 4; + desc.usage = wgpu::BufferUsage::MapRead | wgpu::BufferUsage::CopyDst; + wgpu::Buffer buffer = device.CreateBuffer(&desc); + + bool done = false; + buffer.MapAsync( + wgpu::MapMode::Read, 0, wgpu::kWholeMapSize, + [](WGPUBufferMapAsyncStatus status, void* userdata) { + EXPECT_EQ(status, WGPUBufferMapAsyncStatus_Success); + *static_cast(userdata) = true; + }, + &done); + + while (!done) { + WaitABit(); + } + + device = nullptr; +} + +// Test that the device can be dropped before a mapped at creation buffer created from it. +TEST_P(DeviceLifetimeTests, DroppedBeforeMappedAtCreationBuffer) { + wgpu::BufferDescriptor desc = {}; + desc.size = 4; + desc.usage = wgpu::BufferUsage::MapRead | wgpu::BufferUsage::CopyDst; + desc.mappedAtCreation = true; + wgpu::Buffer buffer = device.CreateBuffer(&desc); + + device = nullptr; +} + +// Test that the device can be dropped before a buffer created from it, then mapping the buffer +// fails. +TEST_P(DeviceLifetimeTests, DroppedThenMapBuffer) { + wgpu::BufferDescriptor desc = {}; + desc.size = 4; + desc.usage = wgpu::BufferUsage::MapRead | wgpu::BufferUsage::CopyDst; + wgpu::Buffer buffer = device.CreateBuffer(&desc); + + device = nullptr; + + bool done = false; + buffer.MapAsync( + wgpu::MapMode::Read, 0, wgpu::kWholeMapSize, + [](WGPUBufferMapAsyncStatus status, void* userdata) { + EXPECT_EQ(status, WGPUBufferMapAsyncStatus_DeviceLost); + *static_cast(userdata) = true; + }, + &done); + + while (!done) { + WaitABit(); + } +} + +// Test that the device can be dropped inside a buffer map callback. +TEST_P(DeviceLifetimeTests, DroppedInsideBufferMapCallback) { + wgpu::BufferDescriptor desc = {}; + desc.size = 4; + desc.usage = wgpu::BufferUsage::MapRead | wgpu::BufferUsage::CopyDst; + wgpu::Buffer buffer = device.CreateBuffer(&desc); + + struct Userdata { + wgpu::Device device; + wgpu::Buffer buffer; + bool wire; + bool done; + }; + + // Ask for a mapAsync callback and drop the device inside the callback. + Userdata data = Userdata{std::move(device), buffer, UsesWire(), false}; + buffer.MapAsync( + wgpu::MapMode::Read, 0, wgpu::kWholeMapSize, + [](WGPUBufferMapAsyncStatus status, void* userdata) { + EXPECT_EQ(status, WGPUBufferMapAsyncStatus_Success); + auto* data = static_cast(userdata); + data->device = nullptr; + data->done = true; + + // Mapped data should be null since the buffer is implicitly destroyed. + // TODO(crbug.com/dawn/1424): On the wire client, we don't track device child objects so + // the mapped data is still available when the device is destroyed. + if (!data->wire) { + EXPECT_EQ(data->buffer.GetConstMappedRange(), nullptr); + } + }, + &data); + + while (!data.done) { + // WaitABit no longer can call tick since we've moved the device from the fixture into the + // userdata. + if (data.device) { + data.device.Tick(); + } + WaitABit(); + } + + // Mapped data should be null since the buffer is implicitly destroyed. + // TODO(crbug.com/dawn/1424): On the wire client, we don't track device child objects so the + // mapped data is still available when the device is destroyed. + if (!UsesWire()) { + EXPECT_EQ(buffer.GetConstMappedRange(), nullptr); + } +} + +// Test that the device can be dropped while a write buffer operation is enqueued. +TEST_P(DeviceLifetimeTests, DroppedWhileWriteBuffer) { + wgpu::BufferDescriptor desc = {}; + desc.size = 4; + desc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + wgpu::Buffer buffer = device.CreateBuffer(&desc); + + uint32_t value = 7; + queue.WriteBuffer(buffer, 0, &value, sizeof(value)); + device = nullptr; +} + +// Test that the device can be dropped while a write buffer operation is enqueued and then +// a queue submit occurs. This is slightly different from the former test since it ensures +// that pending work is flushed. +TEST_P(DeviceLifetimeTests, DroppedWhileWriteBufferAndSubmit) { + wgpu::BufferDescriptor desc = {}; + desc.size = 4; + desc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + wgpu::Buffer buffer = device.CreateBuffer(&desc); + + uint32_t value = 7; + queue.WriteBuffer(buffer, 0, &value, sizeof(value)); + queue.Submit(0, nullptr); + device = nullptr; +} + +// Test that the device can be dropped while createPipelineAsync is in flight +TEST_P(DeviceLifetimeTests, DroppedWhileCreatePipelineAsync) { + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = utils::CreateShaderModule(device, R"( + @compute @workgroup_size(1) fn main() { + })"); + desc.compute.entryPoint = "main"; + + device.CreateComputePipelineAsync( + &desc, + [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline cPipeline, const char* message, + void* userdata) { + wgpu::ComputePipeline::Acquire(cPipeline); + EXPECT_EQ(status, WGPUCreatePipelineAsyncStatus_DeviceDestroyed); + }, + nullptr); + + device = nullptr; +} + +// Test that the device can be dropped inside a createPipelineAsync callback +TEST_P(DeviceLifetimeTests, DroppedInsideCreatePipelineAsync) { + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = utils::CreateShaderModule(device, R"( + @compute @workgroup_size(1) fn main() { + })"); + desc.compute.entryPoint = "main"; + + struct Userdata { + wgpu::Device device; + bool done; + }; + // Call CreateComputePipelineAsync and drop the device inside the callback. + Userdata data = Userdata{std::move(device), false}; + data.device.CreateComputePipelineAsync( + &desc, + [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline cPipeline, const char* message, + void* userdata) { + wgpu::ComputePipeline::Acquire(cPipeline); + EXPECT_EQ(status, WGPUCreatePipelineAsyncStatus_Success); + + static_cast(userdata)->device = nullptr; + static_cast(userdata)->done = true; + }, + &data); + + while (!data.done) { + // WaitABit no longer can call tick since we've moved the device from the fixture into the + // userdata. + if (data.device) { + data.device.Tick(); + } + WaitABit(); + } +} + +// Test that the device can be dropped while createPipelineAsync which will hit the frontend cache +// is in flight +TEST_P(DeviceLifetimeTests, DroppedWhileCreatePipelineAsyncAlreadyCached) { + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = utils::CreateShaderModule(device, R"( + @compute @workgroup_size(1) fn main() { + })"); + desc.compute.entryPoint = "main"; + + // Create a pipeline ahead of time so it's in the cache. + wgpu::ComputePipeline p = device.CreateComputePipeline(&desc); + + bool wire = UsesWire(); + device.CreateComputePipelineAsync( + &desc, + [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline cPipeline, const char*, + void* userdata) { + const bool wire = *static_cast(userdata); + wgpu::ComputePipeline::Acquire(cPipeline); + // On the wire, all callbacks get rejected immediately with once the device is deleted. + // In native, expect success since the compilation hits the frontend cache immediately. + // TODO(crbug.com/dawn/1122): These callbacks should be made consistent. + EXPECT_EQ(status, wire ? WGPUCreatePipelineAsyncStatus_DeviceDestroyed + : WGPUCreatePipelineAsyncStatus_Success); + }, + &wire); + device = nullptr; +} + +// Test that the device can be dropped inside a createPipelineAsync callback which will hit the +// frontend cache +TEST_P(DeviceLifetimeTests, DroppedInsideCreatePipelineAsyncAlreadyCached) { + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = utils::CreateShaderModule(device, R"( + @compute @workgroup_size(1) fn main() { + })"); + desc.compute.entryPoint = "main"; + + // Create a pipeline ahead of time so it's in the cache. + wgpu::ComputePipeline p = device.CreateComputePipeline(&desc); + + struct Userdata { + wgpu::Device device; + bool done; + }; + // Call CreateComputePipelineAsync and drop the device inside the callback. + Userdata data = Userdata{std::move(device), false}; + data.device.CreateComputePipelineAsync( + &desc, + [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline cPipeline, const char* message, + void* userdata) { + wgpu::ComputePipeline::Acquire(cPipeline); + // Success because it hits the frontend cache immediately. + EXPECT_EQ(status, WGPUCreatePipelineAsyncStatus_Success); + + static_cast(userdata)->device = nullptr; + static_cast(userdata)->done = true; + }, + &data); + + while (!data.done) { + // WaitABit no longer can call tick since we've moved the device from the fixture into the + // userdata. + if (data.device) { + data.device.Tick(); + } + WaitABit(); + } +} + +// Test that the device can be dropped while createPipelineAsync which will race with a compilation +// to add the same pipeline to the frontend cache +TEST_P(DeviceLifetimeTests, DroppedWhileCreatePipelineAsyncRaceCache) { + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = utils::CreateShaderModule(device, R"( + @compute @workgroup_size(1) fn main() { + })"); + desc.compute.entryPoint = "main"; + + device.CreateComputePipelineAsync( + &desc, + [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline cPipeline, const char* message, + void* userdata) { + wgpu::ComputePipeline::Acquire(cPipeline); + EXPECT_EQ(status, WGPUCreatePipelineAsyncStatus_DeviceDestroyed); + }, + nullptr); + + // Create the same pipeline synchronously which will get added to the cache. + wgpu::ComputePipeline p = device.CreateComputePipeline(&desc); + + device = nullptr; +} + +// Test that the device can be dropped inside a createPipelineAsync callback which which will race +// with a compilation to add the same pipeline to the frontend cache +TEST_P(DeviceLifetimeTests, DroppedInsideCreatePipelineAsyncRaceCache) { + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = utils::CreateShaderModule(device, R"( + @compute @workgroup_size(1) fn main() { + })"); + desc.compute.entryPoint = "main"; + + struct Userdata { + wgpu::Device device; + bool done; + }; + // Call CreateComputePipelineAsync and drop the device inside the callback. + Userdata data = Userdata{std::move(device), false}; + data.device.CreateComputePipelineAsync( + &desc, + [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline cPipeline, const char* message, + void* userdata) { + wgpu::ComputePipeline::Acquire(cPipeline); + EXPECT_EQ(status, WGPUCreatePipelineAsyncStatus_Success); + + static_cast(userdata)->device = nullptr; + static_cast(userdata)->done = true; + }, + &data); + + // Create the same pipeline synchronously which will get added to the cache. + wgpu::ComputePipeline p = data.device.CreateComputePipeline(&desc); + + while (!data.done) { + // WaitABit no longer can call tick since we've moved the device from the fixture into the + // userdata. + if (data.device) { + data.device.Tick(); + } + WaitABit(); + } +} + +DAWN_INSTANTIATE_TEST(DeviceLifetimeTests, + D3D12Backend(), + MetalBackend(), + NullBackend(), + OpenGLBackend(), + OpenGLESBackend(), + VulkanBackend()); diff --git a/src/dawn/tests/end2end/DeviceLostTests.cpp b/src/dawn/tests/end2end/DeviceLostTests.cpp index 2ac47f69b3..4a906cd468 100644 --- a/src/dawn/tests/end2end/DeviceLostTests.cpp +++ b/src/dawn/tests/end2end/DeviceLostTests.cpp @@ -93,7 +93,7 @@ TEST_P(DeviceLostTest, GetBindGroupLayoutFails) { pos : vec4 } @group(0) @binding(0) var ubo : UniformBuffer; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::ComputePipelineDescriptor descriptor; @@ -176,7 +176,7 @@ TEST_P(DeviceLostTest, CreateShaderModuleFails) { LoseDeviceForTesting(); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })")); @@ -423,7 +423,7 @@ TEST_P(DeviceLostTest, DeviceLostDoesntCallUncapturedError) { // before the callback of Create*PipelineAsync() is called. TEST_P(DeviceLostTest, DeviceLostBeforeCreatePipelineAsyncCallback) { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::ComputePipelineDescriptor descriptor; diff --git a/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp b/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp index 43ffa1a79c..cfbad2a8c2 100644 --- a/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp +++ b/src/dawn/tests/end2end/DrawIndexedIndirectTests.cpp @@ -37,13 +37,13 @@ class DrawIndexedIndirectTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -103,7 +103,9 @@ class DrawIndexedIndirectTest : public DawnTest { return encoder.Finish(); } - void TestDraw(wgpu::CommandBuffer commands, RGBA8 bottomLeftExpected, RGBA8 topRightExpected) { + void TestDraw(wgpu::CommandBuffer commands, + utils::RGBA8 bottomLeftExpected, + utils::RGBA8 topRightExpected) { queue.Submit(1, &commands); EXPECT_PIXEL_RGBA8_EQ(bottomLeftExpected, renderPass.color, 1, 3); @@ -113,8 +115,8 @@ class DrawIndexedIndirectTest : public DawnTest { void Test(std::initializer_list bufferList, uint64_t indexOffset, uint64_t indirectOffset, - RGBA8 bottomLeftExpected, - RGBA8 topRightExpected) { + utils::RGBA8 bottomLeftExpected, + utils::RGBA8 topRightExpected) { wgpu::Buffer indexBuffer = CreateIndexBuffer({0, 1, 2, 0, 3, 1, // The indices below are added to test negatve baseVertex @@ -133,8 +135,8 @@ TEST_P(DrawIndexedIndirectTest, Uint32) { // the offsets that Tint/GLSL produces. DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL() && IsLinux()); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); // Test a draw with no indices. Test({0, 0, 0, 0, 0}, 0, 0, notFilled, notFilled); @@ -164,8 +166,8 @@ TEST_P(DrawIndexedIndirectTest, BaseVertex) { // the offsets that Tint/GLSL produces. DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL() && IsLinux()); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); // Test a draw with only the first 3 indices of the second quad (top right triangle) Test({3, 1, 0, 4, 0}, 0, 0, notFilled, filled); @@ -197,8 +199,8 @@ TEST_P(DrawIndexedIndirectTest, IndirectOffset) { // the offsets that Tint/GLSL produces. DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL() && IsLinux()); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); // Test an offset draw call, with indirect buffer containing 2 calls: // 1) first 3 indices of the second quad (top right triangle) @@ -222,8 +224,8 @@ TEST_P(DrawIndexedIndirectTest, BasicValidation) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::Buffer indexBuffer = CreateIndexBuffer({0, 1, 2, 0, 3, 1}); @@ -249,8 +251,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateWithOffsets) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::Buffer indexBuffer = CreateIndexBuffer({0, 1, 2, 0, 3, 1, 0, 1, 2}); @@ -281,8 +283,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateMultiplePasses) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::Buffer indexBuffer = CreateIndexBuffer({0, 1, 2, 0, 3, 1, 0, 1, 2}); @@ -309,8 +311,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateMultipleDraws) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); // Validate multiple draw calls using the same index and indirect buffers as input, but with // different indirect offsets. @@ -409,8 +411,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateEncodeMultipleThenSubmitInOrder) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::Buffer indexBuffer = CreateIndexBuffer({0, 1, 2, 0, 3, 1, 0, 1, 2}); @@ -447,8 +449,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateEncodeMultipleThenSubmitAtOnce) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::Buffer indexBuffer = CreateIndexBuffer({0, 1, 2, 0, 3, 1, 0, 1, 2}); @@ -475,8 +477,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateEncodeMultipleThenSubmitOutOfOrder) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::Buffer indexBuffer = CreateIndexBuffer({0, 1, 2, 0, 3, 1, 0, 1, 2}); @@ -509,8 +511,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateWithBundlesInSamePass) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::Buffer indirectBuffer = CreateIndirectBuffer({3, 1, 3, 0, 0, 10, 1, 0, 0, 0, 3, 1, 6, 0, 0}); @@ -564,8 +566,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateWithBundlesInDifferentPasses) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::Buffer indirectBuffer = CreateIndirectBuffer({3, 1, 3, 0, 0, 10, 1, 0, 0, 0, 3, 1, 6, 0, 0}); @@ -636,8 +638,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateReusedBundleWithChangingParams) { // It doesn't make sense to test invalid inputs when validation is disabled. DAWN_SUPPRESS_TEST_IF(HasToggleEnabled("skip_validation")); - RGBA8 filled(0, 255, 0, 255); - // RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + // utils::RGBA8 notFilled(0, 0, 0, 0); wgpu::Buffer indirectBuffer = CreateIndirectBuffer({0, 0, 0, 0, 0}); wgpu::Buffer indexBuffer = CreateIndexBuffer({0, 1, 2, 0, 3, 1}); @@ -663,8 +665,8 @@ TEST_P(DrawIndexedIndirectTest, ValidateReusedBundleWithChangingParams) { firstIndex: u32, } @group(0) @binding(0) var input: Input; - @group(0) @binding(1) var params: Params; - @stage(compute) @workgroup_size(1) fn main() { + @group(0) @binding(1) var params: Params; + @compute @workgroup_size(1) fn main() { params.indexCount = 3u; params.instanceCount = 1u; params.firstIndex = input.firstIndex; diff --git a/src/dawn/tests/end2end/DrawIndexedTests.cpp b/src/dawn/tests/end2end/DrawIndexedTests.cpp index c28b297136..ef5ce14daa 100644 --- a/src/dawn/tests/end2end/DrawIndexedTests.cpp +++ b/src/dawn/tests/end2end/DrawIndexedTests.cpp @@ -27,13 +27,13 @@ class DrawIndexedTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -80,8 +80,8 @@ class DrawIndexedTest : public DawnTest { int32_t baseVertex, uint32_t firstInstance, uint64_t bufferOffset, - RGBA8 bottomLeftExpected, - RGBA8 topRightExpected) { + utils::RGBA8 bottomLeftExpected, + utils::RGBA8 topRightExpected) { // Regular draw with a reasonable index buffer TestImplementation(indexCount, instanceCount, firstIndex, baseVertex, firstInstance, bufferOffset, indexBuffer, bottomLeftExpected, topRightExpected); @@ -89,8 +89,8 @@ class DrawIndexedTest : public DawnTest { void TestZeroSizedIndexBufferDraw(uint32_t indexCount, uint32_t firstIndex, - RGBA8 bottomLeftExpected, - RGBA8 topRightExpected) { + utils::RGBA8 bottomLeftExpected, + utils::RGBA8 topRightExpected) { TestImplementation(indexCount, 1, firstIndex, 0, 0, 0, zeroSizedIndexBuffer, bottomLeftExpected, topRightExpected); } @@ -102,8 +102,8 @@ class DrawIndexedTest : public DawnTest { uint32_t firstInstance, uint64_t bufferOffset, const wgpu::Buffer& curIndexBuffer, - RGBA8 bottomLeftExpected, - RGBA8 topRightExpected) { + utils::RGBA8 bottomLeftExpected, + utils::RGBA8 topRightExpected) { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); @@ -124,8 +124,8 @@ class DrawIndexedTest : public DawnTest { // The most basic DrawIndexed triangle draw. TEST_P(DrawIndexedTest, Uint32) { - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); // Test a draw with no indices. Test(0, 0, 0, 0, 0, 0, notFilled, notFilled); @@ -140,8 +140,8 @@ TEST_P(DrawIndexedTest, Uint32) { // Test the parameter 'baseVertex' of DrawIndexed() works. TEST_P(DrawIndexedTest, BaseVertex) { DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_base_vertex")); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); // Test a draw with only the first 3 indices of the second quad (top right triangle) Test(3, 1, 0, 4, 0, 0, notFilled, filled); diff --git a/src/dawn/tests/end2end/DrawIndirectTests.cpp b/src/dawn/tests/end2end/DrawIndirectTests.cpp index 84ab2b4634..d5669b8e59 100644 --- a/src/dawn/tests/end2end/DrawIndirectTests.cpp +++ b/src/dawn/tests/end2end/DrawIndirectTests.cpp @@ -27,13 +27,13 @@ class DrawIndirectTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -65,8 +65,8 @@ class DrawIndirectTest : public DawnTest { void Test(std::initializer_list bufferList, uint64_t indirectOffset, - RGBA8 bottomLeftExpected, - RGBA8 topRightExpected) { + utils::RGBA8 bottomLeftExpected, + utils::RGBA8 topRightExpected) { wgpu::Buffer indirectBuffer = utils::CreateBufferFromData(device, wgpu::BufferUsage::Indirect, bufferList); @@ -93,8 +93,8 @@ TEST_P(DrawIndirectTest, Uint32) { // the offsets that Tint/GLSL produces. DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL() && IsLinux()); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); // Test a draw with no indices. Test({0, 0, 0, 0}, 0, notFilled, notFilled); @@ -114,8 +114,8 @@ TEST_P(DrawIndirectTest, IndirectOffset) { // the offsets that Tint/GLSL produces. DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL() && IsLinux()); - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); // Test an offset draw call, with indirect buffer containing 2 calls: // 1) only the first 3 indices (bottom left triangle) diff --git a/src/dawn/tests/end2end/DrawTests.cpp b/src/dawn/tests/end2end/DrawTests.cpp index 55e86ce5c4..32e14cf9c1 100644 --- a/src/dawn/tests/end2end/DrawTests.cpp +++ b/src/dawn/tests/end2end/DrawTests.cpp @@ -27,13 +27,13 @@ class DrawTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -66,8 +66,8 @@ class DrawTest : public DawnTest { uint32_t instanceCount, uint32_t firstIndex, uint32_t firstInstance, - RGBA8 bottomLeftExpected, - RGBA8 topRightExpected) { + utils::RGBA8 bottomLeftExpected, + utils::RGBA8 topRightExpected) { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); @@ -87,8 +87,8 @@ class DrawTest : public DawnTest { // The basic triangle draw. TEST_P(DrawTest, Uint32) { - RGBA8 filled(0, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); // Test a draw with no indices. Test(0, 0, 0, 0, notFilled, notFilled); diff --git a/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp b/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp index 23dee828c4..61caf90608 100644 --- a/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp +++ b/src/dawn/tests/end2end/DynamicBufferOffsetTests.cpp @@ -104,7 +104,7 @@ class DynamicBufferOffsetTests : public DawnTest { wgpu::RenderPipeline CreateRenderPipeline(bool isInheritedPipeline = false) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 0.0), @@ -135,7 +135,7 @@ class DynamicBufferOffsetTests : public DawnTest { fs << "let multipleNumber : u32 = " << multipleNumber << "u;\n"; fs << R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { sBufferNotDynamic.value = uBufferNotDynamic.value.xy; sBuffer.value = vec2(multipleNumber, multipleNumber) * (uBuffer.value.xy + uBufferNotDynamic.value.xy); return vec4(f32(uBuffer.value.x) / 255.0, f32(uBuffer.value.y) / 255.0, @@ -185,7 +185,7 @@ class DynamicBufferOffsetTests : public DawnTest { cs << "let multipleNumber : u32 = " << multipleNumber << "u;\n"; cs << R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { sBufferNotDynamic.value = uBufferNotDynamic.value.xy; sBuffer.value = vec2(multipleNumber, multipleNumber) * (uBuffer.value.xy + uBufferNotDynamic.value.xy); } @@ -227,7 +227,7 @@ TEST_P(DynamicBufferOffsetTests, BasicRenderPipeline) { queue.Submit(1, &commands); std::vector expectedData = {2, 4}; - EXPECT_PIXEL_RGBA8_EQ(RGBA8(1, 2, 255, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(1, 2, 255, 255), renderPass.color, 0, 0); EXPECT_BUFFER_U32_RANGE_EQ(expectedData.data(), mStorageBuffers[1], 0, expectedData.size()); } @@ -249,7 +249,7 @@ TEST_P(DynamicBufferOffsetTests, SetDynamicOffsetsRenderPipeline) { queue.Submit(1, &commands); std::vector expectedData = {6, 8}; - EXPECT_PIXEL_RGBA8_EQ(RGBA8(5, 6, 255, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(5, 6, 255, 255), renderPass.color, 0, 0); EXPECT_BUFFER_U32_RANGE_EQ(expectedData.data(), mStorageBuffers[1], mMinUniformBufferOffsetAlignment, expectedData.size()); } @@ -318,7 +318,7 @@ TEST_P(DynamicBufferOffsetTests, InheritDynamicOffsetsRenderPipeline) { queue.Submit(1, &commands); std::vector expectedData = {12, 16}; - EXPECT_PIXEL_RGBA8_EQ(RGBA8(5, 6, 255, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(5, 6, 255, 255), renderPass.color, 0, 0); EXPECT_BUFFER_U32_RANGE_EQ(expectedData.data(), mStorageBuffers[1], mMinUniformBufferOffsetAlignment, expectedData.size()); } @@ -376,7 +376,7 @@ TEST_P(DynamicBufferOffsetTests, UpdateDynamicOffsetsMultipleTimesRenderPipeline queue.Submit(1, &commands); std::vector expectedData = {2, 4}; - EXPECT_PIXEL_RGBA8_EQ(RGBA8(1, 2, 255, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(1, 2, 255, 255), renderPass.color, 0, 0); EXPECT_BUFFER_U32_RANGE_EQ(expectedData.data(), mStorageBuffers[1], 0, expectedData.size()); } @@ -480,7 +480,7 @@ TEST_P(ClampedOOBDynamicBufferOffsetTests, CheckOOBAccess) { @group(0) @binding(1) var dst : Dst; )"; shader << R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { for (var i: u32 = 0u; i < kArrayLength; i = i + 1u) { dst.values[i + kWriteOffset] = src.values[i + kReadOffset]; } diff --git a/src/dawn/tests/end2end/EntryPointTests.cpp b/src/dawn/tests/end2end/EntryPointTests.cpp index 02266ba2cc..20335c4839 100644 --- a/src/dawn/tests/end2end/EntryPointTests.cpp +++ b/src/dawn/tests/end2end/EntryPointTests.cpp @@ -24,11 +24,11 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) { // TODO(crbug.com/dawn/658): Crashes on bots DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES()); wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -55,7 +55,7 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, renderPass.color, 0, 0); } // Test creating two compute pipelines from the same module. @@ -83,12 +83,12 @@ TEST_P(EntryPointTests, TwoComputeInModule) { } @binding(0) @group(0) var data : Data; - @stage(compute) @workgroup_size(1) fn write1() { + @compute @workgroup_size(1) fn write1() { data.data = 1u; return; } - @stage(compute) @workgroup_size(1) fn write42() { + @compute @workgroup_size(1) fn write42() { data.data = 42u; return; } diff --git a/src/dawn/tests/end2end/ExperimentalDP4aTests.cpp b/src/dawn/tests/end2end/ExperimentalDP4aTests.cpp new file mode 100644 index 0000000000..e6ecf3aabd --- /dev/null +++ b/src/dawn/tests/end2end/ExperimentalDP4aTests.cpp @@ -0,0 +1,106 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "dawn/tests/DawnTest.h" +#include "dawn/utils/WGPUHelpers.h" + +namespace { +using RequestDP4aExtension = bool; +DAWN_TEST_PARAM_STRUCT(ExperimentalDP4aTestsParams, RequestDP4aExtension); + +} // anonymous namespace + +class ExperimentalDP4aTests : public DawnTestWithParams { + protected: + std::vector GetRequiredFeatures() override { + mIsDP4aSupportedOnAdapter = SupportsFeatures({wgpu::FeatureName::ChromiumExperimentalDp4a}); + if (!mIsDP4aSupportedOnAdapter) { + return {}; + } + + if (GetParam().mRequestDP4aExtension) { + return {wgpu::FeatureName::ChromiumExperimentalDp4a}; + } + + return {}; + } + + bool IsDP4aSupportedOnAdapter() const { return mIsDP4aSupportedOnAdapter; } + + private: + bool mIsDP4aSupportedOnAdapter = false; +}; + +TEST_P(ExperimentalDP4aTests, BasicDP4aFeaturesTest) { + const char* computeShader = R"( + enable chromium_experimental_dp4a; + + struct Buf { + data1 : i32, + data2 : u32, + data3 : i32, + data4 : u32, + } + @group(0) @binding(0) var buf : Buf; + + @compute @workgroup_size(1) + fn main() { + var a = 0xFFFFFFFFu; + var b = 0xFFFFFFFEu; + var c = 0x01020304u; + buf.data1 = dot4I8Packed(a, b); + buf.data2 = dot4U8Packed(a, b); + buf.data3 = dot4I8Packed(a, c); + buf.data4 = dot4U8Packed(a, c); + } +)"; + if (!GetParam().mRequestDP4aExtension || !IsDP4aSupportedOnAdapter() || + (IsD3D12() && !HasToggleEnabled("use_dxc"))) { + ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, computeShader)); + return; + } + + wgpu::BufferDescriptor bufferDesc; + bufferDesc.size = 4 * sizeof(uint32_t); + bufferDesc.usage = wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopySrc; + wgpu::Buffer bufferOut = device.CreateBuffer(&bufferDesc); + + wgpu::ComputePipelineDescriptor csDesc; + csDesc.compute.module = utils::CreateShaderModule(device, computeShader); + csDesc.compute.entryPoint = "main"; + wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc); + + wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), + { + {0, bufferOut}, + }); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::ComputePassEncoder pass = encoder.BeginComputePass(); + pass.SetPipeline(pipeline); + pass.SetBindGroup(0, bindGroup); + pass.DispatchWorkgroups(1); + pass.End(); + wgpu::CommandBuffer commands = encoder.Finish(); + queue.Submit(1, &commands); + + uint32_t expected[] = {5, 259845, static_cast(-10), 2550}; + EXPECT_BUFFER_U32_RANGE_EQ(expected, bufferOut, 0, 4); +} + +DAWN_INSTANTIATE_TEST_P(ExperimentalDP4aTests, + {D3D12Backend(), D3D12Backend({"use_dxc"}), VulkanBackend()}, + {true, false}); diff --git a/src/dawn/tests/end2end/ExternalTextureTests.cpp b/src/dawn/tests/end2end/ExternalTextureTests.cpp index 4215c7765a..5511437647 100644 --- a/src/dawn/tests/end2end/ExternalTextureTests.cpp +++ b/src/dawn/tests/end2end/ExternalTextureTests.cpp @@ -37,10 +37,28 @@ wgpu::Texture Create2DTexture(wgpu::Device device, class ExternalTextureTests : public DawnTest { protected: + wgpu::ExternalTextureDescriptor CreateDefaultExternalTextureDescriptor() { + wgpu::ExternalTextureDescriptor desc; + desc.yuvToRgbConversionMatrix = kYuvToRGBMatrixBT709.data(); + desc.gamutConversionMatrix = kGamutConversionMatrixBT709ToSrgb.data(); + desc.srcTransferFunctionParameters = kGammaDecodeBT709.data(); + desc.dstTransferFunctionParameters = kGammaEncodeSrgb.data(); + + return desc; + } + static constexpr uint32_t kWidth = 4; static constexpr uint32_t kHeight = 4; static constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm; static constexpr wgpu::TextureUsage kSampledUsage = wgpu::TextureUsage::TextureBinding; + std::array kYuvToRGBMatrixBT709 = {1.164384f, 0.0f, 1.792741f, -0.972945f, + 1.164384f, -0.213249f, -0.532909f, 0.301483f, + 1.164384f, 2.112402f, 0.0f, -1.133402f}; + std::array kGamutConversionMatrixBT709ToSrgb = {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 0.0f, 1.0f}; + std::array kGammaDecodeBT709 = {2.2, 1.0 / 1.099, 0.099 / 1.099, 1 / 4.5, 0.081, + 0.0, 0.0}; + std::array kGammaEncodeSrgb = {1 / 2.4, 1.137119, 0.0, 12.92, 0.0031308, -0.055, 0.0}; }; } // anonymous namespace @@ -51,7 +69,7 @@ TEST_P(ExternalTextureTests, CreateExternalTextureSuccess) { wgpu::TextureView view = texture.CreateView(); // Create an ExternalTextureDescriptor from the texture view - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = view; // Import the external texture @@ -66,7 +84,7 @@ TEST_P(ExternalTextureTests, SampleExternalTexture) { DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES()); const wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var positions = array, 3>( vec4(-1.0, 1.0, 0.0, 1.0), vec4(-1.0, -1.0, 0.0, 1.0), @@ -79,7 +97,7 @@ TEST_P(ExternalTextureTests, SampleExternalTexture) { @group(0) @binding(0) var s : sampler; @group(0) @binding(1) var t : texture_external; - @stage(fragment) fn main(@builtin(position) FragCoord : vec4) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSampleLevel(t, s, FragCoord.xy / vec2(4.0, 4.0)); })"); @@ -114,7 +132,7 @@ TEST_P(ExternalTextureTests, SampleExternalTexture) { wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); // Create an ExternalTextureDescriptor from the texture view - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = externalView; // Import the external texture @@ -142,7 +160,7 @@ TEST_P(ExternalTextureTests, SampleExternalTexture) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderTexture, 0, 0); } TEST_P(ExternalTextureTests, SampleMultiplanarExternalTexture) { @@ -151,7 +169,7 @@ TEST_P(ExternalTextureTests, SampleMultiplanarExternalTexture) { DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES()); const wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var positions = array, 3>( vec4(-1.0, 1.0, 0.0, 1.0), vec4(-1.0, -1.0, 0.0, 1.0), @@ -164,7 +182,7 @@ TEST_P(ExternalTextureTests, SampleMultiplanarExternalTexture) { @group(0) @binding(0) var s : sampler; @group(0) @binding(1) var t : texture_external; - @stage(fragment) fn main(@builtin(position) FragCoord : vec4) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSampleLevel(t, s, FragCoord.xy / vec2(4.0, 4.0)); })"); @@ -188,15 +206,15 @@ TEST_P(ExternalTextureTests, SampleMultiplanarExternalTexture) { double y; double u; double v; - RGBA8 rgba; + utils::RGBA8 rgba; }; // Conversion expectations for BT.709 YUV source and sRGB destination. std::array expectations = { - {{0.0, .5, .5, RGBA8::kBlack}, - {0.2126, 0.4172, 1.0, RGBA8::kRed}, - {0.7152, 0.1402, 0.0175, RGBA8::kGreen}, - {0.0722, 1.0, 0.4937, RGBA8::kBlue}, + {{0.0, .5, .5, utils::RGBA8::kBlack}, + {0.2126, 0.4172, 1.0, utils::RGBA8::kRed}, + {0.7152, 0.1402, 0.0175, utils::RGBA8::kGreen}, + {0.0722, 1.0, 0.4937, utils::RGBA8::kBlue}, {0.6382, 0.3232, 0.6644, {246, 169, 90, 255}}, {0.5423, 0.5323, 0.4222, {120, 162, 169, 255}}, {0.2345, 0.4383, 0.6342, {126, 53, 33, 255}}}}; @@ -225,7 +243,7 @@ TEST_P(ExternalTextureTests, SampleMultiplanarExternalTexture) { wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); // Create an ExternalTextureDescriptor from the texture views - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = externalViewPlane0; externalDesc.plane1 = externalViewPlane1; diff --git a/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp b/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp index 768db35b13..2b795d6b8f 100644 --- a/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp +++ b/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp @@ -63,6 +63,13 @@ class FirstIndexOffsetTests : public DawnTest { DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES()); } + std::vector GetRequiredFeatures() override { + if (!SupportsFeatures({wgpu::FeatureName::IndirectFirstInstance})) { + return {}; + } + return {wgpu::FeatureName::IndirectFirstInstance}; + } + private: void TestImpl(DrawMode mode, CheckIndex checkIndex, @@ -128,7 +135,7 @@ struct VertexInputs { struct VertexOutputs { )" + vertexOutputs.str() + R"( } -@stage(vertex) fn main(input : VertexInputs) -> VertexOutputs { +@vertex fn main(input : VertexInputs) -> VertexOutputs { var output : VertexOutputs; )" + vertexBody.str() + R"( output.position = input.position; @@ -145,7 +152,7 @@ struct IndexVals { struct FragInputs { )" + fragmentInputs.str() + R"( } -@stage(fragment) fn main(input : FragInputs) { +@fragment fn main(input : FragInputs) { )" + fragmentBody.str() + R"( })"; @@ -280,6 +287,8 @@ TEST_P(FirstIndexOffsetTests, IndexedBothOffset) { // Test that vertex_index starts at 7 when drawn using DrawIndirect() TEST_P(FirstIndexOffsetTests, NonIndexedIndirectVertexOffset) { + // TODO(crbug.com/dawn/1429): Fails with the full validation turned on. + DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsFullBackendValidationEnabled()); TestVertexIndex(DrawMode::NonIndexedIndirect, 7); } @@ -296,6 +305,8 @@ TEST_P(FirstIndexOffsetTests, NonIndexedIndirectBothOffset) { // Test that vertex_index starts at 7 when drawn using DrawIndexedIndirect() TEST_P(FirstIndexOffsetTests, IndexedIndirectVertex) { + // TODO(crbug.com/dawn/1429): Fails with the full validation turned on. + DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsFullBackendValidationEnabled()); TestVertexIndex(DrawMode::IndexedIndirect, 7); } diff --git a/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp b/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp index 5bd06048c7..073a6667f1 100644 --- a/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp +++ b/src/dawn/tests/end2end/GpuMemorySynchronizationTests.cpp @@ -43,7 +43,7 @@ class GpuMemorySyncTests : public DawnTest { a : i32 } @group(0) @binding(0) var data : Data; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { data.a = data.a + 1; })"); @@ -61,7 +61,7 @@ class GpuMemorySyncTests : public DawnTest { const wgpu::Buffer& buffer, wgpu::TextureFormat colorFormat) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -70,7 +70,7 @@ class GpuMemorySyncTests : public DawnTest { i : i32 } @group(0) @binding(0) var data : Data; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { data.i = data.i + 1; return vec4(f32(data.i) / 255.0, 0.0, 0.0, 1.0); })"); @@ -144,7 +144,7 @@ TEST_P(GpuMemorySyncTests, RenderPass) { queue.Submit(1, &commands); // Verify the result. - EXPECT_PIXEL_RGBA8_EQ(RGBA8(iteration, 0, 0, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(iteration, 0, 0, 255), renderPass.color, 0, 0); } // Write into a storage buffer in a render pass. Then read that data in a compute @@ -210,7 +210,7 @@ TEST_P(GpuMemorySyncTests, ComputePassToRenderPass) { queue.Submit(1, &commands); // Verify the result. - EXPECT_PIXEL_RGBA8_EQ(RGBA8(2, 0, 0, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(2, 0, 0, 255), renderPass.color, 0, 0); } DAWN_INSTANTIATE_TEST(GpuMemorySyncTests, @@ -235,7 +235,7 @@ class StorageToUniformSyncTests : public DawnTest { a : f32 } @group(0) @binding(0) var data : Data; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { data.a = 1.0; })"); @@ -252,7 +252,7 @@ class StorageToUniformSyncTests : public DawnTest { std::tuple CreatePipelineAndBindGroupForRender( wgpu::TextureFormat colorFormat) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -262,7 +262,7 @@ class StorageToUniformSyncTests : public DawnTest { } @group(0) @binding(0) var contents : Contents; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(contents.color, 0.0, 0.0, 1.0); })"); @@ -310,7 +310,7 @@ TEST_P(StorageToUniformSyncTests, ReadAfterWriteWithSameCommandBuffer) { queue.Submit(1, &commands); // Verify the rendering result. - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, renderPass.color, 0, 0); } // Write into a storage buffer in compute pass in a command buffer. Then read that data in a render @@ -345,7 +345,7 @@ TEST_P(StorageToUniformSyncTests, ReadAfterWriteWithDifferentCommandBuffers) { queue.Submit(2, cb); // Verify the rendering result. - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, renderPass.color, 0, 0); } // Write into a storage buffer in compute pass in a command buffer. Then read that data in a render @@ -381,7 +381,7 @@ TEST_P(StorageToUniformSyncTests, ReadAfterWriteWithDifferentQueueSubmits) { queue.Submit(1, &cb[1]); // Verify the rendering result. - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, renderPass.color, 0, 0); } DAWN_INSTANTIATE_TEST(StorageToUniformSyncTests, @@ -432,7 +432,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { @group(0) @binding(2) var uniformContents : ColorContents; @group(0) @binding(3) var storageContents : ColorContents; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { vbContents.pos[0] = vec4(-1.0, 1.0, 0.0, 1.0); vbContents.pos[1] = vec4(1.0, 1.0, 0.0, 1.0); vbContents.pos[2] = vec4(1.0, -1.0, 0.0, 1.0); @@ -473,7 +473,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { // Create pipeline, bind group, and reuse buffers in render pass. wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); @@ -486,7 +486,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { @group(0) @binding(0) var uniformBuffer : Buf; @group(0) @binding(1) var storageBuffer : Buf; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(uniformBuffer.color, storageBuffer.color, 0.0, 1.0); })"); @@ -521,10 +521,10 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) { // Verify the rendering result. uint32_t min = 1, max = kRTSize - 3; - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, min); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, max, min); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, max); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, max, max); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kYellow, renderPass.color, min, min); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kYellow, renderPass.color, max, min); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kYellow, renderPass.color, min, max); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kYellow, renderPass.color, max, max); } // Write into a storage buffer in compute pass. Then read that data in buffer in a render pass. The @@ -547,7 +547,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { @group(0) @binding(0) var contents : Contents; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { contents.pos[0] = vec4(-1.0, 1.0, 0.0, 1.0); contents.pos[1] = vec4(1.0, 1.0, 0.0, 1.0); contents.pos[2] = vec4(1.0, -1.0, 0.0, 1.0); @@ -590,7 +590,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { // Create pipeline, bind group, and reuse the buffer in render pass. wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); @@ -602,7 +602,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { @group(0) @binding(0) var uniformBuffer : Buf; @group(0) @binding(1) var storageBuffer : Buf; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(uniformBuffer.color, storageBuffer.color, 0.0, 1.0); })"); @@ -639,10 +639,10 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) { // Verify the rendering result. uint32_t min = 1, max = kRTSize - 3; - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, min); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, max, min); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, max); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, max, max); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kYellow, renderPass.color, min, min); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kYellow, renderPass.color, max, min); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kYellow, renderPass.color, min, max); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kYellow, renderPass.color, max, max); } DAWN_INSTANTIATE_TEST(MultipleWriteThenMultipleReadTests, diff --git a/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp b/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp index 79f862c5d6..e9f5b59aa4 100644 --- a/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp +++ b/src/dawn/tests/end2end/IOSurfaceWrappingTests.cpp @@ -214,7 +214,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase { wgpu::TextureFormat format, void* data, size_t dataSize, - RGBA8 expectedColor) { + utils::RGBA8 expectedColor) { // Write the data to the IOSurface IOSurfaceLock(ioSurface, 0, nullptr); memcpy(IOSurfaceGetBaseAddress(ioSurface), data, dataSize); @@ -229,7 +229,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var pos = array, 6>( vec2(-2.0, -2.0), @@ -257,7 +257,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord); } @@ -355,7 +355,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromR8IOSurface) { uint8_t data = 0x01; DoSampleTest(ioSurface.get(), wgpu::TextureFormat::R8Unorm, &data, sizeof(data), - RGBA8(1, 0, 0, 255)); + utils::RGBA8(1, 0, 0, 255)); } // Test clearing a R8 IOSurface @@ -376,7 +376,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromRG8IOSurface) { uint16_t data = 0x0102; // Stored as (G, R) DoSampleTest(ioSurface.get(), wgpu::TextureFormat::RG8Unorm, &data, sizeof(data), - RGBA8(2, 1, 0, 255)); + utils::RGBA8(2, 1, 0, 255)); } // Test clearing a RG8 IOSurface @@ -396,7 +396,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromBGRA8IOSurface) { uint32_t data = 0x01020304; // Stored as (A, R, G, B) DoSampleTest(ioSurface.get(), wgpu::TextureFormat::BGRA8Unorm, &data, sizeof(data), - RGBA8(2, 3, 4, 1)); + utils::RGBA8(2, 3, 4, 1)); } // Test clearing a BGRA8 IOSurface @@ -415,7 +415,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromRGBA8IOSurface) { uint32_t data = 0x01020304; // Stored as (A, B, G, R) DoSampleTest(ioSurface.get(), wgpu::TextureFormat::RGBA8Unorm, &data, sizeof(data), - RGBA8(4, 3, 2, 1)); + utils::RGBA8(4, 3, 2, 1)); } // Test clearing an RGBA8 IOSurface @@ -448,7 +448,7 @@ TEST_P(IOSurfaceUsageTests, UninitializedTextureIsCleared) { // wrap ioSurface and ensure color is not visible when isInitialized set to false wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface.get(), false); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), ioSurfaceTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 0, 0, 0), ioSurfaceTexture, 0, 0); } DAWN_INSTANTIATE_TEST(IOSurfaceValidationTests, MetalBackend()); diff --git a/src/dawn/tests/end2end/IndexFormatTests.cpp b/src/dawn/tests/end2end/IndexFormatTests.cpp index b563c64921..9343629a6b 100644 --- a/src/dawn/tests/end2end/IndexFormatTests.cpp +++ b/src/dawn/tests/end2end/IndexFormatTests.cpp @@ -39,7 +39,7 @@ class IndexFormatTest : public DawnTest { @builtin(vertex_index) idx : u32, } - @stage(vertex) fn main(input : VertexIn) -> @builtin(position) vec4 { + @vertex fn main(input : VertexIn) -> @builtin(position) vec4 { // 0xFFFFFFFE is a designated invalid index used by some tests. if (input.idx == 0xFFFFFFFEu) { return vec4(0.0, 0.0, 0.0, 1.0); @@ -48,7 +48,7 @@ class IndexFormatTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -92,7 +92,7 @@ TEST_P(IndexFormatTest, Uint32) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 100, 300); } // Test that the Uint16 index format is correctly interpreted @@ -119,7 +119,7 @@ TEST_P(IndexFormatTest, Uint16) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 100, 300); } // Test that the index format used is the format of the last set pipeline. This is to @@ -151,7 +151,7 @@ TEST_P(IndexFormatTest, ChangePipelineAfterSetIndexBuffer) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 100, 300); } // Test that setting the index buffer before the pipeline works, this is important @@ -179,7 +179,7 @@ TEST_P(IndexFormatTest, SetIndexBufferBeforeSetPipeline) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 255, 0, 255), renderPass.color, 100, 300); } // Test that index buffers of multiple formats can be used with a pipeline that @@ -209,7 +209,7 @@ TEST_P(IndexFormatTest, SetIndexBufferDifferentFormats) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 255, 0, 255), renderPass.color, 100, 300); encoder = device.CreateCommandEncoder(); { @@ -224,7 +224,7 @@ TEST_P(IndexFormatTest, SetIndexBufferDifferentFormats) { commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 255, 0, 255), renderPass.color, 100, 300); } // Tests for primitive restart use vertices like in the drawing and draw the following @@ -286,9 +286,9 @@ TEST_P(TriangleStripPrimitiveRestartTests, Uint32PrimitiveRestart) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 50, 350); // A - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 350, 50); // B - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 198, 200); // C + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 50, 350); // A + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 350, 50); // B + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 198, 200); // C } // Same as the above test, but uses an OOB index to emulate primitive restart being disabled, @@ -321,9 +321,9 @@ TEST_P(TriangleStripPrimitiveRestartTests, Uint32WithoutPrimitiveRestart) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 50, 350); // A - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 350, 50); // B - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 198, 200); // C + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 50, 350); // A + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 350, 50); // B + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 198, 200); // C } // Test use of primitive restart with an Uint16 index format @@ -357,9 +357,9 @@ TEST_P(TriangleStripPrimitiveRestartTests, Uint16PrimitiveRestart) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 50, 350); // A - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 350, 50); // B - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 198, 200); // C + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 50, 350); // A + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 350, 50); // B + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 198, 200); // C } // Tests for primitive restart use vertices like in the drawing and draw the following @@ -411,9 +411,9 @@ TEST_P(LineStripPrimitiveRestartTests, Uint32PrimitiveRestart) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 399, 199); // 1 - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 199, 199); // 2 - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 300, 199); // A + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 399, 199); // 1 + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 199, 199); // 2 + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 300, 199); // A } // Same as the above test, but uses an OOB index to emulate primitive restart being disabled, @@ -440,9 +440,9 @@ TEST_P(LineStripPrimitiveRestartTests, Uint32WithoutPrimitiveRestart) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 399, 199); // 1 - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 199, 199); // 2 - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 300, 199); // A + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 399, 199); // 1 + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 199, 199); // 2 + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 300, 199); // A } TEST_P(LineStripPrimitiveRestartTests, Uint16PrimitiveRestart) { @@ -467,9 +467,9 @@ TEST_P(LineStripPrimitiveRestartTests, Uint16PrimitiveRestart) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 399, 199); // 1 - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 199, 199); // 2 - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 300, 199); // A + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 399, 199); // 1 + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 199, 199); // 2 + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 300, 199); // A } DAWN_INSTANTIATE_TEST(IndexFormatTest, diff --git a/src/dawn/tests/end2end/MaxLimitTests.cpp b/src/dawn/tests/end2end/MaxLimitTests.cpp index 42affd85a5..052713fb96 100644 --- a/src/dawn/tests/end2end/MaxLimitTests.cpp +++ b/src/dawn/tests/end2end/MaxLimitTests.cpp @@ -41,7 +41,7 @@ TEST_P(MaxLimitTests, MaxComputeWorkgroupStorageSize) { value1 : u32, } - @group(0) @binding(0) var dst : Dst; + @group(0) @binding(0) var dst : Dst; struct WGData { value0 : u32, @@ -52,7 +52,7 @@ TEST_P(MaxLimitTests, MaxComputeWorkgroupStorageSize) { } var wg_data : WGData; - @stage(compute) @workgroup_size(2,1,1) + @compute @workgroup_size(2,1,1) fn main(@builtin(local_invocation_index) LocalInvocationIndex : u32) { if (LocalInvocationIndex == 0u) { // Put data into the first and last byte of workgroup memory. @@ -122,7 +122,7 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) { maxBufferBindingSize = std::min(maxBufferBindingSize, uint64_t(2) * 1024 * 1024 * 1024); // With WARP or on 32-bit platforms, such large buffer allocations often fail. -#ifdef DAWN_PLATFORM_32_BIT +#if DAWN_PLATFORM_IS(32_BIT) if (IsWindows()) { continue; } @@ -142,9 +142,9 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) { } @group(0) @binding(0) var buf : Buf; - @group(0) @binding(1) var result : Result; + @group(0) @binding(1) var result : Result; - @stage(compute) @workgroup_size(1,1,1) + @compute @workgroup_size(1,1,1) fn main() { result.value0 = buf.values[0]; result.value1 = buf.values[arrayLength(&buf.values) - 1u]; @@ -173,9 +173,9 @@ TEST_P(MaxLimitTests, MaxBufferBindingSize) { } @group(0) @binding(0) var buf : Buf; - @group(0) @binding(1) var result : Result; + @group(0) @binding(1) var result : Result; - @stage(compute) @workgroup_size(1,1,1) + @compute @workgroup_size(1,1,1) fn main() { result.value0 = buf.value0; result.value1 = buf.value1; diff --git a/src/dawn/tests/end2end/MultisampledRenderingTests.cpp b/src/dawn/tests/end2end/MultisampledRenderingTests.cpp index 69dbd18992..07114a9168 100644 --- a/src/dawn/tests/end2end/MultisampledRenderingTests.cpp +++ b/src/dawn/tests/end2end/MultisampledRenderingTests.cpp @@ -57,7 +57,7 @@ class MultisampledRenderingTest : public DawnTest { @builtin(frag_depth) depth : f32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color = uBuffer.color; output.depth = uBuffer.depth; @@ -70,7 +70,7 @@ class MultisampledRenderingTest : public DawnTest { } @group(0) @binding(0) var uBuffer : U; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return uBuffer.color; })"; @@ -95,7 +95,7 @@ class MultisampledRenderingTest : public DawnTest { @location(1) color1 : vec4, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color0 = uBuffer.color0; output.color1 = uBuffer.color1; @@ -189,7 +189,7 @@ class MultisampledRenderingTest : public DawnTest { constexpr uint32_t kMiddleX = (kWidth - 1) / 2; constexpr uint32_t kMiddleY = (kHeight - 1) / 2; - RGBA8 expectedColor = ExpectedMSAAColor(inputColor, msaaCoverage); + utils::RGBA8 expectedColor = ExpectedMSAAColor(inputColor, msaaCoverage); EXPECT_TEXTURE_EQ(&expectedColor, resolveTexture, {kMiddleX, kMiddleY, arrayLayer}, {1, 1}, mipmapLevel); } @@ -224,7 +224,7 @@ class MultisampledRenderingTest : public DawnTest { // Draw a bottom-right triangle. In standard 4xMSAA pattern, for the pixels on diagonal, // only two of the samples will be touched. const char* vs = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -236,7 +236,7 @@ class MultisampledRenderingTest : public DawnTest { // Draw a bottom-left triangle. const char* vsFlipped = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -274,8 +274,8 @@ class MultisampledRenderingTest : public DawnTest { return pipeline; } - RGBA8 ExpectedMSAAColor(const wgpu::Color color, const double msaaCoverage) { - RGBA8 result; + utils::RGBA8 ExpectedMSAAColor(const wgpu::Color color, const double msaaCoverage) { + utils::RGBA8 result; result.r = static_cast(std::min(255.0, 256 * color.r * msaaCoverage)); result.g = static_cast(std::min(255.0, 256 * color.g * msaaCoverage)); result.b = static_cast(std::min(255.0, 256 * color.b * msaaCoverage)); @@ -629,6 +629,9 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithEmptyFinalSampleMask) // Test doing MSAA resolve into multiple resolve targets works correctly with a non-default sample // mask. TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithSampleMask) { + // TODO(crbug.com/dawn/1462): Re-enable on Mac Intel 12.4. + DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(12, 4)); + wgpu::TextureView multisampledColorView2 = CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView(); wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1); @@ -753,7 +756,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut @builtin(sample_mask) sampleMask : u32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color = uBuffer.color; output.sampleMask = 6u; @@ -775,7 +778,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); queue.Submit(1, &commandBuffer); - RGBA8 expectedColor = ExpectedMSAAColor(kGreen, kMSAACoverage); + utils::RGBA8 expectedColor = ExpectedMSAAColor(kGreen, kMSAACoverage); EXPECT_TEXTURE_EQ(&expectedColor, mResolveTexture, {1, 0}, {1, 1}); } @@ -786,6 +789,9 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOut // supported on some platforms. DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_sample_variables")); + // TODO(crbug.com/dawn/1462): Re-enable on Mac Intel 12.4. + DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(12, 4)); + wgpu::TextureView multisampledColorView2 = CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView(); wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1); @@ -808,7 +814,7 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOut @builtin(sample_mask) sampleMask : u32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color0 = uBuffer.color0; output.color1 = uBuffer.color1; @@ -881,7 +887,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithAlphaToCoverage) { msaaCoverage = 1.0f; } - RGBA8 expectedColor = ExpectedMSAAColor(kGreen, msaaCoverage); + utils::RGBA8 expectedColor = ExpectedMSAAColor(kGreen, msaaCoverage); EXPECT_TEXTURE_EQ(&expectedColor, mResolveTexture, {1, 0}, {1, 1}); } } @@ -933,8 +939,8 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithAlphaToCo // Alpha to coverage affects both the color outputs, but the mask is computed // using only the first one. - RGBA8 expectedRed = ExpectedMSAAColor(kRed, kMSAACoverage); - RGBA8 expectedGreen = ExpectedMSAAColor(kGreen, kMSAACoverage); + utils::RGBA8 expectedRed = ExpectedMSAAColor(kRed, kMSAACoverage); + utils::RGBA8 expectedGreen = ExpectedMSAAColor(kGreen, kMSAACoverage); EXPECT_TEXTURE_EQ(&expectedRed, mResolveTexture, {1, 0}, {1, 1}); EXPECT_TEXTURE_EQ(&expectedGreen, resolveTexture2, {1, 0}, {1, 1}); } @@ -995,7 +1001,7 @@ TEST_P(MultisampledRenderingTest, MultisampledRenderingWithDepthTestAndAlphaToCo constexpr wgpu::Color kHalfGreenHalfRed = {(kGreen.r + kRed.r) / 2.0, (kGreen.g + kRed.g) / 2.0, (kGreen.b + kRed.b) / 2.0, (kGreen.a + kRed.a) / 2.0}; - RGBA8 expectedColor = ExpectedMSAAColor(kHalfGreenHalfRed, 1.0f); + utils::RGBA8 expectedColor = ExpectedMSAAColor(kHalfGreenHalfRed, 1.0f); EXPECT_TEXTURE_EQ(&expectedColor, mResolveTexture, {1, 0}, {1, 1}); } @@ -1040,7 +1046,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithAlphaToCoverageAndSamp wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); queue.Submit(1, &commandBuffer); - RGBA8 expectedColor = ExpectedMSAAColor(kGreen, kMSAACoverage * alpha); + utils::RGBA8 expectedColor = ExpectedMSAAColor(kGreen, kMSAACoverage * alpha); EXPECT_TEXTURE_EQ(&expectedColor, mResolveTexture, {1, 0}, {1, 1}); } } diff --git a/src/dawn/tests/end2end/MultisampledSamplingTests.cpp b/src/dawn/tests/end2end/MultisampledSamplingTests.cpp index 9a8ca2addc..6952500c47 100644 --- a/src/dawn/tests/end2end/MultisampledSamplingTests.cpp +++ b/src/dawn/tests/end2end/MultisampledSamplingTests.cpp @@ -55,7 +55,7 @@ class MultisampledSamplingTest : public DawnTest { utils::ComboRenderPipelineDescriptor desc; desc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec2) -> @builtin(position) vec4 { return vec4(pos, 0.0, 1.0); })"); @@ -66,7 +66,7 @@ class MultisampledSamplingTest : public DawnTest { @builtin(frag_depth) depth : f32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var output : FragmentOut; output.color = 1.0; output.depth = 0.7; @@ -103,7 +103,7 @@ class MultisampledSamplingTest : public DawnTest { } @group(0) @binding(2) var results : Results; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { for (var i : i32 = 0; i < 4; i = i + 1) { results.colorSamples[i] = textureLoad(texture0, vec2(0, 0), i).x; results.depthSamples[i] = textureLoad(texture1, vec2(0, 0), i); diff --git a/src/dawn/tests/end2end/NonzeroTextureCreationTests.cpp b/src/dawn/tests/end2end/NonzeroTextureCreationTests.cpp index 25ab7189fe..2c29f22416 100644 --- a/src/dawn/tests/end2end/NonzeroTextureCreationTests.cpp +++ b/src/dawn/tests/end2end/NonzeroTextureCreationTests.cpp @@ -68,9 +68,6 @@ class ExpectNonZero : public detail::CustomTextureExpectation { } }; -#define EXPECT_TEXTURE_NONZERO(T, ...) \ - AddTextureExpectation(__FILE__, __LINE__, new ExpectNonZero(), __VA_ARGS__) - class NonzeroTextureCreationTests : public DawnTestWithParams { protected: constexpr static uint32_t kSize = 128; @@ -417,8 +414,7 @@ DAWN_INSTANTIATE_TEST_P( {"lazy_clear_resource_on_first_use"})}, {wgpu::TextureFormat::R8Unorm, wgpu::TextureFormat::RG8Unorm, wgpu::TextureFormat::RGBA8Unorm}, {wgpu::TextureAspect::All}, - {wgpu::TextureUsage(wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::TextureBinding), - wgpu::TextureUsage::TextureBinding}, + {wgpu::TextureUsage(wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::TextureBinding)}, {wgpu::TextureDimension::e2D}, {1u}, // depth or array layers {1u}, // mip count diff --git a/src/dawn/tests/end2end/ObjectCachingTests.cpp b/src/dawn/tests/end2end/ObjectCachingTests.cpp index 85139c93f0..cda1fca1ea 100644 --- a/src/dawn/tests/end2end/ObjectCachingTests.cpp +++ b/src/dawn/tests/end2end/ObjectCachingTests.cpp @@ -104,15 +104,15 @@ TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) { // Test that ShaderModules are correctly deduplicated. TEST_P(ObjectCachingTest, ShaderModuleDeduplication) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); @@ -124,16 +124,16 @@ TEST_P(ObjectCachingTest, ShaderModuleDeduplication) { TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnShaderModule) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( var i : u32; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { i = 0u; })"); wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"( var i : u32; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { i = 0u; })"); wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); EXPECT_NE(module.Get(), otherModule.Get()); @@ -176,7 +176,7 @@ TEST_P(ObjectCachingTest, ComputePipelineDeduplicationOnLayout) { desc.compute.entryPoint = "main"; desc.compute.module = utils::CreateShaderModule(device, R"( var i : u32; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { i = 0u; })"); @@ -210,11 +210,11 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) { utils::ComboRenderPipelineDescriptor desc; desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; desc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); desc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); desc.layout = pl; @@ -233,15 +233,15 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) { // Test that RenderPipelines are correctly deduplicated wrt. their vertex module TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); })"); @@ -251,7 +251,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) { utils::ComboRenderPipelineDescriptor desc; desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; desc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); desc.vertex.module = module; @@ -270,13 +270,13 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) { // Test that RenderPipelines are correctly deduplicated wrt. their fragment module TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); wgpu::ShaderModule sameModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); wgpu::ShaderModule otherModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); @@ -285,7 +285,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) { utils::ComboRenderPipelineDescriptor desc; desc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); diff --git a/src/dawn/tests/end2end/OpArrayLengthTests.cpp b/src/dawn/tests/end2end/OpArrayLengthTests.cpp index a00ca3211b..514e2b579a 100644 --- a/src/dawn/tests/end2end/OpArrayLengthTests.cpp +++ b/src/dawn/tests/end2end/OpArrayLengthTests.cpp @@ -21,7 +21,7 @@ class OpArrayLengthTest : public DawnTest { protected: - void SetUp() { + void SetUp() override { DawnTest::SetUp(); // Create buffers of various size to check the length() implementation @@ -100,7 +100,7 @@ TEST_P(OpArrayLengthTest, Compute) { // TODO(crbug.com/dawn/1292): Some Intel drivers don't seem to like the // (spurious but harmless) offset=64 that Tint/GLSL produces. - DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL()); + DAWN_SUPPRESS_TEST_IF(IsIntel() && (IsOpenGL() || IsOpenGLES())); // Create a buffer to hold the result sizes and create a bindgroup for it. wgpu::BufferDescriptor bufferDesc; @@ -130,7 +130,7 @@ TEST_P(OpArrayLengthTest, Compute) { } @group(1) @binding(0) var result : ResultBuffer; )" + mShaderInterface + R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { result.data[0] = arrayLength(&buffer1.data); result.data[1] = arrayLength(&buffer2.data); result.data[2] = arrayLength(&buffer3.data); @@ -161,19 +161,19 @@ TEST_P(OpArrayLengthTest, Fragment) { // TODO(crbug.com/dawn/1292): Some Intel drivers don't seem to like the // (spurious but harmless) offset=64 that Tint/GLSL produces. - DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL()); + DAWN_SUPPRESS_TEST_IF(IsIntel() && (IsOpenGL() || IsOpenGLES())); utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1); // Create the pipeline that computes the length of the buffers and writes it to the only render // pass pixel. wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, (mShaderInterface + R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { var fragColor : vec4; fragColor.r = f32(arrayLength(&buffer1.data)) / 255.0; fragColor.g = f32(arrayLength(&buffer2.data)) / 255.0; @@ -204,7 +204,8 @@ TEST_P(OpArrayLengthTest, Fragment) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 expectedColor = RGBA8(mExpectedLengths[0], mExpectedLengths[1], mExpectedLengths[2], 0); + utils::RGBA8 expectedColor = + utils::RGBA8(mExpectedLengths[0], mExpectedLengths[1], mExpectedLengths[2], 0); EXPECT_PIXEL_RGBA8_EQ(expectedColor, renderPass.color, 0, 0); } @@ -229,7 +230,7 @@ TEST_P(OpArrayLengthTest, Vertex) { @builtin(position) position : vec4, } - @stage(vertex) fn main() -> VertexOut { + @vertex fn main() -> VertexOut { var output : VertexOut; output.color.r = f32(arrayLength(&buffer1.data)) / 255.0; output.color.g = f32(arrayLength(&buffer2.data)) / 255.0; @@ -242,7 +243,7 @@ TEST_P(OpArrayLengthTest, Vertex) { .c_str()); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })"); @@ -268,7 +269,8 @@ TEST_P(OpArrayLengthTest, Vertex) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 expectedColor = RGBA8(mExpectedLengths[0], mExpectedLengths[1], mExpectedLengths[2], 0); + utils::RGBA8 expectedColor = + utils::RGBA8(mExpectedLengths[0], mExpectedLengths[1], mExpectedLengths[2], 0); EXPECT_PIXEL_RGBA8_EQ(expectedColor, renderPass.color, 0, 0); } diff --git a/src/dawn/tests/end2end/PipelineCachingTests.cpp b/src/dawn/tests/end2end/PipelineCachingTests.cpp index bdf6a1e9ed..b11a23bf39 100644 --- a/src/dawn/tests/end2end/PipelineCachingTests.cpp +++ b/src/dawn/tests/end2end/PipelineCachingTests.cpp @@ -16,7 +16,7 @@ #include #include "dawn/tests/DawnTest.h" -#include "dawn/tests/end2end/mocks/CachingInterfaceMock.h" +#include "dawn/tests/mocks/platform/CachingInterfaceMock.h" #include "dawn/utils/ComboRenderPipelineDescriptor.h" #include "dawn/utils/WGPUHelpers.h" @@ -26,18 +26,73 @@ using ::testing::NiceMock; // TODO(dawn:549) Add some sort of pipeline descriptor repository to test more caching. -static constexpr std::string_view kComputeShader = R"( - @stage(compute) @workgroup_size(1) fn main() {} +static constexpr std::string_view kComputeShaderDefault = R"( + @compute @workgroup_size(1) fn main() {} )"; -static constexpr std::string_view kVertexShader = R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { +static constexpr std::string_view kComputeShaderMultipleEntryPoints = R"( + @compute @workgroup_size(16) fn main() {} + @compute @workgroup_size(64) fn main2() {} + )"; + +static constexpr std::string_view kVertexShaderDefault = R"( + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } )"; -static constexpr std::string_view kFragmentShader = R"( - @stage(fragment) fn main() {} +static constexpr std::string_view kVertexShaderMultipleEntryPoints = R"( + @vertex fn main() -> @builtin(position) vec4 { + return vec4(1.0, 0.0, 0.0, 1.0); + } + + @vertex fn main2() -> @builtin(position) vec4 { + return vec4(0.5, 0.5, 0.5, 1.0); + } + )"; + +static constexpr std::string_view kFragmentShaderDefault = R"( + @fragment fn main() -> @location(0) vec4 { + return vec4(0.1, 0.2, 0.3, 0.4); + } + )"; + +static constexpr std::string_view kFragmentShaderMultipleOutput = R"( + struct FragmentOut { + @location(0) fragColor0 : vec4, + @location(1) fragColor1 : vec4, + } + + @fragment fn main() -> FragmentOut { + var output : FragmentOut; + output.fragColor0 = vec4(0.1, 0.2, 0.3, 0.4); + output.fragColor1 = vec4(0.5, 0.6, 0.7, 0.8); + return output; + } + )"; + +static constexpr std::string_view kFragmentShaderBindGroup00Uniform = R"( + struct S { + value : f32 + }; + + @group(0) @binding(0) var uBuffer : S; + + @fragment fn main() -> @location(0) vec4 { + return vec4(uBuffer.value, 0.2, 0.3, 0.4); + } + )"; + +static constexpr std::string_view kFragmentShaderBindGroup01Uniform = R"( + struct S { + value : f32 + }; + + @group(0) @binding(1) var uBuffer : S; + + @fragment fn main() -> @location(0) vec4 { + return vec4(uBuffer.value, 0.2, 0.3, 0.4); + } )"; class PipelineCachingTests : public DawnTest { @@ -46,6 +101,16 @@ class PipelineCachingTests : public DawnTest { return std::make_unique(&mMockCache); } + struct EntryCounts { + unsigned pipeline; + unsigned shaderModule; + }; + const EntryCounts counts = { + // pipeline caching is only implemented on D3D12/Vulkan + IsD3D12() || IsVulkan() ? 1u : 0u, + // One blob per shader module + 1u, + }; NiceMock mMockCache; }; @@ -62,39 +127,38 @@ TEST_P(SinglePipelineCachingTests, ComputePipelineNoCache) { { wgpu::Device device = CreateDevice(); wgpu::ComputePipelineDescriptor desc; - desc.compute.module = utils::CreateShaderModule(device, kComputeShader.data()); + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); desc.compute.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateComputePipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(0), device.CreateComputePipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 0u); // Second time should create fine with no cache hits since cache is disabled. { wgpu::Device device = CreateDevice(); wgpu::ComputePipelineDescriptor desc; - desc.compute.module = utils::CreateShaderModule(device, kComputeShader.data()); + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); desc.compute.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateComputePipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(0), device.CreateComputePipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 0u); } // Tests that pipeline creation on the same device uses frontend cache when possible. TEST_P(SinglePipelineCachingTests, ComputePipelineFrontedCache) { wgpu::ComputePipelineDescriptor desc; - desc.compute.module = utils::CreateShaderModule(device, kComputeShader.data()); + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); desc.compute.entryPoint = "main"; // First creation should create a cache entry. wgpu::ComputePipeline pipeline; - EXPECT_CACHE_HIT(mMockCache, 0u, pipeline = device.CreateComputePipeline(&desc)); - EXPECT_EQ(mMockCache.GetNumEntries(), 1u); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(counts.shaderModule + counts.pipeline), + pipeline = device.CreateComputePipeline(&desc)); // Second creation on the same device should just return from frontend cache and should not // call out to the blob cache. EXPECT_CALL(mMockCache, LoadData).Times(0); wgpu::ComputePipeline samePipeline; - EXPECT_CACHE_HIT(mMockCache, 0u, samePipeline = device.CreateComputePipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(0), + samePipeline = device.CreateComputePipeline(&desc)); EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire()); } @@ -106,21 +170,81 @@ TEST_P(SinglePipelineCachingTests, ComputePipelineBlobCache) { { wgpu::Device device = CreateDevice(); wgpu::ComputePipelineDescriptor desc; - desc.compute.module = utils::CreateShaderModule(device, kComputeShader.data()); + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); desc.compute.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateComputePipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(counts.shaderModule + counts.pipeline), + device.CreateComputePipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 1u); // Second time should create using the cache. { wgpu::Device device = CreateDevice(); wgpu::ComputePipelineDescriptor desc; - desc.compute.module = utils::CreateShaderModule(device, kComputeShader.data()); + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); desc.compute.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 1u, device.CreateComputePipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(counts.shaderModule + counts.pipeline), Add(0), + device.CreateComputePipeline(&desc)); + } +} + +// Tests that pipeline creation hits the cache when using the same pipeline but with explicit +// layout. +TEST_P(SinglePipelineCachingTests, ComputePipelineBlobCacheExplictLayout) { + // First time should create and write out to the cache. + { + wgpu::Device device = CreateDevice(); + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); + desc.compute.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(counts.shaderModule + counts.pipeline), + device.CreateComputePipeline(&desc)); + } + + // Cache should hit: use the same pipeline but with explicit pipeline layout. + { + wgpu::Device device = CreateDevice(); + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); + desc.compute.entryPoint = "main"; + desc.layout = utils::MakeBasicPipelineLayout(device, {}); + EXPECT_CACHE_STATS(mMockCache, Hit(counts.shaderModule + counts.pipeline), Add(0), + device.CreateComputePipeline(&desc)); + } +} + +// Tests that pipeline creation wouldn't hit the cache if the pipelines are not exactly the same. +TEST_P(SinglePipelineCachingTests, ComputePipelineBlobCacheShaderNegativeCases) { + // First time should create and write out to the cache. + { + wgpu::Device device = CreateDevice(); + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); + desc.compute.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(counts.shaderModule + counts.pipeline), + device.CreateComputePipeline(&desc)); + } + + // Cache should not hit: different shader module. + { + wgpu::Device device = CreateDevice(); + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = + utils::CreateShaderModule(device, kComputeShaderMultipleEntryPoints.data()); + desc.compute.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(counts.shaderModule + counts.pipeline), + device.CreateComputePipeline(&desc)); + } + + // Cache should not hit: same shader module but different shader entry point. + { + wgpu::Device device = CreateDevice(); + wgpu::ComputePipelineDescriptor desc; + desc.compute.module = + utils::CreateShaderModule(device, kComputeShaderMultipleEntryPoints.data()); + desc.compute.entryPoint = "main2"; + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(counts.shaderModule + counts.pipeline), + device.CreateComputePipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 1u); } // Tests that pipeline creation does not hits the cache when it is enabled but we use different @@ -130,21 +254,21 @@ TEST_P(SinglePipelineCachingTests, ComputePipelineBlobCacheIsolationKey) { { wgpu::Device device = CreateDevice("isolation key 1"); wgpu::ComputePipelineDescriptor desc; - desc.compute.module = utils::CreateShaderModule(device, kComputeShader.data()); + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); desc.compute.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateComputePipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(counts.shaderModule + counts.pipeline), + device.CreateComputePipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 1u); // Second time should also create and write out to the cache. { wgpu::Device device = CreateDevice("isolation key 2"); wgpu::ComputePipelineDescriptor desc; - desc.compute.module = utils::CreateShaderModule(device, kComputeShader.data()); + desc.compute.module = utils::CreateShaderModule(device, kComputeShaderDefault.data()); desc.compute.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateComputePipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(counts.shaderModule + counts.pipeline), + device.CreateComputePipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 2u); } // Tests that pipeline creation works fine even if the cache is disabled. @@ -158,48 +282,44 @@ TEST_P(SinglePipelineCachingTests, RenderPipelineNoCache) { { wgpu::Device device = CreateDevice(); utils::ComboRenderPipelineDescriptor desc; - desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; - desc.vertex.module = utils::CreateShaderModule(device, kVertexShader.data()); + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); desc.vertex.entryPoint = "main"; - desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShader.data()); + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); desc.cFragment.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateRenderPipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(0), device.CreateRenderPipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 0u); // Second time should create fine with no cache hits since cache is disabled. { wgpu::Device device = CreateDevice(); utils::ComboRenderPipelineDescriptor desc; - desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; - desc.vertex.module = utils::CreateShaderModule(device, kVertexShader.data()); + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); desc.vertex.entryPoint = "main"; - desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShader.data()); + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); desc.cFragment.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateRenderPipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(0), device.CreateRenderPipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 0u); } // Tests that pipeline creation on the same device uses frontend cache when possible. TEST_P(SinglePipelineCachingTests, RenderPipelineFrontedCache) { utils::ComboRenderPipelineDescriptor desc; - desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; - desc.vertex.module = utils::CreateShaderModule(device, kVertexShader.data()); + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); desc.vertex.entryPoint = "main"; - desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShader.data()); + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); desc.cFragment.entryPoint = "main"; // First creation should create a cache entry. wgpu::RenderPipeline pipeline; - EXPECT_CACHE_HIT(mMockCache, 0u, pipeline = device.CreateRenderPipeline(&desc)); - EXPECT_EQ(mMockCache.GetNumEntries(), 1u); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(2 * counts.shaderModule + counts.pipeline), + pipeline = device.CreateRenderPipeline(&desc)); // Second creation on the same device should just return from frontend cache and should not // call out to the blob cache. EXPECT_CALL(mMockCache, LoadData).Times(0); wgpu::RenderPipeline samePipeline; - EXPECT_CACHE_HIT(mMockCache, 0u, samePipeline = device.CreateRenderPipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(0), + samePipeline = device.CreateRenderPipeline(&desc)); EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire()); } @@ -211,27 +331,283 @@ TEST_P(SinglePipelineCachingTests, RenderPipelineBlobCache) { { wgpu::Device device = CreateDevice(); utils::ComboRenderPipelineDescriptor desc; - desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; - desc.vertex.module = utils::CreateShaderModule(device, kVertexShader.data()); + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); desc.vertex.entryPoint = "main"; - desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShader.data()); + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); desc.cFragment.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateRenderPipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(2 * counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 1u); // Second time should create using the cache. { wgpu::Device device = CreateDevice(); utils::ComboRenderPipelineDescriptor desc; - desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; - desc.vertex.module = utils::CreateShaderModule(device, kVertexShader.data()); + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); desc.vertex.entryPoint = "main"; - desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShader.data()); + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); desc.cFragment.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 1u, device.CreateRenderPipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(2 * counts.shaderModule + counts.pipeline), Add(0), + device.CreateRenderPipeline(&desc)); + } +} + +// Tests that pipeline creation hits the cache when using the same pipeline but with explicit +// layout. +TEST_P(SinglePipelineCachingTests, RenderPipelineBlobCacheExplictLayout) { + // First time should create and write out to the cache. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); + desc.cFragment.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(2 * counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); + } + + // Cache should hit: use the same pipeline but with explicit pipeline layout. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); + desc.cFragment.entryPoint = "main"; + desc.layout = utils::MakeBasicPipelineLayout(device, {}); + EXPECT_CACHE_STATS(mMockCache, Hit(2 * counts.shaderModule + counts.pipeline), Add(0), + device.CreateRenderPipeline(&desc)); + } +} + +// Tests that pipeline creation wouldn't hit the cache if the pipelines have different state set in +// the descriptor. +TEST_P(SinglePipelineCachingTests, RenderPipelineBlobCacheDescriptorNegativeCases) { + // First time should create and write out to the cache. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); + desc.cFragment.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(2 * counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); + } + + // Cache should hit for shaders, but not pipeline: different pipeline descriptor state. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.EnableDepthStencil(); + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); + desc.cFragment.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(2 * counts.shaderModule), Add(counts.pipeline), + device.CreateRenderPipeline(&desc)); + } +} + +// Tests that pipeline creation wouldn't hit the cache if the pipelines are not exactly the same in +// terms of shader. +TEST_P(SinglePipelineCachingTests, RenderPipelineBlobCacheShaderNegativeCases) { + // First time should create and write out to the cache. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); + desc.cFragment.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(2 * counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); + } + + // Cache should not hit for different vertex shader module, + // Cache should still hit for the same fragment shader module. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = + utils::CreateShaderModule(device, kVertexShaderMultipleEntryPoints.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); + desc.cFragment.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(counts.shaderModule), + Add(counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); + } + + // Cache should not hit: same shader module but different shader entry point. + // Cache should still hit for the same shader module. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = + utils::CreateShaderModule(device, kVertexShaderMultipleEntryPoints.data()); + desc.vertex.entryPoint = "main2"; + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); + desc.cFragment.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(counts.shaderModule), + Add(counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); + } +} + +// Tests that pipeline creation wouldn't hit the cache if the pipelines are not exactly the same +// (fragment color targets differences). +TEST_P(SinglePipelineCachingTests, RenderPipelineBlobCacheNegativeCasesFragmentColorTargets) { + // First time should create and write out to the cache. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.cFragment.targetCount = 2; + desc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm; + desc.cTargets[1].writeMask = wgpu::ColorWriteMask::None; + desc.cTargets[1].format = wgpu::TextureFormat::RGBA8Unorm; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = + utils::CreateShaderModule(device, kFragmentShaderMultipleOutput.data()); + desc.cFragment.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(2 * counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); + } + + // Cache should not hit for the pipeline: different fragment color target state (sparse). + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.cFragment.targetCount = 2; + desc.cTargets[0].format = wgpu::TextureFormat::Undefined; + desc.cTargets[1].writeMask = wgpu::ColorWriteMask::None; + desc.cTargets[1].format = wgpu::TextureFormat::RGBA8Unorm; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = + utils::CreateShaderModule(device, kFragmentShaderMultipleOutput.data()); + desc.cFragment.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(2 * counts.shaderModule), Add(counts.pipeline), + device.CreateRenderPipeline(&desc)); + } + + // Cache should not hit: different fragment color target state (trailing empty). + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.cFragment.targetCount = 2; + desc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm; + desc.cTargets[1].writeMask = wgpu::ColorWriteMask::None; + desc.cTargets[1].format = wgpu::TextureFormat::Undefined; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = + utils::CreateShaderModule(device, kFragmentShaderMultipleOutput.data()); + desc.cFragment.entryPoint = "main"; + EXPECT_CACHE_STATS(mMockCache, Hit(2 * counts.shaderModule), Add(counts.pipeline), + device.CreateRenderPipeline(&desc)); + } +} + +// Tests that pipeline creation hits the cache for shaders, but not the pipeline if the +// shaders aren't impacted by the layout. This test is a bit change detecting - but all +// cached backends currently remap shader bindings based on the layout. It can be split +// per-backend as needed. +TEST_P(SinglePipelineCachingTests, RenderPipelineBlobCacheLayout) { + // First time should create and write out to the cache. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = + utils::CreateShaderModule(device, kFragmentShaderBindGroup00Uniform.data()); + desc.cFragment.entryPoint = "main"; + desc.layout = utils::MakePipelineLayout( + device, { + utils::MakeBindGroupLayout( + device, + { + {0, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Uniform}, + }), + }); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(2 * counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); + } + + // Cache should hit for the shaders, but not for the pipeline: different layout. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = + utils::CreateShaderModule(device, kFragmentShaderBindGroup00Uniform.data()); + desc.cFragment.entryPoint = "main"; + desc.layout = utils::MakePipelineLayout( + device, { + utils::MakeBindGroupLayout( + device, + { + {0, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Uniform}, + {1, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Uniform}, + }), + }); + EXPECT_CACHE_STATS(mMockCache, Hit(2 * counts.shaderModule), Add(counts.pipeline), + device.CreateRenderPipeline(&desc)); + } + + // Cache should hit for the shaders, but not for the pipeline: different layout (dynamic). + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = + utils::CreateShaderModule(device, kFragmentShaderBindGroup00Uniform.data()); + desc.cFragment.entryPoint = "main"; + desc.layout = utils::MakePipelineLayout( + device, { + utils::MakeBindGroupLayout(device, + { + {0, wgpu::ShaderStage::Fragment, + wgpu::BufferBindingType::Uniform, true}, + }), + }); + EXPECT_CACHE_STATS(mMockCache, Hit(2 * counts.shaderModule), Add(counts.pipeline), + device.CreateRenderPipeline(&desc)); + } + + // Cache should not hit for the fragment shader, but should hit for the pipeline. + // On Metal and Vulkan, the shader is different but compiles to the same due to binding number + // remapping. On other backends, the compiled shader is different and so is the pipeline. + { + wgpu::Device device = CreateDevice(); + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); + desc.vertex.entryPoint = "main"; + desc.cFragment.module = + utils::CreateShaderModule(device, kFragmentShaderBindGroup01Uniform.data()); + desc.cFragment.entryPoint = "main"; + desc.layout = utils::MakePipelineLayout( + device, { + utils::MakeBindGroupLayout( + device, + { + {1, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Uniform}, + }), + }); + if (IsMetal() || IsVulkan()) { + EXPECT_CACHE_STATS(mMockCache, Hit(counts.shaderModule + counts.pipeline), + Add(counts.shaderModule), device.CreateRenderPipeline(&desc)); + } else { + EXPECT_CACHE_STATS(mMockCache, Hit(counts.shaderModule), + Add(counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); + } } - EXPECT_EQ(mMockCache.GetNumEntries(), 1u); } // Tests that pipeline creation does not hits the cache when it is enabled but we use different @@ -241,29 +617,33 @@ TEST_P(SinglePipelineCachingTests, RenderPipelineBlobCacheIsolationKey) { { wgpu::Device device = CreateDevice("isolation key 1"); utils::ComboRenderPipelineDescriptor desc; - desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; - desc.vertex.module = utils::CreateShaderModule(device, kVertexShader.data()); + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); desc.vertex.entryPoint = "main"; - desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShader.data()); + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); desc.cFragment.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateRenderPipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(2 * counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 1u); // Second time should also create and write out to the cache. { wgpu::Device device = CreateDevice("isolation key 2"); utils::ComboRenderPipelineDescriptor desc; - desc.cTargets[0].writeMask = wgpu::ColorWriteMask::None; - desc.vertex.module = utils::CreateShaderModule(device, kVertexShader.data()); + desc.vertex.module = utils::CreateShaderModule(device, kVertexShaderDefault.data()); desc.vertex.entryPoint = "main"; - desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShader.data()); + desc.cFragment.module = utils::CreateShaderModule(device, kFragmentShaderDefault.data()); desc.cFragment.entryPoint = "main"; - EXPECT_CACHE_HIT(mMockCache, 0u, device.CreateRenderPipeline(&desc)); + EXPECT_CACHE_STATS(mMockCache, Hit(0), Add(2 * counts.shaderModule + counts.pipeline), + device.CreateRenderPipeline(&desc)); } - EXPECT_EQ(mMockCache.GetNumEntries(), 2u); } -DAWN_INSTANTIATE_TEST(SinglePipelineCachingTests, VulkanBackend({"enable_blob_cache"})); +DAWN_INSTANTIATE_TEST(SinglePipelineCachingTests, + D3D12Backend({"enable_blob_cache"}), + D3D12Backend({"enable_blob_cache", "use_dxc"}), + MetalBackend({"enable_blob_cache"}), + OpenGLBackend({"enable_blob_cache"}), + OpenGLESBackend({"enable_blob_cache"}), + VulkanBackend({"enable_blob_cache"})); } // namespace diff --git a/src/dawn/tests/end2end/PrimitiveStateTests.cpp b/src/dawn/tests/end2end/PrimitiveStateTests.cpp index 08fb99556a..0734920a6e 100644 --- a/src/dawn/tests/end2end/PrimitiveStateTests.cpp +++ b/src/dawn/tests/end2end/PrimitiveStateTests.cpp @@ -21,11 +21,11 @@ constexpr static unsigned int kRTSize = 1; -class DepthClampingTest : public DawnTest { +class DepthClippingTest : public DawnTest { protected: void SetUp() override { DawnTest::SetUp(); - DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({wgpu::FeatureName::DepthClamping})); + DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({wgpu::FeatureName::DepthClipControl})); wgpu::TextureDescriptor renderTargetDescriptor; renderTargetDescriptor.size = {kRTSize, kRTSize}; @@ -52,7 +52,7 @@ class DepthClampingTest : public DawnTest { } @group(0) @binding(0) var ubo : UBO; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, ubo.depth, 1.0); })"); @@ -63,30 +63,29 @@ class DepthClampingTest : public DawnTest { } @group(0) @binding(0) var ubo : UBO; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(ubo.color, 1.0); })"); } std::vector GetRequiredFeatures() override { std::vector requiredFeatures = {}; - if (SupportsFeatures({wgpu::FeatureName::DepthClamping})) { - requiredFeatures.push_back(wgpu::FeatureName::DepthClamping); + if (SupportsFeatures({wgpu::FeatureName::DepthClipControl})) { + requiredFeatures.push_back(wgpu::FeatureName::DepthClipControl); } return requiredFeatures; } struct TestSpec { - wgpu::PrimitiveDepthClampingState* depthClampingState; - RGBA8 color; + wgpu::PrimitiveDepthClipControl* depthClipControl; + utils::RGBA8 color; float depth; - wgpu::CompareFunction depthCompareFunction; }; // Each test param represents a pair of triangles with a color, depth, stencil value, and // depthStencil state, one frontfacing, one backfacing Draw the triangles in order and check the // expected colors for the frontfaces and backfaces - void DoTest(const std::vector& testParams, const RGBA8& expected) { + void DoTest(const std::vector& testParams, const utils::RGBA8& expected) { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); struct TriangleData { @@ -111,13 +110,12 @@ class DepthClampingTest : public DawnTest { // Create a pipeline for the triangles with the test spec's params. utils::ComboRenderPipelineDescriptor descriptor; - descriptor.primitive.nextInChain = test.depthClampingState; + descriptor.primitive.nextInChain = test.depthClipControl; descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList; descriptor.vertex.module = vsModule; descriptor.cFragment.module = fsModule; wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil(); depthStencil->depthWriteEnabled = true; - depthStencil->depthCompare = test.depthCompareFunction; depthStencil->format = wgpu::TextureFormat::Depth24PlusStencil8; wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); @@ -146,150 +144,219 @@ class DepthClampingTest : public DawnTest { wgpu::ShaderModule fsModule; }; -// Test that fragments beyond the far plane are clamped to 1.0 if depth clamping is enabled. -TEST_P(DepthClampingTest, ClampOnBeyondFarPlane) { - wgpu::PrimitiveDepthClampingState clampingState; - clampingState.clampDepth = true; +// Test that fragments beyond the far plane are not clipped if unclippedDepth is true +TEST_P(DepthClippingTest, UnclippedBeyondFarPlane) { + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = true; DoTest( { // Draw a red triangle at depth 1. { - nullptr, /* depthClampingState */ - RGBA8(255, 0, 0, 255), /* color */ - 1.f, /* depth */ - wgpu::CompareFunction::Always, + nullptr, /* depthClipControl */ + utils::RGBA8(255, 0, 0, 255), /* color */ + 1.f, /* depth */ }, - // Draw a green triangle at depth 2 which should get clamped to 1. + // Draw a green triangle at depth 2 which should not be clipped. { - &clampingState, - RGBA8(0, 255, 0, 255), /* color */ - 2.f, /* depth */ - wgpu::CompareFunction::Equal, + &depthClipControl, /* depthClipControl */ + utils::RGBA8(0, 255, 0, 255), /* color */ + 2.f, /* depth */ }, }, - // Since we draw the green triangle with an "equal" depth compare function, the resulting - // fragment should be green. - RGBA8(0, 255, 0, 255)); + // The resulting fragment should be green even though the green triangle is + // outside the clip volume. + utils::RGBA8(0, 255, 0, 255)); } -// Test that fragments beyond the near plane are clamped to 0.0 if depth clamping is enabled. -TEST_P(DepthClampingTest, ClampOnBeyondNearPlane) { - wgpu::PrimitiveDepthClampingState clampingState; - clampingState.clampDepth = true; +// Test that fragments beyond the far plane are clipped if unclippedDepth is false +TEST_P(DepthClippingTest, ClippedBeyondFarPlane) { + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = false; + + DoTest( + { + // Draw a red triangle at depth 1. + { + nullptr, /* depthClipControl */ + utils::RGBA8(255, 0, 0, 255), /* color */ + 1.f, /* depth */ + }, + // Draw a green triangle at depth 2 which should be clipped. + { + &depthClipControl, /* depthClipControl */ + utils::RGBA8(0, 255, 0, 255), /* color */ + 2.f, /* depth */ + }, + }, + // The resulting fragment should be red since the green triangle is + // outside the clip volume. + utils::RGBA8(255, 0, 0, 255)); +} + +// Test that fragments beyond the far plane are clipped if unclippedDepth is not specified +TEST_P(DepthClippingTest, ClippedBeyondFarPlaneFeatureUnused) { + DoTest( + { + // Draw a red triangle at depth 1. + { + nullptr, /* depthClipControl */ + utils::RGBA8(255, 0, 0, 255), /* color */ + 1.f, /* depth */ + }, + // Draw a green triangle at depth 2 which should be clipped. + { + nullptr, /* depthClipControl */ + utils::RGBA8(0, 255, 0, 255), /* color */ + 2.f, /* depth */ + }, + }, + // The resulting fragment should be red since the green triangle is + // outside the clip volume. + utils::RGBA8(255, 0, 0, 255)); +} + +// Test that fragments beyond the near plane are not clipped if unclippedDepth is true +TEST_P(DepthClippingTest, UnclippedBeyondNearPlane) { + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = true; DoTest( { // Draw a red triangle at depth 0. { - nullptr, /* depthClampingState */ - RGBA8(255, 0, 0, 255), /* color */ - 0.f, /* depth */ - wgpu::CompareFunction::Always, + nullptr, /* depthClipControl */ + utils::RGBA8(255, 0, 0, 255), /* color */ + 0.f, /* depth */ }, - // Draw a green triangle at depth -1 which should get clamped to 0. + // Draw a green triangle at depth -1 which should not be clipped. { - &clampingState, - RGBA8(0, 255, 0, 255), /* color */ - -1.f, /* depth */ - wgpu::CompareFunction::Equal, + &depthClipControl, /* depthClipControl */ + utils::RGBA8(0, 255, 0, 255), /* color */ + -1.f, /* depth */ }, }, - // Since we draw the green triangle with an "equal" depth compare function, the resulting - // fragment should be green. - RGBA8(0, 255, 0, 255)); + // The resulting fragment should be green even though the green triangle is + // outside the clip volume. + utils::RGBA8(0, 255, 0, 255)); } -// Test that fragments inside the view frustum are unaffected by depth clamping. -TEST_P(DepthClampingTest, ClampOnInsideViewFrustum) { - wgpu::PrimitiveDepthClampingState clampingState; - clampingState.clampDepth = true; +// Test that fragments beyond the near plane are clipped if unclippedDepth is false +TEST_P(DepthClippingTest, ClippedBeyondNearPlane) { + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = false; DoTest( { + // Draw a red triangle at depth 0. { - &clampingState, - RGBA8(0, 255, 0, 255), /* color */ - 0.5f, /* depth */ - wgpu::CompareFunction::Always, + nullptr, /* depthClipControl */ + utils::RGBA8(255, 0, 0, 255), /* color */ + 0.f, /* depth */ + }, + // Draw a green triangle at depth -1 which should be clipped. + { + &depthClipControl, /* depthClipControl */ + utils::RGBA8(0, 255, 0, 255), /* color */ + -1.f, /* depth */ }, }, - RGBA8(0, 255, 0, 255)); + // The resulting fragment should be red because the green triangle is + // outside the clip volume. + utils::RGBA8(255, 0, 0, 255)); } -// Test that fragments outside the view frustum are clipped if depth clamping is disabled. -TEST_P(DepthClampingTest, ClampOffOutsideViewFrustum) { - wgpu::PrimitiveDepthClampingState clampingState; - clampingState.clampDepth = false; - +// Test that fragments beyond the near plane are clipped if unclippedDepth is not specified +TEST_P(DepthClippingTest, ClippedBeyondNearPlaneFeatureUnused) { DoTest( { + // Draw a red triangle at depth 0. { - &clampingState, - RGBA8(0, 255, 0, 255), /* color */ - 2.f, /* depth */ - wgpu::CompareFunction::Always, + nullptr, /* depthClipControl */ + utils::RGBA8(255, 0, 0, 255), /* color */ + 0.f, /* depth */ }, + // Draw a green triangle at depth -1 which should be clipped. { - &clampingState, - RGBA8(0, 255, 0, 255), /* color */ - -1.f, /* depth */ - wgpu::CompareFunction::Always, + nullptr, /* depthClipControl */ + utils::RGBA8(0, 255, 0, 255), /* color */ + -1.f, /* depth */ }, }, - RGBA8(0, 0, 0, 0)); -} - -// Test that fragments outside the view frustum are clipped if clampDepth is left unspecified. -TEST_P(DepthClampingTest, ClampUnspecifiedOutsideViewFrustum) { - DoTest( - { - { - nullptr, /* depthClampingState */ - RGBA8(0, 255, 0, 255), /* color */ - -1.f, /* depth */ - wgpu::CompareFunction::Always, - }, - { - nullptr, /* depthClampingState */ - RGBA8(0, 255, 0, 255), /* color */ - 2.f, /* depth */ - wgpu::CompareFunction::Always, - }, - }, - RGBA8(0, 0, 0, 0)); + // The resulting fragment should be red because the green triangle is + // outside the clip volume. + utils::RGBA8(255, 0, 0, 255)); } // Test that fragments are properly clipped or clamped if multiple render pipelines are used -// within the same render pass with differing clampDepth values. -TEST_P(DepthClampingTest, MultipleRenderPipelines) { - wgpu::PrimitiveDepthClampingState clampingState; - clampingState.clampDepth = true; +// within the same render pass with differing unclippedDepth values. +TEST_P(DepthClippingTest, MultipleRenderPipelines) { + wgpu::PrimitiveDepthClipControl depthClipControl1; + depthClipControl1.unclippedDepth = true; - wgpu::PrimitiveDepthClampingState clippingState; - clippingState.clampDepth = false; + wgpu::PrimitiveDepthClipControl depthClipControl2; + depthClipControl2.unclippedDepth = false; DoTest( { - // Draw green with clamping + // Draw green with no clipping { - &clampingState, - RGBA8(0, 255, 0, 255), /* color */ - 2.f, /* depth */ - wgpu::CompareFunction::Always, + &depthClipControl1, utils::RGBA8(0, 255, 0, 255), /* color */ + 2.f, /* depth */ }, // Draw red with clipping { - &clippingState, - RGBA8(255, 0, 0, 255), /* color */ - 2.f, /* depth */ - wgpu::CompareFunction::Always, + &depthClipControl2, utils::RGBA8(255, 0, 0, 255), /* color */ + 2.f, /* depth */ }, }, - RGBA8(0, 255, 0, 255)); // Result should be green + utils::RGBA8(0, 255, 0, 255)); // Result should be green } -DAWN_INSTANTIATE_TEST(DepthClampingTest, +// Test that fragments are not clipped if unclippedDepth is true and that their +// depths are not being clamped instead. In the fragment shader, we should see +// depth values outside the viewport. +TEST_P(DepthClippingTest, UnclippedNotClamped) { + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = true; + + // Create a pipeline to render a point. + utils::ComboRenderPipelineDescriptor descriptor; + descriptor.primitive.nextInChain = &depthClipControl; + descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList; + // Draw the point at (0, 0) with depth 2.0. + descriptor.vertex.module = utils::CreateShaderModule(device, R"( + @vertex fn main() -> @builtin(position) vec4 { + return vec4(0.0, 0.0, 2.0, 1.0); + })"); + // Write frag_pos.z / 4.0 which should be about 0.5 to the red channel. + // This is the depth output from the vertex shader which is not clamped to the viewport. + descriptor.cFragment.module = utils::CreateShaderModule(device, R"( + @fragment fn main(@builtin(position) frag_pos: vec4) -> @location(0) vec4 { + return vec4(frag_pos.z / 4.0, 0.0, 0.0, 1.0); + })"); + wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil(); + depthStencil->depthWriteEnabled = true; + depthStencil->format = wgpu::TextureFormat::Depth24PlusStencil8; + + wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); + + // Draw the point. + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPass({renderTargetView}, depthTextureView); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); + pass.SetPipeline(pipeline); + pass.Draw(1); + pass.End(); + wgpu::CommandBuffer commands = encoder.Finish(); + queue.Submit(1, &commands); + + EXPECT_PIXEL_RGBA8_BETWEEN(utils::RGBA8(127, 0, 0, 255), utils::RGBA8(128, 0, 0, 255), + renderTarget, 0, 0) + << "Pixel check failed"; +} + +DAWN_INSTANTIATE_TEST(DepthClippingTest, D3D12Backend(), MetalBackend(), OpenGLBackend(), diff --git a/src/dawn/tests/end2end/PrimitiveTopologyTests.cpp b/src/dawn/tests/end2end/PrimitiveTopologyTests.cpp index 235bdbf359..47ea2a0d17 100644 --- a/src/dawn/tests/end2end/PrimitiveTopologyTests.cpp +++ b/src/dawn/tests/end2end/PrimitiveTopologyTests.cpp @@ -155,13 +155,13 @@ class PrimitiveTopologyTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -218,7 +218,8 @@ class PrimitiveTopologyTest : public DawnTest { for (size_t i = 0; i < locationSpec.count; ++i) { // If this pixel is included, check that it is green. Otherwise, check that it is // black - RGBA8 color = locationSpec.include ? RGBA8::kGreen : RGBA8::kZero; + utils::RGBA8 color = + locationSpec.include ? utils::RGBA8::kGreen : utils::RGBA8::kZero; EXPECT_PIXEL_RGBA8_EQ(color, renderPass.color, locationSpec.locations[i].x, locationSpec.locations[i].y) << "Expected (" << locationSpec.locations[i].x << ", " diff --git a/src/dawn/tests/end2end/QueryTests.cpp b/src/dawn/tests/end2end/QueryTests.cpp index 3fa486026a..ff195376c6 100644 --- a/src/dawn/tests/end2end/QueryTests.cpp +++ b/src/dawn/tests/end2end/QueryTests.cpp @@ -77,7 +77,7 @@ class OcclusionQueryTests : public QueryTests { // Create basic render pipeline vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2( 1.0, 1.0), @@ -87,7 +87,7 @@ class OcclusionQueryTests : public QueryTests { })"); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -302,7 +302,7 @@ TEST_P(OcclusionQueryTests, Rewrite) { // the query resetting at the start of render passes on Vulkan backend. TEST_P(OcclusionQueryTests, ResolveSparseQueries) { // TODO(hao.x.li@intel.com): Fails on Intel Windows Vulkan due to a driver issue that - // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it util + // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it until // the issue is fixed. DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan() && IsIntel()); @@ -523,6 +523,17 @@ class TimestampQueryTests : public QueryTests { // Skip all tests if timestamp feature is not supported DAWN_TEST_UNSUPPORTED_IF(!SupportsFeatures({wgpu::FeatureName::TimestampQuery})); + + // Create basic compute pipeline + wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( + @compute @workgroup_size(1) + fn main() { + })"); + + wgpu::ComputePipelineDescriptor csDesc; + csDesc.compute.module = module; + csDesc.compute.entryPoint = "main"; + computePipeline = device.CreateComputePipeline(&csDesc); } std::vector GetRequiredFeatures() override { @@ -539,6 +550,113 @@ class TimestampQueryTests : public QueryTests { descriptor.type = wgpu::QueryType::Timestamp; return device.CreateQuerySet(&descriptor); } + + void TestTimestampWritesOnComputePass( + const std::vector& timestampWrites, + const std::vector& timestampWritesOnAnotherPass = {}) { + size_t queryCount = timestampWrites.size() + timestampWritesOnAnotherPass.size(); + // The destination buffer offset must be a multiple of 256. + wgpu::Buffer destination = + CreateResolveBuffer(queryCount * kMinDestinationOffset + sizeof(uint64_t)); + + wgpu::ComputePassDescriptor descriptor; + descriptor.timestampWriteCount = timestampWrites.size(); + descriptor.timestampWrites = timestampWrites.data(); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::ComputePassEncoder pass = encoder.BeginComputePass(&descriptor); + pass.SetPipeline(computePipeline); + pass.DispatchWorkgroups(1, 1, 1); + pass.End(); + + // Resolve queries one by one because the query set at the beginning of pass may be + // different with the one at the end of pass. + for (size_t i = 0; i < timestampWrites.size(); i++) { + encoder.ResolveQuerySet(timestampWrites[i].querySet, timestampWrites[i].queryIndex, 1, + destination, i * kMinDestinationOffset); + } + + // Begin another compute pass if the timestampWritesOnAnotherPass is set. + if (!timestampWritesOnAnotherPass.empty()) { + wgpu::ComputePassDescriptor descriptor2; + descriptor2.timestampWriteCount = timestampWritesOnAnotherPass.size(); + descriptor2.timestampWrites = timestampWritesOnAnotherPass.data(); + + wgpu::ComputePassEncoder pass2 = encoder.BeginComputePass(&descriptor2); + pass2.SetPipeline(computePipeline); + pass2.DispatchWorkgroups(1, 1, 1); + pass2.End(); + + for (size_t i = 0; i < timestampWritesOnAnotherPass.size(); i++) { + // Resolve queries one by one because the query set at the beginning of pass may be + // different with the one at the end of pass. + encoder.ResolveQuerySet(timestampWritesOnAnotherPass[i].querySet, + timestampWritesOnAnotherPass[i].queryIndex, 1, destination, + (timestampWrites.size() + i) * kMinDestinationOffset); + } + } + + wgpu::CommandBuffer commands = encoder.Finish(); + queue.Submit(1, &commands); + + for (size_t i = 0; i < queryCount; i++) { + EXPECT_BUFFER(destination, i * kMinDestinationOffset, sizeof(uint64_t), + new TimestampExpectation); + } + } + + void TestTimestampWritesOnRenderPass( + const std::vector& timestampWrites, + const std::vector& timestampWritesOnAnotherPass = {}) { + size_t queryCount = timestampWrites.size() + timestampWritesOnAnotherPass.size(); + // The destination buffer offset must be a multiple of 256. + wgpu::Buffer destination = + CreateResolveBuffer(queryCount * kMinDestinationOffset + sizeof(uint64_t)); + + utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1); + renderPass.renderPassInfo.timestampWriteCount = timestampWrites.size(); + renderPass.renderPassInfo.timestampWrites = timestampWrites.data(); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); + pass.End(); + + // Resolve queries one by one because the query set at the beginning of pass may be + // different with the one at the end of pass. + for (size_t i = 0; i < timestampWrites.size(); i++) { + encoder.ResolveQuerySet(timestampWrites[i].querySet, timestampWrites[i].queryIndex, 1, + destination, i * kMinDestinationOffset); + } + + // Begin another render pass if the timestampWritesOnAnotherPass is set. + if (!timestampWritesOnAnotherPass.empty()) { + utils::BasicRenderPass renderPass2 = utils::CreateBasicRenderPass(device, 1, 1); + renderPass2.renderPassInfo.timestampWriteCount = timestampWritesOnAnotherPass.size(); + renderPass2.renderPassInfo.timestampWrites = timestampWritesOnAnotherPass.data(); + + wgpu::RenderPassEncoder pass2 = encoder.BeginRenderPass(&renderPass2.renderPassInfo); + pass2.End(); + + for (size_t i = 0; i < timestampWritesOnAnotherPass.size(); i++) { + // Resolve queries one by one because the query set at the beginning of pass may be + // different with the one at the end of pass. + encoder.ResolveQuerySet(timestampWritesOnAnotherPass[i].querySet, + timestampWritesOnAnotherPass[i].queryIndex, 1, destination, + (timestampWrites.size() + i) * kMinDestinationOffset); + } + } + + wgpu::CommandBuffer commands = encoder.Finish(); + queue.Submit(1, &commands); + + for (size_t i = 0; i < queryCount; i++) { + EXPECT_BUFFER(destination, i * kMinDestinationOffset, sizeof(uint64_t), + new TimestampExpectation); + } + } + + private: + wgpu::ComputePipeline computePipeline; }; // Test creating query set with the type of Timestamp @@ -551,6 +669,9 @@ TEST_P(TimestampQueryTests, QuerySetCreation) { // Test calling timestamp query from command encoder TEST_P(TimestampQueryTests, TimestampOnCommandEncoder) { + // TODO (dawn:1250): Still not implemented on Metal backend. + DAWN_TEST_UNSUPPORTED_IF(IsMetal()); + constexpr uint32_t kQueryCount = 2; // Write timestamp with different query indexes @@ -694,6 +815,124 @@ TEST_P(TimestampQueryTests, TimestampOnComputePass) { } } +// Test timestampWrites setting in compute pass descriptor +TEST_P(TimestampQueryTests, TimestampWritesOnComputePass) { + // TODO(dawn:1489): Fails on Intel Windows Vulkan due to a driver issue that + // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it until + // the issue is fixed. + DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan() && IsIntel()); + + // TODO (dawn:1250): Still not implemented on Metal backend. + DAWN_TEST_UNSUPPORTED_IF(IsMetal()); + + constexpr uint32_t kQueryCount = 2; + + // Set timestampWrites with different query indexes and locations on same compute pass + { + wgpu::QuerySet querySet = CreateQuerySetForTimestamp(kQueryCount); + + TestTimestampWritesOnComputePass( + {{querySet, 0, wgpu::ComputePassTimestampLocation::Beginning}, + {querySet, 1, wgpu::ComputePassTimestampLocation::End}}); + } + + // Set timestampWrites with different query set on same compute pass + { + wgpu::QuerySet querySet0 = CreateQuerySetForTimestamp(1); + wgpu::QuerySet querySet1 = CreateQuerySetForTimestamp(1); + + TestTimestampWritesOnComputePass( + {{querySet0, 0, wgpu::ComputePassTimestampLocation::Beginning}, + {querySet1, 0, wgpu::ComputePassTimestampLocation::End}}); + } + + // Set timestampWrites with only one value of ComputePassTimestampLocation + { + wgpu::QuerySet querySet = CreateQuerySetForTimestamp(kQueryCount); + + TestTimestampWritesOnComputePass( + {{querySet, 0, wgpu::ComputePassTimestampLocation::Beginning}}); + + TestTimestampWritesOnComputePass({{querySet, 1, wgpu::ComputePassTimestampLocation::End}}); + } + + // Set timestampWrites with same query set and query index on same compute pass + { + wgpu::QuerySet querySet = CreateQuerySetForTimestamp(kQueryCount); + + TestTimestampWritesOnComputePass( + {{querySet, 0, wgpu::ComputePassTimestampLocation::Beginning}, + {querySet, 0, wgpu::ComputePassTimestampLocation::End}}); + } + + // Set timestampWrites with same query indexes and locations on different compute pass + { + wgpu::QuerySet querySet0 = CreateQuerySetForTimestamp(kQueryCount); + wgpu::QuerySet querySet1 = CreateQuerySetForTimestamp(kQueryCount); + + TestTimestampWritesOnComputePass( + {{querySet0, 0, wgpu::ComputePassTimestampLocation::Beginning}, + {querySet0, 1, wgpu::ComputePassTimestampLocation::End}}, + {{querySet1, 0, wgpu::ComputePassTimestampLocation::Beginning}, + {querySet1, 1, wgpu::ComputePassTimestampLocation::End}}); + } +} + +// Test timestampWrites setting in render pass descriptor +TEST_P(TimestampQueryTests, TimestampWritesOnRenderPass) { + // TODO(dawn:1489): Fails on Intel Windows Vulkan due to a driver issue that + // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it until + // the issue is fixed. + DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan() && IsIntel()); + + // TODO (dawn:1250): Still not implemented on Metal backend. + DAWN_TEST_UNSUPPORTED_IF(IsMetal()); + + constexpr uint32_t kQueryCount = 2; + + // Set timestampWrites with different query indexes and locations, not need test write same + // query index due to it's not allowed on render pass. + { + wgpu::QuerySet querySet = CreateQuerySetForTimestamp(kQueryCount); + + TestTimestampWritesOnRenderPass( + {{querySet, 0, wgpu::RenderPassTimestampLocation::Beginning}, + {querySet, 1, wgpu::RenderPassTimestampLocation::End}}); + } + + // Set timestampWrites with different query set on same render pass + { + wgpu::QuerySet querySet0 = CreateQuerySetForTimestamp(1); + wgpu::QuerySet querySet1 = CreateQuerySetForTimestamp(1); + + TestTimestampWritesOnRenderPass( + {{querySet0, 0, wgpu::RenderPassTimestampLocation::Beginning}, + {querySet1, 0, wgpu::RenderPassTimestampLocation::End}}); + } + + // Set timestampWrites with only one value of RenderPassTimestampLocation + { + wgpu::QuerySet querySet = CreateQuerySetForTimestamp(kQueryCount); + + TestTimestampWritesOnRenderPass( + {{querySet, 0, wgpu::RenderPassTimestampLocation::Beginning}}); + + TestTimestampWritesOnRenderPass({{querySet, 1, wgpu::RenderPassTimestampLocation::End}}); + } + + // Set timestampWrites with same query indexes and locations on different render pass + { + wgpu::QuerySet querySet0 = CreateQuerySetForTimestamp(kQueryCount); + wgpu::QuerySet querySet1 = CreateQuerySetForTimestamp(kQueryCount); + + TestTimestampWritesOnRenderPass( + {{querySet0, 0, wgpu::RenderPassTimestampLocation::Beginning}, + {querySet0, 1, wgpu::RenderPassTimestampLocation::End}}, + {{querySet1, 0, wgpu::RenderPassTimestampLocation::Beginning}, + {querySet1, 1, wgpu::RenderPassTimestampLocation::End}}); + } +} + // Test resolving timestamp query from another different encoder TEST_P(TimestampQueryTests, ResolveFromAnotherEncoder) { constexpr uint32_t kQueryCount = 2; @@ -717,8 +956,8 @@ TEST_P(TimestampQueryTests, ResolveFromAnotherEncoder) { // Test resolving timestamp query correctly if the queries are written sparsely TEST_P(TimestampQueryTests, ResolveSparseQueries) { - // TODO(hao.x.li@intel.com): Fails on Intel Windows Vulkan due to a driver issue that - // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it util + // TODO(dawn:1489): Fails on Intel Windows Vulkan due to a driver issue that + // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it until // the issue is fixed. DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan() && IsIntel()); @@ -768,8 +1007,8 @@ TEST_P(TimestampQueryTests, ResolveWithoutWritten) { // Test resolving timestamp query to one slot in the buffer TEST_P(TimestampQueryTests, ResolveToBufferWithOffset) { - // TODO(hao.x.li@intel.com): Fails on Intel Windows Vulkan due to a driver issue that - // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it util + // TODO(dawn:1489): Fails on Intel Windows Vulkan due to a driver issue that + // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it until // the issue is fixed. DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan() && IsIntel()); @@ -818,8 +1057,8 @@ TEST_P(TimestampQueryTests, ResolveToBufferWithOffset) { // Test resolving a query set twice into the same destination buffer with potentially overlapping // ranges TEST_P(TimestampQueryTests, ResolveTwiceToSameBuffer) { - // TODO(hao.x.li@intel.com): Fails on Intel Windows Vulkan due to a driver issue that - // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it util + // TODO(dawn:1489): Fails on Intel Windows Vulkan due to a driver issue that + // vkCmdFillBuffer and vkCmdCopyQueryPoolResults are not executed in order, skip it until // the issue is fixed. DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan() && IsIntel()); diff --git a/src/dawn/tests/end2end/QueueTests.cpp b/src/dawn/tests/end2end/QueueTests.cpp index a8f34f4acc..3e843ceea5 100644 --- a/src/dawn/tests/end2end/QueueTests.cpp +++ b/src/dawn/tests/end2end/QueueTests.cpp @@ -234,7 +234,7 @@ class QueueWriteTextureTests : public DawnTest { uint32_t width, uint32_t height, uint32_t srcBytesPerRow, - RGBA8* dstData, + utils::RGBA8* dstData, uint32_t dstTexelPerRow, uint32_t texelBlockSize) { for (uint64_t y = 0; y < height; ++y) { @@ -299,7 +299,7 @@ class QueueWriteTextureTests : public DawnTest { for (uint32_t slice = textureSpec.copyOrigin.z; slice < maxArrayLayer; ++slice) { // Pack the data in the specified copy region to have the same // format as the expected texture data. - std::vector expected(texelCountLastLayer); + std::vector expected(texelCountLastLayer); PackTextureData(data.data() + dataOffset, copySize.width, copySize.height, dataSpec.bytesPerRow, expected.data(), copySize.width, bytesPerTexel); @@ -704,8 +704,76 @@ TEST_P(QueueWriteTextureTests, WriteStencilAspectWithSourceOffsetUnalignedTo4) { EXPECT_BUFFER_U8_RANGE_EQ(expectedData.data(), outputBuffer, 0, 8); } +// Tests calling queue.writeTexture() to a depth texture after calling queue.writeTexture() on +// another texture always works. On some D3D12 backends the buffer offset of buffer-to-texture +// copies must be a multiple of 512 when the destination texture is a depth stencil texture. +TEST_P(QueueWriteTextureTests, WriteDepthAspectAfterOtherQueueWriteTextureCalls) { + // Copies to a single aspect are unsupported on OpenGL. + DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES()); + + wgpu::TextureDescriptor textureDescriptor; + textureDescriptor.format = wgpu::TextureFormat::Depth16Unorm; + textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst; + textureDescriptor.size = {1, 1, 1}; + wgpu::Texture depthTexture1 = device.CreateTexture(&textureDescriptor); + wgpu::Texture depthTexture2 = device.CreateTexture(&textureDescriptor); + + constexpr uint16_t kExpectedData1 = (204 << 8) | 205; + wgpu::ImageCopyTexture imageCopyTexture1 = utils::CreateImageCopyTexture(depthTexture1); + wgpu::TextureDataLayout textureDataLayout = + utils::CreateTextureDataLayout(0, sizeof(kExpectedData1)); + queue.WriteTexture(&imageCopyTexture1, &kExpectedData1, sizeof(kExpectedData1), + &textureDataLayout, &textureDescriptor.size); + + constexpr uint16_t kExpectedData2 = (206 << 8) | 207; + wgpu::ImageCopyTexture imageCopyTexture2 = utils::CreateImageCopyTexture(depthTexture2); + queue.WriteTexture(&imageCopyTexture2, &kExpectedData2, sizeof(kExpectedData2), + &textureDataLayout, &textureDescriptor.size); + + EXPECT_TEXTURE_EQ(&kExpectedData1, depthTexture1, {0, 0}, {1, 1}, 0, + wgpu::TextureAspect::DepthOnly); + EXPECT_TEXTURE_EQ(&kExpectedData2, depthTexture2, {0, 0}, {1, 1}, 0, + wgpu::TextureAspect::DepthOnly); +} + +// Tests calling queue.writeTexture() to the stencil aspect after calling queue.writeTexture() on +// another texture always works. On some D3D12 backends the buffer offset of buffer-to-texture +// copies must be a multiple of 512 when the destination texture is a depth stencil texture. +TEST_P(QueueWriteTextureTests, WriteStencilAspectAfterOtherQueueWriteTextureCalls) { + // Copies to a single aspect are unsupported on OpenGL. + DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES()); + + wgpu::TextureDescriptor textureDescriptor; + textureDescriptor.format = wgpu::TextureFormat::Depth24PlusStencil8; + textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst; + textureDescriptor.size = {1, 1, 1}; + wgpu::Texture depthStencilTexture1 = device.CreateTexture(&textureDescriptor); + wgpu::Texture depthStencilTexture2 = device.CreateTexture(&textureDescriptor); + + constexpr uint8_t kExpectedData1 = 204u; + wgpu::ImageCopyTexture imageCopyTexture1 = utils::CreateImageCopyTexture( + depthStencilTexture1, 0, {0, 0, 0}, wgpu::TextureAspect::StencilOnly); + wgpu::TextureDataLayout textureDataLayout = + utils::CreateTextureDataLayout(0, sizeof(kExpectedData1)); + queue.WriteTexture(&imageCopyTexture1, &kExpectedData1, sizeof(kExpectedData1), + &textureDataLayout, &textureDescriptor.size); + + constexpr uint8_t kExpectedData2 = 205; + wgpu::ImageCopyTexture imageCopyTexture2 = utils::CreateImageCopyTexture( + depthStencilTexture2, 0, {0, 0, 0}, wgpu::TextureAspect::StencilOnly); + queue.WriteTexture(&imageCopyTexture2, &kExpectedData2, sizeof(kExpectedData2), + &textureDataLayout, &textureDescriptor.size); + + EXPECT_TEXTURE_EQ(&kExpectedData1, depthStencilTexture1, {0, 0}, {1, 1}, 0, + wgpu::TextureAspect::StencilOnly); + EXPECT_TEXTURE_EQ(&kExpectedData2, depthStencilTexture2, {0, 0}, {1, 1}, 0, + wgpu::TextureAspect::StencilOnly); +} + DAWN_INSTANTIATE_TEST(QueueWriteTextureTests, D3D12Backend(), + D3D12Backend({"d3d12_use_temp_buffer_in_depth_stencil_texture_and_buffer_" + "copy_with_non_zero_buffer_offset"}), MetalBackend(), OpenGLBackend(), OpenGLESBackend(), diff --git a/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp b/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp index ad5c6972d9..f4e422c1d4 100644 --- a/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp +++ b/src/dawn/tests/end2end/ReadOnlyDepthStencilAttachmentTests.cpp @@ -37,13 +37,6 @@ class ReadOnlyDepthStencilAttachmentTests std::vector GetRequiredFeatures() override { switch (GetParam().mTextureFormat) { - case wgpu::TextureFormat::Depth24UnormStencil8: - if (SupportsFeatures({wgpu::FeatureName::Depth24UnormStencil8})) { - mIsFormatSupported = true; - return {wgpu::FeatureName::Depth24UnormStencil8}; - } - - return {}; case wgpu::TextureFormat::Depth32FloatStencil8: if (SupportsFeatures({wgpu::FeatureName::Depth32FloatStencil8})) { mIsFormatSupported = true; @@ -71,7 +64,7 @@ class ReadOnlyDepthStencilAttachmentTests // and pass the depth test, and sample from the depth buffer in fragment shader in the same // pipeline. pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec3(-1.0, 1.0, 0.4), @@ -86,7 +79,7 @@ class ReadOnlyDepthStencilAttachmentTests if (!sampleFromAttachment) { // Draw a solid blue into color buffer if not sample from depth/stencil attachment. pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 1.0, 0.0); })"); } else { @@ -96,7 +89,7 @@ class ReadOnlyDepthStencilAttachmentTests @group(0) @binding(0) var samp : sampler; @group(0) @binding(1) var tex : texture_depth_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return vec4(textureSample(tex, samp, FragCoord.xy), 0.0, 0.0, 0.0); })"); @@ -105,7 +98,7 @@ class ReadOnlyDepthStencilAttachmentTests pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var tex : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { var texel = textureLoad(tex, vec2(FragCoord.xy), 0); return vec4(f32(texel[0]) / 255.0, 0.0, 0.0, 0.0); @@ -231,11 +224,11 @@ TEST_P(ReadOnlyDepthAttachmentTests, SampleFromAttachment) { // The top part is not rendered by the pipeline. Its color is the default clear color for // color attachment. - const std::vector kExpectedTopColors(kSize * kSize / 2, {0, 0, 0, 0}); + const std::vector kExpectedTopColors(kSize * kSize / 2, {0, 0, 0, 0}); // The bottom part is rendered, whose red channel is sampled from depth attachment, which // is initialized into 0.2. - const std::vector kExpectedBottomColors(kSize * kSize / 2, - {static_cast(0.2 * 255), 0, 0, 0}); + const std::vector kExpectedBottomColors( + kSize * kSize / 2, {static_cast(0.2 * 255), 0, 0, 0}); EXPECT_TEXTURE_EQ(kExpectedTopColors.data(), colorTexture, {0, 0}, {kSize, kSize / 2}); EXPECT_TEXTURE_EQ(kExpectedBottomColors.data(), colorTexture, {0, kSize / 2}, {kSize, kSize / 2}); @@ -255,9 +248,9 @@ TEST_P(ReadOnlyDepthAttachmentTests, NotSampleFromAttachment) { // The top part is not rendered by the pipeline. Its color is the default clear color for // color attachment. - const std::vector kExpectedTopColors(kSize * kSize / 2, {0, 0, 0, 0}); + const std::vector kExpectedTopColors(kSize * kSize / 2, {0, 0, 0, 0}); // The bottom part is rendered. Its color is set to blue. - const std::vector kExpectedBottomColors(kSize * kSize / 2, {0, 0, 255, 0}); + const std::vector kExpectedBottomColors(kSize * kSize / 2, {0, 0, 255, 0}); EXPECT_TEXTURE_EQ(kExpectedTopColors.data(), colorTexture, {0, 0}, {kSize, kSize / 2}); EXPECT_TEXTURE_EQ(kExpectedBottomColors.data(), colorTexture, {0, kSize / 2}, {kSize, kSize / 2}); @@ -284,14 +277,14 @@ TEST_P(ReadOnlyStencilAttachmentTests, SampleFromAttachment) { // stencilRefValue < stencilValue (stencilInitValue), so stencil test passes. The pipeline // samples from stencil buffer and writes into color buffer. DoTest(wgpu::TextureAspect::StencilOnly, stencilFormat, colorTexture, &values, true); - const std::vector kSampledColors(kSize * kSize, {3, 0, 0, 0}); + const std::vector kSampledColors(kSize * kSize, {3, 0, 0, 0}); EXPECT_TEXTURE_EQ(kSampledColors.data(), colorTexture, {0, 0}, {kSize, kSize}); values.stencilInitValue = 1; // stencilRefValue > stencilValue (stencilInitValue), so stencil test fails. The pipeline // doesn't change color buffer. Sampled data from stencil buffer is discarded. DoTest(wgpu::TextureAspect::StencilOnly, stencilFormat, colorTexture, &values, true); - const std::vector kInitColors(kSize * kSize, {0, 0, 0, 0}); + const std::vector kInitColors(kSize * kSize, {0, 0, 0, 0}); EXPECT_TEXTURE_EQ(kInitColors.data(), colorTexture, {0, 0}, {kSize, kSize}); } @@ -308,14 +301,14 @@ TEST_P(ReadOnlyStencilAttachmentTests, NotSampleFromAttachment) { // stencilRefValue < stencilValue (stencilInitValue), so stencil test passes. The pipeline // draw solid blue into color buffer. DoTest(wgpu::TextureAspect::StencilOnly, stencilFormat, colorTexture, &values, false); - const std::vector kSampledColors(kSize * kSize, {0, 0, 255, 0}); + const std::vector kSampledColors(kSize * kSize, {0, 0, 255, 0}); EXPECT_TEXTURE_EQ(kSampledColors.data(), colorTexture, {0, 0}, {kSize, kSize}); values.stencilInitValue = 1; // stencilRefValue > stencilValue (stencilInitValue), so stencil test fails. The pipeline // doesn't change color buffer. drawing data is discarded. DoTest(wgpu::TextureAspect::StencilOnly, stencilFormat, colorTexture, &values, false); - const std::vector kInitColors(kSize * kSize, {0, 0, 0, 0}); + const std::vector kInitColors(kSize * kSize, {0, 0, 0, 0}); EXPECT_TEXTURE_EQ(kInitColors.data(), colorTexture, {0, 0}, {kSize, kSize}); } diff --git a/src/dawn/tests/end2end/RenderAttachmentTests.cpp b/src/dawn/tests/end2end/RenderAttachmentTests.cpp index eacc6663ef..aaa0f68da4 100644 --- a/src/dawn/tests/end2end/RenderAttachmentTests.cpp +++ b/src/dawn/tests/end2end/RenderAttachmentTests.cpp @@ -23,7 +23,7 @@ class RenderAttachmentTest : public DawnTest {}; // There should be no backend validation errors or indexing out-of-bounds. TEST_P(RenderAttachmentTest, MoreFragmentOutputsThanAttachments) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); @@ -36,7 +36,7 @@ TEST_P(RenderAttachmentTest, MoreFragmentOutputsThanAttachments) { @location(3) color3 : vec4, } - @stage(fragment) + @fragment fn main() -> Output { var output : Output; output.color0 = vec4(1.0, 0.0, 0.0, 1.0); @@ -72,7 +72,7 @@ TEST_P(RenderAttachmentTest, MoreFragmentOutputsThanAttachments) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderTarget, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, renderTarget, 0, 0); } DAWN_INSTANTIATE_TEST(RenderAttachmentTest, diff --git a/src/dawn/tests/end2end/RenderBundleTests.cpp b/src/dawn/tests/end2end/RenderBundleTests.cpp index 98ccce841d..8dcf98c225 100644 --- a/src/dawn/tests/end2end/RenderBundleTests.cpp +++ b/src/dawn/tests/end2end/RenderBundleTests.cpp @@ -19,7 +19,7 @@ #include "dawn/utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 4; -const RGBA8 kColors[2] = {RGBA8::kGreen, RGBA8::kBlue}; +const utils::RGBA8 kColors[2] = {utils::RGBA8::kGreen, utils::RGBA8::kBlue}; // RenderBundleTest tests simple usage of RenderBundles to draw. The implementaiton // of RenderBundle is shared significantly with render pass execution which is @@ -32,7 +32,7 @@ class RenderBundleTest : public DawnTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); @@ -43,7 +43,7 @@ class RenderBundleTest : public DawnTest { } @group(0) @binding(0) var fragmentUniformBuffer : Ubo; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return fragmentUniformBuffer.color; })"); diff --git a/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp b/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp index 6fb5ddf8ba..ca70dbb23c 100644 --- a/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp @@ -13,6 +13,8 @@ // limitations under the License. #include +#include +#include #include "dawn/tests/DawnTest.h" @@ -68,15 +70,15 @@ class RenderPassLoadOpTests : public DawnTest { renderTargetView = renderTarget.CreateView(); - std::fill(expectZero.begin(), expectZero.end(), RGBA8::kZero); + std::fill(expectZero.begin(), expectZero.end(), utils::RGBA8::kZero); - std::fill(expectGreen.begin(), expectGreen.end(), RGBA8::kGreen); + std::fill(expectGreen.begin(), expectGreen.end(), utils::RGBA8::kGreen); - std::fill(expectBlue.begin(), expectBlue.end(), RGBA8::kBlue); + std::fill(expectBlue.begin(), expectBlue.end(), utils::RGBA8::kBlue); // draws a blue quad on the right half of the screen const char* vsSource = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2( 0.0, -1.0), @@ -90,16 +92,16 @@ class RenderPassLoadOpTests : public DawnTest { })"; const char* fsSource = R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 1.0, 1.0); })"; blueQuad = DrawQuad(device, vsSource, fsSource); } template - void TestIntegerClearColor(wgpu::TextureFormat format, - const wgpu::Color& clearColor, - const std::array& expectedPixelValue) { + void TestClearColor(wgpu::TextureFormat format, + const wgpu::Color& clearColor, + const std::array& expectedPixelValue) { constexpr wgpu::Extent3D kTextureSize = {1, 1, 1}; wgpu::TextureDescriptor textureDescriptor; @@ -131,16 +133,16 @@ class RenderPassLoadOpTests : public DawnTest { wgpu::CommandBuffer commandBuffer = encoder.Finish(); queue.Submit(1, &commandBuffer); - EXPECT_BUFFER_U32_RANGE_EQ(reinterpret_cast(expectedPixelValue.data()), - buffer, 0, bufferSize / sizeof(uint32_t)); + EXPECT_BUFFER_U8_RANGE_EQ(reinterpret_cast(expectedPixelValue.data()), + buffer, 0, bufferSize / sizeof(uint8_t)); } wgpu::Texture renderTarget; wgpu::TextureView renderTargetView; - std::array expectZero; - std::array expectGreen; - std::array expectBlue; + std::array expectZero; + std::array expectGreen; + std::array expectBlue; DrawQuad blueQuad = {}; }; @@ -192,60 +194,47 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearOnIntegerFormats) { { constexpr wgpu::Color kClearColor = {2.f, 3.3f, 254.8f, 255.0f}; constexpr std::array kExpectedPixelValue = {2, 3, 254, 255}; - TestIntegerClearColor(wgpu::TextureFormat::RGBA8Uint, kClearColor, - kExpectedPixelValue); + TestClearColor(wgpu::TextureFormat::RGBA8Uint, kClearColor, kExpectedPixelValue); } // RGBA8Sint { constexpr wgpu::Color kClearColor = {2.f, -3.3f, 126.8f, -128.0f}; constexpr std::array kExpectedPixelValue = {2, -3, 126, -128}; - TestIntegerClearColor(wgpu::TextureFormat::RGBA8Sint, kClearColor, - kExpectedPixelValue); + TestClearColor(wgpu::TextureFormat::RGBA8Sint, kClearColor, kExpectedPixelValue); } // RGBA16Uint { constexpr wgpu::Color kClearColor = {2.f, 3.3f, 512.7f, 65535.f}; constexpr std::array kExpectedPixelValue = {2, 3, 512, 65535u}; - TestIntegerClearColor(wgpu::TextureFormat::RGBA16Uint, kClearColor, - kExpectedPixelValue); + TestClearColor(wgpu::TextureFormat::RGBA16Uint, kClearColor, kExpectedPixelValue); } // RGBA16Sint { constexpr wgpu::Color kClearColor = {2.f, -3.3f, 32767.8f, -32768.0f}; constexpr std::array kExpectedPixelValue = {2, -3, 32767, -32768}; - TestIntegerClearColor(wgpu::TextureFormat::RGBA16Sint, kClearColor, - kExpectedPixelValue); + TestClearColor(wgpu::TextureFormat::RGBA16Sint, kClearColor, kExpectedPixelValue); } // RGBA32Uint { constexpr wgpu::Color kClearColor = {2.f, 3.3f, 65534.8f, 65537.f}; constexpr std::array kExpectedPixelValue = {2, 3, 65534, 65537}; - TestIntegerClearColor(wgpu::TextureFormat::RGBA32Uint, kClearColor, - kExpectedPixelValue); + TestClearColor(wgpu::TextureFormat::RGBA32Uint, kClearColor, kExpectedPixelValue); } // RGBA32Sint { constexpr wgpu::Color kClearColor = {2.f, -3.3f, 65534.8f, -65537.f}; constexpr std::array kExpectedPixelValue = {2, -3, 65534, -65537}; - TestIntegerClearColor(wgpu::TextureFormat::RGBA32Sint, kClearColor, - kExpectedPixelValue); + TestClearColor(wgpu::TextureFormat::RGBA32Sint, kClearColor, kExpectedPixelValue); } } // This test verifies that input double values are being rendered correctly when clearing. TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsToLargeValues) { - // TODO(http://crbug.com/dawn/537): Implemement a workaround to enable clearing integer formats - // to large values on D3D12. - DAWN_SUPPRESS_TEST_IF(IsD3D12()); - - // TODO(crbug.com/dawn/1109): Re-enable once fixed on Mac Mini 8,1s w/ 11.5. - DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(11, 5)); - constexpr double kUint32MaxDouble = 4294967295.0; constexpr uint32_t kUint32Max = static_cast(kUint32MaxDouble); // RGBA32Uint for UINT32_MAX @@ -254,8 +243,7 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsToLargeValues) { kUint32MaxDouble}; constexpr std::array kExpectedPixelValue = {kUint32Max, kUint32Max, kUint32Max, kUint32Max}; - TestIntegerClearColor(wgpu::TextureFormat::RGBA32Uint, kClearColor, - kExpectedPixelValue); + TestClearColor(wgpu::TextureFormat::RGBA32Uint, kClearColor, kExpectedPixelValue); } constexpr double kSint32MaxDouble = 2147483647.0; @@ -270,8 +258,7 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsToLargeValues) { kSint32MaxDouble}; constexpr std::array kExpectedPixelValue = {kSint32Max, kSint32Max, kSint32Max, kSint32Max}; - TestIntegerClearColor(wgpu::TextureFormat::RGBA32Sint, kClearColor, - kExpectedPixelValue); + TestClearColor(wgpu::TextureFormat::RGBA32Sint, kClearColor, kExpectedPixelValue); } // RGBA32Sint for SINT32 lower bound. @@ -280,11 +267,468 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsToLargeValues) { kSint32MinDouble}; constexpr std::array kExpectedPixelValue = {kSint32Min, kSint32Min, kSint32Min, kSint32Min}; - TestIntegerClearColor(wgpu::TextureFormat::RGBA32Sint, kClearColor, - kExpectedPixelValue); + TestClearColor(wgpu::TextureFormat::RGBA32Sint, kClearColor, kExpectedPixelValue); } } +// Test clearing a color attachment on Uint8 formats (R8Uint, RG8Uint, RGBA8Uint) when the clear +// values are out of bound. +TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Uint8) { + constexpr uint16_t kUint8Max = std::numeric_limits::max(); + + using TestCase = std::tuple>; + constexpr std::array kTestCases = {{ + {wgpu::TextureFormat::R8Uint, {-1, 0, 0, 0}, {0, 0, 0, 0}}, + {wgpu::TextureFormat::R8Uint, {0, 0, 0, 0}, {0, 0, 0, 0}}, + {wgpu::TextureFormat::R8Uint, {kUint8Max, 0, 0, 0}, {kUint8Max, 0, 0, 0}}, + {wgpu::TextureFormat::R8Uint, {kUint8Max + 1, 0, 0, 0}, {kUint8Max, 0, 0, 0}}, + {wgpu::TextureFormat::RG8Uint, {0, kUint8Max, 0, 0}, {0, kUint8Max, 0, 0}}, + {wgpu::TextureFormat::RG8Uint, {-1, kUint8Max + 1, 0, 0}, {0, kUint8Max, 0, 0}}, + {wgpu::TextureFormat::RGBA8Uint, + {-1, 0, kUint8Max, kUint8Max + 1}, + {0, 0, kUint8Max, kUint8Max}}, + }}; + + for (const TestCase& testCase : kTestCases) { + auto [format, clearColor, expectedPixelValue] = testCase; + TestClearColor(format, clearColor, expectedPixelValue); + } +} + +// Test clearing a color attachment on Sint8 formats (R8Sint, RG8Sint, RGBA8Sint) when the clear +// values are out of bound. +TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Sint8) { + constexpr int16_t kSint8Max = std::numeric_limits::max(); + constexpr int16_t kSint8Min = std::numeric_limits::min(); + + using TestCase = std::tuple>; + constexpr std::array kTestCases = {{ + {wgpu::TextureFormat::R8Sint, {kSint8Min - 1, 0, 0, 0}, {kSint8Min, 0, 0, 0}}, + {wgpu::TextureFormat::R8Sint, {kSint8Min, 0, 0, 0}, {kSint8Min, 0, 0, 0}}, + {wgpu::TextureFormat::R8Sint, {kSint8Max, 0, 0, 0}, {kSint8Max, 0, 0, 0}}, + {wgpu::TextureFormat::R8Sint, {kSint8Max + 1, 0, 0, 0}, {kSint8Max, 0, 0, 0}}, + {wgpu::TextureFormat::RG8Sint, {kSint8Min, kSint8Max, 0, 0}, {kSint8Min, kSint8Max, 0, 0}}, + {wgpu::TextureFormat::RG8Sint, + {kSint8Min - 1, kSint8Max + 1, 0, 0}, + {kSint8Min, kSint8Max, 0, 0}}, + {wgpu::TextureFormat::RGBA8Sint, + {kSint8Min - 1, kSint8Min, kSint8Max, kSint8Max + 1}, + {kSint8Min, kSint8Min, kSint8Max, kSint8Max}}, + }}; + + for (const TestCase& testCase : kTestCases) { + auto [format, clearColor, expectedPixelValue] = testCase; + TestClearColor(format, clearColor, expectedPixelValue); + } +} + +// Test clearing a color attachment on Uint16 formats (R16Uint, RG16Uint, RGBA16Uint) when the clear +// values are out of bound. +TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Uint16) { + constexpr uint32_t kUint16Max = std::numeric_limits::max(); + + using TestCase = std::tuple>; + constexpr std::array kTestCases = {{ + {wgpu::TextureFormat::R16Uint, {-1, 0, 0, 0}, {0, 0, 0, 0}}, + {wgpu::TextureFormat::R16Uint, {0, 0, 0, 0}, {0, 0, 0, 0}}, + {wgpu::TextureFormat::R16Uint, {kUint16Max, 0, 0, 0}, {kUint16Max, 0, 0, 0}}, + {wgpu::TextureFormat::R16Uint, {kUint16Max + 1, 0, 0, 0}, {kUint16Max, 0, 0, 0}}, + {wgpu::TextureFormat::RG16Uint, {0, kUint16Max, 0, 0}, {0, kUint16Max, 0, 0}}, + {wgpu::TextureFormat::RG16Uint, {-1, kUint16Max + 1, 0, 0}, {0, kUint16Max, 0, 0}}, + {wgpu::TextureFormat::RGBA16Uint, + {-1, 0, kUint16Max, kUint16Max + 1}, + {0, 0, kUint16Max, kUint16Max}}, + }}; + + for (const TestCase& testCase : kTestCases) { + auto [format, clearColor, expectedPixelValue] = testCase; + TestClearColor(format, clearColor, expectedPixelValue); + } +} + +// Test clearing a color attachment on Sint16 formats (R16Sint, RG16Sint, RGBA16Sint) when the clear +// values are out of bound. +TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Sint16) { + constexpr int32_t kSint16Max = std::numeric_limits::max(); + constexpr int32_t kSint16Min = std::numeric_limits::min(); + + using TestCase = std::tuple>; + constexpr std::array kTestCases = {{ + {wgpu::TextureFormat::R16Sint, {kSint16Min - 1, 0, 0, 0}, {kSint16Min, 0, 0, 0}}, + {wgpu::TextureFormat::R16Sint, {kSint16Min, 0, 0, 0}, {kSint16Min, 0, 0, 0}}, + {wgpu::TextureFormat::R16Sint, {kSint16Max, 0, 0, 0}, {kSint16Max, 0, 0, 0}}, + {wgpu::TextureFormat::R16Sint, {kSint16Max + 1, 0, 0, 0}, {kSint16Max, 0, 0, 0}}, + {wgpu::TextureFormat::RG16Sint, + {kSint16Min, kSint16Max, 0, 0}, + {kSint16Min, kSint16Max, 0, 0}}, + {wgpu::TextureFormat::RG16Sint, + {kSint16Min - 1, kSint16Max + 1, 0, 0}, + {kSint16Min, kSint16Max, 0, 0}}, + {wgpu::TextureFormat::RGBA16Sint, + {kSint16Min - 1, kSint16Min, kSint16Max, kSint16Max + 1}, + {kSint16Min, kSint16Min, kSint16Max, kSint16Max}}, + }}; + + for (const TestCase& testCase : kTestCases) { + auto [format, clearColor, expectedPixelValue] = testCase; + TestClearColor(format, clearColor, expectedPixelValue); + } +} + +// Test clearing a color attachment on Uint32 formats (R32Uint, RG32Uint, RGBA32Uint) when the clear +// values are out of bound. +TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Uint32) { + constexpr uint64_t kUint32Max = std::numeric_limits::max(); + + using TestCase = std::tuple>; + constexpr std::array kTestCases = {{ + {wgpu::TextureFormat::R32Uint, {-1, 0, 0, 0}, {0, 0, 0, 0}}, + {wgpu::TextureFormat::R32Uint, {0, 0, 0, 0}, {0, 0, 0, 0}}, + {wgpu::TextureFormat::R32Uint, {kUint32Max, 0, 0, 0}, {kUint32Max, 0, 0, 0}}, + {wgpu::TextureFormat::R32Uint, {kUint32Max + 1, 0, 0, 0}, {kUint32Max, 0, 0, 0}}, + {wgpu::TextureFormat::RG32Uint, {0, kUint32Max, 0, 0}, {0, kUint32Max, 0, 0}}, + {wgpu::TextureFormat::RG32Uint, {-1, kUint32Max + 1, 0, 0}, {0, kUint32Max, 0, 0}}, + {wgpu::TextureFormat::RGBA32Uint, + {-1, 0, kUint32Max, kUint32Max + 1}, + {0, 0, kUint32Max, kUint32Max}}, + }}; + + for (const TestCase& testCase : kTestCases) { + auto [format, clearColor, expectedPixelValue] = testCase; + TestClearColor(format, clearColor, expectedPixelValue); + } +} + +// Test clearing a color attachment on Sint32 formats (R32Sint, RG32Sint, RGBA32Sint) when the clear +// values are out of bound. +TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Sint32) { + constexpr int64_t kSint32Max = std::numeric_limits::max(); + constexpr int64_t kSint32Min = std::numeric_limits::min(); + + using TestCase = std::tuple>; + constexpr std::array kTestCases = {{ + {wgpu::TextureFormat::R32Sint, {kSint32Min - 1, 0, 0, 0}, {kSint32Min, 0, 0, 0}}, + {wgpu::TextureFormat::R32Sint, {kSint32Min, 0, 0, 0}, {kSint32Min, 0, 0, 0}}, + {wgpu::TextureFormat::R32Sint, {kSint32Max, 0, 0, 0}, {kSint32Max, 0, 0, 0}}, + {wgpu::TextureFormat::R32Sint, {kSint32Max + 1, 0, 0, 0}, {kSint32Max, 0, 0, 0}}, + {wgpu::TextureFormat::RG32Sint, + {kSint32Min, kSint32Max, 0, 0}, + {kSint32Min, kSint32Max, 0, 0}}, + {wgpu::TextureFormat::RG32Sint, + {kSint32Min - 1, kSint32Max + 1, 0, 0}, + {kSint32Min, kSint32Max, 0, 0}}, + {wgpu::TextureFormat::RGBA32Sint, + {kSint32Min - 1, kSint32Min, kSint32Max, kSint32Max + 1}, + {kSint32Min, kSint32Min, kSint32Max, kSint32Max}}, + }}; + + for (const TestCase& testCase : kTestCases) { + auto [format, clearColor, expectedPixelValue] = testCase; + TestClearColor(format, clearColor, expectedPixelValue); + } +} + +// Test clearing a color attachment on normalized formats when the clear values are out of bound. +// Note that we don't test RGBA8Snorm because it doesn't support being used as render attachments in +// current WebGPU SPEC. +TEST_P(RenderPassLoadOpTests, LoadOpClearNormalizedFormatsOutOfBound) { + // RGBA8Unorm + { + constexpr wgpu::Color kClearColor = {-0.1f, 0, 1, 1.1f}; + constexpr std::array kExpectedPixelValue = {0, 0, 255u, 255u}; + TestClearColor(wgpu::TextureFormat::RGBA8Unorm, kClearColor, kExpectedPixelValue); + } + + // RGB10A2Unorm - Test components RGB + { + constexpr wgpu::Color kClearColor = {-0.1f, 0, 1.1f, 1}; + constexpr std::array kExpectedPixelValue = {0, 0, 0xF0u, 0xFFu}; + TestClearColor(wgpu::TextureFormat::RGB10A2Unorm, kClearColor, + kExpectedPixelValue); + } + + // RGB10A2Unorm - Test component A < 0 + { + constexpr wgpu::Color kClearColor = {0, 0, 0, -0.1f}; + constexpr std::array kExpectedPixelValue = {0, 0, 0, 0}; + TestClearColor(wgpu::TextureFormat::RGB10A2Unorm, kClearColor, + kExpectedPixelValue); + } + + // RGB10A2Unorm - Test component A > 1 + { + constexpr wgpu::Color kClearColor = {0, 0, 0, 1.1f}; + constexpr std::array kExpectedPixelValue = {0, 0, 0, 0xC0u}; + TestClearColor(wgpu::TextureFormat::RGB10A2Unorm, kClearColor, + kExpectedPixelValue); + } +} + +// Test clearing multiple color attachments with different big integers can still work correctly. +TEST_P(RenderPassLoadOpTests, LoadOpClearWithBigInt32ValuesOnMultipleColorAttachments) { + constexpr int32_t kMaxInt32RepresentableInFloat = 1 << std::numeric_limits::digits; + constexpr int32_t kMinInt32RepresentableInFloat = -kMaxInt32RepresentableInFloat; + + using TestCase = std::tuple>; + + constexpr std::array kTestCases = {{ + {wgpu::TextureFormat::R32Sint, + {kMaxInt32RepresentableInFloat, 0, 0, 0}, + {kMaxInt32RepresentableInFloat, 0, 0, 0}}, + {wgpu::TextureFormat::R32Sint, + {kMaxInt32RepresentableInFloat + 1, 0, 0, 0}, + {kMaxInt32RepresentableInFloat + 1, 0, 0, 0}}, + {wgpu::TextureFormat::R32Sint, + {kMinInt32RepresentableInFloat, 0, 0, 0}, + {kMinInt32RepresentableInFloat, 0, 0, 0}}, + {wgpu::TextureFormat::R32Sint, + {kMinInt32RepresentableInFloat - 1, 0, 0, 0}, + {kMinInt32RepresentableInFloat - 1, 0, 0, 0}}, + {wgpu::TextureFormat::RG32Sint, + {kMaxInt32RepresentableInFloat, kMaxInt32RepresentableInFloat + 1, 0, 0}, + {kMaxInt32RepresentableInFloat, kMaxInt32RepresentableInFloat + 1, 0, 0}}, + {wgpu::TextureFormat::RG32Sint, + {kMinInt32RepresentableInFloat, kMinInt32RepresentableInFloat - 1, 0, 0}, + {kMinInt32RepresentableInFloat, kMinInt32RepresentableInFloat - 1, 0, 0}}, + {wgpu::TextureFormat::RGBA32Sint, + {kMaxInt32RepresentableInFloat, kMinInt32RepresentableInFloat, + kMaxInt32RepresentableInFloat + 1, kMinInt32RepresentableInFloat - 1}, + {kMaxInt32RepresentableInFloat, kMinInt32RepresentableInFloat, + kMaxInt32RepresentableInFloat + 1, kMinInt32RepresentableInFloat - 1}}, + {wgpu::TextureFormat::RGBA32Sint, + {kMaxInt32RepresentableInFloat, kMinInt32RepresentableInFloat, + kMaxInt32RepresentableInFloat - 1, kMinInt32RepresentableInFloat + 1}, + {kMaxInt32RepresentableInFloat, kMinInt32RepresentableInFloat, + kMaxInt32RepresentableInFloat - 1, kMinInt32RepresentableInFloat + 1}}, + }}; + + std::array textures; + + wgpu::TextureDescriptor textureDescriptor = {}; + textureDescriptor.size = {1, 1, 1}; + textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment; + + std::array colorAttachmentsInfo; + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { + textureDescriptor.format = std::get<0>(kTestCases[i]); + textures[i] = device.CreateTexture(&textureDescriptor); + + colorAttachmentsInfo[i].view = textures[i].CreateView(); + colorAttachmentsInfo[i].loadOp = wgpu::LoadOp::Clear; + colorAttachmentsInfo[i].storeOp = wgpu::StoreOp::Store; + colorAttachmentsInfo[i].clearValue = std::get<1>(kTestCases[i]); + } + + wgpu::RenderPassDescriptor renderPassDescriptor = {}; + renderPassDescriptor.colorAttachmentCount = kMaxColorAttachments; + renderPassDescriptor.colorAttachments = colorAttachmentsInfo.data(); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.End(); + + std::array outputBuffers; + for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { + wgpu::BufferDescriptor bufferDescriptor = {}; + bufferDescriptor.size = sizeof(int32_t) * 4; + bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + outputBuffers[i] = device.CreateBuffer(&bufferDescriptor); + + wgpu::ImageCopyTexture imageCopyTexture = + utils::CreateImageCopyTexture(textures[i], 0, {0, 0, 0}); + wgpu::ImageCopyBuffer imageCopyBuffer = + utils::CreateImageCopyBuffer(outputBuffers[i], 0, kTextureBytesPerRowAlignment); + encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &textureDescriptor.size); + } + + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + + for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { + const uint8_t* expected = + reinterpret_cast(std::get<2>(kTestCases[i]).data()); + EXPECT_BUFFER_U8_RANGE_EQ(expected, outputBuffers[i], 0, + sizeof(std::get<2>(kTestCases[i]))); + } +} + +// Test clearing multiple color attachments with different big unsigned integers can still work +// correctly. +TEST_P(RenderPassLoadOpTests, LoadOpClearWithBigUInt32ValuesOnMultipleColorAttachments) { + constexpr int32_t kMaxUInt32RepresentableInFloat = 1 << std::numeric_limits::digits; + + using TestCase = std::tuple>; + + std::array testColorForRGBA32Float = { + kMaxUInt32RepresentableInFloat, kMaxUInt32RepresentableInFloat - 1, + kMaxUInt32RepresentableInFloat - 2, kMaxUInt32RepresentableInFloat - 3}; + std::array expectedDataForRGBA32Float; + for (uint32_t i = 0; i < expectedDataForRGBA32Float.size(); ++i) { + expectedDataForRGBA32Float[i] = *(reinterpret_cast(&testColorForRGBA32Float[i])); + } + + const std::array kTestCases = {{ + {wgpu::TextureFormat::R32Uint, + {kMaxUInt32RepresentableInFloat, 0, 0, 0}, + {kMaxUInt32RepresentableInFloat, 0, 0, 0}}, + {wgpu::TextureFormat::R32Uint, + {kMaxUInt32RepresentableInFloat + 1, 0, 0, 0}, + {kMaxUInt32RepresentableInFloat + 1, 0, 0, 0}}, + {wgpu::TextureFormat::RG32Uint, + {kMaxUInt32RepresentableInFloat, kMaxUInt32RepresentableInFloat, 0, 0}, + {kMaxUInt32RepresentableInFloat, kMaxUInt32RepresentableInFloat, 0, 0}}, + {wgpu::TextureFormat::RG32Uint, + {kMaxUInt32RepresentableInFloat, kMaxUInt32RepresentableInFloat + 1, 0, 0}, + {kMaxUInt32RepresentableInFloat, kMaxUInt32RepresentableInFloat + 1, 0, 0}}, + {wgpu::TextureFormat::RGBA32Uint, + {kMaxUInt32RepresentableInFloat, kMaxUInt32RepresentableInFloat + 1, + kMaxUInt32RepresentableInFloat - 1, kMaxUInt32RepresentableInFloat - 2}, + {kMaxUInt32RepresentableInFloat, kMaxUInt32RepresentableInFloat + 1, + kMaxUInt32RepresentableInFloat - 1, kMaxUInt32RepresentableInFloat - 2}}, + {wgpu::TextureFormat::RGBA32Sint, + {kMaxUInt32RepresentableInFloat, kMaxUInt32RepresentableInFloat - 1, + kMaxUInt32RepresentableInFloat - 2, kMaxUInt32RepresentableInFloat - 3}, + {static_cast(kMaxUInt32RepresentableInFloat), + static_cast(kMaxUInt32RepresentableInFloat - 1), + static_cast(kMaxUInt32RepresentableInFloat - 2), + static_cast(kMaxUInt32RepresentableInFloat - 3)}}, + {wgpu::TextureFormat::RGBA32Float, + {kMaxUInt32RepresentableInFloat, kMaxUInt32RepresentableInFloat - 1, + kMaxUInt32RepresentableInFloat - 2, kMaxUInt32RepresentableInFloat - 3}, + expectedDataForRGBA32Float}, + {wgpu::TextureFormat::Undefined, + {kMaxUInt32RepresentableInFloat + 1, kMaxUInt32RepresentableInFloat + 1, 0, 0}, + {0, 0, 0, 0}}, + }}; + + std::array textures; + + wgpu::TextureDescriptor textureDescriptor = {}; + textureDescriptor.size = {1, 1, 1}; + textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment; + + std::array colorAttachmentsInfo; + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { + wgpu::TextureFormat format = std::get<0>(kTestCases[i]); + if (format == wgpu::TextureFormat::Undefined) { + textures[i] = nullptr; + colorAttachmentsInfo[i].view = nullptr; + continue; + } + + textureDescriptor.format = format; + textures[i] = device.CreateTexture(&textureDescriptor); + + colorAttachmentsInfo[i].view = textures[i].CreateView(); + colorAttachmentsInfo[i].loadOp = wgpu::LoadOp::Clear; + colorAttachmentsInfo[i].storeOp = wgpu::StoreOp::Store; + colorAttachmentsInfo[i].clearValue = std::get<1>(kTestCases[i]); + } + + wgpu::RenderPassDescriptor renderPassDescriptor = {}; + renderPassDescriptor.colorAttachmentCount = kMaxColorAttachments; + renderPassDescriptor.colorAttachments = colorAttachmentsInfo.data(); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.End(); + + std::array outputBuffers; + for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { + wgpu::TextureFormat format = std::get<0>(kTestCases[i]); + if (format == wgpu::TextureFormat::Undefined) { + continue; + } + + wgpu::BufferDescriptor bufferDescriptor = {}; + bufferDescriptor.size = sizeof(int32_t) * 4; + bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + outputBuffers[i] = device.CreateBuffer(&bufferDescriptor); + + wgpu::ImageCopyTexture imageCopyTexture = + utils::CreateImageCopyTexture(textures[i], 0, {0, 0, 0}); + wgpu::ImageCopyBuffer imageCopyBuffer = + utils::CreateImageCopyBuffer(outputBuffers[i], 0, kTextureBytesPerRowAlignment); + encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &textureDescriptor.size); + } + + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + + for (uint32_t i = 0; i < kMaxColorAttachments - 1; ++i) { + const uint8_t* expected = + reinterpret_cast(std::get<2>(kTestCases[i]).data()); + EXPECT_BUFFER_U8_RANGE_EQ(expected, outputBuffers[i], 0, + sizeof(std::get<2>(kTestCases[i]))); + } +} + +// Test using LoadOp::Clear with different big unsigned integers as clearValues and LoadOp::Load on +// the other color attachments in one render pass encoder works correctly. +TEST_P(RenderPassLoadOpTests, MixedUseOfLoadOpLoadAndLoadOpClearWithBigIntegerValues) { + constexpr int32_t kMaxUInt32RepresentableInFloat = 1 << std::numeric_limits::digits; + + wgpu::TextureDescriptor textureDescriptor = {}; + textureDescriptor.size = {1, 1, 1}; + textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment; + textureDescriptor.format = wgpu::TextureFormat::R32Uint; + + wgpu::Texture textureForLoad = device.CreateTexture(&textureDescriptor); + wgpu::Texture textureForClear = device.CreateTexture(&textureDescriptor); + + constexpr uint32_t kExpectedLoadValue = 2u; + // Initialize textureForLoad with pixel value 2u. + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassForInit({textureForLoad.CreateView()}); + renderPassForInit.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear; + renderPassForInit.cColorAttachments[0].clearValue = {kExpectedLoadValue, 0, 0, 0}; + wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassForInit); + renderPassEncoder.End(); + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + } + + // Then set the load operation to Load while we still set the clear color to a big integer value + // that cannot be represented by float. + constexpr uint32_t kExpectedClearValue = kMaxUInt32RepresentableInFloat + 1; + wgpu::Buffer outputBuffer; + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassForClear( + {textureForLoad.CreateView(), textureForClear.CreateView()}); + renderPassForClear.cColorAttachments[0].loadOp = wgpu::LoadOp::Load; + renderPassForClear.cColorAttachments[0].clearValue = {kExpectedClearValue, 0, 0, 0}; + renderPassForClear.cColorAttachments[1].loadOp = wgpu::LoadOp::Clear; + renderPassForClear.cColorAttachments[1].clearValue = {kExpectedClearValue, 0, 0, 0}; + wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassForClear); + renderPassEncoder.End(); + + wgpu::BufferDescriptor bufferDescriptor = {}; + bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + bufferDescriptor.size = 2 * sizeof(uint32_t); + outputBuffer = device.CreateBuffer(&bufferDescriptor); + + wgpu::ImageCopyTexture imageCopyTextureForLoad = + utils::CreateImageCopyTexture(textureForLoad, 0, {0, 0, 0}); + wgpu::ImageCopyBuffer imageCopyBufferForLoad = + utils::CreateImageCopyBuffer(outputBuffer, 0, kTextureBytesPerRowAlignment); + encoder.CopyTextureToBuffer(&imageCopyTextureForLoad, &imageCopyBufferForLoad, + &textureDescriptor.size); + + wgpu::ImageCopyTexture imageCopyTextureForClear = + utils::CreateImageCopyTexture(textureForClear, 0, {0, 0, 0}); + wgpu::ImageCopyBuffer imageCopyBufferForClear = utils::CreateImageCopyBuffer( + outputBuffer, sizeof(uint32_t), kTextureBytesPerRowAlignment); + encoder.CopyTextureToBuffer(&imageCopyTextureForClear, &imageCopyBufferForClear, + &textureDescriptor.size); + + wgpu::CommandBuffer commandBuffer = encoder.Finish(); + queue.Submit(1, &commandBuffer); + } + + constexpr std::array kExpectedData = {kExpectedLoadValue, kExpectedClearValue}; + EXPECT_BUFFER_U32_RANGE_EQ(kExpectedData.data(), outputBuffer, 0, kExpectedData.size()); +} + DAWN_INSTANTIATE_TEST(RenderPassLoadOpTests, D3D12Backend(), MetalBackend(), diff --git a/src/dawn/tests/end2end/RenderPassTests.cpp b/src/dawn/tests/end2end/RenderPassTests.cpp index adf093e24b..d6606acc54 100644 --- a/src/dawn/tests/end2end/RenderPassTests.cpp +++ b/src/dawn/tests/end2end/RenderPassTests.cpp @@ -27,7 +27,7 @@ class RenderPassTest : public DawnTest { // Shaders to draw a bottom-left triangle in blue. mVSModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -38,7 +38,7 @@ class RenderPassTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 1.0, 1.0); })"); @@ -107,11 +107,11 @@ TEST_P(RenderPassTest, TwoRenderPassesInOneCommandBuffer) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kBlue, renderTarget1, 1, kRTSize - 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderTarget1, kRTSize - 1, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kBlue, renderTarget1, 1, kRTSize - 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, renderTarget1, kRTSize - 1, 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kBlue, renderTarget2, 1, kRTSize - 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderTarget2, kRTSize - 1, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kBlue, renderTarget2, 1, kRTSize - 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderTarget2, kRTSize - 1, 1); } // Verify that the content in the color attachment will not be changed if there is no corresponding @@ -138,7 +138,7 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) { { // Next we use a pipeline whose fragment shader has no outputs. wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor descriptor; descriptor.vertex.module = mVSModule; @@ -159,8 +159,8 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kBlue, renderTarget, 1, kRTSize - 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderTarget, kRTSize - 1, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kBlue, renderTarget, 1, kRTSize - 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, renderTarget, kRTSize - 1, 1); } class RenderPassTest_RegressionDawn1071 : public RenderPassTest {}; diff --git a/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp b/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp index 1e5a91ed75..1ab423900e 100644 --- a/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp +++ b/src/dawn/tests/end2end/SamplerFilterAnisotropicTests.cpp @@ -28,7 +28,8 @@ namespace { // each mipmap of the texture is having a different color // so we can check if the sampler anisotropic filtering is fetching // from the correct miplevel -const std::array colors = {RGBA8::kRed, RGBA8::kGreen, RGBA8::kBlue}; +const std::array colors = {utils::RGBA8::kRed, utils::RGBA8::kGreen, + utils::RGBA8::kBlue}; } // namespace class SamplerFilterAnisotropicTest : public DawnTest { @@ -54,7 +55,7 @@ class SamplerFilterAnisotropicTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.uv = input.uv; @@ -71,7 +72,7 @@ class SamplerFilterAnisotropicTest : public DawnTest { @builtin(position) fragCoord : vec4, } - @stage(fragment) + @fragment fn main(input : FragmentIn) -> @location(0) vec4 { return textureSample(texture0, sampler0, input.uv); })"); @@ -111,7 +112,7 @@ class SamplerFilterAnisotropicTest : public DawnTest { descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding; wgpu::Texture texture = device.CreateTexture(&descriptor); - const uint32_t rowPixels = kTextureBytesPerRowAlignment / sizeof(RGBA8); + const uint32_t rowPixels = kTextureBytesPerRowAlignment / sizeof(utils::RGBA8); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -120,11 +121,12 @@ class SamplerFilterAnisotropicTest : public DawnTest { const uint32_t texWidth = textureWidthLevel0 >> level; const uint32_t texHeight = textureHeightLevel0 >> level; - const RGBA8 color = colors[level]; + const utils::RGBA8 color = colors[level]; - std::vector data(rowPixels * texHeight, color); - wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( - device, data.data(), data.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc); + std::vector data(rowPixels * texHeight, color); + wgpu::Buffer stagingBuffer = + utils::CreateBufferFromData(device, data.data(), data.size() * sizeof(utils::RGBA8), + wgpu::BufferUsage::CopySrc); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(stagingBuffer, 0, kTextureBytesPerRowAlignment); wgpu::ImageCopyTexture imageCopyTexture = diff --git a/src/dawn/tests/end2end/SamplerTests.cpp b/src/dawn/tests/end2end/SamplerTests.cpp index 3ad38ecade..e6de979fbf 100644 --- a/src/dawn/tests/end2end/SamplerTests.cpp +++ b/src/dawn/tests/end2end/SamplerTests.cpp @@ -56,7 +56,7 @@ class SamplerTest : public DawnTest { mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); auto vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-2.0, -2.0), @@ -72,7 +72,7 @@ class SamplerTest : public DawnTest { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSample(texture0, sampler0, FragCoord.xy / vec2(2.0, 2.0)); })"); @@ -97,13 +97,14 @@ class SamplerTest : public DawnTest { wgpu::Texture texture = device.CreateTexture(&descriptor); // Create a 2x2 checkerboard texture, with black in the top left and bottom right corners. - const uint32_t rowPixels = kTextureBytesPerRowAlignment / sizeof(RGBA8); - std::array pixels; - pixels[0] = pixels[rowPixels + 1] = RGBA8::kBlack; - pixels[1] = pixels[rowPixels] = RGBA8::kWhite; + const uint32_t rowPixels = kTextureBytesPerRowAlignment / sizeof(utils::RGBA8); + std::array pixels; + pixels[0] = pixels[rowPixels + 1] = utils::RGBA8::kBlack; + pixels[1] = pixels[rowPixels] = utils::RGBA8::kWhite; - wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( - device, pixels.data(), pixels.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc); + wgpu::Buffer stagingBuffer = + utils::CreateBufferFromData(device, pixels.data(), pixels.size() * sizeof(utils::RGBA8), + wgpu::BufferUsage::CopySrc); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(stagingBuffer, 0, 256); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0}); @@ -146,14 +147,14 @@ class SamplerTest : public DawnTest { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 expectedU2(u.mExpected2, u.mExpected2, u.mExpected2, 255); - RGBA8 expectedU3(u.mExpected3, u.mExpected3, u.mExpected3, 255); - RGBA8 expectedV2(v.mExpected2, v.mExpected2, v.mExpected2, 255); - RGBA8 expectedV3(v.mExpected3, v.mExpected3, v.mExpected3, 255); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kBlack, mRenderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kWhite, mRenderPass.color, 0, 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kWhite, mRenderPass.color, 1, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kBlack, mRenderPass.color, 1, 1); + utils::RGBA8 expectedU2(u.mExpected2, u.mExpected2, u.mExpected2, 255); + utils::RGBA8 expectedU3(u.mExpected3, u.mExpected3, u.mExpected3, 255); + utils::RGBA8 expectedV2(v.mExpected2, v.mExpected2, v.mExpected2, 255); + utils::RGBA8 expectedV3(v.mExpected3, v.mExpected3, v.mExpected3, 255); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kBlack, mRenderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kWhite, mRenderPass.color, 0, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kWhite, mRenderPass.color, 1, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kBlack, mRenderPass.color, 1, 1); EXPECT_PIXEL_RGBA8_EQ(expectedU2, mRenderPass.color, 2, 0); EXPECT_PIXEL_RGBA8_EQ(expectedU3, mRenderPass.color, 3, 0); EXPECT_PIXEL_RGBA8_EQ(expectedV2, mRenderPass.color, 0, 2); diff --git a/src/dawn/tests/end2end/ScissorTests.cpp b/src/dawn/tests/end2end/ScissorTests.cpp index a66044097b..03e8c56f08 100644 --- a/src/dawn/tests/end2end/ScissorTests.cpp +++ b/src/dawn/tests/end2end/ScissorTests.cpp @@ -21,7 +21,7 @@ class ScissorTest : public DawnTest { protected: wgpu::RenderPipeline CreateQuadPipeline(wgpu::TextureFormat format) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -34,7 +34,7 @@ class ScissorTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -63,10 +63,10 @@ TEST_P(ScissorTest, DefaultsToWholeRenderTarget) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 99); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 99, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 99, 99); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 0, 99); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 99, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 99, 99); } // Test setting a partial scissor (not empty, not full attachment) @@ -92,11 +92,11 @@ TEST_P(ScissorTest, PartialRect) { queue.Submit(1, &commands); // Test the two opposite corners of the scissor box. With one pixel inside and on outside - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, kX - 1, kY - 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, kX, kY); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, kX - 1, kY - 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, kX, kY); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, kX + kW, kY + kH); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, kX + kW - 1, kY + kH - 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, kX + kW, kY + kH); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, kX + kW - 1, kY + kH - 1); } // Test setting an empty scissor @@ -117,10 +117,10 @@ TEST_P(ScissorTest, EmptyRect) { queue.Submit(1, &commands); // Test that no pixel was written. - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 0, 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 1, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 0, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 1, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 1, 1); } // Test that the scissor setting doesn't get inherited between renderpasses TEST_P(ScissorTest, NoInheritanceBetweenRenderPass) { @@ -145,10 +145,10 @@ TEST_P(ScissorTest, NoInheritanceBetweenRenderPass) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 99); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 99, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 99, 99); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 0, 99); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 99, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 99, 99); } DAWN_INSTANTIATE_TEST(ScissorTest, diff --git a/src/dawn/tests/end2end/ShaderTests.cpp b/src/dawn/tests/end2end/ShaderTests.cpp index a2b159f8cc..82159953ae 100644 --- a/src/dawn/tests/end2end/ShaderTests.cpp +++ b/src/dawn/tests/end2end/ShaderTests.cpp @@ -56,7 +56,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { let factor : f32 = 1.0001; buf.data[0] = u32(log2(1.0 * factor)); @@ -115,7 +115,7 @@ I am an invalid shader and should never pass validation! // can compile and link successfully. TEST_P(ShaderTests, WGSLParamIO) { std::string vertexShader = R"( -@stage(vertex) +@vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -126,7 +126,7 @@ fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4) -> @location(0) vec4 { return vec4(fragCoord.xy, 0.0, 1.0); })"; @@ -152,7 +152,7 @@ struct VertexOut { @builtin(position) position : vec4, } -@stage(vertex) +@vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(input.position, 1.0); @@ -162,7 +162,7 @@ fn main(input : VertexIn) -> VertexOut { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexShader.c_str()); std::string fragmentShader = R"( -@stage(fragment) +@fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })"; @@ -195,7 +195,7 @@ struct VertexOut { @builtin(position) position : vec4, } -@stage(vertex) +@vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(input.position, 1.0); @@ -210,7 +210,7 @@ struct FragmentIn { @builtin(position) fragCoord : vec4, } -@stage(fragment) +@fragment fn main(input : FragmentIn) -> @location(0) vec4 { return input.color * input.fragCoord; })"; @@ -242,7 +242,7 @@ struct VertexOut { @location(0) color : vec4, } -@stage(vertex) +@vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(input.position, 1.0); @@ -257,7 +257,7 @@ struct FragmentIn { @builtin(position) fragCoord : vec4, } -@stage(fragment) +@fragment fn main(input : FragmentIn) -> @location(0) vec4 { return input.color * input.fragCoord; })"; @@ -289,7 +289,7 @@ struct VertexOut { @builtin(position) position : vec4, } -@stage(vertex) +@vertex fn vertexMain(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(input.position, 1.0); @@ -297,7 +297,7 @@ fn vertexMain(input : VertexIn) -> VertexOut { return output; } -@stage(fragment) +@fragment fn fragmentMain(input : VertexOut) -> @location(0) vec4 { return input.color; })"; @@ -338,12 +338,12 @@ struct Inputs { struct S1 { data : array, 20> } @group(0) @binding(1) var providedData1 : S1; -@stage(vertex) fn vsMain(input : Inputs) -> @builtin(position) vec4 { +@vertex fn vsMain(input : Inputs) -> @builtin(position) vec4 { _ = providedData1.data[input.vertexIndex][0]; return vec4(); } -@stage(fragment) fn fsMain() -> @location(0) vec4 { +@fragment fn fsMain() -> @location(0) vec4 { return vec4(); } )"; @@ -364,14 +364,18 @@ struct S1 { data : array, 20> } // Test that WGSL built-in variable @sample_index can be used in fragment shaders. TEST_P(ShaderTests, SampleIndex) { + // TODO(crbug.com/dawn/673): Work around or enforce via validation that sample variables are not + // supported on some platforms. + DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_sample_variables")); + wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( -@stage(vertex) +@vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( -@stage(fragment) fn main(@builtin(sample_index) sampleIndex : u32) +@fragment fn main(@builtin(sample_index) sampleIndex : u32) -> @location(0) vec4 { return vec4(f32(sampleIndex), 1.0, 0.0, 1.0); })"); @@ -418,7 +422,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { buf.data[0] = u32(c0); buf.data[1] = u32(c1); buf.data[2] = u32(c2); @@ -488,7 +492,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { buf.data[0] = c1; buf.data[1] = c2; buf.data[2] = c3; @@ -545,7 +549,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { buf.data[0] = c1; buf.data[1] = c2; })"; @@ -599,15 +603,15 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main1() { +@compute @workgroup_size(1) fn main1() { buf.data[0] = c1; } -@stage(compute) @workgroup_size(1) fn main2() { +@compute @workgroup_size(1) fn main2() { buf.data[0] = c2; } -@stage(compute) @workgroup_size(1) fn main3() { +@compute @workgroup_size(1) fn main3() { buf.data[0] = 3u; } )"; @@ -683,7 +687,7 @@ TEST_P(ShaderTests, OverridableConstantsRenderPipeline) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @id(1111) override xright: f32; @id(2222) override ytop: f32; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( @@ -696,7 +700,7 @@ fn main(@builtin(vertex_index) VertexIndex : u32) wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @id(1000) override intensity: f32 = 0.0; -@stage(fragment) fn main() +@fragment fn main() -> @location(0) vec4 { return vec4(intensity, intensity, intensity, 1.0); })"); @@ -729,7 +733,36 @@ fn main(@builtin(vertex_index) VertexIndex : u32) wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(255, 255, 255, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(255, 255, 255, 255), renderPass.color, 0, 0); +} + +// This is a regression test for crbug.com/dawn:1363 where the BindingRemapper transform was run +// before the SingleEntryPoint transform, causing one of the other entry points to have conflicting +// bindings. +TEST_P(ShaderTests, ConflictingBindingsDueToTransformOrder) { + wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( + @group(0) @binding(0) var b0 : u32; + @group(0) @binding(1) var b1 : u32; + + @vertex fn vertex() -> @builtin(position) vec4 { + _ = b0; + return vec4(0.0); + } + + @fragment fn fragment() -> @location(0) vec4 { + _ = b0; + _ = b1; + return vec4(0.0); + } + )"); + + utils::ComboRenderPipelineDescriptor desc; + desc.vertex.module = module; + desc.vertex.entryPoint = "vertex"; + desc.cFragment.module = module; + desc.cFragment.entryPoint = "fragment"; + + device.CreateRenderPipeline(&desc); } // TODO(tint:1155): Test overridable constants used for workgroup size diff --git a/src/dawn/tests/end2end/StorageTextureTests.cpp b/src/dawn/tests/end2end/StorageTextureTests.cpp index 058e108d3f..482b20209d 100644 --- a/src/dawn/tests/end2end/StorageTextureTests.cpp +++ b/src/dawn/tests/end2end/StorageTextureTests.cpp @@ -142,8 +142,9 @@ class StorageTextureTests : public DawnTest { // 8-bit (normalized/non-normalized signed/unsigned integer) 4-component formats case wgpu::TextureFormat::RGBA8Unorm: case wgpu::TextureFormat::RGBA8Uint: { - RGBA8* valuePtr = static_cast(pixelValuePtr); - *valuePtr = RGBA8(pixelValue, pixelValue * 2, pixelValue * 3, pixelValue * 4); + utils::RGBA8* valuePtr = static_cast(pixelValuePtr); + *valuePtr = + utils::RGBA8(pixelValue, pixelValue * 2, pixelValue * 3, pixelValue * 4); break; } @@ -337,7 +338,7 @@ fn IsEqualTo(pixel : vec4, expected : vec4) -> bool { std::ostringstream ostream; ostream << GetImageDeclaration(format, "write", dimension, 0) << "\n"; - ostream << "@stage(" << stage << ")" << workgroupSize << "\n"; + ostream << "@" << stage << workgroupSize << "\n"; ostream << "fn main() "; if (isFragment) { ostream << "-> @location(0) vec4 "; @@ -488,7 +489,7 @@ fn IsEqualTo(pixel : vec4, expected : vec4) -> bool { queue.Submit(1, &commandBuffer); // Check if the contents in the output texture are all as expected (green). - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, outputTexture, 0, 0) + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, outputTexture, 0, 0) << "\nVertex Shader:\n" << vertexShader << "\n\nFragment Shader:\n" << fragmentShader; @@ -648,7 +649,7 @@ fn IsEqualTo(pixel : vec4, expected : vec4) -> bool { const char* kSimpleVertexShader = R"( ; -@stage(vertex) fn main() -> @builtin(position) vec4 { +@vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"; @@ -696,6 +697,9 @@ TEST_P(StorageTextureTests, WriteonlyStorageTextureInFragmentShader) { // NVidia OpenGLES drivers. DAWN_SUPPRESS_TEST_IF(IsNvidia() && IsLinux() && IsOpenGLES()); + // TODO(crbug.com/dawn/1503): Investigate the regression in ANGLE that causes the test failure. + DAWN_SUPPRESS_TEST_IF(IsANGLE()); + for (wgpu::TextureFormat format : utils::kAllTextureFormats) { if (!utils::TextureFormatSupportsStorageTexture(format)) { continue; @@ -799,7 +803,7 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var Src : texture_2d; @group(0) @binding(1) var Dst : texture_storage_2d; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { var srcValue : vec4 = textureLoad(Src, vec2(0, 0), 0); srcValue.x = srcValue.x + 1u; textureStore(Dst, vec2(0, 0), srcValue); @@ -898,14 +902,14 @@ fn doTest() -> bool { const char* kCommonWriteOnlyZeroInitTestCodeFragment = R"( @group(0) @binding(0) var dstImage : texture_storage_2d; -@stage(fragment) fn main() -> @location(0) vec4 { +@fragment fn main() -> @location(0) vec4 { textureStore(dstImage, vec2(0, 0), vec4(1u, 0u, 0u, 1u)); return vec4(); })"; const char* kCommonWriteOnlyZeroInitTestCodeCompute = R"( @group(0) @binding(0) var dstImage : texture_storage_2d; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { textureStore(dstImage, vec2(0, 0), vec4(1u, 0u, 0u, 1u)); })"; }; @@ -913,6 +917,9 @@ fn doTest() -> bool { // Verify that the texture is correctly cleared to 0 before its first usage as a write-only storage // storage texture in a render pass. TEST_P(StorageTextureZeroInitTests, WriteonlyStorageTextureClearsToZeroInRenderPass) { + // TODO(crbug.com/dawn/1503): Investigate the regression in ANGLE that causes the test failure. + DAWN_SUPPRESS_TEST_IF(IsANGLE()); + // Prepare the write-only storage texture. wgpu::Texture writeonlyStorageTexture = CreateTexture( wgpu::TextureFormat::R32Uint, diff --git a/src/dawn/tests/end2end/SubresourceRenderAttachmentTests.cpp b/src/dawn/tests/end2end/SubresourceRenderAttachmentTests.cpp index bcb16c734e..078dc095b9 100644 --- a/src/dawn/tests/end2end/SubresourceRenderAttachmentTests.cpp +++ b/src/dawn/tests/end2end/SubresourceRenderAttachmentTests.cpp @@ -39,7 +39,7 @@ class SubresourceRenderAttachmentTest : public DawnTest { renderTargetViewDesc.mipLevelCount = 1; wgpu::TextureView renderTargetView = renderTarget.CreateView(&renderTargetViewDesc); - RGBA8 expectedColor(0, 255, 0, 255); + utils::RGBA8 expectedColor(0, 255, 0, 255); float expectedDepth = 0.3f; uint8_t expectedStencil = 7; @@ -81,7 +81,8 @@ class SubresourceRenderAttachmentTest : public DawnTest { const uint32_t renderTargetSize = textureSize >> baseMipLevel; switch (type) { case Type::Color: { - std::vector expected(renderTargetSize * renderTargetSize, expectedColor); + std::vector expected(renderTargetSize * renderTargetSize, + expectedColor); EXPECT_TEXTURE_EQ(expected.data(), renderTarget, {0, 0, baseArrayLayer}, {renderTargetSize, renderTargetSize}, baseMipLevel); break; @@ -168,6 +169,9 @@ TEST_P(SubresourceRenderAttachmentTest, StencilTexture) { // on some Intel drivers. DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel()); + // TODO(crbug.com/dawn/1497): glReadPixels: GL error: HIGH: Invalid format and type combination. + DAWN_SUPPRESS_TEST_IF(IsANGLE()); + DoTest(Type::Stencil); } diff --git a/src/dawn/tests/end2end/SwapChainTests.cpp b/src/dawn/tests/end2end/SwapChainTests.cpp index c55330d7a2..b5dab3151b 100644 --- a/src/dawn/tests/end2end/SwapChainTests.cpp +++ b/src/dawn/tests/end2end/SwapChainTests.cpp @@ -16,8 +16,8 @@ #include "dawn/common/Constants.h" #include "dawn/common/Log.h" -#include "dawn/utils/GLFWUtils.h" #include "dawn/utils/WGPUHelpers.h" +#include "webgpu/webgpu_glfw.h" #include "GLFW/glfw3.h" @@ -37,10 +37,7 @@ class SwapChainTests : public DawnTest { GTEST_SKIP(); } - // The SwapChainTests don't create OpenGL contexts so we don't need to call - // SetupGLFWWindowHintsForBackend. Set GLFW_NO_API anyway to avoid GLFW bringing up a GL - // context that we won't use. - ASSERT_TRUE(!IsOpenGL()); + // Set GLFW_NO_API to avoid GLFW bringing up a GL context that we won't use. glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); window = glfwCreateWindow(400, 400, "SwapChainValidationTests window", nullptr, nullptr); @@ -48,7 +45,7 @@ class SwapChainTests : public DawnTest { int height; glfwGetFramebufferSize(window, &width, &height); - surface = utils::CreateSurfaceForWindow(GetInstance(), window); + surface = wgpu::glfw::CreateSurfaceForWindow(GetInstance(), window); ASSERT_NE(surface, nullptr); baseDescriptor.width = width; diff --git a/src/dawn/tests/end2end/SwapChainValidationTests.cpp b/src/dawn/tests/end2end/SwapChainValidationTests.cpp index 534e95cb08..b02d760f14 100644 --- a/src/dawn/tests/end2end/SwapChainValidationTests.cpp +++ b/src/dawn/tests/end2end/SwapChainValidationTests.cpp @@ -17,8 +17,8 @@ #include "dawn/common/Constants.h" #include "dawn/common/Log.h" #include "dawn/utils/ComboRenderPipelineDescriptor.h" -#include "dawn/utils/GLFWUtils.h" #include "dawn/utils/WGPUHelpers.h" +#include "webgpu/webgpu_glfw.h" #include "GLFW/glfw3.h" @@ -34,14 +34,11 @@ class SwapChainValidationTests : public DawnTest { }); DAWN_TEST_UNSUPPORTED_IF(!glfwInit()); - // The SwapChainValidationTests don't create devices so we don't need to call - // SetupGLFWWindowHintsForBackend. Set GLFW_NO_API anyway to avoid GLFW bringing up a GL - // context that we won't use. - ASSERT_TRUE(!IsOpenGL()); + // Set GLFW_NO_API to avoid GLFW bringing up a GL context that we won't use. glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); window = glfwCreateWindow(400, 400, "SwapChainValidationTests window", nullptr, nullptr); - surface = utils::CreateSurfaceForWindow(GetInstance(), window); + surface = wgpu::glfw::CreateSurfaceForWindow(GetInstance(), window); ASSERT_NE(surface, nullptr); goodDescriptor.width = 1; @@ -109,6 +106,15 @@ TEST_P(SwapChainValidationTests, CreationSuccess) { swapchain.Present(); } +// Test that creating a swapchain with an invalid surface is an error. +TEST_P(SwapChainValidationTests, InvalidSurface) { + wgpu::SurfaceDescriptor surface_desc = {}; + wgpu::Surface surface = GetInstance().CreateSurface(&surface_desc); + + ASSERT_DEVICE_ERROR_MSG(device.CreateSwapChain(surface, &goodDescriptor), + testing::HasSubstr("[Surface] is invalid")); +} + // Checks that the creation size must be a valid 2D texture size. TEST_P(SwapChainValidationTests, InvalidCreationSize) { wgpu::Limits supportedLimits = GetSupportedLimits().limits; @@ -219,7 +225,7 @@ TEST_P(SwapChainValidationTests, ViewDestroyedAfterPresent) { TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) { utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @@ -227,7 +233,7 @@ TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) { @location(0) target0 : vec4, @location(1) target1 : f32, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var out : FragmentOut; out.target0 = vec4(0.0, 1.0, 0.0, 1.0); out.target1 = 0.5; diff --git a/src/dawn/tests/end2end/Texture3DTests.cpp b/src/dawn/tests/end2end/Texture3DTests.cpp index 9472087aad..e1fb29665f 100644 --- a/src/dawn/tests/end2end/Texture3DTests.cpp +++ b/src/dawn/tests/end2end/Texture3DTests.cpp @@ -30,7 +30,7 @@ TEST_P(Texture3DTests, Sampling) { // Set up pipeline. Two triangles will be drawn via the pipeline. They will fill the entire // color attachment with data sampled from 3D texture. wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, 1.0), @@ -47,7 +47,7 @@ TEST_P(Texture3DTests, Sampling) { @group(0) @binding(0) var samp : sampler; @group(0) @binding(1) var tex : texture_3d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSample(tex, samp, vec3(FragCoord.xy / 4.0, 1.5 / 4.0)); })"); @@ -77,12 +77,12 @@ TEST_P(Texture3DTests, Sampling) { utils::RequiredBytesInCopy(bytesPerRow, copySize.height, copySize, kFormat); const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(kFormat); uint32_t size = sizeInBytes / bytesPerTexel; - std::vector data = std::vector(size); + std::vector data = std::vector(size); for (uint32_t z = 0; z < copySize.depthOrArrayLayers; ++z) { for (uint32_t y = 0; y < copySize.height; ++y) { for (uint32_t x = 0; x < copySize.width; ++x) { uint32_t i = (z * copySize.height + y) * bytesPerRow / bytesPerTexel + x; - data[i] = RGBA8(x, y, z, 255); + data[i] = utils::RGBA8(x, y, z, 255); } } } @@ -112,7 +112,7 @@ TEST_P(Texture3DTests, Sampling) { // in shader, so the expected color at coordinate(x, y) should be (x, y, 1, 255). for (uint32_t i = 0; i < kRTSize; ++i) { for (uint32_t j = 0; j < kRTSize; ++j) { - EXPECT_PIXEL_RGBA8_EQ(RGBA8(i, j, 1, 255), renderPass.color, i, j); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(i, j, 1, 255), renderPass.color, i, j); } } } diff --git a/src/dawn/tests/end2end/TextureCorruptionTests.cpp b/src/dawn/tests/end2end/TextureCorruptionTests.cpp new file mode 100644 index 0000000000..13a265b983 --- /dev/null +++ b/src/dawn/tests/end2end/TextureCorruptionTests.cpp @@ -0,0 +1,279 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "dawn/common/Math.h" +#include "dawn/tests/DawnTest.h" +#include "dawn/utils/ComboRenderPipelineDescriptor.h" +#include "dawn/utils/WGPUHelpers.h" + +// 2D array textures with particular dimensions may corrupt on some devices. This test creates some +// 2d-array textures with different dimensions, and test them one by one. For each sub-test, the +// tested texture is written via different methods, then read back from the texture and verify the +// data. + +constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm; + +namespace { +enum class WriteType { + WriteTexture, // Write the tested texture via writeTexture API + B2TCopy, // Write the tested texture via B2T copy + RenderConstant, // Write the tested texture via rendering the whole rectangle with solid color + // (0xFFFFFFFF) + RenderFromTextureSample, // Write the tested texture via sampling from a temp texture and + // writing the sampled data + RenderFromTextureLoad // Write the tested texture via textureLoad() from a temp texture and + // writing the loaded data +}; + +std::ostream& operator<<(std::ostream& o, WriteType writeType) { + switch (writeType) { + case WriteType::WriteTexture: + o << "WriteTexture"; + break; + case WriteType::B2TCopy: + o << "B2TCopy"; + break; + case WriteType::RenderConstant: + o << "RenderConstant"; + break; + case WriteType::RenderFromTextureSample: + o << "RenderFromTextureSample"; + break; + case WriteType::RenderFromTextureLoad: + o << "RenderFromTextureLoad"; + break; + } + return o; +} + +using TextureFormat = wgpu::TextureFormat; +using TextureWidth = uint32_t; +using TextureHeight = uint32_t; + +DAWN_TEST_PARAM_STRUCT(TextureCorruptionTestsParams, TextureWidth, TextureHeight, WriteType); + +} // namespace + +class TextureCorruptionTests : public DawnTestWithParams { + protected: + std::ostringstream& DoTest(wgpu::Texture texture, + const wgpu::Extent3D textureSize, + uint32_t depthOrArrayLayer, + uint32_t srcValue) { + uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(kFormat); + uint32_t bytesPerRow = Align(textureSize.width * bytesPerTexel, 256); + uint64_t bufferSize = bytesPerRow * textureSize.height; + wgpu::BufferDescriptor descriptor; + descriptor.size = bufferSize; + descriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + wgpu::Buffer buffer = device.CreateBuffer(&descriptor); + wgpu::Buffer resultBuffer = device.CreateBuffer(&descriptor); + + wgpu::ImageCopyTexture imageCopyTexture = + utils::CreateImageCopyTexture(texture, 0, {0, 0, depthOrArrayLayer}); + wgpu::ImageCopyBuffer imageCopyBuffer = + utils::CreateImageCopyBuffer(buffer, 0, bytesPerRow); + wgpu::ImageCopyBuffer imageCopyResult = + utils::CreateImageCopyBuffer(resultBuffer, 0, bytesPerRow); + + WriteType type = GetParam().mWriteType; + + // Fill data into a buffer + wgpu::Extent3D copySize = {textureSize.width, textureSize.height, 1}; + + // Data is stored in a uint32_t vector, so a single texel may require multiple vector + // elements for some formats + ASSERT(bytesPerTexel = sizeof(uint32_t)); + uint32_t elementNumPerRow = bytesPerRow / sizeof(uint32_t); + uint32_t elementNumInTotal = bufferSize / sizeof(uint32_t); + std::vector data(elementNumInTotal, 0); + for (uint32_t i = 0; i < copySize.height; ++i) { + for (uint32_t j = 0; j < copySize.width; ++j) { + if (type == WriteType::RenderFromTextureSample || + type == WriteType::RenderConstant) { + // Fill a simple and constant value (0xFFFFFFFF) in the whole buffer for + // texture sampling and rendering because either sampling operation will + // lead to precision loss or rendering a solid color is easier to implement and + // compare. + data[i * elementNumPerRow + j] = 0xFFFFFFFF; + } else { + data[i * elementNumPerRow + j] = srcValue; + srcValue++; + } + } + } + + // Write data into the given layer via various write types + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + switch (type) { + case WriteType::B2TCopy: { + queue.WriteBuffer(buffer, 0, data.data(), bufferSize); + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size); + break; + } + case WriteType::WriteTexture: { + wgpu::TextureDataLayout textureDataLayout = + utils::CreateTextureDataLayout(0, bytesPerRow); + queue.WriteTexture(&imageCopyTexture, data.data(), bufferSize, &textureDataLayout, + ©Size); + break; + } + case WriteType::RenderConstant: + case WriteType::RenderFromTextureSample: + case WriteType::RenderFromTextureLoad: { + // Write data into a single layer temp texture and read from this texture if needed + wgpu::TextureView tempView; + if (type != WriteType::RenderConstant) { + wgpu::Texture tempTexture = Create2DTexture(copySize); + wgpu::ImageCopyTexture imageCopyTempTexture = + utils::CreateImageCopyTexture(tempTexture, 0, {0, 0, 0}); + wgpu::TextureDataLayout textureDataLayout = + utils::CreateTextureDataLayout(0, bytesPerRow); + queue.WriteTexture(&imageCopyTempTexture, data.data(), bufferSize, + &textureDataLayout, ©Size); + tempView = tempTexture.CreateView(); + } + + // Write into the specified layer of a 2D array texture + wgpu::TextureViewDescriptor viewDesc; + viewDesc.format = kFormat; + viewDesc.dimension = wgpu::TextureViewDimension::e2D; + viewDesc.baseMipLevel = 0; + viewDesc.mipLevelCount = 1; + viewDesc.baseArrayLayer = depthOrArrayLayer; + viewDesc.arrayLayerCount = 1; + CreatePipelineAndRender(texture.CreateView(&viewDesc), tempView, encoder, type); + break; + } + default: + break; + } + + // Verify the data in texture via a T2B copy and comparison + encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyResult, ©Size); + wgpu::CommandBuffer commands = encoder.Finish(); + queue.Submit(1, &commands); + return EXPECT_BUFFER_U32_RANGE_EQ(data.data(), resultBuffer, 0, elementNumInTotal); + } + + void CreatePipelineAndRender(wgpu::TextureView renderView, + wgpu::TextureView samplerView, + wgpu::CommandEncoder encoder, + WriteType type) { + utils::ComboRenderPipelineDescriptor pipelineDescriptor; + pipelineDescriptor.cTargets[0].format = kFormat; + + // Draw the whole texture (a rectangle) via two triangles + pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( + @vertex + fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { + var pos = array, 6>( + vec2(-1.0, 1.0), + vec2(-1.0, -1.0), + vec2( 1.0, 1.0), + vec2( 1.0, 1.0), + vec2(-1.0, -1.0), + vec2( 1.0, -1.0)); + return vec4(pos[VertexIndex], 0.0, 1.0); + })"); + + if (type == WriteType::RenderConstant) { + pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( + @fragment + fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { + return vec4(1.0, 1.0, 1.0, 1.0); + })"); + } else if (type == WriteType::RenderFromTextureSample) { + pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( + @group(0) @binding(0) var samp : sampler; + @group(0) @binding(1) var tex : texture_2d; + + @fragment + fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { + return textureSample(tex, samp, FragCoord.xy); + })"); + } else { + pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( + @group(0) @binding(0) var tex : texture_2d; + + @fragment + fn main(@builtin(position) Fragcoord: vec4) -> @location(0) vec4 { + return textureLoad(tex, vec2(Fragcoord.xy), 0); + })"); + } + + wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor); + + utils::ComboRenderPassDescriptor renderPassDescriptor({renderView}); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDescriptor); + pass.SetPipeline(pipeline); + if (type != WriteType::RenderConstant) { + wgpu::BindGroup bindGroup; + if (type == WriteType::RenderFromTextureLoad) { + bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), + {{0, samplerView}}); + } else { + bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), + {{0, device.CreateSampler()}, {1, samplerView}}); + } + pass.SetBindGroup(0, bindGroup); + } + pass.Draw(6); + pass.End(); + } + + wgpu::Texture Create2DTexture(const wgpu::Extent3D size) { + wgpu::TextureDescriptor texDesc = {}; + texDesc.dimension = wgpu::TextureDimension::e2D; + texDesc.size = size; + texDesc.mipLevelCount = 1; + texDesc.format = kFormat; + texDesc.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc | + wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::TextureBinding; + return device.CreateTexture(&texDesc); + } +}; + +TEST_P(TextureCorruptionTests, Tests) { + DAWN_SUPPRESS_TEST_IF(IsWARP()); + uint32_t width = GetParam().mTextureWidth; + uint32_t height = GetParam().mTextureHeight; + uint32_t depthOrArrayLayerCount = 2; + wgpu::Extent3D textureSize = {width, height, depthOrArrayLayerCount}; + + // Pre-allocate textures. The incorrect write type may corrupt neighboring textures or layers. + std::vector textures; + uint32_t texNum = 2; + for (uint32_t i = 0; i < texNum; ++i) { + textures.push_back(Create2DTexture(textureSize)); + } + + // Write data and verify the result one by one for every layer of every texture + uint32_t srcValue = 100000000; + for (uint32_t i = 0; i < texNum; ++i) { + for (uint32_t j = 0; j < depthOrArrayLayerCount; ++j) { + DoTest(textures[i], textureSize, j, srcValue) << "texNum: " << i << ", layer: " << j; + srcValue += 100000000; + } + } +} + +DAWN_INSTANTIATE_TEST_P(TextureCorruptionTests, + {D3D12Backend()}, + {100u, 200u, 300u, 400u, 500u, 600u, 700u, 800u, 900u, 1000u, 1200u}, + {100u, 200u}, + {WriteType::WriteTexture, WriteType::B2TCopy, WriteType::RenderConstant, + WriteType::RenderFromTextureSample, WriteType::RenderFromTextureLoad}); diff --git a/src/dawn/tests/end2end/TextureFormatTests.cpp b/src/dawn/tests/end2end/TextureFormatTests.cpp index 0c7de09638..c0e9a31aec 100644 --- a/src/dawn/tests/end2end/TextureFormatTests.cpp +++ b/src/dawn/tests/end2end/TextureFormatTests.cpp @@ -143,7 +143,7 @@ class TextureFormatTest : public DawnTest { utils::ComboRenderPipelineDescriptor desc; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-3.0, -1.0), @@ -161,7 +161,7 @@ class TextureFormatTest : public DawnTest { fsSource << "struct FragmentOut {\n"; fsSource << " @location(0) color : vec4<" << type << ">\n"; fsSource << R"(} - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> FragmentOut { var output : FragmentOut; output.color = textureLoad(myTexture, vec2(FragCoord.xy), 0); diff --git a/src/dawn/tests/end2end/TextureSubresourceTests.cpp b/src/dawn/tests/end2end/TextureSubresourceTests.cpp index 391d94434d..b6d2aa8978 100644 --- a/src/dawn/tests/end2end/TextureSubresourceTests.cpp +++ b/src/dawn/tests/end2end/TextureSubresourceTests.cpp @@ -50,7 +50,7 @@ class TextureSubresourceTest : public DawnTest { void DrawTriangle(const wgpu::TextureView& view) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec2(-1.0, 1.0), @@ -61,7 +61,7 @@ class TextureSubresourceTest : public DawnTest { })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); @@ -87,7 +87,7 @@ class TextureSubresourceTest : public DawnTest { void SampleAndDraw(const wgpu::TextureView& samplerView, const wgpu::TextureView& renderView) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -104,7 +104,7 @@ class TextureSubresourceTest : public DawnTest { @group(0) @binding(0) var samp : sampler; @group(0) @binding(1) var tex : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> @location(0) vec4 { return textureSample(tex, samp, FragCoord.xy / vec2(4.0, 4.0)); })"); @@ -156,8 +156,8 @@ TEST_P(TextureSubresourceTest, MipmapLevelsTest) { // Verify that pixel at bottom-left corner is red, while pixel at top-right corner is background // black in render view (mip level 1). - RGBA8 topRight = RGBA8::kBlack; - RGBA8 bottomLeft = RGBA8::kRed; + utils::RGBA8 topRight = utils::RGBA8::kBlack; + utils::RGBA8 bottomLeft = utils::RGBA8::kRed; EXPECT_TEXTURE_EQ(&topRight, texture, {kSize / 2 - 1, 0}, {1, 1}, 1); EXPECT_TEXTURE_EQ(&bottomLeft, texture, {0, kSize / 2 - 1}, {1, 1}, 1); } @@ -182,8 +182,8 @@ TEST_P(TextureSubresourceTest, ArrayLayersTest) { // Verify that pixel at bottom-left corner is red, while pixel at top-right corner is background // black in render view (array layer 1). - RGBA8 topRight = RGBA8::kBlack; - RGBA8 bottomLeft = RGBA8::kRed; + utils::RGBA8 topRight = utils::RGBA8::kBlack; + utils::RGBA8 bottomLeft = utils::RGBA8::kRed; EXPECT_TEXTURE_EQ(&topRight, texture, {kSize - 1, 0, 1}, {1, 1}); EXPECT_TEXTURE_EQ(&bottomLeft, texture, {0, kSize - 1, 1}, {1, 1}); } diff --git a/src/dawn/tests/end2end/TextureViewTests.cpp b/src/dawn/tests/end2end/TextureViewTests.cpp index 2ad6cd032d..d30b6f1490 100644 --- a/src/dawn/tests/end2end/TextureViewTests.cpp +++ b/src/dawn/tests/end2end/TextureViewTests.cpp @@ -68,7 +68,7 @@ wgpu::ShaderModule CreateDefaultVertexShaderModule(wgpu::Device device) { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var output : VertexOut; var pos = array, 6>( @@ -140,9 +140,9 @@ class TextureViewSamplingTest : public DawnTest { // Create a texture with pixel = (0, 0, 0, level * 10 + layer + 1) at level `level` and // layer `layer`. - static_assert((kTextureBytesPerRowAlignment % sizeof(RGBA8)) == 0, + static_assert((kTextureBytesPerRowAlignment % sizeof(utils::RGBA8)) == 0, "Texture bytes per row alignment must be a multiple of sizeof(RGBA8)."); - constexpr uint32_t kPixelsPerRowPitch = kTextureBytesPerRowAlignment / sizeof(RGBA8); + constexpr uint32_t kPixelsPerRowPitch = kTextureBytesPerRowAlignment / sizeof(utils::RGBA8); ASSERT_LE(textureWidthLevel0, kPixelsPerRowPitch); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -154,9 +154,11 @@ class TextureViewSamplingTest : public DawnTest { const int pixelValue = GenerateTestPixelValue(layer, level); constexpr uint32_t kPaddedTexWidth = kPixelsPerRowPitch; - std::vector data(kPaddedTexWidth * texHeight, RGBA8(0, 0, 0, pixelValue)); + std::vector data(kPaddedTexWidth * texHeight, + utils::RGBA8(0, 0, 0, pixelValue)); wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( - device, data.data(), data.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc); + device, data.data(), data.size() * sizeof(utils::RGBA8), + wgpu::BufferUsage::CopySrc); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(stagingBuffer, 0, kTextureBytesPerRowAlignment); wgpu::ImageCopyTexture imageCopyTexture = @@ -194,7 +196,7 @@ class TextureViewSamplingTest : public DawnTest { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - RGBA8 expectedPixel(0, 0, 0, expected); + utils::RGBA8 expectedPixel(0, 0, 0, expected); EXPECT_PIXEL_RGBA8_EQ(expectedPixel, mRenderPass.color, 0, 0); EXPECT_PIXEL_RGBA8_EQ(expectedPixel, mRenderPass.color, mRenderPass.width - 1, mRenderPass.height - 1); @@ -222,7 +224,7 @@ class TextureViewSamplingTest : public DawnTest { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord); } @@ -258,7 +260,7 @@ class TextureViewSamplingTest : public DawnTest { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d_array; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord, 0) + textureSample(texture0, sampler0, texCoord, 1) + @@ -293,7 +295,7 @@ class TextureViewSamplingTest : public DawnTest { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : )" << textureType << R"(; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { var sc : f32 = 2.0 * texCoord.x - 1.0; var tc : f32 = 2.0 * texCoord.y - 1.0; @@ -367,7 +369,7 @@ TEST_P(TextureViewSamplingTest, Default2DArrayTexture) { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d_array; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord, 0) + textureSample(texture0, sampler0, texCoord, 1) + @@ -408,7 +410,7 @@ TEST_P(TextureViewSamplingTest, Texture2DArrayViewOnSingleLayer2DTexture) { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture0 : texture_2d_array; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(texture0, sampler0, texCoord, 0); } @@ -453,24 +455,24 @@ TEST_P(TextureViewSamplingTest, SRGBReinterpretation) { wgpu::ImageCopyTexture dst = {}; dst.texture = texture; - std::array rgbaTextureData = { - RGBA8(180, 0, 0, 255), - RGBA8(0, 84, 0, 127), - RGBA8(0, 0, 62, 100), - RGBA8(62, 180, 84, 90), + std::array rgbaTextureData = { + utils::RGBA8(180, 0, 0, 255), + utils::RGBA8(0, 84, 0, 127), + utils::RGBA8(0, 0, 62, 100), + utils::RGBA8(62, 180, 84, 90), }; wgpu::TextureDataLayout dataLayout = {}; - dataLayout.bytesPerRow = textureDesc.size.width * sizeof(RGBA8); + dataLayout.bytesPerRow = textureDesc.size.width * sizeof(utils::RGBA8); - queue.WriteTexture(&dst, rgbaTextureData.data(), rgbaTextureData.size() * sizeof(RGBA8), + queue.WriteTexture(&dst, rgbaTextureData.data(), rgbaTextureData.size() * sizeof(utils::RGBA8), &dataLayout, &textureDesc.size); wgpu::TextureView textureView = texture.CreateView(&viewDesc); utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -485,7 +487,7 @@ TEST_P(TextureViewSamplingTest, SRGBReinterpretation) { pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) coord: vec4) -> @location(0) vec4 { return textureLoad(texture, vec2(coord.xy), 0); } @@ -512,18 +514,18 @@ TEST_P(TextureViewSamplingTest, SRGBReinterpretation) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(116, 0, 0, 255), // - RGBA8(117, 0, 0, 255), renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(0, 23, 0, 127), // - RGBA8(0, 24, 0, 127), renderPass.color, 1, 0); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(0, 0, 12, 100), // - RGBA8(0, 0, 13, 100), renderPass.color, 0, 1); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(12, 116, 23, 90), // - RGBA8(13, 117, 24, 90), renderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(116, 0, 0, 255), // + utils::RGBA8(117, 0, 0, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(0, 23, 0, 127), // + utils::RGBA8(0, 24, 0, 127), renderPass.color, 1, 0); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(0, 0, 12, 100), // + utils::RGBA8(0, 0, 13, 100), renderPass.color, 0, 1); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(12, 116, 23, 90), // + utils::RGBA8(13, 117, 24, 90), renderPass.color, 1, 1); } // Test sampling from a cube map texture view that covers a whole 2D array texture. @@ -552,20 +554,12 @@ TEST_P(TextureViewSamplingTest, TextureCubeMapArrayOnWholeTexture) { // Test sampling from a cube map texture array view that covers a sub part of a 2D array texture. TEST_P(TextureViewSamplingTest, TextureCubeMapArrayViewOnPartOfTexture) { - // Test failing on the GPU FYI Mac Pro (AMD), see - // https://bugs.chromium.org/p/dawn/issues/detail?id=58 - DAWN_SUPPRESS_TEST_IF(IsMacOS() && IsMetal() && IsAMD()); - TextureCubeMapTest(20, 3, 12, true); } // Test sampling from a cube map texture array view that covers the last layer of a 2D array // texture. TEST_P(TextureViewSamplingTest, TextureCubeMapArrayViewCoveringLastLayer) { - // Test failing on the GPU FYI Mac Pro (AMD), see - // https://bugs.chromium.org/p/dawn/issues/detail?id=58 - DAWN_SUPPRESS_TEST_IF(IsMacOS() && IsMetal() && IsAMD()); - constexpr uint32_t kTotalLayers = 20; constexpr uint32_t kBaseLayer = 8; TextureCubeMapTest(kTotalLayers, kBaseLayer, kTotalLayers - kBaseLayer, true); @@ -573,10 +567,6 @@ TEST_P(TextureViewSamplingTest, TextureCubeMapArrayViewCoveringLastLayer) { // Test sampling from a cube map array texture view that only has a single cube map. TEST_P(TextureViewSamplingTest, TextureCubeMapArrayViewSingleCubeMap) { - // Test failing on the GPU FYI Mac Pro (AMD), see - // https://bugs.chromium.org/p/dawn/issues/detail?id=58 - DAWN_SUPPRESS_TEST_IF(IsMacOS() && IsMetal() && IsAMD()); - TextureCubeMapTest(20, 7, 6, true); } @@ -615,7 +605,7 @@ class TextureViewRenderingTest : public DawnTest { renderPassInfo.cColorAttachments[0].clearValue = {1.0f, 0.0f, 0.0f, 1.0f}; const char* oneColorFragmentShader = R"( - @stage(fragment) fn main(@location(0) texCoord : vec2) -> + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); } @@ -648,8 +638,8 @@ class TextureViewRenderingTest : public DawnTest { Align(kBytesPerTexel * textureWidthLevel0, kTextureBytesPerRowAlignment); uint32_t expectedDataSize = bytesPerRow / kBytesPerTexel * (textureWidthLevel0 - 1) + textureHeightLevel0; - constexpr RGBA8 kExpectedPixel(0, 255, 0, 255); - std::vector expected(expectedDataSize, kExpectedPixel); + constexpr utils::RGBA8 kExpectedPixel(0, 255, 0, 255); + std::vector expected(expectedDataSize, kExpectedPixel); EXPECT_TEXTURE_EQ(expected.data(), texture, {0, 0, textureViewBaseLayer}, {textureViewWidth, textureViewHeight}, textureViewBaseLevel); } @@ -792,11 +782,11 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretationRenderAttachment) { wgpu::Texture sampledTexture = device.CreateTexture(&textureDesc); // Initial non-SRGB data to upload to |sampledTexture|. - std::array rgbaTextureData = { - RGBA8(117, 0, 0, 255), - RGBA8(0, 23, 0, 127), - RGBA8(0, 0, 12, 100), - RGBA8(13, 117, 24, 90), + std::array rgbaTextureData = { + utils::RGBA8(117, 0, 0, 255), + utils::RGBA8(0, 23, 0, 127), + utils::RGBA8(0, 0, 12, 100), + utils::RGBA8(13, 117, 24, 90), }; wgpu::ImageCopyTexture dst = {}; @@ -804,8 +794,8 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretationRenderAttachment) { // Upload |rgbaTextureData| into |sampledTexture|. dst.texture = sampledTexture; - dataLayout.bytesPerRow = textureDesc.size.width * sizeof(RGBA8); - queue.WriteTexture(&dst, rgbaTextureData.data(), rgbaTextureData.size() * sizeof(RGBA8), + dataLayout.bytesPerRow = textureDesc.size.width * sizeof(utils::RGBA8); + queue.WriteTexture(&dst, rgbaTextureData.data(), rgbaTextureData.size() * sizeof(utils::RGBA8), &dataLayout, &textureDesc.size); // View both the attachment as SRGB. @@ -814,7 +804,7 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretationRenderAttachment) { // Create a render pipeline to blit |sampledTexture| into |textureView|. utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -829,7 +819,7 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretationRenderAttachment) { pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) coord: vec4) -> @location(0) vec4 { return textureLoad(texture, vec2(coord.xy), 0); } @@ -858,18 +848,18 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretationRenderAttachment) { // Check the results. This is the sRGB encoding for the same non-SRGB colors // represented by |initialData|. - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(180, 0, 0, 255), // - RGBA8(181, 0, 0, 255), texture, 0, 0); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(0, 85, 0, 127), // - RGBA8(0, 86, 0, 127), texture, 1, 0); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(0, 0, 61, 100), // - RGBA8(0, 0, 62, 100), texture, 0, 1); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(64, 180, 86, 90), // - RGBA8(15, 181, 87, 90), texture, 1, 1); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(180, 0, 0, 255), // + utils::RGBA8(181, 0, 0, 255), texture, 0, 0); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(0, 85, 0, 127), // + utils::RGBA8(0, 86, 0, 127), texture, 1, 0); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(0, 0, 61, 100), // + utils::RGBA8(0, 0, 62, 100), texture, 0, 1); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(64, 180, 86, 90), // + utils::RGBA8(15, 181, 87, 90), texture, 1, 1); } // Test that an RGBA8 texture may be interpreted as RGBA8UnormSrgb and resolved to. @@ -905,11 +895,11 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretionResolveAttachment) { wgpu::Texture sampledTexture = device.CreateTexture(&textureDesc); // Initial non-SRGB data to upload to |sampledTexture|. - std::array rgbaTextureData = { - RGBA8(117, 0, 0, 255), - RGBA8(0, 23, 0, 127), - RGBA8(0, 0, 12, 100), - RGBA8(13, 117, 24, 90), + std::array rgbaTextureData = { + utils::RGBA8(117, 0, 0, 255), + utils::RGBA8(0, 23, 0, 127), + utils::RGBA8(0, 0, 12, 100), + utils::RGBA8(13, 117, 24, 90), }; wgpu::ImageCopyTexture dst = {}; @@ -917,8 +907,8 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretionResolveAttachment) { // Upload |rgbaTextureData| into |sampledTexture|. dst.texture = sampledTexture; - dataLayout.bytesPerRow = textureDesc.size.width * sizeof(RGBA8); - queue.WriteTexture(&dst, rgbaTextureData.data(), rgbaTextureData.size() * sizeof(RGBA8), + dataLayout.bytesPerRow = textureDesc.size.width * sizeof(utils::RGBA8); + queue.WriteTexture(&dst, rgbaTextureData.data(), rgbaTextureData.size() * sizeof(utils::RGBA8), &dataLayout, &textureDesc.size); // View both the multisampled texture and the resolve texture as SRGB. @@ -928,7 +918,7 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretionResolveAttachment) { // Create a render pipeline to blit |sampledTexture| into |multisampledTextureView|. utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -943,7 +933,7 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretionResolveAttachment) { pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) coord: vec4) -> @location(0) vec4 { return textureLoad(texture, vec2(coord.xy), 0); } @@ -974,18 +964,18 @@ TEST_P(TextureViewRenderingTest, SRGBReinterpretionResolveAttachment) { // Check the results. This is the sRGB encoding for the same non-SRGB colors // represented by |initialData|. - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(180, 0, 0, 255), // - RGBA8(181, 0, 0, 255), resolveTexture, 0, 0); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(0, 85, 0, 127), // - RGBA8(0, 86, 0, 127), resolveTexture, 1, 0); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(0, 0, 61, 100), // - RGBA8(0, 0, 62, 100), resolveTexture, 0, 1); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(64, 180, 86, 90), // - RGBA8(15, 181, 87, 90), resolveTexture, 1, 1); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(180, 0, 0, 255), // + utils::RGBA8(181, 0, 0, 255), resolveTexture, 0, 0); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(0, 85, 0, 127), // + utils::RGBA8(0, 86, 0, 127), resolveTexture, 1, 0); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(0, 0, 61, 100), // + utils::RGBA8(0, 0, 62, 100), resolveTexture, 0, 1); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(64, 180, 86, 90), // + utils::RGBA8(15, 181, 87, 90), resolveTexture, 1, 1); } DAWN_INSTANTIATE_TEST(TextureViewSamplingTest, @@ -1070,14 +1060,15 @@ TEST_P(TextureView1DTest, Sampling) { texDesc.size = {4, 1, 1}; wgpu::Texture tex = device.CreateTexture(&texDesc); - std::array data = {RGBA8::kGreen, RGBA8::kRed, RGBA8::kBlue, RGBA8::kWhite}; + std::array data = {utils::RGBA8::kGreen, utils::RGBA8::kRed, + utils::RGBA8::kBlue, utils::RGBA8::kWhite}; wgpu::ImageCopyTexture target = utils::CreateImageCopyTexture(tex, 0, {}); wgpu::TextureDataLayout layout = utils::CreateTextureDataLayout(0, wgpu::kCopyStrideUndefined); queue.WriteTexture(&target, &data, sizeof(data), &layout, &texDesc.size); // Create a pipeline that will sample from the 1D texture and output to an attachment. wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn vs(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 3>( vec4( 0., 2., 0., 1.), @@ -1088,7 +1079,7 @@ TEST_P(TextureView1DTest, Sampling) { @group(0) @binding(0) var tex : texture_1d; @group(0) @binding(1) var samp : sampler; - @stage(fragment) + @fragment fn fs(@builtin(position) pos: vec4) -> @location(0) vec4 { return textureSample(tex, samp, pos.x / 4.0); } diff --git a/src/dawn/tests/end2end/TextureZeroInitTests.cpp b/src/dawn/tests/end2end/TextureZeroInitTests.cpp index aa303579fb..85c2893f96 100644 --- a/src/dawn/tests/end2end/TextureZeroInitTests.cpp +++ b/src/dawn/tests/end2end/TextureZeroInitTests.cpp @@ -72,7 +72,7 @@ class TextureZeroInitTest : public DawnTest { pipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest(depth); const char* fs = R"( ; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"; @@ -85,7 +85,7 @@ class TextureZeroInitTest : public DawnTest { } wgpu::ShaderModule CreateBasicVertexShaderForTest(float depth = 0.f) { std::string source = R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -106,7 +106,7 @@ class TextureZeroInitTest : public DawnTest { struct FragmentOut { @location(0) color : vec4 } - @stage(fragment) + @fragment fn main(@builtin(position) FragCoord : vec4) -> FragmentOut { var output : FragmentOut; output.color = textureLoad(texture0, vec2(FragCoord.xy), 0); @@ -134,7 +134,7 @@ TEST_P(TextureZeroInitTest, CopyTextureToBufferSource) { wgpu::Texture texture = device.CreateTexture(&descriptor); // Texture's first usage is in EXPECT_PIXEL_RGBA8_EQ's call to CopyTextureToBuffer - RGBA8 filledWithZeros(0, 0, 0, 0); + utils::RGBA8 filledWithZeros(0, 0, 0, 0); EXPECT_LAZY_CLEAR(1u, EXPECT_PIXEL_RGBA8_EQ(filledWithZeros, texture, 0, 0)); // Expect texture subresource initialized to be true @@ -176,7 +176,7 @@ TEST_P(TextureZeroInitTest, CopyMultipleTextureArrayLayersToBufferSource) { EXPECT_TRUE( dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, kArrayLayers)); - const std::vector kExpectedAllZero(kSize * kSize, {0, 0, 0, 0}); + const std::vector kExpectedAllZero(kSize * kSize, {0, 0, 0, 0}); for (uint32_t layer = 0; layer < kArrayLayers; ++layer) { EXPECT_TEXTURE_EQ(kExpectedAllZero.data(), texture, {0, 0, layer}, {kSize, kSize}); } @@ -217,7 +217,7 @@ TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) { EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); uint32_t mipSize = kSize >> 2; - std::vector expected(mipSize * mipSize, {0, 0, 0, 0}); + std::vector expected(mipSize * mipSize, {0, 0, 0, 0}); EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {0, 0, baseArrayLayer}, {mipSize, mipSize}, baseMipLevel); @@ -260,7 +260,7 @@ TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) { wgpu::CommandBuffer commands = encoder.Finish(); EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); - std::vector expected(kSize * kSize, {0, 0, 0, 0}); + std::vector expected(kSize * kSize, {0, 0, 0, 0}); EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {0, 0, baseArrayLayer}, {kSize, kSize}, baseMipLevel); @@ -293,7 +293,7 @@ TEST_P(TextureZeroInitTest, CopyBufferToTexture) { wgpu::CommandBuffer commands = encoder.Finish(); EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); - std::vector expected(kSize * kSize, {100, 100, 100, 100}); + std::vector expected(kSize * kSize, {100, 100, 100, 100}); EXPECT_TEXTURE_EQ(expected.data(), texture, {0, 0}, {kSize, kSize}); @@ -325,8 +325,8 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureHalf) { wgpu::CommandBuffer commands = encoder.Finish(); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); - std::vector expected100((kSize / 2) * kSize, {100, 100, 100, 100}); - std::vector expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0}); + std::vector expected100((kSize / 2) * kSize, {100, 100, 100, 100}); + std::vector expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0}); // first half filled with 100, by the buffer data EXPECT_TEXTURE_EQ(expected100.data(), texture, {0, 0}, {kSize / 2, kSize}); // second half should be cleared @@ -367,7 +367,7 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureMultipleArrayLayers) { EXPECT_TRUE(dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, kBaseArrayLayer, kCopyLayerCount)); - const std::vector expected100(kSize * kSize, {100, 100, 100, 100}); + const std::vector expected100(kSize * kSize, {100, 100, 100, 100}); for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) { EXPECT_TEXTURE_EQ(expected100.data(), texture, {0, 0, layer}, {kSize, kSize}); } @@ -399,7 +399,7 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) { wgpu::CommandBuffer commands = encoder.Finish(); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); - std::vector expected(kSize * kSize, {0, 0, 0, 0}); + std::vector expected(kSize * kSize, {0, 0, 0, 0}); EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize}); EXPECT_TEXTURE_EQ(expected.data(), dstTexture, {0, 0}, {kSize, kSize}); @@ -454,8 +454,8 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) { wgpu::CommandBuffer commands = encoder.Finish(); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); - std::vector expectedWithZeros((kSize / 2) * kSize, {0, 0, 0, 0}); - std::vector expectedWith100(kSize * kSize, {100, 100, 100, 100}); + std::vector expectedWithZeros((kSize / 2) * kSize, {0, 0, 0, 0}); + std::vector expectedWith100(kSize * kSize, {100, 100, 100, 100}); EXPECT_TEXTURE_EQ(expectedWith100.data(), srcTexture, {0, 0}, {kSize, kSize}); EXPECT_TEXTURE_EQ(expectedWith100.data(), dstTexture, {0, 0}, {kSize / 2, kSize}); @@ -469,6 +469,9 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) { // This tests the texture with depth attachment and load op load will init depth stencil texture to // 0s. TEST_P(TextureZeroInitTest, RenderingLoadingDepth) { + // TODO(crbug.com/dawn/1423): Investigate why this test fails on Windows Vulkan drivers + DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan()); + wgpu::TextureDescriptor srcDescriptor = CreateTextureDescriptor(1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | @@ -501,7 +504,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepth) { EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commandBuffer)); // Expect the texture to be red because depth test passed. - std::vector expected(kSize * kSize, {255, 0, 0, 255}); + std::vector expected(kSize * kSize, {255, 0, 0, 255}); EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true @@ -511,6 +514,9 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepth) { // This tests the texture with stencil attachment and load op load will init depth stencil texture // to 0s. TEST_P(TextureZeroInitTest, RenderingLoadingStencil) { + // TODO(crbug.com/dawn/1423): Investigate why this test fails on Windows Vulkan drivers + DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan()); + wgpu::TextureDescriptor srcDescriptor = CreateTextureDescriptor(1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | @@ -543,7 +549,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingStencil) { EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commandBuffer)); // Expect the texture to be red because stencil test passed. - std::vector expected(kSize * kSize, {255, 0, 0, 255}); + std::vector expected(kSize * kSize, {255, 0, 0, 255}); EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true @@ -553,6 +559,9 @@ TEST_P(TextureZeroInitTest, RenderingLoadingStencil) { // This tests the texture with depth stencil attachment and load op load will init depth stencil // texture to 0s. TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) { + // TODO(crbug.com/dawn/1423): Investigate why this test fails on Windows Vulkan drivers + DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan()); + wgpu::TextureDescriptor srcDescriptor = CreateTextureDescriptor(1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | @@ -582,7 +591,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) { EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commandBuffer)); // Expect the texture to be red because both depth and stencil tests passed. - std::vector expected(kSize * kSize, {255, 0, 0, 255}); + std::vector expected(kSize * kSize, {255, 0, 0, 255}); EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true @@ -652,7 +661,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) { // Expect the texture to be red because the depth and stencil tests passed. Depth was 0 // and stencil was 2. - std::vector expected(kSize * kSize, {255, 0, 0, 255}); + std::vector expected(kSize * kSize, {255, 0, 0, 255}); EXPECT_TEXTURE_EQ(expected.data(), colorTexture, {0, 0}, {kSize, kSize}); } @@ -726,7 +735,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) { // Expect the texture to be red because both the depth a stencil tests passed. // Depth was 0.7 and stencil was 0 - std::vector expected(kSize * kSize, {255, 0, 0, 255}); + std::vector expected(kSize * kSize, {255, 0, 0, 255}); EXPECT_TEXTURE_EQ(expected.data(), colorTexture, {0, 0}, {kSize, kSize}); } @@ -824,7 +833,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) { // Expect the texture to be red because both the depth a stencil tests passed. // Depth was 0.3 and stencil was 0 - std::vector expected(kSize * kSize, {255, 0, 0, 255}); + std::vector expected(kSize * kSize, {255, 0, 0, 255}); EXPECT_TEXTURE_EQ(expected.data(), colorTexture, {0, 0}, {kSize, kSize}); } } @@ -844,7 +853,7 @@ TEST_P(TextureZeroInitTest, ColorAttachmentsClear) { wgpu::CommandBuffer commands = encoder.Finish(); EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); - std::vector expected(kSize * kSize, {0, 0, 0, 0}); + std::vector expected(kSize * kSize, {0, 0, 0, 0}); EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true @@ -889,7 +898,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) { EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); // Expect the rendered texture to be cleared - std::vector expectedWithZeros(kSize * kSize, {0, 0, 0, 0}); + std::vector expectedWithZeros(kSize * kSize, {0, 0, 0, 0}); EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true @@ -946,8 +955,8 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) { // Expect both subresources to be zero: the sampled one with lazy-clearing and the attachment // because it sampled the lazy-cleared sampled subresource. - EXPECT_TEXTURE_EQ(&RGBA8::kZero, texture, {0, 0, 0}, {1, 1}); - EXPECT_TEXTURE_EQ(&RGBA8::kZero, texture, {0, 0, 1}, {1, 1}); + EXPECT_TEXTURE_EQ(&utils::RGBA8::kZero, texture, {0, 0, 0}, {1, 1}); + EXPECT_TEXTURE_EQ(&utils::RGBA8::kZero, texture, {0, 0, 1}, {1, 1}); // The whole texture is now initialized. EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 2)); @@ -983,7 +992,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) { value : vec4 } @group(0) @binding(1) var result : Result; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { result.value = textureLoad(tex, vec2(0,0), 0); } )"; @@ -1173,7 +1182,7 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) { EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); // Expect the rendered texture to be cleared - std::vector expectedWithZeros(kSize * kSize, {0, 0, 0, 0}); + std::vector expectedWithZeros(kSize * kSize, {0, 0, 0, 0}); EXPECT_LAZY_CLEAR( 1u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0}, {kSize, kSize})); @@ -1227,7 +1236,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencilStoreOpClear) { // The depth stencil test should fail and not draw because the depth stencil texture is // cleared to 1's by using loadOp clear and set values from descriptor. - std::vector expectedBlack(kSize * kSize, {0, 0, 0, 0}); + std::vector expectedBlack(kSize * kSize, {0, 0, 0, 0}); EXPECT_TEXTURE_EQ(expectedBlack.data(), srcTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be false since storeop is clear, sets @@ -1252,7 +1261,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencilStoreOpClear) { // Now the depth stencil test should pass since depth stencil texture is cleared to 0's by // loadop load and uninitialized subresource, so we should have a red square - std::vector expectedRed(kSize * kSize, {255, 0, 0, 255}); + std::vector expectedRed(kSize * kSize, {255, 0, 0, 255}); EXPECT_TEXTURE_EQ(expectedRed.data(), srcTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be false since storeop is clear, sets @@ -1321,7 +1330,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) { // Expect the rendered texture to be cleared since we copied from the uninitialized first // mip. - std::vector expectedWithZeros(kSize * kSize, {0, 0, 0, 0}); + std::vector expectedWithZeros(kSize * kSize, {0, 0, 0, 0}); EXPECT_LAZY_CLEAR( 1u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0}, {kSize, kSize}, 0)); @@ -1330,7 +1339,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) { 0u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), sampleTexture, {0, 0}, {kSize, kSize}, 0)); // Expect the second mip to still be filled with 2. - std::vector expectedWithTwos(mipSize * mipSize, {2, 2, 2, 2}); + std::vector expectedWithTwos(mipSize * mipSize, {2, 2, 2, 2}); EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_EQ(expectedWithTwos.data(), sampleTexture, {0, 0}, {mipSize, mipSize}, 1)); @@ -1402,7 +1411,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) { // Expect the rendered texture to be cleared since we copied from the uninitialized first // array layer. - std::vector expectedWithZeros(kSize * kSize, {0, 0, 0, 0}); + std::vector expectedWithZeros(kSize * kSize, {0, 0, 0, 0}); EXPECT_LAZY_CLEAR( 1u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0, 0}, {kSize, kSize})); @@ -1411,7 +1420,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) { 0u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), sampleTexture, {0, 0, 0}, {kSize, kSize})); // Expect the second array layer to still be filled with 2. - std::vector expectedWithTwos(kSize * kSize, {2, 2, 2, 2}); + std::vector expectedWithTwos(kSize * kSize, {2, 2, 2, 2}); EXPECT_LAZY_CLEAR( 0u, EXPECT_TEXTURE_EQ(expectedWithTwos.data(), sampleTexture, {0, 0, 1}, {kSize, kSize})); @@ -1475,15 +1484,15 @@ TEST_P(TextureZeroInitTest, WriteWholeTexture) { textureDataLayout.bytesPerRow = kSize * kFormatBlockByteSize; textureDataLayout.rowsPerImage = kSize; - std::vector data( + std::vector data( utils::RequiredBytesInCopy(textureDataLayout.bytesPerRow, textureDataLayout.rowsPerImage, copySize, kColorFormat) / - sizeof(RGBA8), + sizeof(utils::RGBA8), {100, 100, 100, 100}); // The write overwrites the whole texture so we don't need to do lazy initialization. EXPECT_LAZY_CLEAR( - 0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8), + 0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(utils::RGBA8), &textureDataLayout, ©Size)); // Expect texture initialized to be true @@ -1510,20 +1519,20 @@ TEST_P(TextureZeroInitTest, WriteTextureHalf) { textureDataLayout.bytesPerRow = kSize * kFormatBlockByteSize / 2; textureDataLayout.rowsPerImage = kSize; - std::vector data( + std::vector data( utils::RequiredBytesInCopy(textureDataLayout.bytesPerRow, textureDataLayout.rowsPerImage, copySize, kColorFormat) / - sizeof(RGBA8), + sizeof(utils::RGBA8), {100, 100, 100, 100}); EXPECT_LAZY_CLEAR( - 1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8), + 1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(utils::RGBA8), &textureDataLayout, ©Size)); // Expect texture initialized to be true EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); - std::vector expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0}); + std::vector expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0}); // first half filled with 100, by the data EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0}, {kSize / 2, kSize}); // second half should be cleared @@ -1549,16 +1558,16 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureArray) { textureDataLayout.bytesPerRow = kSize * kFormatBlockByteSize; textureDataLayout.rowsPerImage = kSize; - std::vector data( + std::vector data( utils::RequiredBytesInCopy(textureDataLayout.bytesPerRow, textureDataLayout.rowsPerImage, copySize, kColorFormat) / - sizeof(RGBA8), + sizeof(utils::RGBA8), {100, 100, 100, 100}); // The write overwrites the whole subresources so we don't need to do lazy initialization on // them. EXPECT_LAZY_CLEAR( - 0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8), + 0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(utils::RGBA8), &textureDataLayout, ©Size)); // Expect texture subresource initialized to be true @@ -1592,21 +1601,21 @@ TEST_P(TextureZeroInitTest, WriteTextureArrayHalf) { textureDataLayout.bytesPerRow = kSize * kFormatBlockByteSize / 2; textureDataLayout.rowsPerImage = kSize; - std::vector data( + std::vector data( utils::RequiredBytesInCopy(textureDataLayout.bytesPerRow, textureDataLayout.rowsPerImage, copySize, kColorFormat) / - sizeof(RGBA8), + sizeof(utils::RGBA8), {100, 100, 100, 100}); EXPECT_LAZY_CLEAR( - 1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8), + 1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(utils::RGBA8), &textureDataLayout, ©Size)); // Expect texture subresource initialized to be true EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( texture.Get(), 0, 1, kBaseArrayLayer, kCopyLayerCount)); - std::vector expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0}); + std::vector expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0}); for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) { // first half filled with 100, by the data EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0, layer}, {kSize / 2, kSize}); @@ -1633,15 +1642,15 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureAtMipLevel) { textureDataLayout.bytesPerRow = kMipSize * kFormatBlockByteSize; textureDataLayout.rowsPerImage = kMipSize; - std::vector data( + std::vector data( utils::RequiredBytesInCopy(textureDataLayout.bytesPerRow, textureDataLayout.rowsPerImage, copySize, kColorFormat) / - sizeof(RGBA8), + sizeof(utils::RGBA8), {100, 100, 100, 100}); // The write overwrites the whole texture so we don't need to do lazy initialization. EXPECT_LAZY_CLEAR( - 0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8), + 0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(utils::RGBA8), &textureDataLayout, ©Size)); // Expect texture initialized to be true @@ -1672,21 +1681,21 @@ TEST_P(TextureZeroInitTest, WriteTextureHalfAtMipLevel) { textureDataLayout.bytesPerRow = kMipSize * kFormatBlockByteSize / 2; textureDataLayout.rowsPerImage = kMipSize; - std::vector data( + std::vector data( utils::RequiredBytesInCopy(textureDataLayout.bytesPerRow, textureDataLayout.rowsPerImage, copySize, kColorFormat) / - sizeof(RGBA8), + sizeof(utils::RGBA8), {100, 100, 100, 100}); EXPECT_LAZY_CLEAR( - 1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8), + 1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(utils::RGBA8), &textureDataLayout, ©Size)); // Expect texture initialized to be true EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), kMipLevel, 1, 0, 1)); - std::vector expectedZeros((kMipSize / 2) * kMipSize, {0, 0, 0, 0}); + std::vector expectedZeros((kMipSize / 2) * kMipSize, {0, 0, 0, 0}); // first half filled with 100, by the data EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0}, {kMipSize / 2, kMipSize}, kMipLevel); // second half should be cleared @@ -1814,8 +1823,8 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - std::vector expected(nonPaddedCopyExtent.width * nonPaddedCopyExtent.height, - {0x00, 0x20, 0x08, 0xFF}); + std::vector expected(nonPaddedCopyExtent.width * nonPaddedCopyExtent.height, + {0x00, 0x20, 0x08, 0xFF}); EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {0, 0}, {nonPaddedCopyExtent.width, nonPaddedCopyExtent.height}); EXPECT_TRUE(dawn::native::IsTextureSubresourceInitialized(bcTexture.Get(), viewMipmapLevel, @@ -1823,8 +1832,8 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest { // If we only copied to half the texture, check the other half is initialized to black if (halfCopyTest) { - std::vector expectBlack(nonPaddedCopyExtent.width * nonPaddedCopyExtent.height, - {0x00, 0x00, 0x00, 0xFF}); + std::vector expectBlack( + nonPaddedCopyExtent.width * nonPaddedCopyExtent.height, {0x00, 0x00, 0x00, 0xFF}); EXPECT_TEXTURE_EQ(expectBlack.data(), renderPass.color, {copyExtent3D.width, 0}, {nonPaddedCopyExtent.width, nonPaddedCopyExtent.height}); } diff --git a/src/dawn/tests/end2end/VertexFormatTests.cpp b/src/dawn/tests/end2end/VertexFormatTests.cpp index 336ac0f171..4a2eed1df5 100644 --- a/src/dawn/tests/end2end/VertexFormatTests.cpp +++ b/src/dawn/tests/end2end/VertexFormatTests.cpp @@ -273,7 +273,7 @@ class VertexFormatTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(input : VertexIn) -> VertexOut { var pos = array, 3>( vec2(-1.0, -1.0), @@ -362,7 +362,7 @@ class VertexFormatTest : public DawnTest { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vs.str().c_str()); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })"); @@ -405,7 +405,7 @@ class VertexFormatTest : public DawnTest { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 0, 0); } }; diff --git a/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp b/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp index 25532773f7..146036a1ef 100644 --- a/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp +++ b/src/dawn/tests/end2end/VertexOnlyRenderPipelineTests.cpp @@ -102,13 +102,13 @@ class VertexOnlyRenderPipelineTest : public DawnTest { bool writeDepth = false, bool useFragment = true) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@location(0) pos : vec4) -> @builtin(position) vec4 { return pos; })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -163,8 +163,8 @@ class VertexOnlyRenderPipelineTest : public DawnTest { wgpu::TextureView depthStencilView; wgpu::Texture renderTargetColor; // Render result - const RGBA8 filled = RGBA8(0, 255, 0, 255); - const RGBA8 notFilled = RGBA8(0, 0, 0, 0); + const utils::RGBA8 filled = utils::RGBA8(0, 255, 0, 255); + const utils::RGBA8 notFilled = utils::RGBA8(0, 0, 0, 0); // Render pass utils::ComboRenderPassDescriptor renderPassDescNoColor{}; utils::ComboRenderPassDescriptor renderPassDescWithColor{}; @@ -181,7 +181,7 @@ class VertexOnlyRenderPipelineTest : public DawnTest { TEST_P(VertexOnlyRenderPipelineTest, Stencil) { auto doStencilTest = [&](const wgpu::RenderPassDescriptor* renderPass, const wgpu::RenderPipeline& pipeline, - const RGBA8& colorExpect) -> void { + const utils::RGBA8& colorExpect) -> void { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); ClearAttachment(encoder); @@ -218,7 +218,7 @@ TEST_P(VertexOnlyRenderPipelineTest, Stencil) { TEST_P(VertexOnlyRenderPipelineTest, Depth) { auto doStencilTest = [&](const wgpu::RenderPassDescriptor* renderPass, const wgpu::RenderPipeline& pipeline, - const RGBA8& colorExpect) -> void { + const utils::RGBA8& colorExpect) -> void { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); ClearAttachment(encoder); diff --git a/src/dawn/tests/end2end/VertexStateTests.cpp b/src/dawn/tests/end2end/VertexStateTests.cpp index 2089cd6250..4878e71c05 100644 --- a/src/dawn/tests/end2end/VertexStateTests.cpp +++ b/src/dawn/tests/end2end/VertexStateTests.cpp @@ -91,7 +91,7 @@ class VertexStateTest : public DawnTest { @builtin(position) position : vec4, } - @stage(vertex) fn main(input : VertexIn) -> VertexOut { + @vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; )"; @@ -139,7 +139,7 @@ class VertexStateTest : public DawnTest { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vs.str().c_str()); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; } @@ -236,9 +236,9 @@ class VertexStateTest : public DawnTest { unsigned int x = kRTCellOffset + kRTCellSize * triangle; unsigned int y = kRTCellOffset + kRTCellSize * instance; if (triangle < triangles && instance < instances) { - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, x, y); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, x, y); } else { - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, x, y); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, x, y); } } } @@ -550,6 +550,10 @@ TEST_P(VertexStateTest, LastAllowedVertexBuffer) { vertexState.cAttributes[0].offset = 0; vertexState.cAttributes[0].format = VertexFormat::Float32x4; + for (uint32_t i = 0; i < kBufferIndex; i++) { + vertexState.cVertexBuffers[i].stepMode = VertexStepMode::VertexBufferNotUsed; + } + wgpu::RenderPipeline pipeline = MakeTestPipeline(vertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}}); @@ -598,7 +602,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) { @builtin(position) position : vec4, } - @stage(vertex) fn main(input : VertexIn) -> VertexOut { + @vertex fn main(input : VertexIn) -> VertexOut { var output : VertexOut; output.position = vec4(0.0, 0.0, 0.0, 1.0); @@ -618,7 +622,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) { return output; })"); pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) + @fragment fn main(@location(0) color : vec4) -> @location(0) vec4 { return color; })"); @@ -638,7 +642,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 1, 1); } DAWN_INSTANTIATE_TEST(VertexStateTest, @@ -655,12 +659,12 @@ TEST_P(OptionalVertexStateTest, Basic) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 3, 3); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -684,7 +688,7 @@ TEST_P(OptionalVertexStateTest, Basic) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 1, 1); } DAWN_INSTANTIATE_TEST(OptionalVertexStateTest, diff --git a/src/dawn/tests/end2end/VideoViewsTests.cpp b/src/dawn/tests/end2end/VideoViewsTests.cpp index 32666db667..72a9f605f2 100644 --- a/src/dawn/tests/end2end/VideoViewsTests.cpp +++ b/src/dawn/tests/end2end/VideoViewsTests.cpp @@ -24,10 +24,10 @@ VideoViewsTestBackend::PlatformTexture::~PlatformTexture() = default; VideoViewsTestBackend::~VideoViewsTestBackend() = default; -constexpr std::array VideoViewsTests::kYellowYUVColor; -constexpr std::array VideoViewsTests::kWhiteYUVColor; -constexpr std::array VideoViewsTests::kBlueYUVColor; -constexpr std::array VideoViewsTests::kRedYUVColor; +constexpr std::array VideoViewsTests::kYellowYUVColor; +constexpr std::array VideoViewsTests::kWhiteYUVColor; +constexpr std::array VideoViewsTests::kBlueYUVColor; +constexpr std::array VideoViewsTests::kRedYUVColor; void VideoViewsTests::SetUp() { DawnTest::SetUp(); @@ -177,7 +177,7 @@ wgpu::ShaderModule VideoViewsTests::GetTestVertexShaderModule() const { @builtin(position) position : vec4, } - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> VertexOut { var pos = array, 6>( vec2(-1.0, 1.0), @@ -194,13 +194,25 @@ wgpu::ShaderModule VideoViewsTests::GetTestVertexShaderModule() const { })"); } +// Create video texture uninitialized. +TEST_P(VideoViewsTests, CreateVideoTextureWithoutInitializedData) { + std::unique_ptr platformTexture = + mBackend->CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm, + wgpu::TextureUsage::TextureBinding, + /*isCheckerboard*/ false, + /*initialized*/ false); + ASSERT_NE(platformTexture.get(), nullptr); + mBackend->DestroyVideoTextureForTest(std::move(platformTexture)); +} + // Samples the luminance (Y) plane from an imported NV12 texture into a single channel of an RGBA // output attachment and checks for the expected pixel value in the rendered quad. TEST_P(VideoViewsTests, NV12SampleYtoR) { std::unique_ptr platformTexture = mBackend->CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding, - /*isCheckerboard*/ false); + /*isCheckerboard*/ false, + /*initialized*/ true); ASSERT_NE(platformTexture.get(), nullptr); if (!platformTexture->CanWrapAsWGPUTexture()) { mBackend->DestroyVideoTextureForTest(std::move(platformTexture)); @@ -218,7 +230,7 @@ TEST_P(VideoViewsTests, NV12SampleYtoR) { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { let y : f32 = textureSample(texture, sampler0, texCoord).r; return vec4(y, 0.0, 0.0, 1.0); @@ -257,7 +269,8 @@ TEST_P(VideoViewsTests, NV12SampleUVtoRG) { std::unique_ptr platformTexture = mBackend->CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding, - /*isCheckerboard*/ false); + /*isCheckerboard*/ false, + /*initialized*/ true); ASSERT_NE(platformTexture.get(), nullptr); if (!platformTexture->CanWrapAsWGPUTexture()) { mBackend->DestroyVideoTextureForTest(std::move(platformTexture)); @@ -276,7 +289,7 @@ TEST_P(VideoViewsTests, NV12SampleUVtoRG) { @group(0) @binding(0) var sampler0 : sampler; @group(0) @binding(1) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { let u : f32 = textureSample(texture, sampler0, texCoord).r; let v : f32 = textureSample(texture, sampler0, texCoord).g; @@ -320,7 +333,8 @@ TEST_P(VideoViewsTests, NV12SampleYUVtoRGB) { std::unique_ptr platformTexture = mBackend->CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding, - /*isCheckerboard*/ true); + /*isCheckerboard*/ true, + /*initialized*/ true); ASSERT_NE(platformTexture.get(), nullptr); if (!platformTexture->CanWrapAsWGPUTexture()) { mBackend->DestroyVideoTextureForTest(std::move(platformTexture)); @@ -345,7 +359,7 @@ TEST_P(VideoViewsTests, NV12SampleYUVtoRGB) { @group(0) @binding(1) var lumaTexture : texture_2d; @group(0) @binding(2) var chromaTexture : texture_2d; - @stage(fragment) + @fragment fn main(@location(0) texCoord : vec2) -> @location(0) vec4 { let y : f32 = textureSample(lumaTexture, sampler0, texCoord).r; let u : f32 = textureSample(chromaTexture, sampler0, texCoord).r; @@ -376,22 +390,24 @@ TEST_P(VideoViewsTests, NV12SampleYUVtoRGB) { queue.Submit(1, &commands); // Test four corners of the checkerboard image (YUV color space). - RGBA8 yellowYUV(kYellowYUVColor[kYUVLumaPlaneIndex].r, kYellowYUVColor[kYUVChromaPlaneIndex].r, - kYellowYUVColor[kYUVChromaPlaneIndex].g, 0xFF); + utils::RGBA8 yellowYUV(kYellowYUVColor[kYUVLumaPlaneIndex].r, + kYellowYUVColor[kYUVChromaPlaneIndex].r, + kYellowYUVColor[kYUVChromaPlaneIndex].g, 0xFF); EXPECT_PIXEL_RGBA8_EQ(yellowYUV, renderPass.color, 0, 0); // top left - RGBA8 redYUV(kRedYUVColor[kYUVLumaPlaneIndex].r, kRedYUVColor[kYUVChromaPlaneIndex].r, - kRedYUVColor[kYUVChromaPlaneIndex].g, 0xFF); + utils::RGBA8 redYUV(kRedYUVColor[kYUVLumaPlaneIndex].r, kRedYUVColor[kYUVChromaPlaneIndex].r, + kRedYUVColor[kYUVChromaPlaneIndex].g, 0xFF); EXPECT_PIXEL_RGBA8_EQ(redYUV, renderPass.color, kYUVImageDataWidthInTexels - 1, kYUVImageDataHeightInTexels - 1); // bottom right - RGBA8 blueYUV(kBlueYUVColor[kYUVLumaPlaneIndex].r, kBlueYUVColor[kYUVChromaPlaneIndex].r, - kBlueYUVColor[kYUVChromaPlaneIndex].g, 0xFF); + utils::RGBA8 blueYUV(kBlueYUVColor[kYUVLumaPlaneIndex].r, kBlueYUVColor[kYUVChromaPlaneIndex].r, + kBlueYUVColor[kYUVChromaPlaneIndex].g, 0xFF); EXPECT_PIXEL_RGBA8_EQ(blueYUV, renderPass.color, kYUVImageDataWidthInTexels - 1, 0); // top right - RGBA8 whiteYUV(kWhiteYUVColor[kYUVLumaPlaneIndex].r, kWhiteYUVColor[kYUVChromaPlaneIndex].r, - kWhiteYUVColor[kYUVChromaPlaneIndex].g, 0xFF); + utils::RGBA8 whiteYUV(kWhiteYUVColor[kYUVLumaPlaneIndex].r, + kWhiteYUVColor[kYUVChromaPlaneIndex].r, + kWhiteYUVColor[kYUVChromaPlaneIndex].g, 0xFF); EXPECT_PIXEL_RGBA8_EQ(whiteYUV, renderPass.color, 0, kYUVImageDataHeightInTexels - 1); // bottom left mBackend->DestroyVideoTextureForTest(std::move(platformTexture)); diff --git a/src/dawn/tests/end2end/VideoViewsTests.h b/src/dawn/tests/end2end/VideoViewsTests.h index e614fea9f3..d3d95207fb 100644 --- a/src/dawn/tests/end2end/VideoViewsTests.h +++ b/src/dawn/tests/end2end/VideoViewsTests.h @@ -46,7 +46,8 @@ class VideoViewsTestBackend { }; virtual std::unique_ptr CreateVideoTextureForTest(wgpu::TextureFormat format, wgpu::TextureUsage usage, - bool isCheckerboard) = 0; + bool isCheckerboard, + bool initialized) = 0; virtual void DestroyVideoTextureForTest(std::unique_ptr&& platformTexture) = 0; }; @@ -62,17 +63,21 @@ class VideoViewsTests : public DawnTest { // RGB colors converted into YUV (per plane), for testing. // RGB colors are mapped to the BT.601 definition of luma. // https://docs.microsoft.com/en-us/windows/win32/medfound/about-yuv-video - static constexpr std::array kYellowYUVColor = {RGBA8{210, 0, 0, 0xFF}, // Y - RGBA8{16, 146, 0, 0xFF}}; // UV + static constexpr std::array kYellowYUVColor = { + utils::RGBA8{210, 0, 0, 0xFF}, // Y + utils::RGBA8{16, 146, 0, 0xFF}}; // UV - static constexpr std::array kWhiteYUVColor = {RGBA8{235, 0, 0, 0xFF}, // Y - RGBA8{128, 128, 0, 0xFF}}; // UV + static constexpr std::array kWhiteYUVColor = { + utils::RGBA8{235, 0, 0, 0xFF}, // Y + utils::RGBA8{128, 128, 0, 0xFF}}; // UV - static constexpr std::array kBlueYUVColor = {RGBA8{41, 0, 0, 0xFF}, // Y - RGBA8{240, 110, 0, 0xFF}}; // UV + static constexpr std::array kBlueYUVColor = { + utils::RGBA8{41, 0, 0, 0xFF}, // Y + utils::RGBA8{240, 110, 0, 0xFF}}; // UV - static constexpr std::array kRedYUVColor = {RGBA8{81, 0, 0, 0xFF}, // Y - RGBA8{90, 240, 0, 0xFF}}; // UV + static constexpr std::array kRedYUVColor = { + utils::RGBA8{81, 0, 0, 0xFF}, // Y + utils::RGBA8{90, 240, 0, 0xFF}}; // UV static std::vector GetTestTextureData(wgpu::TextureFormat format, bool isCheckerboard); static uint32_t NumPlanes(wgpu::TextureFormat format); diff --git a/src/dawn/tests/end2end/VideoViewsTests_gbm.cpp b/src/dawn/tests/end2end/VideoViewsTests_gbm.cpp index 9a45b6cfa7..55535ce790 100644 --- a/src/dawn/tests/end2end/VideoViewsTests_gbm.cpp +++ b/src/dawn/tests/end2end/VideoViewsTests_gbm.cpp @@ -32,6 +32,10 @@ #define GBM_BO_USE_HW_VIDEO_DECODER (1 << 13) #endif +#ifndef DRM_FORMAT_MOD_LINEAR +#define DRM_FORMAT_MOD_LINEAR 0 +#endif + class PlatformTextureGbm : public VideoViewsTestBackend::PlatformTexture { public: PlatformTextureGbm(wgpu::Texture&& texture, gbm_bo* gbmBo) @@ -40,6 +44,11 @@ class PlatformTextureGbm : public VideoViewsTestBackend::PlatformTexture { // TODO(chromium:1258986): Add DISJOINT vkImage support for multi-plannar formats. bool CanWrapAsWGPUTexture() override { + // TODO(chromium:1258986): Figure out the failure incurred by the change to explicit vkImage + // create when importing. + if (gbm_bo_get_modifier(mGbmBo) == DRM_FORMAT_MOD_LINEAR) { + return false; + } ASSERT(mGbmBo != nullptr); // Checks if all plane handles of a multi-planar gbm_bo are same. gbm_bo_handle plane0Handle = gbm_bo_get_handle_for_plane(mGbmBo, 0); @@ -84,8 +93,9 @@ class VideoViewsTestBackendGbm : public VideoViewsTestBackend { for (uint32_t i = kRenderNodeStart; i < kRenderNodeEnd; i++) { std::string renderNode = kRenderNodeTemplate + std::to_string(i); renderNodeFd = open(renderNode.c_str(), O_RDWR); - if (renderNodeFd >= 0) + if (renderNodeFd >= 0) { break; + } } ASSERT(renderNodeFd > 0); @@ -124,9 +134,17 @@ class VideoViewsTestBackendGbm : public VideoViewsTestBackend { std::unique_ptr CreateVideoTextureForTest( wgpu::TextureFormat format, wgpu::TextureUsage usage, - bool isCheckerboard) override { - uint32_t flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_TEXTURING | GBM_BO_USE_HW_VIDEO_DECODER | - GBM_BO_USE_SW_WRITE_RARELY; + bool isCheckerboard, + bool initialized) override { + // The flags Chromium is using for the VAAPI decoder. + uint32_t flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_TEXTURING | GBM_BO_USE_HW_VIDEO_DECODER; + if (initialized) { + // The flag specifically used for tests, which need to initialize the GBM buffer with + // the expected raw video data via CPU, and then sample and draw the buffer via GPU. + // With the flag added, the buffer's drm modifier will be DRM_FORMAT_MOD_LINEAR instead + // of I915_FORMAT_MOD_Y_TILED. + flags |= GBM_BO_USE_SW_WRITE_RARELY; + } gbm_bo* gbmBo = gbm_bo_create(mGbmDevice, VideoViewsTests::kYUVImageDataWidthInTexels, VideoViewsTests::kYUVImageDataHeightInTexels, GetGbmBoFormat(format), flags); @@ -134,17 +152,19 @@ class VideoViewsTestBackendGbm : public VideoViewsTestBackend { return nullptr; } - void* mapHandle = nullptr; - uint32_t strideBytes = 0; - void* addr = gbm_bo_map(gbmBo, 0, 0, VideoViewsTests::kYUVImageDataWidthInTexels, - VideoViewsTests::kYUVImageDataHeightInTexels, GBM_BO_TRANSFER_WRITE, - &strideBytes, &mapHandle); - EXPECT_NE(addr, nullptr); - std::vector initialData = - VideoViewsTests::GetTestTextureData(format, isCheckerboard); - std::memcpy(addr, initialData.data(), initialData.size()); + if (initialized) { + void* mapHandle = nullptr; + uint32_t strideBytes = 0; + void* addr = gbm_bo_map(gbmBo, 0, 0, VideoViewsTests::kYUVImageDataWidthInTexels, + VideoViewsTests::kYUVImageDataHeightInTexels, + GBM_BO_TRANSFER_WRITE, &strideBytes, &mapHandle); + EXPECT_NE(addr, nullptr); + std::vector initialData = + VideoViewsTests::GetTestTextureData(format, isCheckerboard); + std::memcpy(addr, initialData.data(), initialData.size()); - gbm_bo_unmap(gbmBo, mapHandle); + gbm_bo_unmap(gbmBo, mapHandle); + } wgpu::TextureDescriptor textureDesc; textureDesc.format = format; @@ -163,13 +183,19 @@ class VideoViewsTestBackendGbm : public VideoViewsTestBackend { descriptor.isInitialized = true; descriptor.memoryFD = gbm_bo_get_fd(gbmBo); - descriptor.stride = gbm_bo_get_stride(gbmBo); + for (int plane = 0; plane < gbm_bo_get_plane_count(gbmBo); ++plane) { + descriptor.planeLayouts[plane].stride = gbm_bo_get_stride_for_plane(gbmBo, plane); + descriptor.planeLayouts[plane].offset = gbm_bo_get_offset(gbmBo, plane); + } descriptor.drmModifier = gbm_bo_get_modifier(gbmBo); descriptor.waitFDs = {}; - return std::make_unique( - wgpu::Texture::Acquire(dawn::native::vulkan::WrapVulkanImage(mWGPUDevice, &descriptor)), - gbmBo); + WGPUTexture texture = dawn::native::vulkan::WrapVulkanImage(mWGPUDevice, &descriptor); + if (texture != nullptr) { + return std::make_unique(wgpu::Texture::Acquire(texture), gbmBo); + } else { + return nullptr; + } } void DestroyVideoTextureForTest( diff --git a/src/dawn/tests/end2end/VideoViewsTests_mac.cpp b/src/dawn/tests/end2end/VideoViewsTests_mac.cpp index c7f480efea..d23cc1355c 100644 --- a/src/dawn/tests/end2end/VideoViewsTests_mac.cpp +++ b/src/dawn/tests/end2end/VideoViewsTests_mac.cpp @@ -86,7 +86,8 @@ class VideoViewsTestBackendIOSurface : public VideoViewsTestBackend { std::unique_ptr CreateVideoTextureForTest( wgpu::TextureFormat format, wgpu::TextureUsage usage, - bool isCheckerboard) override { + bool isCheckerboard, + bool initialized) override { CFMutableDictionaryRef dict(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); @@ -134,15 +135,17 @@ class VideoViewsTestBackendIOSurface : public VideoViewsTestBackend { IOSurfaceRef surface = IOSurfaceCreate(dict); CFRelease(dict); - IOSurfaceLock(surface, 0, nullptr); - for (size_t plane = 0; plane < num_planes; ++plane) { - std::vector data = VideoViewsTests::GetTestTextureDataWithPlaneIndex( - plane, IOSurfaceGetBytesPerRowOfPlane(surface, plane), - IOSurfaceGetHeightOfPlane(surface, plane), isCheckerboard); - void* pointer = IOSurfaceGetBaseAddressOfPlane(surface, plane); - memcpy(pointer, data.data(), data.size()); + if (initialized) { + IOSurfaceLock(surface, 0, nullptr); + for (size_t plane = 0; plane < num_planes; ++plane) { + std::vector data = VideoViewsTests::GetTestTextureDataWithPlaneIndex( + plane, IOSurfaceGetBytesPerRowOfPlane(surface, plane), + IOSurfaceGetHeightOfPlane(surface, plane), isCheckerboard); + void* pointer = IOSurfaceGetBaseAddressOfPlane(surface, plane); + memcpy(pointer, data.data(), data.size()); + } + IOSurfaceUnlock(surface, 0, nullptr); } - IOSurfaceUnlock(surface, 0, nullptr); wgpu::TextureDescriptor textureDesc; textureDesc.format = format; diff --git a/src/dawn/tests/end2end/VideoViewsTests_win.cpp b/src/dawn/tests/end2end/VideoViewsTests_win.cpp index a402deec5e..45991dd5ab 100644 --- a/src/dawn/tests/end2end/VideoViewsTests_win.cpp +++ b/src/dawn/tests/end2end/VideoViewsTests_win.cpp @@ -90,7 +90,8 @@ class VideoViewsTestBackendWin : public VideoViewsTestBackend { std::unique_ptr CreateVideoTextureForTest( wgpu::TextureFormat format, wgpu::TextureUsage usage, - bool isCheckerboard) override { + bool isCheckerboard, + bool initialized) override { wgpu::TextureDescriptor textureDesc; textureDesc.format = format; textureDesc.dimension = wgpu::TextureDimension::e2D; @@ -121,7 +122,8 @@ class VideoViewsTestBackendWin : public VideoViewsTestBackend { subres.SysMemPitch = VideoViewsTests::kYUVImageDataWidthInTexels; ComPtr d3d11Texture; - HRESULT hr = mD3d11Device->CreateTexture2D(&d3dDescriptor, &subres, &d3d11Texture); + HRESULT hr = mD3d11Device->CreateTexture2D( + &d3dDescriptor, (initialized ? &subres : nullptr), &d3d11Texture); ASSERT(hr == S_OK); ComPtr dxgiResource; diff --git a/src/dawn/tests/end2end/ViewportOrientationTests.cpp b/src/dawn/tests/end2end/ViewportOrientationTests.cpp index 9a29049175..a130aa6e3f 100644 --- a/src/dawn/tests/end2end/ViewportOrientationTests.cpp +++ b/src/dawn/tests/end2end/ViewportOrientationTests.cpp @@ -24,12 +24,12 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 2, 2); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(-0.5, 0.5, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -52,10 +52,10 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 0, 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 1, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 0, 1); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 1, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 1, 1); } DAWN_INSTANTIATE_TEST(ViewportOrientationTests, diff --git a/src/dawn/tests/end2end/ViewportTests.cpp b/src/dawn/tests/end2end/ViewportTests.cpp index f27d052e2a..3fc4089279 100644 --- a/src/dawn/tests/end2end/ViewportTests.cpp +++ b/src/dawn/tests/end2end/ViewportTests.cpp @@ -24,7 +24,7 @@ class ViewportTest : public DawnTest { DawnTest::SetUp(); mQuadVS = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, 1.0), @@ -37,7 +37,7 @@ class ViewportTest : public DawnTest { })"); mQuadFS = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); })"); } @@ -81,9 +81,9 @@ class ViewportTest : public DawnTest { for (uint32_t checkX = 0; checkX < kWidth; checkX++) { for (uint32_t checkY = 0; checkY < kHeight; checkY++) { if (checkX >= x && checkX < x + width && checkY >= y && checkY < y + height) { - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kWhite, rp.color, checkX, checkY); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kWhite, rp.color, checkX, checkY); } else { - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, rp.color, checkX, checkY); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, rp.color, checkX, checkY); } } } @@ -93,7 +93,7 @@ class ViewportTest : public DawnTest { // Create a pipeline drawing 3 points at depth 1.0, 0.5 and 0.0. utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var points : array, 3> = array, 3>( vec3(-0.9, 0.0, 1.0), @@ -210,7 +210,7 @@ TEST_P(ViewportTest, EmptyViewport) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kZero, renderPass.color, 0, 0); }; // Test with a 0x0, 0xN and nx0 viewport. diff --git a/src/dawn/tests/end2end/WindowSurfaceTests.cpp b/src/dawn/tests/end2end/WindowSurfaceTests.cpp index f916605069..31ec57a57e 100644 --- a/src/dawn/tests/end2end/WindowSurfaceTests.cpp +++ b/src/dawn/tests/end2end/WindowSurfaceTests.cpp @@ -20,13 +20,13 @@ #include "dawn/dawn_proc.h" #include "dawn/native/DawnNative.h" #include "dawn/tests/DawnTest.h" -#include "dawn/utils/GLFWUtils.h" #include "gtest/gtest.h" +#include "webgpu/webgpu_glfw.h" // Include windows.h before GLFW so GLFW's APIENTRY macro doesn't conflict with windows.h's. -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) #include "dawn/common/windows_with_undefs.h" -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) #include "GLFW/glfw3.h" @@ -63,13 +63,12 @@ class WindowSurfaceInstanceTests : public testing::Test { } void AssertSurfaceCreation(const wgpu::SurfaceDescriptor* descriptor, bool succeeds) { - ASSERT_EQ(mInstance.CreateSurface(descriptor).Get() != nullptr, succeeds); + wgpu::Surface surface = mInstance.CreateSurface(descriptor); + ASSERT_EQ(dawn::native::CheckIsErrorForTesting(surface.Get()), !succeeds); } GLFWwindow* CreateWindow() { - // The WindowSurfaceInstance tests don't create devices so we don't need to call - // SetupGLFWWindowHintsForBackend. Set GLFW_NO_API anyway to avoid GLFW bringing up a GL - // context that we won't use. + // Set GLFW_NO_API to avoid GLFW bringing up a GL context that we won't use. glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); mWindow = glfwCreateWindow(400, 400, "WindowSurfaceInstanceTests window", nullptr, nullptr); return mWindow; @@ -85,7 +84,7 @@ class WindowSurfaceInstanceTests : public testing::Test { TEST_F(WindowSurfaceInstanceTests, ControlCase) { GLFWwindow* window = CreateWindow(); std::unique_ptr chainedDescriptor = - utils::SetupWindowAndGetSurfaceDescriptor(window); + wgpu::glfw::SetupWindowAndGetSurfaceDescriptor(window); wgpu::SurfaceDescriptor descriptor; descriptor.nextInChain = chainedDescriptor.get(); @@ -127,9 +126,9 @@ TEST_F(WindowSurfaceInstanceTests, HTMLCanvasDescriptor) { TEST_F(WindowSurfaceInstanceTests, TwoChainedDescriptors) { GLFWwindow* window = CreateWindow(); std::unique_ptr chainedDescriptor1 = - utils::SetupWindowAndGetSurfaceDescriptor(window); + wgpu::glfw::SetupWindowAndGetSurfaceDescriptor(window); std::unique_ptr chainedDescriptor2 = - utils::SetupWindowAndGetSurfaceDescriptor(window); + wgpu::glfw::SetupWindowAndGetSurfaceDescriptor(window); wgpu::SurfaceDescriptor descriptor; descriptor.nextInChain = chainedDescriptor1.get(); @@ -138,13 +137,13 @@ TEST_F(WindowSurfaceInstanceTests, TwoChainedDescriptors) { AssertSurfaceCreation(&descriptor, false); } -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) // Tests that GLFWUtils returns a descriptor of HWND type TEST_F(WindowSurfaceInstanceTests, CorrectSTypeHWND) { GLFWwindow* window = CreateWindow(); std::unique_ptr chainedDescriptor = - utils::SetupWindowAndGetSurfaceDescriptor(window); + wgpu::glfw::SetupWindowAndGetSurfaceDescriptor(window); ASSERT_EQ(chainedDescriptor->sType, wgpu::SType::SurfaceDescriptorFromWindowsHWND); } @@ -159,7 +158,7 @@ TEST_F(WindowSurfaceInstanceTests, InvalidHWND) { AssertSurfaceCreation(&descriptor, false); } -#else // defined(DAWN_PLATFORM_WINDOWS) +#else // DAWN_PLATFORM_IS(WINDOWS) // Test using HWND when it is not supported TEST_F(WindowSurfaceInstanceTests, HWNDSurfacesAreInvalid) { @@ -172,7 +171,7 @@ TEST_F(WindowSurfaceInstanceTests, HWNDSurfacesAreInvalid) { AssertSurfaceCreation(&descriptor, false); } -#endif // defined(DAWN_PLATFORM_WINDOWS) +#endif // DAWN_PLATFORM_IS(WINDOWS) #if defined(DAWN_USE_X11) @@ -180,7 +179,7 @@ TEST_F(WindowSurfaceInstanceTests, HWNDSurfacesAreInvalid) { TEST_F(WindowSurfaceInstanceTests, CorrectSTypeXlib) { GLFWwindow* window = CreateWindow(); std::unique_ptr chainedDescriptor = - utils::SetupWindowAndGetSurfaceDescriptor(window); + wgpu::glfw::SetupWindowAndGetSurfaceDescriptor(window); ASSERT_EQ(chainedDescriptor->sType, wgpu::SType::SurfaceDescriptorFromXlibWindow); } @@ -220,7 +219,7 @@ TEST_F(WindowSurfaceInstanceTests, XlibSurfacesAreInvalid) { TEST_F(WindowSurfaceInstanceTests, CorrectSTypeMetal) { GLFWwindow* window = CreateWindow(); std::unique_ptr chainedDescriptor = - utils::SetupWindowAndGetSurfaceDescriptor(window); + wgpu::glfw::SetupWindowAndGetSurfaceDescriptor(window); ASSERT_EQ(chainedDescriptor->sType, wgpu::SType::SurfaceDescriptorFromMetalLayer); } diff --git a/src/dawn/tests/end2end/mocks/CachingInterfaceMock.h b/src/dawn/tests/end2end/mocks/CachingInterfaceMock.h deleted file mode 100644 index cc61d80fc2..0000000000 --- a/src/dawn/tests/end2end/mocks/CachingInterfaceMock.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_DAWN_TESTS_END2END_MOCKS_CACHINGINTERFACEMOCK_H_ -#define SRC_DAWN_TESTS_END2END_MOCKS_CACHINGINTERFACEMOCK_H_ - -#include -#include - -#include -#include -#include - -#define EXPECT_CACHE_HIT(cache, N, statement) \ - do { \ - FlushWire(); \ - size_t before = cache.GetHitCount(); \ - statement; \ - FlushWire(); \ - size_t after = cache.GetHitCount(); \ - EXPECT_EQ(N, after - before); \ - } while (0) - -// A mock caching interface class that also supplies an in memory cache for testing. -class CachingInterfaceMock : public dawn::platform::CachingInterface { - public: - CachingInterfaceMock(); - - // Toggles to disable/enable caching. - void Disable(); - void Enable(); - - // Returns the number of cache hits up to this point. - size_t GetHitCount() const; - - // Returns the number of entries in the cache. - size_t GetNumEntries() const; - - MOCK_METHOD(size_t, LoadData, (const void*, size_t, void*, size_t), (override)); - MOCK_METHOD(void, StoreData, (const void*, size_t, const void*, size_t), (override)); - - private: - size_t LoadDataDefault(const void* key, size_t keySize, void* value, size_t valueSize); - void StoreDataDefault(const void* key, size_t keySize, const void* value, size_t valueSize); - - bool mEnabled = true; - size_t mHitCount = 0; - std::unordered_map> mCache; -}; - -// Dawn platform used for testing with a mock caching interface. -class DawnCachingMockPlatform : public dawn::platform::Platform { - public: - explicit DawnCachingMockPlatform(dawn::platform::CachingInterface* cachingInterface); - dawn::platform::CachingInterface* GetCachingInterface(const void* fingerprint, - size_t fingerprintSize) override; - - private: - dawn::platform::CachingInterface* mCachingInterface = nullptr; -}; - -#endif // SRC_DAWN_TESTS_END2END_MOCKS_CACHINGINTERFACEMOCK_H_ diff --git a/src/dawn/tests/end2end/mocks/CachingInterfaceMock.cpp b/src/dawn/tests/mocks/platform/CachingInterfaceMock.cpp similarity index 95% rename from src/dawn/tests/end2end/mocks/CachingInterfaceMock.cpp rename to src/dawn/tests/mocks/platform/CachingInterfaceMock.cpp index 8507e9cffb..4622963c34 100644 --- a/src/dawn/tests/end2end/mocks/CachingInterfaceMock.cpp +++ b/src/dawn/tests/mocks/platform/CachingInterfaceMock.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "dawn/tests/end2end/mocks/CachingInterfaceMock.h" +#include "dawn/tests/mocks/platform/CachingInterfaceMock.h" using ::testing::Invoke; @@ -79,8 +79,6 @@ void CachingInterfaceMock::StoreDataDefault(const void* key, DawnCachingMockPlatform::DawnCachingMockPlatform(dawn::platform::CachingInterface* cachingInterface) : mCachingInterface(cachingInterface) {} -dawn::platform::CachingInterface* DawnCachingMockPlatform::GetCachingInterface( - const void* fingerprint, - size_t fingerprintSize) { +dawn::platform::CachingInterface* DawnCachingMockPlatform::GetCachingInterface() { return mCachingInterface; } diff --git a/src/dawn/tests/mocks/platform/CachingInterfaceMock.h b/src/dawn/tests/mocks/platform/CachingInterfaceMock.h new file mode 100644 index 0000000000..79cff16fd8 --- /dev/null +++ b/src/dawn/tests/mocks/platform/CachingInterfaceMock.h @@ -0,0 +1,95 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_TESTS_MOCKS_PLATFORM_CACHINGINTERFACEMOCK_H_ +#define SRC_DAWN_TESTS_MOCKS_PLATFORM_CACHINGINTERFACEMOCK_H_ + +#include +#include + +#include +#include +#include + +#include "dawn/common/TypedInteger.h" + +#define EXPECT_CACHE_HIT(cache, N, statement) \ + do { \ + FlushWire(); \ + size_t before = cache.GetHitCount(); \ + statement; \ + FlushWire(); \ + size_t after = cache.GetHitCount(); \ + EXPECT_EQ(N, after - before); \ + } while (0) + +// Check that |HitN| cache hits occured, and |AddN| entries were added. +// Usage: EXPECT_CACHE_STATS(myMockCache, Hit(42), Add(3), ...) +// Hit / Add help readability, and enforce the args are passed correctly in the expected order. +#define EXPECT_CACHE_STATS(cache, HitN, AddN, statement) \ + do { \ + using Hit = TypedInteger; \ + using Add = TypedInteger; \ + static_assert(std::is_same_v); \ + static_assert(std::is_same_v); \ + FlushWire(); \ + size_t hitBefore = cache.GetHitCount(); \ + size_t entriesBefore = cache.GetNumEntries(); \ + statement; \ + FlushWire(); \ + size_t hitAfter = cache.GetHitCount(); \ + size_t entriesAfter = cache.GetNumEntries(); \ + EXPECT_EQ(static_cast(HitN), hitAfter - hitBefore); \ + EXPECT_EQ(static_cast(AddN), entriesAfter - entriesBefore); \ + } while (0) + +// A mock caching interface class that also supplies an in memory cache for testing. +class CachingInterfaceMock : public dawn::platform::CachingInterface { + public: + CachingInterfaceMock(); + + // Toggles to disable/enable caching. + void Disable(); + void Enable(); + + // Returns the number of cache hits up to this point. + size_t GetHitCount() const; + + // Returns the number of entries in the cache. + size_t GetNumEntries() const; + + MOCK_METHOD(size_t, LoadData, (const void*, size_t, void*, size_t), (override)); + MOCK_METHOD(void, StoreData, (const void*, size_t, const void*, size_t), (override)); + + private: + size_t LoadDataDefault(const void* key, size_t keySize, void* value, size_t valueSize); + void StoreDataDefault(const void* key, size_t keySize, const void* value, size_t valueSize); + + bool mEnabled = true; + size_t mHitCount = 0; + std::unordered_map> mCache; +}; + +// Dawn platform used for testing with a mock caching interface. +class DawnCachingMockPlatform : public dawn::platform::Platform { + public: + explicit DawnCachingMockPlatform(dawn::platform::CachingInterface* cachingInterface); + + dawn::platform::CachingInterface* GetCachingInterface() override; + + private: + dawn::platform::CachingInterface* mCachingInterface = nullptr; +}; + +#endif // SRC_DAWN_TESTS_MOCKS_PLATFORM_CACHINGINTERFACEMOCK_H_ diff --git a/src/dawn/tests/perf_tests/DrawCallPerf.cpp b/src/dawn/tests/perf_tests/DrawCallPerf.cpp index 7b2cc02890..335f73b8c5 100644 --- a/src/dawn/tests/perf_tests/DrawCallPerf.cpp +++ b/src/dawn/tests/perf_tests/DrawCallPerf.cpp @@ -34,7 +34,7 @@ constexpr float kVertexData[12] = { }; constexpr char kVertexShader[] = R"( - @stage(vertex) fn main( + @vertex fn main( @location(0) pos : vec4 ) -> @builtin(position) vec4 { return pos; @@ -45,7 +45,7 @@ constexpr char kFragmentShaderA[] = R"( color : vec3 } @group(0) @binding(0) var uniforms : Uniforms; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(uniforms.color * (1.0 / 5000.0), 1.0); })"; @@ -59,7 +59,7 @@ constexpr char kFragmentShaderB[] = R"( @group(0) @binding(0) var constants : Constants; @group(1) @binding(0) var uniforms : Uniforms; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4((constants.color + uniforms.color) * (1.0 / 5000.0), 1.0); })"; diff --git a/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp b/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp index b6cc974b95..5a68e2e3b9 100644 --- a/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp +++ b/src/dawn/tests/perf_tests/ShaderRobustnessPerf.cpp @@ -33,7 +33,7 @@ const std::string& kMatMulFloatHeader = R"( @group(0) @binding(0) var firstMatrix : Matrix; @group(0) @binding(1) var secondMatrix : Matrix; - @group(0) @binding(2) var resultMatrix : Matrix; + @group(0) @binding(2) var resultMatrix : Matrix; @group(0) @binding(3) var uniforms : Uniforms; fn mm_readA(row : u32, col : u32) -> f32 { @@ -75,7 +75,7 @@ const std::string& kMatMulFloatSharedArray2D = R"( var mm_Asub : array, 32>; var mm_Bsub : array, 32>;)"; const std::string& kMatMulFloatBodyPart1 = R"( - @stage(compute) @workgroup_size(8, 8, 1) + @compute @workgroup_size(8, 8, 1) fn main(@builtin(local_invocation_id) local_id : vec3, @builtin(global_invocation_id) global_id : vec3) { let tileRow : u32 = local_id.y * RowPerThread; @@ -200,7 +200,7 @@ const std::string& kMatMulVec4Header = R"( @group(0) @binding(0) var firstMatrix : Matrix; @group(0) @binding(1) var secondMatrix : Matrix; - @group(0) @binding(2) var resultMatrix : Matrix; + @group(0) @binding(2) var resultMatrix : Matrix; @group(0) @binding(3) var uniforms : Uniforms; fn mm_readA(row : u32, col : u32) -> vec4 { @@ -240,7 +240,7 @@ const std::string& kMatMulVec4SharedArray2D = R"( var mm_Asub : array, 8>, 32>; var mm_Bsub : array, 8>, 32>;)"; const std::string& kMatMulVec4BodyPart1 = R"( - @stage(compute) @workgroup_size(8, 8, 1) + @compute @workgroup_size(8, 8, 1) fn main(@builtin(local_invocation_id) local_id : vec3, @builtin(global_invocation_id) global_id : vec3) { let tileRow : u32 = local_id.y * RowPerThread; diff --git a/src/dawn/tests/perf_tests/SubresourceTrackingPerf.cpp b/src/dawn/tests/perf_tests/SubresourceTrackingPerf.cpp index 33ae07e925..2fe41acd46 100644 --- a/src/dawn/tests/perf_tests/SubresourceTrackingPerf.cpp +++ b/src/dawn/tests/perf_tests/SubresourceTrackingPerf.cpp @@ -68,13 +68,13 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var materials : texture_2d; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { let foo : vec2 = textureDimensions(materials); return vec4(1.0, 0.0, 0.0, 1.0); } diff --git a/src/dawn/tests/unittests/ChainUtilsTests.cpp b/src/dawn/tests/unittests/ChainUtilsTests.cpp index 87d7b46162..c1bea5b9d6 100644 --- a/src/dawn/tests/unittests/ChainUtilsTests.cpp +++ b/src/dawn/tests/unittests/ChainUtilsTests.cpp @@ -19,7 +19,7 @@ // Checks that we cannot find any structs in an empty chain TEST(ChainUtilsTests, FindEmptyChain) { - const dawn::native::PrimitiveDepthClampingState* info = nullptr; + const dawn::native::PrimitiveDepthClipControl* info = nullptr; dawn::native::FindInChain(nullptr, &info); ASSERT_EQ(nullptr, info); @@ -27,10 +27,10 @@ TEST(ChainUtilsTests, FindEmptyChain) { // Checks that searching a chain for a present struct returns that struct TEST(ChainUtilsTests, FindPresentInChain) { - dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::PrimitiveDepthClipControl chain1; dawn::native::ShaderModuleSPIRVDescriptor chain2; chain1.nextInChain = &chain2; - const dawn::native::PrimitiveDepthClampingState* info1 = nullptr; + const dawn::native::PrimitiveDepthClipControl* info1 = nullptr; const dawn::native::ShaderModuleSPIRVDescriptor* info2 = nullptr; dawn::native::FindInChain(&chain1, &info1); dawn::native::FindInChain(&chain1, &info2); @@ -41,7 +41,7 @@ TEST(ChainUtilsTests, FindPresentInChain) { // Checks that searching a chain for a struct that doesn't exist returns a nullptr TEST(ChainUtilsTests, FindMissingInChain) { - dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::PrimitiveDepthClipControl chain1; dawn::native::ShaderModuleSPIRVDescriptor chain2; chain1.nextInChain = &chain2; const dawn::native::SurfaceDescriptorFromMetalLayer* info = nullptr; @@ -52,9 +52,9 @@ TEST(ChainUtilsTests, FindMissingInChain) { // Checks that validation rejects chains with duplicate STypes TEST(ChainUtilsTests, ValidateDuplicateSTypes) { - dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::PrimitiveDepthClipControl chain1; dawn::native::ShaderModuleSPIRVDescriptor chain2; - dawn::native::PrimitiveDepthClampingState chain3; + dawn::native::PrimitiveDepthClipControl chain3; chain1.nextInChain = &chain2; chain2.nextInChain = &chain3; @@ -65,7 +65,7 @@ TEST(ChainUtilsTests, ValidateDuplicateSTypes) { // Checks that validation rejects chains that contain unspecified STypes TEST(ChainUtilsTests, ValidateUnspecifiedSTypes) { - dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::PrimitiveDepthClipControl chain1; dawn::native::ShaderModuleSPIRVDescriptor chain2; dawn::native::ShaderModuleWGSLDescriptor chain3; chain1.nextInChain = &chain2; @@ -73,7 +73,7 @@ TEST(ChainUtilsTests, ValidateUnspecifiedSTypes) { dawn::native::MaybeError result = dawn::native::ValidateSTypes(&chain1, { - {wgpu::SType::PrimitiveDepthClampingState}, + {wgpu::SType::PrimitiveDepthClipControl}, {wgpu::SType::ShaderModuleSPIRVDescriptor}, }); ASSERT_TRUE(result.IsError()); @@ -83,7 +83,7 @@ TEST(ChainUtilsTests, ValidateUnspecifiedSTypes) { // Checks that validation rejects chains that contain multiple STypes from the same oneof // constraint. TEST(ChainUtilsTests, ValidateOneOfFailure) { - dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::PrimitiveDepthClipControl chain1; dawn::native::ShaderModuleSPIRVDescriptor chain2; dawn::native::ShaderModuleWGSLDescriptor chain3; chain1.nextInChain = &chain2; @@ -98,7 +98,7 @@ TEST(ChainUtilsTests, ValidateOneOfFailure) { // Checks that validation accepts chains that match the constraints. TEST(ChainUtilsTests, ValidateSuccess) { - dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::PrimitiveDepthClipControl chain1; dawn::native::ShaderModuleSPIRVDescriptor chain2; chain1.nextInChain = &chain2; @@ -106,7 +106,7 @@ TEST(ChainUtilsTests, ValidateSuccess) { &chain1, { {wgpu::SType::ShaderModuleSPIRVDescriptor, wgpu::SType::ShaderModuleWGSLDescriptor}, - {wgpu::SType::PrimitiveDepthClampingState}, + {wgpu::SType::PrimitiveDepthClipControl}, {wgpu::SType::SurfaceDescriptorFromMetalLayer}, }); ASSERT_TRUE(result.IsSuccess()); @@ -117,7 +117,7 @@ TEST(ChainUtilsTests, ValidateEmptyChain) { dawn::native::MaybeError result = dawn::native::ValidateSTypes(nullptr, { {wgpu::SType::ShaderModuleSPIRVDescriptor}, - {wgpu::SType::PrimitiveDepthClampingState}, + {wgpu::SType::PrimitiveDepthClipControl}, }); ASSERT_TRUE(result.IsSuccess()); @@ -132,22 +132,22 @@ TEST(ChainUtilsTests, ValidateSingleEmptyChain) { ASSERT_TRUE(result.IsSuccess()); result = dawn::native::ValidateSingleSType(nullptr, wgpu::SType::ShaderModuleSPIRVDescriptor, - wgpu::SType::PrimitiveDepthClampingState); + wgpu::SType::PrimitiveDepthClipControl); ASSERT_TRUE(result.IsSuccess()); } // Checks that singleton validation always fails on chains with multiple children. TEST(ChainUtilsTests, ValidateSingleMultiChain) { - dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::PrimitiveDepthClipControl chain1; dawn::native::ShaderModuleSPIRVDescriptor chain2; chain1.nextInChain = &chain2; dawn::native::MaybeError result = - dawn::native::ValidateSingleSType(&chain1, wgpu::SType::PrimitiveDepthClampingState); + dawn::native::ValidateSingleSType(&chain1, wgpu::SType::PrimitiveDepthClipControl); ASSERT_TRUE(result.IsError()); result.AcquireError(); - result = dawn::native::ValidateSingleSType(&chain1, wgpu::SType::PrimitiveDepthClampingState, + result = dawn::native::ValidateSingleSType(&chain1, wgpu::SType::PrimitiveDepthClipControl, wgpu::SType::ShaderModuleSPIRVDescriptor); ASSERT_TRUE(result.IsError()); result.AcquireError(); @@ -172,7 +172,7 @@ TEST(ChainUtilsTests, ValidateSingleSatisfied) { // Checks that singleton validation passes when the oneof constraint is not met. TEST(ChainUtilsTests, ValidateSingleUnsatisfied) { - dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::PrimitiveDepthClipControl chain1; dawn::native::MaybeError result = dawn::native::ValidateSingleSType(&chain1, wgpu::SType::ShaderModuleWGSLDescriptor); diff --git a/src/dawn/tests/unittests/CommandAllocatorTests.cpp b/src/dawn/tests/unittests/CommandAllocatorTests.cpp index 2c63327591..443dcf61dc 100644 --- a/src/dawn/tests/unittests/CommandAllocatorTests.cpp +++ b/src/dawn/tests/unittests/CommandAllocatorTests.cpp @@ -351,7 +351,6 @@ TEST(CommandAllocator, EmptyIterator) { bool hasNext = iterator2.NextCommandId(&type); ASSERT_FALSE(hasNext); - iterator1.MakeEmptyAsDataWasDestroyed(); iterator2.MakeEmptyAsDataWasDestroyed(); } { @@ -362,7 +361,6 @@ TEST(CommandAllocator, EmptyIterator) { bool hasNext = iterator2.NextCommandId(&type); ASSERT_FALSE(hasNext); - iterator1.MakeEmptyAsDataWasDestroyed(); iterator2.MakeEmptyAsDataWasDestroyed(); } } diff --git a/src/dawn/tests/unittests/ErrorTests.cpp b/src/dawn/tests/unittests/ErrorTests.cpp index 8a3f568707..53c06cfebf 100644 --- a/src/dawn/tests/unittests/ErrorTests.cpp +++ b/src/dawn/tests/unittests/ErrorTests.cpp @@ -359,7 +359,5 @@ TEST(ErrorTests, TRY_ConversionToErrorOrResultNonPointer) { ASSERT_EQ(errorData->GetMessage(), placeholderErrorMessage); } -// TODO(https://crbug.com/dawn/1381) Remove when namespaces are not indented. -// NOLINTNEXTLINE(readability/namespace) } // namespace } // namespace dawn::native diff --git a/src/dawn/tests/unittests/FeatureTests.cpp b/src/dawn/tests/unittests/FeatureTests.cpp index 9fb6248ced..cb7d7014ce 100644 --- a/src/dawn/tests/unittests/FeatureTests.cpp +++ b/src/dawn/tests/unittests/FeatureTests.cpp @@ -84,5 +84,6 @@ TEST_F(FeatureTests, GetEnabledFeatures) { wgpu::FeatureName enabledFeature; deviceBase->APIEnumerateFeatures(&enabledFeature); EXPECT_EQ(enabledFeature, featureName); + deviceBase->APIRelease(); } } diff --git a/src/dawn/tests/unittests/ITypVectorTests.cpp b/src/dawn/tests/unittests/ITypVectorTests.cpp index 1aa82f10dc..3c3af49cb6 100644 --- a/src/dawn/tests/unittests/ITypVectorTests.cpp +++ b/src/dawn/tests/unittests/ITypVectorTests.cpp @@ -110,8 +110,6 @@ TEST_F(ITypVectorTest, MoveConstructAssign) { ASSERT_EQ(vec[Key(0)], Val(2)); ASSERT_EQ(vec[Key(1)], Val(8)); ASSERT_EQ(vec[Key(2)], Val(1)); - - ASSERT_EQ(rhs.size(), Key(0)); } // Test the move assignment @@ -123,8 +121,6 @@ TEST_F(ITypVectorTest, MoveConstructAssign) { ASSERT_EQ(vec[Key(0)], Val(2)); ASSERT_EQ(vec[Key(1)], Val(8)); ASSERT_EQ(vec[Key(2)], Val(1)); - - ASSERT_EQ(rhs.size(), Key(0)); } } diff --git a/src/dawn/tests/unittests/LimitsTests.cpp b/src/dawn/tests/unittests/LimitsTests.cpp index 3cc3cbe6ad..b0b0044928 100644 --- a/src/dawn/tests/unittests/LimitsTests.cpp +++ b/src/dawn/tests/unittests/LimitsTests.cpp @@ -34,7 +34,7 @@ TEST(Limits, ReifyDefaultLimits_PopulatesDefault) { limits.maxStorageBufferBindingSize = wgpu::kLimitU64Undefined; dawn::native::Limits reified = dawn::native::ReifyDefaultLimits(limits); - EXPECT_EQ(reified.maxComputeWorkgroupStorageSize, 16352u); + EXPECT_EQ(reified.maxComputeWorkgroupStorageSize, 16384u); EXPECT_EQ(reified.maxStorageBufferBindingSize, 134217728ul); } @@ -137,7 +137,7 @@ TEST(Limits, ApplyLimitTiers) { SetLimitsStorageBufferBindingSizeTier3(&limitsStorageBufferBindingSizeTier3); auto SetLimitsComputeWorkgroupStorageSizeTier1 = [](dawn::native::Limits* limits) { - limits->maxComputeWorkgroupStorageSize = 16352; + limits->maxComputeWorkgroupStorageSize = 16384; }; dawn::native::Limits limitsComputeWorkgroupStorageSizeTier1; dawn::native::GetDefaultLimits(&limitsComputeWorkgroupStorageSizeTier1); diff --git a/src/dawn/tests/unittests/LinkedListTests.cpp b/src/dawn/tests/unittests/LinkedListTests.cpp index 18321598c9..8737bab8e0 100644 --- a/src/dawn/tests/unittests/LinkedListTests.cpp +++ b/src/dawn/tests/unittests/LinkedListTests.cpp @@ -337,9 +337,6 @@ TEST(LinkedList, NodeMoveConstructor) { MovableNode n2_new(std::move(n2)); - EXPECT_EQ(nullptr, n2.next()); - EXPECT_EQ(nullptr, n2.previous()); - EXPECT_EQ(&n1, n2_new.previous()); EXPECT_EQ(&n2_new, n1.next()); EXPECT_EQ(&n3, n2_new.next()); diff --git a/src/dawn/tests/unittests/ObjectBaseTests.cpp b/src/dawn/tests/unittests/ObjectBaseTests.cpp index 05802750f0..56abe74fa6 100644 --- a/src/dawn/tests/unittests/ObjectBaseTests.cpp +++ b/src/dawn/tests/unittests/ObjectBaseTests.cpp @@ -159,7 +159,6 @@ TEST(ObjectBase, MoveConstructor) { Object source(&refcount); Object destination(std::move(source)); - ASSERT_EQ(source.Get(), nullptr); ASSERT_EQ(destination.Get(), &refcount); ASSERT_EQ(2, refcount); @@ -175,7 +174,6 @@ TEST(ObjectBase, MoveAssignment) { Object destination; destination = std::move(source); - ASSERT_EQ(source.Get(), nullptr); ASSERT_EQ(destination.Get(), &refcount); ASSERT_EQ(2, refcount); diff --git a/src/dawn/tests/unittests/RefBaseTests.cpp b/src/dawn/tests/unittests/RefBaseTests.cpp index dafdcf790d..6436c8a4ed 100644 --- a/src/dawn/tests/unittests/RefBaseTests.cpp +++ b/src/dawn/tests/unittests/RefBaseTests.cpp @@ -244,11 +244,7 @@ TEST(RefBase, RefMoveAssignmentSelf) { Ref& self = ref; events.clear(); - { - ref = std::move(self); - ref = std::move(self); - ref = std::move(self); - } + { ref = std::move(self); } EXPECT_THAT(events, testing::ElementsAre()); } diff --git a/src/dawn/tests/unittests/RefCountedTests.cpp b/src/dawn/tests/unittests/RefCountedTests.cpp index a1c5fca00f..5f2312e3f3 100644 --- a/src/dawn/tests/unittests/RefCountedTests.cpp +++ b/src/dawn/tests/unittests/RefCountedTests.cpp @@ -45,7 +45,7 @@ struct RCTestDerived : public RCTest { // Test that RCs start with one ref, and removing it destroys the object. TEST(RefCounted, StartsWithOneRef) { bool deleted = false; - auto test = new RCTest(&deleted); + auto* test = new RCTest(&deleted); test->Release(); EXPECT_TRUE(deleted); @@ -54,7 +54,7 @@ TEST(RefCounted, StartsWithOneRef) { // Test adding refs keep the RC alive. TEST(RefCounted, AddingRefKeepsAlive) { bool deleted = false; - auto test = new RCTest(&deleted); + auto* test = new RCTest(&deleted); test->Reference(); test->Release(); @@ -186,7 +186,6 @@ TEST(Ref, MoveConstructor) { original->Release(); EXPECT_EQ(original->GetRefCountForTesting(), 1u); - EXPECT_EQ(source.Get(), nullptr); EXPECT_EQ(destination.Get(), original); EXPECT_FALSE(deleted); @@ -209,7 +208,6 @@ TEST(Ref, MoveAssignment) { destination = std::move(source); EXPECT_EQ(original->GetRefCountForTesting(), 1u); - EXPECT_EQ(source.Get(), nullptr); EXPECT_EQ(destination.Get(), original); EXPECT_FALSE(deleted); @@ -234,7 +232,6 @@ TEST(Ref, MoveAssignmentSameObject) { referenceToSource = std::move(source); - EXPECT_EQ(source.Get(), original); EXPECT_EQ(original->GetRefCountForTesting(), 1u); EXPECT_FALSE(deleted); @@ -356,7 +353,6 @@ TEST(Ref, MoveConstructorDerived) { original->Release(); EXPECT_EQ(original->GetRefCountForTesting(), 1u); - EXPECT_EQ(source.Get(), nullptr); EXPECT_EQ(destination.Get(), original); EXPECT_FALSE(deleted); @@ -380,7 +376,6 @@ TEST(Ref, MoveAssignmentDerived) { EXPECT_EQ(original->GetRefCountForTesting(), 1u); - EXPECT_EQ(source.Get(), nullptr); EXPECT_EQ(destination.Get(), original); EXPECT_FALSE(deleted); diff --git a/src/dawn/tests/unittests/StackContainerTests.cpp b/src/dawn/tests/unittests/StackContainerTests.cpp index 432533237c..a5635b95f7 100644 --- a/src/dawn/tests/unittests/StackContainerTests.cpp +++ b/src/dawn/tests/unittests/StackContainerTests.cpp @@ -19,7 +19,7 @@ class Placeholder : public RefCounted { explicit Placeholder(int* alive) : mAlive(alive) { ++*mAlive; } private: - ~Placeholder() { --*mAlive; } + ~Placeholder() override { --*mAlive; } int* const mAlive; }; @@ -47,8 +47,9 @@ TEST(StackContainer, Vector) { } // The array should still be in order. - for (int i = 0; i < stack_size * 2; i++) + for (int i = 0; i < stack_size * 2; i++) { EXPECT_EQ(i, vect.container()[i]); + } // Resize to smaller. Our STL implementation won't reallocate in this case, // otherwise it might use our stack buffer. We reserve right after the resize @@ -64,8 +65,9 @@ TEST(StackContainer, Vector) { std::vector> other(vect.container()); EXPECT_EQ(stack_buffer, &other.front()); EXPECT_TRUE(vect.stack_data().used_stack_buffer_); - for (int i = 0; i < stack_size; i++) + for (int i = 0; i < stack_size; i++) { EXPECT_EQ(i, other[i]); + } } TEST(StackContainer, VectorDoubleDelete) { @@ -121,7 +123,7 @@ TEST(StackContainer, BufferAlignment) { aligned16->push_back(AlignedData<16>()); EXPECT_ALIGNED(&aligned16[0], 16); -#if !defined(DAWN_COMPILER_GCC) || defined(__x86_64__) || defined(__i386__) +#if !DAWN_COMPILER_IS(GCC) || defined(__x86_64__) || defined(__i386__) // It seems that non-X86 gcc doesn't respect greater than 16 byte alignment. // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33721 for details. // TODO(sbc): Re-enable this if GCC starts respecting higher alignments. diff --git a/src/dawn/tests/unittests/ToBackendTests.cpp b/src/dawn/tests/unittests/ToBackendTests.cpp index 8d64fce736..8720a27e94 100644 --- a/src/dawn/tests/unittests/ToBackendTests.cpp +++ b/src/dawn/tests/unittests/ToBackendTests.cpp @@ -19,17 +19,23 @@ #include "dawn/common/RefCounted.h" #include "dawn/native/ToBackend.h" -// Make our own Base - Backend object pair, reusing the AdapterBase name +// Make our own Base - Backend object pair, reusing the MyObjectBase name namespace dawn::native { -class AdapterBase : public RefCounted {}; -class MyAdapter : public AdapterBase {}; +class MyObjectBase : public RefCounted {}; + +class MyObject : public MyObjectBase {}; struct MyBackendTraits { - using AdapterType = MyAdapter; + using MyObjectType = MyObject; }; -// Instanciate ToBackend for our "backend" +template +struct ToBackendTraits { + using BackendType = typename BackendTraits::MyObjectType; +}; + +// Instantiate ToBackend for our "backend" template auto ToBackend(T&& common) -> decltype(ToBackendBase(common)) { return ToBackendBase(common); @@ -38,49 +44,48 @@ auto ToBackend(T&& common) -> decltype(ToBackendBase(common)) { // Test that ToBackend correctly converts pointers to base classes. TEST(ToBackend, Pointers) { { - MyAdapter* adapter = new MyAdapter; - const AdapterBase* base = adapter; + MyObject* myObject = new MyObject; + const MyObjectBase* base = myObject; - auto backendAdapter = ToBackend(base); - static_assert(std::is_same::value); - ASSERT_EQ(adapter, backendAdapter); + auto* backendAdapter = ToBackend(base); + static_assert(std::is_same::value); + ASSERT_EQ(myObject, backendAdapter); - adapter->Release(); + myObject->Release(); } { - MyAdapter* adapter = new MyAdapter; - AdapterBase* base = adapter; + MyObject* myObject = new MyObject; + MyObjectBase* base = myObject; - auto backendAdapter = ToBackend(base); - static_assert(std::is_same::value); - ASSERT_EQ(adapter, backendAdapter); + auto* backendAdapter = ToBackend(base); + static_assert(std::is_same::value); + ASSERT_EQ(myObject, backendAdapter); - adapter->Release(); + myObject->Release(); } } // Test that ToBackend correctly converts Refs to base classes. TEST(ToBackend, Ref) { { - MyAdapter* adapter = new MyAdapter; - const Ref base(adapter); + MyObject* myObject = new MyObject; + const Ref base(myObject); const auto& backendAdapter = ToBackend(base); - static_assert(std::is_same&>::value); - ASSERT_EQ(adapter, backendAdapter.Get()); + static_assert(std::is_same&>::value); + ASSERT_EQ(myObject, backendAdapter.Get()); - adapter->Release(); + myObject->Release(); } { - MyAdapter* adapter = new MyAdapter; - Ref base(adapter); + MyObject* myObject = new MyObject; + Ref base(myObject); auto backendAdapter = ToBackend(base); - static_assert(std::is_same&>::value); - ASSERT_EQ(adapter, backendAdapter.Get()); + static_assert(std::is_same&>::value); + ASSERT_EQ(myObject, backendAdapter.Get()); - adapter->Release(); + myObject->Release(); } } - } // namespace dawn::native diff --git a/src/dawn/tests/unittests/VersionTests.cpp b/src/dawn/tests/unittests/VersionTests.cpp deleted file mode 100644 index ae7ea8b3fb..0000000000 --- a/src/dawn/tests/unittests/VersionTests.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -#include "dawn/common/Version_autogen.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -namespace dawn { -namespace { - -using ::testing::SizeIs; - -TEST(VersionTests, GitCommitHashLength) { - // Git hashes should be 40 characters long. - EXPECT_THAT(std::string(kGitHash), SizeIs(40)); -} - -} // namespace -} // namespace dawn diff --git a/src/dawn/tests/unittests/native/BlobTests.cpp b/src/dawn/tests/unittests/native/BlobTests.cpp new file mode 100644 index 0000000000..4bf081d172 --- /dev/null +++ b/src/dawn/tests/unittests/native/BlobTests.cpp @@ -0,0 +1,224 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "dawn/common/Math.h" +#include "dawn/native/Blob.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +namespace dawn::native { + +namespace { + +// Test that a blob starts empty. +TEST(BlobTests, DefaultEmpty) { + Blob b; + EXPECT_TRUE(b.Empty()); + EXPECT_EQ(b.Data(), nullptr); + EXPECT_EQ(b.Size(), 0u); +} + +// Test that you can create a blob with a size in bytes and write/read its contents. +TEST(BlobTests, SizedCreation) { + Blob b = CreateBlob(10); + EXPECT_FALSE(b.Empty()); + EXPECT_EQ(b.Size(), 10u); + ASSERT_NE(b.Data(), nullptr); + // We should be able to copy 10 bytes into the blob. + char data[10] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; + memcpy(b.Data(), data, sizeof(data)); + // And retrieve the exact contents back. + EXPECT_EQ(memcmp(b.Data(), data, sizeof(data)), 0); +} + +// Test that you can create a zero-sized blob. +TEST(BlobTests, EmptySizedCreation) { + Blob b = CreateBlob(0); + EXPECT_TRUE(b.Empty()); + EXPECT_EQ(b.Data(), nullptr); + EXPECT_EQ(b.Size(), 0u); +} + +// Test that you can create a blob with UnsafeCreateWithDeleter, and the deleter is +// called on destruction. +TEST(BlobTests, UnsafeCreateWithDeleter) { + unsigned char data[13] = "hello world!"; + testing::StrictMock> mockDeleter; + { + // Make a blob with a mock deleter. + Blob b = Blob::UnsafeCreateWithDeleter(data, sizeof(data), [&]() { mockDeleter.Call(); }); + // Check the contents. + EXPECT_FALSE(b.Empty()); + EXPECT_EQ(b.Size(), sizeof(data)); + ASSERT_EQ(b.Data(), data); + EXPECT_EQ(memcmp(b.Data(), data, sizeof(data)), 0); + + // |b| is deleted when this scope exits. + EXPECT_CALL(mockDeleter, Call()); + } +} + +// Test that you can create a blob with UnsafeCreateWithDeleter with zero size but non-null data. +// The deleter is still called on destruction, and the blob is normalized to be empty. +TEST(BlobTests, UnsafeCreateWithDeleterZeroSize) { + unsigned char data[13] = "hello world!"; + testing::StrictMock> mockDeleter; + { + // Make a blob with a mock deleter. + Blob b = Blob::UnsafeCreateWithDeleter(data, 0, [&]() { mockDeleter.Call(); }); + // Check the contents. + EXPECT_TRUE(b.Empty()); + EXPECT_EQ(b.Size(), 0u); + // Data still points to the data. + EXPECT_EQ(b.Data(), data); + + // |b| is deleted when this scope exits. + EXPECT_CALL(mockDeleter, Call()); + } +} + +// Test that you can create a blob with UnsafeCreateWithDeleter that points to nothing. +// The deleter should still be called. +TEST(BlobTests, UnsafeCreateWithDeleterEmpty) { + testing::StrictMock> mockDeleter; + { + // Make a blob with a mock deleter. + Blob b = Blob::UnsafeCreateWithDeleter(nullptr, 0, [&]() { mockDeleter.Call(); }); + // Check the contents. + EXPECT_TRUE(b.Empty()); + EXPECT_EQ(b.Size(), 0u); + EXPECT_EQ(b.Data(), nullptr); + + // |b| is deleted when this scope exits. + EXPECT_CALL(mockDeleter, Call()); + } +} + +// Test that move construction moves the data from one blob into the new one. +TEST(BlobTests, MoveConstruct) { + // Create the blob. + Blob b1 = CreateBlob(10); + char data[10] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; + memcpy(b1.Data(), data, sizeof(data)); + + // Move construct b2 from b1. + Blob b2(std::move(b1)); + + // Data should be moved. + EXPECT_FALSE(b2.Empty()); + EXPECT_EQ(b2.Size(), 10u); + ASSERT_NE(b2.Data(), nullptr); + EXPECT_EQ(memcmp(b2.Data(), data, sizeof(data)), 0); +} + +// Test that move assignment moves the data from one blob into another. +TEST(BlobTests, MoveAssign) { + // Create the blob. + Blob b1 = CreateBlob(10); + char data[10] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; + memcpy(b1.Data(), data, sizeof(data)); + + // Move assign b2 from b1. + Blob b2; + b2 = std::move(b1); + + // Data should be moved. + EXPECT_FALSE(b2.Empty()); + EXPECT_EQ(b2.Size(), 10u); + ASSERT_NE(b2.Data(), nullptr); + EXPECT_EQ(memcmp(b2.Data(), data, sizeof(data)), 0); +} + +// Test that move assignment can replace the contents of the moved-to blob. +TEST(BlobTests, MoveAssignOver) { + // Create the blob. + Blob b1 = CreateBlob(10); + char data[10] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; + memcpy(b1.Data(), data, sizeof(data)); + + // Create another blob with a mock deleter. + testing::StrictMock> mockDeleter; + Blob b2 = Blob::UnsafeCreateWithDeleter(nullptr, 0, [&]() { mockDeleter.Call(); }); + + // Move b1 into b2, replacing b2's contents, and expect the deleter to be called. + EXPECT_CALL(mockDeleter, Call()); + b2 = std::move(b1); + + // Data should be moved. + EXPECT_FALSE(b2.Empty()); + EXPECT_EQ(b2.Size(), 10u); + ASSERT_NE(b2.Data(), nullptr); + EXPECT_EQ(memcmp(b2.Data(), data, sizeof(data)), 0); +} + +// Test that an empty blob can be requested to have a particular alignment. +TEST(BlobTests, EmptyAlignTo) { + for (size_t alignment : {1, 2, 4, 8, 16, 32}) { + Blob b; + EXPECT_TRUE(b.Empty()); + EXPECT_EQ(b.Size(), 0u); + EXPECT_EQ(b.Data(), nullptr); + b.AlignTo(alignment); + // After aligning, it is still empty. + EXPECT_TRUE(b.Empty()); + EXPECT_EQ(b.Size(), 0u); + EXPECT_EQ(b.Data(), nullptr); + } +} + +// Test that AlignTo makes a blob have a particular alignment. +TEST(BlobTests, AlignTo) { + uint8_t data[64]; + for (uint8_t i = 0; i < sizeof(data); ++i) { + data[i] = i; + } + // Test multiple alignments. + for (size_t alignment : {1, 2, 4, 8, 16, 32}) { + for (size_t offset = 0; offset < alignment; ++offset) { + // Make a blob pointing to |data| starting at |offset|. + size_t size = sizeof(data) - offset; + testing::StrictMock> mockDeleter; + Blob b = + Blob::UnsafeCreateWithDeleter(&data[offset], size, [&]() { mockDeleter.Call(); }); + bool alreadyAligned = IsPtrAligned(&data[offset], alignment); + + // The backing store should be deleted at the end of the scope, or because it was + // replaced. + EXPECT_CALL(mockDeleter, Call()); + + b.AlignTo(alignment); + if (!alreadyAligned) { + // If the Blob is not aligned, its data will be deleted and replaced by AlignTo. + testing::Mock::VerifyAndClearExpectations(&mockDeleter); + } + // The blob should not have changed in size. + EXPECT_EQ(b.Size(), size) << "alignment = " << alignment << " offset = " << offset; + // The data should be aligned. + EXPECT_TRUE(IsPtrAligned(b.Data(), alignment)) + << "alignment = " << alignment << " offset = " << offset; + // The contents should be the same. + EXPECT_EQ(memcmp(b.Data(), &data[offset], size), 0) + << "alignment = " << alignment << " offset = " << offset; + // If the data was already aligned, the blob should point to the same memory. + EXPECT_EQ(alreadyAligned, b.Data() == &data[offset]) + << "alignment = " << alignment << " offset = " << offset; + } + } +} + +} // namespace + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/CacheKeyTests.cpp b/src/dawn/tests/unittests/native/CacheKeyTests.cpp deleted file mode 100644 index abd1acc072..0000000000 --- a/src/dawn/tests/unittests/native/CacheKeyTests.cpp +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include - -#include "dawn/native/CacheKey.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -namespace dawn::native { - -// Testing classes with mock serializing implemented for testing. -class A { - public: - MOCK_METHOD(void, SerializeMock, (CacheKey*, const A&), (const)); -}; -template <> -void CacheKeySerializer::Serialize(CacheKey* key, const A& t) { - t.SerializeMock(key, t); -} - -// Custom printer for CacheKey for clearer debug testing messages. -void PrintTo(const CacheKey& key, std::ostream* stream) { - *stream << std::hex; - for (const int b : key) { - *stream << std::setfill('0') << std::setw(2) << b << " "; - } - *stream << std::dec; -} - -namespace { - -using ::testing::InSequence; -using ::testing::NotNull; -using ::testing::PrintToString; -using ::testing::Ref; - -// Matcher to compare CacheKeys for easier testing. -MATCHER_P(CacheKeyEq, key, PrintToString(key)) { - return arg.size() == key.size() && memcmp(arg.data(), key.data(), key.size()) == 0; -} - -TEST(CacheKeyTests, RecordSingleMember) { - CacheKey key; - - A a; - EXPECT_CALL(a, SerializeMock(NotNull(), Ref(a))).Times(1); - EXPECT_THAT(key.Record(a), CacheKeyEq(CacheKey())); -} - -TEST(CacheKeyTests, RecordManyMembers) { - constexpr size_t kNumMembers = 100; - - CacheKey key; - for (size_t i = 0; i < kNumMembers; ++i) { - A a; - EXPECT_CALL(a, SerializeMock(NotNull(), Ref(a))).Times(1); - key.Record(a); - } - EXPECT_THAT(key, CacheKeyEq(CacheKey())); -} - -TEST(CacheKeyTests, RecordIterable) { - constexpr size_t kIterableSize = 100; - - // Expecting the size of the container. - CacheKey expected; - expected.Record(kIterableSize); - - std::vector iterable(kIterableSize); - { - InSequence seq; - for (const auto& a : iterable) { - EXPECT_CALL(a, SerializeMock(NotNull(), Ref(a))).Times(1); - } - for (const auto& a : iterable) { - EXPECT_CALL(a, SerializeMock(NotNull(), Ref(a))).Times(1); - } - } - - EXPECT_THAT(CacheKey().RecordIterable(iterable), CacheKeyEq(expected)); - EXPECT_THAT(CacheKey().RecordIterable(iterable.data(), kIterableSize), CacheKeyEq(expected)); -} - -TEST(CacheKeyTests, RecordNested) { - CacheKey expected; - CacheKey actual; - { - // Recording a single member. - A a; - EXPECT_CALL(a, SerializeMock(NotNull(), Ref(a))).Times(1); - actual.Record(CacheKey().Record(a)); - } - { - // Recording multiple members. - constexpr size_t kNumMembers = 2; - CacheKey sub; - for (size_t i = 0; i < kNumMembers; ++i) { - A a; - EXPECT_CALL(a, SerializeMock(NotNull(), Ref(a))).Times(1); - sub.Record(a); - } - actual.Record(sub); - } - { - // Record an iterable. - constexpr size_t kIterableSize = 2; - expected.Record(kIterableSize); - std::vector iterable(kIterableSize); - { - InSequence seq; - for (const auto& a : iterable) { - EXPECT_CALL(a, SerializeMock(NotNull(), Ref(a))).Times(1); - } - } - actual.Record(CacheKey().RecordIterable(iterable)); - } - EXPECT_THAT(actual, CacheKeyEq(expected)); -} - -TEST(CacheKeySerializerTests, IntegralTypes) { - // Only testing explicitly sized types for simplicity, and using 0s for larger types to - // avoid dealing with endianess. - EXPECT_THAT(CacheKey().Record('c'), CacheKeyEq(CacheKey({'c'}))); - EXPECT_THAT(CacheKey().Record(uint8_t(255)), CacheKeyEq(CacheKey({255}))); - EXPECT_THAT(CacheKey().Record(uint16_t(0)), CacheKeyEq(CacheKey({0, 0}))); - EXPECT_THAT(CacheKey().Record(uint32_t(0)), CacheKeyEq(CacheKey({0, 0, 0, 0}))); -} - -TEST(CacheKeySerializerTests, FloatingTypes) { - // Using 0s to avoid dealing with implementation specific float details. - EXPECT_THAT(CacheKey().Record(float{0}), CacheKeyEq(CacheKey(sizeof(float), 0))); - EXPECT_THAT(CacheKey().Record(double{0}), CacheKeyEq(CacheKey(sizeof(double), 0))); -} - -TEST(CacheKeySerializerTests, LiteralStrings) { - // Using a std::string here to help with creating the expected result. - std::string str = "string"; - - CacheKey expected; - expected.Record(size_t(7)); - expected.insert(expected.end(), str.begin(), str.end()); - expected.push_back('\0'); - - EXPECT_THAT(CacheKey().Record("string"), CacheKeyEq(expected)); -} - -TEST(CacheKeySerializerTests, StdStrings) { - std::string str = "string"; - - CacheKey expected; - expected.Record((size_t)6); - expected.insert(expected.end(), str.begin(), str.end()); - - EXPECT_THAT(CacheKey().Record(str), CacheKeyEq(expected)); -} - -TEST(CacheKeySerializerTests, CacheKeys) { - CacheKey data = {'d', 'a', 't', 'a'}; - - CacheKey expected; - expected.insert(expected.end(), data.begin(), data.end()); - - EXPECT_THAT(CacheKey().Record(data), CacheKeyEq(expected)); -} - -} // namespace - -} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/CacheRequestTests.cpp b/src/dawn/tests/unittests/native/CacheRequestTests.cpp new file mode 100644 index 0000000000..df575e8b25 --- /dev/null +++ b/src/dawn/tests/unittests/native/CacheRequestTests.cpp @@ -0,0 +1,321 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include + +#include "dawn/native/Blob.h" +#include "dawn/native/CacheRequest.h" +#include "dawn/tests/DawnNativeTest.h" +#include "dawn/tests/mocks/platform/CachingInterfaceMock.h" + +namespace dawn::native { + +namespace { + +using ::testing::_; +using ::testing::ByMove; +using ::testing::Invoke; +using ::testing::MockFunction; +using ::testing::Return; +using ::testing::StrictMock; +using ::testing::WithArg; + +class CacheRequestTests : public DawnNativeTest { + protected: + std::unique_ptr CreateTestPlatform() override { + return std::make_unique(&mMockCache); + } + + WGPUDevice CreateTestDevice() override { + wgpu::DeviceDescriptor deviceDescriptor = {}; + wgpu::DawnTogglesDeviceDescriptor togglesDesc = {}; + deviceDescriptor.nextInChain = &togglesDesc; + + const char* toggle = "enable_blob_cache"; + togglesDesc.forceEnabledToggles = &toggle; + togglesDesc.forceEnabledTogglesCount = 1; + + return adapter.CreateDevice(&deviceDescriptor); + } + + DeviceBase* GetDevice() { return dawn::native::FromAPI(device.Get()); } + + StrictMock mMockCache; +}; + +struct Foo { + int value; +}; + +#define REQUEST_MEMBERS(X) \ + X(int, a) \ + X(float, b) \ + X(std::vector, c) \ + X(CacheKey::UnsafeUnkeyedValue, d) \ + X(CacheKey::UnsafeUnkeyedValue, e) + +DAWN_MAKE_CACHE_REQUEST(CacheRequestForTesting, REQUEST_MEMBERS); + +#undef REQUEST_MEMBERS + +// static_assert the expected types for various return types from the cache hit handler and cache +// miss handler. +TEST_F(CacheRequestTests, CacheResultTypes) { + EXPECT_CALL(mMockCache, LoadData(_, _, nullptr, 0)).WillRepeatedly(Return(0)); + + // (int, ResultOrError), should be ResultOrError>. + auto v1 = LoadOrRun( + GetDevice(), CacheRequestForTesting{}, [](Blob) -> int { return 0; }, + [](CacheRequestForTesting) -> ResultOrError { return 1; }); + v1.AcquireSuccess(); + static_assert(std::is_same_v>, decltype(v1)>); + + // (ResultOrError, ResultOrError), should be ResultOrError>. + auto v2 = LoadOrRun( + GetDevice(), CacheRequestForTesting{}, [](Blob) -> ResultOrError { return 0.0; }, + [](CacheRequestForTesting) -> ResultOrError { return 1.0; }); + v2.AcquireSuccess(); + static_assert(std::is_same_v>, decltype(v2)>); +} + +// Test that using a CacheRequest builds a key from the device key, the request type enum, and all +// of the request members. +TEST_F(CacheRequestTests, MakesCacheKey) { + // Make a request. + CacheRequestForTesting req; + req.a = 1; + req.b = 0.2; + req.c = {3, 4, 5}; + + // Make the expected key. + CacheKey expectedKey; + StreamIn(&expectedKey, GetDevice()->GetCacheKey(), "CacheRequestForTesting", req.a, req.b, + req.c); + + // Expect a call to LoadData with the expected key. + EXPECT_CALL(mMockCache, LoadData(_, expectedKey.size(), nullptr, 0)) + .WillOnce(WithArg<0>(Invoke([&](const void* actualKeyData) { + EXPECT_EQ(memcmp(actualKeyData, expectedKey.data(), expectedKey.size()), 0); + return 0; + }))); + + // Load the request. + auto result = LoadOrRun( + GetDevice(), std::move(req), [](Blob) -> int { return 0; }, + [](CacheRequestForTesting) -> ResultOrError { return 0; }) + .AcquireSuccess(); + + // The created cache key should be saved on the result. + EXPECT_EQ(result.GetCacheKey().size(), expectedKey.size()); + EXPECT_EQ(memcmp(result.GetCacheKey().data(), expectedKey.data(), expectedKey.size()), 0); +} + +// Test that members that are wrapped in UnsafeUnkeyedValue do not impact the key. +TEST_F(CacheRequestTests, CacheKeyIgnoresUnsafeIgnoredValue) { + // Make two requests with different UnsafeUnkeyedValues (UnsafeUnkeyed is declared on the struct + // definition). + int v1, v2; + CacheRequestForTesting req1; + req1.d = &v1; + req1.e = Foo{42}; + + CacheRequestForTesting req2; + req2.d = &v2; + req2.e = Foo{24}; + + EXPECT_CALL(mMockCache, LoadData(_, _, nullptr, 0)).WillOnce(Return(0)).WillOnce(Return(0)); + + static StrictMock> cacheMissFn; + + // Load the first request, and check that the unsafe unkeyed values were passed though + EXPECT_CALL(cacheMissFn, Call(_)).WillOnce(WithArg<0>(Invoke([&](CacheRequestForTesting req) { + EXPECT_EQ(req.d.UnsafeGetValue(), &v1); + EXPECT_FLOAT_EQ(req.e.UnsafeGetValue().value, 42); + return 0; + }))); + auto r1 = LoadOrRun( + GetDevice(), std::move(req1), [](Blob) { return 0; }, + [](CacheRequestForTesting req) -> ResultOrError { + return cacheMissFn.Call(std::move(req)); + }) + .AcquireSuccess(); + + // Load the second request, and check that the unsafe unkeyed values were passed though + EXPECT_CALL(cacheMissFn, Call(_)).WillOnce(WithArg<0>(Invoke([&](CacheRequestForTesting req) { + EXPECT_EQ(req.d.UnsafeGetValue(), &v2); + EXPECT_FLOAT_EQ(req.e.UnsafeGetValue().value, 24); + return 0; + }))); + auto r2 = LoadOrRun( + GetDevice(), std::move(req2), [](Blob) { return 0; }, + [](CacheRequestForTesting req) -> ResultOrError { + return cacheMissFn.Call(std::move(req)); + }) + .AcquireSuccess(); + + // Expect their keys to be the same. + EXPECT_EQ(r1.GetCacheKey().size(), r2.GetCacheKey().size()); + EXPECT_EQ(memcmp(r1.GetCacheKey().data(), r2.GetCacheKey().data(), r1.GetCacheKey().size()), 0); +} + +// Test the expected code path when there is a cache miss. +TEST_F(CacheRequestTests, CacheMiss) { + // Make a request. + CacheRequestForTesting req; + req.a = 1; + req.b = 0.2; + req.c = {3, 4, 5}; + + unsigned int* cPtr = req.c.data(); + + static StrictMock> cacheHitFn; + static StrictMock> cacheMissFn; + + // Mock a cache miss. + EXPECT_CALL(mMockCache, LoadData(_, _, nullptr, 0)).WillOnce(Return(0)); + + // Expect the cache miss, and return some value. + int rv = 42; + EXPECT_CALL(cacheMissFn, Call(_)).WillOnce(WithArg<0>(Invoke([=](CacheRequestForTesting req) { + // Expect the request contents to be the same. The data pointer for |c| is also the same + // since it was moved. + EXPECT_EQ(req.a, 1); + EXPECT_FLOAT_EQ(req.b, 0.2); + EXPECT_EQ(req.c.data(), cPtr); + return rv; + }))); + + // Load the request. + auto result = LoadOrRun( + GetDevice(), std::move(req), + [](Blob blob) -> int { return cacheHitFn.Call(std::move(blob)); }, + [](CacheRequestForTesting req) -> ResultOrError { + return cacheMissFn.Call(std::move(req)); + }) + .AcquireSuccess(); + + // Expect the result to store the value. + EXPECT_EQ(*result, rv); + EXPECT_FALSE(result.IsCached()); +} + +// Test the expected code path when there is a cache hit. +TEST_F(CacheRequestTests, CacheHit) { + // Make a request. + CacheRequestForTesting req; + req.a = 1; + req.b = 0.2; + req.c = {3, 4, 5}; + + static StrictMock> cacheHitFn; + static StrictMock> cacheMissFn; + + static constexpr char kCachedData[] = "hello world!"; + + // Mock a cache hit, and load the cached data. + EXPECT_CALL(mMockCache, LoadData(_, _, nullptr, 0)).WillOnce(Return(sizeof(kCachedData))); + EXPECT_CALL(mMockCache, LoadData(_, _, _, sizeof(kCachedData))) + .WillOnce(WithArg<2>(Invoke([](void* dataOut) { + memcpy(dataOut, kCachedData, sizeof(kCachedData)); + return sizeof(kCachedData); + }))); + + // Expect the cache hit, and return some value. + int rv = 1337; + EXPECT_CALL(cacheHitFn, Call(_)).WillOnce(WithArg<0>(Invoke([=](Blob blob) { + // Expect the cached blob contents to match the cached data. + EXPECT_EQ(blob.Size(), sizeof(kCachedData)); + EXPECT_EQ(memcmp(blob.Data(), kCachedData, sizeof(kCachedData)), 0); + + return rv; + }))); + + // Load the request. + auto result = LoadOrRun( + GetDevice(), std::move(req), + [](Blob blob) -> int { return cacheHitFn.Call(std::move(blob)); }, + [](CacheRequestForTesting req) -> ResultOrError { + return cacheMissFn.Call(std::move(req)); + }) + .AcquireSuccess(); + + // Expect the result to store the value. + EXPECT_EQ(*result, rv); + EXPECT_TRUE(result.IsCached()); +} + +// Test the expected code path when there is a cache hit but the handler errors. +TEST_F(CacheRequestTests, CacheHitError) { + // Make a request. + CacheRequestForTesting req; + req.a = 1; + req.b = 0.2; + req.c = {3, 4, 5}; + + unsigned int* cPtr = req.c.data(); + + static StrictMock(Blob)>> cacheHitFn; + static StrictMock> cacheMissFn; + + static constexpr char kCachedData[] = "hello world!"; + + // Mock a cache hit, and load the cached data. + EXPECT_CALL(mMockCache, LoadData(_, _, nullptr, 0)).WillOnce(Return(sizeof(kCachedData))); + EXPECT_CALL(mMockCache, LoadData(_, _, _, sizeof(kCachedData))) + .WillOnce(WithArg<2>(Invoke([](void* dataOut) { + memcpy(dataOut, kCachedData, sizeof(kCachedData)); + return sizeof(kCachedData); + }))); + + // Expect the cache hit. + EXPECT_CALL(cacheHitFn, Call(_)).WillOnce(WithArg<0>(Invoke([=](Blob blob) { + // Expect the cached blob contents to match the cached data. + EXPECT_EQ(blob.Size(), sizeof(kCachedData)); + EXPECT_EQ(memcmp(blob.Data(), kCachedData, sizeof(kCachedData)), 0); + + // Return an error. + return DAWN_VALIDATION_ERROR("fake test error"); + }))); + + // Expect the cache miss handler since the cache hit errored. + int rv = 79; + EXPECT_CALL(cacheMissFn, Call(_)).WillOnce(WithArg<0>(Invoke([=](CacheRequestForTesting req) { + // Expect the request contents to be the same. The data pointer for |c| is also the same + // since it was moved. + EXPECT_EQ(req.a, 1); + EXPECT_FLOAT_EQ(req.b, 0.2); + EXPECT_EQ(req.c.data(), cPtr); + return rv; + }))); + + // Load the request. + auto result = + LoadOrRun( + GetDevice(), std::move(req), + [](Blob blob) -> ResultOrError { return cacheHitFn.Call(std::move(blob)); }, + [](CacheRequestForTesting req) -> ResultOrError { + return cacheMissFn.Call(std::move(req)); + }) + .AcquireSuccess(); + + // Expect the result to store the value. + EXPECT_EQ(*result, rv); + EXPECT_FALSE(result.IsCached()); +} + +} // namespace + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/CommandBufferEncodingTests.cpp b/src/dawn/tests/unittests/native/CommandBufferEncodingTests.cpp index cf76918a95..aaf1f3b5f6 100644 --- a/src/dawn/tests/unittests/native/CommandBufferEncodingTests.cpp +++ b/src/dawn/tests/unittests/native/CommandBufferEncodingTests.cpp @@ -60,7 +60,7 @@ TEST_F(CommandBufferEncodingTests, ComputePassEncoderIndirectDispatchStateRestor // Create a simple pipeline wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main() { })"); csDesc.compute.entryPoint = "main"; @@ -290,7 +290,7 @@ TEST_F(CommandBufferEncodingTests, StateNotLeakedAfterRestore) { // Create a simple pipeline wgpu::ComputePipelineDescriptor csDesc; csDesc.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1, 1, 1) + @compute @workgroup_size(1, 1, 1) fn main() { })"); csDesc.compute.entryPoint = "main"; diff --git a/src/dawn/tests/unittests/native/DestroyObjectTests.cpp b/src/dawn/tests/unittests/native/DestroyObjectTests.cpp index dd57ed5479..2cfb844d75 100644 --- a/src/dawn/tests/unittests/native/DestroyObjectTests.cpp +++ b/src/dawn/tests/unittests/native/DestroyObjectTests.cpp @@ -73,7 +73,7 @@ class DestroyObjectTests : public Test { } DAWN_TRY_ASSIGN_WITH_CLEANUP( mVsModule, ShaderModuleMock::Create(&mDevice, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"), { ASSERT(false); }, mVsModule); @@ -87,7 +87,7 @@ class DestroyObjectTests : public Test { } DAWN_TRY_ASSIGN_WITH_CLEANUP( mCsModule, ShaderModuleMock::Create(&mDevice, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"), { ASSERT(false); }, mCsModule); EXPECT_CALL(*mCsModule.Get(), DestroyImpl).Times(1); @@ -428,7 +428,7 @@ TEST_F(DestroyObjectTests, ShaderModuleImplicit) { { ShaderModuleWGSLDescriptor wgslDesc; wgslDesc.source = R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { } )"; ShaderModuleDescriptor desc = {}; @@ -698,7 +698,7 @@ TEST_F(DestroyObjectTests, DestroyObjects) { { ShaderModuleWGSLDescriptor wgslDesc; wgslDesc.source = R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { } )"; ShaderModuleDescriptor desc = {}; @@ -755,17 +755,17 @@ TEST_F(DestroyObjectTests, DestroyObjects) { } static constexpr std::string_view kComputeShader = R"( - @stage(compute) @workgroup_size(1) fn main() {} + @compute @workgroup_size(1) fn main() {} )"; static constexpr std::string_view kVertexShader = R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } )"; static constexpr std::string_view kFragmentShader = R"( - @stage(fragment) fn main() {} + @fragment fn main() {} )"; class DestroyObjectRegressionTests : public DawnNativeTest {}; @@ -812,7 +812,5 @@ TEST_F(DestroyObjectRegressionTests, LastRefInCommandComputePipeline) { device.Destroy(); } -// TODO(https://crbug.com/dawn/1381) Remove when namespaces are not indented. -// NOLINTNEXTLINE(readability/namespace) } // namespace } // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/StreamTests.cpp b/src/dawn/tests/unittests/native/StreamTests.cpp new file mode 100644 index 0000000000..2246fb3bba --- /dev/null +++ b/src/dawn/tests/unittests/native/StreamTests.cpp @@ -0,0 +1,487 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include +#include +#include +#include + +#include "dawn/common/TypedInteger.h" +#include "dawn/native/Blob.h" +#include "dawn/native/Serializable.h" +#include "dawn/native/stream/BlobSource.h" +#include "dawn/native/stream/ByteVectorSink.h" +#include "dawn/native/stream/Stream.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "tint/tint.h" + +namespace dawn::native::stream { + +// Testing classes with mock serializing implemented for testing. +class A { + public: + MOCK_METHOD(void, WriteMock, (stream::Sink*, const A&), (const)); +}; +template <> +void stream::Stream::Write(stream::Sink* s, const A& t) { + t.WriteMock(s, t); +} + +struct Nested { + A a1; + A a2; +}; +template <> +void stream::Stream::Write(stream::Sink* s, const Nested& t) { + StreamIn(s, t.a1); + StreamIn(s, t.a2); +} + +// Custom printer for ByteVectorSink for clearer debug testing messages. +void PrintTo(const ByteVectorSink& key, std::ostream* stream) { + *stream << std::hex; + for (const int b : key) { + *stream << std::setfill('0') << std::setw(2) << b << " "; + } + *stream << std::dec; +} + +namespace { + +using ::testing::InSequence; +using ::testing::NotNull; +using ::testing::PrintToString; +using ::testing::Ref; + +using TypedIntegerForTest = TypedInteger; + +// Matcher to compare ByteVectorSinks for easier testing. +MATCHER_P(VectorEq, key, PrintToString(key)) { + return arg.size() == key.size() && memcmp(arg.data(), key.data(), key.size()) == 0; +} + +#define EXPECT_CACHE_KEY_EQ(lhs, rhs) \ + do { \ + ByteVectorSink actual; \ + StreamIn(&actual, lhs); \ + EXPECT_THAT(actual, VectorEq(rhs)); \ + } while (0) + +// Test that ByteVectorSink calls Write on a value. +TEST(SerializeTests, CallsWrite) { + ByteVectorSink sink; + + A a; + EXPECT_CALL(a, WriteMock(NotNull(), Ref(a))).Times(1); + StreamIn(&sink, a); +} + +// Test that ByteVectorSink calls Write on all elements of an iterable. +TEST(SerializeTests, StreamInIterable) { + constexpr size_t kIterableSize = 100; + + std::vector vec(kIterableSize); + auto iterable = stream::Iterable(vec.data(), kIterableSize); + + // Expect write to be called for each element + for (const auto& a : vec) { + EXPECT_CALL(a, WriteMock(NotNull(), Ref(a))).Times(1); + } + + ByteVectorSink sink; + StreamIn(&sink, iterable); + + // Expecting the size of the container. + ByteVectorSink expected; + StreamIn(&expected, kIterableSize); + EXPECT_THAT(sink, VectorEq(expected)); +} + +// Test that ByteVectorSink calls Write on all nested members of a struct. +TEST(SerializeTests, StreamInNested) { + ByteVectorSink sink; + + Nested n; + EXPECT_CALL(n.a1, WriteMock(NotNull(), Ref(n.a1))).Times(1); + EXPECT_CALL(n.a2, WriteMock(NotNull(), Ref(n.a2))).Times(1); + StreamIn(&sink, n); +} + +// Test that ByteVectorSink serializes integral data as expected. +TEST(SerializeTests, IntegralTypes) { + // Only testing explicitly sized types for simplicity, and using 0s for larger types to + // avoid dealing with endianess. + EXPECT_CACHE_KEY_EQ('c', ByteVectorSink({'c'})); + EXPECT_CACHE_KEY_EQ(uint8_t(255), ByteVectorSink({255})); + EXPECT_CACHE_KEY_EQ(uint16_t(0), ByteVectorSink({0, 0})); + EXPECT_CACHE_KEY_EQ(uint32_t(0), ByteVectorSink({0, 0, 0, 0})); +} + +// Test that ByteVectorSink serializes floating-point data as expected. +TEST(SerializeTests, FloatingTypes) { + // Using 0s to avoid dealing with implementation specific float details. + ByteVectorSink k1, k2; + EXPECT_CACHE_KEY_EQ(float{0}, ByteVectorSink(sizeof(float), 0)); + EXPECT_CACHE_KEY_EQ(double{0}, ByteVectorSink(sizeof(double), 0)); +} + +// Test that ByteVectorSink serializes literal strings as expected. +TEST(SerializeTests, LiteralStrings) { + // Using a std::string here to help with creating the expected result. + std::string str = "string"; + + ByteVectorSink expected; + expected.insert(expected.end(), str.begin(), str.end()); + expected.push_back('\0'); + + EXPECT_CACHE_KEY_EQ("string", expected); +} + +// Test that ByteVectorSink serializes std::strings as expected. +TEST(SerializeTests, StdStrings) { + std::string str = "string"; + + ByteVectorSink expected; + StreamIn(&expected, size_t(6)); + expected.insert(expected.end(), str.begin(), str.end()); + + EXPECT_CACHE_KEY_EQ(str, expected); +} + +// Test that ByteVectorSink serializes std::string_views as expected. +TEST(SerializeTests, StdStringViews) { + static constexpr std::string_view str("string"); + + ByteVectorSink expected; + StreamIn(&expected, size_t(6)); + expected.insert(expected.end(), str.begin(), str.end()); + + EXPECT_CACHE_KEY_EQ(str, expected); +} + +// Test that ByteVectorSink serializes std::wstring_views as expected. +TEST(SerializeTests, StdWStringViews) { + static constexpr std::wstring_view str(L"Hello world!"); + + ByteVectorSink expected; + StreamIn(&expected, size_t(str.length())); + size_t bytes = str.length() * sizeof(wchar_t); + memcpy(expected.GetSpace(bytes), str.data(), bytes); + + EXPECT_CACHE_KEY_EQ(str, expected); +} + +// Test that ByteVectorSink serializes Blobs as expected. +TEST(SerializeTests, Blob) { + uint8_t data[] = "dawn native Blob"; + Blob blob = Blob::UnsafeCreateWithDeleter(data, sizeof(data), []() {}); + + ByteVectorSink expected; + StreamIn(&expected, sizeof(data)); + expected.insert(expected.end(), data, data + sizeof(data)); + + EXPECT_CACHE_KEY_EQ(blob, expected); +} + +// Test that ByteVectorSink serializes other ByteVectorSinks as expected. +TEST(SerializeTests, ByteVectorSinks) { + ByteVectorSink data = {'d', 'a', 't', 'a'}; + + ByteVectorSink expected; + expected.insert(expected.end(), data.begin(), data.end()); + + EXPECT_CACHE_KEY_EQ(data, expected); +} + +// Test that ByteVectorSink serializes std::pair as expected. +TEST(SerializeTests, StdPair) { + std::string_view s = "hi!"; + + ByteVectorSink expected; + StreamIn(&expected, s, uint32_t(42)); + + EXPECT_CACHE_KEY_EQ(std::make_pair(s, uint32_t(42)), expected); +} + +// Test that ByteVectorSink serializes std::optional as expected. +TEST(SerializeTests, StdOptional) { + std::string_view s = "webgpu"; + { + ByteVectorSink expected; + StreamIn(&expected, true, s); + + EXPECT_CACHE_KEY_EQ(std::optional(s), expected); + } + { + ByteVectorSink expected; + StreamIn(&expected, false); + + EXPECT_CACHE_KEY_EQ(std::optional(), expected); + } +} + +// Test that ByteVectorSink serializes std::unordered_map as expected. +TEST(SerializeTests, StdUnorderedMap) { + std::unordered_map m; + + m[4] = "hello"; + m[1] = "world"; + m[7] = "test"; + m[3] = "data"; + + // Expect the number of entries, followed by (K, V) pairs sorted in order of key. + ByteVectorSink expected; + StreamIn(&expected, size_t(4), std::make_pair(uint32_t(1), m[1]), + std::make_pair(uint32_t(3), m[3]), std::make_pair(uint32_t(4), m[4]), + std::make_pair(uint32_t(7), m[7])); + + EXPECT_CACHE_KEY_EQ(m, expected); +} + +// Test that ByteVectorSink serializes tint::sem::BindingPoint as expected. +TEST(SerializeTests, TintSemBindingPoint) { + tint::sem::BindingPoint bp{3, 6}; + + ByteVectorSink expected; + StreamIn(&expected, uint32_t(3), uint32_t(6)); + + EXPECT_CACHE_KEY_EQ(bp, expected); +} + +// Test that ByteVectorSink serializes tint::transform::BindingPoints as expected. +TEST(SerializeTests, TintTransformBindingPoints) { + tint::transform::BindingPoints points{ + tint::sem::BindingPoint{1, 4}, + tint::sem::BindingPoint{3, 7}, + }; + + ByteVectorSink expected; + StreamIn(&expected, uint32_t(1), uint32_t(4), uint32_t(3), uint32_t(7)); + + EXPECT_CACHE_KEY_EQ(points, expected); +} + +// Test that serializing then deserializing a param pack yields the same values. +TEST(StreamTests, SerializeDeserializeParamPack) { + int a = 1; + float b = 2.0; + std::pair c = std::make_pair("dawn", 3.4); + + ByteVectorSink sink; + StreamIn(&sink, a, b, c); + + BlobSource source(CreateBlob(std::move(sink))); + int aOut; + float bOut; + std::pair cOut; + auto err = StreamOut(&source, &aOut, &bOut, &cOut); + if (err.IsError()) { + FAIL() << err.AcquireError()->GetFormattedMessage(); + } + EXPECT_EQ(a, aOut); + EXPECT_EQ(b, bOut); + EXPECT_EQ(c, cOut); +} + +#define FOO_MEMBERS(X) \ + X(int, a) \ + X(float, b) \ + X(std::string, c) +DAWN_SERIALIZABLE(struct, Foo, FOO_MEMBERS){}; +#undef FOO_MEMBERS + +// Test that serializing then deserializing a struct made with DAWN_SERIALIZABLE works as +// expected. +TEST(StreamTests, SerializeDeserializeVisitable) { + Foo foo{{1, 2, "3"}}; + ByteVectorSink sink; + StreamIn(&sink, foo); + + // Test that the serialization is correct. + { + ByteVectorSink expected; + StreamIn(&expected, foo.a, foo.b, foo.c); + EXPECT_THAT(sink, VectorEq(expected)); + } + + // Test that deserialization works for StructMembers, passed inline. + { + BlobSource src(CreateBlob(sink)); + Foo out; + auto err = StreamOut(&src, &out); + EXPECT_FALSE(err.IsError()); + EXPECT_EQ(foo.a, out.a); + EXPECT_EQ(foo.b, out.b); + EXPECT_EQ(foo.c, out.c); + } +} + +// Test that serializing then deserializing a Blob yields the same data. +// Tested here instead of in the type-parameterized tests since Blobs are not copyable. +TEST(StreamTests, SerializeDeserializeBlobs) { + // Test an empty blob + { + Blob blob; + EXPECT_EQ(blob.Size(), 0u); + + ByteVectorSink sink; + StreamIn(&sink, blob); + + BlobSource src(CreateBlob(sink)); + Blob out; + auto err = StreamOut(&src, &out); + EXPECT_FALSE(err.IsError()); + EXPECT_EQ(blob.Size(), out.Size()); + EXPECT_EQ(memcmp(blob.Data(), out.Data(), blob.Size()), 0); + } + + // Test a blob with some data + { + Blob blob = CreateBlob(std::vector{6.24, 3.12222}); + + ByteVectorSink sink; + StreamIn(&sink, blob); + + BlobSource src(CreateBlob(sink)); + Blob out; + auto err = StreamOut(&src, &out); + EXPECT_FALSE(err.IsError()); + EXPECT_EQ(blob.Size(), out.Size()); + EXPECT_EQ(memcmp(blob.Data(), out.Data(), blob.Size()), 0); + } +} + +template +std::bitset BitsetFromBitString(const char (&str)[N]) { + // N - 1 because the last character is the null terminator. + return std::bitset(str, N - 1); +} + +static auto kStreamValueVectorParams = std::make_tuple( + // Test primitives. + std::vector{4, 5, 6, 2}, + std::vector{6.50, 78.28, 92., 8.28}, + // Test various types of strings. + std::vector{"abcdefg", "9461849495", ""}, + // Test pairs. + std::vector>{{1, 3.}, {6, 4.}}, + // Test TypedIntegers + std::vector{TypedIntegerForTest(42), TypedIntegerForTest(13)}, + // Test enums + std::vector{wgpu::TextureUsage::CopyDst, + wgpu::TextureUsage::RenderAttachment}, + // Test bitsets of various sizes. + std::vector>{0b1001011, 0b0011010, 0b0000000, 0b1111111}, + std::vector>{0x0000, 0xFFFF1}, + std::vector>{0x0C0FFEE0, 0xDEADC0DE, 0x00000000, 0xFFFFFFFF}, + std::vector>{ + BitsetFromBitString("100110010101011001100110101011001100101010110011001011011"), + BitsetFromBitString("000110010101011000100110101011001100101010010011001010100"), + BitsetFromBitString("111111111111111111111111111111111111111111111111111111111"), 0}, + // Test vectors. + std::vector>{{}, {1, 5, 2, 7, 4}, {3, 3, 3, 3, 3, 3, 3}}); + +static auto kStreamValueInitListParams = std::make_tuple( + std::initializer_list{"test string", "string test"}, + std::initializer_list{{5.435, 32.3, 1.23}, {8.2345, 0.234532, 4.435}}); + +template +struct StreamValueTestTypesImpl; + +template +struct StreamValueTestTypesImpl...>, + std::tuple...>> { + using type = ::testing::Types; +}; + +using StreamValueTestTypes = + typename StreamValueTestTypesImpl::type; + +template +class StreamParameterizedTests : public ::testing::Test { + protected: + static std::vector GetParams() { return std::get>(kStreamValueVectorParams); } + + void ExpectEq(const T& lhs, const T& rhs) { EXPECT_EQ(lhs, rhs); } +}; + +template +class StreamParameterizedTests : public ::testing::Test { + protected: + static std::initializer_list GetParams() { + return std::get>(kStreamValueInitListParams); + } + + void ExpectEq(const T lhs[N], const T rhs[N]) { EXPECT_EQ(memcmp(lhs, rhs, sizeof(T[N])), 0); } +}; + +TYPED_TEST_SUITE_P(StreamParameterizedTests); + +// Test that serializing a value, then deserializing it yields the same value. +TYPED_TEST_P(StreamParameterizedTests, SerializeDeserialize) { + for (const auto& value : this->GetParams()) { + ByteVectorSink sink; + StreamIn(&sink, value); + + BlobSource source(CreateBlob(std::move(sink))); + TypeParam deserialized; + auto err = StreamOut(&source, &deserialized); + if (err.IsError()) { + FAIL() << err.AcquireError()->GetFormattedMessage(); + } + this->ExpectEq(deserialized, value); + } +} + +// Test that serializing a value, then deserializing it with insufficient space, an error is raised. +TYPED_TEST_P(StreamParameterizedTests, SerializeDeserializeOutOfBounds) { + for (const auto& value : this->GetParams()) { + ByteVectorSink sink; + StreamIn(&sink, value); + + // Make the vector 1 byte too small. + std::vector src = sink; + src.pop_back(); + + BlobSource source(CreateBlob(std::move(src))); + TypeParam deserialized; + auto err = StreamOut(&source, &deserialized); + EXPECT_TRUE(err.IsError()); + err.AcquireError(); + } +} + +// Test that deserializing from an empty source raises an error. +TYPED_TEST_P(StreamParameterizedTests, DeserializeEmpty) { + BlobSource source(CreateBlob(0)); + TypeParam deserialized; + auto err = StreamOut(&source, &deserialized); + EXPECT_TRUE(err.IsError()); + err.AcquireError(); +} + +REGISTER_TYPED_TEST_SUITE_P(StreamParameterizedTests, + SerializeDeserialize, + SerializeDeserializeOutOfBounds, + DeserializeEmpty); +INSTANTIATE_TYPED_TEST_SUITE_P(DawnUnittests, StreamParameterizedTests, StreamValueTestTypes, ); + +} // namespace + +} // namespace dawn::native::stream diff --git a/src/dawn/tests/unittests/native/mocks/BindGroupLayoutMock.cpp b/src/dawn/tests/unittests/native/mocks/BindGroupLayoutMock.cpp new file mode 100644 index 0000000000..c2775d778d --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/BindGroupLayoutMock.cpp @@ -0,0 +1,27 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/BindGroupLayoutMock.h" + +namespace dawn::native { + +BindGroupLayoutMock::BindGroupLayoutMock(DeviceBase* device) : BindGroupLayoutBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { + this->BindGroupLayoutBase::DestroyImpl(); + }); +} + +BindGroupLayoutMock::~BindGroupLayoutMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/BindGroupLayoutMock.h b/src/dawn/tests/unittests/native/mocks/BindGroupLayoutMock.h index 72768894df..eb0183cf5f 100644 --- a/src/dawn/tests/unittests/native/mocks/BindGroupLayoutMock.h +++ b/src/dawn/tests/unittests/native/mocks/BindGroupLayoutMock.h @@ -24,12 +24,8 @@ namespace dawn::native { class BindGroupLayoutMock final : public BindGroupLayoutBase { public: - explicit BindGroupLayoutMock(DeviceBase* device) : BindGroupLayoutBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { - this->BindGroupLayoutBase::DestroyImpl(); - }); - } - ~BindGroupLayoutMock() override = default; + explicit BindGroupLayoutMock(DeviceBase* device); + ~BindGroupLayoutMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); }; diff --git a/src/dawn/tests/unittests/native/mocks/BindGroupMock.cpp b/src/dawn/tests/unittests/native/mocks/BindGroupMock.cpp new file mode 100644 index 0000000000..ca6f851c77 --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/BindGroupMock.cpp @@ -0,0 +1,25 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/BindGroupMock.h" + +namespace dawn::native { + +BindGroupMock::BindGroupMock(DeviceBase* device) : BindGroupBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->BindGroupBase::DestroyImpl(); }); +} + +BindGroupMock::~BindGroupMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/BindGroupMock.h b/src/dawn/tests/unittests/native/mocks/BindGroupMock.h index 8f5ce34288..0dd5e029ad 100644 --- a/src/dawn/tests/unittests/native/mocks/BindGroupMock.h +++ b/src/dawn/tests/unittests/native/mocks/BindGroupMock.h @@ -24,10 +24,8 @@ namespace dawn::native { class BindGroupMock : public BindGroupBase { public: - explicit BindGroupMock(DeviceBase* device) : BindGroupBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->BindGroupBase::DestroyImpl(); }); - } - ~BindGroupMock() override = default; + explicit BindGroupMock(DeviceBase* device); + ~BindGroupMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); }; diff --git a/src/dawn/tests/unittests/native/mocks/BufferMock.cpp b/src/dawn/tests/unittests/native/mocks/BufferMock.cpp new file mode 100644 index 0000000000..98b345f07d --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/BufferMock.cpp @@ -0,0 +1,26 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/BufferMock.h" + +namespace dawn::native { + +BufferMock::BufferMock(DeviceBase* device, BufferBase::BufferState state) + : BufferBase(device, state) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->BufferBase::DestroyImpl(); }); +} + +BufferMock::~BufferMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/BufferMock.h b/src/dawn/tests/unittests/native/mocks/BufferMock.h index d9d2211ae8..5bb67a575d 100644 --- a/src/dawn/tests/unittests/native/mocks/BufferMock.h +++ b/src/dawn/tests/unittests/native/mocks/BufferMock.h @@ -24,10 +24,8 @@ namespace dawn::native { class BufferMock : public BufferBase { public: - BufferMock(DeviceBase* device, BufferBase::BufferState state) : BufferBase(device, state) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->BufferBase::DestroyImpl(); }); - } - ~BufferMock() override = default; + BufferMock(DeviceBase* device, BufferBase::BufferState state); + ~BufferMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); diff --git a/src/dawn/tests/unittests/native/mocks/CommandBufferMock.cpp b/src/dawn/tests/unittests/native/mocks/CommandBufferMock.cpp new file mode 100644 index 0000000000..80c0cf3546 --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/CommandBufferMock.cpp @@ -0,0 +1,25 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/CommandBufferMock.h" + +namespace dawn::native { + +CommandBufferMock::CommandBufferMock(DeviceBase* device) : CommandBufferBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->CommandBufferBase::DestroyImpl(); }); +} + +CommandBufferMock::~CommandBufferMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/CommandBufferMock.h b/src/dawn/tests/unittests/native/mocks/CommandBufferMock.h index 01843e8e72..f15a46b639 100644 --- a/src/dawn/tests/unittests/native/mocks/CommandBufferMock.h +++ b/src/dawn/tests/unittests/native/mocks/CommandBufferMock.h @@ -24,12 +24,8 @@ namespace dawn::native { class CommandBufferMock : public CommandBufferBase { public: - explicit CommandBufferMock(DeviceBase* device) : CommandBufferBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { - this->CommandBufferBase::DestroyImpl(); - }); - } - ~CommandBufferMock() override = default; + explicit CommandBufferMock(DeviceBase* device); + ~CommandBufferMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); }; diff --git a/src/dawn/tests/unittests/native/mocks/ComputePipelineMock.cpp b/src/dawn/tests/unittests/native/mocks/ComputePipelineMock.cpp new file mode 100644 index 0000000000..2828456c15 --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/ComputePipelineMock.cpp @@ -0,0 +1,27 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/ComputePipelineMock.h" + +namespace dawn::native { + +ComputePipelineMock::ComputePipelineMock(DeviceBase* device) : ComputePipelineBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { + this->ComputePipelineBase::DestroyImpl(); + }); +} + +ComputePipelineMock::~ComputePipelineMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/ComputePipelineMock.h b/src/dawn/tests/unittests/native/mocks/ComputePipelineMock.h index 7f6a5983f3..404359ac81 100644 --- a/src/dawn/tests/unittests/native/mocks/ComputePipelineMock.h +++ b/src/dawn/tests/unittests/native/mocks/ComputePipelineMock.h @@ -24,12 +24,8 @@ namespace dawn::native { class ComputePipelineMock : public ComputePipelineBase { public: - explicit ComputePipelineMock(DeviceBase* device) : ComputePipelineBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { - this->ComputePipelineBase::DestroyImpl(); - }); - } - ~ComputePipelineMock() override = default; + explicit ComputePipelineMock(DeviceBase* device); + ~ComputePipelineMock() override; MOCK_METHOD(MaybeError, Initialize, (), (override)); MOCK_METHOD(size_t, ComputeContentHash, (), (override)); diff --git a/src/dawn/tests/unittests/native/mocks/ExternalTextureMock.cpp b/src/dawn/tests/unittests/native/mocks/ExternalTextureMock.cpp new file mode 100644 index 0000000000..d0e0f239fa --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/ExternalTextureMock.cpp @@ -0,0 +1,27 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/ExternalTextureMock.h" + +namespace dawn::native { + +ExternalTextureMock::ExternalTextureMock(DeviceBase* device) : ExternalTextureBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { + this->ExternalTextureBase::DestroyImpl(); + }); +} + +ExternalTextureMock::~ExternalTextureMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/ExternalTextureMock.h b/src/dawn/tests/unittests/native/mocks/ExternalTextureMock.h index 4114fe8569..55096dab52 100644 --- a/src/dawn/tests/unittests/native/mocks/ExternalTextureMock.h +++ b/src/dawn/tests/unittests/native/mocks/ExternalTextureMock.h @@ -24,12 +24,8 @@ namespace dawn::native { class ExternalTextureMock : public ExternalTextureBase { public: - explicit ExternalTextureMock(DeviceBase* device) : ExternalTextureBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { - this->ExternalTextureBase::DestroyImpl(); - }); - } - ~ExternalTextureMock() override = default; + explicit ExternalTextureMock(DeviceBase* device); + ~ExternalTextureMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); }; diff --git a/src/dawn/tests/unittests/native/mocks/PipelineLayoutMock.cpp b/src/dawn/tests/unittests/native/mocks/PipelineLayoutMock.cpp new file mode 100644 index 0000000000..191a03f223 --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/PipelineLayoutMock.cpp @@ -0,0 +1,27 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/PipelineLayoutMock.h" + +namespace dawn::native { + +PipelineLayoutMock::PipelineLayoutMock(DeviceBase* device) : PipelineLayoutBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { + this->PipelineLayoutBase::DestroyImpl(); + }); +} + +PipelineLayoutMock::~PipelineLayoutMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/PipelineLayoutMock.h b/src/dawn/tests/unittests/native/mocks/PipelineLayoutMock.h index 754cc95bce..f00bcf47a1 100644 --- a/src/dawn/tests/unittests/native/mocks/PipelineLayoutMock.h +++ b/src/dawn/tests/unittests/native/mocks/PipelineLayoutMock.h @@ -24,12 +24,8 @@ namespace dawn::native { class PipelineLayoutMock : public PipelineLayoutBase { public: - explicit PipelineLayoutMock(DeviceBase* device) : PipelineLayoutBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { - this->PipelineLayoutBase::DestroyImpl(); - }); - } - ~PipelineLayoutMock() override = default; + explicit PipelineLayoutMock(DeviceBase* device); + ~PipelineLayoutMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); }; diff --git a/src/dawn/tests/unittests/native/mocks/QuerySetMock.cpp b/src/dawn/tests/unittests/native/mocks/QuerySetMock.cpp new file mode 100644 index 0000000000..5657f8637e --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/QuerySetMock.cpp @@ -0,0 +1,25 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/QuerySetMock.h" + +namespace dawn::native { + +QuerySetMock::QuerySetMock(DeviceBase* device) : QuerySetBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->QuerySetBase::DestroyImpl(); }); +} + +QuerySetMock::~QuerySetMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/QuerySetMock.h b/src/dawn/tests/unittests/native/mocks/QuerySetMock.h index 0d081b729a..62ba31bffb 100644 --- a/src/dawn/tests/unittests/native/mocks/QuerySetMock.h +++ b/src/dawn/tests/unittests/native/mocks/QuerySetMock.h @@ -24,10 +24,8 @@ namespace dawn::native { class QuerySetMock : public QuerySetBase { public: - explicit QuerySetMock(DeviceBase* device) : QuerySetBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->QuerySetBase::DestroyImpl(); }); - } - ~QuerySetMock() override = default; + explicit QuerySetMock(DeviceBase* device); + ~QuerySetMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); }; diff --git a/src/dawn/tests/unittests/native/mocks/RenderPipelineMock.cpp b/src/dawn/tests/unittests/native/mocks/RenderPipelineMock.cpp new file mode 100644 index 0000000000..cf8a861fc0 --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/RenderPipelineMock.cpp @@ -0,0 +1,27 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/RenderPipelineMock.h" + +namespace dawn::native { + +RenderPipelineMock::RenderPipelineMock(DeviceBase* device) : RenderPipelineBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { + this->RenderPipelineBase::DestroyImpl(); + }); +} + +RenderPipelineMock::~RenderPipelineMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/RenderPipelineMock.h b/src/dawn/tests/unittests/native/mocks/RenderPipelineMock.h index a7b0b62643..1558b4bb7c 100644 --- a/src/dawn/tests/unittests/native/mocks/RenderPipelineMock.h +++ b/src/dawn/tests/unittests/native/mocks/RenderPipelineMock.h @@ -24,12 +24,8 @@ namespace dawn::native { class RenderPipelineMock : public RenderPipelineBase { public: - explicit RenderPipelineMock(DeviceBase* device) : RenderPipelineBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { - this->RenderPipelineBase::DestroyImpl(); - }); - } - ~RenderPipelineMock() override = default; + explicit RenderPipelineMock(DeviceBase* device); + ~RenderPipelineMock() override; MOCK_METHOD(MaybeError, Initialize, (), (override)); MOCK_METHOD(size_t, ComputeContentHash, (), (override)); diff --git a/src/dawn/tests/unittests/native/mocks/SamplerMock.cpp b/src/dawn/tests/unittests/native/mocks/SamplerMock.cpp new file mode 100644 index 0000000000..191addbfeb --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/SamplerMock.cpp @@ -0,0 +1,25 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/SamplerMock.h" + +namespace dawn::native { + +SamplerMock::SamplerMock(DeviceBase* device) : SamplerBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->SamplerBase::DestroyImpl(); }); +} + +SamplerMock::~SamplerMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/SamplerMock.h b/src/dawn/tests/unittests/native/mocks/SamplerMock.h index 7e75255e3a..fc378e85d0 100644 --- a/src/dawn/tests/unittests/native/mocks/SamplerMock.h +++ b/src/dawn/tests/unittests/native/mocks/SamplerMock.h @@ -24,10 +24,8 @@ namespace dawn::native { class SamplerMock : public SamplerBase { public: - explicit SamplerMock(DeviceBase* device) : SamplerBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->SamplerBase::DestroyImpl(); }); - } - ~SamplerMock() override = default; + explicit SamplerMock(DeviceBase* device); + ~SamplerMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); }; diff --git a/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.cpp b/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.cpp index 27f0d4321f..6cf6a1306a 100644 --- a/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.cpp +++ b/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.cpp @@ -20,6 +20,8 @@ ShaderModuleMock::ShaderModuleMock(DeviceBase* device) : ShaderModuleBase(device ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->ShaderModuleBase::DestroyImpl(); }); } +ShaderModuleMock::~ShaderModuleMock() = default; + ResultOrError> ShaderModuleMock::Create(DeviceBase* device, const char* source) { ShaderModuleMock* mock = new ShaderModuleMock(device); diff --git a/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.h b/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.h index d35a319669..3281e07dc3 100644 --- a/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.h +++ b/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.h @@ -28,7 +28,7 @@ namespace dawn::native { class ShaderModuleMock : public ShaderModuleBase { public: explicit ShaderModuleMock(DeviceBase* device); - ~ShaderModuleMock() override = default; + ~ShaderModuleMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); diff --git a/src/dawn/tests/unittests/native/mocks/SwapChainMock.cpp b/src/dawn/tests/unittests/native/mocks/SwapChainMock.cpp new file mode 100644 index 0000000000..4fb43bf512 --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/SwapChainMock.cpp @@ -0,0 +1,25 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/SwapChainMock.h" + +namespace dawn::native { + +SwapChainMock::SwapChainMock(DeviceBase* device) : SwapChainBase(device) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->SwapChainBase::DestroyImpl(); }); +} + +SwapChainMock::~SwapChainMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/SwapChainMock.h b/src/dawn/tests/unittests/native/mocks/SwapChainMock.h index 8f3386c982..b25ce4c99b 100644 --- a/src/dawn/tests/unittests/native/mocks/SwapChainMock.h +++ b/src/dawn/tests/unittests/native/mocks/SwapChainMock.h @@ -24,10 +24,8 @@ namespace dawn::native { class SwapChainMock : public SwapChainBase { public: - explicit SwapChainMock(DeviceBase* device) : SwapChainBase(device) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->SwapChainBase::DestroyImpl(); }); - } - ~SwapChainMock() override = default; + explicit SwapChainMock(DeviceBase* device); + ~SwapChainMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); diff --git a/src/dawn/tests/unittests/native/mocks/TextureMock.cpp b/src/dawn/tests/unittests/native/mocks/TextureMock.cpp new file mode 100644 index 0000000000..ce782a6653 --- /dev/null +++ b/src/dawn/tests/unittests/native/mocks/TextureMock.cpp @@ -0,0 +1,30 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/tests/unittests/native/mocks/TextureMock.h" + +namespace dawn::native { + +TextureMock::TextureMock(DeviceBase* device, TextureBase::TextureState state) + : TextureBase(device, state) { + ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->TextureBase::DestroyImpl(); }); +} + +TextureMock::~TextureMock() = default; + +TextureViewMock::TextureViewMock(TextureBase* texture) : TextureViewBase(texture) {} + +TextureViewMock::~TextureViewMock() = default; + +} // namespace dawn::native diff --git a/src/dawn/tests/unittests/native/mocks/TextureMock.h b/src/dawn/tests/unittests/native/mocks/TextureMock.h index b371b1aec1..20bd9283a4 100644 --- a/src/dawn/tests/unittests/native/mocks/TextureMock.h +++ b/src/dawn/tests/unittests/native/mocks/TextureMock.h @@ -24,18 +24,16 @@ namespace dawn::native { class TextureMock : public TextureBase { public: - TextureMock(DeviceBase* device, TextureBase::TextureState state) : TextureBase(device, state) { - ON_CALL(*this, DestroyImpl).WillByDefault([this]() { this->TextureBase::DestroyImpl(); }); - } - ~TextureMock() override = default; + TextureMock(DeviceBase* device, TextureBase::TextureState state); + ~TextureMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); }; class TextureViewMock : public TextureViewBase { public: - explicit TextureViewMock(TextureBase* texture) : TextureViewBase(texture) {} - ~TextureViewMock() override = default; + explicit TextureViewMock(TextureBase* texture); + ~TextureViewMock() override; MOCK_METHOD(void, DestroyImpl, (), (override)); }; diff --git a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp index e916ec7240..112c6691c9 100644 --- a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp @@ -60,7 +60,8 @@ class BindGroupValidationTest : public ValidationTest { CreateTexture(wgpu::TextureUsage::TextureBinding, kDefaultTextureFormat, 1); mSampledTextureView = mSampledTexture.CreateView(); - wgpu::ExternalTextureDescriptor externalTextureDesc; + wgpu::ExternalTextureDescriptor externalTextureDesc = + CreateDefaultExternalTextureDescriptor(); externalTextureDesc.plane0 = mSampledTextureView; mExternalTexture = device.CreateExternalTexture(&externalTextureDesc); mExternalTextureBindingEntry.externalTexture = mExternalTexture; @@ -68,6 +69,23 @@ class BindGroupValidationTest : public ValidationTest { } protected: + wgpu::ExternalTextureDescriptor CreateDefaultExternalTextureDescriptor() { + wgpu::ExternalTextureDescriptor desc; + desc.yuvToRgbConversionMatrix = mPlaceholderConstantArray.data(); + desc.gamutConversionMatrix = mPlaceholderConstantArray.data(); + desc.srcTransferFunctionParameters = mPlaceholderConstantArray.data(); + desc.dstTransferFunctionParameters = mPlaceholderConstantArray.data(); + return desc; + } + + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { + wgpu::DeviceDescriptor descriptor; + wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth32FloatStencil8}; + descriptor.requiredFeatures = requiredFeatures; + descriptor.requiredFeaturesCount = 1; + return dawnAdapter.CreateDevice(&descriptor); + } + wgpu::Buffer mUBO; wgpu::Buffer mSSBO; wgpu::Sampler mSampler; @@ -79,6 +97,7 @@ class BindGroupValidationTest : public ValidationTest { private: wgpu::ExternalTexture mExternalTexture; + std::array mPlaceholderConstantArray; }; // Test the validation of BindGroupDescriptor::nextInChain @@ -311,7 +330,7 @@ TEST_F(BindGroupValidationTest, ExternalTextureBindingType) { // Create an external texture wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::TextureBinding, kDefaultTextureFormat, 1); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture.CreateView(); wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&externalDesc); @@ -360,7 +379,8 @@ TEST_F(BindGroupValidationTest, ExternalTextureBindingType) { { wgpu::Texture errorTexture = CreateTexture(wgpu::TextureUsage::TextureBinding, wgpu::TextureFormat::RGBA8UnormSrgb, 1); - wgpu::ExternalTextureDescriptor errorExternalDesciptor; + wgpu::ExternalTextureDescriptor errorExternalDesciptor = + CreateDefaultExternalTextureDescriptor(); errorExternalDesciptor.plane0 = errorTexture.CreateView(); wgpu::ExternalTexture errorExternalTexture; @@ -435,6 +455,7 @@ TEST_F(BindGroupValidationTest, StorageTextureUsage) { // Multisampled texture is invalid with storage buffer binding // Regression case for crbug.com/dawn/614 where this hit an ASSERT. descriptor.sampleCount = 4; + descriptor.usage |= wgpu::TextureUsage::RenderAttachment; view = device.CreateTexture(&descriptor).CreateView(); ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, view}})); } @@ -442,7 +463,8 @@ TEST_F(BindGroupValidationTest, StorageTextureUsage) { // Check that a texture must have the correct sample type TEST_F(BindGroupValidationTest, TextureSampleType) { auto DoTest = [this](bool success, wgpu::TextureFormat format, - wgpu::TextureSampleType sampleType) { + wgpu::TextureSampleType sampleType, + wgpu::TextureAspect aspect = wgpu::TextureAspect::All) { wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {{0, wgpu::ShaderStage::Fragment, sampleType}}); @@ -451,7 +473,9 @@ TEST_F(BindGroupValidationTest, TextureSampleType) { descriptor.usage = wgpu::TextureUsage::TextureBinding; descriptor.format = format; - wgpu::TextureView view = device.CreateTexture(&descriptor).CreateView(); + wgpu::TextureViewDescriptor viewDescriptor; + viewDescriptor.aspect = aspect; + wgpu::TextureView view = device.CreateTexture(&descriptor).CreateView(&viewDescriptor); if (success) { utils::MakeBindGroup(device, layout, {{0, view}}); @@ -474,13 +498,77 @@ TEST_F(BindGroupValidationTest, TextureSampleType) { DoTest(false, wgpu::TextureFormat::R32Float, wgpu::TextureSampleType::Uint); DoTest(false, wgpu::TextureFormat::R32Float, wgpu::TextureSampleType::Sint); - // Test that Depth32Float is only compatible with depth. + // Test that Depth16Unorm is only compatible with depth/unfilterable-float. + DoTest(false, wgpu::TextureFormat::Depth16Unorm, wgpu::TextureSampleType::Float); + DoTest(true, wgpu::TextureFormat::Depth16Unorm, wgpu::TextureSampleType::UnfilterableFloat); + DoTest(true, wgpu::TextureFormat::Depth16Unorm, wgpu::TextureSampleType::Depth); + DoTest(false, wgpu::TextureFormat::Depth16Unorm, wgpu::TextureSampleType::Uint); + DoTest(false, wgpu::TextureFormat::Depth16Unorm, wgpu::TextureSampleType::Sint); + + // Test that Depth24Plus is only compatible with depth/unfilterable-float. + DoTest(false, wgpu::TextureFormat::Depth24Plus, wgpu::TextureSampleType::Float); + DoTest(true, wgpu::TextureFormat::Depth24Plus, wgpu::TextureSampleType::UnfilterableFloat); + DoTest(true, wgpu::TextureFormat::Depth24Plus, wgpu::TextureSampleType::Depth); + DoTest(false, wgpu::TextureFormat::Depth24Plus, wgpu::TextureSampleType::Uint); + DoTest(false, wgpu::TextureFormat::Depth24Plus, wgpu::TextureSampleType::Sint); + + // Test that Depth24PlusStencil8 with depth aspect is only compatible with + // depth/unfilterable-float. + DoTest(false, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureSampleType::Float, + wgpu::TextureAspect::DepthOnly); + DoTest(true, wgpu::TextureFormat::Depth24PlusStencil8, + wgpu::TextureSampleType::UnfilterableFloat, wgpu::TextureAspect::DepthOnly); + DoTest(true, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureSampleType::Depth, + wgpu::TextureAspect::DepthOnly); + DoTest(false, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureSampleType::Uint, + wgpu::TextureAspect::DepthOnly); + DoTest(false, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureSampleType::Sint, + wgpu::TextureAspect::DepthOnly); + + // Test that Depth24PlusStencil8 with stencil aspect is only compatible with uint. + DoTest(false, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureSampleType::Float, + wgpu::TextureAspect::StencilOnly); + DoTest(false, wgpu::TextureFormat::Depth24PlusStencil8, + wgpu::TextureSampleType::UnfilterableFloat, wgpu::TextureAspect::StencilOnly); + DoTest(false, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureSampleType::Depth, + wgpu::TextureAspect::StencilOnly); + DoTest(true, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureSampleType::Uint, + wgpu::TextureAspect::StencilOnly); + DoTest(false, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureSampleType::Sint, + wgpu::TextureAspect::StencilOnly); + + // Test that Depth32Float is only compatible with depth/unfilterable-float. DoTest(false, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::Float); - DoTest(false, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::UnfilterableFloat); + DoTest(true, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::UnfilterableFloat); DoTest(true, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::Depth); DoTest(false, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::Uint); DoTest(false, wgpu::TextureFormat::Depth32Float, wgpu::TextureSampleType::Sint); + // Test that Depth32FloatStencil8 with depth aspect is only compatible with + // depth/unfilterable-float. + DoTest(false, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureSampleType::Float, + wgpu::TextureAspect::DepthOnly); + DoTest(true, wgpu::TextureFormat::Depth32FloatStencil8, + wgpu::TextureSampleType::UnfilterableFloat, wgpu::TextureAspect::DepthOnly); + DoTest(true, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureSampleType::Depth, + wgpu::TextureAspect::DepthOnly); + DoTest(false, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureSampleType::Uint, + wgpu::TextureAspect::DepthOnly); + DoTest(false, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureSampleType::Sint, + wgpu::TextureAspect::DepthOnly); + + // Test that Depth32FloatStencil8 with stencil aspect is only compatible with uint. + DoTest(false, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureSampleType::Float, + wgpu::TextureAspect::StencilOnly); + DoTest(false, wgpu::TextureFormat::Depth32FloatStencil8, + wgpu::TextureSampleType::UnfilterableFloat, wgpu::TextureAspect::StencilOnly); + DoTest(false, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureSampleType::Depth, + wgpu::TextureAspect::StencilOnly); + DoTest(true, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureSampleType::Uint, + wgpu::TextureAspect::StencilOnly); + DoTest(false, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureSampleType::Sint, + wgpu::TextureAspect::StencilOnly); + // Test that RG8Uint is only compatible with uint DoTest(false, wgpu::TextureFormat::RG8Uint, wgpu::TextureSampleType::Float); DoTest(false, wgpu::TextureFormat::RG8Uint, wgpu::TextureSampleType::UnfilterableFloat); @@ -715,7 +803,7 @@ TEST_F(BindGroupValidationTest, MultisampledTexture) { // Control case: setting a multisampled 2D texture works wgpu::TextureDescriptor textureDesc; textureDesc.sampleCount = 4; - textureDesc.usage = wgpu::TextureUsage::TextureBinding; + textureDesc.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment; textureDesc.dimension = wgpu::TextureDimension::e2D; textureDesc.format = wgpu::TextureFormat::RGBA8Unorm; textureDesc.size = {1, 1, 1}; @@ -1445,7 +1533,7 @@ class SetBindGroupValidationTest : public ValidationTest { wgpu::RenderPipeline CreateRenderPipeline() { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -1459,7 +1547,7 @@ class SetBindGroupValidationTest : public ValidationTest { @group(0) @binding(2) var sBufferDynamic : S; @group(0) @binding(3) var sReadonlyBufferDynamic : S; - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor; @@ -1483,7 +1571,7 @@ class SetBindGroupValidationTest : public ValidationTest { @group(0) @binding(2) var sBufferDynamic : S; @group(0) @binding(3) var sReadonlyBufferDynamic : S; - @stage(compute) @workgroup_size(4, 4, 1) fn main() { + @compute @workgroup_size(4, 4, 1) fn main() { })"); wgpu::PipelineLayout pipelineLayout = @@ -1854,7 +1942,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest { ValidationTest::SetUp(); mVsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -1924,7 +2012,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest { } } - ss << "@stage(fragment) fn main() {}"; + ss << "@fragment fn main() {}"; wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, ss.str().c_str()); @@ -2056,7 +2144,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest { const char* fsShader, std::vector bindGroupLayout) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -2083,7 +2171,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest { @group(0) @binding(0) var sBufferDynamic : S; @group(1) @binding(0) var sReadonlyBufferDynamic : S; - @stage(fragment) fn main() { + @fragment fn main() { var val : vec2 = sBufferDynamic.value; val = sReadonlyBufferDynamic.value; })", @@ -2118,7 +2206,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest { @group(0) @binding(0) var sBufferDynamic : S; @group(1) @binding(0) var sReadonlyBufferDynamic : S; - @stage(compute) @workgroup_size(4, 4, 1) fn main() { + @compute @workgroup_size(4, 4, 1) fn main() { var val : vec2 = sBufferDynamic.value; val = sReadonlyBufferDynamic.value; })", @@ -2161,12 +2249,12 @@ TEST_F(BindGroupLayoutCompatibilityTest, ROStorageInBGLWithRWStorageInShader) { TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) { constexpr char kTexture2DShaderFS[] = R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"; constexpr char kTexture2DShaderCS[] = R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { textureDimensions(myTexture); })"; @@ -2200,12 +2288,12 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) { constexpr char kTexture2DArrayShaderFS[] = R"( @group(0) @binding(0) var myTexture : texture_2d_array; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"; constexpr char kTexture2DArrayShaderCS[] = R"( @group(0) @binding(0) var myTexture : texture_2d_array; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { textureDimensions(myTexture); })"; @@ -2247,7 +2335,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, ExternalTextureBindGroupLayoutCompatibi // Test that an external texture binding works with a texture_external in the shader. CreateFSRenderPipeline(R"( @group(0) @binding(0) var myExternalTexture: texture_external; - @stage(fragment) fn main() { + @fragment fn main() { _ = myExternalTexture; })", {bgl}); @@ -2255,7 +2343,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, ExternalTextureBindGroupLayoutCompatibi // Test that an external texture binding doesn't work with a texture_2d in the shader. ASSERT_DEVICE_ERROR(CreateFSRenderPipeline(R"( @group(0) @binding(0) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { _ = myTexture; })", {bgl})); @@ -2461,7 +2549,7 @@ class SamplerTypeBindingTest : public ValidationTest { wgpu::RenderPipeline CreateFragmentPipeline(wgpu::BindGroupLayout* bindGroupLayout, const char* fragmentSource) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -2488,7 +2576,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); } @@ -2500,7 +2588,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); } @@ -2512,7 +2600,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler_comparison; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); } @@ -2524,7 +2612,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler_comparison; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })")); } @@ -2536,7 +2624,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler_comparison; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })")); } @@ -2548,7 +2636,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })")); } @@ -2562,7 +2650,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2576,7 +2664,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2590,7 +2678,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_depth_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2604,7 +2692,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_depth_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } @@ -2618,7 +2706,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler_comparison; @group(0) @binding(1) var myTexture: texture_depth_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSampleCompare(myTexture, mySampler, vec2(0.0, 0.0), 0.0); })"); } @@ -2632,7 +2720,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })")); } @@ -2646,7 +2734,7 @@ TEST_F(SamplerTypeBindingTest, ShaderAndBGLMatches) { CreateFragmentPipeline(&bindGroupLayout, R"( @group(0) @binding(0) var mySampler: sampler; @group(0) @binding(1) var myTexture: texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2(0.0, 0.0)); })"); } diff --git a/src/dawn/tests/unittests/validation/BufferValidationTests.cpp b/src/dawn/tests/unittests/validation/BufferValidationTests.cpp index a063c4c971..af95b82816 100644 --- a/src/dawn/tests/unittests/validation/BufferValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/BufferValidationTests.cpp @@ -15,6 +15,7 @@ #include #include +#include "dawn/common/Platform.h" #include "dawn/tests/unittests/validation/ValidationTest.h" #include "gmock/gmock.h" @@ -802,12 +803,6 @@ TEST_F(BufferValidationTest, GetMappedRange_ValidBufferStateCases) { // Test valid cases to call GetMappedRange on an error buffer. TEST_F(BufferValidationTest, GetMappedRange_OnErrorBuffer) { - wgpu::BufferDescriptor desc; - desc.size = 4; - desc.usage = wgpu::BufferUsage::Storage | wgpu::BufferUsage::MapRead; - - uint64_t kStupidLarge = uint64_t(1) << uint64_t(63); - // GetMappedRange after mappedAtCreation a zero-sized buffer returns a non-nullptr. // This is to check we don't do a malloc(0). { @@ -828,17 +823,23 @@ TEST_F(BufferValidationTest, GetMappedRange_OnErrorBuffer) { ASSERT_NE(buffer.GetConstMappedRange(), nullptr); ASSERT_EQ(buffer.GetConstMappedRange(), buffer.GetMappedRange()); } +} + +// Test valid cases to call GetMappedRange on an error buffer that's also OOM. +TEST_F(BufferValidationTest, GetMappedRange_OnErrorBuffer_OOM) { + // TODO(crbug.com/dawn/1506): new (std::nothrow) crashes on OOM on Mac ARM64 because libunwind + // doesn't see the previous catchall try-catch. + DAWN_SKIP_TEST_IF(DAWN_PLATFORM_IS(MACOS) && DAWN_PLATFORM_IS(ARM64)); + + uint64_t kStupidLarge = uint64_t(1) << uint64_t(63); + + wgpu::Buffer buffer; + ASSERT_DEVICE_ERROR(buffer = BufferMappedAtCreation( + kStupidLarge, wgpu::BufferUsage::Storage | wgpu::BufferUsage::MapRead)); // GetMappedRange after mappedAtCreation OOM case returns nullptr. - { - wgpu::Buffer buffer; - ASSERT_DEVICE_ERROR( - buffer = BufferMappedAtCreation( - kStupidLarge, wgpu::BufferUsage::Storage | wgpu::BufferUsage::MapRead)); - - ASSERT_EQ(buffer.GetConstMappedRange(), nullptr); - ASSERT_EQ(buffer.GetConstMappedRange(), buffer.GetMappedRange()); - } + ASSERT_EQ(buffer.GetConstMappedRange(), nullptr); + ASSERT_EQ(buffer.GetConstMappedRange(), buffer.GetMappedRange()); } // Test validation of the GetMappedRange parameters @@ -940,3 +941,74 @@ TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) { EXPECT_EQ(buffer.GetMappedRange(0, 0), nullptr); } } + +// Test that the buffer creation parameters are correctly reflected for succesfully created buffers. +TEST_F(BufferValidationTest, CreationParameterReflectionForValidBuffer) { + // Test reflection on two succesfully created but different buffers. The reflected data should + // be different! + { + wgpu::BufferDescriptor desc; + desc.size = 16; + desc.usage = wgpu::BufferUsage::Uniform; + wgpu::Buffer buf = device.CreateBuffer(&desc); + + EXPECT_EQ(wgpu::BufferUsage::Uniform, buf.GetUsage()); + EXPECT_EQ(16u, buf.GetSize()); + } + { + wgpu::BufferDescriptor desc; + desc.size = 32; + desc.usage = wgpu::BufferUsage::Storage; + wgpu::Buffer buf = device.CreateBuffer(&desc); + + EXPECT_EQ(wgpu::BufferUsage::Storage, buf.GetUsage()); + EXPECT_EQ(32u, buf.GetSize()); + } +} + +// Test that the buffer creation parameters are correctly reflected for buffers invalid because of +// validation errors. +TEST_F(BufferValidationTest, CreationParameterReflectionForErrorBuffer) { + wgpu::BufferDescriptor desc; + desc.usage = wgpu::BufferUsage::Uniform; + desc.size = 19; + desc.mappedAtCreation = true; + + // Error! MappedAtCreation requires size % 4 == 0. + wgpu::Buffer buf; + ASSERT_DEVICE_ERROR(buf = device.CreateBuffer(&desc)); + + // Reflection data is still exactly what was in the descriptor. + EXPECT_EQ(wgpu::BufferUsage::Uniform, buf.GetUsage()); + EXPECT_EQ(19u, buf.GetSize()); +} + +// Test that the buffer creation parameters are correctly reflected for buffers invalid because of +// OOM. +TEST_F(BufferValidationTest, CreationParameterReflectionForOOMBuffer) { + constexpr uint64_t kAmazinglyLargeSize = 0x1234'5678'90AB'CDEF; + wgpu::BufferDescriptor desc; + desc.usage = wgpu::BufferUsage::Storage; + desc.size = kAmazinglyLargeSize; + + // OOM! + wgpu::Buffer buf; + ASSERT_DEVICE_ERROR(buf = device.CreateBuffer(&desc)); + + // Reflection data is still exactly what was in the descriptor. + EXPECT_EQ(wgpu::BufferUsage::Storage, buf.GetUsage()); + EXPECT_EQ(kAmazinglyLargeSize, buf.GetSize()); +} + +// Test that buffer reflection doesn't show internal usages +TEST_F(BufferValidationTest, CreationParameterReflectionNoInternalUsage) { + wgpu::BufferDescriptor desc; + desc.size = 16; + // QueryResolve also adds kInternalStorageBuffer for processing of queries. + desc.usage = wgpu::BufferUsage::QueryResolve; + wgpu::Buffer buf = device.CreateBuffer(&desc); + + // The reflection shouldn't show kInternalStorageBuffer + EXPECT_EQ(wgpu::BufferUsage::QueryResolve, buf.GetUsage()); + EXPECT_EQ(16u, buf.GetSize()); +} diff --git a/src/dawn/tests/unittests/validation/CommandBufferValidationTests.cpp b/src/dawn/tests/unittests/validation/CommandBufferValidationTests.cpp index 0b74c728b8..dc45bc0f88 100644 --- a/src/dawn/tests/unittests/validation/CommandBufferValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/CommandBufferValidationTests.cpp @@ -31,12 +31,12 @@ TEST_F(CommandBufferValidationTest, Empty) { // Test that a command buffer cannot be ended mid render pass TEST_F(CommandBufferValidationTest, EndedMidRenderPass) { - PlaceholderRenderPass PlaceholderRenderPass(device); + PlaceholderRenderPass placeholderRenderPass(device); // Control case, command buffer ended after the pass is ended. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); encoder.Finish(); } @@ -44,7 +44,7 @@ TEST_F(CommandBufferValidationTest, EndedMidRenderPass) { // Error case, command buffer ended mid-pass. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); ASSERT_DEVICE_ERROR( encoder.Finish(), HasSubstr("Command buffer recording ended before [RenderPassEncoder] was ended.")); @@ -54,7 +54,7 @@ TEST_F(CommandBufferValidationTest, EndedMidRenderPass) { // should fail too. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); ASSERT_DEVICE_ERROR( encoder.Finish(), HasSubstr("Command buffer recording ended before [RenderPassEncoder] was ended.")); @@ -97,12 +97,12 @@ TEST_F(CommandBufferValidationTest, EndedMidComputePass) { // Test that a render pass cannot be ended twice TEST_F(CommandBufferValidationTest, RenderPassEndedTwice) { - PlaceholderRenderPass PlaceholderRenderPass(device); + PlaceholderRenderPass placeholderRenderPass(device); // Control case, pass is ended once { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); encoder.Finish(); } @@ -110,7 +110,7 @@ TEST_F(CommandBufferValidationTest, RenderPassEndedTwice) { // Error case, pass ended twice { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); pass.End(); ASSERT_DEVICE_ERROR( @@ -143,12 +143,12 @@ TEST_F(CommandBufferValidationTest, ComputePassEndedTwice) { // Test that beginning a compute pass before ending the previous pass causes an error. TEST_F(CommandBufferValidationTest, BeginComputePassBeforeEndPreviousPass) { - PlaceholderRenderPass PlaceholderRenderPass(device); + PlaceholderRenderPass placeholderRenderPass(device); // Beginning a compute pass before ending a render pass causes an error. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&placeholderRenderPass); wgpu::ComputePassEncoder computePass = encoder.BeginComputePass(); computePass.End(); renderPass.End(); @@ -168,13 +168,13 @@ TEST_F(CommandBufferValidationTest, BeginComputePassBeforeEndPreviousPass) { // Test that beginning a render pass before ending the previous pass causes an error. TEST_F(CommandBufferValidationTest, BeginRenderPassBeforeEndPreviousPass) { - PlaceholderRenderPass PlaceholderRenderPass(device); + PlaceholderRenderPass placeholderRenderPass(device); // Beginning a render pass before ending the render pass causes an error. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder renderPass1 = encoder.BeginRenderPass(&PlaceholderRenderPass); - wgpu::RenderPassEncoder renderPass2 = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder renderPass1 = encoder.BeginRenderPass(&placeholderRenderPass); + wgpu::RenderPassEncoder renderPass2 = encoder.BeginRenderPass(&placeholderRenderPass); renderPass2.End(); renderPass1.End(); ASSERT_DEVICE_ERROR(encoder.Finish()); @@ -184,7 +184,7 @@ TEST_F(CommandBufferValidationTest, BeginRenderPassBeforeEndPreviousPass) { { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::ComputePassEncoder computePass = encoder.BeginComputePass(); - wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&placeholderRenderPass); renderPass.End(); computePass.End(); ASSERT_DEVICE_ERROR(encoder.Finish()); @@ -229,12 +229,12 @@ TEST_F(CommandBufferValidationTest, CallsAfterAFailedFinish) { // Test that passes which are de-referenced prior to ending still allow the correct errors to be // produced. TEST_F(CommandBufferValidationTest, PassDereferenced) { - PlaceholderRenderPass PlaceholderRenderPass(device); + PlaceholderRenderPass placeholderRenderPass(device); // Control case, command buffer ended after the pass is ended. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); encoder.Finish(); } @@ -242,7 +242,7 @@ TEST_F(CommandBufferValidationTest, PassDereferenced) { // Error case, no reference is kept to a render pass. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.BeginRenderPass(&PlaceholderRenderPass); + encoder.BeginRenderPass(&placeholderRenderPass); ASSERT_DEVICE_ERROR( encoder.Finish(), HasSubstr("Command buffer recording ended before [RenderPassEncoder] was ended.")); @@ -260,7 +260,7 @@ TEST_F(CommandBufferValidationTest, PassDereferenced) { // Error case, beginning a new pass after failing to end a de-referenced pass. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - encoder.BeginRenderPass(&PlaceholderRenderPass); + encoder.BeginRenderPass(&placeholderRenderPass); wgpu::ComputePassEncoder pass = encoder.BeginComputePass(); pass.End(); ASSERT_DEVICE_ERROR( @@ -301,12 +301,12 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { // only way to trigger the destroy call is by losing all references which means we cannot // call finish. DAWN_SKIP_TEST_IF(UsesWire()); - PlaceholderRenderPass PlaceholderRenderPass(device); + PlaceholderRenderPass placeholderRenderPass(device); // Control case, command buffer ended after the pass is ended. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); encoder.Finish(); } @@ -314,7 +314,7 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { // Destroyed encoder with encoded commands should emit error on finish. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); dawn::native::FromAPI(encoder.Get())->Destroy(); ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("Destroyed encoder cannot be finished.")); @@ -323,7 +323,7 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { // Destroyed encoder with encoded commands shouldn't emit an error if never finished. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); dawn::native::FromAPI(encoder.Get())->Destroy(); } @@ -332,7 +332,7 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::native::FromAPI(encoder.Get())->Destroy(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("Destroyed encoder cannot be finished.")); } @@ -341,14 +341,14 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); dawn::native::FromAPI(encoder.Get())->Destroy(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); } // Destroying a finished encoder should not emit any errors. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&PlaceholderRenderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); pass.End(); encoder.Finish(); dawn::native::FromAPI(encoder.Get())->Destroy(); @@ -369,3 +369,32 @@ TEST_F(CommandBufferValidationTest, DestroyEncoder) { ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("Destroyed encoder cannot be finished.")); } } + +TEST_F(CommandBufferValidationTest, EncodeAfterDeviceDestroyed) { + PlaceholderRenderPass placeholderRenderPass(device); + + // Device destroyed before encoding. + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + ExpectDeviceDestruction(); + device.Destroy(); + // The encoder should not accessing any device info if device is destroyed when try + // encoding. + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); + pass.End(); + ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("Destroyed encoder cannot be finished.")); + } + + // Device destroyed after encoding. + { + ExpectDeviceDestruction(); + device.Destroy(); + ASSERT_DEVICE_ERROR(wgpu::CommandEncoder encoder = device.CreateCommandEncoder(), + HasSubstr("[Device] is lost")); + // The encoder should not accessing any device info if device is destroyed when try + // encoding. + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&placeholderRenderPass); + pass.End(); + ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("[Invalid CommandEncoder] is invalid.")); + } +} diff --git a/src/dawn/tests/unittests/validation/ComputeIndirectValidationTests.cpp b/src/dawn/tests/unittests/validation/ComputeIndirectValidationTests.cpp index d9edd357e0..2363c85dac 100644 --- a/src/dawn/tests/unittests/validation/ComputeIndirectValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/ComputeIndirectValidationTests.cpp @@ -23,7 +23,7 @@ class ComputeIndirectValidationTest : public ValidationTest { ValidationTest::SetUp(); wgpu::ShaderModule computeModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); // Set up compute pipeline diff --git a/src/dawn/tests/unittests/validation/ComputeValidationTests.cpp b/src/dawn/tests/unittests/validation/ComputeValidationTests.cpp index 5e2b492819..77ab331ba3 100644 --- a/src/dawn/tests/unittests/validation/ComputeValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/ComputeValidationTests.cpp @@ -25,7 +25,7 @@ class ComputeValidationTest : public ValidationTest { ValidationTest::SetUp(); wgpu::ShaderModule computeModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); // Set up compute pipeline diff --git a/src/dawn/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/dawn/tests/unittests/validation/CopyCommandsValidationTests.cpp index ab77f50900..7aedf2fc1a 100644 --- a/src/dawn/tests/unittests/validation/CopyCommandsValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/CopyCommandsValidationTests.cpp @@ -420,13 +420,12 @@ TEST_F(CopyCommandTest_B2B, CopyWithinSameBuffer) { class CopyCommandTest_B2T : public CopyCommandTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[2] = {wgpu::FeatureName::Depth24UnormStencil8, - wgpu::FeatureName::Depth32FloatStencil8}; + wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth32FloatStencil8}; descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 2; - return adapter.CreateDevice(&descriptor); + descriptor.requiredFeaturesCount = 1; + return dawnAdapter.CreateDevice(&descriptor); } }; @@ -718,12 +717,10 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffsetForColorTexture) { TEST_F(CopyCommandTest_B2T, IncorrectBufferOffsetForDepthStencilTexture) { // TODO(dawn:570, dawn:666): List other valid parameters after missing texture formats // are implemented, e.g. Stencil8. - std::array, 5> params = { + std::array, 4> params = { std::make_tuple(wgpu::TextureFormat::Depth16Unorm, wgpu::TextureAspect::DepthOnly), std::make_tuple(wgpu::TextureFormat::Depth16Unorm, wgpu::TextureAspect::All), std::make_tuple(wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureAspect::StencilOnly), - std::make_tuple(wgpu::TextureFormat::Depth24UnormStencil8, - wgpu::TextureAspect::StencilOnly), std::make_tuple(wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureAspect::StencilOnly), }; @@ -751,8 +748,9 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffsetForDepthStencilTexture) { TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) { uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1); wgpu::Buffer source = CreateBuffer(bufferSize, wgpu::BufferUsage::CopySrc); - wgpu::Texture destination = Create2DTexture(2, 2, 1, 1, wgpu::TextureFormat::RGBA8Unorm, - wgpu::TextureUsage::CopyDst, 4); + wgpu::Texture destination = + Create2DTexture(2, 2, 1, 1, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment, 4); TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 2, destination, 0, {0, 0, 0}, {2, 2, 1}); @@ -892,9 +890,10 @@ TEST_F(CopyCommandTest_B2T, CopyToDepthAspect) { } } - constexpr std::array kDisallowBufferToDepthCopyFormats = { - wgpu::TextureFormat::Depth32Float, wgpu::TextureFormat::Depth24Plus, - wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth24UnormStencil8, + constexpr std::array kDisallowBufferToDepthCopyFormats = { + wgpu::TextureFormat::Depth32Float, + wgpu::TextureFormat::Depth24Plus, + wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Depth32FloatStencil8, }; @@ -1029,13 +1028,12 @@ TEST_F(CopyCommandTest_B2T, RequiredBytesInCopyOverflow) { class CopyCommandTest_T2B : public CopyCommandTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[2] = {wgpu::FeatureName::Depth24UnormStencil8, - wgpu::FeatureName::Depth32FloatStencil8}; + wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth32FloatStencil8}; descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 2; - return adapter.CreateDevice(&descriptor); + descriptor.requiredFeaturesCount = 1; + return dawnAdapter.CreateDevice(&descriptor); } }; @@ -1353,14 +1351,12 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffsetForColorTexture) { TEST_F(CopyCommandTest_T2B, IncorrectBufferOffsetForDepthStencilTexture) { // TODO(dawn:570, dawn:666): List other valid parameters after missing texture formats // are implemented, e.g. Stencil8. - std::array, 8> params = { + std::array, 7> params = { std::make_tuple(wgpu::TextureFormat::Depth16Unorm, wgpu::TextureAspect::DepthOnly), std::make_tuple(wgpu::TextureFormat::Depth16Unorm, wgpu::TextureAspect::All), std::make_tuple(wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureAspect::StencilOnly), std::make_tuple(wgpu::TextureFormat::Depth32Float, wgpu::TextureAspect::DepthOnly), std::make_tuple(wgpu::TextureFormat::Depth32Float, wgpu::TextureAspect::All), - std::make_tuple(wgpu::TextureFormat::Depth24UnormStencil8, - wgpu::TextureAspect::StencilOnly), std::make_tuple(wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureAspect::DepthOnly), std::make_tuple(wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureAspect::StencilOnly), @@ -1387,8 +1383,9 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffsetForDepthStencilTexture) { // Test multisampled textures cannot be used in T2B copies. TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) { - wgpu::Texture source = Create2DTexture(2, 2, 1, 1, wgpu::TextureFormat::RGBA8Unorm, - wgpu::TextureUsage::CopySrc, 4); + wgpu::Texture source = + Create2DTexture(2, 2, 1, 1, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, 4); uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1); wgpu::Buffer destination = CreateBuffer(bufferSize, wgpu::BufferUsage::CopyDst); @@ -1536,9 +1533,10 @@ TEST_F(CopyCommandTest_T2B, CopyFromDepthAspect) { } } - constexpr std::array kDisallowDepthCopyFormats = { - wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8}; + constexpr std::array kDisallowDepthCopyFormats = { + wgpu::TextureFormat::Depth24Plus, + wgpu::TextureFormat::Depth24PlusStencil8, + }; for (wgpu::TextureFormat format : kDisallowDepthCopyFormats) { { wgpu::Texture source = @@ -1667,13 +1665,12 @@ TEST_F(CopyCommandTest_T2B, RequiredBytesInCopyOverflow) { class CopyCommandTest_T2T : public CopyCommandTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[2] = {wgpu::FeatureName::Depth24UnormStencil8, - wgpu::FeatureName::Depth32FloatStencil8}; + wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth32FloatStencil8}; descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 2; - return adapter.CreateDevice(&descriptor); + descriptor.requiredFeaturesCount = 1; + return dawnAdapter.CreateDevice(&descriptor); } wgpu::TextureFormat GetCopyCompatibleFormat(wgpu::TextureFormat format) { @@ -1956,10 +1953,12 @@ TEST_F(CopyCommandTest_T2T, SrgbFormatsCompatibility) { TEST_F(CopyCommandTest_T2T, MultisampledCopies) { wgpu::Texture sourceMultiSampled1x = Create2DTexture( 16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::CopySrc, 1); - wgpu::Texture sourceMultiSampled4x = Create2DTexture( - 16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::CopySrc, 4); - wgpu::Texture destinationMultiSampled4x = Create2DTexture( - 16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::CopyDst, 4); + wgpu::Texture sourceMultiSampled4x = + Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, 4); + wgpu::Texture destinationMultiSampled4x = + Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment, 4); // Success when entire multisampled subresource is copied { @@ -2145,14 +2144,14 @@ TEST_F(CopyCommandTest_T2T, CopyWithinSameTexture) { class CopyCommandTest_CompressedTextureFormats : public CopyCommandTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[3] = {wgpu::FeatureName::TextureCompressionBC, wgpu::FeatureName::TextureCompressionETC2, wgpu::FeatureName::TextureCompressionASTC}; descriptor.requiredFeatures = requiredFeatures; descriptor.requiredFeaturesCount = 3; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } wgpu::Texture Create2DTexture(wgpu::TextureFormat format, diff --git a/src/dawn/tests/unittests/validation/CopyTextureForBrowserTests.cpp b/src/dawn/tests/unittests/validation/CopyTextureForBrowserTests.cpp index 489a802fa6..06c1b3d2a2 100644 --- a/src/dawn/tests/unittests/validation/CopyTextureForBrowserTests.cpp +++ b/src/dawn/tests/unittests/validation/CopyTextureForBrowserTests.cpp @@ -22,14 +22,17 @@ class CopyTextureForBrowserTest : public ValidationTest { protected: - wgpu::Texture Create2DTexture(uint32_t width, - uint32_t height, - uint32_t mipLevelCount, - uint32_t arrayLayerCount, - wgpu::TextureFormat format, - wgpu::TextureUsage usage, - uint32_t sampleCount = 1) { + wgpu::Texture Create2DTexture( + uint32_t width, + uint32_t height, + uint32_t mipLevelCount, + uint32_t arrayLayerCount, + wgpu::TextureFormat format, + wgpu::TextureUsage usage, + uint32_t sampleCount = 1, + const wgpu::DawnTextureInternalUsageDescriptor* internalDesc = nullptr) { wgpu::TextureDescriptor descriptor; + descriptor.nextInChain = internalDesc; descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = width; descriptor.size.height = height; @@ -67,6 +70,17 @@ class CopyTextureForBrowserTest : public ValidationTest { } }; +class CopyTextureForBrowserInternalUsageTest : public CopyTextureForBrowserTest { + protected: + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { + wgpu::DeviceDescriptor descriptor; + wgpu::FeatureName feature = wgpu::FeatureName::DawnInternalUsages; + descriptor.requiredFeatures = &feature; + descriptor.requiredFeaturesCount = 1; + return dawnAdapter.CreateDevice(&descriptor); + } +}; + // Tests should be Success TEST_F(CopyTextureForBrowserTest, Success) { wgpu::Texture source = @@ -297,7 +311,9 @@ TEST_F(CopyTextureForBrowserTest, InvalidSampleCount) { wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment, 1); wgpu::Texture sourceMultiSampled4x = Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm, - wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding, 4); + wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding | + wgpu::TextureUsage::RenderAttachment, + 4); wgpu::Texture destinationMultiSampled4x = Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment, 4); @@ -432,3 +448,54 @@ TEST_F(CopyTextureForBrowserTest, ColorSpaceConversion_TextureAlphaState) { {0, 0, 0}, {4, 4, 1}, wgpu::TextureAspect::All, options); } } + +// Test that the internal usage can only be set to true when the device internal usage feature is +// enabled +TEST_F(CopyTextureForBrowserTest, InternalUsage) { + wgpu::DawnTextureInternalUsageDescriptor internalDesc = {}; + internalDesc.internalUsage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding; + + // Validation should fail because internal descriptor is not empty. + ASSERT_DEVICE_ERROR(Create2DTexture(16, 16, 5, 4, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopySrc, 1, &internalDesc)); + + wgpu::Texture source = + Create2DTexture(16, 16, 5, 4, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding); + + wgpu::Texture destination = + Create2DTexture(16, 16, 5, 4, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment); + + // Validation should fail because of device internal usage feature is missing when internal + // usage option is on + wgpu::CopyTextureForBrowserOptions options = {}; + options.internalUsage = true; + TestCopyTextureForBrowser(utils::Expectation::Failure, source, 0, {0, 0, 0}, destination, 0, + {0, 0, 0}, {16, 16, 1}, wgpu::TextureAspect::All, options); +} + +// Test that the internal usages are taken into account when interalUsage = true +TEST_F(CopyTextureForBrowserInternalUsageTest, InternalUsage) { + wgpu::DawnTextureInternalUsageDescriptor internalDesc1 = {}; + internalDesc1.internalUsage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding; + + wgpu::Texture source = Create2DTexture(16, 16, 5, 4, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopySrc, 1, &internalDesc1); + + wgpu::DawnTextureInternalUsageDescriptor internalDesc2 = {}; + internalDesc2.internalUsage = + wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment; + wgpu::Texture destination = Create2DTexture(16, 16, 5, 4, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopyDst, 1, &internalDesc2); + + // Without internal usage option should fail usage validation + TestCopyTextureForBrowser(utils::Expectation::Failure, source, 0, {0, 0, 0}, destination, 0, + {0, 0, 0}, {16, 16, 1}); + + // With internal usage option should pass usage validation + wgpu::CopyTextureForBrowserOptions options = {}; + options.internalUsage = true; + TestCopyTextureForBrowser(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, + {0, 0, 0}, {16, 16, 1}, wgpu::TextureAspect::All, options); +} diff --git a/src/dawn/tests/unittests/validation/DeviceValidationTests.cpp b/src/dawn/tests/unittests/validation/DeviceValidationTests.cpp index 7b49c7d59b..e1c9e0b781 100644 --- a/src/dawn/tests/unittests/validation/DeviceValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/DeviceValidationTests.cpp @@ -22,9 +22,9 @@ using ::testing::HasSubstr; class RequestDeviceValidationTest : public ValidationTest { protected: - void SetUp() { - DAWN_SKIP_TEST_IF(UsesWire()); + void SetUp() override { ValidationTest::SetUp(); + DAWN_SKIP_TEST_IF(UsesWire()); } static void ExpectRequestDeviceSuccess(WGPURequestDeviceStatus status, @@ -65,13 +65,13 @@ class RequestDeviceValidationTest : public ValidationTest { // Test that requesting a device without specifying limits is valid. TEST_F(RequestDeviceValidationTest, NoRequiredLimits) { wgpu::DeviceDescriptor descriptor; - adapter.RequestDevice(&descriptor, ExpectRequestDeviceSuccess, - CheckDevice([](wgpu::Device device) { - // Check one of the default limits. - wgpu::SupportedLimits limits; - device.GetLimits(&limits); - EXPECT_EQ(limits.limits.maxBindGroups, 4u); - })); + GetBackendAdapter().RequestDevice(&descriptor, ExpectRequestDeviceSuccess, + CheckDevice([](wgpu::Device device) { + // Check one of the default limits. + wgpu::SupportedLimits limits; + device.GetLimits(&limits); + EXPECT_EQ(limits.limits.maxBindGroups, 4u); + })); } // Test that requesting a device with the default limits is valid. @@ -79,13 +79,13 @@ TEST_F(RequestDeviceValidationTest, DefaultLimits) { wgpu::RequiredLimits limits = {}; wgpu::DeviceDescriptor descriptor; descriptor.requiredLimits = &limits; - adapter.RequestDevice(&descriptor, ExpectRequestDeviceSuccess, - CheckDevice([](wgpu::Device device) { - // Check one of the default limits. - wgpu::SupportedLimits limits; - device.GetLimits(&limits); - EXPECT_EQ(limits.limits.maxTextureArrayLayers, 256u); - })); + GetBackendAdapter().RequestDevice(&descriptor, ExpectRequestDeviceSuccess, + CheckDevice([](wgpu::Device device) { + // Check one of the default limits. + wgpu::SupportedLimits limits; + device.GetLimits(&limits); + EXPECT_EQ(limits.limits.maxTextureArrayLayers, 256u); + })); } // Test that requesting a device where a required limit is above the maximum value. @@ -95,12 +95,12 @@ TEST_F(RequestDeviceValidationTest, HigherIsBetter) { descriptor.requiredLimits = &limits; wgpu::SupportedLimits supportedLimits; - EXPECT_TRUE(adapter.GetLimits(reinterpret_cast(&supportedLimits))); + EXPECT_TRUE(adapter.GetLimits(&supportedLimits)); // If we can support better than the default, test below the max. if (supportedLimits.limits.maxBindGroups > 4u) { limits.limits.maxBindGroups = supportedLimits.limits.maxBindGroups - 1; - adapter.RequestDevice( + GetBackendAdapter().RequestDevice( &descriptor, ExpectRequestDeviceSuccess, CheckDevice([&](wgpu::Device device) { wgpu::SupportedLimits limits; device.GetLimits(&limits); @@ -114,7 +114,7 @@ TEST_F(RequestDeviceValidationTest, HigherIsBetter) { // Test the max. limits.limits.maxBindGroups = supportedLimits.limits.maxBindGroups; - adapter.RequestDevice( + GetBackendAdapter().RequestDevice( &descriptor, ExpectRequestDeviceSuccess, CheckDevice([&](wgpu::Device device) { wgpu::SupportedLimits limits; device.GetLimits(&limits); @@ -127,18 +127,18 @@ TEST_F(RequestDeviceValidationTest, HigherIsBetter) { // Test above the max. limits.limits.maxBindGroups = supportedLimits.limits.maxBindGroups + 1; - adapter.RequestDevice(&descriptor, ExpectRequestDeviceError, nullptr); + GetBackendAdapter().RequestDevice(&descriptor, ExpectRequestDeviceError, nullptr); // Test worse than the default limits.limits.maxBindGroups = 3u; - adapter.RequestDevice(&descriptor, ExpectRequestDeviceSuccess, - CheckDevice([&](wgpu::Device device) { - wgpu::SupportedLimits limits; - device.GetLimits(&limits); + GetBackendAdapter().RequestDevice(&descriptor, ExpectRequestDeviceSuccess, + CheckDevice([&](wgpu::Device device) { + wgpu::SupportedLimits limits; + device.GetLimits(&limits); - // Check we got the default. - EXPECT_EQ(limits.limits.maxBindGroups, 4u); - })); + // Check we got the default. + EXPECT_EQ(limits.limits.maxBindGroups, 4u); + })); } // Test that requesting a device where a required limit is below the minimum value. @@ -148,33 +148,33 @@ TEST_F(RequestDeviceValidationTest, LowerIsBetter) { descriptor.requiredLimits = &limits; wgpu::SupportedLimits supportedLimits; - EXPECT_TRUE(adapter.GetLimits(reinterpret_cast(&supportedLimits))); + EXPECT_TRUE(adapter.GetLimits(&supportedLimits)); // Test below the min. limits.limits.minUniformBufferOffsetAlignment = supportedLimits.limits.minUniformBufferOffsetAlignment / 2; - adapter.RequestDevice(&descriptor, ExpectRequestDeviceError, nullptr); + GetBackendAdapter().RequestDevice(&descriptor, ExpectRequestDeviceError, nullptr); // Test the min. limits.limits.minUniformBufferOffsetAlignment = supportedLimits.limits.minUniformBufferOffsetAlignment; - adapter.RequestDevice(&descriptor, ExpectRequestDeviceSuccess, - CheckDevice([&](wgpu::Device device) { - wgpu::SupportedLimits limits; - device.GetLimits(&limits); + GetBackendAdapter().RequestDevice( + &descriptor, ExpectRequestDeviceSuccess, CheckDevice([&](wgpu::Device device) { + wgpu::SupportedLimits limits; + device.GetLimits(&limits); - // Check we got exactly the request. - EXPECT_EQ(limits.limits.minUniformBufferOffsetAlignment, - supportedLimits.limits.minUniformBufferOffsetAlignment); - // Check another default limit. - EXPECT_EQ(limits.limits.maxTextureArrayLayers, 256u); - })); + // Check we got exactly the request. + EXPECT_EQ(limits.limits.minUniformBufferOffsetAlignment, + supportedLimits.limits.minUniformBufferOffsetAlignment); + // Check another default limit. + EXPECT_EQ(limits.limits.maxTextureArrayLayers, 256u); + })); // IF we can support better than the default, test above the min. if (supportedLimits.limits.minUniformBufferOffsetAlignment > 256u) { limits.limits.minUniformBufferOffsetAlignment = supportedLimits.limits.minUniformBufferOffsetAlignment * 2; - adapter.RequestDevice( + GetBackendAdapter().RequestDevice( &descriptor, ExpectRequestDeviceSuccess, CheckDevice([&](wgpu::Device device) { wgpu::SupportedLimits limits; device.GetLimits(&limits); @@ -189,25 +189,25 @@ TEST_F(RequestDeviceValidationTest, LowerIsBetter) { // Test worse than the default limits.limits.minUniformBufferOffsetAlignment = 2u * 256u; - adapter.RequestDevice(&descriptor, ExpectRequestDeviceSuccess, - CheckDevice([&](wgpu::Device device) { - wgpu::SupportedLimits limits; - device.GetLimits(&limits); + GetBackendAdapter().RequestDevice( + &descriptor, ExpectRequestDeviceSuccess, CheckDevice([&](wgpu::Device device) { + wgpu::SupportedLimits limits; + device.GetLimits(&limits); - // Check we got the default. - EXPECT_EQ(limits.limits.minUniformBufferOffsetAlignment, 256u); - })); + // Check we got the default. + EXPECT_EQ(limits.limits.minUniformBufferOffsetAlignment, 256u); + })); } // Test that it is an error to request limits with an invalid chained struct TEST_F(RequestDeviceValidationTest, InvalidChainedStruct) { - wgpu::PrimitiveDepthClampingState depthClamp = {}; + wgpu::PrimitiveDepthClipControl depthClipControl = {}; wgpu::RequiredLimits limits = {}; - limits.nextInChain = &depthClamp; + limits.nextInChain = &depthClipControl; wgpu::DeviceDescriptor descriptor; descriptor.requiredLimits = &limits; - adapter.RequestDevice(&descriptor, ExpectRequestDeviceError, nullptr); + GetBackendAdapter().RequestDevice(&descriptor, ExpectRequestDeviceError, nullptr); } class DeviceTickValidationTest : public ValidationTest {}; diff --git a/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp b/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp index 805deeeceb..aa9db1c424 100644 --- a/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/DrawIndirectValidationTests.cpp @@ -24,12 +24,12 @@ class DrawIndirectValidationTest : public ValidationTest { ValidationTest::SetUp(); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4{ + @fragment fn main() -> @location(0) vec4{ return vec4(0.0, 0.0, 0.0, 0.0); })"); diff --git a/src/dawn/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp b/src/dawn/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp index e2f19063db..2a2e3159c8 100644 --- a/src/dawn/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/DrawVertexAndIndexBufferOOBValidationTests.cpp @@ -83,7 +83,7 @@ class DrawVertexAndIndexBufferOOBValidationTests : public ValidationTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); } @@ -117,7 +117,7 @@ class DrawVertexAndIndexBufferOOBValidationTests : public ValidationTest { std::stringstream shaderStringStream; shaderStringStream << R"( - @stage(vertex) + @vertex fn main()" << inputStringStream.str() << R"() -> @builtin(position) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); @@ -304,6 +304,12 @@ class DrawVertexAndIndexBufferOOBValidationTests : public ValidationTest { // Non-zero offset and size {(2 * kFloat32x4Stride), 5 * (2 * kFloat32x4Stride), (2 * kFloat32x4Stride), 3 * (2 * kFloat32x4Stride), 3}, + // For (strideCount - 1) * arrayStride + lastStride <= bound buffer size < strideCount * + // arrayStride + {(kFloat32x4Stride + 4), 2 * (kFloat32x4Stride + 4) + kFloat32x4Stride, 0, wgpu::kWholeSize, + 3}, + {(kFloat32x4Stride + 4), 2 * (kFloat32x4Stride + 4) + kFloat32x4Stride - 1, 0, + wgpu::kWholeSize, 2}, }; // Parameters list for instance-step-mode buffer. const std::vector kInstanceParamsList = { @@ -325,6 +331,12 @@ class DrawVertexAndIndexBufferOOBValidationTests : public ValidationTest { // Non-zero offset and size {(3 * kFloat32x2Stride), 7 * (3 * kFloat32x2Stride), (3 * kFloat32x2Stride), 5 * (3 * kFloat32x2Stride), 5}, + // For (strideCount - 1) * arrayStride + lastStride <= bound buffer size < strideCount * + // arrayStride + {(kFloat32x2Stride + 4), 2 * (kFloat32x2Stride + 4) + kFloat32x2Stride, 0, wgpu::kWholeSize, + 3}, + {(kFloat32x2Stride + 4), 2 * (kFloat32x2Stride + 4) + kFloat32x2Stride - 1, 0, + wgpu::kWholeSize, 2}, }; private: @@ -341,7 +353,9 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawBasic) { { // Implicit size VertexBufferList vertexBufferList = {{0, vertexBuffer, 0, wgpu::kWholeSize}}; - TestRenderPassDraw(pipeline, vertexBufferList, 3, 1, 0, 0, true); + TestRenderPassDraw(pipeline, vertexBufferList, /* vertexCount */ 3, + /* instanceCount */ 1, /* firstVertex */ 0, + /* firstInstance */ 0, /* isSuccess */ true); } { @@ -362,9 +376,12 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawVertexBufferOutOfBoundWit VertexBufferList vertexBufferList = { {0, vertexBuffer, params.bufferOffsetForEncoder, params.bufferSizeForEncoder}}; + DAWN_ASSERT(params.maxValidAccessNumber > 0); uint32_t n = params.maxValidAccessNumber; // It is ok to draw n vertices with vertex buffer - TestRenderPassDraw(pipeline, vertexBufferList, n, 1, 0, 0, true); + TestRenderPassDraw(pipeline, vertexBufferList, /* vertexCount */ n, + /* instanceCount */ 1, /* firstVertex */ 0, + /* firstInstance */ 0, /* isSuccess */ true); // It is ok to draw n-1 vertices with offset 1 TestRenderPassDraw(pipeline, vertexBufferList, n - 1, 1, 1, 0, true); // Drawing more vertices will cause OOB, even if not enough for another primitive @@ -396,10 +413,14 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawVertexBufferOutOfBoundWit instanceParams.bufferSizeForEncoder}, }; + DAWN_ASSERT(vertexParams.maxValidAccessNumber > 0); + DAWN_ASSERT(instanceParams.maxValidAccessNumber > 0); uint32_t vert = vertexParams.maxValidAccessNumber; uint32_t inst = instanceParams.maxValidAccessNumber; // It is ok to draw vert vertices - TestRenderPassDraw(pipeline, vertexBufferList, vert, 1, 0, 0, true); + TestRenderPassDraw(pipeline, vertexBufferList, /* vertexCount */ vert, + /* instanceCount */ 1, /* firstVertex */ 0, + /* firstInstance */ 0, /* isSuccess */ true); TestRenderPassDraw(pipeline, vertexBufferList, vert - 1, 1, 1, 0, true); // It is ok to draw vert vertices and inst instences TestRenderPassDraw(pipeline, vertexBufferList, vert, inst, 0, 0, true); @@ -419,6 +440,50 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawVertexBufferOutOfBoundWit } } +// Verify zero-attribute vertex buffer OOB for non-instanced Draw are caught in command encoder +TEST_F(DrawVertexAndIndexBufferOOBValidationTests, ZeroAttribute) { + // Create a render pipeline with zero-attribute vertex buffer description + wgpu::RenderPipeline pipeline = + CreateRenderPipelineWithBufferDesc({{kFloat32x4Stride, wgpu::VertexStepMode::Vertex, {}}}); + + wgpu::Buffer vertexBuffer = CreateBuffer(3 * kFloat32x4Stride); + + { + // Valid + VertexBufferList vertexBufferList = {{0, vertexBuffer, 0, wgpu::kWholeSize}}; + TestRenderPassDraw(pipeline, vertexBufferList, 3, 1, 0, 0, true); + } + + { + // OOB + VertexBufferList vertexBufferList = {{0, vertexBuffer, 0, 0}}; + TestRenderPassDraw(pipeline, vertexBufferList, 3, 1, 0, 0, false); + } +} + +// Verify vertex buffers don't need to be set to unused (hole) slots for Draw +TEST_F(DrawVertexAndIndexBufferOOBValidationTests, UnusedSlots) { + // Set vertex buffer only to the second slot + wgpu::Buffer vertexBuffer = CreateBuffer(3 * kFloat32x4Stride); + VertexBufferList vertexBufferList = {{1, vertexBuffer, 0, wgpu::kWholeSize}}; + + { + // The first slot it unused so valid even if vertex buffer is not set to it. + wgpu::RenderPipeline pipeline = CreateRenderPipelineWithBufferDesc( + {{0, wgpu::VertexStepMode::VertexBufferNotUsed, {}}, + {kFloat32x4Stride, wgpu::VertexStepMode::Vertex, {}}}); + TestRenderPassDraw(pipeline, vertexBufferList, 3, 1, 0, 0, true); + } + + { + // The first slot it used so invalid if vertex buffer is not set to it. + wgpu::RenderPipeline pipeline = CreateRenderPipelineWithBufferDesc( + {{0, wgpu::VertexStepMode::Vertex, {}}, + {kFloat32x4Stride, wgpu::VertexStepMode::Vertex, {}}}); + TestRenderPassDraw(pipeline, vertexBufferList, 3, 1, 0, 0, false); + } +} + // Control case for DrawIndexed TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedBasic) { wgpu::RenderPipeline pipeline = CreateBasicRenderPipeline(); @@ -432,7 +497,9 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedBasic) { IndexBufferDesc indexBufferDesc = {indexBuffer, wgpu::IndexFormat::Uint32}; - TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 12, 1, 0, 0, 0, true); + TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, /* indexCount */ 12, + /* instanceCount */ 1, /* firstIndex */ 0, /* baseVertex */ 0, + /* firstInstance */ 0, /* isSuccess */ true); } // Verify index buffer OOB for DrawIndexed are caught in command encoder @@ -454,10 +521,13 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedIndexBufferOOB) { params.indexBufferOffsetForEncoder, params.indexBufferSizeForEncoder}; + DAWN_ASSERT(params.maxValidIndexNumber > 0); uint32_t n = params.maxValidIndexNumber; // Control case - TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, n, 5, 0, 0, 0, true); + TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, /* indexCount */ n, + /* instanceCount */ 5, /* firstIndex */ 0, /* baseVertex */ 0, + /* firstInstance */ 0, /* isSuccess */ true); TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, n - 1, 5, 1, 0, 0, true); // Index buffer OOB, indexCount too large @@ -487,8 +557,8 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedVertexBufferOOB) { wgpu::RenderPipeline pipeline = CreateBasicRenderPipelineWithInstance( vertexParams.bufferStride, instanceParams.bufferStride); - auto indexFormat = wgpu::IndexFormat::Uint32; - auto indexStride = sizeof(uint32_t); + constexpr wgpu::IndexFormat indexFormat = wgpu::IndexFormat::Uint32; + constexpr uint64_t indexStride = sizeof(uint32_t); // Build index buffer for 12 indexes wgpu::Buffer indexBuffer = CreateBuffer(12 * indexStride, wgpu::BufferUsage::Index); @@ -505,10 +575,13 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedVertexBufferOOB) { IndexBufferDesc indexBufferDesc = {indexBuffer, indexFormat}; + DAWN_ASSERT(instanceParams.maxValidAccessNumber > 0); uint32_t inst = instanceParams.maxValidAccessNumber; // Control case - TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 12, inst, 0, 0, - 0, true); + TestRenderPassDrawIndexed( + pipeline, indexBufferDesc, vertexBufferList, /* indexCount */ 12, + /* instanceCount */ inst, /* firstIndex */ 0, /* baseVertex */ 0, + /* firstInstance */ 0, /* isSuccess */ true); // Vertex buffer (stepMode = instance) OOB, instanceCount too large TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 12, inst + 1, 0, 0, 0, false); @@ -527,8 +600,79 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedVertexBufferOOB) { } } -// Verify instance mode vertex buffer OOB for DrawIndexed are caught in command encoder -TEST_F(DrawVertexAndIndexBufferOOBValidationTests, ZeroArrayStrideVertexBufferOOB) { +// Verify zero-attribute instance step mode vertex buffer OOB for instanced DrawIndex +// are caught in command encoder +TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedZeroAttribute) { + // Create a render pipeline with a vertex step mode and a zero-attribute + // instance step mode vertex buffer description + wgpu::RenderPipeline pipeline = CreateRenderPipelineWithBufferDesc( + {{kFloat32x4Stride, wgpu::VertexStepMode::Vertex, {{0, wgpu::VertexFormat::Float32x4}}}, + {kFloat32x2Stride, wgpu::VertexStepMode::Instance, {}}}); + + // Build index buffer for 12 indexes + wgpu::Buffer indexBuffer = CreateBuffer(12 * sizeof(uint32_t), wgpu::BufferUsage::Index); + IndexBufferDesc indexBufferDesc = {indexBuffer, wgpu::IndexFormat::Uint32}; + + // Build vertex buffer for 3 vertices + wgpu::Buffer vertexBuffer = CreateBuffer(3 * kFloat32x4Stride); + + // Build vertex buffer for 3 instances + wgpu::Buffer instanceBuffer = CreateBuffer(3 * kFloat32x2Stride); + + { + // Valid + VertexBufferList vertexBufferList = {{0, vertexBuffer, 0, wgpu::kWholeSize}, + {1, vertexBuffer, 0, wgpu::kWholeSize}}; + TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 12, 3, 0, 0, 0, + true); + } + + { + // OOB + VertexBufferList vertexBufferList = {{0, vertexBuffer, 0, wgpu::kWholeSize}, + {1, vertexBuffer, 0, 0}}; + TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 12, 3, 0, 0, 0, + false); + } +} + +// Verify vertex buffers don't need to be set to unused (hole) slots for DrawIndexed +TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedUnusedSlots) { + // Build index buffer + wgpu::Buffer indexBuffer = CreateBuffer(12 * sizeof(uint32_t), wgpu::BufferUsage::Index); + IndexBufferDesc indexBufferDesc = {indexBuffer, wgpu::IndexFormat::Uint32}; + + // Set vertex buffers only to the second and third slots + wgpu::Buffer vertexBuffer = CreateBuffer(3 * kFloat32x4Stride); + wgpu::Buffer instanceBuffer = CreateBuffer(3 * kFloat32x2Stride); + VertexBufferList vertexBufferList = {{1, vertexBuffer, 0, wgpu::kWholeSize}, + {2, instanceBuffer, 0, wgpu::kWholeSize}}; + + { + // The first slot it unused so valid even if vertex buffer is not set to it. + wgpu::RenderPipeline pipeline = CreateRenderPipelineWithBufferDesc( + {{0, wgpu::VertexStepMode::VertexBufferNotUsed, {}}, + {kFloat32x4Stride, wgpu::VertexStepMode::Vertex, {}}, + {kFloat32x2Stride, wgpu::VertexStepMode::Instance, {}}}); + TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 12, 3, 0, 0, 0, + true); + } + + { + // The first slot it used so invalid if vertex buffer is not set to it. + wgpu::RenderPipeline pipeline = CreateRenderPipelineWithBufferDesc( + {{0, wgpu::VertexStepMode::Vertex, {}}, + {kFloat32x4Stride, wgpu::VertexStepMode::Vertex, {}}, + {kFloat32x2Stride, wgpu::VertexStepMode::Instance, {}}}); + TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 12, 3, 0, 0, 0, + false); + } +} + +// Verify zero array stride vertex buffer OOB for Draw and DrawIndexed are caught in command encoder +// This test only test cases that strideCount > 0. Cases of strideCount == 0 are tested in +// ZeroStrideCountVertexBufferNeverOOB. +TEST_F(DrawVertexAndIndexBufferOOBValidationTests, ZeroArrayStrideVertexBuffer) { // In this test, we use VertexBufferParams.maxValidAccessNumber > 0 to indicate that such // buffer parameter meet the requirement of pipeline, and maxValidAccessNumber == 0 to // indicate that such buffer parameter will cause OOB. @@ -569,8 +713,8 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, ZeroArrayStrideVertexBufferOO for (VertexBufferParams vertexParams : kVertexParamsListForZeroStride) { for (VertexBufferParams instanceParams : kInstanceParamsListForZeroStride) { - auto indexFormat = wgpu::IndexFormat::Uint32; - auto indexStride = sizeof(uint32_t); + constexpr wgpu::IndexFormat indexFormat = wgpu::IndexFormat::Uint32; + constexpr uint64_t indexStride = sizeof(uint32_t); // Build index buffer for 12 indexes wgpu::Buffer indexBuffer = CreateBuffer(12 * indexStride, wgpu::BufferUsage::Index); @@ -587,14 +731,137 @@ TEST_F(DrawVertexAndIndexBufferOOBValidationTests, ZeroArrayStrideVertexBufferOO IndexBufferDesc indexBufferDesc = {indexBuffer, indexFormat}; - const bool isSuccess = (vertexParams.maxValidAccessNumber > 0) && - (instanceParams.maxValidAccessNumber > 0); + const bool vertexModeBufferOOB = vertexParams.maxValidAccessNumber == 0; + const bool instanceModeBufferOOB = instanceParams.maxValidAccessNumber == 0; + + // Draw validate both vertex and instance step mode buffer OOB. // vertexCount and instanceCount doesn't matter, as array stride is zero and all - // vertex/instance access the same space of buffer - TestRenderPassDraw(pipeline, vertexBufferList, 100, 100, 0, 0, isSuccess); - // indexCount doesn't matter as long as no index buffer OOB happened - TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 12, 100, 0, 0, 0, - isSuccess); + // vertex/instance access the same space of buffer, as long as both (vertexCount + + // firstVertex) and (instanceCount + firstInstance) are larger than zero. + TestRenderPassDraw(pipeline, vertexBufferList, /* vertexCount */ 100, + /* instanceCount */ 100, /* firstVertex */ 0, + /* firstInstance */ 0, + /* isSuccess */ !vertexModeBufferOOB && !instanceModeBufferOOB); + TestRenderPassDraw(pipeline, vertexBufferList, 100, 100, 100, 100, + !vertexModeBufferOOB && !instanceModeBufferOOB); + TestRenderPassDraw(pipeline, vertexBufferList, 0, 0, 100, 100, + !vertexModeBufferOOB && !instanceModeBufferOOB); + + // DrawIndexed only validate instance step mode buffer OOB. + // indexCount doesn't matter as long as no index buffer OOB happened, and instanceCount + // doesn't matter as long as (instanceCount + firstInstance) are larger than zero. + TestRenderPassDrawIndexed( + pipeline, indexBufferDesc, vertexBufferList, /* indexCount */ 12, + /* instanceCount */ 100, /* firstIndex */ 0, /* baseVertex */ 0, + /* firstInstance */ 0, /* isSuccess */ !instanceModeBufferOOB); + TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 12, 0, 0, 0, 100, + !instanceModeBufferOOB); + } + } +} + +// Verify all vertex buffer never OOB for Draw and DrawIndexed with zero stride count +TEST_F(DrawVertexAndIndexBufferOOBValidationTests, ZeroStrideCountVertexBufferNeverOOB) { + // In this test we use a render pipeline with non-zero array stride and a render pipeline with + // zero array stride, both use a vertex step mode vertex buffer with lastStride = 16 and a + // instance step mode vertex buffer with lastStride = 8. Binding a buffer with size less than + // lastStride to corresponding buffer slot will result in a OOB validation error is strideCount + // is larger than 0, but shall not result in validation error if strideCount == 0. + + // Create the render pipeline with non-zero array stride (larger than lastStride) + std::vector bufferDescListNonZeroArrayStride = { + {20u, wgpu::VertexStepMode::Vertex, {{0, wgpu::VertexFormat::Float32x4}}}, + {12u, wgpu::VertexStepMode::Instance, {{3, wgpu::VertexFormat::Float32x2}}}, + }; + wgpu::RenderPipeline pipelineWithNonZeroArrayStride = + CreateRenderPipelineWithBufferDesc(bufferDescListNonZeroArrayStride); + + // Create the render pipeline with zero array stride + std::vector bufferDescListZeroArrayStride = { + {0u, wgpu::VertexStepMode::Vertex, {{0, wgpu::VertexFormat::Float32x4}}}, + {0u, wgpu::VertexStepMode::Instance, {{3, wgpu::VertexFormat::Float32x2}}}, + }; + wgpu::RenderPipeline pipelineWithZeroArrayStride = + CreateRenderPipelineWithBufferDesc(bufferDescListZeroArrayStride); + + const std::vector kVertexParamsListForZeroStride = { + // Size enough for 1 vertex + {kFloat32x4Stride, 16, 0, wgpu::kWholeSize, 1}, + // No enough size for 1 vertex + {kFloat32x4Stride, 19, 4, wgpu::kWholeSize, 0}, + {kFloat32x4Stride, 16, 16, wgpu::kWholeSize, 0}, + }; + + const std::vector kInstanceParamsListForZeroStride = { + // Size enough for 1 instance + {kFloat32x2Stride, 8, 0, wgpu::kWholeSize, 1}, + // No enough size for 1 instance + {kFloat32x2Stride, 11, 4, wgpu::kWholeSize, 0}, + {kFloat32x2Stride, 8, 8, wgpu::kWholeSize, 0}, + }; + + for (VertexBufferParams vertexParams : kVertexParamsListForZeroStride) { + for (VertexBufferParams instanceParams : kInstanceParamsListForZeroStride) { + for (wgpu::RenderPipeline pipeline : + {pipelineWithNonZeroArrayStride, pipelineWithZeroArrayStride}) { + constexpr wgpu::IndexFormat indexFormat = wgpu::IndexFormat::Uint32; + constexpr uint64_t indexStride = sizeof(uint32_t); + + // Build index buffer for 1 index + wgpu::Buffer indexBuffer = CreateBuffer(indexStride, wgpu::BufferUsage::Index); + // Build vertex buffer for vertices + wgpu::Buffer vertexBuffer = CreateBuffer(vertexParams.bufferSize); + // Build vertex buffer for instances + wgpu::Buffer instanceBuffer = CreateBuffer(instanceParams.bufferSize); + + VertexBufferList vertexBufferList = { + {0, vertexBuffer, vertexParams.bufferOffsetForEncoder, + vertexParams.bufferSizeForEncoder}, + {1, instanceBuffer, instanceParams.bufferOffsetForEncoder, + instanceParams.bufferSizeForEncoder}}; + + IndexBufferDesc indexBufferDesc = {indexBuffer, indexFormat}; + + const bool vertexModeBufferOOB = vertexParams.maxValidAccessNumber == 0; + const bool instanceModeBufferOOB = instanceParams.maxValidAccessNumber == 0; + + // Draw validate both vertex and instance step mode buffer OOB. + // Control case, non-zero stride for both step mode buffer + TestRenderPassDraw(pipeline, vertexBufferList, /* vertexCount */ 1, + /* instanceCount */ 1, /* firstVertex */ 0, + /* firstInstance */ 0, + /* isSuccess */ !vertexModeBufferOOB && !instanceModeBufferOOB); + TestRenderPassDraw(pipeline, vertexBufferList, 1, 0, 0, 1, + !vertexModeBufferOOB && !instanceModeBufferOOB); + TestRenderPassDraw(pipeline, vertexBufferList, 0, 1, 1, 0, + !vertexModeBufferOOB && !instanceModeBufferOOB); + TestRenderPassDraw(pipeline, vertexBufferList, 0, 0, 1, 1, + !vertexModeBufferOOB && !instanceModeBufferOOB); + // Vertex step mode buffer will never OOB if (vertexCount + firstVertex) is zero, + // and only instance step mode buffer OOB will fail validation + TestRenderPassDraw(pipeline, vertexBufferList, 0, 1, 0, 0, !instanceModeBufferOOB); + TestRenderPassDraw(pipeline, vertexBufferList, 0, 0, 0, 1, !instanceModeBufferOOB); + // Instance step mode buffer will never OOB if (instanceCount + firstInstance) is + // zero, and only vertex step mode buffer OOB will fail validation + TestRenderPassDraw(pipeline, vertexBufferList, 1, 0, 0, 0, !vertexModeBufferOOB); + TestRenderPassDraw(pipeline, vertexBufferList, 0, 0, 1, 0, !vertexModeBufferOOB); + // If both (vertexCount + firstVertex) and (instanceCount + firstInstance) are zero, + // all vertex buffer will never OOB + TestRenderPassDraw(pipeline, vertexBufferList, 0, 0, 0, 0, true); + + // DrawIndexed only validate instance step mode buffer OOB. + // Control case, non-zero stride for instance step mode buffer + TestRenderPassDrawIndexed( + pipeline, indexBufferDesc, vertexBufferList, /* indexCount */ 1, + /* instanceCount */ 1, /* firstIndex */ 0, /* baseVertex */ 0, + /* firstInstance */ 0, /* isSuccess */ !instanceModeBufferOOB); + TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 1, 0, 0, 0, + 1, !instanceModeBufferOOB); + // Instance step mode buffer will never OOB if (instanceCount + firstInstance) is + // zero, validation shall always succeed + TestRenderPassDrawIndexed(pipeline, indexBufferDesc, vertexBufferList, 1, 0, 0, 0, + 0, true); + } } } } diff --git a/src/dawn/tests/unittests/validation/ExternalTextureTests.cpp b/src/dawn/tests/unittests/validation/ExternalTextureTests.cpp index 340b8f774c..6f6aebcf74 100644 --- a/src/dawn/tests/unittests/validation/ExternalTextureTests.cpp +++ b/src/dawn/tests/unittests/validation/ExternalTextureTests.cpp @@ -41,6 +41,16 @@ class ExternalTextureTest : public ValidationTest { queue = device.GetQueue(); } + wgpu::ExternalTextureDescriptor CreateDefaultExternalTextureDescriptor() { + wgpu::ExternalTextureDescriptor desc; + desc.yuvToRgbConversionMatrix = mPlaceholderConstantArray.data(); + desc.gamutConversionMatrix = mPlaceholderConstantArray.data(); + desc.srcTransferFunctionParameters = mPlaceholderConstantArray.data(); + desc.dstTransferFunctionParameters = mPlaceholderConstantArray.data(); + + return desc; + } + static constexpr uint32_t kWidth = 32; static constexpr uint32_t kHeight = 32; static constexpr uint32_t kDefaultDepth = 1; @@ -53,6 +63,8 @@ class ExternalTextureTest : public ValidationTest { static constexpr wgpu::TextureFormat kBiplanarPlane0Format = wgpu::TextureFormat::R8Unorm; static constexpr wgpu::TextureFormat kBiplanarPlane1Format = wgpu::TextureFormat::RG8Unorm; + std::array mPlaceholderConstantArray; + wgpu::Queue queue; }; @@ -62,7 +74,7 @@ TEST_F(ExternalTextureTest, CreateExternalTextureValidation) { wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); wgpu::Texture texture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture.CreateView(); device.CreateExternalTexture(&externalDesc); } @@ -74,7 +86,7 @@ TEST_F(ExternalTextureTest, CreateExternalTextureValidation) { textureDescriptor.usage = wgpu::TextureUsage::TextureBinding; wgpu::Texture internalTexture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = internalTexture.CreateView(); ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); } @@ -85,7 +97,7 @@ TEST_F(ExternalTextureTest, CreateExternalTextureValidation) { textureDescriptor.mipLevelCount = 2; wgpu::Texture internalTexture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = internalTexture.CreateView(); ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); } @@ -97,7 +109,7 @@ TEST_F(ExternalTextureTest, CreateExternalTextureValidation) { textureDescriptor.mipLevelCount = 2; wgpu::Texture internalTexture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = internalTexture.CreateView(); ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); } @@ -108,7 +120,7 @@ TEST_F(ExternalTextureTest, CreateExternalTextureValidation) { textureDescriptor.format = wgpu::TextureFormat::R8Uint; wgpu::Texture internalTexture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = internalTexture.CreateView(); ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); } @@ -119,7 +131,7 @@ TEST_F(ExternalTextureTest, CreateExternalTextureValidation) { textureDescriptor.sampleCount = 4; wgpu::Texture internalTexture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = internalTexture.CreateView(); ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); } @@ -137,12 +149,75 @@ TEST_F(ExternalTextureTest, CreateExternalTextureValidation) { ASSERT_DEVICE_ERROR(wgpu::TextureView errorTextureView = internalTexture.CreateView(&errorViewDescriptor)); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = errorTextureView; ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); } } +TEST_F(ExternalTextureTest, CreateExternalTextureConstantValueValidation) { + DAWN_SKIP_TEST_IF(UsesWire()); + // Creating a single plane external texture without a YUV-to-RGB matrix should pass. + { + wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); + wgpu::Texture texture = device.CreateTexture(&textureDescriptor); + + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); + externalDesc.plane0 = texture.CreateView(); + externalDesc.yuvToRgbConversionMatrix = nullptr; + device.CreateExternalTexture(&externalDesc); + } + + // Creating a multiplanar external texture without a YUV-to-RGB matrix should fail. + { + wgpu::TextureDescriptor plane0TextureDescriptor = + CreateTextureDescriptor(kBiplanarPlane0Format); + wgpu::TextureDescriptor plane1TextureDescriptor = + CreateTextureDescriptor(kBiplanarPlane1Format); + wgpu::Texture texture0 = device.CreateTexture(&plane0TextureDescriptor); + wgpu::Texture texture1 = device.CreateTexture(&plane1TextureDescriptor); + + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); + externalDesc.plane0 = texture0.CreateView(); + externalDesc.plane1 = texture1.CreateView(); + externalDesc.yuvToRgbConversionMatrix = nullptr; + ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); + } + + // Creating an external texture without a gamut conversion matrix should fail. + { + wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); + wgpu::Texture texture = device.CreateTexture(&textureDescriptor); + + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); + externalDesc.plane0 = texture.CreateView(); + externalDesc.gamutConversionMatrix = nullptr; + ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); + } + + // Creating an external texture without source transfer function constants should fail. + { + wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); + wgpu::Texture texture = device.CreateTexture(&textureDescriptor); + + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); + externalDesc.plane0 = texture.CreateView(); + externalDesc.srcTransferFunctionParameters = nullptr; + ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); + } + + // Creating an external texture without destination transfer function constants should fail. + { + wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); + wgpu::Texture texture = device.CreateTexture(&textureDescriptor); + + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); + externalDesc.plane0 = texture.CreateView(); + externalDesc.dstTransferFunctionParameters = nullptr; + ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); + } +} + // Test that external texture creation works as expected in multiplane scenarios. TEST_F(ExternalTextureTest, CreateMultiplanarExternalTextureValidation) { // Creating an external texture from two 2D, single-subresource textures with a biplanar @@ -155,7 +230,7 @@ TEST_F(ExternalTextureTest, CreateMultiplanarExternalTextureValidation) { wgpu::Texture texture0 = device.CreateTexture(&plane0TextureDescriptor); wgpu::Texture texture1 = device.CreateTexture(&plane1TextureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture0.CreateView(); externalDesc.plane1 = texture1.CreateView(); @@ -172,7 +247,7 @@ TEST_F(ExternalTextureTest, CreateMultiplanarExternalTextureValidation) { wgpu::Texture texture0 = device.CreateTexture(&plane0TextureDescriptor); wgpu::Texture texture1 = device.CreateTexture(&plane1TextureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture0.CreateView(); externalDesc.plane1 = texture1.CreateView(); @@ -189,28 +264,12 @@ TEST_F(ExternalTextureTest, CreateMultiplanarExternalTextureValidation) { wgpu::Texture texture0 = device.CreateTexture(&plane0TextureDescriptor); wgpu::Texture texture1 = device.CreateTexture(&plane1TextureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture0.CreateView(); externalDesc.plane1 = texture1.CreateView(); ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); } - - // Creating a multiplanar external texture with a non-sRGB color space should fail. - { - wgpu::TextureDescriptor plane0TextureDescriptor = - CreateTextureDescriptor(kBiplanarPlane0Format); - wgpu::TextureDescriptor plane1TextureDescriptor = - CreateTextureDescriptor(kBiplanarPlane1Format); - wgpu::Texture texture0 = device.CreateTexture(&plane0TextureDescriptor); - wgpu::Texture texture1 = device.CreateTexture(&plane1TextureDescriptor); - - wgpu::ExternalTextureDescriptor externalDesc; - externalDesc.plane0 = texture0.CreateView(); - externalDesc.plane1 = texture1.CreateView(); - externalDesc.colorSpace = wgpu::PredefinedColorSpace::Undefined; - ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc)); - } } // Test that submitting a render pass that contains a destroyed external texture results in @@ -219,7 +278,7 @@ TEST_F(ExternalTextureTest, SubmitDestroyedExternalTextureInRenderPass) { wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); wgpu::Texture texture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture.CreateView(); wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&externalDesc); @@ -270,7 +329,7 @@ TEST_F(ExternalTextureTest, SubmitDereferencedExternalTextureInRenderPass) { wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); wgpu::Texture texture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture.CreateView(); wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&externalDesc); @@ -321,7 +380,7 @@ TEST_F(ExternalTextureTest, SubmitDestroyedExternalTexturePlaneInRenderPass) { wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); wgpu::Texture texture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture.CreateView(); wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&externalDesc); @@ -372,7 +431,7 @@ TEST_F(ExternalTextureTest, SubmitDestroyedExternalTextureInComputePass) { wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); wgpu::Texture texture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture.CreateView(); wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&externalDesc); @@ -418,7 +477,7 @@ TEST_F(ExternalTextureTest, SubmitDestroyedExternalTexturePlaneInComputePass) { wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); wgpu::Texture texture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture.CreateView(); wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&externalDesc); @@ -462,7 +521,7 @@ TEST_F(ExternalTextureTest, BindGroupDoesNotMatchLayout) { wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); wgpu::Texture texture = device.CreateTexture(&textureDescriptor); - wgpu::ExternalTextureDescriptor externalDesc; + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); externalDesc.plane0 = texture.CreateView(); wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&externalDesc); @@ -482,4 +541,44 @@ TEST_F(ExternalTextureTest, BindGroupDoesNotMatchLayout) { } } +// Regression test for crbug.com/1343099 where BindGroup validation let other binding types be used +// for external texture bindings. +TEST_F(ExternalTextureTest, TextureViewBindingDoesntMatch) { + wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout( + device, {{0, wgpu::ShaderStage::Fragment, &utils::kExternalTextureBindingLayout}}); + + wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); + wgpu::Texture texture = device.CreateTexture(&textureDescriptor); + + // The bug was that this passed validation and crashed inside the backends with a null + // dereference. It passed validation because the number of bindings matched (1 == 1) and that + // the validation didn't check that an external texture binding was required, fell back to + // checking for the binding type of entry 0 that had been decayed to be a sampled texture view. + ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, bgl, {{0, texture.CreateView()}})); +} + +// Ensure that bind group validation catches error external textures. +TEST_F(ExternalTextureTest, UseErrorExternalTextureInBindGroup) { + // Control case should succeed. + { + wgpu::TextureDescriptor textureDescriptor = CreateTextureDescriptor(); + wgpu::Texture texture = device.CreateTexture(&textureDescriptor); + + wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor(); + externalDesc.plane0 = texture.CreateView(); + wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&externalDesc); + wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout( + device, {{0, wgpu::ShaderStage::Fragment, &utils::kExternalTextureBindingLayout}}); + utils::MakeBindGroup(device, bgl, {{0, externalTexture}}); + } + + // Bind group creation should fail when an error external texture is present. + { + wgpu::ExternalTexture errorExternalTexture = device.CreateErrorExternalTexture(); + wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout( + device, {{0, wgpu::ShaderStage::Fragment, &utils::kExternalTextureBindingLayout}}); + ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, bgl, {{0, errorExternalTexture}})); + } +} + } // namespace diff --git a/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp b/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp index b976ed18f6..1bf2af4c24 100644 --- a/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp @@ -21,7 +21,7 @@ class GetBindGroupLayoutTests : public ValidationTest { protected: wgpu::RenderPipeline RenderPipelineFromFragmentShader(const char* shader) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -52,7 +52,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) { @group(0) @binding(0) var uniform0 : S; @group(1) @binding(0) var uniform1 : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : vec4 = uniform0.pos; pos = uniform1.pos; return vec4(); @@ -69,7 +69,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) { } @group(3) @binding(0) var storage3 : S3; - @stage(fragment) fn main() { + @fragment fn main() { var pos_u : vec4 = uniform2.pos; var pos_s : mat4x4 = storage3.pos; })"); @@ -103,7 +103,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultBindGroupLayoutPipelineCompatibility) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); @@ -125,7 +125,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); @@ -178,7 +178,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule emptyVertexModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { _ = myTexture; _ = mySampler; return vec4(); @@ -187,7 +187,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule textureLoadVertexModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureLoad(myTexture, vec2(), 0); _ = mySampler; return vec4(); @@ -196,7 +196,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule textureSampleVertexModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureSampleLevel(myTexture, mySampler, vec2(), 0.0); return vec4(); })"); @@ -204,7 +204,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule unusedTextureFragmentModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = myTexture; _ = mySampler; })"); @@ -212,7 +212,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule textureLoadFragmentModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(fragment) fn main() { + @fragment fn main() { textureLoad(myTexture, vec2(), 0); _ = mySampler; })"); @@ -220,7 +220,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultTextureSampleType) { wgpu::ShaderModule textureSampleFragmentModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; @group(0) @binding(1) var mySampler : sampler; - @stage(fragment) fn main() { + @fragment fn main() { textureSample(myTexture, mySampler, vec2()); })"); @@ -295,7 +295,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) { } @group(0) @binding(0) var uniforms : S; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { var pos : vec4 = uniforms.pos; })"); @@ -348,7 +348,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { } @group(0) @binding(0) var ssbo : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = ssbo.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -362,7 +362,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -377,7 +377,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { } @group(0) @binding(0) var ssbo : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = ssbo.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -391,7 +391,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -403,7 +403,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_multisampled_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -416,7 +416,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -444,7 +444,7 @@ TEST_F(GetBindGroupLayoutTests, ExternalTextureBindingType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myExternalTexture: texture_external; - @stage(fragment) fn main() { + @fragment fn main() { _ = myExternalTexture; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -472,7 +472,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_1d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -484,7 +484,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -496,7 +496,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d_array; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -508,7 +508,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_3d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -520,7 +520,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_cube; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -532,7 +532,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_cube_array; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -560,7 +560,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -572,7 +572,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -584,7 +584,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) { wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -617,7 +617,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -632,7 +632,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { } @group(0) @binding(1) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -647,7 +647,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) { } @group(0) @binding(1) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( @@ -664,7 +664,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) { @group(0) @binding(0) var uniform0 : S; @group(1) @binding(0) var uniform1 : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : vec4 = uniform0.pos; pos = uniform1.pos; return vec4(); @@ -676,7 +676,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) { } @group(1) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms.pos; })"); @@ -702,7 +702,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { } @group(0) @binding(0) var uniforms : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : f32 = uniforms.pos; return vec4(); })"); @@ -713,7 +713,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { } @group(0) @binding(0) var uniforms : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : mat4x4 = uniforms.pos; return vec4(); })"); @@ -724,7 +724,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : f32 = uniforms.pos; })"); @@ -734,7 +734,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) { } @group(0) @binding(0) var uniforms : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : mat4x4 = uniforms.pos; })"); @@ -793,24 +793,24 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) { DAWN_SKIP_TEST_IF(UsesWire()); wgpu::ShaderModule vsModuleNoSampler = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { _ = mySampler; return vec4(); })"); wgpu::ShaderModule fsModuleNoSampler = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); wgpu::ShaderModule fsModuleSampler = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var mySampler: sampler; - @stage(fragment) fn main() { + @fragment fn main() { _ = mySampler; })"); @@ -869,7 +869,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) { } @group(0) @binding(0) var ubo : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : vec4 = ubo.pos; return vec4(); })"); @@ -880,7 +880,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) { } @group(0) @binding(0) var ssbo : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = ssbo.pos; })"); @@ -897,7 +897,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureDimensions(myTexture); return vec4(); })"); @@ -905,7 +905,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_multisampled_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); @@ -922,7 +922,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureDimensions(myTexture); return vec4(); })"); @@ -930,7 +930,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_3d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); @@ -947,7 +947,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { textureDimensions(myTexture); return vec4(); })"); @@ -955,7 +955,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var myTexture : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"); @@ -970,12 +970,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) { // Test it is an error to query an out of range bind group layout. TEST_F(GetBindGroupLayoutTests, OutOfRangeIndex) { ASSERT_DEVICE_ERROR(RenderPipelineFromFragmentShader(R"( - @stage(fragment) fn main() { + @fragment fn main() { })") .GetBindGroupLayout(kMaxBindGroups)); ASSERT_DEVICE_ERROR(RenderPipelineFromFragmentShader(R"( - @stage(fragment) fn main() { + @fragment fn main() { })") .GetBindGroupLayout(kMaxBindGroups + 1)); } @@ -994,7 +994,7 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) { @group(0) @binding(0) var uniforms0 : S; @group(2) @binding(0) var uniforms2 : S; - @stage(fragment) fn main() { + @fragment fn main() { var pos : vec4 = uniforms0.pos; pos = uniforms2.pos; })"); @@ -1046,13 +1046,13 @@ TEST_F(GetBindGroupLayoutTests, Reflection) { } @group(0) @binding(0) var uniforms : S; - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { var pos : vec4 = uniforms.pos; return vec4(); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDesc; @@ -1088,11 +1088,11 @@ TEST_F(GetBindGroupLayoutTests, FromCorrectEntryPoint) { @group(0) @binding(0) var data0 : Data; @group(0) @binding(1) var data1 : Data; - @stage(compute) @workgroup_size(1) fn compute0() { + @compute @workgroup_size(1) fn compute0() { data0.data = 0.0; } - @stage(compute) @workgroup_size(1) fn compute1() { + @compute @workgroup_size(1) fn compute1() { data1.data = 0.0; } )"); diff --git a/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp b/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp index 1d4dbb6e63..3805ef9c4a 100644 --- a/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/IndexBufferValidationTests.cpp @@ -23,12 +23,12 @@ class IndexBufferValidationTest : public ValidationTest { wgpu::RenderPipeline MakeTestPipeline(wgpu::IndexFormat format, wgpu::PrimitiveTopology primitiveTopology) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); diff --git a/src/dawn/tests/unittests/validation/InternalUsageValidationTests.cpp b/src/dawn/tests/unittests/validation/InternalUsageValidationTests.cpp index 623697d292..7e03799d91 100644 --- a/src/dawn/tests/unittests/validation/InternalUsageValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/InternalUsageValidationTests.cpp @@ -64,12 +64,12 @@ TEST_F(InternalUsageValidationDisabledTest, CommandEncoderDescriptorRequiresFeat } class TextureInternalUsageValidationTest : public ValidationTest { - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::DawnInternalUsages}; descriptor.requiredFeatures = requiredFeatures; descriptor.requiredFeaturesCount = 1; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } }; @@ -115,7 +115,7 @@ TEST_F(TextureInternalUsageValidationTest, UsageValidation) { { wgpu::TextureDescriptor textureDesc = {}; textureDesc.size = {1, 1}; - textureDesc.usage = wgpu::TextureUsage::CopySrc; + textureDesc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment; textureDesc.format = wgpu::TextureFormat::RGBA8Unorm; textureDesc.sampleCount = 4; @@ -204,6 +204,24 @@ TEST_F(TextureInternalUsageValidationTest, DeprecatedCommandValidation) { } } +// Test that the internal usages aren't reflected with wgpu::Texture::GetUsage. +TEST_F(TextureInternalUsageValidationTest, InternalUsagesAreNotReflected) { + wgpu::DawnTextureInternalUsageDescriptor internalDesc = {}; + internalDesc.internalUsage = wgpu::TextureUsage::StorageBinding; + + wgpu::TextureDescriptor textureDesc = {}; + textureDesc.size = {1, 1}; + textureDesc.usage = wgpu::TextureUsage::CopySrc; + textureDesc.format = wgpu::TextureFormat::RGBA8Unorm; + textureDesc.nextInChain = &internalDesc; + + wgpu::Texture texture = device.CreateTexture(&textureDesc); + ASSERT_EQ(texture.GetUsage(), wgpu::TextureUsage::CopySrc); +} + + +// Test the validation of internal usages against command encoders with and without +// useInternalUsages. TEST_F(TextureInternalUsageValidationTest, CommandValidation) { wgpu::TextureDescriptor textureDesc = {}; textureDesc.size = {1, 1}; diff --git a/src/dawn/tests/unittests/validation/LabelTests.cpp b/src/dawn/tests/unittests/validation/LabelTests.cpp index 5b1b3ea696..a6d0b44e71 100644 --- a/src/dawn/tests/unittests/validation/LabelTests.cpp +++ b/src/dawn/tests/unittests/validation/LabelTests.cpp @@ -18,10 +18,14 @@ #include "dawn/utils/ComboRenderPipelineDescriptor.h" #include "dawn/utils/WGPUHelpers.h" -class LabelTest : public ValidationTest {}; +class LabelTest : public ValidationTest { + void SetUp() override { + ValidationTest::SetUp(); + DAWN_SKIP_TEST_IF(UsesWire()); + } +}; TEST_F(LabelTest, BindGroup) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {}); @@ -55,7 +59,6 @@ TEST_F(LabelTest, BindGroup) { } TEST_F(LabelTest, BindGroupLayout) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::BindGroupLayoutDescriptor descriptor = {}; @@ -87,7 +90,6 @@ TEST_F(LabelTest, BindGroupLayout) { } TEST_F(LabelTest, Buffer) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::BufferDescriptor descriptor; descriptor.size = 4; @@ -118,7 +120,6 @@ TEST_F(LabelTest, Buffer) { } TEST_F(LabelTest, CommandBuffer) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::CommandBufferDescriptor descriptor; @@ -150,7 +151,6 @@ TEST_F(LabelTest, CommandBuffer) { } TEST_F(LabelTest, CommandEncoder) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::CommandEncoderDescriptor descriptor; @@ -179,7 +179,6 @@ TEST_F(LabelTest, CommandEncoder) { } TEST_F(LabelTest, ComputePassEncoder) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); @@ -213,7 +212,6 @@ TEST_F(LabelTest, ComputePassEncoder) { } TEST_F(LabelTest, ExternalTexture) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::TextureDescriptor textureDescriptor; textureDescriptor.size.width = 1; @@ -229,6 +227,11 @@ TEST_F(LabelTest, ExternalTexture) { wgpu::ExternalTextureDescriptor descriptor; descriptor.plane0 = texture.CreateView(); + std::array mPlaceholderConstantArray; + descriptor.yuvToRgbConversionMatrix = mPlaceholderConstantArray.data(); + descriptor.gamutConversionMatrix = mPlaceholderConstantArray.data(); + descriptor.srcTransferFunctionParameters = mPlaceholderConstantArray.data(); + descriptor.dstTransferFunctionParameters = mPlaceholderConstantArray.data(); // The label should be empty if one was not set. { @@ -255,7 +258,6 @@ TEST_F(LabelTest, ExternalTexture) { } TEST_F(LabelTest, PipelineLayout) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(device, {}); @@ -319,13 +321,13 @@ TEST_F(LabelTest, QuerySet) { } TEST_F(LabelTest, Queue) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; // The label should be empty if one was not set. { wgpu::DeviceDescriptor descriptor; - wgpu::Device labelDevice = adapter.CreateDevice(&descriptor); + wgpu::Device labelDevice = + wgpu::Device::Acquire(GetBackendAdapter().CreateDevice(&descriptor)); std::string readbackLabel = dawn::native::GetObjectLabelForTesting(labelDevice.GetQueue().Get()); ASSERT_TRUE(readbackLabel.empty()); @@ -334,7 +336,8 @@ TEST_F(LabelTest, Queue) { // Test setting a label through API { wgpu::DeviceDescriptor descriptor; - wgpu::Device labelDevice = adapter.CreateDevice(&descriptor); + wgpu::Device labelDevice = + wgpu::Device::Acquire(GetBackendAdapter().CreateDevice(&descriptor)); labelDevice.GetQueue().SetLabel(label.c_str()); std::string readbackLabel = dawn::native::GetObjectLabelForTesting(labelDevice.GetQueue().Get()); @@ -345,7 +348,8 @@ TEST_F(LabelTest, Queue) { { wgpu::DeviceDescriptor descriptor; descriptor.defaultQueue.label = label.c_str(); - wgpu::Device labelDevice = adapter.CreateDevice(&descriptor); + wgpu::Device labelDevice = + wgpu::Device::Acquire(GetBackendAdapter().CreateDevice(&descriptor)); std::string readbackLabel = dawn::native::GetObjectLabelForTesting(labelDevice.GetQueue().Get()); ASSERT_EQ(label, readbackLabel); @@ -353,7 +357,6 @@ TEST_F(LabelTest, Queue) { } TEST_F(LabelTest, RenderBundleEncoder) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; utils::ComboRenderBundleEncoderDescriptor descriptor = {}; @@ -385,7 +388,6 @@ TEST_F(LabelTest, RenderBundleEncoder) { } TEST_F(LabelTest, RenderPassEncoder) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); @@ -425,7 +427,6 @@ TEST_F(LabelTest, RenderPassEncoder) { } TEST_F(LabelTest, Sampler) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::SamplerDescriptor descriptor; @@ -454,7 +455,6 @@ TEST_F(LabelTest, Sampler) { } TEST_F(LabelTest, Texture) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::TextureDescriptor descriptor; descriptor.size.width = 1; @@ -491,7 +491,6 @@ TEST_F(LabelTest, Texture) { } TEST_F(LabelTest, TextureView) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::TextureDescriptor descriptor; descriptor.size.width = 1; @@ -531,16 +530,15 @@ TEST_F(LabelTest, TextureView) { } TEST_F(LabelTest, RenderPipeline) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -573,11 +571,10 @@ TEST_F(LabelTest, RenderPipeline) { } TEST_F(LabelTest, ComputePipeline) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; wgpu::ShaderModule computeModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, nullptr); wgpu::ComputePipelineDescriptor descriptor; @@ -610,11 +607,10 @@ TEST_F(LabelTest, ComputePipeline) { } TEST_F(LabelTest, ShaderModule) { - DAWN_SKIP_TEST_IF(UsesWire()); std::string label = "test"; const char* source = R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"; wgpu::ShaderModuleWGSLDescriptor wgslDesc; diff --git a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp index ae213f48b6..b8fbcdea1d 100644 --- a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp @@ -118,21 +118,21 @@ static const std::string kStructs = "struct ThreeFloats {f1 : f32, f2 : f32, f3 // Creates a compute shader with given bindings std::string CreateComputeShaderWithBindings(const std::vector& bindings) { return kStructs + GenerateBindingString(bindings) + - "@stage(compute) @workgroup_size(1,1,1) fn main() {\n" + + "@compute @workgroup_size(1,1,1) fn main() {\n" + GenerateReferenceString(bindings, wgpu::ShaderStage::Compute) + "}"; } // Creates a vertex shader with given bindings std::string CreateVertexShaderWithBindings(const std::vector& bindings) { return kStructs + GenerateBindingString(bindings) + - "@stage(vertex) fn main() -> @builtin(position) vec4 {\n" + + "@vertex fn main() -> @builtin(position) vec4 {\n" + GenerateReferenceString(bindings, wgpu::ShaderStage::Vertex) + "\n return vec4(); " + "}"; } // Creates a fragment shader with given bindings std::string CreateFragmentShaderWithBindings(const std::vector& bindings) { - return kStructs + GenerateBindingString(bindings) + "@stage(fragment) fn main() {\n" + + return kStructs + GenerateBindingString(bindings) + "@fragment fn main() {\n" + GenerateReferenceString(bindings, wgpu::ShaderStage::Fragment) + "}"; } @@ -541,7 +541,7 @@ TEST_F(MinBufferSizeDefaultLayoutTests, DefaultLayoutVariousWGSLTypes) { CheckShaderBindingSizeReflection({{{0, 0, "a : f32,", "f32", "a", 4}, {0, 1, "b : array,", "f32", "b[0]", 4}, {0, 2, "c : mat2x2,", "mat2x2", "c", 16}}}); - CheckShaderBindingSizeReflection({{{0, 3, "d : u32; e : array,", "u32", "d", 8}, + CheckShaderBindingSizeReflection({{{0, 3, "d : u32, e : array,", "u32", "d", 8}, {0, 4, "f : ThreeFloats,", "f32", "f.f1", 12}, {0, 5, "g : array,", "f32", "g[0].f1", 12}}}); } diff --git a/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp b/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp index 2f1c515e4f..3498f1da04 100644 --- a/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp +++ b/src/dawn/tests/unittests/validation/MultipleDeviceTests.cpp @@ -27,7 +27,7 @@ class MultipleDeviceTest : public ValidationTest {}; // Test that it is invalid to submit a command buffer created on a different device. TEST_F(MultipleDeviceTest, ValidatesSameDevice) { - wgpu::Device device2 = RegisterDevice(CreateTestDevice()); + wgpu::Device device2 = RequestDeviceSync(wgpu::DeviceDescriptor{}); wgpu::CommandBuffer commandBuffer = device2.CreateCommandEncoder().Finish(); ASSERT_DEVICE_ERROR(device.GetQueue().Submit(1, &commandBuffer)); @@ -38,7 +38,7 @@ TEST_F(MultipleDeviceTest, ValidatesSameDevice) { TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) { wgpu::ShaderModuleWGSLDescriptor wgslDesc = {}; wgslDesc.source = R"( - @stage(compute) @workgroup_size(1, 1, 1) fn main() { + @compute @workgroup_size(1, 1, 1) fn main() { } )"; @@ -66,7 +66,7 @@ TEST_F(MultipleDeviceTest, ValidatesSameDeviceCreatePipelineAsync) { // CreateComputePipelineAsync errors if the shader module is created on a different device. { - wgpu::Device device2 = RegisterDevice(CreateTestDevice()); + wgpu::Device device2 = RequestDeviceSync(wgpu::DeviceDescriptor{}); wgpu::ShaderModule shaderModule = device2.CreateShaderModule(&shaderModuleDesc); wgpu::ComputePipelineDescriptor pipelineDesc = {}; diff --git a/src/dawn/tests/unittests/validation/OverridableConstantsValidationTests.cpp b/src/dawn/tests/unittests/validation/OverridableConstantsValidationTests.cpp index c42aa1e675..882bf25d24 100644 --- a/src/dawn/tests/unittests/validation/OverridableConstantsValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/OverridableConstantsValidationTests.cpp @@ -34,7 +34,7 @@ override c8: u32 = 0u; // type: uint32 override c9: u32 = 0u; // default override @id(1000) override c10: u32 = 10u; // default -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { // make sure the overridable constants are not optimized out _ = u32(c0); _ = u32(c1); @@ -64,7 +64,7 @@ override c8: u32; // type: uint32 override c9: u32 = 0u; // default override @id(1000) override c10: u32 = 10u; // default -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { // make sure the overridable constants are not optimized out _ = u32(c0); _ = u32(c1); diff --git a/src/dawn/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp b/src/dawn/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp index 49195c0bd0..7821933bb3 100644 --- a/src/dawn/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp +++ b/src/dawn/tests/unittests/validation/PipelineAndPassCompatibilityTests.cpp @@ -33,11 +33,11 @@ class RenderPipelineAndPassCompatibilityTests : public ValidationTest { // Create a NoOp pipeline utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); pipelineDescriptor.cFragment.targets = nullptr; pipelineDescriptor.cFragment.targetCount = 0; diff --git a/src/dawn/tests/unittests/validation/QueryValidationTests.cpp b/src/dawn/tests/unittests/validation/QueryValidationTests.cpp index bc3b7fed91..508835182c 100644 --- a/src/dawn/tests/unittests/validation/QueryValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/QueryValidationTests.cpp @@ -78,6 +78,46 @@ TEST_F(QuerySetValidationTest, DestroyDestroyedQuerySet) { querySet.Destroy(); } +// Test that the query set creation parameters are correctly reflected for successfully created +// query sets. +TEST_F(QuerySetValidationTest, CreationParameterReflectionForValidQuerySet) { + // Test reflection on two succesfully created but different query sets + { + wgpu::QuerySetDescriptor desc; + desc.type = wgpu::QueryType::Occlusion; + desc.count = 18; + wgpu::QuerySet set = device.CreateQuerySet(&desc); + + EXPECT_EQ(wgpu::QueryType::Occlusion, set.GetType()); + EXPECT_EQ(18u, set.GetCount()); + } + { + wgpu::QuerySetDescriptor desc; + // Unfortunately without extensions we can't check a different type. + desc.type = wgpu::QueryType::Occlusion; + desc.count = 1; + wgpu::QuerySet set = device.CreateQuerySet(&desc); + + EXPECT_EQ(wgpu::QueryType::Occlusion, set.GetType()); + EXPECT_EQ(1u, set.GetCount()); + } +} + +// Test that the query set creation parameters are correctly reflected for error query sets. +TEST_F(QuerySetValidationTest, CreationParameterReflectionForErrorQuerySet) { + wgpu::QuerySetDescriptor desc; + desc.type = static_cast(0xFFFF); + desc.count = 76; + + // Error! We have a garbage type. + wgpu::QuerySet set; + ASSERT_DEVICE_ERROR(set = device.CreateQuerySet(&desc)); + + // Reflection data is still exactly what was in the descriptor. + EXPECT_EQ(desc.type, set.GetType()); + EXPECT_EQ(76u, set.GetCount()); +} + class OcclusionQueryValidationTest : public QuerySetValidationTest {}; // Test the occlusionQuerySet in RenderPassDescriptor @@ -111,7 +151,7 @@ TEST_F(OcclusionQueryValidationTest, InvalidOcclusionQuerySet) { // Fail to begin render pass if the occlusionQuerySet is created from other device { - wgpu::Device otherDevice = RegisterDevice(adapter.CreateDevice()); + wgpu::Device otherDevice = RequestDeviceSync(wgpu::DeviceDescriptor{}); wgpu::QuerySet occlusionQuerySetOnOther = CreateQuerySet(otherDevice, wgpu::QueryType::Occlusion, 2); renderPass.occlusionQuerySet = occlusionQuerySetOnOther; @@ -225,7 +265,7 @@ TEST_F(OcclusionQueryValidationTest, InvalidBeginAndEnd) { class TimestampQueryValidationTest : public QuerySetValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::TimestampQuery}; descriptor.requiredFeatures = requiredFeatures; @@ -237,7 +277,7 @@ class TimestampQueryValidationTest : public QuerySetValidationTest { togglesDesc.forceDisabledToggles = forceDisabledToggles; togglesDesc.forceDisabledTogglesCount = 1; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } void EncodeRenderPassWithTimestampWrites( @@ -324,7 +364,7 @@ TEST_F(TimestampQueryValidationTest, TimestampWritesOnComputePass) { // Fail to write timestamps to a query set created from another device { - wgpu::Device otherDevice = RegisterDevice(adapter.CreateDevice()); + wgpu::Device otherDevice = RequestDeviceSync(wgpu::DeviceDescriptor{}); wgpu::QuerySet querySetFromOtherDevice = CreateQuerySet(otherDevice, wgpu::QueryType::Timestamp, 2); @@ -352,13 +392,23 @@ TEST_F(TimestampQueryValidationTest, TimestampWritesOnComputePass) { encoder.Finish(); } - // Success to write timestamps at same location of compute pass + // Success to write timestamps at same location of different compute pass + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + EncodeComputePassWithTimestampWrites( + encoder, {{querySet, 0, wgpu::ComputePassTimestampLocation::Beginning}}); + EncodeComputePassWithTimestampWrites( + encoder, {{querySet, 0, wgpu::ComputePassTimestampLocation::Beginning}}); + encoder.Finish(); + } + + // Fail to write timestamps at same location of a compute pass { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); EncodeComputePassWithTimestampWrites( encoder, {{querySet, 0, wgpu::ComputePassTimestampLocation::Beginning}, {querySet, 1, wgpu::ComputePassTimestampLocation::Beginning}}); - encoder.Finish(); + ASSERT_DEVICE_ERROR(encoder.Finish()); } // Fail to write timestamps at invalid location of compute pass @@ -408,7 +458,7 @@ TEST_F(TimestampQueryValidationTest, TimestampWritesOnRenderPass) { // Fail to write timestamps to a query set created from another device { - wgpu::Device otherDevice = RegisterDevice(adapter.CreateDevice()); + wgpu::Device otherDevice = RequestDeviceSync(wgpu::DeviceDescriptor{}); wgpu::QuerySet querySetFromOtherDevice = CreateQuerySet(otherDevice, wgpu::QueryType::Timestamp, 2); @@ -427,7 +477,8 @@ TEST_F(TimestampQueryValidationTest, TimestampWritesOnRenderPass) { ASSERT_DEVICE_ERROR(encoder.Finish()); } - // Success to write timestamps to the same query index twice on different render pass + // Success to write timestamps to the same query index and location twice on different render + // pass { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); EncodeRenderPassWithTimestampWrites( @@ -449,13 +500,13 @@ TEST_F(TimestampQueryValidationTest, TimestampWritesOnRenderPass) { ASSERT_DEVICE_ERROR(encoder.Finish()); } - // Success to write timestamps at same location of render pass + // Fail to write timestamps at same location of a render pass { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); EncodeRenderPassWithTimestampWrites( encoder, {{querySet, 0, wgpu::RenderPassTimestampLocation::Beginning}, {querySet, 1, wgpu::RenderPassTimestampLocation::Beginning}}); - encoder.Finish(); + ASSERT_DEVICE_ERROR(encoder.Finish()); } // Fail to write timestamps at invalid location of render pass @@ -640,7 +691,7 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnRenderPassEncoder) { class PipelineStatisticsQueryValidationTest : public QuerySetValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::PipelineStatisticsQuery}; descriptor.requiredFeatures = requiredFeatures; @@ -654,7 +705,7 @@ class PipelineStatisticsQueryValidationTest : public QuerySetValidationTest { togglesDesc.forceDisabledToggles = forceDisabledToggles; togglesDesc.forceDisabledTogglesCount = 1; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } }; @@ -793,7 +844,7 @@ TEST_F(ResolveQuerySetValidationTest, ResolveToInvalidBufferAndOffset) { // Fail to resolve query set to a buffer created from another device { - wgpu::Device otherDevice = RegisterDevice(adapter.CreateDevice()); + wgpu::Device otherDevice = RequestDeviceSync(wgpu::DeviceDescriptor{}); wgpu::Buffer bufferOnOther = CreateBuffer(otherDevice, kBufferSize, wgpu::BufferUsage::QueryResolve); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); diff --git a/src/dawn/tests/unittests/validation/QueueSubmitValidationTests.cpp b/src/dawn/tests/unittests/validation/QueueSubmitValidationTests.cpp index b099e79950..954e038251 100644 --- a/src/dawn/tests/unittests/validation/QueueSubmitValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/QueueSubmitValidationTests.cpp @@ -175,12 +175,12 @@ TEST_F(QueueSubmitValidationTest, SubmitInCreateRenderPipelineAsyncCallback) { }; wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -211,7 +211,7 @@ TEST_F(QueueSubmitValidationTest, SubmitInCreateComputePipelineAsyncCallback) { wgpu::ComputePipelineDescriptor descriptor; descriptor.compute.module = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); descriptor.compute.entryPoint = "main"; device.CreateComputePipelineAsync(&descriptor, callback, &callbackData); @@ -236,7 +236,7 @@ TEST_F(QueueSubmitValidationTest, SubmitWithUnusedComputeBuffer) { cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, testBGL}); cpDesc.compute.entryPoint = "main"; cpDesc.compute.module = - utils::CreateShaderModule(device, "@stage(compute) @workgroup_size(1) fn main() {}"); + utils::CreateShaderModule(device, "@compute @workgroup_size(1) fn main() {}"); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc); wgpu::BufferDescriptor bufDesc; @@ -304,7 +304,7 @@ TEST_F(QueueSubmitValidationTest, SubmitWithUnusedComputeTextures) { cpDesc.layout = utils::MakePipelineLayout(device, {emptyBGL, emptyBGL, testBGL}); cpDesc.compute.entryPoint = "main"; cpDesc.compute.module = - utils::CreateShaderModule(device, "@stage(compute) @workgroup_size(1) fn main() {}"); + utils::CreateShaderModule(device, "@compute @workgroup_size(1) fn main() {}"); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&cpDesc); wgpu::TextureDescriptor texDesc; diff --git a/src/dawn/tests/unittests/validation/QueueWriteTextureValidationTests.cpp b/src/dawn/tests/unittests/validation/QueueWriteTextureValidationTests.cpp index b5fe723367..9829ab3fda 100644 --- a/src/dawn/tests/unittests/validation/QueueWriteTextureValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/QueueWriteTextureValidationTests.cpp @@ -322,8 +322,9 @@ TEST_F(QueueWriteTextureValidationTest, DataOffset) { TEST_F(QueueWriteTextureValidationTest, WriteToMultisampledTexture) { uint64_t dataSize = utils::RequiredBytesInCopy(256, 0, {2, 2, 1}, wgpu::TextureFormat::RGBA8Unorm); - wgpu::Texture destination = Create2DTexture({2, 2, 1}, 1, wgpu::TextureFormat::RGBA8Unorm, - wgpu::TextureUsage::CopyDst, 4); + wgpu::Texture destination = + Create2DTexture({2, 2, 1}, 1, wgpu::TextureFormat::RGBA8Unorm, + wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment, 4); ASSERT_DEVICE_ERROR( TestWriteTexture(dataSize, 0, 256, 2, destination, 0, {0, 0, 0}, {2, 2, 1})); @@ -535,14 +536,14 @@ TEST_F(QueueWriteTextureValidationTest, WriteToStencilAspect) { class WriteTextureTest_CompressedTextureFormats : public QueueWriteTextureValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[3] = {wgpu::FeatureName::TextureCompressionBC, wgpu::FeatureName::TextureCompressionETC2, wgpu::FeatureName::TextureCompressionASTC}; descriptor.requiredFeatures = requiredFeatures; descriptor.requiredFeaturesCount = 3; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } wgpu::Texture Create2DTexture(wgpu::TextureFormat format, diff --git a/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp index 817f302b7f..aebdc0e88a 100644 --- a/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/RenderBundleValidationTests.cpp @@ -33,7 +33,7 @@ class RenderBundleValidationTest : public ValidationTest { } @group(0) @binding(0) var uniforms : S; - @stage(vertex) fn main(@location(0) pos : vec2) -> @builtin(position) vec4 { + @vertex fn main(@location(0) pos : vec2) -> @builtin(position) vec4 { return vec4(); })"); @@ -48,7 +48,7 @@ class RenderBundleValidationTest : public ValidationTest { } @group(1) @binding(1) var ssbo : Storage; - @stage(fragment) fn main() { + @fragment fn main() { })"); wgpu::BindGroupLayout bgls[] = { diff --git a/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp index 50f7c516a9..f0cfd3c8cd 100644 --- a/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp @@ -18,6 +18,8 @@ #include "dawn/common/Constants.h" +#include "dawn/utils/ComboRenderBundleEncoderDescriptor.h" +#include "dawn/utils/ComboRenderPipelineDescriptor.h" #include "dawn/utils/WGPUHelpers.h" namespace { @@ -544,6 +546,211 @@ TEST_F(RenderPassDescriptorValidationTest, NonMultisampledColorWithResolveTarget AssertBeginRenderPassError(&renderPass); } +// drawCount must not exceed maxDrawCount +TEST_F(RenderPassDescriptorValidationTest, MaxDrawCount) { + constexpr wgpu::TextureFormat kColorFormat = wgpu::TextureFormat::RGBA8Unorm; + constexpr uint64_t kMaxDrawCount = 16; + + wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( + @vertex fn main() -> @builtin(position) vec4 { + return vec4(0.0, 0.0, 0.0, 1.0); + })"); + + wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( + @fragment fn main() -> @location(0) vec4 { + return vec4(0.0, 1.0, 0.0, 1.0); + })"); + + utils::ComboRenderPipelineDescriptor pipelineDescriptor; + pipelineDescriptor.vertex.module = vsModule; + pipelineDescriptor.cFragment.module = fsModule; + wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor); + + wgpu::TextureDescriptor colorTextureDescriptor; + colorTextureDescriptor.size = {1, 1}; + colorTextureDescriptor.format = kColorFormat; + colorTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment; + wgpu::Texture colorTexture = device.CreateTexture(&colorTextureDescriptor); + + utils::ComboRenderBundleEncoderDescriptor bundleEncoderDescriptor; + bundleEncoderDescriptor.colorFormatsCount = 1; + bundleEncoderDescriptor.cColorFormats[0] = kColorFormat; + + wgpu::Buffer indexBuffer = + utils::CreateBufferFromData(device, wgpu::BufferUsage::Index, {0, 1, 2}); + wgpu::Buffer indirectBuffer = + utils::CreateBufferFromData(device, wgpu::BufferUsage::Indirect, {3, 1, 0, 0}); + wgpu::Buffer indexedIndirectBuffer = + utils::CreateBufferFromData(device, wgpu::BufferUsage::Indirect, {3, 1, 0, 0, 0}); + + wgpu::RenderPassDescriptorMaxDrawCount maxDrawCount; + maxDrawCount.maxDrawCount = kMaxDrawCount; + + // Valid. drawCount is less than the default maxDrawCount. + + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.SetPipeline(pipeline); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderPass.Draw(3); + } + + renderPass.End(); + encoder.Finish(); + } + + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.SetPipeline(pipeline); + renderPass.SetIndexBuffer(indexBuffer, wgpu::IndexFormat::Uint32); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderPass.DrawIndexed(3); + } + + renderPass.End(); + encoder.Finish(); + } + + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.SetPipeline(pipeline); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderPass.DrawIndirect(indirectBuffer, 0); + } + + renderPass.End(); + encoder.Finish(); + } + + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.SetPipeline(pipeline); + renderPass.SetIndexBuffer(indexBuffer, wgpu::IndexFormat::Uint32); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderPass.DrawIndexedIndirect(indexedIndirectBuffer, 0); + } + + renderPass.End(); + encoder.Finish(); + } + + { + wgpu::RenderBundleEncoder renderBundleEncoder = + device.CreateRenderBundleEncoder(&bundleEncoderDescriptor); + renderBundleEncoder.SetPipeline(pipeline); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderBundleEncoder.Draw(3); + } + + wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish(); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.ExecuteBundles(1, &renderBundle); + renderPass.End(); + encoder.Finish(); + } + + // Invalid. drawCount counts up with draw calls and + // it is greater than maxDrawCount. + + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + renderPassDescriptor.nextInChain = &maxDrawCount; + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.SetPipeline(pipeline); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderPass.Draw(3); + } + + renderPass.End(); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + renderPassDescriptor.nextInChain = &maxDrawCount; + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.SetPipeline(pipeline); + renderPass.SetIndexBuffer(indexBuffer, wgpu::IndexFormat::Uint32); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderPass.DrawIndexed(3); + } + + renderPass.End(); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + renderPassDescriptor.nextInChain = &maxDrawCount; + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.SetPipeline(pipeline); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderPass.DrawIndirect(indirectBuffer, 0); + } + + renderPass.End(); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + renderPassDescriptor.nextInChain = &maxDrawCount; + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.SetPipeline(pipeline); + renderPass.SetIndexBuffer(indexBuffer, wgpu::IndexFormat::Uint32); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderPass.DrawIndexedIndirect(indexedIndirectBuffer, 0); + } + + renderPass.End(); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + + { + wgpu::RenderBundleEncoder renderBundleEncoder = + device.CreateRenderBundleEncoder(&bundleEncoderDescriptor); + renderBundleEncoder.SetPipeline(pipeline); + + for (uint64_t i = 0; i <= kMaxDrawCount; i++) { + renderBundleEncoder.Draw(3); + } + + wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish(); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()}); + renderPassDescriptor.nextInChain = &maxDrawCount; + wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor); + renderPass.ExecuteBundles(1, &renderBundle); + renderPass.End(); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } +} + class MultisampledRenderPassDescriptorValidationTest : public RenderPassDescriptorValidationTest { public: utils::ComboRenderPassDescriptor CreateMultisampledRenderPass() { @@ -720,7 +927,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetFormat) { for (wgpu::TextureFormat format : utils::kAllTextureFormats) { if (!utils::TextureFormatSupportsMultisampling(format) || - !utils::TextureFormatSupportsRendering(format)) { + utils::IsDepthOrStencilFormat(format)) { continue; } @@ -850,7 +1057,7 @@ TEST_F(RenderPassDescriptorValidationTest, UseNaNOrINFINITYAsColorOrDepthClearVa AssertBeginRenderPassError(&renderPass); } - // Tests that INFINITY can be used in depthClearValue. + // Tests that INFINITY cannot be used in depthClearValue. { wgpu::TextureView depth = Create2DAttachment(device, 1, 1, wgpu::TextureFormat::Depth24Plus); @@ -858,13 +1065,66 @@ TEST_F(RenderPassDescriptorValidationTest, UseNaNOrINFINITYAsColorOrDepthClearVa renderPass.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Undefined; renderPass.cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Undefined; renderPass.cDepthStencilAttachmentInfo.depthClearValue = INFINITY; - AssertBeginRenderPassSuccess(&renderPass); + AssertBeginRenderPassError(&renderPass); } // TODO(https://crbug.com/dawn/666): Add a test case for clearStencil for stencilOnly // once stencil8 is supported. } +// Tests that depth clear values mut be between 0 and 1, inclusive. +TEST_F(RenderPassDescriptorValidationTest, ValidateDepthClearValueRange) { + wgpu::TextureView depth = Create2DAttachment(device, 1, 1, wgpu::TextureFormat::Depth24Plus); + + utils::ComboRenderPassDescriptor renderPass({}, depth); + renderPass.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Undefined; + renderPass.cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Undefined; + + // 0, 1, and any value in between are be valid. + renderPass.cDepthStencilAttachmentInfo.depthClearValue = 0; + AssertBeginRenderPassSuccess(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = 0.1; + AssertBeginRenderPassSuccess(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = 0.5; + AssertBeginRenderPassSuccess(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = 0.82; + AssertBeginRenderPassSuccess(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = 1; + AssertBeginRenderPassSuccess(&renderPass); + + // Values less than 0 or greater than 1 are invalid. + renderPass.cDepthStencilAttachmentInfo.depthClearValue = -1; + AssertBeginRenderPassError(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = 2; + AssertBeginRenderPassError(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = -0.001; + AssertBeginRenderPassError(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = 1.001; + AssertBeginRenderPassError(&renderPass); + + // Clear values are not validated if the depthLoadOp is Load. + renderPass.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Load; + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = -1; + AssertBeginRenderPassSuccess(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = 2; + AssertBeginRenderPassSuccess(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = -0.001; + AssertBeginRenderPassSuccess(&renderPass); + + renderPass.cDepthStencilAttachmentInfo.depthClearValue = 1.001; + AssertBeginRenderPassSuccess(&renderPass); +} + TEST_F(RenderPassDescriptorValidationTest, ValidateDepthStencilReadOnly) { wgpu::TextureView colorView = Create2DAttachment(device, 1, 1, wgpu::TextureFormat::RGBA8Unorm); wgpu::TextureView depthStencilView = @@ -1051,6 +1311,7 @@ TEST_F(RenderPassDescriptorValidationTest, ValidateDepthStencilAllAspects) { // Using all aspects of a depth+stencil texture is allowed. { texDesc.format = wgpu::TextureFormat::Depth24PlusStencil8; + viewDesc.format = wgpu::TextureFormat::Undefined; viewDesc.aspect = wgpu::TextureAspect::All; wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc); @@ -1058,29 +1319,68 @@ TEST_F(RenderPassDescriptorValidationTest, ValidateDepthStencilAllAspects) { AssertBeginRenderPassSuccess(&renderPass); } - // Using only depth of a depth+stencil texture is an error. + // Using only depth of a depth+stencil texture is an error, case without format + // reinterpretation. { texDesc.format = wgpu::TextureFormat::Depth24PlusStencil8; + viewDesc.format = wgpu::TextureFormat::Undefined; viewDesc.aspect = wgpu::TextureAspect::DepthOnly; wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc); utils::ComboRenderPassDescriptor renderPass({}, view); + renderPass.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Undefined; + renderPass.cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Undefined; + AssertBeginRenderPassError(&renderPass); } - // Using only stencil of a depth+stencil texture is an error. + // Using only depth of a depth+stencil texture is an error, case with format reinterpretation. { texDesc.format = wgpu::TextureFormat::Depth24PlusStencil8; + viewDesc.format = wgpu::TextureFormat::Depth24Plus; + viewDesc.aspect = wgpu::TextureAspect::DepthOnly; + + wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc); + utils::ComboRenderPassDescriptor renderPass({}, view); + renderPass.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Undefined; + renderPass.cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Undefined; + + AssertBeginRenderPassError(&renderPass); + } + + // Using only stencil of a depth+stencil texture is an error, case without format + // reinterpration. + { + texDesc.format = wgpu::TextureFormat::Depth24PlusStencil8; + viewDesc.format = wgpu::TextureFormat::Undefined; viewDesc.aspect = wgpu::TextureAspect::StencilOnly; wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc); utils::ComboRenderPassDescriptor renderPass({}, view); + renderPass.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Undefined; + renderPass.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Undefined; + + AssertBeginRenderPassError(&renderPass); + } + + // Using only stencil of a depth+stencil texture is an error, case with format reinterpretation. + { + texDesc.format = wgpu::TextureFormat::Depth24PlusStencil8; + viewDesc.format = wgpu::TextureFormat::Stencil8; + viewDesc.aspect = wgpu::TextureAspect::StencilOnly; + + wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc); + utils::ComboRenderPassDescriptor renderPass({}, view); + renderPass.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Undefined; + renderPass.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Undefined; + AssertBeginRenderPassError(&renderPass); } // Using DepthOnly of a depth only texture is allowed. { texDesc.format = wgpu::TextureFormat::Depth24Plus; + viewDesc.format = wgpu::TextureFormat::Undefined; viewDesc.aspect = wgpu::TextureAspect::DepthOnly; wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc); @@ -1091,8 +1391,19 @@ TEST_F(RenderPassDescriptorValidationTest, ValidateDepthStencilAllAspects) { AssertBeginRenderPassSuccess(&renderPass); } - // TODO(https://crbug.com/dawn/666): Add a test case for stencil-only on stencil8 once this - // format is supported. + // Using StencilOnly of a stencil only texture is allowed. + { + texDesc.format = wgpu::TextureFormat::Stencil8; + viewDesc.format = wgpu::TextureFormat::Undefined; + viewDesc.aspect = wgpu::TextureAspect::StencilOnly; + + wgpu::TextureView view = device.CreateTexture(&texDesc).CreateView(&viewDesc); + utils::ComboRenderPassDescriptor renderPass({}, view); + renderPass.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Undefined; + renderPass.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Undefined; + + AssertBeginRenderPassSuccess(&renderPass); + } } // TODO(cwallez@chromium.org): Constraints on attachment aliasing? diff --git a/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp index 079f9b352d..5271228122 100644 --- a/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/RenderPipelineValidationTests.cpp @@ -28,17 +28,17 @@ class RenderPipelineValidationTest : public ValidationTest { ValidationTest::SetUp(); vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); fsModuleUint = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0u, 255u, 0u, 255u); })"); } @@ -194,8 +194,8 @@ TEST_F(RenderPipelineValidationTest, ColorTargetStateRequired) { } } -// Tests that target blend and writeMasks must not be set if the format is undefined. -TEST_F(RenderPipelineValidationTest, UndefinedColorStateFormatWithBlendOrWriteMask) { +// Tests that target blend must not be set if the format is undefined. +TEST_F(RenderPipelineValidationTest, UndefinedColorStateFormatWithBlend) { { // Control case: Valid undefined format target. utils::ComboRenderPipelineDescriptor descriptor; @@ -203,7 +203,6 @@ TEST_F(RenderPipelineValidationTest, UndefinedColorStateFormatWithBlendOrWriteMa descriptor.cFragment.module = fsModule; descriptor.cFragment.targetCount = 1; descriptor.cTargets[0].format = wgpu::TextureFormat::Undefined; - descriptor.cTargets[0].writeMask = wgpu::ColorWriteMask::None; device.CreateRenderPipeline(&descriptor); } @@ -221,19 +220,25 @@ TEST_F(RenderPipelineValidationTest, UndefinedColorStateFormatWithBlendOrWriteMa device.CreateRenderPipeline(&descriptor), testing::HasSubstr("Color target[0] blend state is set when the format is undefined.")); } - { - // Error case: undefined format target with write masking not being none. - utils::ComboRenderPipelineDescriptor descriptor; - descriptor.vertex.module = vsModule; - descriptor.cFragment.module = fsModule; - descriptor.cFragment.targetCount = 1; - descriptor.cTargets[0].format = wgpu::TextureFormat::Undefined; - descriptor.cTargets[0].blend = nullptr; - descriptor.cTargets[0].writeMask = wgpu::ColorWriteMask::All; +} - ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor), - testing::HasSubstr("Color target[0] write mask is set to")); - } +// Tests that a color target that's present in the pipeline descriptor but not in the shader must +// have its writeMask set to 0. +TEST_F(RenderPipelineValidationTest, WriteMaskMustBeZeroForColorTargetWithNoShaderOutput) { + utils::ComboRenderPipelineDescriptor descriptor; + descriptor.vertex.module = vsModule; + descriptor.cFragment.module = fsModule; + descriptor.cFragment.targetCount = 2; + descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm; + descriptor.cTargets[1].format = wgpu::TextureFormat::RGBA8Unorm; + + // Control case: Target 1 not output by the shader but has writeMask = 0 + descriptor.cTargets[1].writeMask = wgpu::ColorWriteMask::None; + device.CreateRenderPipeline(&descriptor); + + // Error case: the writeMask is not 0. + descriptor.cTargets[1].writeMask = wgpu::ColorWriteMask::Red; + ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor)); } // Tests that the color formats must be renderable. @@ -331,7 +336,7 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) { descriptor.vertex.module = vsModule; std::ostringstream stream; stream << R"( - @stage(fragment) fn main() -> @location(0) vec4<)" + @fragment fn main() -> @location(0) vec4<)" << kScalarTypes[i] << R"(> { var result : vec4<)" << kScalarTypes[i] << R"(>; @@ -372,7 +377,7 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputComponentCountCompatibility) std::ostringstream stream; stream << R"( - @stage(fragment) fn main() -> @location(0) )"; + @fragment fn main() -> @location(0) )"; switch (componentCount) { case 1: stream << R"(f32 { @@ -763,6 +768,56 @@ TEST_F(RenderPipelineValidationTest, AlphaToCoverageAndSampleCount) { } } +// Tests if the sample_mask builtin is a pipeline output of fragment shader, +// then alphaToCoverageEnabled must be false +TEST_F(RenderPipelineValidationTest, AlphaToCoverageAndSampleMaskOutput) { + wgpu::ShaderModule fsModuleSampleMaskOutput = utils::CreateShaderModule(device, R"( + struct Output { + @builtin(sample_mask) mask_out: u32, + @location(0) color : vec4, + } + @fragment fn main() -> Output { + var o: Output; + // We need to make sure this sample_mask isn't optimized out even its value equals "no op". + o.mask_out = 0xFFFFFFFFu; + o.color = vec4(1.0, 1.0, 1.0, 1.0); + return o; + } + )"); + + { + utils::ComboRenderPipelineDescriptor descriptor; + descriptor.vertex.module = vsModule; + descriptor.cFragment.module = fsModuleSampleMaskOutput; + descriptor.multisample.count = 4; + descriptor.multisample.alphaToCoverageEnabled = false; + + device.CreateRenderPipeline(&descriptor); + } + + { + utils::ComboRenderPipelineDescriptor descriptor; + descriptor.vertex.module = vsModule; + descriptor.cFragment.module = fsModuleSampleMaskOutput; + descriptor.multisample.count = 4; + descriptor.multisample.alphaToCoverageEnabled = true; + + ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor)); + } + + { + // Control cases: when fragment has no sample_mask output, it's good to have + // alphaToCoverageEnabled enabled + utils::ComboRenderPipelineDescriptor descriptor; + descriptor.vertex.module = vsModule; + descriptor.cFragment.module = fsModule; + descriptor.multisample.count = 4; + descriptor.multisample.alphaToCoverageEnabled = true; + + device.CreateRenderPipeline(&descriptor); + } +} + // Tests that the texture component type in shader must match the bind group layout. TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) { constexpr uint32_t kNumTextureComponentType = 3u; @@ -783,7 +838,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) { @group(0) @binding(0) var myTexture : texture_2d<)" << kScalarTypes[i] << R"(>; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"; descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str()); @@ -832,7 +887,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) { stream << R"( @group(0) @binding(0) var myTexture : )" << kTextureKeywords[i] << R"(; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(myTexture); })"; descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str()); @@ -860,7 +915,7 @@ TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) { data : array } @group(0) @binding(0) var dst : Dst; - @stage(vertex) fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { dst.data[VertexIndex] = 0x1234u; return vec4(); })"); @@ -920,25 +975,51 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatAllowed) { } } -// Test that specifying a clampDepth value results in an error if the feature is not enabled. -TEST_F(RenderPipelineValidationTest, ClampDepthWithoutFeature) { +// Test that specifying a unclippedDepth value is an error if the feature is not enabled. +TEST_F(RenderPipelineValidationTest, UnclippedDepthWithoutFeature) { { utils::ComboRenderPipelineDescriptor descriptor; descriptor.vertex.module = vsModule; descriptor.cFragment.module = fsModule; - wgpu::PrimitiveDepthClampingState clampingState; - clampingState.clampDepth = true; - descriptor.primitive.nextInChain = &clampingState; - ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor)); + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = true; + descriptor.primitive.nextInChain = &depthClipControl; + ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor), + testing::HasSubstr("not supported")); } { utils::ComboRenderPipelineDescriptor descriptor; descriptor.vertex.module = vsModule; descriptor.cFragment.module = fsModule; - wgpu::PrimitiveDepthClampingState clampingState; - clampingState.clampDepth = false; - descriptor.primitive.nextInChain = &clampingState; - ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor)); + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = false; + descriptor.primitive.nextInChain = &depthClipControl; + ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor), + testing::HasSubstr("not supported")); + } +} + +// Test that specifying an unclippedDepth value is an error if the feature is not enabled. +TEST_F(RenderPipelineValidationTest, DepthClipControlWithoutFeature) { + { + utils::ComboRenderPipelineDescriptor descriptor; + descriptor.vertex.module = vsModule; + descriptor.cFragment.module = fsModule; + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = true; + descriptor.primitive.nextInChain = &depthClipControl; + ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor), + testing::HasSubstr("not supported")); + } + { + utils::ComboRenderPipelineDescriptor descriptor; + descriptor.vertex.module = vsModule; + descriptor.cFragment.module = fsModule; + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = false; + descriptor.primitive.nextInChain = &depthClipControl; + ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor), + testing::HasSubstr("not supported")); } } @@ -961,11 +1042,11 @@ TEST_F(RenderPipelineValidationTest, DepthCompareUndefinedIsError) { // Test that the entryPoint names must be present for the correct stage in the shader module. TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex_main() -> @builtin(position) vec4 { + @vertex fn vertex_main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); } - @stage(fragment) fn fragment_main() -> @location(0) vec4 { + @fragment fn fragment_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -1007,11 +1088,11 @@ TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) { // Test that vertex attrib validation is for the correct entryPoint TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn vertex0(@location(0) attrib0 : vec4) + @vertex fn vertex0(@location(0) attrib0 : vec4) -> @builtin(position) vec4 { return attrib0; } - @stage(vertex) fn vertex1(@location(1) attrib1 : vec4) + @vertex fn vertex1(@location(1) attrib1 : vec4) -> @builtin(position) vec4 { return attrib1; } @@ -1049,10 +1130,10 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) { // Test that fragment output validation is for the correct entryPoint TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) { wgpu::ShaderModule module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn fragmentFloat() -> @location(0) vec4 { + @fragment fn fragmentFloat() -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } - @stage(fragment) fn fragmentUint() -> @location(0) vec4 { + @fragment fn fragmentUint() -> @location(0) vec4 { return vec4(0u, 0u, 0u, 0u); } )"); @@ -1083,23 +1164,23 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) { // Test that unwritten fragment outputs must have a write mask of 0. TEST_F(RenderPipelineValidationTest, UnwrittenFragmentOutputsMask0) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); } )"); wgpu::ShaderModule fsModuleWriteNone = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() {} + @fragment fn main() {} )"); wgpu::ShaderModule fsModuleWrite0 = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(); } )"); wgpu::ShaderModule fsModuleWrite1 = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(1) vec4 { + @fragment fn main() -> @location(1) vec4 { return vec4(); } )"); @@ -1109,7 +1190,7 @@ TEST_F(RenderPipelineValidationTest, UnwrittenFragmentOutputsMask0) { @location(0) target0 : vec4, @location(1) target1 : vec4, } - @stage(fragment) fn main() -> FragmentOut { + @fragment fn main() -> FragmentOut { var out : FragmentOut; return out; } @@ -1221,10 +1302,10 @@ TEST_F(RenderPipelineValidationTest, BindingsFromCorrectEntryPoint) { @group(0) @binding(0) var var0 : Uniforms; @group(0) @binding(1) var var1 : Uniforms; - @stage(vertex) fn vertex0() -> @builtin(position) vec4 { + @vertex fn vertex0() -> @builtin(position) vec4 { return var0.data; } - @stage(vertex) fn vertex1() -> @builtin(position) vec4 { + @vertex fn vertex1() -> @builtin(position) vec4 { return var1.data; } )"); @@ -1260,35 +1341,35 @@ TEST_F(RenderPipelineValidationTest, BindingsFromCorrectEntryPoint) { ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor)); } -class DepthClampingValidationTest : public RenderPipelineValidationTest { +class DepthClipControlValidationTest : public RenderPipelineValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::DepthClamping}; + wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::DepthClipControl}; descriptor.requiredFeatures = requiredFeatures; descriptor.requiredFeaturesCount = 1; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } }; -// Tests that specifying a clampDepth value succeeds if the feature is enabled. -TEST_F(DepthClampingValidationTest, Success) { +// Tests that specifying a unclippedDepth value succeeds if the feature is enabled. +TEST_F(DepthClipControlValidationTest, Success) { { utils::ComboRenderPipelineDescriptor descriptor; descriptor.vertex.module = vsModule; descriptor.cFragment.module = fsModule; - wgpu::PrimitiveDepthClampingState clampingState; - clampingState.clampDepth = true; - descriptor.primitive.nextInChain = &clampingState; + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = true; + descriptor.primitive.nextInChain = &depthClipControl; device.CreateRenderPipeline(&descriptor); } { utils::ComboRenderPipelineDescriptor descriptor; descriptor.vertex.module = vsModule; descriptor.cFragment.module = fsModule; - wgpu::PrimitiveDepthClampingState clampingState; - clampingState.clampDepth = false; - descriptor.primitive.nextInChain = &clampingState; + wgpu::PrimitiveDepthClipControl depthClipControl; + depthClipControl.unclippedDepth = false; + descriptor.primitive.nextInChain = &depthClipControl; device.CreateRenderPipeline(&descriptor); } } @@ -1318,7 +1399,7 @@ TEST_F(InterStageVariableMatchingValidationTest, MissingDeclarationAtSameLocatio @location(0) vout: f32, @builtin(position) pos: vec4, } - @stage(vertex) fn main() -> A { + @vertex fn main() -> A { var vertexOut: A; vertexOut.pos = vec4(0.0, 0.0, 0.0, 1.0); return vertexOut; @@ -1327,14 +1408,14 @@ TEST_F(InterStageVariableMatchingValidationTest, MissingDeclarationAtSameLocatio struct B { @location(0) fin: f32 } - @stage(fragment) fn main(fragmentIn: B) -> @location(0) vec4 { + @fragment fn main(fragmentIn: B) -> @location(0) vec4 { return vec4(fragmentIn.fin, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule fragmentModuleInputAtLocation1 = utils::CreateShaderModule(device, R"( struct A { @location(1) vout: f32 } - @stage(fragment) fn main(vertexOut: A) -> @location(0) vec4 { + @fragment fn main(vertexOut: A) -> @location(0) vec4 { return vec4(vertexOut.vout, 0.0, 0.0, 1.0); })"); wgpu::ShaderModule vertexModuleOutputAtLocation1 = utils::CreateShaderModule(device, R"( @@ -1342,7 +1423,7 @@ TEST_F(InterStageVariableMatchingValidationTest, MissingDeclarationAtSameLocatio @location(1) fin: f32, @builtin(position) pos: vec4, } - @stage(vertex) fn main() -> B { + @vertex fn main() -> B { var fragmentIn: B; fragmentIn.pos = vec4(0.0, 0.0, 0.0, 1.0); return fragmentIn; @@ -1386,7 +1467,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentTypeAtSameLocation) { vertexStream << interfaceDeclaration << R"( @builtin(position) pos: vec4, } - @stage(vertex) fn main() -> A { + @vertex fn main() -> A { var vertexOut: A; vertexOut.pos = vec4(0.0, 0.0, 0.0, 1.0); return vertexOut; @@ -1397,7 +1478,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentTypeAtSameLocation) { std::ostringstream fragmentStream; fragmentStream << interfaceDeclaration << R"( } - @stage(fragment) fn main(fragmentIn: A) -> @location(0) vec4 { + @fragment fn main(fragmentIn: A) -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"; fragmentModules[i] = utils::CreateShaderModule(device, fragmentStream.str().c_str()); @@ -1484,7 +1565,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentInterpolationAttribute vertexStream << interfaceDeclaration << R"( @builtin(position) pos: vec4, } - @stage(vertex) fn main() -> A { + @vertex fn main() -> A { var vertexOut: A; vertexOut.pos = vec4(0.0, 0.0, 0.0, 1.0); return vertexOut; @@ -1495,7 +1576,7 @@ TEST_F(InterStageVariableMatchingValidationTest, DifferentInterpolationAttribute std::ostringstream fragmentStream; fragmentStream << interfaceDeclaration << R"( } - @stage(fragment) fn main(fragmentIn: A) -> @location(0) vec4 { + @fragment fn main(fragmentIn: A) -> @location(0) vec4 { return fragmentIn.a; })"; fragmentModules[i] = utils::CreateShaderModule(device, fragmentStream.str().c_str()); diff --git a/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp b/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp index 8e842b3427..9958b3fc02 100644 --- a/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp +++ b/src/dawn/tests/unittests/validation/ResourceUsageTrackingTests.cpp @@ -50,12 +50,12 @@ class ResourceUsageTrackingTest : public ValidationTest { // pipeline. But those bind groups in caller can be used for validation for other purposes. wgpu::RenderPipeline CreateNoOpRenderPipeline() { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = vsModule; @@ -67,7 +67,7 @@ class ResourceUsageTrackingTest : public ValidationTest { wgpu::ComputePipeline CreateNoOpComputePipeline(std::vector bgls) { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { })"); wgpu::ComputePipelineDescriptor pipelineDescriptor; pipelineDescriptor.layout = utils::MakePipelineLayout(device, std::move(bgls)); @@ -749,7 +749,7 @@ TEST_F(ResourceUsageTrackingTest, BufferUsageConflictWithUnusedPipelineBindings) // Create a passthrough render pipeline with a readonly buffer wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); @@ -758,7 +758,7 @@ TEST_F(ResourceUsageTrackingTest, BufferUsageConflictWithUnusedPipelineBindings) value : f32 } @group(0) @binding(0) var rBuffer : RBuffer; - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = vsModule; @@ -1567,13 +1567,13 @@ TEST_F(ResourceUsageTrackingTest, TextureUsageConflictWithUnusedPipelineBindings { // Create a passthrough render pipeline with a sampled storage texture wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(); })"); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var tex : texture_2d; - @stage(fragment) fn main() { + @fragment fn main() { })"); utils::ComboRenderPipelineDescriptor pipelineDescriptor; pipelineDescriptor.vertex.module = vsModule; diff --git a/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp b/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp index 57069ed6c2..17e25f96ee 100644 --- a/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp @@ -59,7 +59,7 @@ TEST_F(ShaderModuleValidationTest, CreationSuccess) { // be compiled. TEST_F(ShaderModuleValidationTest, FragmentOutputLocationExceedsMaxColorAttachments) { std::ostringstream stream; - stream << "@stage(fragment) fn main() -> @location(" << kMaxColorAttachments << R"() vec4 { + stream << "@fragment fn main() -> @location(" << kMaxColorAttachments << R"() vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"; ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, stream.str().c_str())); @@ -161,7 +161,7 @@ TEST_F(ShaderModuleValidationTest, GetCompilationMessages) { DAWN_SKIP_TEST_IF(UsesWire()); wgpu::ShaderModule shaderModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); @@ -241,7 +241,7 @@ TEST_F(ShaderModuleValidationTest, MaximumShaderIOLocations) { errorMatcher = "failingVertex"; pDesc.vertex.entryPoint = "failingVertex"; pDesc.vertex.module = utils::CreateShaderModule(device, (ioStruct + R"( - @stage(vertex) fn failingVertex() -> ShaderIO { + @vertex fn failingVertex() -> ShaderIO { var shaderIO : ShaderIO; shaderIO.pos = vec4(0.0, 0.0, 0.0, 1.0); return shaderIO; @@ -249,7 +249,7 @@ TEST_F(ShaderModuleValidationTest, MaximumShaderIOLocations) { )") .c_str()); pDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0); } )"); @@ -260,13 +260,13 @@ TEST_F(ShaderModuleValidationTest, MaximumShaderIOLocations) { errorMatcher = "failingFragment"; pDesc.cFragment.entryPoint = "failingFragment"; pDesc.cFragment.module = utils::CreateShaderModule(device, (ioStruct + R"( - @stage(fragment) fn failingFragment(io : ShaderIO) -> @location(0) vec4 { + @fragment fn failingFragment(io : ShaderIO) -> @location(0) vec4 { return vec4(0.0); } )") .c_str()); pDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0); } )"); @@ -354,7 +354,7 @@ TEST_F(ShaderModuleValidationTest, MaximumInterStageShaderComponents) { errorMatcher = "failingVertex"; pDesc.vertex.entryPoint = "failingVertex"; pDesc.vertex.module = utils::CreateShaderModule(device, (ioStruct + R"( - @stage(vertex) fn failingVertex() -> ShaderIO { + @vertex fn failingVertex() -> ShaderIO { var shaderIO : ShaderIO; shaderIO.pos = vec4(0.0, 0.0, 0.0, 1.0); return shaderIO; @@ -362,7 +362,7 @@ TEST_F(ShaderModuleValidationTest, MaximumInterStageShaderComponents) { )") .c_str()); pDesc.cFragment.module = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0); } )"); @@ -373,13 +373,13 @@ TEST_F(ShaderModuleValidationTest, MaximumInterStageShaderComponents) { errorMatcher = "failingFragment"; pDesc.cFragment.entryPoint = "failingFragment"; pDesc.cFragment.module = utils::CreateShaderModule(device, (ioStruct + R"( - @stage(fragment) fn failingFragment(io : ShaderIO) -> @location(0) vec4 { + @fragment fn failingFragment(io : ShaderIO) -> @location(0) vec4 { return vec4(0.0); } )") .c_str()); pDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0); } )"); @@ -454,7 +454,7 @@ TEST_F(ShaderModuleValidationTest, MaximumInterStageShaderComponents) { TEST_F(ShaderModuleValidationTest, ComputeWorkgroupSizeLimits) { auto CheckShaderWithWorkgroupSize = [this](bool success, uint32_t x, uint32_t y, uint32_t z) { std::ostringstream ss; - ss << "@stage(compute) @workgroup_size(" << x << "," << y << "," << z << ") fn main() {}"; + ss << "@compute @workgroup_size(" << x << "," << y << "," << z << ") fn main() {}"; wgpu::ComputePipelineDescriptor desc; desc.compute.entryPoint = "main"; @@ -506,7 +506,7 @@ TEST_F(ShaderModuleValidationTest, ComputeWorkgroupStorageSizeLimits) { ss << "var mat4_data: array, " << mat4_count << ">;"; body << "_ = mat4_data;"; } - ss << "@stage(compute) @workgroup_size(1) fn main() { " << body.str() << " }"; + ss << "@compute @workgroup_size(1) fn main() { " << body.str() << " }"; wgpu::ComputePipelineDescriptor desc; desc.compute.entryPoint = "main"; @@ -543,7 +543,7 @@ struct Buf { @group(0) @binding(0) var buf : Buf; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { // make sure the overridable constants are not optimized out buf.data[0] = c0; buf.data[1] = c1; @@ -560,7 +560,7 @@ TEST_F(ShaderModuleValidationTest, MaxBindingNumber) { // kMaxBindingNumber is valid. desc.compute.module = utils::CreateShaderModule(device, R"( @group(0) @binding(65535) var s : sampler; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { _ = s; } )"); @@ -569,7 +569,7 @@ TEST_F(ShaderModuleValidationTest, MaxBindingNumber) { // kMaxBindingNumber + 1 is an error desc.compute.module = utils::CreateShaderModule(device, R"( @group(0) @binding(65536) var s : sampler; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { _ = s; } )"); @@ -580,12 +580,12 @@ TEST_F(ShaderModuleValidationTest, MaxBindingNumber) { TEST_F(ShaderModuleValidationTest, MissingDecorations) { // Vertex input. utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(@location(0) a : vec4) -> @builtin(position) vec4 { + @vertex fn main(@location(0) a : vec4) -> @builtin(position) vec4 { return vec4(1.0); } )"); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( - @stage(vertex) fn main(a : vec4) -> @builtin(position) vec4 { + @vertex fn main(a : vec4) -> @builtin(position) vec4 { return vec4(1.0); } )")); @@ -596,7 +596,7 @@ TEST_F(ShaderModuleValidationTest, MissingDecorations) { @builtin(position) pos : vec4, @location(0) a : f32, } - @stage(vertex) fn main() -> Output { + @vertex fn main() -> Output { var output : Output; return output; } @@ -606,7 +606,7 @@ TEST_F(ShaderModuleValidationTest, MissingDecorations) { @builtin(position) pos : vec4, a : f32, } - @stage(vertex) fn main() -> Output { + @vertex fn main() -> Output { var output : Output; return output; } @@ -614,24 +614,24 @@ TEST_F(ShaderModuleValidationTest, MissingDecorations) { // Fragment input utils::CreateShaderModule(device, R"( - @stage(fragment) fn main(@location(0) a : vec4) -> @location(0) f32 { + @fragment fn main(@location(0) a : vec4) -> @location(0) f32 { return 1.0; } )"); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( - @stage(fragment) fn main(a : vec4) -> @location(0) f32 { + @fragment fn main(a : vec4) -> @location(0) f32 { return 1.0; } )")); // Fragment input utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { return 1.0; } )"); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> f32 { + @fragment fn main() -> f32 { return 1.0; } )")); @@ -639,21 +639,21 @@ TEST_F(ShaderModuleValidationTest, MissingDecorations) { // Binding decorations utils::CreateShaderModule(device, R"( @group(0) @binding(0) var s : sampler; - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { _ = s; return 1.0; } )"); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @binding(0) var s : sampler; - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { _ = s; return 1.0; } )")); ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @group(0) var s : sampler; - @stage(fragment) fn main() -> @location(0) f32 { + @fragment fn main() -> @location(0) f32 { _ = s; return 1.0; } @@ -663,7 +663,7 @@ TEST_F(ShaderModuleValidationTest, MissingDecorations) { // Test that WGSL extension used by enable directives must be allowed by WebGPU. TEST_F(ShaderModuleValidationTest, ExtensionMustBeAllowed) { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( -enable InternalExtensionForTesting; +enable f16; -@stage(compute) @workgroup_size(1) fn main() {})")); +@compute @workgroup_size(1) fn main() {})")); } diff --git a/src/dawn/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/dawn/tests/unittests/validation/StorageTextureValidationTests.cpp index 41968fc7e0..5222b81082 100644 --- a/src/dawn/tests/unittests/validation/StorageTextureValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/StorageTextureValidationTests.cpp @@ -26,11 +26,11 @@ class StorageTextureValidationTests : public ValidationTest { ValidationTest::SetUp(); mDefaultVSModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); mDefaultFSModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); })"); } @@ -84,7 +84,7 @@ class StorageTextureValidationTests : public ValidationTest { ostream << "@group(0) @binding(0) var image0 : " << imageTypeDeclaration << "<" << imageFormatQualifier << ", " << access << ">;\n" - "@stage(compute) @workgroup_size(1) fn main() {\n" + "@compute @workgroup_size(1) fn main() {\n" " textureDimensions(image0);\n" "}\n"; @@ -120,7 +120,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(vertex) + @vertex fn main(@builtin(vertex_index) vertex_index : u32) -> @builtin(position) vec4 { textureStore(image0, vec2(i32(vertex_index), 0), vec4(1.0, 0.0, 0.0, 1.0)); return vec4(0.0); @@ -137,7 +137,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(fragment) fn main(@builtin(position) position : vec4) { + @fragment fn main(@builtin(position) position : vec4) { textureStore(image0, vec2(position.xy), vec4(1.0, 0.0, 0.0, 1.0)); })"); @@ -158,7 +158,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) { wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main(@builtin(local_invocation_id) LocalInvocationID : vec3) { + @compute @workgroup_size(1) fn main(@builtin(local_invocation_id) LocalInvocationID : vec3) { textureStore(image0, vec2(LocalInvocationID.xy), vec4(0.0, 0.0, 0.0, 0.0)); })"); @@ -177,7 +177,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(vertex) fn main() { + @vertex fn main() { textureDimensions(image0); })")); } @@ -186,7 +186,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(fragment) fn main() { + @fragment fn main() { textureDimensions(image0); })")); } @@ -195,7 +195,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) { { ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"( @group(0) @binding(0) var image0 : texture_storage_2d; - @stage(compute) @workgroup_size(1) fn main() { + @compute @workgroup_size(1) fn main() { textureDimensions(image0); })")); } diff --git a/src/dawn/tests/unittests/validation/TextureValidationTests.cpp b/src/dawn/tests/unittests/validation/TextureValidationTests.cpp index 3de9c27380..d40fce42b6 100644 --- a/src/dawn/tests/unittests/validation/TextureValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/TextureValidationTests.cpp @@ -143,7 +143,6 @@ TEST_F(TextureValidationTest, SampleCount) { { wgpu::TextureDescriptor descriptor = defaultDescriptor; descriptor.sampleCount = 4; - descriptor.usage = wgpu::TextureUsage::TextureBinding; for (wgpu::TextureFormat format : utils::kFormatsInCoreSpec) { descriptor.format = format; @@ -172,6 +171,16 @@ TEST_F(TextureValidationTest, SampleCount) { ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); } + + // It is an error to create a texture without TextureUsage::RenderAttachment usage when + // sampleCount > 1. + { + wgpu::TextureDescriptor descriptor = defaultDescriptor; + descriptor.sampleCount = 4; + descriptor.usage = wgpu::TextureUsage::TextureBinding; + + ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); + } } // Test the validation of the mip level count @@ -650,14 +659,6 @@ TEST_F(TextureValidationTest, TextureFormatUndefined) { ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); } -// Test that the creation of a texture with depth24unorm-stencil8 will fail when the feature -// Depth24UnormStencil8 is not enabled. -TEST_F(TextureValidationTest, UseD24S8FormatWithoutEnablingFeature) { - wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor(); - descriptor.format = wgpu::TextureFormat::Depth24UnormStencil8; - ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); -} - // Test that the creation of a texture with depth32float-stencil8 will fail when the feature // Depth32FloatStencil8 is not enabled. TEST_F(TextureValidationTest, UseD32S8FormatWithoutEnablingFeature) { @@ -696,36 +697,14 @@ TEST_F(TextureValidationTest, UseASTCFormatWithoutEnablingFeature) { } } -class D24S8TextureFormatsValidationTests : public TextureValidationTest { - protected: - WGPUDevice CreateTestDevice() override { - wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth24UnormStencil8}; - descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 1; - return adapter.CreateDevice(&descriptor); - } -}; - -// Test that depth24unorm-stencil8 format is invalid for 3D texture -TEST_F(D24S8TextureFormatsValidationTests, DepthStencilFormatsFor3D) { - wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor(); - - for (wgpu::TextureDimension dimension : kDimensions) { - descriptor.format = wgpu::TextureFormat::Depth24UnormStencil8; - descriptor.dimension = dimension; - ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); - } -} - class D32S8TextureFormatsValidationTests : public TextureValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth32FloatStencil8}; descriptor.requiredFeatures = requiredFeatures; descriptor.requiredFeaturesCount = 1; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } }; @@ -742,7 +721,7 @@ TEST_F(D32S8TextureFormatsValidationTests, DepthStencilFormatsFor3D) { class CompressedTextureFormatsValidationTests : public TextureValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[3] = {wgpu::FeatureName::TextureCompressionBC, wgpu::FeatureName::TextureCompressionETC2, @@ -758,7 +737,7 @@ class CompressedTextureFormatsValidationTests : public TextureValidationTest { descriptor.nextInChain = &togglesDesc; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } wgpu::TextureDescriptor CreateDefaultTextureDescriptor() { @@ -906,4 +885,93 @@ TEST_F(CompressedTextureFormatsValidationTests, TextureSize) { } } +static void CheckTextureMatchesDescriptor(const wgpu::Texture& tex, + const wgpu::TextureDescriptor& desc) { + EXPECT_EQ(desc.size.width, tex.GetWidth()); + EXPECT_EQ(desc.size.height, tex.GetHeight()); + EXPECT_EQ(desc.size.depthOrArrayLayers, tex.GetDepthOrArrayLayers()); + EXPECT_EQ(desc.mipLevelCount, tex.GetMipLevelCount()); + EXPECT_EQ(desc.sampleCount, tex.GetSampleCount()); + EXPECT_EQ(desc.dimension, tex.GetDimension()); + EXPECT_EQ(desc.usage, tex.GetUsage()); + EXPECT_EQ(desc.format, tex.GetFormat()); +} + +// Test that the texture creation parameters are correctly reflected for succesfully created +// textures. +TEST_F(TextureValidationTest, CreationParameterReflectionForValidTextures) { + // Test reflection on two succesfully created but different textures. + { + wgpu::TextureDescriptor desc; + desc.size = {3, 2, 1}; + desc.mipLevelCount = 1; + desc.sampleCount = 4; + desc.dimension = wgpu::TextureDimension::e2D; + desc.usage = wgpu::TextureUsage::RenderAttachment; + desc.format = wgpu::TextureFormat::RGBA8Unorm; + wgpu::Texture tex = device.CreateTexture(&desc); + + CheckTextureMatchesDescriptor(tex, desc); + } + { + wgpu::TextureDescriptor desc; + desc.size = {47, 32, 19}; + desc.mipLevelCount = 3; + desc.sampleCount = 1; + desc.dimension = wgpu::TextureDimension::e3D; + desc.usage = wgpu::TextureUsage::TextureBinding; + desc.format = wgpu::TextureFormat::R32Float; + wgpu::Texture tex = device.CreateTexture(&desc); + + CheckTextureMatchesDescriptor(tex, desc); + } +} + +// Test that the texture creation parameters are correctly reflected for error textures. +TEST_F(TextureValidationTest, CreationParameterReflectionForErrorTextures) { + // Fill a descriptor with a bunch of garbage values. + wgpu::TextureDescriptor desc; + desc.size = {0, 0xFFFF'FFFF, 1}; + desc.mipLevelCount = 0; + desc.sampleCount = 42; + desc.dimension = static_cast(0xFFFF'FF00); + desc.usage = static_cast(0xFFFF'FFFF); + desc.format = static_cast(0xFFFF'FFF0); + + // Error! Because the texture width is 0. + wgpu::Texture tex; + ASSERT_DEVICE_ERROR(tex = device.CreateTexture(&desc)); + + CheckTextureMatchesDescriptor(tex, desc); +} + +// Test that CreateErrorTexture creates an invalid texture but doesn't produce an error. +TEST_F(TextureValidationTest, CreateErrorTexture) { + wgpu::TextureDescriptor desc; + desc.format = wgpu::TextureFormat::RGBA8Unorm; + desc.size = {1, 1, 1}; + desc.usage = wgpu::TextureUsage::RenderAttachment; + + // Check that the descriptor is valid. + device.CreateTexture(&desc); + + // Creating the error texture doesn't produce a validation error. + wgpu::Texture tex = device.CreateErrorTexture(&desc); + + // Using the texture, for example to create a view, is an error. + ASSERT_DEVICE_ERROR(tex.CreateView()); +} + +// Test that the texture creation parameters are correctly reflected for textures created via +// CreateErrorTexture +TEST_F(TextureValidationTest, CreationParameterReflectionForCreateErrorTexture) { + wgpu::TextureDescriptor desc; + desc.format = wgpu::TextureFormat::RGBA8Unorm; + desc.size = {1, 1, 1}; + desc.usage = wgpu::TextureUsage::RenderAttachment; + + wgpu::Texture tex = device.CreateErrorTexture(&desc); + CheckTextureMatchesDescriptor(tex, desc); +} + } // namespace diff --git a/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp b/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp index d56647b86f..244e615065 100644 --- a/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp @@ -41,7 +41,7 @@ wgpu::Texture Create2DArrayTexture(wgpu::Device& device, descriptor.sampleCount = sampleCount; descriptor.format = kDefaultTextureFormat; descriptor.mipLevelCount = mipLevelCount; - descriptor.usage = wgpu::TextureUsage::TextureBinding; + descriptor.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment; return device.CreateTexture(&descriptor); } @@ -487,10 +487,15 @@ TEST_F(TextureViewValidationTest, TextureViewDescriptorDefaults2DArray) { { wgpu::TextureViewDescriptor descriptor; - // Setting array layers to non-0 means the dimensionality will - // default to 2D so by itself it causes an error. + // Setting array layers to > 1 with an explicit dimensionality of 2D will + // causes an error. descriptor.arrayLayerCount = kDefaultArrayLayers; + descriptor.dimension = wgpu::TextureViewDimension::e2D; ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor)); + // Setting view dimension to Undefined will result in a dimension of 2DArray because the + // underlying texture has > 1 array layers. + descriptor.dimension = wgpu::TextureViewDimension::Undefined; + texture.CreateView(&descriptor); descriptor.dimension = wgpu::TextureViewDimension::e2DArray; texture.CreateView(&descriptor); @@ -741,15 +746,6 @@ TEST_F(TextureViewValidationTest, TextureViewFormatCompatibility) { ASSERT_DEVICE_ERROR(texture.CreateView(&viewDesc)); } - // Regression test for crbug.com/1312780. - // viewFormat is not supported (Null backend does not support any optional features). - { - textureDesc.format = wgpu::TextureFormat::Depth24PlusStencil8; - viewDesc.format = wgpu::TextureFormat::Depth24UnormStencil8; - wgpu::Texture texture = device.CreateTexture(&textureDesc); - ASSERT_DEVICE_ERROR(texture.CreateView(&viewDesc), testing::HasSubstr("Unsupported")); - } - // It is valid to create a texture view with a depth format of a depth-stencil texture // if the depth only aspect is selected. { @@ -918,60 +914,14 @@ TEST_F(TextureViewValidationTest, AspectMustExist) { } } -class D24S8TextureViewValidationTests : public ValidationTest { - protected: - WGPUDevice CreateTestDevice() override { - wgpu::DeviceDescriptor descriptor; - wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth24UnormStencil8}; - descriptor.requiredFeatures = requiredFeatures; - descriptor.requiredFeaturesCount = 1; - return adapter.CreateDevice(&descriptor); - } -}; - -// Test that the selected TextureAspects must exist in the Depth24UnormStencil8 texture format -TEST_F(D24S8TextureViewValidationTests, AspectMustExist) { - wgpu::Texture texture = - CreateDepthStencilTexture(device, wgpu::TextureFormat::Depth24UnormStencil8); - - // Can select: All, DepthOnly, and StencilOnly from Depth24UnormStencil8 - { - wgpu::TextureViewDescriptor viewDescriptor = {}; - viewDescriptor.aspect = wgpu::TextureAspect::All; - texture.CreateView(&viewDescriptor); - - viewDescriptor.aspect = wgpu::TextureAspect::DepthOnly; - texture.CreateView(&viewDescriptor); - - viewDescriptor.aspect = wgpu::TextureAspect::StencilOnly; - texture.CreateView(&viewDescriptor); - } -} - -// Test the format compatibility rules when creating a texture view. -TEST_F(D24S8TextureViewValidationTests, TextureViewFormatCompatibility) { - wgpu::Texture texture = - CreateDepthStencilTexture(device, wgpu::TextureFormat::Depth24UnormStencil8); - - wgpu::TextureViewDescriptor base2DTextureViewDescriptor = - CreateDefaultViewDescriptor(wgpu::TextureViewDimension::e2D); - - // It is an error to create a texture view in color format on a depth-stencil texture. - { - wgpu::TextureViewDescriptor descriptor = base2DTextureViewDescriptor; - descriptor.format = wgpu::TextureFormat::RGBA8Unorm; - ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor)); - } -} - class D32S8TextureViewValidationTests : public ValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::Depth32FloatStencil8}; descriptor.requiredFeatures = requiredFeatures; descriptor.requiredFeaturesCount = 1; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } }; diff --git a/src/dawn/tests/unittests/validation/ToggleValidationTests.cpp b/src/dawn/tests/unittests/validation/ToggleValidationTests.cpp index 1c0d9bec1d..51514281d9 100644 --- a/src/dawn/tests/unittests/validation/ToggleValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/ToggleValidationTests.cpp @@ -18,14 +18,19 @@ namespace { -class ToggleValidationTest : public ValidationTest {}; +class ToggleValidationTest : public ValidationTest { + void SetUp() override { + ValidationTest::SetUp(); + DAWN_SKIP_TEST_IF(UsesWire()); + } +}; // Tests querying the detail of a toggle from dawn::native::InstanceBase works correctly. TEST_F(ToggleValidationTest, QueryToggleInfo) { // Query with a valid toggle name { const char* kValidToggleName = "emulate_store_and_msaa_resolve"; - const dawn::native::ToggleInfo* toggleInfo = instance->GetToggleInfo(kValidToggleName); + const dawn::native::ToggleInfo* toggleInfo = GetToggleInfo(kValidToggleName); ASSERT_NE(nullptr, toggleInfo); ASSERT_NE(nullptr, toggleInfo->name); ASSERT_NE(nullptr, toggleInfo->description); @@ -35,7 +40,7 @@ TEST_F(ToggleValidationTest, QueryToggleInfo) { // Query with an invalid toggle name { const char* kInvalidToggleName = "!@#$%^&*"; - const dawn::native::ToggleInfo* toggleInfo = instance->GetToggleInfo(kInvalidToggleName); + const dawn::native::ToggleInfo* toggleInfo = GetToggleInfo(kInvalidToggleName); ASSERT_EQ(nullptr, toggleInfo); } } @@ -51,8 +56,9 @@ TEST_F(ToggleValidationTest, OverrideToggleUsage) { togglesDesc.forceEnabledToggles = &kValidToggleName; togglesDesc.forceEnabledTogglesCount = 1; - WGPUDevice deviceWithToggle = adapter.CreateDevice(&descriptor); - std::vector toggleNames = dawn::native::GetTogglesUsed(deviceWithToggle); + wgpu::Device deviceWithToggle = + wgpu::Device::Acquire(GetBackendAdapter().CreateDevice(&descriptor)); + std::vector toggleNames = dawn::native::GetTogglesUsed(deviceWithToggle.Get()); bool validToggleExists = false; for (const char* toggle : toggleNames) { if (strcmp(toggle, kValidToggleName) == 0) { @@ -71,8 +77,9 @@ TEST_F(ToggleValidationTest, OverrideToggleUsage) { togglesDesc.forceEnabledToggles = &kInvalidToggleName; togglesDesc.forceEnabledTogglesCount = 1; - WGPUDevice deviceWithToggle = adapter.CreateDevice(&descriptor); - std::vector toggleNames = dawn::native::GetTogglesUsed(deviceWithToggle); + wgpu::Device deviceWithToggle = + wgpu::Device::Acquire(GetBackendAdapter().CreateDevice(&descriptor)); + std::vector toggleNames = dawn::native::GetTogglesUsed(deviceWithToggle.Get()); bool InvalidToggleExists = false; for (const char* toggle : toggleNames) { if (strcmp(toggle, kInvalidToggleName) == 0) { @@ -91,8 +98,9 @@ TEST_F(ToggleValidationTest, TurnOffVsyncWithToggle) { togglesDesc.forceEnabledToggles = &kValidToggleName; togglesDesc.forceEnabledTogglesCount = 1; - WGPUDevice deviceWithToggle = adapter.CreateDevice(&descriptor); - std::vector toggleNames = dawn::native::GetTogglesUsed(deviceWithToggle); + wgpu::Device deviceWithToggle = + wgpu::Device::Acquire(GetBackendAdapter().CreateDevice(&descriptor)); + std::vector toggleNames = dawn::native::GetTogglesUsed(deviceWithToggle.Get()); bool validToggleExists = false; for (const char* toggle : toggleNames) { if (strcmp(toggle, kValidToggleName) == 0) { diff --git a/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp b/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp index 95b56458fb..10d7a0049e 100644 --- a/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/UnsafeAPIValidationTests.cpp @@ -26,14 +26,14 @@ using testing::HasSubstr; class UnsafeAPIValidationTest : public ValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::DawnTogglesDeviceDescriptor togglesDesc; descriptor.nextInChain = &togglesDesc; const char* toggle = "disallow_unsafe_apis"; togglesDesc.forceEnabledToggles = &toggle; togglesDesc.forceEnabledTogglesCount = 1; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } }; @@ -48,7 +48,7 @@ TEST_F(UnsafeAPIValidationTest, PipelineOverridableConstants) { { wgpu::ComputePipelineDescriptor pipelineDesc = pipelineDescBase; pipelineDesc.compute.module = - utils::CreateShaderModule(device, "@stage(compute) @workgroup_size(1) fn main() {}"); + utils::CreateShaderModule(device, "@compute @workgroup_size(1) fn main() {}"); device.CreateComputePipeline(&pipelineDesc); } @@ -59,7 +59,7 @@ TEST_F(UnsafeAPIValidationTest, PipelineOverridableConstants) { @id(1000) override c0: u32 = 1u; @id(1000) override c1: u32; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { _ = c0; _ = c1; })")); @@ -69,7 +69,7 @@ TEST_F(UnsafeAPIValidationTest, PipelineOverridableConstants) { { wgpu::ComputePipelineDescriptor pipelineDesc = pipelineDescBase; pipelineDesc.compute.module = - utils::CreateShaderModule(device, "@stage(compute) @workgroup_size(1) fn main() {}"); + utils::CreateShaderModule(device, "@compute @workgroup_size(1) fn main() {}"); std::vector constants{{nullptr, "c", 1u}}; pipelineDesc.compute.constants = constants.data(); pipelineDesc.compute.constantCount = constants.size(); @@ -79,7 +79,7 @@ TEST_F(UnsafeAPIValidationTest, PipelineOverridableConstants) { class UnsafeQueryAPIValidationTest : public ValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[2] = {wgpu::FeatureName::PipelineStatisticsQuery, wgpu::FeatureName::TimestampQuery}; @@ -92,7 +92,7 @@ class UnsafeQueryAPIValidationTest : public ValidationTest { togglesDesc.forceEnabledToggles = &toggle; togglesDesc.forceEnabledTogglesCount = 1; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } }; diff --git a/src/dawn/tests/unittests/validation/ValidationTest.cpp b/src/dawn/tests/unittests/validation/ValidationTest.cpp index b7b23b2483..1127fa6981 100644 --- a/src/dawn/tests/unittests/validation/ValidationTest.cpp +++ b/src/dawn/tests/unittests/validation/ValidationTest.cpp @@ -30,6 +30,7 @@ bool gUseWire = false; // NOLINTNEXTLINE(runtime/string) std::string gWireTraceDir = ""; std::unique_ptr gToggleParser = nullptr; +static ValidationTest* gCurrentTest = nullptr; } // namespace @@ -79,45 +80,86 @@ void InitDawnValidationTestEnvironment(int argc, char** argv) { } } -ValidationTest::ValidationTest() - : mWireHelper(utils::CreateWireHelper(gUseWire, gWireTraceDir.c_str())) {} +ValidationTest::ValidationTest() { + gCurrentTest = this; + + DawnProcTable procs = dawn::native::GetProcs(); + // Override procs to provide harness-specific behavior to always select the null adapter, + // and to allow fixture-specific overriding of the test device with CreateTestDevice. + procs.instanceRequestAdapter = [](WGPUInstance instance, const WGPURequestAdapterOptions*, + WGPURequestAdapterCallback callback, void* userdata) { + ASSERT(gCurrentTest); + std::vector adapters = gCurrentTest->mDawnInstance->GetAdapters(); + // Validation tests run against the null backend, find the corresponding adapter + for (auto& adapter : adapters) { + wgpu::AdapterProperties adapterProperties; + adapter.GetProperties(&adapterProperties); + + if (adapterProperties.backendType == wgpu::BackendType::Null) { + gCurrentTest->mBackendAdapter = adapter; + WGPUAdapter cAdapter = adapter.Get(); + ASSERT(cAdapter); + dawn::native::GetProcs().adapterReference(cAdapter); + callback(WGPURequestAdapterStatus_Success, cAdapter, nullptr, userdata); + return; + } + } + UNREACHABLE(); + }; + + procs.adapterRequestDevice = [](WGPUAdapter adapter, const WGPUDeviceDescriptor*, + WGPURequestDeviceCallback callback, void* userdata) { + ASSERT(gCurrentTest); + WGPUDevice cDevice = gCurrentTest->CreateTestDevice( + dawn::native::Adapter(reinterpret_cast(adapter))); + ASSERT(cDevice != nullptr); + gCurrentTest->mLastCreatedBackendDevice = cDevice; + callback(WGPURequestDeviceStatus_Success, cDevice, nullptr, userdata); + }; + + mWireHelper = utils::CreateWireHelper(procs, gUseWire, gWireTraceDir.c_str()); +} void ValidationTest::SetUp() { - instance = std::make_unique(); - instance->DiscoverDefaultAdapters(); - - std::vector adapters = instance->GetAdapters(); - - // Validation tests run against the null backend, find the corresponding adapter - bool foundNullAdapter = false; - for (auto& currentAdapter : adapters) { - wgpu::AdapterProperties adapterProperties; - currentAdapter.GetProperties(&adapterProperties); - - if (adapterProperties.backendType == wgpu::BackendType::Null) { - adapter = currentAdapter; - foundNullAdapter = true; - break; - } - } - - ASSERT(foundNullAdapter); - - std::tie(device, backendDevice) = mWireHelper->RegisterDevice(CreateTestDevice()); - device.SetUncapturedErrorCallback(ValidationTest::OnDeviceError, this); - device.SetDeviceLostCallback(ValidationTest::OnDeviceLost, this); + mDawnInstance = std::make_unique(); + mDawnInstance->DiscoverDefaultAdapters(); + mInstance = mWireHelper->RegisterInstance(mDawnInstance->Get()); std::string traceName = std::string(::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name()) + "_" + ::testing::UnitTest::GetInstance()->current_test_info()->name(); mWireHelper->BeginWireTrace(traceName.c_str()); + + // These options are unused since validation tests always select the null adapter + wgpu::RequestAdapterOptions options = {}; + mInstance.RequestAdapter( + &options, + [](WGPURequestAdapterStatus, WGPUAdapter cAdapter, const char*, void* userdata) { + *static_cast(userdata) = wgpu::Adapter::Acquire(cAdapter); + }, + &adapter); + FlushWire(); + ASSERT(adapter); + + device = RequestDeviceSync(wgpu::DeviceDescriptor{}); + backendDevice = mLastCreatedBackendDevice; + + device.SetUncapturedErrorCallback(ValidationTest::OnDeviceError, this); + device.SetDeviceLostCallback(ValidationTest::OnDeviceLost, this); } ValidationTest::~ValidationTest() { - // We need to destroy Dawn objects before setting the procs to null otherwise the dawn*Release - // will call a nullptr - device = wgpu::Device(); + // We need to destroy Dawn objects before the wire helper which sets procs to null otherwise the + // dawn*Release will call a nullptr + device = nullptr; + adapter = nullptr; + mInstance = nullptr; mWireHelper.reset(); + + // Check that all devices were destructed. + EXPECT_EQ(mDawnInstance->GetDeviceCountForTesting(), 0u); + + gCurrentTest = nullptr; } void ValidationTest::TearDown() { @@ -156,10 +198,6 @@ void ValidationTest::ExpectDeviceDestruction() { mExpectDestruction = true; } -wgpu::Device ValidationTest::RegisterDevice(WGPUDevice backendDevice) { - return mWireHelper->RegisterDevice(backendDevice).first; -} - bool ValidationTest::UsesWire() const { return gUseWire; } @@ -187,6 +225,10 @@ void ValidationTest::WaitForAllOperations(const wgpu::Device& device) { FlushWire(); } +const dawn::native::ToggleInfo* ValidationTest::GetToggleInfo(const char* name) const { + return mDawnInstance->GetToggleInfo(name); +} + bool ValidationTest::HasToggleEnabled(const char* toggle) const { auto toggles = dawn::native::GetTogglesUsed(backendDevice); return std::find_if(toggles.begin(), toggles.end(), [toggle](const char* name) { @@ -194,14 +236,33 @@ bool ValidationTest::HasToggleEnabled(const char* toggle) const { }) != toggles.end(); } -wgpu::SupportedLimits ValidationTest::GetSupportedLimits() { - WGPUSupportedLimits supportedLimits; - supportedLimits.nextInChain = nullptr; - dawn::native::GetProcs().deviceGetLimits(backendDevice, &supportedLimits); - return *reinterpret_cast(&supportedLimits); +wgpu::SupportedLimits ValidationTest::GetSupportedLimits() const { + wgpu::SupportedLimits supportedLimits = {}; + device.GetLimits(&supportedLimits); + return supportedLimits; } -WGPUDevice ValidationTest::CreateTestDevice() { +wgpu::Device ValidationTest::RequestDeviceSync(const wgpu::DeviceDescriptor& deviceDesc) { + ASSERT(adapter); + + wgpu::Device apiDevice; + adapter.RequestDevice( + &deviceDesc, + [](WGPURequestDeviceStatus, WGPUDevice cDevice, const char*, void* userdata) { + *static_cast(userdata) = wgpu::Device::Acquire(cDevice); + }, + &apiDevice); + FlushWire(); + + ASSERT(apiDevice); + return apiDevice; +} + +dawn::native::Adapter& ValidationTest::GetBackendAdapter() { + return mBackendAdapter; +} + +WGPUDevice ValidationTest::CreateTestDevice(dawn::native::Adapter dawnAdapter) { // Disabled disallowing unsafe APIs so we can test them. std::vector forceEnabledToggles; std::vector forceDisabledToggles = {"disallow_unsafe_apis"}; @@ -223,13 +284,13 @@ WGPUDevice ValidationTest::CreateTestDevice() { togglesDesc.forceDisabledToggles = forceDisabledToggles.data(); togglesDesc.forceDisabledTogglesCount = forceDisabledToggles.size(); - return adapter.CreateDevice(&deviceDescriptor); + return dawnAdapter.CreateDevice(&deviceDescriptor); } // static void ValidationTest::OnDeviceError(WGPUErrorType type, const char* message, void* userdata) { ASSERT(type != WGPUErrorType_NoError); - auto self = static_cast(userdata); + auto* self = static_cast(userdata); self->mDeviceErrorMessage = message; ASSERT_TRUE(self->mExpectError) << "Got unexpected device error: " << message; @@ -243,7 +304,7 @@ void ValidationTest::OnDeviceError(WGPUErrorType type, const char* message, void void ValidationTest::OnDeviceLost(WGPUDeviceLostReason reason, const char* message, void* userdata) { - auto self = static_cast(userdata); + auto* self = static_cast(userdata); if (self->mExpectDestruction) { EXPECT_EQ(reason, WGPUDeviceLostReason_Destroyed); return; diff --git a/src/dawn/tests/unittests/validation/ValidationTest.h b/src/dawn/tests/unittests/validation/ValidationTest.h index f373b28fa2..bc064cf43e 100644 --- a/src/dawn/tests/unittests/validation/ValidationTest.h +++ b/src/dawn/tests/unittests/validation/ValidationTest.h @@ -108,8 +108,6 @@ class ValidationTest : public testing::Test { void ExpectDeviceDestruction(); - wgpu::Device RegisterDevice(WGPUDevice backendDevice); - bool UsesWire() const; void FlushWire(); @@ -129,25 +127,28 @@ class ValidationTest : public testing::Test { wgpu::RenderPassColorAttachment mColorAttachment; }; + const dawn::native::ToggleInfo* GetToggleInfo(const char* name) const; bool HasToggleEnabled(const char* toggle) const; - - // TODO(crbug.com/dawn/689): Use limits returned from the wire - // This is implemented here because tests need to always query - // the |backendDevice| since limits are not implemented in the wire. - wgpu::SupportedLimits GetSupportedLimits(); + wgpu::SupportedLimits GetSupportedLimits() const; protected: - virtual WGPUDevice CreateTestDevice(); + dawn::native::Adapter& GetBackendAdapter(); + virtual WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter); + + wgpu::Device RequestDeviceSync(const wgpu::DeviceDescriptor& deviceDesc); - std::unique_ptr instance; - dawn::native::Adapter adapter; wgpu::Device device; + wgpu::Adapter adapter; WGPUDevice backendDevice; size_t mLastWarningCount = 0; private: + std::unique_ptr mDawnInstance; + wgpu::Instance mInstance; + dawn::native::Adapter mBackendAdapter; std::unique_ptr mWireHelper; + WGPUDevice mLastCreatedBackendDevice; static void OnDeviceError(WGPUErrorType type, const char* message, void* userdata); static void OnDeviceLost(WGPUDeviceLostReason reason, const char* message, void* userdata); diff --git a/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp b/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp index 5b79eb5a4e..a70c582cf7 100644 --- a/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/VertexBufferValidationTests.cpp @@ -27,11 +27,11 @@ class VertexBufferValidationTest : public ValidationTest { // Placeholder vertex shader module vsModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"); fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(0.0, 1.0, 0.0, 1.0); })"); } @@ -46,7 +46,7 @@ class VertexBufferValidationTest : public ValidationTest { wgpu::ShaderModule MakeVertexShader(unsigned int bufferCount) { std::ostringstream vs; - vs << "@stage(vertex) fn main(\n"; + vs << "@vertex fn main(\n"; for (unsigned int i = 0; i < bufferCount; ++i) { // TODO(cwallez@chromium.org): remove this special handling of 0 once Tint supports // trailing commas in argument lists. diff --git a/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp b/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp index b4de1bb641..32ed09e9ee 100644 --- a/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/VertexStateValidationTests.cpp @@ -26,7 +26,7 @@ class VertexStateTest : public ValidationTest { const char* vertexSource) { wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexSource); wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } )"); @@ -46,7 +46,7 @@ class VertexStateTest : public ValidationTest { } const char* kPlaceholderVertexShader = R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } )"; @@ -98,7 +98,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) { // Control case: pipeline with one input per attribute CreatePipeline(true, state, R"( - @stage(vertex) fn main( + @vertex fn main( @location(0) a : vec4, @location(1) b : vec4 ) -> @builtin(position) vec4 { @@ -108,7 +108,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) { // Check it is valid for the pipeline to use a subset of the VertexState CreatePipeline(true, state, R"( - @stage(vertex) fn main( + @vertex fn main( @location(0) a : vec4 ) -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); @@ -117,7 +117,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) { // Check for an error when the pipeline uses an attribute not in the vertex input CreatePipeline(false, state, R"( - @stage(vertex) fn main( + @vertex fn main( @location(2) a : vec4 ) -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); @@ -360,7 +360,7 @@ TEST_F(VertexStateTest, BaseTypeMatching) { state.cVertexBuffers[0].attributeCount = 1; state.cAttributes[0].format = format; - std::string shader = "@stage(vertex) fn main(@location(0) attrib : " + shaderType + + std::string shader = "@vertex fn main(@location(0) attrib : " + shaderType + R"() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"; @@ -414,7 +414,7 @@ TEST_F(VertexStateTest, BaseTypeMatchingForInexistentInput) { state.cVertexBuffers[0].attributeCount = 1; state.cAttributes[0].format = format; - std::string shader = R"(@stage(vertex) fn main() -> @builtin(position) vec4 { + std::string shader = R"(@vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); })"; @@ -427,3 +427,18 @@ TEST_F(VertexStateTest, BaseTypeMatchingForInexistentInput) { DoTest(wgpu::VertexFormat::Uint8x4); DoTest(wgpu::VertexFormat::Sint32x2); } + +// Test that non-zero attributeCount with VertexBufferNotUsed stepMode is invalid +TEST_F(VertexStateTest, UnusedBufferZeroAttribute) { + // Non-zero attributeCount with non-VertexBufferNotUsed is valid + utils::ComboVertexState state; + state.vertexBufferCount = 1; + state.cVertexBuffers[0].arrayStride = 0; + state.cVertexBuffers[0].attributeCount = 1; + state.cVertexBuffers[0].stepMode = wgpu::VertexStepMode::Vertex; + CreatePipeline(true, state, kPlaceholderVertexShader); + + // Non-zero attributeCount with VertexBufferNotUsed is invalid + state.cVertexBuffers[0].stepMode = wgpu::VertexStepMode::VertexBufferNotUsed; + CreatePipeline(false, state, kPlaceholderVertexShader); +} diff --git a/src/dawn/tests/unittests/validation/VideoViewsValidationTests.cpp b/src/dawn/tests/unittests/validation/VideoViewsValidationTests.cpp index 6075b94d10..e566958484 100644 --- a/src/dawn/tests/unittests/validation/VideoViewsValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/VideoViewsValidationTests.cpp @@ -21,12 +21,12 @@ namespace { class VideoViewsValidation : public ValidationTest { protected: - WGPUDevice CreateTestDevice() override { + WGPUDevice CreateTestDevice(dawn::native::Adapter dawnAdapter) override { wgpu::DeviceDescriptor descriptor; wgpu::FeatureName requiredFeatures[1] = {wgpu::FeatureName::DawnMultiPlanarFormats}; descriptor.requiredFeatures = requiredFeatures; descriptor.requiredFeaturesCount = 1; - return adapter.CreateDevice(&descriptor); + return dawnAdapter.CreateDevice(&descriptor); } wgpu::Texture CreateVideoTextureForTest(wgpu::TextureFormat format, wgpu::TextureUsage usage) { diff --git a/src/dawn/tests/unittests/wire/WireAdapterTests.cpp b/src/dawn/tests/unittests/wire/WireAdapterTests.cpp index aa56c39b22..1a1c6f1393 100644 --- a/src/dawn/tests/unittests/wire/WireAdapterTests.cpp +++ b/src/dawn/tests/unittests/wire/WireAdapterTests.cpp @@ -62,6 +62,8 @@ class WireAdapterTests : public WireTest { EXPECT_CALL(api, AdapterGetProperties(apiAdapter, NotNull())) .WillOnce(WithArg<1>(Invoke([&](WGPUAdapterProperties* properties) { *properties = {}; + properties->vendorName = ""; + properties->architecture = ""; properties->name = ""; properties->driverDescription = ""; }))); @@ -177,6 +179,10 @@ TEST_F(WireAdapterTests, RequestDeviceSuccess) { // Expect the server to receive the message. Then, mock a fake reply. WGPUDevice apiDevice = api.GetNewDevice(); + // The backend device should not be known by the wire server. + EXPECT_FALSE(GetWireServer()->IsDeviceKnown(apiDevice)); + + wgpu::Device device; EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), NotNull(), NotNull())) .WillOnce(InvokeWithoutArgs([&]() { // Set on device creation to forward callbacks to the client. @@ -203,15 +209,20 @@ TEST_F(WireAdapterTests, RequestDeviceSuccess) { return fakeFeatures.size(); }))); + // The backend device should still not be known by the wire server since the + // callback has not been called yet. + EXPECT_FALSE(GetWireServer()->IsDeviceKnown(apiDevice)); api.CallAdapterRequestDeviceCallback(apiAdapter, WGPURequestDeviceStatus_Success, apiDevice, nullptr); + // After the callback is called, the backend device is now known by the server. + EXPECT_TRUE(GetWireServer()->IsDeviceKnown(apiDevice)); })); FlushClient(); // Expect the callback in the client and all the device information to match. EXPECT_CALL(cb, Call(WGPURequestDeviceStatus_Success, NotNull(), nullptr, this)) .WillOnce(WithArg<1>(Invoke([&](WGPUDevice cDevice) { - wgpu::Device device = wgpu::Device::Acquire(cDevice); + device = wgpu::Device::Acquire(cDevice); wgpu::SupportedLimits limits; EXPECT_TRUE(device.GetLimits(&limits)); @@ -230,10 +241,28 @@ TEST_F(WireAdapterTests, RequestDeviceSuccess) { }))); FlushServer(); + // Test that callbacks can propagate from server to client. + MockCallback errorCb; + device.SetUncapturedErrorCallback(errorCb.Callback(), errorCb.MakeUserdata(this)); + api.CallDeviceSetUncapturedErrorCallbackCallback(apiDevice, WGPUErrorType_Validation, + "Some error message"); + + EXPECT_CALL(errorCb, Call(WGPUErrorType_Validation, StrEq("Some error message"), this)) + .Times(1); + FlushServer(); + + device = nullptr; // Cleared when the device is destroyed. EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, nullptr, nullptr)).Times(1); EXPECT_CALL(api, OnDeviceSetLoggingCallback(apiDevice, nullptr, nullptr)).Times(1); EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(apiDevice, nullptr, nullptr)).Times(1); + EXPECT_CALL(api, DeviceRelease(apiDevice)); + + // Server has not recevied the release yet, so the device should be known. + EXPECT_TRUE(GetWireServer()->IsDeviceKnown(apiDevice)); + FlushClient(); + // After receiving the release call, the device is no longer known by the server. + EXPECT_FALSE(GetWireServer()->IsDeviceKnown(apiDevice)); } // Test that features requested that the implementation supports, but not the @@ -333,7 +362,5 @@ TEST_F(WireAdapterTests, RequestDeviceWireDisconnectedBeforeCallback) { GetWireClient()->Disconnect(); } -// TODO(https://crbug.com/dawn/1381) Remove when namespaces are not indented. -// NOLINTNEXTLINE(readability/namespace) } // namespace } // namespace dawn::wire diff --git a/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp b/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp index 4d7f7cd423..5c81fe3fb7 100644 --- a/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp +++ b/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp @@ -363,20 +363,10 @@ TEST_F(WireCreatePipelineAsyncTest, DeviceDeletedBeforeCallback) { wgpuDeviceRelease(device); - // Expect release on all objects created by the client. - Sequence s1, s2; - EXPECT_CALL(api, QueueRelease(apiQueue)).Times(1).InSequence(s1); - EXPECT_CALL(api, ShaderModuleRelease(apiModule)).Times(1).InSequence(s2); - EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, nullptr, nullptr)) - .Times(1) - .InSequence(s1, s2); - EXPECT_CALL(api, OnDeviceSetLoggingCallback(apiDevice, nullptr, nullptr)) - .Times(1) - .InSequence(s1, s2); - EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(apiDevice, nullptr, nullptr)) - .Times(1) - .InSequence(s1, s2); - EXPECT_CALL(api, DeviceRelease(apiDevice)).Times(1).InSequence(s1, s2); + EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, nullptr, nullptr)).Times(1); + EXPECT_CALL(api, OnDeviceSetLoggingCallback(apiDevice, nullptr, nullptr)).Times(1); + EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(apiDevice, nullptr, nullptr)).Times(1); + EXPECT_CALL(api, DeviceRelease(apiDevice)).Times(1); FlushClient(); DefaultApiDeviceWasReleased(); diff --git a/src/dawn/tests/unittests/wire/WireDestroyObjectTests.cpp b/src/dawn/tests/unittests/wire/WireDestroyObjectTests.cpp deleted file mode 100644 index 4f2f947e3c..0000000000 --- a/src/dawn/tests/unittests/wire/WireDestroyObjectTests.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "dawn/tests/MockCallback.h" -#include "dawn/tests/unittests/wire/WireTest.h" - -namespace dawn::wire { - -using testing::Return; -using testing::Sequence; - -class WireDestroyObjectTests : public WireTest {}; - -// Test that destroying the device also destroys child objects. -TEST_F(WireDestroyObjectTests, DestroyDeviceDestroysChildren) { - WGPUCommandEncoder encoder = wgpuDeviceCreateCommandEncoder(device, nullptr); - - WGPUCommandEncoder apiEncoder = api.GetNewCommandEncoder(); - EXPECT_CALL(api, DeviceCreateCommandEncoder(apiDevice, nullptr)).WillOnce(Return(apiEncoder)); - - FlushClient(); - - // Release the device. It should cause the command encoder to be destroyed. - wgpuDeviceRelease(device); - - Sequence s1, s2; - // The device and child objects should be released. - EXPECT_CALL(api, CommandEncoderRelease(apiEncoder)).InSequence(s1); - EXPECT_CALL(api, QueueRelease(apiQueue)).InSequence(s2); - EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, nullptr, nullptr)) - .Times(1) - .InSequence(s1, s2); - EXPECT_CALL(api, OnDeviceSetLoggingCallback(apiDevice, nullptr, nullptr)) - .Times(1) - .InSequence(s1, s2); - EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(apiDevice, nullptr, nullptr)) - .Times(1) - .InSequence(s1, s2); - EXPECT_CALL(api, DeviceRelease(apiDevice)).InSequence(s1, s2); - - FlushClient(); - - // Signal that we already released and cleared callbacks for |apiDevice| - DefaultApiDeviceWasReleased(); - - // Using the command encoder should be an error. - wgpuCommandEncoderFinish(encoder, nullptr); - FlushClient(false); -} - -} // namespace dawn::wire diff --git a/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp b/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp index 2218194ad1..ec244e0d5e 100644 --- a/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp +++ b/src/dawn/tests/unittests/wire/WireDisconnectTests.cpp @@ -160,11 +160,10 @@ TEST_F(WireDisconnectTests, DeleteClientDestroysObjects) { DeleteClient(); - // Expect release on all objects created by the client. + // Expect release on all objects created by the client. Note: the device + // should be deleted first because it may free its reference to the default queue + // on deletion. Sequence s1, s2, s3; - EXPECT_CALL(api, QueueRelease(apiQueue)).Times(1).InSequence(s1); - EXPECT_CALL(api, CommandEncoderRelease(apiCommandEncoder)).Times(1).InSequence(s2); - EXPECT_CALL(api, SamplerRelease(apiSampler)).Times(1).InSequence(s3); EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, nullptr, nullptr)) .Times(1) .InSequence(s1, s2); @@ -175,6 +174,9 @@ TEST_F(WireDisconnectTests, DeleteClientDestroysObjects) { .Times(1) .InSequence(s1, s2); EXPECT_CALL(api, DeviceRelease(apiDevice)).Times(1).InSequence(s1, s2, s3); + EXPECT_CALL(api, QueueRelease(apiQueue)).Times(1).InSequence(s1); + EXPECT_CALL(api, CommandEncoderRelease(apiCommandEncoder)).Times(1).InSequence(s2); + EXPECT_CALL(api, SamplerRelease(apiSampler)).Times(1).InSequence(s3); FlushClient(); // Signal that we already released and cleared callbacks for |apiDevice| diff --git a/src/dawn/tests/unittests/wire/WireExtensionTests.cpp b/src/dawn/tests/unittests/wire/WireExtensionTests.cpp index 6060ce5d7b..b36e2447e4 100644 --- a/src/dawn/tests/unittests/wire/WireExtensionTests.cpp +++ b/src/dawn/tests/unittests/wire/WireExtensionTests.cpp @@ -36,10 +36,10 @@ TEST_F(WireExtensionTests, ChainedStruct) { EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiShaderModule)); FlushClient(); - WGPUPrimitiveDepthClampingState clientExt = {}; - clientExt.chain.sType = WGPUSType_PrimitiveDepthClampingState; + WGPUPrimitiveDepthClipControl clientExt = {}; + clientExt.chain.sType = WGPUSType_PrimitiveDepthClipControl; clientExt.chain.next = nullptr; - clientExt.clampDepth = true; + clientExt.unclippedDepth = true; WGPURenderPipelineDescriptor renderPipelineDesc = {}; renderPipelineDesc.vertex.module = shaderModule; @@ -50,10 +50,10 @@ TEST_F(WireExtensionTests, ChainedStruct) { EXPECT_CALL(api, DeviceCreateRenderPipeline(apiDevice, NotNull())) .WillOnce(Invoke( [&](Unused, const WGPURenderPipelineDescriptor* serverDesc) -> WGPURenderPipeline { - const auto* ext = reinterpret_cast( + const auto* ext = reinterpret_cast( serverDesc->primitive.nextInChain); EXPECT_EQ(ext->chain.sType, clientExt.chain.sType); - EXPECT_EQ(ext->clampDepth, true); + EXPECT_EQ(ext->unclippedDepth, true); EXPECT_EQ(ext->chain.next, nullptr); return api.GetNewRenderPipeline(); @@ -69,15 +69,15 @@ TEST_F(WireExtensionTests, MutlipleChainedStructs) { EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiShaderModule)); FlushClient(); - WGPUPrimitiveDepthClampingState clientExt2 = {}; - clientExt2.chain.sType = WGPUSType_PrimitiveDepthClampingState; + WGPUPrimitiveDepthClipControl clientExt2 = {}; + clientExt2.chain.sType = WGPUSType_PrimitiveDepthClipControl; clientExt2.chain.next = nullptr; - clientExt2.clampDepth = false; + clientExt2.unclippedDepth = false; - WGPUPrimitiveDepthClampingState clientExt1 = {}; - clientExt1.chain.sType = WGPUSType_PrimitiveDepthClampingState; + WGPUPrimitiveDepthClipControl clientExt1 = {}; + clientExt1.chain.sType = WGPUSType_PrimitiveDepthClipControl; clientExt1.chain.next = &clientExt2.chain; - clientExt1.clampDepth = true; + clientExt1.unclippedDepth = true; WGPURenderPipelineDescriptor renderPipelineDesc = {}; renderPipelineDesc.vertex.module = shaderModule; @@ -88,15 +88,15 @@ TEST_F(WireExtensionTests, MutlipleChainedStructs) { EXPECT_CALL(api, DeviceCreateRenderPipeline(apiDevice, NotNull())) .WillOnce(Invoke( [&](Unused, const WGPURenderPipelineDescriptor* serverDesc) -> WGPURenderPipeline { - const auto* ext1 = reinterpret_cast( + const auto* ext1 = reinterpret_cast( serverDesc->primitive.nextInChain); EXPECT_EQ(ext1->chain.sType, clientExt1.chain.sType); - EXPECT_EQ(ext1->clampDepth, true); + EXPECT_EQ(ext1->unclippedDepth, true); const auto* ext2 = - reinterpret_cast(ext1->chain.next); + reinterpret_cast(ext1->chain.next); EXPECT_EQ(ext2->chain.sType, clientExt2.chain.sType); - EXPECT_EQ(ext2->clampDepth, false); + EXPECT_EQ(ext2->unclippedDepth, false); EXPECT_EQ(ext2->chain.next, nullptr); return api.GetNewRenderPipeline(); @@ -112,15 +112,15 @@ TEST_F(WireExtensionTests, MutlipleChainedStructs) { EXPECT_CALL(api, DeviceCreateRenderPipeline(apiDevice, NotNull())) .WillOnce(Invoke( [&](Unused, const WGPURenderPipelineDescriptor* serverDesc) -> WGPURenderPipeline { - const auto* ext2 = reinterpret_cast( + const auto* ext2 = reinterpret_cast( serverDesc->primitive.nextInChain); EXPECT_EQ(ext2->chain.sType, clientExt2.chain.sType); - EXPECT_EQ(ext2->clampDepth, false); + EXPECT_EQ(ext2->unclippedDepth, false); const auto* ext1 = - reinterpret_cast(ext2->chain.next); + reinterpret_cast(ext2->chain.next); EXPECT_EQ(ext1->chain.sType, clientExt1.chain.sType); - EXPECT_EQ(ext1->clampDepth, true); + EXPECT_EQ(ext1->unclippedDepth, true); EXPECT_EQ(ext1->chain.next, nullptr); return api.GetNewRenderPipeline(); @@ -136,7 +136,7 @@ TEST_F(WireExtensionTests, InvalidSType) { EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiShaderModule)); FlushClient(); - WGPUPrimitiveDepthClampingState clientExt = {}; + WGPUPrimitiveDepthClipControl clientExt = {}; clientExt.chain.sType = WGPUSType_Invalid; clientExt.chain.next = nullptr; @@ -164,7 +164,7 @@ TEST_F(WireExtensionTests, UnknownSType) { EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiShaderModule)); FlushClient(); - WGPUPrimitiveDepthClampingState clientExt = {}; + WGPUPrimitiveDepthClipControl clientExt = {}; clientExt.chain.sType = static_cast(-1); clientExt.chain.next = nullptr; @@ -193,14 +193,14 @@ TEST_F(WireExtensionTests, ValidAndInvalidSTypeInChain) { EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiShaderModule)); FlushClient(); - WGPUPrimitiveDepthClampingState clientExt2 = {}; + WGPUPrimitiveDepthClipControl clientExt2 = {}; clientExt2.chain.sType = WGPUSType_Invalid; clientExt2.chain.next = nullptr; - WGPUPrimitiveDepthClampingState clientExt1 = {}; - clientExt1.chain.sType = WGPUSType_PrimitiveDepthClampingState; + WGPUPrimitiveDepthClipControl clientExt1 = {}; + clientExt1.chain.sType = WGPUSType_PrimitiveDepthClipControl; clientExt1.chain.next = &clientExt2.chain; - clientExt1.clampDepth = true; + clientExt1.unclippedDepth = true; WGPURenderPipelineDescriptor renderPipelineDesc = {}; renderPipelineDesc.vertex.module = shaderModule; @@ -211,10 +211,10 @@ TEST_F(WireExtensionTests, ValidAndInvalidSTypeInChain) { EXPECT_CALL(api, DeviceCreateRenderPipeline(apiDevice, NotNull())) .WillOnce(Invoke( [&](Unused, const WGPURenderPipelineDescriptor* serverDesc) -> WGPURenderPipeline { - const auto* ext = reinterpret_cast( + const auto* ext = reinterpret_cast( serverDesc->primitive.nextInChain); EXPECT_EQ(ext->chain.sType, clientExt1.chain.sType); - EXPECT_EQ(ext->clampDepth, true); + EXPECT_EQ(ext->unclippedDepth, true); EXPECT_EQ(ext->chain.next->sType, WGPUSType_Invalid); EXPECT_EQ(ext->chain.next->next, nullptr); @@ -233,10 +233,10 @@ TEST_F(WireExtensionTests, ValidAndInvalidSTypeInChain) { [&](Unused, const WGPURenderPipelineDescriptor* serverDesc) -> WGPURenderPipeline { EXPECT_EQ(serverDesc->primitive.nextInChain->sType, WGPUSType_Invalid); - const auto* ext = reinterpret_cast( + const auto* ext = reinterpret_cast( serverDesc->primitive.nextInChain->next); EXPECT_EQ(ext->chain.sType, clientExt1.chain.sType); - EXPECT_EQ(ext->clampDepth, true); + EXPECT_EQ(ext->unclippedDepth, true); EXPECT_EQ(ext->chain.next, nullptr); return api.GetNewRenderPipeline(); diff --git a/src/dawn/tests/unittests/wire/WireInjectInstanceTests.cpp b/src/dawn/tests/unittests/wire/WireInjectInstanceTests.cpp index f9fdc5280d..3f18faceb0 100644 --- a/src/dawn/tests/unittests/wire/WireInjectInstanceTests.cpp +++ b/src/dawn/tests/unittests/wire/WireInjectInstanceTests.cpp @@ -117,7 +117,5 @@ TEST_F(WireInjectInstanceTests, ReclaimInstanceReservation) { } } -// TODO(https://crbug.com/dawn/1381) Remove when namespaces are not indented. -// NOLINTNEXTLINE(readability/namespace) } // namespace } // namespace dawn::wire diff --git a/src/dawn/tests/unittests/wire/WireInjectTextureTests.cpp b/src/dawn/tests/unittests/wire/WireInjectTextureTests.cpp index baabaa5024..3438d9b3ab 100644 --- a/src/dawn/tests/unittests/wire/WireInjectTextureTests.cpp +++ b/src/dawn/tests/unittests/wire/WireInjectTextureTests.cpp @@ -26,12 +26,16 @@ class WireInjectTextureTests : public WireTest { public: WireInjectTextureTests() {} ~WireInjectTextureTests() override = default; + + // A placeholder texture format for ReserveTexture. The data in it doesn't matter as long as + // we don't call texture reflection methods. + WGPUTextureDescriptor placeholderDesc = {}; }; // Test that reserving and injecting a texture makes calls on the client object forward to the // server object correctly. TEST_F(WireInjectTextureTests, CallAfterReserveInject) { - ReservedTexture reservation = GetWireClient()->ReserveTexture(device); + ReservedTexture reservation = GetWireClient()->ReserveTexture(device, &placeholderDesc); WGPUTexture apiTexture = api.GetNewTexture(); EXPECT_CALL(api, TextureReference(apiTexture)); @@ -46,8 +50,8 @@ TEST_F(WireInjectTextureTests, CallAfterReserveInject) { // Test that reserve correctly returns different IDs each time. TEST_F(WireInjectTextureTests, ReserveDifferentIDs) { - ReservedTexture reservation1 = GetWireClient()->ReserveTexture(device); - ReservedTexture reservation2 = GetWireClient()->ReserveTexture(device); + ReservedTexture reservation1 = GetWireClient()->ReserveTexture(device, &placeholderDesc); + ReservedTexture reservation2 = GetWireClient()->ReserveTexture(device, &placeholderDesc); ASSERT_NE(reservation1.id, reservation2.id); ASSERT_NE(reservation1.texture, reservation2.texture); @@ -55,7 +59,7 @@ TEST_F(WireInjectTextureTests, ReserveDifferentIDs) { // Test that injecting the same id without a destroy first fails. TEST_F(WireInjectTextureTests, InjectExistingID) { - ReservedTexture reservation = GetWireClient()->ReserveTexture(device); + ReservedTexture reservation = GetWireClient()->ReserveTexture(device, &placeholderDesc); WGPUTexture apiTexture = api.GetNewTexture(); EXPECT_CALL(api, TextureReference(apiTexture)); @@ -70,7 +74,7 @@ TEST_F(WireInjectTextureTests, InjectExistingID) { // Test that the server only borrows the texture and does a single reference-release TEST_F(WireInjectTextureTests, InjectedTextureLifetime) { - ReservedTexture reservation = GetWireClient()->ReserveTexture(device); + ReservedTexture reservation = GetWireClient()->ReserveTexture(device, &placeholderDesc); // Injecting the texture adds a reference WGPUTexture apiTexture = api.GetNewTexture(); @@ -93,17 +97,17 @@ TEST_F(WireInjectTextureTests, InjectedTextureLifetime) { TEST_F(WireInjectTextureTests, ReclaimTextureReservation) { // Test that doing a reservation and full release is an error. { - ReservedTexture reservation = GetWireClient()->ReserveTexture(device); + ReservedTexture reservation = GetWireClient()->ReserveTexture(device, &placeholderDesc); wgpuTextureRelease(reservation.texture); FlushClient(false); } // Test that doing a reservation and then reclaiming it recycles the ID. { - ReservedTexture reservation1 = GetWireClient()->ReserveTexture(device); + ReservedTexture reservation1 = GetWireClient()->ReserveTexture(device, &placeholderDesc); GetWireClient()->ReclaimTextureReservation(reservation1); - ReservedTexture reservation2 = GetWireClient()->ReserveTexture(device); + ReservedTexture reservation2 = GetWireClient()->ReserveTexture(device, &placeholderDesc); // The ID is the same, but the generation is still different. ASSERT_EQ(reservation1.id, reservation2.id); @@ -114,4 +118,26 @@ TEST_F(WireInjectTextureTests, ReclaimTextureReservation) { } } +// Test the reflection of texture creation parameters for reserved textures. +TEST_F(WireInjectTextureTests, ReservedTextureReflection) { + WGPUTextureDescriptor desc = {}; + desc.size = {10, 11, 12}; + desc.format = WGPUTextureFormat_R32Float; + desc.dimension = WGPUTextureDimension_3D; + desc.mipLevelCount = 1000; + desc.sampleCount = 3; + desc.usage = WGPUTextureUsage_RenderAttachment; + + ReservedTexture reservation = GetWireClient()->ReserveTexture(device, &desc); + WGPUTexture texture = reservation.texture; + + ASSERT_EQ(desc.size.width, wgpuTextureGetWidth(texture)); + ASSERT_EQ(desc.size.height, wgpuTextureGetHeight(texture)); + ASSERT_EQ(desc.size.depthOrArrayLayers, wgpuTextureGetDepthOrArrayLayers(texture)); + ASSERT_EQ(desc.format, wgpuTextureGetFormat(texture)); + ASSERT_EQ(desc.dimension, wgpuTextureGetDimension(texture)); + ASSERT_EQ(desc.mipLevelCount, wgpuTextureGetMipLevelCount(texture)); + ASSERT_EQ(desc.sampleCount, wgpuTextureGetSampleCount(texture)); +} + } // namespace dawn::wire diff --git a/src/dawn/tests/unittests/wire/WireInstanceTests.cpp b/src/dawn/tests/unittests/wire/WireInstanceTests.cpp index 16dea28d35..029348b997 100644 --- a/src/dawn/tests/unittests/wire/WireInstanceTests.cpp +++ b/src/dawn/tests/unittests/wire/WireInstanceTests.cpp @@ -109,6 +109,8 @@ TEST_F(WireInstanceTests, RequestAdapterSuccess) { wgpu::AdapterProperties fakeProperties = {}; fakeProperties.vendorID = 0x134; + fakeProperties.vendorName = "fake-vendor"; + fakeProperties.architecture = "fake-architecture"; fakeProperties.deviceID = 0x918; fakeProperties.name = "fake adapter"; fakeProperties.driverDescription = "hello world"; @@ -161,6 +163,8 @@ TEST_F(WireInstanceTests, RequestAdapterSuccess) { wgpu::AdapterProperties properties; adapter.GetProperties(&properties); EXPECT_EQ(properties.vendorID, fakeProperties.vendorID); + EXPECT_STREQ(properties.vendorName, fakeProperties.vendorName); + EXPECT_STREQ(properties.architecture, fakeProperties.architecture); EXPECT_EQ(properties.deviceID, fakeProperties.deviceID); EXPECT_STREQ(properties.name, fakeProperties.name); EXPECT_STREQ(properties.driverDescription, fakeProperties.driverDescription); @@ -194,7 +198,7 @@ TEST_F(WireInstanceTests, RequestAdapterWireLacksFeatureSupport) { instance.RequestAdapter(&options, cb.Callback(), userdata); std::initializer_list fakeFeatures = { - wgpu::FeatureName::Depth24UnormStencil8, + wgpu::FeatureName::Depth32FloatStencil8, // Some value that is not a valid feature static_cast(-2), }; @@ -206,6 +210,8 @@ TEST_F(WireInstanceTests, RequestAdapterWireLacksFeatureSupport) { EXPECT_CALL(api, AdapterGetProperties(apiAdapter, NotNull())) .WillOnce(WithArg<1>(Invoke([&](WGPUAdapterProperties* properties) { *properties = {}; + properties->vendorName = ""; + properties->architecture = ""; properties->name = ""; properties->driverDescription = ""; }))); @@ -240,7 +246,7 @@ TEST_F(WireInstanceTests, RequestAdapterWireLacksFeatureSupport) { ASSERT_EQ(adapter.EnumerateFeatures(nullptr), 1u); adapter.EnumerateFeatures(&feature); - EXPECT_EQ(feature, wgpu::FeatureName::Depth24UnormStencil8); + EXPECT_EQ(feature, wgpu::FeatureName::Depth32FloatStencil8); }))); FlushServer(); } @@ -290,7 +296,5 @@ TEST_F(WireInstanceTests, RequestAdapterWireDisconnectBeforeCallback) { GetWireClient()->Disconnect(); } -// TODO(https://crbug.com/dawn/1381) Remove when namespaces are not indented. -// NOLINTNEXTLINE(readability/namespace) } // namespace } // namespace dawn::wire diff --git a/src/dawn/tests/unittests/wire/WireQueueTests.cpp b/src/dawn/tests/unittests/wire/WireQueueTests.cpp index 7e2d677c65..278a1716e1 100644 --- a/src/dawn/tests/unittests/wire/WireQueueTests.cpp +++ b/src/dawn/tests/unittests/wire/WireQueueTests.cpp @@ -139,6 +139,60 @@ TEST_F(WireQueueTests, OnSubmittedWorkDoneInsideCallbackBeforeDisconnect) { GetWireClient()->Disconnect(); } +// Test releasing the default queue, then its device. Both should be +// released when the device is released since the device holds a reference +// to the queue. Regresssion test for crbug.com/1332926. +TEST_F(WireQueueTests, DefaultQueueThenDeviceReleased) { + // Note: The test fixture gets the default queue. + + // Release the queue which is the last external client reference. + // The device still holds a reference. + wgpuQueueRelease(queue); + FlushClient(); + + // Release the device which holds an internal reference to the queue. + // Now, the queue and device should be released on the server. + wgpuDeviceRelease(device); + + EXPECT_CALL(api, QueueRelease(apiQueue)); + EXPECT_CALL(api, DeviceRelease(apiDevice)); + // These set X callback methods are called before the device is released. + EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, nullptr, nullptr)).Times(1); + EXPECT_CALL(api, OnDeviceSetLoggingCallback(apiDevice, nullptr, nullptr)).Times(1); + EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(apiDevice, nullptr, nullptr)).Times(1); + FlushClient(); + + // Indicate to the fixture that the device was already released. + DefaultApiDeviceWasReleased(); +} + +// Test the device, then its default queue. The default queue should be +// released when its external reference is dropped since releasing the device +// drops the internal reference. Regresssion test for crbug.com/1332926. +TEST_F(WireQueueTests, DeviceThenDefaultQueueReleased) { + // Note: The test fixture gets the default queue. + + // Release the device which holds an internal reference to the queue. + // Now, the should be released on the server, but not the queue since + // the default queue still has one external reference. + wgpuDeviceRelease(device); + + EXPECT_CALL(api, DeviceRelease(apiDevice)); + // These set X callback methods are called before the device is released. + EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, nullptr, nullptr)).Times(1); + EXPECT_CALL(api, OnDeviceSetLoggingCallback(apiDevice, nullptr, nullptr)).Times(1); + EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(apiDevice, nullptr, nullptr)).Times(1); + FlushClient(); + + // Release the external queue reference. The queue should be released. + wgpuQueueRelease(queue); + EXPECT_CALL(api, QueueRelease(apiQueue)); + FlushClient(); + + // Indicate to the fixture that the device was already released. + DefaultApiDeviceWasReleased(); +} + // Only one default queue is supported now so we cannot test ~Queue triggering ClearAllCallbacks // since it is always destructed after the test TearDown, and we cannot create a new queue obj // with wgpuDeviceGetQueue diff --git a/src/dawn/tests/unittests/wire/WireWGPUDevicePropertiesTests.cpp b/src/dawn/tests/unittests/wire/WireWGPUDevicePropertiesTests.cpp deleted file mode 100644 index eba7569ce1..0000000000 --- a/src/dawn/tests/unittests/wire/WireWGPUDevicePropertiesTests.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2019 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -#include "dawn/wire/Wire.h" -#include "gtest/gtest.h" - -class WireWGPUDevicePropertiesTests : public testing::Test {}; - -// Test that the serialization and deserialization of WGPUDeviceProperties can work correctly. -TEST_F(WireWGPUDevicePropertiesTests, SerializeWGPUDeviceProperties) { - WGPUDeviceProperties sentWGPUDeviceProperties = {}; - sentWGPUDeviceProperties.textureCompressionBC = true; - // Set false to test that the serialization can handle both true and false correctly. - sentWGPUDeviceProperties.pipelineStatisticsQuery = false; - sentWGPUDeviceProperties.timestampQuery = true; - - size_t sentWGPUDevicePropertiesSize = - dawn::wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties); - std::vector buffer; - buffer.resize(sentWGPUDevicePropertiesSize); - dawn::wire::SerializeWGPUDeviceProperties(&sentWGPUDeviceProperties, buffer.data()); - - WGPUDeviceProperties receivedWGPUDeviceProperties; - ASSERT_TRUE(dawn::wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties, - buffer.data(), buffer.size())); - ASSERT_TRUE(receivedWGPUDeviceProperties.textureCompressionBC); - ASSERT_FALSE(receivedWGPUDeviceProperties.pipelineStatisticsQuery); - ASSERT_TRUE(receivedWGPUDeviceProperties.timestampQuery); -} - -// Test that deserialization if the buffer is just one byte too small fails. -TEST_F(WireWGPUDevicePropertiesTests, DeserializeBufferTooSmall) { - WGPUDeviceProperties sentWGPUDeviceProperties = {}; - - size_t sentWGPUDevicePropertiesSize = - dawn::wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties); - std::vector buffer; - buffer.resize(sentWGPUDevicePropertiesSize); - dawn::wire::SerializeWGPUDeviceProperties(&sentWGPUDeviceProperties, buffer.data()); - - WGPUDeviceProperties receivedWGPUDeviceProperties; - ASSERT_FALSE(dawn::wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties, - buffer.data(), buffer.size() - 1)); -} diff --git a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp index 16f8c54e9b..7a89e17c22 100644 --- a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp +++ b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp @@ -44,7 +44,7 @@ class D3D12DescriptorHeapTests : public DawnTest { mSimpleVSModule = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main( + @vertex fn main( @builtin(vertex_index) VertexIndex : u32 ) -> @builtin(position) vec4 { var pos = array, 3>( @@ -61,7 +61,7 @@ class D3D12DescriptorHeapTests : public DawnTest { } @group(0) @binding(0) var colorBuffer : U; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return colorBuffer.color; })"); } @@ -176,13 +176,13 @@ TEST_P(D3D12DescriptorHeapTests, NoSwitchOverSamplerHeap) { // a sampler bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps WILL NOT switch over // because the sampler heap allocations are de-duplicated. renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main() -> @builtin(position) vec4 { + @vertex fn main() -> @builtin(position) vec4 { return vec4(0.0, 0.0, 0.0, 1.0); })"); renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var sampler0 : sampler; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { _ = sampler0; return vec4(0.0, 0.0, 0.0, 0.0); })"); @@ -453,7 +453,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBO) { } @group(0) @binding(0) var buffer0 : U; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return vec4(buffer0.heapSize, 0.0, 0.0, 1.0); })"); @@ -550,7 +550,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeUBOOverflowMultipleSubmit) { queue.Submit(1, &commands); } - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 0, 0); // Encode a heap worth of descriptors. { @@ -592,7 +592,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeUBOOverflowMultipleSubmit) { queue.Submit(1, &commands); } - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, renderPass.color, 0, 0); } // Verify encoding a heaps worth of bindgroups plus one more then reuse the first @@ -653,7 +653,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeReuseUBOOverflow) { queue.Submit(1, &commands); // Make sure the first bindgroup was encoded correctly. - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kRed, renderPass.color, 0, 0); } // Verify encoding a heaps worth of bindgroups plus one more in the first submit then reuse the @@ -735,7 +735,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeReuseUBOMultipleSubmits) { } // Make sure the first bindgroup was re-encoded correctly. - EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8::kGreen, renderPass.color, 0, 0); } // Verify encoding many sampler and ubo worth of bindgroups. @@ -773,7 +773,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { wgpu::CommandBuffer commandBuffer = encoder.Finish(); queue.Submit(1, &commandBuffer); - RGBA8 filled(0, 255, 0, 255); + utils::RGBA8 filled(0, 255, 0, 255); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, 0, 0); } @@ -786,7 +786,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { } @group(0) @binding(0) var buffer0 : U; - @stage(vertex) fn main( + @vertex fn main( @builtin(vertex_index) VertexIndex : u32 ) -> @builtin(position) vec4 { var pos = array, 3>( @@ -804,7 +804,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { @group(0) @binding(2) var texture0 : texture_2d; @group(0) @binding(3) var buffer0 : U; - @stage(fragment) fn main( + @fragment fn main( @builtin(position) FragCoord : vec4 ) -> @location(0) vec4 { return textureSample(texture0, sampler0, FragCoord.xy) + buffer0.color; @@ -884,8 +884,8 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { queue.Submit(1, &commands); // Final accumulated color is result of sampled + UBO color. - RGBA8 filled(255, 255, 0, 255); - RGBA8 notFilled(0, 0, 0, 0); + utils::RGBA8 filled(255, 255, 0, 255); + utils::RGBA8 notFilled(0, 0, 0, 0); EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, 0, 0); EXPECT_PIXEL_RGBA8_EQ(notFilled, renderPass.color, kRTSize - 1, 0); diff --git a/src/dawn/tests/white_box/D3D12ResidencyTests.cpp b/src/dawn/tests/white_box/D3D12ResidencyTests.cpp index 8bab67477c..6298d82f4e 100644 --- a/src/dawn/tests/white_box/D3D12ResidencyTests.cpp +++ b/src/dawn/tests/white_box/D3D12ResidencyTests.cpp @@ -341,7 +341,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) { // Fill in a view heap with "view only" bindgroups (1x view per group) by creating a // view bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps must switch over. renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) fn main( + @vertex fn main( @builtin(vertex_index) VertexIndex : u32 ) -> @builtin(position) vec4 { var pos = array, 3>( @@ -358,7 +358,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) { } @group(0) @binding(0) var colorBuffer : U; - @stage(fragment) fn main() -> @location(0) vec4 { + @fragment fn main() -> @location(0) vec4 { return colorBuffer.color; })"); diff --git a/src/dawn/tests/white_box/EGLImageWrappingTests.cpp b/src/dawn/tests/white_box/EGLImageWrappingTests.cpp index f20fda011d..3b2b97e061 100644 --- a/src/dawn/tests/white_box/EGLImageWrappingTests.cpp +++ b/src/dawn/tests/white_box/EGLImageWrappingTests.cpp @@ -29,8 +29,10 @@ namespace { class EGLFunctions { public: EGLFunctions() { -#ifdef DAWN_PLATFORM_WINDOWS +#if DAWN_PLATFORM_IS(WINDOWS) const char* eglLib = "libEGL.dll"; +#elif DAWN_PLATFORM_IS(MACOS) + const char* eglLib = "libEGL.dylib"; #else const char* eglLib = "libEGL.so"; #endif @@ -126,7 +128,7 @@ class EGLImageTestBase : public DawnTest { size_t size) { dawn::native::opengl::Device* openglDevice = dawn::native::opengl::ToBackend(dawn::native::FromAPI(device.Get())); - const dawn::native::opengl::OpenGLFunctions& gl = openglDevice->gl; + const dawn::native::opengl::OpenGLFunctions& gl = openglDevice->GetGL(); GLuint tex; gl.GenTextures(1, &tex); gl.BindTexture(GL_TEXTURE_2D, tex); @@ -298,7 +300,7 @@ class EGLImageUsageTests : public EGLImageTestBase { size_t dataSize) { dawn::native::opengl::Device* openglDevice = dawn::native::opengl::ToBackend(dawn::native::FromAPI(device.Get())); - const dawn::native::opengl::OpenGLFunctions& gl = openglDevice->gl; + const dawn::native::opengl::OpenGLFunctions& gl = openglDevice->GetGL(); // Get a texture view for the eglImage wgpu::TextureDescriptor textureDescriptor; diff --git a/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp b/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp index bf73bccb42..492ef1b92c 100644 --- a/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp +++ b/src/dawn/tests/white_box/InternalStorageBufferBindingTests.cpp @@ -38,7 +38,7 @@ class InternalStorageBufferBindingTests : public DawnTest { @group(0) @binding(0) var buf : Buf; - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { buf.data[GlobalInvocationID.x] = buf.data[GlobalInvocationID.x] + 0x1234u; } diff --git a/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp b/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp index ca8acb81ca..6747a0465a 100644 --- a/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp +++ b/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp @@ -110,7 +110,7 @@ class VulkanImageWrappingTestBase : public DawnTest { // assertion failure void IgnoreSignalSemaphore(wgpu::Texture wrappedTexture) { ExternalImageExportInfoVkForTesting exportInfo; - bool result = mBackend->ExportImage(wrappedTexture, VK_IMAGE_LAYOUT_GENERAL, &exportInfo); + bool result = mBackend->ExportImage(wrappedTexture, VK_IMAGE_LAYOUT_UNDEFINED, &exportInfo); ASSERT(result); } @@ -202,7 +202,7 @@ TEST_P(VulkanImageWrappingValidationTests, DoubleSignalSemaphoreExport) { ExternalImageExportInfoVkForTesting exportInfo; ASSERT_DEVICE_ERROR(bool success = - mBackend->ExportImage(texture, VK_IMAGE_LAYOUT_GENERAL, &exportInfo)); + mBackend->ExportImage(texture, VK_IMAGE_LAYOUT_UNDEFINED, &exportInfo)); ASSERT_FALSE(success); ASSERT_EQ(exportInfo.semaphores.size(), 0u); } @@ -214,7 +214,7 @@ TEST_P(VulkanImageWrappingValidationTests, NormalTextureSignalSemaphoreExport) { ExternalImageExportInfoVkForTesting exportInfo; ASSERT_DEVICE_ERROR(bool success = - mBackend->ExportImage(texture, VK_IMAGE_LAYOUT_GENERAL, &exportInfo)); + mBackend->ExportImage(texture, VK_IMAGE_LAYOUT_UNDEFINED, &exportInfo)); ASSERT_FALSE(success); ASSERT_EQ(exportInfo.semaphores.size(), 0u); } @@ -227,7 +227,7 @@ TEST_P(VulkanImageWrappingValidationTests, DestroyedTextureSignalSemaphoreExport ExternalImageExportInfoVkForTesting exportInfo; ASSERT_DEVICE_ERROR(bool success = - mBackend->ExportImage(texture, VK_IMAGE_LAYOUT_GENERAL, &exportInfo)); + mBackend->ExportImage(texture, VK_IMAGE_LAYOUT_UNDEFINED, &exportInfo)); ASSERT_FALSE(success); ASSERT_EQ(exportInfo.semaphores.size(), 0u); } @@ -322,7 +322,7 @@ TEST_P(VulkanImageWrappingUsageTests, ClearImageAcrossDevices) { exportInfo.releasedOldLayout, exportInfo.releasedNewLayout); // Verify |device| sees the changes from |secondDevice| - EXPECT_PIXEL_RGBA8_EQ(RGBA8(1, 2, 3, 4), nextWrappedTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(1, 2, 3, 4), nextWrappedTexture, 0, 0); IgnoreSignalSemaphore(nextWrappedTexture); } @@ -348,7 +348,7 @@ TEST_P(VulkanImageWrappingUsageTests, UninitializedTextureIsCleared) { exportInfo.releasedOldLayout, exportInfo.releasedNewLayout, false); // Verify |device| doesn't see the changes from |secondDevice| - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), nextWrappedTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 0, 0, 0), nextWrappedTexture, 0, 0); IgnoreSignalSemaphore(nextWrappedTexture); } @@ -382,7 +382,7 @@ TEST_P(VulkanImageWrappingUsageTests, CopyTextureToTextureSrcSync) { SimpleCopyTextureToTexture(device, queue, deviceWrappedTexture, copyDstTexture); // Verify |copyDstTexture| sees changes from |secondDevice| - EXPECT_PIXEL_RGBA8_EQ(RGBA8(1, 2, 3, 4), copyDstTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(1, 2, 3, 4), copyDstTexture, 0, 0); IgnoreSignalSemaphore(deviceWrappedTexture); } @@ -433,7 +433,7 @@ TEST_P(VulkanImageWrappingUsageTests, CopyTextureToTextureDstSync) { secondExportInfo.releasedOldLayout, secondExportInfo.releasedNewLayout); // Verify |nextWrappedTexture| contains the color from our copy - EXPECT_PIXEL_RGBA8_EQ(RGBA8(1, 2, 3, 4), nextWrappedTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(1, 2, 3, 4), nextWrappedTexture, 0, 0); IgnoreSignalSemaphore(nextWrappedTexture); } @@ -540,7 +540,7 @@ TEST_P(VulkanImageWrappingUsageTests, CopyBufferToTextureDstSync) { secondExportInfo.releasedOldLayout, secondExportInfo.releasedNewLayout); // Verify |nextWrappedTexture| contains the color from our copy - EXPECT_PIXEL_RGBA8_EQ(RGBA8(1, 2, 3, 4), nextWrappedTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(1, 2, 3, 4), nextWrappedTexture, 0, 0); IgnoreSignalSemaphore(nextWrappedTexture); } @@ -581,10 +581,10 @@ TEST_P(VulkanImageWrappingUsageTests, DoubleTextureUsage) { SimpleCopyTextureToTexture(device, queue, deviceWrappedTexture, secondCopyDstTexture); // Verify |copyDstTexture| sees changes from |secondDevice| - EXPECT_PIXEL_RGBA8_EQ(RGBA8(1, 2, 3, 4), copyDstTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(1, 2, 3, 4), copyDstTexture, 0, 0); // Verify |secondCopyDstTexture| sees changes from |secondDevice| - EXPECT_PIXEL_RGBA8_EQ(RGBA8(1, 2, 3, 4), secondCopyDstTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(1, 2, 3, 4), secondCopyDstTexture, 0, 0); IgnoreSignalSemaphore(deviceWrappedTexture); } @@ -669,7 +669,7 @@ TEST_P(VulkanImageWrappingUsageTests, ChainTextureCopy) { SimpleCopyTextureToTexture(device, queue, wrappedTexCDevice1, texD); // Verify D matches clear color - EXPECT_PIXEL_RGBA8_EQ(RGBA8(1, 2, 3, 4), texD, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(1, 2, 3, 4), texD, 0, 0); IgnoreSignalSemaphore(wrappedTexCDevice1); } @@ -793,24 +793,24 @@ TEST_P(VulkanImageWrappingUsageTests, SRGBReinterpretation) { wgpu::ImageCopyTexture dst = {}; dst.texture = texture; - std::array rgbaTextureData = { - RGBA8(180, 0, 0, 255), - RGBA8(0, 84, 0, 127), - RGBA8(0, 0, 62, 100), - RGBA8(62, 180, 84, 90), + std::array rgbaTextureData = { + utils::RGBA8(180, 0, 0, 255), + utils::RGBA8(0, 84, 0, 127), + utils::RGBA8(0, 0, 62, 100), + utils::RGBA8(62, 180, 84, 90), }; wgpu::TextureDataLayout dataLayout = {}; - dataLayout.bytesPerRow = textureDesc.size.width * sizeof(RGBA8); + dataLayout.bytesPerRow = textureDesc.size.width * sizeof(utils::RGBA8); - queue.WriteTexture(&dst, rgbaTextureData.data(), rgbaTextureData.size() * sizeof(RGBA8), + queue.WriteTexture(&dst, rgbaTextureData.data(), rgbaTextureData.size() * sizeof(utils::RGBA8), &dataLayout, &textureDesc.size); wgpu::TextureView textureView = texture.CreateView(&viewDesc); utils::ComboRenderPipelineDescriptor pipelineDesc; pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"( - @stage(vertex) + @vertex fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { var pos = array, 6>( vec2(-1.0, -1.0), @@ -825,7 +825,7 @@ TEST_P(VulkanImageWrappingUsageTests, SRGBReinterpretation) { pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"( @group(0) @binding(0) var texture : texture_2d; - @stage(fragment) + @fragment fn main(@builtin(position) coord: vec4) -> @location(0) vec4 { return textureLoad(texture, vec2(coord.xy), 0); } @@ -852,18 +852,18 @@ TEST_P(VulkanImageWrappingUsageTests, SRGBReinterpretation) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(116, 0, 0, 255), // - RGBA8(117, 0, 0, 255), renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(0, 23, 0, 127), // - RGBA8(0, 24, 0, 127), renderPass.color, 1, 0); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(0, 0, 12, 100), // - RGBA8(0, 0, 13, 100), renderPass.color, 0, 1); - EXPECT_PIXEL_RGBA8_BETWEEN( // - RGBA8(12, 116, 23, 90), // - RGBA8(13, 117, 24, 90), renderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(116, 0, 0, 255), // + utils::RGBA8(117, 0, 0, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(0, 23, 0, 127), // + utils::RGBA8(0, 24, 0, 127), renderPass.color, 1, 0); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(0, 0, 12, 100), // + utils::RGBA8(0, 0, 13, 100), renderPass.color, 0, 1); + EXPECT_PIXEL_RGBA8_BETWEEN( // + utils::RGBA8(12, 116, 23, 90), // + utils::RGBA8(13, 117, 24, 90), renderPass.color, 1, 1); IgnoreSignalSemaphore(texture); } diff --git a/src/dawn/tests/white_box/VulkanImageWrappingTests_DmaBuf.cpp b/src/dawn/tests/white_box/VulkanImageWrappingTests_DmaBuf.cpp index cccaadc533..adb03e764a 100644 --- a/src/dawn/tests/white_box/VulkanImageWrappingTests_DmaBuf.cpp +++ b/src/dawn/tests/white_box/VulkanImageWrappingTests_DmaBuf.cpp @@ -51,8 +51,12 @@ class ExternalSemaphoreDmaBuf : public VulkanImageWrappingTestBackend::ExternalS class ExternalTextureDmaBuf : public VulkanImageWrappingTestBackend::ExternalTexture { public: - ExternalTextureDmaBuf(gbm_bo* bo, int fd, uint32_t stride, uint64_t drmModifier) - : mGbmBo(bo), mFd(fd), stride(stride), drmModifier(drmModifier) {} + ExternalTextureDmaBuf( + gbm_bo* bo, + int fd, + std::array planeLayouts, + uint64_t drmModifier) + : mGbmBo(bo), mFd(fd), planeLayouts(planeLayouts), drmModifier(drmModifier) {} ~ExternalTextureDmaBuf() override { if (mFd != -1) { @@ -70,7 +74,7 @@ class ExternalTextureDmaBuf : public VulkanImageWrappingTestBackend::ExternalTex int mFd = -1; public: - const uint32_t stride; + const std::array planeLayouts; const uint64_t drmModifier; }; @@ -93,8 +97,13 @@ class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBacke gbm_bo* bo = CreateGbmBo(width, height, true); - return std::make_unique( - bo, gbm_bo_get_fd(bo), gbm_bo_get_stride_for_plane(bo, 0), gbm_bo_get_modifier(bo)); + std::array planeLayouts; + for (int plane = 0; plane < gbm_bo_get_plane_count(bo); ++plane) { + planeLayouts[plane].stride = gbm_bo_get_stride_for_plane(bo, plane); + planeLayouts[plane].offset = gbm_bo_get_offset(bo, plane); + } + return std::make_unique(bo, gbm_bo_get_fd(bo), planeLayouts, + gbm_bo_get_modifier(bo)); } wgpu::Texture WrapImage(const wgpu::Device& device, @@ -115,10 +124,11 @@ class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBacke descriptorDmaBuf.memoryFD = textureDmaBuf->Dup(); descriptorDmaBuf.waitFDs = std::move(waitFDs); - descriptorDmaBuf.stride = textureDmaBuf->stride; + descriptorDmaBuf.planeLayouts = textureDmaBuf->planeLayouts; descriptorDmaBuf.drmModifier = textureDmaBuf->drmModifier; - return dawn::native::vulkan::WrapVulkanImage(device.Get(), &descriptorDmaBuf); + return wgpu::Texture::Acquire( + dawn::native::vulkan::WrapVulkanImage(device.Get(), &descriptorDmaBuf)); } bool ExportImage(const wgpu::Texture& texture, @@ -153,8 +163,9 @@ class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBacke for (uint32_t i = kRenderNodeStart; i < kRenderNodeEnd; i++) { std::string renderNode = kRenderNodeTemplate + std::to_string(i); renderNodeFd = open(renderNode.c_str(), O_RDWR); - if (renderNodeFd >= 0) + if (renderNodeFd >= 0) { break; + } } EXPECT_GE(renderNodeFd, 0) << "Failed to get file descriptor for render node"; @@ -166,8 +177,9 @@ class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBacke private: gbm_bo* CreateGbmBo(uint32_t width, uint32_t height, bool linear) { uint32_t flags = GBM_BO_USE_RENDERING; - if (linear) + if (linear) { flags |= GBM_BO_USE_LINEAR; + } gbm_bo* gbmBo = gbm_bo_create(mGbmDevice, width, height, GBM_FORMAT_XBGR8888, flags); EXPECT_NE(gbmBo, nullptr) << "Failed to create GBM buffer object"; return gbmBo; diff --git a/src/dawn/tests/white_box/VulkanImageWrappingTests_OpaqueFD.cpp b/src/dawn/tests/white_box/VulkanImageWrappingTests_OpaqueFD.cpp index c92181ccfc..e8e8a59333 100644 --- a/src/dawn/tests/white_box/VulkanImageWrappingTests_OpaqueFD.cpp +++ b/src/dawn/tests/white_box/VulkanImageWrappingTests_OpaqueFD.cpp @@ -141,7 +141,8 @@ class VulkanImageWrappingTestBackendOpaqueFD : public VulkanImageWrappingTestBac descriptorOpaqueFD.memoryTypeIndex = textureOpaqueFD->memoryTypeIndex; descriptorOpaqueFD.waitFDs = std::move(waitFDs); - return dawn::native::vulkan::WrapVulkanImage(device.Get(), &descriptorOpaqueFD); + return wgpu::Texture::Acquire( + dawn::native::vulkan::WrapVulkanImage(device.Get(), &descriptorOpaqueFD)); } bool ExportImage(const wgpu::Texture& texture, diff --git a/src/dawn/utils/BUILD.gn b/src/dawn/utils/BUILD.gn index e281b41712..e74473dd25 100644 --- a/src/dawn/utils/BUILD.gn +++ b/src/dawn/utils/BUILD.gn @@ -16,48 +16,6 @@ import("../../../scripts/dawn_overrides_with_defaults.gni") import("${dawn_root}/scripts/dawn_features.gni") -############################################################################### -# GLFW wrapping target -############################################################################### - -# GLFW does not support ChromeOS, Android or Fuchsia, so provide a small mock -# library that can be linked into the Dawn tests on these platforms. Otherwise, -# use the real library from third_party/. -if (dawn_supports_glfw_for_windowing) { - group("glfw") { - public_deps = [ "${dawn_root}/third_party/gn/glfw" ] - } -} else if (is_fuchsia) { - # The mock implementation of GLFW on Fuchsia - config("glfw_public_config") { - # Allow inclusion of - include_dirs = [ "${dawn_glfw_dir}/include" ] - - # The GLFW/glfw3.h header includes by default, but the latter - # does not exist on Fuchsia. Defining GLFW_INCLUDE_NONE helps work around - # the issue, but it needs to be defined for any file that includes the - # header. - defines = [ - "GLFW_INCLUDE_NONE", - "GLFW_INCLUDE_VULKAN", - ] - } - - static_library("glfw") { - sources = [ - # NOTE: The header below is required to pass "gn check". - "${dawn_glfw_dir}/include/GLFW/glfw3.h", - "Glfw3Fuchsia.cpp", - ] - public_configs = [ ":glfw_public_config" ] - deps = [ "${dawn_root}/src/dawn/common" ] - } -} else { - # Just skip GLFW on other systems - group("glfw") { - } -} - ############################################################################### # Utils for tests and samples ############################################################################### @@ -121,19 +79,6 @@ static_library("utils") { sources += [ "ScopedAutoreleasePool.cpp" ] } - if (dawn_supports_glfw_for_windowing) { - sources += [ - "GLFWUtils.cpp", - "GLFWUtils.h", - ] - deps += [ ":glfw" ] - - if (dawn_enable_metal) { - sources += [ "GLFWUtils_metal.mm" ] - frameworks += [ "Metal.framework" ] - } - } - public_deps = [ "${dawn_root}/include/dawn:cpp_headers" ] } @@ -154,8 +99,8 @@ if (dawn_standalone) { public_deps = [ "${dawn_root}/include/dawn:headers" ] deps = [ - ":glfw", "${dawn_root}/src/dawn/common", + "${dawn_root}/src/dawn/glfw", "${dawn_root}/src/dawn/native", ] libs = [] diff --git a/src/dawn/utils/BackendBinding.cpp b/src/dawn/utils/BackendBinding.cpp index 17bea5f9ff..2aaa04798d 100644 --- a/src/dawn/utils/BackendBinding.cpp +++ b/src/dawn/utils/BackendBinding.cpp @@ -16,12 +16,6 @@ #include "dawn/common/Compiler.h" -#include "GLFW/glfw3.h" - -#if defined(DAWN_ENABLE_BACKEND_OPENGL) -#include "dawn/native/OpenGLBackend.h" -#endif // defined(DAWN_ENABLE_BACKEND_OPENGL) - namespace utils { #if defined(DAWN_ENABLE_BACKEND_D3D12) @@ -43,29 +37,6 @@ BackendBinding* CreateVulkanBinding(GLFWwindow* window, WGPUDevice device); BackendBinding::BackendBinding(GLFWwindow* window, WGPUDevice device) : mWindow(window), mDevice(device) {} -void DiscoverAdapter(dawn::native::Instance* instance, GLFWwindow* window, wgpu::BackendType type) { - DAWN_UNUSED(type); - DAWN_UNUSED(window); - - if (type == wgpu::BackendType::OpenGL || type == wgpu::BackendType::OpenGLES) { -#if defined(DAWN_ENABLE_BACKEND_OPENGL) - glfwMakeContextCurrent(window); - auto getProc = reinterpret_cast(glfwGetProcAddress); - if (type == wgpu::BackendType::OpenGL) { - dawn::native::opengl::AdapterDiscoveryOptions adapterOptions; - adapterOptions.getProc = getProc; - instance->DiscoverAdapters(&adapterOptions); - } else { - dawn::native::opengl::AdapterDiscoveryOptionsES adapterOptions; - adapterOptions.getProc = getProc; - instance->DiscoverAdapters(&adapterOptions); - } -#endif // defined(DAWN_ENABLE_BACKEND_OPENGL) - } else { - instance->DiscoverDefaultAdapters(); - } -} - BackendBinding* CreateBinding(wgpu::BackendType type, GLFWwindow* window, WGPUDevice device) { switch (type) { #if defined(DAWN_ENABLE_BACKEND_D3D12) diff --git a/src/dawn/utils/CMakeLists.txt b/src/dawn/utils/CMakeLists.txt index a05bcba97f..eddbbbec94 100644 --- a/src/dawn/utils/CMakeLists.txt +++ b/src/dawn/utils/CMakeLists.txt @@ -73,8 +73,6 @@ if(DAWN_SUPPORTS_GLFW_FOR_WINDOWING) target_sources(dawn_utils PRIVATE "BackendBinding.cpp" "BackendBinding.h" - "GLFWUtils.cpp" - "GLFWUtils.h" ) target_link_libraries(dawn_utils PRIVATE glfw) @@ -84,7 +82,6 @@ if(DAWN_SUPPORTS_GLFW_FOR_WINDOWING) if (DAWN_ENABLE_METAL) target_sources(dawn_utils PRIVATE - "GLFWUtils_metal.mm" "MetalBinding.mm" ) endif() diff --git a/src/dawn/utils/GLFWUtils.cpp b/src/dawn/utils/GLFWUtils.cpp deleted file mode 100644 index 5a1b4ba021..0000000000 --- a/src/dawn/utils/GLFWUtils.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2020 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include - -#include "GLFW/glfw3.h" -#include "dawn/common/Platform.h" -#include "dawn/utils/GLFWUtils.h" - -#if defined(DAWN_PLATFORM_WINDOWS) -#define GLFW_EXPOSE_NATIVE_WIN32 -#elif defined(DAWN_USE_X11) -#define GLFW_EXPOSE_NATIVE_X11 -#endif -#include "GLFW/glfw3native.h" - -namespace utils { - -void SetupGLFWWindowHintsForBackend(wgpu::BackendType type) { - if (type == wgpu::BackendType::OpenGL) { - // Ask for OpenGL 4.4 which is what the GL backend requires for compute shaders and - // texture views. - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - } else if (type == wgpu::BackendType::OpenGLES) { - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); - glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); - glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); - } else { - // Without this GLFW will initialize a GL context on the window, which prevents using - // the window with other APIs (by crashing in weird ways). - glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); - } -} - -wgpu::Surface CreateSurfaceForWindow(const wgpu::Instance& instance, GLFWwindow* window) { - std::unique_ptr chainedDescriptor = - SetupWindowAndGetSurfaceDescriptor(window); - - wgpu::SurfaceDescriptor descriptor; - descriptor.nextInChain = chainedDescriptor.get(); - wgpu::Surface surface = instance.CreateSurface(&descriptor); - - return surface; -} - -#if defined(DAWN_PLATFORM_WINDOWS) -std::unique_ptr SetupWindowAndGetSurfaceDescriptor(GLFWwindow* window) { - std::unique_ptr desc = - std::make_unique(); - desc->hwnd = glfwGetWin32Window(window); - desc->hinstance = GetModuleHandle(nullptr); - return std::move(desc); -} -#elif defined(DAWN_USE_X11) -std::unique_ptr SetupWindowAndGetSurfaceDescriptor(GLFWwindow* window) { - std::unique_ptr desc = - std::make_unique(); - desc->display = glfwGetX11Display(); - desc->window = glfwGetX11Window(window); - return std::move(desc); -} -#elif defined(DAWN_ENABLE_BACKEND_METAL) -// SetupWindowAndGetSurfaceDescriptor defined in GLFWUtils_metal.mm -#else -std::unique_ptr SetupWindowAndGetSurfaceDescriptor(GLFWwindow*) { - return nullptr; -} -#endif - -} // namespace utils diff --git a/src/dawn/utils/GLFWUtils.h b/src/dawn/utils/GLFWUtils.h deleted file mode 100644 index 2fe5b10ffd..0000000000 --- a/src/dawn/utils/GLFWUtils.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2020 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_DAWN_UTILS_GLFWUTILS_H_ -#define SRC_DAWN_UTILS_GLFWUTILS_H_ - -#include - -#include "dawn/webgpu_cpp.h" - -struct GLFWwindow; - -namespace utils { - -// Adds all the necessary glfwWindowHint calls for the next GLFWwindow created to be used with -// the specified backend. -void SetupGLFWWindowHintsForBackend(wgpu::BackendType type); - -// Does the necessary setup on the GLFWwindow to allow creating a wgpu::Surface with it and -// calls `instance.CreateSurface` with the correct descriptor for this window. -// Returns a null wgpu::Surface on failure. -wgpu::Surface CreateSurfaceForWindow(const wgpu::Instance& instance, GLFWwindow* window); - -// Use for testing only. Does everything that CreateSurfaceForWindow does except the call to -// CreateSurface. Useful to be able to modify the descriptor for testing, or when trying to -// avoid using the global proc table. -std::unique_ptr SetupWindowAndGetSurfaceDescriptor(GLFWwindow* window); - -} // namespace utils - -#endif // SRC_DAWN_UTILS_GLFWUTILS_H_ diff --git a/src/dawn/utils/GLFWUtils_metal.mm b/src/dawn/utils/GLFWUtils_metal.mm deleted file mode 100644 index 0762a3df78..0000000000 --- a/src/dawn/utils/GLFWUtils_metal.mm +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2020 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#if !defined(DAWN_ENABLE_BACKEND_METAL) -#error "GLFWUtils_metal.mm requires the Metal backend to be enabled." -#endif // !defined(DAWN_ENABLE_BACKEND_METAL) - -#include "dawn/utils/GLFWUtils.h" - -#import -#include "GLFW/glfw3.h" - -#include - -#define GLFW_EXPOSE_NATIVE_COCOA -#include "GLFW/glfw3native.h" - -namespace utils { - -std::unique_ptr SetupWindowAndGetSurfaceDescriptor(GLFWwindow* window) { - if (@available(macOS 10.11, *)) { - NSWindow* nsWindow = glfwGetCocoaWindow(window); - NSView* view = [nsWindow contentView]; - - // Create a CAMetalLayer that covers the whole window that will be passed to - // CreateSurface. - [view setWantsLayer:YES]; - [view setLayer:[CAMetalLayer layer]]; - - // Use retina if the window was created with retina support. - [[view layer] setContentsScale:[nsWindow backingScaleFactor]]; - - std::unique_ptr desc = - std::make_unique(); - desc->layer = [view layer]; - return std::move(desc); - } - - return nullptr; -} - -} // namespace utils diff --git a/src/dawn/utils/Glfw3Fuchsia.cpp b/src/dawn/utils/Glfw3Fuchsia.cpp deleted file mode 100644 index 198a5fd2ec..0000000000 --- a/src/dawn/utils/Glfw3Fuchsia.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2019 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// A mock GLFW implementation that supports Fuchsia, but only implements -// the functions called from Dawn. - -#include - -// NOTE: This must be included before GLFW/glfw3.h because the latter will -// include and "common/vulkan_platform.h" wants to be -// the first header to do so for validity reasons (e.g. undefining weird -// macros on Windows and Linux). -// clang-format off -#include "dawn/common/vulkan_platform.h" -#include "dawn/common/Assert.h" -#include "GLFW/glfw3.h" -// clang-format on - -int glfwInit(void) { - return GLFW_TRUE; -} - -void glfwDefaultWindowHints(void) {} - -void glfwWindowHint(int hint, int value) { - DAWN_UNUSED(hint); - DAWN_UNUSED(value); -} - -struct GLFWwindow { - PFN_vkGetInstanceProcAddr GetInstanceProcAddress = nullptr; - void* vulkan_loader = nullptr; - - GLFWwindow() { - vulkan_loader = ::dlopen("libvulkan.so", RTLD_NOW); - ASSERT(vulkan_loader != nullptr); - GetInstanceProcAddress = reinterpret_cast( - dlsym(vulkan_loader, "vkGetInstanceProcAddr")); - ASSERT(GetInstanceProcAddress != nullptr); - } - - ~GLFWwindow() { - if (vulkan_loader) { - ::dlclose(vulkan_loader); - } - vulkan_loader = nullptr; - } -}; - -GLFWwindow* glfwCreateWindow(int width, - int height, - const char* title, - GLFWmonitor* monitor, - GLFWwindow* share) { - ASSERT(monitor == nullptr); - ASSERT(share == nullptr); - DAWN_UNUSED(width); - DAWN_UNUSED(height); - DAWN_UNUSED(title); - return new GLFWwindow(); -} - -VkResult glfwCreateWindowSurface(VkInstance instance, - GLFWwindow* window, - const VkAllocationCallbacks* allocator, - VkSurfaceKHR* surface) { - // IMPORTANT: This assumes that the VkInstance was created with a Fuchsia - // swapchain layer enabled, as well as the corresponding extension that - // is queried here to perform the surface creation. Dawn should do all - // required steps in VulkanInfo.cpp, VulkanFunctions.cpp and BackendVk.cpp. - - auto vkCreateImagePipeSurfaceFUCHSIA = reinterpret_cast( - window->GetInstanceProcAddress(instance, "vkCreateImagePipeSurfaceFUCHSIA")); - ASSERT(vkCreateImagePipeSurfaceFUCHSIA != nullptr); - if (!vkCreateImagePipeSurfaceFUCHSIA) { - *surface = VK_NULL_HANDLE; - return VK_ERROR_FEATURE_NOT_PRESENT; - } - - const struct VkImagePipeSurfaceCreateInfoFUCHSIA create_info = { - VK_STRUCTURE_TYPE_IMAGEPIPE_SURFACE_CREATE_INFO_FUCHSIA, - nullptr, // pNext - 0, // flags, ignored for now - ZX_HANDLE_INVALID, // imagePipeHandle, a null handle matches the framebuffer. - }; - - return vkCreateImagePipeSurfaceFUCHSIA(instance, &create_info, nullptr, surface); -} diff --git a/src/dawn/utils/SystemUtils.cpp b/src/dawn/utils/SystemUtils.cpp index a286b2227e..693a6ceb10 100644 --- a/src/dawn/utils/SystemUtils.cpp +++ b/src/dawn/utils/SystemUtils.cpp @@ -16,9 +16,9 @@ #include "dawn/common/Platform.h" -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) #include -#elif defined(DAWN_PLATFORM_POSIX) +#elif DAWN_PLATFORM_IS(POSIX) #include #else #error "Unsupported platform." @@ -26,11 +26,11 @@ namespace utils { -#if defined(DAWN_PLATFORM_WINDOWS) +#if DAWN_PLATFORM_IS(WINDOWS) void USleep(unsigned int usecs) { Sleep(static_cast(usecs / 1000)); } -#elif defined(DAWN_PLATFORM_POSIX) +#elif DAWN_PLATFORM_IS(POSIX) void USleep(unsigned int usecs) { usleep(usecs); } diff --git a/src/dawn/utils/TestUtils.cpp b/src/dawn/utils/TestUtils.cpp index e5b41cf0a9..3216402abf 100644 --- a/src/dawn/utils/TestUtils.cpp +++ b/src/dawn/utils/TestUtils.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include #include "dawn/common/Assert.h" @@ -24,6 +25,19 @@ namespace utils { +const RGBA8 RGBA8::kZero = RGBA8(0, 0, 0, 0); +const RGBA8 RGBA8::kBlack = RGBA8(0, 0, 0, 255); +const RGBA8 RGBA8::kRed = RGBA8(255, 0, 0, 255); +const RGBA8 RGBA8::kGreen = RGBA8(0, 255, 0, 255); +const RGBA8 RGBA8::kBlue = RGBA8(0, 0, 255, 255); +const RGBA8 RGBA8::kYellow = RGBA8(255, 255, 0, 255); +const RGBA8 RGBA8::kWhite = RGBA8(255, 255, 255, 255); + +std::ostream& operator<<(std::ostream& stream, const RGBA8& color) { + return stream << "RGBA8(" << static_cast(color.r) << ", " << static_cast(color.g) + << ", " << static_cast(color.b) << ", " << static_cast(color.a) << ")"; +} + uint32_t GetMinimumBytesPerRow(wgpu::TextureFormat format, uint32_t width) { const uint32_t bytesPerBlock = utils::GetTexelBlockSizeInBytes(format); const uint32_t blockWidth = utils::GetTextureFormatBlockWidth(format); diff --git a/src/dawn/utils/TestUtils.h b/src/dawn/utils/TestUtils.h index 5e119cf38f..fa7865d900 100644 --- a/src/dawn/utils/TestUtils.h +++ b/src/dawn/utils/TestUtils.h @@ -19,6 +19,26 @@ namespace utils { +struct RGBA8 { + constexpr RGBA8() : RGBA8(0, 0, 0, 0) {} + constexpr RGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a) : r(r), g(g), b(b), a(a) {} + bool operator==(const RGBA8& other) const; + bool operator!=(const RGBA8& other) const; + bool operator<=(const RGBA8& other) const; + bool operator>=(const RGBA8& other) const; + + uint8_t r, g, b, a; + + static const RGBA8 kZero; + static const RGBA8 kBlack; + static const RGBA8 kRed; + static const RGBA8 kGreen; + static const RGBA8 kBlue; + static const RGBA8 kYellow; + static const RGBA8 kWhite; +}; +std::ostream& operator<<(std::ostream& stream, const RGBA8& color); + struct TextureDataCopyLayout { uint64_t byteLength; uint64_t texelBlockCount; diff --git a/src/dawn/utils/TextureUtils.cpp b/src/dawn/utils/TextureUtils.cpp index f0c4505e6c..b630a0c0e7 100644 --- a/src/dawn/utils/TextureUtils.cpp +++ b/src/dawn/utils/TextureUtils.cpp @@ -130,6 +130,20 @@ bool IsDepthOnlyFormat(wgpu::TextureFormat textureFormat) { } } +bool IsDepthOrStencilFormat(wgpu::TextureFormat textureFormat) { + switch (textureFormat) { + case wgpu::TextureFormat::Depth16Unorm: + case wgpu::TextureFormat::Depth24Plus: + case wgpu::TextureFormat::Depth32Float: + case wgpu::TextureFormat::Depth24PlusStencil8: + case wgpu::TextureFormat::Depth32FloatStencil8: + case wgpu::TextureFormat::Stencil8: + return true; + default: + return false; + } +} + bool TextureFormatSupportsMultisampling(wgpu::TextureFormat textureFormat) { if (IsBCTextureFormat(textureFormat) || IsETC2TextureFormat(textureFormat) || IsASTCTextureFormat(textureFormat)) { @@ -157,45 +171,6 @@ bool TextureFormatSupportsMultisampling(wgpu::TextureFormat textureFormat) { } } -bool TextureFormatSupportsRendering(wgpu::TextureFormat textureFormat) { - switch (textureFormat) { - case wgpu::TextureFormat::R8Unorm: - case wgpu::TextureFormat::R8Uint: - case wgpu::TextureFormat::R8Sint: - case wgpu::TextureFormat::RG8Unorm: - case wgpu::TextureFormat::RG8Uint: - case wgpu::TextureFormat::RG8Sint: - case wgpu::TextureFormat::RGBA8Unorm: - case wgpu::TextureFormat::RGBA8Uint: - case wgpu::TextureFormat::RGBA8Sint: - case wgpu::TextureFormat::BGRA8Unorm: - case wgpu::TextureFormat::BGRA8UnormSrgb: - case wgpu::TextureFormat::R16Uint: - case wgpu::TextureFormat::R16Sint: - case wgpu::TextureFormat::R16Float: - case wgpu::TextureFormat::RG16Uint: - case wgpu::TextureFormat::RG16Sint: - case wgpu::TextureFormat::RG16Float: - case wgpu::TextureFormat::RGBA16Uint: - case wgpu::TextureFormat::RGBA16Sint: - case wgpu::TextureFormat::RGBA16Float: - case wgpu::TextureFormat::R32Uint: - case wgpu::TextureFormat::R32Sint: - case wgpu::TextureFormat::R32Float: - case wgpu::TextureFormat::RG32Uint: - case wgpu::TextureFormat::RG32Sint: - case wgpu::TextureFormat::RG32Float: - case wgpu::TextureFormat::RGBA32Uint: - case wgpu::TextureFormat::RGBA32Sint: - case wgpu::TextureFormat::RGBA32Float: - case wgpu::TextureFormat::RGB10A2Unorm: - return true; - - default: - return false; - } -} - bool TextureFormatSupportsResolveTarget(wgpu::TextureFormat textureFormat) { switch (textureFormat) { case wgpu::TextureFormat::R8Unorm: @@ -272,7 +247,6 @@ uint32_t GetTexelBlockSizeInBytes(wgpu::TextureFormat textureFormat) { return 2u; case wgpu::TextureFormat::Depth24Plus: - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth32Float: return 4u; @@ -392,7 +366,6 @@ uint32_t GetTextureFormatBlockWidth(wgpu::TextureFormat textureFormat) { case wgpu::TextureFormat::Depth24Plus: case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth16Unorm: - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: case wgpu::TextureFormat::Stencil8: return 1u; @@ -509,7 +482,6 @@ uint32_t GetTextureFormatBlockHeight(wgpu::TextureFormat textureFormat) { case wgpu::TextureFormat::Depth24Plus: case wgpu::TextureFormat::Depth24PlusStencil8: case wgpu::TextureFormat::Depth16Unorm: - case wgpu::TextureFormat::Depth24UnormStencil8: case wgpu::TextureFormat::Depth32FloatStencil8: case wgpu::TextureFormat::Stencil8: return 1u; diff --git a/src/dawn/utils/TextureUtils.h b/src/dawn/utils/TextureUtils.h index f92b19b518..964df10023 100644 --- a/src/dawn/utils/TextureUtils.h +++ b/src/dawn/utils/TextureUtils.h @@ -22,7 +22,7 @@ #include "dawn/common/Assert.h" namespace utils { -static constexpr std::array kAllTextureFormats = { +static constexpr std::array kAllTextureFormats = { wgpu::TextureFormat::R8Unorm, wgpu::TextureFormat::R8Snorm, wgpu::TextureFormat::R8Uint, @@ -63,7 +63,6 @@ static constexpr std::array kAllTextureFormats = { wgpu::TextureFormat::Depth32Float, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureFormat::Stencil8, wgpu::TextureFormat::BC1RGBAUnorm, @@ -206,20 +205,18 @@ static_assert(kCompressedFormats.size() == kBCFormats.size() + kETC2Formats.size() + kASTCFormats.size(), "Number of compressed format must equal number of BC, ETC2, and ASTC formats."); -static constexpr std::array kDepthFormats = { +static constexpr std::array kDepthFormats = { wgpu::TextureFormat::Depth16Unorm, wgpu::TextureFormat::Depth32Float, wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8, wgpu::TextureFormat::Depth32FloatStencil8, + wgpu::TextureFormat::Depth32FloatStencil8, }; -static constexpr std::array kStencilFormats = { +static constexpr std::array kStencilFormats = { wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8, wgpu::TextureFormat::Depth32FloatStencil8, wgpu::TextureFormat::Stencil8, }; -static constexpr std::array kDepthAndStencilFormats = { +static constexpr std::array kDepthAndStencilFormats = { wgpu::TextureFormat::Depth24PlusStencil8, - wgpu::TextureFormat::Depth24UnormStencil8, wgpu::TextureFormat::Depth32FloatStencil8, }; @@ -231,10 +228,10 @@ bool IsASTCTextureFormat(wgpu::TextureFormat textureFormat); bool IsDepthOnlyFormat(wgpu::TextureFormat textureFormat); bool IsStencilOnlyFormat(wgpu::TextureFormat textureFormat); +bool IsDepthOrStencilFormat(wgpu::TextureFormat textureFormat); bool TextureFormatSupportsMultisampling(wgpu::TextureFormat textureFormat); bool TextureFormatSupportsResolveTarget(wgpu::TextureFormat textureFormat); -bool TextureFormatSupportsRendering(wgpu::TextureFormat textureFormat); uint32_t GetTexelBlockSizeInBytes(wgpu::TextureFormat textureFormat); uint32_t GetTextureFormatBlockWidth(wgpu::TextureFormat textureFormat); diff --git a/src/dawn/utils/WGPUHelpers.cpp b/src/dawn/utils/WGPUHelpers.cpp index e2126f006c..dda2cabe2b 100644 --- a/src/dawn/utils/WGPUHelpers.cpp +++ b/src/dawn/utils/WGPUHelpers.cpp @@ -118,6 +118,8 @@ ComboRenderPassDescriptor::ComboRenderPassDescriptor( } } +ComboRenderPassDescriptor::~ComboRenderPassDescriptor() = default; + ComboRenderPassDescriptor::ComboRenderPassDescriptor(const ComboRenderPassDescriptor& other) { *this = other; } @@ -349,6 +351,11 @@ BindingInitializationHelper::BindingInitializationHelper(uint32_t binding, uint64_t size) : binding(binding), buffer(buffer), offset(offset), size(size) {} +BindingInitializationHelper::BindingInitializationHelper(const BindingInitializationHelper&) = + default; + +BindingInitializationHelper::~BindingInitializationHelper() = default; + wgpu::BindGroupEntry BindingInitializationHelper::GetAsBinding() const { wgpu::BindGroupEntry result; diff --git a/src/dawn/utils/WGPUHelpers.h b/src/dawn/utils/WGPUHelpers.h index fb6ddd5c48..24864e6265 100644 --- a/src/dawn/utils/WGPUHelpers.h +++ b/src/dawn/utils/WGPUHelpers.h @@ -59,6 +59,7 @@ struct ComboRenderPassDescriptor : public wgpu::RenderPassDescriptor { public: ComboRenderPassDescriptor(std::initializer_list colorAttachmentInfo, wgpu::TextureView depthStencil = wgpu::TextureView()); + ~ComboRenderPassDescriptor(); ComboRenderPassDescriptor(const ComboRenderPassDescriptor& otherRenderPass); const ComboRenderPassDescriptor& operator=(const ComboRenderPassDescriptor& otherRenderPass); @@ -158,6 +159,8 @@ struct BindingInitializationHelper { const wgpu::Buffer& buffer, uint64_t offset = 0, uint64_t size = wgpu::kWholeSize); + BindingInitializationHelper(const BindingInitializationHelper&); + ~BindingInitializationHelper(); wgpu::BindGroupEntry GetAsBinding() const; diff --git a/src/dawn/utils/WireHelper.cpp b/src/dawn/utils/WireHelper.cpp index c00006f3ad..609e8ff9d3 100644 --- a/src/dawn/utils/WireHelper.cpp +++ b/src/dawn/utils/WireHelper.cpp @@ -78,11 +78,11 @@ class WireServerTraceLayer : public dawn::wire::CommandHandler { class WireHelperDirect : public WireHelper { public: - WireHelperDirect() { dawnProcSetProcs(&dawn::native::GetProcs()); } + explicit WireHelperDirect(const DawnProcTable& procs) { dawnProcSetProcs(&procs); } - std::pair RegisterDevice(WGPUDevice backendDevice) override { - ASSERT(backendDevice != nullptr); - return std::make_pair(wgpu::Device::Acquire(backendDevice), backendDevice); + wgpu::Instance RegisterInstance(WGPUInstance backendInstance) override { + ASSERT(backendInstance != nullptr); + return wgpu::Instance(backendInstance); } void BeginWireTrace(const char* name) override {} @@ -94,12 +94,12 @@ class WireHelperDirect : public WireHelper { class WireHelperProxy : public WireHelper { public: - explicit WireHelperProxy(const char* wireTraceDir) { + explicit WireHelperProxy(const char* wireTraceDir, const DawnProcTable& procs) { mC2sBuf = std::make_unique(); mS2cBuf = std::make_unique(); dawn::wire::WireServerDescriptor serverDesc = {}; - serverDesc.procs = &dawn::native::GetProcs(); + serverDesc.procs = &procs; serverDesc.serializer = mS2cBuf.get(); mWireServer.reset(new dawn::wire::WireServer(serverDesc)); @@ -118,14 +118,13 @@ class WireHelperProxy : public WireHelper { dawnProcSetProcs(&dawn::wire::client::GetProcs()); } - std::pair RegisterDevice(WGPUDevice backendDevice) override { - ASSERT(backendDevice != nullptr); + wgpu::Instance RegisterInstance(WGPUInstance backendInstance) override { + ASSERT(backendInstance != nullptr); - auto reservation = mWireClient->ReserveDevice(); - mWireServer->InjectDevice(backendDevice, reservation.id, reservation.generation); - dawn::native::GetProcs().deviceRelease(backendDevice); + auto reservation = mWireClient->ReserveInstance(); + mWireServer->InjectInstance(backendInstance, reservation.id, reservation.generation); - return std::make_pair(wgpu::Device::Acquire(reservation.device), backendDevice); + return wgpu::Instance::Acquire(reservation.instance); } void BeginWireTrace(const char* name) override { @@ -148,11 +147,13 @@ class WireHelperProxy : public WireHelper { } // anonymous namespace -std::unique_ptr CreateWireHelper(bool useWire, const char* wireTraceDir) { +std::unique_ptr CreateWireHelper(const DawnProcTable& procs, + bool useWire, + const char* wireTraceDir) { if (useWire) { - return std::unique_ptr(new WireHelperProxy(wireTraceDir)); + return std::unique_ptr(new WireHelperProxy(wireTraceDir, procs)); } else { - return std::unique_ptr(new WireHelperDirect()); + return std::unique_ptr(new WireHelperDirect(procs)); } } diff --git a/src/dawn/utils/WireHelper.h b/src/dawn/utils/WireHelper.h index 73c45ad679..3f52938532 100644 --- a/src/dawn/utils/WireHelper.h +++ b/src/dawn/utils/WireHelper.h @@ -21,16 +21,19 @@ #include "dawn/webgpu_cpp.h" +struct DawnProcTable; + namespace utils { class WireHelper { public: virtual ~WireHelper(); - // Registers the device on the wire, if present. - // Returns a pair of the client device and backend device. - // The function should take ownership of |backendDevice|. - virtual std::pair RegisterDevice(WGPUDevice backendDevice) = 0; + // Registers the instance on the wire, if present. + // Returns the wgpu::Instance which is the client instance on the wire, and + // the backend instance without the wire. + // The function should not take ownership of |backendInstance|. + virtual wgpu::Instance RegisterInstance(WGPUInstance backendInstance) = 0; virtual void BeginWireTrace(const char* name) = 0; @@ -38,7 +41,9 @@ class WireHelper { virtual bool FlushServer() = 0; }; -std::unique_ptr CreateWireHelper(bool useWire, const char* wireTraceDir = nullptr); +std::unique_ptr CreateWireHelper(const DawnProcTable& procs, + bool useWire, + const char* wireTraceDir = nullptr); } // namespace utils diff --git a/src/dawn/wire/BUILD.gn b/src/dawn/wire/BUILD.gn index bff2136e0f..56aa038879 100644 --- a/src/dawn/wire/BUILD.gn +++ b/src/dawn/wire/BUILD.gn @@ -65,6 +65,8 @@ dawn_component("wire") { "ChunkedCommandHandler.h", "ChunkedCommandSerializer.cpp", "ChunkedCommandSerializer.h", + "ObjectHandle.cpp", + "ObjectHandle.h", "SupportedFeatures.cpp", "SupportedFeatures.h", "Wire.cpp", @@ -88,12 +90,19 @@ dawn_component("wire") { "client/Instance.h", "client/LimitsAndFeatures.cpp", "client/LimitsAndFeatures.h", - "client/ObjectAllocator.h", + "client/ObjectBase.cpp", + "client/ObjectBase.h", + "client/ObjectStore.cpp", + "client/ObjectStore.h", + "client/QuerySet.cpp", + "client/QuerySet.h", "client/Queue.cpp", "client/Queue.h", "client/RequestTracker.h", "client/ShaderModule.cpp", "client/ShaderModule.h", + "client/Texture.cpp", + "client/Texture.h", "server/ObjectStorage.h", "server/Server.cpp", "server/Server.h", diff --git a/src/dawn/wire/CMakeLists.txt b/src/dawn/wire/CMakeLists.txt index bce614cded..c470cea071 100644 --- a/src/dawn/wire/CMakeLists.txt +++ b/src/dawn/wire/CMakeLists.txt @@ -38,6 +38,8 @@ target_sources(dawn_wire PRIVATE "ChunkedCommandHandler.h" "ChunkedCommandSerializer.cpp" "ChunkedCommandSerializer.h" + "ObjectHandle.cpp" + "ObjectHandle.h" "SupportedFeatures.cpp" "SupportedFeatures.h" "Wire.cpp" @@ -61,12 +63,19 @@ target_sources(dawn_wire PRIVATE "client/Instance.h" "client/LimitsAndFeatures.cpp" "client/LimitsAndFeatures.h" - "client/ObjectAllocator.h" + "client/ObjectStore.cpp" + "client/ObjectStore.h" + "client/ObjectBase.cpp" + "client/ObjectBase.h" + "client/QuerySet.cpp" + "client/QuerySet.h" "client/Queue.cpp" "client/Queue.h" "client/RequestTracker.h" "client/ShaderModule.cpp" "client/ShaderModule.h" + "client/Texture.cpp" + "client/Texture.h" "server/ObjectStorage.h" "server/Server.cpp" "server/Server.h" diff --git a/src/dawn/wire/ChunkedCommandHandler.cpp b/src/dawn/wire/ChunkedCommandHandler.cpp index 9c3dc0eaa1..7dd1075ead 100644 --- a/src/dawn/wire/ChunkedCommandHandler.cpp +++ b/src/dawn/wire/ChunkedCommandHandler.cpp @@ -22,6 +22,8 @@ namespace dawn::wire { +ChunkedCommandHandler::ChunkedCommandHandler() = default; + ChunkedCommandHandler::~ChunkedCommandHandler() = default; const volatile char* ChunkedCommandHandler::HandleCommands(const volatile char* commands, diff --git a/src/dawn/wire/ChunkedCommandHandler.h b/src/dawn/wire/ChunkedCommandHandler.h index c84c4ef8a9..713ed38c14 100644 --- a/src/dawn/wire/ChunkedCommandHandler.h +++ b/src/dawn/wire/ChunkedCommandHandler.h @@ -27,9 +27,11 @@ namespace dawn::wire { class ChunkedCommandHandler : public CommandHandler { public: - const volatile char* HandleCommands(const volatile char* commands, size_t size) override; + ChunkedCommandHandler(); ~ChunkedCommandHandler() override; + const volatile char* HandleCommands(const volatile char* commands, size_t size) override; + protected: enum class ChunkedCommandsResult { Passthrough, diff --git a/src/dawn/wire/ObjectHandle.cpp b/src/dawn/wire/ObjectHandle.cpp new file mode 100644 index 0000000000..62d9f80f8d --- /dev/null +++ b/src/dawn/wire/ObjectHandle.cpp @@ -0,0 +1,44 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/wire/ObjectHandle.h" + +namespace dawn::wire { + +ObjectHandle::ObjectHandle() = default; +ObjectHandle::ObjectHandle(ObjectId id, ObjectGeneration generation) + : id(id), generation(generation) {} + +ObjectHandle::ObjectHandle(const volatile ObjectHandle& rhs) + : id(rhs.id), generation(rhs.generation) {} +ObjectHandle& ObjectHandle::operator=(const volatile ObjectHandle& rhs) { + id = rhs.id; + generation = rhs.generation; + return *this; +} + +ObjectHandle::ObjectHandle(const ObjectHandle& rhs) = default; +ObjectHandle& ObjectHandle::operator=(const ObjectHandle& rhs) = default; + +ObjectHandle& ObjectHandle::AssignFrom(const ObjectHandle& rhs) { + id = rhs.id; + generation = rhs.generation; + return *this; +} +ObjectHandle& ObjectHandle::AssignFrom(const volatile ObjectHandle& rhs) { + id = rhs.id; + generation = rhs.generation; + return *this; +} +} // namespace dawn::wire diff --git a/src/dawn/wire/ObjectHandle.h b/src/dawn/wire/ObjectHandle.h new file mode 100644 index 0000000000..3e6cf64e7c --- /dev/null +++ b/src/dawn/wire/ObjectHandle.h @@ -0,0 +1,49 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef DAWN_WIRE_OBJECTHANDLE_H_ +#define DAWN_WIRE_OBJECTHANDLE_H_ + +#include + +namespace dawn::wire { + +using ObjectId = uint32_t; +using ObjectGeneration = uint32_t; +struct ObjectHandle { + ObjectId id; + ObjectGeneration generation; + + ObjectHandle(); + ObjectHandle(ObjectId id, ObjectGeneration generation); + + explicit ObjectHandle(const volatile ObjectHandle& rhs); + ObjectHandle& operator=(const volatile ObjectHandle& rhs); + + ObjectHandle(const ObjectHandle& rhs); + ObjectHandle& operator=(const ObjectHandle& rhs); + + // MSVC has a bug where it thinks the volatile copy assignment is a duplicate. + // Workaround this by forwarding to a different function AssignFrom. + template + ObjectHandle& operator=(const T& rhs) { + return AssignFrom(rhs); + } + ObjectHandle& AssignFrom(const ObjectHandle& rhs); + ObjectHandle& AssignFrom(const volatile ObjectHandle& rhs); +}; + +} // namespace dawn::wire + +#endif // DAWN_WIRE_OBJECTHANDLE_H_ diff --git a/src/dawn/wire/SupportedFeatures.cpp b/src/dawn/wire/SupportedFeatures.cpp index 8dd6d5836c..aca064fa9c 100644 --- a/src/dawn/wire/SupportedFeatures.cpp +++ b/src/dawn/wire/SupportedFeatures.cpp @@ -24,7 +24,6 @@ bool IsFeatureSupported(WGPUFeatureName feature) { case WGPUFeatureName_Force32: case WGPUFeatureName_DawnNative: return false; - case WGPUFeatureName_Depth24UnormStencil8: case WGPUFeatureName_Depth32FloatStencil8: case WGPUFeatureName_TimestampQuery: case WGPUFeatureName_PipelineStatisticsQuery: @@ -32,10 +31,11 @@ bool IsFeatureSupported(WGPUFeatureName feature) { case WGPUFeatureName_TextureCompressionETC2: case WGPUFeatureName_TextureCompressionASTC: case WGPUFeatureName_IndirectFirstInstance: - case WGPUFeatureName_DepthClamping: + case WGPUFeatureName_DepthClipControl: case WGPUFeatureName_DawnShaderFloat16: case WGPUFeatureName_DawnInternalUsages: case WGPUFeatureName_DawnMultiPlanarFormats: + case WGPUFeatureName_ChromiumExperimentalDp4a: return true; } diff --git a/src/dawn/wire/WireClient.cpp b/src/dawn/wire/WireClient.cpp index 624cc032d8..9845b3844f 100644 --- a/src/dawn/wire/WireClient.cpp +++ b/src/dawn/wire/WireClient.cpp @@ -28,8 +28,9 @@ const volatile char* WireClient::HandleCommands(const volatile char* commands, s return mImpl->HandleCommands(commands, size); } -ReservedTexture WireClient::ReserveTexture(WGPUDevice device) { - return mImpl->ReserveTexture(device); +ReservedTexture WireClient::ReserveTexture(WGPUDevice device, + const WGPUTextureDescriptor* descriptor) { + return mImpl->ReserveTexture(device, descriptor); } ReservedSwapChain WireClient::ReserveSwapChain(WGPUDevice device) { diff --git a/src/dawn/wire/WireDeserializeAllocator.cpp b/src/dawn/wire/WireDeserializeAllocator.cpp index 95fb5f0e02..9e4fadc512 100644 --- a/src/dawn/wire/WireDeserializeAllocator.cpp +++ b/src/dawn/wire/WireDeserializeAllocator.cpp @@ -48,7 +48,7 @@ void* WireDeserializeAllocator::GetSpace(size_t size) { } void WireDeserializeAllocator::Reset() { - for (auto allocation : mAllocations) { + for (auto* allocation : mAllocations) { free(allocation); } mAllocations.clear(); diff --git a/src/dawn/wire/WireServer.cpp b/src/dawn/wire/WireServer.cpp index c806fe0e33..b864112769 100644 --- a/src/dawn/wire/WireServer.cpp +++ b/src/dawn/wire/WireServer.cpp @@ -58,6 +58,10 @@ WGPUDevice WireServer::GetDevice(uint32_t id, uint32_t generation) { return mImpl->GetDevice(id, generation); } +bool WireServer::IsDeviceKnown(WGPUDevice device) const { + return mImpl->IsDeviceKnown(device); +} + namespace server { MemoryTransferService::MemoryTransferService() = default; diff --git a/src/dawn/wire/client/Adapter.cpp b/src/dawn/wire/client/Adapter.cpp index 3f55044188..6edf63c813 100644 --- a/src/dawn/wire/client/Adapter.cpp +++ b/src/dawn/wire/client/Adapter.cpp @@ -65,18 +65,19 @@ void Adapter::GetProperties(WGPUAdapterProperties* properties) const { void Adapter::RequestDevice(const WGPUDeviceDescriptor* descriptor, WGPURequestDeviceCallback callback, void* userdata) { + Client* client = GetClient(); if (client->IsDisconnected()) { callback(WGPURequestDeviceStatus_Error, nullptr, "GPU connection lost", userdata); return; } - auto* allocation = client->DeviceAllocator().New(client); - uint64_t serial = mRequestDeviceRequests.Add({callback, allocation->object->id, userdata}); + Device* device = client->Make(); + uint64_t serial = mRequestDeviceRequests.Add({callback, device->GetWireId(), userdata}); AdapterRequestDeviceCmd cmd; - cmd.adapterId = this->id; + cmd.adapterId = GetWireId(); cmd.requestSerial = serial; - cmd.deviceObjectHandle = ObjectHandle(allocation->object->id, allocation->generation); + cmd.deviceObjectHandle = device->GetWireHandle(); cmd.descriptor = descriptor; client->SerializeCommand(cmd); @@ -108,12 +109,13 @@ bool Adapter::OnRequestDeviceCallback(uint64_t requestSerial, return false; } - Device* device = client->DeviceAllocator().GetObject(request.deviceObjectId); + Client* client = GetClient(); + Device* device = client->Get(request.deviceObjectId); // If the return status is a failure we should give a null device to the callback and // free the allocation. if (status != WGPURequestDeviceStatus_Success) { - client->DeviceAllocator().Free(device); + client->Free(device); request.callback(status, nullptr, message, request.userdata); return true; } diff --git a/src/dawn/wire/client/Adapter.h b/src/dawn/wire/client/Adapter.h index d2ae70607a..9c4b36fe38 100644 --- a/src/dawn/wire/client/Adapter.h +++ b/src/dawn/wire/client/Adapter.h @@ -28,8 +28,8 @@ namespace dawn::wire::client { class Adapter final : public ObjectBase { public: using ObjectBase::ObjectBase; + ~Adapter() override; - ~Adapter(); void CancelCallbacksForDisconnect() override; bool GetLimits(WGPUSupportedLimits* limits) const; diff --git a/src/dawn/wire/client/ApiObjects.h b/src/dawn/wire/client/ApiObjects.h index 1998d5493e..672b80a699 100644 --- a/src/dawn/wire/client/ApiObjects.h +++ b/src/dawn/wire/client/ApiObjects.h @@ -21,8 +21,10 @@ #include "dawn/wire/client/Buffer.h" #include "dawn/wire/client/Device.h" #include "dawn/wire/client/Instance.h" +#include "dawn/wire/client/QuerySet.h" #include "dawn/wire/client/Queue.h" #include "dawn/wire/client/ShaderModule.h" +#include "dawn/wire/client/Texture.h" #include "dawn/wire/client/ApiObjects_autogen.h" diff --git a/src/dawn/wire/client/Buffer.cpp b/src/dawn/wire/client/Buffer.cpp index 9760e3dc07..32da663827 100644 --- a/src/dawn/wire/client/Buffer.cpp +++ b/src/dawn/wire/client/Buffer.cpp @@ -26,7 +26,7 @@ namespace dawn::wire::client { // static WGPUBuffer Buffer::Create(Device* device, const WGPUBufferDescriptor* descriptor) { - Client* wireClient = device->client; + Client* wireClient = device->GetClient(); bool mappable = (descriptor->usage & (WGPUBufferUsage_MapRead | WGPUBufferUsage_MapWrite)) != 0 || @@ -40,7 +40,7 @@ WGPUBuffer Buffer::Create(Device* device, const WGPUBufferDescriptor* descriptor std::unique_ptr writeHandle = nullptr; DeviceCreateBufferCmd cmd; - cmd.deviceId = device->id; + cmd.deviceId = device->GetWireId(); cmd.descriptor = descriptor; cmd.readHandleCreateInfoLength = 0; cmd.readHandleCreateInfo = nullptr; @@ -54,7 +54,7 @@ WGPUBuffer Buffer::Create(Device* device, const WGPUBufferDescriptor* descriptor wireClient->GetMemoryTransferService()->CreateReadHandle(descriptor->size)); if (readHandle == nullptr) { device->InjectError(WGPUErrorType_OutOfMemory, "Failed to create buffer mapping"); - return device->CreateErrorBuffer(); + return CreateError(device, descriptor); } cmd.readHandleCreateInfoLength = readHandle->SerializeCreateSize(); } @@ -65,7 +65,7 @@ WGPUBuffer Buffer::Create(Device* device, const WGPUBufferDescriptor* descriptor wireClient->GetMemoryTransferService()->CreateWriteHandle(descriptor->size)); if (writeHandle == nullptr) { device->InjectError(WGPUErrorType_OutOfMemory, "Failed to create buffer mapping"); - return device->CreateErrorBuffer(); + return CreateError(device, descriptor); } cmd.writeHandleCreateInfoLength = writeHandle->SerializeCreateSize(); } @@ -74,11 +74,7 @@ WGPUBuffer Buffer::Create(Device* device, const WGPUBufferDescriptor* descriptor // Create the buffer and send the creation command. // This must happen after any potential device->CreateErrorBuffer() // as server expects allocating ids to be monotonically increasing - auto* bufferObjectAndSerial = wireClient->BufferAllocator().New(wireClient); - Buffer* buffer = bufferObjectAndSerial->object.get(); - buffer->mDevice = device; - buffer->mDeviceIsAlive = device->GetAliveWeakPtr(); - buffer->mSize = descriptor->size; + Buffer* buffer = wireClient->Make(device, descriptor); buffer->mDestructWriteHandleOnUnmap = false; if (descriptor->mappedAtCreation) { @@ -97,7 +93,7 @@ WGPUBuffer Buffer::Create(Device* device, const WGPUBufferDescriptor* descriptor buffer->mMappedData = writeHandle->GetData(); } - cmd.result = ObjectHandle{buffer->id, bufferObjectAndSerial->generation}; + cmd.result = buffer->GetWireHandle(); wireClient->SerializeCommand( cmd, cmd.readHandleCreateInfoLength + cmd.writeHandleCreateInfoLength, @@ -124,19 +120,26 @@ WGPUBuffer Buffer::Create(Device* device, const WGPUBufferDescriptor* descriptor } // static -WGPUBuffer Buffer::CreateError(Device* device) { - auto* allocation = device->client->BufferAllocator().New(device->client); - allocation->object->mDevice = device; - allocation->object->mDeviceIsAlive = device->GetAliveWeakPtr(); +WGPUBuffer Buffer::CreateError(Device* device, const WGPUBufferDescriptor* descriptor) { + Client* client = device->GetClient(); + Buffer* buffer = client->Make(device, descriptor); DeviceCreateErrorBufferCmd cmd; cmd.self = ToAPI(device); - cmd.result = ObjectHandle{allocation->object->id, allocation->generation}; - device->client->SerializeCommand(cmd); + cmd.result = buffer->GetWireHandle(); + client->SerializeCommand(cmd); - return ToAPI(allocation->object.get()); + return ToAPI(buffer); } +Buffer::Buffer(const ObjectBaseParams& params, + Device* device, + const WGPUBufferDescriptor* descriptor) + : ObjectBase(params), + mSize(descriptor->size), + mUsage(static_cast(descriptor->usage)), + mDeviceIsAlive(device->GetAliveWeakPtr()) {} + Buffer::~Buffer() { ClearAllCallbacks(WGPUBufferMapAsyncStatus_DestroyedBeforeCallback); FreeMappedData(); @@ -159,6 +162,7 @@ void Buffer::MapAsync(WGPUMapModeFlags mode, size_t size, WGPUBufferMapCallback callback, void* userdata) { + Client* client = GetClient(); if (client->IsDisconnected()) { return callback(WGPUBufferMapAsyncStatus_DeviceLost, userdata); } @@ -185,7 +189,7 @@ void Buffer::MapAsync(WGPUMapModeFlags mode, // Serialize the command to send to the server. BufferMapAsyncCmd cmd; - cmd.bufferId = this->id; + cmd.bufferId = GetWireId(); cmd.requestSerial = serial; cmd.mode = mode; cmd.offset = offset; @@ -286,6 +290,7 @@ void Buffer::Unmap() { // - Server -> Client: Result of MapRequest1 // - Unmap locally on the client // - Server -> Client: Result of MapRequest2 + Client* client = GetClient(); // mWriteHandle can still be nullptr if buffer has been destroyed before unmap if ((mMapState == MapState::MappedForWrite || mMapState == MapState::MappedAtCreation) && @@ -298,7 +303,7 @@ void Buffer::Unmap() { mWriteHandle->SizeOfSerializeDataUpdate(mMapOffset, mMapSize); BufferUpdateMappedDataCmd cmd; - cmd.bufferId = id; + cmd.bufferId = GetWireId(); cmd.writeDataUpdateInfoLength = writeDataUpdateInfoLength; cmd.writeDataUpdateInfo = nullptr; cmd.offset = mMapOffset; @@ -348,6 +353,8 @@ void Buffer::Unmap() { } void Buffer::Destroy() { + Client* client = GetClient(); + // Remove the current mapping and destroy Read/WriteHandles. FreeMappedData(); @@ -363,6 +370,14 @@ void Buffer::Destroy() { client->SerializeCommand(cmd); } +WGPUBufferUsage Buffer::GetUsage() const { + return mUsage; +} + +uint64_t Buffer::GetSize() const { + return mSize; +} + bool Buffer::IsMappedForReading() const { return mMapState == MapState::MappedForRead; } diff --git a/src/dawn/wire/client/Buffer.h b/src/dawn/wire/client/Buffer.h index be11598cfc..8040016233 100644 --- a/src/dawn/wire/client/Buffer.h +++ b/src/dawn/wire/client/Buffer.h @@ -28,12 +28,11 @@ class Device; class Buffer final : public ObjectBase { public: - using ObjectBase::ObjectBase; - static WGPUBuffer Create(Device* device, const WGPUBufferDescriptor* descriptor); - static WGPUBuffer CreateError(Device* device); + static WGPUBuffer CreateError(Device* device, const WGPUBufferDescriptor* descriptor); - ~Buffer(); + Buffer(const ObjectBaseParams& params, Device* device, const WGPUBufferDescriptor* descriptor); + ~Buffer() override; bool OnMapAsyncCallback(uint64_t requestSerial, uint32_t status, @@ -50,6 +49,10 @@ class Buffer final : public ObjectBase { void Destroy(); + // Note that these values can be arbitrary since they aren't validated in the wire client. + WGPUBufferUsage GetUsage() const; + uint64_t GetSize() const; + private: void CancelCallbacksForDisconnect() override; void ClearAllCallbacks(WGPUBufferMapAsyncStatus status); @@ -60,8 +63,6 @@ class Buffer final : public ObjectBase { void FreeMappedData(); - Device* mDevice; - enum class MapRequestType { None, Read, Write }; enum class MapState { @@ -89,6 +90,7 @@ class Buffer final : public ObjectBase { }; RequestTracker mRequests; uint64_t mSize = 0; + WGPUBufferUsage mUsage; // Only one mapped pointer can be active at a time because Unmap clears all the in-flight // requests. diff --git a/src/dawn/wire/client/Client.cpp b/src/dawn/wire/client/Client.cpp index 6b15628695..57f3c57a8a 100644 --- a/src/dawn/wire/client/Client.cpp +++ b/src/dawn/wire/client/Client.cpp @@ -28,7 +28,7 @@ class NoopCommandSerializer final : public CommandSerializer { return &gNoopCommandSerializer; } - ~NoopCommandSerializer() = default; + ~NoopCommandSerializer() override = default; size_t GetMaximumAllocationSize() const final { return 0; } void* GetCmdSpace(size_t size) final { return nullptr; } @@ -51,6 +51,19 @@ Client::~Client() { } void Client::DestroyAllObjects() { + // Free all devices first since they may hold references to other objects + // like the default queue. The Device destructor releases the default queue, + // which would be invalid if the queue was already freed. + while (!mObjects[ObjectType::Device].empty()) { + ObjectBase* object = mObjects[ObjectType::Device].head()->value(); + + DestroyObjectCmd cmd; + cmd.objectType = ObjectType::Device; + cmd.objectId = object->GetWireId(); + SerializeCommand(cmd); + mObjectStores[ObjectType::Device].Free(object); + } + for (auto& objectList : mObjects) { ObjectType objectType = static_cast(&objectList - mObjects.data()); if (objectType == ObjectType::Device) { @@ -61,81 +74,71 @@ void Client::DestroyAllObjects() { DestroyObjectCmd cmd; cmd.objectType = objectType; - cmd.objectId = object->id; + cmd.objectId = object->GetWireId(); SerializeCommand(cmd); - FreeObject(objectType, object); + mObjectStores[objectType].Free(object); } } - - while (!mObjects[ObjectType::Device].empty()) { - ObjectBase* object = mObjects[ObjectType::Device].head()->value(); - - DestroyObjectCmd cmd; - cmd.objectType = ObjectType::Device; - cmd.objectId = object->id; - SerializeCommand(cmd); - FreeObject(ObjectType::Device, object); - } } -ReservedTexture Client::ReserveTexture(WGPUDevice device) { - auto* allocation = TextureAllocator().New(this); +ReservedTexture Client::ReserveTexture(WGPUDevice device, const WGPUTextureDescriptor* descriptor) { + Texture* texture = Make(descriptor); ReservedTexture result; - result.texture = ToAPI(allocation->object.get()); - result.id = allocation->object->id; - result.generation = allocation->generation; - result.deviceId = FromAPI(device)->id; - result.deviceGeneration = DeviceAllocator().GetGeneration(FromAPI(device)->id); + result.texture = ToAPI(texture); + result.id = texture->GetWireId(); + result.generation = texture->GetWireGeneration(); + result.deviceId = FromAPI(device)->GetWireId(); + result.deviceGeneration = FromAPI(device)->GetWireGeneration(); return result; } ReservedSwapChain Client::ReserveSwapChain(WGPUDevice device) { - auto* allocation = SwapChainAllocator().New(this); + SwapChain* swapChain = Make(); ReservedSwapChain result; - result.swapchain = ToAPI(allocation->object.get()); - result.id = allocation->object->id; - result.generation = allocation->generation; - result.deviceId = FromAPI(device)->id; - result.deviceGeneration = DeviceAllocator().GetGeneration(FromAPI(device)->id); + result.swapchain = ToAPI(swapChain); + result.id = swapChain->GetWireId(); + result.generation = swapChain->GetWireGeneration(); + result.deviceId = FromAPI(device)->GetWireId(); + result.deviceGeneration = FromAPI(device)->GetWireGeneration(); return result; } ReservedDevice Client::ReserveDevice() { - auto* allocation = DeviceAllocator().New(this); + Device* device = Make(); ReservedDevice result; - result.device = ToAPI(allocation->object.get()); - result.id = allocation->object->id; - result.generation = allocation->generation; + result.device = ToAPI(device); + result.id = device->GetWireId(); + result.generation = device->GetWireGeneration(); return result; } ReservedInstance Client::ReserveInstance() { - auto* allocation = InstanceAllocator().New(this); + Instance* instance = Make(); ReservedInstance result; - result.instance = ToAPI(allocation->object.get()); - result.id = allocation->object->id; - result.generation = allocation->generation; + result.instance = ToAPI(instance); + result.id = instance->GetWireId(); + result.generation = instance->GetWireGeneration(); return result; } void Client::ReclaimTextureReservation(const ReservedTexture& reservation) { - TextureAllocator().Free(FromAPI(reservation.texture)); + Free(FromAPI(reservation.texture)); } void Client::ReclaimSwapChainReservation(const ReservedSwapChain& reservation) { - SwapChainAllocator().Free(FromAPI(reservation.swapchain)); + Free(FromAPI(reservation.swapchain)); } void Client::ReclaimDeviceReservation(const ReservedDevice& reservation) { - DeviceAllocator().Free(FromAPI(reservation.device)); + Free(FromAPI(reservation.device)); } void Client::ReclaimInstanceReservation(const ReservedInstance& reservation) { - InstanceAllocator().Free(FromAPI(reservation.instance)); + Free(FromAPI(reservation.instance)); } void Client::Disconnect() { @@ -162,4 +165,8 @@ bool Client::IsDisconnected() const { return mDisconnected; } +void Client::Free(ObjectBase* obj, ObjectType type) { + mObjectStores[type].Free(obj); +} + } // namespace dawn::wire::client diff --git a/src/dawn/wire/client/Client.h b/src/dawn/wire/client/Client.h index d045f0c06e..8648522bd8 100644 --- a/src/dawn/wire/client/Client.h +++ b/src/dawn/wire/client/Client.h @@ -16,6 +16,7 @@ #define SRC_DAWN_WIRE_CLIENT_CLIENT_H_ #include +#include #include "dawn/common/LinkedList.h" #include "dawn/common/NonCopyable.h" @@ -26,6 +27,7 @@ #include "dawn/wire/WireCmd_autogen.h" #include "dawn/wire/WireDeserializeAllocator.h" #include "dawn/wire/client/ClientBase_autogen.h" +#include "dawn/wire/client/ObjectStore.h" namespace dawn::wire::client { @@ -37,12 +39,38 @@ class Client : public ClientBase { Client(CommandSerializer* serializer, MemoryTransferService* memoryTransferService); ~Client() override; + // Make(arg1, arg2, arg3) creates a new T, calling a constructor of the form: + // + // T::T(ObjectBaseParams, arg1, arg2, arg3) + template + T* Make(Args&&... args) { + constexpr ObjectType type = ObjectTypeToTypeEnum; + + ObjectBaseParams params = {this, mObjectStores[type].ReserveHandle()}; + T* object = new T(params, std::forward(args)...); + + mObjects[type].Append(object); + mObjectStores[type].Insert(std::unique_ptr(object)); + return object; + } + + template + void Free(T* obj) { + Free(obj, ObjectTypeToTypeEnum); + } + void Free(ObjectBase* obj, ObjectType type); + + template + T* Get(ObjectId id) { + return static_cast(mObjectStores[ObjectTypeToTypeEnum].Get(id)); + } + // ChunkedCommandHandler implementation const volatile char* HandleCommandsImpl(const volatile char* commands, size_t size) override; MemoryTransferService* GetMemoryTransferService() const { return mMemoryTransferService; } - ReservedTexture ReserveTexture(WGPUDevice device); + ReservedTexture ReserveTexture(WGPUDevice device, const WGPUTextureDescriptor* descriptor); ReservedSwapChain ReserveSwapChain(WGPUDevice device); ReservedDevice ReserveDevice(); ReservedInstance ReserveInstance(); @@ -67,21 +95,16 @@ class Client : public ClientBase { void Disconnect(); bool IsDisconnected() const; - template - void TrackObject(T* object) { - mObjects[ObjectTypeToTypeEnum::value].Append(object); - } - private: void DestroyAllObjects(); #include "dawn/wire/client/ClientPrototypes_autogen.inc" ChunkedCommandSerializer mSerializer; - WireDeserializeAllocator mAllocator; + WireDeserializeAllocator mWireCommandAllocator; + PerObjectType mObjectStores; MemoryTransferService* mMemoryTransferService = nullptr; std::unique_ptr mOwnedMemoryTransferService = nullptr; - PerObjectType> mObjects; bool mDisconnected = false; }; diff --git a/src/dawn/wire/client/Device.cpp b/src/dawn/wire/client/Device.cpp index b672d397d1..f2bffe2cdf 100644 --- a/src/dawn/wire/client/Device.cpp +++ b/src/dawn/wire/client/Device.cpp @@ -20,12 +20,11 @@ #include "dawn/common/Log.h" #include "dawn/wire/client/ApiObjects_autogen.h" #include "dawn/wire/client/Client.h" -#include "dawn/wire/client/ObjectAllocator.h" namespace dawn::wire::client { -Device::Device(Client* clientIn, uint32_t initialRefcount, uint32_t initialId) - : ObjectBase(clientIn, initialRefcount, initialId), mIsAlive(std::make_shared()) { +Device::Device(const ObjectBaseParams& params) + : ObjectBase(params), mIsAlive(std::make_shared()) { #if defined(DAWN_ENABLE_ASSERTS) mErrorCallback = [](WGPUErrorType, char const*, void*) { static bool calledOnce = false; @@ -67,6 +66,10 @@ Device::~Device() { "Device destroyed before callback", request->userdata); } }); + + if (mQueue != nullptr) { + GetProcs().queueRelease(ToAPI(mQueue)); + } } bool Device::GetLimits(WGPUSupportedLimits* limits) const { @@ -147,6 +150,7 @@ void Device::SetDeviceLostCallback(WGPUDeviceLostCallback callback, void* userda bool Device::PopErrorScope(WGPUErrorCallback callback, void* userdata) { // TODO(crbug.com/dawn/1324) Replace bool return with void when users are updated. + Client* client = GetClient(); if (client->IsDisconnected()) { callback(WGPUErrorType_DeviceLost, "GPU device disconnected", userdata); return true; @@ -154,7 +158,7 @@ bool Device::PopErrorScope(WGPUErrorCallback callback, void* userdata) { uint64_t serial = mErrorScopes.Add({callback, userdata}); DevicePopErrorScopeCmd cmd; - cmd.deviceId = this->id; + cmd.deviceId = GetWireId(); cmd.requestSerial = serial; client->SerializeCommand(cmd); return true; @@ -188,7 +192,7 @@ void Device::InjectError(WGPUErrorType type, const char* message) { cmd.self = ToAPI(this); cmd.type = type; cmd.message = message; - client->SerializeCommand(cmd); + GetClient()->SerializeCommand(cmd); } WGPUBuffer Device::CreateBuffer(const WGPUBufferDescriptor* descriptor) { @@ -196,7 +200,26 @@ WGPUBuffer Device::CreateBuffer(const WGPUBufferDescriptor* descriptor) { } WGPUBuffer Device::CreateErrorBuffer() { - return Buffer::CreateError(this); + WGPUBufferDescriptor fakeDescriptor = {}; + return Buffer::CreateError(this, &fakeDescriptor); +} + +WGPUQuerySet Device::CreateQuerySet(const WGPUQuerySetDescriptor* descriptor) { + return QuerySet::Create(this, descriptor); +} + +WGPUTexture Device::CreateTexture(const WGPUTextureDescriptor* descriptor) { + return Texture::Create(this, descriptor); +} + +WGPUTexture Device::CreateErrorTexture(const WGPUTextureDescriptor* descriptor) { + return Texture::CreateError(this, descriptor); +} + +WGPUAdapter Device::GetAdapter() { + // Not implemented in the wire. + UNREACHABLE(); + return nullptr; } WGPUQueue Device::GetQueue() { @@ -206,42 +229,43 @@ WGPUQueue Device::GetQueue() { // on construction. if (mQueue == nullptr) { // Get the primary queue for this device. - auto* allocation = client->QueueAllocator().New(client); - mQueue = allocation->object.get(); + Client* client = GetClient(); + mQueue = client->Make(); DeviceGetQueueCmd cmd; cmd.self = ToAPI(this); - cmd.result = ObjectHandle{allocation->object->id, allocation->generation}; + cmd.result = mQueue->GetWireHandle(); client->SerializeCommand(cmd); } - mQueue->refcount++; + mQueue->Reference(); return ToAPI(mQueue); } void Device::CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor, WGPUCreateComputePipelineAsyncCallback callback, void* userdata) { + Client* client = GetClient(); if (client->IsDisconnected()) { return callback(WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr, "GPU device disconnected", userdata); } - auto* allocation = client->ComputePipelineAllocator().New(client); + ComputePipeline* pipeline = client->Make(); CreatePipelineAsyncRequest request = {}; request.createComputePipelineAsyncCallback = callback; request.userdata = userdata; - request.pipelineObjectID = allocation->object->id; + request.pipelineObjectID = pipeline->GetWireId(); uint64_t serial = mCreatePipelineAsyncRequests.Add(std::move(request)); DeviceCreateComputePipelineAsyncCmd cmd; - cmd.deviceId = this->id; + cmd.deviceId = GetWireId(); cmd.descriptor = descriptor; cmd.requestSerial = serial; - cmd.pipelineObjectHandle = ObjectHandle{allocation->object->id, allocation->generation}; + cmd.pipelineObjectHandle = pipeline->GetWireHandle(); client->SerializeCommand(cmd); } @@ -254,45 +278,44 @@ bool Device::OnCreateComputePipelineAsyncCallback(uint64_t requestSerial, return false; } - auto pipelineAllocation = - client->ComputePipelineAllocator().GetObject(request.pipelineObjectID); + Client* client = GetClient(); + ComputePipeline* pipeline = client->Get(request.pipelineObjectID); // If the return status is a failure we should give a null pipeline to the callback and // free the allocation. if (status != WGPUCreatePipelineAsyncStatus_Success) { - client->ComputePipelineAllocator().Free(pipelineAllocation); + client->Free(pipeline); request.createComputePipelineAsyncCallback(status, nullptr, message, request.userdata); return true; } - WGPUComputePipeline pipeline = reinterpret_cast(pipelineAllocation); - request.createComputePipelineAsyncCallback(status, pipeline, message, request.userdata); - + request.createComputePipelineAsyncCallback(status, ToAPI(pipeline), message, request.userdata); return true; } void Device::CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata) { + Client* client = GetClient(); if (client->IsDisconnected()) { return callback(WGPUCreatePipelineAsyncStatus_DeviceLost, nullptr, "GPU device disconnected", userdata); } - auto* allocation = client->RenderPipelineAllocator().New(client); + RenderPipeline* pipeline = client->Make(); CreatePipelineAsyncRequest request = {}; request.createRenderPipelineAsyncCallback = callback; request.userdata = userdata; - request.pipelineObjectID = allocation->object->id; + request.pipelineObjectID = pipeline->GetWireId(); uint64_t serial = mCreatePipelineAsyncRequests.Add(std::move(request)); DeviceCreateRenderPipelineAsyncCmd cmd; - cmd.deviceId = this->id; + cmd.deviceId = GetWireId(); cmd.descriptor = descriptor; cmd.requestSerial = serial; - cmd.pipelineObjectHandle = ObjectHandle(allocation->object->id, allocation->generation); + cmd.pipelineObjectHandle = pipeline->GetWireHandle(); client->SerializeCommand(cmd); } @@ -305,19 +328,18 @@ bool Device::OnCreateRenderPipelineAsyncCallback(uint64_t requestSerial, return false; } - auto pipelineAllocation = client->RenderPipelineAllocator().GetObject(request.pipelineObjectID); + Client* client = GetClient(); + RenderPipeline* pipeline = client->Get(request.pipelineObjectID); // If the return status is a failure we should give a null pipeline to the callback and // free the allocation. if (status != WGPUCreatePipelineAsyncStatus_Success) { - client->RenderPipelineAllocator().Free(pipelineAllocation); + client->Free(pipeline); request.createRenderPipelineAsyncCallback(status, nullptr, message, request.userdata); return true; } - WGPURenderPipeline pipeline = reinterpret_cast(pipelineAllocation); - request.createRenderPipelineAsyncCallback(status, pipeline, message, request.userdata); - + request.createRenderPipelineAsyncCallback(status, ToAPI(pipeline), message, request.userdata); return true; } diff --git a/src/dawn/wire/client/Device.h b/src/dawn/wire/client/Device.h index f613e6ab52..6e021feba9 100644 --- a/src/dawn/wire/client/Device.h +++ b/src/dawn/wire/client/Device.h @@ -32,8 +32,8 @@ class Queue; class Device final : public ObjectBase { public: - Device(Client* client, uint32_t refcount, uint32_t id); - ~Device(); + explicit Device(const ObjectBaseParams& params); + ~Device() override; void SetUncapturedErrorCallback(WGPUErrorCallback errorCallback, void* errorUserdata); void SetLoggingCallback(WGPULoggingCallback errorCallback, void* errorUserdata); @@ -50,6 +50,9 @@ class Device final : public ObjectBase { void CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata); + WGPUQuerySet CreateQuerySet(const WGPUQuerySetDescriptor* descriptor); + WGPUTexture CreateTexture(const WGPUTextureDescriptor* descriptor); + WGPUTexture CreateErrorTexture(const WGPUTextureDescriptor* descriptor); void HandleError(WGPUErrorType errorType, const char* message); void HandleLogging(WGPULoggingType loggingType, const char* message); @@ -68,6 +71,7 @@ class Device final : public ObjectBase { void SetLimits(const WGPUSupportedLimits* limits); void SetFeatures(const WGPUFeatureName* features, uint32_t featuresCount); + WGPUAdapter GetAdapter(); // Not implemented in the wire. WGPUQueue GetQueue(); void CancelCallbacksForDisconnect() override; diff --git a/src/dawn/wire/client/Instance.cpp b/src/dawn/wire/client/Instance.cpp index b3a996f8c7..efd9b74103 100644 --- a/src/dawn/wire/client/Instance.cpp +++ b/src/dawn/wire/client/Instance.cpp @@ -35,18 +35,19 @@ void Instance::CancelCallbacksForDisconnect() { void Instance::RequestAdapter(const WGPURequestAdapterOptions* options, WGPURequestAdapterCallback callback, void* userdata) { + Client* client = GetClient(); if (client->IsDisconnected()) { callback(WGPURequestAdapterStatus_Error, nullptr, "GPU connection lost", userdata); return; } - auto* allocation = client->AdapterAllocator().New(client); - uint64_t serial = mRequestAdapterRequests.Add({callback, allocation->object->id, userdata}); + Adapter* adapter = client->Make(); + uint64_t serial = mRequestAdapterRequests.Add({callback, adapter->GetWireId(), userdata}); InstanceRequestAdapterCmd cmd; - cmd.instanceId = this->id; + cmd.instanceId = GetWireId(); cmd.requestSerial = serial; - cmd.adapterObjectHandle = ObjectHandle(allocation->object->id, allocation->generation); + cmd.adapterObjectHandle = adapter->GetWireHandle(); cmd.options = options; client->SerializeCommand(cmd); @@ -80,12 +81,13 @@ bool Instance::OnRequestAdapterCallback(uint64_t requestSerial, return false; } - Adapter* adapter = client->AdapterAllocator().GetObject(request.adapterObjectId); + Client* client = GetClient(); + Adapter* adapter = client->Get(request.adapterObjectId); // If the return status is a failure we should give a null adapter to the callback and // free the allocation. if (status != WGPURequestAdapterStatus_Success) { - client->AdapterAllocator().Free(adapter); + client->Free(adapter); request.callback(status, nullptr, message, request.userdata); return true; } diff --git a/src/dawn/wire/client/Instance.h b/src/dawn/wire/client/Instance.h index a4c74dcdfc..1400565890 100644 --- a/src/dawn/wire/client/Instance.h +++ b/src/dawn/wire/client/Instance.h @@ -27,8 +27,8 @@ namespace dawn::wire::client { class Instance final : public ObjectBase { public: using ObjectBase::ObjectBase; + ~Instance() override; - ~Instance(); void CancelCallbacksForDisconnect() override; void RequestAdapter(const WGPURequestAdapterOptions* options, diff --git a/src/dawn/wire/client/LimitsAndFeatures.cpp b/src/dawn/wire/client/LimitsAndFeatures.cpp index 95460cdc68..03a65004ec 100644 --- a/src/dawn/wire/client/LimitsAndFeatures.cpp +++ b/src/dawn/wire/client/LimitsAndFeatures.cpp @@ -19,6 +19,10 @@ namespace dawn::wire::client { +LimitsAndFeatures::LimitsAndFeatures() = default; + +LimitsAndFeatures::~LimitsAndFeatures() = default; + bool LimitsAndFeatures::GetLimits(WGPUSupportedLimits* limits) const { ASSERT(limits != nullptr); if (limits->nextInChain != nullptr) { diff --git a/src/dawn/wire/client/LimitsAndFeatures.h b/src/dawn/wire/client/LimitsAndFeatures.h index d97b8330b8..cfe9353ff0 100644 --- a/src/dawn/wire/client/LimitsAndFeatures.h +++ b/src/dawn/wire/client/LimitsAndFeatures.h @@ -23,6 +23,9 @@ namespace dawn::wire::client { class LimitsAndFeatures { public: + LimitsAndFeatures(); + ~LimitsAndFeatures(); + bool GetLimits(WGPUSupportedLimits* limits) const; bool HasFeature(WGPUFeatureName feature) const; size_t EnumerateFeatures(WGPUFeatureName* features) const; diff --git a/src/dawn/wire/client/ObjectAllocator.h b/src/dawn/wire/client/ObjectAllocator.h deleted file mode 100644 index 60b8fa875f..0000000000 --- a/src/dawn/wire/client/ObjectAllocator.h +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2019 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_DAWN_WIRE_CLIENT_OBJECTALLOCATOR_H_ -#define SRC_DAWN_WIRE_CLIENT_OBJECTALLOCATOR_H_ - -#include -#include -#include -#include - -#include "dawn/common/Assert.h" -#include "dawn/common/Compiler.h" -#include "dawn/wire/WireCmd_autogen.h" - -namespace dawn::wire::client { - -template -class ObjectAllocator { - public: - struct ObjectAndSerial { - ObjectAndSerial(std::unique_ptr object, uint32_t generation) - : object(std::move(object)), generation(generation) {} - std::unique_ptr object; - uint32_t generation; - }; - - ObjectAllocator() { - // ID 0 is nullptr - mObjects.emplace_back(nullptr, 0); - } - - template - ObjectAndSerial* New(Client* client) { - uint32_t id = GetNewId(); - auto object = std::make_unique(client, 1, id); - client->TrackObject(object.get()); - - if (id >= mObjects.size()) { - ASSERT(id == mObjects.size()); - mObjects.emplace_back(std::move(object), 0); - } else { - ASSERT(mObjects[id].object == nullptr); - - mObjects[id].generation++; - // The generation should never overflow. We don't recycle ObjectIds that would - // overflow their next generation. - ASSERT(mObjects[id].generation != 0); - - mObjects[id].object = std::move(object); - } - - return &mObjects[id]; - } - void Free(T* obj) { - ASSERT(obj->IsInList()); - if (DAWN_LIKELY(mObjects[obj->id].generation != std::numeric_limits::max())) { - // Only recycle this ObjectId if the generation won't overflow on the next - // allocation. - FreeId(obj->id); - } - mObjects[obj->id].object = nullptr; - } - - T* GetObject(uint32_t id) { - if (id >= mObjects.size()) { - return nullptr; - } - return mObjects[id].object.get(); - } - - uint32_t GetGeneration(uint32_t id) { - if (id >= mObjects.size()) { - return 0; - } - return mObjects[id].generation; - } - - private: - uint32_t GetNewId() { - if (mFreeIds.empty()) { - return mCurrentId++; - } - uint32_t id = mFreeIds.back(); - mFreeIds.pop_back(); - return id; - } - void FreeId(uint32_t id) { mFreeIds.push_back(id); } - - // 0 is an ID reserved to represent nullptr - uint32_t mCurrentId = 1; - std::vector mFreeIds; - std::vector mObjects; -}; -} // namespace dawn::wire::client - -#endif // SRC_DAWN_WIRE_CLIENT_OBJECTALLOCATOR_H_ diff --git a/src/dawn/wire/client/ObjectBase.cpp b/src/dawn/wire/client/ObjectBase.cpp new file mode 100644 index 0000000000..953a443b55 --- /dev/null +++ b/src/dawn/wire/client/ObjectBase.cpp @@ -0,0 +1,54 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/wire/client/ObjectBase.h" + +#include "dawn/common/Assert.h" + +namespace dawn::wire::client { + +ObjectBase::ObjectBase(const ObjectBaseParams& params) + : mClient(params.client), mHandle(params.handle), mRefcount(1) {} + +ObjectBase::~ObjectBase() { + RemoveFromList(); +} + +const ObjectHandle& ObjectBase::GetWireHandle() const { + return mHandle; +} + +ObjectId ObjectBase::GetWireId() const { + return mHandle.id; +} + +ObjectGeneration ObjectBase::GetWireGeneration() const { + return mHandle.generation; +} + +Client* ObjectBase::GetClient() const { + return mClient; +} + +void ObjectBase::Reference() { + mRefcount++; +} + +bool ObjectBase::Release() { + ASSERT(mRefcount != 0); + mRefcount--; + return mRefcount == 0; +} + +} // namespace dawn::wire::client diff --git a/src/dawn/wire/client/ObjectBase.h b/src/dawn/wire/client/ObjectBase.h index a404444666..cf5f8ee7a2 100644 --- a/src/dawn/wire/client/ObjectBase.h +++ b/src/dawn/wire/client/ObjectBase.h @@ -18,28 +18,43 @@ #include "dawn/webgpu.h" #include "dawn/common/LinkedList.h" -#include "dawn/wire/ObjectType_autogen.h" +#include "dawn/wire/ObjectHandle.h" namespace dawn::wire::client { class Client; +struct ObjectBaseParams { + Client* client; + ObjectHandle handle; +}; + // All objects on the client side have: // - A pointer to the Client to get where to serialize commands -// - The external reference count +// - The external reference count, starting at 1. // - An ID that is used to refer to this object when talking with the server side // - A next/prev pointer. They are part of a linked list of objects of the same type. -struct ObjectBase : public LinkNode { - ObjectBase(Client* client, uint32_t refcount, uint32_t id) - : client(client), refcount(refcount), id(id) {} - - ~ObjectBase() { RemoveFromList(); } +class ObjectBase : public LinkNode { + public: + explicit ObjectBase(const ObjectBaseParams& params); + virtual ~ObjectBase(); virtual void CancelCallbacksForDisconnect() {} - Client* const client; - uint32_t refcount; - const uint32_t id; + const ObjectHandle& GetWireHandle() const; + ObjectId GetWireId() const; + ObjectGeneration GetWireGeneration() const; + Client* GetClient() const; + + void Reference(); + // Returns true if it was the last reference, indicating that the caller must destroy the + // object. + [[nodiscard]] bool Release(); + + private: + Client* const mClient; + const ObjectHandle mHandle; + uint32_t mRefcount; }; } // namespace dawn::wire::client diff --git a/src/dawn/wire/client/ObjectStore.cpp b/src/dawn/wire/client/ObjectStore.cpp new file mode 100644 index 0000000000..299a67802f --- /dev/null +++ b/src/dawn/wire/client/ObjectStore.cpp @@ -0,0 +1,72 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/wire/client/ObjectStore.h" + +#include +#include + +namespace dawn::wire::client { + +ObjectStore::ObjectStore() { + // ID 0 is nullptr + mObjects.emplace_back(nullptr); + mCurrentId = 1; +} + +ObjectHandle ObjectStore::ReserveHandle() { + if (mFreeHandles.empty()) { + return {mCurrentId++, 0}; + } + ObjectHandle handle = mFreeHandles.back(); + mFreeHandles.pop_back(); + return handle; +} + +void ObjectStore::Insert(std::unique_ptr obj) { + ObjectId id = obj->GetWireId(); + + if (id >= mObjects.size()) { + ASSERT(id == mObjects.size()); + mObjects.emplace_back(std::move(obj)); + } else { + // The generation should never overflow. We don't recycle ObjectIds that would + // overflow their next generation. + ASSERT(obj->GetWireGeneration() != 0); + ASSERT(mObjects[id] == nullptr); + mObjects[id] = std::move(obj); + } +} + +void ObjectStore::Free(ObjectBase* obj) { + ASSERT(obj->IsInList()); + // The wire reuses ID for objects to keep them in a packed array starting from 0. + // To avoid issues with asynchronous server->client communication referring to an ID that's + // already reused, each handle also has a generation that's increment by one on each reuse. + // Avoid overflows by only reusing the ID if the increment of the generation won't overflow. + const ObjectHandle& currentHandle = obj->GetWireHandle(); + if (DAWN_LIKELY(currentHandle.generation != std::numeric_limits::max())) { + mFreeHandles.push_back({currentHandle.id, currentHandle.generation + 1}); + } + mObjects[currentHandle.id] = nullptr; +} + +ObjectBase* ObjectStore::Get(ObjectId id) const { + if (id >= mObjects.size()) { + return nullptr; + } + return mObjects[id].get(); +} + +} // namespace dawn::wire::client diff --git a/src/dawn/wire/client/ObjectStore.h b/src/dawn/wire/client/ObjectStore.h new file mode 100644 index 0000000000..5d9b7415d0 --- /dev/null +++ b/src/dawn/wire/client/ObjectStore.h @@ -0,0 +1,51 @@ +// Copyright 2019 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_WIRE_CLIENT_OBJECTSTORE_H_ +#define SRC_DAWN_WIRE_CLIENT_OBJECTSTORE_H_ + +#include +#include + +#include "dawn/wire/client/ObjectBase.h" + +namespace dawn::wire::client { + +class Client; + +// A helper class used in Client, ObjectStore owns the association of some ObjectBase and +// ObjectHandles. The lifetime of the ObjectBase is then owned by the ObjectStore, destruction +// happening when Free is called. +// +// Since the wire has one "ID" namespace per type of object, each ObjectStore should contain a +// single type of objects. However no templates are used because Client wraps ObjectStore and is +// type-generic, so ObjectStore is type-erased to only work on ObjectBase. +class ObjectStore { + public: + ObjectStore(); + + ObjectHandle ReserveHandle(); + void Insert(std::unique_ptr obj); + void Free(ObjectBase* obj); + ObjectBase* Get(ObjectId id) const; + + private: + uint32_t mCurrentId; + std::vector mFreeHandles; + std::vector> mObjects; +}; + +} // namespace dawn::wire::client + +#endif // SRC_DAWN_WIRE_CLIENT_OBJECTSTORE_H_ diff --git a/src/dawn/wire/client/QuerySet.cpp b/src/dawn/wire/client/QuerySet.cpp new file mode 100644 index 0000000000..6ecbaa4343 --- /dev/null +++ b/src/dawn/wire/client/QuerySet.cpp @@ -0,0 +1,51 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/wire/client/QuerySet.h" + +#include "dawn/wire/client/Client.h" +#include "dawn/wire/client/Device.h" + +namespace dawn::wire::client { + +// static +WGPUQuerySet QuerySet::Create(Device* device, const WGPUQuerySetDescriptor* descriptor) { + Client* wireClient = device->GetClient(); + QuerySet* querySet = wireClient->Make(descriptor); + + // Send the Device::CreateQuerySet command without modifications. + DeviceCreateQuerySetCmd cmd; + cmd.self = ToAPI(device); + cmd.selfId = device->GetWireId(); + cmd.descriptor = descriptor; + cmd.result = querySet->GetWireHandle(); + wireClient->SerializeCommand(cmd); + + return ToAPI(querySet); +} + +QuerySet::QuerySet(const ObjectBaseParams& params, const WGPUQuerySetDescriptor* descriptor) + : ObjectBase(params), mType(descriptor->type), mCount(descriptor->count) {} + +QuerySet::~QuerySet() = default; + +WGPUQueryType QuerySet::GetType() const { + return mType; +} + +uint32_t QuerySet::GetCount() const { + return mCount; +} + +} // namespace dawn::wire::client diff --git a/src/dawn/wire/client/QuerySet.h b/src/dawn/wire/client/QuerySet.h new file mode 100644 index 0000000000..84c80999ab --- /dev/null +++ b/src/dawn/wire/client/QuerySet.h @@ -0,0 +1,44 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_WIRE_CLIENT_QUERYSET_H_ +#define SRC_DAWN_WIRE_CLIENT_QUERYSET_H_ + +#include "dawn/webgpu.h" + +#include "dawn/wire/client/ObjectBase.h" + +namespace dawn::wire::client { + +class Device; + +class QuerySet final : public ObjectBase { + public: + static WGPUQuerySet Create(Device* device, const WGPUQuerySetDescriptor* descriptor); + + QuerySet(const ObjectBaseParams& params, const WGPUQuerySetDescriptor* descriptor); + ~QuerySet() override; + + // Note that these values can be arbitrary since they aren't validated in the wire client. + WGPUQueryType GetType() const; + uint32_t GetCount() const; + + private: + WGPUQueryType mType; + uint32_t mCount; +}; + +} // namespace dawn::wire::client + +#endif // SRC_DAWN_WIRE_CLIENT_QUERYSET_H_ diff --git a/src/dawn/wire/client/Queue.cpp b/src/dawn/wire/client/Queue.cpp index 79f5632433..bc5a4bbd28 100644 --- a/src/dawn/wire/client/Queue.cpp +++ b/src/dawn/wire/client/Queue.cpp @@ -36,6 +36,7 @@ bool Queue::OnWorkDoneCallback(uint64_t requestSerial, WGPUQueueWorkDoneStatus s void Queue::OnSubmittedWorkDone(uint64_t signalValue, WGPUQueueWorkDoneCallback callback, void* userdata) { + Client* client = GetClient(); if (client->IsDisconnected()) { callback(WGPUQueueWorkDoneStatus_DeviceLost, userdata); return; @@ -44,7 +45,7 @@ void Queue::OnSubmittedWorkDone(uint64_t signalValue, uint64_t serial = mOnWorkDoneRequests.Add({callback, userdata}); QueueOnSubmittedWorkDoneCmd cmd; - cmd.queueId = this->id; + cmd.queueId = GetWireId(); cmd.signalValue = signalValue; cmd.requestSerial = serial; @@ -55,13 +56,13 @@ void Queue::WriteBuffer(WGPUBuffer cBuffer, uint64_t bufferOffset, const void* d Buffer* buffer = FromAPI(cBuffer); QueueWriteBufferCmd cmd; - cmd.queueId = id; - cmd.bufferId = buffer->id; + cmd.queueId = GetWireId(); + cmd.bufferId = buffer->GetWireId(); cmd.bufferOffset = bufferOffset; cmd.data = static_cast(data); cmd.size = size; - client->SerializeCommand(cmd); + GetClient()->SerializeCommand(cmd); } void Queue::WriteTexture(const WGPUImageCopyTexture* destination, @@ -70,14 +71,14 @@ void Queue::WriteTexture(const WGPUImageCopyTexture* destination, const WGPUTextureDataLayout* dataLayout, const WGPUExtent3D* writeSize) { QueueWriteTextureCmd cmd; - cmd.queueId = id; + cmd.queueId = GetWireId(); cmd.destination = destination; cmd.data = static_cast(data); cmd.dataSize = dataSize; cmd.dataLayout = dataLayout; cmd.writeSize = writeSize; - client->SerializeCommand(cmd); + GetClient()->SerializeCommand(cmd); } void Queue::CancelCallbacksForDisconnect() { diff --git a/src/dawn/wire/client/Queue.h b/src/dawn/wire/client/Queue.h index 6b59d96b4e..28424c0b45 100644 --- a/src/dawn/wire/client/Queue.h +++ b/src/dawn/wire/client/Queue.h @@ -26,7 +26,7 @@ namespace dawn::wire::client { class Queue final : public ObjectBase { public: using ObjectBase::ObjectBase; - ~Queue(); + ~Queue() override; bool OnWorkDoneCallback(uint64_t requestSerial, WGPUQueueWorkDoneStatus status); diff --git a/src/dawn/wire/client/RequestTracker.h b/src/dawn/wire/client/RequestTracker.h index d1d6cc0240..13b7294c85 100644 --- a/src/dawn/wire/client/RequestTracker.h +++ b/src/dawn/wire/client/RequestTracker.h @@ -72,7 +72,7 @@ class RequestTracker : NonCopyable { } private: - uint64_t mSerial; + uint64_t mSerial = 0; std::map mRequests; }; diff --git a/src/dawn/wire/client/ShaderModule.cpp b/src/dawn/wire/client/ShaderModule.cpp index e7cbb4ec15..bcf1d6fbfa 100644 --- a/src/dawn/wire/client/ShaderModule.cpp +++ b/src/dawn/wire/client/ShaderModule.cpp @@ -23,6 +23,7 @@ ShaderModule::~ShaderModule() { } void ShaderModule::GetCompilationInfo(WGPUCompilationInfoCallback callback, void* userdata) { + Client* client = GetClient(); if (client->IsDisconnected()) { callback(WGPUCompilationInfoRequestStatus_DeviceLost, nullptr, userdata); return; @@ -31,7 +32,7 @@ void ShaderModule::GetCompilationInfo(WGPUCompilationInfoCallback callback, void uint64_t serial = mCompilationInfoRequests.Add({callback, userdata}); ShaderModuleGetCompilationInfoCmd cmd; - cmd.shaderModuleId = this->id; + cmd.shaderModuleId = GetWireId(); cmd.requestSerial = serial; client->SerializeCommand(cmd); diff --git a/src/dawn/wire/client/ShaderModule.h b/src/dawn/wire/client/ShaderModule.h index d8869ba8e6..c6d4153b63 100644 --- a/src/dawn/wire/client/ShaderModule.h +++ b/src/dawn/wire/client/ShaderModule.h @@ -25,7 +25,7 @@ namespace dawn::wire::client { class ShaderModule final : public ObjectBase { public: using ObjectBase::ObjectBase; - ~ShaderModule(); + ~ShaderModule() override; void GetCompilationInfo(WGPUCompilationInfoCallback callback, void* userdata); bool GetCompilationInfoCallback(uint64_t requestSerial, diff --git a/src/dawn/wire/client/Texture.cpp b/src/dawn/wire/client/Texture.cpp new file mode 100644 index 0000000000..69f773e424 --- /dev/null +++ b/src/dawn/wire/client/Texture.cpp @@ -0,0 +1,97 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/wire/client/Texture.h" + +#include "dawn/wire/client/Client.h" +#include "dawn/wire/client/Device.h" + +namespace dawn::wire::client { + +// static +WGPUTexture Texture::Create(Device* device, const WGPUTextureDescriptor* descriptor) { + Client* wireClient = device->GetClient(); + Texture* texture = wireClient->Make(descriptor); + + // Send the Device::CreateTexture command without modifications. + DeviceCreateTextureCmd cmd; + cmd.self = ToAPI(device); + cmd.selfId = device->GetWireId(); + cmd.descriptor = descriptor; + cmd.result = texture->GetWireHandle(); + wireClient->SerializeCommand(cmd); + + return ToAPI(texture); +} + +// static +WGPUTexture Texture::CreateError(Device* device, const WGPUTextureDescriptor* descriptor) { + Client* wireClient = device->GetClient(); + Texture* texture = wireClient->Make(descriptor); + + // Send the Device::CreateErrorTexture command without modifications. + DeviceCreateErrorTextureCmd cmd; + cmd.self = ToAPI(device); + cmd.selfId = device->GetWireId(); + cmd.descriptor = descriptor; + cmd.result = texture->GetWireHandle(); + wireClient->SerializeCommand(cmd); + + return ToAPI(texture); +} + +Texture::Texture(const ObjectBaseParams& params, const WGPUTextureDescriptor* descriptor) + : ObjectBase(params), + mSize(descriptor->size), + mMipLevelCount(descriptor->mipLevelCount), + mSampleCount(descriptor->sampleCount), + mDimension(descriptor->dimension), + mFormat(descriptor->format), + mUsage(static_cast(descriptor->usage)) {} + +Texture::~Texture() = default; + +uint32_t Texture::GetWidth() const { + return mSize.width; +} + +uint32_t Texture::GetHeight() const { + return mSize.height; +} + +uint32_t Texture::GetDepthOrArrayLayers() const { + return mSize.depthOrArrayLayers; +} + +uint32_t Texture::GetMipLevelCount() const { + return mMipLevelCount; +} + +uint32_t Texture::GetSampleCount() const { + return mSampleCount; +} + +WGPUTextureDimension Texture::GetDimension() const { + return mDimension; +} + +WGPUTextureFormat Texture::GetFormat() const { + return mFormat; +} + +WGPUTextureUsage Texture::GetUsage() const { + return mUsage; +} + +} // namespace dawn::wire::client diff --git a/src/dawn/wire/client/Texture.h b/src/dawn/wire/client/Texture.h new file mode 100644 index 0000000000..9798f9174e --- /dev/null +++ b/src/dawn/wire/client/Texture.h @@ -0,0 +1,55 @@ +// Copyright 2022 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_WIRE_CLIENT_TEXTURE_H_ +#define SRC_DAWN_WIRE_CLIENT_TEXTURE_H_ + +#include "dawn/webgpu.h" + +#include "dawn/wire/client/ObjectBase.h" + +namespace dawn::wire::client { + +class Device; + +class Texture final : public ObjectBase { + public: + static WGPUTexture Create(Device* device, const WGPUTextureDescriptor* descriptor); + static WGPUTexture CreateError(Device* device, const WGPUTextureDescriptor* descriptor); + + Texture(const ObjectBaseParams& params, const WGPUTextureDescriptor* descriptor); + ~Texture() override; + + // Note that these values can be arbitrary since they aren't validated in the wire client. + uint32_t GetWidth() const; + uint32_t GetHeight() const; + uint32_t GetDepthOrArrayLayers() const; + uint32_t GetMipLevelCount() const; + uint32_t GetSampleCount() const; + WGPUTextureDimension GetDimension() const; + WGPUTextureFormat GetFormat() const; + WGPUTextureUsage GetUsage() const; + + private: + WGPUExtent3D mSize; + uint32_t mMipLevelCount; + uint32_t mSampleCount; + WGPUTextureDimension mDimension; + WGPUTextureFormat mFormat; + WGPUTextureUsage mUsage; +}; + +} // namespace dawn::wire::client + +#endif // SRC_DAWN_WIRE_CLIENT_TEXTURE_H_ diff --git a/src/dawn/wire/server/ObjectStorage.h b/src/dawn/wire/server/ObjectStorage.h index 06fbc04dac..1bef0ad844 100644 --- a/src/dawn/wire/server/ObjectStorage.h +++ b/src/dawn/wire/server/ObjectStorage.h @@ -27,12 +27,6 @@ namespace dawn::wire::server { -struct DeviceInfo { - std::unordered_set childObjectTypesAndIds; - Server* server; - ObjectHandle self; -}; - // Whether this object has been allocated, or reserved for async object creation. // Used by the KnownObjects queries enum class AllocationState : uint32_t { @@ -48,9 +42,6 @@ struct ObjectDataBase { uint32_t generation = 0; AllocationState state; - - // This points to an allocation that is owned by the device. - DeviceInfo* deviceInfo = nullptr; }; // Stores what the backend knows about the type. @@ -70,35 +61,25 @@ struct ObjectData : public ObjectDataBase { bool mappedAtCreation = false; }; -// Pack the ObjectType and ObjectId as a single value for storage in -// an std::unordered_set. This lets us avoid providing our own hash and -// equality comparison operators. -inline uint64_t PackObjectTypeAndId(ObjectType type, ObjectId id) { - static_assert(sizeof(ObjectType) * 8 <= 32); - static_assert(sizeof(ObjectId) * 8 <= 32); - return (static_cast(type) << 32) + id; -} - -inline std::pair UnpackObjectTypeAndId(uint64_t payload) { - ObjectType type = static_cast(payload >> 32); - ObjectId id = payload & 0xFFFFFFFF; - return std::make_pair(type, id); -} +struct DeviceInfo { + Server* server; + ObjectHandle self; +}; template <> struct ObjectData : public ObjectDataBase { // Store |info| as a separate allocation so that its address does not move. - // The pointer to |info| is stored in device child objects. + // The pointer to |info| is used as the userdata to device callback. std::unique_ptr info = std::make_unique(); }; // Keeps track of the mapping between client IDs and backend objects. template -class KnownObjects { +class KnownObjectsBase { public: using Data = ObjectData; - KnownObjects() { + KnownObjectsBase() { // Reserve ID 0 so that it can be used to represent nullptr for optional object values // in the wire format. However don't tag it as allocated so that it is an error to ask // KnownObjects for ID 0. @@ -110,30 +91,35 @@ class KnownObjects { // Get a backend objects for a given client ID. // Returns nullptr if the ID hasn't previously been allocated. - const Data* Get(uint32_t id, AllocationState expected = AllocationState::Allocated) const { + const Data* Get(uint32_t id) const { if (id >= mKnown.size()) { return nullptr; } const Data* data = &mKnown[id]; - - if (data->state != expected) { + if (data->state != AllocationState::Allocated) { return nullptr; } - return data; } - Data* Get(uint32_t id, AllocationState expected = AllocationState::Allocated) { + Data* Get(uint32_t id) { if (id >= mKnown.size()) { return nullptr; } Data* data = &mKnown[id]; - - if (data->state != expected) { + if (data->state != AllocationState::Allocated) { return nullptr; } + return data; + } + Data* FillReservation(uint32_t id, T handle) { + ASSERT(id < mKnown.size()); + Data* data = &mKnown[id]; + ASSERT(data->state == AllocationState::Reserved); + data->handle = handle; + data->state = AllocationState::Allocated; return data; } @@ -181,9 +167,9 @@ class KnownObjects { return objects; } - std::vector GetAllHandles() { + std::vector GetAllHandles() const { std::vector objects; - for (Data& data : mKnown) { + for (const Data& data : mKnown) { if (data.state == AllocationState::Allocated && data.handle != nullptr) { objects.push_back(data.handle); } @@ -192,10 +178,50 @@ class KnownObjects { return objects; } - private: + protected: std::vector mKnown; }; +template +class KnownObjects : public KnownObjectsBase { + public: + KnownObjects() = default; +}; + +template <> +class KnownObjects : public KnownObjectsBase { + public: + KnownObjects() = default; + + Data* Allocate(uint32_t id, AllocationState state = AllocationState::Allocated) { + Data* data = KnownObjectsBase::Allocate(id, state); + AddToKnownSet(data); + return data; + } + + Data* FillReservation(uint32_t id, WGPUDevice handle) { + Data* data = KnownObjectsBase::FillReservation(id, handle); + AddToKnownSet(data); + return data; + } + + void Free(uint32_t id) { + mKnownSet.erase(mKnown[id].handle); + KnownObjectsBase::Free(id); + } + + bool IsKnown(WGPUDevice device) const { return mKnownSet.count(device) != 0; } + + private: + void AddToKnownSet(Data* data) { + if (data != nullptr && data->state == AllocationState::Allocated && + data->handle != nullptr) { + mKnownSet.insert(data->handle); + } + } + std::unordered_set mKnownSet; +}; + // ObjectIds are lost in deserialization. Store the ids of deserialized // objects here so they can be used in command handlers. This is useful // for creating ReturnWireCmds which contain client ids diff --git a/src/dawn/wire/server/Server.cpp b/src/dawn/wire/server/Server.cpp index 565154e39e..2796966a4c 100644 --- a/src/dawn/wire/server/Server.cpp +++ b/src/dawn/wire/server/Server.cpp @@ -17,6 +17,9 @@ namespace dawn::wire::server { +CallbackUserdata::CallbackUserdata(Server* server, const std::shared_ptr& serverIsAlive) + : server(server), serverIsAlive(serverIsAlive) {} + Server::Server(const DawnProcTable& procs, CommandSerializer* serializer, MemoryTransferService* memoryTransferService) @@ -59,11 +62,6 @@ bool Server::InjectTexture(WGPUTexture texture, data->handle = texture; data->generation = generation; data->state = AllocationState::Allocated; - data->deviceInfo = device->info.get(); - - if (!TrackDeviceChild(data->deviceInfo, ObjectType::Texture, id)) { - return false; - } // The texture is externally owned so it shouldn't be destroyed when we receive a destroy // message from the client. Add a reference to counterbalance the eventual release. @@ -91,11 +89,6 @@ bool Server::InjectSwapChain(WGPUSwapChain swapchain, data->handle = swapchain; data->generation = generation; data->state = AllocationState::Allocated; - data->deviceInfo = device->info.get(); - - if (!TrackDeviceChild(data->deviceInfo, ObjectType::SwapChain, id)) { - return false; - } // The texture is externally owned so it shouldn't be destroyed when we receive a destroy // message from the client. Add a reference to counterbalance the eventual release. @@ -152,11 +145,18 @@ WGPUDevice Server::GetDevice(uint32_t id, uint32_t generation) { return data->handle; } +bool Server::IsDeviceKnown(WGPUDevice device) const { + return DeviceObjects().IsKnown(device); +} + void Server::SetForwardingDeviceCallbacks(ObjectData* deviceObject) { // Note: these callbacks are manually inlined here since they do not acquire and // free their userdata. Also unlike other callbacks, these are cleared and unset when // the server is destroyed, so we don't need to check if the server is still alive // inside them. + // Also, the device is special-cased in Server::DoDestroyObject to call + // ClearDeviceCallbacks. This ensures that callbacks will not fire after |deviceObject| + // is freed. mProcs.deviceSetUncapturedErrorCallback( deviceObject->handle, [](WGPUErrorType type, const char* message, void* userdata) { @@ -190,24 +190,4 @@ void Server::ClearDeviceCallbacks(WGPUDevice device) { mProcs.deviceSetDeviceLostCallback(device, nullptr, nullptr); } -bool TrackDeviceChild(DeviceInfo* info, ObjectType type, ObjectId id) { - auto [_, inserted] = info->childObjectTypesAndIds.insert(PackObjectTypeAndId(type, id)); - if (!inserted) { - // An object of this type and id already exists. - return false; - } - return true; -} - -bool UntrackDeviceChild(DeviceInfo* info, ObjectType type, ObjectId id) { - auto& children = info->childObjectTypesAndIds; - auto it = children.find(PackObjectTypeAndId(type, id)); - if (it == children.end()) { - // An object of this type and id was already deleted. - return false; - } - children.erase(it); - return true; -} - } // namespace dawn::wire::server diff --git a/src/dawn/wire/server/Server.h b/src/dawn/wire/server/Server.h index 52901b0966..281275685c 100644 --- a/src/dawn/wire/server/Server.h +++ b/src/dawn/wire/server/Server.h @@ -55,8 +55,7 @@ struct CallbackUserdata { std::weak_ptr const serverIsAlive; CallbackUserdata() = delete; - CallbackUserdata(Server* server, const std::shared_ptr& serverIsAlive) - : server(server), serverIsAlive(serverIsAlive) {} + CallbackUserdata(Server* server, const std::shared_ptr& serverIsAlive); }; template @@ -171,6 +170,7 @@ class Server : public ServerBase { bool InjectInstance(WGPUInstance instance, uint32_t id, uint32_t generation); WGPUDevice GetDevice(uint32_t id, uint32_t generation); + bool IsDeviceKnown(WGPUDevice device) const; template ::value>> @@ -234,9 +234,6 @@ class Server : public ServerBase { std::shared_ptr mIsAlive; }; -bool TrackDeviceChild(DeviceInfo* device, ObjectType type, ObjectId id); -bool UntrackDeviceChild(DeviceInfo* device, ObjectType type, ObjectId id); - std::unique_ptr CreateInlineMemoryTransferService(); } // namespace dawn::wire::server diff --git a/src/dawn/wire/server/ServerAdapter.cpp b/src/dawn/wire/server/ServerAdapter.cpp index 67e5d46017..9735d26cd4 100644 --- a/src/dawn/wire/server/ServerAdapter.cpp +++ b/src/dawn/wire/server/ServerAdapter.cpp @@ -50,11 +50,6 @@ void Server::OnRequestDeviceCallback(RequestDeviceUserdata* data, WGPURequestDeviceStatus status, WGPUDevice device, const char* message) { - auto* deviceObject = DeviceObjects().Get(data->deviceObjectId, AllocationState::Reserved); - // Should be impossible to fail. ObjectIds can't be freed by a destroy command until - // they move from Reserved to Allocated, or if they are destroyed here. - ASSERT(deviceObject != nullptr); - ReturnAdapterRequestDeviceCallbackCmd cmd = {}; cmd.adapter = data->adapter; cmd.requestSerial = data->requestSerial; @@ -101,8 +96,10 @@ void Server::OnRequestDeviceCallback(RequestDeviceUserdata* data, cmd.limits = &limits; // Assign the handle and allocated status if the device is created successfully. - deviceObject->state = AllocationState::Allocated; - deviceObject->handle = device; + auto* deviceObject = DeviceObjects().FillReservation(data->deviceObjectId, device); + ASSERT(deviceObject != nullptr); + deviceObject->info->server = this; + deviceObject->info->self = ObjectHandle{data->deviceObjectId, deviceObject->generation}; SetForwardingDeviceCallbacks(deviceObject); SerializeCommand(cmd); diff --git a/src/dawn/wire/server/ServerBuffer.cpp b/src/dawn/wire/server/ServerBuffer.cpp index ff17809bf3..61d5e15423 100644 --- a/src/dawn/wire/server/ServerBuffer.cpp +++ b/src/dawn/wire/server/ServerBuffer.cpp @@ -116,12 +116,8 @@ bool Server::DoDeviceCreateBuffer(ObjectId deviceId, } resultData->generation = bufferResult.generation; resultData->handle = mProcs.deviceCreateBuffer(device->handle, descriptor); - resultData->deviceInfo = device->info.get(); resultData->usage = descriptor->usage; resultData->mappedAtCreation = descriptor->mappedAtCreation; - if (!TrackDeviceChild(resultData->deviceInfo, ObjectType::Buffer, bufferResult.id)) { - return false; - } // isReadMode and isWriteMode could be true at the same time if usage contains // WGPUMapMode_Read and buffer is mappedAtCreation diff --git a/src/dawn/wire/server/ServerDevice.cpp b/src/dawn/wire/server/ServerDevice.cpp index 0a1fff5e3e..27978155a3 100644 --- a/src/dawn/wire/server/ServerDevice.cpp +++ b/src/dawn/wire/server/ServerDevice.cpp @@ -19,27 +19,13 @@ namespace dawn::wire::server { namespace { template -void HandleCreateRenderPipelineAsyncCallbackResult(KnownObjects* knownObjects, - WGPUCreatePipelineAsyncStatus status, - Pipeline pipeline, - CreatePipelineAsyncUserData* data) { - // May be null if the device was destroyed. Device destruction destroys child - // objects on the wire. - auto* pipelineObject = knownObjects->Get(data->pipelineObjectID, AllocationState::Reserved); - // Should be impossible to fail. ObjectIds can't be freed by a destroy command until - // they move from Reserved to Allocated, or if they are destroyed here. - ASSERT(pipelineObject != nullptr); - +void HandleCreatePipelineAsyncCallback(KnownObjects* knownObjects, + WGPUCreatePipelineAsyncStatus status, + Pipeline pipeline, + CreatePipelineAsyncUserData* data) { if (status == WGPUCreatePipelineAsyncStatus_Success) { - // Assign the handle and allocated status if the pipeline is created successfully. - pipelineObject->state = AllocationState::Allocated; - pipelineObject->handle = pipeline; - - // This should be impossible to fail. It would require a command to be sent that - // creates a duplicate ObjectId, which would fail validation. - bool success = - TrackDeviceChild(pipelineObject->deviceInfo, objectType, data->pipelineObjectID); - ASSERT(success); + auto* pipelineObject = knownObjects->FillReservation(data->pipelineObjectID, pipeline); + ASSERT(pipelineObject != nullptr); } else { // Otherwise, free the ObjectId which will make it unusable. knownObjects->Free(data->pipelineObjectID); @@ -119,7 +105,6 @@ bool Server::DoDeviceCreateComputePipelineAsync(ObjectId deviceId, } resultData->generation = pipelineObjectHandle.generation; - resultData->deviceInfo = device->info.get(); auto userdata = MakeUserdata(); userdata->device = ObjectHandle{deviceId, device->generation}; @@ -136,8 +121,8 @@ void Server::OnCreateComputePipelineAsyncCallback(CreatePipelineAsyncUserData* d WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, const char* message) { - HandleCreateRenderPipelineAsyncCallbackResult( - &ComputePipelineObjects(), status, pipeline, data); + HandleCreatePipelineAsyncCallback(&ComputePipelineObjects(), + status, pipeline, data); ReturnDeviceCreateComputePipelineAsyncCallbackCmd cmd; cmd.device = data->device; @@ -164,7 +149,6 @@ bool Server::DoDeviceCreateRenderPipelineAsync(ObjectId deviceId, } resultData->generation = pipelineObjectHandle.generation; - resultData->deviceInfo = device->info.get(); auto userdata = MakeUserdata(); userdata->device = ObjectHandle{deviceId, device->generation}; @@ -181,8 +165,8 @@ void Server::OnCreateRenderPipelineAsyncCallback(CreatePipelineAsyncUserData* da WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, const char* message) { - HandleCreateRenderPipelineAsyncCallbackResult( - &RenderPipelineObjects(), status, pipeline, data); + HandleCreatePipelineAsyncCallback(&RenderPipelineObjects(), status, + pipeline, data); ReturnDeviceCreateRenderPipelineAsyncCallbackCmd cmd; cmd.device = data->device; diff --git a/src/dawn/wire/server/ServerInlineMemoryTransferService.cpp b/src/dawn/wire/server/ServerInlineMemoryTransferService.cpp index 6f5884a798..84ecb7b182 100644 --- a/src/dawn/wire/server/ServerInlineMemoryTransferService.cpp +++ b/src/dawn/wire/server/ServerInlineMemoryTransferService.cpp @@ -55,7 +55,7 @@ class InlineMemoryTransferService : public MemoryTransferService { deserializePointer == nullptr) { return false; } - if ((offset >= mDataLength && offset > 0) || size > mDataLength - offset) { + if (offset > mDataLength || size > mDataLength - offset) { return false; } memcpy(static_cast(mTargetData) + offset, deserializePointer, size); diff --git a/src/dawn/wire/server/ServerInstance.cpp b/src/dawn/wire/server/ServerInstance.cpp index d3998a38c1..dcdf62cc24 100644 --- a/src/dawn/wire/server/ServerInstance.cpp +++ b/src/dawn/wire/server/ServerInstance.cpp @@ -51,11 +51,6 @@ void Server::OnRequestAdapterCallback(RequestAdapterUserdata* data, WGPURequestAdapterStatus status, WGPUAdapter adapter, const char* message) { - auto* adapterObject = AdapterObjects().Get(data->adapterObjectId, AllocationState::Reserved); - // Should be impossible to fail. ObjectIds can't be freed by a destroy command until - // they move from Reserved to Allocated, or if they are destroyed here. - ASSERT(adapterObject != nullptr); - ReturnInstanceRequestAdapterCallbackCmd cmd = {}; cmd.instance = data->instance; cmd.requestSerial = data->requestSerial; @@ -75,8 +70,8 @@ void Server::OnRequestAdapterCallback(RequestAdapterUserdata* data, std::vector features; // Assign the handle and allocated status if the adapter is created successfully. - adapterObject->state = AllocationState::Allocated; - adapterObject->handle = adapter; + auto* adapterObject = AdapterObjects().FillReservation(data->adapterObjectId, adapter); + ASSERT(adapterObject != nullptr); size_t featuresCount = mProcs.adapterEnumerateFeatures(adapter, nullptr); features.resize(featuresCount); diff --git a/src/dawn/wire/server/ServerQueue.cpp b/src/dawn/wire/server/ServerQueue.cpp index 3ea8dabaef..3e44008254 100644 --- a/src/dawn/wire/server/ServerQueue.cpp +++ b/src/dawn/wire/server/ServerQueue.cpp @@ -59,12 +59,7 @@ bool Server::DoQueueWriteBuffer(ObjectId queueId, } if (size > std::numeric_limits::max()) { - auto* device = DeviceObjects().Get(queue->deviceInfo->self.id); - if (device == nullptr) { - return false; - } - return DoDeviceInjectError(reinterpret_cast(device), WGPUErrorType_OutOfMemory, - "Data size too large for write texture."); + return false; } mProcs.queueWriteBuffer(queue->handle, buffer->handle, bufferOffset, data, @@ -86,12 +81,7 @@ bool Server::DoQueueWriteTexture(ObjectId queueId, } if (dataSize > std::numeric_limits::max()) { - auto* device = DeviceObjects().Get(queue->deviceInfo->self.id); - if (device == nullptr) { - return false; - } - return DoDeviceInjectError(reinterpret_cast(device), WGPUErrorType_OutOfMemory, - "Data size too large for write texture."); + return false; } mProcs.queueWriteTexture(queue->handle, destination, data, static_cast(dataSize), diff --git a/src/dawn_native/BUILD.gn b/src/dawn_native/BUILD.gn deleted file mode 100644 index e811642bcc..0000000000 --- a/src/dawn_native/BUILD.gn +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2022 The Dawn Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -################################################################################ -# Build target aliases -# TODO(crbug.com/dawn/1275) - remove these -################################################################################ -group("dawn_native") { - public_deps = [ "../dawn/native" ] -} -group("webgpu_dawn") { - public_deps = [ "../dawn/native:webgpu_dawn" ] -} diff --git a/src/dawn_platform/BUILD.gn b/src/dawn_platform/BUILD.gn deleted file mode 100644 index 92df854432..0000000000 --- a/src/dawn_platform/BUILD.gn +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2022 The Dawn Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -################################################################################ -# Build target aliases -# TODO(crbug.com/dawn/1275) - remove these -################################################################################ -group("dawn_platform") { - public_deps = [ "../dawn/platform" ] -} diff --git a/src/dawn_wire/BUILD.gn b/src/dawn_wire/BUILD.gn deleted file mode 100644 index 13a9a903d3..0000000000 --- a/src/dawn_wire/BUILD.gn +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2022 The Dawn Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -################################################################################ -# Build target aliases -# TODO(crbug.com/dawn/1275) - remove these -################################################################################ -group("dawn_wire") { - public_deps = [ "../dawn/wire" ] -} -group("dawn_wire_headers") { - public_deps = [ "../dawn/wire:headers" ] -} diff --git a/src/fuzzers/dawn/BUILD.gn b/src/fuzzers/dawn/BUILD.gn deleted file mode 100644 index a2756c70c4..0000000000 --- a/src/fuzzers/dawn/BUILD.gn +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2022 The Dawn Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -################################################################################ -# Build target aliases -# TODO(crbug.com/dawn/1275) - remove these -################################################################################ -group("dawn_fuzzers") { - public_deps = [ "../../dawn/fuzzers" ] - testonly = true -} diff --git a/src/include/README.md b/src/include/README.md deleted file mode 100644 index 8111f628c5..0000000000 --- a/src/include/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# TODO(crbug.com/dawn/1275) - remove this directory - -This directory exists as a temporary include directory while migrating Chromium source to the new Dawn include layout. -All headers in the subdirectories simply #include to the new location for the header. diff --git a/src/include/dawn/EnumClassBitmasks.h b/src/include/dawn/EnumClassBitmasks.h deleted file mode 100644 index 7d76b37792..0000000000 --- a/src/include/dawn/EnumClassBitmasks.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_ENUMCLASSBITMASKS_H_ -#define SRC_INCLUDE_DAWN_ENUMCLASSBITMASKS_H_ - -#include "dawn/EnumClassBitmasks.h" - -#endif // SRC_INCLUDE_DAWN_ENUMCLASSBITMASKS_H_ diff --git a/src/include/dawn/dawn_proc.h b/src/include/dawn/dawn_proc.h deleted file mode 100644 index 2bea48b5ea..0000000000 --- a/src/include/dawn/dawn_proc.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_DAWN_PROC_H_ -#define SRC_INCLUDE_DAWN_DAWN_PROC_H_ - -#include "dawn/dawn_proc.h" - -#endif // SRC_INCLUDE_DAWN_DAWN_PROC_H_ diff --git a/src/include/dawn/dawn_thread_dispatch_proc.h b/src/include/dawn/dawn_thread_dispatch_proc.h deleted file mode 100644 index 126e50cafd..0000000000 --- a/src/include/dawn/dawn_thread_dispatch_proc.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_DAWN_THREAD_DISPATCH_PROC_H_ -#define SRC_INCLUDE_DAWN_DAWN_THREAD_DISPATCH_PROC_H_ - -#include "dawn/dawn_thread_dispatch_proc.h" - -#endif // SRC_INCLUDE_DAWN_DAWN_THREAD_DISPATCH_PROC_H_ diff --git a/src/include/dawn/dawn_wsi.h b/src/include/dawn/dawn_wsi.h deleted file mode 100644 index 3803d3911d..0000000000 --- a/src/include/dawn/dawn_wsi.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_DAWN_WSI_H_ -#define SRC_INCLUDE_DAWN_DAWN_WSI_H_ - -#include "dawn/dawn_wsi.h" - -#endif // SRC_INCLUDE_DAWN_DAWN_WSI_H_ diff --git a/src/include/dawn/webgpu.h b/src/include/dawn/webgpu.h deleted file mode 100644 index 2fec78c3c2..0000000000 --- a/src/include/dawn/webgpu.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_WEBGPU_H_ -#define SRC_INCLUDE_DAWN_WEBGPU_H_ - -#include "dawn/webgpu.h" - -#endif // SRC_INCLUDE_DAWN_WEBGPU_H_ diff --git a/src/include/dawn/webgpu_cpp.h b/src/include/dawn/webgpu_cpp.h deleted file mode 100644 index 45ca2b211a..0000000000 --- a/src/include/dawn/webgpu_cpp.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_WEBGPU_CPP_H_ -#define SRC_INCLUDE_DAWN_WEBGPU_CPP_H_ - -#include "dawn/webgpu_cpp.h" - -#endif // SRC_INCLUDE_DAWN_WEBGPU_CPP_H_ diff --git a/src/include/dawn_native/D3D12Backend.h b/src/include/dawn_native/D3D12Backend.h deleted file mode 100644 index c740c81b0d..0000000000 --- a/src/include/dawn_native/D3D12Backend.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_NATIVE_D3D12BACKEND_H_ -#define SRC_INCLUDE_DAWN_NATIVE_D3D12BACKEND_H_ - -#include "dawn/native/D3D12Backend.h" - -#endif // SRC_INCLUDE_DAWN_NATIVE_D3D12BACKEND_H_ diff --git a/src/include/dawn_native/DawnNative.h b/src/include/dawn_native/DawnNative.h deleted file mode 100644 index 197187f21b..0000000000 --- a/src/include/dawn_native/DawnNative.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_NATIVE_DAWNNATIVE_H_ -#define SRC_INCLUDE_DAWN_NATIVE_DAWNNATIVE_H_ - -#include "dawn/native/DawnNative.h" - -#endif // SRC_INCLUDE_DAWN_NATIVE_DAWNNATIVE_H_ diff --git a/src/include/dawn_native/MetalBackend.h b/src/include/dawn_native/MetalBackend.h deleted file mode 100644 index 38ce8748f8..0000000000 --- a/src/include/dawn_native/MetalBackend.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_NATIVE_METALBACKEND_H_ -#define SRC_INCLUDE_DAWN_NATIVE_METALBACKEND_H_ - -#include "dawn/native/MetalBackend.h" - -#endif // SRC_INCLUDE_DAWN_NATIVE_METALBACKEND_H_ diff --git a/src/include/dawn_native/NullBackend.h b/src/include/dawn_native/NullBackend.h deleted file mode 100644 index e09f36b651..0000000000 --- a/src/include/dawn_native/NullBackend.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_NATIVE_NULLBACKEND_H_ -#define SRC_INCLUDE_DAWN_NATIVE_NULLBACKEND_H_ - -#include "dawn/native/NullBackend.h" - -#endif // SRC_INCLUDE_DAWN_NATIVE_NULLBACKEND_H_ diff --git a/src/include/dawn_native/OpenGLBackend.h b/src/include/dawn_native/OpenGLBackend.h deleted file mode 100644 index 73800a0d94..0000000000 --- a/src/include/dawn_native/OpenGLBackend.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_NATIVE_OPENGLBACKEND_H_ -#define SRC_INCLUDE_DAWN_NATIVE_OPENGLBACKEND_H_ - -#include "dawn/native/OpenGLBackend.h" - -#endif // SRC_INCLUDE_DAWN_NATIVE_OPENGLBACKEND_H_ diff --git a/src/include/dawn_native/VulkanBackend.h b/src/include/dawn_native/VulkanBackend.h deleted file mode 100644 index 82e2e5304d..0000000000 --- a/src/include/dawn_native/VulkanBackend.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_NATIVE_VULKANBACKEND_H_ -#define SRC_INCLUDE_DAWN_NATIVE_VULKANBACKEND_H_ - -#include "dawn/native/VulkanBackend.h" - -#endif // SRC_INCLUDE_DAWN_NATIVE_VULKANBACKEND_H_ diff --git a/src/include/dawn_native/dawn_native_export.h b/src/include/dawn_native/dawn_native_export.h deleted file mode 100644 index 7edd9bc4e7..0000000000 --- a/src/include/dawn_native/dawn_native_export.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_NATIVE_DAWN_NATIVE_EXPORT_H_ -#define SRC_INCLUDE_DAWN_NATIVE_DAWN_NATIVE_EXPORT_H_ - -#include "dawn/native/dawn_native_export.h" - -#endif // SRC_INCLUDE_DAWN_NATIVE_DAWN_NATIVE_EXPORT_H_ diff --git a/src/include/dawn_platform/DawnPlatform.h b/src/include/dawn_platform/DawnPlatform.h deleted file mode 100644 index 75faafc91a..0000000000 --- a/src/include/dawn_platform/DawnPlatform.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_PLATFORM_DAWNPLATFORM_H_ -#define SRC_INCLUDE_DAWN_PLATFORM_DAWNPLATFORM_H_ - -#include "dawn/platform/DawnPlatform.h" - -#endif // SRC_INCLUDE_DAWN_PLATFORM_DAWNPLATFORM_H_ diff --git a/src/include/dawn_wire/Wire.h b/src/include/dawn_wire/Wire.h deleted file mode 100644 index 65924db21d..0000000000 --- a/src/include/dawn_wire/Wire.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_WIRE_WIRE_H_ -#define SRC_INCLUDE_DAWN_WIRE_WIRE_H_ - -#include "dawn/wire/Wire.h" - -#endif // SRC_INCLUDE_DAWN_WIRE_WIRE_H_ diff --git a/src/include/dawn_wire/WireClient.h b/src/include/dawn_wire/WireClient.h deleted file mode 100644 index bf4b589f7a..0000000000 --- a/src/include/dawn_wire/WireClient.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_WIRE_WIRECLIENT_H_ -#define SRC_INCLUDE_DAWN_WIRE_WIRECLIENT_H_ - -#include "dawn/wire/WireClient.h" - -#endif // SRC_INCLUDE_DAWN_WIRE_WIRECLIENT_H_ diff --git a/src/include/dawn_wire/WireServer.h b/src/include/dawn_wire/WireServer.h deleted file mode 100644 index d332eaec88..0000000000 --- a/src/include/dawn_wire/WireServer.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_WIRE_WIRESERVER_H_ -#define SRC_INCLUDE_DAWN_WIRE_WIRESERVER_H_ - -#include "dawn/wire/WireServer.h" - -#endif // SRC_INCLUDE_DAWN_WIRE_WIRESERVER_H_ diff --git a/src/include/dawn_wire/dawn_wire_export.h b/src/include/dawn_wire/dawn_wire_export.h deleted file mode 100644 index b1a885e502..0000000000 --- a/src/include/dawn_wire/dawn_wire_export.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_DAWN_WIRE_DAWN_WIRE_EXPORT_H_ -#define SRC_INCLUDE_DAWN_WIRE_DAWN_WIRE_EXPORT_H_ - -#include "dawn/wire/dawn_wire_export.h" - -#endif // SRC_INCLUDE_DAWN_WIRE_DAWN_WIRE_EXPORT_H_ diff --git a/src/include/webgpu/webgpu.h b/src/include/webgpu/webgpu.h deleted file mode 100644 index afce939e54..0000000000 --- a/src/include/webgpu/webgpu.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_WEBGPU_WEBGPU_H_ -#define SRC_INCLUDE_WEBGPU_WEBGPU_H_ - -#include "dawn/webgpu.h" - -#endif // SRC_INCLUDE_WEBGPU_WEBGPU_H_ diff --git a/src/include/webgpu/webgpu_cpp.h b/src/include/webgpu/webgpu_cpp.h deleted file mode 100644 index adf4e4440d..0000000000 --- a/src/include/webgpu/webgpu_cpp.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 The Dawn Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_INCLUDE_WEBGPU_WEBGPU_CPP_H_ -#define SRC_INCLUDE_WEBGPU_WEBGPU_CPP_H_ - -#include "dawn/webgpu_cpp.h" - -#endif // SRC_INCLUDE_WEBGPU_WEBGPU_CPP_H_ diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn index 259a26b51f..d140e1e1c5 100644 --- a/src/tint/BUILD.gn +++ b/src/tint/BUILD.gn @@ -13,8 +13,13 @@ # limitations under the License. import("//build_overrides/build.gni") + import("../../tint_overrides_with_defaults.gni") +if (tint_build_unittests) { + import("//testing/test.gni") +} + ############################################################################### # Common - Configs, etc. shared across targets ############################################################################### @@ -200,10 +205,10 @@ libtint_source_set("libtint_core_all_src") { "ast/bool_literal_expression.h", "ast/break_statement.cc", "ast/break_statement.h", - "ast/builtin.cc", - "ast/builtin.h", "ast/builtin_attribute.cc", "ast/builtin_attribute.h", + "ast/builtin_value.cc", + "ast/builtin_value.h", "ast/call_expression.cc", "ast/call_expression.h", "ast/call_statement.cc", @@ -212,6 +217,8 @@ libtint_source_set("libtint_core_all_src") { "ast/case_statement.h", "ast/compound_assignment_statement.cc", "ast/compound_assignment_statement.h", + "ast/const.cc", + "ast/const.h", "ast/continue_statement.cc", "ast/continue_statement.h", "ast/depth_multisampled_texture.cc", @@ -226,8 +233,12 @@ libtint_source_set("libtint_core_all_src") { "ast/enable.h", "ast/expression.cc", "ast/expression.h", + "ast/extension.cc", + "ast/extension.h", "ast/external_texture.cc", "ast/external_texture.h", + "ast/f16.cc", + "ast/f16.h", "ast/f32.cc", "ast/f32.h", "ast/fallthrough_statement.cc", @@ -260,6 +271,8 @@ libtint_source_set("libtint_core_all_src") { "ast/interpolate_attribute.h", "ast/invariant_attribute.cc", "ast/invariant_attribute.h", + "ast/let.cc", + "ast/let.h", "ast/literal_expression.cc", "ast/literal_expression.h", "ast/location_attribute.cc", @@ -276,6 +289,11 @@ libtint_source_set("libtint_core_all_src") { "ast/multisampled_texture.h", "ast/node.cc", "ast/node.h", + "ast/node_id.h", + "ast/override.cc", + "ast/override.h", + "ast/parameter.cc", + "ast/parameter.h", "ast/phony_expression.cc", "ast/phony_expression.h", "ast/pipeline_stage.cc", @@ -292,6 +310,8 @@ libtint_source_set("libtint_core_all_src") { "ast/stage_attribute.h", "ast/statement.cc", "ast/statement.h", + "ast/static_assert.cc", + "ast/static_assert.h", "ast/storage_class.cc", "ast/storage_class.h", "ast/storage_texture.cc", @@ -310,6 +330,8 @@ libtint_source_set("libtint_core_all_src") { "ast/struct_member_size_attribute.h", "ast/switch_statement.cc", "ast/switch_statement.h", + "ast/texel_format.cc", + "ast/texel_format.h", "ast/texture.cc", "ast/texture.h", "ast/traverse_expressions.h", @@ -324,6 +346,8 @@ libtint_source_set("libtint_core_all_src") { "ast/unary_op.h", "ast/unary_op_expression.cc", "ast/unary_op_expression.h", + "ast/var.cc", + "ast/var.h", "ast/variable.cc", "ast/variable.h", "ast/variable_decl_statement.cc", @@ -332,6 +356,8 @@ libtint_source_set("libtint_core_all_src") { "ast/vector.h", "ast/void.cc", "ast/void.h", + "ast/while_statement.cc", + "ast/while_statement.h", "ast/workgroup_attribute.cc", "ast/workgroup_attribute.h", "castable.cc", @@ -342,7 +368,6 @@ libtint_source_set("libtint_core_all_src") { "debug.h", "demangler.cc", "demangler.h", - "number.h", "diagnostic/diagnostic.cc", "diagnostic/diagnostic.h", "diagnostic/formatter.cc", @@ -357,6 +382,8 @@ libtint_source_set("libtint_core_all_src") { "inspector/resource_binding.h", "inspector/scalar.cc", "inspector/scalar.h", + "number.cc", + "number.h", "program.cc", "program.h", "program_builder.cc", @@ -365,6 +392,10 @@ libtint_source_set("libtint_core_all_src") { "program_id.h", "reader/reader.cc", "reader/reader.h", + "resolver/const_eval.cc", + "resolver/const_eval.h", + "resolver/ctor_conv_intrinsic.cc", + "resolver/ctor_conv_intrinsic.h", "resolver/dependency_graph.cc", "resolver/dependency_graph.h", "resolver/intrinsic_table.cc", @@ -372,12 +403,16 @@ libtint_source_set("libtint_core_all_src") { "resolver/intrinsic_table.inl", "resolver/resolver.cc", "resolver/resolver.h", - "resolver/resolver_constants.cc", "resolver/sem_helper.cc", "resolver/sem_helper.h", + "resolver/uniformity.cc", + "resolver/uniformity.h", "resolver/validator.cc", "resolver/validator.h", "scope_stack.h", + "sem/abstract_float.h", + "sem/abstract_int.h", + "sem/abstract_numeric.h", "sem/array.h", "sem/atomic.h", "sem/behavior.h", @@ -390,14 +425,18 @@ libtint_source_set("libtint_core_all_src") { "sem/constant.h", "sem/depth_multisampled_texture.h", "sem/depth_texture.h", + "sem/evaluation_stage.h", "sem/expression.h", "sem/external_texture.h", + "sem/f16.h", "sem/f32.h", "sem/for_loop_statement.h", "sem/i32.h", "sem/if_statement.h", + "sem/index_accessor_expression.h", "sem/info.h", "sem/loop_statement.h", + "sem/materialize.h", "sem/matrix.h", "sem/module.h", "sem/multisampled_texture.h", @@ -420,6 +459,7 @@ libtint_source_set("libtint_core_all_src") { "sem/u32.h", "sem/vector.h", "sem/void.h", + "sem/while_statement.h", "source.cc", "source.h", "symbol.cc", @@ -451,12 +491,12 @@ libtint_source_set("libtint_core_all_src") { "transform/decompose_strided_array.h", "transform/decompose_strided_matrix.cc", "transform/decompose_strided_matrix.h", + "transform/disable_uniformity_analysis.cc", + "transform/disable_uniformity_analysis.h", "transform/expand_compound_assignment.cc", "transform/expand_compound_assignment.h", "transform/first_index_offset.cc", "transform/first_index_offset.h", - "transform/fold_constants.cc", - "transform/fold_constants.h", "transform/fold_trivial_single_use_lets.cc", "transform/fold_trivial_single_use_lets.h", "transform/for_loop_to_loop.cc", @@ -473,8 +513,8 @@ libtint_source_set("libtint_core_all_src") { "transform/multiplanar_external_texture.h", "transform/num_workgroups_from_uniform.cc", "transform/num_workgroups_from_uniform.h", - "transform/promote_initializers_to_const_var.cc", - "transform/promote_initializers_to_const_var.h", + "transform/promote_initializers_to_let.cc", + "transform/promote_initializers_to_let.h", "transform/promote_side_effects_to_decl.cc", "transform/promote_side_effects_to_decl.h", "transform/remove_continue_in_switch.cc", @@ -491,6 +531,10 @@ libtint_source_set("libtint_core_all_src") { "transform/simplify_pointers.h", "transform/single_entry_point.cc", "transform/single_entry_point.h", + "transform/spirv_atomic.cc", + "transform/spirv_atomic.h", + "transform/substitute_override.cc", + "transform/substitute_override.h", "transform/transform.cc", "transform/transform.h", "transform/unshadow.cc", @@ -507,23 +551,29 @@ libtint_source_set("libtint_core_all_src") { "transform/vectorize_scalar_matrix_constructors.h", "transform/vertex_pulling.cc", "transform/vertex_pulling.h", - "transform/wrap_arrays_in_structs.cc", - "transform/wrap_arrays_in_structs.h", + "transform/while_to_loop.cc", + "transform/while_to_loop.h", "transform/zero_init_workgroup_memory.cc", "transform/zero_init_workgroup_memory.h", "utils/bitcast.h", + "utils/bitset.h", "utils/block_allocator.h", + "utils/compiler_macros.h", + "utils/concat.h", "utils/crc32.h", "utils/debugger.cc", "utils/debugger.h", "utils/enum_set.h", "utils/hash.h", + "utils/hashmap.h", + "utils/hashset.h", "utils/map.h", "utils/math.h", "utils/scoped_assignment.h", "utils/string.h", "utils/unique_allocator.h", "utils/unique_vector.h", + "utils/vector.h", "writer/append_vector.cc", "writer/append_vector.h", "writer/array_length_from_uniform_options.cc", @@ -583,10 +633,13 @@ libtint_source_set("libtint_sem_src") { "sem/depth_multisampled_texture.h", "sem/depth_texture.cc", "sem/depth_texture.h", + "sem/evaluation_stage.h", "sem/expression.cc", "sem/expression.h", "sem/external_texture.cc", "sem/external_texture.h", + "sem/f16.cc", + "sem/f16.h", "sem/f32.cc", "sem/f32.h", "sem/for_loop_statement.cc", @@ -596,10 +649,14 @@ libtint_source_set("libtint_sem_src") { "sem/i32.h", "sem/if_statement.cc", "sem/if_statement.h", + "sem/index_accessor_expression.cc", + "sem/index_accessor_expression.h", "sem/info.cc", "sem/info.h", "sem/loop_statement.cc", "sem/loop_statement.h", + "sem/materialize.cc", + "sem/materialize.h", "sem/matrix.cc", "sem/matrix.h", "sem/member_accessor_expression.cc", @@ -644,6 +701,8 @@ libtint_source_set("libtint_sem_src") { "sem/vector.h", "sem/void.cc", "sem/void.h", + "sem/while_statement.cc", + "sem/while_statement.h", ] public_deps = [ ":libtint_core_all_src" ] @@ -808,3 +867,841 @@ source_set("libtint") { configs += [ "//build/config/compiler:no_chromium_code" ] } } + +if (tint_build_unittests) { + ############################################################################### + # Gtest Gmock - Handle building inside and outside of Chromium. + ############################################################################### + # When building outside of Chromium we need to define our own targets for GTest + # and GMock. However when compiling inside of Chromium we need to reuse the + # existing targets, both because Chromium has a special harness for swarming + # and because otherwise the "gn check" fails. + + if (!build_with_chromium) { + # When we aren't in Chromium we define out own targets based on the location + # of the googletest repo. + config("gtest_config") { + include_dirs = [ + "${tint_googletest_dir}/googletest", + "${tint_googletest_dir}/googletest/include", + ] + } + static_library("gtest") { + testonly = true + sources = [ "${tint_googletest_dir}/googletest/src/gtest-all.cc" ] + public_configs = [ ":gtest_config" ] + } + + config("gmock_config") { + include_dirs = [ + "${tint_googletest_dir}/googlemock", + "${tint_googletest_dir}/googlemock/include", + "${tint_googletest_dir}/googletest/include", + ] + } + + static_library("gmock") { + testonly = true + sources = [ "${tint_googletest_dir}/googlemock/src/gmock-all.cc" ] + public_configs = [ ":gmock_config" ] + } + + group("gmock_and_gtest") { + testonly = true + public_deps = [ + ":gmock", + ":gtest", + ] + } + } else { + # When we are in Chromium we reuse its targets, and also add some deps that + # are needed to launch the test in swarming mode. + group("gmock_and_gtest") { + testonly = true + public_deps = [ + "//base", + "//base/test:test_support", + "//testing/gmock", + "//testing/gtest", + "//third_party/googletest:gmock", + ] + } + } + + ############################################################################### + # Wrapping of Chromium targets + ############################################################################### + # These targets are separated because they are Chromium sources files that + # can't use the tint_internal config, otherwise Tint's warning flags get + # applied while compiling a bunch of Chromium's //base (via header inclusion) + source_set("tint_unittests_main") { + testonly = true + deps = [ ":gmock_and_gtest" ] + if (build_with_chromium) { + sources = [ "//gpu/tint_unittests_main.cc" ] + } else { + sources = [ "test_main.cc" ] + configs += [ ":tint_unittests_config" ] + deps += [ + ":libtint", + ":tint_unittests_hlsl_writer_src", + ":tint_unittests_msl_writer_src", + ":tint_unittests_spv_reader_src", + ] + } + } + + ############################################################################### + # Tests - For libtint core and optional modules + ############################################################################### + config("tint_unittests_config") { + include_dirs = [ + "${tint_googletest_dir}/googlemock/include", + "${tint_googletest_dir}/googletest/include", + ] + + configs = [ + ":tint_common_config", + ":tint_public_config", + ] + } + + template("tint_unittests_source_set") { + source_set(target_name) { + forward_variables_from(invoker, "*", [ "configs" ]) + + if (defined(invoker.configs)) { + configs += invoker.configs + } + configs += [ ":tint_unittests_config" ] + if (build_with_chromium) { + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + } + + testonly = true + + if (!defined(invoker.deps)) { + deps = [] + } + deps += [ + ":gmock_and_gtest", + ":libtint", + ":tint_utils_io", + ] + } + } + + tint_unittests_source_set("tint_unittests_ast_src") { + sources = [ + "ast/alias_test.cc", + "ast/array_test.cc", + "ast/assignment_statement_test.cc", + "ast/atomic_test.cc", + "ast/binary_expression_test.cc", + "ast/binding_attribute_test.cc", + "ast/bitcast_expression_test.cc", + "ast/block_statement_test.cc", + "ast/bool_literal_expression_test.cc", + "ast/bool_test.cc", + "ast/break_statement_test.cc", + "ast/builtin_attribute_test.cc", + "ast/builtin_texture_helper_test.cc", + "ast/builtin_texture_helper_test.h", + "ast/builtin_value_test.cc", + "ast/call_expression_test.cc", + "ast/call_statement_test.cc", + "ast/case_statement_test.cc", + "ast/compound_assignment_statement_test.cc", + "ast/continue_statement_test.cc", + "ast/depth_multisampled_texture_test.cc", + "ast/depth_texture_test.cc", + "ast/discard_statement_test.cc", + "ast/enable_test.cc", + "ast/extension_test.cc", + "ast/external_texture_test.cc", + "ast/f16_test.cc", + "ast/f32_test.cc", + "ast/fallthrough_statement_test.cc", + "ast/float_literal_expression_test.cc", + "ast/for_loop_statement_test.cc", + "ast/function_test.cc", + "ast/group_attribute_test.cc", + "ast/i32_test.cc", + "ast/id_attribute_test.cc", + "ast/identifier_expression_test.cc", + "ast/if_statement_test.cc", + "ast/increment_decrement_statement_test.cc", + "ast/index_accessor_expression_test.cc", + "ast/int_literal_expression_test.cc", + "ast/interpolate_attribute_test.cc", + "ast/invariant_attribute_test.cc", + "ast/location_attribute_test.cc", + "ast/loop_statement_test.cc", + "ast/matrix_test.cc", + "ast/member_accessor_expression_test.cc", + "ast/module_clone_test.cc", + "ast/module_test.cc", + "ast/multisampled_texture_test.cc", + "ast/override_test.cc", + "ast/phony_expression_test.cc", + "ast/pointer_test.cc", + "ast/return_statement_test.cc", + "ast/sampled_texture_test.cc", + "ast/sampler_test.cc", + "ast/stage_attribute_test.cc", + "ast/static_assert_test.cc", + "ast/storage_class_test.cc", + "ast/storage_texture_test.cc", + "ast/stride_attribute_test.cc", + "ast/struct_member_align_attribute_test.cc", + "ast/struct_member_offset_attribute_test.cc", + "ast/struct_member_size_attribute_test.cc", + "ast/struct_member_test.cc", + "ast/struct_test.cc", + "ast/switch_statement_test.cc", + "ast/test_helper.h", + "ast/texel_format_test.cc", + "ast/texture_test.cc", + "ast/traverse_expressions_test.cc", + "ast/u32_test.cc", + "ast/unary_op_expression_test.cc", + "ast/variable_decl_statement_test.cc", + "ast/variable_test.cc", + "ast/vector_test.cc", + "ast/while_statement_test.cc", + "ast/workgroup_attribute_test.cc", + ] + } + + tint_unittests_source_set("tint_unittests_diagnostic_src") { + sources = [ + "diagnostic/diagnostic_test.cc", + "diagnostic/formatter_test.cc", + "diagnostic/printer_test.cc", + ] + } + + tint_unittests_source_set("tint_unittests_inspector_src") { + sources = [ + "inspector/inspector_test.cc", + "inspector/test_inspector_builder.cc", + "inspector/test_inspector_builder.h", + "inspector/test_inspector_runner.cc", + "inspector/test_inspector_runner.h", + ] + } + + tint_unittests_source_set("tint_unittests_resolver_src") { + sources = [ + "resolver/array_accessor_test.cc", + "resolver/assignment_validation_test.cc", + "resolver/atomics_test.cc", + "resolver/atomics_validation_test.cc", + "resolver/attribute_validation_test.cc", + "resolver/bitcast_validation_test.cc", + "resolver/builtin_test.cc", + "resolver/builtin_validation_test.cc", + "resolver/builtins_validation_test.cc", + "resolver/call_test.cc", + "resolver/call_validation_test.cc", + "resolver/compound_assignment_validation_test.cc", + "resolver/compound_statement_test.cc", + "resolver/const_eval_test.cc", + "resolver/control_block_validation_test.cc", + "resolver/dependency_graph_test.cc", + "resolver/entry_point_validation_test.cc", + "resolver/evaluation_stage_test.cc", + "resolver/function_validation_test.cc", + "resolver/host_shareable_validation_test.cc", + "resolver/increment_decrement_validation_test.cc", + "resolver/inferred_type_test.cc", + "resolver/intrinsic_table_test.cc", + "resolver/is_host_shareable_test.cc", + "resolver/is_storeable_test.cc", + "resolver/materialize_test.cc", + "resolver/override_test.cc", + "resolver/ptr_ref_test.cc", + "resolver/ptr_ref_validation_test.cc", + "resolver/resolver_behavior_test.cc", + "resolver/resolver_test.cc", + "resolver/resolver_test_helper.cc", + "resolver/resolver_test_helper.h", + "resolver/side_effects_test.cc", + "resolver/source_variable_test.cc", + "resolver/static_assert_test.cc", + "resolver/storage_class_layout_validation_test.cc", + "resolver/storage_class_validation_test.cc", + "resolver/struct_layout_test.cc", + "resolver/struct_pipeline_stage_use_test.cc", + "resolver/struct_storage_class_use_test.cc", + "resolver/type_constructor_validation_test.cc", + "resolver/type_validation_test.cc", + "resolver/uniformity_test.cc", + "resolver/validation_test.cc", + "resolver/validator_is_storeable_test.cc", + "resolver/variable_test.cc", + "resolver/variable_validation_test.cc", + ] + deps = [ ":tint_unittests_ast_src" ] + } + + tint_unittests_source_set("tint_unittests_sem_src") { + sources = [ + "sem/atomic_test.cc", + "sem/bool_test.cc", + "sem/builtin_test.cc", + "sem/depth_multisampled_texture_test.cc", + "sem/depth_texture_test.cc", + "sem/expression_test.cc", + "sem/external_texture_test.cc", + "sem/f16_test.cc", + "sem/f32_test.cc", + "sem/i32_test.cc", + "sem/matrix_test.cc", + "sem/multisampled_texture_test.cc", + "sem/pointer_test.cc", + "sem/reference_test.cc", + "sem/sampled_texture_test.cc", + "sem/sampler_test.cc", + "sem/sem_array_test.cc", + "sem/sem_struct_test.cc", + "sem/storage_texture_test.cc", + "sem/texture_test.cc", + "sem/type_manager_test.cc", + "sem/type_test.cc", + "sem/u32_test.cc", + "sem/vector_test.cc", + ] + } + + tint_unittests_source_set("tint_unittests_text_src") { + sources = [ "text/unicode_test.cc" ] + } + + tint_unittests_source_set("tint_unittests_transform_src") { + sources = [ + "transform/add_empty_entry_point_test.cc", + "transform/add_spirv_block_attribute_test.cc", + "transform/array_length_from_uniform_test.cc", + "transform/binding_remapper_test.cc", + "transform/builtin_polyfill_test.cc", + "transform/calculate_array_length_test.cc", + "transform/canonicalize_entry_point_io_test.cc", + "transform/combine_samplers_test.cc", + "transform/decompose_memory_access_test.cc", + "transform/decompose_strided_array_test.cc", + "transform/decompose_strided_matrix_test.cc", + "transform/disable_uniformity_analysis_test.cc", + "transform/expand_compound_assignment_test.cc", + "transform/first_index_offset_test.cc", + "transform/fold_trivial_single_use_lets_test.cc", + "transform/for_loop_to_loop_test.cc", + "transform/localize_struct_array_assignment_test.cc", + "transform/loop_to_for_loop_test.cc", + "transform/module_scope_var_to_entry_point_param_test.cc", + "transform/multiplanar_external_texture_test.cc", + "transform/num_workgroups_from_uniform_test.cc", + "transform/promote_initializers_to_let_test.cc", + "transform/promote_side_effects_to_decl_test.cc", + "transform/remove_continue_in_switch_test.cc", + "transform/remove_phonies_test.cc", + "transform/remove_unreachable_statements_test.cc", + "transform/renamer_test.cc", + "transform/robustness_test.cc", + "transform/simplify_pointers_test.cc", + "transform/single_entry_point_test.cc", + "transform/spirv_atomic_test.cc", + "transform/substitute_override_test.cc", + "transform/test_helper.h", + "transform/transform_test.cc", + "transform/unshadow_test.cc", + "transform/unwind_discard_functions_test.cc", + "transform/utils/get_insertion_point_test.cc", + "transform/utils/hoist_to_decl_before_test.cc", + "transform/var_for_dynamic_index_test.cc", + "transform/vectorize_scalar_matrix_constructors_test.cc", + "transform/vertex_pulling_test.cc", + "transform/while_to_loop_test.cc", + "transform/zero_init_workgroup_memory_test.cc", + ] + } + + tint_unittests_source_set("tint_unittests_utils_src") { + sources = [ + "utils/bitcast_test.cc", + "utils/bitset_test.cc", + "utils/crc32_test.cc", + "utils/defer_test.cc", + "utils/enum_set_test.cc", + "utils/hash_test.cc", + "utils/hashmap_test.cc", + "utils/hashset_test.cc", + "utils/io/command_test.cc", + "utils/io/tmpfile_test.cc", + "utils/map_test.cc", + "utils/math_test.cc", + "utils/result_test.cc", + "utils/reverse_test.cc", + "utils/scoped_assignment_test.cc", + "utils/string_test.cc", + "utils/transform_test.cc", + "utils/unique_allocator_test.cc", + "utils/unique_vector_test.cc", + "utils/vector_test.cc", + ] + } + + tint_unittests_source_set("tint_unittests_writer_src") { + sources = [ + "writer/append_vector_test.cc", + "writer/flatten_bindings_test.cc", + "writer/float_to_string_test.cc", + "writer/generate_external_texture_bindings_test.cc", + "writer/text_generator_test.cc", + ] + } + + tint_unittests_source_set("tint_unittests_spv_reader_src") { + sources = [ + "reader/spirv/enum_converter_test.cc", + "reader/spirv/fail_stream_test.cc", + "reader/spirv/function_arithmetic_test.cc", + "reader/spirv/function_bit_test.cc", + "reader/spirv/function_call_test.cc", + "reader/spirv/function_cfg_test.cc", + "reader/spirv/function_composite_test.cc", + "reader/spirv/function_conversion_test.cc", + "reader/spirv/function_decl_test.cc", + "reader/spirv/function_glsl_std_450_test.cc", + "reader/spirv/function_logical_test.cc", + "reader/spirv/function_memory_test.cc", + "reader/spirv/function_misc_test.cc", + "reader/spirv/function_var_test.cc", + "reader/spirv/namer_test.cc", + "reader/spirv/parser_impl_barrier_test.cc", + "reader/spirv/parser_impl_convert_member_decoration_test.cc", + "reader/spirv/parser_impl_convert_type_test.cc", + "reader/spirv/parser_impl_function_decl_test.cc", + "reader/spirv/parser_impl_get_decorations_test.cc", + "reader/spirv/parser_impl_handle_test.cc", + "reader/spirv/parser_impl_import_test.cc", + "reader/spirv/parser_impl_module_var_test.cc", + "reader/spirv/parser_impl_named_types_test.cc", + "reader/spirv/parser_impl_test.cc", + "reader/spirv/parser_impl_test_helper.cc", + "reader/spirv/parser_impl_test_helper.h", + "reader/spirv/parser_impl_user_name_test.cc", + "reader/spirv/parser_test.cc", + "reader/spirv/parser_type_test.cc", + "reader/spirv/spirv_tools_helpers_test.cc", + "reader/spirv/spirv_tools_helpers_test.h", + "reader/spirv/usage_test.cc", + ] + + deps = [ ":libtint_spv_reader_src" ] + } + + tint_unittests_source_set("tint_unittests_spv_writer_src") { + sources = [ + "writer/spirv/binary_writer_test.cc", + "writer/spirv/builder_accessor_expression_test.cc", + "writer/spirv/builder_assign_test.cc", + "writer/spirv/builder_binary_expression_test.cc", + "writer/spirv/builder_bitcast_expression_test.cc", + "writer/spirv/builder_block_test.cc", + "writer/spirv/builder_builtin_test.cc", + "writer/spirv/builder_builtin_texture_test.cc", + "writer/spirv/builder_call_test.cc", + "writer/spirv/builder_constructor_expression_test.cc", + "writer/spirv/builder_discard_test.cc", + "writer/spirv/builder_entry_point_test.cc", + "writer/spirv/builder_format_conversion_test.cc", + "writer/spirv/builder_function_attribute_test.cc", + "writer/spirv/builder_function_test.cc", + "writer/spirv/builder_function_variable_test.cc", + "writer/spirv/builder_global_variable_test.cc", + "writer/spirv/builder_ident_expression_test.cc", + "writer/spirv/builder_if_test.cc", + "writer/spirv/builder_literal_test.cc", + "writer/spirv/builder_loop_test.cc", + "writer/spirv/builder_return_test.cc", + "writer/spirv/builder_static_assert_test.cc", + "writer/spirv/builder_switch_test.cc", + "writer/spirv/builder_test.cc", + "writer/spirv/builder_type_test.cc", + "writer/spirv/builder_unary_op_expression_test.cc", + "writer/spirv/instruction_test.cc", + "writer/spirv/operand_test.cc", + "writer/spirv/scalar_constant_test.cc", + "writer/spirv/spv_dump.cc", + "writer/spirv/spv_dump.h", + "writer/spirv/test_helper.h", + ] + + deps = [ + ":libtint_spv_writer_src", + ":tint_unittests_ast_src", + "${tint_spirv_tools_dir}/:spvtools", + ] + } + + tint_unittests_source_set("tint_unittests_wgsl_reader_src") { + sources = [ + "reader/wgsl/lexer_test.cc", + "reader/wgsl/parser_impl_additive_expression_test.cc", + "reader/wgsl/parser_impl_argument_expression_list_test.cc", + "reader/wgsl/parser_impl_assignment_stmt_test.cc", + "reader/wgsl/parser_impl_bitwise_expression_test.cc", + "reader/wgsl/parser_impl_break_stmt_test.cc", + "reader/wgsl/parser_impl_bug_cases_test.cc", + "reader/wgsl/parser_impl_call_stmt_test.cc", + "reader/wgsl/parser_impl_callable_test.cc", + "reader/wgsl/parser_impl_case_body_test.cc", + "reader/wgsl/parser_impl_compound_stmt_test.cc", + "reader/wgsl/parser_impl_const_literal_test.cc", + "reader/wgsl/parser_impl_continue_stmt_test.cc", + "reader/wgsl/parser_impl_continuing_stmt_test.cc", + "reader/wgsl/parser_impl_core_lhs_expression_test.cc", + "reader/wgsl/parser_impl_depth_texture_test.cc", + "reader/wgsl/parser_impl_element_count_expression_test.cc", + "reader/wgsl/parser_impl_enable_directive_test.cc", + "reader/wgsl/parser_impl_error_msg_test.cc", + "reader/wgsl/parser_impl_error_resync_test.cc", + "reader/wgsl/parser_impl_expression_test.cc", + "reader/wgsl/parser_impl_external_texture_test.cc", + "reader/wgsl/parser_impl_for_stmt_test.cc", + "reader/wgsl/parser_impl_function_attribute_list_test.cc", + "reader/wgsl/parser_impl_function_attribute_test.cc", + "reader/wgsl/parser_impl_function_decl_test.cc", + "reader/wgsl/parser_impl_function_header_test.cc", + "reader/wgsl/parser_impl_global_constant_decl_test.cc", + "reader/wgsl/parser_impl_global_decl_test.cc", + "reader/wgsl/parser_impl_global_variable_decl_test.cc", + "reader/wgsl/parser_impl_if_stmt_test.cc", + "reader/wgsl/parser_impl_increment_decrement_stmt_test.cc", + "reader/wgsl/parser_impl_lhs_expression_test.cc", + "reader/wgsl/parser_impl_loop_stmt_test.cc", + "reader/wgsl/parser_impl_math_expression_test.cc", + "reader/wgsl/parser_impl_multiplicative_expression_test.cc", + "reader/wgsl/parser_impl_param_list_test.cc", + "reader/wgsl/parser_impl_paren_expression_test.cc", + "reader/wgsl/parser_impl_pipeline_stage_test.cc", + "reader/wgsl/parser_impl_primary_expression_test.cc", + "reader/wgsl/parser_impl_relational_expression_test.cc", + "reader/wgsl/parser_impl_reserved_keyword_test.cc", + "reader/wgsl/parser_impl_sampled_texture_test.cc", + "reader/wgsl/parser_impl_sampler_test.cc", + "reader/wgsl/parser_impl_shift_expression_test.cc", + "reader/wgsl/parser_impl_singular_expression_test.cc", + "reader/wgsl/parser_impl_statement_test.cc", + "reader/wgsl/parser_impl_statements_test.cc", + "reader/wgsl/parser_impl_storage_class_test.cc", + "reader/wgsl/parser_impl_storage_texture_test.cc", + "reader/wgsl/parser_impl_struct_attribute_decl_test.cc", + "reader/wgsl/parser_impl_struct_body_decl_test.cc", + "reader/wgsl/parser_impl_struct_decl_test.cc", + "reader/wgsl/parser_impl_struct_member_attribute_decl_test.cc", + "reader/wgsl/parser_impl_struct_member_attribute_test.cc", + "reader/wgsl/parser_impl_struct_member_test.cc", + "reader/wgsl/parser_impl_switch_body_test.cc", + "reader/wgsl/parser_impl_switch_stmt_test.cc", + "reader/wgsl/parser_impl_test.cc", + "reader/wgsl/parser_impl_test_helper.cc", + "reader/wgsl/parser_impl_test_helper.h", + "reader/wgsl/parser_impl_texel_format_test.cc", + "reader/wgsl/parser_impl_texture_sampler_test.cc", + "reader/wgsl/parser_impl_type_alias_test.cc", + "reader/wgsl/parser_impl_type_decl_test.cc", + "reader/wgsl/parser_impl_type_decl_without_ident_test.cc", + "reader/wgsl/parser_impl_unary_expression_test.cc", + "reader/wgsl/parser_impl_variable_attribute_list_test.cc", + "reader/wgsl/parser_impl_variable_attribute_test.cc", + "reader/wgsl/parser_impl_variable_decl_test.cc", + "reader/wgsl/parser_impl_variable_ident_decl_test.cc", + "reader/wgsl/parser_impl_variable_qualifier_test.cc", + "reader/wgsl/parser_impl_variable_stmt_test.cc", + "reader/wgsl/parser_impl_vec_mat_prefix_test.cc", + "reader/wgsl/parser_impl_while_stmt_test.cc", + "reader/wgsl/parser_test.cc", + "reader/wgsl/token_test.cc", + ] + + deps = [ ":libtint_wgsl_reader_src" ] + } + + tint_unittests_source_set("tint_unittests_wgsl_writer_src") { + sources = [ + "writer/wgsl/generator_impl_alias_type_test.cc", + "writer/wgsl/generator_impl_array_accessor_test.cc", + "writer/wgsl/generator_impl_assign_test.cc", + "writer/wgsl/generator_impl_binary_test.cc", + "writer/wgsl/generator_impl_bitcast_test.cc", + "writer/wgsl/generator_impl_block_test.cc", + "writer/wgsl/generator_impl_break_test.cc", + "writer/wgsl/generator_impl_call_test.cc", + "writer/wgsl/generator_impl_case_test.cc", + "writer/wgsl/generator_impl_cast_test.cc", + "writer/wgsl/generator_impl_constructor_test.cc", + "writer/wgsl/generator_impl_continue_test.cc", + "writer/wgsl/generator_impl_discard_test.cc", + "writer/wgsl/generator_impl_enable_test.cc", + "writer/wgsl/generator_impl_fallthrough_test.cc", + "writer/wgsl/generator_impl_function_test.cc", + "writer/wgsl/generator_impl_global_decl_test.cc", + "writer/wgsl/generator_impl_identifier_test.cc", + "writer/wgsl/generator_impl_if_test.cc", + "writer/wgsl/generator_impl_literal_test.cc", + "writer/wgsl/generator_impl_loop_test.cc", + "writer/wgsl/generator_impl_member_accessor_test.cc", + "writer/wgsl/generator_impl_return_test.cc", + "writer/wgsl/generator_impl_static_assert_test.cc", + "writer/wgsl/generator_impl_switch_test.cc", + "writer/wgsl/generator_impl_test.cc", + "writer/wgsl/generator_impl_type_test.cc", + "writer/wgsl/generator_impl_unary_op_test.cc", + "writer/wgsl/generator_impl_variable_decl_statement_test.cc", + "writer/wgsl/generator_impl_variable_test.cc", + "writer/wgsl/test_helper.h", + ] + + deps = [ + ":libtint_wgsl_writer_src", + ":tint_unittests_ast_src", + ] + } + + tint_unittests_source_set("tint_unittests_msl_writer_src") { + sources = [ + "writer/msl/generator_impl_array_accessor_test.cc", + "writer/msl/generator_impl_assign_test.cc", + "writer/msl/generator_impl_binary_test.cc", + "writer/msl/generator_impl_bitcast_test.cc", + "writer/msl/generator_impl_block_test.cc", + "writer/msl/generator_impl_break_test.cc", + "writer/msl/generator_impl_builtin_test.cc", + "writer/msl/generator_impl_builtin_texture_test.cc", + "writer/msl/generator_impl_call_test.cc", + "writer/msl/generator_impl_case_test.cc", + "writer/msl/generator_impl_cast_test.cc", + "writer/msl/generator_impl_constructor_test.cc", + "writer/msl/generator_impl_continue_test.cc", + "writer/msl/generator_impl_discard_test.cc", + "writer/msl/generator_impl_function_test.cc", + "writer/msl/generator_impl_identifier_test.cc", + "writer/msl/generator_impl_if_test.cc", + "writer/msl/generator_impl_import_test.cc", + "writer/msl/generator_impl_loop_test.cc", + "writer/msl/generator_impl_member_accessor_test.cc", + "writer/msl/generator_impl_module_constant_test.cc", + "writer/msl/generator_impl_return_test.cc", + "writer/msl/generator_impl_sanitizer_test.cc", + "writer/msl/generator_impl_static_assert_test.cc", + "writer/msl/generator_impl_switch_test.cc", + "writer/msl/generator_impl_test.cc", + "writer/msl/generator_impl_type_test.cc", + "writer/msl/generator_impl_unary_op_test.cc", + "writer/msl/generator_impl_variable_decl_statement_test.cc", + "writer/msl/test_helper.h", + ] + + deps = [ + ":libtint_msl_writer_src", + ":tint_unittests_ast_src", + ] + } + + tint_unittests_source_set("tint_unittests_hlsl_writer_src") { + sources = [ + "writer/hlsl/generator_impl_array_accessor_test.cc", + "writer/hlsl/generator_impl_assign_test.cc", + "writer/hlsl/generator_impl_binary_test.cc", + "writer/hlsl/generator_impl_bitcast_test.cc", + "writer/hlsl/generator_impl_block_test.cc", + "writer/hlsl/generator_impl_break_test.cc", + "writer/hlsl/generator_impl_builtin_test.cc", + "writer/hlsl/generator_impl_builtin_texture_test.cc", + "writer/hlsl/generator_impl_call_test.cc", + "writer/hlsl/generator_impl_case_test.cc", + "writer/hlsl/generator_impl_cast_test.cc", + "writer/hlsl/generator_impl_constructor_test.cc", + "writer/hlsl/generator_impl_continue_test.cc", + "writer/hlsl/generator_impl_discard_test.cc", + "writer/hlsl/generator_impl_function_test.cc", + "writer/hlsl/generator_impl_identifier_test.cc", + "writer/hlsl/generator_impl_if_test.cc", + "writer/hlsl/generator_impl_import_test.cc", + "writer/hlsl/generator_impl_loop_test.cc", + "writer/hlsl/generator_impl_member_accessor_test.cc", + "writer/hlsl/generator_impl_module_constant_test.cc", + "writer/hlsl/generator_impl_return_test.cc", + "writer/hlsl/generator_impl_sanitizer_test.cc", + "writer/hlsl/generator_impl_static_assert_test.cc", + "writer/hlsl/generator_impl_switch_test.cc", + "writer/hlsl/generator_impl_test.cc", + "writer/hlsl/generator_impl_type_test.cc", + "writer/hlsl/generator_impl_unary_op_test.cc", + "writer/hlsl/generator_impl_variable_decl_statement_test.cc", + "writer/hlsl/generator_impl_workgroup_var_test.cc", + "writer/hlsl/test_helper.h", + ] + + deps = [ + ":libtint_hlsl_writer_src", + ":tint_unittests_ast_src", + ] + } + + tint_unittests_source_set("tint_unittests_glsl_writer_src") { + sources = [ + "writer/glsl/generator_impl_array_accessor_test.cc", + "writer/glsl/generator_impl_assign_test.cc", + "writer/glsl/generator_impl_binary_test.cc", + "writer/glsl/generator_impl_bitcast_test.cc", + "writer/glsl/generator_impl_block_test.cc", + "writer/glsl/generator_impl_break_test.cc", + "writer/glsl/generator_impl_builtin_test.cc", + "writer/glsl/generator_impl_builtin_texture_test.cc", + "writer/glsl/generator_impl_call_test.cc", + "writer/glsl/generator_impl_case_test.cc", + "writer/glsl/generator_impl_cast_test.cc", + "writer/glsl/generator_impl_constructor_test.cc", + "writer/glsl/generator_impl_continue_test.cc", + "writer/glsl/generator_impl_discard_test.cc", + "writer/glsl/generator_impl_function_test.cc", + "writer/glsl/generator_impl_identifier_test.cc", + "writer/glsl/generator_impl_if_test.cc", + "writer/glsl/generator_impl_import_test.cc", + "writer/glsl/generator_impl_loop_test.cc", + "writer/glsl/generator_impl_member_accessor_test.cc", + "writer/glsl/generator_impl_module_constant_test.cc", + "writer/glsl/generator_impl_return_test.cc", + "writer/glsl/generator_impl_sanitizer_test.cc", + "writer/glsl/generator_impl_storage_buffer_test.cc", + "writer/glsl/generator_impl_switch_test.cc", + "writer/glsl/generator_impl_test.cc", + "writer/glsl/generator_impl_type_test.cc", + "writer/glsl/generator_impl_unary_op_test.cc", + "writer/glsl/generator_impl_uniform_buffer_test.cc", + "writer/glsl/generator_impl_variable_decl_statement_test.cc", + "writer/glsl/generator_impl_workgroup_var_test.cc", + "writer/glsl/test_helper.h", + ] + + deps = [ + ":libtint_glsl_writer_src", + ":tint_unittests_ast_src", + ":tint_unittests_transform_src", + ] + } + + tint_unittests_source_set("tint_unittests_core_src") { + sources = [ + "castable_test.cc", + "clone_context_test.cc", + "debug_test.cc", + "demangler_test.cc", + "number_test.cc", + "program_builder_test.cc", + "program_test.cc", + "scope_stack_test.cc", + "source_test.cc", + "symbol_table_test.cc", + "symbol_test.cc", + "traits_test.cc", + "utils/block_allocator_test.cc", + ] + + deps = [ ":tint_unittests_ast_src" ] + } + + if (build_with_chromium) { + tint_unittests_source_set("tint_unittests_fuzzer_src") { + sources = [ "fuzzers/random_generator_test.cc" ] + + deps = [ + ":tint_unittests_core_src", + "fuzzers:tint_fuzzer_common_src", + ] + } + } + + source_set("tint_unittests_src") { + testonly = true + + deps = [ + ":libtint_wgsl_reader_src", + ":libtint_wgsl_writer_src", + ":tint_unittests_ast_src", + ":tint_unittests_core_src", + ":tint_unittests_diagnostic_src", + ":tint_unittests_inspector_src", + ":tint_unittests_resolver_src", + ":tint_unittests_sem_src", + ":tint_unittests_text_src", + ":tint_unittests_transform_src", + ":tint_unittests_utils_src", + ":tint_unittests_writer_src", + ] + + if (tint_build_spv_reader) { + deps += [ ":tint_unittests_spv_reader_src" ] + } + + if (tint_build_spv_writer) { + deps += [ ":tint_unittests_spv_writer_src" ] + } + + if (tint_build_wgsl_reader) { + deps += [ ":tint_unittests_wgsl_reader_src" ] + } + + if (tint_build_wgsl_writer) { + deps += [ ":tint_unittests_wgsl_writer_src" ] + } + + if (tint_build_msl_writer) { + deps += [ ":tint_unittests_msl_writer_src" ] + } + + if (tint_build_hlsl_writer) { + deps += [ ":tint_unittests_hlsl_writer_src" ] + } + + if (tint_build_glsl_writer) { + deps += [ ":tint_unittests_glsl_writer_src" ] + } + + if (build_with_chromium) { + deps += [ ":tint_unittests_fuzzer_src" ] + } + + configs += [ ":tint_unittests_config" ] + + if (build_with_chromium) { + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + } + } + + test("tint_unittests") { + deps = [ + ":gmock_and_gtest", + ":tint_unittests_src", + "${tint_spirv_tools_dir}/:spvtools", + "${tint_spirv_tools_dir}/:spvtools_opt", + "${tint_spirv_tools_dir}/:spvtools_val", + ] + + deps += [ ":tint_unittests_main" ] + + configs += [ ":tint_unittests_config" ] + + if (build_with_chromium) { + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + } + + testonly = true + } +} diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt index 682817f7bd..5d77470d57 100644 --- a/src/tint/CMakeLists.txt +++ b/src/tint/CMakeLists.txt @@ -22,18 +22,6 @@ function(tint_spvtools_compile_options TARGET) ${spirv-tools_SOURCE_DIR} ${spirv-tools_BINARY_DIR} ) - - if (${CMAKE_CXX_COMPILER_ID} MATCHES Clang) - # The SPIRV-Tools code is conditioned against C++ and an older version of Clang. - # Suppress warnings triggered in our current compilation environment. - # TODO(dneto): Fix the issues upstream. - target_compile_options(${TARGET} PRIVATE - -Wno-newline-eof - -Wno-sign-conversion - -Wno-old-style-cast - -Wno-weak-vtables - ) - endif() endfunction() ## Tint diagnostic utilities. Used by libtint and tint_utils_io. @@ -62,18 +50,17 @@ set(TINT_LIB_SRCS ../../include/tint/tint.h ast/access.cc ast/access.h - ast/attribute.cc - ast/attribute.h ast/alias.cc ast/alias.h - ast/index_accessor_expression.cc - ast/index_accessor_expression.h ast/array.cc ast/array.h ast/assignment_statement.cc ast/assignment_statement.h + ast/ast_type.cc # TODO(bclayton) - rename to type.cc ast/atomic.cc ast/atomic.h + ast/attribute.cc + ast/attribute.h ast/binary_expression.cc ast/binary_expression.h ast/binding_attribute.cc @@ -90,8 +77,8 @@ set(TINT_LIB_SRCS ast/break_statement.h ast/builtin_attribute.cc ast/builtin_attribute.h - ast/builtin.cc - ast/builtin.h + ast/builtin_value.cc + ast/builtin_value.h ast/call_expression.cc ast/call_expression.h ast/call_statement.cc @@ -100,22 +87,28 @@ set(TINT_LIB_SRCS ast/case_statement.h ast/compound_assignment_statement.cc ast/compound_assignment_statement.h + ast/const.cc + ast/const.h ast/continue_statement.cc ast/continue_statement.h ast/depth_multisampled_texture.cc ast/depth_multisampled_texture.h - ast/disable_validation_attribute.cc - ast/disable_validation_attribute.h ast/depth_texture.cc ast/depth_texture.h + ast/disable_validation_attribute.cc + ast/disable_validation_attribute.h ast/discard_statement.cc ast/discard_statement.h ast/enable.cc ast/enable.h ast/expression.cc ast/expression.h + ast/extension.cc + ast/extension.h ast/external_texture.cc ast/external_texture.h + ast/f16.cc + ast/f16.h ast/f32.cc ast/f32.h ast/fallthrough_statement.cc @@ -138,6 +131,8 @@ set(TINT_LIB_SRCS ast/if_statement.h ast/increment_decrement_statement.cc ast/increment_decrement_statement.h + ast/index_accessor_expression.cc + ast/index_accessor_expression.h ast/int_literal_expression.cc ast/int_literal_expression.h ast/internal_attribute.cc @@ -146,6 +141,8 @@ set(TINT_LIB_SRCS ast/interpolate_attribute.h ast/invariant_attribute.cc ast/invariant_attribute.h + ast/let.cc + ast/let.h ast/literal_expression.cc ast/literal_expression.h ast/location_attribute.cc @@ -160,8 +157,13 @@ set(TINT_LIB_SRCS ast/module.h ast/multisampled_texture.cc ast/multisampled_texture.h + ast/node_id.h ast/node.cc ast/node.h + ast/override.cc + ast/override.h + ast/parameter.cc + ast/parameter.h ast/phony_expression.cc ast/phony_expression.h ast/pipeline_stage.cc @@ -178,6 +180,8 @@ set(TINT_LIB_SRCS ast/stage_attribute.h ast/statement.cc ast/statement.h + ast/static_assert.cc + ast/static_assert.h ast/storage_class.cc ast/storage_class.h ast/storage_texture.cc @@ -196,23 +200,24 @@ set(TINT_LIB_SRCS ast/struct.h ast/switch_statement.cc ast/switch_statement.h + ast/texel_format.cc + ast/texel_format.h ast/texture.cc ast/texture.h ast/traverse_expressions.h - ast/type_name.cc - ast/type_name.h - ast/ast_type.cc # TODO(bclayton) - rename to type.cc - ast/type.h ast/type_decl.cc ast/type_decl.h ast/type_name.cc ast/type_name.h + ast/type.h ast/u32.cc ast/u32.h ast/unary_op_expression.cc ast/unary_op_expression.h ast/unary_op.cc ast/unary_op.h + ast/var.cc + ast/var.h ast/variable_decl_statement.cc ast/variable_decl_statement.h ast/variable.cc @@ -221,6 +226,8 @@ set(TINT_LIB_SRCS ast/vector.h ast/void.cc ast/void.h + ast/while_statement.cc + ast/while_statement.h ast/workgroup_attribute.cc ast/workgroup_attribute.h castable.cc @@ -229,7 +236,6 @@ set(TINT_LIB_SRCS clone_context.h demangler.cc demangler.h - number.h inspector/entry_point.cc inspector/entry_point.h inspector/inspector.cc @@ -238,6 +244,8 @@ set(TINT_LIB_SRCS inspector/resource_binding.h inspector/scalar.cc inspector/scalar.h + number.cc + number.h program_builder.cc program_builder.h program_id.cc @@ -246,16 +254,21 @@ set(TINT_LIB_SRCS program.h reader/reader.cc reader/reader.h + resolver/const_eval.cc + resolver/const_eval.h + resolver/ctor_conv_intrinsic.cc + resolver/ctor_conv_intrinsic.h resolver/dependency_graph.cc resolver/dependency_graph.h resolver/intrinsic_table.cc resolver/intrinsic_table.h resolver/intrinsic_table.inl resolver/resolver.cc - resolver/resolver_constants.cc resolver/resolver.h resolver/sem_helper.cc resolver/sem_helper.h + resolver/uniformity.cc + resolver/uniformity.h resolver/validator.cc resolver/validator.h scope_stack.h @@ -274,6 +287,8 @@ set(TINT_LIB_SRCS sem/binding_point.h sem/block_statement.cc sem/block_statement.h + sem/bool.cc + sem/bool.h sem/builtin_type.cc sem/builtin_type.h sem/builtin.cc @@ -286,24 +301,79 @@ set(TINT_LIB_SRCS sem/constant.h sem/depth_multisampled_texture.cc sem/depth_multisampled_texture.h + sem/depth_texture.cc + sem/depth_texture.h + sem/evaluation_stage.h sem/expression.cc sem/expression.h + sem/external_texture.cc + sem/external_texture.h + sem/f16.cc + sem/f16.h + sem/f32.cc + sem/f32.h + sem/for_loop_statement.cc + sem/for_loop_statement.h sem/function.cc + sem/i32.cc + sem/i32.h + sem/if_statement.cc + sem/if_statement.h + sem/index_accessor_expression.cc + sem/index_accessor_expression.h sem/info.cc sem/info.h + sem/loop_statement.cc + sem/loop_statement.h + sem/materialize.cc + sem/materialize.h + sem/matrix.cc + sem/matrix.h sem/member_accessor_expression.cc + sem/module.cc + sem/module.h + sem/multisampled_texture.cc + sem/multisampled_texture.h + sem/node.cc + sem/node.h sem/parameter_usage.cc sem/parameter_usage.h sem/pipeline_stage_set.h - sem/node.cc - sem/node.h - sem/module.cc - sem/module.h + sem/pointer.cc + sem/pointer.h + sem/reference.cc + sem/reference.h + sem/sampled_texture.cc + sem/sampled_texture.h sem/sampler_texture_pair.h + sem/sampler.cc + sem/sampler.h sem/statement.cc + sem/storage_texture.cc + sem/storage_texture.h sem/struct.cc + sem/switch_statement.cc + sem/switch_statement.h + sem/texture.cc + sem/texture.h + sem/type_constructor.cc + sem/type_constructor.h + sem/type_conversion.cc + sem/type_conversion.h + sem/type_manager.cc + sem/type_manager.h sem/type_mappings.h + sem/type.cc + sem/type.h + sem/u32.cc + sem/u32.h sem/variable.cc + sem/vector.cc + sem/vector.h + sem/void.cc + sem/void.h + sem/while_statement.cc + sem/while_statement.h symbol_table.cc symbol_table.h symbol.cc @@ -323,28 +393,28 @@ set(TINT_LIB_SRCS transform/builtin_polyfill.h transform/calculate_array_length.cc transform/calculate_array_length.h - transform/combine_samplers.cc - transform/combine_samplers.h transform/canonicalize_entry_point_io.cc transform/canonicalize_entry_point_io.h + transform/combine_samplers.cc + transform/combine_samplers.h transform/decompose_memory_access.cc transform/decompose_memory_access.h transform/decompose_strided_array.cc transform/decompose_strided_array.h transform/decompose_strided_matrix.cc transform/decompose_strided_matrix.h - transform/first_index_offset.cc - transform/first_index_offset.h - transform/fold_constants.cc - transform/fold_constants.h - transform/fold_trivial_single_use_lets.cc - transform/fold_trivial_single_use_lets.h - transform/localize_struct_array_assignment.cc - transform/localize_struct_array_assignment.h - transform/for_loop_to_loop.cc - transform/for_loop_to_loop.h + transform/disable_uniformity_analysis.cc + transform/disable_uniformity_analysis.h transform/expand_compound_assignment.cc transform/expand_compound_assignment.h + transform/first_index_offset.cc + transform/first_index_offset.h + transform/fold_trivial_single_use_lets.cc + transform/fold_trivial_single_use_lets.h + transform/for_loop_to_loop.cc + transform/for_loop_to_loop.h + transform/localize_struct_array_assignment.cc + transform/localize_struct_array_assignment.h transform/loop_to_for_loop.cc transform/loop_to_for_loop.h transform/manager.cc @@ -355,14 +425,14 @@ set(TINT_LIB_SRCS transform/multiplanar_external_texture.h transform/num_workgroups_from_uniform.cc transform/num_workgroups_from_uniform.h - transform/promote_initializers_to_const_var.cc - transform/promote_initializers_to_const_var.h + transform/promote_initializers_to_let.cc + transform/promote_initializers_to_let.h transform/promote_side_effects_to_decl.cc transform/promote_side_effects_to_decl.h - transform/remove_phonies.cc - transform/remove_phonies.h transform/remove_continue_in_switch.cc transform/remove_continue_in_switch.h + transform/remove_phonies.cc + transform/remove_phonies.h transform/remove_unreachable_statements.cc transform/remove_unreachable_statements.h transform/renamer.cc @@ -373,85 +443,47 @@ set(TINT_LIB_SRCS transform/simplify_pointers.h transform/single_entry_point.cc transform/single_entry_point.h + transform/spirv_atomic.cc + transform/spirv_atomic.h + transform/substitute_override.cc + transform/substitute_override.h transform/transform.cc transform/transform.h transform/unshadow.cc transform/unshadow.h transform/unwind_discard_functions.cc transform/unwind_discard_functions.h - transform/vectorize_scalar_matrix_constructors.cc - transform/vectorize_scalar_matrix_constructors.h - transform/var_for_dynamic_index.cc - transform/var_for_dynamic_index.h - transform/vertex_pulling.cc - transform/vertex_pulling.h - transform/wrap_arrays_in_structs.cc - transform/wrap_arrays_in_structs.h - transform/zero_init_workgroup_memory.cc - transform/zero_init_workgroup_memory.h transform/utils/get_insertion_point.cc transform/utils/get_insertion_point.h transform/utils/hoist_to_decl_before.cc transform/utils/hoist_to_decl_before.h - sem/bool.cc - sem/bool.h - sem/depth_texture.cc - sem/depth_texture.h - sem/external_texture.cc - sem/external_texture.h - sem/f32.cc - sem/f32.h - sem/for_loop_statement.cc - sem/for_loop_statement.h - sem/i32.cc - sem/i32.h - sem/if_statement.cc - sem/if_statement.h - sem/loop_statement.cc - sem/loop_statement.h - sem/matrix.cc - sem/matrix.h - sem/multisampled_texture.cc - sem/multisampled_texture.h - sem/pointer.cc - sem/pointer.h - sem/reference.cc - sem/reference.h - sem/sampled_texture.cc - sem/sampled_texture.h - sem/sampler.cc - sem/sampler.h - sem/storage_texture.cc - sem/storage_texture.h - sem/switch_statement.cc - sem/switch_statement.h - sem/texture.cc - sem/texture.h - sem/type_constructor.cc - sem/type_constructor.h - sem/type_conversion.cc - sem/type_conversion.h - sem/type.cc - sem/type.h - sem/type_manager.cc - sem/type_manager.h - sem/u32.cc - sem/u32.h - sem/vector.cc - sem/vector.h - sem/void.cc - sem/void.h + transform/var_for_dynamic_index.cc + transform/var_for_dynamic_index.h + transform/vectorize_scalar_matrix_constructors.cc + transform/vectorize_scalar_matrix_constructors.h + transform/vertex_pulling.cc + transform/vertex_pulling.h + transform/while_to_loop.cc + transform/while_to_loop.h + transform/zero_init_workgroup_memory.cc + transform/zero_init_workgroup_memory.h utils/bitcast.h + utils/bitset.h utils/block_allocator.h + utils/compiler_macros.h + utils/concat.h utils/crc32.h utils/enum_set.h utils/hash.h + utils/hashmap.h + utils/hashset.h utils/map.h utils/math.h utils/scoped_assignment.h utils/string.h utils/unique_allocator.h utils/unique_vector.h + utils/vector.h writer/append_vector.cc writer/append_vector.h writer/array_length_from_uniform_options.cc @@ -672,6 +704,7 @@ if(TINT_BUILD_TESTS) ast/builtin_attribute_test.cc ast/builtin_texture_helper_test.cc ast/builtin_texture_helper_test.h + ast/builtin_value_test.cc ast/call_expression_test.cc ast/call_statement_test.cc ast/case_statement_test.cc @@ -681,7 +714,9 @@ if(TINT_BUILD_TESTS) ast/depth_texture_test.cc ast/discard_statement_test.cc ast/enable_test.cc + ast/extension_test.cc ast/external_texture_test.cc + ast/f16_test.cc ast/f32_test.cc ast/fallthrough_statement_test.cc ast/float_literal_expression_test.cc @@ -704,12 +739,15 @@ if(TINT_BUILD_TESTS) ast/module_clone_test.cc ast/module_test.cc ast/multisampled_texture_test.cc + ast/override_test.cc ast/phony_expression_test.cc ast/pointer_test.cc ast/return_statement_test.cc ast/sampled_texture_test.cc ast/sampler_test.cc ast/stage_attribute_test.cc + ast/static_assert_test.cc + ast/storage_class_test.cc ast/storage_texture_test.cc ast/stride_attribute_test.cc ast/struct_member_align_attribute_test.cc @@ -719,6 +757,7 @@ if(TINT_BUILD_TESTS) ast/struct_test.cc ast/switch_statement_test.cc ast/test_helper.h + ast/texel_format_test.cc ast/texture_test.cc ast/traverse_expressions_test.cc ast/u32_test.cc @@ -726,6 +765,7 @@ if(TINT_BUILD_TESTS) ast/variable_decl_statement_test.cc ast/variable_test.cc ast/vector_test.cc + ast/while_statement_test.cc ast/workgroup_attribute_test.cc castable_test.cc clone_context_test.cc @@ -734,23 +774,27 @@ if(TINT_BUILD_TESTS) diagnostic/diagnostic_test.cc diagnostic/formatter_test.cc diagnostic/printer_test.cc + number_test.cc + program_builder_test.cc program_test.cc resolver/array_accessor_test.cc resolver/assignment_validation_test.cc resolver/atomics_test.cc resolver/atomics_validation_test.cc + resolver/attribute_validation_test.cc resolver/bitcast_validation_test.cc - resolver/builtins_validation_test.cc resolver/builtin_test.cc resolver/builtin_validation_test.cc + resolver/builtins_validation_test.cc resolver/call_test.cc resolver/call_validation_test.cc resolver/compound_assignment_validation_test.cc resolver/compound_statement_test.cc + resolver/const_eval_test.cc resolver/control_block_validation_test.cc - resolver/attribute_validation_test.cc resolver/dependency_graph_test.cc resolver/entry_point_validation_test.cc + resolver/evaluation_stage_test.cc resolver/function_validation_test.cc resolver/host_shareable_validation_test.cc resolver/increment_decrement_validation_test.cc @@ -758,15 +802,16 @@ if(TINT_BUILD_TESTS) resolver/intrinsic_table_test.cc resolver/is_host_shareable_test.cc resolver/is_storeable_test.cc - resolver/pipeline_overridable_constant_test.cc + resolver/materialize_test.cc + resolver/override_test.cc resolver/ptr_ref_test.cc resolver/ptr_ref_validation_test.cc resolver/resolver_behavior_test.cc - resolver/resolver_constants_test.cc resolver/resolver_test_helper.cc resolver/resolver_test_helper.h resolver/resolver_test.cc resolver/side_effects_test.cc + resolver/static_assert_test.cc resolver/source_variable_test.cc resolver/storage_class_layout_validation_test.cc resolver/storage_class_validation_test.cc @@ -777,15 +822,17 @@ if(TINT_BUILD_TESTS) resolver/type_validation_test.cc resolver/validation_test.cc resolver/validator_is_storeable_test.cc - resolver/var_let_test.cc - resolver/var_let_validation_test.cc + resolver/variable_test.cc + resolver/variable_validation_test.cc scope_stack_test.cc sem/atomic.cc sem/bool_test.cc sem/builtin_test.cc sem/depth_multisampled_texture_test.cc sem/depth_texture_test.cc + sem/expression_test.cc sem/external_texture_test.cc + sem/f16_test.cc sem/f32_test.cc sem/i32_test.cc sem/matrix_test.cc @@ -799,6 +846,7 @@ if(TINT_BUILD_TESTS) sem/storage_texture_test.cc sem/texture_test.cc sem/type_manager_test.cc + sem/type_test.cc sem/u32_test.cc sem/vector_test.cc source_test.cc @@ -809,6 +857,7 @@ if(TINT_BUILD_TESTS) traits_test.cc transform/transform_test.cc utils/bitcast_test.cc + utils/bitset_test.cc utils/block_allocator_test.cc utils/crc32_test.cc utils/defer_test.cc @@ -816,14 +865,18 @@ if(TINT_BUILD_TESTS) utils/hash_test.cc utils/io/command_test.cc utils/io/tmpfile_test.cc + utils/hashmap_test.cc + utils/hashset_test.cc utils/map_test.cc utils/math_test.cc + utils/result_test.cc utils/reverse_test.cc utils/scoped_assignment_test.cc utils/string_test.cc utils/transform_test.cc utils/unique_allocator_test.cc utils/unique_vector_test.cc + utils/vector_test.cc writer/append_vector_test.cc writer/flatten_bindings_test.cc writer/float_to_string_test.cc @@ -831,6 +884,13 @@ if(TINT_BUILD_TESTS) writer/text_generator_test.cc ) + # Uniformity analysis tests depend on WGSL reader + if(${TINT_BUILD_WGSL_READER}) + list(APPEND TINT_TEST_SRCS + resolver/uniformity_test.cc + ) + endif() + # Inspector tests depend on WGSL reader if(${TINT_BUILD_WGSL_READER}) list(APPEND TINT_TEST_SRCS @@ -885,25 +945,26 @@ if(TINT_BUILD_TESTS) reader/wgsl/lexer_test.cc reader/wgsl/parser_test.cc reader/wgsl/parser_impl_additive_expression_test.cc - reader/wgsl/parser_impl_and_expression_test.cc reader/wgsl/parser_impl_argument_expression_list_test.cc reader/wgsl/parser_impl_assignment_stmt_test.cc - reader/wgsl/parser_impl_body_stmt_test.cc + reader/wgsl/parser_impl_bitwise_expression_test.cc reader/wgsl/parser_impl_break_stmt_test.cc reader/wgsl/parser_impl_bug_cases_test.cc reader/wgsl/parser_impl_call_stmt_test.cc + reader/wgsl/parser_impl_callable_test.cc reader/wgsl/parser_impl_case_body_test.cc - reader/wgsl/parser_impl_const_expr_test.cc + reader/wgsl/parser_impl_compound_stmt_test.cc reader/wgsl/parser_impl_const_literal_test.cc reader/wgsl/parser_impl_continue_stmt_test.cc reader/wgsl/parser_impl_continuing_stmt_test.cc + reader/wgsl/parser_impl_core_lhs_expression_test.cc reader/wgsl/parser_impl_depth_texture_test.cc + reader/wgsl/parser_impl_element_count_expression_test.cc reader/wgsl/parser_impl_enable_directive_test.cc - reader/wgsl/parser_impl_external_texture_test.cc - reader/wgsl/parser_impl_equality_expression_test.cc reader/wgsl/parser_impl_error_msg_test.cc reader/wgsl/parser_impl_error_resync_test.cc - reader/wgsl/parser_impl_exclusive_or_expression_test.cc + reader/wgsl/parser_impl_expression_test.cc + reader/wgsl/parser_impl_external_texture_test.cc reader/wgsl/parser_impl_for_stmt_test.cc reader/wgsl/parser_impl_function_decl_test.cc reader/wgsl/parser_impl_function_attribute_list_test.cc @@ -913,14 +974,13 @@ if(TINT_BUILD_TESTS) reader/wgsl/parser_impl_global_decl_test.cc reader/wgsl/parser_impl_global_variable_decl_test.cc reader/wgsl/parser_impl_if_stmt_test.cc - reader/wgsl/parser_impl_inclusive_or_expression_test.cc reader/wgsl/parser_impl_increment_decrement_stmt_test.cc - reader/wgsl/parser_impl_logical_and_expression_test.cc - reader/wgsl/parser_impl_logical_or_expression_test.cc + reader/wgsl/parser_impl_lhs_expression_test.cc reader/wgsl/parser_impl_loop_stmt_test.cc + reader/wgsl/parser_impl_math_expression_test.cc reader/wgsl/parser_impl_multiplicative_expression_test.cc reader/wgsl/parser_impl_param_list_test.cc - reader/wgsl/parser_impl_paren_rhs_stmt_test.cc + reader/wgsl/parser_impl_paren_expression_test.cc reader/wgsl/parser_impl_pipeline_stage_test.cc reader/wgsl/parser_impl_primary_expression_test.cc reader/wgsl/parser_impl_relational_expression_test.cc @@ -948,6 +1008,7 @@ if(TINT_BUILD_TESTS) reader/wgsl/parser_impl_texture_sampler_test.cc reader/wgsl/parser_impl_type_alias_test.cc reader/wgsl/parser_impl_type_decl_test.cc + reader/wgsl/parser_impl_type_decl_without_ident_test.cc reader/wgsl/parser_impl_unary_expression_test.cc reader/wgsl/parser_impl_variable_decl_test.cc reader/wgsl/parser_impl_variable_attribute_list_test.cc @@ -955,6 +1016,8 @@ if(TINT_BUILD_TESTS) reader/wgsl/parser_impl_variable_ident_decl_test.cc reader/wgsl/parser_impl_variable_stmt_test.cc reader/wgsl/parser_impl_variable_qualifier_test.cc + reader/wgsl/parser_impl_vec_mat_prefix_test.cc + reader/wgsl/parser_impl_while_stmt_test.cc reader/wgsl/token_test.cc ) endif() @@ -983,6 +1046,7 @@ if(TINT_BUILD_TESTS) writer/spirv/builder_literal_test.cc writer/spirv/builder_loop_test.cc writer/spirv/builder_return_test.cc + writer/spirv/builder_static_assert_test.cc writer/spirv/builder_switch_test.cc writer/spirv/builder_test.cc writer/spirv/builder_type_test.cc @@ -1022,6 +1086,7 @@ if(TINT_BUILD_TESTS) writer/wgsl/generator_impl_literal_test.cc writer/wgsl/generator_impl_member_accessor_test.cc writer/wgsl/generator_impl_return_test.cc + writer/wgsl/generator_impl_static_assert_test.cc writer/wgsl/generator_impl_switch_test.cc writer/wgsl/generator_impl_type_test.cc writer/wgsl/generator_impl_unary_op_test.cc @@ -1044,9 +1109,9 @@ if(TINT_BUILD_TESTS) transform/decompose_memory_access_test.cc transform/decompose_strided_array_test.cc transform/decompose_strided_matrix_test.cc + transform/disable_uniformity_analysis_test.cc transform/expand_compound_assignment_test.cc transform/first_index_offset_test.cc - transform/fold_constants_test.cc transform/fold_trivial_single_use_lets_test.cc transform/for_loop_to_loop_test.cc transform/expand_compound_assignment.cc @@ -1055,7 +1120,7 @@ if(TINT_BUILD_TESTS) transform/module_scope_var_to_entry_point_param_test.cc transform/multiplanar_external_texture_test.cc transform/num_workgroups_from_uniform_test.cc - transform/promote_initializers_to_const_var_test.cc + transform/promote_initializers_to_let_test.cc transform/promote_side_effects_to_decl_test.cc transform/remove_continue_in_switch_test.cc transform/remove_phonies_test.cc @@ -1064,13 +1129,15 @@ if(TINT_BUILD_TESTS) transform/robustness_test.cc transform/simplify_pointers_test.cc transform/single_entry_point_test.cc + transform/spirv_atomic_test.cc + transform/substitute_override_test.cc transform/test_helper.h transform/unshadow_test.cc transform/unwind_discard_functions_test.cc transform/var_for_dynamic_index_test.cc transform/vectorize_scalar_matrix_constructors_test.cc transform/vertex_pulling_test.cc - transform/wrap_arrays_in_structs_test.cc + transform/while_to_loop_test.cc transform/zero_init_workgroup_memory_test.cc transform/utils/get_insertion_point_test.cc transform/utils/hoist_to_decl_before_test.cc @@ -1102,6 +1169,7 @@ if(TINT_BUILD_TESTS) writer/msl/generator_impl_module_constant_test.cc writer/msl/generator_impl_return_test.cc writer/msl/generator_impl_sanitizer_test.cc + writer/msl/generator_impl_static_assert_test.cc writer/msl/generator_impl_switch_test.cc writer/msl/generator_impl_test.cc writer/msl/generator_impl_type_test.cc @@ -1173,6 +1241,7 @@ if(TINT_BUILD_TESTS) writer/hlsl/generator_impl_module_constant_test.cc writer/hlsl/generator_impl_return_test.cc writer/hlsl/generator_impl_sanitizer_test.cc + writer/hlsl/generator_impl_static_assert_test.cc writer/hlsl/generator_impl_switch_test.cc writer/hlsl/generator_impl_test.cc writer/hlsl/generator_impl_type_test.cc @@ -1228,6 +1297,9 @@ if(TINT_BUILD_BENCHMARKS) set(TINT_BENCHMARK_SRC "castable_bench.cc" + "ast/extension_bench.cc" + "ast/storage_class_bench.cc" + "ast/texel_format_bench.cc" "bench/benchmark.cc" "reader/wgsl/parser_bench.cc" ) diff --git a/src/tint/ast/alias.cc b/src/tint/ast/alias.cc index fa98cd486b..8a23e8f45d 100644 --- a/src/tint/ast/alias.cc +++ b/src/tint/ast/alias.cc @@ -20,8 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Alias); namespace tint::ast { -Alias::Alias(ProgramID pid, const Source& src, const Symbol& n, const Type* subtype) - : Base(pid, src, n), type(subtype) { +Alias::Alias(ProgramID pid, NodeID nid, const Source& src, const Symbol& n, const Type* subtype) + : Base(pid, nid, src, n), type(subtype) { TINT_ASSERT(AST, type); } diff --git a/src/tint/ast/alias.h b/src/tint/ast/alias.h index 87ce57874d..74d91b04c2 100644 --- a/src/tint/ast/alias.h +++ b/src/tint/ast/alias.h @@ -26,10 +26,11 @@ class Alias final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param name the symbol for the alias /// @param subtype the alias'd type - Alias(ProgramID pid, const Source& src, const Symbol& name, const Type* subtype); + Alias(ProgramID pid, NodeID nid, const Source& src, const Symbol& name, const Type* subtype); /// Move constructor Alias(Alias&&); /// Destructor diff --git a/src/tint/ast/array.cc b/src/tint/ast/array.cc index 0389ed0d9c..6a898f43ed 100644 --- a/src/tint/ast/array.cc +++ b/src/tint/ast/array.cc @@ -15,6 +15,7 @@ #include "src/tint/ast/array.h" #include +#include #include "src/tint/program_builder.h" @@ -38,11 +39,12 @@ std::string SizeExprToString(const Expression* size, const SymbolTable& symbols) } // namespace Array::Array(ProgramID pid, + NodeID nid, const Source& src, const Type* subtype, const Expression* cnt, - AttributeList attrs) - : Base(pid, src), type(subtype), count(cnt), attributes(attrs) {} + utils::VectorRef attrs) + : Base(pid, nid, src), type(subtype), count(cnt), attributes(std::move(attrs)) {} Array::Array(Array&&) = default; @@ -55,11 +57,14 @@ std::string Array::FriendlyName(const SymbolTable& symbols) const { out << "@stride(" << stride->stride << ") "; } } - out << "array<" << type->FriendlyName(symbols); - if (!IsRuntimeArray()) { - out << ", " << SizeExprToString(count, symbols); + out << "array"; + if (type) { + out << "<" << type->FriendlyName(symbols); + if (count) { + out << ", " << SizeExprToString(count, symbols); + } + out << ">"; } - out << ">"; return out.str(); } @@ -69,7 +74,7 @@ const Array* Array::Clone(CloneContext* ctx) const { auto* ty = ctx->Clone(type); auto* cnt = ctx->Clone(count); auto attrs = ctx->Clone(attributes); - return ctx->dst->create(src, ty, cnt, attrs); + return ctx->dst->create(src, ty, cnt, std::move(attrs)); } } // namespace tint::ast diff --git a/src/tint/ast/array.h b/src/tint/ast/array.h index e92902d4cb..19e806ee82 100644 --- a/src/tint/ast/array.h +++ b/src/tint/ast/array.h @@ -32,23 +32,25 @@ class Array final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param subtype the type of the array elements - /// @param count the number of elements in the array. nullptr represents a - /// runtime-sized array. + /// @param count the number of elements in the array /// @param attributes the array attributes + /// @note a runtime-sized array is represented by a null count and a non-null type Array(ProgramID pid, + NodeID nid, const Source& src, const Type* subtype, const Expression* count, - AttributeList attributes); + utils::VectorRef attributes); /// Move constructor Array(Array&&); ~Array() override; /// @returns true if this is a runtime array. /// i.e. the size is determined at runtime - bool IsRuntimeArray() const { return count == nullptr; } + bool IsRuntimeArray() const { return type != nullptr && count == nullptr; } /// @param symbols the program's symbol table /// @returns the name for this type that closely resembles how it would be @@ -67,7 +69,7 @@ class Array final : public Castable { const Expression* const count; /// the array attributes - const AttributeList attributes; + const utils::Vector attributes; }; } // namespace tint::ast diff --git a/src/tint/ast/array_test.cc b/src/tint/ast/array_test.cc index baed0791e7..e2ce77b9d5 100644 --- a/src/tint/ast/array_test.cc +++ b/src/tint/ast/array_test.cc @@ -26,7 +26,7 @@ using AstArrayTest = TestHelper; TEST_F(AstArrayTest, CreateSizedArray) { auto* u32 = create(); auto* count = Expr(3_u); - auto* arr = create(u32, count, AttributeList{}); + auto* arr = create(u32, count, utils::Empty); EXPECT_EQ(arr->type, u32); EXPECT_EQ(arr->count, count); EXPECT_TRUE(arr->Is()); @@ -35,36 +35,54 @@ TEST_F(AstArrayTest, CreateSizedArray) { TEST_F(AstArrayTest, CreateRuntimeArray) { auto* u32 = create(); - auto* arr = create(u32, nullptr, AttributeList{}); + auto* arr = create(u32, nullptr, utils::Empty); EXPECT_EQ(arr->type, u32); EXPECT_EQ(arr->count, nullptr); EXPECT_TRUE(arr->Is()); EXPECT_TRUE(arr->IsRuntimeArray()); } +TEST_F(AstArrayTest, CreateInferredTypeArray) { + auto* arr = create(nullptr, nullptr, utils::Empty); + EXPECT_EQ(arr->type, nullptr); + EXPECT_EQ(arr->count, nullptr); + EXPECT_TRUE(arr->Is()); + EXPECT_FALSE(arr->IsRuntimeArray()); +} + TEST_F(AstArrayTest, FriendlyName_RuntimeSized) { auto* i32 = create(); - auto* arr = create(i32, nullptr, AttributeList{}); + auto* arr = create(i32, nullptr, utils::Empty); EXPECT_EQ(arr->FriendlyName(Symbols()), "array"); } TEST_F(AstArrayTest, FriendlyName_LiteralSized) { auto* i32 = create(); - auto* arr = create(i32, Expr(5_u), AttributeList{}); + auto* arr = create(i32, Expr(5_u), utils::Empty); EXPECT_EQ(arr->FriendlyName(Symbols()), "array"); } TEST_F(AstArrayTest, FriendlyName_ConstantSized) { auto* i32 = create(); - auto* arr = create(i32, Expr("size"), AttributeList{}); + auto* arr = create(i32, Expr("size"), utils::Empty); EXPECT_EQ(arr->FriendlyName(Symbols()), "array"); } TEST_F(AstArrayTest, FriendlyName_WithStride) { auto* i32 = create(); - auto* arr = create(i32, Expr(5_u), AttributeList{create(32)}); + auto* arr = create(i32, Expr(5_u), utils::Vector{create(32u)}); EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(32) array"); } +TEST_F(AstArrayTest, FriendlyName_InferredTypeAndCount) { + auto* arr = create(nullptr, nullptr, utils::Empty); + EXPECT_EQ(arr->FriendlyName(Symbols()), "array"); +} + +TEST_F(AstArrayTest, FriendlyName_InferredTypeAndCount_WithStrize) { + auto* arr = create(nullptr, nullptr, utils::Vector{create(32u)}); + EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(32) array"); +} + } // namespace } // namespace tint::ast diff --git a/src/tint/ast/assignment_statement.cc b/src/tint/ast/assignment_statement.cc index d7d7bc582a..6a835b88ec 100644 --- a/src/tint/ast/assignment_statement.cc +++ b/src/tint/ast/assignment_statement.cc @@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::AssignmentStatement); namespace tint::ast { AssignmentStatement::AssignmentStatement(ProgramID pid, + NodeID nid, const Source& src, const Expression* l, const Expression* r) - : Base(pid, src), lhs(l), rhs(r) { + : Base(pid, nid, src), lhs(l), rhs(r) { TINT_ASSERT(AST, lhs); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, lhs, program_id); TINT_ASSERT(AST, rhs); diff --git a/src/tint/ast/assignment_statement.h b/src/tint/ast/assignment_statement.h index 9def075e76..6b8c412f47 100644 --- a/src/tint/ast/assignment_statement.h +++ b/src/tint/ast/assignment_statement.h @@ -24,11 +24,13 @@ namespace tint::ast { class AssignmentStatement final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the assignment statement source /// @param lhs the left side of the expression /// @param rhs the right side of the expression - AssignmentStatement(ProgramID program_id, + AssignmentStatement(ProgramID pid, + NodeID nid, const Source& source, const Expression* lhs, const Expression* rhs); diff --git a/src/tint/ast/ast_type.cc b/src/tint/ast/ast_type.cc index ec247c9460..768493f90a 100644 --- a/src/tint/ast/ast_type.cc +++ b/src/tint/ast/ast_type.cc @@ -30,7 +30,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Type); namespace tint::ast { -Type::Type(ProgramID pid, const Source& src) : Base(pid, src) {} +Type::Type(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} Type::Type(Type&&) = default; diff --git a/src/tint/ast/atomic.cc b/src/tint/ast/atomic.cc index ce7019b853..9914c6a8bc 100644 --- a/src/tint/ast/atomic.cc +++ b/src/tint/ast/atomic.cc @@ -20,8 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Atomic); namespace tint::ast { -Atomic::Atomic(ProgramID pid, const Source& src, const Type* const subtype) - : Base(pid, src), type(subtype) {} +Atomic::Atomic(ProgramID pid, NodeID nid, const Source& src, const Type* const subtype) + : Base(pid, nid, src), type(subtype) {} std::string Atomic::FriendlyName(const SymbolTable& symbols) const { std::ostringstream out; diff --git a/src/tint/ast/atomic.h b/src/tint/ast/atomic.h index 5f634222f1..689871e1cf 100644 --- a/src/tint/ast/atomic.h +++ b/src/tint/ast/atomic.h @@ -26,9 +26,10 @@ class Atomic final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param subtype the pointee type - Atomic(ProgramID pid, const Source& src, const Type* const subtype); + Atomic(ProgramID pid, NodeID nid, const Source& src, const Type* const subtype); /// Move constructor Atomic(Atomic&&); ~Atomic() override; diff --git a/src/tint/ast/attribute.h b/src/tint/ast/attribute.h index cb9bf766d4..180978258f 100644 --- a/src/tint/ast/attribute.h +++ b/src/tint/ast/attribute.h @@ -33,19 +33,17 @@ class Attribute : public Castable { protected: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - Attribute(ProgramID pid, const Source& src) : Base(pid, src) {} + Attribute(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} }; -/// A list of attributes -using AttributeList = std::vector; - /// @param attributes the list of attributes to search /// @returns true if `attributes` includes a attribute of type `T` -template -bool HasAttribute(const AttributeList& attributes) { +template +bool HasAttribute(utils::VectorRef attributes) { for (auto* attr : attributes) { - if (attr->Is()) { + if (attr->IsAnyOf()) { return true; } } @@ -55,7 +53,7 @@ bool HasAttribute(const AttributeList& attributes) { /// @param attributes the list of attributes to search /// @returns a pointer to `T` from `attributes` if found, otherwise nullptr. template -const T* GetAttribute(const AttributeList& attributes) { +const T* GetAttribute(utils::VectorRef attributes) { for (auto* attr : attributes) { if (attr->Is()) { return attr->As(); diff --git a/src/tint/ast/binary_expression.cc b/src/tint/ast/binary_expression.cc index e3ccd8b882..ebf704eee0 100644 --- a/src/tint/ast/binary_expression.cc +++ b/src/tint/ast/binary_expression.cc @@ -21,11 +21,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BinaryExpression); namespace tint::ast { BinaryExpression::BinaryExpression(ProgramID pid, + NodeID nid, const Source& src, BinaryOp o, const Expression* l, const Expression* r) - : Base(pid, src), op(o), lhs(l), rhs(r) { + : Base(pid, nid, src), op(o), lhs(l), rhs(r) { TINT_ASSERT(AST, lhs); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, lhs, program_id); TINT_ASSERT(AST, rhs); diff --git a/src/tint/ast/binary_expression.h b/src/tint/ast/binary_expression.h index ad59da401d..cdc5960f3c 100644 --- a/src/tint/ast/binary_expression.h +++ b/src/tint/ast/binary_expression.h @@ -46,12 +46,14 @@ enum class BinaryOp { class BinaryExpression final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the binary expression source /// @param op the operation type /// @param lhs the left side of the expression /// @param rhs the right side of the expression - BinaryExpression(ProgramID program_id, + BinaryExpression(ProgramID pid, + NodeID nid, const Source& source, BinaryOp op, const Expression* lhs, diff --git a/src/tint/ast/binding_attribute.cc b/src/tint/ast/binding_attribute.cc index b9282f2aee..8180f99fa1 100644 --- a/src/tint/ast/binding_attribute.cc +++ b/src/tint/ast/binding_attribute.cc @@ -22,8 +22,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BindingAttribute); namespace tint::ast { -BindingAttribute::BindingAttribute(ProgramID pid, const Source& src, uint32_t val) - : Base(pid, src), value(val) {} +BindingAttribute::BindingAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t val) + : Base(pid, nid, src), value(val) {} BindingAttribute::~BindingAttribute() = default; diff --git a/src/tint/ast/binding_attribute.h b/src/tint/ast/binding_attribute.h index 33c5f69542..b5379b8bb4 100644 --- a/src/tint/ast/binding_attribute.h +++ b/src/tint/ast/binding_attribute.h @@ -26,9 +26,10 @@ class BindingAttribute final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param value the binding value - BindingAttribute(ProgramID pid, const Source& src, uint32_t value); + BindingAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t value); ~BindingAttribute() override; /// @returns the WGSL name for the attribute diff --git a/src/tint/ast/binding_attribute_test.cc b/src/tint/ast/binding_attribute_test.cc index f51fc25c27..800093360d 100644 --- a/src/tint/ast/binding_attribute_test.cc +++ b/src/tint/ast/binding_attribute_test.cc @@ -20,7 +20,7 @@ namespace { using BindingAttributeTest = TestHelper; TEST_F(BindingAttributeTest, Creation) { - auto* d = create(2); + auto* d = create(2u); EXPECT_EQ(2u, d->value); } diff --git a/src/tint/ast/bitcast_expression.cc b/src/tint/ast/bitcast_expression.cc index a81c5dd47e..5cabf67e02 100644 --- a/src/tint/ast/bitcast_expression.cc +++ b/src/tint/ast/bitcast_expression.cc @@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BitcastExpression); namespace tint::ast { BitcastExpression::BitcastExpression(ProgramID pid, + NodeID nid, const Source& src, const Type* t, const Expression* e) - : Base(pid, src), type(t), expr(e) { + : Base(pid, nid, src), type(t), expr(e) { TINT_ASSERT(AST, type); TINT_ASSERT(AST, expr); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, expr, program_id); diff --git a/src/tint/ast/bitcast_expression.h b/src/tint/ast/bitcast_expression.h index a231cd286c..66952b7247 100644 --- a/src/tint/ast/bitcast_expression.h +++ b/src/tint/ast/bitcast_expression.h @@ -28,11 +28,13 @@ namespace tint::ast { class BitcastExpression final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the bitcast expression source /// @param type the type /// @param expr the expr - BitcastExpression(ProgramID program_id, + BitcastExpression(ProgramID pid, + NodeID nid, const Source& source, const Type* type, const Expression* expr); diff --git a/src/tint/ast/block_statement.cc b/src/tint/ast/block_statement.cc index 7d4f49237a..430dbbaa0e 100644 --- a/src/tint/ast/block_statement.cc +++ b/src/tint/ast/block_statement.cc @@ -20,8 +20,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BlockStatement); namespace tint::ast { -BlockStatement::BlockStatement(ProgramID pid, const Source& src, const StatementList& stmts) - : Base(pid, src), statements(std::move(stmts)) { +BlockStatement::BlockStatement(ProgramID pid, + NodeID nid, + const Source& src, + utils::VectorRef stmts) + : Base(pid, nid, src), statements(std::move(stmts)) { for (auto* stmt : statements) { TINT_ASSERT(AST, stmt); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, stmt, program_id); @@ -36,7 +39,7 @@ const BlockStatement* BlockStatement::Clone(CloneContext* ctx) const { // Clone arguments outside of create() call to have deterministic ordering auto src = ctx->Clone(source); auto stmts = ctx->Clone(statements); - return ctx->dst->create(src, stmts); + return ctx->dst->create(src, std::move(stmts)); } } // namespace tint::ast diff --git a/src/tint/ast/block_statement.h b/src/tint/ast/block_statement.h index 48ea35a0fe..22d0a65e5b 100644 --- a/src/tint/ast/block_statement.h +++ b/src/tint/ast/block_statement.h @@ -25,19 +25,23 @@ namespace tint::ast { class BlockStatement final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the block statement source /// @param statements the statements - BlockStatement(ProgramID program_id, const Source& source, const StatementList& statements); + BlockStatement(ProgramID pid, + NodeID nid, + const Source& source, + utils::VectorRef statements); /// Move constructor BlockStatement(BlockStatement&&); ~BlockStatement() override; /// @returns true if the block has no statements - bool Empty() const { return statements.empty(); } + bool Empty() const { return statements.IsEmpty(); } /// @returns the last statement in the block or nullptr if block empty - const Statement* Last() const { return statements.empty() ? nullptr : statements.back(); } + const Statement* Last() const { return statements.IsEmpty() ? nullptr : statements.Back(); } /// Clones this node and all transitive child nodes using the `CloneContext` /// `ctx`. @@ -46,7 +50,7 @@ class BlockStatement final : public Castable { const BlockStatement* Clone(CloneContext* ctx) const override; /// the statement list - const StatementList statements; + const utils::Vector statements; }; } // namespace tint::ast diff --git a/src/tint/ast/block_statement_test.cc b/src/tint/ast/block_statement_test.cc index 4097b209ac..ec92c3f9d2 100644 --- a/src/tint/ast/block_statement_test.cc +++ b/src/tint/ast/block_statement_test.cc @@ -26,21 +26,21 @@ TEST_F(BlockStatementTest, Creation) { auto* d = create(); auto* ptr = d; - auto* b = create(StatementList{d}); + auto* b = create(utils::Vector{d}); - ASSERT_EQ(b->statements.size(), 1u); + ASSERT_EQ(b->statements.Length(), 1u); EXPECT_EQ(b->statements[0], ptr); } TEST_F(BlockStatementTest, Creation_WithSource) { - auto* b = create(Source{Source::Location{20, 2}}, ast::StatementList{}); + auto* b = create(Source{Source::Location{20, 2}}, utils::Empty); auto src = b->source; EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); } TEST_F(BlockStatementTest, IsBlock) { - auto* b = create(ast::StatementList{}); + auto* b = create(utils::Empty); EXPECT_TRUE(b->Is()); } @@ -48,7 +48,7 @@ TEST_F(BlockStatementTest, Assert_Null_Statement) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.create(ast::StatementList{nullptr}); + b.create(utils::Vector{nullptr}); }, "internal compiler error"); } @@ -58,7 +58,7 @@ TEST_F(BlockStatementTest, Assert_DifferentProgramID_Statement) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(ast::StatementList{b2.create()}); + b1.create(utils::Vector{b2.create()}); }, "internal compiler error"); } diff --git a/src/tint/ast/bool.cc b/src/tint/ast/bool.cc index af951e7538..9b326eb044 100644 --- a/src/tint/ast/bool.cc +++ b/src/tint/ast/bool.cc @@ -20,7 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Bool); namespace tint::ast { -Bool::Bool(ProgramID pid, const Source& src) : Base(pid, src) {} +Bool::Bool(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} Bool::Bool(Bool&&) = default; diff --git a/src/tint/ast/bool.h b/src/tint/ast/bool.h index bfe3b78123..d61e49d6af 100644 --- a/src/tint/ast/bool.h +++ b/src/tint/ast/bool.h @@ -32,8 +32,9 @@ class Bool final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - Bool(ProgramID pid, const Source& src); + Bool(ProgramID pid, NodeID nid, const Source& src); /// Move constructor Bool(Bool&&); ~Bool() override; diff --git a/src/tint/ast/bool_literal_expression.cc b/src/tint/ast/bool_literal_expression.cc index cfaacb95ae..10ab4f0723 100644 --- a/src/tint/ast/bool_literal_expression.cc +++ b/src/tint/ast/bool_literal_expression.cc @@ -20,8 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BoolLiteralExpression); namespace tint::ast { -BoolLiteralExpression::BoolLiteralExpression(ProgramID pid, const Source& src, bool val) - : Base(pid, src), value(val) {} +BoolLiteralExpression::BoolLiteralExpression(ProgramID pid, NodeID nid, const Source& src, bool val) + : Base(pid, nid, src), value(val) {} BoolLiteralExpression::~BoolLiteralExpression() = default; diff --git a/src/tint/ast/bool_literal_expression.h b/src/tint/ast/bool_literal_expression.h index f2c4c3f84c..bebd924a7f 100644 --- a/src/tint/ast/bool_literal_expression.h +++ b/src/tint/ast/bool_literal_expression.h @@ -26,9 +26,10 @@ class BoolLiteralExpression final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - BreakStatement(ProgramID pid, const Source& src); + BreakStatement(ProgramID pid, NodeID nid, const Source& src); /// Move constructor BreakStatement(BreakStatement&&); ~BreakStatement() override; diff --git a/src/tint/ast/builtin.cc b/src/tint/ast/builtin.cc deleted file mode 100644 index d215a5c3ee..0000000000 --- a/src/tint/ast/builtin.cc +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/ast/builtin.h" - -namespace tint::ast { - -std::ostream& operator<<(std::ostream& out, Builtin builtin) { - switch (builtin) { - case Builtin::kNone: { - out << "none"; - break; - } - case Builtin::kPosition: { - out << "position"; - break; - } - case Builtin::kVertexIndex: { - out << "vertex_index"; - break; - } - case Builtin::kInstanceIndex: { - out << "instance_index"; - break; - } - case Builtin::kFrontFacing: { - out << "front_facing"; - break; - } - case Builtin::kFragDepth: { - out << "frag_depth"; - break; - } - case Builtin::kLocalInvocationId: { - out << "local_invocation_id"; - break; - } - case Builtin::kLocalInvocationIndex: { - out << "local_invocation_index"; - break; - } - case Builtin::kGlobalInvocationId: { - out << "global_invocation_id"; - break; - } - case Builtin::kWorkgroupId: { - out << "workgroup_id"; - break; - } - case Builtin::kNumWorkgroups: { - out << "num_workgroups"; - break; - } - case Builtin::kSampleIndex: { - out << "sample_index"; - break; - } - case Builtin::kSampleMask: { - out << "sample_mask"; - break; - } - case Builtin::kPointSize: { - out << "pointsize"; - } - } - return out; -} - -} // namespace tint::ast diff --git a/src/tint/ast/builtin.h b/src/tint/ast/builtin.h deleted file mode 100644 index 699632a0e9..0000000000 --- a/src/tint/ast/builtin.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_TINT_AST_BUILTIN_H_ -#define SRC_TINT_AST_BUILTIN_H_ - -#include - -namespace tint::ast { - -/// The builtin identifiers -enum class Builtin { - kNone = -1, - kPosition, - kVertexIndex, - kInstanceIndex, - kFrontFacing, - kFragDepth, - kLocalInvocationId, - kLocalInvocationIndex, - kGlobalInvocationId, - kWorkgroupId, - kNumWorkgroups, - kSampleIndex, - kSampleMask, - - // Below are not currently WGSL builtins, but are included in this enum as - // they are used by certain backends. - kPointSize, -}; - -/// @param out the std::ostream to write to -/// @param builtin the Builtin -/// @return the std::ostream so calls can be chained -std::ostream& operator<<(std::ostream& out, Builtin builtin); - -} // namespace tint::ast - -#endif // SRC_TINT_AST_BUILTIN_H_ diff --git a/src/tint/ast/builtin_attribute.cc b/src/tint/ast/builtin_attribute.cc index 03e47b6074..d5aace008a 100644 --- a/src/tint/ast/builtin_attribute.cc +++ b/src/tint/ast/builtin_attribute.cc @@ -22,8 +22,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::BuiltinAttribute); namespace tint::ast { -BuiltinAttribute::BuiltinAttribute(ProgramID pid, const Source& src, Builtin b) - : Base(pid, src), builtin(b) {} +BuiltinAttribute::BuiltinAttribute(ProgramID pid, NodeID nid, const Source& src, BuiltinValue b) + : Base(pid, nid, src), builtin(b) {} BuiltinAttribute::~BuiltinAttribute() = default; diff --git a/src/tint/ast/builtin_attribute.h b/src/tint/ast/builtin_attribute.h index 75898be596..0aae24b57c 100644 --- a/src/tint/ast/builtin_attribute.h +++ b/src/tint/ast/builtin_attribute.h @@ -18,7 +18,7 @@ #include #include "src/tint/ast/attribute.h" -#include "src/tint/ast/builtin.h" +#include "src/tint/ast/builtin_value.h" namespace tint::ast { @@ -27,9 +27,10 @@ class BuiltinAttribute final : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param builtin the builtin value - BuiltinAttribute(ProgramID pid, const Source& src, Builtin builtin); + BuiltinAttribute(ProgramID pid, NodeID nid, const Source& src, BuiltinValue builtin); ~BuiltinAttribute() override; /// @returns the WGSL name for the attribute @@ -42,7 +43,7 @@ class BuiltinAttribute final : public Castable { const BuiltinAttribute* Clone(CloneContext* ctx) const override; /// The builtin value - const Builtin builtin; + const BuiltinValue builtin; }; } // namespace tint::ast diff --git a/src/tint/ast/builtin_attribute_test.cc b/src/tint/ast/builtin_attribute_test.cc index a57f5b1f08..dba6997faa 100644 --- a/src/tint/ast/builtin_attribute_test.cc +++ b/src/tint/ast/builtin_attribute_test.cc @@ -20,8 +20,8 @@ namespace { using BuiltinAttributeTest = TestHelper; TEST_F(BuiltinAttributeTest, Creation) { - auto* d = create(Builtin::kFragDepth); - EXPECT_EQ(Builtin::kFragDepth, d->builtin); + auto* d = create(BuiltinValue::kFragDepth); + EXPECT_EQ(BuiltinValue::kFragDepth, d->builtin); } } // namespace diff --git a/src/tint/ast/builtin_texture_helper_test.cc b/src/tint/ast/builtin_texture_helper_test.cc index 8f9091d9af..882c0bb0d4 100644 --- a/src/tint/ast/builtin_texture_helper_test.cc +++ b/src/tint/ast/builtin_texture_helper_test.cc @@ -29,7 +29,7 @@ TextureOverloadCase::TextureOverloadCase(ValidTextureOverload o, ast::TextureDimension dims, TextureDataType datatype, const char* f, - std::function a) + std::function a) : overload(o), description(desc), texture_kind(tk), @@ -44,7 +44,7 @@ TextureOverloadCase::TextureOverloadCase(ValidTextureOverload o, ast::TextureDimension dims, TextureDataType datatype, const char* f, - std::function a) + std::function a) : overload(o), description(desc), texture_kind(tk), @@ -59,7 +59,7 @@ TextureOverloadCase::TextureOverloadCase(ValidTextureOverload o, ast::TextureDimension dims, TextureDataType datatype, const char* f, - std::function a) + std::function a) : overload(o), description(d), texture_kind(TextureKind::kStorage), @@ -141,31 +141,32 @@ const ast::Type* TextureOverloadCase::BuildResultVectorComponentType(ProgramBuil } const ast::Variable* TextureOverloadCase::BuildTextureVariable(ProgramBuilder* b) const { - AttributeList attrs = { - b->create(0), - b->create(0), + utils::Vector attrs{ + b->create(0u), + b->create(0u), }; switch (texture_kind) { case ast::builtin::test::TextureKind::kRegular: - return b->Global( + return b->GlobalVar( "texture", b->ty.sampled_texture(texture_dimension, BuildResultVectorComponentType(b)), attrs); case ast::builtin::test::TextureKind::kDepth: - return b->Global("texture", b->ty.depth_texture(texture_dimension), attrs); + return b->GlobalVar("texture", b->ty.depth_texture(texture_dimension), attrs); case ast::builtin::test::TextureKind::kDepthMultisampled: - return b->Global("texture", b->ty.depth_multisampled_texture(texture_dimension), attrs); + return b->GlobalVar("texture", b->ty.depth_multisampled_texture(texture_dimension), + attrs); case ast::builtin::test::TextureKind::kMultisampled: - return b->Global( + return b->GlobalVar( "texture", b->ty.multisampled_texture(texture_dimension, BuildResultVectorComponentType(b)), attrs); case ast::builtin::test::TextureKind::kStorage: { auto* st = b->ty.storage_texture(texture_dimension, texel_format, access); - return b->Global("texture", st, attrs); + return b->GlobalVar("texture", st, attrs); } } @@ -174,11 +175,11 @@ const ast::Variable* TextureOverloadCase::BuildTextureVariable(ProgramBuilder* b } const ast::Variable* TextureOverloadCase::BuildSamplerVariable(ProgramBuilder* b) const { - AttributeList attrs = { - b->create(0), - b->create(1), + utils::Vector attrs = { + b->create(0u), + b->create(1u), }; - return b->Global("sampler", b->ty.sampler(sampler_kind), attrs); + return b->GlobalVar("sampler", b->ty.sampler(sampler_kind), attrs); } std::vector TextureOverloadCase::ValidCases() { @@ -461,7 +462,7 @@ std::vector TextureOverloadCase::ValidCases() { return b->ExprList(0_i, // component "texture", // t "sampler", // s - b->vec2(1.f, 2.f)); // coords + b->vec2(1_f, 2_f)); // coords }, }, { @@ -480,7 +481,7 @@ std::vector TextureOverloadCase::ValidCases() { return b->ExprList(0_i, // component "texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords b->vec2(3_i, 4_i)); // offset }, }, @@ -500,7 +501,7 @@ std::vector TextureOverloadCase::ValidCases() { return b->ExprList(0_i, // component "texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i); // array index }, }, @@ -521,7 +522,7 @@ std::vector TextureOverloadCase::ValidCases() { return b->ExprList(0_i, // component "texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index b->vec2(4_i, 5_i)); // offset }, @@ -541,7 +542,7 @@ std::vector TextureOverloadCase::ValidCases() { return b->ExprList(0_i, // component "texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f)); // coords + b->vec3(1_f, 2_f, 3_f)); // coords }, }, { @@ -560,7 +561,7 @@ std::vector TextureOverloadCase::ValidCases() { return b->ExprList(0_i, // component "texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i); // array_index }, }, @@ -577,7 +578,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f)); // coords + b->vec2(1_f, 2_f)); // coords }, }, { @@ -594,7 +595,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords b->vec2(3_i, 4_i)); // offset }, }, @@ -612,7 +613,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i); // array_index }, }, @@ -631,7 +632,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index b->vec2(4_i, 5_i)); // offset }, @@ -649,7 +650,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f)); // coords + b->vec3(1_f, 2_f, 3_f)); // coords }, }, { @@ -666,7 +667,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i); // array_index }, }, @@ -684,8 +685,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords - 3.f); // depth_ref + b->vec2(1_f, 2_f), // coords + 3_f); // depth_ref }, }, { @@ -703,8 +704,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords - 3.f, // depth_ref + b->vec2(1_f, 2_f), // coords + 3_f, // depth_ref b->vec2(4_i, 5_i)); // offset }, }, @@ -723,9 +724,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index - 4.f); // depth_ref + 4_f); // depth_ref }, }, { @@ -744,9 +745,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index - 4.f, // depth_ref + 4_f, // depth_ref b->vec2(5_i, 6_i)); // offset }, }, @@ -764,8 +765,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - 4.f); // depth_ref + b->vec3(1_f, 2_f, 3_f), // coords + 4_f); // depth_ref }, }, { @@ -783,9 +784,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i, // array_index - 5.f); // depth_ref + 5_f); // depth_ref }, }, { @@ -951,7 +952,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - 1.0f); // coords + 1_f); // coords }, }, { @@ -967,7 +968,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f)); // coords + b->vec2(1_f, 2_f)); // coords }, }, { @@ -984,7 +985,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords b->vec2(3_i, 4_i)); // offset }, }, @@ -1002,7 +1003,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i); // array_index }, }, @@ -1021,7 +1022,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index b->vec2(4_i, 5_i)); // offset }, @@ -1039,7 +1040,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f)); // coords + b->vec3(1_f, 2_f, 3_f)); // coords }, }, { @@ -1056,7 +1057,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords b->vec3(4_i, 5_i, 6_i)); // offset }, }, @@ -1073,7 +1074,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f)); // coords + b->vec3(1_f, 2_f, 3_f)); // coords }, }, { @@ -1090,7 +1091,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i); // array_index }, }, @@ -1107,7 +1108,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f)); // coords + b->vec2(1_f, 2_f)); // coords }, }, { @@ -1124,7 +1125,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords b->vec2(3_i, 4_i)); // offset }, }, @@ -1142,7 +1143,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i); // array_index }, }, @@ -1161,7 +1162,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index b->vec2(4_i, 5_i)); // offset }, @@ -1179,7 +1180,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f)); // coords + b->vec3(1_f, 2_f, 3_f)); // coords }, }, { @@ -1196,7 +1197,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i); // array_index }, }, @@ -1214,8 +1215,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords - 3.f); // bias + b->vec2(1_f, 2_f), // coords + 3_f); // bias }, }, { @@ -1233,8 +1234,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords - 3.f, // bias + b->vec2(1_f, 2_f), // coords + 3_f, // bias b->vec2(4_i, 5_i)); // offset }, }, @@ -1253,9 +1254,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 4_i, // array_index - 3.f); // bias + 3_f); // bias }, }, { @@ -1274,9 +1275,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index - 4.f, // bias + 4_f, // bias b->vec2(5_i, 6_i)); // offset }, }, @@ -1294,8 +1295,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - 4.f); // bias + b->vec3(1_f, 2_f, 3_f), // coords + 4_f); // bias }, }, { @@ -1313,8 +1314,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - 4.f, // bias + b->vec3(1_f, 2_f, 3_f), // coords + 4_f, // bias b->vec3(5_i, 6_i, 7_i)); // offset }, }, @@ -1332,8 +1333,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - 4.f); // bias + b->vec3(1_f, 2_f, 3_f), // coords + 4_f); // bias }, }, { @@ -1351,9 +1352,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 3_i, // array_index - 4.f); // bias + 4_f); // bias }, }, { @@ -1370,8 +1371,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords - 3.f); // level + b->vec2(1_f, 2_f), // coords + 3_f); // level }, }, { @@ -1389,8 +1390,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords - 3.f, // level + b->vec2(1_f, 2_f), // coords + 3_f, // level b->vec2(4_i, 5_i)); // offset }, }, @@ -1409,9 +1410,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index - 4.f); // level + 4_f); // level }, }, { @@ -1430,9 +1431,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index - 4.f, // level + 4_f, // level b->vec2(5_i, 6_i)); // offset }, }, @@ -1450,8 +1451,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - 4.f); // level + b->vec3(1_f, 2_f, 3_f), // coords + 4_f); // level }, }, { @@ -1469,8 +1470,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - 4.f, // level + b->vec3(1_f, 2_f, 3_f), // coords + 4_f, // level b->vec3(5_i, 6_i, 7_i)); // offset }, }, @@ -1488,8 +1489,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - 4.f); // level + b->vec3(1_f, 2_f, 3_f), // coords + 4_f); // level }, }, { @@ -1507,9 +1508,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i, // array_index - 5.f); // level + 5_f); // level }, }, { @@ -1526,7 +1527,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i); // level }, }, @@ -1545,7 +1546,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // level b->vec2(4_i, 5_i)); // offset }, @@ -1565,7 +1566,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index 4_i); // level }, @@ -1586,7 +1587,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index 4_i, // level b->vec2(5_i, 6_i)); // offset @@ -1606,7 +1607,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i); // level }, }, @@ -1625,7 +1626,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i, // array_index 5_i); // level }, @@ -1643,11 +1644,11 @@ std::vector TextureOverloadCase::ValidCases() { TextureDataType::kF32, "textureSampleGrad", [](ProgramBuilder* b) { - return b->ExprList("texture", // t - "sampler", // s - b->vec2(1.0f, 2.0f), // coords - b->vec2(3.0f, 4.0f), // ddx - b->vec2(5.0f, 6.0f)); // ddy + return b->ExprList("texture", // t + "sampler", // s + b->vec2(1_f, 2_f), // coords + b->vec2(3_f, 4_f), // ddx + b->vec2(5_f, 6_f)); // ddy }, }, { @@ -1666,9 +1667,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords - b->vec2(3.f, 4.f), // ddx - b->vec2(5.f, 6.f), // ddy + b->vec2(1_f, 2_f), // coords + b->vec2(3_f, 4_f), // ddx + b->vec2(5_f, 6_f), // ddy b->vec2(7_i, 7_i)); // offset }, }, @@ -1688,10 +1689,10 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index - b->vec2(4.f, 5.f), // ddx - b->vec2(6.f, 7.f)); // ddy + b->vec2(4_f, 5_f), // ddx + b->vec2(6_f, 7_f)); // ddy }, }, { @@ -1711,10 +1712,10 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 3_i, // array_index - b->vec2(4.f, 5.f), // ddx - b->vec2(6.f, 7.f), // ddy + b->vec2(4_f, 5_f), // ddx + b->vec2(6_f, 7_f), // ddy b->vec2(6_i, 7_i)); // offset }, }, @@ -1733,9 +1734,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - b->vec3(4.f, 5.f, 6.f), // ddx - b->vec3(7.f, 8.f, 9.f)); // ddy + b->vec3(1_f, 2_f, 3_f), // coords + b->vec3(4_f, 5_f, 6_f), // ddx + b->vec3(7_f, 8_f, 9_f)); // ddy }, }, { @@ -1754,9 +1755,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - b->vec3(4.f, 5.f, 6.f), // ddx - b->vec3(7.f, 8.f, 9.f), // ddy + b->vec3(1_f, 2_f, 3_f), // coords + b->vec3(4_f, 5_f, 6_f), // ddx + b->vec3(7_f, 8_f, 9_f), // ddy b->vec3(0_i, 1_i, 2_i)); // offset }, }, @@ -1775,9 +1776,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - b->vec3(4.f, 5.f, 6.f), // ddx - b->vec3(7.f, 8.f, 9.f)); // ddy + b->vec3(1_f, 2_f, 3_f), // coords + b->vec3(4_f, 5_f, 6_f), // ddx + b->vec3(7_f, 8_f, 9_f)); // ddy }, }, { @@ -1796,10 +1797,10 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i, // array_index - b->vec3(5.f, 6.f, 7.f), // ddx - b->vec3(8.f, 9.f, 10.f)); // ddy + b->vec3(5_f, 6_f, 7_f), // ddx + b->vec3(8_f, 9_f, 10_f)); // ddy }, }, { @@ -1816,8 +1817,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords - 3.f); // depth_ref + b->vec2(1_f, 2_f), // coords + 3_f); // depth_ref }, }, { @@ -1835,8 +1836,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords - 3.f, // depth_ref + b->vec2(1_f, 2_f), // coords + 3_f, // depth_ref b->vec2(4_i, 5_i)); // offset }, }, @@ -1855,9 +1856,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 4_i, // array_index - 3.f); // depth_ref + 3_f); // depth_ref }, }, { @@ -1876,9 +1877,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec2(1.f, 2.f), // coords + b->vec2(1_f, 2_f), // coords 4_i, // array_index - 3.f, // depth_ref + 3_f, // depth_ref b->vec2(5_i, 6_i)); // offset }, }, @@ -1896,8 +1897,8 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords - 4.f); // depth_ref + b->vec3(1_f, 2_f, 3_f), // coords + 4_f); // depth_ref }, }, { @@ -1915,9 +1916,9 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t "sampler", // s - b->vec3(1.f, 2.f, 3.f), // coords + b->vec3(1_f, 2_f, 3_f), // coords 4_i, // array_index - 5.f); // depth_ref + 5_f); // depth_ref }, }, { @@ -2196,7 +2197,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t 1_i, // coords - b->vec4(2.f, 3.f, 4.f, 5.f)); // value + b->vec4(2_f, 3_f, 4_f, 5_f)); // value }, }, { @@ -2212,7 +2213,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t b->vec2(1_i, 2_i), // coords - b->vec4(3.f, 4.f, 5.f, 6.f)); // value + b->vec4(3_f, 4_f, 5_f, 6_f)); // value }, }, { @@ -2230,7 +2231,7 @@ std::vector TextureOverloadCase::ValidCases() { return b->ExprList("texture", // t b->vec2(1_i, 2_i), // coords 3_i, // array_index - b->vec4(4.f, 5.f, 6.f, 7.f)); // value + b->vec4(4_f, 5_f, 6_f, 7_f)); // value }, }, { @@ -2246,7 +2247,7 @@ std::vector TextureOverloadCase::ValidCases() { [](ProgramBuilder* b) { return b->ExprList("texture", // t b->vec3(1_i, 2_i, 3_i), // coords - b->vec4(4.f, 5.f, 6.f, 7.f)); // value + b->vec4(4_f, 5_f, 6_f, 7_f)); // value }, }, }; diff --git a/src/tint/ast/builtin_texture_helper_test.h b/src/tint/ast/builtin_texture_helper_test.h index d2737e194c..bb61875d00 100644 --- a/src/tint/ast/builtin_texture_helper_test.h +++ b/src/tint/ast/builtin_texture_helper_test.h @@ -177,6 +177,9 @@ bool ReturnsVoid(ValidTextureOverload texture_overload); /// Describes a texture builtin overload struct TextureOverloadCase { + /// Args is a list of ast::Expression used as arguments to the texture overload case. + using Args = utils::Vector; + /// Constructor for textureSample...() functions TextureOverloadCase(ValidTextureOverload, const char*, @@ -185,7 +188,7 @@ struct TextureOverloadCase { ast::TextureDimension, TextureDataType, const char*, - std::function); + std::function); /// Constructor for textureLoad() functions with non-storage textures TextureOverloadCase(ValidTextureOverload, const char*, @@ -193,7 +196,7 @@ struct TextureOverloadCase { ast::TextureDimension, TextureDataType, const char*, - std::function); + std::function); /// Constructor for textureLoad() with storage textures TextureOverloadCase(ValidTextureOverload, const char*, @@ -202,7 +205,7 @@ struct TextureOverloadCase { ast::TextureDimension, TextureDataType, const char*, - std::function); + std::function); /// Copy constructor TextureOverloadCase(const TextureOverloadCase&); /// Destructor @@ -238,7 +241,7 @@ struct TextureOverloadCase { Access const access = Access::kReadWrite; /// The image format for the storage texture /// Used only when texture_kind is kStorage - ast::TexelFormat const texel_format = ast::TexelFormat::kNone; + ast::TexelFormat const texel_format = ast::TexelFormat::kInvalid; /// The dimensions of the texture parameter ast::TextureDimension const texture_dimension; /// The data type of the texture parameter @@ -246,7 +249,7 @@ struct TextureOverloadCase { /// Name of the function. e.g. `textureSample`, `textureSampleGrad`, etc const char* const function; /// A function that builds the AST arguments for the overload - std::function const args; + std::function const args; }; std::ostream& operator<<(std::ostream& out, const TextureOverloadCase& data); diff --git a/src/tint/ast/builtin_value.cc b/src/tint/ast/builtin_value.cc new file mode 100644 index 0000000000..e8d6451404 --- /dev/null +++ b/src/tint/ast/builtin_value.cc @@ -0,0 +1,104 @@ +// Copyright 2020 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/builtin_value.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/builtin_value.h" + +namespace tint::ast { + +/// ParseBuiltinValue parses a BuiltinValue from a string. +/// @param str the string to parse +/// @returns the parsed enum, or BuiltinValue::kInvalid if the string could not be parsed. +BuiltinValue ParseBuiltinValue(std::string_view str) { + if (str == "position") { + return BuiltinValue::kPosition; + } + if (str == "vertex_index") { + return BuiltinValue::kVertexIndex; + } + if (str == "instance_index") { + return BuiltinValue::kInstanceIndex; + } + if (str == "front_facing") { + return BuiltinValue::kFrontFacing; + } + if (str == "frag_depth") { + return BuiltinValue::kFragDepth; + } + if (str == "local_invocation_id") { + return BuiltinValue::kLocalInvocationId; + } + if (str == "local_invocation_index") { + return BuiltinValue::kLocalInvocationIndex; + } + if (str == "global_invocation_id") { + return BuiltinValue::kGlobalInvocationId; + } + if (str == "workgroup_id") { + return BuiltinValue::kWorkgroupId; + } + if (str == "num_workgroups") { + return BuiltinValue::kNumWorkgroups; + } + if (str == "sample_index") { + return BuiltinValue::kSampleIndex; + } + if (str == "sample_mask") { + return BuiltinValue::kSampleMask; + } + return BuiltinValue::kInvalid; +} + +std::ostream& operator<<(std::ostream& out, BuiltinValue value) { + switch (value) { + case BuiltinValue::kInvalid: + return out << "invalid"; + case BuiltinValue::kPosition: + return out << "position"; + case BuiltinValue::kVertexIndex: + return out << "vertex_index"; + case BuiltinValue::kInstanceIndex: + return out << "instance_index"; + case BuiltinValue::kFrontFacing: + return out << "front_facing"; + case BuiltinValue::kFragDepth: + return out << "frag_depth"; + case BuiltinValue::kLocalInvocationId: + return out << "local_invocation_id"; + case BuiltinValue::kLocalInvocationIndex: + return out << "local_invocation_index"; + case BuiltinValue::kGlobalInvocationId: + return out << "global_invocation_id"; + case BuiltinValue::kWorkgroupId: + return out << "workgroup_id"; + case BuiltinValue::kNumWorkgroups: + return out << "num_workgroups"; + case BuiltinValue::kSampleIndex: + return out << "sample_index"; + case BuiltinValue::kSampleMask: + return out << "sample_mask"; + case BuiltinValue::kPointSize: + return out << "point_size"; + } + return out << ""; +} + +} // namespace tint::ast diff --git a/src/tint/ast/builtin_value.cc.tmpl b/src/tint/ast/builtin_value.cc.tmpl new file mode 100644 index 0000000000..7340c8806f --- /dev/null +++ b/src/tint/ast/builtin_value.cc.tmpl @@ -0,0 +1,22 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate builtin_value.cc + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "builtin_value") -}} + +#include "src/tint/ast/builtin_value.h" + +namespace tint::ast { + +{{ Eval "ParseEnum" $enum}} + +{{ Eval "EnumOStream" $enum}} + +} // namespace tint::ast diff --git a/src/tint/ast/builtin_value.h b/src/tint/ast/builtin_value.h new file mode 100644 index 0000000000..0a2c7f02ff --- /dev/null +++ b/src/tint/ast/builtin_value.h @@ -0,0 +1,60 @@ +// Copyright 2020 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/builtin_value.h.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#ifndef SRC_TINT_AST_BUILTIN_VALUE_H_ +#define SRC_TINT_AST_BUILTIN_VALUE_H_ + +#include + +namespace tint::ast { + +/// Storage class of a given pointer. +enum class BuiltinValue { + kInvalid, + kPosition, + kVertexIndex, + kInstanceIndex, + kFrontFacing, + kFragDepth, + kLocalInvocationId, + kLocalInvocationIndex, + kGlobalInvocationId, + kWorkgroupId, + kNumWorkgroups, + kSampleIndex, + kSampleMask, + kPointSize, // Tint-internal enum entry - not parsed +}; + +/// @param out the std::ostream to write to +/// @param value the BuiltinValue +/// @returns `out` so calls can be chained +std::ostream& operator<<(std::ostream& out, BuiltinValue value); + +/// ParseBuiltinValue parses a BuiltinValue from a string. +/// @param str the string to parse +/// @returns the parsed enum, or BuiltinValue::kInvalid if the string could not be parsed. +BuiltinValue ParseBuiltinValue(std::string_view str); + +} // namespace tint::ast + +#endif // SRC_TINT_AST_BUILTIN_VALUE_H_ diff --git a/src/tint/ast/builtin_value.h.tmpl b/src/tint/ast/builtin_value.h.tmpl new file mode 100644 index 0000000000..1985305c23 --- /dev/null +++ b/src/tint/ast/builtin_value.h.tmpl @@ -0,0 +1,26 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate builtin_value.h + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "builtin_value") -}} + +#ifndef SRC_TINT_AST_BUILTIN_VALUE_H_ +#define SRC_TINT_AST_BUILTIN_VALUE_H_ + +#include + +namespace tint::ast { + +/// Storage class of a given pointer. +{{ Eval "DeclareEnum" $enum}} + +} // namespace tint::ast + +#endif // SRC_TINT_AST_BUILTIN_VALUE_H_ diff --git a/src/tint/ast/builtin_value_bench.cc b/src/tint/ast/builtin_value_bench.cc new file mode 100644 index 0000000000..0a4048c5e1 --- /dev/null +++ b/src/tint/ast/builtin_value_bench.cc @@ -0,0 +1,130 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/builtin_value_bench.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/builtin_value.h" + +#include + +#include "benchmark/benchmark.h" + +namespace tint::ast { +namespace { + +void BuiltinValueParser(::benchmark::State& state) { + std::array kStrings{ + "pccsitin", + "oiti3", + "positVon", + "position", + "1osition", + "osJtqqon", + "llos77tion", + "vrtHHppx_index", + "vertx_icx", + "veGtex_bnde", + "vertex_index", + "vertex_inveii", + "veWWtex_ind8x", + "vxxrtMx_indx", + "isXance_indegg", + "insanc_iXVex", + "instance_in3ex", + "instance_index", + "instancE_index", + "nsTTance_PPndex", + "nstancxx_indddx", + "44ront_facing", + "fSSont_facinVV", + "fronR_Racing", + "front_facing", + "ron9_faciFg", + "front_facin", + "fVonRR_HaOing", + "fyag_epth", + "f77ag_nnellrrh", + "fra400depth", + "frag_depth", + "fa_epooh", + "frg_ezzth", + "f11a_eppiih", + "local_invXXcation_id", + "lIIcal_i5599ocation_inn", + "HHrrcal_inSSocation_Yaa", + "local_invocation_id", + "lokkal_invocatini", + "jocal_invocRRongid", + "local_inocatbon_i", + "local_injocation_index", + "local_invocatio_index", + "locl_invocqtion_ndex", + "local_invocation_index", + "localNNinvocaton_index", + "local_invocatin_ivvdx", + "locl_invocatioQQ_index", + "globalrnvocaton_iff", + "global_invocation_jd", + "NNlbal_wwnvocation82d", + "global_invocation_id", + "global_invocationid", + "globalrrinvocation_id", + "globaG_invocation_id", + "workgroupFFid", + "worgrupid", + "workgroup_rr", + "workgroup_id", + "workgrouid", + "DokgXoJJp_id", + "8orgrup_i", + "num_wkkr11up", + "numworkgroups", + "Ju_workgroups", + "num_workgroups", + "num_corkgroups", + "num_woOkgroups", + "num_workKK__vvttps", + "smple5inxxe8", + "s__mle_qFdex", + "saqqple_idex", + "sample_index", + "saOpe_33nde66", + "s6oople_indttQx", + "sam66le_inex", + "samxe66masOz", + "yyample_mask", + "amplZZHask", + "sample_mask", + "WWaple_maq4k", + "samplOO_ask", + "sYohpe_msk", + }; + for (auto _ : state) { + for (auto& str : kStrings) { + auto result = ParseBuiltinValue(str); + benchmark::DoNotOptimize(result); + } + } +} + +BENCHMARK(BuiltinValueParser); + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/builtin_value_bench.cc.tmpl b/src/tint/ast/builtin_value_bench.cc.tmpl new file mode 100644 index 0000000000..f50bd20d7e --- /dev/null +++ b/src/tint/ast/builtin_value_bench.cc.tmpl @@ -0,0 +1,26 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate builtin_value_bench.cc + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "builtin_value") -}} + +#include "src/tint/ast/builtin_value.h" + +#include + +#include "benchmark/benchmark.h" + +namespace tint::ast { +namespace { + +{{ Eval "BenchmarkParseEnum" $enum }} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/builtin_value_test.cc b/src/tint/ast/builtin_value_test.cc new file mode 100644 index 0000000000..a29810aa7d --- /dev/null +++ b/src/tint/ast/builtin_value_test.cc @@ -0,0 +1,122 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/builtin_value_test.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/builtin_value.h" + +#include + +#include "src/tint/ast/test_helper.h" +#include "src/tint/utils/string.h" + +namespace tint::ast { +namespace { + +namespace parse_print_tests { + +struct Case { + const char* string; + BuiltinValue value; +}; + +inline std::ostream& operator<<(std::ostream& out, Case c) { + return out << "'" << std::string(c.string) << "'"; +} + +static constexpr Case kValidCases[] = { + {"position", BuiltinValue::kPosition}, + {"vertex_index", BuiltinValue::kVertexIndex}, + {"instance_index", BuiltinValue::kInstanceIndex}, + {"front_facing", BuiltinValue::kFrontFacing}, + {"frag_depth", BuiltinValue::kFragDepth}, + {"local_invocation_id", BuiltinValue::kLocalInvocationId}, + {"local_invocation_index", BuiltinValue::kLocalInvocationIndex}, + {"global_invocation_id", BuiltinValue::kGlobalInvocationId}, + {"workgroup_id", BuiltinValue::kWorkgroupId}, + {"num_workgroups", BuiltinValue::kNumWorkgroups}, + {"sample_index", BuiltinValue::kSampleIndex}, + {"sample_mask", BuiltinValue::kSampleMask}, +}; + +static constexpr Case kInvalidCases[] = { + {"pccsitin", BuiltinValue::kInvalid}, + {"oiti3", BuiltinValue::kInvalid}, + {"positVon", BuiltinValue::kInvalid}, + {"1ertex_index", BuiltinValue::kInvalid}, + {"vertex_Jnqex", BuiltinValue::kInvalid}, + {"velltex_inde77", BuiltinValue::kInvalid}, + {"inpptanceqHHindx", BuiltinValue::kInvalid}, + {"cnsanvendex", BuiltinValue::kInvalid}, + {"istancG_index", BuiltinValue::kInvalid}, + {"front_facvnii", BuiltinValue::kInvalid}, + {"frWWnt_faci8g", BuiltinValue::kInvalid}, + {"fxxonM_facig", BuiltinValue::kInvalid}, + {"fXag_detgg", BuiltinValue::kInvalid}, + {"fag_XuVh", BuiltinValue::kInvalid}, + {"frag_dept3", BuiltinValue::kInvalid}, + {"local_Envocation_id", BuiltinValue::kInvalid}, + {"localiPPvocatioTT_id", BuiltinValue::kInvalid}, + {"localxxnvocationddid", BuiltinValue::kInvalid}, + {"loca44_invocation_index", BuiltinValue::kInvalid}, + {"local_invocSStionVVindex", BuiltinValue::kInvalid}, + {"locRR_invocat22n_index", BuiltinValue::kInvalid}, + {"globalFinvoction_id", BuiltinValue::kInvalid}, + {"gloal_invocation_id", BuiltinValue::kInvalid}, + {"RRlHOOaV_invoction_id", BuiltinValue::kInvalid}, + {"workgyoup_i", BuiltinValue::kInvalid}, + {"wnrrrkg77loup_Gd", BuiltinValue::kInvalid}, + {"00orkgr4up_id", BuiltinValue::kInvalid}, + {"numwroogrops", BuiltinValue::kInvalid}, + {"nzm_wokgroups", BuiltinValue::kInvalid}, + {"uippworkgro11ps", BuiltinValue::kInvalid}, + {"sample_iXXdex", BuiltinValue::kInvalid}, + {"5nnample_99IIdex", BuiltinValue::kInvalid}, + {"samYlaaHHrrndeSS", BuiltinValue::kInvalid}, + {"aHkk_mask", BuiltinValue::kInvalid}, + {"jRRmpl_gsk", BuiltinValue::kInvalid}, + {"smple_mbk", BuiltinValue::kInvalid}, +}; + +using BuiltinValueParseTest = testing::TestWithParam; + +TEST_P(BuiltinValueParseTest, Parse) { + const char* string = GetParam().string; + BuiltinValue expect = GetParam().value; + EXPECT_EQ(expect, ParseBuiltinValue(string)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, BuiltinValueParseTest, testing::ValuesIn(kValidCases)); +INSTANTIATE_TEST_SUITE_P(InvalidCases, BuiltinValueParseTest, testing::ValuesIn(kInvalidCases)); + +using BuiltinValuePrintTest = testing::TestWithParam; + +TEST_P(BuiltinValuePrintTest, Print) { + BuiltinValue value = GetParam().value; + const char* expect = GetParam().string; + EXPECT_EQ(expect, utils::ToString(value)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, BuiltinValuePrintTest, testing::ValuesIn(kValidCases)); + +} // namespace parse_print_tests + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/builtin_value_test.cc.tmpl b/src/tint/ast/builtin_value_test.cc.tmpl new file mode 100644 index 0000000000..213a81b3cc --- /dev/null +++ b/src/tint/ast/builtin_value_test.cc.tmpl @@ -0,0 +1,27 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate builtin_value_test.cc + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "builtin_value") -}} + +#include "src/tint/ast/builtin_value.h" + +#include + +#include "src/tint/ast/test_helper.h" +#include "src/tint/utils/string.h" + +namespace tint::ast { +namespace { + +{{ Eval "TestParsePrintEnum" $enum}} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/call_expression.cc b/src/tint/ast/call_expression.cc index 68b6dc344a..5a8aa96d68 100644 --- a/src/tint/ast/call_expression.cc +++ b/src/tint/ast/call_expression.cc @@ -14,6 +14,8 @@ #include "src/tint/ast/call_expression.h" +#include + #include "src/tint/program_builder.h" TINT_INSTANTIATE_TYPEINFO(tint::ast::CallExpression); @@ -34,10 +36,11 @@ CallExpression::Target ToTarget(const Type* type) { } // namespace CallExpression::CallExpression(ProgramID pid, + NodeID nid, const Source& src, const IdentifierExpression* name, - ExpressionList a) - : Base(pid, src), target(ToTarget(name)), args(a) { + utils::VectorRef a) + : Base(pid, nid, src), target(ToTarget(name)), args(std::move(a)) { TINT_ASSERT(AST, name); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, name, program_id); for (auto* arg : args) { @@ -46,8 +49,12 @@ CallExpression::CallExpression(ProgramID pid, } } -CallExpression::CallExpression(ProgramID pid, const Source& src, const Type* type, ExpressionList a) - : Base(pid, src), target(ToTarget(type)), args(a) { +CallExpression::CallExpression(ProgramID pid, + NodeID nid, + const Source& src, + const Type* type, + utils::VectorRef a) + : Base(pid, nid, src), target(ToTarget(type)), args(std::move(a)) { TINT_ASSERT(AST, type); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, type, program_id); for (auto* arg : args) { @@ -64,8 +71,9 @@ const CallExpression* CallExpression::Clone(CloneContext* ctx) const { // Clone arguments outside of create() call to have deterministic ordering auto src = ctx->Clone(source); auto p = ctx->Clone(args); - return target.name ? ctx->dst->create(src, ctx->Clone(target.name), p) - : ctx->dst->create(src, ctx->Clone(target.type), p); + return target.name + ? ctx->dst->create(src, ctx->Clone(target.name), std::move(p)) + : ctx->dst->create(src, ctx->Clone(target.type), std::move(p)); } } // namespace tint::ast diff --git a/src/tint/ast/call_expression.h b/src/tint/ast/call_expression.h index 9f197114a5..587a88f058 100644 --- a/src/tint/ast/call_expression.h +++ b/src/tint/ast/call_expression.h @@ -33,24 +33,28 @@ namespace tint::ast { class CallExpression final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the call expression source /// @param name the function or type name /// @param args the arguments - CallExpression(ProgramID program_id, + CallExpression(ProgramID pid, + NodeID nid, const Source& source, const IdentifierExpression* name, - ExpressionList args); + utils::VectorRef args); /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the call expression source /// @param type the type /// @param args the arguments - CallExpression(ProgramID program_id, + CallExpression(ProgramID pid, + NodeID nid, const Source& source, const Type* type, - ExpressionList args); + utils::VectorRef args); /// Move constructor CallExpression(CallExpression&&); @@ -76,7 +80,7 @@ class CallExpression final : public Castable { const Target target; /// The arguments - const ExpressionList args; + const utils::Vector args; }; } // namespace tint::ast diff --git a/src/tint/ast/call_expression_test.cc b/src/tint/ast/call_expression_test.cc index 5cb31cb95c..8b5b6a9e87 100644 --- a/src/tint/ast/call_expression_test.cc +++ b/src/tint/ast/call_expression_test.cc @@ -22,23 +22,24 @@ using CallExpressionTest = TestHelper; TEST_F(CallExpressionTest, CreationIdentifier) { auto* func = Expr("func"); - ExpressionList params; - params.push_back(Expr("param1")); - params.push_back(Expr("param2")); + utils::Vector params{ + Expr("param1"), + Expr("param2"), + }; auto* stmt = create(func, params); EXPECT_EQ(stmt->target.name, func); EXPECT_EQ(stmt->target.type, nullptr); const auto& vec = stmt->args; - ASSERT_EQ(vec.size(), 2u); + ASSERT_EQ(vec.Length(), 2u); EXPECT_EQ(vec[0], params[0]); EXPECT_EQ(vec[1], params[1]); } TEST_F(CallExpressionTest, CreationIdentifier_WithSource) { auto* func = Expr("func"); - auto* stmt = create(Source{{20, 2}}, func, ExpressionList{}); + auto* stmt = create(Source{{20, 2}}, func, utils::Empty); EXPECT_EQ(stmt->target.name, func); EXPECT_EQ(stmt->target.type, nullptr); @@ -49,23 +50,24 @@ TEST_F(CallExpressionTest, CreationIdentifier_WithSource) { TEST_F(CallExpressionTest, CreationType) { auto* type = ty.f32(); - ExpressionList params; - params.push_back(Expr("param1")); - params.push_back(Expr("param2")); + utils::Vector params{ + Expr("param1"), + Expr("param2"), + }; auto* stmt = create(type, params); EXPECT_EQ(stmt->target.name, nullptr); EXPECT_EQ(stmt->target.type, type); const auto& vec = stmt->args; - ASSERT_EQ(vec.size(), 2u); + ASSERT_EQ(vec.Length(), 2u); EXPECT_EQ(vec[0], params[0]); EXPECT_EQ(vec[1], params[1]); } TEST_F(CallExpressionTest, CreationType_WithSource) { auto* type = ty.f32(); - auto* stmt = create(Source{{20, 2}}, type, ExpressionList{}); + auto* stmt = create(Source{{20, 2}}, type, utils::Empty); EXPECT_EQ(stmt->target.name, nullptr); EXPECT_EQ(stmt->target.type, type); @@ -76,7 +78,7 @@ TEST_F(CallExpressionTest, CreationType_WithSource) { TEST_F(CallExpressionTest, IsCall) { auto* func = Expr("func"); - auto* stmt = create(func, ExpressionList{}); + auto* stmt = create(func, utils::Empty); EXPECT_TRUE(stmt->Is()); } @@ -84,7 +86,7 @@ TEST_F(CallExpressionTest, Assert_Null_Identifier) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.create(static_cast(nullptr), ExpressionList{}); + b.create(static_cast(nullptr), utils::Empty); }, "internal compiler error"); } @@ -93,7 +95,7 @@ TEST_F(CallExpressionTest, Assert_Null_Type) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.create(static_cast(nullptr), ExpressionList{}); + b.create(static_cast(nullptr), utils::Empty); }, "internal compiler error"); } @@ -102,11 +104,11 @@ TEST_F(CallExpressionTest, Assert_Null_Param) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - ExpressionList params; - params.push_back(b.Expr("param1")); - params.push_back(nullptr); - params.push_back(b.Expr("param2")); - b.create(b.Expr("func"), params); + b.create(b.Expr("func"), utils::Vector{ + b.Expr("param1"), + nullptr, + b.Expr("param2"), + }); }, "internal compiler error"); } @@ -116,7 +118,7 @@ TEST_F(CallExpressionTest, Assert_DifferentProgramID_Identifier) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(b2.Expr("func"), ExpressionList{}); + b1.create(b2.Expr("func"), utils::Empty); }, "internal compiler error"); } @@ -126,7 +128,7 @@ TEST_F(CallExpressionTest, Assert_DifferentProgramID_Type) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(b2.ty.f32(), ExpressionList{}); + b1.create(b2.ty.f32(), utils::Empty); }, "internal compiler error"); } @@ -136,7 +138,7 @@ TEST_F(CallExpressionTest, Assert_DifferentProgramID_Param) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(b1.Expr("func"), ExpressionList{b2.Expr("param1")}); + b1.create(b1.Expr("func"), utils::Vector{b2.Expr("param1")}); }, "internal compiler error"); } diff --git a/src/tint/ast/call_statement.cc b/src/tint/ast/call_statement.cc index 5e98fc9f33..597e30fe3a 100644 --- a/src/tint/ast/call_statement.cc +++ b/src/tint/ast/call_statement.cc @@ -20,8 +20,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::CallStatement); namespace tint::ast { -CallStatement::CallStatement(ProgramID pid, const Source& src, const CallExpression* call) - : Base(pid, src), expr(call) { +CallStatement::CallStatement(ProgramID pid, + NodeID nid, + const Source& src, + const CallExpression* call) + : Base(pid, nid, src), expr(call) { TINT_ASSERT(AST, expr); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, expr, program_id); } diff --git a/src/tint/ast/call_statement.h b/src/tint/ast/call_statement.h index d0d9f5301b..daf0b3f1af 100644 --- a/src/tint/ast/call_statement.h +++ b/src/tint/ast/call_statement.h @@ -25,9 +25,10 @@ class CallStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node for the statement /// @param call the function - CallStatement(ProgramID pid, const Source& src, const CallExpression* call); + CallStatement(ProgramID pid, NodeID nid, const Source& src, const CallExpression* call); /// Move constructor CallStatement(CallStatement&&); ~CallStatement() override; diff --git a/src/tint/ast/call_statement_test.cc b/src/tint/ast/call_statement_test.cc index 342659731f..84d2b41fab 100644 --- a/src/tint/ast/call_statement_test.cc +++ b/src/tint/ast/call_statement_test.cc @@ -23,7 +23,7 @@ namespace { using CallStatementTest = TestHelper; TEST_F(CallStatementTest, Creation) { - auto* expr = create(Expr("func"), ExpressionList{}); + auto* expr = create(Expr("func"), utils::Empty); auto* c = create(expr); EXPECT_EQ(c->expr, expr); @@ -48,7 +48,7 @@ TEST_F(CallStatementTest, Assert_DifferentProgramID_Call) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(b2.create(b2.Expr("func"), ExpressionList{})); + b1.create(b2.create(b2.Expr("func"), utils::Empty)); }, "internal compiler error"); } diff --git a/src/tint/ast/case_statement.cc b/src/tint/ast/case_statement.cc index bf1f0bf797..9f1c20e8b7 100644 --- a/src/tint/ast/case_statement.cc +++ b/src/tint/ast/case_statement.cc @@ -14,6 +14,8 @@ #include "src/tint/ast/case_statement.h" +#include + #include "src/tint/program_builder.h" TINT_INSTANTIATE_TYPEINFO(tint::ast::CaseStatement); @@ -21,10 +23,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::CaseStatement); namespace tint::ast { CaseStatement::CaseStatement(ProgramID pid, + NodeID nid, const Source& src, - CaseSelectorList s, + utils::VectorRef s, const BlockStatement* b) - : Base(pid, src), selectors(s), body(b) { + : Base(pid, nid, src), selectors(std::move(s)), body(b) { TINT_ASSERT(AST, body); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, body, program_id); for (auto* selector : selectors) { @@ -42,7 +45,7 @@ const CaseStatement* CaseStatement::Clone(CloneContext* ctx) const { auto src = ctx->Clone(source); auto sel = ctx->Clone(selectors); auto* b = ctx->Clone(body); - return ctx->dst->create(src, sel, b); + return ctx->dst->create(src, std::move(sel), b); } } // namespace tint::ast diff --git a/src/tint/ast/case_statement.h b/src/tint/ast/case_statement.h index 19ca69308f..47d2097e52 100644 --- a/src/tint/ast/case_statement.h +++ b/src/tint/ast/case_statement.h @@ -22,27 +22,26 @@ namespace tint::ast { -/// A list of case literals -using CaseSelectorList = std::vector; - /// A case statement class CaseStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param selectors the case selectors /// @param body the case body CaseStatement(ProgramID pid, + NodeID nid, const Source& src, - CaseSelectorList selectors, + utils::VectorRef selectors, const BlockStatement* body); /// Move constructor CaseStatement(CaseStatement&&); ~CaseStatement() override; /// @returns true if this is a default statement - bool IsDefault() const { return selectors.empty(); } + bool IsDefault() const { return selectors.IsEmpty(); } /// Clones this node and all transitive child nodes using the `CloneContext` /// `ctx`. @@ -51,15 +50,12 @@ class CaseStatement final : public Castable { const CaseStatement* Clone(CloneContext* ctx) const override; /// The case selectors, empty if none set - const CaseSelectorList selectors; + const utils::Vector selectors; /// The case body const BlockStatement* const body; }; -/// A list of case statements -using CaseStatementList = std::vector; - } // namespace tint::ast #endif // SRC_TINT_AST_CASE_STATEMENT_H_ diff --git a/src/tint/ast/case_statement_test.cc b/src/tint/ast/case_statement_test.cc index 12fcbda926..dc3c88ad03 100644 --- a/src/tint/ast/case_statement_test.cc +++ b/src/tint/ast/case_statement_test.cc @@ -27,40 +27,37 @@ namespace { using CaseStatementTest = TestHelper; TEST_F(CaseStatementTest, Creation_i32) { - CaseSelectorList b; auto* selector = Expr(2_i); - b.push_back(selector); + utils::Vector b{selector}; auto* discard = create(); - auto* body = create(StatementList{discard}); + auto* body = create(utils::Vector{discard}); auto* c = create(b, body); - ASSERT_EQ(c->selectors.size(), 1u); + ASSERT_EQ(c->selectors.Length(), 1u); EXPECT_EQ(c->selectors[0], selector); - ASSERT_EQ(c->body->statements.size(), 1u); + ASSERT_EQ(c->body->statements.Length(), 1u); EXPECT_EQ(c->body->statements[0], discard); } TEST_F(CaseStatementTest, Creation_u32) { - CaseSelectorList b; auto* selector = Expr(2_u); - b.push_back(selector); + utils::Vector b{selector}; auto* discard = create(); - auto* body = create(StatementList{discard}); + auto* body = create(utils::Vector{discard}); auto* c = create(b, body); - ASSERT_EQ(c->selectors.size(), 1u); + ASSERT_EQ(c->selectors.Length(), 1u); EXPECT_EQ(c->selectors[0], selector); - ASSERT_EQ(c->body->statements.size(), 1u); + ASSERT_EQ(c->body->statements.Length(), 1u); EXPECT_EQ(c->body->statements[0], discard); } TEST_F(CaseStatementTest, Creation_WithSource) { - CaseSelectorList b; - b.push_back(Expr(2_i)); + utils::Vector b{Expr(2_i)}; - auto* body = create(StatementList{ + auto* body = create(utils::Vector{ create(), }); auto* c = create(Source{Source::Location{20, 2}}, b, body); @@ -70,23 +67,21 @@ TEST_F(CaseStatementTest, Creation_WithSource) { } TEST_F(CaseStatementTest, IsDefault_WithoutSelectors) { - auto* body = create(StatementList{ + auto* body = create(utils::Vector{ create(), }); - auto* c = create(CaseSelectorList{}, body); + auto* c = create(utils::Empty, body); EXPECT_TRUE(c->IsDefault()); } TEST_F(CaseStatementTest, IsDefault_WithSelectors) { - CaseSelectorList b; - b.push_back(Expr(2_i)); - - auto* c = create(b, create(StatementList{})); + utils::Vector b{Expr(2_i)}; + auto* c = create(b, create(utils::Empty)); EXPECT_FALSE(c->IsDefault()); } TEST_F(CaseStatementTest, IsCase) { - auto* c = create(CaseSelectorList{}, create(StatementList{})); + auto* c = create(utils::Empty, create(utils::Empty)); EXPECT_TRUE(c->Is()); } @@ -94,7 +89,7 @@ TEST_F(CaseStatementTest, Assert_Null_Body) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.create(CaseSelectorList{}, nullptr); + b.create(utils::Empty, nullptr); }, "internal compiler error"); } @@ -103,8 +98,8 @@ TEST_F(CaseStatementTest, Assert_Null_Selector) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.create(CaseSelectorList{nullptr}, - b.create(StatementList{})); + b.create(utils::Vector{nullptr}, + b.create(utils::Empty)); }, "internal compiler error"); } @@ -114,8 +109,7 @@ TEST_F(CaseStatementTest, Assert_DifferentProgramID_Call) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(CaseSelectorList{}, - b2.create(StatementList{})); + b1.create(utils::Empty, b2.create(utils::Empty)); }, "internal compiler error"); } @@ -125,8 +119,8 @@ TEST_F(CaseStatementTest, Assert_DifferentProgramID_Selector) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(CaseSelectorList{b2.Expr(2_i)}, - b1.create(StatementList{})); + b1.create(utils::Vector{b2.Expr(2_i)}, + b1.create(utils::Empty)); }, "internal compiler error"); } diff --git a/src/tint/ast/compound_assignment_statement.cc b/src/tint/ast/compound_assignment_statement.cc index 848d500391..f7528625f2 100644 --- a/src/tint/ast/compound_assignment_statement.cc +++ b/src/tint/ast/compound_assignment_statement.cc @@ -21,11 +21,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::CompoundAssignmentStatement); namespace tint::ast { CompoundAssignmentStatement::CompoundAssignmentStatement(ProgramID pid, + NodeID nid, const Source& src, const Expression* l, const Expression* r, BinaryOp o) - : Base(pid, src), lhs(l), rhs(r), op(o) { + : Base(pid, nid, src), lhs(l), rhs(r), op(o) { TINT_ASSERT(AST, lhs); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, lhs, program_id); TINT_ASSERT(AST, rhs); diff --git a/src/tint/ast/compound_assignment_statement.h b/src/tint/ast/compound_assignment_statement.h index ba9a558a6b..9fbd22c2b3 100644 --- a/src/tint/ast/compound_assignment_statement.h +++ b/src/tint/ast/compound_assignment_statement.h @@ -25,12 +25,14 @@ namespace tint::ast { class CompoundAssignmentStatement final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the compound assignment statement source /// @param lhs the left side of the expression /// @param rhs the right side of the expression /// @param op the binary operator - CompoundAssignmentStatement(ProgramID program_id, + CompoundAssignmentStatement(ProgramID pid, + NodeID nid, const Source& source, const Expression* lhs, const Expression* rhs, diff --git a/src/tint/ast/const.cc b/src/tint/ast/const.cc new file mode 100644 index 0000000000..fbc8469fee --- /dev/null +++ b/src/tint/ast/const.cc @@ -0,0 +1,53 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/const.h" + +#include + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::ast::Const); + +namespace tint::ast { + +Const::Const(ProgramID pid, + NodeID nid, + const Source& src, + const Symbol& sym, + const ast::Type* ty, + const Expression* ctor, + utils::VectorRef attrs) + : Base(pid, nid, src, sym, ty, ctor, std::move(attrs)) { + TINT_ASSERT(AST, ctor != nullptr); +} + +Const::Const(Const&&) = default; + +Const::~Const() = default; + +const char* Const::Kind() const { + return "const"; +} + +const Const* Const::Clone(CloneContext* ctx) const { + auto src = ctx->Clone(source); + auto sym = ctx->Clone(symbol); + auto* ty = ctx->Clone(type); + auto* ctor = ctx->Clone(constructor); + auto attrs = ctx->Clone(attributes); + return ctx->dst->create(src, sym, ty, ctor, std::move(attrs)); +} + +} // namespace tint::ast diff --git a/src/tint/ast/const.h b/src/tint/ast/const.h new file mode 100644 index 0000000000..c37458f352 --- /dev/null +++ b/src/tint/ast/const.h @@ -0,0 +1,69 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_AST_CONST_H_ +#define SRC_TINT_AST_CONST_H_ + +#include "src/tint/ast/variable.h" + +namespace tint::ast { + +/// A "const" declaration is a name for a module-scoped or function-scoped creation-time value. +/// const must have a constructor expression. +/// +/// Examples: +/// +/// ``` +/// const n = 123; // Abstract-integer typed constant +/// const pi = 3.14159265359; // Abstract-float typed constant +/// const max_f32 : f32 = 0x1.fffffep+127; // f32 typed constant +/// ``` +/// @see https://www.w3.org/TR/WGSL/#creation-time-consts +class Const final : public Castable { + public: + /// Create a 'const' creation-time value variable. + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier + /// @param source the variable source + /// @param sym the variable symbol + /// @param type the declared variable type + /// @param constructor the constructor expression. Must not be nullptr. + /// @param attributes the variable attributes + Const(ProgramID pid, + NodeID nid, + const Source& source, + const Symbol& sym, + const ast::Type* type, + const Expression* constructor, + utils::VectorRef attributes); + + /// Move constructor + Const(Const&&); + + /// Destructor + ~Const() override; + + /// @returns "const" + const char* Kind() const override; + + /// Clones this node and all transitive child nodes using the `CloneContext` + /// `ctx`. + /// @param ctx the clone context + /// @return the newly cloned node + const Const* Clone(CloneContext* ctx) const override; +}; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_CONST_H_ diff --git a/src/tint/ast/continue_statement.cc b/src/tint/ast/continue_statement.cc index 8ae4b9c1ee..53bd6a9a2f 100644 --- a/src/tint/ast/continue_statement.cc +++ b/src/tint/ast/continue_statement.cc @@ -20,7 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ContinueStatement); namespace tint::ast { -ContinueStatement::ContinueStatement(ProgramID pid, const Source& src) : Base(pid, src) {} +ContinueStatement::ContinueStatement(ProgramID pid, NodeID nid, const Source& src) + : Base(pid, nid, src) {} ContinueStatement::ContinueStatement(ContinueStatement&&) = default; diff --git a/src/tint/ast/continue_statement.h b/src/tint/ast/continue_statement.h index 17d8586d90..09b8254373 100644 --- a/src/tint/ast/continue_statement.h +++ b/src/tint/ast/continue_statement.h @@ -24,8 +24,9 @@ class ContinueStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - ContinueStatement(ProgramID pid, const Source& src); + ContinueStatement(ProgramID pid, NodeID nid, const Source& src); /// Move constructor ContinueStatement(ContinueStatement&&); ~ContinueStatement() override; diff --git a/src/tint/ast/depth_multisampled_texture.cc b/src/tint/ast/depth_multisampled_texture.cc index 66c5a86c52..64998b5170 100644 --- a/src/tint/ast/depth_multisampled_texture.cc +++ b/src/tint/ast/depth_multisampled_texture.cc @@ -28,9 +28,10 @@ bool IsValidDepthDimension(TextureDimension dim) { } // namespace DepthMultisampledTexture::DepthMultisampledTexture(ProgramID pid, + NodeID nid, const Source& src, TextureDimension d) - : Base(pid, src, d) { + : Base(pid, nid, src, d) { TINT_ASSERT(AST, IsValidDepthDimension(dim)); } diff --git a/src/tint/ast/depth_multisampled_texture.h b/src/tint/ast/depth_multisampled_texture.h index d15ac7a7de..2cc8d78bd6 100644 --- a/src/tint/ast/depth_multisampled_texture.h +++ b/src/tint/ast/depth_multisampled_texture.h @@ -26,9 +26,10 @@ class DepthMultisampledTexture final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param dim the dimensionality of the texture - DepthTexture(ProgramID pid, const Source& src, TextureDimension dim); + DepthTexture(ProgramID pid, NodeID nid, const Source& src, TextureDimension dim); /// Move constructor DepthTexture(DepthTexture&&); ~DepthTexture() override; diff --git a/src/tint/ast/disable_validation_attribute.cc b/src/tint/ast/disable_validation_attribute.cc index 4bc9f74c65..1f58799dd9 100644 --- a/src/tint/ast/disable_validation_attribute.cc +++ b/src/tint/ast/disable_validation_attribute.cc @@ -20,8 +20,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::DisableValidationAttribute); namespace tint::ast { -DisableValidationAttribute::DisableValidationAttribute(ProgramID pid, DisabledValidation val) - : Base(pid), validation(val) {} +DisableValidationAttribute::DisableValidationAttribute(ProgramID pid, + NodeID nid, + DisabledValidation val) + : Base(pid, nid), validation(val) {} DisableValidationAttribute::~DisableValidationAttribute() = default; @@ -35,8 +37,8 @@ std::string DisableValidationAttribute::InternalName() const { return "disable_validation__ignore_storage_class"; case DisabledValidation::kEntryPointParameter: return "disable_validation__entry_point_parameter"; - case DisabledValidation::kIgnoreConstructibleFunctionParameter: - return "disable_validation__ignore_constructible_function_parameter"; + case DisabledValidation::kFunctionParameter: + return "disable_validation__function_parameter"; case DisabledValidation::kIgnoreStrideAttribute: return "disable_validation__ignore_stride"; case DisabledValidation::kIgnoreInvalidPointerArgument: @@ -46,7 +48,8 @@ std::string DisableValidationAttribute::InternalName() const { } const DisableValidationAttribute* DisableValidationAttribute::Clone(CloneContext* ctx) const { - return ctx->dst->ASTNodes().Create(ctx->dst->ID(), validation); + return ctx->dst->ASTNodes().Create( + ctx->dst->ID(), ctx->dst->AllocateNodeID(), validation); } } // namespace tint::ast diff --git a/src/tint/ast/disable_validation_attribute.h b/src/tint/ast/disable_validation_attribute.h index db70ad4c9a..a109d18d4a 100644 --- a/src/tint/ast/disable_validation_attribute.h +++ b/src/tint/ast/disable_validation_attribute.h @@ -24,27 +24,23 @@ namespace tint::ast { /// Enumerator of validation features that can be disabled with a /// DisableValidationAttribute attribute. enum class DisabledValidation { - /// When applied to a function, the validator will not complain there is no - /// body to a function. + /// When applied to a function, the validator will not complain there is no body to a function. kFunctionHasNoBody, - /// When applied to a module-scoped variable, the validator will not complain - /// if two resource variables have the same binding points. + /// When applied to a module-scoped variable, the validator will not complain if two resource + /// variables have the same binding points. kBindingPointCollision, - /// When applied to a variable, the validator will not complain about the - /// declared storage class. + /// When applied to a variable, the validator will not complain about the declared storage + /// class. kIgnoreStorageClass, - /// When applied to an entry-point function parameter, the validator will not - /// check for entry IO attributes. + /// When applied to an entry-point function parameter, the validator will not check for entry IO + /// attributes. kEntryPointParameter, - /// When applied to a function parameter, the validator will not - /// check if parameter type is constructible - kIgnoreConstructibleFunctionParameter, - /// When applied to a member attribute, a stride attribute may be applied to - /// non-array types. + /// When applied to a function parameter, the parameter will not be validated. + kFunctionParameter, + /// When applied to a member attribute, a stride attribute may be applied to non-array types. kIgnoreStrideAttribute, - /// When applied to a pointer function parameter, the validator will not - /// require a function call argument passed for that parameter to have a - /// certain form. + /// When applied to a pointer function parameter, the validator will not require a function call + /// argument passed for that parameter to have a certain form. kIgnoreInvalidPointerArgument, }; @@ -55,9 +51,10 @@ class DisableValidationAttribute final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param validation the validation to disable - explicit DisableValidationAttribute(ProgramID program_id, DisabledValidation validation); + explicit DisableValidationAttribute(ProgramID pid, NodeID nid, DisabledValidation validation); /// Destructor ~DisableValidationAttribute() override; diff --git a/src/tint/ast/discard_statement.cc b/src/tint/ast/discard_statement.cc index 7ca673f629..fc9e75bbff 100644 --- a/src/tint/ast/discard_statement.cc +++ b/src/tint/ast/discard_statement.cc @@ -20,7 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::DiscardStatement); namespace tint::ast { -DiscardStatement::DiscardStatement(ProgramID pid, const Source& src) : Base(pid, src) {} +DiscardStatement::DiscardStatement(ProgramID pid, NodeID nid, const Source& src) + : Base(pid, nid, src) {} DiscardStatement::DiscardStatement(DiscardStatement&&) = default; diff --git a/src/tint/ast/discard_statement.h b/src/tint/ast/discard_statement.h index 9d18c74454..272cc2dbf2 100644 --- a/src/tint/ast/discard_statement.h +++ b/src/tint/ast/discard_statement.h @@ -24,8 +24,9 @@ class DiscardStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - DiscardStatement(ProgramID pid, const Source& src); + DiscardStatement(ProgramID pid, NodeID nid, const Source& src); /// Move constructor DiscardStatement(DiscardStatement&&); ~DiscardStatement() override; diff --git a/src/tint/ast/enable.cc b/src/tint/ast/enable.cc index f4c6dd6996..9da44c7520 100644 --- a/src/tint/ast/enable.cc +++ b/src/tint/ast/enable.cc @@ -21,31 +21,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Enable); namespace tint::ast { -Enable::ExtensionKind Enable::NameToKind(const std::string& name) { - // The reserved internal extension name for testing - if (name == "InternalExtensionForTesting") { - return Enable::ExtensionKind::kInternalExtensionForTesting; - } - - return Enable::ExtensionKind::kNotAnExtension; -} - -std::string Enable::KindToName(ExtensionKind kind) { - switch (kind) { - // The reserved internal extension for testing - case ExtensionKind::kInternalExtensionForTesting: - return "InternalExtensionForTesting"; - case ExtensionKind::kNotAnExtension: - // Return an empty string for kNotAnExtension - return {}; - // No default case, as this switch must cover all ExtensionKind values. - } - // This return shall never get hit. - return {}; -} - -Enable::Enable(ProgramID pid, const Source& src, const std::string& ext_name) - : Base(pid, src), name(ext_name), kind(NameToKind(ext_name)) {} +Enable::Enable(ProgramID pid, NodeID nid, const Source& src, Extension ext) + : Base(pid, nid, src), extension(ext) {} Enable::Enable(Enable&&) = default; @@ -53,6 +30,6 @@ Enable::~Enable() = default; const Enable* Enable::Clone(CloneContext* ctx) const { auto src = ctx->Clone(source); - return ctx->dst->create(src, name); + return ctx->dst->create(src, extension); } } // namespace tint::ast diff --git a/src/tint/ast/enable.h b/src/tint/ast/enable.h index 67c47c9781..4c27113c0d 100644 --- a/src/tint/ast/enable.h +++ b/src/tint/ast/enable.h @@ -16,52 +16,27 @@ #define SRC_TINT_AST_ENABLE_H_ #include -#include #include +#include -#include "src/tint/ast/access.h" -#include "src/tint/ast/expression.h" +#include "src/tint/ast/extension.h" +#include "src/tint/ast/node.h" namespace tint::ast { -/// An instance of this class represents one extension mentioned in a -/// "enable" derictive. Example: -/// // Enable an extension named "f16" -/// enable f16; -class Enable : public Castable { +/// An "enable" directive. Example: +/// ``` +/// // Enable an extension named "f16" +/// enable f16; +/// ``` +class Enable final : public Castable { public: - /// The enum class identifing each supported WGSL extension - enum class ExtensionKind { - /// An internal reserved extension for test, named - /// "InternalExtensionForTesting" - kInternalExtensionForTesting = -2, - kNotAnExtension = -1, - }; - - /// Convert a string of extension name into one of ExtensionKind enum value, - /// the result will be ExtensionKind::kNotAnExtension if the name is not a - /// known extension name. A extension node of kind kNotAnExtension must not - /// exist in the AST tree, and using a unknown extension name in WGSL code - /// should result in a shader-creation error. - /// @param name string of the extension name - /// @return the ExtensionKind enum value for the extension of given name, or - /// kNotAnExtension if no known extension has the given name - static ExtensionKind NameToKind(const std::string& name); - - /// Convert the ExtensionKind enum value to corresponding extension name - /// string. If the given enum value is kNotAnExtension or don't have a known - /// name, return an empty string instead. - /// @param kind the ExtensionKind enum value - /// @return string of the extension name corresponding to the given kind, or - /// an empty string if the given enum value is kNotAnExtension or don't have a - /// known corresponding name - static std::string KindToName(ExtensionKind kind); - /// Create a extension /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - /// @param name the name of extension - Enable(ProgramID pid, const Source& src, const std::string& name); + /// @param ext the extension + Enable(ProgramID pid, NodeID nid, const Source& src, Extension ext); /// Move constructor Enable(Enable&&); @@ -74,15 +49,9 @@ class Enable : public Castable { const Enable* Clone(CloneContext* ctx) const override; /// The extension name - const std::string name; - - /// The extension kind - const ExtensionKind kind; + const Extension extension; }; -/// A set of extension kinds -using ExtensionSet = std::unordered_set; - } // namespace tint::ast #endif // SRC_TINT_AST_ENABLE_H_ diff --git a/src/tint/ast/enable_test.cc b/src/tint/ast/enable_test.cc index 9fde780a5e..e8b6e5c20f 100644 --- a/src/tint/ast/enable_test.cc +++ b/src/tint/ast/enable_test.cc @@ -19,40 +19,15 @@ namespace tint::ast { namespace { -using AstExtensionTest = TestHelper; +using EnableTest = TestHelper; -TEST_F(AstExtensionTest, Creation) { - auto* ext = - create(Source{Source::Range{Source::Location{20, 2}, Source::Location{20, 5}}}, - "InternalExtensionForTesting"); +TEST_F(EnableTest, Creation) { + auto* ext = create(Source{{{20, 2}, {20, 5}}}, Extension::kF16); EXPECT_EQ(ext->source.range.begin.line, 20u); EXPECT_EQ(ext->source.range.begin.column, 2u); EXPECT_EQ(ext->source.range.end.line, 20u); EXPECT_EQ(ext->source.range.end.column, 5u); - EXPECT_EQ(ext->kind, ast::Enable::ExtensionKind::kInternalExtensionForTesting); -} - -TEST_F(AstExtensionTest, Creation_InvalidName) { - auto* ext = create( - Source{Source::Range{Source::Location{20, 2}, Source::Location{20, 5}}}, std::string()); - EXPECT_EQ(ext->source.range.begin.line, 20u); - EXPECT_EQ(ext->source.range.begin.column, 2u); - EXPECT_EQ(ext->source.range.end.line, 20u); - EXPECT_EQ(ext->source.range.end.column, 5u); - EXPECT_EQ(ext->kind, ast::Enable::ExtensionKind::kNotAnExtension); -} - -TEST_F(AstExtensionTest, NameToKind_InvalidName) { - EXPECT_EQ(ast::Enable::NameToKind(std::string()), ast::Enable::ExtensionKind::kNotAnExtension); - EXPECT_EQ(ast::Enable::NameToKind("__ImpossibleExtensionName"), - ast::Enable::ExtensionKind::kNotAnExtension); - EXPECT_EQ(ast::Enable::NameToKind("123"), ast::Enable::ExtensionKind::kNotAnExtension); -} - -TEST_F(AstExtensionTest, KindToName) { - EXPECT_EQ(ast::Enable::KindToName(ast::Enable::ExtensionKind::kInternalExtensionForTesting), - "InternalExtensionForTesting"); - EXPECT_EQ(ast::Enable::KindToName(ast::Enable::ExtensionKind::kNotAnExtension), std::string()); + EXPECT_EQ(ext->extension, Extension::kF16); } } // namespace diff --git a/src/tint/ast/expression.cc b/src/tint/ast/expression.cc index a7f23aace4..17b3dc2b11 100644 --- a/src/tint/ast/expression.cc +++ b/src/tint/ast/expression.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Expression); namespace tint::ast { -Expression::Expression(ProgramID pid, const Source& src) : Base(pid, src) {} +Expression::Expression(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} Expression::Expression(Expression&&) = default; diff --git a/src/tint/ast/expression.h b/src/tint/ast/expression.h index dc69ff8e4e..8e0718b0f1 100644 --- a/src/tint/ast/expression.h +++ b/src/tint/ast/expression.h @@ -31,15 +31,13 @@ class Expression : public Castable { protected: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - Expression(ProgramID pid, const Source& src); + Expression(ProgramID pid, NodeID nid, const Source& src); /// Move constructor Expression(Expression&&); }; -/// A list of expressions -using ExpressionList = std::vector; - } // namespace tint::ast #endif // SRC_TINT_AST_EXPRESSION_H_ diff --git a/src/tint/ast/extension.cc b/src/tint/ast/extension.cc new file mode 100644 index 0000000000..e57b248773 --- /dev/null +++ b/src/tint/ast/extension.cc @@ -0,0 +1,62 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/extension.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/extension.h" + +namespace tint::ast { + +/// ParseExtension parses a Extension from a string. +/// @param str the string to parse +/// @returns the parsed enum, or Extension::kInvalid if the string could not be parsed. +Extension ParseExtension(std::string_view str) { + if (str == "f16") { + return Extension::kF16; + } + if (str == "chromium_experimental_dp4a") { + return Extension::kChromiumExperimentalDp4A; + } + if (str == "chromium_disable_uniformity_analysis") { + return Extension::kChromiumDisableUniformityAnalysis; + } + if (str == "chromium_experimental_push_constant") { + return Extension::kChromiumExperimentalPushConstant; + } + return Extension::kInvalid; +} + +std::ostream& operator<<(std::ostream& out, Extension value) { + switch (value) { + case Extension::kInvalid: + return out << "invalid"; + case Extension::kF16: + return out << "f16"; + case Extension::kChromiumExperimentalDp4A: + return out << "chromium_experimental_dp4a"; + case Extension::kChromiumDisableUniformityAnalysis: + return out << "chromium_disable_uniformity_analysis"; + case Extension::kChromiumExperimentalPushConstant: + return out << "chromium_experimental_push_constant"; + } + return out << ""; +} + +} // namespace tint::ast diff --git a/src/tint/ast/extension.cc.tmpl b/src/tint/ast/extension.cc.tmpl new file mode 100644 index 0000000000..e0f319ec7a --- /dev/null +++ b/src/tint/ast/extension.cc.tmpl @@ -0,0 +1,22 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate extension.cc + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "extension") -}} + +#include "src/tint/ast/extension.h" + +namespace tint::ast { + +{{ Eval "ParseEnum" $enum}} + +{{ Eval "EnumOStream" $enum}} + +} // namespace tint::ast diff --git a/src/tint/ast/extension.h b/src/tint/ast/extension.h new file mode 100644 index 0000000000..eea9becb72 --- /dev/null +++ b/src/tint/ast/extension.h @@ -0,0 +1,57 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/extension.h.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#ifndef SRC_TINT_AST_EXTENSION_H_ +#define SRC_TINT_AST_EXTENSION_H_ + +#include + +#include "src/tint/utils/unique_vector.h" + +namespace tint::ast { + +/// An enumerator of WGSL extensions +/// @see src/tint/intrinsics.def for extension descriptions +enum class Extension { + kInvalid, + kF16, + kChromiumExperimentalDp4A, + kChromiumDisableUniformityAnalysis, + kChromiumExperimentalPushConstant, +}; + +/// @param out the std::ostream to write to +/// @param value the Extension +/// @returns `out` so calls can be chained +std::ostream& operator<<(std::ostream& out, Extension value); + +/// ParseExtension parses a Extension from a string. +/// @param str the string to parse +/// @returns the parsed enum, or Extension::kInvalid if the string could not be parsed. +Extension ParseExtension(std::string_view str); + +// A unique vector of extensions +using Extensions = utils::UniqueVector; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_EXTENSION_H_ diff --git a/src/tint/ast/extension.h.tmpl b/src/tint/ast/extension.h.tmpl new file mode 100644 index 0000000000..29feff962a --- /dev/null +++ b/src/tint/ast/extension.h.tmpl @@ -0,0 +1,32 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate extension.h + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "extension") -}} + +#ifndef SRC_TINT_AST_EXTENSION_H_ +#define SRC_TINT_AST_EXTENSION_H_ + +#include + +#include "src/tint/utils/unique_vector.h" + +namespace tint::ast { + +/// An enumerator of WGSL extensions +/// @see src/tint/intrinsics.def for extension descriptions +{{ Eval "DeclareEnum" $enum}} + +// A unique vector of extensions +using Extensions = utils::UniqueVector; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_EXTENSION_H_ diff --git a/src/tint/ast/extension_bench.cc b/src/tint/ast/extension_bench.cc new file mode 100644 index 0000000000..8fc9d1cbbd --- /dev/null +++ b/src/tint/ast/extension_bench.cc @@ -0,0 +1,74 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/extension_bench.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/extension.h" + +#include + +#include "benchmark/benchmark.h" + +namespace tint::ast { +namespace { + +void ExtensionParser(::benchmark::State& state) { + std::array kStrings{ + "cc6", + "s", + "HH6", + "f16", + "116", + "qJ6", + "f17ll", + "chromippHm_experqqmetal_dp4a", + "chrmium_expecimntal_dp4", + "chrmiumGexpebimental_dp4a", + "chromium_experimental_dp4a", + "chromium_exverimentiil_dp4a", + "chro8ium_experimenWWal_dp4a", + "chromiMm_eperimxxntal_dp4a", + "chXggmium_disable_uniformity_aalysis", + "Xhomiuu_disale_uniformity_analysis", + "chromium_3isable_uniformity_analysis", + "chromium_disable_uniformity_analysis", + "chromiuE_disable_uniformity_analysis", + "chromium_disable_uniTTormity_aPPalsis", + "ddhromium_disabexxuniformity_analysis", + "c44romium_experimental_push_constant", + "chromium_experimental_pSSsVV_constant", + "chrom22Rm_experimental_pushRonstant", + "chromium_experimental_push_constant", + "chromium_exp9rimFntal_ush_constant", + "chrmium_experimental_push_constant", + "cOOromium_experiVeHtal_puh_conRRtant", + }; + for (auto _ : state) { + for (auto& str : kStrings) { + auto result = ParseExtension(str); + benchmark::DoNotOptimize(result); + } + } +} + +BENCHMARK(ExtensionParser); + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/extension_bench.cc.tmpl b/src/tint/ast/extension_bench.cc.tmpl new file mode 100644 index 0000000000..af3dc9595a --- /dev/null +++ b/src/tint/ast/extension_bench.cc.tmpl @@ -0,0 +1,26 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate extension_bench.cc + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "extension") -}} + +#include "src/tint/ast/extension.h" + +#include + +#include "benchmark/benchmark.h" + +namespace tint::ast { +namespace { + +{{ Eval "BenchmarkParseEnum" $enum }} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/extension_test.cc b/src/tint/ast/extension_test.cc new file mode 100644 index 0000000000..283088db46 --- /dev/null +++ b/src/tint/ast/extension_test.cc @@ -0,0 +1,90 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/extension_test.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/extension.h" + +#include + +#include "src/tint/ast/test_helper.h" +#include "src/tint/utils/string.h" + +namespace tint::ast { +namespace { + +namespace parse_print_tests { + +struct Case { + const char* string; + Extension value; +}; + +inline std::ostream& operator<<(std::ostream& out, Case c) { + return out << "'" << std::string(c.string) << "'"; +} + +static constexpr Case kValidCases[] = { + {"f16", Extension::kF16}, + {"chromium_experimental_dp4a", Extension::kChromiumExperimentalDp4A}, + {"chromium_disable_uniformity_analysis", Extension::kChromiumDisableUniformityAnalysis}, + {"chromium_experimental_push_constant", Extension::kChromiumExperimentalPushConstant}, +}; + +static constexpr Case kInvalidCases[] = { + {"cc6", Extension::kInvalid}, + {"s", Extension::kInvalid}, + {"HH6", Extension::kInvalid}, + {"chro1ium_experimental_dp4a", Extension::kInvalid}, + {"chrJmium_experiqqetal_dp4a", Extension::kInvalid}, + {"chromium_experimenll77l_dp4a", Extension::kInvalid}, + {"chromiumppdisableqquniformity_aalysHHs", Extension::kInvalid}, + {"chromiu_disable_unifovmitc_analyi", Extension::kInvalid}, + {"chromium_diable_uGbformity_analysis", Extension::kInvalid}, + {"chvomium_experimental_push_constiint", Extension::kInvalid}, + {"chromiu8WWexperimental_push_constant", Extension::kInvalid}, + {"chromium_experiMental_push_costanxx", Extension::kInvalid}, +}; + +using ExtensionParseTest = testing::TestWithParam; + +TEST_P(ExtensionParseTest, Parse) { + const char* string = GetParam().string; + Extension expect = GetParam().value; + EXPECT_EQ(expect, ParseExtension(string)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, ExtensionParseTest, testing::ValuesIn(kValidCases)); +INSTANTIATE_TEST_SUITE_P(InvalidCases, ExtensionParseTest, testing::ValuesIn(kInvalidCases)); + +using ExtensionPrintTest = testing::TestWithParam; + +TEST_P(ExtensionPrintTest, Print) { + Extension value = GetParam().value; + const char* expect = GetParam().string; + EXPECT_EQ(expect, utils::ToString(value)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, ExtensionPrintTest, testing::ValuesIn(kValidCases)); + +} // namespace parse_print_tests + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/extension_test.cc.tmpl b/src/tint/ast/extension_test.cc.tmpl new file mode 100644 index 0000000000..8c7a6af339 --- /dev/null +++ b/src/tint/ast/extension_test.cc.tmpl @@ -0,0 +1,27 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate extension_test.cc + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "extension") -}} + +#include "src/tint/ast/extension.h" + +#include + +#include "src/tint/ast/test_helper.h" +#include "src/tint/utils/string.h" + +namespace tint::ast { +namespace { + +{{ Eval "TestParsePrintEnum" $enum}} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/external_texture.cc b/src/tint/ast/external_texture.cc index b88de9055a..488191389d 100644 --- a/src/tint/ast/external_texture.cc +++ b/src/tint/ast/external_texture.cc @@ -21,8 +21,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ExternalTexture); namespace tint::ast { // ExternalTexture::ExternalTexture() : Base(ast::TextureDimension::k2d) {} -ExternalTexture::ExternalTexture(ProgramID pid, const Source& src) - : Base(pid, src, ast::TextureDimension::k2d) {} +ExternalTexture::ExternalTexture(ProgramID pid, NodeID nid, const Source& src) + : Base(pid, nid, src, ast::TextureDimension::k2d) {} ExternalTexture::ExternalTexture(ExternalTexture&&) = default; diff --git a/src/tint/ast/external_texture.h b/src/tint/ast/external_texture.h index 17224cffcf..f2d68b42b4 100644 --- a/src/tint/ast/external_texture.h +++ b/src/tint/ast/external_texture.h @@ -26,8 +26,9 @@ class ExternalTexture final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - ExternalTexture(ProgramID pid, const Source& src); + ExternalTexture(ProgramID pid, NodeID nid, const Source& src); /// Move constructor ExternalTexture(ExternalTexture&&); diff --git a/src/tint/ast/f16.cc b/src/tint/ast/f16.cc new file mode 100644 index 0000000000..dd3e48e67a --- /dev/null +++ b/src/tint/ast/f16.cc @@ -0,0 +1,38 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/f16.h" + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::ast::F16); + +namespace tint::ast { + +F16::F16(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} + +F16::F16(F16&&) = default; + +F16::~F16() = default; + +std::string F16::FriendlyName(const SymbolTable&) const { + return "f16"; +} + +const F16* F16::Clone(CloneContext* ctx) const { + auto src = ctx->Clone(source); + return ctx->dst->create(src); +} + +} // namespace tint::ast diff --git a/src/tint/ast/f16.h b/src/tint/ast/f16.h new file mode 100644 index 0000000000..bae6291356 --- /dev/null +++ b/src/tint/ast/f16.h @@ -0,0 +1,49 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_AST_F16_H_ +#define SRC_TINT_AST_F16_H_ + +#include + +#include "src/tint/ast/type.h" + +namespace tint::ast { + +/// A float 16 type +class F16 final : public Castable { + public: + /// Constructor + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier + /// @param src the source of this node + F16(ProgramID pid, NodeID nid, const Source& src); + /// Move constructor + F16(F16&&); + ~F16() override; + + /// @param symbols the program's symbol table + /// @returns the name for this type that closely resembles how it would be + /// declared in WGSL. + std::string FriendlyName(const SymbolTable& symbols) const override; + + /// Clones this type and all transitive types using the `CloneContext` `ctx`. + /// @param ctx the clone context + /// @return the newly cloned type + const F16* Clone(CloneContext* ctx) const override; +}; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_F16_H_ diff --git a/src/tint/ast/f16_test.cc b/src/tint/ast/f16_test.cc new file mode 100644 index 0000000000..48ab284f55 --- /dev/null +++ b/src/tint/ast/f16_test.cc @@ -0,0 +1,30 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/f16.h" + +#include "src/tint/ast/test_helper.h" + +namespace tint::ast { +namespace { + +using AstF16Test = TestHelper; + +TEST_F(AstF16Test, FriendlyName) { + auto* f = create(); + EXPECT_EQ(f->FriendlyName(Symbols()), "f16"); +} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/f32.cc b/src/tint/ast/f32.cc index b731e65c9d..0ae354ad00 100644 --- a/src/tint/ast/f32.cc +++ b/src/tint/ast/f32.cc @@ -20,7 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::F32); namespace tint::ast { -F32::F32(ProgramID pid, const Source& src) : Base(pid, src) {} +F32::F32(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} F32::F32(F32&&) = default; diff --git a/src/tint/ast/f32.h b/src/tint/ast/f32.h index db81491d81..5176c45e3d 100644 --- a/src/tint/ast/f32.h +++ b/src/tint/ast/f32.h @@ -26,8 +26,9 @@ class F32 final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - F32(ProgramID pid, const Source& src); + F32(ProgramID pid, NodeID nid, const Source& src); /// Move constructor F32(F32&&); ~F32() override; diff --git a/src/tint/ast/fallthrough_statement.cc b/src/tint/ast/fallthrough_statement.cc index 446534d354..0d30ae3ec2 100644 --- a/src/tint/ast/fallthrough_statement.cc +++ b/src/tint/ast/fallthrough_statement.cc @@ -20,7 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::FallthroughStatement); namespace tint::ast { -FallthroughStatement::FallthroughStatement(ProgramID pid, const Source& src) : Base(pid, src) {} +FallthroughStatement::FallthroughStatement(ProgramID pid, NodeID nid, const Source& src) + : Base(pid, nid, src) {} FallthroughStatement::FallthroughStatement(FallthroughStatement&&) = default; diff --git a/src/tint/ast/fallthrough_statement.h b/src/tint/ast/fallthrough_statement.h index b313efbd6d..da2fd3d88b 100644 --- a/src/tint/ast/fallthrough_statement.h +++ b/src/tint/ast/fallthrough_statement.h @@ -24,8 +24,9 @@ class FallthroughStatement final : public CastableClone(source); - return ctx->dst->create(src, value); + return ctx->dst->create(src, value, suffix); +} + +std::ostream& operator<<(std::ostream& out, FloatLiteralExpression::Suffix suffix) { + switch (suffix) { + default: + return out; + case FloatLiteralExpression::Suffix::kF: + return out << "f"; + case FloatLiteralExpression::Suffix::kH: + return out << "h"; + } } } // namespace tint::ast diff --git a/src/tint/ast/float_literal_expression.h b/src/tint/ast/float_literal_expression.h index d1e1a6442a..7f3cd1289f 100644 --- a/src/tint/ast/float_literal_expression.h +++ b/src/tint/ast/float_literal_expression.h @@ -24,11 +24,23 @@ namespace tint::ast { /// A float literal class FloatLiteralExpression final : public Castable { public: + /// Literal suffix + enum class Suffix { + /// No suffix + kNone, + /// 'f' suffix (f32) + kF, + /// 'h' suffix (f16) + kH, + }; + /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - /// @param value the float literals value - FloatLiteralExpression(ProgramID pid, const Source& src, float value); + /// @param val the literal value + /// @param suf the literal suffix + FloatLiteralExpression(ProgramID pid, NodeID nid, const Source& src, double val, Suffix suf); ~FloatLiteralExpression() override; /// Clones this node and all transitive child nodes using the `CloneContext` @@ -37,10 +49,19 @@ class FloatLiteralExpression final : public Castable(47.2f); - ASSERT_TRUE(f->Is()); - EXPECT_EQ(f->value, 47.2f); +TEST_F(FloatLiteralExpressionTest, SuffixNone) { + auto* i = create(42.0, FloatLiteralExpression::Suffix::kNone); + ASSERT_TRUE(i->Is()); + EXPECT_EQ(i->value, 42); + EXPECT_EQ(i->suffix, FloatLiteralExpression::Suffix::kNone); +} + +TEST_F(FloatLiteralExpressionTest, SuffixF) { + auto* i = create(42.0, FloatLiteralExpression::Suffix::kF); + ASSERT_TRUE(i->Is()); + EXPECT_EQ(i->value, 42); + EXPECT_EQ(i->suffix, FloatLiteralExpression::Suffix::kF); +} + +TEST_F(FloatLiteralExpressionTest, SuffixH) { + auto* i = create(42.0, FloatLiteralExpression::Suffix::kH); + ASSERT_TRUE(i->Is()); + EXPECT_EQ(i->value, 42); + EXPECT_EQ(i->suffix, FloatLiteralExpression::Suffix::kH); +} + +TEST_F(FloatLiteralExpressionTest, SuffixStringStream) { + auto to_str = [](FloatLiteralExpression::Suffix suffix) { + std::stringstream ss; + ss << suffix; + return ss.str(); + }; + + EXPECT_EQ("", to_str(FloatLiteralExpression::Suffix::kNone)); + EXPECT_EQ("f", to_str(FloatLiteralExpression::Suffix::kF)); + EXPECT_EQ("h", to_str(FloatLiteralExpression::Suffix::kH)); } } // namespace diff --git a/src/tint/ast/for_loop_statement.cc b/src/tint/ast/for_loop_statement.cc index 804389c8c5..aba956d695 100644 --- a/src/tint/ast/for_loop_statement.cc +++ b/src/tint/ast/for_loop_statement.cc @@ -21,12 +21,13 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ForLoopStatement); namespace tint::ast { ForLoopStatement::ForLoopStatement(ProgramID pid, + NodeID nid, const Source& src, const Statement* init, const Expression* cond, const Statement* cont, const BlockStatement* b) - : Base(pid, src), initializer(init), condition(cond), continuing(cont), body(b) { + : Base(pid, nid, src), initializer(init), condition(cond), continuing(cont), body(b) { TINT_ASSERT(AST, body); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, initializer, program_id); diff --git a/src/tint/ast/for_loop_statement.h b/src/tint/ast/for_loop_statement.h index 464ea499e8..59e0587842 100644 --- a/src/tint/ast/for_loop_statement.h +++ b/src/tint/ast/for_loop_statement.h @@ -25,14 +25,16 @@ class Expression; class ForLoopStatement final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the for loop statement source /// @param initializer the optional loop initializer statement /// @param condition the optional loop condition expression /// @param continuing the optional continuing statement /// @param body the loop body - ForLoopStatement(ProgramID program_id, - Source const& source, + ForLoopStatement(ProgramID pid, + NodeID nid, + const Source& source, const Statement* initializer, const Expression* condition, const Statement* continuing, diff --git a/src/tint/ast/function.cc b/src/tint/ast/function.cc index d8485d6cc9..1cb03396df 100644 --- a/src/tint/ast/function.cc +++ b/src/tint/ast/function.cc @@ -23,14 +23,15 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Function); namespace tint::ast { Function::Function(ProgramID pid, + NodeID nid, const Source& src, Symbol sym, - VariableList parameters, + utils::VectorRef parameters, const Type* return_ty, const BlockStatement* b, - AttributeList attrs, - AttributeList return_type_attrs) - : Base(pid, src), + utils::VectorRef attrs, + utils::VectorRef return_type_attrs) + : Base(pid, nid, src), symbol(sym), params(std::move(parameters)), return_type(return_ty), @@ -40,7 +41,7 @@ Function::Function(ProgramID pid, TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, symbol, program_id); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, body, program_id); for (auto* param : params) { - TINT_ASSERT(AST, param && param->is_const); + TINT_ASSERT(AST, tint::Is(param)); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, param, program_id); } TINT_ASSERT(AST, symbol.IsValid()); diff --git a/src/tint/ast/function.h b/src/tint/ast/function.h index 843877efde..61771bb4fb 100644 --- a/src/tint/ast/function.h +++ b/src/tint/ast/function.h @@ -26,8 +26,8 @@ #include "src/tint/ast/builtin_attribute.h" #include "src/tint/ast/group_attribute.h" #include "src/tint/ast/location_attribute.h" +#include "src/tint/ast/parameter.h" #include "src/tint/ast/pipeline_stage.h" -#include "src/tint/ast/variable.h" namespace tint::ast { @@ -35,7 +35,8 @@ namespace tint::ast { class Function final : public Castable { public: /// Create a function - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the variable source /// @param symbol the function symbol /// @param params the function parameters @@ -43,14 +44,15 @@ class Function final : public Castable { /// @param body the function body /// @param attributes the function attributes /// @param return_type_attributes the return type attributes - Function(ProgramID program_id, + Function(ProgramID pid, + NodeID nid, const Source& source, Symbol symbol, - VariableList params, + utils::VectorRef params, const Type* return_type, const BlockStatement* body, - AttributeList attributes, - AttributeList return_type_attributes); + utils::VectorRef attributes, + utils::VectorRef return_type_attributes); /// Move constructor Function(Function&&); @@ -72,7 +74,7 @@ class Function final : public Castable { const Symbol symbol; /// The function params - const VariableList params; + const utils::Vector params; /// The function return type const Type* const return_type; @@ -81,18 +83,18 @@ class Function final : public Castable { const BlockStatement* const body; /// The attributes attached to this function - const AttributeList attributes; + const utils::Vector attributes; /// The attributes attached to the function return type. - const AttributeList return_type_attributes; + const utils::Vector return_type_attributes; }; /// A list of functions -class FunctionList : public std::vector { +class FunctionList : public utils::Vector { public: /// Appends f to the end of the list /// @param f the function to append to this list - void Add(const Function* f) { this->emplace_back(f); } + void Add(const Function* f) { this->Push(f); } /// Returns the function with the given name /// @param sym the function symbol to search for diff --git a/src/tint/ast/function_test.cc b/src/tint/ast/function_test.cc index bd05fd827d..b95af2674a 100644 --- a/src/tint/ast/function_test.cc +++ b/src/tint/ast/function_test.cc @@ -26,23 +26,20 @@ namespace { using FunctionTest = TestHelper; TEST_F(FunctionTest, Creation) { - VariableList params; - params.push_back(Param("var", ty.i32())); + utils::Vector params{Param("var", ty.i32())}; auto* var = params[0]; - auto* f = Func("func", params, ty.void_(), StatementList{}, AttributeList{}); + auto* f = Func("func", params, ty.void_(), utils::Empty); EXPECT_EQ(f->symbol, Symbols().Get("func")); - ASSERT_EQ(f->params.size(), 1u); + ASSERT_EQ(f->params.Length(), 1u); EXPECT_TRUE(f->return_type->Is()); EXPECT_EQ(f->params[0], var); } TEST_F(FunctionTest, Creation_WithSource) { - VariableList params; - params.push_back(Param("var", ty.i32())); + utils::Vector params{Param("var", ty.i32())}; - auto* f = Func(Source{Source::Location{20, 2}}, "func", params, ty.void_(), StatementList{}, - AttributeList{}); + auto* f = Func(Source{Source::Location{20, 2}}, "func", params, ty.void_(), utils::Empty); auto src = f->source; EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); @@ -52,7 +49,7 @@ TEST_F(FunctionTest, Assert_InvalidName) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.Func("", VariableList{}, b.ty.void_(), StatementList{}, AttributeList{}); + b.Func("", utils::Empty, b.ty.void_(), utils::Empty); }, "internal compiler error"); } @@ -61,20 +58,20 @@ TEST_F(FunctionTest, Assert_Null_ReturnType) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.Func("f", VariableList{}, nullptr, StatementList{}, AttributeList{}); + b.Func("f", utils::Empty, nullptr, utils::Empty); }, "internal compiler error"); } TEST_F(FunctionTest, Assert_Null_Param) { + using ParamList = utils::Vector; EXPECT_FATAL_FAILURE( { ProgramBuilder b; - VariableList params; - params.push_back(b.Param("var", b.ty.i32())); - params.push_back(nullptr); - - b.Func("f", params, b.ty.void_(), StatementList{}, AttributeList{}); + ParamList params; + params.Push(b.Param("var", b.ty.i32())); + params.Push(nullptr); + b.Func("f", params, b.ty.void_(), utils::Empty); }, "internal compiler error"); } @@ -84,7 +81,7 @@ TEST_F(FunctionTest, Assert_DifferentProgramID_Symbol) { { ProgramBuilder b1; ProgramBuilder b2; - b1.Func(b2.Sym("func"), VariableList{}, b1.ty.void_(), StatementList{}); + b1.Func(b2.Sym("func"), utils::Empty, b1.ty.void_(), utils::Empty); }, "internal compiler error"); } @@ -94,8 +91,11 @@ TEST_F(FunctionTest, Assert_DifferentProgramID_Param) { { ProgramBuilder b1; ProgramBuilder b2; - b1.Func("func", VariableList{b2.Param("var", b2.ty.i32())}, b1.ty.void_(), - StatementList{}); + b1.Func("func", + utils::Vector{ + b2.Param("var", b2.ty.i32()), + }, + b1.ty.void_(), utils::Empty); }, "internal compiler error"); } @@ -105,8 +105,8 @@ TEST_F(FunctionTest, Assert_DifferentProgramID_Attr) { { ProgramBuilder b1; ProgramBuilder b2; - b1.Func("func", VariableList{}, b1.ty.void_(), StatementList{}, - AttributeList{ + b1.Func("func", utils::Empty, b1.ty.void_(), utils::Empty, + utils::Vector{ b2.WorkgroupSize(2_i, 4_i, 6_i), }); }, @@ -118,30 +118,18 @@ TEST_F(FunctionTest, Assert_DifferentProgramID_ReturnAttr) { { ProgramBuilder b1; ProgramBuilder b2; - b1.Func("func", VariableList{}, b1.ty.void_(), StatementList{}, AttributeList{}, - AttributeList{ + b1.Func("func", utils::Empty, b1.ty.void_(), utils::Empty, utils::Empty, + utils::Vector{ b2.WorkgroupSize(2_i, 4_i, 6_i), }); }, "internal compiler error"); } -TEST_F(FunctionTest, Assert_NonConstParam) { - EXPECT_FATAL_FAILURE( - { - ProgramBuilder b; - VariableList params; - params.push_back(b.Var("var", b.ty.i32(), ast::StorageClass::kNone)); - - b.Func("f", params, b.ty.void_(), StatementList{}, AttributeList{}); - }, - "internal compiler error"); -} - using FunctionListTest = TestHelper; TEST_F(FunctionListTest, FindSymbol) { - auto* func = Func("main", VariableList{}, ty.f32(), StatementList{}, ast::AttributeList{}); + auto* func = Func("main", utils::Empty, ty.f32(), utils::Empty); FunctionList list; list.Add(func); EXPECT_EQ(func, list.Find(Symbols().Register("main"))); @@ -153,12 +141,12 @@ TEST_F(FunctionListTest, FindSymbolMissing) { } TEST_F(FunctionListTest, FindSymbolStage) { - auto* fs = Func("main", VariableList{}, ty.f32(), StatementList{}, - ast::AttributeList{ + auto* fs = Func("main", utils::Empty, ty.f32(), utils::Empty, + utils::Vector{ Stage(PipelineStage::kFragment), }); - auto* vs = Func("main", VariableList{}, ty.f32(), StatementList{}, - ast::AttributeList{ + auto* vs = Func("main", utils::Empty, ty.f32(), utils::Empty, + utils::Vector{ Stage(PipelineStage::kVertex), }); FunctionList list; @@ -170,8 +158,8 @@ TEST_F(FunctionListTest, FindSymbolStage) { TEST_F(FunctionListTest, FindSymbolStageMissing) { FunctionList list; - list.Add(Func("main", VariableList{}, ty.f32(), StatementList{}, - ast::AttributeList{ + list.Add(Func("main", utils::Empty, ty.f32(), utils::Empty, + utils::Vector{ Stage(PipelineStage::kFragment), })); EXPECT_EQ(nullptr, list.Find(Symbols().Register("main"), PipelineStage::kVertex)); @@ -179,8 +167,8 @@ TEST_F(FunctionListTest, FindSymbolStageMissing) { TEST_F(FunctionListTest, HasStage) { FunctionList list; - list.Add(Func("main", VariableList{}, ty.f32(), StatementList{}, - ast::AttributeList{ + list.Add(Func("main", utils::Empty, ty.f32(), utils::Empty, + utils::Vector{ Stage(PipelineStage::kFragment), })); EXPECT_TRUE(list.HasStage(PipelineStage::kFragment)); diff --git a/src/tint/ast/group_attribute.cc b/src/tint/ast/group_attribute.cc index 394a690771..9d011114ca 100644 --- a/src/tint/ast/group_attribute.cc +++ b/src/tint/ast/group_attribute.cc @@ -22,8 +22,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::GroupAttribute); namespace tint::ast { -GroupAttribute::GroupAttribute(ProgramID pid, const Source& src, uint32_t val) - : Base(pid, src), value(val) {} +GroupAttribute::GroupAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t val) + : Base(pid, nid, src), value(val) {} GroupAttribute::~GroupAttribute() = default; diff --git a/src/tint/ast/group_attribute.h b/src/tint/ast/group_attribute.h index a55946177b..66d6ccb409 100644 --- a/src/tint/ast/group_attribute.h +++ b/src/tint/ast/group_attribute.h @@ -26,9 +26,10 @@ class GroupAttribute final : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param value the group value - GroupAttribute(ProgramID pid, const Source& src, uint32_t value); + GroupAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t value); ~GroupAttribute() override; /// @returns the WGSL name for the attribute diff --git a/src/tint/ast/group_attribute_test.cc b/src/tint/ast/group_attribute_test.cc index 53167bbb7a..4a6dd1dd28 100644 --- a/src/tint/ast/group_attribute_test.cc +++ b/src/tint/ast/group_attribute_test.cc @@ -20,7 +20,7 @@ namespace { using GroupAttributeTest = TestHelper; TEST_F(GroupAttributeTest, Creation) { - auto* d = create(2); + auto* d = create(2u); EXPECT_EQ(2u, d->value); } diff --git a/src/tint/ast/i32.cc b/src/tint/ast/i32.cc index 46fe75ed78..ffdf30dedf 100644 --- a/src/tint/ast/i32.cc +++ b/src/tint/ast/i32.cc @@ -20,7 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::I32); namespace tint::ast { -I32::I32(ProgramID pid, const Source& src) : Base(pid, src) {} +I32::I32(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} I32::I32(I32&&) = default; diff --git a/src/tint/ast/i32.h b/src/tint/ast/i32.h index acafd37cfd..d2c951c3f0 100644 --- a/src/tint/ast/i32.h +++ b/src/tint/ast/i32.h @@ -26,8 +26,9 @@ class I32 final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - I32(ProgramID pid, const Source& src); + I32(ProgramID pid, NodeID nid, const Source& src); /// Move constructor I32(I32&&); ~I32() override; diff --git a/src/tint/ast/id_attribute.cc b/src/tint/ast/id_attribute.cc index b6e19574b3..75d62c6cd0 100644 --- a/src/tint/ast/id_attribute.cc +++ b/src/tint/ast/id_attribute.cc @@ -22,8 +22,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::IdAttribute); namespace tint::ast { -IdAttribute::IdAttribute(ProgramID pid, const Source& src, uint32_t val) - : Base(pid, src), value(val) {} +IdAttribute::IdAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t val) + : Base(pid, nid, src), value(val) {} IdAttribute::~IdAttribute() = default; diff --git a/src/tint/ast/id_attribute.h b/src/tint/ast/id_attribute.h index 5e3ec12f78..ca2a35822d 100644 --- a/src/tint/ast/id_attribute.h +++ b/src/tint/ast/id_attribute.h @@ -26,9 +26,10 @@ class IdAttribute final : public Castable { public: /// Create an id attribute. /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param val the numeric id value - IdAttribute(ProgramID pid, const Source& src, uint32_t val); + IdAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t val); ~IdAttribute() override; /// @returns the WGSL name for the attribute diff --git a/src/tint/ast/id_attribute_test.cc b/src/tint/ast/id_attribute_test.cc index 6957d66b63..ad05c58ab5 100644 --- a/src/tint/ast/id_attribute_test.cc +++ b/src/tint/ast/id_attribute_test.cc @@ -22,7 +22,7 @@ namespace { using IdAttributeTest = TestHelper; TEST_F(IdAttributeTest, Creation) { - auto* d = create(12); + auto* d = create(12u); EXPECT_EQ(12u, d->value); } diff --git a/src/tint/ast/identifier_expression.cc b/src/tint/ast/identifier_expression.cc index 453ae69662..34eadeb07b 100644 --- a/src/tint/ast/identifier_expression.cc +++ b/src/tint/ast/identifier_expression.cc @@ -20,8 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::IdentifierExpression); namespace tint::ast { -IdentifierExpression::IdentifierExpression(ProgramID pid, const Source& src, Symbol sym) - : Base(pid, src), symbol(sym) { +IdentifierExpression::IdentifierExpression(ProgramID pid, NodeID nid, const Source& src, Symbol sym) + : Base(pid, nid, src), symbol(sym) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, symbol, program_id); TINT_ASSERT(AST, symbol.IsValid()); } diff --git a/src/tint/ast/identifier_expression.h b/src/tint/ast/identifier_expression.h index c3e1c30e54..b583807ba2 100644 --- a/src/tint/ast/identifier_expression.h +++ b/src/tint/ast/identifier_expression.h @@ -24,9 +24,10 @@ class IdentifierExpression final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param condition the if condition /// @param body the if body /// @param else_stmt the else statement, or nullptr IfStatement(ProgramID pid, + NodeID nid, const Source& src, const Expression* condition, const BlockStatement* body, diff --git a/src/tint/ast/increment_decrement_statement.cc b/src/tint/ast/increment_decrement_statement.cc index 99c65cb4f7..5b10e5fb8c 100644 --- a/src/tint/ast/increment_decrement_statement.cc +++ b/src/tint/ast/increment_decrement_statement.cc @@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::IncrementDecrementStatement); namespace tint::ast { IncrementDecrementStatement::IncrementDecrementStatement(ProgramID pid, + NodeID nid, const Source& src, const Expression* l, bool inc) - : Base(pid, src), lhs(l), increment(inc) { + : Base(pid, nid, src), lhs(l), increment(inc) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, lhs, program_id); } diff --git a/src/tint/ast/increment_decrement_statement.h b/src/tint/ast/increment_decrement_statement.h index 05b8478e94..ec9923ab69 100644 --- a/src/tint/ast/increment_decrement_statement.h +++ b/src/tint/ast/increment_decrement_statement.h @@ -25,10 +25,15 @@ class IncrementDecrementStatement final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the index accessor source /// @param obj the object /// @param idx the index expression - IndexAccessorExpression(ProgramID program_id, + IndexAccessorExpression(ProgramID pid, + NodeID nid, const Source& source, const Expression* obj, const Expression* idx); diff --git a/src/tint/ast/int_literal_expression.cc b/src/tint/ast/int_literal_expression.cc index 7e11f7ec5a..502ea9d0db 100644 --- a/src/tint/ast/int_literal_expression.cc +++ b/src/tint/ast/int_literal_expression.cc @@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::IntLiteralExpression); namespace tint::ast { IntLiteralExpression::IntLiteralExpression(ProgramID pid, + NodeID nid, const Source& src, int64_t val, Suffix suf) - : Base(pid, src), value(val), suffix(suf) {} + : Base(pid, nid, src), value(val), suffix(suf) {} IntLiteralExpression::~IntLiteralExpression() = default; diff --git a/src/tint/ast/int_literal_expression.h b/src/tint/ast/int_literal_expression.h index 8ff58eaf22..10cbbee5a0 100644 --- a/src/tint/ast/int_literal_expression.h +++ b/src/tint/ast/int_literal_expression.h @@ -20,7 +20,7 @@ namespace tint::ast { /// An integer literal. The literal may have an 'i', 'u' or no suffix. -class IntLiteralExpression : public Castable { +class IntLiteralExpression final : public Castable { public: /// Literal suffix enum class Suffix { @@ -34,10 +34,11 @@ class IntLiteralExpression : public Castablesuffix, IntLiteralExpression::Suffix::kU); } +TEST_F(IntLiteralExpressionTest, SuffixStringStream) { + auto to_str = [](IntLiteralExpression::Suffix suffix) { + std::stringstream ss; + ss << suffix; + return ss.str(); + }; + + EXPECT_EQ("", to_str(IntLiteralExpression::Suffix::kNone)); + EXPECT_EQ("i", to_str(IntLiteralExpression::Suffix::kI)); + EXPECT_EQ("u", to_str(IntLiteralExpression::Suffix::kU)); +} + } // namespace } // namespace tint::ast diff --git a/src/tint/ast/internal_attribute.cc b/src/tint/ast/internal_attribute.cc index 180e90983a..1b4ca9e99b 100644 --- a/src/tint/ast/internal_attribute.cc +++ b/src/tint/ast/internal_attribute.cc @@ -18,7 +18,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::InternalAttribute); namespace tint::ast { -InternalAttribute::InternalAttribute(ProgramID pid) : Base(pid, Source{}) {} +InternalAttribute::InternalAttribute(ProgramID pid, NodeID nid) : Base(pid, nid, Source{}) {} InternalAttribute::~InternalAttribute() = default; diff --git a/src/tint/ast/internal_attribute.h b/src/tint/ast/internal_attribute.h index bb13559184..9904af819e 100644 --- a/src/tint/ast/internal_attribute.h +++ b/src/tint/ast/internal_attribute.h @@ -28,7 +28,8 @@ class InternalAttribute : public Castable { public: /// Constructor /// @param program_id the identifier of the program that owns this node - explicit InternalAttribute(ProgramID program_id); + /// @param nid the unique node identifier + explicit InternalAttribute(ProgramID program_id, NodeID nid); /// Destructor ~InternalAttribute() override; diff --git a/src/tint/ast/interpolate_attribute.cc b/src/tint/ast/interpolate_attribute.cc index 909e827d59..29e3bfed42 100644 --- a/src/tint/ast/interpolate_attribute.cc +++ b/src/tint/ast/interpolate_attribute.cc @@ -23,10 +23,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::InterpolateAttribute); namespace tint::ast { InterpolateAttribute::InterpolateAttribute(ProgramID pid, + NodeID nid, const Source& src, InterpolationType ty, InterpolationSampling smpl) - : Base(pid, src), type(ty), sampling(smpl) {} + : Base(pid, nid, src), type(ty), sampling(smpl) {} InterpolateAttribute::~InterpolateAttribute() = default; diff --git a/src/tint/ast/interpolate_attribute.h b/src/tint/ast/interpolate_attribute.h index 4b2a2df787..4f9ea9de4b 100644 --- a/src/tint/ast/interpolate_attribute.h +++ b/src/tint/ast/interpolate_attribute.h @@ -33,10 +33,12 @@ class InterpolateAttribute final : public Castable public: /// constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - InvariantAttribute(ProgramID pid, const Source& src); + InvariantAttribute(ProgramID pid, NodeID nid, const Source& src); ~InvariantAttribute() override; /// @returns the WGSL name for the attribute diff --git a/src/tint/ast/let.cc b/src/tint/ast/let.cc new file mode 100644 index 0000000000..0248234c89 --- /dev/null +++ b/src/tint/ast/let.cc @@ -0,0 +1,53 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/let.h" + +#include + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::ast::Let); + +namespace tint::ast { + +Let::Let(ProgramID pid, + NodeID nid, + const Source& src, + const Symbol& sym, + const ast::Type* ty, + const Expression* ctor, + utils::VectorRef attrs) + : Base(pid, nid, src, sym, ty, ctor, std::move(attrs)) { + TINT_ASSERT(AST, ctor != nullptr); +} + +Let::Let(Let&&) = default; + +Let::~Let() = default; + +const char* Let::Kind() const { + return "let"; +} + +const Let* Let::Clone(CloneContext* ctx) const { + auto src = ctx->Clone(source); + auto sym = ctx->Clone(symbol); + auto* ty = ctx->Clone(type); + auto* ctor = ctx->Clone(constructor); + auto attrs = ctx->Clone(attributes); + return ctx->dst->create(src, sym, ty, ctor, std::move(attrs)); +} + +} // namespace tint::ast diff --git a/src/tint/ast/let.h b/src/tint/ast/let.h new file mode 100644 index 0000000000..fa0c8be6a9 --- /dev/null +++ b/src/tint/ast/let.h @@ -0,0 +1,66 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_AST_LET_H_ +#define SRC_TINT_AST_LET_H_ + +#include "src/tint/ast/variable.h" + +namespace tint::ast { + +/// A "let" declaration is a name for a function-scoped runtime typed value. +/// +/// Examples: +/// +/// ``` +/// let twice_depth : i32 = width + width; // Must have initializer +/// ``` +/// @see https://www.w3.org/TR/WGSL/#let-decls +class Let final : public Castable { + public: + /// Create a 'let' variable + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier + /// @param source the variable source + /// @param sym the variable symbol + /// @param type the declared variable type + /// @param constructor the constructor expression + /// @param attributes the variable attributes + Let(ProgramID pid, + NodeID nid, + const Source& source, + const Symbol& sym, + const ast::Type* type, + const Expression* constructor, + utils::VectorRef attributes); + + /// Move constructor + Let(Let&&); + + /// Destructor + ~Let() override; + + /// @returns "let" + const char* Kind() const override; + + /// Clones this node and all transitive child nodes using the `CloneContext` + /// `ctx`. + /// @param ctx the clone context + /// @return the newly cloned node + const Let* Clone(CloneContext* ctx) const override; +}; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_LET_H_ diff --git a/src/tint/ast/literal_expression.cc b/src/tint/ast/literal_expression.cc index d05279d0f7..bcf62adb08 100644 --- a/src/tint/ast/literal_expression.cc +++ b/src/tint/ast/literal_expression.cc @@ -18,7 +18,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::LiteralExpression); namespace tint::ast { -LiteralExpression::LiteralExpression(ProgramID pid, const Source& src) : Base(pid, src) {} +LiteralExpression::LiteralExpression(ProgramID pid, NodeID nid, const Source& src) + : Base(pid, nid, src) {} LiteralExpression::~LiteralExpression() = default; diff --git a/src/tint/ast/literal_expression.h b/src/tint/ast/literal_expression.h index 56fc1f0f80..b4b2b097a1 100644 --- a/src/tint/ast/literal_expression.h +++ b/src/tint/ast/literal_expression.h @@ -29,8 +29,9 @@ class LiteralExpression : public Castable { protected: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the input source - LiteralExpression(ProgramID pid, const Source& src); + LiteralExpression(ProgramID pid, NodeID nid, const Source& src); }; } // namespace tint::ast diff --git a/src/tint/ast/location_attribute.cc b/src/tint/ast/location_attribute.cc index 1eae823ade..2ea2d5d24d 100644 --- a/src/tint/ast/location_attribute.cc +++ b/src/tint/ast/location_attribute.cc @@ -22,8 +22,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::LocationAttribute); namespace tint::ast { -LocationAttribute::LocationAttribute(ProgramID pid, const Source& src, uint32_t val) - : Base(pid, src), value(val) {} +LocationAttribute::LocationAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t val) + : Base(pid, nid, src), value(val) {} LocationAttribute::~LocationAttribute() = default; diff --git a/src/tint/ast/location_attribute.h b/src/tint/ast/location_attribute.h index 3646c544fc..97c6feaf84 100644 --- a/src/tint/ast/location_attribute.h +++ b/src/tint/ast/location_attribute.h @@ -26,9 +26,10 @@ class LocationAttribute final : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param value the location value - LocationAttribute(ProgramID pid, const Source& src, uint32_t value); + LocationAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t value); ~LocationAttribute() override; /// @returns the WGSL name for the attribute diff --git a/src/tint/ast/location_attribute_test.cc b/src/tint/ast/location_attribute_test.cc index a1562d561a..e0bcb39c7f 100644 --- a/src/tint/ast/location_attribute_test.cc +++ b/src/tint/ast/location_attribute_test.cc @@ -20,7 +20,7 @@ namespace { using LocationAttributeTest = TestHelper; TEST_F(LocationAttributeTest, Creation) { - auto* d = create(2); + auto* d = create(2u); EXPECT_EQ(2u, d->value); } diff --git a/src/tint/ast/loop_statement.cc b/src/tint/ast/loop_statement.cc index 9d14960c97..b7e7a1bd71 100644 --- a/src/tint/ast/loop_statement.cc +++ b/src/tint/ast/loop_statement.cc @@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::LoopStatement); namespace tint::ast { LoopStatement::LoopStatement(ProgramID pid, + NodeID nid, const Source& src, const BlockStatement* b, const BlockStatement* cont) - : Base(pid, src), body(b), continuing(cont) { + : Base(pid, nid, src), body(b), continuing(cont) { TINT_ASSERT(AST, body); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, body, program_id); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, continuing, program_id); diff --git a/src/tint/ast/loop_statement.h b/src/tint/ast/loop_statement.h index 5a044fead8..d4b24cf7bc 100644 --- a/src/tint/ast/loop_statement.h +++ b/src/tint/ast/loop_statement.h @@ -23,11 +23,13 @@ namespace tint::ast { class LoopStatement final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the loop statement source /// @param body the body statements /// @param continuing the continuing statements - LoopStatement(ProgramID program_id, + LoopStatement(ProgramID pid, + NodeID nid, const Source& source, const BlockStatement* body, const BlockStatement* continuing); diff --git a/src/tint/ast/loop_statement_test.cc b/src/tint/ast/loop_statement_test.cc index c28665b0b7..caa995debf 100644 --- a/src/tint/ast/loop_statement_test.cc +++ b/src/tint/ast/loop_statement_test.cc @@ -31,9 +31,9 @@ TEST_F(LoopStatementTest, Creation) { auto* continuing = Block(create()); auto* l = create(body, continuing); - ASSERT_EQ(l->body->statements.size(), 1u); + ASSERT_EQ(l->body->statements.Length(), 1u); EXPECT_EQ(l->body->statements[0], b); - ASSERT_EQ(l->continuing->statements.size(), 1u); + ASSERT_EQ(l->continuing->statements.Length(), 1u); EXPECT_EQ(l->continuing->statements[0], continuing->Last()); } diff --git a/src/tint/ast/matrix.cc b/src/tint/ast/matrix.cc index 1f74a26ec0..69371274f9 100644 --- a/src/tint/ast/matrix.cc +++ b/src/tint/ast/matrix.cc @@ -20,8 +20,13 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Matrix); namespace tint::ast { -Matrix::Matrix(ProgramID pid, const Source& src, const Type* subtype, uint32_t r, uint32_t c) - : Base(pid, src), type(subtype), rows(r), columns(c) { +Matrix::Matrix(ProgramID pid, + NodeID nid, + const Source& src, + const Type* subtype, + uint32_t r, + uint32_t c) + : Base(pid, nid, src), type(subtype), rows(r), columns(c) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, subtype, program_id); TINT_ASSERT(AST, rows > 1); TINT_ASSERT(AST, rows < 5); diff --git a/src/tint/ast/matrix.h b/src/tint/ast/matrix.h index 620f28a38c..e778738d8c 100644 --- a/src/tint/ast/matrix.h +++ b/src/tint/ast/matrix.h @@ -26,13 +26,19 @@ class Matrix final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param subtype the declared type of the matrix components. May be null for /// matrix constructors, where the element type will be inferred from /// the constructor arguments /// @param rows the number of rows in the matrix /// @param columns the number of columns in the matrix - Matrix(ProgramID pid, const Source& src, const Type* subtype, uint32_t rows, uint32_t columns); + Matrix(ProgramID pid, + NodeID nid, + const Source& src, + const Type* subtype, + uint32_t rows, + uint32_t columns); /// Move constructor Matrix(Matrix&&); ~Matrix() override; diff --git a/src/tint/ast/matrix_test.cc b/src/tint/ast/matrix_test.cc index 66ea84de9f..dbb88e38f8 100644 --- a/src/tint/ast/matrix_test.cc +++ b/src/tint/ast/matrix_test.cc @@ -34,7 +34,7 @@ using AstMatrixTest = TestHelper; TEST_F(AstMatrixTest, Creation) { auto* i32 = create(); - auto* m = create(i32, 2, 4); + auto* m = create(i32, 2u, 4u); EXPECT_EQ(m->type, i32); EXPECT_EQ(m->rows, 2u); EXPECT_EQ(m->columns, 4u); @@ -42,12 +42,12 @@ TEST_F(AstMatrixTest, Creation) { TEST_F(AstMatrixTest, FriendlyName) { auto* i32 = create(); - auto* m = create(i32, 3, 2); + auto* m = create(i32, 3u, 2u); EXPECT_EQ(m->FriendlyName(Symbols()), "mat2x3"); } TEST_F(AstMatrixTest, FriendlyName_WithoutType) { - auto* m = create(nullptr, 3, 2); + auto* m = create(nullptr, 3u, 2u); EXPECT_EQ(m->FriendlyName(Symbols()), "mat2x3"); } diff --git a/src/tint/ast/member_accessor_expression.cc b/src/tint/ast/member_accessor_expression.cc index a087ea458c..b895e3bec0 100644 --- a/src/tint/ast/member_accessor_expression.cc +++ b/src/tint/ast/member_accessor_expression.cc @@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::MemberAccessorExpression); namespace tint::ast { MemberAccessorExpression::MemberAccessorExpression(ProgramID pid, + NodeID nid, const Source& src, const Expression* str, const IdentifierExpression* mem) - : Base(pid, src), structure(str), member(mem) { + : Base(pid, nid, src), structure(str), member(mem) { TINT_ASSERT(AST, structure); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, structure, program_id); TINT_ASSERT(AST, member); diff --git a/src/tint/ast/member_accessor_expression.h b/src/tint/ast/member_accessor_expression.h index 07054caddb..33284fe7ac 100644 --- a/src/tint/ast/member_accessor_expression.h +++ b/src/tint/ast/member_accessor_expression.h @@ -23,11 +23,13 @@ namespace tint::ast { class MemberAccessorExpression final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the member accessor expression source /// @param structure the structure /// @param member the member - MemberAccessorExpression(ProgramID program_id, + MemberAccessorExpression(ProgramID pid, + NodeID nid, const Source& source, const Expression* structure, const IdentifierExpression* member); diff --git a/src/tint/ast/module.cc b/src/tint/ast/module.cc index e163c19d99..3faab6c56e 100644 --- a/src/tint/ast/module.cc +++ b/src/tint/ast/module.cc @@ -23,10 +23,13 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Module); namespace tint::ast { -Module::Module(ProgramID pid, const Source& src) : Base(pid, src) {} +Module::Module(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} -Module::Module(ProgramID pid, const Source& src, std::vector global_decls) - : Base(pid, src), global_declarations_(std::move(global_decls)) { +Module::Module(ProgramID pid, + NodeID nid, + const Source& src, + utils::VectorRef global_decls) + : Base(pid, nid, src), global_declarations_(std::move(global_decls)) { for (auto* decl : global_declarations_) { if (decl == nullptr) { continue; @@ -50,7 +53,7 @@ const ast::TypeDecl* Module::LookupType(Symbol name) const { void Module::AddGlobalDeclaration(const tint::ast::Node* decl) { diag::List diags; BinGlobalDeclaration(decl, diags); - global_declarations_.emplace_back(decl); + global_declarations_.Push(decl); } void Module::BinGlobalDeclaration(const tint::ast::Node* decl, diag::List& diags) { @@ -58,49 +61,60 @@ void Module::BinGlobalDeclaration(const tint::ast::Node* decl, diag::List& diags decl, // [&](const ast::TypeDecl* type) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, type, program_id); - type_decls_.push_back(type); + type_decls_.Push(type); }, [&](const Function* func) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, func, program_id); - functions_.push_back(func); + functions_.Push(func); }, [&](const Variable* var) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, var, program_id); - global_variables_.push_back(var); + global_variables_.Push(var); }, - [&](const Enable* ext) { - TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, ext, program_id); - extensions_.insert(ext->kind); + [&](const Enable* enable) { + TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, enable, program_id); + enables_.Push(enable); + }, + [&](const StaticAssert* assertion) { + TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, assertion, program_id); + static_asserts_.Push(assertion); }, [&](Default) { TINT_ICE(AST, diags) << "Unknown global declaration type"; }); } -void Module::AddEnable(const ast::Enable* ext) { - TINT_ASSERT(AST, ext); - TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, ext, program_id); - global_declarations_.push_back(ext); - extensions_.insert(ext->kind); +void Module::AddEnable(const ast::Enable* enable) { + TINT_ASSERT(AST, enable); + TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, enable, program_id); + global_declarations_.Push(enable); + enables_.Push(enable); } void Module::AddGlobalVariable(const ast::Variable* var) { TINT_ASSERT(AST, var); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, var, program_id); - global_variables_.push_back(var); - global_declarations_.push_back(var); + global_variables_.Push(var); + global_declarations_.Push(var); +} + +void Module::AddStaticAssert(const StaticAssert* assertion) { + TINT_ASSERT(AST, assertion); + TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, assertion, program_id); + static_asserts_.Push(assertion); + global_declarations_.Push(assertion); } void Module::AddTypeDecl(const ast::TypeDecl* type) { TINT_ASSERT(AST, type); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, type, program_id); - type_decls_.push_back(type); - global_declarations_.push_back(type); + type_decls_.Push(type); + global_declarations_.Push(type); } void Module::AddFunction(const ast::Function* func) { TINT_ASSERT(AST, func); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, func, program_id); - functions_.push_back(func); - global_declarations_.push_back(func); + functions_.Push(func); + global_declarations_.Push(func); } const Module* Module::Clone(CloneContext* ctx) const { @@ -114,10 +128,10 @@ void Module::Copy(CloneContext* ctx, const Module* src) { // During the clone, declarations may have been placed into the module. // Clear everything out, as we're about to re-bin the declarations. - type_decls_.clear(); - functions_.clear(); - global_variables_.clear(); - extensions_.clear(); + type_decls_.Clear(); + functions_.Clear(); + global_variables_.Clear(); + enables_.Clear(); for (auto* decl : global_declarations_) { if (!decl) { diff --git a/src/tint/ast/module.h b/src/tint/ast/module.h index d8be2ed67b..2818cb827e 100644 --- a/src/tint/ast/module.h +++ b/src/tint/ast/module.h @@ -16,11 +16,12 @@ #define SRC_TINT_AST_MODULE_H_ #include -#include #include "src/tint/ast/enable.h" #include "src/tint/ast/function.h" +#include "src/tint/ast/static_assert.h" #include "src/tint/ast/type.h" +#include "src/tint/utils/vector.h" namespace tint::ast { @@ -32,27 +33,28 @@ class Module final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - Module(ProgramID pid, const Source& src); + Module(ProgramID pid, NodeID nid, const Source& src); /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param global_decls the list of global types, functions, and variables, in /// the order they were declared in the source program - Module(ProgramID pid, const Source& src, std::vector global_decls); + Module(ProgramID pid, + NodeID nid, + const Source& src, + utils::VectorRef global_decls); /// Destructor ~Module() override; /// @returns the declaration-ordered global declarations for the module - const std::vector& GlobalDeclarations() const { return global_declarations_; } + const auto& GlobalDeclarations() const { return global_declarations_; } - /// Add a enable directive to the Builder - /// @param ext the enable directive to add - void AddEnable(const Enable* ext); - - /// Add a global variable to the Builder + /// Add a global variable to the module /// @param var the variable to add void AddGlobalVariable(const Variable* var); @@ -67,20 +69,44 @@ class Module final : public Castable { return false; } - /// Adds a global declaration to the Builder. + /// Adds a global declaration to the module. /// @param decl the declaration to add void AddGlobalDeclaration(const tint::ast::Node* decl); /// @returns the global variables for the module - const VariableList& GlobalVariables() const { return global_variables_; } + const auto& GlobalVariables() const { return global_variables_; } /// @returns the global variables for the module - VariableList& GlobalVariables() { return global_variables_; } + auto& GlobalVariables() { return global_variables_; } + + /// @returns the global variable declarations of kind 'T' for the module + template > + auto Globals() const { + utils::Vector out; + out.Reserve(global_variables_.Length()); + for (auto* global : global_variables_) { + if (auto* var = global->As()) { + out.Push(var); + } + } + return out; + } + + /// Add a enable directive to the module + /// @param ext the enable directive to add + void AddEnable(const Enable* ext); /// @returns the extension set for the module - const ExtensionSet& Extensions() const { return extensions_; } + const auto& Enables() const { return enables_; } - /// Adds a type declaration to the Builder. + /// Add a global static assertion to the module + /// @param assertion the static assert to add + void AddStaticAssert(const StaticAssert* assertion); + + /// @returns the list of global static assertions + const auto& StaticAsserts() const { return static_asserts_; } + + /// Adds a type declaration to the module /// @param decl the type declaration to add void AddTypeDecl(const TypeDecl* decl); @@ -89,9 +115,9 @@ class Module final : public Castable { const TypeDecl* LookupType(Symbol name) const; /// @returns the declared types in the module - const std::vector& TypeDecls() const { return type_decls_; } + const auto& TypeDecls() const { return type_decls_; } - /// Add a function to the Builder + /// Add a function to the module /// @param func the function to add void AddFunction(const Function* func); @@ -116,11 +142,12 @@ class Module final : public Castable { /// * #functions_ void BinGlobalDeclaration(const tint::ast::Node* decl, diag::List& diags); - std::vector global_declarations_; - std::vector type_decls_; + utils::Vector global_declarations_; + utils::Vector type_decls_; FunctionList functions_; - VariableList global_variables_; - ExtensionSet extensions_; + utils::Vector global_variables_; + utils::Vector enables_; + utils::Vector static_asserts_; }; } // namespace tint::ast diff --git a/src/tint/ast/module_clone_test.cc b/src/tint/ast/module_clone_test.cc index 65c2406f40..a79ef0e566 100644 --- a/src/tint/ast/module_clone_test.cc +++ b/src/tint/ast/module_clone_test.cc @@ -37,8 +37,8 @@ struct S1 { m1 : array, }; -let c0 : i32 = 10; -let c1 : bool = true; +const c0 : i32 = 10; +const c1 : bool = true; type t0 = array>; type t1 = array>; @@ -52,7 +52,7 @@ var g1 : f32 = 123.0; @group(4) @binding(0) var g6 : texture_external; var g7 : vec3; -@group(0) @binding(1) var g8 : S0; +@group(0) @binding(1) var g8 : S0; @group(1) @binding(1) var g9 : S0; @group(2) @binding(1) var g10 : S0; @@ -71,6 +71,8 @@ fn f1(p0 : f32, p1 : i32) -> f32 { var l4 : S1; var l5 : u32 = l4.m1[5]; let l6 : ptr = &g0; + const l7 = 123; + const l8 : i32 = 123; loop { l0 = (p1 + 2); if (((l0 % 4) == 0)) { @@ -99,12 +101,12 @@ fn f1(p0 : f32, p1 : i32) -> f32 { return 1.0; } -@stage(fragment) +@fragment fn main() { f1(1.0, 2); } -let declaration_order_check_0 : i32 = 1; +const declaration_order_check_0 : i32 = 1; type declaration_order_check_1 = f32; @@ -112,7 +114,7 @@ fn declaration_order_check_2() {} type declaration_order_check_3 = f32; -let declaration_order_check_4 : i32 = 1; +const declaration_order_check_4 : i32 = 1; )"); diff --git a/src/tint/ast/module_test.cc b/src/tint/ast/module_test.cc index 6ac610ef2e..3093a16efe 100644 --- a/src/tint/ast/module_test.cc +++ b/src/tint/ast/module_test.cc @@ -22,11 +22,11 @@ namespace { using ModuleTest = TestHelper; TEST_F(ModuleTest, Creation) { - EXPECT_EQ(Program(std::move(*this)).AST().Functions().size(), 0u); + EXPECT_EQ(Program(std::move(*this)).AST().Functions().Length(), 0u); } TEST_F(ModuleTest, LookupFunction) { - auto* func = Func("main", VariableList{}, ty.f32(), StatementList{}, ast::AttributeList{}); + auto* func = Func("main", {}, ty.f32(), {}); Program program(std::move(*this)); EXPECT_EQ(func, program.AST().Functions().Find(program.Symbols().Get("main"))); @@ -61,8 +61,8 @@ TEST_F(ModuleTest, Assert_DifferentProgramID_Function) { ProgramBuilder b1; ProgramBuilder b2; b1.AST().AddFunction(b2.create(b2.Symbols().Register("func"), - VariableList{}, b2.ty.f32(), b2.Block(), - AttributeList{}, AttributeList{})); + utils::Empty, b2.ty.f32(), b2.Block(), + utils::Empty, utils::Empty)); }, "internal compiler error"); } @@ -92,7 +92,7 @@ TEST_F(ModuleTest, CloneOrder) { ProgramBuilder b; b.Func("F", {}, b.ty.void_(), {}); b.Alias("A", b.ty.u32()); - b.Global("V", b.ty.i32(), ast::StorageClass::kPrivate); + b.GlobalVar("V", b.ty.i32(), ast::StorageClass::kPrivate); return Program(std::move(b)); }(); @@ -116,7 +116,7 @@ TEST_F(ModuleTest, CloneOrder) { ctx.Clone(); auto& decls = cloned.AST().GlobalDeclarations(); - ASSERT_EQ(decls.size(), 6u); + ASSERT_EQ(decls.Length(), 6u); EXPECT_TRUE(decls[1]->Is()); EXPECT_TRUE(decls[3]->Is()); EXPECT_TRUE(decls[5]->Is()); diff --git a/src/tint/ast/multisampled_texture.cc b/src/tint/ast/multisampled_texture.cc index 91f8edf5dd..0c4485754d 100644 --- a/src/tint/ast/multisampled_texture.cc +++ b/src/tint/ast/multisampled_texture.cc @@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::MultisampledTexture); namespace tint::ast { MultisampledTexture::MultisampledTexture(ProgramID pid, + NodeID nid, const Source& src, TextureDimension d, const Type* ty) - : Base(pid, src, d), type(ty) { + : Base(pid, nid, src, d), type(ty) { TINT_ASSERT(AST, type); } diff --git a/src/tint/ast/multisampled_texture.h b/src/tint/ast/multisampled_texture.h index 1d95505614..6887045fc5 100644 --- a/src/tint/ast/multisampled_texture.h +++ b/src/tint/ast/multisampled_texture.h @@ -26,10 +26,15 @@ class MultisampledTexture final : public Castable public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param dim the dimensionality of the texture /// @param type the data type of the multisampled texture - MultisampledTexture(ProgramID pid, const Source& src, TextureDimension dim, const Type* type); + MultisampledTexture(ProgramID pid, + NodeID nid, + const Source& src, + TextureDimension dim, + const Type* type); /// Move constructor MultisampledTexture(MultisampledTexture&&); ~MultisampledTexture() override; diff --git a/src/tint/ast/node.cc b/src/tint/ast/node.cc index 2368791d3d..ce3a71d1b9 100644 --- a/src/tint/ast/node.cc +++ b/src/tint/ast/node.cc @@ -18,7 +18,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Node); namespace tint::ast { -Node::Node(ProgramID pid, const Source& src) : program_id(pid), source(src) {} +Node::Node(ProgramID pid, NodeID nid, const Source& src) + : program_id(pid), node_id(nid), source(src) {} Node::Node(Node&&) = default; diff --git a/src/tint/ast/node.h b/src/tint/ast/node.h index 41eeefe609..6eaa1e94f0 100644 --- a/src/tint/ast/node.h +++ b/src/tint/ast/node.h @@ -17,17 +17,9 @@ #include +#include "src/tint/ast/node_id.h" #include "src/tint/clone_context.h" -// Forward declarations -namespace tint { -class CloneContext; -} // namespace tint -namespace tint::sem { -class Type; -class Info; -} // namespace tint::sem - namespace tint::ast { /// AST base class node @@ -38,14 +30,18 @@ class Node : public Castable { /// The identifier of the program that owns this node const ProgramID program_id; + /// The node identifier, unique for the program. + const NodeID node_id; + /// The node source data const Source source; protected: /// Create a new node /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the input source for the node - Node(ProgramID pid, const Source& src); + Node(ProgramID pid, NodeID nid, const Source& src); /// Move constructor Node(Node&&); diff --git a/src/tint/ast/node_id.h b/src/tint/ast/node_id.h new file mode 100644 index 0000000000..79683b0348 --- /dev/null +++ b/src/tint/ast/node_id.h @@ -0,0 +1,36 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_AST_NODE_ID_H_ +#define SRC_TINT_AST_NODE_ID_H_ + +#include + +namespace tint::ast { + +/// NodeID is a unique node identifier for a given Program. +/// NodeIDs are sequentially allocated, starting at 0. +struct NodeID { + /// Equality operator + /// @param other the other NodeID + /// @returns true if the NodeIDs are the same + bool operator==(const NodeID& other) const { return value == other.value; } + + /// The numerical value for the node identifier + size_t value = 0; +}; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_NODE_ID_H_ diff --git a/src/tint/ast/override.cc b/src/tint/ast/override.cc new file mode 100644 index 0000000000..3a0a3a9467 --- /dev/null +++ b/src/tint/ast/override.cc @@ -0,0 +1,58 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/override.h" + +#include + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::ast::Override); + +namespace tint::ast { + +Override::Override(ProgramID pid, + NodeID nid, + const Source& src, + const Symbol& sym, + const ast::Type* ty, + const Expression* ctor, + utils::VectorRef attrs) + : Base(pid, nid, src, sym, ty, ctor, std::move(attrs)) {} + +Override::Override(Override&&) = default; + +Override::~Override() = default; + +const char* Override::Kind() const { + return "override"; +} + +const Override* Override::Clone(CloneContext* ctx) const { + auto src = ctx->Clone(source); + auto sym = ctx->Clone(symbol); + auto* ty = ctx->Clone(type); + auto* ctor = ctx->Clone(constructor); + auto attrs = ctx->Clone(attributes); + return ctx->dst->create(src, sym, ty, ctor, std::move(attrs)); +} + +std::string Override::Identifier(const SymbolTable& symbols) const { + if (auto* id = ast::GetAttribute(attributes)) { + return std::to_string(id->value); + } + return symbols.NameFor(symbol); +} + +} // namespace tint::ast diff --git a/src/tint/ast/override.h b/src/tint/ast/override.h new file mode 100644 index 0000000000..7d01d135e3 --- /dev/null +++ b/src/tint/ast/override.h @@ -0,0 +1,75 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_AST_OVERRIDE_H_ +#define SRC_TINT_AST_OVERRIDE_H_ + +#include + +#include "src/tint/ast/variable.h" + +namespace tint::ast { + +/// An "override" declaration - a name for a pipeline-overridable constant. +/// Examples: +/// +/// ``` +/// override radius : i32 = 2; // Can be overridden by name. +/// @id(5) override width : i32 = 2; // Can be overridden by ID. +/// override scale : f32; // No default - must be overridden. +/// ``` +/// @see https://www.w3.org/TR/WGSL/#override-decls +class Override final : public Castable { + public: + /// Create an 'override' pipeline-overridable constant. + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier + /// @param source the variable source + /// @param sym the variable symbol + /// @param type the declared variable type + /// @param constructor the constructor expression + /// @param attributes the variable attributes + Override(ProgramID pid, + NodeID nid, + const Source& source, + const Symbol& sym, + const ast::Type* type, + const Expression* constructor, + utils::VectorRef attributes); + + /// Move constructor + Override(Override&&); + + /// Destructor + ~Override() override; + + /// @returns "override" + const char* Kind() const override; + + /// Clones this node and all transitive child nodes using the `CloneContext` + /// `ctx`. + /// @param ctx the clone context + /// @return the newly cloned node + const Override* Clone(CloneContext* ctx) const override; + + /// @param symbols the symbol table to retrieve the name from + /// @returns the identifier string for the override. If the override has + /// an ID attribute, the string is the id-stringified. Otherwise, the ID + /// is the symbol. + std::string Identifier(const SymbolTable& symbols) const; +}; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_OVERRIDE_H_ diff --git a/src/tint/ast/override_test.cc b/src/tint/ast/override_test.cc new file mode 100644 index 0000000000..f037601c1b --- /dev/null +++ b/src/tint/ast/override_test.cc @@ -0,0 +1,35 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/override.h" + +#include "src/tint/ast/test_helper.h" + +namespace tint::ast { +namespace { + +using OverrideTest = TestHelper; + +TEST_F(OverrideTest, Identifier_NoId) { + auto* o = Override("o", Expr(f32(1.0))); + EXPECT_EQ(std::string("o"), o->Identifier(Symbols())); +} + +TEST_F(OverrideTest, Identifier_WithId) { + auto* o = Override("o", Expr(f32(1.0)), Id(4u)); + EXPECT_EQ(std::string("4"), o->Identifier(Symbols())); +} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/parameter.cc b/src/tint/ast/parameter.cc new file mode 100644 index 0000000000..01ee3aa6f9 --- /dev/null +++ b/src/tint/ast/parameter.cc @@ -0,0 +1,49 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/parameter.h" + +#include + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::ast::Parameter); + +namespace tint::ast { + +Parameter::Parameter(ProgramID pid, + NodeID nid, + const Source& src, + const Symbol& sym, + const ast::Type* ty, + utils::VectorRef attrs) + : Base(pid, nid, src, sym, ty, nullptr, std::move(attrs)) {} + +Parameter::Parameter(Parameter&&) = default; + +Parameter::~Parameter() = default; + +const char* Parameter::Kind() const { + return "parameter"; +} + +const Parameter* Parameter::Clone(CloneContext* ctx) const { + auto src = ctx->Clone(source); + auto sym = ctx->Clone(symbol); + auto* ty = ctx->Clone(type); + auto attrs = ctx->Clone(attributes); + return ctx->dst->create(src, sym, ty, std::move(attrs)); +} + +} // namespace tint::ast diff --git a/src/tint/ast/parameter.h b/src/tint/ast/parameter.h new file mode 100644 index 0000000000..e9d9f62f23 --- /dev/null +++ b/src/tint/ast/parameter.h @@ -0,0 +1,68 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_AST_PARAMETER_H_ +#define SRC_TINT_AST_PARAMETER_H_ + +#include + +#include "src/tint/ast/variable.h" + +namespace tint::ast { + +/// A formal parameter to a function - a name for a typed value to be passed into a function. +/// Example: +/// +/// ``` +/// fn twice(a: i32) -> i32 { // "a:i32" is the formal parameter +/// return a + a; +/// } +/// ``` +/// +/// @see https://www.w3.org/TR/WGSL/#creation-time-consts +class Parameter final : public Castable { + public: + /// Create a 'parameter' creation-time value variable. + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier + /// @param source the variable source + /// @param sym the variable symbol + /// @param type the declared variable type + /// @param attributes the variable attributes + Parameter(ProgramID pid, + NodeID nid, + const Source& source, + const Symbol& sym, + const ast::Type* type, + utils::VectorRef attributes); + + /// Move constructor + Parameter(Parameter&&); + + /// Destructor + ~Parameter() override; + + /// @returns "parameter" + const char* Kind() const override; + + /// Clones this node and all transitive child nodes using the `CloneContext` + /// `ctx`. + /// @param ctx the clone context + /// @return the newly cloned node + const Parameter* Clone(CloneContext* ctx) const override; +}; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_PARAMETER_H_ diff --git a/src/tint/ast/phony_expression.cc b/src/tint/ast/phony_expression.cc index a3fd4fd946..6bce1bf3a5 100644 --- a/src/tint/ast/phony_expression.cc +++ b/src/tint/ast/phony_expression.cc @@ -20,7 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::PhonyExpression); namespace tint::ast { -PhonyExpression::PhonyExpression(ProgramID pid, const Source& src) : Base(pid, src) {} +PhonyExpression::PhonyExpression(ProgramID pid, NodeID nid, const Source& src) + : Base(pid, nid, src) {} PhonyExpression::PhonyExpression(PhonyExpression&&) = default; diff --git a/src/tint/ast/phony_expression.h b/src/tint/ast/phony_expression.h index 4fc32dd53d..d429a51db2 100644 --- a/src/tint/ast/phony_expression.h +++ b/src/tint/ast/phony_expression.h @@ -25,8 +25,9 @@ class PhonyExpression final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - PhonyExpression(ProgramID pid, const Source& src); + PhonyExpression(ProgramID pid, NodeID nid, const Source& src); /// Move constructor PhonyExpression(PhonyExpression&&); ~PhonyExpression() override; diff --git a/src/tint/ast/pointer.cc b/src/tint/ast/pointer.cc index 42c3fa9e86..796fe8587e 100644 --- a/src/tint/ast/pointer.cc +++ b/src/tint/ast/pointer.cc @@ -21,11 +21,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Pointer); namespace tint::ast { Pointer::Pointer(ProgramID pid, + NodeID nid, const Source& src, const Type* const subtype, ast::StorageClass sc, ast::Access ac) - : Base(pid, src), type(subtype), storage_class(sc), access(ac) {} + : Base(pid, nid, src), type(subtype), storage_class(sc), access(ac) {} std::string Pointer::FriendlyName(const SymbolTable& symbols) const { std::ostringstream out; diff --git a/src/tint/ast/pointer.h b/src/tint/ast/pointer.h index 030e844eb3..61eff88efa 100644 --- a/src/tint/ast/pointer.h +++ b/src/tint/ast/pointer.h @@ -28,11 +28,13 @@ class Pointer final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param subtype the pointee type /// @param storage_class the storage class of the pointer /// @param access the access control of the pointer Pointer(ProgramID pid, + NodeID nid, const Source& src, const Type* const subtype, ast::StorageClass storage_class, diff --git a/src/tint/ast/return_statement.cc b/src/tint/ast/return_statement.cc index 976c063ca4..459bb721fc 100644 --- a/src/tint/ast/return_statement.cc +++ b/src/tint/ast/return_statement.cc @@ -20,11 +20,14 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::ReturnStatement); namespace tint::ast { -ReturnStatement::ReturnStatement(ProgramID pid, const Source& src) - : Base(pid, src), value(nullptr) {} +ReturnStatement::ReturnStatement(ProgramID pid, NodeID nid, const Source& src) + : Base(pid, nid, src), value(nullptr) {} -ReturnStatement::ReturnStatement(ProgramID pid, const Source& src, const Expression* val) - : Base(pid, src), value(val) { +ReturnStatement::ReturnStatement(ProgramID pid, + NodeID nid, + const Source& src, + const Expression* val) + : Base(pid, nid, src), value(val) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, value, program_id); } diff --git a/src/tint/ast/return_statement.h b/src/tint/ast/return_statement.h index 34d8678236..571a738c67 100644 --- a/src/tint/ast/return_statement.h +++ b/src/tint/ast/return_statement.h @@ -25,14 +25,16 @@ class ReturnStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - ReturnStatement(ProgramID pid, const Source& src); + ReturnStatement(ProgramID pid, NodeID nid, const Source& src); /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param value the return value - ReturnStatement(ProgramID pid, const Source& src, const Expression* value); + ReturnStatement(ProgramID pid, NodeID nid, const Source& src, const Expression* value); /// Move constructor ReturnStatement(ReturnStatement&&); ~ReturnStatement() override; diff --git a/src/tint/ast/sampled_texture.cc b/src/tint/ast/sampled_texture.cc index 9c4cea631f..b8dfd61aee 100644 --- a/src/tint/ast/sampled_texture.cc +++ b/src/tint/ast/sampled_texture.cc @@ -20,8 +20,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::SampledTexture); namespace tint::ast { -SampledTexture::SampledTexture(ProgramID pid, const Source& src, TextureDimension d, const Type* ty) - : Base(pid, src, d), type(ty) { +SampledTexture::SampledTexture(ProgramID pid, + NodeID nid, + const Source& src, + TextureDimension d, + const Type* ty) + : Base(pid, nid, src, d), type(ty) { TINT_ASSERT(AST, type); } diff --git a/src/tint/ast/sampled_texture.h b/src/tint/ast/sampled_texture.h index f68fccf57a..1f33af3b6b 100644 --- a/src/tint/ast/sampled_texture.h +++ b/src/tint/ast/sampled_texture.h @@ -26,10 +26,15 @@ class SampledTexture final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param dim the dimensionality of the texture /// @param type the data type of the sampled texture - SampledTexture(ProgramID pid, const Source& src, TextureDimension dim, const Type* type); + SampledTexture(ProgramID pid, + NodeID nid, + const Source& src, + TextureDimension dim, + const Type* type); /// Move constructor SampledTexture(SampledTexture&&); ~SampledTexture() override; diff --git a/src/tint/ast/sampler.cc b/src/tint/ast/sampler.cc index 5d88bf8606..5237380a19 100644 --- a/src/tint/ast/sampler.cc +++ b/src/tint/ast/sampler.cc @@ -32,7 +32,8 @@ std::ostream& operator<<(std::ostream& out, SamplerKind kind) { return out; } -Sampler::Sampler(ProgramID pid, const Source& src, SamplerKind k) : Base(pid, src), kind(k) {} +Sampler::Sampler(ProgramID pid, NodeID nid, const Source& src, SamplerKind k) + : Base(pid, nid, src), kind(k) {} Sampler::Sampler(Sampler&&) = default; diff --git a/src/tint/ast/sampler.h b/src/tint/ast/sampler.h index 067fc38618..bcdf7511f5 100644 --- a/src/tint/ast/sampler.h +++ b/src/tint/ast/sampler.h @@ -39,9 +39,10 @@ class Sampler final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param kind the kind of sampler - Sampler(ProgramID pid, const Source& src, SamplerKind kind); + Sampler(ProgramID pid, NodeID nid, const Source& src, SamplerKind kind); /// Move constructor Sampler(Sampler&&); ~Sampler() override; diff --git a/src/tint/ast/stage_attribute.cc b/src/tint/ast/stage_attribute.cc index 51cfe8c262..c7009509fd 100644 --- a/src/tint/ast/stage_attribute.cc +++ b/src/tint/ast/stage_attribute.cc @@ -22,8 +22,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StageAttribute); namespace tint::ast { -StageAttribute::StageAttribute(ProgramID pid, const Source& src, PipelineStage s) - : Base(pid, src), stage(s) {} +StageAttribute::StageAttribute(ProgramID pid, NodeID nid, const Source& src, PipelineStage s) + : Base(pid, nid, src), stage(s) {} StageAttribute::~StageAttribute() = default; diff --git a/src/tint/ast/stage_attribute.h b/src/tint/ast/stage_attribute.h index a447d1f78c..0bf9d9e932 100644 --- a/src/tint/ast/stage_attribute.h +++ b/src/tint/ast/stage_attribute.h @@ -26,10 +26,11 @@ namespace tint::ast { class StageAttribute final : public Castable { public: /// constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param stage the pipeline stage /// @param source the source of this attribute - StageAttribute(ProgramID program_id, const Source& source, PipelineStage stage); + StageAttribute(ProgramID pid, NodeID nid, const Source& source, PipelineStage stage); ~StageAttribute() override; /// @returns the WGSL name for the attribute diff --git a/src/tint/ast/statement.cc b/src/tint/ast/statement.cc index 12a1cc9406..6acfff31a4 100644 --- a/src/tint/ast/statement.cc +++ b/src/tint/ast/statement.cc @@ -30,7 +30,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Statement); namespace tint::ast { -Statement::Statement(ProgramID pid, const Source& src) : Base(pid, src) {} +Statement::Statement(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} Statement::Statement(Statement&&) = default; diff --git a/src/tint/ast/statement.h b/src/tint/ast/statement.h index 94de247241..616e348120 100644 --- a/src/tint/ast/statement.h +++ b/src/tint/ast/statement.h @@ -32,15 +32,13 @@ class Statement : public Castable { protected: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of the expression - Statement(ProgramID pid, const Source& src); + Statement(ProgramID pid, NodeID nid, const Source& src); /// Move constructor Statement(Statement&&); }; -/// A list of statements -using StatementList = std::vector; - } // namespace tint::ast #endif // SRC_TINT_AST_STATEMENT_H_ diff --git a/src/tint/ast/static_assert.cc b/src/tint/ast/static_assert.cc new file mode 100644 index 0000000000..0609194b88 --- /dev/null +++ b/src/tint/ast/static_assert.cc @@ -0,0 +1,40 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/static_assert.h" + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::ast::StaticAssert); + +namespace tint::ast { + +StaticAssert::StaticAssert(ProgramID pid, NodeID nid, const Source& src, const Expression* cond) + : Base(pid, nid, src), condition(cond) { + TINT_ASSERT(AST, cond); + TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, cond, program_id); +} + +StaticAssert::StaticAssert(StaticAssert&&) = default; + +StaticAssert::~StaticAssert() = default; + +const StaticAssert* StaticAssert::Clone(CloneContext* ctx) const { + // Clone arguments outside of create() call to have deterministic ordering + auto src = ctx->Clone(source); + auto* cond = ctx->Clone(condition); + return ctx->dst->create(src, cond); +} + +} // namespace tint::ast diff --git a/src/tint/ast/static_assert.h b/src/tint/ast/static_assert.h new file mode 100644 index 0000000000..f42ad0707b --- /dev/null +++ b/src/tint/ast/static_assert.h @@ -0,0 +1,50 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_AST_STATIC_ASSERT_H_ +#define SRC_TINT_AST_STATIC_ASSERT_H_ + +#include "src/tint/ast/statement.h" +#include "src/tint/ast/variable.h" + +namespace tint::ast { + +/// A `static_assert` statement +class StaticAssert final : public Castable { + public: + /// Constructor + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier + /// @param source the variable statement source + /// @param condition the assertion condition + StaticAssert(ProgramID pid, NodeID nid, const Source& source, const Expression* condition); + + /// Move constructor + StaticAssert(StaticAssert&&); + + /// Destructor + ~StaticAssert() override; + + /// Clones this node and all transitive child nodes using the `CloneContext` `ctx`. + /// @param ctx the clone context + /// @return the newly cloned node + const StaticAssert* Clone(CloneContext* ctx) const override; + + /// The assertion condition + const Expression* const condition; +}; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_STATIC_ASSERT_H_ diff --git a/src/tint/ast/static_assert_test.cc b/src/tint/ast/static_assert_test.cc new file mode 100644 index 0000000000..48bee48141 --- /dev/null +++ b/src/tint/ast/static_assert_test.cc @@ -0,0 +1,66 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/static_assert.h" + +#include "gtest/gtest-spi.h" +#include "src/tint/ast/test_helper.h" + +namespace tint::ast { +namespace { + +using StaticAssertTest = TestHelper; + +TEST_F(StaticAssertTest, Creation) { + auto* cond = Expr(true); + auto* stmt = StaticAssert(cond); + EXPECT_EQ(stmt->condition, cond); +} + +TEST_F(StaticAssertTest, Creation_WithSource) { + auto* cond = Expr(true); + auto* stmt = StaticAssert(Source{{20, 2}}, cond); + auto src = stmt->source; + EXPECT_EQ(src.range.begin.line, 20u); + EXPECT_EQ(src.range.begin.column, 2u); +} + +TEST_F(StaticAssertTest, IsStaticAssert) { + auto* cond = Expr(true); + + auto* stmt = StaticAssert(cond); + EXPECT_TRUE(stmt->Is()); +} + +TEST_F(StaticAssertTest, Assert_Null_Condition) { + EXPECT_FATAL_FAILURE( + { + ProgramBuilder b; + b.StaticAssert(nullptr); + }, + "internal compiler error"); +} + +TEST_F(StaticAssertTest, Assert_DifferentProgramID_Condition) { + EXPECT_FATAL_FAILURE( + { + ProgramBuilder b1; + ProgramBuilder b2; + b1.StaticAssert(b2.Expr(i32(123))); + }, + "internal compiler error"); +} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/storage_class.cc b/src/tint/ast/storage_class.cc index 31612717d6..450067b950 100644 --- a/src/tint/ast/storage_class.cc +++ b/src/tint/ast/storage_class.cc @@ -12,38 +12,69 @@ // See the License for the specific language governing permissions and // limitations under the License. +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/storage_class.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + #include "src/tint/ast/storage_class.h" namespace tint::ast { -const char* ToString(StorageClass sc) { - switch (sc) { - case StorageClass::kInvalid: - return "invalid"; - case StorageClass::kNone: - return "none"; - case StorageClass::kInput: - return "in"; - case StorageClass::kOutput: - return "out"; - case StorageClass::kUniform: - return "uniform"; - case StorageClass::kWorkgroup: - return "workgroup"; - case StorageClass::kHandle: - return "handle"; - case StorageClass::kStorage: - return "storage"; - case StorageClass::kPrivate: - return "private"; - case StorageClass::kFunction: - return "function"; +/// ParseStorageClass parses a StorageClass from a string. +/// @param str the string to parse +/// @returns the parsed enum, or StorageClass::kInvalid if the string could not be parsed. +StorageClass ParseStorageClass(std::string_view str) { + if (str == "function") { + return StorageClass::kFunction; } - return ""; + if (str == "private") { + return StorageClass::kPrivate; + } + if (str == "workgroup") { + return StorageClass::kWorkgroup; + } + if (str == "uniform") { + return StorageClass::kUniform; + } + if (str == "storage") { + return StorageClass::kStorage; + } + if (str == "push_constant") { + return StorageClass::kPushConstant; + } + return StorageClass::kInvalid; } -std::ostream& operator<<(std::ostream& out, StorageClass sc) { - out << ToString(sc); - return out; + +std::ostream& operator<<(std::ostream& out, StorageClass value) { + switch (value) { + case StorageClass::kInvalid: + return out << "invalid"; + case StorageClass::kNone: + return out << "none"; + case StorageClass::kFunction: + return out << "function"; + case StorageClass::kPrivate: + return out << "private"; + case StorageClass::kWorkgroup: + return out << "workgroup"; + case StorageClass::kUniform: + return out << "uniform"; + case StorageClass::kStorage: + return out << "storage"; + case StorageClass::kPushConstant: + return out << "push_constant"; + case StorageClass::kHandle: + return out << "handle"; + case StorageClass::kIn: + return out << "in"; + case StorageClass::kOut: + return out << "out"; + } + return out << ""; } } // namespace tint::ast diff --git a/src/tint/ast/storage_class.cc.tmpl b/src/tint/ast/storage_class.cc.tmpl new file mode 100644 index 0000000000..e2903b7ea2 --- /dev/null +++ b/src/tint/ast/storage_class.cc.tmpl @@ -0,0 +1,25 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate storage_class.cc + +To update the generated file, run: + ./tools/run gen + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "storage_class") -}} + +#include "src/tint/ast/storage_class.h" + +namespace tint::ast { + +{{ Eval "ParseEnum" $enum}} + +{{ Eval "EnumOStream" $enum}} + +} // namespace tint::ast diff --git a/src/tint/ast/storage_class.h b/src/tint/ast/storage_class.h index d4e64792d0..43e41e165b 100644 --- a/src/tint/ast/storage_class.h +++ b/src/tint/ast/storage_class.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Tint Authors. +// Copyright 2022 The Tint Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,6 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/storage_class.h.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + #ifndef SRC_TINT_AST_STORAGE_CLASS_H_ #define SRC_TINT_AST_STORAGE_CLASS_H_ @@ -21,34 +29,37 @@ namespace tint::ast { /// Storage class of a given pointer. enum class StorageClass { - kInvalid = -1, - kNone, - kInput, - kOutput, - kUniform, - kWorkgroup, - kHandle, - kStorage, + kInvalid, + kNone, // Tint-internal enum entry - not parsed + kFunction, kPrivate, - kFunction + kWorkgroup, + kUniform, + kStorage, + kPushConstant, + kHandle, // Tint-internal enum entry - not parsed + kIn, // Tint-internal enum entry - not parsed + kOut, // Tint-internal enum entry - not parsed }; +/// @param out the std::ostream to write to +/// @param value the StorageClass +/// @returns `out` so calls can be chained +std::ostream& operator<<(std::ostream& out, StorageClass value); + +/// ParseStorageClass parses a StorageClass from a string. +/// @param str the string to parse +/// @returns the parsed enum, or StorageClass::kInvalid if the string could not be parsed. +StorageClass ParseStorageClass(std::string_view str); + /// @returns true if the StorageClass is host-shareable /// @param sc the StorageClass /// @see https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable inline bool IsHostShareable(StorageClass sc) { - return sc == ast::StorageClass::kUniform || sc == ast::StorageClass::kStorage; + return sc == ast::StorageClass::kUniform || sc == ast::StorageClass::kStorage || + sc == ast::StorageClass::kPushConstant; } -/// @param sc the StorageClass -/// @return the name of the given storage class -const char* ToString(StorageClass sc); - -/// @param out the std::ostream to write to -/// @param sc the StorageClass -/// @return the std::ostream so calls can be chained -std::ostream& operator<<(std::ostream& out, StorageClass sc); - } // namespace tint::ast #endif // SRC_TINT_AST_STORAGE_CLASS_H_ diff --git a/src/tint/ast/storage_class.h.tmpl b/src/tint/ast/storage_class.h.tmpl new file mode 100644 index 0000000000..c21d6f6034 --- /dev/null +++ b/src/tint/ast/storage_class.h.tmpl @@ -0,0 +1,37 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate storage_class.h + +To update the generated file, run: + ./tools/run gen + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "storage_class") -}} + +#ifndef SRC_TINT_AST_STORAGE_CLASS_H_ +#define SRC_TINT_AST_STORAGE_CLASS_H_ + +#include + +namespace tint::ast { + +/// Storage class of a given pointer. +{{ Eval "DeclareEnum" $enum}} + +/// @returns true if the StorageClass is host-shareable +/// @param sc the StorageClass +/// @see https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable +inline bool IsHostShareable(StorageClass sc) { + return sc == ast::StorageClass::kUniform || sc == ast::StorageClass::kStorage || + sc == ast::StorageClass::kPushConstant; +} + +} // namespace tint::ast + +#endif // SRC_TINT_AST_STORAGE_CLASS_H_ diff --git a/src/tint/ast/storage_class_bench.cc b/src/tint/ast/storage_class_bench.cc new file mode 100644 index 0000000000..00095c2a62 --- /dev/null +++ b/src/tint/ast/storage_class_bench.cc @@ -0,0 +1,88 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/storage_class_bench.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/storage_class.h" + +#include + +#include "benchmark/benchmark.h" + +namespace tint::ast { +namespace { + +void StorageClassParser(::benchmark::State& state) { + std::array kStrings{ + "fccnctin", + "ucti3", + "functVon", + "function", + "1unction", + "unJtqqon", + "llun77tion", + "ppqqivtHH", + "prcv", + "bivaGe", + "private", + "priviive", + "8WWivate", + "pxxvate", + "wXkgrggup", + "worXVup", + "3orkgroup", + "workgroup", + "workgroEp", + "woTTPkroup", + "ddorkroxxp", + "u44iform", + "unSSfoVVm", + "RniR22m", + "uniform", + "uFfo9m", + "uniorm", + "VOORRHrm", + "straye", + "llntrrr77ge", + "stor4g00", + "storage", + "trooe", + "zzrage", + "siioppa1", + "puXXh_constant", + "pusII9_nn55nstant", + "YusHH_coaastSSrnt", + "push_constant", + "pushonkkHan", + "jush_consgRt", + "puh_cobsant", + }; + for (auto _ : state) { + for (auto& str : kStrings) { + auto result = ParseStorageClass(str); + benchmark::DoNotOptimize(result); + } + } +} + +BENCHMARK(StorageClassParser); + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/storage_class_bench.cc.tmpl b/src/tint/ast/storage_class_bench.cc.tmpl new file mode 100644 index 0000000000..d9ea8cb0b2 --- /dev/null +++ b/src/tint/ast/storage_class_bench.cc.tmpl @@ -0,0 +1,29 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate storage_class_bench.cc + +To update the generated file, run: + ./tools/run gen + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "storage_class") -}} + +#include "src/tint/ast/storage_class.h" + +#include + +#include "benchmark/benchmark.h" + +namespace tint::ast { +namespace { + +{{ Eval "BenchmarkParseEnum" $enum }} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/storage_class_test.cc b/src/tint/ast/storage_class_test.cc new file mode 100644 index 0000000000..1d12d45997 --- /dev/null +++ b/src/tint/ast/storage_class_test.cc @@ -0,0 +1,86 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/storage_class_test.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/storage_class.h" + +#include + +#include "src/tint/ast/test_helper.h" +#include "src/tint/utils/string.h" + +namespace tint::ast { +namespace { + +namespace parse_print_tests { + +struct Case { + const char* string; + StorageClass value; +}; + +inline std::ostream& operator<<(std::ostream& out, Case c) { + return out << "'" << std::string(c.string) << "'"; +} + +static constexpr Case kValidCases[] = { + {"function", StorageClass::kFunction}, {"private", StorageClass::kPrivate}, + {"workgroup", StorageClass::kWorkgroup}, {"uniform", StorageClass::kUniform}, + {"storage", StorageClass::kStorage}, {"push_constant", StorageClass::kPushConstant}, +}; + +static constexpr Case kInvalidCases[] = { + {"fccnctin", StorageClass::kInvalid}, {"ucti3", StorageClass::kInvalid}, + {"functVon", StorageClass::kInvalid}, {"priv1te", StorageClass::kInvalid}, + {"pqiJate", StorageClass::kInvalid}, {"privat7ll", StorageClass::kInvalid}, + {"workroppqHH", StorageClass::kInvalid}, {"workru", StorageClass::kInvalid}, + {"wbkgGoup", StorageClass::kInvalid}, {"unifiivm", StorageClass::kInvalid}, + {"8WWiform", StorageClass::kInvalid}, {"uxxform", StorageClass::kInvalid}, + {"sXraggg", StorageClass::kInvalid}, {"traXe", StorageClass::kInvalid}, + {"stor3ge", StorageClass::kInvalid}, {"push_constanE", StorageClass::kInvalid}, + {"push_TTPnstant", StorageClass::kInvalid}, {"puxxdh_constan", StorageClass::kInvalid}, +}; + +using StorageClassParseTest = testing::TestWithParam; + +TEST_P(StorageClassParseTest, Parse) { + const char* string = GetParam().string; + StorageClass expect = GetParam().value; + EXPECT_EQ(expect, ParseStorageClass(string)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, StorageClassParseTest, testing::ValuesIn(kValidCases)); +INSTANTIATE_TEST_SUITE_P(InvalidCases, StorageClassParseTest, testing::ValuesIn(kInvalidCases)); + +using StorageClassPrintTest = testing::TestWithParam; + +TEST_P(StorageClassPrintTest, Print) { + StorageClass value = GetParam().value; + const char* expect = GetParam().string; + EXPECT_EQ(expect, utils::ToString(value)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, StorageClassPrintTest, testing::ValuesIn(kValidCases)); + +} // namespace parse_print_tests + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/storage_class_test.cc.tmpl b/src/tint/ast/storage_class_test.cc.tmpl new file mode 100644 index 0000000000..3696aab3cb --- /dev/null +++ b/src/tint/ast/storage_class_test.cc.tmpl @@ -0,0 +1,30 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate storage_class_test.cc + +To update the generated file, run: + ./tools/run gen + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "storage_class") -}} + +#include "src/tint/ast/storage_class.h" + +#include + +#include "src/tint/ast/test_helper.h" +#include "src/tint/utils/string.h" + +namespace tint::ast { +namespace { + +{{ Eval "TestParsePrintEnum" $enum}} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/storage_texture.cc b/src/tint/ast/storage_texture.cc index ccc250d9fb..9c223c3336 100644 --- a/src/tint/ast/storage_texture.cc +++ b/src/tint/ast/storage_texture.cc @@ -23,72 +23,14 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StorageTexture); namespace tint::ast { -// Note, these names match the names in the WGSL spec. This behaviour is used -// in the WGSL writer to emit the texture format names. -std::ostream& operator<<(std::ostream& out, TexelFormat format) { - switch (format) { - case TexelFormat::kNone: - out << "none"; - break; - case TexelFormat::kR32Uint: - out << "r32uint"; - break; - case TexelFormat::kR32Sint: - out << "r32sint"; - break; - case TexelFormat::kR32Float: - out << "r32float"; - break; - case TexelFormat::kRgba8Unorm: - out << "rgba8unorm"; - break; - case TexelFormat::kRgba8Snorm: - out << "rgba8snorm"; - break; - case TexelFormat::kRgba8Uint: - out << "rgba8uint"; - break; - case TexelFormat::kRgba8Sint: - out << "rgba8sint"; - break; - case TexelFormat::kRg32Uint: - out << "rg32uint"; - break; - case TexelFormat::kRg32Sint: - out << "rg32sint"; - break; - case TexelFormat::kRg32Float: - out << "rg32float"; - break; - case TexelFormat::kRgba16Uint: - out << "rgba16uint"; - break; - case TexelFormat::kRgba16Sint: - out << "rgba16sint"; - break; - case TexelFormat::kRgba16Float: - out << "rgba16float"; - break; - case TexelFormat::kRgba32Uint: - out << "rgba32uint"; - break; - case TexelFormat::kRgba32Sint: - out << "rgba32sint"; - break; - case TexelFormat::kRgba32Float: - out << "rgba32float"; - break; - } - return out; -} - StorageTexture::StorageTexture(ProgramID pid, + NodeID nid, const Source& src, TextureDimension d, TexelFormat fmt, const Type* subtype, Access ac) - : Base(pid, src, d), format(fmt), type(subtype), access(ac) {} + : Base(pid, nid, src, d), format(fmt), type(subtype), access(ac) {} StorageTexture::StorageTexture(StorageTexture&&) = default; @@ -134,7 +76,7 @@ Type* StorageTexture::SubtypeFor(TexelFormat format, ProgramBuilder& builder) { return builder.create(); } - case TexelFormat::kNone: + case TexelFormat::kInvalid: break; } diff --git a/src/tint/ast/storage_texture.h b/src/tint/ast/storage_texture.h index 3cf779e244..9ae7b95416 100644 --- a/src/tint/ast/storage_texture.h +++ b/src/tint/ast/storage_texture.h @@ -18,47 +18,24 @@ #include #include "src/tint/ast/access.h" +#include "src/tint/ast/texel_format.h" #include "src/tint/ast/texture.h" namespace tint::ast { -/// The texel format in the storage texture -enum class TexelFormat { - kNone = -1, - kRgba8Unorm, - kRgba8Snorm, - kRgba8Uint, - kRgba8Sint, - kRgba16Uint, - kRgba16Sint, - kRgba16Float, - kR32Uint, - kR32Sint, - kR32Float, - kRg32Uint, - kRg32Sint, - kRg32Float, - kRgba32Uint, - kRgba32Sint, - kRgba32Float, -}; - -/// @param out the std::ostream to write to -/// @param format the TexelFormat -/// @return the std::ostream so calls can be chained -std::ostream& operator<<(std::ostream& out, TexelFormat format); - /// A storage texture type. class StorageTexture final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param dim the dimensionality of the texture /// @param format the image format of the texture /// @param subtype the storage subtype. Use SubtypeFor() to calculate this. /// @param access_control the access control for the texture. StorageTexture(ProgramID pid, + NodeID nid, const Source& src, TextureDimension dim, TexelFormat format, diff --git a/src/tint/ast/stride_attribute.cc b/src/tint/ast/stride_attribute.cc index 14a0733319..408ee44176 100644 --- a/src/tint/ast/stride_attribute.cc +++ b/src/tint/ast/stride_attribute.cc @@ -22,8 +22,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StrideAttribute); namespace tint::ast { -StrideAttribute::StrideAttribute(ProgramID pid, const Source& src, uint32_t s) - : Base(pid, src), stride(s) {} +StrideAttribute::StrideAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t s) + : Base(pid, nid, src), stride(s) {} StrideAttribute::~StrideAttribute() = default; diff --git a/src/tint/ast/stride_attribute.h b/src/tint/ast/stride_attribute.h index 4315f21748..90146774d1 100644 --- a/src/tint/ast/stride_attribute.h +++ b/src/tint/ast/stride_attribute.h @@ -28,9 +28,10 @@ class StrideAttribute final : public Castable { public: /// constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param stride the stride value - StrideAttribute(ProgramID pid, const Source& src, uint32_t stride); + StrideAttribute(ProgramID pid, NodeID nid, const Source& src, uint32_t stride); ~StrideAttribute() override; /// @returns the WGSL name for the attribute diff --git a/src/tint/ast/stride_attribute_test.cc b/src/tint/ast/stride_attribute_test.cc index 61c4fb5dad..eb190341c6 100644 --- a/src/tint/ast/stride_attribute_test.cc +++ b/src/tint/ast/stride_attribute_test.cc @@ -20,13 +20,13 @@ namespace { using StrideAttributeTest = TestHelper; TEST_F(StrideAttributeTest, Creation) { - auto* d = create(2); + auto* d = create(2u); EXPECT_EQ(2u, d->stride); } TEST_F(StrideAttributeTest, Source) { auto* d = create( - Source{Source::Range{Source::Location{1, 2}, Source::Location{3, 4}}}, 2); + Source{Source::Range{Source::Location{1, 2}, Source::Location{3, 4}}}, 2u); EXPECT_EQ(d->source.range.begin.line, 1u); EXPECT_EQ(d->source.range.begin.column, 2u); EXPECT_EQ(d->source.range.end.line, 3u); diff --git a/src/tint/ast/struct.cc b/src/tint/ast/struct.cc index 19a30de926..c2d9002e72 100644 --- a/src/tint/ast/struct.cc +++ b/src/tint/ast/struct.cc @@ -22,8 +22,13 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Struct); namespace tint::ast { -Struct::Struct(ProgramID pid, const Source& src, Symbol n, StructMemberList m, AttributeList attrs) - : Base(pid, src, n), members(std::move(m)), attributes(std::move(attrs)) { +Struct::Struct(ProgramID pid, + NodeID nid, + const Source& src, + Symbol n, + utils::VectorRef m, + utils::VectorRef attrs) + : Base(pid, nid, src, n), members(std::move(m)), attributes(std::move(attrs)) { for (auto* mem : members) { TINT_ASSERT(AST, mem); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, mem, program_id); @@ -44,7 +49,7 @@ const Struct* Struct::Clone(CloneContext* ctx) const { auto n = ctx->Clone(name); auto mem = ctx->Clone(members); auto attrs = ctx->Clone(attributes); - return ctx->dst->create(src, n, mem, attrs); + return ctx->dst->create(src, n, std::move(mem), std::move(attrs)); } } // namespace tint::ast diff --git a/src/tint/ast/struct.h b/src/tint/ast/struct.h index 5c28b4cd3a..3e3e5cf17c 100644 --- a/src/tint/ast/struct.h +++ b/src/tint/ast/struct.h @@ -21,6 +21,7 @@ #include "src/tint/ast/attribute.h" #include "src/tint/ast/struct_member.h" #include "src/tint/ast/type_decl.h" +#include "src/tint/utils/vector.h" namespace tint::ast { @@ -29,15 +30,17 @@ class Struct final : public Castable { public: /// Create a new struct statement /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node for the import statement /// @param name The name of the structure /// @param members The struct members /// @param attributes The struct attributes Struct(ProgramID pid, + NodeID nid, const Source& src, Symbol name, - StructMemberList members, - AttributeList attributes); + utils::VectorRef members, + utils::VectorRef attributes); /// Move constructor Struct(Struct&&); @@ -50,10 +53,10 @@ class Struct final : public Castable { const Struct* Clone(CloneContext* ctx) const override; /// The members - const StructMemberList members; + const utils::Vector members; /// The struct attributes - const AttributeList attributes; + const utils::Vector attributes; }; } // namespace tint::ast diff --git a/src/tint/ast/struct_member.cc b/src/tint/ast/struct_member.cc index 611348420d..22de044456 100644 --- a/src/tint/ast/struct_member.cc +++ b/src/tint/ast/struct_member.cc @@ -21,11 +21,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StructMember); namespace tint::ast { StructMember::StructMember(ProgramID pid, + NodeID nid, const Source& src, const Symbol& sym, const ast::Type* ty, - AttributeList attrs) - : Base(pid, src), symbol(sym), type(ty), attributes(std::move(attrs)) { + utils::VectorRef attrs) + : Base(pid, nid, src), symbol(sym), type(ty), attributes(std::move(attrs)) { TINT_ASSERT(AST, type); TINT_ASSERT(AST, symbol.IsValid()); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, symbol, program_id); @@ -45,7 +46,7 @@ const StructMember* StructMember::Clone(CloneContext* ctx) const { auto sym = ctx->Clone(symbol); auto* ty = ctx->Clone(type); auto attrs = ctx->Clone(attributes); - return ctx->dst->create(src, sym, ty, attrs); + return ctx->dst->create(src, sym, ty, std::move(attrs)); } } // namespace tint::ast diff --git a/src/tint/ast/struct_member.h b/src/tint/ast/struct_member.h index 022a34cafe..fc616d74c4 100644 --- a/src/tint/ast/struct_member.h +++ b/src/tint/ast/struct_member.h @@ -16,7 +16,6 @@ #define SRC_TINT_AST_STRUCT_MEMBER_H_ #include -#include #include "src/tint/ast/attribute.h" @@ -32,15 +31,17 @@ class StructMember final : public Castable { public: /// Create a new struct member statement /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node for the struct member statement /// @param sym The struct member symbol /// @param type The struct member type /// @param attributes The struct member attributes StructMember(ProgramID pid, + NodeID nid, const Source& src, const Symbol& sym, const ast::Type* type, - AttributeList attributes); + utils::VectorRef attributes); /// Move constructor StructMember(StructMember&&); @@ -59,12 +60,9 @@ class StructMember final : public Castable { const ast::Type* const type; /// The attributes - const AttributeList attributes; + const utils::Vector attributes; }; -/// A list of struct members -using StructMemberList = std::vector; - } // namespace tint::ast #endif // SRC_TINT_AST_STRUCT_MEMBER_H_ diff --git a/src/tint/ast/struct_member_align_attribute.cc b/src/tint/ast/struct_member_align_attribute.cc index f586e7eea7..e188e7bdc9 100644 --- a/src/tint/ast/struct_member_align_attribute.cc +++ b/src/tint/ast/struct_member_align_attribute.cc @@ -23,8 +23,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StructMemberAlignAttribute); namespace tint::ast { -StructMemberAlignAttribute::StructMemberAlignAttribute(ProgramID pid, const Source& src, uint32_t a) - : Base(pid, src), align(a) {} +StructMemberAlignAttribute::StructMemberAlignAttribute(ProgramID pid, + NodeID nid, + const Source& src, + const ast::Expression* a) + : Base(pid, nid, src), align(a) {} StructMemberAlignAttribute::~StructMemberAlignAttribute() = default; @@ -35,7 +38,8 @@ std::string StructMemberAlignAttribute::Name() const { const StructMemberAlignAttribute* StructMemberAlignAttribute::Clone(CloneContext* ctx) const { // Clone arguments outside of create() call to have deterministic ordering auto src = ctx->Clone(source); - return ctx->dst->create(src, align); + auto* align_ = ctx->Clone(align); + return ctx->dst->create(src, align_); } } // namespace tint::ast diff --git a/src/tint/ast/struct_member_align_attribute.h b/src/tint/ast/struct_member_align_attribute.h index 10a6507d47..2043b01cba 100644 --- a/src/tint/ast/struct_member_align_attribute.h +++ b/src/tint/ast/struct_member_align_attribute.h @@ -19,6 +19,7 @@ #include #include "src/tint/ast/attribute.h" +#include "src/tint/ast/expression.h" namespace tint::ast { @@ -27,9 +28,13 @@ class StructMemberAlignAttribute final : public Castable(2); - EXPECT_EQ(2u, d->align); + auto* val = Expr("ident"); + auto* d = create(val); + EXPECT_EQ(val, d->align); + EXPECT_TRUE(d->align->Is()); } } // namespace diff --git a/src/tint/ast/struct_member_offset_attribute.cc b/src/tint/ast/struct_member_offset_attribute.cc index 0a33127bf9..48d73336b3 100644 --- a/src/tint/ast/struct_member_offset_attribute.cc +++ b/src/tint/ast/struct_member_offset_attribute.cc @@ -23,9 +23,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StructMemberOffsetAttribute); namespace tint::ast { StructMemberOffsetAttribute::StructMemberOffsetAttribute(ProgramID pid, + NodeID nid, const Source& src, uint32_t o) - : Base(pid, src), offset(o) {} + : Base(pid, nid, src), offset(o) {} StructMemberOffsetAttribute::~StructMemberOffsetAttribute() = default; diff --git a/src/tint/ast/struct_member_offset_attribute.h b/src/tint/ast/struct_member_offset_attribute.h index 92cc68ec1d..790927eaa8 100644 --- a/src/tint/ast/struct_member_offset_attribute.h +++ b/src/tint/ast/struct_member_offset_attribute.h @@ -35,9 +35,10 @@ class StructMemberOffsetAttribute final : public Castable(2); + auto* d = create(2u); EXPECT_EQ(2u, d->offset); } diff --git a/src/tint/ast/struct_member_size_attribute.cc b/src/tint/ast/struct_member_size_attribute.cc index a7f291b63a..391907877d 100644 --- a/src/tint/ast/struct_member_size_attribute.cc +++ b/src/tint/ast/struct_member_size_attribute.cc @@ -23,8 +23,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::StructMemberSizeAttribute); namespace tint::ast { -StructMemberSizeAttribute::StructMemberSizeAttribute(ProgramID pid, const Source& src, uint32_t sz) - : Base(pid, src), size(sz) {} +StructMemberSizeAttribute::StructMemberSizeAttribute(ProgramID pid, + NodeID nid, + const Source& src, + uint32_t sz) + : Base(pid, nid, src), size(sz) {} StructMemberSizeAttribute::~StructMemberSizeAttribute() = default; diff --git a/src/tint/ast/struct_member_size_attribute.h b/src/tint/ast/struct_member_size_attribute.h index 0c4ddd6c05..5649e2eaa3 100644 --- a/src/tint/ast/struct_member_size_attribute.h +++ b/src/tint/ast/struct_member_size_attribute.h @@ -27,9 +27,10 @@ class StructMemberSizeAttribute final : public Castable(2); + auto* d = create(2u); EXPECT_EQ(2u, d->size); } diff --git a/src/tint/ast/struct_member_test.cc b/src/tint/ast/struct_member_test.cc index cec82ae03b..69772f4e14 100644 --- a/src/tint/ast/struct_member_test.cc +++ b/src/tint/ast/struct_member_test.cc @@ -21,10 +21,10 @@ namespace { using StructMemberTest = TestHelper; TEST_F(StructMemberTest, Creation) { - auto* st = Member("a", ty.i32(), {MemberSize(4)}); + auto* st = Member("a", ty.i32(), utils::Vector{MemberSize(4)}); EXPECT_EQ(st->symbol, Symbol(1, ID())); EXPECT_TRUE(st->type->Is()); - EXPECT_EQ(st->attributes.size(), 1u); + EXPECT_EQ(st->attributes.Length(), 1u); EXPECT_TRUE(st->attributes[0]->Is()); EXPECT_EQ(st->source.range.begin.line, 0u); EXPECT_EQ(st->source.range.begin.column, 0u); @@ -37,7 +37,7 @@ TEST_F(StructMemberTest, CreationWithSource) { ty.i32()); EXPECT_EQ(st->symbol, Symbol(1, ID())); EXPECT_TRUE(st->type->Is()); - EXPECT_EQ(st->attributes.size(), 0u); + EXPECT_EQ(st->attributes.Length(), 0u); EXPECT_EQ(st->source.range.begin.line, 27u); EXPECT_EQ(st->source.range.begin.column, 4u); EXPECT_EQ(st->source.range.end.line, 27u); @@ -66,7 +66,7 @@ TEST_F(StructMemberTest, Assert_Null_Attribute) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.Member("a", b.ty.i32(), {b.MemberSize(4), nullptr}); + b.Member("a", b.ty.i32(), utils::Vector{b.MemberSize(4), nullptr}); }, "internal compiler error"); } @@ -76,7 +76,7 @@ TEST_F(StructMemberTest, Assert_DifferentProgramID_Symbol) { { ProgramBuilder b1; ProgramBuilder b2; - b1.Member(b2.Sym("a"), b1.ty.i32(), {b1.MemberSize(4)}); + b1.Member(b2.Sym("a"), b1.ty.i32(), utils::Vector{b1.MemberSize(4)}); }, "internal compiler error"); } @@ -86,7 +86,7 @@ TEST_F(StructMemberTest, Assert_DifferentProgramID_Attribute) { { ProgramBuilder b1; ProgramBuilder b2; - b1.Member("a", b1.ty.i32(), {b2.MemberSize(4)}); + b1.Member("a", b1.ty.i32(), utils::Vector{b2.MemberSize(4)}); }, "internal compiler error"); } diff --git a/src/tint/ast/struct_test.cc b/src/tint/ast/struct_test.cc index 895d501e5d..53ec9c8c6c 100644 --- a/src/tint/ast/struct_test.cc +++ b/src/tint/ast/struct_test.cc @@ -36,10 +36,10 @@ using SpirvBlockAttribute = transform::AddSpirvBlockAttribute::SpirvBlockAttribu TEST_F(AstStructTest, Creation) { auto name = Sym("s"); - auto* s = create(name, StructMemberList{Member("a", ty.i32())}, AttributeList{}); + auto* s = create(name, utils::Vector{Member("a", ty.i32())}, utils::Empty); EXPECT_EQ(s->name, name); - EXPECT_EQ(s->members.size(), 1u); - EXPECT_TRUE(s->attributes.empty()); + EXPECT_EQ(s->members.Length(), 1u); + EXPECT_TRUE(s->attributes.IsEmpty()); EXPECT_EQ(s->source.range.begin.line, 0u); EXPECT_EQ(s->source.range.begin.column, 0u); EXPECT_EQ(s->source.range.end.line, 0u); @@ -48,13 +48,14 @@ TEST_F(AstStructTest, Creation) { TEST_F(AstStructTest, Creation_WithAttributes) { auto name = Sym("s"); - AttributeList attrs; - attrs.push_back(ASTNodes().Create(ID())); - auto* s = create(name, StructMemberList{Member("a", ty.i32())}, attrs); + auto* s = create(name, utils::Vector{Member("a", ty.i32())}, + utils::Vector{ + ASTNodes().Create(ID(), AllocateNodeID()), + }); EXPECT_EQ(s->name, name); - EXPECT_EQ(s->members.size(), 1u); - ASSERT_EQ(s->attributes.size(), 1u); + EXPECT_EQ(s->members.Length(), 1u); + ASSERT_EQ(s->attributes.Length(), 1u); EXPECT_TRUE(s->attributes[0]->Is()); EXPECT_EQ(s->source.range.begin.line, 0u); EXPECT_EQ(s->source.range.begin.column, 0u); @@ -64,13 +65,13 @@ TEST_F(AstStructTest, Creation_WithAttributes) { TEST_F(AstStructTest, CreationWithSourceAndAttributes) { auto name = Sym("s"); - auto* s = - create(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 8}}}, - name, StructMemberList{Member("a", ty.i32())}, - AttributeList{ASTNodes().Create(ID())}); + auto* s = create( + Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 8}}}, name, + utils::Vector{Member("a", ty.i32())}, + utils::Vector{ASTNodes().Create(ID(), AllocateNodeID())}); EXPECT_EQ(s->name, name); - EXPECT_EQ(s->members.size(), 1u); - ASSERT_EQ(s->attributes.size(), 1u); + EXPECT_EQ(s->members.Length(), 1u); + ASSERT_EQ(s->attributes.Length(), 1u); EXPECT_TRUE(s->attributes[0]->Is()); EXPECT_EQ(s->source.range.begin.line, 27u); EXPECT_EQ(s->source.range.begin.column, 4u); @@ -82,8 +83,8 @@ TEST_F(AstStructTest, Assert_Null_StructMember) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.create(b.Sym("S"), StructMemberList{b.Member("a", b.ty.i32()), nullptr}, - AttributeList{}); + b.create(b.Sym("S"), utils::Vector{b.Member("a", b.ty.i32()), nullptr}, + utils::Empty); }, "internal compiler error"); } @@ -92,8 +93,8 @@ TEST_F(AstStructTest, Assert_Null_Attribute) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.create(b.Sym("S"), StructMemberList{b.Member("a", b.ty.i32())}, - AttributeList{nullptr}); + b.create(b.Sym("S"), utils::Vector{b.Member("a", b.ty.i32())}, + utils::Vector{nullptr}); }, "internal compiler error"); } @@ -103,8 +104,8 @@ TEST_F(AstStructTest, Assert_DifferentProgramID_StructMember) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(b1.Sym("S"), StructMemberList{b2.Member("a", b2.ty.i32())}, - AttributeList{}); + b1.create(b1.Sym("S"), utils::Vector{b2.Member("a", b2.ty.i32())}, + utils::Empty); }, "internal compiler error"); } @@ -114,8 +115,9 @@ TEST_F(AstStructTest, Assert_DifferentProgramID_Attribute) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(b1.Sym("S"), StructMemberList{b1.Member("a", b1.ty.i32())}, - AttributeList{b2.ASTNodes().Create(b2.ID())}); + b1.create(b1.Sym("S"), utils::Vector{b1.Member("a", b1.ty.i32())}, + utils::Vector{b2.ASTNodes().Create( + b2.ID(), b2.AllocateNodeID())}); }, "internal compiler error"); } diff --git a/src/tint/ast/switch_statement.cc b/src/tint/ast/switch_statement.cc index 08095a109c..1cdf8a4ea0 100644 --- a/src/tint/ast/switch_statement.cc +++ b/src/tint/ast/switch_statement.cc @@ -14,6 +14,8 @@ #include "src/tint/ast/switch_statement.h" +#include + #include "src/tint/program_builder.h" TINT_INSTANTIATE_TYPEINFO(tint::ast::SwitchStatement); @@ -21,10 +23,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::SwitchStatement); namespace tint::ast { SwitchStatement::SwitchStatement(ProgramID pid, + NodeID nid, const Source& src, const Expression* cond, - CaseStatementList b) - : Base(pid, src), condition(cond), body(b) { + utils::VectorRef b) + : Base(pid, nid, src), condition(cond), body(std::move(b)) { TINT_ASSERT(AST, condition); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, condition, program_id); for (auto* stmt : body) { @@ -42,7 +45,7 @@ const SwitchStatement* SwitchStatement::Clone(CloneContext* ctx) const { auto src = ctx->Clone(source); auto* cond = ctx->Clone(condition); auto b = ctx->Clone(body); - return ctx->dst->create(src, cond, b); + return ctx->dst->create(src, cond, std::move(b)); } } // namespace tint::ast diff --git a/src/tint/ast/switch_statement.h b/src/tint/ast/switch_statement.h index 5ac13b7b3e..82a9aa4d54 100644 --- a/src/tint/ast/switch_statement.h +++ b/src/tint/ast/switch_statement.h @@ -25,13 +25,15 @@ class SwitchStatement final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param condition the switch condition /// @param body the switch body SwitchStatement(ProgramID pid, + NodeID nid, const Source& src, const Expression* condition, - CaseStatementList body); + utils::VectorRef body); /// Move constructor SwitchStatement(SwitchStatement&&); ~SwitchStatement() override; @@ -49,7 +51,7 @@ class SwitchStatement final : public Castable { const Expression* const condition; /// The Switch body - const CaseStatementList body; + const utils::Vector body; SwitchStatement(const SwitchStatement&) = delete; }; diff --git a/src/tint/ast/switch_statement_test.cc b/src/tint/ast/switch_statement_test.cc index 19d1cfbaa9..0f66c6113e 100644 --- a/src/tint/ast/switch_statement_test.cc +++ b/src/tint/ast/switch_statement_test.cc @@ -25,54 +25,47 @@ namespace { using SwitchStatementTest = TestHelper; TEST_F(SwitchStatementTest, Creation) { - CaseSelectorList lit; - lit.push_back(Expr(1_u)); - + auto* case_stmt = create(utils::Vector{Expr(1_u)}, Block()); auto* ident = Expr("ident"); - CaseStatementList body; - auto* case_stmt = create(lit, Block()); - body.push_back(case_stmt); + utils::Vector body{case_stmt}; auto* stmt = create(ident, body); EXPECT_EQ(stmt->condition, ident); - ASSERT_EQ(stmt->body.size(), 1u); + ASSERT_EQ(stmt->body.Length(), 1u); EXPECT_EQ(stmt->body[0], case_stmt); } TEST_F(SwitchStatementTest, Creation_WithSource) { auto* ident = Expr("ident"); - - auto* stmt = - create(Source{Source::Location{20, 2}}, ident, CaseStatementList()); + auto* stmt = create(Source{Source::Location{20, 2}}, ident, utils::Empty); auto src = stmt->source; EXPECT_EQ(src.range.begin.line, 20u); EXPECT_EQ(src.range.begin.column, 2u); } TEST_F(SwitchStatementTest, IsSwitch) { - CaseSelectorList lit; - lit.push_back(Expr(2_i)); - + utils::Vector lit{Expr(2_i)}; auto* ident = Expr("ident"); - CaseStatementList body; - body.push_back(create(lit, Block())); + utils::Vector body{create(lit, Block())}; auto* stmt = create(ident, body); EXPECT_TRUE(stmt->Is()); } TEST_F(SwitchStatementTest, Assert_Null_Condition) { + using CaseStatementList = utils::Vector; EXPECT_FATAL_FAILURE( { ProgramBuilder b; CaseStatementList cases; - cases.push_back(b.create(CaseSelectorList{b.Expr(1_i)}, b.Block())); + cases.Push(b.create(utils::Vector{b.Expr(1_i)}, b.Block())); b.create(nullptr, cases); }, "internal compiler error"); } TEST_F(SwitchStatementTest, Assert_Null_CaseStatement) { + using CaseStatementList = utils::Vector; EXPECT_FATAL_FAILURE( { ProgramBuilder b; @@ -86,9 +79,9 @@ TEST_F(SwitchStatementTest, Assert_DifferentProgramID_Condition) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(b2.Expr(true), CaseStatementList{ + b1.create(b2.Expr(true), utils::Vector{ b1.create( - CaseSelectorList{ + utils::Vector{ b1.Expr(1_i), }, b1.Block()), @@ -102,9 +95,9 @@ TEST_F(SwitchStatementTest, Assert_DifferentProgramID_CaseStatement) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(b1.Expr(true), CaseStatementList{ + b1.create(b1.Expr(true), utils::Vector{ b2.create( - CaseSelectorList{ + utils::Vector{ b2.Expr(1_i), }, b2.Block()), diff --git a/src/tint/ast/texel_format.cc b/src/tint/ast/texel_format.cc new file mode 100644 index 0000000000..cfac9f1757 --- /dev/null +++ b/src/tint/ast/texel_format.cc @@ -0,0 +1,122 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/texel_format.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/texel_format.h" + +namespace tint::ast { + +/// ParseTexelFormat parses a TexelFormat from a string. +/// @param str the string to parse +/// @returns the parsed enum, or TexelFormat::kInvalid if the string could not be parsed. +TexelFormat ParseTexelFormat(std::string_view str) { + if (str == "rgba8unorm") { + return TexelFormat::kRgba8Unorm; + } + if (str == "rgba8snorm") { + return TexelFormat::kRgba8Snorm; + } + if (str == "rgba8uint") { + return TexelFormat::kRgba8Uint; + } + if (str == "rgba8sint") { + return TexelFormat::kRgba8Sint; + } + if (str == "rgba16uint") { + return TexelFormat::kRgba16Uint; + } + if (str == "rgba16sint") { + return TexelFormat::kRgba16Sint; + } + if (str == "rgba16float") { + return TexelFormat::kRgba16Float; + } + if (str == "r32uint") { + return TexelFormat::kR32Uint; + } + if (str == "r32sint") { + return TexelFormat::kR32Sint; + } + if (str == "r32float") { + return TexelFormat::kR32Float; + } + if (str == "rg32uint") { + return TexelFormat::kRg32Uint; + } + if (str == "rg32sint") { + return TexelFormat::kRg32Sint; + } + if (str == "rg32float") { + return TexelFormat::kRg32Float; + } + if (str == "rgba32uint") { + return TexelFormat::kRgba32Uint; + } + if (str == "rgba32sint") { + return TexelFormat::kRgba32Sint; + } + if (str == "rgba32float") { + return TexelFormat::kRgba32Float; + } + return TexelFormat::kInvalid; +} + +std::ostream& operator<<(std::ostream& out, TexelFormat value) { + switch (value) { + case TexelFormat::kInvalid: + return out << "invalid"; + case TexelFormat::kRgba8Unorm: + return out << "rgba8unorm"; + case TexelFormat::kRgba8Snorm: + return out << "rgba8snorm"; + case TexelFormat::kRgba8Uint: + return out << "rgba8uint"; + case TexelFormat::kRgba8Sint: + return out << "rgba8sint"; + case TexelFormat::kRgba16Uint: + return out << "rgba16uint"; + case TexelFormat::kRgba16Sint: + return out << "rgba16sint"; + case TexelFormat::kRgba16Float: + return out << "rgba16float"; + case TexelFormat::kR32Uint: + return out << "r32uint"; + case TexelFormat::kR32Sint: + return out << "r32sint"; + case TexelFormat::kR32Float: + return out << "r32float"; + case TexelFormat::kRg32Uint: + return out << "rg32uint"; + case TexelFormat::kRg32Sint: + return out << "rg32sint"; + case TexelFormat::kRg32Float: + return out << "rg32float"; + case TexelFormat::kRgba32Uint: + return out << "rgba32uint"; + case TexelFormat::kRgba32Sint: + return out << "rgba32sint"; + case TexelFormat::kRgba32Float: + return out << "rgba32float"; + } + return out << ""; +} + +} // namespace tint::ast diff --git a/src/tint/ast/texel_format.cc.tmpl b/src/tint/ast/texel_format.cc.tmpl new file mode 100644 index 0000000000..cc9f769f02 --- /dev/null +++ b/src/tint/ast/texel_format.cc.tmpl @@ -0,0 +1,22 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate texel_format.cc + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "texel_format") -}} + +#include "src/tint/ast/texel_format.h" + +namespace tint::ast { + +{{ Eval "ParseEnum" $enum}} + +{{ Eval "EnumOStream" $enum}} + +} // namespace tint::ast diff --git a/src/tint/ast/texel_format.h b/src/tint/ast/texel_format.h new file mode 100644 index 0000000000..28119b3379 --- /dev/null +++ b/src/tint/ast/texel_format.h @@ -0,0 +1,63 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/texel_format.h.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#ifndef SRC_TINT_AST_TEXEL_FORMAT_H_ +#define SRC_TINT_AST_TEXEL_FORMAT_H_ + +#include + +namespace tint::ast { + +/// Enumerator of texel formats +enum class TexelFormat { + kInvalid, + kRgba8Unorm, + kRgba8Snorm, + kRgba8Uint, + kRgba8Sint, + kRgba16Uint, + kRgba16Sint, + kRgba16Float, + kR32Uint, + kR32Sint, + kR32Float, + kRg32Uint, + kRg32Sint, + kRg32Float, + kRgba32Uint, + kRgba32Sint, + kRgba32Float, +}; + +/// @param out the std::ostream to write to +/// @param value the TexelFormat +/// @returns `out` so calls can be chained +std::ostream& operator<<(std::ostream& out, TexelFormat value); + +/// ParseTexelFormat parses a TexelFormat from a string. +/// @param str the string to parse +/// @returns the parsed enum, or TexelFormat::kInvalid if the string could not be parsed. +TexelFormat ParseTexelFormat(std::string_view str); + +} // namespace tint::ast + +#endif // SRC_TINT_AST_TEXEL_FORMAT_H_ diff --git a/src/tint/ast/texel_format.h.tmpl b/src/tint/ast/texel_format.h.tmpl new file mode 100644 index 0000000000..e7454a0fe9 --- /dev/null +++ b/src/tint/ast/texel_format.h.tmpl @@ -0,0 +1,26 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate texel_format.h + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "texel_format") -}} + +#ifndef SRC_TINT_AST_TEXEL_FORMAT_H_ +#define SRC_TINT_AST_TEXEL_FORMAT_H_ + +#include + +namespace tint::ast { + +/// Enumerator of texel formats +{{ Eval "DeclareEnum" $enum}} + +} // namespace tint::ast + +#endif // SRC_TINT_AST_TEXEL_FORMAT_H_ diff --git a/src/tint/ast/texel_format_bench.cc b/src/tint/ast/texel_format_bench.cc new file mode 100644 index 0000000000..a17906a33e --- /dev/null +++ b/src/tint/ast/texel_format_bench.cc @@ -0,0 +1,69 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/texel_format_bench.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/texel_format.h" + +#include + +#include "benchmark/benchmark.h" + +namespace tint::ast { +namespace { + +void TexelFormatParser(::benchmark::State& state) { + std::array kStrings{ + "rgbaunccrm", "rlbanr3", "rVba8unorm", "rgba8unorm", "rgba1unorm", + "rgbJqqnorm", "rgb7ll8unorm", "rgqqappnoHHm", "rv8scor", "rgbbGsnrm", + "rgba8snorm", "rgba8vniirm", "rg8a8snoWWm", "Mgbaxxnorm", "rXa8uggnt", + "rgbXVut", "3gba8uint", "rgba8uint", "rgba8uiEt", "rgTTPauint", + "ddgbauixxt", "44gba8sint", "VVgbaSSsint", "rba8si2Rt", "rgba8sint", + "r9bFsint", "rgba8int", "rgVROOsHnt", "ryba1uint", "r77ba1nnullrrt", + "rgb4006uint", "rgba16uint", "rb1uioot", "rga1uzznt", "r11b1uppiit", + "XXgba16sint", "IIgb9916nni55t", "rYbaSSrrsiHHat", "rgba16sint", "rbkk6Hit", + "jgba1sgRR", "rgbab6si", "rgba16fljat", "rgba6float", "rbq6float", + "rgba16float", "rgba1NNloat", "rgbvv6flot", "rgbaQQ6foat", "r3ffir", + "r32uijt", "rNNwuin8", "r32uint", "r32int", "rrr2uint", + "G32uint", "r32sinFF", "32st", "r3rrint", "r32sint", + "2sint", "D3siJJt", "r38n", "r211lk", "r32floa", + "r3flJat", "r32float", "r32fcoat", "r32floOt", "r32floKK_vtt", + "rxx32ui8", "Fg3qq__n", "rg32iqqt", "rg32uint", "rg333uin6", + "rtto62u9QQt", "rg366uin", "rOx2si6zz", "rg3yysint", "rHHsint", + "rg32sint", "qWW432snt", "rg3OOsnt", "g32siYt", "g32flo", + "rg32foaF", "rg32fwat", "rg32float", "G3fKoaff", "KKgq2float", + "rg32mmlo3t", "rgba32uit", "rqba3uint", "rgbabb2uin", "rgba32uint", + "rba32iint", "qgba32uiOt", "rgba32uiTTvv", "rgFFa32sint", "rg00Q2sPnt", + "rgbaP2sint", "rgba32sint", "rgb77s2sint", "rgba32sbbRRC", "rgbXX32sint", + "rOOOba3CCqoat", "rgbu32fsLt", "rgba3Xfloat", "rgba32float", "rba32float", + "qqb3float", "rgba32fl22at", + }; + for (auto _ : state) { + for (auto& str : kStrings) { + auto result = ParseTexelFormat(str); + benchmark::DoNotOptimize(result); + } + } +} + +BENCHMARK(TexelFormatParser); + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/texel_format_bench.cc.tmpl b/src/tint/ast/texel_format_bench.cc.tmpl new file mode 100644 index 0000000000..4df62b4e78 --- /dev/null +++ b/src/tint/ast/texel_format_bench.cc.tmpl @@ -0,0 +1,26 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate texel_format_bench.cc + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "texel_format") -}} + +#include "src/tint/ast/texel_format.h" + +#include + +#include "benchmark/benchmark.h" + +namespace tint::ast { +namespace { + +{{ Eval "BenchmarkParseEnum" $enum }} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/texel_format_test.cc b/src/tint/ast/texel_format_test.cc new file mode 100644 index 0000000000..606d78f410 --- /dev/null +++ b/src/tint/ast/texel_format_test.cc @@ -0,0 +1,106 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/ast/texel_format_test.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/ast/texel_format.h" + +#include + +#include "src/tint/ast/test_helper.h" +#include "src/tint/utils/string.h" + +namespace tint::ast { +namespace { + +namespace parse_print_tests { + +struct Case { + const char* string; + TexelFormat value; +}; + +inline std::ostream& operator<<(std::ostream& out, Case c) { + return out << "'" << std::string(c.string) << "'"; +} + +static constexpr Case kValidCases[] = { + {"rgba8unorm", TexelFormat::kRgba8Unorm}, {"rgba8snorm", TexelFormat::kRgba8Snorm}, + {"rgba8uint", TexelFormat::kRgba8Uint}, {"rgba8sint", TexelFormat::kRgba8Sint}, + {"rgba16uint", TexelFormat::kRgba16Uint}, {"rgba16sint", TexelFormat::kRgba16Sint}, + {"rgba16float", TexelFormat::kRgba16Float}, {"r32uint", TexelFormat::kR32Uint}, + {"r32sint", TexelFormat::kR32Sint}, {"r32float", TexelFormat::kR32Float}, + {"rg32uint", TexelFormat::kRg32Uint}, {"rg32sint", TexelFormat::kRg32Sint}, + {"rg32float", TexelFormat::kRg32Float}, {"rgba32uint", TexelFormat::kRgba32Uint}, + {"rgba32sint", TexelFormat::kRgba32Sint}, {"rgba32float", TexelFormat::kRgba32Float}, +}; + +static constexpr Case kInvalidCases[] = { + {"rgbaunccrm", TexelFormat::kInvalid}, {"rlbanr3", TexelFormat::kInvalid}, + {"rVba8unorm", TexelFormat::kInvalid}, {"rgba1snorm", TexelFormat::kInvalid}, + {"rgbJqqnorm", TexelFormat::kInvalid}, {"rgb7ll8snorm", TexelFormat::kInvalid}, + {"rgbauippqHH", TexelFormat::kInvalid}, {"rgbaun", TexelFormat::kInvalid}, + {"rba8Gint", TexelFormat::kInvalid}, {"rgvia8sint", TexelFormat::kInvalid}, + {"rgba8WWint", TexelFormat::kInvalid}, {"rgbasxxMt", TexelFormat::kInvalid}, + {"rXba16ungg", TexelFormat::kInvalid}, {"rba1XuVt", TexelFormat::kInvalid}, + {"rgba16uin3", TexelFormat::kInvalid}, {"rgba16sinE", TexelFormat::kInvalid}, + {"TTgba16sPPn", TexelFormat::kInvalid}, {"rgbad6xxint", TexelFormat::kInvalid}, + {"rgba446float", TexelFormat::kInvalid}, {"SSVVba16float", TexelFormat::kInvalid}, + {"rgbRR6float", TexelFormat::kInvalid}, {"rFui9t", TexelFormat::kInvalid}, + {"r32int", TexelFormat::kInvalid}, {"VOORRHnt", TexelFormat::kInvalid}, + {"r3siyt", TexelFormat::kInvalid}, {"lln3rrs77nt", TexelFormat::kInvalid}, + {"r32s4n00", TexelFormat::kInvalid}, {"32ooat", TexelFormat::kInvalid}, + {"r32fzzt", TexelFormat::kInvalid}, {"r3iippl1a", TexelFormat::kInvalid}, + {"XXg32uint", TexelFormat::kInvalid}, {"rII39955nnnt", TexelFormat::kInvalid}, + {"aagHH2uinYSS", TexelFormat::kInvalid}, {"rkk3it", TexelFormat::kInvalid}, + {"gj3sRRn", TexelFormat::kInvalid}, {"r3bsnt", TexelFormat::kInvalid}, + {"rg32flojt", TexelFormat::kInvalid}, {"r32floa", TexelFormat::kInvalid}, + {"rg32lot", TexelFormat::kInvalid}, {"rgb3uit", TexelFormat::kInvalid}, + {"rgjj3uint", TexelFormat::kInvalid}, {"rgb2urnff", TexelFormat::kInvalid}, + {"rgba32sijt", TexelFormat::kInvalid}, {"NNgba32ww2t", TexelFormat::kInvalid}, + {"rgba32snt", TexelFormat::kInvalid}, {"rgba32rrloat", TexelFormat::kInvalid}, + {"rgGa32float", TexelFormat::kInvalid}, {"FFgba32float", TexelFormat::kInvalid}, +}; + +using TexelFormatParseTest = testing::TestWithParam; + +TEST_P(TexelFormatParseTest, Parse) { + const char* string = GetParam().string; + TexelFormat expect = GetParam().value; + EXPECT_EQ(expect, ParseTexelFormat(string)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, TexelFormatParseTest, testing::ValuesIn(kValidCases)); +INSTANTIATE_TEST_SUITE_P(InvalidCases, TexelFormatParseTest, testing::ValuesIn(kInvalidCases)); + +using TexelFormatPrintTest = testing::TestWithParam; + +TEST_P(TexelFormatPrintTest, Print) { + TexelFormat value = GetParam().value; + const char* expect = GetParam().string; + EXPECT_EQ(expect, utils::ToString(value)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, TexelFormatPrintTest, testing::ValuesIn(kValidCases)); + +} // namespace parse_print_tests + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/texel_format_test.cc.tmpl b/src/tint/ast/texel_format_test.cc.tmpl new file mode 100644 index 0000000000..304cfebd4e --- /dev/null +++ b/src/tint/ast/texel_format_test.cc.tmpl @@ -0,0 +1,27 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate texel_format_test.cc + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- Import "src/tint/templates/enums.tmpl.inc" -}} +{{- $enum := (Sem.Enum "texel_format") -}} + +#include "src/tint/ast/texel_format.h" + +#include + +#include "src/tint/ast/test_helper.h" +#include "src/tint/utils/string.h" + +namespace tint::ast { +namespace { + +{{ Eval "TestParsePrintEnum" $enum}} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/texture.cc b/src/tint/ast/texture.cc index 27eb094793..f3c01dff29 100644 --- a/src/tint/ast/texture.cc +++ b/src/tint/ast/texture.cc @@ -77,7 +77,8 @@ int NumCoordinateAxes(TextureDimension dim) { return 0; } -Texture::Texture(ProgramID pid, const Source& src, TextureDimension d) : Base(pid, src), dim(d) {} +Texture::Texture(ProgramID pid, NodeID nid, const Source& src, TextureDimension d) + : Base(pid, nid, src), dim(d) {} Texture::Texture(Texture&&) = default; diff --git a/src/tint/ast/texture.h b/src/tint/ast/texture.h index 9a4199bcd7..fcfa3340ff 100644 --- a/src/tint/ast/texture.h +++ b/src/tint/ast/texture.h @@ -65,9 +65,10 @@ class Texture : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param dim the dimensionality of the texture - Texture(ProgramID pid, const Source& src, TextureDimension dim); + Texture(ProgramID pid, NodeID nid, const Source& src, TextureDimension dim); /// Move constructor Texture(Texture&&); ~Texture() override; diff --git a/src/tint/ast/traverse_expressions.h b/src/tint/ast/traverse_expressions.h index 650273b388..bcf0bfde1c 100644 --- a/src/tint/ast/traverse_expressions.h +++ b/src/tint/ast/traverse_expressions.h @@ -26,6 +26,7 @@ #include "src/tint/ast/phony_expression.h" #include "src/tint/ast/unary_op_expression.h" #include "src/tint/utils/reverse.h" +#include "src/tint/utils/vector.h" namespace tint::ast { @@ -54,40 +55,58 @@ enum class TraverseOrder { /// @param root the root expression node /// @param diags the diagnostics used for error messages /// @param callback the callback function. Must be of the signature: -/// `TraverseAction(const T*)` where T is an ast::Expression type. +/// `TraverseAction(const T* expr)` or `TraverseAction(const T* expr, size_t depth)` where T +/// is an ast::Expression type. /// @return true on success, false on error template bool TraverseExpressions(const ast::Expression* root, diag::List& diags, CALLBACK&& callback) { using EXPR_TYPE = std::remove_pointer_t>; - std::vector to_visit{root}; + constexpr static bool kHasDepthArg = traits::SignatureOfT::parameter_count == 2; - auto push_pair = [&](const ast::Expression* left, const ast::Expression* right) { + struct Pending { + const ast::Expression* expr; + size_t depth; + }; + + utils::Vector to_visit{{root, 0}}; + + auto push_single = [&](const ast::Expression* expr, size_t depth) { + to_visit.Push({expr, depth}); + }; + auto push_pair = [&](const ast::Expression* left, const ast::Expression* right, size_t depth) { if (ORDER == TraverseOrder::LeftToRight) { - to_visit.push_back(right); - to_visit.push_back(left); + to_visit.Push({right, depth}); + to_visit.Push({left, depth}); } else { - to_visit.push_back(left); - to_visit.push_back(right); + to_visit.Push({left, depth}); + to_visit.Push({right, depth}); } }; - auto push_list = [&](const std::vector& exprs) { + auto push_list = [&](utils::VectorRef exprs, size_t depth) { if (ORDER == TraverseOrder::LeftToRight) { for (auto* expr : utils::Reverse(exprs)) { - to_visit.push_back(expr); + to_visit.Push({expr, depth}); } } else { for (auto* expr : exprs) { - to_visit.push_back(expr); + to_visit.Push({expr, depth}); } } }; - while (!to_visit.empty()) { - auto* expr = to_visit.back(); - to_visit.pop_back(); + while (!to_visit.IsEmpty()) { + auto p = to_visit.Pop(); + const ast::Expression* expr = p.expr; - if (auto* filtered = expr->As()) { - switch (callback(filtered)) { + if (auto* filtered = expr->template As()) { + TraverseAction result; + if constexpr (kHasDepthArg) { + result = callback(filtered, p.depth); + } else { + result = callback(filtered); + } + + switch (result) { case TraverseAction::Stop: return true; case TraverseAction::Skip: @@ -100,32 +119,31 @@ bool TraverseExpressions(const ast::Expression* root, diag::List& diags, CALLBAC bool ok = Switch( expr, [&](const IndexAccessorExpression* idx) { - push_pair(idx->object, idx->index); + push_pair(idx->object, idx->index, p.depth + 1); return true; }, [&](const BinaryExpression* bin_op) { - push_pair(bin_op->lhs, bin_op->rhs); + push_pair(bin_op->lhs, bin_op->rhs, p.depth + 1); return true; }, [&](const BitcastExpression* bitcast) { - to_visit.push_back(bitcast->expr); + push_single(bitcast->expr, p.depth + 1); return true; }, [&](const CallExpression* call) { // TODO(crbug.com/tint/1257): Resolver breaks if we actually include - // the function name in the traversal. to_visit.push_back(call->func); - push_list(call->args); + // the function name in the traversal. push_single(call->func); + push_list(call->args, p.depth + 1); return true; }, [&](const MemberAccessorExpression* member) { // TODO(crbug.com/tint/1257): Resolver breaks if we actually include - // the member name in the traversal. push_pair(member->structure, - // member->member); - to_visit.push_back(member->structure); + // the member name in the traversal. push_pair(member->member, p.depth + 1); + push_single(member->structure, p.depth + 1); return true; }, [&](const UnaryOpExpression* unary) { - to_visit.push_back(unary->expr); + push_single(unary->expr, p.depth + 1); return true; }, [&](Default) { diff --git a/src/tint/ast/traverse_expressions_test.cc b/src/tint/ast/traverse_expressions_test.cc index 622a7ffae3..a5a6dfdae7 100644 --- a/src/tint/ast/traverse_expressions_test.cc +++ b/src/tint/ast/traverse_expressions_test.cc @@ -73,6 +73,23 @@ TEST_F(TraverseExpressionsTest, DescendBinaryExpression) { } } +TEST_F(TraverseExpressionsTest, Depth) { + std::vector e = {Expr(1_i), Expr(1_i), Expr(1_i), Expr(1_i)}; + std::vector i = {Add(e[0], e[1]), Sub(e[2], e[3])}; + auto* root = Mul(i[0], i[1]); + + size_t j = 0; + size_t depths[] = {0, 1, 2, 2, 1, 2, 2}; + { + TraverseExpressions( // + root, Diagnostics(), [&](const ast::Expression* expr, size_t depth) { + (void)expr; + EXPECT_THAT(depth, depths[j++]); + return ast::TraverseAction::Descend; + }); + } +} + TEST_F(TraverseExpressionsTest, DescendBitcastExpression) { auto* e = Expr(1_i); auto* b0 = Bitcast(e); @@ -80,19 +97,19 @@ TEST_F(TraverseExpressionsTest, DescendBitcastExpression) { auto* b2 = Bitcast(b1); auto* root = Bitcast(b2); { - std::vector l2r; + utils::Vector l2r; TraverseExpressions(root, Diagnostics(), [&](const ast::Expression* expr) { - l2r.push_back(expr); + l2r.Push(expr); return ast::TraverseAction::Descend; }); EXPECT_THAT(l2r, ElementsAre(root, b2, b1, b0, e)); } { - std::vector r2l; + utils::Vector r2l; TraverseExpressions(root, Diagnostics(), [&](const ast::Expression* expr) { - r2l.push_back(expr); + r2l.Push(expr); return ast::TraverseAction::Descend; }); EXPECT_THAT(r2l, ElementsAre(root, b2, b1, b0, e)); @@ -100,23 +117,23 @@ TEST_F(TraverseExpressionsTest, DescendBitcastExpression) { } TEST_F(TraverseExpressionsTest, DescendCallExpression) { - std::vector e = {Expr(1_i), Expr(1_i), Expr(1_i), Expr(1_i)}; - std::vector c = {Call("a", e[0], e[1]), Call("b", e[2], e[3])}; + utils::Vector e{Expr(1_i), Expr(1_i), Expr(1_i), Expr(1_i)}; + utils::Vector c{Call("a", e[0], e[1]), Call("b", e[2], e[3])}; auto* root = Call("c", c[0], c[1]); { - std::vector l2r; + utils::Vector l2r; TraverseExpressions(root, Diagnostics(), [&](const ast::Expression* expr) { - l2r.push_back(expr); + l2r.Push(expr); return ast::TraverseAction::Descend; }); EXPECT_THAT(l2r, ElementsAre(root, c[0], e[0], e[1], c[1], e[2], e[3])); } { - std::vector r2l; + utils::Vector r2l; TraverseExpressions(root, Diagnostics(), [&](const ast::Expression* expr) { - r2l.push_back(expr); + r2l.Push(expr); return ast::TraverseAction::Descend; }); EXPECT_THAT(r2l, ElementsAre(root, c[1], e[3], e[2], c[0], e[1], e[0])); diff --git a/src/tint/ast/type.h b/src/tint/ast/type.h index 4fee565e1a..4f1f276974 100644 --- a/src/tint/ast/type.h +++ b/src/tint/ast/type.h @@ -42,8 +42,9 @@ class Type : public Castable { protected: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - Type(ProgramID pid, const Source& src); + Type(ProgramID pid, NodeID nid, const Source& src); }; } // namespace tint::ast diff --git a/src/tint/ast/type_decl.cc b/src/tint/ast/type_decl.cc index a1a0605846..0b7652461e 100644 --- a/src/tint/ast/type_decl.cc +++ b/src/tint/ast/type_decl.cc @@ -20,7 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::TypeDecl); namespace tint::ast { -TypeDecl::TypeDecl(ProgramID pid, const Source& src, Symbol n) : Base(pid, src), name(n) { +TypeDecl::TypeDecl(ProgramID pid, NodeID nid, const Source& src, Symbol n) + : Base(pid, nid, src), name(n) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, name, program_id); } diff --git a/src/tint/ast/type_decl.h b/src/tint/ast/type_decl.h index 2b8487a4ca..e3266c69e2 100644 --- a/src/tint/ast/type_decl.h +++ b/src/tint/ast/type_decl.h @@ -26,9 +26,10 @@ class TypeDecl : public Castable { public: /// Create a new struct statement /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node for the import statement /// @param name The name of the structure - TypeDecl(ProgramID pid, const Source& src, Symbol name); + TypeDecl(ProgramID pid, NodeID nid, const Source& src, Symbol name); /// Move constructor TypeDecl(TypeDecl&&); diff --git a/src/tint/ast/type_name.cc b/src/tint/ast/type_name.cc index 8eb7a1ad00..852abf87c3 100644 --- a/src/tint/ast/type_name.cc +++ b/src/tint/ast/type_name.cc @@ -20,7 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::TypeName); namespace tint::ast { -TypeName::TypeName(ProgramID pid, const Source& src, Symbol n) : Base(pid, src), name(n) {} +TypeName::TypeName(ProgramID pid, NodeID nid, const Source& src, Symbol n) + : Base(pid, nid, src), name(n) {} TypeName::~TypeName() = default; diff --git a/src/tint/ast/type_name.h b/src/tint/ast/type_name.h index 3bb556a9b9..ed7e2f23c5 100644 --- a/src/tint/ast/type_name.h +++ b/src/tint/ast/type_name.h @@ -26,9 +26,10 @@ class TypeName final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param name the type name - TypeName(ProgramID pid, const Source& src, Symbol name); + TypeName(ProgramID pid, NodeID nid, const Source& src, Symbol name); /// Move constructor TypeName(TypeName&&); /// Destructor diff --git a/src/tint/ast/u32.cc b/src/tint/ast/u32.cc index ac9c4908f0..c99dc4f284 100644 --- a/src/tint/ast/u32.cc +++ b/src/tint/ast/u32.cc @@ -20,7 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::U32); namespace tint::ast { -U32::U32(ProgramID pid, const Source& src) : Base(pid, src) {} +U32::U32(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} U32::~U32() = default; diff --git a/src/tint/ast/u32.h b/src/tint/ast/u32.h index 8ede11cbb4..9237278de3 100644 --- a/src/tint/ast/u32.h +++ b/src/tint/ast/u32.h @@ -26,8 +26,9 @@ class U32 final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - U32(ProgramID pid, const Source& src); + U32(ProgramID pid, NodeID nid, const Source& src); /// Move constructor U32(U32&&); ~U32() override; diff --git a/src/tint/ast/unary_op_expression.cc b/src/tint/ast/unary_op_expression.cc index 80e4e9061a..eec69a05ab 100644 --- a/src/tint/ast/unary_op_expression.cc +++ b/src/tint/ast/unary_op_expression.cc @@ -21,10 +21,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::UnaryOpExpression); namespace tint::ast { UnaryOpExpression::UnaryOpExpression(ProgramID pid, + NodeID nid, const Source& src, UnaryOp o, const Expression* e) - : Base(pid, src), op(o), expr(e) { + : Base(pid, nid, src), op(o), expr(e) { TINT_ASSERT(AST, expr); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, expr, program_id); } diff --git a/src/tint/ast/unary_op_expression.h b/src/tint/ast/unary_op_expression.h index 22093fbd1e..a5c2be937e 100644 --- a/src/tint/ast/unary_op_expression.h +++ b/src/tint/ast/unary_op_expression.h @@ -24,11 +24,13 @@ namespace tint::ast { class UnaryOpExpression final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the unary op expression source /// @param op the op /// @param expr the expr - UnaryOpExpression(ProgramID program_id, + UnaryOpExpression(ProgramID pid, + NodeID nid, const Source& source, UnaryOp op, const Expression* expr); diff --git a/src/tint/ast/var.cc b/src/tint/ast/var.cc new file mode 100644 index 0000000000..474cff2c38 --- /dev/null +++ b/src/tint/ast/var.cc @@ -0,0 +1,54 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/var.h" + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::ast::Var); + +namespace tint::ast { + +Var::Var(ProgramID pid, + NodeID nid, + const Source& src, + const Symbol& sym, + const ast::Type* ty, + StorageClass storage_class, + Access access, + const Expression* ctor, + utils::VectorRef attrs) + : Base(pid, nid, src, sym, ty, ctor, std::move(attrs)), + declared_storage_class(storage_class), + declared_access(access) {} + +Var::Var(Var&&) = default; + +Var::~Var() = default; + +const char* Var::Kind() const { + return "var"; +} + +const Var* Var::Clone(CloneContext* ctx) const { + auto src = ctx->Clone(source); + auto sym = ctx->Clone(symbol); + auto* ty = ctx->Clone(type); + auto* ctor = ctx->Clone(constructor); + auto attrs = ctx->Clone(attributes); + return ctx->dst->create(src, sym, ty, declared_storage_class, declared_access, ctor, + std::move(attrs)); +} + +} // namespace tint::ast diff --git a/src/tint/ast/var.h b/src/tint/ast/var.h new file mode 100644 index 0000000000..908a9b30f4 --- /dev/null +++ b/src/tint/ast/var.h @@ -0,0 +1,91 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_AST_VAR_H_ +#define SRC_TINT_AST_VAR_H_ + +#include +#include + +#include "src/tint/ast/variable.h" + +namespace tint::ast { + +/// A "var" declaration is a name for typed storage. +/// +/// Examples: +/// +/// ``` +/// // Declared outside a function, i.e. at module scope, requires +/// // a storage class. +/// var width : i32; // no initializer +/// var height : i32 = 3; // with initializer +/// +/// // A variable declared inside a function doesn't take a storage class, +/// // and maps to SPIR-V Function storage. +/// var computed_depth : i32; +/// var area : i32 = compute_area(width, height); +/// ``` +/// +/// @see https://www.w3.org/TR/WGSL/#var-decls +class Var final : public Castable { + public: + /// Create a 'var' variable + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier + /// @param source the variable source + /// @param sym the variable symbol + /// @param type the declared variable type + /// @param declared_storage_class the declared storage class + /// @param declared_access the declared access control + /// @param constructor the constructor expression + /// @param attributes the variable attributes + Var(ProgramID pid, + NodeID nid, + const Source& source, + const Symbol& sym, + const ast::Type* type, + StorageClass declared_storage_class, + Access declared_access, + const Expression* constructor, + utils::VectorRef attributes); + + /// Move constructor + Var(Var&&); + + /// Destructor + ~Var() override; + + /// @returns "var" + const char* Kind() const override; + + /// Clones this node and all transitive child nodes using the `CloneContext` + /// `ctx`. + /// @param ctx the clone context + /// @return the newly cloned node + const Var* Clone(CloneContext* ctx) const override; + + /// The declared storage class + const StorageClass declared_storage_class; + + /// The declared access control + const Access declared_access; +}; + +/// A list of `var` declarations +using VarList = std::vector; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_VAR_H_ diff --git a/src/tint/ast/variable.cc b/src/tint/ast/variable.cc index 26991f252a..bb719c062f 100644 --- a/src/tint/ast/variable.cc +++ b/src/tint/ast/variable.cc @@ -13,35 +13,22 @@ // limitations under the License. #include "src/tint/ast/variable.h" - -#include "src/tint/program_builder.h" -#include "src/tint/sem/variable.h" +#include "src/tint/ast/binding_attribute.h" +#include "src/tint/ast/group_attribute.h" TINT_INSTANTIATE_TYPEINFO(tint::ast::Variable); namespace tint::ast { Variable::Variable(ProgramID pid, + NodeID nid, const Source& src, const Symbol& sym, - StorageClass dsc, - Access da, const ast::Type* ty, - bool constant, - bool overridable, const Expression* ctor, - AttributeList attrs) - : Base(pid, src), - symbol(sym), - type(ty), - is_const(constant), - is_overridable(overridable), - constructor(ctor), - attributes(std::move(attrs)), - declared_storage_class(dsc), - declared_access(da) { + utils::VectorRef attrs) + : Base(pid, nid, src), symbol(sym), type(ty), constructor(ctor), attributes(std::move(attrs)) { TINT_ASSERT(AST, symbol.IsValid()); - TINT_ASSERT(AST, is_overridable ? is_const : true); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, symbol, program_id); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, constructor, program_id); } @@ -50,27 +37,4 @@ Variable::Variable(Variable&&) = default; Variable::~Variable() = default; -VariableBindingPoint Variable::BindingPoint() const { - const GroupAttribute* group = nullptr; - const BindingAttribute* binding = nullptr; - for (auto* attr : attributes) { - if (auto* g = attr->As()) { - group = g; - } else if (auto* b = attr->As()) { - binding = b; - } - } - return VariableBindingPoint{group, binding}; -} - -const Variable* Variable::Clone(CloneContext* ctx) const { - auto src = ctx->Clone(source); - auto sym = ctx->Clone(symbol); - auto* ty = ctx->Clone(type); - auto* ctor = ctx->Clone(constructor); - auto attrs = ctx->Clone(attributes); - return ctx->dst->create(src, sym, declared_storage_class, declared_access, ty, - is_const, is_overridable, ctor, attrs); -} - } // namespace tint::ast diff --git a/src/tint/ast/variable.h b/src/tint/ast/variable.h index 58022558f5..8772f5beb7 100644 --- a/src/tint/ast/variable.h +++ b/src/tint/ast/variable.h @@ -20,136 +20,58 @@ #include "src/tint/ast/access.h" #include "src/tint/ast/attribute.h" +#include "src/tint/ast/binding_attribute.h" #include "src/tint/ast/expression.h" +#include "src/tint/ast/group_attribute.h" #include "src/tint/ast/storage_class.h" // Forward declarations namespace tint::ast { -class BindingAttribute; -class GroupAttribute; class LocationAttribute; class Type; } // namespace tint::ast namespace tint::ast { -/// VariableBindingPoint holds a group and binding attribute. -struct VariableBindingPoint { - /// The `@group` part of the binding point - const GroupAttribute* group = nullptr; - /// The `@binding` part of the binding point - const BindingAttribute* binding = nullptr; - - /// @returns true if the BindingPoint has a valid group and binding - /// attribute. - inline operator bool() const { return group && binding; } -}; - -/// A Variable statement. +/// Variable is the base class for Var, Let, Const, Override and Parameter. /// -/// An instance of this class represents one of four constructs in WGSL: "var" -/// declaration, "let" declaration, "override" declaration, or formal parameter -/// to a function. +/// An instance of this class represents one of five constructs in WGSL: "var" declaration, "let" +/// declaration, "override" declaration, "const" declaration, or formal parameter to a function. /// -/// 1. A "var" declaration is a name for typed storage. Examples: -/// -/// // Declared outside a function, i.e. at module scope, requires -/// // a storage class. -/// var width : i32; // no initializer -/// var height : i32 = 3; // with initializer -/// -/// // A variable declared inside a function doesn't take a storage class, -/// // and maps to SPIR-V Function storage. -/// var computed_depth : i32; -/// var area : i32 = compute_area(width, height); -/// -/// 2. A "let" declaration is a name for a typed value. Examples: -/// -/// let twice_depth : i32 = width + width; // Must have initializer -/// -/// 3. An "override" declaration is a name for a pipeline-overridable constant. -/// Examples: -/// -/// override radius : i32 = 2; // Can be overridden by name. -/// @id(5) override width : i32 = 2; // Can be overridden by ID. -/// override scale : f32; // No default - must be overridden. -/// -/// 4. A formal parameter to a function is a name for a typed value to -/// be passed into a function. Example: -/// -/// fn twice(a: i32) -> i32 { // "a:i32" is the formal parameter -/// return a + a; -/// } -/// -/// From the WGSL draft, about "var":: -/// -/// A variable is a named reference to storage that can contain a value of a -/// particular type. -/// -/// Two types are associated with a variable: its store type (the type of -/// value that may be placed in the referenced storage) and its reference -/// type (the type of the variable itself). If a variable has store type T -/// and storage class S, then its reference type is pointer-to-T-in-S. -/// -/// This class uses the term "type" to refer to: -/// the value type of a "let", -/// the value type of an "override", -/// the value type of the formal parameter, -/// or the store type of the "var". -// -/// Setting is_const: -/// - "var" gets false -/// - "let" gets true -/// - "override" gets true -/// - formal parameter gets true -/// -/// Setting is_overrideable: -/// - "var" gets false -/// - "let" gets false -/// - "override" gets true -/// - formal parameter gets false -/// -/// Setting storage class: -/// - "var" is StorageClass::kNone when using the -/// defaulting syntax for a "var" declared inside a function. -/// - "let" is always StorageClass::kNone. -/// - formal parameter is always StorageClass::kNone. -class Variable final : public Castable { +/// @see https://www.w3.org/TR/WGSL/#value-decls +class Variable : public Castable { public: - /// Create a variable - /// @param program_id the identifier of the program that owns this node + /// Constructor + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the variable source /// @param sym the variable symbol - /// @param declared_storage_class the declared storage class - /// @param declared_access the declared access control /// @param type the declared variable type - /// @param is_const true if the variable is const - /// @param is_overridable true if the variable is pipeline-overridable /// @param constructor the constructor expression /// @param attributes the variable attributes - Variable(ProgramID program_id, + Variable(ProgramID pid, + NodeID nid, const Source& source, const Symbol& sym, - StorageClass declared_storage_class, - Access declared_access, const ast::Type* type, - bool is_const, - bool is_overridable, const Expression* constructor, - AttributeList attributes); + utils::VectorRef attributes); + /// Move constructor Variable(Variable&&); + /// Destructor ~Variable() override; - /// @returns the binding point information for the variable - VariableBindingPoint BindingPoint() const; + /// @returns true if the variable has both group and binding attributes + bool HasBindingPoint() const { + return ast::GetAttribute(attributes) != nullptr && + ast::GetAttribute(attributes) != nullptr; + } - /// Clones this node and all transitive child nodes using the `CloneContext` - /// `ctx`. - /// @param ctx the clone context - /// @return the newly cloned node - const Variable* Clone(CloneContext* ctx) const override; + /// @returns the kind of the variable, which can be used in diagnostics + /// e.g. "var", "let", "const", etc + virtual const char* Kind() const = 0; /// The variable symbol const Symbol symbol; @@ -159,28 +81,13 @@ class Variable final : public Castable { /// var i = 1; const ast::Type* const type; - /// True if this is a constant, false otherwise - const bool is_const; - - /// True if this is a pipeline-overridable constant, false otherwise - const bool is_overridable; - /// The constructor expression or nullptr if none set const Expression* const constructor; /// The attributes attached to this variable - const AttributeList attributes; - - /// The declared storage class - const StorageClass declared_storage_class; - - /// The declared access control - const Access declared_access; + const utils::Vector attributes; }; -/// A list of variables -using VariableList = std::vector; - } // namespace tint::ast #endif // SRC_TINT_AST_VARIABLE_H_ diff --git a/src/tint/ast/variable_decl_statement.cc b/src/tint/ast/variable_decl_statement.cc index fdde149f03..79ee92606c 100644 --- a/src/tint/ast/variable_decl_statement.cc +++ b/src/tint/ast/variable_decl_statement.cc @@ -20,8 +20,11 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::VariableDeclStatement); namespace tint::ast { -VariableDeclStatement::VariableDeclStatement(ProgramID pid, const Source& src, const Variable* var) - : Base(pid, src), variable(var) { +VariableDeclStatement::VariableDeclStatement(ProgramID pid, + NodeID nid, + const Source& src, + const Variable* var) + : Base(pid, nid, src), variable(var) { TINT_ASSERT(AST, variable); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, variable, program_id); } diff --git a/src/tint/ast/variable_decl_statement.h b/src/tint/ast/variable_decl_statement.h index 3f3ae273e3..b71d0b2acc 100644 --- a/src/tint/ast/variable_decl_statement.h +++ b/src/tint/ast/variable_decl_statement.h @@ -24,10 +24,14 @@ namespace tint::ast { class VariableDeclStatement final : public Castable { public: /// Constructor - /// @param program_id the identifier of the program that owns this node + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param source the variable statement source /// @param variable the variable - VariableDeclStatement(ProgramID program_id, const Source& source, const Variable* variable); + VariableDeclStatement(ProgramID pid, + NodeID nid, + const Source& source, + const Variable* variable); /// Move constructor VariableDeclStatement(VariableDeclStatement&&); ~VariableDeclStatement() override; diff --git a/src/tint/ast/variable_decl_statement_test.cc b/src/tint/ast/variable_decl_statement_test.cc index 2cd4d4dd75..5867ae974e 100644 --- a/src/tint/ast/variable_decl_statement_test.cc +++ b/src/tint/ast/variable_decl_statement_test.cc @@ -23,14 +23,14 @@ namespace { using VariableDeclStatementTest = TestHelper; TEST_F(VariableDeclStatementTest, Creation) { - auto* var = Var("a", ty.f32(), StorageClass::kNone); + auto* var = Var("a", ty.f32()); auto* stmt = create(var); EXPECT_EQ(stmt->variable, var); } TEST_F(VariableDeclStatementTest, Creation_WithSource) { - auto* var = Var("a", ty.f32(), StorageClass::kNone); + auto* var = Var("a", ty.f32()); auto* stmt = create(Source{Source::Location{20, 2}}, var); auto src = stmt->source; @@ -39,7 +39,7 @@ TEST_F(VariableDeclStatementTest, Creation_WithSource) { } TEST_F(VariableDeclStatementTest, IsVariableDecl) { - auto* var = Var("a", ty.f32(), StorageClass::kNone); + auto* var = Var("a", ty.f32()); auto* stmt = create(var); EXPECT_TRUE(stmt->Is()); @@ -59,7 +59,7 @@ TEST_F(VariableDeclStatementTest, Assert_DifferentProgramID_Variable) { { ProgramBuilder b1; ProgramBuilder b2; - b1.create(b2.Var("a", b2.ty.f32(), StorageClass::kNone)); + b1.create(b2.Var("a", b2.ty.f32())); }, "internal compiler error"); } diff --git a/src/tint/ast/variable_test.cc b/src/tint/ast/variable_test.cc index b43a19e541..14fb766f46 100644 --- a/src/tint/ast/variable_test.cc +++ b/src/tint/ast/variable_test.cc @@ -17,6 +17,8 @@ #include "src/tint/ast/id_attribute.h" #include "src/tint/ast/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::ast { namespace { @@ -36,7 +38,7 @@ TEST_F(VariableTest, Creation) { TEST_F(VariableTest, CreationWithSource) { auto* v = Var(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 5}}}, "i", - ty.f32(), StorageClass::kPrivate, nullptr, AttributeList{}); + ty.f32(), StorageClass::kPrivate, utils::Empty); EXPECT_EQ(v->symbol, Symbol(1, ID())); EXPECT_EQ(v->declared_storage_class, StorageClass::kPrivate); @@ -49,7 +51,7 @@ TEST_F(VariableTest, CreationWithSource) { TEST_F(VariableTest, CreationEmpty) { auto* v = Var(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 7}}}, "a_var", - ty.i32(), StorageClass::kWorkgroup, nullptr, AttributeList{}); + ty.i32(), StorageClass::kWorkgroup, utils::Empty); EXPECT_EQ(v->symbol, Symbol(1, ID())); EXPECT_EQ(v->declared_storage_class, StorageClass::kWorkgroup); @@ -64,7 +66,7 @@ TEST_F(VariableTest, Assert_MissingSymbol) { EXPECT_FATAL_FAILURE( { ProgramBuilder b; - b.Var("", b.ty.i32(), StorageClass::kNone); + b.Var("", b.ty.i32()); }, "internal compiler error"); } @@ -74,7 +76,7 @@ TEST_F(VariableTest, Assert_DifferentProgramID_Symbol) { { ProgramBuilder b1; ProgramBuilder b2; - b1.Var(b2.Sym("x"), b1.ty.f32(), StorageClass::kNone); + b1.Var(b2.Sym("x"), b1.ty.f32()); }, "internal compiler error"); } @@ -84,18 +86,14 @@ TEST_F(VariableTest, Assert_DifferentProgramID_Constructor) { { ProgramBuilder b1; ProgramBuilder b2; - b1.Var("x", b1.ty.f32(), StorageClass::kNone, b2.Expr(1.2f)); + b1.Var("x", b1.ty.f32(), b2.Expr(1.2_f)); }, "internal compiler error"); } TEST_F(VariableTest, WithAttributes) { - auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr, - AttributeList{ - create(1), - create(Builtin::kPosition), - create(1200), - }); + auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, Location(1u), + Builtin(BuiltinValue::kPosition), Id(1200u)); auto& attributes = var->attributes; EXPECT_TRUE(ast::HasAttribute(attributes)); @@ -107,44 +105,24 @@ TEST_F(VariableTest, WithAttributes) { EXPECT_EQ(1u, location->value); } -TEST_F(VariableTest, BindingPoint) { - auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr, - AttributeList{ - create(2), - create(1), - }); - EXPECT_TRUE(var->BindingPoint()); - ASSERT_NE(var->BindingPoint().binding, nullptr); - ASSERT_NE(var->BindingPoint().group, nullptr); - EXPECT_EQ(var->BindingPoint().binding->value, 2u); - EXPECT_EQ(var->BindingPoint().group->value, 1u); +TEST_F(VariableTest, HasBindingPoint_BothProvided) { + auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, Binding(2), Group(1)); + EXPECT_TRUE(var->HasBindingPoint()); } -TEST_F(VariableTest, BindingPointAttributes) { - auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr, AttributeList{}); - EXPECT_FALSE(var->BindingPoint()); - EXPECT_EQ(var->BindingPoint().group, nullptr); - EXPECT_EQ(var->BindingPoint().binding, nullptr); +TEST_F(VariableTest, HasBindingPoint_NeitherProvided) { + auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, utils::Empty); + EXPECT_FALSE(var->HasBindingPoint()); } -TEST_F(VariableTest, BindingPointMissingGroupAttribute) { - auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr, - AttributeList{ - create(2), - }); - EXPECT_FALSE(var->BindingPoint()); - ASSERT_NE(var->BindingPoint().binding, nullptr); - EXPECT_EQ(var->BindingPoint().binding->value, 2u); - EXPECT_EQ(var->BindingPoint().group, nullptr); +TEST_F(VariableTest, HasBindingPoint_MissingGroupAttribute) { + auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, Binding(2)); + EXPECT_FALSE(var->HasBindingPoint()); } -TEST_F(VariableTest, BindingPointMissingBindingAttribute) { - auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr, - AttributeList{create(1)}); - EXPECT_FALSE(var->BindingPoint()); - ASSERT_NE(var->BindingPoint().group, nullptr); - EXPECT_EQ(var->BindingPoint().group->value, 1u); - EXPECT_EQ(var->BindingPoint().binding, nullptr); +TEST_F(VariableTest, HasBindingPoint_MissingBindingAttribute) { + auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, Group(1)); + EXPECT_FALSE(var->HasBindingPoint()); } } // namespace diff --git a/src/tint/ast/vector.cc b/src/tint/ast/vector.cc index 43478dfda4..d49da33126 100644 --- a/src/tint/ast/vector.cc +++ b/src/tint/ast/vector.cc @@ -20,8 +20,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Vector); namespace tint::ast { -Vector::Vector(ProgramID pid, Source const& src, const Type* subtype, uint32_t w) - : Base(pid, src), type(subtype), width(w) { +Vector::Vector(ProgramID pid, NodeID nid, Source const& src, const Type* subtype, uint32_t w) + : Base(pid, nid, src), type(subtype), width(w) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, subtype, program_id); TINT_ASSERT(AST, width > 1); TINT_ASSERT(AST, width < 5); diff --git a/src/tint/ast/vector.h b/src/tint/ast/vector.h index 6b2d9141b8..111602de52 100644 --- a/src/tint/ast/vector.h +++ b/src/tint/ast/vector.h @@ -26,12 +26,13 @@ class Vector final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param subtype the declared type of the vector components. May be null /// for vector constructors, where the element type will be inferred /// from the constructor arguments /// @param width the number of elements in the vector - Vector(ProgramID pid, Source const& src, const Type* subtype, uint32_t width); + Vector(ProgramID pid, NodeID nid, Source const& src, const Type* subtype, uint32_t width); /// Move constructor Vector(Vector&&); ~Vector() override; diff --git a/src/tint/ast/vector_test.cc b/src/tint/ast/vector_test.cc index a701852df5..da2ad1f3de 100644 --- a/src/tint/ast/vector_test.cc +++ b/src/tint/ast/vector_test.cc @@ -24,14 +24,14 @@ using AstVectorTest = TestHelper; TEST_F(AstVectorTest, Creation) { auto* i32 = create(); - auto* v = create(i32, 2); + auto* v = create(i32, 2u); EXPECT_EQ(v->type, i32); EXPECT_EQ(v->width, 2u); } TEST_F(AstVectorTest, FriendlyName) { auto* f32 = create(); - auto* v = create(f32, 3); + auto* v = create(f32, 3u); EXPECT_EQ(v->FriendlyName(Symbols()), "vec3"); } diff --git a/src/tint/ast/void.cc b/src/tint/ast/void.cc index 5cc89635a7..ead89efe42 100644 --- a/src/tint/ast/void.cc +++ b/src/tint/ast/void.cc @@ -20,7 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Void); namespace tint::ast { -Void::Void(ProgramID pid, const Source& src) : Base(pid, src) {} +Void::Void(ProgramID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {} Void::Void(Void&&) = default; diff --git a/src/tint/ast/void.h b/src/tint/ast/void.h index 33f5b5bd1d..dba20f11e4 100644 --- a/src/tint/ast/void.h +++ b/src/tint/ast/void.h @@ -26,8 +26,9 @@ class Void final : public Castable { public: /// Constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node - Void(ProgramID pid, const Source& src); + Void(ProgramID pid, NodeID nid, const Source& src); /// Move constructor Void(Void&&); ~Void() override; diff --git a/src/tint/ast/while_statement.cc b/src/tint/ast/while_statement.cc new file mode 100644 index 0000000000..160af4b582 --- /dev/null +++ b/src/tint/ast/while_statement.cc @@ -0,0 +1,49 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/while_statement.h" + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::ast::WhileStatement); + +namespace tint::ast { + +WhileStatement::WhileStatement(ProgramID pid, + NodeID nid, + const Source& src, + const Expression* cond, + const BlockStatement* b) + : Base(pid, nid, src), condition(cond), body(b) { + TINT_ASSERT(AST, cond); + TINT_ASSERT(AST, body); + + TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, condition, program_id); + TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, body, program_id); +} + +WhileStatement::WhileStatement(WhileStatement&&) = default; + +WhileStatement::~WhileStatement() = default; + +const WhileStatement* WhileStatement::Clone(CloneContext* ctx) const { + // Clone arguments outside of create() call to have deterministic ordering + auto src = ctx->Clone(source); + + auto* cond = ctx->Clone(condition); + auto* b = ctx->Clone(body); + return ctx->dst->create(src, cond, b); +} + +} // namespace tint::ast diff --git a/src/tint/ast/while_statement.h b/src/tint/ast/while_statement.h new file mode 100644 index 0000000000..4e8dd7e2a1 --- /dev/null +++ b/src/tint/ast/while_statement.h @@ -0,0 +1,57 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_AST_WHILE_STATEMENT_H_ +#define SRC_TINT_AST_WHILE_STATEMENT_H_ + +#include "src/tint/ast/block_statement.h" + +namespace tint::ast { + +class Expression; + +/// A while loop statement +class WhileStatement final : public Castable { + public: + /// Constructor + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier + /// @param source the for loop statement source + /// @param condition the optional loop condition expression + /// @param body the loop body + WhileStatement(ProgramID pid, + NodeID nid, + const Source& source, + const Expression* condition, + const BlockStatement* body); + /// Move constructor + WhileStatement(WhileStatement&&); + ~WhileStatement() override; + + /// Clones this node and all transitive child nodes using the `CloneContext` + /// `ctx`. + /// @param ctx the clone context + /// @return the newly cloned node + const WhileStatement* Clone(CloneContext* ctx) const override; + + /// The condition expression + const Expression* const condition; + + /// The loop body block + const BlockStatement* const body; +}; + +} // namespace tint::ast + +#endif // SRC_TINT_AST_WHILE_STATEMENT_H_ diff --git a/src/tint/ast/while_statement_test.cc b/src/tint/ast/while_statement_test.cc new file mode 100644 index 0000000000..73c9e5614f --- /dev/null +++ b/src/tint/ast/while_statement_test.cc @@ -0,0 +1,85 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "gtest/gtest-spi.h" +#include "src/tint/ast/binary_expression.h" +#include "src/tint/ast/test_helper.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::ast { +namespace { + +using WhileStatementTest = TestHelper; + +TEST_F(WhileStatementTest, Creation) { + auto* cond = create(BinaryOp::kLessThan, Expr("i"), Expr(5_u)); + auto* body = Block(Return()); + auto* l = While(cond, body); + + EXPECT_EQ(l->condition, cond); + EXPECT_EQ(l->body, body); +} + +TEST_F(WhileStatementTest, Creation_WithSource) { + auto* cond = create(BinaryOp::kLessThan, Expr("i"), Expr(5_u)); + auto* body = Block(Return()); + auto* l = While(Source{{20u, 2u}}, cond, body); + auto src = l->source; + EXPECT_EQ(src.range.begin.line, 20u); + EXPECT_EQ(src.range.begin.column, 2u); +} + +TEST_F(WhileStatementTest, Assert_Null_Cond) { + EXPECT_FATAL_FAILURE( + { + ProgramBuilder b; + auto* body = b.Block(); + b.While(nullptr, body); + }, + "internal compiler error"); +} + +TEST_F(WhileStatementTest, Assert_Null_Body) { + EXPECT_FATAL_FAILURE( + { + ProgramBuilder b; + auto* cond = b.create(BinaryOp::kLessThan, b.Expr("i"), b.Expr(5_u)); + b.While(cond, nullptr); + }, + "internal compiler error"); +} + +TEST_F(WhileStatementTest, Assert_DifferentProgramID_Condition) { + EXPECT_FATAL_FAILURE( + { + ProgramBuilder b1; + ProgramBuilder b2; + b1.While(b2.Expr(true), b1.Block()); + }, + "internal compiler error"); +} + +TEST_F(WhileStatementTest, Assert_DifferentProgramID_Body) { + EXPECT_FATAL_FAILURE( + { + ProgramBuilder b1; + ProgramBuilder b2; + b1.While(b1.Expr(true), b2.Block()); + }, + "internal compiler error"); +} + +} // namespace +} // namespace tint::ast diff --git a/src/tint/ast/workgroup_attribute.cc b/src/tint/ast/workgroup_attribute.cc index 74ecdbe019..7cb67dc586 100644 --- a/src/tint/ast/workgroup_attribute.cc +++ b/src/tint/ast/workgroup_attribute.cc @@ -23,11 +23,12 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::WorkgroupAttribute); namespace tint::ast { WorkgroupAttribute::WorkgroupAttribute(ProgramID pid, + NodeID nid, const Source& src, const ast::Expression* x_, const ast::Expression* y_, const ast::Expression* z_) - : Base(pid, src), x(x_), y(y_), z(z_) {} + : Base(pid, nid, src), x(x_), y(y_), z(z_) {} WorkgroupAttribute::~WorkgroupAttribute() = default; diff --git a/src/tint/ast/workgroup_attribute.h b/src/tint/ast/workgroup_attribute.h index 536ce155fd..e27e77e900 100644 --- a/src/tint/ast/workgroup_attribute.h +++ b/src/tint/ast/workgroup_attribute.h @@ -32,11 +32,13 @@ class WorkgroupAttribute final : public Castable public: /// constructor /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier /// @param src the source of this node /// @param x the workgroup x dimension expression /// @param y the optional workgroup y dimension expression /// @param z the optional workgroup z dimension expression WorkgroupAttribute(ProgramID pid, + NodeID nid, const Source& src, const ast::Expression* x, const ast::Expression* y = nullptr, diff --git a/src/tint/bench/benchmark.h b/src/tint/bench/benchmark.h index 733b1a7bb2..680158544d 100644 --- a/src/tint/bench/benchmark.h +++ b/src/tint/bench/benchmark.h @@ -17,8 +17,7 @@ #include #include -// TODO(https://crbug.com/dawn/1379) Update cpplint and remove NOLINT -#include // NOLINT: Found C system header after C++ system header. +#include #include "benchmark/benchmark.h" #include "src/tint/utils/concat.h" @@ -59,6 +58,7 @@ std::variant LoadProgram(std::string name); /// files in `/test/benchmark`. #define TINT_BENCHMARK_WGSL_PROGRAMS(FUNC) \ TINT_BENCHMARK_WGSL_PROGRAM(FUNC, "animometer.wgsl"); \ + TINT_BENCHMARK_WGSL_PROGRAM(FUNC, "atan2-const-eval.wgsl"); \ TINT_BENCHMARK_WGSL_PROGRAM(FUNC, "bloom-vertical-blur.wgsl"); \ TINT_BENCHMARK_WGSL_PROGRAM(FUNC, "cluster-lights.wgsl"); \ TINT_BENCHMARK_WGSL_PROGRAM(FUNC, "empty.wgsl"); \ diff --git a/src/tint/castable.cc b/src/tint/castable.cc index cff430ecb2..40c32da64a 100644 --- a/src/tint/castable.cc +++ b/src/tint/castable.cc @@ -26,4 +26,8 @@ const TypeInfo detail::TypeInfoOf::info{ tint::TypeInfo::FullHashCodeOf(), }; +CastableBase::CastableBase(const CastableBase&) = default; + +CastableBase::~CastableBase() = default; + } // namespace tint diff --git a/src/tint/castable.h b/src/tint/castable.h index 048d1e5258..fe820e15dd 100644 --- a/src/tint/castable.h +++ b/src/tint/castable.h @@ -101,6 +101,36 @@ struct TypeInfo { /// The type hash code bitwise-or'd with all ancestor's hashcodes. const HashCode full_hashcode; + /// @returns true if `type` derives from the class `TO` + /// @param object the object type to test from, which must be, or derive from + /// type `FROM`. + /// @see CastFlags + template + static inline bool Is(const tint::TypeInfo* object) { + constexpr const bool downcast = std::is_base_of::value; + constexpr const bool upcast = std::is_base_of::value; + constexpr const bool nocast = std::is_same::value; + constexpr const bool assert_is_castable = (FLAGS & kDontErrorOnImpossibleCast) == 0; + + static_assert(upcast || downcast || nocast || !assert_is_castable, "impossible cast"); + + return upcast || nocast || object->Is(); + } + + /// @returns true if this type derives from the class `T` + template + inline bool Is() const { + auto* type = &Of>(); + + if constexpr (std::is_final_v) { + // T is final, so nothing can derive from T. + // We do not need to check ancestors, only whether this type is equal to the type T. + return type == this; + } else { + return Is(type); + } + } + /// @param type the test type info /// @returns true if the class with this TypeInfo is of, or derives from the /// class with the given TypeInfo. @@ -112,8 +142,8 @@ struct TypeInfo { return false; } - // Walk the base types, starting with this TypeInfo, to see if any of the - // pointers match `type`. + // Walk the base types, starting with this TypeInfo, to see if any of the pointers match + // `type`. for (auto* ti = this; ti != nullptr; ti = ti->base) { if (ti == type) { return true; @@ -122,26 +152,6 @@ struct TypeInfo { return false; } - /// @returns true if `type` derives from the class `TO` - /// @param type the object type to test from, which must be, or derive from - /// type `FROM`. - /// @see CastFlags - template - static inline bool Is(const tint::TypeInfo* type) { - constexpr const bool downcast = std::is_base_of::value; - constexpr const bool upcast = std::is_base_of::value; - constexpr const bool nocast = std::is_same::value; - constexpr const bool assert_is_castable = (FLAGS & kDontErrorOnImpossibleCast) == 0; - - static_assert(upcast || downcast || nocast || !assert_is_castable, "impossible cast"); - - if (upcast || nocast) { - return true; - } - - return type->Is(&Of>()); - } - /// @returns the static TypeInfo for the type T template static const TypeInfo& Of() { @@ -149,7 +159,7 @@ struct TypeInfo { } /// @returns a compile-time hashcode for the type `T`. - /// @note the returned hashcode will have at most 2 bits set, as the hashes + /// @note the returned hashcode will have exactly 2 bits set, as the hashes /// are expected to be used in bloom-filters which will quickly saturate when /// multiple hashcodes are bitwise-or'd together. template @@ -166,7 +176,8 @@ struct TypeInfo { #endif constexpr uint32_t bit_a = (crc & 63); constexpr uint32_t bit_b = ((crc >> 6) & 63); - return (static_cast(1) << bit_a) | (static_cast(1) << bit_b); + constexpr uint32_t bit_c = (bit_a == bit_b) ? ((bit_a + 1) & 63) : bit_b; + return (static_cast(1) << bit_a) | (static_cast(1) << bit_c); } /// @returns the hashcode of the given type, bitwise-or'd with the hashcodes @@ -212,18 +223,15 @@ struct TypeInfo { return false; } else if constexpr (kCount == 1) { return Is(&Of>()); - } else if constexpr (kCount == 2) { - return Is(&Of>()) || - Is(&Of>()); - } else if constexpr (kCount == 3) { - return Is(&Of>()) || - Is(&Of>()) || - Is(&Of>()); } else { - // Optimization: Compare the object's hashcode to the bitwise-or of all - // the tested type's hashcodes. If there's no intersection of bits in - // the two masks, then we can guarantee that the type is not in `TO`. - if (full_hashcode & TypeInfo::CombinedHashCodeOfTuple()) { + // Optimization: Compare the object's hashcode to the bitwise-or of all the tested + // type's hashcodes. If there's no intersection of bits in the two masks, then we can + // guarantee that the type is not in `TO`. + HashCode mask = full_hashcode & TypeInfo::CombinedHashCodeOfTuple(); + // HashCodeOf() ensures that two bits are always set for every hash, so we can quickly + // eliminate the bitmask where only one bit is set. + HashCode two_bits = mask & (mask - 1); + if (two_bits) { // Possibly one of the types in `TUPLE`. // Split the search in two, and scan each block. static constexpr auto kMid = kCount / 2; @@ -320,10 +328,10 @@ inline const TO* As(const FROM* obj) { class CastableBase { public: /// Copy constructor - CastableBase(const CastableBase&) = default; + CastableBase(const CastableBase&); /// Destructor - virtual ~CastableBase() = default; + virtual ~CastableBase(); /// Copy assignment /// @param other the CastableBase to copy @@ -460,7 +468,7 @@ struct CastableCommonBaseImpl {}; /// Alias to typename CastableCommonBaseImpl::type template -using CastableCommonBase = typename detail::CastableCommonBaseImpl::type; +using CastableCommonBase = typename CastableCommonBaseImpl::type; /// CastableCommonBaseImpl template specialization for a single type template @@ -587,7 +595,7 @@ inline bool NonDefaultCases(T* object, // Attempt to dynamically cast the object to the handler type. If that // succeeds, call the case handler with the cast object. using CaseType = SwitchCaseType; - if (type->Is(&TypeInfo::Of())) { + if (type->Is()) { auto* ptr = static_cast(object); if constexpr (kHasReturnType) { new (result) RETURN_TYPE(static_cast(std::get<0>(cases)(ptr))); @@ -599,9 +607,14 @@ inline bool NonDefaultCases(T* object, return false; } else { // Multiple cases. - // Check the hashcode bits to see if there's any possibility of a case - // matching in these cases. If there isn't, we can skip all these cases. - if (type->full_hashcode & TypeInfo::CombinedHashCodeOf...>()) { + // Check the hashcode bits to see if there's any possibility of a case matching in these + // cases. If there isn't, we can skip all these cases. + TypeInfo::HashCode mask = + type->full_hashcode & TypeInfo::CombinedHashCodeOf...>(); + // HashCodeOf() ensures that two bits are always set for every hash, so we can quickly + // eliminate the bitmask where only one bit is set. + TypeInfo::HashCode two_bits = mask & (mask - 1); + if (two_bits) { // There's a possibility. We need to scan further. // Split the cases into two, and recurse. constexpr size_t kMid = kNumCases / 2; @@ -626,7 +639,7 @@ inline void SwitchCases(T* object, RETURN_TYPE* result, std::tuple&& c // Static assertions static constexpr bool kDefaultIsOK = - kDefaultIndex == -1 || kDefaultIndex == std::tuple_size_v - 1; + kDefaultIndex == -1 || kDefaultIndex == static_cast(std::tuple_size_v - 1); static constexpr bool kReturnIsOK = kHasDefaultCase || !kHasReturnType || std::is_constructible_v; static_assert(kDefaultIsOK, "Default case must be last in Switch()"); diff --git a/src/tint/castable_bench.cc b/src/tint/castable_bench.cc index 7c7e0ef34b..c9d0c43771 100644 --- a/src/tint/castable_bench.cc +++ b/src/tint/castable_bench.cc @@ -12,7 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "bench/benchmark.h" +#include + +#include "benchmark/benchmark.h" + +#include "src/tint/castable.h" namespace tint { namespace { diff --git a/src/tint/clone_context.cc b/src/tint/clone_context.cc index 0a9e606742..457522bf8b 100644 --- a/src/tint/clone_context.cc +++ b/src/tint/clone_context.cc @@ -23,8 +23,9 @@ TINT_INSTANTIATE_TYPEINFO(tint::Cloneable); namespace tint { -CloneContext::ListTransforms::ListTransforms() = default; -CloneContext::ListTransforms::~ListTransforms() = default; +Cloneable::Cloneable() = default; +Cloneable::Cloneable(Cloneable&&) = default; +Cloneable::~Cloneable() = default; CloneContext::CloneContext(ProgramBuilder* to, Program const* from, bool auto_clone_symbols) : dst(to), src(from) { @@ -44,7 +45,7 @@ Symbol CloneContext::Clone(Symbol s) { if (!src) { return s; // In-place clone } - return utils::GetOrCreate(cloned_symbols_, s, [&]() -> Symbol { + return cloned_symbols_.GetOrCreate(s, [&]() -> Symbol { if (symbol_transform_) { return symbol_transform_(s); } @@ -58,7 +59,7 @@ void CloneContext::Clone() { ast::FunctionList CloneContext::Clone(const ast::FunctionList& v) { ast::FunctionList out; - out.reserve(v.size()); + out.Reserve(v.Length()); for (const ast::Function* el : v) { out.Add(Clone(el)); } @@ -72,9 +73,8 @@ const tint::Cloneable* CloneContext::CloneCloneable(const Cloneable* object) { } // Was Replace() called for this object? - auto it = replacements_.find(object); - if (it != replacements_.end()) { - return it->second(); + if (auto* fn = replacements_.Find(object)) { + return (*fn)(); } // Attempt to clone using the registered replacer functions. diff --git a/src/tint/clone_context.h b/src/tint/clone_context.h index e027565aa1..3c5f6ec5d3 100644 --- a/src/tint/clone_context.h +++ b/src/tint/clone_context.h @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include #include @@ -28,6 +26,8 @@ #include "src/tint/program_id.h" #include "src/tint/symbol.h" #include "src/tint/traits.h" +#include "src/tint/utils/hashmap.h" +#include "src/tint/utils/vector.h" // Forward declarations namespace tint { @@ -48,6 +48,13 @@ ProgramID ProgramIDOf(const ProgramBuilder*); /// Cloneable is the base class for all objects that can be cloned class Cloneable : public Castable { public: + /// Constructor + Cloneable(); + /// Move constructor + Cloneable(Cloneable&&); + /// Destructor + ~Cloneable() override; + /// Performs a deep clone of this object using the CloneContext `ctx`. /// @param ctx the clone context /// @return the newly cloned object @@ -156,12 +163,12 @@ class CloneContext { /// /// @param v the vector to clone /// @return the cloned vector - template - std::vector Clone(const std::vector& v) { - std::vector out; + template + utils::Vector Clone(const utils::Vector& v) { + utils::Vector out; out.reserve(v.size()); for (auto& el : v) { - out.emplace_back(Clone(el)); + out.Push(Clone(el)); } return out; } @@ -174,9 +181,9 @@ class CloneContext { /// /// @param v the vector to clone /// @return the cloned vector - template - std::vector Clone(const std::vector& v) { - std::vector out; + template + utils::Vector Clone(const utils::Vector& v) { + utils::Vector out; Clone(out, v); return out; } @@ -189,61 +196,54 @@ class CloneContext { /// /// @param from the vector to clone /// @param to the cloned result - template - void Clone(std::vector& to, const std::vector& from) { - to.reserve(from.size()); + template + void Clone(utils::Vector& to, const utils::Vector& from) { + to.Reserve(from.Length()); - auto list_transform_it = list_transforms_.find(&from); - if (list_transform_it != list_transforms_.end()) { - const auto& transforms = list_transform_it->second; - for (auto* o : transforms.insert_front_) { - to.emplace_back(CheckedCast(o)); + auto transforms = list_transforms_.Find(&from); + + if (transforms) { + for (auto* o : transforms->insert_front_) { + to.Push(CheckedCast(o)); } for (auto& el : from) { - auto insert_before_it = transforms.insert_before_.find(el); - if (insert_before_it != transforms.insert_before_.end()) { - for (auto insert : insert_before_it->second) { - to.emplace_back(CheckedCast(insert)); + if (auto* insert_before = transforms->insert_before_.Find(el)) { + for (auto insert : *insert_before) { + to.Push(CheckedCast(insert)); } } - if (transforms.remove_.count(el) == 0) { - to.emplace_back(Clone(el)); + if (!transforms->remove_.Contains(el)) { + to.Push(Clone(el)); } - auto insert_after_it = transforms.insert_after_.find(el); - if (insert_after_it != transforms.insert_after_.end()) { - for (auto insert : insert_after_it->second) { - to.emplace_back(CheckedCast(insert)); + if (auto* insert_after = transforms->insert_after_.Find(el)) { + for (auto insert : *insert_after) { + to.Push(CheckedCast(insert)); } } } - for (auto* o : transforms.insert_back_) { - to.emplace_back(CheckedCast(o)); + for (auto* o : transforms->insert_back_) { + to.Push(CheckedCast(o)); } } else { for (auto& el : from) { - to.emplace_back(Clone(el)); + to.Push(Clone(el)); - // Clone(el) may have inserted after - list_transform_it = list_transforms_.find(&from); - if (list_transform_it != list_transforms_.end()) { - const auto& transforms = list_transform_it->second; - - auto insert_after_it = transforms.insert_after_.find(el); - if (insert_after_it != transforms.insert_after_.end()) { - for (auto insert : insert_after_it->second) { - to.emplace_back(CheckedCast(insert)); + // Clone(el) may have updated the transformation list, adding an `insert_after` + // transform for `from`. + if (transforms) { + if (auto* insert_after = transforms->insert_after_.Find(el)) { + for (auto insert : *insert_after) { + to.Push(CheckedCast(insert)); } } } } - // Clone(el)s may have inserted back - list_transform_it = list_transforms_.find(&from); - if (list_transform_it != list_transforms_.end()) { - const auto& transforms = list_transform_it->second; - - for (auto* o : transforms.insert_back_) { - to.emplace_back(CheckedCast(o)); + // Clone(el) may have updated the transformation list, adding an `insert_back_` + // transform for `from`. + if (transforms) { + for (auto* o : transforms->insert_back_) { + to.Push(CheckedCast(o)); } } } @@ -311,7 +311,7 @@ class CloneContext { CloneableTransform transform; transform.typeinfo = &TypeInfo::Of(); transform.function = [=](const Cloneable* in) { return replacer(in->As()); }; - transforms_.emplace_back(std::move(transform)); + transforms_.Push(std::move(transform)); return *this; } @@ -350,7 +350,7 @@ class CloneContext { CloneContext& Replace(const WHAT* what, const WITH* with) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, src, what); TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, dst, with); - replacements_[what] = [with]() -> const Cloneable* { return with; }; + replacements_.Add(what, [with]() -> const Cloneable* { return with; }); return *this; } @@ -370,7 +370,7 @@ class CloneContext { template > CloneContext& Replace(const WHAT* what, WITH&& with) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, src, what); - replacements_[what] = with; + replacements_.Add(what, with); return *this; } @@ -379,8 +379,8 @@ class CloneContext { /// @param object a pointer to the object in #src that will be omitted from /// the cloned vector. /// @returns this CloneContext so calls can be chained - template - CloneContext& Remove(const std::vector& vector, OBJECT* object) { + template + CloneContext& Remove(const utils::Vector& vector, OBJECT* object) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, src, object); if (std::find(vector.begin(), vector.end(), object) == vector.end()) { TINT_ICE(Clone, Diagnostics()) @@ -388,7 +388,7 @@ class CloneContext { return *this; } - list_transforms_[&vector].remove_.emplace(object); + list_transforms_.Edit(&vector).remove_.Add(object); return *this; } @@ -397,12 +397,10 @@ class CloneContext { /// @param object a pointer to the object in #dst that will be inserted at the /// front of the vector /// @returns this CloneContext so calls can be chained - template - CloneContext& InsertFront(const std::vector& vector, OBJECT* object) { + template + CloneContext& InsertFront(const utils::Vector& vector, OBJECT* object) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, dst, object); - auto& transforms = list_transforms_[&vector]; - auto& list = transforms.insert_front_; - list.emplace_back(object); + list_transforms_.Edit(&vector).insert_front_.Push(object); return *this; } @@ -411,12 +409,10 @@ class CloneContext { /// @param object a pointer to the object in #dst that will be inserted at the /// end of the vector /// @returns this CloneContext so calls can be chained - template - CloneContext& InsertBack(const std::vector& vector, OBJECT* object) { + template + CloneContext& InsertBack(const utils::Vector& vector, OBJECT* object) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, dst, object); - auto& transforms = list_transforms_[&vector]; - auto& list = transforms.insert_back_; - list.emplace_back(object); + list_transforms_.Edit(&vector).insert_back_.Push(object); return *this; } @@ -426,8 +422,8 @@ class CloneContext { /// @param object a pointer to the object in #dst that will be inserted before /// any occurrence of the clone of `before` /// @returns this CloneContext so calls can be chained - template - CloneContext& InsertBefore(const std::vector& vector, + template + CloneContext& InsertBefore(const utils::Vector& vector, const BEFORE* before, const OBJECT* object) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, src, before); @@ -438,9 +434,7 @@ class CloneContext { return *this; } - auto& transforms = list_transforms_[&vector]; - auto& list = transforms.insert_before_[before]; - list.emplace_back(object); + list_transforms_.Edit(&vector).insert_before_.GetOrZero(before).Push(object); return *this; } @@ -450,8 +444,8 @@ class CloneContext { /// @param object a pointer to the object in #dst that will be inserted after /// any occurrence of the clone of `after` /// @returns this CloneContext so calls can be chained - template - CloneContext& InsertAfter(const std::vector& vector, + template + CloneContext& InsertAfter(const utils::Vector& vector, const AFTER* after, const OBJECT* object) { TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, src, after); @@ -462,9 +456,7 @@ class CloneContext { return *this; } - auto& transforms = list_transforms_[&vector]; - auto& list = transforms.insert_after_[after]; - list.emplace_back(object); + list_transforms_.Edit(&vector).insert_after_.GetOrZero(after).Push(object); return *this; } @@ -494,6 +486,31 @@ class CloneContext { std::function function; }; + /// A vector of const Cloneable* + using CloneableList = utils::Vector; + + /// Transformations to be applied to a list (vector) + struct ListTransforms { + /// A map of object in #src to omit when cloned into #dst. + utils::Hashset remove_; + + /// A list of objects in #dst to insert before any others when the vector is cloned. + CloneableList insert_front_; + + /// A list of objects in #dst to insert after all others when the vector is cloned. + CloneableList insert_back_; + + /// A map of object in #src to the list of cloned objects in #dst. + /// Clone(const utils::Vector& v) will use this to insert the map-value + /// list into the target vector before cloning and inserting the map-key. + utils::Hashmap insert_before_; + + /// A map of object in #src to the list of cloned objects in #dst. + /// Clone(const utils::Vector& v) will use this to insert the map-value + /// list into the target vector after cloning and inserting the map-key. + utils::Hashmap insert_after_; + }; + CloneContext(const CloneContext&) = delete; CloneContext& operator=(const CloneContext&) = delete; @@ -522,50 +539,78 @@ class CloneContext { /// @returns the diagnostic list of #dst diag::List& Diagnostics() const; - /// A vector of const Cloneable* - using CloneableList = std::vector; + /// VectorListTransforms is a map of utils::Vector pointer to transforms for that list + struct VectorListTransforms { + /// An accessor to the VectorListTransforms map. + /// Index caches the last map lookup, and will only re-search the map if the transform map + /// was modified since the last lookup. + struct Index { + /// @returns true if the map now holds a value for the index + operator bool() { + Update(); + return cached_; + } - /// Transformations to be applied to a list (vector) - struct ListTransforms { - /// Constructor - ListTransforms(); - /// Destructor - ~ListTransforms(); + /// @returns a pointer to the indexed map entry + const ListTransforms* operator->() { + Update(); + return cached_; + } - /// A map of object in #src to omit when cloned into #dst. - std::unordered_set remove_; + private: + friend VectorListTransforms; - /// A list of objects in #dst to insert before any others when the vector is - /// cloned. - CloneableList insert_front_; + Index(const void* list, + VectorListTransforms& vlt, + uint32_t generation, + const ListTransforms* cached) + : list_(list), vlt_(vlt), generation_(generation), cached_(cached) {} - /// A list of objects in #dst to insert befor after any others when the - /// vector is cloned. - CloneableList insert_back_; + void Update() { + if (vlt_.generation_ != generation_) { + cached_ = vlt_.map_.Find(list_); + generation_ = vlt_.generation_; + } + } - /// A map of object in #src to the list of cloned objects in #dst. - /// Clone(const std::vector& v) will use this to insert the map-value - /// list into the target vector before cloning and inserting the map-key. - std::unordered_map insert_before_; + const void* list_; + VectorListTransforms& vlt_; + uint32_t generation_; + const ListTransforms* cached_; + }; - /// A map of object in #src to the list of cloned objects in #dst. - /// Clone(const std::vector& v) will use this to insert the map-value - /// list into the target vector after cloning and inserting the map-key. - std::unordered_map insert_after_; + /// Edit returns a reference to the ListTransforms for the given vector pointer and + /// increments #list_transform_generation_ signalling that the list transforms have been + /// modified. + inline ListTransforms& Edit(const void* list) { + generation_++; + return map_.GetOrZero(list); + } + + /// @returns an Index to the transforms for the given list. + inline Index Find(const void* list) { + return Index{list, *this, generation_, map_.Find(list)}; + } + + private: + /// The map of vector pointer to ListTransforms + utils::Hashmap map_; + + /// A counter that's incremented each time list transforms are modified. + uint32_t generation_ = 0; }; - /// A map of object in #src to functions that create their replacement in - /// #dst - std::unordered_map> replacements_; + /// A map of object in #src to functions that create their replacement in #dst + utils::Hashmap, 8> replacements_; /// A map of symbol in #src to their cloned equivalent in #dst - std::unordered_map cloned_symbols_; + utils::Hashmap cloned_symbols_; /// Cloneable transform functions registered with ReplaceAll() - std::vector transforms_; + utils::Vector transforms_; - /// Map of std::vector pointer to transforms for that list - std::unordered_map list_transforms_; + /// Transformations to apply to vectors + VectorListTransforms list_transforms_; /// Symbol transform registered with ReplaceAll() SymbolTransform symbol_transform_; diff --git a/src/tint/clone_context_test.cc b/src/tint/clone_context_test.cc index 46cc720865..c8951515cb 100644 --- a/src/tint/clone_context_test.cc +++ b/src/tint/clone_context_test.cc @@ -37,12 +37,13 @@ struct Node : public Castable { const Node* node_b = nullptr, const Node* node_c = nullptr) : allocator(alloc), name(n), a(node_a), b(node_b), c(node_c) {} + Node(Node&&) = delete; Allocator* const allocator; Symbol name; const Node* a = nullptr; const Node* b = nullptr; const Node* c = nullptr; - std::vector vec; + utils::Vector vec; Node* Clone(CloneContext* ctx) const override { auto* out = allocator->Create(ctx->Clone(name)); @@ -387,7 +388,7 @@ TEST_F(CloneContextNodeTest, CloneWithRemove) { .Remove(original_root->vec, original_root->vec[1]) .Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 2u); + EXPECT_EQ(cloned_root->vec.Length(), 2u); EXPECT_NE(cloned_root->vec[0], cloned_root->a); EXPECT_NE(cloned_root->vec[1], cloned_root->c); @@ -416,7 +417,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertFront) { .InsertFront(original_root->vec, insertion) .Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 4u); + EXPECT_EQ(cloned_root->vec.Length(), 4u); EXPECT_NE(cloned_root->vec[0], cloned_root->a); EXPECT_NE(cloned_root->vec[1], cloned_root->b); @@ -434,7 +435,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertFront_Empty) { ProgramBuilder builder; auto* original_root = a.Create(builder.Symbols().Register("root")); - original_root->vec = {}; + original_root->vec.Clear(); Program original(std::move(builder)); ProgramBuilder cloned; @@ -444,7 +445,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertFront_Empty) { .InsertFront(original_root->vec, insertion) .Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 1u); + EXPECT_EQ(cloned_root->vec.Length(), 1u); EXPECT_EQ(cloned_root->name, cloned.Symbols().Get("root")); EXPECT_EQ(cloned_root->vec[0]->name, cloned.Symbols().Get("insertion")); @@ -469,7 +470,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertBack) { .InsertBack(original_root->vec, insertion) .Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 4u); + EXPECT_EQ(cloned_root->vec.Length(), 4u); EXPECT_EQ(cloned_root->name, cloned.Symbols().Get("root")); EXPECT_EQ(cloned_root->vec[0]->name, cloned.Symbols().Get("a")); @@ -483,7 +484,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertBack_Empty) { ProgramBuilder builder; auto* original_root = a.Create(builder.Symbols().Register("root")); - original_root->vec = {}; + original_root->vec.Clear(); Program original(std::move(builder)); ProgramBuilder cloned; @@ -493,7 +494,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertBack_Empty) { .InsertBack(original_root->vec, insertion) .Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 1u); + EXPECT_EQ(cloned_root->vec.Length(), 1u); EXPECT_EQ(cloned_root->name, cloned.Symbols().Get("root")); EXPECT_EQ(cloned_root->vec[0]->name, cloned.Symbols().Get("insertion")); @@ -504,7 +505,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertFrontAndBack_Empty) { ProgramBuilder builder; auto* original_root = a.Create(builder.Symbols().Register("root")); - original_root->vec = {}; + original_root->vec.Clear(); Program original(std::move(builder)); ProgramBuilder cloned; @@ -516,7 +517,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertFrontAndBack_Empty) { .InsertFront(original_root->vec, insertion_front) .Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 2u); + EXPECT_EQ(cloned_root->vec.Length(), 2u); EXPECT_EQ(cloned_root->name, cloned.Symbols().Get("root")); EXPECT_EQ(cloned_root->vec[0]->name, cloned.Symbols().Get("insertion_front")); @@ -542,7 +543,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertBefore) { .InsertBefore(original_root->vec, original_root->vec[1], insertion) .Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 4u); + EXPECT_EQ(cloned_root->vec.Length(), 4u); EXPECT_EQ(cloned_root->name, cloned.Symbols().Get("root")); EXPECT_EQ(cloned_root->vec[0]->name, cloned.Symbols().Get("a")); @@ -570,7 +571,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertAfter) { .InsertAfter(original_root->vec, original_root->vec[1], insertion) .Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 4u); + EXPECT_EQ(cloned_root->vec.Length(), 4u); EXPECT_EQ(cloned_root->name, cloned.Symbols().Get("root")); EXPECT_EQ(cloned_root->vec[0]->name, cloned.Symbols().Get("a")); @@ -602,7 +603,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertAfterInVectorNodeClone) { auto* cloned_root = ctx.Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 4u); + EXPECT_EQ(cloned_root->vec.Length(), 4u); EXPECT_EQ(cloned_root->name, cloned.Symbols().Get("root")); EXPECT_EQ(cloned_root->vec[0]->name, cloned.Symbols().Get("a")); @@ -634,7 +635,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertBackInVectorNodeClone) { auto* cloned_root = ctx.Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 4u); + EXPECT_EQ(cloned_root->vec.Length(), 4u); EXPECT_EQ(cloned_root->name, cloned.Symbols().Get("root")); EXPECT_EQ(cloned_root->vec[0]->name, cloned.Symbols().Get("a")); @@ -666,7 +667,7 @@ TEST_F(CloneContextNodeTest, CloneWithInsertBeforeAndAfterRemoved) { .Remove(original_root->vec, original_root->vec[1]) .Clone(original_root); - EXPECT_EQ(cloned_root->vec.size(), 4u); + EXPECT_EQ(cloned_root->vec.Length(), 4u); EXPECT_EQ(cloned_root->name, cloned.Symbols().Get("root")); EXPECT_EQ(cloned_root->vec[0]->name, cloned.Symbols().Get("a")); diff --git a/src/tint/cmd/main.cc b/src/tint/cmd/main.cc index 52dfd705e7..6f1234807f 100644 --- a/src/tint/cmd/main.cc +++ b/src/tint/cmd/main.cc @@ -15,9 +15,12 @@ #include #include #include +#include #include +#include #include #include +#include #include #if TINT_BUILD_GLSL_WRITER @@ -29,10 +32,11 @@ #include "spirv-tools/libspirv.hpp" #endif // TINT_BUILD_SPV_READER +#include "src/tint/ast/module.h" #include "src/tint/utils/io/command.h" #include "src/tint/utils/string.h" +#include "src/tint/utils/transform.h" #include "src/tint/val/val.h" -#include "src/tint/writer/flatten_bindings.h" #include "tint/tint.h" namespace { @@ -65,6 +69,7 @@ enum class Format { struct Options { bool show_help = false; + bool verbose = false; std::string input_filename; std::string output_file = "-"; // Default to stdout @@ -82,10 +87,11 @@ struct Options { std::vector transforms; - bool use_fxc = false; + std::string fxc_path; std::string dxc_path; std::string xcrun_path; - std::vector overrides; + std::unordered_map overrides; + std::optional hlsl_root_constant_binding_point; }; const char kUsage[] = R"(Usage: tint [options] @@ -112,43 +118,55 @@ ${transforms} Affects AST dumping, and text-based output languages. --dump-inspector-bindings -- Dump reflection data about bindins to stdout. -h -- This help text - --validate -- Validates the generated shader - --fxc -- Ask to validate HLSL output using FXC instead of DXC. - When specified, automatically enables --validate + --hlsl-root-constant-binding-point , -- Binding point for root constant. + Specify the binding point for generated uniform buffer + used for num_workgroups in HLSL. If not specified, then + default to binding 0 of the largest used group plus 1, + or group 0 if no resource bound. + --validate -- Validates the generated shader with all available validators + --fxc -- Path to FXC dll, used to validate HLSL output. + When specified, automatically enables HLSL validation with FXC --dxc -- Path to DXC executable, used to validate HLSL output. - When specified, automatically enables --validate + When specified, automatically enables HLSL validation with DXC --xcrun -- Path to xcrun executable, used to validate MSL output. - When specified, automatically enables --validate - --overrides -- Pipeline overrides as NAME=VALUE, comma-separated.)"; + When specified, automatically enables MSL validation + --overrides -- Override values as IDENTIFIER=VALUE, comma-separated. +)"; Format parse_format(const std::string& fmt) { (void)fmt; #if TINT_BUILD_SPV_WRITER - if (fmt == "spirv") + if (fmt == "spirv") { return Format::kSpirv; - if (fmt == "spvasm") + } + if (fmt == "spvasm") { return Format::kSpvAsm; + } #endif // TINT_BUILD_SPV_WRITER #if TINT_BUILD_WGSL_WRITER - if (fmt == "wgsl") + if (fmt == "wgsl") { return Format::kWgsl; + } #endif // TINT_BUILD_WGSL_WRITER #if TINT_BUILD_MSL_WRITER - if (fmt == "msl") + if (fmt == "msl") { return Format::kMsl; + } #endif // TINT_BUILD_MSL_WRITER #if TINT_BUILD_HLSL_WRITER - if (fmt == "hlsl") + if (fmt == "hlsl") { return Format::kHlsl; + } #endif // TINT_BUILD_HLSL_WRITER #if TINT_BUILD_GLSL_WRITER - if (fmt == "glsl") + if (fmt == "glsl") { return Format::kGlsl; + } #endif // TINT_BUILD_GLSL_WRITER return Format::kNone; @@ -202,18 +220,47 @@ Format infer_format(const std::string& filename) { return Format::kNone; } -std::vector split_on_comma(std::string list) { +std::vector split_on_char(std::string list, char c) { std::vector res; std::stringstream str(list); while (str.good()) { std::string substr; - getline(str, substr, ','); + getline(str, substr, c); res.push_back(substr); } return res; } +std::vector split_on_comma(std::string list) { + return split_on_char(list, ','); +} + +std::vector split_on_equal(std::string list) { + return split_on_char(list, '='); +} + +std::optional parse_unsigned_number(std::string number) { + for (char c : number) { + if (!std::isdigit(c)) { + // Found a non-digital char, return nullopt + return std::nullopt; + } + } + + errno = 0; + char* p_end; + uint64_t result; + // std::strtoull will not throw exception. + result = std::strtoull(number.c_str(), &p_end, 10); + if ((errno != 0) || (static_cast(p_end - number.c_str()) != number.length())) { + // Unexpected conversion result + return std::nullopt; + } + + return result; +} + std::string TextureDimensionToString(tint::inspector::ResourceBinding::TextureDimension dim) { switch (dim) { case tint::inspector::ResourceBinding::TextureDimension::kNone: @@ -353,6 +400,8 @@ bool ParseArgs(const std::vector& args, Options* opts) { } else if (arg == "-h" || arg == "--help") { opts->show_help = true; + } else if (arg == "-v" || arg == "--verbose") { + opts->verbose = true; } else if (arg == "--transform") { ++i; if (i >= args.size()) { @@ -371,8 +420,12 @@ bool ParseArgs(const std::vector& args, Options* opts) { } else if (arg == "--validate") { opts->validate = true; } else if (arg == "--fxc") { - opts->validate = true; - opts->use_fxc = true; + ++i; + if (i >= args.size()) { + std::cerr << "Missing value for " << arg << std::endl; + return false; + } + opts->fxc_path = args[i]; } else if (arg == "--dxc") { ++i; if (i >= args.size()) { @@ -380,7 +433,6 @@ bool ParseArgs(const std::vector& args, Options* opts) { return false; } opts->dxc_path = args[i]; - opts->validate = true; } else if (arg == "--xcrun") { ++i; if (i >= args.size()) { @@ -395,7 +447,35 @@ bool ParseArgs(const std::vector& args, Options* opts) { std::cerr << "Missing value for " << arg << std::endl; return false; } - opts->overrides = split_on_comma(args[i]); + for (const auto& o : split_on_comma(args[i])) { + auto parts = split_on_equal(o); + opts->overrides.insert({parts[0], std::stod(parts[1])}); + } + } else if (arg == "--hlsl-root-constant-binding-point") { + ++i; + if (i >= args.size()) { + std::cerr << "Missing value for " << arg << std::endl; + return false; + } + auto binding_points = split_on_comma(args[i]); + if (binding_points.size() != 2) { + std::cerr << "Invalid binding point for " << arg << ": " << args[i] << std::endl; + return false; + } + auto group = parse_unsigned_number(binding_points[0]); + if ((!group.has_value()) || (group.value() > std::numeric_limits::max())) { + std::cerr << "Invalid group for " << arg << ": " << binding_points[0] << std::endl; + return false; + } + auto binding = parse_unsigned_number(binding_points[1]); + if ((!binding.has_value()) || + (binding.value() > std::numeric_limits::max())) { + std::cerr << "Invalid binding for " << arg << ": " << binding_points[1] + << std::endl; + return false; + } + opts->hlsl_root_constant_binding_point = tint::sem::BindingPoint{ + static_cast(group.value()), static_cast(binding.value())}; } else if (!arg.empty()) { if (arg[0] == '-') { std::cerr << "Unrecognized option: " << arg << std::endl; @@ -717,6 +797,7 @@ bool GenerateHlsl(const tint::Program* program, const Options& options) { tint::writer::hlsl::Options gen_options; gen_options.disable_workgroup_init = options.disable_workgroup_init; gen_options.generate_external_texture_bindings = true; + gen_options.root_constant_binding_point = options.hlsl_root_constant_binding_point; auto result = tint::writer::hlsl::Generate(program, gen_options); if (!result.success) { PrintWGSL(std::cerr, *program); @@ -728,30 +809,86 @@ bool GenerateHlsl(const tint::Program* program, const Options& options) { return false; } - if (options.validate) { - tint::val::Result res; - if (options.use_fxc) { -#ifdef _WIN32 - res = tint::val::HlslUsingFXC(result.hlsl, result.entry_points, options.overrides); -#else - res.failed = true; - res.output = "FXC can only be used on Windows. Sorry :X"; -#endif // _WIN32 - } else { + // If --fxc or --dxc was passed, then we must explicitly find and validate with that respective + // compiler. + const bool must_validate_dxc = !options.dxc_path.empty(); + const bool must_validate_fxc = !options.fxc_path.empty(); + if (options.validate || must_validate_dxc || must_validate_fxc) { + tint::val::Result dxc_res; + bool dxc_found = false; + if (options.validate || must_validate_dxc) { auto dxc = tint::utils::Command::LookPath(options.dxc_path.empty() ? "dxc" : options.dxc_path); if (dxc.Found()) { - res = tint::val::HlslUsingDXC(dxc.Path(), result.hlsl, result.entry_points, - options.overrides); - } else { - res.failed = true; - res.output = "DXC executable not found. Cannot validate"; + dxc_found = true; + + auto enable_list = program->AST().Enables(); + bool dxc_require_16bit_types = false; + for (auto enable : enable_list) { + if (enable->extension == tint::ast::Extension::kF16) { + dxc_require_16bit_types = true; + break; + } + } + + dxc_res = tint::val::HlslUsingDXC(dxc.Path(), result.hlsl, result.entry_points, + dxc_require_16bit_types); + } else if (must_validate_dxc) { + // DXC was explicitly requested. Error if it could not be found. + dxc_res.failed = true; + dxc_res.output = + "DXC executable '" + options.dxc_path + "' not found. Cannot validate"; } } - if (res.failed) { - std::cerr << res.output << std::endl; + + tint::val::Result fxc_res; + bool fxc_found = false; + if (options.validate || must_validate_fxc) { + auto fxc = tint::utils::Command::LookPath( + options.fxc_path.empty() ? tint::val::kFxcDLLName : options.fxc_path); + +#ifdef _WIN32 + if (fxc.Found()) { + fxc_found = true; + fxc_res = tint::val::HlslUsingFXC(fxc.Path(), result.hlsl, result.entry_points); + } else if (must_validate_fxc) { + // FXC was explicitly requested. Error if it could not be found. + fxc_res.failed = true; + fxc_res.output = "FXC DLL '" + options.fxc_path + "' not found. Cannot validate"; + } +#else + if (must_validate_dxc) { + fxc_res.failed = true; + fxc_res.output = "FXC can only be used on Windows."; + } +#endif // _WIN32 + } + + if (fxc_res.failed) { + std::cerr << "FXC validation failure:" << std::endl << fxc_res.output << std::endl; + } + if (dxc_res.failed) { + std::cerr << "DXC validation failure:" << std::endl << dxc_res.output << std::endl; + } + if (fxc_res.failed || dxc_res.failed) { return false; } + if (!fxc_found && !dxc_found) { + std::cerr << "Couldn't find FXC or DXC. Cannot validate" << std::endl; + return false; + } + if (options.verbose) { + if (fxc_found && !fxc_res.failed) { + std::cout << "Passed FXC validation" << std::endl; + std::cout << fxc_res.output; + std::cout << std::endl; + } + if (dxc_found && !dxc_res.failed) { + std::cout << "Passed DXC validation" << std::endl; + std::cout << dxc_res.output; + std::cout << std::endl; + } + } } return true; @@ -870,23 +1007,73 @@ int main(int argc, const char** argv) { struct TransformFactory { const char* name; - std::function + /// Build and adds the transform to the transform manager. + /// Parameters: + /// inspector - an inspector created from the parsed program + /// manager - the transform manager. Add transforms to this. + /// inputs - the input data to the transform manager. Add inputs to this. + /// Returns true on success, false on error (program will immediately exit) + std::function make; }; std::vector transforms = { {"first_index_offset", - [](tint::transform::Manager& m, tint::transform::DataMap& i) { + [](tint::inspector::Inspector&, tint::transform::Manager& m, tint::transform::DataMap& i) { i.Add(0, 0); m.Add(); + return true; }}, {"fold_trivial_single_use_lets", - [](tint::transform::Manager& m, tint::transform::DataMap&) { + [](tint::inspector::Inspector&, tint::transform::Manager& m, tint::transform::DataMap&) { m.Add(); + return true; + }}, + {"renamer", + [](tint::inspector::Inspector&, tint::transform::Manager& m, tint::transform::DataMap&) { + m.Add(); + return true; + }}, + {"robustness", + [](tint::inspector::Inspector&, tint::transform::Manager& m, tint::transform::DataMap&) { + m.Add(); + return true; + }}, + {"substitute_override", + [&](tint::inspector::Inspector& inspector, tint::transform::Manager& m, + tint::transform::DataMap& i) { + tint::transform::SubstituteOverride::Config cfg; + + std::unordered_map values; + values.reserve(options.overrides.size()); + + for (const auto& [name, value] : options.overrides) { + if (name.empty()) { + std::cerr << "empty override name"; + return false; + } + if (isdigit(name[0])) { + tint::OverrideId id{ + static_cast(atoi(name.c_str()))}; + values.emplace(id, value); + } else { + auto override_names = inspector.GetNamedOverrideIds(); + auto it = override_names.find(name); + if (it == override_names.end()) { + std::cerr << "unknown override '" << name << "'"; + return false; + } + values.emplace(it->second, value); + } + } + + cfg.map = std::move(values); + + i.Add(cfg); + m.Add(); + return true; }}, - {"renamer", [](tint::transform::Manager& m, - tint::transform::DataMap&) { m.Add(); }}, - {"robustness", [](tint::transform::Manager& m, - tint::transform::DataMap&) { m.Add(); }}, }; auto transform_names = [&] { std::stringstream names; @@ -1016,8 +1203,55 @@ int main(int argc, const char** argv) { return 1; } + tint::inspector::Inspector inspector(program.get()); + + if (options.dump_inspector_bindings) { + std::cout << std::string(80, '-') << std::endl; + auto entry_points = inspector.GetEntryPoints(); + if (!inspector.error().empty()) { + std::cerr << "Failed to get entry points from Inspector: " << inspector.error() + << std::endl; + return 1; + } + + for (auto& entry_point : entry_points) { + auto bindings = inspector.GetResourceBindings(entry_point.name); + if (!inspector.error().empty()) { + std::cerr << "Failed to get bindings from Inspector: " << inspector.error() + << std::endl; + return 1; + } + std::cout << "Entry Point = " << entry_point.name << std::endl; + for (auto& binding : bindings) { + std::cout << "\t[" << binding.bind_group << "][" << binding.binding + << "]:" << std::endl; + std::cout << "\t\t resource_type = " << ResourceTypeToString(binding.resource_type) + << std::endl; + std::cout << "\t\t dim = " << TextureDimensionToString(binding.dim) << std::endl; + std::cout << "\t\t sampled_kind = " << SampledKindToString(binding.sampled_kind) + << std::endl; + std::cout << "\t\t image_format = " << TexelFormatToString(binding.image_format) + << std::endl; + } + } + std::cout << std::string(80, '-') << std::endl; + } + tint::transform::Manager transform_manager; tint::transform::DataMap transform_inputs; + + // If overrides are provided, add the SubstituteOverride transform. + if (!options.overrides.empty()) { + for (auto& t : transforms) { + if (t.name == std::string("substitute_override")) { + if (!t.make(inspector, transform_manager, transform_inputs)) { + return 1; + } + break; + } + } + } + for (const auto& name : options.transforms) { // TODO(dsinclair): The vertex pulling transform requires setup code to // be run that needs user input. Should we find a way to support that here @@ -1026,7 +1260,9 @@ int main(int argc, const char** argv) { bool found = false; for (auto& t : transforms) { if (t.name == name) { - t.make(transform_manager, transform_inputs); + if (!t.make(inspector, transform_manager, transform_inputs)) { + return 1; + } found = true; break; } @@ -1080,39 +1316,6 @@ int main(int argc, const char** argv) { *program = std::move(out.program); - if (options.dump_inspector_bindings) { - std::cout << std::string(80, '-') << std::endl; - tint::inspector::Inspector inspector(program.get()); - auto entry_points = inspector.GetEntryPoints(); - if (!inspector.error().empty()) { - std::cerr << "Failed to get entry points from Inspector: " << inspector.error() - << std::endl; - return 1; - } - - for (auto& entry_point : entry_points) { - auto bindings = inspector.GetResourceBindings(entry_point.name); - if (!inspector.error().empty()) { - std::cerr << "Failed to get bindings from Inspector: " << inspector.error() - << std::endl; - return 1; - } - std::cout << "Entry Point = " << entry_point.name << std::endl; - for (auto& binding : bindings) { - std::cout << "\t[" << binding.bind_group << "][" << binding.binding - << "]:" << std::endl; - std::cout << "\t\t resource_type = " << ResourceTypeToString(binding.resource_type) - << std::endl; - std::cout << "\t\t dim = " << TextureDimensionToString(binding.dim) << std::endl; - std::cout << "\t\t sampled_kind = " << SampledKindToString(binding.sampled_kind) - << std::endl; - std::cout << "\t\t image_format = " << TexelFormatToString(binding.image_format) - << std::endl; - } - } - std::cout << std::string(80, '-') << std::endl; - } - bool success = false; switch (options.format) { case Format::kSpirv: diff --git a/src/tint/demangler.cc b/src/tint/demangler.cc index 0116be0ad4..d68a62a825 100644 --- a/src/tint/demangler.cc +++ b/src/tint/demangler.cc @@ -49,7 +49,7 @@ std::string Demangler::Demangle(const SymbolTable& symbols, const std::string& s auto len = end_idx - start_idx; auto id = str.substr(start_idx, len); - Symbol sym(std::stoi(id), symbols.ProgramID()); + Symbol sym(static_cast(std::stoi(id)), symbols.ProgramID()); out << symbols.NameFor(sym); pos = end_idx; diff --git a/src/tint/fuzzers/BUILD.gn b/src/tint/fuzzers/BUILD.gn index 2b477627bd..25e475e08f 100644 --- a/src/tint/fuzzers/BUILD.gn +++ b/src/tint/fuzzers/BUILD.gn @@ -85,6 +85,10 @@ if (build_with_chromium) { "tint_reader_writer_fuzzer.h", "transform_builder.h", ] + + if (is_mac) { + sources += [ "//testing/libfuzzer/libfuzzer_exports.h" ] + } } source_set("tint_fuzzer_common_with_init_src") { @@ -161,6 +165,15 @@ if (build_with_chromium) { seed_corpus_deps = [ ":tint_generate_wgsl_corpus" ] } + fuzzer_test("tint_concurrency_fuzzer") { + sources = [ "tint_concurrency_fuzzer.cc" ] + deps = [ ":tint_fuzzer_common_with_init_src" ] + dict = "dictionary.txt" + libfuzzer_options = tint_fuzzer_common_libfuzzer_options + seed_corpus = fuzzer_corpus_wgsl_dir + seed_corpus_deps = [ ":tint_generate_wgsl_corpus" ] + } + fuzzer_test("tint_first_index_offset_fuzzer") { sources = [ "tint_first_index_offset_fuzzer.cc" ] deps = [ ":tint_fuzzer_common_with_init_src" ] diff --git a/src/tint/fuzzers/CMakeLists.txt b/src/tint/fuzzers/CMakeLists.txt index 55c99637fd..7be123738a 100644 --- a/src/tint/fuzzers/CMakeLists.txt +++ b/src/tint/fuzzers/CMakeLists.txt @@ -45,6 +45,7 @@ endif() if (${TINT_BUILD_WGSL_READER} AND ${TINT_BUILD_SPV_WRITER}) add_tint_fuzzer(tint_all_transforms_fuzzer) add_tint_fuzzer(tint_binding_remapper_fuzzer) + add_tint_fuzzer(tint_concurrency_fuzzer) add_tint_fuzzer(tint_first_index_offset_fuzzer) add_tint_fuzzer(tint_renamer_fuzzer) add_tint_fuzzer(tint_robustness_fuzzer) diff --git a/src/tint/fuzzers/dictionary.txt b/src/tint/fuzzers/dictionary.txt index 8f15ff6f58..005735f1dc 100644 --- a/src/tint/fuzzers/dictionary.txt +++ b/src/tint/fuzzers/dictionary.txt @@ -1,63 +1,165 @@ +"!" +"!=" +"%" +"%=" "&" "&&" -"->" -"[[" -"]]" -"/" -"!" -"[" -"]" -"{" -"}" -":" +"&=" +"(" +")" +"*" +"*=" +"+" +"++" +"+=" "," +"-" +"--" +"-=" +"->" +"." +"/" +"/=" +":" +";" +"<" +"<<" +"<<=" +"<=" "=" "==" ">" ">=" -"<" -"<=" -"%" -"-" -"::" -"!=" -"." -"+" -"|" -"||" -"(" -")" -";" -"*" +">>" +">>=" +"@" +"[" +"]" "^" +"^=" +"_" +"{" +"|" +"|=" +"||" +"}" +"~" +"a" +"abs" +"acos" +"acosh" +"@align" +"all" +"any" "array" -"binding" +"arrayLength" +"asin" +"asinh" +"atan" +"atan2" +"atanh" +"atomic" +"atomicAdd" +"atomicAnd" +"atomicLoad" +"atomicMax" +"atomicMin" +"atomicOr" +"atomicStore" +"atomicSub" +"atomicXor" +"b" +"@binding" "bitcast" "bool" -"block" "break" -"builtin" +"@builtin" +"@builtin(frag_depth)" +"@builtin(front_facing)" +"@builtin(global_invocation_id)" +"@builtin(instance_index)" +"@builtin(local_invocation_id)" +"@builtin(local_invocation_index)" +"@builtin(num_workgroups)" +"@builtin(position)" +"@builtin(sample_index)" +"@builtin(sample_mask)" +"@builtin(vertex_index)" +"@builtin(workgroup_id)" "case" -"compute" +"ceil" +"center" +"centroid" +"clamp" +"@compute" +"@const" "const" "continue" "continuing" -"discard" +"cos" +"cosh" +"countLeadingZeros" +"countOneBits" +"countTrailingZeros" +"cross" "default" +"degrees" +"determinant" +"discard" +"distance" +"dot" +"dpdx" +"dpdxCoarse" +"dpdxFine" +"dpdy" +"dpdyCoarse" +"dpdyFine" "else" -"elseif" +"enable" +"exp" +"exp2" +"extractBits" +"f16" "f32" +"faceForward" "fallthrough" "false" +"firstLeadingBit" +"firstTrailingBit" +"flat" +"floor" +"fma" "fn" -"fragment" +"for" +"fract" +"frag_depth" +"@fragment" +"frexp" +"front_facing" "function" +"fwidth" +"fwidthCoarse" +"fwidthFine" +"g" +"global_invocation_id" +"@group" "i32" +"@id" "if" -"image" -"import" -"in" -"location" +"insertBits" +"instance_index" +"@interpolate" +"@invariant" +"inverseSqrt" +"ldexp" +"length" +"let" +"linear" +"local_invocation_id" +"local_invocation_index" +"@location" +"log" +"log2" "loop" "mat2x2" "mat2x3" @@ -68,45 +170,124 @@ "mat4x2" "mat4x3" "mat4x4" -"offset" -"out" +"max" +"min" +"mix" +"modf" +"normalize" +"num_workgroups" +"override" +"pack2x16float" +"pack2x16snorm" +"pack2x16unorm" +"pack4x8snorm" +"pack4x8unorm" +"perspective" +"position" +"pow" "private" "ptr" +"quantizeToF16" +"r" +"r32float" +"r32sint" +"r32uint" +"radians" +"read" +"read_write" +"reflect" +"refract" "return" +"reverseBits" +"rg32float" +"rg32sint" +"rg32uint" +"rgba16float" +"rgba16sint" +"rgba16uint" +"rgba32float" +"rgba32sint" +"rgba32uint" +"rgba8sint" +"rgba8snorm" +"rgba8uint" +"rgba8unorm" +"round" +"sample" +"sample_index" +"sample_mask" "sampler" "sampler_comparison" -"set" +"saturate" +"select" +"sign" +"sin" +"sinh" +"@size" +"smoothstep" +"sqrt" +"staticAssert" +"step" "storage" -"stage" -"stride" +"storageBarrier" "struct" "switch" -"texture_depth_2d" -"texture_depth_2d_array" -"texture_depth_cube" -"texture_depth_cube_array" -"texture_depth_multisampled_2d" -"texture_multisampled_2d" -"texture_storage_1d" -"texture_storage_2d_array" -"texture_storage_2d" -"texture_storage_2d_array" -"texture_storage_3d" +"tan" +"tanh" "texture_1d" "texture_2d" "texture_2d_array" "texture_3d" "texture_cube" "texture_cube_array" +"texture_depth_2d" +"texture_depth_2d_array" +"texture_depth_cube" +"texture_depth_cube_array" +"texture_depth_multisampled_2d" +"textureDimensions" +"textureGather" +"textureGatherCompare" +"textureLoad" +"texture_multisampled_2d" +"textureNumLayers" +"textureNumLevels" +"textureNumSamples" +"textureSample" +"textureSampleBias" +"textureSampleCompare" +"textureSampleCompareLevel" +"textureSampleGrad" +"textureSampleLevel" +"texture_storage_1d" +"texture_storage_2d" +"texture_storage_2d_array" +"texture_storage_3d" +"textureStore" +"transpose" "true" +"trunc" "type" "u32" "uniform" +"unpack2x16float" +"unpack2x16snorm" +"unpack2x16unorm" +"unpack4x8snorm" +"unpack4x8unorm" "var" "vec2" "vec3" "vec4" -"vertex" -"void" +"@vertex" +"vertex_index" +"w" +"while" "workgroup" -"workgroup_size" +"workgroupBarrier" +"workgroup_id" +"@workgroup_size" +"write" +"x" +"y" +"z" diff --git a/src/tint/fuzzers/fuzzer_init.cc b/src/tint/fuzzers/fuzzer_init.cc index 3d3f692712..66f701a4a5 100644 --- a/src/tint/fuzzers/fuzzer_init.cc +++ b/src/tint/fuzzers/fuzzer_init.cc @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/tint/fuzzers/fuzzer_init.h" +#include + #include "src/tint/fuzzers/cli.h" +#include "src/tint/fuzzers/fuzzer_init.h" +#include "testing/libfuzzer/libfuzzer_exports.h" namespace tint::fuzzers { diff --git a/src/tint/fuzzers/random_generator.cc b/src/tint/fuzzers/random_generator.cc index 186ce1c39b..35b5caf7ec 100644 --- a/src/tint/fuzzers/random_generator.cc +++ b/src/tint/fuzzers/random_generator.cc @@ -34,10 +34,9 @@ namespace { /// @param size - number of elements in buffer /// @returns hash of the data in the buffer size_t HashBuffer(const uint8_t* data, const size_t size) { - size_t hash = 102931; - utils::HashCombine(&hash, size); + size_t hash = utils::Hash(size); for (size_t i = 0; i < size; i++) { - utils::HashCombine(&hash, data[i]); + hash = utils::HashCombine(hash, data[i]); } return hash; } diff --git a/src/tint/fuzzers/tint_ast_fuzzer/BUILD.gn b/src/tint/fuzzers/tint_ast_fuzzer/BUILD.gn index 69ef3fef91..58a36ea566 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/BUILD.gn +++ b/src/tint/fuzzers/tint_ast_fuzzer/BUILD.gn @@ -46,6 +46,8 @@ if (build_with_chromium) { "expression_size.cc", "expression_size.h", "fuzzer.cc", + "jump_tracker.cc", + "jump_tracker.h", "mutation.cc", "mutation.h", "mutation_finder.cc", @@ -54,6 +56,8 @@ if (build_with_chromium) { "mutation_finders/change_binary_operators.h", "mutation_finders/change_unary_operators.cc", "mutation_finders/change_unary_operators.h", + "mutation_finders/delete_statements.cc", + "mutation_finders/delete_statements.h", "mutation_finders/replace_identifiers.cc", "mutation_finders/replace_identifiers.h", "mutation_finders/wrap_unary_operators.cc", @@ -62,6 +66,8 @@ if (build_with_chromium) { "mutations/change_binary_operator.h", "mutations/change_unary_operator.cc", "mutations/change_unary_operator.h", + "mutations/delete_statement.cc", + "mutations/delete_statement.h", "mutations/replace_identifier.cc", "mutations/replace_identifier.h", "mutations/wrap_unary_operator.cc", diff --git a/src/tint/fuzzers/tint_ast_fuzzer/CMakeLists.txt b/src/tint/fuzzers/tint_ast_fuzzer/CMakeLists.txt index 5bd8c507bd..0d1f5a2558 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/CMakeLists.txt +++ b/src/tint/fuzzers/tint_ast_fuzzer/CMakeLists.txt @@ -39,14 +39,17 @@ set(LIBTINT_AST_FUZZER_SOURCES ../random_generator.h ../random_generator_engine.h expression_size.h + jump_tracker.h mutation.h mutation_finder.h mutation_finders/change_binary_operators.h mutation_finders/change_unary_operators.h + mutation_finders/delete_statements.h mutation_finders/replace_identifiers.h mutation_finders/wrap_unary_operators.h mutations/change_binary_operator.h mutations/change_unary_operator.h + mutations/delete_statement.h mutations/replace_identifier.h mutations/wrap_unary_operator.h mutator.h @@ -61,14 +64,17 @@ set(LIBTINT_AST_FUZZER_SOURCES ${LIBTINT_AST_FUZZER_SOURCES} ../random_generator.cc ../random_generator_engine.cc expression_size.cc + jump_tracker.cc mutation.cc mutation_finder.cc mutation_finders/change_binary_operators.cc mutation_finders/change_unary_operators.cc + mutation_finders/delete_statements.cc mutation_finders/replace_identifiers.cc mutation_finders/wrap_unary_operators.cc mutations/change_binary_operator.cc mutations/change_unary_operator.cc + mutations/delete_statement.cc mutations/replace_identifier.cc mutations/wrap_unary_operator.cc mutator.cc @@ -107,8 +113,10 @@ add_tint_ast_fuzzer(tint_ast_wgsl_writer_fuzzer) if (${TINT_BUILD_TESTS}) set(TEST_SOURCES expression_size_test.cc + jump_tracker_test.cc mutations/change_binary_operator_test.cc mutations/change_unary_operator_test.cc + mutations/delete_statement_test.cc mutations/replace_identifier_test.cc mutations/wrap_unary_operator_test.cc) diff --git a/src/tint/fuzzers/tint_ast_fuzzer/fuzzer.cc b/src/tint/fuzzers/tint_ast_fuzzer/fuzzer.cc index 20601dfba3..383135db54 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/fuzzer.cc +++ b/src/tint/fuzzers/tint_ast_fuzzer/fuzzer.cc @@ -21,9 +21,9 @@ #include "src/tint/fuzzers/tint_ast_fuzzer/override_cli_params.h" #include "src/tint/fuzzers/tint_common_fuzzer.h" #include "src/tint/fuzzers/transform_builder.h" - #include "src/tint/reader/wgsl/parser.h" #include "src/tint/writer/wgsl/generator.h" +#include "testing/libfuzzer/libfuzzer_exports.h" namespace tint::fuzzers::ast_fuzzer { namespace { diff --git a/src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.cc b/src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.cc new file mode 100644 index 0000000000..66bbaf7c85 --- /dev/null +++ b/src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.cc @@ -0,0 +1,83 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.h" + +#include +#include + +#include "src/tint/ast/break_statement.h" +#include "src/tint/ast/discard_statement.h" +#include "src/tint/ast/for_loop_statement.h" +#include "src/tint/ast/loop_statement.h" +#include "src/tint/ast/return_statement.h" +#include "src/tint/ast/switch_statement.h" +#include "src/tint/ast/while_statement.h" +#include "src/tint/sem/statement.h" + +namespace tint::fuzzers::ast_fuzzer { + +JumpTracker::JumpTracker(const Program& program) { + // Consider every AST node, looking for break, return and discard statements. + for (auto* node : program.ASTNodes().Objects()) { + auto* stmt = node->As(); + if (stmt == nullptr) { + continue; + } + if (stmt->As()) { + // This break statement either exits a loop or a switch statement. + // Walk up the AST until either a loop or switch statement is found. In the former case, + // it is the innermost loop containing the break statement, and thus all the nodes + // encountered along the way are nodes that contain a break from the innermost loop. + + // This records the statements encountered when walking up the AST from the break + // statement to the innermost enclosing loop or switch statement. + std::unordered_set candidate_statements; + for (const ast::Statement* current = stmt;; + current = + As(program.Sem().Get(current))->Parent()->Declaration()) { + if (current->Is() || current->Is() || + current->Is()) { + // A loop has been encountered, thus all that statements recorded until this + // point contain a break from their innermost loop. + for (auto* candidate : candidate_statements) { + contains_break_for_innermost_loop_.insert(candidate); + } + break; + } + if (current->Is()) { + // A switch statement has been encountered, so the break does not correspond to + // a loop break. + break; + } + candidate_statements.insert(current); + } + } else if (stmt->As() || stmt->As()) { + // Walk up the AST from the return or discard statement, recording that every node + // encountered along the way contains a return/discard. + auto& target_set = stmt->As() ? contains_return_ + : contains_intraprocedural_discard_; + const ast::Statement* current = stmt; + while (true) { + target_set.insert(current); + auto* parent = program.Sem().Get(current)->Parent(); + if (parent == nullptr) { + break; + } + current = parent->Declaration(); + } + } + } +} +} // namespace tint::fuzzers::ast_fuzzer diff --git a/src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.h b/src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.h new file mode 100644 index 0000000000..614ceb5281 --- /dev/null +++ b/src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.h @@ -0,0 +1,68 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_FUZZERS_TINT_AST_FUZZER_JUMP_TRACKER_H_ +#define SRC_TINT_FUZZERS_TINT_AST_FUZZER_JUMP_TRACKER_H_ + +#include + +#include "src/tint/ast/statement.h" +#include "src/tint/program.h" + +namespace tint::fuzzers::ast_fuzzer { + +/// This class computes information on which statements contain loop breaks, returns and discards. +/// It could be extended to handle other jumps, such as switch breaks and loop continues, should +/// such information prove useful. +class JumpTracker { + public: + /// Initializes jump tracking information for the given program. + /// @param program - the program for which jumps will be tracked; + /// must remain in scope as long as this instance exists. + explicit JumpTracker(const Program& program); + + /// Indicates whether a statement contains a break statement for the innermost loop (if any). + /// @param statement - the statement of interest. + /// @return true if and only if the statement is, or contains, a break for the innermost + /// enclosing loop. + bool ContainsBreakForInnermostLoop(const ast::Statement& statement) const { + return contains_break_for_innermost_loop_.count(&statement) > 0; + } + + /// Indicates whether a statement contains a return statement. + /// @param statement - the statement of interest. + /// @return true if and only if the statement is, or contains, a return statement. + bool ContainsReturn(const ast::Statement& statement) const { + return contains_return_.count(&statement) > 0; + } + + /// Indicates whether a statement contains a discard statement. + /// @param statement - the statement of interest. + /// @return true if and only if the statement is, or contains, a discard statement. This is + /// determined in an intraprocedural fashion: the answer will be "false" if no discard occurs + /// inside the statement, even if the statement calls a function that may lead to a discard + /// being performed. + bool ContainsIntraproceduralDiscard(const ast::Statement& statement) const { + return contains_intraprocedural_discard_.count(&statement) > 0; + } + + private: + std::unordered_set contains_break_for_innermost_loop_; + std::unordered_set contains_return_; + std::unordered_set contains_intraprocedural_discard_; +}; + +} // namespace tint::fuzzers::ast_fuzzer + +#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_JUMP_TRACKER_H_ diff --git a/src/tint/fuzzers/tint_ast_fuzzer/jump_tracker_test.cc b/src/tint/fuzzers/tint_ast_fuzzer/jump_tracker_test.cc new file mode 100644 index 0000000000..f83e639a73 --- /dev/null +++ b/src/tint/fuzzers/tint_ast_fuzzer/jump_tracker_test.cc @@ -0,0 +1,332 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.h" + +#include + +#include "gtest/gtest.h" + +#include "src/tint/ast/block_statement.h" +#include "src/tint/ast/break_statement.h" +#include "src/tint/ast/discard_statement.h" +#include "src/tint/ast/for_loop_statement.h" +#include "src/tint/ast/if_statement.h" +#include "src/tint/ast/loop_statement.h" +#include "src/tint/ast/module.h" +#include "src/tint/ast/return_statement.h" +#include "src/tint/ast/switch_statement.h" +#include "src/tint/ast/while_statement.h" +#include "src/tint/program.h" +#include "src/tint/reader/wgsl/parser.h" + +namespace tint::fuzzers::ast_fuzzer { +namespace { + +TEST(JumpTrackerTest, Breaks) { + std::string content = R"( +fn main() { + var x : u32; + for (var i : i32 = 0; i < 100; i++) { + if (i == 40) { + { + break; + } + } + for (var j : i32 = 0; j < 10; j++) { + loop { + if (i > j) { + break; + } + continuing { + i++; + j-=2; + } + } + switch (j) { + case 0: { + if (i == j) { + break; + } + i = i + 1; + continue; + } + default: { + break; + } + } + } + } +} + )"; + Source::File file("test.wgsl", content); + auto program = reader::wgsl::Parse(&file); + ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); + + JumpTracker jump_tracker(program); + + const auto* outer_loop_body = + program.AST().Functions()[0]->body->statements[1]->As()->body; + const auto* first_if = outer_loop_body->statements[0]->As(); + const auto* first_if_body = first_if->body; + const auto* block_in_first_if = first_if_body->statements[0]->As(); + const auto* break_in_first_if = block_in_first_if->statements[0]->As(); + + const auto* innermost_loop_body = outer_loop_body->statements[1] + ->As() + ->body->statements[0] + ->As() + ->body; + const auto* innermost_loop_if = innermost_loop_body->statements[0]->As(); + const auto* innermost_loop_if_body = innermost_loop_if->body; + const auto* break_in_innermost_loop = + innermost_loop_if_body->statements[0]->As(); + + std::unordered_set containing_loop_break = { + outer_loop_body, first_if, + first_if_body, block_in_first_if, + break_in_first_if, innermost_loop_body, + innermost_loop_if, innermost_loop_if_body, + break_in_innermost_loop}; + + for (auto* node : program.ASTNodes().Objects()) { + auto* stmt = node->As(); + if (stmt == nullptr) { + continue; + } + if (containing_loop_break.count(stmt) > 0) { + ASSERT_TRUE(jump_tracker.ContainsBreakForInnermostLoop(*stmt)); + } else { + ASSERT_FALSE(jump_tracker.ContainsBreakForInnermostLoop(*stmt)); + } + } +} + +TEST(JumpTrackerTest, Returns) { + std::string content = R"( +fn main() { + var x : u32; + for (var i : i32 = 0; i < 100; i++) { + if (i == 40) { + { + return; + } + } + for (var j : i32 = 0; j < 10; j++) { + loop { + if (i > j) { + return; + } + continuing { + i++; + j-=2; + } + } + switch (j) { + case 0: { + if (i == j) { + break; + } + i = i + 1; + continue; + } + default: { + return; + } + } + } + } +} + )"; + Source::File file("test.wgsl", content); + auto program = reader::wgsl::Parse(&file); + ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); + + JumpTracker jump_tracker(program); + + const auto* function_body = program.AST().Functions()[0]->body; + const auto* outer_loop = function_body->statements[1]->As(); + const auto* outer_loop_body = outer_loop->body; + const auto* first_if = outer_loop_body->statements[0]->As(); + const auto* first_if_body = first_if->body; + const auto* block_in_first_if = first_if_body->statements[0]->As(); + const auto* return_in_first_if = block_in_first_if->statements[0]->As(); + const auto* inner_for_loop = outer_loop_body->statements[1]->As(); + const auto* inner_for_loop_body = inner_for_loop->body; + const auto* innermost_loop = inner_for_loop_body->statements[0]->As(); + const auto* innermost_loop_body = innermost_loop->body; + const auto* innermost_loop_if = innermost_loop_body->statements[0]->As(); + const auto* innermost_loop_if_body = innermost_loop_if->body; + const auto* return_in_innermost_loop = + innermost_loop_if_body->statements[0]->As(); + const auto* switch_statement = inner_for_loop_body->statements[1]->As(); + const auto* default_statement = switch_statement->body[1]; + const auto* default_statement_body = default_statement->body; + const auto* return_in_default_statement = + default_statement_body->statements[0]->As(); + + std::unordered_set containing_return = { + function_body, outer_loop, + outer_loop_body, first_if, + first_if_body, block_in_first_if, + return_in_first_if, inner_for_loop, + inner_for_loop_body, innermost_loop, + innermost_loop_body, innermost_loop_if, + innermost_loop_if_body, return_in_innermost_loop, + switch_statement, default_statement, + default_statement_body, return_in_default_statement}; + + for (auto* node : program.ASTNodes().Objects()) { + auto* stmt = node->As(); + if (stmt == nullptr) { + continue; + } + if (containing_return.count(stmt) > 0) { + ASSERT_TRUE(jump_tracker.ContainsReturn(*stmt)); + } else { + ASSERT_FALSE(jump_tracker.ContainsReturn(*stmt)); + } + } +} + +TEST(JumpTrackerTest, Discards) { + std::string content = R"( +fn main() { + var x : u32; + for (var i : i32 = 0; i < 100; i++) { + if (i == 40) { + { + discard; + } + } + for (var j : i32 = 0; j < 10; j++) { + loop { + if (i > j) { + discard; + } + continuing { + i++; + j-=2; + } + } + switch (j) { + case 0: { + if (i == j) { + break; + } + i = i + 1; + continue; + } + default: { + discard; + } + } + } + } +} + )"; + Source::File file("test.wgsl", content); + auto program = reader::wgsl::Parse(&file); + ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); + + JumpTracker jump_tracker(program); + + const auto* function_body = program.AST().Functions()[0]->body; + const auto* outer_loop = function_body->statements[1]->As(); + const auto* outer_loop_body = outer_loop->body; + const auto* first_if = outer_loop_body->statements[0]->As(); + const auto* first_if_body = first_if->body; + const auto* block_in_first_if = first_if_body->statements[0]->As(); + const auto* discard_in_first_if = block_in_first_if->statements[0]->As(); + const auto* inner_for_loop = outer_loop_body->statements[1]->As(); + const auto* inner_for_loop_body = inner_for_loop->body; + const auto* innermost_loop = inner_for_loop_body->statements[0]->As(); + const auto* innermost_loop_body = innermost_loop->body; + const auto* innermost_loop_if = innermost_loop_body->statements[0]->As(); + const auto* innermost_loop_if_body = innermost_loop_if->body; + const auto* discard_in_innermost_loop = + innermost_loop_if_body->statements[0]->As(); + const auto* switch_statement = inner_for_loop_body->statements[1]->As(); + const auto* default_statement = switch_statement->body[1]; + const auto* default_statement_body = default_statement->body; + const auto* discard_in_default_statement = + default_statement_body->statements[0]->As(); + + std::unordered_set containing_discard = { + function_body, outer_loop, + outer_loop_body, first_if, + first_if_body, block_in_first_if, + discard_in_first_if, inner_for_loop, + inner_for_loop_body, innermost_loop, + innermost_loop_body, innermost_loop_if, + innermost_loop_if_body, discard_in_innermost_loop, + switch_statement, default_statement, + default_statement_body, discard_in_default_statement}; + + for (auto* node : program.ASTNodes().Objects()) { + auto* stmt = node->As(); + if (stmt == nullptr) { + continue; + } + if (containing_discard.count(stmt) > 0) { + ASSERT_TRUE(jump_tracker.ContainsIntraproceduralDiscard(*stmt)); + } else { + ASSERT_FALSE(jump_tracker.ContainsIntraproceduralDiscard(*stmt)); + } + } +} + +TEST(JumpTrackerTest, WhileLoop) { + std::string content = R"( +fn main() { + var x : u32; + x = 0; + while (x < 100) { + if (x > 50) { + break; + } + x = x + 1; + } +} + )"; + Source::File file("test.wgsl", content); + auto program = reader::wgsl::Parse(&file); + ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); + + JumpTracker jump_tracker(program); + + const auto* while_loop_body = + program.AST().Functions()[0]->body->statements[2]->As()->body; + const auto* if_statement = while_loop_body->statements[0]->As(); + const auto* if_statement_body = if_statement->body; + const auto* break_in_if = if_statement_body->statements[0]->As(); + + std::unordered_set containing_loop_break = { + while_loop_body, if_statement, if_statement_body, break_in_if}; + + for (auto* node : program.ASTNodes().Objects()) { + auto* stmt = node->As(); + if (stmt == nullptr) { + continue; + } + if (containing_loop_break.count(stmt) > 0) { + ASSERT_TRUE(jump_tracker.ContainsBreakForInnermostLoop(*stmt)); + } else { + ASSERT_FALSE(jump_tracker.ContainsBreakForInnermostLoop(*stmt)); + } + } +} + +} // namespace +} // namespace tint::fuzzers::ast_fuzzer diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutation.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutation.cc index 6f60fc3349..62c970b84a 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/mutation.cc +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutation.cc @@ -18,6 +18,7 @@ #include "src/tint/fuzzers/tint_ast_fuzzer/mutations/change_binary_operator.h" #include "src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.h" #include "src/tint/fuzzers/tint_ast_fuzzer/mutations/replace_identifier.h" #include "src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.h" @@ -33,6 +34,8 @@ std::unique_ptr Mutation::FromMessage(const protobufs::Mutation& messa return std::make_unique(message.replace_identifier()); case protobufs::Mutation::kChangeBinaryOperator: return std::make_unique(message.change_binary_operator()); + case protobufs::Mutation::kDeleteStatement: + return std::make_unique(message.delete_statement()); case protobufs::Mutation::kWrapUnaryOperator: return std::make_unique(message.wrap_unary_operator()); case protobufs::Mutation::MUTATION_NOT_SET: diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc index ed2f442ccf..c8dff2cc8d 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc @@ -16,6 +16,7 @@ #include +#include "src/tint/ast/unary_op_expression.h" #include "src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.h" #include "src/tint/fuzzers/tint_ast_fuzzer/util.h" #include "src/tint/sem/reference.h" @@ -49,6 +50,12 @@ MutationList MutationFinderChangeUnaryOperators::FindMutations( continue; } + // Only complement and negation operators can be swapped. + if (!(unary_expr->op == ast::UnaryOp::kComplement || + unary_expr->op == ast::UnaryOp::kNegation)) { + continue; + } + result.push_back(std::make_unique( node_id_map->GetId(unary_expr), MutationChangeUnaryOperator::ToggleOperator(unary_expr->op))); diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/delete_statements.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/delete_statements.cc new file mode 100644 index 0000000000..f1d7e4d6d6 --- /dev/null +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/delete_statements.cc @@ -0,0 +1,68 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/delete_statements.h" + +#include + +#include "src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/util.h" +#include "src/tint/sem/expression.h" +#include "src/tint/sem/statement.h" +#include "src/tint/sem/variable.h" + +namespace tint::fuzzers::ast_fuzzer { + +MutationList MutationFinderDeleteStatements::FindMutations(const tint::Program& program, + NodeIdMap* node_id_map, + ProbabilityContext* /*unused*/) const { + MutationList result; + + JumpTracker jump_tracker(program); + + // Consider every statement node in the AST. + for (auto* node : program.ASTNodes().Objects()) { + auto* statement_node = tint::As(node); + + if (!statement_node) { + continue; + } + + const auto* statement_sem_node = + tint::As(program.Sem().Get(statement_node)); + + // Semantic information for the node is required in order to delete it. + if (!statement_sem_node) { + continue; + } + + // Check that this kind of statement can be deleted. + if (!MutationDeleteStatement::CanBeDeleted(*statement_node, program, jump_tracker)) { + continue; + } + + result.push_back( + std::make_unique(node_id_map->GetId(statement_node))); + } + + return result; +} + +uint32_t MutationFinderDeleteStatements::GetChanceOfApplyingMutation( + ProbabilityContext* probability_context) const { + return probability_context->GetChanceOfDeletingStatements(); +} + +} // namespace tint::fuzzers::ast_fuzzer diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/delete_statements.h b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/delete_statements.h new file mode 100644 index 0000000000..97a4cbf988 --- /dev/null +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/delete_statements.h @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATION_FINDERS_DELETE_STATEMENTS_H_ +#define SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATION_FINDERS_DELETE_STATEMENTS_H_ + +#include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finder.h" + +namespace tint::fuzzers::ast_fuzzer { + +/// Looks for opportunities to apply +/// `MutationFinderDeleteStatements`. +/// +/// Considers statements for deletion if their deletion would not make the module invalid. +class MutationFinderDeleteStatements : public MutationFinder { + public: + MutationList FindMutations(const tint::Program& program, + NodeIdMap* node_id_map, + ProbabilityContext* probability_context) const override; + uint32_t GetChanceOfApplyingMutation(ProbabilityContext* probability_context) const override; +}; + +} // namespace tint::fuzzers::ast_fuzzer + +#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATION_FINDERS_DELETE_STATEMENTS_H_ diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_binary_operator.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_binary_operator.cc index d27fa7f2b9..6e78cb510b 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_binary_operator.cc +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_binary_operator.cc @@ -16,6 +16,8 @@ #include +#include "src/tint/program_builder.h" +#include "src/tint/sem/bool.h" #include "src/tint/sem/reference.h" namespace tint::fuzzers::ast_fuzzer { diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.h b/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.h index d80ec3f271..1fa84a8095 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.h +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.h @@ -15,6 +15,7 @@ #ifndef SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATIONS_CHANGE_UNARY_OPERATOR_H_ #define SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATIONS_CHANGE_UNARY_OPERATOR_H_ +#include "src/tint/ast/unary_op.h" #include "src/tint/fuzzers/tint_ast_fuzzer/mutation.h" #include "src/tint/sem/variable.h" diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.cc new file mode 100644 index 0000000000..05435d0c12 --- /dev/null +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.cc @@ -0,0 +1,208 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.h" + +#include +#include +#include + +#include "src/tint/ast/block_statement.h" +#include "src/tint/ast/fallthrough_statement.h" +#include "src/tint/ast/for_loop_statement.h" +#include "src/tint/ast/if_statement.h" +#include "src/tint/ast/loop_statement.h" +#include "src/tint/ast/variable_decl_statement.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/util.h" +#include "src/tint/program_builder.h" +#include "src/tint/sem/for_loop_statement.h" +#include "src/tint/sem/if_statement.h" +#include "src/tint/sem/loop_statement.h" +#include "src/tint/sem/statement.h" + +namespace tint::fuzzers::ast_fuzzer { + +MutationDeleteStatement::MutationDeleteStatement(protobufs::MutationDeleteStatement message) + : message_(std::move(message)) {} + +MutationDeleteStatement::MutationDeleteStatement(uint32_t statement_id) { + message_.set_statement_id(statement_id); +} + +bool MutationDeleteStatement::IsApplicable(const tint::Program& program, + const NodeIdMap& node_id_map) const { + auto* statement_node = tint::As(node_id_map.GetNode(message_.statement_id())); + + if (!statement_node) { + // The statement id is invalid or does not refer to a statement. + return false; + } + + const auto* statement_sem_node = tint::As(program.Sem().Get(statement_node)); + + if (!statement_sem_node) { + // Semantic information for the statement is not available. This + // information is required in order to perform the deletion. + return false; + } + + // Check whether it is OK to delete this statement. + if (!CanBeDeleted(*statement_node, program, JumpTracker(program))) { + return false; + } + + return true; +} + +void MutationDeleteStatement::Apply(const NodeIdMap& node_id_map, + tint::CloneContext* clone_context, + NodeIdMap* /* unused */) const { + const auto* statement_node = + tint::As(node_id_map.GetNode(message_.statement_id())); + const auto* statement_sem_node = + tint::As(clone_context->src->Sem().Get(statement_node)); + const auto* sem_parent = statement_sem_node->Parent(); + + if (tint::Is(sem_parent) && + tint::As(sem_parent->Declaration())->else_statement == statement_node) { + // Remove the "else" part of an if statement. + clone_context->Replace(statement_node, static_cast(nullptr)); + } else if (tint::Is(sem_parent) && + tint::As(sem_parent->Declaration())->initializer == + statement_node) { + // Remove the initializer of a for loop. + clone_context->Replace(statement_node, static_cast(nullptr)); + } else if (tint::Is(sem_parent) && + tint::As(sem_parent->Declaration())->continuing == + statement_node) { + // Remove the "continuing" statement of a for loop. + clone_context->Replace(statement_node, static_cast(nullptr)); + } else if (tint::Is(statement_sem_node)) { + // Remove the "continuing" block of a loop. + clone_context->Replace(statement_node, static_cast(nullptr)); + } else if (tint::Is(statement_node)) { + // Remove a case statement from its enclosing switch statement. + const auto& case_statement_list = + &sem_parent->Declaration()->As()->body; + assert(std::find(case_statement_list->begin(), case_statement_list->end(), + statement_node) != case_statement_list->end() && + "Statement not found."); + clone_context->Remove(*case_statement_list, statement_node); + } else if (tint::Is(statement_node)) { + // Remove a block statement from the block that encloses it. A special case is required for + // this, since a sem::Block has itself as its associated sem::Block, so it is necessary to + // look at the parent to get the enclosing block. + const auto& statement_list = + sem_parent->Declaration()->As()->statements; + assert(std::find(statement_list.begin(), statement_list.end(), statement_node) != + statement_list.end() && + "Statement not found."); + clone_context->Remove(statement_list, statement_node); + } else { + // Remove a non-block statement from the block that encloses it. + const auto& statement_list = + statement_sem_node->Block()->Declaration()->As()->statements; + assert(std::find(statement_list.begin(), statement_list.end(), statement_node) != + statement_list.end() && + "Statement not found."); + clone_context->Remove(statement_list, statement_node); + } +} + +protobufs::Mutation MutationDeleteStatement::ToMessage() const { + protobufs::Mutation mutation; + *mutation.mutable_delete_statement() = message_; + return mutation; +} + +bool MutationDeleteStatement::CanBeDeleted(const ast::Statement& statement_node, + const Program& program, + const JumpTracker& jump_tracker) { + if (statement_node.Is()) { + // This is conservative. It would be possible to delete variable declarations if they are + // not used. Further analysis could allow that. + return false; + } + + if (jump_tracker.ContainsReturn(statement_node) || + jump_tracker.ContainsIntraproceduralDiscard(statement_node)) { + // This is conservative. It would be possible to delete a return/discard statement as long + // as there is still a return/discard on every control flow path. + return false; + } + + if (jump_tracker.ContainsBreakForInnermostLoop(statement_node)) { + // This is conservative. Disallowing the removal of breaks ensures that loops cannot become + // statically infinite. However, a loop might in practice have multiple breaks, some of + // which can be removed. + return false; + } + + if (auto* case_statement = statement_node.As()) { + // It is not OK to delete the final case statement in a switch statement if the penultimate + // case statement falls through to the final case statement. + auto* switch_statement = + program.Sem().Get(case_statement)->Parent()->Declaration()->As(); + + if (switch_statement->body.Length() > 1 && + switch_statement->body[switch_statement->body.Length() - 1] == case_statement) { + // There are at least two case statements, and this is the final case statement. + auto& penultimate_case_statement_body_statements = + switch_statement->body[switch_statement->body.Length() - 2]->body->statements; + if (penultimate_case_statement_body_statements.Length() > 0 && + penultimate_case_statement_body_statements + [penultimate_case_statement_body_statements.Length() - 1] + ->Is()) { + // The penultimate case statement falls through to the final case statement, thus + // the final case statement cannot be removed. + return false; + } + } + } + + auto* parent_sem = program.Sem().Get(&statement_node)->Parent(); + if (parent_sem == nullptr) { + // Semantic information for the parent node is required. + return false; + } + + auto* parent_stmt = parent_sem->Declaration(); + + // It does not make sense to delete the entire body of a loop or if statement. + if (auto* for_loop = parent_stmt->As()) { + if (for_loop->body == &statement_node) { + return false; + } + } + if (auto* loop = parent_stmt->As()) { + if (loop->body == &statement_node) { + return false; + } + } + if (auto* while_loop = parent_stmt->As()) { + if (while_loop->body == &statement_node) { + return false; + } + } + if (auto* if_statement = parent_stmt->As()) { + if (if_statement->body == &statement_node) { + return false; + } + } + + return true; +} + +} // namespace tint::fuzzers::ast_fuzzer diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.h b/src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.h new file mode 100644 index 0000000000..c7c01924b6 --- /dev/null +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.h @@ -0,0 +1,75 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATIONS_DELETE_STATEMENT_H_ +#define SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATIONS_DELETE_STATEMENT_H_ + +#include "src/tint/ast/statement.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/jump_tracker.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/mutation.h" + +namespace tint::fuzzers::ast_fuzzer { + +/// @see MutationDeleteStatement::Apply +class MutationDeleteStatement : public Mutation { + public: + /// @brief Constructs an instance of this mutation from a protobuf message. + /// @param message - protobuf message + explicit MutationDeleteStatement(protobufs::MutationDeleteStatement message); + + /// @brief Constructor. + /// @param statement_id - the id of the statement to delete. + explicit MutationDeleteStatement(uint32_t statement_id); + + /// @copybrief Mutation::IsApplicable + /// + /// The mutation is applicable iff: + /// - `statement_id` corresponds to a statement in the AST. + /// - `statement_id` does not refer to a variable declaration, since the declared variables will + /// be inaccessible if the statement is deleted. + /// - `statement_id` is not a return statement, since removing return statements arbitrarily can + /// make the program invalid. + /// - `statement_id` is not a break statement, since removing break statements can lead to + /// syntactically infinite loops. + /// + /// @copydetails Mutation::IsApplicable + bool IsApplicable(const tint::Program& program, const NodeIdMap& node_id_map) const override; + + /// @copybrief Mutation::Apply + /// + /// Delete the statement referenced by `statement_id`. + /// + /// @copydetails Mutation::Apply + void Apply(const NodeIdMap& node_id_map, + tint::CloneContext* clone_context, + NodeIdMap* new_node_id_map) const override; + + protobufs::Mutation ToMessage() const override; + + /// Return whether the given statement is suitable for deletion. + /// @param statement_node - the statement to be considered for deletion. + /// @param program - the program containing the statement. + /// @param jump_tracker - information about jump statements for the program. + /// @return true if and only if it is OK to delete the statement. + static bool CanBeDeleted(const ast::Statement& statement_node, + const Program& program, + const JumpTracker& jump_tracker); + + private: + protobufs::MutationDeleteStatement message_; +}; + +} // namespace tint::fuzzers::ast_fuzzer + +#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATIONS_DELETE_STATEMENT_H_ diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement_test.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement_test.cc new file mode 100644 index 0000000000..925ee8008a --- /dev/null +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement_test.cc @@ -0,0 +1,750 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/fuzzers/tint_ast_fuzzer/mutations/delete_statement.h" + +#include +#include + +#include "gtest/gtest.h" + +#include "src/tint/ast/assignment_statement.h" +#include "src/tint/ast/block_statement.h" +#include "src/tint/ast/case_statement.h" +#include "src/tint/ast/fallthrough_statement.h" +#include "src/tint/ast/for_loop_statement.h" +#include "src/tint/ast/if_statement.h" +#include "src/tint/ast/switch_statement.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/mutator.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/node_id_map.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/probability_context.h" +#include "src/tint/program_builder.h" +#include "src/tint/reader/wgsl/parser.h" +#include "src/tint/writer/wgsl/generator.h" + +namespace tint::fuzzers::ast_fuzzer { +namespace { + +void CheckStatementDeletionWorks( + const std::string& original, + const std::string& expected, + const std::function& statement_finder) { + Source::File original_file("original.wgsl", original); + auto program = reader::wgsl::Parse(&original_file); + + Source::File expected_file("expected.wgsl", expected); + auto expected_program = reader::wgsl::Parse(&expected_file); + + ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); + ASSERT_TRUE(expected_program.IsValid()) << expected_program.Diagnostics().str(); + + NodeIdMap node_id_map(program); + const auto* statement = statement_finder(program); + ASSERT_NE(statement, nullptr); + auto statement_id = node_id_map.GetId(statement); + ASSERT_NE(statement_id, 0); + ASSERT_TRUE(MaybeApplyMutation(program, MutationDeleteStatement(statement_id), node_id_map, + &program, &node_id_map, nullptr)); + ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); + writer::wgsl::Options options; + auto transformed_result = writer::wgsl::Generate(&program, options); + auto expected_result = writer::wgsl::Generate(&expected_program, options); + ASSERT_TRUE(transformed_result.success) << transformed_result.error; + ASSERT_TRUE(expected_result.success) << expected_result.error; + ASSERT_EQ(expected_result.wgsl, transformed_result.wgsl); +} + +void CheckStatementDeletionNotAllowed( + const std::string& original, + const std::function& statement_finder) { + Source::File original_file("original.wgsl", original); + auto program = reader::wgsl::Parse(&original_file); + + ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); + + NodeIdMap node_id_map(program); + const auto* statement = statement_finder(program); + ASSERT_NE(statement, nullptr); + auto statement_id = node_id_map.GetId(statement); + ASSERT_NE(statement_id, 0); + ASSERT_FALSE(MaybeApplyMutation(program, MutationDeleteStatement(statement_id), node_id_map, + &program, &node_id_map, nullptr)); +} + +TEST(DeleteStatementTest, DeleteAssignStatement) { + auto original = R"( + fn main() { + { + var a : i32 = 5; + a = 6; + } + })"; + auto expected = R"(fn main() { + { + var a : i32 = 5; + } +} +)"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->statements[1] + ->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteForStatement) { + auto original = + R"( + fn main() { + for (var i : i32 = 0; i < 10; i++) { + } + } + )"; + auto expected = "fn main() { }"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteIfStatement) { + auto original = + R"( + fn main() { + if (true) { } else { } + } + )"; + auto expected = "fn main() { }"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteBlockStatement) { + auto original = "fn main() { { } }"; + auto expected = "fn main() { }"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteSwitchStatement) { + auto original = R"( +fn main() { + switch(1) { + case 0, 1: { + } + default: { + fallthrough; + } + case 2: { + } + } +})"; + auto expected = R"(fn main() { })"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteCaseStatement) { + auto original = R"( +fn main() { + switch(1) { + case 0, 1: { + } + default: { + fallthrough; + } + case 2: { + } + } +})"; + auto expected = R"( +fn main() { + switch(1) { + default: { + fallthrough; + } + case 2: { + } + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->body[0] + ->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteFallthroughStatement) { + auto original = R"( +fn main() { + switch(1) { + case 0, 1: { + } + default: { + fallthrough; + } + case 2: { + } + } +})"; + auto expected = R"( +fn main() { + switch(1) { + case 0, 1: { + } + default: { + } + case 2: { + } + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->body[1] + ->As() + ->body->statements[0] + ->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteElse) { + auto original = R"( +fn main() { + if (true) { + } else { + } +})"; + auto expected = R"( +fn main() { + if (true) { + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->else_statement; + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteCall) { + auto original = R"( +fn main() { + sin(1.0); +})"; + auto expected = R"( +fn main() { +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteCompoundAssign) { + auto original = R"( +fn main() { + var x : i32 = 0; + x += 2;; +})"; + auto expected = R"( +fn main() { + var x : i32 = 0; +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[1] + ->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteLoop) { + auto original = R"( +fn main() { + var x : i32 = 0; + loop { + if (x > 100) { + break; + } + continuing { + x++; + } + } +})"; + auto expected = R"( +fn main() { + var x : i32 = 0; +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[1]->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteContinuingBlock) { + auto original = R"( +fn main() { + var x : i32 = 0; + loop { + if (x > 100) { + break; + } + continuing { + x++; + } + } +})"; + auto expected = R"( +fn main() { + var x : i32 = 0; + loop { + if (x > 100) { + break; + } + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[1] + ->As() + ->continuing; + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteContinue) { + auto original = R"( +fn main() { + var x : i32 = 0; + loop { + if (x > 100) { + break; + } + continue; + continuing { + x++; + } + } +})"; + auto expected = R"( +fn main() { + var x : i32 = 0; + loop { + if (x > 100) { + break; + } + continuing { + x++; + } + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[1] + ->As() + ->body->statements[1] + ->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteIncrement) { + auto original = R"( +fn main() { + var x : i32 = 0; + loop { + if (x > 100) { + break; + } + continuing { + x++; + } + } +})"; + auto expected = R"( +fn main() { + var x : i32 = 0; + loop { + if (x > 100) { + break; + } + continuing { + } + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[1] + ->As() + ->continuing->statements[0] + ->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteForLoopInitializer) { + auto original = R"( +fn main() { + var x : i32; + for (x = 0; x < 100; x++) { + } +})"; + auto expected = R"( +fn main() { + var x : i32; + for (; x < 100; x++) { + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[1] + ->As() + ->initializer->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DeleteForLoopContinuing) { + auto original = R"( +fn main() { + var x : i32; + for (x = 0; x < 100; x++) { + } +})"; + auto expected = R"( +fn main() { + var x : i32; + for (x = 0; x < 100;) { + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[1] + ->As() + ->continuing->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, AllowDeletionOfInnerLoopWithBreak) { + auto original = R"( +fn main() { + loop { + loop { + break; + } + break; + } +})"; + auto expected = R"( +fn main() { + loop { + break; + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->body->statements[0] + ->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, AllowDeletionOfInnerCaseWithBreak) { + auto original = R"( +fn main() { + loop { + switch(0) { + case 1: { + break; + } + default: { + } + } + break; + } +})"; + auto expected = R"( +fn main() { + loop { + switch(0) { + default: { + } + } + break; + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->body->statements[0] + ->As() + ->body[0]; + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, AllowDeletionOfBreakFromSwitch) { + auto original = R"( +fn main() { + switch(0) { + case 1: { + break; + } + default: { + } + } +})"; + auto expected = R"( +fn main() { + switch(0) { + case 1: { + } + default: { + } + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->body[0] + ->body->statements[0] + ->As(); + }; + CheckStatementDeletionWorks(original, expected, statement_finder); +} + +TEST(DeleteStatementTest, DoNotDeleteVariableDeclaration) { + auto original = R"( +fn main() { + var x : i32; +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotDeleteCaseDueToFallthrough) { + auto original = R"( +fn main() { + switch(1) { + default: { + fallthrough; + } + case 2: { + } + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->body[1] + ->As(); + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotMakeLoopInfinite1) { + auto original = R"( +fn main() { + loop { + break; + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->body->statements[0] + ->As(); + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotMakeLoopInfinite2) { + auto original = R"( +fn main() { + loop { + if (true) { + break; + } + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST() + .Functions()[0] + ->body->statements[0] + ->As() + ->body->statements[0] + ->As(); + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotRemoveReturn) { + auto original = R"( +fn main() { + return; +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotRemoveStatementContainingReturn) { + auto original = R"( +fn foo() -> i32 { + if (true) { + return 1; + } else { + return 2; + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotRemoveDiscard) { + auto original = R"( +fn main() { + discard; +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotRemoveStatementContainingDiscard) { + auto original = R"( +fn foo() -> i32 { + if (true) { + discard; + } else { + discard; + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As(); + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotRemoveLoopBody) { + auto original = R"( +fn foo() { + discard; +} +fn main() { + loop { + foo(); + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[1]->body->statements[0]->As()->body; + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotRemoveForLoopBody) { + auto original = R"( +fn main() { + for(var i : i32 = 0; i < 10; i++) { + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As()->body; + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotRemoveWhileBody) { + auto original = R"( +fn main() { + var i : i32 = 0; + while(i < 10) { + i++; + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[1]->As()->body; + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotRemoveIfBody) { + auto original = R"( +fn main() { + if(true) { + } +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body->statements[0]->As()->body; + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +TEST(DeleteStatementTest, DoNotRemoveFunctionBody) { + auto original = R"( +fn main() { +})"; + auto statement_finder = [](const Program& program) -> const ast::Statement* { + return program.AST().Functions()[0]->body; + }; + CheckStatementDeletionNotAllowed(original, statement_finder); +} + +} // namespace +} // namespace tint::fuzzers::ast_fuzzer diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/replace_identifier_test.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutations/replace_identifier_test.cc index 737cb07c2e..f20104753e 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/mutations/replace_identifier_test.cc +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/replace_identifier_test.cc @@ -275,8 +275,8 @@ TEST(ReplaceIdentifierTest, NotApplicable5) { // (`read` for uniform storage class). std::string shader = R"( struct S { - a: i32; -}; + a: i32 +} var a: S; @group(1) @binding(1) var b: S; @@ -310,8 +310,8 @@ TEST(ReplaceIdentifierTest, NotApplicable6) { // Can't replace `ptr_b` with `a` since the latter is not a pointer. std::string shader = R"( struct S { - a: i32; -}; + a: i32 +} var a: S; @group(1) @binding(1) var b: S; @@ -346,12 +346,12 @@ TEST(ReplaceIdentifierTest, NotApplicable8) { // storage class. std::string shader = R"( struct S { - a: i32; -}; + a: i32 +} var a: S; @group(1) @binding(1) var b: S; -@group(1) @binding(2) var c: S; +@group(1) @binding(2) var c: S; fn f() { let ptr_b = &b; *&a = *ptr_b; @@ -382,8 +382,8 @@ TEST(ReplaceIdentifierTest, NotApplicable9) { // Can't replace `b` with `e` since the latter is not a reference. std::string shader = R"( struct S { - a: i32; -}; + a: i32 +} var a: S; let e = 3; @@ -418,11 +418,11 @@ TEST(ReplaceIdentifierTest, NotApplicable10) { // Can't replace `b` with `e` since the latter has a wrong access mode. std::string shader = R"( struct S { - a: i32; -}; + a: i32 +} var a: S; -@group(0) @binding(0) var e: S; +@group(0) @binding(0) var e: S; @group(1) @binding(1) var b: S; fn f() { *&a = *&b; diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.cc index 8b52732a33..d6612f5486 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.cc +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.cc @@ -18,6 +18,8 @@ #include #include "src/tint/program_builder.h" +#include "src/tint/sem/abstract_float.h" +#include "src/tint/sem/abstract_int.h" namespace tint::fuzzers::ast_fuzzer { @@ -98,7 +100,8 @@ std::vector MutationWrapUnaryOperator::GetValidUnaryWrapper( return {ast::UnaryOp::kNot}; } - if (expr_type->is_signed_scalar_or_vector()) { + if (expr_type->is_signed_scalar_or_vector() || + expr_type->is_abstract_integer_scalar_or_vector()) { return {ast::UnaryOp::kNegation, ast::UnaryOp::kComplement}; } @@ -106,7 +109,7 @@ std::vector MutationWrapUnaryOperator::GetValidUnaryWrapper( return {ast::UnaryOp::kComplement}; } - if (expr_type->is_float_scalar_or_vector()) { + if (expr_type->is_float_scalar_or_vector() || expr_type->is_abstract_float_scalar_or_vector()) { return {ast::UnaryOp::kNegation}; } diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.h b/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.h index ec28bf9528..96d09268a7 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.h +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.h @@ -19,6 +19,7 @@ #include "src/tint/fuzzers/tint_ast_fuzzer/mutation.h" +#include "src/tint/ast/unary_op.h" #include "src/tint/sem/variable.h" namespace tint::fuzzers::ast_fuzzer { diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutator.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutator.cc index f70a9479f8..7153f0c2d7 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/mutator.cc +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutator.cc @@ -22,6 +22,7 @@ #include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_binary_operators.h" #include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.h" +#include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/delete_statements.h" #include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/replace_identifiers.h" #include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/wrap_unary_operators.h" #include "src/tint/fuzzers/tint_ast_fuzzer/node_id_map.h" @@ -48,6 +49,8 @@ MutationFinderList CreateMutationFinders(ProbabilityContext* probability_context probability_context, &result); MaybeAddFinder(enable_all_mutations, probability_context, &result); + MaybeAddFinder(enable_all_mutations, probability_context, + &result); MaybeAddFinder(enable_all_mutations, probability_context, &result); MaybeAddFinder(enable_all_mutations, probability_context, diff --git a/src/tint/fuzzers/tint_ast_fuzzer/probability_context.cc b/src/tint/fuzzers/tint_ast_fuzzer/probability_context.cc index 639bd60fbf..f2cb1596c0 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/probability_context.cc +++ b/src/tint/fuzzers/tint_ast_fuzzer/probability_context.cc @@ -21,6 +21,7 @@ namespace { const std::pair kChanceOfChangingBinaryOperators = {30, 90}; const std::pair kChanceOfChangingUnaryOperators = {30, 70}; +const std::pair kChanceOfDeletingStatements = {30, 70}; const std::pair kChanceOfReplacingIdentifiers = {30, 70}; const std::pair kChanceOfWrappingUnaryOperators = {30, 70}; @@ -30,6 +31,7 @@ ProbabilityContext::ProbabilityContext(RandomGenerator* generator) : generator_(generator), chance_of_changing_binary_operators_(RandomFromRange(kChanceOfChangingBinaryOperators)), chance_of_changing_unary_operators_(RandomFromRange(kChanceOfChangingUnaryOperators)), + chance_of_deleting_statements_(RandomFromRange(kChanceOfDeletingStatements)), chance_of_replacing_identifiers_(RandomFromRange(kChanceOfReplacingIdentifiers)), chance_of_wrapping_unary_operators_(RandomFromRange(kChanceOfWrappingUnaryOperators)) { assert(generator != nullptr && "generator must not be nullptr"); diff --git a/src/tint/fuzzers/tint_ast_fuzzer/probability_context.h b/src/tint/fuzzers/tint_ast_fuzzer/probability_context.h index ce467386b9..410d7cfc92 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/probability_context.h +++ b/src/tint/fuzzers/tint_ast_fuzzer/probability_context.h @@ -61,6 +61,9 @@ class ProbabilityContext { return chance_of_changing_unary_operators_; } + /// @return the probability of changing operator for a binary expression. + uint32_t GetChanceOfDeletingStatements() const { return chance_of_deleting_statements_; } + /// @return the probability of replacing some identifier with some other one. uint32_t GetChanceOfReplacingIdentifiers() const { return chance_of_replacing_identifiers_; } @@ -78,6 +81,7 @@ class ProbabilityContext { uint32_t chance_of_changing_binary_operators_; uint32_t chance_of_changing_unary_operators_; + uint32_t chance_of_deleting_statements_; uint32_t chance_of_replacing_identifiers_; uint32_t chance_of_wrapping_unary_operators_; }; diff --git a/src/tint/fuzzers/tint_ast_fuzzer/protobufs/tint_ast_fuzzer.proto b/src/tint/fuzzers/tint_ast_fuzzer/protobufs/tint_ast_fuzzer.proto index fd3cd81454..b1fa5e3bac 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/protobufs/tint_ast_fuzzer.proto +++ b/src/tint/fuzzers/tint_ast_fuzzer/protobufs/tint_ast_fuzzer.proto @@ -22,6 +22,7 @@ message Mutation { MutationChangeBinaryOperator change_binary_operator = 2; MutationWrapUnaryOperator wrap_unary_operator = 3; MutationChangeUnaryOperator change_unary_operator = 4; + MutationDeleteStatement delete_statement = 5; }; } @@ -64,6 +65,14 @@ message MutationChangeUnaryOperator { uint32 new_operator = 2; } +message MutationDeleteStatement { + // This transformation deletes a statement, as long as doing so does not + // invalidate the program. + + // The id of a statement to be deleted. + uint32 statement_id = 1; +} + message MutationReplaceIdentifier { // This transformation replaces a use of one variable with another. diff --git a/src/tint/fuzzers/tint_common_fuzzer.cc b/src/tint/fuzzers/tint_common_fuzzer.cc index bbea6fce08..f547d559c7 100644 --- a/src/tint/fuzzers/tint_common_fuzzer.cc +++ b/src/tint/fuzzers/tint_common_fuzzer.cc @@ -219,12 +219,7 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) { switch (output_) { case OutputFormat::kWGSL: { #if TINT_BUILD_WGSL_WRITER - auto result = writer::wgsl::Generate(&program, options_wgsl_); - generated_wgsl_ = std::move(result.wgsl); - if (!result.success) { - VALIDITY_ERROR(program.Diagnostics(), - "WGSL writer errored on validated input:\n" + result.error); - } + writer::wgsl::Generate(&program, options_wgsl_); #endif // TINT_BUILD_WGSL_WRITER break; } @@ -232,10 +227,6 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) { #if TINT_BUILD_SPV_WRITER auto result = writer::spirv::Generate(&program, options_spirv_); generated_spirv_ = std::move(result.spirv); - if (!result.success) { - VALIDITY_ERROR(program.Diagnostics(), - "SPIR-V writer errored on validated input:\n" + result.error); - } if (!SPIRVToolsValidationCheck(program, generated_spirv_)) { VALIDITY_ERROR(program.Diagnostics(), @@ -247,12 +238,7 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) { } case OutputFormat::kHLSL: { #if TINT_BUILD_HLSL_WRITER - auto result = writer::hlsl::Generate(&program, options_hlsl_); - generated_hlsl_ = std::move(result.hlsl); - if (!result.success) { - VALIDITY_ERROR(program.Diagnostics(), - "HLSL writer errored on validated input:\n" + result.error); - } + writer::hlsl::Generate(&program, options_hlsl_); #endif // TINT_BUILD_HLSL_WRITER break; } @@ -266,12 +252,7 @@ int CommonFuzzer::Run(const uint8_t* data, size_t size) { input_program = &*flattened; } - auto result = writer::msl::Generate(input_program, options_msl_); - generated_msl_ = std::move(result.msl); - if (!result.success) { - VALIDITY_ERROR(input_program->Diagnostics(), - "MSL writer errored on validated input:\n" + result.error); - } + writer::msl::Generate(input_program, options_msl_); #endif // TINT_BUILD_MSL_WRITER break; } @@ -287,10 +268,10 @@ void CommonFuzzer::RunInspector(Program* program) { auto entry_points = inspector.GetEntryPoints(); CHECK_INSPECTOR(program, inspector); - auto constant_ids = inspector.GetConstantIDs(); + auto override_ids = inspector.GetOverrideDefaultValues(); CHECK_INSPECTOR(program, inspector); - auto constant_name_to_id = inspector.GetConstantNameToIdMap(); + auto override_name_to_id = inspector.GetNamedOverrideIds(); CHECK_INSPECTOR(program, inspector); for (auto& ep : entry_points) { diff --git a/src/tint/fuzzers/tint_concurrency_fuzzer.cc b/src/tint/fuzzers/tint_concurrency_fuzzer.cc new file mode 100644 index 0000000000..945cc0e045 --- /dev/null +++ b/src/tint/fuzzers/tint_concurrency_fuzzer.cc @@ -0,0 +1,127 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include + +#include + +#include "src/tint/inspector/inspector.h" +#include "src/tint/reader/wgsl/parser.h" +#include "src/tint/utils/hash.h" +#include "src/tint/writer/flatten_bindings.h" +#include "src/tint/writer/glsl/generator.h" +#include "src/tint/writer/hlsl/generator.h" +#include "src/tint/writer/msl/generator.h" +#include "src/tint/writer/spirv/generator.h" +#include "src/tint/writer/wgsl/generator.h" + +static constexpr size_t kNumThreads = 32; + +[[noreturn]] void TintInternalCompilerErrorReporter(const tint::diag::List& diagnostics) { + auto printer = tint::diag::Printer::create(stderr, true); + tint::diag::Formatter{}.format(diagnostics, printer.get()); + __builtin_trap(); +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + tint::SetInternalCompilerErrorReporter(&TintInternalCompilerErrorReporter); + + std::string str(reinterpret_cast(data), size); + auto file = std::make_unique("test.wgsl", str); + auto program = tint::reader::wgsl::Parse(file.get()); + if (!program.IsValid()) { + return 0; + } + + tint::inspector::Inspector inspector(&program); + auto entry_points = inspector.GetEntryPoints(); + std::string entry_point = entry_points.empty() ? "" : entry_points.front().name; + + std::array threads; + + for (size_t thread_idx = 0; thread_idx < kNumThreads; thread_idx++) { + auto thread = std::thread([&program, thread_idx, entry_point] { + enum class Writer { +#if TINT_BUILD_GLSL_WRITER + kGLSL, +#endif +#if TINT_BUILD_HLSL_WRITER + kHLSL, +#endif +#if TINT_BUILD_MSL_WRITER + kMSL, +#endif +#if TINT_BUILD_SPV_WRITER + kSPIRV, +#endif +#if TINT_BUILD_WGSL_WRITER + kWGSL, +#endif + kCount + }; + switch (static_cast(thread_idx % static_cast(Writer::kCount))) { +#if TINT_BUILD_WGSL_WRITER + case Writer::kWGSL: { + tint::writer::wgsl::Generate(&program, {}); + break; + } +#endif // TINT_BUILD_WGSL_WRITER + +#if TINT_BUILD_SPV_WRITER + case Writer::kSPIRV: { + tint::writer::spirv::Generate(&program, {}); + break; + } +#endif // TINT_BUILD_SPV_WRITER + +#if TINT_BUILD_HLSL_WRITER + case Writer::kHLSL: { + tint::writer::hlsl::Generate(&program, {}); + break; + } +#endif // TINT_BUILD_HLSL_WRITER + +#if TINT_BUILD_GLSL_WRITER + case Writer::kGLSL: { + tint::writer::glsl::Generate(&program, {}, entry_point); + break; + } +#endif // TINT_BUILD_GLSL_WRITER + +#if TINT_BUILD_MSL_WRITER + case Writer::kMSL: { + // Remap resource numbers to a flat namespace. + if (auto flattened = tint::writer::FlattenBindings(&program)) { + tint::writer::msl::Generate(&flattened.value(), {}); + } + break; + } +#endif // TINT_BUILD_MSL_WRITER + + case Writer::kCount: + break; + } + }); + threads[thread_idx] = std::move(thread); + } + + for (auto& thread : threads) { + thread.join(); + } + + return 0; +} diff --git a/src/tint/fuzzers/tint_regex_fuzzer/fuzzer.cc b/src/tint/fuzzers/tint_regex_fuzzer/fuzzer.cc index ac3468489b..f17987dd14 100644 --- a/src/tint/fuzzers/tint_regex_fuzzer/fuzzer.cc +++ b/src/tint/fuzzers/tint_regex_fuzzer/fuzzer.cc @@ -24,6 +24,7 @@ #include "src/tint/fuzzers/transform_builder.h" #include "src/tint/reader/wgsl/parser.h" #include "src/tint/writer/wgsl/generator.h" +#include "testing/libfuzzer/libfuzzer_exports.h" namespace tint::fuzzers::regex_fuzzer { namespace { @@ -37,6 +38,10 @@ enum class MutationKind { kReplaceIdentifier, kReplaceLiteral, kInsertReturnStatement, + kReplaceOperator, + kInsertBreakOrContinue, + kReplaceFunctionCallWithBuiltin, + kAddSwizzle, kNumMutationKinds }; @@ -64,43 +69,65 @@ extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* data, MutationKind mutation_kind = static_cast( generator.GetUInt32(static_cast(MutationKind::kNumMutationKinds))); + WgslMutator mutator(generator); switch (mutation_kind) { case MutationKind::kSwapIntervals: - if (!SwapRandomIntervals(delimiter, wgsl_code, generator)) { + if (!mutator.SwapRandomIntervals(delimiter, wgsl_code)) { return 0; } break; case MutationKind::kDeleteInterval: - if (!DeleteRandomInterval(delimiter, wgsl_code, generator)) { + if (!mutator.DeleteRandomInterval(delimiter, wgsl_code)) { return 0; } break; case MutationKind::kDuplicateInterval: - if (!DuplicateRandomInterval(delimiter, wgsl_code, generator)) { + if (!mutator.DuplicateRandomInterval(delimiter, wgsl_code)) { return 0; } break; case MutationKind::kReplaceIdentifier: - if (!ReplaceRandomIdentifier(wgsl_code, generator)) { + if (!mutator.ReplaceRandomIdentifier(wgsl_code)) { return 0; } break; case MutationKind::kReplaceLiteral: - if (!ReplaceRandomIntLiteral(wgsl_code, generator)) { + if (!mutator.ReplaceRandomIntLiteral(wgsl_code)) { return 0; } break; case MutationKind::kInsertReturnStatement: - if (!InsertReturnStatement(wgsl_code, generator)) { + if (!mutator.InsertReturnStatement(wgsl_code)) { return 0; } break; + case MutationKind::kReplaceOperator: + if (!mutator.ReplaceRandomOperator(wgsl_code)) { + return 0; + } + break; + + case MutationKind::kInsertBreakOrContinue: + if (!mutator.InsertBreakOrContinue(wgsl_code)) { + return 0; + } + break; + case MutationKind::kReplaceFunctionCallWithBuiltin: + if (!mutator.ReplaceFunctionCallWithBuiltin(wgsl_code)) { + return 0; + } + break; + case MutationKind::kAddSwizzle: + if (!mutator.AddSwizzle(wgsl_code)) { + return 0; + } + break; default: assert(false && "Unreachable"); return 0; diff --git a/src/tint/fuzzers/tint_regex_fuzzer/regex_fuzzer_tests.cc b/src/tint/fuzzers/tint_regex_fuzzer/regex_fuzzer_tests.cc index b344a69eca..fb1d5089a6 100644 --- a/src/tint/fuzzers/tint_regex_fuzzer/regex_fuzzer_tests.cc +++ b/src/tint/fuzzers/tint_regex_fuzzer/regex_fuzzer_tests.cc @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include "gtest/gtest.h" @@ -21,26 +22,49 @@ namespace tint::fuzzers::regex_fuzzer { namespace { +class WgslMutatorTest : public WgslMutator { + public: + explicit WgslMutatorTest(RandomGenerator& generator) : WgslMutator(generator) {} + + using WgslMutator::DeleteInterval; + using WgslMutator::DuplicateInterval; + using WgslMutator::FindClosingBracket; + using WgslMutator::FindOperatorOccurrence; + using WgslMutator::GetFunctionBodyPositions; + using WgslMutator::GetFunctionCallIdentifiers; + using WgslMutator::GetIdentifiers; + using WgslMutator::GetIntLiterals; + using WgslMutator::GetLoopBodyPositions; + using WgslMutator::GetSwizzles; + using WgslMutator::GetVectorConstructors; + using WgslMutator::ReplaceRegion; + using WgslMutator::SwapIntervals; +}; + // Swaps two non-consecutive regions in the edge TEST(SwapRegionsTest, SwapIntervalsEdgeNonConsecutive) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;"; std::string all_regions = R1 + R2 + R3; // this call should swap R1 with R3. - SwapIntervals(0, R1.length(), R1.length() + R2.length(), R3.length(), all_regions); + mutator.SwapIntervals(0, R1.length(), R1.length() + R2.length(), R3.length(), all_regions); ASSERT_EQ(R3 + R2 + R1, all_regions); } // Swaps two non-consecutive regions not in the edge TEST(SwapRegionsTest, SwapIntervalsNonConsecutiveNonEdge) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;", R4 = ";regionregionregionregion4;", R5 = ";regionregionregionregionregion5;"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // this call should swap R2 with R4. - SwapIntervals(R1.length(), R2.length(), R1.length() + R2.length() + R3.length(), R4.length(), - all_regions); + mutator.SwapIntervals(R1.length(), R2.length(), R1.length() + R2.length() + R3.length(), + R4.length(), all_regions); ASSERT_EQ(R1 + R4 + R3 + R2 + R5, all_regions); } @@ -48,12 +72,15 @@ TEST(SwapRegionsTest, SwapIntervalsNonConsecutiveNonEdge) { // Swaps two consecutive regions not in the edge (sorrounded by other // regions) TEST(SwapRegionsTest, SwapIntervalsConsecutiveEdge) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;", R4 = ";regionregionregionregion4;", R5 = ";regionregionregionregionregion5;"; std::string all_regions = R1 + R2 + R3 + R4; // this call should swap R2 with R3. - SwapIntervals(R1.length(), R2.length(), R1.length() + R2.length(), R3.length(), all_regions); + mutator.SwapIntervals(R1.length(), R2.length(), R1.length() + R2.length(), R3.length(), + all_regions); ASSERT_EQ(R1 + R3 + R2 + R4, all_regions); } @@ -61,164 +88,181 @@ TEST(SwapRegionsTest, SwapIntervalsConsecutiveEdge) { // Swaps two consecutive regions not in the edge (not sorrounded by other // regions) TEST(SwapRegionsTest, SwapIntervalsConsecutiveNonEdge) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;", R4 = ";regionregionregionregion4;", R5 = ";regionregionregionregionregion5;"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // this call should swap R4 with R5. - SwapIntervals(R1.length() + R2.length() + R3.length(), R4.length(), - R1.length() + R2.length() + R3.length() + R4.length(), R5.length(), all_regions); + mutator.SwapIntervals(R1.length() + R2.length() + R3.length(), R4.length(), + R1.length() + R2.length() + R3.length() + R4.length(), R5.length(), + all_regions); ASSERT_EQ(R1 + R2 + R3 + R5 + R4, all_regions); } // Deletes the first region. TEST(DeleteRegionTest, DeleteFirstRegion) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;", R4 = ";regionregionregionregion4;", R5 = ";regionregionregionregionregion5;"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // This call should delete R1. - DeleteInterval(0, R1.length(), all_regions); + mutator.DeleteInterval(0, R1.length(), all_regions); ASSERT_EQ(";" + R2 + R3 + R4 + R5, all_regions); } // Deletes the last region. TEST(DeleteRegionTest, DeleteLastRegion) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;", R4 = ";regionregionregionregion4;", R5 = ";regionregionregionregionregion5;"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // This call should delete R5. - DeleteInterval(R1.length() + R2.length() + R3.length() + R4.length(), R5.length(), all_regions); + mutator.DeleteInterval(R1.length() + R2.length() + R3.length() + R4.length(), R5.length(), + all_regions); ASSERT_EQ(R1 + R2 + R3 + R4 + ";", all_regions); } // Deletes the middle region. TEST(DeleteRegionTest, DeleteMiddleRegion) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;", R4 = ";regionregionregionregion4;", R5 = ";regionregionregionregionregion5;"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // This call should delete R3. - DeleteInterval(R1.length() + R2.length(), R3.length(), all_regions); + mutator.DeleteInterval(R1.length() + R2.length(), R3.length(), all_regions); ASSERT_EQ(R1 + R2 + ";" + R4 + R5, all_regions); } TEST(InsertRegionTest, InsertRegionTest1) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;", R4 = ";regionregionregionregion4;", R5 = ";regionregionregionregionregion5;"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // This call should insert R2 after R4. - DuplicateInterval(R1.length(), R2.length(), - R1.length() + R2.length() + R3.length() + R4.length() - 1, all_regions); + mutator.DuplicateInterval(R1.length(), R2.length(), + R1.length() + R2.length() + R3.length() + R4.length() - 1, + all_regions); ASSERT_EQ(R1 + R2 + R3 + R4 + R2.substr(1, R2.size() - 1) + R5, all_regions); } TEST(InsertRegionTest, InsertRegionTest2) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;", R4 = ";regionregionregionregion4;", R5 = ";regionregionregionregionregion5;"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // This call should insert R3 after R1. - DuplicateInterval(R1.length() + R2.length(), R3.length(), R1.length() - 1, all_regions); + mutator.DuplicateInterval(R1.length() + R2.length(), R3.length(), R1.length() - 1, all_regions); ASSERT_EQ(R1 + R3.substr(1, R3.length() - 1) + R2 + R3 + R4 + R5, all_regions); } TEST(InsertRegionTest, InsertRegionTest3) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = ";region1;", R2 = ";regionregion2;", R3 = ";regionregionregion3;", R4 = ";regionregionregionregion4;", R5 = ";regionregionregionregionregion5;"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // This call should insert R2 after R5. - DuplicateInterval(R1.length(), R2.length(), all_regions.length() - 1, all_regions); + mutator.DuplicateInterval(R1.length(), R2.length(), all_regions.length() - 1, all_regions); ASSERT_EQ(R1 + R2 + R3 + R4 + R5 + R2.substr(1, R2.length() - 1), all_regions); } TEST(ReplaceIdentifierTest, ReplaceIdentifierTest1) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = "|region1|", R2 = "; region2;", R3 = "---------region3---------", R4 = "++region4++", R5 = "***region5***"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // Replaces R3 with R1. - ReplaceRegion(0, R1.length(), R1.length() + R2.length(), R3.length(), all_regions); + mutator.ReplaceRegion(0, R1.length(), R1.length() + R2.length(), R3.length(), all_regions); ASSERT_EQ(R1 + R2 + R1 + R4 + R5, all_regions); } TEST(ReplaceIdentifierTest, ReplaceIdentifierTest2) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string R1 = "|region1|", R2 = "; region2;", R3 = "---------region3---------", R4 = "++region4++", R5 = "***region5***"; std::string all_regions = R1 + R2 + R3 + R4 + R5; // Replaces R5 with R3. - ReplaceRegion(R1.length() + R2.length(), R3.length(), - R1.length() + R2.length() + R3.length() + R4.length(), R5.length(), all_regions); + mutator.ReplaceRegion(R1.length() + R2.length(), R3.length(), + R1.length() + R2.length() + R3.length() + R4.length(), R5.length(), + all_regions); ASSERT_EQ(R1 + R2 + R3 + R4 + R3, all_regions); } TEST(GetIdentifierTest, GetIdentifierTest1) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string wgsl_code = R"(fn clamp_0acf8f() { var res: vec2 = clamp(vec2(), vec2(), vec2()); } - @stage(vertex) + @vertex fn vertex_main() -> @builtin(position) vec4 { clamp_0acf8f();" return vec4(); } - @stage(fragment) + @fragment fn fragment_main() { clamp_0acf8f(); } - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn compute_main() {" var foo: f32 = 0.0; clamp_0acf8f(); })"; - std::vector> identifiers_pos = GetIdentifiers(wgsl_code); - + std::vector> identifiers_pos = mutator.GetIdentifiers(wgsl_code); std::vector> ground_truth = { - std::make_pair(3, 12), std::make_pair(28, 3), std::make_pair(37, 4), - std::make_pair(49, 5), std::make_pair(60, 3), std::make_pair(68, 4), - std::make_pair(81, 4), std::make_pair(110, 5), std::make_pair(130, 2), - std::make_pair(140, 4), std::make_pair(151, 7), std::make_pair(169, 4), - std::make_pair(190, 12), std::make_pair(216, 6), std::make_pair(228, 3), - std::make_pair(251, 5), std::make_pair(273, 2), std::make_pair(285, 4), - std::make_pair(302, 12), std::make_pair(333, 5), std::make_pair(349, 14), - std::make_pair(373, 2), std::make_pair(384, 4), std::make_pair(402, 3), - std::make_pair(415, 3), std::make_pair(420, 3), std::make_pair(439, 12)}; - + {3, 12}, {32, 3}, {49, 5}, {126, 11}, {144, 7}, {152, 8}, {183, 12}, + {262, 13}, {288, 12}, {328, 14}, {355, 12}, {385, 7}, {394, 3}, {418, 12}}; ASSERT_EQ(ground_truth, identifiers_pos); } TEST(TestGetLiteralsValues, TestGetLiteralsValues1) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string wgsl_code = R"(fn clamp_0acf8f() { var res: vec2 = clamp(vec2(), vec2(), vec2()); } - @stage(vertex) + @vertex fn vertex_main() -> @builtin(position) vec4 { clamp_0acf8f(); var foo_1: i32 = 3; return vec4(); } - @stage(fragment) + @fragment fn fragment_main() { clamp_0acf8f(); } - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn compute_main() { var foo: f32 = 0.0; var foo_2: i32 = 10; @@ -227,7 +271,7 @@ TEST(TestGetLiteralsValues, TestGetLiteralsValues1) { foo_1 = 5 + 7; var foo_3 : i32 = -20;)"; - std::vector> literals_pos = GetIntLiterals(wgsl_code); + std::vector> literals_pos = mutator.GetIntLiterals(wgsl_code); std::vector ground_truth = {"3", "10", "5", "7", "-20"}; @@ -241,6 +285,8 @@ TEST(TestGetLiteralsValues, TestGetLiteralsValues1) { } TEST(InsertReturnTest, FindClosingBrace) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string wgsl_code = R"(fn clamp_0acf8f() { if(false){ @@ -249,17 +295,17 @@ TEST(InsertReturnTest, FindClosingBrace) { var res: vec2 = clamp(vec2(), vec2(), vec2()); } } - @stage(vertex) + @vertex fn vertex_main() -> @builtin(position) vec4 { clamp_0acf8f(); var foo_1: i32 = 3; return vec4(); } - @stage(fragment) + @fragment fn fragment_main() { clamp_0acf8f(); } - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn compute_main() { var foo: f32 = 0.0; var foo_2: i32 = 10; @@ -269,7 +315,8 @@ TEST(InsertReturnTest, FindClosingBrace) { var foo_3 : i32 = -20; )"; size_t opening_bracket_pos = 18; - size_t closing_bracket_pos = FindClosingBrace(opening_bracket_pos, wgsl_code); + size_t closing_bracket_pos = + mutator.FindClosingBracket(opening_bracket_pos, wgsl_code, '{', '}'); // The -1 is needed since the function body starts after the left bracket. std::string function_body = @@ -286,6 +333,8 @@ TEST(InsertReturnTest, FindClosingBrace) { } TEST(InsertReturnTest, FindClosingBraceFailing) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string wgsl_code = R"(fn clamp_0acf8f() { // This comment } causes the test to fail. @@ -295,17 +344,17 @@ TEST(InsertReturnTest, FindClosingBraceFailing) { var res: vec2 = clamp(vec2(), vec2(), vec2()); } } - @stage(vertex) + @vertex fn vertex_main() -> @builtin(position) vec4 { clamp_0acf8f(); var foo_1: i32 = 3; return vec4(); } - @stage(fragment) + @fragment fn fragment_main() { clamp_0acf8f(); } - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn compute_main() { var foo: f32 = 0.0; var foo_2: i32 = 10; @@ -314,7 +363,8 @@ TEST(InsertReturnTest, FindClosingBraceFailing) { foo_1 = 5 + 7; var foo_3 : i32 = -20;)"; size_t opening_bracket_pos = 18; - size_t closing_bracket_pos = FindClosingBrace(opening_bracket_pos, wgsl_code); + size_t closing_bracket_pos = + mutator.FindClosingBracket(opening_bracket_pos, wgsl_code, '{', '}'); // The -1 is needed since the function body starts after the left bracket. std::string function_body = @@ -329,82 +379,24 @@ TEST(InsertReturnTest, FindClosingBraceFailing) { ASSERT_NE(expected, function_body); } -TEST(TestInsertReturn, TestInsertReturn1) { - std::string wgsl_code = - R"(fn clamp_0acf8f() { - var res: vec2 = clamp(vec2(), vec2(), vec2()); - } - @stage(vertex) - fn vertex_main() -> @builtin(position) vec4 { - clamp_0acf8f(); - var foo_1: i32 = 3; - return vec4(); - } - @stage(fragment) - fn fragment_main() { - clamp_0acf8f(); - } - @stage(compute) @workgroup_size(1) - fn compute_main() { - var foo: f32 = 0.0; - var foo_2: i32 = 10; - clamp_0acf8f(); - } - foo_1 = 5 + 7; - var foo_3 : i32 = -20;)"; - - std::vector semicolon_pos; - for (size_t pos = wgsl_code.find(";", 0); pos != std::string::npos; - pos = wgsl_code.find(";", pos + 1)) { - semicolon_pos.push_back(pos); - } - - // should insert a return true statement after the first semicolon of the - // first function the the WGSL-like string above. - wgsl_code.insert(semicolon_pos[0] + 1, "return true;"); - - std::string expected_wgsl_code = - R"(fn clamp_0acf8f() { - var res: vec2 = clamp(vec2(), vec2(), vec2());return true; - } - @stage(vertex) - fn vertex_main() -> @builtin(position) vec4 { - clamp_0acf8f(); - var foo_1: i32 = 3; - return vec4(); - } - @stage(fragment) - fn fragment_main() { - clamp_0acf8f(); - } - @stage(compute) @workgroup_size(1) - fn compute_main() { - var foo: f32 = 0.0; - var foo_2: i32 = 10; - clamp_0acf8f(); - } - foo_1 = 5 + 7; - var foo_3 : i32 = -20;)"; - - ASSERT_EQ(expected_wgsl_code, wgsl_code); -} - -TEST(TestInsertReturn, TestFunctionPositions) { +TEST(TestInsertReturn, TestFunctionPositions1) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string wgsl_code = R"(fn clamp_0acf8f() { var res: vec2 = clamp(vec2(), vec2(), vec2()); } - @stage(vertex) + @vertex fn vertex_main() -> @builtin(position) vec4 { clamp_0acf8f(); var foo_1: i32 = 3; return vec4(); } - @stage(fragment) + @fragment fn fragment_main() { clamp_0acf8f(); } - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn compute_main() { var foo: f32 = 0.0; var foo_2: i32 = 10; @@ -418,27 +410,53 @@ TEST(TestInsertReturn, TestFunctionPositions) { foo_1 = 5 + 7; var foo_3 : i32 = -20;)"; - std::vector function_positions = GetFunctionBodyPositions(wgsl_code); - std::vector expected_positions = {187, 607}; + std::vector> function_positions = + mutator.GetFunctionBodyPositions(wgsl_code); + std::vector> expected_positions = { + {18, false}, {180, true}, {323, false}, {423, false}, {586, true}}; + ASSERT_EQ(expected_positions, function_positions); +} + +TEST(TestInsertReturn, TestFunctionPositions2) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); + std::string wgsl_code = + R"(fn some_loop_body() { +} + +fn f() { + var j : i32; i = (i + 1)) { + some_loop_body(); ((i < 5) && (j < 10)); + for(var i : i32 = 0; + j = (i * 30); + } +} +)"; + + std::vector> function_positions = + mutator.GetFunctionBodyPositions(wgsl_code); + std::vector> expected_positions = {{20, false}, {32, false}}; ASSERT_EQ(expected_positions, function_positions); } TEST(TestInsertReturn, TestMissingSemicolon) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); std::string wgsl_code = R"(fn clamp_0acf8f() { var res: vec2 = clamp(vec2(), vec2(), vec2()) } - @stage(vertex) + @vertex fn vertex_main() -> @builtin(position) vec4 { clamp_0acf8f() var foo_1: i32 = 3 return vec4() } - @stage(fragment) + @fragment fn fragment_main() { clamp_0acf8f(); } - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn compute_main() { var foo: f32 = 0.0; var foo_2: i32 = 10; @@ -452,8 +470,7 @@ TEST(TestInsertReturn, TestMissingSemicolon) { foo_1 = 5 + 7; var foo_3 : i32 = -20;)"; - RandomGenerator generator(0); - InsertReturnStatement(wgsl_code, generator); + mutator.InsertReturnStatement(wgsl_code); // No semicolons found in the function's body, so wgsl_code // should remain unchanged. @@ -461,17 +478,17 @@ TEST(TestInsertReturn, TestMissingSemicolon) { R"(fn clamp_0acf8f() { var res: vec2 = clamp(vec2(), vec2(), vec2()) } - @stage(vertex) + @vertex fn vertex_main() -> @builtin(position) vec4 { clamp_0acf8f() var foo_1: i32 = 3 return vec4() } - @stage(fragment) + @fragment fn fragment_main() { clamp_0acf8f(); } - @stage(compute) @workgroup_size(1) + @compute @workgroup_size(1) fn compute_main() { var foo: f32 = 0.0; var foo_2: i32 = 10; @@ -487,5 +504,166 @@ TEST(TestInsertReturn, TestMissingSemicolon) { ASSERT_EQ(expected_wgsl_code, wgsl_code); } +TEST(TestReplaceOperator, TestIdentifyOperators) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); + std::string code = + R"( +x += 2; +y = a + b; +z = -a; +x *= b / c; +t = t && t | t || t; +b = b > c ^ c <= d; +a >>= b; +b <<= a; +a = a << 2; +b = b >> 3; +c = a % 3; +d %= e; +)"; + // These are the operator occurrences that will be observed by going through the file character + // by character. This includes, for example, identifying the ">" operator if search starts after + // the first character of ">>". + std::vector> operator_occurrences = { + {3, 2}, {4, 1}, {11, 1}, {15, 1}, {22, 1}, {24, 1}, {30, 2}, {31, 1}, + {35, 1}, {42, 1}, {46, 2}, {47, 1}, {51, 1}, {55, 2}, {56, 1}, {63, 1}, + {67, 1}, {71, 1}, {75, 2}, {76, 1}, {83, 3}, {84, 2}, {85, 1}, {92, 3}, + {93, 2}, {94, 1}, {101, 1}, {105, 2}, {106, 1}, {113, 1}, {117, 2}, {118, 1}, + {125, 1}, {129, 1}, {136, 2}, {137, 1}, {3, 2}}; + uint32_t operator_occurrence_index = 0; + for (size_t i = 0; i < code.length(); i++) { + // Move on to the next operator occurrence if the current index into the code string exceeds + // the index associated with that operator occurrence. Exception: stay with the last + // operator occurrence if search has already passed the last operator in the file. + if (i < code.length() - 2 && i > operator_occurrences[operator_occurrence_index].first) { + operator_occurrence_index = + (operator_occurrence_index + 1) % operator_occurrences.size(); + } + ASSERT_EQ(operator_occurrences[operator_occurrence_index], + mutator.FindOperatorOccurrence(code, static_cast(i)).value()); + } +} + +TEST(TestInsertBreakOrContinue, TestLoopPositions1) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); + std::string wgsl_code = " loop { } loop { } loop { }"; + std::vector loop_positions = mutator.GetLoopBodyPositions(wgsl_code); + std::vector expected_positions = {6, 15, 24}; + ASSERT_EQ(expected_positions, loop_positions); +} + +TEST(TestInsertBreakOrContinue, TestLoopPositions2) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); + std::string wgsl_code = R"( loop { } loop +{ } loop { })"; + std::vector loop_positions = mutator.GetLoopBodyPositions(wgsl_code); + std::vector expected_positions = {6, 15, 24}; + ASSERT_EQ(expected_positions, loop_positions); +} + +TEST(TestInsertBreakOrContinue, TestLoopPositions3) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); + // This WGSL-like code is not valid, but it suffices to test regex-based matching (which is + // intended to work well on semi-valid code). + std::string wgsl_code = + R"(fn compute_main() { + loop { + var twice: i32 = 2 * i; + i++; + if i == 5 { break; } + loop + { + var twice: i32 = 2 * i; + i++; + while (i < 100) { i++; } + if i == 5 { break; } + } + } + for (a = 0; a < 100; a++) { + if (a > 50) { + break; + } + while (i < 100) { i++; } + } +})"; + + std::vector loop_positions = mutator.GetLoopBodyPositions(wgsl_code); + std::vector expected_positions = {27, 108, 173, 249, 310}; + ASSERT_EQ(expected_positions, loop_positions); +} + +TEST(TestInsertBreakOrContinue, TestLoopPositions4) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); + std::string wgsl_code = + R"(fn clamp_0acf8f() { + var res: vec2 = clamp(vec2(), vec2(), vec2()); + } + @vertex + fn vertex_main() -> @builtin(position) vec4 { + clamp_0acf8f();" + return vec4(); + } + @fragment + fn fragment_main() { + clamp_0acf8f(); + } + @compute @workgroup_size(1) + fn compute_main() {" + var foo: f32 = 0.0; + clamp_0acf8f (); + })"; + + std::vector loop_positions = mutator.GetLoopBodyPositions(wgsl_code); + ASSERT_TRUE(loop_positions.empty()); +} + +TEST(TestReplaceFunctionCallWithBuiltin, FindFunctionCalls) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); + std::string function_body = R"({ + var foo: f32 = 0.0; + var foo_2: i32 = 10; + clamp_0acf8f (); + _0acf8f(); + f +(); + j = (i * 30); + })"; + std::vector> call_identifiers = + mutator.GetFunctionCallIdentifiers(function_body); + std::vector> ground_truth{{82, 12}, {110, 7}, {131, 1}}; + ASSERT_EQ(ground_truth, call_identifiers); +} + +TEST(TestAddSwizzle, FindSwizzles) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); + std::string code = R"(x +v.xxyy.wz.x; +u.rgba.rrg.b)"; + std::vector> swizzles = mutator.GetSwizzles(code); + std::vector> ground_truth{{3, 5}, {8, 3}, {11, 2}, + {16, 5}, {21, 4}, {25, 2}}; + ASSERT_EQ(ground_truth, swizzles); +} + +TEST(TestAddSwizzle, FindVectorConstructors) { + RandomGenerator generator(0); + WgslMutatorTest mutator(generator); + std::string code = R"( +vec4(vec2(1, 2), vec2(3)) + +vec2(1, abs(abs(2))) +)"; + std::vector> swizzles = mutator.GetVectorConstructors(code); + std::vector> ground_truth{{1, 40}, {11, 15}, {28, 12}, {43, 25}}; + ASSERT_EQ(ground_truth, swizzles); +} + } // namespace } // namespace tint::fuzzers::regex_fuzzer diff --git a/src/tint/fuzzers/tint_regex_fuzzer/wgsl_mutator.cc b/src/tint/fuzzers/tint_regex_fuzzer/wgsl_mutator.cc index 677560bfe5..46db837ed0 100644 --- a/src/tint/fuzzers/tint_regex_fuzzer/wgsl_mutator.cc +++ b/src/tint/fuzzers/tint_regex_fuzzer/wgsl_mutator.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -26,8 +27,10 @@ namespace tint::fuzzers::regex_fuzzer { -std::vector FindDelimiterIndices(const std::string& delimiter, - const std::string& wgsl_code) { +WgslMutator::WgslMutator(RandomGenerator& generator) : generator_(generator) {} + +std::vector WgslMutator::FindDelimiterIndices(const std::string& delimiter, + const std::string& wgsl_code) { std::vector result; for (size_t pos = wgsl_code.find(delimiter, 0); pos != std::string::npos; pos = wgsl_code.find(delimiter, pos + 1)) { @@ -37,31 +40,59 @@ std::vector FindDelimiterIndices(const std::string& delimiter, return result; } -std::vector> GetIdentifiers(const std::string& wgsl_code) { +std::unordered_set WgslMutator::GetCommonKeywords() { + return {"array", "bool", "break", "compute", "continue", "f32", "fn", "fragment", + "i32", "if", "for", "let", "location", "loop", "ptr", "return", + "struct", "u32", "var", "vec2", "vec3", "vec4", "vertex", "while"}; +} + +std::vector> WgslMutator::GetIdentifiers(const std::string& wgsl_code) { std::vector> result; + // To reduce the rate that invalid programs are produced, common keywords will be excluded from + // the identifiers that are returned. + std::unordered_set common_keywords = GetCommonKeywords(); + // This regular expression works by looking for a character that // is not part of an identifier followed by a WGSL identifier, followed // by a character which cannot be part of a WGSL identifer. The regex // for the WGSL identifier is obtained from: // https://www.w3.org/TR/WGSL/#identifiers. - std::regex wgsl_identifier_regex("[^a-zA-Z]([a-zA-Z][0-9a-zA-Z_]*)[^0-9a-zA-Z_]"); + std::regex identifier_regex("[_a-zA-Z][0-9a-zA-Z_]*"); - std::smatch match; + auto identifiers_begin = + std::sregex_iterator(wgsl_code.begin(), wgsl_code.end(), identifier_regex); + auto identifiers_end = std::sregex_iterator(); - std::string::const_iterator search_start(wgsl_code.cbegin()); - std::string prefix; - - while (regex_search(search_start, wgsl_code.cend(), match, wgsl_identifier_regex) == true) { - prefix += match.prefix(); - result.push_back(std::make_pair(prefix.size() + 1, match.str(1).size())); - prefix += match.str(0); - search_start = match.suffix().first; + for (std::sregex_iterator i = identifiers_begin; i != identifiers_end; ++i) { + if (common_keywords.count(i->str()) > 0) { + // This is a common keyword, so skip it. + continue; + } + result.push_back( + {static_cast(i->prefix().second - wgsl_code.cbegin()), i->str().size()}); } return result; } -std::vector> GetIntLiterals(const std::string& s) { +std::vector> WgslMutator::GetFunctionCallIdentifiers( + const std::string& wgsl_code) { + std::vector> result; + + std::regex call_regex("([_a-zA-Z][0-9a-zA-Z_]*)[ \\n]*\\("); + + auto identifiers_begin = std::sregex_iterator(wgsl_code.begin(), wgsl_code.end(), call_regex); + auto identifiers_end = std::sregex_iterator(); + + for (std::sregex_iterator i = identifiers_begin; i != identifiers_end; ++i) { + auto submatch = (*i)[1]; + result.push_back( + {static_cast(submatch.first - wgsl_code.cbegin()), submatch.str().size()}); + } + return result; +} + +std::vector> WgslMutator::GetIntLiterals(const std::string& s) { std::vector> result; // Looks for integer literals in decimal or hexadecimal form. @@ -83,13 +114,16 @@ std::vector> GetIntLiterals(const std::string& s) { return result; } -size_t FindClosingBrace(size_t opening_bracket_pos, const std::string& wgsl_code) { +size_t WgslMutator::FindClosingBracket(size_t opening_bracket_pos, + const std::string& wgsl_code, + char opening_bracket_character, + char closing_bracket_character) { size_t open_bracket_count = 1; size_t pos = opening_bracket_pos + 1; while (open_bracket_count >= 1 && pos < wgsl_code.size()) { - if (wgsl_code[pos] == '{') { + if (wgsl_code[pos] == opening_bracket_character) { ++open_bracket_count; - } else if (wgsl_code[pos] == '}') { + } else if (wgsl_code[pos] == closing_bracket_character) { --open_bracket_count; } ++pos; @@ -97,35 +131,54 @@ size_t FindClosingBrace(size_t opening_bracket_pos, const std::string& wgsl_code return (pos == wgsl_code.size() && open_bracket_count >= 1) ? 0 : pos - 1; } -std::vector GetFunctionBodyPositions(const std::string& wgsl_code) { +std::vector> WgslMutator::GetFunctionBodyPositions( + const std::string& wgsl_code) { // Finds all the functions with a non-void return value. - std::regex function_regex("fn.*?->.*?\\{"); - std::smatch match; - std::vector result; + std::regex function_regex("fn[^a-zA-Z_0-9][^\\{]*\\{"); + std::vector> result; - auto search_start(wgsl_code.cbegin()); - std::string prefix = ""; + auto functions_begin = std::sregex_iterator(wgsl_code.begin(), wgsl_code.end(), function_regex); + auto functions_end = std::sregex_iterator(); - while (std::regex_search(search_start, wgsl_code.cend(), match, function_regex)) { - result.push_back(static_cast(match.suffix().first - wgsl_code.cbegin() - 1L)); - search_start = match.suffix().first; + for (std::sregex_iterator i = functions_begin; i != functions_end; ++i) { + bool returns_value = i->str().find("->") != std::string::npos; + result.push_back( + {static_cast(i->suffix().first - wgsl_code.cbegin() - 1), returns_value}); } return result; } -bool InsertReturnStatement(std::string& wgsl_code, RandomGenerator& generator) { - std::vector function_body_positions = GetFunctionBodyPositions(wgsl_code); +std::vector WgslMutator::GetLoopBodyPositions(const std::string& wgsl_code) { + // Finds all loops. + std::regex loop_regex("[^a-zA-Z_0-9](for|while|loop)[^\\{]*\\{"); + std::vector result; + + auto loops_begin = std::sregex_iterator(wgsl_code.begin(), wgsl_code.end(), loop_regex); + auto loops_end = std::sregex_iterator(); + + for (std::sregex_iterator i = loops_begin; i != loops_end; ++i) { + result.push_back(static_cast(i->suffix().first - wgsl_code.cbegin() - 1)); + } + return result; +} + +bool WgslMutator::InsertReturnStatement(std::string& wgsl_code) { + std::vector> function_body_positions = + GetFunctionBodyPositions(wgsl_code); // No function was found in wgsl_code. if (function_body_positions.empty()) { return false; } - // Pick a random function's opening bracket, find the corresponding closing - // bracket, and find a semi-colon within the function body. - size_t left_bracket_pos = generator.GetRandomElement(function_body_positions); + // Pick a random function + auto function = generator_.GetRandomElement(function_body_positions); - size_t right_bracket_pos = FindClosingBrace(left_bracket_pos, wgsl_code); + // Find the corresponding closing bracket for the function, and find a semi-colon within the + // function body. + size_t left_bracket_pos = function.first; + + size_t right_bracket_pos = FindClosingBracket(left_bracket_pos, wgsl_code, '{', '}'); if (right_bracket_pos == 0) { return false; @@ -141,27 +194,64 @@ bool InsertReturnStatement(std::string& wgsl_code, RandomGenerator& generator) { return false; } - size_t semicolon_position = generator.GetRandomElement(semicolon_positions); - - // Get all identifiers and integer literals to use as potential return values. - std::vector> identifiers = GetIdentifiers(wgsl_code); - auto return_values = identifiers; - std::vector> int_literals = GetIntLiterals(wgsl_code); - return_values.insert(return_values.end(), int_literals.begin(), int_literals.end()); - std::pair return_value = generator.GetRandomElement(return_values); - std::string return_statement = - "return " + wgsl_code.substr(return_value.first, return_value.second) + ";"; + std::string return_statement = "return"; + if (function.second) { + // The function returns a value. Get all identifiers and integer literals to use as + // potential return values. + std::vector> identifiers = GetIdentifiers(wgsl_code); + auto return_values = identifiers; + std::vector> int_literals = GetIntLiterals(wgsl_code); + return_values.insert(return_values.end(), int_literals.begin(), int_literals.end()); + std::pair return_value = generator_.GetRandomElement(return_values); + return_statement += " " + wgsl_code.substr(return_value.first, return_value.second); + } + return_statement += ";"; // Insert the return statement immediately after the semicolon. - wgsl_code.insert(semicolon_position + 1, return_statement); + wgsl_code.insert(generator_.GetRandomElement(semicolon_positions) + 1, return_statement); return true; } -void SwapIntervals(size_t idx1, - size_t reg1_len, - size_t idx2, - size_t reg2_len, - std::string& wgsl_code) { +bool WgslMutator::InsertBreakOrContinue(std::string& wgsl_code) { + std::vector loop_body_positions = GetLoopBodyPositions(wgsl_code); + + // No loop was found in wgsl_code. + if (loop_body_positions.empty()) { + return false; + } + + // Pick a random loop's opening bracket, find the corresponding closing + // bracket, and find a semi-colon within the loop body. + size_t left_bracket_pos = generator_.GetRandomElement(loop_body_positions); + + size_t right_bracket_pos = FindClosingBracket(left_bracket_pos, wgsl_code, '{', '}'); + + if (right_bracket_pos == 0) { + return false; + } + + std::vector semicolon_positions; + for (size_t pos = wgsl_code.find(";", left_bracket_pos + 1); pos < right_bracket_pos; + pos = wgsl_code.find(";", pos + 1)) { + semicolon_positions.push_back(pos); + } + + if (semicolon_positions.empty()) { + return false; + } + + size_t semicolon_position = generator_.GetRandomElement(semicolon_positions); + + // Insert a break or continue immediately after the semicolon. + wgsl_code.insert(semicolon_position + 1, generator_.GetBool() ? "break;" : "continue;"); + return true; +} + +void WgslMutator::SwapIntervals(size_t idx1, + size_t reg1_len, + size_t idx2, + size_t reg2_len, + std::string& wgsl_code) { std::string region_1 = wgsl_code.substr(idx1 + 1, reg1_len - 1); std::string region_2 = wgsl_code.substr(idx2 + 1, reg2_len - 1); @@ -172,36 +262,37 @@ void SwapIntervals(size_t idx1, wgsl_code.replace(idx1 + 1, region_1.size(), region_2); } -void DeleteInterval(size_t idx1, size_t reg_len, std::string& wgsl_code) { +void WgslMutator::DeleteInterval(size_t idx1, size_t reg_len, std::string& wgsl_code) { wgsl_code.erase(idx1 + 1, reg_len - 1); } -void DuplicateInterval(size_t idx1, size_t reg1_len, size_t idx2, std::string& wgsl_code) { +void WgslMutator::DuplicateInterval(size_t idx1, + size_t reg1_len, + size_t idx2, + std::string& wgsl_code) { std::string region = wgsl_code.substr(idx1 + 1, reg1_len - 1); wgsl_code.insert(idx2 + 1, region); } -void ReplaceRegion(size_t idx1, - size_t id1_len, - size_t idx2, - size_t id2_len, - std::string& wgsl_code) { +void WgslMutator::ReplaceRegion(size_t idx1, + size_t id1_len, + size_t idx2, + size_t id2_len, + std::string& wgsl_code) { std::string region_1 = wgsl_code.substr(idx1, id1_len); std::string region_2 = wgsl_code.substr(idx2, id2_len); wgsl_code.replace(idx2, region_2.size(), region_1); } -void ReplaceInterval(size_t start_index, - size_t length, - std::string replacement_text, - std::string& wgsl_code) { +void WgslMutator::ReplaceInterval(size_t start_index, + size_t length, + std::string replacement_text, + std::string& wgsl_code) { std::string region_1 = wgsl_code.substr(start_index, length); wgsl_code.replace(start_index, length, replacement_text); } -bool SwapRandomIntervals(const std::string& delimiter, - std::string& wgsl_code, - RandomGenerator& generator) { +bool WgslMutator::SwapRandomIntervals(const std::string& delimiter, std::string& wgsl_code) { std::vector delimiter_positions = FindDelimiterIndices(delimiter, wgsl_code); // Need to have at least 3 indices. @@ -212,12 +303,12 @@ bool SwapRandomIntervals(const std::string& delimiter, // Choose indices: // interval_1_start < interval_1_end <= interval_2_start < interval_2_end uint32_t interval_1_start = - generator.GetUInt32(static_cast(delimiter_positions.size()) - 2u); - uint32_t interval_1_end = generator.GetUInt32( + generator_.GetUInt32(static_cast(delimiter_positions.size()) - 2u); + uint32_t interval_1_end = generator_.GetUInt32( interval_1_start + 1u, static_cast(delimiter_positions.size()) - 1u); - uint32_t interval_2_start = - generator.GetUInt32(interval_1_end, static_cast(delimiter_positions.size()) - 1u); - uint32_t interval_2_end = generator.GetUInt32( + uint32_t interval_2_start = generator_.GetUInt32( + interval_1_end, static_cast(delimiter_positions.size()) - 1u); + uint32_t interval_2_end = generator_.GetUInt32( interval_2_start + 1u, static_cast(delimiter_positions.size())); SwapIntervals(delimiter_positions[interval_1_start], @@ -229,9 +320,7 @@ bool SwapRandomIntervals(const std::string& delimiter, return true; } -bool DeleteRandomInterval(const std::string& delimiter, - std::string& wgsl_code, - RandomGenerator& generator) { +bool WgslMutator::DeleteRandomInterval(const std::string& delimiter, std::string& wgsl_code) { std::vector delimiter_positions = FindDelimiterIndices(delimiter, wgsl_code); // Need to have at least 2 indices. @@ -240,9 +329,9 @@ bool DeleteRandomInterval(const std::string& delimiter, } uint32_t interval_start = - generator.GetUInt32(static_cast(delimiter_positions.size()) - 1u); - uint32_t interval_end = - generator.GetUInt32(interval_start + 1u, static_cast(delimiter_positions.size())); + generator_.GetUInt32(static_cast(delimiter_positions.size()) - 1u); + uint32_t interval_end = generator_.GetUInt32(interval_start + 1u, + static_cast(delimiter_positions.size())); DeleteInterval(delimiter_positions[interval_start], delimiter_positions[interval_end] - delimiter_positions[interval_start], @@ -251,9 +340,7 @@ bool DeleteRandomInterval(const std::string& delimiter, return true; } -bool DuplicateRandomInterval(const std::string& delimiter, - std::string& wgsl_code, - RandomGenerator& generator) { +bool WgslMutator::DuplicateRandomInterval(const std::string& delimiter, std::string& wgsl_code) { std::vector delimiter_positions = FindDelimiterIndices(delimiter, wgsl_code); // Need to have at least 2 indices @@ -262,11 +349,11 @@ bool DuplicateRandomInterval(const std::string& delimiter, } uint32_t interval_start = - generator.GetUInt32(static_cast(delimiter_positions.size()) - 1u); - uint32_t interval_end = - generator.GetUInt32(interval_start + 1u, static_cast(delimiter_positions.size())); + generator_.GetUInt32(static_cast(delimiter_positions.size()) - 1u); + uint32_t interval_end = generator_.GetUInt32(interval_start + 1u, + static_cast(delimiter_positions.size())); uint32_t duplication_point = - generator.GetUInt32(static_cast(delimiter_positions.size())); + generator_.GetUInt32(static_cast(delimiter_positions.size())); DuplicateInterval(delimiter_positions[interval_start], delimiter_positions[interval_end] - delimiter_positions[interval_start], @@ -275,7 +362,7 @@ bool DuplicateRandomInterval(const std::string& delimiter, return true; } -bool ReplaceRandomIdentifier(std::string& wgsl_code, RandomGenerator& generator) { +bool WgslMutator::ReplaceRandomIdentifier(std::string& wgsl_code) { std::vector> identifiers = GetIdentifiers(wgsl_code); // Need at least 2 identifiers @@ -283,12 +370,12 @@ bool ReplaceRandomIdentifier(std::string& wgsl_code, RandomGenerator& generator) return false; } - uint32_t id1_index = generator.GetUInt32(static_cast(identifiers.size())); - uint32_t id2_index = generator.GetUInt32(static_cast(identifiers.size())); + uint32_t id1_index = generator_.GetUInt32(static_cast(identifiers.size())); + uint32_t id2_index = generator_.GetUInt32(static_cast(identifiers.size())); // The two identifiers must be different while (id1_index == id2_index) { - id2_index = generator.GetUInt32(static_cast(identifiers.size())); + id2_index = generator_.GetUInt32(static_cast(identifiers.size())); } ReplaceRegion(identifiers[id1_index].first, identifiers[id1_index].second, @@ -297,7 +384,7 @@ bool ReplaceRandomIdentifier(std::string& wgsl_code, RandomGenerator& generator) return true; } -bool ReplaceRandomIntLiteral(std::string& wgsl_code, RandomGenerator& generator) { +bool WgslMutator::ReplaceRandomIntLiteral(std::string& wgsl_code) { std::vector> literals = GetIntLiterals(wgsl_code); // Need at least one integer literal @@ -305,13 +392,13 @@ bool ReplaceRandomIntLiteral(std::string& wgsl_code, RandomGenerator& generator) return false; } - uint32_t literal_index = generator.GetUInt32(static_cast(literals.size())); + uint32_t literal_index = generator_.GetUInt32(static_cast(literals.size())); // INT_MAX = 2147483647, INT_MIN = -2147483648 std::vector boundary_values = {"2147483647", "-2147483648", "1", "-1", "0", "4294967295"}; - uint32_t boundary_index = generator.GetUInt32(static_cast(boundary_values.size())); + uint32_t boundary_index = generator_.GetUInt32(static_cast(boundary_values.size())); ReplaceInterval(literals[literal_index].first, literals[literal_index].second, boundary_values[boundary_index], wgsl_code); @@ -319,4 +406,390 @@ bool ReplaceRandomIntLiteral(std::string& wgsl_code, RandomGenerator& generator) return true; } +std::string WgslMutator::ChooseRandomReplacementForOperator(const std::string& existing_operator) { + // Operators are partitioned into three classes: assignment, expression and increment. The regex + // mutator will swap operators in the same class. The hypothesis is that this should exercise a + // number of type-safe swaps (e.g. changing += to *=), as well as some badly-typed yet + // interesting swaps (e.g. changing + to ^ when the operators are matrices), while avoiding + // making totally nonsensical replacements (such as changing ++ too /). + std::vector assignment_operators{ + "=", "+=", "-=", "*=", "/=", "%=", "&=", "|=", "^=", "<<=", ">>="}; + std::vector expression_operators{"+", "-", "*", "/", "%", "&&", "||", + "&", "|", "^", "<<", ">>", "<", ">", + "<=", ">=", "!", "!=", "~"}; + std::vector increment_operators{"++", "--"}; + for (auto operators : {assignment_operators, expression_operators, increment_operators}) { + auto it = std::find(operators.begin(), operators.end(), existing_operator); + if (it != operators.end()) { + // The operator falls into this category, so select another operator from the category. + operators.erase(it); + return generator_.GetRandomElement(operators); + } + } + assert(false && "Unknown operator"); + return ""; +} + +bool WgslMutator::ReplaceRandomOperator(std::string& wgsl_code) { + // Choose an index into the code at random. + const uint32_t start_index = generator_.GetUInt32(static_cast(wgsl_code.size())); + // Find the first operator occurrence from the chosen point, wrapping back to the start of the + // file if needed. + auto maybe_operator_occurrence = FindOperatorOccurrence(wgsl_code, start_index); + if (!maybe_operator_occurrence.has_value()) { + // It is unlikely that there will be *no* operators in the file, but if this is the case + // then this mutation cannot be applied. + return false; + } + std::string existing_operator = + wgsl_code.substr(maybe_operator_occurrence->first, maybe_operator_occurrence->second); + // Replace the identified operator with a randomly-chosen alternative. + wgsl_code.replace(maybe_operator_occurrence->first, maybe_operator_occurrence->second, + ChooseRandomReplacementForOperator(existing_operator)); + return true; +} + +std::optional> WgslMutator::FindOperatorOccurrence( + const std::string& wgsl_code, + uint32_t start_index) { + // Loops through the characters of the code in a wrap-around fashion, looking for the first + // encountered token that is a WGSL operator. + + for (size_t i = 0; i < wgsl_code.size(); i++) { + uint32_t current_index = static_cast((start_index + i) % wgsl_code.size()); + + // To cater for multi-character operator tokens, get the three consecutive characters from + // the code string starting at the current index. Use null characters to account for the + // case where search has reached the end of the code string. + char first_character = wgsl_code[current_index]; + char second_character = + current_index == wgsl_code.size() - 1 ? '\0' : wgsl_code[current_index + 1]; + char third_character = + current_index >= wgsl_code.size() - 2 ? '\0' : wgsl_code[current_index + 2]; + + // This uses the extracted characters to match for the various WGSL operators. + switch (first_character) { + case '!': + case '^': + switch (second_character) { + case '=': + return {{current_index, 2}}; + default: + return {{current_index, 1}}; + } + case '|': + case '&': + case '+': + case '-': + if (second_character == first_character || second_character == '=') { + return {{current_index, 2}}; + } + return {{current_index, 1}}; + case '*': + case '/': + case '%': + switch (second_character) { + case '=': + return {{current_index, 2}}; + default: + return {{current_index, 1}}; + } + case '=': + if (second_character == '=') { + return {{current_index, 2}}; + } + return {{current_index, 1}}; + case '<': + case '>': + if (second_character == '=') { + return {{current_index, 2}}; + } + if (second_character == first_character) { + if (third_character == '=') { + return {{current_index, 3}}; + } + return {{current_index, 2}}; + } + return {{current_index, 1}}; + case '~': + return {{current_index, 1}}; + default: + break; + } + } + // No operator was found, so empty is returned. + return {}; +} + +bool WgslMutator::ReplaceFunctionCallWithBuiltin(std::string& wgsl_code) { + std::vector> function_body_positions = + GetFunctionBodyPositions(wgsl_code); + + // No function was found in wgsl_code. + if (function_body_positions.empty()) { + return false; + } + + // Pick a random function + auto function = generator_.GetRandomElement(function_body_positions); + + // Find the corresponding closing bracket for the function. + size_t left_bracket_pos = function.first; + + size_t right_bracket_pos = FindClosingBracket(left_bracket_pos, wgsl_code, '{', '}'); + + if (right_bracket_pos == 0) { + return false; + } + + std::string function_body( + wgsl_code.substr(left_bracket_pos, right_bracket_pos - left_bracket_pos)); + + std::vector> function_call_identifiers = + GetFunctionCallIdentifiers(function_body); + if (function_call_identifiers.empty()) { + return false; + } + auto function_call_identifier = generator_.GetRandomElement(function_call_identifiers); + + std::vector builtin_functions{"all", + "any", + "select", + "arrayLength", + "abs", + "acos", + "acosh", + "asin", + "asinh", + "atan", + "atanh", + "atan2", + "ceil", + "clamp", + "cos", + "cosh", + "cross", + "degrees", + "distance", + "exp", + "exp2", + "faceForward", + "floor", + "fma", + "fract", + "frexp", + "inverseSqrt", + "ldexp", + "length", + "log", + "log2", + "max", + "min", + "mix", + "modf", + "normalize", + "pow", + "quantizeToF16", + "radians", + "reflect", + "refract", + "round", + "saturate", + "sign", + "sin", + "sinh", + "smoothstep", + "sqrt", + "step", + "tan", + "tanh", + "trunc", + "abs", + "clamp", + "countLeadingZeros", + "countOneBits", + "countTrailingZeros", + "extractBits", + "firstLeadingBit", + "firstTrailingBit", + "insertBits", + "max", + "min", + "reverseBits", + "determinant", + "transpose", + "dot", + "dpdx", + "dpdxCoarse", + "dpdxFine", + "dpdy", + "dpdyCoarse", + "dpdyFine", + "fwidth", + "fwidthCoarse", + "fwidthFine", + "textureDimensions", + "textureGather", + "textureGatherCompare", + "textureLoad", + "textureNumLayers", + "textureNumLevels", + "textureNumSamples", + "textureSample", + "textureSampleBias", + "textureSampleCompare", + "textureSampleCompareLevel", + "textureSampleGrad", + "textureSampleLevel", + "textureStore", + "atomicLoad", + "atomicStore", + "atomicAdd", + "atomicSub", + "atomicMax", + "atomicMin", + "atomicAnd", + "atomicOr", + "atomicXor", + "pack4x8snorm", + "pack4x8unorm", + "pack2x16snorm", + "pack2x16unorm", + "pack2x16float", + "unpack4x8snorm", + "unpack4x8unorm", + "unpack2x16snorm", + "unpack2x16unorm", + "unpack2x16float", + "storageBarrier", + "workgroupBarrier"}; + wgsl_code.replace(left_bracket_pos + function_call_identifier.first, + function_call_identifier.second, + generator_.GetRandomElement(builtin_functions)); + return true; +} + +bool WgslMutator::AddSwizzle(std::string& wgsl_code) { + std::vector> function_body_positions = + GetFunctionBodyPositions(wgsl_code); + + // No function was found in wgsl_code. + if (function_body_positions.empty()) { + return false; + } + + // Pick a random function + auto function = generator_.GetRandomElement(function_body_positions); + + // Find the corresponding closing bracket for the function. + size_t left_bracket_pos = function.first; + size_t right_bracket_pos = FindClosingBracket(left_bracket_pos, wgsl_code, '{', '}'); + + if (right_bracket_pos == 0) { + return false; + } + + std::string function_body( + wgsl_code.substr(left_bracket_pos, right_bracket_pos - left_bracket_pos)); + + // It makes sense to try applying swizzles to: + // - identifiers, because they might be vectors + auto identifiers = GetIdentifiers(function_body); + // - existing swizzles, e.g. to turn v.xy into v.xy.xx + auto swizzles = GetSwizzles(function_body); + // - vector constructors, e.g. to turn vec3(...) into vec3(...).yyz + auto vector_constructors = GetVectorConstructors(function_body); + + // Create a combined vector of all the possibilities for swizzling, so that they can be sampled + // from as a whole. + std::vector> combined; + combined.insert(combined.end(), identifiers.begin(), identifiers.end()); + combined.insert(combined.end(), swizzles.begin(), swizzles.end()); + combined.insert(combined.end(), vector_constructors.begin(), vector_constructors.end()); + + if (combined.empty()) { + // No opportunities for swizzling: give up. + return false; + } + + // Randomly create a swizzle operation. This is done without checking the potential length of + // the target vector. For identifiers this isn't possible without proper context. For existing + // swizzles and vector constructors it would be possible to check the length, but it is anyway + // good to stress-test swizzle validation code paths. + std::string swizzle = "."; + { + // Choose a swizzle length between 1 and 4, inclusive. + uint32_t swizzle_length = generator_.GetUInt32(1, 5); + // Decide whether to use xyzw or rgba as convenience names. + bool use_xyzw = generator_.GetBool(); + // Randomly choose a convenience name for each component of the swizzle. + for (uint32_t i = 0; i < swizzle_length; i++) { + switch (generator_.GetUInt32(4)) { + case 0: + swizzle += use_xyzw ? "x" : "r"; + break; + case 1: + swizzle += use_xyzw ? "y" : "g"; + break; + case 2: + swizzle += use_xyzw ? "z" : "b"; + break; + case 3: + swizzle += use_xyzw ? "w" : "a"; + break; + default: + assert(false && "Unreachable"); + break; + } + } + } + // Choose a random opportunity for swizzling and add the swizzle right after it. + auto target = generator_.GetRandomElement(combined); + wgsl_code.insert(left_bracket_pos + target.first + target.second, swizzle); + return true; +} + +std::vector> WgslMutator::GetSwizzles(const std::string& wgsl_code) { + std::regex swizzle_regex("\\.(([xyzw]+)|([rgba]+))"); + std::vector> result; + + auto swizzles_begin = std::sregex_iterator(wgsl_code.begin(), wgsl_code.end(), swizzle_regex); + auto swizles_end = std::sregex_iterator(); + + for (std::sregex_iterator i = swizzles_begin; i != swizles_end; ++i) { + result.push_back( + {static_cast(i->prefix().second - wgsl_code.cbegin()), i->str().size()}); + } + return result; +} + +std::vector> WgslMutator::GetVectorConstructors( + const std::string& wgsl_code) { + // This regex recognises the prefixes of vector constructors, which have the form: + // "vecn(", with possible whitespace between tokens. + std::regex vector_constructor_prefix_regex("vec\\d[ \\n]*<[ \\n]*[a-z0-9_]+[ \\n]*>[^\\(]*\\("); + std::vector> result; + + auto vector_constructor_prefixes_begin = + std::sregex_iterator(wgsl_code.begin(), wgsl_code.end(), vector_constructor_prefix_regex); + auto vector_constructor_prefixes_end = std::sregex_iterator(); + + // Look through all of the vector constructor prefixes and see whether each one appears to + // correspond to a complete vector construction. + for (std::sregex_iterator i = vector_constructor_prefixes_begin; + i != vector_constructor_prefixes_end; ++i) { + // A prefix is deemed to correspond to a complete vector construction if it is possible to + // find a corresponding closing bracket for the "(" at the end of the prefix. + size_t closing_bracket = FindClosingBracket( + static_cast(i->suffix().first - wgsl_code.cbegin()), wgsl_code, '(', ')'); + if (closing_bracket != 0) { + // A closing bracket was found, so record the start and size of the entire vector + // constructor. + size_t start = static_cast(i->prefix().second - wgsl_code.cbegin()); + result.push_back({start, closing_bracket - start + 1}); + } + } + return result; +} + } // namespace tint::fuzzers::regex_fuzzer diff --git a/src/tint/fuzzers/tint_regex_fuzzer/wgsl_mutator.h b/src/tint/fuzzers/tint_regex_fuzzer/wgsl_mutator.h index 23c45bbca5..cd1f2b6032 100644 --- a/src/tint/fuzzers/tint_regex_fuzzer/wgsl_mutator.h +++ b/src/tint/fuzzers/tint_regex_fuzzer/wgsl_mutator.h @@ -15,7 +15,9 @@ #ifndef SRC_TINT_FUZZERS_TINT_REGEX_FUZZER_WGSL_MUTATOR_H_ #define SRC_TINT_FUZZERS_TINT_REGEX_FUZZER_WGSL_MUTATOR_H_ +#include #include +#include #include #include @@ -23,152 +25,236 @@ namespace tint::fuzzers::regex_fuzzer { -/// A function that given a delimiter, returns a vector that contains -/// all the positions of the delimiter in the WGSL code. -/// @param delimiter - the delimiter of the enclosed region. -/// @param wgsl_code - the initial string (WGSL code) that will be mutated. -/// @return a vector with the positions of the delimiter in the WGSL code. -std::vector FindDelimiterIndices(const std::string& delimiter, - const std::string& wgsl_code); +/// Class encapsulating code for regex-based mutation of WGSL shaders. +class WgslMutator { + public: + /// Constructor + /// @param generator - pseudo-random generator to use in mutator + explicit WgslMutator(RandomGenerator& generator); -/// A function that finds all the identifiers in a WGSL-like string. -/// @param wgsl_code - the WGSL-like string where the identifiers will be found. -/// @return a vector with the positions and the length of all the -/// identifiers in wgsl_code. -std::vector> GetIdentifiers(const std::string& wgsl_code); + /// A function that, given WGSL-like string and a delimiter, + /// generates another WGSL-like string by picking two random regions + /// enclosed by the delimiter and swapping them. + /// @param delimiter - the delimiter that will be used to find enclosed regions. + /// @param wgsl_code - the initial string (WGSL code) that will be mutated. + /// @return true if a swap happened or false otherwise. + bool SwapRandomIntervals(const std::string& delimiter, std::string& wgsl_code); -/// A function that returns returns the starting position -/// and the length of all the integer literals in a WGSL-like string. -/// @param wgsl_code - the WGSL-like string where the int literals -/// will be found. -/// @return a vector with the starting positions and the length -/// of all the integer literals. -std::vector> GetIntLiterals(const std::string& wgsl_code); + /// A function that, given a WGSL-like string and a delimiter, + /// generates another WGSL-like string by deleting a random + /// region enclosed by the delimiter. + /// @param delimiter - the delimiter that will be used to find enclosed regions. + /// @param wgsl_code - the initial string (WGSL code) that will be mutated. + /// @return true if a deletion happened or false otherwise. + bool DeleteRandomInterval(const std::string& delimiter, std::string& wgsl_code); -/// Finds a possible closing brace corresponding to the opening -/// brace at position opening_bracket_pos. -/// @param opening_bracket_pos - the position of the opening brace. -/// @param wgsl_code - the WGSL-like string where the closing brace. -/// @return the position of the closing bracket or 0 if there is no closing -/// brace. -size_t FindClosingBrace(size_t opening_bracket_pos, const std::string& wgsl_code); + /// A function that, given a WGSL-like string and a delimiter, + /// generates another WGSL-like string by duplicating a random + /// region enclosed by the delimiter. + /// @param delimiter - the delimiter that will be used to find enclosed regions. + /// @param wgsl_code - the initial string (WGSL code) that will be mutated. + /// @return true if a duplication happened or false otherwise. + bool DuplicateRandomInterval(const std::string& delimiter, std::string& wgsl_code); -/// Returns the starting_position of the bodies of the functions -/// that follow the regular expression: fn.*?->.*?\\{, which searches for the -/// keyword fn followed by the function name, its return type and opening brace. -/// @param wgsl_code - the WGSL-like string where the functions will be -/// searched. -/// @return a vector with the starting position of the function bodies in -/// wgsl_code. -std::vector GetFunctionBodyPositions(const std::string& wgsl_code); + /// Replaces a randomly-chosen identifier in wgsl_code. + /// @param wgsl_code - WGSL-like string where the replacement will occur. + /// @return true if a replacement happened or false otherwise. + bool ReplaceRandomIdentifier(std::string& wgsl_code); -/// Given 4 indices, idx1, idx2, idx3 and idx4 it swaps the regions -/// in the interval (idx1, idx2] with the region in the interval (idx3, idx4] -/// in wgsl_text. -/// @param idx1 - starting index of the first region. -/// @param reg1_len - length of the first region. -/// @param idx2 - starting index of the second region. -/// @param reg2_len - length of the second region. -/// @param wgsl_code - the string where the swap will occur. -void SwapIntervals(size_t idx1, - size_t reg1_len, - size_t idx2, - size_t reg2_len, - std::string& wgsl_code); + /// Replaces the value of a randomly-chosen integer with one of + /// the values in the set {INT_MAX, INT_MIN, 0, -1}. + /// @param wgsl_code - WGSL-like string where the replacement will occur. + /// @return true if a replacement happened or false otherwise. + bool ReplaceRandomIntLiteral(std::string& wgsl_code); -/// Given index idx1 it delets the region of length interval_len -/// starting at index idx1; -/// @param idx1 - starting index of the first region. -/// @param reg_len - terminating index of the second region. -/// @param wgsl_code - the string where the swap will occur. -void DeleteInterval(size_t idx1, size_t reg_len, std::string& wgsl_code); + /// Inserts a return statement in a randomly chosen function of a + /// WGSL-like string. The return value is a randomly-chosen identifier + /// or literal in the string. + /// @param wgsl_code - WGSL-like string that will be mutated. + /// @return true if the mutation was succesful or false otherwise. + bool InsertReturnStatement(std::string& wgsl_code); -/// Given 2 indices, idx1, idx2, it inserts the region of length -/// reg1_len starting at idx1 after idx2. -/// @param idx1 - starting index of region. -/// @param reg1_len - length of the region. -/// @param idx2 - the position where the region will be inserted. -/// @param wgsl_code - the string where the swap will occur. -void DuplicateInterval(size_t idx1, size_t reg1_len, size_t idx2, std::string& wgsl_code); + /// Inserts a break or continue statement in a randomly chosen loop of a WGSL-like string. + /// @param wgsl_code - WGSL-like string that will be mutated. + /// @return true if the mutation was succesful or false otherwise. + bool InsertBreakOrContinue(std::string& wgsl_code); -/// Replaces a region of a WGSL-like string of length id2_len starting -/// at position idx2 with a region of length id1_len starting at -/// position idx1. -/// @param idx1 - starting position of the first region. -/// @param id1_len - length of the first region. -/// @param idx2 - starting position of the second region. -/// @param id2_len - length of the second region. -/// @param wgsl_code - the string where the replacement will occur. -void ReplaceRegion(size_t idx1, - size_t id1_len, - size_t idx2, - size_t id2_len, - std::string& wgsl_code); + /// A function that, given WGSL-like string, generates a new WGSL-like string by replacing one + /// randomly-chosen operator in the original string with another operator. + /// @param wgsl_code - the initial WGSL-like string that will be mutated. + /// @return true if an operator replacement happened or false otherwise. + bool ReplaceRandomOperator(std::string& wgsl_code); -/// Replaces an interval of length `length` starting at start_index -/// with the `replacement_text`. -/// @param start_index - starting position of the interval to be replaced. -/// @param length - length of the interval to be replaced. -/// @param replacement_text - the interval that will be used as a replacement. -/// @param wgsl_code - the WGSL-like string where the replacement will occur. -void ReplaceInterval(size_t start_index, - size_t length, - std::string replacement_text, - std::string& wgsl_code); + /// Given a WGSL-like string, replaces a random identifier that appears to be a function call + /// with the name of a built-in function. This will often lead to an invalid module, as the + /// mutation does not aim to check whether the original and replacement function have the same + /// number or types of arguments. + /// @param wgsl_code - the initial WGSL-like string that will be mutated. + /// @return true if a function call replacement happened or false otherwise. + bool ReplaceFunctionCallWithBuiltin(std::string& wgsl_code); -/// A function that, given WGSL-like string and a delimiter, -/// generates another WGSL-like string by picking two random regions -/// enclosed by the delimiter and swapping them. -/// @param delimiter - the delimiter that will be used to find enclosed regions. -/// @param wgsl_code - the initial string (WGSL code) that will be mutated. -/// @param generator - the random number generator. -/// @return true if a swap happened or false otherwise. -bool SwapRandomIntervals(const std::string& delimiter, - std::string& wgsl_code, - RandomGenerator& generator); + /// Given a WGSL-like string, adds a swizzle operation to either (a) an identifier, (b) a vector + /// constructor, or (c) an existing swizzle. + /// @param wgsl_code - the initial WGSL-like string that will be mutated. + /// @return true if a swizzle operation is added or false otherwise. + bool AddSwizzle(std::string& wgsl_code); -/// A function that, given a WGSL-like string and a delimiter, -/// generates another WGSL-like string by deleting a random -/// region enclosed by the delimiter. -/// @param delimiter - the delimiter that will be used to find enclosed regions. -/// @param wgsl_code - the initial string (WGSL code) that will be mutated. -/// @param generator - the random number generator. -/// @return true if a deletion happened or false otherwise. -bool DeleteRandomInterval(const std::string& delimiter, - std::string& wgsl_code, - RandomGenerator& generator); + protected: + /// Given index idx1 it delets the region of length interval_len + /// starting at index idx1; + /// @param idx1 - starting index of the first region. + /// @param reg_len - terminating index of the second region. + /// @param wgsl_code - the string where the swap will occur. + void DeleteInterval(size_t idx1, size_t reg_len, std::string& wgsl_code); -/// A function that, given a WGSL-like string and a delimiter, -/// generates another WGSL-like string by duplicating a random -/// region enclosed by the delimiter. -/// @param delimiter - the delimiter that will be used to find enclosed regions. -/// @param wgsl_code - the initial string (WGSL code) that will be mutated. -/// @param generator - the random number generator. -/// @return true if a duplication happened or false otherwise. -bool DuplicateRandomInterval(const std::string& delimiter, - std::string& wgsl_code, - RandomGenerator& generator); + /// Given 2 indices, idx1, idx2, it inserts the region of length + /// reg1_len starting at idx1 after idx2. + /// @param idx1 - starting index of region. + /// @param reg1_len - length of the region. + /// @param idx2 - the position where the region will be inserted. + /// @param wgsl_code - the string where the swap will occur. + void DuplicateInterval(size_t idx1, size_t reg1_len, size_t idx2, std::string& wgsl_code); -/// Replaces a randomly-chosen identifier in wgsl_code. -/// @param wgsl_code - WGSL-like string where the replacement will occur. -/// @param generator - the random number generator. -/// @return true if a replacement happened or false otherwise. -bool ReplaceRandomIdentifier(std::string& wgsl_code, RandomGenerator& generator); + /// Finds a possible closing bracket corresponding to the opening + /// bracket at position opening_bracket_pos. + /// @param opening_bracket_pos - the position of the opening bracket. + /// @param wgsl_code - the WGSL-like string where the closing bracket. + /// @param opening_bracket_character - the opening bracket character, e.g. (, {, <, or [ + /// @param closing_bracket_character - the closing bracket character, e.g. ), }, >, or ] + /// @return the position of the closing bracket or 0 if there is no closing + /// bracket. + size_t FindClosingBracket(size_t opening_bracket_pos, + const std::string& wgsl_code, + char opening_bracket_character, + char closing_bracket_character); -/// Replaces the value of a randomly-chosen integer with one of -/// the values in the set {INT_MAX, INT_MIN, 0, -1}. -/// @param wgsl_code - WGSL-like string where the replacement will occur. -/// @param generator - the random number generator. -/// @return true if a replacement happened or false otherwise. -bool ReplaceRandomIntLiteral(std::string& wgsl_code, RandomGenerator& generator); + /// Returns the starting position of the bodies of the functions identified by an appropriate + /// function, together with a boolean indicating whether the function returns a value or not. + /// @param wgsl_code - the WGSL-like string where the functions will be + /// searched. + /// @return a vector of pairs, where each pair provides the starting position of the function + /// body, and the value true if and only if the function returns a value. + std::vector> GetFunctionBodyPositions(const std::string& wgsl_code); + + /// Returns the starting position of the bodies of the loops identified by an appropriate + /// regular expressions. + /// @param wgsl_code - the WGSL-like string in which loops will be searched for. + /// @return a vector with the starting position of the loop bodies in wgsl_code. + std::vector GetLoopBodyPositions(const std::string& wgsl_code); + + /// A function that finds all the identifiers in a WGSL-like string. + /// @param wgsl_code - the WGSL-like string where the identifiers will be found. + /// @return a vector with the positions and the length of all the + /// identifiers in wgsl_code. + std::vector> GetIdentifiers(const std::string& wgsl_code); + + /// A function that finds the identifiers in a WGSL-like string that appear to be used as + /// function names in function call expressions. + /// @param wgsl_code - the WGSL-like string where the identifiers will be found. + /// @return a vector with the positions and the length of all the + /// identifiers in wgsl_code. + std::vector> GetFunctionCallIdentifiers(const std::string& wgsl_code); + + /// A function that returns returns the starting position + /// and the length of all the integer literals in a WGSL-like string. + /// @param wgsl_code - the WGSL-like string where the int literals + /// will be found. + /// @return a vector with the starting positions and the length + /// of all the integer literals. + std::vector> GetIntLiterals(const std::string& wgsl_code); + + /// Replaces a region of a WGSL-like string of length id2_len starting + /// at position idx2 with a region of length id1_len starting at + /// position idx1. + /// @param idx1 - starting position of the first region. + /// @param id1_len - length of the first region. + /// @param idx2 - starting position of the second region. + /// @param id2_len - length of the second region. + /// @param wgsl_code - the string where the replacement will occur. + void ReplaceRegion(size_t idx1, + size_t id1_len, + size_t idx2, + size_t id2_len, + std::string& wgsl_code); + + /// Given 4 indices, idx1, idx2, idx3 and idx4 it swaps the regions + /// in the interval (idx1, idx2] with the region in the interval (idx3, idx4] + /// in wgsl_text. + /// @param idx1 - starting index of the first region. + /// @param reg1_len - length of the first region. + /// @param idx2 - starting index of the second region. + /// @param reg2_len - length of the second region. + /// @param wgsl_code - the string where the swap will occur. + void SwapIntervals(size_t idx1, + size_t reg1_len, + size_t idx2, + size_t reg2_len, + std::string& wgsl_code); + + /// Finds the next occurrence of an operator in a WGSL-like string from a given starting + /// position, wrapping around to the start of the string if no operator is found before reaching + /// the end, and returning empty of no operator is found at all. There is no guarantee that the + /// result will correspond to a WGSL operator token, e.g. the identified characters could be + /// part of a comment, or e.g. the file might contain >>=, in which case the operator + /// >= will be identified should it happen that the starting index corresponds to the second > + /// character of this operator. Given that the regex mutator does not aim to guarantee + /// well-formed programs, these issues are acceptable. + /// @param wgsl_code - the WGSL-like string in which operator occurrences will be found. + /// @param start_index - the index at which search should start + /// @return empty if no operator is found, otherwise a pair comprising the index at which the + /// operator starts and the character length of the operator. + std::optional> FindOperatorOccurrence( + const std::string& wgsl_code, + uint32_t start_index); + + /// Finds all the swizzle operations in a WGSL-like string. + /// @param wgsl_code - the WGSL-like string where the swizzles will be found. + /// @return a vector with the positions and lengths of all the swizzles in wgsl_code. + std::vector> GetSwizzles(const std::string& wgsl_code); + + /// Finds all the vector constructors in a WGSL-like string. + /// @param wgsl_code - the WGSL-like string where the vector constructors will be found. + /// @return a vector with the positions and lengths of all the vector constructors in wgsl_code. + std::vector> GetVectorConstructors(const std::string& wgsl_code); + + private: + /// A function that given a delimiter, returns a vector that contains + /// all the positions of the delimiter in the WGSL code. + /// @param delimiter - the delimiter of the enclosed region. + /// @param wgsl_code - the initial string (WGSL code) that will be mutated. + /// @return a vector with the positions of the delimiter in the WGSL code. + std::vector FindDelimiterIndices(const std::string& delimiter, + const std::string& wgsl_code); + + /// Replaces an interval of length `length` starting at start_index + /// with the `replacement_text`. + /// @param start_index - starting position of the interval to be replaced. + /// @param length - length of the interval to be replaced. + /// @param replacement_text - the interval that will be used as a replacement. + /// @param wgsl_code - the WGSL-like string where the replacement will occur. + void ReplaceInterval(size_t start_index, + size_t length, + std::string replacement_text, + std::string& wgsl_code); + + /// Given a string representing a WGSL operator, randomly returns a different WGSL operator in + /// the same category as the original, where the three categories are assignment operators (such + /// as = and +=), expression operators (such as + and ^) and increment operators (++ and --). + /// @param existing_operator - the characters comprising some WGSL operator + /// @return another WGSL operator falling into the same category. + std::string ChooseRandomReplacementForOperator(const std::string& existing_operator); + + /// Yields a fixed set of commonly-used WGSL keywords. The regex fuzzer relies heavily on + /// recognizing possible identifiers via regular expressions. There is a high chance that + /// keywords will be recognized as identifiers, which will leads to invalid code. It is valuable + /// for this to occur to some extent (to stress test validation), but it is useful to be able to + /// exclude the most common keywords so that invalidity does not occur too often. + /// @return a set of commonly-used WGSL keywords. + static std::unordered_set GetCommonKeywords(); + + RandomGenerator& generator_; +}; -/// Inserts a return statement in a randomly chosen function of a -/// WGSL-like string. The return value is a randomly-chosen identifier -/// or literal in the string. -/// @param wgsl_code - WGSL-like string that will be mutated. -/// @param generator - the random number generator. -/// @return true if the mutation was succesful or false otherwise. -bool InsertReturnStatement(std::string& wgsl_code, RandomGenerator& generator); } // namespace tint::fuzzers::regex_fuzzer #endif // SRC_TINT_FUZZERS_TINT_REGEX_FUZZER_WGSL_MUTATOR_H_ diff --git a/src/tint/fuzzers/tint_spirv_tools_fuzzer/fuzzer.cc b/src/tint/fuzzers/tint_spirv_tools_fuzzer/fuzzer.cc index c35e0ce087..41e417bc04 100644 --- a/src/tint/fuzzers/tint_spirv_tools_fuzzer/fuzzer.cc +++ b/src/tint/fuzzers/tint_spirv_tools_fuzzer/fuzzer.cc @@ -27,6 +27,7 @@ #include "src/tint/fuzzers/tint_spirv_tools_fuzzer/spirv_opt_mutator.h" #include "src/tint/fuzzers/tint_spirv_tools_fuzzer/spirv_reduce_mutator.h" #include "src/tint/fuzzers/tint_spirv_tools_fuzzer/util.h" +#include "testing/libfuzzer/libfuzzer_exports.h" namespace tint::fuzzers::spvtools_fuzzer { namespace { diff --git a/src/tint/inspector/entry_point.h b/src/tint/inspector/entry_point.h index b9ac4e429e..5d119d4a40 100644 --- a/src/tint/inspector/entry_point.h +++ b/src/tint/inspector/entry_point.h @@ -15,10 +15,13 @@ #ifndef SRC_TINT_INSPECTOR_ENTRY_POINT_H_ #define SRC_TINT_INSPECTOR_ENTRY_POINT_H_ +#include #include #include #include +#include "tint/override_id.h" + #include "src/tint/ast/interpolate_attribute.h" #include "src/tint/ast/pipeline_stage.h" @@ -92,14 +95,13 @@ InterpolationType ASTToInspectorInterpolationType(ast::InterpolationType ast_typ /// @returns the publicly visible equivalent InterpolationSampling ASTToInspectorInterpolationSampling(ast::InterpolationSampling sampling); -/// Reflection data about a pipeline overridable constant referenced by an entry -/// point -struct OverridableConstant { - /// Name of the constant +/// Reflection data about an override variable referenced by an entry point +struct Override { + /// Name of the override std::string name; - /// ID of the constant - uint16_t numeric_id; + /// ID of the override + OverrideId id; /// Type of the scalar enum class Type { @@ -112,12 +114,24 @@ struct OverridableConstant { /// Type of the scalar Type type; - /// Does this pipeline overridable constant have an initializer? + /// Does this override have an initializer? bool is_initialized = false; - /// Does this pipeline overridable constant have a numeric ID specified - /// explicitly? - bool is_numeric_id_specified = false; + /// Does this override have a numeric ID specified explicitly? + bool is_id_specified = false; +}; + +/// The pipeline stage +enum class PipelineStage { kVertex, kFragment, kCompute }; + +/// WorkgroupSize describes the dimensions of the workgroup grid for a compute shader. +struct WorkgroupSize { + /// The 'x' dimension of the workgroup grid + uint32_t x = 1; + /// The 'y' dimension of the workgroup grid + uint32_t y = 1; + /// The 'z' dimension of the workgroup grid + uint32_t z = 1; }; /// Reflection data for an entry point in the shader. @@ -135,19 +149,17 @@ struct EntryPoint { /// Remapped entry point name in the backend std::string remapped_name; /// The entry point stage - ast::PipelineStage stage = ast::PipelineStage::kNone; - /// The workgroup x size - uint32_t workgroup_size_x = 0; - /// The workgroup y size - uint32_t workgroup_size_y = 0; - /// The workgroup z size - uint32_t workgroup_size_z = 0; + PipelineStage stage; + /// The workgroup size. If PipelineStage is kCompute and this holds no value, then the workgroup + /// size is derived from an override-expression. In this situation you first need to run the + /// tint::transform::SubstituteOverride transform before using the inspector. + std::optional workgroup_size; /// List of the input variable accessed via this entry point. std::vector input_variables; /// List of the output variable accessed via this entry point. std::vector output_variables; /// List of the pipeline overridable constants accessed via this entry point. - std::vector overridable_constants; + std::vector overrides; /// Does the entry point use the sample_mask builtin as an input builtin /// variable. bool input_sample_mask_used = false; @@ -163,12 +175,6 @@ struct EntryPoint { bool sample_index_used = false; /// Does the entry point use the num_workgroups builtin bool num_workgroups_used = false; - - /// @returns the size of the workgroup in {x,y,z} format - std::tuple workgroup_size() { - return std::tuple(workgroup_size_x, workgroup_size_y, - workgroup_size_z); - } }; } // namespace tint::inspector diff --git a/src/tint/inspector/inspector.cc b/src/tint/inspector/inspector.cc index bdc14b019b..2f8d09ac02 100644 --- a/src/tint/inspector/inspector.cc +++ b/src/tint/inspector/inspector.cc @@ -19,18 +19,26 @@ #include "src/tint/ast/bool_literal_expression.h" #include "src/tint/ast/call_expression.h" +#include "src/tint/ast/extension.h" #include "src/tint/ast/float_literal_expression.h" #include "src/tint/ast/id_attribute.h" +#include "src/tint/ast/int_literal_expression.h" #include "src/tint/ast/interpolate_attribute.h" #include "src/tint/ast/location_attribute.h" #include "src/tint/ast/module.h" +#include "src/tint/ast/override.h" +#include "src/tint/ast/var.h" #include "src/tint/sem/array.h" #include "src/tint/sem/call.h" #include "src/tint/sem/depth_multisampled_texture.h" +#include "src/tint/sem/depth_texture.h" +#include "src/tint/sem/external_texture.h" +#include "src/tint/sem/f16.h" #include "src/tint/sem/f32.h" #include "src/tint/sem/function.h" #include "src/tint/sem/i32.h" #include "src/tint/sem/matrix.h" +#include "src/tint/sem/module.h" #include "src/tint/sem/multisampled_texture.h" #include "src/tint/sem/sampled_texture.h" #include "src/tint/sem/statement.h" @@ -41,6 +49,7 @@ #include "src/tint/sem/vector.h" #include "src/tint/sem/void.h" #include "src/tint/utils/math.h" +#include "src/tint/utils/string.h" #include "src/tint/utils/unique_vector.h" namespace tint::inspector { @@ -98,7 +107,7 @@ std::tuple CalculateComponentAndComposition(cons std::tuple CalculateInterpolationData( const sem::Type* type, - const ast::AttributeList& attributes) { + utils::VectorRef attributes) { auto* interpolation_attribute = ast::GetAttribute(attributes); if (type->is_integer_scalar_or_vector()) { return {InterpolationType::kFlat, InterpolationSampling::kNone}; @@ -137,16 +146,32 @@ std::vector Inspector::GetEntryPoints() { EntryPoint entry_point; entry_point.name = program_->Symbols().NameFor(func->symbol); entry_point.remapped_name = program_->Symbols().NameFor(func->symbol); - entry_point.stage = func->PipelineStage(); - auto wgsize = sem->WorkgroupSize(); - entry_point.workgroup_size_x = wgsize[0].value; - entry_point.workgroup_size_y = wgsize[1].value; - entry_point.workgroup_size_z = wgsize[2].value; - if (wgsize[0].overridable_const || wgsize[1].overridable_const || - wgsize[2].overridable_const) { - // TODO(crbug.com/tint/713): Handle overridable constants. - TINT_ASSERT(Inspector, false); + switch (func->PipelineStage()) { + case ast::PipelineStage::kCompute: { + entry_point.stage = PipelineStage::kCompute; + + auto wgsize = sem->WorkgroupSize(); + if (!wgsize[0].overridable_const && !wgsize[1].overridable_const && + !wgsize[2].overridable_const) { + entry_point.workgroup_size = {wgsize[0].value, wgsize[1].value, + wgsize[2].value}; + } + break; + } + case ast::PipelineStage::kFragment: { + entry_point.stage = PipelineStage::kFragment; + break; + } + case ast::PipelineStage::kVertex: { + entry_point.stage = PipelineStage::kVertex; + break; + } + default: { + TINT_UNREACHABLE(Inspector, diagnostics_) + << "invalid pipeline stage for entry point '" << entry_point.name << "'"; + break; + } } for (auto* param : sem->Parameters()) { @@ -155,15 +180,15 @@ std::vector Inspector::GetEntryPoints() { entry_point.input_variables); entry_point.input_position_used |= ContainsBuiltin( - ast::Builtin::kPosition, param->Type(), param->Declaration()->attributes); + ast::BuiltinValue::kPosition, param->Type(), param->Declaration()->attributes); entry_point.front_facing_used |= ContainsBuiltin( - ast::Builtin::kFrontFacing, param->Type(), param->Declaration()->attributes); + ast::BuiltinValue::kFrontFacing, param->Type(), param->Declaration()->attributes); entry_point.sample_index_used |= ContainsBuiltin( - ast::Builtin::kSampleIndex, param->Type(), param->Declaration()->attributes); + ast::BuiltinValue::kSampleIndex, param->Type(), param->Declaration()->attributes); entry_point.input_sample_mask_used |= ContainsBuiltin( - ast::Builtin::kSampleMask, param->Type(), param->Declaration()->attributes); + ast::BuiltinValue::kSampleMask, param->Type(), param->Declaration()->attributes); entry_point.num_workgroups_used |= ContainsBuiltin( - ast::Builtin::kNumWorkgroups, param->Type(), param->Declaration()->attributes); + ast::BuiltinValue::kNumWorkgroups, param->Type(), param->Declaration()->attributes); } if (!sem->ReturnType()->Is()) { @@ -171,7 +196,7 @@ std::vector Inspector::GetEntryPoints() { entry_point.output_variables); entry_point.output_sample_mask_used = ContainsBuiltin( - ast::Builtin::kSampleMask, sem->ReturnType(), func->return_type_attributes); + ast::BuiltinValue::kSampleMask, sem->ReturnType(), func->return_type_attributes); } for (auto* var : sem->TransitivelyReferencedGlobals()) { @@ -180,29 +205,29 @@ std::vector Inspector::GetEntryPoints() { auto name = program_->Symbols().NameFor(decl->symbol); auto* global = var->As(); - if (global && global->IsOverridable()) { - OverridableConstant overridable_constant; - overridable_constant.name = name; - overridable_constant.numeric_id = global->ConstantId(); + if (global && global->Declaration()->Is()) { + Override override; + override.name = name; + override.id = global->OverrideId(); auto* type = var->Type(); TINT_ASSERT(Inspector, type->is_scalar()); if (type->is_bool_scalar_or_vector()) { - overridable_constant.type = OverridableConstant::Type::kBool; + override.type = Override::Type::kBool; } else if (type->is_float_scalar()) { - overridable_constant.type = OverridableConstant::Type::kFloat32; + override.type = Override::Type::kFloat32; } else if (type->is_signed_integer_scalar()) { - overridable_constant.type = OverridableConstant::Type::kInt32; + override.type = Override::Type::kInt32; } else if (type->is_unsigned_integer_scalar()) { - overridable_constant.type = OverridableConstant::Type::kUint32; + override.type = Override::Type::kUint32; } else { TINT_UNREACHABLE(Inspector, diagnostics_); } - overridable_constant.is_initialized = global->Declaration()->constructor; - overridable_constant.is_numeric_id_specified = + override.is_initialized = global->Declaration()->constructor; + override.is_id_specified = ast::HasAttribute(global->Declaration()->attributes); - entry_point.overridable_constants.push_back(overridable_constant); + entry_point.overrides.push_back(override); } } @@ -212,37 +237,37 @@ std::vector Inspector::GetEntryPoints() { return result; } -std::map Inspector::GetConstantIDs() { - std::map result; +std::map Inspector::GetOverrideDefaultValues() { + std::map result; for (auto* var : program_->AST().GlobalVariables()) { auto* global = program_->Sem().Get(var); - if (!global || !global->IsOverridable()) { + if (!global || !global->Declaration()->Is()) { continue; } - // If there are conflicting defintions for a constant id, that is invalid + // If there are conflicting defintions for an override id, that is invalid // WGSL, so the resolver should catch it. Thus here the inspector just - // assumes all definitions of the constant id are the same, so only needs - // to find the first reference to constant id. - uint32_t constant_id = global->ConstantId(); - if (result.find(constant_id) != result.end()) { + // assumes all definitions of the override id are the same, so only needs + // to find the first reference to override id. + OverrideId override_id = global->OverrideId(); + if (result.find(override_id) != result.end()) { continue; } if (!var->constructor) { - result[constant_id] = Scalar(); + result[override_id] = Scalar(); continue; } auto* literal = var->constructor->As(); if (!literal) { // This is invalid WGSL, but handling gracefully. - result[constant_id] = Scalar(); + result[override_id] = Scalar(); continue; } if (auto* l = literal->As()) { - result[constant_id] = Scalar(l->value); + result[override_id] = Scalar(l->value); continue; } @@ -250,32 +275,32 @@ std::map Inspector::GetConstantIDs() { switch (l->suffix) { case ast::IntLiteralExpression::Suffix::kNone: case ast::IntLiteralExpression::Suffix::kI: - result[constant_id] = Scalar(static_cast(l->value)); + result[override_id] = Scalar(static_cast(l->value)); continue; case ast::IntLiteralExpression::Suffix::kU: - result[constant_id] = Scalar(static_cast(l->value)); + result[override_id] = Scalar(static_cast(l->value)); continue; } } if (auto* l = literal->As()) { - result[constant_id] = Scalar(l->value); + result[override_id] = Scalar(static_cast(l->value)); continue; } - result[constant_id] = Scalar(); + result[override_id] = Scalar(); } return result; } -std::map Inspector::GetConstantNameToIdMap() { - std::map result; +std::map Inspector::GetNamedOverrideIds() { + std::map result; for (auto* var : program_->AST().GlobalVariables()) { auto* global = program_->Sem().Get(var); - if (global && global->IsOverridable()) { + if (global && global->Declaration()->Is()) { auto name = program_->Symbols().NameFor(var->symbol); - result[name] = global->ConstantId(); + result[name] = global->OverrideId(); } } return result; @@ -345,8 +370,8 @@ std::vector Inspector::GetUniformBufferResourceBindings( ResourceBinding entry; entry.resource_type = ResourceBinding::ResourceType::kUniformBuffer; - entry.bind_group = binding_info.group->value; - entry.binding = binding_info.binding->value; + entry.bind_group = binding_info.group; + entry.binding = binding_info.binding; entry.size = unwrapped_type->Size(); entry.size_no_padding = entry.size; if (auto* str = unwrapped_type->As()) { @@ -385,8 +410,8 @@ std::vector Inspector::GetSamplerResourceBindings(const std::st ResourceBinding entry; entry.resource_type = ResourceBinding::ResourceType::kSampler; - entry.bind_group = binding_info.group->value; - entry.binding = binding_info.binding->value; + entry.bind_group = binding_info.group; + entry.binding = binding_info.binding; result.push_back(entry); } @@ -409,8 +434,8 @@ std::vector Inspector::GetComparisonSamplerResourceBindings( ResourceBinding entry; entry.resource_type = ResourceBinding::ResourceType::kComparisonSampler; - entry.bind_group = binding_info.group->value; - entry.binding = binding_info.binding->value; + entry.bind_group = binding_info.group; + entry.binding = binding_info.binding; result.push_back(entry); } @@ -450,8 +475,8 @@ std::vector Inspector::GetTextureResourceBindings( ResourceBinding entry; entry.resource_type = resource_type; - entry.bind_group = binding_info.group->value; - entry.binding = binding_info.binding->value; + entry.bind_group = binding_info.group; + entry.binding = binding_info.binding; auto* tex = var->Type()->UnwrapRef()->As(); entry.dim = TypeTextureDimensionToResourceBindingTextureDimension(tex->dim()); @@ -480,7 +505,7 @@ std::vector Inspector::GetExternalTextureResourceBindings( ResourceBinding::ResourceType::kExternalTexture); } -std::vector Inspector::GetSamplerTextureUses( +utils::Vector Inspector::GetSamplerTextureUses( const std::string& entry_point) { auto* func = FindEntryPointByName(entry_point); if (!func) { @@ -543,16 +568,13 @@ uint32_t Inspector::GetWorkgroupStorageSize(const std::string& entry_point) { } std::vector Inspector::GetUsedExtensionNames() { - std::vector result; - - ast::ExtensionSet set = program_->AST().Extensions(); - result.reserve(set.size()); - for (auto kind : set) { - std::string name = ast::Enable::KindToName(kind); - result.push_back(name); + auto& extensions = program_->Sem().Module()->Extensions(); + std::vector out; + out.reserve(extensions.Length()); + for (auto ext : extensions) { + out.push_back(utils::ToString(ext)); } - - return result; + return out; } std::vector> Inspector::GetEnableDirectives() { @@ -562,7 +584,7 @@ std::vector> Inspector::GetEnableDirectives() { auto global_decls = program_->AST().GlobalDeclarations(); for (auto* node : global_decls) { if (auto* ext = node->As()) { - result.push_back({ext->name, ext->source}); + result.push_back({utils::ToString(ext->extension), ext->source}); } } @@ -586,7 +608,7 @@ const ast::Function* Inspector::FindEntryPointByName(const std::string& name) { void Inspector::AddEntryPointInOutVariables(std::string name, const sem::Type* type, - const ast::AttributeList& attributes, + utils::VectorRef attributes, std::vector& variables) const { // Skip builtins. if (ast::HasAttribute(attributes)) { @@ -623,9 +645,9 @@ void Inspector::AddEntryPointInOutVariables(std::string name, variables.push_back(stage_variable); } -bool Inspector::ContainsBuiltin(ast::Builtin builtin, +bool Inspector::ContainsBuiltin(ast::BuiltinValue builtin, const sem::Type* type, - const ast::AttributeList& attributes) const { + utils::VectorRef attributes) const { auto* unwrapped_type = type->UnwrapRef(); if (auto* struct_ty = unwrapped_type->As()) { @@ -670,8 +692,8 @@ std::vector Inspector::GetStorageBufferResourceBindingsImpl( ResourceBinding entry; entry.resource_type = read_only ? ResourceBinding::ResourceType::kReadOnlyStorageBuffer : ResourceBinding::ResourceType::kStorageBuffer; - entry.bind_group = binding_info.group->value; - entry.binding = binding_info.binding->value; + entry.bind_group = binding_info.group; + entry.binding = binding_info.binding; entry.size = unwrapped_type->Size(); if (auto* str = unwrapped_type->As()) { entry.size_no_padding = str->SizeNoPadding(); @@ -706,8 +728,8 @@ std::vector Inspector::GetSampledTextureResourceBindingsImpl( entry.resource_type = multisampled_only ? ResourceBinding::ResourceType::kMultisampledTexture : ResourceBinding::ResourceType::kSampledTexture; - entry.bind_group = binding_info.group->value; - entry.binding = binding_info.binding->value; + entry.bind_group = binding_info.group; + entry.binding = binding_info.binding; auto* texture_type = var->Type()->UnwrapRef()->As(); entry.dim = TypeTextureDimensionToResourceBindingTextureDimension(texture_type->dim()); @@ -743,8 +765,8 @@ std::vector Inspector::GetStorageTextureResourceBindingsImpl( ResourceBinding entry; entry.resource_type = ResourceBinding::ResourceType::kWriteOnlyStorageTexture; - entry.bind_group = binding_info.group->value; - entry.binding = binding_info.binding->value; + entry.bind_group = binding_info.group; + entry.binding = binding_info.binding; entry.dim = TypeTextureDimensionToResourceBindingTextureDimension(texture_type->dim()); @@ -767,7 +789,7 @@ void Inspector::GenerateSamplerTargets() { } sampler_targets_ = std::make_unique< - std::unordered_map>>(); + std::unordered_map>>(); auto& sem = program_->Sem(); @@ -777,7 +799,7 @@ void Inspector::GenerateSamplerTargets() { continue; } - auto* call = sem.Get(c); + auto* call = sem.Get(c)->UnwrapMaterialize()->As(); if (!call) { continue; } @@ -810,28 +832,22 @@ void Inspector::GenerateSamplerTargets() { continue; } - auto* t = c->args[texture_index]; - auto* s = c->args[sampler_index]; + auto* t = c->args[static_cast(texture_index)]; + auto* s = c->args[static_cast(sampler_index)]; - GetOriginatingResources(std::array{t, s}, - [&](std::array globals) { - auto* texture = globals[0]; - sem::BindingPoint texture_binding_point = { - texture->Declaration()->BindingPoint().group->value, - texture->Declaration()->BindingPoint().binding->value}; + GetOriginatingResources( + std::array{t, s}, + [&](std::array globals) { + auto texture_binding_point = globals[0]->BindingPoint(); + auto sampler_binding_point = globals[1]->BindingPoint(); - auto* sampler = globals[1]; - sem::BindingPoint sampler_binding_point = { - sampler->Declaration()->BindingPoint().group->value, - sampler->Declaration()->BindingPoint().binding->value}; - - for (auto* entry_point : entry_points) { - const auto& ep_name = program_->Symbols().NameFor( - entry_point->Declaration()->symbol); - (*sampler_targets_)[ep_name].add( - {sampler_binding_point, texture_binding_point}); - } - }); + for (auto* entry_point : entry_points) { + const auto& ep_name = + program_->Symbols().NameFor(entry_point->Declaration()->symbol); + (*sampler_targets_)[ep_name].Add( + {sampler_binding_point, texture_binding_point}); + } + }); } } @@ -847,7 +863,7 @@ void Inspector::GetOriginatingResources(std::array ex std::array globals{}; std::array parameters{}; - utils::UniqueVector callsites; + utils::UniqueVector callsites; for (size_t i = 0; i < N; i++) { const sem::Variable* source_var = sem.Get(exprs[i])->SourceVariable(); @@ -861,7 +877,7 @@ void Inspector::GetOriginatingResources(std::array ex return; } for (auto* call : func->CallSites()) { - callsites.add(call->Declaration()); + callsites.Add(call->Declaration()); } parameters[i] = param; } else { @@ -872,7 +888,7 @@ void Inspector::GetOriginatingResources(std::array ex } } - if (callsites.size()) { + if (callsites.Length()) { for (auto* call_expr : callsites) { // Make a copy of the expressions for this callsite std::array call_exprs = exprs; diff --git a/src/tint/inspector/inspector.h b/src/tint/inspector/inspector.h index a5aee178ea..f3fe27008a 100644 --- a/src/tint/inspector/inspector.h +++ b/src/tint/inspector/inspector.h @@ -23,6 +23,8 @@ #include #include +#include "tint/override_id.h" + #include "src/tint/inspector/entry_point.h" #include "src/tint/inspector/resource_binding.h" #include "src/tint/inspector/scalar.h" @@ -53,11 +55,11 @@ class Inspector { /// @returns vector of entry point information std::vector GetEntryPoints(); - /// @returns map of const_id to initial value - std::map GetConstantIDs(); + /// @returns map of override identifier to initial value + std::map GetOverrideDefaultValues(); /// @returns map of module-constant name to pipeline constant ID - std::map GetConstantNameToIdMap(); + std::map GetNamedOverrideIds(); /// @param entry_point name of the entry point to get information about. /// @returns the total size of shared storage required by an entry point, @@ -120,7 +122,7 @@ class Inspector { /// @param entry_point name of the entry point to get information about. /// @returns vector of all of the sampler/texture sampling pairs that are used /// by that entry point. - std::vector GetSamplerTextureUses(const std::string& entry_point); + utils::Vector GetSamplerTextureUses(const std::string& entry_point); /// @param entry_point name of the entry point to get information about. /// @param placeholder the sampler binding point to use for texture-only @@ -151,7 +153,8 @@ class Inspector { private: const Program* program_; diag::List diagnostics_; - std::unique_ptr>> + std::unique_ptr< + std::unordered_map>> sampler_targets_; /// @param name name of the entry point to find @@ -168,15 +171,15 @@ class Inspector { /// @param variables the list to add the variables to void AddEntryPointInOutVariables(std::string name, const sem::Type* type, - const ast::AttributeList& attributes, + utils::VectorRef attributes, std::vector& variables) const; /// Recursively determine if the type contains builtin. /// If `type` is a struct, recurse into members to check for the attribute. /// Otherwise, check `attributes` for the attribute. - bool ContainsBuiltin(ast::Builtin builtin, + bool ContainsBuiltin(ast::BuiltinValue builtin, const sem::Type* type, - const ast::AttributeList& attributes) const; + utils::VectorRef attributes) const; /// Gathers all the texture resource bindings of the given type for the given /// entry point. diff --git a/src/tint/inspector/inspector_test.cc b/src/tint/inspector/inspector_test.cc index 8e3662b570..5f0013f70e 100644 --- a/src/tint/inspector/inspector_test.cc +++ b/src/tint/inspector/inspector_test.cc @@ -60,7 +60,7 @@ struct InspectorGetEntryPointInterpolateTestParams { class InspectorGetEntryPointInterpolateTest : public InspectorBuilder, public testing::TestWithParam {}; -class InspectorGetConstantIDsTest : public InspectorBuilder, public testing::Test {}; +class InspectorGetOverrideDefaultValuesTest : public InspectorBuilder, public testing::Test {}; class InspectorGetConstantNameToIdMapTest : public InspectorBuilder, public testing::Test {}; class InspectorGetStorageSizeTest : public InspectorBuilder, public testing::Test {}; class InspectorGetResourceBindingsTest : public InspectorBuilder, public testing::Test {}; @@ -154,7 +154,7 @@ TEST_F(InspectorGetEntryPointTest, NoEntryPoints) { } TEST_F(InspectorGetEntryPointTest, OneEntryPoint) { - MakeEmptyBodyFunction("foo", ast::AttributeList{ + MakeEmptyBodyFunction("foo", utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -168,16 +168,18 @@ TEST_F(InspectorGetEntryPointTest, OneEntryPoint) { ASSERT_EQ(1u, result.size()); EXPECT_EQ("foo", result[0].name); EXPECT_EQ("foo", result[0].remapped_name); - EXPECT_EQ(ast::PipelineStage::kFragment, result[0].stage); + EXPECT_EQ(PipelineStage::kFragment, result[0].stage); } TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) { - MakeEmptyBodyFunction("foo", ast::AttributeList{ + MakeEmptyBodyFunction("foo", utils::Vector{ Stage(ast::PipelineStage::kFragment), }); - MakeEmptyBodyFunction( - "bar", ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + MakeEmptyBodyFunction("bar", utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); // TODO(dsinclair): Update to run the namer transform when available. @@ -189,21 +191,23 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) { ASSERT_EQ(2u, result.size()); EXPECT_EQ("foo", result[0].name); EXPECT_EQ("foo", result[0].remapped_name); - EXPECT_EQ(ast::PipelineStage::kFragment, result[0].stage); + EXPECT_EQ(PipelineStage::kFragment, result[0].stage); EXPECT_EQ("bar", result[1].name); EXPECT_EQ("bar", result[1].remapped_name); - EXPECT_EQ(ast::PipelineStage::kCompute, result[1].stage); + EXPECT_EQ(PipelineStage::kCompute, result[1].stage); } TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) { - MakeEmptyBodyFunction("func", {}); + MakeEmptyBodyFunction("func", utils::Empty); - MakeCallerBodyFunction( - "foo", {"func"}, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + MakeCallerBodyFunction("foo", utils::Vector{std::string("func")}, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); - MakeCallerBodyFunction("bar", {"func"}, - ast::AttributeList{ + MakeCallerBodyFunction("bar", utils::Vector{std::string("func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -217,15 +221,17 @@ TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) { ASSERT_EQ(2u, result.size()); EXPECT_EQ("foo", result[0].name); EXPECT_EQ("foo", result[0].remapped_name); - EXPECT_EQ(ast::PipelineStage::kCompute, result[0].stage); + EXPECT_EQ(PipelineStage::kCompute, result[0].stage); EXPECT_EQ("bar", result[1].name); EXPECT_EQ("bar", result[1].remapped_name); - EXPECT_EQ(ast::PipelineStage::kFragment, result[1].stage); + EXPECT_EQ(PipelineStage::kFragment, result[1].stage); } TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) { - MakeEmptyBodyFunction("foo", ast::AttributeList{Stage(ast::PipelineStage::kCompute), - WorkgroupSize(8_i, 2_i, 1_i)}); + MakeEmptyBodyFunction("foo", utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(8_i, 2_i, 1_i), + }); Inspector& inspector = Build(); @@ -233,16 +239,18 @@ TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) { ASSERT_FALSE(inspector.has_error()) << inspector.error(); ASSERT_EQ(1u, result.size()); - uint32_t x, y, z; - std::tie(x, y, z) = result[0].workgroup_size(); - EXPECT_EQ(8u, x); - EXPECT_EQ(2u, y); - EXPECT_EQ(1u, z); + auto workgroup_size = result[0].workgroup_size; + ASSERT_TRUE(workgroup_size.has_value()); + EXPECT_EQ(8u, workgroup_size->x); + EXPECT_EQ(2u, workgroup_size->y); + EXPECT_EQ(1u, workgroup_size->z); } TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) { - MakeEmptyBodyFunction("foo", - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(8_i, 2_i, 1_i)}); + MakeEmptyBodyFunction("foo", utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(8_i, 2_i, 1_i), + }); Inspector& inspector = Build(); @@ -250,18 +258,18 @@ TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) { ASSERT_FALSE(inspector.has_error()) << inspector.error(); ASSERT_EQ(1u, result.size()); - uint32_t x, y, z; - std::tie(x, y, z) = result[0].workgroup_size(); - EXPECT_EQ(8u, x); - EXPECT_EQ(2u, y); - EXPECT_EQ(1u, z); + auto workgroup_size = result[0].workgroup_size; + ASSERT_TRUE(workgroup_size.has_value()); + EXPECT_EQ(8u, workgroup_size->x); + EXPECT_EQ(2u, workgroup_size->y); + EXPECT_EQ(1u, workgroup_size->z); } TEST_F(InspectorGetEntryPointTest, NoInOutVariables) { - MakeEmptyBodyFunction("func", {}); + MakeEmptyBodyFunction("func", utils::Empty); - MakeCallerBodyFunction("foo", {"func"}, - ast::AttributeList{ + MakeCallerBodyFunction("foo", utils::Vector{std::string("func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -281,9 +289,21 @@ TEST_P(InspectorGetEntryPointComponentAndCompositionTest, Test) { std::tie(component, composition) = GetParam(); std::function tint_type = GetTypeFunction(component, composition); - auto* in_var = Param("in_var", tint_type(), {Location(0u), Flat()}); - Func("foo", {in_var}, tint_type(), {Return("in_var")}, {Stage(ast::PipelineStage::kFragment)}, - {Location(0u)}); + auto* in_var = Param("in_var", tint_type(), + utils::Vector{ + Location(0u), + Flat(), + }); + Func("foo", utils::Vector{in_var}, tint_type(), + utils::Vector{ + Return("in_var"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0u), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); @@ -314,11 +334,31 @@ INSTANTIATE_TEST_SUITE_P(InspectorGetEntryPointTest, CompositionType::kVec4))); TEST_F(InspectorGetEntryPointTest, MultipleInOutVariables) { - auto* in_var0 = Param("in_var0", ty.u32(), {Location(0u), Flat()}); - auto* in_var1 = Param("in_var1", ty.u32(), {Location(1u), Flat()}); - auto* in_var4 = Param("in_var4", ty.u32(), {Location(4u), Flat()}); - Func("foo", {in_var0, in_var1, in_var4}, ty.u32(), {Return("in_var0")}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0u)}); + auto* in_var0 = Param("in_var0", ty.u32(), + utils::Vector{ + Location(0u), + Flat(), + }); + auto* in_var1 = Param("in_var1", ty.u32(), + utils::Vector{ + Location(1u), + Flat(), + }); + auto* in_var4 = Param("in_var4", ty.u32(), + utils::Vector{ + Location(4u), + Flat(), + }); + Func("foo", utils::Vector{in_var0, in_var1, in_var4}, ty.u32(), + utils::Vector{ + Return("in_var0"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0u), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); @@ -351,13 +391,37 @@ TEST_F(InspectorGetEntryPointTest, MultipleInOutVariables) { } TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutVariables) { - auto* in_var_foo = Param("in_var_foo", ty.u32(), {Location(0u), Flat()}); - Func("foo", {in_var_foo}, ty.u32(), {Return("in_var_foo")}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0u)}); + auto* in_var_foo = Param("in_var_foo", ty.u32(), + utils::Vector{ + Location(0u), + Flat(), + }); + Func("foo", utils::Vector{in_var_foo}, ty.u32(), + utils::Vector{ + Return("in_var_foo"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0u), + }); - auto* in_var_bar = Param("in_var_bar", ty.u32(), {Location(0u), Flat()}); - Func("bar", {in_var_bar}, ty.u32(), {Return("in_var_bar")}, - {Stage(ast::PipelineStage::kFragment)}, {Location(1u)}); + auto* in_var_bar = Param("in_var_bar", ty.u32(), + utils::Vector{ + Location(0u), + Flat(), + }); + Func("bar", utils::Vector{in_var_bar}, ty.u32(), + utils::Vector{ + Return("in_var_bar"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(1u), + }); Inspector& inspector = Build(); @@ -394,10 +458,24 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutVariables) { } TEST_F(InspectorGetEntryPointTest, BuiltInsNotStageVariables) { - auto* in_var0 = Param("in_var0", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)}); - auto* in_var1 = Param("in_var1", ty.f32(), {Location(0u)}); - Func("foo", {in_var0, in_var1}, ty.f32(), {Return("in_var1")}, - {Stage(ast::PipelineStage::kFragment)}, {Builtin(ast::Builtin::kFragDepth)}); + auto* in_var0 = Param("in_var0", ty.u32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleIndex), + }); + auto* in_var1 = Param("in_var1", ty.f32(), + utils::Vector{ + Location(0u), + }); + Func("foo", utils::Vector{in_var0, in_var1}, ty.f32(), + utils::Vector{ + Return("in_var1"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kFragDepth), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); @@ -415,9 +493,21 @@ TEST_F(InspectorGetEntryPointTest, BuiltInsNotStageVariables) { } TEST_F(InspectorGetEntryPointTest, InOutStruct) { - auto* interface = MakeInOutStruct("interface", {{"a", 0u}, {"b", 1u}}); - Func("foo", {Param("param", ty.Of(interface))}, ty.Of(interface), {Return("param")}, - {Stage(ast::PipelineStage::kFragment)}); + auto* interface = MakeInOutStruct("interface", utils::Vector{ + InOutInfo{"a", 0u}, + InOutInfo{"b", 1u}, + }); + Func("foo", + utils::Vector{ + Param("param", ty.Of(interface)), + }, + ty.Of(interface), + utils::Vector{ + Return("param"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); @@ -447,11 +537,21 @@ TEST_F(InspectorGetEntryPointTest, InOutStruct) { } TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutSharedStruct) { - auto* interface = MakeInOutStruct("interface", {{"a", 0u}, {"b", 1u}}); - Func("foo", {}, ty.Of(interface), {Return(Construct(ty.Of(interface)))}, - {Stage(ast::PipelineStage::kFragment)}); - Func("bar", {Param("param", ty.Of(interface))}, ty.void_(), {}, - {Stage(ast::PipelineStage::kFragment)}); + auto* interface = MakeInOutStruct("interface", utils::Vector{ + InOutInfo{"a", 0u}, + InOutInfo{"b", 1u}, + }); + Func("foo", utils::Empty, ty.Of(interface), + utils::Vector{ + Return(Construct(ty.Of(interface))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); + Func("bar", utils::Vector{Param("param", ty.Of(interface))}, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); @@ -485,12 +585,27 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutSharedStruct) { } TEST_F(InspectorGetEntryPointTest, MixInOutVariablesAndStruct) { - auto* struct_a = MakeInOutStruct("struct_a", {{"a", 0u}, {"b", 1u}}); - auto* struct_b = MakeInOutStruct("struct_b", {{"a", 2u}}); + auto* struct_a = MakeInOutStruct("struct_a", utils::Vector{ + InOutInfo{"a", 0u}, + InOutInfo{"b", 1u}, + }); + auto* struct_b = MakeInOutStruct("struct_b", utils::Vector{ + InOutInfo{"a", 2u}, + }); Func("foo", - {Param("param_a", ty.Of(struct_a)), Param("param_b", ty.Of(struct_b)), - Param("param_c", ty.f32(), {Location(3u)}), Param("param_d", ty.f32(), {Location(4u)})}, - ty.Of(struct_a), {Return("param_a")}, {Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Param("param_a", ty.Of(struct_a)), + Param("param_b", ty.Of(struct_b)), + Param("param_c", ty.f32(), utils::Vector{Location(3u)}), + Param("param_d", ty.f32(), utils::Vector{Location(4u)}), + }, + ty.Of(struct_a), + utils::Vector{ + Return("param_a"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); @@ -531,168 +646,200 @@ TEST_F(InspectorGetEntryPointTest, MixInOutVariablesAndStruct) { EXPECT_EQ(ComponentType::kUInt, result[0].output_variables[1].component_type); } -TEST_F(InspectorGetEntryPointTest, OverridableConstantUnreferenced) { - AddOverridableConstantWithoutID("foo", ty.f32(), nullptr); - MakeEmptyBodyFunction("ep_func", {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); +TEST_F(InspectorGetEntryPointTest, OverrideUnreferenced) { + Override("foo", ty.f32()); + MakeEmptyBodyFunction("ep_func", utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); ASSERT_EQ(1u, result.size()); - EXPECT_EQ(0u, result[0].overridable_constants.size()); + EXPECT_EQ(0u, result[0].overrides.size()); } -TEST_F(InspectorGetEntryPointTest, OverridableConstantReferencedByEntryPoint) { - AddOverridableConstantWithoutID("foo", ty.f32(), nullptr); +TEST_F(InspectorGetEntryPointTest, OverrideReferencedByEntryPoint) { + Override("foo", ty.f32()); MakePlainGlobalReferenceBodyFunction("ep_func", "foo", ty.f32(), - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); ASSERT_EQ(1u, result.size()); - ASSERT_EQ(1u, result[0].overridable_constants.size()); - EXPECT_EQ("foo", result[0].overridable_constants[0].name); + ASSERT_EQ(1u, result[0].overrides.size()); + EXPECT_EQ("foo", result[0].overrides[0].name); } -TEST_F(InspectorGetEntryPointTest, OverridableConstantReferencedByCallee) { - AddOverridableConstantWithoutID("foo", ty.f32(), nullptr); - MakePlainGlobalReferenceBodyFunction("callee_func", "foo", ty.f32(), {}); - MakeCallerBodyFunction("ep_func", {"callee_func"}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); +TEST_F(InspectorGetEntryPointTest, OverrideReferencedByCallee) { + Override("foo", ty.f32()); + MakePlainGlobalReferenceBodyFunction("callee_func", "foo", ty.f32(), utils::Empty); + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("callee_func")}, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); ASSERT_EQ(1u, result.size()); - ASSERT_EQ(1u, result[0].overridable_constants.size()); - EXPECT_EQ("foo", result[0].overridable_constants[0].name); + ASSERT_EQ(1u, result[0].overrides.size()); + EXPECT_EQ("foo", result[0].overrides[0].name); } -TEST_F(InspectorGetEntryPointTest, OverridableConstantSomeReferenced) { - AddOverridableConstantWithID("foo", 1, ty.f32(), nullptr); - AddOverridableConstantWithID("bar", 2, ty.f32(), nullptr); - MakePlainGlobalReferenceBodyFunction("callee_func", "foo", ty.f32(), {}); - MakeCallerBodyFunction("ep_func", {"callee_func"}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); +TEST_F(InspectorGetEntryPointTest, OverrideSomeReferenced) { + Override("foo", ty.f32(), Id(1)); + Override("bar", ty.f32(), Id(2)); + MakePlainGlobalReferenceBodyFunction("callee_func", "foo", ty.f32(), utils::Empty); + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("callee_func")}, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); ASSERT_EQ(1u, result.size()); - ASSERT_EQ(1u, result[0].overridable_constants.size()); - EXPECT_EQ("foo", result[0].overridable_constants[0].name); - EXPECT_EQ(1, result[0].overridable_constants[0].numeric_id); + ASSERT_EQ(1u, result[0].overrides.size()); + EXPECT_EQ("foo", result[0].overrides[0].name); + EXPECT_EQ(1, result[0].overrides[0].id.value); } -TEST_F(InspectorGetEntryPointTest, OverridableConstantTypes) { - AddOverridableConstantWithoutID("bool_var", ty.bool_(), nullptr); - AddOverridableConstantWithoutID("float_var", ty.f32(), nullptr); - AddOverridableConstantWithoutID("u32_var", ty.u32(), nullptr); - AddOverridableConstantWithoutID("i32_var", ty.i32(), nullptr); +TEST_F(InspectorGetEntryPointTest, OverrideTypes) { + Override("bool_var", ty.bool_()); + Override("float_var", ty.f32()); + Override("u32_var", ty.u32()); + Override("i32_var", ty.i32()); - MakePlainGlobalReferenceBodyFunction("bool_func", "bool_var", ty.bool_(), {}); - MakePlainGlobalReferenceBodyFunction("float_func", "float_var", ty.f32(), {}); - MakePlainGlobalReferenceBodyFunction("u32_func", "u32_var", ty.u32(), {}); - MakePlainGlobalReferenceBodyFunction("i32_func", "i32_var", ty.i32(), {}); + MakePlainGlobalReferenceBodyFunction("bool_func", "bool_var", ty.bool_(), utils::Empty); + MakePlainGlobalReferenceBodyFunction("float_func", "float_var", ty.f32(), utils::Empty); + MakePlainGlobalReferenceBodyFunction("u32_func", "u32_var", ty.u32(), utils::Empty); + MakePlainGlobalReferenceBodyFunction("i32_func", "i32_var", ty.i32(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"bool_func", "float_func", "u32_func", "i32_func"}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + MakeCallerBodyFunction( + "ep_func", utils::Vector{std::string("bool_func"), "float_func", "u32_func", "i32_func"}, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); ASSERT_EQ(1u, result.size()); - ASSERT_EQ(4u, result[0].overridable_constants.size()); - EXPECT_EQ("bool_var", result[0].overridable_constants[0].name); - EXPECT_EQ(inspector::OverridableConstant::Type::kBool, result[0].overridable_constants[0].type); - EXPECT_EQ("float_var", result[0].overridable_constants[1].name); - EXPECT_EQ(inspector::OverridableConstant::Type::kFloat32, - result[0].overridable_constants[1].type); - EXPECT_EQ("u32_var", result[0].overridable_constants[2].name); - EXPECT_EQ(inspector::OverridableConstant::Type::kUint32, - result[0].overridable_constants[2].type); - EXPECT_EQ("i32_var", result[0].overridable_constants[3].name); - EXPECT_EQ(inspector::OverridableConstant::Type::kInt32, - result[0].overridable_constants[3].type); + ASSERT_EQ(4u, result[0].overrides.size()); + EXPECT_EQ("bool_var", result[0].overrides[0].name); + EXPECT_EQ(inspector::Override::Type::kBool, result[0].overrides[0].type); + EXPECT_EQ("float_var", result[0].overrides[1].name); + EXPECT_EQ(inspector::Override::Type::kFloat32, result[0].overrides[1].type); + EXPECT_EQ("u32_var", result[0].overrides[2].name); + EXPECT_EQ(inspector::Override::Type::kUint32, result[0].overrides[2].type); + EXPECT_EQ("i32_var", result[0].overrides[3].name); + EXPECT_EQ(inspector::Override::Type::kInt32, result[0].overrides[3].type); } -TEST_F(InspectorGetEntryPointTest, OverridableConstantInitialized) { - AddOverridableConstantWithoutID("foo", ty.f32(), Expr(0.0f)); +TEST_F(InspectorGetEntryPointTest, OverrideInitialized) { + Override("foo", ty.f32(), Expr(0_f)); MakePlainGlobalReferenceBodyFunction("ep_func", "foo", ty.f32(), - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); ASSERT_EQ(1u, result.size()); - ASSERT_EQ(1u, result[0].overridable_constants.size()); - EXPECT_EQ("foo", result[0].overridable_constants[0].name); - EXPECT_TRUE(result[0].overridable_constants[0].is_initialized); + ASSERT_EQ(1u, result[0].overrides.size()); + EXPECT_EQ("foo", result[0].overrides[0].name); + EXPECT_TRUE(result[0].overrides[0].is_initialized); } -TEST_F(InspectorGetEntryPointTest, OverridableConstantUninitialized) { - AddOverridableConstantWithoutID("foo", ty.f32(), nullptr); +TEST_F(InspectorGetEntryPointTest, OverrideUninitialized) { + Override("foo", ty.f32()); MakePlainGlobalReferenceBodyFunction("ep_func", "foo", ty.f32(), - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); ASSERT_EQ(1u, result.size()); - ASSERT_EQ(1u, result[0].overridable_constants.size()); - EXPECT_EQ("foo", result[0].overridable_constants[0].name); + ASSERT_EQ(1u, result[0].overrides.size()); + EXPECT_EQ("foo", result[0].overrides[0].name); - EXPECT_FALSE(result[0].overridable_constants[0].is_initialized); + EXPECT_FALSE(result[0].overrides[0].is_initialized); } -TEST_F(InspectorGetEntryPointTest, OverridableConstantNumericIDSpecified) { - AddOverridableConstantWithoutID("foo_no_id", ty.f32(), nullptr); - AddOverridableConstantWithID("foo_id", 1234, ty.f32(), nullptr); +TEST_F(InspectorGetEntryPointTest, OverrideNumericIDSpecified) { + Override("foo_no_id", ty.f32()); + Override("foo_id", ty.f32(), Id(1234)); - MakePlainGlobalReferenceBodyFunction("no_id_func", "foo_no_id", ty.f32(), {}); - MakePlainGlobalReferenceBodyFunction("id_func", "foo_id", ty.f32(), {}); + MakePlainGlobalReferenceBodyFunction("no_id_func", "foo_no_id", ty.f32(), utils::Empty); + MakePlainGlobalReferenceBodyFunction("id_func", "foo_id", ty.f32(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"no_id_func", "id_func"}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("no_id_func"), "id_func"}, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); ASSERT_EQ(1u, result.size()); - ASSERT_EQ(2u, result[0].overridable_constants.size()); - EXPECT_EQ("foo_no_id", result[0].overridable_constants[0].name); - EXPECT_EQ("foo_id", result[0].overridable_constants[1].name); - EXPECT_EQ(1234, result[0].overridable_constants[1].numeric_id); + ASSERT_EQ(2u, result[0].overrides.size()); + EXPECT_EQ("foo_no_id", result[0].overrides[0].name); + EXPECT_EQ("foo_id", result[0].overrides[1].name); + EXPECT_EQ(1234, result[0].overrides[1].id.value); - EXPECT_FALSE(result[0].overridable_constants[0].is_numeric_id_specified); - EXPECT_TRUE(result[0].overridable_constants[1].is_numeric_id_specified); + EXPECT_FALSE(result[0].overrides[0].is_id_specified); + EXPECT_TRUE(result[0].overrides[1].is_id_specified); } -TEST_F(InspectorGetEntryPointTest, NonOverridableConstantSkipped) { - auto* foo_struct_type = MakeUniformBufferType("foo_type", {ty.i32()}); +TEST_F(InspectorGetEntryPointTest, NonOverrideSkipped) { + auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{ + ty.i32(), + }); AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0); - MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, ty.i32()}}); - MakeCallerBodyFunction("ep_func", {"ub_func"}, {Stage(ast::PipelineStage::kFragment)}); + MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")}, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); auto result = inspector.GetEntryPoints(); ASSERT_EQ(1u, result.size()); - EXPECT_EQ(0u, result[0].overridable_constants.size()); + EXPECT_EQ(0u, result[0].overrides.size()); } TEST_F(InspectorGetEntryPointTest, BuiltinNotReferenced) { - MakeEmptyBodyFunction("ep_func", {Stage(ast::PipelineStage::kFragment)}); + MakeEmptyBodyFunction("ep_func", utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -708,8 +855,17 @@ TEST_F(InspectorGetEntryPointTest, BuiltinNotReferenced) { } TEST_F(InspectorGetEntryPointTest, InputSampleMaskSimpleReferenced) { - auto* in_var = Param("in_var", ty.u32(), {Builtin(ast::Builtin::kSampleMask)}); - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + auto* in_var = Param("in_var", ty.u32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleMask), + }); + Func("ep_func", utils::Vector{in_var}, ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -720,12 +876,23 @@ TEST_F(InspectorGetEntryPointTest, InputSampleMaskSimpleReferenced) { } TEST_F(InspectorGetEntryPointTest, InputSampleMaskStructReferenced) { - ast::StructMemberList members; - members.push_back(Member("inner_position", ty.u32(), {Builtin(ast::Builtin::kSampleMask)})); - Structure("in_struct", members); - auto* in_var = Param("in_var", ty.type_name("in_struct"), {}); + utils::Vector members{ + Member("inner_position", ty.u32(), utils::Vector{Builtin(ast::BuiltinValue::kSampleMask)}), + }; - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + Structure("in_struct", members); + + Func("ep_func", + utils::Vector{ + Param("in_var", ty.type_name("in_struct"), utils::Empty), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -736,9 +903,20 @@ TEST_F(InspectorGetEntryPointTest, InputSampleMaskStructReferenced) { } TEST_F(InspectorGetEntryPointTest, OutputSampleMaskSimpleReferenced) { - auto* in_var = Param("in_var", ty.u32(), {Builtin(ast::Builtin::kSampleMask)}); - Func("ep_func", {in_var}, ty.u32(), {Return("in_var")}, {Stage(ast::PipelineStage::kFragment)}, - {Builtin(ast::Builtin::kSampleMask)}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.u32(), utils::Vector{Builtin(ast::BuiltinValue::kSampleMask)}), + }, + ty.u32(), + utils::Vector{ + Return("in_var"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleMask), + }); Inspector& inspector = Build(); @@ -749,13 +927,19 @@ TEST_F(InspectorGetEntryPointTest, OutputSampleMaskSimpleReferenced) { } TEST_F(InspectorGetEntryPointTest, OutputSampleMaskStructReferenced) { - ast::StructMemberList members; - members.push_back(Member("inner_sample_mask", ty.u32(), {Builtin(ast::Builtin::kSampleMask)})); - Structure("out_struct", members); + Structure("out_struct", utils::Vector{ + Member("inner_sample_mask", ty.u32(), + utils::Vector{Builtin(ast::BuiltinValue::kSampleMask)}), + }); - Func("ep_func", {}, ty.type_name("out_struct"), - {Decl(Var("out_var", ty.type_name("out_struct"))), Return("out_var")}, - {Stage(ast::PipelineStage::kFragment)}, {}); + Func("ep_func", utils::Empty, ty.type_name("out_struct"), + utils::Vector{ + Decl(Var("out_var", ty.type_name("out_struct"))), + Return("out_var"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -766,8 +950,17 @@ TEST_F(InspectorGetEntryPointTest, OutputSampleMaskStructReferenced) { } TEST_F(InspectorGetEntryPointTest, InputPositionSimpleReferenced) { - auto* in_var = Param("in_var", ty.vec4(), {Builtin(ast::Builtin::kPosition)}); - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -778,12 +971,22 @@ TEST_F(InspectorGetEntryPointTest, InputPositionSimpleReferenced) { } TEST_F(InspectorGetEntryPointTest, InputPositionStructReferenced) { - ast::StructMemberList members; - members.push_back(Member("inner_position", ty.vec4(), {Builtin(ast::Builtin::kPosition)})); - Structure("in_struct", members); - auto* in_var = Param("in_var", ty.type_name("in_struct"), {}); + Structure("in_struct", utils::Vector{ + Member("inner_position", ty.vec4(), + utils::Vector{Builtin(ast::BuiltinValue::kPosition)}), + }); - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.type_name("in_struct"), utils::Empty), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -794,8 +997,17 @@ TEST_F(InspectorGetEntryPointTest, InputPositionStructReferenced) { } TEST_F(InspectorGetEntryPointTest, FrontFacingSimpleReferenced) { - auto* in_var = Param("in_var", ty.bool_(), {Builtin(ast::Builtin::kFrontFacing)}); - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.bool_(), utils::Vector{Builtin(ast::BuiltinValue::kFrontFacing)}), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -806,12 +1018,22 @@ TEST_F(InspectorGetEntryPointTest, FrontFacingSimpleReferenced) { } TEST_F(InspectorGetEntryPointTest, FrontFacingStructReferenced) { - ast::StructMemberList members; - members.push_back(Member("inner_position", ty.bool_(), {Builtin(ast::Builtin::kFrontFacing)})); - Structure("in_struct", members); - auto* in_var = Param("in_var", ty.type_name("in_struct"), {}); + Structure("in_struct", utils::Vector{ + Member("inner_position", ty.bool_(), + utils::Vector{Builtin(ast::BuiltinValue::kFrontFacing)}), + }); - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.type_name("in_struct"), utils::Empty), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -822,8 +1044,17 @@ TEST_F(InspectorGetEntryPointTest, FrontFacingStructReferenced) { } TEST_F(InspectorGetEntryPointTest, SampleIndexSimpleReferenced) { - auto* in_var = Param("in_var", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)}); - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.u32(), utils::Vector{Builtin(ast::BuiltinValue::kSampleIndex)}), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -834,12 +1065,22 @@ TEST_F(InspectorGetEntryPointTest, SampleIndexSimpleReferenced) { } TEST_F(InspectorGetEntryPointTest, SampleIndexStructReferenced) { - ast::StructMemberList members; - members.push_back(Member("inner_position", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)})); - Structure("in_struct", members); - auto* in_var = Param("in_var", ty.type_name("in_struct"), {}); + Structure("in_struct", utils::Vector{ + Member("inner_position", ty.u32(), + utils::Vector{Builtin(ast::BuiltinValue::kSampleIndex)}), + }); - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.type_name("in_struct"), utils::Empty), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -850,9 +1091,16 @@ TEST_F(InspectorGetEntryPointTest, SampleIndexStructReferenced) { } TEST_F(InspectorGetEntryPointTest, NumWorkgroupsSimpleReferenced) { - auto* in_var = Param("in_var", ty.vec3(), {Builtin(ast::Builtin::kNumWorkgroups)}); - Func("ep_func", {in_var}, ty.void_(), {Return()}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.vec3(), + utils::Vector{Builtin(ast::BuiltinValue::kNumWorkgroups)}), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}, utils::Empty); Inspector& inspector = Build(); @@ -863,14 +1111,20 @@ TEST_F(InspectorGetEntryPointTest, NumWorkgroupsSimpleReferenced) { } TEST_F(InspectorGetEntryPointTest, NumWorkgroupsStructReferenced) { - ast::StructMemberList members; - members.push_back( - Member("inner_position", ty.vec3(), {Builtin(ast::Builtin::kNumWorkgroups)})); - Structure("in_struct", members); - auto* in_var = Param("in_var", ty.type_name("in_struct"), {}); + Structure("in_struct", utils::Vector{ + Member("inner_position", ty.vec3(), + utils::Vector{Builtin(ast::BuiltinValue::kNumWorkgroups)}), + }); - Func("ep_func", {in_var}, ty.void_(), {Return()}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.type_name("in_struct"), utils::Empty), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}, utils::Empty); Inspector& inspector = Build(); @@ -881,12 +1135,21 @@ TEST_F(InspectorGetEntryPointTest, NumWorkgroupsStructReferenced) { } TEST_F(InspectorGetEntryPointTest, ImplicitInterpolate) { - ast::StructMemberList members; - members.push_back(Member("struct_inner", ty.f32(), {Location(0)})); - Structure("in_struct", members); - auto* in_var = Param("in_var", ty.type_name("in_struct"), {}); + Structure("in_struct", utils::Vector{ + Member("struct_inner", ty.f32(), utils::Vector{Location(0)}), + }); - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.type_name("in_struct"), utils::Empty), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -900,13 +1163,24 @@ TEST_F(InspectorGetEntryPointTest, ImplicitInterpolate) { TEST_P(InspectorGetEntryPointInterpolateTest, Test) { auto& params = GetParam(); - ast::StructMemberList members; - members.push_back(Member("struct_inner", ty.f32(), - {Interpolate(params.in_type, params.in_sampling), Location(0)})); - Structure("in_struct", members); - auto* in_var = Param("in_var", ty.type_name("in_struct"), {}); + Structure( + "in_struct", + utils::Vector{ + Member("struct_inner", ty.f32(), + utils::Vector{Interpolate(params.in_type, params.in_sampling), Location(0)}), + }); - Func("ep_func", {in_var}, ty.void_(), {Return()}, {Stage(ast::PipelineStage::kFragment)}, {}); + Func("ep_func", + utils::Vector{ + Param("in_var", ty.type_name("in_struct"), utils::Empty), + }, + ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -950,132 +1224,134 @@ INSTANTIATE_TEST_SUITE_P( ast::InterpolationType::kFlat, ast::InterpolationSampling::kNone, InterpolationType::kFlat, InterpolationSampling::kNone})); -TEST_F(InspectorGetConstantIDsTest, Bool) { - AddOverridableConstantWithID("foo", 1, ty.bool_(), nullptr); - AddOverridableConstantWithID("bar", 20, ty.bool_(), Expr(true)); - AddOverridableConstantWithID("baz", 300, ty.bool_(), Expr(false)); +TEST_F(InspectorGetOverrideDefaultValuesTest, Bool) { + Override("foo", ty.bool_(), Id(1)); + Override("bar", ty.bool_(), Expr(true), Id(20)); + Override("baz", ty.bool_(), Expr(false), Id(300)); Inspector& inspector = Build(); - auto result = inspector.GetConstantIDs(); + auto result = inspector.GetOverrideDefaultValues(); ASSERT_EQ(3u, result.size()); - ASSERT_TRUE(result.find(1) != result.end()); - EXPECT_TRUE(result[1].IsNull()); + ASSERT_TRUE(result.find(OverrideId{1}) != result.end()); + EXPECT_TRUE(result[OverrideId{1}].IsNull()); - ASSERT_TRUE(result.find(20) != result.end()); - EXPECT_TRUE(result[20].IsBool()); - EXPECT_TRUE(result[20].AsBool()); + ASSERT_TRUE(result.find(OverrideId{20}) != result.end()); + EXPECT_TRUE(result[OverrideId{20}].IsBool()); + EXPECT_TRUE(result[OverrideId{20}].AsBool()); - ASSERT_TRUE(result.find(300) != result.end()); - EXPECT_TRUE(result[300].IsBool()); - EXPECT_FALSE(result[300].AsBool()); + ASSERT_TRUE(result.find(OverrideId{300}) != result.end()); + EXPECT_TRUE(result[OverrideId{300}].IsBool()); + EXPECT_FALSE(result[OverrideId{300}].AsBool()); } -TEST_F(InspectorGetConstantIDsTest, U32) { - AddOverridableConstantWithID("foo", 1, ty.u32(), nullptr); - AddOverridableConstantWithID("bar", 20, ty.u32(), Expr(42_u)); +TEST_F(InspectorGetOverrideDefaultValuesTest, U32) { + Override("foo", ty.u32(), Id(1)); + Override("bar", ty.u32(), Expr(42_u), Id(20)); Inspector& inspector = Build(); - auto result = inspector.GetConstantIDs(); + auto result = inspector.GetOverrideDefaultValues(); ASSERT_EQ(2u, result.size()); - ASSERT_TRUE(result.find(1) != result.end()); - EXPECT_TRUE(result[1].IsNull()); + ASSERT_TRUE(result.find(OverrideId{1}) != result.end()); + EXPECT_TRUE(result[OverrideId{1}].IsNull()); - ASSERT_TRUE(result.find(20) != result.end()); - EXPECT_TRUE(result[20].IsU32()); - EXPECT_EQ(42u, result[20].AsU32()); + ASSERT_TRUE(result.find(OverrideId{20}) != result.end()); + EXPECT_TRUE(result[OverrideId{20}].IsU32()); + EXPECT_EQ(42u, result[OverrideId{20}].AsU32()); } -TEST_F(InspectorGetConstantIDsTest, I32) { - AddOverridableConstantWithID("foo", 1, ty.i32(), nullptr); - AddOverridableConstantWithID("bar", 20, ty.i32(), Expr(i32(-42))); - AddOverridableConstantWithID("baz", 300, ty.i32(), Expr(42_i)); +TEST_F(InspectorGetOverrideDefaultValuesTest, I32) { + Override("foo", ty.i32(), Id(1)); + Override("bar", ty.i32(), Expr(-42_i), Id(20)); + Override("baz", ty.i32(), Expr(42_i), Id(300)); Inspector& inspector = Build(); - auto result = inspector.GetConstantIDs(); + auto result = inspector.GetOverrideDefaultValues(); ASSERT_EQ(3u, result.size()); - ASSERT_TRUE(result.find(1) != result.end()); - EXPECT_TRUE(result[1].IsNull()); + ASSERT_TRUE(result.find(OverrideId{1}) != result.end()); + EXPECT_TRUE(result[OverrideId{1}].IsNull()); - ASSERT_TRUE(result.find(20) != result.end()); - EXPECT_TRUE(result[20].IsI32()); - EXPECT_EQ(-42, result[20].AsI32()); + ASSERT_TRUE(result.find(OverrideId{20}) != result.end()); + EXPECT_TRUE(result[OverrideId{20}].IsI32()); + EXPECT_EQ(-42, result[OverrideId{20}].AsI32()); - ASSERT_TRUE(result.find(300) != result.end()); - EXPECT_TRUE(result[300].IsI32()); - EXPECT_EQ(42, result[300].AsI32()); + ASSERT_TRUE(result.find(OverrideId{300}) != result.end()); + EXPECT_TRUE(result[OverrideId{300}].IsI32()); + EXPECT_EQ(42, result[OverrideId{300}].AsI32()); } -TEST_F(InspectorGetConstantIDsTest, Float) { - AddOverridableConstantWithID("foo", 1, ty.f32(), nullptr); - AddOverridableConstantWithID("bar", 20, ty.f32(), Expr(0.0f)); - AddOverridableConstantWithID("baz", 300, ty.f32(), Expr(-10.0f)); - AddOverridableConstantWithID("x", 4000, ty.f32(), Expr(15.0f)); +TEST_F(InspectorGetOverrideDefaultValuesTest, Float) { + Override("foo", ty.f32(), Id(1)); + Override("bar", ty.f32(), Expr(0_f), Id(20)); + Override("baz", ty.f32(), Expr(-10_f), Id(300)); + Override("x", ty.f32(), Expr(15_f), Id(4000)); Inspector& inspector = Build(); - auto result = inspector.GetConstantIDs(); + auto result = inspector.GetOverrideDefaultValues(); ASSERT_EQ(4u, result.size()); - ASSERT_TRUE(result.find(1) != result.end()); - EXPECT_TRUE(result[1].IsNull()); + ASSERT_TRUE(result.find(OverrideId{1}) != result.end()); + EXPECT_TRUE(result[OverrideId{1}].IsNull()); - ASSERT_TRUE(result.find(20) != result.end()); - EXPECT_TRUE(result[20].IsFloat()); - EXPECT_FLOAT_EQ(0.0, result[20].AsFloat()); + ASSERT_TRUE(result.find(OverrideId{20}) != result.end()); + EXPECT_TRUE(result[OverrideId{20}].IsFloat()); + EXPECT_FLOAT_EQ(0.0f, result[OverrideId{20}].AsFloat()); - ASSERT_TRUE(result.find(300) != result.end()); - EXPECT_TRUE(result[300].IsFloat()); - EXPECT_FLOAT_EQ(-10.0, result[300].AsFloat()); + ASSERT_TRUE(result.find(OverrideId{300}) != result.end()); + EXPECT_TRUE(result[OverrideId{300}].IsFloat()); + EXPECT_FLOAT_EQ(-10.0f, result[OverrideId{300}].AsFloat()); - ASSERT_TRUE(result.find(4000) != result.end()); - EXPECT_TRUE(result[4000].IsFloat()); - EXPECT_FLOAT_EQ(15.0, result[4000].AsFloat()); + ASSERT_TRUE(result.find(OverrideId{4000}) != result.end()); + EXPECT_TRUE(result[OverrideId{4000}].IsFloat()); + EXPECT_FLOAT_EQ(15.0f, result[OverrideId{4000}].AsFloat()); } TEST_F(InspectorGetConstantNameToIdMapTest, WithAndWithoutIds) { - AddOverridableConstantWithID("v1", 1, ty.f32(), nullptr); - AddOverridableConstantWithID("v20", 20, ty.f32(), nullptr); - AddOverridableConstantWithID("v300", 300, ty.f32(), nullptr); - auto* a = AddOverridableConstantWithoutID("a", ty.f32(), nullptr); - auto* b = AddOverridableConstantWithoutID("b", ty.f32(), nullptr); - auto* c = AddOverridableConstantWithoutID("c", ty.f32(), nullptr); + Override("v1", ty.f32(), Id(1)); + Override("v20", ty.f32(), Id(20)); + Override("v300", ty.f32(), Id(300)); + auto* a = Override("a", ty.f32()); + auto* b = Override("b", ty.f32()); + auto* c = Override("c", ty.f32()); Inspector& inspector = Build(); - auto result = inspector.GetConstantNameToIdMap(); + auto result = inspector.GetNamedOverrideIds(); ASSERT_EQ(6u, result.size()); ASSERT_TRUE(result.count("v1")); - EXPECT_EQ(result["v1"], 1u); + EXPECT_EQ(result["v1"].value, 1u); ASSERT_TRUE(result.count("v20")); - EXPECT_EQ(result["v20"], 20u); + EXPECT_EQ(result["v20"].value, 20u); ASSERT_TRUE(result.count("v300")); - EXPECT_EQ(result["v300"], 300u); + EXPECT_EQ(result["v300"].value, 300u); ASSERT_TRUE(result.count("a")); ASSERT_TRUE(program_->Sem().Get(a)); - EXPECT_EQ(result["a"], program_->Sem().Get(a)->ConstantId()); + EXPECT_EQ(result["a"], program_->Sem().Get(a)->OverrideId()); ASSERT_TRUE(result.count("b")); ASSERT_TRUE(program_->Sem().Get(b)); - EXPECT_EQ(result["b"], program_->Sem().Get(b)->ConstantId()); + EXPECT_EQ(result["b"], program_->Sem().Get(b)->OverrideId()); ASSERT_TRUE(result.count("c")); ASSERT_TRUE(program_->Sem().Get(c)); - EXPECT_EQ(result["c"], program_->Sem().Get(c)->ConstantId()); + EXPECT_EQ(result["c"], program_->Sem().Get(c)->OverrideId()); } TEST_F(InspectorGetStorageSizeTest, Empty) { - MakeEmptyBodyFunction( - "ep_func", ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + MakeEmptyBodyFunction("ep_func", utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); EXPECT_EQ(0u, inspector.GetStorageSize("ep_func")); } @@ -1084,13 +1360,16 @@ TEST_F(InspectorGetStorageSizeTest, Simple_NonStruct) { AddUniformBuffer("ub_var", ty.i32(), 0, 0); AddStorageBuffer("sb_var", ty.i32(), ast::Access::kReadWrite, 1, 0); AddStorageBuffer("rosb_var", ty.i32(), ast::Access::kRead, 1, 1); - Func("ep_func", {}, ty.void_(), - { - Decl(Let("ub", nullptr, Expr("ub_var"))), - Decl(Let("sb", nullptr, Expr("sb_var"))), - Decl(Let("rosb", nullptr, Expr("rosb_var"))), + Func("ep_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("ub", Expr("ub_var"))), + Decl(Let("sb", Expr("sb_var"))), + Decl(Let("rosb", Expr("rosb_var"))), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); @@ -1098,20 +1377,36 @@ TEST_F(InspectorGetStorageSizeTest, Simple_NonStruct) { } TEST_F(InspectorGetStorageSizeTest, Simple_Struct) { - auto* ub_struct_type = MakeUniformBufferType("ub_type", {ty.i32(), ty.i32()}); + auto* ub_struct_type = MakeUniformBufferType("ub_type", utils::Vector{ + ty.i32(), + ty.i32(), + }); AddUniformBuffer("ub_var", ty.Of(ub_struct_type), 0, 0); - MakeStructVariableReferenceBodyFunction("ub_func", "ub_var", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("ub_func", "ub_var", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - auto sb = MakeStorageBufferTypes("sb_type", {ty.i32()}); + auto sb = MakeStorageBufferTypes("sb_type", utils::Vector{ + ty.i32(), + }); AddStorageBuffer("sb_var", sb(), ast::Access::kReadWrite, 1, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "sb_var", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "sb_var", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - auto ro_sb = MakeStorageBufferTypes("rosb_type", {ty.i32()}); + auto ro_sb = MakeStorageBufferTypes("rosb_type", utils::Vector{ + ty.i32(), + }); AddStorageBuffer("rosb_var", ro_sb(), ast::Access::kRead, 1, 1); - MakeStructVariableReferenceBodyFunction("rosb_func", "rosb_var", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("rosb_func", "rosb_var", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"ub_func", "sb_func", "rosb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func"), "sb_func", "rosb_func"}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -1123,11 +1418,14 @@ TEST_F(InspectorGetStorageSizeTest, Simple_Struct) { TEST_F(InspectorGetStorageSizeTest, NonStructVec3) { AddUniformBuffer("ub_var", ty.vec3(), 0, 0); - Func("ep_func", {}, ty.void_(), - { - Decl(Let("ub", nullptr, Expr("ub_var"))), + Func("ep_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("ub", Expr("ub_var"))), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); @@ -1135,13 +1433,18 @@ TEST_F(InspectorGetStorageSizeTest, NonStructVec3) { } TEST_F(InspectorGetStorageSizeTest, StructVec3) { - auto* ub_struct_type = MakeUniformBufferType("ub_type", {ty.vec3()}); + auto* ub_struct_type = MakeUniformBufferType("ub_type", utils::Vector{ + ty.vec3(), + }); AddUniformBuffer("ub_var", ty.Of(ub_struct_type), 0, 0); - Func("ep_func", {}, ty.void_(), - { - Decl(Let("ub", nullptr, Expr("ub_var"))), + Func("ep_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("ub", Expr("ub_var"))), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); @@ -1149,8 +1452,8 @@ TEST_F(InspectorGetStorageSizeTest, StructVec3) { } TEST_F(InspectorGetResourceBindingsTest, Empty) { - MakeCallerBodyFunction("ep_func", {}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1162,23 +1465,39 @@ TEST_F(InspectorGetResourceBindingsTest, Empty) { } TEST_F(InspectorGetResourceBindingsTest, Simple) { - auto* ub_struct_type = MakeUniformBufferType("ub_type", {ty.i32()}); + auto* ub_struct_type = MakeUniformBufferType("ub_type", utils::Vector{ + ty.i32(), + }); AddUniformBuffer("ub_var", ty.Of(ub_struct_type), 0, 0); - MakeStructVariableReferenceBodyFunction("ub_func", "ub_var", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("ub_func", "ub_var", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - auto sb = MakeStorageBufferTypes("sb_type", {ty.i32()}); + auto sb = MakeStorageBufferTypes("sb_type", utils::Vector{ + ty.i32(), + }); AddStorageBuffer("sb_var", sb(), ast::Access::kReadWrite, 1, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "sb_var", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "sb_var", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - auto ro_sb = MakeStorageBufferTypes("rosb_type", {ty.i32()}); + auto ro_sb = MakeStorageBufferTypes("rosb_type", utils::Vector{ + ty.i32(), + }); AddStorageBuffer("rosb_var", ro_sb(), ast::Access::kRead, 1, 1); - MakeStructVariableReferenceBodyFunction("rosb_func", "rosb_var", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("rosb_func", "rosb_var", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); auto* s_texture_type = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32()); AddResource("s_texture", s_texture_type, 2, 0); AddSampler("s_var", 3, 0); AddGlobalVariable("s_coords", ty.f32()); - MakeSamplerReferenceBodyFunction("s_func", "s_texture", "s_var", "s_coords", ty.f32(), {}); + MakeSamplerReferenceBodyFunction("s_func", "s_texture", "s_var", "s_coords", ty.f32(), + utils::Empty); auto* cs_depth_texture_type = ty.depth_texture(ast::TextureDimension::k2d); AddResource("cs_texture", cs_depth_texture_type, 3, 1); @@ -1186,22 +1505,32 @@ TEST_F(InspectorGetResourceBindingsTest, Simple) { AddGlobalVariable("cs_coords", ty.vec2()); AddGlobalVariable("cs_depth", ty.f32()); MakeComparisonSamplerReferenceBodyFunction("cs_func", "cs_texture", "cs_var", "cs_coords", - "cs_depth", ty.f32(), {}); + "cs_depth", ty.f32(), utils::Empty); auto* depth_ms_texture_type = ty.depth_multisampled_texture(ast::TextureDimension::k2d); AddResource("depth_ms_texture", depth_ms_texture_type, 3, 3); - Func("depth_ms_func", {}, ty.void_(), {Ignore("depth_ms_texture")}); + Func("depth_ms_func", utils::Empty, ty.void_(), + utils::Vector{ + Ignore("depth_ms_texture"), + }); auto* st_type = MakeStorageTextureTypes(ast::TextureDimension::k2d, ast::TexelFormat::kR32Uint); AddStorageTexture("st_var", st_type, 4, 0); - MakeStorageTextureBodyFunction("st_func", "st_var", ty.vec2(), {}); + MakeStorageTextureBodyFunction("st_func", "st_var", ty.vec2(), utils::Empty); - MakeCallerBodyFunction( - "ep_func", - {"ub_func", "sb_func", "rosb_func", "s_func", "cs_func", "depth_ms_func", "st_func"}, - ast::AttributeList{ - Stage(ast::PipelineStage::kFragment), - }); + MakeCallerBodyFunction("ep_func", + utils::Vector{ + std::string("ub_func"), + std::string("sb_func"), + std::string("rosb_func"), + std::string("s_func"), + std::string("cs_func"), + std::string("depth_ms_func"), + std::string("st_func"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -1256,13 +1585,18 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingEntryPoint) { } TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) { - auto* foo_struct_type = MakeUniformBufferType("foo_type", {ty.i32()}); + auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{ + ty.i32(), + }); AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0); - MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"ub_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1275,10 +1609,10 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) { TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple_NonStruct) { AddUniformBuffer("foo_ub", ty.i32(), 0, 0); - MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.i32(), {}); + MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.i32(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"ub_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1296,13 +1630,18 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple_NonStruct) { } TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple_Struct) { - auto* foo_struct_type = MakeUniformBufferType("foo_type", {ty.i32()}); + auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{ + ty.i32(), + }); AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0); - MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"ub_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1320,14 +1659,22 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple_Struct) { } TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleMembers) { - auto* foo_struct_type = MakeUniformBufferType("foo_type", {ty.i32(), ty.u32(), ty.f32()}); + auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{ + ty.i32(), + ty.u32(), + ty.f32(), + }); AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0); MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", - {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}}); + utils::Vector{ + MemberInfo{0, ty.i32()}, + MemberInfo{1, ty.u32()}, + MemberInfo{2, ty.f32()}, + }); - MakeCallerBodyFunction("ep_func", {"ub_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1345,13 +1692,18 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleMembers) { } TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingPadding) { - auto* foo_struct_type = MakeUniformBufferType("foo_type", {ty.vec3()}); + auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{ + ty.vec3(), + }); AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0); - MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, ty.vec3()}}); + MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", + utils::Vector{ + MemberInfo{0, ty.vec3()}, + }); - MakeCallerBodyFunction("ep_func", {"ub_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1370,10 +1722,10 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingPadding) { TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonStructVec3) { AddUniformBuffer("foo_ub", ty.vec3(), 0, 0); - MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.vec3(), {}); + MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.vec3(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"ub_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1391,14 +1743,22 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonStructVec3) { } TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) { - auto* ub_struct_type = MakeUniformBufferType("ub_type", {ty.i32(), ty.u32(), ty.f32()}); + auto* ub_struct_type = MakeUniformBufferType("ub_type", utils::Vector{ + ty.i32(), + ty.u32(), + ty.f32(), + }); AddUniformBuffer("ub_foo", ty.Of(ub_struct_type), 0, 0); AddUniformBuffer("ub_bar", ty.Of(ub_struct_type), 0, 1); AddUniformBuffer("ub_baz", ty.Of(ub_struct_type), 2, 0); auto AddReferenceFunc = [this](const std::string& func_name, const std::string& var_name) { MakeStructVariableReferenceBodyFunction(func_name, var_name, - {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}}); + utils::Vector{ + MemberInfo{0, ty.i32()}, + MemberInfo{1, ty.u32()}, + MemberInfo{2, ty.f32()}, + }); }; AddReferenceFunc("ub_foo_func", "ub_foo"); AddReferenceFunc("ub_bar_func", "ub_bar"); @@ -1408,10 +1768,14 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) { return create(Call(callee)); }; - Func("ep_func", ast::VariableList(), ty.void_(), - ast::StatementList{FuncCall("ub_foo_func"), FuncCall("ub_bar_func"), - FuncCall("ub_baz_func"), Return()}, - ast::AttributeList{ + Func("ep_func", utils::Empty, ty.void_(), + utils::Vector{ + FuncCall("ub_foo_func"), + FuncCall("ub_bar_func"), + FuncCall("ub_baz_func"), + Return(), + }, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1444,15 +1808,21 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingArray) { // Manually create uniform buffer to make sure it had a valid layout (array // with elem stride of 16, and that is 16-byte aligned within the struct) auto* foo_struct_type = Structure( - "foo_type", {Member("0i32", ty.i32()), - Member("b", ty.array(ty.u32(), 4_u, /*stride*/ 16), {MemberAlign(16)})}); + "foo_type", + utils::Vector{ + Member("0i32", ty.i32()), + Member("b", ty.array(ty.u32(), 4_u, /*stride*/ 16), utils::Vector{MemberAlign(16_u)}), + }); AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0); - MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"ub_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1471,10 +1841,10 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingArray) { TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple_NonStruct) { AddStorageBuffer("foo_sb", ty.i32(), ast::Access::kReadWrite, 0, 0); - MakePlainGlobalReferenceBodyFunction("sb_func", "foo_sb", ty.i32(), {}); + MakePlainGlobalReferenceBodyFunction("sb_func", "foo_sb", ty.i32(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1492,13 +1862,18 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple_NonStruct) { } TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple_Struct) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", {ty.i32()}); + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ + ty.i32(), + }); AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kReadWrite, 0, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1516,7 +1891,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple_Struct) { } TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleMembers) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", { + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ ty.i32(), ty.u32(), ty.f32(), @@ -1524,10 +1899,14 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleMembers) { AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kReadWrite, 0, 0); MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", - {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}}); + utils::Vector{ + MemberInfo{0, ty.i32()}, + MemberInfo{1, ty.u32()}, + MemberInfo{2, ty.f32()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1545,7 +1924,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleMembers) { } TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) { - auto sb_struct_type = MakeStorageBufferTypes("sb_type", { + auto sb_struct_type = MakeStorageBufferTypes("sb_type", utils::Vector{ ty.i32(), ty.u32(), ty.f32(), @@ -1556,7 +1935,11 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) { auto AddReferenceFunc = [this](const std::string& func_name, const std::string& var_name) { MakeStructVariableReferenceBodyFunction(func_name, var_name, - {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}}); + utils::Vector{ + MemberInfo{0, ty.i32()}, + MemberInfo{1, ty.u32()}, + MemberInfo{2, ty.f32()}, + }); }; AddReferenceFunc("sb_foo_func", "sb_foo"); AddReferenceFunc("sb_bar_func", "sb_bar"); @@ -1566,14 +1949,14 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) { return create(Call(callee)); }; - Func("ep_func", ast::VariableList(), ty.void_(), - ast::StatementList{ + Func("ep_func", utils::Empty, ty.void_(), + utils::Vector{ FuncCall("sb_foo_func"), FuncCall("sb_bar_func"), FuncCall("sb_baz_func"), Return(), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1603,13 +1986,19 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) { } TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingArray) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", {ty.i32(), ty.array()}); + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ + ty.i32(), + ty.array(), + }); AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kReadWrite, 0, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1627,16 +2016,19 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingArray) { } TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingRuntimeArray) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", { + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ ty.i32(), ty.array(), }); AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kReadWrite, 0, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1654,13 +2046,18 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingRuntimeArray) { } TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingPadding) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", {ty.vec3()}); + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ + ty.vec3(), + }); AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kReadWrite, 0, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, ty.vec3()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", + utils::Vector{ + MemberInfo{0, ty.vec3()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1679,10 +2076,10 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingPadding) { TEST_F(InspectorGetStorageBufferResourceBindingsTest, NonStructVec3) { AddStorageBuffer("foo_ub", ty.vec3(), ast::Access::kReadWrite, 0, 0); - MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.vec3(), {}); + MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.vec3(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"ub_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1700,13 +2097,18 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, NonStructVec3) { } TEST_F(InspectorGetStorageBufferResourceBindingsTest, SkipReadOnly) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", {ty.i32()}); + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ + ty.i32(), + }); AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kRead, 0, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1718,13 +2120,18 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, SkipReadOnly) { } TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, Simple) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", {ty.i32()}); + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ + ty.i32(), + }); AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kRead, 0, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1742,7 +2149,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, Simple) { } TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, MultipleStorageBuffers) { - auto sb_struct_type = MakeStorageBufferTypes("sb_type", { + auto sb_struct_type = MakeStorageBufferTypes("sb_type", utils::Vector{ ty.i32(), ty.u32(), ty.f32(), @@ -1753,7 +2160,11 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, MultipleStorageBuf auto AddReferenceFunc = [this](const std::string& func_name, const std::string& var_name) { MakeStructVariableReferenceBodyFunction(func_name, var_name, - {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}}); + utils::Vector{ + MemberInfo{0, ty.i32()}, + MemberInfo{1, ty.u32()}, + MemberInfo{2, ty.f32()}, + }); }; AddReferenceFunc("sb_foo_func", "sb_foo"); AddReferenceFunc("sb_bar_func", "sb_bar"); @@ -1763,14 +2174,14 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, MultipleStorageBuf return create(Call(callee)); }; - Func("ep_func", ast::VariableList(), ty.void_(), - ast::StatementList{ + Func("ep_func", utils::Empty, ty.void_(), + utils::Vector{ FuncCall("sb_foo_func"), FuncCall("sb_bar_func"), FuncCall("sb_baz_func"), Return(), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1800,16 +2211,19 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, MultipleStorageBuf } TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingArray) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", { + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ ty.i32(), ty.array(), }); AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kRead, 0, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1827,16 +2241,19 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingArray) { } TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingRuntimeArray) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", { + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ ty.i32(), ty.array(), }); AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kRead, 0, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1854,13 +2271,18 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingRuntimeA } TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, SkipNonReadOnly) { - auto foo_struct_type = MakeStorageBufferTypes("foo_type", {ty.i32()}); + auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{ + ty.i32(), + }); AddStorageBuffer("foo_sb", foo_struct_type(), ast::Access::kReadWrite, 0, 0); - MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); - MakeCallerBodyFunction("ep_func", {"sb_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1878,7 +2300,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, Simple) { AddGlobalVariable("foo_coords", ty.f32()); MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", ty.f32(), - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1894,7 +2316,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, Simple) { } TEST_F(InspectorGetSamplerResourceBindingsTest, NoSampler) { - MakeEmptyBodyFunction("ep_func", ast::AttributeList{ + MakeEmptyBodyFunction("ep_func", utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1913,10 +2335,10 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, InFunction) { AddGlobalVariable("foo_coords", ty.f32()); MakeSamplerReferenceBodyFunction("foo_func", "foo_texture", "foo_sampler", "foo_coords", - ty.f32(), {}); + ty.f32(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"foo_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("foo_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1938,7 +2360,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, UnknownEntryPoint) { AddGlobalVariable("foo_coords", ty.f32()); MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", ty.f32(), - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1957,7 +2379,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) { MakeComparisonSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", ty.f32(), - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1978,7 +2400,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) { MakeComparisonSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", ty.f32(), - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1994,7 +2416,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) { } TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, NoSampler) { - MakeEmptyBodyFunction("ep_func", ast::AttributeList{ + MakeEmptyBodyFunction("ep_func", utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2014,10 +2436,10 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) { AddGlobalVariable("foo_depth", ty.f32()); MakeComparisonSamplerReferenceBodyFunction("foo_func", "foo_texture", "foo_sampler", - "foo_coords", "foo_depth", ty.f32(), {}); + "foo_coords", "foo_depth", ty.f32(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"foo_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("foo_func")}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2041,7 +2463,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) { MakeComparisonSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", ty.f32(), - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2058,7 +2480,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, SkipsSamplers) { AddGlobalVariable("foo_coords", ty.f32()); MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", ty.f32(), - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2071,7 +2493,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, SkipsSamplers) { } TEST_F(InspectorGetSampledTextureResourceBindingsTest, Empty) { - MakeEmptyBodyFunction("foo", ast::AttributeList{ + MakeEmptyBodyFunction("foo", utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2093,7 +2515,7 @@ TEST_P(InspectorGetSampledTextureResourceBindingsTestWithParam, textureSample) { MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", GetBaseType(GetParam().sampled_kind), - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2143,7 +2565,7 @@ TEST_P(InspectorGetSampledArrayTextureResourceBindingsTestWithParam, textureSamp MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index", GetBaseType(GetParam().sampled_kind), - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2179,11 +2601,11 @@ TEST_P(InspectorGetMultisampledTextureResourceBindingsTestWithParam, textureLoad AddGlobalVariable("foo_coords", coord_type); AddGlobalVariable("foo_sample_index", ty.i32()); - Func("ep", ast::VariableList(), ty.void_(), - ast::StatementList{ + Func("ep", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call("textureLoad", "foo_texture", "foo_coords", "foo_sample_index")), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2221,7 +2643,7 @@ INSTANTIATE_TEST_SUITE_P( inspector::ResourceBinding::SampledKind::kUInt})); TEST_F(InspectorGetMultisampledArrayTextureResourceBindingsTest, Empty) { - MakeEmptyBodyFunction("foo", ast::AttributeList{ + MakeEmptyBodyFunction("foo", utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2244,7 +2666,7 @@ TEST_P(InspectorGetMultisampledArrayTextureResourceBindingsTestWithParam, DISABL MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index", GetBaseType(GetParam().sampled_kind), - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2276,7 +2698,7 @@ INSTANTIATE_TEST_SUITE_P( inspector::ResourceBinding::SampledKind::kUInt})); TEST_F(InspectorGetStorageTextureResourceBindingsTest, Empty) { - MakeEmptyBodyFunction("ep", ast::AttributeList{ + MakeEmptyBodyFunction("ep", utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2323,7 +2745,9 @@ TEST_P(InspectorGetStorageTextureResourceBindingsTestWithParam, Simple) { ASSERT_FALSE(dim_type == nullptr); MakeStorageTextureBodyFunction("ep", "st_var", dim_type, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); Inspector& inspector = Build(); @@ -2403,11 +2827,11 @@ TEST_P(InspectorGetDepthTextureResourceBindingsTestWithParam, textureDimensions) auto* depth_texture_type = ty.depth_texture(GetParam().type_dim); AddResource("dt", depth_texture_type, 0, 0); - Func("ep", ast::VariableList(), ty.void_(), - ast::StatementList{ + Func("ep", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call("textureDimensions", "dt")), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2440,11 +2864,11 @@ TEST_F(InspectorGetDepthMultisampledTextureResourceBindingsTest, textureDimensio auto* depth_ms_texture_type = ty.depth_multisampled_texture(ast::TextureDimension::k2d); AddResource("tex", depth_ms_texture_type, 0, 0); - Func("ep", ast::VariableList(), ty.void_(), - ast::StatementList{ + Func("ep", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call("textureDimensions", "tex")), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2464,11 +2888,11 @@ TEST_F(InspectorGetExternalTextureResourceBindingsTest, Simple) { auto* external_texture_type = ty.external_texture(); AddResource("et", external_texture_type, 0, 0); - Func("ep", ast::VariableList(), ty.void_(), - ast::StatementList{ + Func("ep", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call("textureDimensions", "et")), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -2485,7 +2909,7 @@ TEST_F(InspectorGetExternalTextureResourceBindingsTest, Simple) { TEST_F(InspectorGetSamplerTextureUsesTest, None) { std::string shader = R"( -@stage(fragment) +@fragment fn main() { })"; @@ -2493,7 +2917,7 @@ fn main() { auto result = inspector.GetSamplerTextureUses("main"); ASSERT_FALSE(inspector.has_error()) << inspector.error(); - ASSERT_EQ(0u, result.size()); + ASSERT_EQ(0u, result.Length()); } TEST_F(InspectorGetSamplerTextureUsesTest, Simple) { @@ -2501,7 +2925,7 @@ TEST_F(InspectorGetSamplerTextureUsesTest, Simple) { @group(0) @binding(1) var mySampler: sampler; @group(0) @binding(2) var myTexture: texture_2d; -@stage(fragment) +@fragment fn main(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return textureSample(myTexture, mySampler, fragUV) * fragPosition; @@ -2511,7 +2935,7 @@ fn main(@location(0) fragUV: vec2, auto result = inspector.GetSamplerTextureUses("main"); ASSERT_FALSE(inspector.has_error()) << inspector.error(); - ASSERT_EQ(1u, result.size()); + ASSERT_EQ(1u, result.Length()); EXPECT_EQ(0u, result[0].sampler_binding_point.group); EXPECT_EQ(1u, result[0].sampler_binding_point.binding); @@ -2524,7 +2948,7 @@ TEST_F(InspectorGetSamplerTextureUsesTest, UnknownEntryPoint) { @group(0) @binding(1) var mySampler: sampler; @group(0) @binding(2) var myTexture: texture_2d; -@stage(fragment) +@fragment fn main(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return textureSample(myTexture, mySampler, fragUV) * fragPosition; @@ -2540,7 +2964,7 @@ TEST_F(InspectorGetSamplerTextureUsesTest, MultipleCalls) { @group(0) @binding(1) var mySampler: sampler; @group(0) @binding(2) var myTexture: texture_2d; -@stage(fragment) +@fragment fn main(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return textureSample(myTexture, mySampler, fragUV) * fragPosition; @@ -2565,7 +2989,7 @@ fn doSample(t: texture_2d, s: sampler, uv: vec2) -> vec4 { return textureSample(t, s, uv); } -@stage(fragment) +@fragment fn main(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return doSample(myTexture, mySampler, fragUV) * fragPosition; @@ -2575,7 +2999,7 @@ fn main(@location(0) fragUV: vec2, auto result = inspector.GetSamplerTextureUses("main"); ASSERT_FALSE(inspector.has_error()) << inspector.error(); - ASSERT_EQ(1u, result.size()); + ASSERT_EQ(1u, result.Length()); EXPECT_EQ(0u, result[0].sampler_binding_point.group); EXPECT_EQ(1u, result[0].sampler_binding_point.binding); @@ -2592,7 +3016,7 @@ fn doSample(s: sampler, uv: vec2) -> vec4 { return textureSample(myTexture, s, uv); } -@stage(fragment) +@fragment fn main(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return doSample(mySampler, fragUV) * fragPosition; @@ -2602,7 +3026,7 @@ fn main(@location(0) fragUV: vec2, auto result = inspector.GetSamplerTextureUses("main"); ASSERT_FALSE(inspector.has_error()) << inspector.error(); - ASSERT_EQ(1u, result.size()); + ASSERT_EQ(1u, result.Length()); EXPECT_EQ(0u, result[0].sampler_binding_point.group); EXPECT_EQ(1u, result[0].sampler_binding_point.binding); @@ -2619,7 +3043,7 @@ fn doSample(t: texture_2d, uv: vec2) -> vec4 { return textureSample(t, mySampler, uv); } -@stage(fragment) +@fragment fn main(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return doSample(myTexture, fragUV) * fragPosition; @@ -2629,7 +3053,7 @@ fn main(@location(0) fragUV: vec2, auto result = inspector.GetSamplerTextureUses("main"); ASSERT_FALSE(inspector.has_error()) << inspector.error(); - ASSERT_EQ(1u, result.size()); + ASSERT_EQ(1u, result.Length()); EXPECT_EQ(0u, result[0].sampler_binding_point.group); EXPECT_EQ(1u, result[0].sampler_binding_point.binding); @@ -2646,7 +3070,7 @@ fn doSample(uv: vec2) -> vec4 { return textureSample(myTexture, mySampler, uv); } -@stage(fragment) +@fragment fn main(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return doSample(fragUV) * fragPosition; @@ -2656,7 +3080,7 @@ fn main(@location(0) fragUV: vec2, auto result = inspector.GetSamplerTextureUses("main"); ASSERT_FALSE(inspector.has_error()) << inspector.error(); - ASSERT_EQ(1u, result.size()); + ASSERT_EQ(1u, result.Length()); EXPECT_EQ(0u, result[0].sampler_binding_point.group); EXPECT_EQ(1u, result[0].sampler_binding_point.binding); @@ -2686,19 +3110,19 @@ fn Z(t: texture_2d, s: sampler, uv: vec2) -> vec4 { return X(t, s, uv) + Y(t, s, uv); } -@stage(fragment) +@fragment fn via_call(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return Z(myTexture, mySampler, fragUV) * fragPosition; } -@stage(fragment) +@fragment fn via_ptr(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return textureSample(myTexture, mySampler, fragUV) + fragPosition; } -@stage(fragment) +@fragment fn direct(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return textureSample(myTexture, mySampler, fragUV) + fragPosition; @@ -2710,7 +3134,7 @@ fn direct(@location(0) fragUV: vec2, auto result = inspector.GetSamplerTextureUses("via_call"); ASSERT_FALSE(inspector.has_error()) << inspector.error(); - ASSERT_EQ(1u, result.size()); + ASSERT_EQ(1u, result.Length()); EXPECT_EQ(0u, result[0].sampler_binding_point.group); EXPECT_EQ(1u, result[0].sampler_binding_point.binding); @@ -2722,7 +3146,7 @@ fn direct(@location(0) fragUV: vec2, auto result = inspector.GetSamplerTextureUses("via_ptr"); ASSERT_FALSE(inspector.has_error()) << inspector.error(); - ASSERT_EQ(1u, result.size()); + ASSERT_EQ(1u, result.Length()); EXPECT_EQ(0u, result[0].sampler_binding_point.group); EXPECT_EQ(1u, result[0].sampler_binding_point.binding); @@ -2734,7 +3158,7 @@ fn direct(@location(0) fragUV: vec2, auto result = inspector.GetSamplerTextureUses("direct"); ASSERT_FALSE(inspector.has_error()) << inspector.error(); - ASSERT_EQ(1u, result.size()); + ASSERT_EQ(1u, result.Length()); EXPECT_EQ(0u, result[0].sampler_binding_point.group); EXPECT_EQ(1u, result[0].sampler_binding_point.binding); @@ -2744,18 +3168,20 @@ fn direct(@location(0) fragUV: vec2, } TEST_F(InspectorGetWorkgroupStorageSizeTest, Empty) { - MakeEmptyBodyFunction( - "ep_func", ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + MakeEmptyBodyFunction("ep_func", utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); Inspector& inspector = Build(); EXPECT_EQ(0u, inspector.GetWorkgroupStorageSize("ep_func")); } TEST_F(InspectorGetWorkgroupStorageSizeTest, Simple) { AddWorkgroupStorage("wg_f32", ty.f32()); - MakePlainGlobalReferenceBodyFunction("f32_func", "wg_f32", ty.f32(), {}); + MakePlainGlobalReferenceBodyFunction("f32_func", "wg_f32", ty.f32(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"f32_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("f32_func")}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -2767,17 +3193,22 @@ TEST_F(InspectorGetWorkgroupStorageSizeTest, Simple) { TEST_F(InspectorGetWorkgroupStorageSizeTest, CompoundTypes) { // This struct should occupy 68 bytes. 4 from the i32 field, and another 64 // from the 4-element array with 16-byte stride. - auto* wg_struct_type = - MakeStructType("WgStruct", {ty.i32(), ty.array(ty.i32(), 4_u, /*stride=*/16)}); + auto* wg_struct_type = MakeStructType("WgStruct", utils::Vector{ + ty.i32(), + ty.array(ty.i32(), 4_u, /*stride=*/16), + }); AddWorkgroupStorage("wg_struct_var", ty.Of(wg_struct_type)); - MakeStructVariableReferenceBodyFunction("wg_struct_func", "wg_struct_var", {{0, ty.i32()}}); + MakeStructVariableReferenceBodyFunction("wg_struct_func", "wg_struct_var", + utils::Vector{ + MemberInfo{0, ty.i32()}, + }); // Plus another 4 bytes from this other workgroup-class f32. AddWorkgroupStorage("wg_f32", ty.f32()); - MakePlainGlobalReferenceBodyFunction("f32_func", "wg_f32", ty.f32(), {}); + MakePlainGlobalReferenceBodyFunction("f32_func", "wg_f32", ty.f32(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"wg_struct_func", "f32_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("wg_struct_func"), "f32_func"}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -2790,10 +3221,10 @@ TEST_F(InspectorGetWorkgroupStorageSizeTest, AlignmentPadding) { // vec3 has an alignment of 16 but a size of 12. We leverage this to test // that our padded size calculation for workgroup storage is accurate. AddWorkgroupStorage("wg_vec3", ty.vec3()); - MakePlainGlobalReferenceBodyFunction("wg_func", "wg_vec3", ty.vec3(), {}); + MakePlainGlobalReferenceBodyFunction("wg_func", "wg_vec3", ty.vec3(), utils::Empty); - MakeCallerBodyFunction("ep_func", {"wg_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("wg_func")}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -2807,14 +3238,18 @@ TEST_F(InspectorGetWorkgroupStorageSizeTest, StructAlignment) { // of its last member, rounded up to the alignment of its largest member. So // here the struct is expected to occupy 1024 bytes of workgroup storage. const auto* wg_struct_type = MakeStructTypeFromMembers( - "WgStruct", - {MakeStructMember(0, ty.f32(), {create(1024)})}); + "WgStruct", utils::Vector{ + MakeStructMember(0, ty.f32(), utils::Vector{MemberAlign(1024_u)}), + }); AddWorkgroupStorage("wg_struct_var", ty.Of(wg_struct_type)); - MakeStructVariableReferenceBodyFunction("wg_struct_func", "wg_struct_var", {{0, ty.f32()}}); + MakeStructVariableReferenceBodyFunction("wg_struct_func", "wg_struct_var", + utils::Vector{ + MemberInfo{0, ty.f32()}, + }); - MakeCallerBodyFunction("ep_func", {"wg_struct_func"}, - ast::AttributeList{ + MakeCallerBodyFunction("ep_func", utils::Vector{std::string("wg_struct_func")}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -2836,7 +3271,7 @@ TEST_F(InspectorGetUsedExtensionNamesTest, Empty) { // Test calling GetUsedExtensionNames on a shader with no extension. TEST_F(InspectorGetUsedExtensionNamesTest, None) { std::string shader = R"( -@stage(fragment) +@fragment fn main() { })"; @@ -2849,9 +3284,9 @@ fn main() { // Test calling GetUsedExtensionNames on a shader with valid extension. TEST_F(InspectorGetUsedExtensionNamesTest, Simple) { std::string shader = R"( -enable InternalExtensionForTesting; +enable f16; -@stage(fragment) +@fragment fn main() { })"; @@ -2859,17 +3294,17 @@ fn main() { auto result = inspector.GetUsedExtensionNames(); EXPECT_EQ(result.size(), 1u); - EXPECT_EQ(result[0], "InternalExtensionForTesting"); + EXPECT_EQ(result[0], "f16"); } // Test calling GetUsedExtensionNames on a shader with a extension enabled for // multiple times. TEST_F(InspectorGetUsedExtensionNamesTest, Duplicated) { std::string shader = R"( -enable InternalExtensionForTesting; -enable InternalExtensionForTesting; +enable f16; +enable f16; -@stage(fragment) +@fragment fn main() { })"; @@ -2877,7 +3312,7 @@ fn main() { auto result = inspector.GetUsedExtensionNames(); EXPECT_EQ(result.size(), 1u); - EXPECT_EQ(result[0], "InternalExtensionForTesting"); + EXPECT_EQ(result[0], "f16"); } // Test calling GetEnableDirectives on a empty shader. @@ -2893,7 +3328,7 @@ TEST_F(InspectorGetEnableDirectivesTest, Empty) { // Test calling GetEnableDirectives on a shader with no extension. TEST_F(InspectorGetEnableDirectivesTest, None) { std::string shader = R"( -@stage(fragment) +@fragment fn main() { })"; @@ -2906,9 +3341,9 @@ fn main() { // Test calling GetEnableDirectives on a shader with valid extension. TEST_F(InspectorGetEnableDirectivesTest, Simple) { std::string shader = R"( -enable InternalExtensionForTesting; +enable f16; -@stage(fragment) +@fragment fn main() { })"; @@ -2916,18 +3351,18 @@ fn main() { auto result = inspector.GetEnableDirectives(); EXPECT_EQ(result.size(), 1u); - EXPECT_EQ(result[0].first, "InternalExtensionForTesting"); - EXPECT_EQ(result[0].second.range, (Source::Range{{2, 8}, {2, 35}})); + EXPECT_EQ(result[0].first, "f16"); + EXPECT_EQ(result[0].second.range, (Source::Range{{2, 8}, {2, 11}})); } // Test calling GetEnableDirectives on a shader with a extension enabled for // multiple times. TEST_F(InspectorGetEnableDirectivesTest, Duplicated) { std::string shader = R"( -enable InternalExtensionForTesting; +enable f16; -enable InternalExtensionForTesting; -@stage(fragment) +enable f16; +@fragment fn main() { })"; @@ -2935,10 +3370,10 @@ fn main() { auto result = inspector.GetEnableDirectives(); EXPECT_EQ(result.size(), 2u); - EXPECT_EQ(result[0].first, "InternalExtensionForTesting"); - EXPECT_EQ(result[0].second.range, (Source::Range{{2, 8}, {2, 35}})); - EXPECT_EQ(result[1].first, "InternalExtensionForTesting"); - EXPECT_EQ(result[1].second.range, (Source::Range{{4, 8}, {4, 35}})); + EXPECT_EQ(result[0].first, "f16"); + EXPECT_EQ(result[0].second.range, (Source::Range{{2, 8}, {2, 11}})); + EXPECT_EQ(result[1].first, "f16"); + EXPECT_EQ(result[1].second.range, (Source::Range{{4, 8}, {4, 11}})); } // Crash was occuring in ::GenerateSamplerTargets, when @@ -2952,7 +3387,7 @@ fn doSample(t: texture_2d, s: sampler, uv: vec2) -> vec4 { return textureSample(t, s, uv); } -@stage(fragment) +@fragment fn main(@location(0) fragUV: vec2, @location(1) fragPosition: vec4) -> @location(0) vec4 { return doSample(myTexture, mySampler, fragUV) * fragPosition; diff --git a/src/tint/inspector/resource_binding.cc b/src/tint/inspector/resource_binding.cc index 3efb59e57b..6434ac2601 100644 --- a/src/tint/inspector/resource_binding.cc +++ b/src/tint/inspector/resource_binding.cc @@ -104,7 +104,7 @@ ResourceBinding::TexelFormat TypeTexelFormatToResourceBindingTexelFormat( return ResourceBinding::TexelFormat::kRgba32Sint; case ast::TexelFormat::kRgba32Float: return ResourceBinding::TexelFormat::kRgba32Float; - case ast::TexelFormat::kNone: + case ast::TexelFormat::kInvalid: return ResourceBinding::TexelFormat::kNone; } return ResourceBinding::TexelFormat::kNone; diff --git a/src/tint/inspector/resource_binding.h b/src/tint/inspector/resource_binding.h index 9a544357f9..6adab5a7fc 100644 --- a/src/tint/inspector/resource_binding.h +++ b/src/tint/inspector/resource_binding.h @@ -20,6 +20,11 @@ #include "src/tint/ast/storage_texture.h" #include "src/tint/ast/texture.h" +// Forward declarations +namespace tint::sem { +class Type; +} // namespace tint::sem + namespace tint::inspector { /// Container for information about how a resource is bound diff --git a/src/tint/inspector/test_inspector_builder.cc b/src/tint/inspector/test_inspector_builder.cc index 074f29c858..3d67876f09 100644 --- a/src/tint/inspector/test_inspector_builder.cc +++ b/src/tint/inspector/test_inspector_builder.cc @@ -27,32 +27,36 @@ namespace tint::inspector { InspectorBuilder::InspectorBuilder() = default; InspectorBuilder::~InspectorBuilder() = default; -void InspectorBuilder::MakeEmptyBodyFunction(std::string name, ast::AttributeList attributes) { - Func(name, ast::VariableList(), ty.void_(), ast::StatementList{Return()}, attributes); +void InspectorBuilder::MakeEmptyBodyFunction(std::string name, + utils::VectorRef attributes) { + Func(name, utils::Empty, ty.void_(), utils::Vector{Return()}, attributes); } void InspectorBuilder::MakeCallerBodyFunction(std::string caller, - std::vector callees, - ast::AttributeList attributes) { - ast::StatementList body; - body.reserve(callees.size() + 1); + utils::VectorRef callees, + utils::VectorRef attributes) { + utils::Vector body; + body.Reserve(callees.Length() + 1); for (auto callee : callees) { - body.push_back(CallStmt(Call(callee))); + body.Push(CallStmt(Call(callee))); } - body.push_back(Return()); + body.Push(Return()); - Func(caller, ast::VariableList(), ty.void_(), body, attributes); + Func(caller, utils::Empty, ty.void_(), body, attributes); } -const ast::Struct* InspectorBuilder::MakeInOutStruct( - std::string name, - std::vector> inout_vars) { - ast::StructMemberList members; +const ast::Struct* InspectorBuilder::MakeInOutStruct(std::string name, + utils::VectorRef inout_vars) { + utils::Vector members; for (auto var : inout_vars) { std::string member_name; uint32_t location; std::tie(member_name, location) = var; - members.push_back(Member(member_name, ty.u32(), {Location(location), Flat()})); + members.Push(Member(member_name, ty.u32(), + utils::Vector{ + Location(location), + Flat(), + })); } return Structure(name, members); } @@ -61,17 +65,15 @@ const ast::Function* InspectorBuilder::MakePlainGlobalReferenceBodyFunction( std::string func, std::string var, const ast::Type* type, - ast::AttributeList attributes) { - ast::StatementList stmts; - stmts.emplace_back(Decl(Var("local_" + var, type))); - stmts.emplace_back(Assign("local_" + var, var)); - stmts.emplace_back(Return()); - - return Func(func, ast::VariableList(), ty.void_(), stmts, attributes); + utils::VectorRef attributes) { + utils::Vector stmts; + stmts.Push(Decl(Var("local_" + var, type))); + stmts.Push(Assign("local_" + var, var)); + stmts.Push(Return()); + return Func(func, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes)); } -bool InspectorBuilder::ContainsName(const std::vector& vec, - const std::string& name) { +bool InspectorBuilder::ContainsName(utils::VectorRef vec, const std::string& name) { for (auto& s : vec) { if (s.name == name) { return true; @@ -84,35 +86,38 @@ std::string InspectorBuilder::StructMemberName(size_t idx, const ast::Type* type return std::to_string(idx) + type->FriendlyName(Symbols()); } -const ast::Struct* InspectorBuilder::MakeStructType(const std::string& name, - std::vector member_types) { - ast::StructMemberList members; +const ast::Struct* InspectorBuilder::MakeStructType( + const std::string& name, + utils::VectorRef member_types) { + utils::Vector members; for (auto* type : member_types) { - members.push_back(MakeStructMember(members.size(), type, {})); + members.Push(MakeStructMember(members.Length(), type, {})); } return MakeStructTypeFromMembers(name, std::move(members)); } -const ast::Struct* InspectorBuilder::MakeStructTypeFromMembers(const std::string& name, - ast::StructMemberList members) { +const ast::Struct* InspectorBuilder::MakeStructTypeFromMembers( + const std::string& name, + utils::VectorRef members) { return Structure(name, std::move(members)); } -const ast::StructMember* InspectorBuilder::MakeStructMember(size_t index, - const ast::Type* type, - ast::AttributeList attributes) { +const ast::StructMember* InspectorBuilder::MakeStructMember( + size_t index, + const ast::Type* type, + utils::VectorRef attributes) { return Member(StructMemberName(index, type), type, std::move(attributes)); } const ast::Struct* InspectorBuilder::MakeUniformBufferType( const std::string& name, - std::vector member_types) { + utils::VectorRef member_types) { return MakeStructType(name, member_types); } std::function InspectorBuilder::MakeStorageBufferTypes( const std::string& name, - std::vector member_types) { + utils::VectorRef member_types) { MakeStructType(name, member_types); return [this, name] { return ty.type_name(name); }; } @@ -121,15 +126,11 @@ void InspectorBuilder::AddUniformBuffer(const std::string& name, const ast::Type* type, uint32_t group, uint32_t binding) { - Global(name, type, ast::StorageClass::kUniform, - ast::AttributeList{ - create(binding), - create(group), - }); + GlobalVar(name, type, ast::StorageClass::kUniform, Binding(binding), Group(group)); } void InspectorBuilder::AddWorkgroupStorage(const std::string& name, const ast::Type* type) { - Global(name, type, ast::StorageClass::kWorkgroup); + GlobalVar(name, type, ast::StorageClass::kWorkgroup); } void InspectorBuilder::AddStorageBuffer(const std::string& name, @@ -137,25 +138,21 @@ void InspectorBuilder::AddStorageBuffer(const std::string& name, ast::Access access, uint32_t group, uint32_t binding) { - Global(name, type, ast::StorageClass::kStorage, access, - ast::AttributeList{ - create(binding), - create(group), - }); + GlobalVar(name, type, ast::StorageClass::kStorage, access, Binding(binding), Group(group)); } void InspectorBuilder::MakeStructVariableReferenceBodyFunction( std::string func_name, std::string struct_name, - std::vector> members) { - ast::StatementList stmts; + utils::VectorRef> members) { + utils::Vector stmts; for (auto member : members) { size_t member_idx; const ast::Type* member_type; std::tie(member_idx, member_type) = member; std::string member_name = StructMemberName(member_idx, member_type); - stmts.emplace_back(Decl(Var("local" + member_name, member_type))); + stmts.Push(Decl(Var("local" + member_name, member_type))); } for (auto member : members) { @@ -164,45 +161,33 @@ void InspectorBuilder::MakeStructVariableReferenceBodyFunction( std::tie(member_idx, member_type) = member; std::string member_name = StructMemberName(member_idx, member_type); - stmts.emplace_back(Assign("local" + member_name, MemberAccessor(struct_name, member_name))); + stmts.Push(Assign("local" + member_name, MemberAccessor(struct_name, member_name))); } - stmts.emplace_back(Return()); + stmts.Push(Return()); - Func(func_name, ast::VariableList(), ty.void_(), stmts, ast::AttributeList{}); + Func(func_name, utils::Empty, ty.void_(), stmts); } void InspectorBuilder::AddSampler(const std::string& name, uint32_t group, uint32_t binding) { - Global(name, sampler_type(), - ast::AttributeList{ - create(binding), - create(group), - }); + GlobalVar(name, sampler_type(), Binding(binding), Group(group)); } void InspectorBuilder::AddComparisonSampler(const std::string& name, uint32_t group, uint32_t binding) { - Global(name, comparison_sampler_type(), - ast::AttributeList{ - create(binding), - create(group), - }); + GlobalVar(name, comparison_sampler_type(), Binding(binding), Group(group)); } void InspectorBuilder::AddResource(const std::string& name, const ast::Type* type, uint32_t group, uint32_t binding) { - Global(name, type, - ast::AttributeList{ - create(binding), - create(group), - }); + GlobalVar(name, type, Binding(binding), Group(group)); } void InspectorBuilder::AddGlobalVariable(const std::string& name, const ast::Type* type) { - Global(name, type, ast::StorageClass::kPrivate); + GlobalVar(name, type, ast::StorageClass::kPrivate); } const ast::Function* InspectorBuilder::MakeSamplerReferenceBodyFunction( @@ -211,17 +196,15 @@ const ast::Function* InspectorBuilder::MakeSamplerReferenceBodyFunction( const std::string& sampler_name, const std::string& coords_name, const ast::Type* base_type, - ast::AttributeList attributes) { + utils::VectorRef attributes) { std::string result_name = "sampler_result"; - ast::StatementList stmts; - stmts.emplace_back(Decl(Var(result_name, ty.vec(base_type, 4)))); - - stmts.emplace_back( - Assign(result_name, Call("textureSample", texture_name, sampler_name, coords_name))); - stmts.emplace_back(Return()); - - return Func(func_name, ast::VariableList(), ty.void_(), stmts, attributes); + utils::Vector stmts{ + Decl(Var(result_name, ty.vec(base_type, 4))), + Assign(result_name, Call("textureSample", texture_name, sampler_name, coords_name)), + Return(), + }; + return Func(func_name, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes)); } const ast::Function* InspectorBuilder::MakeSamplerReferenceBodyFunction( @@ -231,18 +214,16 @@ const ast::Function* InspectorBuilder::MakeSamplerReferenceBodyFunction( const std::string& coords_name, const std::string& array_index, const ast::Type* base_type, - ast::AttributeList attributes) { + utils::VectorRef attributes) { std::string result_name = "sampler_result"; - ast::StatementList stmts; - - stmts.emplace_back(Decl(Var("sampler_result", ty.vec(base_type, 4)))); - - stmts.emplace_back(Assign("sampler_result", Call("textureSample", texture_name, sampler_name, - coords_name, array_index))); - stmts.emplace_back(Return()); - - return Func(func_name, ast::VariableList(), ty.void_(), stmts, attributes); + utils::Vector stmts{ + Decl(Var("sampler_result", ty.vec(base_type, 4))), + Assign("sampler_result", + Call("textureSample", texture_name, sampler_name, coords_name, array_index)), + Return(), + }; + return Func(func_name, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes)); } const ast::Function* InspectorBuilder::MakeComparisonSamplerReferenceBodyFunction( @@ -252,17 +233,16 @@ const ast::Function* InspectorBuilder::MakeComparisonSamplerReferenceBodyFunctio const std::string& coords_name, const std::string& depth_name, const ast::Type* base_type, - ast::AttributeList attributes) { + utils::VectorRef attributes) { std::string result_name = "sampler_result"; - ast::StatementList stmts; - - stmts.emplace_back(Decl(Var("sampler_result", base_type))); - stmts.emplace_back(Assign("sampler_result", Call("textureSampleCompare", texture_name, - sampler_name, coords_name, depth_name))); - stmts.emplace_back(Return()); - - return Func(func_name, ast::VariableList(), ty.void_(), stmts, attributes); + utils::Vector stmts{ + Decl(Var("sampler_result", base_type)), + Assign("sampler_result", + Call("textureSampleCompare", texture_name, sampler_name, coords_name, depth_name)), + Return(), + }; + return Func(func_name, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes)); } const ast::Type* InspectorBuilder::GetBaseType(ResourceBinding::SampledKind sampled_kind) { @@ -285,11 +265,11 @@ const ast::Type* InspectorBuilder::GetCoordsType(ast::TextureDimension dim, return scalar; case ast::TextureDimension::k2d: case ast::TextureDimension::k2dArray: - return create(scalar, 2); + return create(scalar, 2u); case ast::TextureDimension::k3d: case ast::TextureDimension::kCube: case ast::TextureDimension::kCubeArray: - return create(scalar, 3); + return create(scalar, 3u); default: [=]() { FAIL() << "Unsupported texture dimension: " << dim; }(); } @@ -305,25 +285,21 @@ void InspectorBuilder::AddStorageTexture(const std::string& name, const ast::Type* type, uint32_t group, uint32_t binding) { - Global(name, type, - ast::AttributeList{ - create(binding), - create(group), - }); + GlobalVar(name, type, Binding(binding), Group(group)); } const ast::Function* InspectorBuilder::MakeStorageTextureBodyFunction( const std::string& func_name, const std::string& st_name, const ast::Type* dim_type, - ast::AttributeList attributes) { - ast::StatementList stmts; + utils::VectorRef attributes) { + utils::Vector stmts{ + Decl(Var("dim", dim_type)), + Assign("dim", Call("textureDimensions", st_name)), + Return(), + }; - stmts.emplace_back(Decl(Var("dim", dim_type))); - stmts.emplace_back(Assign("dim", Call("textureDimensions", st_name))); - stmts.emplace_back(Return()); - - return Func(func_name, ast::VariableList(), ty.void_(), stmts, attributes); + return Func(func_name, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes)); } std::function InspectorBuilder::GetTypeFunction(ComponentType component, diff --git a/src/tint/inspector/test_inspector_builder.h b/src/tint/inspector/test_inspector_builder.h index 391e1a1479..fe43c69ea4 100644 --- a/src/tint/inspector/test_inspector_builder.h +++ b/src/tint/inspector/test_inspector_builder.h @@ -44,28 +44,31 @@ class InspectorBuilder : public ProgramBuilder { /// Generates an empty function /// @param name name of the function created /// @param attributes the function attributes - void MakeEmptyBodyFunction(std::string name, ast::AttributeList attributes); + void MakeEmptyBodyFunction(std::string name, + utils::VectorRef attributes); /// Generates a function that calls other functions /// @param caller name of the function created /// @param callees names of the functions to be called /// @param attributes the function attributes void MakeCallerBodyFunction(std::string caller, - std::vector callees, - ast::AttributeList attributes); + utils::VectorRef callees, + utils::VectorRef attributes); + + /// InOutInfo is a tuple of name and location for a structure member + using InOutInfo = std::tuple; /// Generates a struct that contains user-defined IO members /// @param name the name of the generated struct /// @param inout_vars tuples of {name, loc} that will be the struct members /// @returns a structure object - const ast::Struct* MakeInOutStruct(std::string name, - std::vector> inout_vars); + const ast::Struct* MakeInOutStruct(std::string name, utils::VectorRef inout_vars); // TODO(crbug.com/tint/697): Remove this. /// Add In/Out variables to the global variables /// @param inout_vars tuples of {in, out} that will be added as entries to the /// global variables - void AddInOutVariables(std::vector> inout_vars); + void AddInOutVariables(utils::VectorRef> inout_vars); // TODO(crbug.com/tint/697): Remove this. /// Generates a function that references in/out variables @@ -73,9 +76,10 @@ class InspectorBuilder : public ProgramBuilder { /// @param inout_vars tuples of {in, out} that will be converted into out = in /// calls in the function body /// @param attributes the function attributes - void MakeInOutVariableBodyFunction(std::string name, - std::vector> inout_vars, - ast::AttributeList attributes); + void MakeInOutVariableBodyFunction( + std::string name, + utils::VectorRef> inout_vars, + utils::VectorRef attributes); // TODO(crbug.com/tint/697): Remove this. /// Generates a function that references in/out variables and calls another @@ -89,34 +93,8 @@ class InspectorBuilder : public ProgramBuilder { const ast::Function* MakeInOutVariableCallerBodyFunction( std::string caller, std::string callee, - std::vector> inout_vars, - ast::AttributeList attributes); - - /// Add a pipeline constant to the global variables, with a specific ID. - /// @param name name of the variable to add - /// @param id id number for the constant id - /// @param type type of the variable - /// @param constructor val to initialize the constant with, if NULL no - /// constructor will be added. - /// @returns the constant that was created - const ast::Variable* AddOverridableConstantWithID(std::string name, - uint32_t id, - const ast::Type* type, - const ast::Expression* constructor) { - return Override(name, type, constructor, {Id(id)}); - } - - /// Add a pipeline constant to the global variables, without a specific ID. - /// @param name name of the variable to add - /// @param type type of the variable - /// @param constructor val to initialize the constant with, if NULL no - /// constructor will be added. - /// @returns the constant that was created - const ast::Variable* AddOverridableConstantWithoutID(std::string name, - const ast::Type* type, - const ast::Expression* constructor) { - return Override(name, type, constructor); - } + utils::VectorRef> inout_vars, + utils::VectorRef attributes); /// Generates a function that references module-scoped, plain-typed constant /// or variable. @@ -125,15 +103,16 @@ class InspectorBuilder : public ProgramBuilder { /// @param type type of the const being referenced /// @param attributes the function attributes /// @returns a function object - const ast::Function* MakePlainGlobalReferenceBodyFunction(std::string func, - std::string var, - const ast::Type* type, - ast::AttributeList attributes); + const ast::Function* MakePlainGlobalReferenceBodyFunction( + std::string func, + std::string var, + const ast::Type* type, + utils::VectorRef attributes); /// @param vec Vector of StageVariable to be searched /// @param name Name to be searching for /// @returns true if name is in vec, otherwise false - bool ContainsName(const std::vector& vec, const std::string& name); + bool ContainsName(utils::VectorRef vec, const std::string& name); /// Builds a string for accessing a member in a generated struct /// @param idx index of member @@ -146,14 +125,15 @@ class InspectorBuilder : public ProgramBuilder { /// @param member_types a vector of member types /// @returns a struct type const ast::Struct* MakeStructType(const std::string& name, - std::vector member_types); + utils::VectorRef member_types); /// Generates a struct type from a list of member nodes. /// @param name name for the struct type /// @param members a vector of members /// @returns a struct type - const ast::Struct* MakeStructTypeFromMembers(const std::string& name, - ast::StructMemberList members); + const ast::Struct* MakeStructTypeFromMembers( + const std::string& name, + utils::VectorRef members); /// Generates a struct member with a specified index and type. /// @param index index of the field within the struct @@ -162,14 +142,14 @@ class InspectorBuilder : public ProgramBuilder { /// @returns a struct member const ast::StructMember* MakeStructMember(size_t index, const ast::Type* type, - ast::AttributeList attributes); + utils::VectorRef attributes); /// Generates types appropriate for using in an uniform buffer /// @param name name for the type /// @param member_types a vector of member types /// @returns a struct type that has the layout for an uniform buffer. const ast::Struct* MakeUniformBufferType(const std::string& name, - std::vector member_types); + utils::VectorRef member_types); /// Generates types appropriate for using in a storage buffer /// @param name name for the type @@ -177,7 +157,7 @@ class InspectorBuilder : public ProgramBuilder { /// @returns a function that returns the created structure. std::function MakeStorageBufferTypes( const std::string& name, - std::vector member_types); + utils::VectorRef member_types); /// Adds an uniform buffer variable to the program /// @param name the name of the variable @@ -206,14 +186,16 @@ class InspectorBuilder : public ProgramBuilder { uint32_t group, uint32_t binding); + /// MemberInfo is a tuple of member index and type. + using MemberInfo = std::tuple; + /// Generates a function that references a specific struct variable /// @param func_name name of the function created /// @param struct_name name of the struct variabler to be accessed /// @param members list of members to access, by index and type - void MakeStructVariableReferenceBodyFunction( - std::string func_name, - std::string struct_name, - std::vector> members); + void MakeStructVariableReferenceBodyFunction(std::string func_name, + std::string struct_name, + utils::VectorRef members); /// Adds a regular sampler variable to the program /// @param name the name of the variable @@ -250,12 +232,13 @@ class InspectorBuilder : public ProgramBuilder { /// @param base_type sampler base type /// @param attributes the function attributes /// @returns a function that references all of the values specified - const ast::Function* MakeSamplerReferenceBodyFunction(const std::string& func_name, - const std::string& texture_name, - const std::string& sampler_name, - const std::string& coords_name, - const ast::Type* base_type, - ast::AttributeList attributes); + const ast::Function* MakeSamplerReferenceBodyFunction( + const std::string& func_name, + const std::string& texture_name, + const std::string& sampler_name, + const std::string& coords_name, + const ast::Type* base_type, + utils::VectorRef attributes); /// Generates a function that references a specific sampler variable /// @param func_name name of the function created @@ -266,13 +249,14 @@ class InspectorBuilder : public ProgramBuilder { /// @param base_type sampler base type /// @param attributes the function attributes /// @returns a function that references all of the values specified - const ast::Function* MakeSamplerReferenceBodyFunction(const std::string& func_name, - const std::string& texture_name, - const std::string& sampler_name, - const std::string& coords_name, - const std::string& array_index, - const ast::Type* base_type, - ast::AttributeList attributes); + const ast::Function* MakeSamplerReferenceBodyFunction( + const std::string& func_name, + const std::string& texture_name, + const std::string& sampler_name, + const std::string& coords_name, + const std::string& array_index, + const ast::Type* base_type, + utils::VectorRef attributes); /// Generates a function that references a specific comparison sampler /// variable. @@ -284,13 +268,14 @@ class InspectorBuilder : public ProgramBuilder { /// @param base_type sampler base type /// @param attributes the function attributes /// @returns a function that references all of the values specified - const ast::Function* MakeComparisonSamplerReferenceBodyFunction(const std::string& func_name, - const std::string& texture_name, - const std::string& sampler_name, - const std::string& coords_name, - const std::string& depth_name, - const ast::Type* base_type, - ast::AttributeList attributes); + const ast::Function* MakeComparisonSamplerReferenceBodyFunction( + const std::string& func_name, + const std::string& texture_name, + const std::string& sampler_name, + const std::string& coords_name, + const std::string& depth_name, + const ast::Type* base_type, + utils::VectorRef attributes); /// Gets an appropriate type for the data in a given texture type. /// @param sampled_kind type of in the texture @@ -326,10 +311,11 @@ class InspectorBuilder : public ProgramBuilder { /// @param dim_type type expected by textureDimensons to return /// @param attributes the function attributes /// @returns a function that references all of the values specified - const ast::Function* MakeStorageTextureBodyFunction(const std::string& func_name, - const std::string& st_name, - const ast::Type* dim_type, - ast::AttributeList attributes); + const ast::Function* MakeStorageTextureBodyFunction( + const std::string& func_name, + const std::string& st_name, + const ast::Type* dim_type, + utils::VectorRef attributes); /// Get a generator function that returns a type appropriate for a stage /// variable with the given combination of component and composition type. diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def index 443634d5b2..2b84d45fb3 100644 --- a/src/tint/intrinsics.def +++ b/src/tint/intrinsics.def @@ -23,14 +23,48 @@ // Enumerators // //////////////////////////////////////////////////////////////////////////////// +// https://gpuweb.github.io/gpuweb/wgsl/#builtin-values +enum builtin_value { + position + vertex_index + instance_index + front_facing + frag_depth + local_invocation_id + local_invocation_index + global_invocation_id + workgroup_id + num_workgroups + sample_index + sample_mask + @internal point_size +} + +// https://gpuweb.github.io/gpuweb/wgsl/#extension +enum extension { + // WGSL Extension "f16" + f16 + // An extension for the experimental feature "chromium_experimental_dp4a". + // See crbug.com/tint/1497 for more details + chromium_experimental_dp4a + // A Chromium-specific extension for disabling uniformity analysis. + chromium_disable_uniformity_analysis + // A Chromium-specific extension for push constants + chromium_experimental_push_constant +} + // https://gpuweb.github.io/gpuweb/wgsl/#storage-class enum storage_class { + @internal none function private workgroup uniform storage - [[internal]] handle + push_constant + @internal handle + @internal in + @internal out } // https://gpuweb.github.io/gpuweb/wgsl/#memory-access-mode @@ -62,18 +96,35 @@ enum texel_format { //////////////////////////////////////////////////////////////////////////////// // WGSL primitive types // +// Types may be decorated with @precedence(N) to prioritize which type // +// will be picked when multiple types of a matcher match. // +// This is used to ensure that abstract numerical types materialize to the // +// concrete type with the lowest conversion rank. // +// Types with higher the precedence values will be matched first. // //////////////////////////////////////////////////////////////////////////////// // https://gpuweb.github.io/gpuweb/wgsl/#plain-types-section type bool -type f32 -type i32 -type u32 +@precedence(5) @display("abstract-float") type fa +@precedence(4) @display("abstract-int") type ia +@precedence(3) type i32 +@precedence(2) type u32 +@precedence(1) type f32 +@precedence(0) type f16 type vec2 type vec3 type vec4 -[[display("vec{N}<{T}>")]] type vec -[[display("mat{N}x{M}<{T}>")]] type mat +type mat2x2 +type mat2x3 +type mat2x4 +type mat3x2 +type mat3x3 +type mat3x4 +type mat4x2 +type mat4x3 +type mat4x4 +@display("vec{N}<{T}>") type vec +@display("mat{N}x{M}<{T}>") type mat type ptr type atomic type array @@ -97,10 +148,12 @@ type texture_storage_2d_array type texture_storage_3d type texture_external -type __modf_result -[[display("__modf_result_vec{N}")]] type __modf_result_vec -type __frexp_result -[[display("__frexp_result_vec{N}")]] type __frexp_result_vec +@display("__modf_result_{T}") type __modf_result +@display("__modf_result_vec{N}_{T}") type __modf_result_vec +@display("__frexp_result_{T}") type __frexp_result +@display("__frexp_result_vec{N}_{T}") type __frexp_result_vec + +type __atomic_compare_exchange_result //////////////////////////////////////////////////////////////////////////////// // Type matchers // @@ -108,9 +161,25 @@ type __frexp_result // A type matcher that can match one or more types. // //////////////////////////////////////////////////////////////////////////////// +match abstract_or_scalar: ia | fa | f32 | f16 | i32 | u32 | bool +match scalar: f32 | f16 | i32 | u32 | bool +match scalar_no_f32: i32 | f16 | u32 | bool +match scalar_no_f16: f32 | i32 | u32 | bool +match scalar_no_i32: f32 | f16 | u32 | bool +match scalar_no_u32: f32 | f16 | i32 | bool +match scalar_no_bool: f32 | f16 | i32 | u32 +match fia_fiu32_f16: fa | ia | f32 | i32 | u32 | f16 +match fia_fi32_f16: fa | ia | f32 | i32 | f16 +match fia_fiu32: fa | ia | f32 | i32 | u32 +match fa_f32: fa | f32 +match fa_f32_f16: fa | f32 | f16 +match ia_iu32: ia | i32 | u32 +match fiu32_f16: f32 | i32 | u32 | f16 match fiu32: f32 | i32 | u32 +match fi32_f16: f32 | i32 | f16 +match fi32: f32 | i32 +match f32_f16: f32 | f16 match iu32: i32 | u32 -match scalar: f32 | i32 | u32 | bool //////////////////////////////////////////////////////////////////////////////// // Enum matchers // @@ -121,17 +190,38 @@ match scalar: f32 | i32 | u32 | bool //////////////////////////////////////////////////////////////////////////////// // https://gpuweb.github.io/gpuweb/wgsl/#texel-formats -match f32_texel_format: - rgba8unorm | rgba8snorm | rgba16float | r32float | rg32float | rgba32float -match i32_texel_format: - rgba8sint | rgba16sint | r32sint | rg32sint | rgba32sint -match u32_texel_format: - rgba8uint | rgba16uint | r32uint | rg32uint | rgba32uint +match f32_texel_format + : texel_format.rgba8unorm + | texel_format.rgba8snorm + | texel_format.rgba16float + | texel_format.r32float + | texel_format.rg32float + | texel_format.rgba32float +match i32_texel_format + : texel_format.rgba8sint + | texel_format.rgba16sint + | texel_format.r32sint + | texel_format.rg32sint + | texel_format.rgba32sint +match u32_texel_format + : texel_format.rgba8uint + | texel_format.rgba16uint + | texel_format.r32uint + | texel_format.rg32uint + | texel_format.rgba32uint -match write_only: write +match write: access.write +match read_write: access.read_write -match function_private_workgroup: function | private | workgroup -match workgroup_or_storage: workgroup | storage +match function_private_workgroup + : storage_class.function + | storage_class.private + | storage_class.workgroup +match workgroup_or_storage + : storage_class.workgroup + | storage_class.storage +match storage + : storage_class.storage //////////////////////////////////////////////////////////////////////////////// // Builtin Functions // @@ -140,7 +230,7 @@ match workgroup_or_storage: workgroup | storage // functions supported by the WGSL language. This builtin definition // // language supports simple static-type function declarations, as well as // // single overload declarations that can match a number of different // -// argument types via the use of 'open-types' and 'open-numbers'. // +// argument types via the use of template types and template numbers // // // // * Basic example: // // // @@ -149,10 +239,9 @@ match workgroup_or_storage: workgroup | storage // Declares an overload of the function 'isInf' that accepts a single // // parameter of type 'f32' and returns a 'bool'. // // // -// An 'open-type' can be thought as a template type that is determined by the // -// arguments to the builtin. // +// A template type is a type determined by the arguments to the builtin. // // // -// * Open-type example without constraint: // +// * Template type example without constraint: // // // // fn arrayLength(array) -> u32 // // // @@ -161,7 +250,7 @@ match workgroup_or_storage: workgroup | storage // element type. This overload will always return a value of the same type // // as its single argument. // // // -// * Open-type example with constraint: // +// * Template type example with constraint: // // // // fn abs(T) -> T // // // @@ -169,10 +258,10 @@ match workgroup_or_storage: workgroup | storage // argument of type 'f32', 'i32' or 'u32', which returns a value of the // // same argument type. // // // -// Similarly an 'open-number' can be thought as a template number or // -// enumerator that is determined by the arguments to the builtin. // +// Similarly a template number is a number or enumerator that is determined // +// by the arguments to the builtin. // // // -// * Open-number example: // +// * Template number example: // // // // fn dpdx(vec) -> vec // // // @@ -181,54 +270,92 @@ match workgroup_or_storage: workgroup | storage // the same argument type. // // // // // -// Matching algorithm: // -// ------------------- // +// Matching algorithm for a single overload: // +// ----------------------------------------- // // // -// Prior to matching an overload, all open-types are undefined. // +// The goal of matching is to compare a function call's arguments and any // +// explicitly provided template types in the program source against an // +// overload declaration in this file, and determine if the call satisfies // +// the form and type constraints of the overload. If the call matches an // +// overload, then the overload is added to the list of 'overload candidates' // +// used for overload resolution (described below). // // // -// Open-types become closed-types (pinned to a fixed type) on the first // -// attempt to match an argument to that open-type. // -// Once open-types are closed, they remain that type for the rest of the // -// overload evaluation. // +// Prior to matching an overload, all template types are undefined. // +// // +// Template types are first defined with the type of the leftmost argument // +// that matches against that template type name. Subsequent arguments that // +// attempt to match against the template type name will either reject the // +// overload or refine the template, in one of 3 ways: // +// (a) Fail to match, causing the overload to be immediately rejected. // +// (b) Match the existing template type, either exactly or via implicit // +// conversion, and overload resolution continues. // +// (c) Match via implicit conversion of the currently defined template type // +// to the argument type. In this situation, the template type is refined // +// with the more constrained argument type, and overload resolution // +// continues. // // // // To better understand, let's consider the following hypothetical overload // // declaration: // // // // fn foo(T, T); // // // -// T - is the open-type // +// T - is the template type name // // scalar - is a matcher for the types 'f32', 'i32', 'u32' or 'bool' // // (declared above) // -// - declares the open-type T, with the constraint that T must // -// match one of 'f32', 'i32', 'u32' or 'bool'. // +// - declares the template type T, with the constraint that T // +// must match one of 'f32', 'i32', 'u32' or 'bool'. // // // // The process for resolving this overload is as follows: // // // // (1) The overload resolver begins by attempting to match the argument // // types from left to right. // -// The first parameter type is compared against the argument type. // -// As the open-type T has not been closed yet, T is closed as the type // -// of the first argument. // +// The first parameter type is compared against the argument type T. // +// As the template type T has not been defined yet, T is defined as the // +// type of the first argument. // // There's no verification that the T type is a scalar at this stage. // // (2) The second parameter is then compared against the second argument. // -// As the open-type T is now closed, the argument type is compared // -// against the value of the closed-type of T. If the types match, then // -// the overload is still a candidate for matching, otherwise the // -// overload is no longer considered. // -// (3) If all the parameters matched, constraints on the open-types need // -// to be checked next. If the closed-type does not match the 'match' // -// constraint, then the overload is no longer considered. // +// As the template type T is now defined the argument type is compared // +// against the value of the defined type of T. Depending on the // +// comparison of the argument type to the template type, either the // +// actions of (a), (b) or (c) from above will occur. // +// (3) If all the parameters matched, constraints on the template types // +// need to be checked next. If the defined type does not match the // +// 'match' constraint, then the overload is no longer considered. // // // -// The algorithm for matching open-numbers is almost identical to open-types, // -// except of course, they match against integer numbers or enumerators // -// instead of types. // +// This algorithm for matching a single overload is less general than the // +// algorithm described in the WGSL spec. But it makes the same decisions // +// because the overloads defined by WGSL are monotonic in the sense that once // +// a template parameter has been refined, there is never a need to backtrack // +// and un-refine it to match a later argument. // +// // +// The algorithm for matching template numbers is similar to matching // +// template types, except numbers need to exactly match across all uses - // +// there is no implicit conversion. Template numbers may match integer // +// numbers or enumerators. // // // // // -// * More examples: // +// Overload resolution for candidate overloads // +// ------------------------------------------- // +// // +// If multiple candidate overloads match a given set of arguments, then a // +// final overload resolution pass needs to be performed. The arguments and // +// overload parameter types for each candidate overload are compared, // +// following the algorithm described at: // +// https://www.w3.org/TR/WGSL/#overload-resolution-section // +// // +// If the candidate list contains a single entry, then that single candidate // +// is picked, and no overload resolution needs to be performed. // +// // +// If the candidate list is empty, then the call fails to resolve and an // +// error diagnostic is raised. // +// // +// // +// More examples // +// ------------- // // // // fn F() // // - Function called F. // -// No open types or numbers, no parameters, no return value // +// No template types or numbers, no parameters, no return value // // // // fn F() -> RETURN_TYPE // // - Function with RETURN_TYPE as the return type value // @@ -242,168 +369,174 @@ match workgroup_or_storage: workgroup | storage // some builtin functions // // // // fn F(T) // -// - Single parameter of unconstrained open-type T (any type) // +// - Single parameter of unconstrained template type T (any type) // // // // fn F(T) // -// - Single parameter of constrained open-type T (must be a scalar) // +// - Single parameter of constrained template type T (must be a scalar) // // // // fn F(T) -> T // -// - Single parameter of constrained open-type T (must be a one of fiu32) // -// Return type matches parameter type // +// - Single parameter of constrained template type T (must be a one of // +// fiu32) Return type matches parameter type // // // // fn F(vec) // -// - Single parameter of vector type with open-number size N and element // -// open-type T // +// - Single parameter of vector type with template number size N and // +// element template type T // // // // fn F(texture_storage_1d) // -// - Single parameter of texture_storage_1d type with open-number // +// - Single parameter of texture_storage_1d type with template number // // access-control C, and of a texel format that is listed in // // f32_texel_format // // // //////////////////////////////////////////////////////////////////////////////// // https://gpuweb.github.io/gpuweb/wgsl/#builtin-functions -fn abs(T) -> T -fn abs(vec) -> vec -fn acos(f32) -> f32 -fn acos(vec) -> vec +fn abs(T) -> T +fn abs(vec) -> vec +fn acos(T) -> T +fn acos(vec) -> vec +fn acosh(T) -> T +fn acosh(vec) -> vec fn all(bool) -> bool fn all(vec) -> bool fn any(bool) -> bool fn any(vec) -> bool fn arrayLength(ptr, A>) -> u32 -fn asin(f32) -> f32 -fn asin(vec) -> vec -fn atan(f32) -> f32 -fn atan(vec) -> vec -fn atan2(f32, f32) -> f32 -fn atan2(vec, vec) -> vec -fn ceil(f32) -> f32 -fn ceil(vec) -> vec -fn clamp(T, T, T) -> T -fn clamp(vec, vec, vec) -> vec -fn cos(f32) -> f32 -fn cos(vec) -> vec -fn cosh(f32) -> f32 -fn cosh(vec) -> vec +fn asin(T) -> T +fn asin(vec) -> vec +fn asinh(T) -> T +fn asinh(vec) -> vec +fn atan(T) -> T +fn atan(vec) -> vec +@const fn atan2(T, T) -> T +@const fn atan2(vec, vec) -> vec +fn atanh(T) -> T +fn atanh(vec) -> vec +fn ceil(T) -> T +fn ceil(vec) -> vec +@const fn clamp(T, T, T) -> T +@const fn clamp(vec, vec, vec) -> vec +fn cos(T) -> T +fn cos(vec) -> vec +fn cosh(T) -> T +fn cosh(vec) -> vec fn countLeadingZeros(T) -> T fn countLeadingZeros(vec) -> vec fn countOneBits(T) -> T fn countOneBits(vec) -> vec fn countTrailingZeros(T) -> T fn countTrailingZeros(vec) -> vec -fn cross(vec3, vec3) -> vec3 -fn degrees(f32) -> f32 -fn degrees(vec) -> vec -fn determinant(mat) -> f32 -fn distance(f32, f32) -> f32 -fn distance(vec, vec) -> f32 -fn dot(vec, vec) -> T -[[stage("fragment")]] fn dpdx(f32) -> f32 -[[stage("fragment")]] fn dpdx(vec) -> vec -[[stage("fragment")]] fn dpdxCoarse(f32) -> f32 -[[stage("fragment")]] fn dpdxCoarse(vec) -> vec -[[stage("fragment")]] fn dpdxFine(f32) -> f32 -[[stage("fragment")]] fn dpdxFine(vec) -> vec -[[stage("fragment")]] fn dpdy(f32) -> f32 -[[stage("fragment")]] fn dpdy(vec) -> vec -[[stage("fragment")]] fn dpdyCoarse(f32) -> f32 -[[stage("fragment")]] fn dpdyCoarse(vec) -> vec -[[stage("fragment")]] fn dpdyFine(f32) -> f32 -[[stage("fragment")]] fn dpdyFine(vec) -> vec -fn exp(f32) -> f32 -fn exp(vec) -> vec -fn exp2(f32) -> f32 -fn exp2(vec) -> vec +fn cross(vec3, vec3) -> vec3 +fn degrees(T) -> T +fn degrees(vec) -> vec +fn determinant(mat) -> T +fn distance(T, T) -> T +fn distance(vec, vec) -> T +fn dot(vec, vec) -> T +fn dot4I8Packed(u32, u32) -> i32 +fn dot4U8Packed(u32, u32) -> u32 +@stage("fragment") fn dpdx(f32) -> f32 +@stage("fragment") fn dpdx(vec) -> vec +@stage("fragment") fn dpdxCoarse(f32) -> f32 +@stage("fragment") fn dpdxCoarse(vec) -> vec +@stage("fragment") fn dpdxFine(f32) -> f32 +@stage("fragment") fn dpdxFine(vec) -> vec +@stage("fragment") fn dpdy(f32) -> f32 +@stage("fragment") fn dpdy(vec) -> vec +@stage("fragment") fn dpdyCoarse(f32) -> f32 +@stage("fragment") fn dpdyCoarse(vec) -> vec +@stage("fragment") fn dpdyFine(f32) -> f32 +@stage("fragment") fn dpdyFine(vec) -> vec +fn exp(T) -> T +fn exp(vec) -> vec +fn exp2(T) -> T +fn exp2(vec) -> vec fn extractBits(T, u32, u32) -> T fn extractBits(vec, u32, u32) -> vec -fn faceForward(vec, vec, vec) -> vec +fn faceForward(vec, vec, vec) -> vec fn firstLeadingBit(T) -> T fn firstLeadingBit(vec) -> vec fn firstTrailingBit(T) -> T fn firstTrailingBit(vec) -> vec -fn floor(f32) -> f32 -fn floor(vec) -> vec -fn fma(f32, f32, f32) -> f32 -fn fma(vec, vec, vec) -> vec -fn fract(f32) -> f32 -fn fract(vec) -> vec -fn frexp(f32) -> __frexp_result -fn frexp(vec) -> __frexp_result_vec -[[stage("fragment")]] fn fwidth(f32) -> f32 -[[stage("fragment")]] fn fwidth(vec) -> vec -[[stage("fragment")]] fn fwidthCoarse(f32) -> f32 -[[stage("fragment")]] fn fwidthCoarse(vec) -> vec -[[stage("fragment")]] fn fwidthFine(f32) -> f32 -[[stage("fragment")]] fn fwidthFine(vec) -> vec +fn floor(T) -> T +fn floor(vec) -> vec +fn fma(T, T, T) -> T +fn fma(vec, vec, vec) -> vec +fn fract(T) -> T +fn fract(vec) -> vec +fn frexp(T) -> __frexp_result +fn frexp(vec) -> __frexp_result_vec +@stage("fragment") fn fwidth(f32) -> f32 +@stage("fragment") fn fwidth(vec) -> vec +@stage("fragment") fn fwidthCoarse(f32) -> f32 +@stage("fragment") fn fwidthCoarse(vec) -> vec +@stage("fragment") fn fwidthFine(f32) -> f32 +@stage("fragment") fn fwidthFine(vec) -> vec fn insertBits(T, T, u32, u32) -> T fn insertBits(vec, vec, u32, u32) -> vec -fn inverseSqrt(f32) -> f32 -fn inverseSqrt(vec) -> vec -fn ldexp(f32, i32) -> f32 -fn ldexp(vec, vec) -> vec -fn length(f32) -> f32 -fn length(vec) -> f32 -fn log(f32) -> f32 -fn log(vec) -> vec -fn log2(f32) -> f32 -fn log2(vec) -> vec -fn max(T, T) -> T -fn max(vec, vec) -> vec -fn min(T, T) -> T -fn min(vec, vec) -> vec -fn mix(f32, f32, f32) -> f32 -fn mix(vec, vec, vec) -> vec -fn mix(vec, vec, f32) -> vec -fn modf(f32) -> __modf_result -fn modf(vec) -> __modf_result_vec -fn normalize(vec) -> vec +fn inverseSqrt(T) -> T +fn inverseSqrt(vec) -> vec +fn ldexp(T, i32) -> T +fn ldexp(vec, vec) -> vec +fn length(T) -> T +fn length(vec) -> T +fn log(T) -> T +fn log(vec) -> vec +fn log2(T) -> T +fn log2(vec) -> vec +fn max(T, T) -> T +fn max(vec, vec) -> vec +fn min(T, T) -> T +fn min(vec, vec) -> vec +fn mix(T, T, T) -> T +fn mix(vec, vec, vec) -> vec +fn mix(vec, vec, T) -> vec +fn modf(T) -> __modf_result +fn modf(vec) -> __modf_result_vec +fn normalize(vec) -> vec fn pack2x16float(vec2) -> u32 fn pack2x16snorm(vec2) -> u32 fn pack2x16unorm(vec2) -> u32 fn pack4x8snorm(vec4) -> u32 fn pack4x8unorm(vec4) -> u32 -fn pow(f32, f32) -> f32 -fn pow(vec, vec) -> vec -fn radians(f32) -> f32 -fn radians(vec) -> vec -fn reflect(vec, vec) -> vec -fn refract(vec, vec, f32) -> vec +fn pow(T, T) -> T +fn pow(vec, vec) -> vec +fn radians(T) -> T +fn radians(vec) -> vec +fn reflect(vec, vec) -> vec +fn refract(vec, vec, T) -> vec fn reverseBits(T) -> T fn reverseBits(vec) -> vec -fn round(f32) -> f32 -fn round(vec) -> vec +fn round(T) -> T +fn round(vec) -> vec fn select(T, T, bool) -> T fn select(vec, vec, bool) -> vec fn select(vec, vec, vec) -> vec -fn sign(f32) -> f32 -fn sign(vec) -> vec -fn sin(f32) -> f32 -fn sin(vec) -> vec -fn sinh(f32) -> f32 -fn sinh(vec) -> vec -fn smoothstep(f32, f32, f32) -> f32 -fn smoothstep(vec, vec, vec) -> vec -[[deprecated]] fn smoothStep(f32, f32, f32) -> f32 -[[deprecated]] fn smoothStep(vec, vec, vec) -> vec -fn sqrt(f32) -> f32 -fn sqrt(vec) -> vec -fn step(f32, f32) -> f32 -fn step(vec, vec) -> vec -[[stage("compute")]] fn storageBarrier() -fn tan(f32) -> f32 -fn tan(vec) -> vec -fn tanh(f32) -> f32 -fn tanh(vec) -> vec -fn transpose(mat) -> mat -fn trunc(f32) -> f32 -fn trunc(vec) -> vec +fn sign(T) -> T +fn sign(vec) -> vec +fn sin(T) -> T +fn sin(vec) -> vec +fn sinh(T) -> T +fn sinh(vec) -> vec +fn smoothstep(T, T, T) -> T +fn smoothstep(vec, vec, vec) -> vec +fn sqrt(T) -> T +fn sqrt(vec) -> vec +fn step(T, T) -> T +fn step(vec, vec) -> vec +@stage("compute") fn storageBarrier() +fn tan(T) -> T +fn tan(vec) -> vec +fn tanh(T) -> T +fn tanh(vec) -> vec +fn transpose(mat) -> mat +fn trunc(T) -> T +fn trunc(vec) -> vec fn unpack2x16float(u32) -> vec2 fn unpack2x16snorm(u32) -> vec2 fn unpack2x16unorm(u32) -> vec2 fn unpack4x8snorm(u32) -> vec4 fn unpack4x8unorm(u32) -> vec4 -[[stage("compute")]] fn workgroupBarrier() +@stage("compute") fn workgroupBarrier() fn textureDimensions(texture: texture_1d) -> i32 fn textureDimensions(texture: texture_1d, level: i32) -> i32 @@ -427,34 +560,34 @@ fn textureDimensions(texture: texture_depth_cube, level: i32) -> vec2 fn textureDimensions(texture: texture_depth_cube_array) -> vec2 fn textureDimensions(texture: texture_depth_cube_array, level: i32) -> vec2 fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2 -fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions(texture: texture_storage_3d) -> vec3 fn textureDimensions(texture: texture_external) -> vec2 -fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 +fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 +fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> vec4 fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> vec4 -fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> vec4 +fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> vec4 fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> vec4 -fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> vec4 +fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> vec4 fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> vec4 fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> vec4 fn textureNumLayers(texture: texture_2d_array) -> i32 fn textureNumLayers(texture: texture_cube_array) -> i32 fn textureNumLayers(texture: texture_depth_2d_array) -> i32 fn textureNumLayers(texture: texture_depth_cube_array) -> i32 -fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers(texture: texture_storage_2d_array) -> i32 fn textureNumLevels(texture: texture_1d) -> i32 fn textureNumLevels(texture: texture_2d) -> i32 fn textureNumLevels(texture: texture_2d_array) -> i32 @@ -467,61 +600,61 @@ fn textureNumLevels(texture: texture_depth_cube) -> i32 fn textureNumLevels(texture: texture_depth_cube_array) -> i32 fn textureNumSamples(texture: texture_multisampled_2d) -> i32 fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32 -[[stage("fragment")]] fn textureSample(texture: texture_1d, sampler: sampler, coords: f32) -> vec4 -[[stage("fragment")]] fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -[[stage("fragment")]] fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -[[stage("fragment")]] fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -[[stage("fragment")]] fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -[[stage("fragment")]] fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3) -> vec4 -[[stage("fragment")]] fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, offset: vec3) -> vec4 -[[stage("fragment")]] fn textureSample(texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -[[stage("fragment")]] fn textureSample(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 -[[stage("fragment")]] fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> f32 -[[stage("fragment")]] fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> f32 -[[stage("fragment")]] fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> f32 -[[stage("fragment")]] fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> f32 -[[stage("fragment")]] fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> f32 -[[stage("fragment")]] fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> f32 -[[stage("fragment")]] fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32) -> vec4 -[[stage("fragment")]] fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, offset: vec2) -> vec4 -[[stage("fragment")]] fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32) -> vec4 -[[stage("fragment")]] fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, offset: vec2) -> vec4 -[[stage("fragment")]] fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32) -> vec4 -[[stage("fragment")]] fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, offset: vec3) -> vec4 -[[stage("fragment")]] fn textureSampleBias(texture: texture_cube, sampler: sampler, coords: vec3, bias: f32) -> vec4 -[[stage("fragment")]] fn textureSampleBias(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, bias: f32) -> vec4 -[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 -[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 -[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 -[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 -[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 -[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 +@stage("fragment") fn textureSample(texture: texture_1d, sampler: sampler, coords: f32) -> vec4 +@stage("fragment") fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +@stage("fragment") fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +@stage("fragment") fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +@stage("fragment") fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +@stage("fragment") fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3) -> vec4 +@stage("fragment") fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, @const offset: vec3) -> vec4 +@stage("fragment") fn textureSample(texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +@stage("fragment") fn textureSample(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +@stage("fragment") fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> f32 +@stage("fragment") fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> f32 +@stage("fragment") fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> f32 +@stage("fragment") fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> f32 +@stage("fragment") fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> f32 +@stage("fragment") fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> f32 +@stage("fragment") fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, @const offset: vec2) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, @const offset: vec2) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, @const offset: vec3) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_cube, sampler: sampler, coords: vec3, bias: f32) -> vec4 +@stage("fragment") fn textureSampleBias(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, bias: f32) -> vec4 +@stage("fragment") fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 +@stage("fragment") fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 +@stage("fragment") fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 +@stage("fragment") fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 +@stage("fragment") fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 +@stage("fragment") fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 -fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 +fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 -fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 +fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2) -> vec4 -fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 +fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2) -> vec4 -fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 +fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 -fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, offset: vec3) -> vec4 +fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, @const offset: vec3) -> vec4 fn textureSampleGrad(texture: texture_cube, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 fn textureSampleGrad(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, ddx: vec3, ddy: vec3) -> vec4 fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32) -> vec4 -fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, offset: vec2) -> vec4 +fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, @const offset: vec2) -> vec4 fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32) -> vec4 -fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, offset: vec2) -> vec4 +fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, @const offset: vec2) -> vec4 fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32) -> vec4 -fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, offset: vec3) -> vec4 +fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, @const offset: vec3) -> vec4 fn textureSampleLevel(texture: texture_cube, sampler: sampler, coords: vec3, level: f32) -> vec4 fn textureSampleLevel(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: f32) -> vec4 fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32) -> f32 -fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, offset: vec2) -> f32 +fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, @const offset: vec2) -> f32 fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32) -> f32 -fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, offset: vec2) -> f32 +fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, @const offset: vec2) -> f32 fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3, level: i32) -> f32 fn textureSampleLevel(texture: texture_depth_cube_array,sampler: sampler, coords: vec3, array_index: i32, level: i32) -> f32 fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2) -> vec4 @@ -547,14 +680,280 @@ fn textureLoad(texture: texture_depth_2d_array, coords: vec2, array_index: fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2, sample_index: i32) -> f32 fn textureLoad(texture: texture_external, coords: vec2) -> vec4 -[[stage("fragment", "compute")]] fn atomicLoad(ptr, read_write>) -> T -[[stage("fragment", "compute")]] fn atomicStore(ptr, read_write>, T) -[[stage("fragment", "compute")]] fn atomicAdd(ptr, read_write>, T) -> T -[[stage("fragment", "compute")]] fn atomicSub(ptr, read_write>, T) -> T -[[stage("fragment", "compute")]] fn atomicMax(ptr, read_write>, T) -> T -[[stage("fragment", "compute")]] fn atomicMin(ptr, read_write>, T) -> T -[[stage("fragment", "compute")]] fn atomicAnd(ptr, read_write>, T) -> T -[[stage("fragment", "compute")]] fn atomicOr(ptr, read_write>, T) -> T -[[stage("fragment", "compute")]] fn atomicXor(ptr, read_write>, T) -> T -[[stage("fragment", "compute")]] fn atomicExchange(ptr, read_write>, T) -> T -[[stage("fragment", "compute")]] fn atomicCompareExchangeWeak(ptr, read_write>, T, T) -> vec2 +@stage("fragment", "compute") fn atomicLoad(ptr, read_write>) -> T +@stage("fragment", "compute") fn atomicStore(ptr, read_write>, T) +@stage("fragment", "compute") fn atomicAdd(ptr, read_write>, T) -> T +@stage("fragment", "compute") fn atomicSub(ptr, read_write>, T) -> T +@stage("fragment", "compute") fn atomicMax(ptr, read_write>, T) -> T +@stage("fragment", "compute") fn atomicMin(ptr, read_write>, T) -> T +@stage("fragment", "compute") fn atomicAnd(ptr, read_write>, T) -> T +@stage("fragment", "compute") fn atomicOr(ptr, read_write>, T) -> T +@stage("fragment", "compute") fn atomicXor(ptr, read_write>, T) -> T +@stage("fragment", "compute") fn atomicExchange(ptr, read_write>, T) -> T +@stage("fragment", "compute") fn atomicCompareExchangeWeak(ptr, read_write>, T, T) -> __atomic_compare_exchange_result + +//////////////////////////////////////////////////////////////////////////////// +// Type constructors // +//////////////////////////////////////////////////////////////////////////////// + +// Zero value constructors +@const("Zero") ctor i32() -> i32 +@const("Zero") ctor u32() -> u32 +@const("Zero") ctor f32() -> f32 +@const("Zero") ctor f16() -> f16 +@const("Zero") ctor bool() -> bool +@const("Zero") ctor vec2() -> vec2 +@const("Zero") ctor vec3() -> vec3 +@const("Zero") ctor vec4() -> vec4 +@const("Zero") ctor mat2x2() -> mat2x2 +@const("Zero") ctor mat2x3() -> mat2x3 +@const("Zero") ctor mat2x4() -> mat2x4 +@const("Zero") ctor mat3x2() -> mat3x2 +@const("Zero") ctor mat3x3() -> mat3x3 +@const("Zero") ctor mat3x4() -> mat3x4 +@const("Zero") ctor mat4x2() -> mat4x2 +@const("Zero") ctor mat4x3() -> mat4x3 +@const("Zero") ctor mat4x4() -> mat4x4 + +// Identity constructors +@const("Identity") ctor i32(i32) -> i32 +@const("Identity") ctor u32(u32) -> u32 +@const("Identity") ctor f32(f32) -> f32 +@const("Identity") ctor f16(f16) -> f16 +@const("Identity") ctor bool(bool) -> bool +@const("Identity") ctor vec2(vec2) -> vec2 +@const("Identity") ctor vec3(vec3) -> vec3 +@const("Identity") ctor vec4(vec4) -> vec4 +@const("Identity") ctor mat2x2(mat2x2) -> mat2x2 +@const("Identity") ctor mat2x3(mat2x3) -> mat2x3 +@const("Identity") ctor mat2x4(mat2x4) -> mat2x4 +@const("Identity") ctor mat3x2(mat3x2) -> mat3x2 +@const("Identity") ctor mat3x3(mat3x3) -> mat3x3 +@const("Identity") ctor mat3x4(mat3x4) -> mat3x4 +@const("Identity") ctor mat4x2(mat4x2) -> mat4x2 +@const("Identity") ctor mat4x3(mat4x3) -> mat4x3 +@const("Identity") ctor mat4x4(mat4x4) -> mat4x4 + +// Vector constructors (splat) +@const("VecSplat") ctor vec2(T) -> vec2 +@const("VecSplat") ctor vec3(T) -> vec3 +@const("VecSplat") ctor vec4(T) -> vec4 + +// Vector constructors (scalar) +@const("VecCtorS") ctor vec2(x: T, y: T) -> vec2 +@const("VecCtorS") ctor vec3(x: T, y: T, z: T) -> vec3 +@const("VecCtorS") ctor vec4(x: T, y: T, z: T, w: T) -> vec4 + +// Vector constructors (mixed) +@const("VecCtorM") ctor vec3(xy: vec2, z: T) -> vec3 +@const("VecCtorM") ctor vec3(x: T, yz: vec2) -> vec3 +@const("VecCtorM") ctor vec4(xy: vec2, z: T, w: T) -> vec4 +@const("VecCtorM") ctor vec4(x: T, yz: vec2, w: T) -> vec4 +@const("VecCtorM") ctor vec4(x: T, y: T, zw: vec2) -> vec4 +@const("VecCtorM") ctor vec4(xy: vec2, zw: vec2) -> vec4 +@const("VecCtorM") ctor vec4(xyz: vec3, w: T) -> vec4 +@const("VecCtorM") ctor vec4(x: T, zyw: vec3) -> vec4 + +// Matrix constructors (scalar) +@const("MatCtorS") +ctor mat2x2(T, T, + T, T) -> mat2x2 +@const("MatCtorS") +ctor mat2x3(T, T, T, + T, T, T) -> mat2x3 +@const("MatCtorS") +ctor mat2x4(T, T, T, T, + T, T, T, T) -> mat2x4 +@const("MatCtorS") +ctor mat3x2(T, T, + T, T, + T, T) -> mat3x2 +@const("MatCtorS") +ctor mat3x3(T, T, T, + T, T, T, + T, T, T) -> mat3x3 +@const("MatCtorS") +ctor mat3x4(T, T, T, T, + T, T, T, T, + T, T, T, T) -> mat3x4 +@const("MatCtorS") +ctor mat4x2(T, T, + T, T, + T, T, + T, T) -> mat4x2 +@const("MatCtorS") +ctor mat4x3(T, T, T, + T, T, T, + T, T, T, + T, T, T) -> mat4x3 +@const("MatCtorS") +ctor mat4x4(T, T, T, T, + T, T, T, T, + T, T, T, T, + T, T, T, T) -> mat4x4 + +// Matrix constructors (column vectors) +@const("MatCtorV") +ctor mat2x2(vec2, vec2) -> mat2x2 +@const("MatCtorV") +ctor mat2x3(vec3, vec3) -> mat2x3 +@const("MatCtorV") +ctor mat2x4(vec4, vec4) -> mat2x4 +@const("MatCtorV") +ctor mat3x2(vec2, vec2, vec2) -> mat3x2 +@const("MatCtorV") +ctor mat3x3(vec3, vec3, vec3) -> mat3x3 +@const("MatCtorV") +ctor mat3x4(vec4, vec4, vec4) -> mat3x4 +@const("MatCtorV") +ctor mat4x2(vec2, vec2, vec2, vec2) -> mat4x2 +@const("MatCtorV") +ctor mat4x3(vec3, vec3, vec3, vec3) -> mat4x3 +@const("MatCtorV") +ctor mat4x4(vec4, vec4, vec4, vec4) -> mat4x4 + +//////////////////////////////////////////////////////////////////////////////// +// Type conversions // +//////////////////////////////////////////////////////////////////////////////// +@const conv f32(T) -> f32 +@const conv f16(T) -> f16 +@const conv i32(T) -> i32 +@const conv u32(T) -> u32 +@const conv bool(T) -> bool + +@const conv vec2(vec2) -> vec2 +@const conv vec2(vec2) -> vec2 +@const conv vec2(vec2) -> vec2 +@const conv vec2(vec2) -> vec2 +@const conv vec2(vec2) -> vec2 + +@const conv vec3(vec3) -> vec3 +@const conv vec3(vec3) -> vec3 +@const conv vec3(vec3) -> vec3 +@const conv vec3(vec3) -> vec3 +@const conv vec3(vec3) -> vec3 + +@const conv vec4(vec4) -> vec4 +@const conv vec4(vec4) -> vec4 +@const conv vec4(vec4) -> vec4 +@const conv vec4(vec4) -> vec4 +@const conv vec4(vec4) -> vec4 + +@const conv mat2x2(mat2x2) -> mat2x2 +@const conv mat2x2(mat2x2) -> mat2x2 +@const conv mat2x3(mat2x3) -> mat2x3 +@const conv mat2x3(mat2x3) -> mat2x3 +@const conv mat2x4(mat2x4) -> mat2x4 +@const conv mat2x4(mat2x4) -> mat2x4 +@const conv mat3x2(mat3x2) -> mat3x2 +@const conv mat3x2(mat3x2) -> mat3x2 +@const conv mat3x3(mat3x3) -> mat3x3 +@const conv mat3x3(mat3x3) -> mat3x3 +@const conv mat3x4(mat3x4) -> mat3x4 +@const conv mat3x4(mat3x4) -> mat3x4 +@const conv mat4x2(mat4x2) -> mat4x2 +@const conv mat4x2(mat4x2) -> mat4x2 +@const conv mat4x3(mat4x3) -> mat4x3 +@const conv mat4x3(mat4x3) -> mat4x3 +@const conv mat4x4(mat4x4) -> mat4x4 +@const conv mat4x4(mat4x4) -> mat4x4 + +//////////////////////////////////////////////////////////////////////////////// +// Operators // +// // +// The operator declarations below declare all the unary and binary operators // +// supported by the WGSL language (with exception for address-of and // +// dereference unary operators). // +// // +// The syntax is almost identical to builtin functions, except we use 'op' // +// instead of 'fn'. The resolving rules are identical to builtins, which is // +// described in detail above. // +// // +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +// Unary Operators // +//////////////////////////////////////////////////////////////////////////////// +op ! (bool) -> bool +op ! (vec) -> vec + +@const op ~ (T) -> T +@const op ~ (vec) -> vec + +@const("UnaryMinus") op - (T) -> T +@const("UnaryMinus") op - (vec) -> vec + +//////////////////////////////////////////////////////////////////////////////// +// Binary Operators // +//////////////////////////////////////////////////////////////////////////////// +@const op + (T, T) -> T +@const op + (vec, vec) -> vec +@const op + (vec, T) -> vec +@const op + (T, vec) -> vec +@const op + (mat, mat) -> mat + +@const op - (T, T) -> T +@const op - (vec, vec) -> vec +@const op - (vec, T) -> vec +@const op - (T, vec) -> vec +@const op - (mat, mat) -> mat + +op * (T, T) -> T +op * (vec, vec) -> vec +op * (vec, T) -> vec +op * (T, vec) -> vec +op * (T, mat) -> mat +op * (mat, T) -> mat +op * (mat, vec) -> vec +op * (vec, mat) -> vec +op * (mat, mat) -> mat + +op / (T, T) -> T +op / (vec, vec) -> vec +op / (vec, T) -> vec +op / (T, vec) -> vec + +op % (T, T) -> T +op % (vec, vec) -> vec +op % (vec, T) -> vec +op % (T, vec) -> vec + +op ^ (T, T) -> T +op ^ (vec, vec) -> vec + +op & (bool, bool) -> bool +op & (vec, vec) -> vec +op & (T, T) -> T +op & (vec, vec) -> vec + +op | (bool, bool) -> bool +op | (vec, vec) -> vec +op | (T, T) -> T +op | (vec, vec) -> vec + +op && (bool, bool) -> bool +op || (bool, bool) -> bool + +op == (T, T) -> bool +op == (vec, vec) -> vec + +op != (T, T) -> bool +op != (vec, vec) -> vec + +op < (T, T) -> bool +op < (vec, vec) -> vec + +op > (T, T) -> bool +op > (vec, vec) -> vec + +op <= (T, T) -> bool +op <= (vec, vec) -> vec + +op >= (T, T) -> bool +op >= (vec, vec) -> vec + +op << (T, u32) -> T +op << (vec, vec) -> vec + +op >> (T, u32) -> T +op >> (vec, vec) -> vec diff --git a/src/tint/number.cc b/src/tint/number.cc new file mode 100644 index 0000000000..91dbb45f83 --- /dev/null +++ b/src/tint/number.cc @@ -0,0 +1,311 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/number.h" + +#include +#include +#include +#include + +#include "src/tint/debug.h" + +namespace tint { + +std::ostream& operator<<(std::ostream& out, ConversionFailure failure) { + switch (failure) { + case ConversionFailure::kExceedsPositiveLimit: + return out << "value exceeds positive limit for type"; + case ConversionFailure::kExceedsNegativeLimit: + return out << "value exceeds negative limit for type"; + } + return out << ""; +} + +f16::type f16::Quantize(f16::type value) { + if (value > kHighestValue) { + return std::numeric_limits::infinity(); + } + if (value < kLowestValue) { + return -std::numeric_limits::infinity(); + } + // Below value must be within the finite range of a f16. + // Assert we use binary32 (i.e. float) as underlying type, which has 4 bytes. + static_assert(std::is_same()); + const uint32_t sign_mask = 0x80000000u; // Mask for the sign bit + const uint32_t exponent_mask = 0x7f800000u; // Mask for 8 exponent bits + + uint32_t u32; + memcpy(&u32, &value, 4); + + if ((u32 & ~sign_mask) == 0) { + return value; // +/- zero + } + if ((u32 & exponent_mask) == exponent_mask) { // exponent all 1's + return value; // inf or nan + } + + // We are now going to quantize a f32 number into subnormal f16 and store the result value back + // into a f32 variable. Notice that all subnormal f16 values are just normal f32 values. Below + // will show that we can do this quantization by just masking out 13 or more lowest mantissa + // bits of the original f32 number. + // + // Note: + // f32 has 1 sign bit, 8 exponent bits for biased exponent (i.e. unbiased exponent + 127), and + // 23 mantissa bits. Binary form: s_eeeeeeee_mmmmmmmmmmmmmmmmmmmmmmm + // f16 has 1 sign bit, 5 exponent bits for biased exponent (i.e. unbiased exponent + 15), and + // 10 mantissa bits. Binary form: s_eeeee_mmmmmmmmmm + // The largest finite f16 number has a biased exponent of 11110 in binary, or 30 decimal, and so + // a unbiased exponent of 30 - 15 = 15. + // The smallest finite f16 number has a biased exponent of 00001 in binary, or 1 decimal, and so + // a unbiased exponent of 1 - 15 = -14. + // + // We may follow the argument below: + // 1. All normal or subnormal f16 values, range from 0x1.p-24 to 0x1.ffcp15, are exactly + // representable by normal f32 number. + // 1.1. We can denote the set of all f32 number that are exact representation of finite f16 + // values by `R`. + // 1.2. We can do the quantization by mapping a normal f32 value v (in the f16 finite range) + // to a certain f32 number v' in the set R, which is the largest (by the meaning of absolute + // value) one among all values in R that are no larger than v. + // 2. We can decide whether a given normal f32 number v is in the set R, by looking at its + // mantissa bits and biased exponent `e`. Recall that biased exponent e is unbiased exponent + + // 127, and in the range of 1 to 254 for normal f32 number. + // 2.1. If e >= 143, i.e. abs(v) >= 2^16 > f16::kHighestValue = 0x1.ffcp15, v is larger than + // any finite f16 value and can not be in set R. 2.2. If 142 >= e >= 113, or + // f16::kHighestValue >= abs(v) >= f16::kSmallestValue = 2^-14, v falls in the range of normal + // f16 values. In this case, v is in the set R iff the lowest 13 mantissa bits are all 0. (See + // below for proof) + // 2.2.1. If we let v' be v with lowest 13 mantissa bits masked to 0, v' will be in set R + // and the largest one in set R that no larger than v. Such v' is the quantized value of v. + // 2.3. If 112 >= e >= 103, i.e. 2^-14 > abs(v) >= f16::kSmallestSubnormalValue = 2^-24, v + // falls in the range of subnormal f16 values. In this case, v is in the set R iff the lowest + // 126-e mantissa bits are all 0. Notice that 126-e is in range 14 to 23, inclusive. (See + // below for proof) + // 2.3.1. If we let v' be v with lowest 126-e mantissa bits masked to 0, v' will be in set R + // and the largest on in set R that no larger than v. Such v' is the quantized value of v. + // 2.4. If 2^-24 > abs(v) > 0, i.e. 103 > e, v is smaller than any finite f16 value and not + // equal to 0.0, thus can not be in set R. + // 2.5. If abs(v) = 0, v is in set R and is just +-0.0. + // + // Proof for 2.2: + // Any normal f16 number, in binary form, s_eeeee_mmmmmmmmmm, has value + // (s==0?1:-1)*(1+uint(mmmmm_mmmmm)*(2^-10))*2^(uint(eeeee)-15) + // in which unit(bbbbb) means interprete binary pattern "bbbbb" as unsigned binary number, + // and we have 1 <= uint(eeeee) <= 30. + // This value is equal to a normal f32 number with binary + // s_EEEEEEEE_mmmmmmmmmm0000000000000 + // where uint(EEEEEEEE) = uint(eeeee) + 112, so that unbiased exponent keep unchanged + // uint(EEEEEEEE) - 127 = uint(eeeee) - 15 + // and its value is + // (s==0?1:-1)*(1+uint(mmmmm_mmmmm_00000_00000_000)*(2^-23))*2^(uint(EEEEEEEE)-127) + // == (s==0?1:-1)*(1+uint(mmmmm_mmmmm)*(2^-10))*2^(uint(eeeee)-15) + // Notice that uint(EEEEEEEE) is in range [113, 142], showing that it is a normal f32 number. + // So we proof that any normal f16 number can be exactly representd by a normal f32 number + // with biased exponent in range [113,142] and the lowest 13 mantissa bits 0. + // On the other hand, since mantissa bits mmmmmmmmmm are arbitrary, the value of any f32 + // that has a biased exponent in range [113, 142] and lowest 13 mantissa bits zero is equal + // to a normal f16 value. Hence we proof 2.2. + // + // Proof for 2.3: + // Any subnormal f16 number has a binary form of s_00000_mmmmmmmmmm, and its value is + // (s==0?1:-1)*uint(mmmmmmmmmm)*(2^-10)*(2^-14) = (s==0?1:-1)*uint(mmmmmmmmmm)*(2^-24). + // We discuss on bit pattern of mantissa bits mmmmmmmmmm. + // Case 1: mantissa bits has no leading zero bit, s_00000_1mmmmmmmmm + // In this case the value is + // (s==0?1:-1)*uint(1mmmm_mmmmm)*(2^-10)*(2^-14) + // == (s==0?1:-1)*(uint(1_mmmmm_mmmm)*(2^-9))*(2^-15) + // == (s==0?1:-1)*(1+uint(mmmmm_mmmm)*(2^-9))*(2^-15) + // == (s==0?1:-1)*(1+uint(mmmmm_mmmm0_00000_00000_000)*(2^-23))*(2^-15) + // which is equal to the value of normal f32 number + // s_EEEEEEEE_mmmmm_mmmm0_00000_00000_000 + // where uint(EEEEEEEE) = -15 + 127 = 112. Hence we proof that any subnormal f16 number + // with no leading zero mantissa bit can be exactly represented by a f32 number with + // biased exponent 112 and the lowest 14 mantissa bits zero, and the value of any f32 + // number with biased exponent 112 and the lowest 14 mantissa bits zero are equal to a + // subnormal f16 number with no leading zero mantissa bit. + // Case 2: mantissa bits has 1 leading zero bit, s_00000_01mmmmmmmm + // In this case the value is + // (s==0?1:-1)*uint(01mmm_mmmmm)*(2^-10)*(2^-14) + // == (s==0?1:-1)*(uint(01_mmmmm_mmm)*(2^-8))*(2^-16) + // == (s==0?1:-1)*(1+uint(mmmmm_mmm)*(2^-8))*(2^-16) + // == (s==0?1:-1)*(1+uint(mmmmm_mmm00_00000_00000_000)*(2^-23))*(2^-16) + // which is equal to the value of normal f32 number + // s_EEEEEEEE_mmmmm_mmm00_00000_00000_000 + // where uint(EEEEEEEE) = -16 + 127 = 111. Hence we proof that any subnormal f16 number + // with 1 leading zero mantissa bit can be exactly represented by a f32 number with + // biased exponent 111 and the lowest 15 mantissa bits zero, and the value of any f32 + // number with biased exponent 111 and the lowest 15 mantissa bits zero are equal to a + // subnormal f16 number with 1 leading zero mantissa bit. + // Case 3 to case 8: ...... + // Case 9: mantissa bits has 8 leading zero bit, s_00000_000000001m + // In this case the value is + // (s==0?1:-1)*uint(00000_0001m)*(2^-10)*(2^-14) + // == (s==0?1:-1)*(uint(000000001_m)*(2^-1))*(2^-23) + // == (s==0?1:-1)*(1+uint(m)*(2^-1))*(2^-23) + // == (s==0?1:-1)*(1+uint(m0000_00000_00000_00000_000)*(2^-23))*(2^-23) + // which is equal to the value of normal f32 number + // s_EEEEEEEE_m0000_00000_00000_00000_000 + // where uint(EEEEEEEE) = -23 + 127 = 104. Hence we proof that any subnormal f16 number + // with 8 leading zero mantissa bit can be exactly represented by a f32 number with + // biased exponent 104 and the lowest 22 mantissa bits zero, and the value of any f32 + // number with biased exponent 104 and the lowest 22 mantissa bits zero are equal to a + // subnormal f16 number with 8 leading zero mantissa bit. + // Case 10: mantissa bits has 9 leading zero bit, s_00000_0000000001 + // In this case the value is just +-2^-24 = +-0x1.0p-24, + // the f32 number has biased exponent 103 and all 23 mantissa bits zero. + // Case 11: mantissa bits has 10 leading zero bit, s_00000_0000000000, just 0.0 + // Concluding all these case, we proof that any subnormal f16 number with N leading zero + // mantissa bit can be exactly represented by a f32 number with biased exponent 112-N and the + // lowest 14+N mantissa bits zero, and the value of any f32 number with biased exponent 112-N (= + // e) and the lowest 14+N (= 126-e) mantissa bits zero are equal to a subnormal f16 number with + // N leading zero mantissa bit. N is in range [0, 9], so the f32 number's biased exponent e is + // in range [103, 112], or unbiased exponent in [-24, -15]. + + float abs_value = std::fabs(value); + if (abs_value >= kSmallestValue) { + // Value falls in the normal f16 range, quantize it to a normal f16 value by masking out + // lowest 13 mantissa bits. + u32 = u32 & ~((1u << 13) - 1); + } else if (abs_value >= kSmallestSubnormalValue) { + // Value should be quantized to a subnormal f16 value. + + // Get the biased exponent `e` of f32 value, e.g. value 127 representing exponent 2^0. + uint32_t biased_exponent_original = (u32 & exponent_mask) >> 23; + // Since we ensure that kSmallestValue = 0x1f-14 > abs(value) >= kSmallestSubnormalValue = + // 0x1f-24, value will have a unbiased exponent in range -24 to -15 (inclusive), and the + // corresponding biased exponent in f32 is in range 103 to 112 (inclusive). + TINT_ASSERT(Semantic, + (103 <= biased_exponent_original) && (biased_exponent_original <= 112)); + + // As we have proved, masking out the lowest 126-e mantissa bits of input value will result + // in a valid subnormal f16 value, which is exactly the required quantization result. + uint32_t discard_bits = 126 - biased_exponent_original; // In range 14 to 23 (inclusive) + TINT_ASSERT(Semantic, (14 <= discard_bits) && (discard_bits <= 23)); + uint32_t discard_mask = (1u << discard_bits) - 1; + u32 = u32 & ~discard_mask; + } else { + // value is too small that it can't even be represented as subnormal f16 number. Quantize + // to zero. + return value > 0 ? 0.0 : -0.0; + } + memcpy(&value, &u32, 4); + return value; +} + +uint16_t f16::BitsRepresentation() const { + constexpr uint16_t f16_nan = 0x7e00u; + constexpr uint16_t f16_pos_inf = 0x7c00u; + constexpr uint16_t f16_neg_inf = 0xfc00u; + + // Assert we use binary32 (i.e. float) as underlying type, which has 4 bytes. + static_assert(std::is_same()); + + // The stored value in f16 object must be already quantized, so it should be either NaN, +/- + // Inf, or exactly representable by normal or subnormal f16. + + if (std::isnan(value)) { + return f16_nan; + } + + if (std::isinf(value)) { + return value > 0 ? f16_pos_inf : f16_neg_inf; + } + + // Now quantized_value must be a finite f16 exactly-representable value. + // The following table shows exponent cases for all finite f16 exactly-representable value. + // --------------------------------------------------------------------------- + // | Value category | Unbiased exp | F16 biased exp | F32 biased exp | + // |------------------|----------------|------------------|------------------| + // | +/- zero | \ | 0 | 0 | + // | Subnormal f16 | [-24, -15] | 0 | [103, 112] | + // | Normal f16 | [-14, 15] | [1, 30] | [113, 142] | + // --------------------------------------------------------------------------- + + constexpr uint32_t max_f32_biased_exp_for_f16_normal_number = 142; + constexpr uint32_t min_f32_biased_exp_for_f16_normal_number = 113; + constexpr uint32_t max_f32_biased_exp_for_f16_subnormal_number = 112; + constexpr uint32_t min_f32_biased_exp_for_f16_subnormal_number = 103; + + constexpr uint32_t f32_sign_mask = 0x80000000u; + constexpr uint32_t f32_exp_mask = 0x7f800000u; + constexpr uint32_t f32_mantissa_mask = 0x007fffffu; + constexpr uint32_t f32_mantissa_bis_number = 23; + constexpr uint32_t f32_exp_bias = 127; + + constexpr uint16_t f16_sign_mask = 0x8000u; + constexpr uint16_t f16_exp_mask = 0x7c00u; + constexpr uint16_t f16_mantissa_mask = 0x03ffu; + constexpr uint32_t f16_mantissa_bis_number = 10; + constexpr uint32_t f16_exp_bias = 15; + + uint32_t f32_bit_pattern; + memcpy(&f32_bit_pattern, &value, 4); + uint32_t f32_biased_exponent = (f32_bit_pattern & f32_exp_mask) >> f32_mantissa_bis_number; + uint32_t f32_mantissa = f32_bit_pattern & f32_mantissa_mask; + + uint16_t f16_sign_part = static_cast((f32_bit_pattern & f32_sign_mask) >> 16); + TINT_ASSERT(Semantic, (f16_sign_part & ~f16_sign_mask) == 0); + + if ((f32_bit_pattern & ~f32_sign_mask) == 0) { + // +/- zero + return f16_sign_part; + } + + if ((min_f32_biased_exp_for_f16_normal_number <= f32_biased_exponent) && + (f32_biased_exponent <= max_f32_biased_exp_for_f16_normal_number)) { + // Normal f16 + uint32_t f16_biased_exponent = f32_biased_exponent - f32_exp_bias + f16_exp_bias; + uint16_t f16_exp_part = + static_cast(f16_biased_exponent << f16_mantissa_bis_number); + uint16_t f16_mantissa_part = static_cast( + f32_mantissa >> (f32_mantissa_bis_number - f16_mantissa_bis_number)); + + TINT_ASSERT(Semantic, (f16_exp_part & ~f16_exp_mask) == 0); + TINT_ASSERT(Semantic, (f16_mantissa_part & ~f16_mantissa_mask) == 0); + + return f16_sign_part | f16_exp_part | f16_mantissa_part; + } + + if ((min_f32_biased_exp_for_f16_subnormal_number <= f32_biased_exponent) && + (f32_biased_exponent <= max_f32_biased_exp_for_f16_subnormal_number)) { + // Subnormal f16 + // The resulting exp bits are always 0, and the mantissa bits should be handled specially. + uint16_t f16_exp_part = 0; + // The resulting subnormal f16 will have only 1 valid mantissa bit if the unbiased exponent + // of value is of the minimum, i.e. -24; and have all 10 mantissa bits valid if the unbiased + // exponent of value is of the maximum, i.e. -15. + uint32_t f16_valid_mantissa_bits = + f32_biased_exponent - min_f32_biased_exp_for_f16_subnormal_number + 1; + // The resulting f16 mantissa part comes from right-shifting the f32 mantissa bits with + // leading 1 added. + uint16_t f16_mantissa_part = + static_cast((f32_mantissa | (f32_mantissa_mask + 1)) >> + (f32_mantissa_bis_number + 1 - f16_valid_mantissa_bits)); + + TINT_ASSERT(Semantic, (1 <= f16_valid_mantissa_bits) && + (f16_valid_mantissa_bits <= f16_mantissa_bis_number)); + TINT_ASSERT(Semantic, (f16_mantissa_part & ~((1u << f16_valid_mantissa_bits) - 1)) == 0); + TINT_ASSERT(Semantic, (f16_mantissa_part != 0)); + + return f16_sign_part | f16_exp_part | f16_mantissa_part; + } + + // Neither zero, subnormal f16 or normal f16, shall never hit. + tint::diag::List diag; + TINT_UNREACHABLE(Semantic, diag); + return f16_nan; +} + +} // namespace tint diff --git a/src/tint/number.h b/src/tint/number.h index a2508b35e5..a36ccfbab0 100644 --- a/src/tint/number.h +++ b/src/tint/number.h @@ -16,23 +16,122 @@ #define SRC_TINT_NUMBER_H_ #include +#include +#include +#include +#include +#include + +#include "src/tint/utils/compiler_macros.h" +#include "src/tint/utils/result.h" + +// Forward declaration +namespace tint { +/// Number wraps a integer or floating point number, enforcing explicit casting. +template +struct Number; +} // namespace tint + +namespace tint::detail { +/// An empty structure used as a unique template type for Number when +/// specializing for the f16 type. +struct NumberKindF16 {}; + +/// Helper for obtaining the underlying type for a Number. +template +struct NumberUnwrapper { + /// When T is not a Number, then type defined to be T. + using type = T; +}; + +/// NumberUnwrapper specialization for Number. +template +struct NumberUnwrapper> { + /// The Number's underlying type. + using type = typename Number::type; +}; + +} // namespace tint::detail namespace tint { +/// Evaluates to true iff T is a floating-point type or is NumberKindF16. +template +constexpr bool IsFloatingPoint = + std::is_floating_point_v || std::is_same_v; + +/// Evaluates to true iff T is an integer type. +template +constexpr bool IsInteger = std::is_integral_v; + +/// Evaluates to true iff T is an integer type, floating-point type or is NumberKindF16. +template +constexpr bool IsNumeric = IsInteger || IsFloatingPoint; + +/// Resolves to the underlying type for a Number. +template +using UnwrapNumber = typename detail::NumberUnwrapper::type; + +/// NumberBase is a CRTP base class for Number +template +struct NumberBase { + /// @returns value of type `Number` with the highest value for that type. + static NumberT Highest() { return NumberT(NumberT::kHighestValue); } + /// @returns value of type `Number` with the lowest value for that type. + static NumberT Lowest() { return NumberT(NumberT::kLowestValue); } + /// @returns value of type `Number` with the smallest value for that type. + static NumberT Smallest() { return NumberT(NumberT::kSmallestValue); } + /// @returns value of type `Number` that represents NaN for that type. + static NumberT NaN() { + return NumberT(std::numeric_limits>::quiet_NaN()); + } + /// @returns value of type `Number` that represents infinity for that type. + static NumberT Inf() { return NumberT(std::numeric_limits>::infinity()); } +}; + /// Number wraps a integer or floating point number, enforcing explicit casting. template -struct Number { +struct Number : NumberBase> { + static_assert(IsNumeric, "Number constructed with non-numeric type"); + + /// type is the underlying type of the Number + using type = T; + + /// Highest finite representable value of this type. + static constexpr type kHighestValue = std::numeric_limits::max(); + + /// Lowest finite representable value of this type. + static constexpr type kLowestValue = std::numeric_limits::lowest(); + + /// Smallest positive normal value of this type. + static constexpr type kSmallestValue = + std::is_integral_v ? 0 : std::numeric_limits::min(); + + /// Smallest positive subnormal value of this type, 0 for integral type. + static constexpr type kSmallestSubnormalValue = + std::is_integral_v ? 0 : std::numeric_limits::denorm_min(); + /// Constructor. The value is zero-initialized. Number() = default; /// Constructor. /// @param v the value to initialize this Number to - explicit Number(T v) : value(v) {} + template + explicit Number(U v) : value(static_cast(v)) {} + + /// Constructor. + /// @param v the value to initialize this Number to + template + explicit Number(Number v) : value(static_cast(v.value)) {} /// Conversion operator /// @returns the value as T operator T() const { return value; } + /// Negation operator + /// @returns the negative value of the number + Number operator-() const { return Number(-value); } + /// Assignment operator /// @param v the new value /// @returns this Number so calls can be chained @@ -42,53 +141,358 @@ struct Number { } /// The number value - T value = {}; + type value = {}; }; -template -bool operator==(Number a, Number b) { - return a.value == b.value; +/// Writes the number to the ostream. +/// @param out the std::ostream to write to +/// @param num the Number +/// @return the std::ostream so calls can be chained +template +inline std::ostream& operator<<(std::ostream& out, Number num) { + return out << num.value; } -template -bool operator==(Number a, B b) { - return a.value == b; -} +/// The partial specification of Number for f16 type, storing the f16 value as float, +/// and enforcing proper explicit casting. +template <> +struct Number : NumberBase> { + /// C++ does not have a native float16 type, so we use a 32-bit float instead. + using type = float; -template -bool operator==(A a, Number b) { - return a == b.value; -} + /// Highest finite representable value of this type. + static constexpr type kHighestValue = 65504.0f; // 2¹⁵ × (1 + 1023/1024) + + /// Lowest finite representable value of this type. + static constexpr type kLowestValue = -65504.0f; + + /// Smallest positive normal value of this type. + /// binary16 0_00001_0000000000, value is 2⁻¹⁴. + static constexpr type kSmallestValue = 0x1p-14f; + + /// Smallest positive subnormal value of this type. + /// binary16 0_00000_0000000001, value is 2⁻¹⁴ * 2⁻¹⁰ = 2⁻²⁴. + static constexpr type kSmallestSubnormalValue = 0x1p-24f; + + /// Constructor. The value is zero-initialized. + Number() = default; + + /// Constructor. + /// @param v the value to initialize this Number to + template + explicit Number(U v) : value(Quantize(static_cast(v))) {} + + /// Constructor. + /// @param v the value to initialize this Number to + template + explicit Number(Number v) : value(Quantize(static_cast(v.value))) {} + + /// Conversion operator + /// @returns the value as the internal representation type of F16 + operator float() const { return value; } + + /// Negation operator + /// @returns the negative value of the number + Number operator-() const { return Number(-value); } + + /// Assignment operator with parameter as native floating point type + /// @param v the new value + /// @returns this Number so calls can be chained + Number& operator=(type v) { + value = Quantize(v); + return *this; + } + + /// Get the binary16 bit pattern in type uint16_t of this value. + /// @returns the binary16 bit pattern, in type uint16_t, of the stored quantized f16 value. If + /// the value is NaN, the returned value will be 0x7e00u. If the value is positive infinity, the + /// returned value will be 0x7c00u. If the input value is negative infinity, the returned value + /// will be 0xfc00u. + uint16_t BitsRepresentation() const; + + /// @param value the input float32 value + /// @returns the float32 value quantized to the smaller float16 value, through truncation of the + /// mantissa bits (no rounding). If the float32 value is too large (positive or negative) to be + /// represented by a float16 value, then the returned value will be positive or negative + /// infinity. + static type Quantize(type value); + + /// The number value, stored as float + type value = {}; +}; + +/// `AInt` is a type alias to `Number`. +using AInt = Number; +/// `AFloat` is a type alias to `Number`. +using AFloat = Number; /// `i32` is a type alias to `Number`. using i32 = Number; /// `u32` is a type alias to `Number`. using u32 = Number; -/// `f32` is a type alias to `float` -using f32 = float; +/// `f32` is a type alias to `Number` +using f32 = Number; +/// `f16` is a type alias to `Number`, which should be IEEE 754 binary16. +/// However since C++ don't have native binary16 type, the value is stored as float. +using f16 = Number; + +/// Enumerator of failure reasons when converting from one number to another. +enum class ConversionFailure { + kExceedsPositiveLimit, // The value was too big (+'ve) to fit in the target type + kExceedsNegativeLimit, // The value was too big (-'ve) to fit in the target type +}; + +/// Writes the conversion failure message to the ostream. +/// @param out the std::ostream to write to +/// @param failure the ConversionFailure +/// @return the std::ostream so calls can be chained +std::ostream& operator<<(std::ostream& out, ConversionFailure failure); + +/// Converts a number from one type to another, checking that the value fits in the target type. +/// @returns the resulting value of the conversion, or a failure reason. +template +utils::Result CheckedConvert(Number num) { + // Use the highest-precision integer or floating-point type to perform the comparisons. + using T = std::conditional_t> || IsFloatingPoint, + AFloat::type, AInt::type>; + const auto value = static_cast(num.value); + if (value > static_cast(TO::kHighestValue)) { + return ConversionFailure::kExceedsPositiveLimit; + } + if (value < static_cast(TO::kLowestValue)) { + return ConversionFailure::kExceedsNegativeLimit; + } + return TO(value); // Success +} + +/// Equality operator. +/// @param a the LHS number +/// @param b the RHS number +/// @returns true if the numbers `a` and `b` are exactly equal. Also considers sign bit. +template +bool operator==(Number a, Number b) { + // Use the highest-precision integer or floating-point type to perform the comparisons. + using T = + std::conditional_t || IsFloatingPoint, AFloat::type, AInt::type>; + auto va = static_cast(a.value); + auto vb = static_cast(b.value); + if constexpr (IsFloatingPoint) { + if (std::signbit(va) != std::signbit(vb)) { + return false; + } + } + return std::equal_to()(va, vb); +} + +/// Inequality operator. +/// @param a the LHS number +/// @param b the RHS number +/// @returns true if the numbers `a` and `b` are exactly unequal. Also considers sign bit. +template +bool operator!=(Number a, Number b) { + return !(a == b); +} + +/// Equality operator. +/// @param a the LHS number +/// @param b the RHS number +/// @returns true if the numbers `a` and `b` are exactly equal. +template +std::enable_if_t, bool> operator==(Number a, B b) { + return a == Number(b); +} + +/// Inequality operator. +/// @param a the LHS number +/// @param b the RHS number +/// @returns true if the numbers `a` and `b` are exactly unequal. +template +std::enable_if_t, bool> operator!=(Number a, B b) { + return !(a == b); +} + +/// Equality operator. +/// @param a the LHS number +/// @param b the RHS number +/// @returns true if the numbers `a` and `b` are exactly equal. +template +std::enable_if_t, bool> operator==(A a, Number b) { + return Number(a) == b; +} + +/// Inequality operator. +/// @param a the LHS number +/// @param b the RHS number +/// @returns true if the numbers `a` and `b` are exactly unequal. +template +std::enable_if_t, bool> operator!=(A a, Number b) { + return !(a == b); +} + +/// Define 'TINT_HAS_OVERFLOW_BUILTINS' if the compiler provide overflow checking builtins. +/// If the compiler does not support these builtins, then these are emulated with algorithms +/// described in: +/// https://wiki.sei.cmu.edu/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow +#if defined(__GNUC__) && __GNUC__ >= 5 +#define TINT_HAS_OVERFLOW_BUILTINS +#elif defined(__clang__) +#if __has_builtin(__builtin_add_overflow) && __has_builtin(__builtin_mul_overflow) +#define TINT_HAS_OVERFLOW_BUILTINS +#endif +#endif + +/// @returns a + b, or an empty optional if the resulting value overflowed the AInt +inline std::optional CheckedAdd(AInt a, AInt b) { + int64_t result; +#ifdef TINT_HAS_OVERFLOW_BUILTINS + if (__builtin_add_overflow(a.value, b.value, &result)) { + return {}; + } +#else // TINT_HAS_OVERFLOW_BUILTINS + if (a.value >= 0) { + if (b.value > AInt::kHighestValue - a.value) { + return {}; + } + } else { + if (b.value < AInt::kLowestValue - a.value) { + return {}; + } + } + result = a.value + b.value; +#endif // TINT_HAS_OVERFLOW_BUILTINS + return AInt(result); +} + +/// @returns a + b, or an empty optional if the resulting value overflowed the AFloat +inline std::optional CheckedAdd(AFloat a, AFloat b) { + auto result = a.value + b.value; + if (!std::isfinite(result)) { + return {}; + } + return AFloat{result}; +} + +/// @returns a - b, or an empty optional if the resulting value overflowed the AInt +inline std::optional CheckedSub(AInt a, AInt b) { + int64_t result; +#ifdef TINT_HAS_OVERFLOW_BUILTINS + if (__builtin_sub_overflow(a.value, b.value, &result)) { + return {}; + } +#else // TINT_HAS_OVERFLOW_BUILTINS + if (b.value >= 0) { + if (a.value < AInt::kLowestValue + b.value) { + return {}; + } + } else { + if (a.value > AInt::kHighestValue + b.value) { + return {}; + } + } + result = a.value - b.value; +#endif // TINT_HAS_OVERFLOW_BUILTINS + return AInt(result); +} + +/// @returns a + b, or an empty optional if the resulting value overflowed the AFloat +inline std::optional CheckedSub(AFloat a, AFloat b) { + auto result = a.value - b.value; + if (!std::isfinite(result)) { + return {}; + } + return AFloat{result}; +} + +/// @returns a * b, or an empty optional if the resulting value overflowed the AInt +inline std::optional CheckedMul(AInt a, AInt b) { + int64_t result; +#ifdef TINT_HAS_OVERFLOW_BUILTINS + if (__builtin_mul_overflow(a.value, b.value, &result)) { + return {}; + } +#else // TINT_HAS_OVERFLOW_BUILTINS + if (a > 0) { + if (b > 0) { + if (a > (AInt::kHighestValue / b)) { + return {}; + } + } else { + if (b < (AInt::kLowestValue / a)) { + return {}; + } + } + } else { + if (b > 0) { + if (a < (AInt::kLowestValue / b)) { + return {}; + } + } else { + if ((a != 0) && (b < (AInt::kHighestValue / a))) { + return {}; + } + } + } + result = a.value * b.value; +#endif // TINT_HAS_OVERFLOW_BUILTINS + return AInt(result); +} + +/// @returns a * b + c, or an empty optional if the value overflowed the AInt +inline std::optional CheckedMadd(AInt a, AInt b, AInt c) { + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 + TINT_BEGIN_DISABLE_WARNING(MAYBE_UNINITIALIZED); + + if (auto mul = CheckedMul(a, b)) { + return CheckedAdd(mul.value(), c); + } + return {}; + + TINT_END_DISABLE_WARNING(MAYBE_UNINITIALIZED); +} } // namespace tint namespace tint::number_suffixes { -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-identifier" -#endif +/// Literal suffix for abstract integer literals +inline AInt operator""_a(unsigned long long int value) { // NOLINT + return AInt(static_cast(value)); +} + +/// Literal suffix for abstract float literals +inline AFloat operator""_a(long double value) { // NOLINT + return AFloat(static_cast(value)); +} /// Literal suffix for i32 literals -inline i32 operator"" _i(unsigned long long int value) { // NOLINT +inline i32 operator""_i(unsigned long long int value) { // NOLINT return i32(static_cast(value)); } /// Literal suffix for u32 literals -inline u32 operator"" _u(unsigned long long int value) { // NOLINT +inline u32 operator""_u(unsigned long long int value) { // NOLINT return u32(static_cast(value)); } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif +/// Literal suffix for f32 literals +inline f32 operator""_f(long double value) { // NOLINT + return f32(static_cast(value)); +} + +/// Literal suffix for f32 literals +inline f32 operator""_f(unsigned long long int value) { // NOLINT + return f32(static_cast(value)); +} + +/// Literal suffix for f16 literals +inline f16 operator""_h(long double value) { // NOLINT + return f16(static_cast(value)); +} + +/// Literal suffix for f16 literals +inline f16 operator""_h(unsigned long long int value) { // NOLINT + return f16(static_cast(value)); +} } // namespace tint::number_suffixes diff --git a/src/tint/number_test.cc b/src/tint/number_test.cc new file mode 100644 index 0000000000..3182ad353b --- /dev/null +++ b/src/tint/number_test.cc @@ -0,0 +1,614 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include + +#include "src/tint/program_builder.h" +#include "src/tint/utils/compiler_macros.h" + +#include "gtest/gtest.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint { +namespace { + +// Next ULP up from kHighestF32 for a float64. +constexpr double kHighestF32NextULP = 0x1.fffffe0000001p+127; + +// Highest subnormal value for a float32. +constexpr double kHighestF32Subnormal = 0x0.fffffep-126; + +// Next ULP up from kHighestF16 for a float64. +constexpr double kHighestF16NextULP = 0x1.ffc0000000001p+15; + +// Highest subnormal value for a float16. +constexpr double kHighestF16Subnormal = 0x0.ffcp-14; + +constexpr double kLowestF32NextULP = -kHighestF32NextULP; +constexpr double kLowestF16NextULP = -kHighestF16NextULP; + +// MSVC (only in release builds) can grumble about some of the inlined numerical overflow / +// underflow that's done in this file. We like to think we know what we're doing, so silence the +// warning. +TINT_BEGIN_DISABLE_WARNING(CONSTANT_OVERFLOW); + +TEST(NumberTest, Equality) { + EXPECT_TRUE(0_a == 0_a); + EXPECT_TRUE(10_a == 10_a); + EXPECT_TRUE(-10_a == -10_a); + + EXPECT_TRUE(0_i == 0_i); + EXPECT_TRUE(10_i == 10_i); + EXPECT_TRUE(-10_i == -10_i); + + EXPECT_TRUE(0_u == 0_u); + EXPECT_TRUE(10_u == 10_u); + + EXPECT_TRUE(0._a == 0._a); + EXPECT_TRUE(-0._a == -0._a); + EXPECT_TRUE(10._a == 10._a); + EXPECT_TRUE(-10._a == -10._a); + + EXPECT_TRUE(0_f == 0_f); + EXPECT_TRUE(-0_f == -0_f); + EXPECT_TRUE(10_f == 10_f); + EXPECT_TRUE(-10_f == -10_f); + + EXPECT_TRUE(0_h == 0_h); + EXPECT_TRUE(-0_h == -0_h); + EXPECT_TRUE(10_h == 10_h); + EXPECT_TRUE(-10_h == -10_h); +} + +TEST(NumberTest, Inequality) { + EXPECT_TRUE(0_a != 1_a); + EXPECT_TRUE(10_a != 11_a); + EXPECT_TRUE(11_a != 10_a); + EXPECT_TRUE(-10_a != -11_a); + EXPECT_TRUE(-11_a != -10_a); + + EXPECT_TRUE(0_i != 1_i); + EXPECT_TRUE(1_i != 0_i); + EXPECT_TRUE(10_i != 11_i); + EXPECT_TRUE(11_i != 10_i); + EXPECT_TRUE(-10_i != -11_i); + EXPECT_TRUE(-11_i != -10_i); + + EXPECT_TRUE(0_u != 1_u); + EXPECT_TRUE(1_u != 0_u); + EXPECT_TRUE(10_u != 11_u); + EXPECT_TRUE(11_u != 10_u); + + EXPECT_TRUE(0._a != -0._a); + EXPECT_TRUE(-0._a != 0._a); + EXPECT_TRUE(10._a != 11._a); + EXPECT_TRUE(11._a != 10._a); + EXPECT_TRUE(-10._a != -11._a); + EXPECT_TRUE(-11._a != -10._a); + + EXPECT_TRUE(0_f != -0_f); + EXPECT_TRUE(-0_f != 0_f); + EXPECT_TRUE(-0_f != -1_f); + EXPECT_TRUE(-1_f != -0_f); + EXPECT_TRUE(10_f != -10_f); + EXPECT_TRUE(-10_f != 10_f); + EXPECT_TRUE(10_f != 11_f); + EXPECT_TRUE(-10_f != -11_f); + + EXPECT_TRUE(0_h != -0_h); + EXPECT_TRUE(-0_h != 0_h); + EXPECT_TRUE(-0_h != -1_h); + EXPECT_TRUE(-1_h != -0_h); + EXPECT_TRUE(10_h != -10_h); + EXPECT_TRUE(-10_h != 10_h); + EXPECT_TRUE(10_h != 11_h); + EXPECT_TRUE(-10_h != -11_h); +} + +TEST(NumberTest, CheckedConvertIdentity) { + EXPECT_EQ(CheckedConvert(0_a), 0_a); + EXPECT_EQ(CheckedConvert(0_a), 0.0_a); + EXPECT_EQ(CheckedConvert(0_i), 0_i); + EXPECT_EQ(CheckedConvert(0_u), 0_u); + EXPECT_EQ(CheckedConvert(0_f), 0_f); + EXPECT_EQ(CheckedConvert(0_h), 0_h); + + EXPECT_EQ(CheckedConvert(1_a), 1_a); + EXPECT_EQ(CheckedConvert(1_a), 1.0_a); + EXPECT_EQ(CheckedConvert(1_i), 1_i); + EXPECT_EQ(CheckedConvert(1_u), 1_u); + EXPECT_EQ(CheckedConvert(1_f), 1_f); + EXPECT_EQ(CheckedConvert(1_h), 1_h); +} + +TEST(NumberTest, CheckedConvertLargestValue) { + EXPECT_EQ(CheckedConvert(AInt(i32::Highest())), i32::Highest()); + EXPECT_EQ(CheckedConvert(AInt(u32::Highest())), u32::Highest()); + EXPECT_EQ(CheckedConvert(i32::Highest()), u32(i32::Highest())); + EXPECT_EQ(CheckedConvert(AFloat(f32::Highest())), f32::Highest()); + EXPECT_EQ(CheckedConvert(AFloat(f16::Highest())), f16::Highest()); +} + +TEST(NumberTest, CheckedConvertLowestValue) { + EXPECT_EQ(CheckedConvert(AInt(i32::Lowest())), i32::Lowest()); + EXPECT_EQ(CheckedConvert(AInt(u32::Lowest())), u32::Lowest()); + EXPECT_EQ(CheckedConvert(AFloat(f32::Lowest())), f32::Lowest()); + EXPECT_EQ(CheckedConvert(AFloat(f16::Lowest())), f16::Lowest()); +} + +TEST(NumberTest, CheckedConvertSmallestValue) { + EXPECT_EQ(CheckedConvert(AInt(0)), i32(0)); + EXPECT_EQ(CheckedConvert(AInt(0)), u32(0)); + EXPECT_EQ(CheckedConvert(AFloat(f32::Smallest())), f32::Smallest()); + EXPECT_EQ(CheckedConvert(AFloat(f16::Smallest())), f16::Smallest()); +} + +TEST(NumberTest, CheckedConvertExceedsPositiveLimit) { + EXPECT_EQ(CheckedConvert(AInt(static_cast(i32::Highest()) + 1)), + ConversionFailure::kExceedsPositiveLimit); + EXPECT_EQ(CheckedConvert(AInt(static_cast(u32::Highest()) + 1)), + ConversionFailure::kExceedsPositiveLimit); + EXPECT_EQ(CheckedConvert(u32::Highest()), ConversionFailure::kExceedsPositiveLimit); + EXPECT_EQ(CheckedConvert(u32(0x80000000)), ConversionFailure::kExceedsPositiveLimit); + EXPECT_EQ(CheckedConvert(f32::Highest()), ConversionFailure::kExceedsPositiveLimit); + EXPECT_EQ(CheckedConvert(f32::Highest()), ConversionFailure::kExceedsPositiveLimit); + EXPECT_EQ(CheckedConvert(AFloat::Highest()), ConversionFailure::kExceedsPositiveLimit); + EXPECT_EQ(CheckedConvert(AFloat::Highest()), ConversionFailure::kExceedsPositiveLimit); + EXPECT_EQ(CheckedConvert(AFloat(kHighestF32NextULP)), + ConversionFailure::kExceedsPositiveLimit); + EXPECT_EQ(CheckedConvert(AFloat(kHighestF16NextULP)), + ConversionFailure::kExceedsPositiveLimit); +} + +TEST(NumberTest, CheckedConvertExceedsNegativeLimit) { + EXPECT_EQ(CheckedConvert(AInt(static_cast(i32::Lowest()) - 1)), + ConversionFailure::kExceedsNegativeLimit); + EXPECT_EQ(CheckedConvert(AInt(static_cast(u32::Lowest()) - 1)), + ConversionFailure::kExceedsNegativeLimit); + EXPECT_EQ(CheckedConvert(i32(-1)), ConversionFailure::kExceedsNegativeLimit); + EXPECT_EQ(CheckedConvert(i32::Lowest()), ConversionFailure::kExceedsNegativeLimit); + EXPECT_EQ(CheckedConvert(f32::Lowest()), ConversionFailure::kExceedsNegativeLimit); + EXPECT_EQ(CheckedConvert(f32::Lowest()), ConversionFailure::kExceedsNegativeLimit); + EXPECT_EQ(CheckedConvert(AFloat::Lowest()), ConversionFailure::kExceedsNegativeLimit); + EXPECT_EQ(CheckedConvert(AFloat::Lowest()), ConversionFailure::kExceedsNegativeLimit); + EXPECT_EQ(CheckedConvert(AFloat(kLowestF32NextULP)), + ConversionFailure::kExceedsNegativeLimit); + EXPECT_EQ(CheckedConvert(AFloat(kLowestF16NextULP)), + ConversionFailure::kExceedsNegativeLimit); +} + +TEST(NumberTest, CheckedConvertSubnormals) { + EXPECT_EQ(CheckedConvert(AFloat(kHighestF32Subnormal)), f32(kHighestF32Subnormal)); + EXPECT_EQ(CheckedConvert(AFloat(kHighestF16Subnormal)), f16(kHighestF16Subnormal)); + EXPECT_EQ(CheckedConvert(AFloat(-kHighestF32Subnormal)), f32(-kHighestF32Subnormal)); + EXPECT_EQ(CheckedConvert(AFloat(-kHighestF16Subnormal)), f16(-kHighestF16Subnormal)); +} + +// Test cases for f16 subnormal quantization and BitsRepresentation. +// The ULP is based on float rather than double or f16, since F16::Quantize and +// F16::BitsRepresentation take float as input. +constexpr float lowestPositiveNormalF16 = 0x1p-14; +constexpr float lowestPositiveNormalF16PlusULP = 0x1.000002p-14; +constexpr float lowestPositiveNormalF16MinusULP = 0x1.fffffep-15; +constexpr float highestPositiveSubnormalF16 = 0x0.ffcp-14; +constexpr float highestPositiveSubnormalF16PlusULP = 0x1.ff8002p-15; +constexpr float highestPositiveSubnormalF16MinusULP = 0x1.ff7ffep-15; +constexpr float lowestPositiveSubnormalF16 = 0x1.p-24; +constexpr float lowestPositiveSubnormalF16PlusULP = 0x1.000002p-24; +constexpr float lowestPositiveSubnormalF16MinusULP = 0x1.fffffep-25; + +constexpr uint16_t lowestPositiveNormalF16Bits = 0x0400u; +constexpr uint16_t highestPositiveSubnormalF16Bits = 0x03ffu; +constexpr uint16_t lowestPositiveSubnormalF16Bits = 0x0001u; + +constexpr float highestNegativeNormalF16 = -lowestPositiveNormalF16; +constexpr float highestNegativeNormalF16PlusULP = -lowestPositiveNormalF16MinusULP; +constexpr float highestNegativeNormalF16MinusULP = -lowestPositiveNormalF16PlusULP; +constexpr float lowestNegativeSubnormalF16 = -highestPositiveSubnormalF16; +constexpr float lowestNegativeSubnormalF16PlusULP = -highestPositiveSubnormalF16MinusULP; +constexpr float lowestNegativeSubnormalF16MinusULP = -highestPositiveSubnormalF16PlusULP; +constexpr float highestNegativeSubnormalF16 = -lowestPositiveSubnormalF16; +constexpr float highestNegativeSubnormalF16PlusULP = -lowestPositiveSubnormalF16MinusULP; +constexpr float highestNegativeSubnormalF16MinusULP = -lowestPositiveSubnormalF16PlusULP; + +constexpr uint16_t highestNegativeNormalF16Bits = 0x8400u; +constexpr uint16_t lowestNegativeSubnormalF16Bits = 0x83ffu; +constexpr uint16_t highestNegativeSubnormalF16Bits = 0x8001u; + +constexpr float f32_nan = std::numeric_limits::quiet_NaN(); +constexpr float f32_inf = std::numeric_limits::infinity(); + +struct F16TestCase { + float input_value; + float quantized_value; + uint16_t f16_bit_pattern; +}; + +using NumberF16Test = testing::TestWithParam; + +TEST_P(NumberF16Test, QuantizeF16) { + float input_value = GetParam().input_value; + float quantized_value = GetParam().quantized_value; + + std::stringstream ss; + ss << "input value = " << input_value << ", expected quantized value = " << quantized_value; + SCOPED_TRACE(ss.str()); + + if (std::isnan(quantized_value)) { + EXPECT_TRUE(std::isnan(f16(input_value))); + } else { + EXPECT_EQ(f16(input_value), quantized_value); + } +} + +TEST_P(NumberF16Test, BitsRepresentation) { + float input_value = GetParam().input_value; + uint16_t representation = GetParam().f16_bit_pattern; + + std::stringstream ss; + ss << "input value = " << input_value + << ", expected binary16 bits representation = " << std::hex << std::showbase + << representation; + SCOPED_TRACE(ss.str()); + + EXPECT_EQ(f16(input_value).BitsRepresentation(), representation); +} + +INSTANTIATE_TEST_SUITE_P( + NumberF16Test, + NumberF16Test, + testing::ValuesIn(std::vector{ + // NaN, Inf + {f32_inf, f32_inf, 0x7c00u}, + {-f32_inf, -f32_inf, 0xfc00u}, + {f32_nan, f32_nan, 0x7e00u}, + {-f32_nan, -f32_nan, 0x7e00u}, + // +/- zero + {+0.0f, 0.0f, 0x0000u}, + {-0.0f, -0.0f, 0x8000u}, + // Value in normal f16 range + {1.0f, 1.0f, 0x3c00u}, + {-1.0f, -1.0f, 0xbc00u}, + // 0.00006106496 quantized to 0.000061035156 = 0x1p-14 + {0.00006106496f, 0.000061035156f, 0x0400u}, + {-0.00006106496f, -0.000061035156f, 0x8400u}, + // 1.0004883 quantized to 1.0 = 0x1p0 + {1.0004883f, 1.0f, 0x3c00u}, + {-1.0004883f, -1.0f, 0xbc00u}, + // 8196.0 quantized to 8192.0 = 0x1p13 + {8196.0f, 8192.f, 0x7000u}, + {-8196.0f, -8192.f, 0xf000u}, + // Value in subnormal f16 range + {0x0.034p-14f, 0x0.034p-14f, 0x000du}, + {-0x0.034p-14f, -0x0.034p-14f, 0x800du}, + {0x0.068p-14f, 0x0.068p-14f, 0x001au}, + {-0x0.068p-14f, -0x0.068p-14f, 0x801au}, + // 0x0.06b7p-14 quantized to 0x0.068p-14 + {0x0.06b7p-14f, 0x0.068p-14f, 0x001au}, + {-0x0.06b7p-14f, -0x0.068p-14, 0x801au}, + // Value out of f16 range + {65504.003f, f32_inf, 0x7c00u}, + {-65504.003f, -f32_inf, 0xfc00u}, + {0x1.234p56f, f32_inf, 0x7c00u}, + {-0x4.321p65f, -f32_inf, 0xfc00u}, + + // Test for subnormal quantization. + // Value larger than or equal to lowest positive normal f16 will be quantized to normal f16. + {lowestPositiveNormalF16PlusULP, lowestPositiveNormalF16, lowestPositiveNormalF16Bits}, + {lowestPositiveNormalF16, lowestPositiveNormalF16, lowestPositiveNormalF16Bits}, + // Positive value smaller than lowest positive normal f16 but not smaller than lowest + // positive + // subnormal f16 will be quantized to subnormal f16 or zero. + {lowestPositiveNormalF16MinusULP, highestPositiveSubnormalF16, + highestPositiveSubnormalF16Bits}, + {highestPositiveSubnormalF16PlusULP, highestPositiveSubnormalF16, + highestPositiveSubnormalF16Bits}, + {highestPositiveSubnormalF16, highestPositiveSubnormalF16, highestPositiveSubnormalF16Bits}, + {highestPositiveSubnormalF16MinusULP, 0x0.ff8p-14, 0x03feu}, + {lowestPositiveSubnormalF16PlusULP, lowestPositiveSubnormalF16, + lowestPositiveSubnormalF16Bits}, + {lowestPositiveSubnormalF16, lowestPositiveSubnormalF16, lowestPositiveSubnormalF16Bits}, + // Positive value smaller than lowest positive subnormal f16 will be quantized to zero. + {lowestPositiveSubnormalF16MinusULP, 0.0, 0x0000u}, + // Test the mantissa discarding, the least significant mantissa bit is 0x1p-24 = + // 0x0.004p-14. + {0x0.064p-14f, 0x0.064p-14, 0x0019u}, + {0x0.067fecp-14f, 0x0.064p-14, 0x0019u}, + {0x0.063ffep-14f, 0x0.060p-14, 0x0018u}, + {0x0.008p-14f, 0x0.008p-14, 0x0002u}, + {0x0.00bffep-14f, 0x0.008p-14, 0x0002u}, + {0x0.007ffep-14f, 0x0.004p-14, 0x0001u}, + + // Vice versa for negative cases. + {highestNegativeNormalF16MinusULP, highestNegativeNormalF16, highestNegativeNormalF16Bits}, + {highestNegativeNormalF16, highestNegativeNormalF16, highestNegativeNormalF16Bits}, + {highestNegativeNormalF16PlusULP, lowestNegativeSubnormalF16, + lowestNegativeSubnormalF16Bits}, + {lowestNegativeSubnormalF16MinusULP, lowestNegativeSubnormalF16, + lowestNegativeSubnormalF16Bits}, + {lowestNegativeSubnormalF16, lowestNegativeSubnormalF16, lowestNegativeSubnormalF16Bits}, + {lowestNegativeSubnormalF16PlusULP, -0x0.ff8p-14, 0x83feu}, + {highestNegativeSubnormalF16MinusULP, highestNegativeSubnormalF16, + highestNegativeSubnormalF16Bits}, + {highestNegativeSubnormalF16, highestNegativeSubnormalF16, highestNegativeSubnormalF16Bits}, + {highestNegativeSubnormalF16PlusULP, -0.0, 0x8000u}, + // Test the mantissa discarding. + {-0x0.064p-14f, -0x0.064p-14, 0x8019u}, + {-0x0.067fecp-14f, -0x0.064p-14, 0x8019u}, + {-0x0.063ffep-14f, -0x0.060p-14, 0x8018u}, + {-0x0.008p-14f, -0x0.008p-14, 0x8002u}, + {-0x0.00bffep-14f, -0x0.008p-14, 0x8002u}, + {-0x0.007ffep-14f, -0x0.004p-14, 0x8001u}, + ///////////////////////////////////// + })); + +#ifdef OVERFLOW +#undef OVERFLOW // corecrt_math.h :( +#endif +#define OVERFLOW \ + {} + +using BinaryCheckedCase_AInt = std::tuple, AInt, AInt>; +using BinaryCheckedCase_AFloat = std::tuple, AFloat, AFloat>; + +using CheckedAddTest_AInt = testing::TestWithParam; +TEST_P(CheckedAddTest_AInt, Test) { + auto expect = std::get<0>(GetParam()); + auto a = std::get<1>(GetParam()); + auto b = std::get<2>(GetParam()); + EXPECT_EQ(CheckedAdd(a, b), expect) << std::hex << "0x" << a << " + 0x" << b; + EXPECT_EQ(CheckedAdd(b, a), expect) << std::hex << "0x" << a << " + 0x" << b; +} +INSTANTIATE_TEST_SUITE_P( + CheckedAddTest_AInt, + CheckedAddTest_AInt, + testing::ValuesIn(std::vector{ + {AInt(0), AInt(0), AInt(0)}, + {AInt(1), AInt(1), AInt(0)}, + {AInt(2), AInt(1), AInt(1)}, + {AInt(0), AInt(-1), AInt(1)}, + {AInt(3), AInt(2), AInt(1)}, + {AInt(-1), AInt(-2), AInt(1)}, + {AInt(0x300), AInt(0x100), AInt(0x200)}, + {AInt(0x100), AInt(-0x100), AInt(0x200)}, + {AInt::Highest(), AInt(1), AInt(AInt::kHighestValue - 1)}, + {AInt::Lowest(), AInt(-1), AInt(AInt::kLowestValue + 1)}, + {AInt::Highest(), AInt(0x7fffffff00000000ll), AInt(0x00000000ffffffffll)}, + {AInt::Highest(), AInt::Highest(), AInt(0)}, + {AInt::Lowest(), AInt::Lowest(), AInt(0)}, + {OVERFLOW, AInt(1), AInt::Highest()}, + {OVERFLOW, AInt(-1), AInt::Lowest()}, + {OVERFLOW, AInt(2), AInt::Highest()}, + {OVERFLOW, AInt(-2), AInt::Lowest()}, + {OVERFLOW, AInt(10000), AInt::Highest()}, + {OVERFLOW, AInt(-10000), AInt::Lowest()}, + {OVERFLOW, AInt::Highest(), AInt::Highest()}, + {OVERFLOW, AInt::Lowest(), AInt::Lowest()}, + //////////////////////////////////////////////////////////////////////// + })); + +using CheckedAddTest_AFloat = testing::TestWithParam; +TEST_P(CheckedAddTest_AFloat, Test) { + auto expect = std::get<0>(GetParam()); + auto a = std::get<1>(GetParam()); + auto b = std::get<2>(GetParam()); + EXPECT_EQ(CheckedAdd(a, b), expect) << std::hex << "0x" << a << " + 0x" << b; + EXPECT_EQ(CheckedAdd(b, a), expect) << std::hex << "0x" << a << " + 0x" << b; +} +INSTANTIATE_TEST_SUITE_P( + CheckedAddTest_AFloat, + CheckedAddTest_AFloat, + testing::ValuesIn(std::vector{ + {AFloat(0), AFloat(0), AFloat(0)}, + {AFloat(1), AFloat(1), AFloat(0)}, + {AFloat(2), AFloat(1), AFloat(1)}, + {AFloat(0), AFloat(-1), AFloat(1)}, + {AFloat(3), AFloat(2), AFloat(1)}, + {AFloat(-1), AFloat(-2), AFloat(1)}, + {AFloat(0x300), AFloat(0x100), AFloat(0x200)}, + {AFloat(0x100), AFloat(-0x100), AFloat(0x200)}, + {AFloat::Highest(), AFloat(1), AFloat(AFloat::kHighestValue - 1)}, + {AFloat::Lowest(), AFloat(-1), AFloat(AFloat::kLowestValue + 1)}, + {AFloat::Highest(), AFloat::Highest(), AFloat(0)}, + {AFloat::Lowest(), AFloat::Lowest(), AFloat(0)}, + {OVERFLOW, AFloat::Highest(), AFloat::Highest()}, + {OVERFLOW, AFloat::Lowest(), AFloat::Lowest()}, + //////////////////////////////////////////////////////////////////////// + })); + +using CheckedSubTest_AInt = testing::TestWithParam; +TEST_P(CheckedSubTest_AInt, Test) { + auto expect = std::get<0>(GetParam()); + auto a = std::get<1>(GetParam()); + auto b = std::get<2>(GetParam()); + EXPECT_EQ(CheckedSub(a, b), expect) << std::hex << "0x" << a << " - 0x" << b; +} +INSTANTIATE_TEST_SUITE_P( + CheckedSubTest_AInt, + CheckedSubTest_AInt, + testing::ValuesIn(std::vector{ + {AInt(0), AInt(0), AInt(0)}, + {AInt(1), AInt(1), AInt(0)}, + {AInt(0), AInt(1), AInt(1)}, + {AInt(-2), AInt(-1), AInt(1)}, + {AInt(1), AInt(2), AInt(1)}, + {AInt(-3), AInt(-2), AInt(1)}, + {AInt(0x100), AInt(0x300), AInt(0x200)}, + {AInt(-0x300), AInt(-0x100), AInt(0x200)}, + {AInt::Highest(), AInt(AInt::kHighestValue - 1), AInt(-1)}, + {AInt::Lowest(), AInt(AInt::kLowestValue + 1), AInt(1)}, + {AInt(0x00000000ffffffffll), AInt::Highest(), AInt(0x7fffffff00000000ll)}, + {AInt::Highest(), AInt::Highest(), AInt(0)}, + {AInt::Lowest(), AInt::Lowest(), AInt(0)}, + {OVERFLOW, AInt::Lowest(), AInt(1)}, + {OVERFLOW, AInt::Highest(), AInt(-1)}, + {OVERFLOW, AInt::Lowest(), AInt(2)}, + {OVERFLOW, AInt::Highest(), AInt(-2)}, + {OVERFLOW, AInt::Lowest(), AInt(10000)}, + {OVERFLOW, AInt::Highest(), AInt(-10000)}, + {OVERFLOW, AInt::Lowest(), AInt::Highest()}, + //////////////////////////////////////////////////////////////////////// + })); + +using CheckedSubTest_AFloat = testing::TestWithParam; +TEST_P(CheckedSubTest_AFloat, Test) { + auto expect = std::get<0>(GetParam()); + auto a = std::get<1>(GetParam()); + auto b = std::get<2>(GetParam()); + EXPECT_EQ(CheckedSub(a, b), expect) << std::hex << "0x" << a << " - 0x" << b; +} +INSTANTIATE_TEST_SUITE_P( + CheckedSubTest_AFloat, + CheckedSubTest_AFloat, + testing::ValuesIn(std::vector{ + {AFloat(0), AFloat(0), AFloat(0)}, + {AFloat(1), AFloat(1), AFloat(0)}, + {AFloat(0), AFloat(1), AFloat(1)}, + {AFloat(-2), AFloat(-1), AFloat(1)}, + {AFloat(1), AFloat(2), AFloat(1)}, + {AFloat(-3), AFloat(-2), AFloat(1)}, + {AFloat(0x100), AFloat(0x300), AFloat(0x200)}, + {AFloat(-0x300), AFloat(-0x100), AFloat(0x200)}, + {AFloat::Highest(), AFloat(AFloat::kHighestValue - 1), AFloat(-1)}, + {AFloat::Lowest(), AFloat(AFloat::kLowestValue + 1), AFloat(1)}, + {AFloat::Highest(), AFloat::Highest(), AFloat(0)}, + {AFloat::Lowest(), AFloat::Lowest(), AFloat(0)}, + {OVERFLOW, AFloat::Lowest(), AFloat::Highest()}, + //////////////////////////////////////////////////////////////////////// + })); + +using CheckedMulTest_AInt = testing::TestWithParam; +TEST_P(CheckedMulTest_AInt, Test) { + auto expect = std::get<0>(GetParam()); + auto a = std::get<1>(GetParam()); + auto b = std::get<2>(GetParam()); + EXPECT_EQ(CheckedMul(a, b), expect) << std::hex << "0x" << a << " * 0x" << b; + EXPECT_EQ(CheckedMul(b, a), expect) << std::hex << "0x" << a << " * 0x" << b; +} +INSTANTIATE_TEST_SUITE_P( + CheckedMulTest_AInt, + CheckedMulTest_AInt, + testing::ValuesIn(std::vector{ + {AInt(0), AInt(0), AInt(0)}, + {AInt(0), AInt(1), AInt(0)}, + {AInt(1), AInt(1), AInt(1)}, + {AInt(-1), AInt(-1), AInt(1)}, + {AInt(2), AInt(2), AInt(1)}, + {AInt(-2), AInt(-2), AInt(1)}, + {AInt(0x20000), AInt(0x100), AInt(0x200)}, + {AInt(-0x20000), AInt(-0x100), AInt(0x200)}, + {AInt(0x4000000000000000ll), AInt(0x80000000ll), AInt(0x80000000ll)}, + {AInt(0x4000000000000000ll), AInt(-0x80000000ll), AInt(-0x80000000ll)}, + {AInt(0x1000000000000000ll), AInt(0x40000000ll), AInt(0x40000000ll)}, + {AInt(-0x1000000000000000ll), AInt(-0x40000000ll), AInt(0x40000000ll)}, + {AInt(0x100000000000000ll), AInt(0x1000000), AInt(0x100000000ll)}, + {AInt(0x2000000000000000ll), AInt(0x1000000000000000ll), AInt(2)}, + {AInt(-0x2000000000000000ll), AInt(0x1000000000000000ll), AInt(-2)}, + {AInt(-0x2000000000000000ll), AInt(-0x1000000000000000ll), AInt(2)}, + {AInt(-0x2000000000000000ll), AInt(0x1000000000000000ll), AInt(-2)}, + {AInt(0x4000000000000000ll), AInt(0x1000000000000000ll), AInt(4)}, + {AInt(-0x4000000000000000ll), AInt(0x1000000000000000ll), AInt(-4)}, + {AInt(-0x4000000000000000ll), AInt(-0x1000000000000000ll), AInt(4)}, + {AInt(-0x4000000000000000ll), AInt(0x1000000000000000ll), AInt(-4)}, + {AInt(-0x8000000000000000ll), AInt(0x1000000000000000ll), AInt(-8)}, + {AInt(-0x8000000000000000ll), AInt(-0x1000000000000000ll), AInt(8)}, + {AInt(0), AInt::Highest(), AInt(0)}, + {AInt(0), AInt::Lowest(), AInt(0)}, + {OVERFLOW, AInt(0x1000000000000000ll), AInt(8)}, + {OVERFLOW, AInt(-0x1000000000000000ll), AInt(-8)}, + {OVERFLOW, AInt(0x800000000000000ll), AInt(0x10)}, + {OVERFLOW, AInt(0x80000000ll), AInt(0x100000000ll)}, + {OVERFLOW, AInt::Highest(), AInt::Highest()}, + {OVERFLOW, AInt::Highest(), AInt::Lowest()}, + //////////////////////////////////////////////////////////////////////// + })); + +using TernaryCheckedCase = std::tuple, AInt, AInt, AInt>; + +using CheckedMaddTest_AInt = testing::TestWithParam; +TEST_P(CheckedMaddTest_AInt, Test) { + auto expect = std::get<0>(GetParam()); + auto a = std::get<1>(GetParam()); + auto b = std::get<2>(GetParam()); + auto c = std::get<3>(GetParam()); + EXPECT_EQ(CheckedMadd(a, b, c), expect) + << std::hex << "0x" << a << " * 0x" << b << " + 0x" << c; + EXPECT_EQ(CheckedMadd(b, a, c), expect) + << std::hex << "0x" << a << " * 0x" << b << " + 0x" << c; +} +INSTANTIATE_TEST_SUITE_P( + CheckedMaddTest_AInt, + CheckedMaddTest_AInt, + testing::ValuesIn(std::vector{ + {AInt(0), AInt(0), AInt(0), AInt(0)}, + {AInt(0), AInt(1), AInt(0), AInt(0)}, + {AInt(1), AInt(1), AInt(1), AInt(0)}, + {AInt(2), AInt(1), AInt(1), AInt(1)}, + {AInt(0), AInt(1), AInt(-1), AInt(1)}, + {AInt(-1), AInt(1), AInt(-2), AInt(1)}, + {AInt(-1), AInt(-1), AInt(1), AInt(0)}, + {AInt(2), AInt(2), AInt(1), AInt(0)}, + {AInt(-2), AInt(-2), AInt(1), AInt(0)}, + {AInt(0), AInt::Highest(), AInt(0), AInt(0)}, + {AInt(0), AInt::Lowest(), AInt(0), AInt(0)}, + {AInt(3), AInt(1), AInt(2), AInt(1)}, + {AInt(0x300), AInt(1), AInt(0x100), AInt(0x200)}, + {AInt(0x100), AInt(1), AInt(-0x100), AInt(0x200)}, + {AInt(0x20000), AInt(0x100), AInt(0x200), AInt(0)}, + {AInt(-0x20000), AInt(-0x100), AInt(0x200), AInt(0)}, + {AInt(0x4000000000000000ll), AInt(0x80000000ll), AInt(0x80000000ll), AInt(0)}, + {AInt(0x4000000000000000ll), AInt(-0x80000000ll), AInt(-0x80000000ll), AInt(0)}, + {AInt(0x1000000000000000ll), AInt(0x40000000ll), AInt(0x40000000ll), AInt(0)}, + {AInt(-0x1000000000000000ll), AInt(-0x40000000ll), AInt(0x40000000ll), AInt(0)}, + {AInt(0x100000000000000ll), AInt(0x1000000), AInt(0x100000000ll), AInt(0)}, + {AInt(0x2000000000000000ll), AInt(0x1000000000000000ll), AInt(2), AInt(0)}, + {AInt(-0x2000000000000000ll), AInt(0x1000000000000000ll), AInt(-2), AInt(0)}, + {AInt(-0x2000000000000000ll), AInt(-0x1000000000000000ll), AInt(2), AInt(0)}, + {AInt(-0x2000000000000000ll), AInt(0x1000000000000000ll), AInt(-2), AInt(0)}, + {AInt(0x4000000000000000ll), AInt(0x1000000000000000ll), AInt(4), AInt(0)}, + {AInt(-0x4000000000000000ll), AInt(0x1000000000000000ll), AInt(-4), AInt(0)}, + {AInt(-0x4000000000000000ll), AInt(-0x1000000000000000ll), AInt(4), AInt(0)}, + {AInt(-0x4000000000000000ll), AInt(0x1000000000000000ll), AInt(-4), AInt(0)}, + {AInt(-0x8000000000000000ll), AInt(0x1000000000000000ll), AInt(-8), AInt(0)}, + {AInt(-0x8000000000000000ll), AInt(-0x1000000000000000ll), AInt(8), AInt(0)}, + {AInt::Highest(), AInt(1), AInt(1), AInt(AInt::kHighestValue - 1)}, + {AInt::Lowest(), AInt(1), AInt(-1), AInt(AInt::kLowestValue + 1)}, + {AInt::Highest(), AInt(1), AInt(0x7fffffff00000000ll), AInt(0x00000000ffffffffll)}, + {AInt::Highest(), AInt(1), AInt::Highest(), AInt(0)}, + {AInt::Lowest(), AInt(1), AInt::Lowest(), AInt(0)}, + {OVERFLOW, AInt(0x1000000000000000ll), AInt(8), AInt(0)}, + {OVERFLOW, AInt(-0x1000000000000000ll), AInt(-8), AInt(0)}, + {OVERFLOW, AInt(0x800000000000000ll), AInt(0x10), AInt(0)}, + {OVERFLOW, AInt(0x80000000ll), AInt(0x100000000ll), AInt(0)}, + {OVERFLOW, AInt::Highest(), AInt::Highest(), AInt(0)}, + {OVERFLOW, AInt::Highest(), AInt::Lowest(), AInt(0)}, + {OVERFLOW, AInt(1), AInt(1), AInt::Highest()}, + {OVERFLOW, AInt(1), AInt(-1), AInt::Lowest()}, + {OVERFLOW, AInt(1), AInt(2), AInt::Highest()}, + {OVERFLOW, AInt(1), AInt(-2), AInt::Lowest()}, + {OVERFLOW, AInt(1), AInt(10000), AInt::Highest()}, + {OVERFLOW, AInt(1), AInt(-10000), AInt::Lowest()}, + {OVERFLOW, AInt(1), AInt::Highest(), AInt::Highest()}, + {OVERFLOW, AInt(1), AInt::Lowest(), AInt::Lowest()}, + {OVERFLOW, AInt(1), AInt::Highest(), AInt(1)}, + {OVERFLOW, AInt(1), AInt::Lowest(), AInt(-1)}, + })); + +TINT_END_DISABLE_WARNING(CONSTANT_OVERFLOW); + +} // namespace +} // namespace tint diff --git a/src/tint/program.cc b/src/tint/program.cc index 6722a09b0e..6109c20664 100644 --- a/src/tint/program.cc +++ b/src/tint/program.cc @@ -35,9 +35,11 @@ Program::Program() = default; Program::Program(Program&& program) : id_(std::move(program.id_)), + highest_node_id_(std::move(program.highest_node_id_)), types_(std::move(program.types_)), ast_nodes_(std::move(program.ast_nodes_)), sem_nodes_(std::move(program.sem_nodes_)), + constant_nodes_(std::move(program.constant_nodes_)), ast_(std::move(program.ast_)), sem_(std::move(program.sem_)), symbols_(std::move(program.symbols_)), @@ -49,6 +51,7 @@ Program::Program(Program&& program) Program::Program(ProgramBuilder&& builder) { id_ = builder.ID(); + highest_node_id_ = builder.LastAllocatedNodeID(); is_valid_ = builder.IsValid(); if (builder.ResolveOnBuild() && builder.IsValid()) { @@ -62,6 +65,7 @@ Program::Program(ProgramBuilder&& builder) { types_ = std::move(builder.Types()); ast_nodes_ = std::move(builder.ASTNodes()); sem_nodes_ = std::move(builder.SemNodes()); + constant_nodes_ = std::move(builder.ConstantNodes()); ast_ = &builder.AST(); // ast::Module is actually a heap allocation. sem_ = std::move(builder.Sem()); symbols_ = std::move(builder.Symbols()); @@ -83,9 +87,11 @@ Program& Program::operator=(Program&& program) { program.moved_ = true; moved_ = false; id_ = std::move(program.id_); + highest_node_id_ = std::move(program.highest_node_id_); types_ = std::move(program.types_); ast_nodes_ = std::move(program.ast_nodes_); sem_nodes_ = std::move(program.sem_nodes_); + constant_nodes_ = std::move(program.constant_nodes_); ast_ = std::move(program.ast_); sem_ = std::move(program.sem_); symbols_ = std::move(program.symbols_); diff --git a/src/tint/program.h b/src/tint/program.h index 3230e7e786..ea884701ef 100644 --- a/src/tint/program.h +++ b/src/tint/program.h @@ -20,6 +20,7 @@ #include "src/tint/ast/function.h" #include "src/tint/program_id.h" +#include "src/tint/sem/constant.h" #include "src/tint/sem/info.h" #include "src/tint/sem/type_manager.h" #include "src/tint/symbol_table.h" @@ -43,6 +44,9 @@ class Program { /// SemNodeAllocator is an alias to BlockAllocator using SemNodeAllocator = utils::BlockAllocator; + /// ConstantAllocator is an alias to BlockAllocator + using ConstantAllocator = utils::BlockAllocator; + /// Constructor Program(); @@ -65,6 +69,9 @@ class Program { /// @returns the unique identifier for this program ProgramID ID() const { return id_; } + /// @returns the last allocated (numerically highest) AST node identifier. + ast::NodeID HighestASTNodeID() const { return highest_node_id_; } + /// @returns a reference to the program's types const sem::Manager& Types() const { AssertNotMoved(); @@ -157,9 +164,11 @@ class Program { void AssertNotMoved() const; ProgramID id_; + ast::NodeID highest_node_id_; sem::Manager types_; ASTNodeAllocator ast_nodes_; SemNodeAllocator sem_nodes_; + ConstantAllocator constant_nodes_; ast::Module* ast_ = nullptr; sem::Info sem_; SymbolTable symbols_{id_}; diff --git a/src/tint/program_builder.cc b/src/tint/program_builder.cc index cd05fd41b2..c6cff0fc67 100644 --- a/src/tint/program_builder.cc +++ b/src/tint/program_builder.cc @@ -26,17 +26,22 @@ using namespace tint::number_suffixes; // NOLINT namespace tint { -ProgramBuilder::VarOptionals::~VarOptionals() = default; +ProgramBuilder::VarOptions::~VarOptions() = default; +ProgramBuilder::LetOptions::~LetOptions() = default; +ProgramBuilder::ConstOptions::~ConstOptions() = default; +ProgramBuilder::OverrideOptions::~OverrideOptions() = default; ProgramBuilder::ProgramBuilder() - : id_(ProgramID::New()), ast_(ast_nodes_.Create(id_, Source{})) {} + : id_(ProgramID::New()), + ast_(ast_nodes_.Create(id_, AllocateNodeID(), Source{})) {} ProgramBuilder::ProgramBuilder(ProgramBuilder&& rhs) : id_(std::move(rhs.id_)), + last_ast_node_id_(std::move(rhs.last_ast_node_id_)), types_(std::move(rhs.types_)), ast_nodes_(std::move(rhs.ast_nodes_)), sem_nodes_(std::move(rhs.sem_nodes_)), - ast_(rhs.ast_), + ast_(std::move(rhs.ast_)), sem_(std::move(rhs.sem_)), symbols_(std::move(rhs.symbols_)), diagnostics_(std::move(rhs.diagnostics_)) { @@ -49,10 +54,11 @@ ProgramBuilder& ProgramBuilder::operator=(ProgramBuilder&& rhs) { rhs.MarkAsMoved(); AssertNotMoved(); id_ = std::move(rhs.id_); + last_ast_node_id_ = std::move(rhs.last_ast_node_id_); types_ = std::move(rhs.types_); ast_nodes_ = std::move(rhs.ast_nodes_); sem_nodes_ = std::move(rhs.sem_nodes_); - ast_ = rhs.ast_; + ast_ = std::move(rhs.ast_); sem_ = std::move(rhs.sem_); symbols_ = std::move(rhs.symbols_); diagnostics_ = std::move(rhs.diagnostics_); @@ -63,6 +69,7 @@ ProgramBuilder& ProgramBuilder::operator=(ProgramBuilder&& rhs) { ProgramBuilder ProgramBuilder::Wrap(const Program* program) { ProgramBuilder builder; builder.id_ = program->ID(); + builder.last_ast_node_id_ = program->HighestASTNodeID(); builder.types_ = sem::Manager::Wrap(program->Types()); builder.ast_ = builder.create(program->AST().source, program->AST().GlobalDeclarations()); @@ -114,7 +121,7 @@ ProgramBuilder::TypesBuilder::TypesBuilder(ProgramBuilder* pb) : builder(pb) {} const ast::Statement* ProgramBuilder::WrapInStatement(const ast::Expression* expr) { // Create a temporary variable of inferred type from expr. - return Decl(Let(symbols_.New(), nullptr, expr)); + return Decl(Let(symbols_.New(), expr)); } const ast::VariableDeclStatement* ProgramBuilder::WrapInStatement(const ast::Variable* v) { @@ -125,10 +132,12 @@ const ast::Statement* ProgramBuilder::WrapInStatement(const ast::Statement* stmt return stmt; } -const ast::Function* ProgramBuilder::WrapInFunction(const ast::StatementList stmts) { - return Func( - "test_function", {}, ty.void_(), std::move(stmts), - {create(ast::PipelineStage::kCompute), WorkgroupSize(1_i, 1_i, 1_i)}); +const ast::Function* ProgramBuilder::WrapInFunction(utils::VectorRef stmts) { + return Func("test_function", {}, ty.void_(), std::move(stmts), + utils::Vector{ + create(ast::PipelineStage::kCompute), + WorkgroupSize(1_i, 1_i, 1_i), + }); } } // namespace tint diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h index 088efc9561..c797aaba9e 100644 --- a/src/tint/program_builder.h +++ b/src/tint/program_builder.h @@ -19,6 +19,8 @@ #include #include +#include "tint/override_id.h" + #include "src/tint/ast/alias.h" #include "src/tint/ast/array.h" #include "src/tint/ast/assignment_statement.h" @@ -33,13 +35,16 @@ #include "src/tint/ast/call_statement.h" #include "src/tint/ast/case_statement.h" #include "src/tint/ast/compound_assignment_statement.h" +#include "src/tint/ast/const.h" #include "src/tint/ast/continue_statement.h" #include "src/tint/ast/depth_multisampled_texture.h" #include "src/tint/ast/depth_texture.h" #include "src/tint/ast/disable_validation_attribute.h" #include "src/tint/ast/discard_statement.h" #include "src/tint/ast/enable.h" +#include "src/tint/ast/extension.h" #include "src/tint/ast/external_texture.h" +#include "src/tint/ast/f16.h" #include "src/tint/ast/f32.h" #include "src/tint/ast/fallthrough_statement.h" #include "src/tint/ast/float_literal_expression.h" @@ -51,17 +56,21 @@ #include "src/tint/ast/index_accessor_expression.h" #include "src/tint/ast/interpolate_attribute.h" #include "src/tint/ast/invariant_attribute.h" +#include "src/tint/ast/let.h" #include "src/tint/ast/loop_statement.h" #include "src/tint/ast/matrix.h" #include "src/tint/ast/member_accessor_expression.h" #include "src/tint/ast/module.h" #include "src/tint/ast/multisampled_texture.h" +#include "src/tint/ast/override.h" +#include "src/tint/ast/parameter.h" #include "src/tint/ast/phony_expression.h" #include "src/tint/ast/pointer.h" #include "src/tint/ast/return_statement.h" #include "src/tint/ast/sampled_texture.h" #include "src/tint/ast/sampler.h" #include "src/tint/ast/stage_attribute.h" +#include "src/tint/ast/static_assert.h" #include "src/tint/ast/storage_texture.h" #include "src/tint/ast/stride_attribute.h" #include "src/tint/ast/struct_member_align_attribute.h" @@ -71,17 +80,21 @@ #include "src/tint/ast/type_name.h" #include "src/tint/ast/u32.h" #include "src/tint/ast/unary_op_expression.h" +#include "src/tint/ast/var.h" #include "src/tint/ast/variable_decl_statement.h" #include "src/tint/ast/vector.h" #include "src/tint/ast/void.h" +#include "src/tint/ast/while_statement.h" #include "src/tint/ast/workgroup_attribute.h" #include "src/tint/number.h" #include "src/tint/program.h" #include "src/tint/program_id.h" #include "src/tint/sem/array.h" #include "src/tint/sem/bool.h" +#include "src/tint/sem/constant.h" #include "src/tint/sem/depth_texture.h" #include "src/tint/sem/external_texture.h" +#include "src/tint/sem/f16.h" #include "src/tint/sem/f32.h" #include "src/tint/sem/i32.h" #include "src/tint/sem/matrix.h" @@ -108,6 +121,30 @@ class VariableDeclStatement; namespace tint { +namespace detail { + +/// IsVectorLike::value is true if T is a utils::Vector or utils::VectorRef. +template +struct IsVectorLike { + /// Non-specialized form of IsVectorLike defaults to false + static constexpr bool value = false; +}; + +/// IsVectorLike specialization for utils::Vector +template +struct IsVectorLike> { + /// True for the IsVectorLike specialization of utils::Vector + static constexpr bool value = true; +}; + +/// IsVectorLike specialization for utils::VectorRef +template +struct IsVectorLike> { + /// True for the IsVectorLike specialization of utils::VectorRef + static constexpr bool value = true; +}; +} // namespace detail + /// ProgramBuilder is a mutable builder for a Program. /// To construct a Program, populate the builder and then `std::move` it to a /// Program. @@ -119,32 +156,104 @@ class ProgramBuilder { using DisableIfSource = traits::EnableIfIsNotType>, Source>; - /// VarOptionals is a helper for accepting a number of optional, extra - /// arguments for Var() and Global(). - struct VarOptionals { - template - explicit VarOptionals(ARGS&&... args) { - Apply(std::forward(args)...); - } - ~VarOptionals(); + /// A helper used to disable overloads if the first type in `TYPES` is a utils::Vector, + /// utils::VectorRef or utils::VectorRef. + template + using DisableIfVectorLike = traits::EnableIf< + !detail::IsVectorLike>>::value>; + /// VarOptions is a helper for accepting an arbitrary number of order independent options for + /// constructing an ast::Var. + struct VarOptions { + template + explicit VarOptions(ARGS&&... args) { + (Set(std::forward(args)), ...); + } + ~VarOptions(); + + const ast::Type* type = nullptr; ast::StorageClass storage = ast::StorageClass::kNone; ast::Access access = ast::Access::kUndefined; const ast::Expression* constructor = nullptr; - ast::AttributeList attributes = {}; + utils::Vector attributes; private: + void Set(const ast::Type* t) { type = t; } void Set(ast::StorageClass sc) { storage = sc; } void Set(ast::Access ac) { access = ac; } void Set(const ast::Expression* c) { constructor = c; } - void Set(const ast::AttributeList& l) { attributes = l; } + void Set(utils::VectorRef l) { attributes = std::move(l); } + void Set(const ast::Attribute* a) { attributes.Push(a); } + }; - template - void Apply(FIRST&& first, ARGS&&... args) { - Set(std::forward(first)); - Apply(std::forward(args)...); + /// LetOptions is a helper for accepting an arbitrary number of order independent options for + /// constructing an ast::Let. + struct LetOptions { + template + explicit LetOptions(ARGS&&... args) { + static constexpr bool has_init = + (traits::IsTypeOrDerived>, + ast::Expression> || + ...); + static_assert(has_init, "Let() must be constructed with an initializer expression"); + (Set(std::forward(args)), ...); } - void Apply() {} + ~LetOptions(); + + const ast::Type* type = nullptr; + const ast::Expression* constructor = nullptr; + utils::Vector attributes; + + private: + void Set(const ast::Type* t) { type = t; } + void Set(const ast::Expression* c) { constructor = c; } + void Set(utils::VectorRef l) { attributes = std::move(l); } + void Set(const ast::Attribute* a) { attributes.Push(a); } + }; + + /// ConstOptions is a helper for accepting an arbitrary number of order independent options for + /// constructing an ast::Const. + struct ConstOptions { + template + explicit ConstOptions(ARGS&&... args) { + static constexpr bool has_init = + (traits::IsTypeOrDerived>, + ast::Expression> || + ...); + static_assert(has_init, "Const() must be constructed with an initializer expression"); + (Set(std::forward(args)), ...); + } + ~ConstOptions(); + + const ast::Type* type = nullptr; + const ast::Expression* constructor = nullptr; + utils::Vector attributes; + + private: + void Set(const ast::Type* t) { type = t; } + void Set(const ast::Expression* c) { constructor = c; } + void Set(utils::VectorRef l) { attributes = std::move(l); } + void Set(const ast::Attribute* a) { attributes.Push(a); } + }; + + /// OverrideOptions is a helper for accepting an arbitrary number of order independent options + /// for constructing an ast::Override. + struct OverrideOptions { + template + explicit OverrideOptions(ARGS&&... args) { + (Set(std::forward(args)), ...); + } + ~OverrideOptions(); + + const ast::Type* type = nullptr; + const ast::Expression* constructor = nullptr; + utils::Vector attributes; + + private: + void Set(const ast::Type* t) { type = t; } + void Set(const ast::Expression* c) { constructor = c; } + void Set(utils::VectorRef l) { attributes = std::move(l); } + void Set(const ast::Attribute* a) { attributes.Push(a); } }; public: @@ -154,6 +263,9 @@ class ProgramBuilder { /// SemNodeAllocator is an alias to BlockAllocator using SemNodeAllocator = utils::BlockAllocator; + /// ConstantAllocator is an alias to BlockAllocator + using ConstantAllocator = utils::BlockAllocator; + /// Constructor ProgramBuilder(); @@ -220,6 +332,12 @@ class ProgramBuilder { return sem_nodes_; } + /// @returns a reference to the program's semantic constant storage + ConstantAllocator& ConstantNodes() { + AssertNotMoved(); + return constant_nodes_; + } + /// @returns a reference to the program's AST root Module ast::Module& AST() { AssertNotMoved(); @@ -280,6 +398,16 @@ class ProgramBuilder { /// information bool IsValid() const; + /// @returns the last allocated (numerically highest) AST node identifier. + ast::NodeID LastAllocatedNodeID() const { return last_ast_node_id_; } + + /// @returns the next sequentially unique node identifier. + ast::NodeID AllocateNodeID() { + auto out = ast::NodeID{last_ast_node_id_.value + 1}; + last_ast_node_id_ = out; + return out; + } + /// Creates a new ast::Node owned by the ProgramBuilder. When the /// ProgramBuilder is destructed, the ast::Node will also be destructed. /// @param source the Source of the node @@ -288,7 +416,7 @@ class ProgramBuilder { template traits::EnableIfIsType* create(const Source& source, ARGS&&... args) { AssertNotMoved(); - return ast_nodes_.Create(id_, source, std::forward(args)...); + return ast_nodes_.Create(id_, AllocateNodeID(), source, std::forward(args)...); } /// Creates a new ast::Node owned by the ProgramBuilder, injecting the current @@ -300,7 +428,7 @@ class ProgramBuilder { template traits::EnableIfIsType* create() { AssertNotMoved(); - return ast_nodes_.Create(id_, source_); + return ast_nodes_.Create(id_, AllocateNodeID(), source_); } /// Creates a new ast::Node owned by the ProgramBuilder, injecting the current @@ -318,14 +446,13 @@ class ProgramBuilder { T>* create(ARG0&& arg0, ARGS&&... args) { AssertNotMoved(); - return ast_nodes_.Create(id_, source_, std::forward(arg0), + return ast_nodes_.Create(id_, AllocateNodeID(), source_, std::forward(arg0), std::forward(args)...); } /// Creates a new sem::Node owned by the ProgramBuilder. - /// When the ProgramBuilder is destructed, the sem::Node will also be - /// destructed. - /// @param args the arguments to pass to the type constructor + /// When the ProgramBuilder is destructed, the sem::Node will also be destructed. + /// @param args the arguments to pass to the constructor /// @returns the node pointer template traits::EnableIf && @@ -336,6 +463,16 @@ class ProgramBuilder { return sem_nodes_.Create(std::forward(args)...); } + /// Creates a new sem::Constant owned by the ProgramBuilder. + /// When the ProgramBuilder is destructed, the sem::Node will also be destructed. + /// @param args the arguments to pass to the constructor + /// @returns the node pointer + template + traits::EnableIf, T>* create(ARGS&&... args) { + AssertNotMoved(); + return constant_nodes_.Create(std::forward(args)...); + } + /// Creates a new sem::Type owned by the ProgramBuilder. /// When the ProgramBuilder is destructed, owned ProgramBuilder and the /// returned`Type` will also be destructed. @@ -385,6 +522,15 @@ class ProgramBuilder { return builder->create(source); } + /// @returns a f16 type + const ast::F16* f16() const { return builder->create(); } + + /// @param source the Source of the node + /// @returns a f16 type + const ast::F16* f16(const Source& source) const { + return builder->create(source); + } + /// @returns a f32 type const ast::F32* f32() const { return builder->create(); } @@ -440,14 +586,35 @@ class ProgramBuilder { /// @return the tint AST type for a 2-element vector of `type`. const ast::Vector* vec2(const ast::Type* type) const { return vec(type, 2u); } + /// @param source the vector source + /// @param type vector subtype + /// @return the tint AST type for a 2-element vector of `type`. + const ast::Vector* vec2(const Source& source, const ast::Type* type) const { + return vec(source, type, 2u); + } + /// @param type vector subtype /// @return the tint AST type for a 3-element vector of `type`. const ast::Vector* vec3(const ast::Type* type) const { return vec(type, 3u); } + /// @param source the vector source + /// @param type vector subtype + /// @return the tint AST type for a 3-element vector of `type`. + const ast::Vector* vec3(const Source& source, const ast::Type* type) const { + return vec(source, type, 3u); + } + /// @param type vector subtype /// @return the tint AST type for a 4-element vector of `type`. const ast::Vector* vec4(const ast::Type* type) const { return vec(type, 4u); } + /// @param source the vector source + /// @param type vector subtype + /// @return the tint AST type for a 4-element vector of `type`. + const ast::Vector* vec4(const Source& source, const ast::Type* type) const { + return vec(source, type, 4u); + } + /// @param n vector width in elements /// @return the tint AST type for a `n`-element vector of `type`. template @@ -461,18 +628,39 @@ class ProgramBuilder { return vec2(Of()); } + /// @param source the Source of the node + /// @return the tint AST type for a 2-element vector of the C type `T`. + template + const ast::Vector* vec2(const Source& source) const { + return vec2(source, Of()); + } + /// @return the tint AST type for a 3-element vector of the C type `T`. template const ast::Vector* vec3() const { return vec3(Of()); } + /// @param source the Source of the node + /// @return the tint AST type for a 3-element vector of the C type `T`. + template + const ast::Vector* vec3(const Source& source) const { + return vec3(source, Of()); + } + /// @return the tint AST type for a 4-element vector of the C type `T`. template const ast::Vector* vec4() const { return vec4(Of()); } + /// @param source the Source of the node + /// @return the tint AST type for a 4-element vector of the C type `T`. + template + const ast::Vector* vec4(const Source& source) const { + return vec4(source, Of()); + } + /// @param type matrix subtype /// @param columns number of columns for the matrix /// @param rows number of rows for the matrix @@ -596,11 +784,12 @@ class ProgramBuilder { /// @param attrs the optional attributes for the array /// @return the tint AST type for a array of size `n` of type `T` template - const ast::Array* array(const ast::Type* subtype, - EXPR&& n = nullptr, - ast::AttributeList attrs = {}) const { + const ast::Array* array( + const ast::Type* subtype, + EXPR&& n = nullptr, + utils::VectorRef attrs = utils::Empty) const { return builder->create(subtype, builder->Expr(std::forward(n)), - attrs); + std::move(attrs)); } /// @param source the Source of the node @@ -609,12 +798,13 @@ class ProgramBuilder { /// @param attrs the optional attributes for the array /// @return the tint AST type for a array of size `n` of type `T` template - const ast::Array* array(const Source& source, - const ast::Type* subtype, - EXPR&& n = nullptr, - ast::AttributeList attrs = {}) const { - return builder->create(source, subtype, - builder->Expr(std::forward(n)), attrs); + const ast::Array* array( + const Source& source, + const ast::Type* subtype, + EXPR&& n = nullptr, + utils::VectorRef attrs = utils::Empty) const { + return builder->create( + source, subtype, builder->Expr(std::forward(n)), std::move(attrs)); } /// @param subtype the array element type @@ -623,9 +813,9 @@ class ProgramBuilder { /// @return the tint AST type for a array of size `n` of type `T` template const ast::Array* array(const ast::Type* subtype, EXPR&& n, uint32_t stride) const { - ast::AttributeList attrs; + utils::Vector attrs; if (stride) { - attrs.emplace_back(builder->create(stride)); + attrs.Push(builder->create(stride)); } return array(subtype, std::forward(n), std::move(attrs)); } @@ -640,9 +830,9 @@ class ProgramBuilder { const ast::Type* subtype, EXPR&& n, uint32_t stride) const { - ast::AttributeList attrs; + utils::Vector attrs; if (stride) { - attrs.emplace_back(builder->create(stride)); + attrs.Push(builder->create(stride)); } return array(source, subtype, std::forward(n), std::move(attrs)); } @@ -742,6 +932,17 @@ class ProgramBuilder { return pointer(Of(), storage_class, access); } + /// @param source the Source of the node + /// @param storage_class the storage class of the pointer + /// @param access the optional access control of the pointer + /// @return the pointer to type `T` with the given ast::StorageClass. + template + const ast::Pointer* pointer(const Source& source, + ast::StorageClass storage_class, + ast::Access access = ast::Access::kUndefined) const { + return pointer(source, Of(), storage_class, access); + } + /// @param source the Source of the node /// @param type the type of the atomic /// @return the atomic to `type` @@ -974,53 +1175,104 @@ class ProgramBuilder { /// @param source the source information /// @param value the boolean value /// @return a Scalar constructor for the given value - const ast::BoolLiteralExpression* Expr(const Source& source, bool value) { + template + std::enable_if_t, const ast::BoolLiteralExpression*> Expr( + const Source& source, + BOOL value) { return create(source, value); } /// @param value the boolean value /// @return a Scalar constructor for the given value - const ast::BoolLiteralExpression* Expr(bool value) { + template + std::enable_if_t, const ast::BoolLiteralExpression*> Expr( + BOOL value) { return create(value); } /// @param source the source information /// @param value the float value - /// @return a Scalar constructor for the given value + /// @return a 'f'-suffixed FloatLiteralExpression for the f32 value const ast::FloatLiteralExpression* Expr(const Source& source, f32 value) { - return create(source, value); + return create(source, static_cast(value.value), + ast::FloatLiteralExpression::Suffix::kF); } /// @param value the float value - /// @return a Scalar constructor for the given value + /// @return a 'f'-suffixed FloatLiteralExpression for the f32 value const ast::FloatLiteralExpression* Expr(f32 value) { - return create(value); + return create(static_cast(value.value), + ast::FloatLiteralExpression::Suffix::kF); + } + + /// @param source the source information + /// @param value the float value + /// @return a 'h'-suffixed FloatLiteralExpression for the f16 value + const ast::FloatLiteralExpression* Expr(const Source& source, f16 value) { + return create(source, static_cast(value.value), + ast::FloatLiteralExpression::Suffix::kH); + } + + /// @param value the float value + /// @return a 'h'-suffixed FloatLiteralExpression for the f16 value + const ast::FloatLiteralExpression* Expr(f16 value) { + return create(static_cast(value.value), + ast::FloatLiteralExpression::Suffix::kH); } /// @param source the source information /// @param value the integer value - /// @return a 'i'-suffixed IntLiteralExpression for the given value + /// @return an unsuffixed IntLiteralExpression for the AInt value + const ast::IntLiteralExpression* Expr(const Source& source, AInt value) { + return create(source, value, + ast::IntLiteralExpression::Suffix::kNone); + } + + /// @param value the integer value + /// @return an unsuffixed IntLiteralExpression for the AInt value + const ast::IntLiteralExpression* Expr(AInt value) { + return create(value, ast::IntLiteralExpression::Suffix::kNone); + } + + /// @param source the source information + /// @param value the integer value + /// @return an unsuffixed FloatLiteralExpression for the AFloat value + const ast::FloatLiteralExpression* Expr(const Source& source, AFloat value) { + return create(source, value.value, + ast::FloatLiteralExpression::Suffix::kNone); + } + + /// @param value the integer value + /// @return an unsuffixed FloatLiteralExpression for the AFloat value + const ast::FloatLiteralExpression* Expr(AFloat value) { + return create(value.value, + ast::FloatLiteralExpression::Suffix::kNone); + } + + /// @param source the source information + /// @param value the integer value + /// @return a signed 'i'-suffixed IntLiteralExpression for the i32 value const ast::IntLiteralExpression* Expr(const Source& source, i32 value) { return create(source, value, ast::IntLiteralExpression::Suffix::kI); } /// @param value the integer value - /// @return a 'i'-suffixed IntLiteralExpression for the given value + /// @return a signed 'i'-suffixed IntLiteralExpression for the i32 value const ast::IntLiteralExpression* Expr(i32 value) { return create(value, ast::IntLiteralExpression::Suffix::kI); } /// @param source the source information /// @param value the unsigned int value - /// @return a 'u'-suffixed IntLiteralExpression for the given value + /// @return an unsigned 'u'-suffixed IntLiteralExpression for the u32 value const ast::IntLiteralExpression* Expr(const Source& source, u32 value) { return create(source, value, ast::IntLiteralExpression::Suffix::kU); } /// @param value the unsigned int value - /// @return a 'u'-suffixed IntLiteralExpression for the given value + /// @return an unsigned 'u'-suffixed IntLiteralExpression for the u32 value const ast::IntLiteralExpression* Expr(u32 value) { return create(value, ast::IntLiteralExpression::Suffix::kU); } @@ -1029,9 +1281,9 @@ class ProgramBuilder { /// `list`. /// @param list the list to append too /// @param arg the arg to create - template - void Append(ast::ExpressionList& list, ARG&& arg) { - list.emplace_back(Expr(std::forward(arg))); + template + void Append(utils::Vector& list, ARG&& arg) { + list.Push(Expr(std::forward(arg))); } /// Converts `arg0` and `args` to `ast::Expression`s using `Expr()`, @@ -1039,29 +1291,38 @@ class ProgramBuilder { /// @param list the list to append too /// @param arg0 the first argument /// @param args the rest of the arguments - template - void Append(ast::ExpressionList& list, ARG0&& arg0, ARGS&&... args) { + template + void Append(utils::Vector& list, ARG0&& arg0, ARGS&&... args) { Append(list, std::forward(arg0)); Append(list, std::forward(args)...); } - /// @return an empty list of expressions - ast::ExpressionList ExprList() { return {}; } + /// @return utils::EmptyType + utils::EmptyType ExprList() { return utils::Empty; } /// @param args the list of expressions /// @return the list of expressions converted to `ast::Expression`s using /// `Expr()`, - template - ast::ExpressionList ExprList(ARGS&&... args) { - ast::ExpressionList list; - list.reserve(sizeof...(args)); + template > + auto ExprList(ARGS&&... args) { + utils::Vector list; Append(list, std::forward(args)...); return list; } /// @param list the list of expressions /// @return `list` - ast::ExpressionList ExprList(ast::ExpressionList list) { return list; } + template + utils::Vector ExprList(utils::Vector&& list) { + return std::move(list); + } + + /// @param list the list of expressions + /// @return `list` + utils::VectorRef ExprList( + utils::VectorRef list) { + return list; + } /// @param args the arguments for the type constructor /// @return an `ast::CallExpression` of type `ty`, with the values @@ -1134,99 +1395,207 @@ class ProgramBuilder { /// @param args the arguments for the vector constructor /// @return an `ast::CallExpression` of a 2-element vector of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* vec2(ARGS&&... args) { return Construct(ty.vec2(), std::forward(args)...); } + /// @param source the vector source + /// @param args the arguments for the vector constructor + /// @return an `ast::CallExpression` of a 2-element vector of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* vec2(const Source& source, ARGS&&... args) { + return Construct(source, ty.vec2(), std::forward(args)...); + } + /// @param args the arguments for the vector constructor /// @return an `ast::CallExpression` of a 3-element vector of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* vec3(ARGS&&... args) { return Construct(ty.vec3(), std::forward(args)...); } + /// @param source the vector source + /// @param args the arguments for the vector constructor + /// @return an `ast::CallExpression` of a 3-element vector of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* vec3(const Source& source, ARGS&&... args) { + return Construct(source, ty.vec3(), std::forward(args)...); + } + /// @param args the arguments for the vector constructor /// @return an `ast::CallExpression` of a 4-element vector of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* vec4(ARGS&&... args) { return Construct(ty.vec4(), std::forward(args)...); } + /// @param source the vector source + /// @param args the arguments for the vector constructor + /// @return an `ast::CallExpression` of a 4-element vector of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* vec4(const Source& source, ARGS&&... args) { + return Construct(source, ty.vec4(), std::forward(args)...); + } + /// @param args the arguments for the matrix constructor /// @return an `ast::CallExpression` of a 2x2 matrix of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* mat2x2(ARGS&&... args) { return Construct(ty.mat2x2(), std::forward(args)...); } + /// @param source the matrix source + /// @param args the arguments for the matrix constructor + /// @return an `ast::CallExpression` of a 2x2 matrix of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* mat2x2(const Source& source, ARGS&&... args) { + return Construct(source, ty.mat2x2(), std::forward(args)...); + } + /// @param args the arguments for the matrix constructor /// @return an `ast::CallExpression` of a 2x3 matrix of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* mat2x3(ARGS&&... args) { return Construct(ty.mat2x3(), std::forward(args)...); } + /// @param source the matrix source + /// @param args the arguments for the matrix constructor + /// @return an `ast::CallExpression` of a 2x3 matrix of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* mat2x3(const Source& source, ARGS&&... args) { + return Construct(source, ty.mat2x3(), std::forward(args)...); + } + /// @param args the arguments for the matrix constructor /// @return an `ast::CallExpression` of a 2x4 matrix of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* mat2x4(ARGS&&... args) { return Construct(ty.mat2x4(), std::forward(args)...); } + /// @param source the matrix source + /// @param args the arguments for the matrix constructor + /// @return an `ast::CallExpression` of a 2x4 matrix of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* mat2x4(const Source& source, ARGS&&... args) { + return Construct(source, ty.mat2x4(), std::forward(args)...); + } + /// @param args the arguments for the matrix constructor /// @return an `ast::CallExpression` of a 3x2 matrix of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* mat3x2(ARGS&&... args) { return Construct(ty.mat3x2(), std::forward(args)...); } + /// @param source the matrix source + /// @param args the arguments for the matrix constructor + /// @return an `ast::CallExpression` of a 3x2 matrix of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* mat3x2(const Source& source, ARGS&&... args) { + return Construct(source, ty.mat3x2(), std::forward(args)...); + } + /// @param args the arguments for the matrix constructor /// @return an `ast::CallExpression` of a 3x3 matrix of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* mat3x3(ARGS&&... args) { return Construct(ty.mat3x3(), std::forward(args)...); } + /// @param source the matrix source + /// @param args the arguments for the matrix constructor + /// @return an `ast::CallExpression` of a 3x3 matrix of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* mat3x3(const Source& source, ARGS&&... args) { + return Construct(source, ty.mat3x3(), std::forward(args)...); + } + /// @param args the arguments for the matrix constructor /// @return an `ast::CallExpression` of a 3x4 matrix of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* mat3x4(ARGS&&... args) { return Construct(ty.mat3x4(), std::forward(args)...); } + /// @param source the matrix source + /// @param args the arguments for the matrix constructor + /// @return an `ast::CallExpression` of a 3x4 matrix of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* mat3x4(const Source& source, ARGS&&... args) { + return Construct(source, ty.mat3x4(), std::forward(args)...); + } + /// @param args the arguments for the matrix constructor /// @return an `ast::CallExpression` of a 4x2 matrix of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* mat4x2(ARGS&&... args) { return Construct(ty.mat4x2(), std::forward(args)...); } + /// @param source the matrix source + /// @param args the arguments for the matrix constructor + /// @return an `ast::CallExpression` of a 4x2 matrix of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* mat4x2(const Source& source, ARGS&&... args) { + return Construct(source, ty.mat4x2(), std::forward(args)...); + } + /// @param args the arguments for the matrix constructor /// @return an `ast::CallExpression` of a 4x3 matrix of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* mat4x3(ARGS&&... args) { return Construct(ty.mat4x3(), std::forward(args)...); } + /// @param source the matrix source + /// @param args the arguments for the matrix constructor + /// @return an `ast::CallExpression` of a 4x3 matrix of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* mat4x3(const Source& source, ARGS&&... args) { + return Construct(source, ty.mat4x3(), std::forward(args)...); + } + /// @param args the arguments for the matrix constructor /// @return an `ast::CallExpression` of a 4x4 matrix of type /// `T`, constructed with the values `args`. - template + template > const ast::CallExpression* mat4x4(ARGS&&... args) { return Construct(ty.mat4x4(), std::forward(args)...); } + /// @param source the matrix source + /// @param args the arguments for the matrix constructor + /// @return an `ast::CallExpression` of a 4x4 matrix of type + /// `T`, constructed with the values `args`. + template + const ast::CallExpression* mat4x4(const Source& source, ARGS&&... args) { + return Construct(source, ty.mat4x4(), std::forward(args)...); + } + /// @param args the arguments for the array constructor /// @return an `ast::CallExpression` of an array with element type /// `T` and size `N`, constructed with the values `args`. @@ -1235,6 +1604,15 @@ class ProgramBuilder { return Construct(ty.array(), std::forward(args)...); } + /// @param source the array source + /// @param args the arguments for the array constructor + /// @return an `ast::CallExpression` of an array with element type + /// `T` and size `N`, constructed with the values `args`. + template + const ast::CallExpression* array(const Source& source, ARGS&&... args) { + return Construct(source, ty.array(), std::forward(args)...); + } + /// @param subtype the array element type /// @param n the array size. nullptr represents a runtime-array. /// @param args the arguments for the array constructor @@ -1245,230 +1623,293 @@ class ProgramBuilder { return Construct(ty.array(subtype, std::forward(n)), std::forward(args)...); } + /// @param source the array source + /// @param subtype the array element type + /// @param n the array size. nullptr represents a runtime-array. + /// @param args the arguments for the array constructor + /// @return an `ast::CallExpression` of an array with element type + /// `subtype`, constructed with the values `args`. + template + const ast::CallExpression* array(const Source& source, + const ast::Type* subtype, + EXPR&& n, + ARGS&&... args) { + return Construct(source, ty.array(subtype, std::forward(n)), + std::forward(args)...); + } + + /// Adds the extension to the list of enable directives at the top of the module. + /// @param ext the extension to enable + /// @return an `ast::Enable` enabling the given extension. + const ast::Enable* Enable(ast::Extension ext) { + auto* enable = create(ext); + AST().AddEnable(enable); + return enable; + } + /// @param name the variable name - /// @param type the variable type - /// @param optional the optional variable settings. + /// @param options the extra options passed to the ast::Var constructor /// Can be any of the following, in any order: + /// * ast::Type* - specifies the variable type /// * ast::StorageClass - specifies the variable storage class /// * ast::Access - specifies the variable's access control /// * ast::Expression* - specifies the variable's initializer expression - /// * ast::AttributeList - specifies the variable's attributes - /// Note that repeated arguments of the same type will use the last argument's - /// value. - /// @returns a `ast::Variable` with the given name, type and additional + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns a `ast::Var` with the given name, type and additional /// options - template - const ast::Variable* Var(NAME&& name, const ast::Type* type, OPTIONAL&&... optional) { - VarOptionals opts(std::forward(optional)...); - return create(Sym(std::forward(name)), opts.storage, opts.access, type, - false /* is_const */, false /* is_overridable */, - opts.constructor, std::move(opts.attributes)); + template > + const ast::Var* Var(NAME&& name, OPTIONS&&... options) { + VarOptions opts(std::forward(options)...); + return create(Sym(std::forward(name)), opts.type, opts.storage, opts.access, + opts.constructor, std::move(opts.attributes)); } /// @param source the variable source /// @param name the variable name - /// @param type the variable type - /// @param optional the optional variable settings. + /// @param options the extra options passed to the ast::Var constructor /// Can be any of the following, in any order: + /// * ast::Type* - specifies the variable type /// * ast::StorageClass - specifies the variable storage class /// * ast::Access - specifies the variable's access control /// * ast::Expression* - specifies the variable's initializer expression - /// * ast::AttributeList - specifies the variable's attributes - /// Note that repeated arguments of the same type will use the last argument's - /// value. - /// @returns a `ast::Variable` with the given name, storage and type - template - const ast::Variable* Var(const Source& source, - NAME&& name, - const ast::Type* type, - OPTIONAL&&... optional) { - VarOptionals opts(std::forward(optional)...); - return create(source, Sym(std::forward(name)), opts.storage, - opts.access, type, false /* is_const */, - false /* is_overridable */, opts.constructor, - std::move(opts.attributes)); + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns a `ast::Var` with the given name, storage and type + template + const ast::Var* Var(const Source& source, NAME&& name, OPTIONS&&... options) { + VarOptions opts(std::forward(options)...); + return create(source, Sym(std::forward(name)), opts.type, opts.storage, + opts.access, opts.constructor, std::move(opts.attributes)); } /// @param name the variable name - /// @param type the variable type - /// @param constructor constructor expression - /// @param attributes optional variable attributes - /// @returns an immutable `ast::Variable` with the given name and type - template - const ast::Variable* Let(NAME&& name, - const ast::Type* type, - const ast::Expression* constructor, - ast::AttributeList attributes = {}) { - return create(Sym(std::forward(name)), ast::StorageClass::kNone, - ast::Access::kUndefined, type, true /* is_const */, - false /* is_overridable */, constructor, attributes); + /// @param options the extra options passed to the ast::Var constructor + /// Can be any of the following, in any order: + /// * ast::Expression* - specifies the variable's initializer expression (required) + /// * ast::Type* - specifies the variable type + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns an `ast::Const` with the given name, type and additional options + template > + const ast::Const* Const(NAME&& name, OPTIONS&&... options) { + ConstOptions opts(std::forward(options)...); + return create(Sym(std::forward(name)), opts.type, opts.constructor, + std::move(opts.attributes)); } /// @param source the variable source /// @param name the variable name - /// @param type the variable type - /// @param constructor constructor expression - /// @param attributes optional variable attributes - /// @returns an immutable `ast::Variable` with the given name and type - template - const ast::Variable* Let(const Source& source, - NAME&& name, - const ast::Type* type, - const ast::Expression* constructor, - ast::AttributeList attributes = {}) { - return create(source, Sym(std::forward(name)), - ast::StorageClass::kNone, ast::Access::kUndefined, type, - true /* is_const */, false /* is_overridable */, constructor, - attributes); + /// @param options the extra options passed to the ast::Var constructor + /// Can be any of the following, in any order: + /// * ast::Expression* - specifies the variable's initializer expression (required) + /// * ast::Type* - specifies the variable type + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns an `ast::Const` with the given name, type and additional options + template + const ast::Const* Const(const Source& source, NAME&& name, OPTIONS&&... options) { + ConstOptions opts(std::forward(options)...); + return create(source, Sym(std::forward(name)), opts.type, + opts.constructor, std::move(opts.attributes)); + } + + /// @param name the variable name + /// @param options the extra options passed to the ast::Var constructor + /// Can be any of the following, in any order: + /// * ast::Expression* - specifies the variable's initializer expression (required) + /// * ast::Type* - specifies the variable type + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns an `ast::Let` with the given name, type and additional options + template > + const ast::Let* Let(NAME&& name, OPTIONS&&... options) { + LetOptions opts(std::forward(options)...); + return create(Sym(std::forward(name)), opts.type, opts.constructor, + std::move(opts.attributes)); + } + + /// @param source the variable source + /// @param name the variable name + /// @param options the extra options passed to the ast::Var constructor + /// Can be any of the following, in any order: + /// * ast::Expression* - specifies the variable's initializer expression (required) + /// * ast::Type* - specifies the variable type + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns an `ast::Let` with the given name, type and additional options + template + const ast::Let* Let(const Source& source, NAME&& name, OPTIONS&&... options) { + LetOptions opts(std::forward(options)...); + return create(source, Sym(std::forward(name)), opts.type, opts.constructor, + std::move(opts.attributes)); } /// @param name the parameter name /// @param type the parameter type /// @param attributes optional parameter attributes - /// @returns an immutable `ast::Variable` with the given name and type + /// @returns an `ast::Parameter` with the given name and type template - const ast::Variable* Param(NAME&& name, - const ast::Type* type, - ast::AttributeList attributes = {}) { - return create(Sym(std::forward(name)), ast::StorageClass::kNone, - ast::Access::kUndefined, type, true /* is_const */, - false /* is_overridable */, nullptr, attributes); + const ast::Parameter* Param(NAME&& name, + const ast::Type* type, + utils::VectorRef attributes = utils::Empty) { + return create(Sym(std::forward(name)), type, attributes); } /// @param source the parameter source /// @param name the parameter name /// @param type the parameter type /// @param attributes optional parameter attributes - /// @returns an immutable `ast::Variable` with the given name and type + /// @returns an `ast::Parameter` with the given name and type template - const ast::Variable* Param(const Source& source, - NAME&& name, - const ast::Type* type, - ast::AttributeList attributes = {}) { - return create(source, Sym(std::forward(name)), - ast::StorageClass::kNone, ast::Access::kUndefined, type, - true /* is_const */, false /* is_overridable */, nullptr, - attributes); - } - - /// @param name the variable name - /// @param type the variable type - /// @param optional the optional variable settings. - /// Can be any of the following, in any order: - /// * ast::StorageClass - specifies the variable storage class - /// * ast::Access - specifies the variable's access control - /// * ast::Expression* - specifies the variable's initializer expression - /// * ast::AttributeList - specifies the variable's attributes - /// Note that repeated arguments of the same type will use the last argument's - /// value. - /// @returns a new `ast::Variable`, which is automatically registered as a - /// global variable with the ast::Module. - template > - const ast::Variable* Global(NAME&& name, const ast::Type* type, OPTIONAL&&... optional) { - auto* var = Var(std::forward(name), type, std::forward(optional)...); - AST().AddGlobalVariable(var); - return var; - } - - /// @param source the variable source - /// @param name the variable name - /// @param type the variable type - /// @param optional the optional variable settings. - /// Can be any of the following, in any order: - /// * ast::StorageClass - specifies the variable storage class - /// * ast::Access - specifies the variable's access control - /// * ast::Expression* - specifies the variable's initializer expression - /// * ast::AttributeList - specifies the variable's attributes - /// Note that repeated arguments of the same type will use the last argument's - /// value. - /// @returns a new `ast::Variable`, which is automatically registered as a - /// global variable with the ast::Module. - template - const ast::Variable* Global(const Source& source, + const ast::Parameter* Param(const Source& source, NAME&& name, const ast::Type* type, - OPTIONAL&&... optional) { - auto* var = - Var(source, std::forward(name), type, std::forward(optional)...); - AST().AddGlobalVariable(var); - return var; + utils::VectorRef attributes = utils::Empty) { + return create(source, Sym(std::forward(name)), type, attributes); } /// @param name the variable name - /// @param type the variable type - /// @param constructor constructor expression - /// @param attributes optional variable attributes - /// @returns a const `ast::Variable` constructed by calling Var() with the - /// arguments of `args`, which is automatically registered as a global - /// variable with the ast::Module. - template - const ast::Variable* GlobalConst(NAME&& name, - const ast::Type* type, - const ast::Expression* constructor, - ast::AttributeList attributes = {}) { - auto* var = Let(std::forward(name), type, constructor, std::move(attributes)); - AST().AddGlobalVariable(var); - return var; + /// @param options the extra options passed to the ast::Var constructor + /// Can be any of the following, in any order: + /// * ast::Type* - specifies the variable type + /// * ast::StorageClass - specifies the variable storage class + /// * ast::Access - specifies the variable's access control + /// * ast::Expression* - specifies the variable's initializer expression + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns a new `ast::Var`, which is automatically registered as a global variable with the + /// ast::Module. + template > + const ast::Var* GlobalVar(NAME&& name, OPTIONS&&... options) { + auto* variable = Var(std::forward(name), std::forward(options)...); + AST().AddGlobalVariable(variable); + return variable; } /// @param source the variable source /// @param name the variable name - /// @param type the variable type - /// @param constructor constructor expression - /// @param attributes optional variable attributes - /// @returns a const `ast::Variable` constructed by calling Var() with the - /// arguments of `args`, which is automatically registered as a global - /// variable with the ast::Module. - template - const ast::Variable* GlobalConst(const Source& source, - NAME&& name, - const ast::Type* type, - const ast::Expression* constructor, - ast::AttributeList attributes = {}) { - auto* var = Let(source, std::forward(name), type, constructor, std::move(attributes)); - AST().AddGlobalVariable(var); - return var; + /// @param options the extra options passed to the ast::Var constructor + /// Can be any of the following, in any order: + /// * ast::Type* - specifies the variable type + /// * ast::StorageClass - specifies the variable storage class + /// * ast::Access - specifies the variable's access control + /// * ast::Expression* - specifies the variable's initializer expression + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns a new `ast::Var`, which is automatically registered as a global variable with the + /// ast::Module. + template + const ast::Var* GlobalVar(const Source& source, NAME&& name, OPTIONS&&... options) { + auto* variable = Var(source, std::forward(name), std::forward(options)...); + AST().AddGlobalVariable(variable); + return variable; } /// @param name the variable name - /// @param type the variable type - /// @param constructor optional constructor expression - /// @param attributes optional variable attributes - /// @returns an overridable const `ast::Variable` which is automatically - /// registered as a global variable with the ast::Module. - template - const ast::Variable* Override(NAME&& name, - const ast::Type* type, - const ast::Expression* constructor, - ast::AttributeList attributes = {}) { - auto* var = - create(source_, Sym(std::forward(name)), ast::StorageClass::kNone, - ast::Access::kUndefined, type, true /* is_const */, - true /* is_overridable */, constructor, std::move(attributes)); - AST().AddGlobalVariable(var); - return var; + /// @param options the extra options passed to the ast::Const constructor + /// Can be any of the following, in any order: + /// * ast::Expression* - specifies the variable's initializer expression (required) + /// * ast::Type* - specifies the variable type + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns an `ast::Const` with the given name, type and additional options, which is + /// automatically registered as a global variable with the ast::Module. + template > + const ast::Const* GlobalConst(NAME&& name, OPTIONS&&... options) { + auto* variable = Const(std::forward(name), std::forward(options)...); + AST().AddGlobalVariable(variable); + return variable; } /// @param source the variable source /// @param name the variable name - /// @param type the variable type - /// @param constructor constructor expression - /// @param attributes optional variable attributes - /// @returns a const `ast::Variable` constructed by calling Var() with the - /// arguments of `args`, which is automatically registered as a global - /// variable with the ast::Module. - template - const ast::Variable* Override(const Source& source, - NAME&& name, - const ast::Type* type, - const ast::Expression* constructor, - ast::AttributeList attributes = {}) { - auto* var = - create(source, Sym(std::forward(name)), ast::StorageClass::kNone, - ast::Access::kUndefined, type, true /* is_const */, - true /* is_overridable */, constructor, std::move(attributes)); - AST().AddGlobalVariable(var); - return var; + /// @param options the extra options passed to the ast::Const constructor + /// Can be any of the following, in any order: + /// * ast::Expression* - specifies the variable's initializer expression (required) + /// * ast::Type* - specifies the variable type + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns an `ast::Const` with the given name, type and additional options, which is + /// automatically registered as a global variable with the ast::Module. + template + const ast::Const* GlobalConst(const Source& source, NAME&& name, OPTIONS&&... options) { + auto* variable = Const(source, std::forward(name), std::forward(options)...); + AST().AddGlobalVariable(variable); + return variable; + } + + /// @param name the variable name + /// @param options the extra options passed to the ast::Override constructor + /// Can be any of the following, in any order: + /// * ast::Expression* - specifies the variable's initializer expression (required) + /// * ast::Type* - specifies the variable type + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns an `ast::Override` with the given name, type and additional options, which is + /// automatically registered as a global variable with the ast::Module. + template > + const ast::Override* Override(NAME&& name, OPTIONS&&... options) { + OverrideOptions opts(std::forward(options)...); + auto* variable = create(Sym(std::forward(name)), opts.type, + opts.constructor, std::move(opts.attributes)); + AST().AddGlobalVariable(variable); + return variable; + } + + /// @param source the variable source + /// @param name the variable name + /// @param options the extra options passed to the ast::Override constructor + /// Can be any of the following, in any order: + /// * ast::Expression* - specifies the variable's initializer expression (required) + /// * ast::Type* - specifies the variable type + /// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector) + /// Note that non-repeatable arguments of the same type will use the last argument's value. + /// @returns an `ast::Override` with the given name, type and additional options, which is + /// automatically registered as a global variable with the ast::Module. + template + const ast::Override* Override(const Source& source, NAME&& name, OPTIONS&&... options) { + OverrideOptions opts(std::forward(options)...); + auto* variable = create(source, Sym(std::forward(name)), opts.type, + opts.constructor, std::move(opts.attributes)); + AST().AddGlobalVariable(variable); + return variable; + } + + /// @param source the source information + /// @param condition the assertion condition + /// @returns a new `ast::StaticAssert`, which is automatically registered as a global statement + /// with the ast::Module. + template + const ast::StaticAssert* GlobalStaticAssert(const Source& source, EXPR&& condition) { + auto* sa = StaticAssert(source, std::forward(condition)); + AST().AddStaticAssert(sa); + return sa; + } + + /// @param condition the assertion condition + /// @returns a new `ast::StaticAssert`, which is automatically registered as a global statement + /// with the ast::Module. + template > + const ast::StaticAssert* GlobalStaticAssert(EXPR&& condition) { + auto* sa = StaticAssert(std::forward(condition)); + AST().AddStaticAssert(sa); + return sa; + } + + /// @param source the source information + /// @param condition the assertion condition + /// @returns a new `ast::StaticAssert` with the given assertion condition + template + const ast::StaticAssert* StaticAssert(const Source& source, EXPR&& condition) { + return create(source, Expr(std::forward(condition))); + } + + /// @param condition the assertion condition + /// @returns a new `ast::StaticAssert` with the given assertion condition + template > + const ast::StaticAssert* StaticAssert(EXPR&& condition) { + return create(Expr(std::forward(condition))); } /// @param source the source information @@ -1590,6 +2031,17 @@ class ProgramBuilder { Expr(std::forward(rhs))); } + /// @param source the source information + /// @param lhs the left hand argument to the addition operation + /// @param rhs the right hand argument to the addition operation + /// @returns a `ast::BinaryExpression` summing the arguments `lhs` and `rhs` + template + const ast::BinaryExpression* Add(const Source& source, LHS&& lhs, RHS&& rhs) { + return create(source, ast::BinaryOp::kAdd, + Expr(std::forward(lhs)), + Expr(std::forward(rhs))); + } + /// @param lhs the left hand argument to the and operation /// @param rhs the right hand argument to the and operation /// @returns a `ast::BinaryExpression` bitwise anding `lhs` and `rhs` @@ -1822,17 +2274,19 @@ class ProgramBuilder { /// Creates a ast::StructMemberAlignAttribute /// @param source the source information - /// @param val the align value + /// @param val the align value expression /// @returns the align attribute pointer - const ast::StructMemberAlignAttribute* MemberAlign(const Source& source, uint32_t val) { - return create(source, val); + template + const ast::StructMemberAlignAttribute* MemberAlign(const Source& source, EXPR&& val) { + return create(source, Expr(std::forward(val))); } /// Creates a ast::StructMemberAlignAttribute - /// @param val the align value + /// @param val the align value expression /// @returns the align attribute pointer - const ast::StructMemberAlignAttribute* MemberAlign(uint32_t val) { - return create(source_, val); + template + const ast::StructMemberAlignAttribute* MemberAlign(EXPR&& val) { + return create(source_, Expr(std::forward(val))); } /// Creates the ast::GroupAttribute @@ -1847,15 +2301,6 @@ class ProgramBuilder { return create(value); } - /// Convenience function to create both a ast::GroupAttribute and - /// ast::BindingAttribute - /// @param group the group index - /// @param binding the binding index - /// @returns a attribute list with both the group and binding attributes - ast::AttributeList GroupAndBinding(uint32_t group, uint32_t binding) { - return {Group(group), Binding(binding)}; - } - /// Creates an ast::Function and registers it with the ast::Module. /// @param source the source information /// @param name the function name @@ -1867,16 +2312,18 @@ class ProgramBuilder { /// attributes /// @returns the function pointer template - const ast::Function* Func(const Source& source, - NAME&& name, - ast::VariableList params, - const ast::Type* type, - ast::StatementList body, - ast::AttributeList attributes = {}, - ast::AttributeList return_type_attributes = {}) { - auto* func = create(source, Sym(std::forward(name)), params, type, - create(body), attributes, - return_type_attributes); + const ast::Function* Func( + const Source& source, + NAME&& name, + utils::VectorRef params, + const ast::Type* type, + utils::VectorRef body, + utils::VectorRef attributes = utils::Empty, + utils::VectorRef return_type_attributes = utils::Empty) { + auto* func = + create(source, Sym(std::forward(name)), std::move(params), type, + create(std::move(body)), + std::move(attributes), std::move(return_type_attributes)); AST().AddFunction(func); return func; } @@ -1891,15 +2338,17 @@ class ProgramBuilder { /// attributes /// @returns the function pointer template - const ast::Function* Func(NAME&& name, - ast::VariableList params, - const ast::Type* type, - ast::StatementList body, - ast::AttributeList attributes = {}, - ast::AttributeList return_type_attributes = {}) { - auto* func = create(Sym(std::forward(name)), params, type, - create(body), attributes, - return_type_attributes); + const ast::Function* Func( + NAME&& name, + utils::VectorRef params, + const ast::Type* type, + utils::VectorRef body, + utils::VectorRef attributes = utils::Empty, + utils::VectorRef return_type_attributes = utils::Empty) { + auto* func = + create(Sym(std::forward(name)), std::move(params), type, + create(std::move(body)), + std::move(attributes), std::move(return_type_attributes)); AST().AddFunction(func); return func; } @@ -1994,9 +2443,11 @@ class ProgramBuilder { /// @param members the struct members /// @returns the struct type template - const ast::Struct* Structure(const Source& source, NAME&& name, ast::StructMemberList members) { + const ast::Struct* Structure(const Source& source, + NAME&& name, + utils::VectorRef members) { auto sym = Sym(std::forward(name)); - auto* type = create(source, sym, std::move(members), ast::AttributeList{}); + auto* type = create(source, sym, std::move(members), utils::Empty); AST().AddTypeDecl(type); return type; } @@ -2006,9 +2457,9 @@ class ProgramBuilder { /// @param members the struct members /// @returns the struct type template - const ast::Struct* Structure(NAME&& name, ast::StructMemberList members) { + const ast::Struct* Structure(NAME&& name, utils::VectorRef members) { auto sym = Sym(std::forward(name)); - auto* type = create(sym, std::move(members), ast::AttributeList{}); + auto* type = create(sym, std::move(members), utils::Empty); AST().AddTypeDecl(type); return type; } @@ -2020,10 +2471,11 @@ class ProgramBuilder { /// @param attributes the optional struct member attributes /// @returns the struct member pointer template - const ast::StructMember* Member(const Source& source, - NAME&& name, - const ast::Type* type, - ast::AttributeList attributes = {}) { + const ast::StructMember* Member( + const Source& source, + NAME&& name, + const ast::Type* type, + utils::VectorRef attributes = utils::Empty) { return create(source, Sym(std::forward(name)), type, std::move(attributes)); } @@ -2034,22 +2486,23 @@ class ProgramBuilder { /// @param attributes the optional struct member attributes /// @returns the struct member pointer template - const ast::StructMember* Member(NAME&& name, - const ast::Type* type, - ast::AttributeList attributes = {}) { + const ast::StructMember* Member( + NAME&& name, + const ast::Type* type, + utils::VectorRef attributes = utils::Empty) { return create(source_, Sym(std::forward(name)), type, std::move(attributes)); } /// Creates a ast::StructMember with the given byte offset - /// @param offset the offset to use in the StructMemberOffsetattribute + /// @param offset the offset to use in the StructMemberOffsetAttribute /// @param name the struct member name /// @param type the struct member type /// @returns the struct member pointer template const ast::StructMember* Member(uint32_t offset, NAME&& name, const ast::Type* type) { return create(source_, Sym(std::forward(name)), type, - ast::AttributeList{ + utils::Vector{ create(offset), }); } @@ -2061,7 +2514,9 @@ class ProgramBuilder { template const ast::BlockStatement* Block(const Source& source, Statements&&... statements) { return create( - source, ast::StatementList{std::forward(statements)...}); + source, utils::Vector{ + std::forward(statements)..., + }); } /// Creates a ast::BlockStatement with input statements @@ -2070,7 +2525,9 @@ class ProgramBuilder { template > const ast::BlockStatement* Block(STATEMENTS&&... statements) { return create( - ast::StatementList{std::forward(statements)...}); + utils::Vector{ + std::forward(statements)..., + }); } /// A wrapper type for the Else statement used to create If statements. @@ -2267,6 +2724,27 @@ class ProgramBuilder { return create(init, Expr(std::forward(cond)), cont, body); } + /// Creates a ast::WhileStatement with input body and condition. + /// @param source the source information + /// @param cond the loop condition + /// @param body the loop body + /// @returns the while statement pointer + template + const ast::WhileStatement* While(const Source& source, + COND&& cond, + const ast::BlockStatement* body) { + return create(source, Expr(std::forward(cond)), body); + } + + /// Creates a ast::WhileStatement with given condition and body. + /// @param cond the condition + /// @param body the loop body + /// @returns the while loop statement pointer + template + const ast::WhileStatement* While(COND&& cond, const ast::BlockStatement* body) { + return create(Expr(std::forward(cond)), body); + } + /// Creates a ast::VariableDeclStatement for the input variable /// @param source the source information /// @param var the variable to wrap in a decl statement @@ -2291,8 +2769,10 @@ class ProgramBuilder { const ast::SwitchStatement* Switch(const Source& source, ExpressionInit&& condition, Cases&&... cases) { - return create(source, Expr(std::forward(condition)), - ast::CaseStatementList{std::forward(cases)...}); + return create( + source, Expr(std::forward(condition)), + utils::Vector{ + std::forward(cases)...}); } /// Creates a ast::SwitchStatement with input expression and cases @@ -2303,8 +2783,10 @@ class ProgramBuilder { typename... Cases, typename = DisableIfSource> const ast::SwitchStatement* Switch(ExpressionInit&& condition, Cases&&... cases) { - return create(Expr(std::forward(condition)), - ast::CaseStatementList{std::forward(cases)...}); + return create( + Expr(std::forward(condition)), + utils::Vector{ + std::forward(cases)...}); } /// Creates a ast::CaseStatement with input list of selectors, and body @@ -2313,7 +2795,7 @@ class ProgramBuilder { /// @param body the case body /// @returns the case statement pointer const ast::CaseStatement* Case(const Source& source, - ast::CaseSelectorList selectors, + utils::VectorRef selectors, const ast::BlockStatement* body = nullptr) { return create(source, std::move(selectors), body ? body : Block()); } @@ -2322,7 +2804,7 @@ class ProgramBuilder { /// @param selectors list of selectors /// @param body the case body /// @returns the case statement pointer - const ast::CaseStatement* Case(ast::CaseSelectorList selectors, + const ast::CaseStatement* Case(utils::VectorRef selectors, const ast::BlockStatement* body = nullptr) { return create(std::move(selectors), body ? body : Block()); } @@ -2333,7 +2815,7 @@ class ProgramBuilder { /// @returns the case statement pointer const ast::CaseStatement* Case(const ast::IntLiteralExpression* selector, const ast::BlockStatement* body = nullptr) { - return Case(ast::CaseSelectorList{selector}, body); + return Case(utils::Vector{selector}, body); } /// Convenience function that creates a 'default' ast::CaseStatement @@ -2342,14 +2824,14 @@ class ProgramBuilder { /// @returns the case statement pointer const ast::CaseStatement* DefaultCase(const Source& source, const ast::BlockStatement* body = nullptr) { - return Case(source, ast::CaseSelectorList{}, body); + return Case(source, utils::Empty, body); } /// Convenience function that creates a 'default' ast::CaseStatement /// @param body the case body /// @returns the case statement pointer const ast::CaseStatement* DefaultCase(const ast::BlockStatement* body = nullptr) { - return Case(ast::CaseSelectorList{}, body); + return Case(utils::Empty, body); } /// Creates an ast::FallthroughStatement @@ -2367,14 +2849,14 @@ class ProgramBuilder { /// @param source the source information /// @param builtin the builtin value /// @returns the builtin attribute pointer - const ast::BuiltinAttribute* Builtin(const Source& source, ast::Builtin builtin) { + const ast::BuiltinAttribute* Builtin(const Source& source, ast::BuiltinValue builtin) { return create(source, builtin); } /// Creates an ast::BuiltinAttribute /// @param builtin the builtin value /// @returns the builtin attribute pointer - const ast::BuiltinAttribute* Builtin(ast::Builtin builtin) { + const ast::BuiltinAttribute* Builtin(ast::BuiltinValue builtin) { return create(source_, builtin); } @@ -2437,6 +2919,19 @@ class ProgramBuilder { return create(source_, location); } + /// Creates an ast::IdAttribute + /// @param source the source information + /// @param id the id value + /// @returns the override attribute pointer + const ast::IdAttribute* Id(const Source& source, OverrideId id) { + return create(source, id.value); + } + + /// Creates an ast::IdAttribute with an override identifier + /// @param id the optional id value + /// @returns the override attribute pointer + const ast::IdAttribute* Id(OverrideId id) { return Id(source_, id); } + /// Creates an ast::IdAttribute /// @param source the source information /// @param id the id value @@ -2445,7 +2940,7 @@ class ProgramBuilder { return create(source, id); } - /// Creates an ast::IdAttribute with a constant ID + /// Creates an ast::IdAttribute with an override identifier /// @param id the optional id value /// @returns the override attribute pointer const ast::IdAttribute* Id(uint32_t id) { return Id(source_, id); } @@ -2474,10 +2969,29 @@ class ProgramBuilder { } /// Creates an ast::WorkgroupAttribute + /// @param source the source information + /// @param x the x dimension expression + /// @returns the workgroup attribute pointer + template + const ast::WorkgroupAttribute* WorkgroupSize(const Source& source, EXPR_X&& x) { + return WorkgroupSize(source, std::forward(x), nullptr, nullptr); + } + + /// Creates an ast::WorkgroupAttribute + /// @param source the source information /// @param x the x dimension expression /// @param y the y dimension expression /// @returns the workgroup attribute pointer template + const ast::WorkgroupAttribute* WorkgroupSize(const Source& source, EXPR_X&& x, EXPR_Y&& y) { + return WorkgroupSize(source, std::forward(x), std::forward(y), nullptr); + } + + /// Creates an ast::WorkgroupAttribute + /// @param x the x dimension expression + /// @param y the y dimension expression + /// @returns the workgroup attribute pointer + template > const ast::WorkgroupAttribute* WorkgroupSize(EXPR_X&& x, EXPR_Y&& y) { return WorkgroupSize(std::forward(x), std::forward(y), nullptr); } @@ -2503,7 +3017,7 @@ class ProgramBuilder { /// @param y the y dimension expression /// @param z the z dimension expression /// @returns the workgroup attribute pointer - template + template > const ast::WorkgroupAttribute* WorkgroupSize(EXPR_X&& x, EXPR_Y&& y, EXPR_Z&& z) { return create(source_, Expr(std::forward(x)), Expr(std::forward(y)), @@ -2514,7 +3028,8 @@ class ProgramBuilder { /// @param validation the validation to disable /// @returns the disable validation attribute pointer const ast::DisableValidationAttribute* Disable(ast::DisabledValidation validation) { - return ASTNodes().Create(ID(), validation); + return ASTNodes().Create(ID(), AllocateNodeID(), + validation); } /// Sets the current builder source to `src` @@ -2564,6 +3079,25 @@ class ProgramBuilder { /// the type declaration has no resolved type. const sem::Type* TypeOf(const ast::TypeDecl* type_decl) const; + /// @param type a type + /// @returns the name for `type` that closely resembles how it would be + /// declared in WGSL. + std::string FriendlyName(const ast::Type* type) { + return type ? type->FriendlyName(Symbols()) : ""; + } + + /// @param type a type + /// @returns the name for `type` that closely resembles how it would be + /// declared in WGSL. + std::string FriendlyName(const sem::Type* type) { + return type ? type->FriendlyName(Symbols()) : ""; + } + + /// Overload of FriendlyName, which removes an ambiguity when passing nullptr. + /// Simplifies test code. + /// @returns "" + std::string FriendlyName(std::nullptr_t) { return ""; } + /// Wraps the ast::Expression in a statement. This is used by tests that /// construct a partial AST and require the Resolver to reach these /// nodes. @@ -2587,13 +3121,15 @@ class ProgramBuilder { /// @returns the function template const ast::Function* WrapInFunction(ARGS&&... args) { - ast::StatementList stmts{WrapInStatement(std::forward(args))...}; - return WrapInFunction(std::move(stmts)); + utils::Vector stmts{ + WrapInStatement(std::forward(args))..., + }; + return WrapInFunction(utils::VectorRef{std::move(stmts)}); } /// @param stmts a list of ast::Statement that will be wrapped by a function, /// so that each statement is reachable by the Resolver. /// @returns the function - const ast::Function* WrapInFunction(ast::StatementList stmts); + const ast::Function* WrapInFunction(utils::VectorRef stmts); /// The builder types TypesBuilder const ty{this}; @@ -2604,9 +3140,11 @@ class ProgramBuilder { private: ProgramID id_; + ast::NodeID last_ast_node_id_ = ast::NodeID{static_cast(0) - 1}; sem::Manager types_; ASTNodeAllocator ast_nodes_; SemNodeAllocator sem_nodes_; + ConstantAllocator constant_nodes_; ast::Module* ast_; sem::Info sem_; SymbolTable symbols_{id_}; @@ -2639,6 +3177,10 @@ struct ProgramBuilder::TypesBuilder::CToAST { static const ast::Type* get(const ProgramBuilder::TypesBuilder* t) { return t->f32(); } }; template <> +struct ProgramBuilder::TypesBuilder::CToAST { + static const ast::Type* get(const ProgramBuilder::TypesBuilder* t) { return t->f16(); } +}; +template <> struct ProgramBuilder::TypesBuilder::CToAST { static const ast::Type* get(const ProgramBuilder::TypesBuilder* t) { return t->bool_(); } }; diff --git a/src/tint/program_builder_test.cc b/src/tint/program_builder_test.cc index dd7e7a8c37..24e7344a98 100644 --- a/src/tint/program_builder_test.cc +++ b/src/tint/program_builder_test.cc @@ -38,14 +38,14 @@ TEST_F(ProgramBuilderTest, WrapDoesntAffectInner) { return builder; }()); - ASSERT_EQ(inner.AST().Functions().size(), 1u); + ASSERT_EQ(inner.AST().Functions().Length(), 1u); ASSERT_TRUE(inner.Symbols().Get("a").IsValid()); ASSERT_FALSE(inner.Symbols().Get("b").IsValid()); ProgramBuilder outer = ProgramBuilder::Wrap(&inner); - ASSERT_EQ(inner.AST().Functions().size(), 1u); - ASSERT_EQ(outer.AST().Functions().size(), 1u); + ASSERT_EQ(inner.AST().Functions().Length(), 1u); + ASSERT_EQ(outer.AST().Functions().Length(), 1u); EXPECT_EQ(inner.AST().Functions()[0], outer.AST().Functions()[0]); EXPECT_TRUE(inner.Symbols().Get("a").IsValid()); EXPECT_EQ(inner.Symbols().Get("a"), outer.Symbols().Get("a")); @@ -57,8 +57,8 @@ TEST_F(ProgramBuilderTest, WrapDoesntAffectInner) { auto* ty = outer.ty.f32(); outer.Func("b", {}, ty, {}, {}); - ASSERT_EQ(inner.AST().Functions().size(), 1u); - ASSERT_EQ(outer.AST().Functions().size(), 2u); + ASSERT_EQ(inner.AST().Functions().Length(), 1u); + ASSERT_EQ(outer.AST().Functions().Length(), 2u); EXPECT_EQ(inner.AST().Functions()[0], outer.AST().Functions()[0]); EXPECT_EQ(outer.AST().Functions()[1]->symbol, outer.Symbols().Get("b")); EXPECT_EQ(inner.Symbols().Get("a"), outer.Symbols().Get("a")); diff --git a/src/tint/program_test.cc b/src/tint/program_test.cc index 3bdf11ac92..39d7c07c14 100644 --- a/src/tint/program_test.cc +++ b/src/tint/program_test.cc @@ -28,7 +28,7 @@ TEST_F(ProgramTest, Unbuilt) { TEST_F(ProgramTest, Creation) { Program program(std::move(*this)); - EXPECT_EQ(program.AST().Functions().size(), 0u); + EXPECT_EQ(program.AST().Functions().Length(), 0u); } TEST_F(ProgramTest, EmptyIsValid) { @@ -46,7 +46,7 @@ TEST_F(ProgramTest, IDsAreUnique) { } TEST_F(ProgramTest, Assert_GlobalVariable) { - Global("var", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("var", ty.f32(), ast::StorageClass::kPrivate); Program program(std::move(*this)); EXPECT_TRUE(program.IsValid()); diff --git a/src/tint/reader/spirv/construct.h b/src/tint/reader/spirv/construct.h index de4e477a29..cd0804a480 100644 --- a/src/tint/reader/spirv/construct.h +++ b/src/tint/reader/spirv/construct.h @@ -18,7 +18,8 @@ #include #include #include -#include + +#include "src/tint/utils/vector.h" namespace tint::reader::spirv { @@ -146,7 +147,7 @@ struct Construct { }; /// ConstructList is a list of Construct unique pointers. -using ConstructList = std::vector>; +using ConstructList = utils::Vector, 8>; /// Converts a construct kind to a string. /// @param kind the construct kind to convert diff --git a/src/tint/reader/spirv/entry_point_info.cc b/src/tint/reader/spirv/entry_point_info.cc index 2677494a12..9e3604afe5 100644 --- a/src/tint/reader/spirv/entry_point_info.cc +++ b/src/tint/reader/spirv/entry_point_info.cc @@ -22,8 +22,8 @@ EntryPointInfo::EntryPointInfo(std::string the_name, ast::PipelineStage the_stage, bool the_owns_inner_implementation, std::string the_inner_name, - std::vector&& the_inputs, - std::vector&& the_outputs, + utils::VectorRef the_inputs, + utils::VectorRef the_outputs, GridSize the_wg_size) : name(the_name), stage(the_stage), diff --git a/src/tint/reader/spirv/entry_point_info.h b/src/tint/reader/spirv/entry_point_info.h index bc13759f00..90077421d1 100644 --- a/src/tint/reader/spirv/entry_point_info.h +++ b/src/tint/reader/spirv/entry_point_info.h @@ -16,9 +16,9 @@ #define SRC_TINT_READER_SPIRV_ENTRY_POINT_INFO_H_ #include -#include #include "src/tint/ast/pipeline_stage.h" +#include "src/tint/utils/vector.h" namespace tint::reader::spirv { @@ -48,8 +48,8 @@ struct EntryPointInfo { ast::PipelineStage the_stage, bool the_owns_inner_implementation, std::string the_inner_name, - std::vector&& the_inputs, - std::vector&& the_outputs, + utils::VectorRef the_inputs, + utils::VectorRef the_outputs, GridSize the_wg_size); /// Copy constructor /// @param other the other entry point info to be built from @@ -75,9 +75,9 @@ struct EntryPointInfo { /// The name of the inner implementation function of the entry point. std::string inner_name; /// IDs of pipeline input variables, sorted and without duplicates. - std::vector inputs; + utils::Vector inputs; /// IDs of pipeline output variables, sorted and without duplicates. - std::vector outputs; + utils::Vector outputs; /// If this is a compute shader, this is the workgroup size in the x, y, /// and z dimensions set via LocalSize, or via the composite value diff --git a/src/tint/reader/spirv/enum_converter.cc b/src/tint/reader/spirv/enum_converter.cc index 1d58eee8dc..879167032f 100644 --- a/src/tint/reader/spirv/enum_converter.cc +++ b/src/tint/reader/spirv/enum_converter.cc @@ -39,9 +39,9 @@ ast::PipelineStage EnumConverter::ToPipelineStage(SpvExecutionModel model) { ast::StorageClass EnumConverter::ToStorageClass(const SpvStorageClass sc) { switch (sc) { case SpvStorageClassInput: - return ast::StorageClass::kInput; + return ast::StorageClass::kIn; case SpvStorageClassOutput: - return ast::StorageClass::kOutput; + return ast::StorageClass::kOut; case SpvStorageClassUniform: return ast::StorageClass::kUniform; case SpvStorageClassWorkgroup: @@ -62,38 +62,38 @@ ast::StorageClass EnumConverter::ToStorageClass(const SpvStorageClass sc) { return ast::StorageClass::kInvalid; } -ast::Builtin EnumConverter::ToBuiltin(SpvBuiltIn b) { +ast::BuiltinValue EnumConverter::ToBuiltin(SpvBuiltIn b) { switch (b) { case SpvBuiltInPosition: - return ast::Builtin::kPosition; + return ast::BuiltinValue::kPosition; case SpvBuiltInVertexIndex: - return ast::Builtin::kVertexIndex; + return ast::BuiltinValue::kVertexIndex; case SpvBuiltInInstanceIndex: - return ast::Builtin::kInstanceIndex; + return ast::BuiltinValue::kInstanceIndex; case SpvBuiltInFrontFacing: - return ast::Builtin::kFrontFacing; + return ast::BuiltinValue::kFrontFacing; case SpvBuiltInFragCoord: - return ast::Builtin::kPosition; + return ast::BuiltinValue::kPosition; case SpvBuiltInFragDepth: - return ast::Builtin::kFragDepth; + return ast::BuiltinValue::kFragDepth; case SpvBuiltInLocalInvocationId: - return ast::Builtin::kLocalInvocationId; + return ast::BuiltinValue::kLocalInvocationId; case SpvBuiltInLocalInvocationIndex: - return ast::Builtin::kLocalInvocationIndex; + return ast::BuiltinValue::kLocalInvocationIndex; case SpvBuiltInGlobalInvocationId: - return ast::Builtin::kGlobalInvocationId; + return ast::BuiltinValue::kGlobalInvocationId; case SpvBuiltInWorkgroupId: - return ast::Builtin::kWorkgroupId; + return ast::BuiltinValue::kWorkgroupId; case SpvBuiltInSampleId: - return ast::Builtin::kSampleIndex; + return ast::BuiltinValue::kSampleIndex; case SpvBuiltInSampleMask: - return ast::Builtin::kSampleMask; + return ast::BuiltinValue::kSampleMask; default: break; } Fail() << "unknown SPIR-V builtin: " << uint32_t(b); - return ast::Builtin::kNone; + return ast::BuiltinValue::kInvalid; } ast::TextureDimension EnumConverter::ToDim(SpvDim dim, bool arrayed) { @@ -129,7 +129,7 @@ ast::TextureDimension EnumConverter::ToDim(SpvDim dim, bool arrayed) { ast::TexelFormat EnumConverter::ToTexelFormat(SpvImageFormat fmt) { switch (fmt) { case SpvImageFormatUnknown: - return ast::TexelFormat::kNone; + return ast::TexelFormat::kInvalid; // 8 bit channels case SpvImageFormatRgba8: @@ -172,7 +172,7 @@ ast::TexelFormat EnumConverter::ToTexelFormat(SpvImageFormat fmt) { break; } Fail() << "invalid image format: " << int(fmt); - return ast::TexelFormat::kNone; + return ast::TexelFormat::kInvalid; } } // namespace tint::reader::spirv diff --git a/src/tint/reader/spirv/enum_converter.h b/src/tint/reader/spirv/enum_converter.h index ac86f71896..fc3ad83abf 100644 --- a/src/tint/reader/spirv/enum_converter.h +++ b/src/tint/reader/spirv/enum_converter.h @@ -16,7 +16,7 @@ #define SRC_TINT_READER_SPIRV_ENUM_CONVERTER_H_ #include "spirv/unified1/spirv.h" -#include "src/tint/ast/builtin.h" +#include "src/tint/ast/builtin_value.h" #include "src/tint/ast/pipeline_stage.h" #include "src/tint/ast/storage_class.h" #include "src/tint/reader/spirv/fail_stream.h" @@ -49,7 +49,7 @@ class EnumConverter { /// On failure, logs an error and returns kNone /// @param b the SPIR-V builtin /// @returns a Tint AST builtin - ast::Builtin ToBuiltin(SpvBuiltIn b); + ast::BuiltinValue ToBuiltin(SpvBuiltIn b); /// Converts a possibly arrayed SPIR-V Dim to a Tint texture dimension. /// On failure, logs an error and returns kNone diff --git a/src/tint/reader/spirv/enum_converter_test.cc b/src/tint/reader/spirv/enum_converter_test.cc index 791d7e352c..95a6264967 100644 --- a/src/tint/reader/spirv/enum_converter_test.cc +++ b/src/tint/reader/spirv/enum_converter_test.cc @@ -125,8 +125,8 @@ INSTANTIATE_TEST_SUITE_P( EnumConverterGood, SpvStorageClassTest, testing::Values( - StorageClassCase{SpvStorageClassInput, true, ast::StorageClass::kInput}, - StorageClassCase{SpvStorageClassOutput, true, ast::StorageClass::kOutput}, + StorageClassCase{SpvStorageClassInput, true, ast::StorageClass::kIn}, + StorageClassCase{SpvStorageClassOutput, true, ast::StorageClass::kOut}, StorageClassCase{SpvStorageClassUniform, true, ast::StorageClass::kUniform}, StorageClassCase{SpvStorageClassWorkgroup, true, ast::StorageClass::kWorkgroup}, StorageClassCase{SpvStorageClassUniformConstant, true, ast::StorageClass::kNone}, @@ -144,7 +144,7 @@ INSTANTIATE_TEST_SUITE_P(EnumConverterBad, struct BuiltinCase { SpvBuiltIn builtin; bool expect_success; - ast::Builtin expected; + ast::BuiltinValue expected; }; inline std::ostream& operator<<(std::ostream& out, BuiltinCase bc) { out << "BuiltinCase{ SpvBuiltIn:" << int(bc.builtin) @@ -184,30 +184,30 @@ INSTANTIATE_TEST_SUITE_P( EnumConverterGood_Input, SpvBuiltinTest, testing::Values( - BuiltinCase{SpvBuiltInPosition, true, ast::Builtin::kPosition}, - BuiltinCase{SpvBuiltInInstanceIndex, true, ast::Builtin::kInstanceIndex}, - BuiltinCase{SpvBuiltInFrontFacing, true, ast::Builtin::kFrontFacing}, - BuiltinCase{SpvBuiltInFragCoord, true, ast::Builtin::kPosition}, - BuiltinCase{SpvBuiltInLocalInvocationId, true, ast::Builtin::kLocalInvocationId}, - BuiltinCase{SpvBuiltInLocalInvocationIndex, true, ast::Builtin::kLocalInvocationIndex}, - BuiltinCase{SpvBuiltInGlobalInvocationId, true, ast::Builtin::kGlobalInvocationId}, - BuiltinCase{SpvBuiltInWorkgroupId, true, ast::Builtin::kWorkgroupId}, - BuiltinCase{SpvBuiltInSampleId, true, ast::Builtin::kSampleIndex}, - BuiltinCase{SpvBuiltInSampleMask, true, ast::Builtin::kSampleMask})); + BuiltinCase{SpvBuiltInPosition, true, ast::BuiltinValue::kPosition}, + BuiltinCase{SpvBuiltInInstanceIndex, true, ast::BuiltinValue::kInstanceIndex}, + BuiltinCase{SpvBuiltInFrontFacing, true, ast::BuiltinValue::kFrontFacing}, + BuiltinCase{SpvBuiltInFragCoord, true, ast::BuiltinValue::kPosition}, + BuiltinCase{SpvBuiltInLocalInvocationId, true, ast::BuiltinValue::kLocalInvocationId}, + BuiltinCase{SpvBuiltInLocalInvocationIndex, true, ast::BuiltinValue::kLocalInvocationIndex}, + BuiltinCase{SpvBuiltInGlobalInvocationId, true, ast::BuiltinValue::kGlobalInvocationId}, + BuiltinCase{SpvBuiltInWorkgroupId, true, ast::BuiltinValue::kWorkgroupId}, + BuiltinCase{SpvBuiltInSampleId, true, ast::BuiltinValue::kSampleIndex}, + BuiltinCase{SpvBuiltInSampleMask, true, ast::BuiltinValue::kSampleMask})); INSTANTIATE_TEST_SUITE_P( EnumConverterGood_Output, SpvBuiltinTest, - testing::Values(BuiltinCase{SpvBuiltInPosition, true, ast::Builtin::kPosition}, - BuiltinCase{SpvBuiltInFragDepth, true, ast::Builtin::kFragDepth}, - BuiltinCase{SpvBuiltInSampleMask, true, ast::Builtin::kSampleMask})); + testing::Values(BuiltinCase{SpvBuiltInPosition, true, ast::BuiltinValue::kPosition}, + BuiltinCase{SpvBuiltInFragDepth, true, ast::BuiltinValue::kFragDepth}, + BuiltinCase{SpvBuiltInSampleMask, true, ast::BuiltinValue::kSampleMask})); INSTANTIATE_TEST_SUITE_P( EnumConverterBad, SpvBuiltinTest, - testing::Values(BuiltinCase{static_cast(9999), false, ast::Builtin::kNone}, - BuiltinCase{static_cast(9999), false, ast::Builtin::kNone}, - BuiltinCase{SpvBuiltInNumWorkgroups, false, ast::Builtin::kNone})); + testing::Values(BuiltinCase{static_cast(9999), false, ast::BuiltinValue::kInvalid}, + BuiltinCase{static_cast(9999), false, ast::BuiltinValue::kInvalid}, + BuiltinCase{SpvBuiltInNumWorkgroups, false, ast::BuiltinValue::kInvalid})); // Dim @@ -326,7 +326,7 @@ INSTANTIATE_TEST_SUITE_P( SpvImageFormatTest, testing::Values( // Unknown. This is used for sampled images. - TexelFormatCase{SpvImageFormatUnknown, true, ast::TexelFormat::kNone}, + TexelFormatCase{SpvImageFormatUnknown, true, ast::TexelFormat::kInvalid}, // 8 bit channels TexelFormatCase{SpvImageFormatRgba8, true, ast::TexelFormat::kRgba8Unorm}, TexelFormatCase{SpvImageFormatRgba8Snorm, true, ast::TexelFormat::kRgba8Snorm}, @@ -355,23 +355,23 @@ INSTANTIATE_TEST_SUITE_P( SpvImageFormatTest, testing::Values( // Scanning in order from the SPIR-V spec. - TexelFormatCase{SpvImageFormatRg16f, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatR11fG11fB10f, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatR16f, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRgb10A2, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRg16, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRg8, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatR16, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatR8, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRgba16Snorm, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRg16Snorm, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRg8Snorm, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRg16i, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRg8i, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatR8i, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRgb10a2ui, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRg16ui, false, ast::TexelFormat::kNone}, - TexelFormatCase{SpvImageFormatRg8ui, false, ast::TexelFormat::kNone})); + TexelFormatCase{SpvImageFormatRg16f, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatR11fG11fB10f, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatR16f, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRgb10A2, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRg16, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRg8, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatR16, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatR8, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRgba16Snorm, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRg16Snorm, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRg8Snorm, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRg16i, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRg8i, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatR8i, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRgb10a2ui, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRg16ui, false, ast::TexelFormat::kInvalid}, + TexelFormatCase{SpvImageFormatRg8ui, false, ast::TexelFormat::kInvalid})); } // namespace } // namespace tint::reader::spirv diff --git a/src/tint/reader/spirv/function.cc b/src/tint/reader/spirv/function.cc index b416a6a9ad..a57984b820 100644 --- a/src/tint/reader/spirv/function.cc +++ b/src/tint/reader/spirv/function.cc @@ -20,8 +20,8 @@ #include "src/tint/ast/assignment_statement.h" #include "src/tint/ast/bitcast_expression.h" #include "src/tint/ast/break_statement.h" -#include "src/tint/ast/builtin.h" #include "src/tint/ast/builtin_attribute.h" +#include "src/tint/ast/builtin_value.h" #include "src/tint/ast/call_statement.h" #include "src/tint/ast/continue_statement.h" #include "src/tint/ast/discard_statement.h" @@ -36,6 +36,7 @@ #include "src/tint/sem/builtin_type.h" #include "src/tint/sem/depth_texture.h" #include "src/tint/sem/sampled_texture.h" +#include "src/tint/transform/spirv_atomic.h" // Terms: // CFG: the control flow graph of the function, where basic blocks are the @@ -137,6 +138,8 @@ // constructs // +using namespace tint::number_suffixes; // NOLINT + namespace tint::reader::spirv { namespace { @@ -498,6 +501,38 @@ bool IsSampledImageAccess(SpvOp opcode) { return false; } +// @param opcode a SPIR-V opcode +// @returns true if the given instruction is an atomic operation. +bool IsAtomicOp(SpvOp opcode) { + switch (opcode) { + case SpvOpAtomicLoad: + case SpvOpAtomicStore: + case SpvOpAtomicExchange: + case SpvOpAtomicCompareExchange: + case SpvOpAtomicCompareExchangeWeak: + case SpvOpAtomicIIncrement: + case SpvOpAtomicIDecrement: + case SpvOpAtomicIAdd: + case SpvOpAtomicISub: + case SpvOpAtomicSMin: + case SpvOpAtomicUMin: + case SpvOpAtomicSMax: + case SpvOpAtomicUMax: + case SpvOpAtomicAnd: + case SpvOpAtomicOr: + case SpvOpAtomicXor: + case SpvOpAtomicFlagTestAndSet: + case SpvOpAtomicFlagClear: + case SpvOpAtomicFMinEXT: + case SpvOpAtomicFMaxEXT: + case SpvOpAtomicFAddEXT: + return true; + default: + break; + } + return false; +} + // @param opcode a SPIR-V opcode // @returns true if the given instruction is an image sampling, gather, // or gather-compare operation. @@ -587,7 +622,7 @@ class StructuredTraverser { // - a continue target always follows the associated loop construct, if any // @returns the IDs of blocks in reverse structured post order std::vector ReverseStructuredPostOrder() { - visit_order_.clear(); + visit_order_.Clear(); visited_.clear(); VisitBackward(function_.entry()->id()); @@ -600,10 +635,12 @@ class StructuredTraverser { // header, we will visit its merge block, then its continue target (if any). // Also records the post order ordering. void VisitBackward(uint32_t id) { - if (id == 0) + if (id == 0) { return; - if (visited_.count(id)) + } + if (visited_.count(id)) { return; + } visited_.insert(id); const spvtools::opt::BasicBlock* bb = id_to_block_[id]; // non-null for valid modules @@ -623,20 +660,20 @@ class StructuredTraverser { VisitBackward(terminator->GetSingleWordInOperand(0)); } else if (opcode == SpvOpSwitch) { // TODO(dneto): Consider visiting the labels in literal-value order. - std::vector successors; + utils::Vector successors; bb->ForEachSuccessorLabel( - [&successors](const uint32_t succ_id) { successors.push_back(succ_id); }); + [&successors](const uint32_t succ_id) { successors.Push(succ_id); }); for (auto succ_id : successors) { VisitBackward(succ_id); } } - visit_order_.push_back(id); + visit_order_.Push(id); } const spvtools::opt::Function& function_; std::unordered_map id_to_block_; - std::vector visit_order_; + utils::Vector visit_order_; std::unordered_set visited_; }; @@ -655,13 +692,14 @@ struct SwitchStatementBuilder final : public Castablecreate(Source{}, condition, reversed_cases); + return builder->create(Source{}, condition, + std::move(reversed_cases)); } /// Switch statement condition const ast::Expression* const condition; /// Switch statement cases - ast::CaseStatementList cases; + utils::Vector cases; }; /// A StatementBuilder for ast::IfStatement @@ -707,9 +745,9 @@ struct LoopStatementBuilder final : public Castable decos) { if (auto* builtin = ast::GetAttribute(decos)) { - return builtin->builtin == ast::Builtin::kSampleMask; + return builtin->builtin == ast::BuiltinValue::kSampleMask; } return false; } @@ -721,9 +759,13 @@ BlockInfo::BlockInfo(const spvtools::opt::BasicBlock& bb) : basic_block(&bb), id BlockInfo::~BlockInfo() = default; DefInfo::DefInfo(const spvtools::opt::Instruction& def_inst, + bool the_locally_defined, uint32_t the_block_pos, size_t the_index) - : inst(def_inst), block_pos(the_block_pos), index(the_index) {} + : inst(def_inst), + locally_defined(the_locally_defined), + block_pos(the_block_pos), + index(the_index) {} DefInfo::~DefInfo() = default; @@ -767,7 +809,7 @@ FunctionEmitter::FunctionEmitter(FunctionEmitter&& other) sample_mask_in_id(other.sample_mask_out_id), sample_mask_out_id(other.sample_mask_in_id), ep_info_(other.ep_info_) { - other.statements_stack_.clear(); + other.statements_stack_.Clear(); PushNewStatementBlock(nullptr, 0, nullptr); } @@ -785,7 +827,7 @@ FunctionEmitter::StatementBlock::~StatementBlock() = default; void FunctionEmitter::StatementBlock::Finalize(ProgramBuilder* pb) { TINT_ASSERT(Reader, !finalized_ /* Finalize() must only be called once */); - for (size_t i = 0; i < statements_.size(); i++) { + for (size_t i = 0; i < statements_.Length(); i++) { if (auto* sb = statements_[i]->As()) { statements_[i] = sb->Build(pb); } @@ -800,64 +842,64 @@ void FunctionEmitter::StatementBlock::Finalize(ProgramBuilder* pb) { void FunctionEmitter::StatementBlock::Add(const ast::Statement* statement) { TINT_ASSERT(Reader, !finalized_ /* Add() must not be called after Finalize() */); - statements_.emplace_back(statement); + statements_.Push(statement); } void FunctionEmitter::PushNewStatementBlock(const Construct* construct, uint32_t end_id, CompletionAction action) { - statements_stack_.emplace_back(StatementBlock{construct, end_id, action}); + statements_stack_.Push(StatementBlock{construct, end_id, action}); } void FunctionEmitter::PushGuard(const std::string& guard_name, uint32_t end_id) { - TINT_ASSERT(Reader, !statements_stack_.empty()); + TINT_ASSERT(Reader, !statements_stack_.IsEmpty()); TINT_ASSERT(Reader, !guard_name.empty()); // Guard control flow by the guard variable. Introduce a new // if-selection with a then-clause ending at the same block // as the statement block at the top of the stack. - const auto& top = statements_stack_.back(); + const auto& top = statements_stack_.Back(); auto* cond = create(Source{}, builder_.Symbols().Register(guard_name)); auto* builder = AddStatementBuilder(cond); - PushNewStatementBlock(top.GetConstruct(), end_id, [=](const ast::StatementList& stmts) { + PushNewStatementBlock(top.GetConstruct(), end_id, [=](const StatementList& stmts) { builder->body = create(Source{}, stmts); }); } void FunctionEmitter::PushTrueGuard(uint32_t end_id) { - TINT_ASSERT(Reader, !statements_stack_.empty()); - const auto& top = statements_stack_.back(); + TINT_ASSERT(Reader, !statements_stack_.IsEmpty()); + const auto& top = statements_stack_.Back(); auto* cond = MakeTrue(Source{}); auto* builder = AddStatementBuilder(cond); - PushNewStatementBlock(top.GetConstruct(), end_id, [=](const ast::StatementList& stmts) { + PushNewStatementBlock(top.GetConstruct(), end_id, [=](const StatementList& stmts) { builder->body = create(Source{}, stmts); }); } -const ast::StatementList FunctionEmitter::ast_body() { - TINT_ASSERT(Reader, !statements_stack_.empty()); +FunctionEmitter::StatementList FunctionEmitter::ast_body() { + TINT_ASSERT(Reader, !statements_stack_.IsEmpty()); auto& entry = statements_stack_[0]; entry.Finalize(&builder_); return entry.GetStatements(); } const ast::Statement* FunctionEmitter::AddStatement(const ast::Statement* statement) { - TINT_ASSERT(Reader, !statements_stack_.empty()); + TINT_ASSERT(Reader, !statements_stack_.IsEmpty()); if (statement != nullptr) { - statements_stack_.back().Add(statement); + statements_stack_.Back().Add(statement); } return statement; } const ast::Statement* FunctionEmitter::LastStatement() { - TINT_ASSERT(Reader, !statements_stack_.empty()); - auto& statement_list = statements_stack_.back().GetStatements(); - TINT_ASSERT(Reader, !statement_list.empty()); - return statement_list.back(); + TINT_ASSERT(Reader, !statements_stack_.IsEmpty()); + auto& statement_list = statements_stack_.Back().GetStatements(); + TINT_ASSERT(Reader, !statement_list.IsEmpty()); + return statement_list.Back(); } bool FunctionEmitter::Emit() { @@ -896,10 +938,9 @@ bool FunctionEmitter::Emit() { return false; } - builder_.AST().AddFunction( - create(decl.source, builder_.Symbols().Register(decl.name), - std::move(decl.params), decl.return_type->Build(builder_), body, - std::move(decl.attributes), ast::AttributeList{})); + builder_.AST().AddFunction(create( + decl.source, builder_.Symbols().Register(decl.name), std::move(decl.params), + decl.return_type->Build(builder_), body, std::move(decl.attributes), utils::Empty)); } if (ep_info_ && !ep_info_->inner_name.empty()) { @@ -910,17 +951,17 @@ bool FunctionEmitter::Emit() { } const ast::BlockStatement* FunctionEmitter::MakeFunctionBody() { - TINT_ASSERT(Reader, statements_stack_.size() == 1); + TINT_ASSERT(Reader, statements_stack_.Length() == 1); if (!EmitBody()) { return nullptr; } // Set the body of the AST function node. - if (statements_stack_.size() != 1) { + if (statements_stack_.Length() != 1) { Fail() << "internal error: statement-list stack should have 1 " "element but has " - << statements_stack_.size(); + << statements_stack_.Length(); return nullptr; } @@ -929,7 +970,7 @@ const ast::BlockStatement* FunctionEmitter::MakeFunctionBody() { auto* body = create(Source{}, statements); // Maintain the invariant by repopulating the one and only element. - statements_stack_.clear(); + statements_stack_.Clear(); PushNewStatementBlock(constructs_[0].get(), 0, nullptr); return body; @@ -937,12 +978,12 @@ const ast::BlockStatement* FunctionEmitter::MakeFunctionBody() { bool FunctionEmitter::EmitPipelineInput(std::string var_name, const Type* var_type, - ast::AttributeList* attrs, - std::vector index_prefix, + AttributeList* attrs, + utils::Vector index_prefix, const Type* tip_type, const Type* forced_param_type, - ast::VariableList* params, - ast::StatementList* statements) { + ParameterList* params, + StatementList* statements) { // TODO(dneto): Handle structs where the locations are annotated on members. tip_type = tip_type->UnwrapAlias(); if (auto* ref_type = tip_type->As()) { @@ -953,11 +994,11 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name, return Switch( tip_type, [&](const Matrix* matrix_type) -> bool { - index_prefix.push_back(0); + index_prefix.Push(0); const auto num_columns = static_cast(matrix_type->columns); const Type* vec_ty = ty_.Vector(matrix_type->type, matrix_type->rows); for (int col = 0; col < num_columns; col++) { - index_prefix.back() = col; + index_prefix.Back() = col; if (!EmitPipelineInput(var_name, var_type, attrs, index_prefix, vec_ty, forced_param_type, params, statements)) { return false; @@ -969,10 +1010,10 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name, if (array_type->size == 0) { return Fail() << "runtime-size array not allowed on pipeline IO"; } - index_prefix.push_back(0); + index_prefix.Push(0); const Type* elem_ty = array_type->type; for (int i = 0; i < static_cast(array_type->size); i++) { - index_prefix.back() = i; + index_prefix.Back() = i; if (!EmitPipelineInput(var_name, var_type, attrs, index_prefix, elem_ty, forced_param_type, params, statements)) { return false; @@ -982,12 +1023,14 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name, }, [&](const Struct* struct_type) -> bool { const auto& members = struct_type->members; - index_prefix.push_back(0); - for (int i = 0; i < static_cast(members.size()); ++i) { - index_prefix.back() = i; - ast::AttributeList member_attrs(*attrs); + index_prefix.Push(0); + for (size_t i = 0; i < members.size(); ++i) { + index_prefix.Back() = static_cast(i); + AttributeList member_attrs(*attrs); if (!parser_impl_.ConvertPipelineDecorations( - struct_type, parser_impl_.GetMemberPipelineDecorations(*struct_type, i), + struct_type, + parser_impl_.GetMemberPipelineDecorations(*struct_type, + static_cast(i)), &member_attrs)) { return false; } @@ -996,7 +1039,8 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name, return false; } // Copy the location as updated by nested expansion of the member. - parser_impl_.SetLocation(attrs, GetLocation(member_attrs)); + parser_impl_.SetLocation(attrs, + ast::GetAttribute(member_attrs)); } return success(); }, @@ -1013,7 +1057,7 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name, // disallowed but currently the SPIR-V reader will make duplicates when // the entire AST is cloned at the top level of the SPIR-V reader flow. // Consider rewriting this to avoid this node-sharing. - params->push_back(builder_.Param(param_name, param_type->Build(builder_), *attrs)); + params->Push(builder_.Param(param_name, param_type->Build(builder_), *attrs)); // Add a body statement to copy the parameter to the corresponding // private variable. @@ -1037,7 +1081,7 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name, store_dest = builder_.MemberAccessor( store_dest, builder_.Expr(parser_impl_.GetMemberName(*struct_type, index))); - current_type = struct_type->members[index]; + current_type = struct_type->members[static_cast(index)]; }); } @@ -1048,7 +1092,7 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name, create(tip_type->Build(builder_), param_value); } - statements->push_back(builder_.Assign(store_dest, param_value)); + statements->Push(builder_.Assign(store_dest, param_value)); // Increment the location attribute, in case more parameters will // follow. @@ -1058,7 +1102,7 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name, }); } -void FunctionEmitter::IncrementLocation(ast::AttributeList* attributes) { +void FunctionEmitter::IncrementLocation(AttributeList* attributes) { for (auto*& attr : *attributes) { if (auto* loc_attr = attr->As()) { // Replace this location attribute with a new one with one higher index. @@ -1069,23 +1113,14 @@ void FunctionEmitter::IncrementLocation(ast::AttributeList* attributes) { } } -const ast::Attribute* FunctionEmitter::GetLocation(const ast::AttributeList& attributes) { - for (auto* const& attr : attributes) { - if (attr->Is()) { - return attr; - } - } - return nullptr; -} - bool FunctionEmitter::EmitPipelineOutput(std::string var_name, const Type* var_type, - ast::AttributeList* decos, - std::vector index_prefix, + AttributeList* decos, + utils::Vector index_prefix, const Type* tip_type, const Type* forced_member_type, - ast::StructMemberList* return_members, - ast::ExpressionList* return_exprs) { + StructMemberList* return_members, + ExpressionList* return_exprs) { tip_type = tip_type->UnwrapAlias(); if (auto* ref_type = tip_type->As()) { tip_type = ref_type->type; @@ -1095,12 +1130,12 @@ bool FunctionEmitter::EmitPipelineOutput(std::string var_name, return Switch( tip_type, [&](const Matrix* matrix_type) { - index_prefix.push_back(0); + index_prefix.Push(0); const auto num_columns = static_cast(matrix_type->columns); const Type* vec_ty = ty_.Vector(matrix_type->type, matrix_type->rows); for (int col = 0; col < num_columns; col++) { - index_prefix.back() = col; - if (!EmitPipelineOutput(var_name, var_type, decos, index_prefix, vec_ty, + index_prefix.Back() = col; + if (!EmitPipelineOutput(var_name, var_type, std::move(decos), index_prefix, vec_ty, forced_member_type, return_members, return_exprs)) { return false; } @@ -1111,11 +1146,11 @@ bool FunctionEmitter::EmitPipelineOutput(std::string var_name, if (array_type->size == 0) { return Fail() << "runtime-size array not allowed on pipeline IO"; } - index_prefix.push_back(0); + index_prefix.Push(0); const Type* elem_ty = array_type->type; for (int i = 0; i < static_cast(array_type->size); i++) { - index_prefix.back() = i; - if (!EmitPipelineOutput(var_name, var_type, decos, index_prefix, elem_ty, + index_prefix.Back() = i; + if (!EmitPipelineOutput(var_name, var_type, std::move(decos), index_prefix, elem_ty, forced_member_type, return_members, return_exprs)) { return false; } @@ -1124,21 +1159,23 @@ bool FunctionEmitter::EmitPipelineOutput(std::string var_name, }, [&](const Struct* struct_type) -> bool { const auto& members = struct_type->members; - index_prefix.push_back(0); + index_prefix.Push(0); for (int i = 0; i < static_cast(members.size()); ++i) { - index_prefix.back() = i; - ast::AttributeList member_attrs(*decos); + index_prefix.Back() = i; + AttributeList member_attrs(*decos); if (!parser_impl_.ConvertPipelineDecorations( struct_type, parser_impl_.GetMemberPipelineDecorations(*struct_type, i), &member_attrs)) { return false; } - if (!EmitPipelineOutput(var_name, var_type, &member_attrs, index_prefix, members[i], - forced_member_type, return_members, return_exprs)) { + if (!EmitPipelineOutput(var_name, var_type, &member_attrs, index_prefix, + members[static_cast(i)], forced_member_type, + return_members, return_exprs)) { return false; } // Copy the location as updated by nested expansion of the member. - parser_impl_.SetLocation(decos, GetLocation(member_attrs)); + parser_impl_.SetLocation(decos, + ast::GetAttribute(member_attrs)); } return success(); }, @@ -1156,7 +1193,7 @@ bool FunctionEmitter::EmitPipelineOutput(std::string var_name, // disallowed but currently the SPIR-V reader will make duplicates when // the entire AST is cloned at the top level of the SPIR-V reader flow. // Consider rewriting this to avoid this node-sharing. - return_members->push_back( + return_members->Push( builder_.Member(member_name, member_type->Build(builder_), *decos)); // Create an expression to evaluate the part of the variable indexed by @@ -1182,7 +1219,7 @@ bool FunctionEmitter::EmitPipelineOutput(std::string var_name, load_source = builder_.MemberAccessor( load_source, builder_.Expr(parser_impl_.GetMemberName(*struct_type, index))); - current_type = struct_type->members[index]; + current_type = struct_type->members[static_cast(index)]; }); } @@ -1192,7 +1229,7 @@ bool FunctionEmitter::EmitPipelineOutput(std::string var_name, load_source = create(forced_member_type->Build(builder_), load_source); } - return_exprs->push_back(load_source); + return_exprs->Push(load_source); // Increment the location attribute, in case more parameters will // follow. @@ -1206,7 +1243,7 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { Source source; // The statements in the body. - ast::StatementList stmts; + utils::Vector stmts; FunctionDeclaration decl; decl.source = source; @@ -1222,7 +1259,7 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { TINT_ASSERT(Reader, var->opcode() == SpvOpVariable); auto* store_type = GetVariableStoreType(*var); auto* forced_param_type = store_type; - ast::AttributeList param_decos; + AttributeList param_decos; if (!parser_impl_.ConvertDecorationsForVariable(var_id, &forced_param_type, ¶m_decos, true)) { // This occurs, and is not an error, for the PointSize builtin. @@ -1245,12 +1282,12 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { auto* sample_mask_array_type = store_type->UnwrapRef()->UnwrapAlias()->As(); TINT_ASSERT(Reader, sample_mask_array_type); ok = EmitPipelineInput(var_name, store_type, ¶m_decos, {0}, - sample_mask_array_type->type, forced_param_type, &(decl.params), + sample_mask_array_type->type, forced_param_type, &decl.params, &stmts); } else { // The normal path. ok = EmitPipelineInput(var_name, store_type, ¶m_decos, {}, store_type, - forced_param_type, &(decl.params), &stmts); + forced_param_type, &decl.params, &stmts); } if (!ok) { return false; @@ -1258,15 +1295,15 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { } // Call the inner function. It has no parameters. - stmts.push_back(create( + stmts.Push(create( source, create(source, create( source, builder_.Symbols().Register(ep_info_->inner_name)), - ast::ExpressionList{}))); + utils::Empty))); // Pipeline outputs are mapped to the return value. - if (ep_info_->outputs.empty()) { + if (ep_info_->outputs.IsEmpty()) { // There is nothing to return. return_type = ty_.Void()->Build(builder_); } else { @@ -1277,8 +1314,8 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { const auto return_struct_sym = builder_.Symbols().Register(return_struct_name); // Define the structure. - std::vector return_members; - ast::ExpressionList return_exprs; + StructMemberList return_members; + ExpressionList return_exprs; const auto& builtin_position_info = parser_impl_.GetBuiltInPositionInfo(); @@ -1287,13 +1324,13 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { // The SPIR-V gl_PerVertex variable has already been remapped to // a gl_Position variable. Substitute the type. const Type* param_type = ty_.Vector(ty_.F32(), 4); - ast::AttributeList out_decos{ - create(source, ast::Builtin::kPosition)}; + AttributeList out_decos{ + create(source, ast::BuiltinValue::kPosition)}; const auto var_name = namer_.GetName(var_id); - return_members.push_back( + return_members.Push( builder_.Member(var_name, param_type->Build(builder_), out_decos)); - return_exprs.push_back(builder_.Expr(var_name)); + return_exprs.Push(builder_.Expr(var_name)); } else { const auto* var = def_use_mgr_->GetDef(var_id); @@ -1301,7 +1338,7 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { TINT_ASSERT(Reader, var->opcode() == SpvOpVariable); const Type* store_type = GetVariableStoreType(*var); const Type* forced_member_type = store_type; - ast::AttributeList out_decos; + AttributeList out_decos; if (!parser_impl_.ConvertDecorationsForVariable(var_id, &forced_member_type, &out_decos, true)) { // This occurs, and is not an error, for the PointSize builtin. @@ -1334,26 +1371,26 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { } } - if (return_members.empty()) { + if (return_members.IsEmpty()) { // This can occur if only the PointSize member is accessed, because we // never emit it. return_type = ty_.Void()->Build(builder_); } else { // Create and register the result type. - auto* str = create(Source{}, return_struct_sym, return_members, - ast::AttributeList{}); + auto* str = + create(Source{}, return_struct_sym, return_members, AttributeList{}); parser_impl_.AddTypeDecl(return_struct_sym, str); return_type = builder_.ty.Of(str); // Add the return-value statement. - stmts.push_back(create( + stmts.Push(create( source, builder_.Construct(source, return_type, std::move(return_exprs)))); } } auto* body = create(source, stmts); - ast::AttributeList fn_attrs; - fn_attrs.emplace_back(create(source, ep_info_->stage)); + AttributeList fn_attrs; + fn_attrs.Push(create(source, ep_info_->stage)); if (ep_info_->stage == ast::PipelineStage::kCompute) { auto& size = ep_info_->workgroup_size; @@ -1361,13 +1398,13 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() { const ast::Expression* x = builder_.Expr(i32(size.x)); const ast::Expression* y = size.y ? builder_.Expr(i32(size.y)) : nullptr; const ast::Expression* z = size.z ? builder_.Expr(i32(size.z)) : nullptr; - fn_attrs.emplace_back(create(Source{}, x, y, z)); + fn_attrs.Push(create(Source{}, x, y, z)); } } builder_.AST().AddFunction(create( source, builder_.Symbols().Register(ep_info_->name), std::move(decl.params), return_type, - body, std::move(fn_attrs), ast::AttributeList{})); + body, std::move(fn_attrs), AttributeList{})); return true; } @@ -1391,15 +1428,13 @@ bool FunctionEmitter::ParseFunctionDeclaration(FunctionDeclaration* decl) { << function_.result_id(); } - ast::VariableList ast_params; + ParameterList ast_params; function_.ForEachParam([this, &ast_params](const spvtools::opt::Instruction* param) { auto* type = parser_impl_.ConvertType(param->type_id()); if (type != nullptr) { - auto* ast_param = - parser_impl_.MakeVariable(param->result_id(), ast::StorageClass::kNone, type, true, - false, nullptr, ast::AttributeList{}); + auto* ast_param = parser_impl_.MakeParameter(param->result_id(), type, AttributeList{}); // Parameters are treated as const declarations. - ast_params.emplace_back(ast_param); + ast_params.Push(ast_param); // The value is accessible by name. identifier_types_.emplace(param->result_id(), type); } else { @@ -1413,7 +1448,7 @@ bool FunctionEmitter::ParseFunctionDeclaration(FunctionDeclaration* decl) { decl->name = name; decl->params = std::move(ast_params); decl->return_type = ret_ty; - decl->attributes.clear(); + decl->attributes.Clear(); return success(); } @@ -1598,8 +1633,9 @@ bool FunctionEmitter::RegisterMerges() { bool is_single_block_loop = false; block_info->basic_block->ForEachSuccessorLabel( [&is_single_block_loop, block_id](const uint32_t succ) { - if (block_id == succ) + if (block_id == succ) { is_single_block_loop = true; + } }); const auto ct = block_info->continue_for_header; block_info->is_continue_entire_loop = ct == block_id; @@ -1721,11 +1757,11 @@ bool FunctionEmitter::LabelControlFlowConstructs() { // haven't reached the backedge block. TINT_ASSERT(Reader, block_order_.size() > 0); - constructs_.clear(); + constructs_.Clear(); const auto entry_id = block_order_[0]; // The stack of enclosing constructs. - std::vector enclosing; + utils::Vector enclosing; // Creates a control flow construct and pushes it onto the stack. // Its parent is the top of the stack, or nullptr if the stack is empty. @@ -1735,7 +1771,7 @@ bool FunctionEmitter::LabelControlFlowConstructs() { const auto begin_pos = GetBlockInfo(begin_id)->pos; const auto end_pos = end_id == 0 ? uint32_t(block_order_.size()) : GetBlockInfo(end_id)->pos; - const auto* parent = enclosing.empty() ? nullptr : enclosing.back(); + const auto* parent = enclosing.IsEmpty() ? nullptr : enclosing.Back(); auto scope_end_pos = end_pos; // A loop construct is added right after its associated continue construct. // In that case, adjust the parent up. @@ -1745,11 +1781,10 @@ bool FunctionEmitter::LabelControlFlowConstructs() { scope_end_pos = parent->end_pos; parent = parent->parent; } - constructs_.push_back(std::make_unique(parent, static_cast(depth), k, - begin_id, end_id, begin_pos, end_pos, - scope_end_pos)); - Construct* result = constructs_.back().get(); - enclosing.push_back(result); + constructs_.Push(std::make_unique(parent, static_cast(depth), k, begin_id, + end_id, begin_pos, end_pos, scope_end_pos)); + Construct* result = constructs_.Back().get(); + enclosing.Push(result); return result; }; @@ -1764,19 +1799,19 @@ bool FunctionEmitter::LabelControlFlowConstructs() { auto* block_info = GetBlockInfo(block_id); TINT_ASSERT(Reader, block_info); - if (enclosing.empty()) { + if (enclosing.IsEmpty()) { return Fail() << "internal error: too many merge blocks before block " << block_id; } - const Construct* top = enclosing.back(); + const Construct* top = enclosing.Back(); while (block_id == top->end_id) { // We've reached a predeclared end of the construct. Pop it off the // stack. - enclosing.pop_back(); - if (enclosing.empty()) { + enclosing.Pop(); + if (enclosing.IsEmpty()) { return Fail() << "internal error: too many merge blocks before block " << block_id; } - top = enclosing.back(); + top = enclosing.Back(); } const auto merge = block_info->merge_for_header; @@ -1784,7 +1819,7 @@ bool FunctionEmitter::LabelControlFlowConstructs() { // The current block is a header. const auto header = block_id; const auto* header_info = block_info; - const auto depth = 1 + top->depth; + const auto depth = static_cast(1 + top->depth); const auto ct = header_info->continue_for_header; if (ct != 0) { // The current block is a loop header. @@ -1807,10 +1842,10 @@ bool FunctionEmitter::LabelControlFlowConstructs() { // If the loop header branches to two different blocks inside the loop // construct, then the loop body should be modeled as an if-selection // construct - std::vector targets; + utils::Vector targets; header_info->basic_block->ForEachSuccessorLabel( - [&targets](const uint32_t target) { targets.push_back(target); }); - if ((targets.size() == 2u) && targets[0] != targets[1]) { + [&targets](const uint32_t target) { targets.Push(target); }); + if ((targets.Length() == 2u) && targets[0] != targets[1]) { const auto target0_pos = GetBlockInfo(targets[0])->pos; const auto target1_pos = GetBlockInfo(targets[1])->pos; if (top->ContainsPos(target0_pos) && top->ContainsPos(target1_pos)) { @@ -1837,10 +1872,10 @@ bool FunctionEmitter::LabelControlFlowConstructs() { // At the end of the block list, we should only have the kFunction construct // left. - if (enclosing.size() != 1) { + if (enclosing.Length() != 1) { return Fail() << "internal error: unbalanced structured constructs when " "labeling structured constructs: ended with " - << enclosing.size() - 1 << " unterminated constructs"; + << enclosing.Length() - 1 << " unterminated constructs"; } const auto* top = enclosing[0]; if (top->kind != Construct::kFunction || top->depth != 0) { @@ -1901,8 +1936,8 @@ bool FunctionEmitter::FindSwitchCaseHeaders() { default_block->default_is_merge = default_block->pos == construct->end_pos; // Map a case target to the list of values selecting that case. - std::unordered_map> block_to_values; - std::vector case_targets; + std::unordered_map> block_to_values; + utils::Vector case_targets; std::unordered_set case_values; // Process case targets. @@ -1916,16 +1951,15 @@ bool FunctionEmitter::FindSwitchCaseHeaders() { } case_values.insert(value); if (block_to_values.count(case_target_id) == 0) { - case_targets.push_back(case_target_id); + case_targets.Push(case_target_id); } - block_to_values[case_target_id].push_back(value); + block_to_values[case_target_id].Push(value); } for (uint32_t case_target_id : case_targets) { auto* case_block = GetBlockInfo(case_target_id); - case_block->case_values = - std::make_unique>(std::move(block_to_values[case_target_id])); + case_block->case_values = std::move(block_to_values[case_target_id]); // A case target can't be a back-edge. if (construct->begin_pos >= case_block->pos) { @@ -2041,13 +2075,13 @@ bool FunctionEmitter::ClassifyCFGEdges() { const auto& src_construct = *(src_info->construct); // Compute the ordered list of unique successors. - std::vector successors; + utils::Vector successors; { std::unordered_set visited; src_info->basic_block->ForEachSuccessorLabel( [&successors, &visited](const uint32_t succ) { if (visited.count(succ) == 0) { - successors.push_back(succ); + successors.Push(succ); visited.insert(succ); } }); @@ -2061,10 +2095,10 @@ bool FunctionEmitter::ClassifyCFGEdges() { // to have a merge instruction. We also track kIfBreak edges // because when used with normal forward edges, we'll need // to generate a flow guard variable. - std::vector normal_forward_edges; - std::vector if_break_edges; + utils::Vector normal_forward_edges; + utils::Vector if_break_edges; - if (successors.empty() && src_construct.enclosing_continue) { + if (successors.IsEmpty() && src_construct.enclosing_continue) { // Kill and return are not allowed in a continue construct. return Fail() << "Invalid function exit at block " << src << " from continue construct starting at " @@ -2179,10 +2213,10 @@ bool FunctionEmitter::ClassifyCFGEdges() { if ((edge_kind == EdgeKind::kForward) || (edge_kind == EdgeKind::kCaseFallThrough)) { - normal_forward_edges.push_back(dest); + normal_forward_edges.Push(dest); } if (edge_kind == EdgeKind::kIfBreak) { - if_break_edges.push_back(dest); + if_break_edges.Push(dest); } if ((edge_kind == EdgeKind::kForward) || @@ -2244,13 +2278,13 @@ bool FunctionEmitter::ClassifyCFGEdges() { if (num_backedges > 1) { return Fail() << "Block " << src << " has too many backedges: " << num_backedges; } - if ((normal_forward_edges.size() > 1) && (src_info->merge_for_header == 0)) { + if ((normal_forward_edges.Length() > 1) && (src_info->merge_for_header == 0)) { return Fail() << "Control flow diverges at block " << src << " (to " << normal_forward_edges[0] << ", " << normal_forward_edges[1] << ") but it is not a structured header (it has no merge " "instruction)"; } - if ((normal_forward_edges.size() + if_break_edges.size() > 1) && + if ((normal_forward_edges.Length() + if_break_edges.Length() > 1) && (src_info->merge_for_header == 0)) { // There is a branch to the merge of an if-selection combined // with an other normal forward branch. Control within the @@ -2459,9 +2493,8 @@ bool FunctionEmitter::EmitFunctionVariables() { return false; } } - auto* var = - parser_impl_.MakeVariable(inst.result_id(), ast::StorageClass::kNone, var_store_type, - false, false, constructor, ast::AttributeList{}); + auto* var = parser_impl_.MakeVar(inst.result_id(), ast::StorageClass::kNone, var_store_type, + constructor, AttributeList{}); auto* var_decl_stmt = create(Source{}, var); AddStatement(var_decl_stmt); auto* var_type = ty_.Reference(var_store_type, ast::StorageClass::kNone); @@ -2499,7 +2532,8 @@ TypedExpression FunctionEmitter::MakeExpression(uint32_t id) { return source_expr; } case SkipReason::kPointSizeBuiltinValue: { - return {ty_.F32(), create(Source{}, 1.0f)}; + return {ty_.F32(), create( + Source{}, 1.0, ast::FloatLiteralExpression::Suffix::kF)}; } case SkipReason::kPointSizeBuiltinPointer: Fail() << "unhandled use of a pointer to the PointSize builtin, with ID: " << id; @@ -2583,7 +2617,7 @@ bool FunctionEmitter::EmitFunctionBodyStatements() { // Upon entry, the statement stack has one entry representing the whole // function. - TINT_ASSERT(Reader, !constructs_.empty()); + TINT_ASSERT(Reader, !constructs_.IsEmpty()); Construct* function_construct = constructs_[0].get(); TINT_ASSERT(Reader, function_construct != nullptr); TINT_ASSERT(Reader, function_construct->kind == Construct::kFunction); @@ -2591,7 +2625,7 @@ bool FunctionEmitter::EmitFunctionBodyStatements() { // had not been computed at the time the entry was first created. // TODO(dneto): refactor how the first construct is created vs. // this statements stack entry is populated. - TINT_ASSERT(Reader, statements_stack_.size() == 1); + TINT_ASSERT(Reader, statements_stack_.Length() == 1); statements_stack_[0].SetConstruct(function_construct); for (auto block_id : block_order()) { @@ -2604,24 +2638,24 @@ bool FunctionEmitter::EmitFunctionBodyStatements() { bool FunctionEmitter::EmitBasicBlock(const BlockInfo& block_info) { // Close off previous constructs. - while (!statements_stack_.empty() && (statements_stack_.back().GetEndId() == block_info.id)) { - statements_stack_.back().Finalize(&builder_); - statements_stack_.pop_back(); + while (!statements_stack_.IsEmpty() && (statements_stack_.Back().GetEndId() == block_info.id)) { + statements_stack_.Back().Finalize(&builder_); + statements_stack_.Pop(); } - if (statements_stack_.empty()) { + if (statements_stack_.IsEmpty()) { return Fail() << "internal error: statements stack empty at block " << block_info.id; } // Enter new constructs. - std::vector entering_constructs; // inner most comes first + utils::Vector entering_constructs; // inner most comes first { auto* here = block_info.construct; - auto* const top_construct = statements_stack_.back().GetConstruct(); + auto* const top_construct = statements_stack_.Back().GetConstruct(); while (here != top_construct) { // Only enter a construct at its header block. if (here->begin_id == block_info.id) { - entering_constructs.push_back(here); + entering_constructs.Push(here); } here = here->parent; } @@ -2677,10 +2711,10 @@ bool FunctionEmitter::EmitBasicBlock(const BlockInfo& block_info) { // - We are entering 0 or 1 constructs, or // - We are entering 2 constructs, with the outer one being a kContinue or // kLoop, the inner one is not a continue. - if (entering_constructs.size() > 2) { + if (entering_constructs.Length() > 2) { return Fail() << "internal error: bad construct nesting found"; } - if (entering_constructs.size() == 2) { + if (entering_constructs.Length() == 2) { auto inner_kind = entering_constructs[0]->kind; auto outer_kind = entering_constructs[1]->kind; if (outer_kind != Construct::kContinue && outer_kind != Construct::kLoop) { @@ -2852,9 +2886,9 @@ bool FunctionEmitter::EmitIfStart(const BlockInfo& block_info) { // But make sure we do it in the right order. auto push_else = [this, builder, else_end, construct, false_is_break, false_is_continue]() { // Push the else clause onto the stack first. - PushNewStatementBlock(construct, else_end, [=](const ast::StatementList& stmts) { + PushNewStatementBlock(construct, else_end, [=](const StatementList& stmts) { // Only set the else-clause if there are statements to fill it. - if (!stmts.empty()) { + if (!stmts.IsEmpty()) { // The "else" consists of the statement list from the top of // statements stack, without an "else if" condition. builder->else_stmt = create(Source{}, stmts); @@ -2903,7 +2937,7 @@ bool FunctionEmitter::EmitIfStart(const BlockInfo& block_info) { } // Push the then clause onto the stack. - PushNewStatementBlock(construct, then_end, [=](const ast::StatementList& stmts) { + PushNewStatementBlock(construct, then_end, [=](const StatementList& stmts) { builder->body = create(Source{}, stmts); }); if (true_is_break) { @@ -2940,17 +2974,17 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) { // We will push statement-blocks onto the stack to gather the statements in // the default clause and cases clauses. Determine the list of blocks // that start each clause. - std::vector clause_heads; + utils::Vector clause_heads; // Collect the case clauses, even if they are just the merge block. // First the default clause. const auto default_id = branch->GetSingleWordInOperand(1); const auto* default_info = GetBlockInfo(default_id); - clause_heads.push_back(default_info); + clause_heads.Push(default_info); // Now the case clauses. for (uint32_t iarg = 2; iarg + 1 < branch->NumInOperands(); iarg += 2) { const auto case_target_id = branch->GetSingleWordInOperand(iarg + 1); - clause_heads.push_back(GetBlockInfo(case_target_id)); + clause_heads.Push(GetBlockInfo(case_target_id)); } std::stable_sort( @@ -2961,37 +2995,36 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) { // Use read index r, and write index w. // Invariant: w <= r; size_t w = 0; - for (size_t r = 0; r < clause_heads.size(); ++r) { + for (size_t r = 0; r < clause_heads.Length(); ++r) { if (clause_heads[r] != clause_heads[w]) { ++w; // Advance the write cursor. } clause_heads[w] = clause_heads[r]; } // We know it's not empty because it always has at least a default clause. - TINT_ASSERT(Reader, !clause_heads.empty()); - clause_heads.resize(w + 1); + TINT_ASSERT(Reader, !clause_heads.IsEmpty()); + clause_heads.Resize(w + 1); } // Push them on in reverse order. - const auto last_clause_index = clause_heads.size() - 1; + const auto last_clause_index = clause_heads.Length() - 1; for (size_t i = last_clause_index;; --i) { // Create a list of integer literals for the selector values leading to // this case clause. - ast::CaseSelectorList selectors; - const auto* values_ptr = clause_heads[i]->case_values.get(); - const bool has_selectors = (values_ptr && !values_ptr->empty()); + utils::Vector selectors; + const bool has_selectors = clause_heads[i]->case_values.has_value(); if (has_selectors) { - std::vector values(values_ptr->begin(), values_ptr->end()); + auto values = clause_heads[i]->case_values.value(); std::stable_sort(values.begin(), values.end()); for (auto value : values) { // The rest of this module can handle up to 64 bit switch values. // The Tint AST handles 32-bit values. const uint32_t value32 = uint32_t(value & 0xFFFFFFFF); if (selector.type->IsUnsignedScalarOrVector()) { - selectors.emplace_back(create( + selectors.Push(create( Source{}, value32, ast::IntLiteralExpression::Suffix::kU)); } else { - selectors.emplace_back( + selectors.Push( create(Source{}, static_cast(value32), ast::IntLiteralExpression::Suffix::kI)); } @@ -3000,13 +3033,13 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) { // Where does this clause end? const auto end_id = - (i + 1 < clause_heads.size()) ? clause_heads[i + 1]->id : construct->end_id; + (i + 1 < clause_heads.Length()) ? clause_heads[i + 1]->id : construct->end_id; // Reserve the case clause slot in swch->cases, push the new statement block // for the case, and fill the case clause once the block is generated. - auto case_idx = swch->cases.size(); - swch->cases.emplace_back(nullptr); - PushNewStatementBlock(construct, end_id, [=](const ast::StatementList& stmts) { + auto case_idx = swch->cases.Length(); + swch->cases.Push(nullptr); + PushNewStatementBlock(construct, end_id, [=](const StatementList& stmts) { auto* body = create(Source{}, stmts); swch->cases[case_idx] = create(Source{}, selectors, body); }); @@ -3015,11 +3048,11 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) { construct->ContainsPos(default_info->pos)) { // Generate a default clause with a just fallthrough. auto* stmts = create( - Source{}, ast::StatementList{ + Source{}, StatementList{ create(Source{}), }); - auto* case_stmt = create(Source{}, ast::CaseSelectorList{}, stmts); - swch->cases.emplace_back(case_stmt); + auto* case_stmt = create(Source{}, utils::Empty, stmts); + swch->cases.Push(case_stmt); } if (i == 0) { @@ -3032,7 +3065,7 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) { bool FunctionEmitter::EmitLoopStart(const Construct* construct) { auto* builder = AddStatementBuilder(); - PushNewStatementBlock(construct, construct->end_id, [=](const ast::StatementList& stmts) { + PushNewStatementBlock(construct, construct->end_id, [=](const StatementList& stmts) { builder->body = create(Source{}, stmts); }); return success(); @@ -3047,7 +3080,7 @@ bool FunctionEmitter::EmitContinuingStart(const Construct* construct) { return Fail() << "internal error: starting continue construct, " "expected loop on top of stack"; } - PushNewStatementBlock(construct, construct->end_id, [=](const ast::StatementList& stmts) { + PushNewStatementBlock(construct, construct->end_id, [=](const StatementList& stmts) { loop->continuing = create(Source{}, stmts); }); @@ -3141,7 +3174,7 @@ bool FunctionEmitter::EmitNormalTerminator(const BlockInfo& block_info) { AddStatement(MakeSimpleIf(cond, true_branch, false_branch)); if (!flow_guard.empty()) { - PushGuard(flow_guard, statements_stack_.back().GetEndId()); + PushGuard(flow_guard, statements_stack_.Back().GetEndId()); } return true; } @@ -3241,15 +3274,15 @@ const ast::Statement* FunctionEmitter::MakeSimpleIf(const ast::Expression* condi if ((then_stmt == nullptr) && (else_stmt == nullptr)) { return nullptr; } - ast::StatementList if_stmts; + StatementList if_stmts; if (then_stmt != nullptr) { - if_stmts.emplace_back(then_stmt); + if_stmts.Push(then_stmt); } auto* if_block = create(Source{}, if_stmts); const ast::Statement* else_block = nullptr; if (else_stmt) { - else_block = create(ast::StatementList{else_stmt}); + else_block = create(StatementList{else_stmt}); } auto* if_stmt = create(Source{}, condition, if_block, else_block); @@ -3303,7 +3336,7 @@ bool FunctionEmitter::EmitStatementsInBasicBlock(const BlockInfo& block_info, return true; } // Returns the given list of local definition IDs, sorted by their index. - auto sorted_by_index = [this](const std::vector& ids) { + auto sorted_by_index = [this](auto& ids) { auto sorted = ids; std::stable_sort(sorted.begin(), sorted.end(), [this](const uint32_t lhs, const uint32_t rhs) { @@ -3318,8 +3351,8 @@ bool FunctionEmitter::EmitStatementsInBasicBlock(const BlockInfo& block_info, TINT_ASSERT(Reader, def_inst); auto* storage_type = RemapStorageClass(parser_impl_.ConvertType(def_inst->type_id()), id); AddStatement(create( - Source{}, parser_impl_.MakeVariable(id, ast::StorageClass::kNone, storage_type, false, - false, nullptr, ast::AttributeList{}))); + Source{}, parser_impl_.MakeVar(id, ast::StorageClass::kNone, storage_type, nullptr, + AttributeList{}))); auto* type = ty_.Reference(storage_type, ast::StorageClass::kNone); identifier_types_.emplace(id, type); } @@ -3350,7 +3383,7 @@ bool FunctionEmitter::EmitStatementsInBasicBlock(const BlockInfo& block_info, // Emit assignments to carry values to phi nodes in potential destinations. // Do it in index order. - if (!block_info.phi_assignments.empty()) { + if (!block_info.phi_assignments.IsEmpty()) { auto sorted = block_info.phi_assignments; std::stable_sort( sorted.begin(), sorted.end(), @@ -3386,13 +3419,11 @@ bool FunctionEmitter::EmitConstDefinition(const spvtools::opt::Instruction& inst } expr = AddressOfIfNeeded(expr, &inst); - auto* ast_const = - parser_impl_.MakeVariable(inst.result_id(), ast::StorageClass::kNone, expr.type, true, - false, expr.expr, ast::AttributeList{}); - if (!ast_const) { + auto* let = parser_impl_.MakeLet(inst.result_id(), expr.type, expr.expr); + if (!let) { return false; } - AddStatement(create(Source{}, ast_const)); + AddStatement(create(Source{}, let)); identifier_types_.emplace(inst.result_id(), expr.type); return success(); } @@ -3481,6 +3512,10 @@ bool FunctionEmitter::EmitStatement(const spvtools::opt::Instruction& inst) { return EmitImageAccess(inst); } + if (IsAtomicOp(inst.opcode())) { + return EmitAtomicOp(inst); + } + switch (inst.opcode()) { case SpvOpNop: return true; @@ -3767,8 +3802,8 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue( const char* unary_builtin_name = GetUnaryBuiltInFunctionName(opcode); if (unary_builtin_name != nullptr) { - ast::ExpressionList params; - params.emplace_back(MakeOperand(inst, 0).expr); + ExpressionList params; + params.Push(MakeOperand(inst, 0).expr); return {ast_type, create( Source{}, create( @@ -3846,9 +3881,9 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue( } if (opcode == SpvOpCompositeConstruct) { - ast::ExpressionList operands; + ExpressionList operands; for (uint32_t iarg = 0; iarg < inst.NumInOperands(); ++iarg) { - operands.emplace_back(MakeOperand(inst, iarg).expr); + operands.Push(MakeOperand(inst, iarg).expr); } return {ast_type, builder_.Construct(Source{}, ast_type->Build(builder_), std::move(operands))}; @@ -3916,7 +3951,7 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst auto e1 = MakeOperand(inst, 2); auto e2 = ToSignedIfUnsigned(MakeOperand(inst, 3)); - return {e1.type, builder_.Call(Source{}, "ldexp", ast::ExpressionList{e1.expr, e2.expr})}; + return {e1.type, builder_.Call(Source{}, "ldexp", utils::Vector{e1.expr, e2.expr})}; } auto* result_type = parser_impl_.ConvertType(inst.type_id()); @@ -3928,7 +3963,7 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst case GLSLstd450Normalize: // WGSL does not have scalar form of the normalize builtin. // The answer would be 1 anyway, so return that directly. - return {ty_.F32(), builder_.Expr(1.0f)}; + return {ty_.F32(), builder_.Expr(1_f)}; case GLSLstd450FaceForward: { // If dot(Nref, Incident) < 0, the result is Normal, otherwise -Normal. @@ -3942,16 +3977,19 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst TINT_ASSERT(Reader, normal.type->Is()); TINT_ASSERT(Reader, incident.type->Is()); TINT_ASSERT(Reader, nref.type->Is()); - return {ty_.F32(), - builder_.Call( - Source{}, "select", - ast::ExpressionList{create( - Source{}, ast::UnaryOp::kNegation, normal.expr), - normal.expr, - create( - Source{}, ast::BinaryOp::kLessThan, - builder_.Mul({}, incident.expr, nref.expr), - builder_.Expr(0.0f))})}; + return { + ty_.F32(), + builder_.Call( + Source{}, "select", + utils::Vector{ + create(Source{}, ast::UnaryOp::kNegation, + normal.expr), + normal.expr, + create( + Source{}, ast::BinaryOp::kLessThan, + builder_.Mul({}, incident.expr, nref.expr), builder_.Expr(0_f)), + }), + }; } case GLSLstd450Reflect: { @@ -3960,12 +3998,12 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst auto normal = MakeOperand(inst, 3); TINT_ASSERT(Reader, incident.type->Is()); TINT_ASSERT(Reader, normal.type->Is()); - return {ty_.F32(), - builder_.Sub( - incident.expr, - builder_.Mul(2.0f, - builder_.Mul(normal.expr, - builder_.Mul(normal.expr, incident.expr))))}; + return { + ty_.F32(), + builder_.Sub( + incident.expr, + builder_.Mul(2_f, builder_.Mul(normal.expr, + builder_.Mul(normal.expr, incident.expr))))}; } case GLSLstd450Refract: { @@ -3982,13 +4020,17 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst return {}; } const Type* f32 = eta.type; - return {f32, - builder_.MemberAccessor( - builder_.Call(Source{}, "refract", - ast::ExpressionList{ - builder_.vec2(incident.expr, 0.0f), - builder_.vec2(normal.expr, 0.0f), eta.expr}), - "x")}; + return { + f32, + builder_.MemberAccessor( + builder_.Call(Source{}, "refract", + utils::Vector{ + builder_.vec2(incident.expr, 0_f), + builder_.vec2(normal.expr, 0_f), + eta.expr, + }), + "x"), + }; } default: break; @@ -4002,7 +4044,7 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst } auto* func = create(Source{}, builder_.Symbols().Register(name)); - ast::ExpressionList operands; + ExpressionList operands; const Type* first_operand_type = nullptr; // All parameters to GLSL.std.450 extended instructions are IDs. for (uint32_t iarg = 2; iarg < inst.NumInOperands(); ++iarg) { @@ -4010,7 +4052,7 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst if (first_operand_type == nullptr) { first_operand_type = operand.type; } - operands.emplace_back(operand.expr); + operands.Push(operand.expr); } auto* call = create(Source{}, func, std::move(operands)); TypedExpression call_expr{result_type, call}; @@ -4267,7 +4309,7 @@ TypedExpression FunctionEmitter::MakeCompositeExtract(const spvtools::opt::Instr // This is structurally similar to creating an access chain, but // the SPIR-V instruction has literal indices instead of IDs for indices. - auto composite_index = 0; + auto composite_index = 0u; auto first_index_position = 1; TypedExpression current_expr(MakeOperand(inst, composite_index)); if (!current_expr) { @@ -4311,13 +4353,14 @@ TypedExpression FunctionEmitter::MakeCompositeValueDecomposition( // hierarchy, maintaining |current_type_id| as the SPIR-V ID of the type of // the object pointed to after processing the previous indices. const auto num_in_operands = inst.NumInOperands(); - for (uint32_t index = index_start; index < num_in_operands; ++index) { + for (uint32_t index = static_cast(index_start); index < num_in_operands; ++index) { const uint32_t index_val = inst.GetSingleWordInOperand(index); const auto* current_type_inst = def_use_mgr_->GetDef(current_type_id); if (!current_type_inst) { Fail() << "composite type %" << current_type_id << " is invalid after following " - << (index - index_start) << " indices: " << inst.PrettyPrint(); + << (index - static_cast(index_start)) + << " indices: " << inst.PrettyPrint(); return {}; } const char* operation_name = nullptr; @@ -4436,7 +4479,7 @@ TypedExpression FunctionEmitter::MakeVectorShuffle(const spvtools::opt::Instruct // Assume the literal indices are valid, and there is a valid number of them. auto source = GetSourceForInst(inst); const Vector* result_type = As(parser_impl_.ConvertType(inst.type_id())); - ast::ExpressionList values; + ExpressionList values; for (uint32_t i = 2; i < inst.NumInOperands(); ++i) { const auto index = inst.GetSingleWordInOperand(i); if (index < vec0_len) { @@ -4444,8 +4487,7 @@ TypedExpression FunctionEmitter::MakeVectorShuffle(const spvtools::opt::Instruct if (!expr) { return {}; } - values.emplace_back( - create(source, expr.expr, Swizzle(index))); + values.Push(create(source, expr.expr, Swizzle(index))); } else if (index < vec0_len + vec1_len) { const auto sub_index = index - vec0_len; TINT_ASSERT(Reader, sub_index < kMaxVectorLen); @@ -4453,18 +4495,19 @@ TypedExpression FunctionEmitter::MakeVectorShuffle(const spvtools::opt::Instruct if (!expr) { return {}; } - values.emplace_back( + values.Push( create(source, expr.expr, Swizzle(sub_index))); } else if (index == 0xFFFFFFFF) { // By rule, this maps to OpUndef. Instead, make it zero. - values.emplace_back(parser_impl_.MakeNullValue(result_type->type)); + values.Push(parser_impl_.MakeNullValue(result_type->type)); } else { Fail() << "invalid vectorshuffle ID %" << inst.result_id() << ": index too large: " << index; return {}; } } - return {result_type, builder_.Construct(source, result_type->Build(builder_), values)}; + return {result_type, + builder_.Construct(source, result_type->Build(builder_), std::move(values))}; } bool FunctionEmitter::RegisterSpecialBuiltInVariables() { @@ -4473,9 +4516,10 @@ bool FunctionEmitter::RegisterSpecialBuiltInVariables() { const auto id = special_var.first; const auto builtin = special_var.second; const auto* var = def_use_mgr_->GetDef(id); - def_info_[id] = std::make_unique(*var, 0, index); + def_info_[id] = std::make_unique(*var, false, 0, index); ++index; auto& def = def_info_[id]; + // Builtins are always defined outside the function. switch (builtin) { case SpvBuiltInPointSize: def->skip = SkipReason::kPointSizeBuiltinPointer; @@ -4520,7 +4564,7 @@ bool FunctionEmitter::RegisterLocallyDefinedValues() { if ((result_id == 0) || inst.opcode() == SpvOpLabel) { continue; } - def_info_[result_id] = std::make_unique(inst, block_pos, index); + def_info_[result_id] = std::make_unique(inst, true, block_pos, index); ++index; auto& info = def_info_[result_id]; @@ -4606,7 +4650,7 @@ void FunctionEmitter::FindValuesNeedingNamedOrHoistedDefinition() { // but only if they are defined in this function as well. auto require_named_const_def = [&](const spvtools::opt::Instruction& inst, int in_operand_index) { - const auto id = inst.GetSingleWordInOperand(in_operand_index); + const auto id = inst.GetSingleWordInOperand(static_cast(in_operand_index)); auto* const operand_def = GetDefInfo(id); if (operand_def) { operand_def->requires_named_const_def = true; @@ -4684,7 +4728,7 @@ void FunctionEmitter::FindValuesNeedingNamedOrHoistedDefinition() { if (IsInBlockOrder(pred_block_info)) { // Record the assignment that needs to occur at the end // of the predecessor block. - pred_block_info->phi_assignments.push_back({phi_id, value_id}); + pred_block_info->phi_assignments.Push({phi_id, value_id}); first_pos = std::min(first_pos, pred_block_info->pos); last_pos = std::max(last_pos, pred_block_info->pos); } @@ -4692,8 +4736,7 @@ void FunctionEmitter::FindValuesNeedingNamedOrHoistedDefinition() { // Schedule the declaration of the state variable. const auto* enclosing_construct = GetEnclosingScope(first_pos, last_pos); - GetBlockInfo(enclosing_construct->begin_id) - ->phis_needing_state_vars.push_back(phi_id); + GetBlockInfo(enclosing_construct->begin_id)->phis_needing_state_vars.Push(phi_id); } } } @@ -4716,6 +4759,13 @@ void FunctionEmitter::FindValuesNeedingNamedOrHoistedDefinition() { // There is no need to adjust the location of the declaration. continue; } + if (!def_info->locally_defined) { + // Never hoist a variable declared at module scope. + // This occurs for builtin variables, which are mapped to module-scope + // private variables. + continue; + } + // The first use must be the at the SSA definition, because block order // respects dominance. const auto first_pos = def_info->block_pos; @@ -4757,7 +4807,7 @@ void FunctionEmitter::FindValuesNeedingNamedOrHoistedDefinition() { // TODO(dneto): Handle non-storable types, particularly pointers. def_info->requires_hoisted_def = true; auto* hoist_to_block = GetBlockInfo(enclosing_construct->begin_id); - hoist_to_block->hoisted_ids.push_back(def_id); + hoist_to_block->hoisted_ids.Push(def_id); } } } @@ -4819,8 +4869,8 @@ TypedExpression FunctionEmitter::MakeNumericConversion(const spvtools::opt::Inst return {}; } - ast::ExpressionList params; - params.push_back(arg_expr.expr); + ExpressionList params; + params.Push(arg_expr.expr); TypedExpression result{ expr_type, builder_.Construct(GetSourceForInst(inst), expr_type->Build(builder_), std::move(params))}; @@ -4838,7 +4888,7 @@ bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) { auto name = namer_.Name(inst.GetSingleWordInOperand(0)); auto* function = create(Source{}, builder_.Symbols().Register(name)); - ast::ExpressionList args; + ExpressionList args; for (uint32_t iarg = 1; iarg < inst.NumInOperands(); ++iarg) { auto expr = MakeOperand(inst, iarg); if (!expr) { @@ -4847,7 +4897,7 @@ bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) { // Functions cannot use references as parameters, so we need to pass by // pointer if the operand is of pointer type. expr = AddressOfIfNeeded(expr, def_use_mgr_->GetDef(inst.GetSingleWordInOperand(iarg))); - args.emplace_back(expr.expr); + args.Push(expr.expr); } if (failed()) { return false; @@ -4867,7 +4917,7 @@ bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) { bool FunctionEmitter::EmitControlBarrier(const spvtools::opt::Instruction& inst) { uint32_t operands[3]; - for (int i = 0; i < 3; i++) { + for (uint32_t i = 0; i < 3; i++) { auto id = inst.GetSingleWordInOperand(i); if (auto* constant = constant_mgr_->FindDeclaredConstant(id)) { operands[i] = constant->GetU32(); @@ -4885,7 +4935,7 @@ bool FunctionEmitter::EmitControlBarrier(const spvtools::opt::Instruction& inst) << "expected Workgroup (2), got: " << execution; } if (semantics & SpvMemorySemanticsAcquireReleaseMask) { - semantics &= ~SpvMemorySemanticsAcquireReleaseMask; + semantics &= ~static_cast(SpvMemorySemanticsAcquireReleaseMask); } else { return Fail() << "control barrier semantics requires acquire and release"; } @@ -4894,14 +4944,14 @@ bool FunctionEmitter::EmitControlBarrier(const spvtools::opt::Instruction& inst) return Fail() << "workgroupBarrier requires workgroup memory scope"; } AddStatement(create(builder_.Call("workgroupBarrier"))); - semantics &= ~SpvMemorySemanticsWorkgroupMemoryMask; + semantics &= ~static_cast(SpvMemorySemanticsWorkgroupMemoryMask); } if (semantics & SpvMemorySemanticsUniformMemoryMask) { if (memory != SpvScopeDevice) { return Fail() << "storageBarrier requires device memory scope"; } AddStatement(create(builder_.Call("storageBarrier"))); - semantics &= ~SpvMemorySemanticsUniformMemoryMask; + semantics &= ~static_cast(SpvMemorySemanticsUniformMemoryMask); } if (semantics) { return Fail() << "unsupported control barrier semantics: " << semantics; @@ -4914,14 +4964,14 @@ TypedExpression FunctionEmitter::MakeBuiltinCall(const spvtools::opt::Instructio auto* name = sem::str(builtin); auto* ident = create(Source{}, builder_.Symbols().Register(name)); - ast::ExpressionList params; + ExpressionList params; const Type* first_operand_type = nullptr; for (uint32_t iarg = 0; iarg < inst.NumInOperands(); ++iarg) { TypedExpression operand = MakeOperand(inst, iarg); if (first_operand_type == nullptr) { first_operand_type = operand.type; } - params.emplace_back(operand.expr); + params.Push(operand.expr); } auto* call_expr = create(Source{}, ident, std::move(params)); auto* result_type = parser_impl_.ConvertType(inst.type_id()); @@ -4946,11 +4996,11 @@ TypedExpression FunctionEmitter::MakeSimpleSelect(const spvtools::opt::Instructi auto* op_ty = true_value.type; if (op_ty->Is() || op_ty->IsFloatScalar() || op_ty->IsIntegerScalar() || op_ty->Is()) { - ast::ExpressionList params; - params.push_back(false_value.expr); - params.push_back(true_value.expr); + ExpressionList params; + params.Push(false_value.expr); + params.Push(true_value.expr); // The condition goes last. - params.push_back(condition.expr); + params.Push(condition.expr); return {op_ty, create(Source{}, create( @@ -5025,7 +5075,7 @@ const ast::Expression* FunctionEmitter::GetSamplerExpression( } bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { - ast::ExpressionList args; + ExpressionList args; const auto opcode = inst.opcode(); // Form the texture operand. @@ -5033,13 +5083,13 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { if (!image) { return false; } - args.push_back(GetImageExpression(inst)); + args.Push(GetImageExpression(inst)); // Form the sampler operand, if needed. if (IsSampledImageAccess(opcode)) { // Form the sampler operand. if (auto* sampler = GetSamplerExpression(inst)) { - args.push_back(sampler); + args.Push(sampler); } else { return false; } @@ -5061,10 +5111,12 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { // Push the coordinates operands. auto coords = MakeCoordinateOperandsForImageAccess(inst); - if (coords.empty()) { + if (coords.IsEmpty()) { return false; } - args.insert(args.end(), coords.begin(), coords.end()); + for (auto* coord : coords) { + args.Push(coord); + } // Skip the coordinates operand. arg_index++; @@ -5074,7 +5126,7 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { // the parameter list. Issues a diagnostic and returns false on error. auto consume_dref = [&]() -> bool { if (arg_index < num_args) { - args.push_back(MakeOperand(inst, arg_index).expr); + args.Push(MakeOperand(inst, arg_index).expr); arg_index++; } else { return Fail() << "image depth-compare instruction is missing a Dref operand: " @@ -5111,7 +5163,12 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { builtin_name = "textureGather"; if (!texture_type->Is()) { // The explicit component is the *first* argument in WGSL. - args.insert(args.begin(), ToI32(MakeOperand(inst, arg_index)).expr); + ExpressionList gather_args; + gather_args.Push(ToI32(MakeOperand(inst, arg_index)).expr); + for (auto* arg : args) { + gather_args.Push(arg); + } + args = std::move(gather_args); } // Skip over the component operand, even for depth textures. arg_index++; @@ -5139,7 +5196,7 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { return false; } - args.push_back(converted_texel); + args.Push(converted_texel); arg_index++; } else { return Fail() << "image write is missing a Texel operand: " << inst.PrettyPrint(); @@ -5168,7 +5225,7 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { << inst.PrettyPrint(); } builtin_name += "Bias"; - args.push_back(MakeOperand(inst, arg_index).expr); + args.Push(MakeOperand(inst, arg_index).expr); image_operands_mask ^= SpvImageOperandsBiasMask; arg_index++; } @@ -5195,7 +5252,7 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { // Convert it to a signed integer type. lod = ToI32(lod); } - args.push_back(lod.expr); + args.Push(lod.expr); } image_operands_mask ^= SpvImageOperandsLodMask; @@ -5204,7 +5261,7 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { !texture_type->IsAnyOf()) { // textureLoad requires an explicit level-of-detail parameter for // non-multisampled texture types. - args.push_back(parser_impl_.MakeNullValue(ty_.I32())); + args.Push(parser_impl_.MakeNullValue(ty_.I32())); } if (arg_index + 1 < num_args && (image_operands_mask & SpvImageOperandsGradMask)) { if (is_dref_sample) { @@ -5218,8 +5275,8 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { << inst.PrettyPrint(); } builtin_name += "Grad"; - args.push_back(MakeOperand(inst, arg_index).expr); - args.push_back(MakeOperand(inst, arg_index + 1).expr); + args.Push(MakeOperand(inst, arg_index).expr); + args.Push(MakeOperand(inst, arg_index + 1).expr); image_operands_mask ^= SpvImageOperandsGradMask; arg_index += 2; } @@ -5240,13 +5297,13 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { << inst.PrettyPrint(); } - args.push_back(ToSignedIfUnsigned(MakeOperand(inst, arg_index)).expr); + args.Push(ToSignedIfUnsigned(MakeOperand(inst, arg_index)).expr); image_operands_mask ^= SpvImageOperandsConstOffsetMask; arg_index++; } if (arg_index < num_args && (image_operands_mask & SpvImageOperandsSampleMask)) { // TODO(dneto): only permitted with ImageFetch - args.push_back(ToI32(MakeOperand(inst, arg_index)).expr); + args.Push(ToI32(MakeOperand(inst, arg_index)).expr); image_operands_mask ^= SpvImageOperandsSampleMask; arg_index++; } @@ -5288,12 +5345,14 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) { // first component. if (texture_type->IsAnyOf()) { if (is_non_dref_sample || (opcode == SpvOpImageFetch)) { - value = builder_.Construct( - Source{}, - result_type->Build(builder_), // a vec4 - ast::ExpressionList{value, parser_impl_.MakeNullValue(result_component_type), - parser_impl_.MakeNullValue(result_component_type), - parser_impl_.MakeNullValue(result_component_type)}); + value = builder_.Construct(Source{}, + result_type->Build(builder_), // a vec4 + utils::Vector{ + value, + parser_impl_.MakeNullValue(result_component_type), + parser_impl_.MakeNullValue(result_component_type), + parser_impl_.MakeNullValue(result_component_type), + }); } } @@ -5344,15 +5403,15 @@ bool FunctionEmitter::EmitImageQuery(const spvtools::opt::Instruction& inst) { switch (opcode) { case SpvOpImageQuerySize: case SpvOpImageQuerySizeLod: { - ast::ExpressionList exprs; + ExpressionList exprs; // Invoke textureDimensions. // If the texture is arrayed, combine with the result from // textureNumLayers. auto* dims_ident = create( Source{}, builder_.Symbols().Register("textureDimensions")); - ast::ExpressionList dims_args{GetImageExpression(inst)}; + ExpressionList dims_args{GetImageExpression(inst)}; if (opcode == SpvOpImageQuerySizeLod) { - dims_args.push_back(ToI32(MakeOperand(inst, 1)).expr); + dims_args.Push(ToI32(MakeOperand(inst, 1)).expr); } const ast::Expression* dims_call = create(Source{}, dims_ident, dims_args); @@ -5363,16 +5422,17 @@ bool FunctionEmitter::EmitImageQuery(const spvtools::opt::Instruction& inst) { dims_call = create(Source{}, dims_call, PrefixSwizzle(2)); } - exprs.push_back(dims_call); + exprs.Push(dims_call); if (ast::IsTextureArray(dims)) { auto* layers_ident = create( Source{}, builder_.Symbols().Register("textureNumLayers")); - exprs.push_back(create( - Source{}, layers_ident, ast::ExpressionList{GetImageExpression(inst)})); + exprs.Push(create(Source{}, layers_ident, + utils::Vector{GetImageExpression(inst)})); } auto* result_type = parser_impl_.ConvertType(inst.type_id()); TypedExpression expr = { - result_type, builder_.Construct(Source{}, result_type->Build(builder_), exprs)}; + result_type, + builder_.Construct(Source{}, result_type->Build(builder_), std::move(exprs))}; return EmitConstDefOrWriteToHoistedVar(inst, expr); } case SpvOpImageQueryLod: @@ -5386,13 +5446,13 @@ bool FunctionEmitter::EmitImageQuery(const spvtools::opt::Instruction& inst) { auto* levels_ident = create(Source{}, builder_.Symbols().Register(name)); const ast::Expression* ast_expr = create( - Source{}, levels_ident, ast::ExpressionList{GetImageExpression(inst)}); + Source{}, levels_ident, utils::Vector{GetImageExpression(inst)}); auto* result_type = parser_impl_.ConvertType(inst.type_id()); // The SPIR-V result type must be integer scalar. The WGSL bulitin // returns i32. If they aren't the same then convert the result. if (!result_type->Is()) { ast_expr = builder_.Construct(Source{}, result_type->Build(builder_), - ast::ExpressionList{ast_expr}); + utils::Vector{ast_expr}); } TypedExpression expr{result_type, ast_expr}; return EmitConstDefOrWriteToHoistedVar(inst, expr); @@ -5403,7 +5463,116 @@ bool FunctionEmitter::EmitImageQuery(const spvtools::opt::Instruction& inst) { return Fail() << "unhandled image query: " << inst.PrettyPrint(); } -ast::ExpressionList FunctionEmitter::MakeCoordinateOperandsForImageAccess( +bool FunctionEmitter::EmitAtomicOp(const spvtools::opt::Instruction& inst) { + auto emit_atomic = [&](sem::BuiltinType builtin, std::initializer_list args) { + // Split args into params and expressions + ParameterList params; + params.Reserve(args.size()); + ExpressionList exprs; + exprs.Reserve(args.size()); + size_t i = 0; + for (auto& a : args) { + params.Push(builder_.Param("p" + std::to_string(i++), a.type->Build(builder_))); + exprs.Push(a.expr); + } + + // Function return type + const ast::Type* ret_type = nullptr; + if (inst.type_id() != 0) { + ret_type = parser_impl_.ConvertType(inst.type_id())->Build(builder_); + } else { + ret_type = builder_.ty.void_(); + } + + // Emit stub, will be removed by transform::SpirvAtomic + auto sym = builder_.Symbols().New(std::string("stub_") + sem::str(builtin)); + auto* stub_deco = builder_.ASTNodes().Create( + builder_.ID(), builder_.AllocateNodeID(), builtin); + auto* stub = + create(Source{}, sym, std::move(params), ret_type, + /* body */ nullptr, + AttributeList{ + stub_deco, + builder_.Disable(ast::DisabledValidation::kFunctionHasNoBody), + }, + AttributeList{}); + builder_.AST().AddFunction(stub); + + // Emit call to stub, will be replaced with call to atomic builtin by transform::SpirvAtomic + auto* call = builder_.Call(Source{}, sym, std::move(exprs)); + if (inst.type_id() != 0) { + auto* result_type = parser_impl_.ConvertType(inst.type_id()); + TypedExpression expr{result_type, call}; + return EmitConstDefOrWriteToHoistedVar(inst, expr); + } + AddStatement(create(call)); + + return true; + }; + + auto oper = [&](uint32_t index) -> TypedExpression { // + return MakeOperand(inst, index); + }; + + auto lit = [&](int v) -> TypedExpression { + auto* result_type = parser_impl_.ConvertType(inst.type_id()); + if (result_type->Is()) { + return TypedExpression(result_type, builder_.Expr(i32(v))); + } else if (result_type->Is()) { + return TypedExpression(result_type, builder_.Expr(u32(v))); + } + return {}; + }; + + switch (inst.opcode()) { + case SpvOpAtomicLoad: + return emit_atomic(sem::BuiltinType::kAtomicLoad, {oper(/*ptr*/ 0)}); + case SpvOpAtomicStore: + return emit_atomic(sem::BuiltinType::kAtomicStore, + {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicExchange: + return emit_atomic(sem::BuiltinType::kAtomicExchange, + {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicCompareExchange: + case SpvOpAtomicCompareExchangeWeak: + return emit_atomic(sem::BuiltinType::kAtomicCompareExchangeWeak, + {oper(/*ptr*/ 0), /*value*/ oper(5), /*comparator*/ oper(4)}); + case SpvOpAtomicIIncrement: + return emit_atomic(sem::BuiltinType::kAtomicAdd, {oper(/*ptr*/ 0), lit(1)}); + case SpvOpAtomicIDecrement: + return emit_atomic(sem::BuiltinType::kAtomicSub, {oper(/*ptr*/ 0), lit(1)}); + case SpvOpAtomicIAdd: + return emit_atomic(sem::BuiltinType::kAtomicAdd, {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicISub: + return emit_atomic(sem::BuiltinType::kAtomicSub, {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicSMin: + return emit_atomic(sem::BuiltinType::kAtomicMin, {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicUMin: + return emit_atomic(sem::BuiltinType::kAtomicMin, {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicSMax: + return emit_atomic(sem::BuiltinType::kAtomicMax, {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicUMax: + return emit_atomic(sem::BuiltinType::kAtomicMax, {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicAnd: + return emit_atomic(sem::BuiltinType::kAtomicAnd, {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicOr: + return emit_atomic(sem::BuiltinType::kAtomicOr, {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicXor: + return emit_atomic(sem::BuiltinType::kAtomicXor, {oper(/*ptr*/ 0), oper(/*value*/ 3)}); + case SpvOpAtomicFlagTestAndSet: + case SpvOpAtomicFlagClear: + case SpvOpAtomicFMinEXT: + case SpvOpAtomicFMaxEXT: + case SpvOpAtomicFAddEXT: + return Fail() << "unsupported atomic op: " << inst.PrettyPrint(); + + default: + break; + } + return Fail() << "unhandled atomic op: " << inst.PrettyPrint(); +} + +FunctionEmitter::ExpressionList FunctionEmitter::MakeCoordinateOperandsForImageAccess( const spvtools::opt::Instruction& inst) { if (!parser_impl_.success()) { Fail(); @@ -5440,7 +5609,7 @@ ast::ExpressionList FunctionEmitter::MakeCoordinateOperandsForImageAccess( } ast::TextureDimension dim = texture_type->dims; // Number of regular coordinates. - uint32_t num_axes = ast::NumCoordinateAxes(dim); + uint32_t num_axes = static_cast(ast::NumCoordinateAxes(dim)); bool is_arrayed = ast::IsTextureArray(dim); if ((num_axes == 0) || (num_axes > 3)) { Fail() << "unsupported image dimensionality for " << texture_type->TypeInfo().name @@ -5478,7 +5647,7 @@ ast::ExpressionList FunctionEmitter::MakeCoordinateOperandsForImageAccess( return {}; } - ast::ExpressionList result; + ExpressionList result; // Generates the expression for the WGSL coordinates, when it is a prefix // swizzle with num_axes. If the result would be unsigned, also converts @@ -5505,7 +5674,7 @@ ast::ExpressionList FunctionEmitter::MakeCoordinateOperandsForImageAccess( // The source must be a vector. It has at least one coordinate component // and it must have an array component. Use a vector swizzle to get the // first `num_axes` components. - result.push_back(prefix_swizzle_expr()); + result.Push(prefix_swizzle_expr()); // Now get the array index. const ast::Expression* array_index = @@ -5518,16 +5687,16 @@ ast::ExpressionList FunctionEmitter::MakeCoordinateOperandsForImageAccess( array_index = builder_.Call("round", array_index); } // Convert it to a signed integer type, if needed. - result.push_back(ToI32({component_type, array_index}).expr); + result.Push(ToI32({component_type, array_index}).expr); } else { if (num_coords_supplied == num_coords_required && !is_proj) { // Pass the value through, with possible unsigned->signed conversion. - result.push_back(ToSignedIfUnsigned(raw_coords).expr); + result.Push(ToSignedIfUnsigned(raw_coords).expr); } else { // There are more coordinates supplied than needed. So the source type // is a vector. Use a vector swizzle to get the first `num_axes` // components. - result.push_back(prefix_swizzle_expr()); + result.Push(prefix_swizzle_expr()); } } return result; @@ -5588,10 +5757,10 @@ const ast::Expression* FunctionEmitter::ConvertTexelForStorage( // Expand the texel to a 4 element vector. auto* component_type = texel.type->IsScalar() ? texel.type : texel.type->As()->type; texel.type = ty_.Vector(component_type, dest_count); - ast::ExpressionList exprs; - exprs.push_back(texel.expr); + ExpressionList exprs; + exprs.Push(texel.expr); for (auto i = src_count; i < dest_count; i++) { - exprs.push_back(parser_impl_.MakeNullExpression(component_type).expr); + exprs.Push(parser_impl_.MakeNullExpression(component_type).expr); } texel.expr = builder_.Construct(Source{}, texel.type->Build(builder_), std::move(exprs)); } @@ -5603,8 +5772,7 @@ TypedExpression FunctionEmitter::ToI32(TypedExpression value) { if (!value || value.type->Is()) { return value; } - return {ty_.I32(), - builder_.Construct(Source{}, builder_.ty.i32(), ast::ExpressionList{value.expr})}; + return {ty_.I32(), builder_.Construct(Source{}, builder_.ty.i32(), utils::Vector{value.expr})}; } TypedExpression FunctionEmitter::ToSignedIfUnsigned(TypedExpression value) { @@ -5613,8 +5781,7 @@ TypedExpression FunctionEmitter::ToSignedIfUnsigned(TypedExpression value) { } if (auto* vec_type = value.type->As()) { auto* new_type = ty_.Vector(ty_.I32(), vec_type->size); - return {new_type, - builder_.Construct(new_type->Build(builder_), ast::ExpressionList{value.expr})}; + return {new_type, builder_.Construct(new_type->Build(builder_), utils::Vector{value.expr})}; } return ToI32(value); } @@ -5677,20 +5844,22 @@ TypedExpression FunctionEmitter::MakeOuterProduct(const spvtools::opt::Instructi // | c.y * r.x c.y * r.y | // | c.z * r.x c.z * r.y | - ast::ExpressionList result_columns; + ExpressionList result_columns; for (uint32_t icol = 0; icol < result_ty->columns; icol++) { - ast::ExpressionList result_row; + ExpressionList result_row; auto* row_factor = create(Source{}, row.expr, Swizzle(icol)); for (uint32_t irow = 0; irow < result_ty->rows; irow++) { auto* column_factor = create(Source{}, col.expr, Swizzle(irow)); auto* elem = create(Source{}, ast::BinaryOp::kMultiply, row_factor, column_factor); - result_row.push_back(elem); + result_row.Push(elem); } - result_columns.push_back(builder_.Construct(Source{}, col_ty->Build(builder_), result_row)); + result_columns.Push( + builder_.Construct(Source{}, col_ty->Build(builder_), std::move(result_row))); } - return {result_ty, builder_.Construct(Source{}, result_ty->Build(builder_), result_columns)}; + return {result_ty, + builder_.Construct(Source{}, result_ty->Build(builder_), std::move(result_columns))}; } bool FunctionEmitter::MakeVectorInsertDynamic(const spvtools::opt::Instruction& inst) { diff --git a/src/tint/reader/spirv/function.h b/src/tint/reader/spirv/function.h index 8eb33ab8cd..7a2a86b7b5 100644 --- a/src/tint/reader/spirv/function.h +++ b/src/tint/reader/spirv/function.h @@ -16,6 +16,7 @@ #define SRC_TINT_READER_SPIRV_FUNCTION_H_ #include +#include #include #include #include @@ -125,7 +126,7 @@ struct BlockInfo { /// switch? bool default_is_merge = false; /// The list of switch values that cause a branch to this block. - std::unique_ptr> case_values; + std::optional> case_values; /// The following fields record relationships among blocks in a selection /// construct for an OpBranchConditional instruction. @@ -158,7 +159,7 @@ struct BlockInfo { /// The result IDs that this block is responsible for declaring as a /// hoisted variable. /// @see DefInfo#requires_hoisted_def - std::vector hoisted_ids; + utils::Vector hoisted_ids; /// A PhiAssignment represents the assignment of a value to the state /// variable associated with an OpPhi in a successor block. @@ -170,10 +171,10 @@ struct BlockInfo { }; /// If this basic block branches to a visited basic block containing phis, /// then this is the list of writes to the variables associated those phis. - std::vector phi_assignments; + utils::Vector phi_assignments; /// The IDs of OpPhi instructions which require their associated state /// variable to be declared in this basic block. - std::vector phis_needing_state_vars; + utils::Vector phis_needing_state_vars; }; /// Writes the BlockInfo to the ostream @@ -241,14 +242,22 @@ enum class SkipReason { struct DefInfo { /// Constructor. /// @param def_inst the SPIR-V instruction defining the ID - /// @param block_pos the position of the basic block where the ID is defined. + /// @param locally_defined true if the defining instruction is in the function + /// @param block_pos the position of the basic block where the ID is defined /// @param index an ordering index for this local definition - DefInfo(const spvtools::opt::Instruction& def_inst, uint32_t block_pos, size_t index); + DefInfo(const spvtools::opt::Instruction& def_inst, + bool locally_defined, + uint32_t block_pos, + size_t index); /// Destructor. ~DefInfo(); /// The SPIR-V instruction that defines the ID. const spvtools::opt::Instruction& inst; + + /// True if the definition of this ID is inside the function. + const bool locally_defined = true; + /// The position of the first block in which this ID is visible, in function /// block order. For IDs defined outside of the function, it is 0. /// For IDs defined in the function, it is the position of the block @@ -320,8 +329,11 @@ struct DefInfo { /// @returns the ostream so calls can be chained inline std::ostream& operator<<(std::ostream& o, const DefInfo& di) { o << "DefInfo{" - << " inst.result_id: " << di.inst.result_id() << " block_pos: " << di.block_pos - << " num_uses: " << di.num_uses << " last_use_pos: " << di.last_use_pos + << " inst.result_id: " << di.inst.result_id() + << " locally_defined: " << (di.locally_defined ? "true" : "false") + << " block_pos: " << di.block_pos << " num_uses: " << di.num_uses + << " last_use_pos: " << di.last_use_pos + << " used_in_another_construct: " << (di.used_in_another_construct ? "true" : "false") << " requires_named_const_def: " << (di.requires_named_const_def ? "true" : "false") << " requires_hoisted_def: " << (di.requires_hoisted_def ? "true" : "false") << " phi_var: '" << di.phi_var << "'"; @@ -365,7 +377,7 @@ inline std::ostream& operator<<(std::ostream& o, const DefInfo& di) { class StatementBuilder : public Castable { public: /// Constructor - StatementBuilder() : Base(ProgramID(), Source{}) {} + StatementBuilder() : Base(ProgramID(), ast::NodeID(), Source{}) {} /// @param builder the program builder /// @returns the build AST node @@ -377,6 +389,12 @@ class StatementBuilder : public Castable { /// A FunctionEmitter emits a SPIR-V function onto a Tint AST module. class FunctionEmitter { + using AttributeList = utils::Vector; + using StructMemberList = utils::Vector; + using ExpressionList = utils::Vector; + using ParameterList = utils::Vector; + using StatementList = utils::Vector; + public: /// Creates a FunctionEmitter, and prepares to write to the AST module /// in `pi` @@ -409,7 +427,7 @@ class FunctionEmitter { /// Finalizes any StatementBuilders returns the body of the function. /// Must only be called once, and to be used only for testing. /// @returns the body of the function. - const ast::StatementList ast_body(); + StatementList ast_body(); /// Records failure. /// @returns a FailStream on which to emit diagnostics. @@ -444,12 +462,12 @@ class FunctionEmitter { /// @returns false if emission failed bool EmitPipelineInput(std::string var_name, const Type* var_type, - ast::AttributeList* decos, - std::vector index_prefix, + AttributeList* decos, + utils::Vector index_prefix, const Type* tip_type, const Type* forced_param_type, - ast::VariableList* params, - ast::StatementList* statements); + ParameterList* params, + StatementList* statements); /// Creates one or more struct members from an output variable, and the /// expressions that compute the value they contribute to the entry point @@ -460,37 +478,30 @@ class FunctionEmitter { /// @param var_name The name of the variable /// @param var_type The store type of the variable /// @param decos The variable's decorations - /// @param index_prefix Indices stepping into the variable, indicating - /// what part of the variable to populate. - /// @param tip_type The type of the component inside variable, after indexing - /// with the indices in `index_prefix`. - /// @param forced_member_type The type forced by WGSL, if the variable is a - /// builtin, otherwise the same as var_type. - /// @param return_members The struct member list where the new member is - /// added. - /// @param return_exprs The expression list where the return expression is - /// added. + /// @param index_prefix Indices stepping into the variable, indicating what part of the variable + /// to populate. + /// @param tip_type The type of the component inside variable, after indexing with the indices + /// in `index_prefix`. + /// @param forced_member_type The type forced by WGSL, if the variable is a builtin, otherwise + /// the same as var_type. + /// @param return_members The struct member list where the new member is added. + /// @param return_exprs The expression list where the return expression is added. /// @returns false if emission failed bool EmitPipelineOutput(std::string var_name, const Type* var_type, - ast::AttributeList* decos, - std::vector index_prefix, + AttributeList* decos, + utils::Vector index_prefix, const Type* tip_type, const Type* forced_member_type, - ast::StructMemberList* return_members, - ast::ExpressionList* return_exprs); + StructMemberList* return_members, + ExpressionList* return_exprs); /// Updates the attribute list, replacing an existing Location attribute /// with another having one higher location value. Does nothing if no /// location attribute exists. /// Assumes the list contains at most one Location attribute. /// @param attributes the attribute list to modify - void IncrementLocation(ast::AttributeList* attributes); - - /// Returns the Location attribute, if it exists. - /// @param attributes the list of attributes to search - /// @returns the Location attribute, or nullptr if it doesn't exist - const ast::Attribute* GetLocation(const ast::AttributeList& attributes); + void IncrementLocation(AttributeList* attributes); /// Create an ast::BlockStatement representing the body of the function. /// This creates the statement stack, which is non-empty for the lifetime @@ -840,7 +851,7 @@ class FunctionEmitter { return info && info->pos != kInvalidBlockPos; } - /// Gets the local definition info for a result ID. + /// Gets the definition info for a result ID. /// @param id the SPIR-V ID of local definition. /// @returns the definition info for the given ID, if it exists, or nullptr DefInfo* GetDefInfo(uint32_t id) const { @@ -902,7 +913,7 @@ class FunctionEmitter { /// On failure, issues an error and returns an empty expression list. /// @param image_access the image access instruction /// @returns an ExpressionList of the coordinate and array index (if any) - ast::ExpressionList MakeCoordinateOperandsForImageAccess( + ExpressionList MakeCoordinateOperandsForImageAccess( const spvtools::opt::Instruction& image_access); /// Returns the given value as an I32. If it's already an I32 then this @@ -940,11 +951,11 @@ class FunctionEmitter { /// Function name std::string name; /// Function parameters - ast::VariableList params; + ParameterList params; /// Function return type const Type* return_type; /// Function attributes - ast::AttributeList attributes; + AttributeList attributes; }; /// Parse the function declaration, which comprises the name, parameters, and @@ -1049,7 +1060,7 @@ class FunctionEmitter { /// Emits a texture builtin function call for a SPIR-V instruction that /// accesses an image or sampled image. /// @param inst the SPIR-V instruction - /// @returns an expression + /// @returns true on success, false on error bool EmitImageAccess(const spvtools::opt::Instruction& inst); /// Emits statements to implement a SPIR-V image query. @@ -1057,6 +1068,11 @@ class FunctionEmitter { /// @returns an expression bool EmitImageQuery(const spvtools::opt::Instruction& inst); + /// Emits statements to implement a SPIR-V atomic op. + /// @param inst the SPIR-V instruction + /// @returns true on success, false on error + bool EmitAtomicOp(const spvtools::opt::Instruction& inst); + /// Converts the given texel to match the type required for the storage /// texture with the given type. In WGSL the texel value is always provided /// as a 4-element vector, but the component type is determined by the @@ -1101,8 +1117,8 @@ class FunctionEmitter { /// @return the built StatementBuilder template T* AddStatementBuilder(ARGS&&... args) { - TINT_ASSERT(Reader, !statements_stack_.empty()); - return statements_stack_.back().AddStatementBuilder(std::forward(args)...); + TINT_ASSERT(Reader, !statements_stack_.IsEmpty()); + return statements_stack_.Back().AddStatementBuilder(std::forward(args)...); } /// Returns the source record for the given instruction. @@ -1110,10 +1126,10 @@ class FunctionEmitter { /// @return the Source record, or a default one Source GetSourceForInst(const spvtools::opt::Instruction& inst) const; - /// @returns the last statetment in the top of the statement stack. + /// @returns the last statement in the top of the statement stack. const ast::Statement* LastStatement(); - using CompletionAction = std::function; + using CompletionAction = std::function; // A StatementBlock represents a braced-list of statements while it is being // constructed. @@ -1165,7 +1181,7 @@ class FunctionEmitter { /// @return the list of statements being built, if this construct is not a /// switch. - const ast::StatementList& GetStatements() const { return statements_; } + const StatementList& GetStatements() const { return statements_; } private: /// The construct to which this construct constributes. @@ -1177,7 +1193,7 @@ class FunctionEmitter { /// The completion action finishes processing this statement block. FunctionEmitter::CompletionAction const completion_action_; /// The list of statements being built, if this construct is not a switch. - ast::StatementList statements_; + StatementList statements_; /// Owned statement builders std::vector> builders_; @@ -1235,7 +1251,6 @@ class FunctionEmitter { return builder_.create(std::forward(args)...); } - using StatementsStack = std::vector; using PtrAs = ParserImpl::PtrAs; ParserImpl& parser_impl_; @@ -1259,7 +1274,7 @@ class FunctionEmitter { // for the entire function. This stack is never empty. // The `construct` member for the 0th element is only valid during the // lifetime of the EmitFunctionBodyStatements method. - StatementsStack statements_stack_; + utils::Vector statements_stack_; // The map of IDs that have already had an identifier name generated for it, // to their Type. @@ -1274,7 +1289,9 @@ class FunctionEmitter { // Mapping from block ID to its bookkeeping info. std::unordered_map> block_info_; - // Mapping from a locally-defined result ID to its bookkeeping info. + // Mapping from a result ID to its bookkeeping info. This may be + // either a result ID defined in the function body, or the ID of a + // module-scope variable. std::unordered_map> def_info_; // Structured constructs, where enclosing constructs precede their children. diff --git a/src/tint/reader/spirv/function_arithmetic_test.cc b/src/tint/reader/spirv/function_arithmetic_test.cc index 9db49d9ced..059791677f 100644 --- a/src/tint/reader/spirv/function_arithmetic_test.cc +++ b/src/tint/reader/spirv/function_arithmetic_test.cc @@ -93,10 +93,10 @@ std::string AstFor(std::string assembly) { return "bitcast>(vec2(40i, 30i))"; } if (assembly == "v2float_50_60") { - return "vec2(50.0, 60.0)"; + return "vec2(50.0f, 60.0f)"; } if (assembly == "v2float_60_50") { - return "vec2(60.0, 50.0)"; + return "vec2(60.0f, 50.0f)"; } return "bad case"; } @@ -253,7 +253,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Scalar) { auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); - EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : f32 = -(50.0);")); + EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : f32 = -(50.0f);")); } TEST_F(SpvUnaryArithTest, FNegate_Vector) { @@ -270,7 +270,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Vector) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : vec2 = -(vec2(50.0, 60.0));")); + HasSubstr("let x_1 : vec2 = -(vec2(50.0f, 60.0f));")); } struct BinaryData { @@ -394,8 +394,8 @@ INSTANTIATE_TEST_SUITE_P(SpvParserTest_FAdd, SpvBinaryArithTest, ::testing::Values( // Scalar float - BinaryData{"float", "float_50", "OpFAdd", "float_60", "f32", "50.0", - "+", "60.0"}, // Vector float + BinaryData{"float", "float_50", "OpFAdd", "float_60", "f32", "50.0f", + "+", "60.0f"}, // Vector float BinaryData{"v2float", "v2float_50_60", "OpFAdd", "v2float_60_50", "vec2", AstFor("v2float_50_60"), "+", AstFor("v2float_60_50")})); @@ -441,8 +441,8 @@ INSTANTIATE_TEST_SUITE_P(SpvParserTest_FSub, SpvBinaryArithTest, ::testing::Values( // Scalar float - BinaryData{"float", "float_50", "OpFSub", "float_60", "f32", "50.0", - "-", "60.0"}, // Vector float + BinaryData{"float", "float_50", "OpFSub", "float_60", "f32", "50.0f", + "-", "60.0f"}, // Vector float BinaryData{"v2float", "v2float_50_60", "OpFSub", "v2float_60_50", "vec2", AstFor("v2float_50_60"), "-", AstFor("v2float_60_50")})); @@ -488,8 +488,8 @@ INSTANTIATE_TEST_SUITE_P(SpvParserTest_FMul, SpvBinaryArithTest, ::testing::Values( // Scalar float - BinaryData{"float", "float_50", "OpFMul", "float_60", "f32", "50.0", - "*", "60.0"}, // Vector float + BinaryData{"float", "float_50", "OpFMul", "float_60", "f32", "50.0f", + "*", "60.0f"}, // Vector float BinaryData{"v2float", "v2float_50_60", "OpFMul", "v2float_60_50", "vec2", AstFor("v2float_50_60"), "*", AstFor("v2float_60_50")})); @@ -576,8 +576,8 @@ INSTANTIATE_TEST_SUITE_P(SpvParserTest_FDiv, SpvBinaryArithTest, ::testing::Values( // Scalar float - BinaryData{"float", "float_50", "OpFDiv", "float_60", "f32", "50.0", - "/", "60.0"}, // Vector float + BinaryData{"float", "float_50", "OpFDiv", "float_60", "f32", "50.0f", + "/", "60.0f"}, // Vector float BinaryData{"v2float", "v2float_50_60", "OpFDiv", "v2float_60_50", "vec2", AstFor("v2float_50_60"), "/", AstFor("v2float_60_50")})); @@ -667,8 +667,8 @@ INSTANTIATE_TEST_SUITE_P(SpvParserTest_FRem, SpvBinaryArithTest, ::testing::Values( // Scalar float - BinaryData{"float", "float_50", "OpFRem", "float_60", "f32", "50.0", - "%", "60.0"}, // Vector float + BinaryData{"float", "float_50", "OpFRem", "float_60", "f32", "50.0f", + "%", "60.0f"}, // Vector float BinaryData{"v2float", "v2float_50_60", "OpFRem", "v2float_60_50", "vec2", AstFor("v2float_50_60"), "%", AstFor("v2float_60_50")})); @@ -687,7 +687,7 @@ TEST_F(SpvBinaryArithTestBasic, FMod_Scalar) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : f32 = (50.0 - (60.0 * floor((50.0 / 60.0))));")); + HasSubstr("let x_1 : f32 = (50.0f - (60.0f * floor((50.0f / 60.0f))));")); } TEST_F(SpvBinaryArithTestBasic, FMod_Vector) { @@ -706,7 +706,7 @@ TEST_F(SpvBinaryArithTestBasic, FMod_Vector) { EXPECT_THAT( test::ToString(p->program(), ast_body), HasSubstr( - R"(let x_1 : vec2 = (vec2(50.0, 60.0) - (vec2(60.0, 50.0) * floor((vec2(50.0, 60.0) / vec2(60.0, 50.0)))));)")); + R"(let x_1 : vec2 = (vec2(50.0f, 60.0f) - (vec2(60.0f, 50.0f) * floor((vec2(50.0f, 60.0f) / vec2(60.0f, 50.0f)))));)")); } TEST_F(SpvBinaryArithTestBasic, VectorTimesScalar) { diff --git a/src/tint/reader/spirv/function_call_test.cc b/src/tint/reader/spirv/function_call_test.cc index aa1789b883..6b12eced92 100644 --- a/src/tint/reader/spirv/function_call_test.cc +++ b/src/tint/reader/spirv/function_call_test.cc @@ -59,7 +59,7 @@ fn x_100_1() { return; } -@stage(fragment) +@fragment fn x_100() { x_100_1(); } @@ -87,13 +87,13 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParams) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - ast::StatementList f100; + utils::Vector f100; { auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()) << p->error(); f100 = fe.ast_body(); } - ast::StatementList f50; + utils::Vector f50; { auto fe = p->function_emitter(50); EXPECT_TRUE(fe.EmitBody()) << p->error(); @@ -128,13 +128,13 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParamsUsedTwice) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - ast::StatementList f100; + utils::Vector f100; { auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()) << p->error(); f100 = fe.ast_body(); } - ast::StatementList f50; + utils::Vector f50; { auto fe = p->function_emitter(50); EXPECT_TRUE(fe.EmitBody()) << p->error(); @@ -185,7 +185,7 @@ fn x_100_1() { return; } -@stage(fragment) +@fragment fn x_100() { x_100_1(); } diff --git a/src/tint/reader/spirv/function_cfg_test.cc b/src/tint/reader/spirv/function_cfg_test.cc index edeea55271..fb5aff77db 100644 --- a/src/tint/reader/spirv/function_cfg_test.cc +++ b/src/tint/reader/spirv/function_cfg_test.cc @@ -2894,8 +2894,8 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_OuterConstructIsFunction_Sin fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); - EXPECT_EQ(fe.constructs().size(), 1u); - auto& c = fe.constructs().front(); + EXPECT_EQ(fe.constructs().Length(), 1u); + auto& c = fe.constructs().Front(); EXPECT_THAT(ToString(c), Eq("Construct{ Function [0,1) begin_id:10 end_id:0 " "depth:0 parent:null }")); EXPECT_EQ(fe.GetBlockInfo(10)->construct, c.get()); @@ -2920,8 +2920,8 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_OuterConstructIsFunction_Mul fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); - EXPECT_EQ(fe.constructs().size(), 1u); - auto& c = fe.constructs().front(); + EXPECT_EQ(fe.constructs().Length(), 1u); + auto& c = fe.constructs().Front(); EXPECT_THAT(ToString(c), Eq("Construct{ Function [0,2) begin_id:10 end_id:0 " "depth:0 parent:null }")); EXPECT_EQ(fe.GetBlockInfo(10)->construct, c.get()); @@ -2955,7 +2955,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAnd fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 2u); + EXPECT_EQ(constructs.Length(), 2u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,4) begin_id:10 end_id:0 depth:0 parent:null } Construct{ IfSelection [0,3) begin_id:10 end_id:99 depth:1 parent:Function@10 } @@ -3001,7 +3001,7 @@ TEST_F(SpvParserCFGTest, fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 2u); + EXPECT_EQ(constructs.Length(), 2u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,6) begin_id:5 end_id:0 depth:0 parent:null } Construct{ IfSelection [1,4) begin_id:10 end_id:99 depth:1 parent:Function@5 } @@ -3045,7 +3045,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_SwitchSelection) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 2u); + EXPECT_EQ(constructs.Length(), 2u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,5) begin_id:10 end_id:0 depth:0 parent:null } Construct{ SwitchSelection [0,4) begin_id:10 end_id:99 depth:1 parent:Function@10 in-c-l-s:SwitchSelection@10 } @@ -3082,7 +3082,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_SingleBlockLoop) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 2u); + EXPECT_EQ(constructs.Length(), 2u); // A single-block loop consists *only* of a continue target with one block in // it. EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ @@ -3188,6 +3188,9 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_MultiBlockLoop_HeaderIsConti EXPECT_EQ(fe.GetBlockInfo(40)->construct, constructs[1].get()); EXPECT_EQ(fe.GetBlockInfo(50)->construct, constructs[1].get()); EXPECT_EQ(fe.GetBlockInfo(99)->construct, constructs[0].get()); + + // SPIR-V 1.6 Rev 2 made this invalid SPIR-V. + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop) { @@ -3220,7 +3223,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockL fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 3u); + EXPECT_EQ(constructs.Length(), 3u); // A single-block loop consists *only* of a continue target with one block in // it. EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ @@ -3268,7 +3271,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLo fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 4u); + EXPECT_EQ(constructs.Length(), 4u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,5) begin_id:10 end_id:0 depth:0 parent:null } Construct{ IfSelection [0,2) begin_id:10 end_id:50 depth:1 parent:Function@10 } @@ -3327,7 +3330,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_Nest_If_If) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 4u); + EXPECT_EQ(constructs.Length(), 4u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,9) begin_id:10 end_id:0 depth:0 parent:null } Construct{ IfSelection [0,8) begin_id:10 end_id:99 depth:1 parent:Function@10 } @@ -3387,7 +3390,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_Nest_Switch_If) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 4u); + EXPECT_EQ(constructs.Length(), 4u); // The ordering among siblings depends on the computed block order. EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,8) begin_id:10 end_id:0 depth:0 parent:null } @@ -3437,7 +3440,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_Nest_If_Switch) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 3u); + EXPECT_EQ(constructs.Length(), 3u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,5) begin_id:10 end_id:0 depth:0 parent:null } Construct{ IfSelection [0,4) begin_id:10 end_id:99 depth:1 parent:Function@10 } @@ -3491,7 +3494,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_Nest_Loop_Loop) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 4u); + EXPECT_EQ(constructs.Length(), 4u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,8) begin_id:10 end_id:0 depth:0 parent:null } Construct{ Continue [4,6) begin_id:50 end_id:89 depth:1 parent:Function@10 in-c:Continue@50 } @@ -3546,7 +3549,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_Nest_Loop_If) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 4u); + EXPECT_EQ(constructs.Length(), 4u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,7) begin_id:10 end_id:0 depth:0 parent:null } Construct{ Continue [5,6) begin_id:80 end_id:99 depth:1 parent:Function@10 in-c:Continue@80 } @@ -3597,7 +3600,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_Nest_LoopContinue_If) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 4u); + EXPECT_EQ(constructs.Length(), 4u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,6) begin_id:10 end_id:0 depth:0 parent:null } Construct{ Continue [2,5) begin_id:30 end_id:99 depth:1 parent:Function@10 in-c:Continue@30 } @@ -3641,7 +3644,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_Nest_If_SingleBlockLoop) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 3u); + EXPECT_EQ(constructs.Length(), 3u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,4) begin_id:10 end_id:0 depth:0 parent:null } Construct{ IfSelection [0,3) begin_id:10 end_id:99 depth:1 parent:Function@10 } @@ -3690,7 +3693,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_Nest_If_MultiBlockLoop) { fe.RegisterMerges(); EXPECT_TRUE(fe.LabelControlFlowConstructs()); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 4u); + EXPECT_EQ(constructs.Length(), 4u); EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,7) begin_id:10 end_id:0 depth:0 parent:null } Construct{ IfSelection [0,6) begin_id:10 end_id:99 depth:1 parent:Function@10 } @@ -3740,7 +3743,7 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_LoopInterallyDiverge) { auto fe = p->function_emitter(100); ASSERT_TRUE(FlowLabelControlFlowConstructs(&fe)) << p->error(); const auto& constructs = fe.constructs(); - EXPECT_EQ(constructs.size(), 4u); + EXPECT_EQ(constructs.Length(), 4u); ASSERT_THAT(ToString(constructs), Eq(R"(ConstructList{ Construct{ Function [0,6) begin_id:10 end_id:0 depth:0 parent:null } Construct{ Continue [4,5) begin_id:90 end_id:99 depth:1 parent:Function@10 in-c:Continue@90 } @@ -4154,7 +4157,7 @@ TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_NoSwitch) { EXPECT_EQ(bi10->case_head_for, nullptr); EXPECT_EQ(bi10->default_head_for, nullptr); EXPECT_FALSE(bi10->default_is_merge); - EXPECT_EQ(bi10->case_values.get(), nullptr); + EXPECT_FALSE(bi10->case_values.has_value()); } TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_DefaultIsMerge) { @@ -4189,7 +4192,7 @@ TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_DefaultIsMerge) { ASSERT_NE(bi99->default_head_for, nullptr); EXPECT_EQ(bi99->default_head_for->begin_id, 10u); EXPECT_TRUE(bi99->default_is_merge); - EXPECT_EQ(bi99->case_values.get(), nullptr); + EXPECT_FALSE(bi99->case_values.has_value()); } TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_DefaultIsNotMerge) { @@ -4227,7 +4230,7 @@ TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_DefaultIsNotMerge) { ASSERT_NE(bi30->default_head_for, nullptr); EXPECT_EQ(bi30->default_head_for->begin_id, 10u); EXPECT_FALSE(bi30->default_is_merge); - EXPECT_EQ(bi30->case_values.get(), nullptr); + EXPECT_FALSE(bi30->case_values.has_value()); } TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_CaseIsNotDefault) { @@ -4265,7 +4268,7 @@ TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_CaseIsNotDefault) { EXPECT_EQ(bi20->case_head_for->begin_id, 10u); EXPECT_EQ(bi20->default_head_for, nullptr); EXPECT_FALSE(bi20->default_is_merge); - EXPECT_THAT(*(bi20->case_values.get()), UnorderedElementsAre(200)); + EXPECT_THAT(bi20->case_values.value(), UnorderedElementsAre(200)); } TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_CaseIsDefault) { @@ -4300,7 +4303,7 @@ TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_CaseIsDefault) { EXPECT_EQ(bi20->case_head_for->begin_id, 10u); EXPECT_EQ(bi20->default_head_for, bi20->case_head_for); EXPECT_FALSE(bi20->default_is_merge); - EXPECT_THAT(*(bi20->case_values.get()), UnorderedElementsAre(200)); + EXPECT_THAT(bi20->case_values.value(), UnorderedElementsAre(200)); } TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_ManyCasesWithSameValue_IsError) { @@ -4367,7 +4370,7 @@ TEST_F(SpvParserCFGTest, FindSwitchCaseHeaders_ManyValuesWithSameCase) { EXPECT_EQ(bi20->case_head_for->begin_id, 10u); EXPECT_EQ(bi20->default_head_for, nullptr); EXPECT_FALSE(bi20->default_is_merge); - EXPECT_THAT(*(bi20->case_values.get()), UnorderedElementsAre(200, 300)); + EXPECT_THAT(bi20->case_values.value(), UnorderedElementsAre(200, 300)); } TEST_F(SpvParserCFGTest, ClassifyCFGEdges_BranchEscapesIfConstruct) { @@ -4726,6 +4729,12 @@ TEST_F( ASSERT_NE(bi50, nullptr); EXPECT_EQ(bi50->succ_edge.count(20), 1u); EXPECT_EQ(bi50->succ_edge[20], EdgeKind::kBack); + + // SPIR-V 1.6 Rev 2 made this invalid SPIR-V. + // The continue target also has the LoopMerge in it, but the continue + // target 20 is not structurally post-dominated by the back-edge block 50. + // Don't dump this as an end-to-end test. + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserCFGTest, ClassifyCFGEdges_PrematureExitFromContinueConstruct) { @@ -8640,6 +8649,9 @@ var_1 = 3u; return; )"; ASSERT_EQ(expect, got); + + // Continue target does not structurally dominate the backedge block. + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserCFGTest, EmitBody_Loop_Never) { @@ -12608,6 +12620,11 @@ TEST_F(SpvParserCFGTest, SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop) { const Construct* c = fe.GetBlockInfo(20)->construct; EXPECT_EQ(c->kind, Construct::kContinue); EXPECT_EQ(fe.SiblingLoopConstruct(c), nullptr); + + // SPIR-V 1.6 Rev 2 made this invalid SPIR-V. + // Continue target is not structurally post dominated by the backedge block. + // Don't dump this as an end-to-end test. + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserCFGTest, SiblingLoopConstruct_HasSiblingLoop) { diff --git a/src/tint/reader/spirv/function_composite_test.cc b/src/tint/reader/spirv/function_composite_test.cc index 2e15743246..2b26d146fe 100644 --- a/src/tint/reader/spirv/function_composite_test.cc +++ b/src/tint/reader/spirv/function_composite_test.cc @@ -98,7 +98,7 @@ TEST_F(SpvParserTest_Composite_Construct, Vector) { EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(let x_1 : vec2 = vec2(10u, 20u); let x_2 : vec2 = vec2(30i, 40i); -let x_3 : vec2 = vec2(50.0, 60.0); +let x_3 : vec2 = vec2(50.0f, 60.0f); )")); } @@ -117,9 +117,9 @@ TEST_F(SpvParserTest_Composite_Construct, Matrix) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : mat3x2 = mat3x2(" - "vec2(50.0, 60.0), " - "vec2(60.0, 50.0), " - "vec2(70.0, 70.0));")); + "vec2(50.0f, 60.0f), " + "vec2(60.0f, 50.0f), " + "vec2(70.0f, 70.0f));")); } TEST_F(SpvParserTest_Composite_Construct, Array) { @@ -153,7 +153,7 @@ TEST_F(SpvParserTest_Composite_Construct, Struct) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : S = S(vec2(50.0, 60.0), 5u, 30i);")); + HasSubstr("let x_1 : S = S(vec2(50.0f, 60.0f), 5u, 30i);")); } TEST_F(SpvParserTest_Composite_Construct, ConstantComposite_Struct_NoDeduplication) { @@ -201,7 +201,7 @@ TEST_F(SpvParserTest_CompositeExtract, Vector) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : f32 = vec2(50.0, 60.0).y;")); + HasSubstr("let x_1 : f32 = vec2(50.0f, 60.0f).y;")); } TEST_F(SpvParserTest_CompositeExtract, Vector_IndexTooBigError) { @@ -448,8 +448,8 @@ TEST_F(SpvParserTest_CompositeInsert, Vector) { auto ast_body = fe.ast_body(); auto got = test::ToString(p->program(), ast_body); const auto* expected = - R"(var x_1_1 : vec2 = vec2(50.0, 60.0); -x_1_1.y = 70.0; + R"(var x_1_1 : vec2 = vec2(50.0f, 60.0f); +x_1_1.y = 70.0f; let x_1 : vec2 = x_1_1; return; )"; @@ -492,7 +492,7 @@ TEST_F(SpvParserTest_CompositeInsert, Matrix) { auto ast_body = fe.ast_body(); auto body_str = test::ToString(p->program(), ast_body); EXPECT_THAT(body_str, HasSubstr(R"(var x_2_1 : mat3x2 = x_1; -x_2_1[2u] = vec2(50.0, 60.0); +x_2_1[2u] = vec2(50.0f, 60.0f); let x_2 : mat3x2 = x_2_1; )")) << body_str; } @@ -537,7 +537,7 @@ TEST_F(SpvParserTest_CompositeInsert, Matrix_Vector) { auto ast_body = fe.ast_body(); auto body_str = test::ToString(p->program(), ast_body); EXPECT_THAT(body_str, HasSubstr(R"(var x_2_1 : mat3x2 = x_1; -x_2_1[2u] = vec2(50.0, 60.0); +x_2_1[2u] = vec2(50.0f, 60.0f); let x_2 : mat3x2 = x_2_1; return; )")) << body_str; @@ -713,7 +713,7 @@ TEST_F(SpvParserTest_CompositeInsert, Struct_Array_Matrix_Vector) { EXPECT_THAT(body_str, HasSubstr(R"(var x_38 : S_1; let x_1 : S_1 = x_38; var x_2_1 : S_1 = x_1; -x_2_1.field1[2u][0u].y = 70.0; +x_2_1.field1[2u][0u].y = 70.0f; let x_2 : S_1 = x_2_1; )")) << body_str; } diff --git a/src/tint/reader/spirv/function_conversion_test.cc b/src/tint/reader/spirv/function_conversion_test.cc index e2f10b22e1..eab003129c 100644 --- a/src/tint/reader/spirv/function_conversion_test.cc +++ b/src/tint/reader/spirv/function_conversion_test.cc @@ -83,7 +83,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Scalar) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : u32 = bitcast(50.0);")); + HasSubstr("let x_1 : u32 = bitcast(50.0f);")); } TEST_F(SpvUnaryConversionTest, Bitcast_Vector) { diff --git a/src/tint/reader/spirv/function_decl_test.cc b/src/tint/reader/spirv/function_decl_test.cc index bced9358cd..8af9da2172 100644 --- a/src/tint/reader/spirv/function_decl_test.cc +++ b/src/tint/reader/spirv/function_decl_test.cc @@ -93,7 +93,7 @@ TEST_F(SpvParserTest, Emit_NonVoidResultType) { auto got = test::ToString(p->program()); std::string expect = R"(fn x_200() -> f32 { - return 0.0; + return 0.0f; } )"; EXPECT_THAT(got, HasSubstr(expect)); diff --git a/src/tint/reader/spirv/function_glsl_std_450_test.cc b/src/tint/reader/spirv/function_glsl_std_450_test.cc index 319332a7ff..4836a6851c 100644 --- a/src/tint/reader/spirv/function_glsl_std_450_test.cc +++ b/src/tint/reader/spirv/function_glsl_std_450_test.cc @@ -673,7 +673,7 @@ TEST_F(SpvParserTest, Normalize_Scalar) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); const auto body = test::ToString(p->program(), ast_body); - EXPECT_THAT(body, HasSubstr("let x_1 : f32 = 1.0;")) << body; + EXPECT_THAT(body, HasSubstr("let x_1 : f32 = 1.0f;")) << body; } TEST_F(SpvParserTest, Normalize_Vector2) { @@ -981,7 +981,7 @@ TEST_F(SpvParserTest, GlslStd450_Refract_Scalar) { auto ast_body = fe.ast_body(); const auto body = test::ToString(p->program(), ast_body); const auto* expected = - R"(let x_1 : f32 = refract(vec2(f1, 0.0), vec2(f2, 0.0), f3).x;)"; + R"(let x_1 : f32 = refract(vec2(f1, 0.0f), vec2(f2, 0.0f), f3).x;)"; EXPECT_THAT(body, HasSubstr(expected)) << body; } @@ -1019,7 +1019,7 @@ TEST_F(SpvParserTest, GlslStd450_FaceForward_Scalar) { // The %99 sum only has one use. Ensure it is evaluated only once by // making a let-declaration for it, since it is the normal operand to // the builtin function, and code generation uses it twice. - const auto* expected = R"(let x_1 : f32 = select(-(x_99), x_99, ((f2 * f3) < 0.0));)"; + const auto* expected = R"(let x_1 : f32 = select(-(x_99), x_99, ((f2 * f3) < 0.0f));)"; EXPECT_THAT(body, HasSubstr(expected)) << body; } @@ -1059,7 +1059,7 @@ TEST_F(SpvParserTest, GlslStd450_Reflect_Scalar) { // The %99 sum only has one use. Ensure it is evaluated only once by // making a let-declaration for it, since it is the normal operand to // the builtin function, and code generation uses it twice. - const auto* expected = R"(let x_1 : f32 = (x_98 - (2.0 * (x_99 * (x_99 * x_98))));)"; + const auto* expected = R"(let x_1 : f32 = (x_98 - (2.0f * (x_99 * (x_99 * x_98))));)"; EXPECT_THAT(body, HasSubstr(expected)) << body; } diff --git a/src/tint/reader/spirv/function_logical_test.cc b/src/tint/reader/spirv/function_logical_test.cc index ba73d5d10e..474af2e443 100644 --- a/src/tint/reader/spirv/function_logical_test.cc +++ b/src/tint/reader/spirv/function_logical_test.cc @@ -112,10 +112,10 @@ std::string AstFor(std::string assembly) { return "bitcast>(vec2(40i, 30i))"; } if (assembly == "v2float_50_60") { - return "vec2(50.0, 60.0)"; + return "vec2(50.0f, 60.0f)"; } if (assembly == "v2float_60_50") { - return "vec2(60.0, 50.0)"; + return "vec2(60.0f, 50.0f)"; } return "bad case"; } @@ -219,7 +219,7 @@ INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdEqual, SpvBinaryLogicalTest, ::testing::Values(BinaryData{"bool", "float_50", "OpFOrdEqual", "float_60", - "bool", "50.0", "==", "60.0"}, + "bool", "50.0f", "==", "60.0f"}, BinaryData{"v2bool", "v2float_50_60", "OpFOrdEqual", "v2float_60_50", "vec2", AstFor("v2float_50_60"), @@ -249,7 +249,7 @@ INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdNotEqual, SpvBinaryLogicalTest, ::testing::Values(BinaryData{"bool", "float_50", "OpFOrdNotEqual", - "float_60", "bool", "50.0", "!=", "60.0"}, + "float_60", "bool", "50.0f", "!=", "60.0f"}, BinaryData{"v2bool", "v2float_50_60", "OpFOrdNotEqual", "v2float_60_50", "vec2", AstFor("v2float_50_60"), @@ -258,7 +258,7 @@ INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdNotEqual, INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdLessThan, SpvBinaryLogicalTest, ::testing::Values(BinaryData{"bool", "float_50", "OpFOrdLessThan", - "float_60", "bool", "50.0", "<", "60.0"}, + "float_60", "bool", "50.0f", "<", "60.0f"}, BinaryData{"v2bool", "v2float_50_60", "OpFOrdLessThan", "v2float_60_50", "vec2", AstFor("v2float_50_60"), "<", @@ -267,7 +267,7 @@ INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdLessThan, INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdLessThanEqual, SpvBinaryLogicalTest, ::testing::Values(BinaryData{"bool", "float_50", "OpFOrdLessThanEqual", - "float_60", "bool", "50.0", "<=", "60.0"}, + "float_60", "bool", "50.0f", "<=", "60.0f"}, BinaryData{"v2bool", "v2float_50_60", "OpFOrdLessThanEqual", "v2float_60_50", "vec2", AstFor("v2float_50_60"), @@ -276,7 +276,7 @@ INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdLessThanEqual, INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdGreaterThan, SpvBinaryLogicalTest, ::testing::Values(BinaryData{"bool", "float_50", "OpFOrdGreaterThan", - "float_60", "bool", "50.0", ">", "60.0"}, + "float_60", "bool", "50.0f", ">", "60.0f"}, BinaryData{"v2bool", "v2float_50_60", "OpFOrdGreaterThan", "v2float_60_50", "vec2", AstFor("v2float_50_60"), ">", @@ -285,7 +285,7 @@ INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdGreaterThan, INSTANTIATE_TEST_SUITE_P(SpvParserTest_FOrdGreaterThanEqual, SpvBinaryLogicalTest, ::testing::Values(BinaryData{"bool", "float_50", "OpFOrdGreaterThanEqual", - "float_60", "bool", "50.0", ">=", "60.0"}, + "float_60", "bool", "50.0f", ">=", "60.0f"}, BinaryData{"v2bool", "v2float_50_60", "OpFOrdGreaterThanEqual", "v2float_60_50", "vec2", AstFor("v2float_50_60"), @@ -515,7 +515,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Scalar) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : bool = !((50.0 != 60.0));")); + HasSubstr("let x_1 : bool = !((50.0f != 60.0f));")); } TEST_F(SpvFUnordTest, FUnordEqual_Vector) { @@ -533,7 +533,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Vector) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : vec2 = " - "!((vec2(50.0, 60.0) != vec2(60.0, 50.0)));")); + "!((vec2(50.0f, 60.0f) != vec2(60.0f, 50.0f)));")); } TEST_F(SpvFUnordTest, FUnordNotEqual_Scalar) { @@ -550,7 +550,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Scalar) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : bool = !((50.0 == 60.0));")); + HasSubstr("let x_1 : bool = !((50.0f == 60.0f));")); } TEST_F(SpvFUnordTest, FUnordNotEqual_Vector) { @@ -568,7 +568,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Vector) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : vec2 = " - "!((vec2(50.0, 60.0) == vec2(60.0, 50.0)));")); + "!((vec2(50.0f, 60.0f) == vec2(60.0f, 50.0f)));")); } TEST_F(SpvFUnordTest, FUnordLessThan_Scalar) { @@ -585,7 +585,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Scalar) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : bool = !((50.0 >= 60.0));")); + HasSubstr("let x_1 : bool = !((50.0f >= 60.0f));")); } TEST_F(SpvFUnordTest, FUnordLessThan_Vector) { @@ -603,7 +603,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Vector) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : vec2 = " - "!((vec2(50.0, 60.0) >= vec2(60.0, 50.0)));")); + "!((vec2(50.0f, 60.0f) >= vec2(60.0f, 50.0f)));")); } TEST_F(SpvFUnordTest, FUnordLessThanEqual_Scalar) { @@ -620,7 +620,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Scalar) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : bool = !((50.0 > 60.0));")); + HasSubstr("let x_1 : bool = !((50.0f > 60.0f));")); } TEST_F(SpvFUnordTest, FUnordLessThanEqual_Vector) { @@ -638,7 +638,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Vector) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : vec2 = " - "!((vec2(50.0, 60.0) > vec2(60.0, 50.0)));")); + "!((vec2(50.0f, 60.0f) > vec2(60.0f, 50.0f)));")); } TEST_F(SpvFUnordTest, FUnordGreaterThan_Scalar) { @@ -655,7 +655,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Scalar) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : bool = !((50.0 <= 60.0));")); + HasSubstr("let x_1 : bool = !((50.0f <= 60.0f));")); } TEST_F(SpvFUnordTest, FUnordGreaterThan_Vector) { @@ -673,7 +673,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Vector) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : vec2 = " - "!((vec2(50.0, 60.0) <= vec2(60.0, 50.0)));")); + "!((vec2(50.0f, 60.0f) <= vec2(60.0f, 50.0f)));")); } TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Scalar) { @@ -690,7 +690,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Scalar) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : bool = !((50.0 < 60.0));")); + HasSubstr("let x_1 : bool = !((50.0f < 60.0f));")); } TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Vector) { @@ -708,7 +708,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Vector) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : vec2 = !((" - "vec2(50.0, 60.0) < vec2(60.0, 50.0)" + "vec2(50.0f, 60.0f) < vec2(60.0f, 50.0f)" "));")); } @@ -762,7 +762,7 @@ TEST_F(SpvLogicalTest, Select_BoolCond_FloatScalarParams) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : f32 = select(60.0, 50.0, true);")); + HasSubstr("let x_1 : f32 = select(60.0f, 50.0f, true);")); } TEST_F(SpvLogicalTest, Select_BoolCond_VectorParams) { @@ -859,7 +859,8 @@ TEST_F(SpvLogicalTest, IsNan_Scalar) { auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); - EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : bool = isNan(50.0);")); + EXPECT_THAT(test::ToString(p->program(), ast_body), + HasSubstr("let x_1 : bool = isNan(50.0f);")); } TEST_F(SpvLogicalTest, IsNan_Vector) { @@ -876,7 +877,7 @@ TEST_F(SpvLogicalTest, IsNan_Vector) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : vec2 = isNan(vec2(50.0, 60.0));")); + HasSubstr("let x_1 : vec2 = isNan(vec2(50.0f, 60.0f));")); } TEST_F(SpvLogicalTest, IsInf_Scalar) { @@ -892,7 +893,8 @@ TEST_F(SpvLogicalTest, IsInf_Scalar) { auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); - EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("let x_1 : bool = isInf(50.0);")); + EXPECT_THAT(test::ToString(p->program(), ast_body), + HasSubstr("let x_1 : bool = isInf(50.0f);")); } TEST_F(SpvLogicalTest, IsInf_Vector) { @@ -909,7 +911,7 @@ TEST_F(SpvLogicalTest, IsInf_Vector) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_1 : vec2 = isInf(vec2(50.0, 60.0));")); + HasSubstr("let x_1 : vec2 = isInf(vec2(50.0f, 60.0f));")); } // TODO(dneto): Kernel-guarded instructions. diff --git a/src/tint/reader/spirv/function_memory_test.cc b/src/tint/reader/spirv/function_memory_test.cc index 58ccedaa12..2bb98e390f 100644 --- a/src/tint/reader/spirv/function_memory_test.cc +++ b/src/tint/reader/spirv/function_memory_test.cc @@ -133,8 +133,9 @@ TEST_F(SpvParserMemoryTest, EmitStatement_StoreFloatConst) { auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()); auto ast_body = fe.ast_body(); - EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(x_1 = 42.0; -x_1 = 0.0; + EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(x_1 = 42.0f; +x_1 = 0.0f; +return; )")); } @@ -497,7 +498,7 @@ TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Matrix) { EXPECT_TRUE(fe.EmitBody()); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("myvar[2u] = vec4(42.0, 42.0, 42.0, 42.0);")); + HasSubstr("myvar[2u] = vec4(42.0f, 42.0f, 42.0f, 42.0f);")); } TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Array) { @@ -529,7 +530,7 @@ TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Array) { EXPECT_TRUE(fe.EmitBody()); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("myvar[2u] = vec4(42.0, 42.0, 42.0, 42.0);")); + HasSubstr("myvar[2u] = vec4(42.0f, 42.0f, 42.0f, 42.0f);")); } TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Struct) { @@ -559,7 +560,7 @@ TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Struct) { auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()); auto ast_body = fe.ast_body(); - EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("myvar.age = 42.0;")); + EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("myvar.age = 42.0f;")); } TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Struct_DifferOnlyMemberName) { @@ -601,8 +602,9 @@ TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Struct_DifferOnlyMemberNam auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()); auto ast_body = fe.ast_body(); - EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(myvar.age = 42.0; -myvar2.ancientness = 420.0; + EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(myvar.age = 42.0f; +myvar2.ancientness = 420.0f; +return; )")); } @@ -706,7 +708,7 @@ TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Struct_RuntimeArray) { auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()); auto ast_body = fe.ast_body(); - EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("myvar.age[2u] = 42.0;")); + EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("myvar.age[2u] = 42.0f;")); } TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Compound_Matrix_Vector) { @@ -737,7 +739,7 @@ TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_Compound_Matrix_Vector) { auto fe = p->function_emitter(100); EXPECT_TRUE(fe.EmitBody()); auto ast_body = fe.ast_body(); - EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("myvar[2u].w = 42.0;")); + EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("myvar[2u].w = 42.0f;")); } TEST_F(SpvParserMemoryTest, EmitStatement_AccessChain_InvalidPointeeType) { @@ -808,7 +810,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main() { main_1(); } @@ -848,7 +850,7 @@ OpExecutionMode %main OriginUpperLeft return; } -@stage(fragment) +@fragment fn main() { main_1(); } diff --git a/src/tint/reader/spirv/function_misc_test.cc b/src/tint/reader/spirv/function_misc_test.cc index 9d40ffc3a5..5054c670bd 100644 --- a/src/tint/reader/spirv/function_misc_test.cc +++ b/src/tint/reader/spirv/function_misc_test.cc @@ -75,7 +75,8 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_BeforeFunction_Scalar) { EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(let x_11 : bool = false; let x_12 : u32 = 0u; let x_13 : i32 = 0i; -let x_14 : f32 = 0.0; +let x_14 : f32 = 0.0f; +return; )")); } @@ -133,7 +134,8 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Scalar) { EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(let x_11 : bool = false; let x_12 : u32 = 0u; let x_13 : i32 = 0i; -let x_14 : f32 = 0.0; +let x_14 : f32 = 0.0f; +return; )")); } @@ -224,7 +226,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) { EXPECT_TRUE(fe.EmitBody()) << p->error(); auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("let x_11 : S = S(false, 0u, 0i, 0.0);")); + HasSubstr("let x_11 : S = S(false, 0u, 0i, 0.0f);")); } TEST_F(SpvParserTestMiscInstruction, OpNop) { @@ -288,51 +290,6 @@ INSTANTIATE_TEST_SUITE_P(ValidIndex, {4, "", "vector component index is larger than 3: 4"}, {99999, "", "vector component index is larger than 3: 99999"}})); -TEST_F(SpvParserTest, ValueFromBlockNotInBlockOrder) { - // crbug.com/tint/804 - const auto assembly = Preamble() + CommonTypes() + R"( - %float_42 = OpConstant %float 42.0 - %cond = OpUndef %bool - - %100 = OpFunction %void None %voidfn - %10 = OpLabel - OpBranch %30 - - ; unreachable - %20 = OpLabel - %499 = OpFAdd %float %float_42 %float_42 - %500 = OpFAdd %float %499 %float_42 - OpBranch %25 - - %25 = OpLabel - OpBranch %80 - - - %30 = OpLabel - OpLoopMerge %90 %80 None - OpBranchConditional %cond %90 %40 - - %40 = OpLabel - OpBranch %90 - - %80 = OpLabel ; unreachable continue target - ; but "dominated" by %20 and %25 - %81 = OpFMul %float %500 %float_42 ; %500 is defined in %20 - OpBranch %30 ; backedge - - %90 = OpLabel - OpReturn - OpFunctionEnd -)"; - auto p = parser(test::Assemble(assembly)); - ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - auto fe = p->function_emitter(100); - EXPECT_TRUE(fe.EmitBody()) << p->error(); - auto ast_body = fe.ast_body(); - const auto got = test::ToString(p->program(), ast_body); - EXPECT_THAT(got, HasSubstr("let x_81 : f32 = (0.0 * 42.0);")); -} - // TODO(dneto): OpSizeof : requires Kernel (OpenCL) } // namespace diff --git a/src/tint/reader/spirv/function_var_test.cc b/src/tint/reader/spirv/function_var_test.cc index c986af8571..ff282990df 100644 --- a/src/tint/reader/spirv/function_var_test.cc +++ b/src/tint/reader/spirv/function_var_test.cc @@ -184,7 +184,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_ScalarInitializers) { var b : bool = false; var c : i32 = -1i; var d : u32 = 1u; -var e : f32 = 1.5; +var e : f32 = 1.5f; )")); } @@ -212,7 +212,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_ScalarNullInitializers) { EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr(R"(var a : bool = false; var b : i32 = 0i; var c : u32 = 0u; -var d : f32 = 0.0; +var d : f32 = 0.0f; )")); } @@ -234,7 +234,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_VectorInitializer) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("var x_200 : vec2 = vec2(1.5, 2.0);")); + HasSubstr("var x_200 : vec2 = vec2(1.5f, 2.0f);")); } TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_MatrixInitializer) { @@ -261,9 +261,9 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_MatrixInitializer) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), HasSubstr("var x_200 : mat3x2 = mat3x2(" - "vec2(1.5, 2.0), " - "vec2(2.0, 3.0), " - "vec2(3.0, 4.0));")); + "vec2(1.5f, 2.0f), " + "vec2(2.0f, 3.0f), " + "vec2(3.0f, 4.0f));")); } TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_ArrayInitializer) { @@ -382,7 +382,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_StructInitializer) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("var x_200 : S = S(1u, 1.5, array(1u, 2u));")); + HasSubstr("var x_200 : S = S(1u, 1.5f, array(1u, 2u));")); } TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_StructInitializer_Null) { @@ -404,7 +404,7 @@ TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_StructInitializer_Null) { auto ast_body = fe.ast_body(); EXPECT_THAT(test::ToString(p->program(), ast_body), - HasSubstr("var x_200 : S = S(0u, 0.0, array());")); + HasSubstr("var x_200 : S = S(0u, 0.0f, array());")); } TEST_F(SpvParserFunctionVarTest, EmitFunctionVariables_Decorate_RelaxedPrecision) { @@ -1418,65 +1418,6 @@ return; EXPECT_EQ(expect, got); } -TEST_F(SpvParserFunctionVarTest, EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored) { - // From crbug.com/tint/804 - const auto assembly = Preamble() + R"( - %float_42 = OpConstant %float 42.0 - %cond = OpUndef %bool - - %100 = OpFunction %void None %voidfn - %10 = OpLabel - OpBranch %30 - - ; unreachable - %20 = OpLabel - %499 = OpFAdd %float %float_42 %float_42 - %500 = OpFAdd %float %499 %float_42 - OpBranch %25 - - %25 = OpLabel - OpBranch %80 - - - %30 = OpLabel - OpLoopMerge %90 %80 None - OpBranchConditional %cond %90 %40 - - %40 = OpLabel - OpBranch %90 - - %80 = OpLabel ; unreachable continue target - ; but "dominated" by %20 and %25 - %81 = OpPhi %float %500 %25 - OpBranch %30 ; backedge - - %90 = OpLabel - OpReturn - OpFunctionEnd -)"; - auto p = parser(test::Assemble(assembly)); - ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly; - auto fe = p->function_emitter(100); - EXPECT_TRUE(fe.EmitBody()) << p->error(); - - const auto* expected = R"(loop { - if (false) { - break; - } - break; - - continuing { - var x_81_phi_1 : f32; - let x_81 : f32 = x_81_phi_1; - } -} -return; -)"; - auto ast_body = fe.ast_body(); - const auto got = test::ToString(p->program(), ast_body); - EXPECT_EQ(got, expected); -} - TEST_F(SpvParserFunctionVarTest, EmitStatement_Hoist_CompositeInsert) { // From crbug.com/tint/804 const auto assembly = Preamble() + R"( diff --git a/src/tint/reader/spirv/parser.cc b/src/tint/reader/spirv/parser.cc index f430d94f72..ac43b9e54c 100644 --- a/src/tint/reader/spirv/parser.cc +++ b/src/tint/reader/spirv/parser.cc @@ -22,6 +22,7 @@ #include "src/tint/transform/manager.h" #include "src/tint/transform/remove_unreachable_statements.h" #include "src/tint/transform/simplify_pointers.h" +#include "src/tint/transform/spirv_atomic.h" #include "src/tint/transform/unshadow.h" namespace tint::reader::spirv { @@ -55,6 +56,7 @@ Program Parse(const std::vector& input) { manager.Add(); manager.Add(); manager.Add(); + manager.Add(); return manager.Run(&program).program; } diff --git a/src/tint/reader/spirv/parser_impl.cc b/src/tint/reader/spirv/parser_impl.cc index 28dc8569a5..f9117a5e49 100644 --- a/src/tint/reader/spirv/parser_impl.cc +++ b/src/tint/reader/spirv/parser_impl.cc @@ -447,10 +447,10 @@ std::string ParserImpl::ShowType(uint32_t type_id) { return "SPIR-V type " + std::to_string(type_id); } -ast::AttributeList ParserImpl::ConvertMemberDecoration(uint32_t struct_type_id, - uint32_t member_index, - const Type* member_ty, - const Decoration& decoration) { +ParserImpl::AttributeList ParserImpl::ConvertMemberDecoration(uint32_t struct_type_id, + uint32_t member_index, + const Type* member_ty, + const Decoration& decoration) { if (decoration.empty()) { Fail() << "malformed SPIR-V decoration: it's empty"; return {}; @@ -513,7 +513,8 @@ ast::AttributeList ParserImpl::ConvertMemberDecoration(uint32_t struct_type_id, return { create(Source{}, decoration[1]), builder_.ASTNodes().Create( - builder_.ID(), ast::DisabledValidation::kIgnoreStrideAttribute), + builder_.ID(), builder_.AllocateNodeID(), + ast::DisabledValidation::kIgnoreStrideAttribute), }; } default: @@ -816,7 +817,7 @@ bool ParserImpl::RegisterWorkgroupSizeBuiltin() { /// Returns false and emits a diagnostic on error. auto set_param = [this, composite_def](uint32_t* id_ptr, uint32_t* value_ptr, int index) -> bool { - const auto id = composite_def->GetSingleWordInOperand(index); + const auto id = composite_def->GetSingleWordInOperand(static_cast(index)); const auto* def = def_use_mgr_->GetDef(id); if (!def || (def->opcode() != SpvOpSpecConstant && def->opcode() != SpvOpConstant) || (def->NumInOperands() != 1)) { @@ -877,17 +878,17 @@ bool ParserImpl::RegisterEntryPoints() { TINT_ASSERT(Reader, !inner_implementation_name.empty()); TINT_ASSERT(Reader, ep_name != inner_implementation_name); - utils::UniqueVector inputs; - utils::UniqueVector outputs; + utils::UniqueVector inputs; + utils::UniqueVector outputs; for (unsigned iarg = 3; iarg < entry_point.NumInOperands(); iarg++) { const uint32_t var_id = entry_point.GetSingleWordInOperand(iarg); if (const auto* var_inst = def_use_mgr_->GetDef(var_id)) { switch (SpvStorageClass(var_inst->GetSingleWordInOperand(0))) { case SpvStorageClassInput: - inputs.add(var_id); + inputs.Add(var_id); break; case SpvStorageClassOutput: - outputs.add(var_id); + outputs.Add(var_id); break; default: break; @@ -895,9 +896,9 @@ bool ParserImpl::RegisterEntryPoints() { } } // Save the lists, in ID-sorted order. - std::vector sorted_inputs(inputs); + utils::Vector sorted_inputs(inputs); std::sort(sorted_inputs.begin(), sorted_inputs.end()); - std::vector sorted_outputs(outputs); + utils::Vector sorted_outputs(outputs); std::sort(sorted_outputs.begin(), sorted_outputs.end()); const auto ast_stage = enum_converter_.ToPipelineStage(stage); @@ -1066,7 +1067,7 @@ const Type* ParserImpl::ConvertType(uint32_t type_id, } // Compute members - ast::StructMemberList ast_members; + utils::Vector ast_members; const auto members = struct_ty->element_types(); if (members.empty()) { Fail() << "WGSL does not support empty structures. can't convert type: " @@ -1122,7 +1123,7 @@ const Type* ParserImpl::ConvertType(uint32_t type_id, } bool is_non_writable = false; - ast::AttributeList ast_member_decorations; + AttributeList ast_member_decorations; for (auto& decoration : GetDecorationsForMember(type_id, member_index)) { if (IsPipelineDecoration(decoration)) { // IO decorations are handled when emitting the entry point. @@ -1136,7 +1137,7 @@ const Type* ParserImpl::ConvertType(uint32_t type_id, auto decos = ConvertMemberDecoration(type_id, member_index, ast_member_ty, decoration); for (auto* deco : decos) { - ast_member_decorations.emplace_back(deco); + ast_member_decorations.Push(deco); } if (!success_) { return nullptr; @@ -1153,10 +1154,10 @@ const Type* ParserImpl::ConvertType(uint32_t type_id, auto* ast_struct_member = create( Source{}, builder_.Symbols().Register(member_name), ast_member_ty->Build(builder_), std::move(ast_member_decorations)); - ast_members.push_back(ast_struct_member); + ast_members.Push(ast_struct_member); } - if (ast_members.empty()) { + if (ast_members.IsEmpty()) { // All members were likely built-ins. Don't generate an empty AST structure. return nullptr; } @@ -1167,8 +1168,7 @@ const Type* ParserImpl::ConvertType(uint32_t type_id, // Now make the struct. auto sym = builder_.Symbols().Register(name); - auto* ast_struct = - create(Source{}, sym, std::move(ast_members), ast::AttributeList()); + auto* ast_struct = create(Source{}, sym, std::move(ast_members), utils::Empty); if (num_non_writable_members == members.size()) { read_only_struct_types_.insert(ast_struct->name); } @@ -1218,8 +1218,8 @@ const Type* ParserImpl::ConvertType(uint32_t type_id, } // Pipeline input and output variables map to private variables. - if (ast_storage_class == ast::StorageClass::kInput || - ast_storage_class == ast::StorageClass::kOutput) { + if (ast_storage_class == ast::StorageClass::kIn || + ast_storage_class == ast::StorageClass::kOut) { ast_storage_class = ast::StorageClass::kPrivate; } switch (ptr_as) { @@ -1336,14 +1336,16 @@ bool ParserImpl::EmitScalarSpecConstants() { }, [&](const U32*) { return create( - Source{}, static_cast(literal_value), + Source{}, static_cast(literal_value), ast::IntLiteralExpression::Suffix::kU); }, [&](const F32*) { float float_value; // Copy the bits so we can read them as a float. std::memcpy(&float_value, &literal_value, sizeof(float_value)); - return create(Source{}, float_value); + return create( + Source{}, static_cast(float_value), + ast::FloatLiteralExpression::Suffix::kF); }); if (ast_expr == nullptr) { return Fail() << " invalid result type for OpSpecConstant " @@ -1355,7 +1357,7 @@ bool ParserImpl::EmitScalarSpecConstants() { break; } if (ast_type && ast_expr) { - ast::AttributeList spec_id_decos; + AttributeList spec_id_decos; for (const auto& deco : GetDecorationsFor(inst.result_id())) { if ((deco.size() == 2) && (deco[0] == SpvDecorationSpecId)) { const uint32_t id = deco[1]; @@ -1365,12 +1367,12 @@ bool ParserImpl::EmitScalarSpecConstants() { << inst.result_id() << " has SpecId " << id; } auto* cid = create(Source{}, id); - spec_id_decos.push_back(cid); + spec_id_decos.Push(cid); break; } } - auto* ast_var = MakeVariable(inst.result_id(), ast::StorageClass::kNone, ast_type, true, - true, ast_expr, std::move(spec_id_decos)); + auto* ast_var = + MakeOverride(inst.result_id(), ast_type, ast_expr, std::move(spec_id_decos)); if (ast_var) { builder_.AST().AddGlobalVariable(ast_var); scalar_spec_constants_.insert(inst.result_id()); @@ -1443,8 +1445,8 @@ bool ParserImpl::EmitModuleScopeVariables() { } switch (enum_converter_.ToStorageClass(spirv_storage_class)) { case ast::StorageClass::kNone: - case ast::StorageClass::kInput: - case ast::StorageClass::kOutput: + case ast::StorageClass::kIn: + case ast::StorageClass::kOut: case ast::StorageClass::kUniform: case ast::StorageClass::kHandle: case ast::StorageClass::kStorage: @@ -1487,8 +1489,8 @@ bool ParserImpl::EmitModuleScopeVariables() { // here.) ast_constructor = MakeConstantExpression(var.GetSingleWordInOperand(1)).expr; } - auto* ast_var = MakeVariable(var.result_id(), ast_storage_class, ast_store_type, false, - false, ast_constructor, ast::AttributeList{}); + auto* ast_var = MakeVar(var.result_id(), ast_storage_class, ast_store_type, ast_constructor, + utils::Empty); // TODO(dneto): initializers (a.k.a. constructor expression) if (ast_var) { builder_.AST().AddGlobalVariable(ast_var); @@ -1519,10 +1521,9 @@ bool ParserImpl::EmitModuleScopeVariables() { } } auto* ast_var = - MakeVariable(builtin_position_.per_vertex_var_id, - enum_converter_.ToStorageClass(builtin_position_.storage_class), - ConvertType(builtin_position_.position_member_type_id), false, false, - ast_constructor, {}); + MakeVar(builtin_position_.per_vertex_var_id, + enum_converter_.ToStorageClass(builtin_position_.storage_class), + ConvertType(builtin_position_.position_member_type_id), ast_constructor, {}); builder_.AST().AddGlobalVariable(ast_var); } @@ -1552,13 +1553,11 @@ const spvtools::opt::analysis::IntConstant* ParserImpl::GetArraySize(uint32_t va return size->AsIntConstant(); } -ast::Variable* ParserImpl::MakeVariable(uint32_t id, - ast::StorageClass sc, - const Type* storage_type, - bool is_const, - bool is_overridable, - const ast::Expression* constructor, - ast::AttributeList decorations) { +ast::Var* ParserImpl::MakeVar(uint32_t id, + ast::StorageClass sc, + const Type* storage_type, + const ast::Expression* constructor, + AttributeList decorations) { if (storage_type == nullptr) { Fail() << "internal error: can't make ast::Variable for null type"; return nullptr; @@ -1586,20 +1585,41 @@ ast::Variable* ParserImpl::MakeVariable(uint32_t id, return nullptr; } - std::string name = namer_.Name(id); + auto sym = builder_.Symbols().Register(namer_.Name(id)); + return create(Source{}, sym, storage_type->Build(builder_), sc, access, constructor, + decorations); +} - // Note: we're constructing the variable here with the *storage* type, - // regardless of whether this is a `let`, `override`, or `var` declaration. - // `var` declarations will have a resolved type of ref, but at the - // AST level all three are declared with the same type. - return create(Source{}, builder_.Symbols().Register(name), sc, access, - storage_type->Build(builder_), is_const, is_overridable, - constructor, decorations); +ast::Let* ParserImpl::MakeLet(uint32_t id, const Type* type, const ast::Expression* constructor) { + auto sym = builder_.Symbols().Register(namer_.Name(id)); + return create(Source{}, sym, type->Build(builder_), constructor, utils::Empty); +} + +ast::Override* ParserImpl::MakeOverride(uint32_t id, + const Type* type, + const ast::Expression* constructor, + AttributeList decorations) { + if (!ConvertDecorationsForVariable(id, &type, &decorations, false)) { + return nullptr; + } + auto sym = builder_.Symbols().Register(namer_.Name(id)); + return create(Source{}, sym, type->Build(builder_), constructor, decorations); +} + +ast::Parameter* ParserImpl::MakeParameter(uint32_t id, + const Type* type, + AttributeList decorations) { + if (!ConvertDecorationsForVariable(id, &type, &decorations, false)) { + return nullptr; + } + + auto sym = builder_.Symbols().Register(namer_.Name(id)); + return create(Source{}, sym, type->Build(builder_), decorations); } bool ParserImpl::ConvertDecorationsForVariable(uint32_t id, const Type** store_type, - ast::AttributeList* decorations, + AttributeList* decorations, bool transfer_pipeline_io) { DecorationList non_builtin_pipeline_decorations; for (auto& deco : GetDecorationsFor(id)) { @@ -1654,12 +1674,12 @@ bool ParserImpl::ConvertDecorationsForVariable(uint32_t id, break; } auto ast_builtin = enum_converter_.ToBuiltin(spv_builtin); - if (ast_builtin == ast::Builtin::kNone) { + if (ast_builtin == ast::BuiltinValue::kInvalid) { // A diagnostic has already been emitted. return false; } if (transfer_pipeline_io) { - decorations->emplace_back(create(Source{}, ast_builtin)); + decorations->Push(create(Source{}, ast_builtin)); } } if (transfer_pipeline_io && IsPipelineDecoration(deco)) { @@ -1670,13 +1690,13 @@ bool ParserImpl::ConvertDecorationsForVariable(uint32_t id, return Fail() << "malformed DescriptorSet decoration on ID " << id << ": has no operand"; } - decorations->emplace_back(create(Source{}, deco[1])); + decorations->Push(create(Source{}, deco[1])); } if (deco[0] == SpvDecorationBinding) { if (deco.size() == 1) { return Fail() << "malformed Binding decoration on ID " << id << ": has no operand"; } - decorations->emplace_back(create(Source{}, deco[1])); + decorations->Push(create(Source{}, deco[1])); } } @@ -1694,8 +1714,8 @@ DecorationList ParserImpl::GetMemberPipelineDecorations(const Struct& struct_typ int member_index) { // Yes, I could have used std::copy_if or std::copy_if. DecorationList result; - for (const auto& deco : - GetDecorationsForMember(struct_id_for_symbol_[struct_type.name], member_index)) { + for (const auto& deco : GetDecorationsForMember(struct_id_for_symbol_[struct_type.name], + static_cast(member_index))) { if (IsPipelineDecoration(deco)) { result.emplace_back(deco); } @@ -1703,7 +1723,7 @@ DecorationList ParserImpl::GetMemberPipelineDecorations(const Struct& struct_typ return result; } -const ast::Attribute* ParserImpl::SetLocation(ast::AttributeList* attributes, +const ast::Attribute* ParserImpl::SetLocation(AttributeList* attributes, const ast::Attribute* replacement) { if (!replacement) { return nullptr; @@ -1720,13 +1740,13 @@ const ast::Attribute* ParserImpl::SetLocation(ast::AttributeList* attributes, } } // The list didn't have a location. Add it. - attributes->push_back(replacement); + attributes->Push(replacement); return nullptr; } bool ParserImpl::ConvertPipelineDecorations(const Type* store_type, const DecorationList& decorations, - ast::AttributeList* attributes) { + AttributeList* attributes) { // Vulkan defaults to perspective-correct interpolation. ast::InterpolationType type = ast::InterpolationType::kPerspective; ast::InterpolationSampling sampling = ast::InterpolationSampling::kNone; @@ -1774,12 +1794,20 @@ bool ParserImpl::ConvertPipelineDecorations(const Type* store_type, } } + if (type == ast::InterpolationType::kFlat && + !ast::HasAttribute(*attributes)) { + // WGSL requires that '@interpolate(flat)' needs to be paired with '@location', however + // SPIR-V requires all fragment shader integer Inputs are 'flat'. If the decorations do not + // contain a SpvDecorationLocation, then make this perspective. + type = ast::InterpolationType::kPerspective; + } + // Apply interpolation. if (type == ast::InterpolationType::kPerspective && sampling == ast::InterpolationSampling::kNone) { // This is the default. Don't add a decoration. } else { - attributes->emplace_back(create(type, sampling)); + attributes->Push(create(type, sampling)); } return success(); @@ -1812,7 +1840,7 @@ TypedExpression ParserImpl::MakeConstantExpression(uint32_t id) { auto z = MakeConstantExpression(workgroup_size_builtin_.z_id); auto* ast_type = ty_.Vector(x.type, 3); return {ast_type, builder_.Construct(Source{}, ast_type->Build(builder_), - ast::ExpressionList{x.expr, y.expr, z.expr})}; + utils::Vector{x.expr, y.expr, z.expr})}; } else if (id == workgroup_size_builtin_.x_id) { return MakeConstantExpressionForScalarSpirvConstant( Source{}, ConvertType(workgroup_size_builtin_.component_type_id), @@ -1868,14 +1896,14 @@ TypedExpression ParserImpl::MakeConstantExpression(uint32_t id) { // Handle vector, matrix, array, and struct // Generate a composite from explicit components. - ast::ExpressionList ast_components; + ExpressionList ast_components; if (!inst->WhileEachInId([&](const uint32_t* id_ref) -> bool { auto component = MakeConstantExpression(*id_ref); if (!component) { this->Fail() << "invalid constant with ID " << *id_ref; return false; } - ast_components.emplace_back(component.expr); + ast_components.Push(component.expr); return true; })) { // We've already emitted a diagnostic. @@ -1905,18 +1933,22 @@ TypedExpression ParserImpl::MakeConstantExpressionForScalarSpirvConstant( return Switch( ast_type, [&](const I32*) { - return TypedExpression{ty_.I32(), create( - source, spirv_const->GetS32(), - ast::IntLiteralExpression::Suffix::kI)}; + return TypedExpression{ty_.I32(), + create( + source, static_cast(spirv_const->GetS32()), + ast::IntLiteralExpression::Suffix::kI)}; }, [&](const U32*) { - return TypedExpression{ty_.U32(), create( - source, spirv_const->GetU32(), - ast::IntLiteralExpression::Suffix::kU)}; + return TypedExpression{ty_.U32(), + create( + source, static_cast(spirv_const->GetU32()), + ast::IntLiteralExpression::Suffix::kU)}; }, [&](const F32*) { - return TypedExpression{ - ty_.F32(), create(source, spirv_const->GetFloat())}; + return TypedExpression{ty_.F32(), + create( + source, static_cast(spirv_const->GetFloat()), + ast::FloatLiteralExpression::Suffix::kF)}; }, [&](const Bool*) { const bool value = @@ -1953,15 +1985,18 @@ const ast::Expression* ParserImpl::MakeNullValue(const Type* type) { return create(Source{}, 0, ast::IntLiteralExpression::Suffix::kU); }, - [&](const F32*) { return create(Source{}, 0.0f); }, + [&](const F32*) { + return create(Source{}, 0, + ast::FloatLiteralExpression::Suffix::kF); + }, [&](const Vector*) { return builder_.Construct(Source{}, type->Build(builder_)); }, [&](const Matrix*) { return builder_.Construct(Source{}, type->Build(builder_)); }, [&](const Array*) { return builder_.Construct(Source{}, type->Build(builder_)); }, [&](const Bool*) { return create(Source{}, false); }, [&](const Struct* struct_ty) { - ast::ExpressionList ast_components; + ExpressionList ast_components; for (auto* member : struct_ty->members) { - ast_components.emplace_back(MakeNullValue(member)); + ast_components.Push(MakeNullValue(member)); } return builder_.Construct(Source{}, original_type->Build(builder_), std::move(ast_components)); @@ -2439,7 +2474,7 @@ const Pointer* ParserImpl::GetTypeForHandleVar(const spvtools::opt::Instruction& } else { const auto access = ast::Access::kWrite; const auto format = enum_converter_.ToTexelFormat(image_type->format()); - if (format == ast::TexelFormat::kNone) { + if (format == ast::TexelFormat::kInvalid) { return nullptr; } ast_store_type = ty_.StorageTexture(dim, format, access); @@ -2693,7 +2728,7 @@ std::string ParserImpl::GetMemberName(const Struct& struct_type, int member_inde Fail() << "no structure type registered for symbol"; return ""; } - return namer_.GetMemberName(where->second, member_index); + return namer_.GetMemberName(where->second, static_cast(member_index)); } WorkgroupSizeInfo::WorkgroupSizeInfo() = default; diff --git a/src/tint/reader/spirv/parser_impl.h b/src/tint/reader/spirv/parser_impl.h index b91f1924a5..12d62266a8 100644 --- a/src/tint/reader/spirv/parser_impl.h +++ b/src/tint/reader/spirv/parser_impl.h @@ -22,8 +22,18 @@ #include #include +#include "src/tint/utils/compiler_macros.h" + #if TINT_BUILD_SPV_READER +TINT_BEGIN_DISABLE_WARNING(NEWLINE_EOF); +TINT_BEGIN_DISABLE_WARNING(OLD_STYLE_CAST); +TINT_BEGIN_DISABLE_WARNING(SIGN_CONVERSION); +TINT_BEGIN_DISABLE_WARNING(WEAK_VTABLES); #include "source/opt/ir_context.h" +TINT_END_DISABLE_WARNING(WEAK_VTABLES); +TINT_END_DISABLE_WARNING(SIGN_CONVERSION); +TINT_END_DISABLE_WARNING(OLD_STYLE_CAST); +TINT_END_DISABLE_WARNING(NEWLINE_EOF); #endif #include "src/tint/program_builder.h" @@ -113,6 +123,9 @@ struct WorkgroupSizeInfo { /// Parser implementation for SPIR-V. class ParserImpl : Reader { + using AttributeList = utils::Vector; + using ExpressionList = utils::Vector; + public: /// Creates a new parser /// @param input the input data to parse @@ -242,15 +255,14 @@ class ParserImpl : Reader { /// a diagnostic), or when the variable should not be emitted, e.g. for a /// PointSize builtin. /// @param id the ID of the SPIR-V variable - /// @param store_type the WGSL store type for the variable, which should be - /// prepopulatd + /// @param store_type the WGSL store type for the variable, which should be prepopulated /// @param attributes the attribute list to populate /// @param transfer_pipeline_io true if pipeline IO decorations (builtins, /// or locations) will update the store type and the decorations list /// @returns false when the variable should not be emitted as a variable bool ConvertDecorationsForVariable(uint32_t id, const Type** store_type, - ast::AttributeList* attributes, + AttributeList* attributes, bool transfer_pipeline_io); /// Converts SPIR-V decorations for pipeline IO into AST decorations. @@ -260,7 +272,7 @@ class ParserImpl : Reader { /// @returns false if conversion fails bool ConvertPipelineDecorations(const Type* store_type, const DecorationList& decorations, - ast::AttributeList* attributes); + AttributeList* attributes); /// Updates the attribute list, placing a non-null location decoration into /// the list, replacing an existing one if it exists. Does nothing if the @@ -270,7 +282,7 @@ class ParserImpl : Reader { /// @param replacement the location decoration to place into the list /// @returns the location decoration that was replaced, if one was replaced, /// or null otherwise. - const ast::Attribute* SetLocation(ast::AttributeList* decos, const ast::Attribute* replacement); + const ast::Attribute* SetLocation(AttributeList* decos, const ast::Attribute* replacement); /// Converts a SPIR-V struct member decoration into a number of AST /// decorations. If the decoration is recognized but deliberately dropped, @@ -281,10 +293,10 @@ class ParserImpl : Reader { /// @param member_ty the type of the member /// @param decoration an encoded SPIR-V Decoration /// @returns the AST decorations - ast::AttributeList ConvertMemberDecoration(uint32_t struct_type_id, - uint32_t member_index, - const Type* member_ty, - const Decoration& decoration); + AttributeList ConvertMemberDecoration(uint32_t struct_type_id, + uint32_t member_index, + const Type* member_ty, + const Decoration& decoration); /// Returns a string for the given type. If the type ID is invalid, /// then the resulting string only names the type ID. @@ -411,24 +423,46 @@ class ParserImpl : Reader { /// @returns a list of SPIR-V decorations. DecorationList GetMemberPipelineDecorations(const Struct& struct_type, int member_index); - /// Creates an AST Variable node for a SPIR-V ID, including any attached - /// decorations, unless it's an ignorable builtin variable. + /// Creates an AST 'var' node for a SPIR-V ID, including any attached decorations, unless it's + /// an ignorable builtin variable. /// @param id the SPIR-V result ID /// @param sc the storage class, which cannot be ast::StorageClass::kNone /// @param storage_type the storage type of the variable - /// @param is_const if true, the variable is const - /// @param is_overridable if true, the variable is pipeline-overridable /// @param constructor the variable constructor /// @param decorations the variable decorations /// @returns a new Variable node, or null in the ignorable variable case and /// in the error case - ast::Variable* MakeVariable(uint32_t id, - ast::StorageClass sc, - const Type* storage_type, - bool is_const, - bool is_overridable, + ast::Var* MakeVar(uint32_t id, + ast::StorageClass sc, + const Type* storage_type, + const ast::Expression* constructor, + AttributeList decorations); + + /// Creates an AST 'let' node for a SPIR-V ID, including any attached decorations,. + /// @param id the SPIR-V result ID + /// @param type the type of the variable + /// @param constructor the variable constructor + /// @returns the AST 'let' node + ast::Let* MakeLet(uint32_t id, const Type* type, const ast::Expression* constructor); + + /// Creates an AST 'override' node for a SPIR-V ID, including any attached decorations. + /// @param id the SPIR-V result ID + /// @param type the type of the variable + /// @param constructor the variable constructor + /// @param decorations the variable decorations + /// @returns the AST 'override' node + ast::Override* MakeOverride(uint32_t id, + const Type* type, const ast::Expression* constructor, - ast::AttributeList decorations); + AttributeList decorations); + + /// Creates an AST parameter node for a SPIR-V ID, including any attached decorations, unless + /// it's an ignorable builtin variable. + /// @param id the SPIR-V result ID + /// @param type the type of the parameter + /// @param decorations the parameter decorations + /// @returns the AST parameter node + ast::Parameter* MakeParameter(uint32_t id, const Type* type, AttributeList decorations); /// Returns true if a constant expression can be generated. /// @param id the SPIR-V ID of the value diff --git a/src/tint/reader/spirv/parser_impl_barrier_test.cc b/src/tint/reader/spirv/parser_impl_barrier_test.cc index 0549bd1898..a59409844b 100644 --- a/src/tint/reader/spirv/parser_impl_barrier_test.cc +++ b/src/tint/reader/spirv/parser_impl_barrier_test.cc @@ -65,11 +65,11 @@ TEST_F(SpvParserTest, WorkgroupBarrier) { ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); auto* helper = program.AST().Functions().Find(program.Symbols().Get("helper")); ASSERT_NE(helper, nullptr); - ASSERT_GT(helper->body->statements.size(), 0u); + ASSERT_GT(helper->body->statements.Length(), 0u); auto* call = helper->body->statements[0]->As(); ASSERT_NE(call, nullptr); - EXPECT_EQ(call->expr->args.size(), 0u); - auto* sem_call = program.Sem().Get(call->expr); + EXPECT_EQ(call->expr->args.Length(), 0u); + auto* sem_call = program.Sem().Get(call->expr); ASSERT_NE(sem_call, nullptr); auto* builtin = sem_call->Target()->As(); ASSERT_NE(builtin, nullptr); @@ -98,11 +98,11 @@ TEST_F(SpvParserTest, StorageBarrier) { ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); auto* helper = program.AST().Functions().Find(program.Symbols().Get("helper")); ASSERT_NE(helper, nullptr); - ASSERT_GT(helper->body->statements.size(), 0u); + ASSERT_GT(helper->body->statements.Length(), 0u); auto* call = helper->body->statements[0]->As(); ASSERT_NE(call, nullptr); - EXPECT_EQ(call->expr->args.size(), 0u); - auto* sem_call = program.Sem().Get(call->expr); + EXPECT_EQ(call->expr->args.Length(), 0u); + auto* sem_call = program.Sem().Get(call->expr); ASSERT_NE(sem_call, nullptr); auto* builtin = sem_call->Target()->As(); ASSERT_NE(builtin, nullptr); diff --git a/src/tint/reader/spirv/parser_impl_convert_member_decoration_test.cc b/src/tint/reader/spirv/parser_impl_convert_member_decoration_test.cc index 3147ac12bd..cd3e7b5002 100644 --- a/src/tint/reader/spirv/parser_impl_convert_member_decoration_test.cc +++ b/src/tint/reader/spirv/parser_impl_convert_member_decoration_test.cc @@ -20,11 +20,11 @@ namespace { using ::testing::Eq; -TEST_F(SpvParserTest, ConvertMemberDecoration_Empty) { +TEST_F(SpvParserTest, ConvertMemberDecoration_IsEmpty) { auto p = parser(std::vector{}); auto result = p->ConvertMemberDecoration(1, 1, nullptr, {}); - EXPECT_TRUE(result.empty()); + EXPECT_TRUE(result.IsEmpty()); EXPECT_THAT(p->error(), Eq("malformed SPIR-V decoration: it's empty")); } @@ -32,7 +32,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_OffsetWithoutOperand) { auto p = parser(std::vector{}); auto result = p->ConvertMemberDecoration(12, 13, nullptr, {SpvDecorationOffset}); - EXPECT_TRUE(result.empty()); + EXPECT_TRUE(result.IsEmpty()); EXPECT_THAT(p->error(), Eq("malformed Offset decoration: expected 1 literal " "operand, has 0: member 13 of SPIR-V type 12")); } @@ -41,7 +41,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_OffsetWithTooManyOperands) { auto p = parser(std::vector{}); auto result = p->ConvertMemberDecoration(12, 13, nullptr, {SpvDecorationOffset, 3, 4}); - EXPECT_TRUE(result.empty()); + EXPECT_TRUE(result.IsEmpty()); EXPECT_THAT(p->error(), Eq("malformed Offset decoration: expected 1 literal " "operand, has 2: member 13 of SPIR-V type 12")); } @@ -50,7 +50,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_Offset) { auto p = parser(std::vector{}); auto result = p->ConvertMemberDecoration(1, 1, nullptr, {SpvDecorationOffset, 8}); - ASSERT_FALSE(result.empty()); + ASSERT_FALSE(result.IsEmpty()); EXPECT_TRUE(result[0]->Is()); auto* offset_deco = result[0]->As(); ASSERT_NE(offset_deco, nullptr); @@ -64,7 +64,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_Matrix2x2_Stride_Natural) { spirv::F32 f32; spirv::Matrix matrix(&f32, 2, 2); auto result = p->ConvertMemberDecoration(1, 1, &matrix, {SpvDecorationMatrixStride, 8}); - EXPECT_TRUE(result.empty()); + EXPECT_TRUE(result.IsEmpty()); EXPECT_TRUE(p->error().empty()); } @@ -74,7 +74,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_Matrix2x2_Stride_Custom) { spirv::F32 f32; spirv::Matrix matrix(&f32, 2, 2); auto result = p->ConvertMemberDecoration(1, 1, &matrix, {SpvDecorationMatrixStride, 16}); - ASSERT_FALSE(result.empty()); + ASSERT_FALSE(result.IsEmpty()); EXPECT_TRUE(result[0]->Is()); auto* stride_deco = result[0]->As(); ASSERT_NE(stride_deco, nullptr); @@ -88,7 +88,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_Matrix2x4_Stride_Natural) { spirv::F32 f32; spirv::Matrix matrix(&f32, 2, 4); auto result = p->ConvertMemberDecoration(1, 1, &matrix, {SpvDecorationMatrixStride, 16}); - EXPECT_TRUE(result.empty()); + EXPECT_TRUE(result.IsEmpty()); EXPECT_TRUE(p->error().empty()); } @@ -98,7 +98,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_Matrix2x4_Stride_Custom) { spirv::F32 f32; spirv::Matrix matrix(&f32, 2, 4); auto result = p->ConvertMemberDecoration(1, 1, &matrix, {SpvDecorationMatrixStride, 64}); - ASSERT_FALSE(result.empty()); + ASSERT_FALSE(result.IsEmpty()); EXPECT_TRUE(result[0]->Is()); auto* stride_deco = result[0]->As(); ASSERT_NE(stride_deco, nullptr); @@ -112,7 +112,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_Matrix2x3_Stride_Custom) { spirv::F32 f32; spirv::Matrix matrix(&f32, 2, 3); auto result = p->ConvertMemberDecoration(1, 1, &matrix, {SpvDecorationMatrixStride, 32}); - ASSERT_FALSE(result.empty()); + ASSERT_FALSE(result.IsEmpty()); EXPECT_TRUE(result[0]->Is()); auto* stride_deco = result[0]->As(); ASSERT_NE(stride_deco, nullptr); @@ -127,7 +127,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_RelaxedPrecision) { auto p = parser(std::vector{}); auto result = p->ConvertMemberDecoration(1, 1, nullptr, {SpvDecorationRelaxedPrecision}); - EXPECT_TRUE(result.empty()); + EXPECT_TRUE(result.IsEmpty()); EXPECT_TRUE(p->error().empty()); } @@ -135,7 +135,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_UnhandledDecoration) { auto p = parser(std::vector{}); auto result = p->ConvertMemberDecoration(12, 13, nullptr, {12345678}); - EXPECT_TRUE(result.empty()); + EXPECT_TRUE(result.IsEmpty()); EXPECT_THAT(p->error(), Eq("unhandled member decoration: 12345678 on member " "13 of SPIR-V type 12")); } diff --git a/src/tint/reader/spirv/parser_impl_function_decl_test.cc b/src/tint/reader/spirv/parser_impl_function_decl_test.cc index c821c8595e..459460d6f0 100644 --- a/src/tint/reader/spirv/parser_impl_function_decl_test.cc +++ b/src/tint/reader/spirv/parser_impl_function_decl_test.cc @@ -126,7 +126,7 @@ struct main_out { )")) << program_ast; EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(vertex) +@vertex fn main() -> main_out { )")); } @@ -144,7 +144,7 @@ TEST_F(SpvParserTest, EmitFunctions_Function_EntryPoint_Fragment) { Program program = p->program(); const auto program_ast = test::ToString(program); EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(fragment) +@fragment fn main() { )")); } @@ -162,7 +162,7 @@ TEST_F(SpvParserTest, EmitFunctions_Function_EntryPoint_GLCompute) { Program program = p->program(); const auto program_ast = test::ToString(program); EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { )")); } @@ -182,11 +182,11 @@ OpExecutionMode %main OriginUpperLeft Program program = p->program(); const auto program_ast = test::ToString(program); EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(fragment) +@fragment fn first_shader() { )")); EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(fragment) +@fragment fn second_shader() { )")); } @@ -208,7 +208,7 @@ OpFunctionEnd)"; Program program = p->program(); const auto program_ast = test::ToString(program); EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(compute) @workgroup_size(2i, 4i, 8i) +@compute @workgroup_size(2i, 4i, 8i) fn comp_main() { )")) << program_ast; } @@ -233,7 +233,7 @@ OpFunctionEnd)"; Program program = p->program(); const auto program_ast = test::ToString(program); EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(compute) @workgroup_size(3i, 5i, 7i) +@compute @workgroup_size(3i, 5i, 7i) fn comp_main() { )")) << program_ast; } @@ -262,7 +262,7 @@ OpFunctionEnd)"; Program program = p->program(); const auto program_ast = test::ToString(program); EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(compute) @workgroup_size(3i, 5i, 7i) +@compute @workgroup_size(3i, 5i, 7i) fn comp_main() { )")) << program_ast; } @@ -290,7 +290,7 @@ OpFunctionEnd)"; Program program = p->program(); const auto program_ast = test::ToString(program); EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(compute) @workgroup_size(3i, 5i, 7i) +@compute @workgroup_size(3i, 5i, 7i) fn comp_main() { )")) << program_ast; } @@ -323,7 +323,7 @@ OpFunctionEnd)"; Program program = p->program(); const auto program_ast = test::ToString(program); EXPECT_THAT(program_ast, HasSubstr(R"( -@stage(compute) @workgroup_size(3i, 5i, 7i) +@compute @workgroup_size(3i, 5i, 7i) fn comp_main() { )")) << program_ast; } @@ -402,7 +402,16 @@ TEST_F(SpvParserTest, EmitFunctions_NonVoidResultType) { Program program = p->program(); const auto program_ast = test::ToString(program); EXPECT_THAT(program_ast, HasSubstr(R"(fn ret_float() -> f32 { - return 0.0; + return 0.0f; +} + +fn x_100_1() { + return; +} + +@fragment +fn x_100() { + x_100_1(); } )")) << program_ast; } diff --git a/src/tint/reader/spirv/parser_impl_handle_test.cc b/src/tint/reader/spirv/parser_impl_handle_test.cc index 0af3cc518a..e1b4889c4c 100644 --- a/src/tint/reader/spirv/parser_impl_handle_test.cc +++ b/src/tint/reader/spirv/parser_impl_handle_test.cc @@ -1648,7 +1648,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_2d;)", - "textureGatherCompare(x_20, x_10, coords12, 0.200000003)"}, + "textureGatherCompare(x_20, x_10, coords12, 0.200000003f)"}, // OpImageDrefGather 2DDepth ConstOffset signed ImageAccessCase{"%float 2D 1 0 0 1 Unknown", "%result = OpImageDrefGather " @@ -1656,7 +1656,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_2d;)", - "textureGatherCompare(x_20, x_10, coords12, 0.200000003, " + "textureGatherCompare(x_20, x_10, coords12, 0.200000003f, " "vec2(3i, 4i))"}, // OpImageDrefGather 2DDepth ConstOffset unsigned ImageAccessCase{"%float 2D 1 0 0 1 Unknown", @@ -1666,7 +1666,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_2d;)", - "textureGatherCompare(x_20, x_10, coords12, 0.200000003, " + "textureGatherCompare(x_20, x_10, coords12, 0.200000003f, " "vec2(vec2(3u, 4u)))"}, // OpImageDrefGather 2DDepth Array ImageAccessCase{"%float 2D 1 1 0 1 Unknown", @@ -1676,7 +1676,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d_array;)", "textureGatherCompare(x_20, x_10, coords123.xy, " - "i32(round(coords123.z)), 0.200000003)"}, + "i32(round(coords123.z)), 0.200000003f)"}, // OpImageDrefGather 2DDepth Array ConstOffset signed ImageAccessCase{"%float 2D 1 1 0 1 Unknown", "%result = OpImageDrefGather " @@ -1685,7 +1685,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d_array;)", "textureGatherCompare(x_20, x_10, coords123.xy, " - "i32(round(coords123.z)), 0.200000003, vec2(3i, 4i))"}, + "i32(round(coords123.z)), 0.200000003f, vec2(3i, 4i))"}, // OpImageDrefGather 2DDepth Array ConstOffset unsigned ImageAccessCase{"%float 2D 1 1 0 1 Unknown", "%result = OpImageDrefGather " @@ -1695,7 +1695,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d_array;)", "textureGatherCompare(x_20, x_10, coords123.xy, " - "i32(round(coords123.z)), 0.200000003, " + "i32(round(coords123.z)), 0.200000003f, " "vec2(vec2(3u, 4u)))"}, // OpImageDrefGather DepthCube ImageAccessCase{"%float Cube 1 0 0 1 Unknown", @@ -1704,7 +1704,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_cube;)", - "textureGatherCompare(x_20, x_10, coords123, 0.200000003)"}, + "textureGatherCompare(x_20, x_10, coords123, 0.200000003f)"}, // OpImageDrefGather DepthCube Array ImageAccessCase{"%float Cube 1 1 0 1 Unknown", "%result = OpImageDrefGather " @@ -1713,7 +1713,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_cube_array;)", "textureGatherCompare(x_20, x_10, coords1234.xyz, " - "i32(round(coords1234.w)), 0.200000003)"}})); + "i32(round(coords1234.w)), 0.200000003f)"}})); INSTANTIATE_TEST_SUITE_P( ImageSampleImplicitLod, @@ -1764,7 +1764,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d;)", - "textureSampleBias(x_20, x_10, coords12, 7.0)"}, + "textureSampleBias(x_20, x_10, coords12, 7.0f)"}, // OpImageSampleImplicitLod arrayed with Bias ImageAccessCase{ @@ -1774,7 +1774,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d_array;)", - R"(textureSampleBias(x_20, x_10, coords123.xy, i32(round(coords123.z)), 7.0))"}, + R"(textureSampleBias(x_20, x_10, coords123.xy, i32(round(coords123.z)), 7.0f))"}, // OpImageSampleImplicitLod with Bias and signed ConstOffset ImageAccessCase{"%float 2D 0 0 0 1 Unknown", @@ -1784,7 +1784,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d;)", - R"(textureSampleBias(x_20, x_10, coords12, 7.0, vec2(3i, 4i))"}, + R"(textureSampleBias(x_20, x_10, coords12, 7.0f, vec2(3i, 4i))"}, // OpImageSampleImplicitLod with Bias and unsigned ConstOffset // Convert ConstOffset to signed @@ -1796,7 +1796,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d;)", - R"(textureSampleBias(x_20, x_10, coords12, 7.0, vec2(vec2(3u, 4u)))"}, + R"(textureSampleBias(x_20, x_10, coords12, 7.0f, vec2(vec2(3u, 4u)))"}, // OpImageSampleImplicitLod arrayed with Bias ImageAccessCase{ "%float 2D 0 1 0 1 Unknown", @@ -1806,7 +1806,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d_array;)", - R"(textureSampleBias(x_20, x_10, coords123.xy, i32(round(coords123.z)), 7.0, vec2(3i, 4i))"})); + R"(textureSampleBias(x_20, x_10, coords123.xy, i32(round(coords123.z)), 7.0f, vec2(3i, 4i))"})); INSTANTIATE_TEST_SUITE_P( // This test shows the use of a sampled image used with both regular @@ -1831,8 +1831,8 @@ INSTANTIATE_TEST_SUITE_P( @group(0) @binding(1) var x_30 : sampler_comparison; )", R"( - let x_200 : vec4 = vec4(textureSample(x_20, x_10, coords12), 0.0, 0.0, 0.0); - let x_210 : f32 = textureSampleCompare(x_20, x_30, coords12, 0.200000003); + let x_200 : vec4 = vec4(textureSample(x_20, x_10, coords12), 0.0f, 0.0f, 0.0f); + let x_210 : f32 = textureSampleCompare(x_20, x_30, coords12, 0.200000003f); )"})); INSTANTIATE_TEST_SUITE_P( @@ -1847,7 +1847,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d; )", - R"(textureSampleCompare(x_20, x_10, coords12, 0.200000003))"}, + R"(textureSampleCompare(x_20, x_10, coords12, 0.200000003f))"}, // ImageSampleDrefImplicitLod - arrayed ImageAccessCase{ "%float 2D 0 1 0 1 Unknown", @@ -1856,7 +1856,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_2d_array;)", - R"(textureSampleCompare(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003))"}, + R"(textureSampleCompare(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003f))"}, // ImageSampleDrefImplicitLod with ConstOffset ImageAccessCase{ "%float 2D 0 0 0 1 Unknown", @@ -1866,7 +1866,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d; )", - R"(textureSampleCompare(x_20, x_10, coords12, 0.200000003, vec2(3i, 4i)))"}, + R"(textureSampleCompare(x_20, x_10, coords12, 0.200000003f, vec2(3i, 4i)))"}, // ImageSampleDrefImplicitLod arrayed with ConstOffset ImageAccessCase{ "%float 2D 0 1 0 1 Unknown", @@ -1875,7 +1875,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_2d_array;)", - R"(textureSampleCompare(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003, vec2(3i, 4i)))"})); + R"(textureSampleCompare(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003f, vec2(3i, 4i)))"})); INSTANTIATE_TEST_SUITE_P( ImageSampleDrefExplicitLod, @@ -1891,7 +1891,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d; )", - R"(textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003))"}, + R"(textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003f))"}, // 2D array ImageAccessCase{ "%float 2D 1 1 0 1 Unknown", @@ -1900,7 +1900,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_2d_array;)", - R"(textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003))"}, + R"(textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003f))"}, // 2D, ConstOffset ImageAccessCase{ "%float 2D 1 0 0 1 Unknown", @@ -1911,7 +1911,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d; )", - R"(textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003, vec2(3i, 4i)))"}, + R"(textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003f, vec2(3i, 4i)))"}, // 2D array, ConstOffset ImageAccessCase{ "%float 2D 1 1 0 1 Unknown", @@ -1921,7 +1921,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_2d_array;)", - R"(textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003, vec2(3i, 4i)))"}, + R"(textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.200000003f, vec2(3i, 4i)))"}, // Cube ImageAccessCase{"%float Cube 1 0 0 1 Unknown", "%result = OpImageSampleDrefExplicitLod " @@ -1929,7 +1929,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_cube;)", - R"(textureSampleCompareLevel(x_20, x_10, coords123, 0.200000003))"}, + R"(textureSampleCompareLevel(x_20, x_10, coords123, 0.200000003f))"}, // Cube array ImageAccessCase{ "%float Cube 1 1 0 1 Unknown", @@ -1938,7 +1938,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler_comparison; @group(2) @binding(1) var x_20 : texture_depth_cube_array;)", - R"(textureSampleCompareLevel(x_20, x_10, coords1234.xyz, i32(round(coords1234.w)), 0.200000003))"})); + R"(textureSampleCompareLevel(x_20, x_10, coords1234.xyz, i32(round(coords1234.w)), 0.200000003f))"})); INSTANTIATE_TEST_SUITE_P( ImageSampleExplicitLod_UsingLod, @@ -1952,7 +1952,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d;)", - R"(textureSampleLevel(x_20, x_10, coords12, 0.0))"}, + R"(textureSampleLevel(x_20, x_10, coords12, 0.0f))"}, // OpImageSampleExplicitLod arrayed - using Lod ImageAccessCase{ @@ -1962,7 +1962,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d_array;)", - R"(textureSampleLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.0))"}, + R"(textureSampleLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.0f))"}, // OpImageSampleExplicitLod - using Lod and ConstOffset ImageAccessCase{"%float 2D 0 0 0 1 Unknown", @@ -1972,7 +1972,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d;)", - R"(textureSampleLevel(x_20, x_10, coords12, 0.0, vec2(3i, 4i)))"}, + R"(textureSampleLevel(x_20, x_10, coords12, 0.0f, vec2(3i, 4i)))"}, // OpImageSampleExplicitLod - using Lod and unsigned ConstOffset // Convert the ConstOffset operand to signed @@ -1984,7 +1984,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d;)", - R"(textureSampleLevel(x_20, x_10, coords12, 0.0, vec2(vec2(3u, 4u)))"}, + R"(textureSampleLevel(x_20, x_10, coords12, 0.0f, vec2(vec2(3u, 4u)))"}, // OpImageSampleExplicitLod arrayed - using Lod and ConstOffset ImageAccessCase{ @@ -1995,7 +1995,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d_array;)", - R"(textureSampleLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.0, vec2(3i, 4i)))"})); + R"(textureSampleLevel(x_20, x_10, coords123.xy, i32(round(coords123.z)), 0.0f, vec2(3i, 4i)))"})); INSTANTIATE_TEST_SUITE_P( ImageSampleExplicitLod_UsingGrad, @@ -2092,7 +2092,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d; )", - R"(vec4(textureSampleLevel(x_20, x_10, vf12, i32(f1)), 0.0, 0.0, 0.0))"}})); + R"(vec4(textureSampleLevel(x_20, x_10, vf12, i32(f1)), 0.0f, 0.0f, 0.0f))"}})); ///// // Projection sampling @@ -2176,7 +2176,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d;)", - R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0))"}, + R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0f))"}, // OpImageSampleProjImplicitLod with Bias and signed ConstOffset ImageAccessCase{ @@ -2187,7 +2187,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d;)", - R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0, vec2(3i, 4i)))"}, + R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0f, vec2(3i, 4i)))"}, // OpImageSampleProjImplicitLod with Bias and unsigned ConstOffset // Convert ConstOffset to signed @@ -2199,7 +2199,7 @@ INSTANTIATE_TEST_SUITE_P( R"(@group(0) @binding(0) var x_10 : sampler; @group(2) @binding(1) var x_20 : texture_2d;)", - R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0, vec2(vec2(3u, 4u))))"})); + R"(textureSampleBias(x_20, x_10, (coords123.xy / coords123.z), 7.0f, vec2(vec2(3u, 4u))))"})); INSTANTIATE_TEST_SUITE_P( ImageSampleProjExplicitLod_Lod, @@ -2266,7 +2266,7 @@ INSTANTIATE_TEST_SUITE_P( // Sampling the depth texture yields an f32, but the // SPIR-V operation yiedls vec4, so fill out the // remaining components with 0. - R"(vec4(textureSample(x_20, x_10, (coords123.xy / coords123.z)), 0.0, 0.0, 0.0))"})); + R"(vec4(textureSample(x_20, x_10, (coords123.xy / coords123.z)), 0.0f, 0.0f, 0.0f))"})); INSTANTIATE_TEST_SUITE_P( ImageSampleProjDrefImplicitLod, @@ -2311,7 +2311,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d; )", - R"(textureSampleCompare(x_20, x_10, (coords123.xy / coords123.z), 0.200000003, 0.0))"}, + R"(textureSampleCompare(x_20, x_10, (coords123.xy / coords123.z), 0.200000003f, 0.0f))"}, // OpImageSampleProjDrefImplicitLod 2D depth-texture, Lod ConstOffset ImageAccessCase{ @@ -2323,7 +2323,7 @@ INSTANTIATE_TEST_SUITE_P( @group(2) @binding(1) var x_20 : texture_depth_2d; )", - R"(textureSampleCompareLevel(x_20, x_10, (coords123.xy / coords123.z), 0.200000003, 0.0, vec2(3i, 4i)))"})); + R"(textureSampleCompareLevel(x_20, x_10, (coords123.xy / coords123.z), 0.200000003f, 0.0f, vec2(3i, 4i)))"})); ///// // End projection sampling @@ -2416,15 +2416,15 @@ INSTANTIATE_TEST_SUITE_P( // Source 1 component {"%float 2D 0 0 0 2 R32f", "OpImageWrite %im %vi12 %f1", R"(@group(2) @binding(1) var x_20 : texture_storage_2d;)", - "textureStore(x_20, vi12, vec4(f1, 0.0, 0.0, 0.0));"}, + "textureStore(x_20, vi12, vec4(f1, 0.0f, 0.0f, 0.0f));"}, // Source 2 component, dest 1 component {"%float 2D 0 0 0 2 R32f", "OpImageWrite %im %vi12 %vf12", R"(@group(2) @binding(1) var x_20 : texture_storage_2d;)", - "textureStore(x_20, vi12, vec4(vf12, 0.0, 0.0));"}, + "textureStore(x_20, vi12, vec4(vf12, 0.0f, 0.0f));"}, // Source 3 component, dest 1 component {"%float 2D 0 0 0 2 R32f", "OpImageWrite %im %vi12 %vf123", R"(@group(2) @binding(1) var x_20 : texture_storage_2d;)", - "textureStore(x_20, vi12, vec4(vf123, 0.0));"}, + "textureStore(x_20, vi12, vec4(vf123, 0.0f));"}, // Source 4 component, dest 1 component {"%float 2D 0 0 0 2 R32f", "OpImageWrite %im %vi12 %vf1234", R"(@group(2) @binding(1) var x_20 : texture_storage_2d;)", @@ -2432,11 +2432,11 @@ INSTANTIATE_TEST_SUITE_P( // Source 2 component, dest 2 component {"%float 2D 0 0 0 2 Rg32f", "OpImageWrite %im %vi12 %vf12", R"(@group(2) @binding(1) var x_20 : texture_storage_2d;)", - "textureStore(x_20, vi12, vec4(vf12, 0.0, 0.0));"}, + "textureStore(x_20, vi12, vec4(vf12, 0.0f, 0.0f));"}, // Source 3 component, dest 2 component {"%float 2D 0 0 0 2 Rg32f", "OpImageWrite %im %vi12 %vf123", R"(@group(2) @binding(1) var x_20 : texture_storage_2d;)", - "textureStore(x_20, vi12, vec4(vf123, 0.0));"}, + "textureStore(x_20, vi12, vec4(vf123, 0.0f));"}, // Source 4 component, dest 2 component {"%float 2D 0 0 0 2 Rg32f", "OpImageWrite %im %vi12 %vf1234", R"(@group(2) @binding(1) var x_20 : texture_storage_2d;)", @@ -2583,11 +2583,11 @@ INSTANTIATE_TEST_SUITE_P( // Level of detail is injected for depth texture {"%float 2D 1 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12", R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)", - R"(let x_99 : vec4 = vec4(textureLoad(x_20, vi12, 0i), 0.0, 0.0, 0.0);)"}, + R"(let x_99 : vec4 = vec4(textureLoad(x_20, vi12, 0i), 0.0f, 0.0f, 0.0f);)"}, // OpImageFetch with extra params, on depth texture {"%float 2D 1 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12 Lod %int_3", R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)", - R"(let x_99 : vec4 = vec4(textureLoad(x_20, vi12, 3i), 0.0, 0.0, 0.0);)"}})); + R"(let x_99 : vec4 = vec4(textureLoad(x_20, vi12, 3i), 0.0f, 0.0f, 0.0f);)"}})); INSTANTIATE_TEST_SUITE_P( ImageFetch_Depth, @@ -2600,7 +2600,7 @@ INSTANTIATE_TEST_SUITE_P( // ImageFetch on depth image. {"%float 2D 1 0 0 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12 ", R"(@group(2) @binding(1) var x_20 : texture_depth_2d;)", - R"(let x_99 : vec4 = vec4(textureLoad(x_20, vi12, 0i), 0.0, 0.0, 0.0);)"}})); + R"(let x_99 : vec4 = vec4(textureLoad(x_20, vi12, 0i), 0.0f, 0.0f, 0.0f);)"}})); INSTANTIATE_TEST_SUITE_P( ImageFetch_DepthMultisampled, @@ -2613,7 +2613,7 @@ INSTANTIATE_TEST_SUITE_P( // ImageFetch on multisampled depth image. {"%float 2D 1 0 1 1 Unknown", "%99 = OpImageFetch %v4float %im %vi12 Sample %i1", R"(@group(2) @binding(1) var x_20 : texture_depth_multisampled_2d;)", - R"(let x_99 : vec4 = vec4(textureLoad(x_20, vi12, i1), 0.0, 0.0, 0.0);)"}})); + R"(let x_99 : vec4 = vec4(textureLoad(x_20, vi12, i1), 0.0f, 0.0f, 0.0f);)"}})); INSTANTIATE_TEST_SUITE_P(ImageFetch_Multisampled, SpvParserHandleTest_ImageAccessTest, @@ -3076,7 +3076,7 @@ TEST_P(SpvParserHandleTest_ImageCoordsTest, MakeCoordinateOperandsForImageAccess ASSERT_NE(anchor, nullptr); const spvtools::opt::Instruction& image_access = *(anchor->PreviousNode()); - ast::ExpressionList result = fe.MakeCoordinateOperandsForImageAccess(image_access); + auto result = fe.MakeCoordinateOperandsForImageAccess(image_access); if (GetParam().expected_error.empty()) { EXPECT_TRUE(fe.success()) << p->error(); EXPECT_TRUE(p->error().empty()); @@ -3090,7 +3090,7 @@ TEST_P(SpvParserHandleTest_ImageCoordsTest, MakeCoordinateOperandsForImageAccess } else { EXPECT_FALSE(fe.success()); EXPECT_THAT(p->error(), Eq(GetParam().expected_error)) << assembly; - EXPECT_TRUE(result.empty()); + EXPECT_TRUE(result.IsEmpty()); } } diff --git a/src/tint/reader/spirv/parser_impl_module_var_test.cc b/src/tint/reader/spirv/parser_impl_module_var_test.cc index 8ef704e4d7..8eb506b8bd 100644 --- a/src/tint/reader/spirv/parser_impl_module_var_test.cc +++ b/src/tint/reader/spirv/parser_impl_module_var_test.cc @@ -408,7 +408,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPosition_StorePositionMember_OneAcces EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->error().empty()); const auto module_str = test::ToString(p->program()); - EXPECT_THAT(module_str, HasSubstr("gl_Position.y = 0.0;")) << module_str; + EXPECT_THAT(module_str, HasSubstr("gl_Position.y = 0.0f;")) << module_str; } TEST_F(SpvModuleScopeVarParserTest, BuiltinPosition_StorePositionMember_TwoAccessChain) { @@ -430,7 +430,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPosition_StorePositionMember_TwoAcces EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->error().empty()); const auto module_str = test::ToString(p->program()); - EXPECT_THAT(module_str, HasSubstr("gl_Position.y = 0.0;")) << module_str; + EXPECT_THAT(module_str, HasSubstr("gl_Position.y = 0.0f;")) << module_str; } TEST_F(SpvModuleScopeVarParserTest, BuiltinPointSize_Write1_IsErased) { @@ -460,7 +460,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(gl_Position); @@ -510,7 +510,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPointSize_ReadReplaced) { var gl_Position : vec4; fn main_1() { - x_900 = 1.0; + x_900 = 1.0f; return; } @@ -519,7 +519,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(gl_Position); @@ -575,7 +575,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(gl_Position); @@ -634,7 +634,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(x_2); @@ -681,7 +681,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPointSize_Loose_ReadReplaced_Vertex) var x_900 : f32; fn main_1() { - x_900 = 1.0; + x_900 = 1.0f; return; } @@ -690,7 +690,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(x_2); @@ -746,7 +746,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(x_2); @@ -782,7 +782,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(x_2); @@ -889,7 +889,7 @@ var x_3 : i32 = -1i; var x_4 : u32 = 1u; -var x_5 : f32 = 1.5; +var x_5 : f32 = 1.5f; )")); } @@ -914,7 +914,7 @@ var x_2 : i32 = 0i; var x_3 : u32 = 0u; -var x_4 : f32 = 0.0; +var x_4 : f32 = 0.0f; )")); } @@ -939,7 +939,7 @@ var x_2 : i32 = 0i; var x_3 : u32 = 0u; -var x_4 : f32 = 0.0; +var x_4 : f32 = 0.0f; )")); // This example module emits ok, but is not valid SPIR-V in the first place. @@ -956,7 +956,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorInitializer) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); EXPECT_TRUE(p->error().empty()); const auto module_str = test::ToString(p->program()); - EXPECT_THAT(module_str, HasSubstr("var x_200 : vec2 = vec2(1.5, 2.0);")); + EXPECT_THAT(module_str, HasSubstr("var x_200 : vec2 = vec2(1.5f, 2.0f);")); } TEST_F(SpvModuleScopeVarParserTest, VectorBoolNullInitializer) { @@ -1083,9 +1083,9 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixInitializer) { EXPECT_TRUE(p->error().empty()); const auto module_str = test::ToString(p->program()); EXPECT_THAT(module_str, HasSubstr("var x_200 : mat3x2 = mat3x2(" - "vec2(1.5, 2.0), " - "vec2(2.0, 3.0), " - "vec2(3.0, 4.0));")); + "vec2(1.5f, 2.0f), " + "vec2(2.0f, 3.0f), " + "vec2(3.0f, 4.0f));")); } TEST_F(SpvModuleScopeVarParserTest, MatrixNullInitializer) { @@ -1168,7 +1168,7 @@ TEST_F(SpvModuleScopeVarParserTest, StructInitializer) { EXPECT_TRUE(p->error().empty()); const auto module_str = test::ToString(p->program()); EXPECT_THAT(module_str, - HasSubstr("var x_200 : S = S(1u, 1.5, array(1u, 2u));")) + HasSubstr("var x_200 : S = S(1u, 1.5f, array(1u, 2u));")) << module_str; } @@ -1181,7 +1181,7 @@ TEST_F(SpvModuleScopeVarParserTest, StructNullInitializer) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); EXPECT_TRUE(p->error().empty()); const auto module_str = test::ToString(p->program()); - EXPECT_THAT(module_str, HasSubstr("var x_200 : S = S(0u, 0.0, array());")) + EXPECT_THAT(module_str, HasSubstr("var x_200 : S = S(0u, 0.0f, array());")) << module_str; } @@ -1195,7 +1195,7 @@ TEST_F(SpvModuleScopeVarParserTest, StructUndefInitializer) { EXPECT_TRUE(p->error().empty()); const auto module_str = test::ToString(p->program()); - EXPECT_THAT(module_str, HasSubstr("var x_200 : S = S(0u, 0.0, array());")) + EXPECT_THAT(module_str, HasSubstr("var x_200 : S = S(0u, 0.0f, array());")) << module_str; // This example module emits ok, but is not valid SPIR-V in the first place. @@ -1565,7 +1565,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_F32) { ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); EXPECT_TRUE(p->error().empty()); const auto module_str = test::ToString(p->program()); - EXPECT_THAT(module_str, HasSubstr("@id(12) override myconst : f32 = 2.5;")) << module_str; + EXPECT_THAT(module_str, HasSubstr("@id(12) override myconst : f32 = 2.5f;")) << module_str; } TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_F32_WithoutSpecId) { @@ -1580,7 +1580,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_F32_WithoutS ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); EXPECT_TRUE(p->error().empty()); const auto module_str = test::ToString(p->program()); - EXPECT_THAT(module_str, HasSubstr("override myconst : f32 = 2.5;")) << module_str; + EXPECT_THAT(module_str, HasSubstr("override myconst : f32 = 2.5f;")) << module_str; } TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_UsedInFunction) { @@ -1650,7 +1650,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_index) x_1_param : u32) { x_1 = bitcast(x_1_param); main_1(); @@ -1763,7 +1763,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_index) x_1_param : u32) { x_1 = bitcast(x_1_param); main_1(); @@ -1816,7 +1816,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_index) x_1_param : u32) { x_1 = x_1_param; main_1(); @@ -1846,7 +1846,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_index) x_1_param : u32) { x_1 = x_1_param; main_1(); @@ -1875,7 +1875,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_index) x_1_param : u32) { x_1 = x_1_param; main_1(); @@ -1989,7 +1989,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_mask) x_1_param : u32) { x_1[0i] = x_1_param; main_1(); @@ -2021,7 +2021,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_mask) x_1_param : u32) { x_1[0i] = x_1_param; main_1(); @@ -2053,7 +2053,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_mask) x_1_param : u32) { x_1[0i] = x_1_param; main_1(); @@ -2084,7 +2084,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_mask) x_1_param : u32) { x_1[0i] = bitcast(x_1_param); main_1(); @@ -2116,7 +2116,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_mask) x_1_param : u32) { x_1[0i] = bitcast(x_1_param); main_1(); @@ -2148,7 +2148,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_mask) x_1_param : u32) { x_1[0i] = bitcast(x_1_param); main_1(); @@ -2202,7 +2202,7 @@ struct main_out { x_1_1 : u32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_1[0i]); @@ -2239,7 +2239,7 @@ struct main_out { x_1_1 : u32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_1[0i]); @@ -2276,7 +2276,7 @@ struct main_out { x_1_1 : u32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_1[0i]); @@ -2312,7 +2312,7 @@ struct main_out { x_1_1 : u32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(bitcast(x_1[0i])); @@ -2349,7 +2349,7 @@ struct main_out { x_1_1 : u32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(bitcast(x_1[0i])); @@ -2386,7 +2386,7 @@ struct main_out { x_1_1 : u32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(bitcast(x_1[0i])); @@ -2425,7 +2425,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_mask) x_1_param : u32) { x_1[0i] = x_1_param; main_1(); @@ -2469,7 +2469,7 @@ struct main_out { x_1_1 : u32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_1[0i]); @@ -2527,7 +2527,7 @@ struct main_out { x_4_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { x_1 = bitcast(x_1_param); main_1(); @@ -2537,6 +2537,68 @@ fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { EXPECT_EQ(module_str, expected) << module_str; } +TEST_F(SpvModuleScopeVarParserTest, VertexIndex_UsedTwice_DifferentConstructs) { + // Test crbug.com/tint/1577 + // Builtin variables must not be hoisted. Before the fix, the reader + // would see two uses of the variable in different constructs and try + // to hoist it. Only function-local definitions should be hoisted. + const std::string assembly = VertexIndexPreamble("%uint") + R"( + %bool = OpTypeBool + %900 = OpConstantTrue %bool + %main = OpFunction %void None %voidfn + %entry = OpLabel + %2 = OpLoad %uint %1 ; used in outer selection + OpSelectionMerge %99 None + OpBranchConditional %900 %30 %99 + + %30 = OpLabel + %3 = OpLoad %uint %1 ; used in inner selection + OpSelectionMerge %40 None + OpBranchConditional %900 %35 %40 + + %35 = OpLabel + OpBranch %40 + + %40 = OpLabel + OpBranch %99 + + %99 = OpLabel + OpReturn + OpFunctionEnd + )"; + auto p = parser(test::Assemble(assembly)); + ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly; + EXPECT_TRUE(p->error().empty()); + const auto module_str = test::ToString(p->program()); + const std::string expected = R"(var x_1 : u32; + +var x_5 : vec4; + +fn main_1() { + let x_2 : u32 = x_1; + if (true) { + let x_3 : u32 = x_1; + if (true) { + } + } + return; +} + +struct main_out { + @builtin(position) + x_5_1 : vec4, +} + +@vertex +fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { + x_1 = x_1_param; + main_1(); + return main_out(x_5); +} +)"; + EXPECT_EQ(module_str, expected) << module_str; +} + TEST_F(SpvModuleScopeVarParserTest, VertexIndex_I32_Load_CopyObject) { const std::string assembly = VertexIndexPreamble("%int") + R"( %main = OpFunction %void None %voidfn @@ -2565,7 +2627,7 @@ struct main_out { x_4_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { x_1 = bitcast(x_1_param); main_1(); @@ -2602,7 +2664,7 @@ struct main_out { x_4_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { x_1 = bitcast(x_1_param); main_1(); @@ -2638,7 +2700,7 @@ struct main_out { x_4_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { x_1 = x_1_param; main_1(); @@ -2676,7 +2738,7 @@ struct main_out { x_4_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { x_1 = x_1_param; main_1(); @@ -2713,7 +2775,7 @@ struct main_out { x_4_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(vertex_index) x_1_param : u32) -> main_out { x_1 = x_1_param; main_1(); @@ -2797,7 +2859,7 @@ struct main_out { position_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(instance_index) x_1_param : u32) -> main_out { x_1 = bitcast(x_1_param); main_1(); @@ -2835,7 +2897,7 @@ struct main_out { position_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(instance_index) x_1_param : u32) -> main_out { x_1 = bitcast(x_1_param); main_1(); @@ -2872,7 +2934,7 @@ struct main_out { position_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(instance_index) x_1_param : u32) -> main_out { x_1 = bitcast(x_1_param); main_1(); @@ -2931,7 +2993,7 @@ struct main_out { position_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(instance_index) x_1_param : u32) -> main_out { x_1 = x_1_param; main_1(); @@ -2969,7 +3031,7 @@ struct main_out { position_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(instance_index) x_1_param : u32) -> main_out { x_1 = x_1_param; main_1(); @@ -3006,7 +3068,7 @@ struct main_out { position_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(instance_index) x_1_param : u32) -> main_out { x_1 = x_1_param; main_1(); @@ -3149,7 +3211,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) { x_1 = ${assignment_value}; main_1(); @@ -3195,7 +3257,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) { x_1 = ${assignment_value}; main_1(); @@ -3240,7 +3302,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main(@builtin(${wgsl_builtin}) x_1_param : ${unsigned_wgsl_type}) { x_1 = ${assignment_value}; main_1(); @@ -3366,13 +3428,13 @@ TEST_F(SpvModuleScopeVarParserTest, RegisterInputOutputVars) { const auto& info_1000 = p->GetEntryPointInfo(1000); EXPECT_EQ(1u, info_1000.size()); - EXPECT_TRUE(info_1000[0].inputs.empty()); - EXPECT_TRUE(info_1000[0].outputs.empty()); + EXPECT_TRUE(info_1000[0].inputs.IsEmpty()); + EXPECT_TRUE(info_1000[0].outputs.IsEmpty()); const auto& info_1100 = p->GetEntryPointInfo(1100); EXPECT_EQ(1u, info_1100.size()); EXPECT_THAT(info_1100[0].inputs, ElementsAre(1)); - EXPECT_TRUE(info_1100[0].outputs.empty()); + EXPECT_TRUE(info_1100[0].outputs.IsEmpty()); const auto& info_1200 = p->GetEntryPointInfo(1200); EXPECT_EQ(1u, info_1200.size()); @@ -3552,7 +3614,7 @@ struct main_out { x_4_1 : u32, } -@stage(fragment) +@fragment fn main(@location(0) @interpolate(flat) x_1_param : u32, @location(30) @interpolate(flat) x_3_param : u32) -> main_out { x_1 = x_1_param; x_3 = x_3_param; @@ -3603,7 +3665,7 @@ struct main_out { x_4_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(instance_index) x_1_param : u32) -> main_out { x_1 = x_1_param; main_1(); @@ -3652,7 +3714,7 @@ struct main_out { x_4_1 : vec4, } -@stage(vertex) +@vertex fn main(@builtin(instance_index) x_1_param : u32) -> main_out { x_1 = bitcast(x_1_param); main_1(); @@ -3692,7 +3754,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_mask) x_1_param : u32) { x_1[0i] = x_1_param; main_1(); @@ -3730,7 +3792,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@builtin(sample_mask) x_1_param : u32) { x_1[0i] = bitcast(x_1_param); main_1(); @@ -3776,7 +3838,7 @@ struct main_out { x_1_1 : u32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_1[0i]); @@ -3822,7 +3884,7 @@ struct main_out { x_1_1 : u32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(bitcast(x_1[0i])); @@ -3854,7 +3916,7 @@ TEST_F(SpvModuleScopeVarParserTest, EntryPointWrapping_BuiltinVar_FragDepth_Out_ ASSERT_TRUE(p->Parse()) << p->error() << assembly; EXPECT_TRUE(p->error().empty()); const auto got = test::ToString(p->program()); - const std::string expected = R"(var x_1 : f32 = 0.0; + const std::string expected = R"(var x_1 : f32 = 0.0f; fn main_1() { return; @@ -3865,7 +3927,7 @@ struct main_out { x_1_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_1); @@ -3899,7 +3961,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(gl_Position); @@ -3957,7 +4019,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPosition_BuiltIn_Position_Initializer const auto got = test::ToString(p->program()); const std::string expected = - R"(var gl_Position : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + R"(var gl_Position : vec4 = vec4(1.0f, 2.0f, 3.0f, 4.0f); fn main_1() { return; @@ -3968,7 +4030,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(gl_Position); @@ -4025,7 +4087,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main(@location(4) x_1_param : f32, @location(5) x_1_param_1 : f32, @location(6) x_1_param_2 : f32) -> main_out { x_1[0i] = x_1_param; x_1[1i] = x_1_param_1; @@ -4083,7 +4145,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main(@location(9) x_1_param : vec4, @location(10) x_1_param_1 : vec4) -> main_out { x_1[0i] = x_1_param; x_1[1i] = x_1_param_1; @@ -4150,7 +4212,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main(@location(9) x_1_param : f32, @location(10) x_1_param_1 : vec4) -> main_out { x_1.alice = x_1_param; x_1.bob = x_1_param_1; @@ -4209,7 +4271,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main(@location(7) x_1_param : vec4, @location(8) x_1_param_1 : vec4, @location(9) x_1_param_2 : vec4, @location(10) x_1_param_3 : vec4) -> main_out { x_1[0i][0i] = x_1_param; x_1[0i][1i] = x_1_param_1; @@ -4276,7 +4338,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(x_1[0i], x_1[1i], x_1[2i], x_2); @@ -4335,7 +4397,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(x_1[0i], x_1[1i], x_2); @@ -4404,7 +4466,7 @@ struct main_out { x_2_1 : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(x_1.alice, x_1.bob, x_2); @@ -4479,7 +4541,7 @@ struct main_out { x_3_2 : vec4, } -@stage(vertex) +@vertex fn main(@location(9) x_1_param : f32, @location(11) x_1_param_1 : vec4) -> main_out { x_1.alice = x_1_param; x_1.bob = x_1_param_1; @@ -4558,7 +4620,7 @@ struct main_out { x_10_1 : vec4, } -@stage(vertex) +@vertex fn main(@location(1) @interpolate(flat) x_1_param : u32, @location(2) @interpolate(flat) x_2_param : vec2, @location(3) @interpolate(flat) x_3_param : i32, @location(4) @interpolate(flat) x_4_param : vec2, @location(5) @interpolate(flat) x_5_param : f32, @location(6) @interpolate(flat) x_6_param : vec2) -> main_out { x_1 = x_1_param; x_2 = x_2_param; @@ -4653,7 +4715,7 @@ struct main_out { x_10_1 : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(x_1, x_2, x_3, x_4, x_5, x_6, x_10); @@ -4703,7 +4765,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@location(1) @interpolate(flat) x_1_param : f32, @location(2) @interpolate(flat) x_1_param_1 : f32, @location(5) @interpolate(flat) x_2_param : f32, @location(6) @interpolate(flat) x_2_param_1 : f32) { x_1[0i] = x_1_param; x_1[1i] = x_1_param_1; @@ -4777,7 +4839,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@location(1) x_1_param : f32, @location(2) @interpolate(perspective, centroid) x_2_param : f32, @location(3) @interpolate(perspective, sample) x_3_param : f32, @location(4) @interpolate(linear) x_4_param : f32, @location(5) @interpolate(linear, centroid) x_5_param : f32, @location(6) @interpolate(linear, sample) x_6_param : f32) { x_1 = x_1_param; x_2 = x_2_param; @@ -4844,7 +4906,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@location(1) x_1_param : f32, @location(2) @interpolate(perspective, centroid) x_1_param_1 : f32, @location(3) @interpolate(perspective, sample) x_1_param_2 : f32, @location(4) @interpolate(linear) x_1_param_3 : f32, @location(5) @interpolate(linear, centroid) x_1_param_4 : f32, @location(6) @interpolate(linear, sample) x_1_param_5 : f32) { x_1.field0 = x_1_param; x_1.field1 = x_1_param_1; @@ -4935,7 +4997,7 @@ struct main_out { x_6_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_1, x_2, x_3, x_4, x_5, x_6); @@ -5014,7 +5076,7 @@ struct main_out { x_1_6 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_1.field0, x_1.field1, x_1.field2, x_1.field3, x_1.field4, x_1.field5); @@ -5100,7 +5162,7 @@ struct main_out { x_10_1 : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(x_1, x_2, x_3, x_4, x_5, x_6, x_10); @@ -5163,7 +5225,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main(@location(1) @interpolate(flat) x_1_param : u32, @location(2) @interpolate(flat) x_2_param : vec2, @location(3) @interpolate(flat) x_3_param : i32, @location(4) @interpolate(flat) x_4_param : vec2, @location(5) x_5_param : f32, @location(6) x_6_param : vec2) { x_1 = x_1_param; x_2 = x_2_param; diff --git a/src/tint/reader/spirv/parser_impl_test_helper.cc b/src/tint/reader/spirv/parser_impl_test_helper.cc index 1e52d815ac..e624984983 100644 --- a/src/tint/reader/spirv/parser_impl_test_helper.cc +++ b/src/tint/reader/spirv/parser_impl_test_helper.cc @@ -39,7 +39,7 @@ std::string ToString(const Program& program) { return writer.result(); } -std::string ToString(const Program& program, const ast::StatementList& stmts) { +std::string ToString(const Program& program, utils::VectorRef stmts) { writer::wgsl::GeneratorImpl writer(&program); for (const auto* stmt : stmts) { if (!writer.EmitStatement(stmt)) { diff --git a/src/tint/reader/spirv/parser_impl_test_helper.h b/src/tint/reader/spirv/parser_impl_test_helper.h index 7362a2d75e..d1b0e35f84 100644 --- a/src/tint/reader/spirv/parser_impl_test_helper.h +++ b/src/tint/reader/spirv/parser_impl_test_helper.h @@ -21,8 +21,18 @@ #include #include +#include "src/tint/utils/compiler_macros.h" + #if TINT_BUILD_SPV_READER +TINT_BEGIN_DISABLE_WARNING(NEWLINE_EOF); +TINT_BEGIN_DISABLE_WARNING(OLD_STYLE_CAST); +TINT_BEGIN_DISABLE_WARNING(SIGN_CONVERSION); +TINT_BEGIN_DISABLE_WARNING(WEAK_VTABLES); #include "source/opt/ir_context.h" +TINT_END_DISABLE_WARNING(WEAK_VTABLES); +TINT_END_DISABLE_WARNING(SIGN_CONVERSION); +TINT_END_DISABLE_WARNING(OLD_STYLE_CAST); +TINT_END_DISABLE_WARNING(NEWLINE_EOF); #endif #include "gtest/gtest.h" @@ -185,10 +195,10 @@ class ParserImplWrapperForTest { /// @param member_ty the type of the member /// @param decoration an encoded SPIR-V Decoration /// @returns the AST decorations - ast::AttributeList ConvertMemberDecoration(uint32_t struct_type_id, - uint32_t member_index, - const Type* member_ty, - const Decoration& decoration) { + auto ConvertMemberDecoration(uint32_t struct_type_id, + uint32_t member_index, + const Type* member_ty, + const Decoration& decoration) { return impl_.ConvertMemberDecoration(struct_type_id, member_index, member_ty, decoration); } @@ -265,7 +275,7 @@ std::string ToString(const Program& program); /// @param program the Program /// @param stmts the statement list /// @returns the WGSL printed string of a statement list. -std::string ToString(const Program& program, const ast::StatementList& stmts); +std::string ToString(const Program& program, utils::VectorRef stmts); /// Returns the WGSL printed string of an AST node. /// @param program the Program diff --git a/src/tint/reader/spirv/parser_type.cc b/src/tint/reader/spirv/parser_type.cc index 3332cd4f74..5de62f6bce 100644 --- a/src/tint/reader/spirv/parser_type.cc +++ b/src/tint/reader/spirv/parser_type.cc @@ -21,6 +21,7 @@ #include "src/tint/program_builder.h" #include "src/tint/utils/hash.h" #include "src/tint/utils/map.h" +#include "src/tint/utils/string.h" #include "src/tint/utils/unique_allocator.h" TINT_INSTANTIATE_TYPEINFO(tint::reader::spirv::Type); @@ -163,6 +164,12 @@ const ast::Type* I32::Build(ProgramBuilder& b) const { return b.ty.i32(); } +Type::Type() = default; +Type::Type(const Type&) = default; +Type::~Type() = default; + +Texture::~Texture() = default; + Pointer::Pointer(const Type* t, ast::StorageClass s) : type(t), storage_class(s) {} Pointer::Pointer(const Pointer&) = default; @@ -512,13 +519,13 @@ std::string I32::String() const { std::string Pointer::String() const { std::stringstream ss; - ss << "ptr<" << std::string(ast::ToString(storage_class)) << ", " << type->String() + ">"; + ss << "ptr<" << utils::ToString(storage_class) << ", " << type->String() + ">"; return ss.str(); } std::string Reference::String() const { std::stringstream ss; - ss << "ref<" + std::string(ast::ToString(storage_class)) << ", " << type->String() << ">"; + ss << "ref<" + utils::ToString(storage_class) << ", " << type->String() << ">"; return ss.str(); } diff --git a/src/tint/reader/spirv/parser_type.h b/src/tint/reader/spirv/parser_type.h index 605ac9b0b6..9543b51cc4 100644 --- a/src/tint/reader/spirv/parser_type.h +++ b/src/tint/reader/spirv/parser_type.h @@ -40,6 +40,13 @@ namespace tint::reader::spirv { /// Type is the base class for all types class Type : public Castable { public: + /// Constructor + Type(); + /// Copy constructor + Type(const Type&); + /// Destructor + ~Type() override; + /// @param b the ProgramBuilder used to construct the AST types /// @returns the constructed ast::Type node for the given type virtual const ast::Type* Build(ProgramBuilder& b) const = 0; @@ -314,6 +321,8 @@ struct Sampler final : public Castable { /// Base class for texture types struct Texture : public Castable { + ~Texture() override; + /// Constructor /// @param d the texture dimensions explicit Texture(ast::TextureDimension d); diff --git a/src/tint/reader/spirv/parser_type_test.cc b/src/tint/reader/spirv/parser_type_test.cc index c031cd7567..37ac113b48 100644 --- a/src/tint/reader/spirv/parser_type_test.cc +++ b/src/tint/reader/spirv/parser_type_test.cc @@ -56,7 +56,7 @@ TEST(SpvParserTypeTest, DifferentArgumentsGivesDifferentPointer) { EXPECT_NE(ty.Pointer(ty.I32(), ast::StorageClass::kNone), ty.Pointer(ty.U32(), ast::StorageClass::kNone)); EXPECT_NE(ty.Pointer(ty.I32(), ast::StorageClass::kNone), - ty.Pointer(ty.I32(), ast::StorageClass::kInput)); + ty.Pointer(ty.I32(), ast::StorageClass::kIn)); EXPECT_NE(ty.Vector(ty.I32(), 3), ty.Vector(ty.U32(), 3)); EXPECT_NE(ty.Vector(ty.I32(), 3), ty.Vector(ty.I32(), 2)); EXPECT_NE(ty.Matrix(ty.I32(), 3, 2), ty.Matrix(ty.U32(), 3, 2)); diff --git a/src/tint/reader/spirv/usage_test.cc b/src/tint/reader/spirv/usage_test.cc index d01d1a264e..bb64bb35e7 100644 --- a/src/tint/reader/spirv/usage_test.cc +++ b/src/tint/reader/spirv/usage_test.cc @@ -45,7 +45,7 @@ TEST_F(SpvParserTest, Usage_Trivial_Output) { } TEST_F(SpvParserTest, Usage_Equality_OneDifference) { - const int num_usages = 9; + const size_t num_usages = 9u; std::vector usages(num_usages); usages[1].AddSampler(); usages[2].AddComparisonSampler(); @@ -55,8 +55,8 @@ TEST_F(SpvParserTest, Usage_Equality_OneDifference) { usages[6].AddDepthTexture(); usages[7].AddStorageReadTexture(); usages[8].AddStorageWriteTexture(); - for (int i = 0; i < num_usages; ++i) { - for (int j = 0; j < num_usages; ++j) { + for (size_t i = 0; i < num_usages; ++i) { + for (size_t j = 0; j < num_usages; ++j) { const auto& lhs = usages[i]; const auto& rhs = usages[j]; if (i == j) { diff --git a/src/tint/reader/wgsl/lexer.cc b/src/tint/reader/wgsl/lexer.cc index d9a9f34540..0bc19ad132 100644 --- a/src/tint/reader/wgsl/lexer.cc +++ b/src/tint/reader/wgsl/lexer.cc @@ -17,13 +17,15 @@ #include #include #include +#include #include -#include // NOLINT(build/include_order) +#include #include #include #include #include "src/tint/debug.h" +#include "src/tint/number.h" #include "src/tint/text/unicode.h" namespace tint::reader::wgsl { @@ -35,6 +37,8 @@ static_assert(sizeof(decltype(tint::Source::FileContent::data[0])) == sizeof(uin "tint::reader::wgsl requires the size of a std::string element " "to be a single byte"); +static constexpr size_t kDefaultListSize = 512; + bool read_blankspace(std::string_view str, size_t i, bool* is_blankspace, size_t* blankspace_size) { // See https://www.w3.org/TR/WGSL/#blankspace @@ -80,35 +84,33 @@ uint32_t hex_value(char c) { return 0; } -/// LimitCheck is the enumerator result of check_limits(). -enum class LimitCheck { - /// The value was within the limits of the data type. - kWithinLimits, - /// The value was too small to fit within the data type. - kTooSmall, - /// The value was too large to fit within the data type. - kTooLarge, -}; - -/// Checks whether the value fits within the integer type `T` -template -LimitCheck check_limits(int64_t value) { - static_assert(std::is_integral_v, "T must be an integer"); - if (value < static_cast(std::numeric_limits::min())) { - return LimitCheck::kTooSmall; - } - if (value > static_cast(std::numeric_limits::max())) { - return LimitCheck::kTooLarge; - } - return LimitCheck::kWithinLimits; -} - } // namespace Lexer::Lexer(const Source::File* file) : file_(file), location_{1, 1} {} Lexer::~Lexer() = default; +std::vector Lexer::Lex() { + std::vector tokens; + tokens.reserve(kDefaultListSize); + while (true) { + tokens.emplace_back(next()); + + // If the token can be split, we insert a placeholder element into + // the stream to hold the split character. + if (tokens.back().IsSplittable()) { + auto src = tokens.back().source(); + src.range.begin.column++; + tokens.emplace_back(Token(Token::Type::kPlaceholder, src)); + } + + if (tokens.back().IsEof() || tokens.back().IsError()) { + break; + } + } + return tokens; +} + const std::string_view Lexer::line() const { if (file_->content.lines.size() == 0) { static const char* empty_string = ""; @@ -219,11 +221,19 @@ bool Lexer::is_hex(char ch) const { } bool Lexer::matches(size_t pos, std::string_view sub_string) { - if (pos >= length()) + if (pos >= length()) { return false; + } return substr(pos, sub_string.size()) == sub_string; } +bool Lexer::matches(size_t pos, char ch) { + if (pos >= length()) { + return false; + } + return line()[pos] == ch; +} + Token Lexer::skip_blankspace_and_comments() { for (;;) { auto loc = location_; @@ -252,8 +262,9 @@ Token Lexer::skip_blankspace_and_comments() { // If the cursor didn't advance we didn't remove any blankspace // so we're done. - if (loc == location_) + if (loc == location_) { break; + } } if (is_eof()) { return {Token::Type::kEOF, begin_source()}; @@ -317,7 +328,7 @@ Token Lexer::try_float() { auto source = begin_source(); bool has_mantissa_digits = false; - if (matches(end, "-")) { + if (matches(end, '-')) { end++; } while (end < length() && is_digit(at(end))) { @@ -326,7 +337,7 @@ Token Lexer::try_float() { } bool has_point = false; - if (end < length() && matches(end, ".")) { + if (end < length() && matches(end, '.')) { has_point = true; end++; } @@ -342,9 +353,9 @@ Token Lexer::try_float() { // Parse the exponent if one exists bool has_exponent = false; - if (end < length() && (matches(end, "e") || matches(end, "E"))) { + if (end < length() && (matches(end, 'e') || matches(end, 'E'))) { end++; - if (end < length() && (matches(end, "+") || matches(end, "-"))) { + if (end < length() && (matches(end, '+') || matches(end, '-'))) { end++; } @@ -362,53 +373,61 @@ Token Lexer::try_float() { } bool has_f_suffix = false; - if (end < length() && matches(end, "f")) { + bool has_h_suffix = false; + if (end < length() && matches(end, 'f')) { end++; has_f_suffix = true; + } else if (end < length() && matches(end, 'h')) { + end++; + has_h_suffix = true; } - if (!has_point && !has_exponent && !has_f_suffix) { + if (!has_point && !has_exponent && !has_f_suffix && !has_h_suffix) { // If it only has digits then it's an integer. return {}; } - // Save the error string, for use by diagnostics. - const auto str = std::string{substr(start, end - start)}; - advance(end - start); end_source(source); - auto res = strtod(&at(start), nullptr); - // This errors out if a non-zero magnitude is too small to represent in a - // float. It can't be represented faithfully in an f32. - const auto magnitude = std::fabs(res); - if (0.0 < magnitude && magnitude < static_cast(std::numeric_limits::min())) { - return {Token::Type::kError, source, - "f32 (" + str + ") magnitude too small, not representable"}; - } - // This handles if the number is really large negative number - if (res < static_cast(std::numeric_limits::lowest())) { - return {Token::Type::kError, source, "f32 (" + str + ") too large (negative)"}; - } - if (res > static_cast(std::numeric_limits::max())) { - return {Token::Type::kError, source, "f32 (" + str + ") too large (positive)"}; + double value = std::strtod(&at(start), nullptr); + + if (has_f_suffix) { + if (auto f = CheckedConvert(AFloat(value))) { + return {Token::Type::kFloatLiteral_F, source, static_cast(f.Get())}; + } else { + return {Token::Type::kError, source, "value cannot be represented as 'f32'"}; + } } - return {source, static_cast(res)}; + if (has_h_suffix) { + if (auto f = CheckedConvert(AFloat(value))) { + return {Token::Type::kFloatLiteral_H, source, static_cast(f.Get())}; + } else { + return {Token::Type::kError, source, "value cannot be represented as 'f16'"}; + } + } + + if (value == HUGE_VAL || -value == HUGE_VAL) { + return {Token::Type::kError, source, "value cannot be represented as 'abstract-float'"}; + } else { + return {Token::Type::kFloatLiteral, source, value}; + } } Token Lexer::try_hex_float() { - constexpr uint32_t kTotalBits = 32; - constexpr uint32_t kTotalMsb = kTotalBits - 1; - constexpr uint32_t kMantissaBits = 23; - constexpr uint32_t kMantissaMsb = kMantissaBits - 1; - constexpr uint32_t kMantissaShiftRight = kTotalBits - kMantissaBits; - constexpr int32_t kExponentBias = 127; - constexpr int32_t kExponentMax = 255; - constexpr uint32_t kExponentBits = 8; - constexpr uint32_t kExponentMask = (1 << kExponentBits) - 1; - constexpr uint32_t kExponentLeftShift = kMantissaBits; - constexpr uint32_t kSignBit = 31; + constexpr uint64_t kExponentBits = 11; + constexpr uint64_t kMantissaBits = 52; + constexpr uint64_t kTotalBits = 1 + kExponentBits + kMantissaBits; + constexpr uint64_t kTotalMsb = kTotalBits - 1; + constexpr uint64_t kMantissaMsb = kMantissaBits - 1; + constexpr uint64_t kMantissaShiftRight = kTotalBits - kMantissaBits; + constexpr int64_t kExponentBias = 1023; + constexpr uint64_t kExponentMask = (1 << kExponentBits) - 1; + constexpr int64_t kExponentMax = kExponentMask; // Including NaN / inf + constexpr uint64_t kExponentLeftShift = kMantissaBits; + constexpr uint64_t kSignBit = kTotalBits - 1; + constexpr uint64_t kOne = 1; auto start = pos(); auto end = pos(); @@ -420,20 +439,20 @@ Token Lexer::try_hex_float() { // clang-format on // -? - int32_t sign_bit = 0; - if (matches(end, "-")) { + uint64_t sign_bit = 0; + if (matches(end, '-')) { sign_bit = 1; end++; } // 0[xX] - if (matches(end, "0x") || matches(end, "0X")) { + if (matches(end, '0') && (matches(end + 1, 'x') || matches(end + 1, 'X'))) { end += 2; } else { return {}; } - uint32_t mantissa = 0; - uint32_t exponent = 0; + uint64_t mantissa = 0; + uint64_t exponent = 0; // TODO(dneto): Values in the normal range for the format do not explicitly // store the most significant bit. The algorithm here works hard to eliminate @@ -446,7 +465,7 @@ Token Lexer::try_hex_float() { // `set_next_mantissa_bit_to` sets next `mantissa` bit starting from msb to // lsb to value 1 if `set` is true, 0 otherwise. Returns true on success, i.e. // when the bit can be accommodated in the available space. - uint32_t mantissa_next_bit = kTotalMsb; + uint64_t mantissa_next_bit = kTotalMsb; auto set_next_mantissa_bit_to = [&](bool set, bool integer_part) -> bool { // If adding bits for the integer part, we can overflow whether we set the // bit or not. For the fractional part, we can only overflow when setting @@ -458,7 +477,7 @@ Token Lexer::try_hex_float() { return false; // Overflowed mantissa } if (set) { - mantissa |= (1 << mantissa_next_bit); + mantissa |= (kOne << mantissa_next_bit); } --mantissa_next_bit; return true; @@ -472,7 +491,7 @@ Token Lexer::try_hex_float() { // .? bool hex_point = false; - if (matches(end, ".")) { + if (matches(end, '.')) { hex_point = true; end++; } @@ -490,7 +509,7 @@ Token Lexer::try_hex_float() { } // Is the binary exponent present? It's optional. - const bool has_exponent = (matches(end, "p") || matches(end, "P")); + const bool has_exponent = (matches(end, 'p') || matches(end, 'P')); if (has_exponent) { end++; } @@ -514,7 +533,7 @@ Token Lexer::try_hex_float() { has_zero_integer = false; } - for (int32_t bit = 3; bit >= 0; --bit) { + for (int bit = 3; bit >= 0; --bit) { auto v = 1 & (nibble >> bit); // Skip leading 0s and the first 1 @@ -535,7 +554,7 @@ Token Lexer::try_hex_float() { // [0-9a-fA-F]* for (auto i = fractional_range.first; i < fractional_range.second; ++i) { auto nibble = hex_value(at(i)); - for (int32_t bit = 3; bit >= 0; --bit) { + for (int bit = 3; bit >= 0; --bit) { auto v = 1 & (nibble >> bit); if (v == 1) { @@ -563,22 +582,24 @@ Token Lexer::try_hex_float() { // Parse the optional exponent. // ((p|P)(\+|-)?[0-9]+)? - uint32_t input_exponent = 0; // Defaults to 0 if not present - int32_t exponent_sign = 1; + uint64_t input_exponent = 0; // Defaults to 0 if not present + int64_t exponent_sign = 1; // If the 'p' part is present, the rest of the exponent must exist. + bool has_f_suffix = false; + bool has_h_suffix = false; if (has_exponent) { // Parse the rest of the exponent. // (+|-)? - if (matches(end, "+")) { + if (matches(end, '+')) { end++; - } else if (matches(end, "-")) { + } else if (matches(end, '-')) { exponent_sign = -1; end++; } // Parse exponent from input // [0-9]+ - // Allow overflow (in uint32_t) when the floating point value magnitude is + // Allow overflow (in uint64_t) when the floating point value magnitude is // zero. bool has_exponent_digits = false; while (end < length() && isdigit(at(end))) { @@ -593,10 +614,14 @@ Token Lexer::try_hex_float() { end++; } - // Parse optional 'f' suffix. For a hex float, it can only exist + // Parse optional 'f' or 'h' suffix. For a hex float, it can only exist // when the exponent is present. Otherwise it will look like // one of the mantissa digits. - if (end < length() && matches(end, "f")) { + if (end < length() && matches(end, 'f')) { + has_f_suffix = true; + end++; + } else if (end < length() && matches(end, 'h')) { + has_h_suffix = true; end++; } @@ -614,14 +639,14 @@ Token Lexer::try_hex_float() { } else { // Ensure input exponent is not too large; i.e. that it won't overflow when // adding the exponent bias. - const uint32_t kIntMax = static_cast(std::numeric_limits::max()); - const uint32_t kMaxInputExponent = kIntMax - kExponentBias; + const uint64_t kIntMax = static_cast(std::numeric_limits::max()); + const uint64_t kMaxInputExponent = kIntMax - kExponentBias; if (input_exponent > kMaxInputExponent) { return {Token::Type::kError, source, "exponent is too large for hex float"}; } // Compute exponent so far - exponent += static_cast(static_cast(input_exponent) * exponent_sign); + exponent += static_cast(static_cast(input_exponent) * exponent_sign); // Bias exponent if non-zero // After this, if exponent is <= 0, our value is a denormal @@ -640,7 +665,7 @@ Token Lexer::try_hex_float() { // We can now safely work with exponent as a signed quantity, as there's no // chance to overflow - int32_t signed_exponent = static_cast(exponent); + int64_t signed_exponent = static_cast(exponent); // Shift mantissa to occupy the low 23 bits mantissa >>= kMantissaShiftRight; @@ -651,7 +676,7 @@ Token Lexer::try_hex_float() { // then shift the mantissa to make exponent zero. if (signed_exponent <= 0) { mantissa >>= 1; - mantissa |= (1 << kMantissaMsb); + mantissa |= (kOne << kMantissaMsb); } while (signed_exponent < 0) { @@ -665,154 +690,213 @@ Token Lexer::try_hex_float() { } } - if (signed_exponent > kExponentMax) { - // Overflow: set to infinity - signed_exponent = kExponentMax; - mantissa = 0; - } else if (signed_exponent == kExponentMax && mantissa != 0) { - // NaN: set to infinity - mantissa = 0; + if (signed_exponent >= kExponentMax || (signed_exponent == kExponentMax && mantissa != 0)) { + std::string type = has_f_suffix ? "f32" : (has_h_suffix ? "f16" : "abstract-float"); + return {Token::Type::kError, source, "value cannot be represented as '" + type + "'"}; } // Combine sign, mantissa, and exponent - uint32_t result_u32 = sign_bit << kSignBit; - result_u32 |= mantissa; - result_u32 |= (static_cast(signed_exponent) & kExponentMask) << kExponentLeftShift; + uint64_t result_u64 = sign_bit << kSignBit; + result_u64 |= mantissa; + result_u64 |= (static_cast(signed_exponent) & kExponentMask) << kExponentLeftShift; - // Reinterpret as float and return - float result; - std::memcpy(&result, &result_u32, sizeof(result)); - return {source, static_cast(result)}; + // Reinterpret as f16 and return + double result_f64; + std::memcpy(&result_f64, &result_u64, 8); + + if (has_f_suffix) { + // Check value fits in f32 + if (result_f64 < static_cast(f32::kLowestValue) || + result_f64 > static_cast(f32::kHighestValue)) { + return {Token::Type::kError, source, "value cannot be represented as 'f32'"}; + } + // Check the value can be exactly represented, i.e. only high 23 mantissa bits are valid for + // normal f32 values, and less for subnormal f32 values. The rest low mantissa bits must be + // 0. + int valid_mantissa_bits = 0; + double abs_result_f64 = std::fabs(result_f64); + if (abs_result_f64 >= static_cast(f32::kSmallestValue)) { + // The result shall be a normal f32 value. + valid_mantissa_bits = 23; + } else if (abs_result_f64 >= static_cast(f32::kSmallestSubnormalValue)) { + // The result shall be a subnormal f32 value, represented as double. + // The smallest positive normal f32 is f32::kSmallestValue = 2^-126 = 0x1.0p-126, and + // the + // smallest positive subnormal f32 is f32::kSmallestSubnormalValue = 2^-149. Thus, the + // value v in range 2^-126 > v >= 2^-149 must be represented as a subnormal f32 + // number, but is still normal double (f64) number, and has a exponent in range -127 + // to -149, inclusive. + // A value v, if 2^-126 > v >= 2^-127, its binary32 representation will have binary form + // s_00000000_1xxxxxxxxxxxxxxxxxxxxxx, having mantissa of 1 leading 1 bit and 22 + // arbitrary bits. Since this value is represented as normal double number, the + // leading 1 bit is omitted, only the highest 22 mantissia bits can be arbitrary, and + // the rest lowest 40 mantissa bits of f64 number must be zero. + // 2^-127 > v >= 2^-128, binary32 s_00000000_01xxxxxxxxxxxxxxxxxxxxx, having mantissa of + // 1 leading 0 bit, 1 leading 1 bit, and 21 arbitrary bits. The f64 representation + // omits the leading 0 and 1 bits, and only the highest 21 mantissia bits can be + // arbitrary. + // 2^-128 > v >= 2^-129, binary32 s_00000000_001xxxxxxxxxxxxxxxxxxxx, 20 arbitrary bits. + // ... + // 2^-147 > v >= 2^-148, binary32 s_00000000_0000000000000000000001x, 1 arbitrary bit. + // 2^-148 > v >= 2^-149, binary32 s_00000000_00000000000000000000001, 0 arbitrary bit. + + // signed_exponent must be in range -149 + 1023 = 874 to -127 + 1023 = 896, inclusive + TINT_ASSERT(Reader, (874 <= signed_exponent) && (signed_exponent <= 896)); + int unbiased_exponent = + static_cast(signed_exponent) - static_cast(kExponentBias); + TINT_ASSERT(Reader, (-149 <= unbiased_exponent) && (unbiased_exponent <= -127)); + valid_mantissa_bits = unbiased_exponent + 149; // 0 for -149, and 22 for -127 + } else if (abs_result_f64 != 0.0) { + // The result is smaller than the smallest subnormal f32 value, but not equal to zero. + // Such value will never be exactly represented by f32. + return {Token::Type::kError, source, "value cannot be exactly represented as 'f32'"}; + } + // Check the low 52-valid_mantissa_bits mantissa bits must be 0. + TINT_ASSERT(Reader, (0 <= valid_mantissa_bits) && (valid_mantissa_bits <= 23)); + if (result_u64 & ((uint64_t(1) << (52 - valid_mantissa_bits)) - 1)) { + return {Token::Type::kError, source, "value cannot be exactly represented as 'f32'"}; + } + return {Token::Type::kFloatLiteral_F, source, result_f64}; + } else if (has_h_suffix) { + // Check value fits in f16 + if (result_f64 < static_cast(f16::kLowestValue) || + result_f64 > static_cast(f16::kHighestValue)) { + return {Token::Type::kError, source, "value cannot be represented as 'f16'"}; + } + // Check the value can be exactly represented, i.e. only high 10 mantissa bits are valid for + // normal f16 values, and less for subnormal f16 values. The rest low mantissa bits must be + // 0. + int valid_mantissa_bits = 0; + double abs_result_f64 = std::fabs(result_f64); + if (abs_result_f64 >= static_cast(f16::kSmallestValue)) { + // The result shall be a normal f16 value. + valid_mantissa_bits = 10; + } else if (abs_result_f64 >= static_cast(f16::kSmallestSubnormalValue)) { + // The result shall be a subnormal f16 value, represented as double. + // The smallest positive normal f16 is f16::kSmallestValue = 2^-14 = 0x1.0p-14, and the + // smallest positive subnormal f16 is f16::kSmallestSubnormalValue = 2^-24. Thus, the + // value v in range 2^-14 > v >= 2^-24 must be represented as a subnormal f16 number, + // but is still normal double (f64) number, and has a exponent in range -15 to -24, + // inclusive. + // A value v, if 2^-14 > v >= 2^-15, its binary16 representation will have binary form + // s_00000_1xxxxxxxxx, having mantissa of 1 leading 1 bit and 9 arbitrary bits. Since + // this value is represented as normal double number, the leading 1 bit is omitted, + // only the highest 9 mantissia bits can be arbitrary, and the rest lowest 43 mantissa + // bits of f64 number must be zero. + // 2^-15 > v >= 2^-16, binary16 s_00000_01xxxxxxxx, having mantissa of 1 leading 0 bit, + // 1 leading 1 bit, and 8 arbitrary bits. The f64 representation omits the leading 0 + // and 1 bits, and only the highest 8 mantissia bits can be arbitrary. + // 2^-16 > v >= 2^-17, binary16 s_00000_001xxxxxxx, 7 arbitrary bits. + // ... + // 2^-22 > v >= 2^-23, binary16 s_00000_000000001x, 1 arbitrary bits. + // 2^-23 > v >= 2^-24, binary16 s_00000_0000000001, 0 arbitrary bits. + + // signed_exponent must be in range -24 + 1023 = 999 to -15 + 1023 = 1008, inclusive + TINT_ASSERT(Reader, (999 <= signed_exponent) && (signed_exponent <= 1008)); + int unbiased_exponent = + static_cast(signed_exponent) - static_cast(kExponentBias); + TINT_ASSERT(Reader, (-24 <= unbiased_exponent) && (unbiased_exponent <= -15)); + valid_mantissa_bits = unbiased_exponent + 24; // 0 for -24, and 9 for -15 + } else if (abs_result_f64 != 0.0) { + // The result is smaller than the smallest subnormal f16 value, but not equal to zero. + // Such value will never be exactly represented by f16. + return {Token::Type::kError, source, "value cannot be exactly represented as 'f16'"}; + } + // Check the low 52-valid_mantissa_bits mantissa bits must be 0. + TINT_ASSERT(Reader, (0 <= valid_mantissa_bits) && (valid_mantissa_bits <= 10)); + if (result_u64 & ((uint64_t(1) << (52 - valid_mantissa_bits)) - 1)) { + return {Token::Type::kError, source, "value cannot be exactly represented as 'f16'"}; + } + return {Token::Type::kFloatLiteral_H, source, result_f64}; + } + + return {Token::Type::kFloatLiteral, source, result_f64}; } -Token Lexer::build_token_from_int_if_possible(Source source, - size_t start, - size_t end, - int32_t base) { - int64_t res = strtoll(&at(start), nullptr, base); +Token Lexer::build_token_from_int_if_possible(Source source, size_t start, int32_t base) { + const char* start_ptr = &at(start); + char* end_ptr = nullptr; - auto str = [&] { return std::string{substr(start, end - start)}; }; + errno = 0; + int64_t res = strtoll(start_ptr, &end_ptr, base); + const bool overflow = errno == ERANGE; - if (matches(pos(), "u")) { - switch (check_limits(res)) { - case LimitCheck::kTooSmall: - return {Token::Type::kError, source, "unsigned literal cannot be negative"}; - case LimitCheck::kTooLarge: - return {Token::Type::kError, source, str() + " too large for u32"}; - default: - advance(1); - end_source(source); - return {Token::Type::kIntULiteral, source, res}; - } + if (end_ptr) { + advance(static_cast(end_ptr - start_ptr)); } - if (matches(pos(), "i")) { - switch (check_limits(res)) { - case LimitCheck::kTooSmall: - return {Token::Type::kError, source, str() + " too small for i32"}; - case LimitCheck::kTooLarge: - return {Token::Type::kError, source, str() + " too large for i32"}; - default: - break; - } - advance(1); - end_source(source); - return {Token::Type::kIntILiteral, source, res}; - } - - // TODO(crbug.com/tint/1504): Properly support abstract int: - // Change `AbstractIntType` to `int64_t`, update errors to say 'abstract int'. - using AbstractIntType = int32_t; - switch (check_limits(res)) { - case LimitCheck::kTooSmall: - return {Token::Type::kError, source, str() + " too small for i32"}; - case LimitCheck::kTooLarge: - return {Token::Type::kError, source, str() + " too large for i32"}; - default: + if (matches(pos(), 'u')) { + if (!overflow && CheckedConvert(AInt(res))) { + advance(1); end_source(source); - return {Token::Type::kIntLiteral, source, res}; + return {Token::Type::kIntLiteral_U, source, res}; + } + return {Token::Type::kError, source, "value cannot be represented as 'u32'"}; } + + if (matches(pos(), 'i')) { + if (!overflow && CheckedConvert(AInt(res))) { + advance(1); + end_source(source); + return {Token::Type::kIntLiteral_I, source, res}; + } + return {Token::Type::kError, source, "value cannot be represented as 'i32'"}; + } + + end_source(source); + if (overflow) { + return {Token::Type::kError, source, "value cannot be represented as 'abstract-int'"}; + } + return {Token::Type::kIntLiteral, source, res}; } Token Lexer::try_hex_integer() { - constexpr size_t kMaxDigits = 8; // Valid for both 32-bit integer types auto start = pos(); - auto end = pos(); + auto curr = start; auto source = begin_source(); - if (matches(end, "-")) { - end++; + if (matches(curr, '-')) { + curr++; } - if (matches(end, "0x") || matches(end, "0X")) { - end += 2; + if (matches(curr, '0') && (matches(curr + 1, 'x') || matches(curr + 1, 'X'))) { + curr += 2; } else { return {}; } - auto first = end; - while (!is_eol() && is_hex(at(end))) { - end++; - - auto digits = end - first; - if (digits > kMaxDigits) { - return {Token::Type::kError, source, - "integer literal (" + std::string{substr(start, end - 1 - start)} + - "...) has too many digits"}; - } - } - if (first == end) { + if (!is_hex(at(curr))) { return {Token::Type::kError, source, "integer or float hex literal has no significant digits"}; } - advance(end - start); - - return build_token_from_int_if_possible(source, start, end, 16); + return build_token_from_int_if_possible(source, start, 16); } Token Lexer::try_integer() { - constexpr size_t kMaxDigits = 10; // Valid for both 32-bit integer types auto start = pos(); - auto end = start; + auto curr = start; auto source = begin_source(); - if (matches(end, "-")) { - end++; + if (matches(curr, '-')) { + curr++; } - if (end >= length() || !is_digit(at(end))) { + if (curr >= length() || !is_digit(at(curr))) { return {}; } - auto first = end; // If the first digit is a zero this must only be zero as leading zeros // are not allowed. - auto next = first + 1; - if (next < length()) { - if (at(first) == '0' && is_digit(at(next))) { - return {Token::Type::kError, source, - "integer literal (" + std::string{substr(start, end - 1 - start)} + - "...) has leading 0s"}; + if (auto next = curr + 1; next < length()) { + if (at(curr) == '0' && is_digit(at(next))) { + return {Token::Type::kError, source, "integer literal cannot have leading 0s"}; } } - while (end < length() && is_digit(at(end))) { - auto digits = end - first; - if (digits > kMaxDigits) { - return {Token::Type::kError, source, - "integer literal (" + std::string{substr(start, end - 1 - start)} + - "...) has too many digits"}; - } - - end++; - } - - advance(end - start); - - return build_token_from_int_if_possible(source, start, end, 10); + return build_token_from_int_if_possible(source, start, 10); } Token Lexer::try_ident() { @@ -874,138 +958,172 @@ Token Lexer::try_punctuation() { auto source = begin_source(); auto type = Token::Type::kUninitialized; - if (matches(pos(), "@")) { + if (matches(pos(), '@')) { type = Token::Type::kAttr; advance(1); - } else if (matches(pos(), "(")) { + } else if (matches(pos(), '(')) { type = Token::Type::kParenLeft; advance(1); - } else if (matches(pos(), ")")) { + } else if (matches(pos(), ')')) { type = Token::Type::kParenRight; advance(1); - } else if (matches(pos(), "[")) { + } else if (matches(pos(), '[')) { type = Token::Type::kBracketLeft; advance(1); - } else if (matches(pos(), "]")) { + } else if (matches(pos(), ']')) { type = Token::Type::kBracketRight; advance(1); - } else if (matches(pos(), "{")) { + } else if (matches(pos(), '{')) { type = Token::Type::kBraceLeft; advance(1); - } else if (matches(pos(), "}")) { + } else if (matches(pos(), '}')) { type = Token::Type::kBraceRight; advance(1); - } else if (matches(pos(), "&&")) { - type = Token::Type::kAndAnd; - advance(2); - } else if (matches(pos(), "&=")) { - type = Token::Type::kAndEqual; - advance(2); - } else if (matches(pos(), "&")) { - type = Token::Type::kAnd; - advance(1); - } else if (matches(pos(), "/=")) { - type = Token::Type::kDivisionEqual; - advance(2); - } else if (matches(pos(), "/")) { - type = Token::Type::kForwardSlash; - advance(1); - } else if (matches(pos(), "!=")) { - type = Token::Type::kNotEqual; - advance(2); - } else if (matches(pos(), "!")) { - type = Token::Type::kBang; - advance(1); - } else if (matches(pos(), ":")) { + } else if (matches(pos(), '&')) { + if (matches(pos() + 1, '&')) { + type = Token::Type::kAndAnd; + advance(2); + } else if (matches(pos() + 1, '=')) { + type = Token::Type::kAndEqual; + advance(2); + } else { + type = Token::Type::kAnd; + advance(1); + } + } else if (matches(pos(), '/')) { + if (matches(pos() + 1, '=')) { + type = Token::Type::kDivisionEqual; + advance(2); + } else { + type = Token::Type::kForwardSlash; + advance(1); + } + } else if (matches(pos(), '!')) { + if (matches(pos() + 1, '=')) { + type = Token::Type::kNotEqual; + advance(2); + } else { + type = Token::Type::kBang; + advance(1); + } + } else if (matches(pos(), ':')) { type = Token::Type::kColon; advance(1); - } else if (matches(pos(), ",")) { + } else if (matches(pos(), ',')) { type = Token::Type::kComma; advance(1); - } else if (matches(pos(), "==")) { - type = Token::Type::kEqualEqual; - advance(2); - } else if (matches(pos(), "=")) { - type = Token::Type::kEqual; - advance(1); - } else if (matches(pos(), ">=")) { - type = Token::Type::kGreaterThanEqual; - advance(2); - } else if (matches(pos(), ">>")) { - type = Token::Type::kShiftRight; - advance(2); - } else if (matches(pos(), ">")) { - type = Token::Type::kGreaterThan; - advance(1); - } else if (matches(pos(), "<=")) { - type = Token::Type::kLessThanEqual; - advance(2); - } else if (matches(pos(), "<<")) { - type = Token::Type::kShiftLeft; - advance(2); - } else if (matches(pos(), "<")) { - type = Token::Type::kLessThan; - advance(1); - } else if (matches(pos(), "%=")) { - type = Token::Type::kModuloEqual; - advance(2); - } else if (matches(pos(), "%")) { - type = Token::Type::kMod; - advance(1); - } else if (matches(pos(), "->")) { - type = Token::Type::kArrow; - advance(2); - } else if (matches(pos(), "--")) { - type = Token::Type::kMinusMinus; - advance(2); - } else if (matches(pos(), "-=")) { - type = Token::Type::kMinusEqual; - advance(2); - } else if (matches(pos(), "-")) { - type = Token::Type::kMinus; - advance(1); - } else if (matches(pos(), ".")) { + } else if (matches(pos(), '=')) { + if (matches(pos() + 1, '=')) { + type = Token::Type::kEqualEqual; + advance(2); + } else { + type = Token::Type::kEqual; + advance(1); + } + } else if (matches(pos(), '>')) { + if (matches(pos() + 1, '=')) { + type = Token::Type::kGreaterThanEqual; + advance(2); + } else if (matches(pos() + 1, '>')) { + if (matches(pos() + 2, '=')) { + type = Token::Type::kShiftRightEqual; + advance(3); + } else { + type = Token::Type::kShiftRight; + advance(2); + } + } else { + type = Token::Type::kGreaterThan; + advance(1); + } + } else if (matches(pos(), '<')) { + if (matches(pos() + 1, '=')) { + type = Token::Type::kLessThanEqual; + advance(2); + } else if (matches(pos() + 1, '<')) { + if (matches(pos() + 2, '=')) { + type = Token::Type::kShiftLeftEqual; + advance(3); + } else { + type = Token::Type::kShiftLeft; + advance(2); + } + } else { + type = Token::Type::kLessThan; + advance(1); + } + } else if (matches(pos(), '%')) { + if (matches(pos() + 1, '=')) { + type = Token::Type::kModuloEqual; + advance(2); + } else { + type = Token::Type::kMod; + advance(1); + } + } else if (matches(pos(), '-')) { + if (matches(pos() + 1, '>')) { + type = Token::Type::kArrow; + advance(2); + } else if (matches(pos() + 1, '-')) { + type = Token::Type::kMinusMinus; + advance(2); + } else if (matches(pos() + 1, '=')) { + type = Token::Type::kMinusEqual; + advance(2); + } else { + type = Token::Type::kMinus; + advance(1); + } + } else if (matches(pos(), '.')) { type = Token::Type::kPeriod; advance(1); - } else if (matches(pos(), "++")) { - type = Token::Type::kPlusPlus; - advance(2); - } else if (matches(pos(), "+=")) { - type = Token::Type::kPlusEqual; - advance(2); - } else if (matches(pos(), "+")) { - type = Token::Type::kPlus; - advance(1); - } else if (matches(pos(), "||")) { - type = Token::Type::kOrOr; - advance(2); - } else if (matches(pos(), "|=")) { - type = Token::Type::kOrEqual; - advance(2); - } else if (matches(pos(), "|")) { - type = Token::Type::kOr; - advance(1); - } else if (matches(pos(), ";")) { + } else if (matches(pos(), '+')) { + if (matches(pos() + 1, '+')) { + type = Token::Type::kPlusPlus; + advance(2); + } else if (matches(pos() + 1, '=')) { + type = Token::Type::kPlusEqual; + advance(2); + } else { + type = Token::Type::kPlus; + advance(1); + } + } else if (matches(pos(), '|')) { + if (matches(pos() + 1, '|')) { + type = Token::Type::kOrOr; + advance(2); + } else if (matches(pos() + 1, '=')) { + type = Token::Type::kOrEqual; + advance(2); + } else { + type = Token::Type::kOr; + advance(1); + } + } else if (matches(pos(), ';')) { type = Token::Type::kSemicolon; advance(1); - } else if (matches(pos(), "*=")) { - type = Token::Type::kTimesEqual; - advance(2); - } else if (matches(pos(), "*")) { - type = Token::Type::kStar; - advance(1); - } else if (matches(pos(), "~")) { + } else if (matches(pos(), '*')) { + if (matches(pos() + 1, '=')) { + type = Token::Type::kTimesEqual; + advance(2); + } else { + type = Token::Type::kStar; + advance(1); + } + } else if (matches(pos(), '~')) { type = Token::Type::kTilde; advance(1); - } else if (matches(pos(), "_")) { + } else if (matches(pos(), '_')) { type = Token::Type::kUnderscore; advance(1); - } else if (matches(pos(), "^=")) { - type = Token::Type::kXorEqual; - advance(2); - } else if (matches(pos(), "^")) { - type = Token::Type::kXor; - advance(1); + } else if (matches(pos(), '^')) { + if (matches(pos() + 1, '=')) { + type = Token::Type::kXorEqual; + advance(2); + } else { + type = Token::Type::kXor; + advance(1); + } } end_source(source); @@ -1014,108 +1132,153 @@ Token Lexer::try_punctuation() { } Token Lexer::check_keyword(const Source& source, std::string_view str) { - if (str == "array") + if (str == "array") { return {Token::Type::kArray, source, "array"}; - if (str == "atomic") + } + if (str == "atomic") { return {Token::Type::kAtomic, source, "atomic"}; - if (str == "bitcast") + } + if (str == "bitcast") { return {Token::Type::kBitcast, source, "bitcast"}; - if (str == "bool") + } + if (str == "bool") { return {Token::Type::kBool, source, "bool"}; - if (str == "break") + } + if (str == "break") { return {Token::Type::kBreak, source, "break"}; - if (str == "case") + } + if (str == "case") { return {Token::Type::kCase, source, "case"}; - if (str == "continue") + } + if (str == "const") { + return {Token::Type::kConst, source, "const"}; + } + if (str == "continue") { return {Token::Type::kContinue, source, "continue"}; - if (str == "continuing") + } + if (str == "continuing") { return {Token::Type::kContinuing, source, "continuing"}; - if (str == "discard") + } + if (str == "discard") { return {Token::Type::kDiscard, source, "discard"}; - if (str == "default") + } + if (str == "default") { return {Token::Type::kDefault, source, "default"}; - if (str == "else") + } + if (str == "else") { return {Token::Type::kElse, source, "else"}; - if (str == "enable") + } + if (str == "enable") { return {Token::Type::kEnable, source, "enable"}; - if (str == "f32") + } + if (str == "f16") { + return {Token::Type::kF16, source, "f16"}; + } + if (str == "f32") { return {Token::Type::kF32, source, "f32"}; - if (str == "fallthrough") + } + if (str == "fallthrough") { return {Token::Type::kFallthrough, source, "fallthrough"}; - if (str == "false") + } + if (str == "false") { return {Token::Type::kFalse, source, "false"}; - if (str == "fn") + } + if (str == "fn") { return {Token::Type::kFn, source, "fn"}; - if (str == "for") + } + if (str == "for") { return {Token::Type::kFor, source, "for"}; - if (str == "function") - return {Token::Type::kFunction, source, "function"}; - if (str == "i32") + } + if (str == "i32") { return {Token::Type::kI32, source, "i32"}; - if (str == "if") + } + if (str == "if") { return {Token::Type::kIf, source, "if"}; - if (str == "import") - return {Token::Type::kImport, source, "import"}; - if (str == "let") + } + if (str == "let") { return {Token::Type::kLet, source, "let"}; - if (str == "loop") + } + if (str == "loop") { return {Token::Type::kLoop, source, "loop"}; - if (str == "mat2x2") + } + if (str == "mat2x2") { return {Token::Type::kMat2x2, source, "mat2x2"}; - if (str == "mat2x3") + } + if (str == "mat2x3") { return {Token::Type::kMat2x3, source, "mat2x3"}; - if (str == "mat2x4") + } + if (str == "mat2x4") { return {Token::Type::kMat2x4, source, "mat2x4"}; - if (str == "mat3x2") + } + if (str == "mat3x2") { return {Token::Type::kMat3x2, source, "mat3x2"}; - if (str == "mat3x3") + } + if (str == "mat3x3") { return {Token::Type::kMat3x3, source, "mat3x3"}; - if (str == "mat3x4") + } + if (str == "mat3x4") { return {Token::Type::kMat3x4, source, "mat3x4"}; - if (str == "mat4x2") + } + if (str == "mat4x2") { return {Token::Type::kMat4x2, source, "mat4x2"}; - if (str == "mat4x3") + } + if (str == "mat4x3") { return {Token::Type::kMat4x3, source, "mat4x3"}; - if (str == "mat4x4") + } + if (str == "mat4x4") { return {Token::Type::kMat4x4, source, "mat4x4"}; - if (str == "override") + } + if (str == "override") { return {Token::Type::kOverride, source, "override"}; - if (str == "private") - return {Token::Type::kPrivate, source, "private"}; - if (str == "ptr") + } + if (str == "ptr") { return {Token::Type::kPtr, source, "ptr"}; - if (str == "return") + } + if (str == "return") { return {Token::Type::kReturn, source, "return"}; - if (str == "sampler") + } + if (str == "sampler") { return {Token::Type::kSampler, source, "sampler"}; - if (str == "sampler_comparison") + } + if (str == "sampler_comparison") { return {Token::Type::kComparisonSampler, source, "sampler_comparison"}; - if (str == "storage_buffer" || str == "storage") - return {Token::Type::kStorage, source, "storage"}; - if (str == "struct") + } + if (str == "static_assert") { + return {Token::Type::kStaticAssert, source, "static_assert"}; + } + if (str == "struct") { return {Token::Type::kStruct, source, "struct"}; - if (str == "switch") + } + if (str == "switch") { return {Token::Type::kSwitch, source, "switch"}; - if (str == "texture_1d") + } + if (str == "texture_1d") { return {Token::Type::kTextureSampled1d, source, "texture_1d"}; - if (str == "texture_2d") + } + if (str == "texture_2d") { return {Token::Type::kTextureSampled2d, source, "texture_2d"}; - if (str == "texture_2d_array") + } + if (str == "texture_2d_array") { return {Token::Type::kTextureSampled2dArray, source, "texture_2d_array"}; - if (str == "texture_3d") + } + if (str == "texture_3d") { return {Token::Type::kTextureSampled3d, source, "texture_3d"}; - if (str == "texture_cube") + } + if (str == "texture_cube") { return {Token::Type::kTextureSampledCube, source, "texture_cube"}; + } if (str == "texture_cube_array") { return {Token::Type::kTextureSampledCubeArray, source, "texture_cube_array"}; } - if (str == "texture_depth_2d") + if (str == "texture_depth_2d") { return {Token::Type::kTextureDepth2d, source, "texture_depth_2d"}; + } if (str == "texture_depth_2d_array") { return {Token::Type::kTextureDepth2dArray, source, "texture_depth_2d_array"}; } - if (str == "texture_depth_cube") + if (str == "texture_depth_cube") { return {Token::Type::kTextureDepthCube, source, "texture_depth_cube"}; + } if (str == "texture_depth_cube_array") { return {Token::Type::kTextureDepthCubeArray, source, "texture_depth_cube_array"}; } @@ -1140,24 +1303,30 @@ Token Lexer::check_keyword(const Source& source, std::string_view str) { if (str == "texture_storage_3d") { return {Token::Type::kTextureStorage3d, source, "texture_storage_3d"}; } - if (str == "true") + if (str == "true") { return {Token::Type::kTrue, source, "true"}; - if (str == "type") + } + if (str == "type") { return {Token::Type::kType, source, "type"}; - if (str == "u32") + } + if (str == "u32") { return {Token::Type::kU32, source, "u32"}; - if (str == "uniform") - return {Token::Type::kUniform, source, "uniform"}; - if (str == "var") + } + if (str == "var") { return {Token::Type::kVar, source, "var"}; - if (str == "vec2") + } + if (str == "vec2") { return {Token::Type::kVec2, source, "vec2"}; - if (str == "vec3") + } + if (str == "vec3") { return {Token::Type::kVec3, source, "vec3"}; - if (str == "vec4") + } + if (str == "vec4") { return {Token::Type::kVec4, source, "vec4"}; - if (str == "workgroup") - return {Token::Type::kWorkgroup, source, "workgroup"}; + } + if (str == "while") { + return {Token::Type::kWhile, source, "while"}; + } return {}; } diff --git a/src/tint/reader/wgsl/lexer.h b/src/tint/reader/wgsl/lexer.h index 11ac9cf1d2..8e0306b6a8 100644 --- a/src/tint/reader/wgsl/lexer.h +++ b/src/tint/reader/wgsl/lexer.h @@ -16,6 +16,7 @@ #define SRC_TINT_READER_WGSL_LEXER_H_ #include +#include #include "src/tint/reader/wgsl/token.h" @@ -29,11 +30,14 @@ class Lexer { explicit Lexer(const Source::File* file); ~Lexer(); + /// @return the token list. + std::vector Lex(); + + private: /// Returns the next token in the input stream. /// @return Token Token next(); - private: /// Advances past blankspace and comments, if present at the current position. /// @returns error token, EOF, or uninitialized Token skip_blankspace_and_comments(); @@ -43,7 +47,8 @@ class Lexer { /// @returns uninitialized token on success, or error Token skip_comment(); - Token build_token_from_int_if_possible(Source source, size_t start, size_t end, int32_t base); + Token build_token_from_int_if_possible(Source source, size_t start, int32_t base); + Token check_keyword(const Source&, std::string_view); /// The try_* methods have the following in common: @@ -95,7 +100,8 @@ class Lexer { bool is_hex(char ch) const; /// @returns true if string at `pos` matches `substr` bool matches(size_t pos, std::string_view substr); - + /// @returns true if char at `pos` matches `ch` + bool matches(size_t pos, char ch); /// The source file content Source::File const* const file_; /// The current location within the input diff --git a/src/tint/reader/wgsl/lexer_test.cc b/src/tint/reader/wgsl/lexer_test.cc index 6bcea15fc8..3268eaf836 100644 --- a/src/tint/reader/wgsl/lexer_test.cc +++ b/src/tint/reader/wgsl/lexer_test.cc @@ -15,8 +15,11 @@ #include "src/tint/reader/wgsl/lexer.h" #include +#include +#include #include "gtest/gtest.h" +#include "src/tint/number.h" namespace tint::reader::wgsl { namespace { @@ -43,24 +46,33 @@ using LexerTest = testing::Test; TEST_F(LexerTest, Empty) { Source::File file("", ""); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsEof()); + + auto list = l.Lex(); + ASSERT_EQ(1u, list.size()); + EXPECT_TRUE(list[0].IsEof()); } TEST_F(LexerTest, Skips_Blankspace_Basic) { Source::File file("", "\t\r\n\t ident\t\n\t \r "); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 2u); - EXPECT_EQ(t.source().range.begin.column, 6u); - EXPECT_EQ(t.source().range.end.line, 2u); - EXPECT_EQ(t.source().range.end.column, 11u); - EXPECT_EQ(t.to_str(), "ident"); + auto list = l.Lex(); + ASSERT_EQ(2u, list.size()); - t = l.next(); - EXPECT_TRUE(t.IsEof()); + { + auto& t = list[0]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 2u); + EXPECT_EQ(t.source().range.begin.column, 6u); + EXPECT_EQ(t.source().range.end.line, 2u); + EXPECT_EQ(t.source().range.end.column, 11u); + EXPECT_EQ(t.to_str(), "ident"); + } + + { + auto& t = list[1]; + EXPECT_TRUE(t.IsEof()); + } } TEST_F(LexerTest, Skips_Blankspace_Exotic) { @@ -70,16 +82,23 @@ TEST_F(LexerTest, Skips_Blankspace_Exotic) { kVTab kFF kNL kLS kPS kL2R kR2L); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 6u); - EXPECT_EQ(t.source().range.begin.column, 7u); - EXPECT_EQ(t.source().range.end.line, 6u); - EXPECT_EQ(t.source().range.end.column, 12u); - EXPECT_EQ(t.to_str(), "ident"); + auto list = l.Lex(); + ASSERT_EQ(2u, list.size()); - t = l.next(); - EXPECT_TRUE(t.IsEof()); + { + auto& t = list[0]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 6u); + EXPECT_EQ(t.source().range.begin.column, 7u); + EXPECT_EQ(t.source().range.end.line, 6u); + EXPECT_EQ(t.source().range.end.column, 12u); + EXPECT_EQ(t.to_str(), "ident"); + } + + { + auto& t = list[1]; + EXPECT_TRUE(t.IsEof()); + } } TEST_F(LexerTest, Skips_Comments_Line) { @@ -89,24 +108,33 @@ ident1 //ends with comment ident2)"); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 2u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 2u); - EXPECT_EQ(t.source().range.end.column, 7u); - EXPECT_EQ(t.to_str(), "ident1"); + auto list = l.Lex(); + ASSERT_EQ(3u, list.size()); - t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 4u); - EXPECT_EQ(t.source().range.begin.column, 2u); - EXPECT_EQ(t.source().range.end.line, 4u); - EXPECT_EQ(t.source().range.end.column, 8u); - EXPECT_EQ(t.to_str(), "ident2"); + { + auto& t = list[0]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 2u); + EXPECT_EQ(t.source().range.begin.column, 1u); + EXPECT_EQ(t.source().range.end.line, 2u); + EXPECT_EQ(t.source().range.end.column, 7u); + EXPECT_EQ(t.to_str(), "ident1"); + } - t = l.next(); - EXPECT_TRUE(t.IsEof()); + { + auto& t = list[1]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 4u); + EXPECT_EQ(t.source().range.begin.column, 2u); + EXPECT_EQ(t.source().range.end.line, 4u); + EXPECT_EQ(t.source().range.end.column, 8u); + EXPECT_EQ(t.to_str(), "ident2"); + } + + { + auto& t = list[2]; + EXPECT_TRUE(t.IsEof()); + } } TEST_F(LexerTest, Skips_Comments_Unicode) { @@ -116,24 +144,33 @@ ident1 //ends with 🙂🙂🙂 ident2)"); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 2u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 2u); - EXPECT_EQ(t.source().range.end.column, 7u); - EXPECT_EQ(t.to_str(), "ident1"); + auto list = l.Lex(); + ASSERT_EQ(3u, list.size()); - t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 4u); - EXPECT_EQ(t.source().range.begin.column, 2u); - EXPECT_EQ(t.source().range.end.line, 4u); - EXPECT_EQ(t.source().range.end.column, 8u); - EXPECT_EQ(t.to_str(), "ident2"); + { + auto& t = list[0]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 2u); + EXPECT_EQ(t.source().range.begin.column, 1u); + EXPECT_EQ(t.source().range.end.line, 2u); + EXPECT_EQ(t.source().range.end.column, 7u); + EXPECT_EQ(t.to_str(), "ident1"); + } - t = l.next(); - EXPECT_TRUE(t.IsEof()); + { + auto& t = list[1]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 4u); + EXPECT_EQ(t.source().range.begin.column, 2u); + EXPECT_EQ(t.source().range.end.line, 4u); + EXPECT_EQ(t.source().range.end.column, 8u); + EXPECT_EQ(t.to_str(), "ident2"); + } + + { + auto& t = list[2]; + EXPECT_TRUE(t.IsEof()); + } } using LineCommentTerminatorTest = testing::TestWithParam; @@ -141,27 +178,35 @@ TEST_P(LineCommentTerminatorTest, Terminators) { // Test that line comments are ended by blankspace characters other than // space, horizontal tab, left-to-right mark, and right-to-left mark. auto* c = GetParam(); - std::string src = "let// This is a comment"; + std::string src = "const// This is a comment"; src += c; src += "ident"; Source::File file("", src); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.Is(Token::Type::kLet)); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 4u); - auto is_same_line = [](std::string_view v) { return v == kSpace || v == kHTab || v == kL2R || v == kR2L; }; + auto list = l.Lex(); + ASSERT_EQ(is_same_line(c) ? 2u : 3u, list.size()); + + size_t idx = 0; + + { + auto& t = list[idx++]; + EXPECT_TRUE(t.Is(Token::Type::kConst)); + EXPECT_EQ(t.source().range.begin.line, 1u); + EXPECT_EQ(t.source().range.begin.column, 1u); + EXPECT_EQ(t.source().range.end.line, 1u); + EXPECT_EQ(t.source().range.end.column, 6u); + } + if (!is_same_line(c)) { size_t line = is_same_line(c) ? 1u : 2u; size_t col = is_same_line(c) ? 25u : 1u; - t = l.next(); + + auto& t = list[idx++]; EXPECT_TRUE(t.IsIdentifier()); EXPECT_EQ(t.source().range.begin.line, line); EXPECT_EQ(t.source().range.begin.column, col); @@ -170,8 +215,10 @@ TEST_P(LineCommentTerminatorTest, Terminators) { EXPECT_EQ(t.to_str(), "ident"); } - t = l.next(); - EXPECT_TRUE(t.IsEof()); + { + auto& t = list[idx]; + EXPECT_TRUE(t.IsEof()); + } } INSTANTIATE_TEST_SUITE_P(LexerTest, LineCommentTerminatorTest, @@ -195,16 +242,23 @@ TEST_F(LexerTest, Skips_Comments_Block) { text */ident)"); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 2u); - EXPECT_EQ(t.source().range.begin.column, 8u); - EXPECT_EQ(t.source().range.end.line, 2u); - EXPECT_EQ(t.source().range.end.column, 13u); - EXPECT_EQ(t.to_str(), "ident"); + auto list = l.Lex(); + ASSERT_EQ(2u, list.size()); - t = l.next(); - EXPECT_TRUE(t.IsEof()); + { + auto& t = list[0]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 2u); + EXPECT_EQ(t.source().range.begin.column, 8u); + EXPECT_EQ(t.source().range.end.line, 2u); + EXPECT_EQ(t.source().range.end.column, 13u); + EXPECT_EQ(t.to_str(), "ident"); + } + + { + auto& t = list[1]; + EXPECT_TRUE(t.IsEof()); + } } TEST_F(LexerTest, Skips_Comments_Block_Nested) { @@ -213,16 +267,23 @@ text // nested line comments are ignored /* more text /////**/ */*/ident)"); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 3u); - EXPECT_EQ(t.source().range.begin.column, 14u); - EXPECT_EQ(t.source().range.end.line, 3u); - EXPECT_EQ(t.source().range.end.column, 19u); - EXPECT_EQ(t.to_str(), "ident"); + auto list = l.Lex(); + ASSERT_EQ(2u, list.size()); - t = l.next(); - EXPECT_TRUE(t.IsEof()); + { + auto& t = list[0]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 3u); + EXPECT_EQ(t.source().range.begin.column, 14u); + EXPECT_EQ(t.source().range.end.line, 3u); + EXPECT_EQ(t.source().range.end.column, 19u); + EXPECT_EQ(t.to_str(), "ident"); + } + + { + auto& t = list[1]; + EXPECT_TRUE(t.IsEof()); + } } TEST_F(LexerTest, Skips_Comments_Block_Unterminated) { @@ -234,7 +295,10 @@ TEST_F(LexerTest, Skips_Comments_Block_Unterminated) { abcd)"); Lexer l(&file); - auto t = l.next(); + auto list = l.Lex(); + ASSERT_EQ(1u, list.size()); + + auto& t = list[0]; ASSERT_TRUE(t.Is(Token::Type::kError)); EXPECT_EQ(t.to_str(), "unterminated block comment"); EXPECT_EQ(t.source().range.begin.line, 2u); @@ -247,7 +311,10 @@ TEST_F(LexerTest, Null_InBlankspace_IsError) { Source::File file("", std::string{' ', 0, ' '}); Lexer l(&file); - auto t = l.next(); + auto list = l.Lex(); + ASSERT_EQ(1u, list.size()); + + auto& t = list[0]; EXPECT_TRUE(t.IsError()); EXPECT_EQ(t.source().range.begin.line, 1u); EXPECT_EQ(t.source().range.begin.column, 2u); @@ -260,7 +327,10 @@ TEST_F(LexerTest, Null_InLineComment_IsError) { Source::File file("", std::string{'/', '/', ' ', 0, ' '}); Lexer l(&file); - auto t = l.next(); + auto list = l.Lex(); + ASSERT_EQ(1u, list.size()); + + auto& t = list[0]; EXPECT_TRUE(t.IsError()); EXPECT_EQ(t.source().range.begin.line, 1u); EXPECT_EQ(t.source().range.begin.column, 4u); @@ -273,7 +343,10 @@ TEST_F(LexerTest, Null_InBlockComment_IsError) { Source::File file("", std::string{'/', '*', ' ', 0, '*', '/'}); Lexer l(&file); - auto t = l.next(); + auto list = l.Lex(); + ASSERT_EQ(1u, list.size()); + + auto& t = list[0]; EXPECT_TRUE(t.IsError()); EXPECT_EQ(t.source().range.begin.line, 1u); EXPECT_EQ(t.source().range.begin.column, 4u); @@ -289,21 +362,29 @@ TEST_F(LexerTest, Null_InIdentifier_IsError) { Source::File file("", std::string{'a', 0, 'c'}); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.to_str(), "a"); - t = l.next(); - EXPECT_TRUE(t.IsError()); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 2u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 2u); - EXPECT_EQ(t.to_str(), "null character found"); + auto list = l.Lex(); + ASSERT_EQ(2u, list.size()); + + { + auto& t = list[0]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.to_str(), "a"); + } + + { + auto& t = list[1]; + EXPECT_TRUE(t.IsError()); + EXPECT_EQ(t.source().range.begin.line, 1u); + EXPECT_EQ(t.source().range.begin.column, 2u); + EXPECT_EQ(t.source().range.end.line, 1u); + EXPECT_EQ(t.source().range.end.column, 2u); + EXPECT_EQ(t.to_str(), "null character found"); + } } struct FloatData { const char* input; - float result; + double result; }; inline std::ostream& operator<<(std::ostream& out, FloatData data) { out << std::string(data.input); @@ -315,86 +396,138 @@ TEST_P(FloatTest, Parse) { Source::File file("", params.input); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.Is(Token::Type::kFloatLiteral)); - EXPECT_EQ(t.to_f32(), params.result); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); + auto list = l.Lex(); + ASSERT_EQ(2u, list.size()); - t = l.next(); - EXPECT_TRUE(t.IsEof()); + { + auto& t = list[0]; + if (std::string(params.input).back() == 'f') { + EXPECT_TRUE(t.Is(Token::Type::kFloatLiteral_F)); + } else if (std::string(params.input).back() == 'h') { + EXPECT_TRUE(t.Is(Token::Type::kFloatLiteral_H)); + } else { + EXPECT_TRUE(t.Is(Token::Type::kFloatLiteral)); + } + EXPECT_EQ(t.to_f64(), params.result); + EXPECT_EQ(t.source().range.begin.line, 1u); + EXPECT_EQ(t.source().range.begin.column, 1u); + EXPECT_EQ(t.source().range.end.line, 1u); + EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); + } + + { + auto& t = list[1]; + EXPECT_TRUE(t.IsEof()); + } } INSTANTIATE_TEST_SUITE_P(LexerTest, FloatTest, testing::Values( // No decimal, with 'f' suffix - FloatData{"0f", 0.0f}, - FloatData{"1f", 1.0f}, - FloatData{"-0f", 0.0f}, - FloatData{"-1f", -1.0f}, + FloatData{"0f", 0.0}, + FloatData{"1f", 1.0}, + FloatData{"-0f", 0.0}, + FloatData{"-1f", -1.0}, + // No decimal, with 'h' suffix + FloatData{"0h", 0.0}, + FloatData{"1h", 1.0}, + FloatData{"-0h", 0.0}, + FloatData{"-1h", -1.0}, // Zero, with decimal. - FloatData{"0.0", 0.0f}, - FloatData{"0.", 0.0f}, - FloatData{".0", 0.0f}, - FloatData{"-0.0", 0.0f}, - FloatData{"-0.", 0.0f}, - FloatData{"-.0", 0.0f}, + FloatData{"0.0", 0.0}, + FloatData{"0.", 0.0}, + FloatData{".0", 0.0}, + FloatData{"-0.0", 0.0}, + FloatData{"-0.", 0.0}, + FloatData{"-.0", 0.0}, // Zero, with decimal and 'f' suffix - FloatData{"0.0f", 0.0f}, - FloatData{"0.f", 0.0f}, - FloatData{".0f", 0.0f}, - FloatData{"-0.0f", 0.0f}, - FloatData{"-0.f", 0.0f}, - FloatData{"-.0", 0.0f}, + FloatData{"0.0f", 0.0}, + FloatData{"0.f", 0.0}, + FloatData{".0f", 0.0}, + FloatData{"-0.0f", 0.0}, + FloatData{"-0.f", 0.0}, + FloatData{"-.0f", 0.0}, + // Zero, with decimal and 'h' suffix + FloatData{"0.0h", 0.0}, + FloatData{"0.h", 0.0}, + FloatData{".0h", 0.0}, + FloatData{"-0.0h", 0.0}, + FloatData{"-0.h", 0.0}, + FloatData{"-.0h", 0.0}, // Non-zero with decimal - FloatData{"5.7", 5.7f}, - FloatData{"5.", 5.f}, - FloatData{".7", .7f}, - FloatData{"-5.7", -5.7f}, - FloatData{"-5.", -5.f}, - FloatData{"-.7", -.7f}, + FloatData{"5.7", 5.7}, + FloatData{"5.", 5.}, + FloatData{".7", .7}, + FloatData{"-5.7", -5.7}, + FloatData{"-5.", -5.}, + FloatData{"-.7", -.7}, // Non-zero with decimal and 'f' suffix - FloatData{"5.7f", 5.7f}, - FloatData{"5.f", 5.f}, - FloatData{".7f", .7f}, - FloatData{"-5.7f", -5.7f}, - FloatData{"-5.f", -5.f}, - FloatData{"-.7f", -.7f}, + FloatData{"5.7f", static_cast(5.7f)}, + FloatData{"5.f", static_cast(5.f)}, + FloatData{".7f", static_cast(.7f)}, + FloatData{"-5.7f", static_cast(-5.7f)}, + FloatData{"-5.f", static_cast(-5.f)}, + FloatData{"-.7f", static_cast(-.7f)}, + // Non-zero with decimal and 'h' suffix + FloatData{"5.7h", static_cast(f16::Quantize(5.7f))}, + FloatData{"5.h", static_cast(f16::Quantize(5.f))}, + FloatData{".7h", static_cast(f16::Quantize(.7f))}, + FloatData{"-5.7h", static_cast(f16::Quantize(-5.7f))}, + FloatData{"-5.h", static_cast(f16::Quantize(-5.f))}, + FloatData{"-.7h", static_cast(f16::Quantize(-.7f))}, // No decimal, with exponent - FloatData{"1e5", 1e5f}, - FloatData{"1E5", 1e5f}, - FloatData{"1e-5", 1e-5f}, - FloatData{"1E-5", 1e-5f}, + FloatData{"1e5", 1e5}, + FloatData{"1E5", 1e5}, + FloatData{"1e-5", 1e-5}, + FloatData{"1E-5", 1e-5}, // No decimal, with exponent and 'f' suffix - FloatData{"1e5f", 1e5f}, - FloatData{"1E5f", 1e5f}, - FloatData{"1e-5f", 1e-5f}, - FloatData{"1E-5f", 1e-5f}, + FloatData{"1e5f", static_cast(1e5f)}, + FloatData{"1E5f", static_cast(1e5f)}, + FloatData{"1e-5f", static_cast(1e-5f)}, + FloatData{"1E-5f", static_cast(1e-5f)}, + // No decimal, with exponent and 'h' suffix + FloatData{"6e4h", static_cast(f16::Quantize(6e4f))}, + FloatData{"6E4h", static_cast(f16::Quantize(6e4f))}, + FloatData{"1e-5h", static_cast(f16::Quantize(1e-5f))}, + FloatData{"1E-5h", static_cast(f16::Quantize(1e-5f))}, // With decimal and exponents - FloatData{"0.2e+12", 0.2e12f}, - FloatData{"1.2e-5", 1.2e-5f}, - FloatData{"2.57e23", 2.57e23f}, - FloatData{"2.5e+0", 2.5f}, - FloatData{"2.5e-0", 2.5f}, + FloatData{"0.2e+12", 0.2e12}, + FloatData{"1.2e-5", 1.2e-5}, + FloatData{"2.57e23", 2.57e23}, + FloatData{"2.5e+0", 2.5}, + FloatData{"2.5e-0", 2.5}, // With decimal and exponents and 'f' suffix - FloatData{"0.2e+12f", 0.2e12f}, - FloatData{"1.2e-5f", 1.2e-5f}, - FloatData{"2.57e23f", 2.57e23f}, - FloatData{"2.5e+0f", 2.5f}, - FloatData{"2.5e-0f", 2.5f})); + FloatData{"0.2e+12f", static_cast(0.2e12f)}, + FloatData{"1.2e-5f", static_cast(1.2e-5f)}, + FloatData{"2.57e23f", static_cast(2.57e23f)}, + FloatData{"2.5e+0f", static_cast(2.5f)}, + FloatData{"2.5e-0f", static_cast(2.5f)}, + // With decimal and exponents and 'h' suffix + FloatData{"0.2e+5h", static_cast(f16::Quantize(0.2e5f))}, + FloatData{"1.2e-5h", static_cast(f16::Quantize(1.2e-5f))}, + FloatData{"6.55e4h", static_cast(f16::Quantize(6.55e4f))}, + FloatData{"2.5e+0h", static_cast(f16::Quantize(2.5f))}, + FloatData{"2.5e-0h", static_cast(f16::Quantize(2.5f))}, + // Quantization + FloatData{"3.141592653589793", 3.141592653589793}, // no quantization + FloatData{"3.141592653589793f", 3.1415927410125732}, // f32 quantized + FloatData{"3.141592653589793h", 3.140625} // f16 quantized + )); using FloatTest_Invalid = testing::TestWithParam; TEST_P(FloatTest_Invalid, Handles) { Source::File file("", GetParam()); Lexer l(&file); - auto t = l.next(); - EXPECT_FALSE(t.Is(Token::Type::kFloatLiteral)); + auto list = l.Lex(); + ASSERT_FALSE(list.empty()); + + auto& t = list[0]; + EXPECT_FALSE(t.Is(Token::Type::kFloatLiteral) || t.Is(Token::Type::kFloatLiteral_F) || + t.Is(Token::Type::kFloatLiteral_H)); } INSTANTIATE_TEST_SUITE_P(LexerTest, FloatTest_Invalid, @@ -411,11 +544,10 @@ INSTANTIATE_TEST_SUITE_P(LexerTest, ".e+", ".e-", // Overflow - "2.5e+256", - "-2.5e+127", - // Magnitude smaller than smallest positive f32. - "2.5e-300", - "-2.5e-300", + "2.5e+256f", + "-2.5e+127f", + "6.5520e+4h", + "-6.5e+12h", // Decimal exponent must immediately // follow the 'e'. "2.5e 12", @@ -434,13 +566,23 @@ TEST_P(AsciiIdentifierTest, Parse) { Source::File file("", GetParam()); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 1u + strlen(GetParam())); - EXPECT_EQ(t.to_str(), GetParam()); + auto list = l.Lex(); + ASSERT_EQ(2u, list.size()); + + { + auto& t = list[0]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 1u); + EXPECT_EQ(t.source().range.begin.column, 1u); + EXPECT_EQ(t.source().range.end.line, 1u); + EXPECT_EQ(t.source().range.end.column, 1u + strlen(GetParam())); + EXPECT_EQ(t.to_str(), GetParam()); + } + + { + auto& t = list[1]; + EXPECT_TRUE(t.IsEof()); + } } INSTANTIATE_TEST_SUITE_P(LexerTest, AsciiIdentifierTest, @@ -466,13 +608,23 @@ TEST_P(ValidUnicodeIdentifierTest, Parse) { Source::File file("", GetParam().utf8); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 1u + GetParam().count); - EXPECT_EQ(t.to_str(), GetParam().utf8); + auto list = l.Lex(); + ASSERT_EQ(2u, list.size()); + + { + auto& t = list[0]; + EXPECT_TRUE(t.IsIdentifier()); + EXPECT_EQ(t.source().range.begin.line, 1u); + EXPECT_EQ(t.source().range.begin.column, 1u); + EXPECT_EQ(t.source().range.end.line, 1u); + EXPECT_EQ(t.source().range.end.column, 1u + GetParam().count); + EXPECT_EQ(t.to_str(), GetParam().utf8); + } + + { + auto& t = list[1]; + EXPECT_TRUE(t.IsEof()); + } } INSTANTIATE_TEST_SUITE_P( LexerTest, @@ -510,7 +662,10 @@ TEST_P(InvalidUnicodeIdentifierTest, Parse) { Source::File file("", GetParam()); Lexer l(&file); - auto t = l.next(); + auto list = l.Lex(); + ASSERT_FALSE(list.empty()); + + auto& t = list[0]; EXPECT_TRUE(t.IsError()); EXPECT_EQ(t.source().range.begin.line, 1u); EXPECT_EQ(t.source().range.begin.column, 1u); @@ -558,7 +713,10 @@ TEST_F(LexerTest, IdentifierTest_SingleUnderscoreDoesNotMatch) { Source::File file("", "_"); Lexer l(&file); - auto t = l.next(); + auto list = l.Lex(); + ASSERT_FALSE(list.empty()); + + auto& t = list[0]; EXPECT_FALSE(t.IsIdentifier()); } @@ -566,7 +724,10 @@ TEST_F(LexerTest, IdentifierTest_DoesNotStartWithDoubleUnderscore) { Source::File file("", "__test"); Lexer l(&file); - auto t = l.next(); + auto list = l.Lex(); + ASSERT_FALSE(list.empty()); + + auto& t = list[0]; EXPECT_FALSE(t.IsIdentifier()); } @@ -574,274 +735,245 @@ TEST_F(LexerTest, IdentifierTest_DoesNotStartWithNumber) { Source::File file("", "01test"); Lexer l(&file); - auto t = l.next(); + auto list = l.Lex(); + EXPECT_FALSE(list.empty()); + + auto& t = list[0]; EXPECT_FALSE(t.IsIdentifier()); } -struct HexSignedIntData { +//////////////////////////////////////////////////////////////////////////////// +// ParseIntegerTest +//////////////////////////////////////////////////////////////////////////////// +struct ParseIntegerCase { const char* input; - int32_t result; + int64_t result; }; -inline std::ostream& operator<<(std::ostream& out, HexSignedIntData data) { + +inline std::ostream& operator<<(std::ostream& out, ParseIntegerCase data) { out << std::string(data.input); return out; } -using IntegerTest_HexSigned = testing::TestWithParam; -TEST_P(IntegerTest_HexSigned, NoSuffix) { - auto params = GetParam(); +using ParseIntegerTest = testing::TestWithParam>; +TEST_P(ParseIntegerTest, Parse) { + auto suffix = std::get<0>(GetParam()); + auto params = std::get<1>(GetParam()); Source::File file("", params.input); + Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.Is(Token::Type::kIntLiteral)); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); - EXPECT_EQ(t.to_i64(), params.result); -} -TEST_P(IntegerTest_HexSigned, ISuffix) { - auto params = GetParam(); - Source::File file("", std::string(params.input) + "i"); - Lexer l(&file); + auto list = l.Lex(); + ASSERT_FALSE(list.empty()); - auto t = l.next(); - EXPECT_TRUE(t.Is(Token::Type::kIntILiteral)); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 2u + strlen(params.input)); - EXPECT_EQ(t.to_i64(), params.result); -} -INSTANTIATE_TEST_SUITE_P( - LexerTest, - IntegerTest_HexSigned, - testing::Values(HexSignedIntData{"0x0", 0}, - HexSignedIntData{"0X0", 0}, - HexSignedIntData{"0x42", 66}, - HexSignedIntData{"0X42", 66}, - HexSignedIntData{"-0x42", -66}, - HexSignedIntData{"-0X42", -66}, - HexSignedIntData{"0xeF1Abc9", 250719177}, - HexSignedIntData{"0XeF1Abc9", 250719177}, - HexSignedIntData{"-0x80000000", std::numeric_limits::min()}, - HexSignedIntData{"-0X80000000", std::numeric_limits::min()}, - HexSignedIntData{"0x7FFFFFFF", std::numeric_limits::max()}, - HexSignedIntData{"0X7FFFFFFF", std::numeric_limits::max()})); - -TEST_F(LexerTest, HexPrefixOnly_IsError) { - // Could be the start of a hex integer or hex float, but is neither. - Source::File file("", "0x"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "integer or float hex literal has no significant digits"); -} - -TEST_F(LexerTest, HexPrefixUpperCaseOnly_IsError) { - // Could be the start of a hex integer or hex float, but is neither. - Source::File file("", "0X"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "integer or float hex literal has no significant digits"); -} - -TEST_F(LexerTest, NegativeHexPrefixOnly_IsError) { - // Could be the start of a hex integer or hex float, but is neither. - Source::File file("", "-0x"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "integer or float hex literal has no significant digits"); -} - -TEST_F(LexerTest, NegativeHexPrefixUpperCaseOnly_IsError) { - // Could be the start of a hex integer or hex float, but is neither. - Source::File file("", "-0X"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "integer or float hex literal has no significant digits"); -} - -TEST_F(LexerTest, IntegerTest_HexSignedTooLarge) { - Source::File file("", "0x80000000"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "0x80000000 too large for i32"); -} - -TEST_F(LexerTest, IntegerTest_HexSignedTooSmall) { - Source::File file("", "-0x8000000F"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "-0x8000000F too small for i32"); -} - -TEST_F(LexerTest, IntegerTest_HexSignedTooManyDigits) { - { - Source::File file("", "-0x100000000000000000000000"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "integer literal (-0x10000000...) has too many digits"); + auto& t = list[0]; + switch (suffix) { + case 'i': + EXPECT_TRUE(t.Is(Token::Type::kIntLiteral_I)); + break; + case 'u': + EXPECT_TRUE(t.Is(Token::Type::kIntLiteral_U)); + break; + case 0: + EXPECT_TRUE(t.Is(Token::Type::kIntLiteral)); + break; } - { - Source::File file("", "0x100000000000000"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "integer literal (0x10000000...) has too many digits"); - } -} - -struct HexUnsignedIntData { - const char* input; - uint32_t result; -}; -inline std::ostream& operator<<(std::ostream& out, HexUnsignedIntData data) { - out << std::string(data.input); - return out; -} -using IntegerTest_HexUnsigned = testing::TestWithParam; -// TODO(crbug.com/tint/1504): Split into NoSuffix and USuffix -TEST_P(IntegerTest_HexUnsigned, Matches) { - auto params = GetParam(); - Source::File file("", params.input); - Lexer l(&file); - - auto t = l.next(); - EXPECT_TRUE(t.Is(Token::Type::kIntULiteral)); EXPECT_EQ(t.source().range.begin.line, 1u); EXPECT_EQ(t.source().range.begin.column, 1u); EXPECT_EQ(t.source().range.end.line, 1u); EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); + ASSERT_FALSE(t.IsError()) << t.to_str(); EXPECT_EQ(t.to_i64(), params.result); - - t = l.next(); - EXPECT_TRUE(t.IsEof()); } -INSTANTIATE_TEST_SUITE_P( - LexerTest, - IntegerTest_HexUnsigned, - testing::Values(HexUnsignedIntData{"0x0u", 0}, - HexUnsignedIntData{"0x42u", 66}, - HexUnsignedIntData{"0xeF1Abc9u", 250719177}, - HexUnsignedIntData{"0x0u", std::numeric_limits::min()}, - HexUnsignedIntData{"0xFFFFFFFFu", std::numeric_limits::max()})); -TEST_F(LexerTest, IntegerTest_HexUnsignedTooManyDigits) { - Source::File file("", "0x1000000000000000000000u"); +INSTANTIATE_TEST_SUITE_P(Dec_AInt, + ParseIntegerTest, + testing::Combine(testing::Values('\0'), // No suffix + testing::ValuesIn(std::vector{ + {"0", 0}, + {"-2", -2}, + {"2", 2}, + {"123", 123}, + {"2147483647", 2147483647}, + {"-2147483648", -2147483648LL}, + {"-9223372036854775808", -9223372036854775807LL - 1}, + }))); + +INSTANTIATE_TEST_SUITE_P(Dec_u32, + ParseIntegerTest, + testing::Combine(testing::Values('u'), // Suffix + testing::ValuesIn(std::vector{ + {"0u", 0}, + {"123u", 123}, + {"4294967295u", 4294967295ll}, + }))); + +INSTANTIATE_TEST_SUITE_P(Dec_i32, + ParseIntegerTest, + testing::Combine(testing::Values('i'), // Suffix + testing::ValuesIn(std::vector{ + {"0i", 0u}, + {"-0i", 0u}, + {"123i", 123}, + {"-123i", -123}, + {"2147483647i", 2147483647}, + {"-2147483647i", -2147483647ll}, + }))); + +INSTANTIATE_TEST_SUITE_P(Hex_AInt, + ParseIntegerTest, + testing::Combine(testing::Values('\0'), // No suffix + testing::ValuesIn(std::vector{ + {"0x0", 0}, + {"0X0", 0}, + {"0x42", 66}, + {"0X42", 66}, + {"-0x42", -66}, + {"-0X42", -66}, + {"0xeF1Abc9", 0xeF1Abc9}, + {"0XeF1Abc9", 0xeF1Abc9}, + {"-0xeF1Abc9", -0xeF1Abc9}, + {"-0XeF1Abc9", -0xeF1Abc9}, + {"0x80000000", 0x80000000}, + {"0X80000000", 0X80000000}, + {"-0x80000000", -0x80000000ll}, + {"-0X80000000", -0X80000000ll}, + {"0x7FFFFFFF", 0x7fffffff}, + {"0X7FFFFFFF", 0x7fffffff}, + {"0x7fffffff", 0x7fffffff}, + {"0x7fffffff", 0x7fffffff}, + {"0x7FfFfFfF", 0x7fffffff}, + {"0X7FfFfFfF", 0x7fffffff}, + {"0x7fffffffffffffff", 0x7fffffffffffffffll}, + {"-0x7fffffffffffffff", -0x7fffffffffffffffll}, + }))); + +INSTANTIATE_TEST_SUITE_P(Hex_u32, + ParseIntegerTest, + testing::Combine(testing::Values('u'), // Suffix + testing::ValuesIn(std::vector{ + {"0x0u", 0}, + {"0x42u", 66}, + {"0xeF1Abc9u", 250719177}, + {"0xFFFFFFFFu", 0xffffffff}, + {"0XFFFFFFFFu", 0xffffffff}, + {"0xffffffffu", 0xffffffff}, + {"0Xffffffffu", 0xffffffff}, + {"0xfFfFfFfFu", 0xffffffff}, + {"0XfFfFfFfFu", 0xffffffff}, + }))); + +INSTANTIATE_TEST_SUITE_P(Hex_i32, + ParseIntegerTest, + testing::Combine(testing::Values('i'), // Suffix + testing::ValuesIn(std::vector{ + {"0x0i", 0}, + {"0x42i", 66}, + {"-0x0i", 0}, + {"-0x42i", -66}, + {"0xeF1Abc9i", 250719177}, + {"-0xeF1Abc9i", -250719177}, + {"0x7FFFFFFFi", 0x7fffffff}, + {"-0x7FFFFFFFi", -0x7fffffff}, + {"0X7FFFFFFFi", 0x7fffffff}, + {"-0X7FFFFFFFi", -0x7fffffff}, + {"0x7fffffffi", 0x7fffffff}, + {"-0x7fffffffi", -0x7fffffff}, + {"0X7fffffffi", 0x7fffffff}, + {"-0X7fffffffi", -0x7fffffff}, + {"0x7FfFfFfFi", 0x7fffffff}, + {"-0x7FfFfFfFi", -0x7fffffff}, + {"0X7FfFfFfFi", 0x7fffffff}, + {"-0X7FfFfFfFi", -0x7fffffff}, + }))); +//////////////////////////////////////////////////////////////////////////////// +// ParseIntegerTest_CannotBeRepresented +//////////////////////////////////////////////////////////////////////////////// +using ParseIntegerTest_CannotBeRepresented = + testing::TestWithParam>; +TEST_P(ParseIntegerTest_CannotBeRepresented, Parse) { + auto type = std::get<0>(GetParam()); + auto source = std::get<1>(GetParam()); + Source::File file("", source); + Lexer l(&file); + auto list = l.Lex(); + ASSERT_FALSE(list.empty()); - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "integer literal (0x10000000...) has too many digits"); + auto& t = list[0]; + EXPECT_TRUE(t.Is(Token::Type::kError)); + auto expect = "value cannot be represented as '" + std::string(type) + "'"; + EXPECT_EQ(t.to_str(), expect); } +INSTANTIATE_TEST_SUITE_P(AbstractInt, + ParseIntegerTest_CannotBeRepresented, + testing::Combine(testing::Values("abstract-int"), + testing::Values("9223372036854775808", + "0xFFFFFFFFFFFFFFFF", + "0xffffffffffffffff", + "0x8000000000000000"))); -struct UnsignedIntData { - const char* input; - uint32_t result; -}; -inline std::ostream& operator<<(std::ostream& out, UnsignedIntData data) { - out << std::string(data.input); - return out; -} -using IntegerTest_Unsigned = testing::TestWithParam; -TEST_P(IntegerTest_Unsigned, Matches) { - auto params = GetParam(); - Source::File file("", params.input); - Lexer l(&file); +INSTANTIATE_TEST_SUITE_P(i32, + ParseIntegerTest_CannotBeRepresented, + testing::Combine(testing::Values("i32"), // type + testing::Values("2147483648i"))); - auto t = l.next(); - EXPECT_TRUE(t.Is(Token::Type::kIntULiteral)); - EXPECT_EQ(t.to_i64(), params.result); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); -} -INSTANTIATE_TEST_SUITE_P(LexerTest, - IntegerTest_Unsigned, - testing::Values(UnsignedIntData{"0u", 0u}, - UnsignedIntData{"123u", 123u}, - UnsignedIntData{"4294967295u", 4294967295u})); +INSTANTIATE_TEST_SUITE_P(u32, + ParseIntegerTest_CannotBeRepresented, + testing::Combine(testing::Values("u32"), // type + testing::Values("4294967296u", // + "-1u"))); -TEST_F(LexerTest, IntegerTest_UnsignedTooManyDigits) { - Source::File file("", "10000000000000000000000u"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "integer literal (1000000000...) has too many digits"); -} - -struct SignedIntData { - const char* input; - int32_t result; -}; -inline std::ostream& operator<<(std::ostream& out, SignedIntData data) { - out << std::string(data.input); - return out; -} -using IntegerTest_Signed = testing::TestWithParam; -TEST_P(IntegerTest_Signed, Matches) { - auto params = GetParam(); - Source::File file("", params.input); - Lexer l(&file); - - auto t = l.next(); - EXPECT_TRUE(t.Is(Token::Type::kIntLiteral)); - EXPECT_EQ(t.to_i64(), params.result); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); -} -INSTANTIATE_TEST_SUITE_P(LexerTest, - IntegerTest_Signed, - testing::Values(SignedIntData{"0", 0}, - SignedIntData{"-2", -2}, - SignedIntData{"2", 2}, - SignedIntData{"123", 123}, - SignedIntData{"2147483647", 2147483647}, - SignedIntData{"-2147483648", -2147483648LL})); - -TEST_F(LexerTest, IntegerTest_SignedTooManyDigits) { - Source::File file("", "-10000000000000000"); - Lexer l(&file); - - auto t = l.next(); - ASSERT_TRUE(t.Is(Token::Type::kError)); - EXPECT_EQ(t.to_str(), "integer literal (-1000000000...) has too many digits"); -} - -using IntegerTest_Invalid = testing::TestWithParam; -TEST_P(IntegerTest_Invalid, Parses) { +//////////////////////////////////////////////////////////////////////////////// +// ParseIntegerTest_LeadingZeros +//////////////////////////////////////////////////////////////////////////////// +using ParseIntegerTest_LeadingZeros = testing::TestWithParam; +TEST_P(ParseIntegerTest_LeadingZeros, Parse) { Source::File file("", GetParam()); - Lexer l(&file); - auto t = l.next(); - EXPECT_FALSE(t.Is(Token::Type::kIntLiteral)); - EXPECT_FALSE(t.Is(Token::Type::kIntULiteral)); - EXPECT_FALSE(t.Is(Token::Type::kIntILiteral)); + Lexer l(&file); + auto list = l.Lex(); + ASSERT_FALSE(list.empty()); + + auto& t = list[0]; + EXPECT_TRUE(t.Is(Token::Type::kError)); + EXPECT_EQ(t.to_str(), "integer literal cannot have leading 0s"); } -INSTANTIATE_TEST_SUITE_P( - LexerTest, - IntegerTest_Invalid, - testing::Values("2147483648", "4294967296u", "01234", "0000", "-00", "00u")); + +INSTANTIATE_TEST_SUITE_P(LeadingZero, + ParseIntegerTest_LeadingZeros, + testing::Values("01234", "0000", "-00", "00u")); + +//////////////////////////////////////////////////////////////////////////////// +// ParseIntegerTest_NoSignificantDigits +//////////////////////////////////////////////////////////////////////////////// +using ParseIntegerTest_NoSignificantDigits = testing::TestWithParam; +TEST_P(ParseIntegerTest_NoSignificantDigits, Parse) { + Source::File file("", GetParam()); + + Lexer l(&file); + auto list = l.Lex(); + ASSERT_FALSE(list.empty()); + + auto& t = list[0]; + EXPECT_TRUE(t.Is(Token::Type::kError)); + EXPECT_EQ(t.to_str(), "integer or float hex literal has no significant digits"); +} + +INSTANTIATE_TEST_SUITE_P(LeadingZero, + ParseIntegerTest_NoSignificantDigits, + testing::Values("0x", + "0X", + "-0x", + "-0X", + "0xu", + "0Xu", + "-0xu", + "-0Xu", + "0xi", + "0Xi", + "-0xi", + "-0Xi")); struct TokenData { const char* input; @@ -857,20 +989,26 @@ TEST_P(PunctuationTest, Parses) { Source::File file("", params.input); Lexer l(&file); - auto t = l.next(); - EXPECT_TRUE(t.Is(params.type)); - EXPECT_EQ(t.source().range.begin.line, 1u); - EXPECT_EQ(t.source().range.begin.column, 1u); - EXPECT_EQ(t.source().range.end.line, 1u); - EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); + auto list = l.Lex(); + ASSERT_GE(list.size(), 2u); - t = l.next(); - EXPECT_EQ(t.source().range.begin.column, 1 + std::string(params.input).size()); + { + auto& t = list[0]; + EXPECT_TRUE(t.Is(params.type)); + EXPECT_EQ(t.source().range.begin.line, 1u); + EXPECT_EQ(t.source().range.begin.column, 1u); + EXPECT_EQ(t.source().range.end.line, 1u); + EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); + } + + { + auto& t = list[1]; + EXPECT_EQ(t.source().range.begin.column, 1 + std::string(params.input).size()); + } } INSTANTIATE_TEST_SUITE_P(LexerTest, PunctuationTest, testing::Values(TokenData{"&", Token::Type::kAnd}, - TokenData{"&&", Token::Type::kAndAnd}, TokenData{"->", Token::Type::kArrow}, TokenData{"@", Token::Type::kAttr}, TokenData{"/", Token::Type::kForwardSlash}, @@ -884,15 +1022,12 @@ INSTANTIATE_TEST_SUITE_P(LexerTest, TokenData{"=", Token::Type::kEqual}, TokenData{"==", Token::Type::kEqualEqual}, TokenData{">", Token::Type::kGreaterThan}, - TokenData{">=", Token::Type::kGreaterThanEqual}, - TokenData{">>", Token::Type::kShiftRight}, TokenData{"<", Token::Type::kLessThan}, TokenData{"<=", Token::Type::kLessThanEqual}, TokenData{"<<", Token::Type::kShiftLeft}, TokenData{"%", Token::Type::kMod}, TokenData{"!=", Token::Type::kNotEqual}, TokenData{"-", Token::Type::kMinus}, - TokenData{"--", Token::Type::kMinusMinus}, TokenData{".", Token::Type::kPeriod}, TokenData{"+", Token::Type::kPlus}, TokenData{"++", Token::Type::kPlusPlus}, @@ -912,7 +1047,48 @@ INSTANTIATE_TEST_SUITE_P(LexerTest, TokenData{"%=", Token::Type::kModuloEqual}, TokenData{"&=", Token::Type::kAndEqual}, TokenData{"|=", Token::Type::kOrEqual}, - TokenData{"^=", Token::Type::kXorEqual})); + TokenData{"^=", Token::Type::kXorEqual}, + TokenData{">>=", Token::Type::kShiftRightEqual}, + TokenData{"<<=", Token::Type::kShiftLeftEqual})); + +using SplittablePunctuationTest = testing::TestWithParam; +TEST_P(SplittablePunctuationTest, Parses) { + auto params = GetParam(); + Source::File file("", params.input); + Lexer l(&file); + + auto list = l.Lex(); + ASSERT_GE(list.size(), 3u); + + { + auto& t = list[0]; + EXPECT_TRUE(t.Is(params.type)); + EXPECT_EQ(t.source().range.begin.line, 1u); + EXPECT_EQ(t.source().range.begin.column, 1u); + EXPECT_EQ(t.source().range.end.line, 1u); + EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); + } + + { + auto& t = list[1]; + EXPECT_TRUE(t.Is(Token::Type::kPlaceholder)); + EXPECT_EQ(t.source().range.begin.line, 1u); + EXPECT_EQ(t.source().range.begin.column, 2u); + EXPECT_EQ(t.source().range.end.line, 1u); + EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); + } + + { + auto& t = list[2]; + EXPECT_EQ(t.source().range.begin.column, 1 + std::string(params.input).size()); + } +} +INSTANTIATE_TEST_SUITE_P(LexerTest, + SplittablePunctuationTest, + testing::Values(TokenData{"&&", Token::Type::kAndAnd}, + TokenData{">=", Token::Type::kGreaterThanEqual}, + TokenData{"--", Token::Type::kMinusMinus}, + TokenData{">>", Token::Type::kShiftRight})); using KeywordTest = testing::TestWithParam; TEST_P(KeywordTest, Parses) { @@ -920,15 +1096,17 @@ TEST_P(KeywordTest, Parses) { Source::File file("", params.input); Lexer l(&file); - auto t = l.next(); + auto list = l.Lex(); + ASSERT_GE(list.size(), 2u); + + auto& t = list[0]; EXPECT_TRUE(t.Is(params.type)) << params.input; EXPECT_EQ(t.source().range.begin.line, 1u); EXPECT_EQ(t.source().range.begin.column, 1u); EXPECT_EQ(t.source().range.end.line, 1u); EXPECT_EQ(t.source().range.end.column, 1u + strlen(params.input)); - t = l.next(); - EXPECT_EQ(t.source().range.begin.column, 1 + std::string(params.input).size()); + EXPECT_EQ(list[1].source().range.begin.column, 1 + std::string(params.input).size()); } INSTANTIATE_TEST_SUITE_P( LexerTest, @@ -938,6 +1116,7 @@ INSTANTIATE_TEST_SUITE_P( TokenData{"bool", Token::Type::kBool}, TokenData{"break", Token::Type::kBreak}, TokenData{"case", Token::Type::kCase}, + TokenData{"const", Token::Type::kConst}, TokenData{"continue", Token::Type::kContinue}, TokenData{"continuing", Token::Type::kContinuing}, TokenData{"default", Token::Type::kDefault}, @@ -948,10 +1127,8 @@ INSTANTIATE_TEST_SUITE_P( TokenData{"false", Token::Type::kFalse}, TokenData{"fn", Token::Type::kFn}, TokenData{"for", Token::Type::kFor}, - TokenData{"function", Token::Type::kFunction}, TokenData{"i32", Token::Type::kI32}, TokenData{"if", Token::Type::kIf}, - TokenData{"import", Token::Type::kImport}, TokenData{"let", Token::Type::kLet}, TokenData{"loop", Token::Type::kLoop}, TokenData{"mat2x2", Token::Type::kMat2x2}, @@ -964,13 +1141,11 @@ INSTANTIATE_TEST_SUITE_P( TokenData{"mat4x3", Token::Type::kMat4x3}, TokenData{"mat4x4", Token::Type::kMat4x4}, TokenData{"override", Token::Type::kOverride}, - TokenData{"private", Token::Type::kPrivate}, TokenData{"ptr", Token::Type::kPtr}, TokenData{"return", Token::Type::kReturn}, TokenData{"sampler", Token::Type::kSampler}, TokenData{"sampler_comparison", Token::Type::kComparisonSampler}, - TokenData{"storage", Token::Type::kStorage}, - TokenData{"storage_buffer", Token::Type::kStorage}, + TokenData{"static_assert", Token::Type::kStaticAssert}, TokenData{"struct", Token::Type::kStruct}, TokenData{"switch", Token::Type::kSwitch}, TokenData{"texture_1d", Token::Type::kTextureSampled1d}, @@ -993,12 +1168,11 @@ INSTANTIATE_TEST_SUITE_P( TokenData{"true", Token::Type::kTrue}, TokenData{"type", Token::Type::kType}, TokenData{"u32", Token::Type::kU32}, - TokenData{"uniform", Token::Type::kUniform}, TokenData{"var", Token::Type::kVar}, TokenData{"vec2", Token::Type::kVec2}, TokenData{"vec3", Token::Type::kVec3}, TokenData{"vec4", Token::Type::kVec4}, - TokenData{"workgroup", Token::Type::kWorkgroup})); + TokenData{"while", Token::Type::kWhile})); } // namespace } // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl.cc b/src/tint/reader/wgsl/parser_impl.cc index 8661a00a98..bf95b4e73b 100644 --- a/src/tint/reader/wgsl/parser_impl.cc +++ b/src/tint/reader/wgsl/parser_impl.cc @@ -47,6 +47,12 @@ namespace tint::reader::wgsl { namespace { +using Void = ParserImpl::Void; + +/// An instance of Void that can be used to signal success for functions that return Expect or +/// Maybe. +static constexpr Void kSuccess; + template using Expect = ParserImpl::Expect; @@ -62,72 +68,42 @@ constexpr uint32_t kMaxParseDepth = 128; /// parser on error. constexpr size_t const kMaxResynchronizeLookahead = 32; -const char kVertexStage[] = "vertex"; -const char kFragmentStage[] = "fragment"; -const char kComputeStage[] = "compute"; - -const char kReadAccess[] = "read"; -const char kWriteAccess[] = "write"; -const char kReadWriteAccess[] = "read_write"; - -ast::Builtin ident_to_builtin(std::string_view str) { - if (str == "position") { - return ast::Builtin::kPosition; - } - if (str == "vertex_index") { - return ast::Builtin::kVertexIndex; - } - if (str == "instance_index") { - return ast::Builtin::kInstanceIndex; - } - if (str == "front_facing") { - return ast::Builtin::kFrontFacing; - } - if (str == "frag_depth") { - return ast::Builtin::kFragDepth; - } - if (str == "local_invocation_id") { - return ast::Builtin::kLocalInvocationId; - } - if (str == "local_invocation_idx" || str == "local_invocation_index") { - return ast::Builtin::kLocalInvocationIndex; - } - if (str == "global_invocation_id") { - return ast::Builtin::kGlobalInvocationId; - } - if (str == "workgroup_id") { - return ast::Builtin::kWorkgroupId; - } - if (str == "num_workgroups") { - return ast::Builtin::kNumWorkgroups; - } - if (str == "sample_index") { - return ast::Builtin::kSampleIndex; - } - if (str == "sample_mask") { - return ast::Builtin::kSampleMask; - } - return ast::Builtin::kNone; -} - -const char kBindingAttribute[] = "binding"; -const char kBuiltinAttribute[] = "builtin"; -const char kGroupAttribute[] = "group"; -const char kIdAttribute[] = "id"; -const char kInterpolateAttribute[] = "interpolate"; -const char kInvariantAttribute[] = "invariant"; -const char kLocationAttribute[] = "location"; -const char kSizeAttribute[] = "size"; -const char kAlignAttribute[] = "align"; -const char kStageAttribute[] = "stage"; -const char kWorkgroupSizeAttribute[] = "workgroup_size"; - // https://gpuweb.github.io/gpuweb/wgsl.html#reserved-keywords -bool is_reserved(Token t) { - return t == "asm" || t == "bf16" || t == "const" || t == "do" || t == "enum" || t == "f16" || - t == "f64" || t == "handle" || t == "i8" || t == "i16" || t == "i64" || t == "mat" || - t == "premerge" || t == "regardless" || t == "typedef" || t == "u8" || t == "u16" || - t == "u64" || t == "unless" || t == "using" || t == "vec" || t == "void" || t == "while"; +bool is_reserved(const Token& t) { + return t == "CompileShader" || t == "ComputeShader" || t == "DomainShader" || + t == "GeometryShader" || t == "Hullshader" || t == "NULL" || t == "Self" || + t == "abstract" || t == "active" || t == "alignas" || t == "alignof" || t == "as" || + t == "asm" || t == "asm_fragment" || t == "async" || t == "attribute" || t == "auto" || + t == "await" || t == "become" || t == "binding_array" || t == "cast" || t == "catch" || + t == "class" || t == "co_await" || t == "co_return" || t == "co_yield" || + t == "coherent" || t == "column_major" || t == "common" || t == "compile" || + t == "compile_fragment" || t == "concept" || t == "const_cast" || t == "consteval" || + t == "constexpr" || t == "constinit" || t == "crate" || t == "debugger" || + t == "decltype" || t == "delete" || t == "demote" || t == "demote_to_helper" || + t == "do" || t == "dynamic_cast" || t == "enum" || t == "explicit" || t == "export" || + t == "extends" || t == "extern" || t == "external" || t == "filter" || t == "final" || + t == "finally" || t == "friend" || t == "from" || t == "fxgroup" || t == "get" || + t == "goto" || t == "groupshared" || t == "handle" || t == "highp" || t == "impl" || + t == "implements" || t == "import" || t == "inline" || t == "inout" || + t == "instanceof" || t == "interface" || t == "invariant" || t == "layout" || + t == "line" || t == "lineadj" || t == "lowp" || t == "macro" || t == "macro_rules" || + t == "match" || t == "mediump" || t == "meta" || t == "mod" || t == "module" || + t == "move" || t == "mut" || t == "mutable" || t == "namespace" || t == "new" || + t == "nil" || t == "noexcept" || t == "noinline" || t == "nointerpolation" || + t == "noperspective" || t == "null" || t == "nullptr" || t == "of" || t == "operator" || + t == "package" || t == "packoffset" || t == "partition" || t == "pass" || t == "patch" || + t == "pixelfragment" || t == "point" || t == "precise" || t == "precision" || + t == "premerge" || t == "priv" || t == "protected" || t == "pub" || t == "public" || + t == "readonly" || t == "ref" || t == "regardless" || t == "register" || + t == "reinterpret_cast" || t == "requires" || t == "resource" || t == "restrict" || + t == "self" || t == "set" || t == "shared" || t == "signed" || t == "sizeof" || + t == "smooth" || t == "snorm" || t == "static" || t == "static_cast" || t == "std" || + t == "subroutine" || t == "super" || t == "target" || t == "template" || t == "this" || + t == "thread_local" || t == "throw" || t == "trait" || t == "try" || t == "typedef" || + t == "typeid" || t == "typename" || t == "typeof" || t == "union" || t == "unless" || + t == "unorm" || t == "unsafe" || t == "unsized" || t == "use" || t == "using" || + t == "varying" || t == "virtual" || t == "volatile" || t == "wgsl" || t == "where" || + t == "with" || t == "writeonly" || t == "yield"; } /// Enter-exit counters for block token types. @@ -141,18 +117,24 @@ struct BlockCounters { /// @return the current enter-exit depth for the given block token type. If /// `t` is not a block token type, then 0 is always returned. int consume(const Token& t) { - if (t.Is(Token::Type::kBraceLeft)) + if (t.Is(Token::Type::kBraceLeft)) { return brace++; - if (t.Is(Token::Type::kBraceRight)) + } + if (t.Is(Token::Type::kBraceRight)) { return brace--; - if (t.Is(Token::Type::kBracketLeft)) + } + if (t.Is(Token::Type::kBracketLeft)) { return bracket++; - if (t.Is(Token::Type::kBracketRight)) + } + if (t.Is(Token::Type::kBracketRight)) { return bracket--; - if (t.Is(Token::Type::kParenLeft)) + } + if (t.Is(Token::Type::kParenLeft)) { return paren++; - if (t.Is(Token::Type::kParenRight)) + } + if (t.Is(Token::Type::kParenRight)) { return paren--; + } return 0; } }; @@ -175,7 +157,7 @@ class ParserImpl::MultiTokenSource { /// Implicit conversion to Source that returns the combined source from start /// to the current last token's source. operator Source() const { - Source end = parser_->last_token().source().End(); + Source end = parser_->last_source().End(); if (end < start_) { end = start_; } @@ -204,10 +186,14 @@ ParserImpl::FunctionHeader::FunctionHeader(const FunctionHeader&) = default; ParserImpl::FunctionHeader::FunctionHeader(Source src, std::string n, - ast::VariableList p, + utils::VectorRef p, const ast::Type* ret_ty, - ast::AttributeList ret_attrs) - : source(src), name(n), params(p), return_type(ret_ty), return_type_attributes(ret_attrs) {} + utils::VectorRef ret_attrs) + : source(src), + name(n), + params(std::move(p)), + return_type(ret_ty), + return_type_attributes(std::move(ret_attrs)) {} ParserImpl::FunctionHeader::~FunctionHeader() = default; @@ -231,7 +217,7 @@ ParserImpl::VarDeclInfo::VarDeclInfo(Source source_in, ParserImpl::VarDeclInfo::~VarDeclInfo() = default; -ParserImpl::ParserImpl(Source::File const* file) : lexer_(std::make_unique(file)) {} +ParserImpl::ParserImpl(Source::File const* file) : file_(file) {} ParserImpl::~ParserImpl() = default; @@ -264,55 +250,89 @@ void ParserImpl::deprecated(const Source& source, const std::string& msg) { "use of deprecated language feature: " + msg, source); } -Token ParserImpl::next() { - if (!token_queue_.empty()) { - auto t = token_queue_.front(); - token_queue_.pop_front(); - last_token_ = t; - return last_token_; +const Token& ParserImpl::next() { + // If the next token is already an error or the end of file, stay there. + if (tokens_[next_token_idx_].IsEof() || tokens_[next_token_idx_].IsError()) { + return tokens_[next_token_idx_]; } - last_token_ = lexer_->next(); - return last_token_; + + // Skip over any placeholder elements + while (true) { + if (!tokens_[next_token_idx_].IsPlaceholder()) { + break; + } + next_token_idx_++; + } + last_source_idx_ = next_token_idx_; + + if (!tokens_[next_token_idx_].IsEof() && !tokens_[next_token_idx_].IsError()) { + next_token_idx_++; + } + return tokens_[last_source_idx_]; } -Token ParserImpl::peek(size_t idx) { - while (token_queue_.size() < (idx + 1)) { - token_queue_.push_back(lexer_->next()); +const Token& ParserImpl::peek(size_t count) { + for (size_t idx = next_token_idx_; idx < tokens_.size(); idx++) { + if (tokens_[idx].IsPlaceholder()) { + continue; + } + if (count == 0) { + return tokens_[idx]; + } + count--; } - return token_queue_[idx]; + // Walked off the end of the token list, return last token. + return tokens_[tokens_.size() - 1]; } bool ParserImpl::peek_is(Token::Type tok, size_t idx) { return peek(idx).Is(tok); } -Token ParserImpl::last_token() const { - return last_token_; +void ParserImpl::split_token(Token::Type lhs, Token::Type rhs) { + if (next_token_idx_ == 0) { + TINT_ICE(Reader, builder_.Diagnostics()) + << "attempt to update placeholder at beginning of tokens"; + } + if (next_token_idx_ >= tokens_.size()) { + TINT_ICE(Reader, builder_.Diagnostics()) + << "attempt to update placeholder past end of tokens"; + } + if (!tokens_[next_token_idx_].IsPlaceholder()) { + TINT_ICE(Reader, builder_.Diagnostics()) << "attempt to update non-placeholder token"; + } + tokens_[next_token_idx_ - 1].SetType(lhs); + tokens_[next_token_idx_].SetType(rhs); +} + +Source ParserImpl::last_source() const { + return tokens_[last_source_idx_].source(); +} + +void ParserImpl::InitializeLex() { + Lexer l{file_}; + tokens_ = l.Lex(); } bool ParserImpl::Parse() { + InitializeLex(); translation_unit(); return !has_error(); } // translation_unit -// : enable_directive* global_decl* EOF +// : global_directive* global_decl* EOF void ParserImpl::translation_unit() { bool after_global_decl = false; while (continue_parsing()) { - auto p = peek(); + auto& p = peek(); if (p.IsEof()) { break; } - auto ed = enable_directive(); - if (ed.matched) { - if (after_global_decl) { - add_error(p, "enable directives must come before all global declarations"); - } - } else { + auto ed = global_directive(after_global_decl); + if (!ed.matched && !ed.errored) { auto gd = global_decl(); - if (gd.matched) { after_global_decl = true; } @@ -330,21 +350,41 @@ void ParserImpl::translation_unit() { } } +// global_directive +// : enable_directive +Maybe ParserImpl::global_directive(bool have_parsed_decl) { + auto& p = peek(); + auto ed = enable_directive(); + if (ed.matched && have_parsed_decl) { + return add_error(p, "enable directives must come before all global declarations"); + } + return ed; +} + // enable_directive // : enable name SEMICLON -Maybe ParserImpl::enable_directive() { - auto decl = sync(Token::Type::kSemicolon, [&]() -> Maybe { +Maybe ParserImpl::enable_directive() { + auto decl = sync(Token::Type::kSemicolon, [&]() -> Maybe { if (!match(Token::Type::kEnable)) { return Failure::kNoMatch; } // Match the extension name. Expect name = {""}; - auto t = peek(); + auto& t = peek(); if (t.IsIdentifier()) { synchronized_ = true; next(); name = {t.to_str(), t.source()}; + } else if (t.Is(Token::Type::kF16)) { + // `f16` is a valid extension name and also a keyword + synchronized_ = true; + next(); + name = {"f16", t.source()}; + } else if (t.Is(Token::Type::kParenLeft)) { + // A common error case is writing `enable(foo);` instead of `enable foo;`. + synchronized_ = false; + return add_error(t.source(), "enable directives don't take parenthesis"); } else if (handle_error(t)) { // The token might itself be an error. return Failure::kErrored; @@ -358,22 +398,20 @@ Maybe ParserImpl::enable_directive() { return Failure::kErrored; } - if (ast::Enable::NameToKind(name.value) != ast::Enable::ExtensionKind::kNotAnExtension) { - const ast::Enable* extension = create(name.source, name.value); - builder_.AST().AddEnable(extension); - } else { - // Error if an unknown extension is used + auto extension = ast::ParseExtension(name.value); + if (extension == ast::Extension::kInvalid) { return add_error(name.source, "unsupported extension: '" + name.value + "'"); } + builder_.AST().AddEnable(create(name.source, extension)); - return true; + return kSuccess; }); if (decl.errored) { return Failure::kErrored; } if (decl.matched) { - return true; + return kSuccess; } return Failure::kNoMatch; @@ -381,66 +419,80 @@ Maybe ParserImpl::enable_directive() { // global_decl // : SEMICOLON -// | global_variable_decl SEMICLON +// | global_variable_decl SEMICOLON // | global_constant_decl SEMICOLON -// | type_alias SEMICOLON +// | type_alias_decl SEMICOLON // | struct_decl // | function_decl -Maybe ParserImpl::global_decl() { - if (match(Token::Type::kSemicolon) || match(Token::Type::kEOF)) - return true; +// | static_assert_statement SEMICOLON +Maybe ParserImpl::global_decl() { + if (match(Token::Type::kSemicolon) || match(Token::Type::kEOF)) { + return kSuccess; + } bool errored = false; - auto attrs = attribute_list(); - if (attrs.errored) + if (attrs.errored) { errored = true; - if (!continue_parsing()) + } + if (!continue_parsing()) { return Failure::kErrored; + } - auto decl = sync(Token::Type::kSemicolon, [&]() -> Maybe { + auto decl = sync(Token::Type::kSemicolon, [&]() -> Maybe { auto gv = global_variable_decl(attrs.value); - if (gv.errored) + if (gv.errored) { return Failure::kErrored; + } if (gv.matched) { - if (!expect("variable declaration", Token::Type::kSemicolon)) + if (!expect("variable declaration", Token::Type::kSemicolon)) { return Failure::kErrored; + } builder_.AST().AddGlobalVariable(gv.value); - return true; + return kSuccess; } auto gc = global_constant_decl(attrs.value); - if (gc.errored) + if (gc.errored) { return Failure::kErrored; - + } if (gc.matched) { - if (!expect("let declaration", Token::Type::kSemicolon)) - return Failure::kErrored; + // Avoid the cost of the string allocation for the common no-error case + if (!peek().Is(Token::Type::kSemicolon)) { + std::string kind = gc->Kind(); + if (!expect("'" + kind + "' declaration", Token::Type::kSemicolon)) { + return Failure::kErrored; + } + } builder_.AST().AddGlobalVariable(gc.value); - return true; + return kSuccess; } - auto ta = type_alias(); - if (ta.errored) + auto ta = type_alias_decl(); + if (ta.errored) { return Failure::kErrored; - + } if (ta.matched) { - if (!expect("type alias", Token::Type::kSemicolon)) + if (!expect("type alias", Token::Type::kSemicolon)) { return Failure::kErrored; + } builder_.AST().AddTypeDecl(ta.value); - return true; + return kSuccess; } - auto str = struct_decl(); - if (str.errored) + auto assertion = static_assert_statement(); + if (assertion.errored) { return Failure::kErrored; - - if (str.matched) { - builder_.AST().AddTypeDecl(str.value); - return true; + } + if (assertion.matched) { + builder_.AST().AddStaticAssert(assertion.value); + if (!expect("static assertion declaration", Token::Type::kSemicolon)) { + return Failure::kErrored; + } + return kSuccess; } return Failure::kNoMatch; @@ -450,7 +502,22 @@ Maybe ParserImpl::global_decl() { errored = true; } if (decl.matched) { - return expect_attributes_consumed(attrs.value); + if (!expect_attributes_consumed(attrs.value)) { + return Failure::kErrored; + } + return kSuccess; + } + + auto str = struct_decl(); + if (str.errored) { + errored = true; + } + if (str.matched) { + builder_.AST().AddTypeDecl(str.value); + if (!expect_attributes_consumed(attrs.value)) { + return Failure::kErrored; + } + return kSuccess; } auto func = function_decl(attrs.value); @@ -459,7 +526,7 @@ Maybe ParserImpl::global_decl() { } if (func.matched) { builder_.AST().AddFunction(func.value); - return true; + return kSuccess; } if (errored) { @@ -469,12 +536,12 @@ Maybe ParserImpl::global_decl() { // Invalid syntax found - try and determine the best error message // We have attributes parsed, but nothing to consume them? - if (attrs.value.size() > 0) { + if (attrs.value.Length() > 0) { return add_error(next(), "expected declaration after attributes"); } // We have a statement outside of a function? - auto t = peek(); + auto& t = peek(); auto stat = without_error([&] { return statement(); }); if (stat.matched) { // Attempt to jump to the next '}' - the function might have just been @@ -500,142 +567,189 @@ Maybe ParserImpl::global_decl() { } // global_variable_decl -// : variable_attribute_list* variable_decl -// | variable_attribute_list* variable_decl EQUAL const_expr -Maybe ParserImpl::global_variable_decl(ast::AttributeList& attrs) { +// : variable_attribute_list* variable_decl (EQUAL expression)? +Maybe ParserImpl::global_variable_decl(AttributeList& attrs) { auto decl = variable_decl(); - if (decl.errored) + if (decl.errored) { return Failure::kErrored; - if (!decl.matched) + } + if (!decl.matched) { return Failure::kNoMatch; - - const ast::Expression* constructor = nullptr; - if (match(Token::Type::kEqual)) { - auto expr = expect_const_expr(); - if (expr.errored) - return Failure::kErrored; - constructor = expr.value; } - return create(decl->source, // source - builder_.Symbols().Register(decl->name), // symbol - decl->storage_class, // storage class - decl->access, // access control - decl->type, // type - false, // is_const - false, // is_overridable - constructor, // constructor - std::move(attrs)); // attributes + const ast::Expression* initializer = nullptr; + if (match(Token::Type::kEqual)) { + auto expr = expression(); + if (expr.errored) { + return Failure::kErrored; + } + if (!expr.matched) { + return add_error(peek(), "missing initializer for 'var' declaration"); + } + initializer = expr.value; + } + + TINT_DEFER(attrs.Clear()); + + return create(decl->source, // source + builder_.Symbols().Register(decl->name), // symbol + decl->type, // type + decl->storage_class, // storage class + decl->access, // access control + initializer, // initializer + std::move(attrs)); // attributes } // global_constant_decl : -// | LET (ident | variable_ident_decl) global_const_initializer -// | attribute* override (ident | variable_ident_decl) (equal expression)? +// | LET optionally_typed_ident global_const_initializer +// | attribute* override optionally_typed_ident (equal expression)? // global_const_initializer // : EQUAL const_expr -Maybe ParserImpl::global_constant_decl(ast::AttributeList& attrs) { +Maybe ParserImpl::global_constant_decl(AttributeList& attrs) { + bool is_const = false; bool is_overridable = false; const char* use = nullptr; - if (match(Token::Type::kLet)) { - use = "let declaration"; + Source source; + if (match(Token::Type::kConst)) { + use = "'const' declaration"; + } else if (match(Token::Type::kLet, &source)) { + use = "'let' declaration"; + deprecated(source, "module-scope 'let' has been replaced with 'const'"); } else if (match(Token::Type::kOverride)) { - use = "override declaration"; + use = "'override' declaration"; is_overridable = true; } else { return Failure::kNoMatch; } - auto decl = expect_variable_ident_decl(use, /* allow_inferred = */ true); - if (decl.errored) + auto decl = expect_optionally_typed_ident(use); + if (decl.errored) { return Failure::kErrored; - - const ast::Expression* initializer = nullptr; - if (match(Token::Type::kEqual)) { - auto init = expect_const_expr(); - if (init.errored) { - return Failure::kErrored; - } - initializer = std::move(init.value); } - return create(decl->source, // source - builder_.Symbols().Register(decl->name), // symbol - ast::StorageClass::kNone, // storage class - ast::Access::kUndefined, // access control - decl->type, // type - true, // is_const - is_overridable, // is_overridable - initializer, // constructor - std::move(attrs)); // attributes + bool has_initializer = false; + if (is_overridable) { + has_initializer = match(Token::Type::kEqual); + } else { + if (!expect(use, Token::Type::kEqual)) { + return Failure::kErrored; + } + has_initializer = true; + } + + const ast::Expression* initializer = nullptr; + if (has_initializer) { + auto expr = expression(); + if (expr.errored) { + return Failure::kErrored; + } + if (!expr.matched) { + return add_error(peek(), "missing initializer for " + std::string(use)); + } + initializer = std::move(expr.value); + } + + TINT_DEFER(attrs.Clear()); + + if (is_const) { + return create(decl->source, // source + builder_.Symbols().Register(decl->name), // symbol + decl->type, // type + initializer, // initializer + std::move(attrs)); // attributes + } + if (is_overridable) { + return create(decl->source, // source + builder_.Symbols().Register(decl->name), // symbol + decl->type, // type + initializer, // initializer + std::move(attrs)); // attributes + } + return create(decl->source, // source + builder_.Symbols().Register(decl->name), // symbol + decl->type, // type + initializer, // initializer + std::move(attrs)); // attributes } // variable_decl -// : VAR variable_qualifier? variable_ident_decl -Maybe ParserImpl::variable_decl(bool allow_inferred) { +// : VAR variable_qualifier? optionally_typed_ident +// +// Note, the `( LESS_THAN address_space ( COMMA access_mode )? GREATER_THAN ) is pulled out into +// a `variable_qualifier` helper. +Maybe ParserImpl::variable_decl() { Source source; - if (!match(Token::Type::kVar, &source)) + if (!match(Token::Type::kVar, &source)) { return Failure::kNoMatch; + } VariableQualifier vq; auto explicit_vq = variable_qualifier(); - if (explicit_vq.errored) + if (explicit_vq.errored) { return Failure::kErrored; + } if (explicit_vq.matched) { vq = explicit_vq.value; } - auto decl = expect_variable_ident_decl("variable declaration", allow_inferred); - if (decl.errored) + auto decl = expect_optionally_typed_ident("variable declaration"); + if (decl.errored) { return Failure::kErrored; + } return VarDeclInfo{decl->source, decl->name, vq.storage_class, vq.access, decl->type}; } -// texture_samplers -// : sampler -// | depth_texture -// | sampled_texture LESS_THAN type_decl GREATER_THAN -// | multisampled_texture LESS_THAN type_decl GREATER_THAN -// | storage_texture LESS_THAN texel_format -// COMMA access GREATER_THAN -Maybe ParserImpl::texture_samplers() { - auto type = sampler(); - if (type.matched) +// texture_and_sampler_types +// : sampler_type +// | depth_texture_type +// | sampled_texture_type LESS_THAN type_decl GREATER_THAN +// | multisampled_texture_type LESS_THAN type_decl GREATER_THAN +// | storage_texture_type LESS_THAN texel_format +// COMMA access_mode GREATER_THAN +Maybe ParserImpl::texture_and_sampler_types() { + auto type = sampler_type(); + if (type.matched) { return type; + } - type = depth_texture(); - if (type.matched) + type = depth_texture_type(); + if (type.matched) { return type; + } type = external_texture(); - if (type.matched) + if (type.matched) { return type.value; + } auto source_range = make_source_range(); - auto dim = sampled_texture(); + auto dim = sampled_texture_type(); if (dim.matched) { const char* use = "sampled texture type"; auto subtype = expect_lt_gt_block(use, [&] { return expect_type(use); }); - if (subtype.errored) + if (subtype.errored) { return Failure::kErrored; + } return builder_.ty.sampled_texture(source_range, dim.value, subtype.value); } - auto ms_dim = multisampled_texture(); + auto ms_dim = multisampled_texture_type(); if (ms_dim.matched) { const char* use = "multisampled texture type"; auto subtype = expect_lt_gt_block(use, [&] { return expect_type(use); }); - if (subtype.errored) + if (subtype.errored) { return Failure::kErrored; + } return builder_.ty.multisampled_texture(source_range, ms_dim.value, subtype.value); } - auto storage = storage_texture(); + auto storage = storage_texture_type(); if (storage.matched) { const char* use = "storage texture type"; using StorageTextureInfo = std::pair; @@ -649,7 +763,7 @@ Maybe ParserImpl::texture_samplers() { return Failure::kErrored; } - auto access = expect_access("access control"); + auto access = expect_access_mode("access control"); if (access.errored) { return Failure::kErrored; } @@ -668,45 +782,53 @@ Maybe ParserImpl::texture_samplers() { return Failure::kNoMatch; } -// sampler +// sampler_type // : SAMPLER // | SAMPLER_COMPARISON -Maybe ParserImpl::sampler() { +Maybe ParserImpl::sampler_type() { Source source; - if (match(Token::Type::kSampler, &source)) + if (match(Token::Type::kSampler, &source)) { return builder_.ty.sampler(source, ast::SamplerKind::kSampler); + } - if (match(Token::Type::kComparisonSampler, &source)) + if (match(Token::Type::kComparisonSampler, &source)) { return builder_.ty.sampler(source, ast::SamplerKind::kComparisonSampler); + } return Failure::kNoMatch; } -// sampled_texture +// sampled_texture_type // : TEXTURE_SAMPLED_1D // | TEXTURE_SAMPLED_2D // | TEXTURE_SAMPLED_2D_ARRAY // | TEXTURE_SAMPLED_3D // | TEXTURE_SAMPLED_CUBE // | TEXTURE_SAMPLED_CUBE_ARRAY -Maybe ParserImpl::sampled_texture() { - if (match(Token::Type::kTextureSampled1d)) +Maybe ParserImpl::sampled_texture_type() { + if (match(Token::Type::kTextureSampled1d)) { return ast::TextureDimension::k1d; + } - if (match(Token::Type::kTextureSampled2d)) + if (match(Token::Type::kTextureSampled2d)) { return ast::TextureDimension::k2d; + } - if (match(Token::Type::kTextureSampled2dArray)) + if (match(Token::Type::kTextureSampled2dArray)) { return ast::TextureDimension::k2dArray; + } - if (match(Token::Type::kTextureSampled3d)) + if (match(Token::Type::kTextureSampled3d)) { return ast::TextureDimension::k3d; + } - if (match(Token::Type::kTextureSampledCube)) + if (match(Token::Type::kTextureSampledCube)) { return ast::TextureDimension::kCube; + } - if (match(Token::Type::kTextureSampledCubeArray)) + if (match(Token::Type::kTextureSampledCubeArray)) { return ast::TextureDimension::kCubeArray; + } return Failure::kNoMatch; } @@ -722,40 +844,45 @@ Maybe ParserImpl::external_texture() { return Failure::kNoMatch; } -// multisampled_texture +// multisampled_texture_type // : TEXTURE_MULTISAMPLED_2D -Maybe ParserImpl::multisampled_texture() { - if (match(Token::Type::kTextureMultisampled2d)) +Maybe ParserImpl::multisampled_texture_type() { + if (match(Token::Type::kTextureMultisampled2d)) { return ast::TextureDimension::k2d; + } return Failure::kNoMatch; } -// storage_texture +// storage_texture_type // : TEXTURE_STORAGE_1D // | TEXTURE_STORAGE_2D // | TEXTURE_STORAGE_2D_ARRAY // | TEXTURE_STORAGE_3D -Maybe ParserImpl::storage_texture() { - if (match(Token::Type::kTextureStorage1d)) +Maybe ParserImpl::storage_texture_type() { + if (match(Token::Type::kTextureStorage1d)) { return ast::TextureDimension::k1d; - if (match(Token::Type::kTextureStorage2d)) + } + if (match(Token::Type::kTextureStorage2d)) { return ast::TextureDimension::k2d; - if (match(Token::Type::kTextureStorage2dArray)) + } + if (match(Token::Type::kTextureStorage2dArray)) { return ast::TextureDimension::k2dArray; - if (match(Token::Type::kTextureStorage3d)) + } + if (match(Token::Type::kTextureStorage3d)) { return ast::TextureDimension::k3d; + } return Failure::kNoMatch; } -// depth_texture +// depth_texture_type // : TEXTURE_DEPTH_2D // | TEXTURE_DEPTH_2D_ARRAY // | TEXTURE_DEPTH_CUBE // | TEXTURE_DEPTH_CUBE_ARRAY // | TEXTURE_DEPTH_MULTISAMPLED_2D -Maybe ParserImpl::depth_texture() { +Maybe ParserImpl::depth_texture_type() { Source source; if (match(Token::Type::kTextureDepth2d, &source)) { return builder_.ty.depth_texture(source, ast::TextureDimension::k2d); @@ -793,100 +920,80 @@ Maybe ParserImpl::depth_texture() { // | 'rgba32sint' // | 'rgba32float' Expect ParserImpl::expect_texel_format(std::string_view use) { - auto t = next(); - if (t == "rgba8unorm") { - return ast::TexelFormat::kRgba8Unorm; + auto& t = next(); + auto fmt = ast::ParseTexelFormat(t.to_str()); + if (fmt == ast::TexelFormat::kInvalid) { + return add_error(t.source(), "invalid format", use); } - if (t == "rgba8snorm") { - return ast::TexelFormat::kRgba8Snorm; - } - if (t == "rgba8uint") { - return ast::TexelFormat::kRgba8Uint; - } - if (t == "rgba8sint") { - return ast::TexelFormat::kRgba8Sint; - } - if (t == "rgba16uint") { - return ast::TexelFormat::kRgba16Uint; - } - if (t == "rgba16sint") { - return ast::TexelFormat::kRgba16Sint; - } - if (t == "rgba16float") { - return ast::TexelFormat::kRgba16Float; - } - if (t == "r32uint") { - return ast::TexelFormat::kR32Uint; - } - if (t == "r32sint") { - return ast::TexelFormat::kR32Sint; - } - if (t == "r32float") { - return ast::TexelFormat::kR32Float; - } - if (t == "rg32uint") { - return ast::TexelFormat::kRg32Uint; - } - if (t == "rg32sint") { - return ast::TexelFormat::kRg32Sint; - } - if (t == "rg32float") { - return ast::TexelFormat::kRg32Float; - } - if (t == "rgba32uint") { - return ast::TexelFormat::kRgba32Uint; - } - if (t == "rgba32sint") { - return ast::TexelFormat::kRgba32Sint; - } - if (t == "rgba32float") { - return ast::TexelFormat::kRgba32Float; - } - return add_error(t.source(), "invalid format", use); + return fmt; } -// variable_ident_decl -// : IDENT COLON type_decl -Expect ParserImpl::expect_variable_ident_decl(std::string_view use, - bool allow_inferred) { +Expect ParserImpl::expect_ident_with_optional_type_decl( + std::string_view use, + bool allow_inferred) { auto ident = expect_ident(use); - if (ident.errored) + if (ident.errored) { return Failure::kErrored; + } if (allow_inferred && !peek_is(Token::Type::kColon)) { return TypedIdentifier{nullptr, ident.value, ident.source}; } - if (!expect(use, Token::Type::kColon)) + if (!expect(use, Token::Type::kColon)) { return Failure::kErrored; + } - auto t = peek(); + auto& t = peek(); auto type = type_decl(); - if (type.errored) + if (type.errored) { return Failure::kErrored; - if (!type.matched) + } + if (!type.matched) { return add_error(t.source(), "invalid type", use); + } return TypedIdentifier{type.value, ident.value, ident.source}; } -Expect ParserImpl::expect_access(std::string_view use) { - auto ident = expect_ident(use); - if (ident.errored) - return Failure::kErrored; +// optionally_typed_ident +// : ident ( COLON typed_decl ) ? +Expect ParserImpl::expect_optionally_typed_ident( + std::string_view use) { + return expect_ident_with_optional_type_decl(use, true); +} - if (ident.value == kReadAccess) +// ident_with_type_decl +// : IDENT COLON type_decl +Expect ParserImpl::expect_ident_with_type_decl(std::string_view use) { + return expect_ident_with_optional_type_decl(use, false); +} + +// access_mode +// : 'read' +// | 'write' +// | 'read_write' +Expect ParserImpl::expect_access_mode(std::string_view use) { + auto ident = expect_ident(use); + if (ident.errored) { + return Failure::kErrored; + } + + if (ident.value == "read") { return {ast::Access::kRead, ident.source}; - if (ident.value == kWriteAccess) + } + if (ident.value == "write") { return {ast::Access::kWrite, ident.source}; - if (ident.value == kReadWriteAccess) + } + if (ident.value == "read_write") { return {ast::Access::kReadWrite, ident.source}; + } return add_error(ident.source, "invalid value for access control"); } // variable_qualifier -// : LESS_THAN storage_class (COMMA access_mode)? GREATER_THAN +// : LESS_THAN address_spaces (COMMA access_mode)? GREATER_THAN Maybe ParserImpl::variable_qualifier() { if (!peek_is(Token::Type::kLessThan)) { return Failure::kNoMatch; @@ -895,12 +1002,12 @@ Maybe ParserImpl::variable_qualifier() { auto* use = "variable declaration"; auto vq = expect_lt_gt_block(use, [&]() -> Expect { auto source = make_source_range(); - auto sc = expect_storage_class(use); + auto sc = expect_address_space(use); if (sc.errored) { return Failure::kErrored; } if (match(Token::Type::kComma)) { - auto ac = expect_access(use); + auto ac = expect_access_mode(use); if (ac.errored) { return Failure::kErrored; } @@ -917,122 +1024,195 @@ Maybe ParserImpl::variable_qualifier() { return vq; } -// type_alias +// type_alias_decl // : TYPE IDENT EQUAL type_decl -Maybe ParserImpl::type_alias() { - if (!peek_is(Token::Type::kType)) +Maybe ParserImpl::type_alias_decl() { + if (!peek_is(Token::Type::kType)) { return Failure::kNoMatch; + } - auto t = next(); + auto& t = next(); const char* use = "type alias"; auto name = expect_ident(use); - if (name.errored) + if (name.errored) { return Failure::kErrored; + } - if (!expect(use, Token::Type::kEqual)) + if (!expect(use, Token::Type::kEqual)) { return Failure::kErrored; + } auto type = type_decl(); - if (type.errored) + if (type.errored) { return Failure::kErrored; - if (!type.matched) + } + if (!type.matched) { return add_error(peek(), "invalid type alias"); + } return builder_.ty.alias(make_source_range_from(t.source()), name.value, type.value); } +// vec_prefix +// : 'vec2' +// | 'vec3' +// | 'vec4' +Maybe ParserImpl::vec_prefix() { + auto& t = peek(); + if (!t.IsVector()) { + return Failure::kNoMatch; + } + next(); + + if (t.Is(Token::Type::kVec3)) { + return 3u; + } + if (t.Is(Token::Type::kVec4)) { + return 4u; + } + return 2u; +} + +// mat_prefix +// : 'mat2x2' +// | 'mat2x3' +// | 'mat2x4' +// | 'mat3x2' +// | 'mat3x3' +// | 'mat3x4' +// | 'mat4x2' +// | 'mat4x3' +// | 'mat4x4' +Maybe ParserImpl::mat_prefix() { + auto& t = peek(); + if (!t.IsMatrix()) { + return Failure::kNoMatch; + } + next(); + + uint32_t columns = 2; + if (t.IsMat3xN()) { + columns = 3; + } else if (t.IsMat4xN()) { + columns = 4; + } + if (t.IsMatNx3()) { + return MatrixDimensions{columns, 3}; + } + if (t.IsMatNx4()) { + return MatrixDimensions{columns, 4}; + } + return MatrixDimensions{columns, 2}; +} + +// type_decl_without_ident: +// : BOOL +// | F16 +// | F32 +// | I32 +// | U32 +// | ARRAY LESS_THAN type_decl ( COMMA element_count_expression )? GREATER_THAN +// | ATOMIC LESS_THAN type_decl GREATER_THAN +// | PTR LESS_THAN address_space COMMA type_decl ( COMMA access_mode )? GREATER_THAN +// | mat_prefix LESS_THAN type_decl GREATER_THAN +// | vec_prefix LESS_THAN type_decl GREATER_THAN +// | texture_and_sampler_types +Maybe ParserImpl::type_decl_without_ident() { + auto& t = peek(); + + if (match(Token::Type::kBool)) { + return builder_.ty.bool_(t.source()); + } + + if (match(Token::Type::kF16)) { + return builder_.ty.f16(t.source()); + } + + if (match(Token::Type::kF32)) { + return builder_.ty.f32(t.source()); + } + + if (match(Token::Type::kI32)) { + return builder_.ty.i32(t.source()); + } + + if (match(Token::Type::kU32)) { + return builder_.ty.u32(t.source()); + } + + if (t.Is(Token::Type::kArray) && peek_is(Token::Type::kLessThan, 1)) { + if (match(Token::Type::kArray)) { + return expect_type_decl_array(t.source()); + } + } + + if (match(Token::Type::kAtomic)) { + return expect_type_decl_atomic(t.source()); + } + + if (match(Token::Type::kPtr)) { + return expect_type_decl_pointer(t.source()); + } + + if (t.IsMatrix() && peek_is(Token::Type::kLessThan, 1)) { + auto mat = mat_prefix(); + if (mat.matched) { + return expect_type_decl_matrix(t.source(), mat.value); + } + } + + if (t.IsVector() && peek_is(Token::Type::kLessThan, 1)) { + auto vec = vec_prefix(); + if (vec.matched) { + return expect_type_decl_vector(t.source(), vec.value); + } + } + + auto texture_or_sampler = texture_and_sampler_types(); + if (texture_or_sampler.errored) { + return Failure::kErrored; + } + if (texture_or_sampler.matched) { + return texture_or_sampler; + } + + return Failure::kNoMatch; +} + // type_decl // : IDENTIFIER -// | BOOL -// | FLOAT32 -// | INT32 -// | UINT32 -// | VEC2 LESS_THAN type_decl GREATER_THAN -// | VEC3 LESS_THAN type_decl GREATER_THAN -// | VEC4 LESS_THAN type_decl GREATER_THAN -// | PTR LESS_THAN storage_class, type_decl (COMMA access_mode)? GREATER_THAN -// | array_attribute_list* ARRAY LESS_THAN type_decl COMMA -// INT_LITERAL GREATER_THAN -// | array_attribute_list* ARRAY LESS_THAN type_decl -// GREATER_THAN -// | MAT2x2 LESS_THAN type_decl GREATER_THAN -// | MAT2x3 LESS_THAN type_decl GREATER_THAN -// | MAT2x4 LESS_THAN type_decl GREATER_THAN -// | MAT3x2 LESS_THAN type_decl GREATER_THAN -// | MAT3x3 LESS_THAN type_decl GREATER_THAN -// | MAT3x4 LESS_THAN type_decl GREATER_THAN -// | MAT4x2 LESS_THAN type_decl GREATER_THAN -// | MAT4x3 LESS_THAN type_decl GREATER_THAN -// | MAT4x4 LESS_THAN type_decl GREATER_THAN -// | texture_samplers +// | type_decl_without_ident Maybe ParserImpl::type_decl() { - auto t = peek(); + auto& t = peek(); Source source; if (match(Token::Type::kIdentifier, &source)) { return builder_.create(source, builder_.Symbols().Register(t.to_str())); } - if (match(Token::Type::kBool, &source)) - return builder_.ty.bool_(source); - - if (match(Token::Type::kF32, &source)) - return builder_.ty.f32(source); - - if (match(Token::Type::kI32, &source)) - return builder_.ty.i32(source); - - if (match(Token::Type::kU32, &source)) - return builder_.ty.u32(source); - - if (t.IsVector()) { - next(); // Consume the peek - return expect_type_decl_vector(t); - } - - if (match(Token::Type::kPtr)) { - return expect_type_decl_pointer(t); - } - - if (match(Token::Type::kAtomic)) { - return expect_type_decl_atomic(t); - } - - if (match(Token::Type::kArray, &source)) { - return expect_type_decl_array(t); - } - - if (t.IsMatrix()) { - next(); // Consume the peek - return expect_type_decl_matrix(t); - } - - auto texture_or_sampler = texture_samplers(); - if (texture_or_sampler.errored) - return Failure::kErrored; - if (texture_or_sampler.matched) - return texture_or_sampler; - - return Failure::kNoMatch; + return type_decl_without_ident(); } Expect ParserImpl::expect_type(std::string_view use) { auto type = type_decl(); - if (type.errored) + if (type.errored) { return Failure::kErrored; - if (!type.matched) + } + if (!type.matched) { return add_error(peek().source(), "invalid type", use); + } return type.value; } -Expect ParserImpl::expect_type_decl_pointer(Token t) { +// LESS_THAN address_space COMMA type_decl ( COMMA access_mode )? GREATER_THAN +Expect ParserImpl::expect_type_decl_pointer(const Source& s) { const char* use = "ptr declaration"; auto storage_class = ast::StorageClass::kNone; auto access = ast::Access::kUndefined; auto subtype = expect_lt_gt_block(use, [&]() -> Expect { - auto sc = expect_storage_class(use); + auto sc = expect_address_space(use); if (sc.errored) { return Failure::kErrored; } @@ -1048,7 +1228,7 @@ Expect ParserImpl::expect_type_decl_pointer(Token t) { } if (match(Token::Type::kComma)) { - auto ac = expect_access("access control"); + auto ac = expect_access_mode("access control"); if (ac.errored) { return Failure::kErrored; } @@ -1062,11 +1242,11 @@ Expect ParserImpl::expect_type_decl_pointer(Token t) { return Failure::kErrored; } - return builder_.ty.pointer(make_source_range_from(t.source()), subtype.value, storage_class, - access); + return builder_.ty.pointer(make_source_range_from(s), subtype.value, storage_class, access); } -Expect ParserImpl::expect_type_decl_atomic(Token t) { +// LESS_THAN type_decl GREATER_THAN +Expect ParserImpl::expect_type_decl_atomic(const Source& s) { const char* use = "atomic declaration"; auto subtype = expect_lt_gt_block(use, [&] { return expect_type(use); }); @@ -1074,147 +1254,128 @@ Expect ParserImpl::expect_type_decl_atomic(Token t) { return Failure::kErrored; } - return builder_.ty.atomic(make_source_range_from(t.source()), subtype.value); + return builder_.ty.atomic(make_source_range_from(s), subtype.value); } -Expect ParserImpl::expect_type_decl_vector(Token t) { - uint32_t count = 2; - if (t.Is(Token::Type::kVec3)) { - count = 3; - } else if (t.Is(Token::Type::kVec4)) { - count = 4; - } - - const ast::Type* subtype = nullptr; - if (peek_is(Token::Type::kLessThan)) { - const char* use = "vector"; - auto ty = expect_lt_gt_block(use, [&] { return expect_type(use); }); - if (ty.errored) { - return Failure::kErrored; - } - subtype = ty.value; - } - - return builder_.ty.vec(make_source_range_from(t.source()), subtype, count); -} - -Expect ParserImpl::expect_type_decl_array(Token t) { - const char* use = "array declaration"; - - const ast::Expression* size = nullptr; - - auto subtype = expect_lt_gt_block(use, [&]() -> Expect { - auto type = expect_type(use); - if (type.errored) - return Failure::kErrored; - - if (match(Token::Type::kComma)) { - auto expr = primary_expression(); - if (expr.errored) { - return Failure::kErrored; - } else if (!expr.matched) { - return add_error(peek(), "expected array size expression"); - } - - size = std::move(expr.value); - } - - return type.value; - }); - - if (subtype.errored) { +// LESS_THAN type_decl GREATER_THAN +Expect ParserImpl::expect_type_decl_vector(const Source& s, uint32_t count) { + const char* use = "vector"; + auto ty = expect_lt_gt_block(use, [&] { return expect_type(use); }); + if (ty.errored) { return Failure::kErrored; } - return builder_.ty.array(make_source_range_from(t.source()), subtype.value, size); + return builder_.ty.vec(make_source_range_from(s), ty.value, count); } -Expect ParserImpl::expect_type_decl_matrix(Token t) { - uint32_t rows = 2; - uint32_t columns = 2; - if (t.IsMat3xN()) { - columns = 3; - } else if (t.IsMat4xN()) { - columns = 4; - } - if (t.IsMatNx3()) { - rows = 3; - } else if (t.IsMatNx4()) { - rows = 4; +// LESS_THAN type_decl ( COMMA element_count_expression )? GREATER_THAN +Expect ParserImpl::expect_type_decl_array(const Source& s) { + const char* use = "array declaration"; + + struct TypeAndSize { + const ast::Type* type = nullptr; + const ast::Expression* size = nullptr; + }; + + if (!peek_is(Token::Type::kLessThan)) { + return add_error(peek(), "expected < for array"); } - const ast::Type* subtype = nullptr; - if (peek_is(Token::Type::kLessThan)) { - const char* use = "matrix"; - auto ty = expect_lt_gt_block(use, [&] { return expect_type(use); }); - if (ty.errored) { + auto type_size = expect_lt_gt_block(use, [&]() -> Expect { + auto type = expect_type(use); + if (type.errored) { return Failure::kErrored; } - subtype = ty.value; + + if (!match(Token::Type::kComma)) { + return TypeAndSize{type.value, nullptr}; + } + + auto size = element_count_expression(); + if (size.errored) { + return Failure::kErrored; + } + if (!size.matched) { + return add_error(peek(), "expected array size expression"); + } + + return TypeAndSize{type.value, size.value}; + }); + + if (type_size.errored) { + return Failure::kErrored; } - return builder_.ty.mat(make_source_range_from(t.source()), subtype, columns, rows); + return builder_.ty.array(make_source_range_from(s), type_size->type, type_size->size); } -// storage_class -// : INPUT -// | OUTPUT -// | UNIFORM -// | WORKGROUP -// | STORAGE -// | PRIVATE -// | FUNCTION -Expect ParserImpl::expect_storage_class(std::string_view use) { - auto source = peek().source(); +// LESS_THAN type_decl GREATER_THAN +Expect ParserImpl::expect_type_decl_matrix(const Source& s, + const MatrixDimensions& dims) { + const char* use = "matrix"; + auto ty = expect_lt_gt_block(use, [&] { return expect_type(use); }); + if (ty.errored) { + return Failure::kErrored; + } - if (match(Token::Type::kUniform)) - return {ast::StorageClass::kUniform, source}; + return builder_.ty.mat(make_source_range_from(s), ty.value, dims.columns, dims.rows); +} - if (match(Token::Type::kWorkgroup)) - return {ast::StorageClass::kWorkgroup, source}; +// address_space +// : 'function' +// | 'private' +// | 'workgroup' +// | 'uniform' +// | 'storage' +// +// Note, we also parse `push_constant` from the experimental extension +Expect ParserImpl::expect_address_space(std::string_view use) { + auto& t = peek(); + auto ident = expect_ident("storage class"); + if (ident.errored) { + return Failure::kErrored; + } - if (match(Token::Type::kStorage)) - return {ast::StorageClass::kStorage, source}; + auto storage_class = ast::ParseStorageClass(ident.value); + if (storage_class == ast::StorageClass::kInvalid) { + return add_error(t.source(), "invalid storage class", use); + } - if (match(Token::Type::kPrivate)) - return {ast::StorageClass::kPrivate, source}; - - if (match(Token::Type::kFunction)) - return {ast::StorageClass::kFunction, source}; - - return add_error(source, "invalid storage class", use); + return {storage_class, t.source()}; } // struct_decl // : STRUCT IDENT struct_body_decl Maybe ParserImpl::struct_decl() { - auto t = peek(); - auto source = t.source(); + auto& t = peek(); - if (!match(Token::Type::kStruct)) + if (!match(Token::Type::kStruct)) { return Failure::kNoMatch; + } auto name = expect_ident("struct declaration"); - if (name.errored) + if (name.errored) { return Failure::kErrored; + } auto body = expect_struct_body_decl(); - if (body.errored) + if (body.errored) { return Failure::kErrored; + } auto sym = builder_.Symbols().Register(name.value); - return create(source, sym, std::move(body.value), ast::AttributeList{}); + return create(t.source(), sym, std::move(body.value), utils::Empty); } // struct_body_decl // : BRACE_LEFT (struct_member COMMA)* struct_member COMMA? BRACE_RIGHT -Expect ParserImpl::expect_struct_body_decl() { - return expect_brace_block("struct declaration", [&]() -> Expect { - ast::StructMemberList members; +Expect ParserImpl::expect_struct_body_decl() { + return expect_brace_block("struct declaration", [&]() -> Expect { + StructMemberList members; bool errored = false; while (continue_parsing()) { // Check for the end of the list. - auto t = peek(); + auto& t = peek(); if (!t.IsIdentifier() && !t.Is(Token::Type::kAttr)) { break; } @@ -1226,17 +1387,12 @@ Expect ParserImpl::expect_struct_body_decl() { return Failure::kErrored; } } else { - members.push_back(member.value); + members.Push(member.value); } - // TODO(crbug.com/tint/1475): Remove support for semicolons. - if (auto sc = peek(); sc.Is(Token::Type::kSemicolon)) { - deprecated(sc.source(), "struct members should be separated with commas"); - next(); - continue; - } - if (!match(Token::Type::kComma)) + if (!match(Token::Type::kComma)) { break; + } } if (errored) { return Failure::kErrored; @@ -1246,24 +1402,45 @@ Expect ParserImpl::expect_struct_body_decl() { } // struct_member -// : attribute* variable_ident_decl +// : attribute* ident_with_type_decl Expect ParserImpl::expect_struct_member() { auto attrs = attribute_list(); if (attrs.errored) { return Failure::kErrored; } - auto decl = expect_variable_ident_decl("struct member"); - if (decl.errored) + auto decl = expect_ident_with_type_decl("struct member"); + if (decl.errored) { return Failure::kErrored; + } return create(decl->source, builder_.Symbols().Register(decl->name), decl->type, std::move(attrs.value)); } +// static_assert_statement +// : STATIC_ASSERT expression +Maybe ParserImpl::static_assert_statement() { + Source start; + if (!match(Token::Type::kStaticAssert, &start)) { + return Failure::kNoMatch; + } + + auto condition = expression(); + if (condition.errored) { + return Failure::kErrored; + } + if (!condition.matched) { + return add_error(peek(), "unable to parse condition expression"); + } + + Source source = make_source_range_from(start); + return create(source, condition.value); +} + // function_decl -// : function_header body_stmt -Maybe ParserImpl::function_decl(ast::AttributeList& attrs) { +// : function_header compound_statement +Maybe ParserImpl::function_decl(AttributeList& attrs) { auto header = function_header(); if (header.errored) { if (sync_to(Token::Type::kBraceLeft, /* consume: */ false)) { @@ -1273,24 +1450,29 @@ Maybe ParserImpl::function_decl(ast::AttributeList& attrs) // function body. The AST isn't used as we've already errored, but this // catches any errors inside the body, and can help keep the parser in // sync. - expect_body_stmt(); + expect_compound_statement(); } return Failure::kErrored; } - if (!header.matched) + if (!header.matched) { return Failure::kNoMatch; + } bool errored = false; - auto body = expect_body_stmt(); - if (body.errored) + auto body = expect_compound_statement(); + if (body.errored) { errored = true; + } - if (errored) + if (errored) { return Failure::kErrored; + } + + TINT_DEFER(attrs.Clear()); return create(header->source, builder_.Symbols().Register(header->name), - header->params, header->return_type, body.value, attrs, + header->params, header->return_type, body.value, std::move(attrs), header->return_type_attributes); } @@ -1325,7 +1507,7 @@ Maybe ParserImpl::function_header() { } const ast::Type* return_type = nullptr; - ast::AttributeList return_attributes; + AttributeList return_attributes; if (match(Token::Type::kArrow)) { auto attrs = attribute_list(); @@ -1350,113 +1532,172 @@ Maybe ParserImpl::function_header() { return Failure::kErrored; } - return FunctionHeader{source, name.value, std::move(params.value), return_type, - std::move(return_attributes)}; + return FunctionHeader{ + source, std::move(name.value), std::move(params.value), + return_type, std::move(return_attributes), + }; } // param_list // : // | (param COMMA)* param COMMA? -Expect ParserImpl::expect_param_list() { - ast::VariableList ret; +Expect ParserImpl::expect_param_list() { + ParameterList ret; while (continue_parsing()) { // Check for the end of the list. - auto t = peek(); + auto& t = peek(); if (!t.IsIdentifier() && !t.Is(Token::Type::kAttr)) { break; } auto param = expect_param(); - if (param.errored) + if (param.errored) { return Failure::kErrored; - ret.push_back(param.value); + } + ret.Push(param.value); - if (!match(Token::Type::kComma)) + if (!match(Token::Type::kComma)) { break; + } } return ret; } // param -// : attribute_list* variable_ident_decl -Expect ParserImpl::expect_param() { +// : attribute_list* ident COLON type_decl +Expect ParserImpl::expect_param() { auto attrs = attribute_list(); - auto decl = expect_variable_ident_decl("parameter"); - if (decl.errored) + auto decl = expect_ident_with_type_decl("parameter"); + if (decl.errored) { return Failure::kErrored; + } - auto* var = create(decl->source, // source - builder_.Symbols().Register(decl->name), // symbol - ast::StorageClass::kNone, // storage class - ast::Access::kUndefined, // access control - decl->type, // type - true, // is_const - false, // is_overridable - nullptr, // constructor - std::move(attrs.value)); // attributes - // Formal parameters are treated like a const declaration where the - // initializer value is provided by the call's argument. The key point is - // that it's not updatable after initially set. This is unlike C or GLSL - // which treat formal parameters like local variables that can be updated. - - return var; + return create(decl->source, // source + builder_.Symbols().Register(decl->name), // symbol + decl->type, // type + std::move(attrs.value)); // attributes } // pipeline_stage // : VERTEX // | FRAGMENT // | COMPUTE +// +// TODO(crbug.com/tint/1503): Remove when deprecation period is over. Expect ParserImpl::expect_pipeline_stage() { - auto t = peek(); - if (t == kVertexStage) { + auto& t = peek(); + if (t == "vertex") { next(); // Consume the peek return {ast::PipelineStage::kVertex, t.source()}; } - if (t == kFragmentStage) { + if (t == "fragment") { next(); // Consume the peek return {ast::PipelineStage::kFragment, t.source()}; } - if (t == kComputeStage) { + if (t == "compute") { next(); // Consume the peek return {ast::PipelineStage::kCompute, t.source()}; } return add_error(peek(), "invalid value for stage attribute"); } -Expect ParserImpl::expect_builtin() { - auto ident = expect_ident("builtin"); - if (ident.errored) +// interpolation_sample_name +// : 'center' +// | 'centroid' +// | 'sample' +Expect ParserImpl::expect_interpolation_sample_name() { + auto ident = expect_ident("interpolation sample name"); + if (ident.errored) { return Failure::kErrored; + } - ast::Builtin builtin = ident_to_builtin(ident.value); - if (builtin == ast::Builtin::kNone) + if (ident.value == "center") { + return {ast::InterpolationSampling::kCenter, ident.source}; + } + if (ident.value == "centroid") { + return {ast::InterpolationSampling::kCentroid, ident.source}; + } + if (ident.value == "sample") { + return {ast::InterpolationSampling::kSample, ident.source}; + } + return add_error(ident.source, "invalid interpolation sampling"); +} + +// interpolation_type_name +// : 'perspective' +// | 'linear' +// | 'flat' +Expect ParserImpl::expect_interpolation_type_name() { + auto ident = expect_ident("interpolation type name"); + if (ident.errored) { + return Failure::kErrored; + } + + if (ident.value == "perspective") { + return {ast::InterpolationType::kPerspective, ident.source}; + } + if (ident.value == "linear") { + return {ast::InterpolationType::kLinear, ident.source}; + } + if (ident.value == "flat") { + return {ast::InterpolationType::kFlat, ident.source}; + } + + return add_error(ident.source, "invalid interpolation type"); +} + +// builtin_value_name +// : frag_depth +// | front_facing +// | global_invocation_id +// | instance_index +// | local_invocation_id +// | local_invocation_index +// | num_workgroups +// | position +// | sample_index +// | sample_mask +// | vertex_index +// | workgroup_id +Expect ParserImpl::expect_builtin() { + auto ident = expect_ident("builtin"); + if (ident.errored) { + return Failure::kErrored; + } + + ast::BuiltinValue builtin = ast::ParseBuiltinValue(ident.value); + if (builtin == ast::BuiltinValue::kInvalid) { return add_error(ident.source, "invalid value for builtin attribute"); + } return {builtin, ident.source}; } -// body_stmt -// : BRACE_LEFT statements BRACE_RIGHT -Expect ParserImpl::expect_body_stmt() { +// compound_statement +// : BRACE_LEFT statement* BRACE_RIGHT +Expect ParserImpl::expect_compound_statement() { return expect_brace_block("", [&]() -> Expect { auto stmts = expect_statements(); - if (stmts.errored) + if (stmts.errored) { return Failure::kErrored; + } return create(Source{}, stmts.value); }); } -// paren_rhs_stmt -// : PAREN_LEFT logical_or_expression PAREN_RIGHT -Expect ParserImpl::expect_paren_rhs_stmt() { +// paren_expression +// : PAREN_LEFT expression PAREN_RIGHT +Expect ParserImpl::expect_paren_expression() { return expect_paren_block("", [&]() -> Expect { - auto expr = logical_or_expression(); - if (expr.errored) + auto expr = expression(); + if (expr.errored) { return Failure::kErrored; - if (!expr.matched) + } + if (!expr.matched) { return add_error(peek(), "unable to parse expression"); + } return expr.value; }); @@ -1464,239 +1705,303 @@ Expect ParserImpl::expect_paren_rhs_stmt() { // statements // : statement* -Expect ParserImpl::expect_statements() { +Expect ParserImpl::expect_statements() { bool errored = false; - ast::StatementList stmts; + StatementList stmts; while (continue_parsing()) { auto stmt = statement(); if (stmt.errored) { errored = true; } else if (stmt.matched) { - stmts.emplace_back(stmt.value); + stmts.Push(stmt.value); } else { break; } } - if (errored) + if (errored) { return Failure::kErrored; + } return stmts; } // statement // : SEMICOLON -// | body_stmt? -// | if_stmt -// | switch_stmt -// | loop_stmt -// | for_stmt -// | non_block_statement -// : return_stmt SEMICOLON -// | func_call_stmt SEMICOLON -// | variable_stmt SEMICOLON -// | break_stmt SEMICOLON -// | continue_stmt SEMICOLON -// | DISCARD SEMICOLON -// | assignment_stmt SEMICOLON -// | increment_stmt SEMICOLON -// | decrement_stmt SEMICOLON +// | if_statement +// | switch_statement +// | loop_statement +// | for_statement +// | while_statement +// | compound_statement +// | non_block_statement // Note, we inject an extra rule in here for simpler parsing Maybe ParserImpl::statement() { while (match(Token::Type::kSemicolon)) { // Skip empty statements } - // Non-block statments that error can resynchronize on semicolon. + // Non-block statements that error can resynchronize on semicolon. auto stmt = sync(Token::Type::kSemicolon, [&] { return non_block_statement(); }); - - if (stmt.errored) + if (stmt.errored) { return Failure::kErrored; - if (stmt.matched) + } + if (stmt.matched) { return stmt; + } - auto stmt_if = if_stmt(); - if (stmt_if.errored) + auto stmt_if = if_statement(); + if (stmt_if.errored) { return Failure::kErrored; - if (stmt_if.matched) + } + if (stmt_if.matched) { return stmt_if.value; + } - auto sw = switch_stmt(); - if (sw.errored) + auto sw = switch_statement(); + if (sw.errored) { return Failure::kErrored; - if (sw.matched) + } + if (sw.matched) { return sw.value; + } - auto loop = loop_stmt(); - if (loop.errored) + auto loop = loop_statement(); + if (loop.errored) { return Failure::kErrored; - if (loop.matched) + } + if (loop.matched) { return loop.value; + } - auto stmt_for = for_stmt(); - if (stmt_for.errored) + auto stmt_for = for_statement(); + if (stmt_for.errored) { return Failure::kErrored; - if (stmt_for.matched) + } + if (stmt_for.matched) { return stmt_for.value; + } + + auto stmt_while = while_statement(); + if (stmt_while.errored) { + return Failure::kErrored; + } + if (stmt_while.matched) { + return stmt_while.value; + } if (peek_is(Token::Type::kBraceLeft)) { - auto body = expect_body_stmt(); - if (body.errored) + auto body = expect_compound_statement(); + if (body.errored) { return Failure::kErrored; + } return body.value; } return Failure::kNoMatch; } -// statement (continued) -// : return_stmt SEMICOLON -// | func_call_stmt SEMICOLON -// | variable_stmt SEMICOLON -// | break_stmt SEMICOLON -// | continue_stmt SEMICOLON +// non_block_statement (continued) +// : return_statement SEMICOLON +// | func_call_statement SEMICOLON +// | variable_statement SEMICOLON +// | break_statement SEMICOLON +// | continue_statement SEMICOLON // | DISCARD SEMICOLON -// | assignment_stmt SEMICOLON -// | increment_stmt SEMICOLON -// | decrement_stmt SEMICOLON +// | variable_updating_statement SEMICOLON +// | static_assert_statement SEMICOLON Maybe ParserImpl::non_block_statement() { auto stmt = [&]() -> Maybe { - auto ret_stmt = return_stmt(); - if (ret_stmt.errored) + auto ret_stmt = return_statement(); + if (ret_stmt.errored) { return Failure::kErrored; - if (ret_stmt.matched) + } + if (ret_stmt.matched) { return ret_stmt.value; + } - auto func = func_call_stmt(); - if (func.errored) + auto func = func_call_statement(); + if (func.errored) { return Failure::kErrored; - if (func.matched) + } + if (func.matched) { return func.value; + } - auto var = variable_stmt(); - if (var.errored) + auto var = variable_statement(); + if (var.errored) { return Failure::kErrored; - if (var.matched) + } + if (var.matched) { return var.value; + } - auto b = break_stmt(); - if (b.errored) + auto b = break_statement(); + if (b.errored) { return Failure::kErrored; - if (b.matched) + } + if (b.matched) { return b.value; + } - auto cont = continue_stmt(); - if (cont.errored) + auto cont = continue_statement(); + if (cont.errored) { return Failure::kErrored; - if (cont.matched) + } + if (cont.matched) { return cont.value; - - auto assign = assignment_stmt(); - if (assign.errored) - return Failure::kErrored; - if (assign.matched) - return assign.value; + } Source source; - if (match(Token::Type::kDiscard, &source)) + if (match(Token::Type::kDiscard, &source)) { return create(source); + } + + // Note, this covers assignment, increment and decrement + auto assign = variable_updating_statement(); + if (assign.errored) { + return Failure::kErrored; + } + if (assign.matched) { + return assign.value; + } + + auto stmt_static_assert = static_assert_statement(); + if (stmt_static_assert.errored) { + return Failure::kErrored; + } + if (stmt_static_assert.matched) { + return stmt_static_assert.value; + } return Failure::kNoMatch; }(); - if (stmt.matched && !expect(stmt->Name(), Token::Type::kSemicolon)) + if (stmt.matched && !expect(stmt->Name(), Token::Type::kSemicolon)) { return Failure::kErrored; - + } return stmt; } -// return_stmt -// : RETURN logical_or_expression? -Maybe ParserImpl::return_stmt() { +// return_statement +// : RETURN expression? +Maybe ParserImpl::return_statement() { Source source; - if (!match(Token::Type::kReturn, &source)) + if (!match(Token::Type::kReturn, &source)) { return Failure::kNoMatch; + } - if (peek_is(Token::Type::kSemicolon)) + if (peek_is(Token::Type::kSemicolon)) { return create(source, nullptr); + } - auto expr = logical_or_expression(); - if (expr.errored) + auto expr = expression(); + if (expr.errored) { return Failure::kErrored; + } // TODO(bclayton): Check matched? return create(source, expr.value); } -// variable_stmt +// variable_statement // : variable_decl -// | variable_decl EQUAL logical_or_expression -// | CONST variable_ident_decl EQUAL logical_or_expression -Maybe ParserImpl::variable_stmt() { - if (match(Token::Type::kLet)) { - auto decl = expect_variable_ident_decl("let declaration", - /*allow_inferred = */ true); - if (decl.errored) +// | variable_decl EQUAL expression +// | LET optionally_typed_ident EQUAL expression +// | CONST optionally_typed_ident EQUAL expression +Maybe ParserImpl::variable_statement() { + if (match(Token::Type::kConst)) { + auto decl = expect_optionally_typed_ident("'const' declaration"); + if (decl.errored) { return Failure::kErrored; + } - if (!expect("let declaration", Token::Type::kEqual)) + if (!expect("'const' declaration", Token::Type::kEqual)) { return Failure::kErrored; + } - auto constructor = logical_or_expression(); - if (constructor.errored) + auto initializer = expression(); + if (initializer.errored) { return Failure::kErrored; - if (!constructor.matched) - return add_error(peek(), "missing constructor for let declaration"); + } + if (!initializer.matched) { + return add_error(peek(), "missing initializer for 'const' declaration"); + } - auto* var = create(decl->source, // source + auto* const_ = create(decl->source, // source builder_.Symbols().Register(decl->name), // symbol - ast::StorageClass::kNone, // storage class - ast::Access::kUndefined, // access control - decl->type, // type - true, // is_const - false, // is_overridable - constructor.value, // constructor - ast::AttributeList{}); // attributes + decl->type, // type + initializer.value, // initializer + utils::Empty); // attributes - return create(decl->source, var); + return create(decl->source, const_); } - auto decl = variable_decl(/*allow_inferred = */ true); - if (decl.errored) - return Failure::kErrored; - if (!decl.matched) - return Failure::kNoMatch; - - const ast::Expression* constructor = nullptr; - if (match(Token::Type::kEqual)) { - auto constructor_expr = logical_or_expression(); - if (constructor_expr.errored) + if (match(Token::Type::kLet)) { + auto decl = expect_optionally_typed_ident("'let' declaration"); + if (decl.errored) { return Failure::kErrored; - if (!constructor_expr.matched) - return add_error(peek(), "missing constructor for variable declaration"); + } - constructor = constructor_expr.value; + if (!expect("'let' declaration", Token::Type::kEqual)) { + return Failure::kErrored; + } + + auto initializer = expression(); + if (initializer.errored) { + return Failure::kErrored; + } + if (!initializer.matched) { + return add_error(peek(), "missing initializer for 'let' declaration"); + } + + auto* let = create(decl->source, // source + builder_.Symbols().Register(decl->name), // symbol + decl->type, // type + initializer.value, // initializer + utils::Empty); // attributes + + return create(decl->source, let); } - auto* var = create(decl->source, // source - builder_.Symbols().Register(decl->name), // symbol - decl->storage_class, // storage class - decl->access, // access control - decl->type, // type - false, // is_const - false, // is_overridable - constructor, // constructor - ast::AttributeList{}); // attributes + auto decl = variable_decl(); + if (decl.errored) { + return Failure::kErrored; + } + if (!decl.matched) { + return Failure::kNoMatch; + } + + const ast::Expression* initializer = nullptr; + if (match(Token::Type::kEqual)) { + auto initializer_expr = expression(); + if (initializer_expr.errored) { + return Failure::kErrored; + } + if (!initializer_expr.matched) { + return add_error(peek(), "missing initializer for 'var' declaration"); + } + + initializer = initializer_expr.value; + } + + auto* var = create(decl->source, // source + builder_.Symbols().Register(decl->name), // symbol + decl->type, // type + decl->storage_class, // storage class + decl->access, // access control + initializer, // initializer + utils::Empty); // attributes return create(var->source, var); } -// if_stmt +// if_statement // : IF expression compound_stmt ( ELSE else_stmt ) ? // else_stmt -// : body_stmt -// | if_stmt -Maybe ParserImpl::if_stmt() { +// : compound_statement +// | if_statement +Maybe ParserImpl::if_statement() { // Parse if-else chains iteratively instead of recursively, to avoid // stack-overflow for long chains of if-else statements. @@ -1713,7 +2018,7 @@ Maybe ParserImpl::if_stmt() { return Failure::kNoMatch; } - auto condition = logical_or_expression(); + auto condition = expression(); if (condition.errored) { return Failure::kErrored; } @@ -1721,7 +2026,7 @@ Maybe ParserImpl::if_stmt() { return add_error(peek(), "unable to parse condition expression"); } - auto body = expect_body_stmt(); + auto body = expect_compound_statement(); if (body.errored) { return Failure::kErrored; } @@ -1757,7 +2062,7 @@ Maybe ParserImpl::if_stmt() { } // If it wasn't an "else if", it must just be an "else". - auto else_body = expect_body_stmt(); + auto else_body = expect_compound_statement(); if (else_body.errored) { return Failure::kErrored; } @@ -1773,40 +2078,45 @@ Maybe ParserImpl::if_stmt() { return last_stmt->As(); } -// switch_stmt -// : SWITCH paren_rhs_stmt BRACKET_LEFT switch_body+ BRACKET_RIGHT -Maybe ParserImpl::switch_stmt() { +// switch_statement +// : SWITCH expression BRACKET_LEFT switch_body+ BRACKET_RIGHT +Maybe ParserImpl::switch_statement() { Source source; - if (!match(Token::Type::kSwitch, &source)) + if (!match(Token::Type::kSwitch, &source)) { return Failure::kNoMatch; + } - auto condition = logical_or_expression(); - if (condition.errored) + auto condition = expression(); + if (condition.errored) { return Failure::kErrored; + } if (!condition.matched) { return add_error(peek(), "unable to parse selector expression"); } - auto body = expect_brace_block("switch statement", [&]() -> Expect { + auto body = expect_brace_block("switch statement", [&]() -> Expect { bool errored = false; - ast::CaseStatementList list; + CaseStatementList list; while (continue_parsing()) { auto stmt = switch_body(); if (stmt.errored) { errored = true; continue; } - if (!stmt.matched) + if (!stmt.matched) { break; - list.push_back(stmt.value); + } + list.Push(stmt.value); } - if (errored) + if (errored) { return Failure::kErrored; + } return list; }); - if (body.errored) + if (body.errored) { return Failure::kErrored; + } return create(source, condition.value, body.value); } @@ -1815,17 +2125,18 @@ Maybe ParserImpl::switch_stmt() { // : CASE case_selectors COLON? BRACKET_LEFT case_body BRACKET_RIGHT // | DEFAULT COLON? BRACKET_LEFT case_body BRACKET_RIGHT Maybe ParserImpl::switch_body() { - if (!peek_is(Token::Type::kCase) && !peek_is(Token::Type::kDefault)) + if (!peek_is(Token::Type::kCase) && !peek_is(Token::Type::kDefault)) { return Failure::kNoMatch; + } - auto t = next(); - auto source = t.source(); + auto& t = next(); - ast::CaseSelectorList selector_list; + CaseSelectorList selector_list; if (t.Is(Token::Type::kCase)) { auto selectors = expect_case_selectors(); - if (selectors.errored) + if (selectors.errored) { return Failure::kErrored; + } selector_list = std::move(selectors.value); } @@ -1836,18 +2147,20 @@ Maybe ParserImpl::switch_body() { const char* use = "case statement"; auto body = expect_brace_block(use, [&] { return case_body(); }); - if (body.errored) + if (body.errored) { return Failure::kErrored; - if (!body.matched) + } + if (!body.matched) { return add_error(body.source, "expected case body"); + } - return create(source, selector_list, body.value); + return create(t.source(), selector_list, body.value); } // case_selectors // : const_literal (COMMA const_literal)* COMMA? -Expect ParserImpl::expect_case_selectors() { - ast::CaseSelectorList selectors; +Expect ParserImpl::expect_case_selectors() { + CaseSelectorList selectors; while (continue_parsing()) { auto cond = const_literal(); @@ -1859,15 +2172,16 @@ Expect ParserImpl::expect_case_selectors() { return add_error(cond.value->source, "invalid case selector must be an integer value"); } - selectors.push_back(cond.value->As()); + selectors.Push(cond.value->As()); if (!match(Token::Type::kComma)) { break; } } - if (selectors.empty()) + if (selectors.IsEmpty()) { return add_error(peek(), "unable to parse case selectors"); + } return selectors; } @@ -1877,44 +2191,55 @@ Expect ParserImpl::expect_case_selectors() { // | statement case_body // | FALLTHROUGH SEMICOLON Maybe ParserImpl::case_body() { - ast::StatementList stmts; + StatementList stmts; while (continue_parsing()) { Source source; if (match(Token::Type::kFallthrough, &source)) { - if (!expect("fallthrough statement", Token::Type::kSemicolon)) + if (!expect("fallthrough statement", Token::Type::kSemicolon)) { return Failure::kErrored; + } - stmts.emplace_back(create(source)); + deprecated(source, + "fallthrough is set to be removed from WGSL. " + "Case can accept multiple selectors if the existing case bodies are empty. " + "default is not yet supported in a case selector list."); + + stmts.Push(create(source)); break; } auto stmt = statement(); - if (stmt.errored) + if (stmt.errored) { return Failure::kErrored; - if (!stmt.matched) + } + if (!stmt.matched) { break; + } - stmts.emplace_back(stmt.value); + stmts.Push(stmt.value); } return create(Source{}, stmts); } -// loop_stmt -// : LOOP BRACKET_LEFT statements continuing_stmt? BRACKET_RIGHT -Maybe ParserImpl::loop_stmt() { +// loop_statement +// : LOOP BRACKET_LEFT statements continuing_statement? BRACKET_RIGHT +Maybe ParserImpl::loop_statement() { Source source; - if (!match(Token::Type::kLoop, &source)) + if (!match(Token::Type::kLoop, &source)) { return Failure::kNoMatch; + } return expect_brace_block("loop", [&]() -> Maybe { auto stmts = expect_statements(); - if (stmts.errored) + if (stmts.errored) { return Failure::kErrored; + } - auto continuing = continuing_stmt(); - if (continuing.errored) + auto continuing = continuing_statement(); + if (continuing.errored) { return Failure::kErrored; + } auto* body = create(source, stmts.value); return create(source, body, continuing.value); @@ -1928,156 +2253,304 @@ ForHeader::ForHeader(const ast::Statement* init, ForHeader::~ForHeader() = default; -// (variable_stmt | increment_stmt | decrement_stmt | assignment_stmt | -// func_call_stmt)? +// (variable_statement | variable_updating_statement | +// func_call_statement)? Maybe ParserImpl::for_header_initializer() { - auto call = func_call_stmt(); - if (call.errored) + auto call = func_call_statement(); + if (call.errored) { return Failure::kErrored; - if (call.matched) + } + if (call.matched) { return call.value; + } - auto var = variable_stmt(); - if (var.errored) + auto var = variable_statement(); + if (var.errored) { return Failure::kErrored; - if (var.matched) + } + if (var.matched) { return var.value; + } - auto assign = assignment_stmt(); - if (assign.errored) + auto assign = variable_updating_statement(); + if (assign.errored) { return Failure::kErrored; - if (assign.matched) + } + if (assign.matched) { return assign.value; + } return Failure::kNoMatch; } -// (increment_stmt | decrement_stmt | assignment_stmt | func_call_stmt)? +// (variable_updating_statement | func_call_statement)? Maybe ParserImpl::for_header_continuing() { - auto call_stmt = func_call_stmt(); - if (call_stmt.errored) + auto call_stmt = func_call_statement(); + if (call_stmt.errored) { return Failure::kErrored; - if (call_stmt.matched) + } + if (call_stmt.matched) { return call_stmt.value; + } - auto assign = assignment_stmt(); - if (assign.errored) + auto assign = variable_updating_statement(); + if (assign.errored) { return Failure::kErrored; - if (assign.matched) + } + if (assign.matched) { return assign.value; + } return Failure::kNoMatch; } // for_header -// : (variable_stmt | assignment_stmt | func_call_stmt)? +// : (variable_statement | variable_updating_statement | func_call_statement)? // SEMICOLON -// logical_or_expression? SEMICOLON -// (assignment_stmt | func_call_stmt)? +// expression? SEMICOLON +// (variable_updating_statement | func_call_statement)? Expect> ParserImpl::expect_for_header() { auto initializer = for_header_initializer(); - if (initializer.errored) + if (initializer.errored) { return Failure::kErrored; + } - if (!expect("initializer in for loop", Token::Type::kSemicolon)) + if (!expect("initializer in for loop", Token::Type::kSemicolon)) { return Failure::kErrored; + } - auto condition = logical_or_expression(); - if (condition.errored) + auto condition = expression(); + if (condition.errored) { return Failure::kErrored; + } - if (!expect("condition in for loop", Token::Type::kSemicolon)) + if (!expect("condition in for loop", Token::Type::kSemicolon)) { return Failure::kErrored; + } auto continuing = for_header_continuing(); - if (continuing.errored) + if (continuing.errored) { return Failure::kErrored; + } return std::make_unique(initializer.value, condition.value, continuing.value); } // for_statement // : FOR PAREN_LEFT for_header PAREN_RIGHT BRACE_LEFT statements BRACE_RIGHT -Maybe ParserImpl::for_stmt() { +Maybe ParserImpl::for_statement() { Source source; - if (!match(Token::Type::kFor, &source)) + if (!match(Token::Type::kFor, &source)) { return Failure::kNoMatch; + } auto header = expect_paren_block("for loop", [&] { return expect_for_header(); }); - if (header.errored) + if (header.errored) { return Failure::kErrored; + } auto stmts = expect_brace_block("for loop", [&] { return expect_statements(); }); - if (stmts.errored) + if (stmts.errored) { return Failure::kErrored; + } return create(source, header->initializer, header->condition, header->continuing, create(stmts.value)); } -// func_call_stmt -// : IDENT argument_expression_list -Maybe ParserImpl::func_call_stmt() { - auto t = peek(); - auto t2 = peek(1); - if (!t.IsIdentifier() || !t2.Is(Token::Type::kParenLeft)) +// while_statement +// : WHILE expression compound_statement +Maybe ParserImpl::while_statement() { + Source source; + if (!match(Token::Type::kWhile, &source)) { return Failure::kNoMatch; + } + + auto condition = expression(); + if (condition.errored) { + return Failure::kErrored; + } + if (!condition.matched) { + return add_error(peek(), "unable to parse while condition expression"); + } + + auto body = expect_compound_statement(); + if (body.errored) { + return Failure::kErrored; + } + + return create(source, condition.value, body.value); +} + +// func_call_statement +// : IDENT argument_expression_list +Maybe ParserImpl::func_call_statement() { + auto& t = peek(); + auto& t2 = peek(1); + if (!t.IsIdentifier() || !t2.Is(Token::Type::kParenLeft)) { + return Failure::kNoMatch; + } next(); // Consume the first peek - auto source = t.source(); - auto name = t.to_str(); - auto params = expect_argument_expression_list("function call"); - if (params.errored) + if (params.errored) { return Failure::kErrored; + } return create( - source, + t.source(), create( - source, create(source, builder_.Symbols().Register(name)), + t.source(), + create(t.source(), builder_.Symbols().Register(t.to_str())), std::move(params.value))); } -// break_stmt +// break_statement // : BREAK -Maybe ParserImpl::break_stmt() { +Maybe ParserImpl::break_statement() { Source source; - if (!match(Token::Type::kBreak, &source)) + if (!match(Token::Type::kBreak, &source)) { return Failure::kNoMatch; + } return create(source); } -// continue_stmt +// continue_statement // : CONTINUE -Maybe ParserImpl::continue_stmt() { +Maybe ParserImpl::continue_statement() { Source source; - if (!match(Token::Type::kContinue, &source)) + if (!match(Token::Type::kContinue, &source)) { return Failure::kNoMatch; + } return create(source); } -// continuing_stmt -// : CONTINUING body_stmt -Maybe ParserImpl::continuing_stmt() { - if (!match(Token::Type::kContinuing)) - return create(Source{}, ast::StatementList{}); +// break_if_statement: +// 'break' 'if' expression semicolon +Maybe ParserImpl::break_if_statement() { + // TODO(crbug.com/tint/1451): Add support for break-if + return Failure::kNoMatch; +} - return expect_body_stmt(); +// continuing_compound_statement: +// brace_left statement* break_if_statement? brace_right +Maybe ParserImpl::continuing_compound_statement() { + return expect_brace_block("", [&]() -> Expect { + auto stmts = expect_statements(); + if (stmts.errored) { + return Failure::kErrored; + } + + auto break_if = break_if_statement(); + if (break_if.errored) { + return Failure::kErrored; + } + if (break_if.matched) { + stmts.value.Push(break_if.value); + } + + return create(Source{}, stmts.value); + }); +} + +// continuing_statement +// : CONTINUING continuing_compound_statement +Maybe ParserImpl::continuing_statement() { + if (!match(Token::Type::kContinuing)) { + return create(Source{}, utils::Empty); + } + + return continuing_compound_statement(); +} + +// callable +// : type_decl_without_ident +// | ARRAY +// | mat_prefix +// | vec_prefix +// +// Note, `ident` is pulled out to `primary_expression` as it's the only one that +// doesn't create a `type`. Then we can just return a `type` from here on match and +// deal with `ident` in `primary_expression. +Maybe ParserImpl::callable() { + auto& t = peek(); + + // This _must_ match `type_decl_without_ident` before any of the other types as they're all + // prefixes of the types and we want to match the longer `vec3` then the shorter + // prefix match of `vec3`. + auto ty = type_decl_without_ident(); + if (ty.errored) { + return Failure::kErrored; + } + if (ty.matched) { + return ty.value; + } + + if (match(Token::Type::kArray)) { + return builder_.ty.array(make_source_range_from(t.source()), nullptr, nullptr); + } + + auto vec = vec_prefix(); + if (vec.matched) { + return builder_.ty.vec(make_source_range_from(t.source()), nullptr, vec.value); + } + + auto mat = mat_prefix(); + if (mat.matched) { + return builder_.ty.mat(make_source_range_from(t.source()), nullptr, mat.value.columns, + mat.value.rows); + } + + return Failure::kNoMatch; } // primary_expression -// : IDENT argument_expression_list? -// | type_decl argument_expression_list +// : BITCAST LESS_THAN type_decl GREATER_THAN paren_expression +// | callable argument_expression_list // | const_literal -// | paren_rhs_stmt -// | BITCAST LESS_THAN type_decl GREATER_THAN paren_rhs_stmt +// | IDENT argument_expression_list? +// | paren_expression +// +// Note, PAREN_LEFT ( expression ( COMMA expression ) * COMMA? )? PAREN_RIGHT is replaced +// with `argument_expression_list`. +// +// Note, this is matching the `callable` ident here instead of having to come from +// callable so we can return a `type` from callable. Maybe ParserImpl::primary_expression() { - auto t = peek(); - auto source = t.source(); + auto& t = peek(); + + if (match(Token::Type::kBitcast)) { + const char* use = "bitcast expression"; + + auto type = expect_lt_gt_block(use, [&] { return expect_type(use); }); + if (type.errored) { + return Failure::kErrored; + } + + auto params = expect_paren_expression(); + if (params.errored) { + return Failure::kErrored; + } + + return create(t.source(), type.value, params.value); + } + + auto call = callable(); + if (call.errored) { + return Failure::kErrored; + } + if (call.matched) { + auto params = expect_argument_expression_list("type constructor"); + if (params.errored) { + return Failure::kErrored; + } + + return builder_.Construct(t.source(), call.value, std::move(params.value)); + } auto lit = const_literal(); if (lit.errored) { @@ -2087,29 +2560,6 @@ Maybe ParserImpl::primary_expression() { return lit.value; } - if (t.Is(Token::Type::kParenLeft)) { - auto paren = expect_paren_rhs_stmt(); - if (paren.errored) { - return Failure::kErrored; - } - - return paren.value; - } - - if (match(Token::Type::kBitcast)) { - const char* use = "bitcast expression"; - - auto type = expect_lt_gt_block(use, [&] { return expect_type(use); }); - if (type.errored) - return Failure::kErrored; - - auto params = expect_paren_rhs_stmt(); - if (params.errored) - return Failure::kErrored; - - return create(source, type.value, params.value); - } - if (t.IsIdentifier()) { next(); @@ -2118,24 +2568,23 @@ Maybe ParserImpl::primary_expression() { if (peek_is(Token::Type::kParenLeft)) { auto params = expect_argument_expression_list("function call"); - if (params.errored) + if (params.errored) { return Failure::kErrored; + } - return create(source, ident, std::move(params.value)); + return create(t.source(), ident, std::move(params.value)); } return ident; } - auto type = type_decl(); - if (type.errored) - return Failure::kErrored; - if (type.matched) { - auto params = expect_argument_expression_list("type constructor"); - if (params.errored) + if (t.Is(Token::Type::kParenLeft)) { + auto paren = expect_paren_expression(); + if (paren.errored) { return Failure::kErrored; + } - return builder_.Construct(source, type.value, std::move(params.value)); + return paren.value; } return Failure::kNoMatch; @@ -2143,17 +2592,19 @@ Maybe ParserImpl::primary_expression() { // postfix_expression // : -// | BRACE_LEFT logical_or_expression BRACE_RIGHT postfix_expr -// | PERIOD IDENTIFIER postfix_expr +// | BRACE_LEFT expression BRACE_RIGHT postfix_expression? +// | PERIOD member_ident postfix_expression? +// | PERIOD swizzle_name postfix_expression? Maybe ParserImpl::postfix_expression(const ast::Expression* prefix) { Source source; while (continue_parsing()) { if (match(Token::Type::kBracketLeft, &source)) { auto res = sync(Token::Type::kBracketRight, [&]() -> Maybe { - auto param = logical_or_expression(); - if (param.errored) + auto param = expression(); + if (param.errored) { return Failure::kErrored; + } if (!param.matched) { return add_error(peek(), "unable to parse expression inside []"); } @@ -2191,32 +2642,20 @@ Maybe ParserImpl::postfix_expression(const ast::Expressi return Failure::kErrored; } -// singular_expression -// : primary_expression postfix_expr -Maybe ParserImpl::singular_expression() { - auto prefix = primary_expression(); - if (prefix.errored) - return Failure::kErrored; - if (!prefix.matched) - return Failure::kNoMatch; - - return postfix_expression(prefix.value); -} - // argument_expression_list -// : PAREN_LEFT ((logical_or_expression COMMA)* logical_or_expression COMMA?)? -// PAREN_RIGHT -Expect ParserImpl::expect_argument_expression_list(std::string_view use) { - return expect_paren_block(use, [&]() -> Expect { - ast::ExpressionList ret; +// : PAREN_LEFT ((expression COMMA)* expression COMMA?)? PAREN_RIGHT +Expect ParserImpl::expect_argument_expression_list( + std::string_view use) { + return expect_paren_block(use, [&]() -> Expect { + ExpressionList ret; while (continue_parsing()) { - auto arg = logical_or_expression(); + auto arg = expression(); if (arg.errored) { return Failure::kErrored; } else if (!arg.matched) { break; } - ret.push_back(arg.value); + ret.Push(arg.value); if (!match(Token::Type::kComma)) { break; @@ -2226,6 +2665,415 @@ Expect ParserImpl::expect_argument_expression_list(std::str }); } +// bitwise_expression.post.unary_expression +// : AND unary_expression (AND unary_expression)* +// | OR unary_expression (OR unary_expression)* +// | XOR unary_expression (XOR unary_expression)* +Maybe ParserImpl::bitwise_expression_post_unary_expression( + const ast::Expression* lhs) { + auto& t = peek(); + if (!t.Is(Token::Type::kAnd) && !t.Is(Token::Type::kOr) && !t.Is(Token::Type::kXor)) { + return Failure::kNoMatch; + } + + ast::BinaryOp op = ast::BinaryOp::kXor; + if (t.Is(Token::Type::kAnd)) { + op = ast::BinaryOp::kAnd; + } else if (t.Is(Token::Type::kOr)) { + op = ast::BinaryOp::kOr; + } + + while (continue_parsing()) { + auto& n = peek(); + // Handle the case of `a & b &&c` where `&c` is a unary_expression + bool split = false; + if (op == ast::BinaryOp::kAnd && n.Is(Token::Type::kAndAnd)) { + next(); + split_token(Token::Type::kAnd, Token::Type::kAnd); + split = true; + } + + if (!n.Is(t.type())) { + if (n.Is(Token::Type::kAnd) || n.Is(Token::Type::kOr) || n.Is(Token::Type::kXor)) { + return add_error(n.source(), std::string("mixing '") + std::string(t.to_name()) + + "' and '" + std::string(n.to_name()) + + "' requires parenthesis"); + } + + return lhs; + } + // If forced to split an `&&` then we've already done the `next` above which consumes + // the `&`. The type check above will always fail because we only split if already consuming + // a `&` operator. + if (!split) { + next(); + } + + auto rhs = unary_expression(); + if (rhs.errored) { + return Failure::kErrored; + } + if (!rhs.matched) { + return add_error(peek(), std::string("unable to parse right side of ") + + std::string(t.to_name()) + " expression"); + } + + lhs = create(t.source(), op, lhs, rhs.value); + } + return Failure::kErrored; +} + +// multiplicative_operator +// : FORWARD_SLASH +// | MODULO +// | STAR +Maybe ParserImpl::multiplicative_operator() { + if (match(Token::Type::kForwardSlash)) { + return ast::BinaryOp::kDivide; + } + if (match(Token::Type::kMod)) { + return ast::BinaryOp::kModulo; + } + if (match(Token::Type::kStar)) { + return ast::BinaryOp::kMultiply; + } + + return Failure::kNoMatch; +} + +// multiplicative_expression.post.unary_expression +// : (multiplicative_operator unary_expression)* +Expect ParserImpl::expect_multiplicative_expression_post_unary_expression( + const ast::Expression* lhs) { + while (continue_parsing()) { + auto& t = peek(); + + auto op = multiplicative_operator(); + if (op.errored) { + return Failure::kErrored; + } + if (!op.matched) { + return lhs; + } + + auto rhs = unary_expression(); + if (rhs.errored) { + return Failure::kErrored; + } + if (!rhs.matched) { + return add_error(peek(), std::string("unable to parse right side of ") + + std::string(t.to_name()) + " expression"); + } + + lhs = create(t.source(), op.value, lhs, rhs.value); + } + return Failure::kErrored; +} + +// additive_operator +// : MINUS +// | PLUS +// +// Note, this also splits a `--` token. This is currently safe as the only way to get into +// here is through additive expression and rules for where `--` are allowed are very restrictive. +Maybe ParserImpl::additive_operator() { + if (match(Token::Type::kPlus)) { + return ast::BinaryOp::kAdd; + } + + auto& t = peek(); + if (t.Is(Token::Type::kMinusMinus)) { + next(); + split_token(Token::Type::kMinus, Token::Type::kMinus); + } else if (t.Is(Token::Type::kMinus)) { + next(); + } else { + return Failure::kNoMatch; + } + + return ast::BinaryOp::kSubtract; +} + +// additive_expression.pos.unary_expression +// : (additive_operator unary_expression expect_multiplicative_expression.post.unary_expression)* +// +// This is `( additive_operator unary_expression ( multiplicative_operator unary_expression )* )*` +// split apart. +Expect ParserImpl::expect_additive_expression_post_unary_expression( + const ast::Expression* lhs) { + while (continue_parsing()) { + auto& t = peek(); + + auto op = additive_operator(); + if (op.errored) { + return Failure::kErrored; + } + if (!op.matched) { + return lhs; + } + + auto unary = unary_expression(); + if (unary.errored) { + return Failure::kErrored; + } + if (!unary.matched) { + return add_error(peek(), std::string("unable to parse right side of ") + + std::string(t.to_name()) + " expression"); + } + + // The multiplicative binds tigher, so pass the unary into that and build that expression + // before creating the additve expression. + auto rhs = expect_multiplicative_expression_post_unary_expression(unary.value); + if (rhs.errored) { + return Failure::kErrored; + } + + lhs = create(t.source(), op.value, lhs, rhs.value); + } + return Failure::kErrored; +} + +// math_expression.post.unary_expression +// : multiplicative_expression.post.unary_expression additive_expression.post.unary_expression +// +// This is `( multiplicative_operator unary_expression )* ( additive_operator unary_expression ( +// multiplicative_operator unary_expression )* )*` split apart. +Expect ParserImpl::expect_math_expression_post_unary_expression( + const ast::Expression* lhs) { + auto rhs = expect_multiplicative_expression_post_unary_expression(lhs); + if (rhs.errored) { + return Failure::kErrored; + } + + return expect_additive_expression_post_unary_expression(rhs.value); +} + +// element_count_expression +// : unary_expression math_expression.post.unary_expression +// | unary_expression bitwise_expression.post.unary_expression +// +// Note, this moves the `( multiplicative_operator unary_expression )* ( additive_operator +// unary_expression ( multiplicative_operator unary_expression )* )*` expression for the first +// branch out into helper methods. +Maybe ParserImpl::element_count_expression() { + auto lhs = unary_expression(); + if (lhs.errored) { + return Failure::kErrored; + } + if (!lhs.matched) { + return Failure::kNoMatch; + } + + auto bitwise = bitwise_expression_post_unary_expression(lhs.value); + if (bitwise.errored) { + return Failure::kErrored; + } + if (bitwise.matched) { + return bitwise.value; + } + + auto math = expect_math_expression_post_unary_expression(lhs.value); + if (math.errored) { + return Failure::kErrored; + } + return math.value; +} + +// shift_expression +// : unary_expression shift_expression.post.unary_expression +Maybe ParserImpl::shift_expression() { + auto lhs = unary_expression(); + if (lhs.errored) { + return Failure::kErrored; + } + if (!lhs.matched) { + return Failure::kNoMatch; + } + return expect_shift_expression_post_unary_expression(lhs.value); +} + +// shift_expression.post.unary_expression +// : math_expression.post.unary_expression? +// | SHIFT_LEFT unary_expression +// | SHIFT_RIGHT unary_expression +// +// Note, add the `math_expression.post.unary_expression` is added here to make +// implementation simpler. +Expect ParserImpl::expect_shift_expression_post_unary_expression( + const ast::Expression* lhs) { + auto& t = peek(); + if (match(Token::Type::kShiftLeft) || match(Token::Type::kShiftRight)) { + std::string name; + ast::BinaryOp op = ast::BinaryOp::kNone; + if (t.Is(Token::Type::kShiftLeft)) { + op = ast::BinaryOp::kShiftLeft; + name = "<<"; + } else if (t.Is(Token::Type::kShiftRight)) { + op = ast::BinaryOp::kShiftRight; + name = ">>"; + } + + auto& rhs_start = peek(); + auto rhs = unary_expression(); + if (rhs.errored) { + return Failure::kErrored; + } + if (!rhs.matched) { + return add_error(rhs_start, + std::string("unable to parse right side of ") + name + " expression"); + } + return create(t.source(), op, lhs, rhs.value); + } + + return expect_math_expression_post_unary_expression(lhs); +} + +// relational_expression +// : unary_expression relational_expression.post.unary_expression +Maybe ParserImpl::relational_expression() { + auto lhs = unary_expression(); + if (lhs.errored) { + return Failure::kErrored; + } + if (!lhs.matched) { + return Failure::kNoMatch; + } + return expect_relational_expression_post_unary_expression(lhs.value); +} + +// relational_expression.post.unary_expression +// : shift_expression.post.unary_expression +// | shift_expression.post.unary_expression EQUAL_EQUAL shift_expression +// | shift_expression.post.unary_expression GREATER_THAN shift_expression +// | shift_expression.post.unary_expression GREATER_THAN_EQUAL shift_expression +// | shift_expression.post.unary_expression LESS_THAN shift_expression +// | shift_expression.post.unary_expression LESS_THAN_EQUAL shift_expression +// | shift_expression.post.unary_expression NOT_EQUAL shift_expression +// +// Note, a `shift_expression` element was added to simplify many of the right sides +Expect ParserImpl::expect_relational_expression_post_unary_expression( + const ast::Expression* lhs) { + auto lhs_result = expect_shift_expression_post_unary_expression(lhs); + if (lhs_result.errored) { + return Failure::kErrored; + } + lhs = lhs_result.value; + + auto& t = peek(); + if (match(Token::Type::kEqualEqual) || match(Token::Type::kGreaterThan) || + match(Token::Type::kGreaterThanEqual) || match(Token::Type::kLessThan) || + match(Token::Type::kLessThanEqual) || match(Token::Type::kNotEqual)) { + ast::BinaryOp op = ast::BinaryOp::kNone; + if (t.Is(Token::Type::kLessThan)) { + op = ast::BinaryOp::kLessThan; + } else if (t.Is(Token::Type::kGreaterThan)) { + op = ast::BinaryOp::kGreaterThan; + } else if (t.Is(Token::Type::kLessThanEqual)) { + op = ast::BinaryOp::kLessThanEqual; + } else if (t.Is(Token::Type::kGreaterThanEqual)) { + op = ast::BinaryOp::kGreaterThanEqual; + } else if (t.Is(Token::Type::kEqualEqual)) { + op = ast::BinaryOp::kEqual; + } else if (t.Is(Token::Type::kNotEqual)) { + op = ast::BinaryOp::kNotEqual; + } + + auto& next = peek(); + auto rhs = shift_expression(); + if (rhs.errored) { + return Failure::kErrored; + } + if (!rhs.matched) { + return add_error(next, std::string("unable to parse right side of ") + + std::string(t.to_name()) + " expression"); + } + lhs = create(t.source(), op, lhs, rhs.value); + } + return lhs; +} + +// expression +// : unary_expression bitwise_expression.post.unary_expression +// | unary_expression relational_expression.post.unary_expression +// | unary_expression relational_expression.post.unary_expression and_and +// relational_expression ( and_and relational_expression )* +// | unary_expression relational_expression.post.unary_expression or_or +// relational_expression ( or_or relational_expression )* +// +// Note, a `relational_expression` element was added to simplify many of the right sides +Maybe ParserImpl::expression() { + auto lhs = unary_expression(); + if (lhs.errored) { + return Failure::kErrored; + } + if (!lhs.matched) { + return Failure::kNoMatch; + } + + auto bitwise = bitwise_expression_post_unary_expression(lhs.value); + if (bitwise.errored) { + return Failure::kErrored; + } + if (bitwise.matched) { + return bitwise.value; + } + + auto relational = expect_relational_expression_post_unary_expression(lhs.value); + if (relational.errored) { + return Failure::kErrored; + } + auto* ret = relational.value; + + auto& t = peek(); + if (t.Is(Token::Type::kAndAnd) || t.Is(Token::Type::kOrOr)) { + ast::BinaryOp op = ast::BinaryOp::kNone; + if (t.Is(Token::Type::kAndAnd)) { + op = ast::BinaryOp::kLogicalAnd; + } else if (t.Is(Token::Type::kOrOr)) { + op = ast::BinaryOp::kLogicalOr; + } + + while (continue_parsing()) { + auto& n = peek(); + if (!n.Is(t.type())) { + if (n.Is(Token::Type::kAndAnd) || n.Is(Token::Type::kOrOr)) { + return add_error( + n.source(), std::string("mixing '") + std::string(t.to_name()) + "' and '" + + std::string(n.to_name()) + "' requires parenthesis"); + } + break; + } + next(); + + auto rhs = relational_expression(); + if (rhs.errored) { + return Failure::kErrored; + } + if (!rhs.matched) { + return add_error(peek(), std::string("unable to parse right side of ") + + std::string(t.to_name()) + " expression"); + } + + ret = create(t.source(), op, ret, rhs.value); + } + } + return ret; +} + +// singular_expression +// : primary_expression postfix_expr +Maybe ParserImpl::singular_expression() { + auto prefix = primary_expression(); + if (prefix.errored) { + return Failure::kErrored; + } + if (!prefix.matched) { + return Failure::kNoMatch; + } + + return postfix_expression(prefix.value); +} + // unary_expression // : singular_expression // | MINUS unary_expression @@ -2233,8 +3081,10 @@ Expect ParserImpl::expect_argument_expression_list(std::str // | TILDE unary_expression // | STAR unary_expression // | AND unary_expression +// +// The `primary_expression postfix_expression ?` is moved out into a `singular_expression` Maybe ParserImpl::unary_expression() { - auto t = peek(); + auto& t = peek(); if (match(Token::Type::kPlusPlus) || match(Token::Type::kMinusMinus)) { add_error(t.source(), @@ -2281,404 +3131,17 @@ Maybe ParserImpl::unary_expression() { return create(t.source(), op, expr.value); } -// multiplicative_expr -// : -// | STAR unary_expression multiplicative_expr -// | FORWARD_SLASH unary_expression multiplicative_expr -// | MODULO unary_expression multiplicative_expr -Expect ParserImpl::expect_multiplicative_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - ast::BinaryOp op = ast::BinaryOp::kNone; - if (peek_is(Token::Type::kStar)) - op = ast::BinaryOp::kMultiply; - else if (peek_is(Token::Type::kForwardSlash)) - op = ast::BinaryOp::kDivide; - else if (peek_is(Token::Type::kMod)) - op = ast::BinaryOp::kModulo; - else - return lhs; - - auto t = next(); - auto source = t.source(); - auto name = t.to_name(); - - auto rhs = unary_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) { - return add_error(peek(), - "unable to parse right side of " + std::string(name) + " expression"); - } - - lhs = create(source, op, lhs, rhs.value); - } - return Failure::kErrored; -} - -// multiplicative_expression -// : unary_expression multiplicative_expr -Maybe ParserImpl::multiplicative_expression() { - auto lhs = unary_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_multiplicative_expr(lhs.value); -} - -// additive_expr -// : -// | PLUS multiplicative_expression additive_expr -// | MINUS multiplicative_expression additive_expr -Expect ParserImpl::expect_additive_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - ast::BinaryOp op = ast::BinaryOp::kNone; - if (peek_is(Token::Type::kPlus)) - op = ast::BinaryOp::kAdd; - else if (peek_is(Token::Type::kMinus)) - op = ast::BinaryOp::kSubtract; - else - return lhs; - - auto t = next(); - auto source = t.source(); - - auto rhs = multiplicative_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) - return add_error(peek(), "unable to parse right side of + expression"); - - lhs = create(source, op, lhs, rhs.value); - } - return Failure::kErrored; -} - -// additive_expression -// : multiplicative_expression additive_expr -Maybe ParserImpl::additive_expression() { - auto lhs = multiplicative_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_additive_expr(lhs.value); -} - -// shift_expr -// : -// | SHIFT_LEFT additive_expression shift_expr -// | SHIFT_RIGHT additive_expression shift_expr -Expect ParserImpl::expect_shift_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - auto* name = ""; - ast::BinaryOp op = ast::BinaryOp::kNone; - if (peek_is(Token::Type::kShiftLeft)) { - op = ast::BinaryOp::kShiftLeft; - name = "<<"; - } else if (peek_is(Token::Type::kShiftRight)) { - op = ast::BinaryOp::kShiftRight; - name = ">>"; - } else { - return lhs; - } - - auto t = next(); - auto source = t.source(); - auto rhs = additive_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) { - return add_error(peek(), - std::string("unable to parse right side of ") + name + " expression"); - } - - return lhs = create(source, op, lhs, rhs.value); - } - return Failure::kErrored; -} - -// shift_expression -// : additive_expression shift_expr -Maybe ParserImpl::shift_expression() { - auto lhs = additive_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_shift_expr(lhs.value); -} - -// relational_expr -// : -// | LESS_THAN shift_expression relational_expr -// | GREATER_THAN shift_expression relational_expr -// | LESS_THAN_EQUAL shift_expression relational_expr -// | GREATER_THAN_EQUAL shift_expression relational_expr -Expect ParserImpl::expect_relational_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - ast::BinaryOp op = ast::BinaryOp::kNone; - if (peek_is(Token::Type::kLessThan)) - op = ast::BinaryOp::kLessThan; - else if (peek_is(Token::Type::kGreaterThan)) - op = ast::BinaryOp::kGreaterThan; - else if (peek_is(Token::Type::kLessThanEqual)) - op = ast::BinaryOp::kLessThanEqual; - else if (peek_is(Token::Type::kGreaterThanEqual)) - op = ast::BinaryOp::kGreaterThanEqual; - else - return lhs; - - auto t = next(); - auto source = t.source(); - auto name = t.to_name(); - - auto rhs = shift_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) { - return add_error(peek(), - "unable to parse right side of " + std::string(name) + " expression"); - } - - lhs = create(source, op, lhs, rhs.value); - } - return Failure::kErrored; -} - -// relational_expression -// : shift_expression relational_expr -Maybe ParserImpl::relational_expression() { - auto lhs = shift_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_relational_expr(lhs.value); -} - -// equality_expr -// : -// | EQUAL_EQUAL relational_expression equality_expr -// | NOT_EQUAL relational_expression equality_expr -Expect ParserImpl::expect_equality_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - ast::BinaryOp op = ast::BinaryOp::kNone; - if (peek_is(Token::Type::kEqualEqual)) - op = ast::BinaryOp::kEqual; - else if (peek_is(Token::Type::kNotEqual)) - op = ast::BinaryOp::kNotEqual; - else - return lhs; - - auto t = next(); - auto source = t.source(); - auto name = t.to_name(); - - auto rhs = relational_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) { - return add_error(peek(), - "unable to parse right side of " + std::string(name) + " expression"); - } - - lhs = create(source, op, lhs, rhs.value); - } - return Failure::kErrored; -} - -// equality_expression -// : relational_expression equality_expr -Maybe ParserImpl::equality_expression() { - auto lhs = relational_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_equality_expr(lhs.value); -} - -// and_expr -// : -// | AND equality_expression and_expr -Expect ParserImpl::expect_and_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - if (!peek_is(Token::Type::kAnd)) { - return lhs; - } - - auto t = next(); - auto source = t.source(); - - auto rhs = equality_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) - return add_error(peek(), "unable to parse right side of & expression"); - - lhs = create(source, ast::BinaryOp::kAnd, lhs, rhs.value); - } - return Failure::kErrored; -} - -// and_expression -// : equality_expression and_expr -Maybe ParserImpl::and_expression() { - auto lhs = equality_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_and_expr(lhs.value); -} - -// exclusive_or_expr -// : -// | XOR and_expression exclusive_or_expr -Expect ParserImpl::expect_exclusive_or_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - Source source; - if (!match(Token::Type::kXor, &source)) - return lhs; - - auto rhs = and_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) - return add_error(peek(), "unable to parse right side of ^ expression"); - - lhs = create(source, ast::BinaryOp::kXor, lhs, rhs.value); - } - return Failure::kErrored; -} - -// exclusive_or_expression -// : and_expression exclusive_or_expr -Maybe ParserImpl::exclusive_or_expression() { - auto lhs = and_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_exclusive_or_expr(lhs.value); -} - -// inclusive_or_expr -// : -// | OR exclusive_or_expression inclusive_or_expr -Expect ParserImpl::expect_inclusive_or_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - Source source; - if (!match(Token::Type::kOr)) - return lhs; - - auto rhs = exclusive_or_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) - return add_error(peek(), "unable to parse right side of | expression"); - - lhs = create(source, ast::BinaryOp::kOr, lhs, rhs.value); - } - return Failure::kErrored; -} - -// inclusive_or_expression -// : exclusive_or_expression inclusive_or_expr -Maybe ParserImpl::inclusive_or_expression() { - auto lhs = exclusive_or_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_inclusive_or_expr(lhs.value); -} - -// logical_and_expr -// : -// | AND_AND inclusive_or_expression logical_and_expr -Expect ParserImpl::expect_logical_and_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - if (!peek_is(Token::Type::kAndAnd)) { - return lhs; - } - - auto t = next(); - auto source = t.source(); - - auto rhs = inclusive_or_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) - return add_error(peek(), "unable to parse right side of && expression"); - - lhs = create(source, ast::BinaryOp::kLogicalAnd, lhs, rhs.value); - } - return Failure::kErrored; -} - -// logical_and_expression -// : inclusive_or_expression logical_and_expr -Maybe ParserImpl::logical_and_expression() { - auto lhs = inclusive_or_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_logical_and_expr(lhs.value); -} - -// logical_or_expr -// : -// | OR_OR logical_and_expression logical_or_expr -Expect ParserImpl::expect_logical_or_expr(const ast::Expression* lhs) { - while (continue_parsing()) { - Source source; - if (!match(Token::Type::kOrOr)) - return lhs; - - auto rhs = logical_and_expression(); - if (rhs.errored) - return Failure::kErrored; - if (!rhs.matched) - return add_error(peek(), "unable to parse right side of || expression"); - - lhs = create(source, ast::BinaryOp::kLogicalOr, lhs, rhs.value); - } - return Failure::kErrored; -} - -// logical_or_expression -// : logical_and_expression logical_or_expr -Maybe ParserImpl::logical_or_expression() { - auto lhs = logical_and_expression(); - if (lhs.errored) - return Failure::kErrored; - if (!lhs.matched) - return Failure::kNoMatch; - - return expect_logical_or_expr(lhs.value); -} - -// compound_assignment_operator: -// | plus_equal -// | minus_equal -// | times_equal -// | division_equal -// | modulo_equal -// | and_equal -// | or_equal -// | xor_equal +// compound_assignment_operator +// : plus_equal +// | minus_equal +// | times_equal +// | division_equal +// | modulo_equal +// | and_equal +// | or_equal +// | xor_equal +// | shift_right_equal +// | shift_left_equal Maybe ParserImpl::compound_assignment_operator() { ast::BinaryOp compound_op = ast::BinaryOp::kNone; if (peek_is(Token::Type::kPlusEqual)) { @@ -2697,6 +3160,10 @@ Maybe ParserImpl::compound_assignment_operator() { compound_op = ast::BinaryOp::kOr; } else if (peek_is(Token::Type::kXorEqual)) { compound_op = ast::BinaryOp::kXor; + } else if (peek_is(Token::Type::kShiftLeftEqual)) { + compound_op = ast::BinaryOp::kShiftLeft; + } else if (peek_is(Token::Type::kShiftRightEqual)) { + compound_op = ast::BinaryOp::kShiftRight; } if (compound_op != ast::BinaryOp::kNone) { next(); @@ -2705,16 +3172,88 @@ Maybe ParserImpl::compound_assignment_operator() { return Failure::kNoMatch; } -// assignment_stmt -// | lhs_expression ( equal | compound_assignment_operator ) expression -// | underscore equal expression -// increment_stmt -// | lhs_expression PLUS_PLUS -// decrement_stmt -// | lhs_expression MINUS_MINUS -Maybe ParserImpl::assignment_stmt() { - auto t = peek(); - auto source = t.source(); +// core_lhs_expression +// : ident +// | PAREN_LEFT lhs_expression PAREN_RIGHT +Maybe ParserImpl::core_lhs_expression() { + auto& t = peek(); + if (t.IsIdentifier()) { + next(); + + return create(t.source(), + builder_.Symbols().Register(t.to_str())); + } + + if (peek_is(Token::Type::kParenLeft)) { + return expect_paren_block("", [&]() -> Expect { + auto expr = lhs_expression(); + if (expr.errored) { + return Failure::kErrored; + } + if (!expr.matched) { + return add_error(t, "invalid expression"); + } + return expr.value; + }); + } + + return Failure::kNoMatch; +} + +// lhs_expression +// : ( STAR | AND )* core_lhs_expression postfix_expression? +Maybe ParserImpl::lhs_expression() { + std::vector prefixes; + while (peek_is(Token::Type::kStar) || peek_is(Token::Type::kAnd) || + peek_is(Token::Type::kAndAnd)) { + auto& t = next(); + + // If an '&&' is provided split into '&' and '&' + if (t.Is(Token::Type::kAndAnd)) { + split_token(Token::Type::kAnd, Token::Type::kAnd); + } + + prefixes.push_back(&t); + } + + auto core_expr = core_lhs_expression(); + if (core_expr.errored) { + return Failure::kErrored; + } else if (!core_expr.matched) { + if (prefixes.empty()) { + return Failure::kNoMatch; + } + + return add_error(peek(), "missing expression"); + } + + const auto* expr = core_expr.value; + for (auto it = prefixes.rbegin(); it != prefixes.rend(); ++it) { + auto& t = **it; + ast::UnaryOp op = ast::UnaryOp::kAddressOf; + if (t.Is(Token::Type::kStar)) { + op = ast::UnaryOp::kIndirection; + } + expr = create(t.source(), op, expr); + } + + auto e = postfix_expression(expr); + if (e.errored) { + return Failure::kErrored; + } + return e.value; +} + +// variable_updating_statement +// : lhs_expression ( EQUAL | compound_assignment_operator ) expression +// | lhs_expression MINUS_MINUS +// | lhs_expression PLUS_PLUS +// | UNDERSCORE EQUAL expression +// +// Note, this is a simplification of the recursive grammar statement with the `lhs_expression` +// substituted back into the expression. +Maybe ParserImpl::variable_updating_statement() { + auto& t = peek(); // tint:295 - Test for `ident COLON` - this is invalid grammar, and without // special casing will error as "missing = for assignment", which is less @@ -2723,38 +3262,50 @@ Maybe ParserImpl::assignment_stmt() { return add_error(peek(0).source(), "expected 'var' for variable declaration"); } - auto lhs = unary_expression(); - if (lhs.errored) { - return Failure::kErrored; - } - if (!lhs.matched) { - if (!match(Token::Type::kUnderscore, &source)) { - return Failure::kNoMatch; - } - lhs = create(source); - } + const ast::Expression* lhs = nullptr; + ast::BinaryOp compound_op = ast::BinaryOp::kNone; + if (peek_is(Token::Type::kUnderscore)) { + next(); // Consume the peek. - // Handle increment and decrement statements. - // We do this here because the parsing of the LHS expression overlaps with - // the assignment statement, and we cannot tell which we are parsing until we - // hit the ++/--/= token. - if (match(Token::Type::kPlusPlus)) { - return create(source, lhs.value, true); - } else if (match(Token::Type::kMinusMinus)) { - return create(source, lhs.value, false); - } - - auto compound_op = compound_assignment_operator(); - if (compound_op.errored) { - return Failure::kErrored; - } - if (!compound_op.matched) { if (!expect("assignment", Token::Type::kEqual)) { return Failure::kErrored; } + + lhs = create(t.source()); + + } else { + auto lhs_result = lhs_expression(); + if (lhs_result.errored) { + return Failure::kErrored; + } + if (!lhs_result.matched) { + return Failure::kNoMatch; + } + + lhs = lhs_result.value; + + // Handle increment and decrement statements. + if (match(Token::Type::kPlusPlus)) { + return create(t.source(), lhs, true); + } + if (match(Token::Type::kMinusMinus)) { + return create(t.source(), lhs, false); + } + + auto compound_op_result = compound_assignment_operator(); + if (compound_op_result.errored) { + return Failure::kErrored; + } + if (compound_op_result.matched) { + compound_op = compound_op_result.value; + } else { + if (!expect("assignment", Token::Type::kEqual)) { + return Failure::kErrored; + } + } } - auto rhs = logical_or_expression(); + auto rhs = expression(); if (rhs.errored) { return Failure::kErrored; } @@ -2762,35 +3313,45 @@ Maybe ParserImpl::assignment_stmt() { return add_error(peek(), "unable to parse right side of assignment"); } - if (compound_op.value != ast::BinaryOp::kNone) { - return create(source, lhs.value, rhs.value, - compound_op.value); - } else { - return create(source, lhs.value, rhs.value); + if (compound_op != ast::BinaryOp::kNone) { + return create(t.source(), lhs, rhs.value, compound_op); } + return create(t.source(), lhs, rhs.value); } // const_literal // : INT_LITERAL // | FLOAT_LITERAL -// | TRUE +// | bool_literal +// +// bool_literal +// : TRUE // | FALSE Maybe ParserImpl::const_literal() { - auto t = peek(); + auto& t = peek(); if (match(Token::Type::kIntLiteral)) { return create(t.source(), t.to_i64(), ast::IntLiteralExpression::Suffix::kNone); } - if (match(Token::Type::kIntILiteral)) { + if (match(Token::Type::kIntLiteral_I)) { return create(t.source(), t.to_i64(), ast::IntLiteralExpression::Suffix::kI); } - if (match(Token::Type::kIntULiteral)) { + if (match(Token::Type::kIntLiteral_U)) { return create(t.source(), t.to_i64(), ast::IntLiteralExpression::Suffix::kU); } if (match(Token::Type::kFloatLiteral)) { - return create(t.source(), t.to_f32()); + return create(t.source(), t.to_f64(), + ast::FloatLiteralExpression::Suffix::kNone); + } + if (match(Token::Type::kFloatLiteral_F)) { + return create(t.source(), t.to_f64(), + ast::FloatLiteralExpression::Suffix::kF); + } + if (match(Token::Type::kFloatLiteral_H)) { + return create(t.source(), t.to_f64(), + ast::FloatLiteralExpression::Suffix::kH); } if (match(Token::Type::kTrue)) { return create(t.source(), true); @@ -2804,187 +3365,242 @@ Maybe ParserImpl::const_literal() { return Failure::kNoMatch; } -// const_expr -// : type_decl PAREN_LEFT ((const_expr COMMA)? const_expr COMMA?)? PAREN_RIGHT -// | const_literal -Expect ParserImpl::expect_const_expr() { - auto t = peek(); - auto source = t.source(); - if (t.IsLiteral()) { - auto lit = const_literal(); - if (lit.errored) { - return Failure::kErrored; - } - if (!lit.matched) { - return add_error(peek(), "unable to parse constant literal"); - } - return lit.value; - } - - if (peek_is(Token::Type::kParenLeft, 1) || peek_is(Token::Type::kLessThan, 1)) { - auto type = expect_type("const_expr"); - if (type.errored) { - return Failure::kErrored; - } - - auto params = expect_paren_block("type constructor", [&]() -> Expect { - ast::ExpressionList list; - while (continue_parsing()) { - if (peek_is(Token::Type::kParenRight)) { - break; - } - - auto arg = expect_const_expr(); - if (arg.errored) { - return Failure::kErrored; - } - list.emplace_back(arg.value); - - if (!match(Token::Type::kComma)) { - break; - } - } - return list; - }); - - if (params.errored) - return Failure::kErrored; - - return builder_.Construct(source, type.value, params.value); - } - return add_error(peek(), "unable to parse const_expr"); -} - -Maybe ParserImpl::attribute_list() { +Maybe ParserImpl::attribute_list() { bool errored = false; - ast::AttributeList attrs; + AttributeList attrs; while (continue_parsing()) { if (match(Token::Type::kAttr)) { if (auto attr = expect_attribute(); attr.errored) { errored = true; } else { - attrs.emplace_back(attr.value); + attrs.Push(attr.value); } } else { break; } } - if (errored) + if (errored) { return Failure::kErrored; + } - if (attrs.empty()) + if (attrs.IsEmpty()) { return Failure::kNoMatch; + } return attrs; } Expect ParserImpl::expect_attribute() { - auto t = peek(); + auto& t = peek(); auto attr = attribute(); - if (attr.errored) + if (attr.errored) { return Failure::kErrored; - if (attr.matched) + } + if (attr.matched) { return attr.value; + } return add_error(t, "expected attribute"); } +// attribute +// : ATTR 'align' PAREN_LEFT expression COMMA? PAREN_RIGHT +// | ATTR 'binding' PAREN_LEFT expression COMMA? PAREN_RIGHT +// | ATTR 'builtin' PAREN_LEFT builtin_value_name COMMA? PAREN_RIGHT +// | ATTR 'const' +// | ATTR 'group' PAREN_LEFT expression COMMA? PAREN_RIGHT +// | ATTR 'id' PAREN_LEFT expression COMMA? PAREN_RIGHT +// | ATTR 'interpolate' PAREN_LEFT interpolation_type_name COMMA? PAREN_RIGHT +// | ATTR 'interpolate' PAREN_LEFT interpolation_type_name COMMA +// interpolation_sample_name COMMA? PAREN_RIGHT +// | ATTR 'invariant' +// | ATTR 'location' PAREN_LEFT expression COMMA? PAREN_RIGHT +// | ATTR 'size' PAREN_LEFT expression COMMA? PAREN_RIGHT +// | ATTR 'workgroup_size' PAREN_LEFT expression COMMA? PAREN_RIGHT +// | ATTR 'workgroup_size' PAREN_LEFT expression COMMA expression COMMA? PAREN_RIGHT +// | ATTR 'workgroup_size' PAREN_LEFT expression COMMA expression COMMA +// expression COMMA? PAREN_RIGHT +// | ATTR 'vertex' +// | ATTR 'fragment' +// | ATTR 'compute' Maybe ParserImpl::attribute() { using Result = Maybe; - auto t = next(); + auto& t = next(); if (!t.IsIdentifier()) { return Failure::kNoMatch; } - if (t == kLocationAttribute) { - const char* use = "location attribute"; + if (t == "align") { + const char* use = "align attribute"; return expect_paren_block(use, [&]() -> Result { auto val = expect_positive_sint(use); - if (val.errored) + if (val.errored) { return Failure::kErrored; + } + match(Token::Type::kComma); - return create(t.source(), val.value); + return create( + t.source(), create( + val.value, ast::IntLiteralExpression::Suffix::kNone)); }); } - if (t == kBindingAttribute) { + if (t == "binding") { const char* use = "binding attribute"; return expect_paren_block(use, [&]() -> Result { auto val = expect_positive_sint(use); - if (val.errored) + if (val.errored) { return Failure::kErrored; + } + match(Token::Type::kComma); return create(t.source(), val.value); }); } - if (t == kGroupAttribute) { - const char* use = "group attribute"; - return expect_paren_block(use, [&]() -> Result { - auto val = expect_positive_sint(use); - if (val.errored) - return Failure::kErrored; - - return create(t.source(), val.value); - }); - } - - if (t == kInterpolateAttribute) { - return expect_paren_block("interpolate attribute", [&]() -> Result { - ast::InterpolationType type; - ast::InterpolationSampling sampling = ast::InterpolationSampling::kNone; - - auto type_tok = next(); - if (type_tok == "perspective") { - type = ast::InterpolationType::kPerspective; - } else if (type_tok == "linear") { - type = ast::InterpolationType::kLinear; - } else if (type_tok == "flat") { - type = ast::InterpolationType::kFlat; - } else { - return add_error(type_tok, "invalid interpolation type"); - } - - if (match(Token::Type::kComma)) { - auto sampling_tok = next(); - if (sampling_tok == "center") { - sampling = ast::InterpolationSampling::kCenter; - } else if (sampling_tok == "centroid") { - sampling = ast::InterpolationSampling::kCentroid; - } else if (sampling_tok == "sample") { - sampling = ast::InterpolationSampling::kSample; - } else { - return add_error(sampling_tok, "invalid interpolation sampling"); - } - } - - return create(t.source(), type, sampling); - }); - } - - if (t == kInvariantAttribute) { - return create(t.source()); - } - - if (t == kBuiltinAttribute) { + if (t == "builtin") { return expect_paren_block("builtin attribute", [&]() -> Result { auto builtin = expect_builtin(); - if (builtin.errored) + if (builtin.errored) { return Failure::kErrored; + } + match(Token::Type::kComma); return create(t.source(), builtin.value); }); } - if (t == kWorkgroupSizeAttribute) { + if (t == "compute") { + return create(t.source(), ast::PipelineStage::kCompute); + } + + // Note, `const` is not valid in a WGSL source file, it's internal only + + if (t == "fragment") { + return create(t.source(), ast::PipelineStage::kFragment); + } + + if (t == "group") { + const char* use = "group attribute"; + return expect_paren_block(use, [&]() -> Result { + auto val = expect_positive_sint(use); + if (val.errored) { + return Failure::kErrored; + } + match(Token::Type::kComma); + + return create(t.source(), val.value); + }); + } + + if (t == "id") { + const char* use = "id attribute"; + return expect_paren_block(use, [&]() -> Result { + auto val = expect_positive_sint(use); + if (val.errored) { + return Failure::kErrored; + } + match(Token::Type::kComma); + + return create(t.source(), val.value); + }); + } + + if (t == "interpolate") { + return expect_paren_block("interpolate attribute", [&]() -> Result { + auto type = expect_interpolation_type_name(); + if (type.errored) { + return Failure::kErrored; + } + + ast::InterpolationSampling sampling = ast::InterpolationSampling::kNone; + if (match(Token::Type::kComma)) { + if (!peek_is(Token::Type::kParenRight)) { + auto sample = expect_interpolation_sample_name(); + if (sample.errored) { + return Failure::kErrored; + } + + sampling = sample.value; + match(Token::Type::kComma); + } + } + + return create(t.source(), type.value, sampling); + }); + } + + if (t == "invariant") { + return create(t.source()); + } + + if (t == "location") { + const char* use = "location attribute"; + return expect_paren_block(use, [&]() -> Result { + auto val = expect_positive_sint(use); + if (val.errored) { + return Failure::kErrored; + } + match(Token::Type::kComma); + + return create(t.source(), val.value); + }); + } + + if (t == "size") { + const char* use = "size attribute"; + return expect_paren_block(use, [&]() -> Result { + auto val = expect_positive_sint(use); + if (val.errored) { + return Failure::kErrored; + } + match(Token::Type::kComma); + + return create(t.source(), val.value); + }); + } + + // TODO(crbug.com/tint/1503): Remove when deprecation period is over. + if (t == "stage") { + return expect_paren_block("stage attribute", [&]() -> Result { + auto stage = expect_pipeline_stage(); + if (stage.errored) { + return Failure::kErrored; + } + + std::string warning = "remove stage and use @"; + switch (stage.value) { + case ast::PipelineStage::kVertex: + warning += "vertex"; + break; + case ast::PipelineStage::kFragment: + warning += "fragment"; + break; + case ast::PipelineStage::kCompute: + warning += "compute"; + break; + case ast::PipelineStage::kNone: + break; + } + deprecated(t.source(), warning); + + return create(t.source(), stage.value); + }); + } + + if (t == "vertex") { + return create(t.source(), ast::PipelineStage::kVertex); + } + + if (t == "workgroup_size") { return expect_paren_block("workgroup_size attribute", [&]() -> Result { const ast::Expression* x = nullptr; const ast::Expression* y = nullptr; const ast::Expression* z = nullptr; - auto expr = primary_expression(); + auto expr = expression(); if (expr.errored) { return Failure::kErrored; } else if (!expr.matched) { @@ -2993,77 +3609,39 @@ Maybe ParserImpl::attribute() { x = std::move(expr.value); if (match(Token::Type::kComma)) { - expr = primary_expression(); - if (expr.errored) { - return Failure::kErrored; - } else if (!expr.matched) { - return add_error(peek(), "expected workgroup_size y parameter"); - } - y = std::move(expr.value); - - if (match(Token::Type::kComma)) { - expr = primary_expression(); + if (!peek_is(Token::Type::kParenRight)) { + expr = expression(); if (expr.errored) { return Failure::kErrored; } else if (!expr.matched) { - return add_error(peek(), "expected workgroup_size z parameter"); + return add_error(peek(), "expected workgroup_size y parameter"); + } + y = std::move(expr.value); + + if (match(Token::Type::kComma)) { + if (!peek_is(Token::Type::kParenRight)) { + expr = expression(); + if (expr.errored) { + return Failure::kErrored; + } else if (!expr.matched) { + return add_error(peek(), "expected workgroup_size z parameter"); + } + z = std::move(expr.value); + + match(Token::Type::kComma); + } } - z = std::move(expr.value); } } return create(t.source(), x, y, z); }); } - - if (t == kStageAttribute) { - return expect_paren_block("stage attribute", [&]() -> Result { - auto stage = expect_pipeline_stage(); - if (stage.errored) - return Failure::kErrored; - - return create(t.source(), stage.value); - }); - } - - if (t == kSizeAttribute) { - const char* use = "size attribute"; - return expect_paren_block(use, [&]() -> Result { - auto val = expect_positive_sint(use); - if (val.errored) - return Failure::kErrored; - - return create(t.source(), val.value); - }); - } - - if (t == kAlignAttribute) { - const char* use = "align attribute"; - return expect_paren_block(use, [&]() -> Result { - auto val = expect_positive_sint(use); - if (val.errored) - return Failure::kErrored; - - return create(t.source(), val.value); - }); - } - - if (t == kIdAttribute) { - const char* use = "id attribute"; - return expect_paren_block(use, [&]() -> Result { - auto val = expect_positive_sint(use); - if (val.errored) - return Failure::kErrored; - - return create(t.source(), val.value); - }); - } - return Failure::kNoMatch; } -bool ParserImpl::expect_attributes_consumed(ast::AttributeList& in) { - if (in.empty()) { +bool ParserImpl::expect_attributes_consumed(utils::VectorRef in) { + if (in.IsEmpty()) { return true; } add_error(in[0]->source, "unexpected attributes"); @@ -3071,10 +3649,11 @@ bool ParserImpl::expect_attributes_consumed(ast::AttributeList& in) { } bool ParserImpl::match(Token::Type tok, Source* source /*= nullptr*/) { - auto t = peek(); + auto& t = peek(); - if (source != nullptr) + if (source != nullptr) { *source = t.source(); + } if (t.Is(tok)) { next(); @@ -3084,7 +3663,7 @@ bool ParserImpl::match(Token::Type tok, Source* source /*= nullptr*/) { } bool ParserImpl::expect(std::string_view use, Token::Type tok) { - auto t = peek(); + auto& t = peek(); if (t.Is(tok)) { next(); synchronized_ = true; @@ -3097,12 +3676,10 @@ bool ParserImpl::expect(std::string_view use, Token::Type tok) { next(); // Push the second character to the token queue. - auto source = t.source(); - source.range.begin.column++; if (t.Is(Token::Type::kShiftRight)) { - token_queue_.push_front(Token(Token::Type::kGreaterThan, source)); + split_token(Token::Type::kGreaterThan, Token::Type::kGreaterThan); } else if (t.Is(Token::Type::kGreaterThanEqual)) { - token_queue_.push_front(Token(Token::Type::kEqual, source)); + split_token(Token::Type::kGreaterThan, Token::Type::kEqual); } synchronized_ = true; @@ -3125,8 +3702,8 @@ bool ParserImpl::expect(std::string_view use, Token::Type tok) { } Expect ParserImpl::expect_sint(std::string_view use) { - auto t = peek(); - if (!t.Is(Token::Type::kIntLiteral) && !t.Is(Token::Type::kIntILiteral)) { + auto& t = peek(); + if (!t.Is(Token::Type::kIntLiteral) && !t.Is(Token::Type::kIntLiteral_I)) { return add_error(t.source(), "expected signed integer literal", use); } @@ -3143,34 +3720,38 @@ Expect ParserImpl::expect_sint(std::string_view use) { Expect ParserImpl::expect_positive_sint(std::string_view use) { auto sint = expect_sint(use); - if (sint.errored) + if (sint.errored) { return Failure::kErrored; + } - if (sint.value < 0) + if (sint.value < 0) { return add_error(sint.source, std::string(use) + " must be positive"); + } return {static_cast(sint.value), sint.source}; } Expect ParserImpl::expect_nonzero_positive_sint(std::string_view use) { auto sint = expect_sint(use); - if (sint.errored) + if (sint.errored) { return Failure::kErrored; + } - if (sint.value <= 0) + if (sint.value <= 0) { return add_error(sint.source, std::string(use) + " must be greater than 0"); + } return {static_cast(sint.value), sint.source}; } Expect ParserImpl::expect_ident(std::string_view use) { - auto t = peek(); + auto& t = peek(); if (t.IsIdentifier()) { synchronized_ = true; next(); if (is_reserved(t)) { - return add_error(t.source(), "'" + t.to_str() + "' is a reserved keyword"); + deprecated(t.source(), "'" + t.to_str() + "' is a reserved keyword"); } return {t.to_str(), t.source()}; @@ -3191,11 +3772,13 @@ T ParserImpl::expect_block(Token::Type start, Token::Type end, std::string_view return sync(end, [&]() -> T { auto res = body(); - if (res.errored) + if (res.errored) { return Failure::kErrored; + } - if (!expect(use, end)) + if (!expect(use, end)) { return Failure::kErrored; + } return res; }); @@ -3258,7 +3841,7 @@ bool ParserImpl::sync_to(Token::Type tok, bool consume) { BlockCounters counters; for (size_t i = 0; i < kMaxResynchronizeLookahead; i++) { - auto t = peek(i); + auto& t = peek(i); if (counters.consume(t) > 0) { continue; // Nested block } diff --git a/src/tint/reader/wgsl/parser_impl.h b/src/tint/reader/wgsl/parser_impl.h index 67d000437e..cc0cd2b708 100644 --- a/src/tint/reader/wgsl/parser_impl.h +++ b/src/tint/reader/wgsl/parser_impl.h @@ -15,7 +15,6 @@ #ifndef SRC_TINT_READER_WGSL_PARSER_IMPL_H_ #define SRC_TINT_READER_WGSL_PARSER_IMPL_H_ -#include #include #include #include @@ -72,6 +71,21 @@ class ParserImpl { }; public: + /// Pre-determined small vector sizes for AST pointers + //! @cond Doxygen_Suppress + using AttributeList = utils::Vector; + using CaseSelectorList = utils::Vector; + using CaseStatementList = utils::Vector; + using ExpressionList = utils::Vector; + using ParameterList = utils::Vector; + using StatementList = utils::Vector; + using StructMemberList = utils::Vector; + //! @endcond + + /// Empty structure used by functions that do not return a value, but need to signal success / + /// error with Expect or Maybe. + struct Void {}; + /// Expect is the return type of the parser methods that are expected to /// return a parsed value of type T, unless there was an parse error. /// In the case of a parse error the called method will have called @@ -232,9 +246,9 @@ class ParserImpl { /// @param ret_attrs return type attributes FunctionHeader(Source src, std::string n, - ast::VariableList p, + utils::VectorRef p, const ast::Type* ret_ty, - ast::AttributeList ret_attrs); + utils::VectorRef ret_attrs); /// Destructor ~FunctionHeader(); /// Assignment operator @@ -247,11 +261,11 @@ class ParserImpl { /// Function name std::string name; /// Function parameters - ast::VariableList params; + utils::Vector params; /// Function return type const ast::Type* return_type = nullptr; /// Function return type attributes - ast::AttributeList return_type_attributes; + AttributeList return_type_attributes; }; /// VarDeclInfo contains the parsed information for variable declaration. @@ -295,11 +309,23 @@ class ParserImpl { ast::Access access = ast::Access::kUndefined; }; + /// MatrixDimensions contains the column and row information for a matrix + struct MatrixDimensions { + /// The number of columns + uint32_t columns = 0; + /// The number of rows + uint32_t rows = 0; + }; + /// Creates a new parser using the given file /// @param file the input source file to parse explicit ParserImpl(Source::File const* file); ~ParserImpl(); + /// Reads tokens from the source file. This will be called automatically + /// by |parse|. + void InitializeLex(); + /// Run the parser /// @returns true if the parse was successful, false otherwise. bool Parse(); @@ -330,19 +356,19 @@ class ParserImpl { ProgramBuilder& builder() { return builder_; } /// @returns the next token - Token next(); + const Token& next(); /// Peeks ahead and returns the token at `idx` ahead of the current position /// @param idx the index of the token to return /// @returns the token `idx` positions ahead without advancing - Token peek(size_t idx = 0); + const Token& peek(size_t idx = 0); /// Peeks ahead and returns true if the token at `idx` ahead of the current /// position is |tok| /// @param idx the index of the token to return /// @param tok the token to look for /// @returns true if the token `idx` positions ahead is |tok| bool peek_is(Token::Type tok, size_t idx = 0); - /// @returns the last token that was returned by `next()` - Token last_token() const; + /// @returns the last source location that was returned by `next()` + Source last_source() const; /// Appends an error at `t` with the message `msg` /// @param t the token to associate the error with /// @param msg the error message @@ -371,82 +397,106 @@ class ParserImpl { void deprecated(const Source& source, const std::string& msg); /// Parses the `translation_unit` grammar element void translation_unit(); + /// Parses the `global_directive` grammar element, erroring on parse failure. + /// @param has_parsed_decl flag indicating if the parser has consumed a global declaration. + /// @return true on parse success, otherwise an error or no-match. + Maybe global_directive(bool has_parsed_decl); /// Parses the `enable_directive` grammar element, erroring on parse failure. /// @return true on parse success, otherwise an error or no-match. - Maybe enable_directive(); + Maybe enable_directive(); /// Parses the `global_decl` grammar element, erroring on parse failure. /// @return true on parse success, otherwise an error or no-match. - Maybe global_decl(); + Maybe global_decl(); /// Parses a `global_variable_decl` grammar element with the initial /// `variable_attribute_list*` provided as `attrs` /// @returns the variable parsed or nullptr - /// @param attrs the list of attributes for the variable declaration. - Maybe global_variable_decl(ast::AttributeList& attrs); + /// @param attrs the list of attributes for the variable declaration. If attributes are consumed + /// by the declaration, then this vector is cleared before returning. + Maybe global_variable_decl(AttributeList& attrs); /// Parses a `global_constant_decl` grammar element with the initial /// `variable_attribute_list*` provided as `attrs` /// @returns the const object or nullptr - /// @param attrs the list of attributes for the constant declaration. - Maybe global_constant_decl(ast::AttributeList& attrs); + /// @param attrs the list of attributes for the constant declaration. If attributes are consumed + /// by the declaration, then this vector is cleared before returning. + Maybe global_constant_decl(AttributeList& attrs); /// Parses a `variable_decl` grammar element - /// @param allow_inferred if true, do not fail if variable decl does not - /// specify type /// @returns the parsed variable declaration info - Maybe variable_decl(bool allow_inferred = false); - /// Parses a `variable_ident_decl` grammar element, erroring on parse - /// failure. + Maybe variable_decl(); + /// Helper for parsing ident with an optional type declaration. Should not be called directly, + /// use the specific version below. + /// @param use a description of what was being parsed if an error was raised. + /// @param allow_inferred allow the identifier to be parsed without a type + /// @returns the parsed identifier, and possibly type, or empty otherwise + Expect expect_ident_with_optional_type_decl(std::string_view use, + bool allow_inferred); + /// Parses a `ident` or a `variable_ident_decl` grammar element, erroring on parse failure. + /// @param use a description of what was being parsed if an error was raised. + /// @returns the identifier or empty otherwise. + Expect expect_optionally_typed_ident(std::string_view use); + /// Parses a `variable_ident_decl` grammar element, erroring on parse failure. /// @param use a description of what was being parsed if an error was raised. - /// @param allow_inferred if true, do not fail if variable decl does not - /// specify type /// @returns the identifier and type parsed or empty otherwise - Expect expect_variable_ident_decl(std::string_view use, - bool allow_inferred = false); + Expect expect_ident_with_type_decl(std::string_view use); /// Parses a `variable_qualifier` grammar element /// @returns the variable qualifier information Maybe variable_qualifier(); - /// Parses a `type_alias` grammar element + /// Parses a `type_alias_decl` grammar element /// @returns the type alias or nullptr on error - Maybe type_alias(); + Maybe type_alias_decl(); + /// Parses a `callable` grammar element + /// @returns the type or nullptr + Maybe callable(); + /// Parses a `vec_prefix` grammar element + /// @returns the vector size or nullptr + Maybe vec_prefix(); + /// Parses a `mat_prefix` grammar element + /// @returns the matrix dimensions or nullptr + Maybe mat_prefix(); + /// Parses a `type_decl_without_ident` grammar element + /// @returns the parsed Type or nullptr if none matched. + Maybe type_decl_without_ident(); /// Parses a `type_decl` grammar element /// @returns the parsed Type or nullptr if none matched. Maybe type_decl(); - /// Parses a `storage_class` grammar element, erroring on parse failure. + /// Parses an `address_space` grammar element, erroring on parse failure. /// @param use a description of what was being parsed if an error was raised. - /// @returns the storage class or StorageClass::kNone if none matched - Expect expect_storage_class(std::string_view use); + /// @returns the address space or StorageClass::kNone if none matched + Expect expect_address_space(std::string_view use); /// Parses a `struct_decl` grammar element. /// @returns the struct type or nullptr on error Maybe struct_decl(); /// Parses a `struct_body_decl` grammar element, erroring on parse failure. /// @returns the struct members - Expect expect_struct_body_decl(); + Expect expect_struct_body_decl(); /// Parses a `struct_member` grammar element, erroring on parse failure. /// @returns the struct member or nullptr Expect expect_struct_member(); /// Parses a `function_decl` grammar element with the initial /// `function_attribute_decl*` provided as `attrs`. - /// @param attrs the list of attributes for the function declaration. + /// @param attrs the list of attributes for the function declaration. If attributes are consumed + /// by the declaration, then this vector is cleared before returning. /// @returns the parsed function, nullptr otherwise - Maybe function_decl(ast::AttributeList& attrs); - /// Parses a `texture_samplers` grammar element + Maybe function_decl(AttributeList& attrs); + /// Parses a `texture_and_sampler_types` grammar element /// @returns the parsed Type or nullptr if none matched. - Maybe texture_samplers(); - /// Parses a `sampler` grammar element + Maybe texture_and_sampler_types(); + /// Parses a `sampler_type` grammar element /// @returns the parsed Type or nullptr if none matched. - Maybe sampler(); - /// Parses a `multisampled_texture` grammar element + Maybe sampler_type(); + /// Parses a `multisampled_texture_type` grammar element /// @returns returns the multisample texture dimension or kNone if none /// matched. - Maybe multisampled_texture(); - /// Parses a `sampled_texture` grammar element + Maybe multisampled_texture_type(); + /// Parses a `sampled_texture_type` grammar element /// @returns returns the sample texture dimension or kNone if none matched. - Maybe sampled_texture(); - /// Parses a `storage_texture` grammar element + Maybe sampled_texture_type(); + /// Parses a `storage_texture_type` grammar element /// @returns returns the storage texture dimension. /// Returns kNone if none matched. - Maybe storage_texture(); - /// Parses a `depth_texture` grammar element + Maybe storage_texture_type(); + /// Parses a `depth_texture_type` grammar element /// @returns the parsed Type or nullptr if none matched. - Maybe depth_texture(); + Maybe depth_texture_type(); /// Parses a 'texture_external_type' grammar element /// @returns the parsed Type or nullptr if none matched Maybe external_texture(); @@ -454,15 +504,18 @@ class ParserImpl { /// @param use a description of what was being parsed if an error was raised /// @returns returns the texel format or kNone if none matched. Expect expect_texel_format(std::string_view use); + /// Parses a `static_assert_statement` grammar element + /// @returns returns the static assert, if it matched. + Maybe static_assert_statement(); /// Parses a `function_header` grammar element /// @returns the parsed function header Maybe function_header(); /// Parses a `param_list` grammar element, erroring on parse failure. /// @returns the parsed variables - Expect expect_param_list(); + Expect expect_param_list(); /// Parses a `param` grammar element, erroring on parse failure. /// @returns the parsed variable - Expect expect_param(); + Expect expect_param(); /// Parses a `pipeline_stage` grammar element, erroring if the next token does /// not match a stage name. /// @returns the pipeline stage. @@ -471,71 +524,85 @@ class ParserImpl { /// match a valid access control. /// @param use a description of what was being parsed if an error was raised /// @returns the parsed access control. - Expect expect_access(std::string_view use); + Expect expect_access_mode(std::string_view use); + /// Parses an interpolation sample name identifier, erroring if the next token does not match a + /// valid sample name. + /// @returns the parsed sample name. + Expect expect_interpolation_sample_name(); + /// Parses an interpolation type name identifier, erroring if the next token does not match a + /// value type name. + /// @returns the parsed type name + Expect expect_interpolation_type_name(); /// Parses a builtin identifier, erroring if the next token does not match a /// valid builtin name. /// @returns the parsed builtin. - Expect expect_builtin(); - /// Parses a `body_stmt` grammar element, erroring on parse failure. + Expect expect_builtin(); + /// Parses a `compound_statement` grammar element, erroring on parse failure. /// @returns the parsed statements - Expect expect_body_stmt(); - /// Parses a `paren_rhs_stmt` grammar element, erroring on parse failure. + Expect expect_compound_statement(); + /// Parses a `paren_expression` grammar element, erroring on parse failure. /// @returns the parsed element or nullptr - Expect expect_paren_rhs_stmt(); + Expect expect_paren_expression(); /// Parses a `statements` grammar element /// @returns the statements parsed - Expect expect_statements(); + Expect expect_statements(); /// Parses a `statement` grammar element /// @returns the parsed statement or nullptr Maybe statement(); - /// Parses a `break_stmt` grammar element + /// Parses a `break_statement` grammar element /// @returns the parsed statement or nullptr - Maybe break_stmt(); - /// Parses a `return_stmt` grammar element + Maybe break_statement(); + /// Parses a `return_statement` grammar element /// @returns the parsed statement or nullptr - Maybe return_stmt(); - /// Parses a `continue_stmt` grammar element + Maybe return_statement(); + /// Parses a `continue_statement` grammar element /// @returns the parsed statement or nullptr - Maybe continue_stmt(); - /// Parses a `variable_stmt` grammar element + Maybe continue_statement(); + /// Parses a `variable_statement` grammar element /// @returns the parsed variable or nullptr - Maybe variable_stmt(); - /// Parses a `if_stmt` grammar element + Maybe variable_statement(); + /// Parses a `if_statement` grammar element /// @returns the parsed statement or nullptr - Maybe if_stmt(); - /// Parses a `switch_stmt` grammar element + Maybe if_statement(); + /// Parses a `switch_statement` grammar element /// @returns the parsed statement or nullptr - Maybe switch_stmt(); + Maybe switch_statement(); /// Parses a `switch_body` grammar element /// @returns the parsed statement or nullptr Maybe switch_body(); /// Parses a `case_selectors` grammar element /// @returns the list of literals - Expect expect_case_selectors(); + Expect expect_case_selectors(); /// Parses a `case_body` grammar element /// @returns the parsed statements Maybe case_body(); - /// Parses a `func_call_stmt` grammar element + /// Parses a `func_call_statement` grammar element /// @returns the parsed function call or nullptr - Maybe func_call_stmt(); - /// Parses a `loop_stmt` grammar element + Maybe func_call_statement(); + /// Parses a `loop_statement` grammar element /// @returns the parsed loop or nullptr - Maybe loop_stmt(); + Maybe loop_statement(); /// Parses a `for_header` grammar element, erroring on parse failure. /// @returns the parsed for header or nullptr Expect> expect_for_header(); - /// Parses a `for_stmt` grammar element + /// Parses a `for_statement` grammar element /// @returns the parsed for loop or nullptr - Maybe for_stmt(); - /// Parses a `continuing_stmt` grammar element + Maybe for_statement(); + /// Parses a `while_statement` grammar element + /// @returns the parsed while loop or nullptr + Maybe while_statement(); + /// Parses a `break_if_statement` grammar element + /// @returns the parsed statement or nullptr + Maybe break_if_statement(); + /// Parses a `continuing_compound_statement` grammar element /// @returns the parsed statements - Maybe continuing_stmt(); + Maybe continuing_compound_statement(); + /// Parses a `continuing_statement` grammar element + /// @returns the parsed statements + Maybe continuing_statement(); /// Parses a `const_literal` grammar element /// @returns the const literal parsed or nullptr if none found Maybe const_literal(); - /// Parses a `const_expr` grammar element, erroring on parse failure. - /// @returns the parsed constructor expression or nullptr on error - Expect expect_const_expr(); /// Parses a `primary_expression` grammar element /// @returns the parsed expression or nullptr Maybe primary_expression(); @@ -543,7 +610,7 @@ class ParserImpl { /// failure. /// @param use a description of what was being parsed if an error was raised /// @returns the list of arguments - Expect expect_argument_expression_list(std::string_view use); + Expect expect_argument_expression_list(std::string_view use); /// Parses the recursive portion of the postfix_expression /// @param prefix the left side of the expression /// @returns the parsed expression or nullptr @@ -554,95 +621,69 @@ class ParserImpl { /// Parses a `unary_expression` grammar element /// @returns the parsed expression or nullptr Maybe unary_expression(); - /// Parses the recursive part of the `multiplicative_expression`, erroring on - /// parse failure. + /// Parses the `expression` grammar rule + /// @returns the parsed expression or nullptr + Maybe expression(); + /// Parses the `bitwise_expression.post.unary_expression` grammar element /// @param lhs the left side of the expression /// @returns the parsed expression or nullptr - Expect expect_multiplicative_expr(const ast::Expression* lhs); - /// Parses the `multiplicative_expression` grammar element - /// @returns the parsed expression or nullptr - Maybe multiplicative_expression(); - /// Parses the recursive part of the `additive_expression`, erroring on parse - /// failure. + Maybe bitwise_expression_post_unary_expression( + const ast::Expression* lhs); + /// Parse the `multiplicative_operator` grammar element + /// @returns the parsed operator if successful + Maybe multiplicative_operator(); + /// Parses multiplicative elements /// @param lhs the left side of the expression - /// @returns the parsed expression or nullptr - Expect expect_additive_expr(const ast::Expression* lhs); - /// Parses the `additive_expression` grammar element - /// @returns the parsed expression or nullptr - Maybe additive_expression(); - /// Parses the recursive part of the `shift_expression`, erroring on parse - /// failure. + /// @returns the parsed expression or `lhs` if no match + Expect expect_multiplicative_expression_post_unary_expression( + const ast::Expression* lhs); + /// Parses additive elements /// @param lhs the left side of the expression + /// @returns the parsed expression or `lhs` if no match + Expect expect_additive_expression_post_unary_expression( + const ast::Expression* lhs); + /// Parses math elements + /// @param lhs the left side of the expression + /// @returns the parsed expression or `lhs` if no match + Expect expect_math_expression_post_unary_expression( + const ast::Expression* lhs); + /// Parses an `element_count_expression` grammar element /// @returns the parsed expression or nullptr - Expect expect_shift_expr(const ast::Expression* lhs); - /// Parses the `shift_expression` grammar element + Maybe element_count_expression(); + /// Parses a `unary_expression shift.post.unary_expression` /// @returns the parsed expression or nullptr Maybe shift_expression(); - /// Parses the recursive part of the `relational_expression`, erroring on - /// parse failure. + /// Parses a `shift_expression.post.unary_expression` grammar element /// @param lhs the left side of the expression - /// @returns the parsed expression or nullptr - Expect expect_relational_expr(const ast::Expression* lhs); - /// Parses the `relational_expression` grammar element + /// @returns the parsed expression or `lhs` if no match + Expect expect_shift_expression_post_unary_expression( + const ast::Expression* lhs); + /// Parses a `unary_expression relational_expression.post.unary_expression` /// @returns the parsed expression or nullptr Maybe relational_expression(); - /// Parses the recursive part of the `equality_expression`, erroring on parse - /// failure. + /// Parses a `relational_expression.post.unary_expression` grammar element /// @param lhs the left side of the expression - /// @returns the parsed expression or nullptr - Expect expect_equality_expr(const ast::Expression* lhs); - /// Parses the `equality_expression` grammar element - /// @returns the parsed expression or nullptr - Maybe equality_expression(); - /// Parses the recursive part of the `and_expression`, erroring on parse - /// failure. - /// @param lhs the left side of the expression - /// @returns the parsed expression or nullptr - Expect expect_and_expr(const ast::Expression* lhs); - /// Parses the `and_expression` grammar element - /// @returns the parsed expression or nullptr - Maybe and_expression(); - /// Parses the recursive part of the `exclusive_or_expression`, erroring on - /// parse failure. - /// @param lhs the left side of the expression - /// @returns the parsed expression or nullptr - Expect expect_exclusive_or_expr(const ast::Expression* lhs); - /// Parses the `exclusive_or_expression` grammar elememnt - /// @returns the parsed expression or nullptr - Maybe exclusive_or_expression(); - /// Parses the recursive part of the `inclusive_or_expression`, erroring on - /// parse failure. - /// @param lhs the left side of the expression - /// @returns the parsed expression or nullptr - Expect expect_inclusive_or_expr(const ast::Expression* lhs); - /// Parses the `inclusive_or_expression` grammar element - /// @returns the parsed expression or nullptr - Maybe inclusive_or_expression(); - /// Parses the recursive part of the `logical_and_expression`, erroring on - /// parse failure. - /// @param lhs the left side of the expression - /// @returns the parsed expression or nullptr - Expect expect_logical_and_expr(const ast::Expression* lhs); - /// Parses a `logical_and_expression` grammar element - /// @returns the parsed expression or nullptr - Maybe logical_and_expression(); - /// Parses the recursive part of the `logical_or_expression`, erroring on - /// parse failure. - /// @param lhs the left side of the expression - /// @returns the parsed expression or nullptr - Expect expect_logical_or_expr(const ast::Expression* lhs); - /// Parses a `logical_or_expression` grammar element - /// @returns the parsed expression or nullptr - Maybe logical_or_expression(); + /// @returns the parsed expression or `lhs` if no match + Expect expect_relational_expression_post_unary_expression( + const ast::Expression* lhs); + /// Parse the `additive_operator` grammar element + /// @returns the parsed operator if successful + Maybe additive_operator(); /// Parses a `compound_assignment_operator` grammar element /// @returns the parsed compound assignment operator Maybe compound_assignment_operator(); - /// Parses a `assignment_stmt` grammar element + /// Parses a `core_lhs_expression` grammar element + /// @returns the parsed expression or a non-kMatched failure + Maybe core_lhs_expression(); + /// Parses a `lhs_expression` grammar element + /// @returns the parsed expression or a non-kMatched failure + Maybe lhs_expression(); + /// Parses a `variable_updating_statement` grammar element /// @returns the parsed assignment or nullptr - Maybe assignment_stmt(); + Maybe variable_updating_statement(); /// Parses one or more attribute lists. /// @return the parsed attribute list, or an empty list on error. - Maybe attribute_list(); + Maybe attribute_list(); /// Parses a single attribute of the following types: /// * `struct_attribute` /// * `struct_member_attribute` @@ -658,6 +699,11 @@ class ParserImpl { /// @return the parsed attribute, or nullptr on error. Expect expect_attribute(); + /// Splits a peekable token into to parts filling in the peekable fields. + /// @param lhs the token to set in the current position + /// @param rhs the token to set in the placeholder + void split_token(Token::Type lhs, Token::Type rhs); + private: /// ReturnType resolves to the return type for the function or lambda F. template @@ -813,13 +859,13 @@ class ParserImpl { /// Reports an error if the attribute list `list` is not empty. /// Used to ensure that all attributes are consumed. - bool expect_attributes_consumed(ast::AttributeList& list); + bool expect_attributes_consumed(utils::VectorRef list); - Expect expect_type_decl_pointer(Token t); - Expect expect_type_decl_atomic(Token t); - Expect expect_type_decl_vector(Token t); - Expect expect_type_decl_array(Token t); - Expect expect_type_decl_matrix(Token t); + Expect expect_type_decl_pointer(const Source& s); + Expect expect_type_decl_atomic(const Source& s); + Expect expect_type_decl_vector(const Source& s, uint32_t count); + Expect expect_type_decl_array(const Source& s); + Expect expect_type_decl_matrix(const Source& s, const MatrixDimensions& dims); Expect expect_type(std::string_view use); @@ -840,9 +886,10 @@ class ParserImpl { return builder_.create(std::forward(args)...); } - std::unique_ptr lexer_; - std::deque token_queue_; - Token last_token_; + Source::File const* const file_; + std::vector tokens_; + size_t next_token_idx_ = 0; + size_t last_source_idx_ = 0; bool synchronized_ = true; uint32_t parse_depth_ = 0; std::vector sync_tokens_; diff --git a/src/tint/reader/wgsl/parser_impl_additive_expression_test.cc b/src/tint/reader/wgsl/parser_impl_additive_expression_test.cc index 51cf90ea00..971c6953bb 100644 --- a/src/tint/reader/wgsl/parser_impl_additive_expression_test.cc +++ b/src/tint/reader/wgsl/parser_impl_additive_expression_test.cc @@ -18,13 +18,18 @@ namespace tint::reader::wgsl { namespace { TEST_F(ParserImplTest, AdditiveExpression_Parses_Plus) { - auto p = parser("a + true"); - auto e = p->additive_expression(); - EXPECT_TRUE(e.matched); + auto p = parser("a + b"); + auto lhs = p->unary_expression(); + auto e = p->expect_additive_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 4u); + ASSERT_TRUE(e->Is()); auto* rel = e->As(); EXPECT_EQ(ast::BinaryOp::kAdd, rel->op); @@ -33,14 +38,15 @@ TEST_F(ParserImplTest, AdditiveExpression_Parses_Plus) { auto* ident = rel->lhs->As(); EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); } TEST_F(ParserImplTest, AdditiveExpression_Parses_Minus) { - auto p = parser("a - true"); - auto e = p->additive_expression(); - EXPECT_TRUE(e.matched); + auto p = parser("a - b"); + auto lhs = p->unary_expression(); + auto e = p->expect_additive_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); @@ -53,37 +59,146 @@ TEST_F(ParserImplTest, AdditiveExpression_Parses_Minus) { auto* ident = rel->lhs->As(); EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); } -TEST_F(ParserImplTest, AdditiveExpression_InvalidLHS) { - auto p = parser("if (a) {} + true"); - auto e = p->additive_expression(); - EXPECT_FALSE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - EXPECT_EQ(e.value, nullptr); -} - -TEST_F(ParserImplTest, AdditiveExpression_InvalidRHS) { - auto p = parser("true + if (a) {}"); - auto e = p->additive_expression(); - EXPECT_FALSE(e.matched); - EXPECT_TRUE(e.errored); - EXPECT_EQ(e.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:8: unable to parse right side of + expression"); -} - -TEST_F(ParserImplTest, AdditiveExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); - auto e = p->additive_expression(); - EXPECT_TRUE(e.matched); +TEST_F(ParserImplTest, AdditiveExpression_Parses_MinusMinus) { + auto p = parser("a--b"); + auto lhs = p->unary_expression(); + auto e = p->expect_additive_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kSubtract, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + auto* unary = rel->rhs->As(); + EXPECT_EQ(ast::UnaryOp::kNegation, unary->op); + + ASSERT_TRUE(unary->expr->Is()); + ident = unary->expr->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, AdditiveExpression_Parses_MultipleOps) { + auto p = parser("a - b + c - d"); + auto lhs = p->unary_expression(); + auto e = p->expect_additive_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + // lhs: ((a - b) + c + // op: - + // rhs: d + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kSubtract, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("d")); + + ASSERT_TRUE(rel->lhs->Is()); + // lhs: a - b + // op: + + // rhs: c + rel = rel->lhs->As(); + EXPECT_EQ(ast::BinaryOp::kAdd, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("c")); + + ASSERT_TRUE(rel->lhs->Is()); + // lhs: a + // op: - + // rhs: b + rel = rel->lhs->As(); + EXPECT_EQ(ast::BinaryOp::kSubtract, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, AdditiveExpression_Parses_MultipleOps_MixedMultiplication) { + auto p = parser("a - b * c - d"); + auto lhs = p->unary_expression(); + auto e = p->expect_additive_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + // lhs: a - (b * c) + // op: - + // rhs: d + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kSubtract, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("d")); + + ASSERT_TRUE(rel->lhs->Is()); + // lhs: a + // op: - + // rhs: b * c + rel = rel->lhs->As(); + EXPECT_EQ(ast::BinaryOp::kSubtract, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + // lhs: b + // op: * + // rhs: c + rel = rel->rhs->As(); + EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("c")); +} + +TEST_F(ParserImplTest, AdditiveExpression_InvalidRHS) { + auto p = parser("a + if (a) {}"); + auto lhs = p->unary_expression(); + auto e = p->expect_additive_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:5: unable to parse right side of + expression"); +} + +TEST_F(ParserImplTest, AdditiveExpression_NoMatch_ReturnsLHS) { + auto p = parser("a true"); + auto lhs = p->unary_expression(); + auto e = p->expect_additive_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + EXPECT_EQ(lhs.value, e.value); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_and_expression_test.cc b/src/tint/reader/wgsl/parser_impl_and_expression_test.cc deleted file mode 100644 index 1ed8a9cd4a..0000000000 --- a/src/tint/reader/wgsl/parser_impl_and_expression_test.cc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/reader/wgsl/parser_impl_test_helper.h" - -namespace tint::reader::wgsl { -namespace { - -TEST_F(ParserImplTest, AndExpression_Parses) { - auto p = parser("a & true"); - auto e = p->and_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - - ASSERT_TRUE(e->Is()); - auto* rel = e->As(); - EXPECT_EQ(ast::BinaryOp::kAnd, rel->op); - - ASSERT_TRUE(rel->lhs->Is()); - auto* ident = rel->lhs->As(); - EXPECT_EQ(ident->symbol, p->builder().Symbols().Register("a")); - - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); -} - -TEST_F(ParserImplTest, AndExpression_InvalidLHS) { - auto p = parser("if (a) {} & true"); - auto e = p->and_expression(); - EXPECT_FALSE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - EXPECT_EQ(e.value, nullptr); -} - -TEST_F(ParserImplTest, AndExpression_InvalidRHS) { - auto p = parser("true & if (a) {}"); - auto e = p->and_expression(); - EXPECT_FALSE(e.matched); - EXPECT_TRUE(e.errored); - EXPECT_EQ(e.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:8: unable to parse right side of & expression"); -} - -TEST_F(ParserImplTest, AndExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); - auto e = p->and_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); -} - -} // namespace -} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_argument_expression_list_test.cc b/src/tint/reader/wgsl/parser_impl_argument_expression_list_test.cc index 3042c201df..7f1132ced7 100644 --- a/src/tint/reader/wgsl/parser_impl_argument_expression_list_test.cc +++ b/src/tint/reader/wgsl/parser_impl_argument_expression_list_test.cc @@ -23,7 +23,7 @@ TEST_F(ParserImplTest, ArgumentExpressionList_Parses) { ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); - ASSERT_EQ(e.value.size(), 1u); + ASSERT_EQ(e.value.Length(), 1u); ASSERT_TRUE(e.value[0]->Is()); } @@ -33,7 +33,7 @@ TEST_F(ParserImplTest, ArgumentExpressionList_ParsesEmptyList) { ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); - ASSERT_EQ(e.value.size(), 0u); + ASSERT_EQ(e.value.Length(), 0u); } TEST_F(ParserImplTest, ArgumentExpressionList_ParsesMultiple) { @@ -42,7 +42,7 @@ TEST_F(ParserImplTest, ArgumentExpressionList_ParsesMultiple) { ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); - ASSERT_EQ(e.value.size(), 3u); + ASSERT_EQ(e.value.Length(), 3u); ASSERT_TRUE(e.value[0]->Is()); ASSERT_TRUE(e.value[1]->Is()); ASSERT_TRUE(e.value[2]->Is()); @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, ArgumentExpressionList_TrailingComma) { ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); - ASSERT_EQ(e.value.size(), 2u); + ASSERT_EQ(e.value.Length(), 2u); ASSERT_TRUE(e.value[0]->Is()); ASSERT_TRUE(e.value[1]->Is()); } diff --git a/src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc index 4fd23ce08f..1f2b19166d 100644 --- a/src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc @@ -19,7 +19,7 @@ namespace { TEST_F(ParserImplTest, AssignmentStmt_Parses_ToVariable) { auto p = parser("a = 123"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -42,7 +42,7 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_ToVariable) { TEST_F(ParserImplTest, AssignmentStmt_Parses_ToMember) { auto p = parser("a.b.c[2].d = 123"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -92,7 +92,7 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_ToMember) { TEST_F(ParserImplTest, AssignmentStmt_Parses_ToPhony) { auto p = parser("_ = 123i"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -111,9 +111,47 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_ToPhony) { ASSERT_TRUE(a->lhs->Is()); } -TEST_F(ParserImplTest, AssignmentStmt_Parses_CompoundOp) { - auto p = parser("a += 123u"); - auto e = p->assignment_stmt(); +TEST_F(ParserImplTest, AssignmentStmt_Phony_CompoundOpFails) { + auto p = parser("_ += 123i"); + auto e = p->variable_updating_statement(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:3: expected '=' for assignment"); +} + +TEST_F(ParserImplTest, AssignmentStmt_Phony_IncrementFails) { + auto p = parser("_ ++"); + auto e = p->variable_updating_statement(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:3: expected '=' for assignment"); +} + +TEST_F(ParserImplTest, AssignmentStmt_Phony_EqualIncrementFails) { + auto p = parser("_ = ++"); + auto e = p->variable_updating_statement(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(e.value, nullptr); + EXPECT_EQ( + p->error(), + "1:5: prefix increment and decrement operators are reserved for a future WGSL version"); +} + +struct CompoundData { + std::string str; + ast::BinaryOp op; +}; +using CompoundOpTest = ParserImplTestWithParam; +TEST_P(CompoundOpTest, CompoundOp) { + auto params = GetParam(); + auto p = parser("a " + params.str + " 123u"); + auto e = p->variable_updating_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -123,7 +161,7 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_CompoundOp) { ASSERT_NE(a, nullptr); ASSERT_NE(a->lhs, nullptr); ASSERT_NE(a->rhs, nullptr); - EXPECT_EQ(a->op, ast::BinaryOp::kAdd); + EXPECT_EQ(a->op, params.op); ASSERT_TRUE(a->lhs->Is()); auto* ident = a->lhs->As(); @@ -134,10 +172,22 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_CompoundOp) { EXPECT_EQ(a->rhs->As()->suffix, ast::IntLiteralExpression::Suffix::kU); } +INSTANTIATE_TEST_SUITE_P(ParserImplTest, + CompoundOpTest, + testing::Values(CompoundData{"+=", ast::BinaryOp::kAdd}, + CompoundData{"-=", ast::BinaryOp::kSubtract}, + CompoundData{"*=", ast::BinaryOp::kMultiply}, + CompoundData{"/=", ast::BinaryOp::kDivide}, + CompoundData{"%=", ast::BinaryOp::kModulo}, + CompoundData{"&=", ast::BinaryOp::kAnd}, + CompoundData{"|=", ast::BinaryOp::kOr}, + CompoundData{"^=", ast::BinaryOp::kXor}, + CompoundData{">>=", ast::BinaryOp::kShiftRight}, + CompoundData{"<<=", ast::BinaryOp::kShiftLeft})); TEST_F(ParserImplTest, AssignmentStmt_MissingEqual) { auto p = parser("a.b.c[2].d 123"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_TRUE(p->has_error()); @@ -147,7 +197,7 @@ TEST_F(ParserImplTest, AssignmentStmt_MissingEqual) { TEST_F(ParserImplTest, AssignmentStmt_Compound_MissingEqual) { auto p = parser("a + 123"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_TRUE(p->has_error()); @@ -157,7 +207,7 @@ TEST_F(ParserImplTest, AssignmentStmt_Compound_MissingEqual) { TEST_F(ParserImplTest, AssignmentStmt_InvalidLHS) { auto p = parser("if (true) {} = 123"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -166,7 +216,7 @@ TEST_F(ParserImplTest, AssignmentStmt_InvalidLHS) { TEST_F(ParserImplTest, AssignmentStmt_InvalidRHS) { auto p = parser("a.b.c[2].d = if (true) {}"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -176,7 +226,7 @@ TEST_F(ParserImplTest, AssignmentStmt_InvalidRHS) { TEST_F(ParserImplTest, AssignmentStmt_InvalidCompoundOp) { auto p = parser("a &&= true"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); diff --git a/src/tint/reader/wgsl/parser_impl_bitwise_expression_test.cc b/src/tint/reader/wgsl/parser_impl_bitwise_expression_test.cc new file mode 100644 index 0000000000..a5f675ca49 --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_bitwise_expression_test.cc @@ -0,0 +1,345 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, BitwiseExpr_NoOp) { + auto p = parser("a true"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_EQ(e.value, nullptr); +} + +TEST_F(ParserImplTest, BitwiseExpr_Or_Parses) { + auto p = parser("a | true"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 4u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kOr, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, BitwiseExpr_Or_Parses_Multiple) { + auto p = parser("a | true | b"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + // lhs: (a | true) + // rhs: b + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kOr, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); + + ASSERT_TRUE(rel->lhs->Is()); + + // lhs: a + // rhs: true + rel = rel->lhs->As(); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, BitwiseExpr_Or_MixedWithAnd_Invalid) { + auto p = parser("a | b & c"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:7: mixing '|' and '&' requires parenthesis"); +} + +TEST_F(ParserImplTest, BitwiseExpr_Or_MixedWithXor_Invalid) { + auto p = parser("a | b ^ c"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:7: mixing '|' and '^' requires parenthesis"); +} + +TEST_F(ParserImplTest, BitwiseExpr_Or_InvalidRHS) { + auto p = parser("true | if (a) {}"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:8: unable to parse right side of | expression"); +} + +TEST_F(ParserImplTest, BitwiseExpr_Xor_Parses) { + auto p = parser("a ^ true"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 4u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kXor, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, BitwiseExpr_Xor_Parses_Multiple) { + auto p = parser("a ^ true ^ b"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + // lhs: (a ^ true) + // rhs: b + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kXor, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); + + ASSERT_TRUE(rel->lhs->Is()); + + // lhs: a + // rhs: true + rel = rel->lhs->As(); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, BitwiseExpr_Xor_MixedWithOr_Invalid) { + auto p = parser("a ^ b | c"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:7: mixing '^' and '|' requires parenthesis"); +} + +TEST_F(ParserImplTest, BitwiseExpr_Xor_MixedWithAnd_Invalid) { + auto p = parser("a ^ b & c"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:7: mixing '^' and '&' requires parenthesis"); +} + +TEST_F(ParserImplTest, BitwiseExpr_Xor_InvalidRHS) { + auto p = parser("true ^ if (a) {}"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + ASSERT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:8: unable to parse right side of ^ expression"); +} + +TEST_F(ParserImplTest, BitwiseExpr_And_Parses) { + auto p = parser("a & true"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 4u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kAnd, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Register("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, BitwiseExpr_And_Parses_Multiple) { + auto p = parser("a & true & b"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + // lhs: (a & true) + // rhs: b + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kAnd, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Register("b")); + + ASSERT_TRUE(rel->lhs->Is()); + + // lhs: a + // rhs: true + rel = rel->lhs->As(); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Register("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, BitwiseExpr_And_Parses_AndAnd) { + auto p = parser("a & true &&b"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + // lhs: (a & true) + // rhs: &b + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kAnd, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* unary = rel->rhs->As(); + EXPECT_EQ(ast::UnaryOp::kAddressOf, unary->op); + + ASSERT_TRUE(unary->expr->Is()); + auto* ident = unary->expr->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Register("b")); + + ASSERT_TRUE(rel->lhs->Is()); + + // lhs: a + // rhs: true + rel = rel->lhs->As(); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Register("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, BitwiseExpr_And_MixedWithOr_Invalid) { + auto p = parser("a & b | c"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:7: mixing '&' and '|' requires parenthesis"); +} + +TEST_F(ParserImplTest, BitwiseExpr_And_MixedWithXor_Invalid) { + auto p = parser("a & b ^ c"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:7: mixing '&' and '^' requires parenthesis"); +} + +TEST_F(ParserImplTest, BitwiseExpr_And_InvalidRHS) { + auto p = parser("true & if (a) {}"); + auto lhs = p->unary_expression(); + auto e = p->bitwise_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:8: unable to parse right side of & expression"); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_body_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_body_stmt_test.cc deleted file mode 100644 index f84a5ba6c3..0000000000 --- a/src/tint/reader/wgsl/parser_impl_body_stmt_test.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/ast/discard_statement.h" -#include "src/tint/reader/wgsl/parser_impl_test_helper.h" - -namespace tint::reader::wgsl { -namespace { - -TEST_F(ParserImplTest, BodyStmt) { - auto p = parser(R"({ - discard; - return 1 + b / 2; -})"); - auto e = p->expect_body_stmt(); - ASSERT_FALSE(p->has_error()) << p->error(); - ASSERT_FALSE(e.errored); - ASSERT_EQ(e->statements.size(), 2u); - EXPECT_TRUE(e->statements[0]->Is()); - EXPECT_TRUE(e->statements[1]->Is()); -} - -TEST_F(ParserImplTest, BodyStmt_Empty) { - auto p = parser("{}"); - auto e = p->expect_body_stmt(); - ASSERT_FALSE(p->has_error()) << p->error(); - ASSERT_FALSE(e.errored); - EXPECT_EQ(e->statements.size(), 0u); -} - -TEST_F(ParserImplTest, BodyStmt_InvalidStmt) { - auto p = parser("{fn main() {}}"); - auto e = p->expect_body_stmt(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - EXPECT_EQ(p->error(), "1:2: expected '}'"); -} - -TEST_F(ParserImplTest, BodyStmt_MissingRightParen) { - auto p = parser("{return;"); - auto e = p->expect_body_stmt(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - EXPECT_EQ(p->error(), "1:9: expected '}'"); -} - -} // namespace -} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_break_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_break_stmt_test.cc index ca8802a371..21c526767a 100644 --- a/src/tint/reader/wgsl/parser_impl_break_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_break_stmt_test.cc @@ -20,7 +20,7 @@ namespace { TEST_F(ParserImplTest, BreakStmt) { auto p = parser("break"); - auto e = p->break_stmt(); + auto e = p->break_statement(); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); diff --git a/src/tint/reader/wgsl/parser_impl_call_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_call_stmt_test.cc index d044f8da00..59aeb3cb57 100644 --- a/src/tint/reader/wgsl/parser_impl_call_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_call_stmt_test.cc @@ -36,7 +36,7 @@ TEST_F(ParserImplTest, Statement_Call) { EXPECT_EQ(c->target.name->symbol, p->builder().Symbols().Get("a")); - EXPECT_EQ(c->args.size(), 0u); + EXPECT_EQ(c->args.Length(), 0u); } TEST_F(ParserImplTest, Statement_Call_WithParams) { @@ -52,7 +52,7 @@ TEST_F(ParserImplTest, Statement_Call_WithParams) { EXPECT_EQ(c->target.name->symbol, p->builder().Symbols().Get("a")); - EXPECT_EQ(c->args.size(), 3u); + EXPECT_EQ(c->args.Length(), 3u); EXPECT_TRUE(c->args[0]->Is()); EXPECT_TRUE(c->args[1]->Is()); EXPECT_TRUE(c->args[2]->Is()); @@ -71,7 +71,7 @@ TEST_F(ParserImplTest, Statement_Call_WithParams_TrailingComma) { EXPECT_EQ(c->target.name->symbol, p->builder().Symbols().Get("a")); - EXPECT_EQ(c->args.size(), 2u); + EXPECT_EQ(c->args.Length(), 2u); EXPECT_TRUE(c->args[0]->Is()); EXPECT_TRUE(c->args[1]->Is()); } diff --git a/src/tint/reader/wgsl/parser_impl_callable_test.cc b/src/tint/reader/wgsl/parser_impl_callable_test.cc new file mode 100644 index 0000000000..f47dde0848 --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_callable_test.cc @@ -0,0 +1,156 @@ +// Copyright 2020 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, Callable_Array) { + auto p = parser("array"); + auto t = p->callable(); + ASSERT_TRUE(p->peek_is(Token::Type::kEOF)); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(t.value, nullptr); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + EXPECT_FALSE(a->IsRuntimeArray()); + EXPECT_EQ(a->type, nullptr); + EXPECT_EQ(a->count, nullptr); +} + +TEST_F(ParserImplTest, Callable_VecPrefix) { + auto p = parser("vec3"); + auto t = p->callable(); + ASSERT_TRUE(p->peek_is(Token::Type::kEOF)); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(t.value, nullptr); + ASSERT_TRUE(t.value->Is()); + + auto* v = t.value->As(); + EXPECT_EQ(v->type, nullptr); + EXPECT_EQ(v->width, 3u); +} + +TEST_F(ParserImplTest, Callable_MatPrefix) { + auto p = parser("mat3x2"); + auto t = p->callable(); + ASSERT_TRUE(p->peek_is(Token::Type::kEOF)); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(t.value, nullptr); + ASSERT_TRUE(t.value->Is()); + + auto* m = t.value->As(); + EXPECT_EQ(m->type, nullptr); + EXPECT_EQ(m->columns, 3u); + EXPECT_EQ(m->rows, 2u); +} + +TEST_F(ParserImplTest, Callable_TypeDecl_F32) { + auto p = parser("f32"); + auto t = p->callable(); + ASSERT_TRUE(p->peek_is(Token::Type::kEOF)); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(t.value, nullptr); + ASSERT_TRUE(t.value->Is()); +} + +TEST_F(ParserImplTest, Callable_TypeDecl_Array) { + auto p = parser("array"); + auto t = p->callable(); + ASSERT_TRUE(p->peek_is(Token::Type::kEOF)); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(t.value, nullptr); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + EXPECT_FALSE(a->IsRuntimeArray()); + EXPECT_TRUE(a->type->Is()); + + auto* size = a->count->As(); + ASSERT_NE(size, nullptr); + EXPECT_EQ(size->value, 2); + EXPECT_EQ(size->suffix, ast::IntLiteralExpression::Suffix::kNone); +} + +TEST_F(ParserImplTest, Callable_TypeDecl_Array_Runtime) { + auto p = parser("array"); + auto t = p->callable(); + ASSERT_TRUE(p->peek_is(Token::Type::kEOF)); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(t.value, nullptr); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + EXPECT_TRUE(a->IsRuntimeArray()); + EXPECT_TRUE(a->type->Is()); + + ASSERT_EQ(a->count, nullptr); +} + +TEST_F(ParserImplTest, Callable_TypeDecl_VecPrefix) { + auto p = parser("vec3"); + auto t = p->callable(); + ASSERT_TRUE(p->peek_is(Token::Type::kEOF)); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(t.value, nullptr); + ASSERT_TRUE(t.value->Is()); + + auto* v = t.value->As(); + EXPECT_TRUE(v->type->Is()); + EXPECT_EQ(v->width, 3u); +} + +TEST_F(ParserImplTest, Callable_TypeDecl_MatPrefix) { + auto p = parser("mat3x2"); + auto t = p->callable(); + ASSERT_TRUE(p->peek_is(Token::Type::kEOF)); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(t.value, nullptr); + ASSERT_TRUE(t.value->Is()); + + auto* m = t.value->As(); + EXPECT_TRUE(m->type->Is()); + EXPECT_EQ(m->columns, 3u); + EXPECT_EQ(m->rows, 2u); +} + +TEST_F(ParserImplTest, Callable_NoMatch) { + auto p = parser("ident"); + auto t = p->callable(); + EXPECT_FALSE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + EXPECT_EQ(nullptr, t.value); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_case_body_test.cc b/src/tint/reader/wgsl/parser_impl_case_body_test.cc index f8c07a329e..c162be3310 100644 --- a/src/tint/reader/wgsl/parser_impl_case_body_test.cc +++ b/src/tint/reader/wgsl/parser_impl_case_body_test.cc @@ -24,7 +24,7 @@ TEST_F(ParserImplTest, CaseBody_Empty) { ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(e.errored); EXPECT_TRUE(e.matched); - EXPECT_EQ(e->statements.size(), 0u); + EXPECT_EQ(e->statements.Length(), 0u); } TEST_F(ParserImplTest, CaseBody_Statements) { @@ -36,7 +36,7 @@ TEST_F(ParserImplTest, CaseBody_Statements) { ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(e.errored); EXPECT_TRUE(e.matched); - ASSERT_EQ(e->statements.size(), 2u); + ASSERT_EQ(e->statements.Length(), 2u); EXPECT_TRUE(e->statements[0]->Is()); EXPECT_TRUE(e->statements[1]->Is()); } @@ -56,7 +56,7 @@ TEST_F(ParserImplTest, CaseBody_Fallthrough) { ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(e.errored); EXPECT_TRUE(e.matched); - ASSERT_EQ(e->statements.size(), 1u); + ASSERT_EQ(e->statements.Length(), 1u); EXPECT_TRUE(e->statements[0]->Is()); } diff --git a/src/tint/reader/wgsl/parser_impl_compound_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_compound_stmt_test.cc new file mode 100644 index 0000000000..947cb481c7 --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_compound_stmt_test.cc @@ -0,0 +1,59 @@ +// Copyright 2020 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/discard_statement.h" +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, CompoundStmt) { + auto p = parser(R"({ + discard; + return 1 + b / 2; +})"); + auto e = p->expect_compound_statement(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + ASSERT_EQ(e->statements.Length(), 2u); + EXPECT_TRUE(e->statements[0]->Is()); + EXPECT_TRUE(e->statements[1]->Is()); +} + +TEST_F(ParserImplTest, CompoundStmt_Empty) { + auto p = parser("{}"); + auto e = p->expect_compound_statement(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_EQ(e->statements.Length(), 0u); +} + +TEST_F(ParserImplTest, CompoundStmt_InvalidStmt) { + auto p = parser("{fn main() {}}"); + auto e = p->expect_compound_statement(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + EXPECT_EQ(p->error(), "1:2: expected '}'"); +} + +TEST_F(ParserImplTest, CompoundStmt_MissingRightParen) { + auto p = parser("{return;"); + auto e = p->expect_compound_statement(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + EXPECT_EQ(p->error(), "1:9: expected '}'"); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_const_expr_test.cc b/src/tint/reader/wgsl/parser_impl_const_expr_test.cc deleted file mode 100644 index 9d58058c4b..0000000000 --- a/src/tint/reader/wgsl/parser_impl_const_expr_test.cc +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/reader/wgsl/parser_impl_test_helper.h" - -namespace tint::reader::wgsl { -namespace { - -TEST_F(ParserImplTest, ConstExpr_TypeDecl) { - auto p = parser("vec2(1., 2.)"); - auto e = p->expect_const_expr(); - ASSERT_FALSE(p->has_error()) << p->error(); - ASSERT_FALSE(e.errored); - ASSERT_TRUE(e->Is()); - - auto* t = e->As(); - ASSERT_TRUE(t->target.type->Is()); - EXPECT_EQ(t->target.type->As()->width, 2u); - - ASSERT_EQ(t->args.size(), 2u); - - ASSERT_TRUE(t->args[0]->Is()); - EXPECT_FLOAT_EQ(t->args[0]->As()->value, 1.); - - ASSERT_TRUE(t->args[1]->Is()); - EXPECT_FLOAT_EQ(t->args[1]->As()->value, 2.); -} - -TEST_F(ParserImplTest, ConstExpr_TypeDecl_Empty) { - auto p = parser("vec2()"); - auto e = p->expect_const_expr(); - ASSERT_FALSE(p->has_error()) << p->error(); - ASSERT_FALSE(e.errored); - ASSERT_TRUE(e->Is()); - - auto* t = e->As(); - ASSERT_TRUE(t->target.type->Is()); - EXPECT_EQ(t->target.type->As()->width, 2u); - - ASSERT_EQ(t->args.size(), 0u); -} - -TEST_F(ParserImplTest, ConstExpr_TypeDecl_TrailingComma) { - auto p = parser("vec2(1., 2.,)"); - auto e = p->expect_const_expr(); - ASSERT_FALSE(p->has_error()) << p->error(); - ASSERT_FALSE(e.errored); - ASSERT_TRUE(e->Is()); - - auto* t = e->As(); - ASSERT_TRUE(t->target.type->Is()); - EXPECT_EQ(t->target.type->As()->width, 2u); - - ASSERT_EQ(t->args.size(), 2u); - ASSERT_TRUE(t->args[0]->Is()); - ASSERT_TRUE(t->args[1]->Is()); -} - -TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingRightParen) { - auto p = parser("vec2(1., 2."); - auto e = p->expect_const_expr(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:17: expected ')' for type constructor"); -} - -TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingLeftParen) { - auto p = parser("vec2 1., 2.)"); - auto e = p->expect_const_expr(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:11: expected '(' for type constructor"); -} - -TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingComma) { - auto p = parser("vec2(1. 2."); - auto e = p->expect_const_expr(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:14: expected ')' for type constructor"); -} - -TEST_F(ParserImplTest, ConstExpr_InvalidExpr) { - auto p = parser("vec2(1., if(a) {})"); - auto e = p->expect_const_expr(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:15: invalid type for const_expr"); -} - -TEST_F(ParserImplTest, ConstExpr_ConstLiteral) { - auto p = parser("true"); - auto e = p->expect_const_expr(); - ASSERT_FALSE(p->has_error()) << p->error(); - ASSERT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e.value->Is()); - EXPECT_TRUE(e.value->As()->value); -} - -TEST_F(ParserImplTest, ConstExpr_ConstLiteral_Invalid) { - auto p = parser("invalid"); - auto e = p->expect_const_expr(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:1: unable to parse const_expr"); -} - -TEST_F(ParserImplTest, ConstExpr_TypeConstructor) { - auto p = parser("S(0)"); - - auto e = p->expect_const_expr(); - ASSERT_FALSE(e.errored); - ASSERT_TRUE(e->Is()); - ASSERT_NE(e->As()->target.type, nullptr); - ASSERT_TRUE(e->As()->target.type->Is()); - EXPECT_EQ(e->As()->target.type->As()->name, - p->builder().Symbols().Get("S")); -} - -TEST_F(ParserImplTest, ConstExpr_Recursion) { - std::stringstream out; - for (size_t i = 0; i < 200; i++) { - out << "f32("; - } - out << "1.0"; - for (size_t i = 0; i < 200; i++) { - out << ")"; - } - auto p = parser(out.str()); - auto e = p->expect_const_expr(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:517: maximum parser recursive depth reached"); -} - -TEST_F(ParserImplTest, UnaryOp_Recursion) { - std::stringstream out; - for (size_t i = 0; i < 200; i++) { - out << "!"; - } - out << "1.0"; - auto p = parser(out.str()); - auto e = p->unary_expression(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:130: maximum parser recursive depth reached"); -} - -} // namespace -} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_const_literal_test.cc b/src/tint/reader/wgsl/parser_impl_const_literal_test.cc index 3e3709270c..16861e407e 100644 --- a/src/tint/reader/wgsl/parser_impl_const_literal_test.cc +++ b/src/tint/reader/wgsl/parser_impl_const_literal_test.cc @@ -14,7 +14,6 @@ #include "src/tint/reader/wgsl/parser_impl_test_helper.h" -#include #include #include "gmock/gmock.h" @@ -22,21 +21,21 @@ namespace tint::reader::wgsl { namespace { -// Makes an IEEE 754 binary32 floating point number with +// Makes an IEEE 754 binary64 floating point number with // - 0 sign if sign is 0, 1 otherwise // - 'exponent_bits' is placed in the exponent space. // So, the exponent bias must already be included. -float MakeFloat(int sign, int biased_exponent, int mantissa) { - const uint32_t sign_bit = sign ? 0x80000000u : 0u; - // The binary32 exponent is 8 bits, just below the sign. - const uint32_t exponent_bits = (biased_exponent & 0xffu) << 23; - // The mantissa is the bottom 23 bits. - const uint32_t mantissa_bits = (mantissa & 0x7fffffu); +double MakeDouble(uint64_t sign, uint64_t biased_exponent, uint64_t mantissa) { + const uint64_t sign_bit = sign ? 0x8000000000000000u : 0u; + // The binary64 exponent is 11 bits, just below the sign. + const uint64_t exponent_bits = (biased_exponent & 0x7FFull) << 52; + // The mantissa is the bottom 52 bits. + const uint64_t mantissa_bits = (mantissa & 0xFFFFFFFFFFFFFull); - uint32_t bits = sign_bit | exponent_bits | mantissa_bits; - float result = 0.0f; + uint64_t bits = sign_bit | exponent_bits | mantissa_bits; + double result = 0.0; static_assert(sizeof(result) == sizeof(bits), - "expected float and uint32_t to be the same size"); + "expected double and uint64_t to be the same size"); std::memcpy(&result, &bits, sizeof(bits)); return result; } @@ -114,22 +113,10 @@ TEST_F(ParserImplTest, ConstLiteral_Uint_Negative) { auto c = p->const_literal(); EXPECT_FALSE(c.matched); EXPECT_TRUE(c.errored); - EXPECT_EQ(p->error(), "1:1: unsigned literal cannot be negative"); + EXPECT_EQ(p->error(), "1:1: value cannot be represented as 'u32'"); ASSERT_EQ(c.value, nullptr); } -TEST_F(ParserImplTest, ConstLiteral_Float) { - auto p = parser("234.e12"); - auto c = p->const_literal(); - EXPECT_TRUE(c.matched); - EXPECT_FALSE(c.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(c.value, nullptr); - ASSERT_TRUE(c->Is()); - EXPECT_FLOAT_EQ(c->As()->value, 234e12f); - EXPECT_EQ(c->source.range, (Source::Range{{1u, 1u}, {1u, 8u}})); -} - TEST_F(ParserImplTest, ConstLiteral_InvalidFloat_IncompleteExponent) { auto p = parser("1.0e+"); auto c = p->const_literal(); @@ -139,45 +126,11 @@ TEST_F(ParserImplTest, ConstLiteral_InvalidFloat_IncompleteExponent) { ASSERT_EQ(c.value, nullptr); } -TEST_F(ParserImplTest, ConstLiteral_InvalidFloat_TooSmallMagnitude) { - auto p = parser("1e-256"); - auto c = p->const_literal(); - EXPECT_FALSE(c.matched); - EXPECT_TRUE(c.errored); - EXPECT_EQ(p->error(), "1:1: f32 (1e-256) magnitude too small, not representable"); - ASSERT_EQ(c.value, nullptr); -} - -TEST_F(ParserImplTest, ConstLiteral_InvalidFloat_TooLargeNegative) { - auto p = parser("-1.2e+256"); - auto c = p->const_literal(); - EXPECT_FALSE(c.matched); - EXPECT_TRUE(c.errored); - EXPECT_EQ(p->error(), "1:1: f32 (-1.2e+256) too large (negative)"); - ASSERT_EQ(c.value, nullptr); -} - -TEST_F(ParserImplTest, ConstLiteral_InvalidFloat_TooLargePositive) { - auto p = parser("1.2e+256"); - auto c = p->const_literal(); - EXPECT_FALSE(c.matched); - EXPECT_TRUE(c.errored); - EXPECT_EQ(p->error(), "1:1: f32 (1.2e+256) too large (positive)"); - ASSERT_EQ(c.value, nullptr); -} - -// Returns true if the given non-Nan float numbers are equal. -bool FloatEqual(float a, float b) { - // Avoid Clang complaining about equality test on float. - // -Wfloat-equal. - return (a <= b) && (a >= b); -} - struct FloatLiteralTestCase { std::string input; - float expected; + double expected; bool operator==(const FloatLiteralTestCase& other) const { - return (input == other.input) && FloatEqual(expected, other.expected); + return (input == other.input) && std::equal_to()(expected, other.expected); } }; @@ -196,198 +149,364 @@ TEST_P(ParserImplFloatLiteralTest, Parse) { EXPECT_FALSE(c.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(c.value, nullptr); - ASSERT_TRUE(c->Is()); - EXPECT_FLOAT_EQ(c->As()->value, params.expected); + auto* literal = c->As(); + ASSERT_NE(literal, nullptr); + // Use EXPECT_EQ instead of EXPECT_DOUBLE_EQ here, because EXPECT_DOUBLE_EQ use AlmostEquals(), + // which allows an error up to 4 ULPs. + EXPECT_EQ(literal->value, params.expected) + << "\n" + << "got: " << std::hexfloat << literal->value << "\n" + << "expected: " << std::hexfloat << params.expected; + if (params.input.back() == 'f') { + EXPECT_EQ(c->As()->suffix, + ast::FloatLiteralExpression::Suffix::kF); + } else if (params.input.back() == 'h') { + EXPECT_EQ(c->As()->suffix, + ast::FloatLiteralExpression::Suffix::kH); + } else { + EXPECT_EQ(c->As()->suffix, + ast::FloatLiteralExpression::Suffix::kNone); + } + EXPECT_EQ(c->source.range, (Source::Range{{1u, 1u}, {1u, 1u + params.input.size()}})); } - using FloatLiteralTestCaseList = std::vector; -FloatLiteralTestCaseList DecimalFloatCases() { - return FloatLiteralTestCaseList{ - {"0.0", 0.0f}, // Zero - {"1.0", 1.0f}, // One - {"-1.0", -1.0f}, // MinusOne - {"1000000000.0", 1e9f}, // Billion - {"-0.0", std::copysign(0.0f, -5.0f)}, // NegativeZero - {"0.0", MakeFloat(0, 0, 0)}, // Zero - {"-0.0", MakeFloat(1, 0, 0)}, // NegativeZero - {"1.0", MakeFloat(0, 127, 0)}, // One - {"-1.0", MakeFloat(1, 127, 0)}, // NegativeOne - }; -} - INSTANTIATE_TEST_SUITE_P(ParserImplFloatLiteralTest_Float, ParserImplFloatLiteralTest, - testing::ValuesIn(DecimalFloatCases())); + testing::ValuesIn(FloatLiteralTestCaseList{ + {"0.0", 0.0}, // Zero + {"1.0", 1.0}, // One + {"-1.0", -1.0}, // MinusOne + {"1000000000.0", 1e9}, // Billion + {"-0.0", std::copysign(0.0, -5.0)}, // NegativeZero + {"0.0", MakeDouble(0, 0, 0)}, // Zero + {"-0.0", MakeDouble(1, 0, 0)}, // NegativeZero + {"1.0", MakeDouble(0, 1023, 0)}, // One + {"-1.0", MakeDouble(1, 1023, 0)}, // NegativeOne -const float NegInf = MakeFloat(1, 255, 0); -const float PosInf = MakeFloat(0, 255, 0); + {"234.e12", 234.e12}, + {"234.e12f", static_cast(234.e12f)}, + {"234.e2h", static_cast(f16::Quantize(234.e2))}, + + // Tiny cases + {"1e-5000", 0.0}, + {"-1e-5000", 0.0}, + {"1e-5000f", 0.0}, + {"-1e-5000f", 0.0}, + {"1e-50f", 0.0}, + {"-1e-50f", 0.0}, + {"1e-5000h", 0.0}, + {"-1e-5000h", 0.0}, + {"1e-50h", 0.0}, + {"-1e-50h", 0.0}, + {"1e-8h", 0.0}, // The smallest positive subnormal f16 is 5.96e-8 + {"-1e-8h", 0.0}, + + // Nearly overflow + {"1.e308", 1.e308}, + {"-1.e308", -1.e308}, + {"1.8e307", 1.8e307}, + {"-1.8e307", -1.8e307}, + {"1.798e307", 1.798e307}, + {"-1.798e307", -1.798e307}, + {"1.7977e307", 1.7977e307}, + {"-1.7977e307", -1.7977e307}, + + // Nearly overflow + {"1e38f", static_cast(1e38f)}, + {"-1e38f", static_cast(-1e38f)}, + {"4.0e37f", static_cast(4.0e37f)}, + {"-4.0e37f", static_cast(-4.0e37f)}, + {"3.5e37f", static_cast(3.5e37f)}, + {"-3.5e37f", static_cast(-3.5e37f)}, + {"3.403e37f", static_cast(3.403e37f)}, + {"-3.403e37f", static_cast(-3.403e37f)}, + + // Nearly overflow + {"6e4h", 6e4}, + {"-6e4h", -6e4}, + {"8.0e3h", 8.0e3}, + {"-8.0e3h", -8.0e3}, + {"3.5e3h", 3.5e3}, + {"-3.5e3h", -3.5e3}, + {"3.403e3h", 3.402e3}, // Quantized + {"-3.403e3h", -3.402e3}, // Quantized + })); + +const double NegInf = MakeDouble(1, 0x7FF, 0); +const double PosInf = MakeDouble(0, 0x7FF, 0); FloatLiteralTestCaseList HexFloatCases() { return FloatLiteralTestCaseList{ // Regular numbers - {"0x0p+0", 0.f}, - {"0x1p+0", 1.f}, - {"0x1p+1", 2.f}, - {"0x1.8p+1", 3.f}, - {"0x1.99999ap-4", 0.1f}, - {"0x1p-1", 0.5f}, - {"0x1p-2", 0.25f}, - {"0x1.8p-1", 0.75f}, - {"-0x0p+0", -0.f}, - {"-0x1p+0", -1.f}, - {"-0x1p-1", -0.5f}, - {"-0x1p-2", -0.25f}, - {"-0x1.8p-1", -0.75f}, + {"0x0p+0", 0x0p+0}, + {"0x1p+0", 0x1p+0}, + {"0x1p+1", 0x1p+1}, + {"0x1.8p+1", 0x1.8p+1}, + {"0x1.99999ap-4", 0x1.99999ap-4}, + {"0x1p-1", 0x1p-1}, + {"0x1p-2", 0x1p-2}, + {"0x1.8p-1", 0x1.8p-1}, + {"-0x0p+0", -0x0p+0}, + {"-0x1p+0", -0x1p+0}, + {"-0x1p-1", -0x1p-1}, + {"-0x1p-2", -0x1p-2}, + {"-0x1.8p-1", -0x1.8p-1}, + {"0x0.4p+1", 0x0.4p+1}, + {"0x0.02p+3", 0x0.02p+3}, + {"0x4.4p+1", 0x4.4p+1}, + {"0x8c.02p+3", 0x8c.02p+3}, // Large numbers - {"0x1p+9", 512.f}, - {"0x1p+10", 1024.f}, - {"0x1.02p+10", 1024.f + 8.f}, - {"-0x1p+9", -512.f}, - {"-0x1p+10", -1024.f}, - {"-0x1.02p+10", -1024.f - 8.f}, + {"0x1p+9", 0x1p+9}, + {"0x1p+10", 0x1p+10}, + {"0x1.02p+10", 0x1.02p+10}, + {"-0x1p+9", -0x1p+9}, + {"-0x1p+10", -0x1p+10}, + {"-0x1.02p+10", -0x1.02p+10}, // Small numbers - {"0x1p-9", 1.0f / 512.f}, - {"0x1p-10", 1.0f / 1024.f}, - {"0x1.02p-3", 1.0f / 1024.f + 1.0f / 8.f}, - {"-0x1p-9", 1.0f / -512.f}, - {"-0x1p-10", 1.0f / -1024.f}, - {"-0x1.02p-3", 1.0f / -1024.f - 1.0f / 8.f}, + {"0x1p-9", 0x1p-9}, + {"0x1p-10", 0x1p-10}, + {"0x1.02p-3", 0x1.02p-3}, + {"-0x1p-9", -0x1p-9}, + {"-0x1p-10", -0x1p-10}, + {"-0x1.02p-3", -0x1.02p-3}, // Near lowest non-denorm - {"0x1p-124", std::ldexp(1.f * 8.f, -127)}, - {"0x1p-125", std::ldexp(1.f * 4.f, -127)}, - {"-0x1p-124", -std::ldexp(1.f * 8.f, -127)}, - {"-0x1p-125", -std::ldexp(1.f * 4.f, -127)}, + {"0x1p-1020", 0x1p-1020}, + {"0x1p-1021", 0x1p-1021}, + {"-0x1p-1020", -0x1p-1020}, + {"-0x1p-1021", -0x1p-1021}, + + {"0x1p-124f", 0x1p-124}, + {"0x1p-125f", 0x1p-125}, + {"-0x1p-124f", -0x1p-124}, + {"-0x1p-125f", -0x1p-125}, + + {"0x1p-12h", 0x1p-12}, + {"0x1p-13h", 0x1p-13}, + {"-0x1p-12h", -0x1p-12}, + {"-0x1p-13h", -0x1p-13}, // Lowest non-denorm - {"0x1p-126", std::ldexp(1.f * 2.f, -127)}, - {"-0x1p-126", -std::ldexp(1.f * 2.f, -127)}, + {"0x1p-1022", 0x1p-1022}, + {"-0x1p-1022", -0x1p-1022}, + + {"0x1p-126f", 0x1p-126}, + {"-0x1p-126f", -0x1p-126}, + + {"0x1p-14h", 0x1p-14}, + {"-0x1p-14h", -0x1p-14}, // Denormalized values - {"0x1p-127", std::ldexp(1.f, -127)}, - {"0x1p-128", std::ldexp(1.f / 2.f, -127)}, - {"0x1p-129", std::ldexp(1.f / 4.f, -127)}, - {"0x1p-130", std::ldexp(1.f / 8.f, -127)}, - {"-0x1p-127", -std::ldexp(1.f, -127)}, - {"-0x1p-128", -std::ldexp(1.f / 2.f, -127)}, - {"-0x1p-129", -std::ldexp(1.f / 4.f, -127)}, - {"-0x1p-130", -std::ldexp(1.f / 8.f, -127)}, + {"0x1p-1023", 0x1p-1023}, + {"0x0.8p-1022", 0x0.8p-1022}, + {"0x1p-1024", 0x1p-1024}, + {"0x0.2p-1021", 0x0.2p-1021}, + {"0x1p-1025", 0x1p-1025}, + {"0x1p-1026", 0x1p-1026}, + {"-0x1p-1023", -0x1p-1023}, + {"-0x1p-1024", -0x1p-1024}, + {"-0x1p-1025", -0x1p-1025}, + {"-0x1p-1026", -0x1p-1026}, + {"0x1.8p-1023", 0x1.8p-1023}, + {"0x1.8p-1024", 0x1.8p-1024}, - {"0x1.8p-127", std::ldexp(1.f, -127) + (std::ldexp(1.f, -127) / 2.f)}, - {"0x1.8p-128", std::ldexp(1.f, -127) / 2.f + (std::ldexp(1.f, -127) / 4.f)}, + {"0x1p-127f", 0x1p-127}, + {"0x0.8p-126f", 0x0.8p-126}, + {"0x1p-128f", 0x1p-128}, + {"0x0.2p-125f", 0x0.2p-125}, + {"0x1p-129f", 0x1p-129}, + {"0x1p-130f", 0x1p-130}, + {"-0x1p-127f", -0x1p-127}, + {"-0x1p-128f", -0x1p-128}, + {"-0x1p-129f", -0x1p-129}, + {"-0x1p-130f", -0x1p-130}, + {"0x1.8p-127f", 0x1.8p-127}, + {"0x1.8p-128f", 0x1.8p-128}, - {"0x1p-149", MakeFloat(0, 0, 1)}, // +SmallestDenormal - {"0x1p-148", MakeFloat(0, 0, 2)}, // +BiggerDenormal - {"0x1.fffffcp-127", MakeFloat(0, 0, 0x7fffff)}, // +LargestDenormal - {"-0x1p-149", MakeFloat(1, 0, 1)}, // -SmallestDenormal - {"-0x1p-148", MakeFloat(1, 0, 2)}, // -BiggerDenormal - {"-0x1.fffffcp-127", MakeFloat(1, 0, 0x7fffff)}, // -LargestDenormal + {"0x1p-15h", 0x1p-15}, + {"0x0.8p-14h", 0x0.8p-14}, + {"0x1p-16h", 0x1p-16}, + {"0x0.2p-13h", 0x0.2p-13}, + {"0x1p-17h", 0x1p-17}, + {"0x1p-18h", 0x1p-18}, + {"-0x1p-15h", -0x1p-15}, + {"-0x1p-16h", -0x1p-16}, + {"-0x1p-17h", -0x1p-17}, + {"-0x1p-18h", -0x1p-18}, + {"0x1.8p-15h", 0x1.8p-15}, + {"0x1.8p-16h", 0x1.8p-16}, - {"0x1.2bfaf8p-127", MakeFloat(0, 0, 0xcafebe)}, // +Subnormal - {"-0x1.2bfaf8p-127", MakeFloat(1, 0, 0xcafebe)}, // -Subnormal - {"0x1.55554p-130", MakeFloat(0, 0, 0xaaaaa)}, // +Subnormal - {"-0x1.55554p-130", MakeFloat(1, 0, 0xaaaaa)}, // -Subnormal + // F64 extremities + {"0x1p-1074", 0x1p-1074}, // +SmallestDenormal + {"0x1p-1073", 0x1p-1073}, // +BiggerDenormal + {"0x1.ffffffffffffep-1023", 0x1.ffffffffffffep-1023}, // +LargestDenormal + {"0x0.fffffffffffffp-1022", 0x0.fffffffffffffp-1022}, // +LargestDenormal + {"-0x1p-1074", -0x1p-1074}, // -SmallestDenormal + {"-0x1p-1073", -0x1p-1073}, // -BiggerDenormal + {"-0x1.ffffffffffffep-1023", -0x1.ffffffffffffep-1023}, // -LargestDenormal + {"-0x0.fffffffffffffp-1022", -0x0.fffffffffffffp-1022}, // -LargestDenormal - // Nan -> Infinity - {"0x1.8p+128", PosInf}, - {"0x1.0002p+128", PosInf}, - {"0x1.0018p+128", PosInf}, - {"0x1.01ep+128", PosInf}, - {"0x1.fffffep+128", PosInf}, - {"-0x1.8p+128", NegInf}, - {"-0x1.0002p+128", NegInf}, - {"-0x1.0018p+128", NegInf}, - {"-0x1.01ep+128", NegInf}, - {"-0x1.fffffep+128", NegInf}, + {"0x0.cafebeeff000dp-1022", 0x0.cafebeeff000dp-1022}, // +Subnormal + {"-0x0.cafebeeff000dp-1022", -0x0.cafebeeff000dp-1022}, // -Subnormal + {"0x1.2bfaf8p-1052", 0x1.2bfaf8p-1052}, // +Subnormal + {"-0x1.2bfaf8p-1052", -0x1.2bfaf8p-1052}, // +Subnormal + {"0x1.55554p-1055", 0x1.55554p-1055}, // +Subnormal + {"-0x1.55554p-1055", -0x1.55554p-1055}, // -Subnormal + {"0x1.fffffffffffp-1027", 0x1.fffffffffffp-1027}, // +Subnormal, = 0x0.0fffffffffff8p-1022 + {"-0x1.fffffffffffp-1027", -0x1.fffffffffffp-1027}, // -Subnormal - // Infinity - {"0x1p+128", PosInf}, - {"-0x1p+128", NegInf}, - {"0x32p+127", PosInf}, - {"0x32p+500", PosInf}, - {"-0x32p+127", NegInf}, - {"-0x32p+500", NegInf}, + // F32 extremities + {"0x1p-149f", 0x1p-149}, // +SmallestDenormal + {"0x1p-148f", 0x1p-148}, // +BiggerDenormal + {"0x1.fffffcp-127f", 0x1.fffffcp-127}, // +LargestDenormal + {"0x0.fffffep-126f", 0x0.fffffep-126}, // +LargestDenormal + {"0x1.0p-126f", 0x1.0p-126}, // +SmallestNormal + {"0x8.0p-129f", 0x8.0p-129}, // +SmallestNormal + {"-0x1p-149f", -0x1p-149}, // -SmallestDenormal + {"-0x1p-148f", -0x1p-148}, // -BiggerDenormal + {"-0x1.fffffcp-127f", -0x1.fffffcp-127}, // -LargestDenormal + {"-0x0.fffffep-126f", -0x0.fffffep-126}, // -LargestDenormal + {"-0x1.0p-126f", -0x1.0p-126}, // -SmallestNormal + {"-0x8.0p-129f", -0x8.0p-129}, // -SmallestNormal - // Overflow -> Infinity - {"0x1p+129", PosInf}, - {"0x1.1p+128", PosInf}, - {"-0x1p+129", NegInf}, - {"-0x1.1p+128", NegInf}, - {"0x1.0p2147483520", PosInf}, // INT_MAX - 127 (largest valid exponent) + {"0x0.cafebp-129f", 0x0.cafebp-129}, // +Subnormal + {"-0x0.cafebp-129f", -0x0.cafebp-129}, // -Subnormal + {"0x1.2bfaf8p-127f", 0x1.2bfaf8p-127}, // +Subnormal + {"-0x1.2bfaf8p-127f", -0x1.2bfaf8p-127}, // -Subnormal + {"0x1.55554p-130f", 0x1.55554p-130}, // +Subnormal + {"-0x1.55554p-130f", -0x1.55554p-130}, // -Subnormal + + // F32 exactly representable + {"0x1.000002p+0f", 0x1.000002p+0}, + {"0x8.0000fp+0f", 0x8.0000fp+0}, + {"0x8.fffffp+0f", 0x8.fffffp+0}, + {"0x8.00003p+0f", 0x8.00003p+0}, + {"0x2.123p+0f", 0x2.123p+0}, + {"0x2.cafefp+0f", 0x2.cafefp+0}, + {"0x0.0000fep-126f", 0x0.0000fep-126}, // Subnormal + {"-0x0.0000fep-126f", -0x0.0000fep-126}, // Subnormal + {"0x3.f8p-144f", 0x3.f8p-144}, // Subnormal + {"-0x3.f8p-144f", -0x3.f8p-144}, // Subnormal + + // F16 extremities + {"0x1p-24h", 0x1p-24}, // +SmallestDenormal + {"0x1p-23h", 0x1p-23}, // +BiggerDenormal + {"0x1.ff8p-15h", 0x1.ff8p-15}, // +LargestDenormal + {"0x0.ffcp-14h", 0x0.ffcp-14}, // +LargestDenormal + {"0x1.0p-14h", 0x1.0p-14}, // +SmallestNormal + {"0x8.0p-17h", 0x8.0p-17}, // +SmallestNormal + {"-0x1p-24h", -0x1p-24}, // -SmallestDenormal + {"-0x1p-23h", -0x1p-23}, // -BiggerDenormal + {"-0x1.ff8p-15h", -0x1.ff8p-15}, // -LargestDenormal + {"-0x0.ffcp-14h", -0x0.ffcp-14}, // -LargestDenormal + {"-0x1.0p-14h", -0x1.0p-14}, // -SmallestNormal + {"-0x8.0p-17h", -0x8.0p-17}, // -SmallestNormal + + {"0x0.a8p-19h", 0x0.a8p-19}, // +Subnormal + {"-0x0.a8p-19h", -0x0.a8p-19}, // -Subnormal + {"0x1.7ap-17h", 0x1.7ap-17}, // +Subnormal + {"-0x1.7ap-17h", -0x1.7ap-17}, // -Subnormal + {"0x1.dp-20h", 0x1.dp-20}, // +Subnormal + {"-0x1.dp-20h", -0x1.dp-20}, // -Subnormal + + // F16 exactly representable + {"0x1.004p+0h", 0x1.004p+0}, + {"0x8.02p+0h", 0x8.02p+0}, + {"0x8.fep+0h", 0x8.fep+0}, + {"0x8.06p+0h", 0x8.06p+0}, + {"0x2.128p+0h", 0x2.128p+0}, + {"0x2.ca8p+0h", 0x2.ca8p+0}, + {"0x0.0fcp-14h", 0x0.0fcp-14}, // Subnormal + {"-0x0.0fcp-14h", -0x0.0fcp-14}, // Subnormal + {"0x3.f00p-20h", 0x3.f00p-20}, // Subnormal + {"-0x3.f00p-20h", -0x3.f00p-20}, // Subnormal // Underflow -> Zero - {"0x1p-500", 0.f}, // Exponent underflows - {"-0x1p-500", -0.f}, - {"0x0.00000000001p-126", 0.f}, // Fraction causes underflow - {"-0x0.0000000001p-127", -0.f}, - {"0x0.01p-142", 0.f}, - {"-0x0.01p-142", -0.f}, // Fraction causes additional underflow - {"0x1.0p-2147483520", 0}, // -(INT_MAX - 127) (smallest valid exponent) + {"0x1p-1075", 0.0}, // Exponent underflows + {"-0x1p-1075", 0.0}, + {"0x1p-5000", 0.0}, + {"-0x1p-5000", 0.0}, + {"0x0.00000000000000000000001p-1022", 0.0}, // Fraction causes underflow + {"-0x0.0000000000000000000001p-1023", -0.0}, + {"0x0.01p-1073", -0.0}, + {"-0x0.01p-1073", -0.0}, // Fraction causes additional underflow + + {"0x1.0p-9223372036854774784", 0}, // -(INT64_MAX - 1023) (smallest valid exponent) // Zero with non-zero exponent -> Zero - {"0x0p+0", 0.f}, - {"0x0p+1", 0.f}, - {"0x0p-1", 0.f}, - {"0x0p+9999999999", 0.f}, - {"0x0p-9999999999", 0.f}, + {"0x0p+0", 0.0}, + {"0x0p+1", 0.0}, + {"0x0p-1", 0.0}, + {"0x0p+9999999999", 0.0}, + {"0x0p-9999999999", 0.0}, // Same, but with very large positive exponents that would cause overflow // if the mantissa were non-zero. - {"0x0p+4000000000", 0.f}, // 4 billion: - {"0x0p+40000000000", 0.f}, // 40 billion - {"-0x0p+40000000000", 0.f}, // As above 2, but negative mantissa - {"-0x0p+400000000000", 0.f}, - {"0x0.00p+4000000000", 0.f}, // As above 4, but with fractional part - {"0x0.00p+40000000000", 0.f}, - {"-0x0.00p+40000000000", 0.f}, - {"-0x0.00p+400000000000", 0.f}, - {"0x0p-4000000000", 0.f}, // As above 8, but with negative exponents - {"0x0p-40000000000", 0.f}, - {"-0x0p-40000000000", 0.f}, - {"-0x0p-400000000000", 0.f}, - {"0x0.00p-4000000000", 0.f}, - {"0x0.00p-40000000000", 0.f}, - {"-0x0.00p-40000000000", 0.f}, - {"-0x0.00p-400000000000", 0.f}, + {"0x0p+10000000000000000000", 0.0}, // 10 quintillion (10,000,000,000,000,000,000) + {"0x0p+100000000000000000000", 0.0}, // 100 quintillion (100,000,000,000,000,000,000) + {"-0x0p+100000000000000000000", 0.0}, // As above 2, but negative mantissa + {"-0x0p+1000000000000000000000", 0.0}, + {"0x0.00p+10000000000000000000", 0.0}, // As above 4, but with fractional part + {"0x0.00p+100000000000000000000", 0.0}, + {"-0x0.00p+100000000000000000000", 0.0}, + {"-0x0.00p+1000000000000000000000", 0.0}, + {"0x0p-10000000000000000000", 0.0}, // As above 8, but with negative exponents + {"0x0p-100000000000000000000", 0.0}, + {"-0x0p-100000000000000000000", 0.0}, + {"-0x0p-1000000000000000000000", 0.0}, + {"0x0.00p-10000000000000000000", 0.0}, + {"0x0.00p-100000000000000000000", 0.0}, + {"-0x0.00p-100000000000000000000", 0.0}, + {"-0x0.00p-1000000000000000000000", 0.0}, // Test parsing - {"0x0p0", 0.f}, - {"0x0p-0", 0.f}, - {"0x0p+000", 0.f}, - {"0x00000000000000p+000000000000000", 0.f}, - {"0x00000000000000p-000000000000000", 0.f}, - {"0x00000000000001p+000000000000000", 1.f}, - {"0x00000000000001p-000000000000000", 1.f}, - {"0x0000000000000000000001.99999ap-000000000000000004", 0.1f}, - {"0x2p+0", 2.f}, - {"0xFFp+0", 255.f}, - {"0x0.8p+0", 0.5f}, - {"0x0.4p+0", 0.25f}, - {"0x0.4p+1", 2 * 0.25f}, - {"0x0.4p+2", 4 * 0.25f}, - {"0x123Ep+1", 9340.f}, - {"-0x123Ep+1", -9340.f}, - {"0x1a2b3cP12", 7.024656e+09f}, - {"-0x1a2b3cP12", -7.024656e+09f}, + {"0x0p0", 0.0}, + {"0x0p-0", 0.0}, + {"0x0p+000", 0.0}, + {"0x00000000000000p+000000000000000", 0.0}, + {"0x00000000000000p-000000000000000", 0.0}, + {"0x00000000000001p+000000000000000", 1.0}, + {"0x00000000000001p-000000000000000", 1.0}, + {"0x0000000000000000000001.99999ap-000000000000000004", 0.10000000149011612}, + {"0x2p+0", 2.0}, + {"0xFFp+0", 255.0}, + {"0x0.8p+0", 0.5}, + {"0x0.4p+0", 0.25}, + {"0x0.4p+1", 2 * 0.25}, + {"0x0.4p+2", 4 * 0.25}, + {"0x123Ep+1", 9340.0}, + {"-0x123Ep+1", -9340.0}, + {"0x1a2b3cP12", 7.024656384e+09}, + {"-0x1a2b3cP12", -7.024656384e+09}, // Examples without a binary exponent part. - {"0x1.", 1.0f}, - {"0x.8", 0.5f}, - {"0x1.8", 1.5f}, - {"-0x1.", -1.0f}, - {"-0x.8", -0.5f}, - {"-0x1.8", -1.5f}, + {"0x1.", 1.0}, + {"0x.8", 0.5}, + {"0x1.8", 1.5}, + {"-0x1.", -1.0}, + {"-0x.8", -0.5}, + {"-0x1.8", -1.5}, // Examples with a binary exponent and a 'f' suffix. - {"0x1.p0f", 1.0f}, - {"0x.8p2f", 2.0f}, - {"0x1.8p-1f", 0.75f}, - {"0x2p-2f", 0.5f}, // No binary point - {"-0x1.p0f", -1.0f}, - {"-0x.8p2f", -2.0f}, - {"-0x1.8p-1f", -0.75f}, - {"-0x2p-2f", -0.5f}, // No binary point + {"0x1.p0f", 1.0}, + {"0x.8p2f", 2.0}, + {"0x1.8p-1f", 0.75}, + {"0x2p-2f", 0.5}, // No binary point + {"-0x1.p0f", -1.0}, + {"-0x.8p2f", -2.0}, + {"-0x1.8p-1f", -0.75}, + {"-0x2p-2f", -0.5}, // No binary point + + // Examples with a binary exponent and a 'h' suffix. + {"0x1.p0h", 1.0}, + {"0x.8p2h", 2.0}, + {"0x1.8p-1h", 0.75}, + {"0x2p-2h", 0.5}, // No binary point + {"-0x1.p0h", -1.0}, + {"-0x.8p2h", -2.0}, + {"-0x1.8p-1h", -0.75}, + {"-0x2p-2h", -0.5}, // No binary point }; } INSTANTIATE_TEST_SUITE_P(ParserImplFloatLiteralTest_HexFloat, @@ -427,65 +546,302 @@ INSTANTIATE_TEST_SUITE_P(ParserImplFloatLiteralTest_HexFloat_UpperCase0X, ParserImplFloatLiteralTest, testing::ValuesIn(UpperCase0X(HexFloatCases()))); -struct InvalidLiteralTestCase { - const char* input; - const char* error_msg; -}; +// +using InvalidLiteralTestCase = std::tuple; + class ParserImplInvalidLiteralTest : public ParserImplTestWithParam {}; TEST_P(ParserImplInvalidLiteralTest, Parse) { - auto params = GetParam(); - SCOPED_TRACE(params.input); - auto p = parser(params.input); + auto* error = std::get<0>(GetParam()); + auto* source = std::get<1>(GetParam()); + auto p = parser(source); auto c = p->const_literal(); EXPECT_FALSE(c.matched); EXPECT_TRUE(c.errored); - EXPECT_EQ(p->error(), params.error_msg); + EXPECT_EQ(p->error(), std::string(error)); ASSERT_EQ(c.value, nullptr); } -InvalidLiteralTestCase invalid_hexfloat_mantissa_too_large_cases[] = { - {"0x1.ffffffff8p0", "1:1: mantissa is too large for hex float"}, - {"0x1f.fffffff8p0", "1:1: mantissa is too large for hex float"}, - {"0x1ff.ffffff8p0", "1:1: mantissa is too large for hex float"}, - {"0x1fff.fffff8p0", "1:1: mantissa is too large for hex float"}, - {"0x1ffff.ffff8p0", "1:1: mantissa is too large for hex float"}, - {"0x1fffff.fff8p0", "1:1: mantissa is too large for hex float"}, - {"0x1ffffff.ff8p0", "1:1: mantissa is too large for hex float"}, - {"0x1fffffff.f8p0", "1:1: mantissa is too large for hex float"}, - {"0x1ffffffff.8p0", "1:1: mantissa is too large for hex float"}, - {"0x1ffffffff8.p0", "1:1: mantissa is too large for hex float"}, -}; -INSTANTIATE_TEST_SUITE_P(ParserImplInvalidLiteralTest_HexFloatMantissaTooLarge, - ParserImplInvalidLiteralTest, - testing::ValuesIn(invalid_hexfloat_mantissa_too_large_cases)); +INSTANTIATE_TEST_SUITE_P( + HexFloatMantissaTooLarge, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: mantissa is too large for hex float"), + testing::ValuesIn(std::vector{ + "0x1.ffffffffffffffff8p0", + "0x1f.fffffffffffffff8p0", + "0x1ff.ffffffffffffff8p0", + "0x1fff.fffffffffffff8p0", + "0x1ffff.ffffffffffff8p0", + "0x1fffff.fffffffffff8p0", + "0x1ffffff.ffffffffff8p0", + "0x1fffffff.fffffffff8p0", + "0x1ffffffff.ffffffff8p0", + "0x1fffffffff.fffffff8p0", + "0x1ffffffffff.ffffff8p0", + "0x1fffffffffff.fffff8p0", + "0x1ffffffffffff.ffff8p0", + "0x1fffffffffffff.fff8p0", + "0x1ffffffffffffff.ff8p0", + "0x1ffffffffffffffff.8p0", + "0x1ffffffffffffffff8.p0", + }))); -InvalidLiteralTestCase invalid_hexfloat_exponent_too_large_cases[] = { - {"0x1p+2147483521", "1:1: exponent is too large for hex float"}, - {"0x1p-2147483521", "1:1: exponent is too large for hex float"}, - {"0x1p+4294967296", "1:1: exponent is too large for hex float"}, - {"0x1p-4294967296", "1:1: exponent is too large for hex float"}, -}; -INSTANTIATE_TEST_SUITE_P(ParserImplInvalidLiteralTest_HexFloatExponentTooLarge, - ParserImplInvalidLiteralTest, - testing::ValuesIn(invalid_hexfloat_exponent_too_large_cases)); +INSTANTIATE_TEST_SUITE_P( + HexFloatExponentTooLarge, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: exponent is too large for hex float"), + testing::ValuesIn(std::vector{ + "0x1p+9223372036854774785", + "0x1p-9223372036854774785", + "0x1p+18446744073709551616", + "0x1p-18446744073709551616", + }))); -InvalidLiteralTestCase invalid_hexfloat_exponent_missing_cases[] = { - // Lower case p - {"0x0p", "1:1: expected an exponent value for hex float"}, - {"0x0p+", "1:1: expected an exponent value for hex float"}, - {"0x0p-", "1:1: expected an exponent value for hex float"}, - {"0x1.0p", "1:1: expected an exponent value for hex float"}, - {"0x0.1p", "1:1: expected an exponent value for hex float"}, - // Upper case p - {"0x0P", "1:1: expected an exponent value for hex float"}, - {"0x0P+", "1:1: expected an exponent value for hex float"}, - {"0x0P-", "1:1: expected an exponent value for hex float"}, - {"0x1.0P", "1:1: expected an exponent value for hex float"}, - {"0x0.1P", "1:1: expected an exponent value for hex float"}, -}; -INSTANTIATE_TEST_SUITE_P(ParserImplInvalidLiteralTest_HexFloatExponentMissing, - ParserImplInvalidLiteralTest, - testing::ValuesIn(invalid_hexfloat_exponent_missing_cases)); +INSTANTIATE_TEST_SUITE_P( + HexFloatMissingExponent, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: expected an exponent value for hex float"), + testing::ValuesIn(std::vector{ + // Lower case p + "0x0p", + "0x0p+", + "0x0p-", + "0x1.0p", + "0x0.1p", + // Upper case p + "0x0P", + "0x0P+", + "0x0P-", + "0x1.0P", + "0x0.1P", + }))); + +INSTANTIATE_TEST_SUITE_P( + HexNaNAFloat, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be represented as 'abstract-float'"), + testing::ValuesIn(std::vector{ + "0x1.8p+1024", + "0x1.0002p+1024", + "0x1.0018p+1024", + "0x1.01ep+1024", + "0x1.fffffep+1024", + "-0x1.8p+1024", + "-0x1.0002p+1024", + "-0x1.0018p+1024", + "-0x1.01ep+1024", + "-0x1.fffffep+1024", + }))); + +INSTANTIATE_TEST_SUITE_P( + HexNaNF32, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be represented as 'f32'"), + testing::ValuesIn(std::vector{ + "0x1.8p+128f", + "0x1.0002p+128f", + "0x1.0018p+128f", + "0x1.01ep+128f", + "0x1.fffffep+128f", + "-0x1.8p+128f", + "-0x1.0002p+128f", + "-0x1.0018p+128f", + "-0x1.01ep+128f", + "-0x1.fffffep+128f", + }))); + +INSTANTIATE_TEST_SUITE_P( + HexNaNF16, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be represented as 'f16'"), + testing::ValuesIn(std::vector{ + "0x1.8p+16h", + "0x1.004p+16h", + "0x1.018p+16h", + "0x1.1ep+16h", + "0x1.ffcp+16h", + "-0x1.8p+16h", + "-0x1.004p+16h", + "-0x1.018p+16h", + "-0x1.1ep+16h", + "-0x1.ffcp+16h", + }))); + +INSTANTIATE_TEST_SUITE_P( + HexOverflowAFloat, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be represented as 'abstract-float'"), + testing::ValuesIn(std::vector{ + "0x1p+1024", + "-0x1p+1024", + "0x1.1p+1024", + "-0x1.1p+1024", + "0x1p+1025", + "-0x1p+1025", + "0x32p+1023", + "-0x32p+1023", + "0x32p+5000", + "-0x32p+5000", + "0x1.0p9223372036854774784", + "-0x1.0p9223372036854774784", + }))); + +INSTANTIATE_TEST_SUITE_P( + HexOverflowF32, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be represented as 'f32'"), + testing::ValuesIn(std::vector{ + "0x1p+128f", + "-0x1p+128f", + "0x1.1p+128f", + "-0x1.1p+128f", + "0x1p+129f", + "-0x1p+129f", + "0x32p+127f", + "-0x32p+127f", + "0x32p+500f", + "-0x32p+500f", + }))); + +INSTANTIATE_TEST_SUITE_P( + HexOverflowF16, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be represented as 'f16'"), + testing::ValuesIn(std::vector{ + "0x1p+16h", + "-0x1p+16h", + "0x1.1p+16h", + "-0x1.1p+16h", + "0x1p+17h", + "-0x1p+17h", + "0x32p+15h", + "-0x32p+15h", + "0x32p+500h", + "-0x32p+500h", + }))); + +INSTANTIATE_TEST_SUITE_P( + HexNotExactlyRepresentableF32, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be exactly represented as 'f32'"), + testing::ValuesIn(std::vector{ + "0x1.000001p+0f", // Quantizes to 0x1.0p+0 + "0x1.0000008p+0f", // Quantizes to 0x1.0p+0 + "0x1.0000000000001p+0f", // Quantizes to 0x1.0p+0 + "0x8.0000f8p+0f", // Quantizes to 0x8.0000fp+0 + "0x8.000038p+0f", // Quantizes to 0x8.00003p+0 + "0x2.cafef00dp+0f", // Quantizes to 0x2.cafefp+0 + "0x0.0000ffp-126f", // Subnormal, quantizes to 0x0.0000fep-126 + "0x3.fcp-144f", // Subnormal, quantizes to 0x3.f8p-144 + "-0x0.0000ffp-126f", // Subnormal, quantizes to -0x0.0000fep-126 + "-0x3.fcp-144f", // Subnormal, quantizes to -0x3.f8p-144 + "0x0.ffffffp-126f", // Subnormal, quantizes to 0x0.fffffep-144 + "0x0.fffffe0000001p-126f", // Subnormal, quantizes to 0x0.fffffep-144 + "-0x0.ffffffp-126f", // Subnormal, quantizes to -0x0.fffffep-144 + "-0x0.fffffe0000001p-126f", // Subnormal, quantizes to -0x0.fffffep-144 + "0x1.8p-149f", // Subnormal, quantizes to 0x1.0p-149f + "0x1.4p-149f", // Subnormal, quantizes to 0x1.0p-149f + "0x1.000002p-149f", // Subnormal, quantizes to 0x1.0p-149f + "0x1.0000000000001p-149f", // Subnormal, quantizes to 0x1.0p-149f + "-0x1.8p-149f", // Subnormal, quantizes to -0x1.0p-149f + "-0x1.4p-149f", // Subnormal, quantizes to -0x1.0p-149f + "-0x1.000002p-149f", // Subnormal, quantizes to -0x1.0p-149f + "-0x1.0000000000001p-149f", // Subnormal, quantizes to -0x1.0p-149f + "0x1.0p-150f", // Smaller than the smallest subnormal, quantizes to 0.0 + "0x1.8p-150f", // Smaller than the smallest subnormal, quantizes to 0.0 + "-0x1.0p-150f", // Smaller than the smallest subnormal, quantizes to -0.0 + "-0x1.8p-150f", // Smaller than the smallest subnormal, quantizes to -0.0 + }))); + +INSTANTIATE_TEST_SUITE_P( + HexNotExactlyRepresentableF16, + ParserImplInvalidLiteralTest, + testing::Combine( + testing::Values("1:1: value cannot be exactly represented as 'f16'"), + testing::ValuesIn(std::vector{ + "0x1.002p+0h", // Quantizes to 0x1.0p+0, has 11 mantissa bits rather than 10 + "0x1.001p+0h", // Quantizes to 0x1.0p+0, has 12 mantissa bits rather than 10 + "0x1.0000000000001p+0h", // Quantizes to 0x1.0p+0, has 52 mantissa bits rather than 10 + "0x8.0fp+0h", // Quantizes to 0x8.0ep+0 + "0x8.31p+0h", // Quantizes to 0x8.30p+0 + "0x2.ca80dp+0h", // Quantizes to 0x2.ca8p+0 + "0x4.ba8p+0h", // Quantizes to 0x4.bap+0 + "0x4.011p+0h", // Quantizes to 0x4.01p+0 + "0x0.0fep-14h", // Subnormal, quantizes to 0x0.0fcp-14 + "0x3.f8p-20h", // Subnormal, quantizes to 0x3.f0p-20 + "-0x0.0fep-14h", // Subnormal, quantizes to -0x0.0fcp-14 + "-0x3.f8p-20h", // Subnormal, quantizes to -0x3.f0p-20 + "0x0.ffep-14h", // Subnormal, quantizes to 0x0.ffcp-14 + "0x0.ffe0000000001p-14h", // Subnormal, quantizes to 0x0.ffcp-14 + "0x0.fffffffffffffp-14h", // Subnormal, quantizes to 0x0.ffcp-14 + "-0x0.ffep-14h", // Subnormal, quantizes to -0x0.ffcp-14 + "-0x0.ffe0000000001p-14h", // Subnormal, quantizes to -0x0.ffcp-14 + "-0x0.fffffffffffffp-14h", // Subnormal, quantizes to -0x0.ffcp-14 + "0x1.8p-24h", // Subnormal, quantizes to 0x1.0p-24f + "0x1.4p-24h", // Subnormal, quantizes to 0x1.0p-24f + "0x1.004p-24h", // Subnormal, quantizes to 0x1.0p-24f + "0x1.0000000000001p-24h", // Subnormal, quantizes to 0x1.0p-24f + "-0x1.8p-24h", // Subnormal, quantizes to -0x1.0p-24f + "-0x1.4p-24h", // Subnormal, quantizes to -0x1.0p-24f + "-0x1.004p-24h", // Subnormal, quantizes to -0x1.0p-24f + "-0x1.0000000000001p-24h", // Subnormal, quantizes to -0x1.0p-24f + "0x1.0p-25h", // Smaller than the smallest subnormal, quantizes to 0.0 + "0x1.8p-25h", // Smaller than the smallest subnormal, quantizes to 0.0 + "-0x1.0p-25h", // Smaller than the smallest subnormal, quantizes to -0.0 + "-0x1.8p-25h", // Smaller than the smallest subnormal, quantizes to -0.0 + }))); + +INSTANTIATE_TEST_SUITE_P( + DecOverflowAFloat, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be represented as 'abstract-float'"), + testing::ValuesIn(std::vector{ + "1.e309", + "-1.e309", + "1.8e308", + "-1.8e308", + "1.798e308", + "-1.798e308", + "1.7977e308", + "-1.7977e308", + "1.2e+5000", + "-1.2e+5000", + }))); + +INSTANTIATE_TEST_SUITE_P( + DecOverflowF32, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be represented as 'f32'"), + testing::ValuesIn(std::vector{ + "1e39f", + "-1e39f", + "4.0e38f", + "-4.0e38f", + "3.5e38f", + "-3.5e38f", + "3.403e38f", + "-3.403e38f", + "1.2e+256f", + "-1.2e+256f", + }))); + +INSTANTIATE_TEST_SUITE_P( + DecOverflowF16, + ParserImplInvalidLiteralTest, + testing::Combine(testing::Values("1:1: value cannot be represented as 'f16'"), + testing::ValuesIn(std::vector{ + "1.0e5h", + "-1.0e5h", + "7.0e4h", + "-7.0e4h", + "6.6e4h", + "-6.6e4h", + "6.56e4h", + "-6.56e4h", + "6.554e4h", + "-6.554e4h", + "1.2e+32h", + "-1.2e+32h", + }))); TEST_F(ParserImplTest, ConstLiteral_FloatHighest) { const auto highest = std::numeric_limits::max(); @@ -501,7 +857,9 @@ TEST_F(ParserImplTest, ConstLiteral_FloatHighest) { EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(c.value, nullptr); ASSERT_TRUE(c->Is()); - EXPECT_FLOAT_EQ(c->As()->value, std::numeric_limits::max()); + EXPECT_EQ(c->As()->value, std::numeric_limits::max()); + EXPECT_EQ(c->As()->suffix, + ast::FloatLiteralExpression::Suffix::kNone); EXPECT_EQ(c->source.range, (Source::Range{{1u, 1u}, {1u, 42u}})); } @@ -522,8 +880,9 @@ TEST_F(ParserImplTest, ConstLiteral_FloatLowest) { EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(c.value, nullptr); ASSERT_TRUE(c->Is()); - EXPECT_FLOAT_EQ(c->As()->value, - std::numeric_limits::lowest()); + EXPECT_EQ(c->As()->value, std::numeric_limits::lowest()); + EXPECT_EQ(c->As()->suffix, + ast::FloatLiteralExpression::Suffix::kNone); EXPECT_EQ(c->source.range, (Source::Range{{1u, 1u}, {1u, 43u}})); } diff --git a/src/tint/reader/wgsl/parser_impl_continue_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_continue_stmt_test.cc index 002f638c37..349bf5ebdb 100644 --- a/src/tint/reader/wgsl/parser_impl_continue_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_continue_stmt_test.cc @@ -20,7 +20,7 @@ namespace { TEST_F(ParserImplTest, ContinueStmt) { auto p = parser("continue"); - auto e = p->continue_stmt(); + auto e = p->continue_statement(); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); diff --git a/src/tint/reader/wgsl/parser_impl_continuing_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_continuing_stmt_test.cc index d7a5779ff7..d2113af72e 100644 --- a/src/tint/reader/wgsl/parser_impl_continuing_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_continuing_stmt_test.cc @@ -20,17 +20,17 @@ namespace { TEST_F(ParserImplTest, ContinuingStmt) { auto p = parser("continuing { discard; }"); - auto e = p->continuing_stmt(); + auto e = p->continuing_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_EQ(e->statements.size(), 1u); + ASSERT_EQ(e->statements.Length(), 1u); ASSERT_TRUE(e->statements[0]->Is()); } TEST_F(ParserImplTest, ContinuingStmt_InvalidBody) { auto p = parser("continuing { discard }"); - auto e = p->continuing_stmt(); + auto e = p->continuing_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); diff --git a/src/tint/reader/wgsl/parser_impl_core_lhs_expression_test.cc b/src/tint/reader/wgsl/parser_impl_core_lhs_expression_test.cc new file mode 100644 index 0000000000..81984eb41f --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_core_lhs_expression_test.cc @@ -0,0 +1,93 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, CoreLHS_NoMatch) { + auto p = parser("123"); + auto e = p->core_lhs_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_FALSE(e.matched); +} + +TEST_F(ParserImplTest, CoreLHS_Ident) { + auto p = parser("identifier"); + auto e = p->core_lhs_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_TRUE(e.matched); + ASSERT_NE(e.value, nullptr); + ASSERT_TRUE(e->Is()); + + auto* ident = e->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("identifier")); +} + +TEST_F(ParserImplTest, CoreLHS_ParenStmt) { + auto p = parser("(a)"); + auto e = p->core_lhs_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_TRUE(e.matched); + ASSERT_NE(e.value, nullptr); + ASSERT_TRUE(e->Is()); + + auto* ident = e->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); +} + +TEST_F(ParserImplTest, CoreLHS_MissingRightParen) { + auto p = parser("(a"); + auto e = p->core_lhs_expression(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + EXPECT_FALSE(e.matched); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:3: expected ')'"); +} + +TEST_F(ParserImplTest, CoreLHS_InvalidLHSExpression) { + auto p = parser("(if (a() {})"); + auto e = p->core_lhs_expression(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + EXPECT_FALSE(e.matched); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:1: invalid expression"); +} + +TEST_F(ParserImplTest, CoreLHS_MissingLHSExpression) { + auto p = parser("()"); + auto e = p->core_lhs_expression(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + EXPECT_FALSE(e.matched); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:1: invalid expression"); +} + +TEST_F(ParserImplTest, CoreLHS_Invalid) { + auto p = parser("1234"); + auto e = p->core_lhs_expression(); + ASSERT_FALSE(p->has_error()); + ASSERT_FALSE(e.errored); + EXPECT_FALSE(e.matched); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_depth_texture_test.cc b/src/tint/reader/wgsl/parser_impl_depth_texture_test.cc index 6c70bd3a66..78c4b8dfec 100644 --- a/src/tint/reader/wgsl/parser_impl_depth_texture_test.cc +++ b/src/tint/reader/wgsl/parser_impl_depth_texture_test.cc @@ -20,7 +20,7 @@ namespace { TEST_F(ParserImplTest, DepthTextureType_Invalid) { auto p = parser("1234"); - auto t = p->depth_texture(); + auto t = p->depth_texture_type(); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); EXPECT_FALSE(p->has_error()); @@ -28,7 +28,7 @@ TEST_F(ParserImplTest, DepthTextureType_Invalid) { TEST_F(ParserImplTest, DepthTextureType_2d) { auto p = parser("texture_depth_2d"); - auto t = p->depth_texture(); + auto t = p->depth_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); ASSERT_NE(t.value, nullptr); @@ -41,7 +41,7 @@ TEST_F(ParserImplTest, DepthTextureType_2d) { TEST_F(ParserImplTest, DepthTextureType_2dArray) { auto p = parser("texture_depth_2d_array"); - auto t = p->depth_texture(); + auto t = p->depth_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); ASSERT_NE(t.value, nullptr); @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, DepthTextureType_2dArray) { TEST_F(ParserImplTest, DepthTextureType_Cube) { auto p = parser("texture_depth_cube"); - auto t = p->depth_texture(); + auto t = p->depth_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); ASSERT_NE(t.value, nullptr); @@ -67,7 +67,7 @@ TEST_F(ParserImplTest, DepthTextureType_Cube) { TEST_F(ParserImplTest, DepthTextureType_CubeArray) { auto p = parser("texture_depth_cube_array"); - auto t = p->depth_texture(); + auto t = p->depth_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); ASSERT_NE(t.value, nullptr); @@ -80,7 +80,7 @@ TEST_F(ParserImplTest, DepthTextureType_CubeArray) { TEST_F(ParserImplTest, DepthTextureType_Multisampled2d) { auto p = parser("texture_depth_multisampled_2d"); - auto t = p->depth_texture(); + auto t = p->depth_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); ASSERT_NE(t.value, nullptr); diff --git a/src/tint/reader/wgsl/parser_impl_element_count_expression_test.cc b/src/tint/reader/wgsl/parser_impl_element_count_expression_test.cc new file mode 100644 index 0000000000..0dd287d161 --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_element_count_expression_test.cc @@ -0,0 +1,81 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, ElementCountExpression_Math) { + auto p = parser("a * b"); + auto e = p->element_count_expression(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, ElementCountExpression_Bitwise) { + auto p = parser("a | true"); + auto e = p->element_count_expression(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kOr, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, ElementCountExpression_NoMatch) { + auto p = parser("if (a) { }"); + auto e = p->element_count_expression(); + EXPECT_FALSE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_EQ(e.value, nullptr); +} + +TEST_F(ParserImplTest, ElementCountExpression_InvalidRHS) { + auto p = parser("a * if"); + auto e = p->element_count_expression(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_TRUE(p->has_error()); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ("1:5: unable to parse right side of * expression", p->error()); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_enable_directive_test.cc b/src/tint/reader/wgsl/parser_impl_enable_directive_test.cc index 0fd6b802b3..ed57be8d28 100644 --- a/src/tint/reader/wgsl/parser_impl_enable_directive_test.cc +++ b/src/tint/reader/wgsl/parser_impl_enable_directive_test.cc @@ -23,41 +23,36 @@ using EnableDirectiveTest = ParserImplTest; // Test a valid enable directive. TEST_F(EnableDirectiveTest, Valid) { - auto p = parser("enable InternalExtensionForTesting;"); + auto p = parser("enable f16;"); p->enable_directive(); EXPECT_FALSE(p->has_error()) << p->error(); auto program = p->program(); auto& ast = program.AST(); - EXPECT_EQ(ast.Extensions(), - ast::ExtensionSet{ast::Enable::ExtensionKind::kInternalExtensionForTesting}); - EXPECT_EQ(ast.GlobalDeclarations().size(), 1u); - auto* node = ast.GlobalDeclarations()[0]->As(); - EXPECT_TRUE(node != nullptr); - EXPECT_EQ(node->name, "InternalExtensionForTesting"); - EXPECT_EQ(node->kind, ast::Enable::ExtensionKind::kInternalExtensionForTesting); + ASSERT_EQ(ast.Enables().Length(), 1u); + auto* enable = ast.Enables()[0]; + EXPECT_EQ(enable->extension, ast::Extension::kF16); + ASSERT_EQ(ast.GlobalDeclarations().Length(), 1u); + EXPECT_EQ(ast.GlobalDeclarations()[0], enable); } // Test multiple enable directives for a same extension. TEST_F(EnableDirectiveTest, EnableMultipleTime) { auto p = parser(R"( -enable InternalExtensionForTesting; -enable InternalExtensionForTesting; +enable f16; +enable f16; )"); p->translation_unit(); EXPECT_FALSE(p->has_error()) << p->error(); auto program = p->program(); auto& ast = program.AST(); - EXPECT_EQ(ast.Extensions(), - ast::ExtensionSet{ast::Enable::ExtensionKind::kInternalExtensionForTesting}); - EXPECT_EQ(ast.GlobalDeclarations().size(), 2u); - auto* node1 = ast.GlobalDeclarations()[0]->As(); - EXPECT_TRUE(node1 != nullptr); - EXPECT_EQ(node1->name, "InternalExtensionForTesting"); - EXPECT_EQ(node1->kind, ast::Enable::ExtensionKind::kInternalExtensionForTesting); - auto* node2 = ast.GlobalDeclarations()[1]->As(); - EXPECT_TRUE(node2 != nullptr); - EXPECT_EQ(node2->name, "InternalExtensionForTesting"); - EXPECT_EQ(node2->kind, ast::Enable::ExtensionKind::kInternalExtensionForTesting); + ASSERT_EQ(ast.Enables().Length(), 2u); + auto* enable_a = ast.Enables()[0]; + auto* enable_b = ast.Enables()[1]; + EXPECT_EQ(enable_a->extension, ast::Extension::kF16); + EXPECT_EQ(enable_b->extension, ast::Extension::kF16); + ASSERT_EQ(ast.GlobalDeclarations().Length(), 2u); + EXPECT_EQ(ast.GlobalDeclarations()[0], enable_a); + EXPECT_EQ(ast.GlobalDeclarations()[1], enable_b); } // Test an unknown extension identifier. @@ -69,43 +64,55 @@ TEST_F(EnableDirectiveTest, InvalidIdentifier) { EXPECT_EQ(p->error(), "1:8: unsupported extension: 'NotAValidExtensionName'"); auto program = p->program(); auto& ast = program.AST(); - EXPECT_EQ(ast.Extensions().size(), 0u); - EXPECT_EQ(ast.GlobalDeclarations().size(), 0u); + EXPECT_EQ(ast.Enables().Length(), 0u); + EXPECT_EQ(ast.GlobalDeclarations().Length(), 0u); } -// Test an enable directive missing ending semiclon. -TEST_F(EnableDirectiveTest, MissingEndingSemiclon) { - auto p = parser("enable InternalExtensionForTesting"); +// Test an enable directive missing ending semicolon. +TEST_F(EnableDirectiveTest, MissingEndingSemicolon) { + auto p = parser("enable f16"); p->translation_unit(); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:35: expected ';' for enable directive"); + EXPECT_EQ(p->error(), "1:11: expected ';' for enable directive"); auto program = p->program(); auto& ast = program.AST(); - EXPECT_EQ(ast.Extensions().size(), 0u); - EXPECT_EQ(ast.GlobalDeclarations().size(), 0u); + EXPECT_EQ(ast.Enables().Length(), 0u); + EXPECT_EQ(ast.GlobalDeclarations().Length(), 0u); +} + +// Test the special error message when enable are used with parenthesis. +TEST_F(EnableDirectiveTest, ParenthesisSpecialCase) { + auto p = parser("enable(f16);"); + p->translation_unit(); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:7: enable directives don't take parenthesis"); + auto program = p->program(); + auto& ast = program.AST(); + EXPECT_EQ(ast.Enables().Length(), 0u); + EXPECT_EQ(ast.GlobalDeclarations().Length(), 0u); } // Test using invalid tokens in an enable directive. TEST_F(EnableDirectiveTest, InvalidTokens) { { - auto p = parser("enable InternalExtensionForTesting<;"); + auto p = parser("enable f16<;"); p->translation_unit(); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:35: expected ';' for enable directive"); + EXPECT_EQ(p->error(), "1:11: expected ';' for enable directive"); auto program = p->program(); auto& ast = program.AST(); - EXPECT_EQ(ast.Extensions().size(), 0u); - EXPECT_EQ(ast.GlobalDeclarations().size(), 0u); + EXPECT_EQ(ast.Enables().Length(), 0u); + EXPECT_EQ(ast.GlobalDeclarations().Length(), 0u); } { - auto p = parser("enable translation_unit(); EXPECT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:8: invalid extension name"); auto program = p->program(); auto& ast = program.AST(); - EXPECT_EQ(ast.Extensions().size(), 0u); - EXPECT_EQ(ast.GlobalDeclarations().size(), 0u); + EXPECT_EQ(ast.Enables().Length(), 0u); + EXPECT_EQ(ast.GlobalDeclarations().Length(), 0u); } { auto p = parser("enable =;"); @@ -114,8 +121,8 @@ TEST_F(EnableDirectiveTest, InvalidTokens) { EXPECT_EQ(p->error(), "1:8: invalid extension name"); auto program = p->program(); auto& ast = program.AST(); - EXPECT_EQ(ast.Extensions().size(), 0u); - EXPECT_EQ(ast.GlobalDeclarations().size(), 0u); + EXPECT_EQ(ast.Enables().Length(), 0u); + EXPECT_EQ(ast.GlobalDeclarations().Length(), 0u); } { auto p = parser("enable vec4;"); @@ -124,8 +131,8 @@ TEST_F(EnableDirectiveTest, InvalidTokens) { EXPECT_EQ(p->error(), "1:8: invalid extension name"); auto program = p->program(); auto& ast = program.AST(); - EXPECT_EQ(ast.Extensions().size(), 0u); - EXPECT_EQ(ast.GlobalDeclarations().size(), 0u); + EXPECT_EQ(ast.Enables().Length(), 0u); + EXPECT_EQ(ast.GlobalDeclarations().Length(), 0u); } } @@ -133,35 +140,39 @@ TEST_F(EnableDirectiveTest, InvalidTokens) { TEST_F(EnableDirectiveTest, FollowingOtherGlobalDecl) { auto p = parser(R"( var t: f32 = 0f; -enable InternalExtensionForTesting; +enable f16; )"); p->translation_unit(); EXPECT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "3:1: enable directives must come before all global declarations"); auto program = p->program(); auto& ast = program.AST(); - // Accept the enable directive although it cause an error - EXPECT_EQ(ast.Extensions(), - ast::ExtensionSet{ast::Enable::ExtensionKind::kInternalExtensionForTesting}); - EXPECT_EQ(ast.GlobalDeclarations().size(), 2u); + // Accept the enable directive although it caused an error + ASSERT_EQ(ast.Enables().Length(), 1u); + auto* enable = ast.Enables()[0]; + EXPECT_EQ(enable->extension, ast::Extension::kF16); + ASSERT_EQ(ast.GlobalDeclarations().Length(), 2u); + EXPECT_EQ(ast.GlobalDeclarations()[1], enable); } -// Test an enable directive go after an empty semiclon. -TEST_F(EnableDirectiveTest, FollowingEmptySemiclon) { +// Test an enable directive go after an empty semicolon. +TEST_F(EnableDirectiveTest, FollowingEmptySemicolon) { auto p = parser(R"( ; -enable InternalExtensionForTesting; +enable f16; )"); p->translation_unit(); - // An empty semiclon is treated as a global declaration + // An empty semicolon is treated as a global declaration EXPECT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "3:1: enable directives must come before all global declarations"); auto program = p->program(); auto& ast = program.AST(); // Accept the enable directive although it cause an error - EXPECT_EQ(ast.Extensions(), - ast::ExtensionSet{ast::Enable::ExtensionKind::kInternalExtensionForTesting}); - EXPECT_EQ(ast.GlobalDeclarations().size(), 1u); + ASSERT_EQ(ast.Enables().Length(), 1u); + auto* enable = ast.Enables()[0]; + EXPECT_EQ(enable->extension, ast::Extension::kF16); + ASSERT_EQ(ast.GlobalDeclarations().Length(), 1u); + EXPECT_EQ(ast.GlobalDeclarations()[0], enable); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_equality_expression_test.cc b/src/tint/reader/wgsl/parser_impl_equality_expression_test.cc deleted file mode 100644 index 4e1f5a3f8d..0000000000 --- a/src/tint/reader/wgsl/parser_impl_equality_expression_test.cc +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/reader/wgsl/parser_impl_test_helper.h" - -namespace tint::reader::wgsl { -namespace { - -TEST_F(ParserImplTest, EqualityExpression_Parses_Equal) { - auto p = parser("a == true"); - auto e = p->equality_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - - ASSERT_TRUE(e->Is()); - auto* rel = e->As(); - EXPECT_EQ(ast::BinaryOp::kEqual, rel->op); - - ASSERT_TRUE(rel->lhs->Is()); - auto* ident = rel->lhs->As(); - EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); -} - -TEST_F(ParserImplTest, EqualityExpression_Parses_NotEqual) { - auto p = parser("a != true"); - auto e = p->equality_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - - ASSERT_TRUE(e->Is()); - auto* rel = e->As(); - EXPECT_EQ(ast::BinaryOp::kNotEqual, rel->op); - - ASSERT_TRUE(rel->lhs->Is()); - auto* ident = rel->lhs->As(); - EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); -} - -TEST_F(ParserImplTest, EqualityExpression_InvalidLHS) { - auto p = parser("if (a) {} == true"); - auto e = p->equality_expression(); - EXPECT_FALSE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - EXPECT_EQ(e.value, nullptr); -} - -TEST_F(ParserImplTest, EqualityExpression_InvalidRHS) { - auto p = parser("true == if (a) {}"); - auto e = p->equality_expression(); - EXPECT_FALSE(e.matched); - EXPECT_TRUE(e.errored); - EXPECT_EQ(e.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:9: unable to parse right side of == expression"); -} - -TEST_F(ParserImplTest, EqualityExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); - auto e = p->equality_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); -} - -} // namespace -} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_error_msg_test.cc b/src/tint/reader/wgsl/parser_impl_error_msg_test.cc index 1234ae4dd7..ac2161c1ad 100644 --- a/src/tint/reader/wgsl/parser_impl_error_msg_test.cc +++ b/src/tint/reader/wgsl/parser_impl_error_msg_test.cc @@ -204,7 +204,7 @@ fn f() { x = vec2(1,2; } TEST_F(ParserImplErrorTest, ConstVarStmtInvalid) { EXPECT("fn f() { let >; }", - R"(test.wgsl:1:14 error: expected identifier for let declaration + R"(test.wgsl:1:14 error: expected identifier for 'let' declaration fn f() { let >; } ^ )"); @@ -212,7 +212,7 @@ fn f() { let >; } TEST_F(ParserImplErrorTest, ConstVarStmtMissingAssignment) { EXPECT("fn f() { let a : i32; }", - R"(test.wgsl:1:21 error: expected '=' for let declaration + R"(test.wgsl:1:21 error: expected '=' for 'let' declaration fn f() { let a : i32; } ^ )"); @@ -220,7 +220,7 @@ fn f() { let a : i32; } TEST_F(ParserImplErrorTest, ConstVarStmtMissingConstructor) { EXPECT("fn f() { let a : i32 = >; }", - R"(test.wgsl:1:24 error: missing constructor for let declaration + R"(test.wgsl:1:24 error: missing initializer for 'let' declaration fn f() { let a : i32 = >; } ^ )"); @@ -306,6 +306,52 @@ fn f() { for (var i : i32 = 0; i < 8; i=i+1) { )"); } +TEST_F(ParserImplErrorTest, FunctionDeclStaticAssertMissingCondThenEOF) { + EXPECT("fn f() { static_assert }", R"(test.wgsl:1:24 error: unable to parse condition expression +fn f() { static_assert } + ^ +)"); +} + +TEST_F(ParserImplErrorTest, FunctionDeclStaticAssertMissingCondThenSemicolon) { + EXPECT("fn f() { static_assert; }", + R"(test.wgsl:1:23 error: unable to parse condition expression +fn f() { static_assert; } + ^ +)"); +} + +TEST_F(ParserImplErrorTest, FunctionDeclStaticAssertMissingCondThenLet) { + EXPECT("fn f() { static_assert\nlet x = 0; }", + R"(test.wgsl:2:1 error: unable to parse condition expression +let x = 0; } +^^^ +)"); +} + +TEST_F(ParserImplErrorTest, FunctionDeclStaticAssertMissingLParen) { + EXPECT("fn f() { static_assert true);", R"(test.wgsl:1:28 error: expected ';' for statement +fn f() { static_assert true); + ^ +)"); +} + +TEST_F(ParserImplErrorTest, FunctionDeclStaticAssertMissingRParen) { + EXPECT("fn f() { static_assert (true;", R"(test.wgsl:1:29 error: expected ')' +fn f() { static_assert (true; + ^ +)"); +} + +TEST_F(ParserImplErrorTest, FunctionDeclStaticAssertMissingSemicolon) { + EXPECT("fn f() { static_assert true }", + R"(test.wgsl:1:29 error: expected ';' for statement +fn f() { static_assert true } + ^ +)"); +} + +// TODO(crbug.com/tint/1503): Remove this when @stage is removed TEST_F(ParserImplErrorTest, FunctionDeclStageMissingLParen) { EXPECT("@stage vertex) fn f() {}", R"(test.wgsl:1:8 error: expected '(' for stage attribute @@ -315,8 +361,13 @@ TEST_F(ParserImplErrorTest, FunctionDeclStageMissingLParen) { } TEST_F(ParserImplErrorTest, FunctionDeclStageMissingRParen) { - EXPECT("@stage(vertex fn f() {}", - R"(test.wgsl:1:15 error: expected ')' for stage attribute + EXPECT( + "@stage(vertex fn f() {}", + R"(test.wgsl:1:2 warning: use of deprecated language feature: remove stage and use @vertex +@stage(vertex fn f() {} + ^^^^^ + +test.wgsl:1:15 error: expected ')' for stage attribute @stage(vertex fn f() {} ^^ )"); @@ -351,18 +402,18 @@ TEST_F(ParserImplErrorTest, FunctionDeclWorkgroupSizeXInvalid) { } TEST_F(ParserImplErrorTest, FunctionDeclWorkgroupSizeYInvalid) { - EXPECT("@workgroup_size(1, ) fn f() {}", + EXPECT("@workgroup_size(1, fn) fn f() {}", R"(test.wgsl:1:20 error: expected workgroup_size y parameter -@workgroup_size(1, ) fn f() {} - ^ +@workgroup_size(1, fn) fn f() {} + ^^ )"); } TEST_F(ParserImplErrorTest, FunctionDeclWorkgroupSizeZInvalid) { - EXPECT("@workgroup_size(1, 2, ) fn f() {}", + EXPECT("@workgroup_size(1, 2, fn) fn f() {}", R"(test.wgsl:1:23 error: expected workgroup_size z parameter -@workgroup_size(1, 2, ) fn f() {} - ^ +@workgroup_size(1, 2, fn) fn f() {} + ^^ )"); } @@ -450,75 +501,54 @@ fn f(a:i32)->i32{return a;@size(1)} } TEST_F(ParserImplErrorTest, FunctionMissingOpenLine) { - EXPECT(R"(let bar : vec2 = vec2(1., 2.); + EXPECT( + R"(const bar : vec2 = vec2(1., 2.); var a : f32 = bar[0]; return; })", - R"(test.wgsl:2:17 error: unable to parse const_expr - var a : f32 = bar[0]; - ^^^ - -test.wgsl:3:3 error: statement found outside of function body + R"(test.wgsl:3:3 error: statement found outside of function body return; ^^^^^^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclConstInvalidIdentifier) { - EXPECT("let ^ : i32 = 1;", - R"(test.wgsl:1:5 error: expected identifier for let declaration -let ^ : i32 = 1; - ^ + EXPECT("const ^ : i32 = 1;", + R"(test.wgsl:1:7 error: expected identifier for 'const' declaration +const ^ : i32 = 1; + ^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclConstMissingSemicolon) { - EXPECT("let i : i32 = 1", - R"(test.wgsl:1:16 error: expected ';' for let declaration -let i : i32 = 1 - ^ + EXPECT("const i : i32 = 1", + R"(test.wgsl:1:18 error: expected ';' for 'const' declaration +const i : i32 = 1 + ^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclConstMissingLParen) { - EXPECT("let i : vec2 = vec2;", - R"(test.wgsl:1:30 error: expected '(' for type constructor -let i : vec2 = vec2; - ^ + EXPECT("const i : vec2 = vec2;", + R"(test.wgsl:1:32 error: expected '(' for type constructor +const i : vec2 = vec2; + ^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclConstMissingRParen) { - EXPECT("let i : vec2 = vec2(1., 2.;", - R"(test.wgsl:1:37 error: expected ')' for type constructor -let i : vec2 = vec2(1., 2.; - ^ + EXPECT("const i : vec2 = vec2(1., 2.;", + R"(test.wgsl:1:39 error: expected ')' for type constructor +const i : vec2 = vec2(1., 2.; + ^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclConstBadConstLiteral) { - EXPECT("let i : vec2 = vec2(!);", - R"(test.wgsl:1:31 error: unable to parse const_expr -let i : vec2 = vec2(!); - ^ -)"); -} - -TEST_F(ParserImplErrorTest, GlobalDeclConstBadConstLiteralSpaceLessThan) { - EXPECT("let i = 1 < 2;", - R"(test.wgsl:1:11 error: expected ';' for let declaration -let i = 1 < 2; - ^ -)"); -} - -TEST_F(ParserImplErrorTest, GlobalDeclConstNotConstExpr) { - EXPECT( - "let a = 1;\n" - "let b = a;", - R"(test.wgsl:2:9 error: unable to parse const_expr -let b = a; - ^ + EXPECT("const i : vec2 = vec2(!);", + R"(test.wgsl:1:34 error: unable to parse right side of ! expression +const i : vec2 = vec2(!); + ^ )"); } @@ -527,8 +557,8 @@ TEST_F(ParserImplErrorTest, GlobalDeclConstExprMaxDepth) { std::stringstream src; std::stringstream mkr; - src << "let i : i32 = "; - mkr << " "; + src << "const i : i32 = "; + mkr << " "; for (size_t i = 0; i < kMaxDepth + 8; i++) { src << "f32("; if (i < kMaxDepth) { @@ -543,33 +573,124 @@ TEST_F(ParserImplErrorTest, GlobalDeclConstExprMaxDepth) { } src << ";"; std::stringstream err; - err << "test.wgsl:1:527 error: maximum parser recursive depth reached\n" + err << "test.wgsl:1:529 error: maximum parser recursive depth reached\n" << src.str() << "\n" << mkr.str() << "\n"; EXPECT(src.str().c_str(), err.str().c_str()); } TEST_F(ParserImplErrorTest, GlobalDeclConstExprMissingLParen) { - EXPECT("let i : vec2 = vec2 1, 2);", - R"(test.wgsl:1:31 error: expected '(' for type constructor + EXPECT("const i : vec2 = vec2 1, 2);", + R"(test.wgsl:1:33 error: expected '(' for type constructor +const i : vec2 = vec2 1, 2); + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclConstExprMissingRParen) { + EXPECT("const i : vec2 = vec2(1, 2;", + R"(test.wgsl:1:37 error: expected ')' for type constructor +const i : vec2 = vec2(1, 2; + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclLetInvalidIdentifier) { + EXPECT( + "let ^ : i32 = 1;", + R"(test.wgsl:1:1 warning: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +let ^ : i32 = 1; +^^^ + +test.wgsl:1:5 error: expected identifier for 'let' declaration +let ^ : i32 = 1; + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclLetMissingSemicolon) { + EXPECT( + "let i : i32 = 1", + R"(test.wgsl:1:1 warning: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +let i : i32 = 1 +^^^ + +test.wgsl:1:16 error: expected ';' for 'const' declaration +let i : i32 = 1 + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclLetMissingLParen) { + EXPECT( + "let i : vec2 = vec2;", + R"(test.wgsl:1:1 warning: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +let i : vec2 = vec2; +^^^ + +test.wgsl:1:30 error: expected '(' for type constructor +let i : vec2 = vec2; + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclLetMissingRParen) { + EXPECT( + "let i : vec2 = vec2(1., 2.;", + R"(test.wgsl:1:1 warning: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +let i : vec2 = vec2(1., 2.; +^^^ + +test.wgsl:1:37 error: expected ')' for type constructor +let i : vec2 = vec2(1., 2.; + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclLetBadConstLiteral) { + EXPECT( + "let i : vec2 = vec2(!);", + R"(test.wgsl:1:1 warning: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +let i : vec2 = vec2(!); +^^^ + +test.wgsl:1:32 error: unable to parse right side of ! expression +let i : vec2 = vec2(!); + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclLetExprMissingLParen) { + EXPECT( + "let i : vec2 = vec2 1, 2);", + R"(test.wgsl:1:1 warning: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +let i : vec2 = vec2 1, 2); +^^^ + +test.wgsl:1:31 error: expected '(' for type constructor let i : vec2 = vec2 1, 2); ^ )"); } -TEST_F(ParserImplErrorTest, GlobalDeclConstExprMissingRParen) { - EXPECT("let i : vec2 = vec2(1, 2;", - R"(test.wgsl:1:35 error: expected ')' for type constructor +TEST_F(ParserImplErrorTest, GlobalDeclLetExprMissingRParen) { + EXPECT( + "let i : vec2 = vec2(1, 2;", + R"(test.wgsl:1:1 warning: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +let i : vec2 = vec2(1, 2; +^^^ + +test.wgsl:1:35 error: expected ')' for type constructor let i : vec2 = vec2(1, 2; ^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclInvalidAttribute) { - EXPECT("@stage(vertex) x;", - R"(test.wgsl:1:16 error: expected declaration after attributes -@stage(vertex) x; - ^ + EXPECT("@vertex x;", + R"(test.wgsl:1:9 error: expected declaration after attributes +@vertex x; + ^ )"); } @@ -621,6 +742,50 @@ var x : texture_multisampled_2d<1>; )"); } +TEST_F(ParserImplErrorTest, GlobalDeclStaticAssertMissingCondThenEOF) { + EXPECT("static_assert", R"(test.wgsl:1:14 error: unable to parse condition expression +static_assert + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclStaticAssertMissingCondThenSemicolon) { + EXPECT("static_assert;", R"(test.wgsl:1:14 error: unable to parse condition expression +static_assert; + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclStaticAssertMissingCondThenAlias) { + EXPECT("static_assert\ntype T = i32;", + R"(test.wgsl:2:1 error: unable to parse condition expression +type T = i32; +^^^^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclStaticAssertMissingLParen) { + EXPECT("static_assert true);", R"(test.wgsl:1:19 error: expected ';' for static assertion declaration +static_assert true); + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclStaticAssertMissingRParen) { + EXPECT("static_assert (true;", R"(test.wgsl:1:20 error: expected ')' +static_assert (true; + ^ +)"); +} + +TEST_F(ParserImplErrorTest, GlobalDeclStaticAssertMissingSemicolon) { + EXPECT("static_assert true static_assert true;", + R"(test.wgsl:1:20 error: expected ';' for static assertion declaration +static_assert true static_assert true; + ^^^^^^^^^^^^^ +)"); +} + TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingLessThan) { EXPECT("var x : texture_storage_2d;", R"(test.wgsl:1:27 error: expected '<' for storage texture type @@ -746,14 +911,6 @@ type meow = f32 )"); } -TEST_F(ParserImplErrorTest, GlobalDeclVarArrayMissingLessThan) { - EXPECT("var i : array;", - R"(test.wgsl:1:14 error: expected '<' for array declaration -var i : array; - ^ -)"); -} - TEST_F(ParserImplErrorTest, GlobalDeclVarArrayMissingGreaterThan) { EXPECT("var i : array' for array declaration @@ -780,9 +937,9 @@ var i : array; TEST_F(ParserImplErrorTest, GlobalDeclVarArrayInvalidSize) { EXPECT("var i : array;", - R"(test.wgsl:1:20 error: expected array size expression + R"(test.wgsl:1:21 error: unable to parse right side of ! expression var i : array; - ^ + ^ )"); } @@ -1209,7 +1366,7 @@ fn f() { var a : u32 } TEST_F(ParserImplErrorTest, VarStmtInvalidAssignment) { EXPECT("fn f() { var a : u32 = >; }", - R"(test.wgsl:1:24 error: missing constructor for variable declaration + R"(test.wgsl:1:24 error: missing initializer for 'var' declaration fn f() { var a : u32 = >; } ^ )"); diff --git a/src/tint/reader/wgsl/parser_impl_exclusive_or_expression_test.cc b/src/tint/reader/wgsl/parser_impl_exclusive_or_expression_test.cc deleted file mode 100644 index c6f8ad48ce..0000000000 --- a/src/tint/reader/wgsl/parser_impl_exclusive_or_expression_test.cc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/reader/wgsl/parser_impl_test_helper.h" - -namespace tint::reader::wgsl { -namespace { - -TEST_F(ParserImplTest, ExclusiveOrExpression_Parses) { - auto p = parser("a ^ true"); - auto e = p->exclusive_or_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - - ASSERT_TRUE(e->Is()); - auto* rel = e->As(); - EXPECT_EQ(ast::BinaryOp::kXor, rel->op); - - ASSERT_TRUE(rel->lhs->Is()); - auto* ident = rel->lhs->As(); - EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); -} - -TEST_F(ParserImplTest, ExclusiveOrExpression_InvalidLHS) { - auto p = parser("if (a) {} ^ true"); - auto e = p->exclusive_or_expression(); - EXPECT_FALSE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - EXPECT_EQ(e.value, nullptr); -} - -TEST_F(ParserImplTest, ExclusiveOrExpression_InvalidRHS) { - auto p = parser("true ^ if (a) {}"); - auto e = p->exclusive_or_expression(); - EXPECT_FALSE(e.matched); - EXPECT_TRUE(e.errored); - EXPECT_EQ(e.value, nullptr); - ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:8: unable to parse right side of ^ expression"); -} - -TEST_F(ParserImplTest, ExclusiveOrExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); - auto e = p->exclusive_or_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); -} - -} // namespace -} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_expression_test.cc b/src/tint/reader/wgsl/parser_impl_expression_test.cc new file mode 100644 index 0000000000..0adbeeff01 --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_expression_test.cc @@ -0,0 +1,254 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, Expression_InvalidLHS) { + auto p = parser("if (a) {} || true"); + auto e = p->expression(); + EXPECT_FALSE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + EXPECT_EQ(e.value, nullptr); +} + +TEST_F(ParserImplTest, Expression_Or_Parses) { + auto p = parser("a || true"); + auto e = p->expression(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kLogicalOr, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, Expression_Or_Parses_Multiple) { + auto p = parser("a || true || b"); + auto e = p->expression(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + // lhs: (a || true) + // rhs: b + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kLogicalOr, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); + + ASSERT_TRUE(rel->lhs->Is()); + // lhs: a + // rhs: true + rel = rel->lhs->As(); + EXPECT_EQ(ast::BinaryOp::kLogicalOr, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, Expression_Or_InvalidRHS) { + auto p = parser("true || if (a) {}"); + auto e = p->expression(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:9: unable to parse right side of || expression"); +} + +TEST_F(ParserImplTest, Expression_And_Parses) { + auto p = parser("a && true"); + auto e = p->expression(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kLogicalAnd, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, Expression_And_Parses_Multple) { + auto p = parser("a && true && b"); + auto e = p->expression(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + // lhs: (a && true) + // rhs: b + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kLogicalAnd, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); + + ASSERT_TRUE(rel->lhs->Is()); + // lhs: a + // rhs: true + rel = rel->lhs->As(); + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, Expression_And_InvalidRHS) { + auto p = parser("true && if (a) {}"); + auto e = p->expression(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:9: unable to parse right side of && expression"); +} + +TEST_F(ParserImplTest, Expression_Mixing_OrWithAnd) { + auto p = parser("a && true || b"); + auto e = p->expression(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:11: mixing '&&' and '||' requires parenthesis"); +} + +TEST_F(ParserImplTest, Expression_Mixing_AndWithOr) { + auto p = parser("a || true && b"); + auto e = p->expression(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:11: mixing '||' and '&&' requires parenthesis"); +} + +TEST_F(ParserImplTest, Expression_Bitwise) { + auto p = parser("a & b"); + auto e = p->expression(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kAnd, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, Expression_Relational) { + auto p = parser("a <= b"); + auto e = p->expression(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kLessThanEqual, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, Expression_InvalidUnary) { + auto p = parser("!if || true"); + auto e = p->expression(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:2: unable to parse right side of ! expression"); +} + +TEST_F(ParserImplTest, Expression_InvalidBitwise) { + auto p = parser("a & if"); + auto e = p->expression(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:5: unable to parse right side of & expression"); +} + +TEST_F(ParserImplTest, Expression_InvalidRelational) { + auto p = parser("a <= if"); + auto e = p->expression(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:6: unable to parse right side of <= expression"); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_for_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_for_stmt_test.cc index 26f3298fd5..a8d78733bc 100644 --- a/src/tint/reader/wgsl/parser_impl_for_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_for_stmt_test.cc @@ -24,7 +24,7 @@ using ForStmtTest = ParserImplTest; // Test an empty for loop. TEST_F(ForStmtTest, Empty) { auto p = parser("for (;;) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); @@ -37,27 +37,27 @@ TEST_F(ForStmtTest, Empty) { // Test a for loop with non-empty body. TEST_F(ForStmtTest, Body) { auto p = parser("for (;;) { discard; }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); EXPECT_EQ(fl->initializer, nullptr); EXPECT_EQ(fl->condition, nullptr); EXPECT_EQ(fl->continuing, nullptr); - ASSERT_EQ(fl->body->statements.size(), 1u); + ASSERT_EQ(fl->body->statements.Length(), 1u); EXPECT_TRUE(fl->body->statements[0]->Is()); } // Test a for loop declaring a variable in the initializer statement. TEST_F(ForStmtTest, InitializerStatementDecl) { auto p = parser("for (var i: i32 ;;) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); ASSERT_TRUE(Is(fl->initializer)); auto* var = fl->initializer->As()->variable; - EXPECT_FALSE(var->is_const); + EXPECT_TRUE(var->Is()); EXPECT_EQ(var->constructor, nullptr); EXPECT_EQ(fl->condition, nullptr); EXPECT_EQ(fl->continuing, nullptr); @@ -68,13 +68,13 @@ TEST_F(ForStmtTest, InitializerStatementDecl) { // statement. TEST_F(ForStmtTest, InitializerStatementDeclEqual) { auto p = parser("for (var i: i32 = 0 ;;) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); ASSERT_TRUE(Is(fl->initializer)); auto* var = fl->initializer->As()->variable; - EXPECT_FALSE(var->is_const); + EXPECT_TRUE(var->Is()); EXPECT_NE(var->constructor, nullptr); EXPECT_EQ(fl->condition, nullptr); EXPECT_EQ(fl->continuing, nullptr); @@ -84,13 +84,13 @@ TEST_F(ForStmtTest, InitializerStatementDeclEqual) { // Test a for loop declaring a const variable in the initializer statement. TEST_F(ForStmtTest, InitializerStatementConstDecl) { auto p = parser("for (let i: i32 = 0 ;;) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); ASSERT_TRUE(Is(fl->initializer)); auto* var = fl->initializer->As()->variable; - EXPECT_TRUE(var->is_const); + EXPECT_TRUE(var->Is()); EXPECT_NE(var->constructor, nullptr); EXPECT_EQ(fl->condition, nullptr); EXPECT_EQ(fl->continuing, nullptr); @@ -100,7 +100,7 @@ TEST_F(ForStmtTest, InitializerStatementConstDecl) { // Test a for loop assigning a variable in the initializer statement. TEST_F(ForStmtTest, InitializerStatementAssignment) { auto p = parser("for (i = 0 ;;) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); @@ -113,7 +113,7 @@ TEST_F(ForStmtTest, InitializerStatementAssignment) { // Test a for loop incrementing a variable in the initializer statement. TEST_F(ForStmtTest, InitializerStatementIncrement) { auto p = parser("for (i++;;) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); @@ -126,7 +126,7 @@ TEST_F(ForStmtTest, InitializerStatementIncrement) { // Test a for loop calling a function in the initializer statement. TEST_F(ForStmtTest, InitializerStatementFuncCall) { auto p = parser("for (a(b,c) ;;) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); @@ -139,7 +139,7 @@ TEST_F(ForStmtTest, InitializerStatementFuncCall) { // Test a for loop with a break condition TEST_F(ForStmtTest, BreakCondition) { auto p = parser("for (; 0 == 1;) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); @@ -152,7 +152,7 @@ TEST_F(ForStmtTest, BreakCondition) { // Test a for loop assigning a variable in the continuing statement. TEST_F(ForStmtTest, ContinuingAssignment) { auto p = parser("for (;; x = 2) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); @@ -165,7 +165,7 @@ TEST_F(ForStmtTest, ContinuingAssignment) { // Test a for loop with an increment statement as the continuing statement. TEST_F(ForStmtTest, ContinuingIncrement) { auto p = parser("for (;; x++) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); @@ -178,7 +178,7 @@ TEST_F(ForStmtTest, ContinuingIncrement) { // Test a for loop calling a function in the continuing statement. TEST_F(ForStmtTest, ContinuingFuncCall) { auto p = parser("for (;; a(b,c)) { }"); - auto fl = p->for_stmt(); + auto fl = p->for_statement(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(fl.errored); ASSERT_TRUE(fl.matched); @@ -192,7 +192,7 @@ class ForStmtErrorTest : public ParserImplTest { public: void TestForWithError(std::string for_str, std::string error_str) { auto p_for = parser(for_str); - auto e_for = p_for->for_stmt(); + auto e_for = p_for->for_statement(); EXPECT_FALSE(e_for.matched); EXPECT_TRUE(e_for.errored); @@ -253,7 +253,7 @@ TEST_F(ForStmtErrorTest, MissingRightBrace) { // Test a for loop with an invalid initializer statement. TEST_F(ForStmtErrorTest, InvalidInitializerAsConstDecl) { std::string for_str = "for (let x: i32;;) { }"; - std::string error_str = "1:16: expected '=' for let declaration"; + std::string error_str = "1:16: expected '=' for 'let' declaration"; TestForWithError(for_str, error_str); } @@ -304,7 +304,7 @@ TEST_F(ForStmtErrorTest, InvalidContinuingMatch) { // Test a for loop with an invalid body. TEST_F(ForStmtErrorTest, InvalidBody) { std::string for_str = "for (;;) { let x: i32; }"; - std::string error_str = "1:22: expected '=' for let declaration"; + std::string error_str = "1:22: expected '=' for 'let' declaration"; TestForWithError(for_str, error_str); } diff --git a/src/tint/reader/wgsl/parser_impl_function_attribute_list_test.cc b/src/tint/reader/wgsl/parser_impl_function_attribute_list_test.cc index 356241b209..28b84a9767 100644 --- a/src/tint/reader/wgsl/parser_impl_function_attribute_list_test.cc +++ b/src/tint/reader/wgsl/parser_impl_function_attribute_list_test.cc @@ -18,13 +18,40 @@ namespace tint::reader::wgsl { namespace { -TEST_F(ParserImplTest, AttributeList_Parses) { +// TODO(crbug.com/tint/1503): Remove this when @stage is removed +TEST_F(ParserImplTest, AttributeList_Parses_Stage) { auto p = parser("@workgroup_size(2) @stage(compute)"); auto attrs = p->attribute_list(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(attrs.errored); EXPECT_TRUE(attrs.matched); - ASSERT_EQ(attrs.value.size(), 2u); + ASSERT_EQ(attrs.value.Length(), 2u); + + auto* attr_0 = attrs.value[0]->As(); + auto* attr_1 = attrs.value[1]->As(); + ASSERT_NE(attr_0, nullptr); + ASSERT_NE(attr_1, nullptr); + + ASSERT_TRUE(attr_0->Is()); + const ast::Expression* x = attr_0->As()->x; + ASSERT_NE(x, nullptr); + auto* x_literal = x->As(); + ASSERT_NE(x_literal, nullptr); + ASSERT_TRUE(x_literal->Is()); + EXPECT_EQ(x_literal->As()->value, 2); + EXPECT_EQ(x_literal->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + ASSERT_TRUE(attr_1->Is()); + EXPECT_EQ(attr_1->As()->stage, ast::PipelineStage::kCompute); +} + +TEST_F(ParserImplTest, AttributeList_Parses) { + auto p = parser("@workgroup_size(2) @compute"); + auto attrs = p->attribute_list(); + EXPECT_FALSE(p->has_error()) << p->error(); + EXPECT_FALSE(attrs.errored); + EXPECT_TRUE(attrs.matched); + ASSERT_EQ(attrs.value.Length(), 2u); auto* attr_0 = attrs.value[0]->As(); auto* attr_1 = attrs.value[1]->As(); @@ -50,7 +77,7 @@ TEST_F(ParserImplTest, AttributeList_Invalid) { EXPECT_TRUE(p->has_error()); EXPECT_TRUE(attrs.errored); EXPECT_FALSE(attrs.matched); - EXPECT_TRUE(attrs.value.empty()); + EXPECT_TRUE(attrs.value.IsEmpty()); EXPECT_EQ(p->error(), "1:2: expected attribute"); } diff --git a/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc b/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc index d2585b3062..60e8f861c8 100644 --- a/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc +++ b/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc @@ -41,6 +41,67 @@ TEST_F(ParserImplTest, Attribute_Workgroup) { EXPECT_EQ(values[2], nullptr); } +TEST_F(ParserImplTest, Attribute_Workgroup_Expression) { + auto p = parser("workgroup_size(4 + 2)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + auto* func_attr = attr.value->As(); + ASSERT_NE(func_attr, nullptr); + ASSERT_TRUE(func_attr->Is()); + + auto values = func_attr->As()->Values(); + + ASSERT_TRUE(values[0]->Is()); + auto* expr = values[0]->As(); + EXPECT_EQ(expr->op, ast::BinaryOp::kAdd); + + EXPECT_EQ(expr->lhs->As()->value, 4); + EXPECT_EQ(expr->lhs->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + EXPECT_EQ(expr->rhs->As()->value, 2); + EXPECT_EQ(expr->rhs->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + EXPECT_EQ(values[1], nullptr); + EXPECT_EQ(values[2], nullptr); +} + +TEST_F(ParserImplTest, Attribute_Workgroup_1Param_TrailingComma) { + auto p = parser("workgroup_size(4,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + auto* func_attr = attr.value->As(); + ASSERT_NE(func_attr, nullptr); + ASSERT_TRUE(func_attr->Is()); + + auto values = func_attr->As()->Values(); + + ASSERT_TRUE(values[0]->Is()); + EXPECT_EQ(values[0]->As()->value, 4); + EXPECT_EQ(values[0]->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + EXPECT_EQ(values[1], nullptr); + EXPECT_EQ(values[2], nullptr); +} + +TEST_F(ParserImplTest, Attribute_Workgroup_1Param_TrailingComma_Double) { + auto p = parser("workgroup_size(4,,)"); + auto attr = p->attribute(); + EXPECT_FALSE(attr.matched); + EXPECT_TRUE(attr.errored); + EXPECT_EQ(attr.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:18: expected workgroup_size y parameter"); +} + TEST_F(ParserImplTest, Attribute_Workgroup_2Param) { auto p = parser("workgroup_size(4, 5)"); auto attr = p->attribute(); @@ -67,6 +128,75 @@ TEST_F(ParserImplTest, Attribute_Workgroup_2Param) { EXPECT_EQ(values[2], nullptr); } +TEST_F(ParserImplTest, Attribute_Workgroup_2Param_Expression) { + auto p = parser("workgroup_size(4, 5 - 2)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + auto* func_attr = attr.value->As(); + ASSERT_NE(func_attr, nullptr) << p->error(); + ASSERT_TRUE(func_attr->Is()); + + auto values = func_attr->As()->Values(); + + ASSERT_TRUE(values[0]->Is()); + EXPECT_EQ(values[0]->As()->value, 4); + EXPECT_EQ(values[0]->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + ASSERT_TRUE(values[1]->Is()); + auto* expr = values[1]->As(); + EXPECT_EQ(expr->op, ast::BinaryOp::kSubtract); + + EXPECT_EQ(expr->lhs->As()->value, 5); + EXPECT_EQ(expr->lhs->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + EXPECT_EQ(expr->rhs->As()->value, 2); + EXPECT_EQ(expr->rhs->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + EXPECT_EQ(values[2], nullptr); +} + +TEST_F(ParserImplTest, Attribute_Workgroup_2Param_TrailingComma) { + auto p = parser("workgroup_size(4, 5,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + auto* func_attr = attr.value->As(); + ASSERT_NE(func_attr, nullptr) << p->error(); + ASSERT_TRUE(func_attr->Is()); + + auto values = func_attr->As()->Values(); + + ASSERT_TRUE(values[0]->Is()); + EXPECT_EQ(values[0]->As()->value, 4); + EXPECT_EQ(values[0]->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + ASSERT_TRUE(values[1]->Is()); + EXPECT_EQ(values[1]->As()->value, 5); + EXPECT_EQ(values[1]->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + EXPECT_EQ(values[2], nullptr); +} + +TEST_F(ParserImplTest, Attribute_Workgroup21Param_TrailingComma_Double) { + auto p = parser("workgroup_size(4,5,,)"); + auto attr = p->attribute(); + EXPECT_FALSE(attr.matched); + EXPECT_TRUE(attr.errored); + EXPECT_EQ(attr.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:20: expected workgroup_size z parameter"); +} + TEST_F(ParserImplTest, Attribute_Workgroup_3Param) { auto p = parser("workgroup_size(4, 5, 6)"); auto attr = p->attribute(); @@ -96,6 +226,71 @@ TEST_F(ParserImplTest, Attribute_Workgroup_3Param) { ast::IntLiteralExpression::Suffix::kNone); } +TEST_F(ParserImplTest, Attribute_Workgroup_3Param_Expression) { + auto p = parser("workgroup_size(4, 5, 6 << 1)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + auto* func_attr = attr.value->As(); + ASSERT_NE(func_attr, nullptr); + ASSERT_TRUE(func_attr->Is()); + + auto values = func_attr->As()->Values(); + + ASSERT_TRUE(values[0]->Is()); + EXPECT_EQ(values[0]->As()->value, 4); + EXPECT_EQ(values[0]->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + ASSERT_TRUE(values[1]->Is()); + EXPECT_EQ(values[1]->As()->value, 5); + EXPECT_EQ(values[1]->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + ASSERT_TRUE(values[2]->Is()); + auto* expr = values[2]->As(); + EXPECT_EQ(expr->op, ast::BinaryOp::kShiftLeft); + + EXPECT_EQ(expr->lhs->As()->value, 6); + EXPECT_EQ(expr->lhs->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + EXPECT_EQ(expr->rhs->As()->value, 1); + EXPECT_EQ(expr->rhs->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); +} + +TEST_F(ParserImplTest, Attribute_Workgroup_3Param_TrailingComma) { + auto p = parser("workgroup_size(4, 5, 6,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + auto* func_attr = attr.value->As(); + ASSERT_NE(func_attr, nullptr); + ASSERT_TRUE(func_attr->Is()); + + auto values = func_attr->As()->Values(); + + ASSERT_TRUE(values[0]->Is()); + EXPECT_EQ(values[0]->As()->value, 4); + EXPECT_EQ(values[0]->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + ASSERT_TRUE(values[1]->Is()); + EXPECT_EQ(values[1]->As()->value, 5); + EXPECT_EQ(values[1]->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); + + ASSERT_TRUE(values[2]->Is()); + EXPECT_EQ(values[2]->As()->value, 6); + EXPECT_EQ(values[2]->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); +} + TEST_F(ParserImplTest, Attribute_Workgroup_WithIdent) { auto p = parser("workgroup_size(4, height)"); auto attr = p->attribute(); @@ -129,7 +324,7 @@ TEST_F(ParserImplTest, Attribute_Workgroup_TooManyValues) { EXPECT_TRUE(attr.errored); EXPECT_EQ(attr.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:23: expected ')' for workgroup_size attribute"); + EXPECT_EQ(p->error(), "1:25: expected ')' for workgroup_size attribute"); } TEST_F(ParserImplTest, Attribute_Workgroup_MissingLeftParam) { @@ -202,16 +397,7 @@ TEST_F(ParserImplTest, Attribute_Workgroup_Missing_Z_Comma) { EXPECT_EQ(p->error(), "1:21: expected ')' for workgroup_size attribute"); } -TEST_F(ParserImplTest, Attribute_Workgroup_Missing_Z_Value) { - auto p = parser("workgroup_size(1, 2, )"); - auto attr = p->attribute(); - EXPECT_FALSE(attr.matched); - EXPECT_TRUE(attr.errored); - EXPECT_EQ(attr.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:22: expected workgroup_size z parameter"); -} - +// TODO(crbug.com/tint/1503): Remove when @stage is removed TEST_F(ParserImplTest, Attribute_Stage) { auto p = parser("stage(compute)"); auto attr = p->attribute(); @@ -262,7 +448,47 @@ TEST_F(ParserImplTest, Attribute_Stage_MissingRightParen) { EXPECT_TRUE(attr.errored); EXPECT_EQ(attr.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:14: expected ')' for stage attribute"); + EXPECT_EQ(p->error(), R"(1:1: use of deprecated language feature: remove stage and use @compute +1:14: expected ')' for stage attribute)"); +} + +TEST_F(ParserImplTest, Attribute_Compute) { + auto p = parser("compute"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + auto* func_attr = attr.value->As(); + ASSERT_NE(func_attr, nullptr); + ASSERT_TRUE(func_attr->Is()); + EXPECT_EQ(func_attr->As()->stage, ast::PipelineStage::kCompute); +} + +TEST_F(ParserImplTest, Attribute_Vertex) { + auto p = parser("vertex"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + auto* func_attr = attr.value->As(); + ASSERT_NE(func_attr, nullptr); + ASSERT_TRUE(func_attr->Is()); + EXPECT_EQ(func_attr->As()->stage, ast::PipelineStage::kVertex); +} + +TEST_F(ParserImplTest, Attribute_Fragment) { + auto p = parser("fragment"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + auto* func_attr = attr.value->As(); + ASSERT_NE(func_attr, nullptr); + ASSERT_TRUE(func_attr->Is()); + EXPECT_EQ(func_attr->As()->stage, ast::PipelineStage::kFragment); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_function_decl_test.cc b/src/tint/reader/wgsl/parser_impl_function_decl_test.cc index 181501a98a..cba4a7d6c5 100644 --- a/src/tint/reader/wgsl/parser_impl_function_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_function_decl_test.cc @@ -35,7 +35,7 @@ TEST_F(ParserImplTest, FunctionDecl) { ASSERT_NE(f->return_type, nullptr); EXPECT_TRUE(f->return_type->Is()); - ASSERT_EQ(f->params.size(), 2u); + ASSERT_EQ(f->params.Length(), 2u); EXPECT_EQ(f->params[0]->symbol, p->builder().Symbols().Get("a")); EXPECT_EQ(f->params[1]->symbol, p->builder().Symbols().Get("b")); @@ -43,7 +43,7 @@ TEST_F(ParserImplTest, FunctionDecl) { EXPECT_TRUE(f->return_type->Is()); auto* body = f->body; - ASSERT_EQ(body->statements.size(), 1u); + ASSERT_EQ(body->statements.Length(), 1u); EXPECT_TRUE(body->statements[0]->Is()); } @@ -80,7 +80,7 @@ TEST_F(ParserImplTest, FunctionDecl_Unicode) { ASSERT_NE(f->return_type, nullptr); EXPECT_TRUE(f->return_type->Is()); - ASSERT_EQ(f->params.size(), 2u); + ASSERT_EQ(f->params.Length(), 2u); EXPECT_EQ(f->params[0]->symbol, p->builder().Symbols().Get(param_a_ident)); EXPECT_EQ(f->params[1]->symbol, p->builder().Symbols().Get(param_b_ident)); @@ -88,7 +88,7 @@ TEST_F(ParserImplTest, FunctionDecl_Unicode) { EXPECT_TRUE(f->return_type->Is()); auto* body = f->body; - ASSERT_EQ(body->statements.size(), 1u); + ASSERT_EQ(body->statements.Length(), 1u); EXPECT_TRUE(body->statements[0]->Is()); } @@ -107,10 +107,10 @@ TEST_F(ParserImplTest, FunctionDecl_AttributeList) { EXPECT_EQ(f->symbol, p->builder().Symbols().Get("main")); ASSERT_NE(f->return_type, nullptr); EXPECT_TRUE(f->return_type->Is()); - ASSERT_EQ(f->params.size(), 0u); + ASSERT_EQ(f->params.Length(), 0u); auto& attributes = f->attributes; - ASSERT_EQ(attributes.size(), 1u); + ASSERT_EQ(attributes.Length(), 1u); ASSERT_TRUE(attributes[0]->Is()); auto values = attributes[0]->As()->Values(); @@ -131,13 +131,13 @@ TEST_F(ParserImplTest, FunctionDecl_AttributeList) { ast::IntLiteralExpression::Suffix::kNone); auto* body = f->body; - ASSERT_EQ(body->statements.size(), 1u); + ASSERT_EQ(body->statements.Length(), 1u); EXPECT_TRUE(body->statements[0]->Is()); } TEST_F(ParserImplTest, FunctionDecl_AttributeList_MultipleEntries) { auto p = parser(R"( -@workgroup_size(2, 3, 4) @stage(compute) +@workgroup_size(2, 3, 4) @compute fn main() { return; })"); auto attrs = p->attribute_list(); EXPECT_FALSE(p->has_error()) << p->error(); @@ -152,10 +152,10 @@ fn main() { return; })"); EXPECT_EQ(f->symbol, p->builder().Symbols().Get("main")); ASSERT_NE(f->return_type, nullptr); EXPECT_TRUE(f->return_type->Is()); - ASSERT_EQ(f->params.size(), 0u); + ASSERT_EQ(f->params.Length(), 0u); auto& attributes = f->attributes; - ASSERT_EQ(attributes.size(), 2u); + ASSERT_EQ(attributes.Length(), 2u); ASSERT_TRUE(attributes[0]->Is()); auto values = attributes[0]->As()->Values(); @@ -179,14 +179,14 @@ fn main() { return; })"); EXPECT_EQ(attributes[1]->As()->stage, ast::PipelineStage::kCompute); auto* body = f->body; - ASSERT_EQ(body->statements.size(), 1u); + ASSERT_EQ(body->statements.Length(), 1u); EXPECT_TRUE(body->statements[0]->Is()); } TEST_F(ParserImplTest, FunctionDecl_AttributeList_MultipleLists) { auto p = parser(R"( @workgroup_size(2, 3, 4) -@stage(compute) +@compute fn main() { return; })"); auto attributes = p->attribute_list(); EXPECT_FALSE(p->has_error()) << p->error(); @@ -201,10 +201,10 @@ fn main() { return; })"); EXPECT_EQ(f->symbol, p->builder().Symbols().Get("main")); ASSERT_NE(f->return_type, nullptr); EXPECT_TRUE(f->return_type->Is()); - ASSERT_EQ(f->params.size(), 0u); + ASSERT_EQ(f->params.Length(), 0u); auto& attrs = f->attributes; - ASSERT_EQ(attrs.size(), 2u); + ASSERT_EQ(attrs.Length(), 2u); ASSERT_TRUE(attrs[0]->Is()); auto values = attrs[0]->As()->Values(); @@ -228,7 +228,7 @@ fn main() { return; })"); EXPECT_EQ(attrs[1]->As()->stage, ast::PipelineStage::kCompute); auto* body = f->body; - ASSERT_EQ(body->statements.size(), 1u); + ASSERT_EQ(body->statements.Length(), 1u); EXPECT_TRUE(body->statements[0]->Is()); } @@ -247,19 +247,19 @@ TEST_F(ParserImplTest, FunctionDecl_ReturnTypeAttributeList) { EXPECT_EQ(f->symbol, p->builder().Symbols().Get("main")); ASSERT_NE(f->return_type, nullptr); EXPECT_TRUE(f->return_type->Is()); - ASSERT_EQ(f->params.size(), 0u); + ASSERT_EQ(f->params.Length(), 0u); auto& attributes = f->attributes; - EXPECT_EQ(attributes.size(), 0u); + EXPECT_EQ(attributes.Length(), 0u); auto& ret_type_attributes = f->return_type_attributes; - ASSERT_EQ(ret_type_attributes.size(), 1u); + ASSERT_EQ(ret_type_attributes.Length(), 1u); auto* loc = ret_type_attributes[0]->As(); ASSERT_TRUE(loc != nullptr); EXPECT_EQ(loc->value, 1u); auto* body = f->body; - ASSERT_EQ(body->statements.size(), 1u); + ASSERT_EQ(body->statements.Length(), 1u); EXPECT_TRUE(body->statements[0]->Is()); } diff --git a/src/tint/reader/wgsl/parser_impl_function_header_test.cc b/src/tint/reader/wgsl/parser_impl_function_header_test.cc index 6f2e6cbf97..1a8704e523 100644 --- a/src/tint/reader/wgsl/parser_impl_function_header_test.cc +++ b/src/tint/reader/wgsl/parser_impl_function_header_test.cc @@ -25,7 +25,7 @@ TEST_F(ParserImplTest, FunctionHeader) { EXPECT_FALSE(f.errored); EXPECT_EQ(f->name, "main"); - ASSERT_EQ(f->params.size(), 2u); + ASSERT_EQ(f->params.Length(), 2u); EXPECT_EQ(f->params[0]->symbol, p->builder().Symbols().Get("a")); EXPECT_EQ(f->params[1]->symbol, p->builder().Symbols().Get("b")); EXPECT_TRUE(f->return_type->Is()); @@ -38,7 +38,7 @@ TEST_F(ParserImplTest, FunctionHeader_TrailingComma) { EXPECT_FALSE(f.errored); EXPECT_EQ(f->name, "main"); - ASSERT_EQ(f->params.size(), 1u); + ASSERT_EQ(f->params.Length(), 1u); EXPECT_EQ(f->params[0]->symbol, p->builder().Symbols().Get("a")); EXPECT_TRUE(f->return_type->Is()); } @@ -51,9 +51,9 @@ TEST_F(ParserImplTest, FunctionHeader_AttributeReturnType) { EXPECT_FALSE(f.errored); EXPECT_EQ(f->name, "main"); - EXPECT_EQ(f->params.size(), 0u); + EXPECT_EQ(f->params.Length(), 0u); EXPECT_TRUE(f->return_type->Is()); - ASSERT_EQ(f->return_type_attributes.size(), 1u); + ASSERT_EQ(f->return_type_attributes.Length(), 1u); auto* loc = f->return_type_attributes[0]->As(); ASSERT_TRUE(loc != nullptr); EXPECT_EQ(loc->value, 1u); @@ -67,9 +67,9 @@ TEST_F(ParserImplTest, FunctionHeader_InvariantReturnType) { EXPECT_FALSE(f.errored); EXPECT_EQ(f->name, "main"); - EXPECT_EQ(f->params.size(), 0u); + EXPECT_EQ(f->params.Length(), 0u); EXPECT_TRUE(f->return_type->Is()); - ASSERT_EQ(f->return_type_attributes.size(), 1u); + ASSERT_EQ(f->return_type_attributes.Length(), 1u); EXPECT_TRUE(f->return_type_attributes[0]->Is()); } diff --git a/src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc b/src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc index 7a5bb452d7..46bfa34528 100644 --- a/src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc @@ -18,7 +18,7 @@ namespace tint::reader::wgsl { namespace { -TEST_F(ParserImplTest, GlobalConstantDecl) { +TEST_F(ParserImplTest, GlobalLetDecl) { auto p = parser("let a : f32 = 1."); auto attrs = p->attribute_list(); EXPECT_FALSE(attrs.errored); @@ -27,24 +27,23 @@ TEST_F(ParserImplTest, GlobalConstantDecl) { EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* const_ = e.value->As(); + ASSERT_NE(const_, nullptr); - EXPECT_TRUE(e->is_const); - EXPECT_FALSE(e->is_overridable); - EXPECT_EQ(e->symbol, p->builder().Symbols().Get("a")); - ASSERT_NE(e->type, nullptr); - EXPECT_TRUE(e->type->Is()); + EXPECT_EQ(const_->symbol, p->builder().Symbols().Get("a")); + ASSERT_NE(const_->type, nullptr); + EXPECT_TRUE(const_->type->Is()); - EXPECT_EQ(e->source.range.begin.line, 1u); - EXPECT_EQ(e->source.range.begin.column, 5u); - EXPECT_EQ(e->source.range.end.line, 1u); - EXPECT_EQ(e->source.range.end.column, 6u); + EXPECT_EQ(const_->source.range.begin.line, 1u); + EXPECT_EQ(const_->source.range.begin.column, 5u); + EXPECT_EQ(const_->source.range.end.line, 1u); + EXPECT_EQ(const_->source.range.end.column, 6u); - ASSERT_NE(e->constructor, nullptr); - EXPECT_TRUE(e->constructor->Is()); + ASSERT_NE(const_->constructor, nullptr); + EXPECT_TRUE(const_->constructor->Is()); } -TEST_F(ParserImplTest, GlobalConstantDecl_Inferred) { +TEST_F(ParserImplTest, GlobalLetDecl_Inferred) { auto p = parser("let a = 1."); auto attrs = p->attribute_list(); EXPECT_FALSE(attrs.errored); @@ -53,23 +52,22 @@ TEST_F(ParserImplTest, GlobalConstantDecl_Inferred) { EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* const_ = e.value->As(); + ASSERT_NE(const_, nullptr); - EXPECT_TRUE(e->is_const); - EXPECT_FALSE(e->is_overridable); - EXPECT_EQ(e->symbol, p->builder().Symbols().Get("a")); - EXPECT_EQ(e->type, nullptr); + EXPECT_EQ(const_->symbol, p->builder().Symbols().Get("a")); + EXPECT_EQ(const_->type, nullptr); - EXPECT_EQ(e->source.range.begin.line, 1u); - EXPECT_EQ(e->source.range.begin.column, 5u); - EXPECT_EQ(e->source.range.end.line, 1u); - EXPECT_EQ(e->source.range.end.column, 6u); + EXPECT_EQ(const_->source.range.begin.line, 1u); + EXPECT_EQ(const_->source.range.begin.column, 5u); + EXPECT_EQ(const_->source.range.end.line, 1u); + EXPECT_EQ(const_->source.range.end.column, 6u); - ASSERT_NE(e->constructor, nullptr); - EXPECT_TRUE(e->constructor->Is()); + ASSERT_NE(const_->constructor, nullptr); + EXPECT_TRUE(const_->constructor->Is()); } -TEST_F(ParserImplTest, GlobalConstantDecl_InvalidExpression) { +TEST_F(ParserImplTest, GlobalLetDecl_InvalidExpression) { auto p = parser("let a : f32 = if (a) {}"); auto attrs = p->attribute_list(); EXPECT_FALSE(attrs.errored); @@ -79,10 +77,13 @@ TEST_F(ParserImplTest, GlobalConstantDecl_InvalidExpression) { EXPECT_TRUE(e.errored); EXPECT_FALSE(e.matched); EXPECT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:15: invalid type for const_expr"); + EXPECT_EQ( + p->error(), + R"(1:1: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +1:15: missing initializer for 'let' declaration)"); } -TEST_F(ParserImplTest, GlobalConstantDecl_MissingExpression) { +TEST_F(ParserImplTest, GlobalLetDecl_MissingExpression) { auto p = parser("let a : f32 ="); auto attrs = p->attribute_list(); EXPECT_FALSE(attrs.errored); @@ -92,10 +93,88 @@ TEST_F(ParserImplTest, GlobalConstantDecl_MissingExpression) { EXPECT_TRUE(e.errored); EXPECT_FALSE(e.matched); EXPECT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:14: unable to parse const_expr"); + EXPECT_EQ( + p->error(), + R"(1:1: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +1:14: missing initializer for 'let' declaration)"); } -TEST_F(ParserImplTest, GlobalConstantDec_Override_WithId) { +TEST_F(ParserImplTest, GlobalConstDecl) { + auto p = parser("const a : f32 = 1."); + auto attrs = p->attribute_list(); + EXPECT_FALSE(attrs.errored); + EXPECT_FALSE(attrs.matched); + auto e = p->global_constant_decl(attrs.value); + EXPECT_FALSE(p->has_error()) << p->error(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + auto* c = e.value->As(); + ASSERT_NE(c, nullptr); + + EXPECT_EQ(c->symbol, p->builder().Symbols().Get("a")); + ASSERT_NE(c->type, nullptr); + EXPECT_TRUE(c->type->Is()); + + EXPECT_EQ(c->source.range.begin.line, 1u); + EXPECT_EQ(c->source.range.begin.column, 7u); + EXPECT_EQ(c->source.range.end.line, 1u); + EXPECT_EQ(c->source.range.end.column, 8u); + + ASSERT_NE(c->constructor, nullptr); + EXPECT_TRUE(c->constructor->Is()); +} + +TEST_F(ParserImplTest, GlobalConstDecl_Inferred) { + auto p = parser("const a = 1."); + auto attrs = p->attribute_list(); + EXPECT_FALSE(attrs.errored); + EXPECT_FALSE(attrs.matched); + auto e = p->global_constant_decl(attrs.value); + EXPECT_FALSE(p->has_error()) << p->error(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + auto* c = e.value->As(); + ASSERT_NE(c, nullptr); + + EXPECT_EQ(c->symbol, p->builder().Symbols().Get("a")); + EXPECT_EQ(c->type, nullptr); + + EXPECT_EQ(c->source.range.begin.line, 1u); + EXPECT_EQ(c->source.range.begin.column, 7u); + EXPECT_EQ(c->source.range.end.line, 1u); + EXPECT_EQ(c->source.range.end.column, 8u); + + ASSERT_NE(c->constructor, nullptr); + EXPECT_TRUE(c->constructor->Is()); +} + +TEST_F(ParserImplTest, GlobalConstDecl_InvalidExpression) { + auto p = parser("const a : f32 = if (a) {}"); + auto attrs = p->attribute_list(); + EXPECT_FALSE(attrs.errored); + EXPECT_FALSE(attrs.matched); + auto e = p->global_constant_decl(attrs.value); + EXPECT_TRUE(p->has_error()); + EXPECT_TRUE(e.errored); + EXPECT_FALSE(e.matched); + EXPECT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:17: missing initializer for 'const' declaration"); +} + +TEST_F(ParserImplTest, GlobalConstDecl_MissingExpression) { + auto p = parser("const a : f32 ="); + auto attrs = p->attribute_list(); + EXPECT_FALSE(attrs.errored); + EXPECT_FALSE(attrs.matched); + auto e = p->global_constant_decl(attrs.value); + EXPECT_TRUE(p->has_error()); + EXPECT_TRUE(e.errored); + EXPECT_FALSE(e.matched); + EXPECT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:16: missing initializer for 'const' declaration"); +} + +TEST_F(ParserImplTest, GlobalOverrideDecl_WithId) { auto p = parser("@id(7) override a : f32 = 1."); auto attrs = p->attribute_list(); EXPECT_FALSE(attrs.errored); @@ -105,28 +184,57 @@ TEST_F(ParserImplTest, GlobalConstantDec_Override_WithId) { EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* override = e.value->As(); + ASSERT_NE(override, nullptr); - EXPECT_TRUE(e->is_const); - EXPECT_TRUE(e->is_overridable); - EXPECT_EQ(e->symbol, p->builder().Symbols().Get("a")); - ASSERT_NE(e->type, nullptr); - EXPECT_TRUE(e->type->Is()); + EXPECT_EQ(override->symbol, p->builder().Symbols().Get("a")); + ASSERT_NE(override->type, nullptr); + EXPECT_TRUE(override->type->Is()); - EXPECT_EQ(e->source.range.begin.line, 1u); - EXPECT_EQ(e->source.range.begin.column, 17u); - EXPECT_EQ(e->source.range.end.line, 1u); - EXPECT_EQ(e->source.range.end.column, 18u); + EXPECT_EQ(override->source.range.begin.line, 1u); + EXPECT_EQ(override->source.range.begin.column, 17u); + EXPECT_EQ(override->source.range.end.line, 1u); + EXPECT_EQ(override->source.range.end.column, 18u); - ASSERT_NE(e->constructor, nullptr); - EXPECT_TRUE(e->constructor->Is()); + ASSERT_NE(override->constructor, nullptr); + EXPECT_TRUE(override->constructor->Is()); - auto* override_attr = ast::GetAttribute(e.value->attributes); + auto* override_attr = ast::GetAttribute(override->attributes); ASSERT_NE(override_attr, nullptr); EXPECT_EQ(override_attr->value, 7u); } -TEST_F(ParserImplTest, GlobalConstantDec_Override_WithoutId) { +TEST_F(ParserImplTest, GlobalOverrideDecl_WithId_TrailingComma) { + auto p = parser("@id(7,) override a : f32 = 1."); + auto attrs = p->attribute_list(); + EXPECT_FALSE(attrs.errored); + EXPECT_TRUE(attrs.matched); + + auto e = p->global_constant_decl(attrs.value); + EXPECT_FALSE(p->has_error()) << p->error(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + auto* override = e.value->As(); + ASSERT_NE(override, nullptr); + + EXPECT_EQ(override->symbol, p->builder().Symbols().Get("a")); + ASSERT_NE(override->type, nullptr); + EXPECT_TRUE(override->type->Is()); + + EXPECT_EQ(override->source.range.begin.line, 1u); + EXPECT_EQ(override->source.range.begin.column, 18u); + EXPECT_EQ(override->source.range.end.line, 1u); + EXPECT_EQ(override->source.range.end.column, 19u); + + ASSERT_NE(override->constructor, nullptr); + EXPECT_TRUE(override->constructor->Is()); + + auto* override_attr = ast::GetAttribute(override->attributes); + ASSERT_NE(override_attr, nullptr); + EXPECT_EQ(override_attr->value, 7u); +} + +TEST_F(ParserImplTest, GlobalOverrideDecl_WithoutId) { auto p = parser("override a : f32 = 1."); auto attrs = p->attribute_list(); EXPECT_FALSE(attrs.errored); @@ -136,27 +244,26 @@ TEST_F(ParserImplTest, GlobalConstantDec_Override_WithoutId) { EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* override = e.value->As(); + ASSERT_NE(override, nullptr); - EXPECT_TRUE(e->is_const); - EXPECT_TRUE(e->is_overridable); - EXPECT_EQ(e->symbol, p->builder().Symbols().Get("a")); - ASSERT_NE(e->type, nullptr); - EXPECT_TRUE(e->type->Is()); + EXPECT_EQ(override->symbol, p->builder().Symbols().Get("a")); + ASSERT_NE(override->type, nullptr); + EXPECT_TRUE(override->type->Is()); - EXPECT_EQ(e->source.range.begin.line, 1u); - EXPECT_EQ(e->source.range.begin.column, 10u); - EXPECT_EQ(e->source.range.end.line, 1u); - EXPECT_EQ(e->source.range.end.column, 11u); + EXPECT_EQ(override->source.range.begin.line, 1u); + EXPECT_EQ(override->source.range.begin.column, 10u); + EXPECT_EQ(override->source.range.end.line, 1u); + EXPECT_EQ(override->source.range.end.column, 11u); - ASSERT_NE(e->constructor, nullptr); - EXPECT_TRUE(e->constructor->Is()); + ASSERT_NE(override->constructor, nullptr); + EXPECT_TRUE(override->constructor->Is()); - auto* id_attr = ast::GetAttribute(e.value->attributes); + auto* id_attr = ast::GetAttribute(override->attributes); ASSERT_EQ(id_attr, nullptr); } -TEST_F(ParserImplTest, GlobalConstantDec_Override_MissingId) { +TEST_F(ParserImplTest, GlobalOverrideDecl_MissingId) { auto p = parser("@id() override a : f32 = 1."); auto attrs = p->attribute_list(); EXPECT_TRUE(attrs.errored); @@ -165,13 +272,14 @@ TEST_F(ParserImplTest, GlobalConstantDec_Override_MissingId) { auto e = p->global_constant_decl(attrs.value); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* override = e.value->As(); + ASSERT_NE(override, nullptr); EXPECT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:5: expected signed integer literal for id attribute"); } -TEST_F(ParserImplTest, GlobalConstantDec_Override_InvalidId) { +TEST_F(ParserImplTest, GlobalOverrideDecl_InvalidId) { auto p = parser("@id(-7) override a : f32 = 1."); auto attrs = p->attribute_list(); EXPECT_TRUE(attrs.errored); @@ -180,7 +288,8 @@ TEST_F(ParserImplTest, GlobalConstantDec_Override_InvalidId) { auto e = p->global_constant_decl(attrs.value); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* override = e.value->As(); + ASSERT_NE(override, nullptr); EXPECT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:5: id attribute must be positive"); diff --git a/src/tint/reader/wgsl/parser_impl_global_decl_test.cc b/src/tint/reader/wgsl/parser_impl_global_decl_test.cc index e2c7d7ad6d..6c943c84de 100644 --- a/src/tint/reader/wgsl/parser_impl_global_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_global_decl_test.cc @@ -29,17 +29,24 @@ TEST_F(ParserImplTest, GlobalDecl_GlobalVariable) { ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().GlobalVariables().size(), 1u); + ASSERT_EQ(program.AST().GlobalVariables().Length(), 1u); auto* v = program.AST().GlobalVariables()[0]; EXPECT_EQ(v->symbol, program.Symbols().Get("a")); + EXPECT_TRUE(Is(v->type)); } -TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_Inferred_Invalid) { +TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_Inferred) { auto p = parser("var a = vec2(1, 2);"); p->global_decl(); - ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:16: expected ':' for variable declaration"); + ASSERT_FALSE(p->has_error()) << p->error(); + + auto program = p->program(); + ASSERT_EQ(program.AST().GlobalVariables().Length(), 1u); + + auto* v = program.AST().GlobalVariables()[0]; + EXPECT_EQ(v->symbol, program.Symbols().Get("a")); + EXPECT_EQ(v->type, nullptr); } TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_MissingSemicolon) { @@ -49,30 +56,79 @@ TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_MissingSemicolon) { EXPECT_EQ(p->error(), "1:27: expected ';' for variable declaration"); } -TEST_F(ParserImplTest, GlobalDecl_GlobalConstant) { +TEST_F(ParserImplTest, GlobalDecl_GlobalLet) { auto p = parser("let a : i32 = 2;"); p->global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().GlobalVariables().size(), 1u); + ASSERT_EQ(program.AST().GlobalVariables().Length(), 1u); auto* v = program.AST().GlobalVariables()[0]; EXPECT_EQ(v->symbol, program.Symbols().Get("a")); } -TEST_F(ParserImplTest, GlobalDecl_GlobalConstant_Invalid) { +TEST_F(ParserImplTest, GlobalDecl_GlobalLet_MissingInitializer) { + auto p = parser("let a : vec2;"); + p->global_decl(); + ASSERT_TRUE(p->has_error()); + EXPECT_EQ( + p->error(), + R"(1:1: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +1:18: expected '=' for 'let' declaration)"); +} + +TEST_F(ParserImplTest, GlobalDecl_GlobalLet_Invalid) { auto p = parser("let a : vec2 1.0;"); p->global_decl(); ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:19: expected ';' for let declaration"); + EXPECT_EQ( + p->error(), + R"(1:1: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +1:19: expected '=' for 'let' declaration)"); } -TEST_F(ParserImplTest, GlobalDecl_GlobalConstant_MissingSemicolon) { +TEST_F(ParserImplTest, GlobalDecl_GlobalLet_MissingSemicolon) { auto p = parser("let a : vec2 = vec2(1, 2)"); p->global_decl(); ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:36: expected ';' for let declaration"); + EXPECT_EQ( + p->error(), + R"(1:1: use of deprecated language feature: module-scope 'let' has been replaced with 'const' +1:36: expected ';' for 'const' declaration)"); +} + +TEST_F(ParserImplTest, GlobalDecl_GlobalConst) { + auto p = parser("const a : i32 = 2;"); + p->global_decl(); + ASSERT_FALSE(p->has_error()) << p->error(); + + auto program = p->program(); + ASSERT_EQ(program.AST().GlobalVariables().Length(), 1u); + + auto* v = program.AST().GlobalVariables()[0]; + EXPECT_EQ(v->symbol, program.Symbols().Get("a")); +} + +TEST_F(ParserImplTest, GlobalDecl_GlobalConst_MissingInitializer) { + auto p = parser("const a : vec2;"); + p->global_decl(); + ASSERT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:20: expected '=' for 'const' declaration"); +} + +TEST_F(ParserImplTest, GlobalDecl_GlobalConst_Invalid) { + auto p = parser("const a : vec2 1.0;"); + p->global_decl(); + ASSERT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:21: expected '=' for 'const' declaration"); +} + +TEST_F(ParserImplTest, GlobalDecl_GlobalConst_MissingSemicolon) { + auto p = parser("const a : vec2 = vec2(1, 2)"); + p->global_decl(); + ASSERT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:38: expected ';' for 'const' declaration"); } TEST_F(ParserImplTest, GlobalDecl_TypeAlias) { @@ -81,7 +137,7 @@ TEST_F(ParserImplTest, GlobalDecl_TypeAlias) { ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().TypeDecls().size(), 1u); + ASSERT_EQ(program.AST().TypeDecls().Length(), 1u); ASSERT_TRUE(program.AST().TypeDecls()[0]->Is()); EXPECT_EQ(program.Symbols().NameFor(program.AST().TypeDecls()[0]->As()->name), "A"); } @@ -96,7 +152,7 @@ type B = A;)"); ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().TypeDecls().size(), 2u); + ASSERT_EQ(program.AST().TypeDecls().Length(), 2u); ASSERT_TRUE(program.AST().TypeDecls()[0]->Is()); auto* str = program.AST().TypeDecls()[0]->As(); EXPECT_EQ(str->name, program.Symbols().Get("A")); @@ -122,7 +178,7 @@ TEST_F(ParserImplTest, GlobalDecl_Function) { ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().Functions().size(), 1u); + ASSERT_EQ(program.AST().Functions().Length(), 1u); EXPECT_EQ(program.Symbols().NameFor(program.AST().Functions()[0]->symbol), "main"); } @@ -132,7 +188,7 @@ TEST_F(ParserImplTest, GlobalDecl_Function_WithAttribute) { ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().Functions().size(), 1u); + ASSERT_EQ(program.AST().Functions().Length(), 1u); EXPECT_EQ(program.Symbols().NameFor(program.AST().Functions()[0]->symbol), "main"); } @@ -149,7 +205,7 @@ TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) { ASSERT_FALSE(p->has_error()) << p->error(); auto program = p->program(); - ASSERT_EQ(program.AST().TypeDecls().size(), 1u); + ASSERT_EQ(program.AST().TypeDecls().Length(), 1u); auto* t = program.AST().TypeDecls()[0]; ASSERT_NE(t, nullptr); @@ -157,7 +213,7 @@ TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) { auto* str = t->As(); EXPECT_EQ(str->name, program.Symbols().Get("A")); - EXPECT_EQ(str->members.size(), 2u); + EXPECT_EQ(str->members.Length(), 2u); } TEST_F(ParserImplTest, GlobalDecl_Struct_Invalid) { @@ -177,5 +233,58 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_Invalid) { } } +TEST_F(ParserImplTest, GlobalDecl_Struct_UnexpectedAttribute) { + auto p = parser("@vertex struct S { i : i32 }"); + + auto s = p->global_decl(); + EXPECT_TRUE(s.errored); + EXPECT_FALSE(s.matched); + + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:2: unexpected attributes"); +} + +TEST_F(ParserImplTest, GlobalDecl_StaticAssert_WithParen) { + auto p = parser("static_assert(true);"); + p->global_decl(); + ASSERT_FALSE(p->has_error()) << p->error(); + + auto program = p->program(); + ASSERT_EQ(program.AST().StaticAsserts().Length(), 1u); + auto* sa = program.AST().StaticAsserts()[0]; + EXPECT_EQ(sa->source.range.begin.line, 1u); + EXPECT_EQ(sa->source.range.begin.column, 1u); + EXPECT_EQ(sa->source.range.end.line, 1u); + EXPECT_EQ(sa->source.range.end.column, 20u); + + EXPECT_TRUE(sa->condition->Is()); + EXPECT_EQ(sa->condition->source.range.begin.line, 1u); + EXPECT_EQ(sa->condition->source.range.begin.column, 15u); + EXPECT_EQ(sa->condition->source.range.end.line, 1u); + EXPECT_EQ(sa->condition->source.range.end.column, 19u); +} + +TEST_F(ParserImplTest, GlobalDecl_StaticAssert_WithoutParen) { + auto p = parser("static_assert true;"); + p->global_decl(); + ASSERT_FALSE(p->has_error()) << p->error(); + + auto program = p->program(); + ASSERT_EQ(program.AST().StaticAsserts().Length(), 1u); + auto* sa = program.AST().StaticAsserts()[0]; + EXPECT_TRUE(sa->condition->Is()); + + EXPECT_EQ(sa->source.range.begin.line, 1u); + EXPECT_EQ(sa->source.range.begin.column, 1u); + EXPECT_EQ(sa->source.range.end.line, 1u); + EXPECT_EQ(sa->source.range.end.column, 20u); + + EXPECT_TRUE(sa->condition->Is()); + EXPECT_EQ(sa->condition->source.range.begin.line, 1u); + EXPECT_EQ(sa->condition->source.range.begin.column, 16u); + EXPECT_EQ(sa->condition->source.range.end.line, 1u); + EXPECT_EQ(sa->condition->source.range.end.column, 20u); +} + } // namespace } // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc b/src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc index 57f90b9573..85f4702d8b 100644 --- a/src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc @@ -26,18 +26,19 @@ TEST_F(ParserImplTest, GlobalVariableDecl_WithoutConstructor) { ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* var = e.value->As(); + ASSERT_NE(var, nullptr); - EXPECT_EQ(e->symbol, p->builder().Symbols().Get("a")); - EXPECT_TRUE(e->type->Is()); - EXPECT_EQ(e->declared_storage_class, ast::StorageClass::kPrivate); + EXPECT_EQ(var->symbol, p->builder().Symbols().Get("a")); + EXPECT_TRUE(var->type->Is()); + EXPECT_EQ(var->declared_storage_class, ast::StorageClass::kPrivate); - EXPECT_EQ(e->source.range.begin.line, 1u); - EXPECT_EQ(e->source.range.begin.column, 14u); - EXPECT_EQ(e->source.range.end.line, 1u); - EXPECT_EQ(e->source.range.end.column, 15u); + EXPECT_EQ(var->source.range.begin.line, 1u); + EXPECT_EQ(var->source.range.begin.column, 14u); + EXPECT_EQ(var->source.range.end.line, 1u); + EXPECT_EQ(var->source.range.end.column, 15u); - ASSERT_EQ(e->constructor, nullptr); + ASSERT_EQ(var->constructor, nullptr); } TEST_F(ParserImplTest, GlobalVariableDecl_WithConstructor) { @@ -49,19 +50,20 @@ TEST_F(ParserImplTest, GlobalVariableDecl_WithConstructor) { ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* var = e.value->As(); + ASSERT_NE(var, nullptr); - EXPECT_EQ(e->symbol, p->builder().Symbols().Get("a")); - EXPECT_TRUE(e->type->Is()); - EXPECT_EQ(e->declared_storage_class, ast::StorageClass::kPrivate); + EXPECT_EQ(var->symbol, p->builder().Symbols().Get("a")); + EXPECT_TRUE(var->type->Is()); + EXPECT_EQ(var->declared_storage_class, ast::StorageClass::kPrivate); - EXPECT_EQ(e->source.range.begin.line, 1u); - EXPECT_EQ(e->source.range.begin.column, 14u); - EXPECT_EQ(e->source.range.end.line, 1u); - EXPECT_EQ(e->source.range.end.column, 15u); + EXPECT_EQ(var->source.range.begin.line, 1u); + EXPECT_EQ(var->source.range.begin.column, 14u); + EXPECT_EQ(var->source.range.end.line, 1u); + EXPECT_EQ(var->source.range.end.column, 15u); - ASSERT_NE(e->constructor, nullptr); - ASSERT_TRUE(e->constructor->Is()); + ASSERT_NE(var->constructor, nullptr); + ASSERT_TRUE(var->constructor->Is()); } TEST_F(ParserImplTest, GlobalVariableDecl_WithAttribute) { @@ -73,22 +75,23 @@ TEST_F(ParserImplTest, GlobalVariableDecl_WithAttribute) { ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* var = e.value->As(); + ASSERT_NE(var, nullptr); - EXPECT_EQ(e->symbol, p->builder().Symbols().Get("a")); - ASSERT_NE(e->type, nullptr); - EXPECT_TRUE(e->type->Is()); - EXPECT_EQ(e->declared_storage_class, ast::StorageClass::kUniform); + EXPECT_EQ(var->symbol, p->builder().Symbols().Get("a")); + ASSERT_NE(var->type, nullptr); + EXPECT_TRUE(var->type->Is()); + EXPECT_EQ(var->declared_storage_class, ast::StorageClass::kUniform); - EXPECT_EQ(e->source.range.begin.line, 1u); - EXPECT_EQ(e->source.range.begin.column, 36u); - EXPECT_EQ(e->source.range.end.line, 1u); - EXPECT_EQ(e->source.range.end.column, 37u); + EXPECT_EQ(var->source.range.begin.line, 1u); + EXPECT_EQ(var->source.range.begin.column, 36u); + EXPECT_EQ(var->source.range.end.line, 1u); + EXPECT_EQ(var->source.range.end.column, 37u); - ASSERT_EQ(e->constructor, nullptr); + ASSERT_EQ(var->constructor, nullptr); - auto& attributes = e->attributes; - ASSERT_EQ(attributes.size(), 2u); + auto& attributes = var->attributes; + ASSERT_EQ(attributes.Length(), 2u); ASSERT_TRUE(attributes[0]->Is()); ASSERT_TRUE(attributes[1]->Is()); } @@ -103,22 +106,23 @@ TEST_F(ParserImplTest, GlobalVariableDecl_WithAttribute_MulitpleGroups) { ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); + auto* var = e.value->As(); + ASSERT_NE(var, nullptr); - EXPECT_EQ(e->symbol, p->builder().Symbols().Get("a")); - ASSERT_NE(e->type, nullptr); - EXPECT_TRUE(e->type->Is()); - EXPECT_EQ(e->declared_storage_class, ast::StorageClass::kUniform); + EXPECT_EQ(var->symbol, p->builder().Symbols().Get("a")); + ASSERT_NE(var->type, nullptr); + EXPECT_TRUE(var->type->Is()); + EXPECT_EQ(var->declared_storage_class, ast::StorageClass::kUniform); - EXPECT_EQ(e->source.range.begin.line, 1u); - EXPECT_EQ(e->source.range.begin.column, 36u); - EXPECT_EQ(e->source.range.end.line, 1u); - EXPECT_EQ(e->source.range.end.column, 37u); + EXPECT_EQ(var->source.range.begin.line, 1u); + EXPECT_EQ(var->source.range.begin.column, 36u); + EXPECT_EQ(var->source.range.end.line, 1u); + EXPECT_EQ(var->source.range.end.column, 37u); - ASSERT_EQ(e->constructor, nullptr); + ASSERT_EQ(var->constructor, nullptr); - auto& attributes = e->attributes; - ASSERT_EQ(attributes.size(), 2u); + auto& attributes = var->attributes; + ASSERT_EQ(attributes.Length(), 2u); ASSERT_TRUE(attributes[0]->Is()); ASSERT_TRUE(attributes[1]->Is()); } @@ -148,7 +152,7 @@ TEST_F(ParserImplTest, GlobalVariableDecl_InvalidConstExpr) { EXPECT_TRUE(e.errored); EXPECT_FALSE(e.matched); EXPECT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:24: invalid type for const_expr"); + EXPECT_EQ(p->error(), "1:24: missing initializer for 'var' declaration"); } TEST_F(ParserImplTest, GlobalVariableDecl_InvalidVariableDecl) { diff --git a/src/tint/reader/wgsl/parser_impl_if_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_if_stmt_test.cc index b9e5566d61..59e5ad38ba 100644 --- a/src/tint/reader/wgsl/parser_impl_if_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_if_stmt_test.cc @@ -19,7 +19,7 @@ namespace { TEST_F(ParserImplTest, IfStmt) { auto p = parser("if a == 4 { a = b; c = d; }"); - auto e = p->if_stmt(); + auto e = p->if_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -28,13 +28,13 @@ TEST_F(ParserImplTest, IfStmt) { ASSERT_TRUE(e->Is()); ASSERT_NE(e->condition, nullptr); ASSERT_TRUE(e->condition->Is()); - EXPECT_EQ(e->body->statements.size(), 2u); + EXPECT_EQ(e->body->statements.Length(), 2u); EXPECT_EQ(e->else_statement, nullptr); } TEST_F(ParserImplTest, IfStmt_WithElse) { auto p = parser("if a == 4 { a = b; c = d; } else if(c) { d = 2; } else {}"); - auto e = p->if_stmt(); + auto e = p->if_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -43,21 +43,21 @@ TEST_F(ParserImplTest, IfStmt_WithElse) { ASSERT_TRUE(e->Is()); ASSERT_NE(e->condition, nullptr); ASSERT_TRUE(e->condition->Is()); - EXPECT_EQ(e->body->statements.size(), 2u); + EXPECT_EQ(e->body->statements.Length(), 2u); auto* elseif = As(e->else_statement); ASSERT_NE(elseif, nullptr); ASSERT_TRUE(elseif->condition->Is()); - EXPECT_EQ(elseif->body->statements.size(), 1u); + EXPECT_EQ(elseif->body->statements.Length(), 1u); auto* el = As(elseif->else_statement); ASSERT_NE(el, nullptr); - EXPECT_EQ(el->statements.size(), 0u); + EXPECT_EQ(el->statements.Length(), 0u); } TEST_F(ParserImplTest, IfStmt_WithElse_WithParens) { auto p = parser("if(a==4) { a = b; c = d; } else if(c) { d = 2; } else {}"); - auto e = p->if_stmt(); + auto e = p->if_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -66,21 +66,21 @@ TEST_F(ParserImplTest, IfStmt_WithElse_WithParens) { ASSERT_TRUE(e->Is()); ASSERT_NE(e->condition, nullptr); ASSERT_TRUE(e->condition->Is()); - EXPECT_EQ(e->body->statements.size(), 2u); + EXPECT_EQ(e->body->statements.Length(), 2u); auto* elseif = As(e->else_statement); ASSERT_NE(elseif, nullptr); ASSERT_TRUE(elseif->condition->Is()); - EXPECT_EQ(elseif->body->statements.size(), 1u); + EXPECT_EQ(elseif->body->statements.Length(), 1u); auto* el = As(elseif->else_statement); ASSERT_NE(el, nullptr); - EXPECT_EQ(el->statements.size(), 0u); + EXPECT_EQ(el->statements.Length(), 0u); } TEST_F(ParserImplTest, IfStmt_InvalidCondition) { auto p = parser("if a = 3 {}"); - auto e = p->if_stmt(); + auto e = p->if_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -90,7 +90,7 @@ TEST_F(ParserImplTest, IfStmt_InvalidCondition) { TEST_F(ParserImplTest, IfStmt_MissingCondition) { auto p = parser("if {}"); - auto e = p->if_stmt(); + auto e = p->if_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -100,7 +100,7 @@ TEST_F(ParserImplTest, IfStmt_MissingCondition) { TEST_F(ParserImplTest, IfStmt_InvalidBody) { auto p = parser("if a { fn main() {}}"); - auto e = p->if_stmt(); + auto e = p->if_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -110,7 +110,7 @@ TEST_F(ParserImplTest, IfStmt_InvalidBody) { TEST_F(ParserImplTest, IfStmt_MissingBody) { auto p = parser("if a"); - auto e = p->if_stmt(); + auto e = p->if_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -120,7 +120,7 @@ TEST_F(ParserImplTest, IfStmt_MissingBody) { TEST_F(ParserImplTest, IfStmt_InvalidElseif) { auto p = parser("if a {} else if a { fn main() -> a{}}"); - auto e = p->if_stmt(); + auto e = p->if_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -130,7 +130,7 @@ TEST_F(ParserImplTest, IfStmt_InvalidElseif) { TEST_F(ParserImplTest, IfStmt_InvalidElse) { auto p = parser("if a {} else { fn main() -> a{}}"); - auto e = p->if_stmt(); + auto e = p->if_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); diff --git a/src/tint/reader/wgsl/parser_impl_inclusive_or_expression_test.cc b/src/tint/reader/wgsl/parser_impl_inclusive_or_expression_test.cc deleted file mode 100644 index 83b9358c07..0000000000 --- a/src/tint/reader/wgsl/parser_impl_inclusive_or_expression_test.cc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/reader/wgsl/parser_impl_test_helper.h" - -namespace tint::reader::wgsl { -namespace { - -TEST_F(ParserImplTest, InclusiveOrExpression_Parses) { - auto p = parser("a | true"); - auto e = p->inclusive_or_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - - ASSERT_TRUE(e->Is()); - auto* rel = e->As(); - EXPECT_EQ(ast::BinaryOp::kOr, rel->op); - - ASSERT_TRUE(rel->lhs->Is()); - auto* ident = rel->lhs->As(); - EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); -} - -TEST_F(ParserImplTest, InclusiveOrExpression_InvalidLHS) { - auto p = parser("if (a) {} | true"); - auto e = p->inclusive_or_expression(); - EXPECT_FALSE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_EQ(e.value, nullptr); -} - -TEST_F(ParserImplTest, InclusiveOrExpression_InvalidRHS) { - auto p = parser("true | if (a) {}"); - auto e = p->inclusive_or_expression(); - EXPECT_FALSE(e.matched); - EXPECT_TRUE(e.errored); - EXPECT_EQ(e.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:8: unable to parse right side of | expression"); -} - -TEST_F(ParserImplTest, InclusiveOrExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); - auto e = p->inclusive_or_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); -} - -} // namespace -} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_increment_decrement_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_increment_decrement_stmt_test.cc index 8041735329..79220e48e7 100644 --- a/src/tint/reader/wgsl/parser_impl_increment_decrement_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_increment_decrement_stmt_test.cc @@ -19,7 +19,7 @@ namespace { TEST_F(ParserImplTest, IncrementDecrementStmt_Increment) { auto p = parser("a++"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -38,7 +38,7 @@ TEST_F(ParserImplTest, IncrementDecrementStmt_Increment) { TEST_F(ParserImplTest, IncrementDecrementStmt_Decrement) { auto p = parser("a--"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -57,7 +57,7 @@ TEST_F(ParserImplTest, IncrementDecrementStmt_Decrement) { TEST_F(ParserImplTest, IncrementDecrementStmt_Parenthesized) { auto p = parser("(a)++"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -76,7 +76,7 @@ TEST_F(ParserImplTest, IncrementDecrementStmt_Parenthesized) { TEST_F(ParserImplTest, IncrementDecrementStmt_ToMember) { auto p = parser("a.b.c[2].d++"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -121,7 +121,7 @@ TEST_F(ParserImplTest, IncrementDecrementStmt_ToMember) { TEST_F(ParserImplTest, IncrementDecrementStmt_InvalidLHS) { auto p = parser("{}++"); - auto e = p->assignment_stmt(); + auto e = p->variable_updating_statement(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); diff --git a/src/tint/reader/wgsl/parser_impl_lhs_expression_test.cc b/src/tint/reader/wgsl/parser_impl_lhs_expression_test.cc new file mode 100644 index 0000000000..6611f3eee1 --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_lhs_expression_test.cc @@ -0,0 +1,138 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, LHSExpression_NoPrefix) { + auto p = parser("a"); + auto e = p->lhs_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_TRUE(e.matched); + ASSERT_NE(e.value, nullptr); + ASSERT_TRUE(e->Is()); +} + +TEST_F(ParserImplTest, LHSExpression_NoMatch) { + auto p = parser("123"); + auto e = p->lhs_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_FALSE(e.matched); + ASSERT_EQ(e.value, nullptr); +} + +TEST_F(ParserImplTest, LHSExpression_And) { + auto p = parser("&a"); + auto e = p->lhs_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_TRUE(e.matched); + ASSERT_NE(e.value, nullptr); + ASSERT_TRUE(e->Is()); + + auto* u = e->As(); + EXPECT_EQ(u->op, ast::UnaryOp::kAddressOf); + EXPECT_TRUE(u->expr->Is()); +} + +TEST_F(ParserImplTest, LHSExpression_Star) { + auto p = parser("*a"); + auto e = p->lhs_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_TRUE(e.matched); + ASSERT_NE(e.value, nullptr); + ASSERT_TRUE(e->Is()); + + auto* u = e->As(); + EXPECT_EQ(u->op, ast::UnaryOp::kIndirection); + EXPECT_TRUE(u->expr->Is()); +} + +TEST_F(ParserImplTest, LHSExpression_InvalidCoreLHSExpr) { + auto p = parser("*123"); + auto e = p->lhs_expression(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + EXPECT_FALSE(e.matched); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:2: missing expression"); +} + +TEST_F(ParserImplTest, LHSExpression_Multiple) { + auto p = parser("*&**&&*a"); + auto e = p->lhs_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_TRUE(e.matched); + ASSERT_NE(e.value, nullptr); + + std::vector results = {ast::UnaryOp::kIndirection, ast::UnaryOp::kAddressOf, + ast::UnaryOp::kIndirection, ast::UnaryOp::kIndirection, + ast::UnaryOp::kAddressOf, ast::UnaryOp::kAddressOf, + ast::UnaryOp::kIndirection}; + + auto* expr = e.value; + for (auto op : results) { + ASSERT_TRUE(expr->Is()); + + auto* u = expr->As(); + EXPECT_EQ(u->op, op); + + expr = u->expr; + } + + EXPECT_TRUE(expr->Is()); +} + +TEST_F(ParserImplTest, LHSExpression_PostfixExpression) { + auto p = parser("*a.foo"); + auto e = p->lhs_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + EXPECT_TRUE(e.matched); + ASSERT_NE(e.value, nullptr); + ASSERT_TRUE(e->Is()); + + auto* access = e->As(); + ASSERT_TRUE(access->structure->Is()); + + auto* u = access->structure->As(); + EXPECT_EQ(u->op, ast::UnaryOp::kIndirection); + + ASSERT_TRUE(u->expr->Is()); + auto* struct_ident = u->expr->As(); + EXPECT_EQ(struct_ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(access->member->Is()); + auto* member_ident = access->member->As(); + EXPECT_EQ(member_ident->symbol, p->builder().Symbols().Get("foo")); +} + +TEST_F(ParserImplTest, LHSExpression_InvalidPostfixExpression) { + auto p = parser("*a.if"); + auto e = p->lhs_expression(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + EXPECT_FALSE(e.matched); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:4: expected identifier for member accessor"); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_logical_and_expression_test.cc b/src/tint/reader/wgsl/parser_impl_logical_and_expression_test.cc deleted file mode 100644 index 57624a5e64..0000000000 --- a/src/tint/reader/wgsl/parser_impl_logical_and_expression_test.cc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/reader/wgsl/parser_impl_test_helper.h" - -namespace tint::reader::wgsl { -namespace { - -TEST_F(ParserImplTest, LogicalAndExpression_Parses) { - auto p = parser("a && true"); - auto e = p->logical_and_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - - ASSERT_TRUE(e->Is()); - auto* rel = e->As(); - EXPECT_EQ(ast::BinaryOp::kLogicalAnd, rel->op); - - ASSERT_TRUE(rel->lhs->Is()); - auto* ident = rel->lhs->As(); - EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); -} - -TEST_F(ParserImplTest, LogicalAndExpression_InvalidLHS) { - auto p = parser("if (a) {} && true"); - auto e = p->logical_and_expression(); - EXPECT_FALSE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - EXPECT_EQ(e.value, nullptr); -} - -TEST_F(ParserImplTest, LogicalAndExpression_InvalidRHS) { - auto p = parser("true && if (a) {}"); - auto e = p->logical_and_expression(); - EXPECT_FALSE(e.matched); - EXPECT_TRUE(e.errored); - EXPECT_EQ(e.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:9: unable to parse right side of && expression"); -} - -TEST_F(ParserImplTest, LogicalAndExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); - auto e = p->logical_and_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); -} - -} // namespace -} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_logical_or_expression_test.cc b/src/tint/reader/wgsl/parser_impl_logical_or_expression_test.cc deleted file mode 100644 index 6bde6bd5c1..0000000000 --- a/src/tint/reader/wgsl/parser_impl_logical_or_expression_test.cc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/reader/wgsl/parser_impl_test_helper.h" - -namespace tint::reader::wgsl { -namespace { - -TEST_F(ParserImplTest, LogicalOrExpression_Parses) { - auto p = parser("a || true"); - auto e = p->logical_or_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - - ASSERT_TRUE(e->Is()); - auto* rel = e->As(); - EXPECT_EQ(ast::BinaryOp::kLogicalOr, rel->op); - - ASSERT_TRUE(rel->lhs->Is()); - auto* ident = rel->lhs->As(); - EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); -} - -TEST_F(ParserImplTest, LogicalOrExpression_InvalidLHS) { - auto p = parser("if (a) {} || true"); - auto e = p->logical_or_expression(); - EXPECT_FALSE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - EXPECT_EQ(e.value, nullptr); -} - -TEST_F(ParserImplTest, LogicalOrExpression_InvalidRHS) { - auto p = parser("true || if (a) {}"); - auto e = p->logical_or_expression(); - EXPECT_FALSE(e.matched); - EXPECT_TRUE(e.errored); - EXPECT_EQ(e.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:9: unable to parse right side of || expression"); -} - -TEST_F(ParserImplTest, LogicalOrExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); - auto e = p->logical_or_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); -} - -} // namespace -} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_loop_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_loop_stmt_test.cc index 20cd4f6770..a3e51b4f7f 100644 --- a/src/tint/reader/wgsl/parser_impl_loop_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_loop_stmt_test.cc @@ -20,59 +20,59 @@ namespace { TEST_F(ParserImplTest, LoopStmt_BodyNoContinuing) { auto p = parser("loop { discard; }"); - auto e = p->loop_stmt(); + auto e = p->loop_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_EQ(e->body->statements.size(), 1u); + ASSERT_EQ(e->body->statements.Length(), 1u); EXPECT_TRUE(e->body->statements[0]->Is()); - EXPECT_EQ(e->continuing->statements.size(), 0u); + EXPECT_EQ(e->continuing->statements.Length(), 0u); } TEST_F(ParserImplTest, LoopStmt_BodyWithContinuing) { auto p = parser("loop { discard; continuing { discard; }}"); - auto e = p->loop_stmt(); + auto e = p->loop_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_EQ(e->body->statements.size(), 1u); + ASSERT_EQ(e->body->statements.Length(), 1u); EXPECT_TRUE(e->body->statements[0]->Is()); - EXPECT_EQ(e->continuing->statements.size(), 1u); + EXPECT_EQ(e->continuing->statements.Length(), 1u); EXPECT_TRUE(e->continuing->statements[0]->Is()); } TEST_F(ParserImplTest, LoopStmt_NoBodyNoContinuing) { auto p = parser("loop { }"); - auto e = p->loop_stmt(); + auto e = p->loop_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_EQ(e->body->statements.size(), 0u); - ASSERT_EQ(e->continuing->statements.size(), 0u); + ASSERT_EQ(e->body->statements.Length(), 0u); + ASSERT_EQ(e->continuing->statements.Length(), 0u); } TEST_F(ParserImplTest, LoopStmt_NoBodyWithContinuing) { auto p = parser("loop { continuing { discard; }}"); - auto e = p->loop_stmt(); + auto e = p->loop_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_EQ(e->body->statements.size(), 0u); - ASSERT_EQ(e->continuing->statements.size(), 1u); + ASSERT_EQ(e->body->statements.Length(), 0u); + ASSERT_EQ(e->continuing->statements.Length(), 1u); EXPECT_TRUE(e->continuing->statements[0]->Is()); } TEST_F(ParserImplTest, LoopStmt_MissingBracketLeft) { auto p = parser("loop discard; }"); - auto e = p->loop_stmt(); + auto e = p->loop_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -82,7 +82,7 @@ TEST_F(ParserImplTest, LoopStmt_MissingBracketLeft) { TEST_F(ParserImplTest, LoopStmt_MissingBracketRight) { auto p = parser("loop { discard; "); - auto e = p->loop_stmt(); + auto e = p->loop_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -92,7 +92,7 @@ TEST_F(ParserImplTest, LoopStmt_MissingBracketRight) { TEST_F(ParserImplTest, LoopStmt_InvalidStatements) { auto p = parser("loop { discard }"); - auto e = p->loop_stmt(); + auto e = p->loop_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -102,7 +102,7 @@ TEST_F(ParserImplTest, LoopStmt_InvalidStatements) { TEST_F(ParserImplTest, LoopStmt_InvalidContinuing) { auto p = parser("loop { continuing { discard }}"); - auto e = p->loop_stmt(); + auto e = p->loop_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); diff --git a/src/tint/reader/wgsl/parser_impl_math_expression_test.cc b/src/tint/reader/wgsl/parser_impl_math_expression_test.cc new file mode 100644 index 0000000000..27b5870bda --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_math_expression_test.cc @@ -0,0 +1,153 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, MathExpression_Parses_Multiplicative) { + auto p = parser("a * b"); + auto lhs = p->unary_expression(); + auto e = p->expect_math_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, MathExpression_Parses_Mixed_MultiplicativeStart) { + auto p = parser("a * b + c"); + auto lhs = p->unary_expression(); + auto e = p->expect_math_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + // lhs: a * b + // op: + + // rhs: c + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kAdd, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("c")); + + ASSERT_TRUE(rel->lhs->Is()); + // lhs: a + // op: * + // rhs: b + rel = rel->lhs->As(); + EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, MathExpression_Parses_Additive) { + auto p = parser("a + b"); + auto lhs = p->unary_expression(); + auto e = p->expect_math_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kAdd, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, MathExpression_Parses_Mixed_AdditiveStart) { + auto p = parser("a + b * c"); + auto lhs = p->unary_expression(); + auto e = p->expect_math_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + // lhs: a + // op: + + // rhs: b * c + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kAdd, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + // lhs: b + // op: * + // rhs: c + rel = rel->rhs->As(); + EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("c")); +} + +TEST_F(ParserImplTest, MathExpression_NoMatch_ReturnLHS) { + auto p = parser("a if"); + auto lhs = p->unary_expression(); + auto e = p->expect_math_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + EXPECT_EQ(lhs.value, e.value); +} + +TEST_F(ParserImplTest, MathExpression_InvalidRHS) { + auto p = parser("a * if"); + auto lhs = p->unary_expression(); + auto e = p->expect_math_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.errored); + EXPECT_TRUE(p->has_error()); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ("1:5: unable to parse right side of * expression", p->error()); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_multiplicative_expression_test.cc b/src/tint/reader/wgsl/parser_impl_multiplicative_expression_test.cc index 6d77fd5dab..941747798f 100644 --- a/src/tint/reader/wgsl/parser_impl_multiplicative_expression_test.cc +++ b/src/tint/reader/wgsl/parser_impl_multiplicative_expression_test.cc @@ -18,9 +18,9 @@ namespace tint::reader::wgsl { namespace { TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Multiply) { - auto p = parser("a * true"); - auto e = p->multiplicative_expression(); - EXPECT_TRUE(e.matched); + auto p = parser("a * b"); + auto lhs = p->unary_expression(); + auto e = p->expect_multiplicative_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); @@ -33,14 +33,40 @@ TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Multiply) { auto* ident = rel->lhs->As(); EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Multiply_UnaryIndirect) { + auto p = parser("a **b"); + auto lhs = p->unary_expression(); + auto e = p->expect_multiplicative_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + auto* unary = rel->rhs->As(); + EXPECT_EQ(ast::UnaryOp::kIndirection, unary->op); + + ASSERT_TRUE(unary->expr->Is()); + ident = unary->expr->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); } TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Divide) { - auto p = parser("a / true"); - auto e = p->multiplicative_expression(); - EXPECT_TRUE(e.matched); + auto p = parser("a / b"); + auto lhs = p->unary_expression(); + auto e = p->expect_multiplicative_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); @@ -53,14 +79,15 @@ TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Divide) { auto* ident = rel->lhs->As(); EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); } TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Modulo) { - auto p = parser("a % true"); - auto e = p->multiplicative_expression(); - EXPECT_TRUE(e.matched); + auto p = parser("a % b"); + auto lhs = p->unary_expression(); + auto e = p->expect_multiplicative_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); @@ -73,37 +100,86 @@ TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Modulo) { auto* ident = rel->lhs->As(); EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); } -TEST_F(ParserImplTest, MultiplicativeExpression_InvalidLHS) { - auto p = parser("if (a) {} * true"); - auto e = p->multiplicative_expression(); - EXPECT_FALSE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - EXPECT_EQ(e.value, nullptr); -} - -TEST_F(ParserImplTest, MultiplicativeExpression_InvalidRHS) { - auto p = parser("true * if (a) {}"); - auto e = p->multiplicative_expression(); - EXPECT_FALSE(e.matched); - EXPECT_TRUE(e.errored); - EXPECT_EQ(e.value, nullptr); - ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:8: unable to parse right side of * expression"); -} - -TEST_F(ParserImplTest, MultiplicativeExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); - auto e = p->multiplicative_expression(); - EXPECT_TRUE(e.matched); +TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Grouping) { + auto p = parser("a * b / c % d * e"); + auto lhs = p->unary_expression(); + auto e = p->expect_multiplicative_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); + + ASSERT_TRUE(e->Is()); + // lhs: ((a * b) / c) % d + // op: * + // rhs: e + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + auto* ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("e")); + + ASSERT_TRUE(rel->lhs->Is()); + // lhs: (a * b) / c + // op: % + // rhs: d + rel = rel->lhs->As(); + EXPECT_EQ(ast::BinaryOp::kModulo, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("d")); + + ASSERT_TRUE(rel->lhs->Is()); + // lhs: a * b + // op: / + // rhs: c + rel = rel->lhs->As(); + EXPECT_EQ(ast::BinaryOp::kDivide, rel->op); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("c")); + + ASSERT_TRUE(rel->lhs->Is()); + // lhs: a + // op: * + // rhs: b + rel = rel->lhs->As(); + EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, MultiplicativeExpression_InvalidRHS) { + auto p = parser("a * if (a) {}"); + auto lhs = p->unary_expression(); + auto e = p->expect_multiplicative_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + ASSERT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:5: unable to parse right side of * expression"); +} + +TEST_F(ParserImplTest, MultiplicativeExpression_NoMatch_ReturnsLHS) { + auto p = parser("a + b"); + auto lhs = p->unary_expression(); + auto e = p->expect_multiplicative_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + EXPECT_EQ(lhs.value, e.value); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_param_list_test.cc b/src/tint/reader/wgsl/parser_impl_param_list_test.cc index 2d79a99da1..ce542e4c23 100644 --- a/src/tint/reader/wgsl/parser_impl_param_list_test.cc +++ b/src/tint/reader/wgsl/parser_impl_param_list_test.cc @@ -23,11 +23,11 @@ TEST_F(ParserImplTest, ParamList_Single) { auto e = p->expect_param_list(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); - EXPECT_EQ(e.value.size(), 1u); + EXPECT_EQ(e.value.Length(), 1u); EXPECT_EQ(e.value[0]->symbol, p->builder().Symbols().Get("a")); EXPECT_TRUE(e.value[0]->type->Is()); - EXPECT_TRUE(e.value[0]->is_const); + EXPECT_TRUE(e.value[0]->Is()); ASSERT_EQ(e.value[0]->source.range.begin.line, 1u); ASSERT_EQ(e.value[0]->source.range.begin.column, 1u); @@ -41,11 +41,11 @@ TEST_F(ParserImplTest, ParamList_Multiple) { auto e = p->expect_param_list(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); - EXPECT_EQ(e.value.size(), 3u); + EXPECT_EQ(e.value.Length(), 3u); EXPECT_EQ(e.value[0]->symbol, p->builder().Symbols().Get("a")); EXPECT_TRUE(e.value[0]->type->Is()); - EXPECT_TRUE(e.value[0]->is_const); + EXPECT_TRUE(e.value[0]->Is()); ASSERT_EQ(e.value[0]->source.range.begin.line, 1u); ASSERT_EQ(e.value[0]->source.range.begin.column, 1u); @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, ParamList_Multiple) { EXPECT_EQ(e.value[1]->symbol, p->builder().Symbols().Get("b")); EXPECT_TRUE(e.value[1]->type->Is()); - EXPECT_TRUE(e.value[1]->is_const); + EXPECT_TRUE(e.value[1]->Is()); ASSERT_EQ(e.value[1]->source.range.begin.line, 1u); ASSERT_EQ(e.value[1]->source.range.begin.column, 10u); @@ -65,7 +65,7 @@ TEST_F(ParserImplTest, ParamList_Multiple) { ASSERT_TRUE(e.value[2]->type->Is()); ASSERT_TRUE(e.value[2]->type->As()->type->Is()); EXPECT_EQ(e.value[2]->type->As()->width, 2u); - EXPECT_TRUE(e.value[2]->is_const); + EXPECT_TRUE(e.value[2]->Is()); ASSERT_EQ(e.value[2]->source.range.begin.line, 1u); ASSERT_EQ(e.value[2]->source.range.begin.column, 18u); @@ -78,7 +78,7 @@ TEST_F(ParserImplTest, ParamList_Empty) { auto e = p->expect_param_list(); ASSERT_FALSE(p->has_error()); ASSERT_FALSE(e.errored); - EXPECT_EQ(e.value.size(), 0u); + EXPECT_EQ(e.value.Length(), 0u); } TEST_F(ParserImplTest, ParamList_TrailingComma) { @@ -86,7 +86,7 @@ TEST_F(ParserImplTest, ParamList_TrailingComma) { auto e = p->expect_param_list(); ASSERT_FALSE(p->has_error()); ASSERT_FALSE(e.errored); - EXPECT_EQ(e.value.size(), 1u); + EXPECT_EQ(e.value.Length(), 1u); } TEST_F(ParserImplTest, ParamList_Attributes) { @@ -95,17 +95,17 @@ TEST_F(ParserImplTest, ParamList_Attributes) { auto e = p->expect_param_list(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); - ASSERT_EQ(e.value.size(), 2u); + ASSERT_EQ(e.value.Length(), 2u); EXPECT_EQ(e.value[0]->symbol, p->builder().Symbols().Get("coord")); ASSERT_TRUE(e.value[0]->type->Is()); EXPECT_TRUE(e.value[0]->type->As()->type->Is()); EXPECT_EQ(e.value[0]->type->As()->width, 4u); - EXPECT_TRUE(e.value[0]->is_const); + EXPECT_TRUE(e.value[0]->Is()); auto attrs_0 = e.value[0]->attributes; - ASSERT_EQ(attrs_0.size(), 1u); + ASSERT_EQ(attrs_0.Length(), 1u); EXPECT_TRUE(attrs_0[0]->Is()); - EXPECT_EQ(attrs_0[0]->As()->builtin, ast::Builtin::kPosition); + EXPECT_EQ(attrs_0[0]->As()->builtin, ast::BuiltinValue::kPosition); ASSERT_EQ(e.value[0]->source.range.begin.line, 1u); ASSERT_EQ(e.value[0]->source.range.begin.column, 20u); @@ -114,9 +114,9 @@ TEST_F(ParserImplTest, ParamList_Attributes) { EXPECT_EQ(e.value[1]->symbol, p->builder().Symbols().Get("loc1")); EXPECT_TRUE(e.value[1]->type->Is()); - EXPECT_TRUE(e.value[1]->is_const); + EXPECT_TRUE(e.value[1]->Is()); auto attrs_1 = e.value[1]->attributes; - ASSERT_EQ(attrs_1.size(), 1u); + ASSERT_EQ(attrs_1.Length(), 1u); EXPECT_TRUE(attrs_1[0]->Is()); EXPECT_EQ(attrs_1[0]->As()->value, 1u); diff --git a/src/tint/reader/wgsl/parser_impl_paren_expression_test.cc b/src/tint/reader/wgsl/parser_impl_paren_expression_test.cc new file mode 100644 index 0000000000..e6bb2236ef --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_paren_expression_test.cc @@ -0,0 +1,66 @@ +// Copyright 2020 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, ParenRhsStmt) { + auto p = parser("(a + b)"); + auto e = p->expect_paren_expression(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(e.errored); + ASSERT_NE(e.value, nullptr); + ASSERT_TRUE(e->Is()); +} + +TEST_F(ParserImplTest, ParenRhsStmt_MissingLeftParen) { + auto p = parser("true)"); + auto e = p->expect_paren_expression(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:1: expected '('"); +} + +TEST_F(ParserImplTest, ParenRhsStmt_MissingRightParen) { + auto p = parser("(true"); + auto e = p->expect_paren_expression(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:6: expected ')'"); +} + +TEST_F(ParserImplTest, ParenRhsStmt_InvalidExpression) { + auto p = parser("(if (a() {})"); + auto e = p->expect_paren_expression(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:2: unable to parse expression"); +} + +TEST_F(ParserImplTest, ParenRhsStmt_MissingExpression) { + auto p = parser("()"); + auto e = p->expect_paren_expression(); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(e.errored); + ASSERT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:2: unable to parse expression"); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc deleted file mode 100644 index dd5a978bbe..0000000000 --- a/src/tint/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2020 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/reader/wgsl/parser_impl_test_helper.h" - -namespace tint::reader::wgsl { -namespace { - -TEST_F(ParserImplTest, ParenRhsStmt) { - auto p = parser("(a + b)"); - auto e = p->expect_paren_rhs_stmt(); - ASSERT_FALSE(p->has_error()) << p->error(); - ASSERT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); -} - -TEST_F(ParserImplTest, ParenRhsStmt_MissingLeftParen) { - auto p = parser("true)"); - auto e = p->expect_paren_rhs_stmt(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:1: expected '('"); -} - -TEST_F(ParserImplTest, ParenRhsStmt_MissingRightParen) { - auto p = parser("(true"); - auto e = p->expect_paren_rhs_stmt(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:6: expected ')'"); -} - -TEST_F(ParserImplTest, ParenRhsStmt_InvalidExpression) { - auto p = parser("(if (a() {})"); - auto e = p->expect_paren_rhs_stmt(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:2: unable to parse expression"); -} - -TEST_F(ParserImplTest, ParenRhsStmt_MissingExpression) { - auto p = parser("()"); - auto e = p->expect_paren_rhs_stmt(); - ASSERT_TRUE(p->has_error()); - ASSERT_TRUE(e.errored); - ASSERT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:2: unable to parse expression"); -} - -} // namespace -} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_pipeline_stage_test.cc b/src/tint/reader/wgsl/parser_impl_pipeline_stage_test.cc index 75a1ec200a..3c730e2ab1 100644 --- a/src/tint/reader/wgsl/parser_impl_pipeline_stage_test.cc +++ b/src/tint/reader/wgsl/parser_impl_pipeline_stage_test.cc @@ -40,7 +40,7 @@ TEST_P(PipelineStageTest, Parses) { EXPECT_EQ(stage.source.range.end.line, 1u); EXPECT_EQ(stage.source.range.end.column, 1u + params.input.size()); - auto t = p->next(); + auto& t = p->next(); EXPECT_TRUE(t.IsEof()); } INSTANTIATE_TEST_SUITE_P( diff --git a/src/tint/reader/wgsl/parser_impl_primary_expression_test.cc b/src/tint/reader/wgsl/parser_impl_primary_expression_test.cc index 493ce878a1..82f64c3ca5 100644 --- a/src/tint/reader/wgsl/parser_impl_primary_expression_test.cc +++ b/src/tint/reader/wgsl/parser_impl_primary_expression_test.cc @@ -42,7 +42,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl) { EXPECT_NE(call->target.type, nullptr); - ASSERT_EQ(call->args.size(), 4u); + ASSERT_EQ(call->args.Length(), 4u); const auto& val = call->args; ASSERT_TRUE(val[0]->Is()); EXPECT_EQ(val[0]->As()->value, 1); @@ -76,7 +76,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_ZeroConstructor) { ASSERT_TRUE(e->Is()); auto* call = e->As(); - ASSERT_EQ(call->args.size(), 0u); + ASSERT_EQ(call->args.Length(), 0u); } TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidTypeDecl) { @@ -140,7 +140,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_StructConstructor_Empty) { ASSERT_NE(call->target.name, nullptr); EXPECT_EQ(call->target.name->symbol, p->builder().Symbols().Get("S")); - ASSERT_EQ(call->args.size(), 0u); + ASSERT_EQ(call->args.Length(), 0u); } TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_StructConstructor_NotEmpty) { @@ -164,7 +164,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_StructConstructor_NotEmpty) { ASSERT_NE(call->target.name, nullptr); EXPECT_EQ(call->target.name->symbol, p->builder().Symbols().Get("S")); - ASSERT_EQ(call->args.size(), 2u); + ASSERT_EQ(call->args.Length(), 2u); ASSERT_TRUE(call->args[0]->Is()); EXPECT_EQ(call->args[0]->As()->value, 1u); @@ -239,7 +239,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Cast) { auto* call = e->As(); ASSERT_TRUE(call->target.type->Is()); - ASSERT_EQ(call->args.size(), 1u); + ASSERT_EQ(call->args.Length(), 1u); ASSERT_TRUE(call->args[0]->Is()); } diff --git a/src/tint/reader/wgsl/parser_impl_relational_expression_test.cc b/src/tint/reader/wgsl/parser_impl_relational_expression_test.cc index 725761b9a4..ebd8ffd289 100644 --- a/src/tint/reader/wgsl/parser_impl_relational_expression_test.cc +++ b/src/tint/reader/wgsl/parser_impl_relational_expression_test.cc @@ -17,14 +17,19 @@ namespace tint::reader::wgsl { namespace { -TEST_F(ParserImplTest, RelationalExpression_Parses_LessThan) { +TEST_F(ParserImplTest, RelationalExpression_PostUnary_Parses_LessThan) { auto p = parser("a < true"); - auto e = p->relational_expression(); - EXPECT_TRUE(e.matched); + auto lhs = p->unary_expression(); + auto e = p->expect_relational_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 4u); + ASSERT_TRUE(e->Is()); auto* rel = e->As(); EXPECT_EQ(ast::BinaryOp::kLessThan, rel->op); @@ -37,14 +42,19 @@ TEST_F(ParserImplTest, RelationalExpression_Parses_LessThan) { ASSERT_TRUE(rel->rhs->As()->value); } -TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThan) { +TEST_F(ParserImplTest, RelationalExpression_PostUnary_Parses_GreaterThan) { auto p = parser("a > true"); - auto e = p->relational_expression(); - EXPECT_TRUE(e.matched); + auto lhs = p->unary_expression(); + auto e = p->expect_relational_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 4u); + ASSERT_TRUE(e->Is()); auto* rel = e->As(); EXPECT_EQ(ast::BinaryOp::kGreaterThan, rel->op); @@ -57,14 +67,19 @@ TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThan) { ASSERT_TRUE(rel->rhs->As()->value); } -TEST_F(ParserImplTest, RelationalExpression_Parses_LessThanEqual) { +TEST_F(ParserImplTest, RelationalExpression_PostUnary_Parses_LessThanEqual) { auto p = parser("a <= true"); - auto e = p->relational_expression(); - EXPECT_TRUE(e.matched); + auto lhs = p->unary_expression(); + auto e = p->expect_relational_expression_post_unary_expression(lhs.value); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + ASSERT_TRUE(e->Is()); auto* rel = e->As(); EXPECT_EQ(ast::BinaryOp::kLessThanEqual, rel->op); @@ -77,7 +92,101 @@ TEST_F(ParserImplTest, RelationalExpression_Parses_LessThanEqual) { ASSERT_TRUE(rel->rhs->As()->value); } -TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThanEqual) { +TEST_F(ParserImplTest, RelationalExpression_PostUnary_Parses_GreaterThanEqual) { + auto p = parser("a >= true"); + auto lhs = p->unary_expression(); + auto e = p->expect_relational_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kGreaterThanEqual, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Register("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, RelationalExpression_PostUnary_Parses_Equal) { + auto p = parser("a == true"); + auto lhs = p->unary_expression(); + auto e = p->expect_relational_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kEqual, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, RelationalExpression_PostUnary_Parses_NotEqual) { + auto p = parser("a != true"); + auto lhs = p->unary_expression(); + auto e = p->expect_relational_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kNotEqual, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, RelationalExpression_PostUnary_InvalidRHS) { + auto p = parser("true < if (a) {}"); + auto lhs = p->unary_expression(); + auto e = p->expect_relational_expression_post_unary_expression(lhs.value); + ASSERT_TRUE(p->has_error()); + EXPECT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:8: unable to parse right side of < expression"); +} + +TEST_F(ParserImplTest, RelationalExpression_PostUnary_NoMatch_ReturnsLHS) { + auto p = parser("a true"); + auto lhs = p->unary_expression(); + auto e = p->expect_relational_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + EXPECT_EQ(lhs.value, e.value); +} + +TEST_F(ParserImplTest, RelationalExpression_Matches) { auto p = parser("a >= true"); auto e = p->relational_expression(); EXPECT_TRUE(e.matched); @@ -98,30 +207,82 @@ TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThanEqual) { } TEST_F(ParserImplTest, RelationalExpression_InvalidLHS) { - auto p = parser("if (a) {} < true"); + auto p = parser("if (a) {}< 3"); auto e = p->relational_expression(); - EXPECT_FALSE(e.matched); + ASSERT_FALSE(e.matched); EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_EQ(e.value, nullptr); } TEST_F(ParserImplTest, RelationalExpression_InvalidRHS) { auto p = parser("true < if (a) {}"); auto e = p->relational_expression(); + ASSERT_FALSE(e.matched); + EXPECT_TRUE(e.errored); ASSERT_TRUE(p->has_error()); EXPECT_EQ(e.value, nullptr); EXPECT_EQ(p->error(), "1:8: unable to parse right side of < expression"); } -TEST_F(ParserImplTest, RelationalExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); +TEST_F(ParserImplTest, RelationalExpression_Parses_Equal) { + auto p = parser("a == true"); auto e = p->relational_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kEqual, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, RelationalExpression_Parses_NotEqual) { + auto p = parser("a != true"); + auto e = p->relational_expression(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kNotEqual, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, RelationalExpression_Equal_InvalidRHS) { + auto p = parser("true == if (a) {}"); + auto e = p->relational_expression(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:9: unable to parse right side of == expression"); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_reserved_keyword_test.cc b/src/tint/reader/wgsl/parser_impl_reserved_keyword_test.cc index 3226ef5e53..0ad3cc1c5f 100644 --- a/src/tint/reader/wgsl/parser_impl_reserved_keyword_test.cc +++ b/src/tint/reader/wgsl/parser_impl_reserved_keyword_test.cc @@ -21,91 +21,232 @@ using ParserImplReservedKeywordTest = ParserImplTestWithParam; TEST_P(ParserImplReservedKeywordTest, Function) { auto name = GetParam(); auto p = parser("fn " + name + "() {}"); - EXPECT_FALSE(p->Parse()); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:4: '" + name + "' is a reserved keyword"); + EXPECT_TRUE(p->Parse()); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(p->error(), + "1:4: use of deprecated language feature: '" + name + "' is a reserved keyword"); } -TEST_P(ParserImplReservedKeywordTest, ModuleLet) { +TEST_P(ParserImplReservedKeywordTest, ModuleConst) { auto name = GetParam(); - auto p = parser("let " + name + " : i32 = 1;"); - EXPECT_FALSE(p->Parse()); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:5: '" + name + "' is a reserved keyword"); + auto p = parser("const " + name + " : i32 = 1;"); + EXPECT_TRUE(p->Parse()); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(p->error(), + "1:7: use of deprecated language feature: '" + name + "' is a reserved keyword"); } TEST_P(ParserImplReservedKeywordTest, ModuleVar) { auto name = GetParam(); auto p = parser("var " + name + " : i32 = 1;"); - EXPECT_FALSE(p->Parse()); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:5: '" + name + "' is a reserved keyword"); + EXPECT_TRUE(p->Parse()); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(p->error(), + "1:5: use of deprecated language feature: '" + name + "' is a reserved keyword"); } TEST_P(ParserImplReservedKeywordTest, FunctionLet) { auto name = GetParam(); auto p = parser("fn f() { let " + name + " : i32 = 1; }"); - EXPECT_FALSE(p->Parse()); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:14: '" + name + "' is a reserved keyword"); + EXPECT_TRUE(p->Parse()); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(p->error(), + "1:14: use of deprecated language feature: '" + name + "' is a reserved keyword"); } TEST_P(ParserImplReservedKeywordTest, FunctionVar) { auto name = GetParam(); auto p = parser("fn f() { var " + name + " : i32 = 1; }"); - EXPECT_FALSE(p->Parse()); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:14: '" + name + "' is a reserved keyword"); + EXPECT_TRUE(p->Parse()); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(p->error(), + "1:14: use of deprecated language feature: '" + name + "' is a reserved keyword"); } TEST_P(ParserImplReservedKeywordTest, FunctionParam) { auto name = GetParam(); auto p = parser("fn f(" + name + " : i32) {}"); - EXPECT_FALSE(p->Parse()); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:6: '" + name + "' is a reserved keyword"); + EXPECT_TRUE(p->Parse()); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(p->error(), + "1:6: use of deprecated language feature: '" + name + "' is a reserved keyword"); } TEST_P(ParserImplReservedKeywordTest, Struct) { auto name = GetParam(); auto p = parser("struct " + name + " {};"); - EXPECT_FALSE(p->Parse()); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:8: '" + name + "' is a reserved keyword"); + EXPECT_TRUE(p->Parse()); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(p->error(), + "1:8: use of deprecated language feature: '" + name + "' is a reserved keyword"); } TEST_P(ParserImplReservedKeywordTest, StructMember) { auto name = GetParam(); auto p = parser("struct S { " + name + " : i32, };"); - EXPECT_FALSE(p->Parse()); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:12: '" + name + "' is a reserved keyword"); + EXPECT_TRUE(p->Parse()); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(p->error(), + "1:12: use of deprecated language feature: '" + name + "' is a reserved keyword"); } TEST_P(ParserImplReservedKeywordTest, Alias) { auto name = GetParam(); auto p = parser("type " + name + " = i32;"); - EXPECT_FALSE(p->Parse()); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:6: '" + name + "' is a reserved keyword"); + EXPECT_TRUE(p->Parse()); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(p->error(), + "1:6: use of deprecated language feature: '" + name + "' is a reserved keyword"); } INSTANTIATE_TEST_SUITE_P(ParserImplReservedKeywordTest, ParserImplReservedKeywordTest, - testing::Values("asm", - "bf16", - "const", + testing::Values("ComputeShader", + "DomainShader", + "GeometryShader", + "Hullshader", + "NULL", + "Self", + "abstract", + "active", + "alignas", + "alignof", + "as", + "asm", + "asm_fragment", + "async", + "attribute", + "auto", + "await", + "become", + "binding_array", + "cast", + "catch", + "class", + "co_await", + "co_return", + "co_yield", + "coherent", + "column_major", + "common", + "compile", + "compile_fragment", + "concept", + "const_cast", + "consteval", + "constexpr", + "constinit", + "crate", + "debugger", + "decltype", + "delete", + "demote", + "demote_to_helper", "do", + "dynamic_cast", "enum", - "f16", - "f64", + "explicit", + "export", + "extends", + "extern", + "external", + "filter", + "final", + "finally", + "friend", + "from", + "fxgroup", + "get", + "goto", + "groupshared", "handle", - "i8", - "i16", - "i64", - "mat", + "highp", + "impl", + "implements", + "import", + "inline", + "inout", + "instanceof", + "interface", + "invariant", + "layout", + "line", + "lineadj", + "lowp", + "macro", + "macro_rules", + "match", + "mediump", + "meta", + "mod", + "module", + "move", + "mut", + "mutable", + "namespace", + "new", + "nil", + "noexcept", + "noinline", + "nointerpolation", + "noperspective", + "null", + "nullptr", + "of", + "operator", + "package", + "packoffset", + "partition", + "pass", + "patch", + "pixelfragment", + "point", + "precise", + "precision", "premerge", + "priv", + "protected", + "pub", + "public", + "readonly", + "ref", "regardless", + "register", + "reinterpret_cast", + "requires", + "resource", + "restrict", + "self", + "set", + "shared", + "signed", + "sizeof", + "smooth", + "snorm", + "static", + "static_cast", + "std", + "subroutine", + "super", + "target", + "template", + "this", + "thread_local", + "throw", + "trait", + "try", "typedef", - "u8", - "u16", - "u64", + "typeid", + "typename", + "typeof", + "union", "unless", + "unorm", + "unsafe", + "unsized", + "use", "using", - "vec", - "void", - "while")); + "varying", + "virtual", + "volatile", + "wgsl", + "where", + "with", + "writeonly", + "yield" + + )); } // namespace } // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_sampled_texture_test.cc b/src/tint/reader/wgsl/parser_impl_sampled_texture_test.cc index cf9f0898a8..6aa1aab097 100644 --- a/src/tint/reader/wgsl/parser_impl_sampled_texture_test.cc +++ b/src/tint/reader/wgsl/parser_impl_sampled_texture_test.cc @@ -19,7 +19,7 @@ namespace { TEST_F(ParserImplTest, SampledTextureType_Invalid) { auto p = parser("1234"); - auto t = p->sampled_texture(); + auto t = p->sampled_texture_type(); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); EXPECT_FALSE(p->has_error()); @@ -27,7 +27,7 @@ TEST_F(ParserImplTest, SampledTextureType_Invalid) { TEST_F(ParserImplTest, SampledTextureType_1d) { auto p = parser("texture_1d"); - auto t = p->sampled_texture(); + auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::k1d); @@ -36,7 +36,7 @@ TEST_F(ParserImplTest, SampledTextureType_1d) { TEST_F(ParserImplTest, SampledTextureType_2d) { auto p = parser("texture_2d"); - auto t = p->sampled_texture(); + auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::k2d); @@ -45,7 +45,7 @@ TEST_F(ParserImplTest, SampledTextureType_2d) { TEST_F(ParserImplTest, SampledTextureType_2dArray) { auto p = parser("texture_2d_array"); - auto t = p->sampled_texture(); + auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::k2dArray); @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, SampledTextureType_2dArray) { TEST_F(ParserImplTest, SampledTextureType_3d) { auto p = parser("texture_3d"); - auto t = p->sampled_texture(); + auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::k3d); @@ -63,7 +63,7 @@ TEST_F(ParserImplTest, SampledTextureType_3d) { TEST_F(ParserImplTest, SampledTextureType_Cube) { auto p = parser("texture_cube"); - auto t = p->sampled_texture(); + auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::kCube); @@ -72,7 +72,7 @@ TEST_F(ParserImplTest, SampledTextureType_Cube) { TEST_F(ParserImplTest, SampledTextureType_kCubeArray) { auto p = parser("texture_cube_array"); - auto t = p->sampled_texture(); + auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::kCubeArray); diff --git a/src/tint/reader/wgsl/parser_impl_sampler_test.cc b/src/tint/reader/wgsl/parser_impl_sampler_test.cc index 7f1e5645b8..bd3c2d39aa 100644 --- a/src/tint/reader/wgsl/parser_impl_sampler_test.cc +++ b/src/tint/reader/wgsl/parser_impl_sampler_test.cc @@ -19,7 +19,7 @@ namespace { TEST_F(ParserImplTest, SamplerType_Invalid) { auto p = parser("1234"); - auto t = p->sampler(); + auto t = p->sampler_type(); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, nullptr); @@ -28,7 +28,7 @@ TEST_F(ParserImplTest, SamplerType_Invalid) { TEST_F(ParserImplTest, SamplerType_Sampler) { auto p = parser("sampler"); - auto t = p->sampler(); + auto t = p->sampler_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); ASSERT_NE(t.value, nullptr); @@ -40,7 +40,7 @@ TEST_F(ParserImplTest, SamplerType_Sampler) { TEST_F(ParserImplTest, SamplerType_ComparisonSampler) { auto p = parser("sampler_comparison"); - auto t = p->sampler(); + auto t = p->sampler_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); ASSERT_NE(t.value, nullptr); diff --git a/src/tint/reader/wgsl/parser_impl_shift_expression_test.cc b/src/tint/reader/wgsl/parser_impl_shift_expression_test.cc index fd612b5f4b..016f86f95d 100644 --- a/src/tint/reader/wgsl/parser_impl_shift_expression_test.cc +++ b/src/tint/reader/wgsl/parser_impl_shift_expression_test.cc @@ -17,7 +17,137 @@ namespace tint::reader::wgsl { namespace { -TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftLeft) { +TEST_F(ParserImplTest, ShiftExpression_PostUnary_Parses_ShiftLeft) { + auto p = parser("a << true"); + auto lhs = p->unary_expression(); + auto e = p->expect_shift_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kShiftLeft, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, ShiftExpression_PostUnary_Parses_ShiftRight) { + auto p = parser("a >> true"); + auto lhs = p->unary_expression(); + auto e = p->expect_shift_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + EXPECT_EQ(e->source.range.begin.line, 1u); + EXPECT_EQ(e->source.range.begin.column, 3u); + EXPECT_EQ(e->source.range.end.line, 1u); + EXPECT_EQ(e->source.range.end.column, 5u); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kShiftRight, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ASSERT_TRUE(rel->rhs->As()->value); +} + +TEST_F(ParserImplTest, ShiftExpression_PostUnary_Parses_Additive) { + auto p = parser("a + b"); + auto lhs = p->unary_expression(); + auto e = p->expect_shift_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kAdd, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, ShiftExpression_PostUnary_Parses_Multiplicative) { + auto p = parser("a * b"); + auto lhs = p->unary_expression(); + auto e = p->expect_shift_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + ASSERT_TRUE(e->Is()); + auto* rel = e->As(); + EXPECT_EQ(ast::BinaryOp::kMultiply, rel->op); + + ASSERT_TRUE(rel->lhs->Is()); + auto* ident = rel->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(rel->rhs->Is()); + ident = rel->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("b")); +} + +TEST_F(ParserImplTest, ShiftExpression_PostUnary_InvalidSpaceLeft) { + auto p = parser("a < < true"); + auto lhs = p->unary_expression(); + auto e = p->expect_shift_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + ASSERT_NE(e.value, nullptr); + EXPECT_FALSE(e.value->Is()); +} + +TEST_F(ParserImplTest, ShiftExpression_PostUnary_InvalidSpaceRight) { + auto p = parser("a > > true"); + auto lhs = p->unary_expression(); + auto e = p->expect_shift_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + ASSERT_NE(e.value, nullptr); + EXPECT_FALSE(e.value->Is()); +} + +TEST_F(ParserImplTest, ShiftExpression_PostUnary_InvalidRHS) { + auto p = parser("a << if (a) {}"); + auto lhs = p->unary_expression(); + auto e = p->expect_shift_expression_post_unary_expression(lhs.value); + EXPECT_TRUE(e.errored); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:6: unable to parse right side of << expression"); +} + +TEST_F(ParserImplTest, ShiftExpression_PostUnary_NoOr_ReturnsLHS) { + auto p = parser("a true"); + auto lhs = p->unary_expression(); + auto e = p->expect_shift_expression_post_unary_expression(lhs.value); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + ASSERT_EQ(lhs.value, e.value); +} + +TEST_F(ParserImplTest, ShiftExpression_Parses) { auto p = parser("a << true"); auto e = p->shift_expression(); EXPECT_TRUE(e.matched); @@ -37,71 +167,24 @@ TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftLeft) { ASSERT_TRUE(rel->rhs->As()->value); } -TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftRight) { - auto p = parser("a >> true"); - auto e = p->shift_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - - ASSERT_TRUE(e->Is()); - auto* rel = e->As(); - EXPECT_EQ(ast::BinaryOp::kShiftRight, rel->op); - - ASSERT_TRUE(rel->lhs->Is()); - auto* ident = rel->lhs->As(); - EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - - ASSERT_TRUE(rel->rhs->Is()); - ASSERT_TRUE(rel->rhs->As()->value); -} - -TEST_F(ParserImplTest, ShiftExpression_InvalidSpaceLeft) { - auto p = parser("a < < true"); - auto e = p->shift_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); - EXPECT_FALSE(e.value->Is()); -} - -TEST_F(ParserImplTest, ShiftExpression_InvalidSpaceRight) { - auto p = parser("a > > true"); - auto e = p->shift_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - ASSERT_NE(e.value, nullptr); - EXPECT_FALSE(e.value->Is()); -} - -TEST_F(ParserImplTest, ShiftExpression_InvalidLHS) { - auto p = parser("if (a) {} << true"); +TEST_F(ParserImplTest, ShiftExpression_Invalid_Unary) { + auto p = parser("if >> true"); auto e = p->shift_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); - EXPECT_EQ(e.value, nullptr); + ASSERT_EQ(e.value, nullptr); } -TEST_F(ParserImplTest, ShiftExpression_InvalidRHS) { - auto p = parser("true << if (a) {}"); +TEST_F(ParserImplTest, ShiftExpression_Inavlid_ShiftExpressionPostUnary) { + auto p = parser("a * if (a) {}"); auto e = p->shift_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:9: unable to parse right side of << expression"); -} + ASSERT_EQ(e.value, nullptr); -TEST_F(ParserImplTest, ShiftExpression_NoOr_ReturnsLHS) { - auto p = parser("a true"); - auto e = p->shift_expression(); - EXPECT_TRUE(e.matched); - EXPECT_FALSE(e.errored); - EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); + EXPECT_EQ(p->error(), "1:5: unable to parse right side of * expression"); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_singular_expression_test.cc b/src/tint/reader/wgsl/parser_impl_singular_expression_test.cc index 4ab185bb6e..a08b45a97e 100644 --- a/src/tint/reader/wgsl/parser_impl_singular_expression_test.cc +++ b/src/tint/reader/wgsl/parser_impl_singular_expression_test.cc @@ -99,7 +99,7 @@ TEST_F(ParserImplTest, SingularExpression_Call_Empty) { EXPECT_EQ(c->target.name->symbol, p->builder().Symbols().Get("a")); - EXPECT_EQ(c->args.size(), 0u); + EXPECT_EQ(c->args.Length(), 0u); } TEST_F(ParserImplTest, SingularExpression_Call_WithArgs) { @@ -115,7 +115,7 @@ TEST_F(ParserImplTest, SingularExpression_Call_WithArgs) { EXPECT_EQ(c->target.name->symbol, p->builder().Symbols().Get("test")); - EXPECT_EQ(c->args.size(), 3u); + EXPECT_EQ(c->args.Length(), 3u); EXPECT_TRUE(c->args[0]->Is()); EXPECT_TRUE(c->args[1]->Is()); EXPECT_TRUE(c->args[2]->Is()); @@ -130,7 +130,7 @@ TEST_F(ParserImplTest, SingularExpression_Call_TrailingComma) { ASSERT_TRUE(e->Is()); auto* c = e->As(); - EXPECT_EQ(c->args.size(), 1u); + EXPECT_EQ(c->args.Length(), 1u); } TEST_F(ParserImplTest, SingularExpression_Call_InvalidArg) { diff --git a/src/tint/reader/wgsl/parser_impl_statement_test.cc b/src/tint/reader/wgsl/parser_impl_statement_test.cc index 235c748548..7bb51d3d37 100644 --- a/src/tint/reader/wgsl/parser_impl_statement_test.cc +++ b/src/tint/reader/wgsl/parser_impl_statement_test.cc @@ -114,7 +114,7 @@ TEST_F(ParserImplTest, Statement_Variable_Invalid) { EXPECT_TRUE(e.errored); EXPECT_FALSE(e.matched); EXPECT_EQ(e.value, nullptr); - EXPECT_EQ(p->error(), "1:14: missing constructor for variable declaration"); + EXPECT_EQ(p->error(), "1:14: missing initializer for 'var' declaration"); } TEST_F(ParserImplTest, Statement_Variable_MissingSemicolon) { @@ -272,5 +272,47 @@ TEST_F(ParserImplTest, Statement_Body_Invalid) { EXPECT_EQ(p->error(), "1:3: expected '}'"); } +TEST_F(ParserImplTest, Statement_StaticAssert_WithParen) { + auto p = parser("static_assert(true);"); + auto e = p->statement(); + ASSERT_FALSE(p->has_error()) << p->error(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + + auto* sa = As(e.value); + ASSERT_NE(sa, nullptr); + EXPECT_EQ(sa->source.range.begin.line, 1u); + EXPECT_EQ(sa->source.range.begin.column, 1u); + EXPECT_EQ(sa->source.range.end.line, 1u); + EXPECT_EQ(sa->source.range.end.column, 20u); + + EXPECT_TRUE(sa->condition->Is()); + EXPECT_EQ(sa->condition->source.range.begin.line, 1u); + EXPECT_EQ(sa->condition->source.range.begin.column, 15u); + EXPECT_EQ(sa->condition->source.range.end.line, 1u); + EXPECT_EQ(sa->condition->source.range.end.column, 19u); +} + +TEST_F(ParserImplTest, Statement_StaticAssert_WithoutParen) { + auto p = parser("static_assert true;"); + auto e = p->statement(); + ASSERT_FALSE(p->has_error()) << p->error(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + + auto* sa = As(e.value); + ASSERT_NE(sa, nullptr); + EXPECT_EQ(sa->source.range.begin.line, 1u); + EXPECT_EQ(sa->source.range.begin.column, 1u); + EXPECT_EQ(sa->source.range.end.line, 1u); + EXPECT_EQ(sa->source.range.end.column, 20u); + + EXPECT_TRUE(sa->condition->Is()); + EXPECT_EQ(sa->condition->source.range.begin.line, 1u); + EXPECT_EQ(sa->condition->source.range.begin.column, 16u); + EXPECT_EQ(sa->condition->source.range.end.line, 1u); + EXPECT_EQ(sa->condition->source.range.end.column, 20u); +} + } // namespace } // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_statements_test.cc b/src/tint/reader/wgsl/parser_impl_statements_test.cc index b96a28a4a1..c631f7ae21 100644 --- a/src/tint/reader/wgsl/parser_impl_statements_test.cc +++ b/src/tint/reader/wgsl/parser_impl_statements_test.cc @@ -23,7 +23,7 @@ TEST_F(ParserImplTest, Statements) { auto e = p->expect_statements(); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_EQ(e->size(), 2u); + ASSERT_EQ(e->Length(), 2u); EXPECT_TRUE(e.value[0]->Is()); EXPECT_TRUE(e.value[1]->Is()); } @@ -33,7 +33,7 @@ TEST_F(ParserImplTest, Statements_Empty) { auto e = p->expect_statements(); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); - ASSERT_EQ(e->size(), 0u); + ASSERT_EQ(e->Length(), 0u); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_storage_class_test.cc b/src/tint/reader/wgsl/parser_impl_storage_class_test.cc index 4abbe76692..c6ef7eb470 100644 --- a/src/tint/reader/wgsl/parser_impl_storage_class_test.cc +++ b/src/tint/reader/wgsl/parser_impl_storage_class_test.cc @@ -26,40 +26,35 @@ inline std::ostream& operator<<(std::ostream& out, StorageClassData data) { return out; } -class StorageClassTest : public ParserImplTestWithParam {}; +class ParserStorageClassTest : public ParserImplTestWithParam {}; -TEST_P(StorageClassTest, Parses) { +TEST_P(ParserStorageClassTest, Parses) { auto params = GetParam(); auto p = parser(params.input); - auto sc = p->expect_storage_class("test"); + auto sc = p->expect_address_space("test"); EXPECT_FALSE(sc.errored); EXPECT_FALSE(p->has_error()); EXPECT_EQ(sc.value, params.result); - auto t = p->next(); + auto& t = p->next(); EXPECT_TRUE(t.IsEof()); } INSTANTIATE_TEST_SUITE_P( ParserImplTest, - StorageClassTest, + ParserStorageClassTest, testing::Values(StorageClassData{"uniform", ast::StorageClass::kUniform}, StorageClassData{"workgroup", ast::StorageClass::kWorkgroup}, StorageClassData{"storage", ast::StorageClass::kStorage}, - StorageClassData{"storage_buffer", ast::StorageClass::kStorage}, StorageClassData{"private", ast::StorageClass::kPrivate}, StorageClassData{"function", ast::StorageClass::kFunction})); TEST_F(ParserImplTest, StorageClass_NoMatch) { auto p = parser("not-a-storage-class"); - auto sc = p->expect_storage_class("test"); + auto sc = p->expect_address_space("test"); EXPECT_EQ(sc.errored, true); EXPECT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:1: invalid storage class for test"); - - auto t = p->next(); - EXPECT_TRUE(t.IsIdentifier()); - EXPECT_EQ(t.to_str(), "not"); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_storage_texture_test.cc b/src/tint/reader/wgsl/parser_impl_storage_texture_test.cc index 6297a1ef27..528f3a4e7c 100644 --- a/src/tint/reader/wgsl/parser_impl_storage_texture_test.cc +++ b/src/tint/reader/wgsl/parser_impl_storage_texture_test.cc @@ -19,7 +19,7 @@ namespace { TEST_F(ParserImplTest, StorageTextureType_Invalid) { auto p = parser("abc"); - auto t = p->storage_texture(); + auto t = p->storage_texture_type(); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); EXPECT_FALSE(p->has_error()); @@ -27,7 +27,7 @@ TEST_F(ParserImplTest, StorageTextureType_Invalid) { TEST_F(ParserImplTest, StorageTextureType_1d) { auto p = parser("texture_storage_1d"); - auto t = p->storage_texture(); + auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::k1d); @@ -36,7 +36,7 @@ TEST_F(ParserImplTest, StorageTextureType_1d) { TEST_F(ParserImplTest, StorageTextureType_2d) { auto p = parser("texture_storage_2d"); - auto t = p->storage_texture(); + auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::k2d); @@ -45,7 +45,7 @@ TEST_F(ParserImplTest, StorageTextureType_2d) { TEST_F(ParserImplTest, StorageTextureType_2dArray) { auto p = parser("texture_storage_2d_array"); - auto t = p->storage_texture(); + auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::k2dArray); @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, StorageTextureType_2dArray) { TEST_F(ParserImplTest, StorageTextureType_3d) { auto p = parser("texture_storage_3d"); - auto t = p->storage_texture(); + auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::TextureDimension::k3d); diff --git a/src/tint/reader/wgsl/parser_impl_struct_attribute_decl_test.cc b/src/tint/reader/wgsl/parser_impl_struct_attribute_decl_test.cc index a22abee1b1..e015033154 100644 --- a/src/tint/reader/wgsl/parser_impl_struct_attribute_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_struct_attribute_decl_test.cc @@ -24,7 +24,7 @@ TEST_F(ParserImplTest, AttributeDecl_Parses) { EXPECT_FALSE(p->has_error()); EXPECT_FALSE(attrs.errored); EXPECT_TRUE(attrs.matched); - ASSERT_EQ(attrs.value.size(), 1u); + ASSERT_EQ(attrs.value.Length(), 1u); auto* invariant = attrs.value[0]->As(); EXPECT_TRUE(invariant->Is()); } @@ -35,7 +35,7 @@ TEST_F(ParserImplTest, AttributeDecl_MissingParenLeft) { EXPECT_TRUE(p->has_error()); EXPECT_TRUE(attrs.errored); EXPECT_FALSE(attrs.matched); - EXPECT_TRUE(attrs.value.empty()); + EXPECT_TRUE(attrs.value.IsEmpty()); EXPECT_EQ(p->error(), "1:11: expected '(' for location attribute"); } @@ -45,7 +45,7 @@ TEST_F(ParserImplTest, AttributeDecl_MissingValue) { EXPECT_TRUE(p->has_error()); EXPECT_TRUE(attrs.errored); EXPECT_FALSE(attrs.matched); - EXPECT_TRUE(attrs.value.empty()); + EXPECT_TRUE(attrs.value.IsEmpty()); EXPECT_EQ(p->error(), "1:11: expected signed integer literal for location attribute"); } @@ -55,7 +55,7 @@ TEST_F(ParserImplTest, AttributeDecl_MissingParenRight) { EXPECT_TRUE(p->has_error()); EXPECT_TRUE(attrs.errored); EXPECT_FALSE(attrs.matched); - EXPECT_TRUE(attrs.value.empty()); + EXPECT_TRUE(attrs.value.IsEmpty()); EXPECT_EQ(p->error(), "1:12: expected ')' for location attribute"); } @@ -65,7 +65,7 @@ TEST_F(ParserImplTest, AttributeDecl_Invalidattribute) { EXPECT_TRUE(p->has_error()); EXPECT_TRUE(attrs.errored); EXPECT_FALSE(attrs.matched); - EXPECT_TRUE(attrs.value.empty()); + EXPECT_TRUE(attrs.value.IsEmpty()); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc b/src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc index b02fb5a177..3499b5cb00 100644 --- a/src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc @@ -25,12 +25,12 @@ TEST_F(ParserImplTest, StructBodyDecl_Parses) { auto m = p->expect_struct_body_decl(); ASSERT_FALSE(p->has_error()); ASSERT_FALSE(m.errored); - ASSERT_EQ(m.value.size(), 1u); + ASSERT_EQ(m.value.Length(), 1u); const auto* mem = m.value[0]; EXPECT_EQ(mem->symbol, builder.Symbols().Get("a")); EXPECT_TRUE(mem->type->Is()); - EXPECT_EQ(mem->attributes.size(), 0u); + EXPECT_EQ(mem->attributes.Length(), 0u); } TEST_F(ParserImplTest, StructBodyDecl_Parses_TrailingComma) { @@ -41,12 +41,12 @@ TEST_F(ParserImplTest, StructBodyDecl_Parses_TrailingComma) { auto m = p->expect_struct_body_decl(); ASSERT_FALSE(p->has_error()); ASSERT_FALSE(m.errored); - ASSERT_EQ(m.value.size(), 1u); + ASSERT_EQ(m.value.Length(), 1u); const auto* mem = m.value[0]; EXPECT_EQ(mem->symbol, builder.Symbols().Get("a")); EXPECT_TRUE(mem->type->Is()); - EXPECT_EQ(mem->attributes.size(), 0u); + EXPECT_EQ(mem->attributes.Length(), 0u); } TEST_F(ParserImplTest, StructBodyDecl_ParsesEmpty) { @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, StructBodyDecl_ParsesEmpty) { auto m = p->expect_struct_body_decl(); ASSERT_FALSE(p->has_error()); ASSERT_FALSE(m.errored); - ASSERT_EQ(m.value.size(), 0u); + ASSERT_EQ(m.value.Length(), 0u); } TEST_F(ParserImplTest, StructBodyDecl_InvalidAlign) { diff --git a/src/tint/reader/wgsl/parser_impl_struct_decl_test.cc b/src/tint/reader/wgsl/parser_impl_struct_decl_test.cc index 106ffd581b..dbb9ca6ab5 100644 --- a/src/tint/reader/wgsl/parser_impl_struct_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_struct_decl_test.cc @@ -30,7 +30,7 @@ struct S { EXPECT_TRUE(s.matched); ASSERT_NE(s.value, nullptr); ASSERT_EQ(s->name, p->builder().Symbols().Register("S")); - ASSERT_EQ(s->members.size(), 2u); + ASSERT_EQ(s->members.Length(), 2u); EXPECT_EQ(s->members[0]->symbol, p->builder().Symbols().Register("a")); EXPECT_EQ(s->members[1]->symbol, p->builder().Symbols().Register("b")); } @@ -64,7 +64,7 @@ struct $struct { EXPECT_TRUE(s.matched); ASSERT_NE(s.value, nullptr); ASSERT_EQ(s->name, p->builder().Symbols().Register(struct_ident)); - ASSERT_EQ(s->members.size(), 2u); + ASSERT_EQ(s->members.Length(), 2u); EXPECT_EQ(s->members[0]->symbol, p->builder().Symbols().Register(member_a_ident)); EXPECT_EQ(s->members[1]->symbol, p->builder().Symbols().Register(member_b_ident)); } @@ -77,7 +77,7 @@ TEST_F(ParserImplTest, StructDecl_EmptyMembers) { EXPECT_FALSE(s.errored); EXPECT_TRUE(s.matched); ASSERT_NE(s.value, nullptr); - ASSERT_EQ(s->members.size(), 0u); + ASSERT_EQ(s->members.Length(), 0u); } TEST_F(ParserImplTest, StructDecl_MissingIdent) { @@ -104,23 +104,5 @@ TEST_F(ParserImplTest, StructDecl_MissingBracketLeft) { EXPECT_EQ(p->error(), "1:10: expected '{' for struct declaration"); } -// TODO(crbug.com/tint/1475): Remove this. -TEST_F(ParserImplTest, DEPRECATED_StructDecl_Parses_WithSemicolons) { - auto p = parser(R"( -struct S { - a : i32; - b : f32; -})"); - auto s = p->struct_decl(); - EXPECT_FALSE(p->has_error()); - EXPECT_FALSE(s.errored); - EXPECT_TRUE(s.matched); - ASSERT_NE(s.value, nullptr); - ASSERT_EQ(s->name, p->builder().Symbols().Register("S")); - ASSERT_EQ(s->members.size(), 2u); - EXPECT_EQ(s->members[0]->symbol, p->builder().Symbols().Register("a")); - EXPECT_EQ(s->members[1]->symbol, p->builder().Symbols().Register("b")); -} - } // namespace } // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_struct_member_attribute_decl_test.cc b/src/tint/reader/wgsl/parser_impl_struct_member_attribute_decl_test.cc index 2695074c6c..09d5274fe1 100644 --- a/src/tint/reader/wgsl/parser_impl_struct_member_attribute_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_struct_member_attribute_decl_test.cc @@ -23,7 +23,7 @@ TEST_F(ParserImplTest, AttributeDecl_EmptyStr) { EXPECT_FALSE(p->has_error()); EXPECT_FALSE(attrs.errored); EXPECT_FALSE(attrs.matched); - EXPECT_EQ(attrs.value.size(), 0u); + EXPECT_EQ(attrs.value.Length(), 0u); } TEST_F(ParserImplTest, AttributeDecl_Single) { @@ -32,7 +32,7 @@ TEST_F(ParserImplTest, AttributeDecl_Single) { EXPECT_FALSE(p->has_error()); EXPECT_FALSE(attrs.errored); EXPECT_TRUE(attrs.matched); - ASSERT_EQ(attrs.value.size(), 1u); + ASSERT_EQ(attrs.value.Length(), 1u); auto* attr = attrs.value[0]->As(); ASSERT_NE(attr, nullptr); EXPECT_TRUE(attr->Is()); diff --git a/src/tint/reader/wgsl/parser_impl_struct_member_attribute_test.cc b/src/tint/reader/wgsl/parser_impl_struct_member_attribute_test.cc index d185f3736a..4fb95280d1 100644 --- a/src/tint/reader/wgsl/parser_impl_struct_member_attribute_test.cc +++ b/src/tint/reader/wgsl/parser_impl_struct_member_attribute_test.cc @@ -33,6 +33,22 @@ TEST_F(ParserImplTest, Attribute_Size) { EXPECT_EQ(o->size, 4u); } +TEST_F(ParserImplTest, Attribute_Size_TrailingComma) { + auto p = parser("size(4,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr); + ASSERT_FALSE(p->has_error()); + + auto* member_attr = attr.value->As(); + ASSERT_NE(member_attr, nullptr); + ASSERT_TRUE(member_attr->Is()); + + auto* o = member_attr->As(); + EXPECT_EQ(o->size, 4u); +} + TEST_F(ParserImplTest, Attribute_Size_MissingLeftParen) { auto p = parser("size 4)"); auto attr = p->attribute(); @@ -86,7 +102,30 @@ TEST_F(ParserImplTest, Attribute_Align) { ASSERT_TRUE(member_attr->Is()); auto* o = member_attr->As(); - EXPECT_EQ(o->align, 4u); + ASSERT_TRUE(o->align->Is()); + EXPECT_EQ(o->align->As()->value, 4); + EXPECT_EQ(o->align->As()->suffix, + ast::IntLiteralExpression::Suffix::kNone); +} + +TEST_F(ParserImplTest, Attribute_Align_TrailingComma) { + auto p = parser("align(4,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr); + ASSERT_FALSE(p->has_error()); + + auto* member_attr = attr.value->As(); + ASSERT_NE(member_attr, nullptr); + ASSERT_TRUE(member_attr->Is()); + + auto* o = member_attr->As(); + ASSERT_TRUE(o->align->Is()); + + auto* expr = o->align->As(); + EXPECT_EQ(expr->value, 4); + EXPECT_EQ(expr->suffix, ast::IntLiteralExpression::Suffix::kNone); } TEST_F(ParserImplTest, Attribute_Align_MissingLeftParen) { diff --git a/src/tint/reader/wgsl/parser_impl_struct_member_test.cc b/src/tint/reader/wgsl/parser_impl_struct_member_test.cc index 3e8b60e715..c64f7728dd 100644 --- a/src/tint/reader/wgsl/parser_impl_struct_member_test.cc +++ b/src/tint/reader/wgsl/parser_impl_struct_member_test.cc @@ -29,7 +29,7 @@ TEST_F(ParserImplTest, StructMember_Parses) { EXPECT_EQ(m->symbol, builder.Symbols().Get("a")); EXPECT_TRUE(m->type->Is()); - EXPECT_EQ(m->attributes.size(), 0u); + EXPECT_EQ(m->attributes.Length(), 0u); EXPECT_EQ(m->source.range, (Source::Range{{1u, 1u}, {1u, 2u}})); EXPECT_EQ(m->type->source.range, (Source::Range{{1u, 5u}, {1u, 8u}})); @@ -47,9 +47,15 @@ TEST_F(ParserImplTest, StructMember_ParsesWithAlignAttribute) { EXPECT_EQ(m->symbol, builder.Symbols().Get("a")); EXPECT_TRUE(m->type->Is()); - EXPECT_EQ(m->attributes.size(), 1u); + EXPECT_EQ(m->attributes.Length(), 1u); EXPECT_TRUE(m->attributes[0]->Is()); - EXPECT_EQ(m->attributes[0]->As()->align, 2u); + + auto* attr = m->attributes[0]->As(); + ASSERT_TRUE(attr->align->Is()); + + auto* expr = attr->align->As(); + EXPECT_EQ(expr->value, 2); + EXPECT_EQ(expr->suffix, ast::IntLiteralExpression::Suffix::kNone); EXPECT_EQ(m->source.range, (Source::Range{{1u, 11u}, {1u, 12u}})); EXPECT_EQ(m->type->source.range, (Source::Range{{1u, 15u}, {1u, 18u}})); @@ -67,7 +73,7 @@ TEST_F(ParserImplTest, StructMember_ParsesWithSizeAttribute) { EXPECT_EQ(m->symbol, builder.Symbols().Get("a")); EXPECT_TRUE(m->type->Is()); - EXPECT_EQ(m->attributes.size(), 1u); + EXPECT_EQ(m->attributes.Length(), 1u); EXPECT_TRUE(m->attributes[0]->Is()); EXPECT_EQ(m->attributes[0]->As()->size, 2u); @@ -88,11 +94,17 @@ TEST_F(ParserImplTest, StructMember_ParsesWithMultipleattributes) { EXPECT_EQ(m->symbol, builder.Symbols().Get("a")); EXPECT_TRUE(m->type->Is()); - EXPECT_EQ(m->attributes.size(), 2u); - EXPECT_TRUE(m->attributes[0]->Is()); + EXPECT_EQ(m->attributes.Length(), 2u); + ASSERT_TRUE(m->attributes[0]->Is()); EXPECT_EQ(m->attributes[0]->As()->size, 2u); - EXPECT_TRUE(m->attributes[1]->Is()); - EXPECT_EQ(m->attributes[1]->As()->align, 4u); + + ASSERT_TRUE(m->attributes[1]->Is()); + auto* attr = m->attributes[1]->As(); + + ASSERT_TRUE(attr->align->Is()); + auto* expr = attr->align->As(); + EXPECT_EQ(expr->value, 4); + EXPECT_EQ(expr->suffix, ast::IntLiteralExpression::Suffix::kNone); EXPECT_EQ(m->source.range, (Source::Range{{2u, 11u}, {2u, 12u}})); EXPECT_EQ(m->type->source.range, (Source::Range{{2u, 15u}, {2u, 18u}})); diff --git a/src/tint/reader/wgsl/parser_impl_switch_body_test.cc b/src/tint/reader/wgsl/parser_impl_switch_body_test.cc index 0f7384de83..076b1c3f1a 100644 --- a/src/tint/reader/wgsl/parser_impl_switch_body_test.cc +++ b/src/tint/reader/wgsl/parser_impl_switch_body_test.cc @@ -27,10 +27,10 @@ TEST_F(ParserImplTest, SwitchBody_Case) { ASSERT_TRUE(e->Is()); EXPECT_FALSE(e->IsDefault()); auto* stmt = e->As(); - ASSERT_EQ(stmt->selectors.size(), 1u); + ASSERT_EQ(stmt->selectors.Length(), 1u); EXPECT_EQ(stmt->selectors[0]->value, 1); EXPECT_EQ(stmt->selectors[0]->suffix, ast::IntLiteralExpression::Suffix::kNone); - ASSERT_EQ(e->body->statements.size(), 1u); + ASSERT_EQ(e->body->statements.Length(), 1u); EXPECT_TRUE(e->body->statements[0]->Is()); } @@ -44,10 +44,10 @@ TEST_F(ParserImplTest, SwitchBody_Case_WithColon) { ASSERT_TRUE(e->Is()); EXPECT_FALSE(e->IsDefault()); auto* stmt = e->As(); - ASSERT_EQ(stmt->selectors.size(), 1u); + ASSERT_EQ(stmt->selectors.Length(), 1u); EXPECT_EQ(stmt->selectors[0]->value, 1); EXPECT_EQ(stmt->selectors[0]->suffix, ast::IntLiteralExpression::Suffix::kNone); - ASSERT_EQ(e->body->statements.size(), 1u); + ASSERT_EQ(e->body->statements.Length(), 1u); EXPECT_TRUE(e->body->statements[0]->Is()); } @@ -61,7 +61,7 @@ TEST_F(ParserImplTest, SwitchBody_Case_TrailingComma) { ASSERT_TRUE(e->Is()); EXPECT_FALSE(e->IsDefault()); auto* stmt = e->As(); - ASSERT_EQ(stmt->selectors.size(), 2u); + ASSERT_EQ(stmt->selectors.Length(), 2u); EXPECT_EQ(stmt->selectors[0]->value, 1); EXPECT_EQ(stmt->selectors[0]->suffix, ast::IntLiteralExpression::Suffix::kNone); EXPECT_EQ(stmt->selectors[1]->value, 2); @@ -77,7 +77,7 @@ TEST_F(ParserImplTest, SwitchBody_Case_TrailingComma_WithColon) { ASSERT_TRUE(e->Is()); EXPECT_FALSE(e->IsDefault()); auto* stmt = e->As(); - ASSERT_EQ(stmt->selectors.size(), 2u); + ASSERT_EQ(stmt->selectors.Length(), 2u); EXPECT_EQ(stmt->selectors[0]->value, 1); EXPECT_EQ(stmt->selectors[0]->suffix, ast::IntLiteralExpression::Suffix::kNone); EXPECT_EQ(stmt->selectors[1]->value, 2); @@ -162,8 +162,8 @@ TEST_F(ParserImplTest, SwitchBody_Case_MultipleSelectors) { ASSERT_NE(e.value, nullptr); ASSERT_TRUE(e->Is()); EXPECT_FALSE(e->IsDefault()); - ASSERT_EQ(e->body->statements.size(), 0u); - ASSERT_EQ(e->selectors.size(), 2u); + ASSERT_EQ(e->body->statements.Length(), 0u); + ASSERT_EQ(e->selectors.Length(), 2u); ASSERT_EQ(e->selectors[0]->value, 1); EXPECT_EQ(e->selectors[0]->suffix, ast::IntLiteralExpression::Suffix::kNone); ASSERT_EQ(e->selectors[1]->value, 2); @@ -179,8 +179,8 @@ TEST_F(ParserImplTest, SwitchBody_Case_MultipleSelectors_WithColon) { ASSERT_NE(e.value, nullptr); ASSERT_TRUE(e->Is()); EXPECT_FALSE(e->IsDefault()); - ASSERT_EQ(e->body->statements.size(), 0u); - ASSERT_EQ(e->selectors.size(), 2u); + ASSERT_EQ(e->body->statements.Length(), 0u); + ASSERT_EQ(e->selectors.Length(), 2u); ASSERT_EQ(e->selectors[0]->value, 1); EXPECT_EQ(e->selectors[0]->suffix, ast::IntLiteralExpression::Suffix::kNone); ASSERT_EQ(e->selectors[1]->value, 2); @@ -216,7 +216,7 @@ TEST_F(ParserImplTest, SwitchBody_Default) { ASSERT_NE(e.value, nullptr); ASSERT_TRUE(e->Is()); EXPECT_TRUE(e->IsDefault()); - ASSERT_EQ(e->body->statements.size(), 1u); + ASSERT_EQ(e->body->statements.Length(), 1u); EXPECT_TRUE(e->body->statements[0]->Is()); } @@ -229,7 +229,7 @@ TEST_F(ParserImplTest, SwitchBody_Default_WithColon) { ASSERT_NE(e.value, nullptr); ASSERT_TRUE(e->Is()); EXPECT_TRUE(e->IsDefault()); - ASSERT_EQ(e->body->statements.size(), 1u); + ASSERT_EQ(e->body->statements.Length(), 1u); EXPECT_TRUE(e->body->statements[0]->Is()); } diff --git a/src/tint/reader/wgsl/parser_impl_switch_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_switch_stmt_test.cc index c898b123d8..014d850b36 100644 --- a/src/tint/reader/wgsl/parser_impl_switch_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_switch_stmt_test.cc @@ -22,26 +22,26 @@ TEST_F(ParserImplTest, SwitchStmt_WithoutDefault) { case 1: {} case 2: {} })"); - auto e = p->switch_stmt(); + auto e = p->switch_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); ASSERT_TRUE(e->Is()); - ASSERT_EQ(e->body.size(), 2u); + ASSERT_EQ(e->body.Length(), 2u); EXPECT_FALSE(e->body[0]->IsDefault()); EXPECT_FALSE(e->body[1]->IsDefault()); } TEST_F(ParserImplTest, SwitchStmt_Empty) { auto p = parser("switch a { }"); - auto e = p->switch_stmt(); + auto e = p->switch_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); ASSERT_TRUE(e->Is()); - ASSERT_EQ(e->body.size(), 0u); + ASSERT_EQ(e->body.Length(), 0u); } TEST_F(ParserImplTest, SwitchStmt_DefaultInMiddle) { @@ -50,14 +50,14 @@ TEST_F(ParserImplTest, SwitchStmt_DefaultInMiddle) { default: {} case 2: {} })"); - auto e = p->switch_stmt(); + auto e = p->switch_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); ASSERT_TRUE(e->Is()); - ASSERT_EQ(e->body.size(), 3u); + ASSERT_EQ(e->body.Length(), 3u); ASSERT_FALSE(e->body[0]->IsDefault()); ASSERT_TRUE(e->body[1]->IsDefault()); ASSERT_FALSE(e->body[2]->IsDefault()); @@ -65,18 +65,18 @@ TEST_F(ParserImplTest, SwitchStmt_DefaultInMiddle) { TEST_F(ParserImplTest, SwitchStmt_WithParens) { auto p = parser("switch(a+b) { }"); - auto e = p->switch_stmt(); + auto e = p->switch_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); ASSERT_TRUE(e->Is()); - ASSERT_EQ(e->body.size(), 0u); + ASSERT_EQ(e->body.Length(), 0u); } TEST_F(ParserImplTest, SwitchStmt_InvalidExpression) { auto p = parser("switch a=b {}"); - auto e = p->switch_stmt(); + auto e = p->switch_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -86,7 +86,7 @@ TEST_F(ParserImplTest, SwitchStmt_InvalidExpression) { TEST_F(ParserImplTest, SwitchStmt_MissingExpression) { auto p = parser("switch {}"); - auto e = p->switch_stmt(); + auto e = p->switch_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -96,7 +96,7 @@ TEST_F(ParserImplTest, SwitchStmt_MissingExpression) { TEST_F(ParserImplTest, SwitchStmt_MissingBracketLeft) { auto p = parser("switch a }"); - auto e = p->switch_stmt(); + auto e = p->switch_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -106,7 +106,7 @@ TEST_F(ParserImplTest, SwitchStmt_MissingBracketLeft) { TEST_F(ParserImplTest, SwitchStmt_MissingBracketRight) { auto p = parser("switch a {"); - auto e = p->switch_stmt(); + auto e = p->switch_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); @@ -118,7 +118,7 @@ TEST_F(ParserImplTest, SwitchStmt_InvalidBody) { auto p = parser(R"(switch a { case: {} })"); - auto e = p->switch_stmt(); + auto e = p->switch_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); diff --git a/src/tint/reader/wgsl/parser_impl_test.cc b/src/tint/reader/wgsl/parser_impl_test.cc index 33b279c7a5..21efd2f4f2 100644 --- a/src/tint/reader/wgsl/parser_impl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_test.cc @@ -24,7 +24,7 @@ TEST_F(ParserImplTest, Empty) { TEST_F(ParserImplTest, Parses) { auto p = parser(R"( -@stage(fragment) +@fragment fn main() -> @location(0) vec4 { return vec4(.4, .2, .3, 1); } @@ -32,7 +32,7 @@ fn main() -> @location(0) vec4 { ASSERT_TRUE(p->Parse()) << p->error(); Program program = p->program(); - ASSERT_EQ(1u, program.AST().Functions().size()); + ASSERT_EQ(1u, program.AST().Functions().Length()); } TEST_F(ParserImplTest, Parses_ExtraSemicolons) { @@ -52,8 +52,8 @@ fn foo() -> S { ASSERT_TRUE(p->Parse()) << p->error(); Program program = p->program(); - ASSERT_EQ(1u, program.AST().Functions().size()); - ASSERT_EQ(1u, program.AST().TypeDecls().size()); + ASSERT_EQ(1u, program.AST().Functions().Length()); + ASSERT_EQ(1u, program.AST().TypeDecls().Length()); } TEST_F(ParserImplTest, HandlesError) { @@ -82,7 +82,7 @@ foobar TEST_F(ParserImplTest, HandlesBadToken_InMiddle) { auto p = parser(R"( fn main() { - let f = 0x1p500000000000; // Exponent too big for hex float + let f = 0x1p10000000000000000000; // Exponent too big for hex float return; })"); @@ -96,7 +96,7 @@ TEST_F(ParserImplTest, HandlesBadToken_AtModuleScope) { fn main() { return; } -0x1p5000000000000 +0x1p10000000000000000000 )"); ASSERT_FALSE(p->Parse()); @@ -112,7 +112,7 @@ TEST_F(ParserImplTest, Comments_TerminatedBlockComment) { * /* I can nest /**/ comments. */ * // I can nest line comments too. **/ -@stage(fragment) // This is the stage +@fragment // This is the stage fn main(/* no parameters @@ -121,12 +121,12 @@ parameters }/* block comments are OK at EOF...*/)"); ASSERT_TRUE(p->Parse()) << p->error(); - ASSERT_EQ(1u, p->program().AST().Functions().size()); + ASSERT_EQ(1u, p->program().AST().Functions().Length()); } TEST_F(ParserImplTest, Comments_UnterminatedBlockComment) { auto p = parser(R"( -@stage(fragment) +@fragment fn main() -> @location(0) vec4 { return vec4(.4, .2, .3, 1); } /* unterminated block comments are invalid ...)"); @@ -136,5 +136,66 @@ fn main() -> @location(0) vec4 { EXPECT_EQ(p->error(), "5:3: unterminated block comment") << p->error(); } +TEST_F(ParserImplTest, Peek) { + auto p = parser("a == if"); + EXPECT_TRUE(p->peek_is(Token::Type::kIdentifier)); + EXPECT_TRUE(p->peek_is(Token::Type::kEqualEqual, 1)); + EXPECT_TRUE(p->peek_is(Token::Type::kIf, 2)); +} + +TEST_F(ParserImplTest, Peek_Placeholder) { + auto p = parser(">> if"); + EXPECT_TRUE(p->peek_is(Token::Type::kShiftRight)); + EXPECT_TRUE(p->peek_is(Token::Type::kIf, 1)); +} + +TEST_F(ParserImplTest, Peek_PastPlaceholder) { + auto p = parser(">= vec2"); + auto& n = p->next(); + ASSERT_TRUE(n.Is(Token::Type::kGreaterThanEqual)); + EXPECT_TRUE(p->peek_is(Token::Type::kVec2)) << "expected: vec2 got: " << p->peek().to_name(); + EXPECT_TRUE(p->peek_is(Token::Type::kLessThan, 1)) + << "expected: < got: " << p->peek(1).to_name(); +} + +TEST_F(ParserImplTest, Peek_MultiplePlaceholder) { + auto p = parser(">= >= vec2"); + auto& n = p->next(); + ASSERT_TRUE(n.Is(Token::Type::kGreaterThanEqual)); + EXPECT_TRUE(p->peek_is(Token::Type::kGreaterThanEqual)) + << "expected: <= got: " << p->peek().to_name(); + EXPECT_TRUE(p->peek_is(Token::Type::kVec2, 1)) + << "expected: vec2 got: " << p->peek(1).to_name(); + EXPECT_TRUE(p->peek_is(Token::Type::kLessThan, 2)) + << "expected: < got: " << p->peek(2).to_name(); +} + +TEST_F(ParserImplTest, Peek_PastEnd) { + auto p = parser(">"); + EXPECT_TRUE(p->peek_is(Token::Type::kGreaterThan)); + EXPECT_TRUE(p->peek_is(Token::Type::kEOF, 1)); + EXPECT_TRUE(p->peek_is(Token::Type::kEOF, 2)); +} + +TEST_F(ParserImplTest, Peek_PastEnd_WalkingPlaceholders) { + auto p = parser(">= >="); + auto& n = p->next(); + ASSERT_TRUE(n.Is(Token::Type::kGreaterThanEqual)); + EXPECT_TRUE(p->peek_is(Token::Type::kGreaterThanEqual)) + << "expected: <= got: " << p->peek().to_name(); + EXPECT_TRUE(p->peek_is(Token::Type::kEOF, 1)) << "expected: EOF got: " << p->peek(1).to_name(); +} + +TEST_F(ParserImplTest, Peek_AfterSplit) { + auto p = parser(">= vec2"); + auto& n = p->next(); + ASSERT_TRUE(n.Is(Token::Type::kGreaterThanEqual)); + EXPECT_TRUE(p->peek_is(Token::Type::kVec2)) << "expected: vec2 got: " << p->peek().to_name(); + + p->split_token(Token::Type::kGreaterThan, Token::Type::kEqual); + ASSERT_TRUE(n.Is(Token::Type::kGreaterThan)); + EXPECT_TRUE(p->peek_is(Token::Type::kEqual)) << "expected: = got: " << p->peek().to_name(); +} + } // namespace } // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_test_helper.h b/src/tint/reader/wgsl/parser_impl_test_helper.h index f6ee8ea3b7..1b140399fe 100644 --- a/src/tint/reader/wgsl/parser_impl_test_helper.h +++ b/src/tint/reader/wgsl/parser_impl_test_helper.h @@ -38,6 +38,7 @@ class ParserImplTest : public testing::Test, public ProgramBuilder { std::unique_ptr parser(const std::string& str) { auto file = std::make_unique("test.wgsl", str); auto impl = std::make_unique(file.get()); + impl->InitializeLex(); files_.emplace_back(std::move(file)); return impl; } @@ -60,6 +61,7 @@ class ParserImplTestWithParam : public testing::TestWithParam, public Program std::unique_ptr parser(const std::string& str) { auto file = std::make_unique("test.wgsl", str); auto impl = std::make_unique(file.get()); + impl->InitializeLex(); files_.emplace_back(std::move(file)); return impl; } diff --git a/src/tint/reader/wgsl/parser_impl_texture_sampler_test.cc b/src/tint/reader/wgsl/parser_impl_texture_sampler_test.cc index 162b41c15b..1143c5215a 100644 --- a/src/tint/reader/wgsl/parser_impl_texture_sampler_test.cc +++ b/src/tint/reader/wgsl/parser_impl_texture_sampler_test.cc @@ -22,7 +22,7 @@ namespace { TEST_F(ParserImplTest, TextureSamplerTypes_Invalid) { auto p = parser("1234"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); @@ -31,7 +31,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_Invalid) { TEST_F(ParserImplTest, TextureSamplerTypes_Sampler) { auto p = parser("sampler"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -43,7 +43,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_Sampler) { TEST_F(ParserImplTest, TextureSamplerTypes_SamplerComparison) { auto p = parser("sampler_comparison"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -55,7 +55,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SamplerComparison) { TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) { auto p = parser("texture_depth_2d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -68,7 +68,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) { auto p = parser("texture_1d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -82,7 +82,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32) { auto p = parser("texture_2d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -96,7 +96,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32) { auto p = parser("texture_3d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -110,7 +110,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType) { auto p = parser("texture_1d<>"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -120,7 +120,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan) { auto p = parser("texture_1d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -130,7 +130,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) { auto p = parser("texture_1dtexture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -140,7 +140,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) { TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_I32) { auto p = parser("texture_multisampled_2d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -154,7 +154,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_I32) { TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingType) { auto p = parser("texture_multisampled_2d<>"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -164,7 +164,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingType) { TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingLessThan) { auto p = parser("texture_multisampled_2d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -173,7 +173,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingLessThan) TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingGreaterThan) { auto p = parser("texture_multisampled_2dtexture_samplers(); + auto t = p->texture_and_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -182,7 +182,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingGreaterTha TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dRg32Float) { auto p = parser("texture_storage_1d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -198,7 +198,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dRg32Float) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Writeonly2dR32Uint) { auto p = parser("texture_storage_2d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -214,7 +214,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Writeonly2dR32Uint) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType) { auto p = parser("texture_storage_1d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -223,7 +223,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidAccess) { auto p = parser("texture_storage_1d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -232,7 +232,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidAccess) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType) { auto p = parser("texture_storage_1d<>"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -241,7 +241,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) { auto p = parser("texture_storage_1d"); - auto t = p->texture_samplers(); + auto t = p->texture_and_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); @@ -250,7 +250,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingGreaterThan) { auto p = parser("texture_storage_1dtexture_samplers(); + auto t = p->texture_and_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); EXPECT_TRUE(t.errored); diff --git a/src/tint/reader/wgsl/parser_impl_type_alias_test.cc b/src/tint/reader/wgsl/parser_impl_type_alias_test.cc index ea5cbe25b4..c9bb72cb25 100644 --- a/src/tint/reader/wgsl/parser_impl_type_alias_test.cc +++ b/src/tint/reader/wgsl/parser_impl_type_alias_test.cc @@ -20,7 +20,7 @@ namespace { TEST_F(ParserImplTest, TypeDecl_ParsesType) { auto p = parser("type a = i32"); - auto t = p->type_alias(); + auto t = p->type_alias_decl(); EXPECT_FALSE(p->has_error()); EXPECT_FALSE(t.errored); EXPECT_TRUE(t.matched); @@ -35,7 +35,7 @@ TEST_F(ParserImplTest, TypeDecl_ParsesType) { TEST_F(ParserImplTest, TypeDecl_Parses_Ident) { auto p = parser("type a = B"); - auto t = p->type_alias(); + auto t = p->type_alias_decl(); EXPECT_FALSE(p->has_error()); EXPECT_FALSE(t.errored); EXPECT_TRUE(t.matched); @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, TypeDecl_Unicode_Parses_Ident) { auto p = parser("type " + ident + " = i32"); - auto t = p->type_alias(); + auto t = p->type_alias_decl(); EXPECT_FALSE(p->has_error()); EXPECT_FALSE(t.errored); EXPECT_TRUE(t.matched); @@ -68,7 +68,7 @@ TEST_F(ParserImplTest, TypeDecl_Unicode_Parses_Ident) { TEST_F(ParserImplTest, TypeDecl_MissingIdent) { auto p = parser("type = i32"); - auto t = p->type_alias(); + auto t = p->type_alias_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); EXPECT_TRUE(p->has_error()); @@ -78,7 +78,7 @@ TEST_F(ParserImplTest, TypeDecl_MissingIdent) { TEST_F(ParserImplTest, TypeDecl_InvalidIdent) { auto p = parser("type 123 = i32"); - auto t = p->type_alias(); + auto t = p->type_alias_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); EXPECT_TRUE(p->has_error()); @@ -88,7 +88,7 @@ TEST_F(ParserImplTest, TypeDecl_InvalidIdent) { TEST_F(ParserImplTest, TypeDecl_MissingEqual) { auto p = parser("type a i32"); - auto t = p->type_alias(); + auto t = p->type_alias_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); EXPECT_TRUE(p->has_error()); diff --git a/src/tint/reader/wgsl/parser_impl_type_decl_test.cc b/src/tint/reader/wgsl/parser_impl_type_decl_test.cc index a721d77ec1..926f7c7ad3 100644 --- a/src/tint/reader/wgsl/parser_impl_type_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_type_decl_test.cc @@ -55,6 +55,17 @@ TEST_F(ParserImplTest, TypeDecl_Bool) { EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 5u}})); } +TEST_F(ParserImplTest, TypeDecl_F16) { + auto p = parser("f16"); + + auto t = p->type_decl(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_TRUE(t.value->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 4u}})); +} + TEST_F(ParserImplTest, TypeDecl_F32) { auto p = parser("f32"); @@ -261,7 +272,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingStorageClass) { EXPECT_FALSE(t.matched); ASSERT_EQ(t.value, nullptr); ASSERT_TRUE(p->has_error()); - ASSERT_EQ(p->error(), "1:5: invalid storage class for ptr declaration"); + ASSERT_EQ(p->error(), "1:5: expected identifier for storage class"); } TEST_F(ParserImplTest, TypeDecl_Ptr_MissingType) { @@ -291,7 +302,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingParams) { EXPECT_FALSE(t.matched); ASSERT_EQ(t.value, nullptr); ASSERT_TRUE(p->has_error()); - ASSERT_EQ(p->error(), "1:5: invalid storage class for ptr declaration"); + ASSERT_EQ(p->error(), "1:5: expected identifier for storage class"); } TEST_F(ParserImplTest, TypeDecl_Ptr_BadStorageClass) { @@ -388,7 +399,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_AbstractIntLiteralSize) { auto* a = t.value->As(); ASSERT_FALSE(a->IsRuntimeArray()); ASSERT_TRUE(a->type->Is()); - EXPECT_EQ(a->attributes.size(), 0u); + EXPECT_EQ(a->attributes.Length(), 0u); EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 14u}})); auto* size = a->count->As(); @@ -409,7 +420,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_SintLiteralSize) { auto* a = t.value->As(); ASSERT_FALSE(a->IsRuntimeArray()); ASSERT_TRUE(a->type->Is()); - EXPECT_EQ(a->attributes.size(), 0u); + EXPECT_EQ(a->attributes.Length(), 0u); EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 15u}})); auto* size = a->count->As(); @@ -430,7 +441,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_UintLiteralSize) { auto* a = t.value->As(); ASSERT_FALSE(a->IsRuntimeArray()); ASSERT_TRUE(a->type->Is()); - EXPECT_EQ(a->attributes.size(), 0u); + EXPECT_EQ(a->attributes.Length(), 0u); EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 15u}})); auto* size = a->count->As(); @@ -450,7 +461,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_ConstantSize) { auto* a = t.value->As(); ASSERT_FALSE(a->IsRuntimeArray()); ASSERT_TRUE(a->type->Is()); - EXPECT_EQ(a->attributes.size(), 0u); + EXPECT_EQ(a->attributes.Length(), 0u); EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 17u}})); auto* count_expr = a->count->As(); @@ -458,6 +469,33 @@ TEST_F(ParserImplTest, TypeDecl_Array_ConstantSize) { EXPECT_EQ(p->builder().Symbols().NameFor(count_expr->symbol), "size"); } +TEST_F(ParserImplTest, TypeDecl_Array_ExpressionSize) { + auto p = parser("array"); + auto t = p->type_decl(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + ASSERT_FALSE(a->IsRuntimeArray()); + ASSERT_TRUE(a->type->Is()); + EXPECT_EQ(a->attributes.Length(), 0u); + + ASSERT_TRUE(a->count->Is()); + auto* count_expr = a->count->As(); + EXPECT_EQ(ast::BinaryOp::kAdd, count_expr->op); + + ASSERT_TRUE(count_expr->lhs->Is()); + auto* ident = count_expr->lhs->As(); + EXPECT_EQ(p->builder().Symbols().NameFor(ident->symbol), "size"); + + ASSERT_TRUE(count_expr->rhs->Is()); + auto* val = count_expr->rhs->As(); + EXPECT_EQ(2, static_cast(val->value)); +} + TEST_F(ParserImplTest, TypeDecl_Array_Runtime) { auto p = parser("array"); auto t = p->type_decl(); @@ -497,7 +535,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_BadSize) { EXPECT_FALSE(t.matched); ASSERT_EQ(t.value, nullptr); ASSERT_TRUE(p->has_error()); - ASSERT_EQ(p->error(), "1:12: expected array size expression"); + ASSERT_EQ(p->error(), "1:13: unable to parse right side of ! expression"); } TEST_F(ParserImplTest, TypeDecl_Array_MissingSize) { @@ -510,16 +548,6 @@ TEST_F(ParserImplTest, TypeDecl_Array_MissingSize) { ASSERT_EQ(p->error(), "1:11: expected array size expression"); } -TEST_F(ParserImplTest, TypeDecl_Array_MissingLessThan) { - auto p = parser("array f32>"); - auto t = p->type_decl(); - EXPECT_TRUE(t.errored); - EXPECT_FALSE(t.matched); - ASSERT_EQ(t.value, nullptr); - ASSERT_TRUE(p->has_error()); - ASSERT_EQ(p->error(), "1:7: expected '<' for array declaration"); -} - TEST_F(ParserImplTest, TypeDecl_Array_MissingGreaterThan) { auto p = parser("arraytype_decl(); diff --git a/src/tint/reader/wgsl/parser_impl_type_decl_without_ident_test.cc b/src/tint/reader/wgsl/parser_impl_type_decl_without_ident_test.cc new file mode 100644 index 0000000000..ec23f2fd48 --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_type_decl_without_ident_test.cc @@ -0,0 +1,676 @@ +// Copyright 2020 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/alias.h" +#include "src/tint/ast/array.h" +#include "src/tint/ast/matrix.h" +#include "src/tint/ast/sampler.h" +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" +#include "src/tint/sem/sampled_texture.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Invalid) { + auto p = parser("1234"); + auto t = p->type_decl_without_ident(); + EXPECT_EQ(t.errored, false); + EXPECT_EQ(t.matched, false); + EXPECT_EQ(t.value, nullptr); + EXPECT_FALSE(p->has_error()) << p->error(); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Identifier) { + auto p = parser("A"); + auto t = p->type_decl_without_ident(); + EXPECT_FALSE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_EQ(t.value, nullptr); + EXPECT_FALSE(p->has_error()) << p->error(); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Bool) { + auto p = parser("bool"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_TRUE(t.value->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 5u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_F16) { + auto p = parser("f16"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_TRUE(t.value->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 4u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_F32) { + auto p = parser("f32"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_TRUE(t.value->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 4u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_I32) { + auto p = parser("i32"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_TRUE(t.value->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 4u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_U32) { + auto p = parser("u32"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_TRUE(t.value->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 4u}})); +} + +struct VecData { + const char* input; + size_t count; + Source::Range range; +}; +inline std::ostream& operator<<(std::ostream& out, VecData data) { + out << std::string(data.input); + return out; +} + +class TypeDeclWithoutIdent_VecTest : public ParserImplTestWithParam {}; + +TEST_P(TypeDeclWithoutIdent_VecTest, Parse) { + auto params = GetParam(); + auto p = parser(params.input); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + EXPECT_TRUE(t.value->Is()); + EXPECT_EQ(t.value->As()->width, params.count); + EXPECT_EQ(t.value->source.range, params.range); +} +INSTANTIATE_TEST_SUITE_P(ParserImplTest, + TypeDeclWithoutIdent_VecTest, + testing::Values(VecData{"vec2", 2, {{1u, 1u}, {1u, 10u}}}, + VecData{"vec3", 3, {{1u, 1u}, {1u, 10u}}}, + VecData{"vec4", 4, {{1u, 1u}, {1u, 10u}}})); + +class TypeDeclWithoutIdent_VecMissingGreaterThanTest : public ParserImplTestWithParam {}; + +TEST_P(TypeDeclWithoutIdent_VecMissingGreaterThanTest, Handles_Missing_GreaterThan) { + auto params = GetParam(); + auto p = parser(params.input); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:9: expected '>' for vector"); +} +INSTANTIATE_TEST_SUITE_P(ParserImplTest, + TypeDeclWithoutIdent_VecMissingGreaterThanTest, + testing::Values(VecData{"vec2 {}; + +TEST_P(TypeDeclWithoutIdent_VecMissingType, Handles_Missing_Type) { + auto params = GetParam(); + auto p = parser(params.input); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:6: invalid type for vector"); +} +INSTANTIATE_TEST_SUITE_P(ParserImplTest, + TypeDeclWithoutIdent_VecMissingType, + testing::Values(VecData{"vec2<>", 2, {}}, + VecData{"vec3<>", 3, {}}, + VecData{"vec4<>", 4, {}})); + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr) { + auto p = parser("ptr"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* ptr = t.value->As(); + ASSERT_TRUE(ptr->type->Is()); + ASSERT_EQ(ptr->storage_class, ast::StorageClass::kFunction); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 19u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_WithAccess) { + auto p = parser("ptr"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* ptr = t.value->As(); + ASSERT_TRUE(ptr->type->Is()); + ASSERT_EQ(ptr->storage_class, ast::StorageClass::kFunction); + ASSERT_EQ(ptr->access, ast::Access::kRead); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 25u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_ToVec) { + auto p = parser("ptr>"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* ptr = t.value->As(); + ASSERT_TRUE(ptr->type->Is()); + ASSERT_EQ(ptr->storage_class, ast::StorageClass::kFunction); + + auto* vec = ptr->type->As(); + ASSERT_EQ(vec->width, 2u); + ASSERT_TRUE(vec->type->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 25}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingLessThan) { + auto p = parser("ptr private, f32>"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:5: expected '<' for ptr declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingGreaterThanAfterType) { + auto p = parser("ptrtype_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:18: expected '>' for ptr declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingGreaterThanAfterAccess) { + auto p = parser("ptrtype_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:24: expected '>' for ptr declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingCommaAfterStorageClass) { + auto p = parser("ptr"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:14: expected ',' for ptr declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingCommaAfterAccess) { + auto p = parser("ptr"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:19: expected '>' for ptr declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingStorageClass) { + auto p = parser("ptr<, f32>"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:5: expected identifier for storage class"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingType) { + auto p = parser("ptr"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:14: invalid type for ptr declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingAccess) { + auto p = parser("ptr"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:20: expected identifier for access control"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_MissingParams) { + auto p = parser("ptr<>"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:5: expected identifier for storage class"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_BadStorageClass) { + auto p = parser("ptr"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:5: invalid storage class for ptr declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Ptr_BadAccess) { + auto p = parser("ptr"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:20: invalid value for access control"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic) { + auto p = parser("atomic"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* atomic = t.value->As(); + ASSERT_TRUE(atomic->type->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 12u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_ToVec) { + auto p = parser("atomic>"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* atomic = t.value->As(); + ASSERT_TRUE(atomic->type->Is()); + + auto* vec = atomic->type->As(); + ASSERT_EQ(vec->width, 2u); + ASSERT_TRUE(vec->type->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 18u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingLessThan) { + auto p = parser("atomic f32>"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:8: expected '<' for atomic declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingGreaterThan) { + auto p = parser("atomictype_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:11: expected '>' for atomic declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Atomic_MissingType) { + auto p = parser("atomic<>"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:8: invalid type for atomic declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_AbstractIntLiteralSize) { + auto p = parser("array"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + ASSERT_FALSE(a->IsRuntimeArray()); + ASSERT_TRUE(a->type->Is()); + EXPECT_EQ(a->attributes.Length(), 0u); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 14u}})); + + auto* size = a->count->As(); + ASSERT_NE(size, nullptr); + EXPECT_EQ(size->value, 5); + EXPECT_EQ(size->suffix, ast::IntLiteralExpression::Suffix::kNone); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_SintLiteralSize) { + auto p = parser("array"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + ASSERT_FALSE(a->IsRuntimeArray()); + ASSERT_TRUE(a->type->Is()); + EXPECT_EQ(a->attributes.Length(), 0u); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 15u}})); + + auto* size = a->count->As(); + ASSERT_NE(size, nullptr); + EXPECT_EQ(size->value, 5); + EXPECT_EQ(size->suffix, ast::IntLiteralExpression::Suffix::kI); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_UintLiteralSize) { + auto p = parser("array"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + ASSERT_FALSE(a->IsRuntimeArray()); + ASSERT_TRUE(a->type->Is()); + EXPECT_EQ(a->attributes.Length(), 0u); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 15u}})); + + auto* size = a->count->As(); + ASSERT_NE(size, nullptr); + EXPECT_EQ(size->suffix, ast::IntLiteralExpression::Suffix::kU); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_ConstantSize) { + auto p = parser("array"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + ASSERT_FALSE(a->IsRuntimeArray()); + ASSERT_TRUE(a->type->Is()); + EXPECT_EQ(a->attributes.Length(), 0u); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 17u}})); + + auto* count_expr = a->count->As(); + ASSERT_NE(count_expr, nullptr); + EXPECT_EQ(p->builder().Symbols().NameFor(count_expr->symbol), "size"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_ExpressionSize) { + auto p = parser("array"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + ASSERT_FALSE(a->IsRuntimeArray()); + ASSERT_TRUE(a->type->Is()); + EXPECT_EQ(a->attributes.Length(), 0u); + + ASSERT_TRUE(a->count->Is()); + auto* count_expr = a->count->As(); + EXPECT_EQ(ast::BinaryOp::kAdd, count_expr->op); + + ASSERT_TRUE(count_expr->lhs->Is()); + auto* ident = count_expr->lhs->As(); + EXPECT_EQ(p->builder().Symbols().NameFor(ident->symbol), "size"); + + ASSERT_TRUE(count_expr->rhs->Is()); + auto* val = count_expr->rhs->As(); + EXPECT_EQ(2, static_cast(val->value)); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_Runtime) { + auto p = parser("array"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + ASSERT_TRUE(a->IsRuntimeArray()); + ASSERT_TRUE(a->type->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 11u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_Runtime_Vec) { + auto p = parser("array>"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(t.value->Is()); + + auto* a = t.value->As(); + ASSERT_TRUE(a->IsRuntimeArray()); + ASSERT_TRUE(a->type->Is()); + EXPECT_EQ(a->type->As()->width, 4u); + EXPECT_TRUE(a->type->As()->type->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 17u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_BadSize) { + auto p = parser("array"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:13: unable to parse right side of ! expression"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingSize) { + auto p = parser("array"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:11: expected array size expression"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingGreaterThan) { + auto p = parser("arraytype_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:10: expected '>' for array declaration"); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Array_MissingComma) { + auto p = parser("array"); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:11: expected '>' for array declaration"); +} + +struct MatrixData { + const char* input; + size_t columns; + size_t rows; + Source::Range range; +}; +inline std::ostream& operator<<(std::ostream& out, MatrixData data) { + out << std::string(data.input); + return out; +} + +class TypeDeclWithoutIdent_MatrixTest : public ParserImplTestWithParam {}; + +TEST_P(TypeDeclWithoutIdent_MatrixTest, Parse) { + auto params = GetParam(); + auto p = parser(params.input); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_FALSE(p->has_error()); + EXPECT_TRUE(t.value->Is()); + auto* mat = t.value->As(); + EXPECT_EQ(mat->rows, params.rows); + EXPECT_EQ(mat->columns, params.columns); + EXPECT_EQ(t.value->source.range, params.range); +} +INSTANTIATE_TEST_SUITE_P(ParserImplTest, + TypeDeclWithoutIdent_MatrixTest, + testing::Values(MatrixData{"mat2x2", 2, 2, {{1u, 1u}, {1u, 12u}}}, + MatrixData{"mat2x3", 2, 3, {{1u, 1u}, {1u, 12u}}}, + MatrixData{"mat2x4", 2, 4, {{1u, 1u}, {1u, 12u}}}, + MatrixData{"mat3x2", 3, 2, {{1u, 1u}, {1u, 12u}}}, + MatrixData{"mat3x3", 3, 3, {{1u, 1u}, {1u, 12u}}}, + MatrixData{"mat3x4", 3, 4, {{1u, 1u}, {1u, 12u}}}, + MatrixData{"mat4x2", 4, 2, {{1u, 1u}, {1u, 12u}}}, + MatrixData{"mat4x3", 4, 3, {{1u, 1u}, {1u, 12u}}}, + MatrixData{"mat4x4", 4, 4, {{1u, 1u}, {1u, 12u}}})); + +class TypeDeclWithoutIdent_MatrixMissingGreaterThanTest + : public ParserImplTestWithParam {}; + +TEST_P(TypeDeclWithoutIdent_MatrixMissingGreaterThanTest, Handles_Missing_GreaterThan) { + auto params = GetParam(); + auto p = parser(params.input); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:11: expected '>' for matrix"); +} +INSTANTIATE_TEST_SUITE_P(ParserImplTest, + TypeDeclWithoutIdent_MatrixMissingGreaterThanTest, + testing::Values(MatrixData{"mat2x2 {}; + +TEST_P(TypeDeclWithoutIdent_MatrixMissingType, Handles_Missing_Type) { + auto params = GetParam(); + auto p = parser(params.input); + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.errored); + EXPECT_FALSE(t.matched); + ASSERT_EQ(t.value, nullptr); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:8: invalid type for matrix"); +} +INSTANTIATE_TEST_SUITE_P(ParserImplTest, + TypeDeclWithoutIdent_MatrixMissingType, + testing::Values(MatrixData{"mat2x2<>", 2, 2, {}}, + MatrixData{"mat2x3<>", 2, 3, {}}, + MatrixData{"mat2x4<>", 2, 4, {}}, + MatrixData{"mat3x2<>", 3, 2, {}}, + MatrixData{"mat3x3<>", 3, 3, {}}, + MatrixData{"mat3x4<>", 3, 4, {}}, + MatrixData{"mat4x2<>", 4, 2, {}}, + MatrixData{"mat4x3<>", 4, 3, {}}, + MatrixData{"mat4x4<>", 4, 4, {}})); + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Sampler) { + auto p = parser("sampler"); + + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr) << p->error(); + ASSERT_TRUE(t.value->Is()); + ASSERT_FALSE(t.value->As()->IsComparison()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}})); +} + +TEST_F(ParserImplTest, TypeDeclWithoutIdent_Texture) { + auto p = parser("texture_cube"); + + auto t = p->type_decl_without_ident(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_NE(t.value, nullptr); + ASSERT_TRUE(t.value->Is()); + ASSERT_TRUE(t.value->Is()); + ASSERT_TRUE(t.value->As()->type->Is()); + EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 18u}})); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_unary_expression_test.cc b/src/tint/reader/wgsl/parser_impl_unary_expression_test.cc index 184de66de5..29598d9dbe 100644 --- a/src/tint/reader/wgsl/parser_impl_unary_expression_test.cc +++ b/src/tint/reader/wgsl/parser_impl_unary_expression_test.cc @@ -86,7 +86,7 @@ TEST_F(ParserImplTest, UnaryExpression_Dereference) { TEST_F(ParserImplTest, UnaryExpression_AddressOf_Precedence) { auto p = parser("&x.y"); - auto e = p->logical_or_expression(); + auto e = p->unary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -100,7 +100,7 @@ TEST_F(ParserImplTest, UnaryExpression_AddressOf_Precedence) { TEST_F(ParserImplTest, UnaryExpression_Dereference_Precedence) { auto p = parser("*x.y"); - auto e = p->logical_or_expression(); + auto e = p->unary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); diff --git a/src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc b/src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc index 133dd36918..2745e5fc7b 100644 --- a/src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc +++ b/src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc @@ -23,7 +23,7 @@ TEST_F(ParserImplTest, AttributeList_Parses) { ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(attrs.errored); ASSERT_TRUE(attrs.matched); - ASSERT_EQ(attrs.value.size(), 2u); + ASSERT_EQ(attrs.value.Length(), 2u); auto* attr_0 = attrs.value[0]->As(); auto* attr_1 = attrs.value[1]->As(); @@ -33,7 +33,7 @@ TEST_F(ParserImplTest, AttributeList_Parses) { ASSERT_TRUE(attr_0->Is()); EXPECT_EQ(attr_0->As()->value, 4u); ASSERT_TRUE(attr_1->Is()); - EXPECT_EQ(attr_1->As()->builtin, ast::Builtin::kPosition); + EXPECT_EQ(attr_1->As()->builtin, ast::BuiltinValue::kPosition); } TEST_F(ParserImplTest, AttributeList_Invalid) { @@ -42,7 +42,7 @@ TEST_F(ParserImplTest, AttributeList_Invalid) { EXPECT_TRUE(p->has_error()); EXPECT_TRUE(attrs.errored); EXPECT_FALSE(attrs.matched); - EXPECT_TRUE(attrs.value.empty()); + EXPECT_TRUE(attrs.value.IsEmpty()); EXPECT_EQ(p->error(), R"(1:2: expected attribute)"); } @@ -52,7 +52,7 @@ TEST_F(ParserImplTest, AttributeList_InvalidValue) { EXPECT_TRUE(p->has_error()); EXPECT_TRUE(attrs.errored); EXPECT_FALSE(attrs.matched); - EXPECT_TRUE(attrs.value.empty()); + EXPECT_TRUE(attrs.value.IsEmpty()); EXPECT_EQ(p->error(), "1:10: invalid value for builtin attribute"); } diff --git a/src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc b/src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc index 8833273f27..ef778917d5 100644 --- a/src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc +++ b/src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc @@ -32,6 +32,21 @@ TEST_F(ParserImplTest, Attribute_Location) { EXPECT_EQ(loc->value, 4u); } +TEST_F(ParserImplTest, Attribute_Location_TrailingComma) { + auto p = parser("location(4,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr); + auto* var_attr = attr.value->As(); + ASSERT_NE(var_attr, nullptr); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(var_attr->Is()); + + auto* loc = var_attr->As(); + EXPECT_EQ(loc->value, 4u); +} + TEST_F(ParserImplTest, Attribute_Location_MissingLeftParen) { auto p = parser("location 4)"); auto attr = p->attribute(); @@ -74,7 +89,7 @@ TEST_F(ParserImplTest, Attribute_Location_MissingInvalid) { struct BuiltinData { const char* input; - ast::Builtin result; + ast::BuiltinValue result; }; inline std::ostream& operator<<(std::ostream& out, BuiltinData data) { out << std::string(data.input); @@ -99,22 +114,37 @@ TEST_P(BuiltinTest, Attribute_Builtin) { auto* builtin = var_attr->As(); EXPECT_EQ(builtin->builtin, params.result); } +TEST_P(BuiltinTest, Attribute_Builtin_TrailingComma) { + auto params = GetParam(); + auto p = parser(std::string("builtin(") + params.input + ",)"); + + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr); + auto* var_attr = attr.value->As(); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(var_attr, nullptr); + ASSERT_TRUE(var_attr->Is()); + + auto* builtin = var_attr->As(); + EXPECT_EQ(builtin->builtin, params.result); +} INSTANTIATE_TEST_SUITE_P( ParserImplTest, BuiltinTest, - testing::Values(BuiltinData{"position", ast::Builtin::kPosition}, - BuiltinData{"vertex_index", ast::Builtin::kVertexIndex}, - BuiltinData{"instance_index", ast::Builtin::kInstanceIndex}, - BuiltinData{"front_facing", ast::Builtin::kFrontFacing}, - BuiltinData{"frag_depth", ast::Builtin::kFragDepth}, - BuiltinData{"local_invocation_id", ast::Builtin::kLocalInvocationId}, - BuiltinData{"local_invocation_idx", ast::Builtin::kLocalInvocationIndex}, - BuiltinData{"local_invocation_index", ast::Builtin::kLocalInvocationIndex}, - BuiltinData{"global_invocation_id", ast::Builtin::kGlobalInvocationId}, - BuiltinData{"workgroup_id", ast::Builtin::kWorkgroupId}, - BuiltinData{"num_workgroups", ast::Builtin::kNumWorkgroups}, - BuiltinData{"sample_index", ast::Builtin::kSampleIndex}, - BuiltinData{"sample_mask", ast::Builtin::kSampleMask})); + testing::Values(BuiltinData{"position", ast::BuiltinValue::kPosition}, + BuiltinData{"vertex_index", ast::BuiltinValue::kVertexIndex}, + BuiltinData{"instance_index", ast::BuiltinValue::kInstanceIndex}, + BuiltinData{"front_facing", ast::BuiltinValue::kFrontFacing}, + BuiltinData{"frag_depth", ast::BuiltinValue::kFragDepth}, + BuiltinData{"local_invocation_id", ast::BuiltinValue::kLocalInvocationId}, + BuiltinData{"local_invocation_index", ast::BuiltinValue::kLocalInvocationIndex}, + BuiltinData{"global_invocation_id", ast::BuiltinValue::kGlobalInvocationId}, + BuiltinData{"workgroup_id", ast::BuiltinValue::kWorkgroupId}, + BuiltinData{"num_workgroups", ast::BuiltinValue::kNumWorkgroups}, + BuiltinData{"sample_index", ast::BuiltinValue::kSampleIndex}, + BuiltinData{"sample_mask", ast::BuiltinValue::kSampleMask})); TEST_F(ParserImplTest, Attribute_Builtin_MissingLeftParen) { auto p = parser("builtin position)"); @@ -182,6 +212,32 @@ TEST_F(ParserImplTest, Attribute_Interpolate_Flat) { EXPECT_EQ(interp->sampling, ast::InterpolationSampling::kNone); } +TEST_F(ParserImplTest, Attribute_Interpolate_Single_TrailingComma) { + auto p = parser("interpolate(flat,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr); + auto* var_attr = attr.value->As(); + ASSERT_NE(var_attr, nullptr); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(var_attr->Is()); + + auto* interp = var_attr->As(); + EXPECT_EQ(interp->type, ast::InterpolationType::kFlat); + EXPECT_EQ(interp->sampling, ast::InterpolationSampling::kNone); +} + +TEST_F(ParserImplTest, Attribute_Interpolate_Single_DoubleTrailingComma) { + auto p = parser("interpolate(flat,,)"); + auto attr = p->attribute(); + EXPECT_FALSE(attr.matched); + EXPECT_TRUE(attr.errored); + EXPECT_EQ(attr.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:18: expected identifier for interpolation sample name"); +} + TEST_F(ParserImplTest, Attribute_Interpolate_Perspective_Center) { auto p = parser("interpolate(perspective, center)"); auto attr = p->attribute(); @@ -198,6 +254,22 @@ TEST_F(ParserImplTest, Attribute_Interpolate_Perspective_Center) { EXPECT_EQ(interp->sampling, ast::InterpolationSampling::kCenter); } +TEST_F(ParserImplTest, Attribute_Interpolate_Double_TrailingComma) { + auto p = parser("interpolate(perspective, center,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr); + auto* var_attr = attr.value->As(); + ASSERT_NE(var_attr, nullptr); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(var_attr->Is()); + + auto* interp = var_attr->As(); + EXPECT_EQ(interp->type, ast::InterpolationType::kPerspective); + EXPECT_EQ(interp->sampling, ast::InterpolationSampling::kCenter); +} + TEST_F(ParserImplTest, Attribute_Interpolate_Perspective_Centroid) { auto p = parser("interpolate(perspective, centroid)"); auto attr = p->attribute(); @@ -257,7 +329,7 @@ TEST_F(ParserImplTest, Attribute_Interpolate_MissingFirstValue) { EXPECT_TRUE(attr.errored); EXPECT_EQ(attr.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:13: invalid interpolation type"); + EXPECT_EQ(p->error(), "1:13: expected identifier for interpolation type name"); } TEST_F(ParserImplTest, Attribute_Interpolate_InvalidFirstValue) { @@ -270,16 +342,6 @@ TEST_F(ParserImplTest, Attribute_Interpolate_InvalidFirstValue) { EXPECT_EQ(p->error(), "1:13: invalid interpolation type"); } -TEST_F(ParserImplTest, Attribute_Interpolate_MissingSecondValue) { - auto p = parser("interpolate(perspective,)"); - auto attr = p->attribute(); - EXPECT_FALSE(attr.matched); - EXPECT_TRUE(attr.errored); - EXPECT_EQ(attr.value, nullptr); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:25: invalid interpolation sampling"); -} - TEST_F(ParserImplTest, Attribute_Interpolate_InvalidSecondValue) { auto p = parser("interpolate(perspective, nope)"); auto attr = p->attribute(); @@ -305,6 +367,21 @@ TEST_F(ParserImplTest, Attribute_Binding) { EXPECT_EQ(binding->value, 4u); } +TEST_F(ParserImplTest, Attribute_Binding_TrailingComma) { + auto p = parser("binding(4,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr); + auto* var_attr = attr.value->As(); + ASSERT_NE(var_attr, nullptr); + ASSERT_FALSE(p->has_error()); + ASSERT_TRUE(var_attr->Is()); + + auto* binding = var_attr->As(); + EXPECT_EQ(binding->value, 4u); +} + TEST_F(ParserImplTest, Attribute_Binding_MissingLeftParen) { auto p = parser("binding 4)"); auto attr = p->attribute(); @@ -360,6 +437,21 @@ TEST_F(ParserImplTest, Attribute_group) { EXPECT_EQ(group->value, 4u); } +TEST_F(ParserImplTest, Attribute_group_TrailingComma) { + auto p = parser("group(4,)"); + auto attr = p->attribute(); + EXPECT_TRUE(attr.matched); + EXPECT_FALSE(attr.errored); + ASSERT_NE(attr.value, nullptr); + auto* var_attr = attr.value->As(); + ASSERT_FALSE(p->has_error()); + ASSERT_NE(var_attr, nullptr); + ASSERT_TRUE(var_attr->Is()); + + auto* group = var_attr->As(); + EXPECT_EQ(group->value, 4u); +} + TEST_F(ParserImplTest, Attribute_Group_MissingLeftParen) { auto p = parser("group 2)"); auto attr = p->attribute(); diff --git a/src/tint/reader/wgsl/parser_impl_variable_decl_test.cc b/src/tint/reader/wgsl/parser_impl_variable_decl_test.cc index 70ec394afd..2fee83c38a 100644 --- a/src/tint/reader/wgsl/parser_impl_variable_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_variable_decl_test.cc @@ -51,7 +51,7 @@ TEST_F(ParserImplTest, VariableDecl_Unicode_Parses) { TEST_F(ParserImplTest, VariableDecl_Inferred_Parses) { auto p = parser("var my_var = 1.0"); - auto v = p->variable_decl(/*allow_inferred = */ true); + auto v = p->variable_decl(); EXPECT_FALSE(p->has_error()); EXPECT_TRUE(v.matched); EXPECT_FALSE(v.errored); @@ -68,19 +68,10 @@ TEST_F(ParserImplTest, VariableDecl_MissingVar) { EXPECT_FALSE(v.errored); EXPECT_FALSE(p->has_error()); - auto t = p->next(); + auto& t = p->next(); ASSERT_TRUE(t.IsIdentifier()); } -TEST_F(ParserImplTest, VariableDecl_InvalidIdentDecl) { - auto p = parser("var my_var f32"); - auto v = p->variable_decl(); - EXPECT_FALSE(v.matched); - EXPECT_TRUE(v.errored); - EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:12: expected ':' for variable declaration"); -} - TEST_F(ParserImplTest, VariableDecl_WithStorageClass) { auto p = parser("var my_var : f32"); auto v = p->variable_decl(); @@ -97,6 +88,17 @@ TEST_F(ParserImplTest, VariableDecl_WithStorageClass) { EXPECT_EQ(v->source.range.end.column, 20u); } +TEST_F(ParserImplTest, VariableDecl_WithPushConstant) { + auto p = parser("var my_var : f32"); + auto v = p->variable_decl(); + EXPECT_TRUE(v.matched); + EXPECT_FALSE(v.errored); + EXPECT_FALSE(p->has_error()); + EXPECT_EQ(v->name, "my_var"); + EXPECT_TRUE(v->type->Is()); + EXPECT_EQ(v->storage_class, ast::StorageClass::kPushConstant); +} + TEST_F(ParserImplTest, VariableDecl_InvalidStorageClass) { auto p = parser("var my_var : f32"); auto v = p->variable_decl(); diff --git a/src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc b/src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc index 3ffb29ec6c..00dd59b43b 100644 --- a/src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc +++ b/src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc @@ -19,7 +19,7 @@ namespace { TEST_F(ParserImplTest, VariableIdentDecl_Parses) { auto p = parser("my_var : f32"); - auto decl = p->expect_variable_ident_decl("test"); + auto decl = p->expect_ident_with_type_decl("test"); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(decl.errored); ASSERT_EQ(decl->name, "my_var"); @@ -30,9 +30,29 @@ TEST_F(ParserImplTest, VariableIdentDecl_Parses) { EXPECT_EQ(decl->type->source.range, (Source::Range{{1u, 10u}, {1u, 13u}})); } -TEST_F(ParserImplTest, VariableIdentDecl_Inferred_Parses) { +TEST_F(ParserImplTest, VariableIdentDecl_Parses_AllowInferredType) { + auto p = parser("my_var : f32"); + auto decl = p->expect_optionally_typed_ident("test"); + ASSERT_FALSE(p->has_error()) << p->error(); + ASSERT_FALSE(decl.errored); + ASSERT_EQ(decl->name, "my_var"); + ASSERT_NE(decl->type, nullptr); + ASSERT_TRUE(decl->type->Is()); + + EXPECT_EQ(decl->source.range, (Source::Range{{1u, 1u}, {1u, 7u}})); + EXPECT_EQ(decl->type->source.range, (Source::Range{{1u, 10u}, {1u, 13u}})); +} + +TEST_F(ParserImplTest, VariableIdentDecl_Inferred_Parse_Failure) { auto p = parser("my_var = 1.0"); - auto decl = p->expect_variable_ident_decl("test", /*allow_inferred = */ true); + auto decl = p->expect_ident_with_type_decl("test"); + ASSERT_TRUE(p->has_error()); + ASSERT_EQ(p->error(), "1:8: expected ':' for test"); +} + +TEST_F(ParserImplTest, VariableIdentDecl_Inferred_Parses_AllowInferredType) { + auto p = parser("my_var = 1.0"); + auto decl = p->expect_optionally_typed_ident("test"); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(decl.errored); ASSERT_EQ(decl->name, "my_var"); @@ -43,23 +63,31 @@ TEST_F(ParserImplTest, VariableIdentDecl_Inferred_Parses) { TEST_F(ParserImplTest, VariableIdentDecl_MissingIdent) { auto p = parser(": f32"); - auto decl = p->expect_variable_ident_decl("test"); + auto decl = p->expect_ident_with_type_decl("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); ASSERT_EQ(p->error(), "1:1: expected identifier for test"); } -TEST_F(ParserImplTest, VariableIdentDecl_MissingColon) { - auto p = parser("my_var f32"); - auto decl = p->expect_variable_ident_decl("test"); +TEST_F(ParserImplTest, VariableIdentDecl_MissingIdent_AllowInferredType) { + auto p = parser(": f32"); + auto decl = p->expect_optionally_typed_ident("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); - ASSERT_EQ(p->error(), "1:8: expected ':' for test"); + ASSERT_EQ(p->error(), "1:1: expected identifier for test"); } TEST_F(ParserImplTest, VariableIdentDecl_MissingType) { auto p = parser("my_var :"); - auto decl = p->expect_variable_ident_decl("test"); + auto decl = p->expect_ident_with_type_decl("test"); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(decl.errored); + ASSERT_EQ(p->error(), "1:9: invalid type for test"); +} + +TEST_F(ParserImplTest, VariableIdentDecl_MissingType_AllowInferredType) { + auto p = parser("my_var :"); + auto decl = p->expect_optionally_typed_ident("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); ASSERT_EQ(p->error(), "1:9: invalid type for test"); @@ -67,7 +95,15 @@ TEST_F(ParserImplTest, VariableIdentDecl_MissingType) { TEST_F(ParserImplTest, VariableIdentDecl_InvalidIdent) { auto p = parser("123 : f32"); - auto decl = p->expect_variable_ident_decl("test"); + auto decl = p->expect_ident_with_type_decl("test"); + ASSERT_TRUE(p->has_error()); + ASSERT_TRUE(decl.errored); + ASSERT_EQ(p->error(), "1:1: expected identifier for test"); +} + +TEST_F(ParserImplTest, VariableIdentDecl_InvalidIdent_AllowInferredType) { + auto p = parser("123 : f32"); + auto decl = p->expect_optionally_typed_ident("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); ASSERT_EQ(p->error(), "1:1: expected identifier for test"); diff --git a/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc b/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc index de63f923b0..5362d38d98 100644 --- a/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc +++ b/src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc @@ -40,7 +40,7 @@ TEST_P(VariableQualifierTest, ParsesStorageClass) { EXPECT_EQ(sc->storage_class, params.storage_class); EXPECT_EQ(sc->access, params.access); - auto t = p->next(); + auto& t = p->next(); EXPECT_TRUE(t.IsEof()); } INSTANTIATE_TEST_SUITE_P( @@ -50,7 +50,6 @@ INSTANTIATE_TEST_SUITE_P( VariableStorageData{"uniform", ast::StorageClass::kUniform, ast::Access::kUndefined}, VariableStorageData{"workgroup", ast::StorageClass::kWorkgroup, ast::Access::kUndefined}, VariableStorageData{"storage", ast::StorageClass::kStorage, ast::Access::kUndefined}, - VariableStorageData{"storage_buffer", ast::StorageClass::kStorage, ast::Access::kUndefined}, VariableStorageData{"private", ast::StorageClass::kPrivate, ast::Access::kUndefined}, VariableStorageData{"function", ast::StorageClass::kFunction, ast::Access::kUndefined}, VariableStorageData{"storage, read", ast::StorageClass::kStorage, ast::Access::kRead}, @@ -73,7 +72,7 @@ TEST_F(ParserImplTest, VariableQualifier_Empty) { EXPECT_TRUE(p->has_error()); EXPECT_TRUE(sc.errored); EXPECT_FALSE(sc.matched); - EXPECT_EQ(p->error(), "1:2: invalid storage class for variable declaration"); + EXPECT_EQ(p->error(), "1:2: expected identifier for storage class"); } TEST_F(ParserImplTest, VariableQualifier_MissingLessThan) { @@ -83,8 +82,8 @@ TEST_F(ParserImplTest, VariableQualifier_MissingLessThan) { EXPECT_FALSE(sc.errored); EXPECT_FALSE(sc.matched); - auto t = p->next(); - ASSERT_TRUE(t.Is(Token::Type::kPrivate)); + auto& t = p->next(); + ASSERT_TRUE(t.Is(Token::Type::kIdentifier)); } TEST_F(ParserImplTest, VariableQualifier_MissingLessThan_AfterSC) { @@ -94,8 +93,8 @@ TEST_F(ParserImplTest, VariableQualifier_MissingLessThan_AfterSC) { EXPECT_FALSE(sc.errored); EXPECT_FALSE(sc.matched); - auto t = p->next(); - ASSERT_TRUE(t.Is(Token::Type::kPrivate)); + auto& t = p->next(); + ASSERT_TRUE(t.Is(Token::Type::kIdentifier)); } TEST_F(ParserImplTest, VariableQualifier_MissingGreaterThan) { diff --git a/src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc index ee899478a8..3e60acd946 100644 --- a/src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc @@ -19,7 +19,7 @@ namespace { TEST_F(ParserImplTest, VariableStmt_VariableDecl) { auto p = parser("var a : i32;"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -38,7 +38,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl) { TEST_F(ParserImplTest, VariableStmt_VariableDecl_WithInit) { auto p = parser("var a : i32 = 1;"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -58,17 +58,17 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl_WithInit) { TEST_F(ParserImplTest, VariableStmt_VariableDecl_ConstructorInvalid) { auto p = parser("var a : i32 = if(a) {}"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:15: missing constructor for variable declaration"); + EXPECT_EQ(p->error(), "1:15: missing initializer for 'var' declaration"); } TEST_F(ParserImplTest, VariableStmt_VariableDecl_ArrayInit) { auto p = parser("var a : array = array();"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -86,7 +86,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl_ArrayInit) { TEST_F(ParserImplTest, VariableStmt_VariableDecl_ArrayInit_NoSpace) { auto p = parser("var a : array=array();"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -104,7 +104,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl_ArrayInit_NoSpace) { TEST_F(ParserImplTest, VariableStmt_VariableDecl_VecInit) { auto p = parser("var a : vec2 = vec2();"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -122,7 +122,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl_VecInit) { TEST_F(ParserImplTest, VariableStmt_VariableDecl_VecInit_NoSpace) { auto p = parser("var a : vec2=vec2();"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -140,7 +140,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl_VecInit_NoSpace) { TEST_F(ParserImplTest, VariableStmt_Let) { auto p = parser("let a : i32 = 1"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -153,34 +153,60 @@ TEST_F(ParserImplTest, VariableStmt_Let) { ASSERT_EQ(e->source.range.end.column, 6u); } +TEST_F(ParserImplTest, VariableStmt_Let_ComplexExpression) { + auto p = parser("let x = collide + collide_1;"); + // Parse as `statement` to validate the `;` at the end so we know we parsed the whole expression + auto e = p->statement(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + ASSERT_TRUE(e->Is()); + + auto* decl = e->As(); + ASSERT_NE(decl->variable->constructor, nullptr); + + ASSERT_TRUE(decl->variable->constructor->Is()); + auto* expr = decl->variable->constructor->As(); + EXPECT_EQ(expr->op, ast::BinaryOp::kAdd); + + ASSERT_TRUE(expr->lhs->Is()); + auto* ident = expr->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("collide")); + + ASSERT_TRUE(expr->rhs->Is()); + ident = expr->rhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("collide_1")); +} + TEST_F(ParserImplTest, VariableStmt_Let_MissingEqual) { auto p = parser("let a : i32 1"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:13: expected '=' for let declaration"); + EXPECT_EQ(p->error(), "1:13: expected '=' for 'let' declaration"); } TEST_F(ParserImplTest, VariableStmt_Let_MissingConstructor) { auto p = parser("let a : i32 ="); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:14: missing constructor for let declaration"); + EXPECT_EQ(p->error(), "1:14: missing initializer for 'let' declaration"); } TEST_F(ParserImplTest, VariableStmt_Let_InvalidConstructor) { auto p = parser("let a : i32 = if (a) {}"); - auto e = p->variable_stmt(); + auto e = p->variable_statement(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); EXPECT_EQ(e.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:15: missing constructor for let declaration"); + EXPECT_EQ(p->error(), "1:15: missing initializer for 'let' declaration"); } } // namespace diff --git a/src/tint/reader/wgsl/parser_impl_vec_mat_prefix_test.cc b/src/tint/reader/wgsl/parser_impl_vec_mat_prefix_test.cc new file mode 100644 index 0000000000..d6204d70af --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_vec_mat_prefix_test.cc @@ -0,0 +1,103 @@ +// Copyright 2020 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +namespace tint::reader::wgsl { +namespace { + +TEST_F(ParserImplTest, VecPrefix_Vec2) { + auto p = parser("vec2"); + auto t = p->vec_prefix(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + + EXPECT_EQ(2u, t.value); +} + +TEST_F(ParserImplTest, VecPrefix_Vec3) { + auto p = parser("vec3"); + auto t = p->vec_prefix(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + + EXPECT_EQ(3u, t.value); +} + +TEST_F(ParserImplTest, VecPrefix_Vec4) { + auto p = parser("vec4"); + auto t = p->vec_prefix(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + + EXPECT_EQ(4u, t.value); +} + +TEST_F(ParserImplTest, VecPrefix_NoMatch) { + auto p = parser("mat2x2"); + auto t = p->vec_prefix(); + EXPECT_FALSE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + + EXPECT_EQ(0u, t.value); +} + +struct MatData { + std::string name; + uint32_t columns; + uint32_t rows; +}; +class MatPrefixTest : public ParserImplTestWithParam {}; +TEST_P(MatPrefixTest, Parse) { + auto params = GetParam(); + + auto p = parser(params.name); + auto t = p->mat_prefix(); + EXPECT_TRUE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + + auto dims = t.value; + EXPECT_EQ(params.columns, dims.columns); + EXPECT_EQ(params.rows, dims.rows); +} +INSTANTIATE_TEST_SUITE_P(ParserImplTest, + MatPrefixTest, + testing::Values(MatData{"mat2x2", 2, 2}, + MatData{"mat2x3", 2, 3}, + MatData{"mat2x4", 2, 4}, + MatData{"mat3x2", 3, 2}, + MatData{"mat3x3", 3, 3}, + MatData{"mat3x4", 3, 4}, + MatData{"mat4x2", 4, 2}, + MatData{"mat4x3", 4, 3}, + MatData{"mat4x4", 4, 4})); + +TEST_F(ParserImplTest, MatPrefix_NoMatch) { + auto p = parser("vec2"); + auto t = p->mat_prefix(); + EXPECT_FALSE(t.matched); + EXPECT_FALSE(t.errored); + ASSERT_FALSE(p->has_error()) << p->error(); + + EXPECT_EQ(0u, t.value.columns); + EXPECT_EQ(0u, t.value.rows); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_impl_while_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_while_stmt_test.cc new file mode 100644 index 0000000000..247f340dce --- /dev/null +++ b/src/tint/reader/wgsl/parser_impl_while_stmt_test.cc @@ -0,0 +1,157 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/reader/wgsl/parser_impl_test_helper.h" + +#include "src/tint/ast/discard_statement.h" + +namespace tint::reader::wgsl { +namespace { + +using WhileStmtTest = ParserImplTest; + +// Test an empty while loop. +TEST_F(WhileStmtTest, Empty) { + auto p = parser("while (true) { }"); + auto wl = p->while_statement(); + EXPECT_FALSE(p->has_error()) << p->error(); + EXPECT_FALSE(wl.errored); + ASSERT_TRUE(wl.matched); + EXPECT_TRUE(Is(wl->condition)); + EXPECT_TRUE(wl->body->Empty()); +} + +// Test a while loop with non-empty body. +TEST_F(WhileStmtTest, Body) { + auto p = parser("while (true) { discard; }"); + auto wl = p->while_statement(); + EXPECT_FALSE(p->has_error()) << p->error(); + EXPECT_FALSE(wl.errored); + ASSERT_TRUE(wl.matched); + EXPECT_TRUE(Is(wl->condition)); + ASSERT_EQ(wl->body->statements.Length(), 1u); + EXPECT_TRUE(wl->body->statements[0]->Is()); +} + +// Test a while loop with complex condition. +TEST_F(WhileStmtTest, ComplexCondition) { + auto p = parser("while ((a + 1 - 2) == 3) { }"); + auto wl = p->while_statement(); + EXPECT_FALSE(p->has_error()) << p->error(); + EXPECT_FALSE(wl.errored); + ASSERT_TRUE(wl.matched); + EXPECT_TRUE(Is(wl->condition)); + EXPECT_TRUE(wl->body->Empty()); +} + +// Test a while loop with no brackets. +TEST_F(WhileStmtTest, NoBrackets) { + auto p = parser("while (a + 1 - 2) == 3 { }"); + auto wl = p->while_statement(); + EXPECT_FALSE(p->has_error()) << p->error(); + EXPECT_FALSE(wl.errored); + ASSERT_TRUE(wl.matched); + EXPECT_TRUE(Is(wl->condition)); + EXPECT_TRUE(wl->body->Empty()); +} + +class WhileStmtErrorTest : public ParserImplTest { + public: + void TestForWithError(std::string for_str, std::string error_str) { + auto p_for = parser(for_str); + auto e_for = p_for->while_statement(); + + EXPECT_FALSE(e_for.matched); + EXPECT_TRUE(e_for.errored); + EXPECT_TRUE(p_for->has_error()); + ASSERT_EQ(e_for.value, nullptr); + EXPECT_EQ(p_for->error(), error_str); + } +}; + +// Test a while loop with missing left parenthesis is invalid. +TEST_F(WhileStmtErrorTest, MissingLeftParen) { + std::string while_str = "while bool) { }"; + std::string error_str = "1:11: expected '(' for type constructor"; + + TestForWithError(while_str, error_str); +} + +// Test a while loop with missing condition is invalid. +TEST_F(WhileStmtErrorTest, MissingFirstSemicolon) { + std::string while_str = "while () {}"; + std::string error_str = "1:8: unable to parse expression"; + + TestForWithError(while_str, error_str); +} + +// Test a while loop with missing right parenthesis is invalid. +TEST_F(WhileStmtErrorTest, MissingRightParen) { + std::string while_str = "while (true {}"; + std::string error_str = "1:13: expected ')'"; + + TestForWithError(while_str, error_str); +} + +// Test a while loop with missing left brace is invalid. +TEST_F(WhileStmtErrorTest, MissingLeftBrace) { + std::string while_str = "while (true) }"; + std::string error_str = "1:14: expected '{'"; + + TestForWithError(while_str, error_str); +} + +// Test a for loop with missing right brace is invalid. +TEST_F(WhileStmtErrorTest, MissingRightBrace) { + std::string while_str = "while (true) {"; + std::string error_str = "1:15: expected '}'"; + + TestForWithError(while_str, error_str); +} + +// Test a while loop with an invalid break condition. +TEST_F(WhileStmtErrorTest, InvalidBreakConditionAsExpression) { + std::string while_str = "while ((0 == 1) { }"; + std::string error_str = "1:17: expected ')'"; + + TestForWithError(while_str, error_str); +} + +// Test a while loop with a break condition not matching +// logical_or_expression. +TEST_F(WhileStmtErrorTest, InvalidBreakConditionMatch) { + std::string while_str = "while (var i: i32 = 0) { }"; + std::string error_str = "1:8: unable to parse expression"; + + TestForWithError(while_str, error_str); +} + +// Test a while loop with an invalid body. +TEST_F(WhileStmtErrorTest, InvalidBody) { + std::string while_str = "while (true) { let x: i32; }"; + std::string error_str = "1:26: expected '=' for 'let' declaration"; + + TestForWithError(while_str, error_str); +} + +// Test a for loop with a body not matching statements +TEST_F(WhileStmtErrorTest, InvalidBodyMatch) { + std::string while_str = "while (true) { fn main() {} }"; + std::string error_str = "1:16: expected '}'"; + + TestForWithError(while_str, error_str); +} + +} // namespace +} // namespace tint::reader::wgsl diff --git a/src/tint/reader/wgsl/parser_test.cc b/src/tint/reader/wgsl/parser_test.cc index d343c7cceb..860120cc57 100644 --- a/src/tint/reader/wgsl/parser_test.cc +++ b/src/tint/reader/wgsl/parser_test.cc @@ -32,7 +32,7 @@ TEST_F(ParserTest, Empty) { TEST_F(ParserTest, Parses) { Source::File file("test.wgsl", R"( -@stage(fragment) +@fragment fn main() -> @location(0) vec4 { return vec4(.4, .2, .3, 1.); } @@ -41,7 +41,7 @@ fn main() -> @location(0) vec4 { auto errs = diag::Formatter().format(program.Diagnostics()); ASSERT_TRUE(program.IsValid()) << errs; - ASSERT_EQ(1u, program.AST().Functions().size()); + ASSERT_EQ(1u, program.AST().Functions().Length()); } TEST_F(ParserTest, HandlesError) { diff --git a/src/tint/reader/wgsl/token.cc b/src/tint/reader/wgsl/token.cc index 2f51a85b21..ac5eb08922 100644 --- a/src/tint/reader/wgsl/token.cc +++ b/src/tint/reader/wgsl/token.cc @@ -26,13 +26,19 @@ std::string_view Token::TypeToName(Type type) { case Token::Type::kIdentifier: return "identifier"; case Token::Type::kFloatLiteral: - return "float literal"; + return "abstract float literal"; + case Token::Type::kFloatLiteral_F: + return "'f'-suffixed float literal"; + case Token::Type::kFloatLiteral_H: + return "'h'-suffixed float literal"; case Token::Type::kIntLiteral: return "abstract integer literal"; - case Token::Type::kIntILiteral: + case Token::Type::kIntLiteral_I: return "'i'-suffixed integer literal"; - case Token::Type::kIntULiteral: + case Token::Type::kIntLiteral_U: return "'u'-suffixed integer literal"; + case Token::Type::kPlaceholder: + return "placeholder"; case Token::Type::kUninitialized: return "uninitialized"; @@ -124,6 +130,10 @@ std::string_view Token::TypeToName(Type type) { return "|="; case Token::Type::kXorEqual: return "^="; + case Token::Type::kShiftLeftEqual: + return "<<="; + case Token::Type::kShiftRightEqual: + return ">>="; case Token::Type::kArray: return "array"; @@ -137,6 +147,8 @@ std::string_view Token::TypeToName(Type type) { return "break"; case Token::Type::kCase: return "case"; + case Token::Type::kConst: + return "const"; case Token::Type::kContinue: return "continue"; case Token::Type::kContinuing: @@ -149,6 +161,8 @@ std::string_view Token::TypeToName(Type type) { return "else"; case Token::Type::kEnable: return "enable"; + case Token::Type::kF16: + return "f16"; case Token::Type::kF32: return "f32"; case Token::Type::kFallthrough: @@ -159,14 +173,10 @@ std::string_view Token::TypeToName(Type type) { return "fn"; case Token::Type::kFor: return "for"; - case Token::Type::kFunction: - return "function"; case Token::Type::kI32: return "i32"; case Token::Type::kIf: return "if"; - case Token::Type::kImport: - return "import"; case Token::Type::kLet: return "let"; case Token::Type::kLoop: @@ -191,8 +201,6 @@ std::string_view Token::TypeToName(Type type) { return "mat4x4"; case Token::Type::kOverride: return "override"; - case Token::Type::kPrivate: - return "private"; case Token::Type::kPtr: return "ptr"; case Token::Type::kReturn: @@ -201,8 +209,8 @@ std::string_view Token::TypeToName(Type type) { return "sampler"; case Token::Type::kComparisonSampler: return "sampler_comparison"; - case Token::Type::kStorage: - return "storage"; + case Token::Type::kStaticAssert: + return "static_assert"; case Token::Type::kStruct: return "struct"; case Token::Type::kSwitch: @@ -247,8 +255,6 @@ std::string_view Token::TypeToName(Type type) { return "type"; case Token::Type::kU32: return "u32"; - case Token::Type::kUniform: - return "uniform"; case Token::Type::kVar: return "var"; case Token::Type::kVec2: @@ -257,8 +263,8 @@ std::string_view Token::TypeToName(Type type) { return "vec3"; case Token::Type::kVec4: return "vec4"; - case Token::Type::kWorkgroup: - return "workgroup"; + case Token::Type::kWhile: + return "while"; } return ""; @@ -278,20 +284,16 @@ Token::Token(Type type, const Source& source, const char* str) Token::Token(Type type, const Source& source, int64_t val) : type_(type), source_(source), value_(val) {} -Token::Token(const Source& source, float val) - : type_(Type::kFloatLiteral), source_(source), value_(val) {} +Token::Token(Type type, const Source& source, double val) + : type_(type), source_(source), value_(val) {} Token::Token(Type type, const Source& source) : type_(type), source_(source) {} Token::Token(Token&&) = default; -Token::Token(const Token&) = default; - Token::~Token() = default; -Token& Token::operator=(const Token& rhs) = default; - -bool Token::operator==(std::string_view ident) { +bool Token::operator==(std::string_view ident) const { if (type_ != Type::kIdentifier) { return false; } @@ -304,12 +306,16 @@ bool Token::operator==(std::string_view ident) { std::string Token::to_str() const { switch (type_) { case Type::kFloatLiteral: - return std::to_string(std::get(value_)); + return std::to_string(std::get(value_)); + case Type::kFloatLiteral_F: + return std::to_string(std::get(value_)) + "f"; + case Type::kFloatLiteral_H: + return std::to_string(std::get(value_)) + "h"; case Type::kIntLiteral: return std::to_string(std::get(value_)); - case Type::kIntILiteral: + case Type::kIntLiteral_I: return std::to_string(std::get(value_)) + "i"; - case Type::kIntULiteral: + case Type::kIntLiteral_U: return std::to_string(std::get(value_)) + "u"; case Type::kIdentifier: case Type::kError: @@ -322,8 +328,8 @@ std::string Token::to_str() const { } } -float Token::to_f32() const { - return std::get(value_); +double Token::to_f64() const { + return std::get(value_); } int64_t Token::to_i64() const { diff --git a/src/tint/reader/wgsl/token.h b/src/tint/reader/wgsl/token.h index 106d1a6ab9..4cf9aad1b1 100644 --- a/src/tint/reader/wgsl/token.h +++ b/src/tint/reader/wgsl/token.h @@ -17,8 +17,7 @@ #include #include -// TODO(https://crbug.com/dawn/1379) Update cpplint and remove NOLINT -#include // NOLINT(build/include_order)) +#include #include "src/tint/source.h" @@ -33,19 +32,25 @@ class Token { kError = -2, /// Uninitialized token kUninitialized = 0, + /// Placeholder token which maybe fillled in later + kPlaceholder = 1, /// End of input string reached kEOF, /// An identifier kIdentifier, - /// A float value + /// A float literal with no suffix kFloatLiteral, + /// A float literal with an 'f' suffix + kFloatLiteral_F, + /// A float literal with an 'h' suffix + kFloatLiteral_H, /// An integer literal with no suffix kIntLiteral, /// An integer literal with an 'i' suffix - kIntILiteral, + kIntLiteral_I, /// An integer literal with a 'u' suffix - kIntULiteral, + kIntLiteral_U, /// A '&' kAnd, @@ -135,6 +140,10 @@ class Token { kOrEqual, /// A '^=' kXorEqual, + /// A '>>=' + kShiftRightEqual, + /// A '<<=' + kShiftLeftEqual, /// A 'array' kArray, @@ -148,6 +157,8 @@ class Token { kBreak, /// A 'case' kCase, + /// A 'const' + kConst, /// A 'continue' kContinue, /// A 'continuing' @@ -160,6 +171,8 @@ class Token { kElse, /// A 'enable' kEnable, + /// A 'f16' + kF16, /// A 'f32' kF32, /// A 'fallthrough' @@ -170,14 +183,10 @@ class Token { kFn, // A 'for' kFor, - /// A 'function' - kFunction, /// A 'i32' kI32, /// A 'if' kIf, - /// A 'import' - kImport, /// A 'let' kLet, /// A 'loop' @@ -202,8 +211,6 @@ class Token { kMat4x4, /// A 'override' kOverride, - /// A 'private' - kPrivate, /// A 'ptr' kPtr, /// A 'return' @@ -212,8 +219,8 @@ class Token { kSampler, /// A 'sampler_comparison' kComparisonSampler, - /// A 'storage' - kStorage, + /// A 'static_assert' + kStaticAssert, /// A 'struct' kStruct, /// A 'switch' @@ -258,8 +265,6 @@ class Token { kType, /// A 'u32' kU32, - /// A 'uniform' - kUniform, /// A 'var' kVar, /// A 'vec2' @@ -268,8 +273,8 @@ class Token { kVec3, /// A 'vec4' kVec4, - /// A 'workgroup' - kWorkgroup, + /// A 'while' + kWhile, }; /// Converts a token type to a name @@ -304,25 +309,23 @@ class Token { /// @param source the source of the token /// @param val the source unsigned for the token Token(Type type, const Source& source, int64_t val); - /// Create a float Token + /// Create a double Token + /// @param type the Token::Type of the token /// @param source the source of the token - /// @param val the source float for the token - Token(const Source& source, float val); + /// @param val the source double for the token + Token(Type type, const Source& source, double val); /// Move constructor Token(Token&&); - /// Copy constructor - Token(const Token&); ~Token(); - /// Assignment operator - /// @param b the token to copy - /// @return Token - Token& operator=(const Token& b); - /// Equality operator with an identifier /// @param ident the identifier string /// @return true if this token is an identifier and is equal to ident. - bool operator==(std::string_view ident); + bool operator==(std::string_view ident) const; + + /// Sets the token to the given type + /// @param type the type to set + void SetType(Token::Type type) { type_ = type; } /// Returns true if the token is of the given type /// @param t the type to check against. @@ -331,6 +334,8 @@ class Token { /// @returns true if the token is uninitialized bool IsUninitialized() const { return type_ == Type::kUninitialized; } + /// @returns true if the token is a placeholder + bool IsPlaceholder() const { return type_ == Type::kPlaceholder; } /// @returns true if the token is EOF bool IsEof() const { return type_ == Type::kEOF; } /// @returns true if the token is Error @@ -339,9 +344,10 @@ class Token { bool IsIdentifier() const { return type_ == Type::kIdentifier; } /// @returns true if the token is a literal bool IsLiteral() const { - return type_ == Type::kIntLiteral || type_ == Type::kIntILiteral || - type_ == Type::kIntULiteral || type_ == Type::kFalse || type_ == Type::kTrue || - type_ == Type::kFloatLiteral; + return type_ == Type::kIntLiteral || type_ == Type::kIntLiteral_I || + type_ == Type::kIntLiteral_U || type_ == Type::kFalse || type_ == Type::kTrue || + type_ == Type::kFloatLiteral || type_ == Type::kFloatLiteral_F || + type_ == Type::kFloatLiteral_H; } /// @returns true if token is a 'matNxM' bool IsMatrix() const { @@ -371,16 +377,25 @@ class Token { return type_ == Type::kVec2 || type_ == Type::kVec3 || type_ == Type::kVec4; } + /// @returns true if the token can be split during parse into component tokens + bool IsSplittable() const { + return Is(Token::Type::kShiftRight) || Is(Token::Type::kGreaterThanEqual) || + Is(Token::Type::kAndAnd) || Is(Token::Type::kMinusMinus); + } + /// @returns the source information for this token Source source() const { return source_; } + /// @returns the type of the token + Type type() const { return type_; } + /// Returns the string value of the token /// @return std::string std::string to_str() const; /// Returns the float value of the token. 0 is returned if the token does not /// contain a float value. - /// @return float - float to_f32() const; + /// @return double + double to_f64() const; /// Returns the int64_t value of the token. 0 is returned if the token does /// not contain an integer value. /// @return int64_t @@ -395,7 +410,7 @@ class Token { /// The source where the token appeared Source source_; /// The value represented by the token - std::variant value_; + std::variant value_; }; #ifndef NDEBUG diff --git a/src/tint/reader/wgsl/token_test.cc b/src/tint/reader/wgsl/token_test.cc index dd46616974..fd4515fabb 100644 --- a/src/tint/reader/wgsl/token_test.cc +++ b/src/tint/reader/wgsl/token_test.cc @@ -16,46 +16,53 @@ #include -#include "gtest/gtest.h" +#include "gmock/gmock.h" namespace tint::reader::wgsl { namespace { +using ::testing::EndsWith; +using ::testing::Not; +using ::testing::StartsWith; + using TokenTest = testing::Test; -TEST_F(TokenTest, ReturnsF32) { - Token t1(Source{}, -2.345f); - EXPECT_EQ(t1.to_f32(), -2.345f); +TEST_F(TokenTest, ReturnsF64) { + Token t1(Token::Type::kFloatLiteral_F, Source{}, -2.345); + EXPECT_EQ(t1.to_f64(), -2.345); - Token t2(Source{}, 2.345f); - EXPECT_EQ(t2.to_f32(), 2.345f); + Token t2(Token::Type::kFloatLiteral_F, Source{}, 2.345); + EXPECT_EQ(t2.to_f64(), 2.345); } TEST_F(TokenTest, ReturnsI32) { - Token t1(Token::Type::kIntILiteral, Source{}, -2345); + Token t1(Token::Type::kIntLiteral_I, Source{}, static_cast(-2345)); EXPECT_EQ(t1.to_i64(), -2345); - Token t2(Token::Type::kIntILiteral, Source{}, 2345); + Token t2(Token::Type::kIntLiteral_I, Source{}, static_cast(2345)); EXPECT_EQ(t2.to_i64(), 2345); } TEST_F(TokenTest, HandlesMaxI32) { - Token t1(Token::Type::kIntILiteral, Source{}, std::numeric_limits::max()); + Token t1(Token::Type::kIntLiteral_I, Source{}, + static_cast(std::numeric_limits::max())); EXPECT_EQ(t1.to_i64(), std::numeric_limits::max()); } TEST_F(TokenTest, HandlesMinI32) { - Token t1(Token::Type::kIntILiteral, Source{}, std::numeric_limits::min()); + Token t1(Token::Type::kIntLiteral_I, Source{}, + static_cast(std::numeric_limits::min())); EXPECT_EQ(t1.to_i64(), std::numeric_limits::min()); } TEST_F(TokenTest, ReturnsU32) { - Token t2(Token::Type::kIntULiteral, Source{}, 2345u); + Token t2(Token::Type::kIntLiteral_U, Source{}, static_cast(2345u)); EXPECT_EQ(t2.to_i64(), 2345u); } TEST_F(TokenTest, ReturnsMaxU32) { - Token t1(Token::Type::kIntULiteral, Source{}, std::numeric_limits::max()); + Token t1(Token::Type::kIntLiteral_U, Source{}, + static_cast(std::numeric_limits::max())); EXPECT_EQ(t1.to_i64(), std::numeric_limits::max()); } @@ -71,5 +78,21 @@ TEST_F(TokenTest, Source) { EXPECT_EQ(t.source().range.end.column, 3u); } +TEST_F(TokenTest, ToStr) { + double d = 123.0; + int64_t i = 123; + EXPECT_THAT(Token(Token::Type::kFloatLiteral, Source{}, d).to_str(), StartsWith("123")); + EXPECT_THAT(Token(Token::Type::kFloatLiteral, Source{}, d).to_str(), Not(EndsWith("f"))); + EXPECT_THAT(Token(Token::Type::kFloatLiteral_F, Source{}, d).to_str(), StartsWith("123")); + EXPECT_THAT(Token(Token::Type::kFloatLiteral_F, Source{}, d).to_str(), EndsWith("f")); + EXPECT_THAT(Token(Token::Type::kFloatLiteral_H, Source{}, d).to_str(), StartsWith("123")); + EXPECT_THAT(Token(Token::Type::kFloatLiteral_H, Source{}, d).to_str(), EndsWith("h")); + EXPECT_EQ(Token(Token::Type::kIntLiteral, Source{}, i).to_str(), "123"); + EXPECT_EQ(Token(Token::Type::kIntLiteral_I, Source{}, i).to_str(), "123i"); + EXPECT_EQ(Token(Token::Type::kIntLiteral_U, Source{}, i).to_str(), "123u"); + EXPECT_EQ(Token(Token::Type::kIdentifier, Source{}, "blah").to_str(), "blah"); + EXPECT_EQ(Token(Token::Type::kError, Source{}, "blah").to_str(), "blah"); +} + } // namespace } // namespace tint::reader::wgsl diff --git a/src/tint/resolver/array_accessor_test.cc b/src/tint/resolver/array_accessor_test.cc index 17046992e6..a07f6dfd2a 100644 --- a/src/tint/resolver/array_accessor_test.cc +++ b/src/tint/resolver/array_accessor_test.cc @@ -16,6 +16,7 @@ #include "gmock/gmock.h" #include "src/tint/resolver/resolver_test_helper.h" +#include "src/tint/sem/index_accessor_expression.h" #include "src/tint/sem/reference.h" using namespace tint::number_suffixes; // NOLINT @@ -26,8 +27,8 @@ namespace { using ResolverIndexAccessorTest = ResolverTest; TEST_F(ResolverIndexAccessorTest, Matrix_Dynamic_F32) { - Global("my_var", ty.mat2x3(), ast::StorageClass::kPrivate); - auto* acc = IndexAccessor("my_var", Expr(Source{{12, 34}}, 1.0f)); + GlobalVar("my_var", ty.mat2x3(), ast::StorageClass::kPrivate); + auto* acc = IndexAccessor("my_var", Expr(Source{{12, 34}}, 1_f)); WrapInFunction(acc); EXPECT_FALSE(r()->Resolve()); @@ -35,22 +36,32 @@ TEST_F(ResolverIndexAccessorTest, Matrix_Dynamic_F32) { } TEST_F(ResolverIndexAccessorTest, Matrix_Dynamic_Ref) { - Global("my_var", ty.mat2x3(), ast::StorageClass::kPrivate); + GlobalVar("my_var", ty.mat2x3(), ast::StorageClass::kPrivate); auto* idx = Var("idx", ty.i32(), Construct(ty.i32())); auto* acc = IndexAccessor("my_var", idx); WrapInFunction(Decl(idx), acc); EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } TEST_F(ResolverIndexAccessorTest, Matrix_BothDimensions_Dynamic_Ref) { - Global("my_var", ty.mat4x4(), ast::StorageClass::kPrivate); + GlobalVar("my_var", ty.mat4x4(), ast::StorageClass::kPrivate); auto* idx = Var("idx", ty.u32(), Expr(3_u)); auto* idy = Var("idy", ty.u32(), Expr(2_u)); auto* acc = IndexAccessor(IndexAccessor("my_var", idx), idy); WrapInFunction(Decl(idx), Decl(idy), acc); EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } TEST_F(ResolverIndexAccessorTest, Matrix_Dynamic) { @@ -61,12 +72,17 @@ TEST_F(ResolverIndexAccessorTest, Matrix_Dynamic) { EXPECT_TRUE(r()->Resolve()); EXPECT_EQ(r()->error(), ""); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } TEST_F(ResolverIndexAccessorTest, Matrix_XDimension_Dynamic) { - GlobalConst("my_var", ty.mat4x4(), Construct(ty.mat4x4())); + GlobalConst("my_const", ty.mat4x4(), Construct(ty.mat4x4())); auto* idx = Var("idx", ty.u32(), Expr(3_u)); - auto* acc = IndexAccessor("my_var", Expr(Source{{12, 34}}, idx)); + auto* acc = IndexAccessor("my_const", Expr(Source{{12, 34}}, idx)); WrapInFunction(Decl(idx), acc); EXPECT_TRUE(r()->Resolve()); @@ -74,9 +90,9 @@ TEST_F(ResolverIndexAccessorTest, Matrix_XDimension_Dynamic) { } TEST_F(ResolverIndexAccessorTest, Matrix_BothDimension_Dynamic) { - GlobalConst("my_var", ty.mat4x4(), Construct(ty.mat4x4())); + GlobalConst("my_const", ty.mat4x4(), Construct(ty.mat4x4())); auto* idx = Var("idy", ty.u32(), Expr(2_u)); - auto* acc = IndexAccessor(IndexAccessor("my_var", Expr(Source{{12, 34}}, idx)), 1_i); + auto* acc = IndexAccessor(IndexAccessor("my_const", Expr(Source{{12, 34}}, idx)), 1_i); WrapInFunction(Decl(idx), acc); EXPECT_TRUE(r()->Resolve()); @@ -84,7 +100,7 @@ TEST_F(ResolverIndexAccessorTest, Matrix_BothDimension_Dynamic) { } TEST_F(ResolverIndexAccessorTest, Matrix) { - Global("my_var", ty.mat2x3(), ast::StorageClass::kPrivate); + GlobalVar("my_var", ty.mat2x3(), ast::StorageClass::kPrivate); auto* acc = IndexAccessor("my_var", 2_i); WrapInFunction(acc); @@ -97,10 +113,15 @@ TEST_F(ResolverIndexAccessorTest, Matrix) { auto* ref = TypeOf(acc)->As(); ASSERT_TRUE(ref->StoreType()->Is()); EXPECT_EQ(ref->StoreType()->As()->Width(), 3u); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } TEST_F(ResolverIndexAccessorTest, Matrix_BothDimensions) { - Global("my_var", ty.mat2x3(), ast::StorageClass::kPrivate); + GlobalVar("my_var", ty.mat2x3(), ast::StorageClass::kPrivate); auto* acc = IndexAccessor(IndexAccessor("my_var", 2_i), 1_i); WrapInFunction(acc); @@ -112,11 +133,16 @@ TEST_F(ResolverIndexAccessorTest, Matrix_BothDimensions) { auto* ref = TypeOf(acc)->As(); EXPECT_TRUE(ref->StoreType()->Is()); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } TEST_F(ResolverIndexAccessorTest, Vector_F32) { - Global("my_var", ty.vec3(), ast::StorageClass::kPrivate); - auto* acc = IndexAccessor("my_var", Expr(Source{{12, 34}}, 2.0f)); + GlobalVar("my_var", ty.vec3(), ast::StorageClass::kPrivate); + auto* acc = IndexAccessor("my_var", Expr(Source{{12, 34}}, 2_f)); WrapInFunction(acc); EXPECT_FALSE(r()->Resolve()); @@ -124,25 +150,30 @@ TEST_F(ResolverIndexAccessorTest, Vector_F32) { } TEST_F(ResolverIndexAccessorTest, Vector_Dynamic_Ref) { - Global("my_var", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("my_var", ty.vec3(), ast::StorageClass::kPrivate); auto* idx = Var("idx", ty.i32(), Expr(2_i)); auto* acc = IndexAccessor("my_var", idx); WrapInFunction(Decl(idx), acc); EXPECT_TRUE(r()->Resolve()); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } TEST_F(ResolverIndexAccessorTest, Vector_Dynamic) { - GlobalConst("my_var", ty.vec3(), Construct(ty.vec3())); + GlobalConst("my_const", ty.vec3(), Construct(ty.vec3())); auto* idx = Var("idx", ty.i32(), Expr(2_i)); - auto* acc = IndexAccessor("my_var", Expr(Source{{12, 34}}, idx)); + auto* acc = IndexAccessor("my_const", Expr(Source{{12, 34}}, idx)); WrapInFunction(Decl(idx), acc); EXPECT_TRUE(r()->Resolve()); } TEST_F(ResolverIndexAccessorTest, Vector) { - Global("my_var", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("my_var", ty.vec3(), ast::StorageClass::kPrivate); auto* acc = IndexAccessor("my_var", 2_i); WrapInFunction(acc); @@ -154,28 +185,65 @@ TEST_F(ResolverIndexAccessorTest, Vector) { auto* ref = TypeOf(acc)->As(); EXPECT_TRUE(ref->StoreType()->Is()); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } -TEST_F(ResolverIndexAccessorTest, Array) { - auto* idx = Expr(2_i); - Global("my_var", ty.array(), ast::StorageClass::kPrivate); - - auto* acc = IndexAccessor("my_var", idx); +TEST_F(ResolverIndexAccessorTest, Array_Literal_i32) { + GlobalVar("my_var", ty.array(), ast::StorageClass::kPrivate); + auto* acc = IndexAccessor("my_var", 2_i); WrapInFunction(acc); - EXPECT_TRUE(r()->Resolve()) << r()->error(); - ASSERT_NE(TypeOf(acc), nullptr); - ASSERT_TRUE(TypeOf(acc)->Is()); - auto* ref = TypeOf(acc)->As(); + ASSERT_NE(ref, nullptr); EXPECT_TRUE(ref->StoreType()->Is()); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); +} + +TEST_F(ResolverIndexAccessorTest, Array_Literal_u32) { + GlobalVar("my_var", ty.array(), ast::StorageClass::kPrivate); + auto* acc = IndexAccessor("my_var", 2_u); + WrapInFunction(acc); + EXPECT_TRUE(r()->Resolve()) << r()->error(); + ASSERT_NE(TypeOf(acc), nullptr); + auto* ref = TypeOf(acc)->As(); + ASSERT_NE(ref, nullptr); + EXPECT_TRUE(ref->StoreType()->Is()); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); +} + +TEST_F(ResolverIndexAccessorTest, Array_Literal_AInt) { + GlobalVar("my_var", ty.array(), ast::StorageClass::kPrivate); + auto* acc = IndexAccessor("my_var", 2_a); + WrapInFunction(acc); + EXPECT_TRUE(r()->Resolve()) << r()->error(); + ASSERT_NE(TypeOf(acc), nullptr); + auto* ref = TypeOf(acc)->As(); + ASSERT_NE(ref, nullptr); + EXPECT_TRUE(ref->StoreType()->Is()); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } TEST_F(ResolverIndexAccessorTest, Alias_Array) { auto* aary = Alias("myarrty", ty.array()); - Global("my_var", ty.Of(aary), ast::StorageClass::kPrivate); + GlobalVar("my_var", ty.Of(aary), ast::StorageClass::kPrivate); auto* acc = IndexAccessor("my_var", 2_i); WrapInFunction(acc); @@ -187,12 +255,17 @@ TEST_F(ResolverIndexAccessorTest, Alias_Array) { auto* ref = TypeOf(acc)->As(); EXPECT_TRUE(ref->StoreType()->Is()); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } TEST_F(ResolverIndexAccessorTest, Array_Constant) { - GlobalConst("my_var", ty.array(), array()); + GlobalConst("my_const", ty.array(), array()); - auto* acc = IndexAccessor("my_var", 2_i); + auto* acc = IndexAccessor("my_const", 2_i); WrapInFunction(acc); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -207,30 +280,34 @@ TEST_F(ResolverIndexAccessorTest, Array_Dynamic_I32) { // var f : f32 = a[idx]; auto* a = Let("a", ty.array(), array()); auto* idx = Var("idx", ty.i32(), Construct(ty.i32())); - auto* f = Var("f", ty.f32(), IndexAccessor("a", Expr(Source{{12, 34}}, idx))); - Func("my_func", ast::VariableList{}, ty.void_(), - { + auto* acc = IndexAccessor("a", Expr(Source{{12, 34}}, idx)); + auto* f = Var("f", ty.f32(), acc); + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(a), Decl(idx), Decl(f), - }, - ast::AttributeList{}); + }); EXPECT_TRUE(r()->Resolve()); EXPECT_EQ(r()->error(), ""); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } TEST_F(ResolverIndexAccessorTest, Array_Literal_F32) { // let a : array; // var f : f32 = a[2.0f]; auto* a = Let("a", ty.array(), array()); - auto* f = Var("a_2", ty.f32(), IndexAccessor("a", Expr(Source{{12, 34}}, 2.0f))); - Func("my_func", ast::VariableList{}, ty.void_(), - { + auto* f = Var("a_2", ty.f32(), IndexAccessor("a", Expr(Source{{12, 34}}, 2_f))); + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(a), Decl(f), - }, - ast::AttributeList{}); + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: index must be of type 'i32' or 'u32', found: 'f32'"); } @@ -239,17 +316,22 @@ TEST_F(ResolverIndexAccessorTest, Array_Literal_I32) { // let a : array; // var f : f32 = a[2i]; auto* a = Let("a", ty.array(), array()); - auto* f = Var("a_2", ty.f32(), IndexAccessor("a", 2_i)); - Func("my_func", ast::VariableList{}, ty.void_(), - { + auto* acc = IndexAccessor("a", 2_i); + auto* f = Var("a_2", ty.f32(), acc); + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(a), Decl(f), - }, - ast::AttributeList{}); + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } -TEST_F(ResolverIndexAccessorTest, EXpr_Deref_FuncGoodParent) { +TEST_F(ResolverIndexAccessorTest, Expr_Deref_FuncGoodParent) { // fn func(p: ptr>) -> f32 { // let idx: u32 = u32(); // let x: f32 = (*p)[idx]; @@ -258,14 +340,19 @@ TEST_F(ResolverIndexAccessorTest, EXpr_Deref_FuncGoodParent) { auto* p = Param("p", ty.pointer(ty.vec4(), ast::StorageClass::kFunction)); auto* idx = Let("idx", ty.u32(), Construct(ty.u32())); auto* star_p = Deref(p); - auto* accessor_expr = IndexAccessor(Source{{12, 34}}, star_p, idx); - auto* x = Var("x", ty.f32(), accessor_expr); - Func("func", {p}, ty.f32(), {Decl(idx), Decl(x), Return(x)}); + auto* acc = IndexAccessor(Source{{12, 34}}, star_p, idx); + auto* x = Var("x", ty.f32(), acc); + Func("func", utils::Vector{p}, ty.f32(), utils::Vector{Decl(idx), Decl(x), Return(x)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto idx_sem = Sem().Get(acc); + ASSERT_NE(idx_sem, nullptr); + EXPECT_EQ(idx_sem->Index()->Declaration(), acc->index); + EXPECT_EQ(idx_sem->Object()->Declaration(), acc->object); } -TEST_F(ResolverIndexAccessorTest, EXpr_Deref_FuncBadParent) { +TEST_F(ResolverIndexAccessorTest, Expr_Deref_FuncBadParent) { // fn func(p: ptr>) -> f32 { // let idx: u32 = u32(); // let x: f32 = *p[idx]; @@ -276,7 +363,7 @@ TEST_F(ResolverIndexAccessorTest, EXpr_Deref_FuncBadParent) { auto* accessor_expr = IndexAccessor(Source{{12, 34}}, p, idx); auto* star_p = Deref(accessor_expr); auto* x = Var("x", ty.f32(), star_p); - Func("func", {p}, ty.f32(), {Decl(idx), Decl(x), Return(x)}); + Func("func", utils::Vector{p}, ty.f32(), utils::Vector{Decl(idx), Decl(x), Return(x)}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), diff --git a/src/tint/resolver/assignment_validation_test.cc b/src/tint/resolver/assignment_validation_test.cc index f12f80437c..8985e5d8f5 100644 --- a/src/tint/resolver/assignment_validation_test.cc +++ b/src/tint/resolver/assignment_validation_test.cc @@ -29,12 +29,11 @@ TEST_F(ResolverAssignmentValidationTest, ReadOnlyBuffer) { // struct S { m : i32 }; // @group(0) @binding(0) // var a : S; - auto* s = Structure("S", {Member("m", ty.i32())}); - Global(Source{{12, 34}}, "a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + auto* s = Structure("S", utils::Vector{ + Member("m", ty.i32()), + }); + GlobalVar(Source{{12, 34}}, "a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, + Binding(0), Group(0)); WrapInFunction(Assign(Source{{56, 78}}, MemberAccessor("a", "m"), 1_i)); @@ -50,9 +49,9 @@ TEST_F(ResolverAssignmentValidationTest, AssignIncompatibleTypes) { // a = 2.3; // } - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* var = Var("a", ty.i32(), Expr(2_i)); - auto* assign = Assign(Source{{12, 34}}, "a", 2.3f); + auto* assign = Assign(Source{{12, 34}}, "a", 2.3_f); WrapInFunction(var, assign); ASSERT_FALSE(r()->Resolve()); @@ -61,14 +60,14 @@ TEST_F(ResolverAssignmentValidationTest, AssignIncompatibleTypes) { } TEST_F(ResolverAssignmentValidationTest, AssignArraysWithDifferentSizeExpressions_Pass) { - // let len = 4u; + // const len = 4u; // { // var a : array; // var b : array; // a = b; // } - GlobalConst("len", nullptr, Expr(4_u)); + GlobalConst("len", Expr(4_u)); auto* a = Var("a", ty.array(ty.f32(), 4_u)); auto* b = Var("b", ty.array(ty.f32(), "len")); @@ -80,14 +79,14 @@ TEST_F(ResolverAssignmentValidationTest, AssignArraysWithDifferentSizeExpression } TEST_F(ResolverAssignmentValidationTest, AssignArraysWithDifferentSizeExpressions_Fail) { - // let len = 5u; + // const len = 5u; // { // var a : array; // var b : array; // a = b; // } - GlobalConst("len", nullptr, Expr(5_u)); + GlobalConst("len", Expr(5_u)); auto* a = Var("a", ty.array(ty.f32(), 4_u)); auto* b = Var("b", ty.array(ty.f32(), "len")); @@ -105,7 +104,7 @@ TEST_F(ResolverAssignmentValidationTest, AssignCompatibleTypesInBlockStatement_P // var a : i32 = 2i; // a = 2i // } - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* var = Var("a", ty.i32(), Expr(2_i)); WrapInFunction(var, Assign("a", 2_i)); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -117,8 +116,8 @@ TEST_F(ResolverAssignmentValidationTest, AssignIncompatibleTypesInBlockStatement // a = 2.3; // } - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); - WrapInFunction(var, Assign(Source{{12, 34}}, "a", 2.3f)); + auto* var = Var("a", ty.i32(), Expr(2_i)); + WrapInFunction(var, Assign(Source{{12, 34}}, "a", 2.3_f)); ASSERT_FALSE(r()->Resolve()); @@ -133,8 +132,8 @@ TEST_F(ResolverAssignmentValidationTest, AssignIncompatibleTypesInNestedBlockSta // } // } - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); - auto* inner_block = Block(Decl(var), Assign(Source{{12, 34}}, "a", 2.3f)); + auto* var = Var("a", ty.i32(), Expr(2_i)); + auto* inner_block = Block(Decl(var), Assign(Source{{12, 34}}, "a", 2.3_f)); auto* outer_block = Block(inner_block); WrapInFunction(outer_block); @@ -147,29 +146,33 @@ TEST_F(ResolverAssignmentValidationTest, AssignToScalar_Fail) { // var my_var : i32 = 2i; // 1 = my_var; - auto* var = Var("my_var", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); - WrapInFunction(var, Assign(Expr(Source{{12, 34}}, 1_i), "my_var")); + WrapInFunction(Var("my_var", ty.i32(), Expr(2_i)), // + Assign(Expr(Source{{12, 34}}, 1_i), "my_var")); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: cannot assign to value of type 'i32'"); } TEST_F(ResolverAssignmentValidationTest, AssignCompatibleTypes_Pass) { - // var a : i32 = 2i; - // a = 2i - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); - WrapInFunction(var, Assign(Source{{12, 34}}, "a", 2_i)); + // var a : i32 = 1i; + // a = 2i; + // a = 3; + WrapInFunction(Var("a", ty.i32(), Expr(1_i)), // + Assign("a", 2_i), // + Assign("a", 3_a)); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverAssignmentValidationTest, AssignCompatibleTypesThroughAlias_Pass) { - // alias myint = i32; - // var a : myint = 2i; - // a = 2 - auto* myint = Alias("myint", ty.i32()); - auto* var = Var("a", ty.Of(myint), ast::StorageClass::kNone, Expr(2_i)); - WrapInFunction(var, Assign(Source{{12, 34}}, "a", 2_i)); + // alias myint = u32; + // var a : myint = 1u; + // a = 2u; + // a = 3; + auto* myint = Alias("myint", ty.u32()); + WrapInFunction(Var("a", ty.Of(myint), Expr(1_u)), // + Assign("a", 2_u), // + Assign("a", 3_a)); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -178,9 +181,9 @@ TEST_F(ResolverAssignmentValidationTest, AssignCompatibleTypesInferRHSLoad_Pass) // var a : i32 = 2i; // var b : i32 = 3i; // a = b; - auto* var_a = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); - auto* var_b = Var("b", ty.i32(), ast::StorageClass::kNone, Expr(3_i)); - WrapInFunction(var_a, var_b, Assign(Source{{12, 34}}, "a", "b")); + WrapInFunction(Var("a", ty.i32(), Expr(2_i)), // + Var("b", ty.i32(), Expr(3_i)), // + Assign("a", "b")); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -190,14 +193,26 @@ TEST_F(ResolverAssignmentValidationTest, AssignThroughPointer_Pass) { // let b : ptr = &a; // *b = 2i; const auto func = ast::StorageClass::kFunction; - auto* var_a = Var("a", ty.i32(), func, Expr(2_i)); - auto* var_b = Let("b", ty.pointer(func), AddressOf(Expr("a"))); - WrapInFunction(var_a, var_b, Assign(Source{{12, 34}}, Deref("b"), 2_i)); + WrapInFunction(Var("a", ty.i32(), func, Expr(2_i)), // + Let("b", ty.pointer(func), AddressOf(Expr("a"))), // + Assign(Deref("b"), 2_i)); EXPECT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverAssignmentValidationTest, AssignToConstant_Fail) { +TEST_F(ResolverAssignmentValidationTest, AssignMaterializedThroughPointer_Pass) { + // var a : i32; + // let b : ptr = &a; + // *b = 2; + const auto func = ast::StorageClass::kFunction; + auto* var_a = Var("a", ty.i32(), func, Expr(2_i)); + auto* var_b = Let("b", ty.pointer(func), AddressOf(Expr("a"))); + WrapInFunction(var_a, var_b, Assign(Deref("b"), 2_a)); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverAssignmentValidationTest, AssignToLet_Fail) { // { // let a : i32 = 2i; // a = 2i @@ -206,7 +221,7 @@ TEST_F(ResolverAssignmentValidationTest, AssignToConstant_Fail) { WrapInFunction(var, Assign(Expr(Source{{12, 34}}, "a"), 2_i)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: cannot assign to const\nnote: 'a' is declared here:"); + EXPECT_EQ(r()->error(), "12:34 error: cannot assign to 'let'\nnote: 'a' is declared here:"); } TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_Handle) { @@ -219,16 +234,8 @@ TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_Handle) { ast::Access::kWrite); }; - Global("a", make_type(), ast::StorageClass::kNone, - ast::AttributeList{ - create(0), - create(0), - }); - Global("b", make_type(), ast::StorageClass::kNone, - ast::AttributeList{ - create(1), - create(0), - }); + GlobalVar("a", make_type(), Binding(0), Group(0)); + GlobalVar("b", make_type(), Binding(1), Group(0)); WrapInFunction(Assign(Source{{56, 78}}, "a", "b")); @@ -241,12 +248,11 @@ TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_Atomic) { // @group(0) @binding(0) var v : S; // v.a = v.a; - auto* s = Structure("S", {Member("a", ty.atomic(ty.i32()))}); - Global(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + auto* s = Structure("S", utils::Vector{ + Member("a", ty.atomic(ty.i32())), + }); + GlobalVar(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, + Binding(0), Group(0)); WrapInFunction(Assign(Source{{56, 78}}, MemberAccessor("v", "a"), MemberAccessor("v", "a"))); @@ -259,12 +265,11 @@ TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_RuntimeArray) { // @group(0) @binding(0) var v : S; // v.a = v.a; - auto* s = Structure("S", {Member("a", ty.array(ty.f32()))}); - Global(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + auto* s = Structure("S", utils::Vector{ + Member("a", ty.array(ty.f32())), + }); + GlobalVar(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, + Binding(0), Group(0)); WrapInFunction(Assign(Source{{56, 78}}, MemberAccessor("v", "a"), MemberAccessor("v", "a"))); @@ -280,8 +285,10 @@ TEST_F(ResolverAssignmentValidationTest, AssignToPhony_NonConstructibleStruct_Fa // fn f() { // _ = s; // } - auto* s = Structure("S", {Member("arr", ty.array())}); - Global("s", ty.Of(s), ast::StorageClass::kStorage, GroupAndBinding(0, 0)); + auto* s = Structure("S", utils::Vector{ + Member("arr", ty.array()), + }); + GlobalVar("s", ty.Of(s), ast::StorageClass::kStorage, Group(0), Binding(0)); WrapInFunction(Assign(Phony(), Expr(Source{{12, 34}}, "s"))); @@ -300,8 +307,10 @@ TEST_F(ResolverAssignmentValidationTest, AssignToPhony_DynamicArray_Fail) { // fn f() { // _ = s.arr; // } - auto* s = Structure("S", {Member("arr", ty.array())}); - Global("s", ty.Of(s), ast::StorageClass::kStorage, GroupAndBinding(0, 0)); + auto* s = Structure("S", utils::Vector{ + Member("arr", ty.array()), + }); + GlobalVar("s", ty.Of(s), ast::StorageClass::kStorage, Group(0), Binding(0)); WrapInFunction(Assign(Phony(), MemberAccessor(Source{{12, 34}}, "s", "arr"))); @@ -328,8 +337,12 @@ TEST_F(ResolverAssignmentValidationTest, AssignToPhony_Pass) { // fn f() { // _ = 1i; // _ = 2u; - // _ = 3.0; - // _ = vec2(); + // _ = 3.0f; + // _ = 4; + // _ = 5.0; + // _ = vec2(6); + // _ = vec3(7.0); + // _ = vec4(); // _ = tex; // _ = smp; // _ = &s; @@ -340,21 +353,28 @@ TEST_F(ResolverAssignmentValidationTest, AssignToPhony_Pass) { // _ = wg; // _ = wg[3i]; // } - auto* S = Structure("S", { + auto* S = Structure("S", utils::Vector{ Member("i", ty.i32()), Member("arr", ty.array()), }); - auto* U = Structure("U", {Member("i", ty.i32())}); - Global("tex", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), GroupAndBinding(0, 0)); - Global("smp", ty.sampler(ast::SamplerKind::kSampler), GroupAndBinding(0, 1)); - Global("u", ty.Of(U), ast::StorageClass::kUniform, GroupAndBinding(0, 2)); - Global("s", ty.Of(S), ast::StorageClass::kStorage, GroupAndBinding(0, 3)); - Global("wg", ty.array(), ast::StorageClass::kWorkgroup); + auto* U = Structure("U", utils::Vector{ + Member("i", ty.i32()), + }); + GlobalVar("tex", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), Group(0), + Binding(0)); + GlobalVar("smp", ty.sampler(ast::SamplerKind::kSampler), Group(0), Binding(1)); + GlobalVar("u", ty.Of(U), ast::StorageClass::kUniform, Group(0), Binding(2)); + GlobalVar("s", ty.Of(S), ast::StorageClass::kStorage, Group(0), Binding(3)); + GlobalVar("wg", ty.array(), ast::StorageClass::kWorkgroup); WrapInFunction(Assign(Phony(), 1_i), // Assign(Phony(), 2_u), // - Assign(Phony(), 3.f), // - Assign(Phony(), vec2()), // + Assign(Phony(), 3_f), // + Assign(Phony(), 4_a), // + Assign(Phony(), 5.0_a), // + Assign(Phony(), vec(nullptr, 2u, 6_a)), // + Assign(Phony(), vec(nullptr, 3u, 7.0_a)), // + Assign(Phony(), vec4()), // Assign(Phony(), "tex"), // Assign(Phony(), "smp"), // Assign(Phony(), AddressOf("s")), // diff --git a/src/tint/resolver/atomics_test.cc b/src/tint/resolver/atomics_test.cc index c0fe5ce299..405bc27ad8 100644 --- a/src/tint/resolver/atomics_test.cc +++ b/src/tint/resolver/atomics_test.cc @@ -25,7 +25,7 @@ namespace { struct ResolverAtomicTest : public resolver::TestHelper, public testing::Test {}; TEST_F(ResolverAtomicTest, GlobalWorkgroupI32) { - auto* g = Global("a", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kWorkgroup); + auto* g = GlobalVar("a", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kWorkgroup); EXPECT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(TypeOf(g)->Is()); @@ -35,7 +35,7 @@ TEST_F(ResolverAtomicTest, GlobalWorkgroupI32) { } TEST_F(ResolverAtomicTest, GlobalWorkgroupU32) { - auto* g = Global("a", ty.atomic(Source{{12, 34}}, ty.u32()), ast::StorageClass::kWorkgroup); + auto* g = GlobalVar("a", ty.atomic(Source{{12, 34}}, ty.u32()), ast::StorageClass::kWorkgroup); EXPECT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(TypeOf(g)->Is()); @@ -45,12 +45,9 @@ TEST_F(ResolverAtomicTest, GlobalWorkgroupU32) { } TEST_F(ResolverAtomicTest, GlobalStorageStruct) { - auto* s = Structure("s", {Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); - auto* g = Global("g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + auto* s = Structure("s", utils::Vector{Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); + auto* g = GlobalVar("g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, + Binding(0), Group(0)); EXPECT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(TypeOf(g)->Is()); diff --git a/src/tint/resolver/atomics_validation_test.cc b/src/tint/resolver/atomics_validation_test.cc index 78c1fb94f7..eb4f43e1a6 100644 --- a/src/tint/resolver/atomics_validation_test.cc +++ b/src/tint/resolver/atomics_validation_test.cc @@ -27,35 +27,35 @@ namespace { struct ResolverAtomicValidationTest : public resolver::TestHelper, public testing::Test {}; TEST_F(ResolverAtomicValidationTest, StorageClass_WorkGroup) { - Global("a", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kWorkgroup); EXPECT_TRUE(r()->Resolve()); } TEST_F(ResolverAtomicValidationTest, StorageClass_Storage) { - Global("g", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kStorage, - ast::Access::kReadWrite, GroupAndBinding(0, 0)); + GlobalVar("g", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kStorage, + ast::Access::kReadWrite, Group(0), Binding(0)); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverAtomicValidationTest, StorageClass_Storage_Struct) { - auto* s = Structure("s", {Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); - Global("g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - GroupAndBinding(0, 0)); + auto* s = Structure("s", utils::Vector{Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); + GlobalVar("g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Group(0), + Binding(0)); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverAtomicValidationTest, InvalidType) { - Global("a", ty.atomic(ty.f32(Source{{12, 34}})), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.atomic(ty.f32(Source{{12, 34}})), ast::StorageClass::kWorkgroup); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: atomic only supports i32 or u32 types"); } TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_Simple) { - Global("a", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kPrivate); + GlobalVar("a", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -64,7 +64,7 @@ TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_Simple) { } TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_Array) { - Global("a", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kPrivate); + GlobalVar("a", ty.atomic(Source{{12, 34}}, ty.i32()), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -73,8 +73,8 @@ TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_Array) { } TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_Struct) { - auto* s = Structure("s", {Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + auto* s = Structure("s", utils::Vector{Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -88,9 +88,10 @@ TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_StructOfStruct) { // struct Outer { m : array; }; // var g : Outer; - auto* Inner = Structure("Inner", {Member("m", ty.atomic(Source{{12, 34}}, ty.i32()))}); - auto* Outer = Structure("Outer", {Member("m", ty.Of(Inner))}); - Global("g", ty.Of(Outer), ast::StorageClass::kPrivate); + auto* Inner = + Structure("Inner", utils::Vector{Member("m", ty.atomic(Source{{12, 34}}, ty.i32()))}); + auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))}); + GlobalVar("g", ty.Of(Outer), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -104,9 +105,10 @@ TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_StructOfStructOfArray) // struct Outer { m : array; }; // var g : Outer; - auto* Inner = Structure("Inner", {Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))}); - auto* Outer = Structure("Outer", {Member("m", ty.Of(Inner))}); - Global("g", ty.Of(Outer), ast::StorageClass::kPrivate); + auto* Inner = + Structure("Inner", utils::Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))}); + auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))}); + GlobalVar("g", ty.Of(Outer), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -121,7 +123,7 @@ TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_ArrayOfArray) { auto* atomic_array = Alias(Source{{12, 34}}, "AtomicArray", ty.atomic(Source{{12, 34}}, ty.i32())); - Global(Source{{56, 78}}, "v", ty.Of(atomic_array), ast::StorageClass::kPrivate); + GlobalVar(Source{{56, 78}}, "v", ty.Of(atomic_array), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -135,8 +137,8 @@ TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_ArrayOfStruct) { // }; // var v: array; - auto* s = Structure("S", {Member("m", ty.atomic())}); - Global(Source{{56, 78}}, "v", ty.array(ty.Of(s), 5_u), ast::StorageClass::kPrivate); + auto* s = Structure("S", utils::Vector{Member("m", ty.atomic())}); + GlobalVar(Source{{56, 78}}, "v", ty.array(ty.Of(s), 5_u), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -154,8 +156,8 @@ TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_ArrayOfStructOfArray) { auto* atomic_array = Alias(Source{{12, 34}}, "AtomicArray", ty.atomic(Source{{12, 34}}, ty.i32())); - auto* s = Structure("S", {Member("m", ty.Of(atomic_array))}); - Global(Source{{56, 78}}, "v", ty.array(ty.Of(s), 5_u), ast::StorageClass::kPrivate); + auto* s = Structure("S", utils::Vector{Member("m", ty.Of(atomic_array))}); + GlobalVar(Source{{56, 78}}, "v", ty.array(ty.Of(s), 5_u), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -185,18 +187,18 @@ TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_Complex) { auto* array_atomic_u32_8 = ty.array(ty.atomic(ty.u32()), 8_u); auto* array_atomic_i32_4 = ty.array(ty.atomic(ty.i32()), 4_u); - auto* s6 = Structure("S6", {Member("x", array_i32_4)}); - auto* s5 = Structure("S5", {Member("x", ty.Of(s6)), // - Member("y", ty.Of(atomic_array)), // - Member("z", array_atomic_u32_8)}); // - auto* s4 = Structure("S4", {Member("x", ty.Of(s6)), // - Member("y", ty.Of(s5)), // - Member("z", array_atomic_i32_4)}); // - auto* s3 = Structure("S3", {Member("x", ty.Of(s4))}); - auto* s2 = Structure("S2", {Member("x", ty.Of(s3))}); - auto* s1 = Structure("S1", {Member("x", ty.Of(s2))}); - auto* s0 = Structure("S0", {Member("x", ty.Of(s1))}); - Global(Source{{56, 78}}, "g", ty.Of(s0), ast::StorageClass::kPrivate); + auto* s6 = Structure("S6", utils::Vector{Member("x", array_i32_4)}); + auto* s5 = Structure("S5", utils::Vector{Member("x", ty.Of(s6)), // + Member("y", ty.Of(atomic_array)), // + Member("z", array_atomic_u32_8)}); // + auto* s4 = Structure("S4", utils::Vector{Member("x", ty.Of(s6)), // + Member("y", ty.Of(s5)), // + Member("z", array_atomic_i32_4)}); // + auto* s3 = Structure("S3", utils::Vector{Member("x", ty.Of(s4))}); + auto* s2 = Structure("S2", utils::Vector{Member("x", ty.Of(s3))}); + auto* s1 = Structure("S1", utils::Vector{Member("x", ty.Of(s2))}); + auto* s0 = Structure("S0", utils::Vector{Member("x", ty.Of(s1))}); + GlobalVar(Source{{56, 78}}, "g", ty.Of(s0), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -206,9 +208,9 @@ TEST_F(ResolverAtomicValidationTest, InvalidStorageClass_Complex) { } TEST_F(ResolverAtomicValidationTest, Struct_AccessMode_Read) { - auto* s = Structure("s", {Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); - Global(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - GroupAndBinding(0, 0)); + auto* s = Structure("s", utils::Vector{Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); + GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, + Group(0), Binding(0)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -218,9 +220,9 @@ TEST_F(ResolverAtomicValidationTest, Struct_AccessMode_Read) { } TEST_F(ResolverAtomicValidationTest, InvalidAccessMode_Struct) { - auto* s = Structure("s", {Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); - Global(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - GroupAndBinding(0, 0)); + auto* s = Structure("s", utils::Vector{Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))}); + GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, + Group(0), Binding(0)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -234,10 +236,11 @@ TEST_F(ResolverAtomicValidationTest, InvalidAccessMode_StructOfStruct) { // struct Outer { m : array; }; // var g : Outer; - auto* Inner = Structure("Inner", {Member("m", ty.atomic(Source{{12, 34}}, ty.i32()))}); - auto* Outer = Structure("Outer", {Member("m", ty.Of(Inner))}); - Global(Source{{56, 78}}, "g", ty.Of(Outer), ast::StorageClass::kStorage, ast::Access::kRead, - GroupAndBinding(0, 0)); + auto* Inner = + Structure("Inner", utils::Vector{Member("m", ty.atomic(Source{{12, 34}}, ty.i32()))}); + auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))}); + GlobalVar(Source{{56, 78}}, "g", ty.Of(Outer), ast::StorageClass::kStorage, ast::Access::kRead, + Group(0), Binding(0)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -251,10 +254,11 @@ TEST_F(ResolverAtomicValidationTest, InvalidAccessMode_StructOfStructOfArray) { // struct Outer { m : array; }; // var g : Outer; - auto* Inner = Structure("Inner", {Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))}); - auto* Outer = Structure("Outer", {Member("m", ty.Of(Inner))}); - Global(Source{{56, 78}}, "g", ty.Of(Outer), ast::StorageClass::kStorage, ast::Access::kRead, - GroupAndBinding(0, 0)); + auto* Inner = + Structure("Inner", utils::Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))}); + auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))}); + GlobalVar(Source{{56, 78}}, "g", ty.Of(Outer), ast::StorageClass::kStorage, ast::Access::kRead, + Group(0), Binding(0)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -284,19 +288,19 @@ TEST_F(ResolverAtomicValidationTest, InvalidAccessMode_Complex) { auto* array_atomic_u32_8 = ty.array(ty.atomic(ty.u32()), 8_u); auto* array_atomic_i32_4 = ty.array(ty.atomic(ty.i32()), 4_u); - auto* s6 = Structure("S6", {Member("x", array_i32_4)}); - auto* s5 = Structure("S5", {Member("x", ty.Of(s6)), // - Member("y", ty.Of(atomic_array)), // - Member("z", array_atomic_u32_8)}); // - auto* s4 = Structure("S4", {Member("x", ty.Of(s6)), // - Member("y", ty.Of(s5)), // - Member("z", array_atomic_i32_4)}); // - auto* s3 = Structure("S3", {Member("x", ty.Of(s4))}); - auto* s2 = Structure("S2", {Member("x", ty.Of(s3))}); - auto* s1 = Structure("S1", {Member("x", ty.Of(s2))}); - auto* s0 = Structure("S0", {Member("x", ty.Of(s1))}); - Global(Source{{56, 78}}, "g", ty.Of(s0), ast::StorageClass::kStorage, ast::Access::kRead, - GroupAndBinding(0, 0)); + auto* s6 = Structure("S6", utils::Vector{Member("x", array_i32_4)}); + auto* s5 = Structure("S5", utils::Vector{Member("x", ty.Of(s6)), // + Member("y", ty.Of(atomic_array)), // + Member("z", array_atomic_u32_8)}); // + auto* s4 = Structure("S4", utils::Vector{Member("x", ty.Of(s6)), // + Member("y", ty.Of(s5)), // + Member("z", array_atomic_i32_4)}); // + auto* s3 = Structure("S3", utils::Vector{Member("x", ty.Of(s4))}); + auto* s2 = Structure("S2", utils::Vector{Member("x", ty.Of(s3))}); + auto* s1 = Structure("S1", utils::Vector{Member("x", ty.Of(s2))}); + auto* s0 = Structure("S0", utils::Vector{Member("x", ty.Of(s1))}); + GlobalVar(Source{{56, 78}}, "g", ty.Of(s0), ast::StorageClass::kStorage, ast::Access::kRead, + Group(0), Binding(0)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -309,7 +313,7 @@ TEST_F(ResolverAtomicValidationTest, Local) { WrapInFunction(Var("a", ty.atomic(Source{{12, 34}}, ty.i32()))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: function variable must have a constructible type"); + EXPECT_EQ(r()->error(), "12:34 error: function-scope 'var' must have a constructible type"); } } // namespace diff --git a/src/tint/resolver/attribute_validation_test.cc b/src/tint/resolver/attribute_validation_test.cc index dbefb1487f..70d46123a7 100644 --- a/src/tint/resolver/attribute_validation_test.cc +++ b/src/tint/resolver/attribute_validation_test.cc @@ -84,16 +84,16 @@ struct TestParams { }; struct TestWithParams : ResolverTestWithParam {}; -static ast::AttributeList createAttributes(const Source& source, - ProgramBuilder& builder, - AttributeKind kind) { +static utils::Vector createAttributes(const Source& source, + ProgramBuilder& builder, + AttributeKind kind) { switch (kind) { case AttributeKind::kAlign: - return {builder.create(source, 4u)}; + return {builder.MemberAlign(source, 4_u)}; case AttributeKind::kBinding: return {builder.create(source, 1u)}; case AttributeKind::kBuiltin: - return {builder.Builtin(source, ast::Builtin::kPosition)}; + return {builder.Builtin(source, ast::BuiltinValue::kPosition)}; case AttributeKind::kGroup: return {builder.create(source, 1u)}; case AttributeKind::kId: @@ -128,8 +128,10 @@ TEST_P(FunctionParameterAttributeTest, IsValid) { auto& params = GetParam(); Func("main", - ast::VariableList{Param("a", ty.vec4(), createAttributes({}, *this, params.kind))}, - ty.void_(), {}); + utils::Vector{ + Param("a", ty.vec4(), createAttributes({}, *this, params.kind)), + }, + ty.void_(), utils::Empty); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -161,8 +163,11 @@ using FunctionReturnTypeAttributeTest = TestWithParams; TEST_P(FunctionReturnTypeAttributeTest, IsValid) { auto& params = GetParam(); - Func("main", ast::VariableList{}, ty.f32(), ast::StatementList{Return(1.f)}, {}, - createAttributes({}, *this, params.kind)); + Func("main", utils::Empty, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Empty, createAttributes({}, *this, params.kind)); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -195,9 +200,15 @@ namespace EntryPointInputAndOutputTests { using ComputeShaderParameterAttributeTest = TestWithParams; TEST_P(ComputeShaderParameterAttributeTest, IsValid) { auto& params = GetParam(); - auto* p = Param("a", ty.vec4(), createAttributes(Source{{12, 34}}, *this, params.kind)); - Func("main", ast::VariableList{p}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + Func("main", + utils::Vector{ + Param("a", ty.vec4(), createAttributes(Source{{12, 34}}, *this, params.kind)), + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -239,10 +250,13 @@ TEST_P(FragmentShaderParameterAttributeTest, IsValid) { auto& params = GetParam(); auto attrs = createAttributes(Source{{12, 34}}, *this, params.kind); if (params.kind != AttributeKind::kBuiltin && params.kind != AttributeKind::kLocation) { - attrs.push_back(Builtin(Source{{34, 56}}, ast::Builtin::kPosition)); + attrs.Push(Builtin(Source{{34, 56}}, ast::BuiltinValue::kPosition)); } auto* p = Param("a", ty.vec4(), attrs); - Func("frag_main", {p}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func("frag_main", utils::Vector{p}, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -273,11 +287,19 @@ TEST_P(VertexShaderParameterAttributeTest, IsValid) { auto& params = GetParam(); auto attrs = createAttributes(Source{{12, 34}}, *this, params.kind); if (params.kind != AttributeKind::kLocation) { - attrs.push_back(Location(Source{{34, 56}}, 2)); + attrs.Push(Location(Source{{34, 56}}, 2)); } auto* p = Param("a", ty.vec4(), attrs); - Func("vertex_main", ast::VariableList{p}, ty.vec4(), {Return(Construct(ty.vec4()))}, - {Stage(ast::PipelineStage::kVertex)}, {Builtin(ast::Builtin::kPosition)}); + Func("vertex_main", utils::Vector{p}, ty.vec4(), + utils::Vector{ + Return(Construct(ty.vec4())), + }, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -316,8 +338,14 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest, using ComputeShaderReturnTypeAttributeTest = TestWithParams; TEST_P(ComputeShaderReturnTypeAttributeTest, IsValid) { auto& params = GetParam(); - Func("main", ast::VariableList{}, ty.vec4(), {Return(Construct(ty.vec4(), 1.f))}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}, + Func("main", utils::Empty, ty.vec4(), + utils::Vector{ + Return(Construct(ty.vec4(), 1_f)), + }, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }, createAttributes(Source{{12, 34}}, *this, params.kind)); if (params.should_pass) { @@ -361,9 +389,13 @@ using FragmentShaderReturnTypeAttributeTest = TestWithParams; TEST_P(FragmentShaderReturnTypeAttributeTest, IsValid) { auto& params = GetParam(); auto attrs = createAttributes(Source{{12, 34}}, *this, params.kind); - attrs.push_back(Location(Source{{34, 56}}, 2)); - Func("frag_main", {}, ty.vec4(), {Return(Construct(ty.vec4()))}, - {Stage(ast::PipelineStage::kFragment)}, attrs); + attrs.Push(Location(Source{{34, 56}}, 2)); + Func("frag_main", utils::Empty, ty.vec4(), + utils::Vector{Return(Construct(ty.vec4()))}, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + attrs); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -411,10 +443,16 @@ TEST_P(VertexShaderReturnTypeAttributeTest, IsValid) { auto attrs = createAttributes(Source{{12, 34}}, *this, params.kind); // a vertex shader must include the 'position' builtin in its return type if (params.kind != AttributeKind::kBuiltin) { - attrs.push_back(Builtin(Source{{34, 56}}, ast::Builtin::kPosition)); + attrs.Push(Builtin(Source{{34, 56}}, ast::BuiltinValue::kPosition)); } - Func("vertex_main", ast::VariableList{}, ty.vec4(), {Return(Construct(ty.vec4()))}, - {Stage(ast::PipelineStage::kVertex)}, attrs); + Func("vertex_main", utils::Empty, ty.vec4(), + utils::Vector{ + Return(Construct(ty.vec4())), + }, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }, + attrs); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -450,9 +488,14 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest, using EntryPointParameterAttributeTest = TestWithParams; TEST_F(EntryPointParameterAttributeTest, DuplicateAttribute) { - Func("main", ast::VariableList{}, ty.f32(), ast::StatementList{Return(1.f)}, - {Stage(ast::PipelineStage::kFragment)}, - { + Func("main", utils::Empty, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ Location(Source{{12, 34}}, 2), Location(Source{{56, 78}}, 3), }); @@ -465,22 +508,30 @@ TEST_F(EntryPointParameterAttributeTest, DuplicateAttribute) { TEST_F(EntryPointParameterAttributeTest, DuplicateInternalAttribute) { auto* s = Param("s", ty.sampler(ast::SamplerKind::kSampler), - ast::AttributeList{ - create(0), - create(0), + utils::Vector{ + create(0u), + create(0u), Disable(ast::DisabledValidation::kBindingPointCollision), Disable(ast::DisabledValidation::kEntryPointParameter), }); - Func("f", {s}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func("f", utils::Vector{s}, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } using EntryPointReturnTypeAttributeTest = ResolverTest; TEST_F(EntryPointReturnTypeAttributeTest, DuplicateAttribute) { - Func("main", ast::VariableList{}, ty.f32(), ast::StatementList{Return(1.f)}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, - ast::AttributeList{ + Func("main", utils::Empty, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ Location(Source{{12, 34}}, 2), Location(Source{{56, 78}}, 3), }); @@ -492,8 +543,11 @@ TEST_F(EntryPointReturnTypeAttributeTest, DuplicateAttribute) { } TEST_F(EntryPointReturnTypeAttributeTest, DuplicateInternalAttribute) { - Func("f", {}, ty.i32(), {Return(1_i)}, {Stage(ast::PipelineStage::kFragment)}, - ast::AttributeList{ + Func("f", utils::Empty, ty.i32(), utils::Vector{Return(1_i)}, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ Disable(ast::DisabledValidation::kBindingPointCollision), Disable(ast::DisabledValidation::kEntryPointParameter), }); @@ -508,7 +562,7 @@ using SpirvBlockAttribute = transform::AddSpirvBlockAttribute::SpirvBlockAttribu TEST_P(StructAttributeTest, IsValid) { auto& params = GetParam(); - auto* str = create(Sym("mystruct"), ast::StructMemberList{Member("a", ty.f32())}, + auto* str = create(Sym("mystruct"), utils::Vector{Member("a", ty.f32())}, createAttributes(Source{{12, 34}}, *this, params.kind)); AST().AddGlobalDeclaration(str); @@ -539,16 +593,14 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest, using StructMemberAttributeTest = TestWithParams; TEST_P(StructMemberAttributeTest, IsValid) { auto& params = GetParam(); - ast::StructMemberList members; + utils::Vector members; if (params.kind == AttributeKind::kBuiltin) { - members.push_back( - {Member("a", ty.vec4(), createAttributes(Source{{12, 34}}, *this, params.kind))}); + members.Push( + Member("a", ty.vec4(), createAttributes(Source{{12, 34}}, *this, params.kind))); } else { - members.push_back( - {Member("a", ty.f32(), createAttributes(Source{{12, 34}}, *this, params.kind))}); + members.Push(Member("a", ty.f32(), createAttributes(Source{{12, 34}}, *this, params.kind))); } Structure("mystruct", members); - WrapInFunction(); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); } else { @@ -573,39 +625,35 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest, TestParams{AttributeKind::kWorkgroup, false}, TestParams{AttributeKind::kBindingAndGroup, false})); TEST_F(StructMemberAttributeTest, DuplicateAttribute) { - Structure("mystruct", - { - Member("a", ty.i32(), - { - create(Source{{12, 34}}, 4u), - create(Source{{56, 78}}, 8u), - }), - }); - WrapInFunction(); + Structure("mystruct", utils::Vector{ + Member("a", ty.i32(), + utils::Vector{ + MemberAlign(Source{{12, 34}}, 4_u), + MemberAlign(Source{{56, 78}}, 8_u), + }), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(56:78 error: duplicate align attribute 12:34 note: first attribute declared here)"); } TEST_F(StructMemberAttributeTest, InvariantAttributeWithPosition) { - Structure("mystruct", { + Structure("mystruct", utils::Vector{ Member("a", ty.vec4(), - { + utils::Vector{ Invariant(), - Builtin(ast::Builtin::kPosition), + Builtin(ast::BuiltinValue::kPosition), }), }); - WrapInFunction(); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(StructMemberAttributeTest, InvariantAttributeWithoutPosition) { - Structure("mystruct", { + Structure("mystruct", utils::Vector{ Member("a", ty.vec4(), - { + utils::Vector{ Invariant(Source{{12, 34}}), }), }); - WrapInFunction(); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: invariant attribute must only be applied to a " @@ -619,12 +667,10 @@ TEST_P(ArrayAttributeTest, IsValid) { auto& params = GetParam(); auto* arr = ty.array(ty.f32(), nullptr, createAttributes(Source{{12, 34}}, *this, params.kind)); - Structure("mystruct", { + Structure("mystruct", utils::Vector{ Member("a", arr), }); - WrapInFunction(); - if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); } else { @@ -654,21 +700,19 @@ TEST_P(VariableAttributeTest, IsValid) { auto& params = GetParam(); if (IsBindingAttribute(params.kind)) { - Global("a", ty.sampler(ast::SamplerKind::kSampler), ast::StorageClass::kNone, nullptr, - createAttributes(Source{{12, 34}}, *this, params.kind)); + GlobalVar("a", ty.sampler(ast::SamplerKind::kSampler), + createAttributes(Source{{12, 34}}, *this, params.kind)); } else { - Global("a", ty.f32(), ast::StorageClass::kPrivate, nullptr, - createAttributes(Source{{12, 34}}, *this, params.kind)); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate, + createAttributes(Source{{12, 34}}, *this, params.kind)); } - WrapInFunction(); - if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); } else { EXPECT_FALSE(r()->Resolve()); if (!IsBindingAttribute(params.kind)) { - EXPECT_EQ(r()->error(), "12:34 error: attribute is not valid for variables"); + EXPECT_EQ(r()->error(), "12:34 error: attribute is not valid for module-scope 'var'"); } } } @@ -690,14 +734,9 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest, TestParams{AttributeKind::kBindingAndGroup, true})); TEST_F(VariableAttributeTest, DuplicateAttribute) { - Global("a", ty.sampler(ast::SamplerKind::kSampler), - ast::AttributeList{ - create(Source{{12, 34}}, 2), - create(2), - create(Source{{56, 78}}, 3), - }); - - WrapInFunction(); + GlobalVar("a", ty.sampler(ast::SamplerKind::kSampler), + create(Source{{12, 34}}, 2u), create(2u), + create(Source{{56, 78}}, 3u)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -707,8 +746,8 @@ TEST_F(VariableAttributeTest, DuplicateAttribute) { TEST_F(VariableAttributeTest, LocalVariable) { auto* v = Var("a", ty.f32(), - ast::AttributeList{ - create(Source{{12, 34}}, 2), + utils::Vector{ + create(Source{{12, 34}}, 2u), }); WrapInFunction(v); @@ -721,19 +760,62 @@ using ConstantAttributeTest = TestWithParams; TEST_P(ConstantAttributeTest, IsValid) { auto& params = GetParam(); - GlobalConst("a", ty.f32(), Expr(1.23f), createAttributes(Source{{12, 34}}, *this, params.kind)); - - WrapInFunction(); + GlobalConst("a", ty.f32(), Expr(1.23_f), + createAttributes(Source{{12, 34}}, *this, params.kind)); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); } else { EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attribute is not valid for constants"); + EXPECT_EQ(r()->error(), + "12:34 error: attribute is not valid for module-scope 'const' declaration"); } } INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest, ConstantAttributeTest, + testing::Values(TestParams{AttributeKind::kAlign, false}, + TestParams{AttributeKind::kBinding, false}, + TestParams{AttributeKind::kBuiltin, false}, + TestParams{AttributeKind::kGroup, false}, + TestParams{AttributeKind::kId, false}, + TestParams{AttributeKind::kInterpolate, false}, + TestParams{AttributeKind::kInvariant, false}, + TestParams{AttributeKind::kLocation, false}, + TestParams{AttributeKind::kOffset, false}, + TestParams{AttributeKind::kSize, false}, + TestParams{AttributeKind::kStage, false}, + TestParams{AttributeKind::kStride, false}, + TestParams{AttributeKind::kWorkgroup, false}, + TestParams{AttributeKind::kBindingAndGroup, false})); + +TEST_F(ConstantAttributeTest, DuplicateAttribute) { + GlobalConst("a", ty.f32(), Expr(1.23_f), + utils::Vector{ + create(Source{{12, 34}}, 0u), + create(Source{{56, 78}}, 1u), + }); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(56:78 error: duplicate id attribute +12:34 note: first attribute declared here)"); +} + +using OverrideAttributeTest = TestWithParams; +TEST_P(OverrideAttributeTest, IsValid) { + auto& params = GetParam(); + + Override("a", ty.f32(), Expr(1.23_f), createAttributes(Source{{12, 34}}, *this, params.kind)); + + if (params.should_pass) { + EXPECT_TRUE(r()->Resolve()) << r()->error(); + } else { + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: attribute is not valid for 'override' declaration"); + } +} +INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest, + OverrideAttributeTest, testing::Values(TestParams{AttributeKind::kAlign, false}, TestParams{AttributeKind::kBinding, false}, TestParams{AttributeKind::kBuiltin, false}, @@ -749,14 +831,12 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest, TestParams{AttributeKind::kWorkgroup, false}, TestParams{AttributeKind::kBindingAndGroup, false})); -TEST_F(ConstantAttributeTest, DuplicateAttribute) { - GlobalConst("a", ty.f32(), Expr(1.23f), - ast::AttributeList{ - create(Source{{12, 34}}, 0), - create(Source{{56, 78}}, 1), - }); - - WrapInFunction(); +TEST_F(OverrideAttributeTest, DuplicateAttribute) { + Override("a", ty.f32(), Expr(1.23_f), + utils::Vector{ + create(Source{{12, 34}}, 0u), + create(Source{{56, 78}}, 1u), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -793,9 +873,12 @@ TEST_P(ArrayStrideTest, All) { << ", should_pass: " << params.should_pass; SCOPED_TRACE(ss.str()); - auto* arr = ty.array(Source{{12, 34}}, el_ty, 4_u, params.stride); + auto* arr = ty.array(el_ty, 4_u, + utils::Vector{ + create(Source{{12, 34}}, params.stride), + }); - Global("myarray", arr, ast::StorageClass::kPrivate); + GlobalVar("myarray", arr, ast::StorageClass::kPrivate); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -804,7 +887,7 @@ TEST_P(ArrayStrideTest, All) { EXPECT_EQ(r()->error(), "12:34 error: arrays decorated with the stride attribute must " "have a stride that is at least the size of the element type, " - "and be a multiple of the element type's alignment value."); + "and be a multiple of the element type's alignment value"); } } @@ -873,12 +956,12 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest, TEST_F(ArrayStrideTest, DuplicateAttribute) { auto* arr = ty.array(Source{{12, 34}}, ty.i32(), 4_u, - { - create(Source{{12, 34}}, 4_i), - create(Source{{56, 78}}, 4_i), + utils::Vector{ + create(Source{{12, 34}}, 4u), + create(Source{{56, 78}}, 4u), }); - Global("myarray", arr, ast::StorageClass::kPrivate); + GlobalVar("myarray", arr, ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -894,8 +977,10 @@ namespace { using ResourceAttributeTest = ResolverTest; TEST_F(ResourceAttributeTest, UniformBufferMissingBinding) { - auto* s = Structure("S", {Member("x", ty.i32())}); - Global(Source{{12, 34}}, "G", ty.Of(s), ast::StorageClass::kUniform); + auto* s = Structure("S", utils::Vector{ + Member("x", ty.i32()), + }); + GlobalVar(Source{{12, 34}}, "G", ty.Of(s), ast::StorageClass::kUniform); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -903,8 +988,10 @@ TEST_F(ResourceAttributeTest, UniformBufferMissingBinding) { } TEST_F(ResourceAttributeTest, StorageBufferMissingBinding) { - auto* s = Structure("S", {Member("x", ty.i32())}); - Global(Source{{12, 34}}, "G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead); + auto* s = Structure("S", utils::Vector{ + Member("x", ty.i32()), + }); + GlobalVar(Source{{12, 34}}, "G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -912,8 +999,7 @@ TEST_F(ResourceAttributeTest, StorageBufferMissingBinding) { } TEST_F(ResourceAttributeTest, TextureMissingBinding) { - Global(Source{{12, 34}}, "G", ty.depth_texture(ast::TextureDimension::k2d), - ast::StorageClass::kNone); + GlobalVar(Source{{12, 34}}, "G", ty.depth_texture(ast::TextureDimension::k2d)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -921,7 +1007,7 @@ TEST_F(ResourceAttributeTest, TextureMissingBinding) { } TEST_F(ResourceAttributeTest, SamplerMissingBinding) { - Global(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler), ast::StorageClass::kNone); + GlobalVar(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -929,10 +1015,7 @@ TEST_F(ResourceAttributeTest, SamplerMissingBinding) { } TEST_F(ResourceAttributeTest, BindingPairMissingBinding) { - Global(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler), ast::StorageClass::kNone, - ast::AttributeList{ - create(1), - }); + GlobalVar(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler), Group(1)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -940,10 +1023,7 @@ TEST_F(ResourceAttributeTest, BindingPairMissingBinding) { } TEST_F(ResourceAttributeTest, BindingPairMissingGroup) { - Global(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler), ast::StorageClass::kNone, - ast::AttributeList{ - create(1), - }); + GlobalVar(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler), Binding(1)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -951,27 +1031,19 @@ TEST_F(ResourceAttributeTest, BindingPairMissingGroup) { } TEST_F(ResourceAttributeTest, BindingPointUsedTwiceByEntryPoint) { - Global(Source{{12, 34}}, "A", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), - ast::StorageClass::kNone, - ast::AttributeList{ - create(1), - create(2), - }); - Global(Source{{56, 78}}, "B", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), - ast::StorageClass::kNone, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar(Source{{12, 34}}, "A", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), + Binding(1), Group(2)); + GlobalVar(Source{{56, 78}}, "B", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), + Binding(1), Group(2)); - Func("F", {}, ty.void_(), - { - Decl(Var("a", ty.vec4(), ast::StorageClass::kNone, - Call("textureLoad", "A", vec2(1_i, 2_i), 0_i))), - Decl(Var("b", ty.vec4(), ast::StorageClass::kNone, - Call("textureLoad", "B", vec2(1_i, 2_i), 0_i))), + Func("F", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("a", ty.vec4(), Call("textureLoad", "A", vec2(1_i, 2_i), 0_i))), + Decl(Var("b", ty.vec4(), Call("textureLoad", "B", vec2(1_i, 2_i), 0_i))), }, - {Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -981,41 +1053,31 @@ TEST_F(ResourceAttributeTest, BindingPointUsedTwiceByEntryPoint) { } TEST_F(ResourceAttributeTest, BindingPointUsedTwiceByDifferentEntryPoints) { - Global(Source{{12, 34}}, "A", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), - ast::StorageClass::kNone, - ast::AttributeList{ - create(1), - create(2), - }); - Global(Source{{56, 78}}, "B", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), - ast::StorageClass::kNone, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar(Source{{12, 34}}, "A", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), + Binding(1), Group(2)); + GlobalVar(Source{{56, 78}}, "B", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), + Binding(1), Group(2)); - Func("F_A", {}, ty.void_(), - { - Decl(Var("a", ty.vec4(), ast::StorageClass::kNone, - Call("textureLoad", "A", vec2(1_i, 2_i), 0_i))), + Func("F_A", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("a", ty.vec4(), Call("textureLoad", "A", vec2(1_i, 2_i), 0_i))), }, - {Stage(ast::PipelineStage::kFragment)}); - Func("F_B", {}, ty.void_(), - { - Decl(Var("b", ty.vec4(), ast::StorageClass::kNone, - Call("textureLoad", "B", vec2(1_i, 2_i), 0_i))), + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); + Func("F_B", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("b", ty.vec4(), Call("textureLoad", "B", vec2(1_i, 2_i), 0_i))), }, - {Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResourceAttributeTest, BindingPointOnNonResource) { - Global(Source{{12, 34}}, "G", ty.f32(), ast::StorageClass::kPrivate, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar(Source{{12, 34}}, "G", ty.f32(), ast::StorageClass::kPrivate, Binding(1), Group(2)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -1029,24 +1091,38 @@ namespace InvariantAttributeTests { namespace { using InvariantAttributeTests = ResolverTest; TEST_F(InvariantAttributeTests, InvariantWithPosition) { - auto* param = - Param("p", ty.vec4(), - {Invariant(Source{{12, 34}}), Builtin(Source{{56, 78}}, ast::Builtin::kPosition)}); - Func("main", ast::VariableList{param}, ty.vec4(), - ast::StatementList{Return(Construct(ty.vec4()))}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, - ast::AttributeList{ + auto* param = Param("p", ty.vec4(), + utils::Vector{ + Invariant(Source{{12, 34}}), + Builtin(Source{{56, 78}}, ast::BuiltinValue::kPosition), + }); + Func("main", utils::Vector{param}, ty.vec4(), + utils::Vector{ + Return(Construct(ty.vec4())), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ Location(0), }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(InvariantAttributeTests, InvariantWithoutPosition) { - auto* param = Param("p", ty.vec4(), {Invariant(Source{{12, 34}}), Location(0)}); - Func("main", ast::VariableList{param}, ty.vec4(), - ast::StatementList{Return(Construct(ty.vec4()))}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, - ast::AttributeList{ + auto* param = Param("p", ty.vec4(), + utils::Vector{ + Invariant(Source{{12, 34}}), + Location(0), + }); + Func("main", utils::Vector{param}, ty.vec4(), + utils::Vector{ + Return(Construct(ty.vec4())), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ Location(0), }); EXPECT_FALSE(r()->Resolve()); @@ -1062,15 +1138,20 @@ namespace { using WorkgroupAttribute = ResolverTest; TEST_F(WorkgroupAttribute, ComputeShaderPass) { - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - create(Source{{12, 34}}, Expr(1_i))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + create(Source{{12, 34}}, Expr(1_i)), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(WorkgroupAttribute, Missing) { - Func(Source{{12, 34}}, "main", {}, ty.void_(), {}, {Stage(ast::PipelineStage::kCompute)}); + Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -1079,8 +1160,10 @@ TEST_F(WorkgroupAttribute, Missing) { } TEST_F(WorkgroupAttribute, NotAnEntryPoint) { - Func("main", {}, ty.void_(), {}, - {create(Source{{12, 34}}, Expr(1_i))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + create(Source{{12, 34}}, Expr(1_i)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -1089,9 +1172,11 @@ TEST_F(WorkgroupAttribute, NotAnEntryPoint) { } TEST_F(WorkgroupAttribute, NotAComputeShader) { - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kFragment), - create(Source{{12, 34}}, Expr(1_i))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + create(Source{{12, 34}}, Expr(1_i)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -1100,8 +1185,8 @@ TEST_F(WorkgroupAttribute, NotAComputeShader) { } TEST_F(WorkgroupAttribute, DuplicateAttribute) { - Func(Source{{12, 34}}, "main", {}, ty.void_(), {}, - { + Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(Source{{12, 34}}, 1_i, nullptr, nullptr), WorkgroupSize(Source{{56, 78}}, 2_i, nullptr, nullptr), @@ -1134,10 +1219,17 @@ TEST_P(InterpolateParameterTest, All) { auto& params = GetParam(); Func("main", - ast::VariableList{ + utils::Vector{ Param("a", ty.f32(), - {Location(0), Interpolate(Source{{12, 34}}, params.type, params.sampling)})}, - ty.void_(), {}, ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Location(0), + Interpolate(Source{{12, 34}}, params.type, params.sampling), + }), + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); if (params.should_pass) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1153,10 +1245,17 @@ TEST_P(InterpolateParameterTest, IntegerScalar) { auto& params = GetParam(); Func("main", - ast::VariableList{ + utils::Vector{ Param("a", ty.i32(), - {Location(0), Interpolate(Source{{12, 34}}, params.type, params.sampling)})}, - ty.void_(), {}, ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Location(0), + Interpolate(Source{{12, 34}}, params.type, params.sampling), + }), + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); if (params.type != ast::InterpolationType::kFlat) { EXPECT_FALSE(r()->Resolve()); @@ -1177,10 +1276,17 @@ TEST_P(InterpolateParameterTest, IntegerVector) { auto& params = GetParam(); Func("main", - ast::VariableList{ + utils::Vector{ Param("a", ty.vec4(), - {Location(0), Interpolate(Source{{12, 34}}, params.type, params.sampling)})}, - ty.void_(), {}, ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Location(0), + Interpolate(Source{{12, 34}}, params.type, params.sampling), + }), + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); if (params.type != ast::InterpolationType::kFlat) { EXPECT_FALSE(r()->Resolve()); @@ -1216,8 +1322,11 @@ INSTANTIATE_TEST_SUITE_P( Params{ast::InterpolationType::kFlat, ast::InterpolationSampling::kSample, false})); TEST_F(InterpolateTest, FragmentInput_Integer_MissingFlatInterpolation) { - Func("main", ast::VariableList{Param(Source{{12, 34}}, "a", ty.i32(), {Location(0)})}, - ty.void_(), {}, ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Vector{Param(Source{{12, 34}}, "a", ty.i32(), utils::Vector{Location(0)})}, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -1226,12 +1335,19 @@ TEST_F(InterpolateTest, FragmentInput_Integer_MissingFlatInterpolation) { } TEST_F(InterpolateTest, VertexOutput_Integer_MissingFlatInterpolation) { - auto* s = Structure("S", { - Member("pos", ty.vec4(), {Builtin(ast::Builtin::kPosition)}), - Member(Source{{12, 34}}, "u", ty.u32(), {Location(0)}), - }); - Func("main", {}, ty.Of(s), {Return(Construct(ty.Of(s)))}, - ast::AttributeList{Stage(ast::PipelineStage::kVertex)}); + auto* s = Structure( + "S", + utils::Vector{ + Member("pos", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}), + Member(Source{{12, 34}}, "u", ty.u32(), utils::Vector{Location(0)}), + }); + Func("main", utils::Empty, ty.Of(s), + utils::Vector{ + Return(Construct(ty.Of(s))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -1242,11 +1358,18 @@ note: while analysing entry point 'main')"); TEST_F(InterpolateTest, MissingLocationAttribute_Parameter) { Func("main", - ast::VariableList{Param("a", ty.vec4(), - {Builtin(ast::Builtin::kPosition), - Interpolate(Source{{12, 34}}, ast::InterpolationType::kFlat, - ast::InterpolationSampling::kNone)})}, - ty.void_(), {}, ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Param("a", ty.vec4(), + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + Interpolate(Source{{12, 34}}, ast::InterpolationType::kFlat, + ast::InterpolationSampling::kNone), + }), + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -1254,11 +1377,18 @@ TEST_F(InterpolateTest, MissingLocationAttribute_Parameter) { } TEST_F(InterpolateTest, MissingLocationAttribute_ReturnType) { - Func("main", {}, ty.vec4(), {Return(Construct(ty.vec4()))}, - ast::AttributeList{Stage(ast::PipelineStage::kVertex)}, - {Builtin(ast::Builtin::kPosition), - Interpolate(Source{{12, 34}}, ast::InterpolationType::kFlat, - ast::InterpolationSampling::kNone)}); + Func("main", utils::Empty, ty.vec4(), + utils::Vector{ + Return(Construct(ty.vec4())), + }, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + Interpolate(Source{{12, 34}}, ast::InterpolationType::kFlat, + ast::InterpolationSampling::kNone), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -1266,9 +1396,12 @@ TEST_F(InterpolateTest, MissingLocationAttribute_ReturnType) { } TEST_F(InterpolateTest, MissingLocationAttribute_Struct) { - Structure("S", {Member("a", ty.f32(), - {Interpolate(Source{{12, 34}}, ast::InterpolationType::kFlat, - ast::InterpolationSampling::kNone)})}); + Structure("S", + utils::Vector{ + Member("a", ty.f32(), + utils::Vector{Interpolate(Source{{12, 34}}, ast::InterpolationType::kFlat, + ast::InterpolationSampling::kNone)}), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), diff --git a/src/tint/resolver/bitcast_validation_test.cc b/src/tint/resolver/bitcast_validation_test.cc index 78223fc87e..d341808d5b 100644 --- a/src/tint/resolver/bitcast_validation_test.cc +++ b/src/tint/resolver/bitcast_validation_test.cc @@ -113,7 +113,7 @@ TEST_P(ResolverBitcastValidationTestInvalidSrcTy, Test) { auto dst = std::get<1>(GetParam()); auto* cast = Bitcast(dst.ast(*this), Expr(Source{{12, 34}}, "src")); - WrapInFunction(Let("src", nullptr, src.expr(*this, 0)), cast); + WrapInFunction(Let("src", src.expr(*this, 0)), cast); auto expected = "12:34 error: '" + src.sem(*this)->FriendlyName(Symbols()) + "' cannot be bitcast"; diff --git a/src/tint/resolver/builtin_test.cc b/src/tint/resolver/builtin_test.cc index 94684ba842..e98d9b5260 100644 --- a/src/tint/resolver/builtin_test.cc +++ b/src/tint/resolver/builtin_test.cc @@ -44,19 +44,2003 @@ using namespace tint::number_suffixes; // NOLINT namespace tint::resolver { namespace { +using ExpressionList = utils::Vector; + using BuiltinType = sem::BuiltinType; using ResolverBuiltinTest = ResolverTest; +struct BuiltinData { + const char* name; + BuiltinType builtin; +}; + +inline std::ostream& operator<<(std::ostream& out, BuiltinData data) { + out << data.name; + return out; +} + +TEST_F(ResolverBuiltinTest, ModuleScopeUsage) { + GlobalConst("c", ty.f32(), Call(Source{{12, 34}}, "abs", 1._f)); + + EXPECT_FALSE(r()->Resolve()); + + // TODO(crbug.com/tint/1581): Once 'abs' is implemented as @const, this will no longer be an + // error. + EXPECT_EQ(r()->error(), R"(12:34 error: 'const' initializer must be constant expression)"); +} + +// Tests for Logical builtins +namespace logical_builtin_tests { + +using ResolverBuiltinTest_BoolMethod = ResolverTestWithParam; + +TEST_P(ResolverBuiltinTest_BoolMethod, Scalar) { + auto name = GetParam(); + + GlobalVar("my_var", ty.bool_(), ast::StorageClass::kPrivate); + + auto* expr = Call(name, "my_var"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(expr), nullptr); + EXPECT_TRUE(TypeOf(expr)->Is()); +} +TEST_P(ResolverBuiltinTest_BoolMethod, Vector) { + auto name = GetParam(); + + GlobalVar("my_var", ty.vec3(), ast::StorageClass::kPrivate); + + auto* expr = Call(name, "my_var"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(expr), nullptr); + EXPECT_TRUE(TypeOf(expr)->Is()); +} +INSTANTIATE_TEST_SUITE_P(ResolverTest, + ResolverBuiltinTest_BoolMethod, + testing::Values("any", "all")); + +TEST_F(ResolverBuiltinTest, Select) { + GlobalVar("my_var", ty.vec3(), ast::StorageClass::kPrivate); + + GlobalVar("bool_var", ty.vec3(), ast::StorageClass::kPrivate); + + auto* expr = Call("select", "my_var", "my_var", "bool_var"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(expr), nullptr); + EXPECT_TRUE(TypeOf(expr)->Is()); + EXPECT_EQ(TypeOf(expr)->As()->Width(), 3u); + EXPECT_TRUE(TypeOf(expr)->As()->type()->Is()); +} + +TEST_F(ResolverBuiltinTest, Select_Error_NoParams) { + auto* expr = Call("select"); + WrapInFunction(expr); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to select() + +3 candidate functions: + select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, bool) -> vecN where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, vecN) -> vecN where: T is f32, f16, i32, u32 or bool +)"); +} + +TEST_F(ResolverBuiltinTest, Select_Error_SelectorInt) { + auto* expr = Call("select", 1_i, 1_i, 1_i); + WrapInFunction(expr); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to select(i32, i32, i32) + +3 candidate functions: + select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, bool) -> vecN where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, vecN) -> vecN where: T is f32, f16, i32, u32 or bool +)"); +} + +TEST_F(ResolverBuiltinTest, Select_Error_Matrix) { + auto* expr = Call("select", mat2x2(vec2(1_f, 1_f), vec2(1_f, 1_f)), + mat2x2(vec2(1_f, 1_f), vec2(1_f, 1_f)), Expr(true)); + WrapInFunction(expr); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to select(mat2x2, mat2x2, bool) + +3 candidate functions: + select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, bool) -> vecN where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, vecN) -> vecN where: T is f32, f16, i32, u32 or bool +)"); +} + +TEST_F(ResolverBuiltinTest, Select_Error_MismatchTypes) { + auto* expr = Call("select", 1_f, vec2(2_f, 3_f), Expr(true)); + WrapInFunction(expr); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to select(f32, vec2, bool) + +3 candidate functions: + select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, bool) -> vecN where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, vecN) -> vecN where: T is f32, f16, i32, u32 or bool +)"); +} + +TEST_F(ResolverBuiltinTest, Select_Error_MismatchVectorSize) { + auto* expr = Call("select", vec2(1_f, 2_f), vec3(3_f, 4_f, 5_f), Expr(true)); + WrapInFunction(expr); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to select(vec2, vec3, bool) + +3 candidate functions: + select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, bool) -> vecN where: T is f32, f16, i32, u32 or bool + select(vecN, vecN, vecN) -> vecN where: T is f32, f16, i32, u32 or bool +)"); +} + +} // namespace logical_builtin_tests + +// Tests for Array builtins +namespace array_builtin_tests { + +using ResolverBuiltinArrayTest = ResolverTest; + +TEST_F(ResolverBuiltinArrayTest, ArrayLength_Vector) { + auto* ary = ty.array(); + auto* str = Structure("S", utils::Vector{Member("x", ary)}); + GlobalVar("a", ty.Of(str), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), + Group(0)); + + auto* call = Call("arrayLength", AddressOf(MemberAccessor("a", "x"))); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinArrayTest, ArrayLength_Error_ArraySized) { + GlobalVar("arr", ty.array(), ast::StorageClass::kPrivate); + auto* call = Call("arrayLength", AddressOf("arr")); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to arrayLength(ptr, read_write>) + +1 candidate function: + arrayLength(ptr, A>) -> u32 +)"); +} + +} // namespace array_builtin_tests + +// Tests for Numeric builtins with float parameter +namespace float_builtin_tests { + +// Testcase parameters for float built-in having signature of (T, ...) -> T and (vecN, ...) -> +// vecN +struct BuiltinDataWithParamNum { + uint32_t args_number; + const char* name; + BuiltinType builtin; +}; + +inline std::ostream& operator<<(std::ostream& out, BuiltinDataWithParamNum data) { + out << data.name; + return out; +} + +// Tests for float built-ins that has signiture (T, ...) -> T and (vecN, ...) -> vecN +using ResolverBuiltinTest_FloatBuiltin_IdenticalType = + ResolverTestWithParam; + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, Error_NoParams) { + auto param = GetParam(); + + auto* call = Call(param.name); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + "()")); +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_f); + WrapInFunction(call); + + if (param.args_number == 1u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + "(f32)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_f, 1_f, 3_f)); + WrapInFunction(call); + + if (param.args_number == 1u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Scalar_f32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_f, 1_f); + WrapInFunction(call); + + if (param.args_number == 2u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(f32, f32)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Vector_f32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_f, 1_f, 3_f), vec3(1_f, 1_f, 3_f)); + WrapInFunction(call); + + if (param.args_number == 2u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Scalar_f32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_f, 1_f, 1_f); + WrapInFunction(call); + + if (param.args_number == 3u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(f32, f32, f32)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Vector_f32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_f, 1_f, 3_f), vec3(1_f, 1_f, 3_f), + vec3(1_f, 1_f, 3_f)); + WrapInFunction(call); + + if (param.args_number == 3u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + + "(vec3, vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Scalar_f32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_f, 1_f, 1_f, 1_f); + WrapInFunction(call); + + if (param.args_number == 4u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(f32, f32, f32, f32)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Vector_f32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_f, 1_f, 3_f), vec3(1_f, 1_f, 3_f), + vec3(1_f, 1_f, 3_f), vec3(1_f, 1_f, 3_f)); + WrapInFunction(call); + + if (param.args_number == 4u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + + "(vec3, vec3, vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f16) { + auto param = GetParam(); + + Enable(ast::Extension::kF16); + + auto* call = Call(param.name, 1_h); + WrapInFunction(call); + + if (param.args_number == 1u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + "(f16)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f16) { + auto param = GetParam(); + + Enable(ast::Extension::kF16); + + auto* call = Call(param.name, vec3(1_h, 1_h, 3_h)); + WrapInFunction(call); + + if (param.args_number == 1u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Scalar_f16) { + auto param = GetParam(); + + Enable(ast::Extension::kF16); + + auto* call = Call(param.name, 1_h, 1_h); + WrapInFunction(call); + + if (param.args_number == 2u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(f16, f16)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Vector_f16) { + auto param = GetParam(); + + Enable(ast::Extension::kF16); + + auto* call = Call(param.name, vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h)); + WrapInFunction(call); + + if (param.args_number == 2u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Scalar_f16) { + auto param = GetParam(); + + Enable(ast::Extension::kF16); + + auto* call = Call(param.name, 1_h, 1_h, 1_h); + WrapInFunction(call); + + if (param.args_number == 3u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(f16, f16, f16)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Vector_f16) { + auto param = GetParam(); + + Enable(ast::Extension::kF16); + + auto* call = Call(param.name, vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h), + vec3(1_h, 1_h, 3_h)); + WrapInFunction(call); + + if (param.args_number == 3u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + + "(vec3, vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Scalar_f16) { + auto param = GetParam(); + + Enable(ast::Extension::kF16); + + auto* call = Call(param.name, 1_h, 1_h, 1_h, 1_h); + WrapInFunction(call); + + if (param.args_number == 4u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(f16, f16, f16, f16)")); + } +} + +TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Vector_f16) { + auto param = GetParam(); + + Enable(ast::Extension::kF16); + + auto* call = Call(param.name, vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h), + vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h)); + WrapInFunction(call); + + if (param.args_number == 4u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + + "(vec3, vec3, vec3, vec3)")); + } +} + +INSTANTIATE_TEST_SUITE_P( + ResolverTest, + ResolverBuiltinTest_FloatBuiltin_IdenticalType, + testing::Values(BuiltinDataWithParamNum{1, "abs", BuiltinType::kAbs}, + BuiltinDataWithParamNum{1, "acos", BuiltinType::kAcos}, + BuiltinDataWithParamNum{1, "acosh", BuiltinType::kAcos}, + BuiltinDataWithParamNum{1, "asin", BuiltinType::kAsin}, + BuiltinDataWithParamNum{1, "asinh", BuiltinType::kAsin}, + BuiltinDataWithParamNum{1, "atan", BuiltinType::kAtan}, + BuiltinDataWithParamNum{1, "atanh", BuiltinType::kAtan}, + BuiltinDataWithParamNum{2, "atan2", BuiltinType::kAtan2}, + BuiltinDataWithParamNum{1, "ceil", BuiltinType::kCeil}, + BuiltinDataWithParamNum{3, "clamp", BuiltinType::kClamp}, + BuiltinDataWithParamNum{1, "cos", BuiltinType::kCos}, + BuiltinDataWithParamNum{1, "cosh", BuiltinType::kCosh}, + // cross: (vec3, vec3) -> vec3 + BuiltinDataWithParamNum{1, "degrees", BuiltinType::kDegrees}, + // distance: (T, T) -> T, (vecN, vecN) -> T + BuiltinDataWithParamNum{1, "exp", BuiltinType::kExp}, + BuiltinDataWithParamNum{1, "exp2", BuiltinType::kExp2}, + // faceForward: (vecN, vecN, vecN) -> vecN + BuiltinDataWithParamNum{1, "floor", BuiltinType::kFloor}, + BuiltinDataWithParamNum{3, "fma", BuiltinType::kFma}, + BuiltinDataWithParamNum{1, "fract", BuiltinType::kFract}, + // frexp + BuiltinDataWithParamNum{1, "inverseSqrt", BuiltinType::kInverseSqrt}, + // ldexp: (T, i32) -> T, (vecN, vecN) -> vecN + // length: (vecN) -> T + BuiltinDataWithParamNum{1, "log", BuiltinType::kLog}, + BuiltinDataWithParamNum{1, "log2", BuiltinType::kLog2}, + BuiltinDataWithParamNum{2, "max", BuiltinType::kMax}, + BuiltinDataWithParamNum{2, "min", BuiltinType::kMin}, + // Note that `mix(vecN, vecN, f32) -> vecN` is not tested here. + BuiltinDataWithParamNum{3, "mix", BuiltinType::kMix}, + // modf + // normalize: (vecN) -> vecN + BuiltinDataWithParamNum{2, "pow", BuiltinType::kPow}, + // quantizeToF16 is not implemented yet. + BuiltinDataWithParamNum{1, "radians", BuiltinType::kRadians}, + // reflect: (vecN, vecN) -> vecN + // refract: (vecN, vecN, T) -> vecN + BuiltinDataWithParamNum{1, "round", BuiltinType::kRound}, + // saturate not implemented yet. + BuiltinDataWithParamNum{1, "sign", BuiltinType::kSign}, + BuiltinDataWithParamNum{1, "sin", BuiltinType::kSin}, + BuiltinDataWithParamNum{1, "sinh", BuiltinType::kSinh}, + BuiltinDataWithParamNum{3, "smoothstep", BuiltinType::kSmoothstep}, + BuiltinDataWithParamNum{1, "sqrt", BuiltinType::kSqrt}, + BuiltinDataWithParamNum{2, "step", BuiltinType::kStep}, + BuiltinDataWithParamNum{1, "tan", BuiltinType::kTan}, + BuiltinDataWithParamNum{1, "tanh", BuiltinType::kTanh}, + BuiltinDataWithParamNum{1, "trunc", BuiltinType::kTrunc})); + +using ResolverBuiltinFloatTest = ResolverTest; + +// cross: (vec3, vec3) -> vec3 +TEST_F(ResolverBuiltinFloatTest, Cross_f32) { + auto* call = Call("cross", vec3(1_f, 2_f, 3_f), vec3(1_f, 2_f, 3_f)); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Cross_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("cross", vec3(1_h, 2_h, 3_h), vec3(1_h, 2_h, 3_h)); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Cross_Error_NoArgs) { + auto* call = Call("cross"); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to cross() + +1 candidate function: + cross(vec3, vec3) -> vec3 where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Cross_Error_Scalar) { + auto* call = Call("cross", 1_f, 1_f); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to cross(f32, f32) + +1 candidate function: + cross(vec3, vec3) -> vec3 where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Cross_Error_Vec3Int) { + auto* call = Call("cross", vec3(1_i, 2_i, 3_i), vec3(1_i, 2_i, 3_i)); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to cross(vec3, vec3) + +1 candidate function: + cross(vec3, vec3) -> vec3 where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Cross_Error_Vec4) { + auto* call = Call("cross", vec4(1_f, 2_f, 3_f, 4_f), vec4(1_f, 2_f, 3_f, 4_f)); + + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to cross(vec4, vec4) + +1 candidate function: + cross(vec3, vec3) -> vec3 where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Cross_Error_TooManyParams) { + auto* call = + Call("cross", vec3(1_f, 2_f, 3_f), vec3(1_f, 2_f, 3_f), vec3(1_f, 2_f, 3_f)); + + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to cross(vec3, vec3, vec3) + +1 candidate function: + cross(vec3, vec3) -> vec3 where: T is f32 or f16 +)"); +} + +// distance: (T, T) -> T, (vecN, vecN) -> T +TEST_F(ResolverBuiltinFloatTest, Distance_Scalar_f32) { + auto* call = Call("distance", 1_f, 1_f); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Distance_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("distance", 1_h, 1_h); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Distance_Vector_f32) { + auto* call = Call("distance", vec3(1_f, 1_f, 3_f), vec3(1_f, 1_f, 3_f)); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Distance_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("distance", vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h)); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Distance_TooManyParams) { + auto* call = Call("distance", vec3(1_f, 1_f, 3_f), vec3(1_f, 1_f, 3_f), + vec3(1_f, 1_f, 3_f)); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to distance(vec3, vec3, vec3) + +2 candidate functions: + distance(T, T) -> T where: T is f32 or f16 + distance(vecN, vecN) -> T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Distance_TooFewParams) { + auto* call = Call("distance", vec3(1_f, 1_f, 3_f)); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to distance(vec3) + +2 candidate functions: + distance(T, T) -> T where: T is f32 or f16 + distance(vecN, vecN) -> T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Distance_NoParams) { + auto* call = Call("distance"); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to distance() + +2 candidate functions: + distance(T, T) -> T where: T is f32 or f16 + distance(vecN, vecN) -> T where: T is f32 or f16 +)"); +} + +// frexp: (f32) -> __frexp_result, (vecN) -> __frexp_result_vecN, (f16) -> __frexp_result_16, +// (vecN) -> __frexp_result_vecN_f16 +TEST_F(ResolverBuiltinFloatTest, FrexpScalar_f32) { + auto* call = Call("frexp", 1_f); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + auto* ty = TypeOf(call)->As(); + ASSERT_NE(ty, nullptr); + ASSERT_EQ(ty->Members().size(), 2u); + + auto* sig = ty->Members()[0]; + EXPECT_TRUE(sig->Type()->Is()); + EXPECT_EQ(sig->Offset(), 0u); + EXPECT_EQ(sig->Size(), 4u); + EXPECT_EQ(sig->Align(), 4u); + EXPECT_EQ(sig->Name(), Sym("sig")); + + auto* exp = ty->Members()[1]; + EXPECT_TRUE(exp->Type()->Is()); + EXPECT_EQ(exp->Offset(), 4u); + EXPECT_EQ(exp->Size(), 4u); + EXPECT_EQ(exp->Align(), 4u); + EXPECT_EQ(exp->Name(), Sym("exp")); + + EXPECT_EQ(ty->Size(), 8u); + EXPECT_EQ(ty->SizeNoPadding(), 8u); +} + +TEST_F(ResolverBuiltinFloatTest, FrexpScalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("frexp", 1_h); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + auto* ty = TypeOf(call)->As(); + ASSERT_NE(ty, nullptr); + ASSERT_EQ(ty->Members().size(), 2u); + + auto* sig = ty->Members()[0]; + EXPECT_TRUE(sig->Type()->Is()); + EXPECT_EQ(sig->Offset(), 0u); + EXPECT_EQ(sig->Size(), 2u); + EXPECT_EQ(sig->Align(), 2u); + EXPECT_EQ(sig->Name(), Sym("sig")); + + auto* exp = ty->Members()[1]; + EXPECT_TRUE(exp->Type()->Is()); + EXPECT_EQ(exp->Offset(), 4u); + EXPECT_EQ(exp->Size(), 4u); + EXPECT_EQ(exp->Align(), 4u); + EXPECT_EQ(exp->Name(), Sym("exp")); + + EXPECT_EQ(ty->Size(), 8u); + EXPECT_EQ(ty->SizeNoPadding(), 8u); +} + +TEST_F(ResolverBuiltinFloatTest, FrexpVector_f32) { + auto* call = Call("frexp", vec3()); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + auto* ty = TypeOf(call)->As(); + ASSERT_NE(ty, nullptr); + ASSERT_EQ(ty->Members().size(), 2u); + + auto* sig = ty->Members()[0]; + ASSERT_TRUE(sig->Type()->Is()); + EXPECT_EQ(sig->Type()->As()->Width(), 3u); + EXPECT_TRUE(sig->Type()->As()->type()->Is()); + EXPECT_EQ(sig->Offset(), 0u); + EXPECT_EQ(sig->Size(), 12u); + EXPECT_EQ(sig->Align(), 16u); + EXPECT_EQ(sig->Name(), Sym("sig")); + + auto* exp = ty->Members()[1]; + ASSERT_TRUE(exp->Type()->Is()); + EXPECT_EQ(exp->Type()->As()->Width(), 3u); + EXPECT_TRUE(exp->Type()->As()->type()->Is()); + EXPECT_EQ(exp->Offset(), 16u); + EXPECT_EQ(exp->Size(), 12u); + EXPECT_EQ(exp->Align(), 16u); + EXPECT_EQ(exp->Name(), Sym("exp")); + + EXPECT_EQ(ty->Size(), 32u); + EXPECT_EQ(ty->SizeNoPadding(), 28u); +} + +TEST_F(ResolverBuiltinFloatTest, FrexpVector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("frexp", vec3()); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + auto* ty = TypeOf(call)->As(); + ASSERT_NE(ty, nullptr); + ASSERT_EQ(ty->Members().size(), 2u); + + auto* sig = ty->Members()[0]; + ASSERT_TRUE(sig->Type()->Is()); + EXPECT_EQ(sig->Type()->As()->Width(), 3u); + EXPECT_TRUE(sig->Type()->As()->type()->Is()); + EXPECT_EQ(sig->Offset(), 0u); + EXPECT_EQ(sig->Size(), 6u); + EXPECT_EQ(sig->Align(), 8u); + EXPECT_EQ(sig->Name(), Sym("sig")); + + auto* exp = ty->Members()[1]; + ASSERT_TRUE(exp->Type()->Is()); + EXPECT_EQ(exp->Type()->As()->Width(), 3u); + EXPECT_TRUE(exp->Type()->As()->type()->Is()); + EXPECT_EQ(exp->Offset(), 16u); + EXPECT_EQ(exp->Size(), 12u); + EXPECT_EQ(exp->Align(), 16u); + EXPECT_EQ(exp->Name(), Sym("exp")); + + EXPECT_EQ(ty->Size(), 32u); + EXPECT_EQ(ty->SizeNoPadding(), 28u); +} + +TEST_F(ResolverBuiltinFloatTest, Frexp_Error_FirstParamInt) { + GlobalVar("v", ty.i32(), ast::StorageClass::kWorkgroup); + auto* call = Call("frexp", 1_i, AddressOf("v")); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to frexp(i32, ptr) + +2 candidate functions: + frexp(T) -> __frexp_result_T where: T is f32 or f16 + frexp(vecN) -> __frexp_result_vecN_T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Frexp_Error_SecondParamFloatPtr) { + GlobalVar("v", ty.f32(), ast::StorageClass::kWorkgroup); + auto* call = Call("frexp", 1_f, AddressOf("v")); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to frexp(f32, ptr) + +2 candidate functions: + frexp(T) -> __frexp_result_T where: T is f32 or f16 + frexp(vecN) -> __frexp_result_vecN_T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Frexp_Error_SecondParamNotAPointer) { + auto* call = Call("frexp", 1_f, 1_i); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to frexp(f32, i32) + +2 candidate functions: + frexp(T) -> __frexp_result_T where: T is f32 or f16 + frexp(vecN) -> __frexp_result_vecN_T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Frexp_Error_VectorSizesDontMatch) { + GlobalVar("v", ty.vec4(), ast::StorageClass::kWorkgroup); + auto* call = Call("frexp", vec2(1_f, 2_f), AddressOf("v")); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to frexp(vec2, ptr, read_write>) + +2 candidate functions: + frexp(T) -> __frexp_result_T where: T is f32 or f16 + frexp(vecN) -> __frexp_result_vecN_T where: T is f32 or f16 +)"); +} + +// length: (T) -> T, (vecN) -> T +TEST_F(ResolverBuiltinFloatTest, Length_Scalar_f32) { + auto* call = Call("length", 1_f); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Length_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("length", 1_h); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Length_FloatVector_f32) { + auto* call = Call("length", vec3(1_f, 1_f, 3_f)); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Length_FloatVector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("length", vec3(1_h, 1_h, 3_h)); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Length_NoParams) { + auto* call = Call("length"); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to length() + +2 candidate functions: + length(T) -> T where: T is f32 or f16 + length(vecN) -> T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Length_TooManyParams) { + auto* call = Call("length", 1_f, 2_f); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to length(f32, f32) + +2 candidate functions: + length(T) -> T where: T is f32 or f16 + length(vecN) -> T where: T is f32 or f16 +)"); +} + +// mix(vecN, vecN, T) -> vecN. Other overloads are tested in +// ResolverBuiltinTest_FloatBuiltin_IdenticalType above. +TEST_F(ResolverBuiltinFloatTest, Mix_VectorScalar_f32) { + auto* call = Call("mix", vec3(1_f, 1_f, 3_f), vec3(1_f, 1_f, 3_f), 4_f); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Mix_VectorScalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("mix", vec3(1_h, 1_h, 1_h), vec3(1_h, 1_h, 1_h), 4_h); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); +} + +// modf: (f32) -> __modf_result, (vecN) -> __modf_result_vecN, (f16) -> __modf_result_f16, +// (vecN) -> __modf_result_vecN_f16 +TEST_F(ResolverBuiltinFloatTest, ModfScalar_f32) { + auto* call = Call("modf", 1_f); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + auto* ty = TypeOf(call)->As(); + ASSERT_NE(ty, nullptr); + ASSERT_EQ(ty->Members().size(), 2u); + + auto* fract = ty->Members()[0]; + EXPECT_TRUE(fract->Type()->Is()); + EXPECT_EQ(fract->Offset(), 0u); + EXPECT_EQ(fract->Size(), 4u); + EXPECT_EQ(fract->Align(), 4u); + EXPECT_EQ(fract->Name(), Sym("fract")); + + auto* whole = ty->Members()[1]; + EXPECT_TRUE(whole->Type()->Is()); + EXPECT_EQ(whole->Offset(), 4u); + EXPECT_EQ(whole->Size(), 4u); + EXPECT_EQ(whole->Align(), 4u); + EXPECT_EQ(whole->Name(), Sym("whole")); + + EXPECT_EQ(ty->Size(), 8u); + EXPECT_EQ(ty->SizeNoPadding(), 8u); +} + +TEST_F(ResolverBuiltinFloatTest, ModfScalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("modf", 1_h); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + auto* ty = TypeOf(call)->As(); + ASSERT_NE(ty, nullptr); + ASSERT_EQ(ty->Members().size(), 2u); + + auto* fract = ty->Members()[0]; + EXPECT_TRUE(fract->Type()->Is()); + EXPECT_EQ(fract->Offset(), 0u); + EXPECT_EQ(fract->Size(), 2u); + EXPECT_EQ(fract->Align(), 2u); + EXPECT_EQ(fract->Name(), Sym("fract")); + + auto* whole = ty->Members()[1]; + EXPECT_TRUE(whole->Type()->Is()); + EXPECT_EQ(whole->Offset(), 2u); + EXPECT_EQ(whole->Size(), 2u); + EXPECT_EQ(whole->Align(), 2u); + EXPECT_EQ(whole->Name(), Sym("whole")); + + EXPECT_EQ(ty->Size(), 4u); + EXPECT_EQ(ty->SizeNoPadding(), 4u); +} + +TEST_F(ResolverBuiltinFloatTest, ModfVector_f32) { + auto* call = Call("modf", vec3()); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + auto* ty = TypeOf(call)->As(); + ASSERT_NE(ty, nullptr); + ASSERT_EQ(ty->Members().size(), 2u); + + auto* fract = ty->Members()[0]; + ASSERT_TRUE(fract->Type()->Is()); + EXPECT_EQ(fract->Type()->As()->Width(), 3u); + EXPECT_TRUE(fract->Type()->As()->type()->Is()); + EXPECT_EQ(fract->Offset(), 0u); + EXPECT_EQ(fract->Size(), 12u); + EXPECT_EQ(fract->Align(), 16u); + EXPECT_EQ(fract->Name(), Sym("fract")); + + auto* whole = ty->Members()[1]; + ASSERT_TRUE(whole->Type()->Is()); + EXPECT_EQ(whole->Type()->As()->Width(), 3u); + EXPECT_TRUE(whole->Type()->As()->type()->Is()); + EXPECT_EQ(whole->Offset(), 16u); + EXPECT_EQ(whole->Size(), 12u); + EXPECT_EQ(whole->Align(), 16u); + EXPECT_EQ(whole->Name(), Sym("whole")); + + EXPECT_EQ(ty->Size(), 32u); + EXPECT_EQ(ty->SizeNoPadding(), 28u); +} + +TEST_F(ResolverBuiltinFloatTest, ModfVector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("modf", vec3()); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + auto* ty = TypeOf(call)->As(); + ASSERT_NE(ty, nullptr); + ASSERT_EQ(ty->Members().size(), 2u); + + auto* fract = ty->Members()[0]; + ASSERT_TRUE(fract->Type()->Is()); + EXPECT_EQ(fract->Type()->As()->Width(), 3u); + EXPECT_TRUE(fract->Type()->As()->type()->Is()); + EXPECT_EQ(fract->Offset(), 0u); + EXPECT_EQ(fract->Size(), 6u); + EXPECT_EQ(fract->Align(), 8u); + EXPECT_EQ(fract->Name(), Sym("fract")); + + auto* whole = ty->Members()[1]; + ASSERT_TRUE(whole->Type()->Is()); + EXPECT_EQ(whole->Type()->As()->Width(), 3u); + EXPECT_TRUE(whole->Type()->As()->type()->Is()); + EXPECT_EQ(whole->Offset(), 8u); + EXPECT_EQ(whole->Size(), 6u); + EXPECT_EQ(whole->Align(), 8u); + EXPECT_EQ(whole->Name(), Sym("whole")); + + EXPECT_EQ(ty->Size(), 16u); + EXPECT_EQ(ty->SizeNoPadding(), 14u); +} + +TEST_F(ResolverBuiltinFloatTest, Modf_Error_FirstParamInt) { + GlobalVar("whole", ty.f32(), ast::StorageClass::kWorkgroup); + auto* call = Call("modf", 1_i, AddressOf("whole")); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to modf(i32, ptr) + +2 candidate functions: + modf(T) -> __modf_result_T where: T is f32 or f16 + modf(vecN) -> __modf_result_vecN_T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Modf_Error_SecondParamIntPtr) { + GlobalVar("whole", ty.i32(), ast::StorageClass::kWorkgroup); + auto* call = Call("modf", 1_f, AddressOf("whole")); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to modf(f32, ptr) + +2 candidate functions: + modf(T) -> __modf_result_T where: T is f32 or f16 + modf(vecN) -> __modf_result_vecN_T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Modf_Error_SecondParamNotAPointer) { + auto* call = Call("modf", 1_f, 1_f); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to modf(f32, f32) + +2 candidate functions: + modf(T) -> __modf_result_T where: T is f32 or f16 + modf(vecN) -> __modf_result_vecN_T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinFloatTest, Modf_Error_VectorSizesDontMatch) { + GlobalVar("whole", ty.vec4(), ast::StorageClass::kWorkgroup); + auto* call = Call("modf", vec2(1_f, 2_f), AddressOf("whole")); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to modf(vec2, ptr, read_write>) + +2 candidate functions: + modf(T) -> __modf_result_T where: T is f32 or f16 + modf(vecN) -> __modf_result_vecN_T where: T is f32 or f16 +)"); +} + +// normalize: (vecN) -> vecN +TEST_F(ResolverBuiltinFloatTest, Normalize_Vector_f32) { + auto* call = Call("normalize", vec3(1_f, 1_f, 3_f)); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Normalize_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("normalize", vec3(1_h, 1_h, 3_h)); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); +} + +TEST_F(ResolverBuiltinFloatTest, Normalize_Error_NoParams) { + auto* call = Call("normalize"); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to normalize() + +1 candidate function: + normalize(vecN) -> vecN where: T is f32 or f16 +)"); +} + +} // namespace float_builtin_tests + +// Tests for Numeric builtins with all integer parameter +namespace integer_builtin_tests { + +// Testcase parameters for integer built-in having signature of (T, ...) -> T and (vecN, ...) -> +// vecN, where T is i32 and u32 +struct BuiltinDataWithParamNum { + uint32_t args_number; + const char* name; + BuiltinType builtin; +}; + +inline std::ostream& operator<<(std::ostream& out, BuiltinDataWithParamNum data) { + out << data.name; + return out; +} + +// Tests for integer built-ins that has signiture (T, ...) -> T and (vecN, ...) -> vecN +using ResolverBuiltinTest_IntegerBuiltin_IdenticalType = + ResolverTestWithParam; + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, Error_NoParams) { + auto param = GetParam(); + + auto* call = Call(param.name); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + "()")); +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, OneParams_Scalar_i32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_i); + WrapInFunction(call); + + if (param.args_number == 1u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + "(i32)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, OneParams_Vector_i32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_i, 1_i, 3_i)); + WrapInFunction(call); + + if (param.args_number == 1u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, OneParams_Scalar_u32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_u); + WrapInFunction(call); + + if (param.args_number == 1u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + "(u32)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, OneParams_Vector_u32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_u, 1_u, 3_u)); + WrapInFunction(call); + + if (param.args_number == 1u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, TwoParams_Scalar_i32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_i, 1_i); + WrapInFunction(call); + + if (param.args_number == 2u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(i32, i32)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, TwoParams_Vector_i32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_i, 1_i, 3_i), vec3(1_i, 1_i, 3_i)); + WrapInFunction(call); + + if (param.args_number == 2u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, TwoParams_Scalar_u32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_u, 1_u); + WrapInFunction(call); + + if (param.args_number == 2u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(u32, u32)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, TwoParams_Vector_u32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_u, 1_u, 3_u), vec3(1_u, 1_u, 3_u)); + WrapInFunction(call); + + if (param.args_number == 2u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, ThreeParams_Scalar_i32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_i, 1_i, 1_i); + WrapInFunction(call); + + if (param.args_number == 3u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(i32, i32, i32)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, ThreeParams_Vector_i32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_i, 1_i, 3_i), vec3(1_i, 1_i, 3_i), + vec3(1_i, 1_i, 3_i)); + WrapInFunction(call); + + if (param.args_number == 3u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + + "(vec3, vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, ThreeParams_Scalar_u32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_u, 1_u, 1_u); + WrapInFunction(call); + + if (param.args_number == 3u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(u32, u32, u32)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, ThreeParams_Vector_u32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_u, 1_u, 3_u), vec3(1_u, 1_u, 3_u), + vec3(1_u, 1_u, 3_u)); + WrapInFunction(call); + + if (param.args_number == 3u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + + "(vec3, vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, FourParams_Scalar_i32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_i, 1_i, 1_i, 1_i); + WrapInFunction(call); + + if (param.args_number == 4u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(i32, i32, i32, i32)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, FourParams_Vector_i32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_i, 1_i, 3_i), vec3(1_i, 1_i, 3_i), + vec3(1_i, 1_i, 3_i), vec3(1_i, 1_i, 3_i)); + WrapInFunction(call); + + if (param.args_number == 4u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + + "(vec3, vec3, vec3, vec3)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, FourParams_Scalar_u32) { + auto param = GetParam(); + + auto* call = Call(param.name, 1_u, 1_u, 1_u, 1_u); + WrapInFunction(call); + + if (param.args_number == 4u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + + std::string(param.name) + "(u32, u32, u32, u32)")); + } +} + +TEST_P(ResolverBuiltinTest_IntegerBuiltin_IdenticalType, FourParams_Vector_u32) { + auto param = GetParam(); + + auto* call = Call(param.name, vec3(1_u, 1_u, 3_u), vec3(1_u, 1_u, 3_u), + vec3(1_u, 1_u, 3_u), vec3(1_u, 1_u, 3_u)); + WrapInFunction(call); + + if (param.args_number == 4u) { + // Parameter count matched. + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector()); + EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); + ASSERT_NE(TypeOf(call)->As()->type(), nullptr); + EXPECT_TRUE(TypeOf(call)->As()->type()->Is()); + } else { + // Invalid parameter count. + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), + HasSubstr("error: no matching call to " + std::string(param.name) + + "(vec3, vec3, vec3, vec3)")); + } +} + +INSTANTIATE_TEST_SUITE_P( + ResolverTest, + ResolverBuiltinTest_IntegerBuiltin_IdenticalType, + testing::Values( + BuiltinDataWithParamNum{1, "abs", BuiltinType::kAbs}, + BuiltinDataWithParamNum{3, "clamp", BuiltinType::kClamp}, + BuiltinDataWithParamNum{1, "countLeadingZeros", BuiltinType::kCountLeadingZeros}, + BuiltinDataWithParamNum{1, "countOneBits", BuiltinType::kCountOneBits}, + BuiltinDataWithParamNum{1, "countTrailingZeros", BuiltinType::kCountTrailingZeros}, + // extractBits: (T, u32, u32) -> T + BuiltinDataWithParamNum{1, "firstLeadingBit", BuiltinType::kFirstLeadingBit}, + BuiltinDataWithParamNum{1, "firstTrailingBit", BuiltinType::kFirstTrailingBit}, + // insertBits: (T, T, u32, u32) -> T + BuiltinDataWithParamNum{2, "max", BuiltinType::kMax}, + BuiltinDataWithParamNum{2, "min", BuiltinType::kMin}, + BuiltinDataWithParamNum{1, "reverseBits", BuiltinType::kReverseBits})); + +} // namespace integer_builtin_tests + +// Tests for Numeric builtins with matrix parameter, i.e. "determinant" and "transpose" +namespace matrix_builtin_tests { + +TEST_F(ResolverBuiltinTest, Determinant_2x2_f32) { + GlobalVar("var", ty.mat2x2(), ast::StorageClass::kPrivate); + + auto* call = Call("determinant", "var"); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinTest, Determinant_2x2_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("var", ty.mat2x2(), ast::StorageClass::kPrivate); + + auto* call = Call("determinant", "var"); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinTest, Determinant_3x3_f32) { + GlobalVar("var", ty.mat3x3(), ast::StorageClass::kPrivate); + + auto* call = Call("determinant", "var"); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinTest, Determinant_3x3_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("var", ty.mat3x3(), ast::StorageClass::kPrivate); + + auto* call = Call("determinant", "var"); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinTest, Determinant_4x4_f32) { + GlobalVar("var", ty.mat4x4(), ast::StorageClass::kPrivate); + + auto* call = Call("determinant", "var"); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinTest, Determinant_4x4_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("var", ty.mat4x4(), ast::StorageClass::kPrivate); + + auto* call = Call("determinant", "var"); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_F(ResolverBuiltinTest, Determinant_NotSquare) { + GlobalVar("var", ty.mat2x3(), ast::StorageClass::kPrivate); + + auto* call = Call("determinant", "var"); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to determinant(mat2x3) + +1 candidate function: + determinant(matNxN) -> T where: T is f32 or f16 +)"); +} + +TEST_F(ResolverBuiltinTest, Determinant_NotMatrix) { + GlobalVar("var", ty.f32(), ast::StorageClass::kPrivate); + + auto* call = Call("determinant", "var"); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(error: no matching call to determinant(f32) + +1 candidate function: + determinant(matNxN) -> T where: T is f32 or f16 +)"); +} + +} // namespace matrix_builtin_tests + +// Tests for Numeric builtins with float and integer vector parameter, i.e. "dot" +namespace vector_builtin_tests { + +TEST_F(ResolverBuiltinTest, Dot_Vec2_f32) { + GlobalVar("my_var", ty.vec2(), ast::StorageClass::kPrivate); + + auto* expr = Call("dot", "my_var", "my_var"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(expr), nullptr); + EXPECT_TRUE(TypeOf(expr)->Is()); +} + +TEST_F(ResolverBuiltinTest, Dot_Vec2_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("my_var", ty.vec2(), ast::StorageClass::kPrivate); + + auto* expr = Call("dot", "my_var", "my_var"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(expr), nullptr); + EXPECT_TRUE(TypeOf(expr)->Is()); +} + +TEST_F(ResolverBuiltinTest, Dot_Vec3_i32) { + GlobalVar("my_var", ty.vec3(), ast::StorageClass::kPrivate); + + auto* expr = Call("dot", "my_var", "my_var"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(expr), nullptr); + EXPECT_TRUE(TypeOf(expr)->Is()); +} + +TEST_F(ResolverBuiltinTest, Dot_Vec4_u32) { + GlobalVar("my_var", ty.vec4(), ast::StorageClass::kPrivate); + + auto* expr = Call("dot", "my_var", "my_var"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(expr), nullptr); + EXPECT_TRUE(TypeOf(expr)->Is()); +} + +TEST_F(ResolverBuiltinTest, Dot_Error_Scalar) { + auto* expr = Call("dot", 1_f, 1_f); + WrapInFunction(expr); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(error: no matching call to dot(f32, f32) + +1 candidate function: + dot(vecN, vecN) -> T where: T is f32, i32, u32 or f16 +)"); +} + +} // namespace vector_builtin_tests + +// Tests for Derivative builtins +namespace derivative_builtin_tests { + using ResolverBuiltinDerivativeTest = ResolverTestWithParam; + TEST_P(ResolverBuiltinDerivativeTest, Scalar) { auto name = GetParam(); - Global("ident", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("ident", ty.f32(), ast::StorageClass::kPrivate); auto* expr = Call(name, "ident"); - Func("func", {}, ty.void_(), {Ignore(expr)}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), utils::Vector{Ignore(expr)}, + utils::Vector{create(ast::PipelineStage::kFragment)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -66,11 +2050,11 @@ TEST_P(ResolverBuiltinDerivativeTest, Scalar) { TEST_P(ResolverBuiltinDerivativeTest, Vector) { auto name = GetParam(); - Global("ident", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("ident", ty.vec4(), ast::StorageClass::kPrivate); auto* expr = Call(name, "ident"); - Func("func", {}, ty.void_(), {Ignore(expr)}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), utils::Vector{Ignore(expr)}, + utils::Vector{create(ast::PipelineStage::kFragment)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -106,36 +2090,10 @@ INSTANTIATE_TEST_SUITE_P(ResolverTest, "fwidthCoarse", "fwidthFine")); -using ResolverBuiltinTest_BoolMethod = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_BoolMethod, Scalar) { - auto name = GetParam(); +} // namespace derivative_builtin_tests - Global("my_var", ty.bool_(), ast::StorageClass::kPrivate); - - auto* expr = Call(name, "my_var"); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(expr), nullptr); - EXPECT_TRUE(TypeOf(expr)->Is()); -} -TEST_P(ResolverBuiltinTest_BoolMethod, Vector) { - auto name = GetParam(); - - Global("my_var", ty.vec3(), ast::StorageClass::kPrivate); - - auto* expr = Call(name, "my_var"); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(expr), nullptr); - EXPECT_TRUE(TypeOf(expr)->Is()); -} -INSTANTIATE_TEST_SUITE_P(ResolverTest, - ResolverBuiltinTest_BoolMethod, - testing::Values("any", "all")); +// Tests for Texture builtins +namespace texture_builtin_tests { enum class Texture { kF32, kI32, kU32 }; inline std::ostream& operator<<(std::ostream& out, Texture data) { @@ -183,19 +2141,15 @@ class ResolverBuiltinTest_TextureOperation : public ResolverTestWithParamIsAnyOf()) { - Global(name, type, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(name, type, Binding(0), Group(0)); } else { - Global(name, type, ast::StorageClass::kPrivate); + GlobalVar(name, type, ast::StorageClass::kPrivate); } - call_params->push_back(Expr(name)); + call_params->Push(Expr(name)); } const ast::Type* subtype(Texture type) { if (type == Texture::kF32) { @@ -217,7 +2171,7 @@ TEST_P(ResolverBuiltinTest_SampledTextureOperation, TextureLoadSampled) { auto* coords_type = GetCoordsType(dim, ty.i32()); auto* texture_type = ty.sampled_texture(dim, s); - ast::ExpressionList call_params; + ExpressionList call_params; add_call_param("texture", texture_type, &call_params); add_call_param("coords", coords_type, &call_params); @@ -250,1342 +2204,14 @@ INSTANTIATE_TEST_SUITE_P(ResolverTest, TextureTestParams{ast::TextureDimension::k2dArray}, TextureTestParams{ast::TextureDimension::k3d})); -TEST_F(ResolverBuiltinTest, Dot_Vec2) { - Global("my_var", ty.vec2(), ast::StorageClass::kPrivate); - - auto* expr = Call("dot", "my_var", "my_var"); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(expr), nullptr); - EXPECT_TRUE(TypeOf(expr)->Is()); -} - -TEST_F(ResolverBuiltinTest, Dot_Vec3) { - Global("my_var", ty.vec3(), ast::StorageClass::kPrivate); - - auto* expr = Call("dot", "my_var", "my_var"); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(expr), nullptr); - EXPECT_TRUE(TypeOf(expr)->Is()); -} - -TEST_F(ResolverBuiltinTest, Dot_Vec4) { - Global("my_var", ty.vec4(), ast::StorageClass::kPrivate); - - auto* expr = Call("dot", "my_var", "my_var"); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(expr), nullptr); - EXPECT_TRUE(TypeOf(expr)->Is()); -} - -TEST_F(ResolverBuiltinTest, Dot_Error_Scalar) { - auto* expr = Call("dot", 1.0f, 1.0f); - WrapInFunction(expr); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to dot(f32, f32) - -1 candidate function: - dot(vecN, vecN) -> T where: T is f32, i32 or u32 -)"); -} - -TEST_F(ResolverBuiltinTest, Select) { - Global("my_var", ty.vec3(), ast::StorageClass::kPrivate); - - Global("bool_var", ty.vec3(), ast::StorageClass::kPrivate); - - auto* expr = Call("select", "my_var", "my_var", "bool_var"); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(expr), nullptr); - EXPECT_TRUE(TypeOf(expr)->Is()); - EXPECT_EQ(TypeOf(expr)->As()->Width(), 3u); - EXPECT_TRUE(TypeOf(expr)->As()->type()->Is()); -} - -TEST_F(ResolverBuiltinTest, Select_Error_NoParams) { - auto* expr = Call("select"); - WrapInFunction(expr); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to select() - -3 candidate functions: - select(T, T, bool) -> T where: T is f32, i32, u32 or bool - select(vecN, vecN, bool) -> vecN where: T is f32, i32, u32 or bool - select(vecN, vecN, vecN) -> vecN where: T is f32, i32, u32 or bool -)"); -} - -TEST_F(ResolverBuiltinTest, Select_Error_SelectorInt) { - auto* expr = Call("select", 1_i, 1_i, 1_i); - WrapInFunction(expr); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to select(i32, i32, i32) - -3 candidate functions: - select(T, T, bool) -> T where: T is f32, i32, u32 or bool - select(vecN, vecN, bool) -> vecN where: T is f32, i32, u32 or bool - select(vecN, vecN, vecN) -> vecN where: T is f32, i32, u32 or bool -)"); -} - -TEST_F(ResolverBuiltinTest, Select_Error_Matrix) { - auto* expr = Call("select", mat2x2(vec2(1.0f, 1.0f), vec2(1.0f, 1.0f)), - mat2x2(vec2(1.0f, 1.0f), vec2(1.0f, 1.0f)), Expr(true)); - WrapInFunction(expr); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to select(mat2x2, mat2x2, bool) - -3 candidate functions: - select(T, T, bool) -> T where: T is f32, i32, u32 or bool - select(vecN, vecN, bool) -> vecN where: T is f32, i32, u32 or bool - select(vecN, vecN, vecN) -> vecN where: T is f32, i32, u32 or bool -)"); -} - -TEST_F(ResolverBuiltinTest, Select_Error_MismatchTypes) { - auto* expr = Call("select", 1.0f, vec2(2.0f, 3.0f), Expr(true)); - WrapInFunction(expr); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to select(f32, vec2, bool) - -3 candidate functions: - select(T, T, bool) -> T where: T is f32, i32, u32 or bool - select(vecN, vecN, bool) -> vecN where: T is f32, i32, u32 or bool - select(vecN, vecN, vecN) -> vecN where: T is f32, i32, u32 or bool -)"); -} - -TEST_F(ResolverBuiltinTest, Select_Error_MismatchVectorSize) { - auto* expr = Call("select", vec2(1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), Expr(true)); - WrapInFunction(expr); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to select(vec2, vec3, bool) - -3 candidate functions: - select(T, T, bool) -> T where: T is f32, i32, u32 or bool - select(vecN, vecN, bool) -> vecN where: T is f32, i32, u32 or bool - select(vecN, vecN, vecN) -> vecN where: T is f32, i32, u32 or bool -)"); -} - -struct BuiltinData { - const char* name; - BuiltinType builtin; -}; - -inline std::ostream& operator<<(std::ostream& out, BuiltinData data) { - out << data.name; - return out; -} - -using ResolverBuiltinTest_Barrier = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_Barrier, InferType) { - auto param = GetParam(); - - auto* call = Call(param.name); - WrapInFunction(CallStmt(call)); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_P(ResolverBuiltinTest_Barrier, Error_TooManyParams) { - auto param = GetParam(); - - auto* call = Call(param.name, vec4(1.f, 2.f, 3.f, 4.f), 1.0f); - WrapInFunction(CallStmt(call)); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + std::string(param.name))); -} - -INSTANTIATE_TEST_SUITE_P( - ResolverTest, - ResolverBuiltinTest_Barrier, - testing::Values(BuiltinData{"storageBarrier", BuiltinType::kStorageBarrier}, - BuiltinData{"workgroupBarrier", BuiltinType::kWorkgroupBarrier})); - -using ResolverBuiltinTest_DataPacking = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_DataPacking, InferType) { - auto param = GetParam(); - - bool pack4 = - param.builtin == BuiltinType::kPack4x8snorm || param.builtin == BuiltinType::kPack4x8unorm; - - auto* call = pack4 ? Call(param.name, vec4(1.f, 2.f, 3.f, 4.f)) - : Call(param.name, vec2(1.f, 2.f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_P(ResolverBuiltinTest_DataPacking, Error_IncorrectParamType) { - auto param = GetParam(); - - bool pack4 = - param.builtin == BuiltinType::kPack4x8snorm || param.builtin == BuiltinType::kPack4x8unorm; - - auto* call = pack4 ? Call(param.name, vec4(1_i, 2_i, 3_i, 4_i)) - : Call(param.name, vec2(1_i, 2_i)); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + std::string(param.name))); -} - -TEST_P(ResolverBuiltinTest_DataPacking, Error_NoParams) { - auto param = GetParam(); - - auto* call = Call(param.name); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + std::string(param.name))); -} - -TEST_P(ResolverBuiltinTest_DataPacking, Error_TooManyParams) { - auto param = GetParam(); - - bool pack4 = - param.builtin == BuiltinType::kPack4x8snorm || param.builtin == BuiltinType::kPack4x8unorm; - - auto* call = pack4 ? Call(param.name, vec4(1.f, 2.f, 3.f, 4.f), 1.0f) - : Call(param.name, vec2(1.f, 2.f), 1.0f); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + std::string(param.name))); -} - -INSTANTIATE_TEST_SUITE_P(ResolverTest, - ResolverBuiltinTest_DataPacking, - testing::Values(BuiltinData{"pack4x8snorm", BuiltinType::kPack4x8snorm}, - BuiltinData{"pack4x8unorm", BuiltinType::kPack4x8unorm}, - BuiltinData{"pack2x16snorm", BuiltinType::kPack2x16snorm}, - BuiltinData{"pack2x16unorm", BuiltinType::kPack2x16unorm}, - BuiltinData{"pack2x16float", - BuiltinType::kPack2x16float})); - -using ResolverBuiltinTest_DataUnpacking = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_DataUnpacking, InferType) { - auto param = GetParam(); - - bool pack4 = param.builtin == BuiltinType::kUnpack4x8snorm || - param.builtin == BuiltinType::kUnpack4x8unorm; - - auto* call = Call(param.name, 1_u); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - if (pack4) { - EXPECT_EQ(TypeOf(call)->As()->Width(), 4u); - } else { - EXPECT_EQ(TypeOf(call)->As()->Width(), 2u); - } -} - -INSTANTIATE_TEST_SUITE_P( - ResolverTest, - ResolverBuiltinTest_DataUnpacking, - testing::Values(BuiltinData{"unpack4x8snorm", BuiltinType::kUnpack4x8snorm}, - BuiltinData{"unpack4x8unorm", BuiltinType::kUnpack4x8unorm}, - BuiltinData{"unpack2x16snorm", BuiltinType::kUnpack2x16snorm}, - BuiltinData{"unpack2x16unorm", BuiltinType::kUnpack2x16unorm}, - BuiltinData{"unpack2x16float", BuiltinType::kUnpack2x16float})); - -using ResolverBuiltinTest_SingleParam = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_SingleParam, Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, 1.f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_scalar()); -} - -TEST_P(ResolverBuiltinTest_SingleParam, Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1.0f, 1.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_SingleParam, Error_NoParams) { - auto param = GetParam(); - - auto* call = Call(param.name); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), "error: no matching call to " + std::string(param.name) + - "()\n\n" - "2 candidate functions:\n " + - std::string(param.name) + "(f32) -> f32\n " + - std::string(param.name) + "(vecN) -> vecN\n"); -} - -TEST_P(ResolverBuiltinTest_SingleParam, Error_TooManyParams) { - auto param = GetParam(); - - auto* call = Call(param.name, 1_i, 2_i, 3_i); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), "error: no matching call to " + std::string(param.name) + - "(i32, i32, i32)\n\n" - "2 candidate functions:\n " + - std::string(param.name) + "(f32) -> f32\n " + - std::string(param.name) + "(vecN) -> vecN\n"); -} - -INSTANTIATE_TEST_SUITE_P(ResolverTest, - ResolverBuiltinTest_SingleParam, - testing::Values(BuiltinData{"acos", BuiltinType::kAcos}, - BuiltinData{"asin", BuiltinType::kAsin}, - BuiltinData{"atan", BuiltinType::kAtan}, - BuiltinData{"ceil", BuiltinType::kCeil}, - BuiltinData{"cos", BuiltinType::kCos}, - BuiltinData{"cosh", BuiltinType::kCosh}, - BuiltinData{"exp", BuiltinType::kExp}, - BuiltinData{"exp2", BuiltinType::kExp2}, - BuiltinData{"floor", BuiltinType::kFloor}, - BuiltinData{"fract", BuiltinType::kFract}, - BuiltinData{"inverseSqrt", BuiltinType::kInverseSqrt}, - BuiltinData{"log", BuiltinType::kLog}, - BuiltinData{"log2", BuiltinType::kLog2}, - BuiltinData{"round", BuiltinType::kRound}, - BuiltinData{"sign", BuiltinType::kSign}, - BuiltinData{"sin", BuiltinType::kSin}, - BuiltinData{"sinh", BuiltinType::kSinh}, - BuiltinData{"sqrt", BuiltinType::kSqrt}, - BuiltinData{"tan", BuiltinType::kTan}, - BuiltinData{"tanh", BuiltinType::kTanh}, - BuiltinData{"trunc", BuiltinType::kTrunc})); - -using ResolverBuiltinDataTest = ResolverTest; - -TEST_F(ResolverBuiltinDataTest, ArrayLength_Vector) { - auto* ary = ty.array(); - auto* str = Structure("S", {Member("x", ary)}); - Global("a", ty.Of(str), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); - - auto* call = Call("arrayLength", AddressOf(MemberAccessor("a", "x"))); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_F(ResolverBuiltinDataTest, ArrayLength_Error_ArraySized) { - Global("arr", ty.array(), ast::StorageClass::kPrivate); - auto* call = Call("arrayLength", AddressOf("arr")); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to arrayLength(ptr, read_write>) - -1 candidate function: - arrayLength(ptr, A>) -> u32 -)"); -} - -TEST_F(ResolverBuiltinDataTest, Normalize_Vector) { - auto* call = Call("normalize", vec3(1.0f, 1.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_F(ResolverBuiltinDataTest, Normalize_Error_NoParams) { - auto* call = Call("normalize"); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), R"(error: no matching call to normalize() - -1 candidate function: - normalize(vecN) -> vecN -)"); -} - -TEST_F(ResolverBuiltinDataTest, FrexpScalar) { - auto* call = Call("frexp", 1.0f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - auto* ty = TypeOf(call)->As(); - ASSERT_NE(ty, nullptr); - ASSERT_EQ(ty->Members().size(), 2u); - - auto* sig = ty->Members()[0]; - EXPECT_TRUE(sig->Type()->Is()); - EXPECT_EQ(sig->Offset(), 0u); - EXPECT_EQ(sig->Size(), 4u); - EXPECT_EQ(sig->Align(), 4u); - EXPECT_EQ(sig->Name(), Sym("sig")); - - auto* exp = ty->Members()[1]; - EXPECT_TRUE(exp->Type()->Is()); - EXPECT_EQ(exp->Offset(), 4u); - EXPECT_EQ(exp->Size(), 4u); - EXPECT_EQ(exp->Align(), 4u); - EXPECT_EQ(exp->Name(), Sym("exp")); - - EXPECT_EQ(ty->Size(), 8u); - EXPECT_EQ(ty->SizeNoPadding(), 8u); -} - -TEST_F(ResolverBuiltinDataTest, FrexpVector) { - auto* call = Call("frexp", vec3()); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - auto* ty = TypeOf(call)->As(); - ASSERT_NE(ty, nullptr); - ASSERT_EQ(ty->Members().size(), 2u); - - auto* sig = ty->Members()[0]; - ASSERT_TRUE(sig->Type()->Is()); - EXPECT_EQ(sig->Type()->As()->Width(), 3u); - EXPECT_TRUE(sig->Type()->As()->type()->Is()); - EXPECT_EQ(sig->Offset(), 0u); - EXPECT_EQ(sig->Size(), 12u); - EXPECT_EQ(sig->Align(), 16u); - EXPECT_EQ(sig->Name(), Sym("sig")); - - auto* exp = ty->Members()[1]; - ASSERT_TRUE(exp->Type()->Is()); - EXPECT_EQ(exp->Type()->As()->Width(), 3u); - EXPECT_TRUE(exp->Type()->As()->type()->Is()); - EXPECT_EQ(exp->Offset(), 16u); - EXPECT_EQ(exp->Size(), 12u); - EXPECT_EQ(exp->Align(), 16u); - EXPECT_EQ(exp->Name(), Sym("exp")); - - EXPECT_EQ(ty->Size(), 32u); - EXPECT_EQ(ty->SizeNoPadding(), 28u); -} - -TEST_F(ResolverBuiltinDataTest, Frexp_Error_FirstParamInt) { - Global("v", ty.i32(), ast::StorageClass::kWorkgroup); - auto* call = Call("frexp", 1_i, AddressOf("v")); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to frexp(i32, ptr) - -2 candidate functions: - frexp(f32) -> __frexp_result - frexp(vecN) -> __frexp_result_vecN -)"); -} - -TEST_F(ResolverBuiltinDataTest, Frexp_Error_SecondParamFloatPtr) { - Global("v", ty.f32(), ast::StorageClass::kWorkgroup); - auto* call = Call("frexp", 1.0f, AddressOf("v")); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to frexp(f32, ptr) - -2 candidate functions: - frexp(f32) -> __frexp_result - frexp(vecN) -> __frexp_result_vecN -)"); -} - -TEST_F(ResolverBuiltinDataTest, Frexp_Error_SecondParamNotAPointer) { - auto* call = Call("frexp", 1.0f, 1_i); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), R"(error: no matching call to frexp(f32, i32) - -2 candidate functions: - frexp(f32) -> __frexp_result - frexp(vecN) -> __frexp_result_vecN -)"); -} - -TEST_F(ResolverBuiltinDataTest, Frexp_Error_VectorSizesDontMatch) { - Global("v", ty.vec4(), ast::StorageClass::kWorkgroup); - auto* call = Call("frexp", vec2(1.0f, 2.0f), AddressOf("v")); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to frexp(vec2, ptr, read_write>) - -2 candidate functions: - frexp(vecN) -> __frexp_result_vecN - frexp(f32) -> __frexp_result -)"); -} - -TEST_F(ResolverBuiltinDataTest, ModfScalar) { - auto* call = Call("modf", 1.0f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - auto* ty = TypeOf(call)->As(); - ASSERT_NE(ty, nullptr); - ASSERT_EQ(ty->Members().size(), 2u); - - auto* fract = ty->Members()[0]; - EXPECT_TRUE(fract->Type()->Is()); - EXPECT_EQ(fract->Offset(), 0u); - EXPECT_EQ(fract->Size(), 4u); - EXPECT_EQ(fract->Align(), 4u); - EXPECT_EQ(fract->Name(), Sym("fract")); - - auto* whole = ty->Members()[1]; - EXPECT_TRUE(whole->Type()->Is()); - EXPECT_EQ(whole->Offset(), 4u); - EXPECT_EQ(whole->Size(), 4u); - EXPECT_EQ(whole->Align(), 4u); - EXPECT_EQ(whole->Name(), Sym("whole")); - - EXPECT_EQ(ty->Size(), 8u); - EXPECT_EQ(ty->SizeNoPadding(), 8u); -} - -TEST_F(ResolverBuiltinDataTest, ModfVector) { - auto* call = Call("modf", vec3()); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - auto* ty = TypeOf(call)->As(); - ASSERT_NE(ty, nullptr); - ASSERT_EQ(ty->Members().size(), 2u); - - auto* fract = ty->Members()[0]; - ASSERT_TRUE(fract->Type()->Is()); - EXPECT_EQ(fract->Type()->As()->Width(), 3u); - EXPECT_TRUE(fract->Type()->As()->type()->Is()); - EXPECT_EQ(fract->Offset(), 0u); - EXPECT_EQ(fract->Size(), 12u); - EXPECT_EQ(fract->Align(), 16u); - EXPECT_EQ(fract->Name(), Sym("fract")); - - auto* whole = ty->Members()[1]; - ASSERT_TRUE(whole->Type()->Is()); - EXPECT_EQ(whole->Type()->As()->Width(), 3u); - EXPECT_TRUE(whole->Type()->As()->type()->Is()); - EXPECT_EQ(whole->Offset(), 16u); - EXPECT_EQ(whole->Size(), 12u); - EXPECT_EQ(whole->Align(), 16u); - EXPECT_EQ(whole->Name(), Sym("whole")); - - EXPECT_EQ(ty->Size(), 32u); - EXPECT_EQ(ty->SizeNoPadding(), 28u); -} - -TEST_F(ResolverBuiltinDataTest, Modf_Error_FirstParamInt) { - Global("whole", ty.f32(), ast::StorageClass::kWorkgroup); - auto* call = Call("modf", 1_i, AddressOf("whole")); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to modf(i32, ptr) - -2 candidate functions: - modf(f32) -> __modf_result - modf(vecN) -> __modf_result_vecN -)"); -} - -TEST_F(ResolverBuiltinDataTest, Modf_Error_SecondParamIntPtr) { - Global("whole", ty.i32(), ast::StorageClass::kWorkgroup); - auto* call = Call("modf", 1.0f, AddressOf("whole")); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to modf(f32, ptr) - -2 candidate functions: - modf(f32) -> __modf_result - modf(vecN) -> __modf_result_vecN -)"); -} - -TEST_F(ResolverBuiltinDataTest, Modf_Error_SecondParamNotAPointer) { - auto* call = Call("modf", 1.0f, 1.0f); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), R"(error: no matching call to modf(f32, f32) - -2 candidate functions: - modf(f32) -> __modf_result - modf(vecN) -> __modf_result_vecN -)"); -} - -TEST_F(ResolverBuiltinDataTest, Modf_Error_VectorSizesDontMatch) { - Global("whole", ty.vec4(), ast::StorageClass::kWorkgroup); - auto* call = Call("modf", vec2(1.0f, 2.0f), AddressOf("whole")); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to modf(vec2, ptr, read_write>) - -2 candidate functions: - modf(vecN) -> __modf_result_vecN - modf(f32) -> __modf_result -)"); -} - -using ResolverBuiltinTest_SingleParam_FloatOrInt = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_SingleParam_FloatOrInt, Float_Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, 1.f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_scalar()); -} - -TEST_P(ResolverBuiltinTest_SingleParam_FloatOrInt, Float_Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1.0f, 1.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_SingleParam_FloatOrInt, Sint_Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, i32(-1)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_P(ResolverBuiltinTest_SingleParam_FloatOrInt, Sint_Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1_i, 1_i, 3_i)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_SingleParam_FloatOrInt, Uint_Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, 1_u); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_P(ResolverBuiltinTest_SingleParam_FloatOrInt, Uint_Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1_u, 1_u, 3_u)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_SingleParam_FloatOrInt, Error_NoParams) { - auto param = GetParam(); - - auto* call = Call(param.name); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - "error: no matching call to " + std::string(param.name) + - "()\n\n" - "2 candidate functions:\n " + - std::string(param.name) + "(T) -> T where: T is f32, i32 or u32\n " + - std::string(param.name) + "(vecN) -> vecN where: T is f32, i32 or u32\n"); -} - -INSTANTIATE_TEST_SUITE_P(ResolverTest, - ResolverBuiltinTest_SingleParam_FloatOrInt, - testing::Values(BuiltinData{"abs", BuiltinType::kAbs})); - -TEST_F(ResolverBuiltinTest, Length_Scalar) { - auto* call = Call("length", 1.f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_scalar()); -} - -TEST_F(ResolverBuiltinTest, Length_FloatVector) { - auto* call = Call("length", vec3(1.0f, 1.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_scalar()); -} - -using ResolverBuiltinTest_TwoParam = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_TwoParam, Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, 1.f, 1.f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_scalar()); -} - -TEST_P(ResolverBuiltinTest_TwoParam, Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1.0f, 1.0f, 3.0f), vec3(1.0f, 1.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_TwoParam, Error_NoTooManyParams) { - auto param = GetParam(); - - auto* call = Call(param.name, 1_i, 2_i, 3_i); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), "error: no matching call to " + std::string(param.name) + - "(i32, i32, i32)\n\n" - "2 candidate functions:\n " + - std::string(param.name) + "(f32, f32) -> f32\n " + - std::string(param.name) + "(vecN, vecN) -> vecN\n"); -} - -TEST_P(ResolverBuiltinTest_TwoParam, Error_NoParams) { - auto param = GetParam(); - - auto* call = Call(param.name); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), "error: no matching call to " + std::string(param.name) + - "()\n\n" - "2 candidate functions:\n " + - std::string(param.name) + "(f32, f32) -> f32\n " + - std::string(param.name) + "(vecN, vecN) -> vecN\n"); -} - -INSTANTIATE_TEST_SUITE_P(ResolverTest, - ResolverBuiltinTest_TwoParam, - testing::Values(BuiltinData{"atan2", BuiltinType::kAtan2}, - BuiltinData{"pow", BuiltinType::kPow}, - BuiltinData{"step", BuiltinType::kStep})); - -TEST_F(ResolverBuiltinTest, Distance_Scalar) { - auto* call = Call("distance", 1.f, 1.f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_scalar()); -} - -TEST_F(ResolverBuiltinTest, Distance_Vector) { - auto* call = Call("distance", vec3(1.0f, 1.0f, 3.0f), vec3(1.0f, 1.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_F(ResolverBuiltinTest, Cross) { - auto* call = Call("cross", vec3(1.0f, 2.0f, 3.0f), vec3(1.0f, 2.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_F(ResolverBuiltinTest, Cross_Error_NoArgs) { - auto* call = Call("cross"); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), R"(error: no matching call to cross() - -1 candidate function: - cross(vec3, vec3) -> vec3 -)"); -} - -TEST_F(ResolverBuiltinTest, Cross_Error_Scalar) { - auto* call = Call("cross", 1.0f, 1.0f); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), R"(error: no matching call to cross(f32, f32) - -1 candidate function: - cross(vec3, vec3) -> vec3 -)"); -} - -TEST_F(ResolverBuiltinTest, Cross_Error_Vec3Int) { - auto* call = Call("cross", vec3(1_i, 2_i, 3_i), vec3(1_i, 2_i, 3_i)); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to cross(vec3, vec3) - -1 candidate function: - cross(vec3, vec3) -> vec3 -)"); -} - -TEST_F(ResolverBuiltinTest, Cross_Error_Vec4) { - auto* call = - Call("cross", vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(1.0f, 2.0f, 3.0f, 4.0f)); - - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to cross(vec4, vec4) - -1 candidate function: - cross(vec3, vec3) -> vec3 -)"); -} - -TEST_F(ResolverBuiltinTest, Cross_Error_TooManyParams) { - auto* call = Call("cross", vec3(1.0f, 2.0f, 3.0f), vec3(1.0f, 2.0f, 3.0f), - vec3(1.0f, 2.0f, 3.0f)); - - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), - R"(error: no matching call to cross(vec3, vec3, vec3) - -1 candidate function: - cross(vec3, vec3) -> vec3 -)"); -} -TEST_F(ResolverBuiltinTest, Normalize) { - auto* call = Call("normalize", vec3(1.0f, 1.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_F(ResolverBuiltinTest, Normalize_NoArgs) { - auto* call = Call("normalize"); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), R"(error: no matching call to normalize() - -1 candidate function: - normalize(vecN) -> vecN -)"); -} - -using ResolverBuiltinTest_ThreeParam = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_ThreeParam, Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, 1.f, 1.f, 1.f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_scalar()); -} - -TEST_P(ResolverBuiltinTest_ThreeParam, Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1.0f, 1.0f, 3.0f), vec3(1.0f, 1.0f, 3.0f), - vec3(1.0f, 1.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} -TEST_P(ResolverBuiltinTest_ThreeParam, Error_NoParams) { - auto param = GetParam(); - - auto* call = Call(param.name); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_THAT(r()->error(), - HasSubstr("error: no matching call to " + std::string(param.name) + "()")); -} - -INSTANTIATE_TEST_SUITE_P(ResolverTest, - ResolverBuiltinTest_ThreeParam, - testing::Values(BuiltinData{"mix", BuiltinType::kMix}, - BuiltinData{"smoothstep", BuiltinType::kSmoothstep}, - BuiltinData{"smoothStep", BuiltinType::kSmoothStep}, - BuiltinData{"fma", BuiltinType::kFma})); - -using ResolverBuiltinTest_ThreeParam_FloatOrInt = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_ThreeParam_FloatOrInt, Float_Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, 1.f, 1.f, 1.f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_scalar()); -} - -TEST_P(ResolverBuiltinTest_ThreeParam_FloatOrInt, Float_Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1.0f, 1.0f, 3.0f), vec3(1.0f, 1.0f, 3.0f), - vec3(1.0f, 1.0f, 3.0f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_ThreeParam_FloatOrInt, Sint_Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, 1_i, 1_i, 1_i); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_P(ResolverBuiltinTest_ThreeParam_FloatOrInt, Sint_Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1_i, 1_i, 3_i), vec3(1_i, 1_i, 3_i), - vec3(1_i, 1_i, 3_i)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_ThreeParam_FloatOrInt, Uint_Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, 1_u, 1_u, 1_u); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_P(ResolverBuiltinTest_ThreeParam_FloatOrInt, Uint_Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1_u, 1_u, 3_u), vec3(1_u, 1_u, 3_u), - vec3(1_u, 1_u, 3_u)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_ThreeParam_FloatOrInt, Error_NoParams) { - auto param = GetParam(); - - auto* call = Call(param.name); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), "error: no matching call to " + std::string(param.name) + - "()\n\n" - "2 candidate functions:\n " + - std::string(param.name) + - "(T, T, T) -> T where: T is f32, i32 or u32\n " + - std::string(param.name) + - "(vecN, vecN, vecN) -> vecN where: T is f32, i32 " - "or u32\n"); -} - -INSTANTIATE_TEST_SUITE_P(ResolverTest, - ResolverBuiltinTest_ThreeParam_FloatOrInt, - testing::Values(BuiltinData{"clamp", BuiltinType::kClamp})); - -using ResolverBuiltinTest_Int_SingleParam = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_Int_SingleParam, Scalar) { - auto param = GetParam(); - - auto* call = Call(param.name, 1_i); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_integer_scalar()); -} - -TEST_P(ResolverBuiltinTest_Int_SingleParam, Vector) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1_i, 1_i, 3_i)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_Int_SingleParam, Error_NoParams) { - auto param = GetParam(); - - auto* call = Call(param.name); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), "error: no matching call to " + std::string(param.name) + - "()\n\n" - "2 candidate functions:\n " + - std::string(param.name) + "(T) -> T where: T is i32 or u32\n " + - std::string(param.name) + - "(vecN) -> vecN where: T is i32 or u32\n"); -} - -INSTANTIATE_TEST_SUITE_P(ResolverTest, - ResolverBuiltinTest_Int_SingleParam, - testing::Values(BuiltinData{"countOneBits", BuiltinType::kCountOneBits}, - BuiltinData{"reverseBits", BuiltinType::kReverseBits})); - -using ResolverBuiltinTest_FloatOrInt_TwoParam = ResolverTestWithParam; -TEST_P(ResolverBuiltinTest_FloatOrInt_TwoParam, Scalar_Signed) { - auto param = GetParam(); - - auto* call = Call(param.name, 1_i, 1_i); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_P(ResolverBuiltinTest_FloatOrInt_TwoParam, Scalar_Unsigned) { - auto param = GetParam(); - - auto* call = Call(param.name, 1_u, 1_u); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_P(ResolverBuiltinTest_FloatOrInt_TwoParam, Scalar_Float) { - auto param = GetParam(); - - auto* call = Call(param.name, 1.0f, 1.0f); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_P(ResolverBuiltinTest_FloatOrInt_TwoParam, Vector_Signed) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1_i, 1_i, 3_i), vec3(1_i, 1_i, 3_i)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_FloatOrInt_TwoParam, Vector_Unsigned) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1_u, 1_u, 3_u), vec3(1_u, 1_u, 3_u)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_FloatOrInt_TwoParam, Vector_Float) { - auto param = GetParam(); - - auto* call = Call(param.name, vec3(1.f, 1.f, 3.f), vec3(1.f, 1.f, 3.f)); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->is_float_vector()); - EXPECT_EQ(TypeOf(call)->As()->Width(), 3u); -} - -TEST_P(ResolverBuiltinTest_FloatOrInt_TwoParam, Error_NoParams) { - auto param = GetParam(); - - auto* call = Call(param.name); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), "error: no matching call to " + std::string(param.name) + - "()\n\n" - "2 candidate functions:\n " + - std::string(param.name) + - "(T, T) -> T where: T is f32, i32 or u32\n " + - std::string(param.name) + - "(vecN, vecN) -> vecN where: T is f32, i32 or u32\n"); -} - -INSTANTIATE_TEST_SUITE_P(ResolverTest, - ResolverBuiltinTest_FloatOrInt_TwoParam, - testing::Values(BuiltinData{"min", BuiltinType::kMin}, - BuiltinData{"max", BuiltinType::kMax})); - -TEST_F(ResolverBuiltinTest, Determinant_2x2) { - Global("var", ty.mat2x2(), ast::StorageClass::kPrivate); - - auto* call = Call("determinant", "var"); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_F(ResolverBuiltinTest, Determinant_3x3) { - Global("var", ty.mat3x3(), ast::StorageClass::kPrivate); - - auto* call = Call("determinant", "var"); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_F(ResolverBuiltinTest, Determinant_4x4) { - Global("var", ty.mat4x4(), ast::StorageClass::kPrivate); - - auto* call = Call("determinant", "var"); - WrapInFunction(call); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_NE(TypeOf(call), nullptr); - EXPECT_TRUE(TypeOf(call)->Is()); -} - -TEST_F(ResolverBuiltinTest, Determinant_NotSquare) { - Global("var", ty.mat2x3(), ast::StorageClass::kPrivate); - - auto* call = Call("determinant", "var"); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), R"(error: no matching call to determinant(mat2x3) - -1 candidate function: - determinant(matNxN) -> f32 -)"); -} - -TEST_F(ResolverBuiltinTest, Determinant_NotMatrix) { - Global("var", ty.f32(), ast::StorageClass::kPrivate); - - auto* call = Call("determinant", "var"); - WrapInFunction(call); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), R"(error: no matching call to determinant(f32) - -1 candidate function: - determinant(matNxN) -> f32 -)"); -} - using ResolverBuiltinTest_Texture = ResolverTestWithParam; INSTANTIATE_TEST_SUITE_P(ResolverTest, ResolverBuiltinTest_Texture, testing::ValuesIn(ast::builtin::test::TextureOverloadCase::ValidCases())); -std::string to_str(const std::string& function, const sem::ParameterList& params) { +static std::string to_str(const std::string& function, + utils::VectorRef params) { std::stringstream out; out << function << "("; bool first = true; @@ -1600,7 +2226,7 @@ std::string to_str(const std::string& function, const sem::ParameterList& params return out.str(); } -const char* expected_texture_overload(ast::builtin::test::ValidTextureOverload overload) { +static const char* expected_texture_overload(ast::builtin::test::ValidTextureOverload overload) { using ValidTextureOverload = ast::builtin::test::ValidTextureOverload; switch (overload) { case ValidTextureOverload::kDimensions1d: @@ -1840,7 +2466,8 @@ TEST_P(ResolverBuiltinTest_Texture, Call) { auto* call = Call(param.function, param.args(this)); auto* stmt = CallStmt(call); - Func("func", {}, ty.void_(), {stmt}, {Stage(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), utils::Vector{stmt}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1925,15 +2552,156 @@ TEST_P(ResolverBuiltinTest_Texture, Call) { } } - auto* call_sem = Sem().Get(call); + auto* call_sem = Sem().Get(call); ASSERT_NE(call_sem, nullptr); auto* target = call_sem->Target(); ASSERT_NE(target, nullptr); - auto got = resolver::to_str(param.function, target->Parameters()); + auto got = texture_builtin_tests::to_str(param.function, target->Parameters()); auto* expected = expected_texture_overload(param.overload); EXPECT_EQ(got, expected); } +} // namespace texture_builtin_tests + +// Tests for Data Packing builtins +namespace data_packing_builtin_tests { + +using ResolverBuiltinTest_DataPacking = ResolverTestWithParam; +TEST_P(ResolverBuiltinTest_DataPacking, InferType) { + auto param = GetParam(); + + bool pack4 = + param.builtin == BuiltinType::kPack4x8snorm || param.builtin == BuiltinType::kPack4x8unorm; + + auto* call = pack4 ? Call(param.name, vec4(1_f, 2_f, 3_f, 4_f)) + : Call(param.name, vec2(1_f, 2_f)); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_P(ResolverBuiltinTest_DataPacking, Error_IncorrectParamType) { + auto param = GetParam(); + + bool pack4 = + param.builtin == BuiltinType::kPack4x8snorm || param.builtin == BuiltinType::kPack4x8unorm; + + auto* call = pack4 ? Call(param.name, vec4(1_i, 2_i, 3_i, 4_i)) + : Call(param.name, vec2(1_i, 2_i)); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + std::string(param.name))); +} + +TEST_P(ResolverBuiltinTest_DataPacking, Error_NoParams) { + auto param = GetParam(); + + auto* call = Call(param.name); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + std::string(param.name))); +} + +TEST_P(ResolverBuiltinTest_DataPacking, Error_TooManyParams) { + auto param = GetParam(); + + bool pack4 = + param.builtin == BuiltinType::kPack4x8snorm || param.builtin == BuiltinType::kPack4x8unorm; + + auto* call = pack4 ? Call(param.name, vec4(1_f, 2_f, 3_f, 4_f), 1_f) + : Call(param.name, vec2(1_f, 2_f), 1_f); + WrapInFunction(call); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + std::string(param.name))); +} + +INSTANTIATE_TEST_SUITE_P(ResolverTest, + ResolverBuiltinTest_DataPacking, + testing::Values(BuiltinData{"pack4x8snorm", BuiltinType::kPack4x8snorm}, + BuiltinData{"pack4x8unorm", BuiltinType::kPack4x8unorm}, + BuiltinData{"pack2x16snorm", BuiltinType::kPack2x16snorm}, + BuiltinData{"pack2x16unorm", BuiltinType::kPack2x16unorm}, + BuiltinData{"pack2x16float", + BuiltinType::kPack2x16float})); + +} // namespace data_packing_builtin_tests + +// Tests for Data Unpacking builtins +namespace data_unpacking_builtin_tests { + +using ResolverBuiltinTest_DataUnpacking = ResolverTestWithParam; +TEST_P(ResolverBuiltinTest_DataUnpacking, InferType) { + auto param = GetParam(); + + bool pack4 = param.builtin == BuiltinType::kUnpack4x8snorm || + param.builtin == BuiltinType::kUnpack4x8unorm; + + auto* call = Call(param.name, 1_u); + WrapInFunction(call); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->is_float_vector()); + if (pack4) { + EXPECT_EQ(TypeOf(call)->As()->Width(), 4u); + } else { + EXPECT_EQ(TypeOf(call)->As()->Width(), 2u); + } +} + +INSTANTIATE_TEST_SUITE_P( + ResolverTest, + ResolverBuiltinTest_DataUnpacking, + testing::Values(BuiltinData{"unpack4x8snorm", BuiltinType::kUnpack4x8snorm}, + BuiltinData{"unpack4x8unorm", BuiltinType::kUnpack4x8unorm}, + BuiltinData{"unpack2x16snorm", BuiltinType::kUnpack2x16snorm}, + BuiltinData{"unpack2x16unorm", BuiltinType::kUnpack2x16unorm}, + BuiltinData{"unpack2x16float", BuiltinType::kUnpack2x16float})); + +} // namespace data_unpacking_builtin_tests + +// Tests for Synchronization builtins +namespace synchronization_builtin_tests { + +using ResolverBuiltinTest_Barrier = ResolverTestWithParam; +TEST_P(ResolverBuiltinTest_Barrier, InferType) { + auto param = GetParam(); + + auto* call = Call(param.name); + WrapInFunction(CallStmt(call)); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + ASSERT_NE(TypeOf(call), nullptr); + EXPECT_TRUE(TypeOf(call)->Is()); +} + +TEST_P(ResolverBuiltinTest_Barrier, Error_TooManyParams) { + auto param = GetParam(); + + auto* call = Call(param.name, vec4(1_f, 2_f, 3_f, 4_f), 1_f); + WrapInFunction(CallStmt(call)); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("error: no matching call to " + std::string(param.name))); +} + +INSTANTIATE_TEST_SUITE_P( + ResolverTest, + ResolverBuiltinTest_Barrier, + testing::Values(BuiltinData{"storageBarrier", BuiltinType::kStorageBarrier}, + BuiltinData{"workgroupBarrier", BuiltinType::kWorkgroupBarrier})); + +} // namespace synchronization_builtin_tests + } // namespace } // namespace tint::resolver diff --git a/src/tint/resolver/builtin_validation_test.cc b/src/tint/resolver/builtin_validation_test.cc index 98e29fa6ea..63f3ccbc25 100644 --- a/src/tint/resolver/builtin_validation_test.cc +++ b/src/tint/resolver/builtin_validation_test.cc @@ -24,8 +24,8 @@ using ResolverBuiltinValidationTest = ResolverTest; TEST_F(ResolverBuiltinValidationTest, FunctionTypeMustMatchReturnStatementType_void_fail) { // fn func { return workgroupBarrier(); } - Func("func", {}, ty.void_(), - { + Func("func", utils::Empty, ty.void_(), + utils::Vector{ Return(Call(Source{Source::Location{12, 34}}, "workgroupBarrier")), }); @@ -34,12 +34,20 @@ TEST_F(ResolverBuiltinValidationTest, FunctionTypeMustMatchReturnStatementType_v } TEST_F(ResolverBuiltinValidationTest, InvalidPipelineStageDirect) { - // @stage(compute) @workgroup_size(1) fn func { return dpdx(1.0); } + // @compute @workgroup_size(1) fn func { return dpdx(1.0); } - auto* dpdx = - create(Source{{3, 4}}, Expr("dpdx"), ast::ExpressionList{Expr(1.0f)}); - Func(Source{{1, 2}}, "func", ast::VariableList{}, ty.void_(), {CallStmt(dpdx)}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + auto* dpdx = create(Source{{3, 4}}, Expr("dpdx"), + utils::Vector{ + Expr(1_f), + }); + Func(Source{{1, 2}}, "func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(dpdx), + }, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "3:4 error: built-in cannot be used by compute pipeline stage"); @@ -49,18 +57,35 @@ TEST_F(ResolverBuiltinValidationTest, InvalidPipelineStageIndirect) { // fn f0 { return dpdx(1.0); } // fn f1 { f0(); } // fn f2 { f1(); } - // @stage(compute) @workgroup_size(1) fn main { return f2(); } + // @compute @workgroup_size(1) fn main { return f2(); } - auto* dpdx = - create(Source{{3, 4}}, Expr("dpdx"), ast::ExpressionList{Expr(1.0f)}); - Func(Source{{1, 2}}, "f0", {}, ty.void_(), {CallStmt(dpdx)}); + auto* dpdx = create(Source{{3, 4}}, Expr("dpdx"), + utils::Vector{ + Expr(1_f), + }); + Func(Source{{1, 2}}, "f0", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(dpdx), + }); - Func(Source{{3, 4}}, "f1", {}, ty.void_(), {CallStmt(Call("f0"))}); + Func(Source{{3, 4}}, "f1", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("f0")), + }); - Func(Source{{5, 6}}, "f2", {}, ty.void_(), {CallStmt(Call("f1"))}); + Func(Source{{5, 6}}, "f2", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("f1")), + }); - Func(Source{{7, 8}}, "main", {}, ty.void_(), {CallStmt(Call("f2"))}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + Func(Source{{7, 8}}, "main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("f2")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -72,27 +97,28 @@ TEST_F(ResolverBuiltinValidationTest, InvalidPipelineStageIndirect) { } TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsFunction) { - Func(Source{{12, 34}}, "mix", {}, ty.i32(), {}); + Func(Source{{12, 34}}, "mix", utils::Empty, ty.i32(), {}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(12:34 error: 'mix' is a builtin and cannot be redeclared as a function)"); } -TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsGlobalLet) { +TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsGlobalConst) { GlobalConst(Source{{12, 34}}, "mix", ty.i32(), Expr(1_i)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - R"(12:34 error: 'mix' is a builtin and cannot be redeclared as a module-scope let)"); + R"(12:34 error: 'mix' is a builtin and cannot be redeclared as a 'const')"); } TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsGlobalVar) { - Global(Source{{12, 34}}, "mix", ty.i32(), Expr(1_i), ast::StorageClass::kPrivate); + GlobalVar(Source{{12, 34}}, "mix", ty.i32(), Expr(1_i), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - R"(12:34 error: 'mix' is a builtin and cannot be redeclared as a module-scope var)"); + EXPECT_EQ( + r()->error(), + R"(12:34 error: 'mix' is a builtin and cannot be redeclared as a module-scope 'var')"); } TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsAlias) { @@ -104,7 +130,10 @@ TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsAlias) { } TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsStruct) { - Structure(Source{{12, 34}}, "mix", {Member("m", ty.i32())}); + Structure(Source{{12, 34}}, "mix", + utils::Vector{ + Member("m", ty.i32()), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -225,7 +254,7 @@ TEST_P(BuiltinTextureConstExprArgValidationTest, Immediate) { overload.BuildSamplerVariable(this); auto args = overload.args(this); - auto*& arg_to_replace = (param.position == Position::kFirst) ? args.front() : args.back(); + auto*& arg_to_replace = (param.position == Position::kFirst) ? args.Front() : args.Back(); // BuildTextureVariable() uses a Literal for scalars, and a CallExpression for // a vector constructor. @@ -238,8 +267,13 @@ TEST_P(BuiltinTextureConstExprArgValidationTest, Immediate) { arg_to_replace = expr(Source{{12, 34}}, *this); // Call the builtin with the constexpr argument replaced - Func("func", {}, ty.void_(), {CallStmt(Call(overload.function, args))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call(overload.function, args)), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); if (expr.invalid_index == Constexpr::kValid) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -250,11 +284,11 @@ TEST_P(BuiltinTextureConstExprArgValidationTest, Immediate) { err << "12:34 error: each component of the " << param.name << " argument must be at least " << param.min << " and at most " << param.max << ". " << param.name << " component " << expr.invalid_index << " is " - << std::to_string(expr.values[expr.invalid_index]); + << std::to_string(expr.values[static_cast(expr.invalid_index)]); } else { err << "12:34 error: the " << param.name << " argument must be at least " << param.min << " and at most " << param.max << ". " << param.name << " is " - << std::to_string(expr.values[expr.invalid_index]); + << std::to_string(expr.values[static_cast(expr.invalid_index)]); } EXPECT_EQ(r()->error(), err.str()); } @@ -270,11 +304,11 @@ TEST_P(BuiltinTextureConstExprArgValidationTest, GlobalConst) { overload.BuildTextureVariable(this); overload.BuildSamplerVariable(this); - // Build the module-scope let 'G' with the offset value - GlobalConst("G", nullptr, expr({}, *this)); + // Build the module-scope const 'G' with the offset value + GlobalConst("G", expr({}, *this)); auto args = overload.args(this); - auto*& arg_to_replace = (param.position == Position::kFirst) ? args.front() : args.back(); + auto*& arg_to_replace = (param.position == Position::kFirst) ? args.Front() : args.Back(); // Make the expression to be replaced, reachable. This keeps the resolver // happy. @@ -283,15 +317,19 @@ TEST_P(BuiltinTextureConstExprArgValidationTest, GlobalConst) { arg_to_replace = Expr(Source{{12, 34}}, "G"); // Call the builtin with the constexpr argument replaced - Func("func", {}, ty.void_(), {CallStmt(Call(overload.function, args))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call(overload.function, args)), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); std::stringstream err; err << "12:34 error: the " << param.name << " argument must be a const_expression"; EXPECT_EQ(r()->error(), err.str()); } - INSTANTIATE_TEST_SUITE_P( Offset2D, BuiltinTextureConstExprArgValidationTest, @@ -371,5 +409,65 @@ INSTANTIATE_TEST_SUITE_P( } // namespace texture_constexpr_args +// TODO(crbug.com/tint/1497): Update or remove ResolverDP4aExtensionValidationTest when the +// experimental extension chromium_experimental_dp4a is not needed. +using ResolverDP4aExtensionValidationTest = ResolverTest; + +TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithExtension) { + // enable chromium_experimental_dp4a; + // fn func { return dot4I8Packed(1u, 2u); } + Enable(ast::Extension::kChromiumExperimentalDp4A); + + Func("func", utils::Empty, ty.i32(), + utils::Vector{ + Return(Call(Source{Source::Location{12, 34}}, "dot4I8Packed", + utils::Vector{Expr(1_u), Expr(2_u)})), + }); + + EXPECT_TRUE(r()->Resolve()); +} + +TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithoutExtension) { + // fn func { return dot4I8Packed(1u, 2u); } + Func("func", utils::Empty, ty.i32(), + utils::Vector{ + Return(Call(Source{Source::Location{12, 34}}, "dot4I8Packed", + utils::Vector{Expr(1_u), Expr(2_u)})), + }); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ( + r()->error(), + R"(12:34 error: cannot call built-in function 'dot4I8Packed' without extension chromium_experimental_dp4a)"); +} + +TEST_F(ResolverDP4aExtensionValidationTest, Dot4U8PackedWithExtension) { + // enable chromium_experimental_dp4a; + // fn func { return dot4U8Packed(1u, 2u); } + Enable(ast::Extension::kChromiumExperimentalDp4A); + + Func("func", utils::Empty, ty.u32(), + utils::Vector{ + Return(Call(Source{Source::Location{12, 34}}, "dot4U8Packed", + utils::Vector{Expr(1_u), Expr(2_u)})), + }); + + EXPECT_TRUE(r()->Resolve()); +} + +TEST_F(ResolverDP4aExtensionValidationTest, Dot4U8PackedWithoutExtension) { + // fn func { return dot4U8Packed(1u, 2u); } + Func("func", utils::Empty, ty.u32(), + utils::Vector{ + Return(Call(Source{Source::Location{12, 34}}, "dot4U8Packed", + utils::Vector{Expr(1_u), Expr(2_u)})), + }); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ( + r()->error(), + R"(12:34 error: cannot call built-in function 'dot4U8Packed' without extension chromium_experimental_dp4a)"); +} + } // namespace } // namespace tint::resolver diff --git a/src/tint/resolver/builtins_validation_test.cc b/src/tint/resolver/builtins_validation_test.cc index 87835d6161..631890119c 100644 --- a/src/tint/resolver/builtins_validation_test.cc +++ b/src/tint/resolver/builtins_validation_test.cc @@ -33,79 +33,97 @@ class ResolverBuiltinsValidationTest : public resolver::TestHelper, public testi namespace StageTest { struct Params { builder::ast_type_func_ptr type; - ast::Builtin builtin; + ast::BuiltinValue builtin; ast::PipelineStage stage; bool is_valid; }; template -constexpr Params ParamsFor(ast::Builtin builtin, ast::PipelineStage stage, bool is_valid) { +constexpr Params ParamsFor(ast::BuiltinValue builtin, ast::PipelineStage stage, bool is_valid) { return Params{DataType::AST, builtin, stage, is_valid}; } static constexpr Params cases[] = { - ParamsFor>(ast::Builtin::kPosition, ast::PipelineStage::kVertex, false), - ParamsFor>(ast::Builtin::kPosition, ast::PipelineStage::kFragment, true), - ParamsFor>(ast::Builtin::kPosition, ast::PipelineStage::kCompute, false), + ParamsFor>(ast::BuiltinValue::kPosition, ast::PipelineStage::kVertex, false), + ParamsFor>(ast::BuiltinValue::kPosition, ast::PipelineStage::kFragment, true), + ParamsFor>(ast::BuiltinValue::kPosition, ast::PipelineStage::kCompute, false), - ParamsFor(ast::Builtin::kVertexIndex, ast::PipelineStage::kVertex, true), - ParamsFor(ast::Builtin::kVertexIndex, ast::PipelineStage::kFragment, false), - ParamsFor(ast::Builtin::kVertexIndex, ast::PipelineStage::kCompute, false), + ParamsFor(ast::BuiltinValue::kVertexIndex, ast::PipelineStage::kVertex, true), + ParamsFor(ast::BuiltinValue::kVertexIndex, ast::PipelineStage::kFragment, false), + ParamsFor(ast::BuiltinValue::kVertexIndex, ast::PipelineStage::kCompute, false), - ParamsFor(ast::Builtin::kInstanceIndex, ast::PipelineStage::kVertex, true), - ParamsFor(ast::Builtin::kInstanceIndex, ast::PipelineStage::kFragment, false), - ParamsFor(ast::Builtin::kInstanceIndex, ast::PipelineStage::kCompute, false), + ParamsFor(ast::BuiltinValue::kInstanceIndex, ast::PipelineStage::kVertex, true), + ParamsFor(ast::BuiltinValue::kInstanceIndex, ast::PipelineStage::kFragment, false), + ParamsFor(ast::BuiltinValue::kInstanceIndex, ast::PipelineStage::kCompute, false), - ParamsFor(ast::Builtin::kFrontFacing, ast::PipelineStage::kVertex, false), - ParamsFor(ast::Builtin::kFrontFacing, ast::PipelineStage::kFragment, true), - ParamsFor(ast::Builtin::kFrontFacing, ast::PipelineStage::kCompute, false), + ParamsFor(ast::BuiltinValue::kFrontFacing, ast::PipelineStage::kVertex, false), + ParamsFor(ast::BuiltinValue::kFrontFacing, ast::PipelineStage::kFragment, true), + ParamsFor(ast::BuiltinValue::kFrontFacing, ast::PipelineStage::kCompute, false), - ParamsFor>(ast::Builtin::kLocalInvocationId, ast::PipelineStage::kVertex, false), - ParamsFor>(ast::Builtin::kLocalInvocationId, ast::PipelineStage::kFragment, false), - ParamsFor>(ast::Builtin::kLocalInvocationId, ast::PipelineStage::kCompute, true), + ParamsFor>(ast::BuiltinValue::kLocalInvocationId, ast::PipelineStage::kVertex, false), + ParamsFor>(ast::BuiltinValue::kLocalInvocationId, + ast::PipelineStage::kFragment, + false), + ParamsFor>(ast::BuiltinValue::kLocalInvocationId, ast::PipelineStage::kCompute, true), - ParamsFor(ast::Builtin::kLocalInvocationIndex, ast::PipelineStage::kVertex, false), - ParamsFor(ast::Builtin::kLocalInvocationIndex, ast::PipelineStage::kFragment, false), - ParamsFor(ast::Builtin::kLocalInvocationIndex, ast::PipelineStage::kCompute, true), + ParamsFor(ast::BuiltinValue::kLocalInvocationIndex, ast::PipelineStage::kVertex, false), + ParamsFor(ast::BuiltinValue::kLocalInvocationIndex, ast::PipelineStage::kFragment, false), + ParamsFor(ast::BuiltinValue::kLocalInvocationIndex, ast::PipelineStage::kCompute, true), - ParamsFor>(ast::Builtin::kGlobalInvocationId, ast::PipelineStage::kVertex, false), - ParamsFor>(ast::Builtin::kGlobalInvocationId, ast::PipelineStage::kFragment, false), - ParamsFor>(ast::Builtin::kGlobalInvocationId, ast::PipelineStage::kCompute, true), + ParamsFor>(ast::BuiltinValue::kGlobalInvocationId, + ast::PipelineStage::kVertex, + false), + ParamsFor>(ast::BuiltinValue::kGlobalInvocationId, + ast::PipelineStage::kFragment, + false), + ParamsFor>(ast::BuiltinValue::kGlobalInvocationId, + ast::PipelineStage::kCompute, + true), - ParamsFor>(ast::Builtin::kWorkgroupId, ast::PipelineStage::kVertex, false), - ParamsFor>(ast::Builtin::kWorkgroupId, ast::PipelineStage::kFragment, false), - ParamsFor>(ast::Builtin::kWorkgroupId, ast::PipelineStage::kCompute, true), + ParamsFor>(ast::BuiltinValue::kWorkgroupId, ast::PipelineStage::kVertex, false), + ParamsFor>(ast::BuiltinValue::kWorkgroupId, ast::PipelineStage::kFragment, false), + ParamsFor>(ast::BuiltinValue::kWorkgroupId, ast::PipelineStage::kCompute, true), - ParamsFor>(ast::Builtin::kNumWorkgroups, ast::PipelineStage::kVertex, false), - ParamsFor>(ast::Builtin::kNumWorkgroups, ast::PipelineStage::kFragment, false), - ParamsFor>(ast::Builtin::kNumWorkgroups, ast::PipelineStage::kCompute, true), + ParamsFor>(ast::BuiltinValue::kNumWorkgroups, ast::PipelineStage::kVertex, false), + ParamsFor>(ast::BuiltinValue::kNumWorkgroups, ast::PipelineStage::kFragment, false), + ParamsFor>(ast::BuiltinValue::kNumWorkgroups, ast::PipelineStage::kCompute, true), - ParamsFor(ast::Builtin::kSampleIndex, ast::PipelineStage::kVertex, false), - ParamsFor(ast::Builtin::kSampleIndex, ast::PipelineStage::kFragment, true), - ParamsFor(ast::Builtin::kSampleIndex, ast::PipelineStage::kCompute, false), + ParamsFor(ast::BuiltinValue::kSampleIndex, ast::PipelineStage::kVertex, false), + ParamsFor(ast::BuiltinValue::kSampleIndex, ast::PipelineStage::kFragment, true), + ParamsFor(ast::BuiltinValue::kSampleIndex, ast::PipelineStage::kCompute, false), - ParamsFor(ast::Builtin::kSampleMask, ast::PipelineStage::kVertex, false), - ParamsFor(ast::Builtin::kSampleMask, ast::PipelineStage::kFragment, true), - ParamsFor(ast::Builtin::kSampleMask, ast::PipelineStage::kCompute, false), + ParamsFor(ast::BuiltinValue::kSampleMask, ast::PipelineStage::kVertex, false), + ParamsFor(ast::BuiltinValue::kSampleMask, ast::PipelineStage::kFragment, true), + ParamsFor(ast::BuiltinValue::kSampleMask, ast::PipelineStage::kCompute, false), }; using ResolverBuiltinsStageTest = ResolverTestWithParam; TEST_P(ResolverBuiltinsStageTest, All_input) { const Params& params = GetParam(); - auto* p = Global("p", ty.vec4(), ast::StorageClass::kPrivate); + auto* p = GlobalVar("p", ty.vec4(), ast::StorageClass::kPrivate); auto* input = Param("input", params.type(*this), - ast::AttributeList{Builtin(Source{{12, 34}}, params.builtin)}); + utils::Vector{Builtin(Source{{12, 34}}, params.builtin)}); switch (params.stage) { case ast::PipelineStage::kVertex: - Func("main", {input}, ty.vec4(), {Return(p)}, {Stage(ast::PipelineStage::kVertex)}, - {Builtin(Source{{12, 34}}, ast::Builtin::kPosition)}); + Func("main", utils::Vector{input}, ty.vec4(), utils::Vector{Return(p)}, + utils::Vector{Stage(ast::PipelineStage::kVertex)}, + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kPosition), + }); break; case ast::PipelineStage::kFragment: - Func("main", {input}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}, {}); + Func("main", utils::Vector{input}, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + {}); break; case ast::PipelineStage::kCompute: - Func("main", {input}, ty.void_(), {}, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + Func("main", utils::Vector{input}, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); break; default: break; @@ -126,14 +144,27 @@ INSTANTIATE_TEST_SUITE_P(ResolverBuiltinsValidationTest, testing::ValuesIn(cases)); TEST_F(ResolverBuiltinsValidationTest, FragDepthIsInput_Fail) { - // @stage(fragment) + // @fragment // fn fs_main( // @builtin(frag_depth) fd: f32, // ) -> @location(0) f32 { return 1.0; } - auto* fd = Param("fd", ty.f32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kFragDepth)}); - Func("fs_main", ast::VariableList{fd}, ty.f32(), {Return(1.0f)}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + Func("fs_main", + utils::Vector{ + Param("fd", ty.f32(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kFragDepth), + }), + }, + ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: builtin(frag_depth) cannot be used in input of " @@ -144,16 +175,31 @@ TEST_F(ResolverBuiltinsValidationTest, FragDepthIsInputStruct_Fail) { // struct MyInputs { // @builtin(frag_depth) ff: f32; // }; - // @stage(fragment) + // @fragment // fn fragShader(arg: MyInputs) -> @location(0) f32 { return 1.0; } - auto* s = Structure( - "MyInputs", - {Member("frag_depth", ty.f32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kFragDepth)})}); + auto* s = Structure("MyInputs", + utils::Vector{ + Member("frag_depth", ty.f32(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kFragDepth), + }), + }); - Func("fragShader", {Param("arg", ty.Of(s))}, ty.f32(), {Return(1.0f)}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + Func("fragShader", + utils::Vector{ + Param("arg", ty.Of(s)), + }, + ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: builtin(frag_depth) cannot be used in input of " @@ -165,13 +211,20 @@ TEST_F(ResolverBuiltinsValidationTest, StructBuiltinInsideEntryPoint_Ignored) { // struct S { // @builtin(vertex_index) idx: u32; // }; - // @stage(fragment) + // @fragment // fn fragShader() { var s : S; } - Structure("S", {Member("idx", ty.u32(), {Builtin(ast::Builtin::kVertexIndex)})}); + Structure("S", utils::Vector{ + Member("idx", ty.u32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kVertexIndex), + }), + }); - Func("fragShader", {}, ty.void_(), {Decl(Var("s", ty.type_name("S")))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("fragShader", utils::Empty, ty.void_(), utils::Vector{Decl(Var("s", ty.type_name("S")))}, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()); } @@ -181,24 +234,46 @@ TEST_F(ResolverBuiltinsValidationTest, PositionNotF32_Struct_Fail) { // struct MyInputs { // @builtin(kPosition) p: vec4; // }; - // @stage(fragment) + // @fragment // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; } - auto* m = Member("position", ty.vec4(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kPosition)}); - auto* s = Structure("MyInputs", {m}); - Func("fragShader", {Param("arg", ty.Of(s))}, ty.f32(), {Return(1.0f)}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + auto* s = Structure("MyInputs", + utils::Vector{ + Member("position", ty.vec4(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kPosition), + }), + }); + Func("fragShader", + utils::Vector{ + Param("arg", ty.Of(s)), + }, + ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(position) must be 'vec4'"); } TEST_F(ResolverBuiltinsValidationTest, PositionNotF32_ReturnType_Fail) { - // @stage(vertex) + // @vertex // fn main() -> @builtin(position) f32 { return 1.0; } - Func("main", {}, ty.f32(), {Return(1.0f)}, {Stage(ast::PipelineStage::kVertex)}, - {Builtin(Source{{12, 34}}, ast::Builtin::kPosition)}); + Func("main", utils::Empty, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{Stage(ast::PipelineStage::kVertex)}, + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kPosition), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(position) must be 'vec4'"); @@ -208,14 +283,26 @@ TEST_F(ResolverBuiltinsValidationTest, FragDepthNotF32_Struct_Fail) { // struct MyInputs { // @builtin(kFragDepth) p: i32; // }; - // @stage(fragment) + // @fragment // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; } - auto* m = Member("frag_depth", ty.i32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kFragDepth)}); - auto* s = Structure("MyInputs", {m}); - Func("fragShader", {Param("arg", ty.Of(s))}, ty.f32(), {Return(1.0f)}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + auto* s = Structure("MyInputs", + utils::Vector{ + Member("frag_depth", ty.i32(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kFragDepth), + }), + }); + Func("fragShader", utils::Vector{Param("arg", ty.Of(s))}, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(frag_depth) must be 'f32'"); @@ -225,39 +312,68 @@ TEST_F(ResolverBuiltinsValidationTest, SampleMaskNotU32_Struct_Fail) { // struct MyInputs { // @builtin(sample_mask) m: f32; // }; - // @stage(fragment) + // @fragment // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; } - auto* s = Structure( - "MyInputs", - {Member("m", ty.f32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kSampleMask)})}); - Func("fragShader", {Param("arg", ty.Of(s))}, ty.f32(), {Return(1.0f)}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + auto* s = Structure("MyInputs", + utils::Vector{ + Member("m", ty.f32(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kSampleMask), + }), + }); + Func("fragShader", utils::Vector{Param("arg", ty.Of(s))}, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(sample_mask) must be 'u32'"); } TEST_F(ResolverBuiltinsValidationTest, SampleMaskNotU32_ReturnType_Fail) { - // @stage(fragment) + // @fragment // fn main() -> @builtin(sample_mask) i32 { return 1; } - Func("main", {}, ty.i32(), {Return(1_i)}, {Stage(ast::PipelineStage::kFragment)}, - {Builtin(Source{{12, 34}}, ast::Builtin::kSampleMask)}); + Func("main", utils::Empty, ty.i32(), utils::Vector{Return(1_i)}, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kSampleMask), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(sample_mask) must be 'u32'"); } TEST_F(ResolverBuiltinsValidationTest, SampleMaskIsNotU32_Fail) { - // @stage(fragment) + // @fragment // fn fs_main( // @builtin(sample_mask) arg: bool // ) -> @location(0) f32 { return 1.0; } - auto* arg = Param("arg", ty.bool_(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kSampleMask)}); - Func("fs_main", ast::VariableList{arg}, ty.f32(), {Return(1.0f)}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + Func("fs_main", + utils::Vector{ + Param("arg", ty.bool_(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kSampleMask), + }), + }, + ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(sample_mask) must be 'u32'"); } @@ -266,133 +382,222 @@ TEST_F(ResolverBuiltinsValidationTest, SampleIndexIsNotU32_Struct_Fail) { // struct MyInputs { // @builtin(sample_index) m: f32; // }; - // @stage(fragment) + // @fragment // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; } - auto* s = Structure( - "MyInputs", - {Member("m", ty.f32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kSampleIndex)})}); - Func("fragShader", {Param("arg", ty.Of(s))}, ty.f32(), {Return(1.0f)}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + auto* s = Structure("MyInputs", + utils::Vector{ + Member("m", ty.f32(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kSampleIndex), + }), + }); + Func("fragShader", utils::Vector{Param("arg", ty.Of(s))}, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(sample_index) must be 'u32'"); } TEST_F(ResolverBuiltinsValidationTest, SampleIndexIsNotU32_Fail) { - // @stage(fragment) + // @fragment // fn fs_main( // @builtin(sample_index) arg: bool // ) -> @location(0) f32 { return 1.0; } - auto* arg = Param("arg", ty.bool_(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kSampleIndex)}); - Func("fs_main", ast::VariableList{arg}, ty.f32(), {Return(1.0f)}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + Func("fs_main", + utils::Vector{ + Param("arg", ty.bool_(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kSampleIndex), + }), + }, + ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(sample_index) must be 'u32'"); } TEST_F(ResolverBuiltinsValidationTest, PositionIsNotF32_Fail) { - // @stage(fragment) + // @fragment // fn fs_main( // @builtin(kPosition) p: vec3, // ) -> @location(0) f32 { return 1.0; } - auto* p = Param("p", ty.vec3(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kPosition)}); - Func("fs_main", ast::VariableList{p}, ty.f32(), {Return(1.0f)}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + Func("fs_main", + utils::Vector{ + Param("p", ty.vec3(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kPosition), + }), + }, + ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(position) must be 'vec4'"); } TEST_F(ResolverBuiltinsValidationTest, FragDepthIsNotF32_Fail) { - // @stage(fragment) + // @fragment // fn fs_main() -> @builtin(kFragDepth) f32 { var fd: i32; return fd; } auto* fd = Var("fd", ty.i32()); - Func("fs_main", {}, ty.i32(), {Decl(fd), Return(fd)}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kFragDepth)}); + Func("fs_main", utils::Empty, ty.i32(), + utils::Vector{ + Decl(fd), + Return(fd), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kFragDepth), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(frag_depth) must be 'f32'"); } TEST_F(ResolverBuiltinsValidationTest, VertexIndexIsNotU32_Fail) { - // @stage(vertex) + // @vertex // fn main( // @builtin(kVertexIndex) vi : f32, // @builtin(kPosition) p :vec4 // ) -> @builtin(kPosition) vec4 { return vec4(); } - auto* p = Param("p", ty.vec4(), ast::AttributeList{Builtin(ast::Builtin::kPosition)}); + auto* p = Param("p", ty.vec4(), + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); auto* vi = Param("vi", ty.f32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kVertexIndex)}); - Func("main", ast::VariableList{vi, p}, ty.vec4(), {Return(Expr("p"))}, - ast::AttributeList{Stage(ast::PipelineStage::kVertex)}, - ast::AttributeList{Builtin(ast::Builtin::kPosition)}); + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kVertexIndex), + }); + Func("main", utils::Vector{vi, p}, ty.vec4(), utils::Vector{Return(Expr("p"))}, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(vertex_index) must be 'u32'"); } TEST_F(ResolverBuiltinsValidationTest, InstanceIndexIsNotU32) { - // @stage(vertex) + // @vertex // fn main( // @builtin(kInstanceIndex) ii : f32, // @builtin(kPosition) p :vec4 // ) -> @builtin(kPosition) vec4 { return vec4(); } - auto* p = Param("p", ty.vec4(), ast::AttributeList{Builtin(ast::Builtin::kPosition)}); + auto* p = Param("p", ty.vec4(), + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); auto* ii = Param("ii", ty.f32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kInstanceIndex)}); - Func("main", ast::VariableList{ii, p}, ty.vec4(), {Return(Expr("p"))}, - ast::AttributeList{Stage(ast::PipelineStage::kVertex)}, - ast::AttributeList{Builtin(ast::Builtin::kPosition)}); + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kInstanceIndex), + }); + Func("main", utils::Vector{ii, p}, ty.vec4(), utils::Vector{Return(Expr("p"))}, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(instance_index) must be 'u32'"); } TEST_F(ResolverBuiltinsValidationTest, FragmentBuiltin_Pass) { - // @stage(fragment) + // @fragment // fn fs_main( // @builtin(kPosition) p: vec4, // @builtin(front_facing) ff: bool, // @builtin(sample_index) si: u32, // @builtin(sample_mask) sm : u32 // ) -> @builtin(frag_depth) f32 { var fd: f32; return fd; } - auto* p = Param("p", ty.vec4(), ast::AttributeList{Builtin(ast::Builtin::kPosition)}); - auto* ff = Param("ff", ty.bool_(), ast::AttributeList{Builtin(ast::Builtin::kFrontFacing)}); - auto* si = Param("si", ty.u32(), ast::AttributeList{Builtin(ast::Builtin::kSampleIndex)}); - auto* sm = Param("sm", ty.u32(), ast::AttributeList{Builtin(ast::Builtin::kSampleMask)}); + auto* p = Param("p", ty.vec4(), + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); + auto* ff = Param("ff", ty.bool_(), + utils::Vector{ + Builtin(ast::BuiltinValue::kFrontFacing), + }); + auto* si = Param("si", ty.u32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleIndex), + }); + auto* sm = Param("sm", ty.u32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleMask), + }); auto* var_fd = Var("fd", ty.f32()); - Func("fs_main", ast::VariableList{p, ff, si, sm}, ty.f32(), {Decl(var_fd), Return(var_fd)}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, - ast::AttributeList{Builtin(ast::Builtin::kFragDepth)}); + Func("fs_main", utils::Vector{p, ff, si, sm}, ty.f32(), + utils::Vector{ + Decl(var_fd), + Return(var_fd), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kFragDepth), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, VertexBuiltin_Pass) { - // @stage(vertex) + // @vertex // fn main( // @builtin(vertex_index) vi : u32, // @builtin(instance_index) ii : u32, // ) -> @builtin(position) vec4 { var p :vec4; return p; } auto* vi = Param("vi", ty.u32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kVertexIndex)}); + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kVertexIndex), + }); auto* ii = Param("ii", ty.u32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kInstanceIndex)}); + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kInstanceIndex), + }); auto* p = Var("p", ty.vec4()); - Func("main", ast::VariableList{vi, ii}, ty.vec4(), - { + Func("main", utils::Vector{vi, ii}, ty.vec4(), + utils::Vector{ Decl(p), Return(p), }, - ast::AttributeList{Stage(ast::PipelineStage::kVertex)}, - ast::AttributeList{Builtin(ast::Builtin::kPosition)}); + utils::Vector{Stage(ast::PipelineStage::kVertex)}, + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_Pass) { - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn main( // @builtin(local_invocationId) li_id: vec3, // @builtin(local_invocationIndex) li_index: u32, @@ -402,28 +607,41 @@ TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_Pass) { // ) {} auto* li_id = Param("li_id", ty.vec3(), - ast::AttributeList{Builtin(ast::Builtin::kLocalInvocationId)}); + utils::Vector{ + Builtin(ast::BuiltinValue::kLocalInvocationId), + }); auto* li_index = Param("li_index", ty.u32(), - ast::AttributeList{Builtin(ast::Builtin::kLocalInvocationIndex)}); - auto* gi = - Param("gi", ty.vec3(), ast::AttributeList{Builtin(ast::Builtin::kGlobalInvocationId)}); - auto* wi = Param("wi", ty.vec3(), ast::AttributeList{Builtin(ast::Builtin::kWorkgroupId)}); - auto* nwgs = - Param("nwgs", ty.vec3(), ast::AttributeList{Builtin(ast::Builtin::kNumWorkgroups)}); + utils::Vector{ + Builtin(ast::BuiltinValue::kLocalInvocationIndex), + }); + auto* gi = Param("gi", ty.vec3(), + utils::Vector{ + Builtin(ast::BuiltinValue::kGlobalInvocationId), + }); + auto* wi = Param("wi", ty.vec3(), + utils::Vector{ + Builtin(ast::BuiltinValue::kWorkgroupId), + }); + auto* nwgs = Param("nwgs", ty.vec3(), + utils::Vector{ + Builtin(ast::BuiltinValue::kNumWorkgroups), + }); - Func("main", ast::VariableList{li_id, li_index, gi, wi, nwgs}, ty.void_(), {}, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); + Func("main", utils::Vector{li_id, li_index, gi, wi, nwgs}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_WorkGroupIdNotVec3U32) { auto* wi = Param("wi", ty.f32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kWorkgroupId)}); - Func("main", ast::VariableList{wi}, ty.void_(), {}, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kWorkgroupId), + }); + Func("main", utils::Vector{wi}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -433,10 +651,12 @@ TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_WorkGroupIdNotVec3U32) { TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_NumWorkgroupsNotVec3U32) { auto* nwgs = Param("nwgs", ty.f32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kNumWorkgroups)}); - Func("main", ast::VariableList{nwgs}, ty.void_(), {}, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kNumWorkgroups), + }); + Func("main", utils::Vector{nwgs}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -445,12 +665,13 @@ TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_NumWorkgroupsNotVec3U32) { } TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_GlobalInvocationNotVec3U32) { - auto* gi = - Param("gi", ty.vec3(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kGlobalInvocationId)}); - Func("main", ast::VariableList{gi}, ty.void_(), {}, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); + auto* gi = Param("gi", ty.vec3(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kGlobalInvocationId), + }); + Func("main", utils::Vector{gi}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -459,12 +680,13 @@ TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_GlobalInvocationNotVec3U32 } TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_LocalInvocationIndexNotU32) { - auto* li_index = - Param("li_index", ty.vec3(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kLocalInvocationIndex)}); - Func("main", ast::VariableList{li_index}, ty.void_(), {}, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); + auto* li_index = Param("li_index", ty.vec3(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kLocalInvocationIndex), + }); + Func("main", utils::Vector{li_index}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -473,12 +695,13 @@ TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_LocalInvocationIndexNotU32 } TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_LocalInvocationNotVec3U32) { - auto* li_id = - Param("li_id", ty.vec2(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kLocalInvocationId)}); - Func("main", ast::VariableList{li_id}, ty.void_(), {}, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); + auto* li_id = Param("li_id", ty.vec2(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kLocalInvocationId), + }); + Func("main", utils::Vector{li_id}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -493,32 +716,60 @@ TEST_F(ResolverBuiltinsValidationTest, FragmentBuiltinStruct_Pass) { // @builtin(sample_index) si: u32; // @builtin(sample_mask) sm : u32;; // }; - // @stage(fragment) + // @fragment // fn fragShader(arg: MyInputs) -> @location(0) f32 { return 1.0; } - auto* s = Structure( - "MyInputs", - {Member("position", ty.vec4(), ast::AttributeList{Builtin(ast::Builtin::kPosition)}), - Member("front_facing", ty.bool_(), - ast::AttributeList{Builtin(ast::Builtin::kFrontFacing)}), - Member("sample_index", ty.u32(), ast::AttributeList{Builtin(ast::Builtin::kSampleIndex)}), - Member("sample_mask", ty.u32(), ast::AttributeList{Builtin(ast::Builtin::kSampleMask)})}); - Func("fragShader", {Param("arg", ty.Of(s))}, ty.f32(), {Return(1.0f)}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + auto* s = Structure("MyInputs", utils::Vector{ + Member("position", ty.vec4(), + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }), + Member("front_facing", ty.bool_(), + utils::Vector{ + Builtin(ast::BuiltinValue::kFrontFacing), + }), + Member("sample_index", ty.u32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleIndex), + }), + Member("sample_mask", ty.u32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleMask), + }), + }); + Func("fragShader", utils::Vector{Param("arg", ty.Of(s))}, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, FrontFacingParamIsNotBool_Fail) { - // @stage(fragment) + // @fragment // fn fs_main( // @builtin(front_facing) is_front: i32; // ) -> @location(0) f32 { return 1.0; } - auto* is_front = - Param("is_front", ty.i32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kFrontFacing)}); - Func("fs_main", ast::VariableList{is_front}, ty.f32(), {Return(1.0f)}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + auto* is_front = Param("is_front", ty.i32(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kFrontFacing), + }); + Func("fs_main", utils::Vector{is_front}, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(front_facing) must be 'bool'"); @@ -528,105 +779,114 @@ TEST_F(ResolverBuiltinsValidationTest, FrontFacingMemberIsNotBool_Fail) { // struct MyInputs { // @builtin(front_facing) pos: f32; // }; - // @stage(fragment) + // @fragment // fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; } - auto* s = Structure( - "MyInputs", - {Member("pos", ty.f32(), - ast::AttributeList{Builtin(Source{{12, 34}}, ast::Builtin::kFrontFacing)})}); - Func("fragShader", {Param("is_front", ty.Of(s))}, ty.f32(), {Return(1.0f)}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + auto* s = Structure("MyInputs", + utils::Vector{ + Member("pos", ty.f32(), + utils::Vector{ + Builtin(Source{{12, 34}}, ast::BuiltinValue::kFrontFacing), + }), + }); + Func("fragShader", utils::Vector{Param("is_front", ty.Of(s))}, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: store type of builtin(front_facing) must be 'bool'"); } TEST_F(ResolverBuiltinsValidationTest, Length_Float_Scalar) { - auto* builtin = Call("length", 1.0f); + auto* builtin = Call("length", 1_f); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Length_Float_Vec2) { - auto* builtin = Call("length", vec2(1.0f, 1.0f)); + auto* builtin = Call("length", vec2(1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Length_Float_Vec3) { - auto* builtin = Call("length", vec3(1.0f, 1.0f, 1.0f)); + auto* builtin = Call("length", vec3(1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Length_Float_Vec4) { - auto* builtin = Call("length", vec4(1.0f, 1.0f, 1.0f, 1.0f)); + auto* builtin = Call("length", vec4(1_f, 1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Distance_Float_Scalar) { - auto* builtin = Call("distance", 1.0f, 1.0f); + auto* builtin = Call("distance", 1_f, 1_f); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Distance_Float_Vec2) { - auto* builtin = Call("distance", vec2(1.0f, 1.0f), vec2(1.0f, 1.0f)); + auto* builtin = Call("distance", vec2(1_f, 1_f), vec2(1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Distance_Float_Vec3) { - auto* builtin = Call("distance", vec3(1.0f, 1.0f, 1.0f), vec3(1.0f, 1.0f, 1.0f)); + auto* builtin = Call("distance", vec3(1_f, 1_f, 1_f), vec3(1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Distance_Float_Vec4) { - auto* builtin = - Call("distance", vec4(1.0f, 1.0f, 1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f)); + auto* builtin = Call("distance", vec4(1_f, 1_f, 1_f, 1_f), vec4(1_f, 1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Determinant_Mat2x2) { - auto* builtin = Call("determinant", mat2x2(vec2(1.0f, 1.0f), vec2(1.0f, 1.0f))); + auto* builtin = Call("determinant", mat2x2(vec2(1_f, 1_f), vec2(1_f, 1_f))); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Determinant_Mat3x3) { - auto* builtin = - Call("determinant", mat3x3(vec3(1.0f, 1.0f, 1.0f), vec3(1.0f, 1.0f, 1.0f), - vec3(1.0f, 1.0f, 1.0f))); + auto* builtin = Call( + "determinant", + mat3x3(vec3(1_f, 1_f, 1_f), vec3(1_f, 1_f, 1_f), vec3(1_f, 1_f, 1_f))); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Determinant_Mat4x4) { - auto* builtin = - Call("determinant", - mat4x4(vec4(1.0f, 1.0f, 1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f), - vec4(1.0f, 1.0f, 1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f))); + auto* builtin = Call("determinant", + mat4x4(vec4(1_f, 1_f, 1_f, 1_f), vec4(1_f, 1_f, 1_f, 1_f), + vec4(1_f, 1_f, 1_f, 1_f), vec4(1_f, 1_f, 1_f, 1_f))); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Frexp_Scalar) { - auto* builtin = Call("frexp", 1.0f); + auto* builtin = Call("frexp", 1_f); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -639,7 +899,7 @@ TEST_F(ResolverBuiltinsValidationTest, Frexp_Scalar) { } TEST_F(ResolverBuiltinsValidationTest, Frexp_Vec2) { - auto* builtin = Call("frexp", vec2(1.0f, 1.0f)); + auto* builtin = Call("frexp", vec2(1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -656,7 +916,7 @@ TEST_F(ResolverBuiltinsValidationTest, Frexp_Vec2) { } TEST_F(ResolverBuiltinsValidationTest, Frexp_Vec3) { - auto* builtin = Call("frexp", vec3(1.0f, 1.0f, 1.0f)); + auto* builtin = Call("frexp", vec3(1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -673,7 +933,7 @@ TEST_F(ResolverBuiltinsValidationTest, Frexp_Vec3) { } TEST_F(ResolverBuiltinsValidationTest, Frexp_Vec4) { - auto* builtin = Call("frexp", vec4(1.0f, 1.0f, 1.0f, 1.0f)); + auto* builtin = Call("frexp", vec4(1_f, 1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -690,7 +950,7 @@ TEST_F(ResolverBuiltinsValidationTest, Frexp_Vec4) { } TEST_F(ResolverBuiltinsValidationTest, Modf_Scalar) { - auto* builtin = Call("modf", 1.0f); + auto* builtin = Call("modf", 1_f); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -703,7 +963,7 @@ TEST_F(ResolverBuiltinsValidationTest, Modf_Scalar) { } TEST_F(ResolverBuiltinsValidationTest, Modf_Vec2) { - auto* builtin = Call("modf", vec2(1.0f, 1.0f)); + auto* builtin = Call("modf", vec2(1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -720,7 +980,7 @@ TEST_F(ResolverBuiltinsValidationTest, Modf_Vec2) { } TEST_F(ResolverBuiltinsValidationTest, Modf_Vec3) { - auto* builtin = Call("modf", vec3(1.0f, 1.0f, 1.0f)); + auto* builtin = Call("modf", vec3(1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -737,7 +997,7 @@ TEST_F(ResolverBuiltinsValidationTest, Modf_Vec3) { } TEST_F(ResolverBuiltinsValidationTest, Modf_Vec4) { - auto* builtin = Call("modf", vec4(1.0f, 1.0f, 1.0f, 1.0f)); + auto* builtin = Call("modf", vec4(1_f, 1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -754,36 +1014,35 @@ TEST_F(ResolverBuiltinsValidationTest, Modf_Vec4) { } TEST_F(ResolverBuiltinsValidationTest, Cross_Float_Vec3) { - auto* builtin = Call("cross", vec3(1.0f, 1.0f, 1.0f), vec3(1.0f, 1.0f, 1.0f)); + auto* builtin = Call("cross", vec3(1_f, 1_f, 1_f), vec3(1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Dot_Float_Vec2) { - auto* builtin = Call("dot", vec2(1.0f, 1.0f), vec2(1.0f, 1.0f)); + auto* builtin = Call("dot", vec2(1_f, 1_f), vec2(1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Dot_Float_Vec3) { - auto* builtin = Call("dot", vec3(1.0f, 1.0f, 1.0f), vec3(1.0f, 1.0f, 1.0f)); + auto* builtin = Call("dot", vec3(1_f, 1_f, 1_f), vec3(1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Dot_Float_Vec4) { - auto* builtin = - Call("dot", vec4(1.0f, 1.0f, 1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f)); + auto* builtin = Call("dot", vec4(1_f, 1_f, 1_f, 1_f), vec4(1_f, 1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverBuiltinsValidationTest, Select_Float_Scalar) { - auto* builtin = Call("select", Expr(1.0f), Expr(1.0f), Expr(true)); + auto* builtin = Call("select", Expr(1_f), Expr(1_f), Expr(true)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -805,7 +1064,7 @@ TEST_F(ResolverBuiltinsValidationTest, Select_Boolean_Scalar) { TEST_F(ResolverBuiltinsValidationTest, Select_Float_Vec2) { auto* builtin = - Call("select", vec2(1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(true, true)); + Call("select", vec2(1_f, 1_f), vec2(1_f, 1_f), vec2(true, true)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -838,13 +1097,18 @@ TEST_P(FloatAllMatching, Scalar) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(Expr(1.0f)); + params.Push(Expr(1_f)); } auto* builtin = Call(name, params); - Func("func", {}, ty.void_(), {CallStmt(builtin)}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(builtin), + }, + utils::Vector{ + create(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); EXPECT_TRUE(TypeOf(builtin)->Is()); @@ -854,13 +1118,18 @@ TEST_P(FloatAllMatching, Vec2) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec2(1.0f, 1.0f)); + params.Push(vec2(1_f, 1_f)); } auto* builtin = Call(name, params); - Func("func", {}, ty.void_(), {CallStmt(builtin)}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(builtin), + }, + utils::Vector{ + create(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); EXPECT_TRUE(TypeOf(builtin)->is_float_vector()); @@ -870,13 +1139,18 @@ TEST_P(FloatAllMatching, Vec3) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec3(1.0f, 1.0f, 1.0f)); + params.Push(vec3(1_f, 1_f, 1_f)); } auto* builtin = Call(name, params); - Func("func", {}, ty.void_(), {CallStmt(builtin)}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(builtin), + }, + utils::Vector{ + create(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); EXPECT_TRUE(TypeOf(builtin)->is_float_vector()); @@ -886,13 +1160,18 @@ TEST_P(FloatAllMatching, Vec4) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec4(1.0f, 1.0f, 1.0f, 1.0f)); + params.Push(vec4(1_f, 1_f, 1_f, 1_f)); } auto* builtin = Call(name, params); - Func("func", {}, ty.void_(), {CallStmt(builtin)}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(builtin), + }, + utils::Vector{ + create(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); EXPECT_TRUE(TypeOf(builtin)->is_float_vector()); @@ -948,9 +1227,9 @@ TEST_P(IntegerAllMatching, ScalarUnsigned) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(Construct(1_i)); + params.Push(Construct(1_i)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -963,9 +1242,9 @@ TEST_P(IntegerAllMatching, Vec2Unsigned) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec2(1_u, 1_u)); + params.Push(vec2(1_u, 1_u)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -978,9 +1257,9 @@ TEST_P(IntegerAllMatching, Vec3Unsigned) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec3(1_u, 1_u, 1_u)); + params.Push(vec3(1_u, 1_u, 1_u)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -993,9 +1272,9 @@ TEST_P(IntegerAllMatching, Vec4Unsigned) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec4(1_u, 1_u, 1_u, 1_u)); + params.Push(vec4(1_u, 1_u, 1_u, 1_u)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -1008,9 +1287,9 @@ TEST_P(IntegerAllMatching, ScalarSigned) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(Construct(1_i)); + params.Push(Construct(1_i)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -1023,9 +1302,9 @@ TEST_P(IntegerAllMatching, Vec2Signed) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec2(1_i, 1_i)); + params.Push(vec2(1_i, 1_i)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -1038,9 +1317,9 @@ TEST_P(IntegerAllMatching, Vec3Signed) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec3(1_i, 1_i, 1_i)); + params.Push(vec3(1_i, 1_i, 1_i)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -1053,9 +1332,9 @@ TEST_P(IntegerAllMatching, Vec4Signed) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec4(1_i, 1_i, 1_i, 1_i)); + params.Push(vec4(1_i, 1_i, 1_i, 1_i)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -1080,9 +1359,9 @@ TEST_P(BooleanVectorInput, Vec2) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec2(true, true)); + params.Push(vec2(true, true)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -1094,9 +1373,9 @@ TEST_P(BooleanVectorInput, Vec3) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec3(true, true, true)); + params.Push(vec3(true, true, true)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -1108,9 +1387,9 @@ TEST_P(BooleanVectorInput, Vec4) { std::string name = std::get<0>(GetParam()); uint32_t num_params = std::get<1>(GetParam()); - ast::ExpressionList params; + utils::Vector params; for (uint32_t i = 0; i < num_params; ++i) { - params.push_back(vec4(true, true, true, true)); + params.Push(vec4(true, true, true, true)); } auto* builtin = Call(name, params); WrapInFunction(builtin); @@ -1126,7 +1405,7 @@ using DataPacking4x8 = ResolverBuiltinsValidationTestWithParams; TEST_P(DataPacking4x8, Float_Vec4) { auto name = GetParam(); - auto* builtin = Call(name, vec4(1.0f, 1.0f, 1.0f, 1.0f)); + auto* builtin = Call(name, vec4(1_f, 1_f, 1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -1139,7 +1418,7 @@ using DataPacking2x16 = ResolverBuiltinsValidationTestWithParams; TEST_P(DataPacking2x16, Float_Vec2) { auto name = GetParam(); - auto* builtin = Call(name, vec2(1.0f, 1.0f)); + auto* builtin = Call(name, vec2(1_f, 1_f)); WrapInFunction(builtin); EXPECT_TRUE(r()->Resolve()) << r()->error(); } diff --git a/src/tint/resolver/call_test.cc b/src/tint/resolver/call_test.cc index c8b9856dba..37aaffa09c 100644 --- a/src/tint/resolver/call_test.cc +++ b/src/tint/resolver/call_test.cc @@ -18,6 +18,8 @@ #include "src/tint/ast/call_statement.h" #include "src/tint/resolver/resolver_test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::resolver { namespace { // Helpers and typedefs @@ -69,6 +71,7 @@ static constexpr Params all_param_types[] = { ParamsFor(), // ParamsFor(), // ParamsFor(), // + ParamsFor(), // ParamsFor>(), // ParamsFor>(), // ParamsFor>(), // @@ -79,32 +82,34 @@ static constexpr Params all_param_types[] = { }; TEST_F(ResolverCallTest, Valid) { - ast::VariableList params; - ast::ExpressionList args; + Enable(ast::Extension::kF16); + + utils::Vector params; + utils::Vector args; for (auto& p : all_param_types) { - params.push_back(Param(Sym(), p.create_type(*this))); - args.push_back(p.create_value(*this, 0)); + params.Push(Param(Sym(), p.create_type(*this))); + args.Push(p.create_value(*this, 0)); } - auto* func = Func("foo", std::move(params), ty.f32(), {Return(1.23f)}); + auto* func = Func("foo", std::move(params), ty.f32(), utils::Vector{Return(1.23_f)}); auto* call_expr = Call("foo", std::move(args)); WrapInFunction(call_expr); EXPECT_TRUE(r()->Resolve()) << r()->error(); - auto* call = Sem().Get(call_expr); + auto* call = Sem().Get(call_expr); EXPECT_NE(call, nullptr); EXPECT_EQ(call->Target(), Sem().Get(func)); } TEST_F(ResolverCallTest, OutOfOrder) { auto* call_expr = Call("b"); - Func("a", {}, ty.void_(), {CallStmt(call_expr)}); - auto* b = Func("b", {}, ty.void_(), {}); + Func("a", utils::Empty, ty.void_(), utils::Vector{CallStmt(call_expr)}); + auto* b = Func("b", utils::Empty, ty.void_(), utils::Empty); EXPECT_TRUE(r()->Resolve()) << r()->error(); - auto* call = Sem().Get(call_expr); + auto* call = Sem().Get(call_expr); EXPECT_NE(call, nullptr); EXPECT_EQ(call->Target(), Sem().Get(b)); } diff --git a/src/tint/resolver/call_validation_test.cc b/src/tint/resolver/call_validation_test.cc index 756ba5c91e..3fa71b849a 100644 --- a/src/tint/resolver/call_validation_test.cc +++ b/src/tint/resolver/call_validation_test.cc @@ -26,7 +26,15 @@ namespace { using ResolverCallValidationTest = ResolverTest; TEST_F(ResolverCallValidationTest, TooFewArgs) { - Func("foo", {Param(Sym(), ty.i32()), Param(Sym(), ty.f32())}, ty.void_(), {Return()}); + Func("foo", + utils::Vector{ + Param(Sym(), ty.i32()), + Param(Sym(), ty.f32()), + }, + ty.void_(), + utils::Vector{ + Return(), + }); auto* call = Call(Source{{12, 34}}, "foo", 1_i); WrapInFunction(call); @@ -35,8 +43,16 @@ TEST_F(ResolverCallValidationTest, TooFewArgs) { } TEST_F(ResolverCallValidationTest, TooManyArgs) { - Func("foo", {Param(Sym(), ty.i32()), Param(Sym(), ty.f32())}, ty.void_(), {Return()}); - auto* call = Call(Source{{12, 34}}, "foo", 1_i, 1.0f, 1.0f); + Func("foo", + utils::Vector{ + Param(Sym(), ty.i32()), + Param(Sym(), ty.f32()), + }, + ty.void_(), + utils::Vector{ + Return(), + }); + auto* call = Call(Source{{12, 34}}, "foo", 1_i, 1_f, 1_f); WrapInFunction(call); EXPECT_FALSE(r()->Resolve()); @@ -44,8 +60,16 @@ TEST_F(ResolverCallValidationTest, TooManyArgs) { } TEST_F(ResolverCallValidationTest, MismatchedArgs) { - Func("foo", {Param(Sym(), ty.i32()), Param(Sym(), ty.f32())}, ty.void_(), {Return()}); - auto* call = Call("foo", Expr(Source{{12, 34}}, true), 1.0f); + Func("foo", + utils::Vector{ + Param(Sym(), ty.i32()), + Param(Sym(), ty.f32()), + }, + ty.void_(), + utils::Vector{ + Return(), + }); + auto* call = Call("foo", Expr(Source{{12, 34}}, true), 1_f); WrapInFunction(call); EXPECT_FALSE(r()->Resolve()); @@ -58,10 +82,14 @@ TEST_F(ResolverCallValidationTest, UnusedRetval) { // fn func() -> f32 { return 1.0; } // fn main() {func(); return; } - Func("func", {}, ty.f32(), {Return(Expr(1.0f))}, {}); + Func("func", utils::Empty, ty.f32(), + utils::Vector{ + Return(Expr(1_f)), + }, + utils::Empty); - Func("main", {}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Source{{12, 34}}, Call("func")), Return(), }); @@ -76,9 +104,9 @@ TEST_F(ResolverCallValidationTest, PointerArgument_VariableIdentExpr) { // foo(&z); // } auto* param = Param("p", ty.pointer(ast::StorageClass::kFunction)); - Func("foo", {param}, ty.void_(), {}); - Func("main", {}, ty.void_(), - { + Func("foo", utils::Vector{param}, ty.void_(), utils::Empty); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("z", ty.i32(), Expr(1_i))), CallStmt(Call("foo", AddressOf(Source{{12, 34}}, Expr("z")))), }); @@ -93,9 +121,9 @@ TEST_F(ResolverCallValidationTest, PointerArgument_ConstIdentExpr) { // foo(&z); // } auto* param = Param("p", ty.pointer(ast::StorageClass::kFunction)); - Func("foo", {param}, ty.void_(), {}); - Func("main", {}, ty.void_(), - { + Func("foo", utils::Vector{param}, ty.void_(), utils::Empty); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(Let("z", ty.i32(), Expr(1_i))), CallStmt(Call("foo", AddressOf(Expr(Source{{12, 34}}, "z")))), }); @@ -111,11 +139,13 @@ TEST_F(ResolverCallValidationTest, PointerArgument_NotIdentExprVar) { // var v: S; // foo(&v.m); // } - auto* S = Structure("S", {Member("m", ty.i32())}); + auto* S = Structure("S", utils::Vector{ + Member("m", ty.i32()), + }); auto* param = Param("p", ty.pointer(ast::StorageClass::kFunction)); - Func("foo", {param}, ty.void_(), {}); - Func("main", {}, ty.void_(), - { + Func("foo", utils::Vector{param}, ty.void_(), utils::Empty); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("v", ty.Of(S))), CallStmt(Call("foo", AddressOf(Source{{12, 34}}, MemberAccessor("v", "m")))), }); @@ -133,13 +163,15 @@ TEST_F(ResolverCallValidationTest, PointerArgument_AddressOfMemberAccessor) { // let v: S = S(); // foo(&v.m); // } - auto* S = Structure("S", {Member("m", ty.i32())}); + auto* S = Structure("S", utils::Vector{ + Member("m", ty.i32()), + }); auto* param = Param("p", ty.pointer(ast::StorageClass::kFunction)); - Func("foo", {param}, ty.void_(), {}); - Func("main", {}, ty.void_(), - { + Func("foo", utils::Vector{param}, ty.void_(), utils::Empty); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(Let("v", ty.Of(S), Construct(ty.Of(S)))), - CallStmt(Call("foo", AddressOf(Expr(Source{{12, 34}}, MemberAccessor("v", "m"))))), + CallStmt(Call("foo", AddressOf(MemberAccessor(Source{{12, 34}}, "v", "m")))), }); EXPECT_FALSE(r()->Resolve()); @@ -151,9 +183,19 @@ TEST_F(ResolverCallValidationTest, PointerArgument_FunctionParam) { // fn bar(p: ptr) { // foo(p); // } - Func("foo", {Param("p", ty.pointer(ast::StorageClass::kFunction))}, ty.void_(), {}); - Func("bar", {Param("p", ty.pointer(ast::StorageClass::kFunction))}, ty.void_(), - ast::StatementList{CallStmt(Call("foo", Expr("p")))}); + Func("foo", + utils::Vector{ + Param("p", ty.pointer(ast::StorageClass::kFunction)), + }, + ty.void_(), utils::Empty); + Func("bar", + utils::Vector{ + Param("p", ty.pointer(ast::StorageClass::kFunction)), + }, + ty.void_(), + utils::Vector{ + CallStmt(Call("foo", Expr("p"))), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -163,20 +205,30 @@ TEST_F(ResolverCallValidationTest, PointerArgument_FunctionParamWithMain) { // fn bar(p: ptr) { // foo(p); // } - // @stage(fragment) + // @fragment // fn main() { // var v: i32; // bar(&v); // } - Func("foo", {Param("p", ty.pointer(ast::StorageClass::kFunction))}, ty.void_(), {}); - Func("bar", {Param("p", ty.pointer(ast::StorageClass::kFunction))}, ty.void_(), - ast::StatementList{CallStmt(Call("foo", Expr("p")))}); - Func("main", ast::VariableList{}, ty.void_(), - { + Func("foo", + utils::Vector{ + Param("p", ty.pointer(ast::StorageClass::kFunction)), + }, + ty.void_(), utils::Empty); + Func("bar", + utils::Vector{ + Param("p", ty.pointer(ast::StorageClass::kFunction)), + }, + ty.void_(), + utils::Vector{ + CallStmt(Call("foo", Expr("p"))), + }); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("v", ty.i32(), Expr(1_i))), CallStmt(Call("foo", AddressOf(Expr("v")))), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -185,23 +237,27 @@ TEST_F(ResolverCallValidationTest, PointerArgument_FunctionParamWithMain) { TEST_F(ResolverCallValidationTest, LetPointer) { // fn x(p : ptr) -> i32 {} - // @stage(fragment) + // @fragment // fn main() { // var v: i32; // let p: ptr = &v; // var c: i32 = x(p); // } - Func("x", {Param("p", ty.pointer(ast::StorageClass::kFunction))}, ty.void_(), {}); + Func("x", + utils::Vector{ + Param("p", ty.pointer(ast::StorageClass::kFunction)), + }, + ty.void_(), utils::Empty); auto* v = Var("v", ty.i32()); auto* p = Let("p", ty.pointer(ty.i32(), ast::StorageClass::kFunction), AddressOf(v)); - auto* c = Var("c", ty.i32(), ast::StorageClass::kNone, Call("x", Expr(Source{{12, 34}}, p))); - Func("main", ast::VariableList{}, ty.void_(), - { + auto* c = Var("c", ty.i32(), Call("x", Expr(Source{{12, 34}}, p))); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(v), Decl(p), Decl(c), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); EXPECT_FALSE(r()->Resolve()); @@ -214,20 +270,24 @@ TEST_F(ResolverCallValidationTest, LetPointerPrivate) { // let p: ptr = &v; // fn foo(p : ptr) -> i32 {} // var v: i32; - // @stage(fragment) + // @fragment // fn main() { // var c: i32 = foo(p); // } - Func("foo", {Param("p", ty.pointer(ast::StorageClass::kPrivate))}, ty.void_(), {}); - auto* v = Global("v", ty.i32(), ast::StorageClass::kPrivate); + Func("foo", + utils::Vector{ + Param("p", ty.pointer(ast::StorageClass::kPrivate)), + }, + ty.void_(), utils::Empty); + auto* v = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); auto* p = Let("p", ty.pointer(ty.i32(), ast::StorageClass::kPrivate), AddressOf(v)); - auto* c = Var("c", ty.i32(), ast::StorageClass::kNone, Call("foo", Expr(Source{{12, 34}}, p))); - Func("main", ast::VariableList{}, ty.void_(), - { + auto* c = Var("c", ty.i32(), Call("foo", Expr(Source{{12, 34}}, p))); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(p), Decl(c), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); EXPECT_FALSE(r()->Resolve()); @@ -241,8 +301,11 @@ TEST_F(ResolverCallValidationTest, CallVariable) { // fn f() { // v(); // } - Global("v", ty.i32(), ast::StorageClass::kPrivate); - Func("f", {}, ty.void_(), {CallStmt(Call(Source{{12, 34}}, "v"))}); + GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call(Source{{12, 34}}, "v")), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(error: cannot call variable 'v' @@ -255,9 +318,9 @@ TEST_F(ResolverCallValidationTest, CallVariableShadowsFunction) { // var x : i32; // x(); // } - Func("x", {}, ty.void_(), {}); - Func("f", {}, ty.void_(), - { + Func("x", utils::Empty, ty.void_(), utils::Empty); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var(Source{{56, 78}}, "x", ty.i32())), CallStmt(Call(Source{{12, 34}}, "x")), }); diff --git a/src/tint/resolver/compound_assignment_validation_test.cc b/src/tint/resolver/compound_assignment_validation_test.cc index a3f124db78..9bd5c3a0d3 100644 --- a/src/tint/resolver/compound_assignment_validation_test.cc +++ b/src/tint/resolver/compound_assignment_validation_test.cc @@ -18,6 +18,8 @@ #include "src/tint/resolver/resolver_test_helper.h" #include "src/tint/sem/storage_texture.h" +using ::testing::HasSubstr; + using namespace tint::number_suffixes; // NOLINT namespace tint::resolver { @@ -28,7 +30,7 @@ using ResolverCompoundAssignmentValidationTest = ResolverTest; TEST_F(ResolverCompoundAssignmentValidationTest, CompatibleTypes) { // var a : i32 = 2; // a += 2 - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* var = Var("a", ty.i32(), Expr(2_i)); WrapInFunction(var, CompoundAssign(Source{{12, 34}}, "a", 2_i, ast::BinaryOp::kAdd)); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -39,7 +41,7 @@ TEST_F(ResolverCompoundAssignmentValidationTest, CompatibleTypesThroughAlias) { // var a : myint = 2; // a += 2 auto* myint = Alias("myint", ty.i32()); - auto* var = Var("a", ty.Of(myint), ast::StorageClass::kNone, Expr(2_i)); + auto* var = Var("a", ty.Of(myint), Expr(2_i)); WrapInFunction(var, CompoundAssign(Source{{12, 34}}, "a", 2_i, ast::BinaryOp::kAdd)); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -64,16 +66,15 @@ TEST_F(ResolverCompoundAssignmentValidationTest, IncompatibleTypes) { // a += 2.3; // } - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* var = Var("a", ty.i32(), Expr(2_i)); - auto* assign = CompoundAssign(Source{{12, 34}}, "a", 2.3f, ast::BinaryOp::kAdd); + auto* assign = CompoundAssign(Source{{12, 34}}, "a", 2.3_f, ast::BinaryOp::kAdd); WrapInFunction(var, assign); ASSERT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: compound assignment operand types are invalid: i32 " - "add f32"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching overload for operator += (i32, f32)")); } TEST_F(ResolverCompoundAssignmentValidationTest, IncompatibleOp) { @@ -82,15 +83,15 @@ TEST_F(ResolverCompoundAssignmentValidationTest, IncompatibleOp) { // a |= 2.0; // } - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(1.f)); + auto* var = Var("a", ty.f32(), Expr(1_f)); - auto* assign = CompoundAssign(Source{{12, 34}}, "a", 2.0f, ast::BinaryOp::kOr); + auto* assign = CompoundAssign(Source{{12, 34}}, "a", 2_f, ast::BinaryOp::kOr); WrapInFunction(var, assign); ASSERT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: compound assignment operand types are invalid: f32 or f32"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching overload for operator |= (f32, f32)")); } TEST_F(ResolverCompoundAssignmentValidationTest, VectorScalar_Pass) { @@ -99,9 +100,9 @@ TEST_F(ResolverCompoundAssignmentValidationTest, VectorScalar_Pass) { // a += 1.0; // } - auto* var = Var("a", ty.vec4(), ast::StorageClass::kNone); + auto* var = Var("a", ty.vec4()); - auto* assign = CompoundAssign(Source{{12, 34}}, "a", 1.f, ast::BinaryOp::kAdd); + auto* assign = CompoundAssign(Source{{12, 34}}, "a", 1_f, ast::BinaryOp::kAdd); WrapInFunction(var, assign); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -113,7 +114,7 @@ TEST_F(ResolverCompoundAssignmentValidationTest, ScalarVector_Fail) { // a += vec4(); // } - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone); + auto* var = Var("a", ty.f32()); auto* assign = CompoundAssign(Source{{12, 34}}, "a", vec4(), ast::BinaryOp::kAdd); WrapInFunction(var, assign); @@ -129,9 +130,9 @@ TEST_F(ResolverCompoundAssignmentValidationTest, MatrixScalar_Pass) { // a *= 2.0; // } - auto* var = Var("a", ty.mat4x4(), ast::StorageClass::kNone); + auto* var = Var("a", ty.mat4x4()); - auto* assign = CompoundAssign(Source{{12, 34}}, "a", 2.f, ast::BinaryOp::kMultiply); + auto* assign = CompoundAssign(Source{{12, 34}}, "a", 2_f, ast::BinaryOp::kMultiply); WrapInFunction(var, assign); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -143,7 +144,7 @@ TEST_F(ResolverCompoundAssignmentValidationTest, ScalarMatrix_Fail) { // a *= mat4x4(); // } - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone); + auto* var = Var("a", ty.f32()); auto* assign = CompoundAssign(Source{{12, 34}}, "a", mat4x4(), ast::BinaryOp::kMultiply); WrapInFunction(var, assign); @@ -159,7 +160,7 @@ TEST_F(ResolverCompoundAssignmentValidationTest, VectorMatrix_Pass) { // a *= mat4x4(); // } - auto* var = Var("a", ty.vec4(), ast::StorageClass::kNone); + auto* var = Var("a", ty.vec4()); auto* assign = CompoundAssign(Source{{12, 34}}, "a", mat4x4(), ast::BinaryOp::kMultiply); WrapInFunction(var, assign); @@ -173,16 +174,16 @@ TEST_F(ResolverCompoundAssignmentValidationTest, VectorMatrix_ColumnMismatch) { // a *= mat4x2(); // } - auto* var = Var("a", ty.vec4(), ast::StorageClass::kNone); + auto* var = Var("a", ty.vec4()); auto* assign = CompoundAssign(Source{{12, 34}}, "a", mat4x2(), ast::BinaryOp::kMultiply); WrapInFunction(var, assign); ASSERT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: compound assignment operand types are invalid: " - "vec4 multiply mat4x2"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching overload for operator *= (vec4, mat4x2)")); } TEST_F(ResolverCompoundAssignmentValidationTest, VectorMatrix_ResultMismatch) { @@ -191,7 +192,7 @@ TEST_F(ResolverCompoundAssignmentValidationTest, VectorMatrix_ResultMismatch) { // a *= mat2x4(); // } - auto* var = Var("a", ty.vec4(), ast::StorageClass::kNone); + auto* var = Var("a", ty.vec4()); auto* assign = CompoundAssign(Source{{12, 34}}, "a", mat2x4(), ast::BinaryOp::kMultiply); WrapInFunction(var, assign); @@ -207,7 +208,7 @@ TEST_F(ResolverCompoundAssignmentValidationTest, MatrixVector_Fail) { // a *= vec4(); // } - auto* var = Var("a", ty.mat4x4(), ast::StorageClass::kNone); + auto* var = Var("a", ty.mat4x4()); auto* assign = CompoundAssign(Source{{12, 34}}, "a", vec4(), ast::BinaryOp::kMultiply); WrapInFunction(var, assign); @@ -223,9 +224,8 @@ TEST_F(ResolverCompoundAssignmentValidationTest, Phony) { // } WrapInFunction(CompoundAssign(Source{{56, 78}}, Phony(), 1_i, ast::BinaryOp::kAdd)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "56:78 error: compound assignment operand types are invalid: void " - "add i32"); + EXPECT_THAT(r()->error(), + HasSubstr("56:78 error: no matching overload for operator += (void, i32)")); } TEST_F(ResolverCompoundAssignmentValidationTest, ReadOnlyBuffer) { @@ -233,24 +233,23 @@ TEST_F(ResolverCompoundAssignmentValidationTest, ReadOnlyBuffer) { // { // a += 1i; // } - Global(Source{{12, 34}}, "a", ty.i32(), ast::StorageClass::kStorage, ast::Access::kRead, - GroupAndBinding(0, 0)); + GlobalVar(Source{{12, 34}}, "a", ty.i32(), ast::StorageClass::kStorage, ast::Access::kRead, + Group(0), Binding(0)); WrapInFunction(CompoundAssign(Source{{56, 78}}, "a", 1_i, ast::BinaryOp::kAdd)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "56:78 error: cannot store into a read-only type 'ref'"); + "56:78 error: cannot store into a read-only type 'ref'"); } TEST_F(ResolverCompoundAssignmentValidationTest, LhsConstant) { // let a = 1i; // a += 1i; - auto* a = Let(Source{{12, 34}}, "a", nullptr, Expr(1_i)); + auto* a = Let(Source{{12, 34}}, "a", Expr(1_i)); WrapInFunction(a, CompoundAssign(Expr(Source{{56, 78}}, "a"), 1_i, ast::BinaryOp::kAdd)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), R"(56:78 error: cannot assign to const + EXPECT_EQ(r()->error(), R"(56:78 error: cannot assign to 'let' 12:34 note: 'a' is declared here:)"); } @@ -265,13 +264,13 @@ TEST_F(ResolverCompoundAssignmentValidationTest, LhsLiteral) { TEST_F(ResolverCompoundAssignmentValidationTest, LhsAtomic) { // var a : atomic; // a += a; - Global(Source{{12, 34}}, "a", ty.atomic(ty.i32()), ast::StorageClass::kWorkgroup); + GlobalVar(Source{{12, 34}}, "a", ty.atomic(ty.i32()), ast::StorageClass::kWorkgroup); WrapInFunction(CompoundAssign(Source{{56, 78}}, "a", "a", ast::BinaryOp::kAdd)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "56:78 error: compound assignment operand types are invalid: " - "atomic add atomic"); + EXPECT_THAT( + r()->error(), + HasSubstr("error: no matching overload for operator += (atomic, atomic)")); } } // namespace diff --git a/src/tint/resolver/compound_statement_test.cc b/src/tint/resolver/compound_statement_test.cc index 4061a62baf..0a96cedd8a 100644 --- a/src/tint/resolver/compound_statement_test.cc +++ b/src/tint/resolver/compound_statement_test.cc @@ -21,6 +21,7 @@ #include "src/tint/sem/if_statement.h" #include "src/tint/sem/loop_statement.h" #include "src/tint/sem/switch_statement.h" +#include "src/tint/sem/while_statement.h" using namespace tint::number_suffixes; // NOLINT @@ -34,7 +35,7 @@ TEST_F(ResolverCompoundStatementTest, FunctionBlock) { // var x : 32; // } auto* stmt = Decl(Var("x", ty.i32())); - auto* f = Func("F", {}, ty.void_(), {stmt}); + auto* f = Func("F", utils::Empty, ty.void_(), utils::Vector{stmt}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -56,7 +57,7 @@ TEST_F(ResolverCompoundStatementTest, Block) { // } auto* stmt = Decl(Var("x", ty.i32())); auto* block = Block(stmt); - auto* f = Func("F", {}, ty.void_(), {block}); + auto* f = Func("F", utils::Empty, ty.void_(), utils::Vector{block}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -91,7 +92,7 @@ TEST_F(ResolverCompoundStatementTest, Loop) { auto* brk = Break(); auto* stmt = Ignore(1_i); auto* loop = Loop(Block(brk), Block(stmt)); - auto* f = Func("F", {}, ty.void_(), {loop}); + auto* f = Func("F", utils::Empty, ty.void_(), utils::Vector{loop}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -144,6 +145,35 @@ TEST_F(ResolverCompoundStatementTest, Loop) { } } +TEST_F(ResolverCompoundStatementTest, Loop_EmptyContinuing) { + // fn F() { + // loop { + // break; + // continuing { + // } + // } + // } + auto* brk = Break(); + auto* loop = Loop(Block(brk), Block()); + Func("F", utils::Empty, ty.void_(), utils::Vector{loop}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + { + auto* s = Sem().Get(loop); + ASSERT_NE(s, nullptr); + EXPECT_TRUE(s->Is()); + EXPECT_EQ(s->Parent(), s->FindFirstParent()); + EXPECT_EQ(s->Parent(), s->Block()); + } + { + auto* s = Sem().Get(loop->continuing); + ASSERT_NE(s, nullptr); + EXPECT_TRUE(Is(s)); + EXPECT_TRUE(Is(s->Parent()->Parent())); + } +} + TEST_F(ResolverCompoundStatementTest, ForLoop) { // fn F() { // for (var i : u32; true; i = i + 1u) { @@ -156,7 +186,7 @@ TEST_F(ResolverCompoundStatementTest, ForLoop) { auto* stmt = Return(); auto* body = Block(stmt); auto* for_ = For(init, cond, cont, body); - auto* f = Func("F", {}, ty.void_(), {for_}); + auto* f = Func("F", utils::Empty, ty.void_(), utils::Vector{for_}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -210,6 +240,55 @@ TEST_F(ResolverCompoundStatementTest, ForLoop) { } } +TEST_F(ResolverCompoundStatementTest, While) { + // fn F() { + // while (true) { + // return; + // } + // } + auto* cond = Expr(true); + auto* stmt = Return(); + auto* body = Block(stmt); + auto* while_ = While(cond, body); + auto* f = Func("W", utils::Empty, ty.void_(), utils::Vector{while_}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + { + auto* s = Sem().Get(while_); + ASSERT_NE(s, nullptr); + EXPECT_EQ(Sem().Get(body)->Parent(), s); + EXPECT_TRUE(s->Is()); + EXPECT_EQ(s->Parent(), s->FindFirstParent()); + EXPECT_EQ(s->Parent(), s->Block()); + } + { // Condition expression's statement is the while itself + auto* e = Sem().Get(cond); + ASSERT_NE(e, nullptr); + auto* s = e->Stmt(); + ASSERT_NE(s, nullptr); + ASSERT_TRUE(Is(s)); + ASSERT_NE(s->Parent(), nullptr); + EXPECT_EQ(s->Parent(), s->Block()); + EXPECT_EQ(s->Parent(), s->FindFirstParent()); + EXPECT_TRUE(Is(s->Block())); + } + { + auto* s = Sem().Get(stmt); + ASSERT_NE(s, nullptr); + ASSERT_NE(s->Block(), nullptr); + EXPECT_EQ(s->Parent(), s->Block()); + EXPECT_EQ(s->Block(), s->FindFirstParent()); + EXPECT_TRUE(Is(s->Parent()->Parent())); + EXPECT_EQ(s->Block()->Parent(), s->FindFirstParent()); + ASSERT_TRUE(Is(s->Block()->Parent()->Parent())); + EXPECT_EQ(s->Block()->Parent()->Parent(), + s->FindFirstParent()); + EXPECT_EQ(s->Function()->Declaration(), f); + EXPECT_EQ(s->Block()->Parent()->Parent()->Parent(), nullptr); + } +} + TEST_F(ResolverCompoundStatementTest, If) { // fn F() { // if (cond_a) { diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc new file mode 100644 index 0000000000..9bc1d476df --- /dev/null +++ b/src/tint/resolver/const_eval.cc @@ -0,0 +1,896 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/resolver/const_eval.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "src/tint/program_builder.h" +#include "src/tint/sem/abstract_float.h" +#include "src/tint/sem/abstract_int.h" +#include "src/tint/sem/array.h" +#include "src/tint/sem/bool.h" +#include "src/tint/sem/constant.h" +#include "src/tint/sem/f16.h" +#include "src/tint/sem/f32.h" +#include "src/tint/sem/i32.h" +#include "src/tint/sem/matrix.h" +#include "src/tint/sem/member_accessor_expression.h" +#include "src/tint/sem/type_constructor.h" +#include "src/tint/sem/u32.h" +#include "src/tint/sem/vector.h" +#include "src/tint/utils/compiler_macros.h" +#include "src/tint/utils/map.h" +#include "src/tint/utils/transform.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::resolver { + +namespace { + +/// Returns the first element of a parameter pack +template +T First(T&& first, ...) { + return std::forward(first); +} + +/// Helper that calls `f` passing in the value of all `cs`. +/// Assumes all `cs` are of the same type. +template +auto Dispatch_ia_iu32(F&& f, CONSTANTS&&... cs) { + return Switch( + First(cs...)->Type(), // + [&](const sem::AbstractInt*) { return f(cs->template As()...); }, + [&](const sem::I32*) { return f(cs->template As()...); }, + [&](const sem::U32*) { return f(cs->template As()...); }); +} + +/// Helper that calls `f` passing in the value of all `cs`. +/// Assumes all `cs` are of the same type. +template +auto Dispatch_fia_fi32_f16(F&& f, CONSTANTS&&... cs) { + return Switch( + First(cs...)->Type(), // + [&](const sem::AbstractInt*) { return f(cs->template As()...); }, + [&](const sem::AbstractFloat*) { return f(cs->template As()...); }, + [&](const sem::F32*) { return f(cs->template As()...); }, + [&](const sem::I32*) { return f(cs->template As()...); }, + [&](const sem::F16*) { return f(cs->template As()...); }); +} + +/// Helper that calls `f` passing in the value of all `cs`. +/// Assumes all `cs` are of the same type. +template +auto Dispatch_fia_fiu32_f16(F&& f, CONSTANTS&&... cs) { + return Switch( + First(cs...)->Type(), // + [&](const sem::AbstractInt*) { return f(cs->template As()...); }, + [&](const sem::AbstractFloat*) { return f(cs->template As()...); }, + [&](const sem::F32*) { return f(cs->template As()...); }, + [&](const sem::I32*) { return f(cs->template As()...); }, + [&](const sem::U32*) { return f(cs->template As()...); }, + [&](const sem::F16*) { return f(cs->template As()...); }); +} + +/// Helper that calls `f` passing in the value of all `cs`. +/// Assumes all `cs` are of the same type. +template +auto Dispatch_fa_f32_f16(F&& f, CONSTANTS&&... cs) { + return Switch( + First(cs...)->Type(), // + [&](const sem::AbstractFloat*) { return f(cs->template As()...); }, + [&](const sem::F32*) { return f(cs->template As()...); }, + [&](const sem::F16*) { return f(cs->template As()...); }); +} + +/// ZeroTypeDispatch is a helper for calling the function `f`, passing a single zero-value argument +/// of the C++ type that corresponds to the sem::Type `type`. For example, calling +/// `ZeroTypeDispatch()` with a type of `sem::I32*` will call the function f with a single argument +/// of `i32(0)`. +/// @returns the value returned by calling `f`. +/// @note `type` must be a scalar or abstract numeric type. Other types will not call `f`, and will +/// return the zero-initialized value of the return type for `f`. +template +auto ZeroTypeDispatch(const sem::Type* type, F&& f) { + return Switch( + type, // + [&](const sem::AbstractInt*) { return f(AInt(0)); }, // + [&](const sem::AbstractFloat*) { return f(AFloat(0)); }, // + [&](const sem::I32*) { return f(i32(0)); }, // + [&](const sem::U32*) { return f(u32(0)); }, // + [&](const sem::F32*) { return f(f32(0)); }, // + [&](const sem::F16*) { return f(f16(0)); }, // + [&](const sem::Bool*) { return f(static_cast(0)); }); +} + +/// @returns `value` if `T` is not a Number, otherwise ValueOf returns the inner value of the +/// Number. +template +inline auto ValueOf(T value) { + if constexpr (std::is_same_v, T>) { + return value; + } else { + return value.value; + } +} + +/// @returns true if `value` is a positive zero. +template +inline bool IsPositiveZero(T value) { + using N = UnwrapNumber; + return Number(value) == Number(0); // Considers sign bit +} + +/// Constant inherits from sem::Constant to add an private implementation method for conversion. +struct Constant : public sem::Constant { + /// Convert attempts to convert the constant value to the given type. On error, Convert() + /// creates a new diagnostic message and returns a Failure. + virtual utils::Result Convert(ProgramBuilder& builder, + const sem::Type* target_ty, + const Source& source) const = 0; +}; + +// Forward declaration +const Constant* CreateComposite(ProgramBuilder& builder, + const sem::Type* type, + utils::VectorRef elements); + +/// Element holds a single scalar or abstract-numeric value. +/// Element implements the Constant interface. +template +struct Element : Constant { + static_assert(!std::is_same_v, T> || std::is_same_v, + "T must be a Number or bool"); + + Element(const sem::Type* t, T v) : type(t), value(v) {} + ~Element() override = default; + const sem::Type* Type() const override { return type; } + std::variant Value() const override { + if constexpr (IsFloatingPoint>) { + return static_cast(value); + } else { + return static_cast(value); + } + } + const sem::Constant* Index(size_t) const override { return nullptr; } + bool AllZero() const override { return IsPositiveZero(value); } + bool AnyZero() const override { return IsPositiveZero(value); } + bool AllEqual() const override { return true; } + size_t Hash() const override { return utils::Hash(type, ValueOf(value)); } + + utils::Result Convert(ProgramBuilder& builder, + const sem::Type* target_ty, + const Source& source) const override { + TINT_BEGIN_DISABLE_WARNING(UNREACHABLE_CODE); + if (target_ty == type) { + // If the types are identical, then no conversion is needed. + return this; + } + bool failed = false; + auto* res = ZeroTypeDispatch(target_ty, [&](auto zero_to) -> const Constant* { + // `T` is the source type, `value` is the source value. + // `TO` is the target type. + using TO = std::decay_t; + if constexpr (std::is_same_v) { + // [x -> bool] + return builder.create>(target_ty, !IsPositiveZero(value)); + } else if constexpr (std::is_same_v) { + // [bool -> x] + return builder.create>(target_ty, TO(value ? 1 : 0)); + } else if (auto conv = CheckedConvert(value)) { + // Conversion success + return builder.create>(target_ty, conv.Get()); + // --- Below this point are the failure cases --- + } else if constexpr (std::is_same_v || std::is_same_v) { + // [abstract-numeric -> x] - materialization failure + std::stringstream ss; + ss << "value " << value << " cannot be represented as "; + ss << "'" << builder.FriendlyName(target_ty) << "'"; + builder.Diagnostics().add_error(tint::diag::System::Resolver, ss.str(), source); + failed = true; + } else if constexpr (IsFloatingPoint>) { + // [x -> floating-point] - number not exactly representable + // https://www.w3.org/TR/WGSL/#floating-point-conversion + switch (conv.Failure()) { + case ConversionFailure::kExceedsNegativeLimit: + return builder.create>(target_ty, -TO::Inf()); + case ConversionFailure::kExceedsPositiveLimit: + return builder.create>(target_ty, TO::Inf()); + } + } else { + // [x -> integer] - number not exactly representable + // https://www.w3.org/TR/WGSL/#floating-point-conversion + switch (conv.Failure()) { + case ConversionFailure::kExceedsNegativeLimit: + return builder.create>(target_ty, TO::Lowest()); + case ConversionFailure::kExceedsPositiveLimit: + return builder.create>(target_ty, TO::Highest()); + } + } + return nullptr; // Expression is not constant. + }); + if (failed) { + // A diagnostic error has been raised, and resolving should abort. + return utils::Failure; + } + return res; + TINT_END_DISABLE_WARNING(UNREACHABLE_CODE); + } + + sem::Type const* const type; + const T value; +}; + +/// Splat holds a single Constant value, duplicated as all children. +/// Splat is used for zero-initializers, 'splat' constructors, or constructors where each element is +/// identical. Splat may be of a vector, matrix or array type. +/// Splat implements the Constant interface. +struct Splat : Constant { + Splat(const sem::Type* t, const sem::Constant* e, size_t n) : type(t), el(e), count(n) {} + ~Splat() override = default; + const sem::Type* Type() const override { return type; } + std::variant Value() const override { return {}; } + const sem::Constant* Index(size_t i) const override { return i < count ? el : nullptr; } + bool AllZero() const override { return el->AllZero(); } + bool AnyZero() const override { return el->AnyZero(); } + bool AllEqual() const override { return true; } + size_t Hash() const override { return utils::Hash(type, el->Hash(), count); } + + utils::Result Convert(ProgramBuilder& builder, + const sem::Type* target_ty, + const Source& source) const override { + // Convert the single splatted element type. + // Note: This file is the only place where `sem::Constant`s are created, so this static_cast + // is safe. + auto conv_el = static_cast(el)->Convert( + builder, sem::Type::ElementOf(target_ty), source); + if (!conv_el) { + return utils::Failure; + } + if (!conv_el.Get()) { + return nullptr; + } + return builder.create(target_ty, conv_el.Get(), count); + } + + sem::Type const* const type; + const sem::Constant* el; + const size_t count; +}; + +/// Composite holds a number of mixed child Constant values. +/// Composite may be of a vector, matrix or array type. +/// If each element is the same type and value, then a Splat would be a more efficient constant +/// implementation. Use CreateComposite() to create the appropriate Constant type. +/// Composite implements the Constant interface. +struct Composite : Constant { + Composite(const sem::Type* t, + utils::VectorRef els, + bool all_0, + bool any_0) + : type(t), elements(std::move(els)), all_zero(all_0), any_zero(any_0), hash(CalcHash()) {} + ~Composite() override = default; + const sem::Type* Type() const override { return type; } + std::variant Value() const override { return {}; } + const sem::Constant* Index(size_t i) const override { + return i < elements.Length() ? elements[i] : nullptr; + } + bool AllZero() const override { return all_zero; } + bool AnyZero() const override { return any_zero; } + bool AllEqual() const override { return false; /* otherwise this should be a Splat */ } + size_t Hash() const override { return hash; } + + utils::Result Convert(ProgramBuilder& builder, + const sem::Type* target_ty, + const Source& source) const override { + // Convert each of the composite element types. + auto* el_ty = sem::Type::ElementOf(target_ty); + utils::Vector conv_els; + conv_els.Reserve(elements.Length()); + for (auto* el : elements) { + // Note: This file is the only place where `sem::Constant`s are created, so this + // static_cast is safe. + auto conv_el = static_cast(el)->Convert(builder, el_ty, source); + if (!conv_el) { + return utils::Failure; + } + if (!conv_el.Get()) { + return nullptr; + } + conv_els.Push(conv_el.Get()); + } + return CreateComposite(builder, target_ty, std::move(conv_els)); + } + + size_t CalcHash() { + auto h = utils::Hash(type, all_zero, any_zero); + for (auto* el : elements) { + h = utils::HashCombine(h, el->Hash()); + } + return h; + } + + sem::Type const* const type; + const utils::Vector elements; + const bool all_zero; + const bool any_zero; + const size_t hash; +}; + +/// CreateElement constructs and returns an Element. +template +const Constant* CreateElement(ProgramBuilder& builder, const sem::Type* t, T v) { + return builder.create>(t, v); +} + +/// ZeroValue returns a Constant for the zero-value of the type `type`. +const Constant* ZeroValue(ProgramBuilder& builder, const sem::Type* type) { + return Switch( + type, // + [&](const sem::Vector* v) -> const Constant* { + auto* zero_el = ZeroValue(builder, v->type()); + return builder.create(type, zero_el, v->Width()); + }, + [&](const sem::Matrix* m) -> const Constant* { + auto* zero_el = ZeroValue(builder, m->ColumnType()); + return builder.create(type, zero_el, m->columns()); + }, + [&](const sem::Array* a) -> const Constant* { + if (auto* zero_el = ZeroValue(builder, a->ElemType())) { + return builder.create(type, zero_el, a->Count()); + } + return nullptr; + }, + [&](const sem::Struct* s) -> const Constant* { + std::unordered_map zero_by_type; + utils::Vector zeros; + zeros.Reserve(s->Members().size()); + for (auto* member : s->Members()) { + auto* zero = utils::GetOrCreate(zero_by_type, member->Type(), + [&] { return ZeroValue(builder, member->Type()); }); + if (!zero) { + return nullptr; + } + zeros.Push(zero); + } + if (zero_by_type.size() == 1) { + // All members were of the same type, so the zero value is the same for all members. + return builder.create(type, zeros[0], s->Members().size()); + } + return CreateComposite(builder, s, std::move(zeros)); + }, + [&](Default) -> const Constant* { + return ZeroTypeDispatch(type, [&](auto zero) -> const Constant* { + return CreateElement(builder, type, zero); + }); + }); +} + +/// Equal returns true if the constants `a` and `b` are of the same type and value. +bool Equal(const sem::Constant* a, const sem::Constant* b) { + if (a->Hash() != b->Hash()) { + return false; + } + if (a->Type() != b->Type()) { + return false; + } + return Switch( + a->Type(), // + [&](const sem::Vector* vec) { + for (size_t i = 0; i < vec->Width(); i++) { + if (!Equal(a->Index(i), b->Index(i))) { + return false; + } + } + return true; + }, + [&](const sem::Matrix* mat) { + for (size_t i = 0; i < mat->columns(); i++) { + if (!Equal(a->Index(i), b->Index(i))) { + return false; + } + } + return true; + }, + [&](const sem::Array* arr) { + for (size_t i = 0; i < arr->Count(); i++) { + if (!Equal(a->Index(i), b->Index(i))) { + return false; + } + } + return true; + }, + [&](Default) { return a->Value() == b->Value(); }); +} + +/// CreateComposite is used to construct a constant of a vector, matrix or array type. +/// CreateComposite examines the element values and will return either a Composite or a Splat, +/// depending on the element types and values. +const Constant* CreateComposite(ProgramBuilder& builder, + const sem::Type* type, + utils::VectorRef elements) { + if (elements.IsEmpty()) { + return nullptr; + } + bool any_zero = false; + bool all_zero = true; + bool all_equal = true; + auto* first = elements.Front(); + for (auto* el : elements) { + if (!el) { + return nullptr; + } + if (!any_zero && el->AnyZero()) { + any_zero = true; + } + if (all_zero && !el->AllZero()) { + all_zero = false; + } + if (all_equal && el != first) { + if (!Equal(el, first)) { + all_equal = false; + } + } + } + if (all_equal) { + return builder.create(type, elements[0], elements.Length()); + } else { + return builder.create(type, std::move(elements), all_zero, any_zero); + } +} + +/// TransformElements constructs a new constant by applying the transformation function 'f' on each +/// of the most deeply nested elements of 'cs'. Assumes that all constants are the same type. +template +const Constant* TransformElements(ProgramBuilder& builder, F&& f, CONSTANTS&&... cs) { + uint32_t n = 0; + auto* ty = First(cs...)->Type(); + auto* el_ty = sem::Type::ElementOf(ty, &n); + if (el_ty == ty) { + return f(cs...); + } + utils::Vector els; + els.Reserve(n); + for (uint32_t i = 0; i < n; i++) { + els.Push(TransformElements(builder, std::forward(f), cs->Index(i)...)); + } + return CreateComposite(builder, ty, std::move(els)); +} + +/// TransformBinaryElements constructs a new constant by applying the transformation function 'f' on +/// each of the most deeply nested elements of both `c0` and `c1`. Unlike TransformElements, this +/// function handles the constants being of different types, e.g. vector-scalar, scalar-vector. +template +const Constant* TransformBinaryElements(ProgramBuilder& builder, + F&& f, + const sem::Constant* c0, + const sem::Constant* c1) { + uint32_t n0 = 0, n1 = 0; + sem::Type::ElementOf(c0->Type(), &n0); + sem::Type::ElementOf(c1->Type(), &n1); + uint32_t max_n = std::max(n0, n1); + // If arity of both constants is 1, invoke callback + if (max_n == 1u) { + return f(c0, c1); + } + + utils::Vector els; + els.Reserve(max_n); + for (uint32_t i = 0; i < max_n; i++) { + auto nested_or_self = [&](auto& c, uint32_t num_elems) { + if (num_elems == 1) { + return c; + } + return c->Index(i); + }; + els.Push(TransformBinaryElements(builder, std::forward(f), nested_or_self(c0, n0), + nested_or_self(c1, n1))); + } + // Use larger type + auto* ty = n0 > n1 ? c0->Type() : c1->Type(); + return CreateComposite(builder, ty, std::move(els)); +} + +} // namespace + +ConstEval::ConstEval(ProgramBuilder& b) : builder(b) {} + +ConstEval::ConstantResult ConstEval::Literal(const sem::Type* ty, + const ast::LiteralExpression* literal) { + return Switch( + literal, + [&](const ast::BoolLiteralExpression* lit) { + return CreateElement(builder, ty, lit->value); + }, + [&](const ast::IntLiteralExpression* lit) -> const Constant* { + switch (lit->suffix) { + case ast::IntLiteralExpression::Suffix::kNone: + return CreateElement(builder, ty, AInt(lit->value)); + case ast::IntLiteralExpression::Suffix::kI: + return CreateElement(builder, ty, i32(lit->value)); + case ast::IntLiteralExpression::Suffix::kU: + return CreateElement(builder, ty, u32(lit->value)); + } + return nullptr; + }, + [&](const ast::FloatLiteralExpression* lit) -> const Constant* { + switch (lit->suffix) { + case ast::FloatLiteralExpression::Suffix::kNone: + return CreateElement(builder, ty, AFloat(lit->value)); + case ast::FloatLiteralExpression::Suffix::kF: + return CreateElement(builder, ty, f32(lit->value)); + case ast::FloatLiteralExpression::Suffix::kH: + return CreateElement(builder, ty, f16(lit->value)); + } + return nullptr; + }); +} + +ConstEval::ConstantResult ConstEval::ArrayOrStructCtor( + const sem::Type* ty, + utils::VectorRef args) { + if (args.IsEmpty()) { + return ZeroValue(builder, ty); + } + + if (args.Length() == 1 && args[0]->Type() == ty) { + // Identity constructor. + return args[0]->ConstantValue(); + } + + // Multiple arguments. Must be a type constructor. + utils::Vector els; + els.Reserve(args.Length()); + for (auto* arg : args) { + els.Push(arg->ConstantValue()); + } + return CreateComposite(builder, ty, std::move(els)); +} + +ConstEval::ConstantResult ConstEval::Conv(const sem::Type* ty, + utils::VectorRef args, + const Source& source) { + uint32_t el_count = 0; + auto* el_ty = sem::Type::ElementOf(ty, &el_count); + if (!el_ty) { + return nullptr; + } + + if (!args[0]) { + return nullptr; // Single argument is not constant. + } + + if (auto conv = Convert(ty, args[0], source)) { + return conv.Get(); + } + + return nullptr; +} + +ConstEval::ConstantResult ConstEval::Zero(const sem::Type* ty, + utils::VectorRef, + const Source&) { + return ZeroValue(builder, ty); +} + +ConstEval::ConstantResult ConstEval::Identity(const sem::Type*, + utils::VectorRef args, + const Source&) { + return args[0]; +} + +ConstEval::ConstantResult ConstEval::VecSplat(const sem::Type* ty, + utils::VectorRef args, + const Source&) { + if (auto* arg = args[0]) { + return builder.create(ty, arg, static_cast(ty)->Width()); + } + return nullptr; +} + +ConstEval::ConstantResult ConstEval::VecCtorS(const sem::Type* ty, + utils::VectorRef args, + const Source&) { + return CreateComposite(builder, ty, args); +} + +ConstEval::ConstantResult ConstEval::VecCtorM(const sem::Type* ty, + utils::VectorRef args, + const Source&) { + utils::Vector els; + for (auto* arg : args) { + auto* val = arg; + if (!val) { + return nullptr; + } + auto* arg_ty = arg->Type(); + if (auto* arg_vec = arg_ty->As()) { + // Extract out vector elements. + for (uint32_t j = 0; j < arg_vec->Width(); j++) { + auto* el = val->Index(j); + if (!el) { + return nullptr; + } + els.Push(el); + } + } else { + els.Push(val); + } + } + return CreateComposite(builder, ty, std::move(els)); +} + +ConstEval::ConstantResult ConstEval::MatCtorS(const sem::Type* ty, + utils::VectorRef args, + const Source&) { + auto* m = static_cast(ty); + + utils::Vector els; + for (uint32_t c = 0; c < m->columns(); c++) { + utils::Vector column; + for (uint32_t r = 0; r < m->rows(); r++) { + auto i = r + c * m->rows(); + column.Push(args[i]); + } + els.Push(CreateComposite(builder, m->ColumnType(), std::move(column))); + } + return CreateComposite(builder, ty, std::move(els)); +} + +ConstEval::ConstantResult ConstEval::MatCtorV(const sem::Type* ty, + utils::VectorRef args, + const Source&) { + return CreateComposite(builder, ty, args); +} + +ConstEval::ConstantResult ConstEval::Index(const sem::Expression* obj_expr, + const sem::Expression* idx_expr) { + auto obj_val = obj_expr->ConstantValue(); + if (!obj_val) { + return nullptr; + } + + auto idx_val = idx_expr->ConstantValue(); + if (!idx_val) { + return nullptr; + } + + uint32_t el_count = 0; + sem::Type::ElementOf(obj_val->Type(), &el_count); + + AInt idx = idx_val->As(); + if (idx < 0 || idx >= el_count) { + auto clamped = std::min(std::max(idx, 0), el_count - 1); + AddWarning("index " + std::to_string(idx) + " out of bounds [0.." + + std::to_string(el_count - 1) + "]. Clamping index to " + + std::to_string(clamped), + idx_expr->Declaration()->source); + idx = clamped; + } + + return obj_val->Index(static_cast(idx)); +} + +ConstEval::ConstantResult ConstEval::MemberAccess(const sem::Expression* obj_expr, + const sem::StructMember* member) { + auto obj_val = obj_expr->ConstantValue(); + if (!obj_val) { + return nullptr; + } + return obj_val->Index(static_cast(member->Index())); +} + +ConstEval::ConstantResult ConstEval::Swizzle(const sem::Type* ty, + const sem::Expression* vec_expr, + utils::VectorRef indices) { + auto* vec_val = vec_expr->ConstantValue(); + if (!vec_val) { + return nullptr; + } + if (indices.Length() == 1) { + return vec_val->Index(static_cast(indices[0])); + } else { + auto values = utils::Transform<4>( + indices, [&](uint32_t i) { return vec_val->Index(static_cast(i)); }); + return CreateComposite(builder, ty, std::move(values)); + } +} + +ConstEval::ConstantResult ConstEval::Bitcast(const sem::Type*, const sem::Expression*) { + // TODO(crbug.com/tint/1581): Implement @const intrinsics + return nullptr; +} + +ConstEval::ConstantResult ConstEval::OpComplement(const sem::Type*, + utils::VectorRef args, + const Source&) { + auto transform = [&](const sem::Constant* c) { + auto create = [&](auto i) { + return CreateElement(builder, c->Type(), decltype(i)(~i.value)); + }; + return Dispatch_ia_iu32(create, c); + }; + return TransformElements(builder, transform, args[0]); +} + +ConstEval::ConstantResult ConstEval::OpUnaryMinus(const sem::Type*, + utils::VectorRef args, + const Source&) { + auto transform = [&](const sem::Constant* c) { + auto create = [&](auto i) { + // For signed integrals, avoid C++ UB by not negating the + // smallest negative number. In WGSL, this operation is well + // defined to return the same value, see: + // https://gpuweb.github.io/gpuweb/wgsl/#arithmetic-expr. + using T = UnwrapNumber; + if constexpr (std::is_integral_v) { + auto v = i.value; + if (v != std::numeric_limits::min()) { + v = -v; + } + return CreateElement(builder, c->Type(), decltype(i)(v)); + } else { + return CreateElement(builder, c->Type(), decltype(i)(-i.value)); + } + }; + return Dispatch_fia_fi32_f16(create, c); + }; + return TransformElements(builder, transform, args[0]); +} + +ConstEval::ConstantResult ConstEval::OpPlus(const sem::Type* ty, + utils::VectorRef args, + const Source& source) { + auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) { + auto create = [&](auto i, auto j) -> const Constant* { + using NumberT = decltype(i); + using T = UnwrapNumber; + + auto add_values = [](T lhs, T rhs) { + if constexpr (std::is_integral_v && std::is_signed_v) { + // Ensure no UB for signed overflow + using UT = std::make_unsigned_t; + return static_cast(static_cast(lhs) + static_cast(rhs)); + } else { + return lhs + rhs; + } + }; + + NumberT result; + if constexpr (std::is_same_v || std::is_same_v) { + // Check for over/underflow for abstract values + if (auto r = CheckedAdd(i, j)) { + result = r->value; + } else { + AddError("'" + std::to_string(add_values(i.value, j.value)) + + "' cannot be represented as '" + + ty->FriendlyName(builder.Symbols()) + "'", + source); + return nullptr; + } + } else { + result = add_values(i.value, j.value); + } + return CreateElement(builder, c0->Type(), result); + }; + return Dispatch_fia_fiu32_f16(create, c0, c1); + }; + + auto r = TransformBinaryElements(builder, transform, args[0], args[1]); + if (builder.Diagnostics().contains_errors()) { + return utils::Failure; + } + return r; +} + +ConstEval::ConstantResult ConstEval::OpMinus(const sem::Type* ty, + utils::VectorRef args, + const Source& source) { + auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) { + auto create = [&](auto i, auto j) -> const Constant* { + using NumberT = decltype(i); + using T = UnwrapNumber; + + auto subtract_values = [](T lhs, T rhs) { + if constexpr (std::is_integral_v && std::is_signed_v) { + // Ensure no UB for signed underflow + using UT = std::make_unsigned_t; + return static_cast(static_cast(lhs) - static_cast(rhs)); + } else { + return lhs - rhs; + } + }; + + NumberT result; + if constexpr (std::is_same_v || std::is_same_v) { + // Check for over/underflow for abstract values + if (auto r = CheckedSub(i, j)) { + result = r->value; + } else { + AddError("'" + std::to_string(subtract_values(i.value, j.value)) + + "' cannot be represented as '" + + ty->FriendlyName(builder.Symbols()) + "'", + source); + return nullptr; + } + } else { + result = subtract_values(i.value, j.value); + } + return CreateElement(builder, c0->Type(), result); + }; + return Dispatch_fia_fiu32_f16(create, c0, c1); + }; + + auto r = TransformBinaryElements(builder, transform, args[0], args[1]); + if (builder.Diagnostics().contains_errors()) { + return utils::Failure; + } + return r; +} + +ConstEval::ConstantResult ConstEval::atan2(const sem::Type*, + utils::VectorRef args, + const Source&) { + auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) { + auto create = [&](auto i, auto j) { + return CreateElement(builder, c0->Type(), decltype(i)(std::atan2(i.value, j.value))); + }; + return Dispatch_fa_f32_f16(create, c0, c1); + }; + return TransformElements(builder, transform, args[0], args[1]); +} + +ConstEval::ConstantResult ConstEval::clamp(const sem::Type*, + utils::VectorRef args, + const Source&) { + auto transform = [&](const sem::Constant* c0, const sem::Constant* c1, + const sem::Constant* c2) { + auto create = [&](auto e, auto low, auto high) { + return CreateElement(builder, c0->Type(), + decltype(e)(std::min(std::max(e, low), high))); + }; + return Dispatch_fia_fiu32_f16(create, c0, c1, c2); + }; + return TransformElements(builder, transform, args[0], args[1], args[2]); +} + +utils::Result ConstEval::Convert(const sem::Type* target_ty, + const sem::Constant* value, + const Source& source) { + if (value->Type() == target_ty) { + return value; + } + auto conv = static_cast(value)->Convert(builder, target_ty, source); + if (!conv) { + return utils::Failure; + } + return conv.Get(); +} + +void ConstEval::AddError(const std::string& msg, const Source& source) const { + builder.Diagnostics().add_error(diag::System::Resolver, msg, source); +} + +void ConstEval::AddWarning(const std::string& msg, const Source& source) const { + builder.Diagnostics().add_warning(diag::System::Resolver, msg, source); +} + +} // namespace tint::resolver diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h new file mode 100644 index 0000000000..9cd38d7054 --- /dev/null +++ b/src/tint/resolver/const_eval.h @@ -0,0 +1,267 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_RESOLVER_CONST_EVAL_H_ +#define SRC_TINT_RESOLVER_CONST_EVAL_H_ + +#include +#include + +#include "src/tint/utils/result.h" +#include "src/tint/utils/vector.h" + +// Forward declarations +namespace tint { +class ProgramBuilder; +class Source; +} // namespace tint +namespace tint::ast { +class LiteralExpression; +} // namespace tint::ast +namespace tint::sem { +class Constant; +class Expression; +class StructMember; +class Type; +} // namespace tint::sem + +namespace tint::resolver { + +/// ConstEval performs shader creation-time (constant expression) expression evaluation. +/// Methods are called from the resolver, either directly or via member-function pointers indexed by +/// the IntrinsicTable. All child-expression nodes are guaranteed to have been already resolved +/// before calling a method to evaluate an expression's value. +class ConstEval { + public: + /// The result type of a method that may raise a diagnostic error and the caller should abort + /// resolving. Can be one of three distinct values: + /// * A non-null sem::Constant pointer. Returned when a expression resolves to a creation time + /// value. + /// * A null sem::Constant pointer. Returned when a expression cannot resolve to a creation time + /// value, but is otherwise legal. + /// * `utils::Failure`. Returned when there was a resolver error. In this situation the method + /// will have already reported a diagnostic error message, and the caller should abort + /// resolving. + using ConstantResult = utils::Result; + + /// Typedef for a constant evaluation function + using Function = ConstantResult (ConstEval::*)(const sem::Type* result_ty, + utils::VectorRef, + const Source&); + + /// Constructor + /// @param b the program builder + explicit ConstEval(ProgramBuilder& b); + + //////////////////////////////////////////////////////////////////////////////////////////////// + // Constant value evaluation methods, to be called directly from Resolver + //////////////////////////////////////////////////////////////////////////////////////////////// + + /// @param ty the target type - must be an array or constructor + /// @param args the input arguments + /// @return the constructed value, or null if the value cannot be calculated + ConstantResult ArrayOrStructCtor(const sem::Type* ty, + utils::VectorRef args); + + /// @param ty the target type + /// @param expr the input expression + /// @return the bit-cast of the given expression to the given type, or null if the value cannot + /// be calculated + ConstantResult Bitcast(const sem::Type* ty, const sem::Expression* expr); + + /// @param obj the object being indexed + /// @param idx the index expression + /// @return the result of the index, or null if the value cannot be calculated + ConstantResult Index(const sem::Expression* obj, const sem::Expression* idx); + + /// @param ty the result type + /// @param lit the literal AST node + /// @return the constant value of the literal + ConstantResult Literal(const sem::Type* ty, const ast::LiteralExpression* lit); + + /// @param obj the object being accessed + /// @param member the member + /// @return the result of the member access, or null if the value cannot be calculated + ConstantResult MemberAccess(const sem::Expression* obj, const sem::StructMember* member); + + /// @param ty the result type + /// @param vector the vector being swizzled + /// @param indices the swizzle indices + /// @return the result of the swizzle, or null if the value cannot be calculated + ConstantResult Swizzle(const sem::Type* ty, + const sem::Expression* vector, + utils::VectorRef indices); + + /// Convert the `value` to `target_type` + /// @param ty the result type + /// @param value the value being converted + /// @param source the source location of the conversion + /// @return the converted value, or null if the value cannot be calculated + ConstantResult Convert(const sem::Type* ty, const sem::Constant* value, const Source& source); + + //////////////////////////////////////////////////////////////////////////////////////////////// + // Constant value evaluation methods, to be indirectly called via the intrinsic table + //////////////////////////////////////////////////////////////////////////////////////////////// + + /// Type conversion + /// @param ty the result type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the converted value, or null if the value cannot be calculated + ConstantResult Conv(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// Zero value type constructor + /// @param ty the result type + /// @param args the input arguments (no arguments provided) + /// @param source the source location of the conversion + /// @return the constructed value, or null if the value cannot be calculated + ConstantResult Zero(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// Identity value type constructor + /// @param ty the result type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the constructed value, or null if the value cannot be calculated + ConstantResult Identity(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// Vector splat constructor + /// @param ty the vector type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the constructed value, or null if the value cannot be calculated + ConstantResult VecSplat(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// Vector constructor using scalars + /// @param ty the vector type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the constructed value, or null if the value cannot be calculated + ConstantResult VecCtorS(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// Vector constructor using a mix of scalars and smaller vectors + /// @param ty the vector type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the constructed value, or null if the value cannot be calculated + ConstantResult VecCtorM(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// Matrix constructor using scalar values + /// @param ty the matrix type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the constructed value, or null if the value cannot be calculated + ConstantResult MatCtorS(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// Matrix constructor using column vectors + /// @param ty the matrix type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the constructed value, or null if the value cannot be calculated + ConstantResult MatCtorV(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + //////////////////////////////////////////////////////////////////////////// + // Unary Operators + //////////////////////////////////////////////////////////////////////////// + + /// Complement operator '~' + /// @param ty the integer type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the result value, or null if the value cannot be calculated + ConstantResult OpComplement(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// Unary minus operator '-' + /// @param ty the expression type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the result value, or null if the value cannot be calculated + ConstantResult OpUnaryMinus(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + //////////////////////////////////////////////////////////////////////////// + // Binary Operators + //////////////////////////////////////////////////////////////////////////// + + /// Plus operator '+' + /// @param ty the expression type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the result value, or null if the value cannot be calculated + ConstantResult OpPlus(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// Minus operator '-' + /// @param ty the expression type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the result value, or null if the value cannot be calculated + ConstantResult OpMinus(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + //////////////////////////////////////////////////////////////////////////// + // Builtins + //////////////////////////////////////////////////////////////////////////// + + /// atan2 builtin + /// @param ty the expression type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the result value, or null if the value cannot be calculated + ConstantResult atan2(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// clamp builtin + /// @param ty the expression type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the result value, or null if the value cannot be calculated + ConstantResult clamp(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + private: + /// Adds the given error message to the diagnostics + void AddError(const std::string& msg, const Source& source) const; + + /// Adds the given warning message to the diagnostics + void AddWarning(const std::string& msg, const Source& source) const; + + ProgramBuilder& builder; +}; + +} // namespace tint::resolver + +#endif // SRC_TINT_RESOLVER_CONST_EVAL_H_ diff --git a/src/tint/resolver/const_eval_test.cc b/src/tint/resolver/const_eval_test.cc new file mode 100644 index 0000000000..d515ac41de --- /dev/null +++ b/src/tint/resolver/const_eval_test.cc @@ -0,0 +1,3507 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include "gtest/gtest.h" +#include "src/tint/resolver/resolver_test_helper.h" +#include "src/tint/sem/builtin_type.h" +#include "src/tint/sem/expression.h" +#include "src/tint/sem/index_accessor_expression.h" +#include "src/tint/sem/member_accessor_expression.h" +#include "src/tint/sem/test_helper.h" +#include "src/tint/utils/transform.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::resolver { +namespace { + +template +const auto kPi = T(UnwrapNumber(3.14159265358979323846)); + +template +const auto kPiOver2 = T(UnwrapNumber(1.57079632679489661923)); + +template +const auto kPiOver4 = T(UnwrapNumber(0.785398163397448309616)); + +template +const auto k3PiOver4 = T(UnwrapNumber(2.356194490192344928846)); + +template +constexpr auto Negate(const Number& v) { + if constexpr (std::is_integral_v) { + if constexpr (std::is_signed_v) { + // For signed integrals, avoid C++ UB by not negating the smallest negative number. In + // WGSL, this operation is well defined to return the same value, see: + // https://gpuweb.github.io/gpuweb/wgsl/#arithmetic-expr. + if (v == std::numeric_limits::min()) { + return v; + } + return -v; + + } else { + // Allow negating unsigned values + using ST = std::make_signed_t; + auto as_signed = Number{static_cast(v)}; + return Number{static_cast(Negate(as_signed))}; + } + } else { + // float case + return -v; + } +} + +template +auto Abs(const Number& v) { + if constexpr (std::is_integral_v && std::is_unsigned_v) { + return v; + } else { + return Number(std::abs(v)); + } +} + +// Concats any number of std::vectors +template +[[nodiscard]] auto Concat(Vec&& v1, Vecs&&... vs) { + auto total_size = v1.size() + (vs.size() + ...); + v1.reserve(total_size); + (std::move(vs.begin(), vs.end(), std::back_inserter(v1)), ...); + return std::move(v1); +} + +using ResolverConstEvalTest = ResolverTest; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Construction +//////////////////////////////////////////////////////////////////////////////////////////////////// + +TEST_F(ResolverConstEvalTest, Scalar_i32) { + auto* expr = Expr(99_i); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + EXPECT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->As(), 99); +} + +TEST_F(ResolverConstEvalTest, Scalar_u32) { + auto* expr = Expr(99_u); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + EXPECT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->As(), 99u); +} + +TEST_F(ResolverConstEvalTest, Scalar_f32) { + auto* expr = Expr(9.9_f); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + EXPECT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->As().value, 9.9f); +} + +TEST_F(ResolverConstEvalTest, Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* expr = Expr(9.9_h); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + EXPECT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + // 9.9 is not exactly representable by f16, and should be quantized to 9.8984375 + EXPECT_EQ(sem->ConstantValue()->As(), 9.8984375f); +} + +TEST_F(ResolverConstEvalTest, Scalar_bool) { + auto* expr = Expr(true); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + EXPECT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->As(), true); +} + +TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_i32) { + auto* expr = vec3(); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0); +} + +TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_u32) { + auto* expr = vec3(); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0u); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0u); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0u); +} + +TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f32) { + auto* expr = vec3(); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0._a); +} + +TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f16) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0._a); +} + +TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_bool) { + auto* expr = vec3(); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), false); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), false); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), false); +} + +TEST_F(ResolverConstEvalTest, Vec3_Splat_i32) { + auto* expr = vec3(99_i); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 99); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 99); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 99); +} + +TEST_F(ResolverConstEvalTest, Vec3_Splat_u32) { + auto* expr = vec3(99_u); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 99u); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 99u); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 99u); +} + +TEST_F(ResolverConstEvalTest, Vec3_Splat_f32) { + auto* expr = vec3(9.9_f); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 9.9f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 9.9f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 9.9f); +} + +TEST_F(ResolverConstEvalTest, Vec3_Splat_f16) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(9.9_h); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + // 9.9 is not exactly representable by f16, and should be quantized to 9.8984375 + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 9.8984375f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 9.8984375f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 9.8984375f); +} + +TEST_F(ResolverConstEvalTest, Vec3_Splat_bool) { + auto* expr = vec3(true); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), true); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), true); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), true); +} + +TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_i32) { + auto* expr = vec3(1_i, 2_i, 3_i); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); +} + +TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_u32) { + auto* expr = vec3(1_u, 2_u, 3_u); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); +} + +TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f32) { + auto* expr = vec3(1_f, 2_f, 3_f); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3.f); +} + +TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f16) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(1_h, 2_h, 3_h); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3.f); +} + +TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_bool) { + auto* expr = vec3(true, false, true); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), true); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), false); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), true); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_i32) { + auto* expr = vec3(1_i, vec2(2_i, 3_i)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_u32) { + auto* expr = vec3(vec2(1_u, 2_u), 3_u); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32) { + auto* expr = vec3(1_f, vec2(2_f, 3_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3.f); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_all_10) { + auto* expr = vec3(10_f, vec2(10_f, 10_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 10_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 10_f); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_all_positive_0) { + auto* expr = vec3(0_f, vec2(0_f, 0_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_f); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_all_negative_0) { + auto* expr = vec3(vec2(-0_f, -0_f), -0_f); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), -0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), -0_f); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_mixed_sign_0) { + auto* expr = vec3(0_f, vec2(-0_f, 0_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_f); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(1_h, vec2(2_h, 3_h)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3.f); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_10) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(10_h, vec2(10_h, 10_h)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10_h); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 10_h); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 10_h); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_positive_0) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(0_h, vec2(0_h, 0_h)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_h); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_h); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_h); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_negative_0) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(vec2(-0_h, -0_h), -0_h); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), -0_h); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0_h); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), -0_h); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_mixed_sign_0) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(0_h, vec2(-0_h, 0_h)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_h); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0_h); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_h); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_bool) { + auto* expr = vec3(vec2(true, false), true); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), true); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), false); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), true); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_all_true) { + auto* expr = vec3(true, vec2(true, true)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), true); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), true); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), true); +} + +TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_all_false) { + auto* expr = vec3(false, vec2(false, false)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), false); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), false); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), false); +} + +TEST_F(ResolverConstEvalTest, Vec3_Convert_f32_to_i32) { + auto* expr = vec3(vec3(1.1_f, 2.2_f, 3.3_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3); +} + +TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f32) { + auto* expr = vec3(vec3(10_u, 20_u, 30_u)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 20.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 30.f); +} + +TEST_F(ResolverConstEvalTest, Vec3_Convert_f16_to_i32) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(vec3(1.1_h, 2.2_h, 3.3_h)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3_i); +} + +TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f16) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(vec3(10_u, 20_u, 30_u)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 20.f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 30.f); +} + +TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_i32) { + auto* expr = vec3(vec3(1e10_f, -1e20_f, 1e30_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), i32::Highest()); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), i32::Lowest()); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), i32::Highest()); +} + +TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_u32) { + auto* expr = vec3(vec3(1e10_f, -1e20_f, 1e30_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), u32::Highest()); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), u32::Lowest()); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), u32::Highest()); +} + +TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_f16) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(vec3(1e10_f, -1e20_f, 1e30_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + constexpr auto kInfinity = std::numeric_limits::infinity(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), kInfinity); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -kInfinity); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), kInfinity); +} + +TEST_F(ResolverConstEvalTest, Vec3_Convert_Small_f32_to_f16) { + Enable(ast::Extension::kF16); + + auto* expr = vec3(vec3(1e-20_f, -2e-30_f, 3e-40_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0.0); + EXPECT_FALSE(std::signbit(sem->ConstantValue()->Index(0)->As().value)); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), -0.0); + EXPECT_TRUE(std::signbit(sem->ConstantValue()->Index(1)->As().value)); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0.0); + EXPECT_FALSE(std::signbit(sem->ConstantValue()->Index(2)->As().value)); +} + +TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f32) { + auto* expr = mat2x3(); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* mat = sem->Type()->As(); + ASSERT_NE(mat, nullptr); + EXPECT_TRUE(mat->type()->Is()); + EXPECT_EQ(mat->columns(), 2u); + EXPECT_EQ(mat->rows(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0._f); +} + +TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f16) { + Enable(ast::Extension::kF16); + + auto* expr = mat2x3(); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + EXPECT_NE(sem, nullptr); + auto* mat = sem->Type()->As(); + ASSERT_NE(mat, nullptr); + EXPECT_TRUE(mat->type()->Is()); + EXPECT_EQ(mat->columns(), 2u); + EXPECT_EQ(mat->rows(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0._h); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0._h); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0._h); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0._h); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0._h); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0._h); +} + +TEST_F(ResolverConstEvalTest, Mat3x2_Construct_Scalars_af) { + auto* expr = Construct(ty.mat(nullptr, 3, 2), 1.0_a, 2.0_a, 3.0_a, 4.0_a, 5.0_a, 6.0_a); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* mat = sem->Type()->As(); + ASSERT_NE(mat, nullptr); + EXPECT_TRUE(mat->type()->Is()); + EXPECT_EQ(mat->columns(), 3u); + EXPECT_EQ(mat->rows(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 3._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 4._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 5._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 6._a); +} + +TEST_F(ResolverConstEvalTest, Mat3x2_Construct_Columns_af) { + auto* expr = Construct(ty.mat(nullptr, 3, 2), // + vec(nullptr, 2u, 1.0_a, 2.0_a), // + vec(nullptr, 2u, 3.0_a, 4.0_a), // + vec(nullptr, 2u, 5.0_a, 6.0_a)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* mat = sem->Type()->As(); + ASSERT_NE(mat, nullptr); + EXPECT_TRUE(mat->type()->Is()); + EXPECT_EQ(mat->columns(), 3u); + EXPECT_EQ(mat->rows(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 3._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 4._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 5._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 6._a); +} + +TEST_F(ResolverConstEvalTest, Array_i32_Zero) { + auto* expr = Construct(ty.array()); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* arr = sem->Type()->As(); + ASSERT_NE(arr, nullptr); + EXPECT_TRUE(arr->ElemType()->Is()); + EXPECT_EQ(arr->Count(), 4u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 0_i); +} + +TEST_F(ResolverConstEvalTest, Array_f32_Zero) { + auto* expr = Construct(ty.array()); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* arr = sem->Type()->As(); + ASSERT_NE(arr, nullptr); + EXPECT_TRUE(arr->ElemType()->Is()); + EXPECT_EQ(arr->Count(), 4u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 0_f); +} + +TEST_F(ResolverConstEvalTest, Array_vec3_f32_Zero) { + auto* expr = Construct(ty.array(ty.vec3(), 2_u)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* arr = sem->Type()->As(); + ASSERT_NE(arr, nullptr); + EXPECT_TRUE(arr->ElemType()->Is()); + EXPECT_EQ(arr->Count(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0_f); +} + +TEST_F(ResolverConstEvalTest, Array_Struct_f32_Zero) { + Structure("S", utils::Vector{ + Member("m1", ty.f32()), + Member("m2", ty.f32()), + }); + auto* expr = Construct(ty.array(ty.type_name("S"), 2_u)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* arr = sem->Type()->As(); + ASSERT_NE(arr, nullptr); + EXPECT_TRUE(arr->ElemType()->Is()); + EXPECT_EQ(arr->Count(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_f); +} + +TEST_F(ResolverConstEvalTest, Array_i32_Elements) { + auto* expr = Construct(ty.array(), 10_i, 20_i, 30_i, 40_i); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* arr = sem->Type()->As(); + ASSERT_NE(arr, nullptr); + EXPECT_TRUE(arr->ElemType()->Is()); + EXPECT_EQ(arr->Count(), 4u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 20_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 30_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(3)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 40_i); +} + +TEST_F(ResolverConstEvalTest, Array_f32_Elements) { + auto* expr = Construct(ty.array(), 10_f, 20_f, 30_f, 40_f); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* arr = sem->Type()->As(); + ASSERT_NE(arr, nullptr); + EXPECT_TRUE(arr->ElemType()->Is()); + EXPECT_EQ(arr->Count(), 4u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 10_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 20_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 30_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(3)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 40_f); +} + +TEST_F(ResolverConstEvalTest, Array_vec3_f32_Elements) { + auto* expr = Construct(ty.array(ty.vec3(), 2_u), // + vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* arr = sem->Type()->As(); + ASSERT_NE(arr, nullptr); + EXPECT_TRUE(arr->ElemType()->Is()); + EXPECT_EQ(arr->Count(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2_f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 3_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 4_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 5_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 6_f); +} + +TEST_F(ResolverConstEvalTest, Array_Struct_f32_Elements) { + Structure("S", utils::Vector{ + Member("m1", ty.f32()), + Member("m2", ty.f32()), + }); + auto* expr = Construct(ty.array(ty.type_name("S"), 2_u), // + Construct(ty.type_name("S"), 1_f, 2_f), // + Construct(ty.type_name("S"), 3_f, 4_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* arr = sem->Type()->As(); + ASSERT_NE(arr, nullptr); + EXPECT_TRUE(arr->ElemType()->Is()); + EXPECT_EQ(arr->Count(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 3_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 4_f); +} + +TEST_F(ResolverConstEvalTest, Struct_I32s_ZeroInit) { + Structure( + "S", utils::Vector{Member("m1", ty.i32()), Member("m2", ty.i32()), Member("m3", ty.i32())}); + auto* expr = Construct(ty.type_name("S")); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* str = sem->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 3u); + ASSERT_NE(sem->ConstantValue(), nullptr); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0_i); +} + +TEST_F(ResolverConstEvalTest, Struct_MixedScalars_ZeroInit) { + Enable(ast::Extension::kF16); + + Structure("S", utils::Vector{ + Member("m1", ty.i32()), + Member("m2", ty.u32()), + Member("m3", ty.f32()), + Member("m4", ty.f16()), + Member("m5", ty.bool_()), + }); + auto* expr = Construct(ty.type_name("S")); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* str = sem->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 5u); + ASSERT_NE(sem->ConstantValue(), nullptr); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 0_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 0_u); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 0._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 0._h); + + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(4)->As(), false); +} + +TEST_F(ResolverConstEvalTest, Struct_VectorF32s_ZeroInit) { + Structure("S", utils::Vector{ + Member("m1", ty.vec3()), + Member("m2", ty.vec3()), + Member("m3", ty.vec3()), + }); + auto* expr = Construct(ty.type_name("S")); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* str = sem->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 3u); + ASSERT_NE(sem->ConstantValue(), nullptr); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->As(), 0._f); +} + +TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) { + Enable(ast::Extension::kF16); + + Structure("S", utils::Vector{ + Member("m1", ty.vec2()), + Member("m2", ty.vec3()), + Member("m3", ty.vec4()), + Member("m4", ty.vec3()), + Member("m5", ty.vec2()), + }); + auto* expr = Construct(ty.type_name("S")); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* str = sem->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 5u); + ASSERT_NE(sem->ConstantValue(), nullptr); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0_u); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->As(), 0._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(3)->As(), 0._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(0)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(1)->As(), 0._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(2)->As(), 0._h); + + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(0)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(1)->As(), false); +} + +TEST_F(ResolverConstEvalTest, Struct_Struct_ZeroInit) { + Structure("Inner", utils::Vector{ + Member("m1", ty.i32()), + Member("m2", ty.u32()), + Member("m3", ty.f32()), + }); + + Structure("Outer", utils::Vector{ + Member("m1", ty.type_name("Inner")), + Member("m2", ty.type_name("Inner")), + }); + auto* expr = Construct(ty.type_name("Outer")); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* str = sem->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 2u); + ASSERT_NE(sem->ConstantValue(), nullptr); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->AllZero()); + + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 0_f); + + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 0_i); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 0_f); +} + +TEST_F(ResolverConstEvalTest, Struct_MixedScalars_Construct) { + Enable(ast::Extension::kF16); + + Structure("S", utils::Vector{ + Member("m1", ty.i32()), + Member("m2", ty.u32()), + Member("m3", ty.f32()), + Member("m4", ty.f16()), + Member("m5", ty.bool_()), + }); + auto* expr = Construct(ty.type_name("S"), 1_i, 2_u, 3_f, 4_h, false); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* str = sem->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 5u); + ASSERT_NE(sem->ConstantValue(), nullptr); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2_u); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(3)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(3)->As(), 4._h); + + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(4)->As(), false); +} + +TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) { + Enable(ast::Extension::kF16); + + Structure("S", utils::Vector{ + Member("m1", ty.vec2()), + Member("m2", ty.vec3()), + Member("m3", ty.vec4()), + Member("m4", ty.vec3()), + Member("m5", ty.vec2()), + }); + auto* expr = Construct(ty.type_name("S"), vec2(1_i), vec3(2_u), vec4(3_f), + vec3(4_h), vec2(false)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* str = sem->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 5u); + ASSERT_NE(sem->ConstantValue(), nullptr); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 1_i); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 2_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 2_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 2_u); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->As(), 3._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->As(), 3._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->As(), 3._f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(3)->As(), 3._f); + + EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(3)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(0)->As(), 4._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(1)->As(), 4._h); + EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(2)->As(), 4._h); + + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is()); + EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->As()->type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(0)->As(), false); + EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(1)->As(), false); +} + +TEST_F(ResolverConstEvalTest, Struct_Struct_Construct) { + Structure("Inner", utils::Vector{ + Member("m1", ty.i32()), + Member("m2", ty.u32()), + Member("m3", ty.f32()), + }); + + Structure("Outer", utils::Vector{ + Member("m1", ty.type_name("Inner")), + Member("m2", ty.type_name("Inner")), + }); + auto* expr = Construct(ty.type_name("Outer"), // + Construct(ty.type_name("Inner"), 1_i, 2_u, 3_f), + Construct(ty.type_name("Inner"), 4_i, 0_u, 6_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* str = sem->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 2u); + ASSERT_NE(sem->ConstantValue(), nullptr); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2_u); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->As(), 3_f); + + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 4_i); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 0_u); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 6_f); +} + +TEST_F(ResolverConstEvalTest, Struct_Array_Construct) { + Structure("S", utils::Vector{ + Member("m1", ty.array()), + Member("m2", ty.array()), + }); + auto* expr = Construct(ty.type_name("S"), // + Construct(ty.array(), 1_i, 2_i), + Construct(ty.array(), 1_f, 2_f, 3_f)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* str = sem->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 2u); + ASSERT_NE(sem->ConstantValue(), nullptr); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->As(), 1_i); + EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->As(), 2_i); + + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->As(), 1_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->As(), 2_f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->As(), 3_f); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Indexing +//////////////////////////////////////////////////////////////////////////////////////////////////// + +TEST_F(ResolverConstEvalTest, Vec3_Index) { + auto* expr = IndexAccessor(vec3(1_i, 2_i, 3_i), 2_i); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + ASSERT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->As(), 3_i); +} + +TEST_F(ResolverConstEvalTest, Vec3_Index_OOB_High) { + auto* expr = IndexAccessor(vec3(1_i, 2_i, 3_i), Expr(Source{{12, 34}}, 3_i)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(r()->error(), "12:34 warning: index 3 out of bounds [0..2]. Clamping index to 2"); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + ASSERT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->As(), 3_i); +} + +TEST_F(ResolverConstEvalTest, Vec3_Index_OOB_Low) { + auto* expr = IndexAccessor(vec3(1_i, 2_i, 3_i), Expr(Source{{12, 34}}, -3_i)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(r()->error(), "12:34 warning: index -3 out of bounds [0..2]. Clamping index to 0"); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + ASSERT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->As(), 1_i); +} + +TEST_F(ResolverConstEvalTest, Vec3_Swizzle_Scalar) { + auto* expr = MemberAccessor(vec3(1_i, 2_i, 3_i), "y"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + ASSERT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->As(), 2_i); +} + +TEST_F(ResolverConstEvalTest, Vec3_Swizzle_Vector) { + auto* expr = MemberAccessor(vec3(1_i, 2_i, 3_i), "zx"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_EQ(vec->Width(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 3._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 1._a); +} + +TEST_F(ResolverConstEvalTest, Vec3_Swizzle_Chain) { + auto* expr = // (1, 2, 3) -> (2, 3, 1) -> (3, 2) -> 2 + MemberAccessor(MemberAccessor(MemberAccessor(vec3(1_i, 2_i, 3_i), "gbr"), "yx"), "y"); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + ASSERT_TRUE(sem->Type()->Is()); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_TRUE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + EXPECT_EQ(sem->ConstantValue()->As(), 2_i); +} + +TEST_F(ResolverConstEvalTest, Mat3x2_Index) { + auto* expr = IndexAccessor( + mat3x2(vec2(1._a, 2._a), vec2(3._a, 4._a), vec2(5._a, 6._a)), 2_i); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_EQ(vec->Width(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 5._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 6._a); +} + +TEST_F(ResolverConstEvalTest, Mat3x2_Index_OOB_High) { + auto* expr = IndexAccessor( + mat3x2(vec2(1._a, 2._a), vec2(3._a, 4._a), vec2(5._a, 6._a)), + Expr(Source{{12, 34}}, 3_i)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(r()->error(), "12:34 warning: index 3 out of bounds [0..2]. Clamping index to 2"); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_EQ(vec->Width(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 5._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 6._a); +} + +TEST_F(ResolverConstEvalTest, Mat3x2_Index_OOB_Low) { + auto* expr = IndexAccessor( + mat3x2(vec2(1._a, 2._a), vec2(3._a, 4._a), vec2(5._a, 6._a)), + Expr(Source{{12, 34}}, -3_i)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(r()->error(), "12:34 warning: index -3 out of bounds [0..2]. Clamping index to 0"); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_EQ(vec->Width(), 2u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1._a); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2._a); +} + +TEST_F(ResolverConstEvalTest, Array_vec3_f32_Index) { + auto* expr = IndexAccessor(Construct(ty.array(ty.vec3(), 2_u), // + vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f)), + 1_i); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 4_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 5_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 6_f); +} + +TEST_F(ResolverConstEvalTest, Array_vec3_f32_Index_OOB_High) { + auto* expr = IndexAccessor(Construct(ty.array(ty.vec3(), 2_u), // + vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f)), + Expr(Source{{12, 34}}, 2_i)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(r()->error(), "12:34 warning: index 2 out of bounds [0..1]. Clamping index to 1"); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 4_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 5_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 6_f); +} + +TEST_F(ResolverConstEvalTest, Array_vec3_f32_Index_OOB_Low) { + auto* expr = IndexAccessor(Construct(ty.array(ty.vec3(), 2_u), // + vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f)), + Expr(Source{{12, 34}}, -2_i)); + WrapInFunction(expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(r()->error(), "12:34 warning: index -2 out of bounds [0..1]. Clamping index to 0"); + + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + auto* vec = sem->Type()->As(); + ASSERT_NE(vec, nullptr); + EXPECT_TRUE(vec->type()->Is()); + EXPECT_EQ(vec->Width(), 3u); + EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type()); + EXPECT_FALSE(sem->ConstantValue()->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->AllZero()); + + EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 1_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 2_f); + + EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3_f); +} + +TEST_F(ResolverConstEvalTest, ChainedIndex) { + auto* arr_expr = Construct(ty.array(ty.mat2x3(), 2_u), // array, 2u> + mat2x3(vec3(1_f, 2_f, 3_f), // + vec3(4_f, 5_f, 6_f)), // + mat2x3(vec3(7_f, 0_f, 9_f), // + vec3(10_f, 11_f, 12_f))); + + auto* mat_expr = IndexAccessor(arr_expr, 1_i); // arr[1] + auto* vec_expr = IndexAccessor(mat_expr, 0_i); // arr[1][0] + auto* f32_expr = IndexAccessor(vec_expr, 2_i); // arr[1][0][2] + WrapInFunction(f32_expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + { + auto* mat = Sem().Get(mat_expr); + EXPECT_NE(mat, nullptr); + auto* ty = mat->Type()->As(); + ASSERT_NE(mat->Type(), nullptr); + EXPECT_TRUE(ty->ColumnType()->Is()); + EXPECT_EQ(ty->columns(), 2u); + EXPECT_EQ(ty->rows(), 3u); + EXPECT_EQ(mat->ConstantValue()->Type(), mat->Type()); + EXPECT_FALSE(mat->ConstantValue()->AllEqual()); + EXPECT_TRUE(mat->ConstantValue()->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->AllZero()); + + EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(0)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(0)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(0)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(0)->As(), 7_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(1)->AllEqual()); + EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(1)->AnyZero()); + EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(1)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(1)->As(), 0_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(2)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(2)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(2)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(2)->As(), 9_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(1)->Index(0)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(0)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(0)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(0)->As(), 10_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(1)->Index(1)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(1)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(1)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(1)->As(), 11_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(1)->Index(2)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(2)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(2)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(2)->As(), 12_f); + } + { + auto* vec = Sem().Get(vec_expr); + EXPECT_NE(vec, nullptr); + auto* ty = vec->Type()->As(); + ASSERT_NE(vec->Type(), nullptr); + EXPECT_TRUE(ty->type()->Is()); + EXPECT_EQ(ty->Width(), 3u); + EXPECT_EQ(vec->ConstantValue()->Type(), vec->Type()); + EXPECT_FALSE(vec->ConstantValue()->AllEqual()); + EXPECT_TRUE(vec->ConstantValue()->AnyZero()); + EXPECT_FALSE(vec->ConstantValue()->AllZero()); + + EXPECT_TRUE(vec->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(vec->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(vec->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(vec->ConstantValue()->Index(0)->As(), 7_f); + + EXPECT_TRUE(vec->ConstantValue()->Index(1)->AllEqual()); + EXPECT_TRUE(vec->ConstantValue()->Index(1)->AnyZero()); + EXPECT_TRUE(vec->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(vec->ConstantValue()->Index(1)->As(), 0_f); + + EXPECT_TRUE(vec->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(vec->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(vec->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(vec->ConstantValue()->Index(2)->As(), 9_f); + } + { + auto* f = Sem().Get(f32_expr); + EXPECT_NE(f, nullptr); + EXPECT_TRUE(f->Type()->Is()); + EXPECT_EQ(f->ConstantValue()->Type(), f->Type()); + EXPECT_TRUE(f->ConstantValue()->AllEqual()); + EXPECT_FALSE(f->ConstantValue()->AnyZero()); + EXPECT_FALSE(f->ConstantValue()->AllZero()); + EXPECT_EQ(f->ConstantValue()->As(), 9_f); + } +} + +TEST_F(ResolverConstEvalTest, ChainedIndex_OOB) { + auto* arr_expr = Construct(ty.array(ty.mat2x3(), 2_u), // array, 2u> + mat2x3(vec3(1_f, 2_f, 3_f), // + vec3(4_f, 5_f, 6_f)), // + mat2x3(vec3(7_f, 8_f, 9_f), // + vec3(10_f, 11_f, 12_f))); + + auto* mat_expr = IndexAccessor(arr_expr, Expr(Source{{1, 2}}, -3_i)); // arr[3] + auto* vec_expr = IndexAccessor(mat_expr, Expr(Source{{3, 4}}, -2_i)); // arr[3][-2] + auto* f32_expr = IndexAccessor(vec_expr, Expr(Source{{5, 6}}, 4_i)); // arr[3][-2][4] + WrapInFunction(f32_expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(r()->error(), R"(1:2 warning: index -3 out of bounds [0..1]. Clamping index to 0 +3:4 warning: index -2 out of bounds [0..1]. Clamping index to 0 +5:6 warning: index 4 out of bounds [0..2]. Clamping index to 2)"); + + { + auto* mat = Sem().Get(mat_expr); + EXPECT_NE(mat, nullptr); + auto* ty = mat->Type()->As(); + ASSERT_NE(mat->Type(), nullptr); + EXPECT_TRUE(ty->ColumnType()->Is()); + EXPECT_EQ(ty->columns(), 2u); + EXPECT_EQ(ty->rows(), 3u); + EXPECT_EQ(mat->ConstantValue()->Type(), mat->Type()); + EXPECT_FALSE(mat->ConstantValue()->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->AllZero()); + + EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(0)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(0)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(0)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(0)->As(), 1_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(1)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(1)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(1)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(1)->As(), 2_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(0)->Index(2)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(2)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(0)->Index(2)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(0)->Index(2)->As(), 3_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(1)->Index(0)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(0)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(0)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(0)->As(), 4_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(1)->Index(1)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(1)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(1)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(1)->As(), 5_f); + + EXPECT_TRUE(mat->ConstantValue()->Index(1)->Index(2)->AllEqual()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(2)->AnyZero()); + EXPECT_FALSE(mat->ConstantValue()->Index(1)->Index(2)->AllZero()); + EXPECT_EQ(mat->ConstantValue()->Index(1)->Index(2)->As(), 6_f); + } + { + auto* vec = Sem().Get(vec_expr); + EXPECT_NE(vec, nullptr); + auto* ty = vec->Type()->As(); + ASSERT_NE(vec->Type(), nullptr); + EXPECT_TRUE(ty->type()->Is()); + EXPECT_EQ(ty->Width(), 3u); + EXPECT_EQ(vec->ConstantValue()->Type(), vec->Type()); + EXPECT_FALSE(vec->ConstantValue()->AllEqual()); + EXPECT_FALSE(vec->ConstantValue()->AnyZero()); + EXPECT_FALSE(vec->ConstantValue()->AllZero()); + + EXPECT_TRUE(vec->ConstantValue()->Index(0)->AllEqual()); + EXPECT_FALSE(vec->ConstantValue()->Index(0)->AnyZero()); + EXPECT_FALSE(vec->ConstantValue()->Index(0)->AllZero()); + EXPECT_EQ(vec->ConstantValue()->Index(0)->As(), 1_f); + + EXPECT_TRUE(vec->ConstantValue()->Index(1)->AllEqual()); + EXPECT_FALSE(vec->ConstantValue()->Index(1)->AnyZero()); + EXPECT_FALSE(vec->ConstantValue()->Index(1)->AllZero()); + EXPECT_EQ(vec->ConstantValue()->Index(1)->As(), 2_f); + + EXPECT_TRUE(vec->ConstantValue()->Index(2)->AllEqual()); + EXPECT_FALSE(vec->ConstantValue()->Index(2)->AnyZero()); + EXPECT_FALSE(vec->ConstantValue()->Index(2)->AllZero()); + EXPECT_EQ(vec->ConstantValue()->Index(2)->As(), 3_f); + } + { + auto* f = Sem().Get(f32_expr); + EXPECT_NE(f, nullptr); + EXPECT_TRUE(f->Type()->Is()); + EXPECT_EQ(f->ConstantValue()->Type(), f->Type()); + EXPECT_TRUE(f->ConstantValue()->AllEqual()); + EXPECT_FALSE(f->ConstantValue()->AnyZero()); + EXPECT_FALSE(f->ConstantValue()->AllZero()); + EXPECT_EQ(f->ConstantValue()->As(), 3_f); + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Member accessing +//////////////////////////////////////////////////////////////////////////////////////////////////// + +TEST_F(ResolverConstEvalTest, MemberAccess) { + Structure("Inner", utils::Vector{ + Member("i1", ty.i32()), + Member("i2", ty.u32()), + Member("i3", ty.f32()), + }); + + Structure("Outer", utils::Vector{ + Member("o1", ty.type_name("Inner")), + Member("o2", ty.type_name("Inner")), + }); + auto* outer_expr = Construct(ty.type_name("Outer"), // + Construct(ty.type_name("Inner"), 1_i, 2_u, 3_f), + Construct(ty.type_name("Inner"))); + auto* o1_expr = MemberAccessor(outer_expr, "o1"); + auto* i2_expr = MemberAccessor(o1_expr, "i2"); + WrapInFunction(i2_expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* outer = Sem().Get(outer_expr); + ASSERT_NE(outer, nullptr); + auto* str = outer->Type()->As(); + ASSERT_NE(str, nullptr); + EXPECT_EQ(str->Members().size(), 2u); + ASSERT_NE(outer->ConstantValue(), nullptr); + EXPECT_TYPE(outer->ConstantValue()->Type(), outer->Type()); + EXPECT_FALSE(outer->ConstantValue()->AllEqual()); + EXPECT_TRUE(outer->ConstantValue()->AnyZero()); + EXPECT_FALSE(outer->ConstantValue()->AllZero()); + + auto* o1 = Sem().Get(o1_expr); + ASSERT_NE(o1->ConstantValue(), nullptr); + EXPECT_FALSE(o1->ConstantValue()->AllEqual()); + EXPECT_FALSE(o1->ConstantValue()->AnyZero()); + EXPECT_FALSE(o1->ConstantValue()->AllZero()); + EXPECT_TRUE(o1->ConstantValue()->Type()->Is()); + EXPECT_EQ(o1->ConstantValue()->Index(0)->As(), 1_i); + EXPECT_EQ(o1->ConstantValue()->Index(1)->As(), 2_u); + EXPECT_EQ(o1->ConstantValue()->Index(2)->As(), 3_f); + + auto* i2 = Sem().Get(i2_expr); + ASSERT_NE(i2->ConstantValue(), nullptr); + EXPECT_TRUE(i2->ConstantValue()->AllEqual()); + EXPECT_FALSE(i2->ConstantValue()->AnyZero()); + EXPECT_FALSE(i2->ConstantValue()->AllZero()); + EXPECT_TRUE(i2->ConstantValue()->Type()->Is()); + EXPECT_EQ(i2->ConstantValue()->As(), 2_u); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Unary op +//////////////////////////////////////////////////////////////////////////////////////////////////// +namespace unary_op { + +template +struct Values { + T input; + T expect; +}; + +struct Case { + std::variant, Values, Values, Values, Values, Values> + values; +}; + +static std::ostream& operator<<(std::ostream& o, const Case& c) { + std::visit([&](auto&& v) { o << v.input; }, c.values); + return o; +} + +template +Case C(T input, T expect) { + return Case{Values{input, expect}}; +} + +using ResolverConstEvalUnaryOpTest = ResolverTestWithParam>; + +TEST_P(ResolverConstEvalUnaryOpTest, Test) { + Enable(ast::Extension::kF16); + + auto op = std::get<0>(GetParam()); + auto c = std::get<1>(GetParam()); + std::visit( + [&](auto&& values) { + using T = decltype(values.expect); + auto* expr = create(op, Expr(values.input)); + GlobalConst("C", expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + const sem::Constant* value = sem->ConstantValue(); + ASSERT_NE(value, nullptr); + EXPECT_TYPE(value->Type(), sem->Type()); + EXPECT_EQ(value->As(), values.expect); + + if constexpr (IsInteger>) { + // Check that the constant's integer doesn't contain unexpected data in the MSBs + // that are outside of the bit-width of T. + EXPECT_EQ(value->As(), AInt(values.expect)); + } + }, + c.values); +} +INSTANTIATE_TEST_SUITE_P(Complement, + ResolverConstEvalUnaryOpTest, + testing::Combine(testing::Values(ast::UnaryOp::kComplement), + testing::ValuesIn({ + // AInt + C(0_a, 0xffffffffffffffff_a), + C(0xffffffffffffffff_a, 0_a), + C(0xf0f0f0f0f0f0f0f0_a, 0x0f0f0f0f0f0f0f0f_a), + C(0xaaaaaaaaaaaaaaaa_a, 0x5555555555555555_a), + C(0x5555555555555555_a, 0xaaaaaaaaaaaaaaaa_a), + // u32 + C(0_u, 0xffffffff_u), + C(0xffffffff_u, 0_u), + C(0xf0f0f0f0_u, 0x0f0f0f0f_u), + C(0xaaaaaaaa_u, 0x55555555_u), + C(0x55555555_u, 0xaaaaaaaa_u), + // i32 + C(0_i, -1_i), + C(-1_i, 0_i), + C(1_i, -2_i), + C(-2_i, 1_i), + C(2_i, -3_i), + C(-3_i, 2_i), + }))); + +INSTANTIATE_TEST_SUITE_P(Negation, + ResolverConstEvalUnaryOpTest, + testing::Combine(testing::Values(ast::UnaryOp::kNegation), + testing::ValuesIn({ + // AInt + C(0_a, -0_a), + C(-0_a, 0_a), + C(1_a, -1_a), + C(-1_a, 1_a), + C(AInt::Highest(), -AInt::Highest()), + C(-AInt::Highest(), AInt::Highest()), + C(AInt::Lowest(), Negate(AInt::Lowest())), + C(Negate(AInt::Lowest()), AInt::Lowest()), + // i32 + C(0_i, -0_i), + C(-0_i, 0_i), + C(1_i, -1_i), + C(-1_i, 1_i), + C(i32::Highest(), -i32::Highest()), + C(-i32::Highest(), i32::Highest()), + C(i32::Lowest(), Negate(i32::Lowest())), + C(Negate(i32::Lowest()), i32::Lowest()), + // AFloat + C(0.0_a, -0.0_a), + C(-0.0_a, 0.0_a), + C(1.0_a, -1.0_a), + C(-1.0_a, 1.0_a), + C(AFloat::Highest(), -AFloat::Highest()), + C(-AFloat::Highest(), AFloat::Highest()), + C(AFloat::Lowest(), Negate(AFloat::Lowest())), + C(Negate(AFloat::Lowest()), AFloat::Lowest()), + // f32 + C(0.0_f, -0.0_f), + C(-0.0_f, 0.0_f), + C(1.0_f, -1.0_f), + C(-1.0_f, 1.0_f), + C(f32::Highest(), -f32::Highest()), + C(-f32::Highest(), f32::Highest()), + C(f32::Lowest(), Negate(f32::Lowest())), + C(Negate(f32::Lowest()), f32::Lowest()), + // f16 + C(0.0_h, -0.0_h), + C(-0.0_h, 0.0_h), + C(1.0_h, -1.0_h), + C(-1.0_h, 1.0_h), + C(f16::Highest(), -f16::Highest()), + C(-f16::Highest(), f16::Highest()), + C(f16::Lowest(), Negate(f16::Lowest())), + C(Negate(f16::Lowest()), f16::Lowest()), + }))); + +// Make sure UBSan doesn't trip on C++'s undefined behaviour of negating the smallest negative +// number. +TEST_F(ResolverConstEvalTest, UnaryNegateLowestAbstract) { + // const break_me = -(-9223372036854775808); + auto* c = GlobalConst("break_me", Negation(Negation(Expr(9223372036854775808_a)))); + (void)c; + EXPECT_TRUE(r()->Resolve()) << r()->error(); + auto* sem = Sem().Get(c); + EXPECT_EQ(sem->ConstantValue()->As(), 9223372036854775808_a); +} + +} // namespace unary_op + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Binary op +//////////////////////////////////////////////////////////////////////////////////////////////////// +namespace binary_op { + +using Types = std::variant; + +struct Case { + Types lhs; + Types rhs; + Types expected; + bool is_overflow; +}; + +static std::ostream& operator<<(std::ostream& o, const Case& c) { + std::visit( + [&](auto&& lhs, auto&& rhs, auto&& expected) { + o << "lhs: " << lhs << ", rhs: " << rhs << ", expected: " << expected; + }, + c.lhs, c.rhs, c.expected); + return o; +} + +template +Case C(T lhs, U rhs, V expected, bool is_overflow = false) { + return Case{lhs, rhs, expected, is_overflow}; +} + +using ResolverConstEvalBinaryOpTest = ResolverTestWithParam>; +TEST_P(ResolverConstEvalBinaryOpTest, Test) { + Enable(ast::Extension::kF16); + + auto op = std::get<0>(GetParam()); + auto c = std::get<1>(GetParam()); + std::visit( + [&](auto&& lhs, auto&& rhs, auto&& expected) { + using T = std::decay_t; + + if constexpr (std::is_same_v || std::is_same_v) { + if (c.is_overflow) { + return; + } + } + + auto* expr = create(op, Expr(lhs), Expr(rhs)); + GlobalConst("C", expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + const sem::Constant* value = sem->ConstantValue(); + ASSERT_NE(value, nullptr); + EXPECT_TYPE(value->Type(), sem->Type()); + EXPECT_EQ(value->As(), expected); + + if constexpr (IsInteger>) { + // Check that the constant's integer doesn't contain unexpected data in the MSBs + // that are outside of the bit-width of T. + EXPECT_EQ(value->As(), AInt(expected)); + } + }, + c.lhs, c.rhs, c.expected); +} + +INSTANTIATE_TEST_SUITE_P(MixedAbstractArgs, + ResolverConstEvalBinaryOpTest, + testing::Combine(testing::Values(ast::BinaryOp::kAdd), + testing::ValuesIn(std::vector{ + // Mixed abstract type args + C(1_a, 2.3_a, 3.3_a), + C(2.3_a, 1_a, 3.3_a), + }))); + +template +std::vector OpAddIntCases() { + static_assert(IsInteger>); + return { + C(T{0}, T{0}, T{0}), + C(T{1}, T{2}, T{3}), + C(T::Lowest(), T{1}, T{T::Lowest() + 1}), + C(T::Highest(), Negate(T{1}), T{T::Highest() - 1}), + C(T::Lowest(), T::Highest(), Negate(T{1})), + C(T::Highest(), T{1}, T::Lowest(), true), + C(T::Lowest(), Negate(T{1}), T::Highest(), true), + }; +} +template +std::vector OpAddFloatCases() { + static_assert(IsFloatingPoint>); + return { + C(T{0}, T{0}, T{0}), + C(T{1}, T{2}, T{3}), + C(T::Lowest(), T{1}, T{T::Lowest() + 1}), + C(T::Highest(), Negate(T{1}), T{T::Highest() - 1}), + C(T::Lowest(), T::Highest(), T{0}), + C(T::Highest(), T::Highest(), T::Inf(), true), + C(T::Lowest(), Negate(T::Highest()), -T::Inf(), true), + }; +} +INSTANTIATE_TEST_SUITE_P(Add, + ResolverConstEvalBinaryOpTest, + testing::Combine(testing::Values(ast::BinaryOp::kAdd), + testing::ValuesIn(Concat( // + OpAddIntCases(), + OpAddIntCases(), + OpAddIntCases(), + OpAddFloatCases(), + OpAddFloatCases(), + OpAddFloatCases())))); + +template +std::vector OpSubIntCases() { + static_assert(IsInteger>); + return { + C(T{0}, T{0}, T{0}), + C(T{3}, T{2}, T{1}), + C(T{T::Lowest() + 1}, T{1}, T::Lowest()), + C(T{T::Highest() - 1}, Negate(T{1}), T::Highest()), + C(Negate(T{1}), T::Highest(), T::Lowest()), + C(T::Lowest(), T{1}, T::Highest(), true), + C(T::Highest(), Negate(T{1}), T::Lowest(), true), + }; +} +template +std::vector OpSubFloatCases() { + static_assert(IsFloatingPoint>); + return { + C(T{0}, T{0}, T{0}), + C(T{3}, T{2}, T{1}), + C(T::Highest(), T{1}, T{T::Highest() - 1}), + C(T::Lowest(), Negate(T{1}), T{T::Lowest() + 1}), + C(T{0}, T::Highest(), T::Lowest()), + C(T::Highest(), Negate(T::Highest()), T::Inf(), true), + C(T::Lowest(), T::Highest(), -T::Inf(), true), + }; +} +INSTANTIATE_TEST_SUITE_P(Sub, + ResolverConstEvalBinaryOpTest, + testing::Combine(testing::Values(ast::BinaryOp::kSubtract), + testing::ValuesIn(Concat( // + OpSubIntCases(), + OpSubIntCases(), + OpSubIntCases(), + OpSubFloatCases(), + OpSubFloatCases(), + OpSubFloatCases())))); + +TEST_F(ResolverConstEvalTest, BinaryAbstractAddOverflow_AInt) { + GlobalConst("c", Add(Source{{1, 1}}, Expr(AInt::Highest()), 1_a)); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "1:1 error: '-9223372036854775808' cannot be represented as 'abstract-int'"); +} + +TEST_F(ResolverConstEvalTest, BinaryAbstractAddUnderflow_AInt) { + GlobalConst("c", Add(Source{{1, 1}}, Expr(AInt::Lowest()), -1_a)); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "1:1 error: '9223372036854775807' cannot be represented as 'abstract-int'"); +} + +TEST_F(ResolverConstEvalTest, BinaryAbstractAddOverflow_AFloat) { + GlobalConst("c", Add(Source{{1, 1}}, Expr(AFloat::Highest()), AFloat::Highest())); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "1:1 error: 'inf' cannot be represented as 'abstract-float'"); +} + +TEST_F(ResolverConstEvalTest, BinaryAbstractAddUnderflow_AFloat) { + GlobalConst("c", Add(Source{{1, 1}}, Expr(AFloat::Lowest()), AFloat::Lowest())); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "1:1 error: '-inf' cannot be represented as 'abstract-float'"); +} + +TEST_F(ResolverConstEvalTest, BinaryAbstractMixed_ScalarScalar) { + auto* a = Const("a", Expr(1_a)); // AInt + auto* b = Const("b", Expr(2.3_a)); // AFloat + auto* c = Add(Expr("a"), Expr("b")); + WrapInFunction(a, b, c); + EXPECT_TRUE(r()->Resolve()) << r()->error(); + auto* sem = Sem().Get(c); + ASSERT_TRUE(sem); + ASSERT_TRUE(sem->ConstantValue()); + auto result = sem->ConstantValue()->As(); + EXPECT_EQ(result, 3.3f); +} + +TEST_F(ResolverConstEvalTest, BinaryAbstractMixed_ScalarVector) { + auto* a = Const("a", Expr(1_a)); // AInt + auto* b = Const("b", Construct(ty.vec(nullptr, 3), Expr(2.3_a))); // AFloat + auto* c = Add(Expr("a"), Expr("b")); + WrapInFunction(a, b, c); + EXPECT_TRUE(r()->Resolve()) << r()->error(); + auto* sem = Sem().Get(c); + ASSERT_TRUE(sem); + ASSERT_TRUE(sem->ConstantValue()); + EXPECT_EQ(sem->ConstantValue()->Index(0)->As(), 3.3f); + EXPECT_EQ(sem->ConstantValue()->Index(1)->As(), 3.3f); + EXPECT_EQ(sem->ConstantValue()->Index(2)->As(), 3.3f); +} + +} // namespace binary_op + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Builtin +//////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace builtin { + +using Types = std::variant; + +struct Case { + utils::Vector args; + Types result; + bool result_pos_or_neg; +}; + +static std::ostream& operator<<(std::ostream& o, const Case& c) { + for (auto& a : c.args) { + std::visit([&](auto&& v) { o << v << ((&a != &c.args.Back()) ? " " : ""); }, a); + } + return o; +} + +template +Case C(std::initializer_list args, T result, bool result_pos_or_neg = false) { + return Case{std::move(args), std::move(result), result_pos_or_neg}; +} + +using ResolverConstEvalBuiltinTest = ResolverTestWithParam>; + +TEST_P(ResolverConstEvalBuiltinTest, Test) { + Enable(ast::Extension::kF16); + + auto builtin = std::get<0>(GetParam()); + auto c = std::get<1>(GetParam()); + + utils::Vector args; + for (auto& a : c.args) { + std::visit([&](auto&& v) { args.Push(Expr(v)); }, a); + } + + std::visit( + [&](auto&& result) { + using T = std::decay_t; + auto* expr = Call(sem::str(builtin), std::move(args)); + + GlobalConst("C", expr); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(expr); + const sem::Constant* value = sem->ConstantValue(); + ASSERT_NE(value, nullptr); + EXPECT_TYPE(value->Type(), sem->Type()); + + auto actual = value->As(); + + if constexpr (IsFloatingPoint>) { + if (std::isnan(result)) { + EXPECT_TRUE(std::isnan(actual)); + } else { + EXPECT_FLOAT_EQ(c.result_pos_or_neg ? Abs(actual) : actual, result); + } + } else { + EXPECT_EQ(c.result_pos_or_neg ? Abs(actual) : actual, result); + } + + if constexpr (IsInteger>) { + // Check that the constant's integer doesn't contain unexpected data in the MSBs + // that are outside of the bit-width of T. + EXPECT_EQ(value->As(), AInt(result)); + } + }, + c.result); +} + +template +std::vector Atan2Cases() { + std::vector cases = { + // If y is +/-0 and x is negative or -0, +/-PI is returned + C({T(0.0), -T(0.0)}, kPi, true), + + // If y is +/-0 and x is positive or +0, +/-0 is returned + C({T(0.0), T(0.0)}, T(0.0), true), + + // If x is +/-0 and y is negative, -PI/2 is returned + C({-T(1.0), T(0.0)}, -kPiOver2), + C({-T(1.0), -T(0.0)}, -kPiOver2), + + // If x is +/-0 and y is positive, +PI/2 is returned + C({T(1.0), T(0.0)}, kPiOver2), + C({T(1.0), -T(0.0)}, kPiOver2), + }; + + if constexpr (!finite_only) { + std::vector non_finite_cases = { + // If y is +/-INF and x is finite, +/-PI/2 is returned + C({T::Inf(), T(0.0)}, kPiOver2, true), + C({-T::Inf(), T(0.0)}, kPiOver2, true), + + // If y is +/-INF and x is -INF, +/-3PI/4 is returned + C({T::Inf(), -T::Inf()}, k3PiOver4, true), + C({-T::Inf(), -T::Inf()}, k3PiOver4, true), + + // If y is +/-INF and x is +INF, +/-PI/4 is returned + C({T::Inf(), T::Inf()}, kPiOver4, true), + C({-T::Inf(), T::Inf()}, kPiOver4, true), + + // If x is -INF and y is finite and positive, +PI is returned + C({T(0.0), -T::Inf()}, kPi), + + // If x is -INF and y is finite and negative, -PI is returned + C({-T(0.0), -T::Inf()}, -kPi), + + // If x is +INF and y is finite and positive, +0 is returned + C({T(0.0), T::Inf()}, T(0.0)), + + // If x is +INF and y is finite and negative, -0 is returned + C({-T(0.0), T::Inf()}, -T(0.0)), + + // If either x is NaN or y is NaN, NaN is returned + C({T::NaN(), T(0.0)}, T::NaN()), + C({T(0.0), T::NaN()}, T::NaN()), + C({T::NaN(), T::NaN()}, T::NaN()), + }; + + cases = Concat(cases, non_finite_cases); + } + + return cases; +} + +INSTANTIATE_TEST_SUITE_P( // + MixedAbstractArgs, + ResolverConstEvalBuiltinTest, + testing::Combine(testing::Values(sem::BuiltinType::kAtan2), + testing::ValuesIn(std::vector{ + C({1_a, 1.0_a}, 0.78539819_a), + C({1.0_a, 1_a}, 0.78539819_a), + }))); + +INSTANTIATE_TEST_SUITE_P( // + Atan2, + ResolverConstEvalBuiltinTest, + testing::Combine(testing::Values(sem::BuiltinType::kAtan2), + testing::ValuesIn(Concat(Atan2Cases(), // + Atan2Cases(), + Atan2Cases())))); + +template +std::vector ClampCases() { + return { + C({T(0), T(0), T(0)}, T(0)), + C({T(0), T(42), T::Highest()}, T(42)), + C({T::Lowest(), T(0), T(42)}, T(0)), + C({T(0), T::Lowest(), T::Highest()}, T(0)), + C({T(0), T::Highest(), T::Lowest()}, T::Lowest()), + C({T::Highest(), T::Highest(), T::Highest()}, T::Highest()), + C({T::Lowest(), T::Lowest(), T::Lowest()}, T::Lowest()), + C({T::Highest(), T::Lowest(), T::Highest()}, T::Highest()), + C({T::Lowest(), T::Lowest(), T::Highest()}, T::Lowest()), + }; +} + +INSTANTIATE_TEST_SUITE_P( // + Clamp, + ResolverConstEvalBuiltinTest, + testing::Combine(testing::Values(sem::BuiltinType::kClamp), + testing::ValuesIn(Concat(ClampCases(), // + ClampCases(), + ClampCases(), + ClampCases(), + ClampCases(), + ClampCases())))); + +} // namespace builtin + +} // namespace +} // namespace tint::resolver diff --git a/src/tint/resolver/control_block_validation_test.cc b/src/tint/resolver/control_block_validation_test.cc index b4742c9ce5..9b0d2899bd 100644 --- a/src/tint/resolver/control_block_validation_test.cc +++ b/src/tint/resolver/control_block_validation_test.cc @@ -30,7 +30,7 @@ TEST_F(ResolverControlBlockValidationTest, SwitchSelectorExpressionNoneIntegerTy // switch (a) { // default: {} // } - auto* var = Var("a", ty.f32(), Expr(3.14f)); + auto* var = Var("a", ty.f32(), Expr(3.14_f)); auto* block = Block(Decl(var), Switch(Expr(Source{{12, 34}}, "a"), // DefaultCase())); @@ -213,8 +213,8 @@ TEST_F(ResolverControlBlockValidationTest, SwitchConditionTypeMustMatchSelectorT // } auto* var = Var("a", ty.i32(), Expr(2_i)); - auto* block = Block(Decl(var), Switch("a", // - Case(Source{{12, 34}}, {Expr(1_u)}), // + auto* block = Block(Decl(var), Switch("a", // + Case(Source{{12, 34}}, utils::Vector{Expr(1_u)}), // DefaultCase())); WrapInFunction(block); @@ -232,9 +232,9 @@ TEST_F(ResolverControlBlockValidationTest, SwitchConditionTypeMustMatchSelectorT // } auto* var = Var("a", ty.u32(), Expr(2_u)); - auto* block = Block(Decl(var), // - Switch("a", // - Case(Source{{12, 34}}, {Expr(i32(-1))}), // + auto* block = Block(Decl(var), // + Switch("a", // + Case(Source{{12, 34}}, utils::Vector{Expr(-1_i)}), // DefaultCase())); WrapInFunction(block); @@ -256,7 +256,7 @@ TEST_F(ResolverControlBlockValidationTest, NonUniqueCaseSelectorValueUint_Fail) auto* block = Block(Decl(var), // Switch("a", // Case(Expr(0_u)), - Case({ + Case(utils::Vector{ Expr(Source{{12, 34}}, 2_u), Expr(3_u), Expr(Source{{56, 78}}, 2_u), @@ -281,12 +281,12 @@ TEST_F(ResolverControlBlockValidationTest, NonUniqueCaseSelectorValueSint_Fail) auto* block = Block(Decl(var), // Switch("a", // - Case(Expr(Source{{12, 34}}, i32(-10))), - Case({ + Case(Expr(Source{{12, 34}}, -10_i)), + Case(utils::Vector{ Expr(0_i), Expr(1_i), Expr(2_i), - Expr(Source{{56, 78}}, i32(-10)), + Expr(Source{{56, 78}}, -10_i), }), DefaultCase())); WrapInFunction(block); diff --git a/src/tint/resolver/ctor_conv_intrinsic.cc b/src/tint/resolver/ctor_conv_intrinsic.cc new file mode 100644 index 0000000000..3ac3a677f5 --- /dev/null +++ b/src/tint/resolver/ctor_conv_intrinsic.cc @@ -0,0 +1,69 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/resolver/ctor_conv_intrinsic.cc.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#include "src/tint/resolver/ctor_conv_intrinsic.h" + +namespace tint::resolver { + +const char* str(CtorConvIntrinsic i) { + switch (i) { + case CtorConvIntrinsic::kNone: + return ""; + case CtorConvIntrinsic::kI32: + return "i32"; + case CtorConvIntrinsic::kU32: + return "u32"; + case CtorConvIntrinsic::kF32: + return "f32"; + case CtorConvIntrinsic::kF16: + return "f16"; + case CtorConvIntrinsic::kBool: + return "bool"; + case CtorConvIntrinsic::kVec2: + return "vec2"; + case CtorConvIntrinsic::kVec3: + return "vec3"; + case CtorConvIntrinsic::kVec4: + return "vec4"; + case CtorConvIntrinsic::kMat2x2: + return "mat2x2"; + case CtorConvIntrinsic::kMat2x3: + return "mat2x3"; + case CtorConvIntrinsic::kMat2x4: + return "mat2x4"; + case CtorConvIntrinsic::kMat3x2: + return "mat3x2"; + case CtorConvIntrinsic::kMat3x3: + return "mat3x3"; + case CtorConvIntrinsic::kMat3x4: + return "mat3x4"; + case CtorConvIntrinsic::kMat4x2: + return "mat4x2"; + case CtorConvIntrinsic::kMat4x3: + return "mat4x3"; + case CtorConvIntrinsic::kMat4x4: + return "mat4x4"; + } + return ""; +} + +} // namespace tint::resolver diff --git a/src/tint/resolver/ctor_conv_intrinsic.cc.tmpl b/src/tint/resolver/ctor_conv_intrinsic.cc.tmpl new file mode 100644 index 0000000000..00ac21beee --- /dev/null +++ b/src/tint/resolver/ctor_conv_intrinsic.cc.tmpl @@ -0,0 +1,30 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate ctor_conv_intrinsic.cc + +To update the generated file, run: + ./tools/run gen + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +#include "src/tint/resolver/ctor_conv_intrinsic.h" + +namespace tint::resolver { + +const char* str(CtorConvIntrinsic i) { + switch (i) { + case CtorConvIntrinsic::kNone: + return ""; +{{- range Sem.ConstructorsAndConverters }} + case CtorConvIntrinsic::k{{Title .Name}}: + return "{{.Name}}"; +{{- end }} + } + return ""; +} + +} // namespace tint::resolver diff --git a/src/tint/resolver/ctor_conv_intrinsic.h b/src/tint/resolver/ctor_conv_intrinsic.h new file mode 100644 index 0000000000..4ee1c79e99 --- /dev/null +++ b/src/tint/resolver/ctor_conv_intrinsic.h @@ -0,0 +1,99 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// src/tint/resolver/ctor_conv_intrinsic.h.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +#ifndef SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_ +#define SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_ + +#include + +namespace tint::resolver { + +/// CtorConvIntrinsic is an enumerator of types that have a constructor or converter overload +/// declared in the intrinsic table. +enum class CtorConvIntrinsic { + kNone = -1, + kI32, + kU32, + kF32, + kF16, + kBool, + kVec2, + kVec3, + kVec4, + kMat2x2, + kMat2x3, + kMat2x4, + kMat3x2, + kMat3x3, + kMat3x4, + kMat4x2, + kMat4x3, + kMat4x4, +}; + +/// @returns the name of the type. +const char* str(CtorConvIntrinsic i); + +/// @param n the width of the vector +/// @return the CtorConvIntrinsic for a vector of width `n` +inline CtorConvIntrinsic VectorCtorConvIntrinsic(uint32_t n) { + switch (n) { + case 2: + return CtorConvIntrinsic::kVec2; + case 3: + return CtorConvIntrinsic::kVec3; + case 4: + return CtorConvIntrinsic::kVec4; + } + return CtorConvIntrinsic::kNone; +} + +/// @param c the number of columns in the matrix +/// @param r the number of rows in the matrix +/// @return the CtorConvIntrinsic for a matrix with `c` columns and `r` rows +inline CtorConvIntrinsic MatrixCtorConvIntrinsic(uint32_t c, uint32_t r) { + switch ((c - 2) * 3 + (r - 2)) { + case 0: + return CtorConvIntrinsic::kMat2x2; + case 1: + return CtorConvIntrinsic::kMat2x3; + case 2: + return CtorConvIntrinsic::kMat2x4; + case 3: + return CtorConvIntrinsic::kMat3x2; + case 4: + return CtorConvIntrinsic::kMat3x3; + case 5: + return CtorConvIntrinsic::kMat3x4; + case 6: + return CtorConvIntrinsic::kMat4x2; + case 7: + return CtorConvIntrinsic::kMat4x3; + case 8: + return CtorConvIntrinsic::kMat4x4; + } + return CtorConvIntrinsic::kNone; +} + +} // namespace tint::resolver + +#endif // SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_ diff --git a/src/tint/resolver/ctor_conv_intrinsic.h.tmpl b/src/tint/resolver/ctor_conv_intrinsic.h.tmpl new file mode 100644 index 0000000000..349f93907e --- /dev/null +++ b/src/tint/resolver/ctor_conv_intrinsic.h.tmpl @@ -0,0 +1,76 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate ctor_conv_intrinsic.h + +To update the generated file, run: + ./tools/run gen + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +#ifndef SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_ +#define SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_ + +#include + +namespace tint::resolver { + +/// CtorConvIntrinsic is an enumerator of types that have a constructor or converter overload +/// declared in the intrinsic table. +enum class CtorConvIntrinsic { + kNone = -1, +{{- range Sem.ConstructorsAndConverters }} + k{{Title .Name}}, +{{- end }} +}; + +/// @returns the name of the type. +const char* str(CtorConvIntrinsic i); + +/// @param n the width of the vector +/// @return the CtorConvIntrinsic for a vector of width `n` +inline CtorConvIntrinsic VectorCtorConvIntrinsic(uint32_t n) { + switch (n) { + case 2: + return CtorConvIntrinsic::kVec2; + case 3: + return CtorConvIntrinsic::kVec3; + case 4: + return CtorConvIntrinsic::kVec4; + } + return CtorConvIntrinsic::kNone; +} + +/// @param c the number of columns in the matrix +/// @param r the number of rows in the matrix +/// @return the CtorConvIntrinsic for a matrix with `c` columns and `r` rows +inline CtorConvIntrinsic MatrixCtorConvIntrinsic(uint32_t c, uint32_t r) { + switch ((c - 2) * 3 + (r - 2)) { + case 0: + return CtorConvIntrinsic::kMat2x2; + case 1: + return CtorConvIntrinsic::kMat2x3; + case 2: + return CtorConvIntrinsic::kMat2x4; + case 3: + return CtorConvIntrinsic::kMat3x2; + case 4: + return CtorConvIntrinsic::kMat3x3; + case 5: + return CtorConvIntrinsic::kMat3x4; + case 6: + return CtorConvIntrinsic::kMat4x2; + case 7: + return CtorConvIntrinsic::kMat4x3; + case 8: + return CtorConvIntrinsic::kMat4x4; + } + return CtorConvIntrinsic::kNone; +} + +} // namespace tint::resolver + +#endif // SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_ diff --git a/src/tint/resolver/dependency_graph.cc b/src/tint/resolver/dependency_graph.cc index 0a9bdc015b..823dcada11 100644 --- a/src/tint/resolver/dependency_graph.cc +++ b/src/tint/resolver/dependency_graph.cc @@ -19,12 +19,58 @@ #include #include +#include "src/tint/ast/alias.h" +#include "src/tint/ast/array.h" +#include "src/tint/ast/assignment_statement.h" +#include "src/tint/ast/atomic.h" +#include "src/tint/ast/block_statement.h" +#include "src/tint/ast/bool.h" +#include "src/tint/ast/break_statement.h" +#include "src/tint/ast/call_statement.h" +#include "src/tint/ast/compound_assignment_statement.h" #include "src/tint/ast/continue_statement.h" +#include "src/tint/ast/depth_multisampled_texture.h" +#include "src/tint/ast/depth_texture.h" #include "src/tint/ast/discard_statement.h" +#include "src/tint/ast/external_texture.h" +#include "src/tint/ast/f16.h" +#include "src/tint/ast/f32.h" #include "src/tint/ast/fallthrough_statement.h" +#include "src/tint/ast/for_loop_statement.h" +#include "src/tint/ast/i32.h" +#include "src/tint/ast/id_attribute.h" +#include "src/tint/ast/if_statement.h" +#include "src/tint/ast/increment_decrement_statement.h" +#include "src/tint/ast/internal_attribute.h" +#include "src/tint/ast/interpolate_attribute.h" +#include "src/tint/ast/invariant_attribute.h" +#include "src/tint/ast/location_attribute.h" +#include "src/tint/ast/loop_statement.h" +#include "src/tint/ast/matrix.h" +#include "src/tint/ast/multisampled_texture.h" +#include "src/tint/ast/pointer.h" +#include "src/tint/ast/return_statement.h" +#include "src/tint/ast/sampled_texture.h" +#include "src/tint/ast/stage_attribute.h" +#include "src/tint/ast/storage_texture.h" +#include "src/tint/ast/stride_attribute.h" +#include "src/tint/ast/struct.h" +#include "src/tint/ast/struct_member_align_attribute.h" +#include "src/tint/ast/struct_member_offset_attribute.h" +#include "src/tint/ast/struct_member_size_attribute.h" +#include "src/tint/ast/switch_statement.h" #include "src/tint/ast/traverse_expressions.h" +#include "src/tint/ast/type_name.h" +#include "src/tint/ast/u32.h" +#include "src/tint/ast/variable_decl_statement.h" +#include "src/tint/ast/vector.h" +#include "src/tint/ast/void.h" +#include "src/tint/ast/while_statement.h" +#include "src/tint/ast/workgroup_attribute.h" #include "src/tint/scope_stack.h" #include "src/tint/sem/builtin.h" +#include "src/tint/symbol_table.h" +#include "src/tint/utils/block_allocator.h" #include "src/tint/utils/defer.h" #include "src/tint/utils/map.h" #include "src/tint/utils/scoped_assignment.h" @@ -158,6 +204,7 @@ class DependencyScanner { [&](const ast::Enable*) { // Enable directives do not effect the dependency graph. }, + [&](const ast::StaticAssert* assertion) { TraverseExpression(assertion->condition); }, [&](Default) { UnhandledNode(diagnostics_, global->node); }); } @@ -191,7 +238,7 @@ class DependencyScanner { /// Traverses the statements, performing symbol resolution and determining /// global dependencies. - void TraverseStatements(const ast::StatementList& stmts) { + void TraverseStatements(utils::VectorRef stmts) { for (auto* s : stmts) { TraverseStatement(s); } @@ -263,6 +310,13 @@ class DependencyScanner { TraverseExpression(v->variable->constructor); Declare(v->variable->symbol, v->variable); }, + [&](const ast::WhileStatement* w) { + scope_stack_.Push(); + TINT_DEFER(scope_stack_.Pop()); + TraverseExpression(w->condition); + TraverseStatement(w->body); + }, + [&](const ast::StaticAssert* assertion) { TraverseExpression(assertion->condition); }, [&](Default) { if (!stmt->IsAnyOf()) { @@ -342,7 +396,7 @@ class DependencyScanner { TraverseType(tex->type); }, [&](Default) { - if (!ty->IsAnyOfIsAnyOf()) { UnhandledNode(diagnostics_, ty); @@ -352,7 +406,7 @@ class DependencyScanner { /// Traverses the attribute list, performing symbol resolution and /// determining global dependencies. - void TraverseAttributes(const ast::AttributeList& attrs) { + void TraverseAttributes(utils::VectorRef attrs) { for (auto* attr : attrs) { TraverseAttribute(attr); } @@ -420,7 +474,7 @@ class DependencyScanner { DependencyGraph& graph_; DependencyEdges& dependency_edges_; - ScopeStack scope_stack_; + ScopeStack scope_stack_; Global* current_global_ = nullptr; }; @@ -435,6 +489,10 @@ struct DependencyAnalysis { /// #diagnostics. /// @returns true if analysis found no errors, otherwise false. bool Run(const ast::Module& module) { + // Reserve container memory + graph_.resolved_symbols.reserve(module.GlobalDeclarations().Length()); + sorted_.Reserve(module.GlobalDeclarations().Length()); + // Collect all the named globals from the AST module GatherGlobals(module); @@ -447,7 +505,7 @@ struct DependencyAnalysis { // Dump the dependency graph if TINT_DUMP_DEPENDENCY_GRAPH is non-zero DumpDependencyGraph(); - graph_.ordered_globals = std::move(sorted_); + graph_.ordered_globals = sorted_.Release(); return !diagnostics_.contains_errors(); } @@ -463,6 +521,8 @@ struct DependencyAnalysis { [&](const ast::TypeDecl* td) { return td->name; }, [&](const ast::Function* func) { return func->symbol; }, [&](const ast::Variable* var) { return var->symbol; }, + [&](const ast::Enable*) { return Symbol(); }, + [&](const ast::StaticAssert*) { return Symbol(); }, [&](Default) { UnhandledNode(diagnostics_, node); return Symbol{}; @@ -481,11 +541,12 @@ struct DependencyAnalysis { /// declaration std::string KindOf(const ast::Node* node) { return Switch( - node, // - [&](const ast::Struct*) { return "struct"; }, - [&](const ast::Alias*) { return "alias"; }, - [&](const ast::Function*) { return "function"; }, - [&](const ast::Variable* var) { return var->is_const ? "let" : "var"; }, + node, // + [&](const ast::Struct*) { return "struct"; }, // + [&](const ast::Alias*) { return "alias"; }, // + [&](const ast::Function*) { return "function"; }, // + [&](const ast::Variable* v) { return v->Kind(); }, // + [&](const ast::StaticAssert*) { return "static_assert"; }, // [&](Default) { UnhandledNode(diagnostics_, node); return ""; @@ -497,9 +558,8 @@ struct DependencyAnalysis { void GatherGlobals(const ast::Module& module) { for (auto* node : module.GlobalDeclarations()) { auto* global = allocator_.Create(node); - // Enable directives do not form a symbol. Skip them. - if (!node->Is()) { - globals_.emplace(SymbolOf(node), global); + if (auto symbol = SymbolOf(node); symbol.IsValid()) { + globals_.emplace(symbol, global); } declaration_order_.emplace_back(global); } @@ -569,33 +629,43 @@ struct DependencyAnalysis { return; // This code assumes there are no undeclared identifiers. } - std::unordered_set visited; + // Make sure all 'enable' directives go before any other global declarations. for (auto* global : declaration_order_) { - utils::UniqueVector stack; + if (auto* enable = global->node->As()) { + sorted_.Add(enable); + } + } + + for (auto* global : declaration_order_) { + if (global->node->Is()) { + // Skip 'enable' directives here, as they are already added. + continue; + } + utils::UniqueVector stack; TraverseDependencies( global, [&](const Global* g) { // Enter - if (!stack.add(g)) { - CyclicDependencyFound(g, stack); + if (!stack.Add(g)) { + CyclicDependencyFound(g, stack.Release()); return false; } - if (sorted_.contains(g->node)) { + if (sorted_.Contains(g->node)) { // Visited this global already. // stack was pushed, but exit() will not be called when we return // false, so pop here. - stack.pop_back(); + stack.Pop(); return false; } return true; }, [&](const Global* g) { // Exit. Only called if Enter returned true. - sorted_.add(g->node); - stack.pop_back(); + sorted_.Add(g->node); + stack.Pop(); }); - sorted_.add(global->node); + sorted_.Add(global->node); - if (!stack.empty()) { + if (!stack.IsEmpty()) { // Each stack.push() must have a corresponding stack.pop_back(). TINT_ICE(Resolver, diagnostics_) << "stack not empty after returning from TraverseDependencies()"; @@ -621,12 +691,12 @@ struct DependencyAnalysis { /// @param root is the global that starts the cyclic dependency, which must be /// found in `stack`. /// @param stack is the global dependency stack that contains a loop. - void CyclicDependencyFound(const Global* root, const std::vector& stack) { + void CyclicDependencyFound(const Global* root, utils::VectorRef stack) { std::stringstream msg; msg << "cyclic dependency found: "; constexpr size_t kLoopNotStarted = ~0u; size_t loop_start = kLoopNotStarted; - for (size_t i = 0; i < stack.size(); i++) { + for (size_t i = 0; i < stack.Length(); i++) { auto* e = stack[i]; if (loop_start == kLoopNotStarted && e == root) { loop_start = i; @@ -637,9 +707,9 @@ struct DependencyAnalysis { } msg << "'" << NameOf(root->node) << "'"; AddError(diagnostics_, msg.str(), root->node->source); - for (size_t i = loop_start; i < stack.size(); i++) { + for (size_t i = loop_start; i < stack.Length(); i++) { auto* from = stack[i]; - auto* to = (i + 1 < stack.size()) ? stack[i + 1] : stack[loop_start]; + auto* to = (i + 1 < stack.Length()) ? stack[i + 1] : stack[loop_start]; auto info = DepInfoFor(from, to); AddNote(diagnostics_, KindOf(from->node) + " '" + NameOf(from->node) + "' " + info.action + " " + @@ -694,7 +764,7 @@ struct DependencyAnalysis { std::vector declaration_order_; /// Globals in sorted dependency order. Populated by SortGlobals(). - utils::UniqueVector sorted_; + utils::UniqueVector sorted_; }; } // namespace diff --git a/src/tint/resolver/dependency_graph.h b/src/tint/resolver/dependency_graph.h index 0554817ebc..9f5ddc5646 100644 --- a/src/tint/resolver/dependency_graph.h +++ b/src/tint/resolver/dependency_graph.h @@ -46,7 +46,7 @@ struct DependencyGraph { DependencyGraph& output); /// All globals in dependency-sorted order. - std::vector ordered_globals; + utils::Vector ordered_globals; /// Map of ast::IdentifierExpression or ast::TypeName to a type, function, or /// variable that declares the symbol. diff --git a/src/tint/resolver/dependency_graph_test.cc b/src/tint/resolver/dependency_graph_test.cc index 248dc87e48..224d342b12 100644 --- a/src/tint/resolver/dependency_graph_test.cc +++ b/src/tint/resolver/dependency_graph_test.cc @@ -113,12 +113,12 @@ enum class SymbolUseKind { GlobalVarSampledTexElemType, GlobalVarMultisampledTexElemType, GlobalVarValue, - GlobalLetType, - GlobalLetArrayElemType, - GlobalLetArraySizeValue, - GlobalLetVectorElemType, - GlobalLetMatrixElemType, - GlobalLetValue, + GlobalConstType, + GlobalConstArrayElemType, + GlobalConstArraySizeValue, + GlobalConstVectorElemType, + GlobalConstMatrixElemType, + GlobalConstValue, AliasType, StructMemberType, CallFunction, @@ -146,11 +146,11 @@ static constexpr SymbolUseKind kTypeUseKinds[] = { SymbolUseKind::GlobalVarMatrixElemType, SymbolUseKind::GlobalVarSampledTexElemType, SymbolUseKind::GlobalVarMultisampledTexElemType, - SymbolUseKind::GlobalLetType, - SymbolUseKind::GlobalLetArrayElemType, - SymbolUseKind::GlobalLetArraySizeValue, - SymbolUseKind::GlobalLetVectorElemType, - SymbolUseKind::GlobalLetMatrixElemType, + SymbolUseKind::GlobalConstType, + SymbolUseKind::GlobalConstArrayElemType, + SymbolUseKind::GlobalConstArraySizeValue, + SymbolUseKind::GlobalConstVectorElemType, + SymbolUseKind::GlobalConstMatrixElemType, SymbolUseKind::AliasType, SymbolUseKind::StructMemberType, SymbolUseKind::ParameterType, @@ -165,7 +165,7 @@ static constexpr SymbolUseKind kTypeUseKinds[] = { }; static constexpr SymbolUseKind kValueUseKinds[] = { - SymbolUseKind::GlobalVarValue, SymbolUseKind::GlobalLetValue, + SymbolUseKind::GlobalVarValue, SymbolUseKind::GlobalConstValue, SymbolUseKind::LocalVarValue, SymbolUseKind::LocalLetValue, SymbolUseKind::NestedLocalVarValue, SymbolUseKind::NestedLocalLetValue, SymbolUseKind::WorkgroupSizeValue, @@ -182,7 +182,7 @@ std::ostream& operator<<(std::ostream& out, SymbolDeclKind kind) { case SymbolDeclKind::GlobalVar: return out << "global var"; case SymbolDeclKind::GlobalConst: - return out << "global let"; + return out << "global const"; case SymbolDeclKind::Alias: return out << "alias"; case SymbolDeclKind::Struct: @@ -223,18 +223,18 @@ std::ostream& operator<<(std::ostream& out, SymbolUseKind kind) { return out << "global var sampled_texture element type"; case SymbolUseKind::GlobalVarMultisampledTexElemType: return out << "global var multisampled_texture element type"; - case SymbolUseKind::GlobalLetType: - return out << "global let type"; - case SymbolUseKind::GlobalLetValue: - return out << "global let value"; - case SymbolUseKind::GlobalLetArrayElemType: - return out << "global let array element type"; - case SymbolUseKind::GlobalLetArraySizeValue: - return out << "global let array size value"; - case SymbolUseKind::GlobalLetVectorElemType: - return out << "global let vector element type"; - case SymbolUseKind::GlobalLetMatrixElemType: - return out << "global let matrix element type"; + case SymbolUseKind::GlobalConstType: + return out << "global const type"; + case SymbolUseKind::GlobalConstValue: + return out << "global const value"; + case SymbolUseKind::GlobalConstArrayElemType: + return out << "global const array element type"; + case SymbolUseKind::GlobalConstArraySizeValue: + return out << "global const array size value"; + case SymbolUseKind::GlobalConstVectorElemType: + return out << "global const vector element type"; + case SymbolUseKind::GlobalConstMatrixElemType: + return out << "global const matrix element type"; case SymbolUseKind::AliasType: return out << "alias type"; case SymbolUseKind::StructMemberType: @@ -282,10 +282,10 @@ std::string DiagString(SymbolUseKind kind) { case SymbolUseKind::GlobalVarMatrixElemType: case SymbolUseKind::GlobalVarSampledTexElemType: case SymbolUseKind::GlobalVarMultisampledTexElemType: - case SymbolUseKind::GlobalLetType: - case SymbolUseKind::GlobalLetArrayElemType: - case SymbolUseKind::GlobalLetVectorElemType: - case SymbolUseKind::GlobalLetMatrixElemType: + case SymbolUseKind::GlobalConstType: + case SymbolUseKind::GlobalConstArrayElemType: + case SymbolUseKind::GlobalConstVectorElemType: + case SymbolUseKind::GlobalConstMatrixElemType: case SymbolUseKind::AliasType: case SymbolUseKind::StructMemberType: case SymbolUseKind::ParameterType: @@ -299,8 +299,8 @@ std::string DiagString(SymbolUseKind kind) { return "type"; case SymbolUseKind::GlobalVarValue: case SymbolUseKind::GlobalVarArraySizeValue: - case SymbolUseKind::GlobalLetValue: - case SymbolUseKind::GlobalLetArraySizeValue: + case SymbolUseKind::GlobalConstValue: + case SymbolUseKind::GlobalConstArraySizeValue: case SymbolUseKind::LocalVarValue: case SymbolUseKind::LocalVarArraySizeValue: case SymbolUseKind::LocalLetValue: @@ -349,12 +349,12 @@ int ScopeDepth(SymbolUseKind kind) { case SymbolUseKind::GlobalVarMatrixElemType: case SymbolUseKind::GlobalVarSampledTexElemType: case SymbolUseKind::GlobalVarMultisampledTexElemType: - case SymbolUseKind::GlobalLetType: - case SymbolUseKind::GlobalLetValue: - case SymbolUseKind::GlobalLetArrayElemType: - case SymbolUseKind::GlobalLetArraySizeValue: - case SymbolUseKind::GlobalLetVectorElemType: - case SymbolUseKind::GlobalLetMatrixElemType: + case SymbolUseKind::GlobalConstType: + case SymbolUseKind::GlobalConstValue: + case SymbolUseKind::GlobalConstArrayElemType: + case SymbolUseKind::GlobalConstArraySizeValue: + case SymbolUseKind::GlobalConstVectorElemType: + case SymbolUseKind::GlobalConstMatrixElemType: case SymbolUseKind::AliasType: case SymbolUseKind::StructMemberType: case SymbolUseKind::WorkgroupSizeValue: @@ -384,13 +384,13 @@ struct SymbolTestHelper { /// The program builder ProgramBuilder* const builder; /// Parameters to a function that may need to be built - std::vector parameters; + utils::Vector parameters; /// Shallow function var / let declaration statements - std::vector statements; + utils::Vector statements; /// Nested function local var / let declaration statements - std::vector nested_statements; + utils::Vector nested_statements; /// Function attributes - ast::AttributeList func_attrs; + utils::Vector func_attrs; /// Constructor /// @param builder the program builder @@ -425,38 +425,38 @@ const ast::Node* SymbolTestHelper::Add(SymbolDeclKind kind, Symbol symbol, Sourc auto& b = *builder; switch (kind) { case SymbolDeclKind::GlobalVar: - return b.Global(source, symbol, b.ty.i32(), ast::StorageClass::kPrivate); + return b.GlobalVar(source, symbol, b.ty.i32(), ast::StorageClass::kPrivate); case SymbolDeclKind::GlobalConst: return b.GlobalConst(source, symbol, b.ty.i32(), b.Expr(1_i)); case SymbolDeclKind::Alias: return b.Alias(source, symbol, b.ty.i32()); case SymbolDeclKind::Struct: - return b.Structure(source, symbol, {b.Member("m", b.ty.i32())}); + return b.Structure(source, symbol, utils::Vector{b.Member("m", b.ty.i32())}); case SymbolDeclKind::Function: - return b.Func(source, symbol, {}, b.ty.void_(), {}); + return b.Func(source, symbol, utils::Empty, b.ty.void_(), utils::Empty); case SymbolDeclKind::Parameter: { auto* node = b.Param(source, symbol, b.ty.i32()); - parameters.emplace_back(node); + parameters.Push(node); return node; } case SymbolDeclKind::LocalVar: { auto* node = b.Var(source, symbol, b.ty.i32()); - statements.emplace_back(b.Decl(node)); + statements.Push(b.Decl(node)); return node; } case SymbolDeclKind::LocalLet: { auto* node = b.Let(source, symbol, b.ty.i32(), b.Expr(1_i)); - statements.emplace_back(b.Decl(node)); + statements.Push(b.Decl(node)); return node; } case SymbolDeclKind::NestedLocalVar: { auto* node = b.Var(source, symbol, b.ty.i32()); - nested_statements.emplace_back(b.Decl(node)); + nested_statements.Push(b.Decl(node)); return node; } case SymbolDeclKind::NestedLocalLet: { auto* node = b.Let(source, symbol, b.ty.i32(), b.Expr(1_i)); - nested_statements.emplace_back(b.Decl(node)); + nested_statements.Push(b.Decl(node)); return node; } } @@ -468,70 +468,70 @@ const ast::Node* SymbolTestHelper::Add(SymbolUseKind kind, Symbol symbol, Source switch (kind) { case SymbolUseKind::GlobalVarType: { auto* node = b.ty.type_name(source, symbol); - b.Global(b.Sym(), node, ast::StorageClass::kPrivate); + b.GlobalVar(b.Sym(), node, ast::StorageClass::kPrivate); return node; } case SymbolUseKind::GlobalVarArrayElemType: { auto* node = b.ty.type_name(source, symbol); - b.Global(b.Sym(), b.ty.array(node, 4_i), ast::StorageClass::kPrivate); + b.GlobalVar(b.Sym(), b.ty.array(node, 4_i), ast::StorageClass::kPrivate); return node; } case SymbolUseKind::GlobalVarArraySizeValue: { auto* node = b.Expr(source, symbol); - b.Global(b.Sym(), b.ty.array(b.ty.i32(), node), ast::StorageClass::kPrivate); + b.GlobalVar(b.Sym(), b.ty.array(b.ty.i32(), node), ast::StorageClass::kPrivate); return node; } case SymbolUseKind::GlobalVarVectorElemType: { auto* node = b.ty.type_name(source, symbol); - b.Global(b.Sym(), b.ty.vec3(node), ast::StorageClass::kPrivate); + b.GlobalVar(b.Sym(), b.ty.vec3(node), ast::StorageClass::kPrivate); return node; } case SymbolUseKind::GlobalVarMatrixElemType: { auto* node = b.ty.type_name(source, symbol); - b.Global(b.Sym(), b.ty.mat3x4(node), ast::StorageClass::kPrivate); + b.GlobalVar(b.Sym(), b.ty.mat3x4(node), ast::StorageClass::kPrivate); return node; } case SymbolUseKind::GlobalVarSampledTexElemType: { auto* node = b.ty.type_name(source, symbol); - b.Global(b.Sym(), b.ty.sampled_texture(ast::TextureDimension::k2d, node)); + b.GlobalVar(b.Sym(), b.ty.sampled_texture(ast::TextureDimension::k2d, node)); return node; } case SymbolUseKind::GlobalVarMultisampledTexElemType: { auto* node = b.ty.type_name(source, symbol); - b.Global(b.Sym(), b.ty.multisampled_texture(ast::TextureDimension::k2d, node)); + b.GlobalVar(b.Sym(), b.ty.multisampled_texture(ast::TextureDimension::k2d, node)); return node; } case SymbolUseKind::GlobalVarValue: { auto* node = b.Expr(source, symbol); - b.Global(b.Sym(), b.ty.i32(), ast::StorageClass::kPrivate, node); + b.GlobalVar(b.Sym(), b.ty.i32(), ast::StorageClass::kPrivate, node); return node; } - case SymbolUseKind::GlobalLetType: { + case SymbolUseKind::GlobalConstType: { auto* node = b.ty.type_name(source, symbol); b.GlobalConst(b.Sym(), node, b.Expr(1_i)); return node; } - case SymbolUseKind::GlobalLetArrayElemType: { + case SymbolUseKind::GlobalConstArrayElemType: { auto* node = b.ty.type_name(source, symbol); b.GlobalConst(b.Sym(), b.ty.array(node, 4_i), b.Expr(1_i)); return node; } - case SymbolUseKind::GlobalLetArraySizeValue: { + case SymbolUseKind::GlobalConstArraySizeValue: { auto* node = b.Expr(source, symbol); b.GlobalConst(b.Sym(), b.ty.array(b.ty.i32(), node), b.Expr(1_i)); return node; } - case SymbolUseKind::GlobalLetVectorElemType: { + case SymbolUseKind::GlobalConstVectorElemType: { auto* node = b.ty.type_name(source, symbol); b.GlobalConst(b.Sym(), b.ty.vec3(node), b.Expr(1_i)); return node; } - case SymbolUseKind::GlobalLetMatrixElemType: { + case SymbolUseKind::GlobalConstMatrixElemType: { auto* node = b.ty.type_name(source, symbol); b.GlobalConst(b.Sym(), b.ty.mat3x4(node), b.Expr(1_i)); return node; } - case SymbolUseKind::GlobalLetValue: { + case SymbolUseKind::GlobalConstValue: { auto* node = b.Expr(source, symbol); b.GlobalConst(b.Sym(), b.ty.i32(), node); return node; @@ -543,83 +543,82 @@ const ast::Node* SymbolTestHelper::Add(SymbolUseKind kind, Symbol symbol, Source } case SymbolUseKind::StructMemberType: { auto* node = b.ty.type_name(source, symbol); - b.Structure(b.Sym(), {b.Member("m", node)}); + b.Structure(b.Sym(), utils::Vector{b.Member("m", node)}); return node; } case SymbolUseKind::CallFunction: { auto* node = b.Expr(source, symbol); - statements.emplace_back(b.CallStmt(b.Call(node))); + statements.Push(b.CallStmt(b.Call(node))); return node; } case SymbolUseKind::ParameterType: { auto* node = b.ty.type_name(source, symbol); - parameters.emplace_back(b.Param(b.Sym(), node)); + parameters.Push(b.Param(b.Sym(), node)); return node; } case SymbolUseKind::LocalVarType: { auto* node = b.ty.type_name(source, symbol); - statements.emplace_back(b.Decl(b.Var(b.Sym(), node))); + statements.Push(b.Decl(b.Var(b.Sym(), node))); return node; } case SymbolUseKind::LocalVarArrayElemType: { auto* node = b.ty.type_name(source, symbol); - statements.emplace_back(b.Decl(b.Var(b.Sym(), b.ty.array(node, 4_u), b.Expr(1_i)))); + statements.Push(b.Decl(b.Var(b.Sym(), b.ty.array(node, 4_u), b.Expr(1_i)))); return node; } case SymbolUseKind::LocalVarArraySizeValue: { auto* node = b.Expr(source, symbol); - statements.emplace_back( - b.Decl(b.Var(b.Sym(), b.ty.array(b.ty.i32(), node), b.Expr(1_i)))); + statements.Push(b.Decl(b.Var(b.Sym(), b.ty.array(b.ty.i32(), node), b.Expr(1_i)))); return node; } case SymbolUseKind::LocalVarVectorElemType: { auto* node = b.ty.type_name(source, symbol); - statements.emplace_back(b.Decl(b.Var(b.Sym(), b.ty.vec3(node)))); + statements.Push(b.Decl(b.Var(b.Sym(), b.ty.vec3(node)))); return node; } case SymbolUseKind::LocalVarMatrixElemType: { auto* node = b.ty.type_name(source, symbol); - statements.emplace_back(b.Decl(b.Var(b.Sym(), b.ty.mat3x4(node)))); + statements.Push(b.Decl(b.Var(b.Sym(), b.ty.mat3x4(node)))); return node; } case SymbolUseKind::LocalVarValue: { auto* node = b.Expr(source, symbol); - statements.emplace_back(b.Decl(b.Var(b.Sym(), b.ty.i32(), node))); + statements.Push(b.Decl(b.Var(b.Sym(), b.ty.i32(), node))); return node; } case SymbolUseKind::LocalLetType: { auto* node = b.ty.type_name(source, symbol); - statements.emplace_back(b.Decl(b.Let(b.Sym(), node, b.Expr(1_i)))); + statements.Push(b.Decl(b.Let(b.Sym(), node, b.Expr(1_i)))); return node; } case SymbolUseKind::LocalLetValue: { auto* node = b.Expr(source, symbol); - statements.emplace_back(b.Decl(b.Let(b.Sym(), b.ty.i32(), node))); + statements.Push(b.Decl(b.Let(b.Sym(), b.ty.i32(), node))); return node; } case SymbolUseKind::NestedLocalVarType: { auto* node = b.ty.type_name(source, symbol); - nested_statements.emplace_back(b.Decl(b.Var(b.Sym(), node))); + nested_statements.Push(b.Decl(b.Var(b.Sym(), node))); return node; } case SymbolUseKind::NestedLocalVarValue: { auto* node = b.Expr(source, symbol); - nested_statements.emplace_back(b.Decl(b.Var(b.Sym(), b.ty.i32(), node))); + nested_statements.Push(b.Decl(b.Var(b.Sym(), b.ty.i32(), node))); return node; } case SymbolUseKind::NestedLocalLetType: { auto* node = b.ty.type_name(source, symbol); - nested_statements.emplace_back(b.Decl(b.Let(b.Sym(), node, b.Expr(1_i)))); + nested_statements.Push(b.Decl(b.Let(b.Sym(), node, b.Expr(1_i)))); return node; } case SymbolUseKind::NestedLocalLetValue: { auto* node = b.Expr(source, symbol); - nested_statements.emplace_back(b.Decl(b.Let(b.Sym(), b.ty.i32(), node))); + nested_statements.Push(b.Decl(b.Let(b.Sym(), b.ty.i32(), node))); return node; } case SymbolUseKind::WorkgroupSizeValue: { auto* node = b.Expr(source, symbol); - func_attrs.emplace_back(b.WorkgroupSize(1_i, node, 2_i)); + func_attrs.Push(b.WorkgroupSize(1_i, node, 2_i)); return node; } } @@ -628,15 +627,15 @@ const ast::Node* SymbolTestHelper::Add(SymbolUseKind kind, Symbol symbol, Source void SymbolTestHelper::Build() { auto& b = *builder; - if (!nested_statements.empty()) { - statements.emplace_back(b.Block(nested_statements)); - nested_statements.clear(); + if (!nested_statements.IsEmpty()) { + statements.Push(b.Block(nested_statements)); + nested_statements.Clear(); } - if (!parameters.empty() || !statements.empty() || !func_attrs.empty()) { + if (!parameters.IsEmpty() || !statements.IsEmpty() || !func_attrs.IsEmpty()) { b.Func("func", parameters, b.ty.void_(), statements, func_attrs); - parameters.clear(); - statements.clear(); - func_attrs.clear(); + parameters.Clear(); + statements.Clear(); + func_attrs.Clear(); } } @@ -651,8 +650,8 @@ TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, FuncCall) { // fn A() { B(); } // fn B() {} - Func("A", {}, ty.void_(), {CallStmt(Call(Expr(Source{{12, 34}}, "B")))}); - Func(Source{{56, 78}}, "B", {}, ty.void_(), {Return()}); + Func("A", utils::Empty, ty.void_(), utils::Vector{CallStmt(Call(Expr(Source{{12, 34}}, "B")))}); + Func(Source{{56, 78}}, "B", utils::Empty, ty.void_(), utils::Vector{Return()}); Build(); } @@ -663,7 +662,8 @@ TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeConstructed) { // } // type T = i32; - Func("F", {}, ty.void_(), {Block(Ignore(Construct(ty.type_name(Source{{12, 34}}, "T"))))}); + Func("F", utils::Empty, ty.void_(), + utils::Vector{Block(Ignore(Construct(ty.type_name(Source{{12, 34}}, "T"))))}); Alias(Source{{56, 78}}, "T", ty.i32()); Build(); @@ -675,7 +675,8 @@ TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeUsedByLocal) { // } // type T = i32; - Func("F", {}, ty.void_(), {Block(Decl(Var("v", ty.type_name(Source{{12, 34}}, "T"))))}); + Func("F", utils::Empty, ty.void_(), + utils::Vector{Block(Decl(Var("v", ty.type_name(Source{{12, 34}}, "T"))))}); Alias(Source{{56, 78}}, "T", ty.i32()); Build(); @@ -685,7 +686,8 @@ TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeUsedByParam) { // fn F(p : T) {} // type T = i32; - Func("F", {Param("p", ty.type_name(Source{{12, 34}}, "T"))}, ty.void_(), {}); + Func("F", utils::Vector{Param("p", ty.type_name(Source{{12, 34}}, "T"))}, ty.void_(), + utils::Empty); Alias(Source{{56, 78}}, "T", ty.i32()); Build(); @@ -695,7 +697,7 @@ TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeUsedAsReturnType) { // fn F() -> T {} // type T = i32; - Func("F", {}, ty.type_name(Source{{12, 34}}, "T"), {}); + Func("F", utils::Empty, ty.type_name(Source{{12, 34}}, "T"), utils::Empty); Alias(Source{{56, 78}}, "T", ty.i32()); Build(); @@ -705,7 +707,7 @@ TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeByStructMember) { // struct S { m : T }; // type T = i32; - Structure("S", {Member("m", ty.type_name(Source{{12, 34}}, "T"))}); + Structure("S", utils::Vector{Member("m", ty.type_name(Source{{12, 34}}, "T"))}); Alias(Source{{56, 78}}, "T", ty.i32()); Build(); @@ -717,9 +719,12 @@ TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, VarUsed) { // } // var G: f32 = 2.1; - Func("F", ast::VariableList{}, ty.void_(), {Block(Assign(Expr(Source{{12, 34}}, "G"), 3.14f))}); + Func("F", utils::Empty, ty.void_(), + utils::Vector{ + Block(Assign(Expr(Source{{12, 34}}, "G"), 3.14_f)), + }); - Global(Source{{56, 78}}, "G", ty.f32(), ast::StorageClass::kPrivate, Expr(2.1f)); + GlobalVar(Source{{56, 78}}, "G", ty.f32(), ast::StorageClass::kPrivate, Expr(2.1_f)); Build(); } @@ -769,7 +774,7 @@ using ResolverDependencyGraphDeclSelfUse = ResolverDependencyGraphTest; TEST_F(ResolverDependencyGraphDeclSelfUse, GlobalVar) { const Symbol symbol = Sym("SYMBOL"); - Global(symbol, ty.i32(), Mul(Expr(Source{{12, 34}}, symbol), 123_i)); + GlobalVar(symbol, ty.i32(), Mul(Expr(Source{{12, 34}}, symbol), 123_i)); Build(R"(error: cyclic dependency found: 'SYMBOL' -> 'SYMBOL' 12:34 note: var 'SYMBOL' references var 'SYMBOL' here)"); } @@ -778,7 +783,7 @@ TEST_F(ResolverDependencyGraphDeclSelfUse, GlobalConst) { const Symbol symbol = Sym("SYMBOL"); GlobalConst(symbol, ty.i32(), Mul(Expr(Source{{12, 34}}, symbol), 123_i)); Build(R"(error: cyclic dependency found: 'SYMBOL' -> 'SYMBOL' -12:34 note: let 'SYMBOL' references let 'SYMBOL' here)"); +12:34 note: const 'SYMBOL' references const 'SYMBOL' here)"); } TEST_F(ResolverDependencyGraphDeclSelfUse, LocalVar) { @@ -805,8 +810,8 @@ using ResolverDependencyGraphCyclicRefTest = ResolverDependencyGraphTest; TEST_F(ResolverDependencyGraphCyclicRefTest, DirectCall) { // fn main() { main(); } - Func(Source{{12, 34}}, "main", {}, ty.void_(), - {CallStmt(Call(Expr(Source{{56, 78}}, "main")))}); + Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(), + utils::Vector{CallStmt(Call(Expr(Source{{56, 78}}, "main")))}); Build(R"(12:34 error: cyclic dependency found: 'main' -> 'main' 56:78 note: function 'main' calls function 'main' here)"); @@ -819,15 +824,18 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, IndirectCall) { // 4: fn c() { d(); } // 5: fn b() { c(); } - Func(Source{{1, 1}}, "a", {}, ty.void_(), {CallStmt(Call(Expr(Source{{1, 10}}, "b")))}); - Func(Source{{2, 1}}, "e", {}, ty.void_(), {}); - Func(Source{{3, 1}}, "d", {}, ty.void_(), - { + Func(Source{{1, 1}}, "a", utils::Empty, ty.void_(), + utils::Vector{CallStmt(Call(Expr(Source{{1, 10}}, "b")))}); + Func(Source{{2, 1}}, "e", utils::Empty, ty.void_(), utils::Empty); + Func(Source{{3, 1}}, "d", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call(Expr(Source{{3, 10}}, "e"))), CallStmt(Call(Expr(Source{{3, 10}}, "b"))), }); - Func(Source{{4, 1}}, "c", {}, ty.void_(), {CallStmt(Call(Expr(Source{{4, 10}}, "d")))}); - Func(Source{{5, 1}}, "b", {}, ty.void_(), {CallStmt(Call(Expr(Source{{5, 10}}, "c")))}); + Func(Source{{4, 1}}, "c", utils::Empty, ty.void_(), + utils::Vector{CallStmt(Call(Expr(Source{{4, 10}}, "d")))}); + Func(Source{{5, 1}}, "b", utils::Empty, ty.void_(), + utils::Vector{CallStmt(Call(Expr(Source{{5, 10}}, "c")))}); Build(R"(5:1 error: cyclic dependency found: 'b' -> 'c' -> 'd' -> 'b' 5:10 note: function 'b' calls function 'c' here @@ -868,7 +876,8 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, Struct_Direct) { // a: S; // }; - Structure(Source{{12, 34}}, "S", {Member("a", ty.type_name(Source{{56, 78}}, "S"))}); + Structure(Source{{12, 34}}, "S", + utils::Vector{Member("a", ty.type_name(Source{{56, 78}}, "S"))}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -881,9 +890,9 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, Struct_Indirect) { // 2: struct X { y: Y; }; // 3: struct Z { x: X; }; - Structure(Source{{1, 1}}, "Y", {Member("z", ty.type_name(Source{{1, 10}}, "Z"))}); - Structure(Source{{2, 1}}, "X", {Member("y", ty.type_name(Source{{2, 10}}, "Y"))}); - Structure(Source{{3, 1}}, "Z", {Member("x", ty.type_name(Source{{3, 10}}, "X"))}); + Structure(Source{{1, 1}}, "Y", utils::Vector{Member("z", ty.type_name(Source{{1, 10}}, "Z"))}); + Structure(Source{{2, 1}}, "X", utils::Vector{Member("y", ty.type_name(Source{{2, 10}}, "Y"))}); + Structure(Source{{3, 1}}, "Z", utils::Vector{Member("x", ty.type_name(Source{{3, 10}}, "X"))}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -896,7 +905,7 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, Struct_Indirect) { TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalVar_Direct) { // var V : i32 = V; - Global(Source{{12, 34}}, "V", ty.i32(), Expr(Source{{56, 78}}, "V")); + GlobalVar(Source{{12, 34}}, "V", ty.i32(), Expr(Source{{56, 78}}, "V")); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -904,7 +913,7 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalVar_Direct) { 56:78 note: var 'V' references var 'V' here)"); } -TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalLet_Direct) { +TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalConst_Direct) { // let V : i32 = V; GlobalConst(Source{{12, 34}}, "V", ty.i32(), Expr(Source{{56, 78}}, "V")); @@ -912,7 +921,7 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalLet_Direct) { EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(12:34 error: cyclic dependency found: 'V' -> 'V' -56:78 note: let 'V' references let 'V' here)"); +56:78 note: const 'V' references const 'V' here)"); } TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalVar_Indirect) { @@ -920,9 +929,9 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalVar_Indirect) { // 2: var X : i32 = Y; // 3: var Z : i32 = X; - Global(Source{{1, 1}}, "Y", ty.i32(), Expr(Source{{1, 10}}, "Z")); - Global(Source{{2, 1}}, "X", ty.i32(), Expr(Source{{2, 10}}, "Y")); - Global(Source{{3, 1}}, "Z", ty.i32(), Expr(Source{{3, 10}}, "X")); + GlobalVar(Source{{1, 1}}, "Y", ty.i32(), Expr(Source{{1, 10}}, "Z")); + GlobalVar(Source{{2, 1}}, "X", ty.i32(), Expr(Source{{2, 10}}, "Y")); + GlobalVar(Source{{3, 1}}, "Z", ty.i32(), Expr(Source{{3, 10}}, "X")); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -932,10 +941,10 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalVar_Indirect) { 2:10 note: var 'X' references var 'Y' here)"); } -TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalLet_Indirect) { - // 1: let Y : i32 = Z; - // 2: let X : i32 = Y; - // 3: let Z : i32 = X; +TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalConst_Indirect) { + // 1: const Y : i32 = Z; + // 2: const X : i32 = Y; + // 3: const Z : i32 = X; GlobalConst(Source{{1, 1}}, "Y", ty.i32(), Expr(Source{{1, 10}}, "Z")); GlobalConst(Source{{2, 1}}, "X", ty.i32(), Expr(Source{{2, 10}}, "Y")); @@ -944,9 +953,9 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalLet_Indirect) { EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(1:1 error: cyclic dependency found: 'Y' -> 'Z' -> 'X' -> 'Y' -1:10 note: let 'Y' references let 'Z' here -3:10 note: let 'Z' references let 'X' here -2:10 note: let 'X' references let 'Y' here)"); +1:10 note: const 'Y' references const 'Z' here +3:10 note: const 'Z' references const 'X' here +2:10 note: const 'X' references const 'Y' here)"); } TEST_F(ResolverDependencyGraphCyclicRefTest, Mixed_RecursiveDependencies) { @@ -955,13 +964,13 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, Mixed_RecursiveDependencies) { // 3: struct S { a : A }; // 4: var Z = L; // 5: type R = A; - // 6: let L : S = Z; + // 6: const L : S = Z; - Func(Source{{1, 1}}, "F", {}, ty.type_name(Source{{1, 5}}, "R"), - {Return(Expr(Source{{1, 10}}, "Z"))}); + Func(Source{{1, 1}}, "F", utils::Empty, ty.type_name(Source{{1, 5}}, "R"), + utils::Vector{Return(Expr(Source{{1, 10}}, "Z"))}); Alias(Source{{2, 1}}, "A", ty.type_name(Source{{2, 10}}, "S")); - Structure(Source{{3, 1}}, "S", {Member("a", ty.type_name(Source{{3, 10}}, "A"))}); - Global(Source{{4, 1}}, "Z", nullptr, Expr(Source{{4, 10}}, "L")); + Structure(Source{{3, 1}}, "S", utils::Vector{Member("a", ty.type_name(Source{{3, 10}}, "A"))}); + GlobalVar(Source{{4, 1}}, "Z", Expr(Source{{4, 10}}, "L")); Alias(Source{{5, 1}}, "R", ty.type_name(Source{{5, 10}}, "A")); GlobalConst(Source{{6, 1}}, "L", ty.type_name(Source{{5, 5}}, "S"), Expr(Source{{5, 10}}, "Z")); @@ -971,8 +980,8 @@ TEST_F(ResolverDependencyGraphCyclicRefTest, Mixed_RecursiveDependencies) { 2:10 note: alias 'A' references struct 'S' here 3:10 note: struct 'S' references alias 'A' here 4:1 error: cyclic dependency found: 'Z' -> 'L' -> 'Z' -4:10 note: var 'Z' references let 'L' here -5:10 note: let 'L' references var 'Z' here)"); +4:10 note: var 'Z' references const 'L' here +5:10 note: const 'L' references var 'Z' here)"); } } // namespace recursive_tests @@ -1036,7 +1045,7 @@ TEST_P(ResolverDependencyGraphOrderedGlobalsTest, InOrder) { helper.Add(use_kind, symbol, Source{{56, 78}}); helper.Build(); - ASSERT_EQ(AST().GlobalDeclarations().size(), 2u); + ASSERT_EQ(AST().GlobalDeclarations().Length(), 2u); auto* decl = AST().GlobalDeclarations()[0]; auto* use = AST().GlobalDeclarations()[1]; @@ -1056,7 +1065,7 @@ TEST_P(ResolverDependencyGraphOrderedGlobalsTest, OutOfOrder) { helper.Add(decl_kind, symbol, Source{{12, 34}}); helper.Build(); - ASSERT_EQ(AST().GlobalDeclarations().size(), 2u); + ASSERT_EQ(AST().GlobalDeclarations().Length(), 2u); auto* use = AST().GlobalDeclarations()[0]; auto* decl = AST().GlobalDeclarations()[1]; @@ -1077,6 +1086,20 @@ INSTANTIATE_TEST_SUITE_P(Functions, ResolverDependencyGraphOrderedGlobalsTest, testing::Combine(testing::ValuesIn(kFuncDeclKinds), testing::ValuesIn(kFuncUseKinds))); + +TEST_F(ResolverDependencyGraphOrderedGlobalsTest, EnableFirst) { + // Test that enable nodes always go before any other global declaration. + // Although all enable directives in a valid WGSL program must go before any other global + // declaration, a transform may produce such a AST tree that has some declarations before enable + // nodes. DependencyGraph should deal with these cases. + auto* var_1 = GlobalVar("SYMBOL1", ty.i32()); + auto* enable_1 = Enable(ast::Extension::kF16); + auto* var_2 = GlobalVar("SYMBOL2", ty.f32()); + auto* enable_2 = Enable(ast::Extension::kF16); + + EXPECT_THAT(AST().GlobalDeclarations(), ElementsAre(var_1, enable_1, var_2, enable_2)); + EXPECT_THAT(Build().ordered_globals, ElementsAre(enable_1, enable_2, var_1, var_2)); +} } // namespace ordered_globals //////////////////////////////////////////////////////////////////////////////// @@ -1147,9 +1170,9 @@ TEST_P(ResolverDependencyShadowTest, Test) { SymbolTestHelper helper(this); auto* outer = helper.Add(outer_kind, symbol, Source{{12, 34}}); helper.Add(inner_kind, symbol, Source{{56, 78}}); - auto* inner_var = helper.nested_statements.size() + auto* inner_var = helper.nested_statements.Length() ? helper.nested_statements[0]->As()->variable - : helper.statements.size() + : helper.statements.Length() ? helper.statements[0]->As()->variable : helper.parameters[0]; helper.Build(); @@ -1184,9 +1207,9 @@ TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) { const auto type_sym = Sym("TYPE"); const auto func_sym = Sym("FUNC"); - const auto* value_decl = Global(value_sym, ty.i32(), ast::StorageClass::kPrivate); + const auto* value_decl = GlobalVar(value_sym, ty.i32(), ast::StorageClass::kPrivate); const auto* type_decl = Alias(type_sym, ty.i32()); - const auto* func_decl = Func(func_sym, {}, ty.void_(), {}); + const auto* func_decl = Func(func_sym, utils::Empty, ty.void_(), utils::Empty); struct SymbolUse { const ast::Node* decl = nullptr; @@ -1194,10 +1217,10 @@ TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) { std::string where; }; - std::vector symbol_uses; + utils::Vector symbol_uses; auto add_use = [&](const ast::Node* decl, auto* use, int line, const char* kind) { - symbol_uses.emplace_back( + symbol_uses.Push( SymbolUse{decl, use, std::string(__FILE__) + ":" + std::to_string(line) + ": " + kind}); return use; }; @@ -1206,13 +1229,13 @@ TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) { #define F add_use(func_decl, Expr(func_sym), __LINE__, "F()") Alias(Sym(), T); - Structure(Sym(), {Member(Sym(), T)}); - Global(Sym(), T, V); + Structure(Sym(), utils::Vector{Member(Sym(), T)}); + GlobalVar(Sym(), T, V); GlobalConst(Sym(), T, V); - Func(Sym(), // - {Param(Sym(), T)}, // - T, // Return type - { + Func(Sym(), // + utils::Vector{Param(Sym(), T)}, // + T, // Return type + utils::Vector{ Decl(Var(Sym(), T, V)), // Decl(Let(Sym(), T, V)), // CallStmt(Call(F, V)), // @@ -1228,6 +1251,9 @@ TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) { Assign(V, V), // Block( // Assign(V, V))), // + While(Equal(V, V), // + Block( // + Assign(V, V))), // Loop(Block(Assign(V, V)), // Block(Assign(V, V))), // Switch(V, // @@ -1241,24 +1267,24 @@ TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) { Discard(), // }); // // Exercise type traversal - Global(Sym(), ty.atomic(T)); - Global(Sym(), ty.bool_()); - Global(Sym(), ty.i32()); - Global(Sym(), ty.u32()); - Global(Sym(), ty.f32()); - Global(Sym(), ty.array(T, V, 4)); - Global(Sym(), ty.vec3(T)); - Global(Sym(), ty.mat3x2(T)); - Global(Sym(), ty.pointer(T, ast::StorageClass::kPrivate)); - Global(Sym(), ty.sampled_texture(ast::TextureDimension::k2d, T)); - Global(Sym(), ty.depth_texture(ast::TextureDimension::k2d)); - Global(Sym(), ty.depth_multisampled_texture(ast::TextureDimension::k2d)); - Global(Sym(), ty.external_texture()); - Global(Sym(), ty.multisampled_texture(ast::TextureDimension::k2d, T)); - Global(Sym(), ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Float, - ast::Access::kRead)); // - Global(Sym(), ty.sampler(ast::SamplerKind::kSampler)); - Func(Sym(), {}, ty.void_(), {}); + GlobalVar(Sym(), ty.atomic(T)); + GlobalVar(Sym(), ty.bool_()); + GlobalVar(Sym(), ty.i32()); + GlobalVar(Sym(), ty.u32()); + GlobalVar(Sym(), ty.f32()); + GlobalVar(Sym(), ty.array(T, V, 4)); + GlobalVar(Sym(), ty.vec3(T)); + GlobalVar(Sym(), ty.mat3x2(T)); + GlobalVar(Sym(), ty.pointer(T, ast::StorageClass::kPrivate)); + GlobalVar(Sym(), ty.sampled_texture(ast::TextureDimension::k2d, T)); + GlobalVar(Sym(), ty.depth_texture(ast::TextureDimension::k2d)); + GlobalVar(Sym(), ty.depth_multisampled_texture(ast::TextureDimension::k2d)); + GlobalVar(Sym(), ty.external_texture()); + GlobalVar(Sym(), ty.multisampled_texture(ast::TextureDimension::k2d, T)); + GlobalVar(Sym(), ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Float, + ast::Access::kRead)); // + GlobalVar(Sym(), ty.sampler(ast::SamplerKind::kSampler)); + Func(Sym(), utils::Empty, ty.void_(), utils::Empty); #undef V #undef T #undef F @@ -1271,11 +1297,11 @@ TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) { } TEST_F(ResolverDependencyGraphTraversalTest, InferredType) { - // Check that the nullptr of the var / let type doesn't make things explode - Global("a", nullptr, Expr(1_i)); - GlobalConst("b", nullptr, Expr(1_i)); - WrapInFunction(Var("c", nullptr, Expr(1_i)), // - Let("d", nullptr, Expr(1_i))); + // Check that the nullptr of the var / const / let type doesn't make things explode + GlobalVar("a", Expr(1_i)); + GlobalConst("b", Expr(1_i)); + WrapInFunction(Var("c", Expr(1_i)), // + Let("d", Expr(1_i))); Build(); } @@ -1283,10 +1309,10 @@ TEST_F(ResolverDependencyGraphTraversalTest, InferredType) { // DependencyAnalysis::SortGlobals(), found by clusterfuzz. // See: crbug.com/chromium/1273451 TEST_F(ResolverDependencyGraphTraversalTest, chromium_1273451) { - Structure("A", {Member("a", ty.i32())}); - Structure("B", {Member("b", ty.i32())}); - Func("f", {Param("a", ty.type_name("A"))}, ty.type_name("B"), - { + Structure("A", utils::Vector{Member("a", ty.i32())}); + Structure("B", utils::Vector{Member("b", ty.i32())}); + Func("f", utils::Vector{Param("a", ty.type_name("A"))}, ty.type_name("B"), + utils::Vector{ Return(Construct(ty.type_name("B"))), }); Build(); diff --git a/src/tint/resolver/entry_point_validation_test.cc b/src/tint/resolver/entry_point_validation_test.cc index d1d9a48399..d997912576 100644 --- a/src/tint/resolver/entry_point_validation_test.cc +++ b/src/tint/resolver/entry_point_validation_test.cc @@ -47,43 +47,72 @@ using alias = builder::alias; class ResolverEntryPointValidationTest : public TestHelper, public testing::Test {}; TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Location) { - // @stage(fragment) + // @fragment // fn main() -> @location(0) f32 { return 1.0; } - Func(Source{{12, 34}}, "main", {}, ty.f32(), {Return(1.0f)}, - {Stage(ast::PipelineStage::kFragment)}, {Location(0)}); + Func(Source{{12, 34}}, "main", utils::Empty, ty.f32(), + utils::Vector{ + Return(1_f), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Builtin) { - // @stage(vertex) + // @vertex // fn main() -> @builtin(position) vec4 { return vec4(); } - Func(Source{{12, 34}}, "main", {}, ty.vec4(), {Return(Construct(ty.vec4()))}, - {Stage(ast::PipelineStage::kVertex)}, {Builtin(ast::Builtin::kPosition)}); + Func(Source{{12, 34}}, "main", utils::Empty, ty.vec4(), + utils::Vector{ + Return(Construct(ty.vec4())), + }, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Missing) { - // @stage(vertex) + // @vertex // fn main() -> f32 { // return 1.0; // } - Func(Source{{12, 34}}, "main", {}, ty.vec4(), {Return(Construct(ty.vec4()))}, - {Stage(ast::PipelineStage::kVertex)}); + Func(Source{{12, 34}}, "main", utils::Empty, ty.vec4(), + utils::Vector{ + Return(Construct(ty.vec4())), + }, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: missing entry point IO attribute on return type"); } TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Multiple) { - // @stage(vertex) + // @vertex // fn main() -> @location(0) @builtin(position) vec4 { // return vec4(); // } - Func(Source{{12, 34}}, "main", {}, ty.vec4(), {Return(Construct(ty.vec4()))}, - {Stage(ast::PipelineStage::kVertex)}, - {Location(Source{{13, 43}}, 0), Builtin(Source{{14, 52}}, ast::Builtin::kPosition)}); + Func(Source{{12, 34}}, "main", utils::Empty, ty.vec4(), + utils::Vector{ + Return(Construct(ty.vec4())), + }, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }, + utils::Vector{ + Location(Source{{13, 43}}, 0), + Builtin(Source{{14, 52}}, ast::BuiltinValue::kPosition), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(14:52 error: multiple entry point IO attributes @@ -95,15 +124,22 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_Valid) { // @location(0) a : f32; // @builtin(frag_depth) b : f32; // }; - // @stage(fragment) + // @fragment // fn main() -> Output { // return Output(); // } - auto* output = - Structure("Output", {Member("a", ty.f32(), {Location(0)}), - Member("b", ty.f32(), {Builtin(ast::Builtin::kFragDepth)})}); - Func(Source{{12, 34}}, "main", {}, ty.Of(output), {Return(Construct(ty.Of(output)))}, - {Stage(ast::PipelineStage::kFragment)}); + auto* output = Structure( + "Output", utils::Vector{ + Member("a", ty.f32(), utils::Vector{Location(0)}), + Member("b", ty.f32(), utils::Vector{Builtin(ast::BuiltinValue::kFragDepth)}), + }); + Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output), + utils::Vector{ + Return(Construct(ty.Of(output))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -112,16 +148,24 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_MemberMultipleAttribu // struct Output { // @location(0) @builtin(frag_depth) a : f32; // }; - // @stage(fragment) + // @fragment // fn main() -> Output { // return Output(); // } - auto* output = - Structure("Output", {Member("a", ty.f32(), - {Location(Source{{13, 43}}, 0), - Builtin(Source{{14, 52}}, ast::Builtin::kFragDepth)})}); - Func(Source{{12, 34}}, "main", {}, ty.Of(output), {Return(Construct(ty.Of(output)))}, - {Stage(ast::PipelineStage::kFragment)}); + auto* output = Structure( + "Output", + utils::Vector{ + Member("a", ty.f32(), + utils::Vector{Location(Source{{13, 43}}, 0), + Builtin(Source{{14, 52}}, ast::BuiltinValue::kFragDepth)}), + }); + Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output), + utils::Vector{ + Return(Construct(ty.Of(output))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(14:52 error: multiple entry point IO attributes @@ -134,14 +178,22 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_MemberMissingAttribut // @location(0) a : f32; // b : f32; // }; - // @stage(fragment) + // @fragment // fn main() -> Output { // return Output(); // } - auto* output = Structure("Output", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)}), - Member(Source{{14, 52}}, "b", ty.f32(), {})}); - Func(Source{{12, 34}}, "main", {}, ty.Of(output), {Return(Construct(ty.Of(output)))}, - {Stage(ast::PipelineStage::kFragment)}); + auto* output = + Structure("Output", utils::Vector{ + Member(Source{{13, 43}}, "a", ty.f32(), utils::Vector{Location(0)}), + Member(Source{{14, 52}}, "b", ty.f32(), {}), + }); + Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output), + utils::Vector{ + Return(Construct(ty.Of(output))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -154,15 +206,22 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_DuplicateBuiltins) { // @builtin(frag_depth) a : f32; // @builtin(frag_depth) b : f32; // }; - // @stage(fragment) + // @fragment // fn main() -> Output { // return Output(); // } - auto* output = - Structure("Output", {Member("a", ty.f32(), {Builtin(ast::Builtin::kFragDepth)}), - Member("b", ty.f32(), {Builtin(ast::Builtin::kFragDepth)})}); - Func(Source{{12, 34}}, "main", {}, ty.Of(output), {Return(Construct(ty.Of(output)))}, - {Stage(ast::PipelineStage::kFragment)}); + auto* output = Structure( + "Output", utils::Vector{ + Member("a", ty.f32(), utils::Vector{Builtin(ast::BuiltinValue::kFragDepth)}), + Member("b", ty.f32(), utils::Vector{Builtin(ast::BuiltinValue::kFragDepth)}), + }); + Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output), + utils::Vector{ + Return(Construct(ty.Of(output))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -172,31 +231,57 @@ TEST_F(ResolverEntryPointValidationTest, ReturnType_Struct_DuplicateBuiltins) { } TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Location) { - // @stage(fragment) + // @fragment // fn main(@location(0) param : f32) {} - auto* param = Param("param", ty.f32(), {Location(0)}); - Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + auto* param = Param("param", ty.f32(), + utils::Vector{ + Location(0), + }); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Missing) { - // @stage(fragment) + // @fragment // fn main(param : f32) {} auto* param = Param(Source{{13, 43}}, "param", ty.vec4()); - Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "13:43 error: missing entry point IO attribute on parameter"); } TEST_F(ResolverEntryPointValidationTest, ParameterAttribute_Multiple) { - // @stage(fragment) + // @fragment // fn main(@location(0) @builtin(sample_index) param : u32) {} - auto* param = Param( - "param", ty.u32(), - {Location(Source{{13, 43}}, 0), Builtin(Source{{14, 52}}, ast::Builtin::kSampleIndex)}); - Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + auto* param = Param("param", ty.u32(), + utils::Vector{ + Location(Source{{13, 43}}, 0), + Builtin(Source{{14, 52}}, ast::BuiltinValue::kSampleIndex), + }); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(14:52 error: multiple entry point IO attributes @@ -208,13 +293,22 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_Valid) { // @location(0) a : f32; // @builtin(sample_index) b : u32; // }; - // @stage(fragment) + // @fragment // fn main(param : Input) {} - auto* input = - Structure("Input", {Member("a", ty.f32(), {Location(0)}), - Member("b", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)})}); + auto* input = Structure( + "Input", utils::Vector{ + Member("a", ty.f32(), utils::Vector{Location(0)}), + Member("b", ty.u32(), utils::Vector{Builtin(ast::BuiltinValue::kSampleIndex)}), + }); auto* param = Param("param", ty.Of(input)); - Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -223,14 +317,24 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_MemberMultipleAttribut // struct Input { // @location(0) @builtin(sample_index) a : u32; // }; - // @stage(fragment) + // @fragment // fn main(param : Input) {} - auto* input = - Structure("Input", {Member("a", ty.u32(), - {Location(Source{{13, 43}}, 0), - Builtin(Source{{14, 52}}, ast::Builtin::kSampleIndex)})}); + auto* input = Structure( + "Input", + utils::Vector{ + Member("a", ty.u32(), + utils::Vector{Location(Source{{13, 43}}, 0), + Builtin(Source{{14, 52}}, ast::BuiltinValue::kSampleIndex)}), + }); auto* param = Param("param", ty.Of(input)); - Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(14:52 error: multiple entry point IO attributes @@ -243,12 +347,22 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_MemberMissingAttribute // @location(0) a : f32; // b : f32; // }; - // @stage(fragment) + // @fragment // fn main(param : Input) {} - auto* input = Structure("Input", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)}), - Member(Source{{14, 52}}, "b", ty.f32(), {})}); + auto* input = + Structure("Input", utils::Vector{ + Member(Source{{13, 43}}, "a", ty.f32(), utils::Vector{Location(0)}), + Member(Source{{14, 52}}, "b", ty.f32(), {}), + }); auto* param = Param("param", ty.Of(input)); - Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(14:52 error: missing entry point IO attribute @@ -256,13 +370,26 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_MemberMissingAttribute } TEST_F(ResolverEntryPointValidationTest, Parameter_DuplicateBuiltins) { - // @stage(fragment) + // @fragment // fn main(@builtin(sample_index) param_a : u32, // @builtin(sample_index) param_b : u32) {} - auto* param_a = Param("param_a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)}); - auto* param_b = Param("param_b", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)}); - Func(Source{{12, 34}}, "main", {param_a, param_b}, ty.void_(), {}, - {Stage(ast::PipelineStage::kFragment)}); + auto* param_a = Param("param_a", ty.u32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleIndex), + }); + auto* param_b = Param("param_b", ty.u32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleIndex), + }); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param_a, + param_b, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -277,16 +404,29 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_DuplicateBuiltins) { // struct InputB { // @builtin(sample_index) a : u32; // }; - // @stage(fragment) + // @fragment // fn main(param_a : InputA, param_b : InputB) {} - auto* input_a = - Structure("InputA", {Member("a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)})}); - auto* input_b = - Structure("InputB", {Member("a", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)})}); + auto* input_a = Structure( + "InputA", + utils::Vector{ + Member("a", ty.u32(), utils::Vector{Builtin(ast::BuiltinValue::kSampleIndex)}), + }); + auto* input_b = Structure( + "InputB", + utils::Vector{ + Member("a", ty.u32(), utils::Vector{Builtin(ast::BuiltinValue::kSampleIndex)}), + }); auto* param_a = Param("param_a", ty.Of(input_a)); auto* param_b = Param("param_b", ty.Of(input_b)); - Func(Source{{12, 34}}, "main", {param_a, param_b}, ty.void_(), {}, - {Stage(ast::PipelineStage::kFragment)}); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param_a, + param_b, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -296,9 +436,12 @@ TEST_F(ResolverEntryPointValidationTest, Parameter_Struct_DuplicateBuiltins) { } TEST_F(ResolverEntryPointValidationTest, VertexShaderMustReturnPosition) { - // @stage(vertex) + // @vertex // fn main() {} - Func(Source{{12, 34}}, "main", {}, ty.void_(), {}, {Stage(ast::PipelineStage::kVertex)}); + Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -306,6 +449,135 @@ TEST_F(ResolverEntryPointValidationTest, VertexShaderMustReturnPosition) { "in its return type"); } +TEST_F(ResolverEntryPointValidationTest, PushConstantAllowedWithEnable) { + // enable chromium_experimental_push_constant; + // var a : u32; + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant); + + EXPECT_TRUE(r()->Resolve()); +} + +TEST_F(ResolverEntryPointValidationTest, PushConstantDisallowedWithoutEnable) { + // var a : u32; + GlobalVar(Source{{1, 2}}, "a", ty.u32(), ast::StorageClass::kPushConstant); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "1:2 error: use of variable storage class 'push_constant' requires enabling " + "extension 'chromium_experimental_push_constant'"); +} + +TEST_F(ResolverEntryPointValidationTest, PushConstantAllowedWithIgnoreStorageClassAttribute) { + // var a : u32; // With ast::DisabledValidation::kIgnoreStorageClass + GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant, + utils::Vector{Disable(ast::DisabledValidation::kIgnoreStorageClass)}); + + EXPECT_TRUE(r()->Resolve()); +} + +TEST_F(ResolverEntryPointValidationTest, PushConstantOneVariableUsedInEntryPoint) { + // enable chromium_experimental_push_constant; + // var a : u32; + // @compute @workgroup_size(1) fn main() { + // _ = a; + // } + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant); + + Func("main", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")}, + utils::Vector{Stage(ast::PipelineStage::kCompute), + create(Expr(1_i))}); + + EXPECT_TRUE(r()->Resolve()); +} + +TEST_F(ResolverEntryPointValidationTest, PushConstantTwoVariablesUsedInEntryPoint) { + // enable chromium_experimental_push_constant; + // var a : u32; + // var b : u32; + // @compute @workgroup_size(1) fn main() { + // _ = a; + // _ = b; + // } + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar(Source{{1, 2}}, "a", ty.u32(), ast::StorageClass::kPushConstant); + GlobalVar(Source{{3, 4}}, "b", ty.u32(), ast::StorageClass::kPushConstant); + + Func(Source{{5, 6}}, "main", {}, ty.void_(), + utils::Vector{Assign(Phony(), "a"), Assign(Phony(), "b")}, + utils::Vector{Stage(ast::PipelineStage::kCompute), + create(Expr(1_i))}); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(5:6 error: entry point 'main' uses two different 'push_constant' variables. +3:4 note: first 'push_constant' variable declaration is here +1:2 note: second 'push_constant' variable declaration is here)"); +} + +TEST_F(ResolverEntryPointValidationTest, + PushConstantTwoVariablesUsedInEntryPointWithFunctionGraph) { + // enable chromium_experimental_push_constant; + // var a : u32; + // var b : u32; + // fn uses_a() { + // _ = a; + // } + // fn uses_b() { + // _ = b; + // } + // @compute @workgroup_size(1) fn main() { + // uses_a(); + // uses_b(); + // } + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar(Source{{1, 2}}, "a", ty.u32(), ast::StorageClass::kPushConstant); + GlobalVar(Source{{3, 4}}, "b", ty.u32(), ast::StorageClass::kPushConstant); + + Func(Source{{5, 6}}, "uses_a", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")}); + Func(Source{{7, 8}}, "uses_b", {}, ty.void_(), utils::Vector{Assign(Phony(), "b")}); + + Func(Source{{9, 10}}, "main", {}, ty.void_(), + utils::Vector{CallStmt(Call("uses_a")), CallStmt(Call("uses_b"))}, + utils::Vector{Stage(ast::PipelineStage::kCompute), + create(Expr(1_i))}); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(9:10 error: entry point 'main' uses two different 'push_constant' variables. +3:4 note: first 'push_constant' variable declaration is here +7:8 note: called by function 'uses_b' +9:10 note: called by entry point 'main' +1:2 note: second 'push_constant' variable declaration is here +5:6 note: called by function 'uses_a' +9:10 note: called by entry point 'main')"); +} + +TEST_F(ResolverEntryPointValidationTest, PushConstantTwoVariablesUsedInDifferentEntryPoint) { + // enable chromium_experimental_push_constant; + // var a : u32; + // var b : u32; + // @compute @workgroup_size(1) fn uses_a() { + // _ = a; + // } + // @compute @workgroup_size(1) fn uses_b() { + // _ = a; + // } + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant); + GlobalVar("b", ty.u32(), ast::StorageClass::kPushConstant); + + Func("uses_a", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")}, + utils::Vector{Stage(ast::PipelineStage::kCompute), + create(Expr(1_i))}); + Func("uses_b", {}, ty.void_(), utils::Vector{Assign(Phony(), "b")}, + utils::Vector{Stage(ast::PipelineStage::kCompute), + create(Expr(1_i))}); + + EXPECT_TRUE(r()->Resolve()); +} + namespace TypeValidationTests { struct Params { builder::ast_type_func_ptr create_ast_type; @@ -334,14 +606,39 @@ static constexpr Params cases[] = { ParamsFor>(true), // ParamsFor>(true), // ParamsFor>(false), // + // Currently entry point IO of f16 types are not implemented yet. + // TODO(tint:1473, tint:1502): Change f16 and vecN cases to valid after f16 is supported in + // entry point IO. + ParamsFor(false), // + ParamsFor>(false), // + ParamsFor>(false), // + ParamsFor>(false), // + ParamsFor>(false), // + ParamsFor>(false), // + ParamsFor>(false), // + ParamsFor>(false), // }; TEST_P(TypeValidationTest, BareInputs) { - // @stage(fragment) + // @fragment // fn main(@location(0) @interpolate(flat) a : *) {} auto params = GetParam(); - auto* a = Param("a", params.create_ast_type(*this), {Location(0), Flat()}); - Func(Source{{12, 34}}, "main", {a}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + + Enable(ast::Extension::kF16); + + auto* a = Param("a", params.create_ast_type(*this), + utils::Vector{ + Location(0), + Flat(), + }); + Func(Source{{12, 34}}, "main", + utils::Vector{ + a, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); if (params.is_valid) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -354,13 +651,25 @@ TEST_P(TypeValidationTest, StructInputs) { // struct Input { // @location(0) @interpolate(flat) a : *; // }; - // @stage(fragment) + // @fragment // fn main(a : Input) {} auto params = GetParam(); - auto* input = - Structure("Input", {Member("a", params.create_ast_type(*this), {Location(0), Flat()})}); + + Enable(ast::Extension::kF16); + + auto* input = Structure( + "Input", utils::Vector{ + Member("a", params.create_ast_type(*this), utils::Vector{Location(0), Flat()}), + }); auto* a = Param("a", ty.Of(input), {}); - Func(Source{{12, 34}}, "main", {a}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func(Source{{12, 34}}, "main", + utils::Vector{ + a, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); if (params.is_valid) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -370,14 +679,24 @@ TEST_P(TypeValidationTest, StructInputs) { } TEST_P(TypeValidationTest, BareOutputs) { - // @stage(fragment) + // @fragment // fn main() -> @location(0) * { // return *(); // } auto params = GetParam(); - Func(Source{{12, 34}}, "main", {}, params.create_ast_type(*this), - {Return(Construct(params.create_ast_type(*this)))}, {Stage(ast::PipelineStage::kFragment)}, - {Location(0)}); + + Enable(ast::Extension::kF16); + + Func(Source{{12, 34}}, "main", utils::Empty, params.create_ast_type(*this), + utils::Vector{ + Return(Construct(params.create_ast_type(*this))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(0), + }); if (params.is_valid) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -390,14 +709,25 @@ TEST_P(TypeValidationTest, StructOutputs) { // struct Output { // @location(0) a : *; // }; - // @stage(fragment) + // @fragment // fn main() -> Output { // return Output(); // } auto params = GetParam(); - auto* output = Structure("Output", {Member("a", params.create_ast_type(*this), {Location(0)})}); - Func(Source{{12, 34}}, "main", {}, ty.Of(output), {Return(Construct(ty.Of(output)))}, - {Stage(ast::PipelineStage::kFragment)}); + + Enable(ast::Extension::kF16); + + auto* output = Structure( + "Output", utils::Vector{ + Member("a", params.create_ast_type(*this), utils::Vector{Location(0)}), + }); + Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output), + utils::Vector{ + Return(Construct(ty.Of(output))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); if (params.is_valid) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -416,21 +746,42 @@ namespace { using LocationAttributeTests = ResolverTest; TEST_F(LocationAttributeTests, Pass) { - // @stage(fragment) + // @fragment // fn frag_main(@location(0) @interpolate(flat) a: i32) {} - auto* p = Param(Source{{12, 34}}, "a", ty.i32(), {Location(0), Flat()}); - Func("frag_main", {p}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + auto* p = Param(Source{{12, 34}}, "a", ty.i32(), + utils::Vector{ + Location(0), + Flat(), + }); + Func("frag_main", + utils::Vector{ + p, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(LocationAttributeTests, BadType_Input_bool) { - // @stage(fragment) + // @fragment // fn frag_main(@location(0) a: bool) {} - auto* p = Param(Source{{12, 34}}, "a", ty.bool_(), {Location(Source{{34, 56}}, 0)}); - Func("frag_main", {p}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + auto* p = Param(Source{{12, 34}}, "a", ty.bool_(), + utils::Vector{ + Location(Source{{34, 56}}, 0), + }); + Func("frag_main", + utils::Vector{ + p, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -441,12 +792,19 @@ TEST_F(LocationAttributeTests, BadType_Input_bool) { } TEST_F(LocationAttributeTests, BadType_Output_Array) { - // @stage(fragment) + // @fragment // fn frag_main()->@location(0) array { return array(); } - Func(Source{{12, 34}}, "frag_main", {}, ty.array(), - {Return(Construct(ty.array()))}, {Stage(ast::PipelineStage::kFragment)}, - {Location(Source{{34, 56}}, 0)}); + Func(Source{{12, 34}}, "frag_main", utils::Empty, ty.array(), + utils::Vector{ + Return(Construct(ty.array())), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(Source{{34, 56}}, 0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -460,11 +818,23 @@ TEST_F(LocationAttributeTests, BadType_Input_Struct) { // struct Input { // a : f32; // }; - // @stage(fragment) + // @fragment // fn main(@location(0) param : Input) {} - auto* input = Structure("Input", {Member("a", ty.f32())}); - auto* param = Param(Source{{12, 34}}, "param", ty.Of(input), {Location(Source{{13, 43}}, 0)}); - Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + auto* input = Structure("Input", utils::Vector{ + Member("a", ty.f32()), + }); + auto* param = Param(Source{{12, 34}}, "param", ty.Of(input), + utils::Vector{ + Location(Source{{13, 43}}, 0), + }); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -481,12 +851,24 @@ TEST_F(LocationAttributeTests, BadType_Input_Struct_NestedStruct) { // struct Input { // a : Inner; // }; - // @stage(fragment) + // @fragment // fn main(param : Input) {} - auto* inner = Structure("Inner", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)})}); - auto* input = Structure("Input", {Member(Source{{14, 52}}, "a", ty.Of(inner))}); + auto* inner = + Structure("Inner", utils::Vector{ + Member(Source{{13, 43}}, "a", ty.f32(), utils::Vector{Location(0)}), + }); + auto* input = Structure("Input", utils::Vector{ + Member(Source{{14, 52}}, "a", ty.Of(inner)), + }); auto* param = Param("param", ty.Of(input)); - Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -498,12 +880,21 @@ TEST_F(LocationAttributeTests, BadType_Input_Struct_RuntimeArray) { // struct Input { // @location(0) a : array; // }; - // @stage(fragment) + // @fragment // fn main(param : Input) {} - auto* input = - Structure("Input", {Member(Source{{13, 43}}, "a", ty.array(), {Location(0)})}); + auto* input = Structure( + "Input", utils::Vector{ + Member(Source{{13, 43}}, "a", ty.array(), utils::Vector{Location(0)}), + }); auto* param = Param("param", ty.Of(input)); - Func(Source{{12, 34}}, "main", {param}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -515,15 +906,24 @@ TEST_F(LocationAttributeTests, BadType_Input_Struct_RuntimeArray) { TEST_F(LocationAttributeTests, BadMemberType_Input) { // struct S { @location(0) m: array; }; - // @stage(fragment) + // @fragment // fn frag_main( a: S) {} auto* m = Member(Source{{34, 56}}, "m", ty.array(), - ast::AttributeList{Location(Source{{12, 34}}, 0u)}); - auto* s = Structure("S", {m}); + utils::Vector{ + Location(Source{{12, 34}}, 0u), + }); + auto* s = Structure("S", utils::Vector{m}); auto* p = Param("a", ty.Of(s)); - Func("frag_main", {p}, ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func("frag_main", + utils::Vector{ + p, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -535,14 +935,22 @@ TEST_F(LocationAttributeTests, BadMemberType_Input) { TEST_F(LocationAttributeTests, BadMemberType_Output) { // struct S { @location(0) m: atomic; }; - // @stage(fragment) + // @fragment // fn frag_main() -> S {} auto* m = Member(Source{{34, 56}}, "m", ty.atomic(), - ast::AttributeList{Location(Source{{12, 34}}, 0u)}); - auto* s = Structure("S", {m}); + utils::Vector{ + Location(Source{{12, 34}}, 0u), + }); + auto* s = Structure("S", utils::Vector{m}); - Func("frag_main", {}, ty.Of(s), {Return(Construct(ty.Of(s)))}, - {Stage(ast::PipelineStage::kFragment)}, {}); + Func("frag_main", utils::Empty, ty.Of(s), + utils::Vector{ + Return(Construct(ty.Of(s))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + {}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -556,8 +964,10 @@ TEST_F(LocationAttributeTests, BadMemberType_Unused) { // struct S { @location(0) m: mat3x2; }; auto* m = Member(Source{{34, 56}}, "m", ty.mat3x2(), - ast::AttributeList{Location(Source{{12, 34}}, 0u)}); - Structure("S", {m}); + utils::Vector{ + Location(Source{{12, 34}}, 0u), + }); + Structure("S", utils::Vector{m}); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -572,15 +982,22 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_Valid) { // @location(0) a : f32; // @builtin(frag_depth) b : f32; // }; - // @stage(fragment) + // @fragment // fn main() -> Output { // return Output(); // } - auto* output = - Structure("Output", {Member("a", ty.f32(), {Location(0)}), - Member("b", ty.f32(), {Builtin(ast::Builtin::kFragDepth)})}); - Func(Source{{12, 34}}, "main", {}, ty.Of(output), {Return(Construct(ty.Of(output)))}, - {Stage(ast::PipelineStage::kFragment)}); + auto* output = Structure( + "Output", utils::Vector{ + Member("a", ty.f32(), utils::Vector{Location(0)}), + Member("b", ty.f32(), utils::Vector{Builtin(ast::BuiltinValue::kFragDepth)}), + }); + Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output), + utils::Vector{ + Return(Construct(ty.Of(output))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -589,13 +1006,23 @@ TEST_F(LocationAttributeTests, ReturnType_Struct) { // struct Output { // a : f32; // }; - // @stage(vertex) + // @vertex // fn main() -> @location(0) Output { // return Output(); // } - auto* output = Structure("Output", {Member("a", ty.f32())}); - Func(Source{{12, 34}}, "main", {}, ty.Of(output), {Return(Construct(ty.Of(output)))}, - {Stage(ast::PipelineStage::kVertex)}, {Location(Source{{13, 43}}, 0)}); + auto* output = Structure("Output", utils::Vector{ + Member("a", ty.f32()), + }); + Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output), + utils::Vector{ + Return(Construct(ty.Of(output))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }, + utils::Vector{ + Location(Source{{13, 43}}, 0), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -612,12 +1039,22 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_NestedStruct) { // struct Output { // a : Inner; // }; - // @stage(fragment) + // @fragment // fn main() -> Output { return Output(); } - auto* inner = Structure("Inner", {Member(Source{{13, 43}}, "a", ty.f32(), {Location(0)})}); - auto* output = Structure("Output", {Member(Source{{14, 52}}, "a", ty.Of(inner))}); - Func(Source{{12, 34}}, "main", {}, ty.Of(output), {Return(Construct(ty.Of(output)))}, - {Stage(ast::PipelineStage::kFragment)}); + auto* inner = + Structure("Inner", utils::Vector{ + Member(Source{{13, 43}}, "a", ty.f32(), utils::Vector{Location(0)}), + }); + auto* output = Structure("Output", utils::Vector{ + Member(Source{{14, 52}}, "a", ty.Of(inner)), + }); + Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output), + utils::Vector{ + Return(Construct(ty.Of(output))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -629,14 +1066,21 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_RuntimeArray) { // struct Output { // @location(0) a : array; // }; - // @stage(fragment) + // @fragment // fn main() -> Output { // return Output(); // } - auto* output = Structure("Output", {Member(Source{{13, 43}}, "a", ty.array(), - {Location(Source{{12, 34}}, 0)})}); - Func(Source{{12, 34}}, "main", {}, ty.Of(output), {Return(Construct(ty.Of(output)))}, - {Stage(ast::PipelineStage::kFragment)}); + auto* output = Structure("Output", utils::Vector{ + Member(Source{{13, 43}}, "a", ty.array(), + utils::Vector{Location(Source{{12, 34}}, 0)}), + }); + Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output), + utils::Vector{ + Return(Construct(ty.Of(output))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -647,32 +1091,51 @@ TEST_F(LocationAttributeTests, ReturnType_Struct_RuntimeArray) { } TEST_F(LocationAttributeTests, ComputeShaderLocation_Input) { - Func("main", {}, ty.i32(), {Return(Expr(1_i))}, - {Stage(ast::PipelineStage::kCompute), - create(Source{{12, 34}}, Expr(1_i))}, - ast::AttributeList{Location(Source{{12, 34}}, 1)}); + Func("main", utils::Empty, ty.i32(), + utils::Vector{ + Return(Expr(1_i)), + }, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + create(Source{{12, 34}}, Expr(1_i)), + }, + utils::Vector{ + Location(Source{{12, 34}}, 1), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: attribute is not valid for compute shader output"); } TEST_F(LocationAttributeTests, ComputeShaderLocation_Output) { - auto* input = Param("input", ty.i32(), ast::AttributeList{Location(Source{{12, 34}}, 0u)}); - Func("main", {input}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - create(Source{{12, 34}}, Expr(1_i))}); + auto* input = Param("input", ty.i32(), + utils::Vector{ + Location(Source{{12, 34}}, 0u), + }); + Func("main", utils::Vector{input}, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + create(Source{{12, 34}}, Expr(1_i)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: attribute is not valid for compute shader inputs"); } TEST_F(LocationAttributeTests, ComputeShaderLocationStructMember_Output) { - auto* m = Member("m", ty.i32(), ast::AttributeList{Location(Source{{12, 34}}, 0u)}); - auto* s = Structure("S", {m}); - Func(Source{{56, 78}}, "main", {}, ty.Of(s), - ast::StatementList{Return(Expr(Construct(ty.Of(s))))}, - {Stage(ast::PipelineStage::kCompute), - create(Source{{12, 34}}, Expr(1_i))}); + auto* m = Member("m", ty.i32(), + utils::Vector{ + Location(Source{{12, 34}}, 0u), + }); + auto* s = Structure("S", utils::Vector{m}); + Func(Source{{56, 78}}, "main", utils::Empty, ty.Of(s), + utils::Vector{ + Return(Expr(Construct(ty.Of(s)))), + }, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + create(Source{{12, 34}}, Expr(1_i)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -681,12 +1144,17 @@ TEST_F(LocationAttributeTests, ComputeShaderLocationStructMember_Output) { } TEST_F(LocationAttributeTests, ComputeShaderLocationStructMember_Input) { - auto* m = Member("m", ty.i32(), ast::AttributeList{Location(Source{{12, 34}}, 0u)}); - auto* s = Structure("S", {m}); + auto* m = Member("m", ty.i32(), + utils::Vector{ + Location(Source{{12, 34}}, 0u), + }); + auto* s = Structure("S", utils::Vector{m}); auto* input = Param("input", ty.Of(s)); - Func(Source{{56, 78}}, "main", {input}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - create(Source{{12, 34}}, Expr(1_i))}); + Func(Source{{56, 78}}, "main", utils::Vector{input}, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + create(Source{{12, 34}}, Expr(1_i)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -695,13 +1163,26 @@ TEST_F(LocationAttributeTests, ComputeShaderLocationStructMember_Input) { } TEST_F(LocationAttributeTests, Duplicate_input) { - // @stage(fragment) + // @fragment // fn main(@location(1) param_a : f32, // @location(1) param_b : f32) {} - auto* param_a = Param("param_a", ty.f32(), {Location(1)}); - auto* param_b = Param("param_b", ty.f32(), {Location(Source{{12, 34}}, 1)}); - Func(Source{{12, 34}}, "main", {param_a, param_b}, ty.void_(), {}, - {Stage(ast::PipelineStage::kFragment)}); + auto* param_a = Param("param_a", ty.f32(), + utils::Vector{ + Location(1), + }); + auto* param_b = Param("param_b", ty.f32(), + utils::Vector{ + Location(Source{{12, 34}}, 1), + }); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param_a, + param_b, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: location(1) attribute appears multiple times"); @@ -714,14 +1195,26 @@ TEST_F(LocationAttributeTests, Duplicate_struct) { // struct InputB { // @location(1) a : f32; // }; - // @stage(fragment) + // @fragment // fn main(param_a : InputA, param_b : InputB) {} - auto* input_a = Structure("InputA", {Member("a", ty.f32(), {Location(1)})}); - auto* input_b = Structure("InputB", {Member("a", ty.f32(), {Location(Source{{34, 56}}, 1)})}); + auto* input_a = Structure("InputA", utils::Vector{ + Member("a", ty.f32(), utils::Vector{Location(1)}), + }); + auto* input_b = + Structure("InputB", utils::Vector{ + Member("a", ty.f32(), utils::Vector{Location(Source{{34, 56}}, 1)}), + }); auto* param_a = Param("param_a", ty.Of(input_a)); auto* param_b = Param("param_b", ty.Of(input_b)); - Func(Source{{12, 34}}, "main", {param_a, param_b}, ty.void_(), {}, - {Stage(ast::PipelineStage::kFragment)}); + Func(Source{{12, 34}}, "main", + utils::Vector{ + param_a, + param_b, + }, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), diff --git a/src/tint/resolver/evaluation_stage_test.cc b/src/tint/resolver/evaluation_stage_test.cc new file mode 100644 index 0000000000..45047826ab --- /dev/null +++ b/src/tint/resolver/evaluation_stage_test.cc @@ -0,0 +1,297 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/resolver/resolver.h" + +#include "gmock/gmock.h" +#include "src/tint/resolver/resolver_test_helper.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::resolver { +namespace { + +using ResolverEvaluationStageTest = ResolverTest; + +TEST_F(ResolverEvaluationStageTest, Literal_i32) { + auto* expr = Expr(123_i); + WrapInFunction(expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, Literal_f32) { + auto* expr = Expr(123_f); + WrapInFunction(expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, Vector_Ctor) { + auto* expr = vec3(); + WrapInFunction(expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, Vector_Ctor_Const_Const) { + // const f = 1.f; + // vec2(f, f); + auto* f = Const("f", Expr(1_f)); + auto* expr = vec2(f, f); + WrapInFunction(f, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(f)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, Vector_Ctor_Runtime_Runtime) { + // var f = 1.f; + // vec2(f, f); + auto* f = Var("f", Expr(1_f)); + auto* expr = vec2(f, f); + WrapInFunction(f, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(f)->Stage(), sem::EvaluationStage::kRuntime); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kRuntime); +} + +TEST_F(ResolverEvaluationStageTest, Vector_Conv_Const) { + // const f = 1.f; + // vec2(vec2(f)); + auto* f = Const("f", Expr(1_f)); + auto* expr = vec2(vec2(f)); + WrapInFunction(f, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(f)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, Vector_Conv_Runtime) { + // var f = 1.f; + // vec2(vec2(f)); + auto* f = Var("f", Expr(1_f)); + auto* expr = vec2(vec2(f)); + WrapInFunction(f, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(f)->Stage(), sem::EvaluationStage::kRuntime); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kRuntime); +} + +TEST_F(ResolverEvaluationStageTest, Matrix_Ctor) { + auto* expr = mat2x2(); + WrapInFunction(expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, Array_Ctor) { + auto* expr = array(); + WrapInFunction(expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, Array_Ctor_Const_Const) { + // const f = 1.f; + // array(f, f); + auto* f = Const("f", Expr(1_f)); + auto* expr = Construct(ty.array(), f, f); + WrapInFunction(f, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(f)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, Array_Ctor_Const_Override) { + // const f1 = 1.f; + // override f2 = 2.f; + // array(f1, f2); + auto* f1 = Const("f1", Expr(1_f)); + auto* f2 = Override("f2", Expr(2_f)); + auto* expr = Construct(ty.array(), f1, f2); + WrapInFunction(f1, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(f1)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(f2)->Stage(), sem::EvaluationStage::kOverride); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kOverride); +} + +TEST_F(ResolverEvaluationStageTest, Array_Ctor_Override_Runtime) { + // override f1 = 1.f; + // var f2 = 2.f; + // array(f1, f2); + auto* f1 = Override("f1", Expr(1_f)); + auto* f2 = Var("f2", Expr(2_f)); + auto* expr = Construct(ty.array(), f1, f2); + WrapInFunction(f2, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(f1)->Stage(), sem::EvaluationStage::kOverride); + EXPECT_EQ(Sem().Get(f2)->Stage(), sem::EvaluationStage::kRuntime); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kRuntime); +} + +TEST_F(ResolverEvaluationStageTest, Array_Ctor_Const_Runtime) { + // const f1 = 1.f; + // var f2 = 2.f; + // array(f1, f2); + auto* f1 = Const("f1", Expr(1_f)); + auto* f2 = Var("f2", Expr(2_f)); + auto* expr = Construct(ty.array(), f1, f2); + WrapInFunction(f1, f2, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(f1)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(f2)->Stage(), sem::EvaluationStage::kRuntime); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kRuntime); +} + +TEST_F(ResolverEvaluationStageTest, Array_Ctor_Runtime_Runtime) { + // var f = 1.f; + // array(f, f); + auto* f = Var("f", Expr(1_f)); + auto* expr = Construct(ty.array(), f, f); + WrapInFunction(f, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(f)->Stage(), sem::EvaluationStage::kRuntime); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kRuntime); +} + +TEST_F(ResolverEvaluationStageTest, IndexAccessor_Const_Const) { + // const vec = vec4(); + // const idx = 1_i; + // vec[idx] + auto* vec = Const("vec", vec4()); + auto* idx = Const("idx", Expr(1_i)); + auto* expr = IndexAccessor(vec, idx); + WrapInFunction(vec, idx, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(vec)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(idx)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, IndexAccessor_Runtime_Const) { + // var vec = vec4(); + // const idx = 1_i; + // vec[idx] + auto* vec = Var("vec", vec4()); + auto* idx = Const("idx", Expr(1_i)); + auto* expr = IndexAccessor(vec, idx); + WrapInFunction(vec, idx, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(vec)->Stage(), sem::EvaluationStage::kRuntime); + EXPECT_EQ(Sem().Get(idx)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kRuntime); +} + +TEST_F(ResolverEvaluationStageTest, IndexAccessor_Const_Override) { + // const vec = vec4(); + // override idx = 1_i; + // vec[idx] + auto* vec = Const("vec", vec4()); + auto* idx = Override("idx", Expr(1_i)); + auto* expr = IndexAccessor(vec, idx); + WrapInFunction(vec, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(vec)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(idx)->Stage(), sem::EvaluationStage::kOverride); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kOverride); +} + +TEST_F(ResolverEvaluationStageTest, IndexAccessor_Const_Runtime) { + // const vec = vec4(); + // let idx = 1_i; + // vec[idx] + auto* vec = Const("vec", vec4()); + auto* idx = Let("idx", Expr(1_i)); + auto* expr = IndexAccessor(vec, idx); + WrapInFunction(vec, idx, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(vec)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(idx)->Stage(), sem::EvaluationStage::kRuntime); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kRuntime); +} + +TEST_F(ResolverEvaluationStageTest, Swizzle_Const) { + // const vec = S(); + // vec.m + auto* vec = Const("vec", vec4()); + auto* expr = MemberAccessor(vec, "xz"); + WrapInFunction(vec, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(vec)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, Swizzle_Runtime) { + // var vec = S(); + // vec.m + auto* vec = Var("vec", vec4()); + auto* expr = MemberAccessor(vec, "rg"); + WrapInFunction(vec, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(vec)->Stage(), sem::EvaluationStage::kRuntime); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kRuntime); +} + +TEST_F(ResolverEvaluationStageTest, MemberAccessor_Const) { + // struct S { m : i32 }; + // const str = S(); + // str.m + Structure("S", utils::Vector{Member("m", ty.i32())}); + auto* str = Const("str", Construct(ty.type_name("S"))); + auto* expr = MemberAccessor(str, "m"); + WrapInFunction(str, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(str)->Stage(), sem::EvaluationStage::kConstant); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kConstant); +} + +TEST_F(ResolverEvaluationStageTest, MemberAccessor_Runtime) { + // struct S { m : i32 }; + // var str = S(); + // str.m + Structure("S", utils::Vector{Member("m", ty.i32())}); + auto* str = Var("str", Construct(ty.type_name("S"))); + auto* expr = MemberAccessor(str, "m"); + WrapInFunction(str, expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(Sem().Get(str)->Stage(), sem::EvaluationStage::kRuntime); + EXPECT_EQ(Sem().Get(expr)->Stage(), sem::EvaluationStage::kRuntime); +} + +} // namespace +} // namespace tint::resolver diff --git a/src/tint/resolver/function_validation_test.cc b/src/tint/resolver/function_validation_test.cc index 1bc70a5b32..22f26205c2 100644 --- a/src/tint/resolver/function_validation_test.cc +++ b/src/tint/resolver/function_validation_test.cc @@ -30,8 +30,8 @@ class ResolverFunctionValidationTest : public TestHelper, public testing::Test { TEST_F(ResolverFunctionValidationTest, DuplicateParameterName) { // fn func_a(common_name : f32) { } // fn func_b(common_name : f32) { } - Func("func_a", {Param("common_name", ty.f32())}, ty.void_(), {}); - Func("func_b", {Param("common_name", ty.f32())}, ty.void_(), {}); + Func("func_a", utils::Vector{Param("common_name", ty.f32())}, ty.void_(), utils::Empty); + Func("func_b", utils::Vector{Param("common_name", ty.f32())}, ty.void_(), utils::Empty); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -39,8 +39,8 @@ TEST_F(ResolverFunctionValidationTest, DuplicateParameterName) { TEST_F(ResolverFunctionValidationTest, ParameterMayShadowGlobal) { // var common_name : f32; // fn func(common_name : f32) { } - Global("common_name", ty.f32(), ast::StorageClass::kPrivate); - Func("func", {Param("common_name", ty.f32())}, ty.void_(), {}); + GlobalVar("common_name", ty.f32(), ast::StorageClass::kPrivate); + Func("func", utils::Vector{Param("common_name", ty.f32())}, ty.void_(), utils::Empty); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -49,8 +49,10 @@ TEST_F(ResolverFunctionValidationTest, LocalConflictsWithParameter) { // fn func(common_name : f32) { // let common_name = 1i; // } - Func("func", {Param(Source{{12, 34}}, "common_name", ty.f32())}, ty.void_(), - {Decl(Let(Source{{56, 78}}, "common_name", nullptr, Expr(1_i)))}); + Func("func", utils::Vector{Param(Source{{12, 34}}, "common_name", ty.f32())}, ty.void_(), + utils::Vector{ + Decl(Let(Source{{56, 78}}, "common_name", Expr(1_i))), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(56:78 error: redeclaration of 'common_name' @@ -59,12 +61,14 @@ TEST_F(ResolverFunctionValidationTest, LocalConflictsWithParameter) { TEST_F(ResolverFunctionValidationTest, NestedLocalMayShadowParameter) { // fn func(common_name : f32) { - // { + // utils::Vector { // let common_name = 1i; // } // } - Func("func", {Param(Source{{12, 34}}, "common_name", ty.f32())}, ty.void_(), - {Block(Decl(Let(Source{{56, 78}}, "common_name", nullptr, Expr(1_i))))}); + Func("func", utils::Vector{Param(Source{{12, 34}}, "common_name", ty.f32())}, ty.void_(), + utils::Vector{ + Block(Decl(Let(Source{{56, 78}}, "common_name", Expr(1_i)))), + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -73,8 +77,8 @@ TEST_F(ResolverFunctionValidationTest, VoidFunctionEndWithoutReturnStatement_Pas // fn func { var a:i32 = 2i; } auto* var = Var("a", ty.i32(), Expr(2_i)); - Func(Source{{12, 34}}, "func", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func(Source{{12, 34}}, "func", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), }); @@ -88,12 +92,11 @@ TEST_F(ResolverFunctionValidationTest, FunctionUsingSameVariableName_Pass) { // } auto* var = Var("func", ty.i32(), Expr(0_i)); - Func("func", ast::VariableList{}, ty.i32(), - ast::StatementList{ + Func("func", utils::Empty, ty.i32(), + utils::Vector{ Decl(var), Return(Source{{12, 34}}, Expr("func")), - }, - ast::AttributeList{}); + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -103,17 +106,15 @@ TEST_F(ResolverFunctionValidationTest, FunctionNameSameAsFunctionScopeVariableNa // fn b() -> i32 { return 2; } auto* var = Var("b", ty.i32(), Expr(0_i)); - Func("a", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("a", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), - }, - ast::AttributeList{}); + }); - Func(Source{{12, 34}}, "b", ast::VariableList{}, ty.i32(), - ast::StatementList{ + Func(Source{{12, 34}}, "b", utils::Empty, ty.i32(), + utils::Vector{ Return(2_i), - }, - ast::AttributeList{}); + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -129,7 +130,7 @@ TEST_F(ResolverFunctionValidationTest, UnreachableCode_return) { auto* ret = Return(); auto* assign_a = Assign(Source{{12, 34}}, "a", 2_i); - Func("func", ast::VariableList{}, ty.void_(), {decl_a, ret, assign_a}); + Func("func", utils::Empty, ty.void_(), utils::Vector{decl_a, ret, assign_a}); ASSERT_TRUE(r()->Resolve()); @@ -142,7 +143,7 @@ TEST_F(ResolverFunctionValidationTest, UnreachableCode_return) { TEST_F(ResolverFunctionValidationTest, UnreachableCode_return_InBlocks) { // fn func() -> { // var a : i32; - // {{{return;}}} + // utils::Vector {{{return;}}} // a = 2i; //} @@ -150,7 +151,8 @@ TEST_F(ResolverFunctionValidationTest, UnreachableCode_return_InBlocks) { auto* ret = Return(); auto* assign_a = Assign(Source{{12, 34}}, "a", 2_i); - Func("func", ast::VariableList{}, ty.void_(), {decl_a, Block(Block(Block(ret))), assign_a}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{decl_a, Block(Block(Block(ret))), assign_a}); ASSERT_TRUE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 warning: code is unreachable"); @@ -170,7 +172,7 @@ TEST_F(ResolverFunctionValidationTest, UnreachableCode_discard) { auto* discard = Discard(); auto* assign_a = Assign(Source{{12, 34}}, "a", 2_i); - Func("func", ast::VariableList{}, ty.void_(), {decl_a, discard, assign_a}); + Func("func", utils::Empty, ty.void_(), utils::Vector{decl_a, discard, assign_a}); ASSERT_TRUE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 warning: code is unreachable"); @@ -182,7 +184,7 @@ TEST_F(ResolverFunctionValidationTest, UnreachableCode_discard) { TEST_F(ResolverFunctionValidationTest, UnreachableCode_discard_InBlocks) { // fn func() -> { // var a : i32; - // {{{discard;}}} + // utils::Vector {{{discard;}}} // a = 2i; //} @@ -190,7 +192,8 @@ TEST_F(ResolverFunctionValidationTest, UnreachableCode_discard_InBlocks) { auto* discard = Discard(); auto* assign_a = Assign(Source{{12, 34}}, "a", 2_i); - Func("func", ast::VariableList{}, ty.void_(), {decl_a, Block(Block(Block(discard))), assign_a}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{decl_a, Block(Block(Block(discard))), assign_a}); ASSERT_TRUE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 warning: code is unreachable"); @@ -204,11 +207,10 @@ TEST_F(ResolverFunctionValidationTest, FunctionEndWithoutReturnStatement_Fail) { auto* var = Var("a", ty.i32(), Expr(2_i)); - Func(Source{{12, 34}}, "func", ast::VariableList{}, ty.i32(), - ast::StatementList{ + Func(Source{{12, 34}}, "func", utils::Empty, ty.i32(), + utils::Vector{ Decl(var), - }, - ast::AttributeList{}); + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: missing return at end of function"); @@ -217,7 +219,7 @@ TEST_F(ResolverFunctionValidationTest, FunctionEndWithoutReturnStatement_Fail) { TEST_F(ResolverFunctionValidationTest, VoidFunctionEndWithoutReturnStatementEmptyBody_Pass) { // fn func {} - Func(Source{{12, 34}}, "func", ast::VariableList{}, ty.void_(), ast::StatementList{}); + Func(Source{{12, 34}}, "func", utils::Empty, ty.void_(), utils::Empty); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -225,8 +227,7 @@ TEST_F(ResolverFunctionValidationTest, VoidFunctionEndWithoutReturnStatementEmpt TEST_F(ResolverFunctionValidationTest, FunctionEndWithoutReturnStatementEmptyBody_Fail) { // fn func() -> int {} - Func(Source{{12, 34}}, "func", ast::VariableList{}, ty.i32(), ast::StatementList{}, - ast::AttributeList{}); + Func(Source{{12, 34}}, "func", utils::Empty, ty.i32(), utils::Empty); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: missing return at end of function"); @@ -235,34 +236,62 @@ TEST_F(ResolverFunctionValidationTest, FunctionEndWithoutReturnStatementEmptyBod TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementType_Pass) { // fn func { return; } - Func("func", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("func", utils::Empty, ty.void_(), + utils::Vector{ Return(), }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementType_fail) { - // fn func { return 2i; } - Func("func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Return(Source{{12, 34}}, Expr(2_i)), - }, - ast::AttributeList{}); +TEST_F(ResolverFunctionValidationTest, VoidFunctionReturnsAInt) { + // fn func { return 2; } + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + Return(Source{{12, 34}}, Expr(2_a)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: return statement type must match its function return " - "type, returned 'i32', expected 'void'"); + "12:34 error: return statement type must match its function return type, returned " + "'abstract-int', expected 'void'"); +} + +TEST_F(ResolverFunctionValidationTest, VoidFunctionReturnsAFloat) { + // fn func { return 2.0; } + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + Return(Source{{12, 34}}, Expr(2.0_a)), + }); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "12:34 error: return statement type must match its function return type, returned " + "'abstract-float', expected 'void'"); +} + +TEST_F(ResolverFunctionValidationTest, VoidFunctionReturnsI32) { + // fn func { return 2i; } + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + Return(Source{{12, 34}}, Expr(2_i)), + }); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "12:34 error: return statement type must match its function return type, returned " + "'i32', expected 'void'"); } TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementType_void_fail) { // fn v { return; } // fn func { return v(); } - Func("v", {}, ty.void_(), {Return()}); - Func("func", {}, ty.void_(), - { + Func("v", utils::Empty, ty.void_(), + utils::Vector{ + Return(), + }); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ Return(Call(Source{{12, 34}}, "v")), }); @@ -272,52 +301,48 @@ TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementType_ TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeMissing_fail) { // fn func() -> f32 { return; } - Func("func", ast::VariableList{}, ty.f32(), - ast::StatementList{ + Func("func", utils::Empty, ty.f32(), + utils::Vector{ Return(Source{{12, 34}}, nullptr), - }, - ast::AttributeList{}); + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: return statement type must match its function return " - "type, returned 'void', expected 'f32'"); + "12:34 error: return statement type must match its function return type, returned " + "'void', expected 'f32'"); } TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF32_pass) { // fn func() -> f32 { return 2.0; } - Func("func", ast::VariableList{}, ty.f32(), - ast::StatementList{ - Return(Source{{12, 34}}, Expr(2.f)), - }, - ast::AttributeList{}); + Func("func", utils::Empty, ty.f32(), + utils::Vector{ + Return(Source{{12, 34}}, Expr(2_f)), + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF32_fail) { // fn func() -> f32 { return 2i; } - Func("func", ast::VariableList{}, ty.f32(), - ast::StatementList{ + Func("func", utils::Empty, ty.f32(), + utils::Vector{ Return(Source{{12, 34}}, Expr(2_i)), - }, - ast::AttributeList{}); + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: return statement type must match its function return " - "type, returned 'i32', expected 'f32'"); + "12:34 error: return statement type must match its function return type, returned " + "'i32', expected 'f32'"); } TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF32Alias_pass) { // type myf32 = f32; // fn func() -> myf32 { return 2.0; } auto* myf32 = Alias("myf32", ty.f32()); - Func("func", ast::VariableList{}, ty.Of(myf32), - ast::StatementList{ - Return(Source{{12, 34}}, Expr(2.f)), - }, - ast::AttributeList{}); + Func("func", utils::Empty, ty.Of(myf32), + utils::Vector{ + Return(Source{{12, 34}}, Expr(2_f)), + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -326,44 +351,58 @@ TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF // type myf32 = f32; // fn func() -> myf32 { return 2u; } auto* myf32 = Alias("myf32", ty.f32()); - Func("func", ast::VariableList{}, ty.Of(myf32), - ast::StatementList{ + Func("func", utils::Empty, ty.Of(myf32), + utils::Vector{ Return(Source{{12, 34}}, Expr(2_u)), - }, - ast::AttributeList{}); + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: return statement type must match its function return " - "type, returned 'u32', expected 'f32'"); + "12:34 error: return statement type must match its function return type, returned " + "'u32', expected 'f32'"); } TEST_F(ResolverFunctionValidationTest, CannotCallEntryPoint) { - // @stage(compute) @workgroup_size(1) fn entrypoint() {} + // @compute @workgroup_size(1) fn entrypoint() {} // fn func() { return entrypoint(); } - Func("entrypoint", ast::VariableList{}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + Func("entrypoint", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); - Func("func", ast::VariableList{}, ty.void_(), - { + Func("func", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call(Source{{12, 34}}, "entrypoint")), }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - R"(12:34 error: entry point functions cannot be the target of a function call)"); } +TEST_F(ResolverFunctionValidationTest, CannotCallFunctionAtModuleScope) { + // fn F() -> i32 { return 1; } + // var x = F(); + Func("F", utils::Empty, ty.i32(), + utils::Vector{ + Return(1_i), + }); + GlobalVar("x", Call(Source{{12, 34}}, "F"), ast::StorageClass::kPrivate); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(12:34 error: functions cannot be called at module-scope)"); +} + TEST_F(ResolverFunctionValidationTest, PipelineStage_MustBeUnique_Fail) { - // @stage(fragment) - // @stage(vertex) + // @fragment + // @vertex // fn main() { return; } - Func(Source{{12, 34}}, "main", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(), + utils::Vector{ Return(), }, - ast::AttributeList{ + utils::Vector{ Stage(Source{{12, 34}}, ast::PipelineStage::kVertex), Stage(Source{{56, 78}}, ast::PipelineStage::kFragment), }); @@ -375,11 +414,10 @@ TEST_F(ResolverFunctionValidationTest, PipelineStage_MustBeUnique_Fail) { } TEST_F(ResolverFunctionValidationTest, NoPipelineEntryPoints) { - Func("vtx_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("vtx_func", utils::Empty, ty.void_(), + utils::Vector{ Return(), - }, - ast::AttributeList{}); + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -392,8 +430,10 @@ TEST_F(ResolverFunctionValidationTest, FunctionVarInitWithParam) { auto* bar = Param("bar", ty.f32()); auto* baz = Var("baz", ty.f32(), Expr("bar")); - Func("foo", ast::VariableList{bar}, ty.void_(), ast::StatementList{Decl(baz)}, - ast::AttributeList{}); + Func("foo", utils::Vector{bar}, ty.void_(), + utils::Vector{ + Decl(baz), + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -406,32 +446,38 @@ TEST_F(ResolverFunctionValidationTest, FunctionConstInitWithParam) { auto* bar = Param("bar", ty.f32()); auto* baz = Let("baz", ty.f32(), Expr("bar")); - Func("foo", ast::VariableList{bar}, ty.void_(), ast::StatementList{Decl(baz)}, - ast::AttributeList{}); + Func("foo", utils::Vector{bar}, ty.void_(), + utils::Vector{ + Decl(baz), + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverFunctionValidationTest, FunctionParamsConst) { - Func("foo", {Param(Sym("arg"), ty.i32())}, ty.void_(), - {Assign(Expr(Source{{12, 34}}, "arg"), Expr(1_i)), Return()}); + Func("foo", utils::Vector{Param(Sym("arg"), ty.i32())}, ty.void_(), + utils::Vector{ + Assign(Expr(Source{{12, 34}}, "arg"), Expr(1_i)), + Return(), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: cannot assign to function parameter\nnote: 'arg' is " - "declared here:"); + "12:34 error: cannot assign to function parameter\nnote: 'arg' is declared here:"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_ConstU32) { - // let x = 4u; - // let x = 8u; - // @stage(compute) @workgroup_size(x, y, 16u) + // const x = 4u; + // const x = 8u; + // @compute @workgroup_size(x, y, 16u) // fn main() {} auto* x = GlobalConst("x", ty.u32(), Expr(4_u)); auto* y = GlobalConst("y", ty.u32(), Expr(8_u)); - auto* func = Func( - "main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(Expr("x"), Expr("y"), Expr(16_u))}); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize("x", "y", 16_u), + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -443,177 +489,258 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_ConstU32) { ASSERT_NE(sem_x, nullptr); ASSERT_NE(sem_y, nullptr); - EXPECT_TRUE(sem_func->DirectlyReferencedGlobals().contains(sem_x)); - EXPECT_TRUE(sem_func->DirectlyReferencedGlobals().contains(sem_y)); + EXPECT_TRUE(sem_func->DirectlyReferencedGlobals().Contains(sem_x)); + EXPECT_TRUE(sem_func->DirectlyReferencedGlobals().Contains(sem_y)); } -TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32) { - // @stage(compute) @workgroup_size(1u, 2u, 3u) +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32) { + // @compute @workgroup_size(1i, 2i, 3i) // fn main() {} - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Source{{12, 34}}, Expr(1_u), Expr(2_u), Expr(3_u))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, 1_i, 2_i, 3_i), + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchTypeU32) { - // @stage(compute) @workgroup_size(1u, 2u, 3_i) +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32) { + // @compute @workgroup_size(1u, 2u, 3u) // fn main() {} - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr(1_u), Expr(2_u), Expr(Source{{12, 34}}, 3_i))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, 1_u, 2_u, 3_u), + }); - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: workgroup_size arguments must be of the same type, " - "either i32 or u32"); + ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchTypeI32) { - // @stage(compute) @workgroup_size(1_i, 2u, 3_i) +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_I32_AInt) { + // @compute @workgroup_size(1, 2i, 3) // fn main() {} - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr(1_i), Expr(Source{{12, 34}}, 2_u), Expr(3_i))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, 1_a, 2_i, 3_a), + }); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_GoodType_U32_AInt) { + // @compute @workgroup_size(1u, 2, 3u) + // fn main() {} + + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, 1_u, 2_a, 3_u), + }); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Expr) { + // @compute @workgroup_size(1 + 2) + // fn main() {} + + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, Add(1_u, 2_u)), + }); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_U32) { + // @compute @workgroup_size(1u, 2, 3_i) + // fn main() {} + + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, 1_u, 2_a, 3_i), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: workgroup_size arguments must be of the same type, " - "either i32 or u32"); + "12:34 error: workgroup_size arguments must be of the same type, either i32 or u32"); +} + +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_MismatchType_I32) { + // @compute @workgroup_size(1_i, 2u, 3) + // fn main() {} + + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, 1_i, 2_u, 3_a), + }); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "12:34 error: workgroup_size arguments must be of the same type, either i32 or u32"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch) { - // let x = 64u; - // @stage(compute) @workgroup_size(1i, x) + // const x = 64u; + // @compute @workgroup_size(1i, x) // fn main() {} GlobalConst("x", ty.u32(), Expr(64_u)); - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr(1_i), Expr(Source{{12, 34}}, "x"))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, 1_i, "x"), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: workgroup_size arguments must be of the same type, " - "either i32 or u32"); + "12:34 error: workgroup_size arguments must be of the same type, either i32 or u32"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch2) { - // let x = 64u; - // let y = 32i; - // @stage(compute) @workgroup_size(x, y) + // const x = 64u; + // const y = 32i; + // @compute @workgroup_size(x, y) // fn main() {} GlobalConst("x", ty.u32(), Expr(64_u)); GlobalConst("y", ty.i32(), Expr(32_i)); - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr("x"), Expr(Source{{12, 34}}, "y"))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, "x", "y"), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: workgroup_size arguments must be of the same type, " - "either i32 or u32"); + "12:34 error: workgroup_size arguments must be of the same type, either i32 or u32"); } + TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Mismatch_ConstU32) { - // let x = 4u; - // let x = 8u; - // @stage(compute) @workgroup_size(x, y, 16i) + // const x = 4u; + // const x = 8u; + // @compute @workgroup_size(x, y, 16i) // fn main() {} GlobalConst("x", ty.u32(), Expr(4_u)); GlobalConst("y", ty.u32(), Expr(8_u)); - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Expr("x"), Expr("y"), Expr(Source{{12, 34}}, 16_i))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Source{{12, 34}}, "x", "y", 16_i), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: workgroup_size arguments must be of the same type, " - "either i32 or u32"); + "12:34 error: workgroup_size arguments must be of the same type, either i32 or u32"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) { - // @stage(compute) @workgroup_size(64.0) + // @compute @workgroup_size(64.0) // fn main() {} - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(Expr(Source{{12, 34}}, 64.f))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{{12, 34}}, 64_f)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: workgroup_size argument must be either literal or " - "module-scope constant of type i32 or u32"); + "12:34 error: workgroup_size argument must be either a literal, constant, or " + "overridable of type abstract-integer, i32 or u32"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Negative) { - // @stage(compute) @workgroup_size(-2i) + // @compute @workgroup_size(-2i) // fn main() {} - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(Expr(Source{{12, 34}}, i32(-2)))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{{12, 34}}, -2_i)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: workgroup_size argument must be at least 1"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Zero) { - // @stage(compute) @workgroup_size(0i) + // @compute @workgroup_size(0i) // fn main() {} - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(Expr(Source{{12, 34}}, 0_i))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{{12, 34}}, 0_i)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: workgroup_size argument must be at least 1"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_BadType) { - // let x = 64.0; - // @stage(compute) @workgroup_size(x) + // const x = 64.0; + // @compute @workgroup_size(x) // fn main() {} - GlobalConst("x", ty.f32(), Expr(64.f)); - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(Expr(Source{{12, 34}}, "x"))}); + GlobalConst("x", ty.f32(), Expr(64_f)); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{{12, 34}}, "x")), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: workgroup_size argument must be either literal or " - "module-scope constant of type i32 or u32"); + "12:34 error: workgroup_size argument must be either a literal, constant, or " + "overridable of type abstract-integer, i32 or u32"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Negative) { - // let x = -2i; - // @stage(compute) @workgroup_size(x) + // const x = -2i; + // @compute @workgroup_size(x) // fn main() {} - GlobalConst("x", ty.i32(), Expr(i32(-2))); - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(Expr(Source{{12, 34}}, "x"))}); + GlobalConst("x", ty.i32(), Expr(-2_i)); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{{12, 34}}, "x")), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: workgroup_size argument must be at least 1"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Zero) { - // let x = 0i; - // @stage(compute) @workgroup_size(x) + // const x = 0i; + // @compute @workgroup_size(x) // fn main() {} GlobalConst("x", ty.i32(), Expr(0_i)); - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(Expr(Source{{12, 34}}, "x"))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{{12, 34}}, "x")), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: workgroup_size argument must be at least 1"); } TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_NestedZeroValueConstructor) { - // let x = i32(i32(i32())); - // @stage(compute) @workgroup_size(x) + // const x = i32(i32(i32())); + // @compute @workgroup_size(x) // fn main() {} GlobalConst("x", ty.i32(), Construct(ty.i32(), Construct(ty.i32(), Construct(ty.i32())))); - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(Expr(Source{{12, 34}}, "x"))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{{12, 34}}, "x")), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: workgroup_size argument must be at least 1"); @@ -621,34 +748,69 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_NestedZeroValueConstr TEST_F(ResolverFunctionValidationTest, WorkgroupSize_NonConst) { // var x = 64i; - // @stage(compute) @workgroup_size(x) + // @compute @workgroup_size(x) // fn main() {} - Global("x", ty.i32(), ast::StorageClass::kPrivate, Expr(64_i)); - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(Expr(Source{{12, 34}}, "x"))}); + GlobalVar("x", ty.i32(), ast::StorageClass::kPrivate, Expr(64_i)); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Expr(Source{{12, 34}}, "x")), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: workgroup_size argument must be either literal or " - "module-scope constant of type i32 or u32"); + "12:34 error: workgroup_size argument must be either a literal, constant, or " + "overridable of type abstract-integer, i32 or u32"); } -TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr) { - // @stage(compute) @workgroup_size(i32(1)) +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr_x) { + // @compute @workgroup_size(1 << 2 + 4) // fn main() {} - Func("main", {}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), - WorkgroupSize(Construct(Source{{12, 34}}, ty.i32(), 1_i))}); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Construct(Source{{12, 34}}, ty.i32(), Shr(1_i, Add(2_u, 4_u)))), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: workgroup_size argument must be either a literal or " - "a module-scope constant"); + "12:34 error: workgroup_size argument must be either a literal, constant, or " + "overridable of type abstract-integer, i32 or u32"); +} + +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr_y) { + // @compute @workgroup_size(1, 1 << 2 + 4) + // fn main() {} + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Construct(Source{{12, 34}}, ty.i32(), Shr(1_i, Add(2_u, 4_u)))), + }); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "12:34 error: workgroup_size argument must be either a literal, constant, or " + "overridable of type abstract-integer, i32 or u32"); +} + +TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr_z) { + // @compute @workgroup_size(1, 1, 1 << 2 + 4) + // fn main() {} + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(Construct(Source{{12, 34}}, ty.i32(), Shr(1_i, Add(2_u, 4_u)))), + }); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "12:34 error: workgroup_size argument must be either a literal, constant, or " + "overridable of type abstract-integer, i32 or u32"); } TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_NonPlain) { auto* ret_type = ty.pointer(Source{{12, 34}}, ty.i32(), ast::StorageClass::kFunction); - Func("f", {}, ret_type, {}); + Func("f", utils::Empty, ret_type, utils::Empty); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type"); @@ -656,7 +818,7 @@ TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_NonPlain) { TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_AtomicInt) { auto* ret_type = ty.atomic(Source{{12, 34}}, ty.i32()); - Func("f", {}, ret_type, {}); + Func("f", utils::Empty, ret_type, utils::Empty); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type"); @@ -664,16 +826,18 @@ TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_AtomicInt) { TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_ArrayOfAtomic) { auto* ret_type = ty.array(Source{{12, 34}}, ty.atomic(ty.i32()), 10_u); - Func("f", {}, ret_type, {}); + Func("f", utils::Empty, ret_type, utils::Empty); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type"); } TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_StructOfAtomic) { - Structure("S", {Member("m", ty.atomic(ty.i32()))}); + Structure("S", utils::Vector{ + Member("m", ty.atomic(ty.i32())), + }); auto* ret_type = ty.type_name(Source{{12, 34}}, "S"); - Func("f", {}, ret_type, {}); + Func("f", utils::Empty, ret_type, utils::Empty); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type"); @@ -681,49 +845,51 @@ TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_StructOfAtomic) { TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_RuntimeArray) { auto* ret_type = ty.array(Source{{12, 34}}, ty.i32()); - Func("f", {}, ret_type, {}); + Func("f", utils::Empty, ret_type, utils::Empty); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type"); } TEST_F(ResolverFunctionValidationTest, ParameterStoreType_NonAtomicFree) { - Structure("S", {Member("m", ty.atomic(ty.i32()))}); + Structure("S", utils::Vector{ + Member("m", ty.atomic(ty.i32())), + }); auto* ret_type = ty.type_name(Source{{12, 34}}, "S"); auto* bar = Param(Source{{12, 34}}, "bar", ret_type); - Func("f", ast::VariableList{bar}, ty.void_(), {}); + Func("f", utils::Vector{bar}, ty.void_(), utils::Empty); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: store type of function parameter must be a " - "constructible type"); + EXPECT_EQ(r()->error(), "12:34 error: type of function parameter must be constructible"); } TEST_F(ResolverFunctionValidationTest, ParameterSotreType_AtomicFree) { - Structure("S", {Member("m", ty.i32())}); + Structure("S", utils::Vector{ + Member("m", ty.i32()), + }); auto* ret_type = ty.type_name(Source{{12, 34}}, "S"); auto* bar = Param(Source{{12, 34}}, "bar", ret_type); - Func("f", ast::VariableList{bar}, ty.void_(), {}); + Func("f", utils::Vector{bar}, ty.void_(), utils::Empty); ASSERT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverFunctionValidationTest, ParametersAtLimit) { - ast::VariableList params; + utils::Vector params; for (int i = 0; i < 255; i++) { - params.emplace_back(Param("param_" + std::to_string(i), ty.i32())); + params.Push(Param("param_" + std::to_string(i), ty.i32())); } - Func(Source{{12, 34}}, "f", params, ty.void_(), {}); + Func(Source{{12, 34}}, "f", params, ty.void_(), utils::Empty); ASSERT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverFunctionValidationTest, ParametersOverLimit) { - ast::VariableList params; + utils::Vector params; for (int i = 0; i < 256; i++) { - params.emplace_back(Param("param_" + std::to_string(i), ty.i32())); + params.Push(Param("param_" + std::to_string(i), ty.i32())); } - Func(Source{{12, 34}}, "f", params, ty.void_(), {}); + Func(Source{{12, 34}}, "f", params, ty.void_(), utils::Empty); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: functions may declare at most 255 parameters"); @@ -732,8 +898,9 @@ TEST_F(ResolverFunctionValidationTest, ParametersOverLimit) { TEST_F(ResolverFunctionValidationTest, ParameterVectorNoType) { // fn f(p : vec3) {} - Func(Source{{12, 34}}, "f", {Param("p", create(Source{{12, 34}}, nullptr, 3))}, - ty.void_(), {}); + Func(Source{{12, 34}}, "f", + utils::Vector{Param("p", create(Source{{12, 34}}, nullptr, 3u))}, ty.void_(), + utils::Empty); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: missing vector element type"); @@ -742,8 +909,9 @@ TEST_F(ResolverFunctionValidationTest, ParameterVectorNoType) { TEST_F(ResolverFunctionValidationTest, ParameterMatrixNoType) { // fn f(p : vec3) {} - Func(Source{{12, 34}}, "f", {Param("p", create(Source{{12, 34}}, nullptr, 3, 3))}, - ty.void_(), {}); + Func(Source{{12, 34}}, "f", + utils::Vector{Param("p", create(Source{{12, 34}}, nullptr, 3u, 3u))}, + ty.void_(), utils::Empty); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type"); @@ -761,7 +929,7 @@ TEST_P(ResolverFunctionParameterValidationTest, StorageClass) { auto& param = GetParam(); auto* ptr_type = ty.pointer(Source{{12, 34}}, ty.i32(), param.storage_class); auto* arg = Param(Source{{12, 34}}, "p", ptr_type); - Func("f", ast::VariableList{arg}, ty.void_(), {}); + Func("f", utils::Vector{arg}, ty.void_(), utils::Empty); if (param.should_pass) { ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -776,8 +944,8 @@ TEST_P(ResolverFunctionParameterValidationTest, StorageClass) { INSTANTIATE_TEST_SUITE_P(ResolverTest, ResolverFunctionParameterValidationTest, testing::Values(TestParams{ast::StorageClass::kNone, false}, - TestParams{ast::StorageClass::kInput, false}, - TestParams{ast::StorageClass::kOutput, false}, + TestParams{ast::StorageClass::kIn, false}, + TestParams{ast::StorageClass::kOut, false}, TestParams{ast::StorageClass::kUniform, false}, TestParams{ast::StorageClass::kWorkgroup, true}, TestParams{ast::StorageClass::kHandle, false}, diff --git a/src/tint/resolver/host_shareable_validation_test.cc b/src/tint/resolver/host_shareable_validation_test.cc index 01fbfb0a58..b9831cc23b 100644 --- a/src/tint/resolver/host_shareable_validation_test.cc +++ b/src/tint/resolver/host_shareable_validation_test.cc @@ -24,13 +24,10 @@ namespace { using ResolverHostShareableValidationTest = ResolverTest; TEST_F(ResolverHostShareableValidationTest, BoolMember) { - auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.bool_())}); + auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "x", ty.bool_())}); - Global(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, + Binding(0), Group(0)); ASSERT_FALSE(r()->Resolve()); @@ -38,17 +35,14 @@ TEST_F(ResolverHostShareableValidationTest, BoolMember) { r()->error(), R"(56:78 error: Type 'bool' cannot be used in storage class 'storage' as it is non-host-shareable 12:34 note: while analysing structure member S.x -56:78 note: while instantiating variable g)"); +56:78 note: while instantiating 'var' g)"); } TEST_F(ResolverHostShareableValidationTest, BoolVectorMember) { - auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.vec3())}); + auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "x", ty.vec3())}); - Global(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, + Binding(0), Group(0)); ASSERT_FALSE(r()->Resolve()); @@ -56,18 +50,15 @@ TEST_F(ResolverHostShareableValidationTest, BoolVectorMember) { r()->error(), R"(56:78 error: Type 'vec3' cannot be used in storage class 'storage' as it is non-host-shareable 12:34 note: while analysing structure member S.x -56:78 note: while instantiating variable g)"); +56:78 note: while instantiating 'var' g)"); } TEST_F(ResolverHostShareableValidationTest, Aliases) { auto* a1 = Alias("a1", ty.bool_()); - auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.Of(a1))}); + auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "x", ty.Of(a1))}); auto* a2 = Alias("a2", ty.Of(s)); - Global(Source{{56, 78}}, "g", ty.Of(a2), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "g", ty.Of(a2), ast::StorageClass::kStorage, ast::Access::kRead, + Binding(0), Group(0)); ASSERT_FALSE(r()->Resolve()); @@ -75,21 +66,18 @@ TEST_F(ResolverHostShareableValidationTest, Aliases) { r()->error(), R"(56:78 error: Type 'bool' cannot be used in storage class 'storage' as it is non-host-shareable 12:34 note: while analysing structure member S.x -56:78 note: while instantiating variable g)"); +56:78 note: while instantiating 'var' g)"); } TEST_F(ResolverHostShareableValidationTest, NestedStructures) { - auto* i1 = Structure("I1", {Member(Source{{1, 2}}, "x", ty.bool_())}); - auto* i2 = Structure("I2", {Member(Source{{3, 4}}, "y", ty.Of(i1))}); - auto* i3 = Structure("I3", {Member(Source{{5, 6}}, "z", ty.Of(i2))}); + auto* i1 = Structure("I1", utils::Vector{Member(Source{{1, 2}}, "x", ty.bool_())}); + auto* i2 = Structure("I2", utils::Vector{Member(Source{{3, 4}}, "y", ty.Of(i1))}); + auto* i3 = Structure("I3", utils::Vector{Member(Source{{5, 6}}, "z", ty.Of(i2))}); - auto* s = Structure("S", {Member(Source{{7, 8}}, "m", ty.Of(i3))}); + auto* s = Structure("S", utils::Vector{Member(Source{{7, 8}}, "m", ty.Of(i3))}); - Global(Source{{9, 10}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{9, 10}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, + Binding(0), Group(0)); ASSERT_FALSE(r()->Resolve()); @@ -100,35 +88,35 @@ TEST_F(ResolverHostShareableValidationTest, NestedStructures) { 3:4 note: while analysing structure member I2.y 5:6 note: while analysing structure member I3.z 7:8 note: while analysing structure member S.m -9:10 note: while instantiating variable g)"); +9:10 note: while instantiating 'var' g)"); } TEST_F(ResolverHostShareableValidationTest, NoError) { - auto* i1 = Structure("I1", { - Member(Source{{1, 1}}, "x1", ty.f32()), - Member(Source{{2, 1}}, "y1", ty.vec3()), - Member(Source{{3, 1}}, "z1", ty.array()), + Enable(ast::Extension::kF16); + + auto* i1 = Structure("I1", utils::Vector{ + Member(Source{{1, 1}}, "w1", ty.f32()), + Member(Source{{2, 1}}, "x1", ty.f32()), + Member(Source{{3, 1}}, "y1", ty.vec3()), + Member(Source{{4, 1}}, "z1", ty.array()), }); auto* a1 = Alias("a1", ty.Of(i1)); - auto* i2 = Structure("I2", { - Member(Source{{4, 1}}, "x2", ty.mat2x2()), - Member(Source{{5, 1}}, "y2", ty.Of(i1)), + auto* i2 = Structure("I2", utils::Vector{ + Member(Source{{5, 1}}, "x2", ty.mat2x2()), + Member(Source{{6, 1}}, "w2", ty.mat3x4()), + Member(Source{{7, 1}}, "z2", ty.Of(i1)), }); auto* a2 = Alias("a2", ty.Of(i2)); - auto* i3 = Structure("I3", { + auto* i3 = Structure("I3", utils::Vector{ Member(Source{{4, 1}}, "x3", ty.Of(a1)), Member(Source{{5, 1}}, "y3", ty.Of(i2)), Member(Source{{6, 1}}, "z3", ty.Of(a2)), }); - auto* s = Structure("S", {Member(Source{{7, 8}}, "m", ty.Of(i3))}); + auto* s = Structure("S", utils::Vector{Member(Source{{7, 8}}, "m", ty.Of(i3))}); - Global(Source{{9, 10}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); - WrapInFunction(); + GlobalVar(Source{{9, 10}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, + Binding(0), Group(0)); ASSERT_TRUE(r()->Resolve()) << r()->error(); } diff --git a/src/tint/resolver/increment_decrement_validation_test.cc b/src/tint/resolver/increment_decrement_validation_test.cc index 37033c5aa0..87d7bafbbc 100644 --- a/src/tint/resolver/increment_decrement_validation_test.cc +++ b/src/tint/resolver/increment_decrement_validation_test.cc @@ -27,7 +27,7 @@ using ResolverIncrementDecrementValidationTest = ResolverTest; TEST_F(ResolverIncrementDecrementValidationTest, Increment_Signed) { // var a : i32 = 2; // a++; - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* var = Var("a", ty.i32(), Expr(2_i)); WrapInFunction(var, Increment(Source{{12, 34}}, "a")); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -36,7 +36,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, Increment_Signed) { TEST_F(ResolverIncrementDecrementValidationTest, Decrement_Signed) { // var a : i32 = 2; // a--; - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* var = Var("a", ty.i32(), Expr(2_i)); WrapInFunction(var, Decrement(Source{{12, 34}}, "a")); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -45,7 +45,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, Decrement_Signed) { TEST_F(ResolverIncrementDecrementValidationTest, Increment_Unsigned) { // var a : u32 = 2u; // a++; - auto* var = Var("a", ty.u32(), ast::StorageClass::kNone, Expr(2_u)); + auto* var = Var("a", ty.u32(), Expr(2_u)); WrapInFunction(var, Increment(Source{{12, 34}}, "a")); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -54,7 +54,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, Increment_Unsigned) { TEST_F(ResolverIncrementDecrementValidationTest, Decrement_Unsigned) { // var a : u32 = 2u; // a--; - auto* var = Var("a", ty.u32(), ast::StorageClass::kNone, Expr(2_u)); + auto* var = Var("a", ty.u32(), Expr(2_u)); WrapInFunction(var, Decrement(Source{{12, 34}}, "a")); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -74,7 +74,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, ThroughPointer) { TEST_F(ResolverIncrementDecrementValidationTest, ThroughArray) { // var a : array; // a[1i]++; - auto* var_a = Var("a", ty.array(ty.i32(), 4_u), ast::StorageClass::kNone); + auto* var_a = Var("a", ty.array(ty.i32(), 4_u)); WrapInFunction(var_a, Increment(Source{{12, 34}}, IndexAccessor("a", 1_i))); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -83,7 +83,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, ThroughArray) { TEST_F(ResolverIncrementDecrementValidationTest, ThroughVector_Index) { // var a : vec4; // a[1i]++; - auto* var_a = Var("a", ty.vec4(ty.i32()), ast::StorageClass::kNone); + auto* var_a = Var("a", ty.vec4(ty.i32())); WrapInFunction(var_a, Increment(Source{{12, 34}}, IndexAccessor("a", 1_i))); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -92,7 +92,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, ThroughVector_Index) { TEST_F(ResolverIncrementDecrementValidationTest, ThroughVector_Member) { // var a : vec4; // a.y++; - auto* var_a = Var("a", ty.vec4(ty.i32()), ast::StorageClass::kNone); + auto* var_a = Var("a", ty.vec4(ty.i32())); WrapInFunction(var_a, Increment(Source{{12, 34}}, MemberAccessor("a", "y"))); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -101,7 +101,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, ThroughVector_Member) { TEST_F(ResolverIncrementDecrementValidationTest, Float) { // var a : f32 = 2.0; // a++; - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(2.f)); + auto* var = Var("a", ty.f32(), Expr(2_f)); auto* inc = Increment(Expr(Source{{12, 34}}, "a")); WrapInFunction(var, inc); @@ -114,7 +114,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, Float) { TEST_F(ResolverIncrementDecrementValidationTest, Vector) { // var a : vec4; // a++; - auto* var = Var("a", ty.vec4(), ast::StorageClass::kNone); + auto* var = Var("a", ty.vec4()); auto* inc = Increment(Expr(Source{{12, 34}}, "a")); WrapInFunction(var, inc); @@ -127,7 +127,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, Vector) { TEST_F(ResolverIncrementDecrementValidationTest, Atomic) { // var a : atomic; // a++; - Global(Source{{12, 34}}, "a", ty.atomic(ty.i32()), ast::StorageClass::kWorkgroup); + GlobalVar(Source{{12, 34}}, "a", ty.atomic(ty.i32()), ast::StorageClass::kWorkgroup); WrapInFunction(Increment(Expr(Source{{56, 78}}, "a"))); EXPECT_FALSE(r()->Resolve()); @@ -147,11 +147,11 @@ TEST_F(ResolverIncrementDecrementValidationTest, Literal) { TEST_F(ResolverIncrementDecrementValidationTest, Constant) { // let a = 1; // a++; - auto* a = Let(Source{{12, 34}}, "a", nullptr, Expr(1_i)); + auto* a = Let(Source{{12, 34}}, "a", Expr(1_i)); WrapInFunction(a, Increment(Expr(Source{{56, 78}}, "a"))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), R"(56:78 error: cannot modify constant value + EXPECT_EQ(r()->error(), R"(56:78 error: cannot modify 'let' 12:34 note: 'a' is declared here:)"); } @@ -161,7 +161,10 @@ TEST_F(ResolverIncrementDecrementValidationTest, Parameter) { // a++; // } auto* a = Param(Source{{12, 34}}, "a", ty.i32()); - Func("func", {a}, ty.void_(), {Increment(Expr(Source{{56, 78}}, "a"))}); + Func("func", utils::Vector{a}, ty.void_(), + utils::Vector{ + Increment(Expr(Source{{56, 78}}, "a")), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(56:78 error: cannot modify function parameter @@ -175,7 +178,10 @@ TEST_F(ResolverIncrementDecrementValidationTest, ReturnValue) { // { // a++; // } - Func("func", {}, ty.i32(), {Return(0_i)}); + Func("func", utils::Empty, ty.i32(), + utils::Vector{ + Return(0_i), + }); WrapInFunction(Increment(Call(Source{{56, 78}}, "func"))); EXPECT_FALSE(r()->Resolve()); @@ -187,8 +193,8 @@ TEST_F(ResolverIncrementDecrementValidationTest, ReadOnlyBuffer) { // { // a++; // } - Global(Source{{12, 34}}, "a", ty.i32(), ast::StorageClass::kStorage, ast::Access::kRead, - GroupAndBinding(0, 0)); + GlobalVar(Source{{12, 34}}, "a", ty.i32(), ast::StorageClass::kStorage, ast::Access::kRead, + Group(0), Binding(0)); WrapInFunction(Increment(Source{{56, 78}}, "a")); EXPECT_FALSE(r()->Resolve()); @@ -207,7 +213,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, InForLoopInit) { // for (a++; ; ) { // break; // } - auto* a = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* a = Var("a", ty.i32(), Expr(2_i)); auto* loop = For(Increment(Source{{56, 78}}, "a"), nullptr, nullptr, Block(Break())); WrapInFunction(a, loop); @@ -219,7 +225,7 @@ TEST_F(ResolverIncrementDecrementValidationTest, InForLoopCont) { // for (; ; a++) { // break; // } - auto* a = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* a = Var("a", ty.i32(), Expr(2_i)); auto* loop = For(nullptr, nullptr, Increment(Source{{56, 78}}, "a"), Block(Break())); WrapInFunction(a, loop); diff --git a/src/tint/resolver/inferred_type_test.cc b/src/tint/resolver/inferred_type_test.cc index d8cc649ffa..8ce611ee8a 100644 --- a/src/tint/resolver/inferred_type_test.cc +++ b/src/tint/resolver/inferred_type_test.cc @@ -75,30 +75,30 @@ Params all_cases[] = { using ResolverInferredTypeParamTest = ResolverTestWithParam; -TEST_P(ResolverInferredTypeParamTest, GlobalLet_Pass) { +TEST_P(ResolverInferredTypeParamTest, GlobalConst_Pass) { auto& params = GetParam(); auto* expected_type = params.create_expected_type(*this); - // let a = ; + // const a = ; auto* ctor_expr = params.create_value(*this, 0); - auto* var = GlobalConst("a", nullptr, ctor_expr); - WrapInFunction(); + auto* a = GlobalConst("a", ctor_expr); EXPECT_TRUE(r()->Resolve()) << r()->error(); - EXPECT_EQ(TypeOf(var), expected_type); + EXPECT_EQ(TypeOf(a), expected_type); } -TEST_P(ResolverInferredTypeParamTest, GlobalVar_Fail) { +TEST_P(ResolverInferredTypeParamTest, GlobalVar_Pass) { auto& params = GetParam(); + auto* expected_type = params.create_expected_type(*this); + // var a = ; auto* ctor_expr = params.create_value(*this, 0); - Global(Source{{12, 34}}, "a", nullptr, ast::StorageClass::kPrivate, ctor_expr); - WrapInFunction(); + auto* var = GlobalVar("a", ast::StorageClass::kPrivate, ctor_expr); - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: global var declaration must specify a type"); + EXPECT_TRUE(r()->Resolve()) << r()->error(); + EXPECT_EQ(TypeOf(var)->UnwrapRef(), expected_type); } TEST_P(ResolverInferredTypeParamTest, LocalLet_Pass) { @@ -108,7 +108,7 @@ TEST_P(ResolverInferredTypeParamTest, LocalLet_Pass) { // let a = ; auto* ctor_expr = params.create_value(*this, 0); - auto* var = Let("a", nullptr, ctor_expr); + auto* var = Let("a", ctor_expr); WrapInFunction(var); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -122,7 +122,7 @@ TEST_P(ResolverInferredTypeParamTest, LocalVar_Pass) { // var a = ; auto* ctor_expr = params.create_value(*this, 0); - auto* var = Var("a", nullptr, ast::StorageClass::kFunction, ctor_expr); + auto* var = Var("a", ast::StorageClass::kFunction, ctor_expr); WrapInFunction(var); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -136,7 +136,7 @@ TEST_F(ResolverInferredTypeTest, InferArray_Pass) { auto* expected_type = create(create(), 10u, 4u, 4u * 10u, 4u, 4u); auto* ctor_expr = Construct(type); - auto* var = Var("a", nullptr, ast::StorageClass::kFunction, ctor_expr); + auto* var = Var("a", ast::StorageClass::kFunction, ctor_expr); WrapInFunction(var); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -145,7 +145,7 @@ TEST_F(ResolverInferredTypeTest, InferArray_Pass) { TEST_F(ResolverInferredTypeTest, InferStruct_Pass) { auto* member = Member("x", ty.i32()); - auto* str = Structure("S", {member}); + auto* str = Structure("S", utils::Vector{member}); auto* expected_type = create(str, str->name, @@ -155,7 +155,7 @@ TEST_F(ResolverInferredTypeTest, InferStruct_Pass) { auto* ctor_expr = Construct(ty.Of(str)); - auto* var = Var("a", nullptr, ast::StorageClass::kFunction, ctor_expr); + auto* var = Var("a", ast::StorageClass::kFunction, ctor_expr); WrapInFunction(var); EXPECT_TRUE(r()->Resolve()) << r()->error(); diff --git a/src/tint/resolver/intrinsic_table.cc b/src/tint/resolver/intrinsic_table.cc index 7656e55429..0cd0abec37 100644 --- a/src/tint/resolver/intrinsic_table.cc +++ b/src/tint/resolver/intrinsic_table.cc @@ -19,7 +19,11 @@ #include #include +#include "src/tint/ast/binary_expression.h" #include "src/tint/program_builder.h" +#include "src/tint/sem/abstract_float.h" +#include "src/tint/sem/abstract_int.h" +#include "src/tint/sem/abstract_numeric.h" #include "src/tint/sem/atomic.h" #include "src/tint/sem/depth_multisampled_texture.h" #include "src/tint/sem/depth_texture.h" @@ -28,12 +32,14 @@ #include "src/tint/sem/pipeline_stage_set.h" #include "src/tint/sem/sampled_texture.h" #include "src/tint/sem/storage_texture.h" +#include "src/tint/sem/type_constructor.h" +#include "src/tint/sem/type_conversion.h" #include "src/tint/utils/hash.h" #include "src/tint/utils/map.h" #include "src/tint/utils/math.h" #include "src/tint/utils/scoped_assignment.h" -namespace tint { +namespace tint::resolver { namespace { // Forward declarations @@ -42,6 +48,12 @@ class Matchers; class NumberMatcher; class TypeMatcher; +/// The utils::Vector `N` template argument value for arrays of parameters. +constexpr static const size_t kNumFixedParams = 8; + +/// The utils::Vector `N` template argument value for arrays of overload candidates. +constexpr static const size_t kNumFixedCandidates = 8; + /// A special type that matches all TypeMatchers class Any final : public Castable { public: @@ -98,83 +110,102 @@ struct Number { const Number Number::any{Number::kAny}; const Number Number::invalid{Number::kInvalid}; -/// ClosedState holds the state of the open / closed numbers and types. +/// TemplateState holds the state of the template numbers and types. /// Used by the MatchState. -class ClosedState { +class TemplateState { public: - explicit ClosedState(ProgramBuilder& b) : builder(b) {} - - /// If the type with index `idx` is open, then it is closed with type `ty` and - /// Type() returns true. If the type is closed, then `Type()` returns true iff - /// it is equal to `ty`. - bool Type(uint32_t idx, const sem::Type* ty) { - auto res = types_.emplace(idx, ty); - return res.second || res.first->second == ty; + /// If the template type with index `idx` is undefined, then it is defined with the `ty` and + /// Type() returns `ty`. + /// If the template type is defined, and `ty` can be converted to the template type then the + /// template type is returned. + /// If the template type is defined, and the template type can be converted to `ty`, then the + /// template type is replaced with `ty`, and `ty` is returned. + /// If none of the above applies, then `ty` is a type mismatch for the template type, and + /// nullptr is returned. + const sem::Type* Type(size_t idx, const sem::Type* ty) { + if (idx >= types_.Length()) { + types_.Resize(idx + 1); + } + auto& t = types_[idx]; + if (t == nullptr) { + t = ty; + return ty; + } + ty = sem::Type::Common(utils::Vector{t, ty}); + if (ty) { + t = ty; + } + return ty; } - /// If the number with index `idx` is open, then it is closed with number - /// `number` and Num() returns true. If the number is closed, then `Num()` - /// returns true iff it is equal to `ty`. - bool Num(uint32_t idx, Number number) { - auto res = numbers_.emplace(idx, number.Value()); - return res.second || res.first->second == number.Value(); + /// If the number with index `idx` is undefined, then it is defined with the number `number` and + /// Num() returns true. If the number is defined, then `Num()` returns true iff it is equal to + /// `ty`. + bool Num(size_t idx, Number number) { + if (idx >= numbers_.Length()) { + numbers_.Resize(idx + 1, Number::invalid); + } + auto& n = numbers_[idx]; + if (!n.IsValid()) { + n = number.Value(); + return true; + } + return n.Value() == number.Value(); } - /// Type returns the closed type with index `idx`. - /// An ICE is raised if the type is not closed. - const sem::Type* Type(uint32_t idx) const { - auto it = types_.find(idx); - if (it == types_.end()) { - TINT_ICE(Resolver, builder.Diagnostics()) - << "type with index " << idx << " is not closed"; + /// Type returns the template type with index `idx`, or nullptr if the type was not defined. + const sem::Type* Type(size_t idx) const { + if (idx >= types_.Length()) { return nullptr; } - TINT_ASSERT(Resolver, it != types_.end()); - return it->second; + return types_[idx]; + } + + /// SetType replaces the template type with index `idx` with type `ty`. + void SetType(size_t idx, const sem::Type* ty) { + if (idx >= types_.Length()) { + types_.Resize(idx + 1); + } + types_[idx] = ty; } /// Type returns the number type with index `idx`. - /// An ICE is raised if the number is not closed. - Number Num(uint32_t idx) const { - auto it = numbers_.find(idx); - if (it == numbers_.end()) { - TINT_ICE(Resolver, builder.Diagnostics()) - << "number with index " << idx << " is not closed"; + Number Num(size_t idx) const { + if (idx >= numbers_.Length()) { return Number::invalid; } - return Number(it->second); + return numbers_[idx]; } private: - ProgramBuilder& builder; - std::unordered_map types_; - std::unordered_map numbers_; + utils::Vector types_; + utils::Vector numbers_; }; /// Index type used for matcher indices using MatcherIndex = uint8_t; -/// Index value used for open types / numbers that do not have a constraint +/// Index value used for template types / numbers that do not have a constraint constexpr MatcherIndex kNoMatcher = std::numeric_limits::max(); /// MatchState holds the state used to match an overload. class MatchState { public: MatchState(ProgramBuilder& b, - ClosedState& c, + TemplateState& t, const Matchers& m, - const OverloadInfo& o, + const OverloadInfo* o, MatcherIndex const* matcher_indices) - : builder(b), closed(c), matchers(m), overload(o), matcher_indices_(matcher_indices) {} + : builder(b), templates(t), matchers(m), overload(o), matcher_indices_(matcher_indices) {} /// The program builder ProgramBuilder& builder; - /// The open / closed types and numbers - ClosedState& closed; + /// The template types and numbers + TemplateState& templates; /// The type and number matchers Matchers const& matchers; /// The current overload being evaluated - OverloadInfo const& overload; + OverloadInfo const* overload; /// Type uses the next TypeMatcher from the matcher indices to match the type /// `ty`. If the type matches, the canonical expected type is returned. If the @@ -211,14 +242,14 @@ class TypeMatcher { /// Checks whether the given type matches the matcher rules, and returns the /// expected, canonicalized type on success. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr virtual const sem::Type* Match(MatchState& state, const sem::Type* type) const = 0; /// @return a string representation of the matcher. Used for printing error /// messages when no overload is found. - virtual std::string String(MatchState& state) const = 0; + virtual std::string String(MatchState* state) const = 0; }; /// A NumberMatcher is the interface used to match a number or enumerator used @@ -229,55 +260,58 @@ class NumberMatcher { virtual ~NumberMatcher() = default; /// Checks whether the given number matches the matcher rules. - /// Match may close open numbers in state. + /// Match may define template numbers in state. /// @param number the number to match /// @returns true if the argument type is as expected. virtual Number Match(MatchState& state, Number number) const = 0; /// @return a string representation of the matcher. Used for printing error /// messages when no overload is found. - virtual std::string String(MatchState& state) const = 0; + virtual std::string String(MatchState* state) const = 0; }; -/// OpenTypeMatcher is a Matcher for an open type. -/// The OpenTypeMatcher will match against any type (so long as it is consistent -/// across all uses in the overload) -class OpenTypeMatcher : public TypeMatcher { +/// TemplateTypeMatcher is a Matcher for a template type. +/// The TemplateTypeMatcher will initially match against any type, and then will only be further +/// constrained based on the conversion rules defined at https://www.w3.org/TR/WGSL/#conversion-rank +class TemplateTypeMatcher : public TypeMatcher { public: /// Constructor - explicit OpenTypeMatcher(uint32_t index) : index_(index) {} + explicit TemplateTypeMatcher(size_t index) : index_(index) {} const sem::Type* Match(MatchState& state, const sem::Type* type) const override { if (type->Is()) { - return state.closed.Type(index_); + return state.templates.Type(index_); } - return state.closed.Type(index_, type) ? type : nullptr; + if (auto* templates = state.templates.Type(index_, type)) { + return templates; + } + return nullptr; } - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; private: - uint32_t index_; + size_t index_; }; -/// OpenNumberMatcher is a Matcher for an open number. -/// The OpenNumberMatcher will match against any number (so long as it is -/// consistent for the overload) -class OpenNumberMatcher : public NumberMatcher { +/// TemplateNumberMatcher is a Matcher for a template number. +/// The TemplateNumberMatcher will match against any number (so long as it is +/// consistent for all uses in the overload) +class TemplateNumberMatcher : public NumberMatcher { public: - explicit OpenNumberMatcher(uint32_t index) : index_(index) {} + explicit TemplateNumberMatcher(size_t index) : index_(index) {} Number Match(MatchState& state, Number number) const override { if (number.IsAny()) { - return state.closed.Num(index_); + return state.templates.Num(index_); } - return state.closed.Num(index_, number) ? number : Number::invalid; + return state.templates.Num(index_, number) ? number : Number::invalid; } - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; private: - uint32_t index_; + size_t index_; }; //////////////////////////////////////////////////////////////////////////////// @@ -289,19 +323,61 @@ using TexelFormat = ast::TexelFormat; using Access = ast::Access; using StorageClass = ast::StorageClass; using ParameterUsage = sem::ParameterUsage; -using PipelineStageSet = sem::PipelineStageSet; using PipelineStage = ast::PipelineStage; +/// Unique flag bits for overloads +enum class OverloadFlag { + kIsBuiltin, // The overload is a builtin ('fn') + kIsOperator, // The overload is an operator ('op') + kIsConstructor, // The overload is a type constructor ('ctor') + kIsConverter, // The overload is a type converter ('conv') + kSupportsVertexPipeline, // The overload can be used in vertex shaders + kSupportsFragmentPipeline, // The overload can be used in fragment shaders + kSupportsComputePipeline, // The overload can be used in compute shaders + kIsDeprecated, // The overload is deprecated +}; + +// An enum set of OverloadFlag, used by OperatorInfo +using OverloadFlags = utils::EnumSet; + bool match_bool(const sem::Type* ty) { return ty->IsAnyOf(); } +const sem::AbstractFloat* build_fa(MatchState& state) { + return state.builder.create(); +} + +bool match_fa(const sem::Type* ty) { + return ty->IsAnyOf(); +} + +const sem::AbstractInt* build_ia(MatchState& state) { + return state.builder.create(); +} + +bool match_ia(const sem::Type* ty) { + return ty->IsAnyOf(); +} + const sem::Bool* build_bool(MatchState& state) { return state.builder.create(); } +const sem::F16* build_f16(MatchState& state) { + return state.builder.create(); +} + +bool match_f16(const sem::Type* ty) { + return ty->IsAnyOf(); +} + +const sem::F32* build_f32(MatchState& state) { + return state.builder.create(); +} + bool match_f32(const sem::Type* ty) { - return ty->IsAnyOf(); + return ty->IsAnyOf(); } const sem::I32* build_i32(MatchState& state) { @@ -309,7 +385,7 @@ const sem::I32* build_i32(MatchState& state) { } bool match_i32(const sem::Type* ty) { - return ty->IsAnyOf(); + return ty->IsAnyOf(); } const sem::U32* build_u32(MatchState& state) { @@ -317,11 +393,7 @@ const sem::U32* build_u32(MatchState& state) { } bool match_u32(const sem::Type* ty) { - return ty->IsAnyOf(); -} - -const sem::F32* build_f32(MatchState& state) { - return state.builder.create(); + return ty->IsAnyOf(); } bool match_vec(const sem::Type* ty, Number& N, const sem::Type*& T) { @@ -339,11 +411,7 @@ bool match_vec(const sem::Type* ty, Number& N, const sem::Type*& T) { return false; } -const sem::Vector* build_vec(MatchState& state, Number N, const sem::Type* el) { - return state.builder.create(el, N.Value()); -} - -template +template bool match_vec(const sem::Type* ty, const sem::Type*& T) { if (ty->Is()) { T = ty; @@ -359,29 +427,22 @@ bool match_vec(const sem::Type* ty, const sem::Type*& T) { return false; } -bool match_vec2(const sem::Type* ty, const sem::Type*& T) { - return match_vec<2>(ty, T); +const sem::Vector* build_vec(MatchState& state, Number N, const sem::Type* el) { + return state.builder.create(el, N.Value()); } -const sem::Vector* build_vec2(MatchState& state, const sem::Type* T) { - return build_vec(state, Number(2), T); +template +const sem::Vector* build_vec(MatchState& state, const sem::Type* el) { + return state.builder.create(el, N); } -bool match_vec3(const sem::Type* ty, const sem::Type*& T) { - return match_vec<3>(ty, T); -} +constexpr auto match_vec2 = match_vec<2>; +constexpr auto match_vec3 = match_vec<3>; +constexpr auto match_vec4 = match_vec<4>; -const sem::Vector* build_vec3(MatchState& state, const sem::Type* T) { - return build_vec(state, Number(3), T); -} - -bool match_vec4(const sem::Type* ty, const sem::Type*& T) { - return match_vec<4>(ty, T); -} - -const sem::Vector* build_vec4(MatchState& state, const sem::Type* T) { - return build_vec(state, Number(4), T); -} +constexpr auto build_vec2 = build_vec<2>; +constexpr auto build_vec3 = build_vec<3>; +constexpr auto build_vec4 = build_vec<4>; bool match_mat(const sem::Type* ty, Number& M, Number& N, const sem::Type*& T) { if (ty->Is()) { @@ -399,11 +460,52 @@ bool match_mat(const sem::Type* ty, Number& M, Number& N, const sem::Type*& T) { return false; } -const sem::Matrix* build_mat(MatchState& state, Number N, Number M, const sem::Type* T) { - auto* column_type = state.builder.create(T, M.Value()); - return state.builder.create(column_type, N.Value()); +template +bool match_mat(const sem::Type* ty, const sem::Type*& T) { + if (ty->Is()) { + T = ty; + return true; + } + if (auto* m = ty->As()) { + if (m->columns() == C && m->rows() == R) { + T = m->type(); + return true; + } + } + return false; } +const sem::Matrix* build_mat(MatchState& state, Number C, Number R, const sem::Type* T) { + auto* column_type = state.builder.create(T, R.Value()); + return state.builder.create(column_type, C.Value()); +} + +template +const sem::Matrix* build_mat(MatchState& state, const sem::Type* T) { + auto* column_type = state.builder.create(T, R); + return state.builder.create(column_type, C); +} + +constexpr auto build_mat2x2 = build_mat<2, 2>; +constexpr auto build_mat2x3 = build_mat<2, 3>; +constexpr auto build_mat2x4 = build_mat<2, 4>; +constexpr auto build_mat3x2 = build_mat<3, 2>; +constexpr auto build_mat3x3 = build_mat<3, 3>; +constexpr auto build_mat3x4 = build_mat<3, 4>; +constexpr auto build_mat4x2 = build_mat<4, 2>; +constexpr auto build_mat4x3 = build_mat<4, 3>; +constexpr auto build_mat4x4 = build_mat<4, 4>; + +constexpr auto match_mat2x2 = match_mat<2, 2>; +constexpr auto match_mat2x3 = match_mat<2, 3>; +constexpr auto match_mat2x4 = match_mat<2, 4>; +constexpr auto match_mat3x2 = match_mat<3, 2>; +constexpr auto match_mat3x3 = match_mat<3, 3>; +constexpr auto match_mat3x4 = match_mat<3, 4>; +constexpr auto match_mat4x2 = match_mat<4, 2>; +constexpr auto match_mat4x3 = match_mat<4, 3>; +constexpr auto match_mat4x4 = match_mat<4, 4>; + bool match_array(const sem::Type* ty, const sem::Type*& T) { if (ty->Is()) { T = ty; @@ -630,30 +732,48 @@ const sem::ExternalTexture* build_texture_external(MatchState& state) { // Builtin types starting with a _ prefix cannot be declared in WGSL, so they // can only be used as return types. Because of this, they must only match Any, // which is used as the return type matcher. -bool match_modf_result(const sem::Type* ty) { - return ty->Is(); +bool match_modf_result(const sem::Type* ty, const sem::Type*& T) { + if (!ty->Is()) { + return false; + } + T = ty; + return true; } -bool match_modf_result_vec(const sem::Type* ty, Number& N) { +bool match_modf_result_vec(const sem::Type* ty, Number& N, const sem::Type*& T) { if (!ty->Is()) { return false; } N = Number::any; + T = ty; return true; } -bool match_frexp_result(const sem::Type* ty) { - return ty->Is(); +bool match_frexp_result(const sem::Type* ty, const sem::Type*& T) { + if (!ty->Is()) { + return false; + } + T = ty; + return true; } -bool match_frexp_result_vec(const sem::Type* ty, Number& N) { +bool match_frexp_result_vec(const sem::Type* ty, Number& N, const sem::Type*& T) { if (!ty->Is()) { return false; } N = Number::any; + T = ty; return true; } +bool match_atomic_compare_exchange_result(const sem::Type* ty, const sem::Type*& T) { + if (ty->Is()) { + T = ty; + return true; + } + return false; +} + struct NameAndType { std::string name; - sem::Type* type; + const sem::Type* type; }; const sem::Struct* build_struct(MatchState& state, std::string name, @@ -687,25 +807,51 @@ const sem::Struct* build_struct(MatchState& state, /* size_no_padding */ size_without_padding); } -const sem::Struct* build_modf_result(MatchState& state) { - auto* f32 = state.builder.create(); - return build_struct(state, "__modf_result", {{"fract", f32}, {"whole", f32}}); +const sem::Struct* build_modf_result(MatchState& state, const sem::Type* el) { + std::string display_name; + if (el->Is()) { + display_name = "__modf_result_f16"; + } else { + display_name = "__modf_result"; + } + return build_struct(state, display_name, {{"fract", el}, {"whole", el}}); } -const sem::Struct* build_modf_result_vec(MatchState& state, Number& n) { - auto* vec_f32 = state.builder.create(state.builder.create(), n.Value()); - return build_struct(state, "__modf_result_vec" + std::to_string(n.Value()), - {{"fract", vec_f32}, {"whole", vec_f32}}); +const sem::Struct* build_modf_result_vec(MatchState& state, Number& n, const sem::Type* el) { + std::string display_name; + if (el->Is()) { + display_name = "__modf_result_vec" + std::to_string(n.Value()) + "_f16"; + } else { + display_name = "__modf_result_vec" + std::to_string(n.Value()); + } + auto* vec = state.builder.create(el, n.Value()); + return build_struct(state, display_name, {{"fract", vec}, {"whole", vec}}); } -const sem::Struct* build_frexp_result(MatchState& state) { - auto* f32 = state.builder.create(); +const sem::Struct* build_frexp_result(MatchState& state, const sem::Type* el) { + std::string display_name; + if (el->Is()) { + display_name = "__frexp_result_f16"; + } else { + display_name = "__frexp_result"; + } auto* i32 = state.builder.create(); - return build_struct(state, "__frexp_result", {{"sig", f32}, {"exp", i32}}); + return build_struct(state, display_name, {{"sig", el}, {"exp", i32}}); } -const sem::Struct* build_frexp_result_vec(MatchState& state, Number& n) { - auto* vec_f32 = state.builder.create(state.builder.create(), n.Value()); +const sem::Struct* build_frexp_result_vec(MatchState& state, Number& n, const sem::Type* el) { + std::string display_name; + if (el->Is()) { + display_name = "__frexp_result_vec" + std::to_string(n.Value()) + "_f16"; + } else { + display_name = "__frexp_result_vec" + std::to_string(n.Value()); + } + auto* vec = state.builder.create(el, n.Value()); auto* vec_i32 = state.builder.create(state.builder.create(), n.Value()); - return build_struct(state, "__frexp_result_vec" + std::to_string(n.Value()), - {{"sig", vec_f32}, {"exp", vec_i32}}); + return build_struct(state, display_name, {{"sig", vec}, {"exp", vec_i32}}); +} +const sem::Struct* build_atomic_compare_exchange_result(MatchState& state, const sem::Type* ty) { + return build_struct( + state, "__atomic_compare_exchange_result" + ty->FriendlyName(state.builder.Symbols()), + {{"old_value", const_cast(ty)}, + {"exchanged", state.builder.create()}}); } /// ParameterInfo describes a parameter @@ -720,18 +866,18 @@ struct ParameterInfo { MatcherIndex const* const matcher_indices; }; -/// OpenTypeInfo describes an open type -struct OpenTypeInfo { - /// Name of the open type (e.g. 'T') +/// TemplateTypeInfo describes an template type +struct TemplateTypeInfo { + /// Name of the template type (e.g. 'T') const char* name; /// Optional type matcher constraint. /// Either an index in Matchers::type, or kNoMatcher const MatcherIndex matcher_index; }; -/// OpenNumberInfo describes an open number -struct OpenNumberInfo { - /// Name of the open number (e.g. 'N') +/// TemplateNumberInfo describes a template number +struct TemplateNumberInfo { + /// Name of the template number (e.g. 'N') const char* name; /// Optional number matcher constraint. /// Either an index in Matchers::number, or kNoMatcher @@ -742,29 +888,29 @@ struct OpenNumberInfo { struct OverloadInfo { /// Total number of parameters for the overload const uint8_t num_parameters; - /// Total number of open types for the overload - const uint8_t num_open_types; - /// Total number of open numbers for the overload - const uint8_t num_open_numbers; - /// Pointer to the first open type - OpenTypeInfo const* const open_types; - /// Pointer to the first open number - OpenNumberInfo const* const open_numbers; + /// Total number of template types for the overload + const uint8_t num_template_types; + /// Total number of template numbers for the overload + const uint8_t num_template_numbers; + /// Pointer to the first template type + TemplateTypeInfo const* const template_types; + /// Pointer to the first template number + TemplateNumberInfo const* const template_numbers; /// Pointer to the first parameter ParameterInfo const* const parameters; /// Pointer to a list of matcher indices that index on Matchers::type and /// Matchers::number, used to build the return type. If the function has no /// return type then this is null MatcherIndex const* const return_matcher_indices; - /// The pipeline stages that this overload can be used in - PipelineStageSet supported_stages; - /// True if the overload is marked as deprecated - bool is_deprecated; + /// The flags for the overload + OverloadFlags flags; + /// The function used to evaluate the overload at shader-creation time. + ConstEval::Function const const_eval_fn; }; -/// BuiltinInfo describes a builtin function -struct BuiltinInfo { - /// Number of overloads of the builtin function +/// IntrinsicInfo describes a builtin function or operator overload +struct IntrinsicInfo { + /// Number of overloads of the intrinsic const uint8_t num_overloads; /// Pointer to the start of the overloads for the function OverloadInfo const* const overloads; @@ -772,9 +918,8 @@ struct BuiltinInfo { #include "intrinsic_table.inl" -/// BuiltinPrototype describes a fully matched builtin function, which is -/// used as a lookup for building unique sem::Builtin instances. -struct BuiltinPrototype { +/// IntrinsicPrototype describes a fully matched intrinsic. +struct IntrinsicPrototype { /// Parameter describes a single parameter struct Parameter { /// Parameter type @@ -783,34 +928,31 @@ struct BuiltinPrototype { ParameterUsage const usage = ParameterUsage::kNone; }; - /// Hasher provides a hash function for the BuiltinPrototype + /// Hasher provides a hash function for the IntrinsicPrototype struct Hasher { - /// @param i the BuiltinPrototype to create a hash for + /// @param i the IntrinsicPrototype to create a hash for /// @return the hash value - inline std::size_t operator()(const BuiltinPrototype& i) const { - size_t hash = utils::Hash(i.parameters.size()); + inline std::size_t operator()(const IntrinsicPrototype& i) const { + size_t hash = utils::Hash(i.parameters.Length()); for (auto& p : i.parameters) { - utils::HashCombine(&hash, p.type, p.usage); + hash = utils::HashCombine(hash, p.type, p.usage); } - return utils::Hash(hash, i.type, i.return_type, i.supported_stages, i.is_deprecated); + return utils::Hash(hash, i.overload, i.return_type); } }; - sem::BuiltinType type = sem::BuiltinType::kNone; - std::vector parameters; + const OverloadInfo* overload = nullptr; sem::Type const* return_type = nullptr; - PipelineStageSet supported_stages; - bool is_deprecated = false; + utils::Vector parameters; }; -/// Equality operator for BuiltinPrototype -bool operator==(const BuiltinPrototype& a, const BuiltinPrototype& b) { - if (a.type != b.type || a.supported_stages != b.supported_stages || - a.return_type != b.return_type || a.is_deprecated != b.is_deprecated || - a.parameters.size() != b.parameters.size()) { +/// Equality operator for IntrinsicPrototype +bool operator==(const IntrinsicPrototype& a, const IntrinsicPrototype& b) { + if (a.overload != b.overload || a.return_type != b.return_type || + a.parameters.Length() != b.parameters.Length()) { return false; } - for (size_t i = 0; i < a.parameters.size(); i++) { + for (size_t i = 0; i < a.parameters.Length(); i++) { auto& pa = a.parameters[i]; auto& pb = b.parameters[i]; if (pa.type != pb.type || pa.usage != pb.usage) { @@ -825,36 +967,140 @@ class Impl : public IntrinsicTable { public: explicit Impl(ProgramBuilder& builder); - const sem::Builtin* Lookup(sem::BuiltinType builtin_type, - const std::vector& args, - const Source& source) override; + Builtin Lookup(sem::BuiltinType builtin_type, + utils::VectorRef args, + const Source& source) override; + + UnaryOperator Lookup(ast::UnaryOp op, const sem::Type* arg, const Source& source) override; + + BinaryOperator Lookup(ast::BinaryOp op, + const sem::Type* lhs, + const sem::Type* rhs, + const Source& source, + bool is_compound) override; + + CtorOrConv Lookup(CtorConvIntrinsic type, + const sem::Type* template_arg, + utils::VectorRef args, + const Source& source) override; private: - const sem::Builtin* Match(sem::BuiltinType builtin_type, - const OverloadInfo& overload, - const std::vector& args, - int& match_score); + /// Candidate holds information about an overload evaluated for resolution. + struct Candidate { + /// The candidate overload + const OverloadInfo* overload; + /// The template types and numbers + TemplateState templates; + /// The parameter types for the candidate overload + utils::Vector parameters; + /// The match-score of the candidate overload. + /// A score of zero indicates an exact match. + /// Non-zero scores are used for diagnostics when no overload matches. + /// Lower scores are displayed first (top-most). + size_t score; + }; - MatchState Match(ClosedState& closed, - const OverloadInfo& overload, + /// A list of candidates + using Candidates = utils::Vector; + + /// Callback function when no overloads match. + using OnNoMatch = std::function)>; + + /// Sorts the candidates based on their score, with the lowest (best-ranking) scores first. + static inline void SortCandidates(Candidates& candidates) { + std::stable_sort(candidates.begin(), candidates.end(), + [&](const Candidate& a, const Candidate& b) { return a.score < b.score; }); + } + + /// Attempts to find a single intrinsic overload that matches the provided argument types. + /// @param intrinsic the intrinsic being called + /// @param intrinsic_name the name of the intrinsic + /// @param args the argument types + /// @param templates initial template state. This may contain explicitly specified template + /// arguments. For example `vec3()` would have the first template-type + /// defined as `f32`. + /// @param on_no_match an error callback when no intrinsic overloads matched the provided + /// arguments. + /// @returns the matched intrinsic. If no intrinsic could be matched then IntrinsicPrototype + /// will hold nullptrs for IntrinsicPrototype::overload and + /// IntrinsicPrototype::return_type. + IntrinsicPrototype MatchIntrinsic(const IntrinsicInfo& intrinsic, + const char* intrinsic_name, + utils::VectorRef args, + TemplateState templates, + OnNoMatch on_no_match) const; + + /// Evaluates the single overload for the provided argument types. + /// @param overload the overload being considered + /// @param args the argument types + /// @param templates initial template state. This may contain explicitly specified template + /// arguments. For example `vec3()` would have the first template-type + /// template as `f32`. + /// @returns the evaluated Candidate information. + Candidate ScoreOverload(const OverloadInfo* overload, + utils::VectorRef args, + TemplateState templates) const; + + /// Performs overload resolution given the list of candidates, by ranking the conversions of + /// arguments to the each of the candidate's parameter types. + /// @param candidates the list of candidate overloads + /// @param intrinsic_name the name of the intrinsic + /// @param args the argument types + /// @param templates initial template state. This may contain explicitly specified template + /// arguments. For example `vec3()` would have the first template-type + /// template as `f32`. + /// @see https://www.w3.org/TR/WGSL/#overload-resolution-section + /// @returns the resolved Candidate. + Candidate ResolveCandidate(Candidates&& candidates, + const char* intrinsic_name, + utils::VectorRef args, + TemplateState templates) const; + + /// Match constructs a new MatchState + /// @param templates the template state used for matcher evaluation + /// @param overload the overload being evaluated + /// @param matcher_indices pointer to a list of matcher indices + MatchState Match(TemplateState& templates, + const OverloadInfo* overload, MatcherIndex const* matcher_indices) const; + // Prints the overload for emitting diagnostics void PrintOverload(std::ostream& ss, - const OverloadInfo& overload, - sem::BuiltinType builtin_type) const; + const OverloadInfo* overload, + const char* intrinsic_name) const; + + // Prints the list of candidates for emitting diagnostics + void PrintCandidates(std::ostream& ss, + utils::VectorRef candidates, + const char* intrinsic_name) const; + + /// Raises an error when no overload is a clear winner of overload resolution + void ErrAmbiguousOverload(const char* intrinsic_name, + utils::VectorRef args, + TemplateState templates, + utils::VectorRef candidates) const; ProgramBuilder& builder; Matchers matchers; - std::unordered_map builtins; + std::unordered_map builtins; + std::unordered_map + constructors; + std::unordered_map + converters; }; /// @return a string representing a call to a builtin with the given argument /// types. std::string CallSignature(ProgramBuilder& builder, - sem::BuiltinType builtin_type, - const std::vector& args) { + const char* intrinsic_name, + utils::VectorRef args, + const sem::Type* template_arg = nullptr) { std::stringstream ss; - ss << sem::str(builtin_type) << "("; + ss << intrinsic_name; + if (template_arg) { + ss << "<" << template_arg->FriendlyName(builder.Symbols()) << ">"; + } + ss << "("; { bool first = true; for (auto* arg : args) { @@ -870,185 +1116,497 @@ std::string CallSignature(ProgramBuilder& builder, return ss.str(); } -std::string OpenTypeMatcher::String(MatchState& state) const { - return state.overload.open_types[index_].name; +std::string TemplateTypeMatcher::String(MatchState* state) const { + return state->overload->template_types[index_].name; } -std::string OpenNumberMatcher::String(MatchState& state) const { - return state.overload.open_numbers[index_].name; +std::string TemplateNumberMatcher::String(MatchState* state) const { + return state->overload->template_numbers[index_].name; } Impl::Impl(ProgramBuilder& b) : builder(b) {} -const sem::Builtin* Impl::Lookup(sem::BuiltinType builtin_type, - const std::vector& args, - const Source& source) { - // Candidate holds information about a mismatched overload that could be what - // the user intended to call. - struct Candidate { - const OverloadInfo* overload; - int score; +Impl::Builtin Impl::Lookup(sem::BuiltinType builtin_type, + utils::VectorRef args, + const Source& source) { + const char* intrinsic_name = sem::str(builtin_type); + + // Generates an error when no overloads match the provided arguments + auto on_no_match = [&](utils::VectorRef candidates) { + std::stringstream ss; + ss << "no matching call to " << CallSignature(builder, intrinsic_name, args) << std::endl; + if (!candidates.IsEmpty()) { + ss << std::endl + << candidates.Length() << " candidate function" + << (candidates.Length() > 1 ? "s:" : ":") << std::endl; + PrintCandidates(ss, candidates, intrinsic_name); + } + builder.Diagnostics().add_error(diag::System::Resolver, ss.str(), source); }; - // The list of failed matches that had promise. - std::vector candidates; - - auto& builtin = kBuiltins[static_cast(builtin_type)]; - for (uint32_t o = 0; o < builtin.num_overloads; o++) { - int match_score = 1000; - auto& overload = builtin.overloads[o]; - if (auto* match = Match(builtin_type, overload, args, match_score)) { - return match; - } - if (match_score > 0) { - candidates.emplace_back(Candidate{&overload, match_score}); - } + // Resolve the intrinsic overload + auto match = MatchIntrinsic(kBuiltins[static_cast(builtin_type)], intrinsic_name, args, + TemplateState{}, on_no_match); + if (!match.overload) { + return {}; } - // Sort the candidates with the most promising first - std::stable_sort(candidates.begin(), candidates.end(), - [](const Candidate& a, const Candidate& b) { return a.score > b.score; }); - - // Generate an error message - std::stringstream ss; - ss << "no matching call to " << CallSignature(builder, builtin_type, args) << std::endl; - if (!candidates.empty()) { - ss << std::endl; - ss << candidates.size() << " candidate function" << (candidates.size() > 1 ? "s:" : ":") - << std::endl; - for (auto& candidate : candidates) { - ss << " "; - PrintOverload(ss, *candidate.overload, builtin_type); - ss << std::endl; + // De-duplicate builtins that are identical. + auto* sem = utils::GetOrCreate(builtins, match, [&] { + utils::Vector params; + params.Reserve(match.parameters.Length()); + for (auto& p : match.parameters) { + params.Push(builder.create( + nullptr, static_cast(params.Length()), p.type, ast::StorageClass::kNone, + ast::Access::kUndefined, p.usage)); } - } - builder.Diagnostics().add_error(diag::System::Resolver, ss.str(), source); - return nullptr; + sem::PipelineStageSet supported_stages; + if (match.overload->flags.Contains(OverloadFlag::kSupportsVertexPipeline)) { + supported_stages.Add(ast::PipelineStage::kVertex); + } + if (match.overload->flags.Contains(OverloadFlag::kSupportsFragmentPipeline)) { + supported_stages.Add(ast::PipelineStage::kFragment); + } + if (match.overload->flags.Contains(OverloadFlag::kSupportsComputePipeline)) { + supported_stages.Add(ast::PipelineStage::kCompute); + } + auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant + : sem::EvaluationStage::kRuntime; + return builder.create( + builtin_type, match.return_type, std::move(params), eval_stage, supported_stages, + match.overload->flags.Contains(OverloadFlag::kIsDeprecated)); + }); + return Builtin{sem, match.overload->const_eval_fn}; } -const sem::Builtin* Impl::Match(sem::BuiltinType builtin_type, - const OverloadInfo& overload, - const std::vector& args, - int& match_score) { - // Score wait for argument <-> parameter count matches / mismatches - constexpr int kScorePerParamArgMismatch = -1; - constexpr int kScorePerMatchedParam = 2; - constexpr int kScorePerMatchedOpenType = 1; - constexpr int kScorePerMatchedOpenNumber = 1; - - auto num_parameters = overload.num_parameters; - auto num_arguments = static_cast(args.size()); - - bool overload_matched = true; - - if (num_parameters != num_arguments) { - match_score += kScorePerParamArgMismatch * (std::max(num_parameters, num_arguments) - - std::min(num_parameters, num_arguments)); - overload_matched = false; - } - - ClosedState closed(builder); - - std::vector parameters; - - auto num_params = std::min(num_parameters, num_arguments); - for (uint32_t p = 0; p < num_params; p++) { - auto& parameter = overload.parameters[p]; - auto* indices = parameter.matcher_indices; - auto* type = Match(closed, overload, indices).Type(args[p]->UnwrapRef()); - if (type) { - parameters.emplace_back(BuiltinPrototype::Parameter{type, parameter.usage}); - match_score += kScorePerMatchedParam; - } else { - overload_matched = false; +IntrinsicTable::UnaryOperator Impl::Lookup(ast::UnaryOp op, + const sem::Type* arg, + const Source& source) { + auto [intrinsic_index, intrinsic_name] = [&]() -> std::pair { + switch (op) { + case ast::UnaryOp::kComplement: + return {kUnaryOperatorComplement, "operator ~ "}; + case ast::UnaryOp::kNegation: + return {kUnaryOperatorMinus, "operator - "}; + case ast::UnaryOp::kNot: + return {kUnaryOperatorNot, "operator ! "}; + default: + return {0, ""}; } + }(); + + utils::Vector args{arg}; + + // Generates an error when no overloads match the provided arguments + auto on_no_match = [&, name = intrinsic_name](utils::VectorRef candidates) { + std::stringstream ss; + ss << "no matching overload for " << CallSignature(builder, name, args) << std::endl; + if (!candidates.IsEmpty()) { + ss << std::endl + << candidates.Length() << " candidate operator" + << (candidates.Length() > 1 ? "s:" : ":") << std::endl; + PrintCandidates(ss, candidates, name); + } + builder.Diagnostics().add_error(diag::System::Resolver, ss.str(), source); + }; + + // Resolve the intrinsic overload + auto match = MatchIntrinsic(kUnaryOperators[intrinsic_index], intrinsic_name, args, + TemplateState{}, on_no_match); + if (!match.overload) { + return {}; } - if (overload_matched) { - // Check all constrained open types matched - for (uint32_t ot = 0; ot < overload.num_open_types; ot++) { - auto& open_type = overload.open_types[ot]; - if (open_type.matcher_index != kNoMatcher) { - auto* index = &open_type.matcher_index; - if (Match(closed, overload, index).Type(closed.Type(ot))) { - match_score += kScorePerMatchedOpenType; - } else { - overload_matched = false; - } + return UnaryOperator{ + match.return_type, + match.parameters[0].type, + match.overload->const_eval_fn, + }; +} + +IntrinsicTable::BinaryOperator Impl::Lookup(ast::BinaryOp op, + const sem::Type* lhs, + const sem::Type* rhs, + const Source& source, + bool is_compound) { + auto [intrinsic_index, intrinsic_name] = [&]() -> std::pair { + switch (op) { + case ast::BinaryOp::kAnd: + return {kBinaryOperatorAnd, is_compound ? "operator &= " : "operator & "}; + case ast::BinaryOp::kOr: + return {kBinaryOperatorOr, is_compound ? "operator |= " : "operator | "}; + case ast::BinaryOp::kXor: + return {kBinaryOperatorXor, is_compound ? "operator ^= " : "operator ^ "}; + case ast::BinaryOp::kLogicalAnd: + return {kBinaryOperatorLogicalAnd, "operator && "}; + case ast::BinaryOp::kLogicalOr: + return {kBinaryOperatorLogicalOr, "operator || "}; + case ast::BinaryOp::kEqual: + return {kBinaryOperatorEqual, "operator == "}; + case ast::BinaryOp::kNotEqual: + return {kBinaryOperatorNotEqual, "operator != "}; + case ast::BinaryOp::kLessThan: + return {kBinaryOperatorLessThan, "operator < "}; + case ast::BinaryOp::kGreaterThan: + return {kBinaryOperatorGreaterThan, "operator > "}; + case ast::BinaryOp::kLessThanEqual: + return {kBinaryOperatorLessThanEqual, "operator <= "}; + case ast::BinaryOp::kGreaterThanEqual: + return {kBinaryOperatorGreaterThanEqual, "operator >= "}; + case ast::BinaryOp::kShiftLeft: + return {kBinaryOperatorShiftLeft, is_compound ? "operator <<= " : "operator << "}; + case ast::BinaryOp::kShiftRight: + return {kBinaryOperatorShiftRight, is_compound ? "operator >>= " : "operator >> "}; + case ast::BinaryOp::kAdd: + return {kBinaryOperatorPlus, is_compound ? "operator += " : "operator + "}; + case ast::BinaryOp::kSubtract: + return {kBinaryOperatorMinus, is_compound ? "operator -= " : "operator - "}; + case ast::BinaryOp::kMultiply: + return {kBinaryOperatorStar, is_compound ? "operator *= " : "operator * "}; + case ast::BinaryOp::kDivide: + return {kBinaryOperatorDivide, is_compound ? "operator /= " : "operator / "}; + case ast::BinaryOp::kModulo: + return {kBinaryOperatorModulo, is_compound ? "operator %= " : "operator % "}; + default: + return {0, ""}; + } + }(); + + utils::Vector args{lhs, rhs}; + + // Generates an error when no overloads match the provided arguments + auto on_no_match = [&, name = intrinsic_name](utils::VectorRef candidates) { + std::stringstream ss; + ss << "no matching overload for " << CallSignature(builder, name, args) << std::endl; + if (!candidates.IsEmpty()) { + ss << std::endl + << candidates.Length() << " candidate operator" + << (candidates.Length() > 1 ? "s:" : ":") << std::endl; + PrintCandidates(ss, candidates, name); + } + builder.Diagnostics().add_error(diag::System::Resolver, ss.str(), source); + }; + + // Resolve the intrinsic overload + auto match = MatchIntrinsic(kBinaryOperators[intrinsic_index], intrinsic_name, args, + TemplateState{}, on_no_match); + if (!match.overload) { + return {}; + } + + return BinaryOperator{ + match.return_type, + match.parameters[0].type, + match.parameters[1].type, + match.overload->const_eval_fn, + }; +} + +IntrinsicTable::CtorOrConv Impl::Lookup(CtorConvIntrinsic type, + const sem::Type* template_arg, + utils::VectorRef args, + const Source& source) { + auto name = str(type); + + // Generates an error when no overloads match the provided arguments + auto on_no_match = [&](utils::VectorRef candidates) { + std::stringstream ss; + ss << "no matching constructor for " << CallSignature(builder, name, args, template_arg) + << std::endl; + Candidates ctor, conv; + for (auto candidate : candidates) { + if (candidate.overload->flags.Contains(OverloadFlag::kIsConstructor)) { + ctor.Push(candidate); + } else { + conv.Push(candidate); } } - } - - if (overload_matched) { - // Check all constrained open numbers matched - for (uint32_t on = 0; on < overload.num_open_numbers; on++) { - auto& open_number = overload.open_numbers[on]; - if (open_number.matcher_index != kNoMatcher) { - auto* index = &open_number.matcher_index; - if (Match(closed, overload, index).Num(closed.Num(on)).IsValid()) { - match_score += kScorePerMatchedOpenNumber; - } else { - overload_matched = false; - } - } + if (!ctor.IsEmpty()) { + ss << std::endl + << ctor.Length() << " candidate constructor" << (ctor.Length() > 1 ? "s:" : ":") + << std::endl; + PrintCandidates(ss, ctor, name); } + if (!conv.IsEmpty()) { + ss << std::endl + << conv.Length() << " candidate conversion" << (conv.Length() > 1 ? "s:" : ":") + << std::endl; + PrintCandidates(ss, conv, name); + } + builder.Diagnostics().add_error(diag::System::Resolver, ss.str(), source); + }; + + // If a template type was provided, then close the 0'th type with this. + TemplateState templates; + if (template_arg) { + templates.Type(0, template_arg); } - if (!overload_matched) { - return nullptr; + // Resolve the intrinsic overload + auto match = MatchIntrinsic(kConstructorsAndConverters[static_cast(type)], name, args, + templates, on_no_match); + if (!match.overload) { + return {}; + } + + // Was this overload a constructor or conversion? + if (match.overload->flags.Contains(OverloadFlag::kIsConstructor)) { + utils::Vector params; + params.Reserve(match.parameters.Length()); + for (auto& p : match.parameters) { + params.Push(builder.create( + nullptr, static_cast(params.Length()), p.type, ast::StorageClass::kNone, + ast::Access::kUndefined, p.usage)); + } + auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant + : sem::EvaluationStage::kRuntime; + auto* target = utils::GetOrCreate(constructors, match, [&]() { + return builder.create(match.return_type, std::move(params), + eval_stage); + }); + return CtorOrConv{target, match.overload->const_eval_fn}; + } + + // Conversion. + auto* target = utils::GetOrCreate(converters, match, [&]() { + auto param = builder.create( + nullptr, 0u, match.parameters[0].type, ast::StorageClass::kNone, + ast::Access::kUndefined, match.parameters[0].usage); + auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant + : sem::EvaluationStage::kRuntime; + return builder.create(match.return_type, param, eval_stage); + }); + return CtorOrConv{target, match.overload->const_eval_fn}; +} + +IntrinsicPrototype Impl::MatchIntrinsic(const IntrinsicInfo& intrinsic, + const char* intrinsic_name, + utils::VectorRef args, + TemplateState templates, + OnNoMatch on_no_match) const { + size_t num_matched = 0; + size_t match_idx = 0; + utils::Vector candidates; + candidates.Reserve(intrinsic.num_overloads); + for (size_t overload_idx = 0; overload_idx < static_cast(intrinsic.num_overloads); + overload_idx++) { + auto candidate = ScoreOverload(&intrinsic.overloads[overload_idx], args, templates); + if (candidate.score == 0) { + match_idx = overload_idx; + num_matched++; + } + candidates.Push(std::move(candidate)); + } + + // How many candidates matched? + if (num_matched == 0) { + // Sort the candidates with the most promising first + SortCandidates(candidates); + on_no_match(std::move(candidates)); + return {}; + } + + Candidate match; + + if (num_matched == 1) { + match = std::move(candidates[match_idx]); + } else { + match = ResolveCandidate(std::move(candidates), intrinsic_name, args, std::move(templates)); + if (!match.overload) { + // Ambiguous overload. ResolveCandidate() will have already raised an error diagnostic. + return {}; + } } // Build the return type const sem::Type* return_type = nullptr; - if (auto* indices = overload.return_matcher_indices) { + if (auto* indices = match.overload->return_matcher_indices) { Any any; - return_type = Match(closed, overload, indices).Type(&any); + return_type = Match(match.templates, match.overload, indices).Type(&any); if (!return_type) { - std::stringstream ss; - PrintOverload(ss, overload, builtin_type); - TINT_ICE(Resolver, builder.Diagnostics()) - << "MatchState.Match() returned null for " << ss.str(); - return nullptr; + TINT_ICE(Resolver, builder.Diagnostics()) << "MatchState.Match() returned null"; + return {}; } } else { return_type = builder.create(); } - BuiltinPrototype builtin; - builtin.type = builtin_type; - builtin.return_type = return_type; - builtin.parameters = std::move(parameters); - builtin.supported_stages = overload.supported_stages; - builtin.is_deprecated = overload.is_deprecated; - - // De-duplicate builtins that are identical. - return utils::GetOrCreate(builtins, builtin, [&] { - std::vector params; - params.reserve(builtin.parameters.size()); - for (auto& p : builtin.parameters) { - params.emplace_back(builder.create( - nullptr, static_cast(params.size()), p.type, ast::StorageClass::kNone, - ast::Access::kUndefined, p.usage)); - } - return builder.create(builtin.type, builtin.return_type, std::move(params), - builtin.supported_stages, builtin.is_deprecated); - }); + return IntrinsicPrototype{match.overload, return_type, std::move(match.parameters)}; } -MatchState Impl::Match(ClosedState& closed, - const OverloadInfo& overload, +Impl::Candidate Impl::ScoreOverload(const OverloadInfo* overload, + utils::VectorRef args, + TemplateState templates) const { + // Penalty weights for overload mismatching. + // This scoring is used to order the suggested overloads in diagnostic on overload mismatch, and + // has no impact for a correct program. + // The overloads with the lowest score will be displayed first (top-most). + constexpr int kMismatchedParamCountPenalty = 3; + constexpr int kMismatchedParamTypePenalty = 2; + constexpr int kMismatchedTemplateTypePenalty = 1; + constexpr int kMismatchedTemplateNumberPenalty = 1; + + size_t num_parameters = static_cast(overload->num_parameters); + size_t num_arguments = static_cast(args.Length()); + + size_t score = 0; + + if (num_parameters != num_arguments) { + score += kMismatchedParamCountPenalty * (std::max(num_parameters, num_arguments) - + std::min(num_parameters, num_arguments)); + } + + // Invoke the matchers for each parameter <-> argument pair. + // If any arguments cannot be matched, then `score` will be increased. + // If the overload has any template types or numbers then these will be set based on the + // argument types. Template types may be refined by constraining with later argument types. For + // example calling `F(T, T)` with the argument types (abstract-int, i32) will first set T to + // abstract-int when matching the first argument, and then constrained down to i32 when matching + // the second argument. + // Note that inferred template types are not tested against their matchers at this point. + auto num_params = std::min(num_parameters, num_arguments); + for (size_t p = 0; p < num_params; p++) { + auto& parameter = overload->parameters[p]; + auto* indices = parameter.matcher_indices; + if (!Match(templates, overload, indices).Type(args[p]->UnwrapRef())) { + score += kMismatchedParamTypePenalty; + } + } + + if (score == 0) { + // Check all constrained template types matched their constraint matchers. + // If the template type *does not* match any of the types in the constraint matcher, then + // `score` is incremented. If the template type *does* match a type, then the template type + // is replaced with the first matching type. The order of types in the template matcher is + // important here, which can be controlled with the [[precedence(N)]] decorations on the + // types in intrinsics.def. + for (size_t ot = 0; ot < overload->num_template_types; ot++) { + auto* matcher_index = &overload->template_types[ot].matcher_index; + if (*matcher_index != kNoMatcher) { + if (auto* template_type = templates.Type(ot)) { + if (auto* ty = Match(templates, overload, matcher_index).Type(template_type)) { + // Template type matched one of the types in the template type's matcher. + // Replace the template type with this type. + templates.SetType(ot, ty); + continue; + } + } + score += kMismatchedTemplateTypePenalty; + } + } + } + + if (score == 0) { + // Check all constrained open numbers matched. + // Unlike template types, numbers are not constrained, so we're just checking that the + // inferred number matches the constraints on the overload. Increments `score` if the + // template numbers do not match their constraint matchers. + for (size_t on = 0; on < overload->num_template_numbers; on++) { + auto* matcher_index = &overload->template_numbers[on].matcher_index; + if (*matcher_index != kNoMatcher) { + auto template_num = templates.Num(on); + if (!template_num.IsValid() || + !Match(templates, overload, matcher_index).Num(template_num).IsValid()) { + score += kMismatchedTemplateNumberPenalty; + } + } + } + } + + // Now that all the template types have been finalized, we can construct the parameters. + utils::Vector parameters; + if (score == 0) { + parameters.Reserve(num_params); + for (size_t p = 0; p < num_params; p++) { + auto& parameter = overload->parameters[p]; + auto* indices = parameter.matcher_indices; + auto* ty = Match(templates, overload, indices).Type(args[p]->UnwrapRef()); + parameters.Emplace(ty, parameter.usage); + } + } + + return Candidate{overload, templates, parameters, score}; +} + +Impl::Candidate Impl::ResolveCandidate(Impl::Candidates&& candidates, + const char* intrinsic_name, + utils::VectorRef args, + TemplateState templates) const { + utils::Vector best_ranks; + best_ranks.Resize(args.Length(), 0xffffffff); + size_t num_matched = 0; + Candidate* best = nullptr; + for (auto& candidate : candidates) { + if (candidate.score > 0) { + continue; // Candidate has already been ruled out. + } + bool some_won = false; // An argument ranked less than the 'best' overload's argument + bool some_lost = false; // An argument ranked more than the 'best' overload's argument + for (size_t i = 0; i < args.Length(); i++) { + auto rank = sem::Type::ConversionRank(args[i], candidate.parameters[i].type); + if (best_ranks[i] > rank) { + best_ranks[i] = rank; + some_won = true; + } else if (best_ranks[i] < rank) { + some_lost = true; + } + } + // If no arguments of this candidate ranked worse than the previous best candidate, then + // this candidate becomes the new best candidate. + // If no arguments of this candidate ranked better than the previous best candidate, then + // this candidate is removed from the list of matches. + // If neither of the above apply, then we have two candidates with no clear winner, which + // results in an ambiguous overload error. In this situation the loop ends with + // `num_matched > 1`. + if (some_won) { + // One or more arguments of this candidate ranked better than the previous best + // candidate's argument(s). + num_matched++; + if (!some_lost) { + // All arguments were at as-good or better than the previous best. + if (best) { + // Mark the previous best candidate as no longer being in the running, by + // setting its score to a non-zero value. We pick 1 as this is the closest to 0 + // (match) as we can get. + best->score = 1; + num_matched--; + } + // This candidate is the new best. + best = &candidate; + } + } else { + // No arguments ranked better than the current best. + // Change the score of this candidate to a non-zero value, so that it's not considered a + // match. + candidate.score = 1; + } + } + + if (num_matched > 1) { + // Re-sort the candidates with the most promising first + SortCandidates(candidates); + // Raise an error + ErrAmbiguousOverload(intrinsic_name, args, templates, candidates); + return {}; + } + + return std::move(*best); +} + +MatchState Impl::Match(TemplateState& templates, + const OverloadInfo* overload, MatcherIndex const* matcher_indices) const { - return MatchState(builder, closed, matchers, overload, matcher_indices); + return MatchState(builder, templates, matchers, overload, matcher_indices); } void Impl::PrintOverload(std::ostream& ss, - const OverloadInfo& overload, - sem::BuiltinType builtin_type) const { - ClosedState closed(builder); + const OverloadInfo* overload, + const char* intrinsic_name) const { + TemplateState templates; - ss << builtin_type << "("; - for (uint32_t p = 0; p < overload.num_parameters; p++) { - auto& parameter = overload.parameters[p]; + ss << intrinsic_name << "("; + for (size_t p = 0; p < overload->num_parameters; p++) { + auto& parameter = overload->parameters[p]; if (p > 0) { ss << ", "; } @@ -1056,13 +1614,13 @@ void Impl::PrintOverload(std::ostream& ss, ss << sem::str(parameter.usage) << ": "; } auto* indices = parameter.matcher_indices; - ss << Match(closed, overload, indices).TypeName(); + ss << Match(templates, overload, indices).TypeName(); } ss << ")"; - if (overload.return_matcher_indices) { + if (overload->return_matcher_indices) { ss << " -> "; - auto* indices = overload.return_matcher_indices; - ss << Match(closed, overload, indices).TypeName(); + auto* indices = overload->return_matcher_indices; + ss << Match(templates, overload, indices).TypeName(); } bool first = true; @@ -1070,26 +1628,36 @@ void Impl::PrintOverload(std::ostream& ss, ss << (first ? " where: " : ", "); first = false; }; - for (uint32_t i = 0; i < overload.num_open_types; i++) { - auto& open_type = overload.open_types[i]; - if (open_type.matcher_index != kNoMatcher) { + for (size_t i = 0; i < overload->num_template_types; i++) { + auto& template_type = overload->template_types[i]; + if (template_type.matcher_index != kNoMatcher) { separator(); - ss << open_type.name; - auto* index = &open_type.matcher_index; - ss << " is " << Match(closed, overload, index).TypeName(); + ss << template_type.name; + auto* index = &template_type.matcher_index; + ss << " is " << Match(templates, overload, index).TypeName(); } } - for (uint32_t i = 0; i < overload.num_open_numbers; i++) { - auto& open_number = overload.open_numbers[i]; - if (open_number.matcher_index != kNoMatcher) { + for (size_t i = 0; i < overload->num_template_numbers; i++) { + auto& template_number = overload->template_numbers[i]; + if (template_number.matcher_index != kNoMatcher) { separator(); - ss << open_number.name; - auto* index = &open_number.matcher_index; - ss << " is " << Match(closed, overload, index).NumName(); + ss << template_number.name; + auto* index = &template_number.matcher_index; + ss << " is " << Match(templates, overload, index).NumName(); } } } +void Impl::PrintCandidates(std::ostream& ss, + utils::VectorRef candidates, + const char* intrinsic_name) const { + for (auto& candidate : candidates) { + ss << " "; + PrintOverload(ss, candidate.overload, intrinsic_name); + ss << std::endl; + } +} + const sem::Type* MatchState::Type(const sem::Type* ty) { MatcherIndex matcher_index = *matcher_indices_++; auto* matcher = matchers.type[matcher_index]; @@ -1105,13 +1673,49 @@ Number MatchState::Num(Number number) { std::string MatchState::TypeName() { MatcherIndex matcher_index = *matcher_indices_++; auto* matcher = matchers.type[matcher_index]; - return matcher->String(*this); + return matcher->String(this); } std::string MatchState::NumName() { MatcherIndex matcher_index = *matcher_indices_++; auto* matcher = matchers.number[matcher_index]; - return matcher->String(*this); + return matcher->String(this); +} + +void Impl::ErrAmbiguousOverload(const char* intrinsic_name, + utils::VectorRef args, + TemplateState templates, + utils::VectorRef candidates) const { + std::stringstream ss; + ss << "ambiguous overload while attempting to match " << intrinsic_name; + for (size_t i = 0; i < std::numeric_limits::max(); i++) { + if (auto* ty = templates.Type(i)) { + ss << ((i == 0) ? "<" : ", ") << ty->FriendlyName(builder.Symbols()); + } else { + if (i > 0) { + ss << ">"; + } + break; + } + } + ss << "("; + bool first = true; + for (auto* arg : args) { + if (!first) { + ss << ", "; + } + first = false; + ss << arg->FriendlyName(builder.Symbols()); + } + ss << "):\n"; + for (auto& candidate : candidates) { + if (candidate.score == 0) { + ss << " "; + PrintOverload(ss, candidate.overload, intrinsic_name); + ss << std::endl; + } + } + TINT_ICE(Resolver, builder.Diagnostics()) << ss.str(); } } // namespace @@ -1122,7 +1726,7 @@ std::unique_ptr IntrinsicTable::Create(ProgramBuilder& builder) IntrinsicTable::~IntrinsicTable() = default; -/// TypeInfo for the Any type declared in the anonymous namespace above -TINT_INSTANTIATE_TYPEINFO(Any); +} // namespace tint::resolver -} // namespace tint +/// TypeInfo for the Any type declared in the anonymous namespace above +TINT_INSTANTIATE_TYPEINFO(tint::resolver::Any); diff --git a/src/tint/resolver/intrinsic_table.h b/src/tint/resolver/intrinsic_table.h index e9760a5696..b36f8d8a60 100644 --- a/src/tint/resolver/intrinsic_table.h +++ b/src/tint/resolver/intrinsic_table.h @@ -17,18 +17,22 @@ #include #include -#include +#include "src/tint/ast/binary_expression.h" +#include "src/tint/ast/unary_op.h" +#include "src/tint/resolver/const_eval.h" +#include "src/tint/resolver/ctor_conv_intrinsic.h" #include "src/tint/sem/builtin.h" +#include "src/tint/utils/vector.h" // Forward declarations namespace tint { class ProgramBuilder; } // namespace tint -namespace tint { +namespace tint::resolver { -/// IntrinsicTable is a lookup table of all the WGSL builtin functions +/// IntrinsicTable is a lookup table of all the WGSL builtin functions and intrinsic operators class IntrinsicTable { public: /// @param builder the program builder @@ -38,17 +42,91 @@ class IntrinsicTable { /// Destructor virtual ~IntrinsicTable(); - /// Lookup looks for the builtin overload with the given signature, raising - /// an error diagnostic if the builtin was not found. + /// Builtin describes a resolved builtin function + struct Builtin { + /// The semantic info for the builtin + const sem::Builtin* sem = nullptr; + /// The constant evaluation function + ConstEval::Function const_eval_fn = nullptr; + }; + + /// UnaryOperator describes a resolved unary operator + struct UnaryOperator { + /// The result type of the unary operator + const sem::Type* result = nullptr; + /// The type of the parameter of the unary operator + const sem::Type* parameter = nullptr; + /// The constant evaluation function + ConstEval::Function const_eval_fn = nullptr; + }; + + /// BinaryOperator describes a resolved binary operator + struct BinaryOperator { + /// The result type of the binary operator + const sem::Type* result = nullptr; + /// The type of LHS parameter of the binary operator + const sem::Type* lhs = nullptr; + /// The type of RHS parameter of the binary operator + const sem::Type* rhs = nullptr; + /// The constant evaluation function + ConstEval::Function const_eval_fn = nullptr; + }; + + /// CtorOrConv describes a resolved type constructor or type conversion + struct CtorOrConv { + /// The result type of the type constructor or type conversion + const sem::CallTarget* target = nullptr; + /// The constant evaluation function + ConstEval::Function const_eval_fn = nullptr; + }; + + /// Lookup looks for the builtin overload with the given signature, raising an error diagnostic + /// if the builtin was not found. /// @param type the builtin type /// @param args the argument types passed to the builtin function /// @param source the source of the builtin call /// @return the semantic builtin if found, otherwise nullptr - virtual const sem::Builtin* Lookup(sem::BuiltinType type, - const std::vector& args, - const Source& source) = 0; + virtual Builtin Lookup(sem::BuiltinType type, + utils::VectorRef args, + const Source& source) = 0; + + /// Lookup looks for the unary op overload with the given signature, raising an error + /// diagnostic if the operator was not found. + /// @param op the unary operator + /// @param arg the type of the expression passed to the operator + /// @param source the source of the operator call + /// @return the operator call target signature. If the operator was not found + /// UnaryOperator::result will be nullptr. + virtual UnaryOperator Lookup(ast::UnaryOp op, const sem::Type* arg, const Source& source) = 0; + + /// Lookup looks for the binary op overload with the given signature, raising an error + /// diagnostic if the operator was not found. + /// @param op the binary operator + /// @param lhs the LHS value type passed to the operator + /// @param rhs the RHS value type passed to the operator + /// @param source the source of the operator call + /// @param is_compound true if the binary operator is being used as a compound assignment + /// @return the operator call target signature. If the operator was not found + /// BinaryOperator::result will be nullptr. + virtual BinaryOperator Lookup(ast::BinaryOp op, + const sem::Type* lhs, + const sem::Type* rhs, + const Source& source, + bool is_compound) = 0; + + /// Lookup looks for the type constructor or conversion overload for the given + /// CtorConvIntrinsic. + /// @param type the type being constructed or converted + /// @param template_arg the optional template argument + /// @param args the argument types passed to the constructor / conversion call + /// @param source the source of the call + /// @return a sem::TypeConstructor, sem::TypeConversion or nullptr if nothing matched + virtual CtorOrConv Lookup(CtorConvIntrinsic type, + const sem::Type* template_arg, + utils::VectorRef args, + const Source& source) = 0; }; -} // namespace tint +} // namespace tint::resolver #endif // SRC_TINT_RESOLVER_INTRINSIC_TABLE_H_ diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl index fa48359728..c589b2f66e 100644 --- a/src/tint/resolver/intrinsic_table.inl +++ b/src/tint/resolver/intrinsic_table.inl @@ -13,11 +13,9 @@ // limitations under the License. //////////////////////////////////////////////////////////////////////////////// -// File generated by tools/builtin-gen +// File generated by tools/src/cmd/gen // using the template: -// src/tint/builtin_table.inl.tmpl -// and the builtin defintion file: -// src/tint/builtins.def +// src/tint/resolver/intrinsic_table.inl.tmpl // // Do not modify this file directly //////////////////////////////////////////////////////////////////////////////// @@ -25,11 +23,10 @@ // clang-format off /// TypeMatcher for 'type bool' -/// @see src/tint/builtins.def:68:6 class Bool : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -37,7 +34,7 @@ class Bool : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Bool::Match(MatchState& state, const sem::Type* ty) const { @@ -47,16 +44,15 @@ const sem::Type* Bool::Match(MatchState& state, const sem::Type* ty) const { return build_bool(state); } -std::string Bool::String(MatchState&) const { +std::string Bool::String(MatchState*) const { return "bool"; } -/// TypeMatcher for 'type f32' -/// @see src/tint/builtins.def:69:6 -class F32 : public TypeMatcher { +/// TypeMatcher for 'type fa' +class Fa : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -64,26 +60,55 @@ class F32 : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; -const sem::Type* F32::Match(MatchState& state, const sem::Type* ty) const { - if (!match_f32(ty)) { +const sem::Type* Fa::Match(MatchState& state, const sem::Type* ty) const { + if (!match_fa(ty)) { return nullptr; } - return build_f32(state); + return build_fa(state); } -std::string F32::String(MatchState&) const { - return "f32"; +std::string Fa::String(MatchState*) const { + std::stringstream ss; + ss << "abstract-float"; + return ss.str(); +} + +/// TypeMatcher for 'type ia' +class Ia : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Ia::Match(MatchState& state, const sem::Type* ty) const { + if (!match_ia(ty)) { + return nullptr; + } + return build_ia(state); +} + +std::string Ia::String(MatchState*) const { + std::stringstream ss; + ss << "abstract-int"; + return ss.str(); } /// TypeMatcher for 'type i32' -/// @see src/tint/builtins.def:70:6 class I32 : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -91,7 +116,7 @@ class I32 : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* I32::Match(MatchState& state, const sem::Type* ty) const { @@ -101,16 +126,15 @@ const sem::Type* I32::Match(MatchState& state, const sem::Type* ty) const { return build_i32(state); } -std::string I32::String(MatchState&) const { +std::string I32::String(MatchState*) const { return "i32"; } /// TypeMatcher for 'type u32' -/// @see src/tint/builtins.def:71:6 class U32 : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -118,7 +142,7 @@ class U32 : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* U32::Match(MatchState& state, const sem::Type* ty) const { @@ -128,16 +152,15 @@ const sem::Type* U32::Match(MatchState& state, const sem::Type* ty) const { return build_u32(state); } -std::string U32::String(MatchState&) const { +std::string U32::String(MatchState*) const { return "u32"; } -/// TypeMatcher for 'type vec2' -/// @see src/tint/builtins.def:72:6 -class Vec2 : public TypeMatcher { +/// TypeMatcher for 'type f32' +class F32 : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -145,7 +168,59 @@ class Vec2 : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; +}; + +const sem::Type* F32::Match(MatchState& state, const sem::Type* ty) const { + if (!match_f32(ty)) { + return nullptr; + } + return build_f32(state); +} + +std::string F32::String(MatchState*) const { + return "f32"; +} + +/// TypeMatcher for 'type f16' +class F16 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* F16::Match(MatchState& state, const sem::Type* ty) const { + if (!match_f16(ty)) { + return nullptr; + } + return build_f16(state); +} + +std::string F16::String(MatchState*) const { + return "f16"; +} + +/// TypeMatcher for 'type vec2' +class Vec2 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; }; const sem::Type* Vec2::Match(MatchState& state, const sem::Type* ty) const { @@ -160,17 +235,16 @@ const sem::Type* Vec2::Match(MatchState& state, const sem::Type* ty) const { return build_vec2(state, T); } -std::string Vec2::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string Vec2::String(MatchState* state) const { + const std::string T = state->TypeName(); return "vec2<" + T + ">"; } /// TypeMatcher for 'type vec3' -/// @see src/tint/builtins.def:73:6 class Vec3 : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -178,7 +252,7 @@ class Vec3 : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Vec3::Match(MatchState& state, const sem::Type* ty) const { @@ -193,17 +267,16 @@ const sem::Type* Vec3::Match(MatchState& state, const sem::Type* ty) const { return build_vec3(state, T); } -std::string Vec3::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string Vec3::String(MatchState* state) const { + const std::string T = state->TypeName(); return "vec3<" + T + ">"; } /// TypeMatcher for 'type vec4' -/// @see src/tint/builtins.def:74:6 class Vec4 : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -211,7 +284,7 @@ class Vec4 : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Vec4::Match(MatchState& state, const sem::Type* ty) const { @@ -226,17 +299,16 @@ const sem::Type* Vec4::Match(MatchState& state, const sem::Type* ty) const { return build_vec4(state, T); } -std::string Vec4::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string Vec4::String(MatchState* state) const { + const std::string T = state->TypeName(); return "vec4<" + T + ">"; } -/// TypeMatcher for 'type vec' -/// @see src/tint/builtins.def:75:37 -class Vec : public TypeMatcher { +/// TypeMatcher for 'type mat2x2' +class Mat2X2 : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -244,7 +316,295 @@ class Vec : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; +}; + +const sem::Type* Mat2X2::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_mat2x2(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_mat2x2(state, T); +} + +std::string Mat2X2::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "mat2x2<" + T + ">"; +} + +/// TypeMatcher for 'type mat2x3' +class Mat2X3 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Mat2X3::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_mat2x3(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_mat2x3(state, T); +} + +std::string Mat2X3::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "mat2x3<" + T + ">"; +} + +/// TypeMatcher for 'type mat2x4' +class Mat2X4 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Mat2X4::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_mat2x4(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_mat2x4(state, T); +} + +std::string Mat2X4::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "mat2x4<" + T + ">"; +} + +/// TypeMatcher for 'type mat3x2' +class Mat3X2 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Mat3X2::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_mat3x2(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_mat3x2(state, T); +} + +std::string Mat3X2::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "mat3x2<" + T + ">"; +} + +/// TypeMatcher for 'type mat3x3' +class Mat3X3 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Mat3X3::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_mat3x3(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_mat3x3(state, T); +} + +std::string Mat3X3::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "mat3x3<" + T + ">"; +} + +/// TypeMatcher for 'type mat3x4' +class Mat3X4 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Mat3X4::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_mat3x4(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_mat3x4(state, T); +} + +std::string Mat3X4::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "mat3x4<" + T + ">"; +} + +/// TypeMatcher for 'type mat4x2' +class Mat4X2 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Mat4X2::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_mat4x2(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_mat4x2(state, T); +} + +std::string Mat4X2::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "mat4x2<" + T + ">"; +} + +/// TypeMatcher for 'type mat4x3' +class Mat4X3 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Mat4X3::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_mat4x3(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_mat4x3(state, T); +} + +std::string Mat4X3::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "mat4x3<" + T + ">"; +} + +/// TypeMatcher for 'type mat4x4' +class Mat4X4 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Mat4X4::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_mat4x4(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_mat4x4(state, T); +} + +std::string Mat4X4::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "mat4x4<" + T + ">"; +} + +/// TypeMatcher for 'type vec' +class Vec : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; }; const sem::Type* Vec::Match(MatchState& state, const sem::Type* ty) const { @@ -264,20 +624,19 @@ const sem::Type* Vec::Match(MatchState& state, const sem::Type* ty) const { return build_vec(state, N, T); } -std::string Vec::String(MatchState& state) const { - const std::string N = state.NumName(); - const std::string T = state.TypeName(); +std::string Vec::String(MatchState* state) const { + const std::string N = state->NumName(); + const std::string T = state->TypeName(); std::stringstream ss; ss << "vec" << N << "<" << T << ">"; return ss.str(); } /// TypeMatcher for 'type mat' -/// @see src/tint/builtins.def:76:37 class Mat : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -285,7 +644,7 @@ class Mat : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Mat::Match(MatchState& state, const sem::Type* ty) const { @@ -310,21 +669,20 @@ const sem::Type* Mat::Match(MatchState& state, const sem::Type* ty) const { return build_mat(state, N, M, T); } -std::string Mat::String(MatchState& state) const { - const std::string N = state.NumName(); - const std::string M = state.NumName(); - const std::string T = state.TypeName(); +std::string Mat::String(MatchState* state) const { + const std::string N = state->NumName(); + const std::string M = state->NumName(); + const std::string T = state->TypeName(); std::stringstream ss; ss << "mat" << N << "x" << M << "<" << T << ">"; return ss.str(); } /// TypeMatcher for 'type ptr' -/// @see src/tint/builtins.def:77:6 class Ptr : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -332,7 +690,7 @@ class Ptr : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Ptr::Match(MatchState& state, const sem::Type* ty) const { @@ -357,19 +715,18 @@ const sem::Type* Ptr::Match(MatchState& state, const sem::Type* ty) const { return build_ptr(state, S, T, A); } -std::string Ptr::String(MatchState& state) const { - const std::string S = state.NumName(); - const std::string T = state.TypeName(); - const std::string A = state.NumName(); +std::string Ptr::String(MatchState* state) const { + const std::string S = state->NumName(); + const std::string T = state->TypeName(); + const std::string A = state->NumName(); return "ptr<" + S + ", " + T + ", " + A + ">"; } /// TypeMatcher for 'type atomic' -/// @see src/tint/builtins.def:78:6 class Atomic : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -377,7 +734,7 @@ class Atomic : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Atomic::Match(MatchState& state, const sem::Type* ty) const { @@ -392,17 +749,16 @@ const sem::Type* Atomic::Match(MatchState& state, const sem::Type* ty) const { return build_atomic(state, T); } -std::string Atomic::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string Atomic::String(MatchState* state) const { + const std::string T = state->TypeName(); return "atomic<" + T + ">"; } /// TypeMatcher for 'type array' -/// @see src/tint/builtins.def:79:6 class Array : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -410,7 +766,7 @@ class Array : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Array::Match(MatchState& state, const sem::Type* ty) const { @@ -425,17 +781,16 @@ const sem::Type* Array::Match(MatchState& state, const sem::Type* ty) const { return build_array(state, T); } -std::string Array::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string Array::String(MatchState* state) const { + const std::string T = state->TypeName(); return "array<" + T + ">"; } /// TypeMatcher for 'type sampler' -/// @see src/tint/builtins.def:80:6 class Sampler : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -443,7 +798,7 @@ class Sampler : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Sampler::Match(MatchState& state, const sem::Type* ty) const { @@ -453,16 +808,15 @@ const sem::Type* Sampler::Match(MatchState& state, const sem::Type* ty) const { return build_sampler(state); } -std::string Sampler::String(MatchState&) const { +std::string Sampler::String(MatchState*) const { return "sampler"; } /// TypeMatcher for 'type sampler_comparison' -/// @see src/tint/builtins.def:81:6 class SamplerComparison : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -470,7 +824,7 @@ class SamplerComparison : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* SamplerComparison::Match(MatchState& state, const sem::Type* ty) const { @@ -480,16 +834,15 @@ const sem::Type* SamplerComparison::Match(MatchState& state, const sem::Type* ty return build_sampler_comparison(state); } -std::string SamplerComparison::String(MatchState&) const { +std::string SamplerComparison::String(MatchState*) const { return "sampler_comparison"; } /// TypeMatcher for 'type texture_1d' -/// @see src/tint/builtins.def:82:6 class Texture1D : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -497,7 +850,7 @@ class Texture1D : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Texture1D::Match(MatchState& state, const sem::Type* ty) const { @@ -512,17 +865,16 @@ const sem::Type* Texture1D::Match(MatchState& state, const sem::Type* ty) const return build_texture_1d(state, T); } -std::string Texture1D::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string Texture1D::String(MatchState* state) const { + const std::string T = state->TypeName(); return "texture_1d<" + T + ">"; } /// TypeMatcher for 'type texture_2d' -/// @see src/tint/builtins.def:83:6 class Texture2D : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -530,7 +882,7 @@ class Texture2D : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Texture2D::Match(MatchState& state, const sem::Type* ty) const { @@ -545,17 +897,16 @@ const sem::Type* Texture2D::Match(MatchState& state, const sem::Type* ty) const return build_texture_2d(state, T); } -std::string Texture2D::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string Texture2D::String(MatchState* state) const { + const std::string T = state->TypeName(); return "texture_2d<" + T + ">"; } /// TypeMatcher for 'type texture_2d_array' -/// @see src/tint/builtins.def:84:6 class Texture2DArray : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -563,7 +914,7 @@ class Texture2DArray : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Texture2DArray::Match(MatchState& state, const sem::Type* ty) const { @@ -578,17 +929,16 @@ const sem::Type* Texture2DArray::Match(MatchState& state, const sem::Type* ty) c return build_texture_2d_array(state, T); } -std::string Texture2DArray::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string Texture2DArray::String(MatchState* state) const { + const std::string T = state->TypeName(); return "texture_2d_array<" + T + ">"; } /// TypeMatcher for 'type texture_3d' -/// @see src/tint/builtins.def:85:6 class Texture3D : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -596,7 +946,7 @@ class Texture3D : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* Texture3D::Match(MatchState& state, const sem::Type* ty) const { @@ -611,17 +961,16 @@ const sem::Type* Texture3D::Match(MatchState& state, const sem::Type* ty) const return build_texture_3d(state, T); } -std::string Texture3D::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string Texture3D::String(MatchState* state) const { + const std::string T = state->TypeName(); return "texture_3d<" + T + ">"; } /// TypeMatcher for 'type texture_cube' -/// @see src/tint/builtins.def:86:6 class TextureCube : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -629,7 +978,7 @@ class TextureCube : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureCube::Match(MatchState& state, const sem::Type* ty) const { @@ -644,17 +993,16 @@ const sem::Type* TextureCube::Match(MatchState& state, const sem::Type* ty) cons return build_texture_cube(state, T); } -std::string TextureCube::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string TextureCube::String(MatchState* state) const { + const std::string T = state->TypeName(); return "texture_cube<" + T + ">"; } /// TypeMatcher for 'type texture_cube_array' -/// @see src/tint/builtins.def:87:6 class TextureCubeArray : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -662,7 +1010,7 @@ class TextureCubeArray : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureCubeArray::Match(MatchState& state, const sem::Type* ty) const { @@ -677,17 +1025,16 @@ const sem::Type* TextureCubeArray::Match(MatchState& state, const sem::Type* ty) return build_texture_cube_array(state, T); } -std::string TextureCubeArray::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string TextureCubeArray::String(MatchState* state) const { + const std::string T = state->TypeName(); return "texture_cube_array<" + T + ">"; } /// TypeMatcher for 'type texture_multisampled_2d' -/// @see src/tint/builtins.def:88:6 class TextureMultisampled2D : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -695,7 +1042,7 @@ class TextureMultisampled2D : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureMultisampled2D::Match(MatchState& state, const sem::Type* ty) const { @@ -710,17 +1057,16 @@ const sem::Type* TextureMultisampled2D::Match(MatchState& state, const sem::Type return build_texture_multisampled_2d(state, T); } -std::string TextureMultisampled2D::String(MatchState& state) const { - const std::string T = state.TypeName(); +std::string TextureMultisampled2D::String(MatchState* state) const { + const std::string T = state->TypeName(); return "texture_multisampled_2d<" + T + ">"; } /// TypeMatcher for 'type texture_depth_2d' -/// @see src/tint/builtins.def:89:6 class TextureDepth2D : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -728,7 +1074,7 @@ class TextureDepth2D : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureDepth2D::Match(MatchState& state, const sem::Type* ty) const { @@ -738,16 +1084,15 @@ const sem::Type* TextureDepth2D::Match(MatchState& state, const sem::Type* ty) c return build_texture_depth_2d(state); } -std::string TextureDepth2D::String(MatchState&) const { +std::string TextureDepth2D::String(MatchState*) const { return "texture_depth_2d"; } /// TypeMatcher for 'type texture_depth_2d_array' -/// @see src/tint/builtins.def:90:6 class TextureDepth2DArray : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -755,7 +1100,7 @@ class TextureDepth2DArray : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureDepth2DArray::Match(MatchState& state, const sem::Type* ty) const { @@ -765,16 +1110,15 @@ const sem::Type* TextureDepth2DArray::Match(MatchState& state, const sem::Type* return build_texture_depth_2d_array(state); } -std::string TextureDepth2DArray::String(MatchState&) const { +std::string TextureDepth2DArray::String(MatchState*) const { return "texture_depth_2d_array"; } /// TypeMatcher for 'type texture_depth_cube' -/// @see src/tint/builtins.def:91:6 class TextureDepthCube : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -782,7 +1126,7 @@ class TextureDepthCube : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureDepthCube::Match(MatchState& state, const sem::Type* ty) const { @@ -792,16 +1136,15 @@ const sem::Type* TextureDepthCube::Match(MatchState& state, const sem::Type* ty) return build_texture_depth_cube(state); } -std::string TextureDepthCube::String(MatchState&) const { +std::string TextureDepthCube::String(MatchState*) const { return "texture_depth_cube"; } /// TypeMatcher for 'type texture_depth_cube_array' -/// @see src/tint/builtins.def:92:6 class TextureDepthCubeArray : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -809,7 +1152,7 @@ class TextureDepthCubeArray : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureDepthCubeArray::Match(MatchState& state, const sem::Type* ty) const { @@ -819,16 +1162,15 @@ const sem::Type* TextureDepthCubeArray::Match(MatchState& state, const sem::Type return build_texture_depth_cube_array(state); } -std::string TextureDepthCubeArray::String(MatchState&) const { +std::string TextureDepthCubeArray::String(MatchState*) const { return "texture_depth_cube_array"; } /// TypeMatcher for 'type texture_depth_multisampled_2d' -/// @see src/tint/builtins.def:93:6 class TextureDepthMultisampled2D : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -836,7 +1178,7 @@ class TextureDepthMultisampled2D : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureDepthMultisampled2D::Match(MatchState& state, const sem::Type* ty) const { @@ -846,16 +1188,15 @@ const sem::Type* TextureDepthMultisampled2D::Match(MatchState& state, const sem: return build_texture_depth_multisampled_2d(state); } -std::string TextureDepthMultisampled2D::String(MatchState&) const { +std::string TextureDepthMultisampled2D::String(MatchState*) const { return "texture_depth_multisampled_2d"; } /// TypeMatcher for 'type texture_storage_1d' -/// @see src/tint/builtins.def:94:6 class TextureStorage1D : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -863,7 +1204,7 @@ class TextureStorage1D : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureStorage1D::Match(MatchState& state, const sem::Type* ty) const { @@ -883,18 +1224,17 @@ const sem::Type* TextureStorage1D::Match(MatchState& state, const sem::Type* ty) return build_texture_storage_1d(state, F, A); } -std::string TextureStorage1D::String(MatchState& state) const { - const std::string F = state.NumName(); - const std::string A = state.NumName(); +std::string TextureStorage1D::String(MatchState* state) const { + const std::string F = state->NumName(); + const std::string A = state->NumName(); return "texture_storage_1d<" + F + ", " + A + ">"; } /// TypeMatcher for 'type texture_storage_2d' -/// @see src/tint/builtins.def:95:6 class TextureStorage2D : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -902,7 +1242,7 @@ class TextureStorage2D : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureStorage2D::Match(MatchState& state, const sem::Type* ty) const { @@ -922,18 +1262,17 @@ const sem::Type* TextureStorage2D::Match(MatchState& state, const sem::Type* ty) return build_texture_storage_2d(state, F, A); } -std::string TextureStorage2D::String(MatchState& state) const { - const std::string F = state.NumName(); - const std::string A = state.NumName(); +std::string TextureStorage2D::String(MatchState* state) const { + const std::string F = state->NumName(); + const std::string A = state->NumName(); return "texture_storage_2d<" + F + ", " + A + ">"; } /// TypeMatcher for 'type texture_storage_2d_array' -/// @see src/tint/builtins.def:96:6 class TextureStorage2DArray : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -941,7 +1280,7 @@ class TextureStorage2DArray : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureStorage2DArray::Match(MatchState& state, const sem::Type* ty) const { @@ -961,18 +1300,17 @@ const sem::Type* TextureStorage2DArray::Match(MatchState& state, const sem::Type return build_texture_storage_2d_array(state, F, A); } -std::string TextureStorage2DArray::String(MatchState& state) const { - const std::string F = state.NumName(); - const std::string A = state.NumName(); +std::string TextureStorage2DArray::String(MatchState* state) const { + const std::string F = state->NumName(); + const std::string A = state->NumName(); return "texture_storage_2d_array<" + F + ", " + A + ">"; } /// TypeMatcher for 'type texture_storage_3d' -/// @see src/tint/builtins.def:97:6 class TextureStorage3D : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -980,7 +1318,7 @@ class TextureStorage3D : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureStorage3D::Match(MatchState& state, const sem::Type* ty) const { @@ -1000,18 +1338,17 @@ const sem::Type* TextureStorage3D::Match(MatchState& state, const sem::Type* ty) return build_texture_storage_3d(state, F, A); } -std::string TextureStorage3D::String(MatchState& state) const { - const std::string F = state.NumName(); - const std::string A = state.NumName(); +std::string TextureStorage3D::String(MatchState* state) const { + const std::string F = state->NumName(); + const std::string A = state->NumName(); return "texture_storage_3d<" + F + ", " + A + ">"; } /// TypeMatcher for 'type texture_external' -/// @see src/tint/builtins.def:98:6 class TextureExternal : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -1019,7 +1356,7 @@ class TextureExternal : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* TextureExternal::Match(MatchState& state, const sem::Type* ty) const { @@ -1029,16 +1366,15 @@ const sem::Type* TextureExternal::Match(MatchState& state, const sem::Type* ty) return build_texture_external(state); } -std::string TextureExternal::String(MatchState&) const { +std::string TextureExternal::String(MatchState*) const { return "texture_external"; } /// TypeMatcher for 'type __modf_result' -/// @see src/tint/builtins.def:100:6 class ModfResult : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -1046,26 +1382,33 @@ class ModfResult : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* ModfResult::Match(MatchState& state, const sem::Type* ty) const { - if (!match_modf_result(ty)) { + const sem::Type* T = nullptr; + if (!match_modf_result(ty, T)) { return nullptr; } - return build_modf_result(state); + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_modf_result(state, T); } -std::string ModfResult::String(MatchState&) const { - return "__modf_result"; +std::string ModfResult::String(MatchState* state) const { + const std::string T = state->TypeName(); + std::stringstream ss; + ss << "__modf_result_" << T; + return ss.str(); } /// TypeMatcher for 'type __modf_result_vec' -/// @see src/tint/builtins.def:101:42 class ModfResultVec : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -1073,34 +1416,39 @@ class ModfResultVec : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* ModfResultVec::Match(MatchState& state, const sem::Type* ty) const { Number N = Number::invalid; - if (!match_modf_result_vec(ty, N)) { + const sem::Type* T = nullptr; + if (!match_modf_result_vec(ty, N, T)) { return nullptr; } N = state.Num(N); if (!N.IsValid()) { return nullptr; } - return build_modf_result_vec(state, N); + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_modf_result_vec(state, N, T); } -std::string ModfResultVec::String(MatchState& state) const { - const std::string N = state.NumName(); +std::string ModfResultVec::String(MatchState* state) const { + const std::string N = state->NumName(); + const std::string T = state->TypeName(); std::stringstream ss; - ss << "__modf_result_vec" << N; + ss << "__modf_result_vec" << N << "_" << T; return ss.str(); } /// TypeMatcher for 'type __frexp_result' -/// @see src/tint/builtins.def:102:6 class FrexpResult : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -1108,26 +1456,33 @@ class FrexpResult : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* FrexpResult::Match(MatchState& state, const sem::Type* ty) const { - if (!match_frexp_result(ty)) { + const sem::Type* T = nullptr; + if (!match_frexp_result(ty, T)) { return nullptr; } - return build_frexp_result(state); + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_frexp_result(state, T); } -std::string FrexpResult::String(MatchState&) const { - return "__frexp_result"; +std::string FrexpResult::String(MatchState* state) const { + const std::string T = state->TypeName(); + std::stringstream ss; + ss << "__frexp_result_" << T; + return ss.str(); } /// TypeMatcher for 'type __frexp_result_vec' -/// @see src/tint/builtins.def:103:43 class FrexpResultVec : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -1135,35 +1490,39 @@ class FrexpResultVec : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* FrexpResultVec::Match(MatchState& state, const sem::Type* ty) const { Number N = Number::invalid; - if (!match_frexp_result_vec(ty, N)) { + const sem::Type* T = nullptr; + if (!match_frexp_result_vec(ty, N, T)) { return nullptr; } N = state.Num(N); if (!N.IsValid()) { return nullptr; } - return build_frexp_result_vec(state, N); + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_frexp_result_vec(state, N, T); } -std::string FrexpResultVec::String(MatchState& state) const { - const std::string N = state.NumName(); +std::string FrexpResultVec::String(MatchState* state) const { + const std::string N = state->NumName(); + const std::string T = state->TypeName(); std::stringstream ss; - ss << "__frexp_result_vec" << N; + ss << "__frexp_result_vec" << N << "_" << T; return ss.str(); } -/// TypeMatcher for 'match fiu32' -/// @see src/tint/builtins.def:111:7 -class Fiu32 : public TypeMatcher { +/// TypeMatcher for 'type __atomic_compare_exchange_result' +class AtomicCompareExchangeResult : public TypeMatcher { public: - /// Checks whether the given type matches the matcher rules, and returns the - /// expected, canonicalized type on success. - /// Match may close open types and numbers in state. + /// Checks whether the given type matches the matcher rules. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -1171,13 +1530,541 @@ class Fiu32 : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; -const sem::Type* Fiu32::Match(MatchState& state, const sem::Type* ty) const { +const sem::Type* AtomicCompareExchangeResult::Match(MatchState& state, const sem::Type* ty) const { + const sem::Type* T = nullptr; + if (!match_atomic_compare_exchange_result(ty, T)) { + return nullptr; + } + T = state.Type(T); + if (T == nullptr) { + return nullptr; + } + return build_atomic_compare_exchange_result(state, T); +} + +std::string AtomicCompareExchangeResult::String(MatchState* state) const { + const std::string T = state->TypeName(); + return "__atomic_compare_exchange_result<" + T + ">"; +} + +/// TypeMatcher for 'match abstract_or_scalar' +class AbstractOrScalar : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* AbstractOrScalar::Match(MatchState& state, const sem::Type* ty) const { + if (match_fa(ty)) { + return build_fa(state); + } + if (match_ia(ty)) { + return build_ia(state); + } + if (match_i32(ty)) { + return build_i32(state); + } + if (match_u32(ty)) { + return build_u32(state); + } if (match_f32(ty)) { return build_f32(state); } + if (match_f16(ty)) { + return build_f16(state); + } + if (match_bool(ty)) { + return build_bool(state); + } + return nullptr; +} + +std::string AbstractOrScalar::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << Ia().String(nullptr) << ", " << Fa().String(nullptr) << ", " << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match scalar' +class Scalar : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Scalar::Match(MatchState& state, const sem::Type* ty) const { + if (match_i32(ty)) { + return build_i32(state); + } + if (match_u32(ty)) { + return build_u32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + if (match_bool(ty)) { + return build_bool(state); + } + return nullptr; +} + +std::string Scalar::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match scalar_no_f32' +class ScalarNoF32 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* ScalarNoF32::Match(MatchState& state, const sem::Type* ty) const { + if (match_i32(ty)) { + return build_i32(state); + } + if (match_u32(ty)) { + return build_u32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + if (match_bool(ty)) { + return build_bool(state); + } + return nullptr; +} + +std::string ScalarNoF32::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << I32().String(nullptr) << ", " << F16().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match scalar_no_f16' +class ScalarNoF16 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* ScalarNoF16::Match(MatchState& state, const sem::Type* ty) const { + if (match_i32(ty)) { + return build_i32(state); + } + if (match_u32(ty)) { + return build_u32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_bool(ty)) { + return build_bool(state); + } + return nullptr; +} + +std::string ScalarNoF16::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match scalar_no_i32' +class ScalarNoI32 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* ScalarNoI32::Match(MatchState& state, const sem::Type* ty) const { + if (match_u32(ty)) { + return build_u32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + if (match_bool(ty)) { + return build_bool(state); + } + return nullptr; +} + +std::string ScalarNoI32::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match scalar_no_u32' +class ScalarNoU32 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* ScalarNoU32::Match(MatchState& state, const sem::Type* ty) const { + if (match_i32(ty)) { + return build_i32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + if (match_bool(ty)) { + return build_bool(state); + } + return nullptr; +} + +std::string ScalarNoU32::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << I32().String(nullptr) << " or " << Bool().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match scalar_no_bool' +class ScalarNoBool : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* ScalarNoBool::Match(MatchState& state, const sem::Type* ty) const { + if (match_i32(ty)) { + return build_i32(state); + } + if (match_u32(ty)) { + return build_u32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + return nullptr; +} + +std::string ScalarNoBool::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << I32().String(nullptr) << " or " << U32().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match fia_fiu32_f16' +class FiaFiu32F16 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* FiaFiu32F16::Match(MatchState& state, const sem::Type* ty) const { + if (match_fa(ty)) { + return build_fa(state); + } + if (match_ia(ty)) { + return build_ia(state); + } + if (match_i32(ty)) { + return build_i32(state); + } + if (match_u32(ty)) { + return build_u32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + return nullptr; +} + +std::string FiaFiu32F16::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << Fa().String(nullptr) << ", " << Ia().String(nullptr) << ", " << F32().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << F16().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match fia_fi32_f16' +class FiaFi32F16 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* FiaFi32F16::Match(MatchState& state, const sem::Type* ty) const { + if (match_fa(ty)) { + return build_fa(state); + } + if (match_ia(ty)) { + return build_ia(state); + } + if (match_i32(ty)) { + return build_i32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + return nullptr; +} + +std::string FiaFi32F16::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << Fa().String(nullptr) << ", " << Ia().String(nullptr) << ", " << F32().String(nullptr) << ", " << I32().String(nullptr) << " or " << F16().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match fia_fiu32' +class FiaFiu32 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* FiaFiu32::Match(MatchState& state, const sem::Type* ty) const { + if (match_fa(ty)) { + return build_fa(state); + } + if (match_ia(ty)) { + return build_ia(state); + } + if (match_i32(ty)) { + return build_i32(state); + } + if (match_u32(ty)) { + return build_u32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + return nullptr; +} + +std::string FiaFiu32::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << Fa().String(nullptr) << ", " << Ia().String(nullptr) << ", " << F32().String(nullptr) << ", " << I32().String(nullptr) << " or " << U32().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match fa_f32' +class FaF32 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* FaF32::Match(MatchState& state, const sem::Type* ty) const { + if (match_fa(ty)) { + return build_fa(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + return nullptr; +} + +std::string FaF32::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << Fa().String(nullptr) << " or " << F32().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match fa_f32_f16' +class FaF32F16 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* FaF32F16::Match(MatchState& state, const sem::Type* ty) const { + if (match_fa(ty)) { + return build_fa(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + return nullptr; +} + +std::string FaF32F16::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << Fa().String(nullptr) << ", " << F32().String(nullptr) << " or " << F16().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match ia_iu32' +class IaIu32 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* IaIu32::Match(MatchState& state, const sem::Type* ty) const { + if (match_ia(ty)) { + return build_ia(state); + } if (match_i32(ty)) { return build_i32(state); } @@ -1187,17 +2074,20 @@ const sem::Type* Fiu32::Match(MatchState& state, const sem::Type* ty) const { return nullptr; } -std::string Fiu32::String(MatchState&) const { - return "f32, i32 or u32"; +std::string IaIu32::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << Ia().String(nullptr) << ", " << I32().String(nullptr) << " or " << U32().String(nullptr); + return ss.str(); } -/// TypeMatcher for 'match iu32' -/// @see src/tint/builtins.def:112:7 -class Iu32 : public TypeMatcher { +/// TypeMatcher for 'match fiu32_f16' +class Fiu32F16 : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules, and returns the /// expected, canonicalized type on success. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -1205,7 +2095,189 @@ class Iu32 : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; +}; + +const sem::Type* Fiu32F16::Match(MatchState& state, const sem::Type* ty) const { + if (match_i32(ty)) { + return build_i32(state); + } + if (match_u32(ty)) { + return build_u32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + return nullptr; +} + +std::string Fiu32F16::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << F16().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match fiu32' +class Fiu32 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Fiu32::Match(MatchState& state, const sem::Type* ty) const { + if (match_i32(ty)) { + return build_i32(state); + } + if (match_u32(ty)) { + return build_u32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + return nullptr; +} + +std::string Fiu32::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << ", " << I32().String(nullptr) << " or " << U32().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match fi32_f16' +class Fi32F16 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Fi32F16::Match(MatchState& state, const sem::Type* ty) const { + if (match_i32(ty)) { + return build_i32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + return nullptr; +} + +std::string Fi32F16::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << ", " << I32().String(nullptr) << " or " << F16().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match fi32' +class Fi32 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* Fi32::Match(MatchState& state, const sem::Type* ty) const { + if (match_i32(ty)) { + return build_i32(state); + } + if (match_f32(ty)) { + return build_f32(state); + } + return nullptr; +} + +std::string Fi32::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << " or " << I32().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match f32_f16' +class F32F16 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; +}; + +const sem::Type* F32F16::Match(MatchState& state, const sem::Type* ty) const { + if (match_f32(ty)) { + return build_f32(state); + } + if (match_f16(ty)) { + return build_f16(state); + } + return nullptr; +} + +std::string F32F16::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << F32().String(nullptr) << " or " << F16().String(nullptr); + return ss.str(); +} + +/// TypeMatcher for 'match iu32' +class Iu32 : public TypeMatcher { + public: + /// Checks whether the given type matches the matcher rules, and returns the + /// expected, canonicalized type on success. + /// Match may define and refine the template types and numbers in state. + /// @param state the MatchState + /// @param type the type to match + /// @returns the canonicalized type on match, otherwise nullptr + const sem::Type* Match(MatchState& state, + const sem::Type* type) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; }; const sem::Type* Iu32::Match(MatchState& state, const sem::Type* ty) const { @@ -1218,60 +2290,26 @@ const sem::Type* Iu32::Match(MatchState& state, const sem::Type* ty) const { return nullptr; } -std::string Iu32::String(MatchState&) const { - return "i32 or u32"; -} - -/// TypeMatcher for 'match scalar' -/// @see src/tint/builtins.def:113:7 -class Scalar : public TypeMatcher { - public: - /// Checks whether the given type matches the matcher rules, and returns the - /// expected, canonicalized type on success. - /// Match may close open types and numbers in state. - /// @param state the MatchState - /// @param type the type to match - /// @returns the canonicalized type on match, otherwise nullptr - const sem::Type* Match(MatchState& state, - const sem::Type* type) const override; - /// @param state the MatchState - /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; -}; - -const sem::Type* Scalar::Match(MatchState& state, const sem::Type* ty) const { - if (match_f32(ty)) { - return build_f32(state); - } - if (match_i32(ty)) { - return build_i32(state); - } - if (match_u32(ty)) { - return build_u32(state); - } - if (match_bool(ty)) { - return build_bool(state); - } - return nullptr; -} - -std::string Scalar::String(MatchState&) const { - return "f32, i32, u32 or bool"; +std::string Iu32::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss << I32().String(nullptr) << " or " << U32().String(nullptr); + return ss.str(); } /// EnumMatcher for 'match f32_texel_format' -/// @see src/tint/builtins.def:124:7 class F32TexelFormat : public NumberMatcher { public: /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. + /// Match may define template numbers in state. /// @param state the MatchState /// @param number the enum value as a Number /// @return true if the enum value matches the set Number Match(MatchState& state, Number number) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; Number F32TexelFormat::Match(MatchState&, Number number) const { @@ -1288,23 +2326,22 @@ Number F32TexelFormat::Match(MatchState&, Number number) const { } } -std::string F32TexelFormat::String(MatchState&) const { +std::string F32TexelFormat::String(MatchState*) const { return "rgba8unorm, rgba8snorm, rgba16float, r32float, rg32float or rgba32float"; } /// EnumMatcher for 'match i32_texel_format' -/// @see src/tint/builtins.def:126:7 class I32TexelFormat : public NumberMatcher { public: /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. + /// Match may define template numbers in state. /// @param state the MatchState /// @param number the enum value as a Number /// @return true if the enum value matches the set Number Match(MatchState& state, Number number) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; Number I32TexelFormat::Match(MatchState&, Number number) const { @@ -1320,23 +2357,22 @@ Number I32TexelFormat::Match(MatchState&, Number number) const { } } -std::string I32TexelFormat::String(MatchState&) const { +std::string I32TexelFormat::String(MatchState*) const { return "rgba8sint, rgba16sint, r32sint, rg32sint or rgba32sint"; } /// EnumMatcher for 'match u32_texel_format' -/// @see src/tint/builtins.def:128:7 class U32TexelFormat : public NumberMatcher { public: /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. + /// Match may define template numbers in state. /// @param state the MatchState /// @param number the enum value as a Number /// @return true if the enum value matches the set Number Match(MatchState& state, Number number) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; Number U32TexelFormat::Match(MatchState&, Number number) const { @@ -1352,49 +2388,72 @@ Number U32TexelFormat::Match(MatchState&, Number number) const { } } -std::string U32TexelFormat::String(MatchState&) const { +std::string U32TexelFormat::String(MatchState*) const { return "rgba8uint, rgba16uint, r32uint, rg32uint or rgba32uint"; } -/// EnumMatcher for 'match write_only' -/// @see src/tint/builtins.def:131:7 -class WriteOnly : public NumberMatcher { +/// EnumMatcher for 'match write' +class Write : public NumberMatcher { public: /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. + /// Match may define template numbers in state. /// @param state the MatchState /// @param number the enum value as a Number /// @return true if the enum value matches the set Number Match(MatchState& state, Number number) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; -Number WriteOnly::Match(MatchState&, Number number) const { +Number Write::Match(MatchState&, Number number) const { if (number.IsAny() || number.Value() == static_cast(Access::kWrite)) { return Number(static_cast(Access::kWrite)); } return Number::invalid; } -std::string WriteOnly::String(MatchState&) const { +std::string Write::String(MatchState*) const { return "write"; } -/// EnumMatcher for 'match function_private_workgroup' -/// @see src/tint/builtins.def:133:7 -class FunctionPrivateWorkgroup : public NumberMatcher { +/// EnumMatcher for 'match read_write' +class ReadWrite : public NumberMatcher { public: /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. + /// Match may define template numbers in state. /// @param state the MatchState /// @param number the enum value as a Number /// @return true if the enum value matches the set Number Match(MatchState& state, Number number) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; +}; + +Number ReadWrite::Match(MatchState&, Number number) const { + if (number.IsAny() || number.Value() == static_cast(Access::kReadWrite)) { + return Number(static_cast(Access::kReadWrite)); + } + return Number::invalid; +} + +std::string ReadWrite::String(MatchState*) const { + return "read_write"; +} + +/// EnumMatcher for 'match function_private_workgroup' +class FunctionPrivateWorkgroup : public NumberMatcher { + public: + /// Checks whether the given number matches the enum matcher rules. + /// Match may define template numbers in state. + /// @param state the MatchState + /// @param number the enum value as a Number + /// @return true if the enum value matches the set + Number Match(MatchState& state, Number number) const override; + /// @param state the MatchState + /// @return a string representation of the matcher. + std::string String(MatchState* state) const override; }; Number FunctionPrivateWorkgroup::Match(MatchState&, Number number) const { @@ -1408,23 +2467,22 @@ Number FunctionPrivateWorkgroup::Match(MatchState&, Number number) const { } } -std::string FunctionPrivateWorkgroup::String(MatchState&) const { +std::string FunctionPrivateWorkgroup::String(MatchState*) const { return "function, private or workgroup"; } /// EnumMatcher for 'match workgroup_or_storage' -/// @see src/tint/builtins.def:134:7 class WorkgroupOrStorage : public NumberMatcher { public: /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. + /// Match may define template numbers in state. /// @param state the MatchState /// @param number the enum value as a Number /// @return true if the enum value matches the set Number Match(MatchState& state, Number number) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; Number WorkgroupOrStorage::Match(MatchState&, Number number) const { @@ -1437,7 +2495,7 @@ Number WorkgroupOrStorage::Match(MatchState&, Number number) const { } } -std::string WorkgroupOrStorage::String(MatchState&) const { +std::string WorkgroupOrStorage::String(MatchState*) const { return "workgroup or storage"; } @@ -1445,14 +2503,14 @@ std::string WorkgroupOrStorage::String(MatchState&) const { class Storage : public NumberMatcher { public: /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. + /// Match may define template numbers in state. /// @param state the MatchState /// @param number the enum value as a Number /// @return true if the enum value matches the set Number Match(MatchState& state, Number number) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; Number Storage::Match(MatchState&, Number number) const { @@ -1462,73 +2520,37 @@ Number Storage::Match(MatchState&, Number number) const { return Number::invalid; } -std::string Storage::String(MatchState&) const { +std::string Storage::String(MatchState*) const { return "storage"; } -/// EnumMatcher for 'match write' -class Write : public NumberMatcher { - public: - /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. - /// @param state the MatchState - /// @param number the enum value as a Number - /// @return true if the enum value matches the set - Number Match(MatchState& state, Number number) const override; - /// @param state the MatchState - /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; -}; - -Number Write::Match(MatchState&, Number number) const { - if (number.IsAny() || number.Value() == static_cast(Access::kWrite)) { - return Number(static_cast(Access::kWrite)); - } - return Number::invalid; -} - -std::string Write::String(MatchState&) const { - return "write"; -} - -/// EnumMatcher for 'match read_write' -class ReadWrite : public NumberMatcher { - public: - /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. - /// @param state the MatchState - /// @param number the enum value as a Number - /// @return true if the enum value matches the set - Number Match(MatchState& state, Number number) const override; - /// @param state the MatchState - /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; -}; - -Number ReadWrite::Match(MatchState&, Number number) const { - if (number.IsAny() || number.Value() == static_cast(Access::kReadWrite)) { - return Number(static_cast(Access::kReadWrite)); - } - return Number::invalid; -} - -std::string ReadWrite::String(MatchState&) const { - return "read_write"; -} - /// Matchers holds type and number matchers class Matchers { private: - OpenTypeMatcher open_type_0_{0}; - OpenNumberMatcher open_number_0_{0}; - OpenNumberMatcher open_number_1_{1}; + TemplateTypeMatcher template_type_0_{0}; + TemplateTypeMatcher template_type_1_{1}; + TemplateNumberMatcher template_number_0_{0}; + TemplateNumberMatcher template_number_1_{1}; + TemplateNumberMatcher template_number_2_{2}; Bool Bool_; - F32 F32_; + Fa Fa_; + Ia Ia_; I32 I32_; U32 U32_; + F32 F32_; + F16 F16_; Vec2 Vec2_; Vec3 Vec3_; Vec4 Vec4_; + Mat2X2 Mat2X2_; + Mat2X3 Mat2X3_; + Mat2X4 Mat2X4_; + Mat3X2 Mat3X2_; + Mat3X3 Mat3X3_; + Mat3X4 Mat3X4_; + Mat4X2 Mat4X2_; + Mat4X3 Mat4X3_; + Mat4X4 Mat4X4_; Vec Vec_; Mat Mat_; Ptr Ptr_; @@ -1557,18 +2579,34 @@ class Matchers { ModfResultVec ModfResultVec_; FrexpResult FrexpResult_; FrexpResultVec FrexpResultVec_; - Fiu32 Fiu32_; - Iu32 Iu32_; + AtomicCompareExchangeResult AtomicCompareExchangeResult_; + AbstractOrScalar AbstractOrScalar_; Scalar Scalar_; + ScalarNoF32 ScalarNoF32_; + ScalarNoF16 ScalarNoF16_; + ScalarNoI32 ScalarNoI32_; + ScalarNoU32 ScalarNoU32_; + ScalarNoBool ScalarNoBool_; + FiaFiu32F16 FiaFiu32F16_; + FiaFi32F16 FiaFi32F16_; + FiaFiu32 FiaFiu32_; + FaF32 FaF32_; + FaF32F16 FaF32F16_; + IaIu32 IaIu32_; + Fiu32F16 Fiu32F16_; + Fiu32 Fiu32_; + Fi32F16 Fi32F16_; + Fi32 Fi32_; + F32F16 F32F16_; + Iu32 Iu32_; F32TexelFormat F32TexelFormat_; I32TexelFormat I32TexelFormat_; U32TexelFormat U32TexelFormat_; - WriteOnly WriteOnly_; + Write Write_; + ReadWrite ReadWrite_; FunctionPrivateWorkgroup FunctionPrivateWorkgroup_; WorkgroupOrStorage WorkgroupOrStorage_; Storage Storage_; - Write Write_; - ReadWrite ReadWrite_; public: /// Constructor @@ -1576,62 +2614,92 @@ class Matchers { /// Destructor ~Matchers(); - /// The open-types, types, and type matchers - TypeMatcher const* const type[39] = { - /* [0] */ &open_type_0_, - /* [1] */ &Bool_, - /* [2] */ &F32_, - /* [3] */ &I32_, - /* [4] */ &U32_, - /* [5] */ &Vec2_, - /* [6] */ &Vec3_, - /* [7] */ &Vec4_, - /* [8] */ &Vec_, - /* [9] */ &Mat_, - /* [10] */ &Ptr_, - /* [11] */ &Atomic_, - /* [12] */ &Array_, - /* [13] */ &Sampler_, - /* [14] */ &SamplerComparison_, - /* [15] */ &Texture1D_, - /* [16] */ &Texture2D_, - /* [17] */ &Texture2DArray_, - /* [18] */ &Texture3D_, - /* [19] */ &TextureCube_, - /* [20] */ &TextureCubeArray_, - /* [21] */ &TextureMultisampled2D_, - /* [22] */ &TextureDepth2D_, - /* [23] */ &TextureDepth2DArray_, - /* [24] */ &TextureDepthCube_, - /* [25] */ &TextureDepthCubeArray_, - /* [26] */ &TextureDepthMultisampled2D_, - /* [27] */ &TextureStorage1D_, - /* [28] */ &TextureStorage2D_, - /* [29] */ &TextureStorage2DArray_, - /* [30] */ &TextureStorage3D_, - /* [31] */ &TextureExternal_, - /* [32] */ &ModfResult_, - /* [33] */ &ModfResultVec_, - /* [34] */ &FrexpResult_, - /* [35] */ &FrexpResultVec_, - /* [36] */ &Fiu32_, - /* [37] */ &Iu32_, - /* [38] */ &Scalar_, + /// The template types, types, and type matchers + TypeMatcher const* const type[69] = { + /* [0] */ &template_type_0_, + /* [1] */ &template_type_1_, + /* [2] */ &Bool_, + /* [3] */ &Fa_, + /* [4] */ &Ia_, + /* [5] */ &I32_, + /* [6] */ &U32_, + /* [7] */ &F32_, + /* [8] */ &F16_, + /* [9] */ &Vec2_, + /* [10] */ &Vec3_, + /* [11] */ &Vec4_, + /* [12] */ &Mat2X2_, + /* [13] */ &Mat2X3_, + /* [14] */ &Mat2X4_, + /* [15] */ &Mat3X2_, + /* [16] */ &Mat3X3_, + /* [17] */ &Mat3X4_, + /* [18] */ &Mat4X2_, + /* [19] */ &Mat4X3_, + /* [20] */ &Mat4X4_, + /* [21] */ &Vec_, + /* [22] */ &Mat_, + /* [23] */ &Ptr_, + /* [24] */ &Atomic_, + /* [25] */ &Array_, + /* [26] */ &Sampler_, + /* [27] */ &SamplerComparison_, + /* [28] */ &Texture1D_, + /* [29] */ &Texture2D_, + /* [30] */ &Texture2DArray_, + /* [31] */ &Texture3D_, + /* [32] */ &TextureCube_, + /* [33] */ &TextureCubeArray_, + /* [34] */ &TextureMultisampled2D_, + /* [35] */ &TextureDepth2D_, + /* [36] */ &TextureDepth2DArray_, + /* [37] */ &TextureDepthCube_, + /* [38] */ &TextureDepthCubeArray_, + /* [39] */ &TextureDepthMultisampled2D_, + /* [40] */ &TextureStorage1D_, + /* [41] */ &TextureStorage2D_, + /* [42] */ &TextureStorage2DArray_, + /* [43] */ &TextureStorage3D_, + /* [44] */ &TextureExternal_, + /* [45] */ &ModfResult_, + /* [46] */ &ModfResultVec_, + /* [47] */ &FrexpResult_, + /* [48] */ &FrexpResultVec_, + /* [49] */ &AtomicCompareExchangeResult_, + /* [50] */ &AbstractOrScalar_, + /* [51] */ &Scalar_, + /* [52] */ &ScalarNoF32_, + /* [53] */ &ScalarNoF16_, + /* [54] */ &ScalarNoI32_, + /* [55] */ &ScalarNoU32_, + /* [56] */ &ScalarNoBool_, + /* [57] */ &FiaFiu32F16_, + /* [58] */ &FiaFi32F16_, + /* [59] */ &FiaFiu32_, + /* [60] */ &FaF32_, + /* [61] */ &FaF32F16_, + /* [62] */ &IaIu32_, + /* [63] */ &Fiu32F16_, + /* [64] */ &Fiu32_, + /* [65] */ &Fi32F16_, + /* [66] */ &Fi32_, + /* [67] */ &F32F16_, + /* [68] */ &Iu32_, }; - /// The open-numbers, and number matchers + /// The template numbers, and number matchers NumberMatcher const* const number[11] = { - /* [0] */ &open_number_0_, - /* [1] */ &open_number_1_, - /* [2] */ &F32TexelFormat_, - /* [3] */ &I32TexelFormat_, - /* [4] */ &U32TexelFormat_, - /* [5] */ &WriteOnly_, - /* [6] */ &FunctionPrivateWorkgroup_, - /* [7] */ &WorkgroupOrStorage_, - /* [8] */ &Storage_, - /* [9] */ &Write_, - /* [10] */ &ReadWrite_, + /* [0] */ &template_number_0_, + /* [1] */ &template_number_1_, + /* [2] */ &template_number_2_, + /* [3] */ &F32TexelFormat_, + /* [4] */ &I32TexelFormat_, + /* [5] */ &U32TexelFormat_, + /* [6] */ &Write_, + /* [7] */ &ReadWrite_, + /* [8] */ &FunctionPrivateWorkgroup_, + /* [9] */ &WorkgroupOrStorage_, + /* [10] */ &Storage_, }; }; @@ -1639,145 +2707,244 @@ Matchers::Matchers() = default; Matchers::~Matchers() = default; constexpr MatcherIndex kMatcherIndices[] = { - /* [0] */ 10, + /* [0] */ 23, /* [1] */ 0, - /* [2] */ 11, + /* [2] */ 24, /* [3] */ 0, - /* [4] */ 10, - /* [5] */ 8, - /* [6] */ 12, - /* [7] */ 0, + /* [4] */ 7, + /* [5] */ 23, + /* [6] */ 10, + /* [7] */ 25, /* [8] */ 0, - /* [9] */ 9, - /* [10] */ 1, + /* [9] */ 0, + /* [10] */ 22, /* [11] */ 0, - /* [12] */ 2, - /* [13] */ 9, - /* [14] */ 0, - /* [15] */ 1, + /* [12] */ 1, + /* [13] */ 0, + /* [14] */ 22, + /* [15] */ 0, /* [16] */ 2, - /* [17] */ 9, - /* [18] */ 0, - /* [19] */ 0, - /* [20] */ 2, - /* [21] */ 8, - /* [22] */ 0, - /* [23] */ 2, - /* [24] */ 8, + /* [17] */ 0, + /* [18] */ 22, + /* [19] */ 1, + /* [20] */ 0, + /* [21] */ 0, + /* [22] */ 22, + /* [23] */ 1, + /* [24] */ 2, /* [25] */ 0, - /* [26] */ 1, - /* [27] */ 29, + /* [26] */ 22, + /* [27] */ 0, /* [28] */ 0, - /* [29] */ 1, - /* [30] */ 30, + /* [29] */ 0, + /* [30] */ 21, /* [31] */ 0, - /* [32] */ 1, - /* [33] */ 28, - /* [34] */ 0, - /* [35] */ 1, - /* [36] */ 27, - /* [37] */ 0, - /* [38] */ 1, - /* [39] */ 8, + /* [32] */ 0, + /* [33] */ 43, + /* [34] */ 5, + /* [35] */ 6, + /* [36] */ 42, + /* [37] */ 5, + /* [38] */ 6, + /* [39] */ 21, /* [40] */ 0, - /* [41] */ 0, - /* [42] */ 30, - /* [43] */ 4, - /* [44] */ 9, - /* [45] */ 29, - /* [46] */ 4, - /* [47] */ 9, - /* [48] */ 28, - /* [49] */ 4, - /* [50] */ 9, - /* [51] */ 27, + /* [41] */ 2, + /* [42] */ 41, + /* [43] */ 5, + /* [44] */ 6, + /* [45] */ 40, + /* [46] */ 5, + /* [47] */ 6, + /* [48] */ 42, + /* [49] */ 0, + /* [50] */ 1, + /* [51] */ 43, /* [52] */ 4, - /* [53] */ 9, - /* [54] */ 30, - /* [55] */ 3, - /* [56] */ 9, - /* [57] */ 29, - /* [58] */ 3, - /* [59] */ 9, - /* [60] */ 28, - /* [61] */ 3, - /* [62] */ 9, - /* [63] */ 27, - /* [64] */ 3, - /* [65] */ 9, - /* [66] */ 30, - /* [67] */ 2, - /* [68] */ 9, - /* [69] */ 29, - /* [70] */ 2, - /* [71] */ 9, - /* [72] */ 28, - /* [73] */ 2, - /* [74] */ 9, - /* [75] */ 27, - /* [76] */ 2, - /* [77] */ 9, - /* [78] */ 8, + /* [53] */ 6, + /* [54] */ 42, + /* [55] */ 4, + /* [56] */ 6, + /* [57] */ 41, + /* [58] */ 4, + /* [59] */ 6, + /* [60] */ 21, + /* [61] */ 0, + /* [62] */ 7, + /* [63] */ 40, + /* [64] */ 4, + /* [65] */ 6, + /* [66] */ 43, + /* [67] */ 3, + /* [68] */ 6, + /* [69] */ 21, + /* [70] */ 1, + /* [71] */ 0, + /* [72] */ 42, + /* [73] */ 3, + /* [74] */ 6, + /* [75] */ 41, + /* [76] */ 3, + /* [77] */ 6, + /* [78] */ 48, /* [79] */ 0, - /* [80] */ 3, - /* [81] */ 7, - /* [82] */ 2, - /* [83] */ 17, - /* [84] */ 2, - /* [85] */ 5, - /* [86] */ 3, - /* [87] */ 5, - /* [88] */ 2, - /* [89] */ 16, - /* [90] */ 2, - /* [91] */ 6, - /* [92] */ 2, - /* [93] */ 18, - /* [94] */ 2, - /* [95] */ 20, - /* [96] */ 2, - /* [97] */ 19, - /* [98] */ 2, - /* [99] */ 6, + /* [80] */ 0, + /* [81] */ 43, + /* [82] */ 0, + /* [83] */ 1, + /* [84] */ 41, + /* [85] */ 0, + /* [86] */ 1, + /* [87] */ 40, + /* [88] */ 0, + /* [89] */ 1, + /* [90] */ 21, + /* [91] */ 0, + /* [92] */ 5, + /* [93] */ 21, + /* [94] */ 0, + /* [95] */ 6, + /* [96] */ 46, + /* [97] */ 0, + /* [98] */ 0, + /* [99] */ 40, /* [100] */ 3, - /* [101] */ 35, - /* [102] */ 0, - /* [103] */ 33, - /* [104] */ 0, - /* [105] */ 5, - /* [106] */ 0, - /* [107] */ 7, - /* [108] */ 3, - /* [109] */ 7, - /* [110] */ 4, - /* [111] */ 15, - /* [112] */ 0, - /* [113] */ 7, - /* [114] */ 0, - /* [115] */ 16, - /* [116] */ 0, - /* [117] */ 17, - /* [118] */ 0, - /* [119] */ 18, - /* [120] */ 0, - /* [121] */ 21, - /* [122] */ 0, - /* [123] */ 19, - /* [124] */ 0, - /* [125] */ 20, - /* [126] */ 0, - /* [127] */ 15, - /* [128] */ 2, - /* [129] */ 14, - /* [130] */ 24, - /* [131] */ 23, - /* [132] */ 25, - /* [133] */ 22, - /* [134] */ 26, - /* [135] */ 13, - /* [136] */ 31, - /* [137] */ 32, - /* [138] */ 34, + /* [101] */ 6, + /* [102] */ 17, + /* [103] */ 0, + /* [104] */ 10, + /* [105] */ 7, + /* [106] */ 10, + /* [107] */ 1, + /* [108] */ 10, + /* [109] */ 8, + /* [110] */ 10, + /* [111] */ 5, + /* [112] */ 10, + /* [113] */ 0, + /* [114] */ 10, + /* [115] */ 6, + /* [116] */ 9, + /* [117] */ 0, + /* [118] */ 10, + /* [119] */ 2, + /* [120] */ 11, + /* [121] */ 0, + /* [122] */ 9, + /* [123] */ 2, + /* [124] */ 9, + /* [125] */ 1, + /* [126] */ 11, + /* [127] */ 7, + /* [128] */ 9, + /* [129] */ 6, + /* [130] */ 9, + /* [131] */ 5, + /* [132] */ 9, + /* [133] */ 8, + /* [134] */ 9, + /* [135] */ 7, + /* [136] */ 45, + /* [137] */ 0, + /* [138] */ 28, + /* [139] */ 0, + /* [140] */ 29, + /* [141] */ 0, + /* [142] */ 30, + /* [143] */ 0, + /* [144] */ 11, + /* [145] */ 1, + /* [146] */ 31, + /* [147] */ 0, + /* [148] */ 32, + /* [149] */ 0, + /* [150] */ 11, + /* [151] */ 8, + /* [152] */ 33, + /* [153] */ 0, + /* [154] */ 34, + /* [155] */ 0, + /* [156] */ 11, + /* [157] */ 5, + /* [158] */ 11, + /* [159] */ 6, + /* [160] */ 11, + /* [161] */ 2, + /* [162] */ 12, + /* [163] */ 0, + /* [164] */ 12, + /* [165] */ 7, + /* [166] */ 12, + /* [167] */ 8, + /* [168] */ 13, + /* [169] */ 0, + /* [170] */ 13, + /* [171] */ 7, + /* [172] */ 47, + /* [173] */ 0, + /* [174] */ 13, + /* [175] */ 8, + /* [176] */ 14, + /* [177] */ 0, + /* [178] */ 14, + /* [179] */ 7, + /* [180] */ 14, + /* [181] */ 8, + /* [182] */ 15, + /* [183] */ 0, + /* [184] */ 15, + /* [185] */ 7, + /* [186] */ 15, + /* [187] */ 8, + /* [188] */ 16, + /* [189] */ 0, + /* [190] */ 16, + /* [191] */ 7, + /* [192] */ 16, + /* [193] */ 8, + /* [194] */ 17, + /* [195] */ 7, + /* [196] */ 17, + /* [197] */ 8, + /* [198] */ 18, + /* [199] */ 0, + /* [200] */ 18, + /* [201] */ 7, + /* [202] */ 18, + /* [203] */ 8, + /* [204] */ 19, + /* [205] */ 0, + /* [206] */ 49, + /* [207] */ 0, + /* [208] */ 28, + /* [209] */ 7, + /* [210] */ 29, + /* [211] */ 7, + /* [212] */ 30, + /* [213] */ 7, + /* [214] */ 31, + /* [215] */ 7, + /* [216] */ 19, + /* [217] */ 7, + /* [218] */ 19, + /* [219] */ 8, + /* [220] */ 32, + /* [221] */ 7, + /* [222] */ 33, + /* [223] */ 7, + /* [224] */ 20, + /* [225] */ 0, + /* [226] */ 20, + /* [227] */ 7, + /* [228] */ 20, + /* [229] */ 8, + /* [230] */ 26, + /* [231] */ 38, + /* [232] */ 27, + /* [233] */ 37, + /* [234] */ 36, + /* [235] */ 35, + /* [236] */ 44, + /* [237] */ 39, }; // Assert that the MatcherIndex is big enough to index all the matchers, plus @@ -1789,2068 +2956,2068 @@ static_assert(static_cast(sizeof(kMatcherIndices) / sizeof(kMatcherIndices[ constexpr ParameterInfo kParameters[] = { { /* [0] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[83], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [1] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [2] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [3] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [4] */ - /* usage */ ParameterUsage::kDdx, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [5] */ - /* usage */ ParameterUsage::kDdy, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [6] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [7] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [8] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [9] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [10] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [11] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [12] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [13] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[95], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [14] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [15] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [16] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [17] */ - /* usage */ ParameterUsage::kDdx, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [18] */ - /* usage */ ParameterUsage::kDdy, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [19] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[93], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [20] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [21] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [22] */ - /* usage */ ParameterUsage::kDdx, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [23] */ - /* usage */ ParameterUsage::kDdy, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [24] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[99], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [25] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[83], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [26] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [27] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [28] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [29] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [30] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [31] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[83], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [32] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [33] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [34] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [35] */ - /* usage */ ParameterUsage::kDdx, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [36] */ - /* usage */ ParameterUsage::kDdy, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [37] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[83], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [38] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [39] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [40] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [41] */ - /* usage */ ParameterUsage::kBias, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [42] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [43] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[89], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [44] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [45] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [46] */ - /* usage */ ParameterUsage::kDdx, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [47] */ - /* usage */ ParameterUsage::kDdy, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [48] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [49] */ - /* usage */ ParameterUsage::kComponent, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [50] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[117], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [51] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [52] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [53] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [54] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [55] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [56] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [57] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [58] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [59] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [60] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [61] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [62] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [63] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [64] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [65] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[212], }, { /* [66] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [67] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [68] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [69] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kDdx, + /* matcher indices */ &kMatcherIndices[134], }, { /* [70] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kDdy, + /* matcher indices */ &kMatcherIndices[134], }, { /* [71] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [72] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [73] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[93], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [74] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [75] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [76] */ - /* usage */ ParameterUsage::kDdx, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [77] */ - /* usage */ ParameterUsage::kDdy, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [78] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* matcher indices */ &kMatcherIndices[214], }, { /* [79] */ /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* matcher indices */ &kMatcherIndices[230], }, { /* [80] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* matcher indices */ &kMatcherIndices[104], }, { /* [81] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kDdx, + /* matcher indices */ &kMatcherIndices[104], }, { /* [82] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kDdy, + /* matcher indices */ &kMatcherIndices[104], }, { /* [83] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[110], }, { /* [84] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [85] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [86] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [87] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [88] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[95], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [89] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [90] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [91] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [92] */ - /* usage */ ParameterUsage::kBias, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [93] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [94] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [95] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [96] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kComponent, + /* matcher indices */ &kMatcherIndices[34], }, { /* [97] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[142], }, { /* [98] */ - /* usage */ ParameterUsage::kComponent, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [99] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[125], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [100] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [101] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [102] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[212], }, { /* [103] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [104] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [105] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [106] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kDdx, + /* matcher indices */ &kMatcherIndices[134], }, { /* [107] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kDdy, + /* matcher indices */ &kMatcherIndices[134], }, { /* [108] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[93], + /* matcher indices */ &kMatcherIndices[210], }, { /* [109] */ /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* matcher indices */ &kMatcherIndices[230], }, { /* [110] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* matcher indices */ &kMatcherIndices[134], }, { /* [111] */ - /* usage */ ParameterUsage::kBias, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kDdx, + /* matcher indices */ &kMatcherIndices[134], }, { /* [112] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[99], + /* usage */ ParameterUsage::kDdy, + /* matcher indices */ &kMatcherIndices[134], }, { /* [113] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [114] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [115] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [116] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [117] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [118] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [119] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [120] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[222], }, { /* [121] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [122] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [123] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [124] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kDdx, + /* matcher indices */ &kMatcherIndices[104], }, { /* [125] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kDdy, + /* matcher indices */ &kMatcherIndices[104], }, { /* [126] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [127] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [128] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [129] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [130] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [131] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [132] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[212], }, { /* [133] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [134] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [135] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [136] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[4], }, { /* [137] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [138] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[83], + /* matcher indices */ &kMatcherIndices[234], }, { /* [139] */ /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* matcher indices */ &kMatcherIndices[232], }, { /* [140] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* matcher indices */ &kMatcherIndices[134], }, { /* [141] */ /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* matcher indices */ &kMatcherIndices[34], }, { /* [142] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [143] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [144] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[212], }, { /* [145] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [146] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [147] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [148] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kBias, + /* matcher indices */ &kMatcherIndices[4], }, { /* [149] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [150] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[212], }, { /* [151] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [152] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [153] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [154] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kBias, + /* matcher indices */ &kMatcherIndices[4], }, { /* [155] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [156] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [157] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [158] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[89], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [159] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [160] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [161] */ - /* usage */ ParameterUsage::kDdx, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [162] */ - /* usage */ ParameterUsage::kDdy, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [163] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[95], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [164] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [165] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [166] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [167] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [168] */ - /* usage */ ParameterUsage::kComponent, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [169] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[117], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [170] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kComponent, + /* matcher indices */ &kMatcherIndices[34], }, { /* [171] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[152], }, { /* [172] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [173] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[93], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [174] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [175] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[231], }, { /* [176] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [177] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[99], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [178] */ - /* usage */ ParameterUsage::kComponent, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [179] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[115], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [180] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[210], }, { /* [181] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [182] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [183] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kDdx, + /* matcher indices */ &kMatcherIndices[134], }, { /* [184] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kDdy, + /* matcher indices */ &kMatcherIndices[134], }, { /* [185] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], }, { /* [186] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [187] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [188] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[83], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [189] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [190] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [191] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [192] */ - /* usage */ ParameterUsage::kBias, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [193] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[89], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [194] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [195] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], }, { /* [196] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [197] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [198] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[89], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [199] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [200] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[214], }, { /* [201] */ - /* usage */ ParameterUsage::kBias, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [202] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [203] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kBias, + /* matcher indices */ &kMatcherIndices[4], }, { /* [204] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[110], }, { /* [205] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[214], }, { /* [206] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [207] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [208] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[97], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[4], }, { /* [209] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[110], }, { /* [210] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[231], }, { /* [211] */ - /* usage */ ParameterUsage::kDdx, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [212] */ - /* usage */ ParameterUsage::kDdy, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [213] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[83], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [214] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [215] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kComponent, + /* matcher indices */ &kMatcherIndices[34], }, { /* [216] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[142], }, { /* [217] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [218] */ - /* usage */ ParameterUsage::kComponent, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [219] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[123], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [220] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [221] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [222] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[89], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [223] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [224] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [225] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[210], }, { /* [226] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[93], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [227] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [228] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kBias, + /* matcher indices */ &kMatcherIndices[4], }, { /* [229] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [230] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[97], + /* matcher indices */ &kMatcherIndices[212], }, { /* [231] */ /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* matcher indices */ &kMatcherIndices[230], }, { /* [232] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* matcher indices */ &kMatcherIndices[134], }, { /* [233] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [234] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [235] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[214], }, { /* [236] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [237] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [238] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[83], + /* usage */ ParameterUsage::kDdx, + /* matcher indices */ &kMatcherIndices[104], }, { /* [239] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kDdy, + /* matcher indices */ &kMatcherIndices[104], }, { /* [240] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], }, { /* [241] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], }, { /* [242] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[130], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [243] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [244] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], - }, - { - /* [245] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [246] */ - /* usage */ ParameterUsage::kTexture, + /* usage */ ParameterUsage::kOffset, /* matcher indices */ &kMatcherIndices[130], }, { - /* [247] */ + /* [245] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[220], + }, + { + /* [246] */ /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [247] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [248] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kDdx, + /* matcher indices */ &kMatcherIndices[104], }, { /* [249] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kDdy, + /* matcher indices */ &kMatcherIndices[104], }, { /* [250] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[89], + /* usage */ ParameterUsage::kComponent, + /* matcher indices */ &kMatcherIndices[34], }, { /* [251] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[140], }, { /* [252] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [253] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [254] */ - /* usage */ ParameterUsage::kTexture, + /* usage */ ParameterUsage::kOffset, /* matcher indices */ &kMatcherIndices[130], }, { /* [255] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[231], }, { /* [256] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [257] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [258] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [259] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [260] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[212], }, { /* [261] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [262] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[69], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [263] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [264] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[4], }, { /* [265] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[81], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[210], }, { /* [266] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[93], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [267] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [268] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[4], }, { /* [269] */ /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[99], + /* matcher indices */ &kMatcherIndices[130], }, { /* [270] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[95], + /* matcher indices */ &kMatcherIndices[234], }, { /* [271] */ /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* matcher indices */ &kMatcherIndices[230], }, { /* [272] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* matcher indices */ &kMatcherIndices[134], }, { /* [273] */ /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* matcher indices */ &kMatcherIndices[34], }, { /* [274] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [275] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], }, { /* [276] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [277] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [278] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[130], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [279] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [280] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[222], }, { /* [281] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [282] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [283] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [284] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kBias, + /* matcher indices */ &kMatcherIndices[4], }, { /* [285] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[222], }, { /* [286] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [287] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [288] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [289] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[4], }, { /* [290] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* matcher indices */ &kMatcherIndices[231], }, { /* [291] */ /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* matcher indices */ &kMatcherIndices[232], }, { /* [292] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* matcher indices */ &kMatcherIndices[104], }, { /* [293] */ /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* matcher indices */ &kMatcherIndices[34], }, { /* [294] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [295] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[129], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[220], }, { /* [296] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [297] */ - /* usage */ ParameterUsage::kDepthRef, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [298] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[4], }, { /* [299] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[214], }, { /* [300] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [301] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [302] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[4], }, { /* [303] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], }, { /* [304] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [305] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [306] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [307] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[233], }, { /* [308] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [309] */ - /* usage */ ParameterUsage::kOffset, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [310] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[97], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [311] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[54], }, { /* [312] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* matcher indices */ &kMatcherIndices[130], }, { /* [313] */ - /* usage */ ParameterUsage::kBias, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [314] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[45], + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[156], }, { /* [315] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[210], }, { /* [316] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [317] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[109], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [318] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[93], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[4], }, { /* [319] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [320] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [321] */ - /* usage */ ParameterUsage::kBias, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [322] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[117], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [323] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], }, { /* [324] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [325] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [326] */ - /* usage */ ParameterUsage::kComponent, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], }, { /* [327] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[115], + /* matcher indices */ &kMatcherIndices[222], }, { /* [328] */ /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* matcher indices */ &kMatcherIndices[230], }, { /* [329] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* matcher indices */ &kMatcherIndices[104], }, { /* [330] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], }, { /* [331] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[214], }, { /* [332] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [333] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [334] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[89], + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[110], }, { /* [335] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], - }, - { - /* [336] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], - }, - { - /* [337] */ - /* usage */ ParameterUsage::kBias, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [338] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], - }, - { - /* [339] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], - }, - { - /* [340] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], - }, - { - /* [341] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [342] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], - }, - { - /* [343] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], - }, - { - /* [344] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], - }, - { - /* [345] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], - }, - { - /* [346] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[57], - }, - { - /* [347] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], - }, - { - /* [348] */ - /* usage */ ParameterUsage::kArrayIndex, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [349] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[107], - }, - { - /* [350] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[130], - }, - { - /* [351] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], - }, - { - /* [352] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], - }, - { - /* [353] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], - }, - { - /* [354] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], - }, - { - /* [355] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], - }, - { - /* [356] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [357] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [358] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [359] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [360] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [361] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [362] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], - }, - { - /* [363] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], - }, - { - /* [364] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], - }, - { - /* [365] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [366] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [367] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [368] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[97], - }, - { - /* [369] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], - }, - { - /* [370] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], - }, - { - /* [371] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], - }, - { - /* [372] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], - }, - { - /* [373] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], - }, - { - /* [374] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[93], - }, - { - /* [375] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], - }, - { - /* [376] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], - }, - { - /* [377] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], - }, - { - /* [378] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], - }, - { - /* [379] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], - }, - { - /* [380] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [381] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [382] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [383] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[136], - }, - { - /* [384] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], - }, - { - /* [385] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], - }, - { - /* [386] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[89], - }, - { - /* [387] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], - }, - { - /* [388] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], - }, - { - /* [389] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[127], - }, - { - /* [390] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], - }, - { - /* [391] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [392] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[75], - }, - { - /* [393] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [394] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[81], - }, - { - /* [395] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [396] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [397] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [398] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [399] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [400] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [401] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [402] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [403] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [404] */ /* usage */ ParameterUsage::kTexture, /* matcher indices */ &kMatcherIndices[72], }, + { + /* [336] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [337] */ + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [338] */ + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[126], + }, + { + /* [339] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[231], + }, + { + /* [340] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [341] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], + }, + { + /* [342] */ + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [343] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[210], + }, + { + /* [344] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [345] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [346] */ + /* usage */ ParameterUsage::kBias, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [347] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[212], + }, + { + /* [348] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [349] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [350] */ + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [351] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[210], + }, + { + /* [352] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [353] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [354] */ + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [355] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[233], + }, + { + /* [356] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], + }, + { + /* [357] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], + }, + { + /* [358] */ + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [359] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[36], + }, + { + /* [360] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [361] */ + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [362] */ + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[158], + }, + { + /* [363] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[142], + }, + { + /* [364] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [365] */ + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [366] */ + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [367] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], + }, + { + /* [368] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], + }, + { + /* [369] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [370] */ + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [371] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[233], + }, + { + /* [372] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], + }, + { + /* [373] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], + }, + { + /* [374] */ + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [375] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[231], + }, + { + /* [376] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [377] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], + }, + { + /* [378] */ + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [379] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], + }, + { + /* [380] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [381] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [382] */ + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [383] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], + }, + { + /* [384] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [385] */ + /* usage */ ParameterUsage::kArrayIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [386] */ + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [387] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], + }, + { + /* [388] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [389] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [390] */ + /* usage */ ParameterUsage::kOffset, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [391] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], + }, + { + /* [392] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], + }, + { + /* [393] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], + }, + { + /* [394] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], + }, + { + /* [395] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], + }, + { + /* [396] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], + }, + { + /* [397] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [398] */ + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [399] */ + /* usage */ ParameterUsage::kX, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [400] */ + /* usage */ ParameterUsage::kY, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [401] */ + /* usage */ ParameterUsage::kZ, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [402] */ + /* usage */ ParameterUsage::kW, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [403] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[233], + }, + { + /* [404] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[232], + }, { /* [405] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* matcher indices */ &kMatcherIndices[104], }, { /* [406] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[81], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [407] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[66], + /* usage */ ParameterUsage::kComponent, + /* matcher indices */ &kMatcherIndices[34], }, { /* [408] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[99], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[148], }, { /* [409] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[81], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [410] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [411] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* matcher indices */ &kMatcherIndices[1], }, { /* [412] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* matcher indices */ &kMatcherIndices[1], }, { /* [413] */ @@ -3865,312 +5032,312 @@ constexpr ParameterInfo kParameters[] = { { /* [415] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* matcher indices */ &kMatcherIndices[116], }, { /* [416] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[63], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[116], }, { /* [417] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[116], }, { /* [418] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[107], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[116], }, { /* [419] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[130], + /* matcher indices */ &kMatcherIndices[235], }, { /* [420] */ /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* matcher indices */ &kMatcherIndices[232], }, { /* [421] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[91], + /* matcher indices */ &kMatcherIndices[134], }, { /* [422] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[60], + /* usage */ ParameterUsage::kDepthRef, + /* matcher indices */ &kMatcherIndices[4], }, { /* [423] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [424] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[107], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [425] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[54], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], }, { /* [426] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[99], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], }, { /* [427] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[107], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [428] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[51], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [429] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], }, { /* [430] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[109], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], }, { /* [431] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kComponent, + /* matcher indices */ &kMatcherIndices[34], }, { /* [432] */ - /* usage */ ParameterUsage::kSampler, - /* matcher indices */ &kMatcherIndices[135], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[140], }, { /* [433] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [434] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[48], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [435] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[220], }, { /* [436] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[109], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [437] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[42], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [438] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[99], + /* usage */ ParameterUsage::kBias, + /* matcher indices */ &kMatcherIndices[4], }, { /* [439] */ - /* usage */ ParameterUsage::kValue, - /* matcher indices */ &kMatcherIndices[109], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[214], }, { /* [440] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[111], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [441] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[55], + /* matcher indices */ &kMatcherIndices[104], }, { /* [442] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kBias, + /* matcher indices */ &kMatcherIndices[4], }, { /* [443] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[120], }, { /* [444] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[120], }, { /* [445] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[120], }, { /* [446] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[115], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[120], }, { /* [447] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [448] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [449] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[119], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [450] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[99], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [451] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [452] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[121], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [453] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [454] */ - /* usage */ ParameterUsage::kSampleIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [455] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [456] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [457] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], }, { /* [458] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[134], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], }, { /* [459] */ - /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [460] */ - /* usage */ ParameterUsage::kSampleIndex, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], }, { /* [461] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* matcher indices */ &kMatcherIndices[35], }, { /* [462] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[233], }, { /* [463] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[10], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [464] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [465] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[42], }, { /* [466] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[24], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], }, { /* [467] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[158], }, { /* [468] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[120], }, { /* [469] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[120], }, { /* [470] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[120], }, { /* [471] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[236], }, { /* [472] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [473] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [474] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], }, { /* [475] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [476] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], }, { /* [477] */ @@ -4180,457 +5347,457 @@ constexpr ParameterInfo kParameters[] = { { /* [478] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[10], + /* matcher indices */ &kMatcherIndices[1], }, { /* [479] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [480] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [481] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], + /* matcher indices */ &kMatcherIndices[30], }, { /* [482] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* matcher indices */ &kMatcherIndices[30], }, { /* [483] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], + /* matcher indices */ &kMatcherIndices[30], }, { /* [484] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* matcher indices */ &kMatcherIndices[30], }, { /* [485] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], + /* matcher indices */ &kMatcherIndices[1], }, { /* [486] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[99], }, { /* [487] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[34], }, { /* [488] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[126], }, { /* [489] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[220], }, { /* [490] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [491] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [492] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[75], }, { /* [493] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], }, { /* [494] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[126], }, { /* [495] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[214], }, { /* [496] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [497] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [498] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[66], }, { /* [499] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[110], }, { /* [500] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[126], }, { /* [501] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[136], + /* matcher indices */ &kMatcherIndices[63], }, { /* [502] */ /* usage */ ParameterUsage::kCoords, - /* matcher indices */ &kMatcherIndices[85], + /* matcher indices */ &kMatcherIndices[34], }, { /* [503] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[156], }, { /* [504] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[57], }, { /* [505] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], }, { /* [506] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[156], }, { /* [507] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[210], }, { /* [508] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [509] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[91], - }, - { - /* [510] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[91], - }, - { - /* [511] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [512] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [513] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [514] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [515] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [516] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [517] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [518] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[78], - }, - { - /* [519] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], - }, - { - /* [520] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], - }, - { - /* [521] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], - }, - { - /* [522] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], - }, - { - /* [523] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], - }, - { - /* [524] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [525] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], - }, - { - /* [526] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], - }, - { - /* [527] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], - }, - { - /* [528] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], - }, - { - /* [529] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[111], - }, - { - /* [530] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [531] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], - }, - { - /* [532] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], - }, - { - /* [533] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[115], - }, - { - /* [534] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [535] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[117], - }, - { - /* [536] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [537] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [538] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [539] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [540] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [541] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[119], - }, - { - /* [542] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [543] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [544] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], - }, - { - /* [545] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[123], - }, - { - /* [546] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [547] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[130], - }, - { - /* [548] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [549] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[125], - }, - { - /* [550] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [551] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], - }, - { - /* [552] */ - /* usage */ ParameterUsage::kLevel, - /* matcher indices */ &kMatcherIndices[55], - }, - { - /* [553] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], - }, - { - /* [554] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], - }, - { - /* [555] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], - }, - { - /* [556] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[121], - }, - { - /* [557] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[130], - }, - { - /* [558] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[125], - }, - { - /* [559] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], - }, - { - /* [560] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], - }, - { - /* [561] */ - /* usage */ ParameterUsage::kTexture, + /* usage */ ParameterUsage::kCoords, /* matcher indices */ &kMatcherIndices[134], }, { - /* [562] */ + /* [510] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[36], + /* matcher indices */ &kMatcherIndices[208], }, { - /* [563] */ + /* [511] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [512] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [513] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[51], + }, + { + /* [514] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[110], + }, + { + /* [515] */ + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[156], + }, + { + /* [516] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[45], + }, + { + /* [517] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [518] */ + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[158], + }, + { + /* [519] */ /* usage */ ParameterUsage::kTexture, /* matcher indices */ &kMatcherIndices[33], }, { - /* [564] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[27], + /* [520] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[110], }, { - /* [565] */ + /* [521] */ + /* usage */ ParameterUsage::kValue, + /* matcher indices */ &kMatcherIndices[158], + }, + { + /* [522] */ /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[138], + }, + { + /* [523] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [524] */ + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [525] */ + /* usage */ ParameterUsage::kNone, /* matcher indices */ &kMatcherIndices[30], }, { - /* [566] */ + /* [526] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [527] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [528] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[136], + /* matcher indices */ &kMatcherIndices[140], + }, + { + /* [529] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [530] */ + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [531] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[146], + }, + { + /* [532] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[110], + }, + { + /* [533] */ + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [534] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [535] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [536] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [537] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [538] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [539] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [540] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [541] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [542] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[16], + }, + { + /* [543] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [544] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [545] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[16], + }, + { + /* [546] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [547] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [548] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[39], + }, + { + /* [549] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[154], + }, + { + /* [550] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [551] */ + /* usage */ ParameterUsage::kSampleIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [552] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], + }, + { + /* [553] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [554] */ + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [555] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[237], + }, + { + /* [556] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [557] */ + /* usage */ ParameterUsage::kSampleIndex, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [558] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], + }, + { + /* [559] */ + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], + }, + { + /* [560] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [561] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [562] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [563] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [564] */ + /* usage */ ParameterUsage::kXy, + /* matcher indices */ &kMatcherIndices[116], + }, + { + /* [565] */ + /* usage */ ParameterUsage::kZ, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [566] */ + /* usage */ ParameterUsage::kW, + /* matcher indices */ &kMatcherIndices[1], }, { /* [567] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[1], }, { /* [568] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* matcher indices */ &kMatcherIndices[1], }, { /* [569] */ @@ -4639,438 +5806,438 @@ constexpr ParameterInfo kParameters[] = { }, { /* [570] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[123], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [571] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [572] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[30], }, { /* [573] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[119], + /* usage */ ParameterUsage::kX, + /* matcher indices */ &kMatcherIndices[1], }, { /* [574] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kYz, + /* matcher indices */ &kMatcherIndices[116], }, { /* [575] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[81], + /* usage */ ParameterUsage::kW, + /* matcher indices */ &kMatcherIndices[1], }, { /* [576] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[81], + /* usage */ ParameterUsage::kX, + /* matcher indices */ &kMatcherIndices[1], }, { /* [577] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kY, + /* matcher indices */ &kMatcherIndices[1], }, { /* [578] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[87], + /* usage */ ParameterUsage::kZw, + /* matcher indices */ &kMatcherIndices[116], }, { /* [579] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[87], + /* matcher indices */ &kMatcherIndices[116], }, { /* [580] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[116], }, { /* [581] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[117], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[116], }, { /* [582] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[115], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], }, { /* [583] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[112], }, { /* [584] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[111], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], }, { /* [585] */ /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[117], + /* matcher indices */ &kMatcherIndices[233], }, { /* [586] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[125], + /* usage */ ParameterUsage::kSampler, + /* matcher indices */ &kMatcherIndices[230], }, { /* [587] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[104], }, { /* [588] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], + /* usage */ ParameterUsage::kX, + /* matcher indices */ &kMatcherIndices[1], }, { /* [589] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[27], + /* usage */ ParameterUsage::kY, + /* matcher indices */ &kMatcherIndices[1], }, { /* [590] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[111], + /* usage */ ParameterUsage::kZ, + /* matcher indices */ &kMatcherIndices[1], }, { /* [591] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[115], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], }, { /* [592] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[117], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], }, { /* [593] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[119], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[120], }, { /* [594] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[123], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[120], }, { /* [595] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[125], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], }, { /* [596] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[133], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], }, { /* [597] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[131], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[116], }, { /* [598] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[130], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[116], }, { /* [599] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[132], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [600] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[121], + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], }, { /* [601] */ - /* usage */ ParameterUsage::kTexture, - /* matcher indices */ &kMatcherIndices[134], + /* usage */ ParameterUsage::kX, + /* matcher indices */ &kMatcherIndices[1], }, { /* [602] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], + /* usage */ ParameterUsage::kZyw, + /* matcher indices */ &kMatcherIndices[112], }, { /* [603] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], + /* usage */ ParameterUsage::kXyz, + /* matcher indices */ &kMatcherIndices[112], }, { /* [604] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kW, + /* matcher indices */ &kMatcherIndices[1], }, { /* [605] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kXy, + /* matcher indices */ &kMatcherIndices[116], }, { /* [606] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kZw, + /* matcher indices */ &kMatcherIndices[116], }, { /* [607] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kX, + /* matcher indices */ &kMatcherIndices[1], }, { /* [608] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kYz, + /* matcher indices */ &kMatcherIndices[116], }, { /* [609] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kXy, + /* matcher indices */ &kMatcherIndices[116], }, { /* [610] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kZ, + /* matcher indices */ &kMatcherIndices[1], }, { /* [611] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], + /* usage */ ParameterUsage::kX, + /* matcher indices */ &kMatcherIndices[1], }, { /* [612] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[43], + /* usage */ ParameterUsage::kY, + /* matcher indices */ &kMatcherIndices[1], }, { /* [613] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[1], }, { /* [614] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[1], }, { /* [615] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [616] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[93], }, { /* [617] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[138], }, { /* [618] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [619] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[1], }, { /* [620] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[35], }, { /* [621] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[140], }, { /* [622] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [623] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [624] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[93], }, { /* [625] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[142], }, { /* [626] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [627] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* matcher indices */ &kMatcherIndices[1], }, { /* [628] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* matcher indices */ &kMatcherIndices[35], }, { /* [629] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[146], }, { /* [630] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [631] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [632] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[30], }, { /* [633] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[148], }, { /* [634] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [635] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[1], }, { /* [636] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[1], }, { /* [637] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[152], }, { /* [638] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [639] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [640] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[30], }, { /* [641] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[1], }, { /* [642] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[1], }, { /* [643] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], }, { /* [644] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [645] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [646] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[30], }, { /* [647] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], }, { /* [648] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [649] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[1], }, { /* [650] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[17], + /* matcher indices */ &kMatcherIndices[1], }, { /* [651] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[233], }, { /* [652] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [653] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[13], + /* matcher indices */ &kMatcherIndices[30], }, { /* [654] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* matcher indices */ &kMatcherIndices[30], }, { /* [655] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[1], + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[231], }, { /* [656] */ - /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* usage */ ParameterUsage::kLevel, + /* matcher indices */ &kMatcherIndices[34], }, { /* [657] */ @@ -5080,7 +6247,7 @@ constexpr ParameterInfo kParameters[] = { { /* [658] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* matcher indices */ &kMatcherIndices[1], }, { /* [659] */ @@ -5090,208 +6257,1908 @@ constexpr ParameterInfo kParameters[] = { { /* [660] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[1], }, { /* [661] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[30], }, { /* [662] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [663] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[1], }, { /* [664] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[1], }, { /* [665] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[16], }, { /* [666] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[16], }, { /* [667] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[16], }, { /* [668] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[16], }, { /* [669] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [670] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [671] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[1], }, { /* [672] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[4], + /* matcher indices */ &kMatcherIndices[1], }, { /* [673] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[24], + /* matcher indices */ &kMatcherIndices[30], }, { /* [674] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[10], + /* matcher indices */ &kMatcherIndices[30], }, { /* [675] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[24], + /* matcher indices */ &kMatcherIndices[1], }, { /* [676] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[10], + /* matcher indices */ &kMatcherIndices[1], }, { /* [677] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[39], }, { /* [678] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[39], }, { /* [679] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[39], + /* matcher indices */ &kMatcherIndices[16], }, { /* [680] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[16], }, { /* [681] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[0], + /* matcher indices */ &kMatcherIndices[30], }, { /* [682] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[30], }, { /* [683] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[1], }, { /* [684] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[1], }, { /* [685] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[39], }, { /* [686] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[39], }, { /* [687] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[16], }, { /* [688] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[21], + /* matcher indices */ &kMatcherIndices[16], }, { /* [689] */ /* usage */ ParameterUsage::kNone, - /* matcher indices */ &kMatcherIndices[12], + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [690] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [691] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [692] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [693] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [694] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [695] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [696] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [697] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [698] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [699] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [700] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [701] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [702] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [703] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [704] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [705] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [706] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [707] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [708] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [709] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [710] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [711] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[14], + }, + { + /* [712] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[18], + }, + { + /* [713] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[69], + }, + { + /* [714] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[10], + }, + { + /* [715] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[10], + }, + { + /* [716] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [717] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[10], + }, + { + /* [718] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [719] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [720] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[10], + }, + { + /* [721] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [722] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [723] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [724] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [725] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [726] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [727] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [728] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [729] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[10], + }, + { + /* [730] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[10], + }, + { + /* [731] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [732] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [733] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [734] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [735] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [736] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [737] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [738] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [739] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [740] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [741] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[10], + }, + { + /* [742] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[10], + }, + { + /* [743] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [744] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [745] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [746] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [747] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [748] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [749] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [750] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [751] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [752] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [753] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [754] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [755] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [756] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [757] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [758] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [759] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [760] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [761] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [762] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [763] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [764] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [765] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [766] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [767] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [768] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [769] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [770] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [771] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [772] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [773] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [774] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [775] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [776] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [777] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [778] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[90], + }, + { + /* [779] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [780] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [781] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [782] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [783] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[236], + }, + { + /* [784] */ + /* usage */ ParameterUsage::kCoords, + /* matcher indices */ &kMatcherIndices[130], + }, + { + /* [785] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], + }, + { + /* [786] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], + }, + { + /* [787] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [788] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [789] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [790] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [791] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [792] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [793] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [794] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [795] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [796] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [797] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [798] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [799] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [800] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [801] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [802] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [803] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [804] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [805] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [806] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [807] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [808] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [809] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [810] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [811] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [812] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[60], + }, + { + /* [813] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [814] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[60], + }, + { + /* [815] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [816] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[60], + }, + { + /* [817] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [818] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[60], + }, + { + /* [819] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [820] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[60], + }, + { + /* [821] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [822] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [823] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[60], + }, + { + /* [824] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [825] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[60], + }, + { + /* [826] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [827] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[26], + }, + { + /* [828] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [829] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [830] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[60], + }, + { + /* [831] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [832] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [833] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [834] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [835] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[231], + }, + { + /* [836] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [837] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [838] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [839] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [840] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [841] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [842] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [843] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [844] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [845] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [846] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [847] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[0], + }, + { + /* [848] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [849] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [850] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [851] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [852] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [853] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [854] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [855] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [856] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [857] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [858] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[16], + }, + { + /* [859] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[39], + }, + { + /* [860] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [861] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [862] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [863] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [864] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [865] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [866] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[134], + }, + { + /* [867] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[126], + }, + { + /* [868] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[126], + }, + { + /* [869] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[237], + }, + { + /* [870] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[154], + }, + { + /* [871] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[231], + }, + { + /* [872] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[233], + }, + { + /* [873] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], + }, + { + /* [874] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], + }, + { + /* [875] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[152], + }, + { + /* [876] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[148], + }, + { + /* [877] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[146], + }, + { + /* [878] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[142], + }, + { + /* [879] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[140], + }, + { + /* [880] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[138], + }, + { + /* [881] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[48], + }, + { + /* [882] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[231], + }, + { + /* [883] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], + }, + { + /* [884] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[152], + }, + { + /* [885] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[142], + }, + { + /* [886] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [887] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [888] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [889] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [890] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [891] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [892] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [893] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [894] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [895] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [896] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [897] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [898] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [899] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [900] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [901] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[236], + }, + { + /* [902] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[81], + }, + { + /* [903] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[48], + }, + { + /* [904] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[84], + }, + { + /* [905] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[87], + }, + { + /* [906] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[228], + }, + { + /* [907] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[237], + }, + { + /* [908] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[226], + }, + { + /* [909] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[233], + }, + { + /* [910] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[234], + }, + { + /* [911] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[235], + }, + { + /* [912] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[154], + }, + { + /* [913] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[152], + }, + { + /* [914] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[148], + }, + { + /* [915] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[146], + }, + { + /* [916] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[142], + }, + { + /* [917] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[140], + }, + { + /* [918] */ + /* usage */ ParameterUsage::kTexture, + /* matcher indices */ &kMatcherIndices[138], + }, + { + /* [919] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [920] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[34], + }, + { + /* [921] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [922] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[224], + }, + { + /* [923] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [924] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [925] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[218], + }, + { + /* [926] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[4], + }, + { + /* [927] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [928] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[216], + }, + { + /* [929] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[109], + }, + { + /* [930] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [931] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [932] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[16], + }, + { + /* [933] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [934] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [935] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[116], + }, + { + /* [936] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [937] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [938] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[124], + }, + { + /* [939] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[124], + }, + { + /* [940] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[124], + }, + { + /* [941] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[124], + }, + { + /* [942] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[124], + }, + { + /* [943] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[204], + }, + { + /* [944] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[112], + }, + { + /* [945] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [946] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [947] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [948] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [949] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[106], + }, + { + /* [950] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[106], + }, + { + /* [951] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[106], + }, + { + /* [952] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[106], + }, + { + /* [953] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[106], + }, + { + /* [954] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[202], + }, + { + /* [955] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[120], + }, + { + /* [956] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [957] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [958] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [959] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [960] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[5], + }, + { + /* [961] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [962] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[35], + }, + { + /* [963] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [964] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [965] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[144], + }, + { + /* [966] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[144], + }, + { + /* [967] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[144], + }, + { + /* [968] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[144], + }, + { + /* [969] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[200], + }, + { + /* [970] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[162], + }, + { + /* [971] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[39], + }, + { + /* [972] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[10], + }, + { + /* [973] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[164], + }, + { + /* [974] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[166], + }, + { + /* [975] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[16], + }, + { + /* [976] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[168], + }, + { + /* [977] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[39], + }, + { + /* [978] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [979] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[170], + }, + { + /* [980] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[174], + }, + { + /* [981] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[16], + }, + { + /* [982] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[176], + }, + { + /* [983] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [984] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [985] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[178], + }, + { + /* [986] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[180], + }, + { + /* [987] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[198], + }, + { + /* [988] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[182], + }, + { + /* [989] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [990] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [991] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[184], + }, + { + /* [992] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[186], + }, + { + /* [993] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[196], + }, + { + /* [994] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[188], + }, + { + /* [995] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [996] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[30], + }, + { + /* [997] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[190], + }, + { + /* [998] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[192], + }, + { + /* [999] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[194], + }, + { + /* [1000] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[102], + }, + { + /* [1001] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[60], + }, + { + /* [1002] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[1], + }, + { + /* [1003] */ + /* usage */ ParameterUsage::kNone, + /* matcher indices */ &kMatcherIndices[144], }, }; -constexpr OpenTypeInfo kOpenTypes[] = { +constexpr TemplateTypeInfo kTemplateTypes[] = { { /* [0] */ /* name */ "T", - /* matcher index */ 37, + /* matcher index */ 7, }, { /* [1] */ - /* name */ "T", - /* matcher index */ 36, + /* name */ "U", + /* matcher index */ 52, }, { /* [2] */ /* name */ "T", - /* matcher index */ kNoMatcher, + /* matcher index */ 8, }, { /* [3] */ + /* name */ "U", + /* matcher index */ 53, + }, + { + /* [4] */ /* name */ "T", - /* matcher index */ 38, - }, -}; - -constexpr OpenNumberInfo kOpenNumbers[] = { - { - /* [0] */ - /* name */ "F", - /* matcher index */ kNoMatcher, - }, - { - /* [1] */ - /* name */ "A", /* matcher index */ 5, }, + { + /* [5] */ + /* name */ "U", + /* matcher index */ 54, + }, + { + /* [6] */ + /* name */ "T", + /* matcher index */ 6, + }, + { + /* [7] */ + /* name */ "U", + /* matcher index */ 55, + }, + { + /* [8] */ + /* name */ "T", + /* matcher index */ 2, + }, + { + /* [9] */ + /* name */ "U", + /* matcher index */ 56, + }, + { + /* [10] */ + /* name */ "T", + /* matcher index */ 62, + }, + { + /* [11] */ + /* name */ "T", + /* matcher index */ 67, + }, + { + /* [12] */ + /* name */ "T", + /* matcher index */ 61, + }, + { + /* [13] */ + /* name */ "T", + /* matcher index */ 57, + }, + { + /* [14] */ + /* name */ "T", + /* matcher index */ 68, + }, + { + /* [15] */ + /* name */ "T", + /* matcher index */ 63, + }, + { + /* [16] */ + /* name */ "T", + /* matcher index */ 51, + }, + { + /* [17] */ + /* name */ "T", + /* matcher index */ 64, + }, + { + /* [18] */ + /* name */ "T", + /* matcher index */ 50, + }, + { + /* [19] */ + /* name */ "T", + /* matcher index */ kNoMatcher, + }, + { + /* [20] */ + /* name */ "T", + /* matcher index */ 56, + }, + { + /* [21] */ + /* name */ "T", + /* matcher index */ 53, + }, + { + /* [22] */ + /* name */ "T", + /* matcher index */ 52, + }, + { + /* [23] */ + /* name */ "T", + /* matcher index */ 55, + }, + { + /* [24] */ + /* name */ "T", + /* matcher index */ 54, + }, + { + /* [25] */ + /* name */ "T", + /* matcher index */ 58, + }, +}; + +constexpr TemplateNumberInfo kTemplateNumbers[] = { + { + /* [0] */ + /* name */ "K", + /* matcher index */ kNoMatcher, + }, + { + /* [1] */ + /* name */ "C", + /* matcher index */ kNoMatcher, + }, { /* [2] */ - /* name */ "M", + /* name */ "R", /* matcher index */ kNoMatcher, }, { /* [3] */ - /* name */ "N", + /* name */ "F", /* matcher index */ kNoMatcher, }, { /* [4] */ /* name */ "A", - /* matcher index */ kNoMatcher, + /* matcher index */ 6, }, { /* [5] */ + /* name */ "M", + /* matcher index */ kNoMatcher, + }, + { + /* [6] */ + /* name */ "N", + /* matcher index */ kNoMatcher, + }, + { + /* [7] */ + /* name */ "M", + /* matcher index */ kNoMatcher, + }, + { + /* [8] */ + /* name */ "A", + /* matcher index */ kNoMatcher, + }, + { + /* [9] */ /* name */ "S", - /* matcher index */ 7, + /* matcher index */ 9, }, }; @@ -5299,4065 +8166,6143 @@ constexpr OverloadInfo kOverloads[] = { { /* [0] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[584], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[918], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [1] */ /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[529], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[617], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [2] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[582], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[917], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [3] */ /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[533], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[621], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [4] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[581], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[916], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [5] */ /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[535], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[625], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [6] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[573], - /* return matcher indices */ &kMatcherIndices[99], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[915], + /* return matcher indices */ &kMatcherIndices[110], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [7] */ /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[541], - /* return matcher indices */ &kMatcherIndices[99], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[629], + /* return matcher indices */ &kMatcherIndices[110], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [8] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[570], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[914], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [9] */ /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[545], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[633], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [10] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[558], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[913], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [11] */ /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[549], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[637], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [12] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[556], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[912], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [13] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[554], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[911], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [14] */ /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[479], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[643], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [15] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[555], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[910], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [16] */ /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[551], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[647], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [17] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[557], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[909], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [18] */ /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[547], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[651], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [19] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[559], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[835], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [20] */ /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[523], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[655], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [21] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[561], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[907], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [22] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 2, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[0], - /* parameters */ &kParameters[562], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[3], + /* parameters */ &kParameters[905], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [23] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 2, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[0], - /* parameters */ &kParameters[563], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[3], + /* parameters */ &kParameters[904], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [24] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 2, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[0], - /* parameters */ &kParameters[564], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[3], + /* parameters */ &kParameters[903], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [25] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 2, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[0], - /* parameters */ &kParameters[565], - /* return matcher indices */ &kMatcherIndices[99], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[3], + /* parameters */ &kParameters[902], + /* return matcher indices */ &kMatcherIndices[110], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [26] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[566], - /* return matcher indices */ &kMatcherIndices[85], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[901], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [27] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[222], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [28] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[193], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[955], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [29] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[213], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[956], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecSplat, }, { /* [30] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[25], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[399], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorS, }, { /* [31] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[226], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[564], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorM, }, { /* [32] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[173], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[573], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorM, }, { /* [33] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[230], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[576], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorM, }, { /* [34] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[163], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[605], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorM, }, { /* [35] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[234], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[603], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorM, }, { /* [36] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[83], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[601], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorM, }, { /* [37] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[148], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1003], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [38] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[55], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[965], + /* return matcher indices */ &kMatcherIndices[150], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [39] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[246], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[4], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[966], + /* return matcher indices */ &kMatcherIndices[156], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [40] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[133], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[6], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[967], + /* return matcher indices */ &kMatcherIndices[158], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [41] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[383], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[8], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[968], + /* return matcher indices */ &kMatcherIndices[160], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [42] */ /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[389], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[510], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [43] */ /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[386], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[507], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [44] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[250], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[351], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [45] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[238], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[347], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [46] */ /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[138], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[230], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [47] */ /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[374], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[495], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [48] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[266], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[331], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [49] */ /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[368], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[489], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [50] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[270], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[327], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [51] */ /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[362], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[474], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [52] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[298], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[323], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [53] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[302], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[319], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [54] */ /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[183], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[165], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [55] */ /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[350], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[462], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [56] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[338], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[339], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [57] */ /* num parameters */ 4, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[326], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[315], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [58] */ /* num parameters */ 5, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[178], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[265], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [59] */ /* num parameters */ 5, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[168], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[260], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [60] */ /* num parameters */ 6, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[49], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[132], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [61] */ /* num parameters */ 4, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[218], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[299], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [62] */ /* num parameters */ 5, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[98], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[205], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [63] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[431], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[295], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [64] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[306], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[285], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [65] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[290], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[303], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [66] */ /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[113], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[275], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [67] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[419], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[270], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [68] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[286], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[90], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [69] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[392], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[307], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [70] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[404], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[255], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [71] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[262], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[471], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [72] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[407], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[431], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [73] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[416], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[250], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [74] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[422], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[215], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [75] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[346], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[96], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [76] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[425], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[407], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [77] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[428], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[170], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [78] */ /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[434], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[558], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [79] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[314], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[387], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [80] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[437], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[379], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [81] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[590], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[160], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [82] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[591], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[585], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [83] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[592], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[375], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [84] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[593], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[486], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [85] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[594], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[492], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [86] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[595], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[335], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [87] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[596], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[498], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [88] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[597], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[501], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [89] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[598], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[504], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [90] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[599], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[311], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [91] */ /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[440], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[513], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [92] */ /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[446], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[516], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [93] */ - /* num parameters */ 4, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[322], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[465], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [94] */ - /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[449], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[359], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [95] */ /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[452], - /* return matcher indices */ &kMatcherIndices[113], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[519], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [96] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[455], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[112], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [97] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[330], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[944], + /* return matcher indices */ &kMatcherIndices[112], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [98] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[458], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[945], + /* return matcher indices */ &kMatcherIndices[112], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecSplat, }, { /* [99] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[501], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[588], + /* return matcher indices */ &kMatcherIndices[112], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorS, }, { /* [100] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[334], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[609], + /* return matcher indices */ &kMatcherIndices[112], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorM, }, { /* [101] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[198], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[607], + /* return matcher indices */ &kMatcherIndices[112], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorM, }, { /* [102] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[188], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[949], + /* return matcher indices */ &kMatcherIndices[104], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [103] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[37], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[950], + /* return matcher indices */ &kMatcherIndices[108], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [104] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[318], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[4], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[951], + /* return matcher indices */ &kMatcherIndices[110], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [105] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[108], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[6], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[952], + /* return matcher indices */ &kMatcherIndices[114], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [106] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[310], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[8], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[953], + /* return matcher indices */ &kMatcherIndices[118], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [107] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[88], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[880], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [108] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[158], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[879], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [109] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[43], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[878], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [110] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[31], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[877], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [111] */ - /* num parameters */ 7, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[0], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[876], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [112] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[73], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[875], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [113] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[19], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[874], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [114] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[208], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[873], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [115] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[13], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[872], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [116] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[282], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[871], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [117] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[143], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[727], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [118] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[203], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[725], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [119] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[61], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[723], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [120] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[254], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[721], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [121] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[123], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[719], + /* return matcher indices */ &kMatcherIndices[10], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [122] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[258], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[717], + /* return matcher indices */ &kMatcherIndices[10], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [123] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[118], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[1], + /* parameters */ &kParameters[715], + /* return matcher indices */ &kMatcherIndices[69], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [124] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[128], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[1], + /* parameters */ &kParameters[713], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [125] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[7], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 3, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[0], + /* parameters */ &kParameters[711], + /* return matcher indices */ &kMatcherIndices[22], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [126] */ - /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[242], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[522], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [127] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[153], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[528], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [128] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[294], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[363], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [129] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[78], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[531], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [130] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[93], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[549], + /* return matcher indices */ &kMatcherIndices[120], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [131] */ - /* num parameters */ 6, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[67], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[552], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [132] */ /* num parameters */ 4, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[278], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[383], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [133] */ - /* num parameters */ 5, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[103], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[555], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [134] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[585], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[783], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [135] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[586], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[116], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [136] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[587], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[935], + /* return matcher indices */ &kMatcherIndices[116], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [137] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[588], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[936], + /* return matcher indices */ &kMatcherIndices[116], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecSplat, }, { /* [138] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 2, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[0], - /* parameters */ &kParameters[589], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[18], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[611], + /* return matcher indices */ &kMatcherIndices[116], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::VecCtorS, }, { /* [139] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[395], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[938], + /* return matcher indices */ &kMatcherIndices[134], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [140] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[398], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[939], + /* return matcher indices */ &kMatcherIndices[132], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [141] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[401], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[4], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[940], + /* return matcher indices */ &kMatcherIndices[130], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [142] */ - /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[3], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[476], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[6], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[941], + /* return matcher indices */ &kMatcherIndices[128], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [143] */ - /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[3], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[461], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 2, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[8], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[942], + /* return matcher indices */ &kMatcherIndices[122], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [144] */ - /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[3], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[464], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[180], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [145] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[649], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[108], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [146] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[648], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[102], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [147] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[652], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 7, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[65], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [148] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[651], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[235], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [149] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[655], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[78], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [150] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[654], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[245], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [151] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[511], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[120], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [152] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[513], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[343], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [153] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[657], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[225], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [154] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[656], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[150], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [155] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[646], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[144], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [156] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[645], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[439], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [157] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[644], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[200], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [158] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[643], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[435], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [159] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[642], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[280], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [160] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[641], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[224], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [161] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[640], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[922], + /* return matcher indices */ &kMatcherIndices[224], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [162] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[639], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 16, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[0], + /* return matcher indices */ &kMatcherIndices[224], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorS, }, { /* [163] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[638], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[443], + /* return matcher indices */ &kMatcherIndices[224], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorV, }, { /* [164] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[637], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[908], + /* return matcher indices */ &kMatcherIndices[228], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [165] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[636], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[906], + /* return matcher indices */ &kMatcherIndices[226], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [166] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[635], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[419], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [167] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[634], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[240], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [168] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[633], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[220], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [169] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[632], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[138], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [170] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[631], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[403], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [171] */ - /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[377], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[290], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [172] */ - /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[371], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[176], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [173] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[659], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[982], + /* return matcher indices */ &kMatcherIndices[176], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [174] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[658], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 8, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[57], + /* return matcher indices */ &kMatcherIndices[176], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorS, }, { /* [175] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[630], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[593], + /* return matcher indices */ &kMatcherIndices[176], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorV, }, { /* [176] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[629], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[985], + /* return matcher indices */ &kMatcherIndices[180], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [177] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[628], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[986], + /* return matcher indices */ &kMatcherIndices[178], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [178] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[627], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[162], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [179] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[626], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[970], + /* return matcher indices */ &kMatcherIndices[162], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [180] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[625], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[411], + /* return matcher indices */ &kMatcherIndices[162], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorS, }, { /* [181] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[359], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[597], + /* return matcher indices */ &kMatcherIndices[162], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorV, }, { /* [182] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[356], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[973], + /* return matcher indices */ &kMatcherIndices[166], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [183] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[624], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[974], + /* return matcher indices */ &kMatcherIndices[164], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [184] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[623], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[395], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [185] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[622], - /* return matcher indices */ &kMatcherIndices[138], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[195], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [186] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[621], - /* return matcher indices */ &kMatcherIndices[101], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[155], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [187] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[620], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[72], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [188] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[619], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[371], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [189] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[618], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[175], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [190] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[617], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[367], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [191] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[616], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[185], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [192] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[615], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[190], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [193] */ - /* num parameters */ 4, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[274], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[126], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [194] */ /* num parameters */ 4, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[342], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[355], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [195] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[614], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 5, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[210], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [196] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[613], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[168], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [197] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[515], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[976], + /* return matcher indices */ &kMatcherIndices[168], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [198] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[517], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[84], + /* return matcher indices */ &kMatcherIndices[168], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorS, }, { /* [199] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[610], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[595], + /* return matcher indices */ &kMatcherIndices[168], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorV, }, { /* [200] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[609], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[979], + /* return matcher indices */ &kMatcherIndices[174], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [201] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[608], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[980], + /* return matcher indices */ &kMatcherIndices[170], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [202] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[607], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[198], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [203] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[606], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[987], + /* return matcher indices */ &kMatcherIndices[198], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [204] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[605], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 8, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[49], + /* return matcher indices */ &kMatcherIndices[198], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorS, }, { /* [205] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[531], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[415], + /* return matcher indices */ &kMatcherIndices[198], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorV, }, { /* [206] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[519], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[969], + /* return matcher indices */ &kMatcherIndices[202], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [207] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[521], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[954], + /* return matcher indices */ &kMatcherIndices[200], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [208] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[527], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[204], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [209] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[661], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[943], + /* return matcher indices */ &kMatcherIndices[204], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [210] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[660], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 12, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[16], + /* return matcher indices */ &kMatcherIndices[204], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorS, }, { /* [211] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[583], - /* return matcher indices */ &kMatcherIndices[137], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 4, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[391], + /* return matcher indices */ &kMatcherIndices[204], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorV, }, { /* [212] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[604], - /* return matcher indices */ &kMatcherIndices[103], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[928], + /* return matcher indices */ &kMatcherIndices[218], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [213] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[663], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[925], + /* return matcher indices */ &kMatcherIndices[216], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [214] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[662], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[102], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [215] */ - /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[413], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1000], + /* return matcher indices */ &kMatcherIndices[102], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [216] */ - /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[410], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 12, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[28], + /* return matcher indices */ &kMatcherIndices[102], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorS, }, { /* [217] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[665], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[468], + /* return matcher indices */ &kMatcherIndices[102], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorV, }, { /* [218] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[664], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[999], + /* return matcher indices */ &kMatcherIndices[196], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [219] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[380], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[993], + /* return matcher indices */ &kMatcherIndices[194], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [220] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[473], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[188], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [221] */ /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[600], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[994], + /* return matcher indices */ &kMatcherIndices[188], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [222] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[601], - /* return matcher indices */ &kMatcherIndices[55], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 9, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[40], + /* return matcher indices */ &kMatcherIndices[188], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorS, }, { /* [223] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[505], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[582], + /* return matcher indices */ &kMatcherIndices[188], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorV, }, { /* [224] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[507], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[997], + /* return matcher indices */ &kMatcherIndices[192], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [225] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[537], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[998], + /* return matcher indices */ &kMatcherIndices[190], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [226] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[539], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[182], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [227] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[572], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[988], + /* return matcher indices */ &kMatcherIndices[182], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [228] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[571], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 6, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[114], + /* return matcher indices */ &kMatcherIndices[182], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorS, }, { /* [229] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[689], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[579], + /* return matcher indices */ &kMatcherIndices[182], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::MatCtorV, }, { /* [230] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[668], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[2], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[991], + /* return matcher indices */ &kMatcherIndices[186], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [231] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[671], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[0], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[992], + /* return matcher indices */ &kMatcherIndices[184], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [232] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[670], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[737], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpMinus, }, { /* [233] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[569], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[735], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpMinus, }, { /* [234] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[568], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[733], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpMinus, }, { /* [235] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[567], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[731], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpMinus, }, { /* [236] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[574], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[729], + /* return matcher indices */ &kMatcherIndices[10], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpMinus, }, { /* [237] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[674], - /* return matcher indices */ &kMatcherIndices[10], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[885], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [238] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[673], - /* return matcher indices */ &kMatcherIndices[10], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[884], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [239] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[684], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[883], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [240] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[685], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[882], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [241] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[686], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[3], + /* parameters */ &kParameters[881], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [242] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[687], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[749], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpPlus, }, { /* [243] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[560], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[747], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpPlus, }, { /* [244] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[688], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[745], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpPlus, }, { /* [245] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[676], - /* return matcher indices */ &kMatcherIndices[10], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[743], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpPlus, }, { /* [246] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[675], + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[741], /* return matcher indices */ &kMatcherIndices[10], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpPlus, }, { /* [247] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[470], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ true, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[701], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [248] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[467], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ true, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[699], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [249] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[683], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[695], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [250] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[682], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[693], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [251] */ /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[495], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[687], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [252] */ /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[497], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[685], + /* return matcher indices */ &kMatcherIndices[39], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [253] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[678], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[683], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [254] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[677], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[681], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [255] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[680], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[679], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [256] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[669], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[677], + /* return matcher indices */ &kMatcherIndices[39], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [257] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[667], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[675], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [258] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[666], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[673], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [259] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[647], + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[709], /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [260] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[679], - /* return matcher indices */ &kMatcherIndices[39], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[707], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [261] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 2, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[2], - /* parameters */ &kParameters[653], - /* return matcher indices */ &kMatcherIndices[9], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[705], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [262] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[612], - /* return matcher indices */ &kMatcherIndices[87], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[781], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [263] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[611], - /* return matcher indices */ &kMatcherIndices[87], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [264] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[603], - /* return matcher indices */ &kMatcherIndices[87], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[920], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [265] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[602], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[24], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[921], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [266] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[553], - /* return matcher indices */ &kMatcherIndices[81], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [267] */ - /* num parameters */ 0, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[690], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[932], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [268] */ - /* num parameters */ 0, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[690], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[20], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[933], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [269] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[577], - /* return matcher indices */ &kMatcherIndices[43], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[109], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [270] */ - /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[443], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[929], + /* return matcher indices */ &kMatcherIndices[109], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [271] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[543], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[21], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[930], + /* return matcher indices */ &kMatcherIndices[109], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [272] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[575], - /* return matcher indices */ &kMatcherIndices[43], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [273] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[576], - /* return matcher indices */ &kMatcherIndices[43], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[926], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [274] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[578], - /* return matcher indices */ &kMatcherIndices[43], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[22], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[927], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [275] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[579], - /* return matcher indices */ &kMatcherIndices[43], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[540], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [276] */ - /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[580], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[543], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [277] */ /* num parameters */ 3, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[365], - /* return matcher indices */ &kMatcherIndices[21], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[546], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [278] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[1], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[503], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 0, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Zero, }, { /* [279] */ /* num parameters */ 1, - /* num open types */ 0, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[3], - /* parameters */ &kParameters[650], - /* return matcher indices */ &kMatcherIndices[12], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[923], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Identity, }, { /* [280] */ - /* num parameters */ 2, - /* num open types */ 0, - /* num open numbers */ 0, - /* open types */ &kOpenTypes[4], - /* open numbers */ &kOpenNumbers[6], - /* parameters */ &kParameters[509], - /* return matcher indices */ &kMatcherIndices[91], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[23], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[924], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsConverter, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::Conv, }, { /* [281] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[2], - /* open numbers */ &kOpenNumbers[4], - /* parameters */ &kParameters[672], - /* return matcher indices */ &kMatcherIndices[43], - /* supported_stages */ PipelineStageSet(PipelineStage::kVertex, PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[477], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [282] */ - /* num parameters */ 1, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[681], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[480], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [283] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[493], - /* return matcher indices */ nullptr, - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[483], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [284] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[491], + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[10], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[860], /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpComplement, }, { /* [285] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[489], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[10], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[861], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpComplement, }, { /* [286] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[487], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[798], + /* return matcher indices */ &kMatcherIndices[172], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [287] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[485], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[810], + /* return matcher indices */ &kMatcherIndices[78], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [288] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[483], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[822], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [289] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[481], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[823], + /* return matcher indices */ &kMatcherIndices[60], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, }, { /* [290] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[525], + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[800], /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [291] */ - /* num parameters */ 2, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[499], - /* return matcher indices */ &kMatcherIndices[1], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[799], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, { /* [292] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[826], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [293] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[830], + /* return matcher indices */ &kMatcherIndices[60], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [294] */ + /* num parameters */ 4, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[423], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [295] */ + /* num parameters */ 4, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[427], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [296] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[846], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [297] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[848], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [298] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[779], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [299] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[777], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [300] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[849], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [301] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[850], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [302] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[851], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [303] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[852], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [304] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[853], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [305] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[854], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [306] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[763], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [307] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[761], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [308] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[759], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [309] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[757], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [310] */ /* num parameters */ 3, - /* num open types */ 1, - /* num open numbers */ 1, - /* open types */ &kOpenTypes[0], - /* open numbers */ &kOpenNumbers[5], - /* parameters */ &kParameters[353], - /* return matcher indices */ &kMatcherIndices[105], - /* supported_stages */ PipelineStageSet(PipelineStage::kFragment, PipelineStage::kCompute), - /* is_deprecated */ false, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[450], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [311] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[447], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [312] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[855], + /* return matcher indices */ &kMatcherIndices[136], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [313] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[856], + /* return matcher indices */ &kMatcherIndices[96], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [314] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[802], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [315] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[801], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [316] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[824], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [317] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[825], + /* return matcher indices */ &kMatcherIndices[60], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [318] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[806], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [319] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[805], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [320] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[459], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [321] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[456], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [322] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[808], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [323] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[807], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [324] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[886], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [325] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[809], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [326] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[739], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [327] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[703], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [328] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[887], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [329] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[888], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [330] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[811], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [331] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[1001], + /* return matcher indices */ &kMatcherIndices[60], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [332] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[813], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [333] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[812], + /* return matcher indices */ &kMatcherIndices[60], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [334] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[889], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [335] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[890], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [336] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[891], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [337] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[892], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [338] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[815], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [339] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[814], + /* return matcher indices */ &kMatcherIndices[60], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [340] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[893], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [341] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[894], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [342] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[895], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [343] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[896], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [344] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[897], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [345] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[898], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [346] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[567], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [347] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[570], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [348] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[899], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [349] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[900], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [350] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[671], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [351] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[669], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [352] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[804], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [353] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[803], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [354] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[919], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [355] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[797], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [356] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[984], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [357] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[978], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [358] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[817], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [359] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[816], + /* return matcher indices */ &kMatcherIndices[60], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [360] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[964], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [361] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[963], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [362] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[819], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [363] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[818], + /* return matcher indices */ &kMatcherIndices[60], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [364] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[619], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [365] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[615], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [366] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[821], + /* return matcher indices */ &kMatcherIndices[4], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [367] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[820], + /* return matcher indices */ &kMatcherIndices[60], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline), + /* const eval */ nullptr, + }, + { + /* [368] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[635], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [369] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[631], + /* return matcher indices */ &kMatcherIndices[39], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [370] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[641], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [371] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[639], + /* return matcher indices */ &kMatcherIndices[39], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [372] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[649], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [373] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[645], + /* return matcher indices */ &kMatcherIndices[39], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [374] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[787], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [375] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[789], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [376] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[829], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [377] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[828], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [378] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1002], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [379] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[996], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [380] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[832], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [381] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[831], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [382] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[834], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [383] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[833], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [384] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[17], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[870], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [385] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[869], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [386] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[837], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [387] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[836], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [388] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[657], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [389] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[653], + /* return matcher indices */ &kMatcherIndices[39], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [390] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[839], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [391] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[838], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [392] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[841], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [393] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[840], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [394] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[537], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::clamp, + }, + { + /* [395] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[13], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[534], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::clamp, + }, + { + /* [396] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[843], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [397] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[842], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [398] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[845], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [399] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[844], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [400] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[613], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::atan2, + }, + { + /* [401] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[12], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[751], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::atan2, + }, + { + /* [402] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[659], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [403] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[599], + /* return matcher indices */ &kMatcherIndices[39], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [404] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[663], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [405] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[16], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[661], + /* return matcher indices */ &kMatcherIndices[39], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [406] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[934], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [407] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[931], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [408] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[957], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [409] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[946], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [410] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[691], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [411] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[689], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [412] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[959], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [413] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[958], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [414] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[975], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [415] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[971], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [416] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[981], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [417] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[977], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [418] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[989], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [419] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[983], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [420] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[995], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [421] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[990], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [422] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[25], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[862], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpUnaryMinus, + }, + { + /* [423] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[25], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[863], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ &ConstEval::OpUnaryMinus, + }, + { + /* [424] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[858], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [425] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[859], + /* return matcher indices */ &kMatcherIndices[39], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [426] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[627], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [427] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[623], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [428] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[561], + /* return matcher indices */ &kMatcherIndices[206], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [429] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[753], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [430] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[755], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [431] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[765], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [432] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[767], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [433] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[769], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [434] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[771], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [435] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[773], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [436] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[775], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [437] */ + /* num parameters */ 2, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[667], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [438] */ + /* num parameters */ 2, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[665], + /* return matcher indices */ &kMatcherIndices[16], + /* flags */ OverloadFlags(OverloadFlag::kIsOperator, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [439] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[591], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [440] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[14], + /* template numbers */ &kTemplateNumbers[9], + /* parameters */ &kParameters[847], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [441] */ + /* num parameters */ 0, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [442] */ + /* num parameters */ 0, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[1004], + /* return matcher indices */ nullptr, + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [443] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[937], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [444] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[947], + /* return matcher indices */ &kMatcherIndices[126], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [445] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[948], + /* return matcher indices */ &kMatcherIndices[134], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [446] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[961], + /* return matcher indices */ &kMatcherIndices[134], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [447] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[962], + /* return matcher indices */ &kMatcherIndices[134], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [448] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 2, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[5], + /* parameters */ &kParameters[972], + /* return matcher indices */ &kMatcherIndices[18], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [449] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[525], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [450] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[697], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [451] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[868], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [452] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[867], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [453] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[866], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [454] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[865], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [455] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[857], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [456] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[785], + /* return matcher indices */ &kMatcherIndices[112], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [457] */ + /* num parameters */ 3, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[453], + /* return matcher indices */ &kMatcherIndices[30], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [458] */ + /* num parameters */ 2, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[795], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [459] */ + /* num parameters */ 2, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[793], + /* return matcher indices */ &kMatcherIndices[34], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [460] */ + /* num parameters */ 2, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[15], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[791], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [461] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[11], + /* template numbers */ &kTemplateNumbers[6], + /* parameters */ &kParameters[827], + /* return matcher indices */ &kMatcherIndices[1], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [462] */ + /* num parameters */ 1, + /* num template types */ 1, + /* num template numbers */ 1, + /* template types */ &kTemplateTypes[19], + /* template numbers */ &kTemplateNumbers[8], + /* parameters */ &kParameters[960], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, + }, + { + /* [463] */ + /* num parameters */ 1, + /* num template types */ 0, + /* num template numbers */ 0, + /* template types */ &kTemplateTypes[26], + /* template numbers */ &kTemplateNumbers[10], + /* parameters */ &kParameters[864], + /* return matcher indices */ &kMatcherIndices[35], + /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), + /* const eval */ nullptr, }, }; -constexpr BuiltinInfo kBuiltins[] = { +constexpr IntrinsicInfo kBuiltins[] = { { /* [0] */ - /* fn abs(T) -> T */ - /* fn abs(vec) -> vec */ + /* fn abs(T) -> T */ + /* fn abs(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[259], + /* overloads */ &kOverloads[378], }, { /* [1] */ - /* fn acos(f32) -> f32 */ - /* fn acos(vec) -> vec */ + /* fn acos(T) -> T */ + /* fn acos(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[253], + /* overloads */ &kOverloads[420], }, { /* [2] */ - /* fn all(bool) -> bool */ - /* fn all(vec) -> bool */ + /* fn acosh(T) -> T */ + /* fn acosh(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[245], + /* overloads */ &kOverloads[418], }, { /* [3] */ - /* fn any(bool) -> bool */ - /* fn any(vec) -> bool */ + /* fn all(bool) -> bool */ + /* fn all(vec) -> bool */ /* num overloads */ 2, - /* overloads */ &kOverloads[237], + /* overloads */ &kOverloads[416], }, { /* [4] */ - /* fn arrayLength(ptr, A>) -> u32 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[281], + /* fn any(bool) -> bool */ + /* fn any(vec) -> bool */ + /* num overloads */ 2, + /* overloads */ &kOverloads[414], }, { /* [5] */ - /* fn asin(f32) -> f32 */ - /* fn asin(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[231], + /* fn arrayLength(ptr, A>) -> u32 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[462], }, { /* [6] */ - /* fn atan(f32) -> f32 */ - /* fn atan(vec) -> vec */ + /* fn asin(T) -> T */ + /* fn asin(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[229], + /* overloads */ &kOverloads[412], }, { /* [7] */ - /* fn atan2(f32, f32) -> f32 */ - /* fn atan2(vec, vec) -> vec */ + /* fn asinh(T) -> T */ + /* fn asinh(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[223], + /* overloads */ &kOverloads[408], }, { /* [8] */ - /* fn ceil(f32) -> f32 */ - /* fn ceil(vec) -> vec */ + /* fn atan(T) -> T */ + /* fn atan(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[217], + /* overloads */ &kOverloads[406], }, { /* [9] */ - /* fn clamp(T, T, T) -> T */ - /* fn clamp(vec, vec, vec) -> vec */ + /* fn atan2(T, T) -> T */ + /* fn atan2(vec, vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[215], + /* overloads */ &kOverloads[400], }, { /* [10] */ - /* fn cos(f32) -> f32 */ - /* fn cos(vec) -> vec */ + /* fn atanh(T) -> T */ + /* fn atanh(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[213], + /* overloads */ &kOverloads[398], }, { /* [11] */ - /* fn cosh(f32) -> f32 */ - /* fn cosh(vec) -> vec */ + /* fn ceil(T) -> T */ + /* fn ceil(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[209], + /* overloads */ &kOverloads[396], }, { /* [12] */ - /* fn countLeadingZeros(T) -> T */ - /* fn countLeadingZeros(vec) -> vec */ + /* fn clamp(T, T, T) -> T */ + /* fn clamp(vec, vec, vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[173], + /* overloads */ &kOverloads[394], }, { /* [13] */ - /* fn countOneBits(T) -> T */ - /* fn countOneBits(vec) -> vec */ + /* fn cos(T) -> T */ + /* fn cos(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[153], + /* overloads */ &kOverloads[392], }, { /* [14] */ - /* fn countTrailingZeros(T) -> T */ - /* fn countTrailingZeros(vec) -> vec */ + /* fn cosh(T) -> T */ + /* fn cosh(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[149], + /* overloads */ &kOverloads[390], }, { /* [15] */ - /* fn cross(vec3, vec3) -> vec3 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[280], + /* fn countLeadingZeros(T) -> T */ + /* fn countLeadingZeros(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[386], }, { /* [16] */ - /* fn degrees(f32) -> f32 */ - /* fn degrees(vec) -> vec */ + /* fn countOneBits(T) -> T */ + /* fn countOneBits(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[147], + /* overloads */ &kOverloads[382], }, { /* [17] */ - /* fn determinant(mat) -> f32 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[279], + /* fn countTrailingZeros(T) -> T */ + /* fn countTrailingZeros(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[380], }, { /* [18] */ - /* fn distance(f32, f32) -> f32 */ - /* fn distance(vec, vec) -> f32 */ - /* num overloads */ 2, - /* overloads */ &kOverloads[151], + /* fn cross(vec3, vec3) -> vec3 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[456], }, { /* [19] */ - /* fn dot(vec, vec) -> T */ - /* num overloads */ 1, - /* overloads */ &kOverloads[278], + /* fn degrees(T) -> T */ + /* fn degrees(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[376], }, { /* [20] */ - /* fn dpdx(f32) -> f32 */ - /* fn dpdx(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[155], + /* fn determinant(mat) -> T */ + /* num overloads */ 1, + /* overloads */ &kOverloads[461], }, { /* [21] */ - /* fn dpdxCoarse(f32) -> f32 */ - /* fn dpdxCoarse(vec) -> vec */ + /* fn distance(T, T) -> T */ + /* fn distance(vec, vec) -> T */ /* num overloads */ 2, - /* overloads */ &kOverloads[157], + /* overloads */ &kOverloads[374], }, { /* [22] */ - /* fn dpdxFine(f32) -> f32 */ - /* fn dpdxFine(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[159], + /* fn dot(vec, vec) -> T */ + /* num overloads */ 1, + /* overloads */ &kOverloads[460], }, { /* [23] */ - /* fn dpdy(f32) -> f32 */ - /* fn dpdy(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[161], + /* fn dot4I8Packed(u32, u32) -> i32 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[459], }, { /* [24] */ - /* fn dpdyCoarse(f32) -> f32 */ - /* fn dpdyCoarse(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[163], + /* fn dot4U8Packed(u32, u32) -> u32 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[458], }, { /* [25] */ - /* fn dpdyFine(f32) -> f32 */ - /* fn dpdyFine(vec) -> vec */ + /* fn dpdx(f32) -> f32 */ + /* fn dpdx(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[165], + /* overloads */ &kOverloads[366], }, { /* [26] */ - /* fn exp(f32) -> f32 */ - /* fn exp(vec) -> vec */ + /* fn dpdxCoarse(f32) -> f32 */ + /* fn dpdxCoarse(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[167], + /* overloads */ &kOverloads[362], }, { /* [27] */ - /* fn exp2(f32) -> f32 */ - /* fn exp2(vec) -> vec */ + /* fn dpdxFine(f32) -> f32 */ + /* fn dpdxFine(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[169], + /* overloads */ &kOverloads[358], }, { /* [28] */ - /* fn extractBits(T, u32, u32) -> T */ - /* fn extractBits(vec, u32, u32) -> vec */ + /* fn dpdy(f32) -> f32 */ + /* fn dpdy(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[171], + /* overloads */ &kOverloads[338], }, { /* [29] */ - /* fn faceForward(vec, vec, vec) -> vec */ - /* num overloads */ 1, - /* overloads */ &kOverloads[277], + /* fn dpdyCoarse(f32) -> f32 */ + /* fn dpdyCoarse(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[332], }, { /* [30] */ - /* fn firstLeadingBit(T) -> T */ - /* fn firstLeadingBit(vec) -> vec */ + /* fn dpdyFine(f32) -> f32 */ + /* fn dpdyFine(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[175], + /* overloads */ &kOverloads[330], }, { /* [31] */ - /* fn firstTrailingBit(T) -> T */ - /* fn firstTrailingBit(vec) -> vec */ + /* fn exp(T) -> T */ + /* fn exp(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[177], + /* overloads */ &kOverloads[324], }, { /* [32] */ - /* fn floor(f32) -> f32 */ - /* fn floor(vec) -> vec */ + /* fn exp2(T) -> T */ + /* fn exp2(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[179], + /* overloads */ &kOverloads[322], }, { /* [33] */ - /* fn fma(f32, f32, f32) -> f32 */ - /* fn fma(vec, vec, vec) -> vec */ + /* fn extractBits(T, u32, u32) -> T */ + /* fn extractBits(vec, u32, u32) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[181], + /* overloads */ &kOverloads[320], }, { /* [34] */ - /* fn fract(f32) -> f32 */ - /* fn fract(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[183], + /* fn faceForward(vec, vec, vec) -> vec */ + /* num overloads */ 1, + /* overloads */ &kOverloads[457], }, { /* [35] */ - /* fn frexp(f32) -> __frexp_result */ - /* fn frexp(vec) -> __frexp_result_vec */ + /* fn firstLeadingBit(T) -> T */ + /* fn firstLeadingBit(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[185], + /* overloads */ &kOverloads[318], }, { /* [36] */ - /* fn fwidth(f32) -> f32 */ - /* fn fwidth(vec) -> vec */ + /* fn firstTrailingBit(T) -> T */ + /* fn firstTrailingBit(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[187], + /* overloads */ &kOverloads[352], }, { /* [37] */ - /* fn fwidthCoarse(f32) -> f32 */ - /* fn fwidthCoarse(vec) -> vec */ + /* fn floor(T) -> T */ + /* fn floor(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[189], + /* overloads */ &kOverloads[314], }, { /* [38] */ - /* fn fwidthFine(f32) -> f32 */ - /* fn fwidthFine(vec) -> vec */ + /* fn fma(T, T, T) -> T */ + /* fn fma(vec, vec, vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[191], + /* overloads */ &kOverloads[310], }, { /* [39] */ - /* fn insertBits(T, T, u32, u32) -> T */ - /* fn insertBits(vec, vec, u32, u32) -> vec */ + /* fn fract(T) -> T */ + /* fn fract(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[193], + /* overloads */ &kOverloads[290], }, { /* [40] */ - /* fn inverseSqrt(f32) -> f32 */ - /* fn inverseSqrt(vec) -> vec */ + /* fn frexp(T) -> __frexp_result */ + /* fn frexp(vec) -> __frexp_result_vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[195], + /* overloads */ &kOverloads[286], }, { /* [41] */ - /* fn ldexp(f32, i32) -> f32 */ - /* fn ldexp(vec, vec) -> vec */ + /* fn fwidth(f32) -> f32 */ + /* fn fwidth(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[197], + /* overloads */ &kOverloads[288], }, { /* [42] */ - /* fn length(f32) -> f32 */ - /* fn length(vec) -> f32 */ + /* fn fwidthCoarse(f32) -> f32 */ + /* fn fwidthCoarse(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[199], + /* overloads */ &kOverloads[316], }, { /* [43] */ - /* fn log(f32) -> f32 */ - /* fn log(vec) -> vec */ + /* fn fwidthFine(f32) -> f32 */ + /* fn fwidthFine(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[201], + /* overloads */ &kOverloads[292], }, { /* [44] */ - /* fn log2(f32) -> f32 */ - /* fn log2(vec) -> vec */ + /* fn insertBits(T, T, u32, u32) -> T */ + /* fn insertBits(vec, vec, u32, u32) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[203], + /* overloads */ &kOverloads[294], }, { /* [45] */ - /* fn max(T, T) -> T */ - /* fn max(vec, vec) -> vec */ + /* fn inverseSqrt(T) -> T */ + /* fn inverseSqrt(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[205], + /* overloads */ &kOverloads[296], }, { /* [46] */ - /* fn min(T, T) -> T */ - /* fn min(vec, vec) -> vec */ + /* fn ldexp(T, i32) -> T */ + /* fn ldexp(vec, vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[207], + /* overloads */ &kOverloads[298], }, { /* [47] */ - /* fn mix(f32, f32, f32) -> f32 */ - /* fn mix(vec, vec, vec) -> vec */ - /* fn mix(vec, vec, f32) -> vec */ - /* num overloads */ 3, - /* overloads */ &kOverloads[139], + /* fn length(T) -> T */ + /* fn length(vec) -> T */ + /* num overloads */ 2, + /* overloads */ &kOverloads[300], }, { /* [48] */ - /* fn modf(f32) -> __modf_result */ - /* fn modf(vec) -> __modf_result_vec */ + /* fn log(T) -> T */ + /* fn log(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[211], + /* overloads */ &kOverloads[302], }, { /* [49] */ - /* fn normalize(vec) -> vec */ - /* num overloads */ 1, - /* overloads */ &kOverloads[276], + /* fn log2(T) -> T */ + /* fn log2(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[304], }, { /* [50] */ - /* fn pack2x16float(vec2) -> u32 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[275], + /* fn max(T, T) -> T */ + /* fn max(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[306], }, { /* [51] */ - /* fn pack2x16snorm(vec2) -> u32 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[274], + /* fn min(T, T) -> T */ + /* fn min(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[308], }, { /* [52] */ - /* fn pack2x16unorm(vec2) -> u32 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[269], + /* fn mix(T, T, T) -> T */ + /* fn mix(vec, vec, vec) -> vec */ + /* fn mix(vec, vec, T) -> vec */ + /* num overloads */ 3, + /* overloads */ &kOverloads[281], }, { /* [53] */ - /* fn pack4x8snorm(vec4) -> u32 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[273], + /* fn modf(T) -> __modf_result */ + /* fn modf(vec) -> __modf_result_vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[312], }, { /* [54] */ - /* fn pack4x8unorm(vec4) -> u32 */ + /* fn normalize(vec) -> vec */ /* num overloads */ 1, - /* overloads */ &kOverloads[272], + /* overloads */ &kOverloads[455], }, { /* [55] */ - /* fn pow(f32, f32) -> f32 */ - /* fn pow(vec, vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[225], + /* fn pack2x16float(vec2) -> u32 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[463], }, { /* [56] */ - /* fn radians(f32) -> f32 */ - /* fn radians(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[227], + /* fn pack2x16snorm(vec2) -> u32 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[454], }, { /* [57] */ - /* fn reflect(vec, vec) -> vec */ + /* fn pack2x16unorm(vec2) -> u32 */ /* num overloads */ 1, - /* overloads */ &kOverloads[271], + /* overloads */ &kOverloads[453], }, { /* [58] */ - /* fn refract(vec, vec, f32) -> vec */ + /* fn pack4x8snorm(vec4) -> u32 */ /* num overloads */ 1, - /* overloads */ &kOverloads[270], + /* overloads */ &kOverloads[452], }, { /* [59] */ - /* fn reverseBits(T) -> T */ - /* fn reverseBits(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[233], + /* fn pack4x8unorm(vec4) -> u32 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[451], }, { /* [60] */ - /* fn round(f32) -> f32 */ - /* fn round(vec) -> vec */ + /* fn pow(T, T) -> T */ + /* fn pow(vec, vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[235], + /* overloads */ &kOverloads[326], }, { /* [61] */ + /* fn radians(T) -> T */ + /* fn radians(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[328], + }, + { + /* [62] */ + /* fn reflect(vec, vec) -> vec */ + /* num overloads */ 1, + /* overloads */ &kOverloads[450], + }, + { + /* [63] */ + /* fn refract(vec, vec, T) -> vec */ + /* num overloads */ 1, + /* overloads */ &kOverloads[449], + }, + { + /* [64] */ + /* fn reverseBits(T) -> T */ + /* fn reverseBits(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[334], + }, + { + /* [65] */ + /* fn round(T) -> T */ + /* fn round(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[336], + }, + { + /* [66] */ /* fn select(T, T, bool) -> T */ /* fn select(vec, vec, bool) -> vec */ /* fn select(vec, vec, vec) -> vec */ /* num overloads */ 3, - /* overloads */ &kOverloads[142], - }, - { - /* [62] */ - /* fn sign(f32) -> f32 */ - /* fn sign(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[239], - }, - { - /* [63] */ - /* fn sin(f32) -> f32 */ - /* fn sin(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[241], - }, - { - /* [64] */ - /* fn sinh(f32) -> f32 */ - /* fn sinh(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[243], - }, - { - /* [65] */ - /* fn smoothstep(f32, f32, f32) -> f32 */ - /* fn smoothstep(vec, vec, vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[219], - }, - { - /* [66] */ - /* fn smoothStep(f32, f32, f32) -> f32 */ - /* fn smoothStep(vec, vec, vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[247], + /* overloads */ &kOverloads[275], }, { /* [67] */ - /* fn sqrt(f32) -> f32 */ - /* fn sqrt(vec) -> vec */ + /* fn sign(T) -> T */ + /* fn sign(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[249], + /* overloads */ &kOverloads[340], }, { /* [68] */ - /* fn step(f32, f32) -> f32 */ - /* fn step(vec, vec) -> vec */ + /* fn sin(T) -> T */ + /* fn sin(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[251], + /* overloads */ &kOverloads[342], }, { /* [69] */ - /* fn storageBarrier() */ - /* num overloads */ 1, - /* overloads */ &kOverloads[268], + /* fn sinh(T) -> T */ + /* fn sinh(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[344], }, { /* [70] */ - /* fn tan(f32) -> f32 */ - /* fn tan(vec) -> vec */ + /* fn smoothstep(T, T, T) -> T */ + /* fn smoothstep(vec, vec, vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[255], + /* overloads */ &kOverloads[346], }, { /* [71] */ - /* fn tanh(f32) -> f32 */ - /* fn tanh(vec) -> vec */ + /* fn sqrt(T) -> T */ + /* fn sqrt(vec) -> vec */ /* num overloads */ 2, - /* overloads */ &kOverloads[257], + /* overloads */ &kOverloads[348], }, { /* [72] */ - /* fn transpose(mat) -> mat */ - /* num overloads */ 1, - /* overloads */ &kOverloads[261], + /* fn step(T, T) -> T */ + /* fn step(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[350], }, { /* [73] */ - /* fn trunc(f32) -> f32 */ - /* fn trunc(vec) -> vec */ - /* num overloads */ 2, - /* overloads */ &kOverloads[145], + /* fn storageBarrier() */ + /* num overloads */ 1, + /* overloads */ &kOverloads[441], }, { /* [74] */ - /* fn unpack2x16float(u32) -> vec2 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[262], + /* fn tan(T) -> T */ + /* fn tan(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[354], }, { /* [75] */ - /* fn unpack2x16snorm(u32) -> vec2 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[263], + /* fn tanh(T) -> T */ + /* fn tanh(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[356], }, { /* [76] */ - /* fn unpack2x16unorm(u32) -> vec2 */ + /* fn transpose(mat) -> mat */ /* num overloads */ 1, - /* overloads */ &kOverloads[264], + /* overloads */ &kOverloads[448], }, { /* [77] */ - /* fn unpack4x8snorm(u32) -> vec4 */ - /* num overloads */ 1, - /* overloads */ &kOverloads[265], + /* fn trunc(T) -> T */ + /* fn trunc(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[360], }, { /* [78] */ - /* fn unpack4x8unorm(u32) -> vec4 */ + /* fn unpack2x16float(u32) -> vec2 */ /* num overloads */ 1, - /* overloads */ &kOverloads[266], + /* overloads */ &kOverloads[447], }, { /* [79] */ - /* fn workgroupBarrier() */ + /* fn unpack2x16snorm(u32) -> vec2 */ /* num overloads */ 1, - /* overloads */ &kOverloads[267], + /* overloads */ &kOverloads[446], }, { /* [80] */ + /* fn unpack2x16unorm(u32) -> vec2 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[445], + }, + { + /* [81] */ + /* fn unpack4x8snorm(u32) -> vec4 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[444], + }, + { + /* [82] */ + /* fn unpack4x8unorm(u32) -> vec4 */ + /* num overloads */ 1, + /* overloads */ &kOverloads[443], + }, + { + /* [83] */ + /* fn workgroupBarrier() */ + /* num overloads */ 1, + /* overloads */ &kOverloads[442], + }, + { + /* [84] */ /* fn textureDimensions(texture: texture_1d) -> i32 */ /* fn textureDimensions(texture: texture_1d, level: i32) -> i32 */ /* fn textureDimensions(texture: texture_2d) -> vec2 */ @@ -9380,54 +14325,54 @@ constexpr BuiltinInfo kBuiltins[] = { /* fn textureDimensions(texture: texture_depth_cube_array) -> vec2 */ /* fn textureDimensions(texture: texture_depth_cube_array, level: i32) -> vec2 */ /* fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2 */ - /* fn textureDimensions(texture: texture_storage_1d) -> i32 */ - /* fn textureDimensions(texture: texture_storage_2d) -> vec2 */ - /* fn textureDimensions(texture: texture_storage_2d_array) -> vec2 */ - /* fn textureDimensions(texture: texture_storage_3d) -> vec3 */ + /* fn textureDimensions(texture: texture_storage_1d) -> i32 */ + /* fn textureDimensions(texture: texture_storage_2d) -> vec2 */ + /* fn textureDimensions(texture: texture_storage_2d_array) -> vec2 */ + /* fn textureDimensions(texture: texture_storage_3d) -> vec3 */ /* fn textureDimensions(texture: texture_external) -> vec2 */ /* num overloads */ 27, /* overloads */ &kOverloads[0], }, { - /* [81] */ - /* fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 */ - /* fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 */ + /* [85] */ + /* fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 */ + /* fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 */ /* fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> vec4 */ - /* fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 */ + /* fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 */ /* fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 */ - /* fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 */ + /* fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 */ /* fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> vec4 */ /* fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 */ /* num overloads */ 12, - /* overloads */ &kOverloads[57], + /* overloads */ &kOverloads[72], }, { - /* [82] */ + /* [86] */ /* fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> vec4 */ - /* fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> vec4 */ + /* fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> vec4 */ /* fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> vec4 */ - /* fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> vec4 */ + /* fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> vec4 */ /* fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> vec4 */ /* fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> vec4 */ /* num overloads */ 6, - /* overloads */ &kOverloads[116], + /* overloads */ &kOverloads[190], }, { - /* [83] */ + /* [87] */ /* fn textureNumLayers(texture: texture_2d_array) -> i32 */ /* fn textureNumLayers(texture: texture_cube_array) -> i32 */ /* fn textureNumLayers(texture: texture_depth_2d_array) -> i32 */ /* fn textureNumLayers(texture: texture_depth_cube_array) -> i32 */ - /* fn textureNumLayers(texture: texture_storage_2d_array) -> i32 */ + /* fn textureNumLayers(texture: texture_storage_2d_array) -> i32 */ /* num overloads */ 5, - /* overloads */ &kOverloads[134], + /* overloads */ &kOverloads[237], }, { - /* [84] */ + /* [88] */ /* fn textureNumLevels(texture: texture_1d) -> i32 */ /* fn textureNumLevels(texture: texture_2d) -> i32 */ /* fn textureNumLevels(texture: texture_2d_array) -> i32 */ @@ -9439,105 +14384,105 @@ constexpr BuiltinInfo kBuiltins[] = { /* fn textureNumLevels(texture: texture_depth_cube) -> i32 */ /* fn textureNumLevels(texture: texture_depth_cube_array) -> i32 */ /* num overloads */ 10, - /* overloads */ &kOverloads[81], + /* overloads */ &kOverloads[107], }, { - /* [85] */ + /* [89] */ /* fn textureNumSamples(texture: texture_multisampled_2d) -> i32 */ /* fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32 */ /* num overloads */ 2, - /* overloads */ &kOverloads[221], + /* overloads */ &kOverloads[384], }, { - /* [86] */ + /* [90] */ /* fn textureSample(texture: texture_1d, sampler: sampler, coords: f32) -> vec4 */ /* fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 */ - /* fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 */ + /* fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 */ /* fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 */ - /* fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 */ + /* fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 */ /* fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3) -> vec4 */ - /* fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, offset: vec3) -> vec4 */ + /* fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, @const offset: vec3) -> vec4 */ /* fn textureSample(texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 */ /* fn textureSample(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 */ /* fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> f32 */ - /* fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> f32 */ + /* fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> f32 */ /* fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> f32 */ - /* fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> f32 */ + /* fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> f32 */ /* fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> f32 */ /* fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> f32 */ /* num overloads */ 15, /* overloads */ &kOverloads[42], }, { - /* [87] */ + /* [91] */ /* fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32) -> vec4 */ - /* fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, offset: vec2) -> vec4 */ + /* fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, @const offset: vec2) -> vec4 */ /* fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32) -> vec4 */ - /* fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, offset: vec2) -> vec4 */ + /* fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, @const offset: vec2) -> vec4 */ /* fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32) -> vec4 */ - /* fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, offset: vec3) -> vec4 */ + /* fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, @const offset: vec3) -> vec4 */ /* fn textureSampleBias(texture: texture_cube, sampler: sampler, coords: vec3, bias: f32) -> vec4 */ /* fn textureSampleBias(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, bias: f32) -> vec4 */ /* num overloads */ 8, - /* overloads */ &kOverloads[100], + /* overloads */ &kOverloads[152], }, { - /* [88] */ + /* [92] */ /* fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 */ - /* fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 */ + /* fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 */ /* fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 */ - /* fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 */ + /* fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 */ /* fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 */ /* fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 */ /* num overloads */ 6, - /* overloads */ &kOverloads[128], + /* overloads */ &kOverloads[166], }, { - /* [89] */ + /* [93] */ /* fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 */ - /* fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 */ + /* fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 */ /* fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 */ - /* fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 */ + /* fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 */ /* fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 */ /* fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 */ /* num overloads */ 6, - /* overloads */ &kOverloads[122], + /* overloads */ &kOverloads[184], }, { - /* [90] */ + /* [94] */ /* fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2) -> vec4 */ - /* fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 */ + /* fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 */ /* fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2) -> vec4 */ - /* fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 */ + /* fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 */ /* fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 */ - /* fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, offset: vec3) -> vec4 */ + /* fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, @const offset: vec3) -> vec4 */ /* fn textureSampleGrad(texture: texture_cube, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 */ /* fn textureSampleGrad(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, ddx: vec3, ddy: vec3) -> vec4 */ /* num overloads */ 8, - /* overloads */ &kOverloads[108], + /* overloads */ &kOverloads[144], }, { - /* [91] */ + /* [95] */ /* fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32) -> vec4 */ - /* fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, offset: vec2) -> vec4 */ + /* fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, @const offset: vec2) -> vec4 */ /* fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32) -> vec4 */ - /* fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, offset: vec2) -> vec4 */ + /* fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, @const offset: vec2) -> vec4 */ /* fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32) -> vec4 */ - /* fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, offset: vec3) -> vec4 */ + /* fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, @const offset: vec3) -> vec4 */ /* fn textureSampleLevel(texture: texture_cube, sampler: sampler, coords: vec3, level: f32) -> vec4 */ /* fn textureSampleLevel(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: f32) -> vec4 */ /* fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32) -> f32 */ - /* fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, offset: vec2) -> f32 */ + /* fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, @const offset: vec2) -> f32 */ /* fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32) -> f32 */ - /* fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, offset: vec2) -> f32 */ + /* fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, @const offset: vec2) -> f32 */ /* fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3, level: i32) -> f32 */ /* fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: i32) -> f32 */ /* fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2) -> vec4 */ /* num overloads */ 15, - /* overloads */ &kOverloads[27], + /* overloads */ &kOverloads[57], }, { - /* [92] */ + /* [96] */ /* fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) */ /* fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) */ /* fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) */ @@ -9551,10 +14496,10 @@ constexpr BuiltinInfo kBuiltins[] = { /* fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) */ /* fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) */ /* num overloads */ 12, - /* overloads */ &kOverloads[69], + /* overloads */ &kOverloads[84], }, { - /* [93] */ + /* [97] */ /* fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 */ /* fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 */ /* fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 */ @@ -9565,73 +14510,458 @@ constexpr BuiltinInfo kBuiltins[] = { /* fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2, sample_index: i32) -> f32 */ /* fn textureLoad(texture: texture_external, coords: vec2) -> vec4 */ /* num overloads */ 9, - /* overloads */ &kOverloads[91], - }, - { - /* [94] */ - /* fn atomicLoad(ptr, read_write>) -> T */ - /* num overloads */ 1, - /* overloads */ &kOverloads[282], - }, - { - /* [95] */ - /* fn atomicStore(ptr, read_write>, T) */ - /* num overloads */ 1, - /* overloads */ &kOverloads[283], - }, - { - /* [96] */ - /* fn atomicAdd(ptr, read_write>, T) -> T */ - /* num overloads */ 1, - /* overloads */ &kOverloads[284], - }, - { - /* [97] */ - /* fn atomicSub(ptr, read_write>, T) -> T */ - /* num overloads */ 1, - /* overloads */ &kOverloads[285], + /* overloads */ &kOverloads[126], }, { /* [98] */ - /* fn atomicMax(ptr, read_write>, T) -> T */ + /* fn atomicLoad(ptr, read_write>) -> T */ /* num overloads */ 1, - /* overloads */ &kOverloads[286], + /* overloads */ &kOverloads[440], }, { /* [99] */ - /* fn atomicMin(ptr, read_write>, T) -> T */ + /* fn atomicStore(ptr, read_write>, T) */ /* num overloads */ 1, - /* overloads */ &kOverloads[287], + /* overloads */ &kOverloads[439], }, { /* [100] */ - /* fn atomicAnd(ptr, read_write>, T) -> T */ + /* fn atomicAdd(ptr, read_write>, T) -> T */ /* num overloads */ 1, - /* overloads */ &kOverloads[288], + /* overloads */ &kOverloads[436], }, { /* [101] */ - /* fn atomicOr(ptr, read_write>, T) -> T */ + /* fn atomicSub(ptr, read_write>, T) -> T */ /* num overloads */ 1, - /* overloads */ &kOverloads[289], + /* overloads */ &kOverloads[435], }, { /* [102] */ - /* fn atomicXor(ptr, read_write>, T) -> T */ + /* fn atomicMax(ptr, read_write>, T) -> T */ /* num overloads */ 1, - /* overloads */ &kOverloads[290], + /* overloads */ &kOverloads[434], }, { /* [103] */ - /* fn atomicExchange(ptr, read_write>, T) -> T */ + /* fn atomicMin(ptr, read_write>, T) -> T */ /* num overloads */ 1, - /* overloads */ &kOverloads[291], + /* overloads */ &kOverloads[433], }, { /* [104] */ - /* fn atomicCompareExchangeWeak(ptr, read_write>, T, T) -> vec2 */ + /* fn atomicAnd(ptr, read_write>, T) -> T */ /* num overloads */ 1, - /* overloads */ &kOverloads[292], + /* overloads */ &kOverloads[432], + }, + { + /* [105] */ + /* fn atomicOr(ptr, read_write>, T) -> T */ + /* num overloads */ 1, + /* overloads */ &kOverloads[431], + }, + { + /* [106] */ + /* fn atomicXor(ptr, read_write>, T) -> T */ + /* num overloads */ 1, + /* overloads */ &kOverloads[430], + }, + { + /* [107] */ + /* fn atomicExchange(ptr, read_write>, T) -> T */ + /* num overloads */ 1, + /* overloads */ &kOverloads[429], + }, + { + /* [108] */ + /* fn atomicCompareExchangeWeak(ptr, read_write>, T, T) -> __atomic_compare_exchange_result */ + /* num overloads */ 1, + /* overloads */ &kOverloads[428], + }, +}; + +constexpr IntrinsicInfo kUnaryOperators[] = { + { + /* [0] */ + /* op !(bool) -> bool */ + /* op !(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[424], + }, + { + /* [1] */ + /* op ~(T) -> T */ + /* op ~(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[284], + }, + { + /* [2] */ + /* op -(T) -> T */ + /* op -(vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[422], + }, +}; +constexpr uint8_t kUnaryOperatorNot = 0; +constexpr uint8_t kUnaryOperatorComplement = 1; +constexpr uint8_t kUnaryOperatorMinus = 2; + +constexpr IntrinsicInfo kBinaryOperators[] = { + { + /* [0] */ + /* op +(T, T) -> T */ + /* op +(vec, vec) -> vec */ + /* op +(vec, T) -> vec */ + /* op +(T, vec) -> vec */ + /* op +(mat, mat) -> mat */ + /* num overloads */ 5, + /* overloads */ &kOverloads[242], + }, + { + /* [1] */ + /* op -(T, T) -> T */ + /* op -(vec, vec) -> vec */ + /* op -(vec, T) -> vec */ + /* op -(T, vec) -> vec */ + /* op -(mat, mat) -> mat */ + /* num overloads */ 5, + /* overloads */ &kOverloads[232], + }, + { + /* [2] */ + /* op *(T, T) -> T */ + /* op *(vec, vec) -> vec */ + /* op *(vec, T) -> vec */ + /* op *(T, vec) -> vec */ + /* op *(T, mat) -> mat */ + /* op *(mat, T) -> mat */ + /* op *(mat, vec) -> vec */ + /* op *(vec, mat) -> vec */ + /* op *(mat, mat) -> mat */ + /* num overloads */ 9, + /* overloads */ &kOverloads[117], + }, + { + /* [3] */ + /* op /(T, T) -> T */ + /* op /(vec, vec) -> vec */ + /* op /(vec, T) -> vec */ + /* op /(T, vec) -> vec */ + /* num overloads */ 4, + /* overloads */ &kOverloads[259], + }, + { + /* [4] */ + /* op %(T, T) -> T */ + /* op %(vec, vec) -> vec */ + /* op %(vec, T) -> vec */ + /* op %(T, vec) -> vec */ + /* num overloads */ 4, + /* overloads */ &kOverloads[247], + }, + { + /* [5] */ + /* op ^(T, T) -> T */ + /* op ^(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[410], + }, + { + /* [6] */ + /* op &(bool, bool) -> bool */ + /* op &(vec, vec) -> vec */ + /* op &(T, T) -> T */ + /* op &(vec, vec) -> vec */ + /* num overloads */ 4, + /* overloads */ &kOverloads[251], + }, + { + /* [7] */ + /* op |(bool, bool) -> bool */ + /* op |(vec, vec) -> vec */ + /* op |(T, T) -> T */ + /* op |(vec, vec) -> vec */ + /* num overloads */ 4, + /* overloads */ &kOverloads[255], + }, + { + /* [8] */ + /* op &&(bool, bool) -> bool */ + /* num overloads */ 1, + /* overloads */ &kOverloads[437], + }, + { + /* [9] */ + /* op ||(bool, bool) -> bool */ + /* num overloads */ 1, + /* overloads */ &kOverloads[438], + }, + { + /* [10] */ + /* op ==(T, T) -> bool */ + /* op ==(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[404], + }, + { + /* [11] */ + /* op !=(T, T) -> bool */ + /* op !=(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[402], + }, + { + /* [12] */ + /* op <(T, T) -> bool */ + /* op <(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[388], + }, + { + /* [13] */ + /* op >(T, T) -> bool */ + /* op >(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[372], + }, + { + /* [14] */ + /* op <=(T, T) -> bool */ + /* op <=(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[370], + }, + { + /* [15] */ + /* op >=(T, T) -> bool */ + /* op >=(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[368], + }, + { + /* [16] */ + /* op <<(T, u32) -> T */ + /* op <<(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[426], + }, + { + /* [17] */ + /* op >>(T, u32) -> T */ + /* op >>(vec, vec) -> vec */ + /* num overloads */ 2, + /* overloads */ &kOverloads[364], + }, +}; +constexpr uint8_t kBinaryOperatorPlus = 0; +constexpr uint8_t kBinaryOperatorMinus = 1; +constexpr uint8_t kBinaryOperatorStar = 2; +constexpr uint8_t kBinaryOperatorDivide = 3; +constexpr uint8_t kBinaryOperatorModulo = 4; +constexpr uint8_t kBinaryOperatorXor = 5; +constexpr uint8_t kBinaryOperatorAnd = 6; +constexpr uint8_t kBinaryOperatorOr = 7; +constexpr uint8_t kBinaryOperatorLogicalAnd = 8; +constexpr uint8_t kBinaryOperatorLogicalOr = 9; +constexpr uint8_t kBinaryOperatorEqual = 10; +constexpr uint8_t kBinaryOperatorNotEqual = 11; +constexpr uint8_t kBinaryOperatorLessThan = 12; +constexpr uint8_t kBinaryOperatorGreaterThan = 13; +constexpr uint8_t kBinaryOperatorLessThanEqual = 14; +constexpr uint8_t kBinaryOperatorGreaterThanEqual = 15; +constexpr uint8_t kBinaryOperatorShiftLeft = 16; +constexpr uint8_t kBinaryOperatorShiftRight = 17; + +constexpr IntrinsicInfo kConstructorsAndConverters[] = { + { + /* [0] */ + /* ctor i32() -> i32 */ + /* ctor i32(i32) -> i32 */ + /* conv i32(T) -> i32 */ + /* num overloads */ 3, + /* overloads */ &kOverloads[263], + }, + { + /* [1] */ + /* ctor u32() -> u32 */ + /* ctor u32(u32) -> u32 */ + /* conv u32(T) -> u32 */ + /* num overloads */ 3, + /* overloads */ &kOverloads[278], + }, + { + /* [2] */ + /* ctor f32() -> f32 */ + /* ctor f32(f32) -> f32 */ + /* conv f32(T) -> f32 */ + /* num overloads */ 3, + /* overloads */ &kOverloads[272], + }, + { + /* [3] */ + /* ctor f16() -> f16 */ + /* ctor f16(f16) -> f16 */ + /* conv f16(T) -> f16 */ + /* num overloads */ 3, + /* overloads */ &kOverloads[269], + }, + { + /* [4] */ + /* ctor bool() -> bool */ + /* ctor bool(bool) -> bool */ + /* conv bool(T) -> bool */ + /* num overloads */ 3, + /* overloads */ &kOverloads[266], + }, + { + /* [5] */ + /* ctor vec2() -> vec2 */ + /* ctor vec2(vec2) -> vec2 */ + /* ctor vec2(T) -> vec2 */ + /* ctor vec2(x: T, y: T) -> vec2 */ + /* conv vec2(vec2) -> vec2 */ + /* conv vec2(vec2) -> vec2 */ + /* conv vec2(vec2) -> vec2 */ + /* conv vec2(vec2) -> vec2 */ + /* conv vec2(vec2) -> vec2 */ + /* num overloads */ 9, + /* overloads */ &kOverloads[135], + }, + { + /* [6] */ + /* ctor vec3() -> vec3 */ + /* ctor vec3(vec3) -> vec3 */ + /* ctor vec3(T) -> vec3 */ + /* ctor vec3(x: T, y: T, z: T) -> vec3 */ + /* ctor vec3(xy: vec2, z: T) -> vec3 */ + /* ctor vec3(x: T, yz: vec2) -> vec3 */ + /* conv vec3(vec3) -> vec3 */ + /* conv vec3(vec3) -> vec3 */ + /* conv vec3(vec3) -> vec3 */ + /* conv vec3(vec3) -> vec3 */ + /* conv vec3(vec3) -> vec3 */ + /* num overloads */ 11, + /* overloads */ &kOverloads[96], + }, + { + /* [7] */ + /* ctor vec4() -> vec4 */ + /* ctor vec4(vec4) -> vec4 */ + /* ctor vec4(T) -> vec4 */ + /* ctor vec4(x: T, y: T, z: T, w: T) -> vec4 */ + /* ctor vec4(xy: vec2, z: T, w: T) -> vec4 */ + /* ctor vec4(x: T, yz: vec2, w: T) -> vec4 */ + /* ctor vec4(x: T, y: T, zw: vec2) -> vec4 */ + /* ctor vec4(xy: vec2, zw: vec2) -> vec4 */ + /* ctor vec4(xyz: vec3, w: T) -> vec4 */ + /* ctor vec4(x: T, zyw: vec3) -> vec4 */ + /* conv vec4(vec4) -> vec4 */ + /* conv vec4(vec4) -> vec4 */ + /* conv vec4(vec4) -> vec4 */ + /* conv vec4(vec4) -> vec4 */ + /* conv vec4(vec4) -> vec4 */ + /* num overloads */ 15, + /* overloads */ &kOverloads[27], + }, + { + /* [8] */ + /* ctor mat2x2() -> mat2x2 */ + /* ctor mat2x2(mat2x2) -> mat2x2 */ + /* ctor mat2x2(T, T, T, T) -> mat2x2 */ + /* ctor mat2x2(vec2, vec2) -> mat2x2 */ + /* conv mat2x2(mat2x2) -> mat2x2 */ + /* conv mat2x2(mat2x2) -> mat2x2 */ + /* num overloads */ 6, + /* overloads */ &kOverloads[178], + }, + { + /* [9] */ + /* ctor mat2x3() -> mat2x3 */ + /* ctor mat2x3(mat2x3) -> mat2x3 */ + /* ctor mat2x3(T, T, T, T, T, T) -> mat2x3 */ + /* ctor mat2x3(vec3, vec3) -> mat2x3 */ + /* conv mat2x3(mat2x3) -> mat2x3 */ + /* conv mat2x3(mat2x3) -> mat2x3 */ + /* num overloads */ 6, + /* overloads */ &kOverloads[196], + }, + { + /* [10] */ + /* ctor mat2x4() -> mat2x4 */ + /* ctor mat2x4(mat2x4) -> mat2x4 */ + /* ctor mat2x4(T, T, T, T, T, T, T, T) -> mat2x4 */ + /* ctor mat2x4(vec4, vec4) -> mat2x4 */ + /* conv mat2x4(mat2x4) -> mat2x4 */ + /* conv mat2x4(mat2x4) -> mat2x4 */ + /* num overloads */ 6, + /* overloads */ &kOverloads[172], + }, + { + /* [11] */ + /* ctor mat3x2() -> mat3x2 */ + /* ctor mat3x2(mat3x2) -> mat3x2 */ + /* ctor mat3x2(T, T, T, T, T, T) -> mat3x2 */ + /* ctor mat3x2(vec2, vec2, vec2) -> mat3x2 */ + /* conv mat3x2(mat3x2) -> mat3x2 */ + /* conv mat3x2(mat3x2) -> mat3x2 */ + /* num overloads */ 6, + /* overloads */ &kOverloads[226], + }, + { + /* [12] */ + /* ctor mat3x3() -> mat3x3 */ + /* ctor mat3x3(mat3x3) -> mat3x3 */ + /* ctor mat3x3(T, T, T, T, T, T, T, T, T) -> mat3x3 */ + /* ctor mat3x3(vec3, vec3, vec3) -> mat3x3 */ + /* conv mat3x3(mat3x3) -> mat3x3 */ + /* conv mat3x3(mat3x3) -> mat3x3 */ + /* num overloads */ 6, + /* overloads */ &kOverloads[220], + }, + { + /* [13] */ + /* ctor mat3x4() -> mat3x4 */ + /* ctor mat3x4(mat3x4) -> mat3x4 */ + /* ctor mat3x4(T, T, T, T, T, T, T, T, T, T, T, T) -> mat3x4 */ + /* ctor mat3x4(vec4, vec4, vec4) -> mat3x4 */ + /* conv mat3x4(mat3x4) -> mat3x4 */ + /* conv mat3x4(mat3x4) -> mat3x4 */ + /* num overloads */ 6, + /* overloads */ &kOverloads[214], + }, + { + /* [14] */ + /* ctor mat4x2() -> mat4x2 */ + /* ctor mat4x2(mat4x2) -> mat4x2 */ + /* ctor mat4x2(T, T, T, T, T, T, T, T) -> mat4x2 */ + /* ctor mat4x2(vec2, vec2, vec2, vec2) -> mat4x2 */ + /* conv mat4x2(mat4x2) -> mat4x2 */ + /* conv mat4x2(mat4x2) -> mat4x2 */ + /* num overloads */ 6, + /* overloads */ &kOverloads[202], + }, + { + /* [15] */ + /* ctor mat4x3() -> mat4x3 */ + /* ctor mat4x3(mat4x3) -> mat4x3 */ + /* ctor mat4x3(T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x3 */ + /* ctor mat4x3(vec3, vec3, vec3, vec3) -> mat4x3 */ + /* conv mat4x3(mat4x3) -> mat4x3 */ + /* conv mat4x3(mat4x3) -> mat4x3 */ + /* num overloads */ 6, + /* overloads */ &kOverloads[208], + }, + { + /* [16] */ + /* ctor mat4x4() -> mat4x4 */ + /* ctor mat4x4(mat4x4) -> mat4x4 */ + /* ctor mat4x4(T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x4 */ + /* ctor mat4x4(vec4, vec4, vec4, vec4) -> mat4x4 */ + /* conv mat4x4(mat4x4) -> mat4x4 */ + /* conv mat4x4(mat4x4) -> mat4x4 */ + /* num overloads */ 6, + /* overloads */ &kOverloads[160], }, }; diff --git a/src/tint/resolver/intrinsic_table.inl.tmpl b/src/tint/resolver/intrinsic_table.inl.tmpl index 931ae247ae..750c29f381 100644 --- a/src/tint/resolver/intrinsic_table.inl.tmpl +++ b/src/tint/resolver/intrinsic_table.inl.tmpl @@ -1,17 +1,20 @@ {{- /* -------------------------------------------------------------------------------- -Template file for use with tools/builtin-gen to generate builtin_table.inl +Template file for use with tools/src/cmd/gen to generate builtin_table.inl Used by BuiltinTable.cc for builtin overload resolution. +To update the generated file, run: + ./tools/run gen + See: -* tools/cmd/intrinsic-gen/gen for structures used by this template +* tools/src/cmd/gen for structures used by this template * https://golang.org/pkg/text/template/ for documentation on the template syntax -------------------------------------------------------------------------------- */ -}} // clang-format off -{{ with .Sem -}} +{{ with Sem -}} {{ range .Types -}} {{ template "Type" . }} {{ end -}} @@ -23,7 +26,7 @@ See: {{ end -}} {{- end -}} -{{- with BuiltinTable -}} +{{- with IntrinsicTable -}} {{- template "Matchers" . }} constexpr MatcherIndex kMatcherIndices[] = { @@ -51,8 +54,8 @@ constexpr ParameterInfo kParameters[] = { {{- end }} }; -constexpr OpenTypeInfo kOpenTypes[] = { -{{- range $i, $o := .OpenTypes }} +constexpr TemplateTypeInfo kTemplateTypes[] = { +{{- range $i, $o := .TemplateTypes }} { /* [{{$i}}] */ /* name */ "{{$o.Name}}", @@ -64,8 +67,8 @@ constexpr OpenTypeInfo kOpenTypes[] = { {{- end }} }; -constexpr OpenNumberInfo kOpenNumbers[] = { -{{- range $i, $o := .OpenNumbers }} +constexpr TemplateNumberInfo kTemplateNumbers[] = { +{{- range $i, $o := .TemplateNumbers }} { /* [{{$i}}] */ /* name */ "{{$o.Name}}", @@ -82,39 +85,90 @@ constexpr OverloadInfo kOverloads[] = { { /* [{{$i}}] */ /* num parameters */ {{$o.NumParameters}}, - /* num open types */ {{$o.NumOpenTypes}}, - /* num open numbers */ {{$o.NumOpenNumbers}}, - /* open types */ -{{- if $o.OpenTypesOffset }} &kOpenTypes[{{$o.OpenTypesOffset}}], -{{- else }} nullptr, + /* num template types */ {{$o.NumTemplateTypes}}, + /* num template numbers */ {{$o.NumTemplateNumbers}}, + /* template types */ +{{- if $o.TemplateTypesOffset }} &kTemplateTypes[{{$o.TemplateTypesOffset}}], +{{- else }} nullptr, {{- end }} - /* open numbers */ -{{- if $o.OpenNumbersOffset }} &kOpenNumbers[{{$o.OpenNumbersOffset}}] -{{- else }} nullptr + /* template numbers */ +{{- if $o.TemplateNumbersOffset }} &kTemplateNumbers[{{$o.TemplateNumbersOffset}}] +{{- else }} nullptr {{- end }}, /* parameters */ &kParameters[{{$o.ParametersOffset}}], /* return matcher indices */ {{- if $o.ReturnMatcherIndicesOffset }} &kMatcherIndices[{{$o.ReturnMatcherIndicesOffset}}] {{- else }} nullptr {{- end }}, - /* supported_stages */ PipelineStageSet( + /* flags */ OverloadFlags(OverloadFlag::kIs{{Title $o.Kind}} {{- range $i, $u := $o.CanBeUsedInStage.List -}} -{{- if $i -}}, {{end}}PipelineStage::k{{Title $u}} -{{- end }}), - /* is_deprecated */ {{$o.IsDeprecated}}, + , OverloadFlag::kSupports{{Title $u}}Pipeline +{{- end }} +{{- if $o.IsDeprecated}}, OverloadFlag::kIsDeprecated{{end }}), + /* const eval */ +{{- if $o.ConstEvalFunction }} {{template "ConstEvalFn" $o}}, +{{- else }} nullptr, +{{- end }} }, {{- end }} }; -constexpr BuiltinInfo kBuiltins[] = { -{{- range $i, $f := .Functions }} +constexpr IntrinsicInfo kBuiltins[] = { +{{- range $i, $b := .Builtins }} { /* [{{$i}}] */ -{{- range $f.OverloadDescriptions }} +{{- range $b.OverloadDescriptions }} /* {{.}} */ {{- end }} - /* num overloads */ {{$f.NumOverloads}}, - /* overloads */ &kOverloads[{{$f.OverloadsOffset}}], + /* num overloads */ {{$b.NumOverloads}}, + /* overloads */ &kOverloads[{{$b.OverloadsOffset}}], + }, +{{- end }} +}; + +constexpr IntrinsicInfo kUnaryOperators[] = { +{{- range $i, $o := .UnaryOperators }} + { + /* [{{$i}}] */ +{{- range $o.OverloadDescriptions }} + /* {{.}} */ +{{- end }} + /* num overloads */ {{$o.NumOverloads}}, + /* overloads */ &kOverloads[{{$o.OverloadsOffset}}], + }, +{{- end }} +}; + +{{- range $i, $o := .UnaryOperators }} +constexpr uint8_t kUnaryOperator{{ template "ExpandName" $o.Name}} = {{$i}}; +{{- end }} + +constexpr IntrinsicInfo kBinaryOperators[] = { +{{- range $i, $o := .BinaryOperators }} + { + /* [{{$i}}] */ +{{- range $o.OverloadDescriptions }} + /* {{.}} */ +{{- end }} + /* num overloads */ {{$o.NumOverloads}}, + /* overloads */ &kOverloads[{{$o.OverloadsOffset}}], + }, +{{- end }} +}; + +{{- range $i, $o := .BinaryOperators }} +constexpr uint8_t kBinaryOperator{{ template "ExpandName" $o.Name}} = {{$i}}; +{{- end }} + +constexpr IntrinsicInfo kConstructorsAndConverters[] = { +{{- range $i, $o := .ConstructorsAndConverters }} + { + /* [{{$i}}] */ +{{- range $o.OverloadDescriptions }} + /* {{.}} */ +{{- end }} + /* num overloads */ {{$o.NumOverloads}}, + /* overloads */ &kOverloads[{{$o.OverloadsOffset}}], }, {{- end }} }; @@ -128,12 +182,11 @@ constexpr BuiltinInfo kBuiltins[] = { {{- $class := PascalCase .Name -}} /// TypeMatcher for 'type {{.Name}}' {{- if .Decl.Source.S.Filepath }} -/// @see {{.Decl.Source}} {{- end }} class {{$class}} : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -141,7 +194,7 @@ class {{$class}} : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* {{$class}}::Match(MatchState& state, const sem::Type* ty) const { @@ -160,7 +213,7 @@ const sem::Type* {{$class}}::Match(MatchState& state, const sem::Type* ty) const return build_{{TrimLeft .Name "_"}}(state{{range .TemplateParams}}, {{.GetName}}{{end}}); } -std::string {{$class}}::String(MatchState&{{if .TemplateParams}} state{{end}}) const { +std::string {{$class}}::String(MatchState*{{if .TemplateParams}} state{{end}}) const { {{- range .TemplateParams }} {{- template "DeclareLocalTemplateParamName" . }} {{- end }} @@ -183,13 +236,12 @@ std::string {{$class}}::String(MatchState&{{if .TemplateParams}} state{{end}}) c {{- $class := PascalCase .Name -}} /// TypeMatcher for 'match {{.Name}}' {{- if .Decl.Source.S.Filepath }} -/// @see {{.Decl.Source}} {{- end }} class {{$class}} : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules, and returns the /// expected, canonicalized type on success. - /// Match may close open types and numbers in state. + /// Match may define and refine the template types and numbers in state. /// @param state the MatchState /// @param type the type to match /// @returns the canonicalized type on match, otherwise nullptr @@ -197,11 +249,11 @@ class {{$class}} : public TypeMatcher { const sem::Type* type) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; const sem::Type* {{$class}}::Match(MatchState& state, const sem::Type* ty) const { -{{- range .Types }} +{{- range .PrecedenceSortedTypes }} if (match_{{.Name}}(ty)) { return build_{{.Name}}(state); } @@ -209,15 +261,18 @@ const sem::Type* {{$class}}::Match(MatchState& state, const sem::Type* ty) const return nullptr; } -std::string {{$class}}::String(MatchState&) const { - return " +std::string {{$class}}::String(MatchState*) const { + std::stringstream ss; + // Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support + // template arguments, nor can they match sub-types. As such, they have no use for the MatchState. + ss {{- range .Types -}} -{{- if IsFirstIn . $.Types }}{{.Name}} -{{- else if IsLastIn . $.Types }} or {{.Name}} -{{- else }}, {{.Name}} +{{- if IsFirstIn . $.Types }} << {{PascalCase .Name}}().String(nullptr) +{{- else if IsLastIn . $.Types }} << " or " << {{PascalCase .Name}}().String(nullptr) +{{- else }} << ", " << {{PascalCase .Name}}().String(nullptr) {{- end -}} -{{- end -}} - "; +{{- end -}}; + return ss.str(); } {{ end -}} @@ -228,19 +283,18 @@ std::string {{$class}}::String(MatchState&) const { {{- $enum := PascalCase .Enum.Name -}} /// EnumMatcher for 'match {{.Name}}' {{- if .Decl.Source.S.Filepath }} -/// @see {{.Decl.Source}} {{- end }} class {{$class}} : public NumberMatcher { public: /// Checks whether the given number matches the enum matcher rules. - /// Match may close open types and numbers in state. + /// Match may define template numbers in state. /// @param state the MatchState /// @param number the enum value as a Number /// @return true if the enum value matches the set Number Match(MatchState& state, Number number) const override; /// @param state the MatchState /// @return a string representation of the matcher. - std::string String(MatchState& state) const override; + std::string String(MatchState* state) const override; }; {{ if eq 1 (len .Options) -}} @@ -265,7 +319,7 @@ Number {{$class}}::Match(MatchState&, Number number) const { } {{- end }} -std::string {{$class}}::String(MatchState&) const { +std::string {{$class}}::String(MatchState*) const { return " {{- range .Options -}} {{- if IsFirstIn . $.Options }}{{.Name}} @@ -285,27 +339,27 @@ class Matchers { private: {{- $t_names := Map -}} {{- $n_names := Map -}} -{{- range Iterate .Sem.MaxOpenTypes -}} -{{- $name := printf "open_type_%v" . -}} +{{- range Iterate Sem.MaxTemplateTypes -}} +{{- $name := printf "template_type_%v" . -}} {{- $t_names.Put . $name }} - OpenTypeMatcher {{$name}}_{ {{- . -}} }; + TemplateTypeMatcher {{$name}}_{ {{- . -}} }; {{- end }} -{{- range Iterate .Sem.MaxOpenNumbers -}} -{{- $name := printf "open_number_%v" . -}} +{{- range Iterate Sem.MaxTemplateNumbers -}} +{{- $name := printf "template_number_%v" . -}} {{- $n_names.Put . $name }} - OpenNumberMatcher {{$name}}_{ {{- . -}} }; + TemplateNumberMatcher {{$name}}_{ {{- . -}} }; {{- end }} -{{- range .Sem.Types -}} +{{- range Sem.Types -}} {{- $name := PascalCase .Name -}} {{- $t_names.Put . $name }} {{$name}} {{$name}}_; {{- end }} -{{- range .Sem.TypeMatchers -}} +{{- range Sem.TypeMatchers -}} {{- $name := PascalCase .Name -}} {{- $t_names.Put . $name }} {{$name}} {{$name}}_; {{- end }} -{{- range .Sem.EnumMatchers -}} +{{- range Sem.EnumMatchers -}} {{- $name := PascalCase .Name -}} {{- $n_names.Put . $name }} {{$name}} {{$name}}_; @@ -317,7 +371,7 @@ class Matchers { /// Destructor ~Matchers(); - /// The open-types, types, and type matchers + /// The template types, types, and type matchers TypeMatcher const* const type[{{len .TMatchers}}] = { {{- range $i, $m := .TMatchers }} /* [{{$i}}] */ @@ -327,7 +381,7 @@ class Matchers { {{- end }} }; - /// The open-numbers, and number matchers + /// The template numbers, and number matchers NumberMatcher const* const number[{{len .NMatchers}}] = { {{- range $i, $m := .NMatchers }} /* [{{$i}}] */ @@ -358,11 +412,11 @@ Matchers::~Matchers() = default; {{- define "DeclareLocalTemplateParamName" -}} {{- /* ------------------------------------------------------------------ */ -}} {{- if IsTemplateTypeParam . }} - const std::string {{.Name}} = state.TypeName(); + const std::string {{.Name}} = state->TypeName(); {{- else if IsTemplateNumberParam . }} - const std::string {{.Name}} = state.NumName(); + const std::string {{.Name}} = state->NumName(); {{- else if IsTemplateEnumParam . }} - const std::string {{.Name}} = state.NumName(); + const std::string {{.Name}} = state->NumName(); {{- end -}} {{- end -}} @@ -399,3 +453,41 @@ Matchers::~Matchers() = default; {{- end -}} {{- end -}} {{- end -}} + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "ExpandName" -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- if eq . "<<" -}}ShiftLeft +{{- else if eq . "&" -}}And +{{- else if eq . "|" -}}Or +{{- else if eq . "^" -}}Xor +{{- else if eq . "&&" -}}LogicalAnd +{{- else if eq . "||" -}}LogicalOr +{{- else if eq . "==" -}}Equal +{{- else if eq . "!" -}}Not +{{- else if eq . "!=" -}}NotEqual +{{- else if eq . "~" -}}Complement +{{- else if eq . "<" -}}LessThan +{{- else if eq . ">" -}}GreaterThan +{{- else if eq . "<=" -}}LessThanEqual +{{- else if eq . ">=" -}}GreaterThanEqual +{{- else if eq . "<<" -}}ShiftLeft +{{- else if eq . ">>" -}}ShiftRight +{{- else if eq . "+" -}}Plus +{{- else if eq . "-" -}}Minus +{{- else if eq . "*" -}}Star +{{- else if eq . "/" -}}Divide +{{- else if eq . "%" -}}Modulo +{{- else -}}{{.}} +{{- end -}} +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "ConstEvalFn" -}} +{{- /* ------------------------------------------------------------------ */ -}} + &ConstEval:: +{{- if eq .Kind "operator" -}}Op{{end -}} + {{template "ExpandName" .ConstEvalFunction}} +{{- end -}} + diff --git a/src/tint/resolver/intrinsic_table_test.cc b/src/tint/resolver/intrinsic_table_test.cc index c4f4fd4b23..02c97f7aac 100644 --- a/src/tint/resolver/intrinsic_table_test.cc +++ b/src/tint/resolver/intrinsic_table_test.cc @@ -14,8 +14,11 @@ #include "src/tint/resolver/intrinsic_table.h" +#include + #include "gmock/gmock.h" #include "src/tint/program_builder.h" +#include "src/tint/resolver/resolver_test_helper.h" #include "src/tint/sem/atomic.h" #include "src/tint/sem/depth_multisampled_texture.h" #include "src/tint/sem/depth_texture.h" @@ -24,8 +27,11 @@ #include "src/tint/sem/reference.h" #include "src/tint/sem/sampled_texture.h" #include "src/tint/sem/storage_texture.h" +#include "src/tint/sem/test_helper.h" +#include "src/tint/sem/type_constructor.h" +#include "src/tint/sem/type_conversion.h" -namespace tint { +namespace tint::resolver { namespace { using ::testing::HasSubstr; @@ -34,6 +40,12 @@ using BuiltinType = sem::BuiltinType; using Parameter = sem::Parameter; using ParameterUsage = sem::ParameterUsage; +using AFloatV = builder::vec<3, AFloat>; +using AIntV = builder::vec<3, AInt>; +using f32V = builder::vec<3, f32>; +using i32V = builder::vec<3, i32>; +using u32V = builder::vec<3, u32>; + class IntrinsicTableTest : public testing::Test, public ProgramBuilder { public: std::unique_ptr table = IntrinsicTable::Create(*this); @@ -41,19 +53,19 @@ class IntrinsicTableTest : public testing::Test, public ProgramBuilder { TEST_F(IntrinsicTableTest, MatchF32) { auto* f32 = create(); - auto* result = table->Lookup(BuiltinType::kCos, {f32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kCos, utils::Vector{f32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kCos); - EXPECT_EQ(result->ReturnType(), f32); - ASSERT_EQ(result->Parameters().size(), 1u); - EXPECT_EQ(result->Parameters()[0]->Type(), f32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kCos); + EXPECT_EQ(result.sem->ReturnType(), f32); + ASSERT_EQ(result.sem->Parameters().Length(), 1u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), f32); } TEST_F(IntrinsicTableTest, MismatchF32) { auto* i32 = create(); - auto* result = table->Lookup(BuiltinType::kCos, {i32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kCos, utils::Vector{i32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } @@ -61,19 +73,19 @@ TEST_F(IntrinsicTableTest, MatchU32) { auto* f32 = create(); auto* u32 = create(); auto* vec2_f32 = create(f32, 2u); - auto* result = table->Lookup(BuiltinType::kUnpack2x16float, {u32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kUnpack2x16float, utils::Vector{u32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kUnpack2x16float); - EXPECT_EQ(result->ReturnType(), vec2_f32); - ASSERT_EQ(result->Parameters().size(), 1u); - EXPECT_EQ(result->Parameters()[0]->Type(), u32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kUnpack2x16float); + EXPECT_EQ(result.sem->ReturnType(), vec2_f32); + ASSERT_EQ(result.sem->Parameters().Length(), 1u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), u32); } TEST_F(IntrinsicTableTest, MismatchU32) { auto* f32 = create(); - auto* result = table->Lookup(BuiltinType::kUnpack2x16float, {f32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kUnpack2x16float, utils::Vector{f32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } @@ -82,121 +94,121 @@ TEST_F(IntrinsicTableTest, MatchI32) { auto* i32 = create(); auto* vec4_f32 = create(f32, 4u); auto* tex = create(ast::TextureDimension::k1d, f32); - auto* result = table->Lookup(BuiltinType::kTextureLoad, {tex, i32, i32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kTextureLoad, utils::Vector{tex, i32, i32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kTextureLoad); - EXPECT_EQ(result->ReturnType(), vec4_f32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), tex); - EXPECT_EQ(result->Parameters()[0]->Usage(), ParameterUsage::kTexture); - EXPECT_EQ(result->Parameters()[1]->Type(), i32); - EXPECT_EQ(result->Parameters()[1]->Usage(), ParameterUsage::kCoords); - EXPECT_EQ(result->Parameters()[2]->Type(), i32); - EXPECT_EQ(result->Parameters()[2]->Usage(), ParameterUsage::kLevel); + EXPECT_EQ(result.sem->Type(), BuiltinType::kTextureLoad); + EXPECT_EQ(result.sem->ReturnType(), vec4_f32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), tex); + EXPECT_EQ(result.sem->Parameters()[0]->Usage(), ParameterUsage::kTexture); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), i32); + EXPECT_EQ(result.sem->Parameters()[1]->Usage(), ParameterUsage::kCoords); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), i32); + EXPECT_EQ(result.sem->Parameters()[2]->Usage(), ParameterUsage::kLevel); } TEST_F(IntrinsicTableTest, MismatchI32) { auto* f32 = create(); auto* tex = create(ast::TextureDimension::k1d, f32); - auto* result = table->Lookup(BuiltinType::kTextureLoad, {tex, f32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kTextureLoad, utils::Vector{tex, f32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } TEST_F(IntrinsicTableTest, MatchIU32AsI32) { auto* i32 = create(); - auto* result = table->Lookup(BuiltinType::kCountOneBits, {i32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kCountOneBits, utils::Vector{i32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kCountOneBits); - EXPECT_EQ(result->ReturnType(), i32); - ASSERT_EQ(result->Parameters().size(), 1u); - EXPECT_EQ(result->Parameters()[0]->Type(), i32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kCountOneBits); + EXPECT_EQ(result.sem->ReturnType(), i32); + ASSERT_EQ(result.sem->Parameters().Length(), 1u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), i32); } TEST_F(IntrinsicTableTest, MatchIU32AsU32) { auto* u32 = create(); - auto* result = table->Lookup(BuiltinType::kCountOneBits, {u32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kCountOneBits, utils::Vector{u32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kCountOneBits); - EXPECT_EQ(result->ReturnType(), u32); - ASSERT_EQ(result->Parameters().size(), 1u); - EXPECT_EQ(result->Parameters()[0]->Type(), u32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kCountOneBits); + EXPECT_EQ(result.sem->ReturnType(), u32); + ASSERT_EQ(result.sem->Parameters().Length(), 1u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), u32); } TEST_F(IntrinsicTableTest, MismatchIU32) { auto* f32 = create(); - auto* result = table->Lookup(BuiltinType::kCountOneBits, {f32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kCountOneBits, utils::Vector{f32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } TEST_F(IntrinsicTableTest, MatchFIU32AsI32) { auto* i32 = create(); - auto* result = table->Lookup(BuiltinType::kClamp, {i32, i32, i32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kClamp, utils::Vector{i32, i32, i32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kClamp); - EXPECT_EQ(result->ReturnType(), i32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), i32); - EXPECT_EQ(result->Parameters()[1]->Type(), i32); - EXPECT_EQ(result->Parameters()[2]->Type(), i32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kClamp); + EXPECT_EQ(result.sem->ReturnType(), i32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), i32); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), i32); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), i32); } TEST_F(IntrinsicTableTest, MatchFIU32AsU32) { auto* u32 = create(); - auto* result = table->Lookup(BuiltinType::kClamp, {u32, u32, u32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kClamp, utils::Vector{u32, u32, u32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kClamp); - EXPECT_EQ(result->ReturnType(), u32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), u32); - EXPECT_EQ(result->Parameters()[1]->Type(), u32); - EXPECT_EQ(result->Parameters()[2]->Type(), u32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kClamp); + EXPECT_EQ(result.sem->ReturnType(), u32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), u32); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), u32); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), u32); } TEST_F(IntrinsicTableTest, MatchFIU32AsF32) { auto* f32 = create(); - auto* result = table->Lookup(BuiltinType::kClamp, {f32, f32, f32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kClamp, utils::Vector{f32, f32, f32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kClamp); - EXPECT_EQ(result->ReturnType(), f32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), f32); - EXPECT_EQ(result->Parameters()[1]->Type(), f32); - EXPECT_EQ(result->Parameters()[2]->Type(), f32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kClamp); + EXPECT_EQ(result.sem->ReturnType(), f32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), f32); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), f32); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), f32); } TEST_F(IntrinsicTableTest, MismatchFIU32) { auto* bool_ = create(); - auto* result = table->Lookup(BuiltinType::kClamp, {bool_, bool_, bool_}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kClamp, utils::Vector{bool_, bool_, bool_}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } TEST_F(IntrinsicTableTest, MatchBool) { auto* f32 = create(); auto* bool_ = create(); - auto* result = table->Lookup(BuiltinType::kSelect, {f32, f32, bool_}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kSelect, utils::Vector{f32, f32, bool_}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kSelect); - EXPECT_EQ(result->ReturnType(), f32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), f32); - EXPECT_EQ(result->Parameters()[1]->Type(), f32); - EXPECT_EQ(result->Parameters()[2]->Type(), bool_); + EXPECT_EQ(result.sem->Type(), BuiltinType::kSelect); + EXPECT_EQ(result.sem->ReturnType(), f32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), f32); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), f32); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), bool_); } TEST_F(IntrinsicTableTest, MismatchBool) { auto* f32 = create(); - auto* result = table->Lookup(BuiltinType::kSelect, {f32, f32, f32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kSelect, utils::Vector{f32, f32, f32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } @@ -205,41 +217,41 @@ TEST_F(IntrinsicTableTest, MatchPointer) { auto* atomicI32 = create(i32); auto* ptr = create(atomicI32, ast::StorageClass::kWorkgroup, ast::Access::kReadWrite); - auto* result = table->Lookup(BuiltinType::kAtomicLoad, {ptr}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kAtomicLoad, utils::Vector{ptr}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kAtomicLoad); - EXPECT_EQ(result->ReturnType(), i32); - ASSERT_EQ(result->Parameters().size(), 1u); - EXPECT_EQ(result->Parameters()[0]->Type(), ptr); + EXPECT_EQ(result.sem->Type(), BuiltinType::kAtomicLoad); + EXPECT_EQ(result.sem->ReturnType(), i32); + ASSERT_EQ(result.sem->Parameters().Length(), 1u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), ptr); } TEST_F(IntrinsicTableTest, MismatchPointer) { auto* i32 = create(); auto* atomicI32 = create(i32); - auto* result = table->Lookup(BuiltinType::kAtomicLoad, {atomicI32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kAtomicLoad, utils::Vector{atomicI32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } TEST_F(IntrinsicTableTest, MatchArray) { auto* arr = create(create(), 0u, 4u, 4u, 4u, 4u); auto* arr_ptr = create(arr, ast::StorageClass::kStorage, ast::Access::kReadWrite); - auto* result = table->Lookup(BuiltinType::kArrayLength, {arr_ptr}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kArrayLength, utils::Vector{arr_ptr}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kArrayLength); - EXPECT_TRUE(result->ReturnType()->Is()); - ASSERT_EQ(result->Parameters().size(), 1u); - auto* param_type = result->Parameters()[0]->Type(); + EXPECT_EQ(result.sem->Type(), BuiltinType::kArrayLength); + EXPECT_TRUE(result.sem->ReturnType()->Is()); + ASSERT_EQ(result.sem->Parameters().Length(), 1u); + auto* param_type = result.sem->Parameters()[0]->Type(); ASSERT_TRUE(param_type->Is()); EXPECT_TRUE(param_type->As()->StoreType()->Is()); } TEST_F(IntrinsicTableTest, MismatchArray) { auto* f32 = create(); - auto* result = table->Lookup(BuiltinType::kArrayLength, {f32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kArrayLength, utils::Vector{f32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } @@ -249,26 +261,28 @@ TEST_F(IntrinsicTableTest, MatchSampler) { auto* vec4_f32 = create(f32, 4u); auto* tex = create(ast::TextureDimension::k2d, f32); auto* sampler = create(ast::SamplerKind::kSampler); - auto* result = table->Lookup(BuiltinType::kTextureSample, {tex, sampler, vec2_f32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = + table->Lookup(BuiltinType::kTextureSample, utils::Vector{tex, sampler, vec2_f32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kTextureSample); - EXPECT_EQ(result->ReturnType(), vec4_f32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), tex); - EXPECT_EQ(result->Parameters()[0]->Usage(), ParameterUsage::kTexture); - EXPECT_EQ(result->Parameters()[1]->Type(), sampler); - EXPECT_EQ(result->Parameters()[1]->Usage(), ParameterUsage::kSampler); - EXPECT_EQ(result->Parameters()[2]->Type(), vec2_f32); - EXPECT_EQ(result->Parameters()[2]->Usage(), ParameterUsage::kCoords); + EXPECT_EQ(result.sem->Type(), BuiltinType::kTextureSample); + EXPECT_EQ(result.sem->ReturnType(), vec4_f32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), tex); + EXPECT_EQ(result.sem->Parameters()[0]->Usage(), ParameterUsage::kTexture); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), sampler); + EXPECT_EQ(result.sem->Parameters()[1]->Usage(), ParameterUsage::kSampler); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), vec2_f32); + EXPECT_EQ(result.sem->Parameters()[2]->Usage(), ParameterUsage::kCoords); } TEST_F(IntrinsicTableTest, MismatchSampler) { auto* f32 = create(); auto* vec2_f32 = create(f32, 2u); auto* tex = create(ast::TextureDimension::k2d, f32); - auto* result = table->Lookup(BuiltinType::kTextureSample, {tex, f32, vec2_f32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = + table->Lookup(BuiltinType::kTextureSample, utils::Vector{tex, f32, vec2_f32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } @@ -278,18 +292,19 @@ TEST_F(IntrinsicTableTest, MatchSampledTexture) { auto* vec2_i32 = create(i32, 2u); auto* vec4_f32 = create(f32, 4u); auto* tex = create(ast::TextureDimension::k2d, f32); - auto* result = table->Lookup(BuiltinType::kTextureLoad, {tex, vec2_i32, i32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = + table->Lookup(BuiltinType::kTextureLoad, utils::Vector{tex, vec2_i32, i32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kTextureLoad); - EXPECT_EQ(result->ReturnType(), vec4_f32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), tex); - EXPECT_EQ(result->Parameters()[0]->Usage(), ParameterUsage::kTexture); - EXPECT_EQ(result->Parameters()[1]->Type(), vec2_i32); - EXPECT_EQ(result->Parameters()[1]->Usage(), ParameterUsage::kCoords); - EXPECT_EQ(result->Parameters()[2]->Type(), i32); - EXPECT_EQ(result->Parameters()[2]->Usage(), ParameterUsage::kLevel); + EXPECT_EQ(result.sem->Type(), BuiltinType::kTextureLoad); + EXPECT_EQ(result.sem->ReturnType(), vec4_f32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), tex); + EXPECT_EQ(result.sem->Parameters()[0]->Usage(), ParameterUsage::kTexture); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), vec2_i32); + EXPECT_EQ(result.sem->Parameters()[1]->Usage(), ParameterUsage::kCoords); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), i32); + EXPECT_EQ(result.sem->Parameters()[2]->Usage(), ParameterUsage::kLevel); } TEST_F(IntrinsicTableTest, MatchMultisampledTexture) { @@ -298,18 +313,19 @@ TEST_F(IntrinsicTableTest, MatchMultisampledTexture) { auto* vec2_i32 = create(i32, 2u); auto* vec4_f32 = create(f32, 4u); auto* tex = create(ast::TextureDimension::k2d, f32); - auto* result = table->Lookup(BuiltinType::kTextureLoad, {tex, vec2_i32, i32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = + table->Lookup(BuiltinType::kTextureLoad, utils::Vector{tex, vec2_i32, i32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kTextureLoad); - EXPECT_EQ(result->ReturnType(), vec4_f32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), tex); - EXPECT_EQ(result->Parameters()[0]->Usage(), ParameterUsage::kTexture); - EXPECT_EQ(result->Parameters()[1]->Type(), vec2_i32); - EXPECT_EQ(result->Parameters()[1]->Usage(), ParameterUsage::kCoords); - EXPECT_EQ(result->Parameters()[2]->Type(), i32); - EXPECT_EQ(result->Parameters()[2]->Usage(), ParameterUsage::kSampleIndex); + EXPECT_EQ(result.sem->Type(), BuiltinType::kTextureLoad); + EXPECT_EQ(result.sem->ReturnType(), vec4_f32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), tex); + EXPECT_EQ(result.sem->Parameters()[0]->Usage(), ParameterUsage::kTexture); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), vec2_i32); + EXPECT_EQ(result.sem->Parameters()[1]->Usage(), ParameterUsage::kCoords); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), i32); + EXPECT_EQ(result.sem->Parameters()[2]->Usage(), ParameterUsage::kSampleIndex); } TEST_F(IntrinsicTableTest, MatchDepthTexture) { @@ -317,18 +333,19 @@ TEST_F(IntrinsicTableTest, MatchDepthTexture) { auto* i32 = create(); auto* vec2_i32 = create(i32, 2u); auto* tex = create(ast::TextureDimension::k2d); - auto* result = table->Lookup(BuiltinType::kTextureLoad, {tex, vec2_i32, i32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = + table->Lookup(BuiltinType::kTextureLoad, utils::Vector{tex, vec2_i32, i32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kTextureLoad); - EXPECT_EQ(result->ReturnType(), f32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), tex); - EXPECT_EQ(result->Parameters()[0]->Usage(), ParameterUsage::kTexture); - EXPECT_EQ(result->Parameters()[1]->Type(), vec2_i32); - EXPECT_EQ(result->Parameters()[1]->Usage(), ParameterUsage::kCoords); - EXPECT_EQ(result->Parameters()[2]->Type(), i32); - EXPECT_EQ(result->Parameters()[2]->Usage(), ParameterUsage::kLevel); + EXPECT_EQ(result.sem->Type(), BuiltinType::kTextureLoad); + EXPECT_EQ(result.sem->ReturnType(), f32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), tex); + EXPECT_EQ(result.sem->Parameters()[0]->Usage(), ParameterUsage::kTexture); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), vec2_i32); + EXPECT_EQ(result.sem->Parameters()[1]->Usage(), ParameterUsage::kCoords); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), i32); + EXPECT_EQ(result.sem->Parameters()[2]->Usage(), ParameterUsage::kLevel); } TEST_F(IntrinsicTableTest, MatchDepthMultisampledTexture) { @@ -336,18 +353,19 @@ TEST_F(IntrinsicTableTest, MatchDepthMultisampledTexture) { auto* i32 = create(); auto* vec2_i32 = create(i32, 2u); auto* tex = create(ast::TextureDimension::k2d); - auto* result = table->Lookup(BuiltinType::kTextureLoad, {tex, vec2_i32, i32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = + table->Lookup(BuiltinType::kTextureLoad, utils::Vector{tex, vec2_i32, i32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kTextureLoad); - EXPECT_EQ(result->ReturnType(), f32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), tex); - EXPECT_EQ(result->Parameters()[0]->Usage(), ParameterUsage::kTexture); - EXPECT_EQ(result->Parameters()[1]->Type(), vec2_i32); - EXPECT_EQ(result->Parameters()[1]->Usage(), ParameterUsage::kCoords); - EXPECT_EQ(result->Parameters()[2]->Type(), i32); - EXPECT_EQ(result->Parameters()[2]->Usage(), ParameterUsage::kSampleIndex); + EXPECT_EQ(result.sem->Type(), BuiltinType::kTextureLoad); + EXPECT_EQ(result.sem->ReturnType(), f32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), tex); + EXPECT_EQ(result.sem->Parameters()[0]->Usage(), ParameterUsage::kTexture); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), vec2_i32); + EXPECT_EQ(result.sem->Parameters()[1]->Usage(), ParameterUsage::kCoords); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), i32); + EXPECT_EQ(result.sem->Parameters()[2]->Usage(), ParameterUsage::kSampleIndex); } TEST_F(IntrinsicTableTest, MatchExternalTexture) { @@ -356,16 +374,16 @@ TEST_F(IntrinsicTableTest, MatchExternalTexture) { auto* vec2_i32 = create(i32, 2u); auto* vec4_f32 = create(f32, 4u); auto* tex = create(); - auto* result = table->Lookup(BuiltinType::kTextureLoad, {tex, vec2_i32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kTextureLoad, utils::Vector{tex, vec2_i32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kTextureLoad); - EXPECT_EQ(result->ReturnType(), vec4_f32); - ASSERT_EQ(result->Parameters().size(), 2u); - EXPECT_EQ(result->Parameters()[0]->Type(), tex); - EXPECT_EQ(result->Parameters()[0]->Usage(), ParameterUsage::kTexture); - EXPECT_EQ(result->Parameters()[1]->Type(), vec2_i32); - EXPECT_EQ(result->Parameters()[1]->Usage(), ParameterUsage::kCoords); + EXPECT_EQ(result.sem->Type(), BuiltinType::kTextureLoad); + EXPECT_EQ(result.sem->ReturnType(), vec4_f32); + ASSERT_EQ(result.sem->Parameters().Length(), 2u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), tex); + EXPECT_EQ(result.sem->Parameters()[0]->Usage(), ParameterUsage::kTexture); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), vec2_i32); + EXPECT_EQ(result.sem->Parameters()[1]->Usage(), ParameterUsage::kCoords); } TEST_F(IntrinsicTableTest, MatchWOStorageTexture) { @@ -377,83 +395,88 @@ TEST_F(IntrinsicTableTest, MatchWOStorageTexture) { auto* tex = create(ast::TextureDimension::k2d, ast::TexelFormat::kR32Float, ast::Access::kWrite, subtype); - auto* result = table->Lookup(BuiltinType::kTextureStore, {tex, vec2_i32, vec4_f32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = + table->Lookup(BuiltinType::kTextureStore, utils::Vector{tex, vec2_i32, vec4_f32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kTextureStore); - EXPECT_TRUE(result->ReturnType()->Is()); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), tex); - EXPECT_EQ(result->Parameters()[0]->Usage(), ParameterUsage::kTexture); - EXPECT_EQ(result->Parameters()[1]->Type(), vec2_i32); - EXPECT_EQ(result->Parameters()[1]->Usage(), ParameterUsage::kCoords); - EXPECT_EQ(result->Parameters()[2]->Type(), vec4_f32); - EXPECT_EQ(result->Parameters()[2]->Usage(), ParameterUsage::kValue); + EXPECT_EQ(result.sem->Type(), BuiltinType::kTextureStore); + EXPECT_TRUE(result.sem->ReturnType()->Is()); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), tex); + EXPECT_EQ(result.sem->Parameters()[0]->Usage(), ParameterUsage::kTexture); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), vec2_i32); + EXPECT_EQ(result.sem->Parameters()[1]->Usage(), ParameterUsage::kCoords); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), vec4_f32); + EXPECT_EQ(result.sem->Parameters()[2]->Usage(), ParameterUsage::kValue); } TEST_F(IntrinsicTableTest, MismatchTexture) { auto* f32 = create(); auto* i32 = create(); auto* vec2_i32 = create(i32, 2u); - auto* result = table->Lookup(BuiltinType::kTextureLoad, {f32, vec2_i32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kTextureLoad, utils::Vector{f32, vec2_i32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } TEST_F(IntrinsicTableTest, ImplicitLoadOnReference) { auto* f32 = create(); - auto* result = table->Lookup( + auto result = table->Lookup( BuiltinType::kCos, - {create(f32, ast::StorageClass::kFunction, ast::Access::kReadWrite)}, + utils::Vector{ + create(f32, ast::StorageClass::kFunction, ast::Access::kReadWrite), + }, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kCos); - EXPECT_EQ(result->ReturnType(), f32); - ASSERT_EQ(result->Parameters().size(), 1u); - EXPECT_EQ(result->Parameters()[0]->Type(), f32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kCos); + EXPECT_EQ(result.sem->ReturnType(), f32); + ASSERT_EQ(result.sem->Parameters().Length(), 1u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), f32); } -TEST_F(IntrinsicTableTest, MatchOpenType) { +TEST_F(IntrinsicTableTest, MatchTemplateType) { auto* f32 = create(); - auto* result = table->Lookup(BuiltinType::kClamp, {f32, f32, f32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kClamp, utils::Vector{f32, f32, f32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kClamp); - EXPECT_EQ(result->ReturnType(), f32); - EXPECT_EQ(result->Parameters()[0]->Type(), f32); - EXPECT_EQ(result->Parameters()[1]->Type(), f32); - EXPECT_EQ(result->Parameters()[2]->Type(), f32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kClamp); + EXPECT_EQ(result.sem->ReturnType(), f32); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), f32); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), f32); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), f32); } -TEST_F(IntrinsicTableTest, MismatchOpenType) { +TEST_F(IntrinsicTableTest, MismatchTemplateType) { auto* f32 = create(); auto* u32 = create(); - auto* result = table->Lookup(BuiltinType::kClamp, {f32, u32, f32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kClamp, utils::Vector{f32, u32, f32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } TEST_F(IntrinsicTableTest, MatchOpenSizeVector) { auto* f32 = create(); auto* vec2_f32 = create(f32, 2u); - auto* result = table->Lookup(BuiltinType::kClamp, {vec2_f32, vec2_f32, vec2_f32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = + table->Lookup(BuiltinType::kClamp, utils::Vector{vec2_f32, vec2_f32, vec2_f32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kClamp); - EXPECT_EQ(result->ReturnType(), vec2_f32); - ASSERT_EQ(result->Parameters().size(), 3u); - EXPECT_EQ(result->Parameters()[0]->Type(), vec2_f32); - EXPECT_EQ(result->Parameters()[1]->Type(), vec2_f32); - EXPECT_EQ(result->Parameters()[2]->Type(), vec2_f32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kClamp); + EXPECT_EQ(result.sem->ReturnType(), vec2_f32); + ASSERT_EQ(result.sem->Parameters().Length(), 3u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), vec2_f32); + EXPECT_EQ(result.sem->Parameters()[1]->Type(), vec2_f32); + EXPECT_EQ(result.sem->Parameters()[2]->Type(), vec2_f32); } TEST_F(IntrinsicTableTest, MismatchOpenSizeVector) { auto* f32 = create(); auto* u32 = create(); auto* vec2_f32 = create(f32, 2u); - auto* result = table->Lookup(BuiltinType::kClamp, {vec2_f32, u32, vec2_f32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = + table->Lookup(BuiltinType::kClamp, utils::Vector{vec2_f32, u32, vec2_f32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } @@ -461,21 +484,21 @@ TEST_F(IntrinsicTableTest, MatchOpenSizeMatrix) { auto* f32 = create(); auto* vec3_f32 = create(f32, 3u); auto* mat3_f32 = create(vec3_f32, 3u); - auto* result = table->Lookup(BuiltinType::kDeterminant, {mat3_f32}, Source{}); - ASSERT_NE(result, nullptr) << Diagnostics().str(); + auto result = table->Lookup(BuiltinType::kDeterminant, utils::Vector{mat3_f32}, Source{}); + ASSERT_NE(result.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(result->Type(), BuiltinType::kDeterminant); - EXPECT_EQ(result->ReturnType(), f32); - ASSERT_EQ(result->Parameters().size(), 1u); - EXPECT_EQ(result->Parameters()[0]->Type(), mat3_f32); + EXPECT_EQ(result.sem->Type(), BuiltinType::kDeterminant); + EXPECT_EQ(result.sem->ReturnType(), f32); + ASSERT_EQ(result.sem->Parameters().Length(), 1u); + EXPECT_EQ(result.sem->Parameters()[0]->Type(), mat3_f32); } TEST_F(IntrinsicTableTest, MismatchOpenSizeMatrix) { auto* f32 = create(); auto* vec2_f32 = create(f32, 2u); auto* mat3x2_f32 = create(vec2_f32, 3u); - auto* result = table->Lookup(BuiltinType::kDeterminant, {mat3x2_f32}, Source{}); - ASSERT_EQ(result, nullptr); + auto result = table->Lookup(BuiltinType::kDeterminant, utils::Vector{mat3x2_f32}, Source{}); + ASSERT_EQ(result.sem, nullptr); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); } @@ -483,7 +506,7 @@ TEST_F(IntrinsicTableTest, OverloadOrderByNumberOfParameters) { // None of the arguments match, so expect the overloads with 2 parameters to // come first auto* bool_ = create(); - table->Lookup(BuiltinType::kTextureDimensions, {bool_, bool_}, Source{}); + table->Lookup(BuiltinType::kTextureDimensions, utils::Vector{bool_, bool_}, Source{}); ASSERT_EQ(Diagnostics().str(), R"(error: no matching call to textureDimensions(bool, bool) @@ -521,7 +544,7 @@ TEST_F(IntrinsicTableTest, OverloadOrderByNumberOfParameters) { TEST_F(IntrinsicTableTest, OverloadOrderByMatchingParameter) { auto* tex = create(ast::TextureDimension::k2d); auto* bool_ = create(); - table->Lookup(BuiltinType::kTextureDimensions, {tex, bool_}, Source{}); + table->Lookup(BuiltinType::kTextureDimensions, utils::Vector{tex, bool_}, Source{}); ASSERT_EQ(Diagnostics().str(), R"(error: no matching call to textureDimensions(texture_depth_2d, bool) @@ -560,21 +583,757 @@ TEST_F(IntrinsicTableTest, SameOverloadReturnsSameBuiltinPointer) { auto* f32 = create(); auto* vec2_f32 = create(create(), 2u); auto* bool_ = create(); - auto* a = table->Lookup(BuiltinType::kSelect, {f32, f32, bool_}, Source{}); - ASSERT_NE(a, nullptr) << Diagnostics().str(); + auto a = table->Lookup(BuiltinType::kSelect, utils::Vector{f32, f32, bool_}, Source{}); + ASSERT_NE(a.sem, nullptr) << Diagnostics().str(); - auto* b = table->Lookup(BuiltinType::kSelect, {f32, f32, bool_}, Source{}); - ASSERT_NE(b, nullptr) << Diagnostics().str(); + auto b = table->Lookup(BuiltinType::kSelect, utils::Vector{f32, f32, bool_}, Source{}); + ASSERT_NE(b.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - auto* c = table->Lookup(BuiltinType::kSelect, {vec2_f32, vec2_f32, bool_}, Source{}); - ASSERT_NE(c, nullptr) << Diagnostics().str(); + auto c = + table->Lookup(BuiltinType::kSelect, utils::Vector{vec2_f32, vec2_f32, bool_}, Source{}); + ASSERT_NE(c.sem, nullptr) << Diagnostics().str(); ASSERT_EQ(Diagnostics().str(), ""); - EXPECT_EQ(a, b); - EXPECT_NE(a, c); - EXPECT_NE(b, c); + EXPECT_EQ(a.sem, b.sem); + EXPECT_NE(a.sem, c.sem); + EXPECT_NE(b.sem, c.sem); } +TEST_F(IntrinsicTableTest, MatchUnaryOp) { + auto* i32 = create(); + auto* vec3_i32 = create(i32, 3u); + auto result = table->Lookup(ast::UnaryOp::kNegation, vec3_i32, Source{{12, 34}}); + EXPECT_EQ(result.result, vec3_i32); + EXPECT_EQ(result.result, vec3_i32); + EXPECT_EQ(Diagnostics().str(), ""); +} + +TEST_F(IntrinsicTableTest, MismatchUnaryOp) { + auto* bool_ = create(); + auto result = table->Lookup(ast::UnaryOp::kNegation, bool_, Source{{12, 34}}); + ASSERT_EQ(result.result, nullptr); + EXPECT_EQ(Diagnostics().str(), R"(12:34 error: no matching overload for operator - (bool) + +2 candidate operators: + operator - (T) -> T where: T is abstract-float, abstract-int, f32, i32 or f16 + operator - (vecN) -> vecN where: T is abstract-float, abstract-int, f32, i32 or f16 +)"); +} + +TEST_F(IntrinsicTableTest, MatchBinaryOp) { + auto* i32 = create(); + auto* vec3_i32 = create(i32, 3u); + auto result = table->Lookup(ast::BinaryOp::kMultiply, i32, vec3_i32, Source{{12, 34}}, + /* is_compound */ false); + EXPECT_EQ(result.result, vec3_i32); + EXPECT_EQ(result.lhs, i32); + EXPECT_EQ(result.rhs, vec3_i32); + EXPECT_EQ(Diagnostics().str(), ""); +} + +TEST_F(IntrinsicTableTest, MismatchBinaryOp) { + auto* f32 = create(); + auto* bool_ = create(); + auto result = table->Lookup(ast::BinaryOp::kMultiply, f32, bool_, Source{{12, 34}}, + /* is_compound */ false); + ASSERT_EQ(result.result, nullptr); + EXPECT_EQ(Diagnostics().str(), R"(12:34 error: no matching overload for operator * (f32, bool) + +9 candidate operators: + operator * (T, T) -> T where: T is f32, i32, u32 or f16 + operator * (vecN, T) -> vecN where: T is f32, i32, u32 or f16 + operator * (T, vecN) -> vecN where: T is f32, i32, u32 or f16 + operator * (T, matNxM) -> matNxM where: T is f32 or f16 + operator * (matNxM, T) -> matNxM where: T is f32 or f16 + operator * (vecN, vecN) -> vecN where: T is f32, i32, u32 or f16 + operator * (matCxR, vecC) -> vecR where: T is f32 or f16 + operator * (vecR, matCxR) -> vecC where: T is f32 or f16 + operator * (matKxR, matCxK) -> matCxR where: T is f32 or f16 +)"); +} + +TEST_F(IntrinsicTableTest, MatchCompoundOp) { + auto* i32 = create(); + auto* vec3_i32 = create(i32, 3u); + auto result = table->Lookup(ast::BinaryOp::kMultiply, i32, vec3_i32, Source{{12, 34}}, + /* is_compound */ true); + EXPECT_EQ(result.result, vec3_i32); + EXPECT_EQ(result.lhs, i32); + EXPECT_EQ(result.rhs, vec3_i32); + EXPECT_EQ(Diagnostics().str(), ""); +} + +TEST_F(IntrinsicTableTest, MismatchCompoundOp) { + auto* f32 = create(); + auto* bool_ = create(); + auto result = table->Lookup(ast::BinaryOp::kMultiply, f32, bool_, Source{{12, 34}}, + /* is_compound */ true); + ASSERT_EQ(result.result, nullptr); + EXPECT_EQ(Diagnostics().str(), R"(12:34 error: no matching overload for operator *= (f32, bool) + +9 candidate operators: + operator *= (T, T) -> T where: T is f32, i32, u32 or f16 + operator *= (vecN, T) -> vecN where: T is f32, i32, u32 or f16 + operator *= (T, vecN) -> vecN where: T is f32, i32, u32 or f16 + operator *= (T, matNxM) -> matNxM where: T is f32 or f16 + operator *= (matNxM, T) -> matNxM where: T is f32 or f16 + operator *= (vecN, vecN) -> vecN where: T is f32, i32, u32 or f16 + operator *= (matCxR, vecC) -> vecR where: T is f32 or f16 + operator *= (vecR, matCxR) -> vecC where: T is f32 or f16 + operator *= (matKxR, matCxK) -> matCxR where: T is f32 or f16 +)"); +} + +TEST_F(IntrinsicTableTest, MatchTypeConstructorImplicit) { + auto* i32 = create(); + auto* vec3_i32 = create(i32, 3u); + auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{i32, i32, i32}, + Source{{12, 34}}); + ASSERT_NE(result.target, nullptr); + EXPECT_EQ(result.target->ReturnType(), vec3_i32); + EXPECT_TRUE(result.target->Is()); + ASSERT_EQ(result.target->Parameters().Length(), 3u); + EXPECT_EQ(result.target->Parameters()[0]->Type(), i32); + EXPECT_EQ(result.target->Parameters()[1]->Type(), i32); + EXPECT_EQ(result.target->Parameters()[2]->Type(), i32); + EXPECT_NE(result.const_eval_fn, nullptr); +} + +TEST_F(IntrinsicTableTest, MatchTypeConstructorExplicit) { + auto* i32 = create(); + auto* vec3_i32 = create(i32, 3u); + auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{i32, i32, i32}, + Source{{12, 34}}); + ASSERT_NE(result.target, nullptr); + EXPECT_EQ(result.target->ReturnType(), vec3_i32); + EXPECT_TRUE(result.target->Is()); + ASSERT_EQ(result.target->Parameters().Length(), 3u); + EXPECT_EQ(result.target->Parameters()[0]->Type(), i32); + EXPECT_EQ(result.target->Parameters()[1]->Type(), i32); + EXPECT_EQ(result.target->Parameters()[2]->Type(), i32); + EXPECT_NE(result.const_eval_fn, nullptr); +} + +TEST_F(IntrinsicTableTest, MismatchTypeConstructorImplicit) { + auto* i32 = create(); + auto* f32 = create(); + auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{i32, f32, i32}, + Source{{12, 34}}); + ASSERT_EQ(result.target, nullptr); + EXPECT_EQ(Diagnostics().str(), + R"(12:34 error: no matching constructor for vec3(i32, f32, i32) + +6 candidate constructors: + vec3(x: T, y: T, z: T) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(xy: vec2, z: T) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(x: T, yz: vec2) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(T) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(vec3) -> vec3 where: T is f32, f16, i32, u32 or bool + vec3() -> vec3 where: T is f32, f16, i32, u32 or bool + +5 candidate conversions: + vec3(vec3) -> vec3 where: T is f32, U is i32, f16, u32 or bool + vec3(vec3) -> vec3 where: T is f16, U is f32, i32, u32 or bool + vec3(vec3) -> vec3 where: T is i32, U is f32, f16, u32 or bool + vec3(vec3) -> vec3 where: T is u32, U is f32, f16, i32 or bool + vec3(vec3) -> vec3 where: T is bool, U is f32, f16, i32 or u32 +)"); +} + +TEST_F(IntrinsicTableTest, MismatchTypeConstructorExplicit) { + auto* i32 = create(); + auto* f32 = create(); + auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{i32, f32, i32}, + Source{{12, 34}}); + ASSERT_EQ(result.target, nullptr); + EXPECT_EQ(Diagnostics().str(), + R"(12:34 error: no matching constructor for vec3(i32, f32, i32) + +6 candidate constructors: + vec3(x: T, y: T, z: T) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(x: T, yz: vec2) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(T) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(xy: vec2, z: T) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(vec3) -> vec3 where: T is f32, f16, i32, u32 or bool + vec3() -> vec3 where: T is f32, f16, i32, u32 or bool + +5 candidate conversions: + vec3(vec3) -> vec3 where: T is f32, U is i32, f16, u32 or bool + vec3(vec3) -> vec3 where: T is f16, U is f32, i32, u32 or bool + vec3(vec3) -> vec3 where: T is i32, U is f32, f16, u32 or bool + vec3(vec3) -> vec3 where: T is u32, U is f32, f16, i32 or bool + vec3(vec3) -> vec3 where: T is bool, U is f32, f16, i32 or u32 +)"); +} + +TEST_F(IntrinsicTableTest, MatchTypeConversion) { + auto* i32 = create(); + auto* vec3_i32 = create(i32, 3u); + auto* f32 = create(); + auto* vec3_f32 = create(f32, 3u); + auto result = + table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{vec3_f32}, Source{{12, 34}}); + ASSERT_NE(result.target, nullptr); + EXPECT_EQ(result.target->ReturnType(), vec3_i32); + EXPECT_TRUE(result.target->Is()); + ASSERT_EQ(result.target->Parameters().Length(), 1u); + EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_f32); +} + +TEST_F(IntrinsicTableTest, MismatchTypeConversion) { + auto* arr = create(create(), 0u, 4u, 4u, 4u, 4u); + auto* f32 = create(); + auto result = + table->Lookup(CtorConvIntrinsic::kVec3, f32, utils::Vector{arr}, Source{{12, 34}}); + ASSERT_EQ(result.target, nullptr); + EXPECT_EQ(Diagnostics().str(), + R"(12:34 error: no matching constructor for vec3(array) + +6 candidate constructors: + vec3(vec3) -> vec3 where: T is f32, f16, i32, u32 or bool + vec3(T) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3() -> vec3 where: T is f32, f16, i32, u32 or bool + vec3(xy: vec2, z: T) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(x: T, yz: vec2) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + vec3(x: T, y: T, z: T) -> vec3 where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool + +5 candidate conversions: + vec3(vec3) -> vec3 where: T is f32, U is i32, f16, u32 or bool + vec3(vec3) -> vec3 where: T is f16, U is f32, i32, u32 or bool + vec3(vec3) -> vec3 where: T is i32, U is f32, f16, u32 or bool + vec3(vec3) -> vec3 where: T is u32, U is f32, f16, i32 or bool + vec3(vec3) -> vec3 where: T is bool, U is f32, f16, i32 or u32 +)"); +} + +TEST_F(IntrinsicTableTest, Err257Arguments) { // crbug.com/1323605 + auto* f32 = create(); + utils::Vector arg_tys; + arg_tys.Resize(257, f32); + auto result = table->Lookup(BuiltinType::kAbs, std::move(arg_tys), Source{}); + ASSERT_EQ(result.sem, nullptr); + ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); +} + +TEST_F(IntrinsicTableTest, OverloadResolution) { + // i32(abstract-int) produces candidates for both: + // ctor i32(i32) -> i32 + // conv i32(T) -> i32 + // The first should win overload resolution. + auto* ai = create(); + auto* i32 = create(); + auto result = table->Lookup(CtorConvIntrinsic::kI32, nullptr, utils::Vector{ai}, Source{}); + ASSERT_NE(result.target, nullptr); + EXPECT_EQ(result.target->ReturnType(), i32); + EXPECT_EQ(result.target->Parameters().Length(), 1u); + EXPECT_EQ(result.target->Parameters()[0]->Type(), i32); +} + +//////////////////////////////////////////////////////////////////////////////// +// AbstractBinaryTests +//////////////////////////////////////////////////////////////////////////////// +namespace AbstractBinaryTests { +struct Case { + template + static Case Create(bool match = true) { + return { + match, // + builder::DataType::Sem, // + builder::DataType::Sem, // + builder::DataType::Sem, // + builder::DataType::Sem, // + builder::DataType::Sem, // + }; + } + bool expected_match; + builder::sem_type_func_ptr expected_result; + builder::sem_type_func_ptr expected_param_lhs; + builder::sem_type_func_ptr expected_param_rhs; + builder::sem_type_func_ptr arg_lhs; + builder::sem_type_func_ptr arg_rhs; +}; + +struct IntrinsicTableAbstractBinaryTest : public ResolverTestWithParam { + std::unique_ptr table = IntrinsicTable::Create(*this); +}; + +TEST_P(IntrinsicTableAbstractBinaryTest, MatchAdd) { + auto* arg_lhs = GetParam().arg_lhs(*this); + auto* arg_rhs = GetParam().arg_rhs(*this); + auto result = table->Lookup(ast::BinaryOp::kAdd, arg_lhs, arg_rhs, Source{{12, 34}}, + /* is_compound */ false); + + bool matched = result.result != nullptr; + bool expected_match = GetParam().expected_match; + EXPECT_EQ(matched, expected_match) << Diagnostics().str(); + + auto* expected_result = GetParam().expected_result(*this); + EXPECT_TYPE(result.result, expected_result); + + auto* expected_param_lhs = GetParam().expected_param_lhs(*this); + EXPECT_TYPE(result.lhs, expected_param_lhs); + + auto* expected_param_rhs = GetParam().expected_param_rhs(*this); + EXPECT_TYPE(result.rhs, expected_param_rhs); +} + +INSTANTIATE_TEST_SUITE_P(AFloat_AInt, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P( + VecAFloat_VecAInt, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P(AFloat_f32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create() + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P(VecAFloat_Vecf32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create() + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P( + AFloat_i32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(false), +Case::Create(false) + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P( + VecAFloat_Veci32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(false), +Case::Create(false) + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P( + AFloat_u32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(false), +Case::Create(false) + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P( + VecAFloat_Vecu32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(false), +Case::Create(false) + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P(AInt_f32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create() + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P(VecAInt_Vecf32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create() + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P(AInt_i32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create() + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P(VecAInt_Veci32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create() + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P(AInt_u32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create() + )); // clang-format on + +INSTANTIATE_TEST_SUITE_P(VecAInt_Vecu32, + IntrinsicTableAbstractBinaryTest, + testing::Values( // clang-format off +// result | param lhs | param rhs | arg lhs | arg rhs +Case::Create(), +Case::Create() + )); // clang-format on + +} // namespace AbstractBinaryTests + +//////////////////////////////////////////////////////////////////////////////// +// AbstractTernaryTests +//////////////////////////////////////////////////////////////////////////////// +namespace AbstractTernaryTests { +struct Case { + template + static Case Create(bool match = true) { + return { + match, + builder::DataType::Sem, // + builder::DataType::Sem, // + builder::DataType::Sem, // + builder::DataType::Sem, // + builder::DataType::Sem, // + builder::DataType::Sem, // + builder::DataType::Sem, // + }; + } + bool expected_match; + builder::sem_type_func_ptr expected_result; + builder::sem_type_func_ptr expected_param_a; + builder::sem_type_func_ptr expected_param_b; + builder::sem_type_func_ptr expected_param_c; + builder::sem_type_func_ptr arg_a; + builder::sem_type_func_ptr arg_b; + builder::sem_type_func_ptr arg_c; +}; + +struct IntrinsicTableAbstractTernaryTest : public ResolverTestWithParam { + std::unique_ptr table = IntrinsicTable::Create(*this); +}; + +TEST_P(IntrinsicTableAbstractTernaryTest, MatchClamp) { + auto* arg_a = GetParam().arg_a(*this); + auto* arg_b = GetParam().arg_b(*this); + auto* arg_c = GetParam().arg_c(*this); + auto builtin = table->Lookup(sem::BuiltinType::kClamp, utils::Vector{arg_a, arg_b, arg_c}, + Source{{12, 34}}); + + bool matched = builtin.sem != nullptr; + bool expected_match = GetParam().expected_match; + EXPECT_EQ(matched, expected_match) << Diagnostics().str(); + + auto* result = builtin.sem ? builtin.sem->ReturnType() : nullptr; + auto* expected_result = GetParam().expected_result(*this); + EXPECT_TYPE(result, expected_result); + + auto* param_a = builtin.sem ? builtin.sem->Parameters()[0]->Type() : nullptr; + auto* expected_param_a = GetParam().expected_param_a(*this); + EXPECT_TYPE(param_a, expected_param_a); + + auto* param_b = builtin.sem ? builtin.sem->Parameters()[1]->Type() : nullptr; + auto* expected_param_b = GetParam().expected_param_b(*this); + EXPECT_TYPE(param_b, expected_param_b); + + auto* param_c = builtin.sem ? builtin.sem->Parameters()[2]->Type() : nullptr; + auto* expected_param_c = GetParam().expected_param_c(*this); + EXPECT_TYPE(param_c, expected_param_c); +} + +INSTANTIATE_TEST_SUITE_P( + AFloat_AInt, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + VecAFloat_VecAInt, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + AFloat_f32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + VecAFloat_Vecf32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create () + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + AFloat_i32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false) + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + VecAFloat_Veci32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false) + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + AFloat_u32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false) + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + VecAFloat_Vecu32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false), +Case::Create(false) + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + AInt_f32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + VecAInt_Vecf32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + AInt_i32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + VecAInt_Veci32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + AInt_u32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + VecAInt_Vecu32, + IntrinsicTableAbstractTernaryTest, + testing::Values( // clang-format off +// result | param a | param b | param c | arg a | arg b | arg c +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create(), +Case::Create() + // clang-format on + )); + +struct IntrinsicTableAbstractTernaryTest_NonConstEval : public ResolverTestWithParam { + std::unique_ptr table = IntrinsicTable::Create(*this); +}; + +TEST_P(IntrinsicTableAbstractTernaryTest_NonConstEval, MatchMix) { + auto* arg_a = GetParam().arg_a(*this); + auto* arg_b = GetParam().arg_b(*this); + auto* arg_c = GetParam().arg_c(*this); + auto builtin = + table->Lookup(sem::BuiltinType::kMix, utils::Vector{arg_a, arg_b, arg_c}, Source{{12, 34}}); + + bool matched = builtin.sem != nullptr; + bool expected_match = GetParam().expected_match; + EXPECT_EQ(matched, expected_match) << Diagnostics().str(); + + auto* result = builtin.sem ? builtin.sem->ReturnType() : nullptr; + auto* expected_result = GetParam().expected_result(*this); + EXPECT_TYPE(result, expected_result); + + auto* param_a = builtin.sem ? builtin.sem->Parameters()[0]->Type() : nullptr; + auto* expected_param_a = GetParam().expected_param_a(*this); + EXPECT_TYPE(param_a, expected_param_a); + + auto* param_b = builtin.sem ? builtin.sem->Parameters()[1]->Type() : nullptr; + auto* expected_param_b = GetParam().expected_param_b(*this); + EXPECT_TYPE(param_b, expected_param_b); + + auto* param_c = builtin.sem ? builtin.sem->Parameters()[2]->Type() : nullptr; + auto* expected_param_c = GetParam().expected_param_c(*this); + EXPECT_TYPE(param_c, expected_param_c); +} + +INSTANTIATE_TEST_SUITE_P( + AFloat_f32, + IntrinsicTableAbstractTernaryTest_NonConstEval, + testing::Values( // clang-format off + // result | param a | param b | param c | arg a | arg b | arg c + Case::Create(), + Case::Create(), + Case::Create(), + Case::Create(), + Case::Create(), + Case::Create(), + Case::Create() + // clang-format on + )); + +INSTANTIATE_TEST_SUITE_P( + VecAFloat_Vecf32, + IntrinsicTableAbstractTernaryTest_NonConstEval, + testing::Values( // clang-format off + // result | param a | param b | param c | arg a | arg b | arg c + Case::Create(), + Case::Create(), + Case::Create(), + Case::Create(), + Case::Create(), + Case::Create(), + Case::Create () + // clang-format on + )); + +} // namespace AbstractTernaryTests + } // namespace -} // namespace tint +} // namespace tint::resolver diff --git a/src/tint/resolver/is_host_shareable_test.cc b/src/tint/resolver/is_host_shareable_test.cc index a167903306..0ac335265b 100644 --- a/src/tint/resolver/is_host_shareable_test.cc +++ b/src/tint/resolver/is_host_shareable_test.cc @@ -35,6 +35,7 @@ TEST_F(ResolverIsHostShareable, NumericScalar) { EXPECT_TRUE(r()->IsHostShareable(create())); EXPECT_TRUE(r()->IsHostShareable(create())); EXPECT_TRUE(r()->IsHostShareable(create())); + EXPECT_TRUE(r()->IsHostShareable(create())); } TEST_F(ResolverIsHostShareable, NumericVector) { @@ -47,6 +48,9 @@ TEST_F(ResolverIsHostShareable, NumericVector) { EXPECT_TRUE(r()->IsHostShareable(create(create(), 2u))); EXPECT_TRUE(r()->IsHostShareable(create(create(), 3u))); EXPECT_TRUE(r()->IsHostShareable(create(create(), 4u))); + EXPECT_TRUE(r()->IsHostShareable(create(create(), 2u))); + EXPECT_TRUE(r()->IsHostShareable(create(create(), 3u))); + EXPECT_TRUE(r()->IsHostShareable(create(create(), 4u))); } TEST_F(ResolverIsHostShareable, BoolVector) { @@ -62,19 +66,32 @@ TEST_F(ResolverIsHostShareable, BoolVector) { } TEST_F(ResolverIsHostShareable, Matrix) { - auto* vec2 = create(create(), 2u); - auto* vec3 = create(create(), 3u); - auto* vec4 = create(create(), 4u); + auto* vec2_f32 = create(create(), 2u); + auto* vec3_f32 = create(create(), 3u); + auto* vec4_f32 = create(create(), 4u); + auto* vec2_f16 = create(create(), 2u); + auto* vec3_f16 = create(create(), 3u); + auto* vec4_f16 = create(create(), 4u); - EXPECT_TRUE(r()->IsHostShareable(create(vec2, 2u))); - EXPECT_TRUE(r()->IsHostShareable(create(vec2, 3u))); - EXPECT_TRUE(r()->IsHostShareable(create(vec2, 4u))); - EXPECT_TRUE(r()->IsHostShareable(create(vec3, 2u))); - EXPECT_TRUE(r()->IsHostShareable(create(vec3, 3u))); - EXPECT_TRUE(r()->IsHostShareable(create(vec3, 4u))); - EXPECT_TRUE(r()->IsHostShareable(create(vec4, 2u))); - EXPECT_TRUE(r()->IsHostShareable(create(vec4, 3u))); - EXPECT_TRUE(r()->IsHostShareable(create(vec4, 4u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec2_f32, 2u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec2_f32, 3u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec2_f32, 4u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec3_f32, 2u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec3_f32, 3u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec3_f32, 4u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec4_f32, 2u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec4_f32, 3u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec4_f32, 4u))); + + EXPECT_TRUE(r()->IsHostShareable(create(vec2_f16, 2u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec2_f16, 3u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec2_f16, 4u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec3_f16, 2u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec3_f16, 3u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec3_f16, 4u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec4_f16, 2u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec4_f16, 3u))); + EXPECT_TRUE(r()->IsHostShareable(create(vec4_f16, 4u))); } TEST_F(ResolverIsHostShareable, Pointer) { diff --git a/src/tint/resolver/is_storeable_test.cc b/src/tint/resolver/is_storeable_test.cc index 2d37d8b6e3..0423f72510 100644 --- a/src/tint/resolver/is_storeable_test.cc +++ b/src/tint/resolver/is_storeable_test.cc @@ -32,6 +32,7 @@ TEST_F(ResolverIsStorableTest, Scalar) { EXPECT_TRUE(r()->IsStorable(create())); EXPECT_TRUE(r()->IsStorable(create())); EXPECT_TRUE(r()->IsStorable(create())); + EXPECT_TRUE(r()->IsStorable(create())); } TEST_F(ResolverIsStorableTest, Vector) { @@ -44,21 +45,36 @@ TEST_F(ResolverIsStorableTest, Vector) { EXPECT_TRUE(r()->IsStorable(create(create(), 2u))); EXPECT_TRUE(r()->IsStorable(create(create(), 3u))); EXPECT_TRUE(r()->IsStorable(create(create(), 4u))); + EXPECT_TRUE(r()->IsStorable(create(create(), 2u))); + EXPECT_TRUE(r()->IsStorable(create(create(), 3u))); + EXPECT_TRUE(r()->IsStorable(create(create(), 4u))); } TEST_F(ResolverIsStorableTest, Matrix) { - auto* vec2 = create(create(), 2u); - auto* vec3 = create(create(), 3u); - auto* vec4 = create(create(), 4u); - EXPECT_TRUE(r()->IsStorable(create(vec2, 2u))); - EXPECT_TRUE(r()->IsStorable(create(vec2, 3u))); - EXPECT_TRUE(r()->IsStorable(create(vec2, 4u))); - EXPECT_TRUE(r()->IsStorable(create(vec3, 2u))); - EXPECT_TRUE(r()->IsStorable(create(vec3, 3u))); - EXPECT_TRUE(r()->IsStorable(create(vec3, 4u))); - EXPECT_TRUE(r()->IsStorable(create(vec4, 2u))); - EXPECT_TRUE(r()->IsStorable(create(vec4, 3u))); - EXPECT_TRUE(r()->IsStorable(create(vec4, 4u))); + auto* vec2_f32 = create(create(), 2u); + auto* vec3_f32 = create(create(), 3u); + auto* vec4_f32 = create(create(), 4u); + auto* vec2_f16 = create(create(), 2u); + auto* vec3_f16 = create(create(), 3u); + auto* vec4_f16 = create(create(), 4u); + EXPECT_TRUE(r()->IsStorable(create(vec2_f32, 2u))); + EXPECT_TRUE(r()->IsStorable(create(vec2_f32, 3u))); + EXPECT_TRUE(r()->IsStorable(create(vec2_f32, 4u))); + EXPECT_TRUE(r()->IsStorable(create(vec3_f32, 2u))); + EXPECT_TRUE(r()->IsStorable(create(vec3_f32, 3u))); + EXPECT_TRUE(r()->IsStorable(create(vec3_f32, 4u))); + EXPECT_TRUE(r()->IsStorable(create(vec4_f32, 2u))); + EXPECT_TRUE(r()->IsStorable(create(vec4_f32, 3u))); + EXPECT_TRUE(r()->IsStorable(create(vec4_f32, 4u))); + EXPECT_TRUE(r()->IsStorable(create(vec2_f16, 2u))); + EXPECT_TRUE(r()->IsStorable(create(vec2_f16, 3u))); + EXPECT_TRUE(r()->IsStorable(create(vec2_f16, 4u))); + EXPECT_TRUE(r()->IsStorable(create(vec3_f16, 2u))); + EXPECT_TRUE(r()->IsStorable(create(vec3_f16, 3u))); + EXPECT_TRUE(r()->IsStorable(create(vec3_f16, 4u))); + EXPECT_TRUE(r()->IsStorable(create(vec4_f16, 2u))); + EXPECT_TRUE(r()->IsStorable(create(vec4_f16, 3u))); + EXPECT_TRUE(r()->IsStorable(create(vec4_f16, 4u))); } TEST_F(ResolverIsStorableTest, Pointer) { @@ -83,7 +99,7 @@ TEST_F(ResolverIsStorableTest, ArrayUnsizedOfStorable) { } TEST_F(ResolverIsStorableTest, Struct_AllMembersStorable) { - Structure("S", { + Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); @@ -92,7 +108,7 @@ TEST_F(ResolverIsStorableTest, Struct_AllMembersStorable) { } TEST_F(ResolverIsStorableTest, Struct_SomeMembersNonStorable) { - Structure("S", { + Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.pointer(ast::StorageClass::kPrivate)), }); @@ -104,11 +120,11 @@ TEST_F(ResolverIsStorableTest, Struct_SomeMembersNonStorable) { } TEST_F(ResolverIsStorableTest, Struct_NestedStorable) { - auto* storable = Structure("Storable", { + auto* storable = Structure("Storable", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Structure("S", { + Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.Of(storable)), }); @@ -118,11 +134,11 @@ TEST_F(ResolverIsStorableTest, Struct_NestedStorable) { TEST_F(ResolverIsStorableTest, Struct_NestedNonStorable) { auto* non_storable = - Structure("nonstorable", { + Structure("nonstorable", utils::Vector{ Member("a", ty.i32()), Member("b", ty.pointer(ast::StorageClass::kPrivate)), }); - Structure("S", { + Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.Of(non_storable)), }); diff --git a/src/tint/resolver/materialize_test.cc b/src/tint/resolver/materialize_test.cc new file mode 100644 index 0000000000..01ff0d5afa --- /dev/null +++ b/src/tint/resolver/materialize_test.cc @@ -0,0 +1,1188 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/sem/materialize.h" + +#include "src/tint/resolver/resolver.h" +#include "src/tint/resolver/resolver_test_helper.h" +#include "src/tint/sem/test_helper.h" + +#include "gmock/gmock.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::resolver { +namespace { + +using AFloatV = builder::vec<3, AFloat>; +using AFloatM = builder::mat<3, 2, AFloat>; +using AFloatA = builder::array<3, AFloat>; +using AIntV = builder::vec<3, AInt>; +using AIntA = builder::array<3, AInt>; +using f32V = builder::vec<3, f32>; +using f16V = builder::vec<3, f16>; +using i32V = builder::vec<3, i32>; +using u32V = builder::vec<3, u32>; +using f32M = builder::mat<3, 2, f32>; +using f16M = builder::mat<3, 2, f16>; +using f32A = builder::array<3, f32>; +using f16A = builder::array<3, f16>; +using i32A = builder::array<3, i32>; +using u32A = builder::array<3, u32>; + +constexpr double kTooBigF32 = static_cast(3.5e+38); +constexpr double kTooBigF16 = static_cast(6.6e+4); +constexpr double kPiF64 = 3.141592653589793; +constexpr double kPiF32 = 3.1415927410125732; // kPiF64 quantized to f32 +constexpr double kPiF16 = 3.140625; // kPiF64 quantized to f16 + +constexpr double kSubnormalF32 = 0x1.0p-128; +constexpr double kSubnormalF16 = 0x1.0p-16; + +enum class Expectation { + kMaterialize, + kNoMaterialize, + kInvalidConversion, + kValueCannotBeRepresented, +}; + +static std::ostream& operator<<(std::ostream& o, Expectation m) { + switch (m) { + case Expectation::kMaterialize: + return o << "materialize"; + case Expectation::kNoMaterialize: + return o << "no-materialize"; + case Expectation::kInvalidConversion: + return o << "invalid-conversion"; + case Expectation::kValueCannotBeRepresented: + return o << "value cannot be represented"; + } + return o << ""; +} + +template +class MaterializeTest : public resolver::ResolverTestWithParam { + protected: + using ProgramBuilder::FriendlyName; + + void CheckTypesAndValues(const sem::Expression* expr, + const tint::sem::Type* expected_sem_ty, + const std::variant& expected_value) { + std::visit([&](auto v) { CheckTypesAndValuesImpl(expr, expected_sem_ty, v); }, + expected_value); + } + + private: + template + void CheckTypesAndValuesImpl(const sem::Expression* expr, + const tint::sem::Type* expected_sem_ty, + T expected_value) { + EXPECT_TYPE(expr->Type(), expected_sem_ty); + + auto* value = expr->ConstantValue(); + ASSERT_NE(value, nullptr); + EXPECT_TYPE(expr->Type(), value->Type()); + + tint::Switch( + expected_sem_ty, // + [&](const sem::Vector* v) { + for (uint32_t i = 0; i < v->Width(); i++) { + auto* el = value->Index(i); + ASSERT_NE(el, nullptr); + EXPECT_TYPE(el->Type(), v->type()); + EXPECT_EQ(std::get(el->Value()), expected_value); + } + }, + [&](const sem::Matrix* m) { + for (uint32_t c = 0; c < m->columns(); c++) { + auto* column = value->Index(c); + ASSERT_NE(column, nullptr); + EXPECT_TYPE(column->Type(), m->ColumnType()); + for (uint32_t r = 0; r < m->rows(); r++) { + auto* el = column->Index(r); + ASSERT_NE(el, nullptr); + EXPECT_TYPE(el->Type(), m->type()); + EXPECT_EQ(std::get(el->Value()), expected_value); + } + } + }, + [&](const sem::Array* a) { + for (uint32_t i = 0; i < a->Count(); i++) { + auto* el = value->Index(i); + ASSERT_NE(el, nullptr); + EXPECT_TYPE(el->Type(), a->ElemType()); + EXPECT_EQ(std::get(el->Value()), expected_value); + } + }, + [&](Default) { EXPECT_EQ(std::get(value->Value()), expected_value); }); + } +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// MaterializeAbstractNumericToConcreteType +// Tests that an abstract-numeric will materialize to the expected concrete type +//////////////////////////////////////////////////////////////////////////////////////////////////// +namespace materialize_abstract_numeric_to_concrete_type { +// How should the materialization occur? +enum class Method { + // var a : target_type = abstract_expr; + kVar, + + // let a : target_type = abstract_expr; + kLet, + + // var a : target_type; + // a = abstract_expr; + kAssign, + + // _ = abstract_expr; + kPhonyAssign, + + // fn F(v : target_type) {} + // fn x() { + // F(abstract_expr); + // } + kFnArg, + + // min(target_expr, abstract_expr); + kBuiltinArg, + + // fn F() : target_type { + // return abstract_expr; + // } + kReturn, + + // array(abstract_expr); + kArray, + + // struct S { + // v : target_type + // }; + // fn x() { + // _ = S(abstract_expr) + // } + kStruct, + + // target_expr + abstract_expr + kBinaryOp, + + // switch (abstract_expr) { + // case target_expr: {} + // default: {} + // } + kSwitchCond, + + // switch (target_expr) { + // case abstract_expr: {} + // default: {} + // } + kSwitchCase, + + // switch (abstract_expr) { + // case 123: {} + // case target_expr: {} + // default: {} + // } + kSwitchCondWithAbstractCase, + + // switch (target_expr) { + // case 123: {} + // case abstract_expr: {} + // default: {} + // } + kSwitchCaseWithAbstractCase, + + // @workgroup_size(target_expr, abstract_expr, 123) + // @compute + // fn f() {} + kWorkgroupSize, + + // abstract_expr[runtime-index] + kRuntimeIndex, +}; + +static std::ostream& operator<<(std::ostream& o, Method m) { + switch (m) { + case Method::kVar: + return o << "var"; + case Method::kLet: + return o << "let"; + case Method::kAssign: + return o << "assign"; + case Method::kPhonyAssign: + return o << "phony-assign"; + case Method::kFnArg: + return o << "fn-arg"; + case Method::kBuiltinArg: + return o << "builtin-arg"; + case Method::kReturn: + return o << "return"; + case Method::kArray: + return o << "array"; + case Method::kStruct: + return o << "struct"; + case Method::kBinaryOp: + return o << "binary-op"; + case Method::kSwitchCond: + return o << "switch-cond"; + case Method::kSwitchCase: + return o << "switch-case"; + case Method::kSwitchCondWithAbstractCase: + return o << "switch-cond-with-abstract"; + case Method::kSwitchCaseWithAbstractCase: + return o << "switch-case-with-abstract"; + case Method::kWorkgroupSize: + return o << "workgroup-size"; + case Method::kRuntimeIndex: + return o << "runtime-index"; + } + return o << ""; +} + +struct Data { + std::string target_type_name; + std::string target_element_type_name; + builder::ast_type_func_ptr target_ast_ty; + builder::sem_type_func_ptr target_sem_ty; + builder::ast_expr_func_ptr target_expr; + std::string abstract_type_name; + builder::ast_expr_func_ptr abstract_expr; + std::variant materialized_value; + double literal_value; +}; + +template +Data Types(MATERIALIZED_TYPE materialized_value, double literal_value) { + using TargetDataType = builder::DataType; + using AbstractDataType = builder::DataType; + using TargetElementDataType = builder::DataType; + return { + TargetDataType::Name(), // target_type_name + TargetElementDataType::Name(), // target_element_type_name + TargetDataType::AST, // target_ast_ty + TargetDataType::Sem, // target_sem_ty + TargetDataType::Expr, // target_expr + AbstractDataType::Name(), // abstract_type_name + AbstractDataType::Expr, // abstract_expr + materialized_value, + literal_value, + }; +} + +template +Data Types() { + using TargetDataType = builder::DataType; + using AbstractDataType = builder::DataType; + using TargetElementDataType = builder::DataType; + return { + TargetDataType::Name(), // target_type_name + TargetElementDataType::Name(), // target_element_type_name + TargetDataType::AST, // target_ast_ty + TargetDataType::Sem, // target_sem_ty + TargetDataType::Expr, // target_expr + AbstractDataType::Name(), // abstract_type_name + AbstractDataType::Expr, // abstract_expr + 0_a, + 0.0, + }; +} + +static std::ostream& operator<<(std::ostream& o, const Data& c) { + auto print_value = [&](auto&& v) { o << v; }; + o << "[" << c.target_type_name << " <- " << c.abstract_type_name << "] ["; + std::visit(print_value, c.materialized_value); + o << " <- " << c.literal_value << "]"; + return o; +} + +using MaterializeAbstractNumericToConcreteType = + MaterializeTest>; + +TEST_P(MaterializeAbstractNumericToConcreteType, Test) { + Enable(ast::Extension::kF16); + + const auto& param = GetParam(); + const auto& expectation = std::get<0>(param); + const auto& method = std::get<1>(param); + const auto& data = std::get<2>(param); + + auto target_ty = [&] { return data.target_ast_ty(*this); }; + auto target_expr = [&] { return data.target_expr(*this, 42); }; + auto* abstract_expr = data.abstract_expr(*this, data.literal_value); + switch (method) { + case Method::kVar: + WrapInFunction(Decl(Var("a", target_ty(), abstract_expr))); + break; + case Method::kLet: + WrapInFunction(Decl(Let("a", target_ty(), abstract_expr))); + break; + case Method::kAssign: + WrapInFunction(Decl(Var("a", target_ty())), Assign("a", abstract_expr)); + break; + case Method::kPhonyAssign: + WrapInFunction(Assign(Phony(), abstract_expr)); + break; + case Method::kFnArg: + Func("F", utils::Vector{Param("P", target_ty())}, ty.void_(), utils::Empty); + WrapInFunction(CallStmt(Call("F", abstract_expr))); + break; + case Method::kBuiltinArg: + WrapInFunction(CallStmt(Call("min", target_expr(), abstract_expr))); + break; + case Method::kReturn: + Func("F", utils::Empty, target_ty(), utils::Vector{Return(abstract_expr)}); + break; + case Method::kArray: + WrapInFunction(Construct(ty.array(target_ty(), 1_i), abstract_expr)); + break; + case Method::kStruct: + Structure("S", utils::Vector{Member("v", target_ty())}); + WrapInFunction(Construct(ty.type_name("S"), abstract_expr)); + break; + case Method::kBinaryOp: + WrapInFunction(Add(target_expr(), abstract_expr)); + break; + case Method::kSwitchCond: + WrapInFunction(Switch(abstract_expr, // + Case(target_expr()->As()), // + DefaultCase())); + break; + case Method::kSwitchCase: + WrapInFunction(Switch(target_expr(), // + Case(abstract_expr->As()), // + DefaultCase())); + break; + case Method::kSwitchCondWithAbstractCase: + WrapInFunction(Switch(abstract_expr, // + Case(Expr(123_a)), // + Case(target_expr()->As()), // + DefaultCase())); + break; + case Method::kSwitchCaseWithAbstractCase: + WrapInFunction(Switch(target_expr(), // + Case(Expr(123_a)), // + Case(abstract_expr->As()), // + DefaultCase())); + break; + case Method::kWorkgroupSize: + Func("f", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{WorkgroupSize(target_expr(), abstract_expr, Expr(123_a)), + Stage(ast::PipelineStage::kCompute)}); + break; + case Method::kRuntimeIndex: + auto* runtime_index = Var("runtime_index", Expr(1_i)); + WrapInFunction(runtime_index, IndexAccessor(abstract_expr, runtime_index)); + break; + } + + switch (expectation) { + case Expectation::kMaterialize: { + ASSERT_TRUE(r()->Resolve()) << r()->error(); + auto* materialize = Sem().Get(abstract_expr); + ASSERT_NE(materialize, nullptr); + CheckTypesAndValues(materialize, data.target_sem_ty(*this), data.materialized_value); + break; + } + case Expectation::kNoMaterialize: { + ASSERT_TRUE(r()->Resolve()) << r()->error(); + auto* sem = Sem().Get(abstract_expr); + ASSERT_NE(sem, nullptr); + EXPECT_FALSE(sem->Is()); + CheckTypesAndValues(sem, data.target_sem_ty(*this), data.materialized_value); + break; + } + case Expectation::kInvalidConversion: { + ASSERT_FALSE(r()->Resolve()); + std::string expect; + switch (method) { + case Method::kBuiltinArg: + expect = "error: no matching call to min(" + data.target_type_name + ", " + + data.abstract_type_name + ")"; + break; + case Method::kBinaryOp: + expect = "error: no matching overload for operator + (" + + data.target_type_name + ", " + data.abstract_type_name + ")"; + break; + default: + expect = "error: cannot convert value of type '" + data.abstract_type_name + + "' to type '" + data.target_type_name + "'"; + break; + } + EXPECT_THAT(r()->error(), testing::StartsWith(expect)); + break; + } + case Expectation::kValueCannotBeRepresented: + ASSERT_FALSE(r()->Resolve()); + EXPECT_THAT(r()->error(), testing::HasSubstr("cannot be represented as '" + + data.target_element_type_name + "'")); + break; + } +} + +/// Methods that support scalar materialization +constexpr Method kScalarMethods[] = { + Method::kLet, Method::kVar, Method::kAssign, Method::kFnArg, Method::kBuiltinArg, + Method::kReturn, Method::kArray, Method::kStruct, Method::kBinaryOp, +}; + +/// Methods that support vector materialization +constexpr Method kVectorMethods[] = { + Method::kLet, Method::kVar, Method::kAssign, Method::kFnArg, Method::kBuiltinArg, + Method::kReturn, Method::kArray, Method::kStruct, Method::kBinaryOp, +}; + +/// Methods that support matrix materialization +constexpr Method kMatrixMethods[] = { + Method::kLet, Method::kVar, Method::kAssign, Method::kFnArg, + Method::kReturn, Method::kArray, Method::kStruct, Method::kBinaryOp, +}; + +/// Methods that support array materialization +constexpr Method kArrayMethods[] = { + Method::kLet, Method::kVar, Method::kAssign, Method::kFnArg, + Method::kReturn, Method::kArray, Method::kStruct, +}; + +/// Methods that support materialization for switch cases +constexpr Method kSwitchMethods[] = { + Method::kSwitchCond, + Method::kSwitchCase, + Method::kSwitchCondWithAbstractCase, + Method::kSwitchCaseWithAbstractCase, +}; + +/// Methods that do not materialize +constexpr Method kNoMaterializeMethods[] = { + Method::kPhonyAssign, // + Method::kBinaryOp, + // TODO(crbug.com/tint/1504): Enable once "min" supports const evaluation + // Method::kBuiltinArg, +}; +INSTANTIATE_TEST_SUITE_P( + MaterializeScalar, + MaterializeAbstractNumericToConcreteType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kScalarMethods), + testing::ValuesIn(std::vector{ + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(-1_a, -1.0), // + Types(AInt(i32::Highest()), i32::Highest()), // + Types(AInt(i32::Lowest()), i32::Lowest()), // + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(AInt(u32::Highest()), u32::Highest()), // + Types(AInt(u32::Lowest()), u32::Lowest()), // + Types(0.0_a, 0.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(AFloat(f16::Highest()), static_cast(f16::Highest())), // + Types(AFloat(f16::Lowest()), static_cast(f16::Lowest())), // + Types(AFloat(kPiF16), kPiF64), // + Types(AFloat(kSubnormalF16), kSubnormalF16), // + Types(AFloat(-kSubnormalF16), -kSubnormalF16), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeVector, + MaterializeAbstractNumericToConcreteType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kVectorMethods), + testing::ValuesIn(std::vector{ + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(-1_a, -1.0), // + Types(AInt(i32::Highest()), i32::Highest()), // + Types(AInt(i32::Lowest()), i32::Lowest()), // + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(AInt(u32::Highest()), u32::Highest()), // + Types(AInt(u32::Lowest()), u32::Lowest()), // + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f16::Highest()), static_cast(f16::Highest())), // + Types(AFloat(f16::Lowest()), static_cast(f16::Lowest())), // + Types(AFloat(kPiF16), kPiF64), // + Types(AFloat(kSubnormalF16), kSubnormalF16), // + Types(AFloat(-kSubnormalF16), -kSubnormalF16), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeVectorRuntimeIndex, + MaterializeAbstractNumericToConcreteType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::Values(Method::kRuntimeIndex), + testing::ValuesIn(std::vector{ + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(-1_a, -1.0), // + Types(AInt(i32::Highest()), i32::Highest()), // + Types(AInt(i32::Lowest()), i32::Lowest()), // + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeMatrix, + MaterializeAbstractNumericToConcreteType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kMatrixMethods), + testing::ValuesIn(std::vector{ + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f16::Highest()), static_cast(f16::Highest())), // + Types(AFloat(f16::Lowest()), static_cast(f16::Lowest())), // + Types(AFloat(kPiF16), kPiF64), // + Types(AFloat(kSubnormalF16), kSubnormalF16), // + Types(AFloat(-kSubnormalF16), -kSubnormalF16), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeMatrixRuntimeIndex, + MaterializeAbstractNumericToConcreteType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::Values(Method::kRuntimeIndex), + testing::ValuesIn(std::vector{ + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeSwitch, + MaterializeAbstractNumericToConcreteType, + testing::Combine(testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kSwitchMethods), + testing::ValuesIn(std::vector{ + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(-1_a, -1.0), // + Types(AInt(i32::Highest()), i32::Highest()), // + Types(AInt(i32::Lowest()), i32::Lowest()), // + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(AInt(u32::Highest()), u32::Highest()), // + Types(AInt(u32::Lowest()), u32::Lowest()), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeArray, + MaterializeAbstractNumericToConcreteType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kArrayMethods), + testing::ValuesIn(std::vector{ + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(-1_a, -1.0), // + Types(AInt(i32::Highest()), i32::Highest()), // + Types(AInt(i32::Lowest()), i32::Lowest()), // + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(AInt(u32::Highest()), u32::Highest()), // + Types(AInt(u32::Lowest()), u32::Lowest()), // + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f16::Highest()), static_cast(f16::Highest())), // + Types(AFloat(f16::Lowest()), static_cast(f16::Lowest())), // + Types(AFloat(kPiF16), kPiF64), // + Types(AFloat(kSubnormalF16), kSubnormalF16), // + Types(AFloat(-kSubnormalF16), -kSubnormalF16), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeArrayRuntimeIndex, + MaterializeAbstractNumericToConcreteType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::Values(Method::kRuntimeIndex), + testing::ValuesIn(std::vector{ + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + }))); + +INSTANTIATE_TEST_SUITE_P(MaterializeWorkgroupSize, + MaterializeAbstractNumericToConcreteType, + testing::Combine(testing::Values(Expectation::kMaterialize), + testing::Values(Method::kWorkgroupSize), + testing::ValuesIn(std::vector{ + Types(1_a, 1.0), // + Types(10_a, 10.0), // + Types(65535_a, 65535.0), // + Types(1_a, 1.0), // + Types(10_a, 10.0), // + Types(65535_a, 65535.0), // + }))); + +INSTANTIATE_TEST_SUITE_P(NoMaterialize, + MaterializeAbstractNumericToConcreteType, + testing::Combine(testing::Values(Expectation::kNoMaterialize), + testing::ValuesIn(kNoMaterializeMethods), + testing::ValuesIn(std::vector{ + Types(1_a, 1_a), // + Types(1_a, 1_a), // + Types(1.0_a, 1.0_a), // + Types(1.0_a, 1.0_a), // + Types(1.0_a, 1.0_a), // + }))); + +INSTANTIATE_TEST_SUITE_P(InvalidConversion, + MaterializeAbstractNumericToConcreteType, + testing::Combine(testing::Values(Expectation::kInvalidConversion), + testing::ValuesIn(kScalarMethods), + testing::ValuesIn(std::vector{ + Types(), // + Types(), // + Types(), // + Types(), // + Types(), // + Types(), // + Types(), // + Types(), // + }))); + +INSTANTIATE_TEST_SUITE_P( + ScalarValueCannotBeRepresented, + MaterializeAbstractNumericToConcreteType, + testing::Combine(testing::Values(Expectation::kValueCannotBeRepresented), + testing::ValuesIn(kScalarMethods), + testing::ValuesIn(std::vector{ + Types(0_a, static_cast(i32::kHighestValue) + 1), // + Types(0_a, static_cast(i32::kLowestValue) - 1), // + Types(0_a, static_cast(u32::kHighestValue) + 1), // + Types(0_a, static_cast(u32::kLowestValue) - 1), // + Types(0.0_a, kTooBigF32), // + Types(0.0_a, -kTooBigF32), // + Types(0.0_a, kTooBigF16), // + Types(0.0_a, -kTooBigF16), // + }))); + +INSTANTIATE_TEST_SUITE_P( + VectorValueCannotBeRepresented, + MaterializeAbstractNumericToConcreteType, + testing::Combine(testing::Values(Expectation::kValueCannotBeRepresented), + testing::ValuesIn(kVectorMethods), + testing::ValuesIn(std::vector{ + Types(0_a, static_cast(i32::kHighestValue) + 1), // + Types(0_a, static_cast(i32::kLowestValue) - 1), // + Types(0_a, static_cast(u32::kHighestValue) + 1), // + Types(0_a, static_cast(u32::kLowestValue) - 1), // + Types(0.0_a, kTooBigF32), // + Types(0.0_a, -kTooBigF32), // + Types(0.0_a, kTooBigF16), // + Types(0.0_a, -kTooBigF16), // + }))); + +INSTANTIATE_TEST_SUITE_P(MatrixValueCannotBeRepresented, + MaterializeAbstractNumericToConcreteType, + testing::Combine(testing::Values(Expectation::kValueCannotBeRepresented), + testing::ValuesIn(kMatrixMethods), + testing::ValuesIn(std::vector{ + Types(0.0_a, kTooBigF32), // + Types(0.0_a, -kTooBigF32), // + Types(0.0_a, kTooBigF16), // + Types(0.0_a, -kTooBigF16), // + }))); + +} // namespace materialize_abstract_numeric_to_concrete_type + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Tests that in the absence of a 'target type' an abstract-int will materialize to i32, and an +// abstract-float will materialize to f32. +//////////////////////////////////////////////////////////////////////////////////////////////////// +namespace materialize_abstract_numeric_to_default_type { + +// How should the materialization occur? +enum class Method { + // var a = abstract_expr; + kVar, + + // let a = abstract_expr; + kLet, + + // min(abstract_expr, abstract_expr) + kBuiltinArg, + + // bitcast(abstract_expr) + kBitcastF32Arg, + + // bitcast>(abstract_expr) + kBitcastVec3F32Arg, + + // array() + kArrayLength, + + // switch (abstract_expr) { + // case abstract_expr: {} + // default: {} + // } + kSwitch, + + // @workgroup_size(abstract_expr) + // @compute + // fn f() {} + kWorkgroupSize, + + // arr[abstract_expr] + kIndex, + + // abstract_expr[runtime-index] + kRuntimeIndex, +}; + +static std::ostream& operator<<(std::ostream& o, Method m) { + switch (m) { + case Method::kVar: + return o << "var"; + case Method::kLet: + return o << "let"; + case Method::kBuiltinArg: + return o << "builtin-arg"; + case Method::kBitcastF32Arg: + return o << "bitcast-f32-arg"; + case Method::kBitcastVec3F32Arg: + return o << "bitcast-vec3-f32-arg"; + case Method::kArrayLength: + return o << "array-length"; + case Method::kSwitch: + return o << "switch"; + case Method::kWorkgroupSize: + return o << "workgroup-size"; + case Method::kIndex: + return o << "index"; + case Method::kRuntimeIndex: + return o << "runtime-index"; + } + return o << ""; +} + +struct Data { + std::string expected_type_name; + std::string expected_element_type_name; + builder::sem_type_func_ptr expected_sem_ty; + std::string abstract_type_name; + builder::ast_expr_func_ptr abstract_expr; + std::variant materialized_value; + double literal_value; +}; + +template +Data Types(MATERIALIZED_TYPE materialized_value, double literal_value) { + using ExpectedDataType = builder::DataType; + using AbstractDataType = builder::DataType; + using TargetElementDataType = builder::DataType; + return { + ExpectedDataType::Name(), // expected_type_name + TargetElementDataType::Name(), // expected_element_type_name + ExpectedDataType::Sem, // expected_sem_ty + AbstractDataType::Name(), // abstract_type_name + AbstractDataType::Expr, // abstract_expr + materialized_value, + literal_value, + }; +} + +static std::ostream& operator<<(std::ostream& o, const Data& c) { + auto print_value = [&](auto&& v) { o << v; }; + o << "[" << c.expected_type_name << " <- " << c.abstract_type_name << "] ["; + std::visit(print_value, c.materialized_value); + o << " <- " << c.literal_value << "]"; + return o; +} + +using MaterializeAbstractNumericToDefaultType = + MaterializeTest>; + +TEST_P(MaterializeAbstractNumericToDefaultType, Test) { + const auto& param = GetParam(); + const auto& expectation = std::get<0>(param); + const auto& method = std::get<1>(param); + const auto& data = std::get<2>(param); + + utils::Vector abstract_exprs; + auto abstract_expr = [&] { + auto* expr = data.abstract_expr(*this, data.literal_value); + abstract_exprs.Push(expr); + return expr; + }; + switch (method) { + case Method::kVar: + WrapInFunction(Decl(Var("a", abstract_expr()))); + break; + case Method::kLet: + WrapInFunction(Decl(Let("a", abstract_expr()))); + break; + case Method::kBuiltinArg: + WrapInFunction(CallStmt(Call("min", abstract_expr(), abstract_expr()))); + break; + case Method::kBitcastF32Arg: + WrapInFunction(Bitcast(abstract_expr())); + break; + case Method::kBitcastVec3F32Arg: + WrapInFunction(Bitcast(ty.vec3(), abstract_expr())); + break; + case Method::kArrayLength: + WrapInFunction(Construct(ty.array(ty.i32(), abstract_expr()))); + break; + case Method::kSwitch: + WrapInFunction(Switch(abstract_expr(), + Case(abstract_expr()->As()), + DefaultCase())); + break; + case Method::kWorkgroupSize: + Func( + "f", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{WorkgroupSize(abstract_expr()), Stage(ast::PipelineStage::kCompute)}); + break; + case Method::kIndex: + GlobalVar("arr", ty.array(), ast::StorageClass::kPrivate); + WrapInFunction(IndexAccessor("arr", abstract_expr())); + break; + case Method::kRuntimeIndex: + auto* runtime_index = Var("runtime_index", Expr(1_i)); + WrapInFunction(runtime_index, IndexAccessor(abstract_expr(), runtime_index)); + break; + } + + switch (expectation) { + case Expectation::kMaterialize: { + ASSERT_TRUE(r()->Resolve()) << r()->error(); + for (auto* expr : abstract_exprs) { + auto* materialize = Sem().Get(expr); + ASSERT_NE(materialize, nullptr); + CheckTypesAndValues(materialize, data.expected_sem_ty(*this), + data.materialized_value); + } + break; + } + case Expectation::kInvalidConversion: { + ASSERT_FALSE(r()->Resolve()); + std::string expect; + switch (method) { + case Method::kBuiltinArg: + expect = "error: no matching call to min(" + data.abstract_type_name + ", " + + data.abstract_type_name + ")"; + break; + default: + expect = "error: cannot convert value of type '" + data.abstract_type_name + + "' to type '" + data.expected_type_name + "'"; + break; + } + EXPECT_THAT(r()->error(), testing::StartsWith(expect)); + break; + } + case Expectation::kValueCannotBeRepresented: + ASSERT_FALSE(r()->Resolve()); + EXPECT_THAT(r()->error(), testing::HasSubstr("cannot be represented as '" + + data.expected_element_type_name + "'")); + break; + default: + FAIL() << "unhandled expectation: " << expectation; + } +} + +/// Methods that support scalar materialization +constexpr Method kScalarMethods[] = { + Method::kLet, + Method::kVar, + Method::kBuiltinArg, + Method::kBitcastF32Arg, +}; + +/// Methods that support abstract-integer materialization +/// Note: Doesn't contain kWorkgroupSize or kArrayLength as they have tighter constraints on the +/// range of allowed integer values. +constexpr Method kAIntMethods[] = { + Method::kSwitch, + Method::kIndex, +}; + +/// Methods that support vector materialization +constexpr Method kVectorMethods[] = { + Method::kLet, Method::kVar, Method::kBuiltinArg, Method::kBitcastVec3F32Arg, + Method::kRuntimeIndex, +}; + +/// Methods that support matrix materialization +constexpr Method kMatrixMethods[] = { + Method::kLet, + Method::kVar, +}; + +/// Methods that support array materialization +constexpr Method kArrayMethods[] = { + Method::kLet, + Method::kVar, +}; + +INSTANTIATE_TEST_SUITE_P( + MaterializeScalar, + MaterializeAbstractNumericToDefaultType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kScalarMethods), + testing::ValuesIn(std::vector{ + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(-1_a, -1.0), // + Types(AInt(i32::Highest()), i32::Highest()), // + Types(AInt(i32::Lowest()), i32::Lowest()), // + Types(0.0_a, 0.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeVector, + MaterializeAbstractNumericToDefaultType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kVectorMethods), + testing::ValuesIn(std::vector{ + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(-1_a, -1.0), // + Types(AInt(i32::Highest()), i32::Highest()), // + Types(AInt(i32::Lowest()), i32::Lowest()), // + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeMatrix, + MaterializeAbstractNumericToDefaultType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kMatrixMethods), + testing::ValuesIn(std::vector{ + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeAInt, + MaterializeAbstractNumericToDefaultType, + testing::Combine(testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kAIntMethods), + testing::ValuesIn(std::vector{ + Types(0_a, 0.0), // + Types(10_a, 10.0), // + Types(AInt(i32::Highest()), i32::Highest()), // + Types(AInt(i32::Lowest()), i32::Lowest()), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeArray, + MaterializeAbstractNumericToDefaultType, + testing::Combine( + testing::Values(Expectation::kMaterialize), + testing::ValuesIn(kArrayMethods), + testing::ValuesIn(std::vector{ + Types(0_a, 0.0), // + Types(1_a, 1.0), // + Types(-1_a, -1.0), // + Types(AInt(i32::Highest()), i32::Highest()), // + Types(AInt(i32::Lowest()), i32::Lowest()), // + Types(0.0_a, 0.0), // + Types(1.0_a, 1.0), // + Types(-1.0_a, -1.0), // + Types(AFloat(f32::Highest()), static_cast(f32::Highest())), // + Types(AFloat(f32::Lowest()), static_cast(f32::Lowest())), // + Types(AFloat(kPiF32), kPiF64), // + Types(AFloat(kSubnormalF32), kSubnormalF32), // + Types(AFloat(-kSubnormalF32), -kSubnormalF32), // + }))); + +INSTANTIATE_TEST_SUITE_P( + MaterializeArrayLength, + MaterializeAbstractNumericToDefaultType, + testing::Combine(testing::Values(Expectation::kMaterialize), + testing::Values(Method::kArrayLength), + testing::ValuesIn(std::vector{ + Types(1_a, 1.0), // + Types(10_a, 10.0), // + Types(1000_a, 1000.0), // + // Note: i32::Highest() cannot be used due to max-byte-size validation + }))); + +INSTANTIATE_TEST_SUITE_P(MaterializeWorkgroupSize, + MaterializeAbstractNumericToDefaultType, + testing::Combine(testing::Values(Expectation::kMaterialize), + testing::Values(Method::kWorkgroupSize), + testing::ValuesIn(std::vector{ + Types(1_a, 1.0), // + Types(10_a, 10.0), // + Types(65535_a, 65535.0), // + }))); + +INSTANTIATE_TEST_SUITE_P( + ScalarValueCannotBeRepresented, + MaterializeAbstractNumericToDefaultType, + testing::Combine(testing::Values(Expectation::kValueCannotBeRepresented), + testing::ValuesIn(kScalarMethods), + testing::ValuesIn(std::vector{ + Types(0_a, static_cast(i32::kHighestValue) + 1), // + Types(0_a, static_cast(i32::kLowestValue) - 1), // + Types(0.0_a, kTooBigF32), // + Types(0.0_a, -kTooBigF32), // + }))); + +INSTANTIATE_TEST_SUITE_P( + VectorValueCannotBeRepresented, + MaterializeAbstractNumericToDefaultType, + testing::Combine(testing::Values(Expectation::kValueCannotBeRepresented), + testing::ValuesIn(kVectorMethods), + testing::ValuesIn(std::vector{ + Types(0_a, static_cast(i32::kHighestValue) + 1), // + Types(0_a, static_cast(i32::kLowestValue) - 1), // + Types(0_a, static_cast(u32::kHighestValue) + 1), // + Types(0.0_a, kTooBigF32), // + Types(0.0_a, -kTooBigF32), // + }))); + +INSTANTIATE_TEST_SUITE_P(MatrixValueCannotBeRepresented, + MaterializeAbstractNumericToDefaultType, + testing::Combine(testing::Values(Expectation::kValueCannotBeRepresented), + testing::ValuesIn(kMatrixMethods), + testing::ValuesIn(std::vector{ + Types(0.0_a, kTooBigF32), // + Types(0.0_a, -kTooBigF32), // + }))); + +INSTANTIATE_TEST_SUITE_P( + AIntValueCannotBeRepresented, + MaterializeAbstractNumericToDefaultType, + testing::Combine(testing::Values(Expectation::kValueCannotBeRepresented), + testing::ValuesIn(kAIntMethods), + testing::ValuesIn(std::vector{ + Types(0_a, static_cast(i32::kHighestValue) + 1), // + Types(0_a, static_cast(i32::kLowestValue) - 1), // + }))); + +INSTANTIATE_TEST_SUITE_P( + WorkgroupSizeValueCannotBeRepresented, + MaterializeAbstractNumericToDefaultType, + testing::Combine(testing::Values(Expectation::kValueCannotBeRepresented), + testing::Values(Method::kWorkgroupSize), + testing::ValuesIn(std::vector{ + Types(0_a, static_cast(i32::kHighestValue) + 1), // + Types(0_a, static_cast(i32::kLowestValue) - 1), // + }))); + +INSTANTIATE_TEST_SUITE_P( + ArrayLengthValueCannotBeRepresented, + MaterializeAbstractNumericToDefaultType, + testing::Combine(testing::Values(Expectation::kValueCannotBeRepresented), + testing::Values(Method::kArrayLength), + testing::ValuesIn(std::vector{ + Types(0_a, static_cast(i32::kHighestValue) + 1), // + }))); + +} // namespace materialize_abstract_numeric_to_default_type + +namespace materialize_abstract_numeric_to_unrelated_type { + +using MaterializeAbstractNumericToUnrelatedType = resolver::ResolverTest; + +TEST_F(MaterializeAbstractNumericToUnrelatedType, AIntToStructVarCtor) { + Structure("S", utils::Vector{Member("a", ty.i32())}); + WrapInFunction(Decl(Var("v", ty.type_name("S"), Expr(Source{{12, 34}}, 1_a)))); + EXPECT_FALSE(r()->Resolve()); + EXPECT_THAT( + r()->error(), + testing::HasSubstr("error: cannot convert value of type 'abstract-int' to type 'S'")); +} + +TEST_F(MaterializeAbstractNumericToUnrelatedType, AIntToStructLetCtor) { + Structure("S", utils::Vector{Member("a", ty.i32())}); + WrapInFunction(Decl(Let("v", ty.type_name("S"), Expr(Source{{12, 34}}, 1_a)))); + EXPECT_FALSE(r()->Resolve()); + EXPECT_THAT( + r()->error(), + testing::HasSubstr("error: cannot convert value of type 'abstract-int' to type 'S'")); +} + +} // namespace materialize_abstract_numeric_to_unrelated_type + +} // namespace +} // namespace tint::resolver diff --git a/src/tint/resolver/override_test.cc b/src/tint/resolver/override_test.cc new file mode 100644 index 0000000000..08fec584ba --- /dev/null +++ b/src/tint/resolver/override_test.cc @@ -0,0 +1,117 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/resolver/resolver.h" + +#include "src/tint/resolver/resolver_test_helper.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::resolver { +namespace { + +class ResolverOverrideTest : public ResolverTest { + protected: + /// Verify that the AST node `var` was resolved to an overridable constant + /// with an ID equal to `id`. + /// @param var the overridable constant AST node + /// @param id the expected constant ID + void ExpectOverrideId(const ast::Variable* var, uint16_t id) { + auto* sem = Sem().Get(var); + ASSERT_NE(sem, nullptr); + EXPECT_EQ(sem->Declaration(), var); + EXPECT_TRUE(sem->Declaration()->Is()); + EXPECT_EQ(sem->OverrideId().value, id); + EXPECT_FALSE(sem->ConstantValue()); + } +}; + +TEST_F(ResolverOverrideTest, NonOverridable) { + auto* a = GlobalConst("a", ty.f32(), Expr(1_f)); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem_a = Sem().Get(a); + ASSERT_NE(sem_a, nullptr); + EXPECT_EQ(sem_a->Declaration(), a); + EXPECT_FALSE(sem_a->Declaration()->Is()); + EXPECT_TRUE(sem_a->ConstantValue()); +} + +TEST_F(ResolverOverrideTest, WithId) { + auto* a = Override("a", ty.f32(), Expr(1_f), Id(7u)); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ExpectOverrideId(a, 7u); +} + +TEST_F(ResolverOverrideTest, WithoutId) { + auto* a = Override("a", ty.f32(), Expr(1_f)); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + ExpectOverrideId(a, 0u); +} + +TEST_F(ResolverOverrideTest, WithAndWithoutIds) { + std::vector variables; + auto* a = Override("a", ty.f32(), Expr(1_f)); + auto* b = Override("b", ty.f32(), Expr(1_f)); + auto* c = Override("c", ty.f32(), Expr(1_f), Id(2u)); + auto* d = Override("d", ty.f32(), Expr(1_f), Id(4u)); + auto* e = Override("e", ty.f32(), Expr(1_f)); + auto* f = Override("f", ty.f32(), Expr(1_f), Id(1u)); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + // Verify that constant id allocation order is deterministic. + ExpectOverrideId(a, 0u); + ExpectOverrideId(b, 3u); + ExpectOverrideId(c, 2u); + ExpectOverrideId(d, 4u); + ExpectOverrideId(e, 5u); + ExpectOverrideId(f, 1u); +} + +TEST_F(ResolverOverrideTest, DuplicateIds) { + Override("a", ty.f32(), Expr(1_f), Id(Source{{12, 34}}, 7u)); + Override("b", ty.f32(), Expr(1_f), Id(Source{{56, 78}}, 7u)); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), R"(56:78 error: override IDs must be unique +12:34 note: a override with an ID of 7 was previously declared here:)"); +} + +TEST_F(ResolverOverrideTest, IdTooLarge) { + Override("a", ty.f32(), Expr(1_f), Id(Source{{12, 34}}, 65536u)); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), "12:34 error: override IDs must be between 0 and 65535"); +} + +TEST_F(ResolverOverrideTest, F16_TemporallyBan) { + Enable(ast::Extension::kF16); + + Override(Source{{12, 34}}, "a", ty.f16(), Expr(1_h), Id(1u)); + + EXPECT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), "12:34 error: 'override' of type f16 is not implemented yet"); +} + +} // namespace +} // namespace tint::resolver diff --git a/src/tint/resolver/pipeline_overridable_constant_test.cc b/src/tint/resolver/pipeline_overridable_constant_test.cc deleted file mode 100644 index 35c145e148..0000000000 --- a/src/tint/resolver/pipeline_overridable_constant_test.cc +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/resolver/resolver.h" - -#include "src/tint/resolver/resolver_test_helper.h" - -namespace tint::resolver { -namespace { - -class ResolverPipelineOverridableConstantTest : public ResolverTest { - protected: - /// Verify that the AST node `var` was resolved to an overridable constant - /// with an ID equal to `id`. - /// @param var the overridable constant AST node - /// @param id the expected constant ID - void ExpectConstantId(const ast::Variable* var, uint16_t id) { - auto* sem = Sem().Get(var); - ASSERT_NE(sem, nullptr); - EXPECT_EQ(sem->Declaration(), var); - EXPECT_TRUE(sem->IsOverridable()); - EXPECT_EQ(sem->ConstantId(), id); - EXPECT_FALSE(sem->ConstantValue()); - } -}; - -TEST_F(ResolverPipelineOverridableConstantTest, NonOverridable) { - auto* a = GlobalConst("a", ty.f32(), Expr(1.f)); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem_a = Sem().Get(a); - ASSERT_NE(sem_a, nullptr); - EXPECT_EQ(sem_a->Declaration(), a); - EXPECT_FALSE(sem_a->IsOverridable()); - EXPECT_TRUE(sem_a->ConstantValue()); -} - -TEST_F(ResolverPipelineOverridableConstantTest, WithId) { - auto* a = Override("a", ty.f32(), Expr(1.f), {Id(7u)}); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ExpectConstantId(a, 7u); -} - -TEST_F(ResolverPipelineOverridableConstantTest, WithoutId) { - auto* a = Override("a", ty.f32(), Expr(1.f)); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - ExpectConstantId(a, 0u); -} - -TEST_F(ResolverPipelineOverridableConstantTest, WithAndWithoutIds) { - std::vector variables; - auto* a = Override("a", ty.f32(), Expr(1.f)); - auto* b = Override("b", ty.f32(), Expr(1.f)); - auto* c = Override("c", ty.f32(), Expr(1.f), {Id(2u)}); - auto* d = Override("d", ty.f32(), Expr(1.f), {Id(4u)}); - auto* e = Override("e", ty.f32(), Expr(1.f)); - auto* f = Override("f", ty.f32(), Expr(1.f), {Id(1u)}); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - // Verify that constant id allocation order is deterministic. - ExpectConstantId(a, 0u); - ExpectConstantId(b, 3u); - ExpectConstantId(c, 2u); - ExpectConstantId(d, 4u); - ExpectConstantId(e, 5u); - ExpectConstantId(f, 1u); -} - -TEST_F(ResolverPipelineOverridableConstantTest, DuplicateIds) { - Override("a", ty.f32(), Expr(1.f), {Id(Source{{12, 34}}, 7u)}); - Override("b", ty.f32(), Expr(1.f), {Id(Source{{56, 78}}, 7u)}); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), R"(56:78 error: pipeline constant IDs must be unique -12:34 note: a pipeline constant with an ID of 7 was previously declared here:)"); -} - -TEST_F(ResolverPipelineOverridableConstantTest, IdTooLarge) { - Override("a", ty.f32(), Expr(1.f), {Id(Source{{12, 34}}, 65536u)}); - - EXPECT_FALSE(r()->Resolve()); - - EXPECT_EQ(r()->error(), "12:34 error: pipeline constant IDs must be between 0 and 65535"); -} - -} // namespace -} // namespace tint::resolver diff --git a/src/tint/resolver/ptr_ref_test.cc b/src/tint/resolver/ptr_ref_test.cc index 69b7e54051..ba5be6217b 100644 --- a/src/tint/resolver/ptr_ref_test.cc +++ b/src/tint/resolver/ptr_ref_test.cc @@ -27,7 +27,7 @@ TEST_F(ResolverPtrRefTest, AddressOf) { // var v : i32; // &v - auto* v = Var("v", ty.i32(), ast::StorageClass::kNone); + auto* v = Var("v", ty.i32()); auto* expr = AddressOf(v); WrapInFunction(v, expr); @@ -43,7 +43,7 @@ TEST_F(ResolverPtrRefTest, AddressOfThenDeref) { // var v : i32; // *(&v) - auto* v = Var("v", ty.i32(), ast::StorageClass::kNone); + auto* v = Var("v", ty.i32()); auto* expr = Deref(AddressOf(v)); WrapInFunction(v, expr); @@ -57,20 +57,12 @@ TEST_F(ResolverPtrRefTest, AddressOfThenDeref) { TEST_F(ResolverPtrRefTest, DefaultPtrStorageClass) { // https://gpuweb.github.io/gpuweb/wgsl/#storage-class - auto* buf = Structure("S", {Member("m", ty.i32())}); + auto* buf = Structure("S", utils::Vector{Member("m", ty.i32())}); auto* function = Var("f", ty.i32()); - auto* private_ = Global("p", ty.i32(), ast::StorageClass::kPrivate); - auto* workgroup = Global("w", ty.i32(), ast::StorageClass::kWorkgroup); - auto* uniform = Global("ub", ty.Of(buf), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); - auto* storage = Global("sb", ty.Of(buf), ast::StorageClass::kStorage, - ast::AttributeList{ - create(1), - create(0), - }); + auto* private_ = GlobalVar("p", ty.i32(), ast::StorageClass::kPrivate); + auto* workgroup = GlobalVar("w", ty.i32(), ast::StorageClass::kWorkgroup); + auto* uniform = GlobalVar("ub", ty.Of(buf), ast::StorageClass::kUniform, Binding(0), Group(0)); + auto* storage = GlobalVar("sb", ty.Of(buf), ast::StorageClass::kStorage, Binding(1), Group(0)); auto* function_ptr = Let("f_ptr", ty.pointer(ty.i32(), ast::StorageClass::kFunction), AddressOf(function)); diff --git a/src/tint/resolver/ptr_ref_validation_test.cc b/src/tint/resolver/ptr_ref_validation_test.cc index b011dd0382..0f6f6e57bd 100644 --- a/src/tint/resolver/ptr_ref_validation_test.cc +++ b/src/tint/resolver/ptr_ref_validation_test.cc @@ -54,7 +54,7 @@ TEST_F(ResolverPtrRefValidationTest, AddressOfLet) { TEST_F(ResolverPtrRefValidationTest, AddressOfHandle) { // @group(0) @binding(0) var t: texture_3d; // &t - Global("t", ty.sampled_texture(ast::TextureDimension::k3d, ty.f32()), GroupAndBinding(0u, 0u)); + GlobalVar("t", ty.sampled_texture(ast::TextureDimension::k3d, ty.f32()), Group(0), Binding(0)); auto* expr = AddressOf(Expr(Source{{12, 34}}, "t")); WrapInFunction(expr); @@ -93,7 +93,7 @@ TEST_F(ResolverPtrRefValidationTest, AddressOfVectorComponent_IndexAccessor) { TEST_F(ResolverPtrRefValidationTest, IndirectOfAddressOfHandle) { // @group(0) @binding(0) var t: texture_3d; // *&t - Global("t", ty.sampled_texture(ast::TextureDimension::k3d, ty.f32()), GroupAndBinding(0u, 0u)); + GlobalVar("t", ty.sampled_texture(ast::TextureDimension::k3d, ty.f32()), Group(0), Binding(0)); auto* expr = Deref(AddressOf(Expr(Source{{12, 34}}, "t"))); WrapInFunction(expr); @@ -139,13 +139,10 @@ TEST_F(ResolverPtrRefValidationTest, InferredPtrAccessMismatch) { // fn f() { // let p : pointer = &s.inner.arr[2i]; // } - auto* inner = Structure("Inner", {Member("arr", ty.array())}); - auto* buf = Structure("S", {Member("inner", ty.Of(inner))}); - auto* storage = Global("s", ty.Of(buf), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + auto* inner = Structure("Inner", utils::Vector{Member("arr", ty.array())}); + auto* buf = Structure("S", utils::Vector{Member("inner", ty.Of(inner))}); + auto* storage = GlobalVar("s", ty.Of(buf), ast::StorageClass::kStorage, ast::Access::kReadWrite, + Binding(0), Group(0)); auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 2_i); auto* ptr = diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc index 760813d3d0..90ec2549da 100644 --- a/src/tint/resolver/resolver.cc +++ b/src/tint/resolver/resolver.cc @@ -49,7 +49,11 @@ #include "src/tint/ast/unary_op_expression.h" #include "src/tint/ast/variable_decl_statement.h" #include "src/tint/ast/vector.h" +#include "src/tint/ast/while_statement.h" #include "src/tint/ast/workgroup_attribute.h" +#include "src/tint/resolver/uniformity.h" +#include "src/tint/sem/abstract_float.h" +#include "src/tint/sem/abstract_int.h" #include "src/tint/sem/array.h" #include "src/tint/sem/atomic.h" #include "src/tint/sem/call.h" @@ -58,7 +62,9 @@ #include "src/tint/sem/for_loop_statement.h" #include "src/tint/sem/function.h" #include "src/tint/sem/if_statement.h" +#include "src/tint/sem/index_accessor_expression.h" #include "src/tint/sem/loop_statement.h" +#include "src/tint/sem/materialize.h" #include "src/tint/sem/member_accessor_expression.h" #include "src/tint/sem/module.h" #include "src/tint/sem/multisampled_texture.h" @@ -73,17 +79,20 @@ #include "src/tint/sem/type_constructor.h" #include "src/tint/sem/type_conversion.h" #include "src/tint/sem/variable.h" +#include "src/tint/sem/while_statement.h" #include "src/tint/utils/defer.h" #include "src/tint/utils/math.h" #include "src/tint/utils/reverse.h" #include "src/tint/utils/scoped_assignment.h" #include "src/tint/utils/transform.h" +#include "src/tint/utils/vector.h" namespace tint::resolver { Resolver::Resolver(ProgramBuilder* builder) : builder_(builder), diagnostics_(builder->Diagnostics()), + const_eval_(*builder), intrinsic_table_(IntrinsicTable::Create(*builder)), sem_(builder, dependencies_), validator_(builder, sem_) {} @@ -95,14 +104,16 @@ bool Resolver::Resolve() { return false; } + builder_->Sem().Reserve(builder_->LastAllocatedNodeID()); + + // Pre-allocate the marked bitset with the total number of AST nodes. + marked_.Resize(builder_->ASTNodes().Count()); + if (!DependencyGraph::Build(builder_->AST(), builder_->Symbols(), builder_->Diagnostics(), dependencies_)) { return false; } - // Create the semantic module - builder_->Sem().SetModule(builder_->create(dependencies_.ordered_globals)); - bool result = ResolveInternal(); if (!result && !diagnostics_.contains_errors()) { @@ -110,6 +121,10 @@ bool Resolver::Resolve() { return false; } + // Create the semantic module + builder_->Sem().SetModule(builder_->create( + std::move(dependencies_.ordered_globals), std::move(enabled_extensions_))); + return result; } @@ -119,25 +134,25 @@ bool Resolver::ResolveInternal() { // Process all module-scope declarations in dependency order. for (auto* decl : dependencies_.ordered_globals) { Mark(decl); - // Enable directives don't have sem node. - if (decl->Is()) { - continue; - } - if (!Switch( + if (!Switch( decl, // + [&](const ast::Enable* e) { return Enable(e); }, [&](const ast::TypeDecl* td) { return TypeDecl(td); }, [&](const ast::Function* func) { return Function(func); }, [&](const ast::Variable* var) { return GlobalVariable(var); }, + [&](const ast::StaticAssert* sa) { return StaticAssert(sa); }, [&](Default) { TINT_UNREACHABLE(Resolver, diagnostics_) << "unhandled global declaration: " << decl->TypeInfo().name; - return nullptr; + return false; })) { return false; } } - AllocateOverridableConstantIds(); + if (!AllocateOverridableConstantIds()) { + return false; + } SetShadows(); @@ -145,9 +160,19 @@ bool Resolver::ResolveInternal() { return false; } + if (!validator_.PushConstants(entry_points_)) { + return false; + } + + if (!enabled_extensions_.Contains(ast::Extension::kChromiumDisableUniformityAnalysis)) { + if (!AnalyzeUniformity(builder_, dependencies_)) { + // TODO(jrprice): Reject programs that fail uniformity analysis. + } + } + bool result = true; for (auto* node : builder_->ASTNodes().Objects()) { - if (marked_.count(node) == 0) { + if (!marked_[node->node_id.value]) { TINT_ICE(Resolver, diagnostics_) << "AST node '" << node->TypeInfo().name << "' was not reached by the resolver\n" << "At: " << node->source << "\n" @@ -167,6 +192,14 @@ sem::Type* Resolver::Type(const ast::Type* ty) { [&](const ast::Bool*) { return builder_->create(); }, [&](const ast::I32*) { return builder_->create(); }, [&](const ast::U32*) { return builder_->create(); }, + [&](const ast::F16* t) -> sem::F16* { + // Validate if f16 type is allowed. + if (!enabled_extensions_.Contains(ast::Extension::kF16)) { + AddError("f16 used without 'f16' extension enabled", t->source); + return nullptr; + } + return builder_->create(); + }, [&](const ast::F32*) { return builder_->create(); }, [&](const ast::Vector* t) -> sem::Vector* { if (!t->type) { @@ -222,13 +255,21 @@ sem::Type* Resolver::Type(const ast::Type* ty) { [&](const ast::Sampler* t) { return builder_->create(t->kind); }, [&](const ast::SampledTexture* t) -> sem::SampledTexture* { if (auto* el = Type(t->type)) { - return builder_->create(t->dim, el); + auto* sem = builder_->create(t->dim, el); + if (!validator_.SampledTexture(sem, t->source)) { + return nullptr; + } + return sem; } return nullptr; }, [&](const ast::MultisampledTexture* t) -> sem::MultisampledTexture* { if (auto* el = Type(t->type)) { - return builder_->create(t->dim, el); + auto* sem = builder_->create(t->dim, el); + if (!validator_.MultisampledTexture(sem, t->source)) { + return nullptr; + } + return sem; } return nullptr; }, @@ -285,9 +326,188 @@ sem::Type* Resolver::Type(const ast::Type* ty) { return s; } -sem::Variable* Resolver::Variable(const ast::Variable* var, - VariableKind kind, - uint32_t index /* = 0 */) { +sem::Variable* Resolver::Variable(const ast::Variable* v, bool is_global) { + return Switch( + v, // + [&](const ast::Var* var) { return Var(var, is_global); }, + [&](const ast::Let* let) { return Let(let, is_global); }, + [&](const ast::Override* override) { return Override(override); }, + [&](const ast::Const* const_) { return Const(const_, is_global); }, + [&](Default) { + TINT_ICE(Resolver, diagnostics_) + << "Resolver::GlobalVariable() called with a unknown variable type: " + << v->TypeInfo().name; + return nullptr; + }); +} + +sem::Variable* Resolver::Let(const ast::Let* v, bool is_global) { + const sem::Type* ty = nullptr; + + // If the variable has a declared type, resolve it. + if (v->type) { + ty = Type(v->type); + if (!ty) { + return nullptr; + } + } + + if (!v->constructor) { + AddError("'let' declaration must have an initializer", v->source); + return nullptr; + } + + auto* rhs = Materialize(Expression(v->constructor), ty); + if (!rhs) { + return nullptr; + } + + // If the variable has no declared type, infer it from the RHS + if (!ty) { + ty = rhs->Type()->UnwrapRef(); // Implicit load of RHS + } + + if (rhs && !validator_.VariableInitializer(v, ast::StorageClass::kNone, ty, rhs)) { + return nullptr; + } + + if (!ApplyStorageClassUsageToType(ast::StorageClass::kNone, const_cast(ty), + v->source)) { + AddNote("while instantiating 'let' " + builder_->Symbols().NameFor(v->symbol), v->source); + return nullptr; + } + + sem::Variable* sem = nullptr; + if (is_global) { + sem = builder_->create( + v, ty, sem::EvaluationStage::kRuntime, ast::StorageClass::kNone, + ast::Access::kUndefined, /* constant_value */ nullptr, sem::BindingPoint{}); + } else { + sem = builder_->create(v, ty, sem::EvaluationStage::kRuntime, + ast::StorageClass::kNone, + ast::Access::kUndefined, current_statement_, + /* constant_value */ nullptr); + } + + sem->SetConstructor(rhs); + builder_->Sem().Add(v, sem); + return sem; +} + +sem::Variable* Resolver::Override(const ast::Override* v) { + const sem::Type* ty = nullptr; + + // If the variable has a declared type, resolve it. + if (v->type) { + ty = Type(v->type); + if (!ty) { + return nullptr; + } + } + + const sem::Expression* rhs = nullptr; + + // Does the variable have a constructor? + if (v->constructor) { + rhs = Materialize(Expression(v->constructor), ty); + if (!rhs) { + return nullptr; + } + + // If the variable has no declared type, infer it from the RHS + if (!ty) { + ty = rhs->Type()->UnwrapRef(); // Implicit load of RHS + } + } else if (!ty) { + AddError("override declaration requires a type or initializer", v->source); + return nullptr; + } + + if (rhs && !validator_.VariableInitializer(v, ast::StorageClass::kNone, ty, rhs)) { + return nullptr; + } + + if (!ApplyStorageClassUsageToType(ast::StorageClass::kNone, const_cast(ty), + v->source)) { + AddNote("while instantiating 'override' " + builder_->Symbols().NameFor(v->symbol), + v->source); + return nullptr; + } + + auto* sem = builder_->create( + v, ty, sem::EvaluationStage::kOverride, ast::StorageClass::kNone, ast::Access::kUndefined, + /* constant_value */ nullptr, sem::BindingPoint{}); + + if (auto* id = ast::GetAttribute(v->attributes)) { + sem->SetOverrideId(OverrideId{static_cast(id->value)}); + } + + sem->SetConstructor(rhs); + builder_->Sem().Add(v, sem); + return sem; +} + +sem::Variable* Resolver::Const(const ast::Const* c, bool is_global) { + const sem::Type* ty = nullptr; + + // If the variable has a declared type, resolve it. + if (c->type) { + ty = Type(c->type); + if (!ty) { + return nullptr; + } + } + + if (!c->constructor) { + AddError("'const' declaration must have an initializer", c->source); + return nullptr; + } + + const auto* rhs = Expression(c->constructor); + if (!rhs) { + return nullptr; + } + + if (ty) { + // If an explicit type was specified, materialize to that type + rhs = Materialize(rhs, ty); + if (!rhs) { + return nullptr; + } + } else { + // If no type was specified, infer it from the RHS + ty = rhs->Type(); + } + + const auto value = rhs->ConstantValue(); + if (!value) { + AddError("'const' initializer must be constant expression", c->constructor->source); + return nullptr; + } + + if (!validator_.VariableInitializer(c, ast::StorageClass::kNone, ty, rhs)) { + return nullptr; + } + + if (!ApplyStorageClassUsageToType(ast::StorageClass::kNone, const_cast(ty), + c->source)) { + AddNote("while instantiating 'const' " + builder_->Symbols().NameFor(c->symbol), c->source); + return nullptr; + } + + auto* sem = is_global ? static_cast(builder_->create( + c, ty, sem::EvaluationStage::kConstant, ast::StorageClass::kNone, + ast::Access::kUndefined, value, sem::BindingPoint{})) + : static_cast(builder_->create( + c, ty, sem::EvaluationStage::kConstant, ast::StorageClass::kNone, + ast::Access::kUndefined, current_statement_, value)); + + sem->SetConstructor(rhs); + builder_->Sem().Add(c, sem); + return sem; +} + +sem::Variable* Resolver::Var(const ast::Var* var, bool is_global) { const sem::Type* storage_ty = nullptr; // If the variable has a declared type, resolve it. @@ -302,42 +522,25 @@ sem::Variable* Resolver::Variable(const ast::Variable* var, // Does the variable have a constructor? if (var->constructor) { - rhs = Expression(var->constructor); + rhs = Materialize(Expression(var->constructor), storage_ty); if (!rhs) { return nullptr; } - // If the variable has no declared type, infer it from the RHS if (!storage_ty) { - if (!var->is_const && kind == VariableKind::kGlobal) { - AddError("global var declaration must specify a type", var->source); - return nullptr; - } - storage_ty = rhs->Type()->UnwrapRef(); // Implicit load of RHS } - } else if (var->is_const && !var->is_overridable && kind != VariableKind::kParameter) { - AddError("let declaration must have an initializer", var->source); - return nullptr; - } else if (!var->type) { - AddError((kind == VariableKind::kGlobal) - ? "module scope var declaration requires a type and initializer" - : "function scope var declaration requires a type or initializer", - var->source); - return nullptr; } if (!storage_ty) { - TINT_ICE(Resolver, diagnostics_) << "failed to determine storage type for variable '" + - builder_->Symbols().NameFor(var->symbol) + "'\n" - << "Source: " << var->source; + AddError("var declaration requires a type or initializer", var->source); return nullptr; } auto storage_class = var->declared_storage_class; - if (storage_class == ast::StorageClass::kNone && !var->is_const) { + if (storage_class == ast::StorageClass::kNone) { // No declared storage class. Infer from usage / type. - if (kind == VariableKind::kLocal) { + if (!is_global) { storage_class = ast::StorageClass::kFunction; } else if (storage_ty->UnwrapRef()->is_handle()) { // https://gpuweb.github.io/gpuweb/wgsl/#module-scope-variables @@ -348,11 +551,10 @@ sem::Variable* Resolver::Variable(const ast::Variable* var, } } - if (kind == VariableKind::kLocal && !var->is_const && - storage_class != ast::StorageClass::kFunction && + if (!is_global && storage_class != ast::StorageClass::kFunction && validator_.IsValidationEnabled(var->attributes, ast::DisabledValidation::kIgnoreStorageClass)) { - AddError("function variable has a non-function storage class", var->source); + AddError("function-scope 'var' declaration must use 'function' storage class", var->source); return nullptr; } @@ -361,80 +563,104 @@ sem::Variable* Resolver::Variable(const ast::Variable* var, access = DefaultAccessForStorageClass(storage_class); } - auto* var_ty = storage_ty; - if (!var->is_const) { - // Variable declaration. Unlike `let`, `var` has storage. - // Variables are always of a reference type to the declared storage type. - var_ty = builder_->create(storage_ty, storage_class, access); - } - - if (rhs && !validator_.VariableConstructorOrCast(var, storage_class, storage_ty, rhs->Type())) { + if (rhs && !validator_.VariableInitializer(var, storage_class, storage_ty, rhs)) { return nullptr; } - if (!ApplyStorageClassUsageToType(storage_class, const_cast(var_ty), var->source)) { - AddNote(std::string("while instantiating ") + - ((kind == VariableKind::kParameter) ? "parameter " : "variable ") + - builder_->Symbols().NameFor(var->symbol), + auto* var_ty = builder_->create(storage_ty, storage_class, access); + + if (!ApplyStorageClassUsageToType(storage_class, var_ty, var->source)) { + AddNote("while instantiating 'var' " + builder_->Symbols().NameFor(var->symbol), var->source); return nullptr; } - if (kind == VariableKind::kParameter) { - if (auto* ptr = var_ty->As()) { - // For MSL, we push module-scope variables into the entry point as pointer - // parameters, so we also need to handle their store type. - if (!ApplyStorageClassUsageToType( - ptr->StorageClass(), const_cast(ptr->StoreType()), var->source)) { - AddNote("while instantiating parameter " + builder_->Symbols().NameFor(var->symbol), - var->source); - return nullptr; + sem::Variable* sem = nullptr; + if (is_global) { + sem::BindingPoint binding_point; + if (var->HasBindingPoint()) { + uint32_t binding = 0; + { + auto* attr = ast::GetAttribute(var->attributes); + // TODO(dsinclair): Materialize when binding attribute is an expression + binding = attr->value; } + + uint32_t group = 0; + { + auto* attr = ast::GetAttribute(var->attributes); + // TODO(dsinclair): Materialize when group attribute is an expression + group = attr->value; + } + binding_point = {group, binding}; + } + sem = builder_->create(var, var_ty, sem::EvaluationStage::kRuntime, + storage_class, access, + /* constant_value */ nullptr, binding_point); + + } else { + sem = builder_->create(var, var_ty, sem::EvaluationStage::kRuntime, + storage_class, access, current_statement_, + /* constant_value */ nullptr); + } + + sem->SetConstructor(rhs); + builder_->Sem().Add(var, sem); + return sem; +} + +sem::Parameter* Resolver::Parameter(const ast::Parameter* param, uint32_t index) { + auto add_note = [&] { + AddNote("while instantiating parameter " + builder_->Symbols().NameFor(param->symbol), + param->source); + }; + + for (auto* attr : param->attributes) { + Mark(attr); + } + if (!validator_.NoDuplicateAttributes(param->attributes)) { + return nullptr; + } + + sem::Type* ty = Type(param->type); + if (!ty) { + return nullptr; + } + + if (!ApplyStorageClassUsageToType(ast::StorageClass::kNone, ty, param->source)) { + add_note(); + return nullptr; + } + + if (auto* ptr = ty->As()) { + // For MSL, we push module-scope variables into the entry point as pointer + // parameters, so we also need to handle their store type. + if (!ApplyStorageClassUsageToType( + ptr->StorageClass(), const_cast(ptr->StoreType()), param->source)) { + add_note(); + return nullptr; } } - switch (kind) { - case VariableKind::kGlobal: { - sem::BindingPoint binding_point; - if (auto bp = var->BindingPoint()) { - binding_point = {bp.group->value, bp.binding->value}; - } - - bool has_const_val = rhs && var->is_const && !var->is_overridable; - auto* global = builder_->create( - var, var_ty, storage_class, access, - has_const_val ? rhs->ConstantValue() : sem::Constant{}, binding_point); - - if (var->is_overridable) { - global->SetIsOverridable(); - if (auto* id = ast::GetAttribute(var->attributes)) { - global->SetConstantId(static_cast(id->value)); - } - } - - global->SetConstructor(rhs); - - builder_->Sem().Add(var, global); - return global; + sem::BindingPoint binding_point; + if (param->HasBindingPoint()) { + { + auto* attr = ast::GetAttribute(param->attributes); + // TODO(dsinclair): Materialize the binding information + binding_point.binding = attr->value; } - case VariableKind::kLocal: { - auto* local = builder_->create( - var, var_ty, storage_class, access, current_statement_, - (rhs && var->is_const) ? rhs->ConstantValue() : sem::Constant{}); - builder_->Sem().Add(var, local); - local->SetConstructor(rhs); - return local; - } - case VariableKind::kParameter: { - auto* param = - builder_->create(var, index, var_ty, storage_class, access); - builder_->Sem().Add(var, param); - return param; + { + auto* attr = ast::GetAttribute(param->attributes); + // TODO(dsinclair): Materialize the group information + binding_point.group = attr->value; } } - TINT_UNREACHABLE(Resolver, diagnostics_) << "unhandled VariableKind " << static_cast(kind); - return nullptr; + auto* sem = builder_->create(param, index, ty, ast::StorageClass::kNone, + ast::Access::kUndefined, + sem::ParameterUsage::kNone, binding_point); + builder_->Sem().Add(param, sem); + return sem; } ast::Access Resolver::DefaultAccessForStorageClass(ast::StorageClass storage_class) { @@ -450,40 +676,52 @@ ast::Access Resolver::DefaultAccessForStorageClass(ast::StorageClass storage_cla return ast::Access::kReadWrite; } -void Resolver::AllocateOverridableConstantIds() { +bool Resolver::AllocateOverridableConstantIds() { + constexpr size_t kLimit = std::numeric_limits::max(); // The next pipeline constant ID to try to allocate. - uint16_t next_constant_id = 0; + OverrideId next_id; + bool ids_exhausted = false; + + auto increment_next_id = [&] { + if (next_id.value == kLimit) { + ids_exhausted = true; + } else { + next_id.value = next_id.value + 1; + } + }; // Allocate constant IDs in global declaration order, so that they are // deterministic. // TODO(crbug.com/tint/1192): If a transform changes the order or removes an // unused constant, the allocation may change on the next Resolver pass. for (auto* decl : builder_->AST().GlobalDeclarations()) { - auto* var = decl->As(); - if (!var || !var->is_overridable) { + auto* override = decl->As(); + if (!override) { continue; } - uint16_t constant_id; - if (auto* id_attr = ast::GetAttribute(var->attributes)) { - constant_id = static_cast(id_attr->value); + OverrideId id; + if (auto* id_attr = ast::GetAttribute(override->attributes)) { + id = OverrideId{static_cast(id_attr->value)}; } else { // No ID was specified, so allocate the next available ID. - constant_id = next_constant_id; - while (constant_ids_.count(constant_id)) { - if (constant_id == UINT16_MAX) { - TINT_ICE(Resolver, builder_->Diagnostics()) - << "no more pipeline constant IDs available"; - return; - } - constant_id++; + while (!ids_exhausted && override_ids_.count(next_id)) { + increment_next_id(); } - next_constant_id = constant_id + 1; + if (ids_exhausted) { + AddError( + "number of 'override' variables exceeded limit of " + std::to_string(kLimit), + decl->source); + return false; + } + id = next_id; + increment_next_id(); } - auto* sem = sem_.Get(var); - const_cast(sem)->SetConstantId(constant_id); + auto* sem = sem_.Get(override); + const_cast(sem)->SetOverrideId(id); } + return true; } void Resolver::SetShadows() { @@ -495,52 +733,70 @@ void Resolver::SetShadows() { } } -sem::GlobalVariable* Resolver::GlobalVariable(const ast::Variable* var) { - auto* sem = Variable(var, VariableKind::kGlobal); +sem::GlobalVariable* Resolver::GlobalVariable(const ast::Variable* v) { + auto* sem = As(Variable(v, /* is_global */ true)); if (!sem) { return nullptr; } - auto storage_class = sem->StorageClass(); - if (!var->is_const && storage_class == ast::StorageClass::kNone) { - AddError("global variables must have a storage class", var->source); - return nullptr; - } - if (var->is_const && storage_class != ast::StorageClass::kNone) { - AddError("global constants shouldn't have a storage class", var->source); - return nullptr; - } - - for (auto* attr : var->attributes) { + for (auto* attr : v->attributes) { Mark(attr); if (auto* id_attr = attr->As()) { // Track the constant IDs that are specified in the shader. - constant_ids_.emplace(id_attr->value, sem); + override_ids_.emplace( + OverrideId{static_cast(id_attr->value)}, sem); } } - if (!validator_.NoDuplicateAttributes(var->attributes)) { + if (!validator_.NoDuplicateAttributes(v->attributes)) { return nullptr; } - if (!validator_.GlobalVariable(sem, constant_ids_, atomic_composite_info_)) { + if (!validator_.GlobalVariable(sem, override_ids_, atomic_composite_info_)) { return nullptr; } // TODO(bclayton): Call this at the end of resolve on all uniform and storage // referenced structs - if (!validator_.StorageClassLayout(sem, valid_type_storage_layouts_)) { + if (!validator_.StorageClassLayout(sem, enabled_extensions_, valid_type_storage_layouts_)) { return nullptr; } - return sem->As(); + return sem; +} + +sem::Statement* Resolver::StaticAssert(const ast::StaticAssert* assertion) { + auto* expr = Expression(assertion->condition); + if (!expr) { + return nullptr; + } + auto* cond = expr->ConstantValue(); + if (!cond) { + AddError("static assertion condition must be a constant expression", + assertion->condition->source); + return nullptr; + } + if (auto* ty = cond->Type(); !ty->Is()) { + AddError( + "static assertion condition must be a bool, got '" + builder_->FriendlyName(ty) + "'", + assertion->condition->source); + return nullptr; + } + if (!cond->As()) { + AddError("static assertion failed", assertion->source); + return nullptr; + } + auto* sem = + builder_->create(assertion, current_compound_statement_, current_function_); + builder_->Sem().Add(assertion, sem); + return sem; } sem::Function* Resolver::Function(const ast::Function* decl) { uint32_t parameter_index = 0; std::unordered_map parameter_names; - std::vector parameters; + utils::Vector parameters; // Resolve all the parameters for (auto* param : decl->params) { @@ -556,23 +812,19 @@ sem::Function* Resolver::Function(const ast::Function* decl) { } } - auto* var = - As(Variable(param, VariableKind::kParameter, parameter_index++)); - if (!var) { + auto* p = Parameter(param, parameter_index++); + if (!p) { return nullptr; } - for (auto* attr : param->attributes) { - Mark(attr); - } - if (!validator_.NoDuplicateAttributes(param->attributes)) { + if (!validator_.Parameter(decl, p)) { return nullptr; } - parameters.emplace_back(var); + parameters.Push(p); - auto* var_ty = const_cast(var->Type()); - if (auto* str = var_ty->As()) { + auto* p_ty = const_cast(p->Type()); + if (auto* str = p_ty->As()) { switch (decl->PipelineStage()) { case ast::PipelineStage::kVertex: str->AddUsage(sem::PipelineStageUsage::kVertexInput); @@ -623,7 +875,7 @@ sem::Function* Resolver::Function(const ast::Function* decl) { } } - auto* func = builder_->create(decl, return_type, parameters); + auto* func = builder_->create(decl, return_type, std::move(parameters)); builder_->Sem().Add(decl, func); TINT_SCOPED_ASSIGNMENT(current_function_, func); @@ -693,7 +945,7 @@ sem::Function* Resolver::Function(const ast::Function* decl) { bool Resolver::WorkgroupSize(const ast::Function* func) { // Set work-group size defaults. sem::WorkgroupSize ws; - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { ws[i].value = 1; ws[i].overridable_const = nullptr; } @@ -704,56 +956,63 @@ bool Resolver::WorkgroupSize(const ast::Function* func) { } auto values = attr->Values(); - auto any_i32 = false; - auto any_u32 = false; - for (int i = 0; i < 3; i++) { - // Each argument to this attribute can either be a literal, an - // identifier for a module-scope constants, or nullptr if not specified. + utils::Vector args; + utils::Vector arg_tys; - auto* expr = values[i]; + constexpr const char* kErrBadExpr = + "workgroup_size argument must be either a literal, constant, or overridable of type " + "abstract-integer, i32 or u32"; + + for (size_t i = 0; i < 3; i++) { + // Each argument to this attribute can either be a literal, an identifier for a module-scope + // constants, a constant expression, or nullptr if not specified. + auto* value = values[i]; + if (!value) { + break; + } + const auto* expr = Expression(value); if (!expr) { - // Not specified, just use the default. - continue; + return false; } - - auto* expr_sem = Expression(expr); - if (!expr_sem) { + auto* ty = expr->Type(); + if (!ty->IsAnyOf()) { + AddError(kErrBadExpr, value->source); return false; } - constexpr const char* kErrBadType = - "workgroup_size argument must be either literal or module-scope " - "constant of type i32 or u32"; - constexpr const char* kErrInconsistentType = - "workgroup_size arguments must be of the same type, either i32 " - "or u32"; + args.Push(expr); + arg_tys.Push(ty); + } - auto* ty = sem_.TypeOf(expr); - bool is_i32 = ty->UnwrapRef()->Is(); - bool is_u32 = ty->UnwrapRef()->Is(); - if (!is_i32 && !is_u32) { - AddError(kErrBadType, expr->source); + auto* common_ty = sem::Type::Common(arg_tys); + if (!common_ty) { + AddError("workgroup_size arguments must be of the same type, either i32 or u32", + attr->source); + return false; + } + + // If all arguments are abstract-integers, then materialize to i32. + if (common_ty->Is()) { + common_ty = builder_->create(); + } + + for (size_t i = 0; i < args.Length(); i++) { + auto* materialized = Materialize(args[i], common_ty); + if (!materialized) { return false; } - any_i32 = any_i32 || is_i32; - any_u32 = any_u32 || is_u32; - if (any_i32 && any_u32) { - AddError(kErrInconsistentType, expr->source); - return false; - } + const sem::Constant* value = nullptr; - sem::Constant value; - - if (auto* user = sem_.Get(expr)->As()) { + if (auto* user = args[i]->As()) { // We have an variable of a module-scope constant. auto* decl = user->Variable()->Declaration(); - if (!decl->is_const) { - AddError(kErrBadType, expr->source); + if (!decl->IsAnyOf()) { + AddError(kErrBadExpr, values[i]->source); return false; } // Capture the constant if it is pipeline-overridable. - if (decl->is_overridable) { + if (decl->Is()) { ws[i].overridable_const = decl; } @@ -764,13 +1023,10 @@ bool Resolver::WorkgroupSize(const ast::Function* func) { ws[i].value = 0; continue; } - } else if (expr->Is()) { - value = sem_.Get(expr)->ConstantValue(); + } else if (values[i]->Is() || args[i]->ConstantValue()) { + value = materialized->ConstantValue(); } else { - AddError( - "workgroup_size argument must be either a literal or a " - "module-scope constant", - values[i]->source); + AddError(kErrBadExpr, values[i]->source); return false; } @@ -780,20 +1036,19 @@ bool Resolver::WorkgroupSize(const ast::Function* func) { continue; } // validator_.Validate and set the default value for this dimension. - if (is_i32 ? value.Elements()[0].i32 < 1 : value.Elements()[0].u32 < 1) { + if (value->As() < 1) { AddError("workgroup_size argument must be at least 1", values[i]->source); return false; } - ws[i].value = - is_i32 ? static_cast(value.Elements()[0].i32) : value.Elements()[0].u32; + ws[i].value = value->As(); } current_function_->SetWorkgroupSize(std::move(ws)); return true; } -bool Resolver::Statements(const ast::StatementList& stmts) { +bool Resolver::Statements(utils::VectorRef stmts) { sem::Behaviors behaviors{sem::Behavior::kNext}; bool reachable = true; @@ -828,6 +1083,7 @@ sem::Statement* Resolver::Statement(const ast::Statement* stmt) { [&](const ast::BlockStatement* b) { return BlockStatement(b); }, [&](const ast::ForLoopStatement* l) { return ForLoopStatement(l); }, [&](const ast::LoopStatement* l) { return LoopStatement(l); }, + [&](const ast::WhileStatement* w) { return WhileStatement(w); }, [&](const ast::IfStatement* i) { return IfStatement(i); }, [&](const ast::SwitchStatement* s) { return SwitchStatement(s); }, @@ -842,6 +1098,7 @@ sem::Statement* Resolver::Statement(const ast::Statement* stmt) { [&](const ast::IncrementDecrementStatement* i) { return IncrementDecrementStatement(i); }, [&](const ast::ReturnStatement* r) { return ReturnStatement(r); }, [&](const ast::VariableDeclStatement* v) { return VariableDeclStatement(v); }, + [&](const ast::StaticAssert* sa) { return StaticAssert(sa); }, // Error cases [&](const ast::CaseStatement*) { @@ -858,10 +1115,13 @@ sem::CaseStatement* Resolver::CaseStatement(const ast::CaseStatement* stmt) { auto* sem = builder_->create(stmt, current_compound_statement_, current_function_); return StatementScope(stmt, sem, [&] { + sem->Selectors().reserve(stmt->selectors.Length()); for (auto* sel : stmt->selectors) { - if (!Expression(sel)) { + auto* expr = Expression(sel); + if (!expr) { return false; } + sem->Selectors().emplace_back(expr); } Mark(stmt->body); auto* body = BlockStatement(stmt->body); @@ -935,17 +1195,15 @@ sem::LoopStatement* Resolver::LoopStatement(const ast::LoopStatement* stmt) { if (stmt->continuing) { Mark(stmt->continuing); - if (!stmt->continuing->Empty()) { - auto* continuing = StatementScope( - stmt->continuing, - builder_->create( - stmt->continuing, current_compound_statement_, current_function_), - [&] { return Statements(stmt->continuing->statements); }); - if (!continuing) { - return false; - } - behaviors.Add(continuing->Behaviors()); + auto* continuing = StatementScope( + stmt->continuing, + builder_->create( + stmt->continuing, current_compound_statement_, current_function_), + [&] { return Statements(stmt->continuing->statements); }); + if (!continuing) { + return false; } + behaviors.Add(continuing->Behaviors()); } if (behaviors.Contains(sem::Behavior::kBreak)) { // Does the loop exit? @@ -1012,22 +1270,63 @@ sem::ForLoopStatement* Resolver::ForLoopStatement(const ast::ForLoopStatement* s }); } +sem::WhileStatement* Resolver::WhileStatement(const ast::WhileStatement* stmt) { + auto* sem = + builder_->create(stmt, current_compound_statement_, current_function_); + return StatementScope(stmt, sem, [&] { + auto& behaviors = sem->Behaviors(); + + auto* cond = Expression(stmt->condition); + if (!cond) { + return false; + } + sem->SetCondition(cond); + behaviors.Add(cond->Behaviors()); + + Mark(stmt->body); + + auto* body = builder_->create( + stmt->body, current_compound_statement_, current_function_); + if (!StatementScope(stmt->body, body, [&] { return Statements(stmt->body->statements); })) { + return false; + } + + behaviors.Add(body->Behaviors()); + // Always consider the while as having a 'next' behaviour because it has + // a condition. We don't check if the condition will terminate but it isn't + // valid to have an infinite loop in a WGSL program, so a non-terminating + // condition is already an invalid program. + behaviors.Add(sem::Behavior::kNext); + behaviors.Remove(sem::Behavior::kBreak, sem::Behavior::kContinue); + + return validator_.WhileStatement(sem); + }); +} + sem::Expression* Resolver::Expression(const ast::Expression* root) { - std::vector sorted; - bool mark_failed = false; + utils::Vector sorted; + constexpr size_t kMaxExpressionDepth = 512U; + bool failed = false; if (!ast::TraverseExpressions( - root, diagnostics_, [&](const ast::Expression* expr) { - if (!Mark(expr)) { - mark_failed = true; + root, diagnostics_, [&](const ast::Expression* expr, size_t depth) { + if (depth > kMaxExpressionDepth) { + AddError( + "reached max expression depth of " + std::to_string(kMaxExpressionDepth), + expr->source); + failed = true; return ast::TraverseAction::Stop; } - sorted.emplace_back(expr); + if (!Mark(expr)) { + failed = true; + return ast::TraverseAction::Stop; + } + sorted.Push(expr); return ast::TraverseAction::Descend; })) { return nullptr; } - if (mark_failed) { + if (failed) { return nullptr; } @@ -1054,7 +1353,9 @@ sem::Expression* Resolver::Expression(const ast::Expression* root) { [&](const ast::UnaryOpExpression* unary) -> sem::Expression* { return UnaryOp(unary); }, [&](const ast::PhonyExpression*) -> sem::Expression* { return builder_->create(expr, builder_->create(), - current_statement_, sem::Constant{}, + sem::EvaluationStage::kRuntime, + current_statement_, + /* constant_value */ nullptr, /* has_side_effects */ false); }, [&](Default) { @@ -1076,9 +1377,151 @@ sem::Expression* Resolver::Expression(const ast::Expression* root) { return nullptr; } +const sem::Type* Resolver::ConcreteType(const sem::Type* ty, + const sem::Type* target_ty, + const Source& source) { + auto i32 = [&] { return builder_->create(); }; + auto f32 = [&] { return builder_->create(); }; + auto i32v = [&](uint32_t width) { return builder_->create(i32(), width); }; + auto f32v = [&](uint32_t width) { return builder_->create(f32(), width); }; + auto f32m = [&](uint32_t columns, uint32_t rows) { + return builder_->create(f32v(rows), columns); + }; + + return Switch( + ty, // + [&](const sem::AbstractInt*) { return target_ty ? target_ty : i32(); }, + [&](const sem::AbstractFloat*) { return target_ty ? target_ty : f32(); }, + [&](const sem::Vector* v) { + return Switch( + v->type(), // + [&](const sem::AbstractInt*) { return target_ty ? target_ty : i32v(v->Width()); }, + [&](const sem::AbstractFloat*) { + return target_ty ? target_ty : f32v(v->Width()); + }); + }, + [&](const sem::Matrix* m) { + return Switch(m->type(), // + [&](const sem::AbstractFloat*) { + return target_ty ? target_ty : f32m(m->columns(), m->rows()); + }); + }, + [&](const sem::Array* a) -> const sem::Type* { + const sem::Type* target_el_ty = nullptr; + if (auto* target_arr_ty = As(target_ty)) { + target_el_ty = target_arr_ty->ElemType(); + } + if (auto* el_ty = ConcreteType(a->ElemType(), target_el_ty, source)) { + return Array(source, el_ty, a->Count(), /* explicit_stride */ 0); + } + return nullptr; + }); +} + +const sem::Expression* Resolver::Materialize(const sem::Expression* expr, + const sem::Type* target_type /* = nullptr */) { + if (!expr) { + // Allow for Materialize(Expression(blah)), where failures pass through Materialize() + return nullptr; + } + + auto* decl = expr->Declaration(); + + auto* concrete_ty = ConcreteType(expr->Type(), target_type, decl->source); + if (!concrete_ty) { + return expr; // Does not require materialization + } + + auto* src_ty = expr->Type(); + if (!validator_.Materialize(concrete_ty, src_ty, decl->source)) { + return nullptr; + } + + auto expr_val = expr->ConstantValue(); + if (!expr_val) { + TINT_ICE(Resolver, builder_->Diagnostics()) + << decl->source << "Materialize(" << decl->TypeInfo().name + << ") called on expression with no constant value"; + return nullptr; + } + + auto materialized_val = const_eval_.Convert(concrete_ty, expr_val, decl->source); + if (!materialized_val) { + // ConvertValue() has already failed and raised an diagnostic error. + return nullptr; + } + + if (!materialized_val.Get()) { + TINT_ICE(Resolver, builder_->Diagnostics()) + << decl->source << "ConvertValue(" << builder_->FriendlyName(expr_val->Type()) << " -> " + << builder_->FriendlyName(concrete_ty) << ") returned invalid value"; + return nullptr; + } + auto* m = builder_->create(expr, current_statement_, materialized_val.Get()); + m->Behaviors() = expr->Behaviors(); + builder_->Sem().Replace(decl, m); + return m; +} + +template +bool Resolver::MaterializeArguments(utils::Vector& args, + const sem::CallTarget* target) { + for (size_t i = 0, n = std::min(args.Length(), target->Parameters().Length()); i < n; i++) { + const auto* param_ty = target->Parameters()[i]->Type(); + if (ShouldMaterializeArgument(param_ty)) { + auto* materialized = Materialize(args[i], param_ty); + if (!materialized) { + return false; + } + args[i] = materialized; + } + } + return true; +} + +bool Resolver::ShouldMaterializeArgument(const sem::Type* parameter_ty) const { + const auto* param_el_ty = sem::Type::DeepestElementOf(parameter_ty); + return param_el_ty && !param_el_ty->Is(); +} + +bool Resolver::Convert(const sem::Constant*& c, const sem::Type* target_ty, const Source& source) { + auto r = const_eval_.Convert(target_ty, c, source); + if (!r) { + return false; + } + c = r.Get(); + return true; +} + +template +utils::Result> Resolver::ConvertArguments( + const utils::Vector& args, + const sem::CallTarget* target) { + auto const_args = utils::Transform(args, [](auto* arg) { return arg->ConstantValue(); }); + for (size_t i = 0, n = std::min(args.Length(), target->Parameters().Length()); i < n; i++) { + if (!Convert(const_args[i], target->Parameters()[i]->Type(), + args[i]->Declaration()->source)) { + return utils::Failure; + } + } + return const_args; +} + sem::Expression* Resolver::IndexAccessor(const ast::IndexAccessorExpression* expr) { - auto* idx = sem_.Get(expr->index); - auto* obj = sem_.Get(expr->object); + auto* idx = Materialize(sem_.Get(expr->index)); + if (!idx) { + return nullptr; + } + const auto* obj = sem_.Get(expr->object); + if (idx->Stage() != sem::EvaluationStage::kConstant) { + // If the index is non-constant, then the resulting expression is non-constant, so we'll + // have to materialize the object. For example, consider: + // vec2(1, 2)[runtime-index] + obj = Materialize(obj); + } + if (!obj) { + return nullptr; + } auto* obj_raw_ty = obj->Type(); auto* obj_ty = obj_raw_ty->UnwrapRef(); auto* ty = Switch( @@ -1108,24 +1551,40 @@ sem::Expression* Resolver::IndexAccessor(const ast::IndexAccessorExpression* exp ty = builder_->create(ty, ref->StorageClass(), ref->Access()); } - auto val = EvaluateConstantValue(expr, ty); + auto stage = sem::EarliestStage(obj->Stage(), idx->Stage()); + const sem::Constant* val = nullptr; + if (auto r = const_eval_.Index(obj, idx)) { + val = r.Get(); + } else { + return nullptr; + } bool has_side_effects = idx->HasSideEffects() || obj->HasSideEffects(); - auto* sem = builder_->create(expr, ty, current_statement_, val, - has_side_effects, obj->SourceVariable()); + auto* sem = builder_->create( + expr, ty, stage, obj, idx, current_statement_, std::move(val), has_side_effects, + obj->SourceVariable()); sem->Behaviors() = idx->Behaviors() + obj->Behaviors(); return sem; } sem::Expression* Resolver::Bitcast(const ast::BitcastExpression* expr) { - auto* inner = sem_.Get(expr->expr); + auto* inner = Materialize(sem_.Get(expr->expr)); + if (!inner) { + return nullptr; + } auto* ty = Type(expr->type); if (!ty) { return nullptr; } - auto val = EvaluateConstantValue(expr, ty); - auto* sem = builder_->create(expr, ty, current_statement_, val, - inner->HasSideEffects()); + const sem::Constant* val = nullptr; + if (auto r = const_eval_.Bitcast(ty, inner)) { + val = r.Get(); + } else { + return nullptr; + } + auto stage = sem::EvaluationStage::kRuntime; // TODO(crbug.com/tint/1581) + auto* sem = builder_->create(expr, ty, stage, current_statement_, + std::move(val), inner->HasSideEffects()); sem->Behaviors() = inner->Behaviors(); @@ -1137,220 +1596,440 @@ sem::Expression* Resolver::Bitcast(const ast::BitcastExpression* expr) { } sem::Call* Resolver::Call(const ast::CallExpression* expr) { - std::vector args(expr->args.size()); - std::vector arg_tys(args.size()); + // A CallExpression can resolve to one of: + // * A function call. + // * A builtin call. + // * A type constructor. + // * A type conversion. + + // Resolve all of the arguments, their types and the set of behaviors. + utils::Vector args; + args.Reserve(expr->args.Length()); + auto args_stage = sem::EvaluationStage::kConstant; sem::Behaviors arg_behaviors; - - // The element type of all the arguments. Nullptr if argument types are - // different. - const sem::Type* arg_el_ty = nullptr; - - for (size_t i = 0; i < expr->args.size(); i++) { + for (size_t i = 0; i < expr->args.Length(); i++) { auto* arg = sem_.Get(expr->args[i]); if (!arg) { return nullptr; } - args[i] = arg; - arg_tys[i] = args[i]->Type(); + args.Push(arg); + args_stage = sem::EarliestStage(args_stage, arg->Stage()); arg_behaviors.Add(arg->Behaviors()); - - // Determine the common argument element type - auto* el_ty = arg_tys[i]->UnwrapRef(); - if (auto* vec = el_ty->As()) { - el_ty = vec->type(); - } else if (auto* mat = el_ty->As()) { - el_ty = mat->type(); - } - if (i == 0) { - arg_el_ty = el_ty; - } else if (arg_el_ty != el_ty) { - arg_el_ty = nullptr; - } } - arg_behaviors.Remove(sem::Behavior::kNext); - auto type_ctor_or_conv = [&](const sem::Type* ty) -> sem::Call* { - // The call has resolved to a type constructor or cast. - if (args.size() == 1) { - auto* target = ty; - auto* source = args[0]->Type()->UnwrapRef(); - if ((source != target) && // - ((source->is_scalar() && target->is_scalar()) || - (source->Is() && target->Is()) || - (source->Is() && target->Is()))) { - // Note: Matrix types currently cannot be converted (the element type - // must only be f32). We implement this for the day we support other - // matrix element types. - return TypeConversion(expr, ty, args[0], arg_tys[0]); - } + // Did any arguments have side effects? + bool has_side_effects = + std::any_of(args.begin(), args.end(), [](auto* e) { return e->HasSideEffects(); }); + + // ct_ctor_or_conv is a helper for building either a sem::TypeConstructor or sem::TypeConversion + // call for a CtorConvIntrinsic with an optional template argument type. + auto ct_ctor_or_conv = [&](CtorConvIntrinsic ty, const sem::Type* template_arg) -> sem::Call* { + auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type(); }); + auto ctor_or_conv = intrinsic_table_->Lookup(ty, template_arg, arg_tys, expr->source); + if (!ctor_or_conv.target) { + return nullptr; } - return TypeConstructor(expr, ty, std::move(args), std::move(arg_tys)); - }; - - // Resolve the target of the CallExpression to determine whether this is a - // function call, cast or type constructor expression. - if (expr->target.type) { - const sem::Type* ty = nullptr; - - auto err_cannot_infer_el_ty = [&](std::string name) { - AddError("cannot infer " + name + - " element type, as constructor arguments have different types", - expr->source); - for (size_t i = 0; i < args.size(); i++) { - auto* arg = args[i]; - AddNote("argument " + std::to_string(i) + " has type " + - arg->Type()->FriendlyName(builder_->Symbols()), - arg->Declaration()->source); - } - }; - - if (!expr->args.empty()) { - // vecN() without explicit element type? - // Try to infer element type from args - if (auto* vec = expr->target.type->As()) { - if (!vec->type) { - if (!arg_el_ty) { - err_cannot_infer_el_ty("vector"); - return nullptr; - } - - Mark(vec); - auto* v = - builder_->create(arg_el_ty, static_cast(vec->width)); - if (!validator_.Vector(v, vec->source)) { - return nullptr; - } - builder_->Sem().Add(vec, v); - ty = v; - } - } - - // matNxM() without explicit element type? - // Try to infer element type from args - if (auto* mat = expr->target.type->As()) { - if (!mat->type) { - if (!arg_el_ty) { - err_cannot_infer_el_ty("matrix"); - return nullptr; - } - - Mark(mat); - auto* column_type = builder_->create(arg_el_ty, mat->rows); - auto* m = builder_->create(column_type, mat->columns); - if (!validator_.Matrix(m, mat->source)) { - return nullptr; - } - builder_->Sem().Add(mat, m); - ty = m; - } - } + if (!MaterializeArguments(args, ctor_or_conv.target)) { + return nullptr; } - - if (ty == nullptr) { - ty = Type(expr->target.type); - if (!ty) { + const sem::Constant* value = nullptr; + auto stage = sem::EarliestStage(ctor_or_conv.target->Stage(), args_stage); + if (stage == sem::EvaluationStage::kConstant) { + auto const_args = + utils::Transform(args, [](auto* arg) { return arg->ConstantValue(); }); + if (auto r = (const_eval_.*ctor_or_conv.const_eval_fn)( + ctor_or_conv.target->ReturnType(), const_args, expr->source)) { + value = r.Get(); + } else { return nullptr; } } + return builder_->create(expr, ctor_or_conv.target, stage, std::move(args), + current_statement_, value, has_side_effects); + }; - return type_ctor_or_conv(ty); + // arr_or_str_ctor is a helper for building a sem::TypeConstructor for an array or structure + // constructor call target. + auto arr_or_str_ctor = [&](const sem::Type* ty, + const sem::CallTarget* call_target) -> sem::Call* { + if (!MaterializeArguments(args, call_target)) { + return nullptr; + } + + auto stage = args_stage; // The evaluation stage of the call + const sem::Constant* value = nullptr; // The constant value for the call + if (stage == sem::EvaluationStage::kConstant) { + if (auto r = const_eval_.ArrayOrStructCtor(ty, args)) { + value = r.Get(); + } else { + return nullptr; + } + if (!value) { + // Constant evaluation failed. + // Can happen for expressions that will fail validation (later). + // Use the kRuntime EvaluationStage, as kConstant will trigger an assertion in the + // sem::Expression constructor, which checks that kConstant is paired with a + // constant value. + stage = sem::EvaluationStage::kRuntime; + } + } + + return builder_->create(expr, call_target, stage, std::move(args), + current_statement_, value, has_side_effects); + }; + + // ty_ctor_or_conv is a helper for building either a sem::TypeConstructor or sem::TypeConversion + // call for the given semantic type. + auto ty_ctor_or_conv = [&](const sem::Type* ty) { + return Switch( + ty, // + [&](const sem::Vector* v) { + return ct_ctor_or_conv(VectorCtorConvIntrinsic(v->Width()), v->type()); + }, + [&](const sem::Matrix* m) { + return ct_ctor_or_conv(MatrixCtorConvIntrinsic(m->columns(), m->rows()), m->type()); + }, + [&](const sem::I32*) { return ct_ctor_or_conv(CtorConvIntrinsic::kI32, nullptr); }, + [&](const sem::U32*) { return ct_ctor_or_conv(CtorConvIntrinsic::kU32, nullptr); }, + [&](const sem::F16*) { return ct_ctor_or_conv(CtorConvIntrinsic::kF16, nullptr); }, + [&](const sem::F32*) { return ct_ctor_or_conv(CtorConvIntrinsic::kF32, nullptr); }, + [&](const sem::Bool*) { return ct_ctor_or_conv(CtorConvIntrinsic::kBool, nullptr); }, + [&](const sem::Array* arr) -> sem::Call* { + auto* call_target = utils::GetOrCreate( + array_ctors_, ArrayConstructorSig{{arr, args.Length(), args_stage}}, + [&]() -> sem::TypeConstructor* { + auto params = utils::Transform(args, [&](auto, size_t i) { + return builder_->create( + nullptr, // declaration + static_cast(i), // index + arr->ElemType(), // type + ast::StorageClass::kNone, // storage_class + ast::Access::kUndefined); + }); + return builder_->create(arr, std::move(params), + args_stage); + }); + + auto* call = arr_or_str_ctor(arr, call_target); + if (!call) { + return nullptr; + } + + // Validation must occur after argument materialization in arr_or_str_ctor(). + if (!validator_.ArrayConstructor(expr, arr)) { + return nullptr; + } + return call; + }, + [&](const sem::Struct* str) -> sem::Call* { + auto* call_target = utils::GetOrCreate( + struct_ctors_, StructConstructorSig{{str, args.Length(), args_stage}}, + [&]() -> sem::TypeConstructor* { + utils::Vector params; + params.Resize(std::min(args.Length(), str->Members().size())); + for (size_t i = 0, n = params.Length(); i < n; i++) { + params[i] = builder_->create( + nullptr, // declaration + static_cast(i), // index + str->Members()[i]->Type(), // type + ast::StorageClass::kNone, // storage_class + ast::Access::kUndefined); // access + } + return builder_->create(str, std::move(params), + args_stage); + }); + + auto* call = arr_or_str_ctor(str, call_target); + if (!call) { + return nullptr; + } + + // Validation must occur after argument materialization in arr_or_str_ctor(). + if (!validator_.StructureConstructor(expr, str)) { + return nullptr; + } + return call; + }, + [&](Default) { + AddError("type is not constructible", expr->source); + return nullptr; + }); + }; + + // ast::CallExpression has a target which is either an ast::Type or an ast::IdentifierExpression + sem::Call* call = nullptr; + if (expr->target.type) { + // ast::CallExpression has an ast::Type as the target. + // This call is either a type constructor or type conversion. + call = Switch( + expr->target.type, + [&](const ast::Vector* v) -> sem::Call* { + Mark(v); + // vector element type must be inferred if it was not specified. + sem::Type* template_arg = nullptr; + if (v->type) { + template_arg = Type(v->type); + if (!template_arg) { + return nullptr; + } + } + if (auto* c = ct_ctor_or_conv(VectorCtorConvIntrinsic(v->width), template_arg)) { + builder_->Sem().Add(expr->target.type, c->Target()->ReturnType()); + return c; + } + return nullptr; + }, + [&](const ast::Matrix* m) -> sem::Call* { + Mark(m); + // matrix element type must be inferred if it was not specified. + sem::Type* template_arg = nullptr; + if (m->type) { + template_arg = Type(m->type); + if (!template_arg) { + return nullptr; + } + } + if (auto* c = ct_ctor_or_conv(MatrixCtorConvIntrinsic(m->columns, m->rows), + template_arg)) { + builder_->Sem().Add(expr->target.type, c->Target()->ReturnType()); + return c; + } + return nullptr; + }, + [&](const ast::Array* a) -> sem::Call* { + Mark(a); + // array element type must be inferred if it was not specified. + auto el_count = static_cast(args.Length()); + const sem::Type* el_ty = nullptr; + if (a->type) { + el_ty = Type(a->type); + if (!el_ty) { + return nullptr; + } + if (!a->count) { + AddError("cannot construct a runtime-sized array", expr->source); + return nullptr; + } + if (auto count = ArrayCount(a->count)) { + el_count = count.Get(); + } else { + return nullptr; + } + // Note: validation later will detect any mismatches between explicit array + // size and number of constructor expressions. + } else { + auto arg_tys = + utils::Transform(args, [](auto* arg) { return arg->Type()->UnwrapRef(); }); + el_ty = sem::Type::Common(arg_tys); + if (!el_ty) { + AddError( + "cannot infer common array element type from constructor arguments", + expr->source); + std::unordered_set types; + for (size_t i = 0; i < args.Length(); i++) { + if (types.emplace(args[i]->Type()).second) { + AddNote("argument " + std::to_string(i) + " is of type '" + + sem_.TypeNameOf(args[i]->Type()) + "'", + args[i]->Declaration()->source); + } + } + return nullptr; + } + } + uint32_t explicit_stride = 0; + if (!ArrayAttributes(a->attributes, el_ty, explicit_stride)) { + return nullptr; + } + + auto* arr = Array(a->source, el_ty, el_count, explicit_stride); + if (!arr) { + return nullptr; + } + builder_->Sem().Add(a, arr); + + return ty_ctor_or_conv(arr); + }, + [&](const ast::Type* ast) -> sem::Call* { + // Handler for AST types that do not have an optional element type. + if (auto* ty = Type(ast)) { + return ty_ctor_or_conv(ty); + } + return nullptr; + }, + [&](Default) { + TINT_ICE(Resolver, diagnostics_) + << expr->source << " unhandled CallExpression target:\n" + << "type: " + << (expr->target.type ? expr->target.type->TypeInfo().name : ""); + return nullptr; + }); + } else { + // ast::CallExpression has an ast::IdentifierExpression as the target. + // This call is either a function call, builtin call, type constructor or type conversion. + auto* ident = expr->target.name; + Mark(ident); + auto* resolved = sem_.ResolvedSymbol(ident); + call = Switch( + resolved, // + [&](sem::Type* ty) { + // A type constructor or conversions. + // Note: Unlike the code path where we're resolving the call target from an + // ast::Type, all types must already have the element type explicitly specified, so + // there's no need to infer element types. + return ty_ctor_or_conv(ty); + }, + [&](sem::Function* func) { return FunctionCall(expr, func, args, arg_behaviors); }, + [&](sem::Variable* var) { + auto name = builder_->Symbols().NameFor(var->Declaration()->symbol); + AddError("cannot call variable '" + name + "'", ident->source); + AddNote("'" + name + "' declared here", var->Declaration()->source); + return nullptr; + }, + [&](Default) -> sem::Call* { + auto name = builder_->Symbols().NameFor(ident->symbol); + auto builtin_type = sem::ParseBuiltinType(name); + if (builtin_type != sem::BuiltinType::kNone) { + return BuiltinCall(expr, builtin_type, args); + } + + TINT_ICE(Resolver, diagnostics_) + << expr->source << " unhandled CallExpression target:\n" + << "resolved: " << (resolved ? resolved->TypeInfo().name : "") << "\n" + << "name: " << builder_->Symbols().NameFor(ident->symbol); + return nullptr; + }); } - auto* ident = expr->target.name; - Mark(ident); - - auto* resolved = sem_.ResolvedSymbol(ident); - return Switch( - resolved, // - [&](sem::Type* type) { return type_ctor_or_conv(type); }, - [&](sem::Function* func) { - return FunctionCall(expr, func, std::move(args), arg_behaviors); - }, - [&](sem::Variable* var) { - auto name = builder_->Symbols().NameFor(var->Declaration()->symbol); - AddError("cannot call variable '" + name + "'", ident->source); - AddNote("'" + name + "' declared here", var->Declaration()->source); - return nullptr; - }, - [&](Default) -> sem::Call* { - auto name = builder_->Symbols().NameFor(ident->symbol); - auto builtin_type = sem::ParseBuiltinType(name); - if (builtin_type != sem::BuiltinType::kNone) { - return BuiltinCall(expr, builtin_type, std::move(args), std::move(arg_tys)); - } - - TINT_ICE(Resolver, diagnostics_) - << expr->source << " unresolved CallExpression target:\n" - << "resolved: " << (resolved ? resolved->TypeInfo().name : "") << "\n" - << "name: " << builder_->Symbols().NameFor(ident->symbol); - return nullptr; - }); -} - -sem::Call* Resolver::BuiltinCall(const ast::CallExpression* expr, - sem::BuiltinType builtin_type, - const std::vector args, - const std::vector arg_tys) { - auto* builtin = intrinsic_table_->Lookup(builtin_type, std::move(arg_tys), expr->source); - if (!builtin) { + if (!call) { return nullptr; } - if (builtin->IsDeprecated()) { + return validator_.Call(call, current_statement_) ? call : nullptr; +} + +template +sem::Call* Resolver::BuiltinCall(const ast::CallExpression* expr, + sem::BuiltinType builtin_type, + utils::Vector& args) { + IntrinsicTable::Builtin builtin; + { + auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type(); }); + builtin = intrinsic_table_->Lookup(builtin_type, arg_tys, expr->source); + if (!builtin.sem) { + return nullptr; + } + } + + if (!MaterializeArguments(args, builtin.sem)) { + return nullptr; + } + + if (builtin.sem->IsDeprecated()) { AddWarning("use of deprecated builtin", expr->source); } - bool has_side_effects = - builtin->HasSideEffects() || - std::any_of(args.begin(), args.end(), [](auto* e) { return e->HasSideEffects(); }); - auto* call = builder_->create(expr, builtin, std::move(args), current_statement_, - sem::Constant{}, has_side_effects); + auto stage = builtin.sem->Stage(); + if (stage == sem::EvaluationStage::kConstant) { // <-- Optimization + // If the builtin is not annotated with @const, then it can only be evaluated + // at runtime, in which case there's no point checking the evaluation stage of the + // arguments. - current_function_->AddDirectlyCalledBuiltin(builtin); + // The builtin is @const annotated. Check all arguments are also constant. + for (auto* arg : args) { + stage = sem::EarliestStage(stage, arg->Stage()); + } + } + + // If the builtin is @const, and all arguments have constant values, evaluate the builtin now. + const sem::Constant* value = nullptr; + if (stage == sem::EvaluationStage::kConstant) { + auto const_args = ConvertArguments(args, builtin.sem); + if (!const_args) { + return nullptr; + } + if (auto r = (const_eval_.*builtin.const_eval_fn)(builtin.sem->ReturnType(), + const_args.Get(), expr->source)) { + value = r.Get(); + } else { + return nullptr; + } + } + + bool has_side_effects = + builtin.sem->HasSideEffects() || + std::any_of(args.begin(), args.end(), [](auto* e) { return e->HasSideEffects(); }); + auto* call = builder_->create(expr, builtin.sem, stage, std::move(args), + current_statement_, value, has_side_effects); + + if (current_function_) { + current_function_->AddDirectlyCalledBuiltin(builtin.sem); + current_function_->AddDirectCall(call); + } + + if (!validator_.RequiredExtensionForBuiltinFunction(call, enabled_extensions_)) { + return nullptr; + } if (IsTextureBuiltin(builtin_type)) { if (!validator_.TextureBuiltinFunction(call)) { return nullptr; } - // Collect a texture/sampler pair for this builtin. - const auto& signature = builtin->Signature(); - int texture_index = signature.IndexOf(sem::ParameterUsage::kTexture); - if (texture_index == -1) { - TINT_ICE(Resolver, diagnostics_) << "texture builtin without texture parameter"; - } - - auto* texture = args[texture_index]->As()->Variable(); - if (!texture->Type()->UnwrapRef()->Is()) { - int sampler_index = signature.IndexOf(sem::ParameterUsage::kSampler); - const sem::Variable* sampler = - sampler_index != -1 ? args[sampler_index]->As()->Variable() - : nullptr; - current_function_->AddTextureSamplerPair(texture, sampler); - } + CollectTextureSamplerPairs(builtin.sem, call->Arguments()); } if (!validator_.BuiltinCall(call)) { return nullptr; } - current_function_->AddDirectCall(call); - return call; } +void Resolver::CollectTextureSamplerPairs(const sem::Builtin* builtin, + utils::VectorRef args) const { + // Collect a texture/sampler pair for this builtin. + const auto& signature = builtin->Signature(); + int texture_index = signature.IndexOf(sem::ParameterUsage::kTexture); + if (texture_index == -1) { + TINT_ICE(Resolver, diagnostics_) << "texture builtin without texture parameter"; + } + auto* texture = args[static_cast(texture_index)]->As()->Variable(); + if (!texture->Type()->UnwrapRef()->Is()) { + int sampler_index = signature.IndexOf(sem::ParameterUsage::kSampler); + const sem::Variable* sampler = + sampler_index != -1 + ? args[static_cast(sampler_index)]->As()->Variable() + : nullptr; + current_function_->AddTextureSamplerPair(texture, sampler); + } +} + +template sem::Call* Resolver::FunctionCall(const ast::CallExpression* expr, sem::Function* target, - const std::vector args, + utils::Vector& args, sem::Behaviors arg_behaviors) { auto sym = expr->target.name->symbol; auto name = builder_->Symbols().NameFor(sym); + if (!MaterializeArguments(args, target)) { + return nullptr; + } + // TODO(crbug.com/tint/1420): For now, assume all function calls have side // effects. bool has_side_effects = true; - auto* call = builder_->create(expr, target, std::move(args), current_statement_, - sem::Constant{}, has_side_effects); + auto* call = builder_->create(expr, target, sem::EvaluationStage::kRuntime, + std::move(args), current_statement_, + /* constant_value */ nullptr, has_side_effects); + + target->AddCallSite(call); + + call->Behaviors() = arg_behaviors + target->Behaviors(); + + if (!validator_.FunctionCall(call, current_statement_)) { + return nullptr; + } if (current_function_) { // Note: Requires called functions to be resolved first. @@ -1367,163 +2046,34 @@ sem::Call* Resolver::FunctionCall(const ast::CallExpression* expr, current_function_->AddTransitivelyReferencedGlobal(var); } - // Map all texture/sampler pairs from the target function to the - // current function. These can only be global or parameter - // variables. Resolve any parameter variables to the corresponding - // argument passed to the current function. Leave global variables - // as-is. Then add the mapped pair to the current function's list of - // texture/sampler pairs. - for (sem::VariablePair pair : target->TextureSamplerPairs()) { - const sem::Variable* texture = pair.first; - const sem::Variable* sampler = pair.second; - if (auto* param = texture->As()) { - texture = args[param->Index()]->As()->Variable(); - } - if (sampler) { - if (auto* param = sampler->As()) { - sampler = args[param->Index()]->As()->Variable(); - } - } - current_function_->AddTextureSamplerPair(texture, sampler); - } - } - - target->AddCallSite(call); - - call->Behaviors() = arg_behaviors + target->Behaviors(); - - if (!validator_.FunctionCall(call, current_statement_)) { - return nullptr; + // Note: Validation *must* be performed before calling this method. + CollectTextureSamplerPairs(target, call->Arguments()); } return call; } -sem::Call* Resolver::TypeConversion(const ast::CallExpression* expr, - const sem::Type* target, - const sem::Expression* arg, - const sem::Type* source) { - // It is not valid to have a type-cast call expression inside a call - // statement. - if (IsCallStatement(expr)) { - AddError("type cast evaluated but not used", expr->source); - return nullptr; - } - - auto* call_target = utils::GetOrCreate( - type_conversions_, TypeConversionSig{target, source}, [&]() -> sem::TypeConversion* { - // Now that the argument types have been determined, make sure that - // they obey the conversion rules laid out in - // https://gpuweb.github.io/gpuweb/wgsl/#conversion-expr. - bool ok = Switch( - target, - [&](const sem::Vector* vec_type) { - return validator_.VectorConstructorOrCast(expr, vec_type); - }, - [&](const sem::Matrix* mat_type) { - // Note: Matrix types currently cannot be converted (the element - // type must only be f32). We implement this for the day we - // support other matrix element types. - return validator_.MatrixConstructorOrCast(expr, mat_type); - }, - [&](const sem::Array* arr_type) { - return validator_.ArrayConstructorOrCast(expr, arr_type); - }, - [&](const sem::Struct* struct_type) { - return validator_.StructureConstructorOrCast(expr, struct_type); - }, - [&](Default) { - if (target->is_scalar()) { - return validator_.ScalarConstructorOrCast(expr, target); - } - AddError("type is not constructible", expr->source); - return false; - }); - if (!ok) { - return nullptr; +void Resolver::CollectTextureSamplerPairs(sem::Function* func, + utils::VectorRef args) const { + // Map all texture/sampler pairs from the target function to the + // current function. These can only be global or parameter + // variables. Resolve any parameter variables to the corresponding + // argument passed to the current function. Leave global variables + // as-is. Then add the mapped pair to the current function's list of + // texture/sampler pairs. + for (sem::VariablePair pair : func->TextureSamplerPairs()) { + const sem::Variable* texture = pair.first; + const sem::Variable* sampler = pair.second; + if (auto* param = texture->As()) { + texture = args[param->Index()]->As()->Variable(); + } + if (sampler) { + if (auto* param = sampler->As()) { + sampler = args[param->Index()]->As()->Variable(); } - - auto* param = - builder_->create(nullptr, // declaration - 0, // index - source->UnwrapRef(), // type - ast::StorageClass::kNone, // storage_class - ast::Access::kUndefined); // access - return builder_->create(target, param); - }); - - if (!call_target) { - return nullptr; + } + current_function_->AddTextureSamplerPair(texture, sampler); } - - auto val = EvaluateConstantValue(expr, target); - bool has_side_effects = arg->HasSideEffects(); - return builder_->create(expr, call_target, std::vector{arg}, - current_statement_, val, has_side_effects); -} - -sem::Call* Resolver::TypeConstructor(const ast::CallExpression* expr, - const sem::Type* ty, - const std::vector args, - const std::vector arg_tys) { - // It is not valid to have a type-constructor call expression as a call - // statement. - if (IsCallStatement(expr)) { - AddError("type constructor evaluated but not used", expr->source); - return nullptr; - } - - auto* call_target = utils::GetOrCreate( - type_ctors_, TypeConstructorSig{ty, arg_tys}, [&]() -> sem::TypeConstructor* { - // Now that the argument types have been determined, make sure that - // they obey the constructor type rules laid out in - // https://gpuweb.github.io/gpuweb/wgsl/#type-constructor-expr. - bool ok = Switch( - ty, - [&](const sem::Vector* vec_type) { - return validator_.VectorConstructorOrCast(expr, vec_type); - }, - [&](const sem::Matrix* mat_type) { - return validator_.MatrixConstructorOrCast(expr, mat_type); - }, - [&](const sem::Array* arr_type) { - return validator_.ArrayConstructorOrCast(expr, arr_type); - }, - [&](const sem::Struct* struct_type) { - return validator_.StructureConstructorOrCast(expr, struct_type); - }, - [&](Default) { - if (ty->is_scalar()) { - return validator_.ScalarConstructorOrCast(expr, ty); - } - AddError("type is not constructible", expr->source); - return false; - }); - if (!ok) { - return nullptr; - } - - return builder_->create( - ty, utils::Transform(arg_tys, - [&](const sem::Type* t, size_t i) -> const sem::Parameter* { - return builder_->create( - nullptr, // declaration - static_cast(i), // index - t->UnwrapRef(), // type - ast::StorageClass::kNone, // storage_class - ast::Access::kUndefined); // access - })); - }); - - if (!call_target) { - return nullptr; - } - - auto val = EvaluateConstantValue(expr, ty); - bool has_side_effects = - std::any_of(args.begin(), args.end(), [](auto* e) { return e->HasSideEffects(); }); - return builder_->create(expr, call_target, std::move(args), current_statement_, val, - has_side_effects); } sem::Expression* Resolver::Literal(const ast::LiteralExpression* literal) { @@ -1532,8 +2082,7 @@ sem::Expression* Resolver::Literal(const ast::LiteralExpression* literal) { [&](const ast::IntLiteralExpression* i) -> sem::Type* { switch (i->suffix) { case ast::IntLiteralExpression::Suffix::kNone: - // TODO(crbug.com/tint/1504): This will need to become abstract-int. - // For now, treat as 'i32'. + return builder_->create(); case ast::IntLiteralExpression::Suffix::kI: return builder_->create(); case ast::IntLiteralExpression::Suffix::kU: @@ -1541,7 +2090,17 @@ sem::Expression* Resolver::Literal(const ast::LiteralExpression* literal) { } return nullptr; }, - [&](const ast::FloatLiteralExpression*) { return builder_->create(); }, + [&](const ast::FloatLiteralExpression* f) -> sem::Type* { + switch (f->suffix) { + case ast::FloatLiteralExpression::Suffix::kNone: + return builder_->create(); + case ast::FloatLiteralExpression::Suffix::kF: + return builder_->create(); + case ast::FloatLiteralExpression::Suffix::kH: + return builder_->create(); + } + return nullptr; + }, [&](const ast::BoolLiteralExpression*) { return builder_->create(); }, [&](Default) { return nullptr; }); @@ -1551,16 +2110,27 @@ sem::Expression* Resolver::Literal(const ast::LiteralExpression* literal) { return nullptr; } - auto val = EvaluateConstantValue(literal, ty); - return builder_->create(literal, ty, current_statement_, val, + if ((ty->Is()) && (!enabled_extensions_.Contains(tint::ast::Extension::kF16))) { + AddError("f16 literal used without 'f16' extension enabled", literal->source); + return nullptr; + } + + const sem::Constant* val = nullptr; + if (auto r = const_eval_.Literal(ty, literal)) { + val = r.Get(); + } else { + return nullptr; + } + return builder_->create(literal, ty, sem::EvaluationStage::kConstant, + current_statement_, std::move(val), /* has_side_effects */ false); } sem::Expression* Resolver::Identifier(const ast::IdentifierExpression* expr) { auto symbol = expr->symbol; auto* resolved = sem_.ResolvedSymbol(expr); - if (auto* var = As(resolved)) { - auto* user = builder_->create(expr, current_statement_, var); + if (auto* variable = As(resolved)) { + auto* user = builder_->create(expr, current_statement_, variable); if (current_statement_) { // If identifier is part of a loop continuing block, make sure it @@ -1596,12 +2166,20 @@ sem::Expression* Resolver::Identifier(const ast::IdentifierExpression* expr) { } if (current_function_) { - if (auto* global = var->As()) { + if (auto* global = variable->As()) { current_function_->AddDirectlyReferencedGlobal(global); } + } else if (variable->Declaration()->Is()) { + // Use of a module-scope 'var' outside of a function. + // Note: The spec is currently vague around the rules here. See + // https://github.com/gpuweb/gpuweb/issues/3081. Remove this comment when resolved. + std::string desc = "var '" + builder_->Symbols().NameFor(symbol) + "' "; + AddError(desc + "cannot not be referenced at module-scope", expr->source); + AddNote(desc + "declared here", variable->Declaration()->source); + return nullptr; } - var->AddUser(user); + variable->AddUser(user); return user; } @@ -1630,296 +2208,185 @@ sem::Expression* Resolver::Identifier(const ast::IdentifierExpression* expr) { sem::Expression* Resolver::MemberAccessor(const ast::MemberAccessorExpression* expr) { auto* structure = sem_.TypeOf(expr->structure); auto* storage_ty = structure->UnwrapRef(); - auto* source_var = sem_.Get(expr->structure)->SourceVariable(); + auto* object = sem_.Get(expr->structure); + auto* source_var = object->SourceVariable(); - const sem::Type* ret = nullptr; - std::vector swizzle; + const sem::Type* ty = nullptr; - // Structure may be a side-effecting expression (e.g. function call). - auto* sem_structure = sem_.Get(expr->structure); - bool has_side_effects = sem_structure && sem_structure->HasSideEffects(); + // Object may be a side-effecting expression (e.g. function call). + bool has_side_effects = object && object->HasSideEffects(); - if (auto* str = storage_ty->As()) { - Mark(expr->member); - auto symbol = expr->member->symbol; + return Switch( + storage_ty, // + [&](const sem::Struct* str) -> sem::Expression* { + Mark(expr->member); + auto symbol = expr->member->symbol; - const sem::StructMember* member = nullptr; - for (auto* m : str->Members()) { - if (m->Name() == symbol) { - ret = m->Type(); - member = m; - break; - } - } - - if (ret == nullptr) { - AddError("struct member " + builder_->Symbols().NameFor(symbol) + " not found", - expr->source); - return nullptr; - } - - // If we're extracting from a reference, we return a reference. - if (auto* ref = structure->As()) { - ret = builder_->create(ret, ref->StorageClass(), ref->Access()); - } - - return builder_->create(expr, ret, current_statement_, member, - has_side_effects, source_var); - } - - if (auto* vec = storage_ty->As()) { - Mark(expr->member); - std::string s = builder_->Symbols().NameFor(expr->member->symbol); - auto size = s.size(); - swizzle.reserve(s.size()); - - for (auto c : s) { - switch (c) { - case 'x': - case 'r': - swizzle.emplace_back(0); + const sem::StructMember* member = nullptr; + for (auto* m : str->Members()) { + if (m->Name() == symbol) { + ty = m->Type(); + member = m; break; - case 'y': - case 'g': - swizzle.emplace_back(1); - break; - case 'z': - case 'b': - swizzle.emplace_back(2); - break; - case 'w': - case 'a': - swizzle.emplace_back(3); - break; - default: - AddError("invalid vector swizzle character", - expr->member->source.Begin() + swizzle.size()); - return nullptr; + } } - if (swizzle.back() >= vec->Width()) { - AddError("invalid vector swizzle member", expr->member->source); + if (ty == nullptr) { + AddError("struct member " + builder_->Symbols().NameFor(symbol) + " not found", + expr->source); return nullptr; } - } - if (size < 1 || size > 4) { - AddError("invalid vector swizzle size", expr->member->source); - return nullptr; - } - - // All characters are valid, check if they're being mixed - auto is_rgba = [](char c) { return c == 'r' || c == 'g' || c == 'b' || c == 'a'; }; - auto is_xyzw = [](char c) { return c == 'x' || c == 'y' || c == 'z' || c == 'w'; }; - if (!std::all_of(s.begin(), s.end(), is_rgba) && - !std::all_of(s.begin(), s.end(), is_xyzw)) { - AddError("invalid mixing of vector swizzle characters rgba with xyzw", - expr->member->source); - return nullptr; - } - - if (size == 1) { - // A single element swizzle is just the type of the vector. - ret = vec->type(); // If we're extracting from a reference, we return a reference. if (auto* ref = structure->As()) { - ret = builder_->create(ret, ref->StorageClass(), ref->Access()); + ty = builder_->create(ty, ref->StorageClass(), ref->Access()); } - } else { - // The vector will have a number of components equal to the length of - // the swizzle. - ret = builder_->create(vec->type(), static_cast(size)); - } - return builder_->create(expr, ret, current_statement_, std::move(swizzle), - has_side_effects, source_var); - } - AddError("invalid member accessor expression. Expected vector or struct, got '" + - sem_.TypeNameOf(storage_ty) + "'", - expr->structure->source); - return nullptr; + auto val = const_eval_.MemberAccess(object, member); + if (!val) { + return nullptr; + } + return builder_->create(expr, ty, current_statement_, + val.Get(), object, member, + has_side_effects, source_var); + }, + + [&](const sem::Vector* vec) -> sem::Expression* { + Mark(expr->member); + std::string s = builder_->Symbols().NameFor(expr->member->symbol); + auto size = s.size(); + utils::Vector swizzle; + swizzle.Reserve(s.size()); + + for (auto c : s) { + switch (c) { + case 'x': + case 'r': + swizzle.Push(0u); + break; + case 'y': + case 'g': + swizzle.Push(1u); + break; + case 'z': + case 'b': + swizzle.Push(2u); + break; + case 'w': + case 'a': + swizzle.Push(3u); + break; + default: + AddError("invalid vector swizzle character", + expr->member->source.Begin() + swizzle.Length()); + return nullptr; + } + + if (swizzle.Back() >= vec->Width()) { + AddError("invalid vector swizzle member", expr->member->source); + return nullptr; + } + } + + if (size < 1 || size > 4) { + AddError("invalid vector swizzle size", expr->member->source); + return nullptr; + } + + // All characters are valid, check if they're being mixed + auto is_rgba = [](char c) { return c == 'r' || c == 'g' || c == 'b' || c == 'a'; }; + auto is_xyzw = [](char c) { return c == 'x' || c == 'y' || c == 'z' || c == 'w'; }; + if (!std::all_of(s.begin(), s.end(), is_rgba) && + !std::all_of(s.begin(), s.end(), is_xyzw)) { + AddError("invalid mixing of vector swizzle characters rgba with xyzw", + expr->member->source); + return nullptr; + } + + if (size == 1) { + // A single element swizzle is just the type of the vector. + ty = vec->type(); + // If we're extracting from a reference, we return a reference. + if (auto* ref = structure->As()) { + ty = builder_->create(ty, ref->StorageClass(), ref->Access()); + } + } else { + // The vector will have a number of components equal to the length of + // the swizzle. + ty = builder_->create(vec->type(), static_cast(size)); + } + auto val = const_eval_.Swizzle(ty, object, swizzle); + if (!val) { + return nullptr; + } + return builder_->create(expr, ty, current_statement_, val.Get(), object, + std::move(swizzle), has_side_effects, source_var); + }, + + [&](Default) { + AddError("invalid member accessor expression. Expected vector or struct, got '" + + sem_.TypeNameOf(storage_ty) + "'", + expr->structure->source); + return nullptr; + }); } sem::Expression* Resolver::Binary(const ast::BinaryExpression* expr) { - auto* lhs = sem_.Get(expr->lhs); - auto* rhs = sem_.Get(expr->rhs); + const auto* lhs = sem_.Get(expr->lhs); + const auto* rhs = sem_.Get(expr->rhs); auto* lhs_ty = lhs->Type()->UnwrapRef(); auto* rhs_ty = rhs->Type()->UnwrapRef(); - auto* ty = BinaryOpType(lhs_ty, rhs_ty, expr->op); - if (!ty) { - AddError("Binary expression operand types are invalid for this operation: " + - sem_.TypeNameOf(lhs_ty) + " " + FriendlyName(expr->op) + " " + - sem_.TypeNameOf(rhs_ty), - expr->source); + auto op = intrinsic_table_->Lookup(expr->op, lhs_ty, rhs_ty, expr->source, false); + if (!op.result) { return nullptr; } + if (ShouldMaterializeArgument(op.lhs)) { + lhs = Materialize(lhs, op.lhs); + if (!lhs) { + return nullptr; + } + } + if (ShouldMaterializeArgument(op.rhs)) { + rhs = Materialize(rhs, op.rhs); + if (!rhs) { + return nullptr; + } + } + + const sem::Constant* value = nullptr; + auto stage = sem::EarliestStage(lhs->Stage(), rhs->Stage()); + if (stage == sem::EvaluationStage::kConstant) { + if (op.const_eval_fn) { + auto const_args = utils::Vector{lhs->ConstantValue(), rhs->ConstantValue()}; + // Implicit conversion (e.g. AInt -> AFloat) + if (!Convert(const_args[0], op.lhs, lhs->Declaration()->source)) { + return nullptr; + } + if (!Convert(const_args[1], op.rhs, rhs->Declaration()->source)) { + return nullptr; + } + + if (auto r = (const_eval_.*op.const_eval_fn)(op.result, const_args, expr->source)) { + value = r.Get(); + } else { + return nullptr; + } + } else { + stage = sem::EvaluationStage::kRuntime; + } + } - auto val = EvaluateConstantValue(expr, ty); bool has_side_effects = lhs->HasSideEffects() || rhs->HasSideEffects(); - auto* sem = - builder_->create(expr, ty, current_statement_, val, has_side_effects); + auto* sem = builder_->create(expr, op.result, stage, current_statement_, value, + has_side_effects); sem->Behaviors() = lhs->Behaviors() + rhs->Behaviors(); return sem; } -const sem::Type* Resolver::BinaryOpType(const sem::Type* lhs_ty, - const sem::Type* rhs_ty, - ast::BinaryOp op) { - using Bool = sem::Bool; - using F32 = sem::F32; - using I32 = sem::I32; - using U32 = sem::U32; - using Matrix = sem::Matrix; - using Vector = sem::Vector; - - auto* lhs_vec = lhs_ty->As(); - auto* lhs_vec_elem_type = lhs_vec ? lhs_vec->type() : nullptr; - auto* rhs_vec = rhs_ty->As(); - auto* rhs_vec_elem_type = rhs_vec ? rhs_vec->type() : nullptr; - - const bool matching_vec_elem_types = lhs_vec_elem_type && rhs_vec_elem_type && - (lhs_vec_elem_type == rhs_vec_elem_type) && - (lhs_vec->Width() == rhs_vec->Width()); - - const bool matching_types = matching_vec_elem_types || (lhs_ty == rhs_ty); - - // Binary logical expressions - if (op == ast::BinaryOp::kLogicalAnd || op == ast::BinaryOp::kLogicalOr) { - if (matching_types && lhs_ty->Is()) { - return lhs_ty; - } - } - if (op == ast::BinaryOp::kOr || op == ast::BinaryOp::kAnd) { - if (matching_types && lhs_ty->Is()) { - return lhs_ty; - } - if (matching_types && lhs_vec_elem_type && lhs_vec_elem_type->Is()) { - return lhs_ty; - } - } - - // Arithmetic expressions - if (ast::IsArithmetic(op)) { - // Binary arithmetic expressions over scalars - if (matching_types && lhs_ty->is_numeric_scalar()) { - return lhs_ty; - } - - // Binary arithmetic expressions over vectors - if (matching_types && lhs_vec_elem_type && lhs_vec_elem_type->is_numeric_scalar()) { - return lhs_ty; - } - - // Binary arithmetic expressions with mixed scalar and vector operands - if (lhs_vec_elem_type && (lhs_vec_elem_type == rhs_ty) && rhs_ty->is_numeric_scalar()) { - return lhs_ty; - } - if (rhs_vec_elem_type && (rhs_vec_elem_type == lhs_ty) && lhs_ty->is_numeric_scalar()) { - return rhs_ty; - } - } - - // Matrix arithmetic - auto* lhs_mat = lhs_ty->As(); - auto* lhs_mat_elem_type = lhs_mat ? lhs_mat->type() : nullptr; - auto* rhs_mat = rhs_ty->As(); - auto* rhs_mat_elem_type = rhs_mat ? rhs_mat->type() : nullptr; - // Addition and subtraction of float matrices - if ((op == ast::BinaryOp::kAdd || op == ast::BinaryOp::kSubtract) && lhs_mat_elem_type && - lhs_mat_elem_type->Is() && rhs_mat_elem_type && rhs_mat_elem_type->Is() && - (lhs_mat->columns() == rhs_mat->columns()) && (lhs_mat->rows() == rhs_mat->rows())) { - return rhs_ty; - } - if (op == ast::BinaryOp::kMultiply) { - // Multiplication of a matrix and a scalar - if (lhs_ty->Is() && rhs_mat_elem_type && rhs_mat_elem_type->Is()) { - return rhs_ty; - } - if (lhs_mat_elem_type && lhs_mat_elem_type->Is() && rhs_ty->Is()) { - return lhs_ty; - } - - // Vector times matrix - if (lhs_vec_elem_type && lhs_vec_elem_type->Is() && rhs_mat_elem_type && - rhs_mat_elem_type->Is() && (lhs_vec->Width() == rhs_mat->rows())) { - return builder_->create(lhs_vec->type(), rhs_mat->columns()); - } - - // Matrix times vector - if (lhs_mat_elem_type && lhs_mat_elem_type->Is() && rhs_vec_elem_type && - rhs_vec_elem_type->Is() && (lhs_mat->columns() == rhs_vec->Width())) { - return builder_->create(rhs_vec->type(), lhs_mat->rows()); - } - - // Matrix times matrix - if (lhs_mat_elem_type && lhs_mat_elem_type->Is() && rhs_mat_elem_type && - rhs_mat_elem_type->Is() && (lhs_mat->columns() == rhs_mat->rows())) { - return builder_->create( - builder_->create(lhs_mat_elem_type, lhs_mat->rows()), - rhs_mat->columns()); - } - } - - // Comparison expressions - if (ast::IsComparison(op)) { - if (matching_types) { - // Special case for bools: only == and != - if (lhs_ty->Is() && - (op == ast::BinaryOp::kEqual || op == ast::BinaryOp::kNotEqual)) { - return builder_->create(); - } - - // For the rest, we can compare i32, u32, and f32 - if (lhs_ty->IsAnyOf()) { - return builder_->create(); - } - } - - // Same for vectors - if (matching_vec_elem_types) { - if (lhs_vec_elem_type->Is() && - (op == ast::BinaryOp::kEqual || op == ast::BinaryOp::kNotEqual)) { - return builder_->create(builder_->create(), - lhs_vec->Width()); - } - - if (lhs_vec_elem_type->is_numeric_scalar()) { - return builder_->create(builder_->create(), - lhs_vec->Width()); - } - } - } - - // Binary bitwise operations - if (ast::IsBitwise(op)) { - if (matching_types && lhs_ty->is_integer_scalar_or_vector()) { - return lhs_ty; - } - } - - // Bit shift expressions - if (ast::IsBitshift(op)) { - // Type validation rules are the same for left or right shift, despite - // differences in computation rules (i.e. right shift can be arithmetic or - // logical depending on lhs type). - - if (lhs_ty->IsAnyOf() && rhs_ty->Is()) { - return lhs_ty; - } - - if (lhs_vec_elem_type && lhs_vec_elem_type->IsAnyOf() && rhs_vec_elem_type && - rhs_vec_elem_type->Is()) { - return lhs_ty; - } - } - - return nullptr; -} - sem::Expression* Resolver::UnaryOp(const ast::UnaryOpExpression* unary) { - auto* expr = sem_.Get(unary->expr); + const auto* expr = sem_.Get(unary->expr); auto* expr_ty = expr->Type(); if (!expr_ty) { return nullptr; @@ -1927,40 +2394,10 @@ sem::Expression* Resolver::UnaryOp(const ast::UnaryOpExpression* unary) { const sem::Type* ty = nullptr; const sem::Variable* source_var = nullptr; + const sem::Constant* value = nullptr; + auto stage = sem::EvaluationStage::kRuntime; switch (unary->op) { - case ast::UnaryOp::kNot: - // Result type matches the deref'd inner type. - ty = expr_ty->UnwrapRef(); - if (!ty->Is() && !ty->is_bool_vector()) { - AddError("cannot logical negate expression of type '" + sem_.TypeNameOf(expr_ty), - unary->expr->source); - return nullptr; - } - break; - - case ast::UnaryOp::kComplement: - // Result type matches the deref'd inner type. - ty = expr_ty->UnwrapRef(); - if (!ty->is_integer_scalar_or_vector()) { - AddError( - "cannot bitwise complement expression of type '" + sem_.TypeNameOf(expr_ty), - unary->expr->source); - return nullptr; - } - break; - - case ast::UnaryOp::kNegation: - // Result type matches the deref'd inner type. - ty = expr_ty->UnwrapRef(); - if (!(ty->IsAnyOf() || ty->is_signed_integer_vector() || - ty->is_float_vector())) { - AddError("cannot negate expression of type '" + sem_.TypeNameOf(expr_ty), - unary->expr->source); - return nullptr; - } - break; - case ast::UnaryOp::kAddressOf: if (auto* ref = expr_ty->As()) { if (ref->StoreType()->UnwrapRef()->is_handle()) { @@ -1998,15 +2435,48 @@ sem::Expression* Resolver::UnaryOp(const ast::UnaryOpExpression* unary) { return nullptr; } break; + + default: { + auto op = intrinsic_table_->Lookup(unary->op, expr_ty, unary->source); + if (!op.result) { + return nullptr; + } + if (ShouldMaterializeArgument(op.parameter)) { + expr = Materialize(expr, op.parameter); + if (!expr) { + return nullptr; + } + } + stage = expr->Stage(); + if (stage == sem::EvaluationStage::kConstant) { + if (op.const_eval_fn) { + if (auto r = (const_eval_.*op.const_eval_fn)( + ty, utils::Vector{expr->ConstantValue()}, + expr->Declaration()->source)) { + value = r.Get(); + } else { + return nullptr; + } + } else { + stage = sem::EvaluationStage::kRuntime; + } + } + ty = op.result; + break; + } } - auto val = EvaluateConstantValue(unary, ty); - auto* sem = builder_->create(unary, ty, current_statement_, val, + auto* sem = builder_->create(unary, ty, stage, current_statement_, value, expr->HasSideEffects(), source_var); sem->Behaviors() = expr->Behaviors(); return sem; } +bool Resolver::Enable(const ast::Enable* enable) { + enabled_extensions_.Add(enable->extension); + return true; +} + sem::Type* Resolver::TypeDecl(const ast::TypeDecl* named_type) { sem::Type* result = nullptr; if (auto* alias = named_type->As()) { @@ -2026,130 +2496,128 @@ sem::Type* Resolver::TypeDecl(const ast::TypeDecl* named_type) { } sem::Array* Resolver::Array(const ast::Array* arr) { - auto source = arr->source; - - auto* elem_type = Type(arr->type); - if (!elem_type) { + if (!arr->type) { + AddError("missing array element type", arr->source.End()); return nullptr; } - if (!validator_.IsPlain(elem_type)) { // Check must come before GetDefaultAlignAndSize() - AddError(sem_.TypeNameOf(elem_type) + " cannot be used as an element type of an array", - source); - return nullptr; - } - - uint32_t el_align = elem_type->Align(); - uint32_t el_size = elem_type->Size(); - - if (!validator_.NoDuplicateAttributes(arr->attributes)) { + auto* el_ty = Type(arr->type); + if (!el_ty) { return nullptr; } // Look for explicit stride via @stride(n) attribute uint32_t explicit_stride = 0; - for (auto* attr : arr->attributes) { + if (!ArrayAttributes(arr->attributes, el_ty, explicit_stride)) { + return nullptr; + } + + uint32_t el_count = 0; // sem::Array uses a size of 0 for a runtime-sized array. + + // Evaluate the constant array size expression. + if (auto* count_expr = arr->count) { + if (auto count = ArrayCount(count_expr)) { + el_count = count.Get(); + } else { + return nullptr; + } + } + + auto* out = Array(arr->source, el_ty, el_count, explicit_stride); + if (out == nullptr) { + return nullptr; + } + + if (el_ty->Is()) { + atomic_composite_info_.emplace(out, arr->type->source); + } else { + auto found = atomic_composite_info_.find(el_ty); + if (found != atomic_composite_info_.end()) { + atomic_composite_info_.emplace(out, found->second); + } + } + + return out; +} + +utils::Result Resolver::ArrayCount(const ast::Expression* count_expr) { + // Evaluate the constant array size expression. + const auto* count_sem = Materialize(Expression(count_expr)); + if (!count_sem) { + return utils::Failure; + } + + auto* count_val = count_sem->ConstantValue(); + if (!count_val) { + AddError("array size must evaluate to a constant integer expression", count_expr->source); + return utils::Failure; + } + + if (auto* ty = count_val->Type(); !ty->is_integer_scalar()) { + AddError("array size must evaluate to a constant integer expression, but is type '" + + builder_->FriendlyName(ty) + "'", + count_expr->source); + return utils::Failure; + } + + int64_t count = count_val->As(); + if (count < 1) { + AddError("array size (" + std::to_string(count) + ") must be greater than 0", + count_expr->source); + return utils::Failure; + } + + return static_cast(count); +} + +bool Resolver::ArrayAttributes(utils::VectorRef attributes, + const sem::Type* el_ty, + uint32_t& explicit_stride) { + if (!validator_.NoDuplicateAttributes(attributes)) { + return false; + } + + for (auto* attr : attributes) { Mark(attr); if (auto* sd = attr->As()) { explicit_stride = sd->stride; - if (!validator_.ArrayStrideAttribute(sd, el_size, el_align, source)) { - return nullptr; + if (!validator_.ArrayStrideAttribute(sd, el_ty->Size(), el_ty->Align())) { + return false; } continue; } AddError("attribute is not valid for array types", attr->source); - return nullptr; + return false; } - // Calculate implicit stride - uint64_t implicit_stride = utils::RoundUp(el_align, el_size); + return true; +} +sem::Array* Resolver::Array(const Source& source, + const sem::Type* el_ty, + uint32_t el_count, + uint32_t explicit_stride) { + uint32_t el_align = el_ty->Align(); + uint32_t el_size = el_ty->Size(); + uint64_t implicit_stride = el_size ? utils::RoundUp(el_align, el_size) : 0; uint64_t stride = explicit_stride ? explicit_stride : implicit_stride; - // Evaluate the constant array size expression. - // sem::Array uses a size of 0 for a runtime-sized array. - uint32_t count = 0; - if (auto* count_expr = arr->count) { - auto* count_sem = Expression(count_expr); - if (!count_sem) { - return nullptr; - } - - auto size_source = count_expr->source; - - auto* ty = count_sem->Type()->UnwrapRef(); - if (!ty->is_integer_scalar()) { - AddError("array size must be integer scalar", size_source); - return nullptr; - } - - if (auto* ident = count_expr->As()) { - // Make sure the identifier is a non-overridable module-scope constant. - auto* var = sem_.ResolvedSymbol(ident); - if (!var || !var->Declaration()->is_const) { - AddError("array size identifier must be a module-scope constant", size_source); - return nullptr; - } - if (var->IsOverridable()) { - AddError("array size expression must not be pipeline-overridable", size_source); - return nullptr; - } - - count_expr = var->Declaration()->constructor; - } else if (!count_expr->Is()) { - AddError( - "array size expression must be either a literal or a module-scope " - "constant", - size_source); - return nullptr; - } - - auto count_val = count_sem->ConstantValue(); - if (!count_val) { - TINT_ICE(Resolver, diagnostics_) << "could not resolve array size expression"; - return nullptr; - } - - if (ty->is_signed_integer_scalar() ? count_val.Elements()[0].i32 < 1 - : count_val.Elements()[0].u32 < 1u) { - AddError("array size must be at least 1", size_source); - return nullptr; - } - - count = count_val.Elements()[0].u32; - } - - auto size = std::max(count, 1) * stride; + auto size = std::max(el_count, 1u) * stride; if (size > std::numeric_limits::max()) { std::stringstream msg; - msg << "array size in bytes must not exceed 0x" << std::hex - << std::numeric_limits::max() << ", but is 0x" << std::hex << size; - AddError(msg.str(), arr->source); + msg << "array size (0x" << std::hex << size << ") must not exceed 0xffffffff bytes"; + AddError(msg.str(), source); return nullptr; } - if (stride > std::numeric_limits::max() || - implicit_stride > std::numeric_limits::max()) { - TINT_ICE(Resolver, diagnostics_) << "calculated array stride exceeds uint32"; - return nullptr; - } - auto* out = builder_->create( - elem_type, count, el_align, static_cast(size), static_cast(stride), - static_cast(implicit_stride)); + auto* out = builder_->create(el_ty, el_count, el_align, static_cast(size), + static_cast(stride), + static_cast(implicit_stride)); if (!validator_.Array(out, source)) { return nullptr; } - if (elem_type->Is()) { - atomic_composite_info_.emplace(out, arr->type->source); - } else { - auto found = atomic_composite_info_.find(elem_type); - if (found != atomic_composite_info_.end()) { - atomic_composite_info_.emplace(out, found->second); - } - } - return out; } @@ -2173,7 +2641,7 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) { } sem::StructMemberList sem_members; - sem_members.reserve(str->members.size()); + sem_members.reserve(str->members.Length()); // Calculate the effective size and alignment of each field, and the overall // size of the structure. @@ -2236,11 +2704,26 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) { align = 1; has_offset_attr = true; } else if (auto* a = attr->As()) { - if (a->align <= 0 || !utils::IsPowerOfTwo(a->align)) { + const auto* expr = Expression(a->align); + if (!expr) { + return nullptr; + } + auto* materialized = Materialize(expr); + if (!materialized) { + return nullptr; + } + auto const_value = materialized->ConstantValue(); + if (!const_value) { + AddError("'align' must be constant expression", a->align->source); + return nullptr; + } + auto value = const_value->As(); + + if (value <= 0 || !utils::IsPowerOfTwo(value)) { AddError("align value must be a positive, power-of-two integer", a->source); return nullptr; } - align = a->align; + align = const_value->As(); has_align_attr = true; } else if (auto* s = attr->As()) { if (s->size < size) { @@ -2263,8 +2746,8 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) { offset = utils::RoundUp(align, offset); if (offset > std::numeric_limits::max()) { std::stringstream msg; - msg << "struct member has byte offset 0x" << std::hex << offset - << ", but must not exceed 0x" << std::hex << std::numeric_limits::max(); + msg << "struct member offset (0x" << std::hex << offset << ") must not exceed 0x" + << std::hex << std::numeric_limits::max() << " bytes"; AddError(msg.str(), member->source); return nullptr; } @@ -2285,8 +2768,7 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) { if (struct_size > std::numeric_limits::max()) { std::stringstream msg; - msg << "struct size in bytes must not exceed 0x" << std::hex - << std::numeric_limits::max() << ", but is 0x" << std::hex << struct_size; + msg << "struct size (0x" << std::hex << struct_size << ") must not exceed 0xffffffff bytes"; AddError(msg.str(), str->source); return nullptr; } @@ -2311,6 +2793,8 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) { break; } } + + const_cast(sem_members[i])->SetStruct(out); } auto stage = current_function_ ? current_function_->Declaration()->PipelineStage() @@ -2329,19 +2813,27 @@ sem::Statement* Resolver::ReturnStatement(const ast::ReturnStatement* stmt) { auto& behaviors = current_statement_->Behaviors(); behaviors = sem::Behavior::kReturn; + const sem::Type* value_ty = nullptr; if (auto* value = stmt->value) { - auto* expr = Expression(value); + const auto* expr = Expression(value); if (!expr) { return false; } + if (auto* ret_ty = current_function_->ReturnType(); !ret_ty->Is()) { + expr = Materialize(expr, ret_ty); + if (!expr) { + return false; + } + } behaviors.Add(expr->Behaviors() - sem::Behavior::kNext); + value_ty = expr->Type()->UnwrapRef(); + } else { + value_ty = builder_->create(); } // Validate after processing the return value expression so that its type // is available for validation. - auto* ret_type = - stmt->value ? sem_.TypeOf(stmt->value)->UnwrapRef() : builder_->create(); - return validator_.Return(stmt, current_function_->ReturnType(), ret_type, + return validator_.Return(stmt, current_function_->ReturnType(), value_ty, current_statement_); }); } @@ -2352,19 +2844,52 @@ sem::SwitchStatement* Resolver::SwitchStatement(const ast::SwitchStatement* stmt return StatementScope(stmt, sem, [&] { auto& behaviors = sem->Behaviors(); - auto* cond = Expression(stmt->condition); + const auto* cond = Expression(stmt->condition); if (!cond) { return false; } behaviors = cond->Behaviors() - sem::Behavior::kNext; + auto* cond_ty = cond->Type()->UnwrapRef(); + + utils::Vector types; + types.Push(cond_ty); + + utils::Vector cases; + cases.Reserve(stmt->body.Length()); for (auto* case_stmt : stmt->body) { Mark(case_stmt); auto* c = CaseStatement(case_stmt); if (!c) { return false; } + for (auto* expr : c->Selectors()) { + types.Push(expr->Type()->UnwrapRef()); + } + cases.Push(c); behaviors.Add(c->Behaviors()); + sem->Cases().emplace_back(c); + } + + // Determine the common type across all selectors and the switch expression + // This must materialize to an integer scalar (non-abstract). + auto* common_ty = sem::Type::Common(types); + if (!common_ty || !common_ty->is_integer_scalar()) { + // No common type found or the common type was abstract. + // Pick i32 and let validation deal with any mismatches. + common_ty = builder_->create(); + } + cond = Materialize(cond, common_ty); + if (!cond) { + return false; + } + for (auto* c : cases) { + for (auto*& sel : c->Selectors()) { // Note: pointer reference + sel = Materialize(sel, common_ty); + if (!sel) { + return false; + } + } } if (behaviors.Contains(sem::Behavior::kBreak)) { @@ -2382,8 +2907,8 @@ sem::Statement* Resolver::VariableDeclStatement(const ast::VariableDeclStatement return StatementScope(stmt, sem, [&] { Mark(stmt->variable); - auto* var = Variable(stmt->variable, VariableKind::kLocal); - if (!var) { + auto* variable = Variable(stmt->variable, /* is_global */ false); + if (!variable) { return false; } @@ -2399,11 +2924,11 @@ sem::Statement* Resolver::VariableDeclStatement(const ast::VariableDeclStatement current_block_->AddDecl(stmt->variable); } - if (auto* ctor = var->Constructor()) { + if (auto* ctor = variable->Constructor()) { sem->Behaviors() = ctor->Behaviors(); } - return validator_.Variable(var); + return validator_.LocalVariable(variable); }); } @@ -2416,14 +2941,23 @@ sem::Statement* Resolver::AssignmentStatement(const ast::AssignmentStatement* st return false; } - auto* rhs = Expression(stmt->rhs); + const bool is_phony_assignment = stmt->lhs->Is(); + + const auto* rhs = Expression(stmt->rhs); if (!rhs) { return false; } + if (!is_phony_assignment) { + rhs = Materialize(rhs, lhs->Type()->UnwrapRef()); + if (!rhs) { + return false; + } + } + auto& behaviors = sem->Behaviors(); behaviors = rhs->Behaviors(); - if (!stmt->lhs->Is()) { + if (!is_phony_assignment) { behaviors.Add(lhs->Behaviors()); } @@ -2472,11 +3006,8 @@ sem::Statement* Resolver::CompoundAssignmentStatement( auto* lhs_ty = lhs->Type()->UnwrapRef(); auto* rhs_ty = rhs->Type()->UnwrapRef(); - auto* ty = BinaryOpType(lhs_ty, rhs_ty, stmt->op); + auto* ty = intrinsic_table_->Lookup(stmt->op, lhs_ty, rhs_ty, stmt->source, true).result; if (!ty) { - AddError("compound assignment operand types are invalid: " + sem_.TypeNameOf(lhs_ty) + - " " + FriendlyName(stmt->op) + " " + sem_.TypeNameOf(rhs_ty), - stmt->source); return false; } return validator_.Assignment(stmt, ty); @@ -2550,7 +3081,7 @@ bool Resolver::ApplyStorageClassUsageToType(ast::StorageClass sc, str->AddUsage(sc); for (auto* member : str->Members()) { - if (!ApplyStorageClassUsageToType(sc, member->Type(), usage)) { + if (!ApplyStorageClassUsageToType(sc, const_cast(member->Type()), usage)) { std::stringstream err; err << "while analysing structure member " << sem_.TypeNameOf(str) << "." << builder_->Symbols().NameFor(member->Declaration()->symbol); @@ -2608,7 +3139,9 @@ bool Resolver::Mark(const ast::Node* node) { TINT_ICE(Resolver, diagnostics_) << "Resolver::Mark() called with nullptr"; return false; } - if (marked_.emplace(node).second) { + auto marked_bit_ref = marked_[node->node_id.value]; + if (!marked_bit_ref) { + marked_bit_ref = true; return true; } TINT_ICE(Resolver, diagnostics_) << "AST node '" << node->TypeInfo().name @@ -2635,36 +3168,4 @@ bool Resolver::IsBuiltin(Symbol symbol) const { return sem::ParseBuiltinType(name) != sem::BuiltinType::kNone; } -bool Resolver::IsCallStatement(const ast::Expression* expr) const { - return current_statement_ && - Is(current_statement_->Declaration(), - [&](auto* stmt) { return stmt->expr == expr; }); -} - -//////////////////////////////////////////////////////////////////////////////// -// Resolver::TypeConversionSig -//////////////////////////////////////////////////////////////////////////////// -bool Resolver::TypeConversionSig::operator==(const TypeConversionSig& rhs) const { - return target == rhs.target && source == rhs.source; -} -std::size_t Resolver::TypeConversionSig::Hasher::operator()(const TypeConversionSig& sig) const { - return utils::Hash(sig.target, sig.source); -} - -//////////////////////////////////////////////////////////////////////////////// -// Resolver::TypeConstructorSig -//////////////////////////////////////////////////////////////////////////////// -Resolver::TypeConstructorSig::TypeConstructorSig(const sem::Type* ty, - const std::vector params) - : type(ty), parameters(params) {} -Resolver::TypeConstructorSig::TypeConstructorSig(const TypeConstructorSig&) = default; -Resolver::TypeConstructorSig::~TypeConstructorSig() = default; - -bool Resolver::TypeConstructorSig::operator==(const TypeConstructorSig& rhs) const { - return type == rhs.type && parameters == rhs.parameters; -} -std::size_t Resolver::TypeConstructorSig::Hasher::operator()(const TypeConstructorSig& sig) const { - return utils::Hash(sig.type, sig.parameters); -} - } // namespace tint::resolver diff --git a/src/tint/resolver/resolver.h b/src/tint/resolver/resolver.h index ba90a30133..4c61c47fe0 100644 --- a/src/tint/resolver/resolver.h +++ b/src/tint/resolver/resolver.h @@ -17,12 +17,14 @@ #include #include +#include #include #include #include #include #include "src/tint/program_builder.h" +#include "src/tint/resolver/const_eval.h" #include "src/tint/resolver/dependency_graph.h" #include "src/tint/resolver/intrinsic_table.h" #include "src/tint/resolver/sem_helper.h" @@ -33,6 +35,7 @@ #include "src/tint/sem/constant.h" #include "src/tint/sem/function.h" #include "src/tint/sem/struct.h" +#include "src/tint/utils/bitset.h" #include "src/tint/utils/unique_vector.h" // Forward declarations @@ -52,6 +55,7 @@ class ReturnStatement; class SwitchStatement; class UnaryOpExpression; class Variable; +class WhileStatement; } // namespace tint::ast namespace tint::sem { class Array; @@ -63,8 +67,10 @@ class ForLoopStatement; class IfStatement; class LoopStatement; class Statement; +class StructMember; class SwitchStatement; class TypeConstructor; +class WhileStatement; } // namespace tint::sem namespace tint::resolver { @@ -105,9 +111,6 @@ class Resolver { const Validator* GetValidatorForTesting() const { return &validator_; } private: - /// Describes the context in which a variable is declared - enum class VariableKind { kParameter, kLocal, kGlobal }; - Validator::ValidTypeStorageLayouts valid_type_storage_layouts_; /// Structure holding semantic information about a block (i.e. scope), such as @@ -157,52 +160,88 @@ class Resolver { /// ProgramBuilder. void CreateSemanticNodes() const; - /// Retrieves information for the requested import. - /// @param src the source of the import - /// @param path the import path - /// @param name the method name to get information on - /// @param params the parameters to the method call - /// @param id out parameter for the external call ID. Must not be a nullptr. - /// @returns the return type of `name` in `path` or nullptr on error. - sem::Type* GetImportData(const Source& src, - const std::string& path, - const std::string& name, - const ast::ExpressionList& params, - uint32_t* id); - - ////////////////////////////////////////////////////////////////////////////// - // AST and Type traversal methods - ////////////////////////////////////////////////////////////////////////////// + /// Expression traverses the graph of expressions starting at `expr`, building a postordered + /// list (leaf-first) of all the expression nodes. Each of the expressions are then resolved by + /// dispatching to the appropriate expression handlers below. + /// @returns the resolved semantic node for the expression `expr`, or nullptr on failure. + sem::Expression* Expression(const ast::Expression* expr); + //////////////////////////////////////////////////////////////////////////////////////////////// // Expression resolving methods + // // Returns the semantic node pointer on success, nullptr on failure. + // + // These methods are invoked by Expression(), in postorder (child-first). These methods should + // not attempt to resolve their children. This design avoids recursion, which is a common cause + // of stack-overflows. + //////////////////////////////////////////////////////////////////////////////////////////////// sem::Expression* IndexAccessor(const ast::IndexAccessorExpression*); sem::Expression* Binary(const ast::BinaryExpression*); sem::Expression* Bitcast(const ast::BitcastExpression*); sem::Call* Call(const ast::CallExpression*); - sem::Expression* Expression(const ast::Expression*); sem::Function* Function(const ast::Function*); + template sem::Call* FunctionCall(const ast::CallExpression*, sem::Function* target, - const std::vector args, + utils::Vector& args, sem::Behaviors arg_behaviors); sem::Expression* Identifier(const ast::IdentifierExpression*); + template sem::Call* BuiltinCall(const ast::CallExpression*, sem::BuiltinType, - const std::vector args, - const std::vector arg_tys); + utils::Vector& args); sem::Expression* Literal(const ast::LiteralExpression*); sem::Expression* MemberAccessor(const ast::MemberAccessorExpression*); - sem::Call* TypeConversion(const ast::CallExpression* expr, - const sem::Type* ty, - const sem::Expression* arg, - const sem::Type* arg_ty); - sem::Call* TypeConstructor(const ast::CallExpression* expr, - const sem::Type* ty, - const std::vector args, - const std::vector arg_tys); sem::Expression* UnaryOp(const ast::UnaryOpExpression*); + /// If `expr` is not of an abstract-numeric type, then Materialize() will just return `expr`. + /// If `expr` is of an abstract-numeric type: + /// * Materialize will create and return a sem::Materialize node wrapping `expr`. + /// * The AST -> Sem binding will be updated to point to the new sem::Materialize node. + /// * The sem::Materialize node will have a new concrete type, which will be `target_type` if + /// not nullptr, otherwise: + /// * a type with the element type of `i32` (e.g. `i32`, `vec2`) if `expr` has a + /// element type of abstract-integer... + /// * ... or a type with the element type of `f32` (e.g. `f32`, vec3`, `mat2x3`) + /// if `expr` has a element type of abstract-float. + /// * The sem::Materialize constant value will be the value of `expr` value-converted to the + /// materialized type. + /// If `expr` is nullptr, then Materialize() will also return nullptr. + const sem::Expression* Materialize(const sem::Expression* expr, + const sem::Type* target_type = nullptr); + + /// Materializes all the arguments in `args` to the parameter types of `target`. + /// @returns true on success, false on failure. + template + bool MaterializeArguments(utils::Vector& args, + const sem::CallTarget* target); + + /// @returns true if an argument of an abstract numeric type, passed to a parameter of type + /// `parameter_ty` should be materialized. + bool ShouldMaterializeArgument(const sem::Type* parameter_ty) const; + + /// Converts `c` to `target_ty` + /// @returns true on success, false on failure. + bool Convert(const sem::Constant*& c, const sem::Type* target_ty, const Source& source); + + /// Transforms `args` to a vector of constants, and converts each constant to the call target's + /// parameter type. + /// @returns the vector of constants, `utils::Failure` on failure. + template + utils::Result> ConvertArguments( + const utils::Vector& args, + const sem::CallTarget* target); + + /// @param ty the type that may hold abstract numeric types + /// @param target_ty the target type for the expression (variable type, parameter type, etc). + /// May be nullptr. + /// @param source the source of the expression requiring materialization + /// @returns the concrete (materialized) type for the given type, or nullptr if the type is + /// already concrete. + const sem::Type* ConcreteType(const sem::Type* ty, + const sem::Type* target_ty, + const Source& source); + // Statement resolving methods // Each return true on success, false on failure. sem::Statement* AssignmentStatement(const ast::AssignmentStatement*); @@ -215,6 +254,7 @@ class Resolver { sem::Statement* DiscardStatement(const ast::DiscardStatement*); sem::Statement* FallthroughStatement(const ast::FallthroughStatement*); sem::ForLoopStatement* ForLoopStatement(const ast::ForLoopStatement*); + sem::WhileStatement* WhileStatement(const ast::WhileStatement*); sem::GlobalVariable* GlobalVariable(const ast::Variable*); sem::Statement* Parameter(const ast::Variable*); sem::IfStatement* IfStatement(const ast::IfStatement*); @@ -222,15 +262,17 @@ class Resolver { sem::LoopStatement* LoopStatement(const ast::LoopStatement*); sem::Statement* ReturnStatement(const ast::ReturnStatement*); sem::Statement* Statement(const ast::Statement*); + sem::Statement* StaticAssert(const ast::StaticAssert*); sem::SwitchStatement* SwitchStatement(const ast::SwitchStatement* s); sem::Statement* VariableDeclStatement(const ast::VariableDeclStatement*); - bool Statements(const ast::StatementList&); + bool Statements(utils::VectorRef); - // Resolve the result type of a binary operator. - // Returns nullptr if the types are not valid for this operator. - const sem::Type* BinaryOpType(const sem::Type* lhs_ty, - const sem::Type* rhs_ty, - ast::BinaryOp op); + // CollectTextureSamplerPairs() collects all the texture/sampler pairs from the target function + // / builtin, and records these on the current function by calling AddTextureSamplerPair(). + void CollectTextureSamplerPairs(sem::Function* func, + utils::VectorRef args) const; + void CollectTextureSamplerPairs(const sem::Builtin* builtin, + utils::VectorRef args) const; /// Resolves the WorkgroupSize for the given function, assigning it to /// current_function_ @@ -242,18 +284,46 @@ class Resolver { /// @param ty the ast::Type sem::Type* Type(const ast::Type* ty); + /// @param enable the enable declaration + /// @returns the resolved extension + bool Enable(const ast::Enable* enable); + /// @param named_type the named type to resolve /// @returns the resolved semantic type sem::Type* TypeDecl(const ast::TypeDecl* named_type); - /// Builds and returns the semantic information for the array `arr`. - /// This method does not mark the ast::Array node, nor attach the generated - /// semantic information to the AST node. - /// @returns the semantic Array information, or nullptr if an error is - /// raised. + /// Builds and returns the semantic information for the AST array `arr`. + /// This method does not mark the ast::Array node, nor attach the generated semantic information + /// to the AST node. + /// @returns the semantic Array information, or nullptr if an error is raised. /// @param arr the Array to get semantic information for sem::Array* Array(const ast::Array* arr); + /// Resolves and validates the expression used as the count parameter of an array. + /// @param count_expr the expression used as the second template parameter to an array<>. + /// @returns the number of elements in the array. + utils::Result ArrayCount(const ast::Expression* count_expr); + + /// Resolves and validates the attributes on an array. + /// @param attributes the attributes on the array type. + /// @param el_ty the element type of the array. + /// @param explicit_stride assigned the specified stride of the array in bytes. + /// @returns true on success, false on failure + bool ArrayAttributes(utils::VectorRef attributes, + const sem::Type* el_ty, + uint32_t& explicit_stride); + + /// Builds and returns the semantic information for an array. + /// @returns the semantic Array information, or nullptr if an error is raised. + /// @param source the source of the array declaration + /// @param el_ty the Array element type + /// @param el_count the number of elements in the array. Zero means runtime-sized. + /// @param explicit_stride the explicit byte stride of the array. Zero means implicit stride. + sem::Array* Array(const Source& source, + const sem::Type* el_ty, + uint32_t el_count, + uint32_t explicit_stride); + /// Builds and returns the semantic information for the alias `alias`. /// This method does not mark the ast::Alias node, nor attach the generated /// semantic information to the AST node. @@ -267,14 +337,51 @@ class Resolver { /// raised. sem::Struct* Structure(const ast::Struct* str); - /// @returns the semantic info for the variable `var`. If an error is - /// raised, nullptr is returned. - /// @note this method does not resolve the attributes as these are - /// context-dependent (global, local, parameter) - /// @param var the variable to create or return the `VariableInfo` for - /// @param kind what kind of variable we are declaring - /// @param index the index of the parameter, if this variable is a parameter - sem::Variable* Variable(const ast::Variable* var, VariableKind kind, uint32_t index = 0); + /// @returns the semantic info for the variable `v`. If an error is raised, nullptr is + /// returned. + /// @note this method does not resolve the attributes as these are context-dependent (global, + /// local) + /// @param var the variable + /// @param is_global true if this is module scope, otherwise function scope + sem::Variable* Variable(const ast::Variable* var, bool is_global); + + /// @returns the semantic info for the `ast::Let` `v`. If an error is raised, nullptr is + /// returned. + /// @note this method does not resolve the attributes as these are context-dependent (global, + /// local) + /// @param var the variable + /// @param is_global true if this is module scope, otherwise function scope + sem::Variable* Let(const ast::Let* var, bool is_global); + + /// @returns the semantic info for the module-scope `ast::Override` `v`. If an error is raised, + /// nullptr is returned. + /// @note this method does not resolve the attributes as these are context-dependent (global, + /// local) + /// @param override the variable + sem::Variable* Override(const ast::Override* override); + + /// @returns the semantic info for an `ast::Const` `v`. If an error is raised, nullptr is + /// returned. + /// @note this method does not resolve the attributes as these are context-dependent (global, + /// local) + /// @param const_ the variable + /// @param is_global true if this is module scope, otherwise function scope + sem::Variable* Const(const ast::Const* const_, bool is_global); + + /// @returns the semantic info for the `ast::Var` `var`. If an error is raised, nullptr is + /// returned. + /// @note this method does not resolve the attributes as these are context-dependent (global, + /// local) + /// @param var the variable + /// @param is_global true if this is module scope, otherwise function scope + sem::Variable* Var(const ast::Var* var, bool is_global); + + /// @returns the semantic info for the function parameter `param`. If an error is raised, + /// nullptr is returned. + /// @note the caller is expected to validate the parameter + /// @param param the AST parameter + /// @param index the index of the parameter + sem::Parameter* Parameter(const ast::Parameter* param, uint32_t index); /// Records the storage class usage for the given type, and any transient /// dependencies of the type. Validates that the type can be used for the @@ -292,7 +399,8 @@ class Resolver { ast::Access DefaultAccessForStorageClass(ast::StorageClass storage_class); /// Allocate constant IDs for pipeline-overridable constants. - void AllocateOverridableConstantIds(); + /// @returns true on success, false on error + bool AllocateOverridableConstantIds(); /// Set the shadowing information on variable declarations. /// @note this method must only be called after all semantic nodes are built. @@ -327,69 +435,34 @@ class Resolver { /// Adds the given note message to the diagnostics void AddNote(const std::string& msg, const Source& source) const; - ////////////////////////////////////////////////////////////////////////////// - /// Constant value evaluation methods - ////////////////////////////////////////////////////////////////////////////// - /// Cast `Value` to `target_type` - /// @return the casted value - sem::Constant ConstantCast(const sem::Constant& value, const sem::Type* target_elem_type); - - sem::Constant EvaluateConstantValue(const ast::Expression* expr, const sem::Type* type); - sem::Constant EvaluateConstantValue(const ast::LiteralExpression* literal, - const sem::Type* type); - sem::Constant EvaluateConstantValue(const ast::CallExpression* call, const sem::Type* type); - /// @returns true if the symbol is the name of a builtin function. bool IsBuiltin(Symbol) const; - /// @returns true if `expr` is the current CallStatement's CallExpression - bool IsCallStatement(const ast::Expression* expr) const; + // ArrayConstructorSig represents a unique array constructor signature. + // It is a tuple of the array type, number of arguments provided and earliest evaluation stage. + using ArrayConstructorSig = + utils::UnorderedKeyWrapper>; - struct TypeConversionSig { - const sem::Type* target; - const sem::Type* source; - - bool operator==(const TypeConversionSig&) const; - - /// Hasher provides a hash function for the TypeConversionSig - struct Hasher { - /// @param sig the TypeConversionSig to create a hash for - /// @return the hash value - std::size_t operator()(const TypeConversionSig& sig) const; - }; - }; - - struct TypeConstructorSig { - const sem::Type* type; - const std::vector parameters; - - TypeConstructorSig(const sem::Type* ty, const std::vector params); - TypeConstructorSig(const TypeConstructorSig&); - ~TypeConstructorSig(); - bool operator==(const TypeConstructorSig&) const; - - /// Hasher provides a hash function for the TypeConstructorSig - struct Hasher { - /// @param sig the TypeConstructorSig to create a hash for - /// @return the hash value - std::size_t operator()(const TypeConstructorSig& sig) const; - }; - }; + // StructConstructorSig represents a unique structure constructor signature. + // It is a tuple of the structure type, number of arguments provided and earliest evaluation + // stage. + using StructConstructorSig = + utils::UnorderedKeyWrapper>; ProgramBuilder* const builder_; diag::List& diagnostics_; + ConstEval const_eval_; std::unique_ptr const intrinsic_table_; DependencyGraph dependencies_; SemHelper sem_; Validator validator_; + ast::Extensions enabled_extensions_; std::vector entry_points_; std::unordered_map atomic_composite_info_; - std::unordered_set marked_; - std::unordered_map constant_ids_; - std::unordered_map - type_conversions_; - std::unordered_map - type_ctors_; + utils::Bitset<0> marked_; + std::unordered_map override_ids_; + std::unordered_map array_ctors_; + std::unordered_map struct_ctors_; sem::Function* current_function_ = nullptr; sem::Statement* current_statement_ = nullptr; diff --git a/src/tint/resolver/resolver_behavior_test.cc b/src/tint/resolver/resolver_behavior_test.cc index 9cb26dc974..43f0bf1660 100644 --- a/src/tint/resolver/resolver_behavior_test.cc +++ b/src/tint/resolver/resolver_behavior_test.cc @@ -19,6 +19,8 @@ #include "src/tint/sem/expression.h" #include "src/tint/sem/for_loop_statement.h" #include "src/tint/sem/if_statement.h" +#include "src/tint/sem/switch_statement.h" +#include "src/tint/sem/while_statement.h" using namespace tint::number_suffixes; // NOLINT @@ -31,8 +33,8 @@ class ResolverBehaviorTest : public ResolverTest { // Create a function called 'DiscardOrNext' which returns an i32, and has // the behavior of {Discard, Return}, which when called, will have the // behavior {Discard, Next}. - Func("DiscardOrNext", {}, ty.i32(), - { + Func("DiscardOrNext", utils::Empty, ty.i32(), + utils::Vector{ If(true, Block(Discard())), Return(1_i), }); @@ -70,8 +72,8 @@ TEST_F(ResolverBehaviorTest, ExprBitcastOp) { } TEST_F(ResolverBehaviorTest, ExprIndex_Arr) { - Func("ArrayDiscardOrNext", {}, ty.array(), - { + Func("ArrayDiscardOrNext", utils::Empty, ty.array(), + utils::Vector{ If(true, Block(Discard())), Return(Construct(ty.array())), }); @@ -163,7 +165,7 @@ TEST_F(ResolverBehaviorTest, StmtBlockSingleStmt) { } TEST_F(ResolverBehaviorTest, StmtCallReturn) { - Func("f", {}, ty.void_(), {Return()}); + Func("f", utils::Empty, ty.void_(), utils::Vector{Return()}); auto* stmt = CallStmt(Call("f")); WrapInFunction(stmt); @@ -174,7 +176,7 @@ TEST_F(ResolverBehaviorTest, StmtCallReturn) { } TEST_F(ResolverBehaviorTest, StmtCallFuncDiscard) { - Func("f", {}, ty.void_(), {Discard()}); + Func("f", utils::Empty, ty.void_(), utils::Vector{Discard()}); auto* stmt = CallStmt(Call("f")); WrapInFunction(stmt); @@ -313,6 +315,56 @@ TEST_F(ResolverBehaviorTest, StmtForLoopEmpty_CondCallFuncMayDiscard) { EXPECT_EQ(sem->Behaviors(), sem::Behaviors(sem::Behavior::kDiscard, sem::Behavior::kNext)); } +TEST_F(ResolverBehaviorTest, StmtWhileBreak) { + auto* stmt = While(Expr(true), Block(Break())); + WrapInFunction(stmt); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(stmt); + EXPECT_EQ(sem->Behaviors(), sem::Behavior::kNext); +} + +TEST_F(ResolverBehaviorTest, StmtWhileDiscard) { + auto* stmt = While(Expr(true), Block(Discard())); + WrapInFunction(stmt); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(stmt); + EXPECT_EQ(sem->Behaviors(), sem::Behaviors(sem::Behavior::kDiscard, sem::Behavior::kNext)); +} + +TEST_F(ResolverBehaviorTest, StmtWhileReturn) { + auto* stmt = While(Expr(true), Block(Return())); + WrapInFunction(stmt); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(stmt); + EXPECT_EQ(sem->Behaviors(), sem::Behaviors(sem::Behavior::kReturn, sem::Behavior::kNext)); +} + +TEST_F(ResolverBehaviorTest, StmtWhileEmpty_CondTrue) { + auto* stmt = While(Expr(true), Block()); + WrapInFunction(stmt); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(stmt); + EXPECT_EQ(sem->Behaviors(), sem::Behaviors(sem::Behavior::kNext)); +} + +TEST_F(ResolverBehaviorTest, StmtWhileEmpty_CondCallFuncMayDiscard) { + auto* stmt = While(Equal(Call("DiscardOrNext"), 1_i), Block()); + WrapInFunction(stmt); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = Sem().Get(stmt); + EXPECT_EQ(sem->Behaviors(), sem::Behaviors(sem::Behavior::kDiscard, sem::Behavior::kNext)); +} + TEST_F(ResolverBehaviorTest, StmtIfTrue_ThenEmptyBlock) { auto* stmt = If(true, Block()); WrapInFunction(stmt); @@ -470,7 +522,7 @@ TEST_F(ResolverBehaviorTest, StmtReturn) { TEST_F(ResolverBehaviorTest, StmtReturn_DiscardOrNext) { auto* stmt = Return(Call("DiscardOrNext")); - Func("F", {}, ty.i32(), {stmt}); + Func("F", utils::Empty, ty.i32(), utils::Vector{stmt}); ASSERT_TRUE(r()->Resolve()) << r()->error(); diff --git a/src/tint/resolver/resolver_constants.cc b/src/tint/resolver/resolver_constants.cc deleted file mode 100644 index f5346d18a6..0000000000 --- a/src/tint/resolver/resolver_constants.cc +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/resolver/resolver.h" - -#include "src/tint/sem/constant.h" -#include "src/tint/sem/type_constructor.h" -#include "src/tint/utils/map.h" - -using namespace tint::number_suffixes; // NOLINT - -namespace tint::resolver { - -sem::Constant Resolver::EvaluateConstantValue(const ast::Expression* expr, const sem::Type* type) { - if (auto* e = expr->As()) { - return EvaluateConstantValue(e, type); - } - if (auto* e = expr->As()) { - return EvaluateConstantValue(e, type); - } - return {}; -} - -sem::Constant Resolver::EvaluateConstantValue(const ast::LiteralExpression* literal, - const sem::Type* type) { - return Switch( - literal, - [&](const ast::IntLiteralExpression* lit) { - if (lit->suffix == ast::IntLiteralExpression::Suffix::kU) { - return sem::Constant{type, {u32(static_cast(lit->value))}}; - } - return sem::Constant{type, {i32(static_cast(lit->value))}}; - }, - [&](const ast::FloatLiteralExpression* lit) { - return sem::Constant{type, {lit->value}}; - }, - [&](const ast::BoolLiteralExpression* lit) { - return sem::Constant{type, {lit->value}}; - }); -} - -sem::Constant Resolver::EvaluateConstantValue(const ast::CallExpression* call, - const sem::Type* type) { - auto* vec = type->As(); - - // For now, only fold scalars and vectors - if (!type->is_scalar() && !vec) { - return {}; - } - - auto* elem_type = vec ? vec->type() : type; - int result_size = vec ? static_cast(vec->Width()) : 1; - - // For zero value init, return 0s - if (call->args.empty()) { - if (elem_type->Is()) { - return sem::Constant(type, sem::Constant::Scalars(result_size, 0_i)); - } - if (elem_type->Is()) { - return sem::Constant(type, sem::Constant::Scalars(result_size, 0_u)); - } - if (elem_type->Is()) { - return sem::Constant(type, sem::Constant::Scalars(result_size, 0.f)); - } - if (elem_type->Is()) { - return sem::Constant(type, sem::Constant::Scalars(result_size, false)); - } - } - - // Build value for type_ctor from each child value by casting to - // type_ctor's type. - sem::Constant::Scalars elems; - for (auto* expr : call->args) { - auto* arg = builder_->Sem().Get(expr); - if (!arg || !arg->ConstantValue()) { - return {}; - } - auto cast = ConstantCast(arg->ConstantValue(), elem_type); - elems.insert(elems.end(), cast.Elements().begin(), cast.Elements().end()); - } - - // Splat single-value initializers - if (elems.size() == 1) { - for (int i = 0; i < result_size - 1; ++i) { - elems.emplace_back(elems[0]); - } - } - - return sem::Constant(type, std::move(elems)); -} - -sem::Constant Resolver::ConstantCast(const sem::Constant& value, - const sem::Type* target_elem_type) { - if (value.ElementType() == target_elem_type) { - return value; - } - - sem::Constant::Scalars elems; - for (size_t i = 0; i < value.Elements().size(); ++i) { - elems.emplace_back(Switch( - target_elem_type, - [&](const sem::I32*) { - return value.WithScalarAt(i, [](auto&& s) { // - return i32(static_cast(s)); - }); - }, - [&](const sem::U32*) { - return value.WithScalarAt(i, [](auto&& s) { // - return u32(static_cast(s)); - }); - }, - [&](const sem::F32*) { - return value.WithScalarAt(i, [](auto&& s) { // - return static_cast(s); - }); - }, - [&](const sem::Bool*) { - return value.WithScalarAt(i, [](auto&& s) { // - return static_cast(s); - }); - }, - [&](Default) { - diag::List diags; - TINT_UNREACHABLE(Semantic, diags) - << "invalid element type " << target_elem_type->TypeInfo().name; - return sem::Constant::Scalar(false); - })); - } - - auto* target_type = - value.Type()->Is() - ? builder_->create(target_elem_type, static_cast(elems.size())) - : target_elem_type; - - return sem::Constant(target_type, elems); -} - -} // namespace tint::resolver diff --git a/src/tint/resolver/resolver_constants_test.cc b/src/tint/resolver/resolver_constants_test.cc deleted file mode 100644 index 798de0a3ac..0000000000 --- a/src/tint/resolver/resolver_constants_test.cc +++ /dev/null @@ -1,433 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/resolver/resolver.h" - -#include "gtest/gtest.h" -#include "src/tint/resolver/resolver_test_helper.h" -#include "src/tint/sem/expression.h" - -using namespace tint::number_suffixes; // NOLINT - -namespace tint::resolver { -namespace { - -using Scalar = sem::Constant::Scalar; - -using ResolverConstantsTest = ResolverTest; - -TEST_F(ResolverConstantsTest, Scalar_i32) { - auto* expr = Expr(99_i); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - EXPECT_TRUE(sem->Type()->Is()); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_EQ(sem->ConstantValue().ElementType(), sem->Type()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 1u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].i32, 99); -} - -TEST_F(ResolverConstantsTest, Scalar_u32) { - auto* expr = Expr(99_u); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - EXPECT_TRUE(sem->Type()->Is()); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_EQ(sem->ConstantValue().ElementType(), sem->Type()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 1u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].u32, 99u); -} - -TEST_F(ResolverConstantsTest, Scalar_f32) { - auto* expr = Expr(9.9f); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - EXPECT_TRUE(sem->Type()->Is()); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_EQ(sem->ConstantValue().ElementType(), sem->Type()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 1u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].f32, 9.9f); -} - -TEST_F(ResolverConstantsTest, Scalar_bool) { - auto* expr = Expr(true); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - EXPECT_TRUE(sem->Type()->Is()); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_EQ(sem->ConstantValue().ElementType(), sem->Type()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 1u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].bool_, true); -} - -TEST_F(ResolverConstantsTest, Vec3_ZeroInit_i32) { - auto* expr = vec3(); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].i32, 0); - EXPECT_EQ(sem->ConstantValue().Elements()[1].i32, 0); - EXPECT_EQ(sem->ConstantValue().Elements()[2].i32, 0); -} - -TEST_F(ResolverConstantsTest, Vec3_ZeroInit_u32) { - auto* expr = vec3(); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].u32, 0u); - EXPECT_EQ(sem->ConstantValue().Elements()[1].u32, 0u); - EXPECT_EQ(sem->ConstantValue().Elements()[2].u32, 0u); -} - -TEST_F(ResolverConstantsTest, Vec3_ZeroInit_f32) { - auto* expr = vec3(); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].f32, 0u); - EXPECT_EQ(sem->ConstantValue().Elements()[1].f32, 0u); - EXPECT_EQ(sem->ConstantValue().Elements()[2].f32, 0u); -} - -TEST_F(ResolverConstantsTest, Vec3_ZeroInit_bool) { - auto* expr = vec3(); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].bool_, false); - EXPECT_EQ(sem->ConstantValue().Elements()[1].bool_, false); - EXPECT_EQ(sem->ConstantValue().Elements()[2].bool_, false); -} - -TEST_F(ResolverConstantsTest, Vec3_Splat_i32) { - auto* expr = vec3(99_i); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].i32, 99); - EXPECT_EQ(sem->ConstantValue().Elements()[1].i32, 99); - EXPECT_EQ(sem->ConstantValue().Elements()[2].i32, 99); -} - -TEST_F(ResolverConstantsTest, Vec3_Splat_u32) { - auto* expr = vec3(99_u); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].u32, 99u); - EXPECT_EQ(sem->ConstantValue().Elements()[1].u32, 99u); - EXPECT_EQ(sem->ConstantValue().Elements()[2].u32, 99u); -} - -TEST_F(ResolverConstantsTest, Vec3_Splat_f32) { - auto* expr = vec3(9.9f); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].f32, 9.9f); - EXPECT_EQ(sem->ConstantValue().Elements()[1].f32, 9.9f); - EXPECT_EQ(sem->ConstantValue().Elements()[2].f32, 9.9f); -} - -TEST_F(ResolverConstantsTest, Vec3_Splat_bool) { - auto* expr = vec3(true); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].bool_, true); - EXPECT_EQ(sem->ConstantValue().Elements()[1].bool_, true); - EXPECT_EQ(sem->ConstantValue().Elements()[2].bool_, true); -} - -TEST_F(ResolverConstantsTest, Vec3_FullConstruct_i32) { - auto* expr = vec3(1_i, 2_i, 3_i); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].i32, 1); - EXPECT_EQ(sem->ConstantValue().Elements()[1].i32, 2); - EXPECT_EQ(sem->ConstantValue().Elements()[2].i32, 3); -} - -TEST_F(ResolverConstantsTest, Vec3_FullConstruct_u32) { - auto* expr = vec3(1_u, 2_u, 3_u); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].u32, 1u); - EXPECT_EQ(sem->ConstantValue().Elements()[1].u32, 2u); - EXPECT_EQ(sem->ConstantValue().Elements()[2].u32, 3u); -} - -TEST_F(ResolverConstantsTest, Vec3_FullConstruct_f32) { - auto* expr = vec3(1.f, 2.f, 3.f); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].f32, 1.f); - EXPECT_EQ(sem->ConstantValue().Elements()[1].f32, 2.f); - EXPECT_EQ(sem->ConstantValue().Elements()[2].f32, 3.f); -} - -TEST_F(ResolverConstantsTest, Vec3_FullConstruct_bool) { - auto* expr = vec3(true, false, true); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].bool_, true); - EXPECT_EQ(sem->ConstantValue().Elements()[1].bool_, false); - EXPECT_EQ(sem->ConstantValue().Elements()[2].bool_, true); -} - -TEST_F(ResolverConstantsTest, Vec3_MixConstruct_i32) { - auto* expr = vec3(1_i, vec2(2_i, 3_i)); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].i32, 1); - EXPECT_EQ(sem->ConstantValue().Elements()[1].i32, 2); - EXPECT_EQ(sem->ConstantValue().Elements()[2].i32, 3); -} - -TEST_F(ResolverConstantsTest, Vec3_MixConstruct_u32) { - auto* expr = vec3(vec2(1_u, 2_u), 3_u); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].u32, 1u); - EXPECT_EQ(sem->ConstantValue().Elements()[1].u32, 2u); - EXPECT_EQ(sem->ConstantValue().Elements()[2].u32, 3u); -} - -TEST_F(ResolverConstantsTest, Vec3_MixConstruct_f32) { - auto* expr = vec3(1.f, vec2(2.f, 3.f)); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].f32, 1.f); - EXPECT_EQ(sem->ConstantValue().Elements()[1].f32, 2.f); - EXPECT_EQ(sem->ConstantValue().Elements()[2].f32, 3.f); -} - -TEST_F(ResolverConstantsTest, Vec3_MixConstruct_bool) { - auto* expr = vec3(vec2(true, false), true); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].bool_, true); - EXPECT_EQ(sem->ConstantValue().Elements()[1].bool_, false); - EXPECT_EQ(sem->ConstantValue().Elements()[2].bool_, true); -} - -TEST_F(ResolverConstantsTest, Vec3_Cast_f32_to_32) { - auto* expr = vec3(vec3(1.1f, 2.2f, 3.3f)); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].i32, 1); - EXPECT_EQ(sem->ConstantValue().Elements()[1].i32, 2); - EXPECT_EQ(sem->ConstantValue().Elements()[2].i32, 3); -} - -TEST_F(ResolverConstantsTest, Vec3_Cast_u32_to_f32) { - auto* expr = vec3(vec3(10_u, 20_u, 30_u)); - WrapInFunction(expr); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); - - auto* sem = Sem().Get(expr); - EXPECT_NE(sem, nullptr); - ASSERT_TRUE(sem->Type()->Is()); - EXPECT_TRUE(sem->Type()->As()->type()->Is()); - EXPECT_EQ(sem->Type()->As()->Width(), 3u); - EXPECT_EQ(sem->ConstantValue().Type(), sem->Type()); - EXPECT_TRUE(sem->ConstantValue().ElementType()->Is()); - ASSERT_EQ(sem->ConstantValue().Elements().size(), 3u); - EXPECT_EQ(sem->ConstantValue().Elements()[0].f32, 10.f); - EXPECT_EQ(sem->ConstantValue().Elements()[1].f32, 20.f); - EXPECT_EQ(sem->ConstantValue().Elements()[2].f32, 30.f); -} - -} // namespace -} // namespace tint::resolver diff --git a/src/tint/resolver/resolver_test.cc b/src/tint/resolver/resolver_test.cc index f9055fd5f2..d4f0ef96cb 100644 --- a/src/tint/resolver/resolver_test.cc +++ b/src/tint/resolver/resolver_test.cc @@ -42,6 +42,7 @@ #include "src/tint/sem/reference.h" #include "src/tint/sem/sampled_texture.h" #include "src/tint/sem/statement.h" +#include "src/tint/sem/switch_statement.h" #include "src/tint/sem/variable.h" using ::testing::ElementsAre; @@ -88,7 +89,7 @@ using Op = ast::BinaryOp; TEST_F(ResolverTest, Stmt_Assign) { auto* v = Var("v", ty.f32()); auto* lhs = Expr("v"); - auto* rhs = Expr(2.3f); + auto* rhs = Expr(2.3_f); auto* assign = Assign(lhs, rhs); WrapInFunction(v, assign); @@ -107,15 +108,15 @@ TEST_F(ResolverTest, Stmt_Assign) { TEST_F(ResolverTest, Stmt_Case) { auto* v = Var("v", ty.f32()); auto* lhs = Expr("v"); - auto* rhs = Expr(2.3f); + auto* rhs = Expr(2.3_f); auto* assign = Assign(lhs, rhs); auto* block = Block(assign); - ast::CaseSelectorList lit; - lit.push_back(Expr(3_i)); - auto* cse = create(lit, block); + auto* sel = Expr(3_i); + auto* cse = Case(sel, block); + auto* def = DefaultCase(); auto* cond_var = Var("c", ty.i32()); - auto* sw = Switch(cond_var, cse, DefaultCase()); + auto* sw = Switch(cond_var, cse, def); WrapInFunction(v, cond_var, sw); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -127,12 +128,19 @@ TEST_F(ResolverTest, Stmt_Case) { EXPECT_EQ(StmtOf(lhs), assign); EXPECT_EQ(StmtOf(rhs), assign); EXPECT_EQ(BlockOf(assign), block); + auto* sem = Sem().Get(sw); + ASSERT_EQ(sem->Cases().size(), 2u); + EXPECT_EQ(sem->Cases()[0]->Declaration(), cse); + ASSERT_EQ(sem->Cases()[0]->Selectors().size(), 1u); + EXPECT_EQ(sem->Cases()[0]->Selectors()[0]->Declaration(), sel); + EXPECT_EQ(sem->Cases()[1]->Declaration(), def); + EXPECT_EQ(sem->Cases()[1]->Selectors().size(), 0u); } TEST_F(ResolverTest, Stmt_Block) { auto* v = Var("v", ty.f32()); auto* lhs = Expr("v"); - auto* rhs = Expr(2.3f); + auto* rhs = Expr(2.3_f); auto* assign = Assign(lhs, rhs); auto* block = Block(assign); @@ -154,7 +162,7 @@ TEST_F(ResolverTest, Stmt_Block) { TEST_F(ResolverTest, Stmt_If) { auto* v = Var("v", ty.f32()); auto* else_lhs = Expr("v"); - auto* else_rhs = Expr(2.3f); + auto* else_rhs = Expr(2.3_f); auto* else_body = Block(Assign(else_lhs, else_rhs)); @@ -162,7 +170,7 @@ TEST_F(ResolverTest, Stmt_If) { auto* else_stmt = If(else_cond, else_body); auto* lhs = Expr("v"); - auto* rhs = Expr(2.3f); + auto* rhs = Expr(2.3_f); auto* assign = Assign(lhs, rhs); auto* body = Block(assign); @@ -195,11 +203,11 @@ TEST_F(ResolverTest, Stmt_If) { TEST_F(ResolverTest, Stmt_Loop) { auto* v = Var("v", ty.f32()); auto* body_lhs = Expr("v"); - auto* body_rhs = Expr(2.3f); + auto* body_rhs = Expr(2.3_f); auto* body = Block(Assign(body_lhs, body_rhs), Break()); auto* continuing_lhs = Expr("v"); - auto* continuing_rhs = Expr(2.3f); + auto* continuing_rhs = Expr(2.3_f); auto* continuing = Block(Assign(continuing_lhs, continuing_rhs)); auto* stmt = Loop(body, continuing); @@ -225,7 +233,7 @@ TEST_F(ResolverTest, Stmt_Return) { auto* cond = Expr(2_i); auto* ret = Return(cond); - Func("test", {}, ty.i32(), {ret}, {}); + Func("test", utils::Empty, ty.i32(), utils::Vector{ret}, utils::Empty); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -243,7 +251,7 @@ TEST_F(ResolverTest, Stmt_Return_WithoutValue) { TEST_F(ResolverTest, Stmt_Switch) { auto* v = Var("v", ty.f32()); auto* lhs = Expr("v"); - auto* rhs = Expr(2.3f); + auto* rhs = Expr(2.3_f); auto* case_block = Block(Assign(lhs, rhs)); auto* stmt = Switch(Expr(2_i), Case(Expr(3_i), case_block), DefaultCase()); WrapInFunction(v, stmt); @@ -262,8 +270,10 @@ TEST_F(ResolverTest, Stmt_Switch) { } TEST_F(ResolverTest, Stmt_Call) { - ast::VariableList params; - Func("my_func", params, ty.void_(), {Return()}, ast::AttributeList{}); + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ + Return(), + }); auto* expr = Call("my_func"); @@ -278,7 +288,7 @@ TEST_F(ResolverTest, Stmt_Call) { } TEST_F(ResolverTest, Stmt_VariableDecl) { - auto* var = Var("my_var", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* var = Var("my_var", ty.i32(), Expr(2_i)); auto* init = var->constructor; auto* decl = Decl(var); @@ -292,7 +302,7 @@ TEST_F(ResolverTest, Stmt_VariableDecl) { TEST_F(ResolverTest, Stmt_VariableDecl_Alias) { auto* my_int = Alias("MyInt", ty.i32()); - auto* var = Var("my_var", ty.Of(my_int), ast::StorageClass::kNone, Expr(2_i)); + auto* var = Var("my_var", ty.Of(my_int), Expr(2_i)); auto* init = var->constructor; auto* decl = Decl(var); @@ -306,7 +316,7 @@ TEST_F(ResolverTest, Stmt_VariableDecl_Alias) { TEST_F(ResolverTest, Stmt_VariableDecl_ModuleScope) { auto* init = Expr(2_i); - Global("my_var", ty.i32(), ast::StorageClass::kPrivate, init); + GlobalVar("my_var", ty.i32(), ast::StorageClass::kPrivate, init); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -325,31 +335,29 @@ TEST_F(ResolverTest, Stmt_VariableDecl_OuterScopeAfterInnerScope) { // var bar : f32 = foo; // } - ast::VariableList params; - // Declare i32 "foo" inside a block - auto* foo_i32 = Var("foo", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* foo_i32 = Var("foo", ty.i32(), Expr(2_i)); auto* foo_i32_init = foo_i32->constructor; auto* foo_i32_decl = Decl(foo_i32); // Reference "foo" inside the block - auto* bar_i32 = Var("bar", ty.i32(), ast::StorageClass::kNone, Expr("foo")); + auto* bar_i32 = Var("bar", ty.i32(), Expr("foo")); auto* bar_i32_init = bar_i32->constructor; auto* bar_i32_decl = Decl(bar_i32); auto* inner = Block(foo_i32_decl, bar_i32_decl); // Declare f32 "foo" at function scope - auto* foo_f32 = Var("foo", ty.f32(), ast::StorageClass::kNone, Expr(2.f)); + auto* foo_f32 = Var("foo", ty.f32(), Expr(2_f)); auto* foo_f32_init = foo_f32->constructor; auto* foo_f32_decl = Decl(foo_f32); // Reference "foo" at function scope - auto* bar_f32 = Var("bar", ty.f32(), ast::StorageClass::kNone, Expr("foo")); + auto* bar_f32 = Var("bar", ty.f32(), Expr("foo")); auto* bar_f32_init = bar_f32->constructor; auto* bar_f32_decl = Decl(bar_f32); - Func("func", params, ty.void_(), {inner, foo_f32_decl, bar_f32_decl}, ast::AttributeList{}); + Func("func", utils::Empty, ty.void_(), utils::Vector{inner, foo_f32_decl, bar_f32_decl}); EXPECT_TRUE(r()->Resolve()) << r()->error(); ASSERT_NE(TypeOf(foo_i32_init), nullptr); @@ -364,8 +372,8 @@ TEST_F(ResolverTest, Stmt_VariableDecl_OuterScopeAfterInnerScope) { EXPECT_EQ(StmtOf(bar_i32_init), bar_i32_decl); EXPECT_EQ(StmtOf(foo_f32_init), foo_f32_decl); EXPECT_EQ(StmtOf(bar_f32_init), bar_f32_decl); - EXPECT_TRUE(CheckVarUsers(foo_i32, {bar_i32->constructor})); - EXPECT_TRUE(CheckVarUsers(foo_f32, {bar_f32->constructor})); + EXPECT_TRUE(CheckVarUsers(foo_i32, utils::Vector{bar_i32->constructor})); + EXPECT_TRUE(CheckVarUsers(foo_f32, utils::Vector{bar_f32->constructor})); ASSERT_NE(VarOf(bar_i32->constructor), nullptr); EXPECT_EQ(VarOf(bar_i32->constructor)->Declaration(), foo_i32); ASSERT_NE(VarOf(bar_f32->constructor), nullptr); @@ -381,24 +389,22 @@ TEST_F(ResolverTest, Stmt_VariableDecl_ModuleScopeAfterFunctionScope) { // var bar : f32 = foo; // } - ast::VariableList params; - // Declare i32 "foo" inside a function - auto* fn_i32 = Var("foo", ty.i32(), ast::StorageClass::kNone, Expr(2_i)); + auto* fn_i32 = Var("foo", ty.i32(), Expr(2_i)); auto* fn_i32_init = fn_i32->constructor; auto* fn_i32_decl = Decl(fn_i32); - Func("func_i32", params, ty.void_(), {fn_i32_decl}, ast::AttributeList{}); + Func("func_i32", utils::Empty, ty.void_(), utils::Vector{fn_i32_decl}); // Declare f32 "foo" at module scope - auto* mod_f32 = Var("foo", ty.f32(), ast::StorageClass::kPrivate, Expr(2.f)); + auto* mod_f32 = Var("foo", ty.f32(), ast::StorageClass::kPrivate, Expr(2_f)); auto* mod_init = mod_f32->constructor; AST().AddGlobalVariable(mod_f32); // Reference "foo" in another function - auto* fn_f32 = Var("bar", ty.f32(), ast::StorageClass::kNone, Expr("foo")); + auto* fn_f32 = Var("bar", ty.f32(), Expr("foo")); auto* fn_f32_init = fn_f32->constructor; auto* fn_f32_decl = Decl(fn_f32); - Func("func_f32", params, ty.void_(), {fn_f32_decl}, ast::AttributeList{}); + Func("func_f32", utils::Empty, ty.void_(), utils::Vector{fn_f32_decl}); EXPECT_TRUE(r()->Resolve()) << r()->error(); ASSERT_NE(TypeOf(mod_init), nullptr); @@ -410,15 +416,15 @@ TEST_F(ResolverTest, Stmt_VariableDecl_ModuleScopeAfterFunctionScope) { EXPECT_EQ(StmtOf(fn_i32_init), fn_i32_decl); EXPECT_EQ(StmtOf(mod_init), nullptr); EXPECT_EQ(StmtOf(fn_f32_init), fn_f32_decl); - EXPECT_TRUE(CheckVarUsers(fn_i32, {})); - EXPECT_TRUE(CheckVarUsers(mod_f32, {fn_f32->constructor})); + EXPECT_TRUE(CheckVarUsers(fn_i32, utils::Empty)); + EXPECT_TRUE(CheckVarUsers(mod_f32, utils::Vector{fn_f32->constructor})); ASSERT_NE(VarOf(fn_f32->constructor), nullptr); EXPECT_EQ(VarOf(fn_f32->constructor)->Declaration(), mod_f32); } TEST_F(ResolverTest, ArraySize_UnsignedLiteral) { // var a : array; - auto* a = Global("a", ty.array(ty.f32(), Expr(10_u)), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.array(ty.f32(), Expr(10_u)), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -431,7 +437,7 @@ TEST_F(ResolverTest, ArraySize_UnsignedLiteral) { TEST_F(ResolverTest, ArraySize_SignedLiteral) { // var a : array; - auto* a = Global("a", ty.array(ty.f32(), Expr(10_i)), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.array(ty.f32(), Expr(10_i)), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -442,11 +448,11 @@ TEST_F(ResolverTest, ArraySize_SignedLiteral) { EXPECT_EQ(ary->Count(), 10u); } -TEST_F(ResolverTest, ArraySize_UnsignedConstant) { - // let size = 0u; +TEST_F(ResolverTest, ArraySize_UnsignedConst) { + // const size = 10u; // var a : array; - GlobalConst("size", nullptr, Expr(10_u)); - auto* a = Global("a", ty.array(ty.f32(), Expr("size")), ast::StorageClass::kPrivate); + GlobalConst("size", Expr(10_u)); + auto* a = GlobalVar("a", ty.array(ty.f32(), Expr("size")), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -457,11 +463,11 @@ TEST_F(ResolverTest, ArraySize_UnsignedConstant) { EXPECT_EQ(ary->Count(), 10u); } -TEST_F(ResolverTest, ArraySize_SignedConstant) { - // let size = 0; +TEST_F(ResolverTest, ArraySize_SignedConst) { + // const size = 0; // var a : array; - GlobalConst("size", nullptr, Expr(10_i)); - auto* a = Global("a", ty.array(ty.f32(), Expr("size")), ast::StorageClass::kPrivate); + GlobalConst("size", Expr(10_i)); + auto* a = GlobalVar("a", ty.array(ty.f32(), Expr("size")), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -473,7 +479,7 @@ TEST_F(ResolverTest, ArraySize_SignedConstant) { } TEST_F(ResolverTest, Expr_Bitcast) { - Global("name", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("name", ty.f32(), ast::StorageClass::kPrivate); auto* bitcast = create(ty.f32(), Expr("name")); WrapInFunction(bitcast); @@ -485,8 +491,7 @@ TEST_F(ResolverTest, Expr_Bitcast) { } TEST_F(ResolverTest, Expr_Call) { - ast::VariableList params; - Func("my_func", params, ty.f32(), {Return(0.0f)}, ast::AttributeList{}); + Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(0_f)}); auto* call = Call("my_func"); WrapInFunction(call); @@ -498,8 +503,7 @@ TEST_F(ResolverTest, Expr_Call) { } TEST_F(ResolverTest, Expr_Call_InBinaryOp) { - ast::VariableList params; - Func("func", params, ty.f32(), {Return(0.0f)}, ast::AttributeList{}); + Func("func", utils::Empty, ty.f32(), utils::Vector{Return(0_f)}); auto* expr = Add(Call("func"), Call("func")); WrapInFunction(expr); @@ -511,12 +515,12 @@ TEST_F(ResolverTest, Expr_Call_InBinaryOp) { } TEST_F(ResolverTest, Expr_Call_WithParams) { - Func("my_func", {Param(Sym(), ty.f32())}, ty.f32(), - { - Return(1.2f), + Func("my_func", utils::Vector{Param(Sym(), ty.f32())}, ty.f32(), + utils::Vector{ + Return(1.2_f), }); - auto* param = Expr(2.4f); + auto* param = Expr(2.4_f); auto* call = Call("my_func", param); WrapInFunction(call); @@ -528,7 +532,7 @@ TEST_F(ResolverTest, Expr_Call_WithParams) { } TEST_F(ResolverTest, Expr_Call_Builtin) { - auto* call = Call("round", 2.4f); + auto* call = Call("round", 2.4_f); WrapInFunction(call); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -538,7 +542,7 @@ TEST_F(ResolverTest, Expr_Call_Builtin) { } TEST_F(ResolverTest, Expr_Cast) { - Global("name", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("name", ty.f32(), ast::StorageClass::kPrivate); auto* cast = Construct(ty.f32(), "name"); WrapInFunction(cast); @@ -550,7 +554,7 @@ TEST_F(ResolverTest, Expr_Cast) { } TEST_F(ResolverTest, Expr_Constructor_Scalar) { - auto* s = Expr(1.0f); + auto* s = Expr(1_f); WrapInFunction(s); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -560,7 +564,7 @@ TEST_F(ResolverTest, Expr_Constructor_Scalar) { } TEST_F(ResolverTest, Expr_Constructor_Type_Vec2) { - auto* tc = vec2(1.0f, 1.0f); + auto* tc = vec2(1_f, 1_f); WrapInFunction(tc); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -572,7 +576,7 @@ TEST_F(ResolverTest, Expr_Constructor_Type_Vec2) { } TEST_F(ResolverTest, Expr_Constructor_Type_Vec3) { - auto* tc = vec3(1.0f, 1.0f, 1.0f); + auto* tc = vec3(1_f, 1_f, 1_f); WrapInFunction(tc); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -584,7 +588,7 @@ TEST_F(ResolverTest, Expr_Constructor_Type_Vec3) { } TEST_F(ResolverTest, Expr_Constructor_Type_Vec4) { - auto* tc = vec4(1.0f, 1.0f, 1.0f, 1.0f); + auto* tc = vec4(1_f, 1_f, 1_f, 1_f); WrapInFunction(tc); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -596,7 +600,7 @@ TEST_F(ResolverTest, Expr_Constructor_Type_Vec4) { } TEST_F(ResolverTest, Expr_Identifier_GlobalVariable) { - auto* my_var = Global("my_var", ty.f32(), ast::StorageClass::kPrivate); + auto* my_var = GlobalVar("my_var", ty.f32(), ast::StorageClass::kPrivate); auto* ident = Expr("my_var"); WrapInFunction(ident); @@ -606,12 +610,12 @@ TEST_F(ResolverTest, Expr_Identifier_GlobalVariable) { ASSERT_NE(TypeOf(ident), nullptr); ASSERT_TRUE(TypeOf(ident)->Is()); EXPECT_TRUE(TypeOf(ident)->UnwrapRef()->Is()); - EXPECT_TRUE(CheckVarUsers(my_var, {ident})); + EXPECT_TRUE(CheckVarUsers(my_var, utils::Vector{ident})); ASSERT_NE(VarOf(ident), nullptr); EXPECT_EQ(VarOf(ident)->Declaration(), my_var); } -TEST_F(ResolverTest, Expr_Identifier_GlobalConstant) { +TEST_F(ResolverTest, Expr_Identifier_GlobalConst) { auto* my_var = GlobalConst("my_var", ty.f32(), Construct(ty.f32())); auto* ident = Expr("my_var"); @@ -621,7 +625,7 @@ TEST_F(ResolverTest, Expr_Identifier_GlobalConstant) { ASSERT_NE(TypeOf(ident), nullptr); EXPECT_TRUE(TypeOf(ident)->Is()); - EXPECT_TRUE(CheckVarUsers(my_var, {ident})); + EXPECT_TRUE(CheckVarUsers(my_var, utils::Vector{ident})); ASSERT_NE(VarOf(ident), nullptr); EXPECT_EQ(VarOf(ident)->Declaration(), my_var); } @@ -629,21 +633,20 @@ TEST_F(ResolverTest, Expr_Identifier_GlobalConstant) { TEST_F(ResolverTest, Expr_Identifier_FunctionVariable_Const) { auto* my_var_a = Expr("my_var"); auto* var = Let("my_var", ty.f32(), Construct(ty.f32())); - auto* decl = Decl(Var("b", ty.f32(), ast::StorageClass::kNone, my_var_a)); + auto* decl = Decl(Var("b", ty.f32(), my_var_a)); - Func("my_func", ast::VariableList{}, ty.void_(), - { + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), decl, - }, - ast::AttributeList{}); + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); ASSERT_NE(TypeOf(my_var_a), nullptr); EXPECT_TRUE(TypeOf(my_var_a)->Is()); EXPECT_EQ(StmtOf(my_var_a), decl); - EXPECT_TRUE(CheckVarUsers(var, {my_var_a})); + EXPECT_TRUE(CheckVarUsers(var, utils::Vector{my_var_a})); ASSERT_NE(VarOf(my_var_a), nullptr); EXPECT_EQ(VarOf(my_var_a)->Declaration(), var); } @@ -655,13 +658,12 @@ TEST_F(ResolverTest, IndexAccessor_Dynamic_Ref_F32) { auto* a = Var("a", ty.array(), array()); auto* idx = Var("idx", ty.f32(), Construct(ty.f32())); auto* f = Var("f", ty.f32(), IndexAccessor("a", Expr(Source{{12, 34}}, idx))); - Func("my_func", ast::VariableList{}, ty.void_(), - { + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(a), Decl(idx), Decl(f), - }, - ast::AttributeList{}); + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: index must be of type 'i32' or 'u32', found: 'f32'"); @@ -674,12 +676,11 @@ TEST_F(ResolverTest, Expr_Identifier_FunctionVariable) { auto* var = Var("my_var", ty.f32()); - Func("my_func", ast::VariableList{}, ty.void_(), - { + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), assign, - }, - ast::AttributeList{}); + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -691,7 +692,7 @@ TEST_F(ResolverTest, Expr_Identifier_FunctionVariable) { ASSERT_TRUE(TypeOf(my_var_b)->Is()); EXPECT_TRUE(TypeOf(my_var_b)->UnwrapRef()->Is()); EXPECT_EQ(StmtOf(my_var_b), assign); - EXPECT_TRUE(CheckVarUsers(var, {my_var_a, my_var_b})); + EXPECT_TRUE(CheckVarUsers(var, utils::Vector{my_var_a, my_var_b})); ASSERT_NE(VarOf(my_var_a), nullptr); EXPECT_EQ(VarOf(my_var_a)->Declaration(), var); ASSERT_NE(VarOf(my_var_b), nullptr); @@ -703,14 +704,13 @@ TEST_F(ResolverTest, Expr_Identifier_Function_Ptr) { auto* p = Expr("p"); auto* v_decl = Decl(Var("v", ty.f32())); auto* p_decl = Decl(Let("p", ty.pointer(ast::StorageClass::kFunction), AddressOf(v))); - auto* assign = Assign(Deref(p), 1.23f); - Func("my_func", ast::VariableList{}, ty.void_(), - { + auto* assign = Assign(Deref(p), 1.23_f); + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ v_decl, p_decl, assign, - }, - ast::AttributeList{}); + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -725,7 +725,10 @@ TEST_F(ResolverTest, Expr_Identifier_Function_Ptr) { } TEST_F(ResolverTest, Expr_Call_Function) { - Func("my_func", ast::VariableList{}, ty.f32(), {Return(0.0f)}, ast::AttributeList{}); + Func("my_func", utils::Empty, ty.f32(), + utils::Vector{ + Return(0_f), + }); auto* call = Call("my_func"); WrapInFunction(call); @@ -749,18 +752,18 @@ TEST_F(ResolverTest, Function_Parameters) { auto* param_c = Param("c", ty.u32()); auto* func = Func("my_func", - ast::VariableList{ + utils::Vector{ param_a, param_b, param_c, }, - ty.void_(), {}); + ty.void_(), utils::Empty); EXPECT_TRUE(r()->Resolve()) << r()->error(); auto* func_sem = Sem().Get(func); ASSERT_NE(func_sem, nullptr); - EXPECT_EQ(func_sem->Parameters().size(), 3u); + EXPECT_EQ(func_sem->Parameters().Length(), 3u); EXPECT_TRUE(func_sem->Parameters()[0]->Type()->Is()); EXPECT_TRUE(func_sem->Parameters()[1]->Type()->Is()); EXPECT_TRUE(func_sem->Parameters()[2]->Type()->Is()); @@ -771,18 +774,15 @@ TEST_F(ResolverTest, Function_Parameters) { } TEST_F(ResolverTest, Function_RegisterInputOutputVariables) { - auto* s = Structure("S", {Member("m", ty.u32())}); + auto* s = Structure("S", utils::Vector{Member("m", ty.u32())}); - auto* sb_var = Global("sb_var", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); - auto* wg_var = Global("wg_var", ty.f32(), ast::StorageClass::kWorkgroup); - auto* priv_var = Global("priv_var", ty.f32(), ast::StorageClass::kPrivate); + auto* sb_var = GlobalVar("sb_var", ty.Of(s), ast::StorageClass::kStorage, + ast::Access::kReadWrite, Binding(0), Group(0)); + auto* wg_var = GlobalVar("wg_var", ty.f32(), ast::StorageClass::kWorkgroup); + auto* priv_var = GlobalVar("priv_var", ty.f32(), ast::StorageClass::kPrivate); - auto* func = Func("my_func", ast::VariableList{}, ty.void_(), - { + auto* func = Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Assign("wg_var", "wg_var"), Assign("sb_var", "sb_var"), Assign("priv_var", "priv_var"), @@ -792,56 +792,52 @@ TEST_F(ResolverTest, Function_RegisterInputOutputVariables) { auto* func_sem = Sem().Get(func); ASSERT_NE(func_sem, nullptr); - EXPECT_EQ(func_sem->Parameters().size(), 0u); + EXPECT_EQ(func_sem->Parameters().Length(), 0u); EXPECT_TRUE(func_sem->ReturnType()->Is()); const auto& vars = func_sem->TransitivelyReferencedGlobals(); - ASSERT_EQ(vars.size(), 3u); + ASSERT_EQ(vars.Length(), 3u); EXPECT_EQ(vars[0]->Declaration(), wg_var); EXPECT_EQ(vars[1]->Declaration(), sb_var); EXPECT_EQ(vars[2]->Declaration(), priv_var); } TEST_F(ResolverTest, Function_RegisterInputOutputVariables_SubFunction) { - auto* s = Structure("S", {Member("m", ty.u32())}); + auto* s = Structure("S", utils::Vector{Member("m", ty.u32())}); - auto* sb_var = Global("sb_var", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); - auto* wg_var = Global("wg_var", ty.f32(), ast::StorageClass::kWorkgroup); - auto* priv_var = Global("priv_var", ty.f32(), ast::StorageClass::kPrivate); + auto* sb_var = GlobalVar("sb_var", ty.Of(s), ast::StorageClass::kStorage, + ast::Access::kReadWrite, Binding(0), Group(0)); + auto* wg_var = GlobalVar("wg_var", ty.f32(), ast::StorageClass::kWorkgroup); + auto* priv_var = GlobalVar("priv_var", ty.f32(), ast::StorageClass::kPrivate); - Func("my_func", ast::VariableList{}, ty.f32(), - {Assign("wg_var", "wg_var"), Assign("sb_var", "sb_var"), Assign("priv_var", "priv_var"), - Return(0.0f)}, - ast::AttributeList{}); + Func("my_func", utils::Empty, ty.f32(), + utils::Vector{Assign("wg_var", "wg_var"), Assign("sb_var", "sb_var"), + Assign("priv_var", "priv_var"), Return(0_f)}); - auto* func2 = Func("func", ast::VariableList{}, ty.void_(), - { + auto* func2 = Func("func", utils::Empty, ty.void_(), + utils::Vector{ WrapInStatement(Call("my_func")), }, - ast::AttributeList{}); + utils::Empty); EXPECT_TRUE(r()->Resolve()) << r()->error(); auto* func2_sem = Sem().Get(func2); ASSERT_NE(func2_sem, nullptr); - EXPECT_EQ(func2_sem->Parameters().size(), 0u); + EXPECT_EQ(func2_sem->Parameters().Length(), 0u); const auto& vars = func2_sem->TransitivelyReferencedGlobals(); - ASSERT_EQ(vars.size(), 3u); + ASSERT_EQ(vars.Length(), 3u); EXPECT_EQ(vars[0]->Declaration(), wg_var); EXPECT_EQ(vars[1]->Declaration(), sb_var); EXPECT_EQ(vars[2]->Declaration(), priv_var); } TEST_F(ResolverTest, Function_NotRegisterFunctionVariable) { - auto* func = Func("my_func", ast::VariableList{}, ty.void_(), - { + auto* func = Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("var", ty.f32())), - Assign("var", 1.f), + Assign("var", 1_f), }); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -849,13 +845,13 @@ TEST_F(ResolverTest, Function_NotRegisterFunctionVariable) { auto* func_sem = Sem().Get(func); ASSERT_NE(func_sem, nullptr); - EXPECT_EQ(func_sem->TransitivelyReferencedGlobals().size(), 0u); + EXPECT_EQ(func_sem->TransitivelyReferencedGlobals().Length(), 0u); EXPECT_TRUE(func_sem->ReturnType()->Is()); } TEST_F(ResolverTest, Function_NotRegisterFunctionConstant) { - auto* func = Func("my_func", ast::VariableList{}, ty.void_(), - { + auto* func = Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(Let("var", ty.f32(), Construct(ty.f32()))), }); @@ -864,28 +860,28 @@ TEST_F(ResolverTest, Function_NotRegisterFunctionConstant) { auto* func_sem = Sem().Get(func); ASSERT_NE(func_sem, nullptr); - EXPECT_EQ(func_sem->TransitivelyReferencedGlobals().size(), 0u); + EXPECT_EQ(func_sem->TransitivelyReferencedGlobals().Length(), 0u); EXPECT_TRUE(func_sem->ReturnType()->Is()); } TEST_F(ResolverTest, Function_NotRegisterFunctionParams) { - auto* func = Func("my_func", {Let("var", ty.f32(), Construct(ty.f32()))}, ty.void_(), {}); + auto* func = Func("my_func", utils::Vector{Param("var", ty.f32())}, ty.void_(), utils::Empty); EXPECT_TRUE(r()->Resolve()) << r()->error(); auto* func_sem = Sem().Get(func); ASSERT_NE(func_sem, nullptr); - EXPECT_EQ(func_sem->TransitivelyReferencedGlobals().size(), 0u); + EXPECT_EQ(func_sem->TransitivelyReferencedGlobals().Length(), 0u); EXPECT_TRUE(func_sem->ReturnType()->Is()); } TEST_F(ResolverTest, Function_CallSites) { - auto* foo = Func("foo", ast::VariableList{}, ty.void_(), {}); + auto* foo = Func("foo", utils::Empty, ty.void_(), utils::Empty); auto* call_1 = Call("foo"); auto* call_2 = Call("foo"); - auto* bar = Func("bar", ast::VariableList{}, ty.void_(), - { + auto* bar = Func("bar", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(call_1), CallStmt(call_2), }); @@ -904,9 +900,9 @@ TEST_F(ResolverTest, Function_CallSites) { } TEST_F(ResolverTest, Function_WorkgroupSize_NotSet) { - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn main() {} - auto* func = Func("main", ast::VariableList{}, ty.void_(), {}, {}); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -922,10 +918,13 @@ TEST_F(ResolverTest, Function_WorkgroupSize_NotSet) { } TEST_F(ResolverTest, Function_WorkgroupSize_Literals) { - // @stage(compute) @workgroup_size(8, 2, 3) + // @compute @workgroup_size(8, 2, 3) // fn main() {} - auto* func = Func("main", ast::VariableList{}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(8_i, 2_i, 3_i)}); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(8_i, 2_i, 3_i), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -940,18 +939,20 @@ TEST_F(ResolverTest, Function_WorkgroupSize_Literals) { EXPECT_EQ(func_sem->WorkgroupSize()[2].overridable_const, nullptr); } -TEST_F(ResolverTest, Function_WorkgroupSize_Consts) { - // let width = 16i; - // let height = 8i; - // let depth = 2i; - // @stage(compute) @workgroup_size(width, height, depth) +TEST_F(ResolverTest, Function_WorkgroupSize_ViaConst) { + // const width = 16i; + // const height = 8i; + // const depth = 2i; + // @compute @workgroup_size(width, height, depth) // fn main() {} GlobalConst("width", ty.i32(), Expr(16_i)); GlobalConst("height", ty.i32(), Expr(8_i)); GlobalConst("depth", ty.i32(), Expr(2_i)); - auto* func = - Func("main", ast::VariableList{}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize("width", "height", "depth")}); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize("width", "height", "depth"), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -966,17 +967,20 @@ TEST_F(ResolverTest, Function_WorkgroupSize_Consts) { EXPECT_EQ(func_sem->WorkgroupSize()[2].overridable_const, nullptr); } -TEST_F(ResolverTest, Function_WorkgroupSize_Consts_NestedInitializer) { - // let width = i32(i32(i32(8i))); - // let height = i32(i32(i32(4i))); - // @stage(compute) @workgroup_size(width, height) +TEST_F(ResolverTest, Function_WorkgroupSize_ViaConst_NestedInitializer) { + // const width = i32(i32(i32(8i))); + // const height = i32(i32(i32(4i))); + // @compute @workgroup_size(width, height) // fn main() {} GlobalConst("width", ty.i32(), Construct(ty.i32(), Construct(ty.i32(), Construct(ty.i32(), 8_i)))); GlobalConst("height", ty.i32(), Construct(ty.i32(), Construct(ty.i32(), Construct(ty.i32(), 4_i)))); - auto* func = Func("main", ast::VariableList{}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize("width", "height")}); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize("width", "height"), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -995,14 +999,16 @@ TEST_F(ResolverTest, Function_WorkgroupSize_OverridableConsts) { // @id(0) override width = 16i; // @id(1) override height = 8i; // @id(2) override depth = 2i; - // @stage(compute) @workgroup_size(width, height, depth) + // @compute @workgroup_size(width, height, depth) // fn main() {} - auto* width = Override("width", ty.i32(), Expr(16_i), {Id(0)}); - auto* height = Override("height", ty.i32(), Expr(8_i), {Id(1)}); - auto* depth = Override("depth", ty.i32(), Expr(2_i), {Id(2)}); - auto* func = - Func("main", ast::VariableList{}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize("width", "height", "depth")}); + auto* width = Override("width", ty.i32(), Expr(16_i), Id(0)); + auto* height = Override("height", ty.i32(), Expr(8_i), Id(1)); + auto* depth = Override("depth", ty.i32(), Expr(2_i), Id(2)); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize("width", "height", "depth"), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1021,14 +1027,16 @@ TEST_F(ResolverTest, Function_WorkgroupSize_OverridableConsts_NoInit) { // @id(0) override width : i32; // @id(1) override height : i32; // @id(2) override depth : i32; - // @stage(compute) @workgroup_size(width, height, depth) + // @compute @workgroup_size(width, height, depth) // fn main() {} - auto* width = Override("width", ty.i32(), nullptr, {Id(0)}); - auto* height = Override("height", ty.i32(), nullptr, {Id(1)}); - auto* depth = Override("depth", ty.i32(), nullptr, {Id(2)}); - auto* func = - Func("main", ast::VariableList{}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize("width", "height", "depth")}); + auto* width = Override("width", ty.i32(), Id(0)); + auto* height = Override("height", ty.i32(), Id(1)); + auto* depth = Override("depth", ty.i32(), Id(2)); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize("width", "height", "depth"), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1045,13 +1053,16 @@ TEST_F(ResolverTest, Function_WorkgroupSize_OverridableConsts_NoInit) { TEST_F(ResolverTest, Function_WorkgroupSize_Mixed) { // @id(1) override height = 2i; - // let depth = 3i; - // @stage(compute) @workgroup_size(8, height, depth) + // const depth = 3i; + // @compute @workgroup_size(8, height, depth) // fn main() {} - auto* height = Override("height", ty.i32(), Expr(2_i), {Id(0)}); + auto* height = Override("height", ty.i32(), Expr(2_i), Id(0)); GlobalConst("depth", ty.i32(), Expr(3_i)); - auto* func = Func("main", ast::VariableList{}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(8_i, "height", "depth")}); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(8_i, "height", "depth"), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1067,9 +1078,9 @@ TEST_F(ResolverTest, Function_WorkgroupSize_Mixed) { } TEST_F(ResolverTest, Expr_MemberAccessor_Struct) { - auto* st = - Structure("S", {Member("first_member", ty.i32()), Member("second_member", ty.f32())}); - Global("my_struct", ty.Of(st), ast::StorageClass::kPrivate); + auto* st = Structure( + "S", utils::Vector{Member("first_member", ty.i32()), Member("second_member", ty.f32())}); + GlobalVar("my_struct", ty.Of(st), ast::StorageClass::kPrivate); auto* mem = MemberAccessor("my_struct", "second_member"); WrapInFunction(mem); @@ -1084,15 +1095,16 @@ TEST_F(ResolverTest, Expr_MemberAccessor_Struct) { auto* sma = Sem().Get(mem)->As(); ASSERT_NE(sma, nullptr); EXPECT_TRUE(sma->Member()->Type()->Is()); + EXPECT_EQ(sma->Object()->Declaration(), mem->structure); EXPECT_EQ(sma->Member()->Index(), 1u); EXPECT_EQ(sma->Member()->Declaration()->symbol, Symbols().Get("second_member")); } TEST_F(ResolverTest, Expr_MemberAccessor_Struct_Alias) { - auto* st = - Structure("S", {Member("first_member", ty.i32()), Member("second_member", ty.f32())}); + auto* st = Structure( + "S", utils::Vector{Member("first_member", ty.i32()), Member("second_member", ty.f32())}); auto* alias = Alias("alias", ty.Of(st)); - Global("my_struct", ty.Of(alias), ast::StorageClass::kPrivate); + GlobalVar("my_struct", ty.Of(alias), ast::StorageClass::kPrivate); auto* mem = MemberAccessor("my_struct", "second_member"); WrapInFunction(mem); @@ -1106,12 +1118,13 @@ TEST_F(ResolverTest, Expr_MemberAccessor_Struct_Alias) { EXPECT_TRUE(ref->StoreType()->Is()); auto* sma = Sem().Get(mem)->As(); ASSERT_NE(sma, nullptr); + EXPECT_EQ(sma->Object()->Declaration(), mem->structure); EXPECT_TRUE(sma->Member()->Type()->Is()); EXPECT_EQ(sma->Member()->Index(), 1u); } TEST_F(ResolverTest, Expr_MemberAccessor_VectorSwizzle) { - Global("my_vec", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("my_vec", ty.vec4(), ast::StorageClass::kPrivate); auto* mem = MemberAccessor("my_vec", "xzyw"); WrapInFunction(mem); @@ -1122,12 +1135,14 @@ TEST_F(ResolverTest, Expr_MemberAccessor_VectorSwizzle) { ASSERT_TRUE(TypeOf(mem)->Is()); EXPECT_TRUE(TypeOf(mem)->As()->type()->Is()); EXPECT_EQ(TypeOf(mem)->As()->Width(), 4u); - ASSERT_TRUE(Sem().Get(mem)->Is()); - EXPECT_THAT(Sem().Get(mem)->As()->Indices(), ElementsAre(0, 2, 1, 3)); + auto* sma = Sem().Get(mem)->As(); + ASSERT_NE(sma, nullptr); + EXPECT_EQ(sma->Object()->Declaration(), mem->structure); + EXPECT_THAT(sma->As()->Indices(), ElementsAre(0, 2, 1, 3)); } TEST_F(ResolverTest, Expr_MemberAccessor_VectorSwizzle_SingleElement) { - Global("my_vec", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("my_vec", ty.vec3(), ast::StorageClass::kPrivate); auto* mem = MemberAccessor("my_vec", "b"); WrapInFunction(mem); @@ -1139,7 +1154,9 @@ TEST_F(ResolverTest, Expr_MemberAccessor_VectorSwizzle_SingleElement) { auto* ref = TypeOf(mem)->As(); ASSERT_TRUE(ref->StoreType()->Is()); - ASSERT_TRUE(Sem().Get(mem)->Is()); + auto* sma = Sem().Get(mem)->As(); + ASSERT_NE(sma, nullptr); + EXPECT_EQ(sma->Object()->Declaration(), mem->structure); EXPECT_THAT(Sem().Get(mem)->As()->Indices(), ElementsAre(2)); } @@ -1159,9 +1176,9 @@ TEST_F(ResolverTest, Expr_Accessor_MultiLevel) { // } // - auto* stB = Structure("B", {Member("foo", ty.vec4())}); - auto* stA = Structure("A", {Member("mem", ty.array(ty.Of(stB), 3_i))}); - Global("c", ty.Of(stA), ast::StorageClass::kPrivate); + auto* stB = Structure("B", utils::Vector{Member("foo", ty.vec4())}); + auto* stA = Structure("A", utils::Vector{Member("mem", ty.array(ty.Of(stB), 3_i))}); + GlobalVar("c", ty.Of(stA), ast::StorageClass::kPrivate); auto* mem = MemberAccessor(MemberAccessor(IndexAccessor(MemberAccessor("c", "mem"), 0_i), "foo"), "yx"); @@ -1177,9 +1194,9 @@ TEST_F(ResolverTest, Expr_Accessor_MultiLevel) { } TEST_F(ResolverTest, Expr_MemberAccessor_InBinaryOp) { - auto* st = - Structure("S", {Member("first_member", ty.f32()), Member("second_member", ty.f32())}); - Global("my_struct", ty.Of(st), ast::StorageClass::kPrivate); + auto* st = Structure( + "S", utils::Vector{Member("first_member", ty.f32()), Member("second_member", ty.f32())}); + GlobalVar("my_struct", ty.Of(st), ast::StorageClass::kPrivate); auto* expr = Add(MemberAccessor("my_struct", "first_member"), MemberAccessor("my_struct", "second_member")); @@ -1482,8 +1499,8 @@ TEST_P(Expr_Binary_Test_Valid, All) { ss << FriendlyName(lhs_type) << " " << params.op << " " << FriendlyName(rhs_type); SCOPED_TRACE(ss.str()); - Global("lhs", lhs_type, ast::StorageClass::kPrivate); - Global("rhs", rhs_type, ast::StorageClass::kPrivate); + GlobalVar("lhs", lhs_type, ast::StorageClass::kPrivate); + GlobalVar("rhs", rhs_type, ast::StorageClass::kPrivate); auto* expr = create(params.op, Expr("lhs"), Expr("rhs")); WrapInFunction(expr); @@ -1517,8 +1534,8 @@ TEST_P(Expr_Binary_Test_WithAlias_Valid, All) { << FriendlyName(rhs_type); SCOPED_TRACE(ss.str()); - Global("lhs", lhs_type, ast::StorageClass::kPrivate); - Global("rhs", rhs_type, ast::StorageClass::kPrivate); + GlobalVar("lhs", lhs_type, ast::StorageClass::kPrivate); + GlobalVar("rhs", rhs_type, ast::StorageClass::kPrivate); auto* expr = create(params.op, Expr("lhs"), Expr("rhs")); WrapInFunction(expr); @@ -1563,18 +1580,14 @@ TEST_P(Expr_Binary_Test_Invalid, All) { ss << FriendlyName(lhs_type) << " " << op << " " << FriendlyName(rhs_type); SCOPED_TRACE(ss.str()); - Global("lhs", lhs_type, ast::StorageClass::kPrivate); - Global("rhs", rhs_type, ast::StorageClass::kPrivate); + GlobalVar("lhs", lhs_type, ast::StorageClass::kPrivate); + GlobalVar("rhs", rhs_type, ast::StorageClass::kPrivate); auto* expr = create(Source{{12, 34}}, op, Expr("lhs"), Expr("rhs")); WrapInFunction(expr); ASSERT_FALSE(r()->Resolve()); - ASSERT_EQ(r()->error(), - "12:34 error: Binary expression operand types are invalid for " - "this operation: " + - FriendlyName(lhs_type) + " " + ast::FriendlyName(expr->op) + " " + - FriendlyName(rhs_type)); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching overload for operator ")); } INSTANTIATE_TEST_SUITE_P(ResolverTest, Expr_Binary_Test_Invalid, @@ -1607,8 +1620,8 @@ TEST_P(Expr_Binary_Test_Invalid_VectorMatrixMultiply, All) { is_valid_expr = vec_size == mat_cols; } - Global("lhs", lhs_type, ast::StorageClass::kPrivate); - Global("rhs", rhs_type, ast::StorageClass::kPrivate); + GlobalVar("lhs", lhs_type, ast::StorageClass::kPrivate); + GlobalVar("rhs", rhs_type, ast::StorageClass::kPrivate); auto* expr = Mul(Source{{12, 34}}, Expr("lhs"), Expr("rhs")); WrapInFunction(expr); @@ -1618,11 +1631,7 @@ TEST_P(Expr_Binary_Test_Invalid_VectorMatrixMultiply, All) { ASSERT_TRUE(TypeOf(expr) == result_type); } else { ASSERT_FALSE(r()->Resolve()); - ASSERT_EQ(r()->error(), - "12:34 error: Binary expression operand types are invalid for " - "this operation: " + - FriendlyName(lhs_type) + " " + ast::FriendlyName(expr->op) + " " + - FriendlyName(rhs_type)); + EXPECT_THAT(r()->error(), HasSubstr("no matching overload for operator *")); } } auto all_dimension_values = testing::Values(2u, 3u, 4u); @@ -1648,8 +1657,8 @@ TEST_P(Expr_Binary_Test_Invalid_MatrixMatrixMultiply, All) { auto* col = create(f32, lhs_mat_rows); auto* result_type = create(col, rhs_mat_cols); - Global("lhs", lhs_type, ast::StorageClass::kPrivate); - Global("rhs", rhs_type, ast::StorageClass::kPrivate); + GlobalVar("lhs", lhs_type, ast::StorageClass::kPrivate); + GlobalVar("rhs", rhs_type, ast::StorageClass::kPrivate); auto* expr = Mul(Source{{12, 34}}, Expr("lhs"), Expr("rhs")); WrapInFunction(expr); @@ -1660,11 +1669,7 @@ TEST_P(Expr_Binary_Test_Invalid_MatrixMatrixMultiply, All) { ASSERT_TRUE(TypeOf(expr) == result_type); } else { ASSERT_FALSE(r()->Resolve()); - ASSERT_EQ(r()->error(), - "12:34 error: Binary expression operand types are invalid for " - "this operation: " + - FriendlyName(lhs_type) + " " + ast::FriendlyName(expr->op) + " " + - FriendlyName(rhs_type)); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching overload for operator * ")); } } INSTANTIATE_TEST_SUITE_P(ResolverTest, @@ -1681,11 +1686,11 @@ TEST_P(UnaryOpExpressionTest, Expr_UnaryOp) { auto op = GetParam(); if (op == ast::UnaryOp::kNot) { - Global("ident", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("ident", ty.vec4(), ast::StorageClass::kPrivate); } else if (op == ast::UnaryOp::kNegation || op == ast::UnaryOp::kComplement) { - Global("ident", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("ident", ty.vec4(), ast::StorageClass::kPrivate); } else { - Global("ident", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("ident", ty.vec4(), ast::StorageClass::kPrivate); } auto* der = create(op, Expr("ident")); WrapInFunction(der); @@ -1713,7 +1718,7 @@ TEST_F(ResolverTest, StorageClass_SetsIfMissing) { auto* var = Var("var", ty.i32()); auto* stmt = Decl(var); - Func("func", ast::VariableList{}, ty.void_(), {stmt}, ast::AttributeList{}); + Func("func", utils::Empty, ty.void_(), utils::Vector{stmt}); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1722,11 +1727,7 @@ TEST_F(ResolverTest, StorageClass_SetsIfMissing) { TEST_F(ResolverTest, StorageClass_SetForSampler) { auto* t = ty.sampler(ast::SamplerKind::kSampler); - auto* var = Global("var", t, - ast::AttributeList{ - create(0), - create(0), - }); + auto* var = GlobalVar("var", t, Binding(0), Group(0)); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1735,11 +1736,7 @@ TEST_F(ResolverTest, StorageClass_SetForSampler) { TEST_F(ResolverTest, StorageClass_SetForTexture) { auto* t = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32()); - auto* var = Global("var", t, - ast::AttributeList{ - create(0), - create(0), - }); + auto* var = GlobalVar("var", t, Binding(0), Group(0)); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1749,7 +1746,7 @@ TEST_F(ResolverTest, StorageClass_SetForTexture) { TEST_F(ResolverTest, StorageClass_DoesNotSetOnConst) { auto* var = Let("var", ty.i32(), Construct(ty.i32())); auto* stmt = Decl(var); - Func("func", ast::VariableList{}, ty.void_(), {stmt}, ast::AttributeList{}); + Func("func", utils::Empty, ty.void_(), utils::Vector{stmt}); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1759,12 +1756,9 @@ TEST_F(ResolverTest, StorageClass_DoesNotSetOnConst) { TEST_F(ResolverTest, Access_SetForStorageBuffer) { // struct S { x : i32 }; // var g : S; - auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())}); - auto* var = Global(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, - ast::AttributeList{ - create(0), - create(0), - }); + auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "x", ty.i32())}); + auto* var = GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, Binding(0), + Group(0)); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1774,12 +1768,8 @@ TEST_F(ResolverTest, Access_SetForStorageBuffer) { TEST_F(ResolverTest, BindingPoint_SetForResources) { // @group(1) @binding(2) var s1 : sampler; // @group(3) @binding(4) var s2 : sampler; - auto* s1 = Global( - Sym(), ty.sampler(ast::SamplerKind::kSampler), - ast::AttributeList{create(1), create(2)}); - auto* s2 = Global( - Sym(), ty.sampler(ast::SamplerKind::kSampler), - ast::AttributeList{create(3), create(4)}); + auto* s1 = GlobalVar(Sym(), ty.sampler(ast::SamplerKind::kSampler), Group(1), Binding(2)); + auto* s2 = GlobalVar(Sym(), ty.sampler(ast::SamplerKind::kSampler), Group(3), Binding(4)); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1800,32 +1790,46 @@ TEST_F(ResolverTest, Function_EntryPoints_StageAttribute) { // ep_1 -> {} // ep_2 -> {} - Global("first", ty.f32(), ast::StorageClass::kPrivate); - Global("second", ty.f32(), ast::StorageClass::kPrivate); - Global("call_a", ty.f32(), ast::StorageClass::kPrivate); - Global("call_b", ty.f32(), ast::StorageClass::kPrivate); - Global("call_c", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("first", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("second", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("call_a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("call_b", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("call_c", ty.f32(), ast::StorageClass::kPrivate); - ast::VariableList params; - auto* func_b = Func("b", params, ty.f32(), {Return(0.0f)}, ast::AttributeList{}); - auto* func_c = Func("c", params, ty.f32(), {Assign("second", Call("b")), Return(0.0f)}, - ast::AttributeList{}); + auto* func_b = Func("b", utils::Empty, ty.f32(), + utils::Vector{ + Return(0_f), + }); + auto* func_c = Func("c", utils::Empty, ty.f32(), + utils::Vector{ + Assign("second", Call("b")), + Return(0_f), + }); - auto* func_a = Func("a", params, ty.f32(), {Assign("first", Call("c")), Return(0.0f)}, - ast::AttributeList{}); + auto* func_a = Func("a", utils::Empty, ty.f32(), + utils::Vector{ + Assign("first", Call("c")), + Return(0_f), + }); - auto* ep_1 = Func("ep_1", params, ty.void_(), - { + auto* ep_1 = Func("ep_1", utils::Empty, ty.void_(), + utils::Vector{ Assign("call_a", Call("a")), Assign("call_b", Call("b")), }, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); - auto* ep_2 = Func("ep_2", params, ty.void_(), - { + auto* ep_2 = Func("ep_2", utils::Empty, ty.void_(), + utils::Vector{ Assign("call_c", Call("c")), }, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1840,9 +1844,9 @@ TEST_F(ResolverTest, Function_EntryPoints_StageAttribute) { ASSERT_NE(ep_1_sem, nullptr); ASSERT_NE(ep_2_sem, nullptr); - EXPECT_EQ(func_b_sem->Parameters().size(), 0u); - EXPECT_EQ(func_a_sem->Parameters().size(), 0u); - EXPECT_EQ(func_c_sem->Parameters().size(), 0u); + EXPECT_EQ(func_b_sem->Parameters().Length(), 0u); + EXPECT_EQ(func_a_sem->Parameters().Length(), 0u); + EXPECT_EQ(func_c_sem->Parameters().Length(), 0u); const auto& b_eps = func_b_sem->AncestorEntryPoints(); ASSERT_EQ(2u, b_eps.size()); @@ -1879,38 +1883,38 @@ TEST_F(ResolverTest, Function_EntryPoints_LinearTime) { auto fn_a = [](int level) { return "l" + std::to_string(level + 1) + "a"; }; auto fn_b = [](int level) { return "l" + std::to_string(level + 1) + "b"; }; - Func(fn_a(levels), {}, ty.void_(), {}, {}); - Func(fn_b(levels), {}, ty.void_(), {}, {}); + Func(fn_a(levels), utils::Empty, ty.void_(), utils::Empty); + Func(fn_b(levels), utils::Empty, ty.void_(), utils::Empty); for (int i = levels - 1; i >= 0; i--) { - Func(fn_a(i), {}, ty.void_(), - { + Func(fn_a(i), utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call(fn_a(i + 1))), CallStmt(Call(fn_b(i + 1))), }, - {}); - Func(fn_b(i), {}, ty.void_(), - { + utils::Empty); + Func(fn_b(i), utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call(fn_a(i + 1))), CallStmt(Call(fn_b(i + 1))), }, - {}); + utils::Empty); } - Func("main", {}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call(fn_a(0))), CallStmt(Call(fn_b(0))), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); } // Test for crbug.com/tint/728 TEST_F(ResolverTest, ASTNodesAreReached) { - Structure("A", {Member("x", ty.array(4))}); - Structure("B", {Member("x", ty.array(4))}); + Structure("A", utils::Vector{Member("x", ty.array(4))}); + Structure("B", utils::Vector{Member("x", ty.array(4))}); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -1930,8 +1934,8 @@ TEST_F(ResolverTest, ASTNodeReachedTwice) { { ProgramBuilder b; auto* expr = b.Expr(1_i); - b.Global("a", b.ty.i32(), ast::StorageClass::kPrivate, expr); - b.Global("b", b.ty.i32(), ast::StorageClass::kPrivate, expr); + b.GlobalVar("a", b.ty.i32(), ast::StorageClass::kPrivate, expr); + b.GlobalVar("b", b.ty.i32(), ast::StorageClass::kPrivate, expr); Resolver(&b).Resolve(); }, "internal compiler error: AST node 'tint::ast::IntLiteralExpression' was encountered twice " @@ -1939,135 +1943,141 @@ TEST_F(ResolverTest, ASTNodeReachedTwice) { } TEST_F(ResolverTest, UnaryOp_Not) { - Global("ident", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("ident", ty.vec4(), ast::StorageClass::kPrivate); auto* der = create(ast::UnaryOp::kNot, Expr(Source{{12, 34}}, "ident")); WrapInFunction(der); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: cannot logical negate expression of type 'vec4"); + EXPECT_THAT(r()->error(), HasSubstr("error: no matching overload for operator ! (vec4)")); } TEST_F(ResolverTest, UnaryOp_Complement) { - Global("ident", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("ident", ty.vec4(), ast::StorageClass::kPrivate); auto* der = create(ast::UnaryOp::kComplement, Expr(Source{{12, 34}}, "ident")); WrapInFunction(der); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: cannot bitwise complement expression of type 'vec4"); + EXPECT_THAT(r()->error(), HasSubstr("error: no matching overload for operator ~ (vec4)")); } TEST_F(ResolverTest, UnaryOp_Negation) { - Global("ident", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("ident", ty.u32(), ast::StorageClass::kPrivate); auto* der = create(ast::UnaryOp::kNegation, Expr(Source{{12, 34}}, "ident")); WrapInFunction(der); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: cannot negate expression of type 'u32"); + EXPECT_THAT(r()->error(), HasSubstr("error: no matching overload for operator - (u32)")); } TEST_F(ResolverTest, TextureSampler_TextureSample) { - Global("t", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), GroupAndBinding(1, 1)); - Global("s", ty.sampler(ast::SamplerKind::kSampler), GroupAndBinding(1, 2)); + GlobalVar("t", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), Group(1), Binding(1)); + GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(1), Binding(2)); - auto* call = CallStmt(Call("textureSample", "t", "s", vec2(1.0f, 2.0f))); - const ast::Function* f = - Func("test_function", {}, ty.void_(), {call}, {Stage(ast::PipelineStage::kFragment)}); + auto* call = CallStmt(Call("textureSample", "t", "s", vec2(1_f, 2_f))); + const ast::Function* f = Func("test_function", utils::Empty, ty.void_(), utils::Vector{call}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); const sem::Function* sf = Sem().Get(f); auto pairs = sf->TextureSamplerPairs(); - ASSERT_EQ(pairs.size(), 1u); + ASSERT_EQ(pairs.Length(), 1u); EXPECT_TRUE(pairs[0].first != nullptr); EXPECT_TRUE(pairs[0].second != nullptr); } TEST_F(ResolverTest, TextureSampler_TextureSampleInFunction) { - Global("t", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), GroupAndBinding(1, 1)); - Global("s", ty.sampler(ast::SamplerKind::kSampler), GroupAndBinding(1, 2)); + GlobalVar("t", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), Group(1), Binding(1)); + GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(1), Binding(2)); - auto* inner_call = CallStmt(Call("textureSample", "t", "s", vec2(1.0f, 2.0f))); - const ast::Function* inner_func = Func("inner_func", {}, ty.void_(), {inner_call}); + auto* inner_call = CallStmt(Call("textureSample", "t", "s", vec2(1_f, 2_f))); + const ast::Function* inner_func = + Func("inner_func", utils::Empty, ty.void_(), utils::Vector{inner_call}); auto* outer_call = CallStmt(Call("inner_func")); const ast::Function* outer_func = - Func("outer_func", {}, ty.void_(), {outer_call}, {Stage(ast::PipelineStage::kFragment)}); + Func("outer_func", utils::Empty, ty.void_(), utils::Vector{outer_call}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); auto inner_pairs = Sem().Get(inner_func)->TextureSamplerPairs(); - ASSERT_EQ(inner_pairs.size(), 1u); + ASSERT_EQ(inner_pairs.Length(), 1u); EXPECT_TRUE(inner_pairs[0].first != nullptr); EXPECT_TRUE(inner_pairs[0].second != nullptr); auto outer_pairs = Sem().Get(outer_func)->TextureSamplerPairs(); - ASSERT_EQ(outer_pairs.size(), 1u); + ASSERT_EQ(outer_pairs.Length(), 1u); EXPECT_TRUE(outer_pairs[0].first != nullptr); EXPECT_TRUE(outer_pairs[0].second != nullptr); } TEST_F(ResolverTest, TextureSampler_TextureSampleFunctionDiamondSameVariables) { - Global("t", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), GroupAndBinding(1, 1)); - Global("s", ty.sampler(ast::SamplerKind::kSampler), GroupAndBinding(1, 2)); + GlobalVar("t", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), Group(1), Binding(1)); + GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(1), Binding(2)); - auto* inner_call_1 = CallStmt(Call("textureSample", "t", "s", vec2(1.0f, 2.0f))); - const ast::Function* inner_func_1 = Func("inner_func_1", {}, ty.void_(), {inner_call_1}); - auto* inner_call_2 = CallStmt(Call("textureSample", "t", "s", vec2(3.0f, 4.0f))); - const ast::Function* inner_func_2 = Func("inner_func_2", {}, ty.void_(), {inner_call_2}); + auto* inner_call_1 = CallStmt(Call("textureSample", "t", "s", vec2(1_f, 2_f))); + const ast::Function* inner_func_1 = + Func("inner_func_1", utils::Empty, ty.void_(), utils::Vector{inner_call_1}); + auto* inner_call_2 = CallStmt(Call("textureSample", "t", "s", vec2(3_f, 4_f))); + const ast::Function* inner_func_2 = + Func("inner_func_2", utils::Empty, ty.void_(), utils::Vector{inner_call_2}); auto* outer_call_1 = CallStmt(Call("inner_func_1")); auto* outer_call_2 = CallStmt(Call("inner_func_2")); const ast::Function* outer_func = - Func("outer_func", {}, ty.void_(), {outer_call_1, outer_call_2}, - {Stage(ast::PipelineStage::kFragment)}); + Func("outer_func", utils::Empty, ty.void_(), utils::Vector{outer_call_1, outer_call_2}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); auto inner_pairs_1 = Sem().Get(inner_func_1)->TextureSamplerPairs(); - ASSERT_EQ(inner_pairs_1.size(), 1u); + ASSERT_EQ(inner_pairs_1.Length(), 1u); EXPECT_TRUE(inner_pairs_1[0].first != nullptr); EXPECT_TRUE(inner_pairs_1[0].second != nullptr); auto inner_pairs_2 = Sem().Get(inner_func_2)->TextureSamplerPairs(); - ASSERT_EQ(inner_pairs_1.size(), 1u); + ASSERT_EQ(inner_pairs_1.Length(), 1u); EXPECT_TRUE(inner_pairs_2[0].first != nullptr); EXPECT_TRUE(inner_pairs_2[0].second != nullptr); auto outer_pairs = Sem().Get(outer_func)->TextureSamplerPairs(); - ASSERT_EQ(outer_pairs.size(), 1u); + ASSERT_EQ(outer_pairs.Length(), 1u); EXPECT_TRUE(outer_pairs[0].first != nullptr); EXPECT_TRUE(outer_pairs[0].second != nullptr); } TEST_F(ResolverTest, TextureSampler_TextureSampleFunctionDiamondDifferentVariables) { - Global("t1", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), GroupAndBinding(1, 1)); - Global("t2", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), GroupAndBinding(1, 2)); - Global("s", ty.sampler(ast::SamplerKind::kSampler), GroupAndBinding(1, 3)); + GlobalVar("t1", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), Group(1), Binding(1)); + GlobalVar("t2", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), Group(1), Binding(2)); + GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(1), Binding(3)); - auto* inner_call_1 = CallStmt(Call("textureSample", "t1", "s", vec2(1.0f, 2.0f))); - const ast::Function* inner_func_1 = Func("inner_func_1", {}, ty.void_(), {inner_call_1}); - auto* inner_call_2 = CallStmt(Call("textureSample", "t2", "s", vec2(3.0f, 4.0f))); - const ast::Function* inner_func_2 = Func("inner_func_2", {}, ty.void_(), {inner_call_2}); + auto* inner_call_1 = CallStmt(Call("textureSample", "t1", "s", vec2(1_f, 2_f))); + const ast::Function* inner_func_1 = + Func("inner_func_1", utils::Empty, ty.void_(), utils::Vector{inner_call_1}); + auto* inner_call_2 = CallStmt(Call("textureSample", "t2", "s", vec2(3_f, 4_f))); + const ast::Function* inner_func_2 = + Func("inner_func_2", utils::Empty, ty.void_(), utils::Vector{inner_call_2}); auto* outer_call_1 = CallStmt(Call("inner_func_1")); auto* outer_call_2 = CallStmt(Call("inner_func_2")); const ast::Function* outer_func = - Func("outer_func", {}, ty.void_(), {outer_call_1, outer_call_2}, - {Stage(ast::PipelineStage::kFragment)}); + Func("outer_func", utils::Empty, ty.void_(), utils::Vector{outer_call_1, outer_call_2}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); auto inner_pairs_1 = Sem().Get(inner_func_1)->TextureSamplerPairs(); - ASSERT_EQ(inner_pairs_1.size(), 1u); + ASSERT_EQ(inner_pairs_1.Length(), 1u); EXPECT_TRUE(inner_pairs_1[0].first != nullptr); EXPECT_TRUE(inner_pairs_1[0].second != nullptr); auto inner_pairs_2 = Sem().Get(inner_func_2)->TextureSamplerPairs(); - ASSERT_EQ(inner_pairs_2.size(), 1u); + ASSERT_EQ(inner_pairs_2.Length(), 1u); EXPECT_TRUE(inner_pairs_2[0].first != nullptr); EXPECT_TRUE(inner_pairs_2[0].second != nullptr); auto outer_pairs = Sem().Get(outer_func)->TextureSamplerPairs(); - ASSERT_EQ(outer_pairs.size(), 2u); + ASSERT_EQ(outer_pairs.Length(), 2u); EXPECT_TRUE(outer_pairs[0].first == inner_pairs_1[0].first); EXPECT_TRUE(outer_pairs[0].second == inner_pairs_1[0].second); EXPECT_TRUE(outer_pairs[1].first == inner_pairs_2[0].first); @@ -2075,7 +2085,7 @@ TEST_F(ResolverTest, TextureSampler_TextureSampleFunctionDiamondDifferentVariabl } TEST_F(ResolverTest, TextureSampler_TextureDimensions) { - Global("t", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), GroupAndBinding(1, 2)); + GlobalVar("t", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), Group(1), Binding(2)); auto* call = Call("textureDimensions", "t"); const ast::Function* f = WrapInFunction(call); @@ -2084,24 +2094,24 @@ TEST_F(ResolverTest, TextureSampler_TextureDimensions) { const sem::Function* sf = Sem().Get(f); auto pairs = sf->TextureSamplerPairs(); - ASSERT_EQ(pairs.size(), 1u); + ASSERT_EQ(pairs.Length(), 1u); EXPECT_TRUE(pairs[0].first != nullptr); EXPECT_TRUE(pairs[0].second == nullptr); } TEST_F(ResolverTest, ModuleDependencyOrderedDeclarations) { - auto* f0 = Func("f0", {}, ty.void_(), {}); - auto* v0 = Global("v0", ty.i32(), ast::StorageClass::kPrivate); + auto* f0 = Func("f0", utils::Empty, ty.void_(), utils::Empty); + auto* v0 = GlobalVar("v0", ty.i32(), ast::StorageClass::kPrivate); auto* a0 = Alias("a0", ty.i32()); - auto* s0 = Structure("s0", {Member("m", ty.i32())}); - auto* f1 = Func("f1", {}, ty.void_(), {}); - auto* v1 = Global("v1", ty.i32(), ast::StorageClass::kPrivate); + auto* s0 = Structure("s0", utils::Vector{Member("m", ty.i32())}); + auto* f1 = Func("f1", utils::Empty, ty.void_(), utils::Empty); + auto* v1 = GlobalVar("v1", ty.i32(), ast::StorageClass::kPrivate); auto* a1 = Alias("a1", ty.i32()); - auto* s1 = Structure("s1", {Member("m", ty.i32())}); - auto* f2 = Func("f2", {}, ty.void_(), {}); - auto* v2 = Global("v2", ty.i32(), ast::StorageClass::kPrivate); + auto* s1 = Structure("s1", utils::Vector{Member("m", ty.i32())}); + auto* f2 = Func("f2", utils::Empty, ty.void_(), utils::Empty); + auto* v2 = GlobalVar("v2", ty.i32(), ast::StorageClass::kPrivate); auto* a2 = Alias("a2", ty.i32()); - auto* s2 = Structure("s2", {Member("m", ty.i32())}); + auto* s2 = Structure("s2", utils::Vector{Member("m", ty.i32())}); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -2110,5 +2120,50 @@ TEST_F(ResolverTest, ModuleDependencyOrderedDeclarations) { ElementsAre(f0, v0, a0, s0, f1, v1, a1, s1, f2, v2, a2, s2)); } +constexpr size_t kMaxExpressionDepth = 512U; + +TEST_F(ResolverTest, MaxExpressionDepth_Pass) { + auto* b = Var("b", ty.i32()); + const ast::Expression* chain = nullptr; + for (size_t i = 0; i < kMaxExpressionDepth; ++i) { + chain = Add(chain ? chain : Expr("b"), Expr("b")); + } + auto* a = Let("a", chain); + WrapInFunction(b, a); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverTest, MaxExpressionDepth_Fail) { + auto* b = Var("b", ty.i32()); + const ast::Expression* chain = nullptr; + for (size_t i = 0; i < kMaxExpressionDepth + 1; ++i) { + chain = Add(chain ? chain : Expr("b"), Expr("b")); + } + auto* a = Let("a", chain); + WrapInFunction(b, a); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_THAT(r()->error(), HasSubstr("error: reached max expression depth of " + + std::to_string(kMaxExpressionDepth))); +} + +TEST_F(ResolverTest, Literal_F16WithoutExtension) { + // fn test() {_ = 1.23h;} + WrapInFunction(Ignore(Expr(f16(1.23f)))); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_THAT(r()->error(), HasSubstr("error: f16 literal used without 'f16' extension enabled")); +} + +TEST_F(ResolverTest, Literal_F16WithExtension) { + // enable f16; + // fn test() {_ = 1.23h;} + Enable(ast::Extension::kF16); + WrapInFunction(Ignore(Expr(f16(1.23f)))); + + EXPECT_TRUE(r()->Resolve()); +} + } // namespace } // namespace tint::resolver diff --git a/src/tint/resolver/resolver_test_helper.h b/src/tint/resolver/resolver_test_helper.h index d54e57c6b0..bab1d843aa 100644 --- a/src/tint/resolver/resolver_test_helper.h +++ b/src/tint/resolver/resolver_test_helper.h @@ -15,16 +15,19 @@ #ifndef SRC_TINT_RESOLVER_RESOLVER_TEST_HELPER_H_ #define SRC_TINT_RESOLVER_RESOLVER_TEST_HELPER_H_ +#include #include #include -#include #include "gtest/gtest.h" #include "src/tint/program_builder.h" #include "src/tint/resolver/resolver.h" +#include "src/tint/sem/abstract_float.h" +#include "src/tint/sem/abstract_int.h" #include "src/tint/sem/expression.h" #include "src/tint/sem/statement.h" #include "src/tint/sem/variable.h" +#include "src/tint/utils/vector.h" namespace tint::resolver { @@ -85,9 +88,9 @@ class TestHelper : public ProgramBuilder { /// @param expected_users the expected users of the variable /// @return true if all users are as expected bool CheckVarUsers(const ast::Variable* var, - std::vector&& expected_users) { + utils::VectorRef expected_users) { auto& var_users = Sem().Get(var)->Users(); - if (var_users.size() != expected_users.size()) { + if (var_users.size() != expected_users.Length()) { return false; } for (size_t i = 0; i < var_users.size(); i++) { @@ -168,15 +171,27 @@ template struct ptr {}; using ast_type_func_ptr = const ast::Type* (*)(ProgramBuilder& b); -using ast_expr_func_ptr = const ast::Expression* (*)(ProgramBuilder& b, int elem_value); +using ast_expr_func_ptr = const ast::Expression* (*)(ProgramBuilder& b, double elem_value); using sem_type_func_ptr = const sem::Type* (*)(ProgramBuilder& b); template struct DataType {}; +/// Helper that represents no-type. Returns nullptr for all static methods. +template <> +struct DataType { + /// @return nullptr + static inline const ast::Type* AST(ProgramBuilder&) { return nullptr; } + /// @return nullptr + static inline const sem::Type* Sem(ProgramBuilder&) { return nullptr; } +}; + /// Helper for building bool types and expressions template <> struct DataType { + /// The element type + using ElementType = bool; + /// false as bool is not a composite type static constexpr bool is_composite = false; @@ -189,14 +204,19 @@ struct DataType { /// @param b the ProgramBuilder /// @param elem_value the b /// @return a new AST expression of the bool type - static inline const ast::Expression* Expr(ProgramBuilder& b, int elem_value) { - return b.Expr(elem_value == 0); + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { + return b.Expr(std::equal_to()(elem_value, 0)); } + /// @returns the WGSL name for the type + static inline std::string Name() { return "bool"; } }; /// Helper for building i32 types and expressions template <> struct DataType { + /// The element type + using ElementType = i32; + /// false as i32 is not a composite type static constexpr bool is_composite = false; @@ -209,14 +229,19 @@ struct DataType { /// @param b the ProgramBuilder /// @param elem_value the value i32 will be initialized with /// @return a new AST i32 literal value expression - static inline const ast::Expression* Expr(ProgramBuilder& b, int elem_value) { + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { return b.Expr(static_cast(elem_value)); } + /// @returns the WGSL name for the type + static inline std::string Name() { return "i32"; } }; /// Helper for building u32 types and expressions template <> struct DataType { + /// The element type + using ElementType = u32; + /// false as u32 is not a composite type static constexpr bool is_composite = false; @@ -229,14 +254,19 @@ struct DataType { /// @param b the ProgramBuilder /// @param elem_value the value u32 will be initialized with /// @return a new AST u32 literal value expression - static inline const ast::Expression* Expr(ProgramBuilder& b, int elem_value) { + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { return b.Expr(static_cast(elem_value)); } + /// @returns the WGSL name for the type + static inline std::string Name() { return "u32"; } }; /// Helper for building f32 types and expressions template <> struct DataType { + /// The element type + using ElementType = f32; + /// false as f32 is not a composite type static constexpr bool is_composite = false; @@ -249,14 +279,92 @@ struct DataType { /// @param b the ProgramBuilder /// @param elem_value the value f32 will be initialized with /// @return a new AST f32 literal value expression - static inline const ast::Expression* Expr(ProgramBuilder& b, int elem_value) { + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { return b.Expr(static_cast(elem_value)); } + /// @returns the WGSL name for the type + static inline std::string Name() { return "f32"; } +}; + +/// Helper for building f16 types and expressions +template <> +struct DataType { + /// The element type + using ElementType = f16; + + /// false as f16 is not a composite type + static constexpr bool is_composite = false; + + /// @param b the ProgramBuilder + /// @return a new AST f16 type + static inline const ast::Type* AST(ProgramBuilder& b) { return b.ty.f16(); } + /// @param b the ProgramBuilder + /// @return the semantic f16 type + static inline const sem::Type* Sem(ProgramBuilder& b) { return b.create(); } + /// @param b the ProgramBuilder + /// @param elem_value the value f16 will be initialized with + /// @return a new AST f16 literal value expression + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { + return b.Expr(static_cast(elem_value)); + } + /// @returns the WGSL name for the type + static inline std::string Name() { return "f16"; } +}; + +/// Helper for building abstract float types and expressions +template <> +struct DataType { + /// The element type + using ElementType = AFloat; + + /// false as AFloat is not a composite type + static constexpr bool is_composite = false; + + /// @returns nullptr, as abstract floats are un-typeable + static inline const ast::Type* AST(ProgramBuilder&) { return nullptr; } + /// @param b the ProgramBuilder + /// @return the semantic abstract-float type + static inline const sem::Type* Sem(ProgramBuilder& b) { return b.create(); } + /// @param b the ProgramBuilder + /// @param elem_value the value the abstract-float literal will be constructed with + /// @return a new AST abstract-float literal value expression + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { + return b.Expr(AFloat(elem_value)); + } + /// @returns the WGSL name for the type + static inline std::string Name() { return "abstract-float"; } +}; + +/// Helper for building abstract integer types and expressions +template <> +struct DataType { + /// The element type + using ElementType = AInt; + + /// false as AFloat is not a composite type + static constexpr bool is_composite = false; + + /// @returns nullptr, as abstract integers are un-typeable + static inline const ast::Type* AST(ProgramBuilder&) { return nullptr; } + /// @param b the ProgramBuilder + /// @return the semantic abstract-int type + static inline const sem::Type* Sem(ProgramBuilder& b) { return b.create(); } + /// @param b the ProgramBuilder + /// @param elem_value the value the abstract-int literal will be constructed with + /// @return a new AST abstract-int literal value expression + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { + return b.Expr(AInt(elem_value)); + } + /// @returns the WGSL name for the type + static inline std::string Name() { return "abstract-int"; } }; /// Helper for building vector types and expressions template struct DataType> { + /// The element type + using ElementType = T; + /// true as vectors are a composite type static constexpr bool is_composite = true; @@ -274,25 +382,32 @@ struct DataType> { /// @param elem_value the value each element in the vector will be initialized /// with /// @return a new AST vector value expression - static inline const ast::Expression* Expr(ProgramBuilder& b, int elem_value) { + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { return b.Construct(AST(b), ExprArgs(b, elem_value)); } /// @param b the ProgramBuilder /// @param elem_value the value each element will be initialized with /// @return the list of expressions that are used to construct the vector - static inline ast::ExpressionList ExprArgs(ProgramBuilder& b, int elem_value) { - ast::ExpressionList args; + static inline auto ExprArgs(ProgramBuilder& b, double elem_value) { + utils::Vector args; for (uint32_t i = 0; i < N; i++) { - args.emplace_back(DataType::Expr(b, elem_value)); + args.Push(DataType::Expr(b, elem_value)); } return args; } + /// @returns the WGSL name for the type + static inline std::string Name() { + return "vec" + std::to_string(N) + "<" + DataType::Name() + ">"; + } }; /// Helper for building matrix types and expressions template struct DataType> { + /// The element type + using ElementType = T; + /// true as matrices are a composite type static constexpr bool is_composite = true; @@ -311,25 +426,33 @@ struct DataType> { /// @param elem_value the value each element in the matrix will be initialized /// with /// @return a new AST matrix value expression - static inline const ast::Expression* Expr(ProgramBuilder& b, int elem_value) { + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { return b.Construct(AST(b), ExprArgs(b, elem_value)); } /// @param b the ProgramBuilder /// @param elem_value the value each element will be initialized with /// @return the list of expressions that are used to construct the matrix - static inline ast::ExpressionList ExprArgs(ProgramBuilder& b, int elem_value) { - ast::ExpressionList args; + static inline auto ExprArgs(ProgramBuilder& b, double elem_value) { + utils::Vector args; for (uint32_t i = 0; i < N; i++) { - args.emplace_back(DataType>::Expr(b, elem_value)); + args.Push(DataType>::Expr(b, elem_value)); } return args; } + /// @returns the WGSL name for the type + static inline std::string Name() { + return "mat" + std::to_string(N) + "x" + std::to_string(M) + "<" + DataType::Name() + + ">"; + } }; /// Helper for building alias types and expressions template struct DataType> { + /// The element type + using ElementType = T; + /// true if the aliased type is a composite type static constexpr bool is_composite = DataType::is_composite; @@ -352,7 +475,7 @@ struct DataType> { /// @return a new AST expression of the alias type template static inline traits::EnableIf Expr(ProgramBuilder& b, - int elem_value) { + double elem_value) { // Cast return b.Construct(AST(b), DataType::Expr(b, elem_value)); } @@ -362,15 +485,20 @@ struct DataType> { /// @return a new AST expression of the alias type template static inline traits::EnableIf Expr(ProgramBuilder& b, - int elem_value) { + double elem_value) { // Construct return b.Construct(AST(b), DataType::ExprArgs(b, elem_value)); } + /// @returns the WGSL name for the type + static inline std::string Name() { return "alias_" + std::to_string(ID); } }; /// Helper for building pointer types and expressions template struct DataType> { + /// The element type + using ElementType = T; + /// true if the pointer type is a composite type static constexpr bool is_composite = false; @@ -389,23 +517,31 @@ struct DataType> { /// @param b the ProgramBuilder /// @return a new AST expression of the alias type - static inline const ast::Expression* Expr(ProgramBuilder& b, int /*unused*/) { + static inline const ast::Expression* Expr(ProgramBuilder& b, double /*unused*/) { auto sym = b.Symbols().New("global_for_ptr"); - b.Global(sym, DataType::AST(b), ast::StorageClass::kPrivate); + b.GlobalVar(sym, DataType::AST(b), ast::StorageClass::kPrivate); return b.AddressOf(sym); } + /// @returns the WGSL name for the type + static inline std::string Name() { return "ptr<" + DataType::Name() + ">"; } }; /// Helper for building array types and expressions template struct DataType> { + /// The element type + using ElementType = T; + /// true as arrays are a composite type static constexpr bool is_composite = true; /// @param b the ProgramBuilder /// @return a new AST array type static inline const ast::Type* AST(ProgramBuilder& b) { - return b.ty.array(DataType::AST(b), u32(N)); + if (auto* ast = DataType::AST(b)) { + return b.ty.array(ast, u32(N)); + } + return b.ty.array(nullptr, nullptr); } /// @param b the ProgramBuilder /// @return the semantic array type @@ -415,7 +551,7 @@ struct DataType> { /* element */ el, /* count */ N, /* align */ el->Align(), - /* size */ el->Size(), + /* size */ N * el->Size(), /* stride */ el->Align(), /* implicit_stride */ el->Align()); } @@ -423,20 +559,24 @@ struct DataType> { /// @param elem_value the value each element in the array will be initialized /// with /// @return a new AST array value expression - static inline const ast::Expression* Expr(ProgramBuilder& b, int elem_value) { + static inline const ast::Expression* Expr(ProgramBuilder& b, double elem_value) { return b.Construct(AST(b), ExprArgs(b, elem_value)); } /// @param b the ProgramBuilder /// @param elem_value the value each element will be initialized with /// @return the list of expressions that are used to construct the array - static inline ast::ExpressionList ExprArgs(ProgramBuilder& b, int elem_value) { - ast::ExpressionList args; + static inline auto ExprArgs(ProgramBuilder& b, double elem_value) { + utils::Vector args; for (uint32_t i = 0; i < N; i++) { - args.emplace_back(DataType::Expr(b, elem_value)); + args.Push(DataType::Expr(b, elem_value)); } return args; } + /// @returns the WGSL name for the type + static inline std::string Name() { + return "array<" + DataType::Name() + ", " + std::to_string(N) + ">"; + } }; /// Struct of all creation pointer types diff --git a/src/tint/resolver/side_effects_test.cc b/src/tint/resolver/side_effects_test.cc index a50d9045f4..9a7bd9f163 100644 --- a/src/tint/resolver/side_effects_test.cc +++ b/src/tint/resolver/side_effects_test.cc @@ -17,7 +17,9 @@ #include "gtest/gtest.h" #include "src/tint/resolver/resolver_test_helper.h" #include "src/tint/sem/expression.h" +#include "src/tint/sem/index_accessor_expression.h" #include "src/tint/sem/member_accessor_expression.h" +#include "src/tint/utils/vector.h" using namespace tint::number_suffixes; // NOLINT @@ -28,10 +30,10 @@ struct SideEffectsTest : ResolverTest { template void MakeSideEffectFunc(const char* name) { auto global = Sym(); - Global(global, ty.Of(), ast::StorageClass::kPrivate); + GlobalVar(global, ty.Of(), ast::StorageClass::kPrivate); auto local = Sym(); - Func(name, {}, ty.Of(), - { + Func(name, utils::Empty, ty.Of(), + utils::Vector{ Decl(Var(local, ty.Of())), Assign(global, local), Return(global), @@ -41,10 +43,10 @@ struct SideEffectsTest : ResolverTest { template void MakeSideEffectFunc(const char* name, MAKE_TYPE_FUNC make_type) { auto global = Sym(); - Global(global, make_type(), ast::StorageClass::kPrivate); + GlobalVar(global, make_type(), ast::StorageClass::kPrivate); auto local = Sym(); - Func(name, {}, make_type(), - { + Func(name, utils::Empty, make_type(), + utils::Vector{ Decl(Var(local, make_type())), Assign(global, local), Return(global), @@ -86,10 +88,10 @@ TEST_F(SideEffectsTest, VariableUser) { } TEST_F(SideEffectsTest, Call_Builtin_NoSE) { - Global("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); auto* expr = Call("dpdx", "a"); - Func("f", {}, ty.void_(), {Ignore(expr)}, - {create(ast::PipelineStage::kFragment)}); + Func("f", utils::Empty, ty.void_(), utils::Vector{Ignore(expr)}, + utils::Vector{create(ast::PipelineStage::kFragment)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); auto* sem = Sem().Get(expr); @@ -101,8 +103,8 @@ TEST_F(SideEffectsTest, Call_Builtin_NoSE) { TEST_F(SideEffectsTest, Call_Builtin_NoSE_WithSEArg) { MakeSideEffectFunc("se"); auto* expr = Call("dpdx", Call("se")); - Func("f", {}, ty.void_(), {Ignore(expr)}, - {create(ast::PipelineStage::kFragment)}); + Func("f", utils::Empty, ty.void_(), utils::Vector{Ignore(expr)}, + utils::Vector{create(ast::PipelineStage::kFragment)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); auto* sem = Sem().Get(expr); @@ -112,7 +114,7 @@ TEST_F(SideEffectsTest, Call_Builtin_NoSE_WithSEArg) { } TEST_F(SideEffectsTest, Call_Builtin_SE) { - Global("a", ty.atomic(ty.i32()), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.atomic(ty.i32()), ast::StorageClass::kWorkgroup); auto* expr = Call("atomicAdd", AddressOf("a"), 1_i); WrapInFunction(expr); @@ -123,8 +125,229 @@ TEST_F(SideEffectsTest, Call_Builtin_SE) { EXPECT_TRUE(sem->HasSideEffects()); } +namespace builtin { +struct Case { + const char* name; + utils::Vector args; + bool has_side_effects; + ast::PipelineStage pipeline_stage; +}; +static Case C(const char* name, + utils::VectorRef args, + bool has_side_effects, + ast::PipelineStage stage = ast::PipelineStage::kFragment) { + Case c; + c.name = name; + c.args = std::move(args); + c.has_side_effects = has_side_effects; + c.pipeline_stage = stage; + return c; +} +static std::ostream& operator<<(std::ostream& o, const Case& c) { + o << c.name << "("; + for (size_t i = 0; i < c.args.Length(); ++i) { + o << c.args[i]; + if (i + 1 != c.args.Length()) { + o << ", "; + } + } + o << "), "; + o << "has_side_effects = " << c.has_side_effects; + return o; +} + +using SideEffectsBuiltinTest = resolver::ResolverTestWithParam; + +TEST_P(SideEffectsBuiltinTest, Test) { + Enable(ast::Extension::kChromiumExperimentalDp4A); + auto& c = GetParam(); + + uint32_t next_binding = 0; + GlobalVar("f", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("i", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("u", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("vf", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("vf2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("vi2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("vf4", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("vb", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("m", ty.mat3x3(), ast::StorageClass::kPrivate); + GlobalVar("arr", ty.array(), ast::StorageClass::kPrivate); + GlobalVar("storage_arr", ty.array(), ast::StorageClass::kStorage, Group(0), + Binding(next_binding++)); + GlobalVar("a", ty.atomic(ty.i32()), ast::StorageClass::kStorage, ast::Access::kReadWrite, + Group(0), Binding(next_binding++)); + if (c.pipeline_stage != ast::PipelineStage::kCompute) { + GlobalVar("t2d", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), Group(0), + Binding(next_binding++)); + GlobalVar("tdepth2d", ty.depth_texture(ast::TextureDimension::k2d), Group(0), + Binding(next_binding++)); + GlobalVar("t2d_arr", ty.sampled_texture(ast::TextureDimension::k2dArray, ty.f32()), + Group(0), Binding(next_binding++)); + GlobalVar("t2d_multi", ty.multisampled_texture(ast::TextureDimension::k2d, ty.f32()), + Group(0), Binding(next_binding++)); + GlobalVar("tstorage2d", + ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Float, + ast::Access::kWrite), + Group(0), Binding(next_binding++)); + GlobalVar("s2d", ty.sampler(ast::SamplerKind::kSampler), Group(0), Binding(next_binding++)); + GlobalVar("scomp", ty.sampler(ast::SamplerKind::kComparisonSampler), Group(0), + Binding(next_binding++)); + } + + utils::Vector stmts; + stmts.Push(Decl(Let("pstorage_arr", AddressOf("storage_arr")))); + stmts.Push(Decl(Let("pa", AddressOf("a")))); + + utils::Vector args; + for (auto& a : c.args) { + args.Push(Expr(a)); + } + auto* expr = Call(c.name, args); + + utils::Vector attrs; + attrs.Push(create(c.pipeline_stage)); + if (c.pipeline_stage == ast::PipelineStage::kCompute) { + attrs.Push(WorkgroupSize(Expr(1_u))); + } + + stmts.Push(create(expr)); + + Func("func", utils::Empty, ty.void_(), stmts, attrs); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + auto* sem = Sem().Get(expr); + ASSERT_NE(sem, nullptr); + EXPECT_TRUE(sem->Is()); + EXPECT_EQ(c.has_side_effects, sem->HasSideEffects()); +} +INSTANTIATE_TEST_SUITE_P( + SideEffectsTest_Builtins, + SideEffectsBuiltinTest, + testing::ValuesIn(std::vector{ + // No side-effect builts + C("abs", utils::Vector{"f"}, false), // + C("acos", utils::Vector{"f"}, false), // + C("acosh", utils::Vector{"f"}, false), // + C("all", utils::Vector{"vb"}, false), // + C("any", utils::Vector{"vb"}, false), // + C("arrayLength", utils::Vector{"pstorage_arr"}, false), // + C("asin", utils::Vector{"f"}, false), // + C("asinh", utils::Vector{"f"}, false), // + C("atan", utils::Vector{"f"}, false), // + C("atan2", utils::Vector{"f", "f"}, false), // + C("atanh", utils::Vector{"f"}, false), // + C("atomicLoad", utils::Vector{"pa"}, false), // + C("ceil", utils::Vector{"f"}, false), // + C("clamp", utils::Vector{"f", "f", "f"}, false), // + C("cos", utils::Vector{"f"}, false), // + C("cosh", utils::Vector{"f"}, false), // + C("countLeadingZeros", utils::Vector{"i"}, false), // + C("countOneBits", utils::Vector{"i"}, false), // + C("countTrailingZeros", utils::Vector{"i"}, false), // + C("cross", utils::Vector{"vf", "vf"}, false), // + C("degrees", utils::Vector{"f"}, false), // + C("determinant", utils::Vector{"m"}, false), // + C("distance", utils::Vector{"f", "f"}, false), // + C("dot", utils::Vector{"vf", "vf"}, false), // + C("dot4I8Packed", utils::Vector{"u", "u"}, false), // + C("dot4U8Packed", utils::Vector{"u", "u"}, false), // + C("exp", utils::Vector{"f"}, false), // + C("exp2", utils::Vector{"f"}, false), // + C("extractBits", utils::Vector{"i", "u", "u"}, false), // + C("faceForward", utils::Vector{"vf", "vf", "vf"}, false), // + C("firstLeadingBit", utils::Vector{"u"}, false), // + C("firstTrailingBit", utils::Vector{"u"}, false), // + C("floor", utils::Vector{"f"}, false), // + C("fma", utils::Vector{"f", "f", "f"}, false), // + C("fract", utils::Vector{"vf"}, false), // + C("frexp", utils::Vector{"f"}, false), // + C("insertBits", utils::Vector{"i", "i", "u", "u"}, false), // + C("inverseSqrt", utils::Vector{"f"}, false), // + C("ldexp", utils::Vector{"f", "i"}, false), // + C("length", utils::Vector{"vf"}, false), // + C("log", utils::Vector{"f"}, false), // + C("log2", utils::Vector{"f"}, false), // + C("max", utils::Vector{"f", "f"}, false), // + C("min", utils::Vector{"f", "f"}, false), // + C("mix", utils::Vector{"f", "f", "f"}, false), // + C("modf", utils::Vector{"f"}, false), // + C("normalize", utils::Vector{"vf"}, false), // + C("pack2x16float", utils::Vector{"vf2"}, false), // + C("pack2x16snorm", utils::Vector{"vf2"}, false), // + C("pack2x16unorm", utils::Vector{"vf2"}, false), // + C("pack4x8snorm", utils::Vector{"vf4"}, false), // + C("pack4x8unorm", utils::Vector{"vf4"}, false), // + C("pow", utils::Vector{"f", "f"}, false), // + C("radians", utils::Vector{"f"}, false), // + C("reflect", utils::Vector{"vf", "vf"}, false), // + C("refract", utils::Vector{"vf", "vf", "f"}, false), // + C("reverseBits", utils::Vector{"u"}, false), // + C("round", utils::Vector{"f"}, false), // + C("select", utils::Vector{"f", "f", "b"}, false), // + C("sign", utils::Vector{"f"}, false), // + C("sin", utils::Vector{"f"}, false), // + C("sinh", utils::Vector{"f"}, false), // + C("smoothstep", utils::Vector{"f", "f", "f"}, false), // + C("sqrt", utils::Vector{"f"}, false), // + C("step", utils::Vector{"f", "f"}, false), // + C("tan", utils::Vector{"f"}, false), // + C("tanh", utils::Vector{"f"}, false), // + C("textureDimensions", utils::Vector{"t2d"}, false), // + C("textureGather", utils::Vector{"tdepth2d", "s2d", "vf2"}, false), // + C("textureGatherCompare", utils::Vector{"tdepth2d", "scomp", "vf2", "f"}, false), // + C("textureLoad", utils::Vector{"t2d", "vi2", "i"}, false), // + C("textureNumLayers", utils::Vector{"t2d_arr"}, false), // + C("textureNumLevels", utils::Vector{"t2d"}, false), // + C("textureNumSamples", utils::Vector{"t2d_multi"}, false), // + C("textureSampleCompareLevel", utils::Vector{"tdepth2d", "scomp", "vf2", "f"}, false), // + C("textureSampleGrad", utils::Vector{"t2d", "s2d", "vf2", "vf2", "vf2"}, false), // + C("textureSampleLevel", utils::Vector{"t2d", "s2d", "vf2", "f"}, false), // + C("transpose", utils::Vector{"m"}, false), // + C("trunc", utils::Vector{"f"}, false), // + C("unpack2x16float", utils::Vector{"u"}, false), // + C("unpack2x16snorm", utils::Vector{"u"}, false), // + C("unpack2x16unorm", utils::Vector{"u"}, false), // + C("unpack4x8snorm", utils::Vector{"u"}, false), // + C("unpack4x8unorm", utils::Vector{"u"}, false), // + C("storageBarrier", utils::Empty, false, ast::PipelineStage::kCompute), // + C("workgroupBarrier", utils::Empty, false, ast::PipelineStage::kCompute), // + C("textureSample", utils::Vector{"t2d", "s2d", "vf2"}, false), // + C("textureSampleBias", utils::Vector{"t2d", "s2d", "vf2", "f"}, false), // + C("textureSampleCompare", utils::Vector{"tdepth2d", "scomp", "vf2", "f"}, false), // + C("dpdx", utils::Vector{"f"}, false), // + C("dpdxCoarse", utils::Vector{"f"}, false), // + C("dpdxFine", utils::Vector{"f"}, false), // + C("dpdy", utils::Vector{"f"}, false), // + C("dpdyCoarse", utils::Vector{"f"}, false), // + C("dpdyFine", utils::Vector{"f"}, false), // + C("fwidth", utils::Vector{"f"}, false), // + C("fwidthCoarse", utils::Vector{"f"}, false), // + C("fwidthFine", utils::Vector{"f"}, false), // + + // Side-effect builtins + C("atomicAdd", utils::Vector{"pa", "i"}, true), // + C("atomicAnd", utils::Vector{"pa", "i"}, true), // + C("atomicCompareExchangeWeak", utils::Vector{"pa", "i", "i"}, true), // + C("atomicExchange", utils::Vector{"pa", "i"}, true), // + C("atomicMax", utils::Vector{"pa", "i"}, true), // + C("atomicMin", utils::Vector{"pa", "i"}, true), // + C("atomicOr", utils::Vector{"pa", "i"}, true), // + C("atomicStore", utils::Vector{"pa", "i"}, true), // + C("atomicSub", utils::Vector{"pa", "i"}, true), // + C("atomicXor", utils::Vector{"pa", "i"}, true), // + C("textureStore", utils::Vector{"tstorage2d", "vi2", "vf4"}, true), // + + // Unimplemented builtins + // C("quantizeToF16", utils::Vector{"f"}, false), // + // C("saturate", utils::Vector{"f"}, false), // + })); + +} // namespace builtin + TEST_F(SideEffectsTest, Call_Function) { - Func("f", {}, ty.i32(), {Return(1_i)}); + Func("f", utils::Empty, ty.i32(), utils::Vector{Return(1_i)}); auto* expr = Call("f"); WrapInFunction(expr); @@ -184,7 +407,7 @@ TEST_F(SideEffectsTest, Call_TypeConstructor_SE) { } TEST_F(SideEffectsTest, MemberAccessor_Struct_NoSE) { - auto* s = Structure("S", {Member("m", ty.i32())}); + auto* s = Structure("S", utils::Vector{Member("m", ty.i32())}); auto* var = Decl(Var("a", ty.Of(s))); auto* expr = MemberAccessor("a", "m"); WrapInFunction(var, expr); @@ -196,7 +419,7 @@ TEST_F(SideEffectsTest, MemberAccessor_Struct_NoSE) { } TEST_F(SideEffectsTest, MemberAccessor_Struct_SE) { - auto* s = Structure("S", {Member("m", ty.i32())}); + auto* s = Structure("S", utils::Vector{Member("m", ty.i32())}); MakeSideEffectFunc("se", [&] { return ty.Of(s); }); auto* expr = MemberAccessor(Call("se"), "m"); WrapInFunction(expr); diff --git a/src/tint/resolver/source_variable_test.cc b/src/tint/resolver/source_variable_test.cc index f9fe2fb3e6..ada4fc2b9c 100644 --- a/src/tint/resolver/source_variable_test.cc +++ b/src/tint/resolver/source_variable_test.cc @@ -15,6 +15,7 @@ #include "src/tint/resolver/resolver.h" #include "src/tint/resolver/resolver_test_helper.h" +#include "src/tint/sem/index_accessor_expression.h" #include "src/tint/sem/member_accessor_expression.h" using namespace tint::number_suffixes; // NOLINT @@ -25,7 +26,7 @@ namespace { class ResolverSourceVariableTest : public ResolverTest {}; TEST_F(ResolverSourceVariableTest, GlobalPrivateVar) { - auto* a = Global("a", ty.f32(), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); auto* expr = Expr(a); WrapInFunction(expr); @@ -36,7 +37,7 @@ TEST_F(ResolverSourceVariableTest, GlobalPrivateVar) { } TEST_F(ResolverSourceVariableTest, GlobalWorkgroupVar) { - auto* a = Global("a", ty.f32(), ast::StorageClass::kWorkgroup); + auto* a = GlobalVar("a", ty.f32(), ast::StorageClass::kWorkgroup); auto* expr = Expr(a); WrapInFunction(expr); @@ -47,7 +48,7 @@ TEST_F(ResolverSourceVariableTest, GlobalWorkgroupVar) { } TEST_F(ResolverSourceVariableTest, GlobalStorageVar) { - auto* a = Global("a", ty.f32(), ast::StorageClass::kStorage, GroupAndBinding(0, 0)); + auto* a = GlobalVar("a", ty.f32(), ast::StorageClass::kStorage, Group(0), Binding(0)); auto* expr = Expr(a); WrapInFunction(expr); @@ -58,7 +59,7 @@ TEST_F(ResolverSourceVariableTest, GlobalStorageVar) { } TEST_F(ResolverSourceVariableTest, GlobalUniformVar) { - auto* a = Global("a", ty.f32(), ast::StorageClass::kUniform, GroupAndBinding(0, 0)); + auto* a = GlobalVar("a", ty.f32(), ast::StorageClass::kUniform, Group(0), Binding(0)); auto* expr = Expr(a); WrapInFunction(expr); @@ -69,8 +70,8 @@ TEST_F(ResolverSourceVariableTest, GlobalUniformVar) { } TEST_F(ResolverSourceVariableTest, GlobalTextureVar) { - auto* a = Global("a", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), - ast::StorageClass::kNone, GroupAndBinding(0, 0)); + auto* a = GlobalVar("a", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), + ast::StorageClass::kNone, Group(0), Binding(0)); auto* expr = Expr(a); WrapInFunction(Call("textureDimensions", expr)); @@ -81,7 +82,7 @@ TEST_F(ResolverSourceVariableTest, GlobalTextureVar) { } TEST_F(ResolverSourceVariableTest, GlobalOverride) { - auto* a = Override("a", ty.f32(), Expr(1.f)); + auto* a = Override("a", ty.f32(), Expr(1_f)); auto* expr = Expr(a); WrapInFunction(expr); @@ -92,7 +93,7 @@ TEST_F(ResolverSourceVariableTest, GlobalOverride) { } TEST_F(ResolverSourceVariableTest, GlobalConst) { - auto* a = GlobalConst("a", ty.f32(), Expr(1.f)); + auto* a = GlobalConst("a", ty.f32(), Expr(1_f)); auto* expr = Expr(a); WrapInFunction(expr); @@ -103,7 +104,7 @@ TEST_F(ResolverSourceVariableTest, GlobalConst) { } TEST_F(ResolverSourceVariableTest, FunctionVar) { - auto* a = Var("a", ty.f32(), ast::StorageClass::kNone); + auto* a = Var("a", ty.f32()); auto* expr = Expr(a); WrapInFunction(a, expr); @@ -114,7 +115,7 @@ TEST_F(ResolverSourceVariableTest, FunctionVar) { } TEST_F(ResolverSourceVariableTest, FunctionLet) { - auto* a = Let("a", ty.f32(), Expr(1.f)); + auto* a = Let("a", ty.f32(), Expr(1_f)); auto* expr = Expr(a); WrapInFunction(a, expr); @@ -127,7 +128,7 @@ TEST_F(ResolverSourceVariableTest, FunctionLet) { TEST_F(ResolverSourceVariableTest, Parameter) { auto* a = Param("a", ty.f32()); auto* expr = Expr(a); - Func("foo", {a}, ty.void_(), {WrapInStatement(expr)}); + Func("foo", utils::Vector{a}, ty.void_(), utils::Vector{WrapInStatement(expr)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -142,9 +143,10 @@ TEST_F(ResolverSourceVariableTest, PointerParameter) { // } auto* param = Param("a", ty.pointer(ty.f32(), ast::StorageClass::kFunction)); auto* expr_param = Expr(param); - auto* let = Let("b", nullptr, expr_param); + auto* let = Let("b", expr_param); auto* expr_let = Expr("b"); - Func("foo", {param}, ty.void_(), {WrapInStatement(let), WrapInStatement(expr_let)}); + Func("foo", utils::Vector{param}, ty.void_(), + utils::Vector{WrapInStatement(let), WrapInStatement(expr_let)}); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -158,9 +160,9 @@ TEST_F(ResolverSourceVariableTest, VarCopyVar) { // var a : f32; // var b = a; // } - auto* a = Var("a", ty.f32(), ast::StorageClass::kNone); + auto* a = Var("a", ty.f32()); auto* expr_a = Expr(a); - auto* b = Var("b", ty.f32(), ast::StorageClass::kNone, expr_a); + auto* b = Var("b", ty.f32(), expr_a); auto* expr_b = Expr(b); WrapInFunction(a, b, expr_b); @@ -177,7 +179,7 @@ TEST_F(ResolverSourceVariableTest, LetCopyVar) { // var a : f32; // let b = a; // } - auto* a = Var("a", ty.f32(), ast::StorageClass::kNone); + auto* a = Var("a", ty.f32()); auto* expr_a = Expr(a); auto* b = Let("b", ty.f32(), expr_a); auto* expr_b = Expr(b); @@ -196,7 +198,7 @@ TEST_F(ResolverSourceVariableTest, ThroughIndexAccessor) { // { // a[2i] // } - auto* a = Global("a", ty.array(ty.f32(), 4_u), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.array(ty.f32(), 4_u), ast::StorageClass::kPrivate); auto* expr = IndexAccessor(a, 2_i); WrapInFunction(expr); @@ -212,8 +214,8 @@ TEST_F(ResolverSourceVariableTest, ThroughMemberAccessor) { // { // a.f // } - auto* S = Structure("S", {Member("f", ty.f32())}); - auto* a = Global("a", ty.Of(S), ast::StorageClass::kPrivate); + auto* S = Structure("S", utils::Vector{Member("f", ty.f32())}); + auto* a = GlobalVar("a", ty.Of(S), ast::StorageClass::kPrivate); auto* expr = MemberAccessor(a, "f"); WrapInFunction(expr); @@ -229,14 +231,14 @@ TEST_F(ResolverSourceVariableTest, ThroughPointers) { // let a_ptr1 = &*&a; // let a_ptr2 = &*a_ptr1; // } - auto* a = Global("a", ty.f32(), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); auto* address_of_1 = AddressOf(a); auto* deref_1 = Deref(address_of_1); auto* address_of_2 = AddressOf(deref_1); - auto* a_ptr1 = Let("a_ptr1", nullptr, address_of_2); + auto* a_ptr1 = Let("a_ptr1", address_of_2); auto* deref_2 = Deref(a_ptr1); auto* address_of_3 = AddressOf(deref_2); - auto* a_ptr2 = Let("a_ptr2", nullptr, address_of_3); + auto* a_ptr2 = Let("a_ptr2", address_of_3); WrapInFunction(a_ptr1, a_ptr2); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -250,7 +252,7 @@ TEST_F(ResolverSourceVariableTest, ThroughPointers) { } TEST_F(ResolverSourceVariableTest, Literal) { - auto* expr = Expr(1.f); + auto* expr = Expr(1_f); WrapInFunction(expr); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -259,7 +261,7 @@ TEST_F(ResolverSourceVariableTest, Literal) { } TEST_F(ResolverSourceVariableTest, FunctionReturnValue) { - auto* expr = Call("min", 1.f, 2.f); + auto* expr = Call("min", 1_f, 2_f); WrapInFunction(expr); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -268,8 +270,8 @@ TEST_F(ResolverSourceVariableTest, FunctionReturnValue) { } TEST_F(ResolverSourceVariableTest, BinaryExpression) { - auto* a = Var("a", ty.f32(), ast::StorageClass::kNone); - auto* expr = Add(a, Expr(1.f)); + auto* a = Var("a", ty.f32()); + auto* expr = Add(a, Expr(1_f)); WrapInFunction(a, expr); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -278,7 +280,7 @@ TEST_F(ResolverSourceVariableTest, BinaryExpression) { } TEST_F(ResolverSourceVariableTest, UnaryExpression) { - auto* a = Var("a", ty.f32(), ast::StorageClass::kNone); + auto* a = Var("a", ty.f32()); auto* expr = create(ast::UnaryOp::kNegation, Expr(a)); WrapInFunction(a, expr); diff --git a/src/tint/resolver/static_assert_test.cc b/src/tint/resolver/static_assert_test.cc new file mode 100644 index 0000000000..3cb67c9ebd --- /dev/null +++ b/src/tint/resolver/static_assert_test.cc @@ -0,0 +1,110 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/resolver/resolver.h" + +#include "gmock/gmock.h" +#include "src/tint/resolver/resolver_test_helper.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::resolver { +namespace { + +using ResolverStaticAssertTest = ResolverTest; + +TEST_F(ResolverStaticAssertTest, Global_True_Pass) { + GlobalStaticAssert(true); + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStaticAssertTest, Global_False_Fail) { + GlobalStaticAssert(Source{{12, 34}}, false); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: static assertion failed"); +} + +TEST_F(ResolverStaticAssertTest, Global_Const_Pass) { + GlobalConst("C", ty.bool_(), Expr(true)); + GlobalStaticAssert("C"); + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStaticAssertTest, Global_Const_Fail) { + GlobalConst("C", ty.bool_(), Expr(false)); + GlobalStaticAssert(Source{{12, 34}}, "C"); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: static assertion failed"); +} + +// TODO(crbug.com/tint/1581): Enable once the '<' operator is implemented for constant evaluation. +TEST_F(ResolverStaticAssertTest, DISABLED_Global_LessThan_Pass) { + GlobalStaticAssert(LessThan(2_i, 3_i)); + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +// TODO(crbug.com/tint/1581): Enable once the '<' operator is implemented for constant evaluation. +TEST_F(ResolverStaticAssertTest, DISABLED_Global_LessThan_Fail) { + GlobalStaticAssert(Source{{12, 34}}, LessThan(4_i, 3_i)); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: static assertion failed"); +} + +TEST_F(ResolverStaticAssertTest, Local_True_Pass) { + WrapInFunction(StaticAssert(true)); + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStaticAssertTest, Local_False_Fail) { + WrapInFunction(StaticAssert(Source{{12, 34}}, false)); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: static assertion failed"); +} + +TEST_F(ResolverStaticAssertTest, Local_Const_Pass) { + GlobalConst("C", ty.bool_(), Expr(true)); + WrapInFunction(StaticAssert("C")); + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStaticAssertTest, Local_Const_Fail) { + GlobalConst("C", ty.bool_(), Expr(false)); + WrapInFunction(StaticAssert(Source{{12, 34}}, "C")); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: static assertion failed"); +} + +TEST_F(ResolverStaticAssertTest, Local_NonConst) { + GlobalVar("V", ty.bool_(), Expr(true), ast::StorageClass::kPrivate); + WrapInFunction(StaticAssert(Expr(Source{{12, 34}}, "V"))); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "12:34 error: static assertion condition must be a constant expression"); +} + +// TODO(crbug.com/tint/1581): Enable once the '<' operator is implemented for constant evaluation. +TEST_F(ResolverStaticAssertTest, DISABLED_Local_LessThan_Pass) { + WrapInFunction(StaticAssert(LessThan(2_i, 3_i))); + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +// TODO(crbug.com/tint/1581): Enable once the '<' operator is implemented for constant evaluation. +TEST_F(ResolverStaticAssertTest, DISABLED_Local_LessThan_Fail) { + WrapInFunction(StaticAssert(Source{{12, 34}}, LessThan(4_i, 3_i))); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: static assertion failed"); +} + +} // namespace +} // namespace tint::resolver diff --git a/src/tint/resolver/storage_class_layout_validation_test.cc b/src/tint/resolver/storage_class_layout_validation_test.cc index db379a062b..51b8eccbc1 100644 --- a/src/tint/resolver/storage_class_layout_validation_test.cc +++ b/src/tint/resolver/storage_class_layout_validation_test.cc @@ -34,11 +34,13 @@ TEST_F(ResolverStorageClassLayoutValidationTest, StorageBuffer_UnalignedMember) // var a : S; Structure(Source{{12, 34}}, "S", - {Member("a", ty.f32(), {MemberSize(5)}), - Member(Source{{34, 56}}, "b", ty.f32(), {MemberAlign(1)})}); + utils::Vector{ + Member("a", ty.f32(), utils::Vector{MemberSize(5)}), + Member(Source{{34, 56}}, "b", ty.f32(), utils::Vector{MemberAlign(1_u)}), + }); - Global(Source{{78, 90}}, "a", ty.type_name("S"), ast::StorageClass::kStorage, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("S"), ast::StorageClass::kStorage, Group(0), + Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -62,11 +64,13 @@ TEST_F(ResolverStorageClassLayoutValidationTest, StorageBuffer_UnalignedMember_S // var a : S; Structure(Source{{12, 34}}, "S", - {Member("a", ty.f32(), {MemberSize(5)}), - Member(Source{{34, 56}}, "b", ty.f32(), {MemberAlign(4)})}); + utils::Vector{ + Member("a", ty.f32(), utils::Vector{MemberSize(5)}), + Member(Source{{34, 56}}, "b", ty.f32(), utils::Vector{MemberAlign(4_u)}), + }); - Global(Source{{78, 90}}, "a", ty.type_name("S"), ast::StorageClass::kStorage, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("S"), ast::StorageClass::kStorage, Group(0), + Binding(0)); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -85,16 +89,19 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_UnalignedMember_S // @group(0) @binding(0) // var a : Outer; - Structure(Source{{12, 34}}, "Inner", {Member("scalar", ty.i32())}); + Structure(Source{{12, 34}}, "Inner", + utils::Vector{ + Member("scalar", ty.i32()), + }); Structure(Source{{34, 56}}, "Outer", - { + utils::Vector{ Member("scalar", ty.f32()), Member(Source{{56, 78}}, "inner", ty.type_name("Inner")), }); - Global(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -126,16 +133,20 @@ TEST_F(ResolverStorageClassLayoutValidationTest, // @group(0) @binding(0) // var a : Outer; - Structure(Source{{12, 34}}, "Inner", {Member("scalar", ty.i32())}); - - Structure(Source{{34, 56}}, "Outer", - { - Member("scalar", ty.f32()), - Member(Source{{56, 78}}, "inner", ty.type_name("Inner"), {MemberAlign(16)}), + Structure(Source{{12, 34}}, "Inner", + utils::Vector{ + Member("scalar", ty.i32()), }); - Global(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + Structure(Source{{34, 56}}, "Outer", + utils::Vector{ + Member("scalar", ty.f32()), + Member(Source{{56, 78}}, "inner", ty.type_name("Inner"), + utils::Vector{MemberAlign(16_u)}), + }); + + GlobalVar(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -154,13 +165,13 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_UnalignedMember_A Alias("Inner", ty.array(ty.f32(), 10_u, 16)); Structure(Source{{12, 34}}, "Outer", - { + utils::Vector{ Member("scalar", ty.f32()), Member(Source{{56, 78}}, "inner", ty.type_name("Inner")), }); - Global(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -187,13 +198,14 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_UnalignedMember_A Alias("Inner", ty.array(ty.f32(), 10_u, 16)); Structure(Source{{12, 34}}, "Outer", - { + utils::Vector{ Member("scalar", ty.f32()), - Member(Source{{34, 56}}, "inner", ty.type_name("Inner"), {MemberAlign(16)}), + Member(Source{{34, 56}}, "inner", ty.type_name("Inner"), + utils::Vector{MemberAlign(16_u)}), }); - Global(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -214,16 +226,18 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_MembersOffsetNotM // var a : Outer; Structure(Source{{12, 34}}, "Inner", - {Member("scalar", ty.i32(), {MemberAlign(1), MemberSize(5)})}); + utils::Vector{ + Member("scalar", ty.i32(), utils::Vector{MemberAlign(1_u), MemberSize(5)}), + }); Structure(Source{{34, 56}}, "Outer", - { + utils::Vector{ Member(Source{{56, 78}}, "inner", ty.type_name("Inner")), Member(Source{{78, 90}}, "scalar", ty.i32()), }); - Global(Source{{22, 24}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{22, 24}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -261,21 +275,21 @@ TEST_F(ResolverStorageClassLayoutValidationTest, // var a : Outer; Structure(Source{{12, 34}}, "Inner", - { + utils::Vector{ Member("a", ty.i32()), Member("b", ty.i32()), Member("c", ty.i32()), - Member("scalar", ty.i32(), {MemberAlign(1), MemberSize(5)}), + Member("scalar", ty.i32(), utils::Vector{MemberAlign(1_u), MemberSize(5)}), }); Structure(Source{{34, 56}}, "Outer", - { + utils::Vector{ Member(Source{{56, 78}}, "inner", ty.type_name("Inner")), Member(Source{{78, 90}}, "scalar", ty.i32()), }); - Global(Source{{22, 24}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{22, 24}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -312,16 +326,18 @@ TEST_F(ResolverStorageClassLayoutValidationTest, // var a : Outer; Structure(Source{{12, 34}}, "Inner", - {Member("scalar", ty.i32(), {MemberAlign(1), MemberSize(5)})}); - - Structure(Source{{34, 56}}, "Outer", - { - Member(Source{{56, 78}}, "inner", ty.type_name("Inner")), - Member(Source{{78, 90}}, "scalar", ty.i32(), {MemberAlign(16)}), + utils::Vector{ + Member("scalar", ty.i32(), utils::Vector{MemberAlign(1_u), MemberSize(5)}), }); - Global(Source{{22, 34}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + Structure(Source{{34, 56}}, "Outer", + utils::Vector{ + Member(Source{{56, 78}}, "inner", ty.type_name("Inner")), + Member(Source{{78, 90}}, "scalar", ty.i32(), utils::Vector{MemberAlign(16_u)}), + }); + + GlobalVar(Source{{22, 34}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -336,13 +352,13 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_Vec3MemberOffset_ // @group(0) @binding(0) // var a : ScalarPackedAtEndOfVec3; - Structure("ScalarPackedAtEndOfVec3", { + Structure("ScalarPackedAtEndOfVec3", utils::Vector{ Member("v", ty.vec3(ty.f32())), Member("s", ty.f32()), }); - Global(Source{{78, 90}}, "a", ty.type_name("ScalarPackedAtEndOfVec3"), - ast::StorageClass::kUniform, GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("ScalarPackedAtEndOfVec3"), + ast::StorageClass::kUniform, Group(0), Binding(0)); ASSERT_TRUE(r()->Resolve()) << r()->error(); } @@ -362,13 +378,13 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_InvalidArrayStrid Alias("Inner", ty.array(ty.f32(), 10_u)); Structure(Source{{12, 34}}, "Outer", - { + utils::Vector{ Member("inner", ty.type_name(Source{{34, 56}}, "Inner")), Member("scalar", ty.i32()), }); - Global(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -396,13 +412,13 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_InvalidArrayStrid Alias("Inner", ty.array(ty.vec2(), 10_u)); Structure(Source{{12, 34}}, "Outer", - { + utils::Vector{ Member("inner", ty.type_name(Source{{34, 56}}, "Inner")), Member("scalar", ty.i32()), }); - Global(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -432,20 +448,20 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_InvalidArrayStrid // @group(0) @binding(0) // var a : Outer; - auto* array_elem = Structure("ArrayElem", { + auto* array_elem = Structure("ArrayElem", utils::Vector{ Member("a", ty.f32()), Member("b", ty.i32()), }); Alias("Inner", ty.array(ty.Of(array_elem), 10_u)); Structure(Source{{12, 34}}, "Outer", - { + utils::Vector{ Member("inner", ty.type_name(Source{{34, 56}}, "Inner")), Member("scalar", ty.i32()), }); - Global(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -462,8 +478,8 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_InvalidArrayStrid TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_InvalidArrayStride_TopLevelArray) { // @group(0) @binding(0) // var a : array; - Global(Source{{78, 90}}, "a", ty.array(Source{{34, 56}}, ty.f32(), 4_u), - ast::StorageClass::kUniform, GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.array(Source{{34, 56}}, ty.f32(), 4_u), + ast::StorageClass::kUniform, Group(0), Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -480,12 +496,12 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_InvalidArrayStrid // var a : array; Structure(Source{{12, 34}}, "Outer", - { + utils::Vector{ Member("inner", ty.array(Source{{34, 56}}, ty.array(ty.f32(), 4_u), 4_u)), }); - Global(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( @@ -512,13 +528,56 @@ TEST_F(ResolverStorageClassLayoutValidationTest, UniformBuffer_InvalidArrayStrid Alias("Inner", ty.array(ty.f32(), 10_u, 16)); Structure(Source{{12, 34}}, "Outer", - { + utils::Vector{ Member("inner", ty.type_name(Source{{34, 56}}, "Inner")), Member("scalar", ty.i32()), }); - Global(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, - GroupAndBinding(0, 0)); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("Outer"), ast::StorageClass::kUniform, Group(0), + Binding(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +// Detect unaligned member for push constants buffers +TEST_F(ResolverStorageClassLayoutValidationTest, PushConstant_UnalignedMember) { + // enable chromium_experimental_push_constant; + // struct S { + // @size(5) a : f32; + // @align(1) b : f32; + // }; + // var a : S; + Enable(ast::Extension::kChromiumExperimentalPushConstant); + Structure( + Source{{12, 34}}, "S", + utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5)}), + Member(Source{{34, 56}}, "b", ty.f32(), utils::Vector{MemberAlign(1_u)})}); + GlobalVar(Source{{78, 90}}, "a", ty.type_name("S"), ast::StorageClass::kPushConstant); + + ASSERT_FALSE(r()->Resolve()); + EXPECT_EQ( + r()->error(), + R"(34:56 error: the offset of a struct member of type 'f32' in storage class 'push_constant' must be a multiple of 4 bytes, but 'b' is currently at offset 5. Consider setting @align(4) on this member +12:34 note: see layout of struct: +/* align(4) size(12) */ struct S { +/* offset(0) align(4) size( 5) */ a : f32; +/* offset(5) align(1) size( 4) */ b : f32; +/* offset(9) align(1) size( 3) */ // -- implicit struct size padding --; +/* */ }; +78:90 note: see declaration of variable)"); +} + +TEST_F(ResolverStorageClassLayoutValidationTest, PushConstant_Aligned) { + // enable chromium_experimental_push_constant; + // struct S { + // @size(5) a : f32; + // @align(4) b : f32; + // }; + // var a : S; + Enable(ast::Extension::kChromiumExperimentalPushConstant); + Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5)}), + Member("b", ty.f32(), utils::Vector{MemberAlign(4_u)})}); + GlobalVar("a", ty.type_name("S"), ast::StorageClass::kPushConstant); ASSERT_TRUE(r()->Resolve()) << r()->error(); } diff --git a/src/tint/resolver/storage_class_validation_test.cc b/src/tint/resolver/storage_class_validation_test.cc index 2d75167ea8..ab9c0493c7 100644 --- a/src/tint/resolver/storage_class_validation_test.cc +++ b/src/tint/resolver/storage_class_validation_test.cc @@ -23,155 +23,226 @@ using namespace tint::number_suffixes; // NOLINT namespace tint::resolver { namespace { +using ::testing::HasSubstr; + using ResolverStorageClassValidationTest = ResolverTest; TEST_F(ResolverStorageClassValidationTest, GlobalVariableNoStorageClass_Fail) { // var g : f32; - Global(Source{{12, 34}}, "g", ty.f32(), ast::StorageClass::kNone); + GlobalVar(Source{{12, 34}}, "g", ty.f32()); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: global variables must have a storage class"); + EXPECT_EQ(r()->error(), + "12:34 error: module-scope 'var' declaration must have a storage class"); } TEST_F(ResolverStorageClassValidationTest, GlobalVariableFunctionStorageClass_Fail) { // var g : f32; - Global(Source{{12, 34}}, "g", ty.f32(), ast::StorageClass::kFunction); + GlobalVar(Source{{12, 34}}, "g", ty.f32(), ast::StorageClass::kFunction); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: variables declared at module scope must not be in " - "the function storage class"); + "12:34 error: module-scope 'var' must not use storage class 'function'"); } TEST_F(ResolverStorageClassValidationTest, Private_RuntimeArray) { - Global(Source{{12, 34}}, "v", ty.array(ty.i32()), ast::StorageClass::kPrivate); + GlobalVar(Source{{12, 34}}, "v", ty.array(ty.i32()), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(12:34 error: runtime-sized arrays can only be used in the storage class -12:34 note: while instantiating variable v)"); +12:34 note: while instantiating 'var' v)"); } TEST_F(ResolverStorageClassValidationTest, Private_RuntimeArrayInStruct) { - auto* s = Structure("S", {Member("m", ty.array(ty.i32()))}); - Global(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kPrivate); + auto* s = Structure("S", utils::Vector{Member("m", ty.array(ty.i32()))}); + GlobalVar(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(12:34 error: runtime-sized arrays can only be used in the storage class note: while analysing structure member S.m -12:34 note: while instantiating variable v)"); +12:34 note: while instantiating 'var' v)"); } TEST_F(ResolverStorageClassValidationTest, Workgroup_RuntimeArray) { - Global(Source{{12, 34}}, "v", ty.array(ty.i32()), ast::StorageClass::kWorkgroup); + GlobalVar(Source{{12, 34}}, "v", ty.array(ty.i32()), ast::StorageClass::kWorkgroup); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(12:34 error: runtime-sized arrays can only be used in the storage class -12:34 note: while instantiating variable v)"); +12:34 note: while instantiating 'var' v)"); } TEST_F(ResolverStorageClassValidationTest, Workgroup_RuntimeArrayInStruct) { - auto* s = Structure("S", {Member("m", ty.array(ty.i32()))}); - Global(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kWorkgroup); + auto* s = Structure("S", utils::Vector{Member("m", ty.array(ty.i32()))}); + GlobalVar(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kWorkgroup); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(12:34 error: runtime-sized arrays can only be used in the storage class note: while analysing structure member S.m -12:34 note: while instantiating variable v)"); +12:34 note: while instantiating 'var' v)"); } TEST_F(ResolverStorageClassValidationTest, StorageBufferBool) { // var g : bool; - Global(Source{{56, 78}}, "g", ty.bool_(), ast::StorageClass::kStorage, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "g", ty.bool_(), ast::StorageClass::kStorage, Binding(0), Group(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( r()->error(), R"(56:78 error: Type 'bool' cannot be used in storage class 'storage' as it is non-host-shareable -56:78 note: while instantiating variable g)"); -} - -TEST_F(ResolverStorageClassValidationTest, StorageBufferPointer) { - // var g : ptr; - Global(Source{{56, 78}}, "g", ty.pointer(ty.f32(), ast::StorageClass::kPrivate), - ast::StorageClass::kStorage, - ast::AttributeList{ - create(0), - create(0), - }); - - ASSERT_FALSE(r()->Resolve()); - - EXPECT_EQ( - r()->error(), - R"(56:78 error: Type 'ptr' cannot be used in storage class 'storage' as it is non-host-shareable -56:78 note: while instantiating variable g)"); -} - -TEST_F(ResolverStorageClassValidationTest, StorageBufferIntScalar) { - // var g : i32; - Global(Source{{56, 78}}, "g", ty.i32(), ast::StorageClass::kStorage, - ast::AttributeList{ - create(0), - create(0), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); -} - -TEST_F(ResolverStorageClassValidationTest, StorageBufferVector) { - // var g : vec4; - Global(Source{{56, 78}}, "g", ty.vec4(), ast::StorageClass::kStorage, - ast::AttributeList{ - create(0), - create(0), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); -} - -TEST_F(ResolverStorageClassValidationTest, StorageBufferArray) { - // var g : array; - auto* s = Structure("S", {Member("a", ty.f32())}); - auto* a = ty.array(ty.Of(s), 3_u); - Global(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); +56:78 note: while instantiating 'var' g)"); } TEST_F(ResolverStorageClassValidationTest, StorageBufferBoolAlias) { // type a = bool; // var g : a; auto* a = Alias("a", ty.bool_()); - Global(Source{{56, 78}}, "g", ty.Of(a), ast::StorageClass::kStorage, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "g", ty.Of(a), ast::StorageClass::kStorage, Binding(0), Group(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( r()->error(), R"(56:78 error: Type 'bool' cannot be used in storage class 'storage' as it is non-host-shareable -56:78 note: while instantiating variable g)"); +56:78 note: while instantiating 'var' g)"); +} + +// F16 types in storage and uniform buffer is not implemented yet. +// TODO(tint:1473, tint:1502): make these testcases valid after f16 is supported. +TEST_F(ResolverStorageClassValidationTest, StorageBufferF16_TemporallyBan) { + // var g : f16; + Enable(ast::Extension::kF16); + + GlobalVar("g", ty.f16(Source{{56, 78}}), ast::StorageClass::kStorage, Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + "56:78 error: using f16 types in 'storage' storage class is not " + "implemented yet"); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferF16Alias_TemporallyBan) { + // type a = f16; + // var g : a; + Enable(ast::Extension::kF16); + + auto* a = Alias("a", ty.f16()); + GlobalVar("g", ty.type_name(Source{{56, 78}}, a->name), ast::StorageClass::kStorage, Binding(0), + Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + "56:78 error: using f16 types in 'storage' storage class is not " + "implemented yet"); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferVectorF16_TemporallyBan) { + // var g : vec4; + Enable(ast::Extension::kF16); + GlobalVar("g", ty.vec(Source{{56, 78}}, ty.Of(), 4u), ast::StorageClass::kStorage, + Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + "56:78 error: using f16 types in 'storage' storage class is not " + "implemented yet"); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferArrayF16_TemporallyBan) { + // struct S { a : f16 }; + // var g : array; + Enable(ast::Extension::kF16); + + auto* s = Structure("S", utils::Vector{Member("a", ty.f16(Source{{56, 78}}))}); + auto* a = ty.array(ty.Of(s), 3_u); + GlobalVar("g", a, ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("56:78 error: using f16 types in 'storage' storage " + "class is not implemented yet")); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferStructF16_TemporallyBan) { + // struct S { x : f16 }; + // var g : S; + Enable(ast::Extension::kF16); + + auto* s = Structure("S", utils::Vector{Member("x", ty.f16(Source{{12, 34}}))}); + GlobalVar("g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'storage' storage " + "class is not implemented yet")); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferNoErrorStructF16Aliases_TemporallyBan) { + // struct S { x : f16 }; + // type a1 = S; + // var g : a1; + Enable(ast::Extension::kF16); + + auto* s = Structure("S", utils::Vector{Member("x", ty.f16(Source{{12, 34}}))}); + auto* a1 = Alias("a1", ty.Of(s)); + auto* a2 = Alias("a2", ty.Of(a1)); + GlobalVar("g", ty.Of(a2), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), + Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'storage' storage " + "class is not implemented yet")); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferPointer) { + // var g : ptr; + GlobalVar(Source{{56, 78}}, "g", ty.pointer(ty.f32(), ast::StorageClass::kPrivate), + ast::StorageClass::kStorage, Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_EQ( + r()->error(), + R"(56:78 error: Type 'ptr' cannot be used in storage class 'storage' as it is non-host-shareable +56:78 note: while instantiating 'var' g)"); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferIntScalar) { + // var g : i32; + GlobalVar(Source{{56, 78}}, "g", ty.i32(), ast::StorageClass::kStorage, Binding(0), Group(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferVectorF32) { + // var g : vec4; + GlobalVar(Source{{56, 78}}, "g", ty.vec4(), ast::StorageClass::kStorage, Binding(0), + Group(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferArrayF32) { + // var g : array; + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); + auto* a = ty.array(ty.Of(s), 3_u); + GlobalVar(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), + Group(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverStorageClassValidationTest, NotStorage_AccessMode) { // var g : a; - Global(Source{{56, 78}}, "g", ty.i32(), ast::StorageClass::kPrivate, ast::Access::kRead); + GlobalVar(Source{{56, 78}}, "g", ty.i32(), ast::StorageClass::kPrivate, ast::Access::kRead); ASSERT_FALSE(r()->Resolve()); @@ -180,31 +251,52 @@ TEST_F(ResolverStorageClassValidationTest, NotStorage_AccessMode) { R"(56:78 error: only variables in storage class may declare an access mode)"); } -TEST_F(ResolverStorageClassValidationTest, StorageBufferNoError_Basic) { +TEST_F(ResolverStorageClassValidationTest, Storage_ReadAccessMode) { + // @group(0) @binding(0) var a : i32; + GlobalVar(Source{{56, 78}}, "a", ty.i32(), ast::StorageClass::kStorage, ast::Access::kRead, + Group(0), Binding(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, Storage_ReadWriteAccessMode) { + // @group(0) @binding(0) var a : i32; + GlobalVar(Source{{56, 78}}, "a", ty.i32(), ast::StorageClass::kStorage, ast::Access::kReadWrite, + Group(0), Binding(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, Storage_WriteAccessMode) { + // @group(0) @binding(0) var a : i32; + GlobalVar(Source{{56, 78}}, "a", ty.i32(), ast::StorageClass::kStorage, ast::Access::kWrite, + Group(0), Binding(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + R"(56:78 error: access mode 'write' is not valid for the 'storage' address space)"); +} + +TEST_F(ResolverStorageClassValidationTest, StorageBufferStructI32) { // struct S { x : i32 }; // var g : S; - auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())}); - Global(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "x", ty.i32())}); + GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, + Binding(0), Group(0)); ASSERT_TRUE(r()->Resolve()); } -TEST_F(ResolverStorageClassValidationTest, StorageBufferNoError_Aliases) { +TEST_F(ResolverStorageClassValidationTest, StorageBufferNoErrorStructI32Aliases) { // struct S { x : i32 }; // type a1 = S; // var g : a1; - auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())}); + auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "x", ty.i32())}); auto* a1 = Alias("a1", ty.Of(s)); auto* a2 = Alias("a2", ty.Of(a1)); - Global(Source{{56, 78}}, "g", ty.Of(a2), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "g", ty.Of(a2), ast::StorageClass::kStorage, ast::Access::kRead, + Binding(0), Group(0)); ASSERT_TRUE(r()->Resolve()); } @@ -213,137 +305,278 @@ TEST_F(ResolverStorageClassValidationTest, UniformBuffer_Struct_Runtime) { // struct S { m: array; }; // @group(0) @binding(0) var svar : S; - auto* s = Structure(Source{{12, 34}}, "S", {Member("m", ty.array())}); + auto* s = Structure(Source{{12, 34}}, "S", utils::Vector{Member("m", ty.array())}); - Global(Source{{56, 78}}, "svar", ty.Of(s), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "svar", ty.Of(s), ast::StorageClass::kUniform, Binding(0), + Group(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(56:78 error: runtime-sized arrays can only be used in the storage class note: while analysing structure member S.m -56:78 note: while instantiating variable svar)"); +56:78 note: while instantiating 'var' svar)"); } TEST_F(ResolverStorageClassValidationTest, UniformBufferBool) { // var g : bool; - Global(Source{{56, 78}}, "g", ty.bool_(), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "g", ty.bool_(), ast::StorageClass::kUniform, Binding(0), Group(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( r()->error(), R"(56:78 error: Type 'bool' cannot be used in storage class 'uniform' as it is non-host-shareable -56:78 note: while instantiating variable g)"); -} - -TEST_F(ResolverStorageClassValidationTest, UniformBufferPointer) { - // var g : ptr; - Global(Source{{56, 78}}, "g", ty.pointer(ty.f32(), ast::StorageClass::kPrivate), - ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); - - ASSERT_FALSE(r()->Resolve()); - - EXPECT_EQ( - r()->error(), - R"(56:78 error: Type 'ptr' cannot be used in storage class 'uniform' as it is non-host-shareable -56:78 note: while instantiating variable g)"); -} - -TEST_F(ResolverStorageClassValidationTest, UniformBufferIntScalar) { - // var g : i32; - Global(Source{{56, 78}}, "g", ty.i32(), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); -} - -TEST_F(ResolverStorageClassValidationTest, UniformBufferVector) { - // var g : vec4; - Global(Source{{56, 78}}, "g", ty.vec4(), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); -} - -TEST_F(ResolverStorageClassValidationTest, UniformBufferArray) { - // struct S { - // @size(16) f : f32; - // } - // var g : array; - auto* s = Structure("S", {Member("a", ty.f32(), {MemberSize(16)})}); - auto* a = ty.array(ty.Of(s), 3_u); - Global(Source{{56, 78}}, "g", a, ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); +56:78 note: while instantiating 'var' g)"); } TEST_F(ResolverStorageClassValidationTest, UniformBufferBoolAlias) { // type a = bool; // var g : a; auto* a = Alias("a", ty.bool_()); - Global(Source{{56, 78}}, "g", ty.Of(a), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "g", ty.Of(a), ast::StorageClass::kUniform, Binding(0), Group(0)); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ( r()->error(), R"(56:78 error: Type 'bool' cannot be used in storage class 'uniform' as it is non-host-shareable -56:78 note: while instantiating variable g)"); +56:78 note: while instantiating 'var' g)"); } -TEST_F(ResolverStorageClassValidationTest, UniformBufferNoError_Basic) { - // struct S { x : i32 }; +// F16 types in storage and uniform buffer is not implemented yet. +// TODO(tint:1473, tint:1502): make these testcases valid after f16 is supported. +TEST_F(ResolverStorageClassValidationTest, UniformBufferF16_TemporallyBan) { + // var g : f16; + Enable(ast::Extension::kF16); + + GlobalVar("g", ty.f16(Source{{56, 78}}), ast::StorageClass::kUniform, Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + "56:78 error: using f16 types in 'uniform' storage class is not " + "implemented yet"); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferF16Alias_TemporallyBan) { + // type a = f16; + // var g : a; + Enable(ast::Extension::kF16); + + auto* a = Alias("a", ty.f16()); + GlobalVar("g", ty.type_name(Source{{56, 78}}, a->name), ast::StorageClass::kUniform, Binding(0), + Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_EQ(r()->error(), + "56:78 error: using f16 types in 'uniform' storage class is not " + "implemented yet"); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferVectorF16_TemporallyBan) { + // var g : vec4; + Enable(ast::Extension::kF16); + GlobalVar("g", ty.vec(Source{{56, 78}}, ty.Of(), 4u), ast::StorageClass::kUniform, + Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("56:78 error: using f16 types in 'uniform' storage " + "class is not implemented yet")); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferArrayF16_TemporallyBan) { + // struct S { + // @size(16) f : f16; + // } + // var g : array; + Enable(ast::Extension::kF16); + + auto* s = Structure( + "S", utils::Vector{Member("a", ty.f16(Source{{56, 78}}), utils::Vector{MemberSize(16)})}); + auto* a = ty.array(ty.Of(s), 3_u); + GlobalVar("g", a, ast::StorageClass::kUniform, Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("56:78 error: using f16 types in 'uniform' storage " + "class is not implemented yet")); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferStructF16_TemporallyBan) { + // struct S { x : f16 }; // var g : S; - auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())}); - Global(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); + Enable(ast::Extension::kF16); + + auto* s = Structure("S", utils::Vector{Member("x", ty.f16(Source{{12, 34}}))}); + GlobalVar("g", ty.Of(s), ast::StorageClass::kUniform, Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'uniform' storage " + "class is not implemented yet")); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferStructF16Aliases_TemporallyBan) { + // struct S { x : f16 }; + // type a1 = S; + // var g : a1; + Enable(ast::Extension::kF16); + + auto* s = Structure("S", utils::Vector{Member("x", ty.f16(Source{{12, 34}}))}); + auto* a1 = Alias("a1", ty.Of(s)); + GlobalVar("g", ty.Of(a1), ast::StorageClass::kUniform, Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: using f16 types in 'uniform' storage " + "class is not implemented yet")); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferPointer) { + // var g : ptr; + GlobalVar(Source{{56, 78}}, "g", ty.pointer(ty.f32(), ast::StorageClass::kPrivate), + ast::StorageClass::kUniform, Binding(0), Group(0)); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_EQ( + r()->error(), + R"(56:78 error: Type 'ptr' cannot be used in storage class 'uniform' as it is non-host-shareable +56:78 note: while instantiating 'var' g)"); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferIntScalar) { + // var g : i32; + GlobalVar(Source{{56, 78}}, "g", ty.i32(), ast::StorageClass::kUniform, Binding(0), Group(0)); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverStorageClassValidationTest, UniformBufferNoError_Aliases) { +TEST_F(ResolverStorageClassValidationTest, UniformBufferVectorF32) { + // var g : vec4; + GlobalVar(Source{{56, 78}}, "g", ty.vec4(), ast::StorageClass::kUniform, Binding(0), + Group(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferArrayF32) { + // struct S { + // @size(16) f : f32; + // } + // var g : array; + auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(16)})}); + auto* a = ty.array(ty.Of(s), 3_u); + GlobalVar(Source{{56, 78}}, "g", a, ast::StorageClass::kUniform, Binding(0), Group(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferStructI32) { + // struct S { x : i32 }; + // var g : S; + auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "x", ty.i32())}); + GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kUniform, Binding(0), Group(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, UniformBufferStructI32Aliases) { // struct S { x : i32 }; // type a1 = S; // var g : a1; - auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())}); + auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "x", ty.i32())}); auto* a1 = Alias("a1", ty.Of(s)); - Global(Source{{56, 78}}, "g", ty.Of(a1), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{56, 78}}, "g", ty.Of(a1), ast::StorageClass::kUniform, Binding(0), Group(0)); ASSERT_TRUE(r()->Resolve()) << r()->error(); } +TEST_F(ResolverStorageClassValidationTest, PushConstantBool) { + // enable chromium_experimental_push_constant; + // var g : bool; + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar(Source{{56, 78}}, "g", ty.bool_(), ast::StorageClass::kPushConstant); + + ASSERT_FALSE(r()->Resolve()); + EXPECT_EQ( + r()->error(), + R"(56:78 error: Type 'bool' cannot be used in storage class 'push_constant' as it is non-host-shareable +56:78 note: while instantiating 'var' g)"); +} + +TEST_F(ResolverStorageClassValidationTest, PushConstantF16) { + // enable chromium_experimental_push_constant; + // enable f16; + // var g : f16; + Enable(ast::Extension::kF16); + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar("g", ty.f16(Source{{56, 78}}), ast::StorageClass::kPushConstant); + + ASSERT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "56:78 error: using f16 types in 'push_constant' storage class is not " + "implemented yet"); +} + +TEST_F(ResolverStorageClassValidationTest, PushConstantPointer) { + // enable chromium_experimental_push_constant; + // var g : ptr; + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar(Source{{56, 78}}, "g", ty.pointer(ty.f32(), ast::StorageClass::kPrivate), + ast::StorageClass::kPushConstant); + + ASSERT_FALSE(r()->Resolve()); + EXPECT_EQ( + r()->error(), + R"(56:78 error: Type 'ptr' cannot be used in storage class 'push_constant' as it is non-host-shareable +56:78 note: while instantiating 'var' g)"); +} + +TEST_F(ResolverStorageClassValidationTest, PushConstantIntScalar) { + // enable chromium_experimental_push_constant; + // var g : i32; + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar("g", ty.i32(), ast::StorageClass::kPushConstant); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, PushConstantVectorF32) { + // enable chromium_experimental_push_constant; + // var g : vec4; + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar("g", ty.vec4(), ast::StorageClass::kPushConstant); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, PushConstantArrayF32) { + // enable chromium_experimental_push_constant; + // struct S { a : f32} + // var g : array; + Enable(ast::Extension::kChromiumExperimentalPushConstant); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); + auto* a = ty.array(ty.Of(s), 3_u); + GlobalVar("g", a, ast::StorageClass::kPushConstant); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverStorageClassValidationTest, PushConstantWithInitializer) { + // enable chromium_experimental_push_constant; + // var a : u32 = 0u; + Enable(ast::Extension::kChromiumExperimentalPushConstant); + GlobalVar(Source{{1u, 2u}}, "a", ty.u32(), ast::StorageClass::kPushConstant, + Expr(Source{{3u, 4u}}, u32(0))); + + ASSERT_FALSE(r()->Resolve()); + EXPECT_EQ( + r()->error(), + R"(1:2 error: var of storage class 'push_constant' cannot have an initializer. var initializers are only supported for the storage classes 'private' and 'function')"); +} + } // namespace } // namespace tint::resolver diff --git a/src/tint/resolver/struct_layout_test.cc b/src/tint/resolver/struct_layout_test.cc index 854e87ae3e..ae3972b04f 100644 --- a/src/tint/resolver/struct_layout_test.cc +++ b/src/tint/resolver/struct_layout_test.cc @@ -26,7 +26,7 @@ namespace { using ResolverStructLayoutTest = ResolverTest; TEST_F(ResolverStructLayoutTest, Scalars) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.f32()), Member("b", ty.u32()), Member("c", ty.i32()), @@ -49,13 +49,67 @@ TEST_F(ResolverStructLayoutTest, Scalars) { EXPECT_EQ(sem->Members()[2]->Offset(), 8u); EXPECT_EQ(sem->Members()[2]->Align(), 4u); EXPECT_EQ(sem->Members()[2]->Size(), 4u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } +} + +TEST_F(ResolverStructLayoutTest, ScalarsWithF16) { + Enable(ast::Extension::kF16); + + auto* s = Structure("S", utils::Vector{ + Member("a", ty.f32()), + Member("b", ty.f16()), + Member("c", ty.u32()), + Member("d", ty.f16()), + Member("e", ty.f16()), + Member("f", ty.i32()), + Member("g", ty.f16()), + }); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* sem = TypeOf(s)->As(); + ASSERT_NE(sem, nullptr); + EXPECT_EQ(sem->Size(), 24u); + EXPECT_EQ(sem->SizeNoPadding(), 22u); + EXPECT_EQ(sem->Align(), 4u); + ASSERT_EQ(sem->Members().size(), 7u); + // f32 + EXPECT_EQ(sem->Members()[0]->Offset(), 0u); + EXPECT_EQ(sem->Members()[0]->Align(), 4u); + EXPECT_EQ(sem->Members()[0]->Size(), 4u); + // f16 + EXPECT_EQ(sem->Members()[1]->Offset(), 4u); + EXPECT_EQ(sem->Members()[1]->Align(), 2u); + EXPECT_EQ(sem->Members()[1]->Size(), 2u); + // u32 + EXPECT_EQ(sem->Members()[2]->Offset(), 8u); + EXPECT_EQ(sem->Members()[2]->Align(), 4u); + EXPECT_EQ(sem->Members()[2]->Size(), 4u); + // f16 + EXPECT_EQ(sem->Members()[3]->Offset(), 12u); + EXPECT_EQ(sem->Members()[3]->Align(), 2u); + EXPECT_EQ(sem->Members()[3]->Size(), 2u); + // f16 + EXPECT_EQ(sem->Members()[4]->Offset(), 14u); + EXPECT_EQ(sem->Members()[4]->Align(), 2u); + EXPECT_EQ(sem->Members()[4]->Size(), 2u); + // i32 + EXPECT_EQ(sem->Members()[5]->Offset(), 16u); + EXPECT_EQ(sem->Members()[5]->Align(), 4u); + EXPECT_EQ(sem->Members()[5]->Size(), 4u); + // f16 + EXPECT_EQ(sem->Members()[6]->Offset(), 20u); + EXPECT_EQ(sem->Members()[6]->Align(), 2u); + EXPECT_EQ(sem->Members()[6]->Size(), 2u); } TEST_F(ResolverStructLayoutTest, Alias) { auto* alias_a = Alias("a", ty.f32()); auto* alias_b = Alias("b", ty.f32()); - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.Of(alias_a)), Member("b", ty.Of(alias_b)), }); @@ -74,62 +128,93 @@ TEST_F(ResolverStructLayoutTest, Alias) { EXPECT_EQ(sem->Members()[1]->Offset(), 4u); EXPECT_EQ(sem->Members()[1]->Align(), 4u); EXPECT_EQ(sem->Members()[1]->Size(), 4u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayStaticSize) { - auto* s = Structure("S", { + Enable(ast::Extension::kF16); + + auto* s = Structure("S", utils::Vector{ Member("a", ty.array()), Member("b", ty.array()), - Member("c", ty.array()), + Member("c", ty.array()), + Member("d", ty.array()), }); ASSERT_TRUE(r()->Resolve()) << r()->error(); auto* sem = TypeOf(s)->As(); ASSERT_NE(sem, nullptr); - EXPECT_EQ(sem->Size(), 36u); - EXPECT_EQ(sem->SizeNoPadding(), 36u); + EXPECT_EQ(sem->Size(), 52u); + EXPECT_EQ(sem->SizeNoPadding(), 52u); EXPECT_EQ(sem->Align(), 4u); - ASSERT_EQ(sem->Members().size(), 3u); + ASSERT_EQ(sem->Members().size(), 4u); + // array EXPECT_EQ(sem->Members()[0]->Offset(), 0u); EXPECT_EQ(sem->Members()[0]->Align(), 4u); EXPECT_EQ(sem->Members()[0]->Size(), 12u); + // array EXPECT_EQ(sem->Members()[1]->Offset(), 12u); EXPECT_EQ(sem->Members()[1]->Align(), 4u); EXPECT_EQ(sem->Members()[1]->Size(), 20u); + // array EXPECT_EQ(sem->Members()[2]->Offset(), 32u); - EXPECT_EQ(sem->Members()[2]->Align(), 4u); - EXPECT_EQ(sem->Members()[2]->Size(), 4u); + EXPECT_EQ(sem->Members()[2]->Align(), 2u); + EXPECT_EQ(sem->Members()[2]->Size(), 14u); + // array + EXPECT_EQ(sem->Members()[3]->Offset(), 48u); + EXPECT_EQ(sem->Members()[3]->Align(), 4u); + EXPECT_EQ(sem->Members()[3]->Size(), 4u); + + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, ExplicitStrideArrayStaticSize) { - auto* s = Structure("S", { + Enable(ast::Extension::kF16); + + auto* s = Structure("S", utils::Vector{ Member("a", ty.array(/*stride*/ 8)), Member("b", ty.array(/*stride*/ 16)), - Member("c", ty.array(/*stride*/ 32)), + Member("c", ty.array(/*stride*/ 4)), + Member("d", ty.array(/*stride*/ 32)), }); ASSERT_TRUE(r()->Resolve()) << r()->error(); auto* sem = TypeOf(s)->As(); ASSERT_NE(sem, nullptr); - EXPECT_EQ(sem->Size(), 136u); - EXPECT_EQ(sem->SizeNoPadding(), 136u); + EXPECT_EQ(sem->Size(), 164u); + EXPECT_EQ(sem->SizeNoPadding(), 164u); EXPECT_EQ(sem->Align(), 4u); - ASSERT_EQ(sem->Members().size(), 3u); + ASSERT_EQ(sem->Members().size(), 4u); + // array, stride = 8 EXPECT_EQ(sem->Members()[0]->Offset(), 0u); EXPECT_EQ(sem->Members()[0]->Align(), 4u); EXPECT_EQ(sem->Members()[0]->Size(), 24u); + // array, stride = 16 EXPECT_EQ(sem->Members()[1]->Offset(), 24u); EXPECT_EQ(sem->Members()[1]->Align(), 4u); EXPECT_EQ(sem->Members()[1]->Size(), 80u); + // array, stride = 4 EXPECT_EQ(sem->Members()[2]->Offset(), 104u); - EXPECT_EQ(sem->Members()[2]->Align(), 4u); - EXPECT_EQ(sem->Members()[2]->Size(), 32u); + EXPECT_EQ(sem->Members()[2]->Align(), 2u); + EXPECT_EQ(sem->Members()[2]->Size(), 28u); + // array, stride = 32 + EXPECT_EQ(sem->Members()[3]->Offset(), 132u); + EXPECT_EQ(sem->Members()[3]->Align(), 4u); + EXPECT_EQ(sem->Members()[3]->Size(), 32u); + + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayRuntimeSized) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("c", ty.array()), }); @@ -144,10 +229,13 @@ TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayRuntimeSized) { EXPECT_EQ(sem->Members()[0]->Offset(), 0u); EXPECT_EQ(sem->Members()[0]->Align(), 4u); EXPECT_EQ(sem->Members()[0]->Size(), 4u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, ExplicitStrideArrayRuntimeSized) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("c", ty.array(/*stride*/ 32)), }); @@ -162,12 +250,15 @@ TEST_F(ResolverStructLayoutTest, ExplicitStrideArrayRuntimeSized) { EXPECT_EQ(sem->Members()[0]->Offset(), 0u); EXPECT_EQ(sem->Members()[0]->Align(), 4u); EXPECT_EQ(sem->Members()[0]->Size(), 32u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayOfExplicitStrideArray) { auto* inner = ty.array(/*stride*/ 16); // size: 32 auto* outer = ty.array(inner, 12_u); // size: 12 * 32 - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("c", outer), }); @@ -182,16 +273,19 @@ TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayOfExplicitStrideArray) { EXPECT_EQ(sem->Members()[0]->Offset(), 0u); EXPECT_EQ(sem->Members()[0]->Align(), 4u); EXPECT_EQ(sem->Members()[0]->Size(), 384u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayOfStructure) { - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec2()), Member("b", ty.vec3()), Member("c", ty.vec4()), }); // size: 48 auto* outer = ty.array(ty.Of(inner), 12_u); // size: 12 * 48 - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("c", outer), }); @@ -206,10 +300,13 @@ TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayOfStructure) { EXPECT_EQ(sem->Members()[0]->Offset(), 0u); EXPECT_EQ(sem->Members()[0]->Align(), 16u); EXPECT_EQ(sem->Members()[0]->Size(), 576u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, Vector) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.vec2()), Member("b", ty.vec3()), Member("c", ty.vec4()), @@ -232,63 +329,108 @@ TEST_F(ResolverStructLayoutTest, Vector) { EXPECT_EQ(sem->Members()[2]->Offset(), 32u); // vec4 EXPECT_EQ(sem->Members()[2]->Align(), 16u); EXPECT_EQ(sem->Members()[2]->Size(), 16u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, Matrix) { - auto* s = Structure("S", { - Member("a", ty.mat2x2()), - Member("b", ty.mat2x3()), - Member("c", ty.mat2x4()), - Member("d", ty.mat3x2()), - Member("e", ty.mat3x3()), - Member("f", ty.mat3x4()), - Member("g", ty.mat4x2()), - Member("h", ty.mat4x3()), - Member("i", ty.mat4x4()), + Enable(ast::Extension::kF16); + + auto* s = Structure("S", utils::Vector{ + Member("a_1", ty.mat2x2()), + Member("a_2", ty.mat2x2()), + Member("b_1", ty.mat2x3()), + Member("b_2", ty.mat2x3()), + Member("c_1", ty.mat2x4()), + Member("c_2", ty.mat2x4()), + Member("d_1", ty.mat3x2()), + Member("d_2", ty.mat3x2()), + Member("e_1", ty.mat3x3()), + Member("e_2", ty.mat3x3()), + Member("f_1", ty.mat3x4()), + Member("f_2", ty.mat3x4()), + Member("g_1", ty.mat4x2()), + Member("g_2", ty.mat4x2()), + Member("h_1", ty.mat4x3()), + Member("h_2", ty.mat4x3()), + Member("i_1", ty.mat4x4()), + Member("i_2", ty.mat4x4()), }); ASSERT_TRUE(r()->Resolve()) << r()->error(); auto* sem = TypeOf(s)->As(); ASSERT_NE(sem, nullptr); - EXPECT_EQ(sem->Size(), 368u); - EXPECT_EQ(sem->SizeNoPadding(), 368u); + EXPECT_EQ(sem->Size(), 576u); + EXPECT_EQ(sem->SizeNoPadding(), 576u); EXPECT_EQ(sem->Align(), 16u); - ASSERT_EQ(sem->Members().size(), 9u); - EXPECT_EQ(sem->Members()[0]->Offset(), 0u); // mat2x2 + ASSERT_EQ(sem->Members().size(), 18u); + EXPECT_EQ(sem->Members()[0]->Offset(), 0u); // mat2x2 EXPECT_EQ(sem->Members()[0]->Align(), 8u); EXPECT_EQ(sem->Members()[0]->Size(), 16u); - EXPECT_EQ(sem->Members()[1]->Offset(), 16u); // mat2x3 - EXPECT_EQ(sem->Members()[1]->Align(), 16u); - EXPECT_EQ(sem->Members()[1]->Size(), 32u); - EXPECT_EQ(sem->Members()[2]->Offset(), 48u); // mat2x4 + EXPECT_EQ(sem->Members()[1]->Offset(), 16u); // mat2x2 + EXPECT_EQ(sem->Members()[1]->Align(), 4u); + EXPECT_EQ(sem->Members()[1]->Size(), 8u); + EXPECT_EQ(sem->Members()[2]->Offset(), 32u); // mat2x3 EXPECT_EQ(sem->Members()[2]->Align(), 16u); EXPECT_EQ(sem->Members()[2]->Size(), 32u); - EXPECT_EQ(sem->Members()[3]->Offset(), 80u); // mat3x2 + EXPECT_EQ(sem->Members()[3]->Offset(), 64u); // mat2x3 EXPECT_EQ(sem->Members()[3]->Align(), 8u); - EXPECT_EQ(sem->Members()[3]->Size(), 24u); - EXPECT_EQ(sem->Members()[4]->Offset(), 112u); // mat3x3 + EXPECT_EQ(sem->Members()[3]->Size(), 16u); + EXPECT_EQ(sem->Members()[4]->Offset(), 80u); // mat2x4 EXPECT_EQ(sem->Members()[4]->Align(), 16u); - EXPECT_EQ(sem->Members()[4]->Size(), 48u); - EXPECT_EQ(sem->Members()[5]->Offset(), 160u); // mat3x4 - EXPECT_EQ(sem->Members()[5]->Align(), 16u); - EXPECT_EQ(sem->Members()[5]->Size(), 48u); - EXPECT_EQ(sem->Members()[6]->Offset(), 208u); // mat4x2 + EXPECT_EQ(sem->Members()[4]->Size(), 32u); + EXPECT_EQ(sem->Members()[5]->Offset(), 112u); // mat2x4 + EXPECT_EQ(sem->Members()[5]->Align(), 8u); + EXPECT_EQ(sem->Members()[5]->Size(), 16u); + EXPECT_EQ(sem->Members()[6]->Offset(), 128u); // mat3x2 EXPECT_EQ(sem->Members()[6]->Align(), 8u); - EXPECT_EQ(sem->Members()[6]->Size(), 32u); - EXPECT_EQ(sem->Members()[7]->Offset(), 240u); // mat4x3 - EXPECT_EQ(sem->Members()[7]->Align(), 16u); - EXPECT_EQ(sem->Members()[7]->Size(), 64u); - EXPECT_EQ(sem->Members()[8]->Offset(), 304u); // mat4x4 + EXPECT_EQ(sem->Members()[6]->Size(), 24u); + EXPECT_EQ(sem->Members()[7]->Offset(), 152u); // mat3x2 + EXPECT_EQ(sem->Members()[7]->Align(), 4u); + EXPECT_EQ(sem->Members()[7]->Size(), 12u); + EXPECT_EQ(sem->Members()[8]->Offset(), 176u); // mat3x3 EXPECT_EQ(sem->Members()[8]->Align(), 16u); - EXPECT_EQ(sem->Members()[8]->Size(), 64u); + EXPECT_EQ(sem->Members()[8]->Size(), 48u); + EXPECT_EQ(sem->Members()[9]->Offset(), 224u); // mat3x3 + EXPECT_EQ(sem->Members()[9]->Align(), 8u); + EXPECT_EQ(sem->Members()[9]->Size(), 24u); + EXPECT_EQ(sem->Members()[10]->Offset(), 256u); // mat3x4 + EXPECT_EQ(sem->Members()[10]->Align(), 16u); + EXPECT_EQ(sem->Members()[10]->Size(), 48u); + EXPECT_EQ(sem->Members()[11]->Offset(), 304u); // mat3x4 + EXPECT_EQ(sem->Members()[11]->Align(), 8u); + EXPECT_EQ(sem->Members()[11]->Size(), 24u); + EXPECT_EQ(sem->Members()[12]->Offset(), 328u); // mat4x2 + EXPECT_EQ(sem->Members()[12]->Align(), 8u); + EXPECT_EQ(sem->Members()[12]->Size(), 32u); + EXPECT_EQ(sem->Members()[13]->Offset(), 360u); // mat4x2 + EXPECT_EQ(sem->Members()[13]->Align(), 4u); + EXPECT_EQ(sem->Members()[13]->Size(), 16u); + EXPECT_EQ(sem->Members()[14]->Offset(), 384u); // mat4x3 + EXPECT_EQ(sem->Members()[14]->Align(), 16u); + EXPECT_EQ(sem->Members()[14]->Size(), 64u); + EXPECT_EQ(sem->Members()[15]->Offset(), 448u); // mat4x3 + EXPECT_EQ(sem->Members()[15]->Align(), 8u); + EXPECT_EQ(sem->Members()[15]->Size(), 32u); + EXPECT_EQ(sem->Members()[16]->Offset(), 480u); // mat4x4 + EXPECT_EQ(sem->Members()[16]->Align(), 16u); + EXPECT_EQ(sem->Members()[16]->Size(), 64u); + EXPECT_EQ(sem->Members()[17]->Offset(), 544u); // mat4x4 + EXPECT_EQ(sem->Members()[17]->Align(), 8u); + EXPECT_EQ(sem->Members()[17]->Size(), 32u); + + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, NestedStruct) { - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.mat3x3()), }); - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.Of(inner)), Member("c", ty.i32()), @@ -311,19 +453,22 @@ TEST_F(ResolverStructLayoutTest, NestedStruct) { EXPECT_EQ(sem->Members()[2]->Offset(), 64u); EXPECT_EQ(sem->Members()[2]->Align(), 4u); EXPECT_EQ(sem->Members()[2]->Size(), 4u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, SizeAttributes) { - auto* inner = Structure("Inner", { - Member("a", ty.f32(), {MemberSize(8)}), - Member("b", ty.f32(), {MemberSize(16)}), - Member("c", ty.f32(), {MemberSize(8)}), + auto* inner = Structure("Inner", utils::Vector{ + Member("a", ty.f32(), utils::Vector{MemberSize(8)}), + Member("b", ty.f32(), utils::Vector{MemberSize(16)}), + Member("c", ty.f32(), utils::Vector{MemberSize(8)}), }); - auto* s = Structure("S", { - Member("a", ty.f32(), {MemberSize(4)}), - Member("b", ty.u32(), {MemberSize(8)}), + auto* s = Structure("S", utils::Vector{ + Member("a", ty.f32(), utils::Vector{MemberSize(4)}), + Member("b", ty.u32(), utils::Vector{MemberSize(8)}), Member("c", ty.Of(inner)), - Member("d", ty.i32(), {MemberSize(32)}), + Member("d", ty.i32(), utils::Vector{MemberSize(32)}), }); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -346,19 +491,22 @@ TEST_F(ResolverStructLayoutTest, SizeAttributes) { EXPECT_EQ(sem->Members()[3]->Offset(), 44u); EXPECT_EQ(sem->Members()[3]->Align(), 4u); EXPECT_EQ(sem->Members()[3]->Size(), 32u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, AlignAttributes) { - auto* inner = Structure("Inner", { - Member("a", ty.f32(), {MemberAlign(8)}), - Member("b", ty.f32(), {MemberAlign(16)}), - Member("c", ty.f32(), {MemberAlign(4)}), + auto* inner = Structure("Inner", utils::Vector{ + Member("a", ty.f32(), utils::Vector{MemberAlign(8_u)}), + Member("b", ty.f32(), utils::Vector{MemberAlign(16_u)}), + Member("c", ty.f32(), utils::Vector{MemberAlign(4_u)}), }); - auto* s = Structure("S", { - Member("a", ty.f32(), {MemberAlign(4)}), - Member("b", ty.u32(), {MemberAlign(8)}), + auto* s = Structure("S", utils::Vector{ + Member("a", ty.f32(), utils::Vector{MemberAlign(4_u)}), + Member("b", ty.u32(), utils::Vector{MemberAlign(8_u)}), Member("c", ty.Of(inner)), - Member("d", ty.i32(), {MemberAlign(32)}), + Member("d", ty.i32(), utils::Vector{MemberAlign(32_u)}), }); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -381,11 +529,14 @@ TEST_F(ResolverStructLayoutTest, AlignAttributes) { EXPECT_EQ(sem->Members()[3]->Offset(), 64u); EXPECT_EQ(sem->Members()[3]->Align(), 32u); EXPECT_EQ(sem->Members()[3]->Size(), 4u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } TEST_F(ResolverStructLayoutTest, StructWithLotsOfPadding) { - auto* s = Structure("S", { - Member("a", ty.i32(), {MemberAlign(1024)}), + auto* s = Structure("S", utils::Vector{ + Member("a", ty.i32(), utils::Vector{MemberAlign(1024_u)}), }); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -399,6 +550,9 @@ TEST_F(ResolverStructLayoutTest, StructWithLotsOfPadding) { EXPECT_EQ(sem->Members()[0]->Offset(), 0u); EXPECT_EQ(sem->Members()[0]->Align(), 1024u); EXPECT_EQ(sem->Members()[0]->Size(), 4u); + for (auto& m : sem->Members()) { + EXPECT_EQ(m->Struct()->Declaration(), s); + } } } // namespace diff --git a/src/tint/resolver/struct_pipeline_stage_use_test.cc b/src/tint/resolver/struct_pipeline_stage_use_test.cc index 6b9ede9161..acf30f6bf5 100644 --- a/src/tint/resolver/struct_pipeline_stage_use_test.cc +++ b/src/tint/resolver/struct_pipeline_stage_use_test.cc @@ -29,7 +29,7 @@ namespace { using ResolverPipelineStageUseTest = ResolverTest; TEST_F(ResolverPipelineStageUseTest, UnusedStruct) { - auto* s = Structure("S", {Member("a", ty.f32(), {Location(0)})}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0)})}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -39,9 +39,9 @@ TEST_F(ResolverPipelineStageUseTest, UnusedStruct) { } TEST_F(ResolverPipelineStageUseTest, StructUsedAsNonEntryPointParam) { - auto* s = Structure("S", {Member("a", ty.f32(), {Location(0)})}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0)})}); - Func("foo", {Param("param", ty.Of(s))}, ty.void_(), {}, {}); + Func("foo", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty, utils::Empty); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -51,9 +51,10 @@ TEST_F(ResolverPipelineStageUseTest, StructUsedAsNonEntryPointParam) { } TEST_F(ResolverPipelineStageUseTest, StructUsedAsNonEntryPointReturnType) { - auto* s = Structure("S", {Member("a", ty.f32(), {Location(0)})}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0)})}); - Func("foo", {}, ty.Of(s), {Return(Construct(ty.Of(s), Expr(0.f)))}, {}); + Func("foo", utils::Empty, ty.Of(s), utils::Vector{Return(Construct(ty.Of(s), Expr(0_f)))}, + utils::Empty); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -63,10 +64,12 @@ TEST_F(ResolverPipelineStageUseTest, StructUsedAsNonEntryPointReturnType) { } TEST_F(ResolverPipelineStageUseTest, StructUsedAsVertexShaderParam) { - auto* s = Structure("S", {Member("a", ty.f32(), {Location(0)})}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0)})}); - Func("main", {Param("param", ty.Of(s))}, ty.vec4(), {Return(Construct(ty.vec4()))}, - {Stage(ast::PipelineStage::kVertex)}, {Builtin(ast::Builtin::kPosition)}); + Func("main", utils::Vector{Param("param", ty.Of(s))}, ty.vec4(), + utils::Vector{Return(Construct(ty.vec4()))}, + utils::Vector{Stage(ast::PipelineStage::kVertex)}, + utils::Vector{Builtin(ast::BuiltinValue::kPosition)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -77,9 +80,12 @@ TEST_F(ResolverPipelineStageUseTest, StructUsedAsVertexShaderParam) { } TEST_F(ResolverPipelineStageUseTest, StructUsedAsVertexShaderReturnType) { - auto* s = Structure("S", {Member("a", ty.vec4(), {Builtin(ast::Builtin::kPosition)})}); + auto* s = + Structure("S", utils::Vector{Member("a", ty.vec4(), + utils::Vector{Builtin(ast::BuiltinValue::kPosition)})}); - Func("main", {}, ty.Of(s), {Return(Construct(ty.Of(s)))}, {Stage(ast::PipelineStage::kVertex)}); + Func("main", utils::Empty, ty.Of(s), utils::Vector{Return(Construct(ty.Of(s)))}, + utils::Vector{Stage(ast::PipelineStage::kVertex)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -90,10 +96,10 @@ TEST_F(ResolverPipelineStageUseTest, StructUsedAsVertexShaderReturnType) { } TEST_F(ResolverPipelineStageUseTest, StructUsedAsFragmentShaderParam) { - auto* s = Structure("S", {Member("a", ty.f32(), {Location(0)})}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0)})}); - Func("main", {Param("param", ty.Of(s))}, ty.void_(), {}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -104,10 +110,10 @@ TEST_F(ResolverPipelineStageUseTest, StructUsedAsFragmentShaderParam) { } TEST_F(ResolverPipelineStageUseTest, StructUsedAsFragmentShaderReturnType) { - auto* s = Structure("S", {Member("a", ty.f32(), {Location(0)})}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0)})}); - Func("main", {}, ty.Of(s), {Return(Construct(ty.Of(s), Expr(0.f)))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.Of(s), utils::Vector{Return(Construct(ty.Of(s), Expr(0_f)))}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -118,11 +124,12 @@ TEST_F(ResolverPipelineStageUseTest, StructUsedAsFragmentShaderReturnType) { } TEST_F(ResolverPipelineStageUseTest, StructUsedAsComputeShaderParam) { - auto* s = - Structure("S", {Member("a", ty.u32(), {Builtin(ast::Builtin::kLocalInvocationIndex)})}); + auto* s = Structure( + "S", utils::Vector{Member( + "a", ty.u32(), utils::Vector{Builtin(ast::BuiltinValue::kLocalInvocationIndex)})}); - Func("main", {Param("param", ty.Of(s))}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + Func("main", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -133,13 +140,15 @@ TEST_F(ResolverPipelineStageUseTest, StructUsedAsComputeShaderParam) { } TEST_F(ResolverPipelineStageUseTest, StructUsedMultipleStages) { - auto* s = Structure("S", {Member("a", ty.vec4(), {Builtin(ast::Builtin::kPosition)})}); + auto* s = + Structure("S", utils::Vector{Member("a", ty.vec4(), + utils::Vector{Builtin(ast::BuiltinValue::kPosition)})}); - Func("vert_main", {}, ty.Of(s), {Return(Construct(ty.Of(s)))}, - {Stage(ast::PipelineStage::kVertex)}); + Func("vert_main", utils::Empty, ty.Of(s), utils::Vector{Return(Construct(ty.Of(s)))}, + utils::Vector{Stage(ast::PipelineStage::kVertex)}); - Func("frag_main", {Param("param", ty.Of(s))}, ty.void_(), {}, - {Stage(ast::PipelineStage::kFragment)}); + Func("frag_main", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -151,11 +160,11 @@ TEST_F(ResolverPipelineStageUseTest, StructUsedMultipleStages) { } TEST_F(ResolverPipelineStageUseTest, StructUsedAsShaderParamViaAlias) { - auto* s = Structure("S", {Member("a", ty.f32(), {Location(0)})}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0)})}); auto* s_alias = Alias("S_alias", ty.Of(s)); - Func("main", {Param("param", ty.Of(s_alias))}, ty.void_(), {}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Vector{Param("param", ty.Of(s_alias))}, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -166,11 +175,12 @@ TEST_F(ResolverPipelineStageUseTest, StructUsedAsShaderParamViaAlias) { } TEST_F(ResolverPipelineStageUseTest, StructUsedAsShaderReturnTypeViaAlias) { - auto* s = Structure("S", {Member("a", ty.f32(), {Location(0)})}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0)})}); auto* s_alias = Alias("S_alias", ty.Of(s)); - Func("main", {}, ty.Of(s_alias), {Return(Construct(ty.Of(s_alias), Expr(0.f)))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.Of(s_alias), + utils::Vector{Return(Construct(ty.Of(s_alias), Expr(0_f)))}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); ASSERT_TRUE(r()->Resolve()) << r()->error(); diff --git a/src/tint/resolver/struct_storage_class_use_test.cc b/src/tint/resolver/struct_storage_class_use_test.cc index 72ed546fcc..af7f976a43 100644 --- a/src/tint/resolver/struct_storage_class_use_test.cc +++ b/src/tint/resolver/struct_storage_class_use_test.cc @@ -28,7 +28,7 @@ namespace { using ResolverStorageClassUseTest = ResolverTest; TEST_F(ResolverStorageClassUseTest, UnreachableStruct) { - auto* s = Structure("S", {Member("a", ty.f32())}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -38,9 +38,9 @@ TEST_F(ResolverStorageClassUseTest, UnreachableStruct) { } TEST_F(ResolverStorageClassUseTest, StructReachableFromParameter) { - auto* s = Structure("S", {Member("a", ty.f32())}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); - Func("f", {Param("param", ty.Of(s))}, ty.void_(), {}, {}); + Func("f", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty, utils::Empty); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -50,9 +50,9 @@ TEST_F(ResolverStorageClassUseTest, StructReachableFromParameter) { } TEST_F(ResolverStorageClassUseTest, StructReachableFromReturnType) { - auto* s = Structure("S", {Member("a", ty.f32())}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); - Func("f", {}, ty.Of(s), {Return(Construct(ty.Of(s)))}, {}); + Func("f", utils::Empty, ty.Of(s), utils::Vector{Return(Construct(ty.Of(s)))}, utils::Empty); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -62,9 +62,9 @@ TEST_F(ResolverStorageClassUseTest, StructReachableFromReturnType) { } TEST_F(ResolverStorageClassUseTest, StructReachableFromGlobal) { - auto* s = Structure("S", {Member("a", ty.f32())}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -74,9 +74,9 @@ TEST_F(ResolverStorageClassUseTest, StructReachableFromGlobal) { } TEST_F(ResolverStorageClassUseTest, StructReachableViaGlobalAlias) { - auto* s = Structure("S", {Member("a", ty.f32())}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); auto* a = Alias("A", ty.Of(s)); - Global("g", ty.Of(a), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(a), ast::StorageClass::kPrivate); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -86,9 +86,9 @@ TEST_F(ResolverStorageClassUseTest, StructReachableViaGlobalAlias) { } TEST_F(ResolverStorageClassUseTest, StructReachableViaGlobalStruct) { - auto* s = Structure("S", {Member("a", ty.f32())}); - auto* o = Structure("O", {Member("a", ty.Of(s))}); - Global("g", ty.Of(o), ast::StorageClass::kPrivate); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); + auto* o = Structure("O", utils::Vector{Member("a", ty.Of(s))}); + GlobalVar("g", ty.Of(o), ast::StorageClass::kPrivate); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -98,9 +98,9 @@ TEST_F(ResolverStorageClassUseTest, StructReachableViaGlobalStruct) { } TEST_F(ResolverStorageClassUseTest, StructReachableViaGlobalArray) { - auto* s = Structure("S", {Member("a", ty.f32())}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); auto* a = ty.array(ty.Of(s), 3_u); - Global("g", a, ast::StorageClass::kPrivate); + GlobalVar("g", a, ast::StorageClass::kPrivate); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -110,7 +110,7 @@ TEST_F(ResolverStorageClassUseTest, StructReachableViaGlobalArray) { } TEST_F(ResolverStorageClassUseTest, StructReachableFromLocal) { - auto* s = Structure("S", {Member("a", ty.f32())}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); WrapInFunction(Var("g", ty.Of(s))); @@ -122,7 +122,7 @@ TEST_F(ResolverStorageClassUseTest, StructReachableFromLocal) { } TEST_F(ResolverStorageClassUseTest, StructReachableViaLocalAlias) { - auto* s = Structure("S", {Member("a", ty.f32())}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); auto* a = Alias("A", ty.Of(s)); WrapInFunction(Var("g", ty.Of(a))); @@ -134,8 +134,8 @@ TEST_F(ResolverStorageClassUseTest, StructReachableViaLocalAlias) { } TEST_F(ResolverStorageClassUseTest, StructReachableViaLocalStruct) { - auto* s = Structure("S", {Member("a", ty.f32())}); - auto* o = Structure("O", {Member("a", ty.Of(s))}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); + auto* o = Structure("O", utils::Vector{Member("a", ty.Of(s))}); WrapInFunction(Var("g", ty.Of(o))); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -146,7 +146,7 @@ TEST_F(ResolverStorageClassUseTest, StructReachableViaLocalStruct) { } TEST_F(ResolverStorageClassUseTest, StructReachableViaLocalArray) { - auto* s = Structure("S", {Member("a", ty.f32())}); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); auto* a = ty.array(ty.Of(s), 3_u); WrapInFunction(Var("g", a)); @@ -158,17 +158,9 @@ TEST_F(ResolverStorageClassUseTest, StructReachableViaLocalArray) { } TEST_F(ResolverStorageClassUseTest, StructMultipleStorageClassUses) { - auto* s = Structure("S", {Member("a", ty.f32())}); - Global("x", ty.Of(s), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); - Global("y", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(0), - }); + auto* s = Structure("S", utils::Vector{Member("a", ty.f32())}); + GlobalVar("x", ty.Of(s), ast::StorageClass::kUniform, Binding(0), Group(0)); + GlobalVar("y", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(0)); WrapInFunction(Var("g", ty.Of(s))); ASSERT_TRUE(r()->Resolve()) << r()->error(); diff --git a/src/tint/resolver/type_constructor_validation_test.cc b/src/tint/resolver/type_constructor_validation_test.cc index edfce46ced..6d771f2ebd 100644 --- a/src/tint/resolver/type_constructor_validation_test.cc +++ b/src/tint/resolver/type_constructor_validation_test.cc @@ -57,10 +57,10 @@ constexpr Params ParamsFor() { } TEST_F(ResolverTypeConstructorValidationTest, InferTypeTest_Simple) { - // var a = 1; + // var a = 1i; // var b = a; - auto* a = Var("a", nullptr, ast::StorageClass::kNone, Expr(1_i)); - auto* b = Var("b", nullptr, ast::StorageClass::kNone, Expr("a")); + auto* a = Var("a", Expr(1_i)); + auto* b = Var("b", Expr("a")); auto* a_ident = Expr("a"); auto* b_ident = Expr("b"); @@ -83,9 +83,11 @@ TEST_P(InferTypeTest_FromConstructorExpression, All) { // } auto& params = GetParam(); + Enable(ast::Extension::kF16); + auto* constructor_expr = params.create_rhs_ast_value(*this, 0); - auto* a = Var("a", nullptr, ast::StorageClass::kNone, constructor_expr); + auto* a = Var("a", constructor_expr); // Self-assign 'a' to force the expression to be resolved so we can test its // type below auto* a_ident = Expr("a"); @@ -104,18 +106,24 @@ static constexpr Params from_constructor_expression_cases[] = { ParamsFor(), ParamsFor(), ParamsFor(), + ParamsFor(), ParamsFor>(), ParamsFor>(), ParamsFor>(), + ParamsFor>(), ParamsFor>(), + ParamsFor>(), ParamsFor>(), ParamsFor>(), ParamsFor>(), ParamsFor>(), + ParamsFor>(), ParamsFor>>(), ParamsFor>>(), ParamsFor>>(), + ParamsFor>>(), ParamsFor>>(), + ParamsFor>>(), }; INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest, InferTypeTest_FromConstructorExpression, @@ -133,7 +141,7 @@ TEST_P(InferTypeTest_FromArithmeticExpression, All) { auto* arith_rhs_expr = params.create_rhs_ast_value(*this, 3); auto* constructor_expr = Mul(arith_lhs_expr, arith_rhs_expr); - auto* a = Var("a", nullptr, constructor_expr); + auto* a = Var("a", constructor_expr); // Self-assign 'a' to force the expression to be resolved so we can test its // type below auto* a_ident = Expr("a"); @@ -147,15 +155,16 @@ TEST_P(InferTypeTest_FromArithmeticExpression, All) { << "expected: " << FriendlyName(expected) << "\n"; } static constexpr Params from_arithmetic_expression_cases[] = { - ParamsFor(), ParamsFor(), ParamsFor(), - ParamsFor>(), ParamsFor>(), - - // TODO(amaiorano): Uncomment once https://crbug.com/tint/680 is fixed - // ParamsFor>(), - // ParamsFor>(), - // ParamsFor>(), - // ParamsFor>>(), - // ParamsFor>>(), + ParamsFor(), + ParamsFor(), + ParamsFor(), + ParamsFor>(), + ParamsFor>(), + ParamsFor>(), + ParamsFor>(), + ParamsFor>(), + ParamsFor>>(), + ParamsFor>>(), }; INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest, InferTypeTest_FromArithmeticExpression, @@ -175,10 +184,12 @@ TEST_P(InferTypeTest_FromCallExpression, All) { // } auto& params = GetParam(); - Func("foo", {}, params.create_rhs_ast_type(*this), - {Return(Construct(params.create_rhs_ast_type(*this)))}, {}); + Enable(ast::Extension::kF16); - auto* a = Var("a", nullptr, Call("foo")); + Func("foo", utils::Empty, params.create_rhs_ast_type(*this), + utils::Vector{Return(Construct(params.create_rhs_ast_type(*this)))}, {}); + + auto* a = Var("a", Call("foo")); // Self-assign 'a' to force the expression to be resolved so we can test its // type below auto* a_ident = Expr("a"); @@ -196,18 +207,24 @@ static constexpr Params from_call_expression_cases[] = { ParamsFor(), ParamsFor(), ParamsFor(), + ParamsFor(), ParamsFor>(), ParamsFor>(), ParamsFor>(), + ParamsFor>(), ParamsFor>(), + ParamsFor>(), ParamsFor>(), ParamsFor>(), ParamsFor>(), ParamsFor>(), + ParamsFor>(), ParamsFor>>(), ParamsFor>>(), ParamsFor>>(), + ParamsFor>>(), ParamsFor>>(), + ParamsFor>>(), }; INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest, InferTypeTest_FromCallExpression, @@ -234,60 +251,97 @@ constexpr Params ParamsFor(Kind kind) { } static constexpr Params valid_cases[] = { - // Direct init (non-conversions) - ParamsFor(Kind::Construct), // - ParamsFor(Kind::Construct), // - ParamsFor(Kind::Construct), // - ParamsFor(Kind::Construct), // - ParamsFor, vec3>(Kind::Construct), // - ParamsFor, vec3>(Kind::Construct), // - ParamsFor, vec3>(Kind::Construct), // - ParamsFor, vec3>(Kind::Construct), // + // Identity + ParamsFor(Kind::Construct), // + ParamsFor(Kind::Construct), // + ParamsFor(Kind::Construct), // + ParamsFor(Kind::Construct), // + ParamsFor(Kind::Construct), // + ParamsFor, vec3>(Kind::Construct), // + ParamsFor, vec3>(Kind::Construct), // + ParamsFor, vec3>(Kind::Construct), // + ParamsFor, vec3>(Kind::Construct), // + ParamsFor, vec3>(Kind::Construct), // + ParamsFor, mat3x3>(Kind::Construct), // + ParamsFor, mat2x3>(Kind::Construct), // + ParamsFor, mat3x2>(Kind::Construct), // + ParamsFor, mat3x3>(Kind::Construct), // + ParamsFor, mat2x3>(Kind::Construct), // + ParamsFor, mat3x2>(Kind::Construct), // // Splat ParamsFor, bool>(Kind::Construct), // ParamsFor, i32>(Kind::Construct), // ParamsFor, u32>(Kind::Construct), // ParamsFor, f32>(Kind::Construct), // + ParamsFor, f16>(Kind::Construct), // // Conversion ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // + ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // + ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // + ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // ParamsFor(Kind::Conversion), // + ParamsFor(Kind::Conversion), // + + ParamsFor(Kind::Conversion), // + ParamsFor(Kind::Conversion), // + ParamsFor(Kind::Conversion), // + ParamsFor(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // + ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // + ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // + ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // ParamsFor, vec3>(Kind::Conversion), // + ParamsFor, vec3>(Kind::Conversion), // + + ParamsFor, vec3>(Kind::Conversion), // + ParamsFor, vec3>(Kind::Conversion), // + ParamsFor, vec3>(Kind::Conversion), // + ParamsFor, vec3>(Kind::Conversion), // + + ParamsFor, mat3x3>(Kind::Conversion), // + ParamsFor, mat2x3>(Kind::Conversion), // + ParamsFor, mat3x2>(Kind::Conversion), // + + ParamsFor, mat3x3>(Kind::Conversion), // + ParamsFor, mat2x3>(Kind::Conversion), // + ParamsFor, mat3x2>(Kind::Conversion), // }; using ConversionConstructorValidTest = ResolverTestWithParam; TEST_P(ConversionConstructorValidTest, All) { auto& params = GetParam(); + Enable(ast::Extension::kF16); + // var a : = (()); auto* lhs_type1 = params.lhs_type(*this); auto* lhs_type2 = params.lhs_type(*this); @@ -301,7 +355,7 @@ TEST_P(ConversionConstructorValidTest, All) { auto* arg = Construct(rhs_type, rhs_value_expr); auto* tc = Construct(lhs_type2, arg); - auto* a = Var("a", lhs_type1, ast::StorageClass::kNone, tc); + auto* a = Var("a", lhs_type1, tc); // Self-assign 'a' to force the expression to be resolved so we can test its // type below @@ -310,14 +364,14 @@ TEST_P(ConversionConstructorValidTest, All) { ASSERT_TRUE(r()->Resolve()) << r()->error(); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); switch (params.kind) { case Kind::Construct: { auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_EQ(ctor->Parameters()[0]->Type(), TypeOf(arg)); break; } @@ -325,7 +379,7 @@ TEST_P(ConversionConstructorValidTest, All) { auto* conv = call->Target()->As(); ASSERT_NE(conv, nullptr); EXPECT_EQ(call->Type(), conv->ReturnType()); - ASSERT_EQ(conv->Parameters().size(), 1u); + ASSERT_EQ(conv->Parameters().Length(), 1u); EXPECT_EQ(conv->Parameters()[0]->Type(), TypeOf(arg)); break; } @@ -340,19 +394,24 @@ constexpr CreatePtrs all_types[] = { CreatePtrsFor(), // CreatePtrsFor(), // CreatePtrsFor(), // + CreatePtrsFor(), // CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // + CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // + CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // + CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // - CreatePtrsFor>() // + CreatePtrsFor>(), // + CreatePtrsFor>(), // }; using ConversionConstructorInvalidTest = ResolverTestWithParam))"; SCOPED_TRACE(ss.str()); - auto* a = Var("a", lhs_type1, ast::StorageClass::kNone, - Construct(lhs_type2, Construct(rhs_type, rhs_value_expr))); + Enable(ast::Extension::kF16); + + auto* a = Var("a", lhs_type1, Construct(lhs_type2, Construct(rhs_type, rhs_value_expr))); // Self-assign 'a' to force the expression to be resolved so we can test its // type below @@ -403,170 +463,386 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest, testing::ValuesIn(all_types))); TEST_F(ResolverTypeConstructorValidationTest, ConversionConstructorInvalid_TooManyInitializers) { - auto* a = Var("a", ty.f32(), ast::StorageClass::kNone, - Construct(Source{{12, 34}}, ty.f32(), Expr(1.0f), Expr(2.0f))); + auto* a = Var("a", ty.f32(), Construct(Source{{12, 34}}, ty.f32(), Expr(1_f), Expr(2_f))); WrapInFunction(a); ASSERT_FALSE(r()->Resolve()); - ASSERT_EQ(r()->error(), "12:34 error: expected zero or one value in constructor, got 2"); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for f32(f32, f32)")); } TEST_F(ResolverTypeConstructorValidationTest, ConversionConstructorInvalid_InvalidInitializer) { - auto* a = Var("a", ty.f32(), ast::StorageClass::kNone, - Construct(Source{{12, 34}}, ty.f32(), Construct(ty.array()))); + auto* a = + Var("a", ty.f32(), Construct(Source{{12, 34}}, ty.f32(), Construct(ty.array()))); WrapInFunction(a); ASSERT_FALSE(r()->Resolve()); - ASSERT_EQ(r()->error(), - "12:34 error: cannot construct 'f32' with a value of type " - "'array'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for f32(array)")); } } // namespace ConversionConstructTest namespace ArrayConstructor { -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_ZeroValue_Pass) { +TEST_F(ResolverTypeConstructorValidationTest, Array_ZeroValue_Pass) { // array(); auto* tc = array(); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); EXPECT_TRUE(call->Type()->Is()); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 0u); + ASSERT_EQ(ctor->Parameters().Length(), 0u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_type_match) { - // array(0u, 10u. 20u); - auto* tc = array(Expr(0_u), Expr(10_u), Expr(20_u)); +TEST_F(ResolverTypeConstructorValidationTest, Array_U32U32U32) { + // array(0u, 10u, 20u); + auto* tc = array(0_u, 10_u, 20_u); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); EXPECT_TRUE(call->Type()->Is()); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 3u); + ASSERT_EQ(ctor->Parameters().Length(), 3u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_type_Mismatch_U32F32) { +TEST_F(ResolverTypeConstructorValidationTest, InferredArray_U32U32U32) { + // array(0u, 10u, 20u); + auto* tc = array(Source{{12, 34}}, nullptr, nullptr, 0_u, 10_u, 20_u); + WrapInFunction(tc); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* call = Sem().Get(tc); + ASSERT_NE(call, nullptr); + EXPECT_TRUE(call->Type()->Is()); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 3u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, Array_U32AIU32) { + // array(0u, 10, 20u); + auto* tc = array(0_u, 10_a, 20_u); + WrapInFunction(tc); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* call = Sem().Get(tc); + ASSERT_NE(call, nullptr); + EXPECT_TRUE(call->Type()->Is()); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 3u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, InferredArray_U32AIU32) { + // array(0u, 10u, 20u); + auto* tc = array(Source{{12, 34}}, nullptr, nullptr, 0_u, 10_a, 20_u); + WrapInFunction(tc); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* call = Sem().Get(tc); + ASSERT_NE(call, nullptr); + EXPECT_TRUE(call->Type()->Is()); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 3u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, ArrayU32_AIAIAI) { + // array(0, 10, 20); + auto* tc = array(0_a, 10_a, 20_a); + WrapInFunction(tc); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* call = Sem().Get(tc); + ASSERT_NE(call, nullptr); + EXPECT_TRUE(call->Type()->Is()); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 3u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, InferredArray_AIAIAI) { + // const c = array(0, 10, 20); + auto* tc = array(Source{{12, 34}}, nullptr, nullptr, 0_a, 10_a, 20_a); + WrapInFunction(Decl(Const("C", tc))); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* call = Sem().Get(tc); + ASSERT_NE(call, nullptr); + EXPECT_TRUE(call->Type()->Is()); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 3u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayU32_VecI32_VecAI) { + // array(vec2(10i), vec2(20)); + auto* tc = array(Source{{12, 34}}, nullptr, nullptr, // + Construct(ty.vec(nullptr, 2), 20_i), // + Construct(ty.vec(nullptr, 2), 20_a)); + WrapInFunction(tc); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* call = Sem().Get(tc); + ASSERT_NE(call, nullptr); + EXPECT_TRUE(call->Type()->Is()); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 2u); + ASSERT_TRUE(ctor->Parameters()[0]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->As()->type()->Is()); + ASSERT_TRUE(ctor->Parameters()[1]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[1]->Type()->As()->type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayU32_VecAI_VecF32) { + // array(vec2(20), vec2(10f)); + auto* tc = array(Source{{12, 34}}, nullptr, nullptr, // + Construct(ty.vec(nullptr, 2), 20_a), // + Construct(ty.vec(nullptr, 2), 20_f)); + WrapInFunction(tc); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* call = Sem().Get(tc); + ASSERT_NE(call, nullptr); + EXPECT_TRUE(call->Type()->Is()); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 2u); + ASSERT_TRUE(ctor->Parameters()[0]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->As()->type()->Is()); + ASSERT_TRUE(ctor->Parameters()[1]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[1]->Type()->As()->type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, ArrayArgumentTypeMismatch_U32F32) { // array(0u, 1.0f, 20u); - auto* tc = array(Expr(0_u), Expr(Source{{12, 34}}, 1.0f), Expr(20_u)); + auto* tc = array(0_u, Expr(Source{{12, 34}}, 1_f), 20_u); + WrapInFunction(tc); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(12:34 error: 'f32' cannot be used to construct an array of 'u32')"); +} + +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayArgumentTypeMismatch_U32F32) { + // array(0u, 1.0f, 20u); + auto* tc = array(Source{{12, 34}}, nullptr, nullptr, 0_u, 1_f, 20_u); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: type in array constructor does not match array type: " - "expected 'u32', found 'f32'"); + R"(12:34 error: cannot infer common array element type from constructor arguments +note: argument 0 is of type 'u32' +note: argument 1 is of type 'f32')"); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Array_ScalarArgumentTypeMismatch_F32I32) { +TEST_F(ResolverTypeConstructorValidationTest, ArrayArgumentTypeMismatch_F32I32) { // array(1i); auto* tc = array(Expr(Source{{12, 34}}, 1_i)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in array constructor does not match array type: " - "expected 'f32', found 'i32'"); + EXPECT_EQ(r()->error(), R"(12:34 error: 'i32' cannot be used to construct an array of 'f32')"); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Array_ScalarArgumentTypeMismatch_U32I32) { +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayArgumentTypeMismatch_F32I32) { + // array(1f, 1i); + auto* tc = array(Source{{12, 34}}, nullptr, nullptr, 1_f, 1_i); + WrapInFunction(tc); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(12:34 error: cannot infer common array element type from constructor arguments +note: argument 0 is of type 'f32' +note: argument 1 is of type 'i32')"); +} + +TEST_F(ResolverTypeConstructorValidationTest, ArrayArgumentTypeMismatch_U32I32) { // array(1i, 0u, 0u, 0u, 0u, 0u); - auto* tc = - array(Expr(Source{{12, 34}}, 1_i), Expr(0_u), Expr(0_u), Expr(0_u), Expr(0_u)); + auto* tc = array(Expr(Source{{12, 34}}, 1_i), 0_u, 0_u, 0_u, 0_u); + WrapInFunction(tc); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(12:34 error: 'i32' cannot be used to construct an array of 'u32')"); +} + +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayArgumentTypeMismatch_U32I32) { + // array(1i, 0u, 0u, 0u, 0u, 0u); + auto* tc = array(Source{{12, 34}}, nullptr, nullptr, 1_i, 0_u, 0_u, 0_u, 0_u); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: type in array constructor does not match array type: " - "expected 'u32', found 'i32'"); + R"(12:34 error: cannot infer common array element type from constructor arguments +note: argument 0 is of type 'i32' +note: argument 1 is of type 'u32')"); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Array_ScalarArgumentTypeMismatch_Vec2) { +TEST_F(ResolverTypeConstructorValidationTest, ArrayArgumentTypeMismatch_I32Vec2) { // array(1i, vec2()); - auto* tc = array(Expr(1_i), Construct(Source{{12, 34}}, ty.vec2())); + auto* tc = array(1_i, vec2(Source{{12, 34}})); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: type in array constructor does not match array type: " - "expected 'i32', found 'vec2'"); + R"(12:34 error: 'vec2' cannot be used to construct an array of 'i32')"); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_ArrayOfVector_SubElemTypeMismatch_I32U32) { - // array, 2u>(vec3(), vec3()); - auto* e0 = vec3(); - SetSource(Source::Location({12, 34})); - auto* e1 = vec3(); - auto* t = Construct(ty.array(ty.vec3(), 2_i), e0, e1); +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayArgumentTypeMismatch_I32Vec2) { + // array(1i, vec2()); + auto* tc = array(Source{{12, 34}}, nullptr, nullptr, 1_i, vec2()); + WrapInFunction(tc); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(12:34 error: cannot infer common array element type from constructor arguments +note: argument 0 is of type 'i32' +note: argument 1 is of type 'vec2')"); +} + +TEST_F(ResolverTypeConstructorValidationTest, ArrayArgumentTypeMismatch_Vec3i32_Vec3u32) { + // array, 2u>(vec3(), vec3()); + auto* t = array(ty.vec3(), 2_u, vec3(Source{{12, 34}}), vec3()); WrapInFunction(t); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: type in array constructor does not match array type: " - "expected 'vec3', found 'vec3'"); + R"(12:34 error: 'vec3' cannot be used to construct an array of 'vec3')"); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_ArrayOfVector_SubElemTypeMismatch_I32Bool) { - // array, 2u>(vec3(), vec3(true, true, false)); - SetSource(Source::Location({12, 34})); - auto* e0 = vec3(true, true, false); - auto* e1 = vec3(); - auto* t = Construct(ty.array(ty.vec3(), 2_i), e0, e1); +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayArgumentTypeMismatch_Vec3i32_Vec3u32) { + // array(vec3(), vec3()); + auto* t = array(Source{{12, 34}}, nullptr, nullptr, vec3(), vec3()); WrapInFunction(t); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: type in array constructor does not match array type: " - "expected 'vec3', found 'vec3'"); + R"(12:34 error: cannot infer common array element type from constructor arguments +note: argument 0 is of type 'vec3' +note: argument 1 is of type 'vec3')"); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_ArrayOfArray_SubElemSizeMismatch) { +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayArgumentTypeMismatch_Vec3i32_Vec3AF) { + // array(vec3(), vec3(1.0)); + auto* t = + array(Source{{12, 34}}, nullptr, nullptr, vec3(), Construct(ty.vec3(nullptr), 1._a)); + WrapInFunction(t); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(12:34 error: cannot infer common array element type from constructor arguments +note: argument 0 is of type 'vec3' +note: argument 1 is of type 'vec3')"); +} + +TEST_F(ResolverTypeConstructorValidationTest, ArrayArgumentTypeMismatch_Vec3i32_Vec3bool) { + // array, 2u>(vec3(), vec3()); + auto* t = array(ty.vec3(), 2_u, vec3(), vec3()); + WrapInFunction(t); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(error: 'vec3' cannot be used to construct an array of 'vec3')"); +} + +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayArgumentTypeMismatch_Vec3i32_Vec3bool) { + // array(vec3(), vec3()); + auto* t = array(Source{{12, 34}}, nullptr, nullptr, vec3(), vec3()); + WrapInFunction(t); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(12:34 error: cannot infer common array element type from constructor arguments +note: argument 0 is of type 'vec3' +note: argument 1 is of type 'vec3')"); +} + +TEST_F(ResolverTypeConstructorValidationTest, ArrayOfArray_SubElemSizeMismatch) { // array, 2u>(array(), array()); - SetSource(Source::Location({12, 34})); - auto* e0 = array(); - auto* e1 = array(); - auto* t = Construct(ty.array(ty.array(), 2_i), e0, e1); + auto* t = array(Source{{12, 34}}, ty.array(), 2_i, array(), array()); WrapInFunction(t); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: type in array constructor does not match array type: " - "expected 'array', found 'array'"); + R"(error: 'array' cannot be used to construct an array of 'array')"); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_ArrayOfArray_SubElemTypeMismatch) { +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayOfArray_SubElemSizeMismatch) { + // array, 2u>(array(), array()); + auto* t = array(Source{{12, 34}}, nullptr, nullptr, array(), array()); + WrapInFunction(t); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(12:34 error: cannot infer common array element type from constructor arguments +note: argument 0 is of type 'array' +note: argument 1 is of type 'array')"); +} + +TEST_F(ResolverTypeConstructorValidationTest, ArrayOfArray_SubElemTypeMismatch) { // array, 2u>(array(), array()); - auto* e0 = array(); - SetSource(Source::Location({12, 34})); - auto* e1 = array(); - auto* t = Construct(ty.array(ty.array(), 2_i), e0, e1); + auto* t = array(Source{{12, 34}}, ty.array(), 2_i, array(), array()); WrapInFunction(t); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: type in array constructor does not match array type: " - "expected 'array', found 'array'"); + R"(error: 'array' cannot be used to construct an array of 'array')"); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_TooFewElements) { +TEST_F(ResolverTypeConstructorValidationTest, InferredArrayOfArray_SubElemTypeMismatch) { + // array, 2u>(array(), array()); + auto* t = array(Source{{12, 34}}, nullptr, nullptr, array(), array()); + WrapInFunction(t); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(12:34 error: cannot infer common array element type from constructor arguments +note: argument 0 is of type 'array' +note: argument 1 is of type 'array')"); +} + +TEST_F(ResolverTypeConstructorValidationTest, Array_TooFewElements) { // array(1i, 2i, 3i); SetSource(Source::Location({12, 34})); auto* tc = array(Expr(1_i), Expr(2_i), Expr(3_i)); @@ -574,11 +850,10 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_TooFewEleme EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: array constructor has too few elements: expected 4, " - "found 3"); + "12:34 error: array constructor has too few elements: expected 4, found 3"); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_TooManyElements) { +TEST_F(ResolverTypeConstructorValidationTest, Array_TooManyElements) { // array(1i, 2i, 3i, 4i, 5i); SetSource(Source::Location({12, 34})); auto* tc = array(Expr(1_i), Expr(2_i), Expr(3_i), Expr(4_i), Expr(5_i)); @@ -591,29 +866,29 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_TooManyElem "found 5"); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_Runtime) { +TEST_F(ResolverTypeConstructorValidationTest, Array_Runtime) { // array(1i); - auto* tc = array(ty.i32(), nullptr, Expr(Source{{12, 34}}, 1_i)); + auto* tc = array(Source{{12, 34}}, ty.i32(), nullptr, Expr(1_i)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "error: cannot init a runtime-sized array"); + EXPECT_EQ(r()->error(), "12:34 error: cannot construct a runtime-sized array"); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_RuntimeZeroValue) { +TEST_F(ResolverTypeConstructorValidationTest, Array_RuntimeZeroValue) { // array(); - auto* tc = array(ty.i32(), nullptr); + auto* tc = array(Source{{12, 34}}, ty.i32(), nullptr); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "error: cannot init a runtime-sized array"); + EXPECT_EQ(r()->error(), "12:34 error: cannot construct a runtime-sized array"); } } // namespace ArrayConstructor namespace ScalarConstructor { -TEST_F(ResolverTypeConstructorValidationTest, Expr_Construct_i32_Success) { +TEST_F(ResolverTypeConstructorValidationTest, I32_Success) { auto* expr = Construct(Expr(123_i)); WrapInFunction(expr); @@ -622,16 +897,16 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Construct_i32_Success) { ASSERT_NE(TypeOf(expr), nullptr); ASSERT_TRUE(TypeOf(expr)->Is()); - auto* call = Sem().Get(expr); + auto* call = Sem().Get(expr); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Construct_u32_Success) { +TEST_F(ResolverTypeConstructorValidationTest, U32_Success) { auto* expr = Construct(Expr(123_u)); WrapInFunction(expr); @@ -640,17 +915,17 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Construct_u32_Success) { ASSERT_NE(TypeOf(expr), nullptr); ASSERT_TRUE(TypeOf(expr)->Is()); - auto* call = Sem().Get(expr); + auto* call = Sem().Get(expr); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Construct_f32_Success) { - auto* expr = Construct(Expr(1.23f)); +TEST_F(ResolverTypeConstructorValidationTest, F32_Success) { + auto* expr = Construct(Expr(1.23_f)); WrapInFunction(expr); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -658,17 +933,37 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Construct_f32_Success) { ASSERT_NE(TypeOf(expr), nullptr); ASSERT_TRUE(TypeOf(expr)->Is()); - auto* call = Sem().Get(expr); + auto* call = Sem().Get(expr); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Convert_f32_to_i32_Success) { - auto* expr = Construct(1.23f); +TEST_F(ResolverTypeConstructorValidationTest, F16_Success) { + Enable(ast::Extension::kF16); + + auto* expr = Construct(Expr(1.5_h)); + WrapInFunction(expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(expr), nullptr); + ASSERT_TRUE(TypeOf(expr)->Is()); + + auto* call = Sem().Get(expr); + ASSERT_NE(call, nullptr); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 1u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, Convert_f32_to_i32_Success) { + auto* expr = Construct(1.23_f); WrapInFunction(expr); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -676,16 +971,16 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Convert_f32_to_i32_Success) { ASSERT_NE(TypeOf(expr), nullptr); ASSERT_TRUE(TypeOf(expr)->Is()); - auto* call = Sem().Get(expr); + auto* call = Sem().Get(expr); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Convert_i32_to_u32_Success) { +TEST_F(ResolverTypeConstructorValidationTest, Convert_i32_to_u32_Success) { auto* expr = Construct(123_i); WrapInFunction(expr); @@ -694,17 +989,39 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Convert_i32_to_u32_Success) { ASSERT_NE(TypeOf(expr), nullptr); ASSERT_TRUE(TypeOf(expr)->Is()); - auto* call = Sem().Get(expr); + auto* call = Sem().Get(expr); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Convert_u32_to_f32_Success) { - auto* expr = Construct(123_u); +TEST_F(ResolverTypeConstructorValidationTest, Convert_u32_to_f16_Success) { + Enable(ast::Extension::kF16); + + auto* expr = Construct(123_u); + WrapInFunction(expr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(expr), nullptr); + ASSERT_TRUE(TypeOf(expr)->Is()); + + auto* call = Sem().Get(expr); + ASSERT_NE(call, nullptr); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 1u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, Convert_f16_to_f32_Success) { + Enable(ast::Extension::kF16); + + auto* expr = Construct(123_h); WrapInFunction(expr); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -712,119 +1029,111 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Convert_u32_to_f32_Success) { ASSERT_NE(TypeOf(expr), nullptr); ASSERT_TRUE(TypeOf(expr)->Is()); - auto* call = Sem().Get(expr); + auto* call = Sem().Get(expr); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); - EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); + ASSERT_EQ(ctor->Parameters().Length(), 1u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } } // namespace ScalarConstructor namespace VectorConstructor { -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec2F32_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec2(Expr(Source{{12, 34}}, 1_i), 1.0f); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2F32_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec2(Source{{12, 34}}, 1_i, 2_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'f32', found 'i32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(i32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec2U32_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec2(1_u, Expr(Source{{12, 34}}, 1_i)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2F16_Error_ScalarArgumentTypeMismatch) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec2(Source{{12, 34}}, 1_h, 2_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'u32', found 'i32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(f16, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec2I32_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec2(Expr(Source{{12, 34}}, 1_u), 1_i); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2U32_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec2(Source{{12, 34}}, 1_u, 2_i)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'i32', found 'u32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(u32, i32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec2Bool_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec2(true, Expr(Source{{12, 34}}, 1_i)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2I32_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec2(Source{{12, 34}}, 1_u, 2_i)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'bool', found 'i32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(u32, i32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec2_Error_Vec3ArgumentCardinalityTooLarge) { - auto* tc = vec2(Construct(Source{{12, 34}}, ty.vec3())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2Bool_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec2(Source{{12, 34}}, true, 1_i)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec2' with 3 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(bool, i32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec2_Error_Vec4ArgumentCardinalityTooLarge) { - auto* tc = vec2(Construct(Source{{12, 34}}, ty.vec4())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2_Error_Vec3ArgumentCardinalityTooLarge) { + WrapInFunction(vec2(Source{{12, 34}}, vec3())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec2' with 4 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(vec3)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2_Error_TooManyArgumentsScalar) { - auto* tc = vec2(Expr(Source{{12, 34}}, 1.0f), Expr(Source{{12, 40}}, 1.0f), - Expr(Source{{12, 46}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2_Error_Vec4ArgumentCardinalityTooLarge) { + WrapInFunction(vec2(Source{{12, 34}}, vec4())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec2' with 3 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(vec4)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2_Error_TooManyArgumentsVector) { - auto* tc = vec2(Construct(Source{{12, 34}}, ty.vec2()), - Construct(Source{{12, 40}}, ty.vec2())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2_Error_TooManyArgumentsScalar) { + WrapInFunction(vec2(Source{{12, 34}}, 1_f, 2_f, 3_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec2' with 4 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(f32, f32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec2_Error_TooManyArgumentsVectorAndScalar) { - auto* tc = vec2(Construct(Source{{12, 34}}, ty.vec2()), Expr(Source{{12, 40}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2_Error_TooManyArgumentsVector) { + WrapInFunction(vec2(Source{{12, 34}}, vec2(), vec2())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec2' with 3 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(vec2, vec2)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2_Error_InvalidArgumentType) { - auto* tc = vec2(Construct(Source{{12, 34}}, ty.mat2x2())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec2_Error_TooManyArgumentsVectorAndScalar) { + WrapInFunction(vec2(Source{{12, 34}}, vec2(), 1_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: expected vector or scalar type in vector " - "constructor; found: mat2x2"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(vec2, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2_Success_ZeroValue) { +TEST_F(ResolverTypeConstructorValidationTest, Vec2_Error_InvalidArgumentType) { + WrapInFunction(vec2(Source{{12, 34}}, mat2x2())); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(mat2x2)")); +} + +TEST_F(ResolverTypeConstructorValidationTest, Vec2_Success_ZeroValue) { auto* tc = vec2(); WrapInFunction(tc); @@ -835,16 +1144,16 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2_Success_Zero EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 2u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 0u); + ASSERT_EQ(ctor->Parameters().Length(), 0u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2F32_Success_Scalar) { - auto* tc = vec2(1.0f, 1.0f); +TEST_F(ResolverTypeConstructorValidationTest, Vec2F32_Success_Scalar) { + auto* tc = vec2(1_f, 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -854,17 +1163,40 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2F32_Success_S EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 2u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2U32_Success_Scalar) { +TEST_F(ResolverTypeConstructorValidationTest, Vec2F16_Success_Scalar) { + Enable(ast::Extension::kF16); + + auto* tc = vec2(1_h, 1_h); + WrapInFunction(tc); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(tc), nullptr); + ASSERT_TRUE(TypeOf(tc)->Is()); + EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); + EXPECT_EQ(TypeOf(tc)->As()->Width(), 2u); + + auto* call = Sem().Get(tc); + ASSERT_NE(call, nullptr); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 2u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, Vec2U32_Success_Scalar) { auto* tc = vec2(1_u, 1_u); WrapInFunction(tc); @@ -875,17 +1207,17 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2U32_Success_S EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 2u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2I32_Success_Scalar) { +TEST_F(ResolverTypeConstructorValidationTest, Vec2I32_Success_Scalar) { auto* tc = vec2(1_i, 1_i); WrapInFunction(tc); @@ -896,17 +1228,17 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2I32_Success_S EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 2u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2Bool_Success_Scalar) { +TEST_F(ResolverTypeConstructorValidationTest, Vec2Bool_Success_Scalar) { auto* tc = vec2(true, false); WrapInFunction(tc); @@ -917,17 +1249,17 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2Bool_Success_ EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 2u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2_Success_Identity) { +TEST_F(ResolverTypeConstructorValidationTest, Vec2_Success_Identity) { auto* tc = vec2(vec2()); WrapInFunction(tc); @@ -938,16 +1270,16 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2_Success_Iden EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 2u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2_Success_Vec2TypeConversion) { +TEST_F(ResolverTypeConstructorValidationTest, Vec2_Success_Vec2TypeConversion) { auto* tc = vec2(vec2()); WrapInFunction(tc); @@ -958,131 +1290,125 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec2_Success_Vec2 EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 2u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec3F32_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec3(1.0f, 1.0f, Expr(Source{{12, 34}}, 1_i)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3F32_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec3(Source{{12, 34}}, 1_f, 2_f, 3_i)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'f32', found 'i32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(f32, f32, i32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec3U32_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec3(1_u, Expr(Source{{12, 34}}, 1_i), 1_u); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3F16_Error_ScalarArgumentTypeMismatch) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3(Source{{12, 34}}, 1_h, 2_h, 3_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'u32', found 'i32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(f16, f16, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec3I32_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec3(1_i, Expr(Source{{12, 34}}, 1_u), 1_i); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3U32_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec3(Source{{12, 34}}, 1_u, 2_i, 3_u)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'i32', found 'u32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(u32, i32, u32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec3Bool_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec3(true, Expr(Source{{12, 34}}, 1_i), false); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3I32_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec3(Source{{12, 34}}, 1_i, 2_u, 3_i)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'bool', found 'i32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(i32, u32, i32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec3_Error_Vec4ArgumentCardinalityTooLarge) { - auto* tc = vec3(Construct(Source{{12, 34}}, ty.vec4())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3Bool_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec3(Source{{12, 34}}, false, 1_i, true)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec3' with 4 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(bool, i32, bool)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Error_TooFewArgumentsScalar) { - auto* tc = vec3(Expr(Source{{12, 34}}, 1.0f), Expr(Source{{12, 40}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Error_Vec4ArgumentCardinalityTooLarge) { + WrapInFunction(vec3(Source{{12, 34}}, vec4())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec3' with 2 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(vec4)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Error_TooManyArgumentsScalar) { - auto* tc = vec3(Expr(Source{{12, 34}}, 1.0f), Expr(Source{{12, 40}}, 1.0f), - Expr(Source{{12, 46}}, 1.0f), Expr(Source{{12, 52}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Error_TooFewArgumentsScalar) { + WrapInFunction(vec3(Source{{12, 34}}, 1_f, 2_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec3' with 4 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(f32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Error_TooFewArgumentsVec2) { - auto* tc = vec3(Construct(Source{{12, 34}}, ty.vec2())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Error_TooManyArgumentsScalar) { + WrapInFunction(vec3(Source{{12, 34}}, 1_f, 2_f, 3_f, 4_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec3' with 2 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(f32, f32, f32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Error_TooManyArgumentsVec2) { - auto* tc = vec3(Construct(Source{{12, 34}}, ty.vec2()), - Construct(Source{{12, 40}}, ty.vec2())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Error_TooFewArgumentsVec2) { + WrapInFunction(vec3(Source{{12, 34}}, vec2())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec3' with 4 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(vec2)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec3_Error_TooManyArgumentsVec2AndScalar) { - auto* tc = vec3(Construct(Source{{12, 34}}, ty.vec2()), Expr(Source{{12, 40}}, 1.0f), - Expr(Source{{12, 46}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Error_TooManyArgumentsVec2) { + WrapInFunction(vec3(Source{{12, 34}}, vec2(), vec2())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec3' with 4 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(vec2, vec2)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Error_TooManyArgumentsVec3) { - auto* tc = vec3(Construct(Source{{12, 34}}, ty.vec3()), Expr(Source{{12, 40}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Error_TooManyArgumentsVec2AndScalar) { + WrapInFunction(vec3(Source{{12, 34}}, vec2(), 1_f, 1_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec3' with 4 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(vec2, f32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Error_InvalidArgumentType) { - auto* tc = vec3(Construct(Source{{12, 34}}, ty.mat2x2())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Error_TooManyArgumentsVec3) { + WrapInFunction(vec3(Source{{12, 34}}, vec3(), 1_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: expected vector or scalar type in vector " - "constructor; found: mat2x2"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(vec3, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_ZeroValue) { +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Error_InvalidArgumentType) { + WrapInFunction(vec3(Source{{12, 34}}, mat2x2())); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(mat2x2)")); +} + +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Success_ZeroValue) { auto* tc = vec3(); WrapInFunction(tc); @@ -1093,16 +1419,16 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_Zero EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 0u); + ASSERT_EQ(ctor->Parameters().Length(), 0u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3F32_Success_Scalar) { - auto* tc = vec3(1.0f, 1.0f, 1.0f); +TEST_F(ResolverTypeConstructorValidationTest, Vec3F32_Success_Scalar) { + auto* tc = vec3(1_f, 1_f, 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1112,18 +1438,42 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3F32_Success_S EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 3u); + ASSERT_EQ(ctor->Parameters().Length(), 3u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3U32_Success_Scalar) { +TEST_F(ResolverTypeConstructorValidationTest, Vec3F16_Success_Scalar) { + Enable(ast::Extension::kF16); + + auto* tc = vec3(1_h, 1_h, 1_h); + WrapInFunction(tc); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(tc), nullptr); + ASSERT_TRUE(TypeOf(tc)->Is()); + EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); + EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); + + auto* call = Sem().Get(tc); + ASSERT_NE(call, nullptr); + auto* ctor = call->Target()->As(); + ASSERT_NE(ctor, nullptr); + EXPECT_EQ(call->Type(), ctor->ReturnType()); + ASSERT_EQ(ctor->Parameters().Length(), 3u); + EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); + EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); +} + +TEST_F(ResolverTypeConstructorValidationTest, Vec3U32_Success_Scalar) { auto* tc = vec3(1_u, 1_u, 1_u); WrapInFunction(tc); @@ -1134,18 +1484,18 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3U32_Success_S EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 3u); + ASSERT_EQ(ctor->Parameters().Length(), 3u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3I32_Success_Scalar) { +TEST_F(ResolverTypeConstructorValidationTest, Vec3I32_Success_Scalar) { auto* tc = vec3(1_i, 1_i, 1_i); WrapInFunction(tc); @@ -1156,18 +1506,18 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3I32_Success_S EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 3u); + ASSERT_EQ(ctor->Parameters().Length(), 3u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3Bool_Success_Scalar) { +TEST_F(ResolverTypeConstructorValidationTest, Vec3Bool_Success_Scalar) { auto* tc = vec3(true, false, true); WrapInFunction(tc); @@ -1178,19 +1528,19 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3Bool_Success_ EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 3u); + ASSERT_EQ(ctor->Parameters().Length(), 3u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_Vec2AndScalar) { - auto* tc = vec3(vec2(), 1.0f); +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Success_Vec2AndScalar) { + auto* tc = vec3(vec2(), 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1200,18 +1550,18 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_Vec2 EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_ScalarAndVec2) { - auto* tc = vec3(1.0f, vec2()); +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Success_ScalarAndVec2) { + auto* tc = vec3(1_f, vec2()); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1221,17 +1571,17 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_Scal EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_Identity) { +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Success_Identity) { auto* tc = vec3(vec3()); WrapInFunction(tc); @@ -1242,16 +1592,16 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_Iden EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_Vec3TypeConversion) { +TEST_F(ResolverTypeConstructorValidationTest, Vec3_Success_Vec3TypeConversion) { auto* tc = vec3(vec3()); WrapInFunction(tc); @@ -1262,177 +1612,168 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec3_Success_Vec3 EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); EXPECT_EQ(TypeOf(tc)->As()->Width(), 3u); - auto* call = Sem().Get(tc); + auto* call = Sem().Get(tc); ASSERT_NE(call, nullptr); auto* ctor = call->Target()->As(); ASSERT_NE(ctor, nullptr); EXPECT_EQ(call->Type(), ctor->ReturnType()); - ASSERT_EQ(ctor->Parameters().size(), 1u); + ASSERT_EQ(ctor->Parameters().Length(), 1u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4F32_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec4(1.0f, 1.0f, Expr(Source{{12, 34}}, 1_i), 1.0f); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4F32_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec4(Source{{12, 34}}, 1_f, 1_f, 1_i, 1_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'f32', found 'i32'"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(f32, f32, i32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4U32_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec4(1_u, 1_u, Expr(Source{{12, 34}}, 1_i), 1_u); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4F16_Error_ScalarArgumentTypeMismatch) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec4(Source{{12, 34}}, 1_h, 1_h, 1_f, 1_h)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'u32', found 'i32'"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(f16, f16, f32, f16)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4I32_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec4(1_i, 1_i, Expr(Source{{12, 34}}, 1_u), 1_i); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4U32_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec4(Source{{12, 34}}, 1_u, 1_u, 1_i, 1_u)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'i32', found 'u32'"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(u32, u32, i32, u32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4Bool_Error_ScalarArgumentTypeMismatch) { - auto* tc = vec4(true, false, Expr(Source{{12, 34}}, 1_i), true); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4I32_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec4(Source{{12, 34}}, 1_i, 1_i, 1_u, 1_i)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'bool', found 'i32'"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(i32, i32, u32, i32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Error_TooFewArgumentsScalar) { - auto* tc = vec4(Expr(Source{{12, 34}}, 1.0f), Expr(Source{{12, 40}}, 1.0f), - Expr(Source{{12, 46}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4Bool_Error_ScalarArgumentTypeMismatch) { + WrapInFunction(vec4(Source{{12, 34}}, true, false, 1_i, true)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 3 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(bool, bool, i32, bool)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Error_TooManyArgumentsScalar) { - auto* tc = vec4(Expr(Source{{12, 34}}, 1.0f), Expr(Source{{12, 40}}, 1.0f), - Expr(Source{{12, 46}}, 1.0f), Expr(Source{{12, 52}}, 1.0f), - Expr(Source{{12, 58}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooFewArgumentsScalar) { + WrapInFunction(vec4(Source{{12, 34}}, 1_f, 2_f, 3_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 5 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(f32, f32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4_Error_TooFewArgumentsVec2AndScalar) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.vec2()), Expr(Source{{12, 40}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooManyArgumentsScalar) { + WrapInFunction(vec4(Source{{12, 34}}, 1_f, 2_f, 3_f, 4_f, 5_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 3 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(f32, f32, f32, f32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4_Error_TooManyArgumentsVec2AndScalars) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.vec2()), Expr(Source{{12, 40}}, 1.0f), - Expr(Source{{12, 46}}, 1.0f), Expr(Source{{12, 52}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooFewArgumentsVec2AndScalar) { + WrapInFunction(vec4(Source{{12, 34}}, vec2(), 1_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 5 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(vec2, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4_Error_TooManyArgumentsVec2Vec2Scalar) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.vec2()), - Construct(Source{{12, 40}}, ty.vec2()), Expr(Source{{12, 46}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooManyArgumentsVec2AndScalars) { + WrapInFunction(vec4(Source{{12, 34}}, vec2(), 1_f, 2_f, 3_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 5 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(vec2, f32, f32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4_Error_TooManyArgumentsVec2Vec2Vec2) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.vec2()), - Construct(Source{{12, 40}}, ty.vec2()), - Construct(Source{{12, 40}}, ty.vec2())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooManyArgumentsVec2Vec2Scalar) { + WrapInFunction(vec4(Source{{12, 34}}, vec2(), vec2(), 1_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 6 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(vec2, vec2, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Error_TooFewArgumentsVec3) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.vec3())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooManyArgumentsVec2Vec2Vec2) { + WrapInFunction(vec4(Source{{12, 34}}, vec2(), vec2(), vec2())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 3 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr( + "12:34 error: no matching constructor for vec4(vec2, vec2, vec2)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4_Error_TooManyArgumentsVec3AndScalars) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.vec3()), Expr(Source{{12, 40}}, 1.0f), - Expr(Source{{12, 46}}, 1.0f)); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooFewArgumentsVec3) { + WrapInFunction(vec4(Source{{12, 34}}, vec3())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 5 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(vec3)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4_Error_TooManyArgumentsVec3AndVec2) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.vec3()), - Construct(Source{{12, 40}}, ty.vec2())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooManyArgumentsVec3AndScalars) { + WrapInFunction(vec4(Source{{12, 34}}, vec3(), 1_f, 2_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 5 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(vec3, f32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4_Error_TooManyArgumentsVec2AndVec3) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.vec2()), - Construct(Source{{12, 40}}, ty.vec3())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooManyArgumentsVec3AndVec2) { + WrapInFunction(vec4(Source{{12, 34}}, vec3(), vec2())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 5 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(vec3, vec2)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vec4_Error_TooManyArgumentsVec3AndVec3) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.vec3()), - Construct(Source{{12, 40}}, ty.vec3())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooManyArgumentsVec2AndVec3) { + WrapInFunction(vec4(Source{{12, 34}}, vec2(), vec3())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec4' with 6 component(s)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(vec2, vec3)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Error_InvalidArgumentType) { - auto* tc = vec4(Construct(Source{{12, 34}}, ty.mat2x2())); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_TooManyArgumentsVec3AndVec3) { + WrapInFunction(vec4(Source{{12, 34}}, vec3(), vec3())); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: expected vector or scalar type in vector " - "constructor; found: mat2x2"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(vec3, vec3)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_ZeroValue) { +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Error_InvalidArgumentType) { + WrapInFunction(vec4(Source{{12, 34}}, mat2x2())); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec4(mat2x2)")); +} + +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Success_ZeroValue) { auto* tc = vec4(); WrapInFunction(tc); @@ -1444,8 +1785,8 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Zero EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4F32_Success_Scalar) { - auto* tc = vec4(1.0f, 1.0f, 1.0f, 1.0f); +TEST_F(ResolverTypeConstructorValidationTest, Vec4F32_Success_Scalar) { + auto* tc = vec4(1_f, 1_f, 1_f, 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1456,7 +1797,21 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4F32_Success_S EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4U32_Success_Scalar) { +TEST_F(ResolverTypeConstructorValidationTest, Vec4F16_Success_Scalar) { + Enable(ast::Extension::kF16); + + auto* tc = vec4(1_h, 1_h, 1_h, 1_h); + WrapInFunction(tc); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_NE(TypeOf(tc), nullptr); + ASSERT_TRUE(TypeOf(tc)->Is()); + EXPECT_TRUE(TypeOf(tc)->As()->type()->Is()); + EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); +} + +TEST_F(ResolverTypeConstructorValidationTest, Vec4U32_Success_Scalar) { auto* tc = vec4(1_u, 1_u, 1_u, 1_u); WrapInFunction(tc); @@ -1468,7 +1823,7 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4U32_Success_S EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4I32_Success_Scalar) { +TEST_F(ResolverTypeConstructorValidationTest, Vec4I32_Success_Scalar) { auto* tc = vec4(1_i, 1_i, 1_i, 1_i); WrapInFunction(tc); @@ -1480,7 +1835,7 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4I32_Success_S EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4Bool_Success_Scalar) { +TEST_F(ResolverTypeConstructorValidationTest, Vec4Bool_Success_Scalar) { auto* tc = vec4(true, false, true, false); WrapInFunction(tc); @@ -1492,8 +1847,8 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4Bool_Success_ EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Vec2ScalarScalar) { - auto* tc = vec4(vec2(), 1.0f, 1.0f); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Success_Vec2ScalarScalar) { + auto* tc = vec4(vec2(), 1_f, 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1504,8 +1859,8 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Vec2 EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_ScalarVec2Scalar) { - auto* tc = vec4(1.0f, vec2(), 1.0f); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Success_ScalarVec2Scalar) { + auto* tc = vec4(1_f, vec2(), 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1516,8 +1871,8 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Scal EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_ScalarScalarVec2) { - auto* tc = vec4(1.0f, 1.0f, vec2()); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Success_ScalarScalarVec2) { + auto* tc = vec4(1_f, 1_f, vec2()); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1528,7 +1883,7 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Scal EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Vec2AndVec2) { +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Success_Vec2AndVec2) { auto* tc = vec4(vec2(), vec2()); WrapInFunction(tc); @@ -1540,8 +1895,8 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Vec2 EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Vec3AndScalar) { - auto* tc = vec4(vec3(), 1.0f); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Success_Vec3AndScalar) { + auto* tc = vec4(vec3(), 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1552,8 +1907,8 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Vec3 EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_ScalarAndVec3) { - auto* tc = vec4(1.0f, vec3()); +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Success_ScalarAndVec3) { + auto* tc = vec4(1_f, vec3()); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1564,7 +1919,7 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Scal EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Identity) { +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Success_Identity) { auto* tc = vec4(vec4()); WrapInFunction(tc); @@ -1576,7 +1931,7 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Iden EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Vec4TypeConversion) { +TEST_F(ResolverTypeConstructorValidationTest, Vec4_Success_Vec4TypeConversion) { auto* tc = vec4(vec4()); WrapInFunction(tc); @@ -1588,20 +1943,18 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vec4_Success_Vec4 EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_NestedVectorConstructors_InnerError) { - auto* tc = - vec4(vec4(1.0f, 1.0f, - vec3(Expr(Source{{12, 34}}, 1.0f), Expr(Source{{12, 34}}, 1.0f))), - 1.0f); - WrapInFunction(tc); +TEST_F(ResolverTypeConstructorValidationTest, NestedVectorConstructors_InnerError) { + WrapInFunction(vec4(vec4(1_f, 1_f, // + vec3(Source{{12, 34}}, 1_f, 1_f)), + 1_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: attempted to construct 'vec3' with 2 component(s)"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(f32, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_NestedVectorConstructors_Success) { - auto* tc = vec4(vec3(vec2(1.0f, 1.0f), 1.0f), 1.0f); +TEST_F(ResolverTypeConstructorValidationTest, NestedVectorConstructors_Success) { + auto* tc = vec4(vec3(vec2(1_f, 1_f), 1_f), 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1612,88 +1965,83 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_NestedVectorConst EXPECT_EQ(TypeOf(tc)->As()->Width(), 4u); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vector_Alias_Argument_Error) { +TEST_F(ResolverTypeConstructorValidationTest, Vector_Alias_Argument_Error) { auto* alias = Alias("UnsignedInt", ty.u32()); - Global("uint_var", ty.Of(alias), ast::StorageClass::kPrivate); + GlobalVar("uint_var", ty.Of(alias), ast::StorageClass::kPrivate); - auto* tc = vec2(Expr(Source{{12, 34}}, "uint_var")); + auto* tc = vec2(Source{{12, 34}}, "uint_var"); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'f32', found 'u32'"); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for vec2(u32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vector_Alias_Argument_Success) { +TEST_F(ResolverTypeConstructorValidationTest, Vector_Alias_Argument_Success) { auto* f32_alias = Alias("Float32", ty.f32()); auto* vec2_alias = Alias("VectorFloat2", ty.vec2()); - Global("my_f32", ty.Of(f32_alias), ast::StorageClass::kPrivate); - Global("my_vec2", ty.Of(vec2_alias), ast::StorageClass::kPrivate); + GlobalVar("my_f32", ty.Of(f32_alias), ast::StorageClass::kPrivate); + GlobalVar("my_vec2", ty.Of(vec2_alias), ast::StorageClass::kPrivate); auto* tc = vec3("my_vec2", "my_f32"); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vector_ElementTypeAlias_Error) { +TEST_F(ResolverTypeConstructorValidationTest, Vector_ElementTypeAlias_Error) { auto* f32_alias = Alias("Float32", ty.f32()); // vec2(1.0f, 1u) auto* vec_type = ty.vec(ty.Of(f32_alias), 2); - auto* tc = Construct(Source{{12, 34}}, vec_type, 1.0f, Expr(Source{{12, 40}}, 1_u)); - WrapInFunction(tc); + WrapInFunction(Construct(Source{{12, 34}}, vec_type, 1_f, 1_u)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:40 error: type in vector constructor does not match vector " - "type: expected 'f32', found 'u32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec2(f32, u32)")); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Vector_ElementTypeAlias_Success) { +TEST_F(ResolverTypeConstructorValidationTest, Vector_ElementTypeAlias_Success) { auto* f32_alias = Alias("Float32", ty.f32()); // vec2(1.0f, 1.0f) auto* vec_type = ty.vec(ty.Of(f32_alias), 2); - auto* tc = Construct(Source{{12, 34}}, vec_type, 1.0f, 1.0f); + auto* tc = Construct(Source{{12, 34}}, vec_type, 1_f, 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vector_ArgumentElementTypeAlias_Error) { +TEST_F(ResolverTypeConstructorValidationTest, Vector_ArgumentElementTypeAlias_Error) { auto* f32_alias = Alias("Float32", ty.f32()); // vec3(vec(), 1.0f) auto* vec_type = ty.vec(ty.Of(f32_alias), 2); - auto* tc = vec3(Construct(Source{{12, 34}}, vec_type), 1.0f); - WrapInFunction(tc); + WrapInFunction(vec3(Source{{12, 34}}, Construct(vec_type), 1_f)); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: type in vector constructor does not match vector " - "type: expected 'u32', found 'f32'"); + EXPECT_THAT(r()->error(), + HasSubstr("12:34 error: no matching constructor for vec3(vec2, f32)")); } -TEST_F(ResolverTypeConstructorValidationTest, - Expr_Constructor_Vector_ArgumentElementTypeAlias_Success) { +TEST_F(ResolverTypeConstructorValidationTest, Vector_ArgumentElementTypeAlias_Success) { auto* f32_alias = Alias("Float32", ty.f32()); // vec3(vec(), 1.0f) auto* vec_type = ty.vec(ty.Of(f32_alias), 2); - auto* tc = vec3(Construct(Source{{12, 34}}, vec_type), 1.0f); + auto* tc = vec3(Construct(Source{{12, 34}}, vec_type), 1_f); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverTypeConstructorValidationTest, InferVec2ElementTypeFromScalars) { - auto* vec2_bool = Construct(create(nullptr, 2), Expr(true), Expr(false)); - auto* vec2_i32 = Construct(create(nullptr, 2), Expr(1_i), Expr(2_i)); - auto* vec2_u32 = Construct(create(nullptr, 2), Expr(1_u), Expr(2_u)); - auto* vec2_f32 = Construct(create(nullptr, 2), Expr(1.0f), Expr(2.0f)); - WrapInFunction(vec2_bool, vec2_i32, vec2_u32, vec2_f32); + Enable(ast::Extension::kF16); + + auto* vec2_bool = Construct(create(nullptr, 2u), Expr(true), Expr(false)); + auto* vec2_i32 = Construct(create(nullptr, 2u), Expr(1_i), Expr(2_i)); + auto* vec2_u32 = Construct(create(nullptr, 2u), Expr(1_u), Expr(2_u)); + auto* vec2_f32 = Construct(create(nullptr, 2u), Expr(1_f), Expr(2_f)); + auto* vec2_f16 = Construct(create(nullptr, 2u), Expr(1_h), Expr(2_h)); + WrapInFunction(vec2_bool, vec2_i32, vec2_u32, vec2_f32, vec2_f16); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1701,26 +2049,33 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec2ElementTypeFromScalars) { ASSERT_TRUE(TypeOf(vec2_i32)->Is()); ASSERT_TRUE(TypeOf(vec2_u32)->Is()); ASSERT_TRUE(TypeOf(vec2_f32)->Is()); + ASSERT_TRUE(TypeOf(vec2_f16)->Is()); EXPECT_TRUE(TypeOf(vec2_bool)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec2_i32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec2_u32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec2_f32)->As()->type()->Is()); + EXPECT_TRUE(TypeOf(vec2_f16)->As()->type()->Is()); EXPECT_EQ(TypeOf(vec2_bool)->As()->Width(), 2u); EXPECT_EQ(TypeOf(vec2_i32)->As()->Width(), 2u); EXPECT_EQ(TypeOf(vec2_u32)->As()->Width(), 2u); EXPECT_EQ(TypeOf(vec2_f32)->As()->Width(), 2u); + EXPECT_EQ(TypeOf(vec2_f16)->As()->Width(), 2u); EXPECT_EQ(TypeOf(vec2_bool), TypeOf(vec2_bool->target.type)); EXPECT_EQ(TypeOf(vec2_i32), TypeOf(vec2_i32->target.type)); EXPECT_EQ(TypeOf(vec2_u32), TypeOf(vec2_u32->target.type)); EXPECT_EQ(TypeOf(vec2_f32), TypeOf(vec2_f32->target.type)); + EXPECT_EQ(TypeOf(vec2_f16), TypeOf(vec2_f16->target.type)); } TEST_F(ResolverTypeConstructorValidationTest, InferVec2ElementTypeFromVec2) { - auto* vec2_bool = Construct(create(nullptr, 2), vec2(true, false)); - auto* vec2_i32 = Construct(create(nullptr, 2), vec2(1_i, 2_i)); - auto* vec2_u32 = Construct(create(nullptr, 2), vec2(1_u, 2_u)); - auto* vec2_f32 = Construct(create(nullptr, 2), vec2(1.0f, 2.0f)); - WrapInFunction(vec2_bool, vec2_i32, vec2_u32, vec2_f32); + Enable(ast::Extension::kF16); + + auto* vec2_bool = Construct(create(nullptr, 2u), vec2(true, false)); + auto* vec2_i32 = Construct(create(nullptr, 2u), vec2(1_i, 2_i)); + auto* vec2_u32 = Construct(create(nullptr, 2u), vec2(1_u, 2_u)); + auto* vec2_f32 = Construct(create(nullptr, 2u), vec2(1_f, 2_f)); + auto* vec2_f16 = Construct(create(nullptr, 2u), vec2(1_h, 2_h)); + WrapInFunction(vec2_bool, vec2_i32, vec2_u32, vec2_f32, vec2_f16); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1728,27 +2083,34 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec2ElementTypeFromVec2) { ASSERT_TRUE(TypeOf(vec2_i32)->Is()); ASSERT_TRUE(TypeOf(vec2_u32)->Is()); ASSERT_TRUE(TypeOf(vec2_f32)->Is()); + ASSERT_TRUE(TypeOf(vec2_f16)->Is()); EXPECT_TRUE(TypeOf(vec2_bool)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec2_i32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec2_u32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec2_f32)->As()->type()->Is()); + EXPECT_TRUE(TypeOf(vec2_f16)->As()->type()->Is()); EXPECT_EQ(TypeOf(vec2_bool)->As()->Width(), 2u); EXPECT_EQ(TypeOf(vec2_i32)->As()->Width(), 2u); EXPECT_EQ(TypeOf(vec2_u32)->As()->Width(), 2u); EXPECT_EQ(TypeOf(vec2_f32)->As()->Width(), 2u); + EXPECT_EQ(TypeOf(vec2_f16)->As()->Width(), 2u); EXPECT_EQ(TypeOf(vec2_bool), TypeOf(vec2_bool->target.type)); EXPECT_EQ(TypeOf(vec2_i32), TypeOf(vec2_i32->target.type)); EXPECT_EQ(TypeOf(vec2_u32), TypeOf(vec2_u32->target.type)); EXPECT_EQ(TypeOf(vec2_f32), TypeOf(vec2_f32->target.type)); + EXPECT_EQ(TypeOf(vec2_f16), TypeOf(vec2_f16->target.type)); } TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromScalars) { + Enable(ast::Extension::kF16); + auto* vec3_bool = - Construct(create(nullptr, 3), Expr(true), Expr(false), Expr(true)); - auto* vec3_i32 = Construct(create(nullptr, 3), Expr(1_i), Expr(2_i), Expr(3_i)); - auto* vec3_u32 = Construct(create(nullptr, 3), Expr(1_u), Expr(2_u), Expr(3_u)); - auto* vec3_f32 = Construct(create(nullptr, 3), Expr(1.0f), Expr(2.0f), Expr(3.0f)); - WrapInFunction(vec3_bool, vec3_i32, vec3_u32, vec3_f32); + Construct(create(nullptr, 3u), Expr(true), Expr(false), Expr(true)); + auto* vec3_i32 = Construct(create(nullptr, 3u), Expr(1_i), Expr(2_i), Expr(3_i)); + auto* vec3_u32 = Construct(create(nullptr, 3u), Expr(1_u), Expr(2_u), Expr(3_u)); + auto* vec3_f32 = Construct(create(nullptr, 3u), Expr(1_f), Expr(2_f), Expr(3_f)); + auto* vec3_f16 = Construct(create(nullptr, 3u), Expr(1_h), Expr(2_h), Expr(3_h)); + WrapInFunction(vec3_bool, vec3_i32, vec3_u32, vec3_f32, vec3_f16); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1756,26 +2118,33 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromScalars) { ASSERT_TRUE(TypeOf(vec3_i32)->Is()); ASSERT_TRUE(TypeOf(vec3_u32)->Is()); ASSERT_TRUE(TypeOf(vec3_f32)->Is()); + ASSERT_TRUE(TypeOf(vec3_f16)->Is()); EXPECT_TRUE(TypeOf(vec3_bool)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec3_i32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec3_u32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec3_f32)->As()->type()->Is()); + EXPECT_TRUE(TypeOf(vec3_f16)->As()->type()->Is()); EXPECT_EQ(TypeOf(vec3_bool)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_i32)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_u32)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_f32)->As()->Width(), 3u); + EXPECT_EQ(TypeOf(vec3_f16)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_bool), TypeOf(vec3_bool->target.type)); EXPECT_EQ(TypeOf(vec3_i32), TypeOf(vec3_i32->target.type)); EXPECT_EQ(TypeOf(vec3_u32), TypeOf(vec3_u32->target.type)); EXPECT_EQ(TypeOf(vec3_f32), TypeOf(vec3_f32->target.type)); + EXPECT_EQ(TypeOf(vec3_f16), TypeOf(vec3_f16->target.type)); } TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromVec3) { - auto* vec3_bool = Construct(create(nullptr, 3), vec3(true, false, true)); - auto* vec3_i32 = Construct(create(nullptr, 3), vec3(1_i, 2_i, 3_i)); - auto* vec3_u32 = Construct(create(nullptr, 3), vec3(1_u, 2_u, 3_u)); - auto* vec3_f32 = Construct(create(nullptr, 3), vec3(1.0f, 2.0f, 3.0f)); - WrapInFunction(vec3_bool, vec3_i32, vec3_u32, vec3_f32); + Enable(ast::Extension::kF16); + + auto* vec3_bool = Construct(create(nullptr, 3u), vec3(true, false, true)); + auto* vec3_i32 = Construct(create(nullptr, 3u), vec3(1_i, 2_i, 3_i)); + auto* vec3_u32 = Construct(create(nullptr, 3u), vec3(1_u, 2_u, 3_u)); + auto* vec3_f32 = Construct(create(nullptr, 3u), vec3(1_f, 2_f, 3_f)); + auto* vec3_f16 = Construct(create(nullptr, 3u), vec3(1_h, 2_h, 3_h)); + WrapInFunction(vec3_bool, vec3_i32, vec3_u32, vec3_f32, vec3_f16); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1783,27 +2152,34 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromVec3) { ASSERT_TRUE(TypeOf(vec3_i32)->Is()); ASSERT_TRUE(TypeOf(vec3_u32)->Is()); ASSERT_TRUE(TypeOf(vec3_f32)->Is()); + ASSERT_TRUE(TypeOf(vec3_f16)->Is()); EXPECT_TRUE(TypeOf(vec3_bool)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec3_i32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec3_u32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec3_f32)->As()->type()->Is()); + EXPECT_TRUE(TypeOf(vec3_f16)->As()->type()->Is()); EXPECT_EQ(TypeOf(vec3_bool)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_i32)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_u32)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_f32)->As()->Width(), 3u); + EXPECT_EQ(TypeOf(vec3_f16)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_bool), TypeOf(vec3_bool->target.type)); EXPECT_EQ(TypeOf(vec3_i32), TypeOf(vec3_i32->target.type)); EXPECT_EQ(TypeOf(vec3_u32), TypeOf(vec3_u32->target.type)); EXPECT_EQ(TypeOf(vec3_f32), TypeOf(vec3_f32->target.type)); + EXPECT_EQ(TypeOf(vec3_f16), TypeOf(vec3_f16->target.type)); } TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromScalarAndVec2) { + Enable(ast::Extension::kF16); + auto* vec3_bool = - Construct(create(nullptr, 3), Expr(true), vec2(false, true)); - auto* vec3_i32 = Construct(create(nullptr, 3), Expr(1_i), vec2(2_i, 3_i)); - auto* vec3_u32 = Construct(create(nullptr, 3), Expr(1_u), vec2(2_u, 3_u)); - auto* vec3_f32 = Construct(create(nullptr, 3), Expr(1.0f), vec2(2.0f, 3.0f)); - WrapInFunction(vec3_bool, vec3_i32, vec3_u32, vec3_f32); + Construct(create(nullptr, 3u), Expr(true), vec2(false, true)); + auto* vec3_i32 = Construct(create(nullptr, 3u), Expr(1_i), vec2(2_i, 3_i)); + auto* vec3_u32 = Construct(create(nullptr, 3u), Expr(1_u), vec2(2_u, 3_u)); + auto* vec3_f32 = Construct(create(nullptr, 3u), Expr(1_f), vec2(2_f, 3_f)); + auto* vec3_f16 = Construct(create(nullptr, 3u), Expr(1_h), vec2(2_h, 3_h)); + WrapInFunction(vec3_bool, vec3_i32, vec3_u32, vec3_f32, vec3_f16); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1811,30 +2187,38 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromScalarAndV ASSERT_TRUE(TypeOf(vec3_i32)->Is()); ASSERT_TRUE(TypeOf(vec3_u32)->Is()); ASSERT_TRUE(TypeOf(vec3_f32)->Is()); + ASSERT_TRUE(TypeOf(vec3_f16)->Is()); EXPECT_TRUE(TypeOf(vec3_bool)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec3_i32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec3_u32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec3_f32)->As()->type()->Is()); + EXPECT_TRUE(TypeOf(vec3_f16)->As()->type()->Is()); EXPECT_EQ(TypeOf(vec3_bool)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_i32)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_u32)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_f32)->As()->Width(), 3u); + EXPECT_EQ(TypeOf(vec3_f16)->As()->Width(), 3u); EXPECT_EQ(TypeOf(vec3_bool), TypeOf(vec3_bool->target.type)); EXPECT_EQ(TypeOf(vec3_i32), TypeOf(vec3_i32->target.type)); EXPECT_EQ(TypeOf(vec3_u32), TypeOf(vec3_u32->target.type)); EXPECT_EQ(TypeOf(vec3_f32), TypeOf(vec3_f32->target.type)); + EXPECT_EQ(TypeOf(vec3_f16), TypeOf(vec3_f16->target.type)); } TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromScalars) { - auto* vec4_bool = Construct(create(nullptr, 4), Expr(true), Expr(false), + Enable(ast::Extension::kF16); + + auto* vec4_bool = Construct(create(nullptr, 4u), Expr(true), Expr(false), Expr(true), Expr(false)); auto* vec4_i32 = - Construct(create(nullptr, 4), Expr(1_i), Expr(2_i), Expr(3_i), Expr(4_i)); + Construct(create(nullptr, 4u), Expr(1_i), Expr(2_i), Expr(3_i), Expr(4_i)); auto* vec4_u32 = - Construct(create(nullptr, 4), Expr(1_u), Expr(2_u), Expr(3_u), Expr(4_u)); + Construct(create(nullptr, 4u), Expr(1_u), Expr(2_u), Expr(3_u), Expr(4_u)); auto* vec4_f32 = - Construct(create(nullptr, 4), Expr(1.0f), Expr(2.0f), Expr(3.0f), Expr(4.0f)); - WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32); + Construct(create(nullptr, 4u), Expr(1_f), Expr(2_f), Expr(3_f), Expr(4_f)); + auto* vec4_f16 = + Construct(create(nullptr, 4u), Expr(1_h), Expr(2_h), Expr(3_h), Expr(4_h)); + WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32, vec4_f16); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1842,27 +2226,34 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromScalars) { ASSERT_TRUE(TypeOf(vec4_i32)->Is()); ASSERT_TRUE(TypeOf(vec4_u32)->Is()); ASSERT_TRUE(TypeOf(vec4_f32)->Is()); + ASSERT_TRUE(TypeOf(vec4_f16)->Is()); EXPECT_TRUE(TypeOf(vec4_bool)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_i32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_u32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_f32)->As()->type()->Is()); + EXPECT_TRUE(TypeOf(vec4_f16)->As()->type()->Is()); EXPECT_EQ(TypeOf(vec4_bool)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_i32)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_u32)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_f32)->As()->Width(), 4u); + EXPECT_EQ(TypeOf(vec4_f16)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_bool), TypeOf(vec4_bool->target.type)); EXPECT_EQ(TypeOf(vec4_i32), TypeOf(vec4_i32->target.type)); EXPECT_EQ(TypeOf(vec4_u32), TypeOf(vec4_u32->target.type)); EXPECT_EQ(TypeOf(vec4_f32), TypeOf(vec4_f32->target.type)); + EXPECT_EQ(TypeOf(vec4_f16), TypeOf(vec4_f16->target.type)); } TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromVec4) { + Enable(ast::Extension::kF16); + auto* vec4_bool = - Construct(create(nullptr, 4), vec4(true, false, true, false)); - auto* vec4_i32 = Construct(create(nullptr, 4), vec4(1_i, 2_i, 3_i, 4_i)); - auto* vec4_u32 = Construct(create(nullptr, 4), vec4(1_u, 2_u, 3_u, 4_u)); - auto* vec4_f32 = Construct(create(nullptr, 4), vec4(1.0f, 2.0f, 3.0f, 4.0f)); - WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32); + Construct(create(nullptr, 4u), vec4(true, false, true, false)); + auto* vec4_i32 = Construct(create(nullptr, 4u), vec4(1_i, 2_i, 3_i, 4_i)); + auto* vec4_u32 = Construct(create(nullptr, 4u), vec4(1_u, 2_u, 3_u, 4_u)); + auto* vec4_f32 = Construct(create(nullptr, 4u), vec4(1_f, 2_f, 3_f, 4_f)); + auto* vec4_f16 = Construct(create(nullptr, 4u), vec4(1_h, 2_h, 3_h, 4_h)); + WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32, vec4_f16); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1870,30 +2261,38 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromVec4) { ASSERT_TRUE(TypeOf(vec4_i32)->Is()); ASSERT_TRUE(TypeOf(vec4_u32)->Is()); ASSERT_TRUE(TypeOf(vec4_f32)->Is()); + ASSERT_TRUE(TypeOf(vec4_f16)->Is()); EXPECT_TRUE(TypeOf(vec4_bool)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_i32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_u32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_f32)->As()->type()->Is()); + EXPECT_TRUE(TypeOf(vec4_f16)->As()->type()->Is()); EXPECT_EQ(TypeOf(vec4_bool)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_i32)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_u32)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_f32)->As()->Width(), 4u); + EXPECT_EQ(TypeOf(vec4_f16)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_bool), TypeOf(vec4_bool->target.type)); EXPECT_EQ(TypeOf(vec4_i32), TypeOf(vec4_i32->target.type)); EXPECT_EQ(TypeOf(vec4_u32), TypeOf(vec4_u32->target.type)); EXPECT_EQ(TypeOf(vec4_f32), TypeOf(vec4_f32->target.type)); + EXPECT_EQ(TypeOf(vec4_f16), TypeOf(vec4_f16->target.type)); } TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromScalarAndVec3) { + Enable(ast::Extension::kF16); + auto* vec4_bool = - Construct(create(nullptr, 4), Expr(true), vec3(false, true, false)); + Construct(create(nullptr, 4u), Expr(true), vec3(false, true, false)); auto* vec4_i32 = - Construct(create(nullptr, 4), Expr(1_i), vec3(2_i, 3_i, 4_i)); + Construct(create(nullptr, 4u), Expr(1_i), vec3(2_i, 3_i, 4_i)); auto* vec4_u32 = - Construct(create(nullptr, 4), Expr(1_u), vec3(2_u, 3_u, 4_u)); + Construct(create(nullptr, 4u), Expr(1_u), vec3(2_u, 3_u, 4_u)); auto* vec4_f32 = - Construct(create(nullptr, 4), Expr(1.0f), vec3(2.0f, 3.0f, 4.0f)); - WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32); + Construct(create(nullptr, 4u), Expr(1_f), vec3(2_f, 3_f, 4_f)); + auto* vec4_f16 = + Construct(create(nullptr, 4u), Expr(1_h), vec3(2_h, 3_h, 4_h)); + WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32, vec4_f16); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1901,30 +2300,38 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromScalarAndV ASSERT_TRUE(TypeOf(vec4_i32)->Is()); ASSERT_TRUE(TypeOf(vec4_u32)->Is()); ASSERT_TRUE(TypeOf(vec4_f32)->Is()); + ASSERT_TRUE(TypeOf(vec4_f16)->Is()); EXPECT_TRUE(TypeOf(vec4_bool)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_i32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_u32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_f32)->As()->type()->Is()); + EXPECT_TRUE(TypeOf(vec4_f16)->As()->type()->Is()); EXPECT_EQ(TypeOf(vec4_bool)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_i32)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_u32)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_f32)->As()->Width(), 4u); + EXPECT_EQ(TypeOf(vec4_f16)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_bool), TypeOf(vec4_bool->target.type)); EXPECT_EQ(TypeOf(vec4_i32), TypeOf(vec4_i32->target.type)); EXPECT_EQ(TypeOf(vec4_u32), TypeOf(vec4_u32->target.type)); EXPECT_EQ(TypeOf(vec4_f32), TypeOf(vec4_f32->target.type)); + EXPECT_EQ(TypeOf(vec4_f16), TypeOf(vec4_f16->target.type)); } TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromVec2AndVec2) { - auto* vec4_bool = Construct(create(nullptr, 4), vec2(true, false), + Enable(ast::Extension::kF16); + + auto* vec4_bool = Construct(create(nullptr, 4u), vec2(true, false), vec2(true, false)); auto* vec4_i32 = - Construct(create(nullptr, 4), vec2(1_i, 2_i), vec2(3_i, 4_i)); + Construct(create(nullptr, 4u), vec2(1_i, 2_i), vec2(3_i, 4_i)); auto* vec4_u32 = - Construct(create(nullptr, 4), vec2(1_u, 2_u), vec2(3_u, 4_u)); + Construct(create(nullptr, 4u), vec2(1_u, 2_u), vec2(3_u, 4_u)); auto* vec4_f32 = - Construct(create(nullptr, 4), vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)); - WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32); + Construct(create(nullptr, 4u), vec2(1_f, 2_f), vec2(3_f, 4_f)); + auto* vec4_f16 = + Construct(create(nullptr, 4u), vec2(1_h, 2_h), vec2(3_h, 4_h)); + WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32, vec4_f16); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1932,275 +2339,301 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromVec2AndVec ASSERT_TRUE(TypeOf(vec4_i32)->Is()); ASSERT_TRUE(TypeOf(vec4_u32)->Is()); ASSERT_TRUE(TypeOf(vec4_f32)->Is()); + ASSERT_TRUE(TypeOf(vec4_f16)->Is()); EXPECT_TRUE(TypeOf(vec4_bool)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_i32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_u32)->As()->type()->Is()); EXPECT_TRUE(TypeOf(vec4_f32)->As()->type()->Is()); + EXPECT_TRUE(TypeOf(vec4_f16)->As()->type()->Is()); EXPECT_EQ(TypeOf(vec4_bool)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_i32)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_u32)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_f32)->As()->Width(), 4u); + EXPECT_EQ(TypeOf(vec4_f16)->As()->Width(), 4u); EXPECT_EQ(TypeOf(vec4_bool), TypeOf(vec4_bool->target.type)); EXPECT_EQ(TypeOf(vec4_i32), TypeOf(vec4_i32->target.type)); EXPECT_EQ(TypeOf(vec4_u32), TypeOf(vec4_u32->target.type)); EXPECT_EQ(TypeOf(vec4_f32), TypeOf(vec4_f32->target.type)); + EXPECT_EQ(TypeOf(vec4_f16), TypeOf(vec4_f16->target.type)); } TEST_F(ResolverTypeConstructorValidationTest, CannotInferVectorElementTypeWithoutArgs) { - WrapInFunction(Construct(create(Source{{12, 34}}, nullptr, 3))); + WrapInFunction(Construct(Source{{12, 34}}, create(nullptr, 3u))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: missing vector element type"); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for vec3()")); } TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec2ElementTypeFromScalarsMismatch) { - WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 2), + WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 2u), Expr(Source{{1, 2}}, 1_i), // Expr(Source{{1, 3}}, 2_u))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ( - r()->error(), - R"(1:1 error: cannot infer vector element type, as constructor arguments have different types -1:2 note: argument 0 has type i32 -1:3 note: argument 1 has type u32)"); + EXPECT_THAT(r()->error(), HasSubstr("1:1 error: no matching constructor for vec2(i32, u32)")); } TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec3ElementTypeFromScalarsMismatch) { - WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 3), + WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 3u), Expr(Source{{1, 2}}, 1_i), // Expr(Source{{1, 3}}, 2_u), // Expr(Source{{1, 4}}, 3_i))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ( - r()->error(), - R"(1:1 error: cannot infer vector element type, as constructor arguments have different types -1:2 note: argument 0 has type i32 -1:3 note: argument 1 has type u32 -1:4 note: argument 2 has type i32)"); + EXPECT_THAT(r()->error(), + HasSubstr("1:1 error: no matching constructor for vec3(i32, u32, i32)")); } TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec3ElementTypeFromScalarAndVec2Mismatch) { - WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 3), + WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 3u), Expr(Source{{1, 2}}, 1_i), // - Construct(Source{{1, 3}}, ty.vec2(), 2.0f, 3.0f))); + Construct(Source{{1, 3}}, ty.vec2(), 2_f, 3_f))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ( - r()->error(), - R"(1:1 error: cannot infer vector element type, as constructor arguments have different types -1:2 note: argument 0 has type i32 -1:3 note: argument 1 has type vec2)"); + EXPECT_THAT(r()->error(), + HasSubstr("1:1 error: no matching constructor for vec3(i32, vec2)")); } TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec4ElementTypeFromScalarsMismatch) { - WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 4), - Expr(Source{{1, 2}}, 1_i), // - Expr(Source{{1, 3}}, 2_i), // - Expr(Source{{1, 4}}, 3.0f), // + WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 4u), + Expr(Source{{1, 2}}, 1_i), // + Expr(Source{{1, 3}}, 2_i), // + Expr(Source{{1, 4}}, 3_f), // Expr(Source{{1, 5}}, 4_i))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ( - r()->error(), - R"(1:1 error: cannot infer vector element type, as constructor arguments have different types -1:2 note: argument 0 has type i32 -1:3 note: argument 1 has type i32 -1:4 note: argument 2 has type f32 -1:5 note: argument 3 has type i32)"); + EXPECT_THAT(r()->error(), + HasSubstr("1:1 error: no matching constructor for vec4(i32, i32, f32, i32)")); } TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec4ElementTypeFromScalarAndVec3Mismatch) { - WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 4), + WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 4u), Expr(Source{{1, 2}}, 1_i), // Construct(Source{{1, 3}}, ty.vec3(), 2_u, 3_u, 4_u))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ( - r()->error(), - R"(1:1 error: cannot infer vector element type, as constructor arguments have different types -1:2 note: argument 0 has type i32 -1:3 note: argument 1 has type vec3)"); + EXPECT_THAT(r()->error(), + HasSubstr("1:1 error: no matching constructor for vec4(i32, vec3)")); } TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec4ElementTypeFromVec2AndVec2Mismatch) { - WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 4), + WrapInFunction(Construct(Source{{1, 1}}, create(nullptr, 4u), Construct(Source{{1, 2}}, ty.vec2(), 3_i, 4_i), // Construct(Source{{1, 3}}, ty.vec2(), 3_u, 4_u))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ( - r()->error(), - R"(1:1 error: cannot infer vector element type, as constructor arguments have different types -1:2 note: argument 0 has type vec2 -1:3 note: argument 1 has type vec2)"); + EXPECT_THAT(r()->error(), + HasSubstr("1:1 error: no matching constructor for vec4(vec2, vec2)")); } } // namespace VectorConstructor namespace MatrixConstructor { -struct MatrixDimensions { + +struct MatrixParams { + using name_func_ptr = std::string (*)(); + uint32_t rows; uint32_t columns; + name_func_ptr get_element_type_name; + builder::ast_type_func_ptr create_element_ast_type; + builder::ast_expr_func_ptr create_element_ast_value; + builder::ast_type_func_ptr create_column_ast_type; + builder::ast_type_func_ptr create_mat_ast_type; }; -static std::string MatrixStr(const MatrixDimensions& dimensions) { - return "mat" + std::to_string(dimensions.columns) + "x" + std::to_string(dimensions.rows) + - ""; +template +constexpr MatrixParams MatrixParamsFor() { + return MatrixParams{ + R, + C, + DataType::Name, + DataType::AST, + DataType::Expr, + DataType>::AST, + DataType>::AST, + }; } -using MatrixConstructorTest = ResolverTestWithParam; +static std::string MatrixStr(const MatrixParams& param) { + return "mat" + std::to_string(param.columns) + "x" + std::to_string(param.rows) + "<" + + param.get_element_type_name() + ">"; +} -TEST_P(MatrixConstructorTest, Expr_ColumnConstructor_Error_TooFewArguments) { +using MatrixConstructorTest = ResolverTestWithParam; + +TEST_P(MatrixConstructorTest, ColumnConstructor_Error_TooFewArguments) { // matNxM(vecM(), ...); with N - 1 arguments + // matNxM(vecM(), ...); with N - 1 arguments const auto param = GetParam(); + Enable(ast::Extension::kF16); + + const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns - 1; i++) { - auto* vec_type = ty.vec(param.rows); - args.push_back(Construct(Source{{12, i}}, vec_type)); - if (i > 1) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns - 1; i++) { + auto* vec_type = param.create_column_ast_type(*this); + args.Push(Construct(vec_type)); + if (i > 0) { args_tys << ", "; } - args_tys << "vec" << param.rows << ""; + args_tys << "vec" << param.rows << "<" + element_type_name + ">"; } - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_ElementConstructor_Error_TooFewArguments) { +TEST_P(MatrixConstructorTest, ElementConstructor_Error_TooFewArguments) { // matNxM(f32,...,f32); with N*M - 1 arguments + // matNxM(f16,...,f16); with N*M - 1 arguments const auto param = GetParam(); + Enable(ast::Extension::kF16); + + const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns * param.rows - 1; i++) { - args.push_back(Construct(Source{{12, i}}, ty.f32())); - if (i > 1) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns * param.rows - 1; i++) { + args.Push(Construct(param.create_element_ast_type(*this))); + if (i > 0) { args_tys << ", "; } - args_tys << "f32"; + args_tys << element_type_name; } - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_ColumnConstructor_Error_TooManyArguments) { +TEST_P(MatrixConstructorTest, ColumnConstructor_Error_TooManyArguments) { // matNxM(vecM(), ...); with N + 1 arguments + // matNxM(vecM(), ...); with N + 1 arguments const auto param = GetParam(); + Enable(ast::Extension::kF16); + + const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns + 1; i++) { - auto* vec_type = ty.vec(param.rows); - args.push_back(Construct(Source{{12, i}}, vec_type)); - if (i > 1) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns + 1; i++) { + auto* vec_type = param.create_column_ast_type(*this); + args.Push(Construct(vec_type)); + if (i > 0) { args_tys << ", "; } - args_tys << "vec" << param.rows << ""; + args_tys << "vec" << param.rows << "<" + element_type_name + ">"; } - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_ElementConstructor_Error_TooManyArguments) { +TEST_P(MatrixConstructorTest, ElementConstructor_Error_TooManyArguments) { // matNxM(f32,...,f32); with N*M + 1 arguments + // matNxM(f16,...,f16); with N*M + 1 arguments const auto param = GetParam(); + Enable(ast::Extension::kF16); + + const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns * param.rows + 1; i++) { - args.push_back(Construct(Source{{12, i}}, ty.f32())); - if (i > 1) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns * param.rows + 1; i++) { + args.Push(Construct(param.create_element_ast_type(*this))); + if (i > 0) { args_tys << ", "; } - args_tys << "f32"; + args_tys << element_type_name; } - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_ColumnConstructor_Error_InvalidArgumentType) { +TEST_P(MatrixConstructorTest, ColumnConstructor_Error_InvalidArgumentType) { // matNxM(vec, vec, ...); N arguments + // matNxM(vec, vec, ...); N arguments const auto param = GetParam(); + Enable(ast::Extension::kF16); + std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns; i++) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { auto* vec_type = ty.vec(param.rows); - args.push_back(Construct(Source{{12, i}}, vec_type)); - if (i > 1) { + args.Push(Construct(vec_type)); + if (i > 0) { args_tys << ", "; } args_tys << "vec" << param.rows << ""; } - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_ElementConstructor_Error_InvalidArgumentType) { +TEST_P(MatrixConstructorTest, ElementConstructor_Error_InvalidArgumentType) { // matNxM(u32, u32, ...); N*M arguments + // matNxM(u32, u32, ...); N*M arguments const auto param = GetParam(); + Enable(ast::Extension::kF16); + std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns; i++) { - args.push_back(Expr(Source{{12, i}}, 1_u)); - if (i > 1) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { + args.Push(Expr(1_u)); + if (i > 0) { args_tys << ", "; } args_tys << "u32"; } - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_ColumnConstructor_Error_TooFewRowsInVectorArgument) { +TEST_P(MatrixConstructorTest, ColumnConstructor_Error_TooFewRowsInVectorArgument) { // matNxM(vecM(),...,vecM-1()); + // matNxM(vecM(),...,vecM-1()); const auto param = GetParam(); @@ -2209,32 +2642,36 @@ TEST_P(MatrixConstructorTest, Expr_ColumnConstructor_Error_TooFewRowsInVectorArg return; } + Enable(ast::Extension::kF16); + + const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns - 1; i++) { - auto* valid_vec_type = ty.vec(param.rows); - args.push_back(Construct(Source{{12, i}}, valid_vec_type)); - if (i > 1) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { + auto* valid_vec_type = param.create_column_ast_type(*this); + args.Push(Construct(valid_vec_type)); + if (i > 0) { args_tys << ", "; } - args_tys << "vec" << param.rows << ""; + args_tys << "vec" << param.rows << "<" + element_type_name + ">"; } const size_t kInvalidLoc = 2 * (param.columns - 1); - auto* invalid_vec_type = ty.vec(param.rows - 1); - args.push_back(Construct(Source{{12, kInvalidLoc}}, invalid_vec_type)); - args_tys << ", vec" << (param.rows - 1) << ""; + auto* invalid_vec_type = ty.vec(param.create_element_ast_type(*this), param.rows - 1); + args.Push(Construct(Source{{12, kInvalidLoc}}, invalid_vec_type)); + args_tys << ", vec" << (param.rows - 1) << "<" + element_type_name + ">"; - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_ColumnConstructor_Error_TooManyRowsInVectorArgument) { +TEST_P(MatrixConstructorTest, ColumnConstructor_Error_TooManyRowsInVectorArgument) { // matNxM(vecM(),...,vecM+1()); + // matNxM(vecM(),...,vecM+1()); const auto param = GetParam(); @@ -2243,146 +2680,164 @@ TEST_P(MatrixConstructorTest, Expr_ColumnConstructor_Error_TooManyRowsInVectorAr return; } + Enable(ast::Extension::kF16); + + const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns - 1; i++) { - auto* valid_vec_type = ty.vec(param.rows); - args.push_back(Construct(Source{{12, i}}, valid_vec_type)); - if (i > 1) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { + auto* valid_vec_type = param.create_column_ast_type(*this); + args.Push(Construct(valid_vec_type)); + if (i > 0) { args_tys << ", "; } - args_tys << "vec" << param.rows << ""; + args_tys << "vec" << param.rows << "<" + element_type_name + ">"; } - const size_t kInvalidLoc = 2 * (param.columns - 1); - auto* invalid_vec_type = ty.vec(param.rows + 1); - args.push_back(Construct(Source{{12, kInvalidLoc}}, invalid_vec_type)); - args_tys << ", vec" << (param.rows + 1) << ""; + auto* invalid_vec_type = ty.vec(param.create_element_ast_type(*this), param.rows + 1); + args.Push(Construct(invalid_vec_type)); + args_tys << ", vec" << (param.rows + 1) << "<" + element_type_name + ">"; - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_Constructor_ZeroValue_Success) { +TEST_P(MatrixConstructorTest, ZeroValue_Success) { // matNxM(); + // matNxM(); const auto param = GetParam(); - auto* matrix_type = ty.mat(param.columns, param.rows); + + Enable(ast::Extension::kF16); + + auto* matrix_type = param.create_mat_ast_type(*this); auto* tc = Construct(Source{{12, 40}}, matrix_type); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_P(MatrixConstructorTest, Expr_Constructor_WithColumns_Success) { +TEST_P(MatrixConstructorTest, WithColumns_Success) { // matNxM(vecM(), ...); with N arguments + // matNxM(vecM(), ...); with N arguments const auto param = GetParam(); - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns; i++) { - auto* vec_type = ty.vec(param.rows); - args.push_back(Construct(Source{{12, i}}, vec_type)); + Enable(ast::Extension::kF16); + + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { + auto* vec_type = param.create_column_ast_type(*this); + args.Push(Construct(vec_type)); } - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(matrix_type, std::move(args)); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_P(MatrixConstructorTest, Expr_Constructor_WithElements_Success) { +TEST_P(MatrixConstructorTest, WithElements_Success) { // matNxM(f32,...,f32); with N*M arguments + // matNxM(f16,...,f16); with N*M arguments const auto param = GetParam(); - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns * param.rows; i++) { - args.push_back(Construct(Source{{12, i}}, ty.f32())); + Enable(ast::Extension::kF16); + + utils::Vector args; + for (uint32_t i = 0; i < param.columns * param.rows; i++) { + args.Push(Construct(param.create_element_ast_type(*this))); } - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = param.create_mat_ast_type(*this); + auto* tc = Construct(matrix_type, std::move(args)); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_P(MatrixConstructorTest, Expr_Constructor_ElementTypeAlias_Error) { +TEST_P(MatrixConstructorTest, ElementTypeAlias_Error) { // matNxM(vecM(), ...); with N arguments + // matNxM(vecM(), ...); with N arguments const auto param = GetParam(); - auto* f32_alias = Alias("Float32", ty.f32()); + + Enable(ast::Extension::kF16); + + auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this)); std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns; i++) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { auto* vec_type = ty.vec(ty.u32(), param.rows); - args.push_back(Construct(Source{{12, i}}, vec_type)); - if (i > 1) { + args.Push(Construct(vec_type)); + if (i > 0) { args_tys << ", "; } args_tys << "vec" << param.rows << ""; } - auto* matrix_type = ty.mat(ty.Of(f32_alias), param.columns, param.rows); - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* matrix_type = ty.mat(ty.Of(elem_type_alias), param.columns, param.rows); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_Constructor_ElementTypeAlias_Success) { +TEST_P(MatrixConstructorTest, ElementTypeAlias_Success) { // matNxM(vecM(), ...); with N arguments + // matNxM(vecM(), ...); with N arguments const auto param = GetParam(); - auto* f32_alias = Alias("Float32", ty.f32()); - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns; i++) { - auto* vec_type = ty.vec(param.rows); - args.push_back(Construct(Source{{12, i}}, vec_type)); + Enable(ast::Extension::kF16); + + auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this)); + + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { + auto* vec_type = param.create_column_ast_type(*this); + args.Push(Construct(vec_type)); } - auto* matrix_type = ty.mat(ty.Of(f32_alias), param.columns, param.rows); + auto* matrix_type = ty.mat(ty.Of(elem_type_alias), param.columns, param.rows); auto* tc = Construct(Source{}, matrix_type, std::move(args)); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_MatrixConstructor_ArgumentTypeAlias_Error) { +TEST_F(ResolverTypeConstructorValidationTest, MatrixConstructor_ArgumentTypeAlias_Error) { auto* alias = Alias("VectorUnsigned2", ty.vec2()); - auto* tc = mat2x2(Construct(Source{{12, 34}}, ty.Of(alias)), vec2()); + auto* tc = Construct(Source{{12, 34}}, ty.mat2x2(), Construct(ty.Of(alias)), vec2()); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - R"(12:34 error: no matching constructor mat2x2(vec2, vec2) - -3 candidates available: - mat2x2() - mat2x2(f32,...,f32) // 4 arguments - mat2x2(vec2, vec2) -)"); + EXPECT_THAT( + r()->error(), + HasSubstr("12:34 error: no matching constructor for mat2x2(vec2, vec2)")); } -TEST_P(MatrixConstructorTest, Expr_Constructor_ArgumentTypeAlias_Success) { +TEST_P(MatrixConstructorTest, ArgumentTypeAlias_Success) { const auto param = GetParam(); - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* vec_type = ty.vec(param.rows); - auto* vec_alias = Alias("VectorFloat2", vec_type); - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns; i++) { - args.push_back(Construct(Source{{12, i}}, ty.Of(vec_alias))); + Enable(ast::Extension::kF16); + + auto* matrix_type = param.create_mat_ast_type(*this); + auto* vec_type = param.create_column_ast_type(*this); + auto* vec_alias = Alias("ColVectorAlias", vec_type); + + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { + args.Push(Construct(ty.Of(vec_alias))); } auto* tc = Construct(Source{}, matrix_type, std::move(args)); @@ -2391,41 +2846,47 @@ TEST_P(MatrixConstructorTest, Expr_Constructor_ArgumentTypeAlias_Success) { ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_P(MatrixConstructorTest, Expr_Constructor_ArgumentElementTypeAlias_Error) { +TEST_P(MatrixConstructorTest, ArgumentElementTypeAlias_Error) { const auto param = GetParam(); - auto* matrix_type = ty.mat(param.columns, param.rows); - auto* f32_alias = Alias("UnsignedInt", ty.u32()); + + Enable(ast::Extension::kF16); + + auto* matrix_type = param.create_mat_ast_type(*this); + auto* u32_type_alias = Alias("UnsignedInt", ty.u32()); std::stringstream args_tys; - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns; i++) { - auto* vec_type = ty.vec(ty.Of(f32_alias), param.rows); - args.push_back(Construct(Source{{12, i}}, vec_type)); - if (i > 1) { + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { + auto* vec_type = ty.vec(ty.Of(u32_type_alias), param.rows); + args.Push(Construct(vec_type)); + if (i > 0) { args_tys << ", "; } args_tys << "vec" << param.rows << ""; } - auto* tc = Construct(Source{}, matrix_type, std::move(args)); + auto* tc = Construct(Source{{12, 34}}, matrix_type, std::move(args)); WrapInFunction(tc); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), HasSubstr("12:1 error: no matching constructor " + MatrixStr(param) + - "(" + args_tys.str() + ")\n\n3 candidates available:")); + EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for " + + MatrixStr(param) + "(" + args_tys.str() + ")")); } -TEST_P(MatrixConstructorTest, Expr_Constructor_ArgumentElementTypeAlias_Success) { +TEST_P(MatrixConstructorTest, ArgumentElementTypeAlias_Success) { const auto param = GetParam(); - auto* f32_alias = Alias("Float32", ty.f32()); - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns; i++) { - auto* vec_type = ty.vec(ty.Of(f32_alias), param.rows); - args.push_back(Construct(Source{{12, i}}, vec_type)); + Enable(ast::Extension::kF16); + + auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this)); + + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { + auto* vec_type = ty.vec(ty.Of(elem_type_alias), param.rows); + args.Push(Construct(vec_type)); } - auto* matrix_type = ty.mat(param.columns, param.rows); + auto* matrix_type = param.create_mat_ast_type(*this); auto* tc = Construct(Source{}, matrix_type, std::move(args)); WrapInFunction(tc); @@ -2435,9 +2896,11 @@ TEST_P(MatrixConstructorTest, Expr_Constructor_ArgumentElementTypeAlias_Success) TEST_P(MatrixConstructorTest, InferElementTypeFromVectors) { const auto param = GetParam(); - ast::ExpressionList args; - for (uint32_t i = 1; i <= param.columns; i++) { - args.push_back(Construct(ty.vec(param.rows))); + Enable(ast::Extension::kF16); + + utils::Vector args; + for (uint32_t i = 0; i < param.columns; i++) { + args.Push(Construct(param.create_column_ast_type(*this))); } auto* matrix_type = create(nullptr, param.rows, param.columns); @@ -2450,9 +2913,11 @@ TEST_P(MatrixConstructorTest, InferElementTypeFromVectors) { TEST_P(MatrixConstructorTest, InferElementTypeFromScalars) { const auto param = GetParam(); - ast::ExpressionList args; + Enable(ast::Extension::kF16); + + utils::Vector args; for (uint32_t i = 0; i < param.rows * param.columns; i++) { - args.push_back(Expr(static_cast(i))); + args.Push(param.create_element_ast_value(*this, static_cast(i))); } auto* matrix_type = create(nullptr, param.rows, param.columns); @@ -2464,21 +2929,24 @@ TEST_P(MatrixConstructorTest, InferElementTypeFromScalars) { TEST_P(MatrixConstructorTest, CannotInferElementTypeFromVectors_Mismatch) { const auto param = GetParam(); - std::stringstream err; - err << "12:34 error: cannot infer matrix element type, as constructor " - "arguments have different types"; + Enable(ast::Extension::kF16); - ast::ExpressionList args; + std::stringstream err; + err << "12:34 error: no matching constructor for mat" << param.columns << "x" << param.rows + << "("; + + utils::Vector args; for (uint32_t i = 0; i < param.columns; i++) { - err << "\n"; - auto src = Source{{1, 10 + i}}; + if (i > 0) { + err << ", "; + } if (i == 1) { // Odd one out - args.push_back(Construct(src, ty.vec(param.rows))); - err << src << " note: argument " << i << " has type vec" << param.rows << ""; + args.Push(Construct(ty.vec(param.rows))); + err << "vec" << param.rows << ""; } else { - args.push_back(Construct(src, ty.vec(param.rows))); - err << src << " note: argument " << i << " has type vec" << param.rows << ""; + args.Push(Construct(param.create_column_ast_type(*this))); + err << "vec" << param.rows << "<" + param.get_element_type_name() + ">"; } } @@ -2486,46 +2954,61 @@ TEST_P(MatrixConstructorTest, CannotInferElementTypeFromVectors_Mismatch) { WrapInFunction(Construct(Source{{12, 34}}, matrix_type, std::move(args))); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), err.str()); + EXPECT_THAT(r()->error(), HasSubstr(err.str())); } TEST_P(MatrixConstructorTest, CannotInferElementTypeFromScalars_Mismatch) { const auto param = GetParam(); + Enable(ast::Extension::kF16); + std::stringstream err; - err << "12:34 error: cannot infer matrix element type, as constructor " - "arguments have different types"; - ast::ExpressionList args; + err << "12:34 error: no matching constructor for mat" << param.columns << "x" << param.rows + << "("; + + utils::Vector args; for (uint32_t i = 0; i < param.rows * param.columns; i++) { - err << "\n"; - auto src = Source{{1, 10 + i}}; + if (i > 0) { + err << ", "; + } if (i == 3) { - args.push_back(Expr(src, static_cast(i))); // The odd one out - err << src << " note: argument " << i << " has type i32"; + args.Push(Expr(static_cast(i))); // The odd one out + err << "i32"; } else { - args.push_back(Expr(src, static_cast(i))); - err << src << " note: argument " << i << " has type f32"; + args.Push(param.create_element_ast_value(*this, static_cast(i))); + err << param.get_element_type_name(); } } + err << ")"; + auto* matrix_type = create(nullptr, param.rows, param.columns); WrapInFunction(Construct(Source{{12, 34}}, matrix_type, std::move(args))); EXPECT_FALSE(r()->Resolve()); - EXPECT_THAT(r()->error(), err.str()); + EXPECT_THAT(r()->error(), HasSubstr(err.str())); } INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest, MatrixConstructorTest, - testing::Values(MatrixDimensions{2, 2}, - MatrixDimensions{3, 2}, - MatrixDimensions{4, 2}, - MatrixDimensions{2, 3}, - MatrixDimensions{3, 3}, - MatrixDimensions{4, 3}, - MatrixDimensions{2, 4}, - MatrixDimensions{3, 4}, - MatrixDimensions{4, 4})); + testing::Values(MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor(), + MatrixParamsFor())); } // namespace MatrixConstructor namespace StructConstructor { @@ -2543,13 +3026,18 @@ constexpr CreatePtrs all_types[] = { CreatePtrsFor(), // CreatePtrsFor(), // CreatePtrsFor(), // + CreatePtrsFor(), // CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // + CreatePtrsFor>(), // CreatePtrsFor>(), // CreatePtrsFor>(), // - CreatePtrsFor>() // + CreatePtrsFor>(), // + CreatePtrsFor>(), // + CreatePtrsFor>(), // + CreatePtrsFor>() // }; auto number_of_members = testing::Values(2u, 32u, 64u); @@ -2562,14 +3050,16 @@ TEST_P(StructConstructorInputsTest, TooFew) { auto& str_params = std::get<0>(param); uint32_t N = std::get<1>(param); - ast::StructMemberList members; - ast::ExpressionList values; + Enable(ast::Extension::kF16); + + utils::Vector members; + utils::Vector values; for (uint32_t i = 0; i < N; i++) { auto* struct_type = str_params.ast(*this); - members.push_back(Member("member_" + std::to_string(i), struct_type)); + members.Push(Member("member_" + std::to_string(i), struct_type)); if (i < N - 1) { auto* ctor_value_expr = str_params.expr(*this, 0); - values.push_back(ctor_value_expr); + values.Push(ctor_value_expr); } } auto* s = Structure("s", members); @@ -2585,15 +3075,17 @@ TEST_P(StructConstructorInputsTest, TooMany) { auto& str_params = std::get<0>(param); uint32_t N = std::get<1>(param); - ast::StructMemberList members; - ast::ExpressionList values; + Enable(ast::Extension::kF16); + + utils::Vector members; + utils::Vector values; for (uint32_t i = 0; i < N + 1; i++) { if (i < N) { auto* struct_type = str_params.ast(*this); - members.push_back(Member("member_" + std::to_string(i), struct_type)); + members.Push(Member("member_" + std::to_string(i), struct_type)); } auto* ctor_value_expr = str_params.expr(*this, 0); - values.push_back(ctor_value_expr); + values.Push(ctor_value_expr); } auto* s = Structure("s", members); auto* tc = Construct(Source{{12, 34}}, ty.Of(s), values); @@ -2616,21 +3108,23 @@ TEST_P(StructConstructorTypeTest, AllTypes) { auto& ctor_params = std::get<1>(param); uint32_t N = std::get<2>(param); + Enable(ast::Extension::kF16); + if (str_params.ast == ctor_params.ast) { return; } - ast::StructMemberList members; - ast::ExpressionList values; + utils::Vector members; + utils::Vector values; // make the last value of the constructor to have a different type uint32_t constructor_value_with_different_type = N - 1; for (uint32_t i = 0; i < N; i++) { auto* struct_type = str_params.ast(*this); - members.push_back(Member("member_" + std::to_string(i), struct_type)); + members.Push(Member("member_" + std::to_string(i), struct_type)); auto* ctor_value_expr = (i == constructor_value_with_different_type) ? ctor_params.expr(*this, 0) : str_params.expr(*this, 0); - values.push_back(ctor_value_expr); + values.Push(ctor_value_expr); } auto* s = Structure("s", members); auto* tc = Construct(ty.Of(s), values); @@ -2651,14 +3145,14 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest, testing::ValuesIn(all_types), number_of_members)); -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Struct_Nested) { +TEST_F(ResolverTypeConstructorValidationTest, Struct_Nested) { auto* inner_m = Member("m", ty.i32()); - auto* inner_s = Structure("inner_s", {inner_m}); + auto* inner_s = Structure("inner_s", utils::Vector{inner_m}); auto* m0 = Member("m0", ty.i32()); auto* m1 = Member("m1", ty.Of(inner_s)); auto* m2 = Member("m2", ty.i32()); - auto* s = Structure("s", {m0, m1, m2}); + auto* s = Structure("s", utils::Vector{m0, m1, m2}); auto* tc = Construct(Source{{12, 34}}, ty.Of(s), 1_i, 1_i, 1_i); WrapInFunction(tc); @@ -2668,16 +3162,16 @@ TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Struct_Nested) { "type: expected 'inner_s', found 'i32'"); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Struct) { +TEST_F(ResolverTypeConstructorValidationTest, Struct) { auto* m = Member("m", ty.i32()); - auto* s = Structure("MyInputs", {m}); + auto* s = Structure("MyInputs", utils::Vector{m}); auto* tc = Construct(Source{{12, 34}}, ty.Of(s)); WrapInFunction(tc); ASSERT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Struct_Empty) { - auto* str = Structure("S", { +TEST_F(ResolverTypeConstructorValidationTest, Struct_Empty) { + auto* str = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), Member("c", ty.vec3()), @@ -2704,7 +3198,7 @@ TEST_F(ResolverTypeConstructorValidationTest, NonConstructibleType_AtomicArray) } TEST_F(ResolverTypeConstructorValidationTest, NonConstructibleType_AtomicStructMember) { - auto* str = Structure("S", {Member("a", ty.atomic(ty.i32()))}); + auto* str = Structure("S", utils::Vector{Member("a", ty.atomic(ty.i32()))}); WrapInFunction(Assign(Phony(), Construct(Source{{12, 34}}, ty.Of(str)))); EXPECT_FALSE(r()->Resolve()); @@ -2720,7 +3214,7 @@ TEST_F(ResolverTypeConstructorValidationTest, NonConstructibleType_Sampler) { } TEST_F(ResolverTypeConstructorValidationTest, TypeConstructorAsStatement) { - WrapInFunction(CallStmt(Construct(Source{{12, 34}}, ty.vec2(), 1.f, 2.f))); + WrapInFunction(CallStmt(vec2(Source{{12, 34}}, 1_f, 2_f))); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: type constructor evaluated but not used"); @@ -2730,7 +3224,7 @@ TEST_F(ResolverTypeConstructorValidationTest, TypeConversionAsStatement) { WrapInFunction(CallStmt(Construct(Source{{12, 34}}, ty.f32(), 1_i))); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: type cast evaluated but not used"); + EXPECT_EQ(r()->error(), "12:34 error: type conversion evaluated but not used"); } } // namespace diff --git a/src/tint/resolver/type_validation_test.cc b/src/tint/resolver/type_validation_test.cc index 2af2c0e4f8..25750029a5 100644 --- a/src/tint/resolver/type_validation_test.cc +++ b/src/tint/resolver/type_validation_test.cc @@ -60,7 +60,7 @@ TEST_F(ResolverTypeValidationTest, VariableDeclNoConstructor_Pass) { // var a :i32; // a = 2; // } - auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, nullptr); + auto* var = Var("a", ty.i32()); auto* lhs = Expr("a"); auto* rhs = Expr(2_i); @@ -73,33 +73,23 @@ TEST_F(ResolverTypeValidationTest, VariableDeclNoConstructor_Pass) { ASSERT_NE(TypeOf(rhs), nullptr); } -TEST_F(ResolverTypeValidationTest, GlobalConstantNoConstructor_Pass) { +TEST_F(ResolverTypeValidationTest, GlobalOverrideNoConstructor_Pass) { // @id(0) override a :i32; - Override(Source{{12, 34}}, "a", ty.i32(), nullptr, ast::AttributeList{Id(0)}); + Override(Source{{12, 34}}, "a", ty.i32(), Id(0)); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverTypeValidationTest, GlobalVariableWithStorageClass_Pass) { // var global_var: f32; - Global(Source{{12, 34}}, "global_var", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar(Source{{12, 34}}, "global_var", ty.f32(), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverTypeValidationTest, GlobalConstantWithStorageClass_Fail) { - // const global_var: f32; - AST().AddGlobalVariable(create( - Source{{12, 34}}, Symbols().Register("global_var"), ast::StorageClass::kPrivate, - ast::Access::kUndefined, ty.f32(), true, false, Expr(1.23f), ast::AttributeList{})); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: global constants shouldn't have a storage class"); -} - TEST_F(ResolverTypeValidationTest, GlobalConstNoStorageClass_Pass) { - // let global_var: f32; - GlobalConst(Source{{12, 34}}, "global_var", ty.f32(), Construct(ty.f32())); + // const global_const: f32 = f32(); + GlobalConst(Source{{12, 34}}, "global_const", ty.f32(), Construct(ty.f32())); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -108,9 +98,9 @@ TEST_F(ResolverTypeValidationTest, GlobalVariableUnique_Pass) { // var global_var0 : f32 = 0.1; // var global_var1 : i32 = 0; - Global("global_var0", ty.f32(), ast::StorageClass::kPrivate, Expr(0.1f)); + GlobalVar("global_var0", ty.f32(), ast::StorageClass::kPrivate, Expr(0.1_f)); - Global(Source{{12, 34}}, "global_var1", ty.f32(), ast::StorageClass::kPrivate, Expr(1.0f)); + GlobalVar(Source{{12, 34}}, "global_var1", ty.f32(), ast::StorageClass::kPrivate, Expr(1_f)); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -121,11 +111,12 @@ TEST_F(ResolverTypeValidationTest, GlobalVariableFunctionVariableNotUnique_Pass) // } // var a: f32 = 2.1; - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(2.0f)); + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("a", ty.f32(), Expr(2_f))), + }); - Func("my_func", ast::VariableList{}, ty.void_(), {Decl(var)}); - - Global("a", ty.f32(), ast::StorageClass::kPrivate, Expr(2.1f)); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate, Expr(2.1_f)); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -135,12 +126,12 @@ TEST_F(ResolverTypeValidationTest, RedeclaredIdentifierInnerScope_Pass) { // if (true) { var a : f32 = 2.0; } // var a : f32 = 3.14; // } - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(2.0f)); + auto* var = Var("a", ty.f32(), Expr(2_f)); auto* cond = Expr(true); auto* body = Block(Decl(var)); - auto* var_a_float = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(3.1f)); + auto* var_a_float = Var("a", ty.f32(), Expr(3.1_f)); auto* outer_body = Block(If(cond, body), Decl(Source{{12, 34}}, var_a_float)); @@ -154,10 +145,10 @@ TEST_F(ResolverTypeValidationTest, RedeclaredIdentifierInnerScopeBlock_Pass) { // { var a : f32; } // var a : f32; // } - auto* var_inner = Var("a", ty.f32(), ast::StorageClass::kNone); + auto* var_inner = Var("a", ty.f32()); auto* inner = Block(Decl(Source{{12, 34}}, var_inner)); - auto* var_outer = Var("a", ty.f32(), ast::StorageClass::kNone); + auto* var_outer = Var("a", ty.f32()); auto* outer_body = Block(inner, Decl(var_outer)); WrapInFunction(outer_body); @@ -168,19 +159,18 @@ TEST_F(ResolverTypeValidationTest, RedeclaredIdentifierInnerScopeBlock_Pass) { TEST_F(ResolverTypeValidationTest, RedeclaredIdentifierDifferentFunctions_Pass) { // func0 { var a : f32 = 2.0; return; } // func1 { var a : f32 = 3.0; return; } - auto* var0 = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(2.0f)); + auto* var0 = Var("a", ty.f32(), Expr(2_f)); - auto* var1 = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(1.0f)); + auto* var1 = Var("a", ty.f32(), Expr(1_f)); - Func("func0", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("func0", utils::Empty, ty.void_(), + utils::Vector{ Decl(Source{{12, 34}}, var0), Return(), - }, - ast::AttributeList{}); + }); - Func("func1", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("func1", utils::Empty, ty.void_(), + utils::Vector{ Decl(Source{{13, 34}}, var1), Return(), }); @@ -188,191 +178,223 @@ TEST_F(ResolverTypeValidationTest, RedeclaredIdentifierDifferentFunctions_Pass) EXPECT_TRUE(r()->Resolve()) << r()->error(); } +TEST_F(ResolverTypeValidationTest, ArraySize_AIntLiteral_Pass) { + // var a : array; + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 4_a)), ast::StorageClass::kPrivate); + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} + TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedLiteral_Pass) { // var a : array; - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 4_u)), ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 4_u)), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverTypeValidationTest, ArraySize_SignedLiteral_Pass) { // var a : array; - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 4_i)), ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 4_i)), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedConstant_Pass) { - // let size = 4u; +TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedConst_Pass) { + // const size = 4u; // var a : array; - GlobalConst("size", nullptr, Expr(4_u)); - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); + GlobalConst("size", Expr(4_u)); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); } -TEST_F(ResolverTypeValidationTest, ArraySize_SignedConstant_Pass) { - // let size = 4i; +TEST_F(ResolverTypeValidationTest, ArraySize_SignedConst_Pass) { + // const size = 4i; // var a : array; - GlobalConst("size", nullptr, Expr(4_i)); - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); + GlobalConst("size", Expr(4_i)); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); } +TEST_F(ResolverTypeValidationTest, ArraySize_AIntLiteral_Zero) { + // var a : array; + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 0_a)), ast::StorageClass::kPrivate); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: array size (0) must be greater than 0"); +} + TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedLiteral_Zero) { // var a : array; - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 0_u)), ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 0_u)), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be at least 1"); + EXPECT_EQ(r()->error(), "12:34 error: array size (0) must be greater than 0"); } TEST_F(ResolverTypeValidationTest, ArraySize_SignedLiteral_Zero) { // var a : array; - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 0_i)), ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 0_i)), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be at least 1"); + EXPECT_EQ(r()->error(), "12:34 error: array size (0) must be greater than 0"); } TEST_F(ResolverTypeValidationTest, ArraySize_SignedLiteral_Negative) { // var a : array; - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, i32(-10))), ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, -10_i)), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be at least 1"); + EXPECT_EQ(r()->error(), "12:34 error: array size (-10) must be greater than 0"); } -TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedConstant_Zero) { - // let size = 0u; +TEST_F(ResolverTypeValidationTest, ArraySize_UnsignedConst_Zero) { + // const size = 0u; // var a : array; - GlobalConst("size", nullptr, Expr(0_u)); - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); + GlobalConst("size", Expr(0_u)); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be at least 1"); + EXPECT_EQ(r()->error(), "12:34 error: array size (0) must be greater than 0"); } -TEST_F(ResolverTypeValidationTest, ArraySize_SignedConstant_Zero) { - // let size = 0i; +TEST_F(ResolverTypeValidationTest, ArraySize_SignedConst_Zero) { + // const size = 0i; // var a : array; - GlobalConst("size", nullptr, Expr(0_i)); - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); + GlobalConst("size", Expr(0_i)); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be at least 1"); + EXPECT_EQ(r()->error(), "12:34 error: array size (0) must be greater than 0"); } -TEST_F(ResolverTypeValidationTest, ArraySize_SignedConstant_Negative) { - // let size = -10i; +TEST_F(ResolverTypeValidationTest, ArraySize_SignedConst_Negative) { + // const size = -10i; // var a : array; - GlobalConst("size", nullptr, Expr(i32(-10))); - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); + GlobalConst("size", Expr(-10_i)); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be at least 1"); + EXPECT_EQ(r()->error(), "12:34 error: array size (-10) must be greater than 0"); } TEST_F(ResolverTypeValidationTest, ArraySize_FloatLiteral) { // var a : array; - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 10.f)), ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 10_f)), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be integer scalar"); + EXPECT_EQ(r()->error(), + "12:34 error: array size must evaluate to a constant integer expression, but is type " + "'f32'"); } TEST_F(ResolverTypeValidationTest, ArraySize_IVecLiteral) { // var a : array(10, 10)>; - Global("a", ty.array(ty.f32(), Construct(Source{{12, 34}}, ty.vec2(), 10_i, 10_i)), - ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(ty.f32(), Construct(Source{{12, 34}}, ty.vec2(), 10_i, 10_i)), + ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be integer scalar"); + EXPECT_EQ(r()->error(), + "12:34 error: array size must evaluate to a constant integer expression, but is type " + "'vec2'"); } -TEST_F(ResolverTypeValidationTest, ArraySize_FloatConstant) { - // let size = 10.0; +TEST_F(ResolverTypeValidationTest, ArraySize_FloatConst) { + // const size = 10.0; // var a : array; - GlobalConst("size", nullptr, Expr(10.f)); - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); + GlobalConst("size", Expr(10_f)); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be integer scalar"); + EXPECT_EQ(r()->error(), + "12:34 error: array size must evaluate to a constant integer expression, but is type " + "'f32'"); } -TEST_F(ResolverTypeValidationTest, ArraySize_IVecConstant) { - // let size = vec2(100, 100); +TEST_F(ResolverTypeValidationTest, ArraySize_IVecConst) { + // const size = vec2(100, 100); // var a : array; - GlobalConst("size", nullptr, Construct(ty.vec2(), 100_i, 100_i)); - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); + GlobalConst("size", Construct(ty.vec2(), 100_i, 100_i)); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size must be integer scalar"); + EXPECT_EQ(r()->error(), + "12:34 error: array size must evaluate to a constant integer expression, but is type " + "'vec2'"); } TEST_F(ResolverTypeValidationTest, ArraySize_TooBig_ImplicitStride) { // var a : array; - Global("a", ty.array(Source{{12, 34}}, ty.f32(), 0x40000000_u), ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(Source{{12, 34}}, ty.f32(), 0x40000000_u), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: array size in bytes must not exceed 0xffffffff, but " - "is 0x100000000"); + "12:34 error: array size (0x100000000) must not exceed 0xffffffff bytes"); } TEST_F(ResolverTypeValidationTest, ArraySize_TooBig_ExplicitStride) { // var a : @stride(8) array; - Global("a", ty.array(Source{{12, 34}}, ty.f32(), 0x20000000_u, 8), ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(Source{{12, 34}}, ty.f32(), 0x20000000_u, 8), + ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: array size in bytes must not exceed 0xffffffff, but " - "is 0x100000000"); + "12:34 error: array size (0x100000000) must not exceed 0xffffffff bytes"); } -TEST_F(ResolverTypeValidationTest, ArraySize_OverridableConstant) { +TEST_F(ResolverTypeValidationTest, ArraySize_Overridable) { // override size = 10i; // var a : array; - Override("size", nullptr, Expr(10_i)); - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); + Override("size", Expr(10_i)); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size expression must not be pipeline-overridable"); + EXPECT_EQ(r()->error(), + "12:34 error: array size must evaluate to a constant integer expression"); } TEST_F(ResolverTypeValidationTest, ArraySize_ModuleVar) { // var size : i32 = 10i; // var a : array; - Global("size", ty.i32(), Expr(10_i), ast::StorageClass::kPrivate); - Global("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); + GlobalVar("size", ty.i32(), Expr(10_i), ast::StorageClass::kPrivate); + GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size")), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size identifier must be a module-scope constant"); + EXPECT_EQ(r()->error(), + R"(12:34 error: var 'size' cannot not be referenced at module-scope +note: var 'size' declared here)"); } -TEST_F(ResolverTypeValidationTest, ArraySize_FunctionConstant) { +TEST_F(ResolverTypeValidationTest, ArraySize_FunctionConst) { + // { + // const size = 10; + // var a : array; + // } + auto* size = Const("size", Expr(10_i)); + auto* a = Var("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size"))); + WrapInFunction(size, a); + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverTypeValidationTest, ArraySize_FunctionLet) { // { // let size = 10; // var a : array; // } - auto* size = Let("size", nullptr, Expr(10_i)); + auto* size = Let("size", Expr(10_i)); auto* a = Var("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, "size"))); - WrapInFunction(Block(Decl(size), Decl(a))); - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: array size identifier must be a module-scope constant"); -} - -TEST_F(ResolverTypeValidationTest, ArraySize_InvalidExpr) { - // var a : array; - auto* a = Var("a", ty.array(ty.f32(), Construct(Source{{12, 34}}, ty.i32(), 4_i))); - WrapInFunction(Block(Decl(a))); + WrapInFunction(size, a); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: array size expression must be either a literal or a " - "module-scope constant"); + "12:34 error: array size must evaluate to a constant integer expression"); +} + +TEST_F(ResolverTypeValidationTest, ArraySize_ComplexExpr) { + // var a : array; + auto* a = Var("a", ty.array(ty.f32(), Construct(Source{{12, 34}}, ty.i32(), 4_i))); + WrapInFunction(a); + EXPECT_TRUE(r()->Resolve()); } TEST_F(ResolverTypeValidationTest, RuntimeArrayInFunction_Fail) { - /// @stage(vertex) + /// @vertex // fn func() { var a : array; } - auto* var = Var(Source{{12, 34}}, "a", ty.array(), ast::StorageClass::kNone); + auto* var = Var(Source{{12, 34}}, "a", ty.array()); - Func("func", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("func", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kVertex), }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(12:34 error: runtime-sized arrays can only be used in the storage class -12:34 note: while instantiating variable a)"); +12:34 note: while instantiating 'var' a)"); } TEST_F(ResolverTypeValidationTest, Struct_Member_VectorNoType) { @@ -380,7 +402,9 @@ TEST_F(ResolverTypeValidationTest, Struct_Member_VectorNoType) { // a: vec3; // }; - Structure("S", {Member("a", create(Source{{12, 34}}, nullptr, 3))}); + Structure("S", utils::Vector{ + Member("a", create(Source{{12, 34}}, nullptr, 3u)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: missing vector element type"); @@ -390,7 +414,9 @@ TEST_F(ResolverTypeValidationTest, Struct_Member_MatrixNoType) { // struct S { // a: mat3x3; // }; - Structure("S", {Member("a", create(Source{{12, 34}}, nullptr, 3, 3))}); + Structure("S", utils::Vector{ + Member("a", create(Source{{12, 34}}, nullptr, 3u, 3u)), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type"); @@ -403,17 +429,14 @@ TEST_F(ResolverTypeValidationTest, Struct_TooBig) { // }; Structure(Source{{12, 34}}, "Foo", - { + utils::Vector{ Member("a", ty.array()), Member("b", ty.array()), }); - WrapInFunction(); - EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: struct size in bytes must not exceed 0xffffffff, but " - "is 0x100000000"); + "12:34 error: struct size (0x100000000) must not exceed 0xffffffff bytes"); } TEST_F(ResolverTypeValidationTest, Struct_MemberOffset_TooBig) { @@ -423,18 +446,15 @@ TEST_F(ResolverTypeValidationTest, Struct_MemberOffset_TooBig) { // c: f32; // }; - Structure("Foo", { + Structure("Foo", utils::Vector{ Member("a", ty.array()), Member("b", ty.f32()), Member(Source{{12, 34}}, "c", ty.f32()), }); - WrapInFunction(); - EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: struct member has byte offset 0x100000000, but must " - "not exceed 0xffffffff"); + "12:34 error: struct member offset (0x100000000) must not exceed 0xffffffff bytes"); } TEST_F(ResolverTypeValidationTest, RuntimeArrayIsLast_Pass) { @@ -443,13 +463,11 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayIsLast_Pass) { // rt: array; // }; - Structure("Foo", { + Structure("Foo", utils::Vector{ Member("vf", ty.f32()), Member("rt", ty.array()), }); - WrapInFunction(); - EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -458,12 +476,13 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayInArray) { // rt : array, 4u>; // }; - Structure("Foo", {Member("rt", ty.array(Source{{12, 34}}, ty.array(), 4_u))}); + Structure("Foo", utils::Vector{ + Member("rt", ty.array(Source{{12, 34}}, ty.array(), 4_u)), + }); EXPECT_FALSE(r()->Resolve()) << r()->error(); EXPECT_EQ(r()->error(), - "12:34 error: an array element type cannot contain a runtime-sized " - "array"); + "12:34 error: an array element type cannot contain a runtime-sized array"); } TEST_F(ResolverTypeValidationTest, RuntimeArrayInStructInArray) { @@ -472,13 +491,14 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayInStructInArray) { // }; // var a : array; - auto* foo = Structure("Foo", {Member("rt", ty.array())}); - Global("v", ty.array(Source{{12, 34}}, ty.Of(foo), 4_u), ast::StorageClass::kPrivate); + auto* foo = Structure("Foo", utils::Vector{ + Member("rt", ty.array()), + }); + GlobalVar("v", ty.array(Source{{12, 34}}, ty.Of(foo), 4_u), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()) << r()->error(); EXPECT_EQ(r()->error(), - "12:34 error: an array element type cannot contain a runtime-sized " - "array"); + "12:34 error: an array element type cannot contain a runtime-sized array"); } TEST_F(ResolverTypeValidationTest, RuntimeArrayInStructInStruct) { @@ -489,13 +509,17 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayInStructInStruct) { // inner : Foo; // }; - auto* foo = Structure("Foo", {Member("rt", ty.array())}); - Structure("Outer", {Member(Source{{12, 34}}, "inner", ty.Of(foo))}); + auto* foo = Structure("Foo", utils::Vector{ + Member("rt", ty.array()), + }); + Structure("Outer", utils::Vector{ + Member(Source{{12, 34}}, "inner", ty.Of(foo)), + }); EXPECT_FALSE(r()->Resolve()) << r()->error(); EXPECT_EQ(r()->error(), - "12:34 error: a struct that contains a runtime array cannot be " - "nested inside another struct"); + "12:34 error: a struct that contains a runtime array cannot be nested inside another " + "struct"); } TEST_F(ResolverTypeValidationTest, RuntimeArrayIsNotLast_Fail) { @@ -504,26 +528,24 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayIsNotLast_Fail) { // vf: f32; // }; - Structure("Foo", { + Structure("Foo", utils::Vector{ Member(Source{{12, 34}}, "rt", ty.array()), Member("vf", ty.f32()), }); - WrapInFunction(); - EXPECT_FALSE(r()->Resolve()) << r()->error(); EXPECT_EQ(r()->error(), R"(12:34 error: runtime arrays may only appear as the last member of a struct)"); } TEST_F(ResolverTypeValidationTest, RuntimeArrayAsGlobalVariable) { - Global(Source{{56, 78}}, "g", ty.array(), ast::StorageClass::kPrivate); + GlobalVar(Source{{56, 78}}, "g", ty.array(), ast::StorageClass::kPrivate); ASSERT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), R"(56:78 error: runtime-sized arrays can only be used in the storage class -56:78 note: while instantiating variable g)"); +56:78 note: while instantiating 'var' g)"); } TEST_F(ResolverTypeValidationTest, RuntimeArrayAsLocalVariable) { @@ -534,26 +556,25 @@ TEST_F(ResolverTypeValidationTest, RuntimeArrayAsLocalVariable) { EXPECT_EQ(r()->error(), R"(56:78 error: runtime-sized arrays can only be used in the storage class -56:78 note: while instantiating variable g)"); +56:78 note: while instantiating 'var' g)"); } TEST_F(ResolverTypeValidationTest, RuntimeArrayAsParameter_Fail) { // fn func(a : array) {} - // @stage(vertex) fn main() {} + // @vertex fn main() {} auto* param = Param(Source{{12, 34}}, "a", ty.array()); - Func("func", ast::VariableList{param}, ty.void_(), - ast::StatementList{ + Func("func", utils::Vector{param}, ty.void_(), + utils::Vector{ Return(), - }, - ast::AttributeList{}); + }); - Func("main", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Return(), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kVertex), }); @@ -569,11 +590,10 @@ TEST_F(ResolverTypeValidationTest, PtrToRuntimeArrayAsParameter_Fail) { auto* param = Param(Source{{12, 34}}, "a", ty.pointer(ty.array(), ast::StorageClass::kWorkgroup)); - Func("func", ast::VariableList{param}, ty.void_(), - ast::StatementList{ + Func("func", utils::Vector{param}, ty.void_(), + utils::Vector{ Return(), - }, - ast::AttributeList{}); + }); EXPECT_FALSE(r()->Resolve()) << r()->error(); EXPECT_EQ(r()->error(), @@ -589,17 +609,14 @@ TEST_F(ResolverTypeValidationTest, AliasRuntimeArrayIsNotLast_Fail) { //} auto* alias = Alias("RTArr", ty.array()); - Structure("s", { + Structure("s", utils::Vector{ Member(Source{{12, 34}}, "b", ty.Of(alias)), Member("a", ty.u32()), }); - WrapInFunction(); - EXPECT_FALSE(r()->Resolve()) << r()->error(); EXPECT_EQ(r()->error(), - "12:34 error: runtime arrays may only appear as the last member of " - "a struct"); + "12:34 error: runtime arrays may only appear as the last member of a struct"); } TEST_F(ResolverTypeValidationTest, AliasRuntimeArrayIsLast_Pass) { @@ -610,31 +627,28 @@ TEST_F(ResolverTypeValidationTest, AliasRuntimeArrayIsLast_Pass) { //} auto* alias = Alias("RTArr", ty.array()); - Structure("s", { + Structure("s", utils::Vector{ Member("a", ty.u32()), Member("b", ty.Of(alias)), }); - WrapInFunction(); - EXPECT_TRUE(r()->Resolve()) << r()->error(); } TEST_F(ResolverTypeValidationTest, ArrayOfNonStorableType) { auto* tex_ty = ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()); - Global("arr", ty.array(Source{{12, 34}}, tex_ty, 4_i), ast::StorageClass::kPrivate); + GlobalVar("arr", ty.array(Source{{12, 34}}, tex_ty, 4_i), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: texture_2d cannot be used as an element type of " - "an array"); + "12:34 error: texture_2d cannot be used as an element type of an array"); } TEST_F(ResolverTypeValidationTest, VariableAsType) { // var a : i32; // var b : a; - Global("a", ty.i32(), ast::StorageClass::kPrivate); - Global("b", ty.type_name("a"), ast::StorageClass::kPrivate); + GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.type_name("a"), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -645,8 +659,8 @@ note: 'a' declared here)"); TEST_F(ResolverTypeValidationTest, FunctionAsType) { // fn f() {} // var v : f; - Func("f", {}, ty.void_(), {}); - Global("v", ty.type_name("f"), ast::StorageClass::kPrivate); + Func("f", utils::Empty, ty.void_(), {}); + GlobalVar("v", ty.type_name("f"), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -656,12 +670,30 @@ note: 'f' declared here)"); TEST_F(ResolverTypeValidationTest, BuiltinAsType) { // var v : max; - Global("v", ty.type_name("max"), ast::StorageClass::kPrivate); + GlobalVar("v", ty.type_name("max"), ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "error: cannot use builtin 'max' as type"); } +TEST_F(ResolverTypeValidationTest, F16TypeUsedWithExtension) { + // enable f16; + // var v : f16; + Enable(ast::Extension::kF16); + + GlobalVar("v", ty.f16(), ast::StorageClass::kPrivate); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverTypeValidationTest, F16TypeUsedWithoutExtension) { + // var v : f16; + GlobalVar("v", ty.f16(), ast::StorageClass::kPrivate); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "error: f16 used without 'f16' extension enabled"); +} + namespace GetCanonicalTests { struct Params { builder::ast_type_func_ptr create_ast_type; @@ -719,25 +751,35 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, CanonicalTest, testing::Val } // namespace GetCanonicalTests -namespace MultisampledTextureTests { +namespace SampledTextureTests { struct DimensionParams { ast::TextureDimension dim; bool is_valid; }; -static constexpr DimensionParams dimension_cases[] = { - DimensionParams{ast::TextureDimension::k1d, false}, - DimensionParams{ast::TextureDimension::k2d, true}, - DimensionParams{ast::TextureDimension::k2dArray, false}, - DimensionParams{ast::TextureDimension::k3d, false}, - DimensionParams{ast::TextureDimension::kCube, false}, - DimensionParams{ast::TextureDimension::kCubeArray, false}}; +using SampledTextureDimensionTest = ResolverTestWithParam; +TEST_P(SampledTextureDimensionTest, All) { + auto& params = GetParam(); + GlobalVar(Source{{12, 34}}, "a", ty.sampled_texture(params.dim, ty.i32()), Group(0), + Binding(0)); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} +INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, + SampledTextureDimensionTest, + testing::Values( // + DimensionParams{ast::TextureDimension::k1d, true}, + DimensionParams{ast::TextureDimension::k2d, true}, + DimensionParams{ast::TextureDimension::k2dArray, true}, + DimensionParams{ast::TextureDimension::k3d, true}, + DimensionParams{ast::TextureDimension::kCube, true}, + DimensionParams{ast::TextureDimension::kCubeArray, true})); using MultisampledTextureDimensionTest = ResolverTestWithParam; TEST_P(MultisampledTextureDimensionTest, All) { auto& params = GetParam(); - Global(Source{{12, 34}}, "a", ty.multisampled_texture(params.dim, ty.i32()), - ast::StorageClass::kNone, nullptr, ast::AttributeList{GroupAndBinding(0, 0)}); + GlobalVar("a", ty.multisampled_texture(Source{{12, 34}}, params.dim, ty.i32()), Group(0), + Binding(0)); if (params.is_valid) { EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -748,7 +790,13 @@ TEST_P(MultisampledTextureDimensionTest, All) { } INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, MultisampledTextureDimensionTest, - testing::ValuesIn(dimension_cases)); + testing::Values( // + DimensionParams{ast::TextureDimension::k1d, false}, + DimensionParams{ast::TextureDimension::k2d, true}, + DimensionParams{ast::TextureDimension::k2dArray, false}, + DimensionParams{ast::TextureDimension::k3d, false}, + DimensionParams{ast::TextureDimension::kCube, false}, + DimensionParams{ast::TextureDimension::kCubeArray, false})); struct TypeParams { builder::ast_type_func_ptr type_func; @@ -778,27 +826,46 @@ static constexpr TypeParams type_cases[] = { TypeParamsFor>>(false), }; +using SampledTextureTypeTest = ResolverTestWithParam; +TEST_P(SampledTextureTypeTest, All) { + auto& params = GetParam(); + GlobalVar( + "a", + ty.sampled_texture(Source{{12, 34}}, ast::TextureDimension::k2d, params.type_func(*this)), + Group(0), Binding(0)); + + if (params.is_valid) { + EXPECT_TRUE(r()->Resolve()) << r()->error(); + } else { + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: texture_2d: type must be f32, i32 or u32"); + } +} +INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, + SampledTextureTypeTest, + testing::ValuesIn(type_cases)); + using MultisampledTextureTypeTest = ResolverTestWithParam; TEST_P(MultisampledTextureTypeTest, All) { auto& params = GetParam(); - Global(Source{{12, 34}}, "a", - ty.multisampled_texture(ast::TextureDimension::k2d, params.type_func(*this)), - ast::StorageClass::kNone, nullptr, ast::AttributeList{GroupAndBinding(0, 0)}); + GlobalVar("a", + ty.multisampled_texture(Source{{12, 34}}, ast::TextureDimension::k2d, + params.type_func(*this)), + Group(0), Binding(0)); if (params.is_valid) { EXPECT_TRUE(r()->Resolve()) << r()->error(); } else { EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: texture_multisampled_2d: type must be f32, " - "i32 or u32"); + "12:34 error: texture_multisampled_2d: type must be f32, i32 or u32"); } } INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, MultisampledTextureTypeTest, testing::ValuesIn(type_cases)); -} // namespace MultisampledTextureTests +} // namespace SampledTextureTests namespace StorageTextureTests { struct DimensionParams { @@ -823,15 +890,14 @@ TEST_P(StorageTextureDimensionTest, All) { auto* st = ty.storage_texture(Source{{12, 34}}, params.dim, ast::TexelFormat::kR32Uint, ast::Access::kWrite); - Global("a", st, ast::StorageClass::kNone, ast::AttributeList{GroupAndBinding(0, 0)}); + GlobalVar("a", st, Group(0), Binding(0)); if (params.is_valid) { EXPECT_TRUE(r()->Resolve()) << r()->error(); } else { EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: cube dimensions for storage textures are not " - "supported"); + "12:34 error: cube dimensions for storage textures are not supported"); } } INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, @@ -874,26 +940,25 @@ TEST_P(StorageTextureFormatTest, All) { auto* st_a = ty.storage_texture(Source{{12, 34}}, ast::TextureDimension::k1d, params.format, ast::Access::kWrite); - Global("a", st_a, ast::StorageClass::kNone, ast::AttributeList{GroupAndBinding(0, 0)}); + GlobalVar("a", st_a, Group(0), Binding(0)); auto* st_b = ty.storage_texture(ast::TextureDimension::k2d, params.format, ast::Access::kWrite); - Global("b", st_b, ast::StorageClass::kNone, ast::AttributeList{GroupAndBinding(0, 1)}); + GlobalVar("b", st_b, Group(0), Binding(1)); auto* st_c = ty.storage_texture(ast::TextureDimension::k2dArray, params.format, ast::Access::kWrite); - Global("c", st_c, ast::StorageClass::kNone, ast::AttributeList{GroupAndBinding(0, 2)}); + GlobalVar("c", st_c, Group(0), Binding(2)); auto* st_d = ty.storage_texture(ast::TextureDimension::k3d, params.format, ast::Access::kWrite); - Global("d", st_d, ast::StorageClass::kNone, ast::AttributeList{GroupAndBinding(0, 3)}); + GlobalVar("d", st_d, Group(0), Binding(3)); if (params.is_valid) { EXPECT_TRUE(r()->Resolve()) << r()->error(); } else { EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: image format must be one of the texel formats " - "specified for storage textues in " - "https://gpuweb.github.io/gpuweb/wgsl/#texel-formats"); + "12:34 error: image format must be one of the texel formats specified for " + "storage textues in https://gpuweb.github.io/gpuweb/wgsl/#texel-formats"); } } INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, @@ -909,7 +974,7 @@ TEST_F(StorageTextureAccessTest, MissingAccess_Fail) { auto* st = ty.storage_texture(Source{{12, 34}}, ast::TextureDimension::k1d, ast::TexelFormat::kR32Uint, ast::Access::kUndefined); - Global("a", st, ast::StorageClass::kNone, ast::AttributeList{GroupAndBinding(0, 0)}); + GlobalVar("a", st, Group(0), Binding(0)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: storage texture missing access control"); @@ -922,12 +987,11 @@ TEST_F(StorageTextureAccessTest, RWAccess_Fail) { auto* st = ty.storage_texture(Source{{12, 34}}, ast::TextureDimension::k1d, ast::TexelFormat::kR32Uint, ast::Access::kReadWrite); - Global("a", st, ast::StorageClass::kNone, nullptr, ast::AttributeList{GroupAndBinding(0, 0)}); + GlobalVar("a", st, Group(0), Binding(0)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: storage textures currently only support 'write' " - "access control"); + "12:34 error: storage textures currently only support 'write' access control"); } TEST_F(StorageTextureAccessTest, ReadOnlyAccess_Fail) { @@ -937,12 +1001,11 @@ TEST_F(StorageTextureAccessTest, ReadOnlyAccess_Fail) { auto* st = ty.storage_texture(Source{{12, 34}}, ast::TextureDimension::k1d, ast::TexelFormat::kR32Uint, ast::Access::kRead); - Global("a", st, ast::StorageClass::kNone, nullptr, ast::AttributeList{GroupAndBinding(0, 0)}); + GlobalVar("a", st, Group(0), Binding(0)); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: storage textures currently only support 'write' " - "access control"); + "12:34 error: storage textures currently only support 'write' access control"); } TEST_F(StorageTextureAccessTest, WriteOnlyAccess_Pass) { @@ -952,7 +1015,7 @@ TEST_F(StorageTextureAccessTest, WriteOnlyAccess_Pass) { auto* st = ty.storage_texture(ast::TextureDimension::k1d, ast::TexelFormat::kR32Uint, ast::Access::kWrite); - Global("a", st, ast::StorageClass::kNone, nullptr, ast::AttributeList{GroupAndBinding(0, 0)}); + GlobalVar("a", st, Group(0), Binding(0)); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -975,8 +1038,11 @@ using ValidMatrixTypes = ResolverTestWithParam; TEST_P(ValidMatrixTypes, Okay) { // var a : matNxM; auto& params = GetParam(); - Global("a", ty.mat(params.elem_ty(*this), params.columns, params.rows), - ast::StorageClass::kPrivate); + + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.mat(params.elem_ty(*this), params.columns, params.rows), + ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); } INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, @@ -992,16 +1058,31 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, ParamsFor(4, 4), ParamsFor>(4, 2), ParamsFor>(4, 3), - ParamsFor>(4, 4))); + ParamsFor>(4, 4), + ParamsFor(2, 2), + ParamsFor(2, 3), + ParamsFor(2, 4), + ParamsFor(3, 2), + ParamsFor(3, 3), + ParamsFor(3, 4), + ParamsFor(4, 2), + ParamsFor(4, 3), + ParamsFor(4, 4), + ParamsFor>(4, 2), + ParamsFor>(4, 3), + ParamsFor>(4, 4))); using InvalidMatrixElementTypes = ResolverTestWithParam; TEST_P(InvalidMatrixElementTypes, InvalidElementType) { // var a : matNxM; auto& params = GetParam(); - Global("a", ty.mat(Source{{12, 34}}, params.elem_ty(*this), params.columns, params.rows), - ast::StorageClass::kPrivate); + + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.mat(Source{{12, 34}}, params.elem_ty(*this), params.columns, params.rows), + ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: matrix element type must be 'f32'"); + EXPECT_EQ(r()->error(), "12:34 error: matrix element type must be 'f32' or 'f16'"); } INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, InvalidMatrixElementTypes, @@ -1009,12 +1090,17 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, ParamsFor(4, 3), ParamsFor(4, 4), ParamsFor>(2, 2), + ParamsFor>(2, 2), ParamsFor>(2, 3), ParamsFor>(2, 4), ParamsFor>(3, 2), ParamsFor>(3, 3), ParamsFor>(3, 4), - ParamsFor>(4, 2))); + ParamsFor>(3, 2), + ParamsFor>(3, 3), + ParamsFor>(3, 4), + ParamsFor>(4, 2), + ParamsFor>(4, 2))); } // namespace MatrixTests namespace VectorTests { @@ -1032,25 +1118,32 @@ using ValidVectorTypes = ResolverTestWithParam; TEST_P(ValidVectorTypes, Okay) { // var a : vecN; auto& params = GetParam(); - Global("a", ty.vec(params.elem_ty(*this), params.width), ast::StorageClass::kPrivate); + + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.vec(params.elem_ty(*this), params.width), ast::StorageClass::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); } INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, ValidVectorTypes, testing::Values(ParamsFor(2), ParamsFor(2), + ParamsFor(2), ParamsFor(2), ParamsFor(2), ParamsFor(3), ParamsFor(3), + ParamsFor(3), ParamsFor(3), ParamsFor(3), ParamsFor(4), ParamsFor(4), + ParamsFor(4), ParamsFor(4), ParamsFor(4), ParamsFor>(4), ParamsFor>(4), + ParamsFor>(4), ParamsFor>(4), ParamsFor>(4))); @@ -1058,11 +1151,14 @@ using InvalidVectorElementTypes = ResolverTestWithParam; TEST_P(InvalidVectorElementTypes, InvalidElementType) { // var a : vecN; auto& params = GetParam(); - Global("a", ty.vec(Source{{12, 34}}, params.elem_ty(*this), params.width), - ast::StorageClass::kPrivate); + + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.vec(Source{{12, 34}}, params.elem_ty(*this), params.width), + ast::StorageClass::kPrivate); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), - "12:34 error: vector element type must be 'bool', 'f32', 'i32' " + "12:34 error: vector element type must be 'bool', 'f32', 'f16', 'i32' " "or 'u32'"); } INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, @@ -1071,7 +1167,7 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, ParamsFor>(2), ParamsFor>(2), ParamsFor>(2), - ParamsFor>(2), + ParamsFor>(2), ParamsFor>(2), ParamsFor>(2))); } // namespace VectorTests diff --git a/src/tint/resolver/uniformity.cc b/src/tint/resolver/uniformity.cc new file mode 100644 index 0000000000..e4c31c9394 --- /dev/null +++ b/src/tint/resolver/uniformity.cc @@ -0,0 +1,1644 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/resolver/uniformity.h" + +#include +#include +#include +#include +#include +#include + +#include "src/tint/program_builder.h" +#include "src/tint/resolver/dependency_graph.h" +#include "src/tint/scope_stack.h" +#include "src/tint/sem/block_statement.h" +#include "src/tint/sem/for_loop_statement.h" +#include "src/tint/sem/function.h" +#include "src/tint/sem/if_statement.h" +#include "src/tint/sem/info.h" +#include "src/tint/sem/loop_statement.h" +#include "src/tint/sem/statement.h" +#include "src/tint/sem/switch_statement.h" +#include "src/tint/sem/type_constructor.h" +#include "src/tint/sem/type_conversion.h" +#include "src/tint/sem/variable.h" +#include "src/tint/sem/while_statement.h" +#include "src/tint/utils/block_allocator.h" +#include "src/tint/utils/map.h" +#include "src/tint/utils/unique_vector.h" + +// Set to `1` to dump the uniformity graph for each function in graphviz format. +#define TINT_DUMP_UNIFORMITY_GRAPH 0 + +namespace tint::resolver { + +namespace { + +/// CallSiteTag describes the uniformity requirements on the call sites of a function. +enum CallSiteTag { + CallSiteRequiredToBeUniform, + CallSiteNoRestriction, +}; + +/// FunctionTag describes a functions effects on uniformity. +enum FunctionTag { + SubsequentControlFlowMayBeNonUniform, + ReturnValueMayBeNonUniform, + NoRestriction, +}; + +/// ParameterTag describes the uniformity requirements of values passed to a function parameter. +enum ParameterTag { + ParameterRequiredToBeUniform, + ParameterRequiredToBeUniformForSubsequentControlFlow, + ParameterRequiredToBeUniformForReturnValue, + ParameterNoRestriction, +}; + +/// Node represents a node in the graph of control flow and value nodes within the analysis of a +/// single function. +struct Node { + /// Constructor + /// @param a the corresponding AST node + explicit Node(const ast::Node* a) : ast(a) {} + +#if TINT_DUMP_UNIFORMITY_GRAPH + /// The node tag. + std::string tag; +#endif + + /// Type describes the type of the node, which is used to determine additional diagnostic + /// information. + enum Type { + kRegular, + kFunctionCallArgument, + kFunctionCallPointerArgumentResult, + kFunctionCallReturnValue, + }; + + /// The type of the node. + Type type = kRegular; + + /// `true` if this node represents a potential control flow change. + bool affects_control_flow = false; + + /// The corresponding AST node, or nullptr. + const ast::Node* ast = nullptr; + + /// The function call argument index, if applicable. + uint32_t arg_index; + + /// The set of edges from this node to other nodes in the graph. + utils::UniqueVector edges; + + /// The node that this node was visited from, or nullptr if not visited. + Node* visited_from = nullptr; + + /// Add an edge to the `to` node. + /// @param to the destination node + void AddEdge(Node* to) { edges.Add(to); } +}; + +/// ParameterInfo holds information about the uniformity requirements and effects for a particular +/// function parameter. +struct ParameterInfo { + /// The semantic node in corresponds to this parameter. + const sem::Parameter* sem; + /// The parameter's uniformity requirements. + ParameterTag tag = ParameterNoRestriction; + /// Will be `true` if this function may cause the contents of this pointer parameter to become + /// non-uniform. + bool pointer_may_become_non_uniform = false; + /// The parameters that are required to be uniform for the contents of this pointer parameter to + /// be uniform at function exit. + std::vector pointer_param_output_sources; + /// The node in the graph that corresponds to this parameter's initial value. + Node* init_value; + /// The node in the graph that corresponds to this parameter's output value (or nullptr). + Node* pointer_return_value = nullptr; +}; + +/// FunctionInfo holds information about the uniformity requirements and effects for a particular +/// function, as well as the control flow graph. +struct FunctionInfo { + /// Constructor + /// @param func the AST function + /// @param builder the program builder + FunctionInfo(const ast::Function* func, const ProgramBuilder* builder) { + name = builder->Symbols().NameFor(func->symbol); + callsite_tag = CallSiteNoRestriction; + function_tag = NoRestriction; + + // Create special nodes. + required_to_be_uniform = CreateNode("RequiredToBeUniform"); + may_be_non_uniform = CreateNode("MayBeNonUniform"); + cf_start = CreateNode("CF_start"); + cf_return = CreateNode("CF_return"); + if (func->return_type) { + value_return = CreateNode("Value_return"); + } + + // Create nodes for parameters. + parameters.resize(func->params.Length()); + for (size_t i = 0; i < func->params.Length(); i++) { + auto* param = func->params[i]; + auto param_name = builder->Symbols().NameFor(param->symbol); + auto* sem = builder->Sem().Get(param); + parameters[i].sem = sem; + + Node* node_init; + if (sem->Type()->Is()) { + node_init = CreateNode("ptrparam_" + name + "_init"); + parameters[i].pointer_return_value = CreateNode("ptrparam_" + name + "_return"); + local_var_decls.insert(sem); + } else { + node_init = CreateNode("param_" + name); + } + parameters[i].init_value = node_init; + variables.Set(sem, node_init); + } + } + + /// The name of the function. + std::string name; + + /// The call site uniformity requirements. + CallSiteTag callsite_tag; + /// The function's uniformity effects. + FunctionTag function_tag; + /// The uniformity requirements of the function's parameters. + std::vector parameters; + + /// The control flow graph. + utils::BlockAllocator nodes; + + /// Special `RequiredToBeUniform` node. + Node* required_to_be_uniform; + /// Special `MayBeNonUniform` node. + Node* may_be_non_uniform; + /// Special `CF_start` node. + Node* cf_start; + /// Special `CF_return` node. + Node* cf_return; + /// Special `Value_return` node. + Node* value_return; + + /// Map from variables to their value nodes in the graph, scoped with respect to control flow. + ScopeStack variables; + + /// The set of a local read-write vars that are in scope at any given point in the process. + /// Includes pointer parameters. + std::unordered_set local_var_decls; + + /// LoopSwitchInfo tracks information about the value of variables for a control flow construct. + struct LoopSwitchInfo { + /// The type of this control flow construct. + std::string type; + /// The input values for local variables at the start of this construct. + std::unordered_map var_in_nodes; + /// The exit values for local variables at the end of this construct. + std::unordered_map var_exit_nodes; + }; + + /// Map from control flow statements to the corresponding LoopSwitchInfo structure. + std::unordered_map loop_switch_infos; + + /// Create a new node. + /// @param tag a tag used to identify the node for debugging purposes + /// @param ast the optional AST node that this node corresponds to + /// @returns the new node + Node* CreateNode([[maybe_unused]] std::string tag, const ast::Node* ast = nullptr) { + auto* node = nodes.Create(ast); + +#if TINT_DUMP_UNIFORMITY_GRAPH + // Make the tag unique and set it. + // This only matters if we're dumping the graph. + std::string unique_tag = tag; + int suffix = 0; + while (tags_.count(unique_tag)) { + unique_tag = tag + "_$" + std::to_string(++suffix); + } + tags_.insert(unique_tag); + node->tag = name + "." + unique_tag; +#endif + + return node; + } + + /// Reset the visited status of every node in the graph. + void ResetVisited() { + for (auto* node : nodes.Objects()) { + node->visited_from = nullptr; + } + } + + private: + /// A list of tags that have already been used within the current function. + std::unordered_set tags_; +}; + +/// UniformityGraph is used to analyze the uniformity requirements and effects of functions in a +/// module. +class UniformityGraph { + public: + /// Constructor. + /// @param builder the program to analyze + explicit UniformityGraph(ProgramBuilder* builder) + : builder_(builder), sem_(builder->Sem()), diagnostics_(builder->Diagnostics()) {} + + /// Destructor. + ~UniformityGraph() {} + + /// Build and analyze the graph to determine whether the program satisfies the uniformity + /// constraints of WGSL. + /// @param dependency_graph the dependency-ordered module-scope declarations + /// @returns true if all uniformity constraints are satisfied, otherise false + bool Build(const DependencyGraph& dependency_graph) { +#if TINT_DUMP_UNIFORMITY_GRAPH + std::cout << "digraph G {\n"; + std::cout << "rankdir=BT\n"; +#endif + + // Process all functions in the module. + bool success = true; + for (auto* decl : dependency_graph.ordered_globals) { + if (auto* func = decl->As()) { + if (!ProcessFunction(func)) { + success = false; + break; + } + } + } + +#if TINT_DUMP_UNIFORMITY_GRAPH + std::cout << "\n}\n"; +#endif + + return success; + } + + private: + const ProgramBuilder* builder_; + const sem::Info& sem_; + diag::List& diagnostics_; + + /// Map of analyzed function results. + std::unordered_map functions_; + + /// The function currently being analyzed. + FunctionInfo* current_function_; + + /// Create a new node. + /// @param tag a tag used to identify the node for debugging purposes. + /// @param ast the optional AST node that this node corresponds to + /// @returns the new node + Node* CreateNode(std::string tag, const ast::Node* ast = nullptr) { + return current_function_->CreateNode(std::move(tag), ast); + } + + /// Process a function. + /// @param func the function to process + /// @returns true if there are no uniformity issues, false otherwise + bool ProcessFunction(const ast::Function* func) { + functions_.emplace(func, FunctionInfo(func, builder_)); + current_function_ = &functions_.at(func); + + // Process function body. + if (func->body) { + auto* cf = ProcessStatement(current_function_->cf_start, func->body); + current_function_->cf_return->AddEdge(cf); + } + +#if TINT_DUMP_UNIFORMITY_GRAPH + // Dump the graph for this function as a subgraph. + std::cout << "\nsubgraph cluster_" << current_function_->name << " {\n"; + std::cout << " label=" << current_function_->name << ";"; + for (auto* node : current_function_->nodes.Objects()) { + std::cout << "\n \"" << node->tag << "\";"; + for (auto* edge : node->edges) { + std::cout << "\n \"" << node->tag << "\" -> \"" << edge->tag << "\";"; + } + } + std::cout << "\n}\n"; +#endif + + // Look at which nodes are reachable from "RequiredToBeUniform". + { + utils::UniqueVector reachable; + Traverse(current_function_->required_to_be_uniform, &reachable); + if (reachable.Contains(current_function_->may_be_non_uniform)) { + MakeError(*current_function_, current_function_->may_be_non_uniform); + return false; + } + if (reachable.Contains(current_function_->cf_start)) { + current_function_->callsite_tag = CallSiteRequiredToBeUniform; + } + + // Set the parameter tag to ParameterRequiredToBeUniform for each parameter node that + // was reachable. + for (size_t i = 0; i < func->params.Length(); i++) { + auto* param = func->params[i]; + if (reachable.Contains(current_function_->variables.Get(sem_.Get(param)))) { + current_function_->parameters[i].tag = ParameterRequiredToBeUniform; + } + } + } + + // Look at which nodes are reachable from "CF_return" + { + utils::UniqueVector reachable; + Traverse(current_function_->cf_return, &reachable); + if (reachable.Contains(current_function_->may_be_non_uniform)) { + current_function_->function_tag = SubsequentControlFlowMayBeNonUniform; + } + + // Set the parameter tag to ParameterRequiredToBeUniformForSubsequentControlFlow for + // each parameter node that was reachable. + for (size_t i = 0; i < func->params.Length(); i++) { + auto* param = func->params[i]; + if (reachable.Contains(current_function_->variables.Get(sem_.Get(param)))) { + current_function_->parameters[i].tag = + ParameterRequiredToBeUniformForSubsequentControlFlow; + } + } + } + + // If "Value_return" exists, look at which nodes are reachable from it + if (current_function_->value_return) { + utils::UniqueVector reachable; + Traverse(current_function_->value_return, &reachable); + if (reachable.Contains(current_function_->may_be_non_uniform)) { + current_function_->function_tag = ReturnValueMayBeNonUniform; + } + + // Set the parameter tag to ParameterRequiredToBeUniformForReturnValue for each + // parameter node that was reachable. + for (size_t i = 0; i < func->params.Length(); i++) { + auto* param = func->params[i]; + if (reachable.Contains(current_function_->variables.Get(sem_.Get(param)))) { + current_function_->parameters[i].tag = + ParameterRequiredToBeUniformForReturnValue; + } + } + } + + // Traverse the graph for each pointer parameter. + for (size_t i = 0; i < func->params.Length(); i++) { + if (current_function_->parameters[i].pointer_return_value == nullptr) { + continue; + } + + // Reset "visited" state for all nodes. + current_function_->ResetVisited(); + + utils::UniqueVector reachable; + Traverse(current_function_->parameters[i].pointer_return_value, &reachable); + if (reachable.Contains(current_function_->may_be_non_uniform)) { + current_function_->parameters[i].pointer_may_become_non_uniform = true; + } + + // Check every other parameter to see if they feed into this parameter's final value. + for (size_t j = 0; j < func->params.Length(); j++) { + auto* param_source = sem_.Get(func->params[j]); + if (reachable.Contains(current_function_->parameters[j].init_value)) { + current_function_->parameters[i].pointer_param_output_sources.push_back( + param_source); + } + } + } + + return true; + } + + /// Process a statement, returning the new control flow node. + /// @param cf the input control flow node + /// @param stmt the statement to process d + /// @returns the new control flow node + Node* ProcessStatement(Node* cf, const ast::Statement* stmt) { + return Switch( + stmt, + + [&](const ast::AssignmentStatement* a) { + auto [cf1, v1] = ProcessExpression(cf, a->rhs); + if (a->lhs->Is()) { + return cf1; + } else { + auto [cf2, l2] = ProcessLValueExpression(cf1, a->lhs); + l2->AddEdge(v1); + return cf2; + } + }, + + [&](const ast::BlockStatement* b) { + std::unordered_map scoped_assignments; + { + // Push a new scope for variable assignments in the block. + current_function_->variables.Push(); + TINT_DEFER(current_function_->variables.Pop()); + + for (auto* s : b->statements) { + cf = ProcessStatement(cf, s); + if (!sem_.Get(s)->Behaviors().Contains(sem::Behavior::kNext)) { + break; + } + } + + if (sem_.Get(b)) { + // We've reached the end of the function body. + // Add edges from pointer parameter outputs to their current value. + for (auto param : current_function_->parameters) { + if (param.pointer_return_value) { + param.pointer_return_value->AddEdge( + current_function_->variables.Get(param.sem)); + } + } + } + + scoped_assignments = std::move(current_function_->variables.Top()); + } + + // Propagate all variables assignments to the containing scope if the behavior is + // either 'Next' or 'Fallthrough'. + auto& behaviors = sem_.Get(b)->Behaviors(); + if (behaviors.Contains(sem::Behavior::kNext) || + behaviors.Contains(sem::Behavior::kFallthrough)) { + for (auto var : scoped_assignments) { + current_function_->variables.Set(var.first, var.second); + } + } + + // Remove any variables declared in this scope from the set of in-scope variables. + for (auto* d : sem_.Get(b)->Decls()) { + current_function_->local_var_decls.erase(sem_.Get(d)); + } + + return cf; + }, + + [&](const ast::BreakStatement* b) { + // Find the loop or switch statement that we are in. + auto* parent = sem_.Get(b) + ->FindFirstParent(); + TINT_ASSERT(Resolver, current_function_->loop_switch_infos.count(parent)); + auto& info = current_function_->loop_switch_infos.at(parent); + + // Propagate variable values to the loop/switch exit nodes. + for (auto* var : current_function_->local_var_decls) { + // Skip variables that were declared inside this loop/switch. + if (auto* lv = var->As(); + lv && + lv->Statement()->FindFirstParent([&](auto* s) { return s == parent; })) { + continue; + } + + // Add an edge from the variable exit node to its value at this point. + auto* exit_node = utils::GetOrCreate(info.var_exit_nodes, var, [&]() { + auto name = builder_->Symbols().NameFor(var->Declaration()->symbol); + return CreateNode(name + "_value_" + info.type + "_exit"); + }); + exit_node->AddEdge(current_function_->variables.Get(var)); + } + + return cf; + }, + + [&](const ast::CallStatement* c) { + auto [cf1, _] = ProcessCall(cf, c->expr); + return cf1; + }, + + [&](const ast::CompoundAssignmentStatement* c) { + // The compound assignment statement `a += b` is equivalent to `a = a + b`. + auto [cf1, v1] = ProcessExpression(cf, c->lhs); + auto [cf2, v2] = ProcessExpression(cf1, c->rhs); + auto* result = CreateNode("binary_expr_result"); + result->AddEdge(v1); + result->AddEdge(v2); + + auto [cf3, l3] = ProcessLValueExpression(cf2, c->lhs); + l3->AddEdge(result); + return cf3; + }, + + [&](const ast::ContinueStatement* c) { + // Find the loop statement that we are in. + auto* parent = sem_.Get(c) + ->FindFirstParent(); + TINT_ASSERT(Resolver, current_function_->loop_switch_infos.count(parent)); + auto& info = current_function_->loop_switch_infos.at(parent); + + // Propagate assignments to the loop input nodes. + for (auto* var : current_function_->local_var_decls) { + // Skip variables that were declared inside this loop. + if (auto* lv = var->As(); + lv && + lv->Statement()->FindFirstParent([&](auto* s) { return s == parent; })) { + continue; + } + + // Add an edge from the variable's loop input node to its value at this point. + TINT_ASSERT(Resolver, info.var_in_nodes.count(var)); + auto* in_node = info.var_in_nodes.at(var); + auto* out_node = current_function_->variables.Get(var); + if (out_node != in_node) { + in_node->AddEdge(out_node); + } + } + return cf; + }, + + [&](const ast::DiscardStatement*) { return cf; }, + + [&](const ast::FallthroughStatement*) { return cf; }, + + [&](const ast::ForLoopStatement* f) { + auto* sem_loop = sem_.Get(f); + auto* cfx = CreateNode("loop_start"); + + // Insert the initializer before the loop. + auto* cf_init = cf; + if (f->initializer) { + cf_init = ProcessStatement(cf, f->initializer); + } + auto* cf_start = cf_init; + + auto& info = current_function_->loop_switch_infos[sem_loop]; + info.type = "forloop"; + + // Create input nodes for any variables declared before this loop. + for (auto* v : current_function_->local_var_decls) { + auto name = builder_->Symbols().NameFor(v->Declaration()->symbol); + auto* in_node = CreateNode(name + "_value_forloop_in"); + in_node->AddEdge(current_function_->variables.Get(v)); + info.var_in_nodes[v] = in_node; + current_function_->variables.Set(v, in_node); + } + + // Insert the condition at the start of the loop body. + if (f->condition) { + auto [cf_cond, v] = ProcessExpression(cfx, f->condition); + auto* cf_condition_end = CreateNode("for_condition_CFend", f); + cf_condition_end->affects_control_flow = true; + cf_condition_end->AddEdge(v); + cf_start = cf_condition_end; + + // Propagate assignments to the loop exit nodes. + for (auto* var : current_function_->local_var_decls) { + auto* exit_node = utils::GetOrCreate(info.var_exit_nodes, var, [&]() { + auto name = builder_->Symbols().NameFor(var->Declaration()->symbol); + return CreateNode(name + "_value_" + info.type + "_exit"); + }); + exit_node->AddEdge(current_function_->variables.Get(var)); + } + } + auto* cf1 = ProcessStatement(cf_start, f->body); + + // Insert the continuing statement at the end of the loop body. + if (f->continuing) { + auto* cf2 = ProcessStatement(cf1, f->continuing); + cfx->AddEdge(cf2); + } else { + cfx->AddEdge(cf1); + } + cfx->AddEdge(cf); + + // Add edges from variable loop input nodes to their values at the end of the loop. + for (auto v : info.var_in_nodes) { + auto* in_node = v.second; + auto* out_node = current_function_->variables.Get(v.first); + if (out_node != in_node) { + in_node->AddEdge(out_node); + } + } + + // Set each variable's exit node as its value in the outer scope. + for (auto v : info.var_exit_nodes) { + current_function_->variables.Set(v.first, v.second); + } + + current_function_->loop_switch_infos.erase(sem_loop); + + if (sem_loop->Behaviors() == sem::Behaviors{sem::Behavior::kNext}) { + return cf; + } else { + return cfx; + } + }, + + [&](const ast::WhileStatement* w) { + auto* sem_loop = sem_.Get(w); + auto* cfx = CreateNode("loop_start"); + + auto* cf_start = cf; + + auto& info = current_function_->loop_switch_infos[sem_loop]; + info.type = "whileloop"; + + // Create input nodes for any variables declared before this loop. + for (auto* v : current_function_->local_var_decls) { + auto name = builder_->Symbols().NameFor(v->Declaration()->symbol); + auto* in_node = CreateNode(name + "_value_forloop_in"); + in_node->AddEdge(current_function_->variables.Get(v)); + info.var_in_nodes[v] = in_node; + current_function_->variables.Set(v, in_node); + } + + // Insert the condition at the start of the loop body. + { + auto [cf_cond, v] = ProcessExpression(cfx, w->condition); + auto* cf_condition_end = CreateNode("while_condition_CFend", w); + cf_condition_end->affects_control_flow = true; + cf_condition_end->AddEdge(v); + cf_start = cf_condition_end; + } + + // Propagate assignments to the loop exit nodes. + for (auto* var : current_function_->local_var_decls) { + auto* exit_node = utils::GetOrCreate(info.var_exit_nodes, var, [&]() { + auto name = builder_->Symbols().NameFor(var->Declaration()->symbol); + return CreateNode(name + "_value_" + info.type + "_exit"); + }); + exit_node->AddEdge(current_function_->variables.Get(var)); + } + auto* cf1 = ProcessStatement(cf_start, w->body); + cfx->AddEdge(cf1); + cfx->AddEdge(cf); + + // Add edges from variable loop input nodes to their values at the end of the loop. + for (auto v : info.var_in_nodes) { + auto* in_node = v.second; + auto* out_node = current_function_->variables.Get(v.first); + if (out_node != in_node) { + in_node->AddEdge(out_node); + } + } + + // Set each variable's exit node as its value in the outer scope. + for (auto v : info.var_exit_nodes) { + current_function_->variables.Set(v.first, v.second); + } + + current_function_->loop_switch_infos.erase(sem_loop); + + if (sem_loop->Behaviors() == sem::Behaviors{sem::Behavior::kNext}) { + return cf; + } else { + return cfx; + } + }, + + [&](const ast::IfStatement* i) { + auto* sem_if = sem_.Get(i); + auto [_, v_cond] = ProcessExpression(cf, i->condition); + + // Add a diagnostic node to capture the control flow change. + auto* v = current_function_->CreateNode("if_stmt", i); + v->affects_control_flow = true; + v->AddEdge(v_cond); + + std::unordered_map true_vars; + std::unordered_map false_vars; + + // Helper to process a statement with a new scope for variable assignments. + // Populates `assigned_vars` with new nodes for any variables that are assigned in + // this statement. + auto process_in_scope = + [&](Node* cf_in, const ast::Statement* s, + std::unordered_map& assigned_vars) { + // Push a new scope for variable assignments. + current_function_->variables.Push(); + + // Process the statement. + auto* cf_out = ProcessStatement(cf_in, s); + + assigned_vars = current_function_->variables.Top(); + + // Pop the scope and return. + current_function_->variables.Pop(); + return cf_out; + }; + + auto* cf1 = process_in_scope(v, i->body, true_vars); + + bool true_has_next = sem_.Get(i->body)->Behaviors().Contains(sem::Behavior::kNext); + bool false_has_next = true; + + Node* cf2 = nullptr; + if (i->else_statement) { + cf2 = process_in_scope(v, i->else_statement, false_vars); + + false_has_next = + sem_.Get(i->else_statement)->Behaviors().Contains(sem::Behavior::kNext); + } + + // Update values for any variables assigned in the if or else blocks. + for (auto* var : current_function_->local_var_decls) { + // Skip variables not assigned in either block. + if (true_vars.count(var) == 0 && false_vars.count(var) == 0) { + continue; + } + + // Create an exit node for the variable. + auto name = builder_->Symbols().NameFor(var->Declaration()->symbol); + auto* out_node = CreateNode(name + "_value_if_exit"); + + // Add edges to the assigned value or the initial value. + // Only add edges if the behavior for that block contains 'Next'. + if (true_has_next) { + if (true_vars.count(var)) { + out_node->AddEdge(true_vars.at(var)); + } else { + out_node->AddEdge(current_function_->variables.Get(var)); + } + } + if (false_has_next) { + if (false_vars.count(var)) { + out_node->AddEdge(false_vars.at(var)); + } else { + out_node->AddEdge(current_function_->variables.Get(var)); + } + } + + current_function_->variables.Set(var, out_node); + } + + if (sem_if->Behaviors() != sem::Behaviors{sem::Behavior::kNext}) { + auto* cf_end = CreateNode("if_CFend"); + cf_end->AddEdge(cf1); + if (cf2) { + cf_end->AddEdge(cf2); + } + return cf_end; + } + return cf; + }, + + [&](const ast::IncrementDecrementStatement* i) { + // The increment/decrement statement `i++` is equivalent to `i = i + 1`. + auto [cf1, v1] = ProcessExpression(cf, i->lhs); + auto* result = CreateNode("incdec_result"); + result->AddEdge(v1); + result->AddEdge(cf1); + + auto [cf2, l2] = ProcessLValueExpression(cf1, i->lhs); + l2->AddEdge(result); + return cf2; + }, + + [&](const ast::LoopStatement* l) { + auto* sem_loop = sem_.Get(l); + auto* cfx = CreateNode("loop_start"); + + auto& info = current_function_->loop_switch_infos[sem_loop]; + info.type = "loop"; + + // Create input nodes for any variables declared before this loop. + for (auto* v : current_function_->local_var_decls) { + auto name = builder_->Symbols().NameFor(v->Declaration()->symbol); + auto* in_node = CreateNode(name + "_value_loop_in"); + in_node->AddEdge(current_function_->variables.Get(v)); + info.var_in_nodes[v] = in_node; + current_function_->variables.Set(v, in_node); + } + + auto* cf1 = ProcessStatement(cfx, l->body); + if (l->continuing) { + auto* cf2 = ProcessStatement(cf1, l->continuing); + cfx->AddEdge(cf2); + } else { + cfx->AddEdge(cf1); + } + cfx->AddEdge(cf); + + // Add edges from variable loop input nodes to their values at the end of the loop. + for (auto v : info.var_in_nodes) { + auto* in_node = v.second; + auto* out_node = current_function_->variables.Get(v.first); + if (out_node != in_node) { + in_node->AddEdge(out_node); + } + } + + // Set each variable's exit node as its value in the outer scope. + for (auto v : info.var_exit_nodes) { + current_function_->variables.Set(v.first, v.second); + } + + current_function_->loop_switch_infos.erase(sem_loop); + + if (sem_loop->Behaviors() == sem::Behaviors{sem::Behavior::kNext}) { + return cf; + } else { + return cfx; + } + }, + + [&](const ast::ReturnStatement* r) { + Node* cf_ret; + if (r->value) { + auto [cf1, v] = ProcessExpression(cf, r->value); + current_function_->cf_return->AddEdge(cf1); + current_function_->value_return->AddEdge(v); + cf_ret = cf1; + } else { + TINT_ASSERT(Resolver, cf != nullptr); + current_function_->cf_return->AddEdge(cf); + cf_ret = cf; + } + + // Add edges from each pointer parameter output to its current value. + for (auto param : current_function_->parameters) { + if (param.pointer_return_value) { + param.pointer_return_value->AddEdge( + current_function_->variables.Get(param.sem)); + } + } + + return cf_ret; + }, + + [&](const ast::SwitchStatement* s) { + auto* sem_switch = sem_.Get(s); + auto [cfx, v_cond] = ProcessExpression(cf, s->condition); + + // Add a diagnostic node to capture the control flow change. + auto* v = current_function_->CreateNode("switch_stmt", s); + v->affects_control_flow = true; + v->AddEdge(v_cond); + + Node* cf_end = nullptr; + if (sem_switch->Behaviors() != sem::Behaviors{sem::Behavior::kNext}) { + cf_end = CreateNode("switch_CFend"); + } + + auto& info = current_function_->loop_switch_infos[sem_switch]; + info.type = "switch"; + + auto* cf_n = v; + bool previous_case_has_fallthrough = false; + for (auto* c : s->body) { + auto* sem_case = sem_.Get(c); + + if (previous_case_has_fallthrough) { + cf_n = ProcessStatement(cf_n, c->body); + } else { + current_function_->variables.Push(); + cf_n = ProcessStatement(v, c->body); + } + + if (cf_end) { + cf_end->AddEdge(cf_n); + } + + bool has_fallthrough = + sem_case->Behaviors().Contains(sem::Behavior::kFallthrough); + if (!has_fallthrough) { + if (sem_case->Behaviors().Contains(sem::Behavior::kNext)) { + // Propagate variable values to the switch exit nodes. + for (auto* var : current_function_->local_var_decls) { + // Skip variables that were declared inside the switch. + if (auto* lv = var->As(); + lv && lv->Statement()->FindFirstParent( + [&](auto* st) { return st == sem_switch; })) { + continue; + } + + // Add an edge from the variable exit node to its new value. + auto* exit_node = + utils::GetOrCreate(info.var_exit_nodes, var, [&]() { + auto name = + builder_->Symbols().NameFor(var->Declaration()->symbol); + return CreateNode(name + "_value_" + info.type + "_exit"); + }); + exit_node->AddEdge(current_function_->variables.Get(var)); + } + } + current_function_->variables.Pop(); + } + previous_case_has_fallthrough = has_fallthrough; + } + + // Update nodes for any variables assigned in the switch statement. + for (auto var : info.var_exit_nodes) { + current_function_->variables.Set(var.first, var.second); + } + + return cf_end ? cf_end : cf; + }, + + [&](const ast::VariableDeclStatement* decl) { + Node* node; + if (decl->variable->constructor) { + auto [cf1, v] = ProcessExpression(cf, decl->variable->constructor); + cf = cf1; + node = v; + } else { + node = cf; + } + current_function_->variables.Set(sem_.Get(decl->variable), node); + + if (decl->variable->Is()) { + current_function_->local_var_decls.insert( + sem_.Get(decl->variable)); + } + + return cf; + }, + + [&](const ast::StaticAssert*) { + return cf; // No impact on uniformity + }, + + [&](Default) { + TINT_ICE(Resolver, diagnostics_) + << "unknown statement type: " << std::string(stmt->TypeInfo().name); + return nullptr; + }); + } + + /// Process an identifier expression. + /// @param cf the input control flow node + /// @param ident the identifier expression to process + /// @returns a pair of (control flow node, value node) + std::pair ProcessIdentExpression(Node* cf, + const ast::IdentifierExpression* ident) { + // Helper to check if the entry point attribute of `obj` indicates non-uniformity. + auto has_nonuniform_entry_point_attribute = [](auto* obj) { + // Only the num_workgroups and workgroup_id builtins are uniform. + if (auto* builtin = ast::GetAttribute(obj->attributes)) { + if (builtin->builtin == ast::BuiltinValue::kNumWorkgroups || + builtin->builtin == ast::BuiltinValue::kWorkgroupId) { + return false; + } + } + return true; + }; + + auto name = builder_->Symbols().NameFor(ident->symbol); + auto* sem = sem_.Get(ident)->UnwrapMaterialize()->As()->Variable(); + auto* node = CreateNode(name + "_ident_expr", ident); + return Switch( + sem, + + [&](const sem::Parameter* param) { + auto* user_func = param->Owner()->As(); + if (user_func && user_func->Declaration()->IsEntryPoint()) { + if (auto* str = param->Type()->As()) { + // We consider the whole struct to be non-uniform if any one of its members + // is non-uniform. + bool uniform = true; + for (auto* member : str->Members()) { + if (has_nonuniform_entry_point_attribute(member->Declaration())) { + uniform = false; + } + } + node->AddEdge(uniform ? cf : current_function_->may_be_non_uniform); + return std::make_pair(cf, node); + } else { + if (has_nonuniform_entry_point_attribute(param->Declaration())) { + node->AddEdge(current_function_->may_be_non_uniform); + } else { + node->AddEdge(cf); + } + return std::make_pair(cf, node); + } + } else { + auto* x = current_function_->variables.Get(param); + node->AddEdge(cf); + node->AddEdge(x); + return std::make_pair(cf, node); + } + }, + + [&](const sem::GlobalVariable* global) { + if (!global->Declaration()->Is() || + global->Access() == ast::Access::kRead) { + node->AddEdge(cf); + } else { + node->AddEdge(current_function_->may_be_non_uniform); + } + return std::make_pair(cf, node); + }, + + [&](const sem::LocalVariable* local) { + node->AddEdge(cf); + if (auto* x = current_function_->variables.Get(local)) { + node->AddEdge(x); + } + return std::make_pair(cf, node); + }, + + [&](Default) { + TINT_ICE(Resolver, diagnostics_) + << "unknown identifier expression type: " << std::string(sem->TypeInfo().name); + return std::pair(nullptr, nullptr); + }); + } + + /// Process an expression. + /// @param cf the input control flow node + /// @param expr the expression to process + /// @returns a pair of (control flow node, value node) + std::pair ProcessExpression(Node* cf, const ast::Expression* expr) { + return Switch( + expr, + + [&](const ast::BinaryExpression* b) { + if (b->IsLogical()) { + // Short-circuiting binary operators are a special case. + auto [cf1, v1] = ProcessExpression(cf, b->lhs); + + // Add a diagnostic node to capture the control flow change. + auto* v1_cf = current_function_->CreateNode("short_circuit_op", b); + v1_cf->affects_control_flow = true; + v1_cf->AddEdge(v1); + + auto [cf2, v2] = ProcessExpression(v1_cf, b->rhs); + + if (sem_.Get(b)->Behaviors() == sem::Behaviors{sem::Behavior::kNext}) { + return std::pair(cf, v2); + } + return std::pair(cf2, v2); + } else { + auto [cf1, v1] = ProcessExpression(cf, b->lhs); + auto [cf2, v2] = ProcessExpression(cf1, b->rhs); + auto* result = CreateNode("binary_expr_result"); + result->AddEdge(v1); + result->AddEdge(v2); + return std::pair(cf2, result); + } + }, + + [&](const ast::BitcastExpression* b) { return ProcessExpression(cf, b->expr); }, + + [&](const ast::CallExpression* c) { return ProcessCall(cf, c); }, + + [&](const ast::IdentifierExpression* i) { return ProcessIdentExpression(cf, i); }, + + [&](const ast::IndexAccessorExpression* i) { + auto [cf1, v1] = ProcessExpression(cf, i->object); + auto [cf2, v2] = ProcessExpression(cf1, i->index); + auto* result = CreateNode("index_accessor_result"); + result->AddEdge(v1); + result->AddEdge(v2); + return std::pair(cf2, result); + }, + + [&](const ast::LiteralExpression*) { return std::make_pair(cf, cf); }, + + [&](const ast::MemberAccessorExpression* m) { + return ProcessExpression(cf, m->structure); + }, + + [&](const ast::UnaryOpExpression* u) { + if (u->op == ast::UnaryOp::kIndirection) { + // Cut the analysis short, since we only need to know the originating variable + // which is being accessed. + auto* source_var = sem_.Get(u)->SourceVariable(); + auto* value = current_function_->variables.Get(source_var); + if (!value) { + value = cf; + } + return std::pair(cf, value); + } + return ProcessExpression(cf, u->expr); + }, + + [&](Default) { + TINT_ICE(Resolver, diagnostics_) + << "unknown expression type: " << std::string(expr->TypeInfo().name); + return std::pair(nullptr, nullptr); + }); + } + + /// Process an LValue expression. + /// @param cf the input control flow node + /// @param expr the expression to process + /// @returns a pair of (control flow node, variable node) + std::pair ProcessLValueExpression(Node* cf, const ast::Expression* expr) { + return Switch( + expr, + + [&](const ast::IdentifierExpression* i) { + auto name = builder_->Symbols().NameFor(i->symbol); + auto* sem = sem_.Get(i); + if (sem->Variable()->Is()) { + return std::make_pair(cf, current_function_->may_be_non_uniform); + } else if (auto* local = sem->Variable()->As()) { + // Create a new value node for this variable. + auto* value = CreateNode(name + "_lvalue"); + auto* old_value = current_function_->variables.Set(local, value); + + // Aggregate values link back to their previous value, as they can never become + // uniform again. + if (!local->Type()->UnwrapRef()->is_scalar() && old_value) { + value->AddEdge(old_value); + } + + return std::make_pair(cf, value); + } else { + TINT_ICE(Resolver, diagnostics_) + << "unknown lvalue identifier expression type: " + << std::string(sem->Variable()->TypeInfo().name); + return std::pair(nullptr, nullptr); + } + }, + + [&](const ast::IndexAccessorExpression* i) { + auto [cf1, l1] = ProcessLValueExpression(cf, i->object); + auto [cf2, v2] = ProcessExpression(cf1, i->index); + l1->AddEdge(v2); + return std::pair(cf2, l1); + }, + + [&](const ast::MemberAccessorExpression* m) { + return ProcessLValueExpression(cf, m->structure); + }, + + [&](const ast::UnaryOpExpression* u) { + if (u->op == ast::UnaryOp::kIndirection) { + // Cut the analysis short, since we only need to know the originating variable + // that is being written to. + auto* source_var = sem_.Get(u)->SourceVariable(); + auto name = builder_->Symbols().NameFor(source_var->Declaration()->symbol); + auto* deref = CreateNode(name + "_deref"); + auto* old_value = current_function_->variables.Set(source_var, deref); + + // Aggregate values link back to their previous value, as they can never become + // uniform again. + if (!source_var->Type()->UnwrapRef()->UnwrapPtr()->is_scalar() && old_value) { + deref->AddEdge(old_value); + } + + return std::pair(cf, deref); + } + return ProcessLValueExpression(cf, u->expr); + }, + + [&](Default) { + TINT_ICE(Resolver, diagnostics_) + << "unknown lvalue expression type: " << std::string(expr->TypeInfo().name); + return std::pair(nullptr, nullptr); + }); + } + + /// Process a function call expression. + /// @param cf the input control flow node + /// @param call the function call to process + /// @returns a pair of (control flow node, value node) + std::pair ProcessCall(Node* cf, const ast::CallExpression* call) { + std::string name; + if (call->target.name) { + name = builder_->Symbols().NameFor(call->target.name->symbol); + } else { + name = call->target.type->FriendlyName(builder_->Symbols()); + } + + // Process call arguments + Node* cf_last_arg = cf; + std::vector args; + for (size_t i = 0; i < call->args.Length(); i++) { + auto [cf_i, arg_i] = ProcessExpression(cf_last_arg, call->args[i]); + + // Capture the index of this argument in a new node. + // Note: This is an additional node that isn't described in the specification, for the + // purpose of providing diagnostic information. + Node* arg_node = CreateNode(name + "_arg_" + std::to_string(i), call); + arg_node->type = Node::kFunctionCallArgument; + arg_node->arg_index = static_cast(i); + arg_node->AddEdge(arg_i); + + cf_last_arg = cf_i; + args.push_back(arg_node); + } + + // Note: This is an additional node that isn't described in the specification, for the + // purpose of providing diagnostic information. + Node* call_node = CreateNode(name + "_call", call); + call_node->AddEdge(cf_last_arg); + + Node* result = CreateNode(name + "_return_value", call); + result->type = Node::kFunctionCallReturnValue; + Node* cf_after = CreateNode("CF_after_" + name, call); + + // Get tags for the callee. + CallSiteTag callsite_tag = CallSiteNoRestriction; + FunctionTag function_tag = NoRestriction; + auto* sem = SemCall(call); + const FunctionInfo* func_info = nullptr; + Switch( + sem->Target(), + [&](const sem::Builtin* builtin) { + // Most builtins have no restrictions. The exceptions are barriers, derivatives, and + // some texture sampling builtins. + if (builtin->IsBarrier()) { + callsite_tag = CallSiteRequiredToBeUniform; + } else if (builtin->IsDerivative() || + builtin->Type() == sem::BuiltinType::kTextureSample || + builtin->Type() == sem::BuiltinType::kTextureSampleBias || + builtin->Type() == sem::BuiltinType::kTextureSampleCompare) { + callsite_tag = CallSiteRequiredToBeUniform; + function_tag = ReturnValueMayBeNonUniform; + } else { + callsite_tag = CallSiteNoRestriction; + function_tag = NoRestriction; + } + }, + [&](const sem::Function* func) { + // We must have already analyzed the user-defined function since we process + // functions in dependency order. + TINT_ASSERT(Resolver, functions_.count(func->Declaration())); + auto& info = functions_.at(func->Declaration()); + callsite_tag = info.callsite_tag; + function_tag = info.function_tag; + func_info = &info; + }, + [&](const sem::TypeConstructor*) { + callsite_tag = CallSiteNoRestriction; + function_tag = NoRestriction; + }, + [&](const sem::TypeConversion*) { + callsite_tag = CallSiteNoRestriction; + function_tag = NoRestriction; + }, + [&](Default) { + TINT_ICE(Resolver, diagnostics_) << "unhandled function call target: " << name; + }); + + if (callsite_tag == CallSiteRequiredToBeUniform) { + current_function_->required_to_be_uniform->AddEdge(call_node); + } + cf_after->AddEdge(call_node); + + if (function_tag == SubsequentControlFlowMayBeNonUniform) { + cf_after->AddEdge(current_function_->may_be_non_uniform); + cf_after->affects_control_flow = true; + } else if (function_tag == ReturnValueMayBeNonUniform) { + result->AddEdge(current_function_->may_be_non_uniform); + } + + result->AddEdge(cf_after); + + // For each argument, add edges based on parameter tags. + for (size_t i = 0; i < args.size(); i++) { + if (func_info) { + switch (func_info->parameters[i].tag) { + case ParameterRequiredToBeUniform: + current_function_->required_to_be_uniform->AddEdge(args[i]); + break; + case ParameterRequiredToBeUniformForSubsequentControlFlow: + cf_after->AddEdge(args[i]); + args[i]->affects_control_flow = true; + break; + case ParameterRequiredToBeUniformForReturnValue: + result->AddEdge(args[i]); + break; + case ParameterNoRestriction: + break; + } + + auto* sem_arg = sem_.Get(call->args[i]); + if (sem_arg->Type()->Is()) { + auto* ptr_result = + CreateNode(name + "_ptrarg_" + std::to_string(i) + "_result", call); + ptr_result->type = Node::kFunctionCallPointerArgumentResult; + ptr_result->arg_index = static_cast(i); + if (func_info->parameters[i].pointer_may_become_non_uniform) { + ptr_result->AddEdge(current_function_->may_be_non_uniform); + } else { + // Add edge to the call to catch when it's called in non-uniform control + // flow. + ptr_result->AddEdge(call_node); + + // Add edges from the resulting pointer value to any other arguments that + // feed it. + for (auto* source : func_info->parameters[i].pointer_param_output_sources) { + ptr_result->AddEdge(args[source->Index()]); + } + } + + // Update the current stored value for this pointer argument. + auto* source_var = sem_arg->SourceVariable(); + TINT_ASSERT(Resolver, source_var); + current_function_->variables.Set(source_var, ptr_result); + } + } else { + // All builtin function parameters are RequiredToBeUniformForReturnValue, as are + // parameters for type constructors and type conversions. + // The arrayLength() builtin is a special case, as there is currently no way for it + // to have a non-uniform return value. + auto* builtin = sem->Target()->As(); + if (!builtin || builtin->Type() != sem::BuiltinType::kArrayLength) { + result->AddEdge(args[i]); + } + } + } + + return {cf_after, result}; + } + + /// Traverse a graph starting at `source`, inserting all visited nodes into `reachable` and + /// recording which node they were reached from. + /// @param source the starting node + /// @param reachable the set of reachable nodes to populate, if required + void Traverse(Node* source, utils::UniqueVector* reachable = nullptr) { + std::vector to_visit{source}; + + while (!to_visit.empty()) { + auto* node = to_visit.back(); + to_visit.pop_back(); + + if (reachable) { + reachable->Add(node); + } + for (auto* to : node->edges) { + if (to->visited_from == nullptr) { + to->visited_from = node; + to_visit.push_back(to); + } + } + } + } + + /// Trace back along a path from `start` until finding a node that matches a predicate. + /// @param start the starting node + /// @param pred the predicate function + /// @returns the first node found that matches the predicate, or nullptr + template + Node* TraceBackAlongPathUntil(Node* start, F&& pred) { + auto* current = start; + while (current) { + if (pred(current)) { + break; + } + current = current->visited_from; + } + return current; + } + + /// Recursively descend through the function called by `call` and the functions that it calls in + /// order to find a call to a builtin function that requires uniformity. + const ast::CallExpression* FindBuiltinThatRequiresUniformity(const ast::CallExpression* call) { + auto* target = SemCall(call)->Target(); + if (target->Is()) { + // This is a call to a builtin, so we must be done. + return call; + } else if (auto* user = target->As()) { + // This is a call to a user-defined function, so inspect the functions called by that + // function and look for one whose node has an edge from the RequiredToBeUniform node. + auto& target_info = functions_.at(user->Declaration()); + for (auto* call_node : target_info.required_to_be_uniform->edges) { + if (call_node->type == Node::kRegular) { + auto* child_call = call_node->ast->As(); + return FindBuiltinThatRequiresUniformity(child_call); + } + } + TINT_ASSERT(Resolver, false && "unable to find child call with uniformity requirement"); + } else { + TINT_ASSERT(Resolver, false && "unexpected call expression type"); + } + return nullptr; + } + + /// Add diagnostic notes to show where control flow became non-uniform on the way to a node. + /// @param function the function being analyzed + /// @param required_to_be_uniform the node to traverse from + /// @param may_be_non_uniform the node to traverse to + void ShowCauseOfNonUniformity(FunctionInfo& function, + Node* required_to_be_uniform, + Node* may_be_non_uniform) { + // Traverse the graph to generate a path from the node to the source of non-uniformity. + function.ResetVisited(); + Traverse(required_to_be_uniform); + + // Get the source of the non-uniform value. + auto* non_uniform_source = may_be_non_uniform->visited_from; + TINT_ASSERT(Resolver, non_uniform_source); + + // Show where the non-uniform value results in non-uniform control flow. + auto* control_flow = TraceBackAlongPathUntil( + non_uniform_source, [](Node* node) { return node->affects_control_flow; }); + if (control_flow) { + if (auto* call = control_flow->ast->As()) { + if (control_flow->type == Node::kFunctionCallArgument) { + auto idx = control_flow->arg_index; + diagnostics_.add_note(diag::System::Resolver, + "non-uniform function call argument causes subsequent " + "control flow to be non-uniform", + call->args[idx]->source); + + // Recurse into the target function. + if (auto* user = SemCall(call)->Target()->As()) { + auto& callee = functions_.at(user->Declaration()); + ShowCauseOfNonUniformity(callee, callee.cf_return, + callee.parameters[idx].init_value); + } + } + } else { + diagnostics_.add_note(diag::System::Resolver, + "control flow depends on non-uniform value", + control_flow->ast->source); + } + // TODO(jrprice): There are cases where the function with uniformity requirements is not + // actually inside this control flow construct, for example: + // - A conditional interrupt (e.g. break), with a barrier elsewhere in the loop + // - A conditional assignment to a variable, which is later used to guard a barrier + // In these cases, the diagnostics are not entirely accurate as they may not highlight + // the actual cause of divergence. + } + + // Show the source of the non-uniform value. + Switch( + non_uniform_source->ast, + [&](const ast::IdentifierExpression* ident) { + std::string var_type = ""; + auto* var = sem_.Get(ident)->Variable(); + switch (var->StorageClass()) { + case ast::StorageClass::kStorage: + var_type = "read_write storage buffer "; + break; + case ast::StorageClass::kWorkgroup: + var_type = "workgroup storage variable "; + break; + case ast::StorageClass::kPrivate: + var_type = "module-scope private variable "; + break; + default: + if (ast::HasAttribute( + var->Declaration()->attributes)) { + var_type = "builtin "; + } else if (ast::HasAttribute( + var->Declaration()->attributes)) { + var_type = "user-defined input "; + } else { + // TODO(jrprice): Provide more info for this case. + } + break; + } + diagnostics_.add_note(diag::System::Resolver, + "reading from " + var_type + "'" + + builder_->Symbols().NameFor(ident->symbol) + + "' may result in a non-uniform value", + ident->source); + }, + [&](const ast::CallExpression* c) { + auto target_name = builder_->Symbols().NameFor( + c->target.name->As()->symbol); + switch (non_uniform_source->type) { + case Node::kRegular: { + diagnostics_.add_note( + diag::System::Resolver, + "calling '" + target_name + + "' may cause subsequent control flow to be non-uniform", + c->source); + + // Recurse into the target function. + if (auto* user = SemCall(c)->Target()->As()) { + auto& callee = functions_.at(user->Declaration()); + ShowCauseOfNonUniformity(callee, callee.cf_return, + callee.may_be_non_uniform); + } + break; + } + case Node::kFunctionCallReturnValue: { + diagnostics_.add_note( + diag::System::Resolver, + "return value of '" + target_name + "' may be non-uniform", c->source); + break; + } + case Node::kFunctionCallPointerArgumentResult: { + diagnostics_.add_note( + diag::System::Resolver, + "pointer contents may become non-uniform after calling '" + + target_name + "'", + c->args[non_uniform_source->arg_index]->source); + break; + } + default: { + TINT_ICE(Resolver, diagnostics_) << "unhandled source of non-uniformity"; + break; + } + } + }, + [&](Default) { + TINT_ICE(Resolver, diagnostics_) << "unhandled source of non-uniformity"; + }); + } + + /// Generate an error message for a uniformity issue. + /// @param function the function that the diagnostic is being produced for + /// @param source_node the node that has caused a uniformity issue in `function` + /// @param note `true` if the diagnostic should be emitted as a note + void MakeError(FunctionInfo& function, Node* source_node, bool note = false) { + // Helper to produce a diagnostic message with the severity required by this invocation of + // the `MakeError` function. + auto report = [&](Source source, std::string msg) { + // TODO(jrprice): Switch to error instead of warning when feedback has settled. + diag::Diagnostic error{}; + error.severity = note ? diag::Severity::Note : diag::Severity::Warning; + error.system = diag::System::Resolver; + error.source = source; + error.message = msg; + diagnostics_.add(std::move(error)); + }; + + // Traverse the graph to generate a path from RequiredToBeUniform to the source node. + function.ResetVisited(); + Traverse(function.required_to_be_uniform); + TINT_ASSERT(Resolver, source_node->visited_from); + + // Find a node that is required to be uniform that has a path to the source node. + auto* cause = TraceBackAlongPathUntil(source_node, [&](Node* node) { + return node->visited_from == function.required_to_be_uniform; + }); + + // The node will always have a corresponding call expression. + auto* call = cause->ast->As(); + TINT_ASSERT(Resolver, call); + auto* target = SemCall(call)->Target(); + + std::string func_name; + if (auto* builtin = target->As()) { + func_name = builtin->str(); + } else if (auto* user = target->As()) { + func_name = builder_->Symbols().NameFor(user->Declaration()->symbol); + } + + if (cause->type == Node::kFunctionCallArgument) { + // The requirement was on a function parameter. + auto param_name = builder_->Symbols().NameFor( + target->Parameters()[cause->arg_index]->Declaration()->symbol); + report(call->args[cause->arg_index]->source, + "parameter '" + param_name + "' of '" + func_name + "' must be uniform"); + + // If this is a call to a user-defined function, add a note to show the reason that the + // parameter is required to be uniform. + if (auto* user = target->As()) { + auto& next_function = functions_.at(user->Declaration()); + Node* next_cause = next_function.parameters[cause->arg_index].init_value; + MakeError(next_function, next_cause, true); + } + } else { + // The requirement was on a function callsite. + report(call->source, + "'" + func_name + "' must only be called from uniform control flow"); + + // If this is a call to a user-defined function, add a note to show the builtin that + // causes the uniformity requirement. + auto* innermost_call = FindBuiltinThatRequiresUniformity(call); + if (innermost_call != call) { + auto* sem_call = SemCall(call); + auto* sem_innermost_call = SemCall(innermost_call); + + // Determine whether the builtin is being called directly or indirectly. + bool indirect = false; + if (sem_call->Target()->As() != + sem_innermost_call->Stmt()->Function()) { + indirect = true; + } + + auto* builtin = sem_innermost_call->Target()->As(); + diagnostics_.add_note(diag::System::Resolver, + "'" + func_name + "' requires uniformity because it " + + (indirect ? "indirectly " : "") + "calls " + + builtin->str(), + innermost_call->source); + } + } + + // Show the cause of non-uniformity (starting at the top-level error). + if (!note) { + ShowCauseOfNonUniformity(function, function.required_to_be_uniform, + function.may_be_non_uniform); + } + } + + // Helper for obtaining the sem::Call node for the ast::CallExpression + const sem::Call* SemCall(const ast::CallExpression* expr) const { + return sem_.Get(expr)->UnwrapMaterialize()->As(); + } +}; + +} // namespace + +bool AnalyzeUniformity(ProgramBuilder* builder, const DependencyGraph& dependency_graph) { + UniformityGraph graph(builder); + return graph.Build(dependency_graph); +} + +} // namespace tint::resolver diff --git a/src/tint/resolver/uniformity.h b/src/tint/resolver/uniformity.h new file mode 100644 index 0000000000..39827cf520 --- /dev/null +++ b/src/tint/resolver/uniformity.h @@ -0,0 +1,36 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_RESOLVER_UNIFORMITY_H_ +#define SRC_TINT_RESOLVER_UNIFORMITY_H_ + +// Forward declarations. +namespace tint { +namespace resolver { +struct DependencyGraph; +} // namespace resolver +class ProgramBuilder; +} // namespace tint + +namespace tint::resolver { + +/// Analyze the uniformity of a program. +/// @param builder the program to analyze +/// @param dependency_graph the dependency-ordered module-scope declarations +/// @returns true if there are no uniformity issues, false otherwise +bool AnalyzeUniformity(ProgramBuilder* builder, const resolver::DependencyGraph& dependency_graph); + +} // namespace tint::resolver + +#endif // SRC_TINT_RESOLVER_UNIFORMITY_H_ diff --git a/src/tint/resolver/uniformity_test.cc b/src/tint/resolver/uniformity_test.cc new file mode 100644 index 0000000000..e2e2796789 --- /dev/null +++ b/src/tint/resolver/uniformity_test.cc @@ -0,0 +1,6842 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include + +#include "src/tint/program_builder.h" +#include "src/tint/reader/wgsl/parser.h" +#include "src/tint/resolver/uniformity.h" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::resolver { +namespace { + +class UniformityAnalysisTestBase { + protected: + /// Parse and resolve a WGSL shader. + /// @param src the WGSL source code + /// @param should_pass true if `src` should pass the analysis, otherwise false + void RunTest(std::string src, bool should_pass) { + auto file = std::make_unique("test", src); + auto program = reader::wgsl::Parse(file.get()); + + diag::Formatter::Style style; + style.print_newline_at_end = false; + error_ = diag::Formatter(style).format(program.Diagnostics()); + + bool valid = program.IsValid(); + if (should_pass) { + EXPECT_TRUE(valid) << error_; + if (program.Diagnostics().count() == 1u) { + EXPECT_THAT(program.Diagnostics().str(), ::testing::HasSubstr("unreachable")); + } else { + EXPECT_EQ(program.Diagnostics().count(), 0u) << error_; + } + } else { + // TODO(jrprice): expect false when uniformity issues become errors. + EXPECT_TRUE(valid) << error_; + } + } + + /// Build and resolve a program from a ProgramBuilder object. + /// @param builder the program builder + /// @returns true on success, false on failure + bool RunTest(ProgramBuilder&& builder) { + auto program = Program(std::move(builder)); + + diag::Formatter::Style style; + style.print_newline_at_end = false; + error_ = diag::Formatter(style).format(program.Diagnostics()); + + return program.IsValid(); + } + + /// The error message from the parser or resolver, if any. + std::string error_; +}; + +class UniformityAnalysisTest : public UniformityAnalysisTestBase, public ::testing::Test {}; + +class BasicTest : public UniformityAnalysisTestBase, + public ::testing::TestWithParam> { + public: + /// Enum for the if-statement condition guarding a function call. + enum Condition { + // Uniform conditions: + kTrue, + kFalse, + kLiteral, + kModuleConst, + kPipelineOverridable, + kFuncLetUniformRhs, + kFuncVarUniform, + kFuncUniformRetVal, + kUniformBuffer, + kROStorageBuffer, + kLastUniformCondition = kROStorageBuffer, + // MayBeNonUniform conditions: + kFuncLetNonUniformRhs, + kFuncVarNonUniform, + kFuncNonUniformRetVal, + kRWStorageBuffer, + // End of range marker: + kEndOfConditionRange, + }; + + /// Enum for the function call statement. + enum Function { + // NoRestrictionFunctions: + kUserNoRestriction, + kMin, + kTextureSampleLevel, + kLastNoRestrictionFunction = kTextureSampleLevel, + // RequiredToBeUniform functions: + kUserRequiredToBeUniform, + kWorkgroupBarrier, + kStorageBarrier, + kTextureSample, + kTextureSampleBias, + kTextureSampleCompare, + kDpdx, + kDpdxCoarse, + kDpdxFine, + kDpdy, + kDpdyCoarse, + kDpdyFine, + kFwidth, + kFwidthCoarse, + kFwidthFine, + // End of range marker: + kEndOfFunctionRange, + }; + + /// Convert a condition to its string representation. + static std::string ConditionToStr(Condition c) { + switch (c) { + case kTrue: + return "true"; + case kFalse: + return "false"; + case kLiteral: + return "7 == 7"; + case kModuleConst: + return "module_const == 0"; + case kPipelineOverridable: + return "pipeline_overridable == 0"; + case kFuncLetUniformRhs: + return "let_uniform_rhs == 0"; + case kFuncVarUniform: + return "func_uniform == 0"; + case kFuncUniformRetVal: + return "func_uniform_retval() == 0"; + case kUniformBuffer: + return "u == 0"; + case kROStorageBuffer: + return "ro == 0"; + case kFuncLetNonUniformRhs: + return "let_nonuniform_rhs == 0"; + case kFuncVarNonUniform: + return "func_non_uniform == 0"; + case kFuncNonUniformRetVal: + return "func_nonuniform_retval() == 0"; + case kRWStorageBuffer: + return "rw == 0"; + case kEndOfConditionRange: + return ""; + } + return ""; + } + + /// Convert a function call to its string representation. + static std::string FunctionToStr(Function f) { + switch (f) { + case kUserNoRestriction: + return "user_no_restriction()"; + case kMin: + return "min(1, 1)"; + case kTextureSampleLevel: + return "textureSampleLevel(t, s, vec2(0.5, 0.5), 0.0)"; + case kUserRequiredToBeUniform: + return "user_required_to_be_uniform()"; + case kWorkgroupBarrier: + return "workgroupBarrier()"; + case kStorageBarrier: + return "storageBarrier()"; + case kTextureSample: + return "textureSample(t, s, vec2(0.5, 0.5))"; + case kTextureSampleBias: + return "textureSampleBias(t, s, vec2(0.5, 0.5), 2.0)"; + case kTextureSampleCompare: + return "textureSampleCompare(td, sc, vec2(0.5, 0.5), 0.5)"; + case kDpdx: + return "dpdx(1.0)"; + case kDpdxCoarse: + return "dpdxCoarse(1.0)"; + case kDpdxFine: + return "dpdxFine(1.0)"; + case kDpdy: + return "dpdy(1.0)"; + case kDpdyCoarse: + return "dpdyCoarse(1.0)"; + case kDpdyFine: + return "dpdyFine(1.0)"; + case kFwidth: + return "fwidth(1.0)"; + case kFwidthCoarse: + return "fwidthCoarse(1.0)"; + case kFwidthFine: + return "fwidthFine(1.0)"; + case kEndOfFunctionRange: + return ""; + } + return ""; + } + + /// @returns true if `c` is a condition that may be non-uniform. + static bool MayBeNonUniform(Condition c) { return c > kLastUniformCondition; } + + /// @returns true if `f` is a function call that is required to be uniform. + static bool RequiredToBeUniform(Function f) { return f > kLastNoRestrictionFunction; } + + /// Convert a test parameter pair of condition+function to a string that can be used as part of + /// a test name. + static std::string ParamsToName(::testing::TestParamInfo params) { + Condition c = static_cast(std::get<0>(params.param)); + Function f = static_cast(std::get<1>(params.param)); + std::string name; +#define CASE(c) \ + case c: \ + name += #c; \ + break + + switch (c) { + CASE(kTrue); + CASE(kFalse); + CASE(kLiteral); + CASE(kModuleConst); + CASE(kPipelineOverridable); + CASE(kFuncLetUniformRhs); + CASE(kFuncVarUniform); + CASE(kFuncUniformRetVal); + CASE(kUniformBuffer); + CASE(kROStorageBuffer); + CASE(kFuncLetNonUniformRhs); + CASE(kFuncVarNonUniform); + CASE(kFuncNonUniformRetVal); + CASE(kRWStorageBuffer); + case kEndOfConditionRange: + break; + } + name += "_"; + switch (f) { + CASE(kUserNoRestriction); + CASE(kMin); + CASE(kTextureSampleLevel); + CASE(kUserRequiredToBeUniform); + CASE(kWorkgroupBarrier); + CASE(kStorageBarrier); + CASE(kTextureSample); + CASE(kTextureSampleBias); + CASE(kTextureSampleCompare); + CASE(kDpdx); + CASE(kDpdxCoarse); + CASE(kDpdxFine); + CASE(kDpdy); + CASE(kDpdyCoarse); + CASE(kDpdyFine); + CASE(kFwidth); + CASE(kFwidthCoarse); + CASE(kFwidthFine); + case kEndOfFunctionRange: + break; + } +#undef CASE + + return name; + } +}; + +// Test the uniformity constraints for a function call inside a conditional statement. +TEST_P(BasicTest, ConditionalFunctionCall) { + auto condition = static_cast(std::get<0>(GetParam())); + auto function = static_cast(std::get<1>(GetParam())); + std::string src = R"( +var p : i32; +var w : i32; +@group(0) @binding(0) var u : i32; +@group(0) @binding(0) var ro : i32; +@group(0) @binding(0) var rw : i32; + +@group(1) @binding(0) var t : texture_2d; +@group(1) @binding(1) var td : texture_depth_2d; +@group(1) @binding(2) var s : sampler; +@group(1) @binding(3) var sc : sampler_comparison; + +const module_const : i32 = 42; +@id(42) override pipeline_overridable : i32; + +fn user_no_restriction() {} +fn user_required_to_be_uniform() { workgroupBarrier(); } + +fn func_uniform_retval() -> i32 { return u; } +fn func_nonuniform_retval() -> i32 { return rw; } + +fn foo() { + let let_uniform_rhs = 7; + let let_nonuniform_rhs = rw; + + var func_uniform = 7; + var func_non_uniform = 7; + func_non_uniform = rw; + + if ()" + ConditionToStr(condition) + + R"() { + )" + FunctionToStr(function) + + R"(; + } +} +)"; + + bool should_pass = !(MayBeNonUniform(condition) && RequiredToBeUniform(function)); + RunTest(src, should_pass); + if (!should_pass) { + EXPECT_THAT(error_, ::testing::StartsWith("test:31:5 warning: ")); + EXPECT_THAT(error_, ::testing::HasSubstr("must only be called from uniform control flow")); + } +} + +INSTANTIATE_TEST_SUITE_P( + UniformityAnalysisTest, + BasicTest, + ::testing::Combine(::testing::Range(0, BasicTest::kEndOfConditionRange), + ::testing::Range(0, BasicTest::kEndOfFunctionRange)), + BasicTest::ParamsToName); + +//////////////////////////////////////////////////////////////////////////////// +/// Test specific function and parameter tags that are not tested above. +//////////////////////////////////////////////////////////////////////////////// + +TEST_F(UniformityAnalysisTest, SubsequentControlFlowMayBeNonUniform_Pass) { + // Call a function that causes subsequent control flow to be non-uniform, and then call another + // function that doesn't require uniformity. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +var p : i32; + +fn foo() { + if (rw == 0) { + p = 42; + return; + } + p = 5; + return; +} + +fn bar() { + if (p == 42) { + p = 7; + } +} + +fn main() { + foo(); + bar(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, SubsequentControlFlowMayBeNonUniform_Fail) { + // Call a function that causes subsequent control flow to be non-uniform, and then call another + // function that requires uniformity. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +var p : i32; + +fn foo() { + if (rw == 0) { + p = 42; + return; + } + p = 5; + return; +} + +fn main() { + foo(); + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:17:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:16:3 note: calling 'foo' may cause subsequent control flow to be non-uniform + foo(); + ^^^ + +test:7:3 note: control flow depends on non-uniform value + if (rw == 0) { + ^^ + +test:7:7 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + if (rw == 0) { + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, SubsequentControlFlowMayBeNonUniform_Nested_Fail) { + // Indirectly call a function that causes subsequent control flow to be non-uniform, and then + // call another function that requires uniformity. + // The lack of return statement in `foo()` requires that we implicitly add an edge from + // CF_return to that last control flow node of the function. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +var p : i32; + +fn bar() { + if (rw == 0) { + p = 42; + return; + } + p = 5; + return; +} + +fn foo() { + bar(); +} + +fn main() { + foo(); + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:21:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:20:3 note: calling 'foo' may cause subsequent control flow to be non-uniform + foo(); + ^^^ + +test:16:3 note: calling 'bar' may cause subsequent control flow to be non-uniform + bar(); + ^^^ + +test:7:3 note: control flow depends on non-uniform value + if (rw == 0) { + ^^ + +test:7:7 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + if (rw == 0) { + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ParameterNoRestriction_Pass) { + // Pass a non-uniform value as an argument, and then try to use the return value for + // control-flow guarding a barrier. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +var p : i32; + +fn foo(i : i32) -> i32 { + if (i == 0) { + // This assignment is non-uniform, but shouldn't affect the return value. + p = 42; + } + return 7; +} + +fn bar() { + let x = foo(rw); + if (x == 7) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniform_Pass) { + // Pass a uniform value as an argument to a function that uses that parameter for control-flow + // guarding a barrier. + std::string src = R"( +@group(0) @binding(0) var ro : i32; + +fn foo(i : i32) { + if (i == 0) { + workgroupBarrier(); + } +} + +fn bar() { + foo(ro); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniform_Fail) { + // Pass a non-uniform value as an argument to a function that uses that parameter for + // control-flow guarding a barrier. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo(i : i32) { + if (i == 0) { + workgroupBarrier(); + } +} + +fn bar() { + foo(rw); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:11:7 warning: parameter 'i' of 'foo' must be uniform + foo(rw); + ^^ + +test:6:5 note: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:7 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + foo(rw); + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniformForReturnValue_Pass) { + // Pass a uniform value as an argument to a function that uses that parameter to produce the + // return value, and then use the return value for control-flow guarding a barrier. + std::string src = R"( +@group(0) @binding(0) var ro : i32; + +fn foo(i : i32) -> i32 { + return 1 + i; +} + +fn bar() { + if (foo(ro) == 7) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniformForReturnValue_Fail) { + // Pass a non-uniform value as an argument to a function that uses that parameter to produce the + // return value, and then use the return value for control-flow guarding a barrier. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo(i : i32) -> i32 { + return 1 + i; +} + +fn bar() { + if (foo(rw) == 7) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:10:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:9:3 note: control flow depends on non-uniform value + if (foo(rw) == 7) { + ^^ + +test:9:11 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + if (foo(rw) == 7) { + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniformForSubsequentControlFlow_Pass) { + // Pass a uniform value as an argument to a function that uses that parameter return early, and + // then invoke a barrier after calling that function. + std::string src = R"( +@group(0) @binding(0) var ro : i32; + +var p : i32; + +fn foo(i : i32) { + if (i == 0) { + p = 42; + return; + } + p = 5; + return; +} + +fn bar() { + foo(ro); + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ParameterRequiredToBeUniformForSubsequentControlFlow_Fail) { + // Pass a non-uniform value as an argument to a function that uses that parameter return early, + // and then invoke a barrier after calling that function. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +var p : i32; + +fn foo(i : i32) { + if (i == 0) { + p = 42; + return; + } + p = 5; + return; +} + +fn bar() { + foo(rw); + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:17:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:16:7 note: non-uniform function call argument causes subsequent control flow to be non-uniform + foo(rw); + ^^ + +test:7:3 note: control flow depends on non-uniform value + if (i == 0) { + ^^ + +test:7:7 note: reading from 'i' may result in a non-uniform value + if (i == 0) { + ^ + +test:16:7 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + foo(rw); + ^^ +)"); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Test shader IO attributes. +//////////////////////////////////////////////////////////////////////////////// + +struct BuiltinEntry { + std::string name; + std::string type; + bool uniform; + BuiltinEntry(std::string n, std::string t, bool u) : name(n), type(t), uniform(u) {} +}; + +class ComputeBuiltin : public UniformityAnalysisTestBase, + public ::testing::TestWithParam {}; +TEST_P(ComputeBuiltin, AsParam) { + std::string src = R"( +@compute @workgroup_size(64) +fn main(@builtin()" + GetParam().name + + R"() b : )" + GetParam().type + R"() { + if (all(vec3(b) == vec3(0u))) { + workgroupBarrier(); + } +} +)"; + + bool should_pass = GetParam().uniform; + RunTest(src, should_pass); + if (!should_pass) { + EXPECT_EQ( + error_, + R"(test:5:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:4:3 note: control flow depends on non-uniform value + if (all(vec3(b) == vec3(0u))) { + ^^ + +test:4:16 note: reading from builtin 'b' may result in a non-uniform value + if (all(vec3(b) == vec3(0u))) { + ^ +)"); + } +} + +TEST_P(ComputeBuiltin, InStruct) { + std::string src = R"( +struct S { + @builtin()" + GetParam().name + + R"() b : )" + GetParam().type + R"( +} + +@compute @workgroup_size(64) +fn main(s : S) { + if (all(vec3(s.b) == vec3(0u))) { + workgroupBarrier(); + } +} +)"; + + bool should_pass = GetParam().uniform; + RunTest(src, should_pass); + if (!should_pass) { + EXPECT_EQ( + error_, + R"(test:9:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (all(vec3(s.b) == vec3(0u))) { + ^^ + +test:8:16 note: reading from 's' may result in a non-uniform value + if (all(vec3(s.b) == vec3(0u))) { + ^ +)"); + } +} + +INSTANTIATE_TEST_SUITE_P(UniformityAnalysisTest, + ComputeBuiltin, + ::testing::Values(BuiltinEntry{"local_invocation_id", "vec3", false}, + BuiltinEntry{"local_invocation_index", "u32", false}, + BuiltinEntry{"global_invocation_id", "vec3", false}, + BuiltinEntry{"workgroup_id", "vec3", true}, + BuiltinEntry{"num_workgroups", "vec3", true}), + [](const ::testing::TestParamInfo& p) { + return p.param.name; + }); + +TEST_F(UniformityAnalysisTest, ComputeBuiltin_MixedAttributesInStruct) { + // Mix both non-uniform and uniform shader IO attributes in the same structure. Even accessing + // just uniform member causes non-uniformity in this case. + std::string src = R"( +struct S { + @builtin(num_workgroups) num_groups : vec3, + @builtin(local_invocation_index) idx : u32, +} + +@compute @workgroup_size(64) +fn main(s : S) { + if (s.num_groups.x == 0u) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:10:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:9:3 note: control flow depends on non-uniform value + if (s.num_groups.x == 0u) { + ^^ + +test:9:7 note: reading from 's' may result in a non-uniform value + if (s.num_groups.x == 0u) { + ^ +)"); +} + +class FragmentBuiltin : public UniformityAnalysisTestBase, + public ::testing::TestWithParam {}; +TEST_P(FragmentBuiltin, AsParam) { + std::string src = R"( +@fragment +fn main(@builtin()" + GetParam().name + + R"() b : )" + GetParam().type + R"() { + if (u32(vec4(b).x) == 0u) { + dpdx(0.5); + } +} +)"; + + bool should_pass = GetParam().uniform; + RunTest(src, should_pass); + if (!should_pass) { + EXPECT_EQ(error_, + R"(test:5:5 warning: 'dpdx' must only be called from uniform control flow + dpdx(0.5); + ^^^^ + +test:4:3 note: control flow depends on non-uniform value + if (u32(vec4(b).x) == 0u) { + ^^ + +test:4:16 note: reading from builtin 'b' may result in a non-uniform value + if (u32(vec4(b).x) == 0u) { + ^ +)"); + } +} + +TEST_P(FragmentBuiltin, InStruct) { + std::string src = R"( +struct S { + @builtin()" + GetParam().name + + R"() b : )" + GetParam().type + R"( +} + +@fragment +fn main(s : S) { + if (u32(vec4(s.b).x) == 0u) { + dpdx(0.5); + } +} +)"; + + bool should_pass = GetParam().uniform; + RunTest(src, should_pass); + if (!should_pass) { + EXPECT_EQ(error_, + R"(test:9:5 warning: 'dpdx' must only be called from uniform control flow + dpdx(0.5); + ^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (u32(vec4(s.b).x) == 0u) { + ^^ + +test:8:16 note: reading from 's' may result in a non-uniform value + if (u32(vec4(s.b).x) == 0u) { + ^ +)"); + } +} + +INSTANTIATE_TEST_SUITE_P(UniformityAnalysisTest, + FragmentBuiltin, + ::testing::Values(BuiltinEntry{"position", "vec4", false}, + BuiltinEntry{"front_facing", "bool", false}, + BuiltinEntry{"sample_index", "u32", false}, + BuiltinEntry{"sample_mask", "u32", false}), + [](const ::testing::TestParamInfo& p) { + return p.param.name; + }); + +TEST_F(UniformityAnalysisTest, FragmentLocation) { + std::string src = R"( +@fragment +fn main(@location(0) l : f32) { + if (l == 0.0) { + dpdx(0.5); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:5:5 warning: 'dpdx' must only be called from uniform control flow + dpdx(0.5); + ^^^^ + +test:4:3 note: control flow depends on non-uniform value + if (l == 0.0) { + ^^ + +test:4:7 note: reading from user-defined input 'l' may result in a non-uniform value + if (l == 0.0) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, FragmentLocation_InStruct) { + std::string src = R"( +struct S { + @location(0) l : f32 +} + +@fragment +fn main(s : S) { + if (s.l == 0.0) { + dpdx(0.5); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:5 warning: 'dpdx' must only be called from uniform control flow + dpdx(0.5); + ^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (s.l == 0.0) { + ^^ + +test:8:7 note: reading from 's' may result in a non-uniform value + if (s.l == 0.0) { + ^ +)"); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Test loop conditions and conditional break/continue statements. +//////////////////////////////////////////////////////////////////////////////// + +namespace LoopTest { + +enum ControlFlowInterrupt { + kBreak, + kContinue, + kReturn, + kDiscard, +}; +enum Condition { + kNone, + kUniform, + kNonUniform, +}; + +using LoopTestParams = std::tuple; + +static std::string ToStr(ControlFlowInterrupt interrupt) { + switch (interrupt) { + case kBreak: + return "break"; + case kContinue: + return "continue"; + case kReturn: + return "return"; + case kDiscard: + return "discard"; + } + return ""; +} + +static std::string ToStr(Condition condition) { + switch (condition) { + case kNone: + return "uncondtiional"; + case kUniform: + return "uniform"; + case kNonUniform: + return "nonuniform"; + } + return ""; +} + +class LoopTest : public UniformityAnalysisTestBase, + public ::testing::TestWithParam { + protected: + std::string MakeInterrupt(ControlFlowInterrupt interrupt, Condition condition) { + switch (condition) { + case kNone: + return ToStr(interrupt); + case kUniform: + return "if (uniform_var == 42) { " + ToStr(interrupt) + "; }"; + case kNonUniform: + return "if (nonuniform_var == 42) { " + ToStr(interrupt) + "; }"; + } + return ""; + } +}; + +INSTANTIATE_TEST_SUITE_P(UniformityAnalysisTest, + LoopTest, + ::testing::Combine(::testing::Range(0, kDiscard + 1), + ::testing::Range(0, kNonUniform + 1)), + [](const ::testing::TestParamInfo& p) { + ControlFlowInterrupt interrupt = + static_cast(std::get<0>(p.param)); + auto condition = static_cast(std::get<1>(p.param)); + return ToStr(interrupt) + "_" + ToStr(condition); + }); + +TEST_P(LoopTest, CallInBody_InterruptAfter) { + // Test control-flow interrupt in a loop after a function call that requires uniform control + // flow. + auto interrupt = static_cast(std::get<0>(GetParam())); + auto condition = static_cast(std::get<1>(GetParam())); + std::string src = R"( +@group(0) @binding(0) var uniform_var : i32; +@group(0) @binding(0) var nonuniform_var : i32; + +fn foo() { + loop { + // Pretend that this isn't an infinite loop, in case the interrupt is a + // continue statement. + if (false) { + break; + } + + workgroupBarrier(); + )" + MakeInterrupt(interrupt, condition) + + R"(; + } +} +)"; + + if (condition == kNonUniform) { + RunTest(src, false); + EXPECT_THAT( + error_, + ::testing::StartsWith( + R"(test:13:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier();)")); + EXPECT_THAT(error_, + ::testing::HasSubstr("test:14:9 note: reading from read_write storage buffer " + "'nonuniform_var' may result in a non-uniform value")); + } else { + RunTest(src, true); + } +} + +TEST_P(LoopTest, CallInBody_InterruptBefore) { + // Test control-flow interrupt in a loop before a function call that requires uniform control + // flow. + auto interrupt = static_cast(std::get<0>(GetParam())); + auto condition = static_cast(std::get<1>(GetParam())); + std::string src = R"( +@group(0) @binding(0) var uniform_var : i32; +@group(0) @binding(0) var nonuniform_var : i32; + +fn foo() { + loop { + // Pretend that this isn't an infinite loop, in case the interrupt is a + // continue statement. + if (false) { + break; + } + + )" + MakeInterrupt(interrupt, condition) + + R"(; + workgroupBarrier(); + } +} +)"; + + if (condition == kNonUniform) { + RunTest(src, false); + + EXPECT_THAT( + error_, + ::testing::StartsWith( + R"(test:14:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier();)")); + EXPECT_THAT(error_, + ::testing::HasSubstr("test:13:9 note: reading from read_write storage buffer " + "'nonuniform_var' may result in a non-uniform value")); + } else { + RunTest(src, true); + } +} + +TEST_P(LoopTest, CallInContinuing_InterruptInBody) { + // Test control-flow interrupt in a loop with a function call that requires uniform control flow + // in the continuing statement. + auto interrupt = static_cast(std::get<0>(GetParam())); + auto condition = static_cast(std::get<1>(GetParam())); + std::string src = R"( +@group(0) @binding(0) var uniform_var : i32; +@group(0) @binding(0) var nonuniform_var : i32; + +fn foo() { + loop { + // Pretend that this isn't an infinite loop, in case the interrupt is a + // continue statement. + if (false) { + break; + } + + )" + MakeInterrupt(interrupt, condition) + + R"(; + continuing { + workgroupBarrier(); + } + } +} +)"; + + if (condition == kNonUniform) { + RunTest(src, false); + EXPECT_THAT( + error_, + ::testing::StartsWith( + R"(test:15:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier();)")); + EXPECT_THAT(error_, + ::testing::HasSubstr("test:13:9 note: reading from read_write storage buffer " + "'nonuniform_var' may result in a non-uniform value")); + } else { + RunTest(src, true); + } +} + +TEST_F(UniformityAnalysisTest, Loop_CallInBody_UniformBreakInContinuing) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + var i = 0; + loop { + workgroupBarrier(); + continuing { + i = i + 1; + if (i == n) { + break; + } + } + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_CallInBody_NonUniformBreakInContinuing) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + var i = 0; + loop { + workgroupBarrier(); + continuing { + i = i + 1; + if (i == n) { + break; + } + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:7:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:10:7 note: control flow depends on non-uniform value + if (i == n) { + ^^ + +test:10:16 note: reading from read_write storage buffer 'n' may result in a non-uniform value + if (i == n) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, Loop_CallInContinuing_UniformBreakInContinuing) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + var i = 0; + loop { + continuing { + workgroupBarrier(); + i = i + 1; + if (i == n) { + break; + } + } + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_CallInContinuing_NonUniformBreakInContinuing) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + var i = 0; + loop { + continuing { + workgroupBarrier(); + i = i + 1; + if (i == n) { + break; + } + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:10:7 note: control flow depends on non-uniform value + if (i == n) { + ^^ + +test:10:16 note: reading from read_write storage buffer 'n' may result in a non-uniform value + if (i == n) { + ^ +)"); +} + +class LoopDeadCodeTest : public UniformityAnalysisTestBase, public ::testing::TestWithParam {}; + +INSTANTIATE_TEST_SUITE_P(UniformityAnalysisTest, + LoopDeadCodeTest, + ::testing::Range(0, kDiscard + 1), + [](const ::testing::TestParamInfo& p) { + return ToStr(static_cast(p.param)); + }); + +TEST_P(LoopDeadCodeTest, AfterInterrupt) { + // Dead code after a control-flow interrupt in a loop shouldn't cause uniformity errors. + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + loop { + )" + ToStr(static_cast(GetParam())) + + R"(; + if (n == 42) { + workgroupBarrier(); + } + continuing { + // Pretend that this isn't an infinite loop, in case the interrupt is a + // continue statement. + if (false) { + break; + } + } + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformInLoopAfterBarrier) { + // Use a variable for a conditional barrier in a loop, and then assign a non-uniform value to + // that variable later in that loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:12:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformInLoopAfterBarrier_BreakAtEnd) { + // Use a variable for a conditional barrier in a loop, and then assign a non-uniform value to + // that variable later in that loop. End the loop with a break statement to prevent the + // non-uniform value from causing an issue. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (v == 0) { + workgroupBarrier(); + } + + v = non_uniform; + break; + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_ConditionalAssignNonUniformWithBreak_BarrierInLoop) { + // In a conditional block, assign a non-uniform value and then break, then use a variable for a + // conditional barrier later in the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (true) { + v = non_uniform; + break; + } + if (v == 0) { + workgroupBarrier(); + } + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_ConditionalAssignNonUniformWithConditionalBreak_BarrierInLoop) { + // In a conditional block, assign a non-uniform value and then conditionally break, then use a + // variable for a conditional barrier later in the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (true) { + v = non_uniform; + if (true) { + break; + } + } + if (v == 0) { + workgroupBarrier(); + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:14:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:8:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Loop_ConditionalAssignNonUniformWithBreak_BarrierAfterLoop) { + // In a conditional block, assign a non-uniform value and then break, then use a variable for a + // conditional barrier after the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (true) { + v = non_uniform; + break; + } + v = 5; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:14:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:8:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Loop_VarBecomesUniformBeforeSomeExits_BarrierAfterLoop) { + // Assign a non-uniform value, have two exit points only one of which assigns a uniform value, + // then use a variable for a conditional barrier after the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (true) { + break; + } + + v = non_uniform; + + if (false) { + v = 6; + break; + } + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:20:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:19:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:11:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Loop_VarBecomesUniformBeforeAllExits_BarrierAfterLoop) { + // Assign a non-uniform value, have two exit points both of which assigns a uniform value, + // then use a variable for a conditional barrier after the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (true) { + v = 5; + break; + } + + v = non_uniform; + + if (false) { + v = 6; + break; + } + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_AssignNonUniformBeforeConditionalBreak_BarrierAfterLoop) { + // Assign a non-uniform value and then break in a conditional block, then use a variable for a + // conditional barrier after the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + v = non_uniform; + if (true) { + if (false) { + v = 5; + } else { + break; + } + v = 5; + } + v = 5; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:20:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:19:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:7:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformBeforeConditionalContinue_BarrierAtStart) { + // Use a variable for a conditional barrier in a loop, assign a non-uniform value to + // that variable later in that loop, then perform a conditional continue before assigning a + // uniform value to that variable. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + if (true) { + continue; + } + + v = 5; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:12:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, + Loop_VarBecomesUniformBeforeConditionalContinue_BarrierInContinuing) { + // Use a variable for a conditional barrier in the continuing statement of a loop, assign a + // non-uniform value to that variable later in that loop, then conditionally assign a uniform + // value before continuing. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + v = non_uniform; + + if (false) { + v = 5; + continue; + } + + continuing { + if (v == 0) { + workgroupBarrier(); + } + if (true) { + break; + } + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:16:9 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:15:7 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:7:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformBeforeConditionalContinue) { + // Use a variable for a conditional barrier in a loop, assign a non-uniform value to + // that variable later in that loop, then perform a conditional continue before assigning a + // uniform value to that variable. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + if (true) { + continue; + } + + v = 5; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:12:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Loop_VarBecomesNonUniformInNestedLoopWithBreak_BarrierInLoop) { + // Use a variable for a conditional barrier in a loop, then conditionally assign a non-uniform + // value to that variable followed by a break in a nested loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (v == 0) { + workgroupBarrier(); + break; + } + + loop { + if (true) { + v = non_uniform; + break; + } + v = 5; + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:14:13 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, + Loop_VarBecomesNonUniformInNestedLoopWithBreak_BecomesUniformAgain_BarrierAfterLoop) { + // Conditionally assign a non-uniform value followed by a break in a nested loop, assign a + // uniform value in the outer loop, and then use a variable for a conditional barrier after the + // loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + loop { + if (false) { + break; + } + + loop { + if (true) { + v = non_uniform; + break; + } + } + v = 5; + } + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_NonUniformValueNeverReachesContinuing) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + loop { + var v = non_uniform; + return; + + continuing { + if (v == 0) { + workgroupBarrier(); + } + } + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_NonUniformBreakInBody_Reconverge) { + // Loops reconverge at exit, so test that we can call workgroupBarrier() after a loop that + // contains a non-uniform conditional break. + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + var i = 0; + loop { + if (i == n) { + break; + } + i = i + 1; + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_NonUniformFunctionInBody_Reconverge) { + // Loops reconverge at exit, so test that we can call workgroupBarrier() after a loop that + // contains a call to a function that causes non-uniform control flow. + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn bar() { + if (n == 42) { + return; + } else { + return; + } +} + +fn foo() { + loop { + bar(); + break; + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Loop_NonUniformFunctionDiscard_NoReconvergence) { + // Loops should not reconverge after non-uniform discard statements. + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn bar() { + if (n == 42) { + discard; + } +} + +fn foo() { + loop { + bar(); + break; + } + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:12:5 note: calling 'bar' may cause subsequent control flow to be non-uniform + bar(); + ^^^ + +test:5:3 note: control flow depends on non-uniform value + if (n == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'n' may result in a non-uniform value + if (n == 42) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_CallInside_UniformCondition) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + for (var i = 0; i < n; i = i + 1) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ForLoop_CallInside_NonUniformCondition) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + for (var i = 0; i < n; i = i + 1) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:6:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + for (var i = 0; i < n; i = i + 1) { + ^^^ + +test:5:23 note: reading from read_write storage buffer 'n' may result in a non-uniform value + for (var i = 0; i < n; i = i + 1) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_CallInside_InitializerCausesNonUniformFlow) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn bar() -> i32 { + if (n == 42) { + return 1; + } else { + return 2; + } +} + +fn foo() { + for (var i = bar(); i < 10; i = i + 1) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:14:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:16 note: calling 'bar' may cause subsequent control flow to be non-uniform + for (var i = bar(); i < 10; i = i + 1) { + ^^^ + +test:5:3 note: control flow depends on non-uniform value + if (n == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'n' may result in a non-uniform value + if (n == 42) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_CallInside_ContinuingCausesNonUniformFlow) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn bar() -> i32 { + if (n == 42) { + return 1; + } else { + return 2; + } +} + +fn foo() { + for (var i = 0; i < 10; i = i + bar()) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:14:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:35 note: calling 'bar' may cause subsequent control flow to be non-uniform + for (var i = 0; i < 10; i = i + bar()) { + ^^^ + +test:5:3 note: control flow depends on non-uniform value + if (n == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'n' may result in a non-uniform value + if (n == 42) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesNonUniformInContinuing_BarrierInLoop) { + // Use a variable for a conditional barrier in a loop, and then assign a non-uniform value to + // that variable in the continuing statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; v = non_uniform) { + if (v == 0) { + workgroupBarrier(); + break; + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:6:31 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + for (var i = 0; i < 10; v = non_uniform) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesUniformInContinuing_BarrierInLoop) { + // Use a variable for a conditional barrier in a loop, and then assign a uniform value to that + // variable in the continuing statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; v = 5) { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesNonUniformInContinuing_BarrierAfterLoop) { + // Use a variable for a conditional barrier after a loop, and assign a non-uniform value to + // that variable in the continuing statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; v = non_uniform) { + v = 5; + } + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:10:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:9:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:6:31 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + for (var i = 0; i < 10; v = non_uniform) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesUniformInContinuing_BarrierAfterLoop) { + // Use a variable for a conditional barrier after a loop, and assign a uniform value to that + // variable in the continuing statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; v = 5) { + v = non_uniform; + } + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesNonUniformInLoopAfterBarrier) { + // Use a variable for a conditional barrier in a loop, and then assign a non-uniform value to + // that variable later in that loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; i++) { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:12:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_ConditionalAssignNonUniformWithBreak_BarrierInLoop) { + // In a conditional block, assign a non-uniform value and then break, then use a variable for a + // conditional barrier later in the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; i++) { + if (true) { + v = non_uniform; + break; + } + if (v == 0) { + workgroupBarrier(); + } + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ForLoop_ConditionalAssignNonUniformWithBreak_BarrierAfterLoop) { + // In a conditional block, assign a non-uniform value and then break, then use a variable for a + // conditional barrier after the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; i++) { + if (true) { + v = non_uniform; + break; + } + v = 5; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:14:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:8:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_VarRemainsNonUniformAtLoopEnd_BarrierAfterLoop) { + // Assign a non-uniform value, assign a uniform value before all explicit break points but leave + // the value non-uniform at loop exit, then use a variable for a conditional barrier after the + // loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; i++) { + if (true) { + v = 5; + break; + } + + v = non_uniform; + + if (true) { + v = 6; + break; + } + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:21:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:20:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:12:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, + ForLoop_VarBecomesNonUniformBeforeConditionalContinue_BarrierAtStart) { + // Use a variable for a conditional barrier in a loop, assign a non-uniform value to + // that variable later in that loop, then perform a conditional continue before assigning a + // uniform value to that variable. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; i++) { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + if (true) { + continue; + } + + v = 5; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:12:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_VarBecomesNonUniformBeforeConditionalContinue) { + // Use a variable for a conditional barrier in a loop, assign a non-uniform value to + // that variable later in that loop, then perform a conditional continue before assigning a + // uniform value to that variable. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + for (var i = 0; i < 10; i++) { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + if (true) { + continue; + } + + v = 5; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:12:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ForLoop_NonUniformCondition_Reconverge) { + // Loops reconverge at exit, so test that we can call workgroupBarrier() after a loop that has a + // non-uniform condition. + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + for (var i = 0; i < n; i = i + 1) { + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, While_CallInside_UniformCondition) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + var i = 0; + while (i < n) { + workgroupBarrier(); + i = i + 1; + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, While_CallInside_NonUniformCondition) { + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + var i = 0; + while (i < n) { + workgroupBarrier(); + i = i + 1; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:7:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:6:3 note: control flow depends on non-uniform value + while (i < n) { + ^^^^^ + +test:6:14 note: reading from read_write storage buffer 'n' may result in a non-uniform value + while (i < n) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, While_VarBecomesNonUniformInLoopAfterBarrier) { + // Use a variable for a conditional barrier in a loop, and then assign a non-uniform value to + // that variable later in that loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + var i = 0; + while (i < 10) { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + i++; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:13:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, While_ConditionalAssignNonUniformWithBreak_BarrierInLoop) { + // In a conditional block, assign a non-uniform value and then break, then use a variable for a + // conditional barrier later in the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + var i = 0; + while (i < 10) { + if (true) { + v = non_uniform; + break; + } + if (v == 0) { + workgroupBarrier(); + } + i++; + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, While_ConditionalAssignNonUniformWithBreak_BarrierAfterLoop) { + // In a conditional block, assign a non-uniform value and then break, then use a variable for a + // conditional barrier after the loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + var i = 0; + while (i < 10) { + if (true) { + v = non_uniform; + break; + } + v = 5; + i++; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:17:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:16:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:9:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, While_VarRemainsNonUniformAtLoopEnd_BarrierAfterLoop) { + // Assign a non-uniform value, assign a uniform value before all explicit break points but leave + // the value non-uniform at loop exit, then use a variable for a conditional barrier after the + // loop. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + var i = 0; + while (i < 10) { + if (true) { + v = 5; + break; + } + + v = non_uniform; + + if (true) { + v = 6; + break; + } + i++; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:23:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:22:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:13:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, While_VarBecomesNonUniformBeforeConditionalContinue_BarrierAtStart) { + // Use a variable for a conditional barrier in a loop, assign a non-uniform value to + // that variable later in that loop, then perform a conditional continue before assigning a + // uniform value to that variable. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + var i = 0; + while (i < 10) { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + if (true) { + continue; + } + + v = 5; + i++; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:13:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, While_VarBecomesNonUniformBeforeConditionalContinue) { + // Use a variable for a conditional barrier in a loop, assign a non-uniform value to + // that variable later in that loop, then perform a conditional continue before assigning a + // uniform value to that variable. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + var i = 0; + while (i < 10) { + if (v == 0) { + workgroupBarrier(); + break; + } + + v = non_uniform; + if (true) { + continue; + } + + v = 5; + i++; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:5 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:13:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, While_NonUniformCondition_Reconverge) { + // Loops reconverge at exit, so test that we can call workgroupBarrier() after a loop that has a + // non-uniform condition. + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn foo() { + var i = 0; + while (i < n) { + } + workgroupBarrier(); + i = i + 1; +} +)"; + + RunTest(src, true); +} + +} // namespace LoopTest + +//////////////////////////////////////////////////////////////////////////////// +/// If-else statement tests. +//////////////////////////////////////////////////////////////////////////////// + +TEST_F(UniformityAnalysisTest, IfElse_UniformCondition_BarrierInTrueBlock) { + std::string src = R"( +@group(0) @binding(0) var uniform_global : i32; + +fn foo() { + if (uniform_global == 42) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_UniformCondition_BarrierInElseBlock) { + std::string src = R"( +@group(0) @binding(0) var uniform_global : i32; + +fn foo() { + if (uniform_global == 42) { + } else { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_UniformCondition_BarrierInElseIfBlock) { + std::string src = R"( +@group(0) @binding(0) var uniform_global : i32; + +fn foo() { + if (uniform_global == 42) { + } else if (true) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_NonUniformCondition_BarrierInTrueBlock) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + if (non_uniform == 42) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:6:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (non_uniform == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 42) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_NonUniformCondition_BarrierInElseBlock) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + if (non_uniform == 42) { + } else { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:7:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (non_uniform == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 42) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingCondition_NonUniformLHS_And) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn main() { + if ((non_uniform_global == 42) && false) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:34 note: control flow depends on non-uniform value + if ((non_uniform_global == 42) && false) { + ^^ + +test:7:8 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if ((non_uniform_global == 42) && false) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingCondition_NonUniformRHS_And) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn main() { + if (false && (non_uniform_global == 42)) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (false && (non_uniform_global == 42)) { + ^^ + +test:7:17 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (false && (non_uniform_global == 42)) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingCondition_NonUniformLHS_Or) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn main() { + if ((non_uniform_global == 42) || true) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:34 note: control flow depends on non-uniform value + if ((non_uniform_global == 42) || true) { + ^^ + +test:7:8 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if ((non_uniform_global == 42) || true) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingCondition_NonUniformRHS_Or) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn main() { + if (true || (non_uniform_global == 42)) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (true || (non_uniform_global == 42)) { + ^^ + +test:7:16 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (true || (non_uniform_global == 42)) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_NonUniformCondition_BarrierInElseIfBlock) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + if (non_uniform == 42) { + } else if (true) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:7:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (non_uniform == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 42) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_VarBecomesNonUniform_BeforeCondition) { + // Use a function-scope variable for control-flow guarding a barrier, and then assign to that + // variable before checking the condition. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var v = 0; + v = rw; + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:6:7 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + v = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_VarBecomesNonUniform_AfterCondition) { + // Use a function-scope variable for control-flow guarding a barrier, and then assign to that + // variable after checking the condition. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var v = 0; + if (v == 0) { + v = rw; + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_VarBecomesNonUniformInIf_BarrierInElse) { + // Assign a non-uniform value to a variable in an if-block, and then use that variable for a + // conditional barrier in the else block. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + if (true) { + v = non_uniform; + } else { + if (v == 0) { + workgroupBarrier(); + } + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformInIf_AssignUniformInElse) { + // Assign a non-uniform value to a variable in an if-block and a uniform value in the else + // block, and then use that variable for a conditional barrier after the if-else statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + if (true) { + if (true) { + v = non_uniform; + } else { + v = 5; + } + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:14:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:8:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformInIfWithReturn) { + // Assign a non-uniform value to a variable in an if-block followed by a return, and then use + // that variable for a conditional barrier after the if-else statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + if (true) { + v = non_uniform; + return; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformBeforeIf_BothBranchesAssignUniform) { + // Assign a non-uniform value to a variable before and if-else statement, assign uniform values + // in both branch of the if-else, and then use that variable for a conditional barrier after + // the if-else statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + v = non_uniform; + if (true) { + v = 5; + } else { + v = 6; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformBeforeIf_OnlyTrueBranchAssignsUniform) { + // Assign a non-uniform value to a variable before and if-else statement, assign a uniform value + // in the true branch of the if-else, and then use that variable for a conditional barrier after + // the if-else statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + v = non_uniform; + if (true) { + v = 5; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:12:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:6:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_AssignNonUniformBeforeIf_OnlyFalseBranchAssignsUniform) { + // Assign a non-uniform value to a variable before and if-else statement, assign a uniform value + // in the false branch of the if-else, and then use that variable for a conditional barrier + // after the if-else statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + v = non_uniform; + if (true) { + } else { + v = 5; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:13:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:12:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:6:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, + IfElse_AssignNonUniformBeforeIf_OnlyTrueBranchAssignsUniform_FalseBranchReturns) { + // Assign a non-uniform value to a variable before and if-else statement, assign a uniform value + // in the true branch of the if-else, leave the variable untouched in the false branch and just + // return, and then use that variable for a conditional barrier after the if-else statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + v = non_uniform; + if (true) { + v = 5; + } else { + return; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, + IfElse_AssignNonUniformBeforeIf_OnlyFalseBranchAssignsUniform_TrueBranchReturns) { + // Assign a non-uniform value to a variable before and if-else statement, assign a uniform value + // in the false branch of the if-else, leave the variable untouched in the true branch and just + // return, and then use that variable for a conditional barrier after the if-else statement. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + v = non_uniform; + if (true) { + return; + } else { + v = 5; + } + + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_NonUniformCondition_Reconverge) { + // If statements reconverge at exit, so test that we can call workgroupBarrier() after an if + // statement with a non-uniform condition. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + if (non_uniform == 42) { + } else { + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingNonUniformConditionLHS_Reconverge) { + // If statements reconverge at exit, so test that we can call workgroupBarrier() after an if + // statement with a non-uniform condition that uses short-circuiting. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + if (non_uniform == 42 || true) { + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_ShortCircuitingNonUniformConditionRHS_Reconverge) { + // If statements reconverge at exit, so test that we can call workgroupBarrier() after an if + // statement with a non-uniform condition that uses short-circuiting. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + if (false && non_uniform == 42) { + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_NonUniformFunctionCall_Reconverge) { + // If statements reconverge at exit, so test that we can call workgroupBarrier() after an if + // statement with a non-uniform condition. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar() { + if (non_uniform == 42) { + return; + } else { + return; + } +} + +fn foo() { + if (non_uniform == 42) { + bar(); + } else { + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, IfElse_NonUniformReturn_NoReconverge) { + // If statements should not reconverge after non-uniform returns. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + if (non_uniform == 42) { + return; + } else { + } + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (non_uniform == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 42) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, IfElse_NonUniformDiscard_NoReconverge) { + // If statements should not reconverge after non-uniform discards. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + if (non_uniform == 42) { + discard; + } else { + } + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (non_uniform == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 42) { + ^^^^^^^^^^^ +)"); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Switch statement tests. +//////////////////////////////////////////////////////////////////////////////// + +TEST_F(UniformityAnalysisTest, Switch_NonUniformCondition_BarrierInCase) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + switch (non_uniform) { + case 42: { + workgroupBarrier(); + break; + } + default: { + break; + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:7:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + switch (non_uniform) { + ^^^^^^ + +test:5:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + switch (non_uniform) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_NonUniformCondition_BarrierInDefault) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + switch (non_uniform) { + default: { + workgroupBarrier(); + break; + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:7:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + switch (non_uniform) { + ^^^^^^ + +test:5:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + switch (non_uniform) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_NonUniformBreak) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + switch (condition) { + case 42: { + if (non_uniform == 42) { + break; + } + workgroupBarrier(); + } + default: { + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:11:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:7 note: control flow depends on non-uniform value + if (non_uniform == 42) { + ^^ + +test:8:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 42) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_NonUniformBreakInDifferentCase) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + switch (condition) { + case 0: { + if (non_uniform == 42) { + break; + } + } + case 42: { + workgroupBarrier(); + } + default: { + } + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Switch_NonUniformBreakInDifferentCase_Fallthrough) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + switch (condition) { + case 0: { + if (non_uniform == 42) { + break; + } + fallthrough; + } + case 42: { + workgroupBarrier(); + } + default: { + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ( + error_, + R"(test:11:7 warning: use of deprecated language feature: fallthrough is set to be removed from WGSL. Case can accept multiple selectors if the existing case bodies are empty. default is not yet supported in a case selector list. + fallthrough; + ^^^^^^^^^^^ + +test:14:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:7 note: control flow depends on non-uniform value + if (non_uniform == 42) { + ^^ + +test:8:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 42) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_VarBecomesNonUniformInDifferentCase_WithBreak) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = 0; + switch (condition) { + case 0: { + x = non_uniform; + break; + } + case 42: { + if (x == 0) { + workgroupBarrier(); + } + } + default: { + } + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Switch_VarBecomesNonUniformInDifferentCase_WithFallthrough) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = 0; + switch (condition) { + case 0: { + x = non_uniform; + fallthrough; + } + case 42: { + if (x == 0) { + workgroupBarrier(); + } + } + default: { + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ( + error_, + R"(test:10:7 warning: use of deprecated language feature: fallthrough is set to be removed from WGSL. Case can accept multiple selectors if the existing case bodies are empty. default is not yet supported in a case selector list. + fallthrough; + ^^^^^^^^^^^ + +test:14:9 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:7 note: control flow depends on non-uniform value + if (x == 0) { + ^^ + +test:9:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + x = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformInDifferentCase_WithBreak) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = non_uniform; + switch (condition) { + case 0: { + x = 5; + break; + } + case 42: { + if (x == 0) { + workgroupBarrier(); + } + } + default: { + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:14:9 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:7 note: control flow depends on non-uniform value + if (x == 0) { + ^^ + +test:6:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var x = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_VarBecomesNonUniformInCase_BarrierAfter) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = 0; + switch (condition) { + case 0: { + x = non_uniform; + } + case 42: { + x = 5; + } + default: { + x = 6; + } + } + if (x == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:19:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:18:3 note: control flow depends on non-uniform value + if (x == 0) { + ^^ + +test:9:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + x = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformInAllCases_BarrierAfter) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = non_uniform; + switch (condition) { + case 0: { + x = 4; + } + case 42: { + x = 5; + } + default: { + x = 6; + } + } + if (x == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformInSomeCases_BarrierAfter) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = non_uniform; + switch (condition) { + case 0: { + x = 4; + } + case 42: { + } + default: { + x = 6; + } + } + if (x == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:18:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:17:3 note: control flow depends on non-uniform value + if (x == 0) { + ^^ + +test:6:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var x = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformInCasesThatDontReturn_BarrierAfter) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = non_uniform; + switch (condition) { + case 0: { + x = 4; + } + case 42: { + return; + } + default: { + x = 6; + } + } + if (x == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Switch_VarBecomesUniformAfterConditionalBreak_BarrierAfter) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = non_uniform; + switch (condition) { + case 0: { + x = 4; + } + case 42: { + } + default: { + if (false) { + break; + } + x = 6; + } + } + if (x == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:21:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:20:3 note: control flow depends on non-uniform value + if (x == 0) { + ^^ + +test:6:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var x = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_NestedInLoop_VarBecomesNonUniformWithBreak_BarrierInLoop) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = 0; + loop { + if (x == 0) { + workgroupBarrier(); + break; + } + + switch (condition) { + case 0: { + x = non_uniform; + break; + } + default: { + x = 6; + } + } + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:5 note: control flow depends on non-uniform value + if (x == 0) { + ^^ + +test:15:13 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + x = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Switch_NestedInLoop_VarBecomesNonUniformWithBreak_BarrierAfterLoop) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(0) var condition : i32; + +fn foo() { + var x = 0; + loop { + if (false) { + break; + } + switch (condition) { + case 0: { + x = non_uniform; + break; + } + default: { + x = 6; + } + } + x = 5; + } + if (x == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Switch_NonUniformCondition_Reconverge) { + // Switch statements reconverge at exit, so test that we can call workgroupBarrier() after a + // switch statement that contains a non-uniform conditional break. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + switch (non_uniform) { + default: { + break; + } + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Switch_NonUniformBreak_Reconverge) { + // Switch statements reconverge at exit, so test that we can call workgroupBarrier() after a + // switch statement that contains a non-uniform conditional break. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + switch (42) { + default: { + if (non_uniform == 0) { + break; + } + break; + } + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Switch_NonUniformFunctionCall_Reconverge) { + // Switch statements reconverge at exit, so test that we can call workgroupBarrier() after a + // switch statement that contains a call to a function that causes non-uniform control flow. + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn bar() { + if (n == 42) { + return; + } else { + return; + } +} + +fn foo() { + switch (42) { + default: { + bar(); + break; + } + } + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, Switch_NonUniformFunctionDiscard_NoReconvergence) { + // Switch statements should not reconverge after non-uniform discards. + std::string src = R"( +@group(0) @binding(0) var n : i32; + +fn bar() { + if (n == 42) { + discard; + } +} + +fn foo() { + switch (42) { + default: { + bar(); + break; + } + } + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:17:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:7 note: calling 'bar' may cause subsequent control flow to be non-uniform + bar(); + ^^^ + +test:5:3 note: control flow depends on non-uniform value + if (n == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'n' may result in a non-uniform value + if (n == 42) { + ^ +)"); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Pointer tests. +//////////////////////////////////////////////////////////////////////////////// + +TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + *&v = non_uniform; + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:6:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + *&v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, AssignNonUniformThroughCapturedPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + let pv = &v; + *pv = non_uniform; + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:7:9 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + *pv = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, AssignUniformThroughPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = non_uniform; + *&v = 42; + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, AssignUniformThroughCapturedPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = non_uniform; + let pv = &v; + *pv = 42; + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, AssignUniformThroughCapturedPointer_InNonUniformControlFlow) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + let pv = &v; + if (non_uniform == 0) { + *pv = 42; + } + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:11:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (non_uniform == 0) { + ^^ + +test:7:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 0) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, LoadNonUniformThroughPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = non_uniform; + if (*&v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:7:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:6:3 note: control flow depends on non-uniform value + if (*&v == 0) { + ^^ + +test:5:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, LoadNonUniformThroughCapturedPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = non_uniform; + let pv = &v; + if (*pv == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (*pv == 0) { + ^^ + +test:5:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, LoadNonUniformThroughPointerParameter) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr) { + if (*p == 0) { + workgroupBarrier(); + } +} + +fn foo() { + var v = non_uniform; + bar(&v); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:12:7 warning: parameter 'p' of 'bar' must be uniform + bar(&v); + ^ + +test:6:5 note: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, LoadUniformThroughPointer) { + std::string src = R"( +fn foo() { + var v = 42; + if (*&v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, LoadUniformThroughCapturedPointer) { + std::string src = R"( +fn foo() { + var v = 42; + let pv = &v; + if (*pv == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, LoadUniformThroughPointerParameter) { + std::string src = R"( +fn bar(p : ptr) { + if (*p == 0) { + workgroupBarrier(); + } +} + +fn foo() { + var v = 42; + bar(&v); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, StoreNonUniformAfterCapturingPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + let pv = &v; + v = non_uniform; + if (*pv == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (*pv == 0) { + ^^ + +test:7:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, StoreUniformAfterCapturingPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = non_uniform; + let pv = &v; + v = 42; + if (*pv == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, AssignNonUniformThroughLongChainOfPointers) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + let pv1 = &*&v; + let pv2 = &*&*pv1; + *&*&*pv2 = non_uniform; + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:10:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:9:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:8:14 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + *&*&*pv2 = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, LoadNonUniformThroughLongChainOfPointers) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = non_uniform; + let pv1 = &*&v; + let pv2 = &*&*pv1; + if (*&*&*pv2 == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (*&*&*pv2 == 0) { + ^^ + +test:5:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, AssignUniformThenNonUniformThroughDifferentPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + let pv1 = &v; + let pv2 = &v; + *pv1 = 42; + *pv2 = non_uniform; + if (*pv1 == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:11:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:10:3 note: control flow depends on non-uniform value + if (*pv1 == 0) { + ^^ + +test:9:10 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + *pv2 = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, AssignNonUniformThenUniformThroughDifferentPointer) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + var v = 0; + let pv1 = &v; + let pv2 = &v; + *pv1 = non_uniform; + *pv2 = 42; + if (*pv1 == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, UnmodifiedPointerParameterNonUniform) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr) { +} + +fn foo() { + var v = non_uniform; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:11:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:10:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:8:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, UnmodifiedPointerParameterUniform) { + std::string src = R"( +fn bar(p : ptr) { +} + +fn foo() { + var v = 42; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointerInFunctionCall) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr) { + *p = non_uniform; +} + +fn foo() { + var v = 0; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:12:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:10:7 note: pointer contents may become non-uniform after calling 'bar' + bar(&v); + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, AssignUniformThroughPointerInFunctionCall) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr) { + *p = 42; +} + +fn foo() { + var v = non_uniform; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointerInFunctionCallViaArg) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr, a : i32) { + *p = a; +} + +fn foo() { + var v = 0; + bar(&v, non_uniform); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:12:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:10:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + bar(&v, non_uniform); + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointerInFunctionCallViaPointerArg) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr, a : ptr) { + *p = *a; +} + +fn foo() { + var v = 0; + var a = non_uniform; + bar(&v, &a); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:13:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:12:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:10:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var a = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, AssignUniformThroughPointerInFunctionCallViaArg) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr, a : i32) { + *p = a; +} + +fn foo() { + var v = non_uniform; + bar(&v, 42); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, AssignUniformThroughPointerInFunctionCallViaPointerArg) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr, a : ptr) { + *p = *a; +} + +fn foo() { + var v = non_uniform; + var a = 42; + bar(&v, &a); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, AssignNonUniformThroughPointerInFunctionCallChain) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn f3(p : ptr, a : ptr) { + *p = *a; +} + +fn f2(p : ptr, a : ptr) { + f3(p, a); +} + +fn f1(p : ptr, a : ptr) { + f2(p, a); +} + +fn foo() { + var v = 0; + var a = non_uniform; + f1(&v, &a); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:21:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:20:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:18:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var a = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, AssignUniformThroughPointerInFunctionCallChain) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn f3(p : ptr, a : ptr) { + *p = *a; +} + +fn f2(p : ptr, a : ptr) { + f3(p, a); +} + +fn f1(p : ptr, a : ptr) { + f2(p, a); +} + +fn foo() { + var v = non_uniform; + var a = 42; + f1(&v, &a); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, MakePointerParamUniformInReturnExpression) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn zoo(p : ptr) -> i32 { + *p = 5; + return 6; +} + +fn bar(p : ptr) -> i32 { + *p = non_uniform; + return zoo(p); +} + +fn foo() { + var v = 0; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, MakePointerParamNonUniformInReturnExpression) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn zoo(p : ptr) -> i32 { + *p = non_uniform; + return 6; +} + +fn bar(p : ptr) -> i32 { + *p = 5; + return zoo(p); +} + +fn foo() { + var v = 0; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:18:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:17:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:16:7 note: pointer contents may become non-uniform after calling 'bar' + bar(&v); + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, PointerParamAssignNonUniformInTrueAndUniformInFalse) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr) { + if (true) { + *p = non_uniform; + } else { + *p = 5; + } +} + +fn foo() { + var v = 0; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:16:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:15:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:14:7 note: pointer contents may become non-uniform after calling 'bar' + bar(&v); + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, ConditionalAssignNonUniformToPointerParamAndReturn) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr) { + if (true) { + *p = non_uniform; + return; + } + *p = 5; +} + +fn foo() { + var v = 0; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:16:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:15:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:14:7 note: pointer contents may become non-uniform after calling 'bar' + bar(&v); + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, ConditionalAssignNonUniformToPointerParamAndBreakFromSwitch) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; +@group(0) @binding(1) var condition : i32; + +fn bar(p : ptr) { + switch (condition) { + case 0 { + if (true) { + *p = non_uniform; + break; + } + *p = 5; + } + default { + *p = 6; + } + } +} + +fn foo() { + var v = 0; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:24:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:23:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:22:7 note: pointer contents may become non-uniform after calling 'bar' + bar(&v); + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, ConditionalAssignNonUniformToPointerParamAndBreakFromLoop) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr) { + loop { + if (true) { + *p = non_uniform; + break; + } + *p = 5; + } +} + +fn foo() { + var v = 0; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:18:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:17:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:16:7 note: pointer contents may become non-uniform after calling 'bar' + bar(&v); + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, ConditionalAssignNonUniformToPointerParamAndContinue) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo(p : ptr) { + loop { + if (*p == 0) { + workgroupBarrier(); + break; + } + + if (true) { + *p = non_uniform; + continue; + } + *p = 5; + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:7:7 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:6:5 note: control flow depends on non-uniform value + if (*p == 0) { + ^^ + +test:12:12 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + *p = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, PointerParamMaybeBecomesUniform) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr) { + if (true) { + *p = 5; + return; + } +} + +fn foo() { + var v = non_uniform; + bar(&v); + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:14:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:12:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, PointerParamModifiedInNonUniformControlFlow) { + std::string src = R"( +@binding(0) @group(0) var non_uniform_global : i32; + +fn foo(p : ptr) { + *p = 42; +} + +@compute @workgroup_size(64) +fn main() { + var a : i32; + if (non_uniform_global == 0) { + foo(&a); + } + + if (a == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:16:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:3 note: control flow depends on non-uniform value + if (non_uniform_global == 0) { + ^^ + +test:11:7 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (non_uniform_global == 0) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, PointerParamAssumedModifiedInNonUniformControlFlow) { + std::string src = R"( +@binding(0) @group(0) var non_uniform_global : i32; + +fn foo(p : ptr) { + // Do not modify 'p', uniformity analysis presently assumes it will be. +} + +@compute @workgroup_size(64) +fn main() { + var a : i32; + if (non_uniform_global == 0) { + foo(&a); + } + + if (a == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:16:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:3 note: control flow depends on non-uniform value + if (non_uniform_global == 0) { + ^^ + +test:11:7 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (non_uniform_global == 0) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, PointerParamModifiedInNonUniformControlFlow_NestedCall) { + std::string src = R"( +@binding(0) @group(0) var non_uniform_global : i32; + +fn foo2(p : ptr) { + *p = 42; +} + +fn foo(p : ptr) { + foo2(p); +} + +@compute @workgroup_size(64) +fn main() { + var a : i32; + if (non_uniform_global == 0) { + foo(&a); + } + + if (a == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:20:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:15:3 note: control flow depends on non-uniform value + if (non_uniform_global == 0) { + ^^ + +test:15:7 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (non_uniform_global == 0) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, PointerParamModifiedInUniformControlFlow) { + std::string src = R"( +@binding(0) @group(0) var uniform_global : i32; + +fn foo(p : ptr) { + *p = 42; +} + +@compute @workgroup_size(64) +fn main() { + var a : i32; + if (uniform_global == 0) { + foo(&a); + } + + if (a == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, NonUniformPointerParameterBecomesUniform_AfterUse) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(a : ptr, b : ptr) { + *b = *a; + *a = 0; +} + +fn foo() { + var a = non_uniform; + var b = 0; + bar(&a, &b); + if (b == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:14:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:3 note: control flow depends on non-uniform value + if (b == 0) { + ^^ + +test:10:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var a = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, NonUniformPointerParameterBecomesUniform_BeforeUse) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(a : ptr, b : ptr) { + *a = 0; + *b = *a; +} + +fn foo() { + var a = non_uniform; + var b = 0; + bar(&a, &b); + if (b == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, UniformPointerParameterBecomesNonUniform_BeforeUse) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(a : ptr, b : ptr) { + *a = non_uniform; + *b = *a; +} + +fn foo() { + var a = 0; + var b = 0; + bar(&a, &b); + if (b == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:14:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:3 note: control flow depends on non-uniform value + if (b == 0) { + ^^ + +test:12:11 note: pointer contents may become non-uniform after calling 'bar' + bar(&a, &b); + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, UniformPointerParameterBecomesNonUniform_AfterUse) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(a : ptr, b : ptr) { + *b = *a; + *a = non_uniform; +} + +fn foo() { + var a = 0; + var b = 0; + bar(&a, &b); + if (b == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, NonUniformPointerParameterUpdatedInPlace) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(p : ptr) { + (*p)++; +} + +fn foo() { + var v = non_uniform; + bar(&v); + if (v == 1) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:12:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:3 note: control flow depends on non-uniform value + if (v == 1) { + ^^ + +test:9:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var v = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, MultiplePointerParametersBecomeNonUniform) { + // The analysis traverses the tree for each pointer parameter, and we need to make sure that we + // reset the "visited" state of nodes in between these traversals to properly capture each of + // their uniformity states. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(a : ptr, b : ptr) { + *a = non_uniform; + *b = non_uniform; +} + +fn foo() { + var a = 0; + var b = 0; + bar(&a, &b); + if (b == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:14:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:3 note: control flow depends on non-uniform value + if (b == 0) { + ^^ + +test:12:11 note: pointer contents may become non-uniform after calling 'bar' + bar(&a, &b); + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, MultiplePointerParametersWithEdgesToEachOther) { + // The analysis traverses the tree for each pointer parameter, and we need to make sure that we + // reset the "visited" state of nodes in between these traversals to properly capture each of + // their uniformity states. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn bar(a : ptr, b : ptr, c : ptr) { + *a = *a; + *b = *b; + *c = *a + *b; +} + +fn foo() { + var a = non_uniform; + var b = 0; + var c = 0; + bar(&a, &b, &c); + if (c == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:16:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:15:3 note: control flow depends on non-uniform value + if (c == 0) { + ^^ + +test:11:11 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + var a = non_uniform; + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, MaximumNumberOfPointerParameters) { + // Create a function with the maximum number of parameters, all pointers, to stress the + // quadratic nature of the analysis. + ProgramBuilder b; + auto& ty = b.ty; + + // fn foo(p0 : ptr, p1 : ptr, ...) { + // let rhs = *p0 + *p1 + ... + *p244; + // *p1 = rhs; + // *p2 = rhs; + // ... + // *p254 = rhs; + // } + utils::Vector params; + utils::Vector foo_body; + const ast::Expression* rhs_init = b.Deref("p0"); + for (int i = 1; i < 255; i++) { + rhs_init = b.Add(rhs_init, b.Deref("p" + std::to_string(i))); + } + foo_body.Push(b.Decl(b.Let("rhs", rhs_init))); + for (int i = 0; i < 255; i++) { + params.Push( + b.Param("p" + std::to_string(i), ty.pointer(ty.i32(), ast::StorageClass::kFunction))); + if (i > 0) { + foo_body.Push(b.Assign(b.Deref("p" + std::to_string(i)), "rhs")); + } + } + b.Func("foo", std::move(params), ty.void_(), foo_body); + + // var non_uniform_global : i32; + // fn main() { + // var v0 : i32; + // var v1 : i32; + // ... + // var v254 : i32; + // v0 = non_uniform_global; + // foo(&v0, &v1, ..., &v254); + // if (v254 == 0) { + // workgroupBarrier(); + // } + // } + b.GlobalVar("non_uniform_global", ty.i32(), ast::StorageClass::kPrivate); + utils::Vector main_body; + utils::Vector args; + for (int i = 0; i < 255; i++) { + auto name = "v" + std::to_string(i); + main_body.Push(b.Decl(b.Var(name, ty.i32()))); + args.Push(b.AddressOf(name)); + } + main_body.Push(b.Assign("v0", "non_uniform_global")); + main_body.Push(b.CallStmt(b.create(b.Expr("foo"), args))); + main_body.Push(b.If(b.Equal("v254", 0_i), b.Block(b.CallStmt(b.Call("workgroupBarrier"))))); + b.Func("main", utils::Empty, ty.void_(), main_body); + + // TODO(jrprice): Expect false when uniformity issues become errors. + EXPECT_TRUE(RunTest(std::move(b))) << error_; + EXPECT_EQ(error_, + R"(warning: 'workgroupBarrier' must only be called from uniform control flow +note: control flow depends on non-uniform value +note: reading from module-scope private variable 'non_uniform_global' may result in a non-uniform value)"); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Tests to cover access to aggregate types. +//////////////////////////////////////////////////////////////////////////////// + +TEST_F(UniformityAnalysisTest, VectorElement_Uniform) { + std::string src = R"( +@group(0) @binding(0) var v : vec4; + +fn foo() { + if (v[2] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, VectorElement_NonUniform) { + std::string src = R"( +@group(0) @binding(0) var v : array; + +fn foo() { + if (v[2] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:6:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (v[2] == 0) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'v' may result in a non-uniform value + if (v[2] == 0) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, VectorElement_BecomesNonUniform_BeforeCondition) { + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var v : vec4; + v[2] = rw; + if (v[2] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (v[2] == 0) { + ^^ + +test:6:10 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + v[2] = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, VectorElement_BecomesNonUniform_AfterCondition) { + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var v : vec4; + if (v[2] == 0) { + v[2] = rw; + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, VectorElement_DifferentElementBecomesNonUniform) { + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var v : vec4; + v[1] = rw; + if (v[2] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (v[2] == 0) { + ^^ + +test:6:10 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + v[1] = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, VectorElement_ElementBecomesUniform) { + // For aggregate types, we conservatively consider them to be forever non-uniform once they + // become non-uniform. Test that after assigning a uniform value to an element, that element is + // still considered to be non-uniform. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var v : vec4; + v[1] = rw; + v[1] = 42; + if (v[1] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (v[1] == 0) { + ^^ + +test:6:10 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + v[1] = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, VectorElement_DifferentElementBecomesUniform) { + // For aggregate types, we conservatively consider them to be forever non-uniform once they + // become non-uniform. Test that after assigning a uniform value to an element, the whole vector + // is still considered to be non-uniform. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var v : vec4; + v[1] = rw; + v[2] = 42; + if (v[1] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (v[1] == 0) { + ^^ + +test:6:10 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + v[1] = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, VectorElement_NonUniform_AnyBuiltin) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +fn foo() { + var v : vec4; + v[1] = non_uniform_global; + if (any(v == vec4(42))) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (any(v == vec4(42))) { + ^^ + +test:6:10 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + v[1] = non_uniform_global; + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, StructMember_Uniform) { + std::string src = R"( +struct S { + a : i32, + b : i32, +} +@group(0) @binding(0) var s : S; + +fn foo() { + if (s.b == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, StructMember_NonUniform) { + std::string src = R"( +struct S { + a : i32, + b : i32, +} +@group(0) @binding(0) var s : S; + +fn foo() { + if (s.b == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:10:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:9:3 note: control flow depends on non-uniform value + if (s.b == 0) { + ^^ + +test:9:7 note: reading from read_write storage buffer 's' may result in a non-uniform value + if (s.b == 0) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, StructMember_BecomesNonUniform_BeforeCondition) { + std::string src = R"( +struct S { + a : i32, + b : i32, +} +@group(0) @binding(0) var rw : i32; + +fn foo() { + var s : S; + s.b = rw; + if (s.b == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:12:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:3 note: control flow depends on non-uniform value + if (s.b == 0) { + ^^ + +test:10:9 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + s.b = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, StructMember_BecomesNonUniform_AfterCondition) { + std::string src = R"( +struct S { + a : i32, + b : i32, +} +@group(0) @binding(0) var rw : i32; + +fn foo() { + var s : S; + if (s.b == 0) { + s.b = rw; + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, StructMember_DifferentMemberBecomesNonUniform) { + std::string src = R"( +struct S { + a : i32, + b : i32, +} +@group(0) @binding(0) var rw : i32; + +fn foo() { + var s : S; + s.a = rw; + if (s.b == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:12:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:11:3 note: control flow depends on non-uniform value + if (s.b == 0) { + ^^ + +test:10:9 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + s.a = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, StructMember_MemberBecomesUniform) { + // For aggregate types, we conservatively consider them to be forever non-uniform once they + // become non-uniform. Test that after assigning a uniform value to a member, that member is + // still considered to be non-uniform. + std::string src = R"( +struct S { + a : i32, + b : i32, +} +@group(0) @binding(0) var rw : i32; + +fn foo() { + var s : S; + s.a = rw; + s.a = 0; + if (s.a == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:13:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:12:3 note: control flow depends on non-uniform value + if (s.a == 0) { + ^^ + +test:10:9 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + s.a = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, StructMember_DifferentMemberBecomesUniform) { + // For aggregate types, we conservatively consider them to be forever non-uniform once they + // become non-uniform. Test that after assigning a uniform value to a member, the whole struct + // is still considered to be non-uniform. + std::string src = R"( +struct S { + a : i32, + b : i32, +} +@group(0) @binding(0) var rw : i32; + +fn foo() { + var s : S; + s.a = rw; + s.b = 0; + if (s.a == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:13:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:12:3 note: control flow depends on non-uniform value + if (s.a == 0) { + ^^ + +test:10:9 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + s.a = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ArrayElement_Uniform) { + std::string src = R"( +@group(0) @binding(0) var arr : array; + +fn foo() { + if (arr[7] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ArrayElement_NonUniform) { + std::string src = R"( +@group(0) @binding(0) var arr : array; + +fn foo() { + if (arr[7] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:6:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (arr[7] == 0) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'arr' may result in a non-uniform value + if (arr[7] == 0) { + ^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ArrayElement_BecomesNonUniform_BeforeCondition) { + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var arr : array; + arr[2] = rw; + if (arr[2] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (arr[2] == 0) { + ^^ + +test:6:12 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + arr[2] = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ArrayElement_BecomesNonUniform_AfterCondition) { + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var arr : array; + if (arr[2] == 0) { + arr[2] = rw; + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ArrayElement_DifferentElementBecomesNonUniform) { + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var arr : array; + arr[1] = rw; + if (arr[2] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (arr[2] == 0) { + ^^ + +test:6:12 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + arr[1] = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ArrayElement_DifferentElementBecomesNonUniformThroughPointer) { + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var arr : array; + let pa = &arr[1]; + *pa = rw; + if (arr[2] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (arr[2] == 0) { + ^^ + +test:7:9 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + *pa = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ArrayElement_ElementBecomesUniform) { + // For aggregate types, we conservatively consider them to be forever non-uniform once they + // become non-uniform. Test that after assigning a uniform value to an element, that element is + // still considered to be non-uniform. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var arr : array; + arr[1] = rw; + arr[1] = 42; + if (arr[1] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (arr[1] == 0) { + ^^ + +test:6:12 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + arr[1] = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ArrayElement_DifferentElementBecomesUniform) { + // For aggregate types, we conservatively consider them to be forever non-uniform once they + // become non-uniform. Test that after assigning a uniform value to an element, the whole array + // is still considered to be non-uniform. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var arr : array; + arr[1] = rw; + arr[2] = 42; + if (arr[1] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:9:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:8:3 note: control flow depends on non-uniform value + if (arr[1] == 0) { + ^^ + +test:6:12 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + arr[1] = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ArrayElement_ElementBecomesUniformThroughPointer) { + // For aggregate types, we conservatively consider them to be forever non-uniform once they + // become non-uniform. Test that after assigning a uniform value to an element through a + // pointer, the whole array is still considered to be non-uniform. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var arr : array; + let pa = &arr[2]; + arr[1] = rw; + *pa = 42; + if (arr[1] == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:10:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:9:3 note: control flow depends on non-uniform value + if (arr[1] == 0) { + ^^ + +test:7:12 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + arr[1] = rw; + ^^ +)"); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Miscellaneous statement and expression tests. +//////////////////////////////////////////////////////////////////////////////// + +TEST_F(UniformityAnalysisTest, FunctionRequiresUniformFlowAndCausesNonUniformFlow) { + // Test that a function that requires uniform flow and then causes non-uniform flow can be + // called without error. + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +fn foo() { + _ = dpdx(0.5); + + if (non_uniform_global == 0) { + discard; + } +} + +@fragment +fn main() { + foo(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, TypeConstructor) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +fn foo() { + if (i32(non_uniform_global) == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:6:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (i32(non_uniform_global) == 0) { + ^^ + +test:5:11 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (i32(non_uniform_global) == 0) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Conversion) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +fn foo() { + if (f32(non_uniform_global) == 0.0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:6:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (f32(non_uniform_global) == 0.0) { + ^^ + +test:5:11 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (f32(non_uniform_global) == 0.0) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Bitcast) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +fn foo() { + if (bitcast(non_uniform_global) == 0.0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:6:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (bitcast(non_uniform_global) == 0.0) { + ^^ + +test:5:20 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (bitcast(non_uniform_global) == 0.0) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, CompoundAssignment_NonUniformRHS) { + // Use compound assignment with a non-uniform RHS on a variable. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var v = 0; + v += rw; + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:6:8 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + v += rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, CompoundAssignment_UniformRHS_StillNonUniform) { + // Use compound assignment with a uniform RHS on a variable that is already non-uniform. + std::string src = R"( +@group(0) @binding(0) var rw : i32; + +fn foo() { + var v = rw; + v += 1; + if (v == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:8:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (v == 0) { + ^^ + +test:5:11 note: reading from read_write storage buffer 'rw' may result in a non-uniform value + var v = rw; + ^^ +)"); +} + +TEST_F(UniformityAnalysisTest, PhonyAssignment_LhsCausesNonUniformControlFlow) { + std::string src = R"( +@group(0) @binding(0) var nonuniform_var : i32; + +fn bar() -> i32 { + if (nonuniform_var == 42) { + return 1; + } else { + return 2; + } +} + +fn foo() { + _ = bar(); + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:14:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:7 note: calling 'bar' may cause subsequent control flow to be non-uniform + _ = bar(); + ^^^ + +test:5:3 note: control flow depends on non-uniform value + if (nonuniform_var == 42) { + ^^ + +test:5:7 note: reading from read_write storage buffer 'nonuniform_var' may result in a non-uniform value + if (nonuniform_var == 42) { + ^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ShortCircuiting_NoReconvergeLHS) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn non_uniform_discard_func() -> bool { + if (non_uniform_global == 42) { + discard; + } + return false; +} + +fn main() { + let b = non_uniform_discard_func() && false; + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:14:11 note: calling 'non_uniform_discard_func' may cause subsequent control flow to be non-uniform + let b = non_uniform_discard_func() && false; + ^^^^^^^^^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (non_uniform_global == 42) { + ^^ + +test:7:7 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (non_uniform_global == 42) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ShortCircuiting_NoReconvergeRHS) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn non_uniform_discard_func() -> bool { + if (non_uniform_global == 42) { + discard; + } + return false; +} + +fn main() { + let b = false && non_uniform_discard_func(); + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:14:20 note: calling 'non_uniform_discard_func' may cause subsequent control flow to be non-uniform + let b = false && non_uniform_discard_func(); + ^^^^^^^^^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (non_uniform_global == 42) { + ^^ + +test:7:7 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (non_uniform_global == 42) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ShortCircuiting_NoReconvergeBoth) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn non_uniform_discard_func() -> bool { + if (non_uniform_global == 42) { + discard; + } + return false; +} + +fn main() { + let b = non_uniform_discard_func() && non_uniform_discard_func(); + workgroupBarrier(); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:3 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:14:41 note: calling 'non_uniform_discard_func' may cause subsequent control flow to be non-uniform + let b = non_uniform_discard_func() && non_uniform_discard_func(); + ^^^^^^^^^^^^^^^^^^^^^^^^ + +test:7:3 note: control flow depends on non-uniform value + if (non_uniform_global == 42) { + ^^ + +test:7:7 note: reading from read_write storage buffer 'non_uniform_global' may result in a non-uniform value + if (non_uniform_global == 42) { + ^^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, ShortCircuiting_ReconvergeLHS) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn uniform_discard_func() -> bool { + if (true) { + discard; + } + return false; +} + +fn main() { + let b = uniform_discard_func() && false; + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ShortCircuiting_ReconvergeRHS) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn uniform_discard_func() -> bool { + if (true) { + discard; + } + return false; +} + +fn main() { + let b = false && uniform_discard_func(); + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ShortCircuiting_ReconvergeBoth) { + std::string src = R"( +@group(0) @binding(0) var non_uniform_global : i32; + +var p : i32; + +fn uniform_discard_func() -> bool { + if (true) { + discard; + } + return false; +} + +fn main() { + let b = uniform_discard_func() && uniform_discard_func(); + workgroupBarrier(); +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, DeadCode_AfterReturn) { + // Dead code after a return statement shouldn't cause uniformity errors. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + return; + if (non_uniform == 42) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, DeadCode_AfterDiscard) { + // Dead code after a discard statement shouldn't cause uniformity errors. + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + discard; + if (non_uniform == 42) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, ArrayLength) { + std::string src = R"( +@group(0) @binding(0) var arr : array; + +fn foo() { + for (var i = 0u; i < arrayLength(&arr); i++) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, WorkgroupAtomics) { + std::string src = R"( +var a : atomic; + +fn foo() { + if (atomicAdd(&a, 1) == 1) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:6:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (atomicAdd(&a, 1) == 1) { + ^^ + +test:5:18 note: reading from workgroup storage variable 'a' may result in a non-uniform value + if (atomicAdd(&a, 1) == 1) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, StorageAtomics) { + std::string src = R"( +@group(0) @binding(0) var a : atomic; + +fn foo() { + if (atomicAdd(&a, 1) == 1) { + storageBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:6:5 warning: 'storageBarrier' must only be called from uniform control flow + storageBarrier(); + ^^^^^^^^^^^^^^ + +test:5:3 note: control flow depends on non-uniform value + if (atomicAdd(&a, 1) == 1) { + ^^ + +test:5:18 note: reading from read_write storage buffer 'a' may result in a non-uniform value + if (atomicAdd(&a, 1) == 1) { + ^ +)"); +} + +TEST_F(UniformityAnalysisTest, DisableAnalysisWithExtension) { + std::string src = R"( +enable chromium_disable_uniformity_analysis; + +@group(0) @binding(0) var rw : i32; + +fn foo() { + if (rw == 0) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, true); +} + +TEST_F(UniformityAnalysisTest, StressGraphTraversalDepth) { + // Create a function with a very long sequence of variable declarations and assignments to + // test traversals of very deep graphs. This requires a non-recursive traversal algorithm. + ProgramBuilder b; + auto& ty = b.ty; + + // var v0 : i32 = 0i; + // fn foo() { + // let v1 = v0; + // let v2 = v1; + // ... + // let v{N} = v{N-1}; + // if (v{N} == 0) { + // workgroupBarrier(); + // } + // } + b.GlobalVar("v0", ty.i32(), ast::StorageClass::kPrivate, b.Expr(0_i)); + utils::Vector foo_body; + std::string v_last = "v0"; + for (int i = 1; i < 100000; i++) { + auto v = "v" + std::to_string(i); + foo_body.Push(b.Decl(b.Var(v, b.Expr(v_last)))); + v_last = v; + } + foo_body.Push(b.If(b.Equal(v_last, 0_i), b.Block(b.CallStmt(b.Call("workgroupBarrier"))))); + b.Func("foo", utils::Empty, ty.void_(), foo_body); + + // TODO(jrprice): Expect false when uniformity issues become errors. + EXPECT_TRUE(RunTest(std::move(b))) << error_; + EXPECT_EQ(error_, + R"(warning: 'workgroupBarrier' must only be called from uniform control flow +note: control flow depends on non-uniform value +note: reading from module-scope private variable 'v0' may result in a non-uniform value)"); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Tests for the quality of the error messages produced by the analysis. +//////////////////////////////////////////////////////////////////////////////// + +TEST_F(UniformityAnalysisTest, Error_CallUserThatCallsBuiltinDirectly) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn foo() { + workgroupBarrier(); +} + +fn main() { + if (non_uniform == 42) { + foo(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:10:5 warning: 'foo' must only be called from uniform control flow + foo(); + ^^^ + +test:5:3 note: 'foo' requires uniformity because it calls workgroupBarrier + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:9:3 note: control flow depends on non-uniform value + if (non_uniform == 42) { + ^^ + +test:9:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 42) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Error_CallUserThatCallsBuiltinIndirectly) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn zoo() { + workgroupBarrier(); +} + +fn bar() { + zoo(); +} + +fn foo() { + bar(); +} + +fn main() { + if (non_uniform == 42) { + foo(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:18:5 warning: 'foo' must only be called from uniform control flow + foo(); + ^^^ + +test:5:3 note: 'foo' requires uniformity because it indirectly calls workgroupBarrier + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:17:3 note: control flow depends on non-uniform value + if (non_uniform == 42) { + ^^ + +test:17:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + if (non_uniform == 42) { + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Error_ParametersRequireUniformityInChain) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn zoo(a : i32) { + if (a == 42) { + workgroupBarrier(); + } +} + +fn bar(b : i32) { + zoo(b); +} + +fn foo(c : i32) { + bar(c); +} + +fn main() { + foo(non_uniform); +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:19:7 warning: parameter 'c' of 'foo' must be uniform + foo(non_uniform); + ^^^^^^^^^^^ + +test:15:7 note: parameter 'b' of 'bar' must be uniform + bar(c); + ^ + +test:11:7 note: parameter 'a' of 'zoo' must be uniform + zoo(b); + ^ + +test:6:5 note: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:19:7 note: reading from read_write storage buffer 'non_uniform' may result in a non-uniform value + foo(non_uniform); + ^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Error_ReturnValueMayBeNonUniformChain) { + std::string src = R"( +@group(0) @binding(0) var non_uniform : i32; + +fn zoo() -> i32 { + return non_uniform; +} + +fn bar() -> i32 { + return zoo(); +} + +fn foo() -> i32 { + return bar(); +} + +fn main() { + if (foo() == 42) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:18:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:17:3 note: control flow depends on non-uniform value + if (foo() == 42) { + ^^ + +test:17:7 note: return value of 'foo' may be non-uniform + if (foo() == 42) { + ^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Error_SubsequentControlFlowMayBeNonUniform) { + // Make sure we correctly identify the function call as the source of non-uniform control flow + // and not the if statement with the uniform condition. + std::string src = R"( +@group(0) @binding(0) var uniform_value : i32; +@group(0) @binding(1) var non_uniform_value : i32; + +fn foo() -> i32 { + if (non_uniform_value == 0) { + return 5; + } + return 6; +} + +fn main() { + foo(); + if (uniform_value == 42) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:3 note: calling 'foo' may cause subsequent control flow to be non-uniform + foo(); + ^^^ + +test:6:3 note: control flow depends on non-uniform value + if (non_uniform_value == 0) { + ^^ + +test:6:7 note: reading from read_write storage buffer 'non_uniform_value' may result in a non-uniform value + if (non_uniform_value == 0) { + ^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Error_ParameterRequiredToBeUniformForSubsequentControlFlow) { + // Make sure we correctly identify the function call as the source of non-uniform control flow + // and not the if statement with the uniform condition. + std::string src = R"( +@group(0) @binding(0) var uniform_value : i32; +@group(0) @binding(1) var non_uniform_value : i32; + +fn foo(x : i32) -> i32 { + if (x == 0) { + return 5; + } + return 6; +} + +fn main() { + foo(non_uniform_value); + if (uniform_value == 42) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:7 note: non-uniform function call argument causes subsequent control flow to be non-uniform + foo(non_uniform_value); + ^^^^^^^^^^^^^^^^^ + +test:6:3 note: control flow depends on non-uniform value + if (x == 0) { + ^^ + +test:6:7 note: reading from 'x' may result in a non-uniform value + if (x == 0) { + ^ + +test:13:7 note: reading from read_write storage buffer 'non_uniform_value' may result in a non-uniform value + foo(non_uniform_value); + ^^^^^^^^^^^^^^^^^ +)"); +} + +TEST_F(UniformityAnalysisTest, Error_ShortCircuitingExprCausesNonUniformControlFlow) { + // Make sure we correctly identify the short-circuit as the source of non-uniform control flow + // and not the if statement with the uniform condition. + std::string src = R"( +@group(0) @binding(0) var uniform_value : i32; +@group(0) @binding(1) var non_uniform_value : i32; + +fn non_uniform_discard_func() -> bool { + if (non_uniform_value == 42) { + discard; + } + return false; +} + +fn main() { + let b = non_uniform_discard_func() && true; + if (uniform_value == 42) { + workgroupBarrier(); + } +} +)"; + + RunTest(src, false); + EXPECT_EQ(error_, + R"(test:15:5 warning: 'workgroupBarrier' must only be called from uniform control flow + workgroupBarrier(); + ^^^^^^^^^^^^^^^^ + +test:13:11 note: calling 'non_uniform_discard_func' may cause subsequent control flow to be non-uniform + let b = non_uniform_discard_func() && true; + ^^^^^^^^^^^^^^^^^^^^^^^^ + +test:6:3 note: control flow depends on non-uniform value + if (non_uniform_value == 42) { + ^^ + +test:6:7 note: reading from read_write storage buffer 'non_uniform_value' may result in a non-uniform value + if (non_uniform_value == 42) { + ^^^^^^^^^^^^^^^^^ +)"); +} + +} // namespace +} // namespace tint::resolver diff --git a/src/tint/resolver/validation_test.cc b/src/tint/resolver/validation_test.cc index 65d73c4056..cbd05c126a 100644 --- a/src/tint/resolver/validation_test.cc +++ b/src/tint/resolver/validation_test.cc @@ -50,24 +50,32 @@ using ResolverValidationTest = ResolverTest; class FakeStmt final : public Castable { public: - FakeStmt(ProgramID pid, Source src) : Base(pid, src) {} + FakeStmt(ProgramID pid, ast::NodeID nid, Source src) : Base(pid, nid, src) {} FakeStmt* Clone(CloneContext*) const override { return nullptr; } }; class FakeExpr final : public Castable { public: - FakeExpr(ProgramID pid, Source src) : Base(pid, src) {} + FakeExpr(ProgramID pid, ast::NodeID nid, Source src) : Base(pid, nid, src) {} FakeExpr* Clone(CloneContext*) const override { return nullptr; } }; TEST_F(ResolverValidationTest, WorkgroupMemoryUsedInVertexStage) { - Global(Source{{1, 2}}, "wg", ty.vec4(), ast::StorageClass::kWorkgroup); - Global("dst", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar(Source{{1, 2}}, "wg", ty.vec4(), ast::StorageClass::kWorkgroup); + GlobalVar("dst", ty.vec4(), ast::StorageClass::kPrivate); auto* stmt = Assign(Expr("dst"), Expr(Source{{3, 4}}, "wg")); - Func(Source{{9, 10}}, "f0", ast::VariableList{}, ty.vec4(), {stmt, Return(Expr("dst"))}, - ast::AttributeList{Stage(ast::PipelineStage::kVertex)}, - ast::AttributeList{Builtin(ast::Builtin::kPosition)}); + Func(Source{{9, 10}}, "f0", utils::Empty, ty.vec4(), + utils::Vector{ + stmt, + Return(Expr("dst")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -80,19 +88,24 @@ TEST_F(ResolverValidationTest, WorkgroupMemoryUsedInFragmentStage) { // var dst : vec4; // fn f2(){ dst = wg; } // fn f1() { f2(); } - // @stage(fragment) + // @fragment // fn f0() { // f1(); //} - Global(Source{{1, 2}}, "wg", ty.vec4(), ast::StorageClass::kWorkgroup); - Global("dst", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar(Source{{1, 2}}, "wg", ty.vec4(), ast::StorageClass::kWorkgroup); + GlobalVar("dst", ty.vec4(), ast::StorageClass::kPrivate); auto* stmt = Assign(Expr("dst"), Expr(Source{{3, 4}}, "wg")); - Func(Source{{5, 6}}, "f2", {}, ty.void_(), {stmt}); - Func(Source{{7, 8}}, "f1", {}, ty.void_(), {CallStmt(Call("f2"))}); - Func(Source{{9, 10}}, "f0", {}, ty.void_(), {CallStmt(Call("f1"))}, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + Func(Source{{5, 6}}, "f2", utils::Empty, ty.void_(), utils::Vector{stmt}); + Func(Source{{7, 8}}, "f1", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("f2")), + }); + Func(Source{{9, 10}}, "f0", utils::Empty, ty.void_(), utils::Vector{CallStmt(Call("f1"))}, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -116,7 +129,7 @@ TEST_F(ResolverValidationTest, UnhandledStmt) { TEST_F(ResolverValidationTest, Stmt_If_NonBool) { // if (1.23f) {} - WrapInFunction(If(Expr(Source{{12, 34}}, 1.23f), Block())); + WrapInFunction(If(Expr(Source{{12, 34}}, 1.23_f), Block())); EXPECT_FALSE(r()->Resolve()); @@ -126,7 +139,7 @@ TEST_F(ResolverValidationTest, Stmt_If_NonBool) { TEST_F(ResolverValidationTest, Stmt_ElseIf_NonBool) { // else if (1.23f) {} - WrapInFunction(If(Expr(true), Block(), Else(If(Expr(Source{{12, 34}}, 1.23f), Block())))); + WrapInFunction(If(Expr(true), Block(), Else(If(Expr(Source{{12, 34}}, 1.23_f), Block())))); EXPECT_FALSE(r()->Resolve()); @@ -145,7 +158,7 @@ TEST_F(ResolverValidationTest, Expr_ErrUnknownExprType) { } TEST_F(ResolverValidationTest, Expr_DontCall_Function) { - Func("func", {}, ty.void_(), {}, {}); + Func("func", utils::Empty, ty.void_(), utils::Empty, {}); WrapInFunction(Expr(Source{{{3, 3}, {3, 8}}}, "func")); EXPECT_FALSE(r()->Resolve()); @@ -213,11 +226,11 @@ TEST_F(ResolverValidationTest, UsingUndefinedVariableGlobalVariable_Pass) { // return; // } - Global("global_var", ty.f32(), ast::StorageClass::kPrivate, Expr(2.1f)); + GlobalVar("global_var", ty.f32(), ast::StorageClass::kPrivate, Expr(2.1_f)); - Func("my_func", ast::VariableList{}, ty.void_(), - { - Assign(Expr(Source{{12, 34}}, "global_var"), 3.14f), + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Expr(Source{{12, 34}}, "global_var"), 3.14_f), Return(), }); @@ -229,14 +242,14 @@ TEST_F(ResolverValidationTest, UsingUndefinedVariableInnerScope_Fail) { // if (true) { var a : f32 = 2.0; } // a = 3.14; // } - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(2.0f)); + auto* var = Var("a", ty.f32(), Expr(2_f)); auto* cond = Expr(true); auto* body = Block(Decl(var)); SetSource(Source{{12, 34}}); auto* lhs = Expr(Source{{12, 34}}, "a"); - auto* rhs = Expr(3.14f); + auto* rhs = Expr(3.14_f); auto* outer_body = Block(If(cond, body), Assign(lhs, rhs)); @@ -251,10 +264,10 @@ TEST_F(ResolverValidationTest, UsingUndefinedVariableOuterScope_Pass) { // var a : f32 = 2.0; // if (true) { a = 3.14; } // } - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(2.0f)); + auto* var = Var("a", ty.f32(), Expr(2_f)); auto* lhs = Expr(Source{{12, 34}}, "a"); - auto* rhs = Expr(3.14f); + auto* rhs = Expr(3.14_f); auto* cond = Expr(true); auto* body = Block(Assign(lhs, rhs)); @@ -271,11 +284,11 @@ TEST_F(ResolverValidationTest, UsingUndefinedVariableDifferentScope_Fail) { // { var a : f32 = 2.0; } // { a = 3.14; } // } - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone, Expr(2.0f)); + auto* var = Var("a", ty.f32(), Expr(2_f)); auto* first_body = Block(Decl(var)); auto* lhs = Expr(Source{{12, 34}}, "a"); - auto* rhs = Expr(3.14f); + auto* rhs = Expr(3.14_f); auto* second_body = Block(Assign(lhs, rhs)); auto* outer_body = Block(first_body, second_body); @@ -289,32 +302,34 @@ TEST_F(ResolverValidationTest, UsingUndefinedVariableDifferentScope_Fail) { TEST_F(ResolverValidationTest, StorageClass_FunctionVariableWorkgroupClass) { auto* var = Var("var", ty.i32(), ast::StorageClass::kWorkgroup); - auto* stmt = Decl(var); - Func("func", ast::VariableList{}, ty.void_(), {stmt}, ast::AttributeList{}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(var), + }); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "error: function variable has a non-function storage class"); + EXPECT_EQ(r()->error(), + "error: function-scope 'var' declaration must use 'function' storage class"); } TEST_F(ResolverValidationTest, StorageClass_FunctionVariableI32) { auto* var = Var("s", ty.i32(), ast::StorageClass::kPrivate); - auto* stmt = Decl(var); - Func("func", ast::VariableList{}, ty.void_(), {stmt}, ast::AttributeList{}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(var), + }); EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "error: function variable has a non-function storage class"); + EXPECT_EQ(r()->error(), + "error: function-scope 'var' declaration must use 'function' storage class"); } TEST_F(ResolverValidationTest, StorageClass_SamplerExplicitStorageClass) { auto* t = ty.sampler(ast::SamplerKind::kSampler); - Global(Source{{12, 34}}, "var", t, ast::StorageClass::kHandle, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{12, 34}}, "var", t, ast::StorageClass::kHandle, Binding(0), Group(0)); EXPECT_FALSE(r()->Resolve()); @@ -324,11 +339,7 @@ TEST_F(ResolverValidationTest, StorageClass_SamplerExplicitStorageClass) { TEST_F(ResolverValidationTest, StorageClass_TextureExplicitStorageClass) { auto* t = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32()); - Global(Source{{12, 34}}, "var", t, ast::StorageClass::kHandle, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar(Source{{12, 34}}, "var", t, ast::StorageClass::kHandle, Binding(0), Group(0)); EXPECT_FALSE(r()->Resolve()) << r()->error(); @@ -337,7 +348,7 @@ TEST_F(ResolverValidationTest, StorageClass_TextureExplicitStorageClass) { } TEST_F(ResolverValidationTest, Expr_MemberAccessor_VectorSwizzle_BadChar) { - Global("my_vec", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("my_vec", ty.vec3(), ast::StorageClass::kPrivate); auto* ident = Expr(Source{{{3, 3}, {3, 7}}}, "xyqz"); @@ -349,7 +360,7 @@ TEST_F(ResolverValidationTest, Expr_MemberAccessor_VectorSwizzle_BadChar) { } TEST_F(ResolverValidationTest, Expr_MemberAccessor_VectorSwizzle_MixedChars) { - Global("my_vec", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("my_vec", ty.vec4(), ast::StorageClass::kPrivate); auto* ident = Expr(Source{{{3, 3}, {3, 7}}}, "rgyw"); @@ -362,7 +373,7 @@ TEST_F(ResolverValidationTest, Expr_MemberAccessor_VectorSwizzle_MixedChars) { } TEST_F(ResolverValidationTest, Expr_MemberAccessor_VectorSwizzle_BadLength) { - Global("my_vec", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("my_vec", ty.vec3(), ast::StorageClass::kPrivate); auto* ident = Expr(Source{{{3, 3}, {3, 8}}}, "zzzzz"); auto* mem = MemberAccessor("my_vec", ident); @@ -373,7 +384,7 @@ TEST_F(ResolverValidationTest, Expr_MemberAccessor_VectorSwizzle_BadLength) { } TEST_F(ResolverValidationTest, Expr_MemberAccessor_VectorSwizzle_BadIndex) { - Global("my_vec", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("my_vec", ty.vec2(), ast::StorageClass::kPrivate); auto* ident = Expr(Source{{3, 3}}, "z"); auto* mem = MemberAccessor("my_vec", ident); @@ -411,7 +422,11 @@ TEST_F(ResolverValidationTest, EXpr_MemberAccessor_FuncGoodParent) { auto* z = Expr(Source{{{3, 3}, {3, 8}}}, "z"); auto* accessor_expr = MemberAccessor(star_p, z); auto* x = Var("x", ty.f32(), accessor_expr); - Func("func", {p}, ty.f32(), {Decl(x), Return(x)}); + Func("func", utils::Vector{p}, ty.f32(), + utils::Vector{ + Decl(x), + Return(x), + }); EXPECT_TRUE(r()->Resolve()) << r()->error(); } @@ -425,7 +440,11 @@ TEST_F(ResolverValidationTest, EXpr_MemberAccessor_FuncBadParent) { auto* accessor_expr = MemberAccessor(p, z); auto* star_p = Deref(accessor_expr); auto* x = Var("x", ty.f32(), star_p); - Func("func", {p}, ty.f32(), {Decl(x), Return(x)}); + Func("func", utils::Vector{p}, ty.f32(), + utils::Vector{ + Decl(x), + Return(x), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), @@ -445,7 +464,7 @@ TEST_F(ResolverValidationTest, // } auto error_loc = Source{{12, 34}}; - auto* body = Block(Continue(), Decl(error_loc, Var("z", ty.i32(), ast::StorageClass::kNone))); + auto* body = Block(Continue(), Decl(error_loc, Var("z", ty.i32()))); auto* continuing = Block(Assign(Expr("z"), 2_i)); auto* loop_stmt = Loop(body, continuing); WrapInFunction(loop_stmt); @@ -470,9 +489,8 @@ TEST_F(ResolverValidationTest, Stmt_Loop_ContinueInLoopBodyAfterDecl_UsageInCont // } // } - auto* body = - Block(If(false, Block(Break())), // - Decl(Var("z", ty.i32(), ast::StorageClass::kNone)), Block(Block(Block(Continue())))); + auto* body = Block(If(false, Block(Break())), // + Decl(Var("z", ty.i32())), Block(Block(Block(Continue())))); auto* continuing = Block(Assign(Expr("z"), 2_i)); auto* loop_stmt = Loop(body, continuing); WrapInFunction(loop_stmt); @@ -494,8 +512,8 @@ TEST_F(ResolverValidationTest, Stmt_Loop_ContinueInLoopBodySubscopeBeforeDecl_Us auto cont_loc = Source{{12, 34}}; auto decl_loc = Source{{56, 78}}; auto ref_loc = Source{{90, 12}}; - auto* body = Block(If(Expr(true), Block(Continue(cont_loc))), - Decl(Var(decl_loc, "z", ty.i32(), ast::StorageClass::kNone))); + auto* body = + Block(If(Expr(true), Block(Continue(cont_loc))), Decl(Var(decl_loc, "z", ty.i32()))); auto* continuing = Block(Assign(Expr(ref_loc, "z"), 2_i)); auto* loop_stmt = Loop(body, continuing); WrapInFunction(loop_stmt); @@ -524,8 +542,8 @@ TEST_F(ResolverValidationTest, auto cont_loc = Source{{12, 34}}; auto decl_loc = Source{{56, 78}}; auto ref_loc = Source{{90, 12}}; - auto* body = Block(If(Expr(true), Block(Continue(cont_loc))), - Decl(Var(decl_loc, "z", ty.i32(), ast::StorageClass::kNone))); + auto* body = + Block(If(Expr(true), Block(Continue(cont_loc))), Decl(Var(decl_loc, "z", ty.i32()))); auto* continuing = Block(If(Expr(true), Block(Assign(Expr(ref_loc, "z"), 2_i)))); auto* loop_stmt = Loop(body, continuing); @@ -555,8 +573,8 @@ TEST_F(ResolverValidationTest, Stmt_Loop_ContinueInLoopBodySubscopeBeforeDecl_Us auto cont_loc = Source{{12, 34}}; auto decl_loc = Source{{56, 78}}; auto ref_loc = Source{{90, 12}}; - auto* body = Block(If(Expr(true), Block(Continue(cont_loc))), - Decl(Var(decl_loc, "z", ty.i32(), ast::StorageClass::kNone))); + auto* body = + Block(If(Expr(true), Block(Continue(cont_loc))), Decl(Var(decl_loc, "z", ty.i32()))); auto* compare = create(ast::BinaryOp::kLessThan, Expr(ref_loc, "z"), Expr(2_i)); auto* continuing = Block(If(compare, Block())); @@ -587,8 +605,8 @@ TEST_F(ResolverValidationTest, auto cont_loc = Source{{12, 34}}; auto decl_loc = Source{{56, 78}}; auto ref_loc = Source{{90, 12}}; - auto* body = Block(If(Expr(true), Block(Continue(cont_loc))), - Decl(Var(decl_loc, "z", ty.i32(), ast::StorageClass::kNone))); + auto* body = + Block(If(Expr(true), Block(Continue(cont_loc))), Decl(Var(decl_loc, "z", ty.i32()))); auto* continuing = Block(Loop(Block(Assign(Expr(ref_loc, "z"), 2_i)))); auto* loop_stmt = Loop(body, continuing); @@ -617,8 +635,8 @@ TEST_F(ResolverValidationTest, Stmt_Loop_ContinueInNestedLoopBodyBeforeDecl_Usag auto* inner_loop = Loop(Block( // If(true, Block(Continue())), // Break())); - auto* body = Block(inner_loop, // - Decl(Var("z", ty.i32(), ast::StorageClass::kNone)), // + auto* body = Block(inner_loop, // + Decl(Var("z", ty.i32())), // Break()); auto* continuing = Block(Assign("z", 2_i)); auto* loop_stmt = Loop(body, continuing); @@ -645,8 +663,8 @@ TEST_F(ResolverValidationTest, auto* inner_loop = Loop(Block(If(true, Block(Continue())), // Break())); - auto* body = Block(inner_loop, // - Decl(Var("z", ty.i32(), ast::StorageClass::kNone)), // + auto* body = Block(inner_loop, // + Decl(Var("z", ty.i32())), // Break()); auto* continuing = Block(If(Expr(true), Block(Assign("z", 2_i)))); auto* loop_stmt = Loop(body, continuing); @@ -673,8 +691,8 @@ TEST_F(ResolverValidationTest, Stmt_Loop_ContinueInNestedLoopBodyBeforeDecl_Usag auto* inner_loop = Loop(Block(If(true, Block(Continue())), // Break())); - auto* body = Block(inner_loop, // - Decl(Var("z", ty.i32(), ast::StorageClass::kNone)), // + auto* body = Block(inner_loop, // + Decl(Var("z", ty.i32())), // Break()); auto* continuing = Block(Loop(Block(Assign("z", 2_i), // Break()))); @@ -695,9 +713,8 @@ TEST_F(ResolverTest, Stmt_Loop_ContinueInLoopBodyAfterDecl_UsageInContinuing) { // } auto error_loc = Source{{12, 34}}; - auto* body = - Block(Decl(Var("z", ty.i32(), ast::StorageClass::kNone)), If(true, Block(Continue())), // - Break()); + auto* body = Block(Decl(Var("z", ty.i32())), If(true, Block(Continue())), // + Break()); auto* continuing = Block(Assign(Expr(error_loc, "z"), 2_i)); auto* loop_stmt = Loop(body, continuing); WrapInFunction(loop_stmt); @@ -792,8 +809,14 @@ TEST_F(ResolverTest, Stmt_Loop_DiscardInContinuing_Indirect_ViaCall) { // } // } - Func("MayDiscard", {}, ty.void_(), {If(true, Block(Discard()))}); - Func("SomeFunc", {}, ty.void_(), {CallStmt(Call("MayDiscard"))}); + Func("MayDiscard", utils::Empty, ty.void_(), + utils::Vector{ + If(true, Block(Discard())), + }); + Func("SomeFunc", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("MayDiscard")), + }); WrapInFunction(Loop( // outer loop Block(), // outer loop block @@ -912,8 +935,14 @@ TEST_F(ResolverTest, Stmt_ForLoop_DiscardInContinuing_Indirect_ViaCall) { // break; // } - Func("MayDiscard", {}, ty.void_(), {If(true, Block(Discard()))}); - Func("F", {}, ty.void_(), {CallStmt(Call("MayDiscard"))}); + Func("MayDiscard", utils::Empty, ty.void_(), + utils::Vector{ + If(true, Block(Discard())), + }); + Func("F", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("MayDiscard")), + }); WrapInFunction(For(nullptr, nullptr, Loop(Source{{56, 78}}, // @@ -966,12 +995,32 @@ TEST_F(ResolverTest, Stmt_ForLoop_CondIsNotBool) { // for (; 1.0f; ) { // } - WrapInFunction(For(nullptr, Expr(Source{{12, 34}}, 1.0f), nullptr, Block())); + WrapInFunction(For(nullptr, Expr(Source{{12, 34}}, 1_f), nullptr, Block())); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: for-loop condition must be bool, got f32"); } +TEST_F(ResolverTest, Stmt_While_CondIsBoolRef) { + // var cond : bool = false; + // while (cond) { + // } + + auto* cond = Var("cond", ty.bool_(), Expr(false)); + WrapInFunction(Decl(cond), While("cond", Block())); + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverTest, Stmt_While_CondIsNotBool) { + // while (1.0f) { + // } + + WrapInFunction(While(Expr(Source{{12, 34}}, 1_f), Block())); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: while condition must be bool, got f32"); +} + TEST_F(ResolverValidationTest, Stmt_ContinueInLoop) { WrapInFunction(Loop(Block(If(false, Block(Break())), // Continue(Source{{12, 34}})))); @@ -1157,30 +1206,40 @@ TEST_F(ResolverValidationTest, Stmt_BreakNotInLoopOrSwitch) { } TEST_F(ResolverValidationTest, StructMemberDuplicateName) { - Structure("S", - {Member(Source{{12, 34}}, "a", ty.i32()), Member(Source{{56, 78}}, "a", ty.i32())}); + Structure("S", utils::Vector{ + Member(Source{{12, 34}}, "a", ty.i32()), + Member(Source{{56, 78}}, "a", ty.i32()), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "56:78 error: redefinition of 'a'\n12:34 note: previous definition " "is here"); } TEST_F(ResolverValidationTest, StructMemberDuplicateNameDifferentTypes) { - Structure("S", {Member(Source{{12, 34}}, "a", ty.bool_()), - Member(Source{{12, 34}}, "a", ty.vec3())}); + Structure("S", utils::Vector{ + Member(Source{{12, 34}}, "a", ty.bool_()), + Member(Source{{12, 34}}, "a", ty.vec3()), + }); EXPECT_FALSE(r()->Resolve()); EXPECT_EQ(r()->error(), "12:34 error: redefinition of 'a'\n12:34 note: previous definition " "is here"); } TEST_F(ResolverValidationTest, StructMemberDuplicateNamePass) { - Structure("S", {Member("a", ty.i32()), Member("b", ty.f32())}); - Structure("S1", {Member("a", ty.i32()), Member("b", ty.f32())}); + Structure("S", utils::Vector{ + Member("a", ty.i32()), + Member("b", ty.f32()), + }); + Structure("S1", utils::Vector{ + Member("a", ty.i32()), + Member("b", ty.f32()), + }); EXPECT_TRUE(r()->Resolve()); } TEST_F(ResolverValidationTest, NonPOTStructMemberAlignAttribute) { - Structure("S", { - Member("a", ty.f32(), {MemberAlign(Source{{12, 34}}, 3)}), + Structure("S", utils::Vector{ + Member("a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, 3_u)}), }); EXPECT_FALSE(r()->Resolve()); @@ -1188,8 +1247,8 @@ TEST_F(ResolverValidationTest, NonPOTStructMemberAlignAttribute) { } TEST_F(ResolverValidationTest, ZeroStructMemberAlignAttribute) { - Structure("S", { - Member("a", ty.f32(), {MemberAlign(Source{{12, 34}}, 0)}), + Structure("S", utils::Vector{ + Member("a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, 0_u)}), }); EXPECT_FALSE(r()->Resolve()); @@ -1197,8 +1256,8 @@ TEST_F(ResolverValidationTest, ZeroStructMemberAlignAttribute) { } TEST_F(ResolverValidationTest, ZeroStructMemberSizeAttribute) { - Structure("S", { - Member("a", ty.f32(), {MemberSize(Source{{12, 34}}, 0)}), + Structure("S", utils::Vector{ + Member("a", ty.f32(), utils::Vector{MemberSize(Source{{12, 34}}, 0)}), }); EXPECT_FALSE(r()->Resolve()); @@ -1206,8 +1265,9 @@ TEST_F(ResolverValidationTest, ZeroStructMemberSizeAttribute) { } TEST_F(ResolverValidationTest, OffsetAndSizeAttribute) { - Structure("S", { - Member(Source{{12, 34}}, "a", ty.f32(), {MemberOffset(0), MemberSize(4)}), + Structure("S", utils::Vector{ + Member(Source{{12, 34}}, "a", ty.f32(), + utils::Vector{MemberOffset(0), MemberSize(4)}), }); EXPECT_FALSE(r()->Resolve()); @@ -1217,8 +1277,9 @@ TEST_F(ResolverValidationTest, OffsetAndSizeAttribute) { } TEST_F(ResolverValidationTest, OffsetAndAlignAttribute) { - Structure("S", { - Member(Source{{12, 34}}, "a", ty.f32(), {MemberOffset(0), MemberAlign(4)}), + Structure("S", utils::Vector{ + Member(Source{{12, 34}}, "a", ty.f32(), + utils::Vector{MemberOffset(0), MemberAlign(4_u)}), }); EXPECT_FALSE(r()->Resolve()); @@ -1228,9 +1289,9 @@ TEST_F(ResolverValidationTest, OffsetAndAlignAttribute) { } TEST_F(ResolverValidationTest, OffsetAndAlignAndSizeAttribute) { - Structure("S", { + Structure("S", utils::Vector{ Member(Source{{12, 34}}, "a", ty.f32(), - {MemberOffset(0), MemberAlign(4), MemberSize(4)}), + utils::Vector{MemberOffset(0), MemberAlign(4_u), MemberSize(4)}), }); EXPECT_FALSE(r()->Resolve()); diff --git a/src/tint/resolver/validator.cc b/src/tint/resolver/validator.cc index a97c2bdaa0..08451f0466 100644 --- a/src/tint/resolver/validator.cc +++ b/src/tint/resolver/validator.cc @@ -48,6 +48,7 @@ #include "src/tint/ast/variable_decl_statement.h" #include "src/tint/ast/vector.h" #include "src/tint/ast/workgroup_attribute.h" +#include "src/tint/sem/abstract_numeric.h" #include "src/tint/sem/array.h" #include "src/tint/sem/atomic.h" #include "src/tint/sem/call.h" @@ -57,6 +58,7 @@ #include "src/tint/sem/function.h" #include "src/tint/sem/if_statement.h" #include "src/tint/sem/loop_statement.h" +#include "src/tint/sem/materialize.h" #include "src/tint/sem/member_accessor_expression.h" #include "src/tint/sem/multisampled_texture.h" #include "src/tint/sem/pointer.h" @@ -70,11 +72,13 @@ #include "src/tint/sem/type_constructor.h" #include "src/tint/sem/type_conversion.h" #include "src/tint/sem/variable.h" +#include "src/tint/sem/while_statement.h" #include "src/tint/utils/defer.h" #include "src/tint/utils/map.h" #include "src/tint/utils/math.h" #include "src/tint/utils/reverse.h" #include "src/tint/utils/scoped_assignment.h" +#include "src/tint/utils/string.h" #include "src/tint/utils/transform.h" namespace tint::resolver { @@ -137,7 +141,7 @@ void TraverseCallChain(diag::List& diagnostics, callback(f); return; } - if (f->TransitivelyCalledFunctions().contains(to)) { + if (f->TransitivelyCalledFunctions().Contains(to)) { TraverseCallChain(diagnostics, f, to, callback); callback(f); return; @@ -194,7 +198,7 @@ bool Validator::IsFixedFootprint(const sem::Type* type) const { // https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable-types bool Validator::IsHostShareable(const sem::Type* type) const { - if (type->IsAnyOf()) { + if (type->IsAnyOf()) { return true; } return Switch( @@ -235,6 +239,11 @@ const ast::Statement* Validator::ClosestContinuing(bool stop_at_loop, break; } } + if (Is(s->Parent())) { + if (stop_at_loop) { + break; + } + } } return nullptr; } @@ -276,22 +285,58 @@ bool Validator::StorageTexture(const ast::StorageTexture* t) const { return true; } -bool Validator::VariableConstructorOrCast(const ast::Variable* var, - ast::StorageClass storage_class, - const sem::Type* storage_ty, - const sem::Type* rhs_ty) const { - auto* value_type = rhs_ty->UnwrapRef(); // Implicit load of RHS - - // Value type has to match storage type - if (storage_ty != value_type) { - std::string decl = var->is_const ? "let" : "var"; - AddError("cannot initialize " + decl + " of type '" + sem_.TypeNameOf(storage_ty) + - "' with value of type '" + sem_.TypeNameOf(rhs_ty) + "'", - var->source); +bool Validator::SampledTexture(const sem::SampledTexture* t, const Source& source) const { + if (!t->type()->UnwrapRef()->is_numeric_scalar()) { + AddError("texture_2d: type must be f32, i32 or u32", source); return false; } - if (!var->is_const) { + return true; +} + +bool Validator::MultisampledTexture(const sem::MultisampledTexture* t, const Source& source) const { + if (t->dim() != ast::TextureDimension::k2d) { + AddError("only 2d multisampled textures are supported", source); + return false; + } + + if (!t->type()->UnwrapRef()->is_numeric_scalar()) { + AddError("texture_multisampled_2d: type must be f32, i32 or u32", source); + return false; + } + + return true; +} + +bool Validator::Materialize(const sem::Type* to, + const sem::Type* from, + const Source& source) const { + if (sem::Type::ConversionRank(from, to) == sem::Type::kNoConversion) { + AddError("cannot convert value of type '" + sem_.TypeNameOf(from) + "' to type '" + + sem_.TypeNameOf(to) + "'", + source); + return false; + } + return true; +} + +bool Validator::VariableInitializer(const ast::Variable* v, + ast::StorageClass storage_class, + const sem::Type* storage_ty, + const sem::Expression* initializer) const { + auto* initializer_ty = initializer->Type(); + auto* value_type = initializer_ty->UnwrapRef(); // Implicit load of RHS + + // Value type has to match storage type + if (storage_ty != value_type) { + std::stringstream s; + s << "cannot initialize " << v->Kind() << " of type '" << sem_.TypeNameOf(storage_ty) + << "' with value of type '" << sem_.TypeNameOf(initializer_ty) << "'"; + AddError(s.str(), v->source); + return false; + } + + if (v->Is()) { switch (storage_class) { case ast::StorageClass::kPrivate: case ast::StorageClass::kFunction: @@ -300,11 +345,11 @@ bool Validator::VariableConstructorOrCast(const ast::Variable* var, // https://gpuweb.github.io/gpuweb/wgsl/#var-and-let // Optionally has an initializer expression, if the variable is in the // private or function storage classes. - AddError("var of storage class '" + std::string(ast::ToString(storage_class)) + + AddError("var of storage class '" + utils::ToString(storage_class) + "' cannot have an initializer. var initializers are only " "supported for the storage classes " "'private' and 'function'", - var->source); + v->source); return false; } } @@ -348,6 +393,16 @@ bool Validator::StorageClassLayout(const sem::Type* store_ty, return true; } + // Temporally forbid using f16 types in "uniform" and "storage" storage class. + // TODO(tint:1473, tint:1502): Remove this error after f16 is supported in "uniform" and + // "storage" storage class but keep for "push_constant" storage class. + if (Is(sem::Type::DeepestElementOf(store_ty))) { + AddError( + "using f16 types in '" + utils::ToString(sc) + "' storage class is not implemented yet", + source); + return false; + } + if (auto* str = store_ty->As()) { for (size_t i = 0; i < str->Members().size(); ++i) { auto* const m = str->Members()[i]; @@ -364,7 +419,7 @@ bool Validator::StorageClassLayout(const sem::Type* store_ty, if (m->Offset() % required_align != 0) { AddError("the offset of a struct member of type '" + m->Type()->UnwrapRef()->FriendlyName(symbols_) + - "' in storage class '" + ast::ToString(sc) + + "' in storage class '" + utils::ToString(sc) + "' must be a multiple of " + std::to_string(required_align) + " bytes, but '" + member_name_of(m) + "' is currently at offset " + std::to_string(m->Offset()) + ". Consider setting @align(" + @@ -461,7 +516,19 @@ bool Validator::StorageClassLayout(const sem::Type* store_ty, } bool Validator::StorageClassLayout(const sem::Variable* var, + const ast::Extensions& enabled_extensions, ValidTypeStorageLayouts& layouts) const { + if (var->StorageClass() == ast::StorageClass::kPushConstant && + !enabled_extensions.Contains(ast::Extension::kChromiumExperimentalPushConstant) && + IsValidationEnabled(var->Declaration()->attributes, + ast::DisabledValidation::kIgnoreStorageClass)) { + AddError( + "use of variable storage class 'push_constant' requires enabling extension " + "'chromium_experimental_push_constant'", + var->Declaration()->source); + return false; + } + if (auto* str = var->Type()->UnwrapRef()->As()) { if (!StorageClassLayout(str, var->StorageClass(), str->Declaration()->source, layouts)) { AddNote("see declaration of variable", var->Declaration()->source); @@ -480,107 +547,150 @@ bool Validator::StorageClassLayout(const sem::Variable* var, return true; } +bool Validator::LocalVariable(const sem::Variable* v) const { + auto* decl = v->Declaration(); + return Switch( + decl, // + [&](const ast::Var* var) { + if (IsValidationEnabled(var->attributes, + ast::DisabledValidation::kIgnoreStorageClass)) { + if (!v->Type()->UnwrapRef()->IsConstructible()) { + AddError("function-scope 'var' must have a constructible type", + var->type ? var->type->source : var->source); + return false; + } + } + return Var(v); + }, // + [&](const ast::Let*) { return Let(v); }, // + [&](const ast::Const*) { return true; }, // + [&](Default) { + TINT_ICE(Resolver, diagnostics_) + << "Validator::Variable() called with a unknown variable type: " + << decl->TypeInfo().name; + return false; + }); +} + bool Validator::GlobalVariable( - const sem::Variable* var, - std::unordered_map constant_ids, - std::unordered_map atomic_composite_info) const { - auto* decl = var->Declaration(); - if (!NoDuplicateAttributes(decl->attributes)) { + const sem::GlobalVariable* global, + const std::unordered_map& override_ids, + const std::unordered_map& atomic_composite_info) const { + auto* decl = global->Declaration(); + bool ok = Switch( + decl, // + [&](const ast::Var* var) { + if (auto* init = global->Constructor(); + init && init->Stage() > sem::EvaluationStage::kOverride) { + AddError("module-scope 'var' initializer must be a constant or override expression", + init->Declaration()->source); + return false; + } + + if (global->StorageClass() == ast::StorageClass::kNone) { + AddError("module-scope 'var' declaration must have a storage class", decl->source); + return false; + } + + for (auto* attr : decl->attributes) { + bool is_shader_io_attribute = + attr->IsAnyOf(); + bool has_io_storage_class = global->StorageClass() == ast::StorageClass::kIn || + global->StorageClass() == ast::StorageClass::kOut; + if (!attr->IsAnyOf() && + (!is_shader_io_attribute || !has_io_storage_class)) { + AddError("attribute is not valid for module-scope 'var'", attr->source); + return false; + } + } + + // https://gpuweb.github.io/gpuweb/wgsl/#variable-declaration + // The access mode always has a default, and except for variables in the + // storage storage class, must not be written. + if (var->declared_access != ast::Access::kUndefined) { + if (global->StorageClass() == ast::StorageClass::kStorage) { + // The access mode for the storage address space can only be 'read' or + // 'read_write'. + if (var->declared_access == ast::Access::kWrite) { + AddError("access mode 'write' is not valid for the 'storage' address space", + decl->source); + return false; + } + } else { + AddError("only variables in storage class may declare an access mode", + decl->source); + return false; + } + } + + if (!AtomicVariable(global, atomic_composite_info)) { + return false; + } + + auto name = symbols_.NameFor(var->symbol); + if (sem::ParseBuiltinType(name) != sem::BuiltinType::kNone) { + AddError( + "'" + name + "' is a builtin and cannot be redeclared as a module-scope 'var'", + var->source); + return false; + } + + return Var(global); + }, + [&](const ast::Override*) { return Override(global, override_ids); }, + [&](const ast::Const*) { + if (!decl->attributes.IsEmpty()) { + AddError("attribute is not valid for module-scope 'const' declaration", + decl->attributes[0]->source); + return false; + } + return Const(global); + }, + [&](Default) { + TINT_ICE(Resolver, diagnostics_) + << "Validator::GlobalVariable() called with a unknown variable type: " + << decl->TypeInfo().name; + return false; + }); + + if (!ok) { return false; } - for (auto* attr : decl->attributes) { - if (decl->is_const) { - if (auto* id_attr = attr->As()) { - uint32_t id = id_attr->value; - auto it = constant_ids.find(id); - if (it != constant_ids.end() && it->second != var) { - AddError("pipeline constant IDs must be unique", attr->source); - AddNote( - "a pipeline constant with an ID of " + std::to_string(id) + - " was previously declared " - "here:", - ast::GetAttribute(it->second->Declaration()->attributes) - ->source); - return false; - } - if (id > 65535) { - AddError("pipeline constant IDs must be between 0 and 65535", attr->source); - return false; - } - } else { - AddError("attribute is not valid for constants", attr->source); - return false; - } - } else { - bool is_shader_io_attribute = - attr->IsAnyOf(); - bool has_io_storage_class = var->StorageClass() == ast::StorageClass::kInput || - var->StorageClass() == ast::StorageClass::kOutput; - if (!(attr->IsAnyOf()) && - (!is_shader_io_attribute || !has_io_storage_class)) { - AddError("attribute is not valid for variables", attr->source); - return false; - } - } - } - - if (var->StorageClass() == ast::StorageClass::kFunction) { - AddError( - "variables declared at module scope must not be in the function " - "storage class", - decl->source); + if (global->StorageClass() == ast::StorageClass::kFunction) { + AddError("module-scope 'var' must not use storage class 'function'", decl->source); return false; } - auto binding_point = decl->BindingPoint(); - switch (var->StorageClass()) { + switch (global->StorageClass()) { case ast::StorageClass::kUniform: case ast::StorageClass::kStorage: case ast::StorageClass::kHandle: { // https://gpuweb.github.io/gpuweb/wgsl/#resource-interface // Each resource variable must be declared with both group and binding // attributes. - if (!binding_point) { - AddError( - "resource variables require @group and @binding " - "attributes", - decl->source); + if (!decl->HasBindingPoint()) { + AddError("resource variables require @group and @binding attributes", decl->source); return false; } break; } - default: - if (binding_point.binding || binding_point.group) { + default: { + auto* binding_attr = ast::GetAttribute(decl->attributes); + auto* group_attr = ast::GetAttribute(decl->attributes); + if (binding_attr || group_attr) { // https://gpuweb.github.io/gpuweb/wgsl/#attribute-binding // Must only be applied to a resource variable - AddError( - "non-resource variables must not have @group or @binding " - "attributes", - decl->source); + AddError("non-resource variables must not have @group or @binding attributes", + decl->source); return false; } - } - - // https://gpuweb.github.io/gpuweb/wgsl/#variable-declaration - // The access mode always has a default, and except for variables in the - // storage storage class, must not be written. - if (var->StorageClass() != ast::StorageClass::kStorage && - decl->declared_access != ast::Access::kUndefined) { - AddError("only variables in storage class may declare an access mode", - decl->source); - return false; - } - - if (!decl->is_const) { - if (!AtomicVariable(var, atomic_composite_info)) { - return false; } } - return Variable(var); + return true; } // https://gpuweb.github.io/gpuweb/wgsl/#atomic-types @@ -624,95 +734,135 @@ bool Validator::AtomicVariable( return true; } -bool Validator::Variable(const sem::Variable* var) const { - auto* decl = var->Declaration(); - auto* storage_ty = var->Type()->UnwrapRef(); +bool Validator::Var(const sem::Variable* v) const { + auto* var = v->Declaration()->As(); + auto* storage_ty = v->Type()->UnwrapRef(); - if (var->Is()) { - auto name = symbols_.NameFor(decl->symbol); - if (sem::ParseBuiltinType(name) != sem::BuiltinType::kNone) { - auto* kind = var->Declaration()->is_const ? "let" : "var"; - AddError( - "'" + name + "' is a builtin and cannot be redeclared as a module-scope " + kind, - decl->source); - return false; - } - } - - if (!decl->is_const && !IsStorable(storage_ty)) { - AddError(sem_.TypeNameOf(storage_ty) + " cannot be used as the type of a var", - decl->source); + if (!IsStorable(storage_ty)) { + AddError(sem_.TypeNameOf(storage_ty) + " cannot be used as the type of a var", var->source); return false; } - if (decl->is_const && !var->Is() && - !(storage_ty->IsConstructible() || storage_ty->Is())) { - AddError(sem_.TypeNameOf(storage_ty) + " cannot be used as the type of a let", - decl->source); - return false; - } - - if (auto* r = storage_ty->As()) { - if (r->dim() != ast::TextureDimension::k2d) { - AddError("only 2d multisampled textures are supported", decl->source); - return false; - } - - if (!r->type()->UnwrapRef()->is_numeric_scalar()) { - AddError("texture_multisampled_2d: type must be f32, i32 or u32", decl->source); - return false; - } - } - - if (var->Is() && !decl->is_const && - IsValidationEnabled(decl->attributes, ast::DisabledValidation::kIgnoreStorageClass)) { - if (!var->Type()->UnwrapRef()->IsConstructible()) { - AddError("function variable must have a constructible type", - decl->type ? decl->type->source : decl->source); - return false; - } - } - - if (storage_ty->is_handle() && decl->declared_storage_class != ast::StorageClass::kNone) { + if (storage_ty->is_handle() && var->declared_storage_class != ast::StorageClass::kNone) { // https://gpuweb.github.io/gpuweb/wgsl/#module-scope-variables // If the store type is a texture type or a sampler type, then the // variable declaration must not have a storage class attribute. The // storage class will always be handle. AddError( "variables of type '" + sem_.TypeNameOf(storage_ty) + "' must not have a storage class", - decl->source); + var->source); return false; } - if (IsValidationEnabled(decl->attributes, ast::DisabledValidation::kIgnoreStorageClass) && - (decl->declared_storage_class == ast::StorageClass::kInput || - decl->declared_storage_class == ast::StorageClass::kOutput)) { - AddError("invalid use of input/output storage class", decl->source); + if (IsValidationEnabled(var->attributes, ast::DisabledValidation::kIgnoreStorageClass) && + (var->declared_storage_class == ast::StorageClass::kIn || + var->declared_storage_class == ast::StorageClass::kOut)) { + AddError("invalid use of input/output storage class", var->source); return false; } return true; } -bool Validator::FunctionParameter(const ast::Function* func, const sem::Variable* var) const { - if (!Variable(var)) { +bool Validator::Let(const sem::Variable* v) const { + auto* decl = v->Declaration(); + auto* storage_ty = v->Type()->UnwrapRef(); + + if (!(storage_ty->IsConstructible() || storage_ty->Is())) { + AddError(sem_.TypeNameOf(storage_ty) + " cannot be used as the type of a 'let'", + decl->source); + return false; + } + return true; +} + +bool Validator::Override( + const sem::Variable* v, + const std::unordered_map& override_ids) const { + auto* decl = v->Declaration(); + auto* storage_ty = v->Type()->UnwrapRef(); + + if (auto* init = v->Constructor(); init && init->Stage() > sem::EvaluationStage::kOverride) { + AddError("'override' initializer must be an override expression", + init->Declaration()->source); return false; } + for (auto* attr : decl->attributes) { + if (auto* id_attr = attr->As()) { + uint32_t id = id_attr->value; + if (id > std::numeric_limits::max()) { + AddError( + "override IDs must be between 0 and " + + std::to_string(std::numeric_limits::max()), + attr->source); + return false; + } + if (auto it = + override_ids.find(OverrideId{static_cast(id)}); + it != override_ids.end() && it->second != v) { + AddError("override IDs must be unique", attr->source); + AddNote("a override with an ID of " + std::to_string(id) + + " was previously declared here:", + ast::GetAttribute(it->second->Declaration()->attributes) + ->source); + return false; + } + } else { + AddError("attribute is not valid for 'override' declaration", attr->source); + return false; + } + } + + auto name = symbols_.NameFor(decl->symbol); + if (sem::ParseBuiltinType(name) != sem::BuiltinType::kNone) { + AddError("'" + name + "' is a builtin and cannot be redeclared as a 'override'", + decl->source); + return false; + } + + if (!storage_ty->is_scalar()) { + AddError(sem_.TypeNameOf(storage_ty) + " cannot be used as the type of a 'override'", + decl->source); + return false; + } + + if (storage_ty->Is()) { + AddError("'override' of type f16 is not implemented yet", decl->source); + return false; + } + + return true; +} + +bool Validator::Const(const sem::Variable* v) const { + auto* decl = v->Declaration(); + + auto name = symbols_.NameFor(decl->symbol); + if (sem::ParseBuiltinType(name) != sem::BuiltinType::kNone) { + AddError("'" + name + "' is a builtin and cannot be redeclared as a 'const'", decl->source); + return false; + } + + return true; +} + +bool Validator::Parameter(const ast::Function* func, const sem::Variable* var) const { auto* decl = var->Declaration(); + if (IsValidationDisabled(decl->attributes, ast::DisabledValidation::kFunctionParameter)) { + return true; + } + for (auto* attr : decl->attributes) { if (!func->IsEntryPoint() && !attr->Is()) { AddError("attribute is not valid for non-entry point function parameters", attr->source); return false; - } else if (!attr->IsAnyOf() && - (IsValidationEnabled(decl->attributes, - ast::DisabledValidation::kEntryPointParameter) && - IsValidationEnabled( - decl->attributes, - ast::DisabledValidation::kIgnoreConstructibleFunctionParameter))) { + } + if (!attr->IsAnyOf() && + (IsValidationEnabled(decl->attributes, + ast::DisabledValidation::kEntryPointParameter))) { AddError("attribute is not valid for function parameters", attr->source); return false; } @@ -731,14 +881,12 @@ bool Validator::FunctionParameter(const ast::Function* func, const sem::Variable } if (IsPlain(var->Type())) { - if (!var->Type()->IsConstructible() && - IsValidationEnabled(decl->attributes, - ast::DisabledValidation::kIgnoreConstructibleFunctionParameter)) { - AddError("store type of function parameter must be a constructible type", decl->source); + if (!var->Type()->IsConstructible()) { + AddError("type of function parameter must be constructible", decl->source); return false; } } else if (!var->Type()->IsAnyOf()) { - AddError("store type of function parameter cannot be " + sem_.TypeNameOf(var->Type()), + AddError("type of function parameter cannot be " + sem_.TypeNameOf(var->Type()), decl->source); return false; } @@ -756,7 +904,7 @@ bool Validator::BuiltinAttribute(const ast::BuiltinAttribute* attr, bool is_stage_mismatch = false; bool is_output = !is_input; switch (attr->builtin) { - case ast::Builtin::kPosition: + case ast::BuiltinValue::kPosition: if (stage != ast::PipelineStage::kNone && !((is_input && stage == ast::PipelineStage::kFragment) || (is_output && stage == ast::PipelineStage::kVertex))) { @@ -768,10 +916,10 @@ bool Validator::BuiltinAttribute(const ast::BuiltinAttribute* attr, return false; } break; - case ast::Builtin::kGlobalInvocationId: - case ast::Builtin::kLocalInvocationId: - case ast::Builtin::kNumWorkgroups: - case ast::Builtin::kWorkgroupId: + case ast::BuiltinValue::kGlobalInvocationId: + case ast::BuiltinValue::kLocalInvocationId: + case ast::BuiltinValue::kNumWorkgroups: + case ast::BuiltinValue::kWorkgroupId: if (stage != ast::PipelineStage::kNone && !(stage == ast::PipelineStage::kCompute && is_input)) { is_stage_mismatch = true; @@ -782,7 +930,7 @@ bool Validator::BuiltinAttribute(const ast::BuiltinAttribute* attr, return false; } break; - case ast::Builtin::kFragDepth: + case ast::BuiltinValue::kFragDepth: if (stage != ast::PipelineStage::kNone && !(stage == ast::PipelineStage::kFragment && !is_input)) { is_stage_mismatch = true; @@ -792,7 +940,7 @@ bool Validator::BuiltinAttribute(const ast::BuiltinAttribute* attr, return false; } break; - case ast::Builtin::kFrontFacing: + case ast::BuiltinValue::kFrontFacing: if (stage != ast::PipelineStage::kNone && !(stage == ast::PipelineStage::kFragment && is_input)) { is_stage_mismatch = true; @@ -802,7 +950,7 @@ bool Validator::BuiltinAttribute(const ast::BuiltinAttribute* attr, return false; } break; - case ast::Builtin::kLocalInvocationIndex: + case ast::BuiltinValue::kLocalInvocationIndex: if (stage != ast::PipelineStage::kNone && !(stage == ast::PipelineStage::kCompute && is_input)) { is_stage_mismatch = true; @@ -812,8 +960,8 @@ bool Validator::BuiltinAttribute(const ast::BuiltinAttribute* attr, return false; } break; - case ast::Builtin::kVertexIndex: - case ast::Builtin::kInstanceIndex: + case ast::BuiltinValue::kVertexIndex: + case ast::BuiltinValue::kInstanceIndex: if (stage != ast::PipelineStage::kNone && !(stage == ast::PipelineStage::kVertex && is_input)) { is_stage_mismatch = true; @@ -823,7 +971,7 @@ bool Validator::BuiltinAttribute(const ast::BuiltinAttribute* attr, return false; } break; - case ast::Builtin::kSampleMask: + case ast::BuiltinValue::kSampleMask: if (stage != ast::PipelineStage::kNone && !(stage == ast::PipelineStage::kFragment)) { is_stage_mismatch = true; } @@ -832,7 +980,7 @@ bool Validator::BuiltinAttribute(const ast::BuiltinAttribute* attr, return false; } break; - case ast::Builtin::kSampleIndex: + case ast::BuiltinValue::kSampleIndex: if (stage != ast::PipelineStage::kNone && !(stage == ast::PipelineStage::kFragment && is_input)) { is_stage_mismatch = true; @@ -898,17 +1046,11 @@ bool Validator::Function(const sem::Function* func, ast::PipelineStage stage) co } } - if (decl->params.size() > 255) { + if (decl->params.Length() > 255) { AddError("functions may declare at most 255 parameters", decl->source); return false; } - for (size_t i = 0; i < decl->params.size(); i++) { - if (!FunctionParameter(decl, func->Parameters()[i])) { - return false; - } - } - if (!func->ReturnType()->Is()) { if (!func->ReturnType()->IsConstructible()) { AddError("function return type must be a constructible type", @@ -942,9 +1084,8 @@ bool Validator::Function(const sem::Function* func, ast::PipelineStage stage) co ast::InvariantAttribute>() && (IsValidationEnabled(decl->attributes, ast::DisabledValidation::kEntryPointParameter) && - IsValidationEnabled( - decl->attributes, - ast::DisabledValidation::kIgnoreConstructibleFunctionParameter))) { + IsValidationEnabled(decl->attributes, + ast::DisabledValidation::kFunctionParameter))) { AddError("attribute is not valid for entry point return types", attr->source); return false; } @@ -979,7 +1120,7 @@ bool Validator::EntryPoint(const sem::Function* func, ast::PipelineStage stage) // already been seen, in order to catch conflicts. // TODO(jrprice): This state could be stored in sem::Function instead, and // then passed to sem::Function since it would be useful there too. - std::unordered_set builtins; + std::unordered_set builtins; std::unordered_set locations; enum class ParamOrRetType { kParameter, @@ -987,10 +1128,18 @@ bool Validator::EntryPoint(const sem::Function* func, ast::PipelineStage stage) }; // Inner lambda that is applied to a type and all of its members. - auto validate_entry_point_attributes_inner = [&](const ast::AttributeList& attrs, + auto validate_entry_point_attributes_inner = [&](utils::VectorRef attrs, const sem::Type* ty, Source source, ParamOrRetType param_or_ret, bool is_struct_member) { + // Temporally forbid using f16 types in entry point IO. + // TODO(tint:1473, tint:1502): Remove this error after f16 is supported in entry point + // IO. + if (Is(sem::Type::DeepestElementOf(ty))) { + AddError("entry point IO of f16 types is not implemented yet", source); + return false; + } + // Scan attributes for pipeline IO attributes. // Check for overlap with attributes that have been seen previously. const ast::Attribute* pipeline_io_attribute = nullptr; @@ -1107,7 +1256,7 @@ bool Validator::EntryPoint(const sem::Function* func, ast::PipelineStage stage) bool has_position = false; if (pipeline_io_attribute) { if (auto* builtin = pipeline_io_attribute->As()) { - has_position = (builtin->builtin == ast::Builtin::kPosition); + has_position = (builtin->builtin == ast::BuiltinValue::kPosition); } } if (!has_position) { @@ -1123,8 +1272,9 @@ bool Validator::EntryPoint(const sem::Function* func, ast::PipelineStage stage) }; // Outer lambda for validating the entry point attributes for a type. - auto validate_entry_point_attributes = [&](const ast::AttributeList& attrs, const sem::Type* ty, - Source source, ParamOrRetType param_or_ret) { + auto validate_entry_point_attributes = [&](utils::VectorRef attrs, + const sem::Type* ty, Source source, + ParamOrRetType param_or_ret) { if (!validate_entry_point_attributes_inner(attrs, ty, source, param_or_ret, /*is_struct_member*/ false)) { return false; @@ -1168,13 +1318,13 @@ bool Validator::EntryPoint(const sem::Function* func, ast::PipelineStage stage) } if (decl->PipelineStage() == ast::PipelineStage::kVertex && - builtins.count(ast::Builtin::kPosition) == 0) { + builtins.count(ast::BuiltinValue::kPosition) == 0) { // Check module-scope variables, as the SPIR-V sanitizer generates these. bool found = false; for (auto* global : func->TransitivelyReferencedGlobals()) { if (auto* builtin = ast::GetAttribute(global->Declaration()->attributes)) { - if (builtin->builtin == ast::Builtin::kPosition) { + if (builtin->builtin == ast::BuiltinValue::kPosition) { found = true; break; } @@ -1201,12 +1351,12 @@ bool Validator::EntryPoint(const sem::Function* func, ast::PipelineStage stage) // Validate there are no resource variable binding collisions std::unordered_map binding_points; - for (auto* var : func->TransitivelyReferencedGlobals()) { - auto* var_decl = var->Declaration(); - if (!var_decl->BindingPoint()) { + for (auto* global : func->TransitivelyReferencedGlobals()) { + auto* var_decl = global->Declaration()->As(); + if (!var_decl || !var_decl->HasBindingPoint()) { continue; } - auto bp = var->BindingPoint(); + auto bp = global->BindingPoint(); auto res = binding_points.emplace(bp, var_decl); if (!res.second && IsValidationEnabled(decl->attributes, @@ -1233,7 +1383,7 @@ bool Validator::EntryPoint(const sem::Function* func, ast::PipelineStage stage) return true; } -bool Validator::Statements(const ast::StatementList& stmts) const { +bool Validator::Statements(utils::VectorRef stmts) const { for (auto* stmt : stmts) { if (!sem_.Get(stmt)->IsReachable()) { /// TODO(https://github.com/gpuweb/gpuweb/issues/2378): This may need to @@ -1297,7 +1447,7 @@ bool Validator::BreakStatement(const sem::Statement* stmt, return fail("break statement is not directly in if statement block", stmt->Declaration()->source); } - if (block->Declaration()->statements.size() != 1) { + if (block->Declaration()->statements.Length() != 1) { return fail("if statement block contains multiple statements", block->Declaration()->source); } @@ -1356,6 +1506,28 @@ bool Validator::ContinueStatement(const sem::Statement* stmt, return true; } +bool Validator::Call(const sem::Call* call, sem::Statement* current_statement) const { + auto* expr = call->Declaration(); + bool is_call_stmt = + current_statement && Is(current_statement->Declaration(), + [&](auto* stmt) { return stmt->expr == expr; }); + if (is_call_stmt) { + return Switch( + call->Target(), // + [&](const sem::TypeConversion*) { + AddError("type conversion evaluated but not used", call->Declaration()->source); + return false; + }, + [&](const sem::TypeConstructor*) { + AddError("type constructor evaluated but not used", call->Declaration()->source); + return false; + }, + [&](Default) { return true; }); + } + + return true; +} + bool Validator::DiscardStatement(const sem::Statement* stmt, sem::Statement* current_statement) const { if (auto* continuing = ClosestContinuing(/*stop_at_loop*/ false, current_statement)) { @@ -1374,7 +1546,7 @@ bool Validator::FallthroughStatement(const sem::Statement* stmt) const { if (auto* c = As(block->Parent())) { if (block->Declaration()->Last() == stmt->Declaration()) { if (auto* s = As(c->Parent())) { - if (c->Declaration() != s->Declaration()->body.back()) { + if (c->Declaration() != s->Declaration()->body.Back()) { return true; } AddError( @@ -1415,6 +1587,22 @@ bool Validator::ForLoopStatement(const sem::ForLoopStatement* stmt) const { return true; } +bool Validator::WhileStatement(const sem::WhileStatement* stmt) const { + if (stmt->Behaviors().Empty()) { + AddError("while does not exit", stmt->Declaration()->source.Begin()); + return false; + } + if (auto* cond = stmt->Condition()) { + auto* cond_ty = cond->Type()->UnwrapRef(); + if (!cond_ty->Is()) { + AddError("while condition must be bool, got " + sem_.TypeNameOf(cond_ty), + stmt->Condition()->Declaration()->source); + return false; + } + } + return true; +} + bool Validator::IfStatement(const sem::IfStatement* stmt) const { auto* cond_ty = stmt->Condition()->Type()->UnwrapRef(); if (!cond_ty->Is()) { @@ -1428,9 +1616,14 @@ bool Validator::IfStatement(const sem::IfStatement* stmt) const { bool Validator::BuiltinCall(const sem::Call* call) const { if (call->Type()->Is()) { bool is_call_statement = false; - if (auto* call_stmt = As(call->Stmt()->Declaration())) { - if (call_stmt->expr == call->Declaration()) { - is_call_statement = true; + // Some built-in call are not owned by a statement, e.g. a built-in called in global + // variable declaration. Calling no-return-value built-in in these context is invalid as + // well. + if (auto* call_stmt = call->Stmt()) { + if (auto* call_stmt_ast = As(call_stmt->Declaration())) { + if (call_stmt_ast->expr == call->Declaration()) { + is_call_statement = true; + } } } if (!is_call_statement) { @@ -1457,16 +1650,16 @@ bool Validator::TextureBuiltinFunction(const sem::Call* call) const { auto& signature = builtin->Signature(); auto check_arg_is_constexpr = [&](sem::ParameterUsage usage, int min, int max) { - auto index = signature.IndexOf(usage); - if (index < 0) { + auto signed_index = signature.IndexOf(usage); + if (signed_index < 0) { return true; } + auto index = static_cast(signed_index); std::string name = sem::str(usage); auto* arg = call->Arguments()[index]; if (auto values = arg->ConstantValue()) { // Assert that the constant values are of the expected type. - if (!values.Type()->IsAnyOf() || - !values.ElementType()->Is()) { + if (!values->Type()->is_integer_scalar_or_vector()) { TINT_ICE(Resolver, diagnostics_) << "failed to resolve '" + func_name + "' " << name << " parameter type"; return false; @@ -1484,24 +1677,26 @@ bool Validator::TextureBuiltinFunction(const sem::Call* call) const { return ast::TraverseAction::Stop; }); if (is_const_expr) { - auto vector = builtin->Parameters()[index]->Type()->Is(); - for (size_t i = 0; i < values.Elements().size(); i++) { - auto value = values.Elements()[i].i32; - if (value < min || value > max) { - if (vector) { + if (auto* vector = builtin->Parameters()[index]->Type()->As()) { + for (size_t i = 0; i < vector->Width(); i++) { + auto value = values->Index(i)->As(); + if (value < min || value > max) { AddError("each component of the " + name + " argument must be at least " + std::to_string(min) + " and at most " + std::to_string(max) + ". " + name + " component " + std::to_string(i) + " is " + std::to_string(value), arg->Declaration()->source); - } else { - AddError("the " + name + " argument must be at least " + - std::to_string(min) + " and at most " + - std::to_string(max) + ". " + name + " is " + - std::to_string(value), - arg->Declaration()->source); + return false; } + } + } else { + auto value = values->As(); + if (value < min || value > max) { + AddError("the " + name + " argument must be at least " + + std::to_string(min) + " and at most " + std::to_string(max) + + ". " + name + " is " + std::to_string(value), + arg->Declaration()->source); return false; } } @@ -1517,12 +1712,40 @@ bool Validator::TextureBuiltinFunction(const sem::Call* call) const { check_arg_is_constexpr(sem::ParameterUsage::kComponent, 0, 3); } +bool Validator::RequiredExtensionForBuiltinFunction( + const sem::Call* call, + const ast::Extensions& enabled_extensions) const { + const auto* builtin = call->Target()->As(); + if (!builtin) { + return true; + } + + const auto extension = builtin->RequiredExtension(); + if (extension == ast::Extension::kInvalid) { + return true; + } + + if (!enabled_extensions.Contains(extension)) { + AddError("cannot call built-in function '" + std::string(builtin->str()) + + "' without extension " + utils::ToString(extension), + call->Declaration()->source); + return false; + } + + return true; +} + bool Validator::FunctionCall(const sem::Call* call, sem::Statement* current_statement) const { auto* decl = call->Declaration(); auto* target = call->Target()->As(); auto sym = decl->target.name->symbol; auto name = symbols_.NameFor(sym); + if (!current_statement) { // Function call at module-scope. + AddError("functions cannot be called at module-scope", decl->source); + return false; + } + if (target->Declaration()->IsEntryPoint()) { // https://www.w3.org/TR/WGSL/#function-restriction // An entry point must never be the target of a function call. @@ -1530,17 +1753,17 @@ bool Validator::FunctionCall(const sem::Call* call, sem::Statement* current_stat return false; } - if (decl->args.size() != target->Parameters().size()) { - bool more = decl->args.size() > target->Parameters().size(); + if (decl->args.Length() != target->Parameters().Length()) { + bool more = decl->args.Length() > target->Parameters().Length(); AddError("too " + (more ? std::string("many") : std::string("few")) + " arguments in call to '" + name + "', expected " + - std::to_string(target->Parameters().size()) + ", got " + - std::to_string(call->Arguments().size()), + std::to_string(target->Parameters().Length()) + ", got " + + std::to_string(call->Arguments().Length()), decl->source); return false; } - for (size_t i = 0; i < call->Arguments().size(); ++i) { + for (size_t i = 0; i < call->Arguments().Length(); ++i) { const sem::Variable* param = target->Parameters()[i]; const ast::Expression* arg_expr = decl->args[i]; auto* param_type = param->Type(); @@ -1573,12 +1796,6 @@ bool Validator::FunctionCall(const sem::Call* call, sem::Statement* current_stat TINT_ICE(Resolver, diagnostics_) << "failed to resolve identifier"; return false; } - if (var->Declaration()->is_const) { - TINT_ICE(Resolver, diagnostics_) - << "Resolver::FunctionCall() encountered an address-of " - "expression of a constant identifier expression"; - return false; - } is_valid = true; } } @@ -1627,19 +1844,19 @@ bool Validator::FunctionCall(const sem::Call* call, sem::Statement* current_stat return true; } -bool Validator::StructureConstructorOrCast(const ast::CallExpression* ctor, - const sem::Struct* struct_type) const { +bool Validator::StructureConstructor(const ast::CallExpression* ctor, + const sem::Struct* struct_type) const { if (!struct_type->IsConstructible()) { AddError("struct constructor has non-constructible type", ctor->source); return false; } - if (ctor->args.size() > 0) { - if (ctor->args.size() != struct_type->Members().size()) { - std::string fm = ctor->args.size() < struct_type->Members().size() ? "few" : "many"; + if (ctor->args.Length() > 0) { + if (ctor->args.Length() != struct_type->Members().size()) { + std::string fm = ctor->args.Length() < struct_type->Members().size() ? "few" : "many"; AddError("struct constructor has too " + fm + " inputs: expected " + std::to_string(struct_type->Members().size()) + ", found " + - std::to_string(ctor->args.size()), + std::to_string(ctor->args.Length()), ctor->source); return false; } @@ -1660,100 +1877,39 @@ bool Validator::StructureConstructorOrCast(const ast::CallExpression* ctor, return true; } -bool Validator::ArrayConstructorOrCast(const ast::CallExpression* ctor, - const sem::Array* array_type) const { +bool Validator::ArrayConstructor(const ast::CallExpression* ctor, + const sem::Array* array_type) const { auto& values = ctor->args; auto* elem_ty = array_type->ElemType(); for (auto* value : values) { auto* value_ty = sem_.TypeOf(value)->UnwrapRef(); - if (value_ty != elem_ty) { - AddError( - "type in array constructor does not match array type: " - "expected '" + - sem_.TypeNameOf(elem_ty) + "', found '" + sem_.TypeNameOf(value_ty) + "'", - value->source); - return false; - } - } - - if (array_type->IsRuntimeSized()) { - AddError("cannot init a runtime-sized array", ctor->source); - return false; - } else if (!elem_ty->IsConstructible()) { - AddError("array constructor has non-constructible element type", ctor->source); - return false; - } else if (!values.empty() && (values.size() != array_type->Count())) { - std::string fm = values.size() < array_type->Count() ? "few" : "many"; - AddError("array constructor has too " + fm + " elements: expected " + - std::to_string(array_type->Count()) + ", found " + - std::to_string(values.size()), - ctor->source); - return false; - } else if (values.size() > array_type->Count()) { - AddError("array constructor has too many elements: expected " + - std::to_string(array_type->Count()) + ", found " + - std::to_string(values.size()), - ctor->source); - return false; - } - return true; -} - -bool Validator::VectorConstructorOrCast(const ast::CallExpression* ctor, - const sem::Vector* vec_type) const { - auto& values = ctor->args; - auto* elem_ty = vec_type->type(); - size_t value_cardinality_sum = 0; - for (auto* value : values) { - auto* value_ty = sem_.TypeOf(value)->UnwrapRef(); - if (value_ty->is_scalar()) { - if (elem_ty != value_ty) { - AddError( - "type in vector constructor does not match vector type: " - "expected '" + - sem_.TypeNameOf(elem_ty) + "', found '" + sem_.TypeNameOf(value_ty) + "'", - value->source); - return false; - } - - value_cardinality_sum++; - } else if (auto* value_vec = value_ty->As()) { - auto* value_elem_ty = value_vec->type(); - // A mismatch of vector type parameter T is only an error if multiple - // arguments are present. A single argument constructor constitutes a - // type conversion expression. - if (elem_ty != value_elem_ty && values.size() > 1u) { - AddError( - "type in vector constructor does not match vector type: " - "expected '" + - sem_.TypeNameOf(elem_ty) + "', found '" + sem_.TypeNameOf(value_elem_ty) + - "'", - value->source); - return false; - } - - value_cardinality_sum += value_vec->Width(); - } else { - // A vector constructor can only accept vectors and scalars. - AddError("expected vector or scalar type in vector constructor; found: " + - sem_.TypeNameOf(value_ty), + if (sem::Type::ConversionRank(value_ty, elem_ty) == sem::Type::kNoConversion) { + AddError("'" + sem_.TypeNameOf(value_ty) + + "' cannot be used to construct an array of '" + sem_.TypeNameOf(elem_ty) + + "'", value->source); return false; } } - // A correct vector constructor must either be a zero-value expression, - // a single-value initializer (splat) expression, or the number of components - // of all constructor arguments must add up to the vector cardinality. - if (value_cardinality_sum > 1 && value_cardinality_sum != vec_type->Width()) { - if (values.empty()) { - TINT_ICE(Resolver, diagnostics_) << "constructor arguments expected to be non-empty!"; - } - const Source& values_start = values[0]->source; - const Source& values_end = values[values.size() - 1]->source; - AddError("attempted to construct '" + sem_.TypeNameOf(vec_type) + "' with " + - std::to_string(value_cardinality_sum) + " component(s)", - Source::Combine(values_start, values_end)); + if (array_type->IsRuntimeSized()) { + AddError("cannot construct a runtime-sized array", ctor->source); + return false; + } else if (!elem_ty->IsConstructible()) { + AddError("array constructor has non-constructible element type", ctor->source); + return false; + } else if (!values.IsEmpty() && (values.Length() != array_type->Count())) { + std::string fm = values.Length() < array_type->Count() ? "few" : "many"; + AddError("array constructor has too " + fm + " elements: expected " + + std::to_string(array_type->Count()) + ", found " + + std::to_string(values.Length()), + ctor->source); + return false; + } else if (values.Length() > array_type->Count()) { + AddError("array constructor has too many elements: expected " + + std::to_string(array_type->Count()) + ", found " + + std::to_string(values.Length()), + ctor->source); return false; } return true; @@ -1761,7 +1917,7 @@ bool Validator::VectorConstructorOrCast(const ast::CallExpression* ctor, bool Validator::Vector(const sem::Vector* ty, const Source& source) const { if (!ty->type()->is_scalar()) { - AddError("vector element type must be 'bool', 'f32', 'i32' or 'u32'", source); + AddError("vector element type must be 'bool', 'f32', 'f16', 'i32' or 'u32'", source); return false; } return true; @@ -1769,121 +1925,12 @@ bool Validator::Vector(const sem::Vector* ty, const Source& source) const { bool Validator::Matrix(const sem::Matrix* ty, const Source& source) const { if (!ty->is_float_matrix()) { - AddError("matrix element type must be 'f32'", source); + AddError("matrix element type must be 'f32' or 'f16'", source); return false; } return true; } -bool Validator::MatrixConstructorOrCast(const ast::CallExpression* ctor, - const sem::Matrix* matrix_ty) const { - auto& values = ctor->args; - // Zero Value expression - if (values.empty()) { - return true; - } - - if (!Matrix(matrix_ty, ctor->source)) { - return false; - } - - std::vector arg_tys; - arg_tys.reserve(values.size()); - for (auto* value : values) { - arg_tys.emplace_back(sem_.TypeOf(value)->UnwrapRef()); - } - - auto* elem_type = matrix_ty->type(); - auto num_elements = matrix_ty->columns() * matrix_ty->rows(); - - // Print a generic error for an invalid matrix constructor, showing the - // available overloads. - auto print_error = [&]() { - const Source& values_start = values[0]->source; - const Source& values_end = values[values.size() - 1]->source; - auto type_name = sem_.TypeNameOf(matrix_ty); - auto elem_type_name = sem_.TypeNameOf(elem_type); - std::stringstream ss; - ss << "no matching constructor " + type_name << "("; - for (size_t i = 0; i < values.size(); i++) { - if (i > 0) { - ss << ", "; - } - ss << arg_tys[i]->FriendlyName(symbols_); - } - ss << ")" << std::endl << std::endl; - ss << "3 candidates available:" << std::endl; - ss << " " << type_name << "()" << std::endl; - ss << " " << type_name << "(" << elem_type_name << ",...," << elem_type_name << ")" - << " // " << std::to_string(num_elements) << " arguments" << std::endl; - ss << " " << type_name << "("; - for (uint32_t c = 0; c < matrix_ty->columns(); c++) { - if (c > 0) { - ss << ", "; - } - ss << VectorPretty(matrix_ty->rows(), elem_type); - } - ss << ")" << std::endl; - AddError(ss.str(), Source::Combine(values_start, values_end)); - }; - - const sem::Type* expected_arg_type = nullptr; - if (num_elements == values.size()) { - // Column-major construction from scalar elements. - expected_arg_type = matrix_ty->type(); - } else if (matrix_ty->columns() == values.size()) { - // Column-by-column construction from vectors. - expected_arg_type = matrix_ty->ColumnType(); - } else { - print_error(); - return false; - } - - for (auto* arg_ty : arg_tys) { - if (arg_ty != expected_arg_type) { - print_error(); - return false; - } - } - - return true; -} - -bool Validator::ScalarConstructorOrCast(const ast::CallExpression* ctor, - const sem::Type* ty) const { - if (ctor->args.size() == 0) { - return true; - } - if (ctor->args.size() > 1) { - AddError( - "expected zero or one value in constructor, got " + std::to_string(ctor->args.size()), - ctor->source); - return false; - } - - // Validate constructor - auto* value = ctor->args[0]; - auto* value_ty = sem_.TypeOf(value)->UnwrapRef(); - - using Bool = sem::Bool; - using I32 = sem::I32; - using U32 = sem::U32; - using F32 = sem::F32; - - const bool is_valid = - (ty->Is() && value_ty->is_scalar()) || (ty->Is() && value_ty->is_scalar()) || - (ty->Is() && value_ty->is_scalar()) || (ty->Is() && value_ty->is_scalar()); - if (!is_valid) { - AddError("cannot construct '" + sem_.TypeNameOf(ty) + "' with a value of type '" + - sem_.TypeNameOf(value_ty) + "'", - ctor->source); - - return false; - } - - return true; -} - bool Validator::PipelineStages(const std::vector& entry_points) const { auto check_workgroup_storage = [&](const sem::Function* func, const sem::Function* entry_point) { @@ -1969,9 +2016,81 @@ bool Validator::PipelineStages(const std::vector& entry_points) return true; } +bool Validator::PushConstants(const std::vector& entry_points) const { + for (auto* entry_point : entry_points) { + // State checked and modified by check_push_constant so that it remembers previously seen + // push_constant variables for an entry-point. + const sem::Variable* push_constant_var = nullptr; + const sem::Function* push_constant_func = nullptr; + + auto check_push_constant = [&](const sem::Function* func, const sem::Function* ep) { + for (auto* var : func->DirectlyReferencedGlobals()) { + if (var->StorageClass() != ast::StorageClass::kPushConstant || + var == push_constant_var) { + continue; + } + + if (push_constant_var == nullptr) { + push_constant_var = var; + push_constant_func = func; + continue; + } + + AddError("entry point '" + symbols_.NameFor(ep->Declaration()->symbol) + + "' uses two different 'push_constant' variables.", + ep->Declaration()->source); + AddNote("first 'push_constant' variable declaration is here", + var->Declaration()->source); + if (func != ep) { + TraverseCallChain(diagnostics_, ep, func, [&](const sem::Function* f) { + AddNote("called by function '" + + symbols_.NameFor(f->Declaration()->symbol) + "'", + f->Declaration()->source); + }); + AddNote("called by entry point '" + + symbols_.NameFor(ep->Declaration()->symbol) + "'", + ep->Declaration()->source); + } + AddNote("second 'push_constant' variable declaration is here", + push_constant_var->Declaration()->source); + if (push_constant_func != ep) { + TraverseCallChain( + diagnostics_, ep, push_constant_func, [&](const sem::Function* f) { + AddNote("called by function '" + + symbols_.NameFor(f->Declaration()->symbol) + "'", + f->Declaration()->source); + }); + AddNote("called by entry point '" + + symbols_.NameFor(ep->Declaration()->symbol) + "'", + ep->Declaration()->source); + } + return false; + } + + return true; + }; + + if (!check_push_constant(entry_point, entry_point)) { + return false; + } + for (auto* func : entry_point->TransitivelyCalledFunctions()) { + if (!check_push_constant(func, entry_point)) { + return false; + } + } + } + + return true; +} + bool Validator::Array(const sem::Array* arr, const Source& source) const { auto* el_ty = arr->ElemType(); + if (!IsPlain(el_ty)) { + AddError(sem_.TypeNameOf(el_ty) + " cannot be used as an element type of an array", source); + return false; + } + if (!IsFixedFootprint(el_ty)) { AddError("an array element type cannot contain a runtime-sized array", source); return false; @@ -1981,8 +2100,7 @@ bool Validator::Array(const sem::Array* arr, const Source& source) const { bool Validator::ArrayStrideAttribute(const ast::StrideAttribute* attr, uint32_t el_size, - uint32_t el_align, - const Source& source) const { + uint32_t el_align) const { auto stride = attr->stride; bool is_valid_stride = (stride >= el_size) && (stride >= el_align) && (stride % el_align == 0); if (!is_valid_stride) { @@ -1993,8 +2111,8 @@ bool Validator::ArrayStrideAttribute(const ast::StrideAttribute* attr, AddError( "arrays decorated with the stride attribute must have a stride " "that is at least the size of the element type, and be a multiple " - "of the element type's alignment value.", - source); + "of the element type's alignment value", + attr->source); return false; } return true; @@ -2076,7 +2194,7 @@ bool Validator::Structure(const sem::Struct* str, ast::PipelineStage stage) cons /* is_input */ false)) { return false; } - if (builtin->builtin == ast::Builtin::kPosition) { + if (builtin->builtin == ast::BuiltinValue::kPosition) { has_position = true; } } else if (auto* interpolate = attr->As()) { @@ -2237,7 +2355,8 @@ bool Validator::Assignment(const ast::Statement* a, const sem::Type* rhs_ty) con if (lhs->Is()) { // https://www.w3.org/TR/WGSL/#phony-assignment-section auto* ty = rhs_ty->UnwrapRef(); - if (!ty->IsConstructible() && !ty->IsAnyOf()) { + if (!ty->IsConstructible() && + !ty->IsAnyOf()) { AddError("cannot assign '" + sem_.TypeNameOf(rhs_ty) + "' to '_'. '_' can only be assigned a constructible, pointer, " "texture or sampler type", @@ -2250,16 +2369,16 @@ bool Validator::Assignment(const ast::Statement* a, const sem::Type* rhs_ty) con // https://gpuweb.github.io/gpuweb/wgsl/#assignment-statement auto const* lhs_ty = sem_.TypeOf(lhs); - if (auto* var = sem_.ResolvedSymbol(lhs)) { - auto* decl = var->Declaration(); - if (var->Is()) { - AddError("cannot assign to function parameter", lhs->source); - AddNote("'" + symbols_.NameFor(decl->symbol) + "' is declared here:", decl->source); - return false; - } - if (decl->is_const) { - AddError("cannot assign to const", lhs->source); - AddNote("'" + symbols_.NameFor(decl->symbol) + "' is declared here:", decl->source); + if (auto* variable = sem_.ResolvedSymbol(lhs)) { + auto* v = variable->Declaration(); + const char* err = Switch( + v, // + [&](const ast::Parameter*) { return "cannot assign to function parameter"; }, + [&](const ast::Let*) { return "cannot assign to 'let'"; }, + [&](const ast::Override*) { return "cannot assign to 'override'"; }); + if (err) { + AddError(err, lhs->source); + AddNote("'" + symbols_.NameFor(v->symbol) + "' is declared here:", v->source); return false; } } @@ -2298,16 +2417,16 @@ bool Validator::IncrementDecrementStatement(const ast::IncrementDecrementStateme // https://gpuweb.github.io/gpuweb/wgsl/#increment-decrement - if (auto* var = sem_.ResolvedSymbol(lhs)) { - auto* decl = var->Declaration(); - if (var->Is()) { - AddError("cannot modify function parameter", lhs->source); - AddNote("'" + symbols_.NameFor(decl->symbol) + "' is declared here:", decl->source); - return false; - } - if (decl->is_const) { - AddError("cannot modify constant value", lhs->source); - AddNote("'" + symbols_.NameFor(decl->symbol) + "' is declared here:", decl->source); + if (auto* variable = sem_.ResolvedSymbol(lhs)) { + auto* v = variable->Declaration(); + const char* err = Switch( + v, // + [&](const ast::Parameter*) { return "cannot modify function parameter"; }, + [&](const ast::Let*) { return "cannot modify 'let'"; }, + [&](const ast::Override*) { return "cannot modify 'override'"; }); + if (err) { + AddError(err, lhs->source); + AddNote("'" + symbols_.NameFor(v->symbol) + "' is declared here:", v->source); return false; } } @@ -2333,7 +2452,7 @@ bool Validator::IncrementDecrementStatement(const ast::IncrementDecrementStateme return true; } -bool Validator::NoDuplicateAttributes(const ast::AttributeList& attributes) const { +bool Validator::NoDuplicateAttributes(utils::VectorRef attributes) const { std::unordered_map seen; for (auto* d : attributes) { auto res = seen.emplace(&d->TypeInfo(), d->source); @@ -2346,7 +2465,7 @@ bool Validator::NoDuplicateAttributes(const ast::AttributeList& attributes) cons return true; } -bool Validator::IsValidationDisabled(const ast::AttributeList& attributes, +bool Validator::IsValidationDisabled(utils::VectorRef attributes, ast::DisabledValidation validation) const { for (auto* attribute : attributes) { if (auto* dv = attribute->As()) { @@ -2358,7 +2477,7 @@ bool Validator::IsValidationDisabled(const ast::AttributeList& attributes, return false; } -bool Validator::IsValidationEnabled(const ast::AttributeList& attributes, +bool Validator::IsValidationEnabled(utils::VectorRef attributes, ast::DisabledValidation validation) const { return !IsValidationDisabled(attributes, validation); } diff --git a/src/tint/resolver/validator.h b/src/tint/resolver/validator.h index 9901dc92e4..57ac0648c8 100644 --- a/src/tint/resolver/validator.h +++ b/src/tint/resolver/validator.h @@ -44,19 +44,23 @@ class ReturnStatement; class SwitchStatement; class UnaryOpExpression; class Variable; +class WhileStatement; } // namespace tint::ast namespace tint::sem { class Array; class Atomic; class BlockStatement; class Builtin; +class Call; class CaseStatement; class ForLoopStatement; class IfStatement; class LoopStatement; +class Materialize; class Statement; class SwitchStatement; class TypeConstructor; +class WhileStatement; } // namespace tint::sem namespace tint::resolver { @@ -112,6 +116,11 @@ class Validator { /// @returns true on success, false otherwise. bool PipelineStages(const std::vector& entry_points) const; + /// Validates push_constant variables + /// @param entry_points the entry points to the module + /// @returns true on success, false otherwise. + bool PushConstants(const std::vector& entry_points) const; + /// Validates aliases /// @param alias the alias to validate /// @returns true on success, false otherwise. @@ -127,12 +136,10 @@ class Validator { /// @param attr the stride attribute to validate /// @param el_size the element size /// @param el_align the element alignment - /// @param source the source of the attribute /// @returns true on success, false otherwise bool ArrayStrideAttribute(const ast::StrideAttribute* attr, uint32_t el_size, - uint32_t el_align, - const Source& source) const; + uint32_t el_align) const; /// Validates an atomic /// @param a the atomic ast node to validate @@ -183,6 +190,12 @@ class Validator { /// @returns true on success, false otherwise bool ContinueStatement(const sem::Statement* stmt, sem::Statement* current_statement) const; + /// Validates a call + /// @param call the call + /// @param current_statement the current statement being resolved + /// @returns true on success, false otherwise + bool Call(const sem::Call* call, sem::Statement* current_statement) const; + /// Validates a discard statement /// @param stmt the statement to validate /// @param current_statement the current statement being resolved @@ -200,6 +213,11 @@ class Validator { /// @returns true on success, false otherwise bool ForLoopStatement(const sem::ForLoopStatement* stmt) const; + /// Validates a while loop + /// @param stmt the while statement to validate + /// @returns true on success, false otherwise + bool WhileStatement(const sem::WhileStatement* stmt) const; + /// Validates a fallthrough statement /// @param stmt the fallthrough to validate /// @returns true on success, false otherwise @@ -219,13 +237,13 @@ class Validator { /// Validates a global variable /// @param var the global variable to validate - /// @param constant_ids the set of constant ids in the module + /// @param override_id the set of override ids in the module /// @param atomic_composite_info atomic composite info in the module /// @returns true on success, false otherwise bool GlobalVariable( - const sem::Variable* var, - std::unordered_map constant_ids, - std::unordered_map atomic_composite_info) const; + const sem::GlobalVariable* var, + const std::unordered_map& override_id, + const std::unordered_map& atomic_composite_info) const; /// Validates an if statement /// @param stmt the statement to validate @@ -249,6 +267,11 @@ class Validator { /// @returns true on success, false otherwise. bool BuiltinCall(const sem::Call* call) const; + /// Validates a local variable + /// @param v the variable to validate + /// @returns true on success, false otherwise. + bool LocalVariable(const sem::Variable* v) const; + /// Validates a location attribute /// @param location the location attribute to validate /// @param type the variable type @@ -269,6 +292,13 @@ class Validator { /// @returns true on success, false otherwise. bool LoopStatement(const sem::LoopStatement* stmt) const; + /// Validates a materialize of an abstract numeric value from the type `from` to the type `to`. + /// @param to the target type + /// @param from the abstract numeric type + /// @param source the source of the materialization + /// @returns true on success, false otherwise + bool Materialize(const sem::Type* to, const sem::Type* from, const Source& source) const; + /// Validates a matrix /// @param ty the matrix to validate /// @param source the source of the matrix @@ -279,7 +309,7 @@ class Validator { /// @param func the function the variable is for /// @param var the variable to validate /// @returns true on success, false otherwise - bool FunctionParameter(const ast::Function* func, const sem::Variable* var) const; + bool Parameter(const ast::Function* func, const sem::Variable* var) const; /// Validates a return /// @param ret the return statement to validate @@ -295,46 +325,75 @@ class Validator { /// Validates a list of statements /// @param stmts the statements to validate /// @returns true on success, false otherwise - bool Statements(const ast::StatementList& stmts) const; + bool Statements(utils::VectorRef stmts) const; /// Validates a storage texture /// @param t the texture to validate /// @returns true on success, false otherwise bool StorageTexture(const ast::StorageTexture* t) const; + /// Validates a sampled texture + /// @param t the texture to validate + /// @param source the source of the texture + /// @returns true on success, false otherwise + bool SampledTexture(const sem::SampledTexture* t, const Source& source) const; + + /// Validates a multisampled texture + /// @param t the texture to validate + /// @param source the source of the texture + /// @returns true on success, false otherwise + bool MultisampledTexture(const sem::MultisampledTexture* t, const Source& source) const; + /// Validates a structure /// @param str the structure to validate /// @param stage the current pipeline stage /// @returns true on success, false otherwise. bool Structure(const sem::Struct* str, ast::PipelineStage stage) const; - /// Validates a structure constructor or cast + /// Validates a structure constructor /// @param ctor the call expression to validate /// @param struct_type the type of the structure /// @returns true on success, false otherwise - bool StructureConstructorOrCast(const ast::CallExpression* ctor, - const sem::Struct* struct_type) const; + bool StructureConstructor(const ast::CallExpression* ctor, + const sem::Struct* struct_type) const; /// Validates a switch statement /// @param s the switch to validate /// @returns true on success, false otherwise bool SwitchStatement(const ast::SwitchStatement* s); - /// Validates a variable - /// @param var the variable to validate + /// Validates a 'var' variable declaration + /// @param v the variable to validate /// @returns true on success, false otherwise. - bool Variable(const sem::Variable* var) const; + bool Var(const sem::Variable* v) const; - /// Validates a variable constructor or cast - /// @param var the variable to validate + /// Validates a 'let' variable declaration + /// @param v the variable to validate + /// @returns true on success, false otherwise. + bool Let(const sem::Variable* v) const; + + /// Validates a 'override' variable declaration + /// @param v the variable to validate + /// @param override_id the set of override ids in the module + /// @returns true on success, false otherwise. + bool Override(const sem::Variable* v, + const std::unordered_map& override_id) const; + + /// Validates a 'const' variable declaration + /// @param v the variable to validate + /// @returns true on success, false otherwise. + bool Const(const sem::Variable* v) const; + + /// Validates a variable initializer + /// @param v the variable to validate /// @param storage_class the storage class of the variable /// @param storage_type the type of the storage - /// @param rhs_type the right hand side of the expression + /// @param initializer the RHS initializer expression /// @returns true on succes, false otherwise - bool VariableConstructorOrCast(const ast::Variable* var, - ast::StorageClass storage_class, - const sem::Type* storage_type, - const sem::Type* rhs_type) const; + bool VariableInitializer(const ast::Variable* v, + ast::StorageClass storage_class, + const sem::Type* storage_type, + const sem::Expression* initializer) const; /// Validates a vector /// @param ty the vector to validate @@ -342,41 +401,28 @@ class Validator { /// @returns true on success, false otherwise bool Vector(const sem::Vector* ty, const Source& source) const; - /// Validates a vector constructor or cast - /// @param ctor the call expression to validate - /// @param vec_type the vector type - /// @returns true on success, false otherwise - bool VectorConstructorOrCast(const ast::CallExpression* ctor, - const sem::Vector* vec_type) const; - - /// Validates a matrix constructor or cast - /// @param ctor the call expression to validate - /// @param matrix_type the type of the matrix - /// @returns true on success, false otherwise - bool MatrixConstructorOrCast(const ast::CallExpression* ctor, - const sem::Matrix* matrix_type) const; - - /// Validates a scalar constructor or cast - /// @param ctor the call expression to validate - /// @param type the type of the scalar - /// @returns true on success, false otherwise. - bool ScalarConstructorOrCast(const ast::CallExpression* ctor, const sem::Type* type) const; - - /// Validates an array constructor or cast + /// Validates an array constructor /// @param ctor the call expresion to validate /// @param arr_type the type of the array /// @returns true on success, false otherwise - bool ArrayConstructorOrCast(const ast::CallExpression* ctor, const sem::Array* arr_type) const; + bool ArrayConstructor(const ast::CallExpression* ctor, const sem::Array* arr_type) const; /// Validates a texture builtin function /// @param call the builtin call to validate /// @returns true on success, false otherwise bool TextureBuiltinFunction(const sem::Call* call) const; + /// Validates an optional builtin function and its required extension. + /// @param call the builtin call to validate + /// @param enabled_extensions all the extensions declared in current module + /// @returns true on success, false otherwise + bool RequiredExtensionForBuiltinFunction(const sem::Call* call, + const ast::Extensions& enabled_extensions) const; + /// Validates there are no duplicate attributes /// @param attributes the list of attributes to validate /// @returns true on success, false otherwise. - bool NoDuplicateAttributes(const ast::AttributeList& attributes) const; + bool NoDuplicateAttributes(utils::VectorRef attributes) const; /// Validates a storage class layout /// @param type the type to validate @@ -392,15 +438,18 @@ class Validator { /// Validates a storage class layout /// @param var the variable to validate /// @param layouts previously validated storage layouts + /// @param enabled_extensions all the extensions declared in current module /// @returns true on success, false otherwise. - bool StorageClassLayout(const sem::Variable* var, ValidTypeStorageLayouts& layouts) const; + bool StorageClassLayout(const sem::Variable* var, + const ast::Extensions& enabled_extensions, + ValidTypeStorageLayouts& layouts) const; /// @returns true if the attribute list contains a /// ast::DisableValidationAttribute with the validation mode equal to /// `validation` /// @param attributes the attribute list to check /// @param validation the validation mode to check - bool IsValidationDisabled(const ast::AttributeList& attributes, + bool IsValidationDisabled(utils::VectorRef attributes, ast::DisabledValidation validation) const; /// @returns true if the attribute list does not contains a @@ -408,7 +457,7 @@ class Validator { /// `validation` /// @param attributes the attribute list to check /// @param validation the validation mode to check - bool IsValidationEnabled(const ast::AttributeList& attributes, + bool IsValidationEnabled(utils::VectorRef attributes, ast::DisabledValidation validation) const; private: diff --git a/src/tint/resolver/validator_is_storeable_test.cc b/src/tint/resolver/validator_is_storeable_test.cc index a5f612c905..88ec911403 100644 --- a/src/tint/resolver/validator_is_storeable_test.cc +++ b/src/tint/resolver/validator_is_storeable_test.cc @@ -32,6 +32,7 @@ TEST_F(ValidatorIsStorableTest, Scalar) { EXPECT_TRUE(v()->IsStorable(create())); EXPECT_TRUE(v()->IsStorable(create())); EXPECT_TRUE(v()->IsStorable(create())); + EXPECT_TRUE(v()->IsStorable(create())); } TEST_F(ValidatorIsStorableTest, Vector) { @@ -44,21 +45,36 @@ TEST_F(ValidatorIsStorableTest, Vector) { EXPECT_TRUE(v()->IsStorable(create(create(), 2u))); EXPECT_TRUE(v()->IsStorable(create(create(), 3u))); EXPECT_TRUE(v()->IsStorable(create(create(), 4u))); + EXPECT_TRUE(v()->IsStorable(create(create(), 2u))); + EXPECT_TRUE(v()->IsStorable(create(create(), 3u))); + EXPECT_TRUE(v()->IsStorable(create(create(), 4u))); } TEST_F(ValidatorIsStorableTest, Matrix) { - auto* vec2 = create(create(), 2u); - auto* vec3 = create(create(), 3u); - auto* vec4 = create(create(), 4u); - EXPECT_TRUE(v()->IsStorable(create(vec2, 2u))); - EXPECT_TRUE(v()->IsStorable(create(vec2, 3u))); - EXPECT_TRUE(v()->IsStorable(create(vec2, 4u))); - EXPECT_TRUE(v()->IsStorable(create(vec3, 2u))); - EXPECT_TRUE(v()->IsStorable(create(vec3, 3u))); - EXPECT_TRUE(v()->IsStorable(create(vec3, 4u))); - EXPECT_TRUE(v()->IsStorable(create(vec4, 2u))); - EXPECT_TRUE(v()->IsStorable(create(vec4, 3u))); - EXPECT_TRUE(v()->IsStorable(create(vec4, 4u))); + auto* vec2_f32 = create(create(), 2u); + auto* vec3_f32 = create(create(), 3u); + auto* vec4_f32 = create(create(), 4u); + auto* vec2_f16 = create(create(), 2u); + auto* vec3_f16 = create(create(), 3u); + auto* vec4_f16 = create(create(), 4u); + EXPECT_TRUE(v()->IsStorable(create(vec2_f32, 2u))); + EXPECT_TRUE(v()->IsStorable(create(vec2_f32, 3u))); + EXPECT_TRUE(v()->IsStorable(create(vec2_f32, 4u))); + EXPECT_TRUE(v()->IsStorable(create(vec3_f32, 2u))); + EXPECT_TRUE(v()->IsStorable(create(vec3_f32, 3u))); + EXPECT_TRUE(v()->IsStorable(create(vec3_f32, 4u))); + EXPECT_TRUE(v()->IsStorable(create(vec4_f32, 2u))); + EXPECT_TRUE(v()->IsStorable(create(vec4_f32, 3u))); + EXPECT_TRUE(v()->IsStorable(create(vec4_f32, 4u))); + EXPECT_TRUE(v()->IsStorable(create(vec2_f16, 2u))); + EXPECT_TRUE(v()->IsStorable(create(vec2_f16, 3u))); + EXPECT_TRUE(v()->IsStorable(create(vec2_f16, 4u))); + EXPECT_TRUE(v()->IsStorable(create(vec3_f16, 2u))); + EXPECT_TRUE(v()->IsStorable(create(vec3_f16, 3u))); + EXPECT_TRUE(v()->IsStorable(create(vec3_f16, 4u))); + EXPECT_TRUE(v()->IsStorable(create(vec4_f16, 2u))); + EXPECT_TRUE(v()->IsStorable(create(vec4_f16, 3u))); + EXPECT_TRUE(v()->IsStorable(create(vec4_f16, 4u))); } TEST_F(ValidatorIsStorableTest, Pointer) { diff --git a/src/tint/resolver/var_let_test.cc b/src/tint/resolver/var_let_test.cc deleted file mode 100644 index a59855abd9..0000000000 --- a/src/tint/resolver/var_let_test.cc +++ /dev/null @@ -1,676 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/resolver/resolver.h" -#include "src/tint/resolver/resolver_test_helper.h" -#include "src/tint/sem/reference.h" - -#include "gmock/gmock.h" - -using namespace tint::number_suffixes; // NOLINT - -namespace tint::resolver { -namespace { - -struct ResolverVarLetTest : public resolver::TestHelper, public testing::Test {}; - -TEST_F(ResolverVarLetTest, VarDeclWithoutConstructor) { - // struct S { i : i32; } - // alias A = S; - // fn F(){ - // var i : i32; - // var u : u32; - // var f : f32; - // var b : bool; - // var s : S; - // var a : A; - // } - - auto* S = Structure("S", {Member("i", ty.i32())}); - auto* A = Alias("A", ty.Of(S)); - - auto* i = Var("i", ty.i32(), ast::StorageClass::kNone); - auto* u = Var("u", ty.u32(), ast::StorageClass::kNone); - auto* f = Var("f", ty.f32(), ast::StorageClass::kNone); - auto* b = Var("b", ty.bool_(), ast::StorageClass::kNone); - auto* s = Var("s", ty.Of(S), ast::StorageClass::kNone); - auto* a = Var("a", ty.Of(A), ast::StorageClass::kNone); - - Func("F", {}, ty.void_(), - { - Decl(i), - Decl(u), - Decl(f), - Decl(b), - Decl(s), - Decl(a), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - // `var` declarations are always of reference type - ASSERT_TRUE(TypeOf(i)->Is()); - ASSERT_TRUE(TypeOf(u)->Is()); - ASSERT_TRUE(TypeOf(f)->Is()); - ASSERT_TRUE(TypeOf(b)->Is()); - ASSERT_TRUE(TypeOf(s)->Is()); - ASSERT_TRUE(TypeOf(a)->Is()); - - EXPECT_TRUE(TypeOf(i)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(u)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(f)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(b)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(s)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(a)->As()->StoreType()->Is()); - - EXPECT_EQ(Sem().Get(i)->Constructor(), nullptr); - EXPECT_EQ(Sem().Get(u)->Constructor(), nullptr); - EXPECT_EQ(Sem().Get(f)->Constructor(), nullptr); - EXPECT_EQ(Sem().Get(b)->Constructor(), nullptr); - EXPECT_EQ(Sem().Get(s)->Constructor(), nullptr); - EXPECT_EQ(Sem().Get(a)->Constructor(), nullptr); -} - -TEST_F(ResolverVarLetTest, VarDeclWithConstructor) { - // struct S { i : i32; } - // alias A = S; - // fn F(){ - // var i : i32 = 1; - // var u : u32 = 1u; - // var f : f32 = 1.f; - // var b : bool = true; - // var s : S = S(1); - // var a : A = A(1); - // } - - auto* S = Structure("S", {Member("i", ty.i32())}); - auto* A = Alias("A", ty.Of(S)); - - auto* i_c = Expr(1_i); - auto* u_c = Expr(1_u); - auto* f_c = Expr(1.f); - auto* b_c = Expr(true); - auto* s_c = Construct(ty.Of(S), Expr(1_i)); - auto* a_c = Construct(ty.Of(A), Expr(1_i)); - - auto* i = Var("i", ty.i32(), ast::StorageClass::kNone, i_c); - auto* u = Var("u", ty.u32(), ast::StorageClass::kNone, u_c); - auto* f = Var("f", ty.f32(), ast::StorageClass::kNone, f_c); - auto* b = Var("b", ty.bool_(), ast::StorageClass::kNone, b_c); - auto* s = Var("s", ty.Of(S), ast::StorageClass::kNone, s_c); - auto* a = Var("a", ty.Of(A), ast::StorageClass::kNone, a_c); - - Func("F", {}, ty.void_(), - { - Decl(i), - Decl(u), - Decl(f), - Decl(b), - Decl(s), - Decl(a), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - // `var` declarations are always of reference type - ASSERT_TRUE(TypeOf(i)->Is()); - ASSERT_TRUE(TypeOf(u)->Is()); - ASSERT_TRUE(TypeOf(f)->Is()); - ASSERT_TRUE(TypeOf(b)->Is()); - ASSERT_TRUE(TypeOf(s)->Is()); - ASSERT_TRUE(TypeOf(a)->Is()); - - EXPECT_TRUE(TypeOf(i)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(u)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(f)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(b)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(s)->As()->StoreType()->Is()); - EXPECT_TRUE(TypeOf(a)->As()->StoreType()->Is()); - - EXPECT_EQ(Sem().Get(i)->Constructor()->Declaration(), i_c); - EXPECT_EQ(Sem().Get(u)->Constructor()->Declaration(), u_c); - EXPECT_EQ(Sem().Get(f)->Constructor()->Declaration(), f_c); - EXPECT_EQ(Sem().Get(b)->Constructor()->Declaration(), b_c); - EXPECT_EQ(Sem().Get(s)->Constructor()->Declaration(), s_c); - EXPECT_EQ(Sem().Get(a)->Constructor()->Declaration(), a_c); -} - -TEST_F(ResolverVarLetTest, LetDecl) { - // struct S { i : i32; } - // fn F(){ - // var v : i32; - // let i : i32 = 1i; - // let u : u32 = 1u; - // let f : f32 = 1.; - // let b : bool = true; - // let s : S = S(1); - // let a : A = A(1); - // let p : pointer = &v; - // } - - auto* S = Structure("S", {Member("i", ty.i32())}); - auto* A = Alias("A", ty.Of(S)); - auto* v = Var("v", ty.i32(), ast::StorageClass::kNone); - - auto* i_c = Expr(1_i); - auto* u_c = Expr(1_u); - auto* f_c = Expr(1.f); - auto* b_c = Expr(true); - auto* s_c = Construct(ty.Of(S), Expr(1_i)); - auto* a_c = Construct(ty.Of(A), Expr(1_i)); - auto* p_c = AddressOf(v); - - auto* i = Let("i", ty.i32(), i_c); - auto* u = Let("u", ty.u32(), u_c); - auto* f = Let("f", ty.f32(), f_c); - auto* b = Let("b", ty.bool_(), b_c); - auto* s = Let("s", ty.Of(S), s_c); - auto* a = Let("a", ty.Of(A), a_c); - auto* p = Let("p", ty.pointer(ast::StorageClass::kFunction), p_c); - - Func("F", {}, ty.void_(), - { - Decl(v), - Decl(i), - Decl(u), - Decl(f), - Decl(b), - Decl(s), - Decl(a), - Decl(p), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - // `let` declarations are always of the storage type - ASSERT_TRUE(TypeOf(i)->Is()); - ASSERT_TRUE(TypeOf(u)->Is()); - ASSERT_TRUE(TypeOf(f)->Is()); - ASSERT_TRUE(TypeOf(b)->Is()); - ASSERT_TRUE(TypeOf(s)->Is()); - ASSERT_TRUE(TypeOf(a)->Is()); - ASSERT_TRUE(TypeOf(p)->Is()); - ASSERT_TRUE(TypeOf(p)->As()->StoreType()->Is()); - - EXPECT_EQ(Sem().Get(i)->Constructor()->Declaration(), i_c); - EXPECT_EQ(Sem().Get(u)->Constructor()->Declaration(), u_c); - EXPECT_EQ(Sem().Get(f)->Constructor()->Declaration(), f_c); - EXPECT_EQ(Sem().Get(b)->Constructor()->Declaration(), b_c); - EXPECT_EQ(Sem().Get(s)->Constructor()->Declaration(), s_c); - EXPECT_EQ(Sem().Get(a)->Constructor()->Declaration(), a_c); - EXPECT_EQ(Sem().Get(p)->Constructor()->Declaration(), p_c); -} - -TEST_F(ResolverVarLetTest, DefaultVarStorageClass) { - // https://gpuweb.github.io/gpuweb/wgsl/#storage-class - - auto* buf = Structure("S", {Member("m", ty.i32())}); - auto* function = Var("f", ty.i32()); - auto* private_ = Global("p", ty.i32(), ast::StorageClass::kPrivate); - auto* workgroup = Global("w", ty.i32(), ast::StorageClass::kWorkgroup); - auto* uniform = Global("ub", ty.Of(buf), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); - auto* storage = Global("sb", ty.Of(buf), ast::StorageClass::kStorage, - ast::AttributeList{ - create(1), - create(0), - }); - auto* handle = Global("h", ty.depth_texture(ast::TextureDimension::k2d), - ast::AttributeList{ - create(2), - create(0), - }); - - WrapInFunction(function); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_TRUE(TypeOf(function)->Is()); - ASSERT_TRUE(TypeOf(private_)->Is()); - ASSERT_TRUE(TypeOf(workgroup)->Is()); - ASSERT_TRUE(TypeOf(uniform)->Is()); - ASSERT_TRUE(TypeOf(storage)->Is()); - ASSERT_TRUE(TypeOf(handle)->Is()); - - EXPECT_EQ(TypeOf(function)->As()->Access(), ast::Access::kReadWrite); - EXPECT_EQ(TypeOf(private_)->As()->Access(), ast::Access::kReadWrite); - EXPECT_EQ(TypeOf(workgroup)->As()->Access(), ast::Access::kReadWrite); - EXPECT_EQ(TypeOf(uniform)->As()->Access(), ast::Access::kRead); - EXPECT_EQ(TypeOf(storage)->As()->Access(), ast::Access::kRead); - EXPECT_EQ(TypeOf(handle)->As()->Access(), ast::Access::kRead); -} - -TEST_F(ResolverVarLetTest, ExplicitVarStorageClass) { - // https://gpuweb.github.io/gpuweb/wgsl/#storage-class - - auto* buf = Structure("S", {Member("m", ty.i32())}); - auto* storage = Global("sb", ty.Of(buf), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(1), - create(0), - }); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_TRUE(TypeOf(storage)->Is()); - - EXPECT_EQ(TypeOf(storage)->As()->Access(), ast::Access::kReadWrite); -} - -TEST_F(ResolverVarLetTest, LetInheritsAccessFromOriginatingVariable) { - // struct Inner { - // arr: array; - // } - // struct S { - // inner: Inner; - // } - // @group(0) @binding(0) var s : S; - // fn f() { - // let p = &s.inner.arr[4]; - // } - auto* inner = Structure("Inner", {Member("arr", ty.array())}); - auto* buf = Structure("S", {Member("inner", ty.Of(inner))}); - auto* storage = Global("s", ty.Of(buf), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); - - auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 4_i); - auto* ptr = Let("p", nullptr, AddressOf(expr)); - - WrapInFunction(ptr); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - ASSERT_TRUE(TypeOf(expr)->Is()); - ASSERT_TRUE(TypeOf(ptr)->Is()); - - EXPECT_EQ(TypeOf(expr)->As()->Access(), ast::Access::kReadWrite); - EXPECT_EQ(TypeOf(ptr)->As()->Access(), ast::Access::kReadWrite); -} - -TEST_F(ResolverVarLetTest, LocalShadowsAlias) { - // type a = i32; - // - // fn X() { - // var a = false; - // } - // - // fn Y() { - // let a = true; - // } - - auto* t = Alias("a", ty.i32()); - auto* v = Var("a", nullptr, Expr(false)); - auto* l = Let("a", nullptr, Expr(false)); - Func("X", {}, ty.void_(), {Decl(v)}); - Func("Y", {}, ty.void_(), {Decl(l)}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* type_t = Sem().Get(t); - auto* local_v = Sem().Get(v); - auto* local_l = Sem().Get(l); - - ASSERT_NE(local_v, nullptr); - ASSERT_NE(local_l, nullptr); - - EXPECT_EQ(local_v->Shadows(), type_t); - EXPECT_EQ(local_l->Shadows(), type_t); -} - -TEST_F(ResolverVarLetTest, LocalShadowsStruct) { - // struct a { - // m : i32; - // }; - // - // fn X() { - // var a = true; - // } - // - // fn Y() { - // let a = false; - // } - - auto* t = Structure("a", {Member("m", ty.i32())}); - auto* v = Var("a", nullptr, Expr(false)); - auto* l = Let("a", nullptr, Expr(false)); - Func("X", {}, ty.void_(), {Decl(v)}); - Func("Y", {}, ty.void_(), {Decl(l)}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* type_t = Sem().Get(t); - auto* local_v = Sem().Get(v); - auto* local_l = Sem().Get(l); - - ASSERT_NE(local_v, nullptr); - ASSERT_NE(local_l, nullptr); - - EXPECT_EQ(local_v->Shadows(), type_t); - EXPECT_EQ(local_l->Shadows(), type_t); -} - -TEST_F(ResolverVarLetTest, LocalShadowsFunction) { - // fn a() { - // var a = true; - // } - // - // fn b() { - // let b = false; - // } - - auto* v = Var("a", nullptr, Expr(false)); - auto* l = Let("b", nullptr, Expr(false)); - auto* fa = Func("a", {}, ty.void_(), {Decl(v)}); - auto* fb = Func("b", {}, ty.void_(), {Decl(l)}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* local_v = Sem().Get(v); - auto* local_l = Sem().Get(l); - auto* func_a = Sem().Get(fa); - auto* func_b = Sem().Get(fb); - - ASSERT_NE(local_v, nullptr); - ASSERT_NE(local_l, nullptr); - ASSERT_NE(func_a, nullptr); - ASSERT_NE(func_b, nullptr); - - EXPECT_EQ(local_v->Shadows(), func_a); - EXPECT_EQ(local_l->Shadows(), func_b); -} - -TEST_F(ResolverVarLetTest, LocalShadowsGlobalVar) { - // var a : i32; - // - // fn X() { - // var a = a; - // } - // - // fn Y() { - // let a = a; - // } - - auto* g = Global("a", ty.i32(), ast::StorageClass::kPrivate); - auto* v = Var("a", nullptr, Expr("a")); - auto* l = Let("a", nullptr, Expr("a")); - Func("X", {}, ty.void_(), {Decl(v)}); - Func("Y", {}, ty.void_(), {Decl(l)}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* global = Sem().Get(g); - auto* local_v = Sem().Get(v); - auto* local_l = Sem().Get(l); - - ASSERT_NE(local_v, nullptr); - ASSERT_NE(local_l, nullptr); - - EXPECT_EQ(local_v->Shadows(), global); - EXPECT_EQ(local_l->Shadows(), global); - - auto* user_v = Sem().Get(local_v->Declaration()->constructor); - auto* user_l = Sem().Get(local_l->Declaration()->constructor); - - ASSERT_NE(user_v, nullptr); - ASSERT_NE(user_l, nullptr); - - EXPECT_EQ(user_v->Variable(), global); - EXPECT_EQ(user_l->Variable(), global); -} - -TEST_F(ResolverVarLetTest, LocalShadowsGlobalLet) { - // let a : i32 = 1; - // - // fn X() { - // var a = (a == 123); - // } - // - // fn Y() { - // let a = (a == 321); - // } - - auto* g = GlobalConst("a", ty.i32(), Expr(1_i)); - auto* v = Var("a", nullptr, Expr("a")); - auto* l = Let("a", nullptr, Expr("a")); - Func("X", {}, ty.void_(), {Decl(v)}); - Func("Y", {}, ty.void_(), {Decl(l)}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* global = Sem().Get(g); - auto* local_v = Sem().Get(v); - auto* local_l = Sem().Get(l); - - ASSERT_NE(local_v, nullptr); - ASSERT_NE(local_l, nullptr); - - EXPECT_EQ(local_v->Shadows(), global); - EXPECT_EQ(local_l->Shadows(), global); - - auto* user_v = Sem().Get(local_v->Declaration()->constructor); - auto* user_l = Sem().Get(local_l->Declaration()->constructor); - - ASSERT_NE(user_v, nullptr); - ASSERT_NE(user_l, nullptr); - - EXPECT_EQ(user_v->Variable(), global); - EXPECT_EQ(user_l->Variable(), global); -} - -TEST_F(ResolverVarLetTest, LocalShadowsLocalVar) { - // fn X() { - // var a : i32; - // { - // var a = a; - // } - // { - // let a = a; - // } - // } - - auto* s = Var("a", ty.i32(), Expr(1_i)); - auto* v = Var("a", nullptr, Expr("a")); - auto* l = Let("a", nullptr, Expr("a")); - Func("X", {}, ty.void_(), {Decl(s), Block(Decl(v)), Block(Decl(l))}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* local_s = Sem().Get(s); - auto* local_v = Sem().Get(v); - auto* local_l = Sem().Get(l); - - ASSERT_NE(local_s, nullptr); - ASSERT_NE(local_v, nullptr); - ASSERT_NE(local_l, nullptr); - - EXPECT_EQ(local_v->Shadows(), local_s); - EXPECT_EQ(local_l->Shadows(), local_s); - - auto* user_v = Sem().Get(local_v->Declaration()->constructor); - auto* user_l = Sem().Get(local_l->Declaration()->constructor); - - ASSERT_NE(user_v, nullptr); - ASSERT_NE(user_l, nullptr); - - EXPECT_EQ(user_v->Variable(), local_s); - EXPECT_EQ(user_l->Variable(), local_s); -} - -TEST_F(ResolverVarLetTest, LocalShadowsLocalLet) { - // fn X() { - // let a = 1; - // { - // var a = (a == 123); - // } - // { - // let a = (a == 321); - // } - // } - - auto* s = Let("a", ty.i32(), Expr(1_i)); - auto* v = Var("a", nullptr, Expr("a")); - auto* l = Let("a", nullptr, Expr("a")); - Func("X", {}, ty.void_(), {Decl(s), Block(Decl(v)), Block(Decl(l))}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* local_s = Sem().Get(s); - auto* local_v = Sem().Get(v); - auto* local_l = Sem().Get(l); - - ASSERT_NE(local_s, nullptr); - ASSERT_NE(local_v, nullptr); - ASSERT_NE(local_l, nullptr); - - EXPECT_EQ(local_v->Shadows(), local_s); - EXPECT_EQ(local_l->Shadows(), local_s); - - auto* user_v = Sem().Get(local_v->Declaration()->constructor); - auto* user_l = Sem().Get(local_l->Declaration()->constructor); - - ASSERT_NE(user_v, nullptr); - ASSERT_NE(user_l, nullptr); - - EXPECT_EQ(user_v->Variable(), local_s); - EXPECT_EQ(user_l->Variable(), local_s); -} - -TEST_F(ResolverVarLetTest, LocalShadowsParam) { - // fn F(a : i32) { - // { - // var a = a; - // } - // { - // let a = a; - // } - // } - - auto* p = Param("a", ty.i32()); - auto* v = Var("a", nullptr, Expr("a")); - auto* l = Let("a", nullptr, Expr("a")); - Func("X", {p}, ty.void_(), {Block(Decl(v)), Block(Decl(l))}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* param = Sem().Get(p); - auto* local_v = Sem().Get(v); - auto* local_l = Sem().Get(l); - - ASSERT_NE(param, nullptr); - ASSERT_NE(local_v, nullptr); - ASSERT_NE(local_l, nullptr); - - EXPECT_EQ(local_v->Shadows(), param); - EXPECT_EQ(local_l->Shadows(), param); - - auto* user_v = Sem().Get(local_v->Declaration()->constructor); - auto* user_l = Sem().Get(local_l->Declaration()->constructor); - - ASSERT_NE(user_v, nullptr); - ASSERT_NE(user_l, nullptr); - - EXPECT_EQ(user_v->Variable(), param); - EXPECT_EQ(user_l->Variable(), param); -} - -TEST_F(ResolverVarLetTest, ParamShadowsFunction) { - // fn a(a : bool) { - // } - - auto* p = Param("a", ty.bool_()); - auto* f = Func("a", {p}, ty.void_(), {}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* func = Sem().Get(f); - auto* param = Sem().Get(p); - - ASSERT_NE(func, nullptr); - ASSERT_NE(param, nullptr); - - EXPECT_EQ(param->Shadows(), func); -} - -TEST_F(ResolverVarLetTest, ParamShadowsGlobalVar) { - // var a : i32; - // - // fn F(a : bool) { - // } - - auto* g = Global("a", ty.i32(), ast::StorageClass::kPrivate); - auto* p = Param("a", ty.bool_()); - Func("F", {p}, ty.void_(), {}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* global = Sem().Get(g); - auto* param = Sem().Get(p); - - ASSERT_NE(global, nullptr); - ASSERT_NE(param, nullptr); - - EXPECT_EQ(param->Shadows(), global); -} - -TEST_F(ResolverVarLetTest, ParamShadowsGlobalLet) { - // let a : i32 = 1; - // - // fn F(a : bool) { - // } - - auto* g = GlobalConst("a", ty.i32(), Expr(1_i)); - auto* p = Param("a", ty.bool_()); - Func("F", {p}, ty.void_(), {}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* global = Sem().Get(g); - auto* param = Sem().Get(p); - - ASSERT_NE(global, nullptr); - ASSERT_NE(param, nullptr); - - EXPECT_EQ(param->Shadows(), global); -} - -TEST_F(ResolverVarLetTest, ParamShadowsAlias) { - // type a = i32; - // - // fn F(a : a) { - // } - - auto* a = Alias("a", ty.i32()); - auto* p = Param("a", ty.type_name("a")); - Func("F", {p}, ty.void_(), {}); - - ASSERT_TRUE(r()->Resolve()) << r()->error(); - - auto* alias = Sem().Get(a); - auto* param = Sem().Get(p); - - ASSERT_NE(alias, nullptr); - ASSERT_NE(param, nullptr); - - EXPECT_EQ(param->Shadows(), alias); - EXPECT_EQ(param->Type(), alias); -} - -} // namespace -} // namespace tint::resolver diff --git a/src/tint/resolver/var_let_validation_test.cc b/src/tint/resolver/var_let_validation_test.cc deleted file mode 100644 index ff63918d8e..0000000000 --- a/src/tint/resolver/var_let_validation_test.cc +++ /dev/null @@ -1,319 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/resolver/resolver.h" -#include "src/tint/resolver/resolver_test_helper.h" - -#include "gmock/gmock.h" - -using namespace tint::number_suffixes; // NOLINT - -namespace tint::resolver { -namespace { - -struct ResolverVarLetValidationTest : public resolver::TestHelper, public testing::Test {}; - -TEST_F(ResolverVarLetValidationTest, LetNoInitializer) { - // let a : i32; - WrapInFunction(Let(Source{{12, 34}}, "a", ty.i32(), nullptr)); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: let declaration must have an initializer"); -} - -TEST_F(ResolverVarLetValidationTest, GlobalLetNoInitializer) { - // let a : i32; - GlobalConst(Source{{12, 34}}, "a", ty.i32(), nullptr); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: let declaration must have an initializer"); -} - -TEST_F(ResolverVarLetValidationTest, VarNoInitializerNoType) { - // var a; - WrapInFunction(Var(Source{{12, 34}}, "a", nullptr)); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: function scope var declaration requires a type or " - "initializer"); -} - -TEST_F(ResolverVarLetValidationTest, GlobalVarNoInitializerNoType) { - // var a; - Global(Source{{12, 34}}, "a", nullptr); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: module scope var declaration requires a type and " - "initializer"); -} - -TEST_F(ResolverVarLetValidationTest, VarTypeNotStorable) { - // var i : i32; - // var p : pointer = &v; - auto* i = Var("i", ty.i32(), ast::StorageClass::kNone); - auto* p = Var(Source{{56, 78}}, "a", ty.pointer(ast::StorageClass::kFunction), - ast::StorageClass::kNone, AddressOf(Source{{12, 34}}, "i")); - WrapInFunction(i, p); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "56:78 error: ptr cannot be used as the " - "type of a var"); -} - -TEST_F(ResolverVarLetValidationTest, LetTypeNotConstructible) { - // @group(0) @binding(0) var t1 : texture_2d; - // let t2 : t1; - auto* t1 = Global("t1", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), - GroupAndBinding(0, 0)); - auto* t2 = Let(Source{{56, 78}}, "t2", nullptr, Expr(t1)); - WrapInFunction(t2); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "56:78 error: texture_2d cannot be used as the type of a let"); -} - -TEST_F(ResolverVarLetValidationTest, LetConstructorWrongType) { - // var v : i32 = 2u - WrapInFunction(Let(Source{{3, 3}}, "v", ty.i32(), Expr(2_u))); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - R"(3:3 error: cannot initialize let of type 'i32' with value of type 'u32')"); -} - -TEST_F(ResolverVarLetValidationTest, VarConstructorWrongType) { - // var v : i32 = 2u - WrapInFunction(Var(Source{{3, 3}}, "v", ty.i32(), ast::StorageClass::kNone, Expr(2_u))); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - R"(3:3 error: cannot initialize var of type 'i32' with value of type 'u32')"); -} - -TEST_F(ResolverVarLetValidationTest, LetConstructorWrongTypeViaAlias) { - auto* a = Alias("I32", ty.i32()); - WrapInFunction(Let(Source{{3, 3}}, "v", ty.Of(a), Expr(2_u))); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - R"(3:3 error: cannot initialize let of type 'i32' with value of type 'u32')"); -} - -TEST_F(ResolverVarLetValidationTest, VarConstructorWrongTypeViaAlias) { - auto* a = Alias("I32", ty.i32()); - WrapInFunction(Var(Source{{3, 3}}, "v", ty.Of(a), ast::StorageClass::kNone, Expr(2_u))); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - R"(3:3 error: cannot initialize var of type 'i32' with value of type 'u32')"); -} - -TEST_F(ResolverVarLetValidationTest, LetOfPtrConstructedWithRef) { - // var a : f32; - // let b : ptr = a; - const auto priv = ast::StorageClass::kFunction; - auto* var_a = Var("a", ty.f32(), priv); - auto* var_b = Let(Source{{12, 34}}, "b", ty.pointer(priv), Expr("a"), {}); - WrapInFunction(var_a, var_b); - - ASSERT_FALSE(r()->Resolve()); - - EXPECT_EQ( - r()->error(), - R"(12:34 error: cannot initialize let of type 'ptr' with value of type 'f32')"); -} - -TEST_F(ResolverVarLetValidationTest, LocalLetRedeclared) { - // let l : f32 = 1.; - // let l : i32 = 0; - auto* l1 = Let("l", ty.f32(), Expr(1.f)); - auto* l2 = Let(Source{{12, 34}}, "l", ty.i32(), Expr(0_i)); - WrapInFunction(l1, l2); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: redeclaration of 'l'\nnote: 'l' previously declared here"); -} - -TEST_F(ResolverVarLetValidationTest, GlobalVarRedeclaredAsLocal) { - // var v : f32 = 2.1; - // fn my_func() { - // var v : f32 = 2.0; - // return 0; - // } - - Global("v", ty.f32(), ast::StorageClass::kPrivate, Expr(2.1f)); - - WrapInFunction(Var(Source{{12, 34}}, "v", ty.f32(), ast::StorageClass::kNone, Expr(2.0f))); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); -} - -TEST_F(ResolverVarLetValidationTest, VarRedeclaredInInnerBlock) { - // { - // var v : f32; - // { var v : f32; } - // } - auto* var_outer = Var("v", ty.f32(), ast::StorageClass::kNone); - auto* var_inner = Var(Source{{12, 34}}, "v", ty.f32(), ast::StorageClass::kNone); - auto* inner = Block(Decl(var_inner)); - auto* outer_body = Block(Decl(var_outer), inner); - - WrapInFunction(outer_body); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); -} - -TEST_F(ResolverVarLetValidationTest, VarRedeclaredInIfBlock) { - // { - // var v : f32 = 3.14; - // if (true) { var v : f32 = 2.0; } - // } - auto* var_a_float = Var("v", ty.f32(), ast::StorageClass::kNone, Expr(3.1f)); - - auto* var = Var(Source{{12, 34}}, "v", ty.f32(), ast::StorageClass::kNone, Expr(2.0f)); - - auto* cond = Expr(true); - auto* body = Block(Decl(var)); - - auto* outer_body = Block(Decl(var_a_float), If(cond, body)); - - WrapInFunction(outer_body); - - EXPECT_TRUE(r()->Resolve()) << r()->error(); -} - -TEST_F(ResolverVarLetValidationTest, InferredPtrStorageAccessMismatch) { - // struct Inner { - // arr: array; - // } - // struct S { - // inner: Inner; - // } - // @group(0) @binding(0) var s : S; - // fn f() { - // let p : pointer = &s.inner.arr[2i]; - // } - auto* inner = Structure("Inner", {Member("arr", ty.array())}); - auto* buf = Structure("S", {Member("inner", ty.Of(inner))}); - auto* storage = Global("s", ty.Of(buf), ast::StorageClass::kStorage, - ast::AttributeList{ - create(0), - create(0), - }); - - auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 2_i); - auto* ptr = - Let(Source{{12, 34}}, "p", - ty.pointer(ast::StorageClass::kStorage, ast::Access::kReadWrite), AddressOf(expr)); - - WrapInFunction(ptr); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: cannot initialize let of type " - "'ptr' with value of type " - "'ptr'"); -} - -TEST_F(ResolverVarLetValidationTest, NonConstructibleType_Atomic) { - auto* v = Var("v", ty.atomic(Source{{12, 34}}, ty.i32())); - WrapInFunction(v); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: function variable must have a constructible type"); -} - -TEST_F(ResolverVarLetValidationTest, NonConstructibleType_RuntimeArray) { - auto* s = Structure("S", {Member(Source{{56, 78}}, "m", ty.array(ty.i32()))}); - auto* v = Var(Source{{12, 34}}, "v", ty.Of(s)); - WrapInFunction(v); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - R"(12:34 error: runtime-sized arrays can only be used in the storage class -56:78 note: while analysing structure member S.m -12:34 note: while instantiating variable v)"); -} - -TEST_F(ResolverVarLetValidationTest, NonConstructibleType_Struct_WithAtomic) { - auto* s = Structure("S", {Member("m", ty.atomic(ty.i32()))}); - auto* v = Var("v", ty.Of(s)); - WrapInFunction(v); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "error: function variable must have a constructible type"); -} - -TEST_F(ResolverVarLetValidationTest, NonConstructibleType_InferredType) { - // @group(0) @binding(0) var s : sampler; - // fn foo() { - // var v = s; - // } - Global("s", ty.sampler(ast::SamplerKind::kSampler), GroupAndBinding(0, 0)); - auto* v = Var(Source{{12, 34}}, "v", nullptr, Expr("s")); - WrapInFunction(v); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: function variable must have a constructible type"); -} - -TEST_F(ResolverVarLetValidationTest, InvalidStorageClassForInitializer) { - // var v : f32 = 1.23; - Global(Source{{12, 34}}, "v", ty.f32(), ast::StorageClass::kWorkgroup, Expr(1.23f)); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), - "12:34 error: var of storage class 'workgroup' cannot have " - "an initializer. var initializers are only supported for the " - "storage classes 'private' and 'function'"); -} - -TEST_F(ResolverVarLetValidationTest, VectorLetNoType) { - // let a : mat3x3 = mat3x3(); - WrapInFunction(Let("a", create(Source{{12, 34}}, nullptr, 3), vec3())); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: missing vector element type"); -} - -TEST_F(ResolverVarLetValidationTest, VectorVarNoType) { - // var a : mat3x3; - WrapInFunction(Var("a", create(Source{{12, 34}}, nullptr, 3))); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: missing vector element type"); -} - -TEST_F(ResolverVarLetValidationTest, MatrixLetNoType) { - // let a : mat3x3 = mat3x3(); - WrapInFunction(Let("a", create(Source{{12, 34}}, nullptr, 3, 3), mat3x3())); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type"); -} - -TEST_F(ResolverVarLetValidationTest, MatrixVarNoType) { - // var a : mat3x3; - WrapInFunction(Var("a", create(Source{{12, 34}}, nullptr, 3, 3))); - - EXPECT_FALSE(r()->Resolve()); - EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type"); -} - -} // namespace -} // namespace tint::resolver diff --git a/src/tint/resolver/variable_test.cc b/src/tint/resolver/variable_test.cc new file mode 100644 index 0000000000..02c37d5571 --- /dev/null +++ b/src/tint/resolver/variable_test.cc @@ -0,0 +1,1280 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/resolver/resolver.h" +#include "src/tint/resolver/resolver_test_helper.h" +#include "src/tint/sem/reference.h" + +#include "gmock/gmock.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::resolver { +namespace { + +struct ResolverVariableTest : public resolver::TestHelper, public testing::Test {}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Function-scope 'var' +//////////////////////////////////////////////////////////////////////////////////////////////////// +TEST_F(ResolverVariableTest, LocalVar_NoConstructor) { + // struct S { i : i32; } + // alias A = S; + // fn F(){ + // var i : i32; + // var u : u32; + // var f : f32; + // var h : f16; + // var b : bool; + // var s : S; + // var a : A; + // } + + Enable(ast::Extension::kF16); + + auto* S = Structure("S", utils::Vector{Member("i", ty.i32())}); + auto* A = Alias("A", ty.Of(S)); + + auto* i = Var("i", ty.i32()); + auto* u = Var("u", ty.u32()); + auto* f = Var("f", ty.f32()); + auto* h = Var("h", ty.f16()); + auto* b = Var("b", ty.bool_()); + auto* s = Var("s", ty.Of(S)); + auto* a = Var("a", ty.Of(A)); + + Func("F", utils::Empty, ty.void_(), + utils::Vector{ + Decl(i), + Decl(u), + Decl(f), + Decl(h), + Decl(b), + Decl(s), + Decl(a), + }); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + // `var` declarations are always of reference type + ASSERT_TRUE(TypeOf(i)->Is()); + ASSERT_TRUE(TypeOf(u)->Is()); + ASSERT_TRUE(TypeOf(f)->Is()); + ASSERT_TRUE(TypeOf(h)->Is()); + ASSERT_TRUE(TypeOf(b)->Is()); + ASSERT_TRUE(TypeOf(s)->Is()); + ASSERT_TRUE(TypeOf(a)->Is()); + + EXPECT_TRUE(TypeOf(i)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(u)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(f)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(h)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(b)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(s)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(a)->As()->StoreType()->Is()); + + EXPECT_EQ(Sem().Get(i)->Constructor(), nullptr); + EXPECT_EQ(Sem().Get(u)->Constructor(), nullptr); + EXPECT_EQ(Sem().Get(f)->Constructor(), nullptr); + EXPECT_EQ(Sem().Get(h)->Constructor(), nullptr); + EXPECT_EQ(Sem().Get(b)->Constructor(), nullptr); + EXPECT_EQ(Sem().Get(s)->Constructor(), nullptr); + EXPECT_EQ(Sem().Get(a)->Constructor(), nullptr); +} + +TEST_F(ResolverVariableTest, LocalVar_WithConstructor) { + // struct S { i : i32; } + // alias A = S; + // fn F(){ + // var i : i32 = 1i; + // var u : u32 = 1u; + // var f : f32 = 1.f; + // var h : f16 = 1.h; + // var b : bool = true; + // var s : S = S(1); + // var a : A = A(1); + // } + + Enable(ast::Extension::kF16); + + auto* S = Structure("S", utils::Vector{Member("i", ty.i32())}); + auto* A = Alias("A", ty.Of(S)); + + auto* i_c = Expr(1_i); + auto* u_c = Expr(1_u); + auto* f_c = Expr(1_f); + auto* h_c = Expr(1_h); + auto* b_c = Expr(true); + auto* s_c = Construct(ty.Of(S), Expr(1_i)); + auto* a_c = Construct(ty.Of(A), Expr(1_i)); + + auto* i = Var("i", ty.i32(), i_c); + auto* u = Var("u", ty.u32(), u_c); + auto* f = Var("f", ty.f32(), f_c); + auto* h = Var("h", ty.f16(), h_c); + auto* b = Var("b", ty.bool_(), b_c); + auto* s = Var("s", ty.Of(S), s_c); + auto* a = Var("a", ty.Of(A), a_c); + + Func("F", utils::Empty, ty.void_(), + utils::Vector{ + Decl(i), + Decl(u), + Decl(f), + Decl(h), + Decl(b), + Decl(s), + Decl(a), + }); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + // `var` declarations are always of reference type + ASSERT_TRUE(TypeOf(i)->Is()); + ASSERT_TRUE(TypeOf(u)->Is()); + ASSERT_TRUE(TypeOf(f)->Is()); + ASSERT_TRUE(TypeOf(h)->Is()); + ASSERT_TRUE(TypeOf(b)->Is()); + ASSERT_TRUE(TypeOf(s)->Is()); + ASSERT_TRUE(TypeOf(a)->Is()); + + EXPECT_EQ(TypeOf(i)->As()->Access(), ast::Access::kReadWrite); + EXPECT_EQ(TypeOf(u)->As()->Access(), ast::Access::kReadWrite); + EXPECT_EQ(TypeOf(f)->As()->Access(), ast::Access::kReadWrite); + EXPECT_EQ(TypeOf(b)->As()->Access(), ast::Access::kReadWrite); + EXPECT_EQ(TypeOf(s)->As()->Access(), ast::Access::kReadWrite); + EXPECT_EQ(TypeOf(a)->As()->Access(), ast::Access::kReadWrite); + + EXPECT_TRUE(TypeOf(i)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(u)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(f)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(h)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(b)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(s)->As()->StoreType()->Is()); + EXPECT_TRUE(TypeOf(a)->As()->StoreType()->Is()); + + EXPECT_EQ(Sem().Get(i)->Constructor()->Declaration(), i_c); + EXPECT_EQ(Sem().Get(u)->Constructor()->Declaration(), u_c); + EXPECT_EQ(Sem().Get(f)->Constructor()->Declaration(), f_c); + EXPECT_EQ(Sem().Get(h)->Constructor()->Declaration(), h_c); + EXPECT_EQ(Sem().Get(b)->Constructor()->Declaration(), b_c); + EXPECT_EQ(Sem().Get(s)->Constructor()->Declaration(), s_c); + EXPECT_EQ(Sem().Get(a)->Constructor()->Declaration(), a_c); +} + +TEST_F(ResolverVariableTest, LocalVar_ShadowsAlias) { + // type a = i32; + // + // fn F() { + // var a = false; + // } + + auto* t = Alias("a", ty.i32()); + auto* v = Var("a", Expr(false)); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* type_t = Sem().Get(t); + auto* local = Sem().Get(v); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), type_t); +} + +TEST_F(ResolverVariableTest, LocalVar_ShadowsStruct) { + // struct a { + // m : i32; + // }; + // + // fn F() { + // var a = true; + // } + + auto* t = Structure("a", utils::Vector{Member("m", ty.i32())}); + auto* v = Var("a", Expr(false)); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* type_t = Sem().Get(t); + auto* local = Sem().Get(v); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), type_t); +} + +TEST_F(ResolverVariableTest, LocalVar_ShadowsFunction) { + // fn a() { + // var a = true; + // } + + auto* v = Var("a", Expr(false)); + auto* f = Func("a", utils::Empty, ty.void_(), utils::Vector{Decl(v)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* func = Sem().Get(f); + ASSERT_NE(func, nullptr); + + auto* local = Sem().Get(v); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), func); +} + +TEST_F(ResolverVariableTest, LocalVar_ShadowsGlobalVar) { + // var a : i32; + // + // fn F() { + // var a = a; + // } + + auto* g = GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); + auto* v = Var("a", Expr("a")); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* global = Sem().Get(g); + auto* local = Sem().Get(v); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), global); + + auto* user_v = Sem().Get(local->Declaration()->constructor); + ASSERT_NE(user_v, nullptr); + EXPECT_EQ(user_v->Variable(), global); +} + +TEST_F(ResolverVariableTest, LocalVar_ShadowsGlobalConst) { + // const a : i32 = 1i; + // + // fn X() { + // var a = (a == 123); + // } + + auto* g = GlobalConst("a", ty.i32(), Expr(1_i)); + auto* v = Var("a", Expr("a")); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* global = Sem().Get(g); + auto* local = Sem().Get(v); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), global); + + auto* user_v = Sem().Get(local->Declaration()->constructor); + ASSERT_NE(user_v, nullptr); + EXPECT_EQ(user_v->Variable(), global); +} + +TEST_F(ResolverVariableTest, LocalVar_ShadowsLocalVar) { + // fn F() { + // var a : i32 = 1i; // x + // { + // var a = a; // y + // } + // } + + auto* x = Var("a", ty.i32(), Expr(1_i)); + auto* y = Var("a", Expr("a")); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(x), Block(Decl(y))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* local_x = Sem().Get(x); + auto* local_y = Sem().Get(y); + + ASSERT_NE(local_x, nullptr); + ASSERT_NE(local_y, nullptr); + EXPECT_EQ(local_y->Shadows(), local_x); + + auto* user_y = Sem().Get(local_y->Declaration()->constructor); + ASSERT_NE(user_y, nullptr); + EXPECT_EQ(user_y->Variable(), local_x); +} + +TEST_F(ResolverVariableTest, LocalVar_ShadowsLocalConst) { + // fn F() { + // const a : i32 = 1i; + // { + // var a = (a == 123); + // } + // } + + auto* c = Const("a", ty.i32(), Expr(1_i)); + auto* v = Var("a", Expr("a")); + Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(c), Block(Decl(v))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* local_c = Sem().Get(c); + auto* local_v = Sem().Get(v); + + ASSERT_NE(local_c, nullptr); + ASSERT_NE(local_v, nullptr); + EXPECT_EQ(local_v->Shadows(), local_c); + + auto* user_v = Sem().Get(local_v->Declaration()->constructor); + ASSERT_NE(user_v, nullptr); + EXPECT_EQ(user_v->Variable(), local_c); +} + +TEST_F(ResolverVariableTest, LocalVar_ShadowsLocalLet) { + // fn F() { + // let a : i32 = 1i; + // { + // var a = (a == 123); + // } + // } + + auto* l = Let("a", ty.i32(), Expr(1_i)); + auto* v = Var("a", Expr("a")); + Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(l), Block(Decl(v))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* local_l = Sem().Get(l); + auto* local_v = Sem().Get(v); + + ASSERT_NE(local_l, nullptr); + ASSERT_NE(local_v, nullptr); + EXPECT_EQ(local_v->Shadows(), local_l); + + auto* user_v = Sem().Get(local_v->Declaration()->constructor); + ASSERT_NE(user_v, nullptr); + EXPECT_EQ(user_v->Variable(), local_l); +} + +TEST_F(ResolverVariableTest, LocalVar_ShadowsParam) { + // fn F(a : i32) { + // { + // var a = a; + // } + // } + + auto* p = Param("a", ty.i32()); + auto* v = Var("a", Expr("a")); + Func("X", utils::Vector{p}, ty.void_(), utils::Vector{Block(Decl(v))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* param = Sem().Get(p); + auto* local = Sem().Get(v); + + ASSERT_NE(param, nullptr); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), param); + + auto* user_v = Sem().Get(local->Declaration()->constructor); + ASSERT_NE(user_v, nullptr); + EXPECT_EQ(user_v->Variable(), param); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Function-scope 'let' +//////////////////////////////////////////////////////////////////////////////////////////////////// +TEST_F(ResolverVariableTest, LocalLet) { + // struct S { i : i32; } + // fn F(){ + // var v : i32; + // let i : i32 = 1i; + // let u : u32 = 1u; + // let f : f32 = 1.f; + // let h : h32 = 1.h; + // let b : bool = true; + // let s : S = S(1); + // let a : A = A(1); + // let p : pointer = &v; + // } + + Enable(ast::Extension::kF16); + + auto* S = Structure("S", utils::Vector{Member("i", ty.i32())}); + auto* A = Alias("A", ty.Of(S)); + auto* v = Var("v", ty.i32()); + + auto* i_c = Expr(1_i); + auto* u_c = Expr(1_u); + auto* f_c = Expr(1_f); + auto* h_c = Expr(1_h); + auto* b_c = Expr(true); + auto* s_c = Construct(ty.Of(S), Expr(1_i)); + auto* a_c = Construct(ty.Of(A), Expr(1_i)); + auto* p_c = AddressOf(v); + + auto* i = Let("i", ty.i32(), i_c); + auto* u = Let("u", ty.u32(), u_c); + auto* f = Let("f", ty.f32(), f_c); + auto* h = Let("h", ty.f16(), h_c); + auto* b = Let("b", ty.bool_(), b_c); + auto* s = Let("s", ty.Of(S), s_c); + auto* a = Let("a", ty.Of(A), a_c); + auto* p = Let("p", ty.pointer(ast::StorageClass::kFunction), p_c); + + Func("F", utils::Empty, ty.void_(), + utils::Vector{ + Decl(v), + Decl(i), + Decl(u), + Decl(f), + Decl(h), + Decl(b), + Decl(s), + Decl(a), + Decl(p), + }); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + // `let` declarations are always of the storage type + ASSERT_TRUE(TypeOf(i)->Is()); + ASSERT_TRUE(TypeOf(u)->Is()); + ASSERT_TRUE(TypeOf(f)->Is()); + ASSERT_TRUE(TypeOf(h)->Is()); + ASSERT_TRUE(TypeOf(b)->Is()); + ASSERT_TRUE(TypeOf(s)->Is()); + ASSERT_TRUE(TypeOf(a)->Is()); + ASSERT_TRUE(TypeOf(p)->Is()); + ASSERT_TRUE(TypeOf(p)->As()->StoreType()->Is()); + + EXPECT_EQ(Sem().Get(i)->Constructor()->Declaration(), i_c); + EXPECT_EQ(Sem().Get(u)->Constructor()->Declaration(), u_c); + EXPECT_EQ(Sem().Get(f)->Constructor()->Declaration(), f_c); + EXPECT_EQ(Sem().Get(h)->Constructor()->Declaration(), h_c); + EXPECT_EQ(Sem().Get(b)->Constructor()->Declaration(), b_c); + EXPECT_EQ(Sem().Get(s)->Constructor()->Declaration(), s_c); + EXPECT_EQ(Sem().Get(a)->Constructor()->Declaration(), a_c); + EXPECT_EQ(Sem().Get(p)->Constructor()->Declaration(), p_c); +} + +TEST_F(ResolverVariableTest, LocalLet_InheritsAccessFromOriginatingVariable) { + // struct Inner { + // arr: array; + // } + // struct S { + // inner: Inner; + // } + // @group(0) @binding(0) var s : S; + // fn f() { + // let p = &s.inner.arr[4]; + // } + auto* inner = Structure("Inner", utils::Vector{Member("arr", ty.array())}); + auto* buf = Structure("S", utils::Vector{Member("inner", ty.Of(inner))}); + auto* storage = GlobalVar("s", ty.Of(buf), ast::StorageClass::kStorage, ast::Access::kReadWrite, + Binding(0), Group(0)); + + auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 4_i); + auto* ptr = Let("p", AddressOf(expr)); + + WrapInFunction(ptr); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_TRUE(TypeOf(expr)->Is()); + ASSERT_TRUE(TypeOf(ptr)->Is()); + + EXPECT_EQ(TypeOf(expr)->As()->Access(), ast::Access::kReadWrite); + EXPECT_EQ(TypeOf(ptr)->As()->Access(), ast::Access::kReadWrite); +} + +TEST_F(ResolverVariableTest, LocalLet_ShadowsAlias) { + // type a = i32; + // + // fn F() { + // let a = true; + // } + + auto* t = Alias("a", ty.i32()); + auto* l = Let("a", Expr(false)); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(l)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* type_t = Sem().Get(t); + auto* local = Sem().Get(l); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), type_t); +} + +TEST_F(ResolverVariableTest, LocalLet_ShadowsStruct) { + // struct a { + // m : i32; + // }; + // + // fn F() { + // let a = false; + // } + + auto* t = Structure("a", utils::Vector{Member("m", ty.i32())}); + auto* l = Let("a", Expr(false)); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(l)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* type_t = Sem().Get(t); + auto* local = Sem().Get(l); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), type_t); +} + +TEST_F(ResolverVariableTest, LocalLet_ShadowsFunction) { + // fn a() { + // let a = false; + // } + + auto* l = Let("a", Expr(false)); + auto* fb = Func("a", utils::Empty, ty.void_(), utils::Vector{Decl(l)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* func = Sem().Get(fb); + ASSERT_NE(func, nullptr); + + auto* local = Sem().Get(l); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), func); +} + +TEST_F(ResolverVariableTest, LocalLet_ShadowsGlobalVar) { + // var a : i32; + // + // fn F() { + // let a = a; + // } + + auto* g = GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); + auto* l = Let("a", Expr("a")); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(l)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* global = Sem().Get(g); + auto* local = Sem().Get(l); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), global); + + auto* user = Sem().Get(local->Declaration()->constructor); + ASSERT_NE(user, nullptr); + EXPECT_EQ(user->Variable(), global); +} + +TEST_F(ResolverVariableTest, LocalLet_ShadowsGlobalConst) { + // const a : i32 = 1i; + // + // fn F() { + // let a = a; + // } + + auto* g = GlobalConst("a", ty.i32(), Expr(1_i)); + auto* l = Let("a", Expr("a")); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(l)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* global = Sem().Get(g); + auto* local = Sem().Get(l); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), global); + + auto* user = Sem().Get(local->Declaration()->constructor); + ASSERT_NE(user, nullptr); + EXPECT_EQ(user->Variable(), global); +} + +TEST_F(ResolverVariableTest, LocalLet_ShadowsLocalVar) { + // fn F() { + // var a : i32 = 1i; + // { + // let a = a; + // } + // } + + auto* v = Var("a", ty.i32(), Expr(1_i)); + auto* l = Let("a", Expr("a")); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v), Block(Decl(l))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* local_v = Sem().Get(v); + auto* local_l = Sem().Get(l); + + ASSERT_NE(local_v, nullptr); + ASSERT_NE(local_l, nullptr); + EXPECT_EQ(local_l->Shadows(), local_v); + + auto* user = Sem().Get(local_l->Declaration()->constructor); + ASSERT_NE(user, nullptr); + EXPECT_EQ(user->Variable(), local_v); +} + +TEST_F(ResolverVariableTest, LocalLet_ShadowsLocalConst) { + // fn X() { + // const a : i32 = 1i; // x + // { + // let a = a; // y + // } + // } + + auto* x = Const("a", ty.i32(), Expr(1_i)); + auto* y = Let("a", Expr("a")); + Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(x), Block(Decl(y))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* local_x = Sem().Get(x); + auto* local_y = Sem().Get(y); + + ASSERT_NE(local_x, nullptr); + ASSERT_NE(local_y, nullptr); + EXPECT_EQ(local_y->Shadows(), local_x); + + auto* user = Sem().Get(local_y->Declaration()->constructor); + ASSERT_NE(user, nullptr); + EXPECT_EQ(user->Variable(), local_x); +} + +TEST_F(ResolverVariableTest, LocalLet_ShadowsLocalLet) { + // fn X() { + // let a : i32 = 1i; // x + // { + // let a = a; // y + // } + // } + + auto* x = Let("a", ty.i32(), Expr(1_i)); + auto* y = Let("a", Expr("a")); + Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(x), Block(Decl(y))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* local_x = Sem().Get(x); + auto* local_y = Sem().Get(y); + + ASSERT_NE(local_x, nullptr); + ASSERT_NE(local_y, nullptr); + EXPECT_EQ(local_y->Shadows(), local_x); + + auto* user = Sem().Get(local_y->Declaration()->constructor); + ASSERT_NE(user, nullptr); + EXPECT_EQ(user->Variable(), local_x); +} + +TEST_F(ResolverVariableTest, LocalLet_ShadowsParam) { + // fn F(a : i32) { + // { + // let a = a; + // } + // } + + auto* p = Param("a", ty.i32()); + auto* l = Let("a", Expr("a")); + Func("X", utils::Vector{p}, ty.void_(), utils::Vector{Block(Decl(l))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* param = Sem().Get(p); + auto* local = Sem().Get(l); + + ASSERT_NE(param, nullptr); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), param); + + auto* user = Sem().Get(local->Declaration()->constructor); + ASSERT_NE(user, nullptr); + EXPECT_EQ(user->Variable(), param); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Function-scope const +//////////////////////////////////////////////////////////////////////////////////////////////////// +TEST_F(ResolverVariableTest, LocalConst_ShadowsAlias) { + // type a = i32; + // + // fn F() { + // const a = true; + // } + + auto* t = Alias("a", ty.i32()); + auto* c = Const("a", Expr(false)); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(c)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* type_t = Sem().Get(t); + auto* local = Sem().Get(c); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), type_t); +} + +TEST_F(ResolverVariableTest, LocalConst_ShadowsStruct) { + // struct a { + // m : i32; + // }; + // + // fn F() { + // const a = false; + // } + + auto* t = Structure("a", utils::Vector{Member("m", ty.i32())}); + auto* c = Const("a", Expr(false)); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(c)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* type_t = Sem().Get(t); + auto* local = Sem().Get(c); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), type_t); +} + +TEST_F(ResolverVariableTest, LocalConst_ShadowsFunction) { + // fn a() { + // const a = false; + // } + + auto* c = Const("a", Expr(false)); + auto* fb = Func("a", utils::Empty, ty.void_(), utils::Vector{Decl(c)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* func = Sem().Get(fb); + ASSERT_NE(func, nullptr); + + auto* local = Sem().Get(c); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), func); +} + +TEST_F(ResolverVariableTest, LocalConst_ShadowsGlobalVar) { + // var a : i32; + // + // fn F() { + // const a = 1i; + // } + + auto* g = GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); + auto* c = Const("a", Expr(1_i)); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(c)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* global = Sem().Get(g); + auto* local = Sem().Get(c); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), global); +} + +TEST_F(ResolverVariableTest, LocalConst_ShadowsGlobalConst) { + // const a : i32 = 1i; + // + // fn F() { + // const a = a; + // } + + auto* g = GlobalConst("a", ty.i32(), Expr(1_i)); + auto* c = Const("a", Expr("a")); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(c)}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* global = Sem().Get(g); + auto* local = Sem().Get(c); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), global); + + auto* user = Sem().Get(local->Declaration()->constructor); + ASSERT_NE(user, nullptr); + EXPECT_EQ(user->Variable(), global); +} + +TEST_F(ResolverVariableTest, LocalConst_ShadowsLocalVar) { + // fn F() { + // var a = 1i; + // { + // const a = 1i; + // } + // } + + auto* v = Var("a", ty.i32(), Expr(1_i)); + auto* c = Const("a", Expr(1_i)); + Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v), Block(Decl(c))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* local_v = Sem().Get(v); + auto* local_c = Sem().Get(c); + + ASSERT_NE(local_v, nullptr); + ASSERT_NE(local_c, nullptr); + EXPECT_EQ(local_c->Shadows(), local_v); +} + +TEST_F(ResolverVariableTest, LocalConst_ShadowsLocalConst) { + // fn X() { + // const a = 1i; // x + // { + // const a = a; // y + // } + // } + + auto* x = Const("a", ty.i32(), Expr(1_i)); + auto* y = Const("a", Expr("a")); + Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(x), Block(Decl(y))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* local_x = Sem().Get(x); + auto* local_y = Sem().Get(y); + + ASSERT_NE(local_x, nullptr); + ASSERT_NE(local_y, nullptr); + EXPECT_EQ(local_y->Shadows(), local_x); + + auto* user = Sem().Get(local_y->Declaration()->constructor); + ASSERT_NE(user, nullptr); + EXPECT_EQ(user->Variable(), local_x); +} + +TEST_F(ResolverVariableTest, LocalConst_ShadowsLocalLet) { + // fn X() { + // let a = 1i; // x + // { + // const a = 1i; // y + // } + // } + + auto* l = Let("a", ty.i32(), Expr(1_i)); + auto* c = Const("a", Expr(1_i)); + Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(l), Block(Decl(c))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* local_l = Sem().Get(l); + auto* local_c = Sem().Get(c); + + ASSERT_NE(local_l, nullptr); + ASSERT_NE(local_c, nullptr); + EXPECT_EQ(local_c->Shadows(), local_l); +} + +TEST_F(ResolverVariableTest, LocalConst_ShadowsParam) { + // fn F(a : i32) { + // { + // const a = 1i; + // } + // } + + auto* p = Param("a", ty.i32()); + auto* c = Const("a", Expr(1_i)); + Func("X", utils::Vector{p}, ty.void_(), utils::Vector{Block(Decl(c))}); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* param = Sem().Get(p); + auto* local = Sem().Get(c); + + ASSERT_NE(param, nullptr); + ASSERT_NE(local, nullptr); + EXPECT_EQ(local->Shadows(), param); +} + +TEST_F(ResolverVariableTest, LocalConst_ExplicitType_Decls) { + Structure("S", utils::Vector{Member("m", ty.u32())}); + + auto* c_i32 = Const("a", ty.i32(), Expr(0_i)); + auto* c_u32 = Const("b", ty.u32(), Expr(0_u)); + auto* c_f32 = Const("c", ty.f32(), Expr(0_f)); + auto* c_vi32 = Const("d", ty.vec3(), vec3()); + auto* c_vu32 = Const("e", ty.vec3(), vec3()); + auto* c_vf32 = Const("f", ty.vec3(), vec3()); + auto* c_mf32 = Const("g", ty.mat3x3(), mat3x3()); + auto* c_s = Const("h", ty.type_name("S"), Construct(ty.type_name("S"))); + + WrapInFunction(c_i32, c_u32, c_f32, c_vi32, c_vu32, c_vf32, c_mf32, c_s); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + EXPECT_EQ(Sem().Get(c_i32)->Declaration(), c_i32); + EXPECT_EQ(Sem().Get(c_u32)->Declaration(), c_u32); + EXPECT_EQ(Sem().Get(c_f32)->Declaration(), c_f32); + EXPECT_EQ(Sem().Get(c_vi32)->Declaration(), c_vi32); + EXPECT_EQ(Sem().Get(c_vu32)->Declaration(), c_vu32); + EXPECT_EQ(Sem().Get(c_vf32)->Declaration(), c_vf32); + EXPECT_EQ(Sem().Get(c_mf32)->Declaration(), c_mf32); + EXPECT_EQ(Sem().Get(c_s)->Declaration(), c_s); + + ASSERT_TRUE(TypeOf(c_i32)->Is()); + ASSERT_TRUE(TypeOf(c_u32)->Is()); + ASSERT_TRUE(TypeOf(c_f32)->Is()); + ASSERT_TRUE(TypeOf(c_vi32)->Is()); + ASSERT_TRUE(TypeOf(c_vu32)->Is()); + ASSERT_TRUE(TypeOf(c_vf32)->Is()); + ASSERT_TRUE(TypeOf(c_mf32)->Is()); + ASSERT_TRUE(TypeOf(c_s)->Is()); + + EXPECT_TRUE(Sem().Get(c_i32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_u32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_f32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vi32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vu32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vf32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_mf32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_s)->ConstantValue()->AllZero()); +} + +TEST_F(ResolverVariableTest, LocalConst_ImplicitType_Decls) { + Structure("S", utils::Vector{Member("m", ty.u32())}); + + auto* c_i32 = Const("a", Expr(0_i)); + auto* c_u32 = Const("b", Expr(0_u)); + auto* c_f32 = Const("c", Expr(0_f)); + auto* c_ai = Const("d", Expr(0_a)); + auto* c_af = Const("e", Expr(0._a)); + auto* c_vi32 = Const("f", vec3()); + auto* c_vu32 = Const("g", vec3()); + auto* c_vf32 = Const("h", vec3()); + auto* c_vai = Const("i", Construct(ty.vec(nullptr, 3), Expr(0_a))); + auto* c_vaf = Const("j", Construct(ty.vec(nullptr, 3), Expr(0._a))); + auto* c_mf32 = Const("k", mat3x3()); + auto* c_maf32 = Const("l", Construct(ty.mat(nullptr, 3, 3), // + Construct(ty.vec(nullptr, 3), Expr(0._a)), + Construct(ty.vec(nullptr, 3), Expr(0._a)), + Construct(ty.vec(nullptr, 3), Expr(0._a)))); + auto* c_s = Const("m", Construct(ty.type_name("S"))); + + WrapInFunction(c_i32, c_u32, c_f32, c_ai, c_af, c_vi32, c_vu32, c_vf32, c_vai, c_vaf, c_mf32, + c_maf32, c_s); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + EXPECT_EQ(Sem().Get(c_i32)->Declaration(), c_i32); + EXPECT_EQ(Sem().Get(c_u32)->Declaration(), c_u32); + EXPECT_EQ(Sem().Get(c_f32)->Declaration(), c_f32); + EXPECT_EQ(Sem().Get(c_ai)->Declaration(), c_ai); + EXPECT_EQ(Sem().Get(c_af)->Declaration(), c_af); + EXPECT_EQ(Sem().Get(c_vi32)->Declaration(), c_vi32); + EXPECT_EQ(Sem().Get(c_vu32)->Declaration(), c_vu32); + EXPECT_EQ(Sem().Get(c_vf32)->Declaration(), c_vf32); + EXPECT_EQ(Sem().Get(c_vai)->Declaration(), c_vai); + EXPECT_EQ(Sem().Get(c_vaf)->Declaration(), c_vaf); + EXPECT_EQ(Sem().Get(c_mf32)->Declaration(), c_mf32); + EXPECT_EQ(Sem().Get(c_maf32)->Declaration(), c_maf32); + EXPECT_EQ(Sem().Get(c_s)->Declaration(), c_s); + + ASSERT_TRUE(TypeOf(c_i32)->Is()); + ASSERT_TRUE(TypeOf(c_u32)->Is()); + ASSERT_TRUE(TypeOf(c_f32)->Is()); + ASSERT_TRUE(TypeOf(c_ai)->Is()); + ASSERT_TRUE(TypeOf(c_af)->Is()); + ASSERT_TRUE(TypeOf(c_vi32)->Is()); + ASSERT_TRUE(TypeOf(c_vu32)->Is()); + ASSERT_TRUE(TypeOf(c_vf32)->Is()); + ASSERT_TRUE(TypeOf(c_vai)->Is()); + ASSERT_TRUE(TypeOf(c_vaf)->Is()); + ASSERT_TRUE(TypeOf(c_mf32)->Is()); + ASSERT_TRUE(TypeOf(c_maf32)->Is()); + ASSERT_TRUE(TypeOf(c_s)->Is()); + + EXPECT_TRUE(Sem().Get(c_i32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_u32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_f32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_ai)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_af)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vi32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vu32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vf32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vai)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vaf)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_mf32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_maf32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_s)->ConstantValue()->AllZero()); +} + +TEST_F(ResolverVariableTest, LocalConst_PropagateConstValue) { + auto* a = Const("a", Expr(42_i)); + auto* b = Const("b", Expr("a")); + auto* c = Const("c", Expr("b")); + + WrapInFunction(a, b, c); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_TRUE(TypeOf(c)->Is()); + + EXPECT_EQ(Sem().Get(c)->ConstantValue()->As(), 42_i); +} + +// Enable when we have @const operators implemented +TEST_F(ResolverVariableTest, DISABLED_LocalConst_ConstEval) { + auto* c = Const("c", Div(Mul(Add(1_i, 2_i), 3_i), 2_i)); + + WrapInFunction(c); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_TRUE(TypeOf(c)->Is()); + + EXPECT_EQ(Sem().Get(c)->ConstantValue()->As(), 3_i); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Module-scope 'var' +//////////////////////////////////////////////////////////////////////////////////////////////////// +TEST_F(ResolverVariableTest, GlobalVar_StorageClass) { + // https://gpuweb.github.io/gpuweb/wgsl/#storage-class + + auto* buf = Structure("S", utils::Vector{Member("m", ty.i32())}); + auto* private_ = GlobalVar("p", ty.i32(), ast::StorageClass::kPrivate); + auto* workgroup = GlobalVar("w", ty.i32(), ast::StorageClass::kWorkgroup); + auto* uniform = GlobalVar("ub", ty.Of(buf), ast::StorageClass::kUniform, Binding(0), Group(0)); + auto* storage = GlobalVar("sb", ty.Of(buf), ast::StorageClass::kStorage, Binding(1), Group(0)); + auto* handle = + GlobalVar("h", ty.depth_texture(ast::TextureDimension::k2d), Binding(2), Group(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_TRUE(TypeOf(private_)->Is()); + ASSERT_TRUE(TypeOf(workgroup)->Is()); + ASSERT_TRUE(TypeOf(uniform)->Is()); + ASSERT_TRUE(TypeOf(storage)->Is()); + ASSERT_TRUE(TypeOf(handle)->Is()); + + EXPECT_EQ(TypeOf(private_)->As()->Access(), ast::Access::kReadWrite); + EXPECT_EQ(TypeOf(workgroup)->As()->Access(), ast::Access::kReadWrite); + EXPECT_EQ(TypeOf(uniform)->As()->Access(), ast::Access::kRead); + EXPECT_EQ(TypeOf(storage)->As()->Access(), ast::Access::kRead); + EXPECT_EQ(TypeOf(handle)->As()->Access(), ast::Access::kRead); +} + +TEST_F(ResolverVariableTest, GlobalVar_ExplicitStorageClass) { + // https://gpuweb.github.io/gpuweb/wgsl/#storage-class + + auto* buf = Structure("S", utils::Vector{Member("m", ty.i32())}); + auto* storage = GlobalVar("sb", ty.Of(buf), ast::StorageClass::kStorage, + ast::Access::kReadWrite, Binding(1), Group(0)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_TRUE(TypeOf(storage)->Is()); + + EXPECT_EQ(TypeOf(storage)->As()->Access(), ast::Access::kReadWrite); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Module-scope const +//////////////////////////////////////////////////////////////////////////////////////////////////// +TEST_F(ResolverVariableTest, GlobalConst_ExplicitType_Decls) { + auto* c_i32 = GlobalConst("a", ty.i32(), Expr(0_i)); + auto* c_u32 = GlobalConst("b", ty.u32(), Expr(0_u)); + auto* c_f32 = GlobalConst("c", ty.f32(), Expr(0_f)); + auto* c_vi32 = GlobalConst("d", ty.vec3(), vec3()); + auto* c_vu32 = GlobalConst("e", ty.vec3(), vec3()); + auto* c_vf32 = GlobalConst("f", ty.vec3(), vec3()); + auto* c_mf32 = GlobalConst("g", ty.mat3x3(), mat3x3()); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + EXPECT_EQ(Sem().Get(c_i32)->Declaration(), c_i32); + EXPECT_EQ(Sem().Get(c_u32)->Declaration(), c_u32); + EXPECT_EQ(Sem().Get(c_f32)->Declaration(), c_f32); + EXPECT_EQ(Sem().Get(c_vi32)->Declaration(), c_vi32); + EXPECT_EQ(Sem().Get(c_vu32)->Declaration(), c_vu32); + EXPECT_EQ(Sem().Get(c_vf32)->Declaration(), c_vf32); + EXPECT_EQ(Sem().Get(c_mf32)->Declaration(), c_mf32); + + ASSERT_TRUE(TypeOf(c_i32)->Is()); + ASSERT_TRUE(TypeOf(c_u32)->Is()); + ASSERT_TRUE(TypeOf(c_f32)->Is()); + ASSERT_TRUE(TypeOf(c_vi32)->Is()); + ASSERT_TRUE(TypeOf(c_vu32)->Is()); + ASSERT_TRUE(TypeOf(c_vf32)->Is()); + ASSERT_TRUE(TypeOf(c_mf32)->Is()); + + EXPECT_TRUE(Sem().Get(c_i32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_u32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_f32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vi32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vu32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vf32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_mf32)->ConstantValue()->AllZero()); +} + +TEST_F(ResolverVariableTest, GlobalConst_ImplicitType_Decls) { + auto* c_i32 = GlobalConst("a", Expr(0_i)); + auto* c_u32 = GlobalConst("b", Expr(0_u)); + auto* c_f32 = GlobalConst("c", Expr(0_f)); + auto* c_ai = GlobalConst("d", Expr(0_a)); + auto* c_af = GlobalConst("e", Expr(0._a)); + auto* c_vi32 = GlobalConst("f", vec3()); + auto* c_vu32 = GlobalConst("g", vec3()); + auto* c_vf32 = GlobalConst("h", vec3()); + auto* c_vai = GlobalConst("i", Construct(ty.vec(nullptr, 3), Expr(0_a))); + auto* c_vaf = GlobalConst("j", Construct(ty.vec(nullptr, 3), Expr(0._a))); + auto* c_mf32 = GlobalConst("k", mat3x3()); + auto* c_maf32 = GlobalConst("l", Construct(ty.mat(nullptr, 3, 3), // + Construct(ty.vec(nullptr, 3), Expr(0._a)), + Construct(ty.vec(nullptr, 3), Expr(0._a)), + Construct(ty.vec(nullptr, 3), Expr(0._a)))); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + EXPECT_EQ(Sem().Get(c_i32)->Declaration(), c_i32); + EXPECT_EQ(Sem().Get(c_u32)->Declaration(), c_u32); + EXPECT_EQ(Sem().Get(c_f32)->Declaration(), c_f32); + EXPECT_EQ(Sem().Get(c_ai)->Declaration(), c_ai); + EXPECT_EQ(Sem().Get(c_af)->Declaration(), c_af); + EXPECT_EQ(Sem().Get(c_vi32)->Declaration(), c_vi32); + EXPECT_EQ(Sem().Get(c_vu32)->Declaration(), c_vu32); + EXPECT_EQ(Sem().Get(c_vf32)->Declaration(), c_vf32); + EXPECT_EQ(Sem().Get(c_vai)->Declaration(), c_vai); + EXPECT_EQ(Sem().Get(c_vaf)->Declaration(), c_vaf); + EXPECT_EQ(Sem().Get(c_mf32)->Declaration(), c_mf32); + EXPECT_EQ(Sem().Get(c_maf32)->Declaration(), c_maf32); + + ASSERT_TRUE(TypeOf(c_i32)->Is()); + ASSERT_TRUE(TypeOf(c_u32)->Is()); + ASSERT_TRUE(TypeOf(c_f32)->Is()); + ASSERT_TRUE(TypeOf(c_ai)->Is()); + ASSERT_TRUE(TypeOf(c_af)->Is()); + ASSERT_TRUE(TypeOf(c_vi32)->Is()); + ASSERT_TRUE(TypeOf(c_vu32)->Is()); + ASSERT_TRUE(TypeOf(c_vf32)->Is()); + ASSERT_TRUE(TypeOf(c_vai)->Is()); + ASSERT_TRUE(TypeOf(c_vaf)->Is()); + ASSERT_TRUE(TypeOf(c_mf32)->Is()); + ASSERT_TRUE(TypeOf(c_maf32)->Is()); + + EXPECT_TRUE(Sem().Get(c_i32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_u32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_f32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_ai)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_af)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vi32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vu32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vf32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vai)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_vaf)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_mf32)->ConstantValue()->AllZero()); + EXPECT_TRUE(Sem().Get(c_maf32)->ConstantValue()->AllZero()); +} + +TEST_F(ResolverVariableTest, GlobalConst_PropagateConstValue) { + GlobalConst("b", Expr("a")); + auto* c = GlobalConst("c", Expr("b")); + GlobalConst("a", Expr(42_i)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_TRUE(TypeOf(c)->Is()); + + EXPECT_EQ(Sem().Get(c)->ConstantValue()->As(), 42_i); +} + +// Enable when we have @const operators implemented +TEST_F(ResolverVariableTest, DISABLED_GlobalConst_ConstEval) { + auto* c = GlobalConst("c", Div(Mul(Add(1_i, 2_i), 3_i), 2_i)); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + ASSERT_TRUE(TypeOf(c)->Is()); + + EXPECT_EQ(Sem().Get(c)->ConstantValue()->As(), 3_i); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Function parameter +//////////////////////////////////////////////////////////////////////////////////////////////////// +TEST_F(ResolverVariableTest, Param_ShadowsFunction) { + // fn a(a : bool) { + // } + + auto* p = Param("a", ty.bool_()); + auto* f = Func("a", utils::Vector{p}, ty.void_(), utils::Empty); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* func = Sem().Get(f); + auto* param = Sem().Get(p); + + ASSERT_NE(func, nullptr); + ASSERT_NE(param, nullptr); + + EXPECT_EQ(param->Shadows(), func); +} + +TEST_F(ResolverVariableTest, Param_ShadowsGlobalVar) { + // var a : i32; + // + // fn F(a : bool) { + // } + + auto* g = GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); + auto* p = Param("a", ty.bool_()); + Func("F", utils::Vector{p}, ty.void_(), utils::Empty); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* global = Sem().Get(g); + auto* param = Sem().Get(p); + + ASSERT_NE(global, nullptr); + ASSERT_NE(param, nullptr); + + EXPECT_EQ(param->Shadows(), global); +} + +TEST_F(ResolverVariableTest, Param_ShadowsGlobalConst) { + // const a : i32 = 1i; + // + // fn F(a : bool) { + // } + + auto* g = GlobalConst("a", ty.i32(), Expr(1_i)); + auto* p = Param("a", ty.bool_()); + Func("F", utils::Vector{p}, ty.void_(), utils::Empty); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* global = Sem().Get(g); + auto* param = Sem().Get(p); + + ASSERT_NE(global, nullptr); + ASSERT_NE(param, nullptr); + + EXPECT_EQ(param->Shadows(), global); +} + +TEST_F(ResolverVariableTest, Param_ShadowsAlias) { + // type a = i32; + // + // fn F(a : a) { + // } + + auto* a = Alias("a", ty.i32()); + auto* p = Param("a", ty.type_name("a")); + Func("F", utils::Vector{p}, ty.void_(), utils::Empty); + + ASSERT_TRUE(r()->Resolve()) << r()->error(); + + auto* alias = Sem().Get(a); + auto* param = Sem().Get(p); + + ASSERT_NE(alias, nullptr); + ASSERT_NE(param, nullptr); + + EXPECT_EQ(param->Shadows(), alias); + EXPECT_EQ(param->Type(), alias); +} + +} // namespace +} // namespace tint::resolver diff --git a/src/tint/resolver/variable_validation_test.cc b/src/tint/resolver/variable_validation_test.cc new file mode 100644 index 0000000000..0fb50a5d4a --- /dev/null +++ b/src/tint/resolver/variable_validation_test.cc @@ -0,0 +1,447 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/resolver/resolver.h" +#include "src/tint/resolver/resolver_test_helper.h" + +#include "gmock/gmock.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::resolver { +namespace { + +struct ResolverVariableValidationTest : public resolver::TestHelper, public testing::Test {}; + +TEST_F(ResolverVariableValidationTest, VarNoInitializerNoType) { + // var a; + WrapInFunction(Var(Source{{12, 34}}, "a")); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: var declaration requires a type or initializer"); +} + +TEST_F(ResolverVariableValidationTest, GlobalVarNoInitializerNoType) { + // var a; + GlobalVar(Source{{12, 34}}, "a"); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: var declaration requires a type or initializer"); +} + +TEST_F(ResolverVariableValidationTest, VarInitializerNoReturnValueBuiltin) { + // fn f() { var a = storageBarrier(); } + auto* NoReturnValueBuiltin = Call(Source{{12, 34}}, "storageBarrier"); + WrapInFunction(Var("a", NoReturnValueBuiltin)); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: builtin 'storageBarrier' does not return a value"); +} + +TEST_F(ResolverVariableValidationTest, GlobalVarInitializerNoReturnValueBuiltin) { + // var a = storageBarrier(); + auto* NoReturnValueBuiltin = Call(Source{{12, 34}}, "storageBarrier"); + GlobalVar("a", NoReturnValueBuiltin); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: builtin 'storageBarrier' does not return a value"); +} + +TEST_F(ResolverVariableValidationTest, GlobalVarUsedAtModuleScope) { + // var a : i32; + // var b : i32 = a; + GlobalVar(Source{{12, 34}}, "a", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.i32(), ast::StorageClass::kPrivate, Expr(Source{{56, 78}}, "a")); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(56:78 error: var 'a' cannot not be referenced at module-scope +12:34 note: var 'a' declared here)"); +} + +TEST_F(ResolverVariableValidationTest, OverrideNoInitializerNoType) { + // override a; + Override(Source{{12, 34}}, "a"); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: override declaration requires a type or initializer"); +} + +TEST_F(ResolverVariableValidationTest, OverrideExceedsIDLimit_LastUnreserved) { + // override o0 : i32; + // override o1 : i32; + // ... + // override bang : i32; + constexpr size_t kLimit = std::numeric_limits::max(); + for (size_t i = 0; i <= kLimit; i++) { + Override("o" + std::to_string(i), ty.i32()); + } + Override(Source{{12, 34}}, "bang", ty.i32()); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: number of 'override' variables exceeded limit of 65535"); +} + +TEST_F(ResolverVariableValidationTest, OverrideExceedsIDLimit_LastReserved) { + // override o0 : i32; + // override o1 : i32; + // ... + // @id(N) override oN : i32; + constexpr size_t kLimit = std::numeric_limits::max(); + Override("reserved", ty.i32(), Id(kLimit)); + for (size_t i = 0; i < kLimit; i++) { + Override("o" + std::to_string(i), ty.i32()); + } + Override(Source{{12, 34}}, "bang", ty.i32()); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: number of 'override' variables exceeded limit of 65535"); +} + +TEST_F(ResolverVariableValidationTest, VarTypeNotConstructible) { + // var i : i32; + // var p : pointer = &v; + auto* i = Var("i", ty.i32()); + auto* p = Var("a", ty.pointer(Source{{56, 78}}, ast::StorageClass::kFunction), + ast::StorageClass::kNone, AddressOf(Source{{12, 34}}, "i")); + WrapInFunction(i, p); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "56:78 error: function-scope 'var' must have a constructible type"); +} + +TEST_F(ResolverVariableValidationTest, LetTypeNotConstructible) { + // @group(0) @binding(0) var t1 : texture_2d; + // let t2 : t1; + auto* t1 = GlobalVar("t1", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()), Group(0), + Binding(0)); + auto* t2 = Let(Source{{56, 78}}, "t2", Expr(t1)); + WrapInFunction(t2); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "56:78 error: texture_2d cannot be used as the type of a 'let'"); +} + +TEST_F(ResolverVariableValidationTest, OverrideExplicitTypeNotScalar) { + // override o : vec3; + Override(Source{{56, 78}}, "o", ty.vec3()); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "56:78 error: vec3 cannot be used as the type of a 'override'"); +} + +TEST_F(ResolverVariableValidationTest, OverrideInferedTypeNotScalar) { + // override o = vec3(1.0f); + Override(Source{{56, 78}}, "o", vec3(1.0_f)); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "56:78 error: vec3 cannot be used as the type of a 'override'"); +} + +TEST_F(ResolverVariableValidationTest, ConstConstructorWrongType) { + // const c : i32 = 2u + WrapInFunction(Const(Source{{3, 3}}, "c", ty.i32(), Expr(2_u))); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(3:3 error: cannot initialize const of type 'i32' with value of type 'u32')"); +} + +TEST_F(ResolverVariableValidationTest, LetConstructorWrongType) { + // var v : i32 = 2u + WrapInFunction(Let(Source{{3, 3}}, "v", ty.i32(), Expr(2_u))); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(3:3 error: cannot initialize let of type 'i32' with value of type 'u32')"); +} + +TEST_F(ResolverVariableValidationTest, VarConstructorWrongType) { + // var v : i32 = 2u + WrapInFunction(Var(Source{{3, 3}}, "v", ty.i32(), Expr(2_u))); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(3:3 error: cannot initialize var of type 'i32' with value of type 'u32')"); +} + +TEST_F(ResolverVariableValidationTest, ConstConstructorWrongTypeViaAlias) { + auto* a = Alias("I32", ty.i32()); + WrapInFunction(Const(Source{{3, 3}}, "v", ty.Of(a), Expr(2_u))); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(3:3 error: cannot initialize const of type 'i32' with value of type 'u32')"); +} + +TEST_F(ResolverVariableValidationTest, LetConstructorWrongTypeViaAlias) { + auto* a = Alias("I32", ty.i32()); + WrapInFunction(Let(Source{{3, 3}}, "v", ty.Of(a), Expr(2_u))); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(3:3 error: cannot initialize let of type 'i32' with value of type 'u32')"); +} + +TEST_F(ResolverVariableValidationTest, VarConstructorWrongTypeViaAlias) { + auto* a = Alias("I32", ty.i32()); + WrapInFunction(Var(Source{{3, 3}}, "v", ty.Of(a), Expr(2_u))); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(3:3 error: cannot initialize var of type 'i32' with value of type 'u32')"); +} + +TEST_F(ResolverVariableValidationTest, LetOfPtrConstructedWithRef) { + // var a : f32; + // let b : ptr = a; + const auto priv = ast::StorageClass::kFunction; + auto* var_a = Var("a", ty.f32(), priv); + auto* var_b = Let(Source{{12, 34}}, "b", ty.pointer(priv), Expr("a")); + WrapInFunction(var_a, var_b); + + ASSERT_FALSE(r()->Resolve()); + + EXPECT_EQ( + r()->error(), + R"(12:34 error: cannot initialize let of type 'ptr' with value of type 'f32')"); +} + +TEST_F(ResolverVariableValidationTest, LocalLetRedeclared) { + // let l : f32 = 1.; + // let l : i32 = 0; + auto* l1 = Let("l", ty.f32(), Expr(1_f)); + auto* l2 = Let(Source{{12, 34}}, "l", ty.i32(), Expr(0_i)); + WrapInFunction(l1, l2); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "12:34 error: redeclaration of 'l'\nnote: 'l' previously declared here"); +} + +TEST_F(ResolverVariableValidationTest, GlobalVarRedeclaredAsLocal) { + // var v : f32 = 2.1; + // fn my_func() { + // var v : f32 = 2.0; + // return 0; + // } + + GlobalVar("v", ty.f32(), ast::StorageClass::kPrivate, Expr(2.1_f)); + + WrapInFunction(Var(Source{{12, 34}}, "v", ty.f32(), Expr(2_f))); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverVariableValidationTest, VarRedeclaredInInnerBlock) { + // { + // var v : f32; + // { var v : f32; } + // } + auto* var_outer = Var("v", ty.f32()); + auto* var_inner = Var(Source{{12, 34}}, "v", ty.f32()); + auto* inner = Block(Decl(var_inner)); + auto* outer_body = Block(Decl(var_outer), inner); + + WrapInFunction(outer_body); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverVariableValidationTest, VarRedeclaredInIfBlock) { + // { + // var v : f32 = 3.14; + // if (true) { var v : f32 = 2.0; } + // } + auto* var_a_float = Var("v", ty.f32(), Expr(3.1_f)); + + auto* var = Var(Source{{12, 34}}, "v", ty.f32(), Expr(2_f)); + + auto* cond = Expr(true); + auto* body = Block(Decl(var)); + + auto* outer_body = Block(Decl(var_a_float), If(cond, body)); + + WrapInFunction(outer_body); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); +} + +TEST_F(ResolverVariableValidationTest, InferredPtrStorageAccessMismatch) { + // struct Inner { + // arr: array; + // } + // struct S { + // inner: Inner; + // } + // @group(0) @binding(0) var s : S; + // fn f() { + // let p : pointer = &s.inner.arr[2i]; + // } + auto* inner = Structure("Inner", utils::Vector{ + Member("arr", ty.array()), + }); + auto* buf = Structure("S", utils::Vector{ + Member("inner", ty.Of(inner)), + }); + auto* storage = GlobalVar("s", ty.Of(buf), ast::StorageClass::kStorage, Binding(0), Group(0)); + + auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 2_i); + auto* ptr = + Let(Source{{12, 34}}, "p", + ty.pointer(ast::StorageClass::kStorage, ast::Access::kReadWrite), AddressOf(expr)); + + WrapInFunction(ptr); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "12:34 error: cannot initialize let of type " + "'ptr' with value of type " + "'ptr'"); +} + +TEST_F(ResolverVariableValidationTest, NonConstructibleType_Atomic) { + auto* v = Var("v", ty.atomic(Source{{12, 34}}, ty.i32())); + WrapInFunction(v); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: function-scope 'var' must have a constructible type"); +} + +TEST_F(ResolverVariableValidationTest, NonConstructibleType_RuntimeArray) { + auto* s = Structure("S", utils::Vector{ + Member(Source{{56, 78}}, "m", ty.array(ty.i32())), + }); + auto* v = Var(Source{{12, 34}}, "v", ty.Of(s)); + WrapInFunction(v); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(12:34 error: runtime-sized arrays can only be used in the storage class +56:78 note: while analysing structure member S.m +12:34 note: while instantiating 'var' v)"); +} + +TEST_F(ResolverVariableValidationTest, NonConstructibleType_Struct_WithAtomic) { + auto* s = Structure("S", utils::Vector{ + Member("m", ty.atomic(ty.i32())), + }); + auto* v = Var("v", ty.Of(s)); + WrapInFunction(v); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "error: function-scope 'var' must have a constructible type"); +} + +TEST_F(ResolverVariableValidationTest, NonConstructibleType_InferredType) { + // @group(0) @binding(0) var s : sampler; + // fn foo() { + // var v = s; + // } + GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(0), Binding(0)); + auto* v = Var(Source{{12, 34}}, "v", Expr("s")); + WrapInFunction(v); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: function-scope 'var' must have a constructible type"); +} + +TEST_F(ResolverVariableValidationTest, InvalidStorageClassForInitializer) { + // var v : f32 = 1.23; + GlobalVar(Source{{12, 34}}, "v", ty.f32(), ast::StorageClass::kWorkgroup, Expr(1.23_f)); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + "12:34 error: var of storage class 'workgroup' cannot have " + "an initializer. var initializers are only supported for the " + "storage classes 'private' and 'function'"); +} + +TEST_F(ResolverVariableValidationTest, VectorConstNoType) { + // const a : mat3x3 = mat3x3(); + WrapInFunction(Const("a", create(Source{{12, 34}}, nullptr, 3u), vec3())); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: missing vector element type"); +} + +TEST_F(ResolverVariableValidationTest, VectorLetNoType) { + // let a : mat3x3 = mat3x3(); + WrapInFunction(Let("a", create(Source{{12, 34}}, nullptr, 3u), vec3())); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: missing vector element type"); +} + +TEST_F(ResolverVariableValidationTest, VectorVarNoType) { + // var a : mat3x3; + WrapInFunction(Var("a", create(Source{{12, 34}}, nullptr, 3u))); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: missing vector element type"); +} + +TEST_F(ResolverVariableValidationTest, MatrixConstNoType) { + // const a : mat3x3 = mat3x3(); + WrapInFunction( + Const("a", create(Source{{12, 34}}, nullptr, 3u, 3u), mat3x3())); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type"); +} + +TEST_F(ResolverVariableValidationTest, MatrixLetNoType) { + // let a : mat3x3 = mat3x3(); + WrapInFunction(Let("a", create(Source{{12, 34}}, nullptr, 3u, 3u), mat3x3())); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type"); +} + +TEST_F(ResolverVariableValidationTest, MatrixVarNoType) { + // var a : mat3x3; + WrapInFunction(Var("a", create(Source{{12, 34}}, nullptr, 3u, 3u))); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type"); +} + +TEST_F(ResolverVariableValidationTest, ConstInitWithVar) { + auto* v = Var("v", Expr(1_i)); + auto* c = Const("c", Expr(Source{{12, 34}}, v)); + WrapInFunction(v, c); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(12:34 error: 'const' initializer must be constant expression)"); +} + +TEST_F(ResolverVariableValidationTest, ConstInitWithOverride) { + auto* o = Override("v", Expr(1_i)); + auto* c = Const("c", Expr(Source{{12, 34}}, o)); + WrapInFunction(c); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(12:34 error: 'const' initializer must be constant expression)"); +} + +TEST_F(ResolverVariableValidationTest, ConstInitWithLet) { + auto* l = Let("v", Expr(1_i)); + auto* c = Const("c", Expr(Source{{12, 34}}, l)); + WrapInFunction(l, c); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(12:34 error: 'const' initializer must be constant expression)"); +} + +} // namespace +} // namespace tint::resolver diff --git a/src/tint/scope_stack.h b/src/tint/scope_stack.h index 8bc97a3a2f..6838f5b77c 100644 --- a/src/tint/scope_stack.h +++ b/src/tint/scope_stack.h @@ -24,7 +24,7 @@ namespace tint { /// Used to store a stack of scope information. /// The stack starts with a global scope which can not be popped. -template +template class ScopeStack { public: /// Constructor @@ -47,32 +47,42 @@ class ScopeStack { } /// Assigns the value into the top most scope of the stack. - /// @param symbol the symbol of the value + /// @param key the key of the value /// @param val the value - /// @returns the old value if there was an existing symbol at the top of the + /// @returns the old value if there was an existing key at the top of the /// stack, otherwise the zero initializer for type T. - T Set(const Symbol& symbol, T val) { - std::swap(val, stack_.back()[symbol]); + V Set(const K& key, V val) { + std::swap(val, stack_.back()[key]); return val; } /// Retrieves a value from the stack - /// @param symbol the symbol to look for + /// @param key the key to look for /// @returns the value, or the zero initializer if the value was not found - T Get(const Symbol& symbol) const { + V Get(const K& key) const { for (auto iter = stack_.rbegin(); iter != stack_.rend(); ++iter) { auto& map = *iter; - auto val = map.find(symbol); + auto val = map.find(key); if (val != map.end()) { return val->second; } } - return T{}; + return V{}; + } + + /// Return the top scope of the stack. + /// @returns the top scope of the stack + const std::unordered_map& Top() const { return stack_.back(); } + + /// Clear the scope stack. + void Clear() { + stack_.clear(); + stack_.push_back({}); } private: - std::vector> stack_; + std::vector> stack_; }; } // namespace tint diff --git a/src/tint/scope_stack_test.cc b/src/tint/scope_stack_test.cc index 80628073c1..aeb7e73214 100644 --- a/src/tint/scope_stack_test.cc +++ b/src/tint/scope_stack_test.cc @@ -22,7 +22,7 @@ namespace { class ScopeStackTest : public ProgramBuilder, public testing::Test {}; TEST_F(ScopeStackTest, Get) { - ScopeStack s; + ScopeStack s; Symbol a(1, ID()); Symbol b(3, ID()); s.Push(); @@ -44,13 +44,13 @@ TEST_F(ScopeStackTest, Get) { } TEST_F(ScopeStackTest, Get_MissingSymbol) { - ScopeStack s; + ScopeStack s; Symbol sym(1, ID()); EXPECT_EQ(s.Get(sym), 0u); } TEST_F(ScopeStackTest, Set) { - ScopeStack s; + ScopeStack s; Symbol a(1, ID()); Symbol b(2, ID()); @@ -67,5 +67,25 @@ TEST_F(ScopeStackTest, Set) { EXPECT_EQ(s.Get(b), 25u); } +TEST_F(ScopeStackTest, Clear) { + ScopeStack s; + Symbol a(1, ID()); + Symbol b(2, ID()); + + EXPECT_EQ(s.Set(a, 5u), 0u); + EXPECT_EQ(s.Get(a), 5u); + + s.Push(); + + EXPECT_EQ(s.Set(b, 10u), 0u); + EXPECT_EQ(s.Get(b), 10u); + + s.Push(); + + s.Clear(); + EXPECT_EQ(s.Get(a), 0u); + EXPECT_EQ(s.Get(b), 0u); +} + } // namespace } // namespace tint diff --git a/src/tint/sem/abstract_float.cc b/src/tint/sem/abstract_float.cc index 1f0c8b4ec9..6f32e998e5 100644 --- a/src/tint/sem/abstract_float.cc +++ b/src/tint/sem/abstract_float.cc @@ -34,7 +34,7 @@ bool AbstractFloat::Equals(const sem::Type& other) const { } std::string AbstractFloat::FriendlyName(const SymbolTable&) const { - return "AbstractFloat"; + return "abstract-float"; } } // namespace tint::sem diff --git a/src/tint/sem/abstract_int.cc b/src/tint/sem/abstract_int.cc index 6851514b4e..682c50aaaf 100644 --- a/src/tint/sem/abstract_int.cc +++ b/src/tint/sem/abstract_int.cc @@ -34,7 +34,7 @@ bool AbstractInt::Equals(const sem::Type& other) const { } std::string AbstractInt::FriendlyName(const SymbolTable&) const { - return "AbstractInt"; + return "abstract-int"; } } // namespace tint::sem diff --git a/src/tint/sem/abstract_numeric.cc b/src/tint/sem/abstract_numeric.cc index 6481a433ae..e7d184652d 100644 --- a/src/tint/sem/abstract_numeric.cc +++ b/src/tint/sem/abstract_numeric.cc @@ -31,7 +31,7 @@ uint32_t AbstractNumeric::Align() const { } bool AbstractNumeric::IsConstructible() const { - return false; + return true; } } // namespace tint::sem diff --git a/src/tint/sem/abstract_numeric.h b/src/tint/sem/abstract_numeric.h index 0b38448e05..620c5281e2 100644 --- a/src/tint/sem/abstract_numeric.h +++ b/src/tint/sem/abstract_numeric.h @@ -38,7 +38,7 @@ class AbstractNumeric : public Castable { /// @returns 0, as the type is abstract. uint32_t Align() const override; - /// @returns 0, as the type is abstract. + /// @returns true. bool IsConstructible() const override; }; diff --git a/src/tint/sem/array.h b/src/tint/sem/array.h index aeef3cedbe..7f72d8a8a1 100644 --- a/src/tint/sem/array.h +++ b/src/tint/sem/array.h @@ -21,11 +21,6 @@ #include "src/tint/sem/node.h" #include "src/tint/sem/type.h" -// Forward declarations -namespace tint::ast { -class Array; -} // namespace tint::ast - namespace tint::sem { /// Array holds the semantic information for Array nodes. diff --git a/src/tint/sem/block_statement.h b/src/tint/sem/block_statement.h index e87b225246..4f12122dbd 100644 --- a/src/tint/sem/block_statement.h +++ b/src/tint/sem/block_statement.h @@ -24,7 +24,6 @@ namespace tint::ast { class BlockStatement; class ContinueStatement; -class Function; class Variable; } // namespace tint::ast diff --git a/src/tint/sem/builtin.cc b/src/tint/sem/builtin.cc index 66b5b2733c..ecb23319f0 100644 --- a/src/tint/sem/builtin.cc +++ b/src/tint/sem/builtin.cc @@ -17,13 +17,25 @@ #include "src/tint/sem/builtin.h" +#include #include -#include "src/tint/utils/to_const_ptr_vec.h" +#include "src/tint/utils/transform.h" TINT_INSTANTIATE_TYPEINFO(tint::sem::Builtin); namespace tint::sem { +namespace { + +utils::VectorRef SetOwner(utils::VectorRef parameters, + const tint::sem::CallTarget* owner) { + for (auto* parameter : parameters) { + parameter->SetOwner(owner); + } + return parameters; +} + +} // namespace const char* Builtin::str() const { return sem::str(type_); @@ -83,19 +95,20 @@ bool IsAtomicBuiltin(BuiltinType i) { i == sem::BuiltinType::kAtomicCompareExchangeWeak; } +bool IsDP4aBuiltin(BuiltinType i) { + return i == sem::BuiltinType::kDot4I8Packed || i == sem::BuiltinType::kDot4U8Packed; +} + Builtin::Builtin(BuiltinType type, const sem::Type* return_type, - std::vector parameters, + utils::VectorRef parameters, + EvaluationStage eval_stage, PipelineStageSet supported_stages, bool is_deprecated) - : Base(return_type, utils::ToConstPtrVec(parameters)), + : Base(return_type, SetOwner(std::move(parameters), this), eval_stage), type_(type), supported_stages_(supported_stages), - is_deprecated_(is_deprecated) { - for (auto* parameter : parameters) { - parameter->SetOwner(this); - } -} + is_deprecated_(is_deprecated) {} Builtin::~Builtin() = default; @@ -135,16 +148,37 @@ bool Builtin::IsAtomic() const { return IsAtomicBuiltin(type_); } +bool Builtin::IsDP4a() const { + return IsDP4aBuiltin(type_); +} + bool Builtin::HasSideEffects() const { - if (IsAtomic() && type_ != sem::BuiltinType::kAtomicLoad) { - return true; - } - if (type_ == sem::BuiltinType::kTextureStore) { - return true; + switch (type_) { + case sem::BuiltinType::kAtomicAdd: + case sem::BuiltinType::kAtomicAnd: + case sem::BuiltinType::kAtomicCompareExchangeWeak: + case sem::BuiltinType::kAtomicExchange: + case sem::BuiltinType::kAtomicMax: + case sem::BuiltinType::kAtomicMin: + case sem::BuiltinType::kAtomicOr: + case sem::BuiltinType::kAtomicStore: + case sem::BuiltinType::kAtomicSub: + case sem::BuiltinType::kAtomicXor: + case sem::BuiltinType::kTextureStore: + return true; + default: + break; } return false; } +ast::Extension Builtin::RequiredExtension() const { + if (IsDP4a()) { + return ast::Extension::kChromiumExperimentalDp4A; + } + return ast::Extension::kInvalid; +} + } // namespace tint::sem //! @endcond diff --git a/src/tint/sem/builtin.h b/src/tint/sem/builtin.h index d742f95303..b63bece911 100644 --- a/src/tint/sem/builtin.h +++ b/src/tint/sem/builtin.h @@ -18,6 +18,7 @@ #include #include +#include "src/tint/ast/extension.h" #include "src/tint/sem/builtin_type.h" #include "src/tint/sem/call_target.h" #include "src/tint/sem/pipeline_stage_set.h" @@ -70,6 +71,11 @@ bool IsBarrierBuiltin(BuiltinType i); /// @returns true if the given `i` is a atomic builtin bool IsAtomicBuiltin(BuiltinType i); +/// Determins if the given `i` is a DP4a builtin +/// @param i the builtin +/// @returns true if the given `i` is a DP4a builtin +bool IsDP4aBuiltin(BuiltinType i); + /// Builtin holds the semantic information for a builtin function. class Builtin final : public Castable { public: @@ -77,13 +83,15 @@ class Builtin final : public Castable { /// @param type the builtin type /// @param return_type the return type for the builtin call /// @param parameters the parameters for the builtin overload + /// @param eval_stage the earliest evaluation stage for a call to the builtin /// @param supported_stages the pipeline stages that this builtin can be /// used in /// @param is_deprecated true if the particular overload is considered /// deprecated Builtin(BuiltinType type, const sem::Type* return_type, - std::vector parameters, + utils::VectorRef parameters, + EvaluationStage eval_stage, PipelineStageSet supported_stages, bool is_deprecated); @@ -130,10 +138,18 @@ class Builtin final : public Castable { /// @returns true if builtin is a atomic builtin bool IsAtomic() const; + /// @returns true if builtin is a DP4a builtin (defined in the extension + /// chromium_experimental_DP4a) + bool IsDP4a() const; + /// @returns true if intrinsic may have side-effects (i.e. writes to at least /// one of its inputs) bool HasSideEffects() const; + /// @returns the required extension of this builtin function. Returns + /// ast::Extension::kNone if no extension is required. + ast::Extension RequiredExtension() const; + private: const BuiltinType type_; const PipelineStageSet supported_stages_; diff --git a/src/tint/sem/builtin_test.cc b/src/tint/sem/builtin_test.cc index f3cbae3621..96f8ebe8b7 100644 --- a/src/tint/sem/builtin_test.cc +++ b/src/tint/sem/builtin_test.cc @@ -56,6 +56,8 @@ INSTANTIATE_TEST_SUITE_P( BuiltinData{"determinant", BuiltinType::kDeterminant}, BuiltinData{"distance", BuiltinType::kDistance}, BuiltinData{"dot", BuiltinType::kDot}, + BuiltinData{"dot4I8Packed", BuiltinType::kDot4I8Packed}, + BuiltinData{"dot4U8Packed", BuiltinType::kDot4U8Packed}, BuiltinData{"dpdx", BuiltinType::kDpdx}, BuiltinData{"dpdxCoarse", BuiltinType::kDpdxCoarse}, BuiltinData{"dpdxFine", BuiltinType::kDpdxFine}, @@ -91,7 +93,6 @@ INSTANTIATE_TEST_SUITE_P( BuiltinData{"sin", BuiltinType::kSin}, BuiltinData{"sinh", BuiltinType::kSinh}, BuiltinData{"smoothstep", BuiltinType::kSmoothstep}, - BuiltinData{"smoothStep", BuiltinType::kSmoothStep}, BuiltinData{"sqrt", BuiltinType::kSqrt}, BuiltinData{"step", BuiltinType::kStep}, BuiltinData{"storageBarrier", BuiltinType::kStorageBarrier}, diff --git a/src/tint/sem/builtin_type.cc b/src/tint/sem/builtin_type.cc index 49ee000144..af4f1eb164 100644 --- a/src/tint/sem/builtin_type.cc +++ b/src/tint/sem/builtin_type.cc @@ -13,11 +13,9 @@ // limitations under the License. //////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen +// File generated by tools/src/cmd/gen // using the template: // src/tint/sem/builtin_type.cc.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def // // Do not modify this file directly //////////////////////////////////////////////////////////////////////////////// @@ -35,6 +33,9 @@ BuiltinType ParseBuiltinType(const std::string& name) { if (name == "acos") { return BuiltinType::kAcos; } + if (name == "acosh") { + return BuiltinType::kAcosh; + } if (name == "all") { return BuiltinType::kAll; } @@ -47,12 +48,18 @@ BuiltinType ParseBuiltinType(const std::string& name) { if (name == "asin") { return BuiltinType::kAsin; } + if (name == "asinh") { + return BuiltinType::kAsinh; + } if (name == "atan") { return BuiltinType::kAtan; } if (name == "atan2") { return BuiltinType::kAtan2; } + if (name == "atanh") { + return BuiltinType::kAtanh; + } if (name == "ceil") { return BuiltinType::kCeil; } @@ -89,6 +96,12 @@ BuiltinType ParseBuiltinType(const std::string& name) { if (name == "dot") { return BuiltinType::kDot; } + if (name == "dot4I8Packed") { + return BuiltinType::kDot4I8Packed; + } + if (name == "dot4U8Packed") { + return BuiltinType::kDot4U8Packed; + } if (name == "dpdx") { return BuiltinType::kDpdx; } @@ -227,9 +240,6 @@ BuiltinType ParseBuiltinType(const std::string& name) { if (name == "smoothstep") { return BuiltinType::kSmoothstep; } - if (name == "smoothStep") { - return BuiltinType::kSmoothStep; - } if (name == "sqrt") { return BuiltinType::kSqrt; } @@ -355,6 +365,8 @@ const char* str(BuiltinType i) { return "abs"; case BuiltinType::kAcos: return "acos"; + case BuiltinType::kAcosh: + return "acosh"; case BuiltinType::kAll: return "all"; case BuiltinType::kAny: @@ -363,10 +375,14 @@ const char* str(BuiltinType i) { return "arrayLength"; case BuiltinType::kAsin: return "asin"; + case BuiltinType::kAsinh: + return "asinh"; case BuiltinType::kAtan: return "atan"; case BuiltinType::kAtan2: return "atan2"; + case BuiltinType::kAtanh: + return "atanh"; case BuiltinType::kCeil: return "ceil"; case BuiltinType::kClamp: @@ -391,6 +407,10 @@ const char* str(BuiltinType i) { return "distance"; case BuiltinType::kDot: return "dot"; + case BuiltinType::kDot4I8Packed: + return "dot4I8Packed"; + case BuiltinType::kDot4U8Packed: + return "dot4U8Packed"; case BuiltinType::kDpdx: return "dpdx"; case BuiltinType::kDpdxCoarse: @@ -483,8 +503,6 @@ const char* str(BuiltinType i) { return "sinh"; case BuiltinType::kSmoothstep: return "smoothstep"; - case BuiltinType::kSmoothStep: - return "smoothStep"; case BuiltinType::kSqrt: return "sqrt"; case BuiltinType::kStep: diff --git a/src/tint/sem/builtin_type.cc.tmpl b/src/tint/sem/builtin_type.cc.tmpl index 63c20830c6..5737d8d05a 100644 --- a/src/tint/sem/builtin_type.cc.tmpl +++ b/src/tint/sem/builtin_type.cc.tmpl @@ -1,9 +1,12 @@ {{- /* -------------------------------------------------------------------------------- -Template file for use with tools/builtin-gen to generate builtin_type.cc +Template file for use with tools/src/cmd/gen to generate builtin_type.cc + +To update the generated file, run: + ./tools/run gen See: -* tools/cmd/intrinsic-gen/gen for structures used by this template +* tools/src/cmd/gen for structures used by this template * https://golang.org/pkg/text/template/ for documentation on the template syntax -------------------------------------------------------------------------------- */ -}} @@ -15,7 +18,7 @@ See: namespace tint::sem { BuiltinType ParseBuiltinType(const std::string& name) { -{{- range .Sem.Functions }} +{{- range Sem.Builtins }} if (name == "{{.Name}}") { return BuiltinType::k{{Title .Name}}; } @@ -27,7 +30,7 @@ const char* str(BuiltinType i) { switch (i) { case BuiltinType::kNone: return ""; -{{- range .Sem.Functions }} +{{- range Sem.Builtins }} case BuiltinType::k{{Title .Name}}: return "{{.Name}}"; {{- end }} diff --git a/src/tint/sem/builtin_type.h b/src/tint/sem/builtin_type.h index 780f9c5ce7..0a29fca841 100644 --- a/src/tint/sem/builtin_type.h +++ b/src/tint/sem/builtin_type.h @@ -13,11 +13,9 @@ // limitations under the License. //////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen +// File generated by tools/src/cmd/gen // using the template: // src/tint/sem/builtin_type.h.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def // // Do not modify this file directly //////////////////////////////////////////////////////////////////////////////// @@ -35,12 +33,15 @@ enum class BuiltinType { kNone = -1, kAbs, kAcos, + kAcosh, kAll, kAny, kArrayLength, kAsin, + kAsinh, kAtan, kAtan2, + kAtanh, kCeil, kClamp, kCos, @@ -53,6 +54,8 @@ enum class BuiltinType { kDeterminant, kDistance, kDot, + kDot4I8Packed, + kDot4U8Packed, kDpdx, kDpdxCoarse, kDpdxFine, @@ -99,7 +102,6 @@ enum class BuiltinType { kSin, kSinh, kSmoothstep, - kSmoothStep, kSqrt, kStep, kStorageBarrier, diff --git a/src/tint/sem/builtin_type.h.tmpl b/src/tint/sem/builtin_type.h.tmpl index d4e1cc77d3..84ceffcff7 100644 --- a/src/tint/sem/builtin_type.h.tmpl +++ b/src/tint/sem/builtin_type.h.tmpl @@ -1,9 +1,12 @@ {{- /* -------------------------------------------------------------------------------- -Template file for use with tools/builtin-gen to generate builtin_type.h +Template file for use with tools/src/cmd/gen to generate builtin_type.h + +To update the generated file, run: + ./tools/run gen See: -* tools/cmd/intrinsic-gen/gen for structures used by this template +* tools/src/cmd/gen for structures used by this template * https://golang.org/pkg/text/template/ for documentation on the template syntax -------------------------------------------------------------------------------- */ -}} @@ -19,7 +22,7 @@ namespace tint::sem { /// Enumerator of all builtin functions enum class BuiltinType { kNone = -1, -{{- range .Sem.Functions }} +{{- range Sem.Builtins }} k{{Title .Name}}, {{- end }} }; diff --git a/src/tint/sem/call.cc b/src/tint/sem/call.cc index f688cce22f..1fb7de4a4b 100644 --- a/src/tint/sem/call.cc +++ b/src/tint/sem/call.cc @@ -23,13 +23,17 @@ namespace tint::sem { Call::Call(const ast::CallExpression* declaration, const CallTarget* target, - std::vector arguments, + EvaluationStage stage, + utils::VectorRef arguments, const Statement* statement, - Constant constant, + const Constant* constant, bool has_side_effects) - : Base(declaration, target->ReturnType(), statement, std::move(constant), has_side_effects), + : Base(declaration, target->ReturnType(), stage, statement, constant, has_side_effects), target_(target), - arguments_(std::move(arguments)) {} + arguments_(std::move(arguments)) { + // Check that the stage is no earlier than the target supports + TINT_ASSERT(Semantic, target->Stage() <= stage); +} Call::~Call() = default; diff --git a/src/tint/sem/call.h b/src/tint/sem/call.h index c96179daa4..1213c6d81d 100644 --- a/src/tint/sem/call.h +++ b/src/tint/sem/call.h @@ -17,8 +17,10 @@ #include +#include "src/tint/ast/call_expression.h" #include "src/tint/sem/builtin.h" #include "src/tint/sem/expression.h" +#include "src/tint/utils/vector.h" namespace tint::sem { @@ -29,15 +31,17 @@ class Call final : public Castable { /// Constructor /// @param declaration the AST node /// @param target the call target + /// @param stage the earliest evaluation stage for the expression /// @param arguments the call arguments /// @param statement the statement that owns this expression /// @param constant the constant value of this expression /// @param has_side_effects whether this expression may have side effects Call(const ast::CallExpression* declaration, const CallTarget* target, - std::vector arguments, + EvaluationStage stage, + utils::VectorRef arguments, const Statement* statement, - Constant constant, + const Constant* constant, bool has_side_effects); /// Destructor @@ -47,7 +51,7 @@ class Call final : public Castable { const CallTarget* Target() const { return target_; } /// @return the call arguments - const std::vector& Arguments() const { return arguments_; } + const auto& Arguments() const { return arguments_; } /// @returns the AST node const ast::CallExpression* Declaration() const { @@ -56,7 +60,7 @@ class Call final : public Castable { private: CallTarget const* const target_; - std::vector arguments_; + utils::Vector arguments_; }; } // namespace tint::sem diff --git a/src/tint/sem/call_target.cc b/src/tint/sem/call_target.cc index 67bde0e144..e3b03d4156 100644 --- a/src/tint/sem/call_target.cc +++ b/src/tint/sem/call_target.cc @@ -14,6 +14,8 @@ #include "src/tint/sem/call_target.h" +#include + #include "src/tint/symbol_table.h" #include "src/tint/utils/hash.h" @@ -21,21 +23,24 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::CallTarget); namespace tint::sem { -CallTarget::CallTarget(const sem::Type* return_type, const ParameterList& parameters) - : signature_{return_type, parameters} { +CallTarget::CallTarget(const sem::Type* return_type, + utils::VectorRef parameters, + EvaluationStage stage) + : signature_{return_type, std::move(parameters)}, stage_(stage) { TINT_ASSERT(Semantic, return_type); } CallTarget::CallTarget(const CallTarget&) = default; CallTarget::~CallTarget() = default; -CallTargetSignature::CallTargetSignature(const sem::Type* ret_ty, const ParameterList& params) - : return_type(ret_ty), parameters(params) {} +CallTargetSignature::CallTargetSignature(const sem::Type* ret_ty, + utils::VectorRef params) + : return_type(ret_ty), parameters(std::move(params)) {} CallTargetSignature::CallTargetSignature(const CallTargetSignature&) = default; CallTargetSignature::~CallTargetSignature() = default; int CallTargetSignature::IndexOf(ParameterUsage usage) const { - for (size_t i = 0; i < parameters.size(); i++) { + for (size_t i = 0; i < parameters.Length(); i++) { if (parameters[i]->Usage() == usage) { return static_cast(i); } @@ -44,10 +49,10 @@ int CallTargetSignature::IndexOf(ParameterUsage usage) const { } bool CallTargetSignature::operator==(const CallTargetSignature& other) const { - if (return_type != other.return_type || parameters.size() != other.parameters.size()) { + if (return_type != other.return_type || parameters.Length() != other.parameters.Length()) { return false; } - for (size_t i = 0; i < parameters.size(); i++) { + for (size_t i = 0; i < parameters.Length(); i++) { auto* a = parameters[i]; auto* b = other.parameters[i]; if (a->Type() != b->Type() || a->Usage() != b->Usage()) { @@ -63,9 +68,9 @@ namespace std { std::size_t hash::operator()( const tint::sem::CallTargetSignature& sig) const { - size_t hash = tint::utils::Hash(sig.parameters.size()); + size_t hash = tint::utils::Hash(sig.parameters.Length()); for (auto* p : sig.parameters) { - tint::utils::HashCombine(&hash, p->Type(), p->Usage()); + hash = tint::utils::HashCombine(hash, p->Type(), p->Usage()); } return tint::utils::Hash(hash, sig.return_type); } diff --git a/src/tint/sem/call_target.h b/src/tint/sem/call_target.h index 64716b2913..3f7fec1ce6 100644 --- a/src/tint/sem/call_target.h +++ b/src/tint/sem/call_target.h @@ -21,6 +21,7 @@ #include "src/tint/sem/sampler.h" #include "src/tint/sem/variable.h" #include "src/tint/utils/hash.h" +#include "src/tint/utils/vector.h" // Forward declarations namespace tint::sem { @@ -34,7 +35,7 @@ struct CallTargetSignature { /// Constructor /// @param ret_ty the call target return type /// @param params the call target parameters - CallTargetSignature(const sem::Type* ret_ty, const ParameterList& params); + CallTargetSignature(const sem::Type* ret_ty, utils::VectorRef params); /// Copy constructor CallTargetSignature(const CallTargetSignature&); @@ -45,7 +46,7 @@ struct CallTargetSignature { /// The type of the call target return value const sem::Type* const return_type = nullptr; /// The parameters of the call target - const ParameterList parameters; + const utils::Vector parameters; /// Equality operator /// @param other the signature to compare this to @@ -63,9 +64,12 @@ struct CallTargetSignature { class CallTarget : public Castable { public: /// Constructor + /// @param stage the earliest evaluation stage for a call to this target /// @param return_type the return type of the call target /// @param parameters the parameters for the call target - CallTarget(const sem::Type* return_type, const ParameterList& parameters); + CallTarget(const sem::Type* return_type, + utils::VectorRef parameters, + EvaluationStage stage); /// Copy constructor CallTarget(const CallTarget&); @@ -77,13 +81,17 @@ class CallTarget : public Castable { const sem::Type* ReturnType() const { return signature_.return_type; } /// @return the parameters of the call target - const ParameterList& Parameters() const { return signature_.parameters; } + auto& Parameters() const { return signature_.parameters; } /// @return the signature of the call target const CallTargetSignature& Signature() const { return signature_; } + /// @return the earliest evaluation stage for a call to this target + EvaluationStage Stage() const { return stage_; } + private: CallTargetSignature signature_; + EvaluationStage stage_; }; } // namespace tint::sem diff --git a/src/tint/sem/constant.cc b/src/tint/sem/constant.cc index f5c82a2ced..70bb08c5b5 100644 --- a/src/tint/sem/constant.cc +++ b/src/tint/sem/constant.cc @@ -14,66 +14,10 @@ #include "src/tint/sem/constant.h" -#include -#include - -#include "src/tint/debug.h" -#include "src/tint/program_builder.h" -#include "src/tint/sem/type.h" - namespace tint::sem { -namespace { - -const Type* ElemType(const Type* ty, size_t num_elements) { - diag::List diag; - if (ty->is_scalar()) { - if (num_elements != 1) { - TINT_ICE(Semantic, diag) << "sem::Constant() type <-> num_element mismatch. type: '" - << ty->TypeInfo().name << "' num_elements: " << num_elements; - } - return ty; - } - if (auto* vec = ty->As()) { - if (num_elements != vec->Width()) { - TINT_ICE(Semantic, diag) << "sem::Constant() type <-> num_element mismatch. type: '" - << ty->TypeInfo().name << "' num_elements: " << num_elements; - } - TINT_ASSERT(Semantic, vec->type()->is_scalar()); - return vec->type(); - } - TINT_UNREACHABLE(Semantic, diag) << "Unsupported sem::Constant type"; - return nullptr; -} - -} // namespace - -Constant::Constant() {} - -Constant::Constant(const sem::Type* ty, Scalars els) - : type_(ty), elem_type_(ElemType(ty, els.size())), elems_(std::move(els)) {} - -Constant::Constant(const Constant&) = default; +Constant::Constant() = default; Constant::~Constant() = default; -Constant& Constant::operator=(const Constant& rhs) = default; - -bool Constant::AnyZero() const { - for (size_t i = 0; i < Elements().size(); ++i) { - if (WithScalarAt(i, [&](auto&& s) { - // Use std::equal_to to work around -Wfloat-equal warnings - using T = std::remove_reference_t; - auto equal_to = std::equal_to{}; - if (equal_to(s, T(0))) { - return true; - } - return false; - })) { - return true; - } - } - return false; -} - } // namespace tint::sem diff --git a/src/tint/sem/constant.h b/src/tint/sem/constant.h index 673446f3cc..875864fdc5 100644 --- a/src/tint/sem/constant.h +++ b/src/tint/sem/constant.h @@ -15,118 +15,66 @@ #ifndef SRC_TINT_SEM_CONSTANT_H_ #define SRC_TINT_SEM_CONSTANT_H_ -#include +#include -#include "src/tint/program_builder.h" -#include "src/tint/sem/type.h" +#include "src/tint/number.h" + +// Forward declarations +namespace tint::sem { +class Type; +} namespace tint::sem { -/// A Constant is compile-time known expression value, expressed as a flattened -/// list of scalar values. Value may be of a scalar or vector type. +/// Constant is the interface to a compile-time evaluated expression value. class Constant { public: - /// Scalar holds a single constant scalar value, as a union of an i32, u32, - /// f32 or boolean. - union Scalar { - /// The scalar value as a i32 - tint::i32 i32; - /// The scalar value as a u32 - tint::u32 u32; - /// The scalar value as a f32 - tint::f32 f32; - /// The scalar value as a bool - bool bool_; - - /// Constructs the scalar with the i32 value `v` - /// @param v the value of the Scalar - Scalar(tint::i32 v) : i32(v) {} // NOLINT - - /// Constructs the scalar with the u32 value `v` - /// @param v the value of the Scalar - Scalar(tint::u32 v) : u32(v) {} // NOLINT - - /// Constructs the scalar with the f32 value `v` - /// @param v the value of the Scalar - Scalar(tint::f32 v) : f32(v) {} // NOLINT - - /// Constructs the scalar with the bool value `v` - /// @param v the value of the Scalar - Scalar(bool v) : bool_(v) {} // NOLINT - }; - - /// Scalars is a list of scalar values - using Scalars = std::vector; - - /// Constructs an invalid Constant + /// Constructor Constant(); - /// Constructs a Constant of the given type and element values - /// @param ty the Constant type - /// @param els the Constant element values - Constant(const Type* ty, Scalars els); - - /// Copy constructor - Constant(const Constant&); - /// Destructor - ~Constant(); + virtual ~Constant(); - /// Copy assignment - /// @param other the Constant to copy - /// @returns this Constant - Constant& operator=(const Constant& other); + /// @returns the type of the constant + virtual const sem::Type* Type() const = 0; - /// @returns true if the Constant has been initialized - bool IsValid() const { return type_ != nullptr; } + /// @returns the value of this Constant, if this constant is of a scalar value or abstract + /// numeric, otherwise std::monostate. + virtual std::variant Value() const = 0; - /// @return true if the Constant has been initialized - operator bool() const { return IsValid(); } + /// @returns the child constant element with the given index, or nullptr if the constant has no + /// children, or the index is out of bounds. + /// For arrays, this returns the i'th element of the array. + /// For vectors, this returns the i'th element of the vector. + /// For matrices, this returns the i'th column vector of the matrix. + /// For structures, this returns the i'th member field of the structure. + virtual const Constant* Index(size_t) const = 0; - /// @returns the type of the Constant - const sem::Type* Type() const { return type_; } + /// @returns true if child elements of this constant are positive-zero valued. + virtual bool AllZero() const = 0; - /// @returns the element type of the Constant - const sem::Type* ElementType() const { return elem_type_; } + /// @returns true if any child elements of this constant are positive-zero valued. + virtual bool AnyZero() const = 0; - /// @returns the constant's scalar elements - const Scalars& Elements() const { return elems_; } + /// @returns true if all child elements of this constant have the same value and type. + virtual bool AllEqual() const = 0; - /// @returns true if any scalar element is zero - bool AnyZero() const; + /// @returns a hash of the constant. + virtual size_t Hash() const = 0; - /// Calls `func(s)` with s being the current scalar value at `index`. - /// `func` is typically a lambda of the form '[](auto&& s)'. - /// @param index the index of the scalar value - /// @param func a function with signature `T(S)` - /// @return the value returned by func. - template - auto WithScalarAt(size_t index, Func&& func) const { - return Switch( - ElementType(), // - [&](const I32*) { return func(elems_[index].i32); }, - [&](const U32*) { return func(elems_[index].u32); }, - [&](const F32*) { return func(elems_[index].f32); }, - [&](const Bool*) { return func(elems_[index].bool_); }, - [&](Default) { - diag::List diags; - TINT_UNREACHABLE(Semantic, diags) - << "invalid scalar type " << type_->TypeInfo().name; - return func(u32(0u)); - }); - } - - /// @param index the index of the scalar value - /// @return the value of the scalar `static_cast` to type T. + /// @returns the value of the constant as the given scalar or abstract value. template - T ElementAs(size_t index) const { - return WithScalarAt(index, [](auto val) { return static_cast(val); }); + T As() const { + return std::visit( + [](auto v) { + if constexpr (std::is_same_v) { + return T(0); + } else { + return static_cast(v); + } + }, + Value()); } - - private: - const sem::Type* type_ = nullptr; - const sem::Type* elem_type_ = nullptr; - Scalars elems_; }; } // namespace tint::sem diff --git a/src/tint/sem/evaluation_stage.h b/src/tint/sem/evaluation_stage.h new file mode 100644 index 0000000000..b5e554d873 --- /dev/null +++ b/src/tint/sem/evaluation_stage.h @@ -0,0 +1,60 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_SEM_EVALUATION_STAGE_H_ +#define SRC_TINT_SEM_EVALUATION_STAGE_H_ + +#include +#include + +namespace tint::sem { + +/// The earliest point in time that an expression can be evaluated +enum class EvaluationStage { + /// Expression can be evaluated at shader creation time + kConstant, + /// Expression can be evaluated at pipeline creation time + kOverride, + /// Expression can be evaluated at runtime + kRuntime, +}; + +/// @returns true if stage `a` comes earlier than stage `b` +inline bool operator<(EvaluationStage a, EvaluationStage b) { + return static_cast(a) < static_cast(b); +} + +/// @returns true if stage `a` comes later than stage `b` +inline bool operator>(EvaluationStage a, EvaluationStage b) { + return static_cast(a) > static_cast(b); +} + +/// @param stages a list of EvaluationStage. +/// @returns the earliest stage supported by all the provided stages +inline EvaluationStage EarliestStage(std::initializer_list stages) { + auto earliest = EvaluationStage::kConstant; + for (auto stage : stages) { + earliest = std::max(stage, earliest); + } + return static_cast(earliest); +} + +template +inline EvaluationStage EarliestStage(ARGS... args) { + return EarliestStage({args...}); +} + +} // namespace tint::sem + +#endif // SRC_TINT_SEM_EVALUATION_STAGE_H_ diff --git a/src/tint/sem/expression.cc b/src/tint/sem/expression.cc index 40fbb584c2..cdaa2bca3d 100644 --- a/src/tint/sem/expression.cc +++ b/src/tint/sem/expression.cc @@ -16,25 +16,37 @@ #include +#include "src/tint/sem/materialize.h" + TINT_INSTANTIATE_TYPEINFO(tint::sem::Expression); namespace tint::sem { Expression::Expression(const ast::Expression* declaration, const sem::Type* type, + EvaluationStage stage, const Statement* statement, - Constant constant, + const Constant* constant, bool has_side_effects, const Variable* source_var /* = nullptr */) : declaration_(declaration), source_variable_(source_var), type_(type), + stage_(stage), statement_(statement), constant_(std::move(constant)), has_side_effects_(has_side_effects) { TINT_ASSERT(Semantic, type_); + TINT_ASSERT(Semantic, (constant != nullptr) == (stage == EvaluationStage::kConstant)); } Expression::~Expression() = default; +const Expression* Expression::UnwrapMaterialize() const { + if (auto* m = As()) { + return m->Expr(); + } + return this; +} + } // namespace tint::sem diff --git a/src/tint/sem/expression.h b/src/tint/sem/expression.h index 13f493b59c..5942a71108 100644 --- a/src/tint/sem/expression.h +++ b/src/tint/sem/expression.h @@ -18,6 +18,7 @@ #include "src/tint/ast/expression.h" #include "src/tint/sem/behavior.h" #include "src/tint/sem/constant.h" +#include "src/tint/sem/evaluation_stage.h" #include "src/tint/sem/node.h" // Forward declarations @@ -28,20 +29,23 @@ class Variable; } // namespace tint::sem namespace tint::sem { + /// Expression holds the semantic information for expression nodes. class Expression : public Castable { public: /// Constructor /// @param declaration the AST node /// @param type the resolved type of the expression + /// @param stage the earliest evaluation stage for the expression /// @param statement the statement that owns this expression - /// @param constant the constant value of the expression. May be invalid + /// @param constant the constant value of the expression. May be null /// @param has_side_effects true if this expression may have side-effects /// @param source_var the (optional) source variable for this expression Expression(const ast::Expression* declaration, const sem::Type* type, + EvaluationStage stage, const Statement* statement, - Constant constant, + const Constant* constant, bool has_side_effects, const Variable* source_var = nullptr); @@ -54,11 +58,14 @@ class Expression : public Castable { /// @return the resolved type of the expression const sem::Type* Type() const { return type_; } + /// @return the earliest evaluation stage for the expression + EvaluationStage Stage() const { return stage_; } + /// @return the statement that owns this expression const Statement* Stmt() const { return statement_; } /// @return the constant value of this expression - const Constant& ConstantValue() const { return constant_; } + const Constant* ConstantValue() const { return constant_; } /// Returns the variable or parameter that this expression derives from. /// For reference and pointer expressions, this will either be the originating @@ -76,6 +83,9 @@ class Expression : public Castable { /// @return true of this expression may have side effects bool HasSideEffects() const { return has_side_effects_; } + /// @return the inner expression node if this is a Materialize, otherwise this. + const Expression* UnwrapMaterialize() const; + protected: /// The AST expression node for this semantic expression const ast::Expression* const declaration_; @@ -84,8 +94,9 @@ class Expression : public Castable { private: const sem::Type* const type_; + const EvaluationStage stage_; const Statement* const statement_; - const Constant constant_; + const Constant* const constant_; sem::Behaviors behaviors_{sem::Behavior::kNext}; const bool has_side_effects_; }; diff --git a/src/tint/sem/expression_test.cc b/src/tint/sem/expression_test.cc new file mode 100644 index 0000000000..63e01fbce0 --- /dev/null +++ b/src/tint/sem/expression_test.cc @@ -0,0 +1,57 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/sem/expression.h" + +#include "src/tint/sem/test_helper.h" + +#include "src/tint/sem/materialize.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::sem { +namespace { + +class MockConstant : public sem::Constant { + public: + explicit MockConstant(const sem::Type* ty) : type(ty) {} + ~MockConstant() override {} + const sem::Type* Type() const override { return type; } + std::variant Value() const override { return {}; } + const Constant* Index(size_t) const override { return {}; } + bool AllZero() const override { return {}; } + bool AnyZero() const override { return {}; } + bool AllEqual() const override { return {}; } + size_t Hash() const override { return 0; } + + private: + const sem::Type* type; +}; + +using ExpressionTest = TestHelper; + +TEST_F(ExpressionTest, UnwrapMaterialize) { + MockConstant c(create()); + auto* a = create(/* declaration */ nullptr, create(), + sem::EvaluationStage::kRuntime, /* statement */ nullptr, + /* constant_value */ nullptr, + /* has_side_effects */ false, /* source_var */ nullptr); + auto* b = create(a, /* statement */ nullptr, &c); + + EXPECT_EQ(a, a->UnwrapMaterialize()); + EXPECT_EQ(a, b->UnwrapMaterialize()); +} + +} // namespace +} // namespace tint::sem diff --git a/src/tint/sem/f16.cc b/src/tint/sem/f16.cc new file mode 100644 index 0000000000..7da65fa91d --- /dev/null +++ b/src/tint/sem/f16.cc @@ -0,0 +1,55 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/sem/f16.h" + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::sem::F16); + +namespace tint { +namespace sem { + +F16::F16() = default; + +F16::F16(F16&&) = default; + +F16::~F16() = default; + +size_t F16::Hash() const { + return static_cast(TypeInfo::Of().full_hashcode); +} + +bool F16::Equals(const Type& other) const { + return other.Is(); +} + +std::string F16::FriendlyName(const SymbolTable&) const { + return "f16"; +} + +bool F16::IsConstructible() const { + return true; +} + +uint32_t F16::Size() const { + return 2; +} + +uint32_t F16::Align() const { + return 2; +} + +} // namespace sem +} // namespace tint diff --git a/src/tint/sem/f16.h b/src/tint/sem/f16.h new file mode 100644 index 0000000000..87543ed0e4 --- /dev/null +++ b/src/tint/sem/f16.h @@ -0,0 +1,58 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_SEM_F16_H_ +#define SRC_TINT_SEM_F16_H_ + +#include + +#include "src/tint/sem/type.h" + +namespace tint::sem { + +/// A float 16 type +class F16 final : public Castable { + public: + /// Constructor + F16(); + /// Move constructor + F16(F16&&); + ~F16() override; + + /// @returns a hash of the type. + size_t Hash() const override; + + /// @param other the other type to compare against + /// @returns true if the this type is equal to the given type + bool Equals(const Type& other) const override; + + /// @param symbols the program's symbol table + /// @returns the name for this type that closely resembles how it would be + /// declared in WGSL. + std::string FriendlyName(const SymbolTable& symbols) const override; + + /// @returns true if constructible as per + /// https://gpuweb.github.io/gpuweb/wgsl/#constructible-types + bool IsConstructible() const override; + + /// @returns the size in bytes of the type. + uint32_t Size() const override; + + /// @returns the alignment in bytes of the type. + uint32_t Align() const override; +}; + +} // namespace tint::sem + +#endif // SRC_TINT_SEM_F16_H_ diff --git a/src/tint/sem/f16_test.cc b/src/tint/sem/f16_test.cc new file mode 100644 index 0000000000..28fd0dab6b --- /dev/null +++ b/src/tint/sem/f16_test.cc @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/sem/test_helper.h" +#include "src/tint/sem/texture.h" + +namespace tint::sem { +namespace { + +using F16Test = TestHelper; + +TEST_F(F16Test, Creation) { + auto* a = create(); + auto* b = create(); + EXPECT_EQ(a, b); +} + +TEST_F(F16Test, Hash) { + auto* a = create(); + auto* b = create(); + EXPECT_EQ(a->Hash(), b->Hash()); +} + +TEST_F(F16Test, Equals) { + auto* a = create(); + auto* b = create(); + EXPECT_TRUE(a->Equals(*b)); + EXPECT_FALSE(a->Equals(Void{})); +} + +TEST_F(F16Test, FriendlyName) { + F16 f; + EXPECT_EQ(f.FriendlyName(Symbols()), "f16"); +} + +} // namespace +} // namespace tint::sem diff --git a/src/tint/sem/function.cc b/src/tint/sem/function.cc index 790933b94a..97171fe470 100644 --- a/src/tint/sem/function.cc +++ b/src/tint/sem/function.cc @@ -21,22 +21,29 @@ #include "src/tint/sem/sampled_texture.h" #include "src/tint/sem/storage_texture.h" #include "src/tint/sem/variable.h" -#include "src/tint/utils/to_const_ptr_vec.h" +#include "src/tint/utils/transform.h" TINT_INSTANTIATE_TYPEINFO(tint::sem::Function); namespace tint::sem { +namespace { + +utils::VectorRef SetOwner(utils::VectorRef parameters, + const tint::sem::CallTarget* owner) { + for (auto* parameter : parameters) { + parameter->SetOwner(owner); + } + return parameters; +} + +} // namespace Function::Function(const ast::Function* declaration, Type* return_type, - std::vector parameters) - : Base(return_type, utils::ToConstPtrVec(parameters)), + utils::VectorRef parameters) + : Base(return_type, SetOwner(std::move(parameters), this), EvaluationStage::kRuntime), declaration_(declaration), - workgroup_size_{WorkgroupDimension{1}, WorkgroupDimension{1}, WorkgroupDimension{1}} { - for (auto* parameter : parameters) { - parameter->SetOwner(this); - } -} + workgroup_size_{WorkgroupDimension{1}, WorkgroupDimension{1}, WorkgroupDimension{1}} {} Function::~Function() = default; @@ -44,10 +51,10 @@ std::vector> Function::TransitivelyReferencedLocationVariables() const { std::vector> ret; - for (auto* var : TransitivelyReferencedGlobals()) { - for (auto* attr : var->Declaration()->attributes) { + for (auto* global : TransitivelyReferencedGlobals()) { + for (auto* attr : global->Declaration()->attributes) { if (auto* location = attr->As()) { - ret.push_back({var, location}); + ret.push_back({global, location}); break; } } @@ -58,13 +65,13 @@ Function::TransitivelyReferencedLocationVariables() const { Function::VariableBindings Function::TransitivelyReferencedUniformVariables() const { VariableBindings ret; - for (auto* var : TransitivelyReferencedGlobals()) { - if (var->StorageClass() != ast::StorageClass::kUniform) { + for (auto* global : TransitivelyReferencedGlobals()) { + if (global->StorageClass() != ast::StorageClass::kUniform) { continue; } - if (auto binding_point = var->Declaration()->BindingPoint()) { - ret.push_back({var, binding_point}); + if (global->Declaration()->HasBindingPoint()) { + ret.push_back({global, global->BindingPoint()}); } } return ret; @@ -73,13 +80,13 @@ Function::VariableBindings Function::TransitivelyReferencedUniformVariables() co Function::VariableBindings Function::TransitivelyReferencedStorageBufferVariables() const { VariableBindings ret; - for (auto* var : TransitivelyReferencedGlobals()) { - if (var->StorageClass() != ast::StorageClass::kStorage) { + for (auto* global : TransitivelyReferencedGlobals()) { + if (global->StorageClass() != ast::StorageClass::kStorage) { continue; } - if (auto binding_point = var->Declaration()->BindingPoint()) { - ret.push_back({var, binding_point}); + if (global->Declaration()->HasBindingPoint()) { + ret.push_back({global, global->BindingPoint()}); } } return ret; @@ -89,10 +96,10 @@ std::vector> Function::TransitivelyReferencedBuiltinVariables() const { std::vector> ret; - for (auto* var : TransitivelyReferencedGlobals()) { - for (auto* attr : var->Declaration()->attributes) { + for (auto* global : TransitivelyReferencedGlobals()) { + for (auto* attr : global->Declaration()->attributes) { if (auto* builtin = attr->As()) { - ret.push_back({var, builtin}); + ret.push_back({global, builtin}); break; } } @@ -119,11 +126,11 @@ Function::VariableBindings Function::TransitivelyReferencedMultisampledTextureVa Function::VariableBindings Function::TransitivelyReferencedVariablesOfType( const tint::TypeInfo* type) const { VariableBindings ret; - for (auto* var : TransitivelyReferencedGlobals()) { - auto* unwrapped_type = var->Type()->UnwrapRef(); + for (auto* global : TransitivelyReferencedGlobals()) { + auto* unwrapped_type = global->Type()->UnwrapRef(); if (unwrapped_type->TypeInfo().Is(type)) { - if (auto binding_point = var->Declaration()->BindingPoint()) { - ret.push_back({var, binding_point}); + if (global->Declaration()->HasBindingPoint()) { + ret.push_back({global, global->BindingPoint()}); } } } @@ -143,15 +150,15 @@ Function::VariableBindings Function::TransitivelyReferencedSamplerVariablesImpl( ast::SamplerKind kind) const { VariableBindings ret; - for (auto* var : TransitivelyReferencedGlobals()) { - auto* unwrapped_type = var->Type()->UnwrapRef(); + for (auto* global : TransitivelyReferencedGlobals()) { + auto* unwrapped_type = global->Type()->UnwrapRef(); auto* sampler = unwrapped_type->As(); if (sampler == nullptr || sampler->kind() != kind) { continue; } - if (auto binding_point = var->Declaration()->BindingPoint()) { - ret.push_back({var, binding_point}); + if (global->Declaration()->HasBindingPoint()) { + ret.push_back({global, global->BindingPoint()}); } } return ret; @@ -161,8 +168,8 @@ Function::VariableBindings Function::TransitivelyReferencedSampledTextureVariabl bool multisampled) const { VariableBindings ret; - for (auto* var : TransitivelyReferencedGlobals()) { - auto* unwrapped_type = var->Type()->UnwrapRef(); + for (auto* global : TransitivelyReferencedGlobals()) { + auto* unwrapped_type = global->Type()->UnwrapRef(); auto* texture = unwrapped_type->As(); if (texture == nullptr) { continue; @@ -175,8 +182,8 @@ Function::VariableBindings Function::TransitivelyReferencedSampledTextureVariabl continue; } - if (auto binding_point = var->Declaration()->BindingPoint()) { - ret.push_back({var, binding_point}); + if (global->Declaration()->HasBindingPoint()) { + ret.push_back({global, global->BindingPoint()}); } } diff --git a/src/tint/sem/function.h b/src/tint/sem/function.h index f95920a6bf..d4cb1c7eac 100644 --- a/src/tint/sem/function.h +++ b/src/tint/sem/function.h @@ -22,6 +22,7 @@ #include "src/tint/ast/variable.h" #include "src/tint/sem/call.h" #include "src/tint/utils/unique_vector.h" +#include "src/tint/utils/vector.h" // Forward declarations namespace tint::ast { @@ -53,8 +54,8 @@ using WorkgroupSize = std::array; /// Function holds the semantic information for function nodes. class Function final : public Castable { public: - /// A vector of [Variable*, ast::VariableBindingPoint] pairs - using VariableBindings = std::vector>; + /// A vector of [Variable*, sem::BindingPoint] pairs + using VariableBindings = std::vector>; /// Constructor /// @param declaration the ast::Function @@ -62,7 +63,7 @@ class Function final : public Castable { /// @param parameters the parameters to the function Function(const ast::Function* declaration, Type* return_type, - std::vector parameters); + utils::VectorRef parameters); /// Destructor ~Function() override; @@ -80,7 +81,7 @@ class Function final : public Castable { } /// @returns all directly referenced global variables - const utils::UniqueVector& DirectlyReferencedGlobals() const { + const utils::UniqueVector& DirectlyReferencedGlobals() const { return directly_referenced_globals_; } @@ -88,12 +89,12 @@ class Function final : public Castable { /// Note: Implicitly adds this global to the transtively-called globals. /// @param global the module-scope variable void AddDirectlyReferencedGlobal(const sem::GlobalVariable* global) { - directly_referenced_globals_.add(global); - transitively_referenced_globals_.add(global); + directly_referenced_globals_.Add(global); + transitively_referenced_globals_.Add(global); } /// @returns all transitively referenced global variables - const utils::UniqueVector& TransitivelyReferencedGlobals() const { + const utils::UniqueVector& TransitivelyReferencedGlobals() const { return transitively_referenced_globals_; } @@ -101,29 +102,29 @@ class Function final : public Castable { /// variable. /// @param global the module-scoped variable void AddTransitivelyReferencedGlobal(const sem::GlobalVariable* global) { - transitively_referenced_globals_.add(global); + transitively_referenced_globals_.Add(global); } /// @returns the list of functions that this function transitively calls. - const utils::UniqueVector& TransitivelyCalledFunctions() const { + const utils::UniqueVector& TransitivelyCalledFunctions() const { return transitively_called_functions_; } /// Records that this function transitively calls `function`. /// @param function the function this function transitively calls void AddTransitivelyCalledFunction(const Function* function) { - transitively_called_functions_.add(function); + transitively_called_functions_.Add(function); } /// @returns the list of builtins that this function directly calls. - const utils::UniqueVector& DirectlyCalledBuiltins() const { + const utils::UniqueVector& DirectlyCalledBuiltins() const { return directly_called_builtins_; } /// Records that this function transitively calls `builtin`. /// @param builtin the builtin this function directly calls void AddDirectlyCalledBuiltin(const Builtin* builtin) { - directly_called_builtins_.add(builtin); + directly_called_builtins_.Add(builtin); } /// Adds the given texture/sampler pair to the list of unique pairs @@ -133,12 +134,14 @@ class Function final : public Castable { /// @param texture the texture (must be non-null) /// @param sampler the sampler (null indicates a texture-only reference) void AddTextureSamplerPair(const sem::Variable* texture, const sem::Variable* sampler) { - texture_sampler_pairs_.add(VariablePair(texture, sampler)); + texture_sampler_pairs_.Add(VariablePair(texture, sampler)); } /// @returns the list of texture/sampler pairs that this function uses /// (directly or indirectly). - const std::vector& TextureSamplerPairs() const { return texture_sampler_pairs_; } + const utils::Vector& TextureSamplerPairs() const { + return texture_sampler_pairs_; + } /// @returns the list of direct calls to functions / builtins made by this /// function @@ -252,17 +255,20 @@ class Function final : public Castable { sem::Behaviors& Behaviors() { return behaviors_; } private: + Function(const Function&) = delete; + Function(Function&&) = delete; + VariableBindings TransitivelyReferencedSamplerVariablesImpl(ast::SamplerKind kind) const; VariableBindings TransitivelyReferencedSampledTextureVariablesImpl(bool multisampled) const; const ast::Function* const declaration_; sem::WorkgroupSize workgroup_size_; - utils::UniqueVector directly_referenced_globals_; - utils::UniqueVector transitively_referenced_globals_; - utils::UniqueVector transitively_called_functions_; - utils::UniqueVector directly_called_builtins_; - utils::UniqueVector texture_sampler_pairs_; + utils::UniqueVector directly_referenced_globals_; + utils::UniqueVector transitively_referenced_globals_; + utils::UniqueVector transitively_called_functions_; + utils::UniqueVector directly_called_builtins_; + utils::UniqueVector texture_sampler_pairs_; std::vector direct_calls_; std::vector callsites_; std::vector ancestor_entry_points_; diff --git a/src/tint/sem/index_accessor_expression.cc b/src/tint/sem/index_accessor_expression.cc new file mode 100644 index 0000000000..70d1d5f89c --- /dev/null +++ b/src/tint/sem/index_accessor_expression.cc @@ -0,0 +1,40 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/sem/index_accessor_expression.h" + +#include "src/tint/ast/index_accessor_expression.h" + +#include + +TINT_INSTANTIATE_TYPEINFO(tint::sem::IndexAccessorExpression); + +namespace tint::sem { + +IndexAccessorExpression::IndexAccessorExpression(const ast::IndexAccessorExpression* declaration, + const sem::Type* type, + EvaluationStage stage, + const Expression* object, + const Expression* index, + const Statement* statement, + const Constant* constant, + bool has_side_effects, + const Variable* source_var /* = nullptr */) + : Base(declaration, type, stage, statement, constant, has_side_effects, source_var), + object_(object), + index_(index) {} + +IndexAccessorExpression::~IndexAccessorExpression() = default; + +} // namespace tint::sem diff --git a/src/tint/sem/index_accessor_expression.h b/src/tint/sem/index_accessor_expression.h new file mode 100644 index 0000000000..ea93df72ed --- /dev/null +++ b/src/tint/sem/index_accessor_expression.h @@ -0,0 +1,68 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_SEM_INDEX_ACCESSOR_EXPRESSION_H_ +#define SRC_TINT_SEM_INDEX_ACCESSOR_EXPRESSION_H_ + +#include + +#include "src/tint/sem/expression.h" + +// Forward declarations +namespace tint::ast { +class IndexAccessorExpression; +} // namespace tint::ast + +namespace tint::sem { + +/// IndexAccessorExpression holds the semantic information for a ast::IndexAccessorExpression node. +class IndexAccessorExpression final : public Castable { + public: + /// Constructor + /// @param declaration the AST node + /// @param type the resolved type of the expression + /// @param stage the earliest evaluation stage for the expression + /// @param object the object expression that is being indexed + /// @param index the index expression + /// @param statement the statement that owns this expression + /// @param constant the constant value of the expression. May be null + /// @param has_side_effects whether this expression may have side effects + /// @param source_var the (optional) source variable for this expression + IndexAccessorExpression(const ast::IndexAccessorExpression* declaration, + const sem::Type* type, + EvaluationStage stage, + const Expression* object, + const Expression* index, + const Statement* statement, + const Constant* constant, + bool has_side_effects, + const Variable* source_var = nullptr); + + /// Destructor + ~IndexAccessorExpression() override; + + /// @returns the object expression that is being indexed + Expression const* Object() const { return object_; } + + /// @returns the index expression + Expression const* Index() const { return index_; } + + private: + Expression const* const object_; + Expression const* const index_; +}; + +} // namespace tint::sem + +#endif // SRC_TINT_SEM_INDEX_ACCESSOR_EXPRESSION_H_ diff --git a/src/tint/sem/info.h b/src/tint/sem/info.h index 66b2cd531f..894b408fe0 100644 --- a/src/tint/sem/info.h +++ b/src/tint/sem/info.h @@ -15,9 +15,12 @@ #ifndef SRC_TINT_SEM_INFO_H_ #define SRC_TINT_SEM_INFO_H_ +#include #include #include +#include +#include "src/tint/ast/node.h" #include "src/tint/debug.h" #include "src/tint/sem/node.h" #include "src/tint/sem/type_mappings.h" @@ -35,12 +38,11 @@ class Info { /// Placeholder type used by Get() to provide a default value for EXPLICIT_SEM using InferFromAST = std::nullptr_t; - /// Resolves to the return type of the Get() method given the desired sementic + /// Resolves to the return type of the Get() method given the desired semantic /// type and AST type. - template - using GetResultType = std::conditional_t::value, - SemanticNodeTypeFor, - SEM>; + template + using GetResultType = + std::conditional_t::value, SemanticNodeTypeFor, SEM>; /// Constructor Info(); @@ -56,29 +58,42 @@ class Info { /// @return this Program Info& operator=(Info&& rhs); - /// Get looks up the semantic information for the AST or type node `node`. - /// @param node the AST or type node - /// @returns a pointer to the semantic node if found, otherwise nullptr - template > - const RESULT* Get(const AST_OR_TYPE* node) const { - auto it = map_.find(node); - if (it == map_.end()) { - return nullptr; - } - return As(it->second); + /// @param highest_node_id the last allocated (numerically highest) AST node identifier. + void Reserve(ast::NodeID highest_node_id) { + nodes_.resize(std::max(highest_node_id.value + 1, nodes_.size())); } - /// Add registers the semantic node `sem_node` for the AST or type node - /// `node`. - /// @param node the AST or type node + /// Get looks up the semantic information for the AST node `ast_node`. + /// @param ast_node the AST node + /// @returns a pointer to the semantic node if found, otherwise nullptr + template > + const RESULT* Get(const AST* ast_node) const { + if (ast_node && ast_node->node_id.value < nodes_.size()) { + return As(nodes_[ast_node->node_id.value]); + } + return nullptr; + } + + /// Add registers the semantic node `sem_node` for the AST node `ast_node`. + /// @param ast_node the AST node /// @param sem_node the semantic node - template - void Add(const AST_OR_TYPE* node, const SemanticNodeTypeFor* sem_node) { - // Check there's no semantic info already existing for the node - TINT_ASSERT(Semantic, Get(node) == nullptr); - map_.emplace(node, sem_node); + template + void Add(const AST* ast_node, const SemanticNodeTypeFor* sem_node) { + Reserve(ast_node->node_id); + // Check there's no semantic info already existing for the AST node + TINT_ASSERT(Semantic, nodes_[ast_node->node_id.value] == nullptr); + nodes_[ast_node->node_id.value] = sem_node; + } + + /// Replace replaces any existing semantic node `sem_node` for the AST node `ast_node`. + /// @param ast_node the AST node + /// @param sem_node the new semantic node + template + void Replace(const AST* ast_node, const SemanticNodeTypeFor* sem_node) { + Reserve(ast_node->node_id); + nodes_[ast_node->node_id.value] = sem_node; } /// Wrap returns a new Info created with the contents of `inner`. @@ -90,7 +105,7 @@ class Info { /// @return the Info that wraps `inner` static Info Wrap(const Info& inner) { Info out; - out.map_ = inner.map_; + out.nodes_ = inner.nodes_; out.module_ = inner.module_; return out; } @@ -103,9 +118,8 @@ class Info { const sem::Module* Module() const { return module_; } private: - // TODO(crbug.com/tint/724): Once finished, this map should be: - // std::unordered_map - std::unordered_map map_; + // AST node index to semantic node + std::vector nodes_; // The semantic module sem::Module* module_ = nullptr; }; diff --git a/src/tint/sem/materialize.cc b/src/tint/sem/materialize.cc new file mode 100644 index 0000000000..15c31ae08c --- /dev/null +++ b/src/tint/sem/materialize.cc @@ -0,0 +1,34 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0(the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/sem/materialize.h" + +TINT_INSTANTIATE_TYPEINFO(tint::sem::Materialize); + +namespace tint::sem { +Materialize::Materialize(const Expression* expr, + const Statement* statement, + const Constant* constant) + : Base(/* declaration */ expr->Declaration(), + /* type */ constant->Type(), + /* stage */ EvaluationStage::kConstant, // Abstract can only be const-expr + /* statement */ statement, + /* constant */ constant, + /* has_side_effects */ false, + /* source_var */ expr->SourceVariable()), + expr_(expr) {} + +Materialize::~Materialize() = default; + +} // namespace tint::sem diff --git a/src/tint/sem/materialize.h b/src/tint/sem/materialize.h new file mode 100644 index 0000000000..0cbac29ef6 --- /dev/null +++ b/src/tint/sem/materialize.h @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0(the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_SEM_MATERIALIZE_H_ +#define SRC_TINT_SEM_MATERIALIZE_H_ + +#include "src/tint/sem/expression.h" + +namespace tint::sem { + +/// Materialize is a semantic expression which represents the materialization of a value of an +/// abstract numeric type to a value of a concrete type. +/// Abstract numeric materialization is implicit in WGSL, so the Materialize semantic node shares +/// the same AST node as the inner semantic node. +/// Abstract numerics types may only be used by compile-time expressions, so a Materialize semantic +/// node must have a valid Constant value. +class Materialize final : public Castable { + public: + /// Constructor + /// @param expr the inner expression, being materialized + /// @param statement the statement that owns this expression + /// @param constant the constant value of this expression + Materialize(const Expression* expr, const Statement* statement, const Constant* constant); + + /// Destructor + ~Materialize() override; + + /// @return the target of the call + const Expression* Expr() const { return expr_; } + + private: + Expression const* const expr_; +}; + +} // namespace tint::sem + +#endif // SRC_TINT_SEM_MATERIALIZE_H_ diff --git a/src/tint/sem/member_accessor_expression.cc b/src/tint/sem/member_accessor_expression.cc index 9dcca76ef0..4d194a9d9e 100644 --- a/src/tint/sem/member_accessor_expression.cc +++ b/src/tint/sem/member_accessor_expression.cc @@ -25,30 +25,53 @@ namespace tint::sem { MemberAccessorExpression::MemberAccessorExpression(const ast::MemberAccessorExpression* declaration, const sem::Type* type, + EvaluationStage stage, const Statement* statement, + const Constant* constant, + const Expression* object, bool has_side_effects, const Variable* source_var /* = nullptr */) - : Base(declaration, type, statement, Constant{}, has_side_effects, source_var) {} + : Base(declaration, type, stage, statement, constant, has_side_effects, source_var), + object_(object) {} MemberAccessorExpression::~MemberAccessorExpression() = default; StructMemberAccess::StructMemberAccess(const ast::MemberAccessorExpression* declaration, const sem::Type* type, const Statement* statement, + const Constant* constant, + const Expression* object, const StructMember* member, bool has_side_effects, const Variable* source_var /* = nullptr */) - : Base(declaration, type, statement, has_side_effects, source_var), member_(member) {} + : Base(declaration, + type, + object->Stage(), + statement, + constant, + object, + has_side_effects, + source_var), + member_(member) {} StructMemberAccess::~StructMemberAccess() = default; Swizzle::Swizzle(const ast::MemberAccessorExpression* declaration, const sem::Type* type, const Statement* statement, - std::vector indices, + const Constant* constant, + const Expression* object, + utils::VectorRef indices, bool has_side_effects, const Variable* source_var /* = nullptr */) - : Base(declaration, type, statement, has_side_effects, source_var), + : Base(declaration, + type, + object->Stage(), + statement, + constant, + object, + has_side_effects, + source_var), indices_(std::move(indices)) {} Swizzle::~Swizzle() = default; diff --git a/src/tint/sem/member_accessor_expression.h b/src/tint/sem/member_accessor_expression.h index 0233541e31..b8144f1ca2 100644 --- a/src/tint/sem/member_accessor_expression.h +++ b/src/tint/sem/member_accessor_expression.h @@ -15,9 +15,8 @@ #ifndef SRC_TINT_SEM_MEMBER_ACCESSOR_EXPRESSION_H_ #define SRC_TINT_SEM_MEMBER_ACCESSOR_EXPRESSION_H_ -#include - #include "src/tint/sem/expression.h" +#include "src/tint/utils/vector.h" // Forward declarations namespace tint::ast { @@ -37,17 +36,29 @@ class MemberAccessorExpression : public Castable { /// @param declaration the AST node /// @param type the resolved type of the expression /// @param statement the statement that owns this expression + /// @param constant the constant value of the expression. May be null + /// @param object the object that holds the member being accessed /// @param indices the swizzle indices /// @param has_side_effects whether this expression may have side effects /// @param source_var the (optional) source variable for this expression Swizzle(const ast::MemberAccessorExpression* declaration, const sem::Type* type, const Statement* statement, - std::vector indices, + const Constant* constant, + const Expression* object, + utils::VectorRef indices, bool has_side_effects, const Variable* source_var = nullptr); @@ -101,10 +120,10 @@ class Swizzle final : public Castable { ~Swizzle() override; /// @return the swizzle indices, if this is a vector swizzle - const std::vector& Indices() const { return indices_; } + const auto& Indices() const { return indices_; } private: - std::vector const indices_; + utils::Vector const indices_; }; } // namespace tint::sem diff --git a/src/tint/sem/module.cc b/src/tint/sem/module.cc index 83b71360a5..38f0ec63ce 100644 --- a/src/tint/sem/module.cc +++ b/src/tint/sem/module.cc @@ -21,8 +21,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Module); namespace tint::sem { -Module::Module(std::vector dep_ordered_decls) - : dep_ordered_decls_(std::move(dep_ordered_decls)) {} +Module::Module(utils::VectorRef dep_ordered_decls, ast::Extensions extensions) + : dep_ordered_decls_(std::move(dep_ordered_decls)), extensions_(std::move(extensions)) {} Module::~Module() = default; diff --git a/src/tint/sem/module.h b/src/tint/sem/module.h index c265d4ea08..b451c5bd52 100644 --- a/src/tint/sem/module.h +++ b/src/tint/sem/module.h @@ -15,14 +15,13 @@ #ifndef SRC_TINT_SEM_MODULE_H_ #define SRC_TINT_SEM_MODULE_H_ -#include - +#include "src/tint/ast/extension.h" #include "src/tint/sem/node.h" +#include "src/tint/utils/vector.h" // Forward declarations namespace tint::ast { class Node; -class Module; } // namespace tint::ast namespace tint::sem { @@ -33,18 +32,23 @@ class Module final : public Castable { public: /// Constructor /// @param dep_ordered_decls the dependency-ordered module-scope declarations - explicit Module(std::vector dep_ordered_decls); + /// @param extensions the list of enabled extensions in the module + Module(utils::VectorRef dep_ordered_decls, ast::Extensions extensions); /// Destructor ~Module() override; /// @returns the dependency-ordered global declarations for the module - const std::vector& DependencyOrderedDeclarations() const { + const utils::Vector& DependencyOrderedDeclarations() const { return dep_ordered_decls_; } + /// @returns the list of enabled extensions in the module + const ast::Extensions& Extensions() const { return extensions_; } + private: - const std::vector dep_ordered_decls_; + const utils::Vector dep_ordered_decls_; + ast::Extensions extensions_; }; } // namespace tint::sem diff --git a/src/tint/sem/parameter_usage.cc b/src/tint/sem/parameter_usage.cc index 4891bbaf0a..f929ce10fc 100644 --- a/src/tint/sem/parameter_usage.cc +++ b/src/tint/sem/parameter_usage.cc @@ -13,11 +13,9 @@ // limitations under the License. //////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen +// File generated by tools/src/cmd/gen // using the template: // src/tint/sem/parameter_usage.cc.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def // // Do not modify this file directly //////////////////////////////////////////////////////////////////////////////// @@ -56,6 +54,24 @@ const char* str(ParameterUsage usage) { return "texture"; case ParameterUsage::kValue: return "value"; + case ParameterUsage::kW: + return "w"; + case ParameterUsage::kX: + return "x"; + case ParameterUsage::kXy: + return "xy"; + case ParameterUsage::kXyz: + return "xyz"; + case ParameterUsage::kY: + return "y"; + case ParameterUsage::kYz: + return "yz"; + case ParameterUsage::kZ: + return "z"; + case ParameterUsage::kZw: + return "zw"; + case ParameterUsage::kZyw: + return "zyw"; } return ""; } diff --git a/src/tint/sem/parameter_usage.cc.tmpl b/src/tint/sem/parameter_usage.cc.tmpl index bc413e103a..62cb42e6f2 100644 --- a/src/tint/sem/parameter_usage.cc.tmpl +++ b/src/tint/sem/parameter_usage.cc.tmpl @@ -1,9 +1,12 @@ {{- /* -------------------------------------------------------------------------------- -Template file for use with tools/builtin-gen to generate parameter_usage.cc +Template file for use with tools/src/cmd/gen to generate parameter_usage.cc + +To update the generated file, run: + ./tools/run gen See: -* tools/cmd/intrinsic-gen/gen for structures used by this template +* tools/src/cmd/gen for structures used by this template * https://golang.org/pkg/text/template/ for documentation on the template syntax -------------------------------------------------------------------------------- */ -}} @@ -16,7 +19,7 @@ const char* str(ParameterUsage usage) { switch (usage) { case ParameterUsage::kNone: return "none"; -{{- range .Sem.UniqueParameterNames }} +{{- range Sem.UniqueParameterNames }} case ParameterUsage::k{{PascalCase .}}: return "{{.}}"; {{- end }} diff --git a/src/tint/sem/parameter_usage.h b/src/tint/sem/parameter_usage.h index 85ef64fb53..b358534004 100644 --- a/src/tint/sem/parameter_usage.h +++ b/src/tint/sem/parameter_usage.h @@ -13,11 +13,9 @@ // limitations under the License. //////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen +// File generated by tools/src/cmd/gen // using the template: // src/tint/sem/parameter_usage.h.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def // // Do not modify this file directly //////////////////////////////////////////////////////////////////////////////// @@ -44,6 +42,15 @@ enum class ParameterUsage { kSampler, kTexture, kValue, + kW, + kX, + kXy, + kXyz, + kY, + kYz, + kZ, + kZw, + kZyw, }; /// @returns a string representation of the given parameter usage. diff --git a/src/tint/sem/parameter_usage.h.tmpl b/src/tint/sem/parameter_usage.h.tmpl index b1b5789536..7c09805572 100644 --- a/src/tint/sem/parameter_usage.h.tmpl +++ b/src/tint/sem/parameter_usage.h.tmpl @@ -1,9 +1,12 @@ {{- /* -------------------------------------------------------------------------------- -Template file for use with tools/builtin-gen to generate parameter_usage.h +Template file for use with tools/src/cmd/gen to generate parameter_usage.h + +To update the generated file, run: + ./tools/run gen See: -* tools/cmd/intrinsic-gen/gen for structures used by this template +* tools/src/cmd/gen for structures used by this template * https://golang.org/pkg/text/template/ for documentation on the template syntax -------------------------------------------------------------------------------- */ -}} @@ -17,7 +20,7 @@ namespace tint::sem { /// overload position enum class ParameterUsage { kNone = -1, -{{- range .Sem.UniqueParameterNames }} +{{- range Sem.UniqueParameterNames }} k{{PascalCase .}}, {{- end }} }; diff --git a/src/tint/sem/sem_struct_test.cc b/src/tint/sem/sem_struct_test.cc index 4a6371284d..3ea14e113d 100644 --- a/src/tint/sem/sem_struct_test.cc +++ b/src/tint/sem/sem_struct_test.cc @@ -23,7 +23,7 @@ using StructTest = TestHelper; TEST_F(StructTest, Creation) { auto name = Sym("S"); - auto* impl = create(name, ast::StructMemberList{}, ast::AttributeList{}); + auto* impl = create(name, utils::Empty, utils::Empty); auto* ptr = impl; auto* s = create(impl, impl->name, StructMemberList{}, 4u /* align */, 8u /* size */, 16u /* size_no_padding */); @@ -34,10 +34,10 @@ TEST_F(StructTest, Creation) { } TEST_F(StructTest, Hash) { - auto* a_impl = create(Sym("a"), ast::StructMemberList{}, ast::AttributeList{}); + auto* a_impl = create(Sym("a"), utils::Empty, utils::Empty); auto* a = create(a_impl, a_impl->name, StructMemberList{}, 4u /* align */, 4u /* size */, 4u /* size_no_padding */); - auto* b_impl = create(Sym("b"), ast::StructMemberList{}, ast::AttributeList{}); + auto* b_impl = create(Sym("b"), utils::Empty, utils::Empty); auto* b = create(b_impl, b_impl->name, StructMemberList{}, 4u /* align */, 4u /* size */, 4u /* size_no_padding */); @@ -45,10 +45,10 @@ TEST_F(StructTest, Hash) { } TEST_F(StructTest, Equals) { - auto* a_impl = create(Sym("a"), ast::StructMemberList{}, ast::AttributeList{}); + auto* a_impl = create(Sym("a"), utils::Empty, utils::Empty); auto* a = create(a_impl, a_impl->name, StructMemberList{}, 4u /* align */, 4u /* size */, 4u /* size_no_padding */); - auto* b_impl = create(Sym("b"), ast::StructMemberList{}, ast::AttributeList{}); + auto* b_impl = create(Sym("b"), utils::Empty, utils::Empty); auto* b = create(b_impl, b_impl->name, StructMemberList{}, 4u /* align */, 4u /* size */, 4u /* size_no_padding */); @@ -59,7 +59,7 @@ TEST_F(StructTest, Equals) { TEST_F(StructTest, FriendlyName) { auto name = Sym("my_struct"); - auto* impl = create(name, ast::StructMemberList{}, ast::AttributeList{}); + auto* impl = create(name, utils::Empty, utils::Empty); auto* s = create(impl, impl->name, StructMemberList{}, 4u /* align */, 4u /* size */, 4u /* size_no_padding */); EXPECT_EQ(s->FriendlyName(Symbols()), "my_struct"); @@ -67,7 +67,7 @@ TEST_F(StructTest, FriendlyName) { TEST_F(StructTest, Layout) { auto* inner_st = // - Structure("Inner", { + Structure("Inner", utils::Vector{ Member("a", ty.i32()), Member("b", ty.u32()), Member("c", ty.f32()), @@ -75,7 +75,7 @@ TEST_F(StructTest, Layout) { Member("e", ty.mat4x2()), }); - auto* outer_st = Structure("Outer", { + auto* outer_st = Structure("Outer", utils::Vector{ Member("inner", ty.type_name("Inner")), Member("a", ty.i32()), }); diff --git a/src/tint/sem/statement.h b/src/tint/sem/statement.h index 741a3258f9..bdcb55c706 100644 --- a/src/tint/sem/statement.h +++ b/src/tint/sem/statement.h @@ -20,7 +20,6 @@ // Forward declarations namespace tint::ast { -class Function; class Statement; } // namespace tint::ast namespace tint::sem { diff --git a/src/tint/sem/storage_texture.cc b/src/tint/sem/storage_texture.cc index d8393d77d8..5b743e9054 100644 --- a/src/tint/sem/storage_texture.cc +++ b/src/tint/sem/storage_texture.cc @@ -75,7 +75,7 @@ sem::Type* StorageTexture::SubtypeFor(ast::TexelFormat format, sem::Manager& typ return type_mgr.Get(); } - case ast::TexelFormat::kNone: + case ast::TexelFormat::kInvalid: break; } diff --git a/src/tint/sem/struct.cc b/src/tint/sem/struct.cc index eb0583b03b..0ace9db55f 100644 --- a/src/tint/sem/struct.cc +++ b/src/tint/sem/struct.cc @@ -157,7 +157,7 @@ bool Struct::IsConstructible() const { StructMember::StructMember(const ast::StructMember* declaration, Symbol name, - sem::Type* type, + const sem::Type* type, uint32_t index, uint32_t offset, uint32_t align, diff --git a/src/tint/sem/struct.h b/src/tint/sem/struct.h index fe9169dc12..62b1008ce3 100644 --- a/src/tint/sem/struct.h +++ b/src/tint/sem/struct.h @@ -170,7 +170,7 @@ class Struct final : public Castable { }; /// StructMember holds the semantic information for structure members. -class StructMember : public Castable { +class StructMember final : public Castable { public: /// Constructor /// @param declaration the AST declaration node @@ -182,7 +182,7 @@ class StructMember : public Castable { /// @param size the byte size of the member StructMember(const ast::StructMember* declaration, Symbol name, - sem::Type* type, + const sem::Type* type, uint32_t index, uint32_t offset, uint32_t align, @@ -194,11 +194,18 @@ class StructMember : public Castable { /// @returns the AST declaration node const ast::StructMember* Declaration() const { return declaration_; } - /// @returns the name of the structure + /// @returns the name of the structure member Symbol Name() const { return name_; } + /// Sets the owning structure to `s` + /// @param s the new structure owner + void SetStruct(const sem::Struct* s) { struct_ = s; } + + /// @returns the structure that owns this member + const sem::Struct* Struct() const { return struct_; } + /// @returns the type of the member - sem::Type* Type() const { return type_; } + const sem::Type* Type() const { return type_; } /// @returns the member index uint32_t Index() const { return index_; } @@ -215,7 +222,8 @@ class StructMember : public Castable { private: const ast::StructMember* const declaration_; const Symbol name_; - sem::Type* const type_; + const sem::Struct* struct_; + const sem::Type* type_; const uint32_t index_; const uint32_t offset_; const uint32_t align_; diff --git a/src/tint/sem/switch_statement.h b/src/tint/sem/switch_statement.h index a5ef6598e1..a6b5c00f92 100644 --- a/src/tint/sem/switch_statement.h +++ b/src/tint/sem/switch_statement.h @@ -15,6 +15,8 @@ #ifndef SRC_TINT_SEM_SWITCH_STATEMENT_H_ #define SRC_TINT_SEM_SWITCH_STATEMENT_H_ +#include + #include "src/tint/sem/block_statement.h" // Forward declarations @@ -22,6 +24,10 @@ namespace tint::ast { class CaseStatement; class SwitchStatement; } // namespace tint::ast +namespace tint::sem { +class CaseStatement; +class Expression; +} // namespace tint::sem namespace tint::sem { @@ -41,6 +47,15 @@ class SwitchStatement final : public Castable& Cases() { return cases_; } + + /// @returns the case statements for this switch + const std::vector& Cases() const { return cases_; } + + private: + std::vector cases_; }; /// Holds semantic information about a switch case statement @@ -66,8 +81,15 @@ class CaseStatement final : public Castable { /// @returns the case body block statement const BlockStatement* Body() const { return body_; } + /// @returns the selectors for the case + std::vector& Selectors() { return selectors_; } + + /// @returns the selectors for the case + const std::vector& Selectors() const { return selectors_; } + private: const BlockStatement* body_ = nullptr; + std::vector selectors_; }; } // namespace tint::sem diff --git a/src/tint/sem/test_helper.h b/src/tint/sem/test_helper.h index 94f66e48cc..e1b4eb3345 100644 --- a/src/tint/sem/test_helper.h +++ b/src/tint/sem/test_helper.h @@ -44,4 +44,16 @@ using TestParamHelper = TestHelperBase>; } // namespace tint::sem +/// Helper macro for testing that a semantic type was as expected +#define EXPECT_TYPE(GOT, EXPECT) \ + do { \ + const sem::Type* got = GOT; \ + const sem::Type* expect = EXPECT; \ + if (got != expect) { \ + ADD_FAILURE() << #GOT " != " #EXPECT "\n" \ + << " " #GOT ": " << FriendlyName(got) << "\n" \ + << " " #EXPECT ": " << FriendlyName(expect); \ + } \ + } while (false) + #endif // SRC_TINT_SEM_TEST_HELPER_H_ diff --git a/src/tint/sem/type.cc b/src/tint/sem/type.cc index 5776ff4fd2..b4887dd90e 100644 --- a/src/tint/sem/type.cc +++ b/src/tint/sem/type.cc @@ -14,7 +14,11 @@ #include "src/tint/sem/type.h" +#include "src/tint/sem/abstract_float.h" +#include "src/tint/sem/abstract_int.h" +#include "src/tint/sem/array.h" #include "src/tint/sem/bool.h" +#include "src/tint/sem/f16.h" #include "src/tint/sem/f32.h" #include "src/tint/sem/i32.h" #include "src/tint/sem/matrix.h" @@ -64,15 +68,15 @@ bool Type::IsConstructible() const { } bool Type::is_scalar() const { - return IsAnyOf(); + return IsAnyOf(); } bool Type::is_numeric_scalar() const { - return IsAnyOf(); + return IsAnyOf(); } bool Type::is_float_scalar() const { - return Is(); + return IsAnyOf(); } bool Type::is_float_matrix() const { @@ -109,7 +113,7 @@ bool Type::is_unsigned_integer_scalar() const { } bool Type::is_signed_integer_vector() const { - return Is([](const Vector* v) { return v->type()->Is(); }); + return Is([](const Vector* v) { return v->type()->IsAnyOf(); }); } bool Type::is_unsigned_integer_vector() const { @@ -128,6 +132,22 @@ bool Type::is_integer_scalar_or_vector() const { return is_unsigned_scalar_or_vector() || is_signed_scalar_or_vector(); } +bool Type::is_abstract_integer_vector() const { + return Is([](const Vector* v) { return v->type()->Is(); }); +} + +bool Type::is_abstract_float_vector() const { + return Is([](const Vector* v) { return v->type()->Is(); }); +} + +bool Type::is_abstract_integer_scalar_or_vector() const { + return Is() || is_abstract_integer_vector(); +} + +bool Type::is_abstract_float_scalar_or_vector() const { + return Is() || is_abstract_float_vector(); +} + bool Type::is_bool_vector() const { return Is([](const Vector* v) { return v->type()->Is(); }); } @@ -152,4 +172,127 @@ bool Type::is_handle() const { return IsAnyOf(); } +uint32_t Type::ConversionRank(const Type* from, const Type* to) { + if (from->UnwrapRef() == to) { + return 0; + } + return Switch( + from, + [&](const AbstractFloat*) { + return Switch( + to, // + [&](const F32*) { return 1; }, // + [&](const F16*) { return 2; }, // + [&](Default) { return kNoConversion; }); + }, + [&](const AbstractInt*) { + return Switch( + to, // + [&](const I32*) { return 3; }, // + [&](const U32*) { return 4; }, // + [&](const AbstractFloat*) { return 5; }, // + [&](const F32*) { return 6; }, // + [&](const F16*) { return 7; }, // + [&](Default) { return kNoConversion; }); + }, + [&](const Vector* from_vec) { + if (auto* to_vec = to->As()) { + if (from_vec->Width() == to_vec->Width()) { + return ConversionRank(from_vec->type(), to_vec->type()); + } + } + return kNoConversion; + }, + [&](const Matrix* from_mat) { + if (auto* to_mat = to->As()) { + if (from_mat->columns() == to_mat->columns() && + from_mat->rows() == to_mat->rows()) { + return ConversionRank(from_mat->type(), to_mat->type()); + } + } + return kNoConversion; + }, + [&](const Array* from_arr) { + if (auto* to_arr = to->As()) { + if (from_arr->Count() == to_arr->Count()) { + return ConversionRank(from_arr->ElemType(), to_arr->ElemType()); + } + } + return kNoConversion; + }, + [&](Default) { return kNoConversion; }); +} + +const Type* Type::ElementOf(const Type* ty, uint32_t* count /* = nullptr */) { + if (ty->is_scalar()) { + if (count) { + *count = 1; + } + return ty; + } + return Switch( + ty, // + [&](const Vector* v) { + if (count) { + *count = v->Width(); + } + return v->type(); + }, + [&](const Matrix* m) { + if (count) { + *count = m->columns(); + } + return m->ColumnType(); + }, + [&](const Array* a) { + if (count) { + *count = a->Count(); + } + return a->ElemType(); + }, + [&](Default) { + if (count) { + *count = 0; + } + return nullptr; + }); +} + +const Type* Type::DeepestElementOf(const Type* ty, uint32_t* count /* = nullptr */) { + auto el_ty = ElementOf(ty, count); + while (el_ty && ty != el_ty) { + ty = el_ty; + + uint32_t n = 0; + el_ty = ElementOf(ty, &n); + if (count) { + *count *= n; + } + } + return el_ty; +} + +const sem::Type* Type::Common(utils::VectorRef types) { + const auto count = types.Length(); + if (count == 0) { + return nullptr; + } + const auto* common = types[0]; + for (size_t i = 1; i < count; i++) { + auto* ty = types[i]; + if (ty == common) { + continue; // ty == common + } + if (sem::Type::ConversionRank(ty, common) != sem::Type::kNoConversion) { + continue; // ty can be converted to common. + } + if (sem::Type::ConversionRank(common, ty) != sem::Type::kNoConversion) { + common = ty; // common can be converted to ty. + continue; + } + return nullptr; // Conversion is not valid. + } + return common; +} + } // namespace tint::sem diff --git a/src/tint/sem/type.h b/src/tint/sem/type.h index 271e1d7fca..8bac821ca4 100644 --- a/src/tint/sem/type.h +++ b/src/tint/sem/type.h @@ -19,6 +19,7 @@ #include #include "src/tint/sem/node.h" +#include "src/tint/utils/vector.h" // Forward declarations namespace tint { @@ -101,6 +102,14 @@ class Type : public Castable { bool is_signed_scalar_or_vector() const; /// @returns true if this type is an integer scalar or vector bool is_integer_scalar_or_vector() const; + /// @returns true if this type is an abstract integer vector + bool is_abstract_integer_vector() const; + /// @returns true if this type is an abstract float vector + bool is_abstract_float_vector() const; + /// @returns true if this type is an abstract integer scalar or vector + bool is_abstract_integer_scalar_or_vector() const; + /// @returns true if this type is an abstract float scalar or vector + bool is_abstract_float_scalar_or_vector() const; /// @returns true if this type is a boolean vector bool is_bool_vector() const; /// @returns true if this type is boolean scalar or vector @@ -114,6 +123,46 @@ class Type : public Castable { /// @returns true if this type is a handle type bool is_handle() const; + /// kNoConversion is returned from ConversionRank() when the implicit conversion is not + /// permitted. + static constexpr uint32_t kNoConversion = 0xffffffffu; + + /// ConversionRank returns the implicit conversion rank when attempting to convert `from` to + /// `to`. Lower ranks are preferred over higher ranks. + /// @param from the source type + /// @param to the destination type + /// @returns the rank value for converting from type `from` to type `to`, or #kNoConversion if + /// the implicit conversion is not allowed. + /// @see https://www.w3.org/TR/WGSL/#conversion-rank + static uint32_t ConversionRank(const Type* from, const Type* to); + + /// @param ty the type to obtain the element type from + /// @param count if not null, then this is assigned the number of child elements in the type. + /// For example, the count of an `array, 5>` type would be 5. + /// @returns + /// * `ty` if `ty` is an abstract or scalar + /// * the element type if `ty` is a vector or array + /// * the column type if `ty` is a matrix + /// * `nullptr` if `ty` is none of the above + static const Type* ElementOf(const Type* ty, uint32_t* count = nullptr); + + /// @param ty the type to obtain the deepest element type from + /// @param count if not null, then this is assigned the full number of most deeply nested + /// elements in the type. For example, the count of an `array, 5>` type would be 15. + /// @returns + /// * `ty` if `ty` is an abstract or scalar + /// * the element type if `ty` is a vector + /// * the matrix element type if `ty` is a matrix + /// * the deepest element type if `ty` is an array + /// * `nullptr` if `ty` is none of the above + static const Type* DeepestElementOf(const Type* ty, uint32_t* count = nullptr); + + /// @param types the list of types + /// @returns the lowest-ranking type that all types in `types` can be implicitly converted to, + /// or nullptr if there is no consistent common type across all types in `types`. + /// @see https://www.w3.org/TR/WGSL/#conversion-rank + static const sem::Type* Common(utils::VectorRef types); + protected: Type(); }; diff --git a/src/tint/sem/type_constructor.cc b/src/tint/sem/type_constructor.cc index 34f6e2a71f..2acf74ff0f 100644 --- a/src/tint/sem/type_constructor.cc +++ b/src/tint/sem/type_constructor.cc @@ -14,12 +14,16 @@ #include "src/tint/sem/type_constructor.h" +#include + TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeConstructor); namespace tint::sem { -TypeConstructor::TypeConstructor(const sem::Type* type, const ParameterList& parameters) - : Base(type, parameters) {} +TypeConstructor::TypeConstructor(const sem::Type* type, + utils::VectorRef parameters, + EvaluationStage stage) + : Base(type, std::move(parameters), stage) {} TypeConstructor::~TypeConstructor() = default; diff --git a/src/tint/sem/type_constructor.h b/src/tint/sem/type_constructor.h index f3d4221550..1995db893c 100644 --- a/src/tint/sem/type_constructor.h +++ b/src/tint/sem/type_constructor.h @@ -16,6 +16,7 @@ #define SRC_TINT_SEM_TYPE_CONSTRUCTOR_H_ #include "src/tint/sem/call_target.h" +#include "src/tint/utils/vector.h" namespace tint::sem { @@ -25,7 +26,10 @@ class TypeConstructor final : public Castable { /// Constructor /// @param type the type that's being constructed /// @param parameters the type constructor parameters - TypeConstructor(const sem::Type* type, const ParameterList& parameters); + /// @param stage the earliest evaluation stage for the expression + TypeConstructor(const sem::Type* type, + utils::VectorRef parameters, + EvaluationStage stage); /// Destructor ~TypeConstructor() override; diff --git a/src/tint/sem/type_conversion.cc b/src/tint/sem/type_conversion.cc index 5da2928582..42fa2e05b6 100644 --- a/src/tint/sem/type_conversion.cc +++ b/src/tint/sem/type_conversion.cc @@ -18,8 +18,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeConversion); namespace tint::sem { -TypeConversion::TypeConversion(const sem::Type* type, const sem::Parameter* parameter) - : Base(type, ParameterList{parameter}) {} +TypeConversion::TypeConversion(const sem::Type* type, + const sem::Parameter* parameter, + EvaluationStage stage) + : Base(type, utils::Vector{parameter}, stage) {} TypeConversion::~TypeConversion() = default; diff --git a/src/tint/sem/type_conversion.h b/src/tint/sem/type_conversion.h index e40056508e..5584b36fe3 100644 --- a/src/tint/sem/type_conversion.h +++ b/src/tint/sem/type_conversion.h @@ -25,7 +25,8 @@ class TypeConversion final : public Castable { /// Constructor /// @param type the target type of the cast /// @param parameter the type cast parameter - TypeConversion(const sem::Type* type, const sem::Parameter* parameter); + /// @param stage the earliest evaluation stage for the expression + TypeConversion(const sem::Type* type, const sem::Parameter* parameter, EvaluationStage stage); /// Destructor ~TypeConversion() override; diff --git a/src/tint/sem/type_mappings.h b/src/tint/sem/type_mappings.h index 8425f149f7..07d32b31df 100644 --- a/src/tint/sem/type_mappings.h +++ b/src/tint/sem/type_mappings.h @@ -20,34 +20,36 @@ // Forward declarations namespace tint::ast { class Array; -class CallExpression; class Expression; class ForLoopStatement; class Function; class IfStatement; -class MemberAccessorExpression; class Node; +class Override; class Statement; class Struct; class StructMember; +class SwitchStatement; class Type; class TypeDecl; class Variable; +class WhileStatement; } // namespace tint::ast namespace tint::sem { class Array; -class Call; class Expression; class ForLoopStatement; class Function; class IfStatement; -class MemberAccessorExpression; class Node; +class GlobalVariable; class Statement; class Struct; class StructMember; +class SwitchStatement; class Type; class Variable; +class WhileStatement; } // namespace tint::sem namespace tint::sem { @@ -59,19 +61,20 @@ namespace tint::sem { struct TypeMappings { //! @cond Doxygen_Suppress Array* operator()(ast::Array*); - Call* operator()(ast::CallExpression*); Expression* operator()(ast::Expression*); ForLoopStatement* operator()(ast::ForLoopStatement*); Function* operator()(ast::Function*); IfStatement* operator()(ast::IfStatement*); - MemberAccessorExpression* operator()(ast::MemberAccessorExpression*); Node* operator()(ast::Node*); + GlobalVariable* operator()(ast::Override*); Statement* operator()(ast::Statement*); Struct* operator()(ast::Struct*); StructMember* operator()(ast::StructMember*); + SwitchStatement* operator()(ast::SwitchStatement*); Type* operator()(ast::Type*); Type* operator()(ast::TypeDecl*); Variable* operator()(ast::Variable*); + WhileStatement* operator()(ast::WhileStatement*); //! @endcond }; diff --git a/src/tint/sem/type_test.cc b/src/tint/sem/type_test.cc new file mode 100644 index 0000000000..837579ef84 --- /dev/null +++ b/src/tint/sem/type_test.cc @@ -0,0 +1,528 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/sem/abstract_float.h" +#include "src/tint/sem/abstract_int.h" +#include "src/tint/sem/f16.h" +#include "src/tint/sem/reference.h" +#include "src/tint/sem/test_helper.h" + +namespace tint::sem { +namespace { + +struct TypeTest : public TestHelper { + const sem::AbstractFloat* af = create(); + const sem::AbstractInt* ai = create(); + const sem::F32* f32 = create(); + const sem::F16* f16 = create(); + const sem::I32* i32 = create(); + const sem::U32* u32 = create(); + const sem::Vector* vec2_f32 = create(f32, 2u); + const sem::Vector* vec3_f32 = create(f32, 3u); + const sem::Vector* vec3_f16 = create(f16, 3u); + const sem::Vector* vec4_f32 = create(f32, 4u); + const sem::Vector* vec3_u32 = create(u32, 3u); + const sem::Vector* vec3_i32 = create(i32, 3u); + const sem::Vector* vec3_af = create(af, 3u); + const sem::Vector* vec3_ai = create(ai, 3u); + const sem::Matrix* mat2x4_f32 = create(vec4_f32, 2u); + const sem::Matrix* mat3x4_f32 = create(vec4_f32, 3u); + const sem::Matrix* mat4x2_f32 = create(vec2_f32, 4u); + const sem::Matrix* mat4x3_f32 = create(vec3_f32, 4u); + const sem::Matrix* mat4x3_f16 = create(vec3_f16, 4u); + const sem::Matrix* mat4x3_af = create(vec3_af, 4u); + const sem::Reference* ref_u32 = + create(u32, ast::StorageClass::kPrivate, ast::Access::kReadWrite); + const sem::Struct* str = create(nullptr, + Sym("s"), + StructMemberList{ + create( + /* declaration */ nullptr, + /* name */ Sym("x"), + /* type */ f16, + /* index */ 0u, + /* offset */ 0u, + /* align */ 4u, + /* size */ 4u), + }, + /* align*/ 4u, + /* size*/ 4u, + /* size_no_padding*/ 4u); + const sem::Array* arr_i32 = create( + /* element */ i32, + /* count */ 5u, + /* align */ 4u, + /* size */ 5u * 4u, + /* stride */ 5u * 4u, + /* implicit_stride */ 5u * 4u); + const sem::Array* arr_ai = create( + /* element */ ai, + /* count */ 5u, + /* align */ 4u, + /* size */ 5u * 4u, + /* stride */ 5u * 4u, + /* implicit_stride */ 5u * 4u); + const sem::Array* arr_vec3_i32 = create( + /* element */ vec3_i32, + /* count */ 5u, + /* align */ 16u, + /* size */ 5u * 16u, + /* stride */ 5u * 16u, + /* implicit_stride */ 5u * 16u); + const sem::Array* arr_vec3_ai = create( + /* element */ vec3_ai, + /* count */ 5u, + /* align */ 16u, + /* size */ 5u * 16u, + /* stride */ 5u * 16u, + /* implicit_stride */ 5u * 16u); + const sem::Array* arr_mat4x3_f16 = create( + /* element */ mat4x3_f16, + /* count */ 5u, + /* align */ 32u, + /* size */ 5u * 32u, + /* stride */ 5u * 32u, + /* implicit_stride */ 5u * 32u); + const sem::Array* arr_mat4x3_f32 = create( + /* element */ mat4x3_f32, + /* count */ 5u, + /* align */ 64u, + /* size */ 5u * 64u, + /* stride */ 5u * 64u, + /* implicit_stride */ 5u * 64u); + const sem::Array* arr_mat4x3_af = create( + /* element */ mat4x3_af, + /* count */ 5u, + /* align */ 64u, + /* size */ 5u * 64u, + /* stride */ 5u * 64u, + /* implicit_stride */ 5u * 64u); + const sem::Array* arr_str = create( + /* element */ str, + /* count */ 5u, + /* align */ 4u, + /* size */ 5u * 4u, + /* stride */ 5u * 4u, + /* implicit_stride */ 5u * 4u); +}; + +TEST_F(TypeTest, ConversionRank) { + EXPECT_EQ(Type::ConversionRank(i32, i32), 0u); + EXPECT_EQ(Type::ConversionRank(f32, f32), 0u); + EXPECT_EQ(Type::ConversionRank(u32, u32), 0u); + EXPECT_EQ(Type::ConversionRank(vec3_f32, vec3_f32), 0u); + EXPECT_EQ(Type::ConversionRank(vec3_f16, vec3_f16), 0u); + EXPECT_EQ(Type::ConversionRank(vec4_f32, vec4_f32), 0u); + EXPECT_EQ(Type::ConversionRank(vec3_u32, vec3_u32), 0u); + EXPECT_EQ(Type::ConversionRank(vec3_i32, vec3_i32), 0u); + EXPECT_EQ(Type::ConversionRank(vec3_af, vec3_af), 0u); + EXPECT_EQ(Type::ConversionRank(vec3_ai, vec3_ai), 0u); + EXPECT_EQ(Type::ConversionRank(mat3x4_f32, mat3x4_f32), 0u); + EXPECT_EQ(Type::ConversionRank(mat4x3_f32, mat4x3_f32), 0u); + EXPECT_EQ(Type::ConversionRank(mat4x3_f16, mat4x3_f16), 0u); + EXPECT_EQ(Type::ConversionRank(arr_vec3_ai, arr_vec3_ai), 0u); + EXPECT_EQ(Type::ConversionRank(arr_mat4x3_f16, arr_mat4x3_f16), 0u); + EXPECT_EQ(Type::ConversionRank(mat4x3_af, mat4x3_af), 0u); + EXPECT_EQ(Type::ConversionRank(arr_mat4x3_af, arr_mat4x3_af), 0u); + EXPECT_EQ(Type::ConversionRank(ref_u32, u32), 0u); + + EXPECT_EQ(Type::ConversionRank(af, f32), 1u); + EXPECT_EQ(Type::ConversionRank(vec3_af, vec3_f32), 1u); + EXPECT_EQ(Type::ConversionRank(mat4x3_af, mat4x3_f32), 1u); + EXPECT_EQ(Type::ConversionRank(arr_mat4x3_af, arr_mat4x3_f32), 1u); + EXPECT_EQ(Type::ConversionRank(af, f16), 2u); + EXPECT_EQ(Type::ConversionRank(vec3_af, vec3_f16), 2u); + EXPECT_EQ(Type::ConversionRank(mat4x3_af, mat4x3_f16), 2u); + EXPECT_EQ(Type::ConversionRank(arr_mat4x3_af, arr_mat4x3_f16), 2u); + EXPECT_EQ(Type::ConversionRank(ai, i32), 3u); + EXPECT_EQ(Type::ConversionRank(vec3_ai, vec3_i32), 3u); + EXPECT_EQ(Type::ConversionRank(arr_ai, arr_i32), 3u); + EXPECT_EQ(Type::ConversionRank(arr_vec3_ai, arr_vec3_i32), 3u); + EXPECT_EQ(Type::ConversionRank(ai, u32), 4u); + EXPECT_EQ(Type::ConversionRank(vec3_ai, vec3_u32), 4u); + EXPECT_EQ(Type::ConversionRank(ai, af), 5u); + EXPECT_EQ(Type::ConversionRank(ai, f32), 6u); + EXPECT_EQ(Type::ConversionRank(ai, f16), 7u); + + EXPECT_EQ(Type::ConversionRank(i32, f32), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(f32, u32), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(u32, i32), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(vec3_u32, vec3_f32), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(vec3_f32, vec4_f32), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(mat3x4_f32, mat4x3_f32), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(mat4x3_f32, mat3x4_f32), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(mat4x3_f32, mat4x3_af), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(arr_vec3_i32, arr_vec3_ai), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(arr_mat4x3_f32, arr_mat4x3_af), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(arr_mat4x3_f16, arr_mat4x3_f32), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(f32, af), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(f16, af), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(vec3_f16, vec3_af), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(mat4x3_f16, mat4x3_af), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(i32, af), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(u32, af), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(af, ai), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(f32, ai), Type::kNoConversion); + EXPECT_EQ(Type::ConversionRank(f16, ai), Type::kNoConversion); +} + +TEST_F(TypeTest, ElementOf) { + // No count + EXPECT_TYPE(Type::ElementOf(f32), f32); + EXPECT_TYPE(Type::ElementOf(f16), f16); + EXPECT_TYPE(Type::ElementOf(i32), i32); + EXPECT_TYPE(Type::ElementOf(u32), u32); + EXPECT_TYPE(Type::ElementOf(vec2_f32), f32); + EXPECT_TYPE(Type::ElementOf(vec3_f16), f16); + EXPECT_TYPE(Type::ElementOf(vec4_f32), f32); + EXPECT_TYPE(Type::ElementOf(vec3_u32), u32); + EXPECT_TYPE(Type::ElementOf(vec3_i32), i32); + EXPECT_TYPE(Type::ElementOf(mat2x4_f32), vec4_f32); + EXPECT_TYPE(Type::ElementOf(mat4x2_f32), vec2_f32); + EXPECT_TYPE(Type::ElementOf(mat4x3_f16), vec3_f16); + EXPECT_TYPE(Type::ElementOf(str), nullptr); + EXPECT_TYPE(Type::ElementOf(arr_i32), i32); + EXPECT_TYPE(Type::ElementOf(arr_vec3_i32), vec3_i32); + EXPECT_TYPE(Type::ElementOf(arr_mat4x3_f16), mat4x3_f16); + EXPECT_TYPE(Type::ElementOf(arr_mat4x3_af), mat4x3_af); + EXPECT_TYPE(Type::ElementOf(arr_str), str); + + // With count + uint32_t count = 42; + EXPECT_TYPE(Type::ElementOf(f32, &count), f32); + EXPECT_EQ(count, 1u); + count = 42; + EXPECT_TYPE(Type::ElementOf(f16, &count), f16); + EXPECT_EQ(count, 1u); + count = 42; + EXPECT_TYPE(Type::ElementOf(i32, &count), i32); + EXPECT_EQ(count, 1u); + count = 42; + EXPECT_TYPE(Type::ElementOf(u32, &count), u32); + EXPECT_EQ(count, 1u); + count = 42; + EXPECT_TYPE(Type::ElementOf(vec2_f32, &count), f32); + EXPECT_EQ(count, 2u); + count = 42; + EXPECT_TYPE(Type::ElementOf(vec3_f16, &count), f16); + EXPECT_EQ(count, 3u); + count = 42; + EXPECT_TYPE(Type::ElementOf(vec4_f32, &count), f32); + EXPECT_EQ(count, 4u); + count = 42; + EXPECT_TYPE(Type::ElementOf(vec3_u32, &count), u32); + EXPECT_EQ(count, 3u); + count = 42; + EXPECT_TYPE(Type::ElementOf(vec3_i32, &count), i32); + EXPECT_EQ(count, 3u); + count = 42; + EXPECT_TYPE(Type::ElementOf(mat2x4_f32, &count), vec4_f32); + EXPECT_EQ(count, 2u); + count = 42; + EXPECT_TYPE(Type::ElementOf(mat4x2_f32, &count), vec2_f32); + EXPECT_EQ(count, 4u); + count = 42; + EXPECT_TYPE(Type::ElementOf(mat4x3_f16, &count), vec3_f16); + EXPECT_EQ(count, 4u); + count = 42; + EXPECT_TYPE(Type::ElementOf(str, &count), nullptr); + EXPECT_EQ(count, 0u); + count = 42; + EXPECT_TYPE(Type::ElementOf(arr_i32, &count), i32); + EXPECT_EQ(count, 5u); + count = 42; + EXPECT_TYPE(Type::ElementOf(arr_vec3_i32, &count), vec3_i32); + EXPECT_EQ(count, 5u); + count = 42; + EXPECT_TYPE(Type::ElementOf(arr_mat4x3_f16, &count), mat4x3_f16); + EXPECT_EQ(count, 5u); + count = 42; + EXPECT_TYPE(Type::ElementOf(arr_mat4x3_af, &count), mat4x3_af); + EXPECT_EQ(count, 5u); + count = 42; + EXPECT_TYPE(Type::ElementOf(arr_str, &count), str); + EXPECT_EQ(count, 5u); +} + +TEST_F(TypeTest, DeepestElementOf) { + // No count + EXPECT_TYPE(Type::DeepestElementOf(f32), f32); + EXPECT_TYPE(Type::DeepestElementOf(f16), f16); + EXPECT_TYPE(Type::DeepestElementOf(i32), i32); + EXPECT_TYPE(Type::DeepestElementOf(u32), u32); + EXPECT_TYPE(Type::DeepestElementOf(vec2_f32), f32); + EXPECT_TYPE(Type::DeepestElementOf(vec3_f16), f16); + EXPECT_TYPE(Type::DeepestElementOf(vec4_f32), f32); + EXPECT_TYPE(Type::DeepestElementOf(vec3_u32), u32); + EXPECT_TYPE(Type::DeepestElementOf(vec3_i32), i32); + EXPECT_TYPE(Type::DeepestElementOf(mat2x4_f32), f32); + EXPECT_TYPE(Type::DeepestElementOf(mat4x2_f32), f32); + EXPECT_TYPE(Type::DeepestElementOf(mat4x3_f16), f16); + EXPECT_TYPE(Type::DeepestElementOf(str), nullptr); + EXPECT_TYPE(Type::DeepestElementOf(arr_i32), i32); + EXPECT_TYPE(Type::DeepestElementOf(arr_vec3_i32), i32); + EXPECT_TYPE(Type::DeepestElementOf(arr_mat4x3_f16), f16); + EXPECT_TYPE(Type::DeepestElementOf(arr_mat4x3_af), af); + EXPECT_TYPE(Type::DeepestElementOf(arr_str), nullptr); + + // With count + uint32_t count = 42; + EXPECT_TYPE(Type::DeepestElementOf(f32, &count), f32); + EXPECT_EQ(count, 1u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(f16, &count), f16); + EXPECT_EQ(count, 1u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(i32, &count), i32); + EXPECT_EQ(count, 1u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(u32, &count), u32); + EXPECT_EQ(count, 1u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(vec2_f32, &count), f32); + EXPECT_EQ(count, 2u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(vec3_f16, &count), f16); + EXPECT_EQ(count, 3u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(vec4_f32, &count), f32); + EXPECT_EQ(count, 4u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(vec3_u32, &count), u32); + EXPECT_EQ(count, 3u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(vec3_i32, &count), i32); + EXPECT_EQ(count, 3u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(mat2x4_f32, &count), f32); + EXPECT_EQ(count, 8u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(mat4x2_f32, &count), f32); + EXPECT_EQ(count, 8u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(mat4x3_f16, &count), f16); + EXPECT_EQ(count, 12u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(str, &count), nullptr); + EXPECT_EQ(count, 0u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(arr_i32, &count), i32); + EXPECT_EQ(count, 5u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(arr_vec3_i32, &count), i32); + EXPECT_EQ(count, 15u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(arr_mat4x3_f16, &count), f16); + EXPECT_EQ(count, 60u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(arr_mat4x3_af, &count), af); + EXPECT_EQ(count, 60u); + count = 42; + EXPECT_TYPE(Type::DeepestElementOf(arr_str, &count), nullptr); + EXPECT_EQ(count, 0u); +} + +TEST_F(TypeTest, Common2) { + EXPECT_TYPE(Type::Common(utils::Vector{ai, ai}), ai); + EXPECT_TYPE(Type::Common(utils::Vector{af, af}), af); + EXPECT_TYPE(Type::Common(utils::Vector{f32, f32}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{f16, f16}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{i32, i32}), i32); + EXPECT_TYPE(Type::Common(utils::Vector{u32, u32}), u32); + + EXPECT_TYPE(Type::Common(utils::Vector{i32, u32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{u32, f32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{f32, f16}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{f16, i32}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{ai, af}), af); + EXPECT_TYPE(Type::Common(utils::Vector{ai, f32}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{ai, f16}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{ai, i32}), i32); + EXPECT_TYPE(Type::Common(utils::Vector{ai, u32}), u32); + + EXPECT_TYPE(Type::Common(utils::Vector{af, ai}), af); + EXPECT_TYPE(Type::Common(utils::Vector{f32, ai}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{f16, ai}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{i32, ai}), i32); + EXPECT_TYPE(Type::Common(utils::Vector{u32, ai}), u32); + + EXPECT_TYPE(Type::Common(utils::Vector{ai, af}), af); + EXPECT_TYPE(Type::Common(utils::Vector{f32, af}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{f16, af}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{i32, af}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{u32, af}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{af, ai}), af); + EXPECT_TYPE(Type::Common(utils::Vector{af, f32}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{af, f16}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{af, i32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{af, u32}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_ai}), vec3_ai); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_af}), vec3_af); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_f32}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_f16}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec4_f32}), vec4_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_u32}), vec3_u32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_i32}), vec3_i32); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_f32}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_f16}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec4_f32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_u32}), vec3_u32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_i32}), vec3_i32); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_ai}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_ai}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec3_ai}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_ai}), vec3_u32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_ai}), vec3_i32); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_f32}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_f16}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec4_f32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_u32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_i32}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_af}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_af}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec3_af}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_af}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_af}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_af}), mat4x3_af); + EXPECT_TYPE(Type::Common(utils::Vector{mat3x4_f32, mat3x4_f32}), mat3x4_f32); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f32, mat4x3_f32}), mat4x3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f16, mat4x3_f16}), mat4x3_f16); + + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat3x4_f32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_f32}), mat4x3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_f16}), mat4x3_f16); + + EXPECT_TYPE(Type::Common(utils::Vector{mat3x4_f32, mat4x3_af}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f32, mat4x3_af}), mat4x3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f16, mat4x3_af}), mat4x3_f16); + + EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_f32, arr_mat4x3_f16}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_f32, arr_mat4x3_af}), arr_mat4x3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_f16, arr_mat4x3_af}), arr_mat4x3_f16); +} + +TEST_F(TypeTest, Common3) { + EXPECT_TYPE(Type::Common(utils::Vector{ai, ai, ai}), ai); + EXPECT_TYPE(Type::Common(utils::Vector{af, af, af}), af); + EXPECT_TYPE(Type::Common(utils::Vector{f32, f32, f32}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{f16, f16, f16}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{i32, i32, i32}), i32); + EXPECT_TYPE(Type::Common(utils::Vector{u32, u32, u32}), u32); + + EXPECT_TYPE(Type::Common(utils::Vector{ai, af, ai}), af); + EXPECT_TYPE(Type::Common(utils::Vector{ai, f32, ai}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{ai, f16, ai}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{ai, i32, ai}), i32); + EXPECT_TYPE(Type::Common(utils::Vector{ai, u32, ai}), u32); + + EXPECT_TYPE(Type::Common(utils::Vector{af, ai, af}), af); + EXPECT_TYPE(Type::Common(utils::Vector{f32, ai, f32}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{f16, ai, f16}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{i32, ai, i32}), i32); + EXPECT_TYPE(Type::Common(utils::Vector{u32, ai, u32}), u32); + + EXPECT_TYPE(Type::Common(utils::Vector{ai, f32, ai}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{ai, f16, ai}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{ai, i32, ai}), i32); + EXPECT_TYPE(Type::Common(utils::Vector{ai, u32, ai}), u32); + + EXPECT_TYPE(Type::Common(utils::Vector{f32, ai, f32}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{f16, ai, f16}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{i32, ai, i32}), i32); + EXPECT_TYPE(Type::Common(utils::Vector{u32, ai, u32}), u32); + + EXPECT_TYPE(Type::Common(utils::Vector{af, f32, af}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{af, f16, af}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{af, i32, af}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{af, u32, af}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{f32, af, f32}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{f16, af, f16}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{i32, af, i32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{u32, af, u32}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{ai, af, f32}), f32); + EXPECT_TYPE(Type::Common(utils::Vector{ai, af, f16}), f16); + EXPECT_TYPE(Type::Common(utils::Vector{ai, af, i32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{ai, af, u32}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_ai, vec3_ai}), vec3_ai); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_af, vec3_af}), vec3_af); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_f32, vec3_f32}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_f16, vec3_f16}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec4_f32, vec4_f32}), vec4_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_u32, vec3_u32}), vec3_u32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_i32, vec3_i32}), vec3_i32); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_ai, vec3_f32}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_ai, vec3_f16}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec3_ai, vec4_f32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_ai, vec3_u32}), vec3_u32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_ai, vec3_i32}), vec3_i32); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_f32, vec3_ai}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_f16, vec3_ai}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec4_f32, vec3_ai}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_u32, vec3_ai}), vec3_u32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_i32, vec3_ai}), vec3_i32); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_af, vec3_f32}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_af, vec3_f16}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec3_af, vec4_f32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_af, vec3_u32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_af, vec3_i32}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_f32, vec3_af}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_f16, vec3_af}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec4_f32, vec3_af}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_u32, vec3_af}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_i32, vec3_af}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec3_f32}), vec3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec3_f16}), vec3_f16); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec4_f32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec3_u32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec3_i32}), nullptr); + + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_af, mat4x3_af}), mat4x3_af); + EXPECT_TYPE(Type::Common(utils::Vector{mat3x4_f32, mat3x4_f32, mat3x4_f32}), mat3x4_f32); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f32, mat4x3_f32, mat4x3_f32}), mat4x3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f16, mat4x3_f16, mat4x3_f16}), mat4x3_f16); + + EXPECT_TYPE(Type::Common(utils::Vector{mat3x4_f32, mat4x3_af, mat3x4_f32}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f32, mat4x3_af, mat4x3_f32}), mat4x3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f16, mat4x3_af, mat4x3_f16}), mat4x3_f16); + + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat3x4_f32, mat4x3_af}), nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_f32, mat4x3_af}), mat4x3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_f16, mat4x3_af}), mat4x3_f16); + + EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_f16, arr_mat4x3_f32, arr_mat4x3_f16}), + nullptr); + EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_af, arr_mat4x3_f32, arr_mat4x3_af}), + arr_mat4x3_f32); + EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_af, arr_mat4x3_f16, arr_mat4x3_af}), + arr_mat4x3_f16); +} + +} // namespace +} // namespace tint::sem diff --git a/src/tint/sem/variable.cc b/src/tint/sem/variable.cc index 0ada5aeeed..f2330538fd 100644 --- a/src/tint/sem/variable.cc +++ b/src/tint/sem/variable.cc @@ -17,7 +17,9 @@ #include #include "src/tint/ast/identifier_expression.h" +#include "src/tint/ast/parameter.h" #include "src/tint/ast/variable.h" +#include "src/tint/sem/pointer.h" TINT_INSTANTIATE_TYPEINFO(tint::sem::Variable); TINT_INSTANTIATE_TYPEINFO(tint::sem::GlobalVariable); @@ -26,14 +28,15 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Parameter); TINT_INSTANTIATE_TYPEINFO(tint::sem::VariableUser); namespace tint::sem { - Variable::Variable(const ast::Variable* declaration, const sem::Type* type, + EvaluationStage stage, ast::StorageClass storage_class, ast::Access access, - Constant constant_value) + const Constant* constant_value) : declaration_(declaration), type_(type), + stage_(stage), storage_class_(storage_class), access_(access), constant_value_(constant_value) {} @@ -42,33 +45,39 @@ Variable::~Variable() = default; LocalVariable::LocalVariable(const ast::Variable* declaration, const sem::Type* type, + EvaluationStage stage, ast::StorageClass storage_class, ast::Access access, const sem::Statement* statement, - Constant constant_value) - : Base(declaration, type, storage_class, access, std::move(constant_value)), + const Constant* constant_value) + : Base(declaration, type, stage, storage_class, access, constant_value), statement_(statement) {} LocalVariable::~LocalVariable() = default; GlobalVariable::GlobalVariable(const ast::Variable* declaration, const sem::Type* type, + EvaluationStage stage, ast::StorageClass storage_class, ast::Access access, - Constant constant_value, + const Constant* constant_value, sem::BindingPoint binding_point) - : Base(declaration, type, storage_class, access, std::move(constant_value)), + : Base(declaration, type, stage, storage_class, access, constant_value), binding_point_(binding_point) {} GlobalVariable::~GlobalVariable() = default; -Parameter::Parameter(const ast::Variable* declaration, +Parameter::Parameter(const ast::Parameter* declaration, uint32_t index, const sem::Type* type, ast::StorageClass storage_class, ast::Access access, - const ParameterUsage usage /* = ParameterUsage::kNone */) - : Base(declaration, type, storage_class, access, Constant{}), index_(index), usage_(usage) {} + const ParameterUsage usage /* = ParameterUsage::kNone */, + sem::BindingPoint binding_point /* = {} */) + : Base(declaration, type, EvaluationStage::kRuntime, storage_class, access, nullptr), + index_(index), + usage_(usage), + binding_point_(binding_point) {} Parameter::~Parameter() = default; @@ -77,6 +86,7 @@ VariableUser::VariableUser(const ast::IdentifierExpression* declaration, sem::Variable* variable) : Base(declaration, variable->Type(), + variable->Stage(), statement, variable->ConstantValue(), /* has_side_effects */ false), @@ -89,4 +99,6 @@ VariableUser::VariableUser(const ast::IdentifierExpression* declaration, } } +VariableUser::~VariableUser() = default; + } // namespace tint::sem diff --git a/src/tint/sem/variable.h b/src/tint/sem/variable.h index 7026ca7506..b511563cc4 100644 --- a/src/tint/sem/variable.h +++ b/src/tint/sem/variable.h @@ -18,6 +18,8 @@ #include #include +#include "tint/override_id.h" + #include "src/tint/ast/access.h" #include "src/tint/ast/storage_class.h" #include "src/tint/sem/binding_point.h" @@ -27,6 +29,7 @@ // Forward declarations namespace tint::ast { class IdentifierExpression; +class Parameter; class Variable; } // namespace tint::ast namespace tint::sem { @@ -44,14 +47,16 @@ class Variable : public Castable { /// Constructor /// @param declaration the AST declaration node /// @param type the variable type + /// @param stage the evaluation stage for an expression of this variable type /// @param storage_class the variable storage class /// @param access the variable access control type - /// @param constant_value the constant value for the variable. May be invalid + /// @param constant_value the constant value for the variable. May be null Variable(const ast::Variable* declaration, const sem::Type* type, + EvaluationStage stage, ast::StorageClass storage_class, ast::Access access, - Constant constant_value); + const Constant* constant_value); /// Destructor ~Variable() override; @@ -62,6 +67,9 @@ class Variable : public Castable { /// @returns the canonical type for the variable const sem::Type* Type() const { return type_; } + /// @returns the evaluation stage for an expression of this variable type + EvaluationStage Stage() const { return stage_; } + /// @returns the storage class for the variable ast::StorageClass StorageClass() const { return storage_class_; } @@ -69,7 +77,7 @@ class Variable : public Castable { ast::Access Access() const { return access_; } /// @return the constant value of this expression - const Constant& ConstantValue() const { return constant_value_; } + const Constant* ConstantValue() const { return constant_value_; } /// @returns the variable constructor expression, or nullptr if the variable /// does not have one. @@ -88,9 +96,10 @@ class Variable : public Castable { private: const ast::Variable* const declaration_; const sem::Type* const type_; + const EvaluationStage stage_; const ast::StorageClass storage_class_; const ast::Access access_; - const Constant constant_value_; + const Constant* constant_value_; const Expression* constructor_ = nullptr; std::vector users_; }; @@ -101,16 +110,18 @@ class LocalVariable final : public Castable { /// Constructor /// @param declaration the AST declaration node /// @param type the variable type + /// @param stage the evaluation stage for an expression of this variable type /// @param storage_class the variable storage class /// @param access the variable access control type /// @param statement the statement that declared this local variable - /// @param constant_value the constant value for the variable. May be invalid + /// @param constant_value the constant value for the variable. May be null LocalVariable(const ast::Variable* declaration, const sem::Type* type, + EvaluationStage stage, ast::StorageClass storage_class, ast::Access access, const sem::Statement* statement, - Constant constant_value); + const Constant* constant_value); /// Destructor ~LocalVariable() override; @@ -136,15 +147,17 @@ class GlobalVariable final : public Castable { /// Constructor /// @param declaration the AST declaration node /// @param type the variable type + /// @param stage the evaluation stage for an expression of this variable type /// @param storage_class the variable storage class /// @param access the variable access control type - /// @param constant_value the constant value for the variable. May be invalid + /// @param constant_value the constant value for the variable. May be null /// @param binding_point the optional resource binding point of the variable GlobalVariable(const ast::Variable* declaration, const sem::Type* type, + EvaluationStage stage, ast::StorageClass storage_class, ast::Access access, - Constant constant_value, + const Constant* constant_value, sem::BindingPoint binding_point = {}); /// Destructor @@ -154,25 +167,15 @@ class GlobalVariable final : public Castable { sem::BindingPoint BindingPoint() const { return binding_point_; } /// @param id the constant identifier to assign to this variable - void SetConstantId(uint16_t id) { - constant_id_ = id; - is_overridable_ = true; - } + void SetOverrideId(OverrideId id) { override_id_ = id; } /// @returns the pipeline constant ID associated with the variable - uint16_t ConstantId() const { return constant_id_; } - - /// @param is_overridable true if this is a pipeline overridable constant - void SetIsOverridable(bool is_overridable = true) { is_overridable_ = is_overridable; } - - /// @returns true if this is pipeline overridable constant - bool IsOverridable() const { return is_overridable_; } + tint::OverrideId OverrideId() const { return override_id_; } private: const sem::BindingPoint binding_point_; - bool is_overridable_ = false; - uint16_t constant_id_ = 0; + tint::OverrideId override_id_; }; /// Parameter is a function parameter @@ -185,12 +188,14 @@ class Parameter final : public Castable { /// @param storage_class the variable storage class /// @param access the variable access control type /// @param usage the semantic usage for the parameter - Parameter(const ast::Variable* declaration, + /// @param binding_point the optional resource binding point of the parameter + Parameter(const ast::Parameter* declaration, uint32_t index, const sem::Type* type, ast::StorageClass storage_class, ast::Access access, - const ParameterUsage usage = ParameterUsage::kNone); + const ParameterUsage usage = ParameterUsage::kNone, + sem::BindingPoint binding_point = {}); /// Destructor ~Parameter() override; @@ -214,16 +219,17 @@ class Parameter final : public Castable { /// @param shadows the Type, Function or Variable that this variable shadows void SetShadows(const sem::Node* shadows) { shadows_ = shadows; } + /// @returns the resource binding point for the parameter + sem::BindingPoint BindingPoint() const { return binding_point_; } + private: const uint32_t index_; const ParameterUsage usage_; CallTarget const* owner_ = nullptr; const sem::Node* shadows_ = nullptr; + const sem::BindingPoint binding_point_; }; -/// ParameterList is a list of Parameter -using ParameterList = std::vector; - /// VariableUser holds the semantic information for an identifier expression /// node that resolves to a variable. class VariableUser final : public Castable { @@ -235,6 +241,7 @@ class VariableUser final : public Castable { VariableUser(const ast::IdentifierExpression* declaration, Statement* statement, sem::Variable* variable); + ~VariableUser() override; /// @returns the variable that this expression refers to const sem::Variable* Variable() const { return variable_; } diff --git a/src/tint/sem/vector.cc b/src/tint/sem/vector.cc index 6b4e15d5b6..2df7cf0a33 100644 --- a/src/tint/sem/vector.cc +++ b/src/tint/sem/vector.cc @@ -52,33 +52,17 @@ bool Vector::IsConstructible() const { } uint32_t Vector::Size() const { - return SizeOf(width_); + return subtype_->Size() * width_; } uint32_t Vector::Align() const { - return AlignOf(width_); -} - -uint32_t Vector::SizeOf(uint32_t width) { - switch (width) { + switch (width_) { case 2: - return 8; + return subtype_->Size() * 2; case 3: - return 12; + return subtype_->Size() * 4; case 4: - return 16; - } - return 0; // Unreachable -} - -uint32_t Vector::AlignOf(uint32_t width) { - switch (width) { - case 2: - return 8; - case 3: - return 16; - case 4: - return 16; + return subtype_->Size() * 4; } return 0; // Unreachable } diff --git a/src/tint/sem/while_statement.cc b/src/tint/sem/while_statement.cc new file mode 100644 index 0000000000..495f83fefa --- /dev/null +++ b/src/tint/sem/while_statement.cc @@ -0,0 +1,34 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/sem/while_statement.h" + +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::sem::WhileStatement); + +namespace tint::sem { + +WhileStatement::WhileStatement(const ast::WhileStatement* declaration, + const CompoundStatement* parent, + const sem::Function* function) + : Base(declaration, parent, function) {} + +WhileStatement::~WhileStatement() = default; + +const ast::WhileStatement* WhileStatement::Declaration() const { + return static_cast(Base::Declaration()); +} + +} // namespace tint::sem diff --git a/src/tint/sem/while_statement.h b/src/tint/sem/while_statement.h new file mode 100644 index 0000000000..50f1831f1c --- /dev/null +++ b/src/tint/sem/while_statement.h @@ -0,0 +1,60 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0(the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_SEM_WHILE_STATEMENT_H_ +#define SRC_TINT_SEM_WHILE_STATEMENT_H_ + +#include "src/tint/sem/statement.h" + +// Forward declarations +namespace tint::ast { +class WhileStatement; +} // namespace tint::ast +namespace tint::sem { +class Expression; +} // namespace tint::sem + +namespace tint::sem { + +/// Holds semantic information about a while statement +class WhileStatement final : public Castable { + public: + /// Constructor + /// @param declaration the AST node for this while statement + /// @param parent the owning statement + /// @param function the owning function + WhileStatement(const ast::WhileStatement* declaration, + const CompoundStatement* parent, + const sem::Function* function); + + /// Destructor + ~WhileStatement() override; + + /// @returns the AST node + const ast::WhileStatement* Declaration() const; + + /// @returns the whilecondition expression + const Expression* Condition() const { return condition_; } + + /// Sets the while condition expression + /// @param condition the while condition expression + void SetCondition(const Expression* condition) { condition_ = condition; } + + private: + const Expression* condition_ = nullptr; +}; + +} // namespace tint::sem + +#endif // SRC_TINT_SEM_WHILE_STATEMENT_H_ diff --git a/src/tint/symbol.cc b/src/tint/symbol.cc index 09656975ee..9adc1aaa37 100644 --- a/src/tint/symbol.cc +++ b/src/tint/symbol.cc @@ -23,8 +23,8 @@ Symbol::Symbol() = default; Symbol::Symbol(uint32_t val, tint::ProgramID program_id) : val_(val), program_id_(program_id) {} #if TINT_SYMBOL_STORE_DEBUG_NAME -Symbol::Symbol(uint32_t val, tint::ProgramID program_id, std::string debug_name) - : val_(val), program_id_(program_id), debug_name_(std::move(debug_name)) {} +Symbol::Symbol(uint32_t val, tint::ProgramID pid, std::string debug_name) + : val_(val), program_id_(pid), debug_name_(std::move(debug_name)) {} #endif Symbol::Symbol(const Symbol& o) = default; diff --git a/src/tint/symbol.h b/src/tint/symbol.h index 1cbc6b2245..fc0a0df56c 100644 --- a/src/tint/symbol.h +++ b/src/tint/symbol.h @@ -41,9 +41,9 @@ class Symbol { #if TINT_SYMBOL_STORE_DEBUG_NAME /// Constructor /// @param val the symbol value - /// @param program_id the identifier of the program that owns this Symbol + /// @param pid the identifier of the program that owns this Symbol /// @param debug_name name of symbols used only for debugging - Symbol(uint32_t val, tint::ProgramID program_id, std::string debug_name); + Symbol(uint32_t val, tint::ProgramID pid, std::string debug_name); #endif /// Copy constructor /// @param o the symbol to copy diff --git a/src/tint/symbol_table.cc b/src/tint/symbol_table.cc index 0a7fa5c2fd..2b20fed9a0 100644 --- a/src/tint/symbol_table.cc +++ b/src/tint/symbol_table.cc @@ -34,8 +34,9 @@ Symbol SymbolTable::Register(const std::string& name) { TINT_ASSERT(Symbol, !name.empty()); auto it = name_to_symbol_.find(name); - if (it != name_to_symbol_.end()) + if (it != name_to_symbol_.end()) { return it->second; + } #if TINT_SYMBOL_STORE_DEBUG_NAME Symbol sym(next_symbol_, program_id_, name); diff --git a/src/tint/templates/enums.tmpl.inc b/src/tint/templates/enums.tmpl.inc new file mode 100644 index 0000000000..d05d76331d --- /dev/null +++ b/src/tint/templates/enums.tmpl.inc @@ -0,0 +1,160 @@ +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "EnumCase" -}} +{{- /* Prints the 'Enum::kEntry' name for the provided sem.EnumEntry */ -}} +{{- /* argument. */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{PascalCase $.Enum.Name}}::k{{PascalCase $.Name}} +{{- end -}} + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "DeclareEnum" -}} +{{- /* Declares the 'enum class' for the provided sem.Enum argument. */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $enum := PascalCase $.Name -}} +enum class {{$enum}} { + kInvalid, +{{- range $entry := $.Entries }} + k{{PascalCase $entry.Name}},{{if $entry.IsInternal}} // Tint-internal enum entry - not parsed{{end}} +{{- end }} +}; + +/// @param out the std::ostream to write to +/// @param value the {{$enum}} +/// @returns `out` so calls can be chained +std::ostream& operator<<(std::ostream& out, {{$enum}} value); + +/// Parse{{$enum}} parses a {{$enum}} from a string. +/// @param str the string to parse +/// @returns the parsed enum, or {{$enum}}::kInvalid if the string could not be parsed. +{{$enum}} Parse{{$enum}}(std::string_view str); + +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "ParseEnum" -}} +{{- /* Implements the 'ParseEnum' function for the provided sem.Enum */ -}} +{{- /* argument. */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $enum := PascalCase $.Name -}} +/// Parse{{$enum}} parses a {{$enum}} from a string. +/// @param str the string to parse +/// @returns the parsed enum, or {{$enum}}::kInvalid if the string could not be parsed. +{{$enum}} Parse{{$enum}}(std::string_view str) { +{{- range $entry := $.PublicEntries }} + if (str == "{{$entry.Name}}") { + return {{template "EnumCase" $entry}}; + } +{{- end }} + return {{$enum}}::kInvalid; +} +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "EnumOStream" -}} +{{- /* Implements the std::ostream 'operator<<()' function to print the */ -}} +{{- /* provided sem.Enum. */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $enum := PascalCase $.Name -}} +std::ostream& operator<<(std::ostream& out, {{$enum}} value) { + switch (value) { + case {{$enum}}::kInvalid: + return out << "invalid"; +{{- range $entry := $.Entries }} + case {{template "EnumCase" $entry}}: + return out << "{{$entry.Name}}"; +{{- end }} + } + return out << ""; +} +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "TestParsePrintEnum" -}} +{{- /* Implements unit tests for parsing and printing the provided */ -}} +{{- /* sem.Enum argument. */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $enum := PascalCase $.Name -}} +namespace parse_print_tests { + +struct Case { + const char* string; + {{$enum}} value; +}; + +inline std::ostream& operator<<(std::ostream& out, Case c) { + return out << "'" << std::string(c.string) << "'"; +} + +static constexpr Case kValidCases[] = { +{{- range $entry := $.PublicEntries }} + {"{{$entry.Name}}", {{template "EnumCase" $entry}}}, +{{- end }} +}; + +static constexpr Case kInvalidCases[] = { +{{- $exclude := $.NameSet -}} +{{- range $entry := $.PublicEntries }} + {"{{Scramble $entry.Name $exclude}}", {{$enum}}::kInvalid}, + {"{{Scramble $entry.Name $exclude}}", {{$enum}}::kInvalid}, + {"{{Scramble $entry.Name $exclude}}", {{$enum}}::kInvalid}, +{{- end }} +}; + +using {{$enum}}ParseTest = testing::TestWithParam; + +TEST_P({{$enum}}ParseTest, Parse) { + const char* string = GetParam().string; + {{$enum}} expect = GetParam().value; + EXPECT_EQ(expect, Parse{{$enum}}(string)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, {{$enum}}ParseTest, testing::ValuesIn(kValidCases)); +INSTANTIATE_TEST_SUITE_P(InvalidCases, {{$enum}}ParseTest, testing::ValuesIn(kInvalidCases)); + +using {{$enum}}PrintTest = testing::TestWithParam; + +TEST_P({{$enum}}PrintTest, Print) { + {{$enum}} value = GetParam().value; + const char* expect = GetParam().string; + EXPECT_EQ(expect, utils::ToString(value)); +} + +INSTANTIATE_TEST_SUITE_P(ValidCases, {{$enum}}PrintTest, testing::ValuesIn(kValidCases)); + +} // namespace parse_print_tests + +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "BenchmarkParseEnum" -}} +{{- /* Implements a micro-benchmark for parsing the provided sem.Enum */ -}} +{{- /* argument. */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $enum := PascalCase $.Name -}} +void {{$enum}}Parser(::benchmark::State& state) { + std::array kStrings{ +{{- $exclude := $.NameSet -}} +{{- range $entry := $.PublicEntries }} + "{{Scramble $entry.Name $exclude}}", + "{{Scramble $entry.Name $exclude}}", + "{{Scramble $entry.Name $exclude}}", + "{{$entry.Name}}", + "{{Scramble $entry.Name $exclude}}", + "{{Scramble $entry.Name $exclude}}", + "{{Scramble $entry.Name $exclude}}", +{{- end }} + }; + for (auto _ : state) { + for (auto& str : kStrings) { + auto result = Parse{{$enum}}(str); + benchmark::DoNotOptimize(result); + } + } +} + +BENCHMARK({{$enum}}Parser); +{{- end -}} diff --git a/src/tint/text/unicode.cc b/src/tint/text/unicode.cc index bf28c4e5bc..e23f3dd6b0 100644 --- a/src/tint/text/unicode.cc +++ b/src/tint/text/unicode.cc @@ -306,10 +306,26 @@ constexpr size_t kNumXIDContinueRanges = sizeof(kXIDContinueRanges) / sizeof(kXI } // namespace bool CodePoint::IsXIDStart() const { + // Short circuit ASCII. The binary search will find these last, but most + // of our current source is ASCII, so handle them quicker. + if ((value >= 'a' && value <= 'z') || (value >= 'A' && value <= 'Z')) { + return true; + } + // With [a-zA-Z] handled, nothing less then the next sequence start can be + // XIDStart, so filter them all out. This catches most of the common symbols + // that are used in ASCII. + if (value < 0x000aa) { + return false; + } return std::binary_search(kXIDStartRanges, kXIDStartRanges + kNumXIDStartRanges, *this); } bool CodePoint::IsXIDContinue() const { + // Short circuit ASCII. The binary search will find these last, but most + // of our current source is ASCII, so handle them quicker. + if ((value >= '0' && value <= '9') || value == '_') { + return true; + } return IsXIDStart() || std::binary_search(kXIDContinueRanges, kXIDContinueRanges + kNumXIDContinueRanges, *this); } diff --git a/src/tint/tint.natvis b/src/tint/tint.natvis index c1fd1f398e..45ecf932c2 100644 --- a/src/tint/tint.natvis +++ b/src/tint/tint.natvis @@ -16,6 +16,34 @@ --> + + {{ length={len}, capacity={cap} }} + + + + len + data + + + + + + + impl_.slice.cap > (int)$T2 + impl_.slice + + + + + + + can_move_ + slice_ + + + + {debug_name_,sb} @@ -63,7 +91,7 @@ - + {symbol} symbol @@ -101,11 +129,7 @@ {*variable}; - - {value} - - - + {value} diff --git a/src/tint/traits.h b/src/tint/traits.h index eb81b3f0db..d830d2c437 100644 --- a/src/tint/traits.h +++ b/src/tint/traits.h @@ -91,7 +91,7 @@ static constexpr bool IsTypeOrDerived = /// If `CONDITION` is true then EnableIf resolves to type T, otherwise an /// invalid type. -template +template using EnableIf = typename std::enable_if::type; /// If `T` is of type `BASE`, or derives from `BASE`, then EnableIfIsType diff --git a/src/tint/transform/add_empty_entry_point.cc b/src/tint/transform/add_empty_entry_point.cc index f037649e4a..5ef4fe85eb 100644 --- a/src/tint/transform/add_empty_entry_point.cc +++ b/src/tint/transform/add_empty_entry_point.cc @@ -39,7 +39,10 @@ bool AddEmptyEntryPoint::ShouldRun(const Program* program, const DataMap&) const void AddEmptyEntryPoint::Run(CloneContext& ctx, const DataMap&, DataMap&) const { ctx.dst->Func(ctx.dst->Symbols().New("unused_entry_point"), {}, ctx.dst->ty.void_(), {}, - {ctx.dst->Stage(ast::PipelineStage::kCompute), ctx.dst->WorkgroupSize(1_i)}); + utils::Vector{ + ctx.dst->Stage(ast::PipelineStage::kCompute), + ctx.dst->WorkgroupSize(1_i), + }); ctx.Clone(); } diff --git a/src/tint/transform/add_empty_entry_point_test.cc b/src/tint/transform/add_empty_entry_point_test.cc index 2f8a7ad1f6..44f9005552 100644 --- a/src/tint/transform/add_empty_entry_point_test.cc +++ b/src/tint/transform/add_empty_entry_point_test.cc @@ -31,7 +31,7 @@ TEST_F(AddEmptyEntryPointTest, ShouldRunEmptyModule) { TEST_F(AddEmptyEntryPointTest, ShouldRunExistingEntryPoint) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn existing() {} )"; @@ -42,7 +42,7 @@ TEST_F(AddEmptyEntryPointTest, EmptyModule) { auto* src = R"()"; auto* expect = R"( -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn unused_entry_point() { } )"; @@ -54,7 +54,7 @@ fn unused_entry_point() { TEST_F(AddEmptyEntryPointTest, ExistingEntryPoint) { auto* src = R"( -@stage(fragment) +@fragment fn main() { } )"; @@ -70,7 +70,7 @@ TEST_F(AddEmptyEntryPointTest, NameClash) { auto* src = R"(var unused_entry_point : f32;)"; auto* expect = R"( -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn unused_entry_point_1() { } diff --git a/src/tint/transform/add_spirv_block_attribute.cc b/src/tint/transform/add_spirv_block_attribute.cc index 38e0de66d5..25abdcecc3 100644 --- a/src/tint/transform/add_spirv_block_attribute.cc +++ b/src/tint/transform/add_spirv_block_attribute.cc @@ -14,13 +14,12 @@ #include "src/tint/transform/add_spirv_block_attribute.h" -#include -#include #include #include "src/tint/program_builder.h" #include "src/tint/sem/variable.h" -#include "src/tint/utils/map.h" +#include "src/tint/utils/hashmap.h" +#include "src/tint/utils/hashset.h" TINT_INSTANTIATE_TYPEINFO(tint::transform::AddSpirvBlockAttribute); TINT_INSTANTIATE_TYPEINFO(tint::transform::AddSpirvBlockAttribute::SpirvBlockAttribute); @@ -35,61 +34,69 @@ void AddSpirvBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) co auto& sem = ctx.src->Sem(); // Collect the set of structs that are nested in other types. - std::unordered_set nested_structs; - for (auto* node : ctx.src->ASTNodes().Objects()) { - if (auto* arr = sem.Get(node->As())) { - if (auto* nested_str = arr->ElemType()->As()) { - nested_structs.insert(nested_str); - } - } else if (auto* str = sem.Get(node->As())) { - for (auto* member : str->Members()) { - if (auto* nested_str = member->Type()->As()) { - nested_structs.insert(nested_str); + utils::Hashset nested_structs; + for (auto* ty : ctx.src->Types()) { + Switch( + ty, + [&](const sem::Array* arr) { + if (auto* nested_str = arr->ElemType()->As()) { + nested_structs.Add(nested_str); } - } - } + }, + [&](const sem::Struct* str) { + for (auto* member : str->Members()) { + if (auto* nested_str = member->Type()->As()) { + nested_structs.Add(nested_str); + } + } + }); } - // A map from a type in the source program to a block-decorated wrapper that - // contains it in the destination program. - std::unordered_map wrapper_structs; + // A map from a type in the source program to a block-decorated wrapper that contains it in the + // destination program. + utils::Hashmap wrapper_structs; - // Process global variables that are buffers. - for (auto* var : ctx.src->AST().GlobalVariables()) { - auto* sem_var = sem.Get(var); - if (var->declared_storage_class != ast::StorageClass::kStorage && - var->declared_storage_class != ast::StorageClass::kUniform) { + // Process global 'var' declarations that are buffers. + for (auto* global : ctx.src->AST().GlobalVariables()) { + auto* var = sem.Get(global); + if (!ast::IsHostShareable(var->StorageClass())) { + // Not declared in a host-sharable storage class continue; } - auto* ty = sem.Get(var->type); + auto* ty = var->Type()->UnwrapRef(); auto* str = ty->As(); - if (!str || nested_structs.count(str)) { + bool needs_wrapping = !str || // Type is not a structure + nested_structs.Contains(str); // Structure is nested by another type + + if (needs_wrapping) { const char* kMemberName = "inner"; // This is a non-struct or a struct that is nested somewhere else, so we // need to wrap it first. - auto* wrapper = utils::GetOrCreate(wrapper_structs, ty, [&]() { - auto* block = ctx.dst->ASTNodes().Create(ctx.dst->ID()); - auto wrapper_name = ctx.src->Symbols().NameFor(var->symbol) + "_block"; + auto* wrapper = wrapper_structs.GetOrCreate(ty, [&] { + auto* block = ctx.dst->ASTNodes().Create( + ctx.dst->ID(), ctx.dst->AllocateNodeID()); + auto wrapper_name = ctx.src->Symbols().NameFor(global->symbol) + "_block"; auto* ret = ctx.dst->create( ctx.dst->Symbols().New(wrapper_name), - ast::StructMemberList{ctx.dst->Member(kMemberName, CreateASTTypeFor(ctx, ty))}, - ast::AttributeList{block}); - ctx.InsertBefore(ctx.src->AST().GlobalDeclarations(), var, ret); + utils::Vector{ctx.dst->Member(kMemberName, CreateASTTypeFor(ctx, ty))}, + utils::Vector{block}); + ctx.InsertBefore(ctx.src->AST().GlobalDeclarations(), global, ret); return ret; }); - ctx.Replace(var->type, ctx.dst->ty.Of(wrapper)); + ctx.Replace(global->type, ctx.dst->ty.Of(wrapper)); // Insert a member accessor to get the original type from the wrapper at // any usage of the original variable. - for (auto* user : sem_var->Users()) { + for (auto* user : var->Users()) { ctx.Replace(user->Declaration(), - ctx.dst->MemberAccessor(ctx.Clone(var->symbol), kMemberName)); + ctx.dst->MemberAccessor(ctx.Clone(global->symbol), kMemberName)); } } else { // Add a block attribute to this struct directly. - auto* block = ctx.dst->ASTNodes().Create(ctx.dst->ID()); + auto* block = ctx.dst->ASTNodes().Create( + ctx.dst->ID(), ctx.dst->AllocateNodeID()); ctx.InsertFront(str->Declaration()->attributes, block); } } @@ -97,7 +104,8 @@ void AddSpirvBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) co ctx.Clone(); } -AddSpirvBlockAttribute::SpirvBlockAttribute::SpirvBlockAttribute(ProgramID pid) : Base(pid) {} +AddSpirvBlockAttribute::SpirvBlockAttribute::SpirvBlockAttribute(ProgramID pid, ast::NodeID nid) + : Base(pid, nid) {} AddSpirvBlockAttribute::SpirvBlockAttribute::~SpirvBlockAttribute() = default; std::string AddSpirvBlockAttribute::SpirvBlockAttribute::InternalName() const { return "spirv_block"; @@ -105,7 +113,8 @@ std::string AddSpirvBlockAttribute::SpirvBlockAttribute::InternalName() const { const AddSpirvBlockAttribute::SpirvBlockAttribute* AddSpirvBlockAttribute::SpirvBlockAttribute::Clone(CloneContext* ctx) const { - return ctx->dst->ASTNodes().Create(ctx->dst->ID()); + return ctx->dst->ASTNodes().Create( + ctx->dst->ID(), ctx->dst->AllocateNodeID()); } } // namespace tint::transform diff --git a/src/tint/transform/add_spirv_block_attribute.h b/src/tint/transform/add_spirv_block_attribute.h index 67faaa5ec1..51409c8a23 100644 --- a/src/tint/transform/add_spirv_block_attribute.h +++ b/src/tint/transform/add_spirv_block_attribute.h @@ -35,7 +35,8 @@ class AddSpirvBlockAttribute final : public Castable p : S; -@stage(fragment) +@fragment fn main() { p.f = 1.0; } @@ -60,7 +60,7 @@ struct S { f : f32, } -@stage(fragment) +@fragment fn main() -> S { return S(); } @@ -77,7 +77,7 @@ TEST_F(AddSpirvBlockAttributeTest, BasicScalar) { @group(0) @binding(0) var u : f32; -@stage(fragment) +@fragment fn main() { let f = u; } @@ -90,7 +90,7 @@ struct u_block { @group(0) @binding(0) var u : u_block; -@stage(fragment) +@fragment fn main() { let f = u.inner; } @@ -106,7 +106,7 @@ TEST_F(AddSpirvBlockAttributeTest, BasicArray) { @group(0) @binding(0) var u : array, 4u>; -@stage(fragment) +@fragment fn main() { let a = u; } @@ -119,7 +119,7 @@ struct u_block { @group(0) @binding(0) var u : u_block; -@stage(fragment) +@fragment fn main() { let a = u.inner; } @@ -137,7 +137,7 @@ type Numbers = array, 4u>; @group(0) @binding(0) var u : Numbers; -@stage(fragment) +@fragment fn main() { let a = u; } @@ -152,7 +152,7 @@ struct u_block { @group(0) @binding(0) var u : u_block; -@stage(fragment) +@fragment fn main() { let a = u.inner; } @@ -163,7 +163,7 @@ fn main() { EXPECT_EQ(expect, str(got)); } -TEST_F(AddSpirvBlockAttributeTest, BasicStruct) { +TEST_F(AddSpirvBlockAttributeTest, BasicStruct_AccessRoot) { auto* src = R"( struct S { f : f32, @@ -172,7 +172,40 @@ struct S { @group(0) @binding(0) var u : S; -@stage(fragment) +@fragment +fn main() { + let f = u; +} +)"; + auto* expect = R"( +@internal(spirv_block) +struct S { + f : f32, +} + +@group(0) @binding(0) var u : S; + +@fragment +fn main() { + let f = u; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(AddSpirvBlockAttributeTest, BasicStruct_AccessField) { + auto* src = R"( +struct S { + f : f32, +}; + +@group(0) @binding(0) +var u : S; + +@fragment fn main() { let f = u.f; } @@ -185,7 +218,72 @@ struct S { @group(0) @binding(0) var u : S; -@stage(fragment) +@fragment +fn main() { + let f = u.f; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(AddSpirvBlockAttributeTest, BasicScalar_PushConstant) { + auto* src = R"( +enable chromium_experimental_push_constant; +var u : f32; + +@fragment +fn main() { + let f = u; +} +)"; + auto* expect = R"( +enable chromium_experimental_push_constant; + +@internal(spirv_block) +struct u_block { + inner : f32, +} + +var u : u_block; + +@fragment +fn main() { + let f = u.inner; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(AddSpirvBlockAttributeTest, BasicStruct_PushConstant) { + auto* src = R"( +enable chromium_experimental_push_constant; +struct S { + f : f32, +}; +var u : S; + +@fragment +fn main() { + let f = u.f; +} +)"; + auto* expect = R"( +enable chromium_experimental_push_constant; + +@internal(spirv_block) +struct S { + f : f32, +} + +var u : S; + +@fragment fn main() { let f = u.f; } @@ -209,7 +307,7 @@ struct Outer { @group(0) @binding(0) var u : Outer; -@stage(fragment) +@fragment fn main() { let f = u.i.f; } @@ -226,7 +324,7 @@ struct Outer { @group(0) @binding(0) var u : Outer; -@stage(fragment) +@fragment fn main() { let f = u.i.f; } @@ -253,7 +351,7 @@ var u0 : Outer; @group(0) @binding(1) var u1 : Inner; -@stage(fragment) +@fragment fn main() { let f0 = u0.i.f; let f1 = u1.f; @@ -278,7 +376,7 @@ struct u1_block { @group(0) @binding(1) var u1 : u1_block; -@stage(fragment) +@fragment fn main() { let f0 = u0.i.f; let f1 = u1.inner.f; @@ -305,7 +403,7 @@ var p : Outer; @group(0) @binding(1) var u : Inner; -@stage(fragment) +@fragment fn main() { let f0 = p.i.f; let f1 = u.f; @@ -329,7 +427,7 @@ struct u_block { @group(0) @binding(1) var u : u_block; -@stage(fragment) +@fragment fn main() { let f0 = p.i.f; let f1 = u.inner.f; @@ -360,7 +458,7 @@ var u1 : Inner; @group(0) @binding(2) var u2 : Inner; -@stage(fragment) +@fragment fn main() { let f0 = u0.i.f; let f1 = u1.f; @@ -388,7 +486,7 @@ struct u1_block { @group(0) @binding(2) var u2 : u1_block; -@stage(fragment) +@fragment fn main() { let f0 = u0.i.f; let f1 = u1.inner.f; @@ -410,7 +508,7 @@ struct S { @group(0) @binding(0) var u : S; -@stage(fragment) +@fragment fn main() { let f = u.f; let a = array(); @@ -428,7 +526,7 @@ struct u_block { @group(0) @binding(0) var u : u_block; -@stage(fragment) +@fragment fn main() { let f = u.inner.f; let a = array(); @@ -452,7 +550,7 @@ var u0 : S; @group(0) @binding(1) var u1 : S; -@stage(fragment) +@fragment fn main() { let f0 = u0.f; let f1 = u1.f; @@ -473,7 +571,7 @@ struct u0_block { @group(0) @binding(1) var u1 : u0_block; -@stage(fragment) +@fragment fn main() { let f0 = u0.inner.f; let f1 = u1.inner.f; @@ -506,7 +604,7 @@ var u0 : MyOuter; @group(0) @binding(1) var u1 : MyInner; -@stage(fragment) +@fragment fn main() { let f0 = u0.i.f; let f1 = u1.f; @@ -535,7 +633,7 @@ struct u1_block { @group(0) @binding(1) var u1 : u1_block; -@stage(fragment) +@fragment fn main() { let f0 = u0.i.f; let f1 = u1.inner.f; @@ -549,7 +647,7 @@ fn main() { TEST_F(AddSpirvBlockAttributeTest, Aliases_Nested_OuterBuffer_InnerBuffer_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn main() { let f0 = u0.i.f; let f1 = u1.f; @@ -574,7 +672,7 @@ struct Inner { }; )"; auto* expect = R"( -@stage(fragment) +@fragment fn main() { let f0 = u0.i.f; let f1 = u1.inner.f; diff --git a/src/tint/transform/array_length_from_uniform.cc b/src/tint/transform/array_length_from_uniform.cc index dc19c5c6ae..36ddcdc962 100644 --- a/src/tint/transform/array_length_from_uniform.cc +++ b/src/tint/transform/array_length_from_uniform.cc @@ -52,7 +52,7 @@ static void IterateArrayLengthOnStorageVar(CloneContext& ctx, F&& functor) { continue; } - auto* call = sem.Get(call_expr); + auto* call = sem.Get(call_expr)->UnwrapMaterialize()->As(); auto* builtin = call->Target()->As(); if (!builtin || builtin->Type() != sem::BuiltinType::kArrayLength) { continue; @@ -141,13 +141,14 @@ void ArrayLengthFromUniform::Run(CloneContext& ctx, const DataMap& inputs, DataM // aligned. auto* buffer_size_struct = ctx.dst->Structure( ctx.dst->Sym(), - {ctx.dst->Member(kBufferSizeMemberName, - ctx.dst->ty.array(ctx.dst->ty.vec4(ctx.dst->ty.u32()), - u32((max_buffer_size_index / 4) + 1)))}); - buffer_size_ubo = ctx.dst->Global( + utils::Vector{ + ctx.dst->Member(kBufferSizeMemberName, + ctx.dst->ty.array(ctx.dst->ty.vec4(ctx.dst->ty.u32()), + u32((max_buffer_size_index / 4) + 1))), + }); + buffer_size_ubo = ctx.dst->GlobalVar( ctx.dst->Sym(), ctx.dst->ty.Of(buffer_size_struct), ast::StorageClass::kUniform, - ast::AttributeList{ - ctx.dst->GroupAndBinding(cfg->ubo_binding.group, cfg->ubo_binding.binding)}); + ctx.dst->Group(cfg->ubo_binding.group), ctx.dst->Binding(cfg->ubo_binding.binding)); } return buffer_size_ubo; }; diff --git a/src/tint/transform/array_length_from_uniform_test.cc b/src/tint/transform/array_length_from_uniform_test.cc index ee0d4b1bc1..109904ce26 100644 --- a/src/tint/transform/array_length_from_uniform_test.cc +++ b/src/tint/transform/array_length_from_uniform_test.cc @@ -40,7 +40,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { } )"; @@ -57,7 +57,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = arrayLength(&sb.arr); } @@ -75,7 +75,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = arrayLength(&sb.arr); } @@ -94,7 +94,7 @@ TEST_F(ArrayLengthFromUniformTest, Basic) { auto* src = R"( @group(0) @binding(0) var sb : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = arrayLength(&sb); } @@ -109,7 +109,7 @@ struct tint_symbol { @group(0) @binding(0) var sb : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = (tint_symbol_1.buffer_size[0u][0u] / 4u); } @@ -137,7 +137,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = arrayLength(&sb.arr); } @@ -157,7 +157,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); } @@ -197,7 +197,7 @@ struct SB4 { @group(3) @binding(2) var sb4 : SB4; @group(4) @binding(2) var sb5 : array>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len1 : u32 = arrayLength(&(sb1.arr1)); var len2 : u32 = arrayLength(&(sb2.arr2)); @@ -240,7 +240,7 @@ struct SB4 { @group(4) @binding(2) var sb5 : array>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); var len2 : u32 = ((tint_symbol_1.buffer_size[0u][1u] - 16u) / 16u); @@ -289,7 +289,7 @@ struct SB4 { @group(3) @binding(2) var sb4 : SB4; @group(4) @binding(2) var sb5 : array>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len1 : u32 = arrayLength(&(sb1.arr1)); var len3 : u32 = arrayLength(&sb3); @@ -329,7 +329,7 @@ struct SB4 { @group(4) @binding(2) var sb5 : array>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); var len3 : u32 = (tint_symbol_1.buffer_size[0u][2u] / 16u); @@ -363,7 +363,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = &(sb.arr); } @@ -397,7 +397,7 @@ struct SB2 { @group(1) @binding(2) var sb2 : SB2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len1 : u32 = arrayLength(&(sb1.arr1)); var len2 : u32 = arrayLength(&(sb2.arr2)); @@ -426,7 +426,7 @@ struct SB2 { @group(1) @binding(2) var sb2 : SB2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len1 : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); var len2 : u32 = arrayLength(&(sb2.arr2)); @@ -449,7 +449,7 @@ fn main() { TEST_F(ArrayLengthFromUniformTest, OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = arrayLength(&sb.arr); } @@ -469,7 +469,7 @@ struct tint_symbol { @group(0) @binding(30) var tint_symbol_1 : tint_symbol; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = ((tint_symbol_1.buffer_size[0u][0u] - 4u) / 4u); } diff --git a/src/tint/transform/binding_remapper.cc b/src/tint/transform/binding_remapper.cc index e3b7afdf89..eaf9725453 100644 --- a/src/tint/transform/binding_remapper.cc +++ b/src/tint/transform/binding_remapper.cc @@ -22,6 +22,7 @@ #include "src/tint/program_builder.h" #include "src/tint/sem/function.h" #include "src/tint/sem/variable.h" +#include "src/tint/utils/string.h" TINT_INSTANTIATE_TYPEINFO(tint::transform::BindingRemapper); TINT_INSTANTIATE_TYPEINFO(tint::transform::BindingRemapper::Remappings); @@ -67,9 +68,10 @@ void BindingRemapper::Run(CloneContext& ctx, const DataMap& inputs, DataMap&) co } auto* func = ctx.src->Sem().Get(func_ast); std::unordered_map binding_point_counts; - for (auto* var : func->TransitivelyReferencedGlobals()) { - if (auto binding_point = var->Declaration()->BindingPoint()) { - BindingPoint from{binding_point.group->value, binding_point.binding->value}; + for (auto* global : func->TransitivelyReferencedGlobals()) { + if (global->Declaration()->HasBindingPoint()) { + BindingPoint from = global->BindingPoint(); + auto bp_it = remappings->binding_points.find(from); if (bp_it != remappings->binding_points.end()) { // Remapped @@ -88,10 +90,12 @@ void BindingRemapper::Run(CloneContext& ctx, const DataMap& inputs, DataMap&) co } } - for (auto* var : ctx.src->AST().GlobalVariables()) { - if (auto binding_point = var->BindingPoint()) { + for (auto* var : ctx.src->AST().Globals()) { + if (var->HasBindingPoint()) { + auto* global_sem = ctx.src->Sem().Get(var); + // The original binding point - BindingPoint from{binding_point.group->value, binding_point.binding->value}; + BindingPoint from = global_sem->BindingPoint(); // The binding point after remapping BindingPoint bp = from; @@ -105,8 +109,11 @@ void BindingRemapper::Run(CloneContext& ctx, const DataMap& inputs, DataMap&) co auto* new_group = ctx.dst->create(to.group); auto* new_binding = ctx.dst->create(to.binding); - ctx.Replace(binding_point.group, new_group); - ctx.Replace(binding_point.binding, new_binding); + auto* old_group = ast::GetAttribute(var->attributes); + auto* old_binding = ast::GetAttribute(var->attributes); + + ctx.Replace(old_group, new_group); + ctx.Replace(old_binding, new_binding); bp = to; } @@ -125,15 +132,15 @@ void BindingRemapper::Run(CloneContext& ctx, const DataMap& inputs, DataMap&) co ctx.dst->Diagnostics().add_error( diag::System::Transform, "cannot apply access control to variable with storage class " + - std::string(ast::ToString(sem->StorageClass()))); + std::string(utils::ToString(sem->StorageClass()))); return; } auto* ty = sem->Type()->UnwrapRef(); const ast::Type* inner_ty = CreateASTTypeFor(ctx, ty); - auto* new_var = ctx.dst->create( - ctx.Clone(var->source), ctx.Clone(var->symbol), var->declared_storage_class, ac, - inner_ty, false, false, ctx.Clone(var->constructor), - ctx.Clone(var->attributes)); + auto* new_var = + ctx.dst->Var(ctx.Clone(var->source), ctx.Clone(var->symbol), inner_ty, + var->declared_storage_class, ac, ctx.Clone(var->constructor), + ctx.Clone(var->attributes)); ctx.Replace(var, new_var); } diff --git a/src/tint/transform/binding_remapper_test.cc b/src/tint/transform/binding_remapper_test.cc index 29a96c33a9..564a3a5b24 100644 --- a/src/tint/transform/binding_remapper_test.cc +++ b/src/tint/transform/binding_remapper_test.cc @@ -74,7 +74,7 @@ struct S { @group(3) @binding(2) var b : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } )"; @@ -99,7 +99,7 @@ struct S { @group(3) @binding(2) var b : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } )"; @@ -113,7 +113,7 @@ struct S { @group(3) @binding(2) var b : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } )"; @@ -137,13 +137,13 @@ struct S { a : f32, }; -@group(2) @binding(1) var a : S; +@group(2) @binding(1) var a : S; -@group(3) @binding(2) var b : S; +@group(3) @binding(2) var b : S; @group(4) @binding(3) var c : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } )"; @@ -153,13 +153,13 @@ struct S { a : f32, } -@group(2) @binding(1) var a : S; +@group(2) @binding(1) var a : S; -@group(3) @binding(2) var b : S; +@group(3) @binding(2) var b : S; @group(4) @binding(3) var c : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } )"; @@ -168,7 +168,7 @@ fn f() { data.Add( BindingRemapper::BindingPoints{}, BindingRemapper::AccessControls{ - {{2, 1}, ast::Access::kWrite}, // Modify access control + {{2, 1}, ast::Access::kReadWrite}, // Modify access control // Keep @group(3) @binding(2) as is {{4, 3}, ast::Access::kRead}, // Add access control }); @@ -187,7 +187,7 @@ struct S { @group(3) @binding(2) var b : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } )"; @@ -197,11 +197,11 @@ struct S { a : f32, } -@group(4) @binding(5) var a : S; +@group(4) @binding(5) var a : S; -@group(6) @binding(7) var b : S; +@group(6) @binding(7) var b : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } )"; @@ -213,8 +213,8 @@ fn f() { {{3, 2}, {6, 7}}, }, BindingRemapper::AccessControls{ - {{2, 1}, ast::Access::kWrite}, - {{3, 2}, ast::Access::kWrite}, + {{2, 1}, ast::Access::kReadWrite}, + {{3, 2}, ast::Access::kReadWrite}, }); auto got = Run(src, data); @@ -235,7 +235,7 @@ struct S { @group(5) @binding(4) var d : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let x : i32 = (((a.i + b.i) + c.i) + d.i); } @@ -254,7 +254,7 @@ struct S { @internal(disable_validation__binding_point_collision) @group(5) @binding(4) var d : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let x : i32 = (((a.i + b.i) + c.i) + d.i); } @@ -287,12 +287,12 @@ struct S { @group(5) @binding(4) var d : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f1() { let x : i32 = (a.i + c.i); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f2() { let x : i32 = (b.i + d.i); } @@ -311,12 +311,12 @@ struct S { @group(5) @binding(4) var d : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f1() { let x : i32 = (a.i + c.i); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f2() { let x : i32 = (b.i + d.i); } @@ -345,7 +345,7 @@ struct S { @group(3) @binding(2) var b : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } )"; diff --git a/src/tint/transform/builtin_polyfill.cc b/src/tint/transform/builtin_polyfill.cc index 9bde1cc779..03b39f7708 100644 --- a/src/tint/transform/builtin_polyfill.cc +++ b/src/tint/transform/builtin_polyfill.cc @@ -15,6 +15,7 @@ #include "src/tint/transform/builtin_polyfill.h" #include +#include #include "src/tint/program_builder.h" #include "src/tint/sem/builtin.h" @@ -44,6 +45,98 @@ struct BuiltinPolyfill::State { /// The source clone context const sem::Info& sem = ctx.src->Sem(); + /// Builds the polyfill function for the `acosh` builtin + /// @param ty the parameter and return type for the function + /// @return the polyfill function name + Symbol acosh(const sem::Type* ty) { + auto name = b.Symbols().New("tint_acosh"); + uint32_t width = WidthOf(ty); + + auto V = [&](AFloat value) -> const ast::Expression* { + const ast::Expression* expr = b.Expr(value); + if (width == 1) { + return expr; + } + return b.Construct(T(ty), expr); + }; + + utils::Vector body; + switch (polyfill.acosh) { + case Level::kFull: + // return log(x + sqrt(x*x - 1)); + body.Push(b.Return( + b.Call("log", b.Add("x", b.Call("sqrt", b.Sub(b.Mul("x", "x"), 1_a)))))); + break; + case Level::kRangeCheck: { + // return select(acosh(x), 0, x < 1); + body.Push(b.Return( + b.Call("select", b.Call("acosh", "x"), V(0.0_a), b.LessThan("x", V(1.0_a))))); + break; + } + default: + TINT_ICE(Transform, b.Diagnostics()) + << "unhandled polyfill level: " << static_cast(polyfill.acosh); + return {}; + } + + b.Func(name, utils::Vector{b.Param("x", T(ty))}, T(ty), body); + + return name; + } + + /// Builds the polyfill function for the `asinh` builtin + /// @param ty the parameter and return type for the function + /// @return the polyfill function name + Symbol asinh(const sem::Type* ty) { + auto name = b.Symbols().New("tint_sinh"); + + // return log(x + sqrt(x*x + 1)); + b.Func(name, utils::Vector{b.Param("x", T(ty))}, T(ty), + utils::Vector{ + b.Return(b.Call("log", b.Add("x", b.Call("sqrt", b.Add(b.Mul("x", "x"), 1_a))))), + }); + + return name; + } + + /// Builds the polyfill function for the `atanh` builtin + /// @param ty the parameter and return type for the function + /// @return the polyfill function name + Symbol atanh(const sem::Type* ty) { + auto name = b.Symbols().New("tint_atanh"); + uint32_t width = WidthOf(ty); + + auto V = [&](AFloat value) -> const ast::Expression* { + const ast::Expression* expr = b.Expr(value); + if (width == 1) { + return expr; + } + return b.Construct(T(ty), expr); + }; + + utils::Vector body; + switch (polyfill.atanh) { + case Level::kFull: + // return log((1+x) / (1-x)) * 0.5 + body.Push( + b.Return(b.Mul(b.Call("log", b.Div(b.Add(1_a, "x"), b.Sub(1_a, "x"))), 0.5_a))); + break; + case Level::kRangeCheck: + // return select(atanh(x), 0, x >= 1); + body.Push(b.Return(b.Call("select", b.Call("atanh", "x"), V(0.0_a), + b.GreaterThanEqual("x", V(1.0_a))))); + break; + default: + TINT_ICE(Transform, b.Diagnostics()) + << "unhandled polyfill level: " << static_cast(polyfill.acosh); + return {}; + } + + b.Func(name, utils::Vector{b.Param("x", T(ty))}, T(ty), body); + + return name; + } + /// Builds the polyfill function for the `countLeadingZeros` builtin /// @param ty the parameter and return type for the function /// @return the polyfill function name @@ -61,41 +154,44 @@ struct BuiltinPolyfill::State { auto V = [&](uint32_t value) -> const ast::Expression* { return ScalarOrVector(width, u32(value)); }; - b.Func( - name, {b.Param("v", T(ty))}, T(ty), - { - // var x = U(v); - b.Decl(b.Var("x", nullptr, b.Construct(U(), b.Expr("v")))), - // let b16 = select(0, 16, x <= 0x0000ffff); - b.Decl(b.Let("b16", nullptr, - b.Call("select", V(0), V(16), b.LessThanEqual("x", V(0x0000ffff))))), - // x = x << b16; - b.Assign("x", b.Shl("x", "b16")), - // let b8 = select(0, 8, x <= 0x00ffffff); - b.Decl(b.Let("b8", nullptr, - b.Call("select", V(0), V(8), b.LessThanEqual("x", V(0x00ffffff))))), - // x = x << b8; - b.Assign("x", b.Shl("x", "b8")), - // let b4 = select(0, 4, x <= 0x0fffffff); - b.Decl(b.Let("b4", nullptr, - b.Call("select", V(0), V(4), b.LessThanEqual("x", V(0x0fffffff))))), - // x = x << b4; - b.Assign("x", b.Shl("x", "b4")), - // let b2 = select(0, 2, x <= 0x3fffffff); - b.Decl(b.Let("b2", nullptr, - b.Call("select", V(0), V(2), b.LessThanEqual("x", V(0x3fffffff))))), - // x = x << b2; - b.Assign("x", b.Shl("x", "b2")), - // let b1 = select(0, 1, x <= 0x7fffffff); - b.Decl(b.Let("b1", nullptr, - b.Call("select", V(0), V(1), b.LessThanEqual("x", V(0x7fffffff))))), - // let is_zero = select(0, 1, x == 0); - b.Decl(b.Let("is_zero", nullptr, b.Call("select", V(0), V(1), b.Equal("x", V(0))))), - // return R((b16 | b8 | b4 | b2 | b1) + zero); - b.Return(b.Construct( - T(ty), - b.Add(b.Or(b.Or(b.Or(b.Or("b16", "b8"), "b4"), "b2"), "b1"), "is_zero"))), - }); + b.Func(name, + utils::Vector{ + b.Param("v", T(ty)), + }, + T(ty), + utils::Vector{ + // var x = U(v); + b.Decl(b.Var("x", b.Construct(U(), b.Expr("v")))), + // let b16 = select(0, 16, x <= 0x0000ffff); + b.Decl(b.Let( + "b16", b.Call("select", V(0), V(16), b.LessThanEqual("x", V(0x0000ffff))))), + // x = x << b16; + b.Assign("x", b.Shl("x", "b16")), + // let b8 = select(0, 8, x <= 0x00ffffff); + b.Decl(b.Let("b8", + b.Call("select", V(0), V(8), b.LessThanEqual("x", V(0x00ffffff))))), + // x = x << b8; + b.Assign("x", b.Shl("x", "b8")), + // let b4 = select(0, 4, x <= 0x0fffffff); + b.Decl(b.Let("b4", + b.Call("select", V(0), V(4), b.LessThanEqual("x", V(0x0fffffff))))), + // x = x << b4; + b.Assign("x", b.Shl("x", "b4")), + // let b2 = select(0, 2, x <= 0x3fffffff); + b.Decl(b.Let("b2", + b.Call("select", V(0), V(2), b.LessThanEqual("x", V(0x3fffffff))))), + // x = x << b2; + b.Assign("x", b.Shl("x", "b2")), + // let b1 = select(0, 1, x <= 0x7fffffff); + b.Decl(b.Let("b1", + b.Call("select", V(0), V(1), b.LessThanEqual("x", V(0x7fffffff))))), + // let is_zero = select(0, 1, x == 0); + b.Decl(b.Let("is_zero", b.Call("select", V(0), V(1), b.Equal("x", V(0))))), + // return R((b16 | b8 | b4 | b2 | b1) + zero); + b.Return(b.Construct( + T(ty), + b.Add(b.Or(b.Or(b.Or(b.Or("b16", "b8"), "b4"), "b2"), "b1"), "is_zero"))), + }); return name; } @@ -123,35 +219,34 @@ struct BuiltinPolyfill::State { return b.Construct(b.ty.vec(width), value); }; b.Func( - name, {b.Param("v", T(ty))}, T(ty), - { + name, + utils::Vector{ + b.Param("v", T(ty)), + }, + T(ty), + utils::Vector{ // var x = U(v); - b.Decl(b.Var("x", nullptr, b.Construct(U(), b.Expr("v")))), + b.Decl(b.Var("x", b.Construct(U(), b.Expr("v")))), // let b16 = select(16, 0, bool(x & 0x0000ffff)); - b.Decl(b.Let("b16", nullptr, - b.Call("select", V(16), V(0), B(b.And("x", V(0x0000ffff)))))), + b.Decl(b.Let("b16", b.Call("select", V(16), V(0), B(b.And("x", V(0x0000ffff)))))), // x = x >> b16; b.Assign("x", b.Shr("x", "b16")), // let b8 = select(8, 0, bool(x & 0x000000ff)); - b.Decl(b.Let("b8", nullptr, - b.Call("select", V(8), V(0), B(b.And("x", V(0x000000ff)))))), + b.Decl(b.Let("b8", b.Call("select", V(8), V(0), B(b.And("x", V(0x000000ff)))))), // x = x >> b8; b.Assign("x", b.Shr("x", "b8")), // let b4 = select(4, 0, bool(x & 0x0000000f)); - b.Decl(b.Let("b4", nullptr, - b.Call("select", V(4), V(0), B(b.And("x", V(0x0000000f)))))), + b.Decl(b.Let("b4", b.Call("select", V(4), V(0), B(b.And("x", V(0x0000000f)))))), // x = x >> b4; b.Assign("x", b.Shr("x", "b4")), // let b2 = select(2, 0, bool(x & 0x00000003)); - b.Decl(b.Let("b2", nullptr, - b.Call("select", V(2), V(0), B(b.And("x", V(0x00000003)))))), + b.Decl(b.Let("b2", b.Call("select", V(2), V(0), B(b.And("x", V(0x00000003)))))), // x = x >> b2; b.Assign("x", b.Shr("x", "b2")), // let b1 = select(1, 0, bool(x & 0x00000001)); - b.Decl(b.Let("b1", nullptr, - b.Call("select", V(1), V(0), B(b.And("x", V(0x00000001)))))), + b.Decl(b.Let("b1", b.Call("select", V(1), V(0), B(b.And("x", V(0x00000001)))))), // let is_zero = select(0, 1, x == 0); - b.Decl(b.Let("is_zero", nullptr, b.Call("select", V(0), V(1), b.Equal("x", V(0))))), + b.Decl(b.Let("is_zero", b.Call("select", V(0), V(1), b.Equal("x", V(0))))), // return R((b16 | b8 | b4 | b2 | b1) + zero); b.Return(b.Construct( T(ty), @@ -176,20 +271,20 @@ struct BuiltinPolyfill::State { return b.Construct(b.ty.vec(width), value); }; - ast::StatementList body = { - b.Decl(b.Let("s", nullptr, b.Call("min", "offset", u32(W)))), - b.Decl(b.Let("e", nullptr, b.Call("min", u32(W), b.Add("s", "count")))), + utils::Vector body{ + b.Decl(b.Let("s", b.Call("min", "offset", u32(W)))), + b.Decl(b.Let("e", b.Call("min", u32(W), b.Add("s", "count")))), }; switch (polyfill.extract_bits) { case Level::kFull: - body.emplace_back(b.Decl(b.Let("shl", nullptr, b.Sub(u32(W), "e")))); - body.emplace_back(b.Decl(b.Let("shr", nullptr, b.Add("shl", "s")))); - body.emplace_back( + body.Push(b.Decl(b.Let("shl", b.Sub(u32(W), "e")))); + body.Push(b.Decl(b.Let("shr", b.Add("shl", "s")))); + body.Push( b.Return(b.Shr(b.Shl("v", vecN_u32(b.Expr("shl"))), vecN_u32(b.Expr("shr"))))); break; case Level::kClampParameters: - body.emplace_back(b.Return(b.Call("extractBits", "v", "s", b.Sub("e", "s")))); + body.Push(b.Return(b.Call("extractBits", "v", "s", b.Sub("e", "s")))); break; default: TINT_ICE(Transform, b.Diagnostics()) @@ -198,12 +293,12 @@ struct BuiltinPolyfill::State { } b.Func(name, - { + utils::Vector{ b.Param("v", T(ty)), b.Param("offset", b.ty.u32()), b.Param("count", b.ty.u32()), }, - T(ty), body); + T(ty), std::move(body)); return name; } @@ -244,37 +339,35 @@ struct BuiltinPolyfill::State { } b.Func( - name, {b.Param("v", T(ty))}, T(ty), - { + name, + utils::Vector{ + b.Param("v", T(ty)), + }, + T(ty), + utils::Vector{ // var x = v; (unsigned) // var x = select(U(v), ~U(v), v < 0); (signed) - b.Decl(b.Var("x", nullptr, x)), + b.Decl(b.Var("x", x)), // let b16 = select(0, 16, bool(x & 0xffff0000)); - b.Decl(b.Let("b16", nullptr, - b.Call("select", V(0), V(16), B(b.And("x", V(0xffff0000)))))), + b.Decl(b.Let("b16", b.Call("select", V(0), V(16), B(b.And("x", V(0xffff0000)))))), // x = x >> b16; b.Assign("x", b.Shr("x", "b16")), // let b8 = select(0, 8, bool(x & 0x0000ff00)); - b.Decl(b.Let("b8", nullptr, - b.Call("select", V(0), V(8), B(b.And("x", V(0x0000ff00)))))), + b.Decl(b.Let("b8", b.Call("select", V(0), V(8), B(b.And("x", V(0x0000ff00)))))), // x = x >> b8; b.Assign("x", b.Shr("x", "b8")), // let b4 = select(0, 4, bool(x & 0x000000f0)); - b.Decl(b.Let("b4", nullptr, - b.Call("select", V(0), V(4), B(b.And("x", V(0x000000f0)))))), + b.Decl(b.Let("b4", b.Call("select", V(0), V(4), B(b.And("x", V(0x000000f0)))))), // x = x >> b4; b.Assign("x", b.Shr("x", "b4")), // let b2 = select(0, 2, bool(x & 0x0000000c)); - b.Decl(b.Let("b2", nullptr, - b.Call("select", V(0), V(2), B(b.And("x", V(0x0000000c)))))), + b.Decl(b.Let("b2", b.Call("select", V(0), V(2), B(b.And("x", V(0x0000000c)))))), // x = x >> b2; b.Assign("x", b.Shr("x", "b2")), // let b1 = select(0, 1, bool(x & 0x00000002)); - b.Decl(b.Let("b1", nullptr, - b.Call("select", V(0), V(1), B(b.And("x", V(0x00000002)))))), + b.Decl(b.Let("b1", b.Call("select", V(0), V(1), B(b.And("x", V(0x00000002)))))), // let is_zero = select(0, 0xffffffff, x == 0); - b.Decl(b.Let("is_zero", nullptr, - b.Call("select", V(0), V(0xffffffff), b.Equal("x", V(0))))), + b.Decl(b.Let("is_zero", b.Call("select", V(0), V(0xffffffff), b.Equal("x", V(0))))), // return R(b16 | b8 | b4 | b2 | b1 | zero); b.Return(b.Construct( T(ty), b.Or(b.Or(b.Or(b.Or(b.Or("b16", "b8"), "b4"), "b2"), "b1"), "is_zero"))), @@ -306,36 +399,34 @@ struct BuiltinPolyfill::State { return b.Construct(b.ty.vec(width), value); }; b.Func( - name, {b.Param("v", T(ty))}, T(ty), - { + name, + utils::Vector{ + b.Param("v", T(ty)), + }, + T(ty), + utils::Vector{ // var x = U(v); - b.Decl(b.Var("x", nullptr, b.Construct(U(), b.Expr("v")))), + b.Decl(b.Var("x", b.Construct(U(), b.Expr("v")))), // let b16 = select(16, 0, bool(x & 0x0000ffff)); - b.Decl(b.Let("b16", nullptr, - b.Call("select", V(16), V(0), B(b.And("x", V(0x0000ffff)))))), + b.Decl(b.Let("b16", b.Call("select", V(16), V(0), B(b.And("x", V(0x0000ffff)))))), // x = x >> b16; b.Assign("x", b.Shr("x", "b16")), // let b8 = select(8, 0, bool(x & 0x000000ff)); - b.Decl(b.Let("b8", nullptr, - b.Call("select", V(8), V(0), B(b.And("x", V(0x000000ff)))))), + b.Decl(b.Let("b8", b.Call("select", V(8), V(0), B(b.And("x", V(0x000000ff)))))), // x = x >> b8; b.Assign("x", b.Shr("x", "b8")), // let b4 = select(4, 0, bool(x & 0x0000000f)); - b.Decl(b.Let("b4", nullptr, - b.Call("select", V(4), V(0), B(b.And("x", V(0x0000000f)))))), + b.Decl(b.Let("b4", b.Call("select", V(4), V(0), B(b.And("x", V(0x0000000f)))))), // x = x >> b4; b.Assign("x", b.Shr("x", "b4")), // let b2 = select(2, 0, bool(x & 0x00000003)); - b.Decl(b.Let("b2", nullptr, - b.Call("select", V(2), V(0), B(b.And("x", V(0x00000003)))))), + b.Decl(b.Let("b2", b.Call("select", V(2), V(0), B(b.And("x", V(0x00000003)))))), // x = x >> b2; b.Assign("x", b.Shr("x", "b2")), // let b1 = select(1, 0, bool(x & 0x00000001)); - b.Decl(b.Let("b1", nullptr, - b.Call("select", V(1), V(0), B(b.And("x", V(0x00000001)))))), + b.Decl(b.Let("b1", b.Call("select", V(1), V(0), B(b.And("x", V(0x00000001)))))), // let is_zero = select(0, 0xffffffff, x == 0); - b.Decl(b.Let("is_zero", nullptr, - b.Call("select", V(0), V(0xffffffff), b.Equal("x", V(0))))), + b.Decl(b.Let("is_zero", b.Call("select", V(0), V(0xffffffff), b.Equal("x", V(0))))), // return R(b16 | b8 | b4 | b2 | b1 | is_zero); b.Return(b.Construct( T(ty), b.Or(b.Or(b.Or(b.Or(b.Or("b16", "b8"), "b4"), "b2"), "b1"), "is_zero"))), @@ -369,23 +460,22 @@ struct BuiltinPolyfill::State { return b.vec(b.ty.u32(), width, value); }; - ast::StatementList body = { - b.Decl(b.Let("s", nullptr, b.Call("min", "offset", u32(W)))), - b.Decl(b.Let("e", nullptr, b.Call("min", u32(W), b.Add("s", "count")))), + utils::Vector body = { + b.Decl(b.Let("s", b.Call("min", "offset", u32(W)))), + b.Decl(b.Let("e", b.Call("min", u32(W), b.Add("s", "count")))), }; switch (polyfill.insert_bits) { case Level::kFull: // let mask = ((1 << s) - 1) ^ ((1 << e) - 1) - body.emplace_back( - b.Decl(b.Let("mask", nullptr, - b.Xor(b.Sub(b.Shl(1_u, "s"), 1_u), b.Sub(b.Shl(1_u, "e"), 1_u))))); + body.Push(b.Decl(b.Let( + "mask", b.Xor(b.Sub(b.Shl(1_u, "s"), 1_u), b.Sub(b.Shl(1_u, "e"), 1_u))))); // return ((n << s) & mask) | (v & ~mask) - body.emplace_back(b.Return(b.Or(b.And(b.Shl("n", U("s")), V("mask")), - b.And("v", V(b.Complement("mask")))))); + body.Push(b.Return(b.Or(b.And(b.Shl("n", U("s")), V("mask")), + b.And("v", V(b.Complement("mask")))))); break; case Level::kClampParameters: - body.emplace_back(b.Return(b.Call("insertBits", "v", "n", "s", b.Sub("e", "s")))); + body.Push(b.Return(b.Call("insertBits", "v", "n", "s", b.Sub("e", "s")))); break; default: TINT_ICE(Transform, b.Diagnostics()) @@ -394,7 +484,7 @@ struct BuiltinPolyfill::State { } b.Func(name, - { + utils::Vector{ b.Param("v", T(ty)), b.Param("n", T(ty)), b.Param("offset", b.ty.u32()), @@ -440,6 +530,21 @@ bool BuiltinPolyfill::ShouldRun(const Program* program, const DataMap& data) con if (auto* call = sem.Get(node)) { if (auto* builtin = call->Target()->As()) { switch (builtin->Type()) { + case sem::BuiltinType::kAcosh: + if (builtins.acosh != Level::kNone) { + return true; + } + break; + case sem::BuiltinType::kAsinh: + if (builtins.asinh) { + return true; + } + break; + case sem::BuiltinType::kAtanh: + if (builtins.atanh != Level::kNone) { + return true; + } + break; case sem::BuiltinType::kCountLeadingZeros: if (builtins.count_leading_zeros) { return true; @@ -496,6 +601,24 @@ void BuiltinPolyfill::Run(CloneContext& ctx, const DataMap& data, DataMap&) cons if (auto* builtin = call->Target()->As()) { Symbol polyfill; switch (builtin->Type()) { + case sem::BuiltinType::kAcosh: + if (builtins.acosh != Level::kNone) { + polyfill = utils::GetOrCreate( + polyfills, builtin, [&] { return s.acosh(builtin->ReturnType()); }); + } + break; + case sem::BuiltinType::kAsinh: + if (builtins.asinh) { + polyfill = utils::GetOrCreate( + polyfills, builtin, [&] { return s.asinh(builtin->ReturnType()); }); + } + break; + case sem::BuiltinType::kAtanh: + if (builtins.atanh != Level::kNone) { + polyfill = utils::GetOrCreate( + polyfills, builtin, [&] { return s.atanh(builtin->ReturnType()); }); + } + break; case sem::BuiltinType::kCountLeadingZeros: if (builtins.count_leading_zeros) { polyfill = utils::GetOrCreate(polyfills, builtin, [&] { diff --git a/src/tint/transform/builtin_polyfill.h b/src/tint/transform/builtin_polyfill.h index 8453189fb5..8df4197131 100644 --- a/src/tint/transform/builtin_polyfill.h +++ b/src/tint/transform/builtin_polyfill.h @@ -33,12 +33,20 @@ class BuiltinPolyfill final : public Castable { kNone, /// Clamp the parameters to the inner implementation. kClampParameters, + /// Range check the input. + kRangeCheck, /// Polyfill the entire function kFull, }; /// Specifies the builtins that should be polyfilled by the transform. struct Builtins { + /// What level should `acosh` be polyfilled? + Level acosh = Level::kNone; + /// Should `asinh` be polyfilled? + bool asinh = false; + /// What level should `atanh` be polyfilled? + Level atanh = Level::kNone; /// Should `countLeadingZeros()` be polyfilled? bool count_leading_zeros = false; /// Should `countTrailingZeros()` be polyfilled? diff --git a/src/tint/transform/builtin_polyfill_test.cc b/src/tint/transform/builtin_polyfill_test.cc index bc3dda8cba..1292b65891 100644 --- a/src/tint/transform/builtin_polyfill_test.cc +++ b/src/tint/transform/builtin_polyfill_test.cc @@ -41,6 +41,292 @@ TEST_F(BuiltinPolyfillTest, EmptyModule) { EXPECT_EQ(expect, str(got)); } +//////////////////////////////////////////////////////////////////////////////// +// acosh +//////////////////////////////////////////////////////////////////////////////// +DataMap polyfillAcosh(Level level) { + BuiltinPolyfill::Builtins builtins; + builtins.acosh = level; + DataMap data; + data.Add(builtins); + return data; +} + +TEST_F(BuiltinPolyfillTest, ShouldRunAcosh) { + auto* src = R"( +fn f() { + acosh(1.0); +} +)"; + + EXPECT_FALSE(ShouldRun(src)); + EXPECT_FALSE(ShouldRun(src, polyfillAcosh(Level::kNone))); + EXPECT_TRUE(ShouldRun(src, polyfillAcosh(Level::kClampParameters))); + EXPECT_TRUE(ShouldRun(src, polyfillAcosh(Level::kFull))); +} + +TEST_F(BuiltinPolyfillTest, Acosh_Full_f32) { + auto* src = R"( +fn f() { + let r : f32 = acosh(1234); +} +)"; + + auto* expect = R"( +fn tint_acosh(x : f32) -> f32 { + return log((x + sqrt(((x * x) - 1)))); +} + +fn f() { + let r : f32 = tint_acosh(1234); +} +)"; + + auto got = Run(src, polyfillAcosh(Level::kFull)); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(BuiltinPolyfillTest, Acosh_Full_vec3_f32) { + auto* src = R"( +fn f() { + let r : vec3 = acosh(vec3(1234)); +} +)"; + + auto* expect = R"( +fn tint_acosh(x : vec3) -> vec3 { + return log((x + sqrt(((x * x) - 1)))); +} + +fn f() { + let r : vec3 = tint_acosh(vec3(1234)); +} +)"; + + auto got = Run(src, polyfillAcosh(Level::kFull)); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(BuiltinPolyfillTest, Acosh_Range_f32) { + auto* src = R"( +fn f() { + let r : f32 = acosh(1234); +} +)"; + + auto* expect = R"( +fn tint_acosh(x : f32) -> f32 { + return select(acosh(x), 0.0, (x < 1.0)); +} + +fn f() { + let r : f32 = tint_acosh(1234); +} +)"; + + auto got = Run(src, polyfillAcosh(Level::kRangeCheck)); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(BuiltinPolyfillTest, Acosh_Range_vec3_f32) { + auto* src = R"( +fn f() { + let r : vec3 = acosh(vec3(1234)); +} +)"; + + auto* expect = R"( +fn tint_acosh(x : vec3) -> vec3 { + return select(acosh(x), vec3(0.0), (x < vec3(1.0))); +} + +fn f() { + let r : vec3 = tint_acosh(vec3(1234)); +} +)"; + + auto got = Run(src, polyfillAcosh(Level::kRangeCheck)); + + EXPECT_EQ(expect, str(got)); +} + +//////////////////////////////////////////////////////////////////////////////// +// asinh +//////////////////////////////////////////////////////////////////////////////// +DataMap polyfillSinh() { + BuiltinPolyfill::Builtins builtins; + builtins.asinh = true; + DataMap data; + data.Add(builtins); + return data; +} + +TEST_F(BuiltinPolyfillTest, ShouldRunAsinh) { + auto* src = R"( +fn f() { + asinh(1.0); +} +)"; + + EXPECT_FALSE(ShouldRun(src)); + EXPECT_TRUE(ShouldRun(src, polyfillSinh())); +} + +TEST_F(BuiltinPolyfillTest, Asinh_f32) { + auto* src = R"( +fn f() { + let r : f32 = asinh(1234); +} +)"; + + auto* expect = R"( +fn tint_sinh(x : f32) -> f32 { + return log((x + sqrt(((x * x) + 1)))); +} + +fn f() { + let r : f32 = tint_sinh(1234); +} +)"; + + auto got = Run(src, polyfillSinh()); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(BuiltinPolyfillTest, Asinh_vec3_f32) { + auto* src = R"( +fn f() { + let r : vec3 = asinh(vec3(1234)); +} +)"; + + auto* expect = R"( +fn tint_sinh(x : vec3) -> vec3 { + return log((x + sqrt(((x * x) + 1)))); +} + +fn f() { + let r : vec3 = tint_sinh(vec3(1234)); +} +)"; + + auto got = Run(src, polyfillSinh()); + + EXPECT_EQ(expect, str(got)); +} + +//////////////////////////////////////////////////////////////////////////////// +// atanh +//////////////////////////////////////////////////////////////////////////////// +DataMap polyfillAtanh(Level level) { + BuiltinPolyfill::Builtins builtins; + builtins.atanh = level; + DataMap data; + data.Add(builtins); + return data; +} + +TEST_F(BuiltinPolyfillTest, ShouldRunAtanh) { + auto* src = R"( +fn f() { + atanh(1.0); +} +)"; + + EXPECT_FALSE(ShouldRun(src)); + EXPECT_FALSE(ShouldRun(src, polyfillAtanh(Level::kNone))); + EXPECT_TRUE(ShouldRun(src, polyfillAtanh(Level::kClampParameters))); + EXPECT_TRUE(ShouldRun(src, polyfillAtanh(Level::kFull))); +} + +TEST_F(BuiltinPolyfillTest, Atanh_Full_f32) { + auto* src = R"( +fn f() { + let r : f32 = atanh(1234); +} +)"; + + auto* expect = R"( +fn tint_atanh(x : f32) -> f32 { + return (log(((1 + x) / (1 - x))) * 0.5); +} + +fn f() { + let r : f32 = tint_atanh(1234); +} +)"; + + auto got = Run(src, polyfillAtanh(Level::kFull)); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(BuiltinPolyfillTest, Atanh_Full_vec3_f32) { + auto* src = R"( +fn f() { + let r : vec3 = atanh(vec3(1234)); +} +)"; + + auto* expect = R"( +fn tint_atanh(x : vec3) -> vec3 { + return (log(((1 + x) / (1 - x))) * 0.5); +} + +fn f() { + let r : vec3 = tint_atanh(vec3(1234)); +} +)"; + + auto got = Run(src, polyfillAtanh(Level::kFull)); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(BuiltinPolyfillTest, Atanh_Range_f32) { + auto* src = R"( +fn f() { + let r : f32 = atanh(1234); +} +)"; + + auto* expect = R"( +fn tint_atanh(x : f32) -> f32 { + return select(atanh(x), 0.0, (x >= 1.0)); +} + +fn f() { + let r : f32 = tint_atanh(1234); +} +)"; + + auto got = Run(src, polyfillAtanh(Level::kRangeCheck)); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(BuiltinPolyfillTest, Atanh_Range_vec3_f32) { + auto* src = R"( +fn f() { + let r : vec3 = atanh(vec3(1234)); +} +)"; + + auto* expect = R"( +fn f() { + let r : vec3 = atanh(vec3(1234)); +} +)"; + + auto got = Run(src, polyfillAcosh(Level::kRangeCheck)); + + EXPECT_EQ(expect, str(got)); +} + //////////////////////////////////////////////////////////////////////////////// // countLeadingZeros //////////////////////////////////////////////////////////////////////////////// diff --git a/src/tint/transform/calculate_array_length.cc b/src/tint/transform/calculate_array_length.cc index 42a212c8c1..8edcbf56a5 100644 --- a/src/tint/transform/calculate_array_length.cc +++ b/src/tint/transform/calculate_array_length.cc @@ -23,6 +23,7 @@ #include "src/tint/sem/block_statement.h" #include "src/tint/sem/call.h" #include "src/tint/sem/function.h" +#include "src/tint/sem/reference.h" #include "src/tint/sem/statement.h" #include "src/tint/sem/struct.h" #include "src/tint/sem/variable.h" @@ -56,7 +57,8 @@ struct ArrayUsage { } // namespace -CalculateArrayLength::BufferSizeIntrinsic::BufferSizeIntrinsic(ProgramID pid) : Base(pid) {} +CalculateArrayLength::BufferSizeIntrinsic::BufferSizeIntrinsic(ProgramID pid, ast::NodeID nid) + : Base(pid, nid) {} CalculateArrayLength::BufferSizeIntrinsic::~BufferSizeIntrinsic() = default; std::string CalculateArrayLength::BufferSizeIntrinsic::InternalName() const { return "intrinsic_buffer_size"; @@ -64,7 +66,8 @@ std::string CalculateArrayLength::BufferSizeIntrinsic::InternalName() const { const CalculateArrayLength::BufferSizeIntrinsic* CalculateArrayLength::BufferSizeIntrinsic::Clone( CloneContext* ctx) const { - return ctx->dst->ASTNodes().Create(ctx->dst->ID()); + return ctx->dst->ASTNodes().Create( + ctx->dst->ID(), ctx->dst->AllocateNodeID()); } CalculateArrayLength::CalculateArrayLength() = default; @@ -89,30 +92,29 @@ void CalculateArrayLength::Run(CloneContext& ctx, const DataMap&, DataMap&) cons // get_buffer_size_intrinsic() emits the function decorated with // BufferSizeIntrinsic that is transformed by the HLSL writer into a call to // [RW]ByteAddressBuffer.GetDimensions(). - std::unordered_map buffer_size_intrinsics; - auto get_buffer_size_intrinsic = [&](const sem::Type* buffer_type) { + std::unordered_map buffer_size_intrinsics; + auto get_buffer_size_intrinsic = [&](const sem::Reference* buffer_type) { return utils::GetOrCreate(buffer_size_intrinsics, buffer_type, [&] { auto name = ctx.dst->Sym(); auto* type = CreateASTTypeFor(ctx, buffer_type); auto* disable_validation = - ctx.dst->Disable(ast::DisabledValidation::kIgnoreConstructibleFunctionParameter); + ctx.dst->Disable(ast::DisabledValidation::kFunctionParameter); ctx.dst->AST().AddFunction(ctx.dst->create( name, - ast::VariableList{ - // Note: The buffer parameter requires the kStorage StorageClass - // in order for HLSL to emit this as a ByteAddressBuffer. - ctx.dst->create(ctx.dst->Sym("buffer"), - ast::StorageClass::kStorage, - ast::Access::kUndefined, type, true, false, - nullptr, ast::AttributeList{disable_validation}), + utils::Vector{ + ctx.dst->Param("buffer", + ctx.dst->ty.pointer(type, buffer_type->StorageClass(), + buffer_type->Access()), + utils::Vector{disable_validation}), ctx.dst->Param("result", ctx.dst->ty.pointer(ctx.dst->ty.u32(), ast::StorageClass::kFunction)), }, ctx.dst->ty.void_(), nullptr, - ast::AttributeList{ - ctx.dst->ASTNodes().Create(ctx.dst->ID()), + utils::Vector{ + ctx.dst->ASTNodes().Create(ctx.dst->ID(), + ctx.dst->AllocateNodeID()), }, - ast::AttributeList{})); + utils::Empty)); return name; }); @@ -123,15 +125,15 @@ void CalculateArrayLength::Run(CloneContext& ctx, const DataMap&, DataMap&) cons // Find all the arrayLength() calls... for (auto* node : ctx.src->ASTNodes().Objects()) { if (auto* call_expr = node->As()) { - auto* call = sem.Get(call_expr); + auto* call = sem.Get(call_expr)->UnwrapMaterialize()->As(); if (auto* builtin = call->Target()->As()) { if (builtin->Type() == sem::BuiltinType::kArrayLength) { // We're dealing with an arrayLength() call - // A runtime-sized array can only appear as the store type of a - // variable, or the last element of a structure (which cannot itself - // be nested). Given that we require SimplifyPointers, we can assume - // that the arrayLength() call has one of two forms: + // A runtime-sized array can only appear as the store type of a variable, or the + // last element of a structure (which cannot itself be nested). Given that we + // require SimplifyPointers, we can assume that the arrayLength() call has one + // of two forms: // arrayLength(&struct_var.array_member) // arrayLength(&array_var) auto* arg = call_expr->args[0]; @@ -152,10 +154,9 @@ void CalculateArrayLength::Run(CloneContext& ctx, const DataMap&, DataMap&) cons break; } auto* storage_buffer_var = storage_buffer_sem->Variable(); - auto* storage_buffer_type = storage_buffer_sem->Type()->UnwrapRef(); + auto* storage_buffer_type = storage_buffer_sem->Type()->As(); - // Generate BufferSizeIntrinsic for this storage type if we haven't - // already + // Generate BufferSizeIntrinsic for this storage type if we haven't already auto buffer_size = get_buffer_size_intrinsic(storage_buffer_type); // Find the current statement block @@ -168,16 +169,15 @@ void CalculateArrayLength::Run(CloneContext& ctx, const DataMap&, DataMap&) cons // Construct the variable that'll hold the result of // RWByteAddressBuffer.GetDimensions() - auto* buffer_size_result = ctx.dst->Decl( - ctx.dst->Var(ctx.dst->Sym(), ctx.dst->ty.u32(), - ast::StorageClass::kNone, ctx.dst->Expr(0_u))); + auto* buffer_size_result = ctx.dst->Decl(ctx.dst->Var( + ctx.dst->Sym(), ctx.dst->ty.u32(), ctx.dst->Expr(0_u))); // Call storage_buffer.GetDimensions(&buffer_size_result) auto* call_get_dims = ctx.dst->CallStmt(ctx.dst->Call( // BufferSizeIntrinsic(X, ARGS...) is // translated to: // X.GetDimensions(ARGS..) by the writer - buffer_size, ctx.Clone(storage_buffer_expr), + buffer_size, ctx.dst->AddressOf(ctx.Clone(storage_buffer_expr)), ctx.dst->AddressOf( ctx.dst->Expr(buffer_size_result->variable->symbol)))); @@ -188,22 +188,26 @@ void CalculateArrayLength::Run(CloneContext& ctx, const DataMap&, DataMap&) cons auto name = ctx.dst->Sym(); const ast::Expression* total_size = ctx.dst->Expr(buffer_size_result->variable); - const sem::Array* array_type = nullptr; - if (auto* str = storage_buffer_type->As()) { - // The variable is a struct, so subtract the byte offset of - // the array member. - auto* array_member_sem = str->Members().back(); - array_type = array_member_sem->Type()->As(); - total_size = - ctx.dst->Sub(total_size, u32(array_member_sem->Offset())); - } else if (auto* arr = storage_buffer_type->As()) { - array_type = arr; - } else { + + const sem::Array* array_type = Switch( + storage_buffer_type->StoreType(), + [&](const sem::Struct* str) { + // The variable is a struct, so subtract the byte offset of + // the array member. + auto* array_member_sem = str->Members().back(); + total_size = + ctx.dst->Sub(total_size, u32(array_member_sem->Offset())); + return array_member_sem->Type()->As(); + }, + [&](const sem::Array* arr) { return arr; }); + + if (!array_type) { TINT_ICE(Transform, ctx.dst->Diagnostics()) << "expected form of arrayLength argument to be " "&array_var or &struct_var.array_member"; return name; } + uint32_t array_stride = array_type->Size(); auto* array_length_var = ctx.dst->Decl( ctx.dst->Let(name, ctx.dst->ty.u32(), diff --git a/src/tint/transform/calculate_array_length.h b/src/tint/transform/calculate_array_length.h index 401e081aa7..8db8dcceca 100644 --- a/src/tint/transform/calculate_array_length.h +++ b/src/tint/transform/calculate_array_length.h @@ -40,7 +40,8 @@ class CalculateArrayLength final : public Castable sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { } )"; @@ -55,7 +55,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = arrayLength(&sb.arr); } @@ -68,7 +68,7 @@ TEST_F(CalculateArrayLengthTest, BasicArray) { auto* src = R"( @group(0) @binding(0) var sb : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = arrayLength(&sb); } @@ -76,14 +76,14 @@ fn main() { auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, read>, result : ptr) @group(0) @binding(0) var sb : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var tint_symbol_1 : u32 = 0u; - tint_symbol(sb, &(tint_symbol_1)); + tint_symbol(&(sb), &(tint_symbol_1)); let tint_symbol_2 : u32 = (tint_symbol_1 / 4u); var len : u32 = tint_symbol_2; } @@ -103,7 +103,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len : u32 = arrayLength(&sb.arr); } @@ -111,7 +111,7 @@ fn main() { auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, result : ptr) struct SB { x : i32, @@ -120,10 +120,10 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var tint_symbol_1 : u32 = 0u; - tint_symbol(sb, &(tint_symbol_1)); + tint_symbol(&(sb), &(tint_symbol_1)); let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u); var len : u32 = tint_symbol_2; } @@ -142,14 +142,14 @@ struct S { @group(0) @binding(0) var arr : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let len = arrayLength(&arr); } )"; auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, read>, result : ptr) struct S { f : f32, @@ -157,10 +157,10 @@ struct S { @group(0) @binding(0) var arr : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var tint_symbol_1 : u32 = 0u; - tint_symbol(arr, &(tint_symbol_1)); + tint_symbol(&(arr), &(tint_symbol_1)); let tint_symbol_2 : u32 = (tint_symbol_1 / 4u); let len = tint_symbol_2; } @@ -179,14 +179,14 @@ struct S { @group(0) @binding(0) var arr : array>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let len = arrayLength(&arr); } )"; auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array>, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr>, read>, result : ptr) struct S { f : f32, @@ -194,10 +194,10 @@ struct S { @group(0) @binding(0) var arr : array>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var tint_symbol_1 : u32 = 0u; - tint_symbol(arr, &(tint_symbol_1)); + tint_symbol(&(arr), &(tint_symbol_1)); let tint_symbol_2 : u32 = (tint_symbol_1 / 16u); let len = tint_symbol_2; } @@ -212,7 +212,7 @@ TEST_F(CalculateArrayLengthTest, InSameBlock) { auto* src = R"( @group(0) @binding(0) var sb : array;; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var a : u32 = arrayLength(&sb); var b : u32 = arrayLength(&sb); @@ -222,14 +222,14 @@ fn main() { auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, read>, result : ptr) @group(0) @binding(0) var sb : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var tint_symbol_1 : u32 = 0u; - tint_symbol(sb, &(tint_symbol_1)); + tint_symbol(&(sb), &(tint_symbol_1)); let tint_symbol_2 : u32 = (tint_symbol_1 / 4u); var a : u32 = tint_symbol_2; var b : u32 = tint_symbol_2; @@ -251,7 +251,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var a : u32 = arrayLength(&sb.arr); var b : u32 = arrayLength(&sb.arr); @@ -261,7 +261,7 @@ fn main() { auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, result : ptr) struct SB { x : i32, @@ -270,10 +270,10 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var tint_symbol_1 : u32 = 0u; - tint_symbol(sb, &(tint_symbol_1)); + tint_symbol(&(sb), &(tint_symbol_1)); let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u); var a : u32 = tint_symbol_2; var b : u32 = tint_symbol_2; @@ -295,7 +295,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { if (true) { var len : u32 = arrayLength(&sb.arr); @@ -309,7 +309,7 @@ fn main() { auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, result : ptr) struct SB { x : i32, @@ -318,17 +318,17 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { if (true) { var tint_symbol_1 : u32 = 0u; - tint_symbol(sb, &(tint_symbol_1)); + tint_symbol(&(sb), &(tint_symbol_1)); let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u); var len : u32 = tint_symbol_2; } else { if (true) { var tint_symbol_3 : u32 = 0u; - tint_symbol(sb, &(tint_symbol_3)); + tint_symbol(&(sb), &(tint_symbol_3)); let tint_symbol_4 : u32 = ((tint_symbol_3 - 4u) / 4u); var len : u32 = tint_symbol_4; } @@ -359,7 +359,7 @@ struct SB2 { @group(0) @binding(2) var sb3 : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len1 : u32 = arrayLength(&(sb1.arr1)); var len2 : u32 = arrayLength(&(sb2.arr2)); @@ -370,13 +370,13 @@ fn main() { auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB1, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, result : ptr) @internal(intrinsic_buffer_size) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB2, result : ptr) +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, result : ptr) @internal(intrinsic_buffer_size) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array, result : ptr) +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, read>, result : ptr) struct SB1 { x : i32, @@ -394,16 +394,16 @@ struct SB2 { @group(0) @binding(2) var sb3 : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var tint_symbol_1 : u32 = 0u; - tint_symbol(sb1, &(tint_symbol_1)); + tint_symbol(&(sb1), &(tint_symbol_1)); let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u); var tint_symbol_4 : u32 = 0u; - tint_symbol_3(sb2, &(tint_symbol_4)); + tint_symbol_3(&(sb2), &(tint_symbol_4)); let tint_symbol_5 : u32 = ((tint_symbol_4 - 16u) / 16u); var tint_symbol_7 : u32 = 0u; - tint_symbol_6(sb3, &(tint_symbol_7)); + tint_symbol_6(&(sb3), &(tint_symbol_7)); let tint_symbol_8 : u32 = (tint_symbol_7 / 4u); var len1 : u32 = tint_symbol_2; var len2 : u32 = tint_symbol_5; @@ -427,7 +427,7 @@ struct SB { @group(0) @binding(0) var a : SB; @group(0) @binding(1) var b : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = &a; var a : u32 = arrayLength(&a.arr); @@ -440,7 +440,7 @@ fn main() { auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, result : ptr) struct SB { x : i32, @@ -451,15 +451,15 @@ struct SB { @group(0) @binding(1) var b : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var tint_symbol_1 : u32 = 0u; - tint_symbol(a, &(tint_symbol_1)); + tint_symbol(&(a), &(tint_symbol_1)); let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u); var a_1 : u32 = tint_symbol_2; { var tint_symbol_3 : u32 = 0u; - tint_symbol(a, &(tint_symbol_3)); + tint_symbol(&(a), &(tint_symbol_3)); let tint_symbol_4 : u32 = ((tint_symbol_3 - 4u) / 4u); var b_1 : u32 = tint_symbol_4; } @@ -473,7 +473,7 @@ fn main() { TEST_F(CalculateArrayLengthTest, OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var len1 : u32 = arrayLength(&(sb1.arr1)); var len2 : u32 = arrayLength(&(sb2.arr2)); @@ -500,24 +500,24 @@ struct SB2 { auto* expect = R"( @internal(intrinsic_buffer_size) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB1, result : ptr) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, result : ptr) @internal(intrinsic_buffer_size) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB2, result : ptr) +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, result : ptr) @internal(intrinsic_buffer_size) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : array, result : ptr) +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, read>, result : ptr) -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var tint_symbol_1 : u32 = 0u; - tint_symbol(sb1, &(tint_symbol_1)); + tint_symbol(&(sb1), &(tint_symbol_1)); let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u); var tint_symbol_4 : u32 = 0u; - tint_symbol_3(sb2, &(tint_symbol_4)); + tint_symbol_3(&(sb2), &(tint_symbol_4)); let tint_symbol_5 : u32 = ((tint_symbol_4 - 16u) / 16u); var tint_symbol_7 : u32 = 0u; - tint_symbol_6(sb3, &(tint_symbol_7)); + tint_symbol_6(&(sb3), &(tint_symbol_7)); let tint_symbol_8 : u32 = (tint_symbol_7 / 4u); var len1 : u32 = tint_symbol_2; var len2 : u32 = tint_symbol_5; diff --git a/src/tint/transform/canonicalize_entry_point_io.cc b/src/tint/transform/canonicalize_entry_point_io.cc index aeafa1b86e..31feb86b6f 100644 --- a/src/tint/transform/canonicalize_entry_point_io.cc +++ b/src/tint/transform/canonicalize_entry_point_io.cc @@ -69,9 +69,9 @@ bool IsShaderIOAttribute(const ast::Attribute* attr) { } // Returns true if `attrs` contains a `sample_mask` builtin. -bool HasSampleMask(const ast::AttributeList& attrs) { +bool HasSampleMask(utils::VectorRef attrs) { auto* builtin = ast::GetAttribute(attrs); - return builtin && builtin->builtin == ast::Builtin::kSampleMask; + return builtin && builtin->builtin == ast::BuiltinValue::kSampleMask; } } // namespace @@ -85,7 +85,7 @@ struct CanonicalizeEntryPointIO::State { /// The type of the output value. const ast::Type* type; /// The shader IO attributes. - ast::AttributeList attributes; + utils::Vector attributes; /// The value itself. const ast::Expression* value; }; @@ -100,19 +100,19 @@ struct CanonicalizeEntryPointIO::State { const sem::Function* func_sem; /// The new entry point wrapper function's parameters. - ast::VariableList wrapper_ep_parameters; + utils::Vector wrapper_ep_parameters; /// The members of the wrapper function's struct parameter. - ast::StructMemberList wrapper_struct_param_members; + utils::Vector wrapper_struct_param_members; /// The name of the wrapper function's struct parameter. Symbol wrapper_struct_param_name; /// The parameters that will be passed to the original function. - ast::ExpressionList inner_call_parameters; + utils::Vector inner_call_parameters; /// The members of the wrapper function's struct return type. - ast::StructMemberList wrapper_struct_output_members; + utils::Vector wrapper_struct_output_members; /// The wrapper function output values. - std::vector wrapper_output_values; + utils::Vector wrapper_output_values; /// The body of the wrapper function. - ast::StatementList wrapper_body; + utils::Vector wrapper_body; /// Input names used by the entrypoint std::unordered_set input_names; @@ -129,12 +129,13 @@ struct CanonicalizeEntryPointIO::State { /// @param src the attributes to clone /// @param do_interpolate whether to clone InterpolateAttribute /// @return the cloned attributes - ast::AttributeList CloneShaderIOAttributes(const ast::AttributeList& src, bool do_interpolate) { - ast::AttributeList new_attributes; + template + auto CloneShaderIOAttributes(utils::Vector src, bool do_interpolate) { + utils::Vector new_attributes; for (auto* attr : src) { if (IsShaderIOAttribute(attr) && - (do_interpolate || !attr->Is())) { - new_attributes.push_back(ctx.Clone(attr)); + (do_interpolate || !attr->template Is())) { + new_attributes.Push(ctx.Clone(attr)); } } return new_attributes; @@ -156,30 +157,32 @@ struct CanonicalizeEntryPointIO::State { /// @returns an expression which evaluates to the value of the shader input const ast::Expression* AddInput(std::string name, const sem::Type* type, - ast::AttributeList attributes) { + utils::Vector attributes) { auto* ast_type = CreateASTTypeFor(ctx, type); if (cfg.shader_style == ShaderStyle::kSpirv || cfg.shader_style == ShaderStyle::kGlsl) { - // Vulkan requires that integer user-defined fragment inputs are - // always decorated with `Flat`. - // TODO(crbug.com/tint/1224): Remove this once a flat interpolation - // attribute is required for integers. - if (type->is_integer_scalar_or_vector() && - ast::HasAttribute(attributes) && + // Vulkan requires that integer user-defined fragment inputs are always decorated with + // `Flat`. See: + // https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/StandaloneSpirv.html#VUID-StandaloneSpirv-Flat-04744 + // TODO(crbug.com/tint/1224): Remove this once a flat interpolation attribute is + // required for integers. + if (func_ast->PipelineStage() == ast::PipelineStage::kFragment && + type->is_integer_scalar_or_vector() && !ast::HasAttribute(attributes) && - func_ast->PipelineStage() == ast::PipelineStage::kFragment) { - attributes.push_back(ctx.dst->Interpolate(ast::InterpolationType::kFlat, - ast::InterpolationSampling::kNone)); + (ast::HasAttribute(attributes) || + cfg.shader_style == ShaderStyle::kSpirv)) { + attributes.Push(ctx.dst->Interpolate(ast::InterpolationType::kFlat, + ast::InterpolationSampling::kNone)); } // Disable validation for use of the `input` storage class. - attributes.push_back(ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass)); + attributes.Push(ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass)); // In GLSL, if it's a builtin, override the name with the // corresponding gl_ builtin name auto* builtin = ast::GetAttribute(attributes); if (cfg.shader_style == ShaderStyle::kGlsl && builtin) { name = GLSLBuiltinToString(builtin->builtin, func_ast->PipelineStage(), - ast::StorageClass::kInput); + ast::StorageClass::kIn); } auto symbol = ctx.dst->Symbols().New(name); @@ -189,14 +192,14 @@ struct CanonicalizeEntryPointIO::State { if (builtin) { if (cfg.shader_style == ShaderStyle::kGlsl) { value = FromGLSLBuiltin(builtin->builtin, value, ast_type); - } else if (builtin->builtin == ast::Builtin::kSampleMask) { + } else if (builtin->builtin == ast::BuiltinValue::kSampleMask) { // Vulkan requires the type of a SampleMask builtin to be an array. // Declare it as array and then load the first element. ast_type = ctx.dst->ty.array(ast_type, 1_u); value = ctx.dst->IndexAccessor(value, 0_i); } } - ctx.dst->Global(symbol, ast_type, ast::StorageClass::kInput, std::move(attributes)); + ctx.dst->GlobalVar(symbol, ast_type, ast::StorageClass::kIn, std::move(attributes)); return value; } else if (cfg.shader_style == ShaderStyle::kMsl && ast::HasAttribute(attributes)) { @@ -204,14 +207,13 @@ struct CanonicalizeEntryPointIO::State { // parameter list and pass it directly to the inner function. Symbol symbol = input_names.emplace(name).second ? ctx.dst->Symbols().Register(name) : ctx.dst->Symbols().New(name); - wrapper_ep_parameters.push_back( - ctx.dst->Param(symbol, ast_type, std::move(attributes))); + wrapper_ep_parameters.Push(ctx.dst->Param(symbol, ast_type, std::move(attributes))); return ctx.dst->Expr(symbol); } else { // Otherwise, move it to the new structure member list. Symbol symbol = input_names.emplace(name).second ? ctx.dst->Symbols().Register(name) : ctx.dst->Symbols().New(name); - wrapper_struct_param_members.push_back( + wrapper_struct_param_members.Push( ctx.dst->Member(symbol, ast_type, std::move(attributes))); return ctx.dst->MemberAccessor(InputStructSymbol(), symbol); } @@ -224,18 +226,19 @@ struct CanonicalizeEntryPointIO::State { /// @param value the value of the shader output void AddOutput(std::string name, const sem::Type* type, - ast::AttributeList attributes, + utils::Vector attributes, const ast::Expression* value) { - // Vulkan requires that integer user-defined vertex outputs are - // always decorated with `Flat`. - // TODO(crbug.com/tint/1224): Remove this once a flat interpolation - // attribute is required for integers. - if (cfg.shader_style == ShaderStyle::kSpirv && type->is_integer_scalar_or_vector() && + // Vulkan requires that integer user-defined vertex outputs are always decorated with + // `Flat`. + // TODO(crbug.com/tint/1224): Remove this once a flat interpolation attribute is required + // for integers. + if (cfg.shader_style == ShaderStyle::kSpirv && + func_ast->PipelineStage() == ast::PipelineStage::kVertex && + type->is_integer_scalar_or_vector() && ast::HasAttribute(attributes) && - !ast::HasAttribute(attributes) && - func_ast->PipelineStage() == ast::PipelineStage::kVertex) { - attributes.push_back(ctx.dst->Interpolate(ast::InterpolationType::kFlat, - ast::InterpolationSampling::kNone)); + !ast::HasAttribute(attributes)) { + attributes.Push(ctx.dst->Interpolate(ast::InterpolationType::kFlat, + ast::InterpolationSampling::kNone)); } // In GLSL, if it's a builtin, override the name with the @@ -243,7 +246,7 @@ struct CanonicalizeEntryPointIO::State { if (cfg.shader_style == ShaderStyle::kGlsl) { if (auto* b = ast::GetAttribute(attributes)) { name = GLSLBuiltinToString(b->builtin, func_ast->PipelineStage(), - ast::StorageClass::kOutput); + ast::StorageClass::kOut); value = ToGLSLBuiltin(b->builtin, value, type); } } @@ -253,7 +256,7 @@ struct CanonicalizeEntryPointIO::State { output.type = CreateASTTypeFor(ctx, type); output.attributes = std::move(attributes); output.value = value; - wrapper_output_values.push_back(output); + wrapper_output_values.Push(output); } /// Process a non-struct parameter. @@ -262,19 +265,23 @@ struct CanonicalizeEntryPointIO::State { /// that will be passed to the original function. /// @param param the original function parameter void ProcessNonStructParameter(const sem::Parameter* param) { + // Do not add interpolation attributes on vertex input + bool do_interpolate = func_ast->PipelineStage() != ast::PipelineStage::kVertex; // Remove the shader IO attributes from the inner function parameter, and // attach them to the new object instead. - ast::AttributeList attributes; + utils::Vector attributes; for (auto* attr : param->Declaration()->attributes) { if (IsShaderIOAttribute(attr)) { ctx.Remove(param->Declaration()->attributes, attr); - attributes.push_back(ctx.Clone(attr)); + if ((do_interpolate || !attr->Is())) { + attributes.Push(ctx.Clone(attr)); + } } } auto name = ctx.src->Symbols().NameFor(param->Declaration()->symbol); auto* input_expr = AddInput(name, param->Type(), std::move(attributes)); - inner_call_parameters.push_back(input_expr); + inner_call_parameters.Push(input_expr); } /// Process a struct parameter. @@ -283,11 +290,14 @@ struct CanonicalizeEntryPointIO::State { /// the original function. /// @param param the original function parameter void ProcessStructParameter(const sem::Parameter* param) { + // Do not add interpolation attributes on vertex input + bool do_interpolate = func_ast->PipelineStage() != ast::PipelineStage::kVertex; + auto* str = param->Type()->As(); // Recreate struct members in the outer entry point and build an initializer // list to pass them through to the inner function. - ast::ExpressionList inner_struct_values; + utils::Vector inner_struct_values; for (auto* member : str->Members()) { if (member->Type()->Is()) { TINT_ICE(Transform, ctx.dst->Diagnostics()) << "nested IO struct"; @@ -297,19 +307,13 @@ struct CanonicalizeEntryPointIO::State { auto* member_ast = member->Declaration(); auto name = ctx.src->Symbols().NameFor(member_ast->symbol); - // In GLSL, do not add interpolation attributes on vertex input - bool do_interpolate = true; - if (cfg.shader_style == ShaderStyle::kGlsl && - func_ast->PipelineStage() == ast::PipelineStage::kVertex) { - do_interpolate = false; - } auto attributes = CloneShaderIOAttributes(member_ast->attributes, do_interpolate); auto* input_expr = AddInput(name, member->Type(), std::move(attributes)); - inner_struct_values.push_back(input_expr); + inner_struct_values.Push(input_expr); } // Construct the original structure using the new shader input objects. - inner_call_parameters.push_back( + inner_call_parameters.Push( ctx.dst->Construct(ctx.Clone(param->Declaration()->type), inner_struct_values)); } @@ -319,12 +323,8 @@ struct CanonicalizeEntryPointIO::State { /// @param inner_ret_type the original function return type /// @param original_result the result object produced by the original function void ProcessReturnType(const sem::Type* inner_ret_type, Symbol original_result) { - bool do_interpolate = true; - // In GLSL, do not add interpolation attributes on fragment output - if (cfg.shader_style == ShaderStyle::kGlsl && - func_ast->PipelineStage() == ast::PipelineStage::kFragment) { - do_interpolate = false; - } + // Do not add interpolation attributes on fragment output + bool do_interpolate = func_ast->PipelineStage() != ast::PipelineStage::kFragment; if (auto* str = inner_ret_type->As()) { for (auto* member : str->Members()) { if (member->Type()->Is()) { @@ -366,7 +366,7 @@ struct CanonicalizeEntryPointIO::State { // No existing sample mask builtin was found, so create a new output value // using the fixed sample mask. AddOutput("fixed_sample_mask", ctx.dst->create(), - {ctx.dst->Builtin(ast::Builtin::kSampleMask)}, + {ctx.dst->Builtin(ast::BuiltinValue::kSampleMask)}, ctx.dst->Expr(u32(cfg.fixed_sample_mask))); } @@ -374,7 +374,7 @@ struct CanonicalizeEntryPointIO::State { void AddVertexPointSize() { // Create a new output value and assign it a literal 1.0 value. AddOutput("vertex_point_size", ctx.dst->create(), - {ctx.dst->Builtin(ast::Builtin::kPointSize)}, ctx.dst->Expr(1.f)); + {ctx.dst->Builtin(ast::BuiltinValue::kPointSize)}, ctx.dst->Expr(1_f)); } /// Create an expression for gl_Position.[component] @@ -394,19 +394,19 @@ struct CanonicalizeEntryPointIO::State { // Create the new struct type. auto struct_name = ctx.dst->Sym(); - auto* in_struct = ctx.dst->create(struct_name, wrapper_struct_param_members, - ast::AttributeList{}); + auto* in_struct = + ctx.dst->create(struct_name, wrapper_struct_param_members, utils::Empty); ctx.InsertBefore(ctx.src->AST().GlobalDeclarations(), func_ast, in_struct); // Create a new function parameter using this struct type. auto* param = ctx.dst->Param(InputStructSymbol(), ctx.dst->ty.type_name(struct_name)); - wrapper_ep_parameters.push_back(param); + wrapper_ep_parameters.Push(param); } /// Create and return the wrapper function's struct result object. /// @returns the struct type ast::Struct* CreateOutputStruct() { - ast::StatementList assignments; + utils::Vector assignments; auto wrapper_result = ctx.dst->Symbols().New("wrapper_result"); @@ -422,9 +422,9 @@ struct CanonicalizeEntryPointIO::State { } member_names.insert(ctx.dst->Symbols().NameFor(name)); - wrapper_struct_output_members.push_back( + wrapper_struct_output_members.Push( ctx.dst->Member(name, outval.type, std::move(outval.attributes))); - assignments.push_back( + assignments.Push( ctx.dst->Assign(ctx.dst->MemberAccessor(wrapper_result, name), outval.value)); } @@ -434,14 +434,16 @@ struct CanonicalizeEntryPointIO::State { // Create the new struct type. auto* out_struct = ctx.dst->create( - ctx.dst->Sym(), wrapper_struct_output_members, ast::AttributeList{}); + ctx.dst->Sym(), wrapper_struct_output_members, utils::Empty); ctx.InsertBefore(ctx.src->AST().GlobalDeclarations(), func_ast, out_struct); // Create the output struct object, assign its members, and return it. auto* result_object = ctx.dst->Var(wrapper_result, ctx.dst->ty.type_name(out_struct->name)); - wrapper_body.push_back(ctx.dst->Decl(result_object)); - wrapper_body.insert(wrapper_body.end(), assignments.begin(), assignments.end()); - wrapper_body.push_back(ctx.dst->Return(wrapper_result)); + wrapper_body.Push(ctx.dst->Decl(result_object)); + for (auto* assignment : assignments) { + wrapper_body.Push(assignment); + } + wrapper_body.Push(ctx.dst->Return(wrapper_result)); return out_struct; } @@ -450,8 +452,8 @@ struct CanonicalizeEntryPointIO::State { void CreateGlobalOutputVariables() { for (auto& outval : wrapper_output_values) { // Disable validation for use of the `output` storage class. - ast::AttributeList attributes = std::move(outval.attributes); - attributes.push_back(ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass)); + utils::Vector attributes = std::move(outval.attributes); + attributes.Push(ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass)); // Create the global variable and assign it the output value. auto name = ctx.dst->Symbols().New(outval.name); @@ -463,8 +465,8 @@ struct CanonicalizeEntryPointIO::State { type = ctx.dst->ty.array(type, 1_u); lhs = ctx.dst->IndexAccessor(lhs, 0_i); } - ctx.dst->Global(name, type, ast::StorageClass::kOutput, std::move(attributes)); - wrapper_body.push_back(ctx.dst->Assign(lhs, outval.value)); + ctx.dst->GlobalVar(name, type, ast::StorageClass::kOut, std::move(attributes)); + wrapper_body.Push(ctx.dst->Assign(lhs, outval.value)); } } @@ -488,7 +490,7 @@ struct CanonicalizeEntryPointIO::State { // processing. auto* inner_function = ctx.dst->create( inner_name, ctx.Clone(func_ast->params), ctx.Clone(func_ast->return_type), - ctx.Clone(func_ast->body), ast::AttributeList{}, ast::AttributeList{}); + ctx.Clone(func_ast->body), utils::Empty, utils::Empty); ctx.Replace(func_ast, inner_function); // Call the function. @@ -509,7 +511,7 @@ struct CanonicalizeEntryPointIO::State { } // Exit early if there is no shader IO to handle. - if (func_sem->Parameters().size() == 0 && func_sem->ReturnType()->Is() && + if (func_sem->Parameters().Length() == 0 && func_sem->ReturnType()->Is() && !needs_fixed_sample_mask && !needs_vertex_point_size && cfg.shader_style != ShaderStyle::kGlsl) { return; @@ -517,7 +519,7 @@ struct CanonicalizeEntryPointIO::State { // Process the entry point parameters, collecting those that need to be // aggregated into a single structure. - if (!func_sem->Parameters().empty()) { + if (!func_sem->Parameters().IsEmpty()) { for (auto* param : func_sem->Parameters()) { if (param->Type()->Is()) { ProcessStructParameter(param); @@ -527,7 +529,7 @@ struct CanonicalizeEntryPointIO::State { } // Create a structure parameter for the outer entry point if necessary. - if (!wrapper_struct_param_members.empty()) { + if (!wrapper_struct_param_members.IsEmpty()) { CreateInputStruct(); } } @@ -539,12 +541,11 @@ struct CanonicalizeEntryPointIO::State { std::function wrapper_ret_type = [&] { return ctx.dst->ty.void_(); }; if (func_sem->ReturnType()->Is()) { // The function call is just a statement with no result. - wrapper_body.push_back(ctx.dst->CallStmt(call_inner)); + wrapper_body.Push(ctx.dst->CallStmt(call_inner)); } else { // Capture the result of calling the original function. - auto* inner_result = - ctx.dst->Let(ctx.dst->Symbols().New("inner_result"), nullptr, call_inner); - wrapper_body.push_back(ctx.dst->Decl(inner_result)); + auto* inner_result = ctx.dst->Let(ctx.dst->Symbols().New("inner_result"), call_inner); + wrapper_body.Push(ctx.dst->Decl(inner_result)); // Process the original return type to determine the outputs that the // outer function needs to produce. @@ -562,7 +563,7 @@ struct CanonicalizeEntryPointIO::State { } // Produce the entry point outputs, if necessary. - if (!wrapper_output_values.empty()) { + if (!wrapper_output_values.IsEmpty()) { if (cfg.shader_style == ShaderStyle::kSpirv || cfg.shader_style == ShaderStyle::kGlsl) { CreateGlobalOutputVariables(); } else { @@ -578,11 +579,11 @@ struct CanonicalizeEntryPointIO::State { auto* pos_y = GLPosition("y"); auto* negate_pos_y = ctx.dst->create(ast::UnaryOp::kNegation, GLPosition("y")); - wrapper_body.push_back(ctx.dst->Assign(pos_y, negate_pos_y)); + wrapper_body.Push(ctx.dst->Assign(pos_y, negate_pos_y)); - auto* two_z = ctx.dst->Mul(ctx.dst->Expr(2.0f), GLPosition("z")); + auto* two_z = ctx.dst->Mul(ctx.dst->Expr(2_f), GLPosition("z")); auto* fixed_z = ctx.dst->Sub(two_z, GLPosition("w")); - wrapper_body.push_back(ctx.dst->Assign(GLPosition("z"), fixed_z)); + wrapper_body.Push(ctx.dst->Assign(GLPosition("z"), fixed_z)); } // Create the wrapper entry point function. @@ -597,7 +598,7 @@ struct CanonicalizeEntryPointIO::State { auto* wrapper_func = ctx.dst->create( name, wrapper_ep_parameters, wrapper_ret_type(), ctx.dst->Block(wrapper_body), - ctx.Clone(func_ast->attributes), ast::AttributeList{}); + ctx.Clone(func_ast->attributes), utils::Empty); ctx.InsertAfter(ctx.src->AST().GlobalDeclarations(), func_ast, wrapper_func); } @@ -606,11 +607,11 @@ struct CanonicalizeEntryPointIO::State { /// @param stage the current pipeline stage /// @param storage_class the storage class (input or output) /// @returns the gl_ string corresponding to that builtin - const char* GLSLBuiltinToString(ast::Builtin builtin, + const char* GLSLBuiltinToString(ast::BuiltinValue builtin, ast::PipelineStage stage, ast::StorageClass storage_class) { switch (builtin) { - case ast::Builtin::kPosition: + case ast::BuiltinValue::kPosition: switch (stage) { case ast::PipelineStage::kVertex: return "gl_Position"; @@ -619,28 +620,28 @@ struct CanonicalizeEntryPointIO::State { default: return ""; } - case ast::Builtin::kVertexIndex: + case ast::BuiltinValue::kVertexIndex: return "gl_VertexID"; - case ast::Builtin::kInstanceIndex: + case ast::BuiltinValue::kInstanceIndex: return "gl_InstanceID"; - case ast::Builtin::kFrontFacing: + case ast::BuiltinValue::kFrontFacing: return "gl_FrontFacing"; - case ast::Builtin::kFragDepth: + case ast::BuiltinValue::kFragDepth: return "gl_FragDepth"; - case ast::Builtin::kLocalInvocationId: + case ast::BuiltinValue::kLocalInvocationId: return "gl_LocalInvocationID"; - case ast::Builtin::kLocalInvocationIndex: + case ast::BuiltinValue::kLocalInvocationIndex: return "gl_LocalInvocationIndex"; - case ast::Builtin::kGlobalInvocationId: + case ast::BuiltinValue::kGlobalInvocationId: return "gl_GlobalInvocationID"; - case ast::Builtin::kNumWorkgroups: + case ast::BuiltinValue::kNumWorkgroups: return "gl_NumWorkGroups"; - case ast::Builtin::kWorkgroupId: + case ast::BuiltinValue::kWorkgroupId: return "gl_WorkGroupID"; - case ast::Builtin::kSampleIndex: + case ast::BuiltinValue::kSampleIndex: return "gl_SampleID"; - case ast::Builtin::kSampleMask: - if (storage_class == ast::StorageClass::kInput) { + case ast::BuiltinValue::kSampleMask: + if (storage_class == ast::StorageClass::kIn) { return "gl_SampleMaskIn"; } else { return "gl_SampleMask"; @@ -656,18 +657,18 @@ struct CanonicalizeEntryPointIO::State { /// @param ast_type (inout) the incoming WGSL and outgoing GLSL types /// @returns an expression representing the GLSL builtin converted to what /// WGSL expects - const ast::Expression* FromGLSLBuiltin(ast::Builtin builtin, + const ast::Expression* FromGLSLBuiltin(ast::BuiltinValue builtin, const ast::Expression* value, const ast::Type*& ast_type) { switch (builtin) { - case ast::Builtin::kVertexIndex: - case ast::Builtin::kInstanceIndex: - case ast::Builtin::kSampleIndex: + case ast::BuiltinValue::kVertexIndex: + case ast::BuiltinValue::kInstanceIndex: + case ast::BuiltinValue::kSampleIndex: // GLSL uses i32 for these, so bitcast to u32. value = ctx.dst->Bitcast(ast_type, value); ast_type = ctx.dst->ty.i32(); break; - case ast::Builtin::kSampleMask: + case ast::BuiltinValue::kSampleMask: // gl_SampleMask is an array of i32. Retrieve the first element and // bitcast it to u32. value = ctx.dst->IndexAccessor(value, 0_i); @@ -686,14 +687,14 @@ struct CanonicalizeEntryPointIO::State { /// @param value the value to convert /// @param type (out) the type to which the value was converted /// @returns the converted value which can be assigned to the GLSL builtin - const ast::Expression* ToGLSLBuiltin(ast::Builtin builtin, + const ast::Expression* ToGLSLBuiltin(ast::BuiltinValue builtin, const ast::Expression* value, const sem::Type*& type) { switch (builtin) { - case ast::Builtin::kVertexIndex: - case ast::Builtin::kInstanceIndex: - case ast::Builtin::kSampleIndex: - case ast::Builtin::kSampleMask: + case ast::BuiltinValue::kVertexIndex: + case ast::BuiltinValue::kInstanceIndex: + case ast::BuiltinValue::kSampleIndex: + case ast::BuiltinValue::kSampleMask: type = ctx.dst->create(); value = ctx.dst->Bitcast(CreateASTTypeFor(ctx, type), value); break; diff --git a/src/tint/transform/canonicalize_entry_point_io.h b/src/tint/transform/canonicalize_entry_point_io.h index 64a10f2106..95f8b197df 100644 --- a/src/tint/transform/canonicalize_entry_point_io.h +++ b/src/tint/transform/canonicalize_entry_point_io.h @@ -34,7 +34,7 @@ namespace tint::transform { /// @location(2) loc2 : vec4; /// }; /// -/// @stage(fragment) +/// @fragment /// fn frag_main(@builtin(position) coord : vec4, /// locations : Locations) -> @location(0) f32 { /// if (coord.w > 1.0) { @@ -71,7 +71,7 @@ namespace tint::transform { /// return col; /// } /// -/// @stage(fragment) +/// @fragment /// fn frag_main(in : frag_main_in) -> frag_main_out { /// let inner_retval = frag_main_inner(in.coord, Locations(in.loc1, in.loc2)); /// var wrapper_result : frag_main_out; diff --git a/src/tint/transform/canonicalize_entry_point_io_test.cc b/src/tint/transform/canonicalize_entry_point_io_test.cc index d3fe95af2d..f2af21389d 100644 --- a/src/tint/transform/canonicalize_entry_point_io_test.cc +++ b/src/tint/transform/canonicalize_entry_point_io_test.cc @@ -38,11 +38,11 @@ TEST_F(CanonicalizeEntryPointIOTest, NoShaderIO) { // Test that we do not introduce wrapper functions when there is no shader IO // to process. auto* src = R"( -@stage(fragment) +@fragment fn frag_main() { } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main() { } )"; @@ -58,7 +58,7 @@ fn comp_main() { TEST_F(CanonicalizeEntryPointIOTest, Parameters_Spirv) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(@location(1) loc1 : f32, @location(2) @interpolate(flat) loc2 : vec4, @builtin(position) coord : vec4) { @@ -77,7 +77,7 @@ fn frag_main_inner(loc1 : f32, loc2 : vec4, coord : vec4) { var col : f32 = (coord.x * loc1); } -@stage(fragment) +@fragment fn frag_main() { frag_main_inner(loc1_1, loc2_1, coord_1); } @@ -92,7 +92,7 @@ fn frag_main() { TEST_F(CanonicalizeEntryPointIOTest, Parameters_Msl) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(@location(1) loc1 : f32, @location(2) @interpolate(flat) loc2 : vec4, @builtin(position) coord : vec4) { @@ -112,7 +112,7 @@ fn frag_main_inner(loc1 : f32, loc2 : vec4, coord : vec4) { var col : f32 = (coord.x * loc1); } -@stage(fragment) +@fragment fn frag_main(@builtin(position) coord : vec4, tint_symbol : tint_symbol_1) { frag_main_inner(tint_symbol.loc1, tint_symbol.loc2, coord); } @@ -127,7 +127,7 @@ fn frag_main(@builtin(position) coord : vec4, tint_symbol : tint_symbol_1) TEST_F(CanonicalizeEntryPointIOTest, Parameters_Hlsl) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(@location(1) loc1 : f32, @location(2) @interpolate(flat) loc2 : vec4, @builtin(position) coord : vec4) { @@ -149,7 +149,7 @@ fn frag_main_inner(loc1 : f32, loc2 : vec4, coord : vec4) { var col : f32 = (coord.x * loc1); } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) { frag_main_inner(tint_symbol.loc1, tint_symbol.loc2, tint_symbol.coord); } @@ -166,7 +166,7 @@ TEST_F(CanonicalizeEntryPointIOTest, Parameter_TypeAlias) { auto* src = R"( type myf32 = f32; -@stage(fragment) +@fragment fn frag_main(@location(1) loc1 : myf32) { var x : myf32 = loc1; } @@ -184,7 +184,7 @@ fn frag_main_inner(loc1 : myf32) { var x : myf32 = loc1; } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) { frag_main_inner(tint_symbol.loc1); } @@ -199,7 +199,7 @@ fn frag_main(tint_symbol : tint_symbol_1) { TEST_F(CanonicalizeEntryPointIOTest, Parameter_TypeAlias_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(@location(1) loc1 : myf32) { var x : myf32 = loc1; } @@ -217,7 +217,7 @@ fn frag_main_inner(loc1 : myf32) { var x : myf32 = loc1; } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) { frag_main_inner(tint_symbol.loc1); } @@ -242,7 +242,7 @@ struct FragLocations { @location(2) @interpolate(flat) loc2 : vec4, }; -@stage(fragment) +@fragment fn frag_main(@location(0) loc0 : f32, locations : FragLocations, builtins : FragBuiltins) { @@ -272,7 +272,7 @@ fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltin var col : f32 = ((builtins.coord.x * locations.loc1) + loc0); } -@stage(fragment) +@fragment fn frag_main() { frag_main_inner(loc0_1, FragLocations(loc1_1, loc2_1), FragBuiltins(coord_1)); } @@ -287,7 +287,7 @@ fn frag_main() { TEST_F(CanonicalizeEntryPointIOTest, StructParameters_Spirv_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(@location(0) loc0 : f32, locations : FragLocations, builtins : FragBuiltins) { @@ -316,7 +316,7 @@ fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltin var col : f32 = ((builtins.coord.x * locations.loc1) + loc0); } -@stage(fragment) +@fragment fn frag_main() { frag_main_inner(loc0_1, FragLocations(loc1_1, loc2_1), FragBuiltins(coord_1)); } @@ -348,7 +348,7 @@ struct FragLocations { @location(2) @interpolate(flat) loc2 : vec4, }; -@stage(fragment) +@fragment fn frag_main(@location(0) loc0 : f32, locations : FragLocations, builtins : FragBuiltins) { @@ -379,7 +379,7 @@ fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltin var col : f32 = ((builtins.coord.x * locations.loc1) + loc0); } -@stage(fragment) +@fragment fn frag_main(@builtin(position) coord : vec4, tint_symbol : tint_symbol_1) { frag_main_inner(tint_symbol.loc0, FragLocations(tint_symbol.loc1, tint_symbol.loc2), FragBuiltins(coord)); } @@ -394,7 +394,7 @@ fn frag_main(@builtin(position) coord : vec4, tint_symbol : tint_symbol_1) TEST_F(CanonicalizeEntryPointIOTest, StructParameters_kMsl_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(@location(0) loc0 : f32, locations : FragLocations, builtins : FragBuiltins) { @@ -424,7 +424,7 @@ fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltin var col : f32 = ((builtins.coord.x * locations.loc1) + loc0); } -@stage(fragment) +@fragment fn frag_main(@builtin(position) coord : vec4, tint_symbol : tint_symbol_1) { frag_main_inner(tint_symbol.loc0, FragLocations(tint_symbol.loc1, tint_symbol.loc2), FragBuiltins(coord)); } @@ -456,7 +456,7 @@ struct FragLocations { @location(2) @interpolate(flat) loc2 : vec4, }; -@stage(fragment) +@fragment fn frag_main(@location(0) loc0 : f32, locations : FragLocations, builtins : FragBuiltins) { @@ -489,7 +489,7 @@ fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltin var col : f32 = ((builtins.coord.x * locations.loc1) + loc0); } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) { frag_main_inner(tint_symbol.loc0, FragLocations(tint_symbol.loc1, tint_symbol.loc2), FragBuiltins(tint_symbol.coord)); } @@ -504,7 +504,7 @@ fn frag_main(tint_symbol : tint_symbol_1) { TEST_F(CanonicalizeEntryPointIOTest, StructParameters_Hlsl_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(@location(0) loc0 : f32, locations : FragLocations, builtins : FragBuiltins) { @@ -536,7 +536,7 @@ fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltin var col : f32 = ((builtins.coord.x * locations.loc1) + loc0); } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) { frag_main_inner(tint_symbol.loc0, FragLocations(tint_symbol.loc1, tint_symbol.loc2), FragBuiltins(tint_symbol.coord)); } @@ -560,7 +560,7 @@ struct FragLocations { TEST_F(CanonicalizeEntryPointIOTest, Return_NonStruct_Spirv) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> @builtin(frag_depth) f32 { return 1.0; } @@ -573,7 +573,7 @@ fn frag_main_inner() -> f32 { return 1.0; } -@stage(fragment) +@fragment fn frag_main() { let inner_result = frag_main_inner(); value = inner_result; @@ -589,7 +589,7 @@ fn frag_main() { TEST_F(CanonicalizeEntryPointIOTest, Return_NonStruct_Msl) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> @builtin(frag_depth) f32 { return 1.0; } @@ -605,7 +605,7 @@ fn frag_main_inner() -> f32 { return 1.0; } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -623,7 +623,7 @@ fn frag_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, Return_NonStruct_Hlsl) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> @builtin(frag_depth) f32 { return 1.0; } @@ -639,7 +639,7 @@ fn frag_main_inner() -> f32 { return 1.0; } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -663,7 +663,7 @@ struct FragOutput { @builtin(sample_mask) mask : u32, }; -@stage(fragment) +@fragment fn frag_main() -> FragOutput { var output : FragOutput; output.depth = 1.0; @@ -694,7 +694,7 @@ fn frag_main_inner() -> FragOutput { return output; } -@stage(fragment) +@fragment fn frag_main() { let inner_result = frag_main_inner(); color_1 = inner_result.color; @@ -712,7 +712,7 @@ fn frag_main() { TEST_F(CanonicalizeEntryPointIOTest, Return_Struct_Spirv_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> FragOutput { var output : FragOutput; output.depth = 1.0; @@ -743,7 +743,7 @@ fn frag_main_inner() -> FragOutput { return output; } -@stage(fragment) +@fragment fn frag_main() { let inner_result = frag_main_inner(); color_1 = inner_result.color; @@ -773,7 +773,7 @@ struct FragOutput { @builtin(sample_mask) mask : u32, }; -@stage(fragment) +@fragment fn frag_main() -> FragOutput { var output : FragOutput; output.depth = 1.0; @@ -807,7 +807,7 @@ fn frag_main_inner() -> FragOutput { return output; } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -827,7 +827,7 @@ fn frag_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, Return_Struct_Msl_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> FragOutput { var output : FragOutput; output.depth = 1.0; @@ -861,7 +861,7 @@ fn frag_main_inner() -> FragOutput { return output; } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -893,7 +893,7 @@ struct FragOutput { @builtin(sample_mask) mask : u32, }; -@stage(fragment) +@fragment fn frag_main() -> FragOutput { var output : FragOutput; output.depth = 1.0; @@ -927,7 +927,7 @@ fn frag_main_inner() -> FragOutput { return output; } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -947,7 +947,7 @@ fn frag_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, Return_Struct_Hlsl_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> FragOutput { var output : FragOutput; output.depth = 1.0; @@ -981,7 +981,7 @@ fn frag_main_inner() -> FragOutput { return output; } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -1016,12 +1016,12 @@ fn foo(x : FragmentInput) -> f32 { return x.value * x.mul; } -@stage(fragment) +@fragment fn frag_main1(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(inputs : FragmentInput) { var x : f32 = foo(inputs); } @@ -1049,7 +1049,7 @@ fn frag_main1_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main1() { frag_main1_inner(FragmentInput(value_1, mul_1)); } @@ -1058,7 +1058,7 @@ fn frag_main2_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2() { frag_main2_inner(FragmentInput(value_2, mul_2)); } @@ -1073,12 +1073,12 @@ fn frag_main2() { TEST_F(CanonicalizeEntryPointIOTest, StructParameters_SharedDeviceFunction_Spirv_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main1(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(inputs : FragmentInput) { var x : f32 = foo(inputs); } @@ -1106,7 +1106,7 @@ fn frag_main1_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main1() { frag_main1_inner(FragmentInput(value_1, mul_1)); } @@ -1115,7 +1115,7 @@ fn frag_main2_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2() { frag_main2_inner(FragmentInput(value_2, mul_2)); } @@ -1148,12 +1148,12 @@ fn foo(x : FragmentInput) -> f32 { return x.value * x.mul; } -@stage(fragment) +@fragment fn frag_main1(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(inputs : FragmentInput) { var x : f32 = foo(inputs); } @@ -1180,7 +1180,7 @@ fn frag_main1_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main1(tint_symbol : tint_symbol_1) { frag_main1_inner(FragmentInput(tint_symbol.value, tint_symbol.mul)); } @@ -1196,7 +1196,7 @@ fn frag_main2_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(tint_symbol_2 : tint_symbol_3) { frag_main2_inner(FragmentInput(tint_symbol_2.value, tint_symbol_2.mul)); } @@ -1211,12 +1211,12 @@ fn frag_main2(tint_symbol_2 : tint_symbol_3) { TEST_F(CanonicalizeEntryPointIOTest, StructParameters_SharedDeviceFunction_Msl_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main1(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(inputs : FragmentInput) { var x : f32 = foo(inputs); } @@ -1243,7 +1243,7 @@ fn frag_main1_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main1(tint_symbol : tint_symbol_1) { frag_main1_inner(FragmentInput(tint_symbol.value, tint_symbol.mul)); } @@ -1259,7 +1259,7 @@ fn frag_main2_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(tint_symbol_2 : tint_symbol_3) { frag_main2_inner(FragmentInput(tint_symbol_2.value, tint_symbol_2.mul)); } @@ -1292,12 +1292,12 @@ fn foo(x : FragmentInput) -> f32 { return x.value * x.mul; } -@stage(fragment) +@fragment fn frag_main1(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(inputs : FragmentInput) { var x : f32 = foo(inputs); } @@ -1324,7 +1324,7 @@ fn frag_main1_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main1(tint_symbol : tint_symbol_1) { frag_main1_inner(FragmentInput(tint_symbol.value, tint_symbol.mul)); } @@ -1340,7 +1340,7 @@ fn frag_main2_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(tint_symbol_2 : tint_symbol_3) { frag_main2_inner(FragmentInput(tint_symbol_2.value, tint_symbol_2.mul)); } @@ -1355,12 +1355,12 @@ fn frag_main2(tint_symbol_2 : tint_symbol_3) { TEST_F(CanonicalizeEntryPointIOTest, StructParameters_SharedDeviceFunction_Hlsl_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main1(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(inputs : FragmentInput) { var x : f32 = foo(inputs); } @@ -1387,7 +1387,7 @@ fn frag_main1_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main1(tint_symbol : tint_symbol_1) { frag_main1_inner(FragmentInput(tint_symbol.value, tint_symbol.mul)); } @@ -1403,7 +1403,7 @@ fn frag_main2_inner(inputs : FragmentInput) { var x : f32 = foo(inputs); } -@stage(fragment) +@fragment fn frag_main2(tint_symbol_2 : tint_symbol_3) { frag_main2_inner(FragmentInput(tint_symbol_2.value, tint_symbol_2.mul)); } @@ -1442,7 +1442,7 @@ fn bar() -> f32 { return global_inputs.col2 * 2.0; } -@stage(fragment) +@fragment fn frag_main1(inputs : FragmentInput) { global_inputs = inputs; var r : f32 = foo(); @@ -1479,7 +1479,7 @@ fn frag_main1_inner(inputs : FragmentInput) { var g : f32 = bar(); } -@stage(fragment) +@fragment fn frag_main1(tint_symbol : tint_symbol_1) { frag_main1_inner(FragmentInput(tint_symbol.col1, tint_symbol.col2)); } @@ -1494,7 +1494,7 @@ fn frag_main1(tint_symbol : tint_symbol_1) { TEST_F(CanonicalizeEntryPointIOTest, Struct_ModuleScopeVariable_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main1(inputs : FragmentInput) { global_inputs = inputs; var r : f32 = foo(); @@ -1531,7 +1531,7 @@ fn frag_main1_inner(inputs : FragmentInput) { var g : f32 = bar(); } -@stage(fragment) +@fragment fn frag_main1(tint_symbol : tint_symbol_1) { frag_main1_inner(FragmentInput(tint_symbol.col1, tint_symbol.col2)); } @@ -1581,7 +1581,7 @@ fn foo(x : MyFragmentInput) -> myf32 { return x.col1; } -@stage(fragment) +@fragment fn frag_main(inputs : MyFragmentInput) -> MyFragmentOutput { var x : myf32 = foo(inputs); return MyFragmentOutput(x, inputs.col2); @@ -1628,7 +1628,7 @@ fn frag_main_inner(inputs : MyFragmentInput) -> MyFragmentOutput { return MyFragmentOutput(x, inputs.col2); } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { let inner_result = frag_main_inner(MyFragmentInput(tint_symbol.col1, tint_symbol.col2)); var wrapper_result : tint_symbol_2; @@ -1647,7 +1647,7 @@ fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { TEST_F(CanonicalizeEntryPointIOTest, Struct_TypeAliases_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(inputs : MyFragmentInput) -> MyFragmentOutput { var x : myf32 = foo(inputs); return MyFragmentOutput(x, inputs.col2); @@ -1694,7 +1694,7 @@ fn frag_main_inner(inputs : MyFragmentInput) -> MyFragmentOutput { return MyFragmentOutput(x, inputs.col2); } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { let inner_result = frag_main_inner(MyFragmentInput(tint_symbol.col1, tint_symbol.col2)); var wrapper_result : tint_symbol_2; @@ -1745,12 +1745,12 @@ struct FragmentIn { @location(2) @interpolate(linear, sample) loc2 : f32, }; -@stage(vertex) +@vertex fn vert_main() -> VertexOut { return VertexOut(); } -@stage(fragment) +@fragment fn frag_main(inputs : FragmentIn, @location(3) @interpolate(perspective, centroid) loc3 : f32) { let x = inputs.loc1 + inputs.loc2 + loc3; @@ -1785,7 +1785,7 @@ fn vert_main_inner() -> VertexOut { return VertexOut(); } -@stage(vertex) +@vertex fn vert_main() -> tint_symbol { let inner_result = vert_main_inner(); var wrapper_result : tint_symbol; @@ -1809,7 +1809,7 @@ fn frag_main_inner(inputs : FragmentIn, loc3 : f32) { let x = ((inputs.loc1 + inputs.loc2) + loc3); } -@stage(fragment) +@fragment fn frag_main(tint_symbol_1 : tint_symbol_2) { frag_main_inner(FragmentIn(tint_symbol_1.loc1, tint_symbol_1.loc2), tint_symbol_1.loc3); } @@ -1824,13 +1824,13 @@ fn frag_main(tint_symbol_1 : tint_symbol_2) { TEST_F(CanonicalizeEntryPointIOTest, InterpolateAttributes_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(inputs : FragmentIn, @location(3) @interpolate(perspective, centroid) loc3 : f32) { let x = inputs.loc1 + inputs.loc2 + loc3; } -@stage(vertex) +@vertex fn vert_main() -> VertexOut { return VertexOut(); } @@ -1862,7 +1862,7 @@ fn frag_main_inner(inputs : FragmentIn, loc3 : f32) { let x = ((inputs.loc1 + inputs.loc2) + loc3); } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) { frag_main_inner(FragmentIn(tint_symbol.loc1, tint_symbol.loc2), tint_symbol.loc3); } @@ -1882,7 +1882,7 @@ fn vert_main_inner() -> VertexOut { return VertexOut(); } -@stage(vertex) +@vertex fn vert_main() -> tint_symbol_2 { let inner_result = vert_main_inner(); var wrapper_result : tint_symbol_2; @@ -1939,12 +1939,12 @@ struct FragmentInterface { @location(3) @interpolate(flat) vu : vec4, }; -@stage(vertex) +@vertex fn vert_main(in : VertexIn) -> VertexOut { return VertexOut(in.i, in.u, in.vi, in.vu, vec4()); } -@stage(fragment) +@fragment fn frag_main(inputs : FragmentInterface) -> FragmentInterface { return inputs; } @@ -1978,13 +1978,13 @@ fn frag_main(inputs : FragmentInterface) -> FragmentInterface { @location(3) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var vu_3 : vec4; -@location(0) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var i_4 : i32; +@location(0) @internal(disable_validation__ignore_storage_class) var i_4 : i32; -@location(1) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var u_4 : u32; +@location(1) @internal(disable_validation__ignore_storage_class) var u_4 : u32; -@location(2) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var vi_4 : vec4; +@location(2) @internal(disable_validation__ignore_storage_class) var vi_4 : vec4; -@location(3) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var vu_4 : vec4; +@location(3) @internal(disable_validation__ignore_storage_class) var vu_4 : vec4; struct VertexIn { i : i32, @@ -2012,7 +2012,7 @@ fn vert_main_inner(in : VertexIn) -> VertexOut { return VertexOut(in.i, in.u, in.vi, in.vu, vec4()); } -@stage(vertex) +@vertex fn vert_main() { let inner_result = vert_main_inner(VertexIn(i_1, u_1, vi_1, vu_1)); i_2 = inner_result.i; @@ -2026,7 +2026,7 @@ fn frag_main_inner(inputs : FragmentInterface) -> FragmentInterface { return inputs; } -@stage(fragment) +@fragment fn frag_main() { let inner_result_1 = frag_main_inner(FragmentInterface(i_3, u_3, vi_3, vu_3)); i_4 = inner_result_1.i; @@ -2047,12 +2047,12 @@ TEST_F(CanonicalizeEntryPointIOTest, InterpolateAttributes_Integers_Spirv_OutOfO // Test that we add a Flat attribute to integers that are vertex outputs and // fragment inputs, but not vertex inputs or fragment outputs. auto* src = R"( -@stage(vertex) +@vertex fn vert_main(in : VertexIn) -> VertexOut { return VertexOut(in.i, in.u, in.vi, in.vu, vec4()); } -@stage(fragment) +@fragment fn frag_main(inputs : FragmentInterface) -> FragmentInterface { return inputs; } @@ -2108,19 +2108,19 @@ struct FragmentInterface { @location(3) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var vu_3 : vec4; -@location(0) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var i_4 : i32; +@location(0) @internal(disable_validation__ignore_storage_class) var i_4 : i32; -@location(1) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var u_4 : u32; +@location(1) @internal(disable_validation__ignore_storage_class) var u_4 : u32; -@location(2) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var vi_4 : vec4; +@location(2) @internal(disable_validation__ignore_storage_class) var vi_4 : vec4; -@location(3) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var vu_4 : vec4; +@location(3) @internal(disable_validation__ignore_storage_class) var vu_4 : vec4; fn vert_main_inner(in : VertexIn) -> VertexOut { return VertexOut(in.i, in.u, in.vi, in.vu, vec4()); } -@stage(vertex) +@vertex fn vert_main() { let inner_result = vert_main_inner(VertexIn(i_1, u_1, vi_1, vu_1)); i_2 = inner_result.i; @@ -2134,7 +2134,7 @@ fn frag_main_inner(inputs : FragmentInterface) -> FragmentInterface { return inputs; } -@stage(fragment) +@fragment fn frag_main() { let inner_result_1 = frag_main_inner(FragmentInterface(i_3, u_3, vi_3, vu_3)); i_4 = inner_result_1.i; @@ -2179,12 +2179,12 @@ struct VertexOut { @builtin(position) @invariant pos : vec4, }; -@stage(vertex) +@vertex fn main1() -> VertexOut { return VertexOut(); } -@stage(vertex) +@vertex fn main2() -> @builtin(position) @invariant vec4 { return vec4(); } @@ -2204,7 +2204,7 @@ fn main1_inner() -> VertexOut { return VertexOut(); } -@stage(vertex) +@vertex fn main1() -> tint_symbol { let inner_result = main1_inner(); var wrapper_result : tint_symbol; @@ -2221,7 +2221,7 @@ fn main2_inner() -> vec4 { return vec4(); } -@stage(vertex) +@vertex fn main2() -> tint_symbol_1 { let inner_result_1 = main2_inner(); var wrapper_result_1 : tint_symbol_1; @@ -2239,12 +2239,12 @@ fn main2() -> tint_symbol_1 { TEST_F(CanonicalizeEntryPointIOTest, InvariantAttributes_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn main1() -> VertexOut { return VertexOut(); } -@stage(vertex) +@vertex fn main2() -> @builtin(position) @invariant vec4 { return vec4(); } @@ -2264,7 +2264,7 @@ fn main1_inner() -> VertexOut { return VertexOut(); } -@stage(vertex) +@vertex fn main1() -> tint_symbol { let inner_result = main1_inner(); var wrapper_result : tint_symbol; @@ -2281,7 +2281,7 @@ fn main2_inner() -> vec4 { return vec4(); } -@stage(vertex) +@vertex fn main2() -> tint_symbol_1 { let inner_result_1 = main2_inner(); var wrapper_result_1 : tint_symbol_1; @@ -2313,7 +2313,7 @@ struct FragmentOutput { @size(16) @location(1) @interpolate(flat) value : f32, }; -@stage(fragment) +@fragment fn frag_main(inputs : FragmentInput) -> FragmentOutput { return FragmentOutput(inputs.coord.x * inputs.value + inputs.loc0); } @@ -2344,7 +2344,7 @@ struct tint_symbol_1 { } struct tint_symbol_2 { - @location(1) @interpolate(flat) + @location(1) value : f32, } @@ -2352,7 +2352,7 @@ fn frag_main_inner(inputs : FragmentInput) -> FragmentOutput { return FragmentOutput(((inputs.coord.x * inputs.value) + inputs.loc0)); } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { let inner_result = frag_main_inner(FragmentInput(tint_symbol.value, tint_symbol.coord, tint_symbol.loc0)); var wrapper_result : tint_symbol_2; @@ -2370,7 +2370,7 @@ fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { TEST_F(CanonicalizeEntryPointIOTest, Struct_LayoutAttributes_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main(inputs : FragmentInput) -> FragmentOutput { return FragmentOutput(inputs.coord.x * inputs.value + inputs.loc0); } @@ -2397,7 +2397,7 @@ struct tint_symbol_1 { } struct tint_symbol_2 { - @location(1) @interpolate(flat) + @location(1) value : f32, } @@ -2405,7 +2405,7 @@ fn frag_main_inner(inputs : FragmentInput) -> FragmentOutput { return FragmentOutput(((inputs.coord.x * inputs.value) + inputs.loc0)); } -@stage(fragment) +@fragment fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { let inner_result = frag_main_inner(FragmentInput(tint_symbol.value, tint_symbol.coord, tint_symbol.loc0)); var wrapper_result : tint_symbol_2; @@ -2451,12 +2451,12 @@ struct FragmentInputExtra { @location(0) a : f32, }; -@stage(vertex) +@vertex fn vert_main() -> VertexOutput { return VertexOutput(); } -@stage(fragment) +@fragment fn frag_main(@builtin(front_facing) ff : bool, @location(2) @interpolate(flat) c : i32, inputs : FragmentInputExtra, @@ -2496,7 +2496,7 @@ fn vert_main_inner() -> VertexOutput { return VertexOutput(); } -@stage(vertex) +@vertex fn vert_main() -> tint_symbol { let inner_result = vert_main_inner(); var wrapper_result : tint_symbol; @@ -2526,7 +2526,7 @@ struct tint_symbol_2 { fn frag_main_inner(ff : bool, c : i32, inputs : FragmentInputExtra, b : u32) { } -@stage(fragment) +@fragment fn frag_main(tint_symbol_1 : tint_symbol_2) { frag_main_inner(tint_symbol_1.ff, tint_symbol_1.c, FragmentInputExtra(tint_symbol_1.d, tint_symbol_1.pos, tint_symbol_1.a), tint_symbol_1.b); } @@ -2541,12 +2541,12 @@ fn frag_main(tint_symbol_1 : tint_symbol_2) { TEST_F(CanonicalizeEntryPointIOTest, SortedMembers_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn vert_main() -> VertexOutput { return VertexOutput(); } -@stage(fragment) +@fragment fn frag_main(@builtin(front_facing) ff : bool, @location(2) @interpolate(flat) c : i32, inputs : FragmentInputExtra, @@ -2586,7 +2586,7 @@ fn vert_main_inner() -> VertexOutput { return VertexOutput(); } -@stage(vertex) +@vertex fn vert_main() -> tint_symbol { let inner_result = vert_main_inner(); var wrapper_result : tint_symbol; @@ -2616,7 +2616,7 @@ struct tint_symbol_2 { fn frag_main_inner(ff : bool, c : i32, inputs : FragmentInputExtra, b : u32) { } -@stage(fragment) +@fragment fn frag_main(tint_symbol_1 : tint_symbol_2) { frag_main_inner(tint_symbol_1.ff, tint_symbol_1.c, FragmentInputExtra(tint_symbol_1.d, tint_symbol_1.pos, tint_symbol_1.a), tint_symbol_1.b); } @@ -2645,7 +2645,7 @@ struct FragmentInputExtra { TEST_F(CanonicalizeEntryPointIOTest, DontRenameSymbols) { auto* src = R"( -@stage(fragment) +@fragment fn tint_symbol_1(@location(0) col : f32) { } )"; @@ -2659,7 +2659,7 @@ struct tint_symbol_2 { fn tint_symbol_1_inner(col : f32) { } -@stage(fragment) +@fragment fn tint_symbol_1(tint_symbol : tint_symbol_2) { tint_symbol_1_inner(tint_symbol.col); } @@ -2674,7 +2674,7 @@ fn tint_symbol_1(tint_symbol : tint_symbol_2) { TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_VoidNoReturn) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() { } )"; @@ -2688,7 +2688,7 @@ struct tint_symbol { fn frag_main_inner() { } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { frag_main_inner(); var wrapper_result : tint_symbol; @@ -2706,7 +2706,7 @@ fn frag_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_VoidWithReturn) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() { return; } @@ -2722,7 +2722,7 @@ fn frag_main_inner() { return; } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { frag_main_inner(); var wrapper_result : tint_symbol; @@ -2740,7 +2740,7 @@ fn frag_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_WithAuthoredMask) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> @builtin(sample_mask) u32 { return 7u; } @@ -2756,7 +2756,7 @@ fn frag_main_inner() -> u32 { return 7u; } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -2774,7 +2774,7 @@ fn frag_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_WithoutAuthoredMask) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> @location(0) f32 { return 1.0; } @@ -2792,7 +2792,7 @@ fn frag_main_inner() -> f32 { return 1.0; } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -2817,7 +2817,7 @@ struct Output { @location(0) value : f32, }; -@stage(fragment) +@fragment fn frag_main() -> Output { return Output(0.5, 7u, 1.0); } @@ -2843,7 +2843,7 @@ fn frag_main_inner() -> Output { return Output(0.5, 7u, 1.0); } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -2863,7 +2863,7 @@ fn frag_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_StructWithAuthoredMask_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> Output { return Output(0.5, 7u, 1.0); } @@ -2889,7 +2889,7 @@ fn frag_main_inner() -> Output { return Output(0.5, 7u, 1.0); } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -2920,7 +2920,7 @@ struct Output { @location(0) value : f32, }; -@stage(fragment) +@fragment fn frag_main() -> Output { return Output(0.5, 1.0); } @@ -2945,7 +2945,7 @@ fn frag_main_inner() -> Output { return Output(0.5, 1.0); } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -2965,7 +2965,7 @@ fn frag_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_StructWithoutAuthoredMask_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main() -> Output { return Output(0.5, 1.0); } @@ -2990,7 +2990,7 @@ fn frag_main_inner() -> Output { return Output(0.5, 1.0); } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -3015,22 +3015,22 @@ struct Output { TEST_F(CanonicalizeEntryPointIOTest, FixedSampleMask_MultipleShaders) { auto* src = R"( -@stage(fragment) +@fragment fn frag_main1() -> @builtin(sample_mask) u32 { return 7u; } -@stage(fragment) +@fragment fn frag_main2() -> @location(0) f32 { return 1.0; } -@stage(vertex) +@vertex fn vert_main1() -> @builtin(position) vec4 { return vec4(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { } )"; @@ -3045,7 +3045,7 @@ fn frag_main1_inner() -> u32 { return 7u; } -@stage(fragment) +@fragment fn frag_main1() -> tint_symbol { let inner_result = frag_main1_inner(); var wrapper_result : tint_symbol; @@ -3064,7 +3064,7 @@ fn frag_main2_inner() -> f32 { return 1.0; } -@stage(fragment) +@fragment fn frag_main2() -> tint_symbol_1 { let inner_result_1 = frag_main2_inner(); var wrapper_result_1 : tint_symbol_1; @@ -3082,7 +3082,7 @@ fn vert_main1_inner() -> vec4 { return vec4(); } -@stage(vertex) +@vertex fn vert_main1() -> tint_symbol_2 { let inner_result_2 = vert_main1_inner(); var wrapper_result_2 : tint_symbol_2; @@ -3090,7 +3090,7 @@ fn vert_main1() -> tint_symbol_2 { return wrapper_result_2; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { } )"; @@ -3109,7 +3109,7 @@ struct FragOut { @location(1) fixed_sample_mask_1 : vec4, }; -@stage(fragment) +@fragment fn frag_main() -> FragOut { return FragOut(); } @@ -3134,7 +3134,7 @@ fn frag_main_inner() -> FragOut { return FragOut(); } -@stage(fragment) +@fragment fn frag_main() -> tint_symbol { let inner_result = frag_main_inner(); var wrapper_result : tint_symbol; @@ -3154,7 +3154,7 @@ fn frag_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_ReturnNonStruct_Spirv) { auto* src = R"( -@stage(vertex) +@vertex fn vert_main() -> @builtin(position) vec4 { return vec4(); } @@ -3163,17 +3163,17 @@ fn vert_main() -> @builtin(position) vec4 { auto* expect = R"( @builtin(position) @internal(disable_validation__ignore_storage_class) var value : vec4; -@builtin(pointsize) @internal(disable_validation__ignore_storage_class) var vertex_point_size : f32; +@builtin(point_size) @internal(disable_validation__ignore_storage_class) var vertex_point_size : f32; fn vert_main_inner() -> vec4 { return vec4(); } -@stage(vertex) +@vertex fn vert_main() { let inner_result = vert_main_inner(); value = inner_result; - vertex_point_size = 1.0; + vertex_point_size = 1.0f; } )"; @@ -3187,7 +3187,7 @@ fn vert_main() { TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_ReturnNonStruct_Msl) { auto* src = R"( -@stage(vertex) +@vertex fn vert_main() -> @builtin(position) vec4 { return vec4(); } @@ -3197,7 +3197,7 @@ fn vert_main() -> @builtin(position) vec4 { struct tint_symbol { @builtin(position) value : vec4, - @builtin(pointsize) + @builtin(point_size) vertex_point_size : f32, } @@ -3205,12 +3205,12 @@ fn vert_main_inner() -> vec4 { return vec4(); } -@stage(vertex) +@vertex fn vert_main() -> tint_symbol { let inner_result = vert_main_inner(); var wrapper_result : tint_symbol; wrapper_result.value = inner_result; - wrapper_result.vertex_point_size = 1.0; + wrapper_result.vertex_point_size = 1.0f; return wrapper_result; } )"; @@ -3229,7 +3229,7 @@ struct VertOut { @builtin(position) pos : vec4, }; -@stage(vertex) +@vertex fn vert_main() -> VertOut { return VertOut(); } @@ -3238,7 +3238,7 @@ fn vert_main() -> VertOut { auto* expect = R"( @builtin(position) @internal(disable_validation__ignore_storage_class) var pos_1 : vec4; -@builtin(pointsize) @internal(disable_validation__ignore_storage_class) var vertex_point_size : f32; +@builtin(point_size) @internal(disable_validation__ignore_storage_class) var vertex_point_size : f32; struct VertOut { pos : vec4, @@ -3248,11 +3248,11 @@ fn vert_main_inner() -> VertOut { return VertOut(); } -@stage(vertex) +@vertex fn vert_main() { let inner_result = vert_main_inner(); pos_1 = inner_result.pos; - vertex_point_size = 1.0; + vertex_point_size = 1.0f; } )"; @@ -3266,7 +3266,7 @@ fn vert_main() { TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_ReturnStruct_Spirv_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn vert_main() -> VertOut { return VertOut(); } @@ -3279,17 +3279,17 @@ struct VertOut { auto* expect = R"( @builtin(position) @internal(disable_validation__ignore_storage_class) var pos_1 : vec4; -@builtin(pointsize) @internal(disable_validation__ignore_storage_class) var vertex_point_size : f32; +@builtin(point_size) @internal(disable_validation__ignore_storage_class) var vertex_point_size : f32; fn vert_main_inner() -> VertOut { return VertOut(); } -@stage(vertex) +@vertex fn vert_main() { let inner_result = vert_main_inner(); pos_1 = inner_result.pos; - vertex_point_size = 1.0; + vertex_point_size = 1.0f; } struct VertOut { @@ -3311,7 +3311,7 @@ struct VertOut { @builtin(position) pos : vec4, }; -@stage(vertex) +@vertex fn vert_main() -> VertOut { return VertOut(); } @@ -3325,7 +3325,7 @@ struct VertOut { struct tint_symbol { @builtin(position) pos : vec4, - @builtin(pointsize) + @builtin(point_size) vertex_point_size : f32, } @@ -3333,12 +3333,12 @@ fn vert_main_inner() -> VertOut { return VertOut(); } -@stage(vertex) +@vertex fn vert_main() -> tint_symbol { let inner_result = vert_main_inner(); var wrapper_result : tint_symbol; wrapper_result.pos = inner_result.pos; - wrapper_result.vertex_point_size = 1.0; + wrapper_result.vertex_point_size = 1.0f; return wrapper_result; } )"; @@ -3353,7 +3353,7 @@ fn vert_main() -> tint_symbol { TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_ReturnStruct_Msl_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn vert_main() -> VertOut { return VertOut(); } @@ -3367,7 +3367,7 @@ struct VertOut { struct tint_symbol { @builtin(position) pos : vec4, - @builtin(pointsize) + @builtin(point_size) vertex_point_size : f32, } @@ -3375,12 +3375,12 @@ fn vert_main_inner() -> VertOut { return VertOut(); } -@stage(vertex) +@vertex fn vert_main() -> tint_symbol { let inner_result = vert_main_inner(); var wrapper_result : tint_symbol; wrapper_result.pos = inner_result.pos; - wrapper_result.vertex_point_size = 1.0; + wrapper_result.vertex_point_size = 1.0f; return wrapper_result; } @@ -3416,7 +3416,7 @@ struct VertOut { @builtin(position) vertex_point_size_1 : vec4, }; -@stage(vertex) +@vertex fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = collide.collide + collide_1.collide; return VertOut(); @@ -3432,7 +3432,7 @@ fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut { @builtin(position) @internal(disable_validation__ignore_storage_class) var vertex_point_size_1_1 : vec4; -@builtin(pointsize) @internal(disable_validation__ignore_storage_class) var vertex_point_size_4 : f32; +@builtin(point_size) @internal(disable_validation__ignore_storage_class) var vertex_point_size_4 : f32; var vertex_point_size : f32; @@ -3458,12 +3458,12 @@ fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut { return VertOut(); } -@stage(vertex) +@vertex fn vert_main() { let inner_result = vert_main_inner(VertIn1(collide_2), VertIn2(collide_3)); vertex_point_size_3 = inner_result.vertex_point_size; vertex_point_size_1_1 = inner_result.vertex_point_size_1; - vertex_point_size_4 = 1.0; + vertex_point_size_4 = 1.0f; } )"; @@ -3477,7 +3477,7 @@ fn vert_main() { TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_AvoidNameClash_Spirv_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = collide.collide + collide_1.collide; return VertOut(); @@ -3510,19 +3510,19 @@ struct VertOut { @builtin(position) @internal(disable_validation__ignore_storage_class) var vertex_point_size_1_1 : vec4; -@builtin(pointsize) @internal(disable_validation__ignore_storage_class) var vertex_point_size_4 : f32; +@builtin(point_size) @internal(disable_validation__ignore_storage_class) var vertex_point_size_4 : f32; fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = (collide.collide + collide_1.collide); return VertOut(); } -@stage(vertex) +@vertex fn vert_main() { let inner_result = vert_main_inner(VertIn1(collide_2), VertIn2(collide_3)); vertex_point_size_3 = inner_result.vertex_point_size; vertex_point_size_1_1 = inner_result.vertex_point_size_1; - vertex_point_size_4 = 1.0; + vertex_point_size_4 = 1.0f; } struct VertIn1 { @@ -3568,7 +3568,7 @@ struct VertOut { @builtin(position) vertex_point_size_1 : vec4, }; -@stage(vertex) +@vertex fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = collide.collide + collide_1.collide; return VertOut(); @@ -3601,7 +3601,7 @@ struct tint_symbol_2 { vertex_point_size : vec4, @builtin(position) vertex_point_size_1 : vec4, - @builtin(pointsize) + @builtin(point_size) vertex_point_size_2 : f32, } @@ -3610,13 +3610,13 @@ fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut { return VertOut(); } -@stage(vertex) +@vertex fn vert_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { let inner_result = vert_main_inner(VertIn1(tint_symbol.collide), VertIn2(tint_symbol.collide_2)); var wrapper_result : tint_symbol_2; wrapper_result.vertex_point_size = inner_result.vertex_point_size; wrapper_result.vertex_point_size_1 = inner_result.vertex_point_size_1; - wrapper_result.vertex_point_size_2 = 1.0; + wrapper_result.vertex_point_size_2 = 1.0f; return wrapper_result; } )"; @@ -3631,7 +3631,7 @@ fn vert_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_AvoidNameClash_Msl_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = collide.collide + collide_1.collide; return VertOut(); @@ -3664,7 +3664,7 @@ struct tint_symbol_2 { vertex_point_size : vec4, @builtin(position) vertex_point_size_1 : vec4, - @builtin(pointsize) + @builtin(point_size) vertex_point_size_2 : f32, } @@ -3673,13 +3673,13 @@ fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut { return VertOut(); } -@stage(vertex) +@vertex fn vert_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { let inner_result = vert_main_inner(VertIn1(tint_symbol.collide), VertIn2(tint_symbol.collide_2)); var wrapper_result : tint_symbol_2; wrapper_result.vertex_point_size = inner_result.vertex_point_size; wrapper_result.vertex_point_size_1 = inner_result.vertex_point_size_1; - wrapper_result.vertex_point_size_2 = 1.0; + wrapper_result.vertex_point_size_2 = 1.0f; return wrapper_result; } @@ -3720,7 +3720,7 @@ struct VertOut { @builtin(position) vertex_point_size_1 : vec4, }; -@stage(vertex) +@vertex fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = collide.collide + collide_1.collide; return VertOut(); @@ -3753,7 +3753,7 @@ struct tint_symbol_2 { vertex_point_size : vec4, @builtin(position) vertex_point_size_1 : vec4, - @builtin(pointsize) + @builtin(point_size) vertex_point_size_2 : f32, } @@ -3762,13 +3762,13 @@ fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut { return VertOut(); } -@stage(vertex) +@vertex fn vert_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { let inner_result = vert_main_inner(VertIn1(tint_symbol.collide), VertIn2(tint_symbol.collide_2)); var wrapper_result : tint_symbol_2; wrapper_result.vertex_point_size = inner_result.vertex_point_size; wrapper_result.vertex_point_size_1 = inner_result.vertex_point_size_1; - wrapper_result.vertex_point_size_2 = 1.0; + wrapper_result.vertex_point_size_2 = 1.0f; return wrapper_result; } )"; @@ -3783,7 +3783,7 @@ fn vert_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { TEST_F(CanonicalizeEntryPointIOTest, EmitVertexPointSize_AvoidNameClash_Hlsl_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut { let x = collide.collide + collide_1.collide; return VertOut(); @@ -3816,7 +3816,7 @@ struct tint_symbol_2 { vertex_point_size : vec4, @builtin(position) vertex_point_size_1 : vec4, - @builtin(pointsize) + @builtin(point_size) vertex_point_size_2 : f32, } @@ -3825,13 +3825,13 @@ fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut { return VertOut(); } -@stage(vertex) +@vertex fn vert_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 { let inner_result = vert_main_inner(VertIn1(tint_symbol.collide), VertIn2(tint_symbol.collide_2)); var wrapper_result : tint_symbol_2; wrapper_result.vertex_point_size = inner_result.vertex_point_size; wrapper_result.vertex_point_size_1 = inner_result.vertex_point_size_1; - wrapper_result.vertex_point_size_2 = 1.0; + wrapper_result.vertex_point_size_2 = 1.0f; return wrapper_result; } @@ -3859,7 +3859,7 @@ struct VertOut { TEST_F(CanonicalizeEntryPointIOTest, SpirvSampleMaskBuiltins) { auto* src = R"( -@stage(fragment) +@fragment fn main(@builtin(sample_index) sample_index : u32, @builtin(sample_mask) mask_in : u32 ) -> @builtin(sample_mask) u32 { @@ -3868,9 +3868,9 @@ fn main(@builtin(sample_index) sample_index : u32, )"; auto* expect = R"( -@builtin(sample_index) @internal(disable_validation__ignore_storage_class) var sample_index_1 : u32; +@builtin(sample_index) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var sample_index_1 : u32; -@builtin(sample_mask) @internal(disable_validation__ignore_storage_class) var mask_in_1 : array; +@builtin(sample_mask) @interpolate(flat) @internal(disable_validation__ignore_storage_class) var mask_in_1 : array; @builtin(sample_mask) @internal(disable_validation__ignore_storage_class) var value : array; @@ -3878,7 +3878,7 @@ fn main_inner(sample_index : u32, mask_in : u32) -> u32 { return mask_in; } -@stage(fragment) +@fragment fn main() { let inner_result = main_inner(sample_index_1, mask_in_1[0i]); value[0i] = inner_result; @@ -3894,7 +3894,7 @@ fn main() { TEST_F(CanonicalizeEntryPointIOTest, GLSLSampleMaskBuiltins) { auto* src = R"( -@stage(fragment) +@fragment fn fragment_main(@builtin(sample_index) sample_index : u32, @builtin(sample_mask) mask_in : u32 ) -> @builtin(sample_mask) u32 { @@ -3913,7 +3913,7 @@ fn fragment_main(sample_index : u32, mask_in : u32) -> u32 { return mask_in; } -@stage(fragment) +@fragment fn main() { let inner_result = fragment_main(bitcast(gl_SampleID), bitcast(gl_SampleMaskIn[0i])); gl_SampleMask[0i] = bitcast(inner_result); @@ -3929,7 +3929,7 @@ fn main() { TEST_F(CanonicalizeEntryPointIOTest, GLSLVertexInstanceIndexBuiltins) { auto* src = R"( -@stage(vertex) +@vertex fn vertex_main(@builtin(vertex_index) vertexID : u32, @builtin(instance_index) instanceID : u32 ) -> @builtin(position) vec4 { @@ -3948,12 +3948,12 @@ fn vertex_main(vertexID : u32, instanceID : u32) -> vec4 { return vec4((f32(vertexID) + f32(instanceID))); } -@stage(vertex) +@vertex fn main() { let inner_result = vertex_main(bitcast(gl_VertexID), bitcast(gl_InstanceID)); gl_Position = inner_result; gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0 * gl_Position.z) - gl_Position.w); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); } )"; diff --git a/src/tint/transform/combine_samplers.cc b/src/tint/transform/combine_samplers.cc index 66b5b93768..6290b26490 100644 --- a/src/tint/transform/combine_samplers.cc +++ b/src/tint/transform/combine_samplers.cc @@ -19,6 +19,7 @@ #include #include +#include "src/tint/program_builder.h" #include "src/tint/sem/function.h" #include "src/tint/sem/statement.h" @@ -77,9 +78,9 @@ struct CombineSamplers::State { /// Group and binding attributes used by all combined sampler globals. /// Group 0 and binding 0 are used, with collisions disabled. /// @returns the newly-created attribute list - ast::AttributeList Attributes() const { - auto attributes = ctx.dst->GroupAndBinding(0, 0); - attributes.push_back(ctx.dst->Disable(ast::DisabledValidation::kBindingPointCollision)); + auto Attributes() const { + utils::Vector attributes{ctx.dst->Group(0), ctx.dst->Binding(0)}; + attributes.Push(ctx.dst->Disable(ast::DisabledValidation::kBindingPointCollision)); return attributes; } @@ -109,7 +110,7 @@ struct CombineSamplers::State { } const ast::Type* type = CreateCombinedASTTypeFor(texture_var, sampler_var); Symbol symbol = ctx.dst->Symbols().New(name); - return ctx.dst->Global(symbol, type, Attributes()); + return ctx.dst->GlobalVar(symbol, type, Attributes()); } /// Creates placeholder global sampler variables. @@ -121,7 +122,7 @@ struct CombineSamplers::State { ? "placeholder_comparison_sampler" : "placeholder_sampler"; Symbol symbol = ctx.dst->Symbols().New(name); - return ctx.dst->Global(symbol, type, Attributes()); + return ctx.dst->GlobalVar(symbol, type, Attributes()); } /// Creates ast::Type for a given texture and sampler variable pair. @@ -147,16 +148,18 @@ struct CombineSamplers::State { // Remove all texture and sampler global variables. These will be replaced // by combined samplers. - for (auto* var : ctx.src->AST().GlobalVariables()) { - auto* type = sem.Get(var->type); - if (type && type->IsAnyOf() && + for (auto* global : ctx.src->AST().GlobalVariables()) { + auto* global_sem = sem.Get(global)->As(); + auto* type = sem.Get(global->type); + if (tint::IsAnyOf(type) && !type->Is()) { - ctx.Remove(ctx.src->AST().GlobalDeclarations(), var); - } else if (auto binding_point = var->BindingPoint()) { - if (binding_point.group->value == 0 && binding_point.binding->value == 0) { + ctx.Remove(ctx.src->AST().GlobalDeclarations(), global); + } else if (global->HasBindingPoint()) { + auto binding_point = global_sem->BindingPoint(); + if (binding_point.group == 0 && binding_point.binding == 0) { auto* attribute = ctx.dst->Disable(ast::DisabledValidation::kBindingPointCollision); - ctx.InsertFront(var->attributes, attribute); + ctx.InsertFront(global->attributes, attribute); } } } @@ -166,10 +169,10 @@ struct CombineSamplers::State { ctx.ReplaceAll([&](const ast::Function* src) -> const ast::Function* { if (auto* func = sem.Get(src)) { auto pairs = func->TextureSamplerPairs(); - if (pairs.empty()) { + if (pairs.IsEmpty()) { return nullptr; } - ast::VariableList params; + utils::Vector params; for (auto pair : func->TextureSamplerPairs()) { const sem::Variable* texture_var = pair.first; const sem::Variable* sampler_var = pair.second; @@ -188,10 +191,9 @@ struct CombineSamplers::State { } else { // Either texture or sampler (or both) is a function parameter; // add a new function parameter to represent the combined sampler. - const ast::Type* type = CreateCombinedASTTypeFor(texture_var, sampler_var); - const ast::Variable* var = - ctx.dst->Param(ctx.dst->Symbols().New(name), type); - params.push_back(var); + auto* type = CreateCombinedASTTypeFor(texture_var, sampler_var); + auto* var = ctx.dst->Param(ctx.dst->Symbols().New(name), type); + params.Push(var); function_combined_texture_samplers_[func][pair] = var; } } @@ -199,7 +201,7 @@ struct CombineSamplers::State { // function signature. for (auto* var : src->params) { if (!sem.Get(var->type)->IsAnyOf()) { - params.push_back(ctx.Clone(var)); + params.Push(ctx.Clone(var)); } } // Create a new function signature that differs only in the parameter @@ -220,24 +222,26 @@ struct CombineSamplers::State { // sampler parameters to use the current function's combined samplers or // the combined global samplers, as appropriate. ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::Expression* { - if (auto* call = sem.Get(expr)) { - ast::ExpressionList args; + if (auto* call = sem.Get(expr)->UnwrapMaterialize()->As()) { + utils::Vector args; // Replace all texture builtin calls. if (auto* builtin = call->Target()->As()) { const auto& signature = builtin->Signature(); - int sampler_index = signature.IndexOf(sem::ParameterUsage::kSampler); - int texture_index = signature.IndexOf(sem::ParameterUsage::kTexture); + auto sampler_index = signature.IndexOf(sem::ParameterUsage::kSampler); + auto texture_index = signature.IndexOf(sem::ParameterUsage::kTexture); if (texture_index == -1) { return nullptr; } - const sem::Expression* texture = call->Arguments()[texture_index]; + const sem::Expression* texture = + call->Arguments()[static_cast(texture_index)]; // We don't want to combine storage textures with anything, since // they never have associated samplers in GLSL. if (texture->Type()->UnwrapRef()->Is()) { return nullptr; } const sem::Expression* sampler = - sampler_index != -1 ? call->Arguments()[sampler_index] : nullptr; + sampler_index != -1 ? call->Arguments()[static_cast(sampler_index)] + : nullptr; auto* texture_var = texture->As()->Variable(); auto* sampler_var = sampler ? sampler->As()->Variable() : nullptr; @@ -250,7 +254,7 @@ struct CombineSamplers::State { ? global_combined_texture_samplers_[new_pair] : function_combined_texture_samplers_[call->Stmt()->Function()] [new_pair]; - args.push_back(ctx.dst->Expr(var->symbol)); + args.Push(ctx.dst->Expr(var->symbol)); } else if (auto* sampler_type = type->As()) { ast::SamplerKind kind = sampler_type->kind(); int index = (kind == ast::SamplerKind::kSampler) ? 0 : 1; @@ -258,9 +262,9 @@ struct CombineSamplers::State { if (!p) { p = CreatePlaceholder(kind); } - args.push_back(ctx.dst->Expr(p->symbol)); + args.Push(ctx.dst->Expr(p->symbol)); } else { - args.push_back(ctx.Clone(arg)); + args.Push(ctx.Clone(arg)); } } const ast::Expression* value = @@ -302,7 +306,7 @@ struct CombineSamplers::State { : function_combined_texture_samplers_[call->Stmt()->Function()] [new_pair]; auto* arg = ctx.dst->Expr(var->symbol); - args.push_back(arg); + args.Push(arg); } // Append all of the remaining non-texture and non-sampler // parameters. @@ -310,7 +314,7 @@ struct CombineSamplers::State { if (!ctx.src->TypeOf(arg) ->UnwrapRef() ->IsAnyOf()) { - args.push_back(ctx.Clone(arg)); + args.Push(ctx.Clone(arg)); } } return ctx.dst->Call(ctx.Clone(expr->target.name), args); diff --git a/src/tint/transform/combine_samplers_test.cc b/src/tint/transform/combine_samplers_test.cc index 1d84859faa..cad310959e 100644 --- a/src/tint/transform/combine_samplers_test.cc +++ b/src/tint/transform/combine_samplers_test.cc @@ -872,7 +872,7 @@ fn main() -> vec4 { @group(0) @binding(0) @internal(disable_validation__binding_point_collision) var placeholder_comparison_sampler : sampler_comparison; fn f(t_s : texture_depth_2d, coords : vec2) -> f32 { - return textureSampleCompare(t_s, placeholder_comparison_sampler, coords, 5.0); + return textureSampleCompare(t_s, placeholder_comparison_sampler, coords, 5.0f); } @group(0) @binding(0) @internal(disable_validation__binding_point_collision) var tex_samp : texture_depth_2d; @@ -912,7 +912,7 @@ fn main() -> vec4 { @group(0) @binding(0) @internal(disable_validation__binding_point_collision) var placeholder_comparison_sampler : sampler_comparison; fn f(t_s : texture_depth_2d, coords : vec2) -> f32 { - return textureSampleCompare(t_s, placeholder_comparison_sampler, coords, 5.0); + return textureSampleCompare(t_s, placeholder_comparison_sampler, coords, 5.0f); } )"; diff --git a/src/tint/transform/decompose_memory_access.cc b/src/tint/transform/decompose_memory_access.cc index 66c60737ab..767a2a34d0 100644 --- a/src/tint/transform/decompose_memory_access.cc +++ b/src/tint/transform/decompose_memory_access.cc @@ -73,7 +73,7 @@ struct OffsetExpr : Offset { /// OffsetLiteral is an implementation of Offset that constructs a u32 literal /// value. -struct OffsetLiteral : Castable { +struct OffsetLiteral final : Castable { uint32_t const literal = 0; explicit OffsetLiteral(uint32_t lit) : literal(lit) {} @@ -98,29 +98,32 @@ struct OffsetBinOp : Offset { /// LoadStoreKey is the unordered map key to a load or store intrinsic. struct LoadStoreKey { ast::StorageClass const storage_class; // buffer storage class + ast::Access const access; // buffer access sem::Type const* buf_ty = nullptr; // buffer type sem::Type const* el_ty = nullptr; // element type bool operator==(const LoadStoreKey& rhs) const { - return storage_class == rhs.storage_class && buf_ty == rhs.buf_ty && el_ty == rhs.el_ty; + return storage_class == rhs.storage_class && access == rhs.access && buf_ty == rhs.buf_ty && + el_ty == rhs.el_ty; } struct Hasher { inline std::size_t operator()(const LoadStoreKey& u) const { - return utils::Hash(u.storage_class, u.buf_ty, u.el_ty); + return utils::Hash(u.storage_class, u.access, u.buf_ty, u.el_ty); } }; }; /// AtomicKey is the unordered map key to an atomic intrinsic. struct AtomicKey { + ast::Access const access; // buffer access sem::Type const* buf_ty = nullptr; // buffer type sem::Type const* el_ty = nullptr; // element type sem::BuiltinType const op; // atomic op bool operator==(const AtomicKey& rhs) const { - return buf_ty == rhs.buf_ty && el_ty == rhs.el_ty && op == rhs.op; + return access == rhs.access && buf_ty == rhs.buf_ty && el_ty == rhs.el_ty && op == rhs.op; } struct Hasher { inline std::size_t operator()(const AtomicKey& u) const { - return utils::Hash(u.buf_ty, u.el_ty, u.op); + return utils::Hash(u.access, u.buf_ty, u.el_ty, u.op); } }; }; @@ -199,7 +202,8 @@ DecomposeMemoryAccess::Intrinsic* IntrinsicLoadFor(ProgramBuilder* builder, return nullptr; } return builder->ASTNodes().Create( - builder->ID(), DecomposeMemoryAccess::Intrinsic::Op::kLoad, storage_class, type); + builder->ID(), builder->AllocateNodeID(), DecomposeMemoryAccess::Intrinsic::Op::kLoad, + storage_class, type); } /// @returns a DecomposeMemoryAccess::Intrinsic attribute that can be applied @@ -212,7 +216,8 @@ DecomposeMemoryAccess::Intrinsic* IntrinsicStoreFor(ProgramBuilder* builder, return nullptr; } return builder->ASTNodes().Create( - builder->ID(), DecomposeMemoryAccess::Intrinsic::Op::kStore, storage_class, type); + builder->ID(), builder->AllocateNodeID(), DecomposeMemoryAccess::Intrinsic::Op::kStore, + storage_class, type); } /// @returns a DecomposeMemoryAccess::Intrinsic attribute that can be applied @@ -267,7 +272,7 @@ DecomposeMemoryAccess::Intrinsic* IntrinsicAtomicFor(ProgramBuilder* builder, return nullptr; } return builder->ASTNodes().Create( - builder->ID(), op, ast::StorageClass::kStorage, type); + builder->ID(), builder->AllocateNodeID(), op, ast::StorageClass::kStorage, type); } /// BufferAccess describes a single storage or uniform buffer access @@ -323,7 +328,7 @@ struct DecomposeMemoryAccess::State { /// @returns an Offset for the given ast::Expression const Offset* ToOffset(const ast::Expression* expr) { if (auto* lit = expr->As()) { - if (lit->value > 0) { + if (lit->value >= 0) { return offsets_.Create(static_cast(lit->value)); } } @@ -374,10 +379,10 @@ struct DecomposeMemoryAccess::State { auto* lhs_lit = tint::As(lhs); auto* rhs_lit = tint::As(rhs); if (lhs_lit && lhs_lit->literal == 0) { - return offsets_.Create(0); + return offsets_.Create(0u); } if (rhs_lit && rhs_lit->literal == 0) { - return offsets_.Create(0); + return offsets_.Create(0u); } if (lhs_lit && lhs_lit->literal == 1) { return rhs; @@ -420,10 +425,10 @@ struct DecomposeMemoryAccess::State { return access; } - /// LoadFunc() returns a symbol to an intrinsic function that loads an element - /// of type `el_ty` from a storage or uniform buffer of type `buf_ty`. + /// LoadFunc() returns a symbol to an intrinsic function that loads an element of type `el_ty` + /// from a storage or uniform buffer of type `buf_ty`. /// The emitted function has the signature: - /// `fn load(buf : buf_ty, offset : u32) -> el_ty` + /// `fn load(buf : ptr, offset : u32) -> el_ty` /// @param buf_ty the storage or uniform buffer type /// @param el_ty the storage or uniform buffer element type /// @param var_user the variable user @@ -432,89 +437,84 @@ struct DecomposeMemoryAccess::State { const sem::Type* el_ty, const sem::VariableUser* var_user) { auto storage_class = var_user->Variable()->StorageClass(); - return utils::GetOrCreate(load_funcs, LoadStoreKey{storage_class, buf_ty, el_ty}, [&] { - auto* buf_ast_ty = CreateASTTypeFor(ctx, buf_ty); - auto* disable_validation = - b.Disable(ast::DisabledValidation::kIgnoreConstructibleFunctionParameter); + auto access = var_user->Variable()->Access(); + return utils::GetOrCreate( + load_funcs, LoadStoreKey{storage_class, access, buf_ty, el_ty}, [&] { + utils::Vector params{ + b.Param("buffer", + b.ty.pointer(CreateASTTypeFor(ctx, buf_ty), storage_class, access), + utils::Vector{b.Disable(ast::DisabledValidation::kFunctionParameter)}), + b.Param("offset", b.ty.u32()), + }; - ast::VariableList params = { - // Note: The buffer parameter requires the StorageClass in - // order for HLSL to emit this as a ByteAddressBuffer or cbuffer - // array. - b.create(b.Sym("buffer"), storage_class, - var_user->Variable()->Access(), buf_ast_ty, true, false, - nullptr, ast::AttributeList{disable_validation}), - b.Param("offset", b.ty.u32()), - }; + auto name = b.Sym(); - auto name = b.Sym(); + if (auto* intrinsic = IntrinsicLoadFor(ctx.dst, storage_class, el_ty)) { + auto* el_ast_ty = CreateASTTypeFor(ctx, el_ty); + auto* func = b.create( + name, params, el_ast_ty, nullptr, + utils::Vector{ + intrinsic, + b.Disable(ast::DisabledValidation::kFunctionHasNoBody), + }, + utils::Empty); + b.AST().AddFunction(func); + } else if (auto* arr_ty = el_ty->As()) { + // fn load_func(buffer : buf_ty, offset : u32) -> array { + // var arr : array; + // for (var i = 0u; i < array_count; i = i + 1) { + // arr[i] = el_load_func(buffer, offset + i * array_stride) + // } + // return arr; + // } + auto load = LoadFunc(buf_ty, arr_ty->ElemType()->UnwrapRef(), var_user); + auto* arr = b.Var(b.Symbols().New("arr"), CreateASTTypeFor(ctx, arr_ty)); + auto* i = b.Var(b.Symbols().New("i"), b.Expr(0_u)); + auto* for_init = b.Decl(i); + auto* for_cond = b.create( + ast::BinaryOp::kLessThan, b.Expr(i), b.Expr(u32(arr_ty->Count()))); + auto* for_cont = b.Assign(i, b.Add(i, 1_u)); + auto* arr_el = b.IndexAccessor(arr, i); + auto* el_offset = b.Add(b.Expr("offset"), b.Mul(i, u32(arr_ty->Stride()))); + auto* el_val = b.Call(load, "buffer", el_offset); + auto* for_loop = + b.For(for_init, for_cond, for_cont, b.Block(b.Assign(arr_el, el_val))); - if (auto* intrinsic = IntrinsicLoadFor(ctx.dst, storage_class, el_ty)) { - auto* el_ast_ty = CreateASTTypeFor(ctx, el_ty); - auto* func = b.create( - name, params, el_ast_ty, nullptr, - ast::AttributeList{ - intrinsic, - b.Disable(ast::DisabledValidation::kFunctionHasNoBody), - }, - ast::AttributeList{}); - b.AST().AddFunction(func); - } else if (auto* arr_ty = el_ty->As()) { - // fn load_func(buf : buf_ty, offset : u32) -> array { - // var arr : array; - // for (var i = 0u; i < array_count; i = i + 1) { - // arr[i] = el_load_func(buf, offset + i * array_stride) - // } - // return arr; - // } - auto load = LoadFunc(buf_ty, arr_ty->ElemType()->UnwrapRef(), var_user); - auto* arr = b.Var(b.Symbols().New("arr"), CreateASTTypeFor(ctx, arr_ty)); - auto* i = b.Var(b.Symbols().New("i"), nullptr, b.Expr(0_u)); - auto* for_init = b.Decl(i); - auto* for_cond = b.create( - ast::BinaryOp::kLessThan, b.Expr(i), b.Expr(u32(arr_ty->Count()))); - auto* for_cont = b.Assign(i, b.Add(i, 1_u)); - auto* arr_el = b.IndexAccessor(arr, i); - auto* el_offset = b.Add(b.Expr("offset"), b.Mul(i, u32(arr_ty->Stride()))); - auto* el_val = b.Call(load, "buffer", el_offset); - auto* for_loop = - b.For(for_init, for_cond, for_cont, b.Block(b.Assign(arr_el, el_val))); - - b.Func(name, params, CreateASTTypeFor(ctx, arr_ty), - { - b.Decl(arr), - for_loop, - b.Return(arr), - }); - } else { - ast::ExpressionList values; - if (auto* mat_ty = el_ty->As()) { - auto* vec_ty = mat_ty->ColumnType(); - Symbol load = LoadFunc(buf_ty, vec_ty, var_user); - for (uint32_t i = 0; i < mat_ty->columns(); i++) { - auto* offset = b.Add("offset", u32(i * mat_ty->ColumnStride())); - values.emplace_back(b.Call(load, "buffer", offset)); - } - } else if (auto* str = el_ty->As()) { - for (auto* member : str->Members()) { - auto* offset = b.Add("offset", u32(member->Offset())); - Symbol load = LoadFunc(buf_ty, member->Type()->UnwrapRef(), var_user); - values.emplace_back(b.Call(load, "buffer", offset)); + b.Func(name, params, CreateASTTypeFor(ctx, arr_ty), + utils::Vector{ + b.Decl(arr), + for_loop, + b.Return(arr), + }); + } else { + utils::Vector values; + if (auto* mat_ty = el_ty->As()) { + auto* vec_ty = mat_ty->ColumnType(); + Symbol load = LoadFunc(buf_ty, vec_ty, var_user); + for (uint32_t i = 0; i < mat_ty->columns(); i++) { + auto* offset = b.Add("offset", u32(i * mat_ty->ColumnStride())); + values.Push(b.Call(load, "buffer", offset)); + } + } else if (auto* str = el_ty->As()) { + for (auto* member : str->Members()) { + auto* offset = b.Add("offset", u32(member->Offset())); + Symbol load = LoadFunc(buf_ty, member->Type()->UnwrapRef(), var_user); + values.Push(b.Call(load, "buffer", offset)); + } } + b.Func(name, params, CreateASTTypeFor(ctx, el_ty), + utils::Vector{ + b.Return(b.Construct(CreateASTTypeFor(ctx, el_ty), values)), + }); } - b.Func(name, params, CreateASTTypeFor(ctx, el_ty), - { - b.Return(b.Construct(CreateASTTypeFor(ctx, el_ty), values)), - }); - } - return name; - }); + return name; + }); } /// StoreFunc() returns a symbol to an intrinsic function that stores an /// element of type `el_ty` to a storage buffer of type `buf_ty`. /// The function has the signature: - /// `fn store(buf : buf_ty, offset : u32, value : el_ty)` + /// `fn store(buf : ptr, offset : u32, value : el_ty)` /// @param buf_ty the storage buffer type /// @param el_ty the storage buffer element type /// @param var_user the variable user @@ -523,87 +523,95 @@ struct DecomposeMemoryAccess::State { const sem::Type* el_ty, const sem::VariableUser* var_user) { auto storage_class = var_user->Variable()->StorageClass(); - return utils::GetOrCreate(store_funcs, LoadStoreKey{storage_class, buf_ty, el_ty}, [&] { - auto* buf_ast_ty = CreateASTTypeFor(ctx, buf_ty); - auto* el_ast_ty = CreateASTTypeFor(ctx, el_ty); - auto* disable_validation = - b.Disable(ast::DisabledValidation::kIgnoreConstructibleFunctionParameter); - ast::VariableList params{ - // Note: The buffer parameter requires the StorageClass in - // order for HLSL to emit this as a ByteAddressBuffer. + auto access = var_user->Variable()->Access(); + return utils::GetOrCreate( + store_funcs, LoadStoreKey{storage_class, access, buf_ty, el_ty}, [&] { + utils::Vector params{ + b.Param("buffer", + b.ty.pointer(CreateASTTypeFor(ctx, buf_ty), storage_class, access), + utils::Vector{b.Disable(ast::DisabledValidation::kFunctionParameter)}), + b.Param("offset", b.ty.u32()), + b.Param("value", CreateASTTypeFor(ctx, el_ty)), + }; - b.create(b.Sym("buffer"), storage_class, - var_user->Variable()->Access(), buf_ast_ty, true, false, - nullptr, ast::AttributeList{disable_validation}), - b.Param("offset", b.ty.u32()), - b.Param("value", el_ast_ty), - }; + auto name = b.Sym(); - auto name = b.Sym(); + if (auto* intrinsic = IntrinsicStoreFor(ctx.dst, storage_class, el_ty)) { + auto* func = b.create( + name, params, b.ty.void_(), nullptr, + utils::Vector{ + intrinsic, + b.Disable(ast::DisabledValidation::kFunctionHasNoBody), + }, + utils::Empty); + b.AST().AddFunction(func); + } else { + auto body = Switch>( + el_ty, // + [&](const sem::Array* arr_ty) { + // fn store_func(buffer : buf_ty, offset : u32, value : el_ty) { + // var array = value; // No dynamic indexing on constant arrays + // for (var i = 0u; i < array_count; i = i + 1) { + // arr[i] = el_store_func(buffer, offset + i * array_stride, + // value[i]) + // } + // return arr; + // } + auto* array = b.Var(b.Symbols().New("array"), b.Expr("value")); + auto store = + StoreFunc(buf_ty, arr_ty->ElemType()->UnwrapRef(), var_user); + auto* i = b.Var(b.Symbols().New("i"), b.Expr(0_u)); + auto* for_init = b.Decl(i); + auto* for_cond = b.create( + ast::BinaryOp::kLessThan, b.Expr(i), b.Expr(u32(arr_ty->Count()))); + auto* for_cont = b.Assign(i, b.Add(i, 1_u)); + auto* arr_el = b.IndexAccessor(array, i); + auto* el_offset = + b.Add(b.Expr("offset"), b.Mul(i, u32(arr_ty->Stride()))); + auto* store_stmt = + b.CallStmt(b.Call(store, "buffer", el_offset, arr_el)); + auto* for_loop = + b.For(for_init, for_cond, for_cont, b.Block(store_stmt)); - if (auto* intrinsic = IntrinsicStoreFor(ctx.dst, storage_class, el_ty)) { - auto* func = b.create( - name, params, b.ty.void_(), nullptr, - ast::AttributeList{ - intrinsic, - b.Disable(ast::DisabledValidation::kFunctionHasNoBody), - }, - ast::AttributeList{}); - b.AST().AddFunction(func); - } else { - ast::StatementList body; - if (auto* arr_ty = el_ty->As()) { - // fn store_func(buf : buf_ty, offset : u32, value : el_ty) { - // var array = value; // No dynamic indexing on constant arrays - // for (var i = 0u; i < array_count; i = i + 1) { - // arr[i] = el_store_func(buf, offset + i * array_stride, - // value[i]) - // } - // return arr; - // } - auto* array = b.Var(b.Symbols().New("array"), nullptr, b.Expr("value")); - auto store = StoreFunc(buf_ty, arr_ty->ElemType()->UnwrapRef(), var_user); - auto* i = b.Var(b.Symbols().New("i"), nullptr, b.Expr(0_u)); - auto* for_init = b.Decl(i); - auto* for_cond = b.create( - ast::BinaryOp::kLessThan, b.Expr(i), b.Expr(u32(arr_ty->Count()))); - auto* for_cont = b.Assign(i, b.Add(i, 1_u)); - auto* arr_el = b.IndexAccessor(array, i); - auto* el_offset = b.Add(b.Expr("offset"), b.Mul(i, u32(arr_ty->Stride()))); - auto* store_stmt = b.CallStmt(b.Call(store, "buffer", el_offset, arr_el)); - auto* for_loop = b.For(for_init, for_cond, for_cont, b.Block(store_stmt)); + return utils::Vector{b.Decl(array), for_loop}; + }, + [&](const sem::Matrix* mat_ty) { + auto* vec_ty = mat_ty->ColumnType(); + Symbol store = StoreFunc(buf_ty, vec_ty, var_user); + utils::Vector stmts; + for (uint32_t i = 0; i < mat_ty->columns(); i++) { + auto* offset = b.Add("offset", u32(i * mat_ty->ColumnStride())); + auto* element = b.IndexAccessor("value", u32(i)); + auto* call = b.Call(store, "buffer", offset, element); + stmts.Push(b.CallStmt(call)); + } + return stmts; + }, + [&](const sem::Struct* str) { + utils::Vector stmts; + for (auto* member : str->Members()) { + auto* offset = b.Add("offset", u32(member->Offset())); + auto* element = b.MemberAccessor( + "value", ctx.Clone(member->Declaration()->symbol)); + Symbol store = + StoreFunc(buf_ty, member->Type()->UnwrapRef(), var_user); + auto* call = b.Call(store, "buffer", offset, element); + stmts.Push(b.CallStmt(call)); + } + return stmts; + }); - body = {b.Decl(array), for_loop}; - } else if (auto* mat_ty = el_ty->As()) { - auto* vec_ty = mat_ty->ColumnType(); - Symbol store = StoreFunc(buf_ty, vec_ty, var_user); - for (uint32_t i = 0; i < mat_ty->columns(); i++) { - auto* offset = b.Add("offset", u32(i * mat_ty->ColumnStride())); - auto* access = b.IndexAccessor("value", u32(i)); - auto* call = b.Call(store, "buffer", offset, access); - body.emplace_back(b.CallStmt(call)); - } - } else if (auto* str = el_ty->As()) { - for (auto* member : str->Members()) { - auto* offset = b.Add("offset", u32(member->Offset())); - auto* access = - b.MemberAccessor("value", ctx.Clone(member->Declaration()->symbol)); - Symbol store = StoreFunc(buf_ty, member->Type()->UnwrapRef(), var_user); - auto* call = b.Call(store, "buffer", offset, access); - body.emplace_back(b.CallStmt(call)); - } + b.Func(name, params, b.ty.void_(), body); } - b.Func(name, params, b.ty.void_(), body); - } - return name; - }); + return name; + }); } /// AtomicFunc() returns a symbol to an intrinsic function that performs an /// atomic operation from a storage buffer of type `buf_ty`. The function has /// the signature: - // `fn atomic_op(buf : buf_ty, offset : u32, ...) -> T` + // `fn atomic_op(buf : ptr, offset : u32, ...) -> T` /// @param buf_ty the storage buffer type /// @param el_ty the storage buffer element type /// @param intrinsic the atomic intrinsic @@ -614,27 +622,23 @@ struct DecomposeMemoryAccess::State { const sem::Builtin* intrinsic, const sem::VariableUser* var_user) { auto op = intrinsic->Type(); - return utils::GetOrCreate(atomic_funcs, AtomicKey{buf_ty, el_ty, op}, [&] { - auto* buf_ast_ty = CreateASTTypeFor(ctx, buf_ty); - auto* disable_validation = - b.Disable(ast::DisabledValidation::kIgnoreConstructibleFunctionParameter); + auto access = var_user->Variable()->Access(); + return utils::GetOrCreate(atomic_funcs, AtomicKey{access, buf_ty, el_ty, op}, [&] { // The first parameter to all WGSL atomics is the expression to the // atomic. This is replaced with two parameters: the buffer and offset. - - ast::VariableList params = { - // Note: The buffer parameter requires the kStorage StorageClass in - // order for HLSL to emit this as a ByteAddressBuffer. - b.create(b.Sym("buffer"), ast::StorageClass::kStorage, - var_user->Variable()->Access(), buf_ast_ty, true, false, - nullptr, ast::AttributeList{disable_validation}), + utils::Vector params{ + b.Param("buffer", + b.ty.pointer(CreateASTTypeFor(ctx, buf_ty), ast::StorageClass::kStorage, + access), + utils::Vector{b.Disable(ast::DisabledValidation::kFunctionParameter)}), b.Param("offset", b.ty.u32()), }; // Other parameters are copied as-is: - for (size_t i = 1; i < intrinsic->Parameters().size(); i++) { + for (size_t i = 1; i < intrinsic->Parameters().Length(); i++) { auto* param = intrinsic->Parameters()[i]; auto* ty = CreateASTTypeFor(ctx, param->Type()); - params.emplace_back(b.Param("param_" + std::to_string(i), ty)); + params.Push(b.Param("param_" + std::to_string(i), ty)); } auto* atomic = IntrinsicAtomicFor(ctx.dst, op, el_ty); @@ -644,14 +648,34 @@ struct DecomposeMemoryAccess::State { << el_ty->TypeInfo().name; } - auto* ret_ty = CreateASTTypeFor(ctx, intrinsic->ReturnType()); - auto* func = - b.create(b.Sym(), params, ret_ty, nullptr, - ast::AttributeList{ - atomic, - b.Disable(ast::DisabledValidation::kFunctionHasNoBody), - }, - ast::AttributeList{}); + const ast::Type* ret_ty = nullptr; + + // For intrinsics that return a struct, there is no AST node for it, so create one now. + if (intrinsic->Type() == sem::BuiltinType::kAtomicCompareExchangeWeak) { + auto* str = intrinsic->ReturnType()->As(); + TINT_ASSERT(Transform, str && str->Declaration() == nullptr); + + utils::Vector ast_members; + ast_members.Reserve(str->Members().size()); + for (auto& m : str->Members()) { + ast_members.Push( + b.Member(ctx.Clone(m->Name()), CreateASTTypeFor(ctx, m->Type()))); + } + + auto name = b.Symbols().New("atomic_compare_exchange_weak_ret_type"); + auto* new_str = b.Structure(name, std::move(ast_members)); + ret_ty = b.ty.Of(new_str); + } else { + ret_ty = CreateASTTypeFor(ctx, intrinsic->ReturnType()); + } + + auto* func = b.create( + b.Symbols().New(std::string{"tint_"} + intrinsic->str()), params, ret_ty, nullptr, + utils::Vector{ + atomic, + b.Disable(ast::DisabledValidation::kFunctionHasNoBody), + }, + utils::Empty); b.AST().AddFunction(func); return func->symbol; @@ -659,8 +683,12 @@ struct DecomposeMemoryAccess::State { } }; -DecomposeMemoryAccess::Intrinsic::Intrinsic(ProgramID pid, Op o, ast::StorageClass sc, DataType ty) - : Base(pid), op(o), storage_class(sc), type(ty) {} +DecomposeMemoryAccess::Intrinsic::Intrinsic(ProgramID pid, + ast::NodeID nid, + Op o, + ast::StorageClass sc, + DataType ty) + : Base(pid, nid), op(o), storage_class(sc), type(ty) {} DecomposeMemoryAccess::Intrinsic::~Intrinsic() = default; std::string DecomposeMemoryAccess::Intrinsic::InternalName() const { std::stringstream ss; @@ -749,8 +777,12 @@ std::string DecomposeMemoryAccess::Intrinsic::InternalName() const { const DecomposeMemoryAccess::Intrinsic* DecomposeMemoryAccess::Intrinsic::Clone( CloneContext* ctx) const { - return ctx->dst->ASTNodes().Create(ctx->dst->ID(), op, - storage_class, type); + return ctx->dst->ASTNodes().Create( + ctx->dst->ID(), ctx->dst->AllocateNodeID(), op, storage_class, type); +} + +bool DecomposeMemoryAccess::Intrinsic::IsAtomic() const { + return op != Op::kLoad && op != Op::kStore; } DecomposeMemoryAccess::DecomposeMemoryAccess() = default; @@ -802,10 +834,10 @@ void DecomposeMemoryAccess::Run(CloneContext& ctx, const DataMap&, DataMap&) con // X.Y auto* accessor_sem = sem.Get(accessor); if (auto* swizzle = accessor_sem->As()) { - if (swizzle->Indices().size() == 1) { + if (swizzle->Indices().Length() == 1) { if (auto access = state.TakeAccess(accessor->structure)) { auto* vec_ty = access.type->As(); - auto* offset = state.Mul(vec_ty->type()->Size(), swizzle->Indices()[0]); + auto* offset = state.Mul(vec_ty->type()->Size(), swizzle->Indices()[0u]); state.AddAccess(accessor, { access.var, state.Add(access.offset, offset), @@ -882,12 +914,11 @@ void DecomposeMemoryAccess::Run(CloneContext& ctx, const DataMap&, DataMap&) con } if (auto* call_expr = node->As()) { - auto* call = sem.Get(call_expr); + auto* call = sem.Get(call_expr)->UnwrapMaterialize()->As(); if (auto* builtin = call->Target()->As()) { if (builtin->Type() == sem::BuiltinType::kArrayLength) { // arrayLength(X) - // Don't convert X into a load, this builtin actually requires the - // real pointer. + // Don't convert X into a load, this builtin actually requires the real pointer. state.TakeAccess(call_expr->args[0]); continue; } @@ -902,10 +933,11 @@ void DecomposeMemoryAccess::Run(CloneContext& ctx, const DataMap&, DataMap&) con Symbol func = state.AtomicFunc(buf_ty, el_ty, builtin, access.var->As()); - ast::ExpressionList args{ctx.Clone(buf), offset}; - for (size_t i = 1; i < call_expr->args.size(); i++) { + utils::Vector args{ + ctx.dst->AddressOf(ctx.Clone(buf)), offset}; + for (size_t i = 1; i < call_expr->args.Length(); i++) { auto* arg = call_expr->args[i]; - args.emplace_back(ctx.Clone(arg)); + args.Push(ctx.Clone(arg)); } return ctx.dst->Call(func, args); }); @@ -924,26 +956,26 @@ void DecomposeMemoryAccess::Run(CloneContext& ctx, const DataMap&, DataMap&) con } BufferAccess access = access_it->second; ctx.Replace(expr, [=, &ctx, &state] { - auto* buf = access.var->Declaration(); + auto* buf = ctx.dst->AddressOf(ctx.CloneWithoutTransform(access.var->Declaration())); auto* offset = access.offset->Build(ctx); auto* buf_ty = access.var->Type()->UnwrapRef(); auto* el_ty = access.type->UnwrapRef(); Symbol func = state.LoadFunc(buf_ty, el_ty, access.var->As()); - return ctx.dst->Call(func, ctx.CloneWithoutTransform(buf), offset); + return ctx.dst->Call(func, buf, offset); }); } // And replace all storage and uniform buffer assignments with stores for (auto store : state.stores) { ctx.Replace(store.assignment, [=, &ctx, &state] { - auto* buf = store.target.var->Declaration(); + auto* buf = + ctx.dst->AddressOf(ctx.CloneWithoutTransform((store.target.var->Declaration()))); auto* offset = store.target.offset->Build(ctx); auto* buf_ty = store.target.var->Type()->UnwrapRef(); auto* el_ty = store.target.type->UnwrapRef(); auto* value = store.assignment->rhs; Symbol func = state.StoreFunc(buf_ty, el_ty, store.target.var->As()); - auto* call = - ctx.dst->Call(func, ctx.CloneWithoutTransform(buf), offset, ctx.Clone(value)); + auto* call = ctx.dst->Call(func, buf, offset, ctx.Clone(value)); return ctx.dst->CallStmt(call); }); } diff --git a/src/tint/transform/decompose_memory_access.h b/src/tint/transform/decompose_memory_access.h index 7a7b783d83..1d95dc493d 100644 --- a/src/tint/transform/decompose_memory_access.h +++ b/src/tint/transform/decompose_memory_access.h @@ -72,11 +72,12 @@ class DecomposeMemoryAccess final : public Castable sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var a : i32 = sb.a; var b : u32 = sb.b; @@ -134,78 +134,78 @@ struct SB { @group(0) @binding(0) var sb : SB; @internal(intrinsic_load_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> i32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> i32 @internal(intrinsic_load_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> u32 +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> u32 @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 @internal(intrinsic_load_storage_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_storage_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_storage_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x2 { +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x2 { return mat2x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u))); } -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x3 { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x3 { return mat2x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u))); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x4 { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x4 { return mat2x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u))); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x2 { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x2 { return mat3x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u))); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x3 { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x3 { return mat3x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u))); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x4 { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x4 { return mat3x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u))); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x2 { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x2 { return mat4x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u))); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x3 { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x3 { return mat4x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u)), tint_symbol_8(buffer, (offset + 48u))); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x4 { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x4 { return mat4x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u)), tint_symbol_11(buffer, (offset + 48u))); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> array, 2u> { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> array, 2u> { var arr : array, 2u>; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { arr[i_1] = tint_symbol_8(buffer, (offset + (i_1 * 16u))); @@ -213,30 +213,30 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa return arr; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - var a : i32 = tint_symbol(sb, 0u); - var b : u32 = tint_symbol_1(sb, 4u); - var c : f32 = tint_symbol_2(sb, 8u); - var d : vec2 = tint_symbol_3(sb, 16u); - var e : vec2 = tint_symbol_4(sb, 24u); - var f : vec2 = tint_symbol_5(sb, 32u); - var g : vec3 = tint_symbol_6(sb, 48u); - var h : vec3 = tint_symbol_7(sb, 64u); - var i : vec3 = tint_symbol_8(sb, 80u); - var j : vec4 = tint_symbol_9(sb, 96u); - var k : vec4 = tint_symbol_10(sb, 112u); - var l : vec4 = tint_symbol_11(sb, 128u); - var m : mat2x2 = tint_symbol_12(sb, 144u); - var n : mat2x3 = tint_symbol_13(sb, 160u); - var o : mat2x4 = tint_symbol_14(sb, 192u); - var p : mat3x2 = tint_symbol_15(sb, 224u); - var q : mat3x3 = tint_symbol_16(sb, 256u); - var r : mat3x4 = tint_symbol_17(sb, 304u); - var s : mat4x2 = tint_symbol_18(sb, 352u); - var t : mat4x3 = tint_symbol_19(sb, 384u); - var u : mat4x4 = tint_symbol_20(sb, 448u); - var v : array, 2> = tint_symbol_21(sb, 512u); + var a : i32 = tint_symbol(&(sb), 0u); + var b : u32 = tint_symbol_1(&(sb), 4u); + var c : f32 = tint_symbol_2(&(sb), 8u); + var d : vec2 = tint_symbol_3(&(sb), 16u); + var e : vec2 = tint_symbol_4(&(sb), 24u); + var f : vec2 = tint_symbol_5(&(sb), 32u); + var g : vec3 = tint_symbol_6(&(sb), 48u); + var h : vec3 = tint_symbol_7(&(sb), 64u); + var i : vec3 = tint_symbol_8(&(sb), 80u); + var j : vec4 = tint_symbol_9(&(sb), 96u); + var k : vec4 = tint_symbol_10(&(sb), 112u); + var l : vec4 = tint_symbol_11(&(sb), 128u); + var m : mat2x2 = tint_symbol_12(&(sb), 144u); + var n : mat2x3 = tint_symbol_13(&(sb), 160u); + var o : mat2x4 = tint_symbol_14(&(sb), 192u); + var p : mat3x2 = tint_symbol_15(&(sb), 224u); + var q : mat3x3 = tint_symbol_16(&(sb), 256u); + var r : mat3x4 = tint_symbol_17(&(sb), 304u); + var s : mat4x2 = tint_symbol_18(&(sb), 352u); + var t : mat4x3 = tint_symbol_19(&(sb), 384u); + var u : mat4x4 = tint_symbol_20(&(sb), 448u); + var v : array, 2> = tint_symbol_21(&(sb), 512u); } )"; @@ -247,7 +247,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, SB_BasicLoad_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var a : i32 = sb.a; var b : u32 = sb.b; @@ -303,78 +303,78 @@ struct SB { auto* expect = R"( @internal(intrinsic_load_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> i32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> i32 @internal(intrinsic_load_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> u32 +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> u32 @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 @internal(intrinsic_load_storage_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_storage_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_storage_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x2 { +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x2 { return mat2x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u))); } -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x3 { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x3 { return mat2x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u))); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x4 { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x4 { return mat2x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u))); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x2 { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x2 { return mat3x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u))); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x3 { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x3 { return mat3x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u))); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x4 { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x4 { return mat3x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u))); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x2 { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x2 { return mat4x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u))); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x3 { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x3 { return mat4x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u)), tint_symbol_8(buffer, (offset + 48u))); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x4 { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x4 { return mat4x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u)), tint_symbol_11(buffer, (offset + 48u))); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> array, 2u> { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> array, 2u> { var arr : array, 2u>; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { arr[i_1] = tint_symbol_8(buffer, (offset + (i_1 * 16u))); @@ -382,30 +382,30 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa return arr; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - var a : i32 = tint_symbol(sb, 0u); - var b : u32 = tint_symbol_1(sb, 4u); - var c : f32 = tint_symbol_2(sb, 8u); - var d : vec2 = tint_symbol_3(sb, 16u); - var e : vec2 = tint_symbol_4(sb, 24u); - var f : vec2 = tint_symbol_5(sb, 32u); - var g : vec3 = tint_symbol_6(sb, 48u); - var h : vec3 = tint_symbol_7(sb, 64u); - var i : vec3 = tint_symbol_8(sb, 80u); - var j : vec4 = tint_symbol_9(sb, 96u); - var k : vec4 = tint_symbol_10(sb, 112u); - var l : vec4 = tint_symbol_11(sb, 128u); - var m : mat2x2 = tint_symbol_12(sb, 144u); - var n : mat2x3 = tint_symbol_13(sb, 160u); - var o : mat2x4 = tint_symbol_14(sb, 192u); - var p : mat3x2 = tint_symbol_15(sb, 224u); - var q : mat3x3 = tint_symbol_16(sb, 256u); - var r : mat3x4 = tint_symbol_17(sb, 304u); - var s : mat4x2 = tint_symbol_18(sb, 352u); - var t : mat4x3 = tint_symbol_19(sb, 384u); - var u : mat4x4 = tint_symbol_20(sb, 448u); - var v : array, 2> = tint_symbol_21(sb, 512u); + var a : i32 = tint_symbol(&(sb), 0u); + var b : u32 = tint_symbol_1(&(sb), 4u); + var c : f32 = tint_symbol_2(&(sb), 8u); + var d : vec2 = tint_symbol_3(&(sb), 16u); + var e : vec2 = tint_symbol_4(&(sb), 24u); + var f : vec2 = tint_symbol_5(&(sb), 32u); + var g : vec3 = tint_symbol_6(&(sb), 48u); + var h : vec3 = tint_symbol_7(&(sb), 64u); + var i : vec3 = tint_symbol_8(&(sb), 80u); + var j : vec4 = tint_symbol_9(&(sb), 96u); + var k : vec4 = tint_symbol_10(&(sb), 112u); + var l : vec4 = tint_symbol_11(&(sb), 128u); + var m : mat2x2 = tint_symbol_12(&(sb), 144u); + var n : mat2x3 = tint_symbol_13(&(sb), 160u); + var o : mat2x4 = tint_symbol_14(&(sb), 192u); + var p : mat3x2 = tint_symbol_15(&(sb), 224u); + var q : mat3x3 = tint_symbol_16(&(sb), 256u); + var r : mat3x4 = tint_symbol_17(&(sb), 304u); + var s : mat4x2 = tint_symbol_18(&(sb), 352u); + var t : mat4x3 = tint_symbol_19(&(sb), 384u); + var u : mat4x4 = tint_symbol_20(&(sb), 448u); + var v : array, 2> = tint_symbol_21(&(sb), 512u); } @group(0) @binding(0) var sb : SB; @@ -470,7 +470,7 @@ struct UB { @group(0) @binding(0) var ub : UB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var a : i32 = ub.a; var b : u32 = ub.b; @@ -526,78 +526,78 @@ struct UB { @group(0) @binding(0) var ub : UB; @internal(intrinsic_load_uniform_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> i32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> i32 @internal(intrinsic_load_uniform_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> u32 +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> u32 @internal(intrinsic_load_uniform_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> f32 +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 @internal(intrinsic_load_uniform_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec2 +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_uniform_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec2 +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_uniform_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec2 +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_uniform_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec3 +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_uniform_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec3 +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_uniform_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec3 +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_uniform_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec4 +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_uniform_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec4 +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_uniform_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec4 +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat2x2 { +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x2 { return mat2x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u))); } -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat2x3 { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x3 { return mat2x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u))); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat2x4 { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x4 { return mat2x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u))); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat3x2 { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x2 { return mat3x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u))); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat3x3 { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x3 { return mat3x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u))); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat3x4 { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x4 { return mat3x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u))); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat4x2 { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x2 { return mat4x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u))); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat4x3 { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x3 { return mat4x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u)), tint_symbol_8(buffer, (offset + 48u))); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat4x4 { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x4 { return mat4x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u)), tint_symbol_11(buffer, (offset + 48u))); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> array, 2u> { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> array, 2u> { var arr : array, 2u>; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { arr[i_1] = tint_symbol_8(buffer, (offset + (i_1 * 16u))); @@ -605,30 +605,30 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa return arr; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - var a : i32 = tint_symbol(ub, 0u); - var b : u32 = tint_symbol_1(ub, 4u); - var c : f32 = tint_symbol_2(ub, 8u); - var d : vec2 = tint_symbol_3(ub, 16u); - var e : vec2 = tint_symbol_4(ub, 24u); - var f : vec2 = tint_symbol_5(ub, 32u); - var g : vec3 = tint_symbol_6(ub, 48u); - var h : vec3 = tint_symbol_7(ub, 64u); - var i : vec3 = tint_symbol_8(ub, 80u); - var j : vec4 = tint_symbol_9(ub, 96u); - var k : vec4 = tint_symbol_10(ub, 112u); - var l : vec4 = tint_symbol_11(ub, 128u); - var m : mat2x2 = tint_symbol_12(ub, 144u); - var n : mat2x3 = tint_symbol_13(ub, 160u); - var o : mat2x4 = tint_symbol_14(ub, 192u); - var p : mat3x2 = tint_symbol_15(ub, 224u); - var q : mat3x3 = tint_symbol_16(ub, 256u); - var r : mat3x4 = tint_symbol_17(ub, 304u); - var s : mat4x2 = tint_symbol_18(ub, 352u); - var t : mat4x3 = tint_symbol_19(ub, 384u); - var u : mat4x4 = tint_symbol_20(ub, 448u); - var v : array, 2> = tint_symbol_21(ub, 512u); + var a : i32 = tint_symbol(&(ub), 0u); + var b : u32 = tint_symbol_1(&(ub), 4u); + var c : f32 = tint_symbol_2(&(ub), 8u); + var d : vec2 = tint_symbol_3(&(ub), 16u); + var e : vec2 = tint_symbol_4(&(ub), 24u); + var f : vec2 = tint_symbol_5(&(ub), 32u); + var g : vec3 = tint_symbol_6(&(ub), 48u); + var h : vec3 = tint_symbol_7(&(ub), 64u); + var i : vec3 = tint_symbol_8(&(ub), 80u); + var j : vec4 = tint_symbol_9(&(ub), 96u); + var k : vec4 = tint_symbol_10(&(ub), 112u); + var l : vec4 = tint_symbol_11(&(ub), 128u); + var m : mat2x2 = tint_symbol_12(&(ub), 144u); + var n : mat2x3 = tint_symbol_13(&(ub), 160u); + var o : mat2x4 = tint_symbol_14(&(ub), 192u); + var p : mat3x2 = tint_symbol_15(&(ub), 224u); + var q : mat3x3 = tint_symbol_16(&(ub), 256u); + var r : mat3x4 = tint_symbol_17(&(ub), 304u); + var s : mat4x2 = tint_symbol_18(&(ub), 352u); + var t : mat4x3 = tint_symbol_19(&(ub), 384u); + var u : mat4x4 = tint_symbol_20(&(ub), 448u); + var v : array, 2> = tint_symbol_21(&(ub), 512u); } )"; @@ -639,7 +639,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, UB_BasicLoad_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var a : i32 = ub.a; var b : u32 = ub.b; @@ -695,78 +695,78 @@ struct UB { auto* expect = R"( @internal(intrinsic_load_uniform_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> i32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> i32 @internal(intrinsic_load_uniform_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> u32 +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> u32 @internal(intrinsic_load_uniform_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> f32 +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 @internal(intrinsic_load_uniform_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec2 +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_uniform_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec2 +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_uniform_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec2 +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_uniform_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec3 +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_uniform_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec3 +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_uniform_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec3 +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_uniform_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec4 +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_uniform_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec4 +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_uniform_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> vec4 +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat2x2 { +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x2 { return mat2x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u))); } -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat2x3 { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x3 { return mat2x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u))); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat2x4 { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x4 { return mat2x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u))); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat3x2 { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x2 { return mat3x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u))); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat3x3 { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x3 { return mat3x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u))); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat3x4 { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x4 { return mat3x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u))); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat4x2 { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x2 { return mat4x2(tint_symbol_5(buffer, (offset + 0u)), tint_symbol_5(buffer, (offset + 8u)), tint_symbol_5(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u))); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat4x3 { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x3 { return mat4x3(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 32u)), tint_symbol_8(buffer, (offset + 48u))); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> mat4x4 { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x4 { return mat4x4(tint_symbol_11(buffer, (offset + 0u)), tint_symbol_11(buffer, (offset + 16u)), tint_symbol_11(buffer, (offset + 32u)), tint_symbol_11(buffer, (offset + 48u))); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : UB, offset : u32) -> array, 2u> { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> array, 2u> { var arr : array, 2u>; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { arr[i_1] = tint_symbol_8(buffer, (offset + (i_1 * 16u))); @@ -774,30 +774,30 @@ fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_pa return arr; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - var a : i32 = tint_symbol(ub, 0u); - var b : u32 = tint_symbol_1(ub, 4u); - var c : f32 = tint_symbol_2(ub, 8u); - var d : vec2 = tint_symbol_3(ub, 16u); - var e : vec2 = tint_symbol_4(ub, 24u); - var f : vec2 = tint_symbol_5(ub, 32u); - var g : vec3 = tint_symbol_6(ub, 48u); - var h : vec3 = tint_symbol_7(ub, 64u); - var i : vec3 = tint_symbol_8(ub, 80u); - var j : vec4 = tint_symbol_9(ub, 96u); - var k : vec4 = tint_symbol_10(ub, 112u); - var l : vec4 = tint_symbol_11(ub, 128u); - var m : mat2x2 = tint_symbol_12(ub, 144u); - var n : mat2x3 = tint_symbol_13(ub, 160u); - var o : mat2x4 = tint_symbol_14(ub, 192u); - var p : mat3x2 = tint_symbol_15(ub, 224u); - var q : mat3x3 = tint_symbol_16(ub, 256u); - var r : mat3x4 = tint_symbol_17(ub, 304u); - var s : mat4x2 = tint_symbol_18(ub, 352u); - var t : mat4x3 = tint_symbol_19(ub, 384u); - var u : mat4x4 = tint_symbol_20(ub, 448u); - var v : array, 2> = tint_symbol_21(ub, 512u); + var a : i32 = tint_symbol(&(ub), 0u); + var b : u32 = tint_symbol_1(&(ub), 4u); + var c : f32 = tint_symbol_2(&(ub), 8u); + var d : vec2 = tint_symbol_3(&(ub), 16u); + var e : vec2 = tint_symbol_4(&(ub), 24u); + var f : vec2 = tint_symbol_5(&(ub), 32u); + var g : vec3 = tint_symbol_6(&(ub), 48u); + var h : vec3 = tint_symbol_7(&(ub), 64u); + var i : vec3 = tint_symbol_8(&(ub), 80u); + var j : vec4 = tint_symbol_9(&(ub), 96u); + var k : vec4 = tint_symbol_10(&(ub), 112u); + var l : vec4 = tint_symbol_11(&(ub), 128u); + var m : mat2x2 = tint_symbol_12(&(ub), 144u); + var n : mat2x3 = tint_symbol_13(&(ub), 160u); + var o : mat2x4 = tint_symbol_14(&(ub), 192u); + var p : mat3x2 = tint_symbol_15(&(ub), 224u); + var q : mat3x3 = tint_symbol_16(&(ub), 256u); + var r : mat3x4 = tint_symbol_17(&(ub), 304u); + var s : mat4x2 = tint_symbol_18(&(ub), 352u); + var t : mat4x3 = tint_symbol_19(&(ub), 384u); + var u : mat4x4 = tint_symbol_20(&(ub), 448u); + var v : array, 2> = tint_symbol_21(&(ub), 512u); } @group(0) @binding(0) var ub : UB; @@ -862,7 +862,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { sb.a = i32(); sb.b = u32(); @@ -918,126 +918,126 @@ struct SB { @group(0) @binding(0) var sb : SB; @internal(intrinsic_store_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : i32) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : i32) @internal(intrinsic_store_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : u32) +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : u32) @internal(intrinsic_store_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : f32) +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : f32) @internal(intrinsic_store_storage_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) @internal(intrinsic_store_storage_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) @internal(intrinsic_store_storage_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x2) { +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x2) { tint_symbol_5(buffer, (offset + 0u), value[0u]); tint_symbol_5(buffer, (offset + 8u), value[1u]); } -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x3) { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x3) { tint_symbol_8(buffer, (offset + 0u), value[0u]); tint_symbol_8(buffer, (offset + 16u), value[1u]); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x4) { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x4) { tint_symbol_11(buffer, (offset + 0u), value[0u]); tint_symbol_11(buffer, (offset + 16u), value[1u]); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x2) { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x2) { tint_symbol_5(buffer, (offset + 0u), value[0u]); tint_symbol_5(buffer, (offset + 8u), value[1u]); tint_symbol_5(buffer, (offset + 16u), value[2u]); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x3) { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x3) { tint_symbol_8(buffer, (offset + 0u), value[0u]); tint_symbol_8(buffer, (offset + 16u), value[1u]); tint_symbol_8(buffer, (offset + 32u), value[2u]); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x4) { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x4) { tint_symbol_11(buffer, (offset + 0u), value[0u]); tint_symbol_11(buffer, (offset + 16u), value[1u]); tint_symbol_11(buffer, (offset + 32u), value[2u]); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x2) { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x2) { tint_symbol_5(buffer, (offset + 0u), value[0u]); tint_symbol_5(buffer, (offset + 8u), value[1u]); tint_symbol_5(buffer, (offset + 16u), value[2u]); tint_symbol_5(buffer, (offset + 24u), value[3u]); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x3) { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x3) { tint_symbol_8(buffer, (offset + 0u), value[0u]); tint_symbol_8(buffer, (offset + 16u), value[1u]); tint_symbol_8(buffer, (offset + 32u), value[2u]); tint_symbol_8(buffer, (offset + 48u), value[3u]); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x4) { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x4) { tint_symbol_11(buffer, (offset + 0u), value[0u]); tint_symbol_11(buffer, (offset + 16u), value[1u]); tint_symbol_11(buffer, (offset + 32u), value[2u]); tint_symbol_11(buffer, (offset + 48u), value[3u]); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : array, 2u>) { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : array, 2u>) { var array = value; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { tint_symbol_8(buffer, (offset + (i_1 * 16u)), array[i_1]); } } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - tint_symbol(sb, 0u, i32()); - tint_symbol_1(sb, 4u, u32()); - tint_symbol_2(sb, 8u, f32()); - tint_symbol_3(sb, 16u, vec2()); - tint_symbol_4(sb, 24u, vec2()); - tint_symbol_5(sb, 32u, vec2()); - tint_symbol_6(sb, 48u, vec3()); - tint_symbol_7(sb, 64u, vec3()); - tint_symbol_8(sb, 80u, vec3()); - tint_symbol_9(sb, 96u, vec4()); - tint_symbol_10(sb, 112u, vec4()); - tint_symbol_11(sb, 128u, vec4()); - tint_symbol_12(sb, 144u, mat2x2()); - tint_symbol_13(sb, 160u, mat2x3()); - tint_symbol_14(sb, 192u, mat2x4()); - tint_symbol_15(sb, 224u, mat3x2()); - tint_symbol_16(sb, 256u, mat3x3()); - tint_symbol_17(sb, 304u, mat3x4()); - tint_symbol_18(sb, 352u, mat4x2()); - tint_symbol_19(sb, 384u, mat4x3()); - tint_symbol_20(sb, 448u, mat4x4()); - tint_symbol_21(sb, 512u, array, 2>()); + tint_symbol(&(sb), 0u, i32()); + tint_symbol_1(&(sb), 4u, u32()); + tint_symbol_2(&(sb), 8u, f32()); + tint_symbol_3(&(sb), 16u, vec2()); + tint_symbol_4(&(sb), 24u, vec2()); + tint_symbol_5(&(sb), 32u, vec2()); + tint_symbol_6(&(sb), 48u, vec3()); + tint_symbol_7(&(sb), 64u, vec3()); + tint_symbol_8(&(sb), 80u, vec3()); + tint_symbol_9(&(sb), 96u, vec4()); + tint_symbol_10(&(sb), 112u, vec4()); + tint_symbol_11(&(sb), 128u, vec4()); + tint_symbol_12(&(sb), 144u, mat2x2()); + tint_symbol_13(&(sb), 160u, mat2x3()); + tint_symbol_14(&(sb), 192u, mat2x4()); + tint_symbol_15(&(sb), 224u, mat3x2()); + tint_symbol_16(&(sb), 256u, mat3x3()); + tint_symbol_17(&(sb), 304u, mat3x4()); + tint_symbol_18(&(sb), 352u, mat4x2()); + tint_symbol_19(&(sb), 384u, mat4x3()); + tint_symbol_20(&(sb), 448u, mat4x4()); + tint_symbol_21(&(sb), 512u, array, 2>()); } )"; @@ -1048,7 +1048,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, SB_BasicStore_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { sb.a = i32(); sb.b = u32(); @@ -1104,126 +1104,126 @@ struct SB { auto* expect = R"( @internal(intrinsic_store_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : i32) +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : i32) @internal(intrinsic_store_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : u32) +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : u32) @internal(intrinsic_store_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : f32) +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : f32) @internal(intrinsic_store_storage_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) @internal(intrinsic_store_storage_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) @internal(intrinsic_store_storage_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x2) { +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x2) { tint_symbol_5(buffer, (offset + 0u), value[0u]); tint_symbol_5(buffer, (offset + 8u), value[1u]); } -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x3) { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x3) { tint_symbol_8(buffer, (offset + 0u), value[0u]); tint_symbol_8(buffer, (offset + 16u), value[1u]); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x4) { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x4) { tint_symbol_11(buffer, (offset + 0u), value[0u]); tint_symbol_11(buffer, (offset + 16u), value[1u]); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x2) { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x2) { tint_symbol_5(buffer, (offset + 0u), value[0u]); tint_symbol_5(buffer, (offset + 8u), value[1u]); tint_symbol_5(buffer, (offset + 16u), value[2u]); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x3) { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x3) { tint_symbol_8(buffer, (offset + 0u), value[0u]); tint_symbol_8(buffer, (offset + 16u), value[1u]); tint_symbol_8(buffer, (offset + 32u), value[2u]); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x4) { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x4) { tint_symbol_11(buffer, (offset + 0u), value[0u]); tint_symbol_11(buffer, (offset + 16u), value[1u]); tint_symbol_11(buffer, (offset + 32u), value[2u]); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x2) { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x2) { tint_symbol_5(buffer, (offset + 0u), value[0u]); tint_symbol_5(buffer, (offset + 8u), value[1u]); tint_symbol_5(buffer, (offset + 16u), value[2u]); tint_symbol_5(buffer, (offset + 24u), value[3u]); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x3) { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x3) { tint_symbol_8(buffer, (offset + 0u), value[0u]); tint_symbol_8(buffer, (offset + 16u), value[1u]); tint_symbol_8(buffer, (offset + 32u), value[2u]); tint_symbol_8(buffer, (offset + 48u), value[3u]); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x4) { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x4) { tint_symbol_11(buffer, (offset + 0u), value[0u]); tint_symbol_11(buffer, (offset + 16u), value[1u]); tint_symbol_11(buffer, (offset + 32u), value[2u]); tint_symbol_11(buffer, (offset + 48u), value[3u]); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : array, 2u>) { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : array, 2u>) { var array = value; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { tint_symbol_8(buffer, (offset + (i_1 * 16u)), array[i_1]); } } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - tint_symbol(sb, 0u, i32()); - tint_symbol_1(sb, 4u, u32()); - tint_symbol_2(sb, 8u, f32()); - tint_symbol_3(sb, 16u, vec2()); - tint_symbol_4(sb, 24u, vec2()); - tint_symbol_5(sb, 32u, vec2()); - tint_symbol_6(sb, 48u, vec3()); - tint_symbol_7(sb, 64u, vec3()); - tint_symbol_8(sb, 80u, vec3()); - tint_symbol_9(sb, 96u, vec4()); - tint_symbol_10(sb, 112u, vec4()); - tint_symbol_11(sb, 128u, vec4()); - tint_symbol_12(sb, 144u, mat2x2()); - tint_symbol_13(sb, 160u, mat2x3()); - tint_symbol_14(sb, 192u, mat2x4()); - tint_symbol_15(sb, 224u, mat3x2()); - tint_symbol_16(sb, 256u, mat3x3()); - tint_symbol_17(sb, 304u, mat3x4()); - tint_symbol_18(sb, 352u, mat4x2()); - tint_symbol_19(sb, 384u, mat4x3()); - tint_symbol_20(sb, 448u, mat4x4()); - tint_symbol_21(sb, 512u, array, 2>()); + tint_symbol(&(sb), 0u, i32()); + tint_symbol_1(&(sb), 4u, u32()); + tint_symbol_2(&(sb), 8u, f32()); + tint_symbol_3(&(sb), 16u, vec2()); + tint_symbol_4(&(sb), 24u, vec2()); + tint_symbol_5(&(sb), 32u, vec2()); + tint_symbol_6(&(sb), 48u, vec3()); + tint_symbol_7(&(sb), 64u, vec3()); + tint_symbol_8(&(sb), 80u, vec3()); + tint_symbol_9(&(sb), 96u, vec4()); + tint_symbol_10(&(sb), 112u, vec4()); + tint_symbol_11(&(sb), 128u, vec4()); + tint_symbol_12(&(sb), 144u, mat2x2()); + tint_symbol_13(&(sb), 160u, mat2x3()); + tint_symbol_14(&(sb), 192u, mat2x4()); + tint_symbol_15(&(sb), 224u, mat3x2()); + tint_symbol_16(&(sb), 256u, mat3x3()); + tint_symbol_17(&(sb), 304u, mat3x4()); + tint_symbol_18(&(sb), 352u, mat4x2()); + tint_symbol_19(&(sb), 384u, mat4x3()); + tint_symbol_20(&(sb), 448u, mat4x4()); + tint_symbol_21(&(sb), 512u, array, 2>()); } @group(0) @binding(0) var sb : SB; @@ -1288,7 +1288,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var x : SB = sb; } @@ -1323,78 +1323,78 @@ struct SB { @group(0) @binding(0) var sb : SB; @internal(intrinsic_load_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> i32 +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> i32 @internal(intrinsic_load_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> u32 +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> u32 @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 @internal(intrinsic_load_storage_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_storage_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_storage_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x2 { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x2 { return mat2x2(tint_symbol_6(buffer, (offset + 0u)), tint_symbol_6(buffer, (offset + 8u))); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x3 { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x3 { return mat2x3(tint_symbol_9(buffer, (offset + 0u)), tint_symbol_9(buffer, (offset + 16u))); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x4 { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x4 { return mat2x4(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 16u))); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x2 { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x2 { return mat3x2(tint_symbol_6(buffer, (offset + 0u)), tint_symbol_6(buffer, (offset + 8u)), tint_symbol_6(buffer, (offset + 16u))); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x3 { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x3 { return mat3x3(tint_symbol_9(buffer, (offset + 0u)), tint_symbol_9(buffer, (offset + 16u)), tint_symbol_9(buffer, (offset + 32u))); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x4 { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x4 { return mat3x4(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 16u)), tint_symbol_12(buffer, (offset + 32u))); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x2 { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x2 { return mat4x2(tint_symbol_6(buffer, (offset + 0u)), tint_symbol_6(buffer, (offset + 8u)), tint_symbol_6(buffer, (offset + 16u)), tint_symbol_6(buffer, (offset + 24u))); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x3 { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x3 { return mat4x3(tint_symbol_9(buffer, (offset + 0u)), tint_symbol_9(buffer, (offset + 16u)), tint_symbol_9(buffer, (offset + 32u)), tint_symbol_9(buffer, (offset + 48u))); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x4 { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x4 { return mat4x4(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 16u)), tint_symbol_12(buffer, (offset + 32u)), tint_symbol_12(buffer, (offset + 48u))); } -fn tint_symbol_22(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> array, 2u> { +fn tint_symbol_22(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> array, 2u> { var arr : array, 2u>; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { arr[i_1] = tint_symbol_9(buffer, (offset + (i_1 * 16u))); @@ -1402,13 +1402,13 @@ fn tint_symbol_22(@internal(disable_validation__ignore_constructible_function_pa return arr; } -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> SB { +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> SB { return SB(tint_symbol_1(buffer, (offset + 0u)), tint_symbol_2(buffer, (offset + 4u)), tint_symbol_3(buffer, (offset + 8u)), tint_symbol_4(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u)), tint_symbol_6(buffer, (offset + 32u)), tint_symbol_7(buffer, (offset + 48u)), tint_symbol_8(buffer, (offset + 64u)), tint_symbol_9(buffer, (offset + 80u)), tint_symbol_10(buffer, (offset + 96u)), tint_symbol_11(buffer, (offset + 112u)), tint_symbol_12(buffer, (offset + 128u)), tint_symbol_13(buffer, (offset + 144u)), tint_symbol_14(buffer, (offset + 160u)), tint_symbol_15(buffer, (offset + 192u)), tint_symbol_16(buffer, (offset + 224u)), tint_symbol_17(buffer, (offset + 256u)), tint_symbol_18(buffer, (offset + 304u)), tint_symbol_19(buffer, (offset + 352u)), tint_symbol_20(buffer, (offset + 384u)), tint_symbol_21(buffer, (offset + 448u)), tint_symbol_22(buffer, (offset + 512u))); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - var x : SB = tint_symbol(sb, 0u); + var x : SB = tint_symbol(&(sb), 0u); } )"; @@ -1419,7 +1419,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, LoadStructure_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var x : SB = sb; } @@ -1454,78 +1454,78 @@ struct SB { auto* expect = R"( @internal(intrinsic_load_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> i32 +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> i32 @internal(intrinsic_load_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> u32 +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> u32 @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 @internal(intrinsic_load_storage_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec2 +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec2 @internal(intrinsic_load_storage_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec3 +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec3 @internal(intrinsic_load_storage_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_storage_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 @internal(intrinsic_load_storage_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> vec4 +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> vec4 -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x2 { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x2 { return mat2x2(tint_symbol_6(buffer, (offset + 0u)), tint_symbol_6(buffer, (offset + 8u))); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x3 { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x3 { return mat2x3(tint_symbol_9(buffer, (offset + 0u)), tint_symbol_9(buffer, (offset + 16u))); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat2x4 { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat2x4 { return mat2x4(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 16u))); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x2 { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x2 { return mat3x2(tint_symbol_6(buffer, (offset + 0u)), tint_symbol_6(buffer, (offset + 8u)), tint_symbol_6(buffer, (offset + 16u))); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x3 { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x3 { return mat3x3(tint_symbol_9(buffer, (offset + 0u)), tint_symbol_9(buffer, (offset + 16u)), tint_symbol_9(buffer, (offset + 32u))); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat3x4 { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat3x4 { return mat3x4(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 16u)), tint_symbol_12(buffer, (offset + 32u))); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x2 { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x2 { return mat4x2(tint_symbol_6(buffer, (offset + 0u)), tint_symbol_6(buffer, (offset + 8u)), tint_symbol_6(buffer, (offset + 16u)), tint_symbol_6(buffer, (offset + 24u))); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x3 { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x3 { return mat4x3(tint_symbol_9(buffer, (offset + 0u)), tint_symbol_9(buffer, (offset + 16u)), tint_symbol_9(buffer, (offset + 32u)), tint_symbol_9(buffer, (offset + 48u))); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> mat4x4 { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> mat4x4 { return mat4x4(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 16u)), tint_symbol_12(buffer, (offset + 32u)), tint_symbol_12(buffer, (offset + 48u))); } -fn tint_symbol_22(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> array, 2u> { +fn tint_symbol_22(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> array, 2u> { var arr : array, 2u>; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { arr[i_1] = tint_symbol_9(buffer, (offset + (i_1 * 16u))); @@ -1533,13 +1533,13 @@ fn tint_symbol_22(@internal(disable_validation__ignore_constructible_function_pa return arr; } -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> SB { +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> SB { return SB(tint_symbol_1(buffer, (offset + 0u)), tint_symbol_2(buffer, (offset + 4u)), tint_symbol_3(buffer, (offset + 8u)), tint_symbol_4(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 24u)), tint_symbol_6(buffer, (offset + 32u)), tint_symbol_7(buffer, (offset + 48u)), tint_symbol_8(buffer, (offset + 64u)), tint_symbol_9(buffer, (offset + 80u)), tint_symbol_10(buffer, (offset + 96u)), tint_symbol_11(buffer, (offset + 112u)), tint_symbol_12(buffer, (offset + 128u)), tint_symbol_13(buffer, (offset + 144u)), tint_symbol_14(buffer, (offset + 160u)), tint_symbol_15(buffer, (offset + 192u)), tint_symbol_16(buffer, (offset + 224u)), tint_symbol_17(buffer, (offset + 256u)), tint_symbol_18(buffer, (offset + 304u)), tint_symbol_19(buffer, (offset + 352u)), tint_symbol_20(buffer, (offset + 384u)), tint_symbol_21(buffer, (offset + 448u)), tint_symbol_22(buffer, (offset + 512u))); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - var x : SB = tint_symbol(sb, 0u); + var x : SB = tint_symbol(&(sb), 0u); } @group(0) @binding(0) var sb : SB; @@ -1604,7 +1604,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { sb = SB(); } @@ -1639,103 +1639,103 @@ struct SB { @group(0) @binding(0) var sb : SB; @internal(intrinsic_store_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : i32) +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : i32) @internal(intrinsic_store_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : u32) +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : u32) @internal(intrinsic_store_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : f32) +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : f32) @internal(intrinsic_store_storage_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) @internal(intrinsic_store_storage_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) @internal(intrinsic_store_storage_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x2) { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x2) { tint_symbol_6(buffer, (offset + 0u), value[0u]); tint_symbol_6(buffer, (offset + 8u), value[1u]); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x3) { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x3) { tint_symbol_9(buffer, (offset + 0u), value[0u]); tint_symbol_9(buffer, (offset + 16u), value[1u]); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x4) { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x4) { tint_symbol_12(buffer, (offset + 0u), value[0u]); tint_symbol_12(buffer, (offset + 16u), value[1u]); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x2) { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x2) { tint_symbol_6(buffer, (offset + 0u), value[0u]); tint_symbol_6(buffer, (offset + 8u), value[1u]); tint_symbol_6(buffer, (offset + 16u), value[2u]); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x3) { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x3) { tint_symbol_9(buffer, (offset + 0u), value[0u]); tint_symbol_9(buffer, (offset + 16u), value[1u]); tint_symbol_9(buffer, (offset + 32u), value[2u]); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x4) { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x4) { tint_symbol_12(buffer, (offset + 0u), value[0u]); tint_symbol_12(buffer, (offset + 16u), value[1u]); tint_symbol_12(buffer, (offset + 32u), value[2u]); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x2) { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x2) { tint_symbol_6(buffer, (offset + 0u), value[0u]); tint_symbol_6(buffer, (offset + 8u), value[1u]); tint_symbol_6(buffer, (offset + 16u), value[2u]); tint_symbol_6(buffer, (offset + 24u), value[3u]); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x3) { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x3) { tint_symbol_9(buffer, (offset + 0u), value[0u]); tint_symbol_9(buffer, (offset + 16u), value[1u]); tint_symbol_9(buffer, (offset + 32u), value[2u]); tint_symbol_9(buffer, (offset + 48u), value[3u]); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x4) { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x4) { tint_symbol_12(buffer, (offset + 0u), value[0u]); tint_symbol_12(buffer, (offset + 16u), value[1u]); tint_symbol_12(buffer, (offset + 32u), value[2u]); tint_symbol_12(buffer, (offset + 48u), value[3u]); } -fn tint_symbol_22(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : array, 2u>) { +fn tint_symbol_22(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : array, 2u>) { var array = value; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { tint_symbol_9(buffer, (offset + (i_1 * 16u)), array[i_1]); } } -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : SB) { +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : SB) { tint_symbol_1(buffer, (offset + 0u), value.a); tint_symbol_2(buffer, (offset + 4u), value.b); tint_symbol_3(buffer, (offset + 8u), value.c); @@ -1760,9 +1760,9 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param tint_symbol_22(buffer, (offset + 512u), value.v); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - tint_symbol(sb, 0u, SB()); + tint_symbol(&(sb), 0u, SB()); } )"; @@ -1773,7 +1773,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, StoreStructure_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { sb = SB(); } @@ -1808,103 +1808,103 @@ struct SB { auto* expect = R"( @internal(intrinsic_store_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : i32) +fn tint_symbol_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : i32) @internal(intrinsic_store_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : u32) +fn tint_symbol_2(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : u32) @internal(intrinsic_store_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : f32) +fn tint_symbol_3(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : f32) @internal(intrinsic_store_storage_vec2_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_4(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec2_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_5(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec2_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec2) +fn tint_symbol_6(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec2) @internal(intrinsic_store_storage_vec3_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_7(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec3_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_8(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec3_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec3) +fn tint_symbol_9(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec3) @internal(intrinsic_store_storage_vec4_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_10(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) @internal(intrinsic_store_storage_vec4_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_11(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) @internal(intrinsic_store_storage_vec4_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : vec4) +fn tint_symbol_12(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : vec4) -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x2) { +fn tint_symbol_13(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x2) { tint_symbol_6(buffer, (offset + 0u), value[0u]); tint_symbol_6(buffer, (offset + 8u), value[1u]); } -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x3) { +fn tint_symbol_14(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x3) { tint_symbol_9(buffer, (offset + 0u), value[0u]); tint_symbol_9(buffer, (offset + 16u), value[1u]); } -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat2x4) { +fn tint_symbol_15(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat2x4) { tint_symbol_12(buffer, (offset + 0u), value[0u]); tint_symbol_12(buffer, (offset + 16u), value[1u]); } -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x2) { +fn tint_symbol_16(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x2) { tint_symbol_6(buffer, (offset + 0u), value[0u]); tint_symbol_6(buffer, (offset + 8u), value[1u]); tint_symbol_6(buffer, (offset + 16u), value[2u]); } -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x3) { +fn tint_symbol_17(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x3) { tint_symbol_9(buffer, (offset + 0u), value[0u]); tint_symbol_9(buffer, (offset + 16u), value[1u]); tint_symbol_9(buffer, (offset + 32u), value[2u]); } -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat3x4) { +fn tint_symbol_18(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat3x4) { tint_symbol_12(buffer, (offset + 0u), value[0u]); tint_symbol_12(buffer, (offset + 16u), value[1u]); tint_symbol_12(buffer, (offset + 32u), value[2u]); } -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x2) { +fn tint_symbol_19(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x2) { tint_symbol_6(buffer, (offset + 0u), value[0u]); tint_symbol_6(buffer, (offset + 8u), value[1u]); tint_symbol_6(buffer, (offset + 16u), value[2u]); tint_symbol_6(buffer, (offset + 24u), value[3u]); } -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x3) { +fn tint_symbol_20(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x3) { tint_symbol_9(buffer, (offset + 0u), value[0u]); tint_symbol_9(buffer, (offset + 16u), value[1u]); tint_symbol_9(buffer, (offset + 32u), value[2u]); tint_symbol_9(buffer, (offset + 48u), value[3u]); } -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : mat4x4) { +fn tint_symbol_21(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : mat4x4) { tint_symbol_12(buffer, (offset + 0u), value[0u]); tint_symbol_12(buffer, (offset + 16u), value[1u]); tint_symbol_12(buffer, (offset + 32u), value[2u]); tint_symbol_12(buffer, (offset + 48u), value[3u]); } -fn tint_symbol_22(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : array, 2u>) { +fn tint_symbol_22(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : array, 2u>) { var array = value; for(var i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { tint_symbol_9(buffer, (offset + (i_1 * 16u)), array[i_1]); } } -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, value : SB) { +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, value : SB) { tint_symbol_1(buffer, (offset + 0u), value.a); tint_symbol_2(buffer, (offset + 4u), value.b); tint_symbol_3(buffer, (offset + 8u), value.c); @@ -1929,9 +1929,9 @@ fn tint_symbol(@internal(disable_validation__ignore_constructible_function_param tint_symbol_22(buffer, (offset + 512u), value.v); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - tint_symbol(sb, 0u, SB()); + tint_symbol(&(sb), 0u, SB()); } @group(0) @binding(0) var sb : SB; @@ -1993,7 +1993,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var x : f32 = sb.b[4].b[1].b.z; } @@ -2028,11 +2028,11 @@ struct SB { @group(0) @binding(0) var sb : SB; @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - var x : f32 = tint_symbol(sb, 712u); + var x : f32 = tint_symbol(&(sb), 712u); } )"; @@ -2043,7 +2043,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, ComplexStaticAccessChain_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var x : f32 = sb.b[4].b[1].b.z; } @@ -2078,11 +2078,11 @@ struct S1 { auto* expect = R"( @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - var x : f32 = tint_symbol(sb, 712u); + var x : f32 = tint_symbol(&(sb), 712u); } @group(0) @binding(0) var sb : SB; @@ -2133,7 +2133,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 4; var j : u32 = 1u; @@ -2164,14 +2164,14 @@ struct SB { @group(0) @binding(0) var sb : SB; @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 4; var j : u32 = 1u; var k : i32 = 2; - var x : f32 = tint_symbol(sb, (((((128u + (128u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k)))); + var x : f32 = tint_symbol(&(sb), (((((128u + (128u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k)))); } )"; @@ -2182,7 +2182,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, ComplexDynamicAccessChain_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 4; var j : u32 = 1u; @@ -2213,14 +2213,14 @@ struct S1 { auto* expect = R"( @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 4; var j : u32 = 1u; var k : i32 = 2; - var x : f32 = tint_symbol(sb, (((((128u + (128u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k)))); + var x : f32 = tint_symbol(&(sb), (((((128u + (128u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k)))); } @group(0) @binding(0) var sb : SB; @@ -2279,7 +2279,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 4; var j : u32 = 1u; @@ -2318,14 +2318,14 @@ struct SB { @group(0) @binding(0) var sb : SB; @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 4; var j : u32 = 1u; var k : i32 = 2; - var x : f32 = tint_symbol(sb, (((((128u + (128u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k)))); + var x : f32 = tint_symbol(&(sb), (((((128u + (128u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k)))); } )"; @@ -2336,7 +2336,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, ComplexDynamicAccessChainWithAliases_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 4; var j : u32 = 1u; @@ -2375,14 +2375,14 @@ struct S1 { auto* expect = R"( @internal(intrinsic_load_storage_f32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> f32 +fn tint_symbol(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> f32 -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 4; var j : u32 = 1u; var k : i32 = 2; - var x : f32 = tint_symbol(sb, (((((128u + (128u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k)))); + var x : f32 = tint_symbol(&(sb), (((((128u + (128u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k)))); } @group(0) @binding(0) var sb : SB; @@ -2429,7 +2429,7 @@ struct SB { @group(0) @binding(0) var sb : SB; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { atomicStore(&sb.a, 123); atomicLoad(&sb.a); @@ -2467,95 +2467,105 @@ struct SB { @group(0) @binding(0) var sb : SB; @internal(intrinsic_atomic_store_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) +fn tint_atomicStore(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) @internal(intrinsic_atomic_load_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> i32 +fn tint_atomicLoad(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> i32 @internal(intrinsic_atomic_add_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicAdd(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_sub_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicSub(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_max_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicMax(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_min_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicMin(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_and_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicAnd(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_or_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicOr(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_xor_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicXor(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_exchange_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicExchange(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 + +struct atomic_compare_exchange_weak_ret_type { + old_value : i32, + exchanged : bool, +} @internal(intrinsic_atomic_compare_exchange_weak_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32, param_2 : i32) -> vec2 +fn tint_atomicCompareExchangeWeak(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32, param_2 : i32) -> atomic_compare_exchange_weak_ret_type @internal(intrinsic_atomic_store_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) +fn tint_atomicStore_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) @internal(intrinsic_atomic_load_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> u32 +fn tint_atomicLoad_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> u32 @internal(intrinsic_atomic_add_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicAdd_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_sub_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicSub_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_max_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicMax_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_min_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicMin_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_and_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicAnd_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_or_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicOr_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_xor_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicXor_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_exchange_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicExchange_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 + +struct atomic_compare_exchange_weak_ret_type_1 { + old_value : u32, + exchanged : bool, +} @internal(intrinsic_atomic_compare_exchange_weak_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32, param_2 : u32) -> vec2 +fn tint_atomicCompareExchangeWeak_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32, param_2 : u32) -> atomic_compare_exchange_weak_ret_type_1 -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - tint_symbol(sb, 16u, 123); - tint_symbol_1(sb, 16u); - tint_symbol_2(sb, 16u, 123); - tint_symbol_3(sb, 16u, 123); - tint_symbol_4(sb, 16u, 123); - tint_symbol_5(sb, 16u, 123); - tint_symbol_6(sb, 16u, 123); - tint_symbol_7(sb, 16u, 123); - tint_symbol_8(sb, 16u, 123); - tint_symbol_9(sb, 16u, 123); - tint_symbol_10(sb, 16u, 123, 345); - tint_symbol_11(sb, 20u, 123u); - tint_symbol_12(sb, 20u); - tint_symbol_13(sb, 20u, 123u); - tint_symbol_14(sb, 20u, 123u); - tint_symbol_15(sb, 20u, 123u); - tint_symbol_16(sb, 20u, 123u); - tint_symbol_17(sb, 20u, 123u); - tint_symbol_18(sb, 20u, 123u); - tint_symbol_19(sb, 20u, 123u); - tint_symbol_20(sb, 20u, 123u); - tint_symbol_21(sb, 20u, 123u, 345u); + tint_atomicStore(&(sb), 16u, 123); + tint_atomicLoad(&(sb), 16u); + tint_atomicAdd(&(sb), 16u, 123); + tint_atomicSub(&(sb), 16u, 123); + tint_atomicMax(&(sb), 16u, 123); + tint_atomicMin(&(sb), 16u, 123); + tint_atomicAnd(&(sb), 16u, 123); + tint_atomicOr(&(sb), 16u, 123); + tint_atomicXor(&(sb), 16u, 123); + tint_atomicExchange(&(sb), 16u, 123); + tint_atomicCompareExchangeWeak(&(sb), 16u, 123, 345); + tint_atomicStore_1(&(sb), 20u, 123u); + tint_atomicLoad_1(&(sb), 20u); + tint_atomicAdd_1(&(sb), 20u, 123u); + tint_atomicSub_1(&(sb), 20u, 123u); + tint_atomicMax_1(&(sb), 20u, 123u); + tint_atomicMin_1(&(sb), 20u, 123u); + tint_atomicAnd_1(&(sb), 20u, 123u); + tint_atomicOr_1(&(sb), 20u, 123u); + tint_atomicXor_1(&(sb), 20u, 123u); + tint_atomicExchange_1(&(sb), 20u, 123u); + tint_atomicCompareExchangeWeak_1(&(sb), 20u, 123u, 345u); } )"; @@ -2566,7 +2576,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, StorageBufferAtomics_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { atomicStore(&sb.a, 123); atomicLoad(&sb.a); @@ -2604,95 +2614,105 @@ struct SB { auto* expect = R"( @internal(intrinsic_atomic_store_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) +fn tint_atomicStore(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) @internal(intrinsic_atomic_load_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_1(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> i32 +fn tint_atomicLoad(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> i32 @internal(intrinsic_atomic_add_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_2(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicAdd(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_sub_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_3(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicSub(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_max_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_4(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicMax(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_min_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_5(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicMin(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_and_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_6(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicAnd(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_or_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_7(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicOr(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_xor_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_8(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicXor(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 @internal(intrinsic_atomic_exchange_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_9(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32) -> i32 +fn tint_atomicExchange(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32) -> i32 + +struct atomic_compare_exchange_weak_ret_type { + old_value : i32, + exchanged : bool, +} @internal(intrinsic_atomic_compare_exchange_weak_storage_i32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_10(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : i32, param_2 : i32) -> vec2 +fn tint_atomicCompareExchangeWeak(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : i32, param_2 : i32) -> atomic_compare_exchange_weak_ret_type @internal(intrinsic_atomic_store_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_11(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) +fn tint_atomicStore_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) @internal(intrinsic_atomic_load_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_12(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32) -> u32 +fn tint_atomicLoad_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32) -> u32 @internal(intrinsic_atomic_add_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_13(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicAdd_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_sub_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_14(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicSub_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_max_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_15(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicMax_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_min_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_16(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicMin_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_and_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_17(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicAnd_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_or_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_18(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicOr_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_xor_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_19(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicXor_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 @internal(intrinsic_atomic_exchange_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_20(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32) -> u32 +fn tint_atomicExchange_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32) -> u32 + +struct atomic_compare_exchange_weak_ret_type_1 { + old_value : u32, + exchanged : bool, +} @internal(intrinsic_atomic_compare_exchange_weak_storage_u32) @internal(disable_validation__function_has_no_body) -fn tint_symbol_21(@internal(disable_validation__ignore_constructible_function_parameter) buffer : SB, offset : u32, param_1 : u32, param_2 : u32) -> vec2 +fn tint_atomicCompareExchangeWeak_1(@internal(disable_validation__function_parameter) buffer : ptr, offset : u32, param_1 : u32, param_2 : u32) -> atomic_compare_exchange_weak_ret_type_1 -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - tint_symbol(sb, 16u, 123); - tint_symbol_1(sb, 16u); - tint_symbol_2(sb, 16u, 123); - tint_symbol_3(sb, 16u, 123); - tint_symbol_4(sb, 16u, 123); - tint_symbol_5(sb, 16u, 123); - tint_symbol_6(sb, 16u, 123); - tint_symbol_7(sb, 16u, 123); - tint_symbol_8(sb, 16u, 123); - tint_symbol_9(sb, 16u, 123); - tint_symbol_10(sb, 16u, 123, 345); - tint_symbol_11(sb, 20u, 123u); - tint_symbol_12(sb, 20u); - tint_symbol_13(sb, 20u, 123u); - tint_symbol_14(sb, 20u, 123u); - tint_symbol_15(sb, 20u, 123u); - tint_symbol_16(sb, 20u, 123u); - tint_symbol_17(sb, 20u, 123u); - tint_symbol_18(sb, 20u, 123u); - tint_symbol_19(sb, 20u, 123u); - tint_symbol_20(sb, 20u, 123u); - tint_symbol_21(sb, 20u, 123u, 345u); + tint_atomicStore(&(sb), 16u, 123); + tint_atomicLoad(&(sb), 16u); + tint_atomicAdd(&(sb), 16u, 123); + tint_atomicSub(&(sb), 16u, 123); + tint_atomicMax(&(sb), 16u, 123); + tint_atomicMin(&(sb), 16u, 123); + tint_atomicAnd(&(sb), 16u, 123); + tint_atomicOr(&(sb), 16u, 123); + tint_atomicXor(&(sb), 16u, 123); + tint_atomicExchange(&(sb), 16u, 123); + tint_atomicCompareExchangeWeak(&(sb), 16u, 123, 345); + tint_atomicStore_1(&(sb), 20u, 123u); + tint_atomicLoad_1(&(sb), 20u); + tint_atomicAdd_1(&(sb), 20u, 123u); + tint_atomicSub_1(&(sb), 20u, 123u); + tint_atomicMax_1(&(sb), 20u, 123u); + tint_atomicMin_1(&(sb), 20u, 123u); + tint_atomicAnd_1(&(sb), 20u, 123u); + tint_atomicOr_1(&(sb), 20u, 123u); + tint_atomicXor_1(&(sb), 20u, 123u); + tint_atomicExchange_1(&(sb), 20u, 123u); + tint_atomicCompareExchangeWeak_1(&(sb), 20u, 123u, 345u); } @group(0) @binding(0) var sb : SB; @@ -2719,7 +2739,7 @@ struct S { var w : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { atomicStore(&(w.a), 123); atomicLoad(&(w.a)); @@ -2755,7 +2775,7 @@ fn main() { TEST_F(DecomposeMemoryAccessTest, WorkgroupBufferAtomics_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { atomicStore(&(w.a), 123); atomicLoad(&(w.a)); diff --git a/src/tint/transform/decompose_strided_array.cc b/src/tint/transform/decompose_strided_array.cc index bf36c06fd2..61841f6299 100644 --- a/src/tint/transform/decompose_strided_array.cc +++ b/src/tint/transform/decompose_strided_array.cc @@ -72,8 +72,10 @@ void DecomposeStridedArray::Run(CloneContext& ctx, const DataMap&, DataMap&) con auto name = ctx.dst->Symbols().New("strided_arr"); auto* member_ty = ctx.Clone(ast->type); auto* member = ctx.dst->Member(kMemberName, member_ty, - {ctx.dst->MemberSize(arr->Stride())}); - ctx.dst->Structure(name, {member}); + utils::Vector{ + ctx.dst->MemberSize(arr->Stride()), + }); + ctx.dst->Structure(name, utils::Vector{member}); return name; }); auto* count = ctx.Clone(ast->count); @@ -114,8 +116,8 @@ void DecomposeStridedArray::Run(CloneContext& ctx, const DataMap&, DataMap&) con // -> // `array(strided_arr(1), strided_arr(2), strided_arr(3))` ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::Expression* { - if (!expr->args.empty()) { - if (auto* call = sem.Get(expr)) { + if (!expr->args.IsEmpty()) { + if (auto* call = sem.Get(expr)->UnwrapMaterialize()->As()) { if (auto* ctor = call->Target()->As()) { if (auto* arr = ctor->ReturnType()->As()) { // Begin by cloning the array constructor type or name @@ -130,18 +132,18 @@ void DecomposeStridedArray::Run(CloneContext& ctx, const DataMap&, DataMap&) con target.name = ctx.Clone(expr->target.name); } - ast::ExpressionList args; + utils::Vector args; if (auto it = decomposed.find(arr); it != decomposed.end()) { - args.reserve(expr->args.size()); + args.Reserve(expr->args.Length()); for (auto* arg : expr->args) { - args.emplace_back(ctx.dst->Call(it->second, ctx.Clone(arg))); + args.Push(ctx.dst->Call(it->second, ctx.Clone(arg))); } } else { args = ctx.Clone(expr->args); } - return target.type ? ctx.dst->Construct(target.type, args) - : ctx.dst->Call(target.name, args); + return target.type ? ctx.dst->Construct(target.type, std::move(args)) + : ctx.dst->Call(target.name, std::move(args)); } } } diff --git a/src/tint/transform/decompose_strided_array_test.cc b/src/tint/transform/decompose_strided_array_test.cc index cd9d63c102..2de42fa3c4 100644 --- a/src/tint/transform/decompose_strided_array_test.cc +++ b/src/tint/transform/decompose_strided_array_test.cc @@ -39,7 +39,7 @@ TEST_F(DecomposeStridedArrayTest, ShouldRunNonStridedArray) { // var arr : array ProgramBuilder b; - b.Global("arr", b.ty.array(), ast::StorageClass::kPrivate); + b.GlobalVar("arr", b.ty.array(), ast::StorageClass::kPrivate); EXPECT_FALSE(ShouldRun(Program(std::move(b)))); } @@ -47,7 +47,7 @@ TEST_F(DecomposeStridedArrayTest, ShouldRunDefaultStridedArray) { // var arr : @stride(4) array ProgramBuilder b; - b.Global("arr", b.ty.array(4), ast::StorageClass::kPrivate); + b.GlobalVar("arr", b.ty.array(4), ast::StorageClass::kPrivate); EXPECT_TRUE(ShouldRun(Program(std::move(b)))); } @@ -55,7 +55,7 @@ TEST_F(DecomposeStridedArrayTest, ShouldRunExplicitStridedArray) { // var arr : @stride(16) array ProgramBuilder b; - b.Global("arr", b.ty.array(16), ast::StorageClass::kPrivate); + b.GlobalVar("arr", b.ty.array(16), ast::StorageClass::kPrivate); EXPECT_TRUE(ShouldRun(Program(std::move(b)))); } @@ -71,20 +71,20 @@ TEST_F(DecomposeStridedArrayTest, Empty) { TEST_F(DecomposeStridedArrayTest, PrivateDefaultStridedArray) { // var arr : @stride(4) array // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a : @stride(4) array = a; // let b : f32 = arr[1]; // } ProgramBuilder b; - b.Global("arr", b.ty.array(4), ast::StorageClass::kPrivate); - b.Func("f", {}, b.ty.void_(), - { + b.GlobalVar("arr", b.ty.array(4), ast::StorageClass::kPrivate); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("a", b.ty.array(4), b.Expr("arr"))), b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor("arr", 1_i))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -92,7 +92,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateDefaultStridedArray) { auto* expect = R"( var arr : array; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let a : array = arr; let b : f32 = arr[1i]; @@ -107,20 +107,20 @@ fn f() { TEST_F(DecomposeStridedArrayTest, PrivateStridedArray) { // var arr : @stride(32) array // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a : @stride(32) array = a; // let b : f32 = arr[1]; // } ProgramBuilder b; - b.Global("arr", b.ty.array(32), ast::StorageClass::kPrivate); - b.Func("f", {}, b.ty.void_(), - { + b.GlobalVar("arr", b.ty.array(32), ast::StorageClass::kPrivate); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("a", b.ty.array(32), b.Expr("arr"))), b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor("arr", 1_i))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -133,7 +133,7 @@ struct strided_arr { var arr : array; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let a : array = arr; let b : f32 = arr[1i].el; @@ -151,20 +151,20 @@ TEST_F(DecomposeStridedArrayTest, ReadUniformStridedArray) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a : @stride(32) array = s.a; // let b : f32 = s.a[1]; // } ProgramBuilder b; - auto* S = b.Structure("S", {b.Member("a", b.ty.array(32))}); - b.Global("s", b.ty.Of(S), ast::StorageClass::kUniform, b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array(32))}); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kUniform, b.Group(0), b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("a", b.ty.array(32), b.MemberAccessor("s", "a"))), b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -181,7 +181,7 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let a : array = s.a; let b : f32 = s.a[1i].el; @@ -199,22 +199,22 @@ TEST_F(DecomposeStridedArrayTest, ReadUniformDefaultStridedArray) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a : @stride(16) array, 4u> = s.a; // let b : f32 = s.a[1][2]; // } ProgramBuilder b; - auto* S = b.Structure("S", {b.Member("a", b.ty.array(b.ty.vec4(), 4_u, 16))}); - b.Global("s", b.ty.Of(S), ast::StorageClass::kUniform, b.GroupAndBinding(0, 0)); + auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array(b.ty.vec4(), 4_u, 16))}); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kUniform, b.Group(0), b.Binding(0)); b.Func( - "f", {}, b.ty.void_(), - { + "f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("a", b.ty.array(b.ty.vec4(), 4_u, 16), b.MemberAccessor("s", "a"))), b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 2_i))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -227,7 +227,7 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let a : array, 4u> = s.a; let b : f32 = s.a[1i][2i]; @@ -245,20 +245,20 @@ TEST_F(DecomposeStridedArrayTest, ReadStorageStridedArray) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a : @stride(32) array = s.a; // let b : f32 = s.a[1]; // } ProgramBuilder b; - auto* S = b.Structure("S", {b.Member("a", b.ty.array(32))}); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array(32))}); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, b.Group(0), b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("a", b.ty.array(32), b.MemberAccessor("s", "a"))), b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -275,7 +275,7 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let a : array = s.a; let b : f32 = s.a[1i].el; @@ -293,20 +293,20 @@ TEST_F(DecomposeStridedArrayTest, ReadStorageDefaultStridedArray) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a : @stride(4) array = s.a; // let b : f32 = s.a[1]; // } ProgramBuilder b; - auto* S = b.Structure("S", {b.Member("a", b.ty.array(4))}); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array(4))}); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, b.Group(0), b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("a", b.ty.array(4), b.MemberAccessor("s", "a"))), b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -318,7 +318,7 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let a : array = s.a; let b : f32 = s.a[1i]; @@ -336,24 +336,24 @@ TEST_F(DecomposeStridedArrayTest, WriteStorageStridedArray) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // s.a = @stride(32) array(); // s.a = @stride(32) array(1.0, 2.0, 3.0, 4.0); // s.a[1i] = 5.0; // } ProgramBuilder b; - auto* S = b.Structure("S", {b.Member("a", b.ty.array(32))}); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array(32))}); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Assign(b.MemberAccessor("s", "a"), b.Construct(b.ty.array(32))), b.Assign(b.MemberAccessor("s", "a"), - b.Construct(b.ty.array(32), 1.0f, 2.0f, 3.0f, 4.0f)), - b.Assign(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 5.0f), + b.Construct(b.ty.array(32), 1_f, 2_f, 3_f, 4_f)), + b.Assign(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 5_f), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -371,11 +371,11 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { s.a = array(); - s.a = array(strided_arr(1.0), strided_arr(2.0), strided_arr(3.0), strided_arr(4.0)); - s.a[1i].el = 5.0; + s.a = array(strided_arr(1.0f), strided_arr(2.0f), strided_arr(3.0f), strided_arr(4.0f)); + s.a[1i].el = 5.0f; } )"; @@ -390,24 +390,24 @@ TEST_F(DecomposeStridedArrayTest, WriteStorageDefaultStridedArray) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // s.a = @stride(4) array(); // s.a = @stride(4) array(1.0, 2.0, 3.0, 4.0); // s.a[1] = 5.0; // } ProgramBuilder b; - auto* S = b.Structure("S", {b.Member("a", b.ty.array(4))}); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array(4))}); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Assign(b.MemberAccessor("s", "a"), b.Construct(b.ty.array(4))), b.Assign(b.MemberAccessor("s", "a"), - b.Construct(b.ty.array(4), 1.0f, 2.0f, 3.0f, 4.0f)), - b.Assign(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 5.0f), + b.Construct(b.ty.array(4), 1_f, 2_f, 3_f, 4_f)), + b.Assign(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 5_f), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -420,11 +420,11 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { s.a = array(); - s.a = array(1.0, 2.0, 3.0, 4.0); - s.a[1i] = 5.0; + s.a = array(1.0f, 2.0f, 3.0f, 4.0f); + s.a[1i] = 5.0f; } )"; @@ -439,7 +439,7 @@ TEST_F(DecomposeStridedArrayTest, ReadWriteViaPointerLets) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a = &s.a; // let b = &*&*(a); @@ -449,19 +449,19 @@ TEST_F(DecomposeStridedArrayTest, ReadWriteViaPointerLets) { // (*b)[1] = 5.0; // } ProgramBuilder b; - auto* S = b.Structure("S", {b.Member("a", b.ty.array(32))}); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { - b.Decl(b.Let("a", nullptr, b.AddressOf(b.MemberAccessor("s", "a")))), - b.Decl(b.Let("b", nullptr, b.AddressOf(b.Deref(b.AddressOf(b.Deref("a")))))), - b.Decl(b.Let("c", nullptr, b.Deref("b"))), - b.Decl(b.Let("d", nullptr, b.IndexAccessor(b.Deref("b"), 1_i))), - b.Assign(b.Deref("b"), b.Construct(b.ty.array(32), 1.0f, 2.0f, 3.0f, 4.0f)), - b.Assign(b.IndexAccessor(b.Deref("b"), 1_i), 5.0f), + auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array(32))}); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ + b.Decl(b.Let("a", b.AddressOf(b.MemberAccessor("s", "a")))), + b.Decl(b.Let("b", b.AddressOf(b.Deref(b.AddressOf(b.Deref("a")))))), + b.Decl(b.Let("c", b.Deref("b"))), + b.Decl(b.Let("d", b.IndexAccessor(b.Deref("b"), 1_i))), + b.Assign(b.Deref("b"), b.Construct(b.ty.array(32), 1_f, 2_f, 3_f, 4_f)), + b.Assign(b.IndexAccessor(b.Deref("b"), 1_i), 5_f), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -479,12 +479,12 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let c = s.a; let d = s.a[1i].el; - s.a = array(strided_arr(1.0), strided_arr(2.0), strided_arr(3.0), strided_arr(4.0)); - s.a[1i].el = 5.0; + s.a = array(strided_arr(1.0f), strided_arr(2.0f), strided_arr(3.0f), strided_arr(4.0f)); + s.a[1i].el = 5.0f; } )"; @@ -500,7 +500,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateAliasedStridedArray) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a : ARR = s.a; // let b : f32 = s.a[1]; @@ -510,19 +510,19 @@ TEST_F(DecomposeStridedArrayTest, PrivateAliasedStridedArray) { // } ProgramBuilder b; b.Alias("ARR", b.ty.array(32)); - auto* S = b.Structure("S", {b.Member("a", b.ty.type_name("ARR"))}); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.type_name("ARR"))}); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("a", b.ty.type_name("ARR"), b.MemberAccessor("s", "a"))), b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i))), b.Assign(b.MemberAccessor("s", "a"), b.Construct(b.ty.type_name("ARR"))), b.Assign(b.MemberAccessor("s", "a"), - b.Construct(b.ty.type_name("ARR"), 1.0f, 2.0f, 3.0f, 4.0f)), - b.Assign(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 5.0f), + b.Construct(b.ty.type_name("ARR"), 1_f, 2_f, 3_f, 4_f)), + b.Assign(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 5_f), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -541,13 +541,13 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let a : ARR = s.a; let b : f32 = s.a[1i].el; s.a = ARR(); - s.a = ARR(strided_arr(1.0), strided_arr(2.0), strided_arr(3.0), strided_arr(4.0)); - s.a[1i].el = 5.0; + s.a = ARR(strided_arr(1.0f), strided_arr(2.0f), strided_arr(3.0f), strided_arr(4.0f)); + s.a[1i].el = 5.0f; } )"; @@ -564,7 +564,7 @@ TEST_F(DecomposeStridedArrayTest, PrivateNestedStridedArray) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a : ARR_B = s.a; // let b : array<@stride(8) array, 3u> = s.a[3]; @@ -580,11 +580,11 @@ TEST_F(DecomposeStridedArrayTest, PrivateNestedStridedArray) { b.ty.array( // b.ty.array(b.ty.type_name("ARR_A"), 3_u, 16), // 4_u, 128)); - auto* S = b.Structure("S", {b.Member("a", b.ty.type_name("ARR_B"))}); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.type_name("ARR_B"))}); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("a", b.ty.type_name("ARR_B"), b.MemberAccessor("s", "a"))), b.Decl(b.Let("b", b.ty.array(b.ty.type_name("ARR_A"), 3_u, 16), b.IndexAccessor( // @@ -612,9 +612,9 @@ TEST_F(DecomposeStridedArrayTest, PrivateNestedStridedArray) { 3_i), 2_i), 1_i), - 5.0f), + 5_f), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -641,14 +641,14 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let a : ARR_B = s.a; let b : array = s.a[3i].el; let c : ARR_A = s.a[3i].el[2i]; let d : f32 = s.a[3i].el[2i][1i].el; s.a = ARR_B(); - s.a[3i].el[2i][1i].el = 5.0; + s.a[3i].el[2i][1i].el = 5.0f; } )"; diff --git a/src/tint/transform/decompose_strided_matrix.cc b/src/tint/transform/decompose_strided_matrix.cc index 4f9d6c8db9..75c96f6602 100644 --- a/src/tint/transform/decompose_strided_matrix.cc +++ b/src/tint/transform/decompose_strided_matrix.cc @@ -105,10 +105,11 @@ DecomposeStridedMatrix::~DecomposeStridedMatrix() = default; bool DecomposeStridedMatrix::ShouldRun(const Program* program, const DataMap&) const { bool should_run = false; - GatherCustomStrideMatrixMembers(program, [&](const sem::StructMember*, sem::Matrix*, uint32_t) { - should_run = true; - return GatherResult::kStop; - }); + GatherCustomStrideMatrixMembers(program, + [&](const sem::StructMember*, const sem::Matrix*, uint32_t) { + should_run = true; + return GatherResult::kStop; + }); return should_run; } @@ -118,7 +119,7 @@ void DecomposeStridedMatrix::Run(CloneContext& ctx, const DataMap&, DataMap&) co // and populate the `decomposed` map with the members that have been replaced. std::unordered_map decomposed; GatherCustomStrideMatrixMembers( - ctx.src, [&](const sem::StructMember* member, sem::Matrix* matrix, uint32_t stride) { + ctx.src, [&](const sem::StructMember* member, const sem::Matrix* matrix, uint32_t stride) { // We've got ourselves a struct member of a matrix type with a custom // stride. Replace this with an array of column vectors. MatrixInfo info{stride, matrix}; @@ -169,16 +170,16 @@ void DecomposeStridedMatrix::Run(CloneContext& ctx, const DataMap&, DataMap&) co auto array = [&] { return info.array(ctx.dst); }; auto mat = ctx.dst->Sym("m"); - ast::ExpressionList columns(info.matrix->columns()); - for (uint32_t i = 0; i < static_cast(columns.size()); i++) { - columns[i] = ctx.dst->IndexAccessor(mat, u32(i)); + utils::Vector columns; + for (uint32_t i = 0; i < static_cast(info.matrix->columns()); i++) { + columns.Push(ctx.dst->IndexAccessor(mat, u32(i))); } ctx.dst->Func(name, - { + utils::Vector{ ctx.dst->Param(mat, matrix()), }, array(), - { + utils::Vector{ ctx.dst->Return(ctx.dst->Construct(array(), columns)), }); return name; @@ -210,16 +211,16 @@ void DecomposeStridedMatrix::Run(CloneContext& ctx, const DataMap&, DataMap&) co auto array = [&] { return info.array(ctx.dst); }; auto arr = ctx.dst->Sym("arr"); - ast::ExpressionList columns(info.matrix->columns()); - for (uint32_t i = 0; i < static_cast(columns.size()); i++) { - columns[i] = ctx.dst->IndexAccessor(arr, u32(i)); + utils::Vector columns; + for (uint32_t i = 0; i < static_cast(info.matrix->columns()); i++) { + columns.Push(ctx.dst->IndexAccessor(arr, u32(i))); } ctx.dst->Func(name, - { + utils::Vector{ ctx.dst->Param(arr, array()), }, matrix(), - { + utils::Vector{ ctx.dst->Return(ctx.dst->Construct(matrix(), columns)), }); return name; diff --git a/src/tint/transform/decompose_strided_matrix_test.cc b/src/tint/transform/decompose_strided_matrix_test.cc index 23b30d5b37..a947f6d342 100644 --- a/src/tint/transform/decompose_strided_matrix_test.cc +++ b/src/tint/transform/decompose_strided_matrix_test.cc @@ -62,26 +62,26 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let x : mat2x2 = s.m; // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(16), - b.create(32), + utils::Vector{ + b.create(16u), + b.create(32u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kUniform, b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kUniform, b.Group(0), b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("x", b.ty.mat2x2(), b.MemberAccessor("s", "m"))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -99,7 +99,7 @@ fn arr_to_mat2x2_stride_32(arr : @stride(32) array, 2u>) -> mat2x2(arr[0u], arr[1u]); } -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let x : mat2x2 = arr_to_mat2x2_stride_32(s.m); } @@ -118,27 +118,27 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformColumn) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let x : vec2 = s.m[1]; // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(16), - b.create(32), + utils::Vector{ + b.create(16u), + b.create(32u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kUniform, b.GroupAndBinding(0, 0)); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kUniform, b.Group(0), b.Binding(0)); b.Func( - "f", {}, b.ty.void_(), - { + "f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("x", b.ty.vec2(), b.IndexAccessor(b.MemberAccessor("s", "m"), 1_i))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -152,7 +152,7 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let x : vec2 = s.m[1i]; } @@ -171,26 +171,26 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix_DefaultStride) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let x : mat2x2 = s.m; // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(16), - b.create(8), + utils::Vector{ + b.create(16u), + b.create(8u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kUniform, b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kUniform, b.Group(0), b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("x", b.ty.mat2x2(), b.MemberAccessor("s", "m"))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -205,7 +205,7 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let x : mat2x2 = s.m; } @@ -224,27 +224,27 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageMatrix) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let x : mat2x2 = s.m; // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(8), - b.create(32), + utils::Vector{ + b.create(8u), + b.create(32u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("x", b.ty.mat2x2(), b.MemberAccessor("s", "m"))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -262,7 +262,7 @@ fn arr_to_mat2x2_stride_32(arr : @stride(32) array, 2u>) -> mat2x2(arr[0u], arr[1u]); } -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let x : mat2x2 = arr_to_mat2x2_stride_32(s.m); } @@ -281,28 +281,28 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageColumn) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let x : vec2 = s.m[1]; // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(16), - b.create(32), + utils::Vector{ + b.create(16u), + b.create(32u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); b.Func( - "f", {}, b.ty.void_(), - { + "f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("x", b.ty.vec2(), b.IndexAccessor(b.MemberAccessor("s", "m"), 1_i))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -316,7 +316,7 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let x : vec2 = s.m[1i]; } @@ -335,28 +335,28 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageMatrix) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // s.m = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(8), - b.create(32), + utils::Vector{ + b.create(8u), + b.create(32u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Assign(b.MemberAccessor("s", "m"), - b.mat2x2(b.vec2(1.0f, 2.0f), b.vec2(3.0f, 4.0f))), + b.mat2x2(b.vec2(1_f, 2_f), b.vec2(3_f, 4_f))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -374,9 +374,9 @@ fn mat2x2_stride_32_to_arr(m : mat2x2) -> @stride(32) array, 2u> return @stride(32) array, 2u>(m[0u], m[1u]); } -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { - s.m = mat2x2_stride_32_to_arr(mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0))); + s.m = mat2x2_stride_32_to_arr(mat2x2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f))); } )"; @@ -393,27 +393,27 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageColumn) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // s.m[1] = vec2(1.0, 2.0); // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(8), - b.create(32), + utils::Vector{ + b.create(8u), + b.create(32u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); - b.Func("f", {}, b.ty.void_(), - { - b.Assign(b.IndexAccessor(b.MemberAccessor("s", "m"), 1_i), b.vec2(1.0f, 2.0f)), + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ + b.Assign(b.IndexAccessor(b.MemberAccessor("s", "m"), 1_i), b.vec2(1_f, 2_f)), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -427,9 +427,9 @@ struct S { @group(0) @binding(0) var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { - s.m[1i] = vec2(1.0, 2.0); + s.m[1i] = vec2(1.0f, 2.0f); } )"; @@ -446,7 +446,7 @@ TEST_F(DecomposeStridedMatrixTest, ReadWriteViaPointerLets) { // }; // @group(0) @binding(0) var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let a = &s.m; // let b = &*&*(a); @@ -458,31 +458,30 @@ TEST_F(DecomposeStridedMatrixTest, ReadWriteViaPointerLets) { // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(8), - b.create(32), + utils::Vector{ + b.create(8u), + b.create(32u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, - b.GroupAndBinding(0, 0)); - b.Func( - "f", {}, b.ty.void_(), - { - b.Decl(b.Let("a", nullptr, b.AddressOf(b.MemberAccessor("s", "m")))), - b.Decl(b.Let("b", nullptr, b.AddressOf(b.Deref(b.AddressOf(b.Deref("a")))))), - b.Decl(b.Let("x", nullptr, b.Deref("b"))), - b.Decl(b.Let("y", nullptr, b.IndexAccessor(b.Deref("b"), 1_i))), - b.Decl(b.Let("z", nullptr, b.IndexAccessor("x", 1_i))), - b.Assign(b.Deref("b"), b.mat2x2(b.vec2(1.0f, 2.0f), b.vec2(3.0f, 4.0f))), - b.Assign(b.IndexAccessor(b.Deref("b"), 1_i), b.vec2(5.0f, 6.0f)), - }, - { - b.Stage(ast::PipelineStage::kCompute), - b.WorkgroupSize(1_i), - }); + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kStorage, ast::Access::kReadWrite, b.Group(0), + b.Binding(0)); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ + b.Decl(b.Let("a", b.AddressOf(b.MemberAccessor("s", "m")))), + b.Decl(b.Let("b", b.AddressOf(b.Deref(b.AddressOf(b.Deref("a")))))), + b.Decl(b.Let("x", b.Deref("b"))), + b.Decl(b.Let("y", b.IndexAccessor(b.Deref("b"), 1_i))), + b.Decl(b.Let("z", b.IndexAccessor("x", 1_i))), + b.Assign(b.Deref("b"), b.mat2x2(b.vec2(1_f, 2_f), b.vec2(3_f, 4_f))), + b.Assign(b.IndexAccessor(b.Deref("b"), 1_i), b.vec2(5_f, 6_f)), + }, + utils::Vector{ + b.Stage(ast::PipelineStage::kCompute), + b.WorkgroupSize(1_i), + }); auto* expect = R"( struct S { @@ -501,13 +500,13 @@ fn mat2x2_stride_32_to_arr(m : mat2x2) -> @stride(32) array, 2u> return @stride(32) array, 2u>(m[0u], m[1u]); } -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let x = arr_to_mat2x2_stride_32(s.m); let y = s.m[1i]; let z = x[1i]; - s.m = mat2x2_stride_32_to_arr(mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0))); - s.m[1i] = vec2(5.0, 6.0); + s.m = mat2x2_stride_32_to_arr(mat2x2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f))); + s.m[1i] = vec2(5.0f, 6.0f); } )"; @@ -524,26 +523,26 @@ TEST_F(DecomposeStridedMatrixTest, ReadPrivateMatrix) { // }; // var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // let x : mat2x2 = s.m; // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(8), - b.create(32), + utils::Vector{ + b.create(8u), + b.create(32u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kPrivate); - b.Func("f", {}, b.ty.void_(), - { + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kPrivate); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Decl(b.Let("x", b.ty.mat2x2(), b.MemberAccessor("s", "m"))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -558,7 +557,7 @@ struct S { var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { let x : mat2x2 = s.m; } @@ -577,27 +576,27 @@ TEST_F(DecomposeStridedMatrixTest, WritePrivateMatrix) { // }; // var s : S; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn f() { // s.m = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); // } ProgramBuilder b; auto* S = b.Structure( - "S", { + "S", utils::Vector{ b.Member("m", b.ty.mat2x2(), - { - b.create(8), - b.create(32), + utils::Vector{ + b.create(8u), + b.create(32u), b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute), }), }); - b.Global("s", b.ty.Of(S), ast::StorageClass::kPrivate); - b.Func("f", {}, b.ty.void_(), - { + b.GlobalVar("s", b.ty.Of(S), ast::StorageClass::kPrivate); + b.Func("f", utils::Empty, b.ty.void_(), + utils::Vector{ b.Assign(b.MemberAccessor("s", "m"), - b.mat2x2(b.vec2(1.0f, 2.0f), b.vec2(3.0f, 4.0f))), + b.mat2x2(b.vec2(1_f, 2_f), b.vec2(3_f, 4_f))), }, - { + utils::Vector{ b.Stage(ast::PipelineStage::kCompute), b.WorkgroupSize(1_i), }); @@ -612,9 +611,9 @@ struct S { var s : S; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn f() { - s.m = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + s.m = mat2x2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)); } )"; diff --git a/src/tint/transform/disable_uniformity_analysis.cc b/src/tint/transform/disable_uniformity_analysis.cc new file mode 100644 index 0000000000..918b1f163a --- /dev/null +++ b/src/tint/transform/disable_uniformity_analysis.cc @@ -0,0 +1,40 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/disable_uniformity_analysis.h" + +#include + +#include "src/tint/program_builder.h" +#include "src/tint/sem/module.h" + +TINT_INSTANTIATE_TYPEINFO(tint::transform::DisableUniformityAnalysis); + +namespace tint::transform { + +DisableUniformityAnalysis::DisableUniformityAnalysis() = default; + +DisableUniformityAnalysis::~DisableUniformityAnalysis() = default; + +bool DisableUniformityAnalysis::ShouldRun(const Program* program, const DataMap&) const { + return !program->Sem().Module()->Extensions().Contains( + ast::Extension::kChromiumDisableUniformityAnalysis); +} + +void DisableUniformityAnalysis::Run(CloneContext& ctx, const DataMap&, DataMap&) const { + ctx.dst->Enable(ast::Extension::kChromiumDisableUniformityAnalysis); + ctx.Clone(); +} + +} // namespace tint::transform diff --git a/src/tint/transform/disable_uniformity_analysis.h b/src/tint/transform/disable_uniformity_analysis.h new file mode 100644 index 0000000000..3c9fb53743 --- /dev/null +++ b/src/tint/transform/disable_uniformity_analysis.h @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_TRANSFORM_DISABLE_UNIFORMITY_ANALYSIS_H_ +#define SRC_TINT_TRANSFORM_DISABLE_UNIFORMITY_ANALYSIS_H_ + +#include "src/tint/transform/transform.h" + +namespace tint::transform { + +/// Disable uniformity analysis for the program. +class DisableUniformityAnalysis final : public Castable { + public: + /// Constructor + DisableUniformityAnalysis(); + /// Destructor + ~DisableUniformityAnalysis() override; + + /// @param program the program to inspect + /// @param data optional extra transform-specific input data + /// @returns true if this transform should be run for the given program + bool ShouldRun(const Program* program, const DataMap& data = {}) const override; + + protected: + /// Runs the transform using the CloneContext built for transforming a + /// program. Run() is responsible for calling Clone() on the CloneContext. + /// @param ctx the CloneContext primed with the input program and + /// ProgramBuilder + /// @param inputs optional extra transform-specific input data + /// @param outputs optional extra transform-specific output data + void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; +}; + +} // namespace tint::transform + +#endif // SRC_TINT_TRANSFORM_DISABLE_UNIFORMITY_ANALYSIS_H_ diff --git a/src/tint/transform/disable_uniformity_analysis_test.cc b/src/tint/transform/disable_uniformity_analysis_test.cc new file mode 100644 index 0000000000..3bcac0e58d --- /dev/null +++ b/src/tint/transform/disable_uniformity_analysis_test.cc @@ -0,0 +1,73 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/disable_uniformity_analysis.h" + +#include +#include + +#include "src/tint/transform/test_helper.h" + +namespace tint::transform { +namespace { + +using DisableUniformityAnalysisTest = TransformTest; + +TEST_F(DisableUniformityAnalysisTest, ShouldRunEmptyModule) { + auto* src = R"()"; + + EXPECT_TRUE(ShouldRun(src)); +} + +TEST_F(DisableUniformityAnalysisTest, ShouldRunExtensionAlreadyPresent) { + auto* src = R"( +enable chromium_disable_uniformity_analysis; +)"; + + EXPECT_FALSE(ShouldRun(src)); +} + +TEST_F(DisableUniformityAnalysisTest, EmptyModule) { + auto* src = R"()"; + + auto* expect = R"( +enable chromium_disable_uniformity_analysis; +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(DisableUniformityAnalysisTest, NonEmptyModule) { + auto* src = R"( +@group(0) @binding(0) var global : i32; + +@compute @workgroup_size(64) +fn main() { + if ((global == 42)) { + workgroupBarrier(); + } +} +)"; + + auto expect = "\nenable chromium_disable_uniformity_analysis;\n" + std::string(src); + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +} // namespace +} // namespace tint::transform diff --git a/src/tint/transform/expand_compound_assignment.cc b/src/tint/transform/expand_compound_assignment.cc index 2f775ca119..85b9bf69ed 100644 --- a/src/tint/transform/expand_compound_assignment.cc +++ b/src/tint/transform/expand_compound_assignment.cc @@ -44,6 +44,8 @@ bool ExpandCompoundAssignment::ShouldRun(const Program* program, const DataMap&) return false; } +namespace { + /// Internal class used to collect statement expansions during the transform. class State { private: @@ -82,7 +84,7 @@ class State { auto hoist_pointer_to = [&](const ast::Expression* expr) { auto name = b.Sym(); auto* ptr = b.AddressOf(ctx.Clone(expr)); - auto* decl = b.Decl(b.Let(name, nullptr, ptr)); + auto* decl = b.Decl(b.Let(name, ptr)); hoist_to_decl_before.InsertBefore(ctx.src->Sem().Get(stmt), decl); return name; }; @@ -90,7 +92,7 @@ class State { // Helper function to hoist `expr` to a let declaration. auto hoist_expr_to_let = [&](const ast::Expression* expr) { auto name = b.Sym(); - auto* decl = b.Decl(b.Let(name, nullptr, ctx.Clone(expr))); + auto* decl = b.Decl(b.Let(name, ctx.Clone(expr))); hoist_to_decl_before.InsertBefore(ctx.src->Sem().Get(stmt), decl); return name; }; @@ -163,6 +165,8 @@ class State { } }; +} // namespace + void ExpandCompoundAssignment::Run(CloneContext& ctx, const DataMap&, DataMap&) const { State state(ctx); for (auto* node : ctx.src->ASTNodes().Objects()) { @@ -170,14 +174,8 @@ void ExpandCompoundAssignment::Run(CloneContext& ctx, const DataMap&, DataMap&) state.Expand(assign, assign->lhs, ctx.Clone(assign->rhs), assign->op); } else if (auto* inc_dec = node->As()) { // For increment/decrement statements, `i++` becomes `i = i + 1`. - // TODO(jrprice): Simplify this when we have untyped literals. - auto* sem_lhs = ctx.src->Sem().Get(inc_dec->lhs); - const ast::IntLiteralExpression* one = - sem_lhs->Type()->UnwrapRef()->is_signed_integer_scalar() - ? ctx.dst->Expr(1_i)->As() - : ctx.dst->Expr(1_u)->As(); auto op = inc_dec->increment ? ast::BinaryOp::kAdd : ast::BinaryOp::kSubtract; - state.Expand(inc_dec, inc_dec->lhs, one, op); + state.Expand(inc_dec, inc_dec->lhs, ctx.dst->Expr(1_a), op); } } state.Finalize(); diff --git a/src/tint/transform/expand_compound_assignment.h b/src/tint/transform/expand_compound_assignment.h index d38d297d14..1081df7b32 100644 --- a/src/tint/transform/expand_compound_assignment.h +++ b/src/tint/transform/expand_compound_assignment.h @@ -38,7 +38,7 @@ namespace tint::transform { /// /// This transform also handles increment and decrement statements in the same /// manner, by replacing `i++` with `i = i + 1`. -class ExpandCompoundAssignment : public Castable { +class ExpandCompoundAssignment final : public Castable { public: /// Constructor ExpandCompoundAssignment(); diff --git a/src/tint/transform/expand_compound_assignment_test.cc b/src/tint/transform/expand_compound_assignment_test.cc index 613a13535a..6b18b40378 100644 --- a/src/tint/transform/expand_compound_assignment_test.cc +++ b/src/tint/transform/expand_compound_assignment_test.cc @@ -473,7 +473,7 @@ fn main() { auto* expect = R"( fn main() { var v : i32; - v = (v + 1i); + v = (v + 1); } )"; @@ -493,7 +493,7 @@ fn main() { auto* expect = R"( fn main() { var v : u32; - v = (v + 1u); + v = (v + 1); } )"; @@ -513,7 +513,7 @@ fn main() { auto* expect = R"( fn main() { var v : i32; - v = (v - 1i); + v = (v - 1); } )"; @@ -533,7 +533,7 @@ fn main() { auto* expect = R"( fn main() { var v : u32; - v = (v - 1u); + v = (v - 1); } )"; @@ -556,7 +556,7 @@ fn main() { var v : i32; let p = &(v); let tint_symbol = &(*(p)); - *(tint_symbol) = (*(tint_symbol) + 1i); + *(tint_symbol) = (*(tint_symbol) + 1); } )"; @@ -584,7 +584,7 @@ struct S { fn main() { var s : S; - s.m = (s.m + 1i); + s.m = (s.m + 1); } )"; @@ -617,7 +617,7 @@ fn idx() -> i32 { fn main() { let tint_symbol = &(a[idx()]); - *(tint_symbol) = (*(tint_symbol) + 1i); + *(tint_symbol) = (*(tint_symbol) + 1); } )"; @@ -651,7 +651,7 @@ fn idx() -> i32 { fn main() { let tint_symbol = &(v); let tint_symbol_1 = idx(); - (*(tint_symbol))[tint_symbol_1] = ((*(tint_symbol))[tint_symbol_1] + 1i); + (*(tint_symbol))[tint_symbol_1] = ((*(tint_symbol))[tint_symbol_1] + 1); } )"; @@ -671,7 +671,7 @@ fn main() { auto* expect = R"( fn main() { var v : vec4; - v.y = (v.y + 1i); + v.y = (v.y + 1); } )"; @@ -727,7 +727,7 @@ fn main() { continuing { let tint_symbol = &(a[idx1()]); let tint_symbol_1 = idx2(); - (*(tint_symbol))[tint_symbol_1] = ((*(tint_symbol))[tint_symbol_1] + 1i); + (*(tint_symbol))[tint_symbol_1] = ((*(tint_symbol))[tint_symbol_1] + 1); } } } diff --git a/src/tint/transform/first_index_offset.cc b/src/tint/transform/first_index_offset.cc index 9d89b83acd..34b481e3b9 100644 --- a/src/tint/transform/first_index_offset.cc +++ b/src/tint/transform/first_index_offset.cc @@ -79,13 +79,13 @@ void FirstIndexOffset::Run(CloneContext& ctx, const DataMap& inputs, DataMap& ou if (auto* var = node->As()) { for (auto* attr : var->attributes) { if (auto* builtin_attr = attr->As()) { - ast::Builtin builtin = builtin_attr->builtin; - if (builtin == ast::Builtin::kVertexIndex) { + ast::BuiltinValue builtin = builtin_attr->builtin; + if (builtin == ast::BuiltinValue::kVertexIndex) { auto* sem_var = ctx.src->Sem().Get(var); builtin_vars.emplace(sem_var, kFirstVertexName); has_vertex_or_instance_index = true; } - if (builtin == ast::Builtin::kInstanceIndex) { + if (builtin == ast::BuiltinValue::kInstanceIndex) { auto* sem_var = ctx.src->Sem().Get(var); builtin_vars.emplace(sem_var, kFirstInstanceName); has_vertex_or_instance_index = true; @@ -96,13 +96,13 @@ void FirstIndexOffset::Run(CloneContext& ctx, const DataMap& inputs, DataMap& ou if (auto* member = node->As()) { for (auto* attr : member->attributes) { if (auto* builtin_attr = attr->As()) { - ast::Builtin builtin = builtin_attr->builtin; - if (builtin == ast::Builtin::kVertexIndex) { + ast::BuiltinValue builtin = builtin_attr->builtin; + if (builtin == ast::BuiltinValue::kVertexIndex) { auto* sem_mem = ctx.src->Sem().Get(member); builtin_members.emplace(sem_mem, kFirstVertexName); has_vertex_or_instance_index = true; } - if (builtin == ast::Builtin::kInstanceIndex) { + if (builtin == ast::BuiltinValue::kInstanceIndex) { auto* sem_mem = ctx.src->Sem().Get(member); builtin_members.emplace(sem_mem, kFirstInstanceName); has_vertex_or_instance_index = true; @@ -114,18 +114,18 @@ void FirstIndexOffset::Run(CloneContext& ctx, const DataMap& inputs, DataMap& ou if (has_vertex_or_instance_index) { // Add uniform buffer members and calculate byte offsets - ast::StructMemberList members; - members.push_back(ctx.dst->Member(kFirstVertexName, ctx.dst->ty.u32())); - members.push_back(ctx.dst->Member(kFirstInstanceName, ctx.dst->ty.u32())); + utils::Vector members; + members.Push(ctx.dst->Member(kFirstVertexName, ctx.dst->ty.u32())); + members.Push(ctx.dst->Member(kFirstInstanceName, ctx.dst->ty.u32())); auto* struct_ = ctx.dst->Structure(ctx.dst->Sym(), std::move(members)); // Create a global to hold the uniform buffer Symbol buffer_name = ctx.dst->Sym(); - ctx.dst->Global(buffer_name, ctx.dst->ty.Of(struct_), ast::StorageClass::kUniform, nullptr, - ast::AttributeList{ - ctx.dst->create(ub_binding), - ctx.dst->create(ub_group), - }); + ctx.dst->GlobalVar(buffer_name, ctx.dst->ty.Of(struct_), ast::StorageClass::kUniform, + utils::Vector{ + ctx.dst->create(ub_binding), + ctx.dst->create(ub_group), + }); // Fix up all references to the builtins with the offsets ctx.ReplaceAll([=, &ctx](const ast::Expression* expr) -> const ast::Expression* { @@ -145,7 +145,7 @@ void FirstIndexOffset::Run(CloneContext& ctx, const DataMap& inputs, DataMap& ou } } } - // Not interested in this experssion. Just clone. + // Not interested in this expression. Just clone. return nullptr; }); } diff --git a/src/tint/transform/first_index_offset_test.cc b/src/tint/transform/first_index_offset_test.cc index a467c1784a..c159261aa8 100644 --- a/src/tint/transform/first_index_offset_test.cc +++ b/src/tint/transform/first_index_offset_test.cc @@ -33,7 +33,7 @@ TEST_F(FirstIndexOffsetTest, ShouldRunEmptyModule) { TEST_F(FirstIndexOffsetTest, ShouldRunFragmentStage) { auto* src = R"( -@stage(fragment) +@fragment fn entry() { return; } @@ -44,7 +44,7 @@ fn entry() { TEST_F(FirstIndexOffsetTest, ShouldRunVertexStage) { auto* src = R"( -@stage(vertex) +@vertex fn entry() -> @builtin(position) vec4 { return vec4(); } @@ -70,7 +70,7 @@ TEST_F(FirstIndexOffsetTest, EmptyModule) { TEST_F(FirstIndexOffsetTest, BasicVertexShader) { auto* src = R"( -@stage(vertex) +@vertex fn entry() -> @builtin(position) vec4 { return vec4(); } @@ -95,7 +95,7 @@ fn test(vert_idx : u32) -> u32 { return vert_idx; } -@stage(vertex) +@vertex fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { test(vert_idx); return vec4(); @@ -114,7 +114,7 @@ fn test(vert_idx : u32) -> u32 { return vert_idx; } -@stage(vertex) +@vertex fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { test((vert_idx + tint_symbol_1.first_vertex_index)); return vec4(); @@ -135,7 +135,7 @@ fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 TEST_F(FirstIndexOffsetTest, BasicModuleVertexIndex_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { test(vert_idx); return vec4(); @@ -154,7 +154,7 @@ struct tint_symbol { @binding(1) @group(2) var tint_symbol_1 : tint_symbol; -@stage(vertex) +@vertex fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { test((vert_idx + tint_symbol_1.first_vertex_index)); return vec4(); @@ -183,7 +183,7 @@ fn test(inst_idx : u32) -> u32 { return inst_idx; } -@stage(vertex) +@vertex fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { test(inst_idx); return vec4(); @@ -202,7 +202,7 @@ fn test(inst_idx : u32) -> u32 { return inst_idx; } -@stage(vertex) +@vertex fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { test((inst_idx + tint_symbol_1.first_instance_index)); return vec4(); @@ -223,7 +223,7 @@ fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 @builtin(position) vec4 { test(inst_idx); return vec4(); @@ -242,7 +242,7 @@ struct tint_symbol { @binding(1) @group(7) var tint_symbol_1 : tint_symbol; -@stage(vertex) +@vertex fn entry(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { test((inst_idx + tint_symbol_1.first_instance_index)); return vec4(); @@ -276,7 +276,7 @@ struct Inputs { @builtin(vertex_index) vert_idx : u32, }; -@stage(vertex) +@vertex fn entry(inputs : Inputs) -> @builtin(position) vec4 { test(inputs.instance_idx, inputs.vert_idx); return vec4(); @@ -302,7 +302,7 @@ struct Inputs { vert_idx : u32, } -@stage(vertex) +@vertex fn entry(inputs : Inputs) -> @builtin(position) vec4 { test((inputs.instance_idx + tint_symbol_1.first_instance_index), (inputs.vert_idx + tint_symbol_1.first_vertex_index)); return vec4(); @@ -323,7 +323,7 @@ fn entry(inputs : Inputs) -> @builtin(position) vec4 { TEST_F(FirstIndexOffsetTest, BasicModuleBothIndex_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn entry(inputs : Inputs) -> @builtin(position) vec4 { test(inputs.instance_idx, inputs.vert_idx); return vec4(); @@ -347,7 +347,7 @@ struct tint_symbol { @binding(1) @group(2) var tint_symbol_1 : tint_symbol; -@stage(vertex) +@vertex fn entry(inputs : Inputs) -> @builtin(position) vec4 { test((inputs.instance_idx + tint_symbol_1.first_instance_index), (inputs.vert_idx + tint_symbol_1.first_vertex_index)); return vec4(); @@ -387,7 +387,7 @@ fn func2(vert_idx : u32) -> u32 { return func1(vert_idx); } -@stage(vertex) +@vertex fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { func2(vert_idx); return vec4(); @@ -410,7 +410,7 @@ fn func2(vert_idx : u32) -> u32 { return func1(vert_idx); } -@stage(vertex) +@vertex fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { func2((vert_idx + tint_symbol_1.first_vertex_index)); return vec4(); @@ -431,7 +431,7 @@ fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 TEST_F(FirstIndexOffsetTest, NestedCalls_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { func2(vert_idx); return vec4(); @@ -454,7 +454,7 @@ struct tint_symbol { @binding(1) @group(2) var tint_symbol_1 : tint_symbol; -@stage(vertex) +@vertex fn entry(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { func2((vert_idx + tint_symbol_1.first_vertex_index)); return vec4(); @@ -487,19 +487,19 @@ fn func(i : u32) -> u32 { return i; } -@stage(vertex) +@vertex fn entry_a(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { func(vert_idx); return vec4(); } -@stage(vertex) +@vertex fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { func(vert_idx + inst_idx); return vec4(); } -@stage(vertex) +@vertex fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { func(inst_idx); return vec4(); @@ -518,19 +518,19 @@ fn func(i : u32) -> u32 { return i; } -@stage(vertex) +@vertex fn entry_a(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { func((vert_idx + tint_symbol_1.first_vertex_index)); return vec4(); } -@stage(vertex) +@vertex fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { func(((vert_idx + tint_symbol_1.first_vertex_index) + (inst_idx + tint_symbol_1.first_instance_index))); return vec4(); } -@stage(vertex) +@vertex fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { func((inst_idx + tint_symbol_1.first_instance_index)); return vec4(); @@ -551,19 +551,19 @@ fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 @builtin(position) vec4 { func(vert_idx); return vec4(); } -@stage(vertex) +@vertex fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { func(vert_idx + inst_idx); return vec4(); } -@stage(vertex) +@vertex fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { func(inst_idx); return vec4(); @@ -582,19 +582,19 @@ struct tint_symbol { @binding(1) @group(2) var tint_symbol_1 : tint_symbol; -@stage(vertex) +@vertex fn entry_a(@builtin(vertex_index) vert_idx : u32) -> @builtin(position) vec4 { func((vert_idx + tint_symbol_1.first_vertex_index)); return vec4(); } -@stage(vertex) +@vertex fn entry_b(@builtin(vertex_index) vert_idx : u32, @builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { func(((vert_idx + tint_symbol_1.first_vertex_index) + (inst_idx + tint_symbol_1.first_instance_index))); return vec4(); } -@stage(vertex) +@vertex fn entry_c(@builtin(instance_index) inst_idx : u32) -> @builtin(position) vec4 { func((inst_idx + tint_symbol_1.first_instance_index)); return vec4(); diff --git a/src/tint/transform/fold_constants.cc b/src/tint/transform/fold_constants.cc deleted file mode 100644 index be547b144c..0000000000 --- a/src/tint/transform/fold_constants.cc +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/transform/fold_constants.h" - -#include -#include -#include - -#include "src/tint/program_builder.h" -#include "src/tint/sem/call.h" -#include "src/tint/sem/expression.h" -#include "src/tint/sem/type_constructor.h" -#include "src/tint/sem/type_conversion.h" - -TINT_INSTANTIATE_TYPEINFO(tint::transform::FoldConstants); - -namespace tint::transform { - -FoldConstants::FoldConstants() = default; - -FoldConstants::~FoldConstants() = default; - -void FoldConstants::Run(CloneContext& ctx, const DataMap&, DataMap&) const { - ctx.ReplaceAll([&](const ast::Expression* expr) -> const ast::Expression* { - auto* call = ctx.src->Sem().Get(expr); - if (!call) { - return nullptr; - } - - auto value = call->ConstantValue(); - if (!value.IsValid()) { - return nullptr; - } - - auto* ty = call->Type(); - - if (!call->Target()->IsAnyOf()) { - return nullptr; - } - - // If original ctor expression had no init values, don't replace the - // expression - if (call->Arguments().empty()) { - return nullptr; - } - - if (auto* vec = ty->As()) { - uint32_t vec_size = static_cast(vec->Width()); - - // We'd like to construct the new vector with the same number of - // constructor args that the original node had, but after folding - // constants, cases like the following are problematic: - // - // vec3 = vec3(vec2, 1.0) // vec_size=3, ctor_size=2 - // - // In this case, creating a vec3 with 2 args is invalid, so we should - // create it with 3. So what we do is construct with vec_size args, - // except if the original vector was single-value initialized, in - // which case, we only construct with one arg again. - uint32_t ctor_size = (call->Arguments().size() == 1) ? 1 : vec_size; - - ast::ExpressionList ctors; - for (uint32_t i = 0; i < ctor_size; ++i) { - value.WithScalarAt(i, [&](auto&& s) { ctors.emplace_back(ctx.dst->Expr(s)); }); - } - - auto* el_ty = CreateASTTypeFor(ctx, vec->type()); - return ctx.dst->vec(el_ty, vec_size, ctors); - } - - if (ty->is_scalar()) { - return value.WithScalarAt( - 0, [&](auto&& s) -> const ast::LiteralExpression* { return ctx.dst->Expr(s); }); - } - - return nullptr; - }); - - ctx.Clone(); -} - -} // namespace tint::transform diff --git a/src/tint/transform/fold_constants.h b/src/tint/transform/fold_constants.h deleted file mode 100644 index ed3e205530..0000000000 --- a/src/tint/transform/fold_constants.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_TINT_TRANSFORM_FOLD_CONSTANTS_H_ -#define SRC_TINT_TRANSFORM_FOLD_CONSTANTS_H_ - -#include "src/tint/transform/transform.h" - -namespace tint::transform { - -/// FoldConstants transforms the AST by folding constant expressions -class FoldConstants final : public Castable { - public: - /// Constructor - FoldConstants(); - - /// Destructor - ~FoldConstants() override; - - protected: - /// Runs the transform using the CloneContext built for transforming a - /// program. Run() is responsible for calling Clone() on the CloneContext. - /// @param ctx the CloneContext primed with the input program and - /// ProgramBuilder - /// @param inputs optional extra transform-specific input data - /// @param outputs optional extra transform-specific output data - void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; -}; - -} // namespace tint::transform - -#endif // SRC_TINT_TRANSFORM_FOLD_CONSTANTS_H_ diff --git a/src/tint/transform/fold_constants_test.cc b/src/tint/transform/fold_constants_test.cc deleted file mode 100644 index f27ede61f8..0000000000 --- a/src/tint/transform/fold_constants_test.cc +++ /dev/null @@ -1,425 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/transform/fold_constants.h" - -#include -#include -#include - -#include "src/tint/transform/test_helper.h" - -namespace tint::transform { -namespace { - -using FoldConstantsTest = TransformTest; - -TEST_F(FoldConstantsTest, Module_Scalar_NoConversion) { - auto* src = R"( -var a : i32 = i32(123); -var b : u32 = u32(123u); -var c : f32 = f32(123.0); -var d : bool = bool(true); - -fn f() { -} -)"; - - auto* expect = R"( -var a : i32 = 123i; - -var b : u32 = 123u; - -var c : f32 = 123.0; - -var d : bool = true; - -fn f() { -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Module_Scalar_Conversion) { - auto* src = R"( -var a : i32 = i32(123.0); -var b : u32 = u32(123); -var c : f32 = f32(123u); -var d : bool = bool(123); - -fn f() { -} -)"; - - auto* expect = R"( -var a : i32 = 123i; - -var b : u32 = 123u; - -var c : f32 = 123.0; - -var d : bool = true; - -fn f() { -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Module_Scalar_MultipleConversions) { - auto* src = R"( -var a : i32 = i32(u32(f32(u32(i32(123.0))))); -var b : u32 = u32(i32(f32(i32(u32(123))))); -var c : f32 = f32(u32(i32(u32(f32(123u))))); -var d : bool = bool(i32(f32(i32(u32(123))))); - -fn f() { -} -)"; - - auto* expect = R"( -var a : i32 = 123i; - -var b : u32 = 123u; - -var c : f32 = 123.0; - -var d : bool = true; - -fn f() { -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Module_Vector_NoConversion) { - auto* src = R"( -var a : vec3 = vec3(123); -var b : vec3 = vec3(123u); -var c : vec3 = vec3(123.0); -var d : vec3 = vec3(true); - -fn f() { -} -)"; - - auto* expect = R"( -var a : vec3 = vec3(123i); - -var b : vec3 = vec3(123u); - -var c : vec3 = vec3(123.0); - -var d : vec3 = vec3(true); - -fn f() { -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Module_Vector_Conversion) { - auto* src = R"( -var a : vec3 = vec3(vec3(123.0)); -var b : vec3 = vec3(vec3(123)); -var c : vec3 = vec3(vec3(123u)); -var d : vec3 = vec3(vec3(123)); - -fn f() { -} -)"; - - auto* expect = R"( -var a : vec3 = vec3(123i); - -var b : vec3 = vec3(123u); - -var c : vec3 = vec3(123.0); - -var d : vec3 = vec3(true); - -fn f() { -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Module_Vector_MultipleConversions) { - auto* src = R"( -var a : vec3 = vec3(vec3(vec3(vec3(u32(123.0))))); -var b : vec3 = vec3(vec3(vec3(vec3(i32(123))))); -var c : vec3 = vec3(vec3(vec3(vec3(u32(123u))))); -var d : vec3 = vec3(vec3(vec3(vec3(i32(123))))); - -fn f() { -} -)"; - - auto* expect = R"( -var a : vec3 = vec3(123i); - -var b : vec3 = vec3(123u); - -var c : vec3 = vec3(123.0); - -var d : vec3 = vec3(true); - -fn f() { -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Module_Vector_MixedSizeConversions) { - auto* src = R"( -var a : vec4 = vec4(vec3(vec3(1u, 2u, 3u)), 4); -var b : vec4 = vec4(vec2(vec2(1u, 2u)), vec2(4, 5)); -var c : vec4 = vec4(1, vec2(vec2(2.0, 3.0)), 4); -var d : vec4 = vec4(1, 2, vec2(vec2(3.0, 4.0))); -var e : vec4 = vec4(false, bool(f32(1.0)), vec2(vec2(0, i32(4u)))); - -fn f() { -} -)"; - - auto* expect = R"( -var a : vec4 = vec4(1i, 2i, 3i, 4i); - -var b : vec4 = vec4(1i, 2i, 4i, 5i); - -var c : vec4 = vec4(1i, 2i, 3i, 4i); - -var d : vec4 = vec4(1i, 2i, 3i, 4i); - -var e : vec4 = vec4(false, true, false, true); - -fn f() { -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Function_Scalar_NoConversion) { - auto* src = R"( -fn f() { - var a : i32 = i32(123); - var b : u32 = u32(123u); - var c : f32 = f32(123.0); - var d : bool = bool(true); -} -)"; - - auto* expect = R"( -fn f() { - var a : i32 = 123i; - var b : u32 = 123u; - var c : f32 = 123.0; - var d : bool = true; -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Function_Scalar_Conversion) { - auto* src = R"( -fn f() { - var a : i32 = i32(123.0); - var b : u32 = u32(123); - var c : f32 = f32(123u); - var d : bool = bool(123); -} -)"; - - auto* expect = R"( -fn f() { - var a : i32 = 123i; - var b : u32 = 123u; - var c : f32 = 123.0; - var d : bool = true; -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Function_Scalar_MultipleConversions) { - auto* src = R"( -fn f() { - var a : i32 = i32(u32(f32(u32(i32(123.0))))); - var b : u32 = u32(i32(f32(i32(u32(123))))); - var c : f32 = f32(u32(i32(u32(f32(123u))))); - var d : bool = bool(i32(f32(i32(u32(123))))); -} -)"; - - auto* expect = R"( -fn f() { - var a : i32 = 123i; - var b : u32 = 123u; - var c : f32 = 123.0; - var d : bool = true; -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Function_Vector_NoConversion) { - auto* src = R"( -fn f() { - var a : vec3 = vec3(123i); - var b : vec3 = vec3(123u); - var c : vec3 = vec3(123.0); - var d : vec3 = vec3(true); -} -)"; - - auto* expect = R"( -fn f() { - var a : vec3 = vec3(123i); - var b : vec3 = vec3(123u); - var c : vec3 = vec3(123.0); - var d : vec3 = vec3(true); -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Function_Vector_Conversion) { - auto* src = R"( -fn f() { - var a : vec3 = vec3(vec3(123.0)); - var b : vec3 = vec3(vec3(123)); - var c : vec3 = vec3(vec3(123u)); - var d : vec3 = vec3(vec3(123)); -} -)"; - - auto* expect = R"( -fn f() { - var a : vec3 = vec3(123i); - var b : vec3 = vec3(123u); - var c : vec3 = vec3(123.0); - var d : vec3 = vec3(true); -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Function_Vector_MultipleConversions) { - auto* src = R"( -fn f() { - var a : vec3 = vec3(vec3(vec3(vec3(u32(123.0))))); - var b : vec3 = vec3(vec3(vec3(vec3(i32(123))))); - var c : vec3 = vec3(vec3(vec3(vec3(u32(123u))))); - var d : vec3 = vec3(vec3(vec3(vec3(i32(123))))); -} -)"; - - auto* expect = R"( -fn f() { - var a : vec3 = vec3(123i); - var b : vec3 = vec3(123u); - var c : vec3 = vec3(123.0); - var d : vec3 = vec3(true); -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Function_Vector_MixedSizeConversions) { - auto* src = R"( -fn f() { - var a : vec4 = vec4(vec3(vec3(1u, 2u, 3u)), 4); - var b : vec4 = vec4(vec2(vec2(1u, 2u)), vec2(4, 5)); - var c : vec4 = vec4(1, vec2(vec2(2.0, 3.0)), 4); - var d : vec4 = vec4(1, 2, vec2(vec2(3.0, 4.0))); - var e : vec4 = vec4(false, bool(f32(1.0)), vec2(vec2(0, i32(4u)))); -} -)"; - - auto* expect = R"( -fn f() { - var a : vec4 = vec4(1i, 2i, 3i, 4i); - var b : vec4 = vec4(1i, 2i, 4i, 5i); - var c : vec4 = vec4(1i, 2i, 3i, 4i); - var d : vec4 = vec4(1i, 2i, 3i, 4i); - var e : vec4 = vec4(false, true, false, true); -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(FoldConstantsTest, Function_Vector_ConstantWithNonConstant) { - auto* src = R"( -fn f() { - var a : f32 = f32(); - var b : vec2 = vec2(f32(i32(1)), a); -} -)"; - - auto* expect = R"( -fn f() { - var a : f32 = f32(); - var b : vec2 = vec2(1.0, a); -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -} // namespace -} // namespace tint::transform diff --git a/src/tint/transform/fold_trivial_single_use_lets.cc b/src/tint/transform/fold_trivial_single_use_lets.cc index 5bcdaa4900..8a949ecc6c 100644 --- a/src/tint/transform/fold_trivial_single_use_lets.cc +++ b/src/tint/transform/fold_trivial_single_use_lets.cc @@ -31,11 +31,11 @@ const ast::VariableDeclStatement* AsTrivialLetDecl(const ast::Statement* stmt) { if (!var_decl) { return nullptr; } - auto* var = var_decl->variable; - if (!var->is_const) { + auto* let = var_decl->variable->As(); + if (!let) { return nullptr; } - auto* ctor = var->constructor; + auto* ctor = let->constructor; if (!IsAnyOf(ctor)) { return nullptr; } @@ -52,7 +52,7 @@ void FoldTrivialSingleUseLets::Run(CloneContext& ctx, const DataMap&, DataMap&) for (auto* node : ctx.src->ASTNodes().Objects()) { if (auto* block = node->As()) { auto& stmts = block->statements; - for (size_t stmt_idx = 0; stmt_idx < stmts.size(); stmt_idx++) { + for (size_t stmt_idx = 0; stmt_idx < stmts.Length(); stmt_idx++) { auto* stmt = stmts[stmt_idx]; if (auto* let_decl = AsTrivialLetDecl(stmt)) { auto* let = let_decl->variable; @@ -65,7 +65,7 @@ void FoldTrivialSingleUseLets::Run(CloneContext& ctx, const DataMap&, DataMap&) auto* user = users[0]; auto* user_stmt = user->Stmt()->Declaration(); - for (size_t i = stmt_idx; i < stmts.size(); i++) { + for (size_t i = stmt_idx; i < stmts.Length(); i++) { if (user_stmt == stmts[i]) { auto* user_expr = user->Declaration(); ctx.Remove(stmts, let_decl); diff --git a/src/tint/transform/for_loop_to_loop.cc b/src/tint/transform/for_loop_to_loop.cc index 8fff0a8c1b..e585790e40 100644 --- a/src/tint/transform/for_loop_to_loop.cc +++ b/src/tint/transform/for_loop_to_loop.cc @@ -35,7 +35,7 @@ bool ForLoopToLoop::ShouldRun(const Program* program, const DataMap&) const { void ForLoopToLoop::Run(CloneContext& ctx, const DataMap&, DataMap&) const { ctx.ReplaceAll([&](const ast::ForLoopStatement* for_loop) -> const ast::Statement* { - ast::StatementList stmts; + utils::Vector stmts; if (auto* cond = for_loop->condition) { // !condition auto* not_cond = @@ -45,10 +45,10 @@ void ForLoopToLoop::Run(CloneContext& ctx, const DataMap&, DataMap&) const { auto* break_body = ctx.dst->Block(ctx.dst->create()); // if (!condition) { break; } - stmts.emplace_back(ctx.dst->If(not_cond, break_body)); + stmts.Push(ctx.dst->If(not_cond, break_body)); } for (auto* stmt : for_loop->body->statements) { - stmts.emplace_back(ctx.Clone(stmt)); + stmts.Push(ctx.Clone(stmt)); } const ast::BlockStatement* continuing = nullptr; diff --git a/src/tint/transform/localize_struct_array_assignment.cc b/src/tint/transform/localize_struct_array_assignment.cc index d6cdded9a0..82868450e5 100644 --- a/src/tint/transform/localize_struct_array_assignment.cc +++ b/src/tint/transform/localize_struct_array_assignment.cc @@ -46,7 +46,7 @@ class LocalizeStructArrayAssignment::State { expr, b.Diagnostics(), [&](const ast::IndexAccessorExpression* ia) { // Indexing using a runtime value? auto* idx_sem = ctx.src->Sem().Get(ia->index); - if (!idx_sem->ConstantValue().IsValid()) { + if (!idx_sem->ConstantValue()) { // Indexing a member access expr? if (auto* ma = ia->object->As()) { // That accesses an array? @@ -98,8 +98,8 @@ class LocalizeStructArrayAssignment::State { void Run() { struct Shared { bool process_nested_nodes = false; - ast::StatementList insert_before_stmts; - ast::StatementList insert_after_stmts; + utils::Vector insert_before_stmts; + utils::Vector insert_after_stmts; } s; ctx.ReplaceAll([&](const ast::AssignmentStatement* assign_stmt) -> const ast::Statement* { @@ -130,10 +130,12 @@ class LocalizeStructArrayAssignment::State { // Combine insert_before_stmts + new_assign_stmt + insert_after_stmts into // a block and return it - ast::StatementList stmts = std::move(s.insert_before_stmts); - stmts.reserve(1 + s.insert_after_stmts.size()); - stmts.emplace_back(new_assign_stmt); - stmts.insert(stmts.end(), s.insert_after_stmts.begin(), s.insert_after_stmts.end()); + auto stmts = std::move(s.insert_before_stmts); + stmts.Reserve(1 + s.insert_after_stmts.Length()); + stmts.Push(new_assign_stmt); + for (auto* stmt : s.insert_after_stmts) { + stmts.Push(stmt); + } return b.Block(std::move(stmts)); }); @@ -156,8 +158,7 @@ class LocalizeStructArrayAssignment::State { // Store the address of the member access into a let as we need to read // the value twice e.g. let tint_symbol = &(s.a1); auto mem_access_ptr = b.Sym(); - s.insert_before_stmts.push_back( - b.Decl(b.Let(mem_access_ptr, nullptr, b.AddressOf(mem_access)))); + s.insert_before_stmts.Push(b.Decl(b.Let(mem_access_ptr, b.AddressOf(mem_access)))); // Disable further transforms when cloning TINT_SCOPED_ASSIGNMENT(s.process_nested_nodes, false); @@ -165,8 +166,7 @@ class LocalizeStructArrayAssignment::State { // Copy entire array out of struct into local temp var // e.g. var tint_symbol_1 = *(tint_symbol); auto tmp_var = b.Sym(); - s.insert_before_stmts.push_back( - b.Decl(b.Var(tmp_var, nullptr, b.Deref(mem_access_ptr)))); + s.insert_before_stmts.Push(b.Decl(b.Var(tmp_var, b.Deref(mem_access_ptr)))); // Replace input index_access with a clone of itself, but with its // .object replaced by the new temp var. This is returned from this @@ -177,8 +177,13 @@ class LocalizeStructArrayAssignment::State { // Assign temp var back to array // e.g. *(tint_symbol) = tint_symbol_1; auto* assign_rhs_to_temp = b.Assign(b.Deref(mem_access_ptr), tmp_var); - s.insert_after_stmts.insert(s.insert_after_stmts.begin(), - assign_rhs_to_temp); // push_front + { + utils::Vector stmts{assign_rhs_to_temp}; + for (auto* stmt : s.insert_after_stmts) { + stmts.Push(stmt); + } + s.insert_after_stmts = std::move(stmts); + } return new_index_access; }); diff --git a/src/tint/transform/localize_struct_array_assignment.h b/src/tint/transform/localize_struct_array_assignment.h index 129c8491bb..130f8cc107 100644 --- a/src/tint/transform/localize_struct_array_assignment.h +++ b/src/tint/transform/localize_struct_array_assignment.h @@ -27,7 +27,8 @@ namespace tint::transform { /// /// @note Depends on the following transforms to have been run first: /// * SimplifyPointers -class LocalizeStructArrayAssignment : public Castable { +class LocalizeStructArrayAssignment final + : public Castable { public: /// Constructor LocalizeStructArrayAssignment(); diff --git a/src/tint/transform/localize_struct_array_assignment_test.cc b/src/tint/transform/localize_struct_array_assignment_test.cc index ee6df9f0d5..e85a600029 100644 --- a/src/tint/transform/localize_struct_array_assignment_test.cc +++ b/src/tint/transform/localize_struct_array_assignment_test.cc @@ -46,7 +46,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -69,7 +69,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -88,7 +88,7 @@ fn main() { TEST_F(LocalizeStructArrayAssignmentTest, StructArray_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -111,7 +111,7 @@ struct Uniforms { )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -162,7 +162,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -189,7 +189,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -208,7 +208,7 @@ fn main() { TEST_F(LocalizeStructArrayAssignmentTest, StructStructArray_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -235,7 +235,7 @@ struct Uniforms { )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -287,7 +287,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -311,7 +311,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -348,7 +348,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -375,7 +375,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -413,7 +413,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; @@ -441,7 +441,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; @@ -488,7 +488,7 @@ fn getNextIndex() -> u32 { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; @@ -523,7 +523,7 @@ fn getNextIndex() -> u32 { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; @@ -545,7 +545,7 @@ fn main() { TEST_F(LocalizeStructArrayAssignmentTest, IndexingWithSideEffectFunc_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; @@ -579,7 +579,7 @@ struct InnerS { )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; @@ -643,7 +643,7 @@ fn f(p : ptr) { (*p).a1[uniforms.i] = v; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; f(&s1); @@ -675,7 +675,7 @@ fn f(p : ptr) { } } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; f(&(s1)); @@ -688,7 +688,7 @@ fn main() { TEST_F(LocalizeStructArrayAssignmentTest, ViaPointerArg_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; f(&s1); @@ -714,7 +714,7 @@ struct Uniforms { )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; f(&(s1)); @@ -769,7 +769,7 @@ fn f(p : ptr, v : InnerS) { *(p) = v; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -797,7 +797,7 @@ fn f(p : ptr, v : InnerS) { *(p) = v; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; @@ -831,7 +831,7 @@ fn f(i : u32) -> u32 { return (i + 1u); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; var v : vec3; diff --git a/src/tint/transform/loop_to_for_loop.cc b/src/tint/transform/loop_to_for_loop.cc index 3e0a4b5412..00bf5ec559 100644 --- a/src/tint/transform/loop_to_for_loop.cc +++ b/src/tint/transform/loop_to_for_loop.cc @@ -29,7 +29,7 @@ namespace tint::transform { namespace { bool IsBlockWithSingleBreak(const ast::BlockStatement* block) { - if (block->statements.size() != 1) { + if (block->statements.Length() != 1) { return false; } return block->statements[0]->Is(); @@ -74,7 +74,7 @@ void LoopToForLoop::Run(CloneContext& ctx, const DataMap&, DataMap&) const { // loop { if (condition) { break; } ... } // loop { if (condition) {} else { break; } ... } auto& stmts = loop->body->statements; - if (stmts.empty()) { + if (stmts.IsEmpty()) { return nullptr; } auto* if_stmt = stmts[0]->As(); @@ -96,7 +96,7 @@ void LoopToForLoop::Run(CloneContext& ctx, const DataMap&, DataMap&) const { // function call statement. const ast::Statement* continuing = nullptr; if (auto* loop_cont = loop->continuing) { - if (loop_cont->statements.size() != 1) { + if (loop_cont->statements.Length() != 1) { return nullptr; } diff --git a/src/tint/transform/loop_to_for_loop.h b/src/tint/transform/loop_to_for_loop.h index 0623d79b85..0e948c80c1 100644 --- a/src/tint/transform/loop_to_for_loop.h +++ b/src/tint/transform/loop_to_for_loop.h @@ -21,7 +21,7 @@ namespace tint::transform { /// LoopToForLoop is a Transform that attempts to convert WGSL `loop {}` /// statements into a for-loop statement. -class LoopToForLoop : public Castable { +class LoopToForLoop final : public Castable { public: /// Constructor LoopToForLoop(); diff --git a/src/tint/transform/loop_to_for_loop_test.cc b/src/tint/transform/loop_to_for_loop_test.cc index e3d7eccbef..24e0e15e0a 100644 --- a/src/tint/transform/loop_to_for_loop_test.cc +++ b/src/tint/transform/loop_to_for_loop_test.cc @@ -151,7 +151,7 @@ fn f() { )"; auto* expect = R"( -let N = 16u; +const N = 16u; fn f() { var i : u32 = 0u; diff --git a/src/tint/transform/manager.cc b/src/tint/transform/manager.cc index 823474c63b..4e83320b41 100644 --- a/src/tint/transform/manager.cc +++ b/src/tint/transform/manager.cc @@ -49,7 +49,8 @@ Output Manager::Run(const Program* program, const DataMap& data) const { Output out; for (const auto& transform : transforms_) { if (!transform->ShouldRun(in, data)) { - TINT_IF_PRINT_PROGRAM(std::cout << "Skipping " << transform->TypeInfo().name); + TINT_IF_PRINT_PROGRAM(std::cout << "Skipping " << transform->TypeInfo().name + << std::endl); continue; } TINT_IF_PRINT_PROGRAM(print_program("Input to", transform.get())); diff --git a/src/tint/transform/manager.h b/src/tint/transform/manager.h index 9f5c6bcf21..04bf9fe895 100644 --- a/src/tint/transform/manager.h +++ b/src/tint/transform/manager.h @@ -27,7 +27,7 @@ namespace tint::transform { /// The inner transforms will execute in the appended order. /// If any inner transform fails the manager will return immediately and /// the error can be retrieved with the Output's diagnostics. -class Manager : public Castable { +class Manager final : public Castable { public: /// Constructor Manager(); diff --git a/src/tint/transform/module_scope_var_to_entry_point_param.cc b/src/tint/transform/module_scope_var_to_entry_point_param.cc index 22bcd5c1bc..122fb3ce98 100644 --- a/src/tint/transform/module_scope_var_to_entry_point_param.cc +++ b/src/tint/transform/module_scope_var_to_entry_point_param.cc @@ -23,13 +23,21 @@ #include "src/tint/program_builder.h" #include "src/tint/sem/call.h" #include "src/tint/sem/function.h" +#include "src/tint/sem/module.h" #include "src/tint/sem/statement.h" #include "src/tint/sem/variable.h" +#include "src/tint/utils/string.h" TINT_INSTANTIATE_TYPEINFO(tint::transform::ModuleScopeVarToEntryPointParam); namespace tint::transform { namespace { + +using WorkgroupParameterMemberList = utils::Vector; + +// The name of the struct member for arrays that are wrapped in structures. +const char* kWrappedArrayMemberName = "arr"; + // Returns `true` if `type` is or contains a matrix type. bool ContainsMatrix(const sem::Type* type) { type = type->UnwrapRef(); @@ -83,17 +91,222 @@ struct ModuleScopeVarToEntryPointParam::State { } } + /// Process a variable `var` that is referenced in the entry point function `func`. + /// This will redeclare the variable as a function parameter, possibly as a pointer. + /// Some workgroup variables will be redeclared as a member inside a workgroup structure. + /// @param func the entry point function + /// @param var the variable + /// @param new_var_symbol the symbol to use for the replacement + /// @param workgroup_param helper function to get a symbol to a workgroup struct parameter + /// @param workgroup_parameter_members reference to a list of a workgroup struct members + /// @param is_pointer output signalling whether the replacement is a pointer + /// @param is_wrapped output signalling whether the replacement is wrapped in a struct + void ProcessVariableInEntryPoint(const ast::Function* func, + const sem::Variable* var, + Symbol new_var_symbol, + std::function workgroup_param, + WorkgroupParameterMemberList& workgroup_parameter_members, + bool& is_pointer, + bool& is_wrapped) { + auto* var_ast = var->Declaration()->As(); + auto* ty = var->Type()->UnwrapRef(); + + // Helper to create an AST node for the store type of the variable. + auto store_type = [&]() { return CreateASTTypeFor(ctx, ty); }; + + ast::StorageClass sc = var->StorageClass(); + switch (sc) { + case ast::StorageClass::kHandle: { + // For a texture or sampler variable, redeclare it as an entry point parameter. + // Disable entry point parameter validation. + auto* disable_validation = + ctx.dst->Disable(ast::DisabledValidation::kEntryPointParameter); + auto attrs = ctx.Clone(var->Declaration()->attributes); + attrs.Push(disable_validation); + auto* param = ctx.dst->Param(new_var_symbol, store_type(), attrs); + ctx.InsertFront(func->params, param); + + break; + } + case ast::StorageClass::kStorage: + case ast::StorageClass::kUniform: { + // Variables into the Storage and Uniform storage classes are redeclared as entry + // point parameters with a pointer type. + auto attributes = ctx.Clone(var->Declaration()->attributes); + attributes.Push(ctx.dst->Disable(ast::DisabledValidation::kEntryPointParameter)); + attributes.Push(ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass)); + + auto* param_type = store_type(); + if (auto* arr = ty->As(); arr && arr->IsRuntimeSized()) { + // Wrap runtime-sized arrays in structures, so that we can declare pointers to + // them. Ideally we'd just emit the array itself as a pointer, but this is not + // representable in Tint's AST. + CloneStructTypes(ty); + auto* wrapper = ctx.dst->Structure( + ctx.dst->Sym(), utils::Vector{ + ctx.dst->Member(kWrappedArrayMemberName, param_type), + }); + param_type = ctx.dst->ty.Of(wrapper); + is_wrapped = true; + } + + param_type = ctx.dst->ty.pointer(param_type, sc, var_ast->declared_access); + auto* param = ctx.dst->Param(new_var_symbol, param_type, attributes); + ctx.InsertFront(func->params, param); + is_pointer = true; + + break; + } + case ast::StorageClass::kWorkgroup: { + if (ContainsMatrix(var->Type())) { + // Due to a bug in the MSL compiler, we use a threadgroup memory argument for + // any workgroup allocation that contains a matrix. See crbug.com/tint/938. + // TODO(jrprice): Do this for all other workgroup variables too. + + // Create a member in the workgroup parameter struct. + auto member = ctx.Clone(var->Declaration()->symbol); + workgroup_parameter_members.Push(ctx.dst->Member(member, store_type())); + CloneStructTypes(var->Type()->UnwrapRef()); + + // Create a function-scope variable that is a pointer to the member. + auto* member_ptr = ctx.dst->AddressOf( + ctx.dst->MemberAccessor(ctx.dst->Deref(workgroup_param()), member)); + auto* local_var = ctx.dst->Let( + new_var_symbol, + ctx.dst->ty.pointer(store_type(), ast::StorageClass::kWorkgroup), + member_ptr); + ctx.InsertFront(func->body->statements, ctx.dst->Decl(local_var)); + is_pointer = true; + + break; + } + [[fallthrough]]; + } + case ast::StorageClass::kPrivate: { + // Variables in the Private and Workgroup storage classes are redeclared at function + // scope. Disable storage class validation on this variable. + auto* disable_validation = + ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass); + auto* constructor = ctx.Clone(var->Declaration()->constructor); + auto* local_var = ctx.dst->Var(new_var_symbol, store_type(), sc, constructor, + utils::Vector{disable_validation}); + ctx.InsertFront(func->body->statements, ctx.dst->Decl(local_var)); + + break; + } + case ast::StorageClass::kPushConstant: { + ctx.dst->Diagnostics().add_error( + diag::System::Transform, + "unhandled module-scope storage class (" + utils::ToString(sc) + ")"); + break; + } + default: { + TINT_ICE(Transform, ctx.dst->Diagnostics()) + << "unhandled module-scope storage class (" << sc << ")"; + break; + } + } + } + + /// Process a variable `var` that is referenced in the user-defined function `func`. + /// This will redeclare the variable as a function parameter, possibly as a pointer. + /// @param func the user-defined function + /// @param var the variable + /// @param new_var_symbol the symbol to use for the replacement + /// @param is_pointer output signalling whether the replacement is a pointer or not + void ProcessVariableInUserFunction(const ast::Function* func, + const sem::Variable* var, + Symbol new_var_symbol, + bool& is_pointer) { + auto* var_ast = var->Declaration()->As(); + auto* ty = var->Type()->UnwrapRef(); + auto* param_type = CreateASTTypeFor(ctx, ty); + auto sc = var->StorageClass(); + switch (sc) { + case ast::StorageClass::kPrivate: + case ast::StorageClass::kStorage: + case ast::StorageClass::kUniform: + case ast::StorageClass::kHandle: + case ast::StorageClass::kWorkgroup: + break; + case ast::StorageClass::kPushConstant: { + ctx.dst->Diagnostics().add_error( + diag::System::Transform, + "unhandled module-scope storage class (" + utils::ToString(sc) + ")"); + break; + } + default: { + TINT_ICE(Transform, ctx.dst->Diagnostics()) + << "unhandled module-scope storage class (" << sc << ")"; + } + } + + // Use a pointer for non-handle types. + utils::Vector attributes; + if (!ty->is_handle()) { + param_type = ctx.dst->ty.pointer(param_type, sc, var_ast->declared_access); + is_pointer = true; + + // Disable validation of the parameter's storage class and of arguments passed to it. + attributes.Push(ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass)); + attributes.Push( + ctx.dst->Disable(ast::DisabledValidation::kIgnoreInvalidPointerArgument)); + } + + // Redeclare the variable as a parameter. + ctx.InsertBack(func->params, + ctx.dst->Param(new_var_symbol, param_type, std::move(attributes))); + } + + /// Replace all uses of `var` in `func` with references to `new_var`. + /// @param func the function + /// @param var the variable to replace + /// @param new_var the symbol to use for replacement + /// @param is_pointer true if `new_var` is a pointer to the new variable + /// @param is_wrapped true if `new_var` is an array wrapped in a structure + void ReplaceUsesInFunction(const ast::Function* func, + const sem::Variable* var, + Symbol new_var, + bool is_pointer, + bool is_wrapped) { + for (auto* user : var->Users()) { + if (user->Stmt()->Function()->Declaration() == func) { + const ast::Expression* expr = ctx.dst->Expr(new_var); + if (is_pointer) { + // If this identifier is used by an address-of operator, just remove the + // address-of instead of adding a deref, since we already have a pointer. + auto* ident = user->Declaration()->As(); + if (ident_to_address_of_.count(ident)) { + ctx.Replace(ident_to_address_of_[ident], expr); + continue; + } + + expr = ctx.dst->Deref(expr); + } + if (is_wrapped) { + // Get the member from the wrapper structure. + expr = ctx.dst->MemberAccessor(expr, kWrappedArrayMemberName); + } + ctx.Replace(user->Declaration(), expr); + } + } + } + /// Process the module. void Process() { // Predetermine the list of function calls that need to be replaced. - using CallList = std::vector; + using CallList = utils::Vector; std::unordered_map calls_to_replace; - std::vector functions_to_process; + utils::Vector functions_to_process; + + // Build a list of functions that transitively reference any module-scope variables. + for (auto* decl : ctx.src->Sem().Module()->DependencyOrderedDeclarations()) { + auto* func_ast = decl->As(); + if (!func_ast) { + continue; + } - // Build a list of functions that transitively reference any module-scope - // variables. - for (auto* func_ast : ctx.src->AST().Functions()) { auto* func_sem = ctx.src->Sem().Get(func_ast); bool needs_processing = false; @@ -104,30 +317,28 @@ struct ModuleScopeVarToEntryPointParam::State { } } if (needs_processing) { - functions_to_process.push_back(func_ast); + functions_to_process.Push(func_ast); // Find all of the calls to this function that will need to be replaced. for (auto* call : func_sem->CallSites()) { - calls_to_replace[call->Stmt()->Function()->Declaration()].push_back( + calls_to_replace[call->Stmt()->Function()->Declaration()].Push( call->Declaration()); } } } - // Build a list of `&ident` expressions. We'll use this later to avoid - // generating expressions of the form `&*ident`, which break WGSL validation - // rules when this expression is passed to a function. - // TODO(jrprice): We should add support for bidirectional SEM tree traversal - // so that we can do this on the fly instead. - std::unordered_map - ident_to_address_of; + // Build a list of `&ident` expressions. We'll use this later to avoid generating + // expressions of the form `&*ident`, which break WGSL validation rules when this expression + // is passed to a function. + // TODO(jrprice): We should add support for bidirectional SEM tree traversal so that we can + // do this on the fly instead. for (auto* node : ctx.src->ASTNodes().Objects()) { auto* address_of = node->As(); if (!address_of || address_of->op != ast::UnaryOp::kAddressOf) { continue; } if (auto* ident = address_of->expr->As()) { - ident_to_address_of[ident] = address_of; + ident_to_address_of_[ident] = address_of; } } @@ -141,13 +352,12 @@ struct ModuleScopeVarToEntryPointParam::State { bool is_pointer; bool is_wrapped; }; - const char* kWrappedArrayMemberName = "arr"; std::unordered_map var_to_newvar; - // We aggregate all workgroup variables into a struct to avoid hitting - // MSL's limit for threadgroup memory arguments. + // We aggregate all workgroup variables into a struct to avoid hitting MSL's limit for + // threadgroup memory arguments. Symbol workgroup_parameter_symbol; - ast::StructMemberList workgroup_parameter_members; + WorkgroupParameterMemberList workgroup_parameter_members; auto workgroup_param = [&]() { if (!workgroup_parameter_symbol.IsValid()) { workgroup_parameter_symbol = ctx.dst->Sym(); @@ -155,163 +365,77 @@ struct ModuleScopeVarToEntryPointParam::State { return workgroup_parameter_symbol; }; + // Process and redeclare all variables referenced by the function. for (auto* var : func_sem->TransitivelyReferencedGlobals()) { - auto sc = var->StorageClass(); - auto* ty = var->Type()->UnwrapRef(); - if (sc == ast::StorageClass::kNone) { + if (var->StorageClass() == ast::StorageClass::kNone) { continue; } - if (sc != ast::StorageClass::kPrivate && sc != ast::StorageClass::kStorage && - sc != ast::StorageClass::kUniform && sc != ast::StorageClass::kHandle && - sc != ast::StorageClass::kWorkgroup) { - TINT_ICE(Transform, ctx.dst->Diagnostics()) - << "unhandled module-scope storage class (" << sc << ")"; + if (local_private_vars_.count(var)) { + continue; } - // This is the symbol for the variable that replaces the module-scope - // var. + // This is the symbol for the variable that replaces the module-scope var. auto new_var_symbol = ctx.dst->Sym(); - // Helper to create an AST node for the store type of the variable. - auto store_type = [&]() { return CreateASTTypeFor(ctx, ty); }; - // Track whether the new variable is a pointer or not. bool is_pointer = false; // Track whether the new variable was wrapped in a struct or not. bool is_wrapped = false; - if (is_entry_point) { - if (var->Type()->UnwrapRef()->is_handle()) { - // For a texture or sampler variable, redeclare it as an entry point - // parameter. Disable entry point parameter validation. - auto* disable_validation = - ctx.dst->Disable(ast::DisabledValidation::kEntryPointParameter); - auto attrs = ctx.Clone(var->Declaration()->attributes); - attrs.push_back(disable_validation); - auto* param = ctx.dst->Param(new_var_symbol, store_type(), attrs); - ctx.InsertFront(func_ast->params, param); - } else if (sc == ast::StorageClass::kStorage || - sc == ast::StorageClass::kUniform) { - // Variables into the Storage and Uniform storage classes are - // redeclared as entry point parameters with a pointer type. - auto attributes = ctx.Clone(var->Declaration()->attributes); - attributes.push_back( - ctx.dst->Disable(ast::DisabledValidation::kEntryPointParameter)); - attributes.push_back( - ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass)); - - auto* param_type = store_type(); - if (auto* arr = ty->As(); arr && arr->IsRuntimeSized()) { - // Wrap runtime-sized arrays in structures, so that we can declare - // pointers to them. Ideally we'd just emit the array itself as a - // pointer, but this is not representable in Tint's AST. - CloneStructTypes(ty); - auto* wrapper = ctx.dst->Structure( - ctx.dst->Sym(), - {ctx.dst->Member(kWrappedArrayMemberName, param_type)}); - param_type = ctx.dst->ty.Of(wrapper); - is_wrapped = true; + // Check if this is a private variable that is only referenced by this function. + bool local_private = false; + if (var->StorageClass() == ast::StorageClass::kPrivate) { + local_private = true; + for (auto* user : var->Users()) { + auto* stmt = user->Stmt(); + if (!stmt || stmt->Function() != func_sem) { + local_private = false; + break; } - - param_type = ctx.dst->ty.pointer(param_type, sc, - var->Declaration()->declared_access); - auto* param = ctx.dst->Param(new_var_symbol, param_type, attributes); - ctx.InsertFront(func_ast->params, param); - is_pointer = true; - } else if (sc == ast::StorageClass::kWorkgroup && ContainsMatrix(var->Type())) { - // Due to a bug in the MSL compiler, we use a threadgroup memory - // argument for any workgroup allocation that contains a matrix. - // See crbug.com/tint/938. - // TODO(jrprice): Do this for all other workgroup variables too. - - // Create a member in the workgroup parameter struct. - auto member = ctx.Clone(var->Declaration()->symbol); - workgroup_parameter_members.push_back( - ctx.dst->Member(member, store_type())); - CloneStructTypes(var->Type()->UnwrapRef()); - - // Create a function-scope variable that is a pointer to the member. - auto* member_ptr = ctx.dst->AddressOf( - ctx.dst->MemberAccessor(ctx.dst->Deref(workgroup_param()), member)); - auto* local_var = ctx.dst->Let( - new_var_symbol, - ctx.dst->ty.pointer(store_type(), ast::StorageClass::kWorkgroup), - member_ptr); - ctx.InsertFront(func_ast->body->statements, ctx.dst->Decl(local_var)); - is_pointer = true; - } else { - // Variables in the Private and Workgroup storage classes are - // redeclared at function scope. Disable storage class validation on - // this variable. - auto* disable_validation = - ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass); - auto* constructor = ctx.Clone(var->Declaration()->constructor); - auto* local_var = - ctx.dst->Var(new_var_symbol, store_type(), sc, constructor, - ast::AttributeList{disable_validation}); - ctx.InsertFront(func_ast->body->statements, ctx.dst->Decl(local_var)); } + } + + if (local_private) { + // Redeclare the variable at function scope. + auto* disable_validation = + ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass); + auto* constructor = ctx.Clone(var->Declaration()->constructor); + auto* local_var = ctx.dst->Var(new_var_symbol, + CreateASTTypeFor(ctx, var->Type()->UnwrapRef()), + ast::StorageClass::kPrivate, constructor, + utils::Vector{disable_validation}); + ctx.InsertFront(func_ast->body->statements, ctx.dst->Decl(local_var)); + local_private_vars_.insert(var); } else { - // For a regular function, redeclare the variable as a parameter. - // Use a pointer for non-handle types. - auto* param_type = store_type(); - ast::AttributeList attributes; - if (!var->Type()->UnwrapRef()->is_handle()) { - param_type = ctx.dst->ty.pointer(param_type, sc, - var->Declaration()->declared_access); - is_pointer = true; - - // Disable validation of the parameter's storage class and of - // arguments passed it. - attributes.push_back( - ctx.dst->Disable(ast::DisabledValidation::kIgnoreStorageClass)); - attributes.push_back(ctx.dst->Disable( - ast::DisabledValidation::kIgnoreInvalidPointerArgument)); + // Process the variable to redeclare it as a parameter or local variable. + if (is_entry_point) { + ProcessVariableInEntryPoint(func_ast, var, new_var_symbol, workgroup_param, + workgroup_parameter_members, is_pointer, + is_wrapped); + } else { + ProcessVariableInUserFunction(func_ast, var, new_var_symbol, is_pointer); } - ctx.InsertBack(func_ast->params, - ctx.dst->Param(new_var_symbol, param_type, attributes)); + + // Record the replacement symbol. + var_to_newvar[var] = {new_var_symbol, is_pointer, is_wrapped}; } // Replace all uses of the module-scope variable. - // For non-entry points, dereference non-handle pointer parameters. - for (auto* user : var->Users()) { - if (user->Stmt()->Function()->Declaration() == func_ast) { - const ast::Expression* expr = ctx.dst->Expr(new_var_symbol); - if (is_pointer) { - // If this identifier is used by an address-of operator, just - // remove the address-of instead of adding a deref, since we - // already have a pointer. - auto* ident = user->Declaration()->As(); - if (ident_to_address_of.count(ident)) { - ctx.Replace(ident_to_address_of[ident], expr); - continue; - } - - expr = ctx.dst->Deref(expr); - } - if (is_wrapped) { - // Get the member from the wrapper structure. - expr = ctx.dst->MemberAccessor(expr, kWrappedArrayMemberName); - } - ctx.Replace(user->Declaration(), expr); - } - } - - var_to_newvar[var] = {new_var_symbol, is_pointer, is_wrapped}; + ReplaceUsesInFunction(func_ast, var, new_var_symbol, is_pointer, is_wrapped); } - if (!workgroup_parameter_members.empty()) { + if (!workgroup_parameter_members.IsEmpty()) { // Create the workgroup memory parameter. - // The parameter is a struct that contains members for each workgroup - // variable. + // The parameter is a struct that contains members for each workgroup variable. auto* str = ctx.dst->Structure(ctx.dst->Sym(), std::move(workgroup_parameter_members)); auto* param_type = ctx.dst->ty.pointer(ctx.dst->ty.Of(str), ast::StorageClass::kWorkgroup); auto* disable_validation = ctx.dst->Disable(ast::DisabledValidation::kEntryPointParameter); - auto* param = ctx.dst->Param(workgroup_param(), param_type, {disable_validation}); + auto* param = ctx.dst->Param(workgroup_param(), param_type, + utils::Vector{disable_validation}); ctx.InsertFront(func_ast->params, param); } @@ -328,12 +452,18 @@ struct ModuleScopeVarToEntryPointParam::State { continue; } - auto new_var = var_to_newvar[target_var]; + auto it = var_to_newvar.find(target_var); + if (it == var_to_newvar.end()) { + // No replacement was created for this function. + continue; + } + + auto new_var = it->second; bool is_handle = target_var->Type()->UnwrapRef()->is_handle(); const ast::Expression* arg = ctx.dst->Expr(new_var.symbol); if (new_var.is_wrapped) { - // The variable is wrapped in a struct, so we need to pass a pointer - // to the struct member instead. + // The variable is wrapped in a struct, so we need to pass a pointer to the + // struct member instead. arg = ctx.dst->AddressOf( ctx.dst->MemberAccessor(ctx.dst->Deref(arg), kWrappedArrayMemberName)); } else if (is_entry_point && !is_handle && !new_var.is_pointer) { @@ -356,7 +486,15 @@ struct ModuleScopeVarToEntryPointParam::State { } private: + // The structures that have already been cloned by this transform. std::unordered_set cloned_structs_; + + // Set of a private variables that are local to a single function. + std::unordered_set local_private_vars_; + + // Map from identifier expression to the address-of expression that uses it. + std::unordered_map + ident_to_address_of_; }; ModuleScopeVarToEntryPointParam::ModuleScopeVarToEntryPointParam() = default; diff --git a/src/tint/transform/module_scope_var_to_entry_point_param.h b/src/tint/transform/module_scope_var_to_entry_point_param.h index f268197431..40e6b7da6e 100644 --- a/src/tint/transform/module_scope_var_to_entry_point_param.h +++ b/src/tint/transform/module_scope_var_to_entry_point_param.h @@ -43,7 +43,7 @@ namespace tint::transform { /// p = p + f; /// } /// -/// @stage(compute) @workgroup_size(1) +/// @compute @workgroup_size(1) /// fn main() { /// foo(); /// } @@ -55,13 +55,13 @@ namespace tint::transform { /// *p = *p + (*sptr).f; /// } /// -/// @stage(compute) @workgroup_size(1) +/// @compute @workgroup_size(1) /// fn main(sptr : ptr) { /// var p : f32 = 2.0; /// foo(&p, sptr); /// } /// ``` -class ModuleScopeVarToEntryPointParam +class ModuleScopeVarToEntryPointParam final : public Castable { public: /// Constructor diff --git a/src/tint/transform/module_scope_var_to_entry_point_param_test.cc b/src/tint/transform/module_scope_var_to_entry_point_param_test.cc index 580e6950d7..dcf89126e5 100644 --- a/src/tint/transform/module_scope_var_to_entry_point_param_test.cc +++ b/src/tint/transform/module_scope_var_to_entry_point_param_test.cc @@ -42,14 +42,14 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Basic) { var p : f32; var w : f32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { w = p; } )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { @internal(disable_validation__ignore_storage_class) var tint_symbol : f32; @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32; @@ -64,7 +64,7 @@ fn main() { TEST_F(ModuleScopeVarToEntryPointParamTest, Basic_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { w = p; } @@ -74,7 +74,7 @@ var p : f32; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { @internal(disable_validation__ignore_storage_class) var tint_symbol : f32; @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32; @@ -95,9 +95,14 @@ var w : f32; fn no_uses() { } +fn zoo() { + p = p * 2.0; +} + fn bar(a : f32, b : f32) { p = a; w = b; + zoo(); } fn foo(a : f32) { @@ -106,7 +111,7 @@ fn foo(a : f32) { no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(1.0); } @@ -116,22 +121,27 @@ fn main() { fn no_uses() { } -fn bar(a : f32, b : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_1 : ptr) { - *(tint_symbol) = a; - *(tint_symbol_1) = b; +fn zoo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr) { + *(tint_symbol) = (*(tint_symbol) * 2.0); } -fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_2 : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_3 : ptr) { +fn bar(a : f32, b : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_1 : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_2 : ptr) { + *(tint_symbol_1) = a; + *(tint_symbol_2) = b; + zoo(tint_symbol_1); +} + +fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_3 : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_4 : ptr) { let b : f32 = 2.0; - bar(a, b, tint_symbol_2, tint_symbol_3); + bar(a, b, tint_symbol_3, tint_symbol_4); no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - @internal(disable_validation__ignore_storage_class) var tint_symbol_4 : f32; - @internal(disable_validation__ignore_storage_class) var tint_symbol_5 : f32; - foo(1.0, &(tint_symbol_4), &(tint_symbol_5)); + @internal(disable_validation__ignore_storage_class) var tint_symbol_5 : f32; + @internal(disable_validation__ignore_storage_class) var tint_symbol_6 : f32; + foo(1.0, &(tint_symbol_5), &(tint_symbol_6)); } )"; @@ -142,7 +152,7 @@ fn main() { TEST_F(ModuleScopeVarToEntryPointParamTest, FunctionCalls_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(1.0); } @@ -159,6 +169,11 @@ fn no_uses() { fn bar(a : f32, b : f32) { p = a; w = b; + zoo(); +} + +fn zoo() { + p = p * 2.0; } var p : f32; @@ -166,25 +181,30 @@ var w : f32; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - @internal(disable_validation__ignore_storage_class) var tint_symbol : f32; - @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32; - foo(1.0, &(tint_symbol), &(tint_symbol_1)); + @internal(disable_validation__ignore_storage_class) var tint_symbol_5 : f32; + @internal(disable_validation__ignore_storage_class) var tint_symbol_6 : f32; + foo(1.0, &(tint_symbol_5), &(tint_symbol_6)); } -fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_2 : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_3 : ptr) { +fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_3 : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_4 : ptr) { let b : f32 = 2.0; - bar(a, b, tint_symbol_2, tint_symbol_3); + bar(a, b, tint_symbol_3, tint_symbol_4); no_uses(); } fn no_uses() { } -fn bar(a : f32, b : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_4 : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_5 : ptr) { - *(tint_symbol_4) = a; - *(tint_symbol_5) = b; +fn bar(a : f32, b : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_1 : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_2 : ptr) { + *(tint_symbol_1) = a; + *(tint_symbol_2) = b; + zoo(tint_symbol_1); +} + +fn zoo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr) { + *(tint_symbol) = (*(tint_symbol) * 2.0); } )"; @@ -198,14 +218,14 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Constructors) { var a : f32 = 1.0; var b : f32 = f32(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x : f32 = a + b; } )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { @internal(disable_validation__ignore_storage_class) var tint_symbol : f32 = 1.0; @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32 = f32(); @@ -220,7 +240,7 @@ fn main() { TEST_F(ModuleScopeVarToEntryPointParamTest, Constructors_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x : f32 = a + b; } @@ -230,7 +250,7 @@ var a : f32 = 1.0; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { @internal(disable_validation__ignore_storage_class) var tint_symbol : f32 = 1.0; @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32 = f32(); @@ -248,7 +268,7 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Pointers) { var p : f32; var w : f32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p_ptr : ptr = &p; let w_ptr : ptr = &w; @@ -258,7 +278,7 @@ fn main() { )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { @internal(disable_validation__ignore_storage_class) var tint_symbol : f32; @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32; @@ -276,7 +296,7 @@ fn main() { TEST_F(ModuleScopeVarToEntryPointParamTest, Pointers_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p_ptr : ptr = &p; let w_ptr : ptr = &w; @@ -289,7 +309,7 @@ var p : f32; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { @internal(disable_validation__ignore_storage_class) var tint_symbol : f32; @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32; @@ -307,9 +327,9 @@ fn main() { TEST_F(ModuleScopeVarToEntryPointParamTest, FoldAddressOfDeref) { auto* src = R"( -var v : f32; +var v : f32; -fn bar(p : ptr) { +fn bar(p : ptr) { (*p) = 0.0; } @@ -317,24 +337,24 @@ fn foo() { bar(&v); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(); } )"; auto* expect = R"( -fn bar(p : ptr) { +fn bar(p : ptr) { *(p) = 0.0; } -fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr) { +fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr) { bar(tint_symbol); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32; + @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32; foo(&(tint_symbol_1)); } )"; @@ -346,7 +366,7 @@ fn main() { TEST_F(ModuleScopeVarToEntryPointParamTest, FoldAddressOfDeref_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(); } @@ -355,25 +375,25 @@ fn foo() { bar(&v); } -fn bar(p : ptr) { +fn bar(p : ptr) { (*p) = 0.0; } -var v : f32; +var v : f32; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - @internal(disable_validation__ignore_storage_class) var tint_symbol : f32; - foo(&(tint_symbol)); + @internal(disable_validation__ignore_storage_class) var tint_symbol_1 : f32; + foo(&(tint_symbol_1)); } -fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_1 : ptr) { - bar(tint_symbol_1); +fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr) { + bar(tint_symbol); } -fn bar(p : ptr) { +fn bar(p : ptr) { *(p) = 0.0; } )"; @@ -394,7 +414,7 @@ var u : S; @group(0) @binding(1) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = u; _ = s; @@ -406,7 +426,7 @@ struct S { a : f32, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr) { _ = *(tint_symbol); _ = *(tint_symbol_1); @@ -420,7 +440,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete TEST_F(ModuleScopeVarToEntryPointParamTest, Buffers_Basic_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = u; _ = s; @@ -436,7 +456,7 @@ struct S { )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr) { _ = *(tint_symbol); _ = *(tint_symbol_1); @@ -457,7 +477,7 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArray) { @group(0) @binding(0) var buffer : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = buffer[0]; } @@ -468,7 +488,7 @@ struct tint_symbol_1 { arr : array, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr) { _ = (*(tint_symbol)).arr[0]; } @@ -481,7 +501,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArray_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = buffer[0]; } @@ -495,7 +515,7 @@ struct tint_symbol_1 { arr : array, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr) { _ = (*(tint_symbol)).arr[0]; } @@ -515,7 +535,7 @@ fn foo() { _ = buffer[0]; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(); } @@ -530,7 +550,7 @@ fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_val _ = (*(tint_symbol))[0]; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr) { foo(&((*(tint_symbol_1)).arr)); } @@ -543,7 +563,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArrayInsideFunction_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(); } @@ -556,17 +576,17 @@ fn foo() { )"; auto* expect = R"( -struct tint_symbol_1 { +struct tint_symbol_2 { arr : array, } -@stage(compute) @workgroup_size(1) -fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr) { - foo(&((*(tint_symbol)).arr)); +@compute @workgroup_size(1) +fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr) { + foo(&((*(tint_symbol_1)).arr)); } -fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_2 : ptr>) { - _ = (*(tint_symbol_2))[0]; +fn foo(@internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr>) { + _ = (*(tint_symbol))[0]; } )"; @@ -582,7 +602,7 @@ type myarray = array; @group(0) @binding(0) var buffer : myarray; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = buffer[0]; } @@ -595,7 +615,7 @@ struct tint_symbol_1 { type myarray = array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr) { _ = (*(tint_symbol)).arr[0]; } @@ -608,7 +628,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_RuntimeArray_Alias_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = buffer[0]; } @@ -623,7 +643,7 @@ struct tint_symbol_1 { arr : array, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr) { _ = (*(tint_symbol)).arr[0]; } @@ -645,7 +665,7 @@ struct S { @group(0) @binding(0) var buffer : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = buffer[0]; } @@ -660,7 +680,7 @@ struct tint_symbol_1 { arr : array, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr) { _ = (*(tint_symbol)).arr[0]; } @@ -673,7 +693,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete TEST_F(ModuleScopeVarToEntryPointParamTest, Buffer_ArrayOfStruct_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = buffer[0]; } @@ -694,7 +714,7 @@ struct tint_symbol_1 { arr : array, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr) { _ = (*(tint_symbol)).arr[0]; } @@ -731,7 +751,7 @@ fn foo(a : f32) { no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(1.0); } @@ -757,7 +777,7 @@ fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(di no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_4 : ptr, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_5 : ptr) { foo(1.0, tint_symbol_4, tint_symbol_5); } @@ -770,7 +790,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete TEST_F(ModuleScopeVarToEntryPointParamTest, Buffers_FunctionCalls_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(1.0); } @@ -801,9 +821,9 @@ var s : S; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) -fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol : ptr, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_1 : ptr) { - foo(1.0, tint_symbol, tint_symbol_1); +@compute @workgroup_size(1) +fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_4 : ptr, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) @internal(disable_validation__ignore_storage_class) tint_symbol_5 : ptr) { + foo(1.0, tint_symbol_4, tint_symbol_5); } fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_2 : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_3 : ptr) { @@ -816,9 +836,9 @@ fn foo(a : f32, @internal(disable_validation__ignore_storage_class) @internal(di fn no_uses() { } -fn bar(a : f32, b : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_4 : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_5 : ptr) { - _ = *(tint_symbol_4); - _ = *(tint_symbol_5); +fn bar(a : f32, b : f32, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol : ptr, @internal(disable_validation__ignore_storage_class) @internal(disable_validation__ignore_invalid_pointer_argument) tint_symbol_1 : ptr) { + _ = *(tint_symbol); + _ = *(tint_symbol_1); } struct S { @@ -836,7 +856,7 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, HandleTypes_Basic) { @group(0) @binding(0) var t : texture_2d; @group(0) @binding(1) var s : sampler; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t; _ = s; @@ -844,7 +864,7 @@ fn main() { )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) tint_symbol : texture_2d, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) tint_symbol_1 : sampler) { _ = tint_symbol; _ = tint_symbol_1; @@ -876,7 +896,7 @@ fn foo(a : f32) { no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(1.0); } @@ -898,7 +918,7 @@ fn foo(a : f32, tint_symbol_2 : texture_2d, tint_symbol_3 : sampler) { no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) tint_symbol_4 : texture_2d, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) tint_symbol_5 : sampler) { foo(1.0, tint_symbol_4, tint_symbol_5); } @@ -911,7 +931,7 @@ fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_paramete TEST_F(ModuleScopeVarToEntryPointParamTest, HandleTypes_FunctionCalls_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { foo(1.0); } @@ -936,9 +956,9 @@ fn bar(a : f32, b : f32) { )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) -fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) tint_symbol : texture_2d, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) tint_symbol_1 : sampler) { - foo(1.0, tint_symbol, tint_symbol_1); +@compute @workgroup_size(1) +fn main(@group(0) @binding(0) @internal(disable_validation__entry_point_parameter) tint_symbol_4 : texture_2d, @group(0) @binding(1) @internal(disable_validation__entry_point_parameter) tint_symbol_5 : sampler) { + foo(1.0, tint_symbol_4, tint_symbol_5); } fn foo(a : f32, tint_symbol_2 : texture_2d, tint_symbol_3 : sampler) { @@ -951,9 +971,9 @@ fn foo(a : f32, tint_symbol_2 : texture_2d, tint_symbol_3 : sampler) { fn no_uses() { } -fn bar(a : f32, b : f32, tint_symbol_4 : texture_2d, tint_symbol_5 : sampler) { - _ = tint_symbol_4; - _ = tint_symbol_5; +fn bar(a : f32, b : f32, tint_symbol : texture_2d, tint_symbol_1 : sampler) { + _ = tint_symbol; + _ = tint_symbol_1; } )"; @@ -966,7 +986,7 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, Matrix) { auto* src = R"( var m : mat2x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = m; } @@ -977,7 +997,7 @@ struct tint_symbol_2 { m : mat2x2, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr) { let tint_symbol : ptr> = &((*(tint_symbol_1)).m); let x = *(tint_symbol); @@ -999,7 +1019,7 @@ struct S2 { }; var m : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = m; } @@ -1018,7 +1038,7 @@ struct tint_symbol_2 { m : array, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr) { let tint_symbol : ptr> = &((*(tint_symbol_1)).m); let x = *(tint_symbol); @@ -1042,7 +1062,7 @@ var a : S; var b : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = a; let y = b; @@ -1059,7 +1079,7 @@ struct tint_symbol_3 { b : S, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr) { let tint_symbol : ptr = &((*(tint_symbol_1)).a); let tint_symbol_2 : ptr = &((*(tint_symbol_1)).b); @@ -1077,7 +1097,7 @@ fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr // variables that are promoted to threadgroup memory arguments. TEST_F(ModuleScopeVarToEntryPointParamTest, DuplicateThreadgroupArgumentTypes_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = a; let y = b; @@ -1101,7 +1121,7 @@ struct tint_symbol_3 { b : S, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@internal(disable_validation__entry_point_parameter) tint_symbol_1 : ptr) { let tint_symbol : ptr = &((*(tint_symbol_1)).a); let tint_symbol_2 : ptr = &((*(tint_symbol_1)).b); @@ -1132,7 +1152,7 @@ var sb : S; @group(0) @binding(2) var t : texture_2d; @group(0) @binding(3) var s : sampler; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { } )"; @@ -1142,7 +1162,7 @@ struct S { a : f32, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { } )"; @@ -1152,6 +1172,81 @@ fn main() { EXPECT_EQ(expect, str(got)); } +// Test that a private variable that is only referenced by a single user-defined function is +// promoted to a function scope variable, rather than passed as a parameter. +TEST_F(ModuleScopeVarToEntryPointParamTest, PromotePrivateToFunctionScope) { + auto* src = R"( +var p : f32; + +fn foo(a : f32) -> f32 { + let x = p; + p = x * a; + return p; +} + +@compute @workgroup_size(1) +fn main() { + _ = foo(1.0); +} +)"; + + auto* expect = R"( +fn foo(a : f32) -> f32 { + @internal(disable_validation__ignore_storage_class) var tint_symbol : f32; + let x = tint_symbol; + tint_symbol = (x * a); + return tint_symbol; +} + +@compute @workgroup_size(1) +fn main() { + _ = foo(1.0); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +// Test that a private variable that is only referenced by a single user-defined function is +// promoted to a function scope variable, rather than passed as a parameter. +TEST_F(ModuleScopeVarToEntryPointParamTest, PromotePrivateToFunctionScope_OutOfOrder) { + auto* src = R"( +var p : f32; + +@compute @workgroup_size(1) +fn main() { + _ = foo(1.0); +} + +fn foo(a : f32) -> f32 { + let x = p; + p = x * a; + return p; +} + +)"; + + auto* expect = R"( +@compute @workgroup_size(1) +fn main() { + _ = foo(1.0); +} + +fn foo(a : f32) -> f32 { + @internal(disable_validation__ignore_storage_class) var tint_symbol : f32; + let x = tint_symbol; + tint_symbol = (x * a); + return tint_symbol; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + TEST_F(ModuleScopeVarToEntryPointParamTest, EmtpyModule) { auto* src = ""; diff --git a/src/tint/transform/multiplanar_external_texture.cc b/src/tint/transform/multiplanar_external_texture.cc index 47cc9ce565..2fb4248549 100644 --- a/src/tint/transform/multiplanar_external_texture.cc +++ b/src/tint/transform/multiplanar_external_texture.cc @@ -86,8 +86,8 @@ struct MultiplanarExternalTexture::State { // binding and create two additional bindings (one texture_2d to // represent the secondary plane and one uniform buffer for the // ExternalTextureParams struct). - for (auto* var : ctx.src->AST().GlobalVariables()) { - auto* sem_var = sem.Get(var); + for (auto* global : ctx.src->AST().GlobalVariables()) { + auto* sem_var = sem.Get(global); if (!sem_var->Type()->UnwrapRef()->Is()) { continue; } @@ -95,7 +95,7 @@ struct MultiplanarExternalTexture::State { // If the attributes are empty, then this must be a texture_external // passed as a function parameter. These variables are transformed // elsewhere. - if (var->attributes.empty()) { + if (global->attributes.IsEmpty()) { continue; } @@ -109,8 +109,7 @@ struct MultiplanarExternalTexture::State { // provided to this transform. We fetch the new binding points by // providing the original texture_external binding points into the // passed map. - BindingPoint bp = {var->BindingPoint().group->value, - var->BindingPoint().binding->value}; + BindingPoint bp = sem_var->BindingPoint(); BindingsMap::const_iterator it = new_binding_points->bindings_map.find(bp); if (it == new_binding_points->bindings_map.end()) { @@ -129,24 +128,24 @@ struct MultiplanarExternalTexture::State { // corresponds with the new destination bindings. // NewBindingSymbols new_binding_syms; auto& syms = new_binding_symbols[sem_var]; - syms.plane_0 = ctx.Clone(var->symbol); + syms.plane_0 = ctx.Clone(global->symbol); syms.plane_1 = b.Symbols().New("ext_tex_plane_1"); - b.Global(syms.plane_1, b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32()), - b.GroupAndBinding(bps.plane_1.group, bps.plane_1.binding)); + b.GlobalVar(syms.plane_1, b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32()), + b.Group(bps.plane_1.group), b.Binding(bps.plane_1.binding)); syms.params = b.Symbols().New("ext_tex_params"); - b.Global(syms.params, b.ty.type_name("ExternalTextureParams"), - ast::StorageClass::kUniform, - b.GroupAndBinding(bps.params.group, bps.params.binding)); + b.GlobalVar(syms.params, b.ty.type_name("ExternalTextureParams"), + ast::StorageClass::kUniform, b.Group(bps.params.group), + b.Binding(bps.params.binding)); // Replace the original texture_external binding with a texture_2d // binding. - ast::AttributeList cloned_attributes = ctx.Clone(var->attributes); - const ast::Expression* cloned_constructor = ctx.Clone(var->constructor); + auto cloned_attributes = ctx.Clone(global->attributes); + const ast::Expression* cloned_constructor = ctx.Clone(global->constructor); auto* replacement = b.Var(syms.plane_0, b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32()), cloned_constructor, cloned_attributes); - ctx.Replace(var, replacement); + ctx.Replace(global, replacement); } // We must update all the texture_external parameters for user declared @@ -184,9 +183,10 @@ struct MultiplanarExternalTexture::State { // Transform the original textureLoad and textureSampleLevel calls into // textureLoadExternal and textureSampleExternal calls. ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::CallExpression* { - auto* builtin = sem.Get(expr)->Target()->As(); + auto* call = sem.Get(expr)->UnwrapMaterialize()->As(); + auto* builtin = call->Target()->As(); - if (builtin && !builtin->Parameters().empty() && + if (builtin && !builtin->Parameters().IsEmpty() && builtin->Parameters()[0]->Type()->Is() && builtin->Type() != sem::BuiltinType::kTextureDimensions) { if (auto* var_user = sem.Get(expr->args[0])) { @@ -209,7 +209,7 @@ struct MultiplanarExternalTexture::State { } } - } else if (sem.Get(expr)->Target()->Is()) { + } else if (call->Target()->Is()) { // The call expression may be to a user-defined function that // contains a texture_external parameter. These need to be expanded // out to multiple plane textures and the texture parameters @@ -238,7 +238,7 @@ struct MultiplanarExternalTexture::State { /// Creates the parameter structs associated with the transform. void createExtTexParamsStructs() { // Create GammaTransferParams struct. - ast::StructMemberList gamma_transfer_member_list = { + utils::Vector gamma_transfer_member_list{ b.Member("G", b.ty.f32()), b.Member("A", b.ty.f32()), b.Member("B", b.ty.f32()), b.Member("C", b.ty.f32()), b.Member("D", b.ty.f32()), b.Member("E", b.ty.f32()), b.Member("F", b.ty.f32()), b.Member("padding", b.ty.u32())}; @@ -248,8 +248,9 @@ struct MultiplanarExternalTexture::State { b.Structure(gamma_transfer_struct_sym, gamma_transfer_member_list); // Create ExternalTextureParams struct. - ast::StructMemberList ext_tex_params_member_list = { + utils::Vector ext_tex_params_member_list{ b.Member("numPlanes", b.ty.u32()), + b.Member("doYuvToRgbConversionOnly", b.ty.u32()), b.Member("yuvToRgbConversionMatrix", b.ty.mat3x4(b.ty.f32())), b.Member("gammaDecodeParams", b.ty.type_name("GammaTransferParams")), b.Member("gammaEncodeParams", b.ty.type_name("GammaTransferParams")), @@ -263,52 +264,53 @@ struct MultiplanarExternalTexture::State { /// Creates the gammaCorrection function if needed and returns a call /// expression to it. void createGammaCorrectionFn() { - ast::VariableList varList = {b.Param("v", b.ty.vec3()), - b.Param("params", b.ty.type_name(gamma_transfer_struct_sym))}; - - ast::StatementList statementList = { - // let cond = abs(v) < vec3(params.D); - b.Decl(b.Let( - "cond", nullptr, - b.LessThan(b.Call("abs", "v"), b.vec3(b.MemberAccessor("params", "D"))))), - // let t = sign(v) * ((params.C * abs(v)) + params.F); - b.Decl(b.Let("t", nullptr, - b.Mul(b.Call("sign", "v"), - b.Add(b.Mul(b.MemberAccessor("params", "C"), b.Call("abs", "v")), - b.MemberAccessor("params", "F"))))), - // let f = (sign(v) * pow(((params.A * abs(v)) + params.B), - // vec3(params.G))) + params.E; - b.Decl(b.Let( - "f", nullptr, - b.Mul(b.Call("sign", "v"), - b.Add(b.Call("pow", - b.Add(b.Mul(b.MemberAccessor("params", "A"), b.Call("abs", "v")), - b.MemberAccessor("params", "B")), - b.vec3(b.MemberAccessor("params", "G"))), - b.MemberAccessor("params", "E"))))), - // return select(f, t, cond); - b.Return(b.Call("select", "f", "t", "cond"))}; - gamma_correction_sym = b.Symbols().New("gammaCorrection"); - b.Func(gamma_correction_sym, varList, b.ty.vec3(), statementList, {}); + b.Func( + gamma_correction_sym, + utils::Vector{ + b.Param("v", b.ty.vec3()), + b.Param("params", b.ty.type_name(gamma_transfer_struct_sym)), + }, + b.ty.vec3(), + utils::Vector{ + // let cond = abs(v) < vec3(params.D); + b.Decl(b.Let("cond", b.LessThan(b.Call("abs", "v"), + b.vec3(b.MemberAccessor("params", "D"))))), + // let t = sign(v) * ((params.C * abs(v)) + params.F); + b.Decl(b.Let("t", + b.Mul(b.Call("sign", "v"), + b.Add(b.Mul(b.MemberAccessor("params", "C"), b.Call("abs", "v")), + b.MemberAccessor("params", "F"))))), + // let f = (sign(v) * pow(((params.A * abs(v)) + params.B), + // vec3(params.G))) + params.E; + b.Decl(b.Let("f", b.Mul(b.Call("sign", "v"), + b.Add(b.Call("pow", + b.Add(b.Mul(b.MemberAccessor("params", "A"), + b.Call("abs", "v")), + b.MemberAccessor("params", "B")), + b.vec3(b.MemberAccessor("params", "G"))), + b.MemberAccessor("params", "E"))))), + // return select(f, t, cond); + b.Return(b.Call("select", "f", "t", "cond")), + }); } /// Constructs a StatementList containing all the statements making up the /// bodies of the textureSampleExternal and textureLoadExternal functions. /// @param call_type determines which function body to generate /// @returns a statement list that makes of the body of the chosen function - ast::StatementList createTexFnExtStatementList(sem::BuiltinType call_type) { + auto createTexFnExtStatementList(sem::BuiltinType call_type) { const ast::CallExpression* single_plane_call = nullptr; const ast::CallExpression* plane_0_call = nullptr; const ast::CallExpression* plane_1_call = nullptr; if (call_type == sem::BuiltinType::kTextureSampleLevel) { // textureSampleLevel(plane0, smp, coord.xy, 0.0); - single_plane_call = b.Call("textureSampleLevel", "plane0", "smp", "coord", 0.0f); + single_plane_call = b.Call("textureSampleLevel", "plane0", "smp", "coord", 0_f); // textureSampleLevel(plane0, smp, coord.xy, 0.0); - plane_0_call = b.Call("textureSampleLevel", "plane0", "smp", "coord", 0.0f); + plane_0_call = b.Call("textureSampleLevel", "plane0", "smp", "coord", 0_f); // textureSampleLevel(plane1, smp, coord.xy, 0.0); - plane_1_call = b.Call("textureSampleLevel", "plane1", "smp", "coord", 0.0f); + plane_1_call = b.Call("textureSampleLevel", "plane1", "smp", "coord", 0_f); } else if (call_type == sem::BuiltinType::kTextureLoad) { // textureLoad(plane0, coords.xy, 0); single_plane_call = b.Call("textureLoad", "plane0", "coord", 0_i); @@ -320,7 +322,7 @@ struct MultiplanarExternalTexture::State { TINT_ICE(Transform, b.Diagnostics()) << "unhandled builtin: " << call_type; } - return { + return utils::Vector{ // var color: vec3; b.Decl(b.Var("color", b.ty.vec3(b.ty.f32()))), // if ((params.numPlanes == 1u)) @@ -334,18 +336,24 @@ struct MultiplanarExternalTexture::State { // params.yuvToRgbConversionMatrix; b.Assign("color", b.Mul(b.vec4(b.MemberAccessor(plane_0_call, "r"), - b.MemberAccessor(plane_1_call, "rg"), 1.0f), + b.MemberAccessor(plane_1_call, "rg"), 1_f), b.MemberAccessor("params", "yuvToRgbConversionMatrix")))))), - // color = gammaConversion(color, gammaDecodeParams); - b.Assign("color", b.Call("gammaCorrection", "color", - b.MemberAccessor("params", "gammaDecodeParams"))), - // color = (params.gamutConversionMatrix * color); - b.Assign("color", b.Mul(b.MemberAccessor("params", "gamutConversionMatrix"), "color")), - // color = gammaConversion(color, gammaEncodeParams); - b.Assign("color", b.Call("gammaCorrection", "color", - b.MemberAccessor("params", "gammaEncodeParams"))), - // return vec4(color, 1.0f); - b.Return(b.vec4("color", 1.0f))}; + // if (params.doYuvToRgbConversionOnly == 0u) + b.If(b.create( + ast::BinaryOp::kEqual, b.MemberAccessor("params", "doYuvToRgbConversionOnly"), + b.Expr(0_u)), + b.Block( + // color = gammaConversion(color, gammaDecodeParams); + b.Assign("color", b.Call("gammaCorrection", "color", + b.MemberAccessor("params", "gammaDecodeParams"))), + // color = (params.gamutConversionMatrix * color); + b.Assign("color", + b.Mul(b.MemberAccessor("params", "gamutConversionMatrix"), "color")), + // color = gammaConversion(color, gammaEncodeParams); + b.Assign("color", b.Call("gammaCorrection", "color", + b.MemberAccessor("params", "gammaEncodeParams"))))), + // return vec4(color, 1.f); + b.Return(b.vec4("color", 1_f))}; } /// Creates the textureSampleExternal function if needed and returns a call @@ -355,13 +363,12 @@ struct MultiplanarExternalTexture::State { /// @returns a call expression to textureSampleExternal const ast::CallExpression* createTexSmpExt(const ast::CallExpression* expr, NewBindingSymbols syms) { - ast::ExpressionList params; const ast::Expression* plane_0_binding_param = ctx.Clone(expr->args[0]); - if (expr->args.size() != 3) { + if (expr->args.Length() != 3) { TINT_ICE(Transform, b.Diagnostics()) << "expected textureSampleLevel call with a " "texture_external to have 3 parameters, found " - << expr->args.size() << " parameters"; + << expr->args.Length() << " parameters"; } // TextureSampleExternal calls the gammaCorrection function, so ensure it @@ -374,23 +381,29 @@ struct MultiplanarExternalTexture::State { texture_sample_external_sym = b.Symbols().New("textureSampleExternal"); // Emit the textureSampleExternal function. - ast::VariableList varList = { - b.Param("plane0", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())), - b.Param("plane1", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())), - b.Param("smp", b.ty.sampler(ast::SamplerKind::kSampler)), - b.Param("coord", b.ty.vec2(b.ty.f32())), - b.Param("params", b.ty.type_name(params_struct_sym))}; - - ast::StatementList statementList = - createTexFnExtStatementList(sem::BuiltinType::kTextureSampleLevel); - - b.Func(texture_sample_external_sym, varList, b.ty.vec4(b.ty.f32()), statementList, {}); + b.Func( + texture_sample_external_sym, + utils::Vector{ + b.Param("plane0", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())), + b.Param("plane1", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())), + b.Param("smp", b.ty.sampler(ast::SamplerKind::kSampler)), + b.Param("coord", b.ty.vec2(b.ty.f32())), + b.Param("params", b.ty.type_name(params_struct_sym)), + }, + b.ty.vec4(b.ty.f32()), + utils::Vector{ + createTexFnExtStatementList(sem::BuiltinType::kTextureSampleLevel), + }); } const ast::IdentifierExpression* exp = b.Expr(texture_sample_external_sym); - params = {plane_0_binding_param, b.Expr(syms.plane_1), ctx.Clone(expr->args[1]), - ctx.Clone(expr->args[2]), b.Expr(syms.params)}; - return b.Call(exp, params); + return b.Call(exp, utils::Vector{ + plane_0_binding_param, + b.Expr(syms.plane_1), + ctx.Clone(expr->args[1]), + ctx.Clone(expr->args[2]), + b.Expr(syms.params), + }); } /// Creates the textureLoadExternal function if needed and returns a call @@ -400,14 +413,13 @@ struct MultiplanarExternalTexture::State { /// @returns a call expression to textureLoadExternal const ast::CallExpression* createTexLdExt(const ast::CallExpression* expr, NewBindingSymbols syms) { - ast::ExpressionList params; const ast::Expression* plane_0_binding_param = ctx.Clone(expr->args[0]); - if (expr->args.size() != 2) { + if (expr->args.Length() != 2) { TINT_ICE(Transform, b.Diagnostics()) << "expected textureLoad call with a texture_external " "to have 2 parameters, found " - << expr->args.size() << " parameters"; + << expr->args.Length() << " parameters"; } // TextureLoadExternal calls the gammaCorrection function, so ensure it @@ -420,22 +432,22 @@ struct MultiplanarExternalTexture::State { texture_load_external_sym = b.Symbols().New("textureLoadExternal"); // Emit the textureLoadExternal function. - ast::VariableList var_list = { - b.Param("plane0", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())), - b.Param("plane1", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())), - b.Param("coord", b.ty.vec2(b.ty.i32())), - b.Param("params", b.ty.type_name(params_struct_sym))}; - - ast::StatementList statement_list = - createTexFnExtStatementList(sem::BuiltinType::kTextureLoad); - - b.Func(texture_load_external_sym, var_list, b.ty.vec4(b.ty.f32()), statement_list, {}); + b.Func( + texture_load_external_sym, + utils::Vector{ + b.Param("plane0", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())), + b.Param("plane1", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())), + b.Param("coord", b.ty.vec2(b.ty.i32())), + b.Param("params", b.ty.type_name(params_struct_sym)), + }, + b.ty.vec4(b.ty.f32()), + utils::Vector{ + createTexFnExtStatementList(sem::BuiltinType::kTextureLoad), + }); } - const ast::IdentifierExpression* exp = b.Expr(texture_load_external_sym); - params = {plane_0_binding_param, b.Expr(syms.plane_1), ctx.Clone(expr->args[1]), - b.Expr(syms.params)}; - return b.Call(exp, params); + return b.Call(texture_load_external_sym, plane_0_binding_param, syms.plane_1, + ctx.Clone(expr->args[1]), syms.params); } }; diff --git a/src/tint/transform/multiplanar_external_texture.h b/src/tint/transform/multiplanar_external_texture.h index 88cbc98182..afd15a1701 100644 --- a/src/tint/transform/multiplanar_external_texture.h +++ b/src/tint/transform/multiplanar_external_texture.h @@ -46,8 +46,11 @@ struct BindingPoints { /// textureSampleLevel that contain a texture_external parameter will be /// transformed into a newly generated version of the function, which can /// perform the desired operation on a single RGBA plane or on seperate Y and UV -/// planes. -class MultiplanarExternalTexture : public Castable { +/// planes, and do colorspace conversions including yuv->rgb conversion, gamma +/// decoding, gamut conversion, and gamma encoding steps. Specifically +// for BT.709 to SRGB conversion, it takes the fast path only doing the yuv->rgb +// step and skipping all other steps. +class MultiplanarExternalTexture final : public Castable { public: /// BindingsMap is a map where the key is the binding location of a /// texture_external and the value is a struct containing the desired @@ -57,7 +60,7 @@ class MultiplanarExternalTexture : public Castable { + struct NewBindingPoints final : public Castable { /// Constructor /// @param bm a map to the new binding slots to use. explicit NewBindingPoints(BindingsMap bm); diff --git a/src/tint/transform/multiplanar_external_texture_test.cc b/src/tint/transform/multiplanar_external_texture_test.cc index 171df8dac9..79f9fddef0 100644 --- a/src/tint/transform/multiplanar_external_texture_test.cc +++ b/src/tint/transform/multiplanar_external_texture_test.cc @@ -56,7 +56,7 @@ TEST_F(MultiplanarExternalTextureTest, ErrorNoPassedData) { @group(0) @binding(0) var s : sampler; @group(0) @binding(1) var ext_tex : texture_external; -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureSampleLevel(ext_tex, s, coord.xy); } @@ -74,7 +74,7 @@ TEST_F(MultiplanarExternalTextureTest, ErrorIncorrectBindingPont) { @group(0) @binding(0) var s : sampler; @group(0) @binding(1) var ext_tex : texture_external; -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureSampleLevel(ext_tex, s, coord.xy); } @@ -96,7 +96,7 @@ TEST_F(MultiplanarExternalTextureTest, Dimensions) { auto* src = R"( @group(0) @binding(0) var ext_tex : texture_external; -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { var dim : vec2; dim = textureDimensions(ext_tex); @@ -118,6 +118,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -130,7 +131,7 @@ struct ExternalTextureParams { @group(0) @binding(0) var ext_tex : texture_2d; -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { var dim : vec2; dim = textureDimensions(ext_tex); @@ -148,7 +149,7 @@ fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { // Tests that the transform works with a textureDimensions call. TEST_F(MultiplanarExternalTextureTest, Dimensions_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { var dim : vec2; dim = textureDimensions(ext_tex); @@ -172,6 +173,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -182,7 +184,7 @@ struct ExternalTextureParams { @group(0) @binding(2) var ext_tex_params : ExternalTextureParams; -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { var dim : vec2; dim = textureDimensions(ext_tex); @@ -205,7 +207,7 @@ TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel) { @group(0) @binding(0) var s : sampler; @group(0) @binding(1) var ext_tex : texture_external; -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureSampleLevel(ext_tex, s, coord.xy); } @@ -225,6 +227,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -249,17 +252,19 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params); } @@ -275,7 +280,7 @@ fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { // Test that the transform works with a textureSampleLevel call. TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureSampleLevel(ext_tex, s, coord.xy); } @@ -298,6 +303,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -318,17 +324,19 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params); } @@ -350,7 +358,7 @@ TEST_F(MultiplanarExternalTextureTest, BasicTextureLoad) { auto* src = R"( @group(0) @binding(0) var ext_tex : texture_external; -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureLoad(ext_tex, vec2(1, 1)); } @@ -370,6 +378,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -394,15 +403,17 @@ fn textureLoadExternal(plane0 : texture_2d, plane1 : texture_2d, coord if ((params.numPlanes == 1u)) { color = textureLoad(plane0, coord, 0i).rgb; } else { - color = (vec4(textureLoad(plane0, coord, 0i).r, textureLoad(plane1, coord, 0i).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureLoad(plane0, coord, 0i).r, textureLoad(plane1, coord, 0i).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureLoadExternal(ext_tex, ext_tex_plane_1, vec2(1, 1), ext_tex_params); } @@ -418,7 +429,7 @@ fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { // Tests that the transform works with a textureLoad call. TEST_F(MultiplanarExternalTextureTest, BasicTextureLoad_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureLoad(ext_tex, vec2(1, 1)); } @@ -440,6 +451,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -462,15 +474,17 @@ fn textureLoadExternal(plane0 : texture_2d, plane1 : texture_2d, coord if ((params.numPlanes == 1u)) { color = textureLoad(plane0, coord, 0i).rgb; } else { - color = (vec4(textureLoad(plane0, coord, 0i).r, textureLoad(plane1, coord, 0i).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureLoad(plane0, coord, 0i).r, textureLoad(plane1, coord, 0i).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureLoadExternal(ext_tex, ext_tex_plane_1, vec2(1, 1), ext_tex_params); } @@ -492,7 +506,7 @@ TEST_F(MultiplanarExternalTextureTest, TextureSampleAndTextureLoad) { @group(0) @binding(0) var s : sampler; @group(0) @binding(1) var ext_tex : texture_external; -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureSampleLevel(ext_tex, s, coord.xy) + textureLoad(ext_tex, vec2(1, 1)); } @@ -512,6 +526,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -536,14 +551,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn textureLoadExternal(plane0 : texture_2d, plane1 : texture_2d, coord : vec2, params : ExternalTextureParams) -> vec4 { @@ -551,15 +568,17 @@ fn textureLoadExternal(plane0 : texture_2d, plane1 : texture_2d, coord if ((params.numPlanes == 1u)) { color = textureLoad(plane0, coord, 0i).rgb; } else { - color = (vec4(textureLoad(plane0, coord, 0i).r, textureLoad(plane1, coord, 0i).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureLoad(plane0, coord, 0i).r, textureLoad(plane1, coord, 0i).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return (textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureLoadExternal(ext_tex, ext_tex_plane_1, vec2(1, 1), ext_tex_params)); } @@ -576,7 +595,7 @@ fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { // call. TEST_F(MultiplanarExternalTextureTest, TextureSampleAndTextureLoad_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureSampleLevel(ext_tex, s, coord.xy) + textureLoad(ext_tex, vec2(1, 1)); } @@ -599,6 +618,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -619,14 +639,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn textureLoadExternal(plane0 : texture_2d, plane1 : texture_2d, coord : vec2, params : ExternalTextureParams) -> vec4 { @@ -634,15 +656,17 @@ fn textureLoadExternal(plane0 : texture_2d, plane1 : texture_2d, coord if ((params.numPlanes == 1u)) { color = textureLoad(plane0, coord, 0i).rgb; } else { - color = (vec4(textureLoad(plane0, coord, 0i).r, textureLoad(plane1, coord, 0i).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureLoad(plane0, coord, 0i).r, textureLoad(plane1, coord, 0i).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return (textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureLoadExternal(ext_tex, ext_tex_plane_1, vec2(1, 1), ext_tex_params)); } @@ -668,7 +692,7 @@ TEST_F(MultiplanarExternalTextureTest, ManyTextureSampleLevel) { @group(0) @binding(3) var ext_tex_2 : texture_external; @group(1) @binding(0) var ext_tex_3 : texture_external; -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return textureSampleLevel(ext_tex, s, coord.xy) + textureSampleLevel(ext_tex_1, s, coord.xy) + textureSampleLevel(ext_tex_2, s, coord.xy) + textureSampleLevel(ext_tex_3, s, coord.xy); } @@ -688,6 +712,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -730,17 +755,19 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } -@stage(fragment) +@fragment fn main(@builtin(position) coord : vec4) -> @location(0) vec4 { return (((textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureSampleExternal(ext_tex_1, ext_tex_plane_1_1, s, coord.xy, ext_tex_params_1)) + textureSampleExternal(ext_tex_2, ext_tex_plane_1_2, s, coord.xy, ext_tex_params_2)) + textureSampleExternal(ext_tex_3, ext_tex_plane_1_3, s, coord.xy, ext_tex_params_3)); } @@ -768,7 +795,7 @@ fn f(t : texture_external, s : sampler) { @group(0) @binding(0) var ext_tex : texture_external; @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(ext_tex, smp); } @@ -788,6 +815,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -808,14 +836,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn f(t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_tex_params_1 : ExternalTextureParams, s : sampler) { @@ -826,7 +856,7 @@ fn f(t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_tex_params_1 @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); } @@ -843,7 +873,7 @@ fn main() { // correct output. TEST_F(MultiplanarExternalTextureTest, ExternalTexturePassedAsParam_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn main() { f(ext_tex, smp); } @@ -870,6 +900,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -880,7 +911,7 @@ struct ExternalTextureParams { @group(0) @binding(3) var ext_tex_params : ExternalTextureParams; -@stage(fragment) +@fragment fn main() { f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); } @@ -895,14 +926,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn f(t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_tex_params_1 : ExternalTextureParams, s : sampler) { @@ -932,7 +965,7 @@ fn f(s : sampler, t : texture_external) { @group(0) @binding(0) var ext_tex : texture_external; @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(smp, ext_tex); } @@ -952,6 +985,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -972,14 +1006,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn f(s : sampler, t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_tex_params_1 : ExternalTextureParams) { @@ -990,7 +1026,7 @@ fn f(s : sampler, t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_ @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(smp, ext_tex, ext_tex_plane_1, ext_tex_params); } @@ -1016,7 +1052,7 @@ fn f(t : texture_external, s : sampler, t2 : texture_external) { @group(0) @binding(1) var smp : sampler; @group(0) @binding(2) var ext_tex2 : texture_external; -@stage(fragment) +@fragment fn main() { f(ext_tex, smp, ext_tex2); } @@ -1036,6 +1072,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -1060,14 +1097,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn f(t : texture_2d, ext_tex_plane_1_2 : texture_2d, ext_tex_params_2 : ExternalTextureParams, s : sampler, t2 : texture_2d, ext_tex_plane_1_3 : texture_2d, ext_tex_params_3 : ExternalTextureParams) { @@ -1081,7 +1120,7 @@ fn f(t : texture_2d, ext_tex_plane_1_2 : texture_2d, ext_tex_params_2 @group(0) @binding(2) var ext_tex2 : texture_2d; -@stage(fragment) +@fragment fn main() { f(ext_tex, ext_tex_plane_1, ext_tex_params, smp, ext_tex2, ext_tex_plane_1_1, ext_tex_params_1); } @@ -1099,7 +1138,7 @@ fn main() { // correct output. TEST_F(MultiplanarExternalTextureTest, ExternalTexturePassedAsParamMultiple_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn main() { f(ext_tex, smp, ext_tex2); } @@ -1129,6 +1168,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -1143,7 +1183,7 @@ struct ExternalTextureParams { @group(0) @binding(6) var ext_tex_params_1 : ExternalTextureParams; -@stage(fragment) +@fragment fn main() { f(ext_tex, ext_tex_plane_1, ext_tex_params, smp, ext_tex2, ext_tex_plane_1_1, ext_tex_params_1); } @@ -1158,14 +1198,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn f(t : texture_2d, ext_tex_plane_1_2 : texture_2d, ext_tex_params_2 : ExternalTextureParams, s : sampler, t2 : texture_2d, ext_tex_plane_1_3 : texture_2d, ext_tex_params_3 : ExternalTextureParams) { @@ -1203,7 +1245,7 @@ fn f(t : texture_external, s : sampler) { @group(0) @binding(0) var ext_tex : texture_external; @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(ext_tex, smp); } @@ -1223,6 +1265,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -1243,14 +1286,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn nested(t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_tex_params_1 : ExternalTextureParams, s : sampler) { @@ -1265,7 +1310,7 @@ fn f(t : texture_2d, ext_tex_plane_1_2 : texture_2d, ext_tex_params_2 @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); } @@ -1293,7 +1338,7 @@ fn f(t : texture_external, s : sampler) { @group(0) @binding(0) var ext_tex : texture_external; @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(ext_tex, smp); } @@ -1313,6 +1358,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -1333,14 +1379,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn nested(t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_tex_params_1 : ExternalTextureParams, s : sampler) { @@ -1355,7 +1403,7 @@ fn f(t : texture_2d, ext_tex_plane_1_2 : texture_2d, ext_tex_params_2 @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); } @@ -1391,6 +1439,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -1421,7 +1470,7 @@ fn f(t : ET, s : sampler) { @group(0) @binding(0) var ext_tex : ET; @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(ext_tex, smp); } @@ -1441,6 +1490,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -1463,14 +1513,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn f(t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_tex_params_1 : ExternalTextureParams, s : sampler) { @@ -1481,7 +1533,7 @@ fn f(t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_tex_params_1 @group(0) @binding(1) var smp : sampler; -@stage(fragment) +@fragment fn main() { f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); } @@ -1497,7 +1549,7 @@ fn main() { // Tests that the the transform handles aliases to external textures TEST_F(MultiplanarExternalTextureTest, ExternalTextureAlias_OutOfOrder) { auto* src = R"( -@stage(fragment) +@fragment fn main() { f(ext_tex, smp); } @@ -1526,6 +1578,7 @@ struct GammaTransferParams { struct ExternalTextureParams { numPlanes : u32, + doYuvToRgbConversionOnly : u32, yuvToRgbConversionMatrix : mat3x4, gammaDecodeParams : GammaTransferParams, gammaEncodeParams : GammaTransferParams, @@ -1536,7 +1589,7 @@ struct ExternalTextureParams { @group(0) @binding(3) var ext_tex_params : ExternalTextureParams; -@stage(fragment) +@fragment fn main() { f(ext_tex, ext_tex_plane_1, ext_tex_params, smp); } @@ -1551,14 +1604,16 @@ fn gammaCorrection(v : vec3, params : GammaTransferParams) -> vec3 { fn textureSampleExternal(plane0 : texture_2d, plane1 : texture_2d, smp : sampler, coord : vec2, params : ExternalTextureParams) -> vec4 { var color : vec3; if ((params.numPlanes == 1u)) { - color = textureSampleLevel(plane0, smp, coord, 0.0).rgb; + color = textureSampleLevel(plane0, smp, coord, 0.0f).rgb; } else { - color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0).r, textureSampleLevel(plane1, smp, coord, 0.0).rg, 1.0) * params.yuvToRgbConversionMatrix); + color = (vec4(textureSampleLevel(plane0, smp, coord, 0.0f).r, textureSampleLevel(plane1, smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return vec4(color, 1.0); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } fn f(t : texture_2d, ext_tex_plane_1_1 : texture_2d, ext_tex_params_1 : ExternalTextureParams, s : sampler) { diff --git a/src/tint/transform/num_workgroups_from_uniform.cc b/src/tint/transform/num_workgroups_from_uniform.cc index 17814df9f6..5772424426 100644 --- a/src/tint/transform/num_workgroups_from_uniform.cc +++ b/src/tint/transform/num_workgroups_from_uniform.cc @@ -52,7 +52,7 @@ NumWorkgroupsFromUniform::~NumWorkgroupsFromUniform() = default; bool NumWorkgroupsFromUniform::ShouldRun(const Program* program, const DataMap&) const { for (auto* node : program->ASTNodes().Objects()) { if (auto* attr = node->As()) { - if (attr->builtin == ast::Builtin::kNumWorkgroups) { + if (attr->builtin == ast::BuiltinValue::kNumWorkgroups) { return true; } } @@ -89,7 +89,7 @@ void NumWorkgroupsFromUniform::Run(CloneContext& ctx, const DataMap& inputs, Dat for (auto* member : str->Members()) { auto* builtin = ast::GetAttribute(member->Declaration()->attributes); - if (!builtin || builtin->builtin != ast::Builtin::kNumWorkgroups) { + if (!builtin || builtin->builtin != ast::BuiltinValue::kNumWorkgroups) { continue; } @@ -121,11 +121,36 @@ void NumWorkgroupsFromUniform::Run(CloneContext& ctx, const DataMap& inputs, Dat if (!num_workgroups_ubo) { auto* num_workgroups_struct = ctx.dst->Structure( ctx.dst->Sym(), - {ctx.dst->Member(kNumWorkgroupsMemberName, ctx.dst->ty.vec3(ctx.dst->ty.u32()))}); - num_workgroups_ubo = ctx.dst->Global( + utils::Vector{ + ctx.dst->Member(kNumWorkgroupsMemberName, ctx.dst->ty.vec3(ctx.dst->ty.u32())), + }); + + uint32_t group, binding; + if (cfg->ubo_binding.has_value()) { + // If cfg->ubo_binding holds a value, use the specified binding point. + group = cfg->ubo_binding->group; + binding = cfg->ubo_binding->binding; + } else { + // If cfg->ubo_binding holds no value, use the binding 0 of the largest used group + // plus 1, or group 0 if no resource bound. + group = 0; + + for (auto* global : ctx.src->AST().GlobalVariables()) { + if (global->HasBindingPoint()) { + auto* global_sem = ctx.src->Sem().Get(global); + auto binding_point = global_sem->BindingPoint(); + if (binding_point.group >= group) { + group = binding_point.group + 1; + } + } + } + + binding = 0; + } + + num_workgroups_ubo = ctx.dst->GlobalVar( ctx.dst->Sym(), ctx.dst->ty.Of(num_workgroups_struct), ast::StorageClass::kUniform, - ast::AttributeList{ - ctx.dst->GroupAndBinding(cfg->ubo_binding.group, cfg->ubo_binding.binding)}); + ctx.dst->Group(group), ctx.dst->Binding(binding)); } return num_workgroups_ubo; }; @@ -151,7 +176,8 @@ void NumWorkgroupsFromUniform::Run(CloneContext& ctx, const DataMap& inputs, Dat ctx.Clone(); } -NumWorkgroupsFromUniform::Config::Config(sem::BindingPoint ubo_bp) : ubo_binding(ubo_bp) {} +NumWorkgroupsFromUniform::Config::Config(std::optional ubo_bp) + : ubo_binding(ubo_bp) {} NumWorkgroupsFromUniform::Config::Config(const Config&) = default; NumWorkgroupsFromUniform::Config::~Config() = default; diff --git a/src/tint/transform/num_workgroups_from_uniform.h b/src/tint/transform/num_workgroups_from_uniform.h index 93c4f15b61..292c823bc4 100644 --- a/src/tint/transform/num_workgroups_from_uniform.h +++ b/src/tint/transform/num_workgroups_from_uniform.h @@ -15,6 +15,8 @@ #ifndef SRC_TINT_TRANSFORM_NUM_WORKGROUPS_FROM_UNIFORM_H_ #define SRC_TINT_TRANSFORM_NUM_WORKGROUPS_FROM_UNIFORM_H_ +#include + #include "src/tint/sem/binding_point.h" #include "src/tint/transform/transform.h" @@ -42,7 +44,7 @@ namespace tint::transform { /// /// @note Depends on the following transforms to have been run first: /// * CanonicalizeEntryPointIO -class NumWorkgroupsFromUniform : public Castable { +class NumWorkgroupsFromUniform final : public Castable { public: /// Constructor NumWorkgroupsFromUniform(); @@ -50,10 +52,13 @@ class NumWorkgroupsFromUniform : public Castable { + struct Config final : public Castable { /// Constructor - /// @param ubo_bp the binding point to use for the generated uniform buffer. - explicit Config(sem::BindingPoint ubo_bp); + /// @param ubo_bp the binding point to use for the generated uniform buffer. If ubo_bp + /// contains no value, a free binding point will be used to ensure the generated program is + /// valid. Specifically, binding 0 of the largest used group plus 1 is used if at least one + /// resource is bound, otherwise group 0 binding 0 is used. + explicit Config(std::optional ubo_bp); /// Copy constructor Config(const Config&); @@ -61,8 +66,10 @@ class NumWorkgroupsFromUniform : public Castable ubo_binding; }; /// @param program the program to inspect diff --git a/src/tint/transform/num_workgroups_from_uniform_test.cc b/src/tint/transform/num_workgroups_from_uniform_test.cc index de6c6652f1..093081c6e7 100644 --- a/src/tint/transform/num_workgroups_from_uniform_test.cc +++ b/src/tint/transform/num_workgroups_from_uniform_test.cc @@ -33,7 +33,7 @@ TEST_F(NumWorkgroupsFromUniformTest, ShouldRunEmptyModule) { TEST_F(NumWorkgroupsFromUniformTest, ShouldRunHasNumWorkgroups) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(num_workgroups) num_wgs : vec3) { } )"; @@ -43,7 +43,7 @@ fn main(@builtin(num_workgroups) num_wgs : vec3) { TEST_F(NumWorkgroupsFromUniformTest, Error_MissingTransformData) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(num_workgroups) num_wgs : vec3) { } )"; @@ -61,7 +61,7 @@ fn main(@builtin(num_workgroups) num_wgs : vec3) { TEST_F(NumWorkgroupsFromUniformTest, Basic) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(num_workgroups) num_wgs : vec3) { let groups_x = num_wgs.x; let groups_y = num_wgs.y; @@ -82,7 +82,7 @@ fn main_inner(num_wgs : vec3) { let groups_z = num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { main_inner(tint_symbol_3.num_workgroups); } @@ -101,7 +101,7 @@ struct Builtins { @builtin(num_workgroups) num_wgs : vec3, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(in : Builtins) { let groups_x = in.num_wgs.x; let groups_y = in.num_wgs.y; @@ -126,7 +126,7 @@ fn main_inner(in : Builtins) { let groups_z = in.num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { main_inner(Builtins(tint_symbol_3.num_workgroups)); } @@ -141,7 +141,7 @@ fn main() { TEST_F(NumWorkgroupsFromUniformTest, StructOnlyMember_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(in : Builtins) { let groups_x = in.num_wgs.x; let groups_y = in.num_wgs.y; @@ -166,7 +166,7 @@ fn main_inner(in : Builtins) { let groups_z = in.num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { main_inner(Builtins(tint_symbol_3.num_workgroups)); } @@ -191,7 +191,7 @@ struct Builtins { @builtin(workgroup_id) wgid : vec3, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(in : Builtins) { let groups_x = in.num_wgs.x; let groups_y = in.num_wgs.y; @@ -225,7 +225,7 @@ fn main_inner(in : Builtins) { let groups_z = in.num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(tint_symbol : tint_symbol_1) { main_inner(Builtins(tint_symbol.gid, tint_symbol_3.num_workgroups, tint_symbol.wgid)); } @@ -240,7 +240,7 @@ fn main(tint_symbol : tint_symbol_1) { TEST_F(NumWorkgroupsFromUniformTest, StructMultipleMembers_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(in : Builtins) { let groups_x = in.num_wgs.x; let groups_y = in.num_wgs.y; @@ -275,7 +275,7 @@ fn main_inner(in : Builtins) { let groups_z = in.num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(tint_symbol : tint_symbol_1) { main_inner(Builtins(tint_symbol.gid, tint_symbol_3.num_workgroups, tint_symbol.wgid)); } @@ -306,21 +306,21 @@ struct Builtins2 { @builtin(workgroup_id) wgid : vec3, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main1(in : Builtins1) { let groups_x = in.num_wgs.x; let groups_y = in.num_wgs.y; let groups_z = in.num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main2(in : Builtins2) { let groups_x = in.num_wgs.x; let groups_y = in.num_wgs.y; let groups_z = in.num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main3(@builtin(num_workgroups) num_wgs : vec3) { let groups_x = num_wgs.x; let groups_y = num_wgs.y; @@ -351,7 +351,7 @@ fn main1_inner(in : Builtins1) { let groups_z = in.num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main1() { main1_inner(Builtins1(tint_symbol_7.num_workgroups)); } @@ -369,7 +369,7 @@ fn main2_inner(in : Builtins2) { let groups_z = in.num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main2(tint_symbol_2 : tint_symbol_3) { main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid)); } @@ -380,7 +380,7 @@ fn main3_inner(num_wgs : vec3) { let groups_z = num_wgs.z; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main3() { main3_inner(tint_symbol_7.num_workgroups); } @@ -400,7 +400,7 @@ struct Builtins { @builtin(workgroup_id) wgid : vec3, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(in : Builtins) { } )"; @@ -421,7 +421,7 @@ struct tint_symbol_1 { fn main_inner(in : Builtins) { } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(tint_symbol : tint_symbol_1) { main_inner(Builtins(tint_symbol.gid, tint_symbol.wgid)); } @@ -434,5 +434,261 @@ fn main(tint_symbol : tint_symbol_1) { EXPECT_EQ(expect, str(got)); } +// Test that group 0 binding 0 is used if no bound resource in the program and binding point is not +// specified in NumWorkgroupsFromUniform::Config. +TEST_F(NumWorkgroupsFromUniformTest, UnspecifiedBindingPoint_NoResourceBound) { + auto* src = R"( +struct Builtins1 { + @builtin(num_workgroups) num_wgs : vec3, +}; + +struct Builtins2 { + @builtin(global_invocation_id) gid : vec3, + @builtin(num_workgroups) num_wgs : vec3, + @builtin(workgroup_id) wgid : vec3, +}; + +@compute @workgroup_size(1) +fn main1(in : Builtins1) { + let groups_x = in.num_wgs.x; + let groups_y = in.num_wgs.y; + let groups_z = in.num_wgs.z; +} + +@compute @workgroup_size(1) +fn main2(in : Builtins2) { + let groups_x = in.num_wgs.x; + let groups_y = in.num_wgs.y; + let groups_z = in.num_wgs.z; +} + +@compute @workgroup_size(1) +fn main3(@builtin(num_workgroups) num_wgs : vec3) { + let groups_x = num_wgs.x; + let groups_y = num_wgs.y; + let groups_z = num_wgs.z; +} +)"; + + auto* expect = R"( +struct tint_symbol_6 { + num_workgroups : vec3, +} + +@group(0) @binding(0) var tint_symbol_7 : tint_symbol_6; + +struct Builtins1 { + num_wgs : vec3, +} + +struct Builtins2 { + gid : vec3, + num_wgs : vec3, + wgid : vec3, +} + +fn main1_inner(in : Builtins1) { + let groups_x = in.num_wgs.x; + let groups_y = in.num_wgs.y; + let groups_z = in.num_wgs.z; +} + +@compute @workgroup_size(1) +fn main1() { + main1_inner(Builtins1(tint_symbol_7.num_workgroups)); +} + +struct tint_symbol_3 { + @builtin(global_invocation_id) + gid : vec3, + @builtin(workgroup_id) + wgid : vec3, +} + +fn main2_inner(in : Builtins2) { + let groups_x = in.num_wgs.x; + let groups_y = in.num_wgs.y; + let groups_z = in.num_wgs.z; +} + +@compute @workgroup_size(1) +fn main2(tint_symbol_2 : tint_symbol_3) { + main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid)); +} + +fn main3_inner(num_wgs : vec3) { + let groups_x = num_wgs.x; + let groups_y = num_wgs.y; + let groups_z = num_wgs.z; +} + +@compute @workgroup_size(1) +fn main3() { + main3_inner(tint_symbol_7.num_workgroups); +} +)"; + + DataMap data; + data.Add(CanonicalizeEntryPointIO::ShaderStyle::kHlsl); + // Make binding point unspecified. + data.Add(std::nullopt); + auto got = Run(src, data); + EXPECT_EQ(expect, str(got)); +} + +// Test that binding 0 of the largest used group plus 1 is used if at least one resource is bound in +// the program and binding point is not specified in NumWorkgroupsFromUniform::Config. +TEST_F(NumWorkgroupsFromUniformTest, UnspecifiedBindingPoint_MultipleResourceBound) { + auto* src = R"( +struct Builtins1 { + @builtin(num_workgroups) num_wgs : vec3, +}; + +struct Builtins2 { + @builtin(global_invocation_id) gid : vec3, + @builtin(num_workgroups) num_wgs : vec3, + @builtin(workgroup_id) wgid : vec3, +}; + +struct S0 { + @size(4) + m0 : u32, + m1 : array, +}; + +struct S1 { + @size(4) + m0 : u32, + m1 : array, +}; + +@group(0) @binding(0) var g2 : texture_2d; +@group(1) @binding(0) var g3 : texture_depth_2d; +@group(1) @binding(1) var g4 : texture_storage_2d; +@group(3) @binding(0) var g5 : texture_depth_cube_array; +@group(4) @binding(0) var g6 : texture_external; + +@group(0) @binding(1) var g8 : S0; +@group(1) @binding(3) var g9 : S0; +@group(3) @binding(2) var g10 : S0; + +@compute @workgroup_size(1) +fn main1(in : Builtins1) { + let groups_x = in.num_wgs.x; + let groups_y = in.num_wgs.y; + let groups_z = in.num_wgs.z; + g8.m0 = 1u; +} + +@compute @workgroup_size(1) +fn main2(in : Builtins2) { + let groups_x = in.num_wgs.x; + let groups_y = in.num_wgs.y; + let groups_z = in.num_wgs.z; +} + +@compute @workgroup_size(1) +fn main3(@builtin(num_workgroups) num_wgs : vec3) { + let groups_x = num_wgs.x; + let groups_y = num_wgs.y; + let groups_z = num_wgs.z; +} +)"; + + auto* expect = R"( +struct tint_symbol_6 { + num_workgroups : vec3, +} + +@group(5) @binding(0) var tint_symbol_7 : tint_symbol_6; + +struct Builtins1 { + num_wgs : vec3, +} + +struct Builtins2 { + gid : vec3, + num_wgs : vec3, + wgid : vec3, +} + +struct S0 { + @size(4) + m0 : u32, + m1 : array, +} + +struct S1 { + @size(4) + m0 : u32, + m1 : array, +} + +@group(0) @binding(0) var g2 : texture_2d; + +@group(1) @binding(0) var g3 : texture_depth_2d; + +@group(1) @binding(1) var g4 : texture_storage_2d; + +@group(3) @binding(0) var g5 : texture_depth_cube_array; + +@group(4) @binding(0) var g6 : texture_external; + +@group(0) @binding(1) var g8 : S0; + +@group(1) @binding(3) var g9 : S0; + +@group(3) @binding(2) var g10 : S0; + +fn main1_inner(in : Builtins1) { + let groups_x = in.num_wgs.x; + let groups_y = in.num_wgs.y; + let groups_z = in.num_wgs.z; + g8.m0 = 1u; +} + +@compute @workgroup_size(1) +fn main1() { + main1_inner(Builtins1(tint_symbol_7.num_workgroups)); +} + +struct tint_symbol_3 { + @builtin(global_invocation_id) + gid : vec3, + @builtin(workgroup_id) + wgid : vec3, +} + +fn main2_inner(in : Builtins2) { + let groups_x = in.num_wgs.x; + let groups_y = in.num_wgs.y; + let groups_z = in.num_wgs.z; +} + +@compute @workgroup_size(1) +fn main2(tint_symbol_2 : tint_symbol_3) { + main2_inner(Builtins2(tint_symbol_2.gid, tint_symbol_7.num_workgroups, tint_symbol_2.wgid)); +} + +fn main3_inner(num_wgs : vec3) { + let groups_x = num_wgs.x; + let groups_y = num_wgs.y; + let groups_z = num_wgs.z; +} + +@compute @workgroup_size(1) +fn main3() { + main3_inner(tint_symbol_7.num_workgroups); +} +)"; + + DataMap data; + data.Add(CanonicalizeEntryPointIO::ShaderStyle::kHlsl); + // Make binding point unspecified. + data.Add(std::nullopt); + auto got = Run(src, data); + EXPECT_EQ(expect, str(got)); +} + } // namespace } // namespace tint::transform diff --git a/src/tint/transform/promote_initializers_to_const_var.cc b/src/tint/transform/promote_initializers_to_const_var.cc deleted file mode 100644 index 81b5603373..0000000000 --- a/src/tint/transform/promote_initializers_to_const_var.cc +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/transform/promote_initializers_to_const_var.h" -#include "src/tint/program_builder.h" -#include "src/tint/sem/call.h" -#include "src/tint/sem/statement.h" -#include "src/tint/sem/type_constructor.h" -#include "src/tint/transform/utils/hoist_to_decl_before.h" - -TINT_INSTANTIATE_TYPEINFO(tint::transform::PromoteInitializersToConstVar); - -namespace tint::transform { - -PromoteInitializersToConstVar::PromoteInitializersToConstVar() = default; - -PromoteInitializersToConstVar::~PromoteInitializersToConstVar() = default; - -void PromoteInitializersToConstVar::Run(CloneContext& ctx, const DataMap&, DataMap&) const { - HoistToDeclBefore hoist_to_decl_before(ctx); - - // Hoists array and structure initializers to a constant variable, declared - // just before the statement of usage. - auto type_ctor_to_let = [&](const ast::CallExpression* expr) { - auto* ctor = ctx.src->Sem().Get(expr); - if (!ctor->Target()->Is()) { - return true; - } - auto* sem_stmt = ctor->Stmt(); - if (!sem_stmt) { - // Expression is outside of a statement. This usually means the - // expression is part of a global (module-scope) constant declaration. - // These must be constexpr, and so cannot contain the type of - // expressions that must be sanitized. - return true; - } - - auto* stmt = sem_stmt->Declaration(); - - if (auto* src_var_decl = stmt->As()) { - if (src_var_decl->variable->constructor == expr) { - // This statement is just a variable declaration with the - // initializer as the constructor value. This is what we're - // attempting to transform to, and so ignore. - return true; - } - } - - auto* src_ty = ctor->Type(); - if (!src_ty->IsAnyOf()) { - // We only care about array and struct initializers - return true; - } - - return hoist_to_decl_before.Add(ctor, expr, true); - }; - - for (auto* node : ctx.src->ASTNodes().Objects()) { - if (auto* call_expr = node->As()) { - if (!type_ctor_to_let(call_expr)) { - return; - } - } - } - - hoist_to_decl_before.Apply(); - ctx.Clone(); -} - -} // namespace tint::transform diff --git a/src/tint/transform/promote_initializers_to_const_var.h b/src/tint/transform/promote_initializers_to_const_var.h deleted file mode 100644 index 67a32c48b8..0000000000 --- a/src/tint/transform/promote_initializers_to_const_var.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2022 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_TINT_TRANSFORM_PROMOTE_INITIALIZERS_TO_CONST_VAR_H_ -#define SRC_TINT_TRANSFORM_PROMOTE_INITIALIZERS_TO_CONST_VAR_H_ - -#include "src/tint/transform/transform.h" - -namespace tint::transform { - -/// A transform that hoists the array and structure initializers to a constant -/// variable, declared just before the statement of usage. -/// @see crbug.com/tint/406 -class PromoteInitializersToConstVar : public Castable { - public: - /// Constructor - PromoteInitializersToConstVar(); - - /// Destructor - ~PromoteInitializersToConstVar() override; - - protected: - /// Runs the transform using the CloneContext built for transforming a - /// program. Run() is responsible for calling Clone() on the CloneContext. - /// @param ctx the CloneContext primed with the input program and - /// ProgramBuilder - /// @param inputs optional extra transform-specific input data - /// @param outputs optional extra transform-specific output data - void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; -}; - -} // namespace tint::transform - -#endif // SRC_TINT_TRANSFORM_PROMOTE_INITIALIZERS_TO_CONST_VAR_H_ diff --git a/src/tint/transform/promote_initializers_to_const_var_test.cc b/src/tint/transform/promote_initializers_to_const_var_test.cc deleted file mode 100644 index f322478ce0..0000000000 --- a/src/tint/transform/promote_initializers_to_const_var_test.cc +++ /dev/null @@ -1,625 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/transform/promote_initializers_to_const_var.h" - -#include "src/tint/transform/test_helper.h" - -namespace tint::transform { -namespace { - -using PromoteInitializersToConstVarTest = TransformTest; - -TEST_F(PromoteInitializersToConstVarTest, EmptyModule) { - auto* src = ""; - auto* expect = ""; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, BasicArray) { - auto* src = R"( -fn f() { - var f0 = 1.0; - var f1 = 2.0; - var f2 = 3.0; - var f3 = 4.0; - var i = array(f0, f1, f2, f3)[2]; -} -)"; - - auto* expect = R"( -fn f() { - var f0 = 1.0; - var f1 = 2.0; - var f2 = 3.0; - var f3 = 4.0; - let tint_symbol = array(f0, f1, f2, f3); - var i = tint_symbol[2]; -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, BasicStruct) { - auto* src = R"( -struct S { - a : i32, - b : f32, - c : vec3, -}; - -fn f() { - var x = S(1, 2.0, vec3()).b; -} -)"; - - auto* expect = R"( -struct S { - a : i32, - b : f32, - c : vec3, -} - -fn f() { - let tint_symbol = S(1, 2.0, vec3()); - var x = tint_symbol.b; -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, BasicStruct_OutOfOrder) { - auto* src = R"( -fn f() { - var x = S(1, 2.0, vec3()).b; -} - -struct S { - a : i32, - b : f32, - c : vec3, -}; -)"; - - auto* expect = R"( -fn f() { - let tint_symbol = S(1, 2.0, vec3()); - var x = tint_symbol.b; -} - -struct S { - a : i32, - b : f32, - c : vec3, -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, ArrayInForLoopInit) { - auto* src = R"( -fn f() { - var insert_after = 1; - for(var i = array(0.0, 1.0, 2.0, 3.0)[2]; ; ) { - break; - } -} -)"; - - auto* expect = R"( -fn f() { - var insert_after = 1; - let tint_symbol = array(0.0, 1.0, 2.0, 3.0); - for(var i = tint_symbol[2]; ; ) { - break; - } -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, StructInForLoopInit) { - auto* src = R"( -struct S { - a : i32, - b : f32, - c : vec3, -}; - -fn f() { - var insert_after = 1; - for(var x = S(1, 2.0, vec3()).b; ; ) { - break; - } -} -)"; - - auto* expect = R"( -struct S { - a : i32, - b : f32, - c : vec3, -} - -fn f() { - var insert_after = 1; - let tint_symbol = S(1, 2.0, vec3()); - for(var x = tint_symbol.b; ; ) { - break; - } -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, StructInForLoopInit_OutOfOrder) { - auto* src = R"( -fn f() { - var insert_after = 1; - for(var x = S(1, 2.0, vec3()).b; ; ) { - break; - } -} - -struct S { - a : i32, - b : f32, - c : vec3, -}; -)"; - - auto* expect = R"( -fn f() { - var insert_after = 1; - let tint_symbol = S(1, 2.0, vec3()); - for(var x = tint_symbol.b; ; ) { - break; - } -} - -struct S { - a : i32, - b : f32, - c : vec3, -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, ArrayInForLoopCond) { - auto* src = R"( -fn f() { - var f = 1.0; - for(; f == array(f)[0]; f = f + 1.0) { - var marker = 1; - } -} -)"; - - auto* expect = R"( -fn f() { - var f = 1.0; - loop { - let tint_symbol = array(f); - if (!((f == tint_symbol[0]))) { - break; - } - { - var marker = 1; - } - - continuing { - f = (f + 1.0); - } - } -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, ArrayInForLoopCont) { - auto* src = R"( -fn f() { - var f = 0.0; - for(; f < 10.0; f = f + array(1.0)[0]) { - var marker = 1; - } -} -)"; - - auto* expect = R"( -fn f() { - var f = 0.0; - loop { - if (!((f < 10.0))) { - break; - } - { - var marker = 1; - } - - continuing { - let tint_symbol = array(1.0); - f = (f + tint_symbol[0]); - } - } -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, ArrayInForLoopInitCondCont) { - auto* src = R"( -fn f() { - for(var f = array(0.0)[0]; - f < array(1.0)[0]; - f = f + array(2.0)[0]) { - var marker = 1; - } -} -)"; - - auto* expect = R"( -fn f() { - let tint_symbol = array(0.0); - { - var f = tint_symbol[0]; - loop { - let tint_symbol_1 = array(1.0); - if (!((f < tint_symbol_1[0]))) { - break; - } - { - var marker = 1; - } - - continuing { - let tint_symbol_2 = array(2.0); - f = (f + tint_symbol_2[0]); - } - } - } -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, ArrayInElseIf) { - auto* src = R"( -fn f() { - var f = 1.0; - if (true) { - var marker = 0; - } else if (f == array(f, f)[0]) { - var marker = 1; - } -} -)"; - - auto* expect = R"( -fn f() { - var f = 1.0; - if (true) { - var marker = 0; - } else { - let tint_symbol = array(f, f); - if ((f == tint_symbol[0])) { - var marker = 1; - } - } -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, ArrayInElseIfChain) { - auto* src = R"( -fn f() { - var f = 1.0; - if (true) { - var marker = 0; - } else if (true) { - var marker = 1; - } else if (f == array(f, f)[0]) { - var marker = 2; - } else if (f == array(f, f)[1]) { - var marker = 3; - } else if (true) { - var marker = 4; - } else { - var marker = 5; - } -} -)"; - - auto* expect = R"( -fn f() { - var f = 1.0; - if (true) { - var marker = 0; - } else if (true) { - var marker = 1; - } else { - let tint_symbol = array(f, f); - if ((f == tint_symbol[0])) { - var marker = 2; - } else { - let tint_symbol_1 = array(f, f); - if ((f == tint_symbol_1[1])) { - var marker = 3; - } else if (true) { - var marker = 4; - } else { - var marker = 5; - } - } - } -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, ArrayInArrayArray) { - auto* src = R"( -fn f() { - var i = array, 2u>(array(1.0, 2.0), array(3.0, 4.0))[0][1]; -} -)"; - - auto* expect = R"( -fn f() { - let tint_symbol = array(1.0, 2.0); - let tint_symbol_1 = array(3.0, 4.0); - let tint_symbol_2 = array, 2u>(tint_symbol, tint_symbol_1); - var i = tint_symbol_2[0][1]; -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, StructNested) { - auto* src = R"( -struct S1 { - a : i32, -}; - -struct S2 { - a : i32, - b : S1, - c : i32, -}; - -struct S3 { - a : S2, -}; - -fn f() { - var x = S3(S2(1, S1(2), 3)).a.b.a; -} -)"; - - auto* expect = R"( -struct S1 { - a : i32, -} - -struct S2 { - a : i32, - b : S1, - c : i32, -} - -struct S3 { - a : S2, -} - -fn f() { - let tint_symbol = S1(2); - let tint_symbol_1 = S2(1, tint_symbol, 3); - let tint_symbol_2 = S3(tint_symbol_1); - var x = tint_symbol_2.a.b.a; -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, Mixed) { - auto* src = R"( -struct S1 { - a : i32, -}; - -struct S2 { - a : array, -}; - -fn f() { - var x = S2(array(S1(1), S1(2), S1(3))).a[1].a; -} -)"; - - auto* expect = R"( -struct S1 { - a : i32, -} - -struct S2 { - a : array, -} - -fn f() { - let tint_symbol = S1(1); - let tint_symbol_1 = S1(2); - let tint_symbol_2 = S1(3); - let tint_symbol_3 = array(tint_symbol, tint_symbol_1, tint_symbol_2); - let tint_symbol_4 = S2(tint_symbol_3); - var x = tint_symbol_4.a[1].a; -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, Mixed_OutOfOrder) { - auto* src = R"( -fn f() { - var x = S2(array(S1(1), S1(2), S1(3))).a[1].a; -} - -struct S2 { - a : array, -}; - -struct S1 { - a : i32, -}; -)"; - - auto* expect = R"( -fn f() { - let tint_symbol = S1(1); - let tint_symbol_1 = S1(2); - let tint_symbol_2 = S1(3); - let tint_symbol_3 = array(tint_symbol, tint_symbol_1, tint_symbol_2); - let tint_symbol_4 = S2(tint_symbol_3); - var x = tint_symbol_4.a[1].a; -} - -struct S2 { - a : array, -} - -struct S1 { - a : i32, -} -)"; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, NoChangeOnVarDecl) { - auto* src = R"( -struct S { - a : i32, - b : f32, - c : i32, -} - -fn f() { - var local_arr = array(0.0, 1.0, 2.0, 3.0); - var local_str = S(1, 2.0, 3); -} - -let module_arr : array = array(0.0, 1.0, 2.0, 3.0); - -let module_str : S = S(1, 2.0, 3); -)"; - - auto* expect = src; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(PromoteInitializersToConstVarTest, NoChangeOnVarDecl_OutOfOrder) { - auto* src = R"( -fn f() { - var local_arr = array(0.0, 1.0, 2.0, 3.0); - var local_str = S(1, 2.0, 3); -} - -let module_str : S = S(1, 2.0, 3); - -struct S { - a : i32, - b : f32, - c : i32, -} - -let module_arr : array = array(0.0, 1.0, 2.0, 3.0); -)"; - - auto* expect = src; - - DataMap data; - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -} // namespace -} // namespace tint::transform diff --git a/src/tint/transform/promote_initializers_to_let.cc b/src/tint/transform/promote_initializers_to_let.cc new file mode 100644 index 0000000000..ec7ba9523b --- /dev/null +++ b/src/tint/transform/promote_initializers_to_let.cc @@ -0,0 +1,109 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/promote_initializers_to_let.h" +#include "src/tint/program_builder.h" +#include "src/tint/sem/call.h" +#include "src/tint/sem/statement.h" +#include "src/tint/sem/type_constructor.h" +#include "src/tint/transform/utils/hoist_to_decl_before.h" + +TINT_INSTANTIATE_TYPEINFO(tint::transform::PromoteInitializersToLet); + +namespace tint::transform { + +PromoteInitializersToLet::PromoteInitializersToLet() = default; + +PromoteInitializersToLet::~PromoteInitializersToLet() = default; + +void PromoteInitializersToLet::Run(CloneContext& ctx, const DataMap&, DataMap&) const { + HoistToDeclBefore hoist_to_decl_before(ctx); + + // Hoists array and structure initializers to a constant variable, declared + // just before the statement of usage. + auto promote = [&](const sem::Expression* expr) { + auto* sem_stmt = expr->Stmt(); + if (!sem_stmt) { + // Expression is outside of a statement. This usually means the + // expression is part of a global (module-scope) constant declaration. + // These must be constexpr, and so cannot contain the type of + // expressions that must be sanitized. + return true; + } + + auto* stmt = sem_stmt->Declaration(); + + if (auto* src_var_decl = stmt->As()) { + if (src_var_decl->variable->constructor == expr->Declaration()) { + // This statement is just a variable declaration with the + // initializer as the constructor value. This is what we're + // attempting to transform to, and so ignore. + return true; + } + } + + auto* src_ty = expr->Type(); + if (!src_ty->IsAnyOf()) { + // We only care about array and struct initializers + return true; + } + + return hoist_to_decl_before.Add(expr, expr->Declaration(), true); + }; + + for (auto* node : ctx.src->ASTNodes().Objects()) { + bool ok = Switch( + node, // + [&](const ast::CallExpression* expr) { + if (auto* sem = ctx.src->Sem().Get(expr)) { + auto* ctor = sem->UnwrapMaterialize()->As(); + if (ctor->Target()->Is()) { + return promote(sem); + } + } + return true; + }, + [&](const ast::IdentifierExpression* expr) { + if (auto* sem = ctx.src->Sem().Get(expr)) { + if (auto* user = sem->UnwrapMaterialize()->As()) { + // Identifier resolves to a variable + if (auto* stmt = user->Stmt()) { + if (auto* decl = stmt->Declaration()->As(); + decl && decl->variable->Is()) { + // The identifier is used on the RHS of a 'const' declaration. + // Ignore. + return true; + } + } + if (user->Variable()->Declaration()->Is()) { + // The identifier resolves to a 'const' variable, but isn't used to + // initialize another 'const'. This needs promoting. + return promote(user); + } + } + } + return true; + }, + [&](Default) { return true; }); + + if (!ok) { + return; + } + } + + hoist_to_decl_before.Apply(); + ctx.Clone(); +} + +} // namespace tint::transform diff --git a/src/tint/transform/promote_initializers_to_let.h b/src/tint/transform/promote_initializers_to_let.h new file mode 100644 index 0000000000..226c7d8382 --- /dev/null +++ b/src/tint/transform/promote_initializers_to_let.h @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_TRANSFORM_PROMOTE_INITIALIZERS_TO_LET_H_ +#define SRC_TINT_TRANSFORM_PROMOTE_INITIALIZERS_TO_LET_H_ + +#include "src/tint/transform/transform.h" + +namespace tint::transform { + +/// A transform that hoists array and structure constructors, and identifiers resolving to a +/// 'const' array to a 'let' variable, declared just before the statement of usage. +/// This transform is used by backends that do not support expressions that operate on an immediate +/// array or structure. For example, the following is not immediately expressable for HLSL: +/// `array(1, 2)[0]` +/// @see crbug.com/tint/406 +class PromoteInitializersToLet final : public Castable { + public: + /// Constructor + PromoteInitializersToLet(); + + /// Destructor + ~PromoteInitializersToLet() override; + + protected: + /// Runs the transform using the CloneContext built for transforming a + /// program. Run() is responsible for calling Clone() on the CloneContext. + /// @param ctx the CloneContext primed with the input program and + /// ProgramBuilder + /// @param inputs optional extra transform-specific input data + /// @param outputs optional extra transform-specific output data + void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; +}; + +} // namespace tint::transform + +#endif // SRC_TINT_TRANSFORM_PROMOTE_INITIALIZERS_TO_LET_H_ diff --git a/src/tint/transform/promote_initializers_to_let_test.cc b/src/tint/transform/promote_initializers_to_let_test.cc new file mode 100644 index 0000000000..536d04a29e --- /dev/null +++ b/src/tint/transform/promote_initializers_to_let_test.cc @@ -0,0 +1,1256 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/promote_initializers_to_let.h" + +#include "src/tint/transform/test_helper.h" + +namespace tint::transform { +namespace { + +using PromoteInitializersToLetTest = TransformTest; + +TEST_F(PromoteInitializersToLetTest, EmptyModule) { + auto* src = ""; + auto* expect = ""; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, BasicArray) { + auto* src = R"( +fn f() { + var f0 = 1.0; + var f1 = 2.0; + var f2 = 3.0; + var f3 = 4.0; + var i = array(f0, f1, f2, f3)[2]; +} +)"; + + auto* expect = R"( +fn f() { + var f0 = 1.0; + var f1 = 2.0; + var f2 = 3.0; + var f3 = 4.0; + let tint_symbol = array(f0, f1, f2, f3); + var i = tint_symbol[2]; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, BasicStruct) { + auto* src = R"( +struct S { + a : i32, + b : f32, + c : vec3, +}; + +fn f() { + var x = S(1, 2.0, vec3()).b; +} +)"; + + auto* expect = R"( +struct S { + a : i32, + b : f32, + c : vec3, +} + +fn f() { + let tint_symbol = S(1, 2.0, vec3()); + var x = tint_symbol.b; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, BasicStruct_OutOfOrder) { + auto* src = R"( +fn f() { + var x = S(1, 2.0, vec3()).b; +} + +struct S { + a : i32, + b : f32, + c : vec3, +}; +)"; + + auto* expect = R"( +fn f() { + let tint_symbol = S(1, 2.0, vec3()); + var x = tint_symbol.b; +} + +struct S { + a : i32, + b : f32, + c : vec3, +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, GlobalConstBasicArray) { + auto* src = R"( +const f0 = 1.0; + +const f1 = 2.0; + +const C = array(f0, f1); + +fn f() { + var f0 = 100.0; + var f1 = 100.0; + var i = C[1]; +} +)"; + + auto* expect = R"( +const f0 = 1.0; + +const f1 = 2.0; + +const C = array(f0, f1); + +fn f() { + var f0 = 100.0; + var f1 = 100.0; + let tint_symbol = C; + var i = tint_symbol[1]; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, GlobalConstArrayDynamicIndex) { + auto* src = R"( +const TRI_VERTICES = array( + vec4(0., 0., 0., 1.), + vec4(0., 1., 0., 1.), + vec4(1., 1., 0., 1.), +); + +@vertex +fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4 { + // note: TRI_VERTICES requires a materialize before the dynamic index. + return TRI_VERTICES[in_vertex_index]; +} +)"; + + auto* expect = R"( +const TRI_VERTICES = array(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0)); + +@vertex +fn vs_main(@builtin(vertex_index) in_vertex_index : u32) -> @builtin(position) vec4 { + let tint_symbol = TRI_VERTICES; + return tint_symbol[in_vertex_index]; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, GlobalConstBasicArray_OutOfOrder) { + auto* src = R"( +fn f() { + var f0 = 100.0; + var f1 = 100.0; + var i = C[1]; +} + +const C = array(f0, f1); + +const f0 = 1.0; + +const f1 = 2.0; +)"; + + auto* expect = R"( +fn f() { + var f0 = 100.0; + var f1 = 100.0; + let tint_symbol = C; + var i = tint_symbol[1]; +} + +const C = array(f0, f1); + +const f0 = 1.0; + +const f1 = 2.0; +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, LocalConstBasicArray) { + auto* src = R"( +fn f() { + const f0 = 1.0; + const f1 = 2.0; + const C = array(f0, f1); + var i = C[1]; +} +)"; + + auto* expect = R"( +fn f() { + const f0 = 1.0; + const f1 = 2.0; + const C = array(f0, f1); + let tint_symbol = C; + var i = tint_symbol[1]; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, ArrayInForLoopInit) { + auto* src = R"( +fn f() { + var insert_after = 1; + for(var i = array(0.0, 1.0, 2.0, 3.0)[2]; ; ) { + break; + } +} +)"; + + auto* expect = R"( +fn f() { + var insert_after = 1; + let tint_symbol = array(0.0, 1.0, 2.0, 3.0); + for(var i = tint_symbol[2]; ; ) { + break; + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, LocalConstArrayInForLoopInit) { + auto* src = R"( +fn f() { + const arr = array(0.0, 1.0, 2.0, 3.0); + var insert_after = 1; + for(var i = arr[2]; ; ) { + break; + } +} +)"; + + auto* expect = R"( +fn f() { + const arr = array(0.0, 1.0, 2.0, 3.0); + var insert_after = 1; + let tint_symbol = arr; + for(var i = tint_symbol[2]; ; ) { + break; + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, GlobalConstArrayInForLoopInit) { + auto* src = R"( +const arr = array(0.0, 1.0, 2.0, 3.0); + +fn f() { + var insert_after = 1; + for(var i = arr[2]; ; ) { + break; + } +} +)"; + + auto* expect = R"( +const arr = array(0.0, 1.0, 2.0, 3.0); + +fn f() { + var insert_after = 1; + let tint_symbol = arr; + for(var i = tint_symbol[2]; ; ) { + break; + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, StructInForLoopInit) { + auto* src = R"( +struct S { + a : i32, + b : f32, + c : vec3, +}; + +fn f() { + var insert_after = 1; + for(var x = S(1, 2.0, vec3()).b; ; ) { + break; + } +} +)"; + + auto* expect = R"( +struct S { + a : i32, + b : f32, + c : vec3, +} + +fn f() { + var insert_after = 1; + let tint_symbol = S(1, 2.0, vec3()); + for(var x = tint_symbol.b; ; ) { + break; + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, StructInForLoopInit_OutOfOrder) { + auto* src = R"( +fn f() { + var insert_after = 1; + for(var x = S(1, 2.0, vec3()).b; ; ) { + break; + } +} + +struct S { + a : i32, + b : f32, + c : vec3, +}; +)"; + + auto* expect = R"( +fn f() { + var insert_after = 1; + let tint_symbol = S(1, 2.0, vec3()); + for(var x = tint_symbol.b; ; ) { + break; + } +} + +struct S { + a : i32, + b : f32, + c : vec3, +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, ArrayInForLoopCond) { + auto* src = R"( +fn f() { + var f = 1.0; + for(; f == array(f)[0]; f = f + 1.0) { + var marker = 1; + } +} +)"; + + auto* expect = R"( +fn f() { + var f = 1.0; + loop { + let tint_symbol = array(f); + if (!((f == tint_symbol[0]))) { + break; + } + { + var marker = 1; + } + + continuing { + f = (f + 1.0); + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, LocalConstArrayInForLoopCond) { + auto* src = R"( +fn f() { + const f = 1.0; + const arr = array(f); + for(var i = f; i == arr[0]; i = i + 1.0) { + var marker = 1; + } +} +)"; + + auto* expect = R"( +fn f() { + const f = 1.0; + const arr = array(f); + { + var i = f; + loop { + let tint_symbol = arr; + if (!((i == tint_symbol[0]))) { + break; + } + { + var marker = 1; + } + + continuing { + i = (i + 1.0); + } + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, GlobalConstArrayInForLoopCond) { + auto* src = R"( +const f = 1.0; + +const arr = array(f); + +fn F() { + for(var i = f; i == arr[0]; i = i + 1.0) { + var marker = 1; + } +} +)"; + + auto* expect = R"( +const f = 1.0; + +const arr = array(f); + +fn F() { + { + var i = f; + loop { + let tint_symbol = arr; + if (!((i == tint_symbol[0]))) { + break; + } + { + var marker = 1; + } + + continuing { + i = (i + 1.0); + } + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, ArrayInForLoopCont) { + auto* src = R"( +fn f() { + var f = 0.0; + for(; f < 10.0; f = f + array(1.0)[0]) { + var marker = 1; + } +} +)"; + + auto* expect = R"( +fn f() { + var f = 0.0; + loop { + if (!((f < 10.0))) { + break; + } + { + var marker = 1; + } + + continuing { + let tint_symbol = array(1.0); + f = (f + tint_symbol[0]); + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, LocalConstArrayInForLoopCont) { + auto* src = R"( +fn f() { + const arr = array(1.0); + var f = 0.0; + for(; f < 10.0; f = f + arr[0]) { + var marker = 1; + } +} +)"; + + auto* expect = R"( +fn f() { + const arr = array(1.0); + var f = 0.0; + loop { + if (!((f < 10.0))) { + break; + } + { + var marker = 1; + } + + continuing { + let tint_symbol = arr; + f = (f + tint_symbol[0]); + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, GlobalConstArrayInForLoopCont) { + auto* src = R"( +const arr = array(1.0); + +fn f() { + var f = 0.0; + for(; f < 10.0; f = f + arr[0]) { + var marker = 1; + } +} +)"; + + auto* expect = R"( +const arr = array(1.0); + +fn f() { + var f = 0.0; + loop { + if (!((f < 10.0))) { + break; + } + { + var marker = 1; + } + + continuing { + let tint_symbol = arr; + f = (f + tint_symbol[0]); + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, ArrayInForLoopInitCondCont) { + auto* src = R"( +fn f() { + for(var f = array(0.0)[0]; + f < array(1.0)[0]; + f = f + array(2.0)[0]) { + var marker = 1; + } +} +)"; + + auto* expect = R"( +fn f() { + let tint_symbol = array(0.0); + { + var f = tint_symbol[0]; + loop { + let tint_symbol_1 = array(1.0); + if (!((f < tint_symbol_1[0]))) { + break; + } + { + var marker = 1; + } + + continuing { + let tint_symbol_2 = array(2.0); + f = (f + tint_symbol_2[0]); + } + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, LocalConstArrayInForLoopInitCondCont) { + auto* src = R"( +fn f() { + const arr_a = array(0.0); + const arr_b = array(1.0); + const arr_c = array(2.0); + for(var f = arr_a[0]; f < arr_b[0]; f = f + arr_c[0]) { + var marker = 1; + } +} +)"; + + auto* expect = R"( +fn f() { + const arr_a = array(0.0); + const arr_b = array(1.0); + const arr_c = array(2.0); + let tint_symbol = arr_a; + { + var f = tint_symbol[0]; + loop { + let tint_symbol_1 = arr_b; + if (!((f < tint_symbol_1[0]))) { + break; + } + { + var marker = 1; + } + + continuing { + let tint_symbol_2 = arr_c; + f = (f + tint_symbol_2[0]); + } + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, ArrayInElseIf) { + auto* src = R"( +fn f() { + var f = 1.0; + if (true) { + var marker = 0; + } else if (f == array(f, f)[0]) { + var marker = 1; + } +} +)"; + + auto* expect = R"( +fn f() { + var f = 1.0; + if (true) { + var marker = 0; + } else { + let tint_symbol = array(f, f); + if ((f == tint_symbol[0])) { + var marker = 1; + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, ArrayInElseIfChain) { + auto* src = R"( +fn f() { + var f = 1.0; + if (true) { + var marker = 0; + } else if (true) { + var marker = 1; + } else if (f == array(f, f)[0]) { + var marker = 2; + } else if (f == array(f, f)[1]) { + var marker = 3; + } else if (true) { + var marker = 4; + } else { + var marker = 5; + } +} +)"; + + auto* expect = R"( +fn f() { + var f = 1.0; + if (true) { + var marker = 0; + } else if (true) { + var marker = 1; + } else { + let tint_symbol = array(f, f); + if ((f == tint_symbol[0])) { + var marker = 2; + } else { + let tint_symbol_1 = array(f, f); + if ((f == tint_symbol_1[1])) { + var marker = 3; + } else if (true) { + var marker = 4; + } else { + var marker = 5; + } + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, LocalConstArrayInElseIfChain) { + auto* src = R"( +fn f() { + const f = 1.0; + const arr = array(f, f); + if (true) { + var marker = 0; + } else if (true) { + var marker = 1; + } else if (f == arr[0]) { + var marker = 2; + } else if (f == arr[1]) { + var marker = 3; + } else if (true) { + var marker = 4; + } else { + var marker = 5; + } +} +)"; + + auto* expect = R"( +fn f() { + const f = 1.0; + const arr = array(f, f); + if (true) { + var marker = 0; + } else if (true) { + var marker = 1; + } else { + let tint_symbol = arr; + if ((f == tint_symbol[0])) { + var marker = 2; + } else { + let tint_symbol_1 = arr; + if ((f == tint_symbol_1[1])) { + var marker = 3; + } else if (true) { + var marker = 4; + } else { + var marker = 5; + } + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, GlobalConstArrayInElseIfChain) { + auto* src = R"( +const f = 1.0; + +const arr = array(f, f); + +fn F() { + if (true) { + var marker = 0; + } else if (true) { + var marker = 1; + } else if (f == arr[0]) { + var marker = 2; + } else if (f == arr[1]) { + var marker = 3; + } else if (true) { + var marker = 4; + } else { + var marker = 5; + } +} +)"; + + auto* expect = R"( +const f = 1.0; + +const arr = array(f, f); + +fn F() { + if (true) { + var marker = 0; + } else if (true) { + var marker = 1; + } else { + let tint_symbol = arr; + if ((f == tint_symbol[0])) { + var marker = 2; + } else { + let tint_symbol_1 = arr; + if ((f == tint_symbol_1[1])) { + var marker = 3; + } else if (true) { + var marker = 4; + } else { + var marker = 5; + } + } + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, ArrayInArrayArray) { + auto* src = R"( +fn f() { + var i = array, 2u>(array(1.0, 2.0), array(3.0, 4.0))[0][1]; +} +)"; + + auto* expect = R"( +fn f() { + let tint_symbol = array(1.0, 2.0); + let tint_symbol_1 = array(3.0, 4.0); + let tint_symbol_2 = array, 2u>(tint_symbol, tint_symbol_1); + var i = tint_symbol_2[0][1]; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, LocalConstArrayInArrayArray) { + auto* src = R"( +fn f() { + const arr_0 = array(1.0, 2.0); + const arr_1 = array(3.0, 4.0); + const arr_2 = array, 2u>(arr_0, arr_1); + var i = arr_2[0][1]; +} +)"; + + auto* expect = R"( +fn f() { + const arr_0 = array(1.0, 2.0); + const arr_1 = array(3.0, 4.0); + const arr_2 = array, 2u>(arr_0, arr_1); + let tint_symbol = arr_2; + var i = tint_symbol[0][1]; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, GlobalConstArrayInArrayArray) { + auto* src = R"( +const arr_0 = array(1.0, 2.0); + +const arr_1 = array(3.0, 4.0); + +const arr_2 = array, 2u>(arr_0, arr_1); + +fn f() { + var i = arr_2[0][1]; +} +)"; + + auto* expect = R"( +const arr_0 = array(1.0, 2.0); + +const arr_1 = array(3.0, 4.0); + +const arr_2 = array, 2u>(arr_0, arr_1); + +fn f() { + let tint_symbol = arr_2; + var i = tint_symbol[0][1]; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, StructNested) { + auto* src = R"( +struct S1 { + a : i32, +}; + +struct S2 { + a : i32, + b : S1, + c : i32, +}; + +struct S3 { + a : S2, +}; + +fn f() { + var x = S3(S2(1, S1(2), 3)).a.b.a; +} +)"; + + auto* expect = R"( +struct S1 { + a : i32, +} + +struct S2 { + a : i32, + b : S1, + c : i32, +} + +struct S3 { + a : S2, +} + +fn f() { + let tint_symbol = S1(2); + let tint_symbol_1 = S2(1, tint_symbol, 3); + let tint_symbol_2 = S3(tint_symbol_1); + var x = tint_symbol_2.a.b.a; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, Mixed) { + auto* src = R"( +struct S1 { + a : i32, +}; + +struct S2 { + a : array, +}; + +fn f() { + var x = S2(array(S1(1), S1(2), S1(3))).a[1].a; +} +)"; + + auto* expect = R"( +struct S1 { + a : i32, +} + +struct S2 { + a : array, +} + +fn f() { + let tint_symbol = S1(1); + let tint_symbol_1 = S1(2); + let tint_symbol_2 = S1(3); + let tint_symbol_3 = array(tint_symbol, tint_symbol_1, tint_symbol_2); + let tint_symbol_4 = S2(tint_symbol_3); + var x = tint_symbol_4.a[1].a; +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, Mixed_OutOfOrder) { + auto* src = R"( +fn f() { + var x = S2(array(S1(1), S1(2), S1(3))).a[1].a; +} + +struct S2 { + a : array, +}; + +struct S1 { + a : i32, +}; +)"; + + auto* expect = R"( +fn f() { + let tint_symbol = S1(1); + let tint_symbol_1 = S1(2); + let tint_symbol_2 = S1(3); + let tint_symbol_3 = array(tint_symbol, tint_symbol_1, tint_symbol_2); + let tint_symbol_4 = S2(tint_symbol_3); + var x = tint_symbol_4.a[1].a; +} + +struct S2 { + a : array, +} + +struct S1 { + a : i32, +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, NoChangeOnVarDecl) { + auto* src = R"( +type F = f32; + +fn f() { + var local_arr = array(0.0, 1.0, 2.0, 3.0); + var local_str = F(3.0); +} + +const module_arr : array = array(0.0, 1.0, 2.0, 3.0); + +const module_str : F = F(2.0); +)"; + + auto* expect = src; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, NoChangeOnVarDecl_OutOfOrder) { + auto* src = R"( +fn f() { + var local_arr = array(0.0, 1.0, 2.0, 3.0); + var local_str = F(3.0); +} + +const module_str : F = F(2.0); + +type F = f32; + +const module_arr : array = array(0.0, 1.0, 2.0, 3.0); +)"; + + auto* expect = src; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PromoteInitializersToLetTest, ForLoopShadowing) { + auto* src = R"( +fn X() { + var i = 10; + for(var f = 0; f < 10; f = f + array(i)[0]) { + var i = 20; + } +} + +fn Y() { + var i = 10; + for(var f = 0; f < array(i)[0]; f = f + 1) { + var i = 20; + } +} + +fn Z() { + var i = 10; + for(var f = array(i)[0]; f < 10; f = f + 1) { + var i = 20; + } +} +)"; + + auto* expect = R"( +fn X() { + var i = 10; + { + var f = 0; + loop { + if (!((f < 10))) { + break; + } + { + var i = 20; + } + + continuing { + let tint_symbol = array(i); + f = (f + tint_symbol[0]); + } + } + } +} + +fn Y() { + var i = 10; + { + var f = 0; + loop { + let tint_symbol_1 = array(i); + if (!((f < tint_symbol_1[0]))) { + break; + } + { + var i = 20; + } + + continuing { + f = (f + 1); + } + } + } +} + +fn Z() { + var i = 10; + let tint_symbol_2 = array(i); + for(var f = tint_symbol_2[0]; (f < 10); f = (f + 1)) { + var i = 20; + } +} +)"; + + DataMap data; + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +} // namespace +} // namespace tint::transform diff --git a/src/tint/transform/promote_side_effects_to_decl.cc b/src/tint/transform/promote_side_effects_to_decl.cc index 6f1cc4c797..d1e1cf14a5 100644 --- a/src/tint/transform/promote_side_effects_to_decl.cc +++ b/src/tint/transform/promote_side_effects_to_decl.cc @@ -27,6 +27,7 @@ #include "src/tint/sem/if_statement.h" #include "src/tint/sem/member_accessor_expression.h" #include "src/tint/sem/variable.h" +#include "src/tint/sem/while_statement.h" #include "src/tint/transform/manager.h" #include "src/tint/transform/utils/get_insertion_point.h" #include "src/tint/transform/utils/hoist_to_decl_before.h" @@ -179,11 +180,12 @@ class DecomposeSideEffects::CollectHoistsState : public StateBase { } // Hoists any expressions in `maybe_hoist` and clears it - void Flush(ast::ExpressionList& maybe_hoist) { + template + void Flush(tint::utils::Vector& maybe_hoist) { for (auto* m : maybe_hoist) { Hoist(m); } - maybe_hoist.clear(); + maybe_hoist.Clear(); } // Recursive function that processes expressions for side-effects. It @@ -196,7 +198,9 @@ class DecomposeSideEffects::CollectHoistsState : public StateBase { // * For index and member accessor expressions, special care is taken to not // over-hoist the lhs expressions, as these may be be chained to refer to a // single memory location. - bool ProcessExpression(const ast::Expression* expr, ast::ExpressionList& maybe_hoist) { + template + bool ProcessExpression(const ast::Expression* expr, + tint::utils::Vector& maybe_hoist) { auto process = [&](const ast::Expression* e) -> bool { return ProcessExpression(e, maybe_hoist); }; @@ -204,7 +208,7 @@ class DecomposeSideEffects::CollectHoistsState : public StateBase { auto default_process = [&](const ast::Expression* e) { auto maybe = process(e); if (maybe) { - maybe_hoist.emplace_back(e); + maybe_hoist.Push(e); } if (HasSideEffects(e)) { Flush(maybe_hoist); @@ -239,7 +243,7 @@ class DecomposeSideEffects::CollectHoistsState : public StateBase { // for "v[a][b][c] + g()" we want to hoist all of "v[a][b][c]", not "t1 = // v[a]", then "t2 = t1[b]" then "t3 = t2[c]"). if (maybe && HasSideEffects(lhs)) { - maybe_hoist.emplace_back(lhs); + maybe_hoist.Push(lhs); Flush(maybe_hoist); maybe = false; } @@ -274,7 +278,7 @@ class DecomposeSideEffects::CollectHoistsState : public StateBase { if (auto* sem_e = sem.Get(e)) { if (auto* var_user = sem_e->As()) { // Don't hoist constants. - if (var_user->ConstantValue().IsValid()) { + if (var_user->ConstantValue()) { return false; } // Don't hoist read-only variables as they cannot receive @@ -336,7 +340,7 @@ class DecomposeSideEffects::CollectHoistsState : public StateBase { return; } - ast::ExpressionList maybe_hoist; + tint::utils::Vector maybe_hoist; ProcessExpression(expr, maybe_hoist); } @@ -344,9 +348,9 @@ class DecomposeSideEffects::CollectHoistsState : public StateBase { // evaluate the rhs before the lhs, and possibly hoist the rhs expression. void ProcessAssignment(const ast::Expression* lhs, const ast::Expression* rhs) { // Evaluate rhs before lhs - ast::ExpressionList maybe_hoist; + tint::utils::Vector maybe_hoist; if (ProcessExpression(rhs, maybe_hoist)) { - maybe_hoist.emplace_back(rhs); + maybe_hoist.Push(rhs); } // If the rhs has side-effects, it may affect the lhs, so hoist it right @@ -383,6 +387,7 @@ class DecomposeSideEffects::CollectHoistsState : public StateBase { ProcessStatement(s->expr); }, [&](const ast::ForLoopStatement* s) { ProcessStatement(s->condition); }, + [&](const ast::WhileStatement* s) { ProcessStatement(s->condition); }, [&](const ast::IfStatement* s) { // ProcessStatement(s->condition); }, @@ -412,7 +417,9 @@ class DecomposeSideEffects::DecomposeState : public StateBase { } // Recursive function used to decompose an expression for short-circuit eval. - const ast::Expression* Decompose(const ast::Expression* expr, ast::StatementList* curr_stmts) { + template + const ast::Expression* Decompose(const ast::Expression* expr, + tint::utils::Vector* curr_stmts) { // Helper to avoid passing in same args. auto decompose = [&](auto& e) { return Decompose(e, curr_stmts); }; @@ -420,9 +427,9 @@ class DecomposeSideEffects::DecomposeState : public StateBase { auto clone_maybe_hoisted = [&](const ast::Expression* e) -> const ast::Expression* { if (to_hoist.count(e)) { auto name = b.Symbols().New(); - auto* v = b.Let(name, nullptr, ctx.Clone(e)); + auto* v = b.Let(name, ctx.Clone(e)); auto* decl = b.Decl(v); - curr_stmts->push_back(decl); + curr_stmts->Push(decl); return b.Expr(name); } return ctx.Clone(e); @@ -469,7 +476,7 @@ class DecomposeSideEffects::DecomposeState : public StateBase { // let r = temp; auto name = b.Sym(); - curr_stmts->push_back(b.Decl(b.Var(name, nullptr, decompose(bin_expr->lhs)))); + curr_stmts->Push(b.Decl(b.Var(name, decompose(bin_expr->lhs)))); const ast::Expression* if_cond = nullptr; if (bin_expr->IsLogicalOr()) { @@ -480,14 +487,14 @@ class DecomposeSideEffects::DecomposeState : public StateBase { const ast::BlockStatement* if_body = nullptr; { - ast::StatementList stmts; + tint::utils::Vector stmts; TINT_SCOPED_ASSIGNMENT(curr_stmts, &stmts); auto* new_rhs = decompose(bin_expr->rhs); - curr_stmts->push_back(b.Assign(name, new_rhs)); + curr_stmts->Push(b.Assign(name, new_rhs)); if_body = b.Block(std::move(*curr_stmts)); } - curr_stmts->push_back(b.If(if_cond, if_body)); + curr_stmts->Push(b.If(if_cond, if_body)); return b.Expr(name); }, @@ -535,8 +542,10 @@ class DecomposeSideEffects::DecomposeState : public StateBase { } // Inserts statements in `stmts` before `stmt` - void InsertBefore(const ast::StatementList& stmts, const ast::Statement* stmt) { - if (!stmts.empty()) { + template + void InsertBefore(tint::utils::Vector& stmts, + const ast::Statement* stmt) { + if (!stmts.IsEmpty()) { auto ip = utils::GetInsertionPoint(ctx, stmt); for (auto* s : stmts) { ctx.InsertBefore(ip.first->Declaration()->statements, ip.second, s); @@ -554,7 +563,7 @@ class DecomposeSideEffects::DecomposeState : public StateBase { return nullptr; } // rhs before lhs - ast::StatementList stmts; + tint::utils::Vector stmts; ctx.Replace(s->rhs, Decompose(s->rhs, &stmts)); ctx.Replace(s->lhs, Decompose(s->lhs, &stmts)); InsertBefore(stmts, s); @@ -564,7 +573,7 @@ class DecomposeSideEffects::DecomposeState : public StateBase { if (!sem.Get(s->expr)->HasSideEffects()) { return nullptr; } - ast::StatementList stmts; + tint::utils::Vector stmts; ctx.Replace(s->expr, Decompose(s->expr, &stmts)); InsertBefore(stmts, s); return ctx.CloneWithoutTransform(s); @@ -573,7 +582,16 @@ class DecomposeSideEffects::DecomposeState : public StateBase { if (!s->condition || !sem.Get(s->condition)->HasSideEffects()) { return nullptr; } - ast::StatementList stmts; + tint::utils::Vector stmts; + ctx.Replace(s->condition, Decompose(s->condition, &stmts)); + InsertBefore(stmts, s); + return ctx.CloneWithoutTransform(s); + }, + [&](const ast::WhileStatement* s) -> const ast::Statement* { + if (!sem.Get(s->condition)->HasSideEffects()) { + return nullptr; + } + tint::utils::Vector stmts; ctx.Replace(s->condition, Decompose(s->condition, &stmts)); InsertBefore(stmts, s); return ctx.CloneWithoutTransform(s); @@ -582,7 +600,7 @@ class DecomposeSideEffects::DecomposeState : public StateBase { if (!sem.Get(s->condition)->HasSideEffects()) { return nullptr; } - ast::StatementList stmts; + tint::utils::Vector stmts; ctx.Replace(s->condition, Decompose(s->condition, &stmts)); InsertBefore(stmts, s); return ctx.CloneWithoutTransform(s); @@ -591,7 +609,7 @@ class DecomposeSideEffects::DecomposeState : public StateBase { if (!s->value || !sem.Get(s->value)->HasSideEffects()) { return nullptr; } - ast::StatementList stmts; + tint::utils::Vector stmts; ctx.Replace(s->value, Decompose(s->value, &stmts)); InsertBefore(stmts, s); return ctx.CloneWithoutTransform(s); @@ -600,7 +618,7 @@ class DecomposeSideEffects::DecomposeState : public StateBase { if (!sem.Get(s->condition)) { return nullptr; } - ast::StatementList stmts; + tint::utils::Vector stmts; ctx.Replace(s->condition, Decompose(s->condition, &stmts)); InsertBefore(stmts, s); return ctx.CloneWithoutTransform(s); @@ -610,7 +628,7 @@ class DecomposeSideEffects::DecomposeState : public StateBase { if (!var->constructor || !sem.Get(var->constructor)->HasSideEffects()) { return nullptr; } - ast::StatementList stmts; + tint::utils::Vector stmts; ctx.Replace(var->constructor, Decompose(var->constructor, &stmts)); InsertBefore(stmts, s); return b.Decl(ctx.CloneWithoutTransform(var)); diff --git a/src/tint/transform/promote_side_effects_to_decl.h b/src/tint/transform/promote_side_effects_to_decl.h index 1e629b344f..d5d1126133 100644 --- a/src/tint/transform/promote_side_effects_to_decl.h +++ b/src/tint/transform/promote_side_effects_to_decl.h @@ -23,7 +23,7 @@ namespace tint::transform { /// declarations before the statement of usage with the goal of ensuring /// left-to-right order of evaluation, while respecting short-circuit /// evaluation. -class PromoteSideEffectsToDecl : public Castable { +class PromoteSideEffectsToDecl final : public Castable { public: /// Constructor PromoteSideEffectsToDecl(); diff --git a/src/tint/transform/promote_side_effects_to_decl_test.cc b/src/tint/transform/promote_side_effects_to_decl_test.cc index 9d9115fe19..2cd7401360 100644 --- a/src/tint/transform/promote_side_effects_to_decl_test.cc +++ b/src/tint/transform/promote_side_effects_to_decl_test.cc @@ -999,6 +999,45 @@ fn f() { EXPECT_EQ(expect, str(got)); } +TEST_F(PromoteSideEffectsToDeclTest, Binary_Arith_InWhileCond) { + auto* src = R"( +fn a(i : i32) -> i32 { + return i; +} + +fn f() { + var b = 1; + while(a(0) + b > 0) { + var marker = 0; + } +} +)"; + + auto* expect = R"( +fn a(i : i32) -> i32 { + return i; +} + +fn f() { + var b = 1; + loop { + let tint_symbol = a(0); + if (!(((tint_symbol + b) > 0))) { + break; + } + { + var marker = 0; + } + } +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + TEST_F(PromoteSideEffectsToDeclTest, Binary_Arith_InElseIf) { auto* src = R"( fn a(i : i32) -> i32 { @@ -1600,7 +1639,7 @@ fn f() { var b = true; var c = true; var d = true; - let r = b && a(0) || c && a(1) && c && d || a(2); + let r = (b && a(0)) || (c && a(1) && c && d) || a(2); } )"; @@ -1830,7 +1869,7 @@ fn a(i : i32) -> bool { fn f() { var b = true; - let r = bool(a(0)) && bool(a(1) && b) || bool(a(2) && a(3)); + let r = (bool(a(0)) && bool(a(1) && b)) || bool(a(2) && a(3)); } )"; @@ -1877,7 +1916,7 @@ fn a(i : i32) -> i32 { fn f() { var b = true; - let r = bool(a(0)) && bool(a(1)) || b; + let r = (bool(a(0)) && bool(a(1))) || b; } )"; @@ -1955,7 +1994,7 @@ fn a(i : i32) -> bool { fn f() { var b = true; - let r = all(a(0)) && all(a(1) && b) || all(a(2) && a(3)); + let r = (all(a(0)) && all(a(1) && b)) || all(a(2) && a(3)); } )"; @@ -2299,6 +2338,48 @@ fn f() { EXPECT_EQ(expect, str(got)); } +TEST_F(PromoteSideEffectsToDeclTest, Binary_Logical_InWhileCond) { + auto* src = R"( +fn a(i : i32) -> bool { + return true; +} + +fn f() { + var b = true; + while(a(0) && b) { + var marker = 0; + } +} +)"; + + auto* expect = R"( +fn a(i : i32) -> bool { + return true; +} + +fn f() { + var b = true; + loop { + var tint_symbol = a(0); + if (tint_symbol) { + tint_symbol = b; + } + if (!(tint_symbol)) { + break; + } + { + var marker = 0; + } + } +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + TEST_F(PromoteSideEffectsToDeclTest, Binary_Logical_InElseIf) { auto* src = R"( fn a(i : i32) -> bool { diff --git a/src/tint/transform/remove_continue_in_switch.cc b/src/tint/transform/remove_continue_in_switch.cc index 5c2413e1d4..e5df23fa4d 100644 --- a/src/tint/transform/remove_continue_in_switch.cc +++ b/src/tint/transform/remove_continue_in_switch.cc @@ -25,6 +25,7 @@ #include "src/tint/sem/for_loop_statement.h" #include "src/tint/sem/loop_statement.h" #include "src/tint/sem/switch_statement.h" +#include "src/tint/sem/while_statement.h" #include "src/tint/transform/utils/get_insertion_point.h" #include "src/tint/utils/map.h" @@ -49,7 +50,7 @@ class State { // Find whether first parent is a switch or a loop auto* sem_stmt = sem.Get(cont); auto* sem_parent = sem_stmt->FindFirstParent(); + sem::ForLoopStatement, sem::WhileStatement>(); if (!sem_parent) { return nullptr; } diff --git a/src/tint/transform/remove_continue_in_switch.h b/src/tint/transform/remove_continue_in_switch.h index e706225500..9e5a4d51ad 100644 --- a/src/tint/transform/remove_continue_in_switch.h +++ b/src/tint/transform/remove_continue_in_switch.h @@ -23,7 +23,7 @@ namespace tint::transform { /// bool variable, and checking if the variable is set after the switch to /// continue. It is necessary to work around FXC "error X3708: continue cannot /// be used in a switch". See crbug.com/tint/1080. -class RemoveContinueInSwitch : public Castable { +class RemoveContinueInSwitch final : public Castable { public: /// Constructor RemoveContinueInSwitch(); diff --git a/src/tint/transform/remove_continue_in_switch_test.cc b/src/tint/transform/remove_continue_in_switch_test.cc index a1e7b6e1e1..0b52457c3c 100644 --- a/src/tint/transform/remove_continue_in_switch_test.cc +++ b/src/tint/transform/remove_continue_in_switch_test.cc @@ -559,5 +559,59 @@ fn f() { EXPECT_EQ(expect, str(got)); } +TEST_F(RemoveContinueInSwitchTest, While) { + auto* src = R"( +fn f() { + var i = 0; + while (i < 4) { + let marker1 = 0; + switch(i) { + case 0: { + continue; + break; + } + default: { + break; + } + } + let marker2 = 0; + break; + } +} +)"; + + auto* expect = R"( +fn f() { + var i = 0; + while((i < 4)) { + let marker1 = 0; + var tint_continue : bool = false; + switch(i) { + case 0: { + { + tint_continue = true; + break; + } + break; + } + default: { + break; + } + } + if (tint_continue) { + continue; + } + let marker2 = 0; + break; + } +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + } // namespace } // namespace tint::transform diff --git a/src/tint/transform/remove_phonies.cc b/src/tint/transform/remove_phonies.cc index dc5c092012..c7c2dc5a1b 100644 --- a/src/tint/transform/remove_phonies.cc +++ b/src/tint/transform/remove_phonies.cc @@ -33,33 +33,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::RemovePhonies); namespace tint::transform { namespace { -struct SinkSignature { - std::vector types; - - bool operator==(const SinkSignature& other) const { - if (types.size() != other.types.size()) { - return false; - } - for (size_t i = 0; i < types.size(); i++) { - if (types[i] != other.types[i]) { - return false; - } - } - return true; - } - - struct Hasher { - /// @param sig the CallTargetSignature to hash - /// @return the hash value - std::size_t operator()(const SinkSignature& sig) const { - size_t hash = tint::utils::Hash(sig.types.size()); - for (auto* ty : sig.types) { - tint::utils::HashCombine(&hash, ty); - } - return hash; - } - }; -}; +using SinkSignature = std::vector; } // namespace @@ -72,6 +46,11 @@ bool RemovePhonies::ShouldRun(const Program* program, const DataMap&) const { if (node->Is()) { return true; } + if (auto* stmt = node->As()) { + if (program->Sem().Get(stmt->expr)->ConstantValue() != nullptr) { + return true; + } + } } return false; } @@ -79,69 +58,89 @@ bool RemovePhonies::ShouldRun(const Program* program, const DataMap&) const { void RemovePhonies::Run(CloneContext& ctx, const DataMap&, DataMap&) const { auto& sem = ctx.src->Sem(); - std::unordered_map sinks; + std::unordered_map> sinks; for (auto* node : ctx.src->ASTNodes().Objects()) { - if (auto* stmt = node->As()) { - if (stmt->lhs->Is()) { - std::vector side_effects; - if (!ast::TraverseExpressions( - stmt->rhs, ctx.dst->Diagnostics(), [&](const ast::CallExpression* call) { - // ast::CallExpression may map to a function or builtin call - // (both may have side-effects), or a type constructor or - // type conversion (both do not have side effects). - if (sem.Get(call)->Target()->IsAnyOf()) { - side_effects.push_back(call); - return ast::TraverseAction::Skip; - } - return ast::TraverseAction::Descend; - })) { - return; - } - - if (side_effects.empty()) { - // Phony assignment with no side effects. - // Just remove it. - RemoveStatement(ctx, stmt); - continue; - } - - if (side_effects.size() == 1) { - if (auto* call = side_effects[0]->As()) { - // Phony assignment with single call side effect. - // Replace phony assignment with call. - ctx.Replace(stmt, [&, call] { return ctx.dst->CallStmt(ctx.Clone(call)); }); - continue; + Switch( + node, + [&](const ast::AssignmentStatement* stmt) { + if (stmt->lhs->Is()) { + std::vector side_effects; + if (!ast::TraverseExpressions( + stmt->rhs, ctx.dst->Diagnostics(), + [&](const ast::CallExpression* expr) { + // ast::CallExpression may map to a function or builtin call + // (both may have side-effects), or a type constructor or + // type conversion (both do not have side effects). + auto* call = sem.Get(expr); + if (!call) { + // Semantic node must be a Materialize, in which case the + // expression was creation-time (compile time), so could not + // have side effects. Just skip. + return ast::TraverseAction::Skip; + } + if (call->Target()->IsAnyOf() && + call->HasSideEffects()) { + side_effects.push_back(expr); + return ast::TraverseAction::Skip; + } + return ast::TraverseAction::Descend; + })) { + return; } - } - // Phony assignment with multiple side effects. - // Generate a call to a placeholder function with the side - // effects as arguments. - ctx.Replace(stmt, [&, side_effects] { - SinkSignature sig; - for (auto* arg : side_effects) { - sig.types.push_back(sem.Get(arg)->Type()->UnwrapRef()); + if (side_effects.empty()) { + // Phony assignment with no side effects. + // Just remove it. + RemoveStatement(ctx, stmt); + return; } - auto sink = utils::GetOrCreate(sinks, sig, [&] { - auto name = ctx.dst->Symbols().New("phony_sink"); - ast::VariableList params; - for (auto* ty : sig.types) { - auto* ast_ty = CreateASTTypeFor(ctx, ty); - params.push_back( - ctx.dst->Param("p" + std::to_string(params.size()), ast_ty)); + + if (side_effects.size() == 1) { + if (auto* call = side_effects[0]->As()) { + // Phony assignment with single call side effect. + // Replace phony assignment with call. + ctx.Replace(stmt, + [&, call] { return ctx.dst->CallStmt(ctx.Clone(call)); }); + return; } - ctx.dst->Func(name, params, ctx.dst->ty.void_(), {}); - return name; - }); - ast::ExpressionList args; - for (auto* arg : side_effects) { - args.push_back(ctx.Clone(arg)); } - return ctx.dst->CallStmt(ctx.dst->Call(sink, args)); - }); - } - } + + // Phony assignment with multiple side effects. + // Generate a call to a placeholder function with the side + // effects as arguments. + ctx.Replace(stmt, [&, side_effects] { + SinkSignature sig; + for (auto* arg : side_effects) { + sig.push_back(sem.Get(arg)->Type()->UnwrapRef()); + } + auto sink = utils::GetOrCreate(sinks, sig, [&] { + auto name = ctx.dst->Symbols().New("phony_sink"); + utils::Vector params; + for (auto* ty : sig) { + auto* ast_ty = CreateASTTypeFor(ctx, ty); + params.Push( + ctx.dst->Param("p" + std::to_string(params.Length()), ast_ty)); + } + ctx.dst->Func(name, params, ctx.dst->ty.void_(), {}); + return name; + }); + utils::Vector args; + for (auto* arg : side_effects) { + args.Push(ctx.Clone(arg)); + } + return ctx.dst->CallStmt(ctx.dst->Call(sink, args)); + }); + } + }, + [&](const ast::CallStatement* stmt) { + // Remove call statements to const value-returning functions. + // TODO(crbug.com/tint/1637): Remove if `stmt->expr` has no side-effects. + auto* sem_expr = sem.Get(stmt->expr); + if ((sem_expr->ConstantValue() != nullptr) && !sem_expr->HasSideEffects()) { + ctx.Remove(sem.Get(stmt)->Block()->Declaration()->statements, stmt); + } + }); } ctx.Clone(); diff --git a/src/tint/transform/remove_phonies.h b/src/tint/transform/remove_phonies.h index 20128a0e4e..daa181270e 100644 --- a/src/tint/transform/remove_phonies.h +++ b/src/tint/transform/remove_phonies.h @@ -24,8 +24,8 @@ namespace tint::transform { /// RemovePhonies is a Transform that removes all phony-assignment statements, /// while preserving function call expressions in the RHS of the assignment that -/// may have side-effects. -class RemovePhonies : public Castable { +/// may have side-effects. It also removes calls to builtins that return a constant value. +class RemovePhonies final : public Castable { public: /// Constructor RemovePhonies(); diff --git a/src/tint/transform/remove_phonies_test.cc b/src/tint/transform/remove_phonies_test.cc index 220f1db464..a072e517d7 100644 --- a/src/tint/transform/remove_phonies_test.cc +++ b/src/tint/transform/remove_phonies_test.cc @@ -65,6 +65,10 @@ fn f() { _ = vec2(5.0); _ = vec3(6, 7, 8); _ = mat2x2(9.0, 10.0, 11.0, 12.0); + _ = atan2(1.0, 2.0); + _ = clamp(1.0, 2.0, 3.0); + atan2(1.0, 2.0); + clamp(1.0, 2.0, 3.0); } )"; diff --git a/src/tint/transform/remove_unreachable_statements.h b/src/tint/transform/remove_unreachable_statements.h index c75da3d45f..7f8b9472ad 100644 --- a/src/tint/transform/remove_unreachable_statements.h +++ b/src/tint/transform/remove_unreachable_statements.h @@ -24,7 +24,7 @@ namespace tint::transform { /// RemoveUnreachableStatements is a Transform that removes all statements /// marked as unreachable. -class RemoveUnreachableStatements : public Castable { +class RemoveUnreachableStatements final : public Castable { public: /// Constructor RemoveUnreachableStatements(); diff --git a/src/tint/transform/renamer.cc b/src/tint/transform/renamer.cc index 50cd781a6a..562a52fc7f 100644 --- a/src/tint/transform/renamer.cc +++ b/src/tint/transform/renamer.cc @@ -1278,7 +1278,7 @@ Output Renamer::Run(const Program* in, const DataMap& inputs) const { } } } else if (auto* call = node->As()) { - auto* sem = in->Sem().Get(call); + auto* sem = in->Sem().Get(call)->UnwrapMaterialize()->As(); if (!sem) { TINT_ICE(Transform, out.Diagnostics()) << "CallExpression has no semantic info"; continue; diff --git a/src/tint/transform/renamer.h b/src/tint/transform/renamer.h index 354acdade1..000aee9ca2 100644 --- a/src/tint/transform/renamer.h +++ b/src/tint/transform/renamer.h @@ -23,11 +23,11 @@ namespace tint::transform { /// Renamer is a Transform that renames all the symbols in a program. -class Renamer : public Castable { +class Renamer final : public Castable { public: /// Data is outputted by the Renamer transform. /// Data holds information about shader usage and constant buffer offsets. - struct Data : public Castable { + struct Data final : public Castable { /// Remappings is a map of old symbol name to new symbol name using Remappings = std::unordered_map; @@ -59,7 +59,7 @@ class Renamer : public Castable { /// Optional configuration options for the transform. /// If omitted, then the renamer will use Target::kAll. - struct Config : public Castable { + struct Config final : public Castable { /// Constructor /// @param tgt the targets to rename /// @param keep_unicode if false, symbols with non-ascii code-points are diff --git a/src/tint/transform/renamer_test.cc b/src/tint/transform/renamer_test.cc index f56971ea0b..c57dea3105 100644 --- a/src/tint/transform/renamer_test.cc +++ b/src/tint/transform/renamer_test.cc @@ -50,7 +50,7 @@ fn test(vert_idx : u32) -> u32 { return vert_idx; } -@stage(vertex) +@vertex fn entry(@builtin(vertex_index) vert_idx : u32 ) -> @builtin(position) vec4 { _ = test(vert_idx); @@ -63,7 +63,7 @@ fn tint_symbol(tint_symbol_1 : u32) -> u32 { return tint_symbol_1; } -@stage(vertex) +@vertex fn tint_symbol_2(@builtin(vertex_index) tint_symbol_1 : u32) -> @builtin(position) vec4 { _ = tint_symbol(tint_symbol_1); return vec4(); @@ -87,7 +87,7 @@ fn tint_symbol_2(@builtin(vertex_index) tint_symbol_1 : u32) -> @builtin(positio TEST_F(RenamerTest, PreserveSwizzles) { auto* src = R"( -@stage(vertex) +@vertex fn entry() -> @builtin(position) vec4 { var v : vec4; var rgba : f32; @@ -97,7 +97,7 @@ fn entry() -> @builtin(position) vec4 { )"; auto* expect = R"( -@stage(vertex) +@vertex fn tint_symbol() -> @builtin(position) vec4 { var tint_symbol_1 : vec4; var tint_symbol_2 : f32; @@ -124,7 +124,7 @@ fn tint_symbol() -> @builtin(position) vec4 { TEST_F(RenamerTest, PreserveBuiltins) { auto* src = R"( -@stage(vertex) +@vertex fn entry() -> @builtin(position) vec4 { var blah : vec4; return abs(blah); @@ -132,7 +132,7 @@ fn entry() -> @builtin(position) vec4 { )"; auto* expect = R"( -@stage(vertex) +@vertex fn tint_symbol() -> @builtin(position) vec4 { var tint_symbol_1 : vec4; return abs(tint_symbol_1); @@ -155,7 +155,7 @@ fn tint_symbol() -> @builtin(position) vec4 { TEST_F(RenamerTest, PreserveBuiltinTypes) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn entry() { var a = modf(1.0).whole; var b = modf(1.0).fract; @@ -165,7 +165,7 @@ fn entry() { )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn tint_symbol() { var tint_symbol_1 = modf(1.0).whole; var tint_symbol_2 = modf(1.0).fract; @@ -190,7 +190,7 @@ fn tint_symbol() { TEST_F(RenamerTest, PreserveUnicode) { auto src = R"( -@stage(fragment) +@fragment fn frag_main() { var )" + std::string(kUnicodeIdentifier) + R"( : i32; @@ -209,7 +209,7 @@ fn frag_main() { TEST_F(RenamerTest, AttemptSymbolCollision) { auto* src = R"( -@stage(vertex) +@vertex fn entry() -> @builtin(position) vec4 { var tint_symbol : vec4; var tint_symbol_2 : vec4; @@ -219,7 +219,7 @@ fn entry() -> @builtin(position) vec4 { )"; auto* expect = R"( -@stage(vertex) +@vertex fn tint_symbol() -> @builtin(position) vec4 { var tint_symbol_1 : vec4; var tint_symbol_2 : vec4; @@ -252,7 +252,7 @@ TEST_P(RenamerTestGlsl, Keywords) { auto keyword = GetParam(); auto src = R"( -@stage(fragment) +@fragment fn frag_main() { var )" + keyword + R"( : i32; @@ -260,7 +260,7 @@ fn frag_main() { )"; auto* expect = R"( -@stage(fragment) +@fragment fn frag_main() { var tint_symbol : i32; } @@ -278,7 +278,7 @@ TEST_P(RenamerTestHlsl, Keywords) { auto keyword = GetParam(); auto src = R"( -@stage(fragment) +@fragment fn frag_main() { var )" + keyword + R"( : i32; @@ -286,7 +286,7 @@ fn frag_main() { )"; auto* expect = R"( -@stage(fragment) +@fragment fn frag_main() { var tint_symbol : i32; } @@ -304,7 +304,7 @@ TEST_P(RenamerTestMsl, Keywords) { auto keyword = GetParam(); auto src = R"( -@stage(fragment) +@fragment fn frag_main() { var )" + keyword + R"( : i32; @@ -312,7 +312,7 @@ fn frag_main() { )"; auto* expect = R"( -@stage(fragment) +@fragment fn frag_main() { var tint_symbol : i32; } @@ -328,234 +328,234 @@ fn frag_main() { INSTANTIATE_TEST_SUITE_P(RenamerTestGlsl, RenamerTestGlsl, - testing::Values("active", - // "asm", // WGSL keyword - "atomic_uint", - "attribute", - // "bool", // WGSL keyword - // "break", // WGSL keyword - "buffer", - "bvec2", - "bvec3", - "bvec4", - // "case", // WGSL keyword - "cast", - "centroid", - "class", - "coherent", - "common", - // "const", // WGSL keyword - // "continue", // WGSL keyword - // "default", // WGSL keyword - // "discard", // WGSL keyword - "dmat2", - "dmat2x2", - "dmat2x3", - "dmat2x4", - "dmat3", - "dmat3x2", - "dmat3x3", - "dmat3x4", - "dmat4", - "dmat4x2", - "dmat4x3", - "dmat4x4", - // "do", // WGSL keyword - "double", - "dvec2", - "dvec3", - "dvec4", - // "else" // WGSL keyword - // "enum", // WGSL keyword - "extern", - "external", - // "false", // WGSL keyword - "filter", - "fixed", - "flat", - "float", - // "for", // WGSL keyword - "fvec2", - "fvec3", - "fvec4", - "gl_BaseInstance", - "gl_BaseVertex", - "gl_ClipDistance", - "gl_DepthRangeParameters", - "gl_DrawID", - "gl_FragCoord", - "gl_FragDepth", - "gl_FrontFacing", - "gl_GlobalInvocationID", - "gl_InstanceID", - "gl_LocalInvocationID", - "gl_LocalInvocationIndex", - "gl_NumSamples", - "gl_NumWorkGroups", - "gl_PerVertex", - "gl_PointCoord", - "gl_PointSize", - "gl_Position", - "gl_PrimitiveID", - "gl_SampleID", - "gl_SampleMask", - "gl_SampleMaskIn", - "gl_SamplePosition", - "gl_VertexID", - "gl_WorkGroupID", - "gl_WorkGroupSize", - "goto", - "half", - "highp", - "hvec2", - "hvec3", - "hvec4", - // "if", // WGSL keyword - "iimage1D", - "iimage1DArray", - "iimage2D", - "iimage2DArray", - "iimage2DMS", - "iimage2DMSArray", - "iimage2DRect", - "iimage3D", - "iimageBuffer", - "iimageCube", - "iimageCubeArray", - "image1D", - "image1DArray", - "image2D", - "image2DArray", - "image2DMS", - "image2DMSArray", - "image2DRect", - "image3D", - "imageBuffer", - "imageCube", - "imageCubeArray", - "in", - "inline", - "inout", - "input", - "int", - "interface", - "invariant", - "isampler1D", - "isampler1DArray", - "isampler2D", - "isampler2DArray", - "isampler2DMS", - "isampler2DMSArray", - "isampler2DRect", - "isampler3D", - "isamplerBuffer", - "isamplerCube", - "isamplerCubeArray", - "ivec2", - "ivec3", - "ivec4", - "layout", - "long", - "lowp", - // "mat2x2", // WGSL keyword - // "mat2x3", // WGSL keyword - // "mat2x4", // WGSL keyword - // "mat2", - "mat3", - // "mat3x2", // WGSL keyword - // "mat3x3", // WGSL keyword - // "mat3x4", // WGSL keyword - "mat4", - // "mat4x2", // WGSL keyword - // "mat4x3", // WGSL keyword - // "mat4x4", // WGSL keyword - "mediump", - "namespace", - "noinline", - "noperspective", - "out", - "output", - "partition", - "patch", - "precise", - "precision", - "public", - "readonly", - "resource", - "restrict", - // "return", // WGSL keyword - "sample", - "sampler1D", - "sampler1DArray", - "sampler1DArrayShadow", - "sampler1DShadow", - "sampler2D", - "sampler2DArray", - "sampler2DArrayShadow", - "sampler2DMS", - "sampler2DMSArray", - "sampler2DRect", - "sampler2DRectShadow", - "sampler2DShadow", - "sampler3D", - "sampler3DRect", - "samplerBuffer", - "samplerCube", - "samplerCubeArray", - "samplerCubeArrayShadow", - "samplerCubeShadow", - "shared", - "short", - "sizeof", - "smooth", - "static", - // "struct", // WGSL keyword - "subroutine", - "superp", - // "switch", // WGSL keyword - "template", - "this", - // "true", // WGSL keyword - // "typedef", // WGSL keyword - "uimage1D", - "uimage1DArray", - "uimage2D", - "uimage2DArray", - "uimage2DMS", - "uimage2DMSArray", - "uimage2DRect", - "uimage3D", - "uimageBuffer", - "uimageCube", - "uimageCubeArray", - "uint", - // "uniform", // WGSL keyword - "union", - "unsigned", - "usampler1D", - "usampler1DArray", - "usampler2D", - "usampler2DArray", - "usampler2DMS", - "usampler2DMSArray", - "usampler2DRect", - "usampler3D", - "usamplerBuffer", - "usamplerCube", - "usamplerCubeArray", - // "using", // WGSL keyword - "uvec2", - "uvec3", - "uvec4", - "varying", - // "vec2", // WGSL keyword - // "vec3", // WGSL keyword - // "vec4", // WGSL keyword - // "void", // WGSL keyword - "volatile", - // "while", // WGSL keyword - "writeonly", - kUnicodeIdentifier)); + testing::Values( // "active", // Also reserved in WGSL + // "asm", // WGSL keyword + "atomic_uint", + // "attribute", // Also reserved in WGSL + // "bool", // WGSL keyword + // "break", // WGSL keyword + "buffer", + "bvec2", + "bvec3", + "bvec4", + // "case", // WGSL keyword + // "cast", // Also reserved in WGSL + "centroid", + // "class", // Also reserved in WGSL + // "coherent", // Also reserved in WGSL + // "common", // Also reserved in WGSL + // "const", // WGSL keyword + // "continue", // WGSL keyword + // "default", // WGSL keyword + // "discard", // WGSL keyword + "dmat2", + "dmat2x2", + "dmat2x3", + "dmat2x4", + "dmat3", + "dmat3x2", + "dmat3x3", + "dmat3x4", + "dmat4", + "dmat4x2", + "dmat4x3", + "dmat4x4", + // "do", // WGSL keyword + "double", + "dvec2", + "dvec3", + "dvec4", + // "else" // WGSL keyword + // "enum", // WGSL keyword + // "extern", // Also reserved in WGSL + // "external", // Also reserved in WGSL + // "false", // WGSL keyword + // "filter", // Also reserved in WGSL + "fixed", + "flat", + "float", + // "for", // WGSL keyword + "fvec2", + "fvec3", + "fvec4", + "gl_BaseInstance", + "gl_BaseVertex", + "gl_ClipDistance", + "gl_DepthRangeParameters", + "gl_DrawID", + "gl_FragCoord", + "gl_FragDepth", + "gl_FrontFacing", + "gl_GlobalInvocationID", + "gl_InstanceID", + "gl_LocalInvocationID", + "gl_LocalInvocationIndex", + "gl_NumSamples", + "gl_NumWorkGroups", + "gl_PerVertex", + "gl_PointCoord", + "gl_PointSize", + "gl_Position", + "gl_PrimitiveID", + "gl_SampleID", + "gl_SampleMask", + "gl_SampleMaskIn", + "gl_SamplePosition", + "gl_VertexID", + "gl_WorkGroupID", + "gl_WorkGroupSize", + // "goto", // Also reserved in WGSL + "half", + // "highp", // Also reserved in WGSL + "hvec2", + "hvec3", + "hvec4", + // "if", // WGSL keyword + "iimage1D", + "iimage1DArray", + "iimage2D", + "iimage2DArray", + "iimage2DMS", + "iimage2DMSArray", + "iimage2DRect", + "iimage3D", + "iimageBuffer", + "iimageCube", + "iimageCubeArray", + "image1D", + "image1DArray", + "image2D", + "image2DArray", + "image2DMS", + "image2DMSArray", + "image2DRect", + "image3D", + "imageBuffer", + "imageCube", + "imageCubeArray", + "in", + // "inline", // Also reserved in WGSL + // "inout", // Also reserved in WGSL + "input", + "int", + // "interface", // Also reserved in WGSL + // "invariant", // Also reserved in WGSL + "isampler1D", + "isampler1DArray", + "isampler2D", + "isampler2DArray", + "isampler2DMS", + "isampler2DMSArray", + "isampler2DRect", + "isampler3D", + "isamplerBuffer", + "isamplerCube", + "isamplerCubeArray", + "ivec2", + "ivec3", + "ivec4", + // "layout", // Also reserved in WGSL + "long", + // "lowp", // Also reserved in WGSL + // "mat2x2", // WGSL keyword + // "mat2x3", // WGSL keyword + // "mat2x4", // WGSL keyword + // "mat2", + "mat3", + // "mat3x2", // WGSL keyword + // "mat3x3", // WGSL keyword + // "mat3x4", // WGSL keyword + "mat4", + // "mat4x2", // WGSL keyword + // "mat4x3", // WGSL keyword + // "mat4x4", // WGSL keyword + // "mediump", // Also reserved in WGSL + // "namespace", // Also reserved in WGSL + // "noinline", // Also reserved in WGSL + // "noperspective", // Also reserved in WGSL + "out", + "output", + // "partition", // Also reserved in WGSL + // "patch", // Also reserved in WGSL + // "precise", // Also reserved in WGSL + // "precision", // Also reserved in WGSL + // "public", // Also reserved in WGSL + // "readonly", // Also reserved in WGSL + // "resource", // Also reserved in WGSL + // "restrict", // Also reserved in WGSL + // "return", // WGSL keyword + "sample", + "sampler1D", + "sampler1DArray", + "sampler1DArrayShadow", + "sampler1DShadow", + "sampler2D", + "sampler2DArray", + "sampler2DArrayShadow", + "sampler2DMS", + "sampler2DMSArray", + "sampler2DRect", + "sampler2DRectShadow", + "sampler2DShadow", + "sampler3D", + "sampler3DRect", + "samplerBuffer", + "samplerCube", + "samplerCubeArray", + "samplerCubeArrayShadow", + "samplerCubeShadow", + // "shared" // Also reserved in WGSL, + "short", + // "sizeof", // Also reserved in WGSL + // "smooth", // Also reserved in WGSL + // "static", // Also reserved in WGSL + // "struct", // WGSL keyword + // "subroutine", // Also reserved in WGSL + "superp", + // "switch", // WGSL keyword + // "template", // Also reserved in WGSL + // "this", // Also reserved in WGSL + // "true", // WGSL keyword + // "typedef", // WGSL keyword + "uimage1D", + "uimage1DArray", + "uimage2D", + "uimage2DArray", + "uimage2DMS", + "uimage2DMSArray", + "uimage2DRect", + "uimage3D", + "uimageBuffer", + "uimageCube", + "uimageCubeArray", + "uint", + // "uniform", // WGSL keyword + // "union", // Also reserved in WGSL + "unsigned", + "usampler1D", + "usampler1DArray", + "usampler2D", + "usampler2DArray", + "usampler2DMS", + "usampler2DMSArray", + "usampler2DRect", + "usampler3D", + "usamplerBuffer", + "usamplerCube", + "usamplerCubeArray", + // "using", // WGSL keyword + "uvec2", + "uvec3", + "uvec4", + // "varying", // Also reserved in WGSL + // "vec2", // WGSL keyword + // "vec3", // WGSL keyword + // "vec4", // WGSL keyword + // "void", // WGSL keyword + // "volatile", // Also reserved in WGSL + // "while", // WGSL keyword + // "writeonly", // Also reserved in WGSL + kUnicodeIdentifier)); INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, RenamerTestHlsl, @@ -575,8 +575,8 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "COLOR", "CheckAccessFullyMapped", "ComparisonFunc", - "CompileShader", - "ComputeShader", + // "CompileShader", // Also reserved in WGSL + // "ComputeShader", // Also reserved in WGSL "ConsumeStructuredBuffer", "D3DCOLORtoUBYTE4", "DEPTH", @@ -584,18 +584,18 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "DepthStencilView", "DeviceMemoryBarrier", "DeviceMemroyBarrierWithGroupSync", - "DomainShader", + // "DomainShader", // Also reserved in WGSL "EvaluateAttributeAtCentroid", "EvaluateAttributeAtSample", "EvaluateAttributeSnapped", "FOG", "Filter", - "GeometryShader", + // "GeometryShader", // Also reserved in WGSL "GetRenderTargetSampleCount", "GetRenderTargetSamplePosition", "GroupMemoryBarrier", "GroupMemroyBarrierWithGroupSync", - "Hullshader", + // "Hullshader", // Also reserved in WGSL "InputPatch", "InterlockedAdd", "InterlockedAnd", @@ -612,7 +612,7 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "MinLOD", "MipLODBias", "NORMAL", - "NULL", + // "NULL", // Also reserved in WGSL "Normal", "OutputPatch", "POSITION", @@ -703,11 +703,11 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, // "asin", // WGSL builtin "asint", // "asm", // WGSL keyword - "asm_fragment", + // "asm_fragment", // Also reserved in WGSL "asuint", // "atan", // WGSL builtin // "atan2", // WGSL builtin - "auto", + // "auto", // Also reserved in WGSL // "bool", // WGSL keyword "bool1", "bool1x1", @@ -733,19 +733,19 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, // "break", // WGSL keyword // "call", // WGSL builtin // "case", // WGSL keyword - "catch", + // "catch", // Also reserved in WGSL "cbuffer", // "ceil", // WGSL builtin "centroid", "char", // "clamp", // WGSL builtin - "class", + // "class", // Also reserved in WGSL "clip", - "column_major", - "compile", - "compile_fragment", + // "column_major", // Also reserved in WGSL + // "compile", // Also reserved in WGSL + // "compile_fragment", // Also reserved in WGSL // "const", // WGSL keyword - "const_cast", + // "const_cast", // Also reserved in WGSL // "continue", // WGSL keyword // "cos", // WGSL builtin // "cosh", // WGSL builtin @@ -759,7 +759,7 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "ddy_fine", // "default", // WGSL keyword "degrees", - "delete", + // "delete", // Also reserved in WGSL // "determinant", // WGSL builtin // "discard", // WGSL keyword // "distance", // WGSL builtin @@ -808,15 +808,15 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "dword4x2", "dword4x3", "dword4x4", - "dynamic_cast", + // "dynamic_cast", // Also reserved in WGSL // "else", // WGSL keyword // "enum", // WGSL keyword "errorf", // "exp", // WGSL builtin // "exp2", // WGSL builtin - "explicit", - "export", - "extern", + // "explicit", // Also reserved in WGSL + // "export", // Also reserved in WGSL + // "extern", // Also reserved in WGSL "f16to32", "f32tof16", // "faceforward", // WGSL builtin @@ -853,11 +853,11 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "forcecase", "frac", // "frexp", // WGSL builtin - "friend", + // "friend", // Also reserved in WGSL // "fwidth", // WGSL builtin - "fxgroup", - "goto", - "groupshared", + // "fxgroup", // Also reserved in WGSL + // "goto", // Also reserved in WGSL + // "groupshared", // Also reserved in WGSL "half", "half1", "half1x1", @@ -881,8 +881,8 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "half4x4", // "if", // WGSL keyword // "in", // WGSL keyword - "inline", - "inout", + // "inline", // Also reserved in WGSL + // "inout", // Also reserved in WGSL "int", "int1", "int1x1", @@ -904,15 +904,15 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "int4x2", "int4x3", "int4x4", - "interface", + // "interface", // Also reserved in WGSL "isfinite", "isinf", "isnan", // "ldexp", // WGSL builtin // "length", // WGSL builtin "lerp", - "line", - "lineadj", + // "line", // Also reserved in WGSL + // "lineadj", // Also reserved in WGSL "linear", "lit", // "log", // WGSL builtin @@ -1032,33 +1032,33 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, // "modf", // WGSL builtin "msad4", "mul", - "mutable", - "namespace", - "new", - "nointerpolation", + // "mutable", // Also reserved in WGSL + // "namespace", // Also reserved in WGSL + // "new", // Also reserved in WGSL + // "nointerpolation", // Also reserved in WGSL "noise", - "noperspective", + // "noperspective", // Also reserved in WGSL // "normalize", // WGSL builtin "numthreads", - "operator", + // "operator", // Also reserved in WGSL // "out", // WGSL keyword - "packoffset", - "pass", - "pixelfragment", + // "packoffset", // Also reserved in WGSL + // "pass", // Also reserved in WGSL + // "pixelfragment", // Also reserved in WGSL "pixelshader", - "point", + // "point", // Also reserved in WGSL // "pow", // WGSL builtin - "precise", + // "precise", // Also reserved in WGSL "printf", // "private", // WGSL keyword - "protected", - "public", + // "protected", // Also reserved in WGSL + // "public", // Also reserved in WGSL "radians", "rcp", // "reflect", // WGSL builtin "refract", - "register", - "reinterpret_cast", + // "register", // Also reserved in WGSL + // "reinterpret_cast", // Also reserved in WGSL // "return", // WGSL keyword // "reversebits", // WGSL builtin // "round", // WGSL builtin @@ -1071,21 +1071,21 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "samplerCUBE", "sampler_state", "saturate", - "shared", + // "shared", // Also reserved in WGSL "short", // "sign", // WGSL builtin - "signed", + // "signed", // Also reserved in WGSL // "sin", // WGSL builtin "sincos", // "sinh", // WGSL builtin - "sizeof", + // "sizeof", // Also reserved in WGSL // "smoothstep", // WGSL builtin - "snorm", + // "snorm", // Also reserved in WGSL // "sqrt", // WGSL builtin "stateblock", "stateblock_state", - "static", - "static_cast", + // "static", // Also reserved in WGSL + // "static_cast", // Also reserved in WGSL // "step", // WGSL builtin "string", // "struct", // WGSL keyword @@ -1096,7 +1096,7 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "technique", "technique10", "technique11", - "template", + // "template", // Also reserved in WGSL "tex1D", "tex1Dbias", "tex1Dgrad", @@ -1127,16 +1127,16 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "texture3D", "textureCube", "textureCubeArray", - "this", - "throw", + // "this", // Also reserved in WGSL + // "throw", // Also reserved in WGSL "transpose", "triangle", "triangleadj", // "true", // WGSL keyword // "trunc", // WGSL builtin - "try", + // "try", // Also reserved in WGSL // "typedef", // WGSL keyword - "typename", + // "typename", // Also reserved in WGSL "uint", "uint1", "uint1x1", @@ -1159,17 +1159,17 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, "uint4x3", "uint4x4", // "uniform", // WGSL keyword - "union", - "unorm", + // "union", // Also reserved in WGSL + // "unorm", // Also reserved in WGSL "unroll", "unsigned", // "using", // WGSL reserved keyword "vector", "vertexfragment", "vertexshader", - "virtual", + // "virtual", // Also reserved in WGSL // "void", // WGSL keyword - "volatile", + // "volatile", // Also reserved in WGSL // "while" // WGSL reserved keyword kUnicodeIdentifier)); @@ -1178,87 +1178,87 @@ INSTANTIATE_TEST_SUITE_P( RenamerTestMsl, testing::Values( // c++14 spec - "alignas", - "alignof", + // "alignas", // Also reserved in WGSL + // "alignof", // Also reserved in WGSL "and", "and_eq", // "asm", // Also reserved in WGSL - "auto", + // "auto", // Also reserved in WGSL "bitand", "bitor", // "bool", // Also used in WGSL // "break", // Also used in WGSL // "case", // Also used in WGSL - "catch", + // "catch", // Also reserved in WGSL "char", "char16_t", "char32_t", - "class", + // "class", // Also reserved in WGSL "compl", // "const", // Also used in WGSL - "const_cast", - "constexpr", + // "const_cast", // Also reserved in WGSL + // "constexpr", // Also reserved in WGSL // "continue", // Also used in WGSL - "decltype", + // "decltype", // Also reserved in WGSL // "default", // Also used in WGSL - "delete", + // "delete", // Also reserved in WGSL // "do", // Also used in WGSL "double", - "dynamic_cast", + // "dynamic_cast", // Also reserved in WGSL // "else", // Also used in WGSL // "enum", // Also used in WGSL - "explicit", - "extern", + // "explicit", // Also reserved in WGSL + // "extern", // Also reserved in WGSL // "false", // Also used in WGSL - "final", + // "final", // Also reserved in WGSL "float", // "for", // Also used in WGSL - "friend", - "goto", + // "friend", // Also reserved in WGSL + // "goto", // Also reserved in WGSL // "if", // Also used in WGSL - "inline", + // "inline", // Also reserved in WGSL "int", "long", - "mutable", - "namespace", - "new", - "noexcept", + // "mutable", // Also reserved in WGSL + // "namespace", // Also reserved in WGSL + // "new", // Also reserved in WGSL + // "noexcept", // Also reserved in WGSL "not", "not_eq", - "nullptr", - "operator", + // "nullptr", // Also reserved in WGSL + // "operator", // Also reserved in WGSL "or", "or_eq", // "override", // Also used in WGSL // "private", // Also used in WGSL - "protected", - "public", - "register", - "reinterpret_cast", + // "protected", // Also reserved in WGSL + // "public", // Also reserved in WGSL + // "register", // Also reserved in WGSL + // "reinterpret_cast", // Also reserved in WGSL // "return", // Also used in WGSL "short", - "signed", - "sizeof", - "static", - "static_assert", - "static_cast", + // "signed", // Also reserved in WGSL + // "sizeof", // Also reserved in WGSL + // "static", // Also reserved in WGSL + // "static_assert", // Also reserved in WGSL + // "static_cast", // Also reserved in WGSL // "struct", // Also used in WGSL // "switch", // Also used in WGSL - "template", - "this", - "thread_local", - "throw", + // "template", // Also reserved in WGSL + // "this", // Also reserved in WGSL + // "thread_local", // Also reserved in WGSL + // "throw", // Also reserved in WGSL // "true", // Also used in WGSL - "try", + // "try", // Also reserved in WGSL // "typedef", // Also used in WGSL - "typeid", - "typename", - "union", + // "typeid", // Also reserved in WGSL + // "typename", // Also reserved in WGSL + // "union", // Also reserved in WGSL "unsigned", // "using", // WGSL reserved keyword - "virtual", + // "virtual", // Also reserved in WGSL // "void", // Also used in WGSL - "volatile", + // "volatile", // Also reserved in WGSL "wchar_t", // "while", // WGSL reserved keyword "xor", diff --git a/src/tint/transform/robustness.cc b/src/tint/transform/robustness.cc index a7f2a4abb5..beb11082f1 100644 --- a/src/tint/transform/robustness.cc +++ b/src/tint/transform/robustness.cc @@ -120,17 +120,18 @@ struct Robustness::State { return nullptr; } - if (auto idx_constant = idx_sem->ConstantValue()) { + if (auto* idx_constant = idx_sem->ConstantValue()) { // Constant value index - if (idx_constant.Type()->Is()) { - idx.i32 = idx_constant.Elements()[0].i32; + auto val = std::get(idx_constant->Value()); + if (idx_constant->Type()->Is()) { + idx.i32 = static_cast(val); idx.is_signed = true; - } else if (idx_constant.Type()->Is()) { - idx.u32 = idx_constant.Elements()[0].u32; + } else if (idx_constant->Type()->Is()) { + idx.u32 = static_cast(val); idx.is_signed = false; } else { TINT_ICE(Transform, b.Diagnostics()) << "unsupported constant value for accessor " - << idx_constant.Type()->TypeInfo().name; + << idx_constant->Type()->TypeInfo().name; return nullptr; } } else { @@ -206,7 +207,7 @@ struct Robustness::State { /// @return the clamped replacement call expression, or nullptr if `expr` /// should be cloned without changes. const ast::CallExpression* Transform(const ast::CallExpression* expr) { - auto* call = ctx.src->Sem().Get(expr); + auto* call = ctx.src->Sem().Get(expr)->UnwrapMaterialize()->As(); auto* call_target = call->Target(); auto* builtin = call_target->As(); if (!builtin || !TextureBuiltinNeedsClamping(builtin->Type())) { @@ -223,9 +224,9 @@ struct Robustness::State { auto array_idx = signature.IndexOf(sem::ParameterUsage::kArrayIndex); auto level_idx = signature.IndexOf(sem::ParameterUsage::kLevel); - auto* texture_arg = expr->args[texture_idx]; - auto* coords_arg = expr->args[coords_idx]; - auto* coords_ty = builtin->Parameters()[coords_idx]->Type(); + auto* texture_arg = expr->args[static_cast(texture_idx)]; + auto* coords_arg = expr->args[static_cast(coords_idx)]; + auto* coords_ty = builtin->Parameters()[static_cast(coords_idx)]->Type(); // If the level is provided, then we need to clamp this. As the level is // used by textureDimensions() and the texture[Load|Store]() calls, we need @@ -235,7 +236,7 @@ struct Robustness::State { std::function level_arg; if (level_idx >= 0) { level_arg = [&] { - auto* arg = expr->args[level_idx]; + auto* arg = expr->args[static_cast(level_idx)]; auto* num_levels = b.Call("textureNumLevels", ctx.Clone(texture_arg)); auto* zero = b.Expr(0_i); auto* max = ctx.dst->Sub(num_levels, 1_i); @@ -258,7 +259,7 @@ struct Robustness::State { // Clamp the array_index argument, if provided if (array_idx >= 0) { - auto* arg = expr->args[array_idx]; + auto* arg = expr->args[static_cast(array_idx)]; auto* num_layers = b.Call("textureNumLayers", ctx.Clone(texture_arg)); auto* zero = b.Expr(0_i); auto* max = ctx.dst->Sub(num_layers, 1_i); @@ -268,7 +269,7 @@ struct Robustness::State { // Clamp the level argument, if provided if (level_idx >= 0) { - auto* arg = expr->args[level_idx]; + auto* arg = expr->args[static_cast(level_idx)]; ctx.Replace(arg, level_arg ? level_arg() : ctx.dst->Expr(0_i)); } diff --git a/src/tint/transform/robustness.h b/src/tint/transform/robustness.h index 138b48cec3..549b666bb7 100644 --- a/src/tint/transform/robustness.h +++ b/src/tint/transform/robustness.h @@ -31,7 +31,7 @@ namespace tint::transform { /// the bounds of the array. Any access before the start of the array will clamp /// to zero and any access past the end of the array will clamp to /// (array length - 1). -class Robustness : public Castable { +class Robustness final : public Castable { public: /// Storage class to be skipped in the transform enum class StorageClass { @@ -40,7 +40,7 @@ class Robustness : public Castable { }; /// Configuration options for the transform - struct Config : public Castable { + struct Config final : public Castable { /// Constructor Config(); diff --git a/src/tint/transform/robustness_test.cc b/src/tint/transform/robustness_test.cc index fb0e5a40a6..8dab595725 100644 --- a/src/tint/transform/robustness_test.cc +++ b/src/tint/transform/robustness_test.cc @@ -21,7 +21,7 @@ namespace { using RobustnessTest = TransformTest; -TEST_F(RobustnessTest, Array_Idx_Clamp) { +TEST_F(RobustnessTest, Array_Let_Idx_Clamp) { auto* src = R"( var a : array; @@ -35,7 +35,7 @@ fn f() { auto* expect = R"( var a : array; -let c : u32 = 1u; +const c : u32 = 1u; fn f() { let b : f32 = a[1u]; @@ -47,7 +47,33 @@ fn f() { EXPECT_EQ(expect, str(got)); } -TEST_F(RobustnessTest, Array_Idx_Clamp_OutOfOrder) { +TEST_F(RobustnessTest, Array_Const_Idx_Clamp) { + auto* src = R"( +var a : array; + +const c : u32 = 1u; + +fn f() { + let b : f32 = a[c]; +} +)"; + + auto* expect = R"( +var a : array; + +const c : u32 = 1u; + +fn f() { + let b : f32 = a[1u]; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(RobustnessTest, Array_Let_Idx_Clamp_OutOfOrder) { auto* src = R"( fn f() { let b : f32 = a[c]; @@ -63,7 +89,33 @@ fn f() { let b : f32 = a[1u]; } -let c : u32 = 1u; +const c : u32 = 1u; + +var a : array; +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(RobustnessTest, Array_Const_Idx_Clamp_OutOfOrder) { + auto* src = R"( +fn f() { + let b : f32 = a[c]; +} + +const c : u32 = 1u; + +var a : array; +)"; + + auto* expect = R"( +fn f() { + let b : f32 = a[1u]; +} + +const c : u32 = 1u; var a : array; )"; @@ -1392,7 +1444,7 @@ struct S { @group(0) @binding(0) var s : S; -let c : u32 = 1u; +const c : u32 = 1u; fn f() { let b : f32 = s.b[c]; @@ -1409,7 +1461,7 @@ struct S { @group(0) @binding(0) var s : S; -let c : u32 = 1u; +const c : u32 = 1u; fn f() { let b : f32 = s.b[min(1u, (arrayLength(&(s.b)) - 1u))]; diff --git a/src/tint/transform/simplify_pointers.cc b/src/tint/transform/simplify_pointers.cc index b8f82bc49a..396a31c76d 100644 --- a/src/tint/transform/simplify_pointers.cc +++ b/src/tint/transform/simplify_pointers.cc @@ -109,8 +109,8 @@ struct SimplifyPointers::State { } if (auto* user = ctx.src->Sem().Get(op.expr)) { auto* var = user->Variable(); - if (var->Is() && // - var->Declaration()->is_const && // + if (var->Is() && // + var->Declaration()->Is() && // var->Type()->Is()) { op.expr = var->Declaration()->constructor; continue; @@ -161,7 +161,7 @@ struct SimplifyPointers::State { // permitted. for (auto* node : ctx.src->ASTNodes().Objects()) { if (auto* let = node->As()) { - if (!let->variable->is_const) { + if (!let->variable->Is()) { continue; // Not a `let` declaration. Ignore. } @@ -181,8 +181,7 @@ struct SimplifyPointers::State { // Create a new variable auto saved_name = ctx.dst->Symbols().New( ctx.src->Symbols().NameFor(var->Declaration()->symbol) + "_save"); - auto* decl = - ctx.dst->Decl(ctx.dst->Let(saved_name, nullptr, ctx.Clone(idx_expr))); + auto* decl = ctx.dst->Decl(ctx.dst->Let(saved_name, ctx.Clone(idx_expr))); saved.emplace_back(decl); // Record the substitution of `idx_expr` to the saved variable // with the symbol `saved_name`. This will be used by the diff --git a/src/tint/transform/simplify_pointers.h b/src/tint/transform/simplify_pointers.h index 267b7b2d32..787c7d815f 100644 --- a/src/tint/transform/simplify_pointers.h +++ b/src/tint/transform/simplify_pointers.h @@ -31,7 +31,7 @@ namespace tint::transform { /// /// @note Depends on the following transforms to have been run first: /// * Unshadow -class SimplifyPointers : public Castable { +class SimplifyPointers final : public Castable { public: /// Constructor SimplifyPointers(); diff --git a/src/tint/transform/simplify_pointers_test.cc b/src/tint/transform/simplify_pointers_test.cc index f5658dedb3..9848ff31bb 100644 --- a/src/tint/transform/simplify_pointers_test.cc +++ b/src/tint/transform/simplify_pointers_test.cc @@ -236,7 +236,7 @@ fn foo() -> i32 { return 1; } -@stage(fragment) +@fragment fn main() { var arr = array(); for (let a = &arr[foo()]; ;) { @@ -251,7 +251,7 @@ fn foo() -> i32 { return 1; } -@stage(fragment) +@fragment fn main() { var arr = array(); let a_save = foo(); @@ -337,7 +337,7 @@ TEST_F(SimplifyPointersTest, ShadowPointer) { auto* src = R"( var a : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = &a; var a : i32 = (*x)[0]; @@ -350,7 +350,7 @@ fn main() { auto* expect = R"( var a : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var a_1 : i32 = a[0]; { diff --git a/src/tint/transform/single_entry_point.cc b/src/tint/transform/single_entry_point.cc index 82324c7745..133c836e07 100644 --- a/src/tint/transform/single_entry_point.cc +++ b/src/tint/transform/single_entry_point.cc @@ -64,38 +64,43 @@ void SingleEntryPoint::Run(CloneContext& ctx, const DataMap& inputs, DataMap&) c referenced_vars.emplace(var->Declaration()); } - // Clone any module-scope variables, types, and functions that are statically - // referenced by the target entry point. + // Clone any module-scope variables, types, and functions that are statically referenced by the + // target entry point. for (auto* decl : ctx.src->AST().GlobalDeclarations()) { - if (auto* ty = decl->As()) { - // TODO(jrprice): Strip unused types. - ctx.dst->AST().AddTypeDecl(ctx.Clone(ty)); - } else if (auto* var = decl->As()) { - if (referenced_vars.count(var)) { - if (var->is_overridable) { - // It is an overridable constant - if (!ast::HasAttribute(var->attributes)) { - // If the constant doesn't already have an @id() attribute, add one + Switch( + decl, // + [&](const ast::TypeDecl* ty) { + // TODO(jrprice): Strip unused types. + ctx.dst->AST().AddTypeDecl(ctx.Clone(ty)); + }, + [&](const ast::Override* override) { + if (referenced_vars.count(override)) { + if (!ast::HasAttribute(override->attributes)) { + // If the override doesn't already have an @id() attribute, add one // so that its allocated ID so that it won't be affected by other - // stripped away constants - auto* global = sem.Get(var)->As(); - const auto* id = ctx.dst->Id(global->ConstantId()); - ctx.InsertFront(var->attributes, id); + // stripped away overrides + auto* global = sem.Get(override); + const auto* id = ctx.dst->Id(global->OverrideId()); + ctx.InsertFront(override->attributes, id); } + ctx.dst->AST().AddGlobalVariable(ctx.Clone(override)); } - ctx.dst->AST().AddGlobalVariable(ctx.Clone(var)); - } - } else if (auto* func = decl->As()) { - if (sem.Get(func)->HasAncestorEntryPoint(entry_point->symbol)) { - ctx.dst->AST().AddFunction(ctx.Clone(func)); - } - } else if (auto* ext = decl->As()) { - ctx.dst->AST().AddEnable(ctx.Clone(ext)); - } else { - TINT_UNREACHABLE(Transform, ctx.dst->Diagnostics()) - << "unhandled global declaration: " << decl->TypeInfo().name; - return; - } + }, + [&](const ast::Variable* v) { // var, let + if (referenced_vars.count(v)) { + ctx.dst->AST().AddGlobalVariable(ctx.Clone(v)); + } + }, + [&](const ast::Function* func) { + if (sem.Get(func)->HasAncestorEntryPoint(entry_point->symbol)) { + ctx.dst->AST().AddFunction(ctx.Clone(func)); + } + }, + [&](const ast::Enable* ext) { ctx.dst->AST().AddEnable(ctx.Clone(ext)); }, + [&](Default) { + TINT_UNREACHABLE(Transform, ctx.dst->Diagnostics()) + << "unhandled global declaration: " << decl->TypeInfo().name; + }); } // Clone the entry point. diff --git a/src/tint/transform/single_entry_point.h b/src/tint/transform/single_entry_point.h index 0a922a78d0..59aa021466 100644 --- a/src/tint/transform/single_entry_point.h +++ b/src/tint/transform/single_entry_point.h @@ -25,10 +25,10 @@ namespace tint::transform { /// /// All module-scope variables, types, and functions that are not used by the /// target entry point will also be removed. -class SingleEntryPoint : public Castable { +class SingleEntryPoint final : public Castable { public: /// Configuration options for the transform - struct Config : public Castable { + struct Config final : public Castable { /// Constructor /// @param entry_point the name of the entry point to keep explicit Config(std::string entry_point = ""); diff --git a/src/tint/transform/single_entry_point_test.cc b/src/tint/transform/single_entry_point_test.cc index 80446212ce..020bd65c44 100644 --- a/src/tint/transform/single_entry_point_test.cc +++ b/src/tint/transform/single_entry_point_test.cc @@ -47,7 +47,7 @@ TEST_F(SingleEntryPointTest, Error_NoEntryPoints) { TEST_F(SingleEntryPointTest, Error_InvalidEntryPoint) { auto* src = R"( -@stage(vertex) +@vertex fn main() -> @builtin(position) vec4 { return vec4(); } @@ -68,7 +68,7 @@ TEST_F(SingleEntryPointTest, Error_NotAnEntryPoint) { auto* src = R"( fn foo() {} -@stage(fragment) +@fragment fn main() {} )"; @@ -85,7 +85,7 @@ fn main() {} TEST_F(SingleEntryPointTest, SingleEntryPoint) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { } )"; @@ -101,26 +101,26 @@ fn main() { TEST_F(SingleEntryPointTest, MultipleEntryPoints) { auto* src = R"( -@stage(vertex) +@vertex fn vert_main() -> @builtin(position) vec4 { return vec4(); } -@stage(fragment) +@fragment fn frag_main() { } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main2() { } )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { } )"; @@ -144,23 +144,23 @@ var c : f32; var d : f32; -@stage(vertex) +@vertex fn vert_main() -> @builtin(position) vec4 { a = 0.0; return vec4(); } -@stage(fragment) +@fragment fn frag_main() { b = 0.0; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { c = 0.0; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main2() { d = 0.0; } @@ -169,7 +169,7 @@ fn comp_main2() { auto* expect = R"( var c : f32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { c = 0.0; } @@ -186,40 +186,40 @@ fn comp_main1() { TEST_F(SingleEntryPointTest, GlobalConstants) { auto* src = R"( -let a : f32 = 1.0; +const a : f32 = 1.0; -let b : f32 = 1.0; +const b : f32 = 1.0; -let c : f32 = 1.0; +const c : f32 = 1.0; -let d : f32 = 1.0; +const d : f32 = 1.0; -@stage(vertex) +@vertex fn vert_main() -> @builtin(position) vec4 { let local_a : f32 = a; return vec4(); } -@stage(fragment) +@fragment fn frag_main() { let local_b : f32 = b; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { let local_c : f32 = c; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main2() { let local_d : f32 = d; } )"; auto* expect = R"( -let c : f32 = 1.0; +const c : f32 = 1.0; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { let local_c : f32 = c; } @@ -238,7 +238,33 @@ TEST_F(SingleEntryPointTest, WorkgroupSizeLetPreserved) { auto* src = R"( let size : i32 = 1; -@stage(compute) @workgroup_size(size) +@compute @workgroup_size(size) +fn main() { +} +)"; + + auto* expect = R"( +const size : i32 = 1; + +@compute @workgroup_size(size) +fn main() { +} +)"; + + SingleEntryPoint::Config cfg("main"); + + DataMap data; + data.Add(cfg); + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SingleEntryPointTest, WorkgroupSizeConstPreserved) { + auto* src = R"( +const size : i32 = 1; + +@compute @workgroup_size(size) fn main() { } )"; @@ -261,27 +287,27 @@ TEST_F(SingleEntryPointTest, OverridableConstants) { @id(0) override c3 : u32 = 1u; @id(9999) override c4 : u32 = 1u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { let local_d = c1; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main2() { let local_d = c2; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main3() { let local_d = c3; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main4() { let local_d = c4; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main5() { let local_d = 1u; } @@ -292,7 +318,7 @@ fn comp_main5() { auto* expect = R"( @id(1001) override c1 : u32 = 1u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { let local_d = c1; } @@ -310,7 +336,7 @@ fn comp_main1() { auto* expect = R"( @id(1) override c2 : u32 = 1u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main2() { let local_d = c2; } @@ -326,7 +352,7 @@ fn comp_main2() { auto* expect = R"( @id(0) override c3 : u32 = 1u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main3() { let local_d = c3; } @@ -342,7 +368,7 @@ fn comp_main3() { auto* expect = R"( @id(9999) override c4 : u32 = 1u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main4() { let local_d = c4; } @@ -356,7 +382,7 @@ fn comp_main4() { { SingleEntryPoint::Config cfg("comp_main5"); auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main5() { let local_d = 1u; } @@ -389,12 +415,12 @@ fn outer2() { inner_shared(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { outer1(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main2() { outer2(); } @@ -412,7 +438,7 @@ fn outer1() { inner_shared(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { outer1(); } @@ -463,12 +489,12 @@ fn outer2() { outer2_var = 0.0; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { outer1(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main2() { outer2(); } @@ -495,7 +521,7 @@ fn outer1() { outer1_var = 0.0; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main1() { outer1(); } diff --git a/src/tint/transform/spirv_atomic.cc b/src/tint/transform/spirv_atomic.cc new file mode 100644 index 0000000000..a6cfd5e856 --- /dev/null +++ b/src/tint/transform/spirv_atomic.cc @@ -0,0 +1,302 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/spirv_atomic.h" + +#include +#include +#include +#include +#include + +#include "src/tint/program_builder.h" +#include "src/tint/sem/block_statement.h" +#include "src/tint/sem/function.h" +#include "src/tint/sem/index_accessor_expression.h" +#include "src/tint/sem/member_accessor_expression.h" +#include "src/tint/sem/reference.h" +#include "src/tint/sem/statement.h" +#include "src/tint/utils/map.h" +#include "src/tint/utils/unique_vector.h" + +TINT_INSTANTIATE_TYPEINFO(tint::transform::SpirvAtomic); +TINT_INSTANTIATE_TYPEINFO(tint::transform::SpirvAtomic::Stub); + +namespace tint::transform { + +/// Private implementation of transform +struct SpirvAtomic::State { + private: + /// A struct that has been forked because a subset of members were made atomic. + struct ForkedStruct { + Symbol name; + std::unordered_set atomic_members; + }; + + CloneContext& ctx; + ProgramBuilder& b = *ctx.dst; + std::unordered_map forked_structs; + std::unordered_set atomic_variables; + utils::UniqueVector atomic_expressions; + + public: + /// Constructor + /// @param c the clone context + explicit State(CloneContext& c) : ctx(c) {} + + /// Runs the transform + void Run() { + // Look for stub functions generated by the SPIR-V reader, which are used as placeholders + // for atomic builtin calls. + for (auto* fn : ctx.src->AST().Functions()) { + if (auto* stub = ast::GetAttribute(fn->attributes)) { + auto* sem = ctx.src->Sem().Get(fn); + + for (auto* call : sem->CallSites()) { + // The first argument is always the atomic. + // The stub passes this by value, whereas the builtin wants a pointer. + // Take the address of the atomic argument. + auto& args = call->Declaration()->args; + auto out_args = ctx.Clone(args); + out_args[0] = b.AddressOf(out_args[0]); + + // Replace all callsites of this stub to a call to the real builtin + if (stub->builtin == sem::BuiltinType::kAtomicCompareExchangeWeak) { + // atomicCompareExchangeWeak returns a struct, so insert a call to it above + // the current statement, and replace the current call with the struct's + // `old_value` member. + auto* block = call->Stmt()->Block()->Declaration(); + auto old_value = b.Symbols().New("old_value"); + auto old_value_decl = b.Decl(b.Let( + old_value, + b.MemberAccessor(b.Call(sem::str(stub->builtin), std::move(out_args)), + b.Expr("old_value")))); + ctx.InsertBefore(block->statements, call->Stmt()->Declaration(), + old_value_decl); + ctx.Replace(call->Declaration(), b.Expr(old_value)); + } else { + ctx.Replace(call->Declaration(), + b.Call(sem::str(stub->builtin), std::move(out_args))); + } + + // Keep track of this expression. We'll need to modify the source variable / + // structure to be atomic. + atomic_expressions.Add(ctx.src->Sem().Get(args[0])); + } + + // Remove the stub from the output program + ctx.Remove(ctx.src->AST().GlobalDeclarations(), fn); + } + } + + // Transform all variables and structure members that were used in atomic operations as + // atomic types. This propagates up originating expression chains. + ProcessAtomicExpressions(); + + // If we need to change structure members, then fork them. + if (!forked_structs.empty()) { + ctx.ReplaceAll([&](const ast::Struct* str) { + // Always emit the original structure. This allows unrelated usage of the structure + // to continue working. + // auto* original = ctx.CloneWithoutTransform(str); + + // Is `str` a structure we need to fork? + if (auto it = forked_structs.find(str); it != forked_structs.end()) { + const auto& forked = it->second; + + // Re-create the structure swapping in the atomic-flavoured members + utils::Vector members; + members.Reserve(str->members.Length()); + for (size_t i = 0; i < str->members.Length(); i++) { + auto* member = str->members[i]; + if (forked.atomic_members.count(i)) { + auto* type = AtomicTypeFor(ctx.src->Sem().Get(member)->Type()); + auto name = ctx.src->Symbols().NameFor(member->symbol); + members.Push(b.Member(name, type, ctx.Clone(member->attributes))); + } else { + members.Push(ctx.Clone(member)); + } + } + b.Structure(forked.name, std::move(members)); + } + + // return original; + return nullptr; + }); + } + + // Replace assignments and decls from atomic variables with atomicLoads, and assignments to + // atomic variables with atomicStores. + ReplaceLoadsAndStores(); + + ctx.Clone(); + } + + private: + ForkedStruct& Fork(const ast::Struct* str) { + auto& forked = forked_structs[str]; + if (!forked.name.IsValid()) { + forked.name = b.Symbols().New(ctx.src->Symbols().NameFor(str->name) + "_atomic"); + } + return forked; + } + + void ProcessAtomicExpressions() { + for (size_t i = 0; i < atomic_expressions.Length(); i++) { + Switch( + atomic_expressions[i], // + [&](const sem::VariableUser* user) { + auto* v = user->Variable()->Declaration(); + if (v->type && atomic_variables.emplace(user->Variable()).second) { + ctx.Replace(v->type, AtomicTypeFor(user->Variable()->Type())); + } + if (auto* ctor = user->Variable()->Constructor()) { + atomic_expressions.Add(ctor); + } + }, + [&](const sem::StructMemberAccess* access) { + // Fork the struct (the first time) and mark member(s) that need to be made + // atomic. + auto* member = access->Member(); + Fork(member->Struct()->Declaration()).atomic_members.emplace(member->Index()); + atomic_expressions.Add(access->Object()); + }, + [&](const sem::IndexAccessorExpression* index) { + atomic_expressions.Add(index->Object()); + }, + [&](const sem::Expression* e) { + if (auto* unary = e->Declaration()->As()) { + atomic_expressions.Add(ctx.src->Sem().Get(unary->expr)); + } + }); + } + } + + const ast::Type* AtomicTypeFor(const sem::Type* ty) { + return Switch( + ty, // + [&](const sem::I32*) { return b.ty.atomic(CreateASTTypeFor(ctx, ty)); }, + [&](const sem::U32*) { return b.ty.atomic(CreateASTTypeFor(ctx, ty)); }, + [&](const sem::Struct* str) { return b.ty.type_name(Fork(str->Declaration()).name); }, + [&](const sem::Array* arr) { + return arr->IsRuntimeSized() + ? b.ty.array(AtomicTypeFor(arr->ElemType())) + : b.ty.array(AtomicTypeFor(arr->ElemType()), u32(arr->Count())); + }, + [&](const sem::Pointer* ptr) { + return b.ty.pointer(AtomicTypeFor(ptr->StoreType()), ptr->StorageClass(), + ptr->Access()); + }, + [&](const sem::Reference* ref) { return AtomicTypeFor(ref->StoreType()); }, + [&](Default) { + TINT_ICE(Transform, b.Diagnostics()) + << "unhandled type: " << ty->FriendlyName(ctx.src->Symbols()); + return nullptr; + }); + } + + void ReplaceLoadsAndStores() { + // Returns true if 'e' is a reference to an atomic variable or struct member + auto is_ref_to_atomic_var = [&](const sem::Expression* e) { + if (tint::Is(e->Type()) && e->SourceVariable() && + (atomic_variables.count(e->SourceVariable()) != 0)) { + // If it's a struct member, make sure it's one we marked as atomic + if (auto* ma = e->As()) { + auto it = forked_structs.find(ma->Member()->Struct()->Declaration()); + if (it != forked_structs.end()) { + auto& forked = it->second; + return forked.atomic_members.count(ma->Member()->Index()) != 0; + } + } + return true; + } + return false; + }; + + // Look for loads and stores via assignments and decls of atomic variables we've collected + // so far, and replace them with atomicLoad and atomicStore. + for (auto* atomic_var : atomic_variables) { + for (auto* vu : atomic_var->Users()) { + Switch( + vu->Stmt()->Declaration(), + [&](const ast::AssignmentStatement* assign) { + auto* sem_lhs = ctx.src->Sem().Get(assign->lhs); + if (is_ref_to_atomic_var(sem_lhs)) { + ctx.Replace(assign, [=] { + auto* lhs = ctx.CloneWithoutTransform(assign->lhs); + auto* rhs = ctx.CloneWithoutTransform(assign->rhs); + auto* call = b.Call(sem::str(sem::BuiltinType::kAtomicStore), + b.AddressOf(lhs), rhs); + return b.CallStmt(call); + }); + return; + } + + auto sem_rhs = ctx.src->Sem().Get(assign->rhs); + if (is_ref_to_atomic_var(sem_rhs)) { + ctx.Replace(assign->rhs, [=] { + auto* rhs = ctx.CloneWithoutTransform(assign->rhs); + return b.Call(sem::str(sem::BuiltinType::kAtomicLoad), + b.AddressOf(rhs)); + }); + return; + } + }, + [&](const ast::VariableDeclStatement* decl) { + auto* var = decl->variable; + if (auto* sem_ctor = ctx.src->Sem().Get(var->constructor)) { + if (is_ref_to_atomic_var(sem_ctor)) { + ctx.Replace(var->constructor, [=] { + auto* rhs = ctx.CloneWithoutTransform(var->constructor); + return b.Call(sem::str(sem::BuiltinType::kAtomicLoad), + b.AddressOf(rhs)); + }); + return; + } + } + }); + } + } + } +}; + +SpirvAtomic::SpirvAtomic() = default; +SpirvAtomic::~SpirvAtomic() = default; + +SpirvAtomic::Stub::Stub(ProgramID pid, ast::NodeID nid, sem::BuiltinType b) + : Base(pid, nid), builtin(b) {} +SpirvAtomic::Stub::~Stub() = default; +std::string SpirvAtomic::Stub::InternalName() const { + return "@internal(spirv-atomic " + std::string(sem::str(builtin)) + ")"; +} + +const SpirvAtomic::Stub* SpirvAtomic::Stub::Clone(CloneContext* ctx) const { + return ctx->dst->ASTNodes().Create(ctx->dst->ID(), + ctx->dst->AllocateNodeID(), builtin); +} + +bool SpirvAtomic::ShouldRun(const Program* program, const DataMap&) const { + for (auto* fn : program->AST().Functions()) { + if (ast::HasAttribute(fn->attributes)) { + return true; + } + } + return false; +} + +void SpirvAtomic::Run(CloneContext& ctx, const DataMap&, DataMap&) const { + State{ctx}.Run(); +} + +} // namespace tint::transform diff --git a/src/tint/transform/spirv_atomic.h b/src/tint/transform/spirv_atomic.h new file mode 100644 index 0000000000..e1311c5952 --- /dev/null +++ b/src/tint/transform/spirv_atomic.h @@ -0,0 +1,85 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_TRANSFORM_SPIRV_ATOMIC_H_ +#define SRC_TINT_TRANSFORM_SPIRV_ATOMIC_H_ + +#include + +#include "src/tint/ast/internal_attribute.h" +#include "src/tint/sem/builtin_type.h" +#include "src/tint/transform/transform.h" + +// Forward declarations +namespace tint { +class CloneContext; +} // namespace tint + +namespace tint::transform { + +/// SpirvAtomic is a transform that replaces calls to stub functions created by the SPIR-V reader +/// with calls to the WGSL atomic builtin. It also makes sure to replace variable declarations that +/// are the target of the atomic operations with an atomic declaration of the same type. For +/// structs, it creates a copy of the original struct with atomic members. +class SpirvAtomic final : public Castable { + public: + /// Constructor + SpirvAtomic(); + /// Destructor + ~SpirvAtomic() override; + + /// Stub is an attribute applied to stub SPIR-V reader generated functions that need to be + /// translated to an atomic builtin. + class Stub final : public Castable { + public: + /// @param pid the identifier of the program that owns this node + /// @param nid the unique node identifier + /// @param builtin the atomic builtin this stub represents + Stub(ProgramID pid, ast::NodeID nid, sem::BuiltinType builtin); + /// Destructor + ~Stub() override; + + /// @return a short description of the internal attribute which will be + /// displayed as `@internal()` + std::string InternalName() const override; + + /// Performs a deep clone of this object using the CloneContext `ctx`. + /// @param ctx the clone context + /// @return the newly cloned object + const Stub* Clone(CloneContext* ctx) const override; + + /// The type of the intrinsic + const sem::BuiltinType builtin; + }; + + /// @param program the program to inspect + /// @param data optional extra transform-specific input data + /// @returns true if this transform should be run for the given program + bool ShouldRun(const Program* program, const DataMap& data = {}) const override; + + protected: + struct State; + + /// Runs the transform using the CloneContext built for transforming a + /// program. Run() is responsible for calling Clone() on the CloneContext. + /// @param ctx the CloneContext primed with the input program and + /// ProgramBuilder + /// @param inputs optional extra transform-specific input data + /// @param outputs optional extra transform-specific output data + void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; +}; + +} // namespace tint::transform + +#endif // SRC_TINT_TRANSFORM_SPIRV_ATOMIC_H_ diff --git a/src/tint/transform/spirv_atomic_test.cc b/src/tint/transform/spirv_atomic_test.cc new file mode 100644 index 0000000000..7f6db34e16 --- /dev/null +++ b/src/tint/transform/spirv_atomic_test.cc @@ -0,0 +1,1410 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/spirv_atomic.h" + +#include +#include +#include +#include + +#include "src/tint/reader/wgsl/parser_impl.h" +#include "src/tint/transform/test_helper.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::transform { +namespace { + +class SpirvAtomicTest : public TransformTest { + public: + Output Run(std::string in) { + auto file = std::make_unique("test", std::move(in)); + auto parser = reader::wgsl::ParserImpl(file.get()); + parser.Parse(); + + auto& b = parser.builder(); + + sem::BuiltinType two_params[] = { + sem::BuiltinType::kAtomicExchange, sem::BuiltinType::kAtomicAdd, + sem::BuiltinType::kAtomicSub, sem::BuiltinType::kAtomicMin, + sem::BuiltinType::kAtomicMax, sem::BuiltinType::kAtomicAnd, + sem::BuiltinType::kAtomicOr, sem::BuiltinType::kAtomicXor, + }; + for (auto& a : two_params) { + b.Func(std::string{"stub_"} + sem::str(a) + "_u32", + utils::Vector{ + b.Param("p0", b.ty.u32()), + b.Param("p1", b.ty.u32()), + }, + b.ty.u32(), + utils::Vector{ + b.Return(0_u), + }, + utils::Vector{ + b.ASTNodes().Create(b.ID(), b.AllocateNodeID(), a), + }); + b.Func(std::string{"stub_"} + sem::str(a) + "_i32", + utils::Vector{ + b.Param("p0", b.ty.i32()), + b.Param("p1", b.ty.i32()), + }, + b.ty.i32(), + utils::Vector{ + b.Return(0_i), + }, + utils::Vector{ + b.ASTNodes().Create(b.ID(), b.AllocateNodeID(), a), + }); + } + + b.Func("stub_atomicLoad_u32", + utils::Vector{ + b.Param("p0", b.ty.u32()), + }, + b.ty.u32(), + utils::Vector{ + b.Return(0_u), + }, + utils::Vector{ + b.ASTNodes().Create(b.ID(), b.AllocateNodeID(), + sem::BuiltinType::kAtomicLoad), + }); + b.Func("stub_atomicLoad_i32", + utils::Vector{ + b.Param("p0", b.ty.i32()), + }, + b.ty.i32(), + utils::Vector{ + b.Return(0_i), + }, + utils::Vector{ + b.ASTNodes().Create(b.ID(), b.AllocateNodeID(), + sem::BuiltinType::kAtomicLoad), + }); + + b.Func("stub_atomicStore_u32", + utils::Vector{ + b.Param("p0", b.ty.u32()), + b.Param("p1", b.ty.u32()), + }, + b.ty.void_(), utils::Empty, + utils::Vector{ + b.ASTNodes().Create(b.ID(), b.AllocateNodeID(), + sem::BuiltinType::kAtomicStore), + }); + b.Func("stub_atomicStore_i32", + utils::Vector{ + b.Param("p0", b.ty.i32()), + b.Param("p1", b.ty.i32()), + }, + b.ty.void_(), utils::Empty, + utils::Vector{ + b.ASTNodes().Create(b.ID(), b.AllocateNodeID(), + sem::BuiltinType::kAtomicStore), + }); + + b.Func("stub_atomic_compare_exchange_weak_u32", + utils::Vector{ + b.Param("p0", b.ty.u32()), + b.Param("p1", b.ty.u32()), + b.Param("p2", b.ty.u32()), + }, + b.ty.u32(), + utils::Vector{ + b.Return(0_u), + }, + utils::Vector{ + b.ASTNodes().Create( + b.ID(), b.AllocateNodeID(), sem::BuiltinType::kAtomicCompareExchangeWeak), + }); + b.Func("stub_atomic_compare_exchange_weak_i32", + utils::Vector{b.Param("p0", b.ty.i32()), b.Param("p1", b.ty.i32()), + b.Param("p2", b.ty.i32())}, + b.ty.i32(), + utils::Vector{ + b.Return(0_i), + }, + utils::Vector{ + b.ASTNodes().Create( + b.ID(), b.AllocateNodeID(), sem::BuiltinType::kAtomicCompareExchangeWeak), + }); + + // Keep this pointer alive after Transform() returns + files_.emplace_back(std::move(file)); + + return TransformTest::Run(Program(std::move(b))); + } + + private: + std::vector> files_; +}; + +TEST_F(SpirvAtomicTest, ArrayOfU32) { + auto* src = R"( +var wg : array; + +fn f() { + stub_atomicStore_u32(wg[1], 1u); +} +)"; + + auto* expect = R"( +var wg : array, 4u>; + +fn f() { + atomicStore(&(wg[1]), 1u); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ArraysOfU32) { + auto* src = R"( +var wg : array, 2>, 3>; + +fn f() { + stub_atomicStore_u32(wg[2][1][0], 1u); +} +)"; + + auto* expect = R"( +var wg : array, 1u>, 2u>, 3u>; + +fn f() { + atomicStore(&(wg[2][1][0]), 1u); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AliasedArraysOfU32) { + auto* src = R"( +type A0 = u32; + +type A1 = array; + +type A2 = array; + +type A3 = array; + +var wg : A3; + +fn f() { + stub_atomicStore_u32(wg[2][1][0], 1u); +} +)"; + + auto* expect = R"( +type A0 = u32; + +type A1 = array; + +type A2 = array; + +type A3 = array; + +var wg : array, 1u>, 2u>, 3u>; + +fn f() { + atomicStore(&(wg[2][1][0]), 1u); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, FlatStructSingleAtomic) { + auto* src = R"( +struct S { + a : u32, +} + +var wg : S; + +fn f() { + stub_atomicStore_u32(wg.a, 1u); +} +)"; + + auto* expect = R"( +struct S_atomic { + a : atomic, +} + +struct S { + a : u32, +} + +var wg : S_atomic; + +fn f() { + atomicStore(&(wg.a), 1u); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, FlatStructMultipleAtomic) { + auto* src = R"( +struct S { + a : u32, + b : i32, +} + +var wg : S; + +fn f1() { + stub_atomicStore_u32(wg.a, 1u); +} + +fn f2() { + stub_atomicStore_i32(wg.b, 2i); +} +)"; + + auto* expect = R"( +struct S_atomic { + a : atomic, + b : atomic, +} + +struct S { + a : u32, + b : i32, +} + +var wg : S_atomic; + +fn f1() { + atomicStore(&(wg.a), 1u); +} + +fn f2() { + atomicStore(&(wg.b), 2i); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, NestedStruct) { + auto* src = R"( +struct S0 { + a : u32, + b : i32, + c : u32, +} + +struct S1 { + a : i32, + b : u32, + c : S0, +} + +struct S2 { + a : i32, + b : S1, + c : u32, +} + +var wg : S2; + +fn f() { + stub_atomicStore_u32(wg.b.c.a, 1u); +} +)"; + + auto* expect = R"( +struct S0_atomic { + a : atomic, + b : i32, + c : u32, +} + +struct S0 { + a : u32, + b : i32, + c : u32, +} + +struct S1_atomic { + a : i32, + b : u32, + c : S0_atomic, +} + +struct S1 { + a : i32, + b : u32, + c : S0, +} + +struct S2_atomic { + a : i32, + b : S1_atomic, + c : u32, +} + +struct S2 { + a : i32, + b : S1, + c : u32, +} + +var wg : S2_atomic; + +fn f() { + atomicStore(&(wg.b.c.a), 1u); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ArrayOfStruct) { + auto* src = R"( +struct S { + a : u32, + b : i32, + c : u32, +} + +@group(0) @binding(1) var arr : array; + +fn f() { + stub_atomicStore_i32(arr[4].b, 1i); +} +)"; + + auto* expect = R"( +struct S_atomic { + a : u32, + b : atomic, + c : u32, +} + +struct S { + a : u32, + b : i32, + c : u32, +} + +@group(0) @binding(1) var arr : array; + +fn f() { + atomicStore(&(arr[4].b), 1i); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, StructOfArray) { + auto* src = R"( +struct S { + a : array, +} + +@group(0) @binding(1) var s : S; + +fn f() { + stub_atomicStore_i32(s.a[4], 1i); +} +)"; + + auto* expect = R"( +struct S_atomic { + a : array>, +} + +struct S { + a : array, +} + +@group(0) @binding(1) var s : S_atomic; + +fn f() { + atomicStore(&(s.a[4]), 1i); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ViaPtrLet) { + auto* src = R"( +struct S { + i : i32, +} + +@group(0) @binding(1) var s : S; + +fn f() { + let p0 = &(s); + let p1 : ptr = &((*(p0)).i); + stub_atomicStore_i32(*p1, 1i); +} +)"; + + auto* expect = + R"( +struct S_atomic { + i : atomic, +} + +struct S { + i : i32, +} + +@group(0) @binding(1) var s : S_atomic; + +fn f() { + let p0 = &(s); + let p1 : ptr, read_write> = &((*(p0)).i); + atomicStore(&(*(p1)), 1i); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, StructIsolatedMixedUsage) { + auto* src = R"( +struct S { + i : i32, +} + +@group(0) @binding(1) var s : S; + +fn f() { + stub_atomicStore_i32(s.i, 1i); +} + +fn another_usage() { + var s : S; + let x : i32 = s.i; + s.i = 3i; +} +)"; + + auto* expect = + R"( +struct S_atomic { + i : atomic, +} + +struct S { + i : i32, +} + +@group(0) @binding(1) var s : S_atomic; + +fn f() { + atomicStore(&(s.i), 1i); +} + +fn another_usage() { + var s : S; + let x : i32 = s.i; + s.i = 3i; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +// This sort of mixed usage isn't handled yet. Not sure if we need to just yet. +// If we don't, then the transform should give sensible diagnostics instead of producing invalid +// WGSL. +// TODO(crbug.com/tint/1595) +TEST_F(SpirvAtomicTest, DISABLED_StructComplexMixedUsage) { + auto* src = R"( +struct S { + i : i32, +} + +@group(0) @binding(1) var s : S; + +fn f() { + let x : i32 = s.i; + stub_atomicStore_i32(s.i, 1i); + s.i = 3i; +} +)"; + + auto* expect = + R"( +struct S_atomic { + i : atomic, +} + +struct S { + i : i32, +} + +@group(0) @binding(1) var s : S_atomic; + +fn f() { + let x : i32 = atomicLoad(&s.i); + stub_atomicStore_i32(s.i, 1i); + atomicStore(&(s.i), 1i); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicLoad) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomicLoad_u32(wg_u32);} + {let r = stub_atomicLoad_i32(wg_i32);} + {let r = stub_atomicLoad_u32(sg_u32);} + {let r = stub_atomicLoad_i32(sg_i32);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let r = atomicLoad(&(wg_u32)); + } + { + let r = atomicLoad(&(wg_i32)); + } + { + let r = atomicLoad(&(sg_u32)); + } + { + let r = atomicLoad(&(sg_i32)); + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicExchange) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomicExchange_u32(wg_u32, 123u);} + {let r = stub_atomicExchange_i32(wg_i32, 123i);} + {let r = stub_atomicExchange_u32(sg_u32, 123u);} + {let r = stub_atomicExchange_i32(sg_i32, 123i);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let r = atomicExchange(&(wg_u32), 123u); + } + { + let r = atomicExchange(&(wg_i32), 123i); + } + { + let r = atomicExchange(&(sg_u32), 123u); + } + { + let r = atomicExchange(&(sg_i32), 123i); + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicAdd) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomicAdd_u32(wg_u32, 123u);} + {let r = stub_atomicAdd_i32(wg_i32, 123i);} + {let r = stub_atomicAdd_u32(sg_u32, 123u);} + {let r = stub_atomicAdd_i32(sg_i32, 123i);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let r = atomicAdd(&(wg_u32), 123u); + } + { + let r = atomicAdd(&(wg_i32), 123i); + } + { + let r = atomicAdd(&(sg_u32), 123u); + } + { + let r = atomicAdd(&(sg_i32), 123i); + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicSub) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomicSub_u32(wg_u32, 123u);} + {let r = stub_atomicSub_i32(wg_i32, 123i);} + {let r = stub_atomicSub_u32(sg_u32, 123u);} + {let r = stub_atomicSub_i32(sg_i32, 123i);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let r = atomicSub(&(wg_u32), 123u); + } + { + let r = atomicSub(&(wg_i32), 123i); + } + { + let r = atomicSub(&(sg_u32), 123u); + } + { + let r = atomicSub(&(sg_i32), 123i); + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicMin) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomicMin_u32(wg_u32, 123u);} + {let r = stub_atomicMin_i32(wg_i32, 123i);} + {let r = stub_atomicMin_u32(sg_u32, 123u);} + {let r = stub_atomicMin_i32(sg_i32, 123i);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let r = atomicMin(&(wg_u32), 123u); + } + { + let r = atomicMin(&(wg_i32), 123i); + } + { + let r = atomicMin(&(sg_u32), 123u); + } + { + let r = atomicMin(&(sg_i32), 123i); + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicMax) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomicMax_u32(wg_u32, 123u);} + {let r = stub_atomicMax_i32(wg_i32, 123i);} + {let r = stub_atomicMax_u32(sg_u32, 123u);} + {let r = stub_atomicMax_i32(sg_i32, 123i);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let r = atomicMax(&(wg_u32), 123u); + } + { + let r = atomicMax(&(wg_i32), 123i); + } + { + let r = atomicMax(&(sg_u32), 123u); + } + { + let r = atomicMax(&(sg_i32), 123i); + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicAnd) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomicAnd_u32(wg_u32, 123u);} + {let r = stub_atomicAnd_i32(wg_i32, 123i);} + {let r = stub_atomicAnd_u32(sg_u32, 123u);} + {let r = stub_atomicAnd_i32(sg_i32, 123i);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let r = atomicAnd(&(wg_u32), 123u); + } + { + let r = atomicAnd(&(wg_i32), 123i); + } + { + let r = atomicAnd(&(sg_u32), 123u); + } + { + let r = atomicAnd(&(sg_i32), 123i); + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicOr) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomicOr_u32(wg_u32, 123u);} + {let r = stub_atomicOr_i32(wg_i32, 123i);} + {let r = stub_atomicOr_u32(sg_u32, 123u);} + {let r = stub_atomicOr_i32(sg_i32, 123i);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let r = atomicOr(&(wg_u32), 123u); + } + { + let r = atomicOr(&(wg_i32), 123i); + } + { + let r = atomicOr(&(sg_u32), 123u); + } + { + let r = atomicOr(&(sg_i32), 123i); + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicXor) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomicXor_u32(wg_u32, 123u);} + {let r = stub_atomicXor_i32(wg_i32, 123i);} + {let r = stub_atomicXor_u32(sg_u32, 123u);} + {let r = stub_atomicXor_i32(sg_i32, 123i);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let r = atomicXor(&(wg_u32), 123u); + } + { + let r = atomicXor(&(wg_i32), 123i); + } + { + let r = atomicXor(&(sg_u32), 123u); + } + { + let r = atomicXor(&(sg_i32), 123i); + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, AtomicCompareExchangeWeak) { + auto* src = R"( +var wg_u32 : u32; +var wg_i32 : i32; +@group(0) @binding(0) var sg_u32 : u32; +@group(0) @binding(1) var sg_i32 : i32; + +fn f() { + {let r = stub_atomic_compare_exchange_weak_u32(wg_u32, 123u, 456u);} + {let r = stub_atomic_compare_exchange_weak_i32(wg_i32, 123i, 456i);} + {let r = stub_atomic_compare_exchange_weak_u32(sg_u32, 123u, 456u);} + {let r = stub_atomic_compare_exchange_weak_i32(sg_i32, 123i, 456i);} +} +)"; + + auto* expect = + R"( +var wg_u32 : atomic; + +var wg_i32 : atomic; + +@group(0) @binding(0) var sg_u32 : atomic; + +@group(0) @binding(1) var sg_i32 : atomic; + +fn f() { + { + let old_value = atomicCompareExchangeWeak(&(wg_u32), 123u, 456u).old_value; + let r = old_value; + } + { + let old_value_2 = atomicCompareExchangeWeak(&(wg_i32), 123i, 456i).old_value; + let r = old_value_2; + } + { + let old_value_1 = atomicCompareExchangeWeak(&(sg_u32), 123u, 456u).old_value; + let r = old_value_1; + } + { + let old_value_3 = atomicCompareExchangeWeak(&(sg_i32), 123i, 456i).old_value; + let r = old_value_3; + } +} +)"; + + auto got = Run(src); + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ReplaceAssignsAndDecls_Scaler) { + auto* src = R"( +var wg : u32; + +fn f() { + stub_atomicAdd_u32(wg, 1u); + + wg = 0u; + let a = wg; + var b : u32; + b = wg; +} +)"; + + auto* expect = R"( +var wg : atomic; + +fn f() { + atomicAdd(&(wg), 1u); + atomicStore(&(wg), 0u); + let a = atomicLoad(&(wg)); + var b : u32; + b = atomicLoad(&(wg)); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ReplaceAssignsAndDecls_Struct) { + auto* src = R"( +struct S { + a : u32, +} + +var wg : S; + +fn f() { + stub_atomicAdd_u32(wg.a, 1u); + + wg.a = 0u; + let a = wg.a; + var b : u32; + b = wg.a; +} +)"; + + auto* expect = R"( +struct S_atomic { + a : atomic, +} + +struct S { + a : u32, +} + +var wg : S_atomic; + +fn f() { + atomicAdd(&(wg.a), 1u); + atomicStore(&(wg.a), 0u); + let a = atomicLoad(&(wg.a)); + var b : u32; + b = atomicLoad(&(wg.a)); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ReplaceAssignsAndDecls_NestedStruct) { + auto* src = R"( +struct S0 { + a : u32, +} + +struct S1 { + s0 : S0 +} + +var wg : S1; + +fn f() { + stub_atomicAdd_u32(wg.s0.a, 1u); + + wg.s0.a = 0u; + let a = wg.s0.a; + var b : u32; + b = wg.s0.a; +} +)"; + + auto* expect = R"( +struct S0_atomic { + a : atomic, +} + +struct S0 { + a : u32, +} + +struct S1_atomic { + s0 : S0_atomic, +} + +struct S1 { + s0 : S0, +} + +var wg : S1_atomic; + +fn f() { + atomicAdd(&(wg.s0.a), 1u); + atomicStore(&(wg.s0.a), 0u); + let a = atomicLoad(&(wg.s0.a)); + var b : u32; + b = atomicLoad(&(wg.s0.a)); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ReplaceAssignsAndDecls_StructMultipleAtomics) { + auto* src = R"( +struct S { + a : u32, + b : u32, + c : u32, +} + +var wg : S; + +fn f() { + stub_atomicAdd_u32(wg.a, 1u); + stub_atomicAdd_u32(wg.b, 1u); + + wg.a = 0u; + let a = wg.a; + var b : u32; + b = wg.a; + + wg.b = 0u; + let c = wg.b; + var d : u32; + d = wg.b; + + wg.c = 0u; + let e = wg.c; + var f : u32; + f = wg.c; +} +)"; + + auto* expect = R"( +struct S_atomic { + a : atomic, + b : atomic, + c : u32, +} + +struct S { + a : u32, + b : u32, + c : u32, +} + +var wg : S_atomic; + +fn f() { + atomicAdd(&(wg.a), 1u); + atomicAdd(&(wg.b), 1u); + atomicStore(&(wg.a), 0u); + let a = atomicLoad(&(wg.a)); + var b : u32; + b = atomicLoad(&(wg.a)); + atomicStore(&(wg.b), 0u); + let c = atomicLoad(&(wg.b)); + var d : u32; + d = atomicLoad(&(wg.b)); + wg.c = 0u; + let e = wg.c; + var f : u32; + f = wg.c; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ReplaceAssignsAndDecls_ArrayOfScalar) { + auto* src = R"( +var wg : array; + +fn f() { + stub_atomicAdd_u32(wg[1], 1u); + + wg[1] = 0u; + let a = wg[1]; + var b : u32; + b = wg[1]; +} +)"; + + auto* expect = R"( +var wg : array, 4u>; + +fn f() { + atomicAdd(&(wg[1]), 1u); + atomicStore(&(wg[1]), 0u); + let a = atomicLoad(&(wg[1])); + var b : u32; + b = atomicLoad(&(wg[1])); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ReplaceAssignsAndDecls_ArrayOfStruct) { + auto* src = R"( +struct S { + a : u32, +} + +var wg : array; + +fn f() { + stub_atomicAdd_u32(wg[1].a, 1u); + + wg[1].a = 0u; + let a = wg[1].a; + var b : u32; + b = wg[1].a; +} +)"; + + auto* expect = R"( +struct S_atomic { + a : atomic, +} + +struct S { + a : u32, +} + +var wg : array; + +fn f() { + atomicAdd(&(wg[1].a), 1u); + atomicStore(&(wg[1].a), 0u); + let a = atomicLoad(&(wg[1].a)); + var b : u32; + b = atomicLoad(&(wg[1].a)); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ReplaceAssignsAndDecls_StructOfArray) { + auto* src = R"( +struct S { + a : array, +} + +@group(0) @binding(1) var s : S; + +fn f() { + stub_atomicAdd_u32(s.a[4], 1u); + + s.a[4] = 0u; + let a = s.a[4]; + var b : u32; + b = s.a[4]; +} +)"; + + auto* expect = R"( +struct S_atomic { + a : array>, +} + +struct S { + a : array, +} + +@group(0) @binding(1) var s : S_atomic; + +fn f() { + atomicAdd(&(s.a[4]), 1u); + atomicStore(&(s.a[4]), 0u); + let a = atomicLoad(&(s.a[4])); + var b : u32; + b = atomicLoad(&(s.a[4])); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SpirvAtomicTest, ReplaceAssignsAndDecls_ViaPtrLet) { + auto* src = R"( +struct S { + i : u32, +} + +@group(0) @binding(1) var s : S; + +fn f() { + let p0 = &(s); + let p1 : ptr = &((*(p0)).i); + stub_atomicAdd_u32(*p1, 1u); + + *p1 = 0u; + let a = *p1; + var b : u32; + b = *p1; +} +)"; + + auto* expect = R"( +struct S_atomic { + i : atomic, +} + +struct S { + i : u32, +} + +@group(0) @binding(1) var s : S_atomic; + +fn f() { + let p0 = &(s); + let p1 : ptr, read_write> = &((*(p0)).i); + atomicAdd(&(*(p1)), 1u); + atomicStore(&(*(p1)), 0u); + let a = atomicLoad(&(*(p1))); + var b : u32; + b = atomicLoad(&(*(p1))); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} +} // namespace +} // namespace tint::transform diff --git a/src/tint/transform/substitute_override.cc b/src/tint/transform/substitute_override.cc new file mode 100644 index 0000000000..de597c28fb --- /dev/null +++ b/src/tint/transform/substitute_override.cc @@ -0,0 +1,96 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/substitute_override.h" + +#include + +#include "src/tint/program_builder.h" +#include "src/tint/sem/variable.h" + +TINT_INSTANTIATE_TYPEINFO(tint::transform::SubstituteOverride); +TINT_INSTANTIATE_TYPEINFO(tint::transform::SubstituteOverride::Config); + +namespace tint::transform { + +SubstituteOverride::SubstituteOverride() = default; + +SubstituteOverride::~SubstituteOverride() = default; + +bool SubstituteOverride::ShouldRun(const Program* program, const DataMap&) const { + for (auto* node : program->AST().GlobalVariables()) { + if (node->Is()) { + return true; + } + } + return false; +} + +void SubstituteOverride::Run(CloneContext& ctx, const DataMap& config, DataMap&) const { + const auto* data = config.Get(); + if (!data) { + ctx.dst->Diagnostics().add_error(diag::System::Transform, + "Missing override substitution data"); + return; + } + + ctx.ReplaceAll([&](const ast::Override* w) -> const ast::Const* { + auto* sem = ctx.src->Sem().Get(w); + + auto src = ctx.Clone(w->source); + auto sym = ctx.Clone(w->symbol); + auto* ty = ctx.Clone(w->type); + + // No replacement provided, just clone the override node as a const. + auto iter = data->map.find(sem->OverrideId()); + if (iter == data->map.end()) { + if (!w->constructor) { + ctx.dst->Diagnostics().add_error( + diag::System::Transform, + "Initializer not provided for override, and override not overridden."); + return nullptr; + } + return ctx.dst->Const(src, sym, ty, ctx.Clone(w->constructor)); + } + + auto value = iter->second; + auto* ctor = Switch( + sem->Type(), + [&](const sem::Bool*) { return ctx.dst->Expr(!std::equal_to()(value, 0.0)); }, + [&](const sem::I32*) { return ctx.dst->Expr(i32(value)); }, + [&](const sem::U32*) { return ctx.dst->Expr(u32(value)); }, + [&](const sem::F32*) { return ctx.dst->Expr(f32(value)); }, + [&](const sem::F16*) { return ctx.dst->Expr(f16(value)); }); + + if (!ctor) { + ctx.dst->Diagnostics().add_error(diag::System::Transform, + "Failed to create override expression"); + return nullptr; + } + + return ctx.dst->Const(src, sym, ty, ctor); + }); + + ctx.Clone(); +} + +SubstituteOverride::Config::Config() = default; + +SubstituteOverride::Config::Config(const Config&) = default; + +SubstituteOverride::Config::~Config() = default; + +SubstituteOverride::Config& SubstituteOverride::Config::operator=(const Config&) = default; + +} // namespace tint::transform diff --git a/src/tint/transform/substitute_override.h b/src/tint/transform/substitute_override.h new file mode 100644 index 0000000000..9ea315d92d --- /dev/null +++ b/src/tint/transform/substitute_override.h @@ -0,0 +1,91 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_TRANSFORM_SUBSTITUTE_OVERRIDE_H_ +#define SRC_TINT_TRANSFORM_SUBSTITUTE_OVERRIDE_H_ + +#include +#include + +#include "tint/override_id.h" + +#include "src/tint/transform/transform.h" + +namespace tint::transform { + +/// A transform that replaces overrides with the constant values provided. +/// +/// # Example +/// ``` +/// override width: f32; +/// @id(1) override height: i32 = 4; +/// override depth = 1i; +/// ``` +/// +/// When transformed with `width` -> 1, `1` -> 22, `depth` -> 42 +/// +/// ``` +/// const width: f32 = 1f; +/// const height: i32 = 22i; +/// const depth = 42i; +/// ``` +/// +/// @see crbug.com/tint/1582 +class SubstituteOverride final : public Castable { + public: + /// Configuration options for the transform + struct Config final : public Castable { + /// Constructor + Config(); + + /// Copy constructor + Config(const Config&); + + /// Destructor + ~Config() override; + + /// Assignment operator + /// @returns this Config + Config& operator=(const Config&); + + /// The map of override identifier to the override value. + /// The value is always a double coming into the transform and will be + /// converted to the correct type through and initializer. + std::unordered_map map; + }; + + /// Constructor + SubstituteOverride(); + + /// Destructor + ~SubstituteOverride() override; + + /// @param program the program to inspect + /// @param data optional extra transform-specific input data + /// @returns true if this transform should be run for the given program + bool ShouldRun(const Program* program, const DataMap& data = {}) const override; + + protected: + /// Runs the transform using the CloneContext built for transforming a + /// program. Run() is responsible for calling Clone() on the CloneContext. + /// @param ctx the CloneContext primed with the input program and + /// ProgramBuilder + /// @param inputs optional extra transform-specific input data + /// @param outputs optional extra transform-specific output data + void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; +}; + +} // namespace tint::transform + +#endif // SRC_TINT_TRANSFORM_SUBSTITUTE_OVERRIDE_H_ diff --git a/src/tint/transform/substitute_override_test.cc b/src/tint/transform/substitute_override_test.cc new file mode 100644 index 0000000000..f84c32cd31 --- /dev/null +++ b/src/tint/transform/substitute_override_test.cc @@ -0,0 +1,242 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/substitute_override.h" + +#include "src/tint/transform/test_helper.h" + +namespace tint::transform { +namespace { + +using SubstituteOverrideTest = TransformTest; + +TEST_F(SubstituteOverrideTest, Error_NoData) { + auto* src = R"( +override width: i32; +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + auto* expect = "error: Missing override substitution data"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SubstituteOverrideTest, Error_NoOverrideValue) { + auto* src = R"( +override width: i32; +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + auto* expect = "error: Initializer not provided for override, and override not overridden."; + + SubstituteOverride::Config cfg; + DataMap data; + data.Add(cfg); + + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SubstituteOverrideTest, Module_NoOverrides) { + auto* src = R"( +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + auto* expect = R"( +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + SubstituteOverride::Config cfg; + + DataMap data; + data.Add(cfg); + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SubstituteOverrideTest, ImplicitId) { + auto* src = R"( +override i_width: i32; +override i_height = 1i; + +override f_width: f32; +override f_height = 1.f; + +// TODO(crbug.com/tint/1473) +// override h_width: f16; +// override h_height = 1.h; + +override b_width: bool; +override b_height = true; + +override o_width = 2i; + +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + auto* expect = R"( +const i_width : i32 = 42i; + +const i_height = 11i; + +const f_width : f32 = 22.299999237f; + +const f_height = 12.399999619f; + +const b_width : bool = true; + +const b_height = false; + +const o_width = 2i; + +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + SubstituteOverride::Config cfg; + cfg.map.insert({OverrideId{0}, 42.0}); + cfg.map.insert({OverrideId{1}, 11.0}); + cfg.map.insert({OverrideId{2}, 22.3}); + cfg.map.insert({OverrideId{3}, 12.4}); + // cfg.map.insert({OverrideId{4}, 9.4}); + // cfg.map.insert({OverrideId{5}, 3.4}); + cfg.map.insert({OverrideId{4}, 1.0}); + cfg.map.insert({OverrideId{5}, 0.0}); + + DataMap data; + data.Add(cfg); + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SubstituteOverrideTest, ExplicitId) { + auto* src = R"( +enable f16; + +@id(0) override i_width: i32; +@id(10) override i_height = 1i; + +@id(1) override f_width: f32; +@id(9) override f_height = 1.f; + +// TODO(crbug.com/tint/1473) +// @id(2) override h_width: f16; +// @id(8) override h_height = 1.h; + +@id(3) override b_width: bool; +@id(7) override b_height = true; + +@id(5) override o_width = 2i; + +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + auto* expect = R"( +enable f16; + +const i_width : i32 = 42i; + +const i_height = 11i; + +const f_width : f32 = 22.299999237f; + +const f_height = 12.399999619f; + +const b_width : bool = true; + +const b_height = false; + +const o_width = 13i; + +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + SubstituteOverride::Config cfg; + cfg.map.insert({OverrideId{0}, 42.0}); + cfg.map.insert({OverrideId{10}, 11.0}); + cfg.map.insert({OverrideId{1}, 22.3}); + cfg.map.insert({OverrideId{9}, 12.4}); + cfg.map.insert({OverrideId{2}, 9.4}); + cfg.map.insert({OverrideId{8}, 3.4}); + cfg.map.insert({OverrideId{3}, 1.0}); + cfg.map.insert({OverrideId{7}, 0.0}); + cfg.map.insert({OverrideId{5}, 13}); + + DataMap data; + data.Add(cfg); + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(SubstituteOverrideTest, Identifier_Expression) { + auto* src = R"( +override i_height = ~2i; + +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + auto* expect = R"( +const i_height = 11i; + +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(); +} +)"; + + SubstituteOverride::Config cfg; + cfg.map.insert({OverrideId{0}, 11.0}); + + DataMap data; + data.Add(cfg); + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +} // namespace +} // namespace tint::transform diff --git a/src/tint/transform/transform.cc b/src/tint/transform/transform.cc index e3d0ea9475..3adfff6b26 100644 --- a/src/tint/transform/transform.cc +++ b/src/tint/transform/transform.cc @@ -87,6 +87,9 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const sem::Type* if (ty->Is()) { return ctx.dst->create(); } + if (ty->Is()) { + return ctx.dst->create(); + } if (ty->Is()) { return ctx.dst->create(); } @@ -103,9 +106,9 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const sem::Type* } if (auto* a = ty->As()) { auto* el = CreateASTTypeFor(ctx, a->ElemType()); - ast::AttributeList attrs; + utils::Vector attrs; if (!a->IsStrideImplicit()) { - attrs.emplace_back(ctx.dst->create(a->Stride())); + attrs.Push(ctx.dst->create(a->Stride())); } if (a->IsRuntimeSized()) { return ctx.dst->ty.array(el, nullptr, std::move(attrs)); diff --git a/src/tint/transform/transform_test.cc b/src/tint/transform/transform_test.cc index 3e342c5ec1..4ec4d1d79a 100644 --- a/src/tint/transform/transform_test.cc +++ b/src/tint/transform/transform_test.cc @@ -69,7 +69,7 @@ TEST_F(CreateASTTypeForTest, ArrayImplicitStride) { }); ASSERT_TRUE(arr->Is()); ASSERT_TRUE(arr->As()->type->Is()); - ASSERT_EQ(arr->As()->attributes.size(), 0u); + ASSERT_EQ(arr->As()->attributes.Length(), 0u); auto* size = arr->As()->count->As(); ASSERT_NE(size, nullptr); @@ -82,7 +82,7 @@ TEST_F(CreateASTTypeForTest, ArrayNonImplicitStride) { }); ASSERT_TRUE(arr->Is()); ASSERT_TRUE(arr->As()->type->Is()); - ASSERT_EQ(arr->As()->attributes.size(), 1u); + ASSERT_EQ(arr->As()->attributes.Length(), 1u); ASSERT_TRUE(arr->As()->attributes[0]->Is()); ASSERT_EQ(arr->As()->attributes[0]->As()->stride, 64u); diff --git a/src/tint/transform/unshadow.cc b/src/tint/transform/unshadow.cc index dcf90daa8b..952a88b378 100644 --- a/src/tint/transform/unshadow.cc +++ b/src/tint/transform/unshadow.cc @@ -44,28 +44,45 @@ struct Unshadow::State { // Maps a variable to its new name. std::unordered_map renamed_to; - auto rename = [&](const sem::Variable* var) -> const ast::Variable* { - auto* decl = var->Declaration(); + auto rename = [&](const sem::Variable* v) -> const ast::Variable* { + auto* decl = v->Declaration(); auto name = ctx.src->Symbols().NameFor(decl->symbol); auto symbol = ctx.dst->Symbols().New(name); - renamed_to.emplace(var, symbol); + renamed_to.emplace(v, symbol); auto source = ctx.Clone(decl->source); auto* type = ctx.Clone(decl->type); auto* constructor = ctx.Clone(decl->constructor); auto attributes = ctx.Clone(decl->attributes); - return ctx.dst->create(source, symbol, decl->declared_storage_class, - decl->declared_access, type, decl->is_const, - decl->is_overridable, constructor, attributes); + return Switch( + decl, // + [&](const ast::Var* var) { + return ctx.dst->Var(source, symbol, type, var->declared_storage_class, + var->declared_access, constructor, attributes); + }, + [&](const ast::Let*) { + return ctx.dst->Let(source, symbol, type, constructor, attributes); + }, + [&](const ast::Const*) { + return ctx.dst->Const(source, symbol, type, constructor, attributes); + }, + [&](const ast::Parameter*) { + return ctx.dst->Param(source, symbol, type, attributes); + }, + [&](Default) { + TINT_ICE(Transform, ctx.dst->Diagnostics()) + << "unexpected variable type: " << decl->TypeInfo().name; + return nullptr; + }); }; - ctx.ReplaceAll([&](const ast::Variable* var) -> const ast::Variable* { - if (auto* local = sem.Get(var)) { + ctx.ReplaceAll([&](const ast::Variable* v) -> const ast::Variable* { + if (auto* local = sem.Get(v)) { if (local->Shadows()) { return rename(local); } } - if (auto* param = sem.Get(var)) { + if (auto* param = sem.Get(v)) { if (param->Shadows()) { return rename(param); } diff --git a/src/tint/transform/unshadow.h b/src/tint/transform/unshadow.h index ce5e9758aa..5ffe8399b9 100644 --- a/src/tint/transform/unshadow.h +++ b/src/tint/transform/unshadow.h @@ -21,7 +21,7 @@ namespace tint::transform { /// Unshadow is a Transform that renames any variables that shadow another /// variable. -class Unshadow : public Castable { +class Unshadow final : public Castable { public: /// Constructor Unshadow(); diff --git a/src/tint/transform/unshadow_test.cc b/src/tint/transform/unshadow_test.cc index 30e1db55e5..f5a8102405 100644 --- a/src/tint/transform/unshadow_test.cc +++ b/src/tint/transform/unshadow_test.cc @@ -34,14 +34,16 @@ TEST_F(UnshadowTest, Noop) { auto* src = R"( var a : i32; -let b : i32 = 1; +const b : i32 = 1; fn F(c : i32) { var d : i32; let e : i32 = 1; + const f : i32 = 2; { - var f : i32; - let g : i32 = 1; + var g : i32; + let h : i32 = 1; + const i : i32 = 2; } } )"; @@ -64,6 +66,10 @@ fn X() { fn Y() { let a = true; } + +fn Z() { + const a = true; +} )"; auto* expect = R"( @@ -76,6 +82,10 @@ fn X() { fn Y() { let a_2 = true; } + +fn Z() { + const a_3 = true; +} )"; auto got = Run(src); @@ -93,6 +103,10 @@ fn Y() { let a = true; } +fn Z() { + const a = true; +} + type a = i32; )"; @@ -105,6 +119,10 @@ fn Y() { let a_2 = true; } +fn Z() { + const a_3 = true; +} + type a = i32; )"; @@ -126,6 +144,10 @@ fn X() { fn Y() { let a = false; } + +fn Z() { + const a = false; +} )"; auto* expect = R"( @@ -140,6 +162,10 @@ fn X() { fn Y() { let a_2 = false; } + +fn Z() { + const a_3 = false; +} )"; auto got = Run(src); @@ -157,6 +183,10 @@ fn Y() { let a = false; } +fn Z() { + const a = false; +} + struct a { m : i32, }; @@ -172,6 +202,10 @@ fn Y() { let a_2 = false; } +fn Z() { + const a_3 = false; +} + struct a { m : i32, } @@ -187,11 +221,19 @@ TEST_F(UnshadowTest, LocalShadowsFunction) { fn a() { var a = true; var b = false; + var c = true; } fn b() { let a = true; let b = false; + let c = true; +} + +fn c() { + const a = true; + const b = false; + const c = true; } )"; @@ -199,11 +241,19 @@ fn b() { fn a() { var a_1 = true; var b_1 = false; + var c_1 = true; } fn b() { let a_2 = true; let b_2 = false; + let c_2 = true; +} + +fn c() { + const a_3 = true; + const b_3 = false; + const c_3 = true; } )"; @@ -217,24 +267,39 @@ TEST_F(UnshadowTest, LocalShadowsFunction_OutOfOrder) { fn b() { let a = true; let b = false; + let c = true; } fn a() { var a = true; var b = false; + var c = true; } +fn c() { + const a = true; + const b = false; + const c = true; +} )"; auto* expect = R"( fn b() { let a_1 = true; let b_1 = false; + let c_1 = true; } fn a() { var a_2 = true; var b_2 = false; + var c_2 = true; +} + +fn c() { + const a_3 = true; + const b_3 = false; + const c_3 = true; } )"; @@ -254,6 +319,10 @@ fn X() { fn Y() { let a = (a == 321); } + +fn Z() { + const a = 321; +} )"; auto* expect = R"( @@ -266,6 +335,10 @@ fn X() { fn Y() { let a_2 = (a == 321); } + +fn Z() { + const a_3 = 321; +} )"; auto got = Run(src); @@ -283,6 +356,10 @@ fn Y() { let a = (a == 321); } +fn Z() { + const a = 321; +} + var a : i32; )"; @@ -295,6 +372,10 @@ fn Y() { let a_2 = (a == 321); } +fn Z() { + const a_3 = 321; +} + var a : i32; )"; @@ -314,10 +395,14 @@ fn X() { fn Y() { let a = (a == 321); } + +fn Z() { + const a = 321; +} )"; auto* expect = R"( -let a : i32 = 1; +const a : i32 = 1; fn X() { var a_1 = (a == 123); @@ -326,6 +411,10 @@ fn X() { fn Y() { let a_2 = (a == 321); } + +fn Z() { + const a_3 = 321; +} )"; auto got = Run(src); @@ -343,6 +432,10 @@ fn Y() { let a = (a == 321); } +fn Z() { + const a = 321; +} + let a : i32 = 1; )"; @@ -355,7 +448,87 @@ fn Y() { let a_2 = (a == 321); } -let a : i32 = 1; +fn Z() { + const a_3 = 321; +} + +const a : i32 = 1; +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(UnshadowTest, LocalShadowsGlobalConst) { + auto* src = R"( +const a : i32 = 1; + +fn X() { + var a = (a == 123); +} + +fn Y() { + let a = (a == 321); +} + +fn Z() { + const a = 321; +} +)"; + + auto* expect = R"( +const a : i32 = 1; + +fn X() { + var a_1 = (a == 123); +} + +fn Y() { + let a_2 = (a == 321); +} + +fn Z() { + const a_3 = 321; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(UnshadowTest, LocalShadowsGlobalConst_OutOfOrder) { + auto* src = R"( +fn X() { + var a = (a == 123); +} + +fn Y() { + let a = (a == 321); +} + +fn Z() { + const a = a; +} + +const a : i32 = 1; +)"; + + auto* expect = R"( +fn X() { + var a_1 = (a == 123); +} + +fn Y() { + let a_2 = (a == 321); +} + +fn Z() { + const a_3 = a; +} + +const a : i32 = 1; )"; auto got = Run(src); @@ -373,6 +546,9 @@ fn X() { { let a = (a == 321); } + { + const a = 321; + } } )"; @@ -385,6 +561,9 @@ fn X() { { let a_2 = (a == 321); } + { + const a_3 = 321; + } } )"; @@ -403,6 +582,9 @@ fn X() { { let a = (a == 321); } + { + const a = 321; + } } )"; @@ -415,6 +597,45 @@ fn X() { { let a_2 = (a == 321); } + { + const a_3 = 321; + } +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(UnshadowTest, LocalShadowsLocalConst) { + auto* src = R"( +fn X() { + const a = 1; + { + var a = (a == 123); + } + { + let a = (a == 321); + } + { + const a = a; + } +} +)"; + + auto* expect = R"( +fn X() { + const a = 1; + { + var a_1 = (a == 123); + } + { + let a_2 = (a == 321); + } + { + const a_3 = a; + } } )"; @@ -432,6 +653,9 @@ fn F(a : i32) { { let a = (a == 321); } + { + const a = 321; + } } )"; @@ -443,6 +667,9 @@ fn F(a : i32) { { let a_2 = (a == 321); } + { + const a_3 = 321; + } } )"; @@ -460,6 +687,9 @@ fn a(a : i32) { { let a = (a == 321); } + { + const a = 321; + } } )"; @@ -471,6 +701,9 @@ fn a(a_1 : i32) { { let a_3 = (a_1 == 321); } + { + const a_4 = 321; + } } )"; @@ -508,7 +741,7 @@ fn F(a : bool) { )"; auto* expect = R"( -let a : i32 = 1; +const a : i32 = 1; fn F(a_1 : bool) { } @@ -531,7 +764,47 @@ let a : i32 = 1; fn F(a_1 : bool) { } -let a : i32 = 1; +const a : i32 = 1; +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(UnshadowTest, ParamShadowsGlobalConst) { + auto* src = R"( +const a : i32 = 1; + +fn F(a : bool) { +} +)"; + + auto* expect = R"( +const a : i32 = 1; + +fn F(a_1 : bool) { +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(UnshadowTest, ParamShadowsGlobalConst_OutOfOrder) { + auto* src = R"( +fn F(a : bool) { +} + +const a : i32 = 1; +)"; + + auto* expect = R"( +fn F(a_1 : bool) { +} + +const a : i32 = 1; )"; auto got = Run(src); diff --git a/src/tint/transform/unwind_discard_functions.cc b/src/tint/transform/unwind_discard_functions.cc index e1ba74c2e9..f94f549fa1 100644 --- a/src/tint/transform/unwind_discard_functions.cc +++ b/src/tint/transform/unwind_discard_functions.cc @@ -54,8 +54,8 @@ class State { Symbol ModuleDiscardVarName() { if (!module_discard_var_name.IsValid()) { module_discard_var_name = b.Symbols().New("tint_discard"); - ctx.dst->Global(module_discard_var_name, b.ty.bool_(), b.Expr(false), - ast::StorageClass::kPrivate); + ctx.dst->GlobalVar(module_discard_var_name, b.ty.bool_(), b.Expr(false), + ast::StorageClass::kPrivate); } return module_discard_var_name; } @@ -67,7 +67,8 @@ class State { Symbol ModuleDiscardFuncName() { if (!module_discard_func_name.IsValid()) { module_discard_func_name = b.Symbols().New("tint_discard_func"); - b.Func(module_discard_func_name, {}, b.ty.void_(), {b.Discard()}); + b.Func(module_discard_func_name, tint::utils::Empty, b.ty.void_(), + tint::utils::Vector{b.Discard()}); } return module_discard_func_name; } @@ -108,14 +109,14 @@ class State { // } // const ast::IfStatement* IfDiscardReturn(const ast::Statement* stmt) { - ast::StatementList stmts; + tint::utils::Vector stmts; // For entry point functions, also emit the discard statement if (IsInEntryPointFunc(stmt)) { - stmts.emplace_back(CallDiscardFunc()); + stmts.Push(CallDiscardFunc()); } - stmts.emplace_back(Return(stmt)); + stmts.Push(Return(stmt)); auto var_name = ModuleDiscardVarName(); return b.If(var_name, b.Block(stmts)); @@ -140,7 +141,7 @@ class State { auto ip = utils::GetInsertionPoint(ctx, stmt); auto var_name = b.Sym(); - auto* decl = b.Decl(b.Var(var_name, nullptr, ctx.Clone(expr))); + auto* decl = b.Decl(b.Var(var_name, ctx.Clone(expr))); ctx.InsertBefore(ip.first->Declaration()->statements, ip.second, decl); ctx.InsertBefore(ip.first->Declaration()->statements, ip.second, IfDiscardReturn(stmt)); @@ -262,6 +263,15 @@ class State { } return nullptr; }, + [&](const ast::WhileStatement* s) -> const ast::Statement* { + if (MayDiscard(sem.Get(s->condition))) { + TINT_ICE(Transform, b.Diagnostics()) + << "Unexpected WhileStatement condition that may discard. " + "Make sure transform::PromoteSideEffectsToDecl was run " + "first."; + } + return nullptr; + }, [&](const ast::IfStatement* s) -> const ast::Statement* { auto* sem_expr = sem.Get(s->condition); if (!MayDiscard(sem_expr)) { diff --git a/src/tint/transform/unwind_discard_functions.h b/src/tint/transform/unwind_discard_functions.h index 3b1d838ceb..105a9d8d39 100644 --- a/src/tint/transform/unwind_discard_functions.h +++ b/src/tint/transform/unwind_discard_functions.h @@ -36,7 +36,7 @@ namespace tint::transform { /// /// @note Depends on the following transforms to have been run first: /// * PromoteSideEffectsToDecl -class UnwindDiscardFunctions : public Castable { +class UnwindDiscardFunctions final : public Castable { public: /// Constructor UnwindDiscardFunctions(); diff --git a/src/tint/transform/unwind_discard_functions_test.cc b/src/tint/transform/unwind_discard_functions_test.cc index 70b421889f..7d1fa27264 100644 --- a/src/tint/transform/unwind_discard_functions_test.cc +++ b/src/tint/transform/unwind_discard_functions_test.cc @@ -102,7 +102,7 @@ fn f() { let marker1 = 0; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { f(); let marker1 = 0; @@ -122,7 +122,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { f(); if (tint_discard) { @@ -156,7 +156,7 @@ fn f() -> S { return s; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { let marker1 = 0; f(); @@ -186,7 +186,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let marker1 = 0; f(); @@ -230,7 +230,7 @@ fn h() -> i32{ return 0; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { let marker1 = 0; h(); @@ -275,7 +275,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let marker1 = 0; h(); @@ -311,7 +311,7 @@ fn h() { let marker1 = 0; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { let marker1 = 0; f(); @@ -348,7 +348,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let marker1 = 0; f(); @@ -381,7 +381,7 @@ fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { TEST_F(UnwindDiscardFunctionsTest, Call_DiscardFuncDeclaredBelow) { auto* src = R"( -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { f(); let marker1 = 0; @@ -400,7 +400,7 @@ fn tint_discard_func() { var tint_discard : bool = false; -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { f(); if (tint_discard) { @@ -433,7 +433,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { if (f() == 42) { let marker1 = 0; @@ -456,7 +456,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let tint_symbol = f(); if (tint_discard) { @@ -485,7 +485,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { if (true) { let marker1 = 0; @@ -512,7 +512,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { if (true) { let marker1 = 0; @@ -547,7 +547,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { let marker1 = 0; var a = 0; @@ -573,7 +573,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let marker1 = 0; var a = 0; @@ -605,7 +605,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { let marker1 = 0; for (f(); ; ) { @@ -630,7 +630,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let marker1 = 0; var tint_symbol = f(); @@ -661,7 +661,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { let marker1 = 0; for (let i = f(); ; ) { @@ -686,7 +686,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let marker1 = 0; var tint_symbol = f(); @@ -717,7 +717,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { let marker1 = 0; for (; f() == 42; ) { @@ -742,7 +742,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let marker1 = 0; loop { @@ -778,7 +778,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { let marker1 = 0; for (; ; f()) { @@ -800,6 +800,67 @@ fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { EXPECT_EQ(expect, str(got)); } +TEST_F(UnwindDiscardFunctionsTest, While_Cond) { + auto* src = R"( +fn f() -> i32 { + if (true) { + discard; + } + return 42; +} + +@fragment +fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { + let marker1 = 0; + while (f() == 42) { + let marker2 = 0; + break; + } + return vec4(); +} +)"; + auto* expect = R"( +var tint_discard : bool = false; + +fn f() -> i32 { + if (true) { + tint_discard = true; + return i32(); + } + return 42; +} + +fn tint_discard_func() { + discard; +} + +@fragment +fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { + let marker1 = 0; + loop { + let tint_symbol = f(); + if (tint_discard) { + tint_discard_func(); + return vec4(); + } + if (!((tint_symbol == 42))) { + break; + } + { + let marker2 = 0; + break; + } + } + return vec4(); +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + TEST_F(UnwindDiscardFunctionsTest, Switch) { auto* src = R"( fn f() -> i32 { @@ -809,7 +870,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { switch (f()) { case 0: { @@ -843,7 +904,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { var tint_symbol = f(); if (tint_discard) { @@ -893,7 +954,7 @@ fn g() -> S { return f(); } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { let marker1 = 0; g(); @@ -929,7 +990,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let marker1 = 0; g(); @@ -956,7 +1017,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { var a = f(); let marker1 = 0; @@ -978,7 +1039,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { var a = f(); if (tint_discard) { @@ -1005,7 +1066,7 @@ fn f() -> i32 { return 42; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { var a : i32; a = f(); @@ -1028,7 +1089,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { var a : i32; a = f(); @@ -1056,7 +1117,7 @@ fn f() -> i32 { return 0; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { var b = array(); b[f()] = 10; @@ -1079,7 +1140,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { var b = array(); let tint_symbol = f(); @@ -1115,7 +1176,7 @@ fn g() -> i32 { return 0; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { var b = array(); b[f()] = g(); @@ -1146,7 +1207,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { var b = array(); let tint_symbol = g(); @@ -1194,7 +1255,7 @@ fn h() -> i32{ return 0; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { if ((f() + g() + h()) == 0) { let marker1 = 0; @@ -1233,7 +1294,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let tint_symbol = f(); if (tint_discard) { @@ -1286,7 +1347,7 @@ fn h() -> i32{ return 0; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { if (f() == 1 && g() == 2 && h() == 3) { let marker1 = 0; @@ -1325,7 +1386,7 @@ fn tint_discard_func() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { let tint_symbol_2 = f(); if (tint_discard) { @@ -1373,7 +1434,7 @@ fn f() { let marker1 = 0; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in: vec4) -> @location(0) vec4 { f(); let marker1 = 0; @@ -1397,7 +1458,7 @@ fn tint_discard_func_1() { discard; } -@stage(fragment) +@fragment fn main(@builtin(position) coord_in : vec4) -> @location(0) vec4 { f(); if (tint_discard_1) { diff --git a/src/tint/transform/utils/get_insertion_point_test.cc b/src/tint/transform/utils/get_insertion_point_test.cc index 071cfea40a..d910858e35 100644 --- a/src/tint/transform/utils/get_insertion_point_test.cc +++ b/src/tint/transform/utils/get_insertion_point_test.cc @@ -33,9 +33,9 @@ TEST_F(GetInsertionPointTest, Block) { // } ProgramBuilder b; auto* expr = b.Expr(1_i); - auto* var = b.Decl(b.Var("a", nullptr, expr)); + auto* var = b.Decl(b.Var("a", expr)); auto* block = b.Block(var); - b.Func("f", {}, b.ty.void_(), {block}); + b.Func("f", tint::utils::Empty, b.ty.void_(), tint::utils::Vector{block}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -55,10 +55,10 @@ TEST_F(GetInsertionPointTest, ForLoopInit) { // } ProgramBuilder b; auto* expr = b.Expr(1_i); - auto* var = b.Decl(b.Var("a", nullptr, expr)); - auto* fl = b.For(var, b.Expr(true), {}, b.Block()); + auto* var = b.Decl(b.Var("a", expr)); + auto* fl = b.For(var, b.Expr(true), nullptr, b.Block()); auto* func_block = b.Block(fl); - b.Func("f", {}, b.ty.void_(), {func_block}); + b.Func("f", tint::utils::Empty, b.ty.void_(), tint::utils::Vector{func_block}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -77,9 +77,9 @@ TEST_F(GetInsertionPointTest, ForLoopCont_Invalid) { // } ProgramBuilder b; auto* expr = b.Expr(1_i); - auto* var = b.Decl(b.Var("a", nullptr, expr)); + auto* var = b.Decl(b.Var("a", expr)); auto* s = b.For({}, b.Expr(true), var, b.Block()); - b.Func("f", {}, b.ty.void_(), {s}); + b.Func("f", tint::utils::Empty, b.ty.void_(), tint::utils::Vector{s}); Program original(std::move(b)); ProgramBuilder cloned_b; diff --git a/src/tint/transform/utils/hoist_to_decl_before.cc b/src/tint/transform/utils/hoist_to_decl_before.cc index 450a2e8a92..85bd2b225b 100644 --- a/src/tint/transform/utils/hoist_to_decl_before.cc +++ b/src/tint/transform/utils/hoist_to_decl_before.cc @@ -16,12 +16,13 @@ #include -#include "src/tint/ast/variable_decl_statement.h" +#include "src/tint/program_builder.h" #include "src/tint/sem/block_statement.h" #include "src/tint/sem/for_loop_statement.h" #include "src/tint/sem/if_statement.h" #include "src/tint/sem/reference.h" #include "src/tint/sem/variable.h" +#include "src/tint/sem/while_statement.h" #include "src/tint/utils/reverse.h" namespace tint::transform { @@ -35,18 +36,21 @@ class HoistToDeclBefore::State { /// loop, so that declaration statements can be inserted before the /// condition expression or continuing statement. struct LoopInfo { - ast::StatementList cond_decls; - ast::StatementList cont_decls; + utils::Vector cond_decls; + utils::Vector cont_decls; }; /// Info for each else-if that needs decomposing struct ElseIfInfo { /// Decls to insert before condition - ast::StatementList cond_decls; + utils::Vector cond_decls; }; /// For-loops that need to be decomposed to loops. - std::unordered_map loops; + std::unordered_map for_loops; + + /// Whiles that need to be decomposed to loops. + std::unordered_map while_loops; /// 'else if' statements that need to be decomposed to 'else {if}' std::unordered_map else_ifs; @@ -55,7 +59,7 @@ class HoistToDeclBefore::State { // registered declaration statements before the condition or continuing // statement. void ForLoopsToLoops() { - if (loops.empty()) { + if (for_loops.empty()) { return; } @@ -64,7 +68,7 @@ class HoistToDeclBefore::State { auto& sem = ctx.src->Sem(); if (auto* fl = sem.Get(stmt)) { - if (auto it = loops.find(fl); it != loops.end()) { + if (auto it = for_loops.find(fl); it != for_loops.end()) { auto& info = it->second; auto* for_loop = fl->Declaration(); // For-loop needs to be decomposed to a loop. @@ -81,10 +85,10 @@ class HoistToDeclBefore::State { // { break; } auto* break_body = b.Block(b.create()); // if (!condition) { break; } - body_stmts.emplace_back(b.If(not_cond, break_body)); + body_stmts.Push(b.If(not_cond, break_body)); } // Next emit the for-loop body - body_stmts.emplace_back(ctx.Clone(for_loop->body)); + body_stmts.Push(ctx.Clone(for_loop->body)); // Finally create the continuing block if there was one. const ast::BlockStatement* continuing = nullptr; @@ -92,7 +96,7 @@ class HoistToDeclBefore::State { // Continuing block starts with any let declarations used by // the continuing. auto cont_stmts = info.cont_decls; - cont_stmts.emplace_back(ctx.Clone(cont)); + cont_stmts.Push(ctx.Clone(cont)); continuing = b.Block(cont_stmts); } @@ -108,6 +112,51 @@ class HoistToDeclBefore::State { }); } + // Converts any while-loops marked for conversion to loops, inserting + // registered declaration statements before the condition. + void WhilesToLoops() { + if (while_loops.empty()) { + return; + } + + // At least one while needs to be transformed into a loop. + ctx.ReplaceAll([&](const ast::WhileStatement* stmt) -> const ast::Statement* { + auto& sem = ctx.src->Sem(); + + if (auto* w = sem.Get(stmt)) { + if (auto it = while_loops.find(w); it != while_loops.end()) { + auto& info = it->second; + auto* while_loop = w->Declaration(); + // While needs to be decomposed to a loop. + // Build the loop body's statements. + // Start with any let declarations for the conditional + // expression. + auto body_stmts = info.cond_decls; + // Emit the condition as: + // if (!cond) { break; } + auto* cond = while_loop->condition; + // !condition + auto* not_cond = + b.create(ast::UnaryOp::kNot, ctx.Clone(cond)); + // { break; } + auto* break_body = b.Block(b.create()); + // if (!condition) { break; } + body_stmts.Push(b.If(not_cond, break_body)); + + // Next emit the body + body_stmts.Push(ctx.Clone(while_loop->body)); + + const ast::BlockStatement* continuing = nullptr; + + auto* body = b.Block(body_stmts); + auto* loop = b.Loop(body, continuing); + return loop; + } + } + return nullptr; + }); + } + void ElseIfsToElseWithNestedIfs() { // Decompose 'else-if' statements into 'else { if }' blocks. ctx.ReplaceAll([&](const ast::IfStatement* else_if) -> const ast::Statement* { @@ -124,7 +173,7 @@ class HoistToDeclBefore::State { auto* cond = ctx.Clone(else_if->condition); auto* body = ctx.Clone(else_if->body); auto* new_if = b.If(cond, body, b.Else(ctx.Clone(else_if->else_statement))); - body_stmts.emplace_back(new_if); + body_stmts.Push(new_if); // Replace the 'else-if' with the new 'else' block. return b.Block(body_stmts); @@ -140,18 +189,18 @@ class HoistToDeclBefore::State { /// before `before_expr`. /// @param before_expr expression to insert `expr` before /// @param expr expression to hoist - /// @param as_const hoist to `let` if true, otherwise to `var` + /// @param as_let hoist to `let` if true, otherwise to `var` /// @param decl_name optional name to use for the variable/constant name /// @return true on success bool Add(const sem::Expression* before_expr, const ast::Expression* expr, - bool as_const, + bool as_let, const char* decl_name) { auto name = b.Symbols().New(decl_name); // Construct the let/var that holds the hoisted expr - auto* v = as_const ? b.Let(name, nullptr, ctx.Clone(expr)) - : b.Var(name, nullptr, ctx.Clone(expr)); + auto* v = as_let ? static_cast(b.Let(name, ctx.Clone(expr))) + : static_cast(b.Var(name, ctx.Clone(expr))); auto* decl = b.Decl(v); if (!InsertBefore(before_expr->Stmt(), decl)) { @@ -182,7 +231,7 @@ class HoistToDeclBefore::State { // Index the map to convert this else if, even if `stmt` is nullptr. auto& decls = else_if_info.cond_decls; if (stmt) { - decls.emplace_back(stmt); + decls.Push(stmt); } return true; } @@ -192,9 +241,21 @@ class HoistToDeclBefore::State { // For-loop needs to be decomposed to a loop. // Index the map to convert this for-loop, even if `stmt` is nullptr. - auto& decls = loops[fl].cond_decls; + auto& decls = for_loops[fl].cond_decls; if (stmt) { - decls.emplace_back(stmt); + decls.Push(stmt); + } + return true; + } + + if (auto* w = before_stmt->As()) { + // Insertion point is a while condition. + // While needs to be decomposed to a loop. + + // Index the map to convert this while, even if `stmt` is nullptr. + auto& decls = while_loops[w].cond_decls; + if (stmt) { + decls.Push(stmt); } return true; } @@ -227,9 +288,9 @@ class HoistToDeclBefore::State { // For-loop needs to be decomposed to a loop. // Index the map to convert this for-loop, even if `stmt` is nullptr. - auto& decls = loops[fl].cont_decls; + auto& decls = for_loops[fl].cont_decls; if (stmt) { - decls.emplace_back(stmt); + decls.Push(stmt); } return true; } @@ -257,6 +318,7 @@ class HoistToDeclBefore::State { /// @return true on success bool Apply() { ForLoopsToLoops(); + WhilesToLoops(); ElseIfsToElseWithNestedIfs(); return true; } @@ -268,9 +330,9 @@ HoistToDeclBefore::~HoistToDeclBefore() {} bool HoistToDeclBefore::Add(const sem::Expression* before_expr, const ast::Expression* expr, - bool as_const, + bool as_let, const char* decl_name) { - return state_->Add(before_expr, expr, as_const, decl_name); + return state_->Add(before_expr, expr, as_let, decl_name); } bool HoistToDeclBefore::InsertBefore(const sem::Statement* before_stmt, diff --git a/src/tint/transform/utils/hoist_to_decl_before_test.cc b/src/tint/transform/utils/hoist_to_decl_before_test.cc index 1e4cb8ef36..f0d3b361b0 100644 --- a/src/tint/transform/utils/hoist_to_decl_before_test.cc +++ b/src/tint/transform/utils/hoist_to_decl_before_test.cc @@ -17,6 +17,7 @@ #include "gtest/gtest-spi.h" #include "src/tint/program_builder.h" #include "src/tint/sem/if_statement.h" +#include "src/tint/sem/index_accessor_expression.h" #include "src/tint/sem/statement.h" #include "src/tint/transform/test_helper.h" #include "src/tint/transform/utils/hoist_to_decl_before.h" @@ -34,8 +35,8 @@ TEST_F(HoistToDeclBeforeTest, VarInit) { // } ProgramBuilder b; auto* expr = b.Expr(1_i); - auto* var = b.Decl(b.Var("a", nullptr, expr)); - b.Func("f", {}, b.ty.void_(), {var}); + auto* var = b.Decl(b.Var("a", expr)); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -66,8 +67,8 @@ TEST_F(HoistToDeclBeforeTest, ForLoopInit) { // } ProgramBuilder b; auto* expr = b.Expr(1_i); - auto* s = b.For(b.Decl(b.Var("a", nullptr, expr)), b.Expr(true), {}, b.Block()); - b.Func("f", {}, b.ty.void_(), {s}); + auto* s = b.For(b.Decl(b.Var("a", expr)), b.Expr(true), nullptr, b.Block()); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -101,8 +102,8 @@ TEST_F(HoistToDeclBeforeTest, ForLoopCond) { ProgramBuilder b; auto* var = b.Decl(b.Var("a", b.ty.bool_())); auto* expr = b.Expr("a"); - auto* s = b.For({}, expr, {}, b.Block()); - b.Func("f", {}, b.ty.void_(), {var, s}); + auto* s = b.For(nullptr, expr, nullptr, b.Block()); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -140,8 +141,8 @@ TEST_F(HoistToDeclBeforeTest, ForLoopCont) { // } ProgramBuilder b; auto* expr = b.Expr(1_i); - auto* s = b.For({}, b.Expr(true), b.Decl(b.Var("a", nullptr, expr)), b.Block()); - b.Func("f", {}, b.ty.void_(), {s}); + auto* s = b.For(nullptr, b.Expr(true), b.Decl(b.Var("a", expr)), b.Block()); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -175,6 +176,47 @@ fn f() { EXPECT_EQ(expect, str(cloned)); } +TEST_F(HoistToDeclBeforeTest, WhileCond) { + // fn f() { + // var a : bool; + // while(a) { + // } + // } + ProgramBuilder b; + auto* var = b.Decl(b.Var("a", b.ty.bool_())); + auto* expr = b.Expr("a"); + auto* s = b.While(expr, b.Block()); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s}); + + Program original(std::move(b)); + ProgramBuilder cloned_b; + CloneContext ctx(&cloned_b, &original); + + HoistToDeclBefore hoistToDeclBefore(ctx); + auto* sem_expr = ctx.src->Sem().Get(expr); + hoistToDeclBefore.Add(sem_expr, expr, true); + hoistToDeclBefore.Apply(); + + ctx.Clone(); + Program cloned(std::move(cloned_b)); + + auto* expect = R"( +fn f() { + var a : bool; + loop { + let tint_symbol = a; + if (!(tint_symbol)) { + break; + } + { + } + } +} +)"; + + EXPECT_EQ(expect, str(cloned)); +} + TEST_F(HoistToDeclBeforeTest, ElseIf) { // fn f() { // var a : bool; @@ -189,7 +231,7 @@ TEST_F(HoistToDeclBeforeTest, ElseIf) { auto* s = b.If(b.Expr(true), b.Block(), // b.Else(b.If(expr, b.Block(), // b.Else(b.Block())))); - b.Func("f", {}, b.ty.void_(), {var, s}); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -227,8 +269,8 @@ TEST_F(HoistToDeclBeforeTest, Array1D) { ProgramBuilder b; auto* var1 = b.Decl(b.Var("a", b.ty.array())); auto* expr = b.IndexAccessor("a", 0_i); - auto* var2 = b.Decl(b.Var("b", nullptr, expr)); - b.Func("f", {}, b.ty.void_(), {var1, var2}); + auto* var2 = b.Decl(b.Var("b", expr)); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var1, var2}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -262,8 +304,8 @@ TEST_F(HoistToDeclBeforeTest, Array2D) { auto* var1 = b.Decl(b.Var("a", b.ty.array(b.ty.array(), 10_i))); auto* expr = b.IndexAccessor(b.IndexAccessor("a", 0_i), 0_i); - auto* var2 = b.Decl(b.Var("b", nullptr, expr)); - b.Func("f", {}, b.ty.void_(), {var1, var2}); + auto* var2 = b.Decl(b.Var("b", expr)); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var1, var2}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -297,8 +339,8 @@ TEST_F(HoistToDeclBeforeTest, Prepare_ForLoopCond) { ProgramBuilder b; auto* var = b.Decl(b.Var("a", b.ty.bool_())); auto* expr = b.Expr("a"); - auto* s = b.For({}, expr, {}, b.Block()); - b.Func("f", {}, b.ty.void_(), {var, s}); + auto* s = b.For(nullptr, expr, nullptr, b.Block()); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -335,8 +377,8 @@ TEST_F(HoistToDeclBeforeTest, Prepare_ForLoopCont) { // } ProgramBuilder b; auto* expr = b.Expr(1_i); - auto* s = b.For({}, b.Expr(true), b.Decl(b.Var("a", nullptr, expr)), b.Block()); - b.Func("f", {}, b.ty.void_(), {s}); + auto* s = b.For(nullptr, b.Expr(true), b.Decl(b.Var("a", expr)), b.Block()); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -383,7 +425,7 @@ TEST_F(HoistToDeclBeforeTest, Prepare_ElseIf) { auto* s = b.If(b.Expr(true), b.Block(), // b.Else(b.If(expr, b.Block(), // b.Else(b.Block())))); - b.Func("f", {}, b.ty.void_(), {var, s}); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -419,9 +461,9 @@ TEST_F(HoistToDeclBeforeTest, InsertBefore_Block) { // var a = 1i; // } ProgramBuilder b; - b.Func("foo", {}, b.ty.void_(), {}); - auto* var = b.Decl(b.Var("a", nullptr, b.Expr(1_i))); - b.Func("f", {}, b.ty.void_(), {var}); + b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty); + auto* var = b.Decl(b.Var("a", b.Expr(1_i))); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -457,10 +499,10 @@ TEST_F(HoistToDeclBeforeTest, InsertBefore_ForLoopInit) { // } // } ProgramBuilder b; - b.Func("foo", {}, b.ty.void_(), {}); - auto* var = b.Decl(b.Var("a", nullptr, b.Expr(1_i))); - auto* s = b.For(var, b.Expr(true), {}, b.Block()); - b.Func("f", {}, b.ty.void_(), {s}); + b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty); + auto* var = b.Decl(b.Var("a", b.Expr(1_i))); + auto* s = b.For(var, b.Expr(true), nullptr, b.Block()); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -498,11 +540,11 @@ TEST_F(HoistToDeclBeforeTest, InsertBefore_ForLoopCont) { // } // } ProgramBuilder b; - b.Func("foo", {}, b.ty.void_(), {}); - auto* var = b.Decl(b.Var("a", nullptr, b.Expr(1_i))); + b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty); + auto* var = b.Decl(b.Var("a", b.Expr(1_i))); auto* cont = b.CompoundAssign("a", b.Expr(1_i), ast::BinaryOp::kAdd); - auto* s = b.For({}, b.Expr(true), cont, b.Block()); - b.Func("f", {}, b.ty.void_(), {var, s}); + auto* s = b.For(nullptr, b.Expr(true), cont, b.Block()); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s}); Program original(std::move(b)); ProgramBuilder cloned_b; @@ -552,12 +594,12 @@ TEST_F(HoistToDeclBeforeTest, InsertBefore_ElseIf) { // } // } ProgramBuilder b; - b.Func("foo", {}, b.ty.void_(), {}); + b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty); auto* var = b.Decl(b.Var("a", b.ty.bool_())); auto* elseif = b.If(b.Expr("a"), b.Block(), b.Else(b.Block())); auto* s = b.If(b.Expr(true), b.Block(), // b.Else(elseif)); - b.Func("f", {}, b.ty.void_(), {var, s}); + b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s}); Program original(std::move(b)); ProgramBuilder cloned_b; diff --git a/src/tint/transform/var_for_dynamic_index_test.cc b/src/tint/transform/var_for_dynamic_index_test.cc index ca767c9d05..05c19b3eb9 100644 --- a/src/tint/transform/var_for_dynamic_index_test.cc +++ b/src/tint/transform/var_for_dynamic_index_test.cc @@ -484,7 +484,8 @@ TEST_F(VarForDynamicIndexTest, ArrayIndexConstantLet) { fn f() { let p = array(1, 2, 3, 4); let c = 1; - let x = p[c]; + var var_for_index = p; + let x = var_for_index[c]; } )"; @@ -501,7 +502,8 @@ TEST_F(VarForDynamicIndexTest, MatrixIndexConstantLet) { fn f() { let p = mat2x2(1.0, 2.0, 3.0, 4.0); let c = 1; - let x = p[c]; + var var_for_index = p; + let x = var_for_index[c]; } )"; diff --git a/src/tint/transform/vectorize_scalar_matrix_constructors.cc b/src/tint/transform/vectorize_scalar_matrix_constructors.cc index 80e8b1e8a5..113db5f7b1 100644 --- a/src/tint/transform/vectorize_scalar_matrix_constructors.cc +++ b/src/tint/transform/vectorize_scalar_matrix_constructors.cc @@ -14,12 +14,15 @@ #include "src/tint/transform/vectorize_scalar_matrix_constructors.h" +#include #include #include "src/tint/program_builder.h" +#include "src/tint/sem/abstract_numeric.h" #include "src/tint/sem/call.h" #include "src/tint/sem/expression.h" #include "src/tint/sem/type_constructor.h" +#include "src/tint/utils/map.h" TINT_INSTANTIATE_TYPEINFO(tint::transform::VectorizeScalarMatrixConstructors); @@ -34,7 +37,7 @@ bool VectorizeScalarMatrixConstructors::ShouldRun(const Program* program, const if (auto* call = program->Sem().Get(node)) { if (call->Target()->Is() && call->Type()->Is()) { auto& args = call->Arguments(); - if (args.size() > 0 && args[0]->Type()->is_scalar()) { + if (!args.IsEmpty() && args[0]->Type()->UnwrapRef()->is_scalar()) { return true; } } @@ -44,41 +47,85 @@ bool VectorizeScalarMatrixConstructors::ShouldRun(const Program* program, const } void VectorizeScalarMatrixConstructors::Run(CloneContext& ctx, const DataMap&, DataMap&) const { + std::unordered_map scalar_ctors; + ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::CallExpression* { - auto* call = ctx.src->Sem().Get(expr); + auto* call = ctx.src->Sem().Get(expr)->UnwrapMaterialize()->As(); auto* ty_ctor = call->Target()->As(); if (!ty_ctor) { return nullptr; } - // Check if this is a matrix constructor with scalar arguments. auto* mat_type = call->Type()->As(); if (!mat_type) { return nullptr; } auto& args = call->Arguments(); - if (args.size() == 0) { - return nullptr; - } - if (!args[0]->Type()->is_scalar()) { + if (args.IsEmpty()) { return nullptr; } - // Build a list of vector expressions for each column. - ast::ExpressionList columns; - for (uint32_t c = 0; c < mat_type->columns(); c++) { - // Build a list of scalar expressions for each value in the column. - ast::ExpressionList row_values; - for (uint32_t r = 0; r < mat_type->rows(); r++) { - row_values.push_back(ctx.Clone(args[c * mat_type->rows() + r]->Declaration())); + // If the argument type is a matrix, then this is an identity / conversion constructor. + // If the argument type is a vector, then we're already column vectors. + // If the argument type is abstract, then we're const-expression and there's no need to + // adjust this, as it'll be constant folded by the backend. + if (args[0] + ->Type() + ->UnwrapRef() + ->IsAnyOf()) { + return nullptr; + } + + // Constructs a matrix using vector columns, with the elements constructed using the + // 'element(uint32_t c, uint32_t r)' callback. + auto build_mat = [&](auto&& element) { + utils::Vector columns; + for (uint32_t c = 0; c < mat_type->columns(); c++) { + utils::Vector row_values; + for (uint32_t r = 0; r < mat_type->rows(); r++) { + row_values.Push(element(c, r)); + } + + // Construct the column vector. + columns.Push(ctx.dst->vec(CreateASTTypeFor(ctx, mat_type->type()), mat_type->rows(), + std::move(row_values))); } + return ctx.dst->Construct(CreateASTTypeFor(ctx, mat_type), columns); + }; - // Construct the column vector. - auto* col = - ctx.dst->vec(CreateASTTypeFor(ctx, mat_type->type()), mat_type->rows(), row_values); - columns.push_back(col); + if (args.Length() == 1) { + // Generate a helper function for constructing the matrix. + // This is done to ensure that the single argument value is only evaluated once, and + // with the correct expression evaluation order. + auto fn = utils::GetOrCreate(scalar_ctors, mat_type, [&] { + auto name = + ctx.dst->Symbols().New("build_mat" + std::to_string(mat_type->columns()) + "x" + + std::to_string(mat_type->rows())); + ctx.dst->Func(name, + utils::Vector{ + // Single scalar parameter + ctx.dst->Param("value", CreateASTTypeFor(ctx, mat_type->type())), + }, + CreateASTTypeFor(ctx, mat_type), + utils::Vector{ + ctx.dst->Return(build_mat([&](uint32_t, uint32_t) { // + return ctx.dst->Expr("value"); + })), + }); + return name; + }); + return ctx.dst->Call(fn, ctx.Clone(args[0]->Declaration())); } - return ctx.dst->Construct(CreateASTTypeFor(ctx, mat_type), columns); + + if (args.Length() == mat_type->columns() * mat_type->rows()) { + return build_mat([&](uint32_t c, uint32_t r) { + return ctx.Clone(args[c * mat_type->rows() + r]->Declaration()); + }); + } + + TINT_ICE(Transform, ctx.dst->Diagnostics()) + << "matrix constructor has unexpected number of arguments"; + return nullptr; }); ctx.Clone(); diff --git a/src/tint/transform/vectorize_scalar_matrix_constructors.h b/src/tint/transform/vectorize_scalar_matrix_constructors.h index 83c4ce1aa6..31c57f0a8c 100644 --- a/src/tint/transform/vectorize_scalar_matrix_constructors.h +++ b/src/tint/transform/vectorize_scalar_matrix_constructors.h @@ -20,7 +20,7 @@ namespace tint::transform { /// A transform that converts scalar matrix constructors to the vector form. -class VectorizeScalarMatrixConstructors +class VectorizeScalarMatrixConstructors final : public Castable { public: /// Constructor diff --git a/src/tint/transform/vectorize_scalar_matrix_constructors_test.cc b/src/tint/transform/vectorize_scalar_matrix_constructors_test.cc index 242151a83a..017af72173 100644 --- a/src/tint/transform/vectorize_scalar_matrix_constructors_test.cc +++ b/src/tint/transform/vectorize_scalar_matrix_constructors_test.cc @@ -31,7 +31,7 @@ TEST_F(VectorizeScalarMatrixConstructorsTest, ShouldRunEmptyModule) { EXPECT_FALSE(ShouldRun(src)); } -TEST_P(VectorizeScalarMatrixConstructorsTest, Basic) { +TEST_P(VectorizeScalarMatrixConstructorsTest, MultipleScalars) { uint32_t cols = GetParam().first; uint32_t rows = GetParam().second; std::string mat_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows) + ""; @@ -57,7 +57,7 @@ TEST_P(VectorizeScalarMatrixConstructorsTest, Basic) { } std::string tmpl = R"( -@stage(fragment) +@fragment fn main() { let m = ${matrix}(${values}); } @@ -73,6 +73,49 @@ fn main() { EXPECT_EQ(expect, str(got)); } +TEST_P(VectorizeScalarMatrixConstructorsTest, MultipleScalarsReference) { + uint32_t cols = GetParam().first; + uint32_t rows = GetParam().second; + std::string mat_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows) + ""; + std::string vec_type = "vec" + std::to_string(rows) + ""; + std::string scalar_values; + std::string vector_values; + for (uint32_t c = 0; c < cols; c++) { + if (c > 0) { + vector_values += ", "; + scalar_values += ", "; + } + vector_values += vec_type + "("; + for (uint32_t r = 0; r < rows; r++) { + if (r > 0) { + scalar_values += ", "; + vector_values += ", "; + } + auto value = "v[" + std::to_string((c * rows + r) % 4) + "]"; + scalar_values += value; + vector_values += value; + } + vector_values += ")"; + } + + std::string tmpl = R"( +@fragment +fn main() { + let v = vec4(1.0, 2.0, 3.0, 8.0); + let m = ${matrix}(${values}); +} +)"; + tmpl = utils::ReplaceAll(tmpl, "${matrix}", mat_type); + auto src = utils::ReplaceAll(tmpl, "${values}", scalar_values); + auto expect = utils::ReplaceAll(tmpl, "${values}", vector_values); + + EXPECT_TRUE(ShouldRun(src)); + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + TEST_P(VectorizeScalarMatrixConstructorsTest, NonScalarConstructors) { uint32_t cols = GetParam().first; uint32_t rows = GetParam().second; @@ -87,7 +130,7 @@ TEST_P(VectorizeScalarMatrixConstructorsTest, NonScalarConstructors) { } std::string tmpl = R"( -@stage(fragment) +@fragment fn main() { let m = ${matrix}(${columns}); } diff --git a/src/tint/transform/vertex_pulling.cc b/src/tint/transform/vertex_pulling.cc index 6d315f5ebc..346bb1600d 100644 --- a/src/tint/transform/vertex_pulling.cc +++ b/src/tint/transform/vertex_pulling.cc @@ -228,7 +228,7 @@ struct State { Symbol pulling_position_name; Symbol struct_buffer_name; std::unordered_map vertex_buffer_names; - ast::VariableList new_function_parameters; + utils::Vector new_function_parameters; /// Generate the vertex buffer binding name /// @param index index to append to buffer name @@ -254,17 +254,14 @@ struct State { static const char kStructName[] = "TintVertexData"; auto* struct_type = ctx.dst->Structure(ctx.dst->Symbols().New(kStructName), - { + utils::Vector{ ctx.dst->Member(GetStructBufferName(), ctx.dst->ty.array()), }); for (uint32_t i = 0; i < cfg.vertex_state.size(); ++i) { // The decorated variable with struct type - ctx.dst->Global(GetVertexBufferName(i), ctx.dst->ty.Of(struct_type), - ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - ctx.dst->create(i), - ctx.dst->create(cfg.pulling_group), - }); + ctx.dst->GlobalVar(GetVertexBufferName(i), ctx.dst->ty.Of(struct_type), + ast::StorageClass::kStorage, ast::Access::kRead, ctx.dst->Binding(i), + ctx.dst->Group(cfg.pulling_group)); } } @@ -273,7 +270,7 @@ struct State { // Assign by looking at the vertex descriptor to find attributes with // matching location. - ast::StatementList stmts; + utils::Vector stmts; for (uint32_t buffer_idx = 0; buffer_idx < cfg.vertex_state.size(); ++buffer_idx) { const VertexBufferLayoutDescriptor& buffer_layout = cfg.vertex_state[buffer_idx]; @@ -303,8 +300,7 @@ struct State { } // let pulling_offset_n = - stmts.emplace_back( - ctx.dst->Decl(ctx.dst->Let(buffer_array_base, nullptr, attribute_offset))); + stmts.Push(ctx.dst->Decl(ctx.dst->Let(buffer_array_base, attribute_offset))); for (const VertexAttributeDescriptor& attribute_desc : buffer_layout.attributes) { auto it = location_info.find(attribute_desc.shader_location); @@ -356,24 +352,24 @@ struct State { } else if (var_dt.width > fmt_dt.width) { // WGSL variable vector width is wider than the loaded vector width const ast::Type* ty = nullptr; - ast::ExpressionList values{fetch}; + utils::Vector values{fetch}; switch (var_dt.base_type) { case BaseType::kI32: ty = ctx.dst->ty.i32(); for (uint32_t i = fmt_dt.width; i < var_dt.width; i++) { - values.emplace_back(ctx.dst->Expr(i32((i == 3) ? 1 : 0))); + values.Push(ctx.dst->Expr((i == 3) ? 1_i : 0_i)); } break; case BaseType::kU32: ty = ctx.dst->ty.u32(); for (uint32_t i = fmt_dt.width; i < var_dt.width; i++) { - values.emplace_back(ctx.dst->Expr(u32((i == 3) ? 1u : 0u))); + values.Push(ctx.dst->Expr((i == 3) ? 1_u : 0_u)); } break; case BaseType::kF32: ty = ctx.dst->ty.f32(); for (uint32_t i = fmt_dt.width; i < var_dt.width; i++) { - values.emplace_back(ctx.dst->Expr((i == 3) ? 1.f : 0.f)); + values.Push(ctx.dst->Expr((i == 3) ? 1_f : 0_f)); } break; default: @@ -384,15 +380,15 @@ struct State { } // Assign the value to the WGSL variable - stmts.emplace_back(ctx.dst->Assign(var.expr(), value)); + stmts.Push(ctx.dst->Assign(var.expr(), value)); } } - if (stmts.empty()) { + if (stmts.IsEmpty()) { return nullptr; } - return ctx.dst->create(stmts); + return ctx.dst->create(std::move(stmts)); } /// Generates an expression reading from a buffer a specific format. @@ -679,11 +675,11 @@ struct State { const ast::Type* base_type, VertexFormat base_format, uint32_t count) { - ast::ExpressionList expr_list; + utils::Vector expr_list; for (uint32_t i = 0; i < count; ++i) { // Offset read position by element_stride for each component uint32_t primitive_offset = offset + element_stride * i; - expr_list.push_back(LoadPrimitive(array_base, primitive_offset, buffer, base_format)); + expr_list.Push(LoadPrimitive(array_base, primitive_offset, buffer, base_format)); } return ctx.dst->Construct(ctx.dst->create(base_type, count), @@ -695,7 +691,7 @@ struct State { /// vertex_index and instance_index builtins if present. /// @param func the entry point function /// @param param the parameter to process - void ProcessNonStructParameter(const ast::Function* func, const ast::Variable* param) { + void ProcessNonStructParameter(const ast::Function* func, const ast::Parameter* param) { if (auto* location = ast::GetAttribute(param->attributes)) { // Create a function-scope variable to replace the parameter. auto func_var_sym = ctx.Clone(param->symbol); @@ -709,16 +705,16 @@ struct State { location_info[location->value] = info; } else if (auto* builtin = ast::GetAttribute(param->attributes)) { // Check for existing vertex_index and instance_index builtins. - if (builtin->builtin == ast::Builtin::kVertexIndex) { + if (builtin->builtin == ast::BuiltinValue::kVertexIndex) { vertex_index_expr = [this, param]() { return ctx.dst->Expr(ctx.Clone(param->symbol)); }; - } else if (builtin->builtin == ast::Builtin::kInstanceIndex) { + } else if (builtin->builtin == ast::BuiltinValue::kInstanceIndex) { instance_index_expr = [this, param]() { return ctx.dst->Expr(ctx.Clone(param->symbol)); }; } - new_function_parameters.push_back(ctx.Clone(param)); + new_function_parameters.Push(ctx.Clone(param)); } else { TINT_ICE(Transform, ctx.dst->Diagnostics()) << "Invalid entry point parameter"; } @@ -733,13 +729,13 @@ struct State { /// @param param the parameter to process /// @param struct_ty the structure type void ProcessStructParameter(const ast::Function* func, - const ast::Variable* param, + const ast::Parameter* param, const ast::Struct* struct_ty) { auto param_sym = ctx.Clone(param->symbol); // Process the struct members. bool has_locations = false; - ast::StructMemberList members_to_clone; + utils::Vector members_to_clone; for (auto* member : struct_ty->members) { auto member_sym = ctx.Clone(member->symbol); std::function member_expr = [this, param_sym, member_sym]() { @@ -756,12 +752,12 @@ struct State { } else if (auto* builtin = ast::GetAttribute(member->attributes)) { // Check for existing vertex_index and instance_index builtins. - if (builtin->builtin == ast::Builtin::kVertexIndex) { + if (builtin->builtin == ast::BuiltinValue::kVertexIndex) { vertex_index_expr = member_expr; - } else if (builtin->builtin == ast::Builtin::kInstanceIndex) { + } else if (builtin->builtin == ast::BuiltinValue::kInstanceIndex) { instance_index_expr = member_expr; } - members_to_clone.push_back(member); + members_to_clone.Push(member); } else { TINT_ICE(Transform, ctx.dst->Diagnostics()) << "Invalid entry point parameter"; } @@ -769,7 +765,7 @@ struct State { if (!has_locations) { // Nothing to do. - new_function_parameters.push_back(ctx.Clone(param)); + new_function_parameters.Push(ctx.Clone(param)); return; } @@ -777,21 +773,20 @@ struct State { auto* func_var = ctx.dst->Var(param_sym, ctx.Clone(param->type)); ctx.InsertFront(func->body->statements, ctx.dst->Decl(func_var)); - if (!members_to_clone.empty()) { + if (!members_to_clone.IsEmpty()) { // Create a new struct without the location attributes. - ast::StructMemberList new_members; + utils::Vector new_members; for (auto* member : members_to_clone) { auto member_sym = ctx.Clone(member->symbol); auto* member_type = ctx.Clone(member->type); auto member_attrs = ctx.Clone(member->attributes); - new_members.push_back( - ctx.dst->Member(member_sym, member_type, std::move(member_attrs))); + new_members.Push(ctx.dst->Member(member_sym, member_type, std::move(member_attrs))); } auto* new_struct = ctx.dst->Structure(ctx.dst->Sym(), new_members); // Create a new function parameter with this struct. auto* new_param = ctx.dst->Param(ctx.dst->Sym(), ctx.dst->ty.Of(new_struct)); - new_function_parameters.push_back(new_param); + new_function_parameters.Push(new_param); // Copy values from the new parameter to the function-scope variable. for (auto* member : members_to_clone) { @@ -825,8 +820,9 @@ struct State { for (const VertexBufferLayoutDescriptor& layout : cfg.vertex_state) { if (layout.step_mode == VertexStepMode::kVertex) { auto name = ctx.dst->Symbols().New("tint_pulling_vertex_index"); - new_function_parameters.push_back(ctx.dst->Param( - name, ctx.dst->ty.u32(), {ctx.dst->Builtin(ast::Builtin::kVertexIndex)})); + new_function_parameters.Push(ctx.dst->Param( + name, ctx.dst->ty.u32(), + utils::Vector{ctx.dst->Builtin(ast::BuiltinValue::kVertexIndex)})); vertex_index_expr = [this, name]() { return ctx.dst->Expr(name); }; break; } @@ -836,8 +832,9 @@ struct State { for (const VertexBufferLayoutDescriptor& layout : cfg.vertex_state) { if (layout.step_mode == VertexStepMode::kInstance) { auto name = ctx.dst->Symbols().New("tint_pulling_instance_index"); - new_function_parameters.push_back(ctx.dst->Param( - name, ctx.dst->ty.u32(), {ctx.dst->Builtin(ast::Builtin::kInstanceIndex)})); + new_function_parameters.Push(ctx.dst->Param( + name, ctx.dst->ty.u32(), + utils::Vector{ctx.dst->Builtin(ast::BuiltinValue::kInstanceIndex)})); instance_index_expr = [this, name]() { return ctx.dst->Expr(name); }; break; } diff --git a/src/tint/transform/vertex_pulling.h b/src/tint/transform/vertex_pulling.h index 78756005de..92eb627524 100644 --- a/src/tint/transform/vertex_pulling.h +++ b/src/tint/transform/vertex_pulling.h @@ -128,10 +128,10 @@ using VertexStateDescriptor = std::vector; /// code, but these are types that the data may arrive as. We need to convert /// these smaller types into the base types such as `f32` and `u32` for the /// shader to use. -class VertexPulling : public Castable { +class VertexPulling final : public Castable { public: /// Configuration options for the transform - struct Config : public Castable { + struct Config final : public Castable { /// Constructor Config(); diff --git a/src/tint/transform/vertex_pulling_test.cc b/src/tint/transform/vertex_pulling_test.cc index 80768a76a3..5fb8b1cd40 100644 --- a/src/tint/transform/vertex_pulling_test.cc +++ b/src/tint/transform/vertex_pulling_test.cc @@ -37,7 +37,7 @@ TEST_F(VertexPullingTest, Error_NoEntryPoint) { TEST_F(VertexPullingTest, Error_InvalidEntryPoint) { auto* src = R"( -@stage(vertex) +@vertex fn main() -> @builtin(position) vec4 { return vec4(); } @@ -57,7 +57,7 @@ fn main() -> @builtin(position) vec4 { TEST_F(VertexPullingTest, Error_EntryPointWrongStage) { auto* src = R"( -@stage(fragment) +@fragment fn main() {} )"; @@ -75,7 +75,7 @@ fn main() {} TEST_F(VertexPullingTest, Error_BadStride) { auto* src = R"( -@stage(vertex) +@vertex fn main(@location(0) var_a : f32) -> @builtin(position) vec4 { return vec4(var_a, 0.0, 0.0, 1.0); } @@ -98,7 +98,7 @@ fn main(@location(0) var_a : f32) -> @builtin(position) vec4 { TEST_F(VertexPullingTest, BasicModule) { auto* src = R"( -@stage(vertex) +@vertex fn main() -> @builtin(position) vec4 { return vec4(); } @@ -109,7 +109,7 @@ struct TintVertexData { tint_vertex_data : array, } -@stage(vertex) +@vertex fn main() -> @builtin(position) vec4 { return vec4(); } @@ -127,7 +127,7 @@ fn main() -> @builtin(position) vec4 { TEST_F(VertexPullingTest, OneAttribute) { auto* src = R"( -@stage(vertex) +@vertex fn main(@location(0) var_a : f32) -> @builtin(position) vec4 { return vec4(var_a, 0.0, 0.0, 1.0); } @@ -140,7 +140,7 @@ struct TintVertexData { @binding(0) @group(4) var tint_pulling_vertex_buffer_0 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4 { var var_a : f32; { @@ -164,7 +164,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi TEST_F(VertexPullingTest, OneInstancedAttribute) { auto* src = R"( -@stage(vertex) +@vertex fn main(@location(0) var_a : f32) -> @builtin(position) vec4 { return vec4(var_a, 0.0, 0.0, 1.0); } @@ -177,7 +177,7 @@ struct TintVertexData { @binding(0) @group(4) var tint_pulling_vertex_buffer_0 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(instance_index) tint_pulling_instance_index : u32) -> @builtin(position) vec4 { var var_a : f32; { @@ -201,7 +201,7 @@ fn main(@builtin(instance_index) tint_pulling_instance_index : u32) -> @builtin( TEST_F(VertexPullingTest, OneAttributeDifferentOutputSet) { auto* src = R"( -@stage(vertex) +@vertex fn main(@location(0) var_a : f32) -> @builtin(position) vec4 { return vec4(var_a, 0.0, 0.0, 1.0); } @@ -214,7 +214,7 @@ struct TintVertexData { @binding(0) @group(5) var tint_pulling_vertex_buffer_0 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4 { var var_a : f32; { @@ -243,7 +243,7 @@ struct Inputs { @location(0) var_a : f32, }; -@stage(vertex) +@vertex fn main(inputs : Inputs) -> @builtin(position) vec4 { return vec4(inputs.var_a, 0.0, 0.0, 1.0); } @@ -261,7 +261,7 @@ struct Inputs { var_a : f32, } -@stage(vertex) +@vertex fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4 { var inputs : Inputs; { @@ -286,7 +286,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi // We expect the transform to use an existing builtin variables if it finds them TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) { auto* src = R"( -@stage(vertex) +@vertex fn main(@location(0) var_a : f32, @location(1) var_b : f32, @builtin(vertex_index) custom_vertex_index : u32, @@ -305,7 +305,7 @@ struct TintVertexData { @binding(1) @group(4) var tint_pulling_vertex_buffer_1 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) custom_vertex_index : u32, @builtin(instance_index) custom_instance_index : u32) -> @builtin(position) vec4 { var var_a : f32; var var_b : f32; @@ -350,7 +350,7 @@ struct Inputs { @builtin(instance_index) custom_instance_index : u32, }; -@stage(vertex) +@vertex fn main(inputs : Inputs) -> @builtin(position) vec4 { return vec4(inputs.var_a, inputs.var_b, 0.0, 1.0); } @@ -383,7 +383,7 @@ struct Inputs { custom_instance_index : u32, } -@stage(vertex) +@vertex fn main(tint_symbol_1 : tint_symbol) -> @builtin(position) vec4 { var inputs : Inputs; inputs.custom_vertex_index = tint_symbol_1.custom_vertex_index; @@ -422,7 +422,7 @@ fn main(tint_symbol_1 : tint_symbol) -> @builtin(position) vec4 { TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex_Struct_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn main(inputs : Inputs) -> @builtin(position) vec4 { return vec4(inputs.var_a, inputs.var_b, 0.0, 1.0); } @@ -451,7 +451,7 @@ struct tint_symbol { custom_instance_index : u32, } -@stage(vertex) +@vertex fn main(tint_symbol_1 : tint_symbol) -> @builtin(position) vec4 { var inputs : Inputs; inputs.custom_vertex_index = tint_symbol_1.custom_vertex_index; @@ -511,7 +511,7 @@ struct Indices { @builtin(instance_index) custom_instance_index : u32, }; -@stage(vertex) +@vertex fn main(inputs : Inputs, indices : Indices) -> @builtin(position) vec4 { return vec4(inputs.var_a, inputs.var_b, 0.0, 1.0); } @@ -540,7 +540,7 @@ struct Indices { custom_instance_index : u32, } -@stage(vertex) +@vertex fn main(indices : Indices) -> @builtin(position) vec4 { var inputs : Inputs; { @@ -577,7 +577,7 @@ fn main(indices : Indices) -> @builtin(position) vec4 { TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex_SeparateStruct_OutOfOrder) { auto* src = R"( -@stage(vertex) +@vertex fn main(inputs : Inputs, indices : Indices) -> @builtin(position) vec4 { return vec4(inputs.var_a, inputs.var_b, 0.0, 1.0); } @@ -602,7 +602,7 @@ struct TintVertexData { @binding(1) @group(4) var tint_pulling_vertex_buffer_1 : TintVertexData; -@stage(vertex) +@vertex fn main(indices : Indices) -> @builtin(position) vec4 { var inputs : Inputs; { @@ -653,7 +653,7 @@ struct Indices { TEST_F(VertexPullingTest, TwoAttributesSameBuffer) { auto* src = R"( -@stage(vertex) +@vertex fn main(@location(0) var_a : f32, @location(1) var_b : vec4) -> @builtin(position) vec4 { return vec4(); @@ -667,7 +667,7 @@ struct TintVertexData { @binding(0) @group(4) var tint_pulling_vertex_buffer_0 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4 { var var_a : f32; var var_b : vec4; @@ -695,7 +695,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi TEST_F(VertexPullingTest, FloatVectorAttributes) { auto* src = R"( -@stage(vertex) +@vertex fn main(@location(0) var_a : vec2, @location(1) var_b : vec3, @location(2) var_c : vec4 @@ -715,7 +715,7 @@ struct TintVertexData { @binding(2) @group(4) var tint_pulling_vertex_buffer_2 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4 { var var_a : vec2; var var_b : vec3; @@ -749,7 +749,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi TEST_F(VertexPullingTest, AttemptSymbolCollision) { auto* src = R"( -@stage(vertex) +@vertex fn main(@location(0) var_a : f32, @location(1) var_b : vec4) -> @builtin(position) vec4 { var tint_pulling_vertex_index : i32; @@ -767,7 +767,7 @@ struct TintVertexData { @binding(0) @group(4) var tint_pulling_vertex_buffer_0_1 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) tint_pulling_vertex_index_1 : u32) -> @builtin(position) vec4 { var var_a : f32; var var_b : vec4; @@ -799,7 +799,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index_1 : u32) -> @builtin(po TEST_F(VertexPullingTest, FormatsAligned) { auto* src = R"( -@stage(vertex) +@vertex fn main( @location(0) uint8x2 : vec2, @location(1) uint8x4 : vec4, @@ -843,7 +843,7 @@ struct TintVertexData { @binding(0) @group(4) var tint_pulling_vertex_buffer_0 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4 { var uint8x2 : vec2; var uint8x4 : vec4; @@ -944,7 +944,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi TEST_F(VertexPullingTest, FormatsStrideUnaligned) { auto* src = R"( -@stage(vertex) +@vertex fn main( @location(0) uint8x2 : vec2, @location(1) uint8x4 : vec4, @@ -989,7 +989,7 @@ struct TintVertexData { @binding(0) @group(4) var tint_pulling_vertex_buffer_0 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4 { var uint8x2 : vec2; var uint8x4 : vec4; @@ -1090,7 +1090,7 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi TEST_F(VertexPullingTest, FormatsWithVectorsResized) { auto* src = R"( -@stage(vertex) +@vertex fn main( @location(0) uint8x2 : vec3, @location(1) uint8x4 : vec2, @@ -1134,7 +1134,7 @@ struct TintVertexData { @binding(0) @group(4) var tint_pulling_vertex_buffer_0 : TintVertexData; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(position) vec4 { var uint8x2 : vec3; var uint8x4 : vec2; @@ -1172,22 +1172,22 @@ fn main(@builtin(vertex_index) tint_pulling_vertex_index : u32) -> @builtin(posi uint8x4 = (((vec4(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec4(24u, 16u, 8u, 0u)) >> vec4(24u))).xy; sint8x2 = (((vec2(bitcast((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] << 16u))) << vec2(8u, 0u)) >> vec2(24u))).x; sint8x4 = (((vec4(bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)])) << vec4(24u, 16u, 8u, 0u)) >> vec4(24u))).xy; - unorm8x2 = vec4(unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy, 0.0, 1.0); + unorm8x2 = vec4(unpack4x8unorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy, 0.0f, 1.0f); unorm8x4 = unpack4x8unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).x; - snorm8x2 = vec3(unpack4x8snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy, 0.0); + snorm8x2 = vec3(unpack4x8snorm((tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)] & 65535u)).xy, 0.0f); snorm8x4 = unpack4x8snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]).x; uint16x2 = vec3(((vec2(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]) << vec2(16u, 0u)) >> vec2(16u)), 0u); uint16x4 = (((vec2(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]).xxyy << vec4(16u, 0u, 16u, 0u)) >> vec4(16u))).xy; sint16x2 = vec4(((vec2(bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)])) << vec2(16u, 0u)) >> vec2(16u)), 0i, 1i); sint16x4 = (((vec2(bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])).xxyy << vec4(16u, 0u, 16u, 0u)) >> vec4(16u))).x; - unorm16x2 = vec3(unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0.0); + unorm16x2 = vec3(unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0.0f); unorm16x4 = vec4(unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16unorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])).x; - snorm16x2 = vec4(unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0.0, 1.0); + snorm16x2 = vec4(unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0.0f, 1.0f); snorm16x4 = vec4(unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16snorm(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])).xyz; - float16x2 = vec4(unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0.0, 1.0); + float16x2 = vec4(unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0.0f, 1.0f); float16x4 = vec4(unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), unpack2x16float(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])).x; - float32 = vec4(bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0.0, 0.0, 1.0); - float32x2 = vec4(vec2(bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])), 0.0, 1.0); + float32 = vec4(bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), 0.0f, 0.0f, 1.0f); + float32x2 = vec4(vec2(bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)])), 0.0f, 1.0f); float32x3 = vec3(bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)])).xy; float32x4 = vec4(bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)]), bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 17u)]), bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 18u)]), bitcast(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 19u)])).xyz; uint32 = vec3(tint_pulling_vertex_buffer_0.tint_vertex_data[(buffer_array_base_0 + 16u)], 0u, 0u); diff --git a/src/tint/transform/while_to_loop.cc b/src/tint/transform/while_to_loop.cc new file mode 100644 index 0000000000..45944e67ae --- /dev/null +++ b/src/tint/transform/while_to_loop.cc @@ -0,0 +1,67 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/while_to_loop.h" + +#include "src/tint/ast/break_statement.h" +#include "src/tint/program_builder.h" + +TINT_INSTANTIATE_TYPEINFO(tint::transform::WhileToLoop); + +namespace tint::transform { + +WhileToLoop::WhileToLoop() = default; + +WhileToLoop::~WhileToLoop() = default; + +bool WhileToLoop::ShouldRun(const Program* program, const DataMap&) const { + for (auto* node : program->ASTNodes().Objects()) { + if (node->Is()) { + return true; + } + } + return false; +} + +void WhileToLoop::Run(CloneContext& ctx, const DataMap&, DataMap&) const { + ctx.ReplaceAll([&](const ast::WhileStatement* w) -> const ast::Statement* { + utils::Vector stmts; + auto* cond = w->condition; + + // !condition + auto* not_cond = + ctx.dst->create(ast::UnaryOp::kNot, ctx.Clone(cond)); + + // { break; } + auto* break_body = ctx.dst->Block(ctx.dst->create()); + + // if (!condition) { break; } + stmts.Push(ctx.dst->If(not_cond, break_body)); + + for (auto* stmt : w->body->statements) { + stmts.Push(ctx.Clone(stmt)); + } + + const ast::BlockStatement* continuing = nullptr; + + auto* body = ctx.dst->Block(stmts); + auto* loop = ctx.dst->create(body, continuing); + + return loop; + }); + + ctx.Clone(); +} + +} // namespace tint::transform diff --git a/src/tint/transform/while_to_loop.h b/src/tint/transform/while_to_loop.h new file mode 100644 index 0000000000..4915d681e6 --- /dev/null +++ b/src/tint/transform/while_to_loop.h @@ -0,0 +1,49 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_TRANSFORM_WHILE_TO_LOOP_H_ +#define SRC_TINT_TRANSFORM_WHILE_TO_LOOP_H_ + +#include "src/tint/transform/transform.h" + +namespace tint::transform { + +/// WhileToLoop is a Transform that converts a while statement into a loop +/// statement. This is required by the SPIR-V writer. +class WhileToLoop final : public Castable { + public: + /// Constructor + WhileToLoop(); + + /// Destructor + ~WhileToLoop() override; + + /// @param program the program to inspect + /// @param data optional extra transform-specific input data + /// @returns true if this transform should be run for the given program + bool ShouldRun(const Program* program, const DataMap& data = {}) const override; + + protected: + /// Runs the transform using the CloneContext built for transforming a + /// program. Run() is responsible for calling Clone() on the CloneContext. + /// @param ctx the CloneContext primed with the input program and + /// ProgramBuilder + /// @param inputs optional extra transform-specific input data + /// @param outputs optional extra transform-specific output data + void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; +}; + +} // namespace tint::transform + +#endif // SRC_TINT_TRANSFORM_WHILE_TO_LOOP_H_ diff --git a/src/tint/transform/while_to_loop_test.cc b/src/tint/transform/while_to_loop_test.cc new file mode 100644 index 0000000000..6e5699dfb7 --- /dev/null +++ b/src/tint/transform/while_to_loop_test.cc @@ -0,0 +1,129 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/while_to_loop.h" + +#include "src/tint/transform/test_helper.h" + +namespace tint::transform { +namespace { + +using WhileToLoopTest = TransformTest; + +TEST_F(WhileToLoopTest, ShouldRunEmptyModule) { + auto* src = R"()"; + + EXPECT_FALSE(ShouldRun(src)); +} + +TEST_F(WhileToLoopTest, ShouldRunHasWhile) { + auto* src = R"( +fn f() { + while (true) { + break; + } +} +)"; + + EXPECT_TRUE(ShouldRun(src)); +} + +TEST_F(WhileToLoopTest, EmptyModule) { + auto* src = ""; + auto* expect = src; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +// Test an empty for loop. +TEST_F(WhileToLoopTest, Empty) { + auto* src = R"( +fn f() { + while (true) { + break; + } +} +)"; + + auto* expect = R"( +fn f() { + loop { + if (!(true)) { + break; + } + break; + } +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +// Test a for loop with non-empty body. +TEST_F(WhileToLoopTest, Body) { + auto* src = R"( +fn f() { + while (true) { + discard; + } +} +)"; + + auto* expect = R"( +fn f() { + loop { + if (!(true)) { + break; + } + discard; + } +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +// Test a loop with a break condition +TEST_F(WhileToLoopTest, BreakCondition) { + auto* src = R"( +fn f() { + while (0 == 1) { + } +} +)"; + + auto* expect = R"( +fn f() { + loop { + if (!((0 == 1))) { + break; + } + } +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +} // namespace + +} // namespace tint::transform diff --git a/src/tint/transform/wrap_arrays_in_structs.cc b/src/tint/transform/wrap_arrays_in_structs.cc deleted file mode 100644 index b1dc5e8ab4..0000000000 --- a/src/tint/transform/wrap_arrays_in_structs.cc +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/transform/wrap_arrays_in_structs.h" - -#include - -#include "src/tint/program_builder.h" -#include "src/tint/sem/array.h" -#include "src/tint/sem/call.h" -#include "src/tint/sem/expression.h" -#include "src/tint/sem/type_constructor.h" -#include "src/tint/utils/map.h" -#include "src/tint/utils/transform.h" - -TINT_INSTANTIATE_TYPEINFO(tint::transform::WrapArraysInStructs); - -namespace tint::transform { - -WrapArraysInStructs::WrappedArrayInfo::WrappedArrayInfo() = default; -WrapArraysInStructs::WrappedArrayInfo::WrappedArrayInfo(const WrappedArrayInfo&) = default; -WrapArraysInStructs::WrappedArrayInfo::~WrappedArrayInfo() = default; - -WrapArraysInStructs::WrapArraysInStructs() = default; - -WrapArraysInStructs::~WrapArraysInStructs() = default; - -bool WrapArraysInStructs::ShouldRun(const Program* program, const DataMap&) const { - for (auto* node : program->ASTNodes().Objects()) { - if (program->Sem().Get(node->As())) { - return true; - } - } - return false; -} - -void WrapArraysInStructs::Run(CloneContext& ctx, const DataMap&, DataMap&) const { - auto& sem = ctx.src->Sem(); - - std::unordered_map wrapped_arrays; - auto wrapper = [&](const sem::Array* array) { return WrapArray(ctx, wrapped_arrays, array); }; - auto wrapper_typename = [&](const sem::Array* arr) -> ast::TypeName* { - auto info = wrapper(arr); - return info ? ctx.dst->create(info.wrapper_name) : nullptr; - }; - - // Replace all array types with their corresponding wrapper - ctx.ReplaceAll([&](const ast::Type* ast_type) -> const ast::Type* { - auto* type = ctx.src->TypeOf(ast_type); - if (auto* array = type->UnwrapRef()->As()) { - return wrapper_typename(array); - } - return nullptr; - }); - - // Fix up index accessors so `a[1]` becomes `a.arr[1]` - ctx.ReplaceAll( - [&](const ast::IndexAccessorExpression* accessor) -> const ast::IndexAccessorExpression* { - if (auto* array = - ::tint::As(sem.Get(accessor->object)->Type()->UnwrapRef())) { - if (wrapper(array)) { - // Array is wrapped in a structure. Emit a member accessor to get - // to the actual array. - auto* arr = ctx.Clone(accessor->object); - auto* idx = ctx.Clone(accessor->index); - auto* unwrapped = ctx.dst->MemberAccessor(arr, "arr"); - return ctx.dst->IndexAccessor(accessor->source, unwrapped, idx); - } - } - return nullptr; - }); - - // Fix up array constructors so `A(1,2)` becomes `tint_array_wrapper(A(1,2))` - ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::Expression* { - if (auto* call = sem.Get(expr)) { - if (auto* ctor = call->Target()->As()) { - if (auto* array = ctor->ReturnType()->As()) { - if (auto w = wrapper(array)) { - // Wrap the array type constructor with another constructor for - // the wrapper - auto* wrapped_array_ty = ctx.dst->ty.type_name(w.wrapper_name); - auto* array_ty = w.array_type(ctx); - auto args = utils::Transform(call->Arguments(), - [&](const tint::sem::Expression* s) { - return ctx.Clone(s->Declaration()); - }); - auto* arr_ctor = ctx.dst->Construct(array_ty, args); - return ctx.dst->Construct(wrapped_array_ty, arr_ctor); - } - } - } - } - return nullptr; - }); - - ctx.Clone(); -} - -WrapArraysInStructs::WrappedArrayInfo WrapArraysInStructs::WrapArray( - CloneContext& ctx, - std::unordered_map& wrapped_arrays, - const sem::Array* array) const { - if (array->IsRuntimeSized()) { - return {}; // We don't want to wrap runtime sized arrays - } - - return utils::GetOrCreate(wrapped_arrays, array, [&] { - WrappedArrayInfo info; - - // Generate a unique name for the array wrapper - info.wrapper_name = ctx.dst->Symbols().New("tint_array_wrapper"); - - // Examine the element type. Is it also an array? - std::function el_type; - if (auto* el_array = array->ElemType()->As()) { - // Array of array - call WrapArray() on the element type - if (auto el = WrapArray(ctx, wrapped_arrays, el_array)) { - el_type = [=](CloneContext& c) { - return c.dst->create(el.wrapper_name); - }; - } - } - - // If the element wasn't an array, just create the typical AST type for it - if (!el_type) { - el_type = [=](CloneContext& c) { return CreateASTTypeFor(c, array->ElemType()); }; - } - - // Construct the single structure field type - info.array_type = [=](CloneContext& c) { - ast::AttributeList attrs; - if (!array->IsStrideImplicit()) { - attrs.emplace_back(c.dst->create(array->Stride())); - } - return c.dst->ty.array(el_type(c), u32(array->Count()), std::move(attrs)); - }; - - // Structure() will create and append the ast::Struct to the - // global declarations of `ctx.dst`. As we haven't finished building the - // current module-scope statement or function, this will be placed - // immediately before the usage. - ctx.dst->Structure(info.wrapper_name, {ctx.dst->Member("arr", info.array_type(ctx))}); - return info; - }); -} - -} // namespace tint::transform diff --git a/src/tint/transform/wrap_arrays_in_structs.h b/src/tint/transform/wrap_arrays_in_structs.h deleted file mode 100644 index 4653c6beea..0000000000 --- a/src/tint/transform/wrap_arrays_in_structs.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_TINT_TRANSFORM_WRAP_ARRAYS_IN_STRUCTS_H_ -#define SRC_TINT_TRANSFORM_WRAP_ARRAYS_IN_STRUCTS_H_ - -#include -#include - -#include "src/tint/transform/transform.h" - -// Forward declarations -namespace tint::ast { -class Type; -} // namespace tint::ast - -namespace tint::transform { - -/// WrapArraysInStructs is a transform that replaces all array types with a -/// structure holding a single field of that array type. -/// Array index expressions and constructors are also adjusted to deal with this -/// wrapping. -/// This transform helps with backends that cannot directly return arrays or use -/// them as parameters. -class WrapArraysInStructs : public Castable { - public: - /// Constructor - WrapArraysInStructs(); - - /// Destructor - ~WrapArraysInStructs() override; - - /// @param program the program to inspect - /// @param data optional extra transform-specific input data - /// @returns true if this transform should be run for the given program - bool ShouldRun(const Program* program, const DataMap& data = {}) const override; - - protected: - /// Runs the transform using the CloneContext built for transforming a - /// program. Run() is responsible for calling Clone() on the CloneContext. - /// @param ctx the CloneContext primed with the input program and - /// ProgramBuilder - /// @param inputs optional extra transform-specific input data - /// @param outputs optional extra transform-specific output data - void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; - - private: - struct WrappedArrayInfo { - WrappedArrayInfo(); - WrappedArrayInfo(const WrappedArrayInfo&); - ~WrappedArrayInfo(); - - Symbol wrapper_name; - std::function array_type; - - operator bool() { return wrapper_name.IsValid(); } - }; - - /// WrapArray wraps the fixed-size array type in a new structure (if it hasn't - /// already been wrapped). WrapArray will recursively wrap arrays-of-arrays. - /// The new structure will be added to module-scope type declarations of - /// `ctx.dst`. - /// @param ctx the CloneContext - /// @param wrapped_arrays a map of src array type to the wrapped structure - /// name - /// @param array the array type - /// @return the name of the structure that wraps the array, or an invalid - /// Symbol if this array should not be wrapped - WrappedArrayInfo WrapArray( - CloneContext& ctx, - std::unordered_map& wrapped_arrays, - const sem::Array* array) const; -}; - -} // namespace tint::transform - -#endif // SRC_TINT_TRANSFORM_WRAP_ARRAYS_IN_STRUCTS_H_ diff --git a/src/tint/transform/wrap_arrays_in_structs_test.cc b/src/tint/transform/wrap_arrays_in_structs_test.cc deleted file mode 100644 index 7a7a6b337d..0000000000 --- a/src/tint/transform/wrap_arrays_in_structs_test.cc +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "src/tint/transform/wrap_arrays_in_structs.h" - -#include -#include - -#include "src/tint/transform/test_helper.h" - -namespace tint::transform { -namespace { - -using WrapArraysInStructsTest = TransformTest; - -TEST_F(WrapArraysInStructsTest, ShouldRunEmptyModule) { - auto* src = R"()"; - - EXPECT_FALSE(ShouldRun(src)); -} - -TEST_F(WrapArraysInStructsTest, ShouldRunHasArray) { - auto* src = R"( -var arr : array; -)"; - - EXPECT_TRUE(ShouldRun(src)); -} - -TEST_F(WrapArraysInStructsTest, EmptyModule) { - auto* src = R"()"; - auto* expect = src; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, ArrayAsGlobal) { - auto* src = R"( -var arr : array; -)"; - auto* expect = R"( -struct tint_array_wrapper { - arr : array, -} - -var arr : tint_array_wrapper; -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, ArrayAsFunctionVar) { - auto* src = R"( -fn f() { - var arr : array; - let x = arr[3]; -} -)"; - auto* expect = R"( -struct tint_array_wrapper { - arr : array, -} - -fn f() { - var arr : tint_array_wrapper; - let x = arr.arr[3]; -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, ArrayAsParam) { - auto* src = R"( -fn f(a : array) -> i32 { - return a[2]; -} -)"; - auto* expect = R"( -struct tint_array_wrapper { - arr : array, -} - -fn f(a : tint_array_wrapper) -> i32 { - return a.arr[2]; -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, ArrayAsReturn) { - auto* src = R"( -fn f() -> array { - return array(1, 2, 3, 4); -} -)"; - auto* expect = R"( -struct tint_array_wrapper { - arr : array, -} - -fn f() -> tint_array_wrapper { - return tint_array_wrapper(array(1, 2, 3, 4)); -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, ArrayAlias) { - auto* src = R"( -type Inner = array; -type Array = array; - -fn f() { - var arr : Array; - arr = Array(); - arr = Array(Inner(1, 2), Inner(3, 4)); - let vals : Array = Array(Inner(1, 2), Inner(3, 4)); - arr = vals; - let x = arr[3]; -} -)"; - auto* expect = R"( -struct tint_array_wrapper { - arr : array, -} - -type Inner = tint_array_wrapper; - -struct tint_array_wrapper_1 { - arr : array, -} - -type Array = tint_array_wrapper_1; - -fn f() { - var arr : tint_array_wrapper_1; - arr = tint_array_wrapper_1(array()); - arr = tint_array_wrapper_1(array(tint_array_wrapper(array(1, 2)), tint_array_wrapper(array(3, 4)))); - let vals : tint_array_wrapper_1 = tint_array_wrapper_1(array(tint_array_wrapper(array(1, 2)), tint_array_wrapper(array(3, 4)))); - arr = vals; - let x = arr.arr[3]; -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, ArrayAlias_OutOfOrder) { - auto* src = R"( -fn f() { - var arr : Array; - arr = Array(); - arr = Array(Inner(1, 2), Inner(3, 4)); - let vals : Array = Array(Inner(1, 2), Inner(3, 4)); - arr = vals; - let x = arr[3]; -} - -type Array = array; -type Inner = array; -)"; - auto* expect = R"( -struct tint_array_wrapper_1 { - arr : array, -} - -struct tint_array_wrapper { - arr : array, -} - -fn f() { - var arr : tint_array_wrapper; - arr = tint_array_wrapper(array()); - arr = tint_array_wrapper(array(tint_array_wrapper_1(array(1, 2)), tint_array_wrapper_1(array(3, 4)))); - let vals : tint_array_wrapper = tint_array_wrapper(array(tint_array_wrapper_1(array(1, 2)), tint_array_wrapper_1(array(3, 4)))); - arr = vals; - let x = arr.arr[3]; -} - -type Array = tint_array_wrapper; - -type Inner = tint_array_wrapper_1; -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, ArraysInStruct) { - auto* src = R"( -struct S { - a : array, - b : array, - c : array, -}; -)"; - auto* expect = R"( -struct tint_array_wrapper { - arr : array, -} - -struct tint_array_wrapper_1 { - arr : array, -} - -struct S { - a : tint_array_wrapper, - b : tint_array_wrapper_1, - c : tint_array_wrapper, -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, ArraysOfArraysInStruct) { - auto* src = R"( -struct S { - a : array, - b : array, 4>, - c : array, 4>, 4>, -}; -)"; - auto* expect = R"( -struct tint_array_wrapper { - arr : array, -} - -struct tint_array_wrapper_1 { - arr : array, -} - -struct tint_array_wrapper_2 { - arr : array, -} - -struct S { - a : tint_array_wrapper, - b : tint_array_wrapper_1, - c : tint_array_wrapper_2, -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, AccessArraysOfArraysInStruct) { - auto* src = R"( -struct S { - a : array, - b : array, 4>, - c : array, 4>, 4>, -}; - -fn f(s : S) -> i32 { - return s.a[2] + s.b[1][2] + s.c[3][1][2]; -} -)"; - auto* expect = R"( -struct tint_array_wrapper { - arr : array, -} - -struct tint_array_wrapper_1 { - arr : array, -} - -struct tint_array_wrapper_2 { - arr : array, -} - -struct S { - a : tint_array_wrapper, - b : tint_array_wrapper_1, - c : tint_array_wrapper_2, -} - -fn f(s : S) -> i32 { - return ((s.a.arr[2] + s.b.arr[1].arr[2]) + s.c.arr[3].arr[1].arr[2]); -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, DeclarationOrder) { - auto* src = R"( -type T0 = i32; - -type T1 = array; - -type T2 = i32; - -fn f1(a : array) { -} - -type T3 = i32; - -fn f2() { - var v : array; -} -)"; - auto* expect = R"( -type T0 = i32; - -struct tint_array_wrapper { - arr : array, -} - -type T1 = tint_array_wrapper; - -type T2 = i32; - -struct tint_array_wrapper_1 { - arr : array, -} - -fn f1(a : tint_array_wrapper_1) { -} - -type T3 = i32; - -struct tint_array_wrapper_2 { - arr : array, -} - -fn f2() { - var v : tint_array_wrapper_2; -} -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -TEST_F(WrapArraysInStructsTest, DeclarationOrder_OutOfOrder) { - auto* src = R"( -fn f2() { - var v : array; -} - -type T3 = i32; - -fn f1(a : array) { -} - -type T2 = i32; - -type T1 = array; - -type T0 = i32; -)"; - auto* expect = R"( -struct tint_array_wrapper { - arr : array, -} - -fn f2() { - var v : tint_array_wrapper; -} - -type T3 = i32; - -struct tint_array_wrapper_1 { - arr : array, -} - -fn f1(a : tint_array_wrapper_1) { -} - -type T2 = i32; - -struct tint_array_wrapper_2 { - arr : array, -} - -type T1 = tint_array_wrapper_2; - -type T0 = i32; -)"; - - auto got = Run(src); - - EXPECT_EQ(expect, str(got)); -} - -} // namespace -} // namespace tint::transform diff --git a/src/tint/transform/zero_init_workgroup_memory.cc b/src/tint/transform/zero_init_workgroup_memory.cc index 21a4565142..94df3b9885 100644 --- a/src/tint/transform/zero_init_workgroup_memory.cc +++ b/src/tint/transform/zero_init_workgroup_memory.cc @@ -32,6 +32,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::ZeroInitWorkgroupMemory); namespace tint::transform { +using StatementList = utils::Vector; + /// PIMPL state for the ZeroInitWorkgroupMemory transform struct ZeroInitWorkgroupMemory::State { /// The clone context @@ -73,7 +75,7 @@ struct ZeroInitWorkgroupMemory::State { }; /// A list of unique ArrayIndex - using ArrayIndices = utils::UniqueVector; + using ArrayIndices = utils::UniqueVector; /// Expression holds information about an expression that is being built for a /// statement will zero workgroup values. @@ -137,7 +139,7 @@ struct ZeroInitWorkgroupMemory::State { std::function local_index; for (auto* param : fn->params) { if (auto* builtin = ast::GetAttribute(param->attributes)) { - if (builtin->builtin == ast::Builtin::kLocalInvocationIndex) { + if (builtin->builtin == ast::BuiltinValue::kLocalInvocationIndex) { local_index = [=] { return b.Expr(ctx.Clone(param->symbol)); }; break; } @@ -147,7 +149,7 @@ struct ZeroInitWorkgroupMemory::State { for (auto* member : str->Members()) { if (auto* builtin = ast::GetAttribute( member->Declaration()->attributes)) { - if (builtin->builtin == ast::Builtin::kLocalInvocationIndex) { + if (builtin->builtin == ast::BuiltinValue::kLocalInvocationIndex) { local_index = [=] { auto* param_expr = b.Expr(ctx.Clone(param->symbol)); auto member_name = ctx.Clone(member->Declaration()->symbol); @@ -162,7 +164,9 @@ struct ZeroInitWorkgroupMemory::State { if (!local_index) { // No existing local index parameter. Append one to the entry point. auto* param = b.Param(b.Symbols().New("local_invocation_index"), b.ty.u32(), - {b.Builtin(ast::Builtin::kLocalInvocationIndex)}); + utils::Vector{ + b.Builtin(ast::BuiltinValue::kLocalInvocationIndex), + }); ctx.InsertBack(fn->params, param); local_index = [=] { return b.Expr(param->symbol); }; } @@ -189,7 +193,7 @@ struct ZeroInitWorkgroupMemory::State { ArrayIndices array_indices; for (auto& s : stmts) { for (auto& idx : s.array_indices) { - array_indices.add(idx); + array_indices.Add(idx); } } @@ -216,7 +220,7 @@ struct ZeroInitWorkgroupMemory::State { auto block = DeclareArrayIndices(num_iterations, array_indices, [&] { return b.Expr(idx); }); for (auto& s : stmts) { - block.emplace_back(s.stmt); + block.Push(s.stmt); } auto* for_loop = b.For(init, cond, cont, b.Block(block)); ctx.InsertFront(fn->body->statements, for_loop); @@ -232,7 +236,7 @@ struct ZeroInitWorkgroupMemory::State { auto block = DeclareArrayIndices(num_iterations, array_indices, [&] { return b.Expr(local_index()); }); for (auto& s : stmts) { - block.emplace_back(s.stmt); + block.Push(s.stmt); } auto* if_stmt = b.If(cond, b.Block(block)); ctx.InsertFront(fn->body->statements, if_stmt); @@ -246,7 +250,7 @@ struct ZeroInitWorkgroupMemory::State { auto block = DeclareArrayIndices(num_iterations, array_indices, [&] { return b.Expr(local_index()); }); for (auto& s : stmts) { - block.emplace_back(s.stmt); + block.Push(s.stmt); } ctx.InsertFront(fn->body->statements, b.Block(block)); } @@ -307,7 +311,7 @@ struct ZeroInitWorkgroupMemory::State { auto division = num_values; auto a = get_expr(modulo); auto array_indices = a.array_indices; - array_indices.add(ArrayIndex{modulo, division}); + array_indices.Add(ArrayIndex{modulo, division}); auto index = utils::GetOrCreate(array_index_names, ArrayIndex{modulo, division}, [&] { return b.Symbols().New("i"); }); return Expression{b.IndexAccessor(a.expr, index), a.num_iterations, array_indices}; @@ -327,11 +331,10 @@ struct ZeroInitWorkgroupMemory::State { /// @param iteration a function that returns the index of the current /// iteration. /// @returns the list of `let` statements that declare the array indices - ast::StatementList DeclareArrayIndices( - uint32_t num_iterations, - const ArrayIndices& array_indices, - const std::function& iteration) { - ast::StatementList stmts; + StatementList DeclareArrayIndices(uint32_t num_iterations, + const ArrayIndices& array_indices, + const std::function& iteration) { + StatementList stmts; std::map indices_by_name; for (auto index : array_indices) { auto name = array_index_names.at(index); @@ -341,7 +344,7 @@ struct ZeroInitWorkgroupMemory::State { : iteration(); auto* div = (index.division != 1u) ? b.Div(mod, u32(index.division)) : mod; auto* decl = b.Decl(b.Let(name, b.ty.u32(), div)); - stmts.emplace_back(decl); + stmts.Push(decl); } return stmts; } @@ -358,14 +361,9 @@ struct ZeroInitWorkgroupMemory::State { continue; } auto* sem = ctx.src->Sem().Get(expr); - if (auto c = sem->ConstantValue()) { - if (c.ElementType()->Is()) { - workgroup_size_const *= static_cast(c.Elements()[0].i32); - continue; - } else if (c.ElementType()->Is()) { - workgroup_size_const *= c.Elements()[0].u32; - continue; - } + if (auto* c = sem->ConstantValue()) { + workgroup_size_const *= c->As(); + continue; } // Constant value could not be found. Build expression instead. workgroup_size_expr = [this, expr, size = workgroup_size_expr] { @@ -421,8 +419,8 @@ ZeroInitWorkgroupMemory::ZeroInitWorkgroupMemory() = default; ZeroInitWorkgroupMemory::~ZeroInitWorkgroupMemory() = default; bool ZeroInitWorkgroupMemory::ShouldRun(const Program* program, const DataMap&) const { - for (auto* decl : program->AST().GlobalDeclarations()) { - if (auto* var = decl->As()) { + for (auto* global : program->AST().GlobalVariables()) { + if (auto* var = global->As()) { if (var->declared_storage_class == ast::StorageClass::kWorkgroup) { return true; } diff --git a/src/tint/transform/zero_init_workgroup_memory.h b/src/tint/transform/zero_init_workgroup_memory.h index c75772553d..07feaa895a 100644 --- a/src/tint/transform/zero_init_workgroup_memory.h +++ b/src/tint/transform/zero_init_workgroup_memory.h @@ -22,7 +22,7 @@ namespace tint::transform { /// ZeroInitWorkgroupMemory is a transform that injects code at the top of entry /// points to zero-initialize workgroup memory used by that entry point (and all /// transitive functions called by that entry point) -class ZeroInitWorkgroupMemory : public Castable { +class ZeroInitWorkgroupMemory final : public Castable { public: /// Constructor ZeroInitWorkgroupMemory(); diff --git a/src/tint/transform/zero_init_workgroup_memory_test.cc b/src/tint/transform/zero_init_workgroup_memory_test.cc index c846d55eed..93f3933f41 100644 --- a/src/tint/transform/zero_init_workgroup_memory_test.cc +++ b/src/tint/transform/zero_init_workgroup_memory_test.cc @@ -81,7 +81,7 @@ fn unreferenced() { b = c; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } )"; @@ -94,7 +94,7 @@ fn f() { TEST_F(ZeroInitWorkgroupMemoryTest, UnreferencedWorkgroupVars_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { } @@ -119,7 +119,7 @@ TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_ExistingLocalIndex) { auto* src = R"( var v : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { _ = v; // Initialization should be inserted above this statement } @@ -127,7 +127,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) { auto* expect = R"( var v : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { { v = i32(); @@ -144,7 +144,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) { TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_ExistingLocalIndex_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { _ = v; // Initialization should be inserted above this statement } @@ -152,7 +152,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) { var v : i32; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { { v = i32(); @@ -177,7 +177,7 @@ struct Params { @builtin(local_invocation_index) local_idx : u32, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(params : Params) { _ = v; // Initialization should be inserted above this statement } @@ -190,7 +190,7 @@ struct Params { local_idx : u32, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(params : Params) { { v = i32(); @@ -207,7 +207,7 @@ fn f(params : Params) { TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_ExistingLocalIndexInStruct_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(params : Params) { _ = v; // Initialization should be inserted above this statement } @@ -219,7 +219,7 @@ struct Params { var v : i32; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(params : Params) { { v = i32(); @@ -245,7 +245,7 @@ TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_InjectedLocalIndex) { auto* src = R"( var v : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { _ = v; // Initialization should be inserted above this statement } @@ -253,7 +253,7 @@ fn f() { auto* expect = R"( var v : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { { v = i32(); @@ -270,7 +270,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) { TEST_F(ZeroInitWorkgroupMemoryTest, SingleWorkgroupVar_InjectedLocalIndex_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { _ = v; // Initialization should be inserted above this statement } @@ -278,7 +278,7 @@ fn f() { var v : i32; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { { v = i32(); @@ -308,7 +308,7 @@ var b : S; var c : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { _ = a; // Initialization should be inserted above this statement _ = b; @@ -327,7 +327,7 @@ var b : S; var c : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { { a = i32(); @@ -360,7 +360,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) { TEST_F(ZeroInitWorkgroupMemoryTest, MultipleWorkgroupVar_ExistingLocalIndex_Size1_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { _ = a; // Initialization should be inserted above this statement _ = b; @@ -379,7 +379,7 @@ struct S { }; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { { a = i32(); @@ -434,7 +434,7 @@ var b : S; var c : array; -@stage(compute) @workgroup_size(2, 3) +@compute @workgroup_size(2, 3) fn f(@builtin(local_invocation_index) local_idx : u32) { _ = a; // Initialization should be inserted above this statement _ = b; @@ -453,7 +453,7 @@ var b : S; var c : array; -@stage(compute) @workgroup_size(2, 3) +@compute @workgroup_size(2, 3) fn f(@builtin(local_invocation_index) local_idx : u32) { if ((local_idx < 1u)) { a = i32(); @@ -499,7 +499,7 @@ var c : array; @id(1) override X : i32; -@stage(compute) @workgroup_size(2, 3, X) +@compute @workgroup_size(2, 3, X) fn f(@builtin(local_invocation_index) local_idx : u32) { _ = a; // Initialization should be inserted above this statement _ = b; @@ -521,7 +521,7 @@ var c : array; @id(1) override X : i32; -@stage(compute) @workgroup_size(2, 3, X) +@compute @workgroup_size(2, 3, X) fn f(@builtin(local_invocation_index) local_idx : u32) { for(var idx : u32 = local_idx; (idx < 1u); idx = (idx + (u32(X) * 6u))) { a = i32(); @@ -568,7 +568,7 @@ var c : array; @id(1) override X : u32; -@stage(compute) @workgroup_size(5u, X, 10u) +@compute @workgroup_size(5u, X, 10u) fn f(@builtin(local_invocation_index) local_idx : u32) { _ = a; // Initialization should be inserted above this statement _ = b; @@ -591,7 +591,7 @@ var c : array; @id(1) override X : u32; -@stage(compute) @workgroup_size(5u, X, 10u) +@compute @workgroup_size(5u, X, 10u) fn f(@builtin(local_invocation_index) local_idx : u32) { for(var idx : u32 = local_idx; (idx < 1u); idx = (idx + (X * 50u))) { a = i32(); @@ -654,7 +654,7 @@ var b : S; var c : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_id) local_invocation_id : vec3) { _ = a; // Initialization should be inserted above this statement _ = b; @@ -673,7 +673,7 @@ var b : S; var c : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_id) local_invocation_id : vec3, @builtin(local_invocation_index) local_invocation_index : u32) { { a = i32(); @@ -706,7 +706,7 @@ fn f(@builtin(local_invocation_id) local_invocation_id : vec3, @builtin(loc TEST_F(ZeroInitWorkgroupMemoryTest, MultipleWorkgroupVar_InjectedLocalIndex_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_id) local_invocation_id : vec3) { _ = a; // Initialization should be inserted above this statement _ = b; @@ -725,7 +725,7 @@ struct S { }; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_id) local_invocation_id : vec3, @builtin(local_invocation_index) local_invocation_index : u32) { { a = i32(); @@ -780,18 +780,18 @@ var b : S; var c : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f1() { _ = a; // Initialization should be inserted above this statement _ = c; } -@stage(compute) @workgroup_size(1, 2, 3) +@compute @workgroup_size(1, 2, 3) fn f2(@builtin(local_invocation_id) local_invocation_id : vec3) { _ = b; // Initialization should be inserted above this statement } -@stage(compute) @workgroup_size(4, 5, 6) +@compute @workgroup_size(4, 5, 6) fn f3() { _ = c; // Initialization should be inserted above this statement _ = a; @@ -809,7 +809,7 @@ var b : S; var c : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f1(@builtin(local_invocation_index) local_invocation_index : u32) { { a = i32(); @@ -828,7 +828,7 @@ fn f1(@builtin(local_invocation_index) local_invocation_index : u32) { _ = c; } -@stage(compute) @workgroup_size(1, 2, 3) +@compute @workgroup_size(1, 2, 3) fn f2(@builtin(local_invocation_id) local_invocation_id : vec3, @builtin(local_invocation_index) local_invocation_index_1 : u32) { if ((local_invocation_index_1 < 1u)) { b.x = i32(); @@ -841,7 +841,7 @@ fn f2(@builtin(local_invocation_id) local_invocation_id : vec3, @builtin(lo _ = b; } -@stage(compute) @workgroup_size(4, 5, 6) +@compute @workgroup_size(4, 5, 6) fn f3(@builtin(local_invocation_index) local_invocation_index_2 : u32) { if ((local_invocation_index_2 < 1u)) { a = i32(); @@ -868,18 +868,18 @@ fn f3(@builtin(local_invocation_index) local_invocation_index_2 : u32) { TEST_F(ZeroInitWorkgroupMemoryTest, MultipleWorkgroupVar_MultipleEntryPoints_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f1() { _ = a; // Initialization should be inserted above this statement _ = c; } -@stage(compute) @workgroup_size(1, 2, 3) +@compute @workgroup_size(1, 2, 3) fn f2(@builtin(local_invocation_id) local_invocation_id : vec3) { _ = b; // Initialization should be inserted above this statement } -@stage(compute) @workgroup_size(4, 5, 6) +@compute @workgroup_size(4, 5, 6) fn f3() { _ = c; // Initialization should be inserted above this statement _ = a; @@ -897,7 +897,7 @@ struct S { }; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f1(@builtin(local_invocation_index) local_invocation_index : u32) { { a = i32(); @@ -916,7 +916,7 @@ fn f1(@builtin(local_invocation_index) local_invocation_index : u32) { _ = c; } -@stage(compute) @workgroup_size(1, 2, 3) +@compute @workgroup_size(1, 2, 3) fn f2(@builtin(local_invocation_id) local_invocation_id : vec3, @builtin(local_invocation_index) local_invocation_index_1 : u32) { if ((local_invocation_index_1 < 1u)) { b.x = i32(); @@ -929,7 +929,7 @@ fn f2(@builtin(local_invocation_id) local_invocation_id : vec3, @builtin(lo _ = b; } -@stage(compute) @workgroup_size(4, 5, 6) +@compute @workgroup_size(4, 5, 6) fn f3(@builtin(local_invocation_index) local_invocation_index_2 : u32) { if ((local_invocation_index_2 < 1u)) { a = i32(); @@ -977,7 +977,7 @@ fn call_use_v() { use_v(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { call_use_v(); // Initialization should be inserted above this statement } @@ -993,7 +993,7 @@ fn call_use_v() { use_v(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { { v = i32(); @@ -1010,7 +1010,7 @@ fn f(@builtin(local_invocation_index) local_idx : u32) { TEST_F(ZeroInitWorkgroupMemoryTest, TransitiveUsage_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { call_use_v(); // Initialization should be inserted above this statement } @@ -1026,7 +1026,7 @@ fn use_v() { var v : i32; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_idx : u32) { { v = i32(); @@ -1056,7 +1056,7 @@ TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupAtomics) { var i : atomic; var u : atomic; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { atomicLoad(&(i)); // Initialization should be inserted above this statement atomicLoad(&(u)); @@ -1067,7 +1067,7 @@ var i : atomic; var u : atomic; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { { atomicStore(&(i), i32()); @@ -1086,7 +1086,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) { TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupAtomics_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { atomicLoad(&(i)); // Initialization should be inserted above this statement atomicLoad(&(u)); @@ -1096,7 +1096,7 @@ var i : atomic; var u : atomic; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { { atomicStore(&(i), i32()); @@ -1129,7 +1129,7 @@ struct S { var w : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { _ = w.a; // Initialization should be inserted above this statement } @@ -1145,7 +1145,7 @@ struct S { var w : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { { w.a = i32(); @@ -1166,7 +1166,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) { TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupStructOfAtomics_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { _ = w.a; // Initialization should be inserted above this statement } @@ -1182,7 +1182,7 @@ struct S { }; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { { w.a = i32(); @@ -1215,7 +1215,7 @@ TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupArrayOfAtomics) { auto* src = R"( var w : array, 4>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { atomicLoad(&w[0]); // Initialization should be inserted above this statement } @@ -1223,7 +1223,7 @@ fn f() { auto* expect = R"( var w : array, 4>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { let i : u32 = idx; @@ -1241,7 +1241,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) { TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupArrayOfAtomics_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { atomicLoad(&w[0]); // Initialization should be inserted above this statement } @@ -1249,7 +1249,7 @@ fn f() { var w : array, 4>; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { let i : u32 = idx; @@ -1279,7 +1279,7 @@ struct S { var w : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { _ = w[0].a; // Initialization should be inserted above this statement } @@ -1295,7 +1295,7 @@ struct S { var w : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { let i_1 : u32 = idx; @@ -1317,7 +1317,7 @@ fn f(@builtin(local_invocation_index) local_invocation_index : u32) { TEST_F(ZeroInitWorkgroupMemoryTest, WorkgroupArrayOfStructOfAtomics_OutOfOrder) { auto* src = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { _ = w[0].a; // Initialization should be inserted above this statement } @@ -1333,7 +1333,7 @@ struct S { }; )"; auto* expect = R"( -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f(@builtin(local_invocation_index) local_invocation_index : u32) { for(var idx : u32 = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { let i_1 : u32 = idx; diff --git a/src/tint/utils/bitset.h b/src/tint/utils/bitset.h new file mode 100644 index 0000000000..86dccd6ddb --- /dev/null +++ b/src/tint/utils/bitset.h @@ -0,0 +1,102 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_UTILS_BITSET_H_ +#define SRC_TINT_UTILS_BITSET_H_ + +#include + +#include "src/tint/utils/vector.h" + +namespace tint::utils { + +/// Bitset is a dynamically sized, vector of bits, packed into integer words. +/// Bits can be individually read and written using the index operator. +/// +/// Bitset will fit at least `N` bits internally before spilling to heap allocations. +template +class Bitset { + /// The integer word type used to hold the bits + using Word = size_t; + /// Number of bits per word + static constexpr size_t kWordBits = sizeof(Word) * 8; + + /// Number of words required to hold the number of bits + static constexpr size_t NumWords(size_t num_bits) { + return ((num_bits + kWordBits - 1) / kWordBits); + } + + public: + /// Constructor + Bitset() = default; + + /// Destructor + ~Bitset() = default; + + /// Accessor for a single bit + struct Bit { + /// The word that contains the bit + Word& word; + /// A word with a single bit set, which masks the targetted bit + Word const mask; + + /// Assignment operator + /// @param value the new value for the bit + /// @returns this Bit so calls can be chained + const Bit& operator=(bool value) const { + if (value) { + word = word | mask; + } else { + word = word & ~mask; + } + return *this; + } + + /// Conversion operator + /// @returns the bit value + operator bool() const { return (word & mask) != 0; } + }; + + /// @param new_len the new size of the bitmap, in bits. + void Resize(size_t new_len) { + vec_.Resize(NumWords(new_len)); + + // Clear any potentially set bits that are in the top part of the word + if (size_t high_bit = new_len % kWordBits; high_bit > 0) { + vec_.Back() &= (static_cast(1) << high_bit) - 1; + } + + len_ = new_len; + } + + /// @return the number of bits in the bitset. + size_t Length() const { return len_; } + + /// Index operator + /// @param index the index of the bit to access + /// @return the accessor for the indexed bit + Bit operator[](size_t index) { + auto& word = vec_[index / kWordBits]; + auto mask = static_cast(1) << (index % kWordBits); + return Bit{word, mask}; + } + + private: + Vector vec_; + size_t len_ = 0; +}; + +} // namespace tint::utils + +#endif // SRC_TINT_UTILS_BITSET_H_ diff --git a/src/tint/utils/bitset_test.cc b/src/tint/utils/bitset_test.cc new file mode 100644 index 0000000000..b07cf74493 --- /dev/null +++ b/src/tint/utils/bitset_test.cc @@ -0,0 +1,119 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/utils/bitset.h" + +#include "gtest/gtest.h" + +namespace tint::utils { +namespace { + +TEST(Bitset, Length) { + Bitset<8> bits; + EXPECT_EQ(bits.Length(), 0u); + bits.Resize(100u); + EXPECT_EQ(bits.Length(), 100u); +} + +TEST(Bitset, InitCleared_NoSpill) { + Bitset<256> bits; + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + EXPECT_FALSE(bits[i]); + } +} + +TEST(Bitset, InitCleared_Spill) { + Bitset<64> bits; + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + EXPECT_FALSE(bits[i]); + } +} + +TEST(Bitset, ReadWrite_NoSpill) { + Bitset<256> bits; + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + bits[i] = (i & 0x2) == 0; + } + for (size_t i = 0; i < 256; i++) { + EXPECT_EQ(bits[i], (i & 0x2) == 0); + } +} + +TEST(Bitset, ReadWrite_Spill) { + Bitset<64> bits; + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + bits[i] = (i & 0x2) == 0; + } + for (size_t i = 0; i < 256; i++) { + EXPECT_EQ(bits[i], (i & 0x2) == 0); + } +} + +TEST(Bitset, ShinkGrowAlignedClears_NoSpill) { + Bitset<256> bits; + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + bits[i] = true; + } + bits.Resize(64); + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + EXPECT_EQ(bits[i], i < 64u); + } +} + +TEST(Bitset, ShinkGrowAlignedClears_Spill) { + Bitset<64> bits; + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + bits[i] = true; + } + bits.Resize(64); + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + EXPECT_EQ(bits[i], i < 64u); + } +} +TEST(Bitset, ShinkGrowMisalignedClears_NoSpill) { + Bitset<256> bits; + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + bits[i] = true; + } + bits.Resize(42); + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + EXPECT_EQ(bits[i], i < 42u); + } +} + +TEST(Bitset, ShinkGrowMisalignedClears_Spill) { + Bitset<64> bits; + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + bits[i] = true; + } + bits.Resize(42); + bits.Resize(256); + for (size_t i = 0; i < 256; i++) { + EXPECT_EQ(bits[i], i < 42u); + } +} + +} // namespace +} // namespace tint::utils diff --git a/src/tint/utils/block_allocator.h b/src/tint/utils/block_allocator.h index f413940985..91a8a535cf 100644 --- a/src/tint/utils/block_allocator.h +++ b/src/tint/utils/block_allocator.h @@ -24,10 +24,10 @@ namespace tint::utils { -/// A container and allocator of objects of (or deriving from) the template -/// type `T`. Objects are allocated by calling Create(), and are owned by the -/// BlockAllocator. When the BlockAllocator is destructed, all constructed -/// objects are automatically destructed and freed. +/// A container and allocator of objects of (or deriving from) the template type `T`. +/// Objects are allocated by calling Create(), and are owned by the BlockAllocator. +/// When the BlockAllocator is destructed, all constructed objects are automatically destructed and +/// freed. /// /// Objects held by the BlockAllocator can be iterated over using a View. template @@ -44,8 +44,7 @@ class BlockAllocator { /// Block is linked list of memory blocks. /// Blocks are allocated out of heap memory. /// - /// Note: We're not using std::aligned_storage here as this warns / errors - /// on MSVC. + /// Note: We're not using std::aligned_storage here as this warns / errors on MSVC. struct alignas(BLOCK_ALIGNMENT) Block { uint8_t data[BLOCK_SIZE]; Block* next; @@ -97,22 +96,22 @@ class BlockAllocator { size_t idx; }; - /// View provides begin() and end() methods for looping over the objects - /// owned by the BlockAllocator. + /// View provides begin() and end() methods for looping over the objects owned by the + /// BlockAllocator. template class TView { public: /// @returns an iterator to the beginning of the view TIterator begin() const { - return TIterator{allocator_->pointers_.root, 0}; + return TIterator{allocator_->data.pointers.root, 0}; } /// @returns an iterator to the end of the view TIterator end() const { - return allocator_->pointers_.current_index >= Pointers::kMax + return allocator_->data.pointers.current_index >= Pointers::kMax ? TIterator(nullptr, 0) - : TIterator(allocator_->pointers_.current, - allocator_->pointers_.current_index); + : TIterator(allocator_->data.pointers.current, + allocator_->data.pointers.current_index); } private: @@ -128,12 +127,12 @@ class BlockAllocator { /// An immutable iterator type over the objects of the BlockAllocator using ConstIterator = TIterator; - /// View provides begin() and end() methods for looping over the objects - /// owned by the BlockAllocator. + /// View provides begin() and end() methods for looping over the objects owned by the + /// BlockAllocator. using View = TView; - /// ConstView provides begin() and end() methods for looping over the objects - /// owned by the BlockAllocator. + /// ConstView provides begin() and end() methods for looping over the objects owned by the + /// BlockAllocator. using ConstView = TView; /// Constructor @@ -141,10 +140,7 @@ class BlockAllocator { /// Move constructor /// @param rhs the BlockAllocator to move - BlockAllocator(BlockAllocator&& rhs) { - std::swap(block_, rhs.block_); - std::swap(pointers_, rhs.pointers_); - } + BlockAllocator(BlockAllocator&& rhs) { std::swap(data, rhs.data); } /// Move assignment operator /// @param rhs the BlockAllocator to move @@ -152,8 +148,7 @@ class BlockAllocator { BlockAllocator& operator=(BlockAllocator&& rhs) { if (this != &rhs) { Reset(); - std::swap(block_, rhs.block_); - std::swap(pointers_, rhs.pointers_); + std::swap(data, rhs.data); } return *this; } @@ -168,8 +163,7 @@ class BlockAllocator { ConstView Objects() const { return ConstView(this); } /// Creates a new `TYPE` owned by the BlockAllocator. - /// When the BlockAllocator is destructed the object will be destructed and - /// freed. + /// When the BlockAllocator is destructed the object will be destructed and freed. /// @param args the arguments to pass to the type constructor /// @returns the pointer to the constructed object template @@ -183,6 +177,7 @@ class BlockAllocator { auto* ptr = Allocate(); new (ptr) TYPE(std::forward(args)...); AddObjectPointer(ptr); + data.count++; return ptr; } @@ -192,97 +187,106 @@ class BlockAllocator { for (auto ptr : Objects()) { ptr->~T(); } - auto* block = block_.root; + auto* block = data.block.root; while (block != nullptr) { auto* next = block->next; delete block; block = next; } - block_ = {}; - pointers_ = {}; + data = {}; } + /// @returns the total number of allocated objects. + size_t Count() const { return data.count; } + private: BlockAllocator(const BlockAllocator&) = delete; BlockAllocator& operator=(const BlockAllocator&) = delete; - /// Allocates an instance of TYPE from the current block, or from a newly - /// allocated block if the current block is full. + /// Allocates an instance of TYPE from the current block, or from a newly allocated block if the + /// current block is full. template TYPE* Allocate() { static_assert(sizeof(TYPE) <= BLOCK_SIZE, "Cannot construct TYPE with size greater than BLOCK_SIZE"); static_assert(alignof(TYPE) <= BLOCK_ALIGNMENT, "alignof(TYPE) is greater than ALIGNMENT"); - block_.current_offset = utils::RoundUp(alignof(TYPE), block_.current_offset); - if (block_.current_offset + sizeof(TYPE) > BLOCK_SIZE) { + auto& block = data.block; + + block.current_offset = utils::RoundUp(alignof(TYPE), block.current_offset); + if (block.current_offset + sizeof(TYPE) > BLOCK_SIZE) { // Allocate a new block from the heap - auto* prev_block = block_.current; - block_.current = new Block; - if (!block_.current) { + auto* prev_block = block.current; + block.current = new Block; + if (!block.current) { return nullptr; // out of memory } - block_.current->next = nullptr; - block_.current_offset = 0; + block.current->next = nullptr; + block.current_offset = 0; if (prev_block) { - prev_block->next = block_.current; + prev_block->next = block.current; } else { - block_.root = block_.current; + block.root = block.current; } } - auto* base = &block_.current->data[0]; - auto* ptr = utils::Bitcast(base + block_.current_offset); - block_.current_offset += sizeof(TYPE); + auto* base = &block.current->data[0]; + auto* ptr = utils::Bitcast(base + block.current_offset); + block.current_offset += sizeof(TYPE); return ptr; } /// Adds `ptr` to the linked list of objects owned by this BlockAllocator. - /// Once added, `ptr` will be tracked for destruction when the BlockAllocator - /// is destructed. + /// Once added, `ptr` will be tracked for destruction when the BlockAllocator is destructed. void AddObjectPointer(T* ptr) { - if (pointers_.current_index >= Pointers::kMax) { - auto* prev_pointers = pointers_.current; - pointers_.current = Allocate(); - if (!pointers_.current) { + auto& pointers = data.pointers; + + if (pointers.current_index >= Pointers::kMax) { + auto* prev_pointers = pointers.current; + pointers.current = Allocate(); + if (!pointers.current) { return; // out of memory } - pointers_.current->next = nullptr; - pointers_.current_index = 0; + pointers.current->next = nullptr; + pointers.current_index = 0; if (prev_pointers) { - prev_pointers->next = pointers_.current; + prev_pointers->next = pointers.current; } else { - pointers_.root = pointers_.current; + pointers.root = pointers.current; } } - pointers_.current->ptrs[pointers_.current_index++] = ptr; + pointers.current->ptrs[pointers.current_index++] = ptr; } struct { - /// The root block of the block linked list - Block* root = nullptr; - /// The current (end) block of the blocked linked list. - /// New allocations come from this block - Block* current = nullptr; - /// The byte offset in #current for the next allocation. - /// Initialized with BLOCK_SIZE so that the first allocation triggers a - /// block allocation. - size_t current_offset = BLOCK_SIZE; - } block_; + struct { + /// The root block of the block linked list + Block* root = nullptr; + /// The current (end) block of the blocked linked list. + /// New allocations come from this block + Block* current = nullptr; + /// The byte offset in #current for the next allocation. + /// Initialized with BLOCK_SIZE so that the first allocation triggers a block + /// allocation. + size_t current_offset = BLOCK_SIZE; + } block; - struct { - /// The root Pointers structure of the pointers linked list - Pointers* root = nullptr; - /// The current (end) Pointers structure of the pointers linked list. - /// AddObjectPointer() adds to this structure. - Pointers* current = nullptr; - /// The array index in #current for the next append. - /// Initialized with Pointers::kMax so that the first append triggers a - /// allocation of the Pointers structure. - size_t current_index = Pointers::kMax; - } pointers_; + struct { + /// The root Pointers structure of the pointers linked list + Pointers* root = nullptr; + /// The current (end) Pointers structure of the pointers linked list. + /// AddObjectPointer() adds to this structure. + Pointers* current = nullptr; + /// The array index in #current for the next append. + /// Initialized with Pointers::kMax so that the first append triggers a allocation of + /// the Pointers structure. + size_t current_index = Pointers::kMax; + } pointers; + + size_t count = 0; + } data; }; } // namespace tint::utils diff --git a/src/tint/utils/block_allocator_test.cc b/src/tint/utils/block_allocator_test.cc index 600019c4e9..16847557c2 100644 --- a/src/tint/utils/block_allocator_test.cc +++ b/src/tint/utils/block_allocator_test.cc @@ -33,6 +33,7 @@ TEST_F(BlockAllocatorTest, Empty) { Allocator allocator; + EXPECT_EQ(allocator.Count(), 0u); for (int* i : allocator.Objects()) { (void)i; if ((true)) { // Workaround for "error: loop will run at most once" @@ -47,6 +48,19 @@ TEST_F(BlockAllocatorTest, Empty) { } } +TEST_F(BlockAllocatorTest, Count) { + using Allocator = BlockAllocator; + + for (size_t n : {0u, 1u, 10u, 16u, 20u, 32u, 50u, 64u, 100u, 256u, 300u, 512u, 500u, 512u}) { + Allocator allocator; + EXPECT_EQ(allocator.Count(), 0u); + for (size_t i = 0; i < n; i++) { + allocator.Create(123); + } + EXPECT_EQ(allocator.Count(), n); + } +} + TEST_F(BlockAllocatorTest, ObjectLifetime) { using Allocator = BlockAllocator; @@ -67,7 +81,7 @@ TEST_F(BlockAllocatorTest, ObjectLifetime) { TEST_F(BlockAllocatorTest, MoveConstruct) { using Allocator = BlockAllocator; - for (size_t n : {0, 1, 10, 16, 20, 32, 50, 64, 100, 256, 300, 512, 500, 512}) { + for (size_t n : {0u, 1u, 10u, 16u, 20u, 32u, 50u, 64u, 100u, 256u, 300u, 512u, 500u, 512u}) { size_t count = 0; { Allocator allocator_a; @@ -75,9 +89,11 @@ TEST_F(BlockAllocatorTest, MoveConstruct) { allocator_a.Create(&count); } EXPECT_EQ(count, n); + EXPECT_EQ(allocator_a.Count(), n); Allocator allocator_b{std::move(allocator_a)}; EXPECT_EQ(count, n); + EXPECT_EQ(allocator_b.Count(), n); } EXPECT_EQ(count, 0u); @@ -87,7 +103,7 @@ TEST_F(BlockAllocatorTest, MoveConstruct) { TEST_F(BlockAllocatorTest, MoveAssign) { using Allocator = BlockAllocator; - for (size_t n : {0, 1, 10, 16, 20, 32, 50, 64, 100, 256, 300, 512, 500, 512}) { + for (size_t n : {0u, 1u, 10u, 16u, 20u, 32u, 50u, 64u, 100u, 256u, 300u, 512u, 500u, 512u}) { size_t count_a = 0; size_t count_b = 0; @@ -97,16 +113,19 @@ TEST_F(BlockAllocatorTest, MoveAssign) { allocator_a.Create(&count_a); } EXPECT_EQ(count_a, n); + EXPECT_EQ(allocator_a.Count(), n); Allocator allocator_b; for (size_t i = 0; i < n; i++) { allocator_b.Create(&count_b); } EXPECT_EQ(count_b, n); + EXPECT_EQ(allocator_b.Count(), n); allocator_b = std::move(allocator_a); EXPECT_EQ(count_a, n); EXPECT_EQ(count_b, 0u); + EXPECT_EQ(allocator_b.Count(), n); } EXPECT_EQ(count_a, 0u); diff --git a/src/tint/utils/compiler_macros.h b/src/tint/utils/compiler_macros.h new file mode 100644 index 0000000000..b3cca3cb11 --- /dev/null +++ b/src/tint/utils/compiler_macros.h @@ -0,0 +1,95 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/utils/concat.h" + +#ifndef SRC_TINT_UTILS_COMPILER_MACROS_H_ +#define SRC_TINT_UTILS_COMPILER_MACROS_H_ + +#define TINT_REQUIRE_SEMICOLON static_assert(true) + +#if defined(_MSC_VER) +//////////////////////////////////////////////////////////////////////////////// +// MSVC +//////////////////////////////////////////////////////////////////////////////// +#define TINT_DISABLE_WARNING_CONSTANT_OVERFLOW __pragma(warning(disable : 4756)) +#define TINT_DISABLE_WARNING_MAYBE_UNINITIALIZED /* currently no-op */ +#define TINT_DISABLE_WARNING_NEWLINE_EOF /* currently no-op */ +#define TINT_DISABLE_WARNING_OLD_STYLE_CAST /* currently no-op */ +#define TINT_DISABLE_WARNING_SIGN_CONVERSION /* currently no-op */ +#define TINT_DISABLE_WARNING_UNREACHABLE_CODE __pragma(warning(disable : 4702)) +#define TINT_DISABLE_WARNING_WEAK_VTABLES /* currently no-op */ + +// clang-format off +#define TINT_BEGIN_DISABLE_WARNING(name) \ + __pragma(warning(push)) \ + TINT_CONCAT(TINT_DISABLE_WARNING_, name) \ + TINT_REQUIRE_SEMICOLON +#define TINT_END_DISABLE_WARNING(name) \ + __pragma(warning(pop)) \ + TINT_REQUIRE_SEMICOLON +// clang-format on +#elif defined(__clang__) +//////////////////////////////////////////////////////////////////////////////// +// Clang +//////////////////////////////////////////////////////////////////////////////// +#define TINT_DISABLE_WARNING_CONSTANT_OVERFLOW /* currently no-op */ +#define TINT_DISABLE_WARNING_MAYBE_UNINITIALIZED /* currently no-op */ +#define TINT_DISABLE_WARNING_NEWLINE_EOF _Pragma("clang diagnostic ignored \"-Wnewline-eof\"") +#define TINT_DISABLE_WARNING_OLD_STYLE_CAST _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") +#define TINT_DISABLE_WARNING_SIGN_CONVERSION \ + _Pragma("clang diagnostic ignored \"-Wsign-conversion\"") +#define TINT_DISABLE_WARNING_UNREACHABLE_CODE /* currently no-op */ +#define TINT_DISABLE_WARNING_WEAK_VTABLES _Pragma("clang diagnostic ignored \"-Wweak-vtables\"") + +// clang-format off +#define TINT_BEGIN_DISABLE_WARNING(name) \ + _Pragma("clang diagnostic push") \ + TINT_CONCAT(TINT_DISABLE_WARNING_, name) \ + TINT_REQUIRE_SEMICOLON +#define TINT_END_DISABLE_WARNING(name) \ + _Pragma("clang diagnostic pop") \ + TINT_REQUIRE_SEMICOLON +// clang-format on +#elif defined(__GNUC__) +//////////////////////////////////////////////////////////////////////////////// +// GCC +//////////////////////////////////////////////////////////////////////////////// +#define TINT_DISABLE_WARNING_CONSTANT_OVERFLOW /* currently no-op */ +#define TINT_DISABLE_WARNING_MAYBE_UNINITIALIZED \ + _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +#define TINT_DISABLE_WARNING_NEWLINE_EOF /* currently no-op */ +#define TINT_DISABLE_WARNING_OLD_STYLE_CAST /* currently no-op */ +#define TINT_DISABLE_WARNING_SIGN_CONVERSION /* currently no-op */ +#define TINT_DISABLE_WARNING_UNREACHABLE_CODE /* currently no-op */ +#define TINT_DISABLE_WARNING_WEAK_VTABLES /* currently no-op */ + +// clang-format off +#define TINT_BEGIN_DISABLE_WARNING(name) \ + _Pragma("GCC diagnostic push") \ + TINT_CONCAT(TINT_DISABLE_WARNING_, name) \ + TINT_REQUIRE_SEMICOLON +#define TINT_END_DISABLE_WARNING(name) \ + _Pragma("GCC diagnostic pop") \ + TINT_REQUIRE_SEMICOLON +// clang-format on +#else +//////////////////////////////////////////////////////////////////////////////// +// Other +//////////////////////////////////////////////////////////////////////////////// +#define TINT_BEGIN_DISABLE_WARNING(name) TINT_REQUIRE_SEMICOLON +#define TINT_END_DISABLE_WARNING(name) TINT_REQUIRE_SEMICOLON +#endif + +#endif // SRC_TINT_UTILS_COMPILER_MACROS_H_ diff --git a/src/tint/utils/hash.h b/src/tint/utils/hash.h index 1bc2edb6cb..ad53841f5f 100644 --- a/src/tint/utils/hash.h +++ b/src/tint/utils/hash.h @@ -18,9 +18,12 @@ #include #include #include +#include #include #include +#include "src/tint/utils/vector.h" + namespace tint::utils { namespace detail { @@ -45,35 +48,96 @@ struct HashCombineOffset<8> { } // namespace detail -/// HashCombine "hashes" together an existing hash and hashable values. -template -void HashCombine(size_t* hash, const T& value) { - constexpr size_t offset = detail::HashCombineOffset::value(); - *hash ^= std::hash()(value) + offset + (*hash << 6) + (*hash >> 2); -} +/// Forward declarations (see below) +template +size_t Hash(const ARGS&... values); -/// HashCombine "hashes" together an existing hash and hashable values. +template +size_t HashCombine(size_t hash, const ARGS&... values); + +/// A STL-compatible hasher that does a more thorough job than most implementations of std::hash. +/// Hasher has been optimized for a better quality hash at the expense of increased computation +/// costs. template -void HashCombine(size_t* hash, const std::vector& vector) { - HashCombine(hash, vector.size()); - for (auto& el : vector) { - HashCombine(hash, el); +struct Hasher { + /// @param value the value to hash + /// @returns a hash of the value + size_t operator()(const T& value) const { return std::hash()(value); } +}; + +/// Hasher specialization for pointers +/// std::hash typically uses a reinterpret of the pointer to a size_t. +/// As most pointers a 4 or 16 byte aligned, this usually results in the LSBs of the hash being 0, +/// resulting in bad hashes for hashtables. This implementation mixes up those LSBs. +template +struct Hasher { + /// @param ptr the pointer to hash + /// @returns a hash of the pointer + size_t operator()(T* ptr) const { + auto hash = std::hash()(ptr); + return hash ^ (hash >> 4); + } +}; + +/// Hasher specialization for std::vector +template +struct Hasher> { + /// @param vector the vector to hash + /// @returns a hash of the vector + size_t operator()(const std::vector& vector) const { + auto hash = Hash(vector.size()); + for (auto& el : vector) { + hash = HashCombine(hash, el); + } + return hash; + } +}; + +/// Hasher specialization for utils::vector +template +struct Hasher> { + /// @param vector the vector to hash + /// @returns a hash of the vector + size_t operator()(const utils::Vector& vector) const { + auto hash = Hash(vector.Length()); + for (auto& el : vector) { + hash = HashCombine(hash, el); + } + return hash; + } +}; + +/// Hasher specialization for std::tuple +template +struct Hasher> { + /// @param tuple the tuple to hash + /// @returns a hash of the tuple + size_t operator()(const std::tuple& tuple) const { + return std::apply(Hash, tuple); + } +}; + +/// @returns a hash of the variadic list of arguments. +/// The returned hash is dependent on the order of the arguments. +template +size_t Hash(const ARGS&... args) { + if constexpr (sizeof...(ARGS) == 0) { + return 0; + } else if constexpr (sizeof...(ARGS) == 1) { + using T = std::tuple_element_t<0, std::tuple>; + return Hasher()(args...); + } else { + size_t hash = 102931; // seed with an arbitrary prime + return HashCombine(hash, args...); } } -/// HashCombine "hashes" together an existing hash and hashable values. -template -void HashCombine(size_t* hash, const T& value, const ARGS&... args) { - HashCombine(hash, value); - HashCombine(hash, args...); -} - -/// @returns a hash of the combined arguments. The returned hash is dependent on -/// the order of the arguments. +/// @returns a hash of the variadic list of arguments. +/// The returned hash is dependent on the order of the arguments. template -size_t Hash(const ARGS&... args) { - size_t hash = 102931; // seed with an arbitrary prime - HashCombine(&hash, args...); +size_t HashCombine(size_t hash, const ARGS&... values) { + constexpr size_t offset = detail::HashCombineOffset::value(); + ((hash ^= Hash(values) + offset + (hash << 6) + (hash >> 2)), ...); return hash; } diff --git a/src/tint/utils/hash_test.cc b/src/tint/utils/hash_test.cc index 068ac454a0..6ce6820630 100644 --- a/src/tint/utils/hash_test.cc +++ b/src/tint/utils/hash_test.cc @@ -15,9 +15,11 @@ #include "src/tint/utils/hash.h" #include +#include #include #include "gtest/gtest.h" +#include "src/tint/utils/vector.h" namespace tint::utils { namespace { @@ -34,13 +36,29 @@ TEST(HashTests, Basic) { EXPECT_NE(Hash(std::string("hello")), Hash(std::string("world"))); } -TEST(HashTests, Vector) { +TEST(HashTests, StdVector) { EXPECT_EQ(Hash(std::vector({})), Hash(std::vector({}))); EXPECT_EQ(Hash(std::vector({1, 2, 3})), Hash(std::vector({1, 2, 3}))); EXPECT_NE(Hash(std::vector({1, 2, 3})), Hash(std::vector({1, 2, 4}))); EXPECT_NE(Hash(std::vector({1, 2, 3})), Hash(std::vector({1, 2, 3, 4}))); } +TEST(HashTests, TintVector) { + EXPECT_EQ(Hash(Vector({})), Hash(Vector({}))); + EXPECT_EQ(Hash(Vector({1, 2, 3})), Hash(Vector({1, 2, 3}))); + EXPECT_NE(Hash(Vector({1, 2, 3})), Hash(Vector({1, 2, 4}))); + EXPECT_NE(Hash(Vector({1, 2, 3})), Hash(Vector({1, 2, 3, 4}))); + EXPECT_EQ(Hash(Vector({1, 2, 3})), Hash(Vector({1, 2, 3}))); + EXPECT_EQ(Hash(Vector({1, 2, 3})), Hash(Vector({1, 2, 3}))); +} + +TEST(HashTests, Tuple) { + EXPECT_EQ(Hash(std::make_tuple(1)), Hash(std::make_tuple(1))); + EXPECT_EQ(Hash(std::make_tuple(1, 2, 3)), Hash(std::make_tuple(1, 2, 3))); + EXPECT_NE(Hash(std::make_tuple(1, 2, 3)), Hash(std::make_tuple(1, 2, 4))); + EXPECT_NE(Hash(std::make_tuple(1, 2, 3)), Hash(std::make_tuple(1, 2, 3, 4))); +} + TEST(HashTests, UnorderedKeyWrapper) { using W = UnorderedKeyWrapper>; diff --git a/src/tint/utils/hashmap.h b/src/tint/utils/hashmap.h new file mode 100644 index 0000000000..e17938987f --- /dev/null +++ b/src/tint/utils/hashmap.h @@ -0,0 +1,306 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_UTILS_HASHMAP_H_ +#define SRC_TINT_UTILS_HASHMAP_H_ + +#include +#include +#include + +#include "src/tint/utils/hash.h" +#include "src/tint/utils/hashset.h" + +namespace tint::utils { + +/// An unordered map that uses a robin-hood hashing algorithm. +/// +/// Hashmap internally wraps a Hashset for providing a store for key-value pairs. +/// +/// @see Hashset +template , + typename EQUAL = std::equal_to> +class Hashmap { + /// LazyCreator is a transient structure used to late-build the Entry::value, when inserted into + /// the underlying Hashset. + /// + /// LazyCreator holds a #key, and a #create function used to build the final Entry::value. + /// The #create function must be of the signature `V()`. + /// + /// LazyCreator can be compared to Entry and hashed, allowing them to be passed to + /// Hashset::Insert(). If the set does not contain an existing entry with #key, + /// Hashset::Insert() will construct a new Entry passing the rvalue LazyCreator as the + /// constructor argument, which in turn calls the #create function to generate the entry value. + /// + /// @see Entry + /// @see Hasher + /// @see Equality + template + struct LazyCreator { + /// The key of the entry to insert into the map + const K& key; + /// The value creation function + CREATE create; + }; + + /// Entry holds a key and value pair, and is used as the element type of the underlying Hashset. + /// Entries are compared and hashed using only the #key. + /// @see Hasher + /// @see Equality + struct Entry { + /// Constructor from a key and value pair + Entry(K k, V v) : key(std::move(k)), value(std::move(v)) {} + + /// Copy-constructor. + Entry(const Entry&) = default; + + /// Move-constructor. + Entry(Entry&&) = default; + + /// Constructor from a LazyCreator. + /// The constructor invokes the LazyCreator::create function to build the #value. + /// @see LazyCreator + template + Entry(const LazyCreator& creator) // NOLINT(runtime/explicit) + : key(creator.key), value(creator.create()) {} + + /// Assignment operator from a LazyCreator. + /// The assignment invokes the LazyCreator::create function to build the #value. + /// @see LazyCreator + template + Entry& operator=(LazyCreator&& creator) { + key = std::move(creator.key); + value = creator.create(); + return *this; + } + + /// Copy-assignment operator + Entry& operator=(const Entry&) = default; + + /// Move-assignment operator + Entry& operator=(Entry&&) = default; + + K key; /// The map entry key + V value; /// The map entry value + }; + + /// Hash provider for the underlying Hashset. + /// Provides hash functions for an Entry, K or LazyCreator. + /// The hash functions only consider the key of an entry. + struct Hasher { + /// Calculates a hash from an Entry + size_t operator()(const Entry& entry) const { return HASH()(entry.key); } + /// Calculates a hash from a K + size_t operator()(const K& key) const { return HASH()(key); } + /// Calculates a hash from a LazyCreator + template + size_t operator()(const LazyCreator& lc) const { + return HASH()(lc.key); + } + }; + + /// Equality provider for the underlying Hashset. + /// Provides equality functions for an Entry, K or LazyCreator to an Entry. + /// The equality functions only consider the key for equality. + struct Equality { + /// Compares an Entry to an Entry for equality. + bool operator()(const Entry& a, const Entry& b) const { return EQUAL()(a.key, b.key); } + /// Compares a K to an Entry for equality. + bool operator()(const K& a, const Entry& b) const { return EQUAL()(a, b.key); } + /// Compares a LazyCreator to an Entry for equality. + template + bool operator()(const LazyCreator& lc, const Entry& b) const { + return EQUAL()(lc.key, b.key); + } + }; + + /// The underlying set + using Set = Hashset; + + public: + /// A Key and Value const-reference pair. + struct KeyValue { + /// key of a map entry + const K& key; + /// value of a map entry + const V& value; + + /// Equality operator + /// @param other the other KeyValue + /// @returns true if the key and value of this KeyValue are equal to other's. + bool operator==(const KeyValue& other) const { + return key == other.key && value == other.value; + } + }; + + /// STL-style alias to KeyValue. + /// Used by gmock for the `ElementsAre` checks. + using value_type = KeyValue; + + /// Iterator for the map + class Iterator { + public: + /// @returns the key of the entry pointed to by this iterator + const K& Key() const { return it->key; } + + /// @returns the value of the entry pointed to by this iterator + const V& Value() const { return it->value; } + + /// Increments the iterator + /// @returns this iterator + Iterator& operator++() { + ++it; + return *this; + } + + /// Equality operator + /// @param other the other iterator to compare this iterator to + /// @returns true if this iterator is equal to other + bool operator==(const Iterator& other) const { return it == other.it; } + + /// Inequality operator + /// @param other the other iterator to compare this iterator to + /// @returns true if this iterator is not equal to other + bool operator!=(const Iterator& other) const { return it != other.it; } + + /// @returns a pair of key and value for the entry pointed to by this iterator + KeyValue operator*() const { return {Key(), Value()}; } + + private: + /// Friend class + friend class Hashmap; + + /// Underlying iterator type + using SetIterator = typename Set::Iterator; + + explicit Iterator(SetIterator i) : it(i) {} + + SetIterator it; + }; + + /// Removes all entries from the map. + void Clear() { set_.Clear(); } + + /// Adds the key-value pair to the map, if the map does not already contain an entry with a key + /// equal to `key`. + /// @param key the entry's key to add to the map + /// @param value the entry's value to add to the map + /// @returns true if the entry was added to the map, false if there was already an entry in the + /// map with a key equal to `key`. + template + bool Add(KEY&& key, VALUE&& value) { + return set_.Add(Entry{std::forward(key), std::forward(value)}); + } + + /// Adds the key-value pair to the map, replacing any entry with a key equal to `key`. + /// @param key the entry's key to add to the map + /// @param value the entry's value to add to the map + template + void Replace(KEY&& key, VALUE&& value) { + set_.Replace(Entry{std::forward(key), std::forward(value)}); + } + + /// Searches for an entry with the given key value. + /// @param key the entry's key value to search for. + /// @returns the value of the entry with the given key, or no value if the entry was not found. + std::optional Get(const K& key) { + if (auto* entry = set_.Find(key)) { + return entry->value; + } + return std::nullopt; + } + + /// Searches for an entry with the given key value, adding and returning the result of + /// calling `create` if the entry was not found. + /// @param key the entry's key value to search for. + /// @param create the create function to call if the map does not contain the key. + /// @returns the value of the entry. + template + V& GetOrCreate(const K& key, CREATE&& create) { + LazyCreator lc{key, std::forward(create)}; + auto res = set_.Add(std::move(lc)); + return res.entry->value; + } + + /// Searches for an entry with the given key value, adding and returning a newly created + /// zero-initialized value if the entry was not found. + /// @param key the entry's key value to search for. + /// @returns the value of the entry. + V& GetOrZero(const K& key) { + auto zero = [] { return V{}; }; + LazyCreator lc{key, zero}; + auto res = set_.Add(std::move(lc)); + return res.entry->value; + } + + /// Searches for an entry with the given key value. + /// @param key the entry's key value to search for. + /// @returns the a pointer to the value of the entry with the given key, or nullptr if the entry + /// was not found. + /// @warning the pointer must not be used after the map is mutated + V* Find(const K& key) { + if (auto* entry = set_.Find(key)) { + return &entry->value; + } + return nullptr; + } + + /// Searches for an entry with the given key value. + /// @param key the entry's key value to search for. + /// @returns the a pointer to the value of the entry with the given key, or nullptr if the entry + /// was not found. + /// @warning the pointer must not be used after the map is mutated + const V* Find(const K& key) const { + if (auto* entry = set_.Find(key)) { + return &entry->value; + } + return nullptr; + } + + /// Removes an entry from the set with a key equal to `key`. + /// @param key the entry key value to remove. + /// @returns true if an entry was removed. + bool Remove(const K& key) { return set_.Remove(key); } + + /// Checks whether an entry exists in the map with a key equal to `key`. + /// @param key the entry key value to search for. + /// @returns true if the map contains an entry with the given key. + bool Contains(const K& key) const { return set_.Contains(key); } + + /// Pre-allocates memory so that the map can hold at least `capacity` entries. + /// @param capacity the new capacity of the map. + void Reserve(size_t capacity) { set_.Reserve(capacity); } + + /// @returns the number of entries in the map. + size_t Count() const { return set_.Count(); } + + /// @returns true if the map contains no entries. + bool IsEmpty() const { return set_.IsEmpty(); } + + /// @returns an iterator to the start of the map + Iterator begin() const { return Iterator{set_.begin()}; } + + /// @returns an iterator to the end of the map + Iterator end() const { return Iterator{set_.end()}; } + + private: + Set set_; +}; + +} // namespace tint::utils + +#endif // SRC_TINT_UTILS_HASHMAP_H_ diff --git a/src/tint/utils/hashmap_test.cc b/src/tint/utils/hashmap_test.cc new file mode 100644 index 0000000000..45e929b4c0 --- /dev/null +++ b/src/tint/utils/hashmap_test.cc @@ -0,0 +1,179 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/utils/hashmap.h" + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" + +namespace tint::utils { +namespace { + +constexpr std::array kPrimes{ + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, + 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, + 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, + 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, + 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, +}; + +TEST(Hashmap, Empty) { + Hashmap map; + EXPECT_EQ(map.Count(), 0u); +} + +TEST(Hashmap, AddRemove) { + Hashmap map; + EXPECT_TRUE(map.Add("hello", "world")); + EXPECT_EQ(map.Get("hello"), "world"); + EXPECT_EQ(map.Count(), 1u); + EXPECT_TRUE(map.Contains("hello")); + EXPECT_FALSE(map.Contains("world")); + EXPECT_FALSE(map.Add("hello", "cat")); + EXPECT_EQ(map.Count(), 1u); + EXPECT_TRUE(map.Remove("hello")); + EXPECT_EQ(map.Count(), 0u); + EXPECT_FALSE(map.Contains("hello")); + EXPECT_FALSE(map.Contains("world")); +} + +TEST(Hashmap, ReplaceRemove) { + Hashmap map; + map.Replace("hello", "world"); + EXPECT_EQ(map.Get("hello"), "world"); + EXPECT_EQ(map.Count(), 1u); + EXPECT_TRUE(map.Contains("hello")); + EXPECT_FALSE(map.Contains("world")); + map.Replace("hello", "cat"); + EXPECT_EQ(map.Get("hello"), "cat"); + EXPECT_EQ(map.Count(), 1u); + EXPECT_TRUE(map.Remove("hello")); + EXPECT_EQ(map.Count(), 0u); + EXPECT_FALSE(map.Contains("hello")); + EXPECT_FALSE(map.Contains("world")); +} + +TEST(Hashmap, Iterator) { + using Map = Hashmap; + using KV = typename Map::KeyValue; + Map map; + map.Add(1, "one"); + map.Add(4, "four"); + map.Add(3, "three"); + map.Add(2, "two"); + EXPECT_THAT(map, testing::UnorderedElementsAre(KV{1, "one"}, KV{2, "two"}, KV{3, "three"}, + KV{4, "four"})); +} + +TEST(Hashmap, AddMany) { + Hashmap map; + for (size_t i = 0; i < kPrimes.size(); i++) { + int prime = kPrimes[i]; + ASSERT_TRUE(map.Add(prime, std::to_string(prime))) << "i: " << i; + ASSERT_FALSE(map.Add(prime, std::to_string(prime))) << "i: " << i; + ASSERT_EQ(map.Count(), i + 1); + } + ASSERT_EQ(map.Count(), kPrimes.size()); + for (int prime : kPrimes) { + ASSERT_TRUE(map.Contains(prime)) << prime; + ASSERT_EQ(map.Get(prime), std::to_string(prime)) << prime; + } +} + +TEST(Hashmap, GetOrCreate) { + Hashmap map; + EXPECT_EQ(map.GetOrCreate(0, [&] { return "zero"; }), "zero"); + EXPECT_EQ(map.Count(), 1u); + EXPECT_EQ(map.Get(0), "zero"); + + bool create_called = false; + EXPECT_EQ(map.GetOrCreate(0, + [&] { + create_called = true; + return "oh noes"; + }), + "zero"); + EXPECT_FALSE(create_called); + EXPECT_EQ(map.Count(), 1u); + EXPECT_EQ(map.Get(0), "zero"); + + EXPECT_EQ(map.GetOrCreate(1, [&] { return "one"; }), "one"); + EXPECT_EQ(map.Count(), 2u); + EXPECT_EQ(map.Get(1), "one"); +} + +TEST(Hashmap, Soak) { + std::mt19937 rnd; + std::unordered_map reference; + Hashmap map; + for (size_t i = 0; i < 1000000; i++) { + std::string key = std::to_string(rnd() & 64); + std::string value = "V" + key; + switch (rnd() % 7) { + case 0: { // Add + auto expected = reference.emplace(key, value).second; + EXPECT_EQ(map.Add(key, value), expected) << "i:" << i; + EXPECT_EQ(map.Get(key), value) << "i:" << i; + EXPECT_TRUE(map.Contains(key)) << "i:" << i; + break; + } + case 1: { // Replace + reference[key] = value; + map.Replace(key, value); + EXPECT_EQ(map.Get(key), value) << "i:" << i; + EXPECT_TRUE(map.Contains(key)) << "i:" << i; + break; + } + case 2: { // Remove + auto expected = reference.erase(key) != 0; + EXPECT_EQ(map.Remove(key), expected) << "i:" << i; + EXPECT_FALSE(map.Get(key).has_value()) << "i:" << i; + EXPECT_FALSE(map.Contains(key)) << "i:" << i; + break; + } + case 3: { // Contains + auto expected = reference.count(key) != 0; + EXPECT_EQ(map.Contains(key), expected) << "i:" << i; + break; + } + case 4: { // Get + if (reference.count(key) != 0) { + auto expected = reference[key]; + EXPECT_EQ(map.Get(key), expected) << "i:" << i; + } else { + EXPECT_FALSE(map.Get(key).has_value()) << "i:" << i; + } + break; + } + case 5: { // Copy / Move + Hashmap tmp(map); + map = std::move(tmp); + break; + } + case 6: { // Clear + reference.clear(); + map.Clear(); + break; + } + } + } +} + +} // namespace +} // namespace tint::utils diff --git a/src/tint/utils/hashset.h b/src/tint/utils/hashset.h new file mode 100644 index 0000000000..3009c72eba --- /dev/null +++ b/src/tint/utils/hashset.h @@ -0,0 +1,509 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_UTILS_HASHSET_H_ +#define SRC_TINT_UTILS_HASHSET_H_ + +#include +#include +#include +#include +#include +#include + +#include "src/tint/debug.h" +#include "src/tint/utils/hash.h" +#include "src/tint/utils/vector.h" + +namespace tint::utils { + +/// Action taken by Hashset::Insert() +enum class AddAction { + /// Insert() added a new entry to the Hashset + kAdded, + /// Insert() replaced an existing entry in the Hashset + kReplaced, + /// Insert() found an existing entry, which was not replaced. + kKeptExisting, +}; + +/// An unordered set that uses a robin-hood hashing algorithm. +/// @see the fantastic tutorial: https://programming.guide/robin-hood-hashing.html +template , typename EQUAL = std::equal_to> +class Hashset { + /// A slot is a single entry in the underlying vector. + /// A slot can either be empty or filled with a value. If the slot is empty, #hash and #distance + /// will be zero. + struct Slot { + template + bool Equals(size_t value_hash, const V& val) const { + return value_hash == hash && EQUAL()(val, value.value()); + } + + /// The slot value. If this does not contain a value, then the slot is vacant. + std::optional value; + /// The precomputed hash of value. + size_t hash = 0; + size_t distance = 0; + }; + + /// The target length of the underlying vector length in relation to the number of entries in + /// the set, expressed as a percentage. For example a value of `150` would mean there would be + /// at least 50% more slots than the number of set entries. + static constexpr size_t kRehashFactor = 150; + + /// @returns the target slot vector size to hold `n` set entries. + static constexpr size_t NumSlots(size_t count) { return (count * kRehashFactor) / 100; } + + /// The fixed-size slot vector length, based on N and kRehashFactor. + static constexpr size_t kNumFixedSlots = NumSlots(N); + + /// The minimum number of slots for the set. + static constexpr size_t kMinSlots = std::max(kNumFixedSlots, 4); + + public: + /// Iterator for entries in the set + class Iterator { + public: + /// @returns the value pointed to by this iterator + const T* operator->() const { return ¤t->value.value(); } + + /// Increments the iterator + /// @returns this iterator + Iterator& operator++() { + if (current == end) { + return *this; + } + current++; + SkipToNextValue(); + return *this; + } + + /// Equality operator + /// @param other the other iterator to compare this iterator to + /// @returns true if this iterator is equal to other + bool operator==(const Iterator& other) const { return current == other.current; } + + /// Inequality operator + /// @param other the other iterator to compare this iterator to + /// @returns true if this iterator is not equal to other + bool operator!=(const Iterator& other) const { return current != other.current; } + + /// @returns a reference to the value at the iterator + const T& operator*() const { return current->value.value(); } + + private: + /// Friend class + friend class Hashset; + + Iterator(const Slot* c, const Slot* e) : current(c), end(e) { SkipToNextValue(); } + + /// Moves the iterator forward, stopping at the next slot that is not empty. + void SkipToNextValue() { + while (current != end && !current->value.has_value()) { + current++; + } + } + + const Slot* current; /// The slot the iterator is pointing to + const Slot* end; /// One past the last slot in the set + }; + + /// Type of `T`. + using value_type = T; + + /// Constructor + Hashset() { slots_.Resize(kMinSlots); } + + /// Copy constructor + /// @param other the other Hashset to copy + Hashset(const Hashset& other) = default; + + /// Move constructor + /// @param other the other Hashset to move + Hashset(Hashset&& other) = default; + + /// Destructor + ~Hashset() { Clear(); } + + /// Copy-assignment operator + /// @param other the other Hashset to copy + /// @returns this so calls can be chained + Hashset& operator=(const Hashset& other) = default; + + /// Move-assignment operator + /// @param other the other Hashset to move + /// @returns this so calls can be chained + Hashset& operator=(Hashset&& other) = default; + + /// Removes all entries from the set. + void Clear() { + slots_.Clear(); // Destructs all entries + slots_.Resize(kMinSlots); + count_ = 0; + } + + /// Result of Add() + struct AddResult { + /// Whether the insert replaced or added a new entry to the set. + AddAction action = AddAction::kAdded; + /// A pointer to the inserted entry. + /// @warning do not modify this pointer in a way that would cause the equality or hash of + /// the entry to change. Doing this will corrupt the Hashset. + T* entry = nullptr; + + /// @returns true if the entry was added to the set, or an existing entry was replaced. + operator bool() const { return action != AddAction::kKeptExisting; } + }; + + /// Adds a value to the set, if the set does not already contain an entry equal to `value`. + /// @param value the value to add to the set. + /// @returns A AddResult describing the result of the add + /// @warning do not modify the inserted entry in a way that would cause the equality of hash of + /// the entry to change. Doing this will corrupt the Hashset. + template + AddResult Add(V&& value) { + return Put(std::forward(value)); + } + + /// Adds a value to the set, replacing any entry equal to `value`. + /// @param value the value to add to the set. + /// @returns A AddResult describing the result of the replace + template + AddResult Replace(V&& value) { + return Put(std::forward(value)); + } + + /// Removes an entry from the set. + /// @param value the value to remove from the set. + /// @returns true if an entry was removed. + template + bool Remove(const V& value) { + const auto [found, start] = IndexOf(value); + if (!found) { + return false; + } + + // Shuffle the entries backwards until we either find a free slot, or a slot that has zero + // distance. + Slot* prev = nullptr; + Scan(start, [&](size_t, size_t index) { + auto& slot = slots_[index]; + if (prev) { + // note: `distance == 0` also includes empty slots. + if (slot.distance == 0) { + // Clear the previous slot, and stop shuffling. + *prev = {}; + return Action::kStop; + } else { + // Shuffle the slot backwards. + prev->value = std::move(slot.value); + prev->hash = slot.hash; + prev->distance = slot.distance - 1; + } + } + prev = &slot; + return Action::kContinue; + }); + + // Entry was removed. + count_--; + + return true; + } + + /// @param value the value to search for. + /// @returns the value of the entry that is equal to `value`, or no value if the entry was not + /// found. + template + std::optional Get(const V& value) const { + if (const auto [found, index] = IndexOf(value); found) { + return slots_[index].value.value(); + } + return std::nullopt; + } + + /// @param value the value to search for. + /// @returns a pointer to the entry that is equal to the given value, or nullptr if the set does + /// not contain the given value. + template + const T* Find(const V& value) const { + const auto [found, index] = IndexOf(value); + return found ? &slots_[index].value.value() : nullptr; + } + + /// @param value the value to search for. + /// @returns a pointer to the entry that is equal to the given value, or nullptr if the set does + /// not contain the given value. + /// @warning do not modify the inserted entry in a way that would cause the equality of hash of + /// the entry to change. Doing this will corrupt the Hashset. + template + T* Find(const V& value) { + const auto [found, index] = IndexOf(value); + return found ? &slots_[index].value.value() : nullptr; + } + + /// Checks whether an entry exists in the set + /// @param value the value to search for. + /// @returns true if the set contains an entry with the given value. + template + bool Contains(const V& value) const { + const auto [found, _] = IndexOf(value); + return found; + } + + /// Pre-allocates memory so that the set can hold at least `capacity` entries. + /// @param capacity the new capacity of the set. + void Reserve(size_t capacity) { + // Calculate the number of slots required to hold `capacity` entries. + const size_t num_slots = std::max(NumSlots(capacity), kMinSlots); + if (slots_.Length() >= num_slots) { + // Already have enough slots. + return; + } + + // Move all the values out of the set and into a vector. + Vector values; + values.Reserve(count_); + for (auto& slot : slots_) { + if (slot.value.has_value()) { + values.Push(std::move(slot.value.value())); + } + } + + // Clear the set, grow the number of slots. + Clear(); + slots_.Resize(num_slots); + + // As the number of slots has grown, the slot indices will have changed from before, so + // re-add all the values back into the set. + for (auto& value : values) { + Add(std::move(value)); + } + } + + /// @returns the number of entries in the set. + size_t Count() const { return count_; } + + /// @returns true if the set contains no entries. + bool IsEmpty() const { return count_ == 0; } + + /// @returns an iterator to the start of the set. + Iterator begin() const { return Iterator{slots_.begin(), slots_.end()}; } + + /// @returns an iterator to the end of the set. + Iterator end() const { return Iterator{slots_.end(), slots_.end()}; } + + /// A debug function for checking that the set is in good health. + /// Asserts if the set is corrupted. + void ValidateIntegrity() const { + size_t num_alive = 0; + for (size_t slot_idx = 0; slot_idx < slots_.Length(); slot_idx++) { + const auto& slot = slots_[slot_idx]; + if (slot.value.has_value()) { + num_alive++; + auto const [index, hash] = Hash(slot.value.value()); + TINT_ASSERT(Utils, hash == slot.hash); + TINT_ASSERT(Utils, slot_idx == Wrap(index + slot.distance)); + } + } + TINT_ASSERT(Utils, num_alive == count_); + } + + private: + /// The behaviour of Put() when an entry already exists with the given key. + enum class PutMode { + /// Do not replace existing entries with the new value. + kAdd, + /// Replace existing entries with the new value. + kReplace, + }; + /// The common implementation for Add() and Replace() + /// @param value the value to add to the set. + /// @returns A AddResult describing the result of the insertion + template + AddResult Put(V&& value) { + // Ensure the set can fit a new entry + if (ShouldRehash(count_ + 1)) { + Reserve((count_ + 1) * 2); + } + + const auto hash = Hash(value); + + AddResult result{}; + Scan(hash.scan_start, [&](size_t distance, size_t index) { + auto& slot = slots_[index]; + if (!slot.value.has_value()) { + // Found an empty slot. + // Place value directly into the slot, and we're done. + slot.value.emplace(std::forward(value)); + slot.hash = hash.value; + slot.distance = distance; + count_++; + result = AddResult{AddAction::kAdded, &slot.value.value()}; + return Action::kStop; + } + + // Slot has an entry + + if (slot.Equals(hash.value, value)) { + // Slot is equal to value. Replace or preserve? + if constexpr (MODE == PutMode::kReplace) { + slot.value = std::forward(value); + result = AddResult{AddAction::kReplaced, &slot.value.value()}; + } else { + result = AddResult{AddAction::kKeptExisting, &slot.value.value()}; + } + return Action::kStop; + } + + if (slot.distance < distance) { + // Existing slot has a closer distance than the value we're attempting to insert. + // Steal from the rich! + // Move the current slot to a temporary (evicted), and put the value into the slot. + Slot evicted{std::forward(value), hash.value, distance}; + std::swap(evicted, slot); + + // Find a new home for the evicted slot. + evicted.distance++; // We've already swapped at index. + InsertShuffle(Wrap(index + 1), std::move(evicted)); + + count_++; + result = AddResult{AddAction::kAdded, &slot.value.value()}; + + return Action::kStop; + } + return Action::kContinue; + }); + + return result; + } + + /// Return type of the Scan() callback. + enum class Action { + /// Continue scanning for a slot + kContinue, + /// Immediately stop scanning for a slot + kStop, + }; + + /// Sequentially visits each of the slots starting with the slot with the index `start`, calling + /// the callback function `f` for each slot until `f` returns Action::kStop. + /// `f` must be a function with the signature `Action(size_t distance, size_t index)`. + /// `f` must return Action::kStop within one whole cycle of the slots. + template + void Scan(size_t start, F&& f) const { + size_t index = start; + for (size_t distance = 0; distance < slots_.Length(); distance++) { + if (f(distance, index) == Action::kStop) { + return; + } + index = Wrap(index + 1); + } + tint::diag::List diags; + TINT_ICE(Utils, diags) << "Hashset::Scan() looped entire set without finding a slot"; + } + + /// HashResult is the return value of Hash() + struct HashResult { + /// The target (zero-distance) slot index for the value. + size_t scan_start; + /// The calculated hash of the value. + size_t value; + }; + + /// @returns a tuple holding the target slot index for the given value, and the hash of the + /// value, respectively. + template + HashResult Hash(const V& value) const { + size_t hash = HASH()(value); + size_t index = Wrap(hash); + return {index, hash}; + } + + /// Looks for the value in the set. + /// @returns a tuple holding a boolean representing whether the value was found in the set, and + /// if found, the index of the slot that holds the value. + template + std::tuple IndexOf(const V& value) const { + const auto hash = Hash(value); + + bool found = false; + size_t idx = 0; + + Scan(hash.scan_start, [&](size_t distance, size_t index) { + auto& slot = slots_[index]; + if (!slot.value.has_value()) { + return Action::kStop; + } + if (slot.Equals(hash.value, value)) { + found = true; + idx = index; + return Action::kStop; + } + if (slot.distance < distance) { + // If the slot distance is less than the current probe distance, then the slot must + // be for entry that has an index that comes after value. In this situation, we know + // that the set does not contain the value, as it would have been found before this + // slot. The "Lookup" section of https://programming.guide/robin-hood-hashing.html + // suggests that the condition should inverted, but this is wrong. + return Action::kStop; + } + return Action::kContinue; + }); + + return {found, idx}; + } + + /// Shuffles slots for an insertion that has been placed one slot before `start`. + /// @param evicted the slot content that was evicted for the insertion. + void InsertShuffle(size_t start, Slot evicted) { + Scan(start, [&](size_t, size_t index) { + auto& slot = slots_[index]; + + if (!slot.value.has_value()) { + // Empty slot found for evicted. + slot = std::move(evicted); + return Action::kStop; // We're done. + } + + if (slot.distance < evicted.distance) { + // Occupied slot has shorter distance to evicted. + // Swap slot and evicted. + std::swap(slot, evicted); + } + + // evicted moves further from the target slot... + evicted.distance++; + + return Action::kContinue; + }); + } + + /// @returns true if the set should grow the slot vector, and rehash the items. + bool ShouldRehash(size_t count) const { return NumSlots(count) > slots_.Length(); } + + /// Wrap returns the index value modulo the number of slots. + size_t Wrap(size_t index) const { return index % slots_.Length(); } + + /// The vector of slots. The vector length is equal to its capacity. + Vector slots_; + + /// The number of entries in the set. + size_t count_ = 0; +}; + +} // namespace tint::utils + +#endif // SRC_TINT_UTILS_HASHSET_H_ diff --git a/src/tint/utils/hashset_test.cc b/src/tint/utils/hashset_test.cc new file mode 100644 index 0000000000..4213b32490 --- /dev/null +++ b/src/tint/utils/hashset_test.cc @@ -0,0 +1,142 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/utils/hashset.h" + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" + +namespace tint::utils { +namespace { + +constexpr std::array kPrimes{ + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, + 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, + 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, + 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, + 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, +}; + +TEST(Hashset, Empty) { + Hashset set; + EXPECT_EQ(set.Count(), 0u); +} + +TEST(Hashset, AddRemove) { + Hashset set; + EXPECT_TRUE(set.Add("hello")); + EXPECT_EQ(set.Count(), 1u); + EXPECT_TRUE(set.Contains("hello")); + EXPECT_FALSE(set.Contains("world")); + EXPECT_FALSE(set.Add("hello")); + EXPECT_EQ(set.Count(), 1u); + EXPECT_TRUE(set.Remove("hello")); + EXPECT_EQ(set.Count(), 0u); + EXPECT_FALSE(set.Contains("hello")); + EXPECT_FALSE(set.Contains("world")); +} + +TEST(Hashset, AddMany) { + Hashset set; + for (size_t i = 0; i < kPrimes.size(); i++) { + int prime = kPrimes[i]; + ASSERT_TRUE(set.Add(prime)) << "i: " << i; + ASSERT_FALSE(set.Add(prime)) << "i: " << i; + ASSERT_EQ(set.Count(), i + 1); + set.ValidateIntegrity(); + } + ASSERT_EQ(set.Count(), kPrimes.size()); + for (int prime : kPrimes) { + ASSERT_TRUE(set.Contains(prime)) << prime; + } +} + +TEST(Hashset, Iterator) { + Hashset set; + set.Add("one"); + set.Add("four"); + set.Add("three"); + set.Add("two"); + EXPECT_THAT(set, testing::UnorderedElementsAre("one", "two", "three", "four")); +} + +TEST(Hashset, Soak) { + std::mt19937 rnd; + std::unordered_set reference; + Hashset set; + for (size_t i = 0; i < 1000000; i++) { + std::string value = std::to_string(rnd() & 0x100); + switch (rnd() % 8) { + case 0: { // Add + auto expected = reference.emplace(value).second; + ASSERT_EQ(set.Add(value), expected) << "i: " << i; + ASSERT_TRUE(set.Contains(value)) << "i: " << i; + break; + } + case 1: { // Replace + reference.emplace(value); + set.Replace(value); + ASSERT_TRUE(set.Contains(value)) << "i: " << i; + break; + } + case 2: { // Remove + auto expected = reference.erase(value) != 0; + ASSERT_EQ(set.Remove(value), expected) << "i: " << i; + ASSERT_FALSE(set.Contains(value)) << "i: " << i; + break; + } + case 3: { // Contains + auto expected = reference.count(value) != 0; + ASSERT_EQ(set.Contains(value), expected) << "i: " << i; + break; + } + case 4: { // Get + if (reference.count(value) != 0) { + ASSERT_TRUE(set.Get(value).has_value()) << "i: " << i; + ASSERT_EQ(set.Get(value), value) << "i: " << i; + } else { + ASSERT_FALSE(set.Get(value).has_value()) << "i: " << i; + } + break; + } + case 5: { // Find + if (reference.count(value) != 0) { + ASSERT_EQ(*set.Find(value), value) << "i: " << i; + } else { + ASSERT_EQ(set.Find(value), nullptr) << "i: " << i; + } + break; + } + case 6: { // Copy / Move + Hashset tmp(set); + set = std::move(tmp); + break; + } + case 7: { // Clear + reference.clear(); + set.Clear(); + break; + } + } + set.ValidateIntegrity(); + } +} + +} // namespace +} // namespace tint::utils diff --git a/src/tint/utils/io/command_posix.cc b/src/tint/utils/io/command_posix.cc index 23ee5115fd..b3371e7613 100644 --- a/src/tint/utils/io/command_posix.cc +++ b/src/tint/utils/io/command_posix.cc @@ -164,7 +164,7 @@ Command::Output Command::Exec(std::initializer_list arguments) cons // run the target command. // // The parent process is responsible for feeding any input to the stdin_pipe - // and collectting output from the std[out,err]_pipes. + // and collecting output from the std[out,err]_pipes. int child_id = fork(); if (child_id < 0) { @@ -251,7 +251,9 @@ Command::Output Command::Exec(std::initializer_list arguments) cons std::vector args; args.emplace_back(path_.c_str()); for (auto& arg : arguments) { - args.emplace_back(arg.c_str()); + if (!arg.empty()) { + args.emplace_back(arg.c_str()); + } } args.emplace_back(nullptr); auto res = execv(path_.c_str(), const_cast(args.data())); diff --git a/src/tint/utils/io/command_windows.cc b/src/tint/utils/io/command_windows.cc index f953a85776..8c94e254f4 100644 --- a/src/tint/utils/io/command_windows.cc +++ b/src/tint/utils/io/command_windows.cc @@ -16,9 +16,12 @@ #define WIN32_LEAN_AND_MEAN 1 #include +#include #include #include +#include "src/tint/utils/defer.h" + namespace tint::utils { namespace { @@ -97,9 +100,34 @@ class Pipe { Handle write; }; +/// Queries whether the file at the given path is an executable or DLL. bool ExecutableExists(const std::string& path) { - DWORD type = 0; - return GetBinaryTypeA(path.c_str(), &type); + auto file = Handle(CreateFileA(path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_READONLY, NULL)); + if (!file) { + return false; + } + + auto map = Handle(CreateFileMappingA(file, NULL, PAGE_READONLY, 0, 0, NULL)); + if (map == INVALID_HANDLE_VALUE) { + return false; + } + + void* addr_header = MapViewOfFileEx(map, FILE_MAP_READ, 0, 0, 0, NULL); + + // Dynamically obtain the address of, and call ImageNtHeader. This is done to avoid tint.exe + // needing to statically link Dbghelp.lib. + static auto* dbg_help = LoadLibraryA("Dbghelp.dll"); // Leaks, but who cares? + if (dbg_help) { + if (FARPROC proc = GetProcAddress(dbg_help, "ImageNtHeader")) { + using ImageNtHeaderPtr = decltype(&ImageNtHeader); + auto* image_nt_header = reinterpret_cast(proc)(addr_header); + return image_nt_header != nullptr; + } + } + + // Couldn't call ImageNtHeader, assume it is executable + return false; } std::string FindExecutable(const std::string& name) { @@ -172,7 +200,9 @@ Command::Output Command::Exec(std::initializer_list arguments) cons std::stringstream args; args << path_; for (auto& arg : arguments) { - args << " " << arg; + if (!arg.empty()) { + args << " " << arg; + } } PROCESS_INFORMATION pi{}; @@ -187,7 +217,8 @@ Command::Output Command::Exec(std::initializer_list arguments) cons &si, // Pointer to STARTUPINFO structure &pi)) { // Pointer to PROCESS_INFORMATION structure Output out; - out.err = "Command::Exec() CreateProcess() failed"; + out.err = "Command::Exec() CreateProcess('" + args.str() + "') failed"; + out.error_code = 1; return out; } diff --git a/src/tint/utils/result.h b/src/tint/utils/result.h new file mode 100644 index 0000000000..b535f4fcdb --- /dev/null +++ b/src/tint/utils/result.h @@ -0,0 +1,102 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_UTILS_RESULT_H_ +#define SRC_TINT_UTILS_RESULT_H_ + +#include +#include + +namespace tint::utils { + +/// Empty structure used as the default FAILURE_TYPE for a Result. +struct FailureType {}; + +static constexpr const FailureType Failure; + +/// Result is a helper for functions that need to return a value, or an failure value. +/// Result can be constructed with either a 'success' or 'failure' value. +/// @tparam SUCCESS_TYPE the 'success' value type. +/// @tparam FAILURE_TYPE the 'failure' value type. Defaults to FailureType which provides no +/// information about the failure, except that something failed. Must not be the same type +/// as SUCCESS_TYPE. +template +struct [[nodiscard]] Result { + static_assert(!std::is_same_v, + "Result must not have the same type for SUCCESS_TYPE and FAILURE_TYPE"); + + /// Constructor + /// @param success the success result + Result(const SUCCESS_TYPE& success) // NOLINT(runtime/explicit): + : value{success} {} + + /// Constructor + /// @param failure the failure result + Result(const FAILURE_TYPE& failure) // NOLINT(runtime/explicit): + : value{failure} {} + + /// @returns true if the result was a success + operator bool() const { return std::holds_alternative(value); } + + /// @returns true if the result was a failure + bool operator!() const { return std::holds_alternative(value); } + + /// @returns the success value + /// @warning attempting to call this when the Result holds an failure will result in UB. + const SUCCESS_TYPE* operator->() const { return &std::get(value); } + + /// @returns the success value + /// @warning attempting to call this when the Result holds an failure value will result in UB. + const SUCCESS_TYPE& Get() const { return std::get(value); } + + /// @returns the failure value + /// @warning attempting to call this when the Result holds a success value will result in UB. + const FAILURE_TYPE& Failure() const { return std::get(value); } + + /// Equality operator + /// @param val the value to compare this Result to + /// @returns true if this result holds a success value equal to `value` + bool operator==(SUCCESS_TYPE val) const { + if (auto* v = std::get_if(&value)) { + return *v == val; + } + return false; + } + + /// Equality operator + /// @param val the value to compare this Result to + /// @returns true if this result holds a failure value equal to `value` + bool operator==(FAILURE_TYPE val) const { + if (auto* v = std::get_if(&value)) { + return *v == val; + } + return false; + } + + /// The result. Either a success of failure value. + std::variant value; +}; + +/// Writes the result to the ostream. +/// @param out the std::ostream to write to +/// @param res the result +/// @return the std::ostream so calls can be chained +template +inline std::ostream& operator<<(std::ostream& out, Result res) { + return res ? (out << "success: " << res.Get()) : (out << "failure: " << res.Failure()); +} + +} // namespace tint::utils + +#endif // SRC_TINT_UTILS_RESULT_H_ diff --git a/src/tint/utils/result_test.cc b/src/tint/utils/result_test.cc new file mode 100644 index 0000000000..ce125f452b --- /dev/null +++ b/src/tint/utils/result_test.cc @@ -0,0 +1,55 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/utils/result.h" + +#include + +#include "gmock/gmock.h" + +namespace tint::utils { +namespace { + +TEST(ResultTest, SuccessInt) { + auto r = Result(123); + EXPECT_TRUE(r); + EXPECT_FALSE(!r); + EXPECT_EQ(r.Get(), 123); +} + +TEST(ResultTest, SuccessStruct) { + struct S { + int value; + }; + auto r = Result({123}); + EXPECT_TRUE(r); + EXPECT_FALSE(!r); + EXPECT_EQ(r->value, 123); +} + +TEST(ResultTest, Failure) { + auto r = Result(Failure); + EXPECT_FALSE(r); + EXPECT_TRUE(!r); +} + +TEST(ResultTest, CustomFailure) { + auto r = Result("oh noes!"); + EXPECT_FALSE(r); + EXPECT_TRUE(!r); + EXPECT_EQ(r.Failure(), "oh noes!"); +} + +} // namespace +} // namespace tint::utils diff --git a/src/tint/utils/string.h b/src/tint/utils/string.h index a11e44e421..f10e2581d3 100644 --- a/src/tint/utils/string.h +++ b/src/tint/utils/string.h @@ -15,6 +15,7 @@ #ifndef SRC_TINT_UTILS_STRING_H_ #define SRC_TINT_UTILS_STRING_H_ +#include #include namespace tint::utils { @@ -34,6 +35,15 @@ inline std::string ReplaceAll(std::string str, return str; } +/// @param value the value to be printed as a string +/// @returns value printed as a string via the std::ostream `<<` operator +template +std::string ToString(const T& value) { + std::stringstream s; + s << value; + return s.str(); +} + } // namespace tint::utils #endif // SRC_TINT_UTILS_STRING_H_ diff --git a/src/tint/utils/string_test.cc b/src/tint/utils/string_test.cc index 0d3e14fc40..d1cab51e95 100644 --- a/src/tint/utils/string_test.cc +++ b/src/tint/utils/string_test.cc @@ -32,5 +32,10 @@ TEST(StringTest, ReplaceAll) { ASSERT_EQ("aabxybbxybcc", ReplaceAll("aabbcc", "b", "bxyb")); } +TEST(StringTest, ToString) { + ASSERT_EQ("123", ToString(123)); + ASSERT_EQ("hello", ToString("hello")); +} + } // namespace } // namespace tint::utils diff --git a/src/tint/utils/to_const_ptr_vec.h b/src/tint/utils/to_const_ptr_vec.h deleted file mode 100644 index 02cc984aae..0000000000 --- a/src/tint/utils/to_const_ptr_vec.h +++ /dev/null @@ -1,37 +0,0 @@ - -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SRC_TINT_UTILS_TO_CONST_PTR_VEC_H_ -#define SRC_TINT_UTILS_TO_CONST_PTR_VEC_H_ - -#include - -namespace tint::utils { - -/// @param in a vector of `T*` -/// @returns a vector of `const T*` with the content of `in`. -template -std::vector ToConstPtrVec(const std::vector& in) { - std::vector out; - out.reserve(in.size()); - for (auto* ptr : in) { - out.emplace_back(ptr); - } - return out; -} - -} // namespace tint::utils - -#endif // SRC_TINT_UTILS_TO_CONST_PTR_VEC_H_ diff --git a/src/tint/utils/transform.h b/src/tint/utils/transform.h index 2cd9481e4e..2faca462c1 100644 --- a/src/tint/utils/transform.h +++ b/src/tint/utils/transform.h @@ -21,14 +21,14 @@ #include #include "src/tint/traits.h" +#include "src/tint/utils/vector.h" namespace tint::utils { /// Transform performs an element-wise transformation of a vector. /// @param in the input vector. /// @param transform the transformation function with signature: `OUT(IN)` -/// @returns a new vector with each element of the source vector transformed by -/// `transform`. +/// @returns a new vector with each element of the source vector transformed by `transform`. template auto Transform(const std::vector& in, TRANSFORMER&& transform) -> std::vector { @@ -41,10 +41,8 @@ auto Transform(const std::vector& in, TRANSFORMER&& transform) /// Transform performs an element-wise transformation of a vector. /// @param in the input vector. -/// @param transform the transformation function with signature: -/// `OUT(IN, size_t)` -/// @returns a new vector with each element of the source vector transformed by -/// `transform`. +/// @param transform the transformation function with signature: `OUT(IN, size_t)` +/// @returns a new vector with each element of the source vector transformed by `transform`. template auto Transform(const std::vector& in, TRANSFORMER&& transform) -> std::vector { @@ -55,6 +53,106 @@ auto Transform(const std::vector& in, TRANSFORMER&& transform) return result; } +/// Transform performs an element-wise transformation of a vector. +/// @param in the input vector. +/// @param transform the transformation function with signature: `OUT(IN)` +/// @returns a new vector with each element of the source vector transformed by `transform`. +template +auto Transform(const Vector& in, TRANSFORMER&& transform) + -> Vector { + const auto count = in.Length(); + Vector result; + result.Reserve(count); + for (size_t i = 0; i < count; ++i) { + result.Push(transform(in[i])); + } + return result; +} + +/// Transform performs an element-wise transformation of a vector. +/// @param in the input vector. +/// @param transform the transformation function with signature: `OUT(IN, size_t)` +/// @returns a new vector with each element of the source vector transformed by `transform`. +template +auto Transform(const Vector& in, TRANSFORMER&& transform) + -> Vector { + const auto count = in.Length(); + Vector result; + result.Reserve(count); + for (size_t i = 0; i < count; ++i) { + result.Push(transform(in[i], i)); + } + return result; +} + +/// Transform performs an element-wise transformation of a vector reference. +/// @param in the input vector. +/// @param transform the transformation function with signature: `OUT(IN)` +/// @tparam N the small-array size of the returned Vector +/// @returns a new vector with each element of the source vector transformed by `transform`. +template +auto Transform(const VectorRef& in, TRANSFORMER&& transform) + -> Vector { + const auto count = in.Length(); + Vector result; + result.Reserve(count); + for (size_t i = 0; i < count; ++i) { + result.Push(transform(in[i])); + } + return result; +} + +/// Transform performs an element-wise transformation of a vector reference. +/// @param in the input vector. +/// @param transform the transformation function with signature: `OUT(IN, size_t)` +/// @tparam N the small-array size of the returned Vector +/// @returns a new vector with each element of the source vector transformed by `transform`. +template +auto Transform(const VectorRef& in, TRANSFORMER&& transform) + -> Vector { + const auto count = in.Length(); + Vector result; + result.Reserve(count); + for (size_t i = 0; i < count; ++i) { + result.Push(transform(in[i], i)); + } + return result; +} + +/// TransformN performs an element-wise transformation of a vector, transforming and returning at +/// most `n` elements. +/// @param in the input vector. +/// @param n the maximum number of elements to transform. +/// @param transform the transformation function with signature: `OUT(IN)` +/// @returns a new vector with at most n-elements of the source vector transformed by `transform`. +template +auto TransformN(const std::vector& in, size_t n, TRANSFORMER&& transform) + -> std::vector { + const auto count = std::min(n, in.size()); + std::vector result(count); + for (size_t i = 0; i < count; ++i) { + result[i] = transform(in[i]); + } + return result; +} + +/// TransformN performs an element-wise transformation of a vector, transforming and returning at +/// most `n` elements. +/// @param in the input vector. +/// @param n the maximum number of elements to transform. +/// @param transform the transformation function with signature: `OUT(IN, size_t)` +/// @returns a new vector with at most n-elements of the source vector transformed by `transform`. +template +auto TransformN(const std::vector& in, size_t n, TRANSFORMER&& transform) + -> std::vector { + const auto count = std::min(n, in.size()); + std::vector result(count); + for (size_t i = 0; i < count; ++i) { + result[i] = transform(in[i], i); + } + return result; +} + } // namespace tint::utils #endif // SRC_TINT_UTILS_TRANSFORM_H_ diff --git a/src/tint/utils/transform_test.cc b/src/tint/utils/transform_test.cc index af8b832932..71b3f0cb51 100644 --- a/src/tint/utils/transform_test.cc +++ b/src/tint/utils/transform_test.cc @@ -26,11 +26,11 @@ namespace tint::utils { namespace { -TEST(TransformTest, Empty) { +TEST(TransformTest, StdVectorEmpty) { const std::vector empty{}; { auto transformed = Transform(empty, [](int) -> int { - [] { FAIL() << "Transform should not be called for empty vector"; }(); + [] { FAIL() << "Callback should not be called for empty vector"; }(); return 0; }); CHECK_ELEMENT_TYPE(transformed, int); @@ -38,7 +38,7 @@ TEST(TransformTest, Empty) { } { auto transformed = Transform(empty, [](int, size_t) -> int { - [] { FAIL() << "Transform should not be called for empty vector"; }(); + [] { FAIL() << "Callback should not be called for empty vector"; }(); return 0; }); CHECK_ELEMENT_TYPE(transformed, int); @@ -46,21 +46,21 @@ TEST(TransformTest, Empty) { } } -TEST(TransformTest, Identity) { +TEST(TransformTest, StdVectorIdentity) { const std::vector input{1, 2, 3, 4}; - { - auto transformed = Transform(input, [](int i) { return i; }); - CHECK_ELEMENT_TYPE(transformed, int); - EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); - } - { - auto transformed = Transform(input, [](int i, size_t) { return i; }); - CHECK_ELEMENT_TYPE(transformed, int); - EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); - } + auto transformed = Transform(input, [](int i) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); } -TEST(TransformTest, Index) { +TEST(TransformTest, StdVectorIdentityWithIndex) { + const std::vector input{1, 2, 3, 4}; + auto transformed = Transform(input, [](int i, size_t) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); +} + +TEST(TransformTest, StdVectorIndex) { const std::vector input{10, 20, 30, 40}; { auto transformed = Transform(input, [](int, size_t idx) { return idx; }); @@ -69,7 +69,7 @@ TEST(TransformTest, Index) { } } -TEST(TransformTest, TransformSameType) { +TEST(TransformTest, TransformStdVectorSameType) { const std::vector input{1, 2, 3, 4}; { auto transformed = Transform(input, [](int i) { return i * 10; }); @@ -78,7 +78,7 @@ TEST(TransformTest, TransformSameType) { } } -TEST(TransformTest, TransformDifferentType) { +TEST(TransformTest, TransformStdVectorDifferentType) { const std::vector input{1, 2, 3, 4}; { auto transformed = Transform(input, [](int i) { return std::to_string(i); }); @@ -87,5 +87,263 @@ TEST(TransformTest, TransformDifferentType) { } } +TEST(TransformNTest, StdVectorEmpty) { + const std::vector empty{}; + { + auto transformed = TransformN(empty, 4u, [](int) -> int { + [] { FAIL() << "Callback should not be called for empty vector"; }(); + return 0; + }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_EQ(transformed.size(), 0u); + } + { + auto transformed = TransformN(empty, 4u, [](int, size_t) -> int { + [] { FAIL() << "Callback should not be called for empty vector"; }(); + return 0; + }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_EQ(transformed.size(), 0u); + } +} + +TEST(TransformNTest, StdVectorIdentity) { + const std::vector input{1, 2, 3, 4}; + { + auto transformed = TransformN(input, 0u, [](int) { + [] { FAIL() << "Callback should not call the transform when n == 0"; }(); + return 0; + }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_TRUE(transformed.empty()); + } + { + auto transformed = TransformN(input, 2u, [](int i) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2)); + } + { + auto transformed = TransformN(input, 6u, [](int i) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); + } +} + +TEST(TransformNTest, StdVectorIdentityWithIndex) { + const std::vector input{1, 2, 3, 4}; + { + auto transformed = TransformN(input, 0u, [](int, size_t) { + [] { FAIL() << "Callback should not call the transform when n == 0"; }(); + return 0; + }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_TRUE(transformed.empty()); + } + { + auto transformed = TransformN(input, 3u, [](int i, size_t) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3)); + } + { + auto transformed = TransformN(input, 9u, [](int i, size_t) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); + } +} + +TEST(TransformNTest, StdVectorIndex) { + const std::vector input{10, 20, 30, 40}; + { + auto transformed = TransformN(input, 0u, [](int, size_t) { + [] { FAIL() << "Callback should not call the transform when n == 0"; }(); + return static_cast(0); + }); + CHECK_ELEMENT_TYPE(transformed, size_t); + EXPECT_TRUE(transformed.empty()); + } + { + auto transformed = TransformN(input, 2u, [](int, size_t idx) { return idx; }); + CHECK_ELEMENT_TYPE(transformed, size_t); + EXPECT_THAT(transformed, testing::ElementsAre(0u, 1u)); + } + { + auto transformed = TransformN(input, 9u, [](int, size_t idx) { return idx; }); + CHECK_ELEMENT_TYPE(transformed, size_t); + EXPECT_THAT(transformed, testing::ElementsAre(0u, 1u, 2u, 3u)); + } +} + +TEST(TransformNTest, StdVectorTransformSameType) { + const std::vector input{1, 2, 3, 4}; + { + auto transformed = TransformN(input, 0u, [](int, size_t) { + [] { FAIL() << "Callback should not call the transform when n == 0"; }(); + return 0; + }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_TRUE(transformed.empty()); + } + { + auto transformed = TransformN(input, 2u, [](int i) { return i * 10; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(10, 20)); + } + { + auto transformed = TransformN(input, 9u, [](int i) { return i * 10; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(10, 20, 30, 40)); + } +} + +TEST(TransformNTest, StdVectorTransformDifferentType) { + const std::vector input{1, 2, 3, 4}; + { + auto transformed = TransformN(input, 0u, [](int) { + [] { FAIL() << "Callback should not call the transform when n == 0"; }(); + return std::string(); + }); + CHECK_ELEMENT_TYPE(transformed, std::string); + EXPECT_TRUE(transformed.empty()); + } + { + auto transformed = TransformN(input, 2u, [](int i) { return std::to_string(i); }); + CHECK_ELEMENT_TYPE(transformed, std::string); + EXPECT_THAT(transformed, testing::ElementsAre("1", "2")); + } + { + auto transformed = TransformN(input, 9u, [](int i) { return std::to_string(i); }); + CHECK_ELEMENT_TYPE(transformed, std::string); + EXPECT_THAT(transformed, testing::ElementsAre("1", "2", "3", "4")); + } +} + +TEST(TransformTest, TintVectorEmpty) { + const Vector empty{}; + { + auto transformed = Transform(empty, [](int) -> int { + [] { FAIL() << "Callback should not be called for empty vector"; }(); + return 0; + }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_EQ(transformed.Length(), 0u); + } + { + auto transformed = Transform(empty, [](int, size_t) -> int { + [] { FAIL() << "Callback should not be called for empty vector"; }(); + return 0; + }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_EQ(transformed.Length(), 0u); + } +} + +TEST(TransformTest, TintVectorIdentity) { + const Vector input{1, 2, 3, 4}; + auto transformed = Transform(input, [](int i) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); +} + +TEST(TransformTest, TintVectorIdentityWithIndex) { + const Vector input{1, 2, 3, 4}; + auto transformed = Transform(input, [](int i, size_t) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); +} + +TEST(TransformTest, TintVectorIndex) { + const Vector input{10, 20, 30, 40}; + { + auto transformed = Transform(input, [](int, size_t idx) { return idx; }); + CHECK_ELEMENT_TYPE(transformed, size_t); + EXPECT_THAT(transformed, testing::ElementsAre(0u, 1u, 2u, 3u)); + } +} + +TEST(TransformTest, TransformTintVectorSameType) { + const Vector input{1, 2, 3, 4}; + { + auto transformed = Transform(input, [](int i) { return i * 10; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(10, 20, 30, 40)); + } +} + +TEST(TransformTest, TransformTintVectorDifferentType) { + const Vector input{1, 2, 3, 4}; + { + auto transformed = Transform(input, [](int i) { return std::to_string(i); }); + CHECK_ELEMENT_TYPE(transformed, std::string); + EXPECT_THAT(transformed, testing::ElementsAre("1", "2", "3", "4")); + } +} + +TEST(TransformTest, VectorRefEmpty) { + Vector empty{}; + VectorRef ref(empty); + { + auto transformed = Transform<4>(ref, [](int) -> int { + [] { FAIL() << "Callback should not be called for empty vector"; }(); + return 0; + }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_EQ(transformed.Length(), 0u); + } + { + auto transformed = Transform<4>(ref, [](int, size_t) -> int { + [] { FAIL() << "Callback should not be called for empty vector"; }(); + return 0; + }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_EQ(transformed.Length(), 0u); + } +} + +TEST(TransformTest, VectorRefIdentity) { + Vector input{1, 2, 3, 4}; + VectorRef ref(input); + auto transformed = Transform<8>(ref, [](int i) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); +} + +TEST(TransformTest, VectorRefIdentityWithIndex) { + Vector input{1, 2, 3, 4}; + VectorRef ref(input); + auto transformed = Transform<2>(ref, [](int i, size_t) { return i; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(1, 2, 3, 4)); +} + +TEST(TransformTest, VectorRefIndex) { + Vector input{10, 20, 30, 40}; + VectorRef ref(input); + { + auto transformed = Transform<4>(ref, [](int, size_t idx) { return idx; }); + CHECK_ELEMENT_TYPE(transformed, size_t); + EXPECT_THAT(transformed, testing::ElementsAre(0u, 1u, 2u, 3u)); + } +} + +TEST(TransformTest, TransformVectorRefSameType) { + Vector input{1, 2, 3, 4}; + VectorRef ref(input); + { + auto transformed = Transform<4>(ref, [](int i) { return i * 10; }); + CHECK_ELEMENT_TYPE(transformed, int); + EXPECT_THAT(transformed, testing::ElementsAre(10, 20, 30, 40)); + } +} + +TEST(TransformTest, TransformVectorRefDifferentType) { + Vector input{1, 2, 3, 4}; + VectorRef ref(input); + { + auto transformed = Transform<4>(ref, [](int i) { return std::to_string(i); }); + CHECK_ELEMENT_TYPE(transformed, std::string); + EXPECT_THAT(transformed, testing::ElementsAre("1", "2", "3", "4")); + } +} + } // namespace } // namespace tint::utils diff --git a/src/tint/utils/unique_vector.h b/src/tint/utils/unique_vector.h index 96d9cbf2b3..bda090cea0 100644 --- a/src/tint/utils/unique_vector.h +++ b/src/tint/utils/unique_vector.h @@ -21,17 +21,15 @@ #include #include +#include "src/tint/utils/hashset.h" +#include "src/tint/utils/vector.h" + namespace tint::utils { /// UniqueVector is an ordered container that only contains unique items. /// Attempting to add a duplicate is a no-op. -template , typename EQUAL = std::equal_to> +template , typename EQUAL = std::equal_to> struct UniqueVector { - /// The iterator returned by begin() and end() - using ConstIterator = typename std::vector::const_iterator; - /// The iterator returned by rbegin() and rend() - using ConstReverseIterator = typename std::vector::const_reverse_iterator; - /// Constructor UniqueVector() = default; @@ -40,7 +38,7 @@ struct UniqueVector { /// elements will be removed. explicit UniqueVector(std::vector&& v) { for (auto& el : v) { - add(el); + Add(el); } } @@ -48,10 +46,9 @@ struct UniqueVector { /// already contain the given item. /// @param item the item to append to the end of the vector /// @returns true if the item was added, otherwise false. - bool add(const T& item) { - if (set.count(item) == 0) { - vector.emplace_back(item); - set.emplace(item); + bool Add(const T& item) { + if (set.Add(item)) { + vector.Push(item); return true; } return false; @@ -59,7 +56,7 @@ struct UniqueVector { /// @returns true if the vector contains `item` /// @param item the item - bool contains(const T& item) const { return set.count(item); } + bool Contains(const T& item) const { return set.Contains(item); } /// @param i the index of the element to retrieve /// @returns the element at the index `i` @@ -70,38 +67,50 @@ struct UniqueVector { const T& operator[](size_t i) const { return vector[i]; } /// @returns true if the vector is empty - bool empty() const { return vector.empty(); } + bool IsEmpty() const { return vector.IsEmpty(); } /// @returns the number of items in the vector - size_t size() const { return vector.size(); } + size_t Length() const { return vector.Length(); } + + /// @returns the pointer to the first element in the vector, or nullptr if the vector is empty. + const T* Data() const { return vector.IsEmpty() ? nullptr : &vector[0]; } /// @returns an iterator to the beginning of the vector - ConstIterator begin() const { return vector.begin(); } + auto begin() const { return vector.begin(); } /// @returns an iterator to the end of the vector - ConstIterator end() const { return vector.end(); } + auto end() const { return vector.end(); } /// @returns an iterator to the beginning of the reversed vector - ConstReverseIterator rbegin() const { return vector.rbegin(); } + auto rbegin() const { return vector.rbegin(); } /// @returns an iterator to the end of the reversed vector - ConstReverseIterator rend() const { return vector.rend(); } + auto rend() const { return vector.rend(); } /// @returns a const reference to the internal vector - operator const std::vector&() const { return vector; } + operator const Vector&() const { return vector; } + + /// @returns the std::move()'d vector. + /// @note The UniqueVector must not be used after calling this method + VectorRef Release() { return std::move(vector); } + + /// Pre-allocates `count` elements in the vector and set + /// @param count the number of elements to pre-allocate + void Reserve(size_t count) { + vector.Reserve(count); + set.Reserve(count); + } /// Removes the last element from the vector /// @returns the popped element - T pop_back() { - auto el = std::move(vector.back()); - set.erase(el); - vector.pop_back(); - return el; + T Pop() { + set.Remove(vector.Back()); + return vector.Pop(); } private: - std::vector vector; - std::unordered_set set; + Vector vector; + Hashset set; }; } // namespace tint::utils diff --git a/src/tint/utils/unique_vector_test.cc b/src/tint/utils/unique_vector_test.cc index 7d586e99a2..9b015c2092 100644 --- a/src/tint/utils/unique_vector_test.cc +++ b/src/tint/utils/unique_vector_test.cc @@ -13,6 +13,9 @@ // limitations under the License. #include "src/tint/utils/unique_vector.h" + +#include + #include "src/tint/utils/reverse.h" #include "gtest/gtest.h" @@ -21,16 +24,16 @@ namespace tint::utils { namespace { TEST(UniqueVectorTest, Empty) { - UniqueVector unique_vec; - EXPECT_EQ(unique_vec.size(), 0u); - EXPECT_EQ(unique_vec.empty(), true); + UniqueVector unique_vec; + EXPECT_EQ(unique_vec.Length(), 0u); + EXPECT_EQ(unique_vec.IsEmpty(), true); EXPECT_EQ(unique_vec.begin(), unique_vec.end()); } TEST(UniqueVectorTest, MoveConstructor) { - UniqueVector unique_vec(std::vector{0, 3, 2, 1, 2}); - EXPECT_EQ(unique_vec.size(), 4u); - EXPECT_EQ(unique_vec.empty(), false); + UniqueVector unique_vec(std::vector{0, 3, 2, 1, 2}); + EXPECT_EQ(unique_vec.Length(), 4u); + EXPECT_EQ(unique_vec.IsEmpty(), false); EXPECT_EQ(unique_vec[0], 0); EXPECT_EQ(unique_vec[1], 3); EXPECT_EQ(unique_vec[2], 2); @@ -38,12 +41,12 @@ TEST(UniqueVectorTest, MoveConstructor) { } TEST(UniqueVectorTest, AddUnique) { - UniqueVector unique_vec; - unique_vec.add(0); - unique_vec.add(1); - unique_vec.add(2); - EXPECT_EQ(unique_vec.size(), 3u); - EXPECT_EQ(unique_vec.empty(), false); + UniqueVector unique_vec; + unique_vec.Add(0); + unique_vec.Add(1); + unique_vec.Add(2); + EXPECT_EQ(unique_vec.Length(), 3u); + EXPECT_EQ(unique_vec.IsEmpty(), false); int i = 0; for (auto n : unique_vec) { EXPECT_EQ(n, i); @@ -59,15 +62,15 @@ TEST(UniqueVectorTest, AddUnique) { } TEST(UniqueVectorTest, AddDuplicates) { - UniqueVector unique_vec; - unique_vec.add(0); - unique_vec.add(0); - unique_vec.add(0); - unique_vec.add(1); - unique_vec.add(1); - unique_vec.add(2); - EXPECT_EQ(unique_vec.size(), 3u); - EXPECT_EQ(unique_vec.empty(), false); + UniqueVector unique_vec; + unique_vec.Add(0); + unique_vec.Add(0); + unique_vec.Add(0); + unique_vec.Add(1); + unique_vec.Add(1); + unique_vec.Add(2); + EXPECT_EQ(unique_vec.Length(), 3u); + EXPECT_EQ(unique_vec.IsEmpty(), false); int i = 0; for (auto n : unique_vec) { EXPECT_EQ(n, i); @@ -83,17 +86,17 @@ TEST(UniqueVectorTest, AddDuplicates) { } TEST(UniqueVectorTest, AsVector) { - UniqueVector unique_vec; - unique_vec.add(0); - unique_vec.add(0); - unique_vec.add(0); - unique_vec.add(1); - unique_vec.add(1); - unique_vec.add(2); + UniqueVector unique_vec; + unique_vec.Add(0); + unique_vec.Add(0); + unique_vec.Add(0); + unique_vec.Add(1); + unique_vec.Add(1); + unique_vec.Add(2); - const std::vector& vec = unique_vec; - EXPECT_EQ(vec.size(), 3u); - EXPECT_EQ(unique_vec.empty(), false); + const utils::Vector& vec = unique_vec; + EXPECT_EQ(vec.Length(), 3u); + EXPECT_EQ(unique_vec.IsEmpty(), false); int i = 0; for (auto n : vec) { EXPECT_EQ(n, i); @@ -106,37 +109,46 @@ TEST(UniqueVectorTest, AsVector) { } TEST(UniqueVectorTest, PopBack) { - UniqueVector unique_vec; - unique_vec.add(0); - unique_vec.add(2); - unique_vec.add(1); + UniqueVector unique_vec; + unique_vec.Add(0); + unique_vec.Add(2); + unique_vec.Add(1); - EXPECT_EQ(unique_vec.pop_back(), 1); - EXPECT_EQ(unique_vec.size(), 2u); - EXPECT_EQ(unique_vec.empty(), false); + EXPECT_EQ(unique_vec.Pop(), 1); + EXPECT_EQ(unique_vec.Length(), 2u); + EXPECT_EQ(unique_vec.IsEmpty(), false); EXPECT_EQ(unique_vec[0], 0); EXPECT_EQ(unique_vec[1], 2); - EXPECT_EQ(unique_vec.pop_back(), 2); - EXPECT_EQ(unique_vec.size(), 1u); - EXPECT_EQ(unique_vec.empty(), false); + EXPECT_EQ(unique_vec.Pop(), 2); + EXPECT_EQ(unique_vec.Length(), 1u); + EXPECT_EQ(unique_vec.IsEmpty(), false); EXPECT_EQ(unique_vec[0], 0); - unique_vec.add(1); + unique_vec.Add(1); - EXPECT_EQ(unique_vec.size(), 2u); - EXPECT_EQ(unique_vec.empty(), false); + EXPECT_EQ(unique_vec.Length(), 2u); + EXPECT_EQ(unique_vec.IsEmpty(), false); EXPECT_EQ(unique_vec[0], 0); EXPECT_EQ(unique_vec[1], 1); - EXPECT_EQ(unique_vec.pop_back(), 1); - EXPECT_EQ(unique_vec.size(), 1u); - EXPECT_EQ(unique_vec.empty(), false); + EXPECT_EQ(unique_vec.Pop(), 1); + EXPECT_EQ(unique_vec.Length(), 1u); + EXPECT_EQ(unique_vec.IsEmpty(), false); EXPECT_EQ(unique_vec[0], 0); - EXPECT_EQ(unique_vec.pop_back(), 0); - EXPECT_EQ(unique_vec.size(), 0u); - EXPECT_EQ(unique_vec.empty(), true); + EXPECT_EQ(unique_vec.Pop(), 0); + EXPECT_EQ(unique_vec.Length(), 0u); + EXPECT_EQ(unique_vec.IsEmpty(), true); +} + +TEST(UniqueVectorTest, Data) { + UniqueVector unique_vec; + EXPECT_EQ(unique_vec.Data(), nullptr); + + unique_vec.Add(42); + EXPECT_EQ(unique_vec.Data(), &unique_vec[0]); + EXPECT_EQ(*unique_vec.Data(), 42); } } // namespace diff --git a/src/tint/utils/vector.h b/src/tint/utils/vector.h new file mode 100644 index 0000000000..b718840a5c --- /dev/null +++ b/src/tint/utils/vector.h @@ -0,0 +1,826 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_UTILS_VECTOR_H_ +#define SRC_TINT_UTILS_VECTOR_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "src/tint/castable.h" +#include "src/tint/traits.h" +#include "src/tint/utils/bitcast.h" + +namespace tint::utils { + +/// Forward declarations +template +class VectorRef; +template +class VectorRef; + +} // namespace tint::utils + +namespace tint::utils { + +/// A type used to indicate an empty array. +struct EmptyType {}; + +/// An instance of the EmptyType. +static constexpr EmptyType Empty; + +/// A slice represents a contigious array of elements of type T. +template +struct Slice { + /// The pointer to the first element in the slice + T* data = nullptr; + + /// The total number of elements in the slice + size_t len = 0; + + /// The total capacity of the backing store for the slice + size_t cap = 0; + + /// Index operator + /// @param i the element index. Must be less than `len`. + /// @returns a reference to the i'th element. + T& operator[](size_t i) { return data[i]; } + + /// Index operator + /// @param i the element index. Must be less than `len`. + /// @returns a reference to the i'th element. + const T& operator[](size_t i) const { return data[i]; } + + /// @returns a reference to the first element in the vector + T& Front() { return data[0]; } + + /// @returns a reference to the first element in the vector + const T& Front() const { return data[0]; } + + /// @returns a reference to the last element in the vector + T& Back() { return data[len - 1]; } + + /// @returns a reference to the last element in the vector + const T& Back() const { return data[len - 1]; } + + /// @returns a pointer to the first element in the vector + T* begin() { return data; } + + /// @returns a pointer to the first element in the vector + const T* begin() const { return data; } + + /// @returns a pointer to one past the last element in the vector + T* end() { return data + len; } + + /// @returns a pointer to one past the last element in the vector + const T* end() const { return data + len; } + + /// @returns a reverse iterator starting with the last element in the vector + auto rbegin() { return std::reverse_iterator(end()); } + + /// @returns a reverse iterator starting with the last element in the vector + auto rbegin() const { return std::reverse_iterator(end()); } + + /// @returns the end for a reverse iterator + auto rend() { return std::reverse_iterator(begin()); } + + /// @returns the end for a reverse iterator + auto rend() const { return std::reverse_iterator(begin()); } +}; + +namespace detail { + +/// Private implementation of tint::utils::CanReinterpretSlice. +/// Specialized for the case of TO equal to FROM, which is the common case, and avoids inspection of +/// the base classes, which can be troublesome if the slice is of an incomplete type. +template +struct CanReinterpretSlice { + /// True if a slice of FROM can be reinterpreted as a slice of TO + static constexpr bool value = + // Both TO and FROM are pointers + (std::is_pointer_v && std::is_pointer_v)&& // + // const can only be applied, not removed + (std::is_const_v> || + !std::is_const_v>)&& // + // TO and FROM are both Castable + IsCastable, std::remove_pointer_t> && // + // FROM is of, or derives from TO + traits::IsTypeOrDerived, std::remove_pointer_t>; +}; + +/// Specialization of 'CanReinterpretSlice' for when TO and FROM are equal types. +template +struct CanReinterpretSlice { + /// Always `true` as TO and FROM are the same type. + static constexpr bool value = true; +}; + +} // namespace detail + +/// Evaluates whether a `vector` and be reinterpreted as a `vector`. +/// Vectors can be reinterpreted if both `FROM` and `TO` are pointers to a type that derives from +/// CastableBase, and the pointee type of `TO` is of the same type as, or is an ancestor of the +/// pointee type of `FROM`. Vectors of non-`const` Castable pointers can be converted to a vector of +/// `const` Castable pointers. +template +static constexpr bool CanReinterpretSlice = detail::CanReinterpretSlice::value; + +/// Reinterprets `const Slice*` as `const Slice*` +/// @param slice a pointer to the slice to reinterpret +/// @returns the reinterpreted slice +/// @see CanReinterpretSlice +template +const Slice* ReinterpretSlice(const Slice* slice) { + static_assert(CanReinterpretSlice); + return Bitcast*>(slice); +} + +/// Reinterprets `Slice*` as `Slice*` +/// @param slice a pointer to the slice to reinterpret +/// @returns the reinterpreted slice +/// @see CanReinterpretSlice +template +Slice* ReinterpretSlice(Slice* slice) { + static_assert(CanReinterpretSlice); + return Bitcast*>(slice); +} + +/// Vector is a small-object-optimized, dynamically-sized vector of contigious elements of type T. +/// +/// Vector will fit `N` elements internally before spilling to heap allocations. If `N` is greater +/// than zero, the internal elements are stored in a 'small array' held internally by the Vector. +/// +/// Vectors can be copied or moved. +/// +/// Copying a vector will either copy to the 'small array' if the number of elements is equal to or +/// less than N, otherwise elements will be copied into a new heap allocation. +/// +/// Moving a vector will reassign ownership of the heap-allocation memory, if the source vector +/// holds its elements in a heap allocation, otherwise a copy will be made as described above. +/// +/// Vector is optimized for CPU performance over memory efficiency. For example: +/// * Moving a vector that stores its elements in a heap allocation to another vector will simply +/// assign the heap allocation, even if the target vector can hold the elements in its 'small +/// array'. This reduces memory copying, but may incur additional memory usage. +/// * Resizing, or popping elements from a vector that has spilled to a heap allocation does not +/// revert back to using the 'small array'. Again, this is to reduce memory copying. +template +class Vector { + public: + /// Type of `T`. + using value_type = T; + /// Value of `N` + static constexpr size_t static_length = N; + + /// Constructor + Vector() = default; + + /// Constructor + Vector(EmptyType) {} // NOLINT(runtime/explicit) + + /// Constructor + /// @param elements the elements to place into the vector + Vector(std::initializer_list elements) { + Reserve(elements.size()); + for (auto& el : elements) { + new (&impl_.slice.data[impl_.slice.len++]) T{el}; + } + } + + /// Copy constructor + /// @param other the vector to copy + Vector(const Vector& other) { Copy(other.impl_.slice); } + + /// Move constructor + /// @param other the vector to move + Vector(Vector&& other) { MoveOrCopy(VectorRef(std::move(other))); } + + /// Copy constructor (differing N length) + /// @param other the vector to copy + template + Vector(const Vector& other) { + Copy(other.impl_.slice); + } + + /// Move constructor (differing N length) + /// @param other the vector to move + template + Vector(Vector&& other) { + MoveOrCopy(VectorRef(std::move(other))); + } + + /// Copy constructor with covariance / const conversion + /// @param other the vector to copy + /// @see CanReinterpretSlice for rules about conversion + template >> + Vector(const Vector& other) { // NOLINT(runtime/explicit) + Copy(*ReinterpretSlice(&other.impl_.slice)); + } + + /// Move constructor with covariance / const conversion + /// @param other the vector to move + /// @see CanReinterpretSlice for rules about conversion + template >> + Vector(Vector&& other) { // NOLINT(runtime/explicit) + MoveOrCopy(VectorRef(std::move(other))); + } + + /// Move constructor from a mutable vector reference + /// @param other the vector reference to move + explicit Vector(VectorRef&& other) { MoveOrCopy(std::move(other)); } + + /// Copy constructor from an immutable vector reference + /// @param other the vector reference to copy + explicit Vector(const VectorRef& other) { Copy(other.slice_); } + + /// Destructor + ~Vector() { ClearAndFree(); } + + /// Assignment operator + /// @param other the vector to copy + /// @returns this vector so calls can be chained + Vector& operator=(const Vector& other) { + if (&other != this) { + Copy(other.impl_.slice); + } + return *this; + } + + /// Move operator + /// @param other the vector to move + /// @returns this vector so calls can be chained + Vector& operator=(Vector&& other) { + if (&other != this) { + MoveOrCopy(VectorRef(std::move(other))); + } + return *this; + } + + /// Assignment operator (differing N length) + /// @param other the vector to copy + /// @returns this vector so calls can be chained + template + Vector& operator=(const Vector& other) { + Copy(other.impl_.slice); + return *this; + } + + /// Move operator (differing N length) + /// @param other the vector to copy + /// @returns this vector so calls can be chained + template + Vector& operator=(Vector&& other) { + MoveOrCopy(VectorRef(std::move(other))); + return *this; + } + + /// Assignment operator (differing N length) + /// @param other the vector reference to copy + /// @returns this vector so calls can be chained + Vector& operator=(const VectorRef& other) { + if (&other.slice_ != &impl_.slice) { + Copy(other.slice_); + } + return *this; + } + + /// Move operator (differing N length) + /// @param other the vector reference to copy + /// @returns this vector so calls can be chained + Vector& operator=(VectorRef&& other) { + if (&other.slice_ != &impl_.slice) { + MoveOrCopy(std::move(other)); + } + return *this; + } + + /// Index operator + /// @param i the element index. Must be less than `len`. + /// @returns a reference to the i'th element. + T& operator[](size_t i) { return impl_.slice[i]; } + + /// Index operator + /// @param i the element index. Must be less than `len`. + /// @returns a reference to the i'th element. + const T& operator[](size_t i) const { return impl_.slice[i]; } + + /// @return the number of elements in the vector + size_t Length() const { return impl_.slice.len; } + + /// @return the number of elements that the vector could hold before a heap allocation needs to + /// be made + size_t Capacity() const { return impl_.slice.cap; } + + /// Reserves memory to hold at least `new_cap` elements + /// @param new_cap the new vector capacity + void Reserve(size_t new_cap) { + if (new_cap > impl_.slice.cap) { + auto* old_data = impl_.slice.data; + impl_.Allocate(new_cap); + for (size_t i = 0; i < impl_.slice.len; i++) { + new (&impl_.slice.data[i]) T(std::move(old_data[i])); + old_data[i].~T(); + } + impl_.Free(old_data); + } + } + + /// Resizes the vector to the given length, expanding capacity if necessary. + /// New elements are zero-initialized + /// @param new_len the new vector length + void Resize(size_t new_len) { + Reserve(new_len); + for (size_t i = impl_.slice.len; i > new_len; i--) { // Shrink + impl_.slice.data[i - 1].~T(); + } + for (size_t i = impl_.slice.len; i < new_len; i++) { // Grow + new (&impl_.slice.data[i]) T{}; + } + impl_.slice.len = new_len; + } + + /// Resizes the vector to the given length, expanding capacity if necessary. + /// @param new_len the new vector length + /// @param value the value to copy into the new elements + void Resize(size_t new_len, const T& value) { + Reserve(new_len); + for (size_t i = impl_.slice.len; i > new_len; i--) { // Shrink + impl_.slice.data[i - 1].~T(); + } + for (size_t i = impl_.slice.len; i < new_len; i++) { // Grow + new (&impl_.slice.data[i]) T{value}; + } + impl_.slice.len = new_len; + } + + /// Copies all the elements from `other` to this vector, replacing the content of this vector. + /// @param other the + template + void Copy(const Vector& other) { + Copy(other.impl_.slice); + } + + /// Clears all elements from the vector, keeping the capacity the same. + void Clear() { + for (size_t i = 0; i < impl_.slice.len; i++) { + impl_.slice.data[i].~T(); + } + impl_.slice.len = 0; + } + + /// Appends a new element to the vector. + /// @param el the element to copy to the vector. + void Push(const T& el) { + if (impl_.slice.len >= impl_.slice.cap) { + Grow(); + } + new (&impl_.slice.data[impl_.slice.len++]) T(el); + } + + /// Appends a new element to the vector. + /// @param el the element to move to the vector. + void Push(T&& el) { + if (impl_.slice.len >= impl_.slice.cap) { + Grow(); + } + new (&impl_.slice.data[impl_.slice.len++]) T(std::move(el)); + } + + /// Appends a new element to the vector. + /// @param args the arguments to pass to the element constructor. + template + void Emplace(ARGS&&... args) { + if (impl_.slice.len >= impl_.slice.cap) { + Grow(); + } + new (&impl_.slice.data[impl_.slice.len++]) T{std::forward(args)...}; + } + + /// Removes and returns the last element from the vector. + /// @returns the popped element + T Pop() { + auto& el = impl_.slice.data[--impl_.slice.len]; + auto val = std::move(el); + el.~T(); + return val; + } + + /// @returns true if the vector is empty. + bool IsEmpty() const { return impl_.slice.len == 0; } + + /// @returns a reference to the first element in the vector + T& Front() { return impl_.slice.Front(); } + + /// @returns a reference to the first element in the vector + const T& Front() const { return impl_.slice.Front(); } + + /// @returns a reference to the last element in the vector + T& Back() { return impl_.slice.Back(); } + + /// @returns a reference to the last element in the vector + const T& Back() const { return impl_.slice.Back(); } + + /// @returns a pointer to the first element in the vector + T* begin() { return impl_.slice.begin(); } + + /// @returns a pointer to the first element in the vector + const T* begin() const { return impl_.slice.begin(); } + + /// @returns a pointer to one past the last element in the vector + T* end() { return impl_.slice.end(); } + + /// @returns a pointer to one past the last element in the vector + const T* end() const { return impl_.slice.end(); } + + /// @returns a reverse iterator starting with the last element in the vector + auto rbegin() { return impl_.slice.rbegin(); } + + /// @returns a reverse iterator starting with the last element in the vector + auto rbegin() const { return impl_.slice.rbegin(); } + + /// @returns the end for a reverse iterator + auto rend() { return impl_.slice.rend(); } + + /// @returns the end for a reverse iterator + auto rend() const { return impl_.slice.rend(); } + + /// Equality operator + /// @param other the other vector + /// @returns true if this vector is the same length as `other`, and all elements are equal. + bool operator==(const Vector& other) const { + const size_t len = Length(); + if (len == other.Length()) { + for (size_t i = 0; i < len; i++) { + if ((*this)[i] != other[i]) { + return false; + } + } + } + return true; + } + + private: + /// Friend class (differing specializations of this class) + template + friend class Vector; + + /// Friend class + template + friend class VectorRef; + + /// Friend class + template + friend class VectorRef; + + /// The slice type used by this vector + using Slice = utils::Slice; + + template + void AppendVariadic(Ts&&... args) { + ((new (&impl_.slice.data[impl_.slice.len++]) T(std::forward(args))), ...); + } + + /// Expands the capacity of the vector + void Grow() { Reserve(std::max(impl_.slice.cap, static_cast(1)) * 2); } + + /// Moves 'other' to this vector, if possible, otherwise performs a copy. + void MoveOrCopy(VectorRef&& other) { + if (other.can_move_) { + ClearAndFree(); + impl_.slice = other.slice_; + other.slice_ = {}; + } else { + Copy(other.slice_); + } + } + + /// Copies all the elements from `other` to this vector, replacing the content of this vector. + /// @param other the + void Copy(const Slice& other) { + if (impl_.slice.cap < other.len) { + ClearAndFree(); + impl_.Allocate(other.len); + } else { + Clear(); + } + + impl_.slice.len = other.len; + for (size_t i = 0; i < impl_.slice.len; i++) { + new (&impl_.slice.data[i]) T{other.data[i]}; + } + } + + /// Clears the vector, then frees the slice data. + void ClearAndFree() { + Clear(); + impl_.Free(impl_.slice.data); + } + + /// True if this vector uses a small array for small object optimization. + constexpr static bool HasSmallArray = N > 0; + + /// A structure that has the same size and alignment as T. + /// Replacement for std::aligned_storage as this is broken on earlier versions of MSVC. + struct alignas(alignof(T)) TStorage { + /// @returns the storage reinterpreted as a T* + T* Get() { return Bitcast(&data[0]); } + /// @returns the storage reinterpreted as a T* + const T* Get() const { return Bitcast(&data[0]); } + /// Byte array of length sizeof(T) + uint8_t data[sizeof(T)]; + }; + + /// The internal structure for the vector with a small array. + struct ImplWithSmallArray { + std::array small_arr; + Slice slice = {small_arr[0].Get(), 0, N}; + + /// Allocates a new vector of `T` either from #small_arr, or from the heap, then assigns the + /// pointer it to #slice.data, and updates #slice.cap. + void Allocate(size_t new_cap) { + if (new_cap < N) { + slice.data = small_arr[0].Get(); + slice.cap = N; + } else { + slice.data = Bitcast(new TStorage[new_cap]); + slice.cap = new_cap; + } + } + + /// Frees `data`, if not nullptr and isn't a pointer to #small_arr + void Free(T* data) const { + if (data && data != small_arr[0].Get()) { + delete[] Bitcast(data); + } + } + + /// Indicates whether the slice structure can be std::move()d. + /// @returns true if #slice.data does not point to #small_arr + bool CanMove() const { return slice.data != small_arr[0].Get(); } + }; + + /// The internal structure for the vector without a small array. + struct ImplWithoutSmallArray { + Slice slice = {nullptr, 0, 0}; + + /// Allocates a new vector of `T` and assigns it to #slice.data, and updates #slice.cap. + void Allocate(size_t new_cap) { + slice.data = Bitcast(new TStorage[new_cap]); + slice.cap = new_cap; + } + + /// Frees `data`, if not nullptr. + void Free(T* data) const { + if (data) { + delete[] Bitcast(data); + } + } + + /// Indicates whether the slice structure can be std::move()d. + /// @returns true + bool CanMove() const { return true; } + }; + + /// Either a ImplWithSmallArray or ImplWithoutSmallArray based on N. + std::conditional_t impl_; +}; + +namespace detail { + +/// Helper for determining the Vector element type (`T`) from the vector's constuctor arguments +/// @tparam IS_CASTABLE true if the types of `Ts` derive from CastableBase +/// @tparam Ts the vector constructor argument types to infer the vector element type from. +template +struct VectorCommonType; + +/// VectorCommonType specialization for non-castable types. +template +struct VectorCommonType { + /// The common T type to use for the vector + using type = std::common_type_t; +}; + +/// VectorCommonType specialization for castable types. +template +struct VectorCommonType { + /// The common Castable type (excluding pointer) + using common_ty = CastableCommonBase...>; + /// The common T type to use for the vector + using type = std::conditional_t<(std::is_const_v> || ...), + const common_ty*, + common_ty*>; +}; + +} // namespace detail + +/// Helper for determining the Vector element type (`T`) from the vector's constuctor arguments +template +using VectorCommonType = + typename detail::VectorCommonType...>, Ts...>::type; + +/// Deduction guide for Vector +template +Vector(Ts...) -> Vector, sizeof...(Ts)>; + +/// VectorRef is a weak reference to a Vector, used to pass vectors as parameters, avoiding copies +/// between the caller and the callee. VectorRef can accept a Vector of any 'N' value, decoupling +/// the caller's vector internal size from the callee's vector size. A VectorRef tracks the usage of +/// moves either side of the call. If at the call site, a Vector argument is moved to a VectorRef +/// parameter, and within the callee, the VectorRef parameter is moved to a Vector, then the Vector +/// heap allocation will be moved. For example: +/// +/// ``` +/// void func_a() { +/// Vector vec; +/// // logic to populate 'vec'. +/// func_b(std::move(vec)); // Constructs a VectorRef tracking the move here. +/// } +/// +/// void func_b(VectorRef vec_ref) { +/// // A move was made when calling func_b, so the vector can be moved instead of copied. +/// Vector vec(std::move(vec_ref)); +/// } +/// ``` +template +class VectorRef { + /// The slice type used by this vector reference + using Slice = utils::Slice; + + /// @returns an empty slice. + static Slice& EmptySlice() { + static Slice empty; + return empty; + } + + public: + /// Constructor - empty reference + VectorRef() : slice_(EmptySlice()) {} + + /// Constructor + VectorRef(EmptyType) : slice_(EmptySlice()) {} // NOLINT(runtime/explicit) + + /// Constructor from a Vector + /// @param vector the vector to create a reference of + template + VectorRef(Vector& vector) // NOLINT(runtime/explicit) + : slice_(vector.impl_.slice) {} + + /// Constructor from a const Vector + /// @param vector the vector to create a reference of + template + VectorRef(const Vector& vector) // NOLINT(runtime/explicit) + : slice_(const_cast(vector.impl_.slice)) {} + + /// Constructor from a moved Vector + /// @param vector the vector being moved + template + VectorRef(Vector&& vector) // NOLINT(runtime/explicit) + : slice_(vector.impl_.slice), can_move_(vector.impl_.CanMove()) {} + + /// Copy constructor + /// @param other the vector reference + VectorRef(const VectorRef& other) : slice_(other.slice_) {} + + /// Move constructor + /// @param other the vector reference + VectorRef(VectorRef&& other) = default; + + /// Copy constructor with covariance / const conversion + /// @param other the other vector reference + template >> + VectorRef(const VectorRef& other) // NOLINT(runtime/explicit) + : slice_(*ReinterpretSlice(&other.slice_)) {} + + /// Move constructor with covariance / const conversion + /// @param other the vector reference + template >> + VectorRef(VectorRef&& other) // NOLINT(runtime/explicit) + : slice_(*ReinterpretSlice(&other.slice_)), can_move_(other.can_move_) {} + + /// Constructor from a Vector with covariance / const conversion + /// @param vector the vector to create a reference of + /// @see CanReinterpretSlice for rules about conversion + template >> + VectorRef(Vector& vector) // NOLINT(runtime/explicit) + : slice_(*ReinterpretSlice(&vector.impl_.slice)) {} + + /// Constructor from a moved Vector with covariance / const conversion + /// @param vector the vector to create a reference of + /// @see CanReinterpretSlice for rules about conversion + template >> + VectorRef(Vector&& vector) // NOLINT(runtime/explicit) + : slice_(*ReinterpretSlice(&vector.impl_.slice)), can_move_(vector.impl_.CanMove()) {} + + /// Index operator + /// @param i the element index. Must be less than `len`. + /// @returns a reference to the i'th element. + const T& operator[](size_t i) const { return slice_[i]; } + + /// @return the number of elements in the vector + size_t Length() const { return slice_.len; } + + /// @return the number of elements that the vector could hold before a heap allocation needs to + /// be made + size_t Capacity() const { return slice_.cap; } + + /// @returns true if the vector is empty. + bool IsEmpty() const { return slice_.len == 0; } + + /// @returns a reference to the first element in the vector + T& Front() { return slice_.Front(); } + + /// @returns a reference to the first element in the vector + const T& Front() const { return slice_.Front(); } + + /// @returns a reference to the last element in the vector + T& Back() { return slice_.Back(); } + + /// @returns a reference to the last element in the vector + const T& Back() const { return slice_.Back(); } + + /// @returns a pointer to the first element in the vector + T* begin() { return slice_.begin(); } + + /// @returns a pointer to the first element in the vector + const T* begin() const { return slice_.begin(); } + + /// @returns a pointer to one past the last element in the vector + T* end() { return slice_.end(); } + + /// @returns a pointer to one past the last element in the vector + const T* end() const { return slice_.end(); } + + /// @returns a reverse iterator starting with the last element in the vector + auto rbegin() { return slice_.rbegin(); } + + /// @returns a reverse iterator starting with the last element in the vector + auto rbegin() const { return slice_.rbegin(); } + + /// @returns the end for a reverse iterator + auto rend() { return slice_.rend(); } + + /// @returns the end for a reverse iterator + auto rend() const { return slice_.rend(); } + + private: + /// Friend class + template + friend class Vector; + + /// Friend class + template + friend class VectorRef; + + /// Friend class + template + friend class VectorRef; + + /// The slice of the vector being referenced. + Slice& slice_; + /// Whether the slice data is passed by r-value reference, and can be moved. + bool can_move_ = false; +}; + +/// Helper for converting a Vector to a std::vector. +/// @note This helper exists to help code migration. Avoid if possible. +template +std::vector ToStdVector(const Vector& vector) { + std::vector out; + out.reserve(vector.Length()); + for (auto& el : vector) { + out.emplace_back(el); + } + return out; +} + +/// Helper for converting a std::vector to a Vector. +/// @note This helper exists to help code migration. Avoid if possible. +template +Vector ToVector(const std::vector& vector) { + Vector out; + out.Reserve(vector.size()); + for (auto& el : vector) { + out.Push(el); + } + return out; +} + +} // namespace tint::utils + +#endif // SRC_TINT_UTILS_VECTOR_H_ diff --git a/src/tint/utils/vector_test.cc b/src/tint/utils/vector_test.cc new file mode 100644 index 0000000000..b4e9fb52f6 --- /dev/null +++ b/src/tint/utils/vector_test.cc @@ -0,0 +1,2069 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/utils/vector.h" + +#include +#include + +#include "gtest/gtest.h" + +#include "src/tint/utils/bitcast.h" + +namespace tint::utils { +namespace { + +class C0 : public Castable {}; +class C1 : public Castable {}; +class C2a : public Castable {}; +class C2b : public Castable {}; + +/// @returns true if the address of el is within the memory of the vector vec. +template +bool IsInternal(Vector& vec, E& el) { + auto ptr = Bitcast(&el); + auto base = Bitcast(&vec); + return ptr >= base && ptr < base + sizeof(vec); +} + +/// @returns true if all elements of the vector `vec` are held within the memory of `vec`. +template +bool AllInternallyHeld(Vector& vec) { + for (auto& el : vec) { + if (!IsInternal(vec, el)) { + return false; + } + } + return true; +} + +/// @returns true if all elements of the vector `vec` are held outside the memory of `vec`. +template +bool AllExternallyHeld(Vector& vec) { + for (auto& el : vec) { + if (IsInternal(vec, el)) { + return false; + } + } + return true; +} + +//////////////////////////////////////////////////////////////////////////////// +// Static asserts +//////////////////////////////////////////////////////////////////////////////// +static_assert(std::is_same_v, int>); +static_assert(std::is_same_v, int>); +static_assert(std::is_same_v, float>); + +static_assert(std::is_same_v, C0*>); +static_assert(std::is_same_v, const C0*>); + +static_assert(std::is_same_v, C0*>); +static_assert(std::is_same_v, const C0*>); +static_assert(std::is_same_v, const C0*>); +static_assert(std::is_same_v, const C0*>); + +static_assert(std::is_same_v, C1*>); +static_assert(std::is_same_v, const C1*>); +static_assert(std::is_same_v, const C1*>); +static_assert(std::is_same_v, const C1*>); + +static_assert(CanReinterpretSlice, "apply const"); +static_assert(!CanReinterpretSlice, "remove const"); +static_assert(CanReinterpretSlice, "up cast"); +static_assert(CanReinterpretSlice, "up cast"); +static_assert(CanReinterpretSlice, "up cast, apply const"); +static_assert(!CanReinterpretSlice, "up cast, remove const"); +static_assert(!CanReinterpretSlice, "down cast"); +static_assert(!CanReinterpretSlice, "down cast"); +static_assert(!CanReinterpretSlice, "down cast, apply const"); +static_assert(!CanReinterpretSlice, "down cast, remove const"); +static_assert(!CanReinterpretSlice, "down cast, apply const"); +static_assert(!CanReinterpretSlice, "down cast, remove const"); +static_assert(!CanReinterpretSlice, "sideways cast"); +static_assert(!CanReinterpretSlice, "sideways cast"); +static_assert(!CanReinterpretSlice, "sideways cast, apply const"); +static_assert(!CanReinterpretSlice, "sideways cast, remove const"); + +//////////////////////////////////////////////////////////////////////////////// +// TintVectorTest +//////////////////////////////////////////////////////////////////////////////// +TEST(TintVectorTest, SmallArray_Empty) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); +} + +TEST(TintVectorTest, NoSmallArray) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 0u); +} + +TEST(TintVectorTest, Empty_SmallArray_Empty) { + Vector vec(Empty); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); +} + +TEST(TintVectorTest, Empty_NoSmallArray) { + Vector vec(Empty); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 0u); +} + +TEST(TintVectorTest, InitializerList_NoSpill) { + Vector vec{"one", "two"}; + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "one"); + EXPECT_EQ(vec[1], "two"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InitializerList_WithSpill) { + Vector vec{"one", "two", "three"}; + EXPECT_EQ(vec.Length(), 3u); + EXPECT_EQ(vec.Capacity(), 3u); + EXPECT_EQ(vec[0], "one"); + EXPECT_EQ(vec[1], "two"); + EXPECT_EQ(vec[2], "three"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, InitializerList_NoSmallArray) { + Vector vec{"one", "two"}; + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "one"); + EXPECT_EQ(vec[1], "two"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, Push_NoSmallArray) { + Vector vec; + vec.Push("one"); + vec.Push("two"); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "one"); + EXPECT_EQ(vec[1], "two"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_1CString) { + auto vec = Vector{"one"}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 1u); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 1u); + EXPECT_STREQ(vec[0], "one"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_2CStrings) { + auto vec = Vector{"one", "two"}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_STREQ(vec[0], "one"); + EXPECT_STREQ(vec[1], "two"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_IntFloat) { + auto vec = Vector{1, 2.0f}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], 1.0f); + EXPECT_EQ(vec[1], 2.0f); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_IntDoubleIntDouble) { + auto vec = Vector{1, 2.0, 3, 4.0}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 4u); + EXPECT_EQ(vec.Length(), 4u); + EXPECT_EQ(vec.Capacity(), 4u); + EXPECT_EQ(vec[0], 1.0); + EXPECT_EQ(vec[1], 2.0); + EXPECT_EQ(vec[2], 3.0); + EXPECT_EQ(vec[3], 4.0); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_C0) { + C0 c0; + auto vec = Vector{&c0}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 1u); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 1u); + EXPECT_EQ(vec[0], &c0); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_ConstC0) { + const C0 c0; + auto vec = Vector{&c0}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 1u); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 1u); + EXPECT_EQ(vec[0], &c0); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_C0C1) { + C0 c0; + C1 c1; + auto vec = Vector{&c0, &c1}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], &c0); + EXPECT_EQ(vec[1], &c1); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_ConstC0C1) { + const C0 c0; + C1 c1; + auto vec = Vector{&c0, &c1}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], &c0); + EXPECT_EQ(vec[1], &c1); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_C0ConstC1) { + C0 c0; + const C1 c1; + auto vec = Vector{&c0, &c1}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], &c0); + EXPECT_EQ(vec[1], &c1); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_ConstC0ConstC1) { + const C0 c0; + const C1 c1; + auto vec = Vector{&c0, &c1}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], &c0); + EXPECT_EQ(vec[1], &c1); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_C2aC2b) { + C2a c2a; + C2b c2b; + auto vec = Vector{&c2a, &c2b}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], &c2a); + EXPECT_EQ(vec[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_ConstC2aC2b) { + const C2a c2a; + C2b c2b; + auto vec = Vector{&c2a, &c2b}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], &c2a); + EXPECT_EQ(vec[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_C2aConstC2b) { + C2a c2a; + const C2b c2b; + auto vec = Vector{&c2a, &c2b}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], &c2a); + EXPECT_EQ(vec[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, InferTN_ConstC2aConstC2b) { + const C2a c2a; + const C2b c2b; + auto vec = Vector{&c2a, &c2b}; + static_assert(std::is_same_v); + static_assert(decltype(vec)::static_length == 2u); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], &c2a); + EXPECT_EQ(vec[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, CopyVector_NoSpill_N2_to_N2) { + Vector vec_a{"hello", "world"}; + Vector vec_b(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyVector_WithSpill_N2_to_N2) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyVector_NoSpill_N2_to_N1) { + Vector vec_a{"hello", "world"}; + Vector vec_b(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyVector_WithSpill_N2_to_N1) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyVector_NoSpill_N2_to_N3) { + Vector vec_a{"hello", "world"}; + Vector vec_b(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyVector_WithSpill_N2_to_N3) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyVector_NoMoveUpcast_NoSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(vec_a); // No move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorTest, CopyVector_NoMoveUpcast_WithSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(vec_a); // No move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorTest, CopyVector_NoMoveAddConst_NoSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(vec_a); // No move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorTest, CopyVector_NoMoveAddConst_WithSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(vec_a); // No move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorTest, CopyVector_NoMoveUpcastAndAddConst_NoSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(vec_a); // No move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorTest, CopyVector_NoMoveUpcastAndAddConst_WithSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(vec_a); // No move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorTest, MoveVector_NoSpill_N2_to_N2) { + Vector vec_a{"hello", "world"}; + Vector vec_b(std::move(vec_a)); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveVector_WithSpill_N2_to_N2) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b(std::move(vec_a)); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveVector_NoSpill_N2_to_N1) { + Vector vec_a{"hello", "world"}; + Vector vec_b(std::move(vec_a)); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveVector_WithSpill_N2_to_N1) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b(std::move(vec_a)); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveVector_NoSpill_N2_to_N3) { + Vector vec_a{"hello", "world"}; + Vector vec_b(std::move(vec_a)); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveVector_WithSpill_N2_to_N3) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b(std::move(vec_a)); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveVector_Upcast_NoSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(std::move(vec_a)); // Move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorTest, MoveVector_Upcast_WithSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(std::move(vec_a)); // Move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorTest, MoveVector_AddConst_NoSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(std::move(vec_a)); // Move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorTest, MoveVector_AddConst_WithSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(std::move(vec_a)); // Move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorTest, MoveVector_UpcastAndAddConst_NoSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(std::move(vec_a)); // Move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorTest, MoveVector_UpcastAndAddConst_WithSpill) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + Vector vec_b(std::move(vec_a)); // Move + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorTest, CopyAssign_NoSpill_N2_to_N2) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b = vec_a; + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssign_WithSpill_N2_to_N2) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b = vec_a; + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssign_NoSpill_N2_to_N1) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b = vec_a; + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssign_WithSpill_N2_to_N1) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b = vec_a; + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssign_NoSpill_N2_to_N3) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b = vec_a; + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssign_WithSpill_N2_to_N3) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b = vec_a; + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssign_NoSpill_N2_to_N0) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b = vec_a; + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssign_WithSpill_N2_to_N0) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b = vec_a; + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssign_Self_NoSpill) { + Vector vec{"hello", "world"}; + auto* vec_ptr = &vec; // Used to avoid -Wself-assign-overloaded + vec = *vec_ptr; + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, CopyAssign_Self_WithSpill) { + Vector vec{"hello", "world"}; + auto* vec_ptr = &vec; // Used to avoid -Wself-assign-overloaded + vec = *vec_ptr; + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, MoveAssign_NoSpill_N2_to_N2) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b = std::move(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssign_WithSpill_N2_to_N2) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b = std::move(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssign_NoSpill_N2_to_N1) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b = std::move(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssign_SpillSpill_N2_to_N1) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b = std::move(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssign_NoSpill_N2_to_N3) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b = std::move(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssign_WithSpill_N2_to_N3) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b = std::move(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssign_NoSpill_N2_to_N0) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b = std::move(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssign_WithSpill_N2_to_N0) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b = std::move(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssign_Self_NoSpill) { + Vector vec{"hello", "world"}; + auto* vec_ptr = &vec; // Used to avoid -Wself-move + vec = std::move(*vec_ptr); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, MoveAssign_Self_WithSpill) { + Vector vec{"hello", "world"}; + auto* vec_ptr = &vec; // Used to avoid -Wself-move + vec = std::move(*vec_ptr); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, RepeatMoveAssign_NoSpill) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"Ciao", "mondo"}; + Vector vec_c{"Bonjour", "le", "monde"}; + Vector vec; + vec = std::move(vec_a); + vec = std::move(vec_b); + vec = std::move(vec_c); + EXPECT_EQ(vec.Length(), 3u); + EXPECT_EQ(vec.Capacity(), 3u); + EXPECT_EQ(vec[0], "Bonjour"); + EXPECT_EQ(vec[1], "le"); + EXPECT_EQ(vec[2], "monde"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, RepeatMoveAssign_WithSpill) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"Ciao", "mondo"}; + Vector vec_c{"bonjour", "le", "monde"}; + Vector vec; + vec = std::move(vec_a); + vec = std::move(vec_b); + vec = std::move(vec_c); + EXPECT_EQ(vec.Length(), 3u); + EXPECT_EQ(vec.Capacity(), 3u); + EXPECT_EQ(vec[0], "bonjour"); + EXPECT_EQ(vec[1], "le"); + EXPECT_EQ(vec[2], "monde"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, CopyAssignRef_NoSpill_N2_to_N2) { + Vector vec_a{"hello", "world"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = ref; + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssignRef_WithSpill_N2_to_N2) { + Vector vec_a{"hello", "world", "spill"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = ref; + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssignRef_NoSpill_N2_to_N1) { + Vector vec_a{"hello", "world"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = ref; + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssignRef_WithSpill_N2_to_N1) { + Vector vec_a{"hello", "world", "spill"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = ref; + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssignRef_NoSpill_N2_to_N3) { + Vector vec_a{"hello", "world"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = ref; + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssignRef_WithSpill_N2_to_N3) { + Vector vec_a{"hello", "world", "spill"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = ref; + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssignRef_NoSpill_N2_to_N0) { + Vector vec_a{"hello", "world"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = ref; + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssignRef_WithSpill_N2_to_N0) { + Vector vec_a{"hello", "world", "spill"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = ref; + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, CopyAssignRef_Self_NoSpill) { + Vector vec{"hello", "world"}; + VectorRef ref{std::move(vec)}; + vec = ref; + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, CopyAssignRef_Self_WithSpill) { + Vector vec{"hello", "world"}; + VectorRef ref{std::move(vec)}; + vec = ref; + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, MoveAssignRef_NoSpill_N2_to_N2) { + Vector vec_a{"hello", "world"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = std::move(ref); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssignRef_WithSpill_N2_to_N2) { + Vector vec_a{"hello", "world", "spill"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = std::move(ref); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssignRef_NoSpill_N2_to_N1) { + Vector vec_a{"hello", "world"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = std::move(ref); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssignRef_SpillSpill_N2_to_N1) { + Vector vec_a{"hello", "world", "spill"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = std::move(ref); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssignRef_NoSpill_N2_to_N3) { + Vector vec_a{"hello", "world"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = std::move(ref); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssignRef_WithSpill_N2_to_N3) { + Vector vec_a{"hello", "world", "spill"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = std::move(ref); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssignRef_NoSpill_N2_to_N0) { + Vector vec_a{"hello", "world"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = std::move(ref); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssignRef_WithSpill_N2_to_N0) { + Vector vec_a{"hello", "world", "spill"}; + VectorRef ref{std::move(vec_a)}; + Vector vec_b; + vec_b = std::move(ref); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, MoveAssignRef_Self_NoSpill) { + Vector vec{"hello", "world"}; + VectorRef ref{std::move(vec)}; + vec = std::move(ref); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, MoveAssignRef_Self_WithSpill) { + Vector vec{"hello", "world"}; + VectorRef ref{std::move(vec)}; + vec = std::move(ref); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, RepeatMoveAssignRef_NoSpill) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"Ciao", "mondo"}; + Vector vec_c{"Bonjour", "le", "monde"}; + VectorRef ref_a{std::move(vec_a)}; + VectorRef ref_b{std::move(vec_b)}; + VectorRef ref_c{std::move(vec_c)}; + Vector vec; + vec = std::move(ref_a); + vec = std::move(ref_b); + vec = std::move(ref_c); + EXPECT_EQ(vec.Length(), 3u); + EXPECT_EQ(vec.Capacity(), 3u); + EXPECT_EQ(vec[0], "Bonjour"); + EXPECT_EQ(vec[1], "le"); + EXPECT_EQ(vec[2], "monde"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, RepeatMoveAssignRef_WithSpill) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"Ciao", "mondo"}; + Vector vec_c{"bonjour", "le", "monde"}; + VectorRef ref_a{std::move(vec_a)}; + VectorRef ref_b{std::move(vec_b)}; + VectorRef ref_c{std::move(vec_c)}; + Vector vec; + vec = std::move(ref_a); + vec = std::move(ref_b); + vec = std::move(ref_c); + EXPECT_EQ(vec.Length(), 3u); + EXPECT_EQ(vec.Capacity(), 3u); + EXPECT_EQ(vec[0], "bonjour"); + EXPECT_EQ(vec[1], "le"); + EXPECT_EQ(vec[2], "monde"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, Index) { + Vector vec{"hello", "world"}; + static_assert(!std::is_const_v>); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); +} + +TEST(TintVectorTest, ConstIndex) { + const Vector vec{"hello", "world"}; + static_assert(std::is_const_v>); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "world"); +} + +TEST(TintVectorTest, Reserve_NoSpill) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); + vec.Reserve(1); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); + vec.Reserve(2); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); + vec.Push("hello"); + vec.Push("world"); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_TRUE(AllInternallyHeld(vec)); + vec.Reserve(1); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, Reserve_WithSpill) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 1u); + vec.Reserve(1); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 1u); + vec.Reserve(2); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); + vec.Push("hello"); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec.Push("world"); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec.Reserve(1); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, ResizeZero_NoSpill) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); + vec.Resize(1); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], ""); + EXPECT_TRUE(AllInternallyHeld(vec)); + vec[0] = "hello"; + vec.Resize(2); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], ""); + EXPECT_TRUE(AllInternallyHeld(vec)); + vec[1] = "world"; + vec.Resize(1); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_TRUE(AllInternallyHeld(vec)); + vec.Resize(2); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], ""); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, ResizeZero_WithSpill) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 1u); + vec.Resize(1); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 1u); + EXPECT_EQ(vec[0], ""); + EXPECT_TRUE(AllInternallyHeld(vec)); + vec[0] = "hello"; + vec.Resize(2); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], ""); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec[1] = "world"; + vec.Resize(1); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec.Resize(2); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], ""); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, ResizeValue_NoSpill) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); + vec.Resize(1, "meow"); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "meow"); + EXPECT_TRUE(AllInternallyHeld(vec)); + vec[0] = "hello"; + vec.Resize(2, "woof"); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "woof"); + EXPECT_TRUE(AllInternallyHeld(vec)); + vec[1] = "world"; + vec.Resize(1, "quack"); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_TRUE(AllInternallyHeld(vec)); + vec.Resize(2, "hiss"); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "hiss"); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, ResizeValue_WithSpill) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 1u); + vec.Resize(1, "meow"); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 1u); + EXPECT_EQ(vec[0], "meow"); + EXPECT_TRUE(AllInternallyHeld(vec)); + vec[0] = "hello"; + vec.Resize(2, "woof"); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "woof"); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec[1] = "world"; + vec.Resize(1, "quack"); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec.Resize(2, "hiss"); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], "hiss"); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, Reserve_NoSmallArray) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 0u); + vec.Reserve(1); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 1u); + vec.Reserve(2); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); + vec.Push("hello"); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec.Push("world"); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec.Reserve(1); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, Resize_NoSmallArray) { + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 0u); + vec.Resize(1); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 1u); + EXPECT_EQ(vec[0], ""); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec[0] = "hello"; + vec.Resize(2); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], ""); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec[1] = "world"; + vec.Resize(1); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_TRUE(AllExternallyHeld(vec)); + vec.Resize(2); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_EQ(vec.Capacity(), 2u); + EXPECT_EQ(vec[0], "hello"); + EXPECT_EQ(vec[1], ""); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, Copy_NoSpill_N2_to_N2_Empty) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_NoSpill_N2_to_N2_NonEmpty) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"hallo", "wereld"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_NoSpill_N2_to_N2_Spill) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"hallo", "wereld", "spill"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_WithSpill_N2_to_N2_Empty) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_WithSpill_N2_to_N2_NonEmpty) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b{"hallo", "wereld"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_WithSpill_N2_to_N2_Spill) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b{"hallo", "wereld", "morsen"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_NoSpill_N2_to_N1_Empty) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_NoSpill_N2_to_N1_NonEmpty) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"hallo"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_NoSpill_N2_to_N1_Spill) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"hallo", "morsen"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 2u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_WithSpill_N2_to_N1_Empty) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_WithSpill_N2_to_N1_NonEmpty) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b{"hallo"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_WithSpill_N2_to_N1_Spill) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b{"hallo", "wereld"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_NoSpill_N2_to_N3_Empty) { + Vector vec_a{"hello", "world"}; + Vector vec_b; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_NoSpill_N2_to_N3_NonEmpty) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"hallo", "fijne", "wereld"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_NoSpill_N2_to_N3_Spill) { + Vector vec_a{"hello", "world"}; + Vector vec_b{"hallo", "fijne", "wereld", "morsen"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 2u); + EXPECT_EQ(vec_b.Capacity(), 4u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_WithSpill_N2_to_N3_Empty) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_WithSpill_N2_to_N3_NonEmpty) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b{"hallo", "fijne", "wereld"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 3u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Copy_WithSpill_N2_to_N3_Spill) { + Vector vec_a{"hello", "world", "spill"}; + Vector vec_b{"hallo", "fijne", "wereld", "morsen"}; + vec_b.Copy(vec_a); + EXPECT_EQ(vec_b.Length(), 3u); + EXPECT_EQ(vec_b.Capacity(), 4u); + EXPECT_EQ(vec_b[0], "hello"); + EXPECT_EQ(vec_b[1], "world"); + EXPECT_EQ(vec_b[2], "spill"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); +} + +TEST(TintVectorTest, Clear_Empty) { + Vector vec; + vec.Clear(); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); +} + +TEST(TintVectorTest, Clear_NoSpill) { + Vector vec{"hello", "world"}; + vec.Clear(); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 2u); +} + +TEST(TintVectorTest, Clear_WithSpill) { + Vector vec{"hello", "world", "spill"}; + vec.Clear(); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_EQ(vec.Capacity(), 3u); +} + +TEST(TintVectorTest, PushPop_StringNoSpill) { + const std::string hello = "hello"; + const std::string world = "world"; + + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Push(hello); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Push(world); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), world); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), hello); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, PushPop_StringWithSpill) { + const std::string hello = "hello"; + const std::string world = "world"; + + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Push(hello); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Push(world); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_TRUE(AllExternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), world); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllExternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), hello); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, PushPop_StringMoveNoSpill) { + std::string hello = "hello"; + std::string world = "world"; + + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Push(std::move(hello)); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Push(std::move(world)); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), "world"); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), "hello"); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, PushPop_StringMoveWithSpill) { + std::string hello = "hello"; + std::string world = "world"; + + Vector vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Push(std::move(hello)); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Push(std::move(world)); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_TRUE(AllExternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), "world"); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllExternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), "hello"); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, EmplacePop_TupleVarArgNoSpill) { + Vector, 2> vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Emplace(1, 2.0, false); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Emplace(3, 4.0, true); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), std::make_tuple(3, 4.0, true)); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), std::make_tuple(1, 2.0, false)); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllInternallyHeld(vec)); +} + +TEST(TintVectorTest, EmplacePop_TupleVarArgWithSpill) { + Vector, 1> vec; + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Emplace(1, 2.0, false); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllInternallyHeld(vec)); + + vec.Emplace(3, 4.0, true); + EXPECT_EQ(vec.Length(), 2u); + EXPECT_TRUE(AllExternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), std::make_tuple(3, 4.0, true)); + EXPECT_EQ(vec.Length(), 1u); + EXPECT_TRUE(AllExternallyHeld(vec)); + + EXPECT_EQ(vec.Pop(), std::make_tuple(1, 2.0, false)); + EXPECT_EQ(vec.Length(), 0u); + EXPECT_TRUE(AllExternallyHeld(vec)); +} + +TEST(TintVectorTest, IsEmpty) { + Vector vec; + EXPECT_TRUE(vec.IsEmpty()); + vec.Push("one"); + EXPECT_FALSE(vec.IsEmpty()); + vec.Pop(); + EXPECT_TRUE(vec.IsEmpty()); +} + +TEST(TintVectorTest, FrontBack_NoSpill) { + Vector vec{"front", "mid", "back"}; + static_assert(!std::is_const_v>); + static_assert(!std::is_const_v>); + EXPECT_EQ(vec.Front(), "front"); + EXPECT_EQ(vec.Back(), "back"); +} + +TEST(TintVectorTest, FrontBack_WithSpill) { + Vector vec{"front", "mid", "back"}; + static_assert(!std::is_const_v>); + static_assert(!std::is_const_v>); + EXPECT_EQ(vec.Front(), "front"); + EXPECT_EQ(vec.Back(), "back"); +} + +TEST(TintVectorTest, ConstFrontBack_NoSpill) { + const Vector vec{"front", "mid", "back"}; + static_assert(std::is_const_v>); + static_assert(std::is_const_v>); + EXPECT_EQ(vec.Front(), "front"); + EXPECT_EQ(vec.Back(), "back"); +} + +TEST(TintVectorTest, ConstFrontBack_WithSpill) { + const Vector vec{"front", "mid", "back"}; + static_assert(std::is_const_v>); + static_assert(std::is_const_v>); + EXPECT_EQ(vec.Front(), "front"); + EXPECT_EQ(vec.Back(), "back"); +} + +TEST(TintVectorTest, BeginEnd_NoSpill) { + Vector vec{"front", "mid", "back"}; + static_assert(!std::is_const_v>); + static_assert(!std::is_const_v>); + EXPECT_EQ(vec.begin(), &vec[0]); + EXPECT_EQ(vec.end(), &vec[0] + 3); +} + +TEST(TintVectorTest, BeginEnd_WithSpill) { + Vector vec{"front", "mid", "back"}; + static_assert(!std::is_const_v>); + static_assert(!std::is_const_v>); + EXPECT_EQ(vec.begin(), &vec[0]); + EXPECT_EQ(vec.end(), &vec[0] + 3); +} + +TEST(TintVectorTest, ConstBeginEnd_NoSpill) { + const Vector vec{"front", "mid", "back"}; + static_assert(std::is_const_v>); + static_assert(std::is_const_v>); + EXPECT_EQ(vec.begin(), &vec[0]); + EXPECT_EQ(vec.end(), &vec[0] + 3); +} + +TEST(TintVectorTest, ConstBeginEnd_WithSpill) { + const Vector vec{"front", "mid", "back"}; + static_assert(std::is_const_v>); + static_assert(std::is_const_v>); + EXPECT_EQ(vec.begin(), &vec[0]); + EXPECT_EQ(vec.end(), &vec[0] + 3); +} + +//////////////////////////////////////////////////////////////////////////////// +// TintVectorRefTest +//////////////////////////////////////////////////////////////////////////////// +TEST(TintVectorRefTest, CopyVectorRef) { + Vector vec_a{"one", "two"}; + VectorRef vec_ref_a(std::move(vec_a)); + VectorRef vec_ref_b(vec_ref_a); // No move + Vector vec_b(std::move(vec_ref_b)); + EXPECT_EQ(vec_b[0], "one"); + EXPECT_EQ(vec_b[1], "two"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorRefTest, CopyVectorRef_Upcast) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref_a(std::move(vec_a)); + VectorRef vec_ref_b(vec_ref_a); // No-move. Up-cast + Vector vec_b(std::move(vec_ref_b)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorRefTest, CopyVectorRef_AddConst) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref_a(std::move(vec_a)); + VectorRef vec_ref_b(vec_ref_a); // No-move. Up-cast + Vector vec_b(std::move(vec_ref_b)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorRefTest, CopyVectorRef_UpcastAndAddConst) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref_a(std::move(vec_a)); + VectorRef vec_ref_b(vec_ref_a); // No-move. Up-cast + Vector vec_b(std::move(vec_ref_b)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorRefTest, MoveVectorRef) { + Vector vec_a{"one", "two"}; + VectorRef vec_ref_a(std::move(vec_a)); // Move + VectorRef vec_ref_b(std::move(vec_ref_a)); + Vector vec_b(std::move(vec_ref_b)); + EXPECT_EQ(vec_b[0], "one"); + EXPECT_EQ(vec_b[1], "two"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorRefTest, MoveVectorRef_Upcast) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref_a(std::move(vec_a)); + VectorRef vec_ref_b(std::move(vec_ref_a)); // Moved. Up-cast + Vector vec_b(std::move(vec_ref_b)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorRefTest, MoveVectorRef_AddConst) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref_a(std::move(vec_a)); + VectorRef vec_ref_b(std::move(vec_ref_a)); // Moved. Up-cast + Vector vec_b(std::move(vec_ref_b)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorRefTest, MoveVectorRef_UpcastAndAddConst) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref_a(std::move(vec_a)); + VectorRef vec_ref_b(std::move(vec_ref_a)); // Moved. Up-cast + Vector vec_b(std::move(vec_ref_b)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorRefTest, CopyVector) { + Vector vec_a{"one", "two"}; + VectorRef vec_ref(vec_a); // No move + Vector vec_b(std::move(vec_ref)); + EXPECT_EQ(vec_b[0], "one"); + EXPECT_EQ(vec_b[1], "two"); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorRefTest, CopyVector_Upcast) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref(vec_a); // No move + EXPECT_EQ(vec_ref[0], &c2a); + EXPECT_EQ(vec_ref[1], &c2b); + Vector vec_b(std::move(vec_ref)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorRefTest, CopyVector_AddConst) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref(vec_a); // No move + EXPECT_EQ(vec_ref[0], &c2a); + EXPECT_EQ(vec_ref[1], &c2b); + Vector vec_b(std::move(vec_ref)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorRefTest, CopyVector_UpcastAndAddConst) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref(vec_a); // No move + EXPECT_EQ(vec_ref[0], &c2a); + EXPECT_EQ(vec_ref[1], &c2b); + Vector vec_b(std::move(vec_ref)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllInternallyHeld(vec_b)); // Copied, not moved +} + +TEST(TintVectorRefTest, MoveVector) { + Vector vec_a{"one", "two"}; + VectorRef vec_ref(std::move(vec_a)); // Move + Vector vec_b(std::move(vec_ref)); + EXPECT_EQ(vec_b[0], "one"); + EXPECT_EQ(vec_b[1], "two"); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorRefTest, MoveVector_Upcast) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref(std::move(vec_a)); // Move + EXPECT_EQ(vec_ref[0], &c2a); + EXPECT_EQ(vec_ref[1], &c2b); + Vector vec_b(std::move(vec_ref)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorRefTest, MoveVector_AddConst) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref(std::move(vec_a)); // Move + EXPECT_EQ(vec_ref[0], &c2a); + EXPECT_EQ(vec_ref[1], &c2b); + Vector vec_b(std::move(vec_ref)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorRefTest, MoveVector_UpcastAndAddConst) { + C2a c2a; + C2b c2b; + Vector vec_a{&c2a, &c2b}; + VectorRef vec_ref(std::move(vec_a)); // Move + EXPECT_EQ(vec_ref[0], &c2a); + EXPECT_EQ(vec_ref[1], &c2b); + Vector vec_b(std::move(vec_ref)); + EXPECT_EQ(vec_b[0], &c2a); + EXPECT_EQ(vec_b[1], &c2b); + EXPECT_TRUE(AllExternallyHeld(vec_b)); // Moved, not copied +} + +TEST(TintVectorRefTest, Index) { + Vector vec{"one", "two"}; + VectorRef vec_ref(vec); + static_assert(std::is_const_v>); + EXPECT_EQ(vec_ref[0], "one"); + EXPECT_EQ(vec_ref[1], "two"); +} + +TEST(TintVectorRefTest, ConstIndex) { + Vector vec{"one", "two"}; + const VectorRef vec_ref(vec); + static_assert(std::is_const_v>); + EXPECT_EQ(vec_ref[0], "one"); + EXPECT_EQ(vec_ref[1], "two"); +} + +TEST(TintVectorRefTest, Length) { + Vector vec{"one", "two", "three"}; + VectorRef vec_ref(vec); + EXPECT_EQ(vec_ref.Length(), 3u); +} + +TEST(TintVectorRefTest, Capacity) { + Vector vec{"one", "two", "three"}; + VectorRef vec_ref(vec); + EXPECT_EQ(vec_ref.Capacity(), 5u); +} + +TEST(TintVectorRefTest, IsEmpty) { + Vector vec; + VectorRef vec_ref(vec); + EXPECT_TRUE(vec_ref.IsEmpty()); + vec.Push("one"); + EXPECT_FALSE(vec_ref.IsEmpty()); + vec.Pop(); + EXPECT_TRUE(vec_ref.IsEmpty()); +} + +TEST(TintVectorRefTest, FrontBack) { + Vector vec{"front", "mid", "back"}; + VectorRef vec_ref(vec); + static_assert(!std::is_const_v>); + static_assert(!std::is_const_v>); + EXPECT_EQ(vec_ref.Front(), "front"); + EXPECT_EQ(vec_ref.Back(), "back"); +} + +TEST(TintVectorRefTest, ConstFrontBack) { + Vector vec{"front", "mid", "back"}; + const VectorRef vec_ref(vec); + static_assert(std::is_const_v>); + static_assert(std::is_const_v>); + EXPECT_EQ(vec_ref.Front(), "front"); + EXPECT_EQ(vec_ref.Back(), "back"); +} + +TEST(TintVectorRefTest, BeginEnd) { + Vector vec{"front", "mid", "back"}; + VectorRef vec_ref(vec); + static_assert(!std::is_const_v>); + static_assert(!std::is_const_v>); + EXPECT_EQ(vec_ref.begin(), &vec[0]); + EXPECT_EQ(vec_ref.end(), &vec[0] + 3); +} + +TEST(TintVectorRefTest, ConstBeginEnd) { + Vector vec{"front", "mid", "back"}; + const VectorRef vec_ref(vec); + static_assert(std::is_const_v>); + static_assert(std::is_const_v>); + EXPECT_EQ(vec_ref.begin(), &vec[0]); + EXPECT_EQ(vec_ref.end(), &vec[0] + 3); +} + +} // namespace +} // namespace tint::utils + +TINT_INSTANTIATE_TYPEINFO(tint::utils::C0); +TINT_INSTANTIATE_TYPEINFO(tint::utils::C1); +TINT_INSTANTIATE_TYPEINFO(tint::utils::C2a); +TINT_INSTANTIATE_TYPEINFO(tint::utils::C2b); diff --git a/src/tint/val/hlsl.cc b/src/tint/val/hlsl.cc index 49c38501a9..eabbe68488 100644 --- a/src/tint/val/hlsl.cc +++ b/src/tint/val/hlsl.cc @@ -12,10 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include + #include "src/tint/val/val.h" #include "src/tint/utils/io/command.h" #include "src/tint/utils/io/tmpfile.h" +#include "src/tint/utils/string.h" #ifdef _WIN32 #include @@ -31,7 +34,7 @@ namespace tint::val { Result HlslUsingDXC(const std::string& dxc_path, const std::string& source, const EntryPointList& entry_points, - const std::vector& overrides) { + bool require_16bit_types) { Result result; auto dxc = utils::Command(dxc_path); @@ -41,11 +44,14 @@ Result HlslUsingDXC(const std::string& dxc_path, return result; } + // Native 16-bit types, e.g. float16_t, require SM6.2. Otherwise we use SM6.0. + const char* shader_model_version = require_16bit_types ? "6_2" : "6_0"; + utils::TmpFile file; file << source; for (auto ep : entry_points) { - const char* profile = ""; + const char* stage_prefix = ""; switch (ep.second) { case ast::PipelineStage::kNone: @@ -53,30 +59,26 @@ Result HlslUsingDXC(const std::string& dxc_path, result.failed = true; return result; case ast::PipelineStage::kVertex: - profile = "-T vs_6_0"; + stage_prefix = "vs"; break; case ast::PipelineStage::kFragment: - profile = "-T ps_6_0"; + stage_prefix = "ps"; break; case ast::PipelineStage::kCompute: - profile = "-T cs_6_0"; + stage_prefix = "cs"; break; } // Match Dawn's compile flags // See dawn\src\dawn_native\d3d12\RenderPipelineD3D12.cpp // and dawn_native\d3d12\ShaderModuleD3D12.cpp (GetDXCArguments) - const char* compileFlags = - "/Zpr " // D3DCOMPILE_PACK_MATRIX_ROW_MAJOR - "/Gis"; // D3DCOMPILE_IEEE_STRICTNESS - - std::string defs; - defs.reserve(overrides.size() * 20); - for (auto& o : overrides) { - defs += "/D" + o + " "; - } - - auto res = dxc(profile, "-E " + ep.first, compileFlags, file.Path(), defs); + auto res = dxc( + "-T " + std::string(stage_prefix) + "_" + std::string(shader_model_version), // Profile + "-E " + ep.first, // Entry point + "/Zpr", // D3DCOMPILE_PACK_MATRIX_ROW_MAJOR + "/Gis", // D3DCOMPILE_IEEE_STRICTNESS + require_16bit_types ? "-enable-16bit-types" : "", // Enable 16-bit if required + file.Path()); if (!res.out.empty()) { if (!result.output.empty()) { result.output += "\n"; @@ -90,6 +92,9 @@ Result HlslUsingDXC(const std::string& dxc_path, result.output += res.err; } result.failed = (res.error_code != 0); + + // Remove the temporary file name from the output to keep output deterministic + result.output = utils::ReplaceAll(result.output, file.Path(), "shader.hlsl"); } if (entry_points.empty()) { @@ -102,28 +107,36 @@ Result HlslUsingDXC(const std::string& dxc_path, } #ifdef _WIN32 -Result HlslUsingFXC(const std::string& source, - const EntryPointList& entry_points, - const std::vector& overrides) { +Result HlslUsingFXC(const std::string& fxc_path, + const std::string& source, + const EntryPointList& entry_points) { Result result; // This library leaks if an error happens in this function, but it is ok // because it is loaded at most once, and the executables using HlslUsingFXC // are short-lived. - HMODULE fxcLib = LoadLibraryA("d3dcompiler_47.dll"); + HMODULE fxcLib = LoadLibraryA(fxc_path.c_str()); if (fxcLib == nullptr) { result.output = "Couldn't load FXC"; result.failed = true; return result; } - pD3DCompile d3dCompile = reinterpret_cast( + auto* d3dCompile = reinterpret_cast( reinterpret_cast(GetProcAddress(fxcLib, "D3DCompile"))); + auto* d3dDisassemble = reinterpret_cast( + reinterpret_cast(GetProcAddress(fxcLib, "D3DDisassemble"))); + if (d3dCompile == nullptr) { result.output = "Couldn't load D3DCompile from FXC"; result.failed = true; return result; } + if (d3dDisassemble == nullptr) { + result.output = "Couldn't load D3DDisassemble from FXC"; + result.failed = true; + return result; + } for (auto ep : entry_points) { const char* profile = ""; @@ -148,37 +161,32 @@ Result HlslUsingFXC(const std::string& source, UINT compileFlags = D3DCOMPILE_OPTIMIZATION_LEVEL0 | D3DCOMPILE_PACK_MATRIX_ROW_MAJOR | D3DCOMPILE_IEEE_STRICTNESS; - auto overrides_copy = overrides; // Copy so that we can replace '=' with '\0' - std::vector macros; - macros.reserve(overrides_copy.size() * 2); - for (auto& o : overrides_copy) { - if (auto sep = o.find_first_of('='); sep != std::string::npos) { - // Replace '=' with '\0' so we can point directly into the allocated string buffer - o[sep] = '\0'; - macros.push_back(D3D_SHADER_MACRO{&o[0], &o[sep + 1]}); - } else { - macros.emplace_back(D3D_SHADER_MACRO{o.c_str(), NULL}); - } - } - macros.emplace_back(D3D_SHADER_MACRO{NULL, NULL}); - ComPtr compiledShader; ComPtr errors; - HRESULT cr = d3dCompile(source.c_str(), // pSrcData - source.length(), // SrcDataSize - nullptr, // pSourceName - macros.data(), // pDefines - nullptr, // pInclude - ep.first.c_str(), // pEntrypoint - profile, // pTarget - compileFlags, // Flags1 - 0, // Flags2 - &compiledShader, // ppCode - &errors); // ppErrorMsgs - if (FAILED(cr)) { + HRESULT res = d3dCompile(source.c_str(), // pSrcData + source.length(), // SrcDataSize + nullptr, // pSourceName + nullptr, // pDefines + nullptr, // pInclude + ep.first.c_str(), // pEntrypoint + profile, // pTarget + compileFlags, // Flags1 + 0, // Flags2 + &compiledShader, // ppCode + &errors); // ppErrorMsgs + if (FAILED(res)) { result.output = static_cast(errors->GetBufferPointer()); result.failed = true; return result; + } else { + ComPtr disassembly; + res = d3dDisassemble(compiledShader->GetBufferPointer(), + compiledShader->GetBufferSize(), 0, "", &disassembly); + if (FAILED(res)) { + result.output = "failed to disassemble shader"; + } else { + result.output = static_cast(disassembly->GetBufferPointer()); + } } } diff --git a/src/tint/val/val.h b/src/tint/val/val.h index c869efb7aa..02ffc780cf 100644 --- a/src/tint/val/val.h +++ b/src/tint/val/val.h @@ -30,6 +30,9 @@ namespace tint::val { using EntryPointList = std::vector>; +/// Name of the FXC compiler DLL +static constexpr const char kFxcDLLName[] = "d3dcompiler_47.dll"; + /// The return structure of Validate() struct Result { /// True if validation passed @@ -43,23 +46,22 @@ struct Result { /// @param dxc_path path to DXC /// @param source the generated HLSL source /// @param entry_points the list of entry points to validate -/// @param overrides optional list of pipeline overrides /// @return the result of the compile Result HlslUsingDXC(const std::string& dxc_path, const std::string& source, const EntryPointList& entry_points, - const std::vector& overrides); + bool require_16bit_types); #ifdef _WIN32 /// Hlsl attempts to compile the shader with FXC, verifying that the shader /// compiles successfully. +/// @param fxc_path path to the FXC DLL /// @param source the generated HLSL source /// @param entry_points the list of entry points to validate -/// @param overrides optional list of pipeline overrides /// @return the result of the compile -Result HlslUsingFXC(const std::string& source, - const EntryPointList& entry_points, - const std::vector& overrides); +Result HlslUsingFXC(const std::string& fxc_path, + const std::string& source, + const EntryPointList& entry_points); #endif // _WIN32 /// Msl attempts to compile the shader with the Metal Shader Compiler, diff --git a/src/tint/writer/append_vector.cc b/src/tint/writer/append_vector.cc index d3d11c1e60..527560edc3 100644 --- a/src/tint/writer/append_vector.cc +++ b/src/tint/writer/append_vector.cc @@ -51,7 +51,7 @@ const sem::Expression* Zero(ProgramBuilder& b, const sem::Type* ty, const sem::S } else if (ty->Is()) { expr = b.Expr(0_u); } else if (ty->Is()) { - expr = b.Expr(0.0f); + expr = b.Expr(0_f); } else if (ty->Is()) { expr = b.Expr(false); } else { @@ -59,7 +59,8 @@ const sem::Expression* Zero(ProgramBuilder& b, const sem::Type* ty, const sem::S << "unsupported vector element type: " << ty->TypeInfo().name; return nullptr; } - auto* sem = b.create(expr, ty, stmt, sem::Constant{}, + auto* sem = b.create(expr, ty, sem::EvaluationStage::kRuntime, stmt, + /* constant_value */ nullptr, /* has_side_effects */ false); b.Sem().Add(expr, sem); return sem; @@ -111,23 +112,23 @@ const sem::Call* AppendVector(ProgramBuilder* b, // to convert a vector of a different type, e.g. vec2(vec2()). // In that case, preserve the original argument, or you'll get a type error. - std::vector packed; + utils::Vector packed; if (auto vc = AsVectorConstructor(vector_sem)) { - const auto num_supplied = vc.call->Arguments().size(); + const auto num_supplied = vc.call->Arguments().Length(); if (num_supplied == 0) { // Zero-value vector constructor. Populate with zeros for (uint32_t i = 0; i < packed_size - 1; i++) { auto* zero = Zero(*b, packed_el_sem_ty, statement); - packed.emplace_back(zero); + packed.Push(zero); } } else if (num_supplied + 1 == packed_size) { // All vector components were supplied as scalars. Pass them through. packed = vc.call->Arguments(); } } - if (packed.empty()) { + if (packed.IsEmpty()) { // The special cases didn't occur. Use the vector argument as-is. - packed.emplace_back(vector_sem); + packed.Push(vector_sem); } if (packed_el_sem_ty != scalar_sem->Type()->UnwrapRef()) { @@ -135,15 +136,17 @@ const sem::Call* AppendVector(ProgramBuilder* b, auto* scalar_cast_ast = b->Construct(packed_el_ast_ty, scalar_ast); auto* scalar_cast_target = b->create( packed_el_sem_ty, - b->create(nullptr, 0, scalar_sem->Type()->UnwrapRef(), - ast::StorageClass::kNone, ast::Access::kUndefined)); + b->create(nullptr, 0u, scalar_sem->Type()->UnwrapRef(), + ast::StorageClass::kNone, ast::Access::kUndefined), + sem::EvaluationStage::kRuntime); auto* scalar_cast_sem = b->create( - scalar_cast_ast, scalar_cast_target, std::vector{scalar_sem}, - statement, sem::Constant{}, /* has_side_effects */ false); + scalar_cast_ast, scalar_cast_target, sem::EvaluationStage::kRuntime, + utils::Vector{scalar_sem}, statement, + /* constant_value */ nullptr, /* has_side_effects */ false); b->Sem().Add(scalar_cast_ast, scalar_cast_sem); - packed.emplace_back(scalar_cast_sem); + packed.Push(scalar_cast_sem); } else { - packed.emplace_back(scalar_sem); + packed.Push(scalar_sem); } auto* constructor_ast = b->Construct( @@ -151,15 +154,18 @@ const sem::Call* AppendVector(ProgramBuilder* b, utils::Transform(packed, [&](const sem::Expression* expr) { return expr->Declaration(); })); auto* constructor_target = b->create( packed_sem_ty, - utils::Transform( - packed, [&](const tint::sem::Expression* arg, size_t i) -> const sem::Parameter* { - return b->create(nullptr, static_cast(i), - arg->Type()->UnwrapRef(), ast::StorageClass::kNone, - ast::Access::kUndefined); - })); - auto* constructor_sem = b->create(constructor_ast, constructor_target, packed, - statement, sem::Constant{}, - /* has_side_effects */ false); + utils::Transform(packed, + [&](const tint::sem::Expression* arg, size_t i) -> const sem::Parameter* { + return b->create( + nullptr, static_cast(i), arg->Type()->UnwrapRef(), + ast::StorageClass::kNone, ast::Access::kUndefined); + }), + sem::EvaluationStage::kRuntime); + auto* constructor_sem = + b->create(constructor_ast, constructor_target, sem::EvaluationStage::kRuntime, + std::move(packed), statement, + /* constant_value */ nullptr, + /* has_side_effects */ false); b->Sem().Add(constructor_ast, constructor_sem); return constructor_sem; } diff --git a/src/tint/writer/append_vector.h b/src/tint/writer/append_vector.h index e6a72382d4..353e20e292 100644 --- a/src/tint/writer/append_vector.h +++ b/src/tint/writer/append_vector.h @@ -17,11 +17,14 @@ #include "src/tint/program_builder.h" -// Forward Declarations +// Forward declarations namespace tint::ast { class CallExpression; class Expression; } // namespace tint::ast +namespace tint::sem { +class Call; +} // namespace tint::sem namespace tint::writer { diff --git a/src/tint/writer/append_vector_test.cc b/src/tint/writer/append_vector_test.cc index 5a9551ef7c..a8608f98f6 100644 --- a/src/tint/writer/append_vector_test.cc +++ b/src/tint/writer/append_vector_test.cc @@ -41,14 +41,14 @@ TEST_F(AppendVectorTest, Vec2i32_i32) { auto* vec_123 = As(append->Declaration()); ASSERT_NE(vec_123, nullptr); - ASSERT_EQ(vec_123->args.size(), 3u); + ASSERT_EQ(vec_123->args.Length(), 3u); EXPECT_EQ(vec_123->args[0], scalar_1); EXPECT_EQ(vec_123->args[1], scalar_2); EXPECT_EQ(vec_123->args[2], scalar_3); - auto* call = Sem().Get(vec_123); + auto* call = Sem().Get(vec_123); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 3u); + ASSERT_EQ(call->Arguments().Length(), 3u); EXPECT_EQ(call->Arguments()[0], Sem().Get(scalar_1)); EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2)); EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3)); @@ -60,7 +60,7 @@ TEST_F(AppendVectorTest, Vec2i32_i32) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 3u); + ASSERT_EQ(ctor->Parameters().Length(), 3u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); @@ -81,18 +81,18 @@ TEST_F(AppendVectorTest, Vec2i32_u32) { auto* vec_123 = As(append->Declaration()); ASSERT_NE(vec_123, nullptr); - ASSERT_EQ(vec_123->args.size(), 3u); + ASSERT_EQ(vec_123->args.Length(), 3u); EXPECT_EQ(vec_123->args[0], scalar_1); EXPECT_EQ(vec_123->args[1], scalar_2); auto* u32_to_i32 = vec_123->args[2]->As(); ASSERT_NE(u32_to_i32, nullptr); EXPECT_TRUE(u32_to_i32->target.type->Is()); - ASSERT_EQ(u32_to_i32->args.size(), 1u); + ASSERT_EQ(u32_to_i32->args.Length(), 1u); EXPECT_EQ(u32_to_i32->args[0], scalar_3); - auto* call = Sem().Get(vec_123); + auto* call = Sem().Get(vec_123); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 3u); + ASSERT_EQ(call->Arguments().Length(), 3u); EXPECT_EQ(call->Arguments()[0], Sem().Get(scalar_1)); EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2)); EXPECT_EQ(call->Arguments()[2], Sem().Get(u32_to_i32)); @@ -104,7 +104,7 @@ TEST_F(AppendVectorTest, Vec2i32_u32) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 3u); + ASSERT_EQ(ctor->Parameters().Length(), 3u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); @@ -127,24 +127,24 @@ TEST_F(AppendVectorTest, Vec2i32FromVec2u32_u32) { auto* vec_123 = As(append->Declaration()); ASSERT_NE(vec_123, nullptr); - ASSERT_EQ(vec_123->args.size(), 2u); + ASSERT_EQ(vec_123->args.Length(), 2u); auto* v2u32_to_v2i32 = vec_123->args[0]->As(); ASSERT_NE(v2u32_to_v2i32, nullptr); ASSERT_TRUE(v2u32_to_v2i32->target.type->Is()); EXPECT_EQ(v2u32_to_v2i32->target.type->As()->width, 2u); EXPECT_TRUE(v2u32_to_v2i32->target.type->As()->type->Is()); - EXPECT_EQ(v2u32_to_v2i32->args.size(), 1u); + EXPECT_EQ(v2u32_to_v2i32->args.Length(), 1u); EXPECT_EQ(v2u32_to_v2i32->args[0], uvec_12); auto* u32_to_i32 = vec_123->args[1]->As(); ASSERT_NE(u32_to_i32, nullptr); EXPECT_TRUE(u32_to_i32->target.type->Is()); - ASSERT_EQ(u32_to_i32->args.size(), 1u); + ASSERT_EQ(u32_to_i32->args.Length(), 1u); EXPECT_EQ(u32_to_i32->args[0], scalar_3); - auto* call = Sem().Get(vec_123); + auto* call = Sem().Get(vec_123); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 2u); + ASSERT_EQ(call->Arguments().Length(), 2u); EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12)); EXPECT_EQ(call->Arguments()[1], Sem().Get(u32_to_i32)); @@ -155,7 +155,7 @@ TEST_F(AppendVectorTest, Vec2i32FromVec2u32_u32) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } @@ -164,7 +164,7 @@ TEST_F(AppendVectorTest, Vec2i32FromVec2u32_u32) { TEST_F(AppendVectorTest, Vec2i32_f32) { auto* scalar_1 = Expr(1_i); auto* scalar_2 = Expr(2_i); - auto* scalar_3 = Expr(3.0f); + auto* scalar_3 = Expr(3_f); auto* vec_12 = vec2(scalar_1, scalar_2); WrapInFunction(vec_12, scalar_3); @@ -175,18 +175,18 @@ TEST_F(AppendVectorTest, Vec2i32_f32) { auto* vec_123 = As(append->Declaration()); ASSERT_NE(vec_123, nullptr); - ASSERT_EQ(vec_123->args.size(), 3u); + ASSERT_EQ(vec_123->args.Length(), 3u); EXPECT_EQ(vec_123->args[0], scalar_1); EXPECT_EQ(vec_123->args[1], scalar_2); auto* f32_to_i32 = vec_123->args[2]->As(); ASSERT_NE(f32_to_i32, nullptr); EXPECT_TRUE(f32_to_i32->target.type->Is()); - ASSERT_EQ(f32_to_i32->args.size(), 1u); + ASSERT_EQ(f32_to_i32->args.Length(), 1u); EXPECT_EQ(f32_to_i32->args[0], scalar_3); - auto* call = Sem().Get(vec_123); + auto* call = Sem().Get(vec_123); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 3u); + ASSERT_EQ(call->Arguments().Length(), 3u); EXPECT_EQ(call->Arguments()[0], Sem().Get(scalar_1)); EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2)); EXPECT_EQ(call->Arguments()[2], Sem().Get(f32_to_i32)); @@ -198,7 +198,7 @@ TEST_F(AppendVectorTest, Vec2i32_f32) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 3u); + ASSERT_EQ(ctor->Parameters().Length(), 3u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); @@ -220,15 +220,15 @@ TEST_F(AppendVectorTest, Vec3i32_i32) { auto* vec_1234 = As(append->Declaration()); ASSERT_NE(vec_1234, nullptr); - ASSERT_EQ(vec_1234->args.size(), 4u); + ASSERT_EQ(vec_1234->args.Length(), 4u); EXPECT_EQ(vec_1234->args[0], scalar_1); EXPECT_EQ(vec_1234->args[1], scalar_2); EXPECT_EQ(vec_1234->args[2], scalar_3); EXPECT_EQ(vec_1234->args[3], scalar_4); - auto* call = Sem().Get(vec_1234); + auto* call = Sem().Get(vec_1234); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 4u); + ASSERT_EQ(call->Arguments().Length(), 4u); EXPECT_EQ(call->Arguments()[0], Sem().Get(scalar_1)); EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2)); EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3)); @@ -241,7 +241,7 @@ TEST_F(AppendVectorTest, Vec3i32_i32) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 4u); + ASSERT_EQ(ctor->Parameters().Length(), 4u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); @@ -250,7 +250,7 @@ TEST_F(AppendVectorTest, Vec3i32_i32) { // AppendVector(vec_12, 3) -> vec3(vec_12, 3) TEST_F(AppendVectorTest, Vec2i32Var_i32) { - Global("vec_12", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("vec_12", ty.vec2(), ast::StorageClass::kPrivate); auto* vec_12 = Expr("vec_12"); auto* scalar_3 = Expr(3_i); WrapInFunction(vec_12, scalar_3); @@ -262,13 +262,13 @@ TEST_F(AppendVectorTest, Vec2i32Var_i32) { auto* vec_123 = As(append->Declaration()); ASSERT_NE(vec_123, nullptr); - ASSERT_EQ(vec_123->args.size(), 2u); + ASSERT_EQ(vec_123->args.Length(), 2u); EXPECT_EQ(vec_123->args[0], vec_12); EXPECT_EQ(vec_123->args[1], scalar_3); - auto* call = Sem().Get(vec_123); + auto* call = Sem().Get(vec_123); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 2u); + ASSERT_EQ(call->Arguments().Length(), 2u); EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12)); EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3)); @@ -279,14 +279,14 @@ TEST_F(AppendVectorTest, Vec2i32Var_i32) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } // AppendVector(1, 2, scalar_3) -> vec3(1, 2, scalar_3) TEST_F(AppendVectorTest, Vec2i32_i32Var) { - Global("scalar_3", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("scalar_3", ty.i32(), ast::StorageClass::kPrivate); auto* scalar_1 = Expr(1_i); auto* scalar_2 = Expr(2_i); auto* scalar_3 = Expr("scalar_3"); @@ -300,14 +300,14 @@ TEST_F(AppendVectorTest, Vec2i32_i32Var) { auto* vec_123 = As(append->Declaration()); ASSERT_NE(vec_123, nullptr); - ASSERT_EQ(vec_123->args.size(), 3u); + ASSERT_EQ(vec_123->args.Length(), 3u); EXPECT_EQ(vec_123->args[0], scalar_1); EXPECT_EQ(vec_123->args[1], scalar_2); EXPECT_EQ(vec_123->args[2], scalar_3); - auto* call = Sem().Get(vec_123); + auto* call = Sem().Get(vec_123); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 3u); + ASSERT_EQ(call->Arguments().Length(), 3u); EXPECT_EQ(call->Arguments()[0], Sem().Get(scalar_1)); EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2)); EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3)); @@ -319,7 +319,7 @@ TEST_F(AppendVectorTest, Vec2i32_i32Var) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 3u); + ASSERT_EQ(ctor->Parameters().Length(), 3u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); @@ -327,8 +327,8 @@ TEST_F(AppendVectorTest, Vec2i32_i32Var) { // AppendVector(vec_12, scalar_3) -> vec3(vec_12, scalar_3) TEST_F(AppendVectorTest, Vec2i32Var_i32Var) { - Global("vec_12", ty.vec2(), ast::StorageClass::kPrivate); - Global("scalar_3", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("vec_12", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("scalar_3", ty.i32(), ast::StorageClass::kPrivate); auto* vec_12 = Expr("vec_12"); auto* scalar_3 = Expr("scalar_3"); WrapInFunction(vec_12, scalar_3); @@ -340,13 +340,13 @@ TEST_F(AppendVectorTest, Vec2i32Var_i32Var) { auto* vec_123 = As(append->Declaration()); ASSERT_NE(vec_123, nullptr); - ASSERT_EQ(vec_123->args.size(), 2u); + ASSERT_EQ(vec_123->args.Length(), 2u); EXPECT_EQ(vec_123->args[0], vec_12); EXPECT_EQ(vec_123->args[1], scalar_3); - auto* call = Sem().Get(vec_123); + auto* call = Sem().Get(vec_123); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 2u); + ASSERT_EQ(call->Arguments().Length(), 2u); EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12)); EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3)); @@ -357,15 +357,15 @@ TEST_F(AppendVectorTest, Vec2i32Var_i32Var) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } // AppendVector(vec_12, scalar_3) -> vec3(vec_12, i32(scalar_3)) TEST_F(AppendVectorTest, Vec2i32Var_f32Var) { - Global("vec_12", ty.vec2(), ast::StorageClass::kPrivate); - Global("scalar_3", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("vec_12", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("scalar_3", ty.f32(), ast::StorageClass::kPrivate); auto* vec_12 = Expr("vec_12"); auto* scalar_3 = Expr("scalar_3"); WrapInFunction(vec_12, scalar_3); @@ -377,17 +377,17 @@ TEST_F(AppendVectorTest, Vec2i32Var_f32Var) { auto* vec_123 = As(append->Declaration()); ASSERT_NE(vec_123, nullptr); - ASSERT_EQ(vec_123->args.size(), 2u); + ASSERT_EQ(vec_123->args.Length(), 2u); EXPECT_EQ(vec_123->args[0], vec_12); auto* f32_to_i32 = vec_123->args[1]->As(); ASSERT_NE(f32_to_i32, nullptr); EXPECT_TRUE(f32_to_i32->target.type->Is()); - ASSERT_EQ(f32_to_i32->args.size(), 1u); + ASSERT_EQ(f32_to_i32->args.Length(), 1u); EXPECT_EQ(f32_to_i32->args[0], scalar_3); - auto* call = Sem().Get(vec_123); + auto* call = Sem().Get(vec_123); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 2u); + ASSERT_EQ(call->Arguments().Length(), 2u); EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12)); EXPECT_EQ(call->Arguments()[1], Sem().Get(f32_to_i32)); @@ -398,15 +398,15 @@ TEST_F(AppendVectorTest, Vec2i32Var_f32Var) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } // AppendVector(vec_12, scalar_3) -> vec3(vec_12, scalar_3) TEST_F(AppendVectorTest, Vec2boolVar_boolVar) { - Global("vec_12", ty.vec2(), ast::StorageClass::kPrivate); - Global("scalar_3", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("vec_12", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("scalar_3", ty.bool_(), ast::StorageClass::kPrivate); auto* vec_12 = Expr("vec_12"); auto* scalar_3 = Expr("scalar_3"); WrapInFunction(vec_12, scalar_3); @@ -418,13 +418,13 @@ TEST_F(AppendVectorTest, Vec2boolVar_boolVar) { auto* vec_123 = As(append->Declaration()); ASSERT_NE(vec_123, nullptr); - ASSERT_EQ(vec_123->args.size(), 2u); + ASSERT_EQ(vec_123->args.Length(), 2u); EXPECT_EQ(vec_123->args[0], vec_12); EXPECT_EQ(vec_123->args[1], scalar_3); - auto* call = Sem().Get(vec_123); + auto* call = Sem().Get(vec_123); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 2u); + ASSERT_EQ(call->Arguments().Length(), 2u); EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12)); EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3)); @@ -435,7 +435,7 @@ TEST_F(AppendVectorTest, Vec2boolVar_boolVar) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 2u); + ASSERT_EQ(ctor->Parameters().Length(), 2u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); } @@ -453,7 +453,7 @@ TEST_F(AppendVectorTest, ZeroVec3i32_i32) { auto* vec_0004 = As(append->Declaration()); ASSERT_NE(vec_0004, nullptr); - ASSERT_EQ(vec_0004->args.size(), 4u); + ASSERT_EQ(vec_0004->args.Length(), 4u); for (size_t i = 0; i < 3; i++) { auto* literal = As(vec_0004->args[i]); ASSERT_NE(literal, nullptr); @@ -461,9 +461,9 @@ TEST_F(AppendVectorTest, ZeroVec3i32_i32) { } EXPECT_EQ(vec_0004->args[3], scalar); - auto* call = Sem().Get(vec_0004); + auto* call = Sem().Get(vec_0004); ASSERT_NE(call, nullptr); - ASSERT_EQ(call->Arguments().size(), 4u); + ASSERT_EQ(call->Arguments().Length(), 4u); EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_0004->args[0])); EXPECT_EQ(call->Arguments()[1], Sem().Get(vec_0004->args[1])); EXPECT_EQ(call->Arguments()[2], Sem().Get(vec_0004->args[2])); @@ -476,7 +476,7 @@ TEST_F(AppendVectorTest, ZeroVec3i32_i32) { EXPECT_TRUE(ctor->ReturnType()->As()->type()->Is()); EXPECT_EQ(ctor->ReturnType(), call->Type()); - ASSERT_EQ(ctor->Parameters().size(), 4u); + ASSERT_EQ(ctor->Parameters().Length(), 4u); EXPECT_TRUE(ctor->Parameters()[0]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[1]->Type()->Is()); EXPECT_TRUE(ctor->Parameters()[2]->Type()->Is()); diff --git a/src/tint/writer/flatten_bindings.cc b/src/tint/writer/flatten_bindings.cc index 1efc02a87f..bedec75969 100644 --- a/src/tint/writer/flatten_bindings.cc +++ b/src/tint/writer/flatten_bindings.cc @@ -33,6 +33,7 @@ std::optional FlattenBindings(const Program* program) { auto entry_points = inspector.GetEntryPoints(); for (auto& entry_point : entry_points) { auto bindings = inspector.GetResourceBindings(entry_point.name); + for (auto& binding : bindings) { BindingPoint src = {binding.bind_group, binding.binding}; if (binding_points.count(src)) { diff --git a/src/tint/writer/flatten_bindings_test.cc b/src/tint/writer/flatten_bindings_test.cc index 1c516c92e5..7137218c08 100644 --- a/src/tint/writer/flatten_bindings_test.cc +++ b/src/tint/writer/flatten_bindings_test.cc @@ -18,7 +18,6 @@ #include "gtest/gtest.h" #include "src/tint/program_builder.h" -#include "src/tint/resolver/resolver.h" #include "src/tint/sem/variable.h" namespace tint::writer { @@ -28,10 +27,6 @@ class FlattenBindingsTest : public ::testing::Test {}; TEST_F(FlattenBindingsTest, NoBindings) { ProgramBuilder b; - b.WrapInFunction(); - - resolver::Resolver resolver(&b); - Program program(std::move(b)); ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); @@ -41,12 +36,9 @@ TEST_F(FlattenBindingsTest, NoBindings) { TEST_F(FlattenBindingsTest, AlreadyFlat) { ProgramBuilder b; - b.Global("a", b.ty.i32(), ast::StorageClass::kUniform, b.GroupAndBinding(0, 0)); - b.Global("b", b.ty.i32(), ast::StorageClass::kUniform, b.GroupAndBinding(0, 1)); - b.Global("c", b.ty.i32(), ast::StorageClass::kUniform, b.GroupAndBinding(0, 2)); - b.WrapInFunction(); - - resolver::Resolver resolver(&b); + b.GlobalVar("a", b.ty.i32(), ast::StorageClass::kUniform, b.Group(0), b.Binding(0)); + b.GlobalVar("b", b.ty.i32(), ast::StorageClass::kUniform, b.Group(0), b.Binding(1)); + b.GlobalVar("c", b.ty.i32(), ast::StorageClass::kUniform, b.Group(0), b.Binding(2)); Program program(std::move(b)); ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); @@ -57,13 +49,11 @@ TEST_F(FlattenBindingsTest, AlreadyFlat) { TEST_F(FlattenBindingsTest, NotFlat_SingleNamespace) { ProgramBuilder b; - b.Global("a", b.ty.i32(), ast::StorageClass::kUniform, b.GroupAndBinding(0, 0)); - b.Global("b", b.ty.i32(), ast::StorageClass::kUniform, b.GroupAndBinding(1, 1)); - b.Global("c", b.ty.i32(), ast::StorageClass::kUniform, b.GroupAndBinding(2, 2)); + b.GlobalVar("a", b.ty.i32(), ast::StorageClass::kUniform, b.Group(0), b.Binding(0)); + b.GlobalVar("b", b.ty.i32(), ast::StorageClass::kUniform, b.Group(1), b.Binding(1)); + b.GlobalVar("c", b.ty.i32(), ast::StorageClass::kUniform, b.Group(2), b.Binding(2)); b.WrapInFunction(b.Expr("a"), b.Expr("b"), b.Expr("c")); - resolver::Resolver resolver(&b); - Program program(std::move(b)); ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); @@ -71,41 +61,51 @@ TEST_F(FlattenBindingsTest, NotFlat_SingleNamespace) { EXPECT_TRUE(flattened); auto& vars = flattened->AST().GlobalVariables(); - EXPECT_EQ(vars[0]->BindingPoint().group->value, 0u); - EXPECT_EQ(vars[0]->BindingPoint().binding->value, 0u); - EXPECT_EQ(vars[1]->BindingPoint().group->value, 0u); - EXPECT_EQ(vars[1]->BindingPoint().binding->value, 1u); - EXPECT_EQ(vars[2]->BindingPoint().group->value, 0u); - EXPECT_EQ(vars[2]->BindingPoint().binding->value, 2u); + + auto* sem = flattened->Sem().Get(vars[0]); + ASSERT_NE(sem, nullptr); + EXPECT_EQ(sem->BindingPoint().group, 0u); + EXPECT_EQ(sem->BindingPoint().binding, 0u); + + sem = flattened->Sem().Get(vars[1]); + ASSERT_NE(sem, nullptr); + EXPECT_EQ(sem->BindingPoint().group, 0u); + EXPECT_EQ(sem->BindingPoint().binding, 1u); + + sem = flattened->Sem().Get(vars[2]); + ASSERT_NE(sem, nullptr); + EXPECT_EQ(sem->BindingPoint().group, 0u); + EXPECT_EQ(sem->BindingPoint().binding, 2u); } TEST_F(FlattenBindingsTest, NotFlat_MultipleNamespaces) { ProgramBuilder b; const size_t num_buffers = 3; - b.Global("buffer1", b.ty.i32(), ast::StorageClass::kUniform, b.GroupAndBinding(0, 0)); - b.Global("buffer2", b.ty.i32(), ast::StorageClass::kStorage, b.GroupAndBinding(1, 1)); - b.Global("buffer3", b.ty.i32(), ast::StorageClass::kStorage, ast::Access::kRead, - b.GroupAndBinding(2, 2)); + b.GlobalVar("buffer1", b.ty.i32(), ast::StorageClass::kUniform, b.Group(0), b.Binding(0)); + b.GlobalVar("buffer2", b.ty.i32(), ast::StorageClass::kStorage, b.Group(1), b.Binding(1)); + b.GlobalVar("buffer3", b.ty.i32(), ast::StorageClass::kStorage, ast::Access::kRead, b.Group(2), + b.Binding(2)); const size_t num_samplers = 2; - b.Global("sampler1", b.ty.sampler(ast::SamplerKind::kSampler), b.GroupAndBinding(3, 3)); - b.Global("sampler2", b.ty.sampler(ast::SamplerKind::kComparisonSampler), - b.GroupAndBinding(4, 4)); + b.GlobalVar("sampler1", b.ty.sampler(ast::SamplerKind::kSampler), b.Group(3), b.Binding(3)); + b.GlobalVar("sampler2", b.ty.sampler(ast::SamplerKind::kComparisonSampler), b.Group(4), + b.Binding(4)); const size_t num_textures = 6; - b.Global("texture1", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32()), - b.GroupAndBinding(5, 5)); - b.Global("texture2", b.ty.multisampled_texture(ast::TextureDimension::k2d, b.ty.f32()), - b.GroupAndBinding(6, 6)); - b.Global("texture3", - b.ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Float, - ast::Access::kWrite), - b.GroupAndBinding(7, 7)); - b.Global("texture4", b.ty.depth_texture(ast::TextureDimension::k2d), b.GroupAndBinding(8, 8)); - b.Global("texture5", b.ty.depth_multisampled_texture(ast::TextureDimension::k2d), - b.GroupAndBinding(9, 9)); - b.Global("texture6", b.ty.external_texture(), b.GroupAndBinding(10, 10)); + b.GlobalVar("texture1", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32()), + b.Group(5), b.Binding(5)); + b.GlobalVar("texture2", b.ty.multisampled_texture(ast::TextureDimension::k2d, b.ty.f32()), + b.Group(6), b.Binding(6)); + b.GlobalVar("texture3", + b.ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Float, + ast::Access::kWrite), + b.Group(7), b.Binding(7)); + b.GlobalVar("texture4", b.ty.depth_texture(ast::TextureDimension::k2d), b.Group(8), + b.Binding(8)); + b.GlobalVar("texture5", b.ty.depth_multisampled_texture(ast::TextureDimension::k2d), b.Group(9), + b.Binding(9)); + b.GlobalVar("texture6", b.ty.external_texture(), b.Group(10), b.Binding(10)); b.WrapInFunction(b.Assign(b.Phony(), "buffer1"), b.Assign(b.Phony(), "buffer2"), b.Assign(b.Phony(), "buffer3"), b.Assign(b.Phony(), "sampler1"), @@ -114,8 +114,6 @@ TEST_F(FlattenBindingsTest, NotFlat_MultipleNamespaces) { b.Assign(b.Phony(), "texture4"), b.Assign(b.Phony(), "texture5"), b.Assign(b.Phony(), "texture6")); - resolver::Resolver resolver(&b); - Program program(std::move(b)); ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); @@ -125,16 +123,22 @@ TEST_F(FlattenBindingsTest, NotFlat_MultipleNamespaces) { auto& vars = flattened->AST().GlobalVariables(); for (size_t i = 0; i < num_buffers; ++i) { - EXPECT_EQ(vars[i]->BindingPoint().group->value, 0u); - EXPECT_EQ(vars[i]->BindingPoint().binding->value, i); + auto* sem = flattened->Sem().Get(vars[i]); + ASSERT_NE(sem, nullptr); + EXPECT_EQ(sem->BindingPoint().group, 0u); + EXPECT_EQ(sem->BindingPoint().binding, i); } for (size_t i = 0; i < num_samplers; ++i) { - EXPECT_EQ(vars[i + num_buffers]->BindingPoint().group->value, 0u); - EXPECT_EQ(vars[i + num_buffers]->BindingPoint().binding->value, i); + auto* sem = flattened->Sem().Get(vars[i + num_buffers]); + ASSERT_NE(sem, nullptr); + EXPECT_EQ(sem->BindingPoint().group, 0u); + EXPECT_EQ(sem->BindingPoint().binding, i); } for (size_t i = 0; i < num_textures; ++i) { - EXPECT_EQ(vars[i + num_buffers + num_samplers]->BindingPoint().group->value, 0u); - EXPECT_EQ(vars[i + num_buffers + num_samplers]->BindingPoint().binding->value, i); + auto* sem = flattened->Sem().Get(vars[i + num_buffers + num_samplers]); + ASSERT_NE(sem, nullptr); + EXPECT_EQ(sem->BindingPoint().group, 0u); + EXPECT_EQ(sem->BindingPoint().binding, i); } } diff --git a/src/tint/writer/float_to_string_test.cc b/src/tint/writer/float_to_string_test.cc index 2596be7998..b629b50dc7 100644 --- a/src/tint/writer/float_to_string_test.cc +++ b/src/tint/writer/float_to_string_test.cc @@ -27,7 +27,7 @@ namespace { // - 0 sign if sign is 0, 1 otherwise // - 'exponent_bits' is placed in the exponent space. // So, the exponent bias must already be included. -float MakeFloat(int sign, int biased_exponent, int mantissa) { +float MakeFloat(uint32_t sign, uint32_t biased_exponent, uint32_t mantissa) { const uint32_t sign_bit = sign ? 0x80000000u : 0u; // The binary32 exponent is 8 bits, just below the sign. const uint32_t exponent_bits = (biased_exponent & 0xffu) << 23; diff --git a/src/tint/writer/generate_external_texture_bindings_test.cc b/src/tint/writer/generate_external_texture_bindings_test.cc index d0918c322d..8c7b8d46b3 100644 --- a/src/tint/writer/generate_external_texture_bindings_test.cc +++ b/src/tint/writer/generate_external_texture_bindings_test.cc @@ -27,7 +27,6 @@ class GenerateExternalTextureBindingsTest : public ::testing::Test {}; TEST_F(GenerateExternalTextureBindingsTest, None) { ProgramBuilder b; - b.WrapInFunction(); tint::Program program(std::move(b)); ASSERT_TRUE(program.IsValid()); @@ -37,8 +36,7 @@ TEST_F(GenerateExternalTextureBindingsTest, None) { TEST_F(GenerateExternalTextureBindingsTest, One) { ProgramBuilder b; - b.Global("v0", b.ty.external_texture(), b.GroupAndBinding(0, 0)); - b.WrapInFunction(); + b.GlobalVar("v0", b.ty.external_texture(), b.Group(0), b.Binding(0)); tint::Program program(std::move(b)); ASSERT_TRUE(program.IsValid()); @@ -54,9 +52,8 @@ TEST_F(GenerateExternalTextureBindingsTest, One) { TEST_F(GenerateExternalTextureBindingsTest, Two_SameGroup) { ProgramBuilder b; - b.Global("v0", b.ty.external_texture(), b.GroupAndBinding(0, 0)); - b.Global("v1", b.ty.external_texture(), b.GroupAndBinding(0, 1)); - b.WrapInFunction(); + b.GlobalVar("v0", b.ty.external_texture(), b.Group(0), b.Binding(0)); + b.GlobalVar("v1", b.ty.external_texture(), b.Group(0), b.Binding(1)); tint::Program program(std::move(b)); ASSERT_TRUE(program.IsValid()); @@ -78,9 +75,8 @@ TEST_F(GenerateExternalTextureBindingsTest, Two_SameGroup) { TEST_F(GenerateExternalTextureBindingsTest, Two_DifferentGroup) { ProgramBuilder b; - b.Global("v0", b.ty.external_texture(), b.GroupAndBinding(0, 0)); - b.Global("v1", b.ty.external_texture(), b.GroupAndBinding(1, 0)); - b.WrapInFunction(); + b.GlobalVar("v0", b.ty.external_texture(), b.Group(0), b.Binding(0)); + b.GlobalVar("v1", b.ty.external_texture(), b.Group(1), b.Binding(0)); tint::Program program(std::move(b)); ASSERT_TRUE(program.IsValid()); @@ -102,12 +98,11 @@ TEST_F(GenerateExternalTextureBindingsTest, Two_DifferentGroup) { TEST_F(GenerateExternalTextureBindingsTest, Two_WithOtherBindingsInSameGroup) { ProgramBuilder b; - b.Global("v0", b.ty.i32(), b.GroupAndBinding(0, 0), kUniform); - b.Global("v1", b.ty.external_texture(), b.GroupAndBinding(0, 1)); - b.Global("v2", b.ty.i32(), b.GroupAndBinding(0, 2), kUniform); - b.Global("v3", b.ty.external_texture(), b.GroupAndBinding(0, 3)); - b.Global("v4", b.ty.i32(), b.GroupAndBinding(0, 4), kUniform); - b.WrapInFunction(); + b.GlobalVar("v0", b.ty.i32(), b.Group(0), b.Binding(0), kUniform); + b.GlobalVar("v1", b.ty.external_texture(), b.Group(0), b.Binding(1)); + b.GlobalVar("v2", b.ty.i32(), b.Group(0), b.Binding(2), kUniform); + b.GlobalVar("v3", b.ty.external_texture(), b.Group(0), b.Binding(3)); + b.GlobalVar("v4", b.ty.i32(), b.Group(0), b.Binding(4), kUniform); tint::Program program(std::move(b)); ASSERT_TRUE(program.IsValid()) << program.Diagnostics().str(); diff --git a/src/tint/writer/glsl/generator.cc b/src/tint/writer/glsl/generator.cc index 4b6da68c46..4b1e516655 100644 --- a/src/tint/writer/glsl/generator.cc +++ b/src/tint/writer/glsl/generator.cc @@ -30,6 +30,10 @@ Result::Result(const Result&) = default; Result Generate(const Program* program, const Options& options, const std::string& entry_point) { Result result; + if (!program->IsValid()) { + result.error = "input program is not valid"; + return result; + } // Sanitize the program. auto sanitized_result = Sanitize(program, options, entry_point); diff --git a/src/tint/writer/glsl/generator.h b/src/tint/writer/glsl/generator.h index 77a7f4b1bb..d48b0bc7d9 100644 --- a/src/tint/writer/glsl/generator.h +++ b/src/tint/writer/glsl/generator.h @@ -32,9 +32,6 @@ namespace tint { class Program; } // namespace tint -namespace tint::writer::glsl { -class GeneratorImpl; -} // namespace tint::writer::glsl namespace tint::writer::glsl { diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc index 29451e7797..31f749fb81 100644 --- a/src/tint/writer/glsl/generator_impl.cc +++ b/src/tint/writer/glsl/generator_impl.cc @@ -32,6 +32,7 @@ #include "src/tint/sem/atomic.h" #include "src/tint/sem/block_statement.h" #include "src/tint/sem/call.h" +#include "src/tint/sem/constant.h" #include "src/tint/sem/depth_multisampled_texture.h" #include "src/tint/sem/depth_texture.h" #include "src/tint/sem/function.h" @@ -52,11 +53,12 @@ #include "src/tint/transform/canonicalize_entry_point_io.h" #include "src/tint/transform/combine_samplers.h" #include "src/tint/transform/decompose_memory_access.h" +#include "src/tint/transform/disable_uniformity_analysis.h" #include "src/tint/transform/expand_compound_assignment.h" #include "src/tint/transform/fold_trivial_single_use_lets.h" #include "src/tint/transform/loop_to_for_loop.h" #include "src/tint/transform/manager.h" -#include "src/tint/transform/promote_initializers_to_const_var.h" +#include "src/tint/transform/promote_initializers_to_let.h" #include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/remove_phonies.h" #include "src/tint/transform/renamer.h" @@ -68,10 +70,13 @@ #include "src/tint/utils/defer.h" #include "src/tint/utils/map.h" #include "src/tint/utils/scoped_assignment.h" +#include "src/tint/utils/string.h" #include "src/tint/writer/append_vector.h" #include "src/tint/writer/float_to_string.h" #include "src/tint/writer/generate_external_texture_bindings.h" +using namespace tint::number_suffixes; // NOLINT + namespace { bool IsRelational(tint::ast::BinaryOp op) { @@ -81,10 +86,10 @@ bool IsRelational(tint::ast::BinaryOp op) { op == tint::ast::BinaryOp::kGreaterThanEqual; } -bool RequiresOESSampleVariables(tint::ast::Builtin builtin) { +bool RequiresOESSampleVariables(tint::ast::BuiltinValue builtin) { switch (builtin) { - case tint::ast::Builtin::kSampleIndex: - case tint::ast::Builtin::kSampleMask: + case tint::ast::BuiltinValue::kSampleIndex: + case tint::ast::BuiltinValue::kSampleMask: return true; default: return false; @@ -137,12 +142,35 @@ const char* convert_texel_format_to_glsl(const ast::TexelFormat format) { return "rgba32i"; case ast::TexelFormat::kRgba32Float: return "rgba32f"; - case ast::TexelFormat::kNone: + case ast::TexelFormat::kInvalid: return "unknown"; } return "unknown"; } +void PrintF32(std::ostream& out, float value) { + // Note: Currently inf and nan should not be constructable, but this is implemented for the day + // we support them. + if (std::isinf(value)) { + out << (value >= 0 ? "uintBitsToFloat(0x7f800000u)" : "uintBitsToFloat(0xff800000u)"); + } else if (std::isnan(value)) { + out << "uintBitsToFloat(0x7fc00000u)"; + } else { + out << FloatToString(value) << "f"; + } +} + +bool PrintF16(std::ostream& out, float value) { + // Note: Currently inf and nan should not be constructable, and there is no solid way to + // generate constant/literal f16 Inf or NaN. + if (std::isinf(value) || std::isnan(value)) { + return false; + } else { + out << FloatToString(value) << "hf"; + return true; + } +} + } // namespace SanitizedResult::SanitizedResult() = default; @@ -155,8 +183,12 @@ SanitizedResult Sanitize(const Program* in, transform::Manager manager; transform::DataMap data; + manager.Add(); + { // Builtin polyfills transform::BuiltinPolyfill::Builtins polyfills; + polyfills.acosh = transform::BuiltinPolyfill::Level::kRangeCheck; + polyfills.atanh = transform::BuiltinPolyfill::Level::kRangeCheck; polyfills.count_leading_zeros = true; polyfills.count_trailing_zeros = true; polyfills.extract_bits = transform::BuiltinPolyfill::Level::kClampParameters; @@ -208,7 +240,7 @@ SanitizedResult Sanitize(const Program* in, options.binding_points, options.access_controls, options.allow_collisions); manager.Add(); - manager.Add(); + manager.Add(); manager.Add(); manager.Add(); data.Add( @@ -241,8 +273,8 @@ bool GeneratorImpl::Generate() { auto* mod = builder_.Sem().Module(); for (auto* decl : mod->DependencyOrderedDeclarations()) { - if (decl->Is()) { - continue; // Ignore aliases. + if (decl->IsAnyOf()) { + continue; // These are not emitted. } if (auto* global = decl->As()) { @@ -293,6 +325,10 @@ bool GeneratorImpl::Generate() { extensions.Append("#extension GL_OES_sample_variables : require"); } + if (requires_f16_extension_) { + extensions.Append("#extension GL_AMD_gpu_shader_half_float : require"); + } + auto indent = current_buffer_->current_indent; if (!extensions.lines.empty()) { @@ -313,17 +349,12 @@ bool GeneratorImpl::Generate() { return true; } -bool GeneratorImpl::RecordExtension(const ast::Enable*) { - /* - Deal with extension node here, recording it within the generator for - later emition. - For example: - ``` - if (ext->kind == ast::Enable::ExtensionKind::kF16) { - require_fp16_ = true; - } - ``` - */ +bool GeneratorImpl::RecordExtension(const ast::Enable* ext) { + // Deal with extension node here, recording it within the generator for later emition. + + if (ext->extension == ast::Extension::kF16) { + requires_f16_extension_ = true; + } return true; } @@ -370,11 +401,10 @@ bool GeneratorImpl::EmitBitcast(std::ostream& out, const ast::BitcastExpression* return false; } } - out << "("; + ScopedParen sp(out); if (!EmitExpression(out, expr->expr)) { return false; } - out << ")"; return true; } @@ -414,7 +444,7 @@ bool GeneratorImpl::EmitVectorRelational(std::ostream& out, const ast::BinaryExp default: break; } - out << "("; + ScopedParen sp(out); if (!EmitExpression(out, expr->lhs)) { return false; } @@ -422,7 +452,6 @@ bool GeneratorImpl::EmitVectorRelational(std::ostream& out, const ast::BinaryExp if (!EmitExpression(out, expr->rhs)) { return false; } - out << ")"; return true; } @@ -472,42 +501,45 @@ bool GeneratorImpl::EmitBitwiseBoolOp(std::ostream& out, const ast::BinaryExpres bool GeneratorImpl::EmitFloatModulo(std::ostream& out, const ast::BinaryExpression* expr) { std::string fn; auto* ret_ty = TypeOf(expr)->UnwrapRef(); - fn = utils::GetOrCreate(float_modulo_funcs_, ret_ty, [&]() -> std::string { - TextBuffer b; - TINT_DEFER(helpers_.Append(b)); + auto* lhs_ty = TypeOf(expr->lhs)->UnwrapRef(); + auto* rhs_ty = TypeOf(expr->rhs)->UnwrapRef(); + fn = utils::GetOrCreate(float_modulo_funcs_, BinaryOperandType{{lhs_ty, rhs_ty}}, + [&]() -> std::string { + TextBuffer b; + TINT_DEFER(helpers_.Append(b)); - auto fn_name = UniqueIdentifier("tint_float_modulo"); - std::vector parameter_names; - { - auto decl = line(&b); - if (!EmitTypeAndName(decl, ret_ty, ast::StorageClass::kNone, ast::Access::kUndefined, - fn_name)) { - return ""; - } - { - ScopedParen sp(decl); - const auto* ty = TypeOf(expr->lhs)->UnwrapRef(); - if (!EmitTypeAndName(decl, ty, ast::StorageClass::kNone, ast::Access::kUndefined, - "lhs")) { - return ""; - } - decl << ", "; - ty = TypeOf(expr->rhs)->UnwrapRef(); - if (!EmitTypeAndName(decl, ty, ast::StorageClass::kNone, ast::Access::kUndefined, - "rhs")) { - return ""; - } - } - decl << " {"; - } - { - ScopedIndent si(&b); - line(&b) << "return (lhs - rhs * trunc(lhs / rhs));"; - } - line(&b) << "}"; - line(&b); - return fn_name; - }); + auto fn_name = UniqueIdentifier("tint_float_modulo"); + std::vector parameter_names; + { + auto decl = line(&b); + if (!EmitTypeAndName(decl, ret_ty, ast::StorageClass::kNone, + ast::Access::kUndefined, fn_name)) { + return ""; + } + { + ScopedParen sp(decl); + const auto* ty = TypeOf(expr->lhs)->UnwrapRef(); + if (!EmitTypeAndName(decl, ty, ast::StorageClass::kNone, + ast::Access::kUndefined, "lhs")) { + return ""; + } + decl << ", "; + ty = TypeOf(expr->rhs)->UnwrapRef(); + if (!EmitTypeAndName(decl, ty, ast::StorageClass::kNone, + ast::Access::kUndefined, "rhs")) { + return ""; + } + } + decl << " {"; + } + { + ScopedIndent si(&b); + line(&b) << "return (lhs - rhs * trunc(lhs / rhs));"; + } + line(&b) << "}"; + line(&b); + return fn_name; + }); if (fn.empty()) { return false; @@ -576,7 +608,7 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, const ast::BinaryExpression* e return EmitFloatModulo(out, expr); } - out << "("; + ScopedParen sp(out); if (!EmitExpression(out, expr->lhs)) { return false; } @@ -652,11 +684,10 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, const ast::BinaryExpression* e return false; } - out << ")"; return true; } -bool GeneratorImpl::EmitStatements(const ast::StatementList& stmts) { +bool GeneratorImpl::EmitStatements(utils::VectorRef stmts) { for (auto* s : stmts) { if (!EmitStatement(s)) { return false; @@ -665,7 +696,7 @@ bool GeneratorImpl::EmitStatements(const ast::StatementList& stmts) { return true; } -bool GeneratorImpl::EmitStatementsWithIndent(const ast::StatementList& stmts) { +bool GeneratorImpl::EmitStatementsWithIndent(utils::VectorRef stmts) { ScopedIndent si(this); return EmitStatements(stmts); } @@ -685,7 +716,7 @@ bool GeneratorImpl::EmitBreak(const ast::BreakStatement*) { } bool GeneratorImpl::EmitCall(std::ostream& out, const ast::CallExpression* expr) { - auto* call = builder_.Sem().Get(expr); + auto* call = builder_.Sem().Get(expr); auto* target = call->Target(); if (target->Is()) { @@ -712,7 +743,8 @@ bool GeneratorImpl::EmitFunctionCall(std::ostream& out, const sem::Call* call) { auto name = builder_.Symbols().NameFor(ident->symbol); auto caller_sym = ident->symbol; - out << name << "("; + out << name; + ScopedParen sp(out); bool first = true; for (auto* arg : args) { @@ -726,7 +758,6 @@ bool GeneratorImpl::EmitFunctionCall(std::ostream& out, const sem::Call* call) { } } - out << ")"; return true; } @@ -791,7 +822,8 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out, return false; } - out << name << "("; + out << name; + ScopedParen sp(out); bool first = true; for (auto* arg : call->Arguments()) { @@ -805,7 +837,6 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out, } } - out << ")"; return true; } @@ -815,13 +846,12 @@ bool GeneratorImpl::EmitTypeConversion(std::ostream& out, if (!EmitType(out, conv->Target(), ast::StorageClass::kNone, ast::Access::kReadWrite, "")) { return false; } - out << "("; + ScopedParen sp(out); if (!EmitExpression(out, call->Arguments()[0]->Declaration())) { return false; } - out << ")"; return true; } @@ -832,19 +862,14 @@ bool GeneratorImpl::EmitTypeConstructor(std::ostream& out, // If the type constructor is empty then we need to construct with the zero // value for all components. - if (call->Arguments().empty()) { + if (call->Arguments().IsEmpty()) { return EmitZeroValue(out, type); } - auto it = structure_builders_.find(As(type)); - if (it != structure_builders_.end()) { - out << it->second << "("; - } else { - if (!EmitType(out, type, ast::StorageClass::kNone, ast::Access::kReadWrite, "")) { - return false; - } - out << "("; + if (!EmitType(out, type, ast::StorageClass::kNone, ast::Access::kReadWrite, "")) { + return false; } + ScopedParen sp(out); bool first = true; for (auto* arg : call->Arguments()) { @@ -858,7 +883,6 @@ bool GeneratorImpl::EmitTypeConstructor(std::ostream& out, } } - out << ")"; return true; } @@ -869,7 +893,7 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out, out << name; { ScopedParen sp(out); - for (size_t i = 0; i < expr->args.size(); i++) { + for (size_t i = 0; i < expr->args.Length(); i++) { auto* arg = expr->args[i]; if (i > 0) { out << ", "; @@ -900,39 +924,56 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out, return true; } case sem::BuiltinType::kAtomicCompareExchangeWeak: { - return CallBuiltinHelper( - out, expr, builtin, [&](TextBuffer* b, const std::vector& params) { - { - auto pre = line(b); - if (!EmitTypeAndName(pre, builtin->ReturnType(), ast::StorageClass::kNone, - ast::Access::kUndefined, "result")) { - return false; - } - pre << ";"; + // Emit the builtin return type unique to this overload. This does not + // exist in the AST, so it will not be generated in Generate(). + if (!EmitStructTypeOnce(&helpers_, builtin->ReturnType()->As())) { + return false; + } + + auto* dest = expr->args[0]; + auto* compare_value = expr->args[1]; + auto* value = expr->args[2]; + + std::string result = UniqueIdentifier("atomic_compare_result"); + + { + auto pre = line(); + if (!EmitTypeAndName(pre, builtin->ReturnType(), ast::StorageClass::kNone, + ast::Access::kUndefined, result)) { + return false; + } + pre << ";"; + } + { + auto pre = line(); + pre << result << ".old_value = atomicCompSwap"; + { + ScopedParen sp(pre); + if (!EmitExpression(pre, dest)) { + return false; } - { - auto pre = line(b); - pre << "result.x = atomicCompSwap"; - { - ScopedParen sp(pre); - pre << params[0]; - pre << ", " << params[1]; - pre << ", " << params[2]; - } - pre << ";"; + pre << ", "; + if (!EmitExpression(pre, compare_value)) { + return false; } - { - auto pre = line(b); - pre << "result.y = result.x == " << params[2] << " ? "; - if (TypeOf(expr->args[2])->Is()) { - pre << "1u : 0u;"; - } else { - pre << "1 : 0;"; - } + pre << ", "; + if (!EmitExpression(pre, value)) { + return false; } - line(b) << "return result;"; - return true; - }); + } + pre << ";"; + } + { + auto pre = line(); + pre << result << ".exchanged = " << result << ".old_value == "; + if (!EmitExpression(pre, compare_value)) { + return false; + } + pre << ";"; + } + + out << result; + return true; } case sem::BuiltinType::kAtomicAdd: @@ -1148,7 +1189,9 @@ bool GeneratorImpl::EmitDotCall(std::ostream& out, } } - out << fn << "("; + out << fn; + ScopedParen sp(out); + if (!EmitExpression(out, expr->args[0])) { return false; } @@ -1156,104 +1199,57 @@ bool GeneratorImpl::EmitDotCall(std::ostream& out, if (!EmitExpression(out, expr->args[1])) { return false; } - out << ")"; return true; } bool GeneratorImpl::EmitModfCall(std::ostream& out, const ast::CallExpression* expr, const sem::Builtin* builtin) { - if (expr->args.size() == 1) { - return CallBuiltinHelper( - out, expr, builtin, [&](TextBuffer* b, const std::vector& params) { - // Emit the builtin return type unique to this overload. This does not - // exist in the AST, so it will not be generated in Generate(). - if (!EmitStructType(&helpers_, builtin->ReturnType()->As())) { + TINT_ASSERT(Writer, expr->args.Length() == 1); + return CallBuiltinHelper( + out, expr, builtin, [&](TextBuffer* b, const std::vector& params) { + // Emit the builtin return type unique to this overload. This does not + // exist in the AST, so it will not be generated in Generate(). + if (!EmitStructType(&helpers_, builtin->ReturnType()->As())) { + return false; + } + + { + auto l = line(b); + if (!EmitType(l, builtin->ReturnType(), ast::StorageClass::kNone, + ast::Access::kUndefined, "")) { return false; } - - { - auto l = line(b); - if (!EmitType(l, builtin->ReturnType(), ast::StorageClass::kNone, - ast::Access::kUndefined, "")) { - return false; - } - l << " result;"; - } - line(b) << "result.fract = modf(" << params[0] << ", result.whole);"; - line(b) << "return result;"; - return true; - }); - } - - // DEPRECATED - out << "modf"; - ScopedParen sp(out); - if (!EmitExpression(out, expr->args[0])) { - return false; - } - out << ", "; - if (!EmitExpression(out, expr->args[1])) { - return false; - } - return true; + l << " result;"; + } + line(b) << "result.fract = modf(" << params[0] << ", result.whole);"; + line(b) << "return result;"; + return true; + }); } bool GeneratorImpl::EmitFrexpCall(std::ostream& out, const ast::CallExpression* expr, const sem::Builtin* builtin) { - if (expr->args.size() == 1) { - return CallBuiltinHelper( - out, expr, builtin, [&](TextBuffer* b, const std::vector& params) { - // Emit the builtin return type unique to this overload. This does not - // exist in the AST, so it will not be generated in Generate(). - if (!EmitStructType(&helpers_, builtin->ReturnType()->As())) { - return false; - } - - { - auto l = line(b); - if (!EmitType(l, builtin->ReturnType(), ast::StorageClass::kNone, - ast::Access::kUndefined, "")) { - return false; - } - l << " result;"; - } - line(b) << "result.sig = frexp(" << params[0] << ", result.exp);"; - line(b) << "return result;"; - return true; - }); - } - // DEPRECATED - // Exponent is an integer in WGSL, but HLSL wants a float. - // We need to make the call with a temporary float, and then cast. + TINT_ASSERT(Writer, expr->args.Length() == 1); return CallBuiltinHelper( out, expr, builtin, [&](TextBuffer* b, const std::vector& params) { - auto* significand_ty = builtin->Parameters()[0]->Type(); - auto significand = params[0]; - auto* exponent_ty = builtin->Parameters()[1]->Type(); - auto exponent = params[1]; - - std::string width; - if (auto* vec = significand_ty->As()) { - width = std::to_string(vec->Width()); + // Emit the builtin return type unique to this overload. This does not + // exist in the AST, so it will not be generated in Generate(). + if (!EmitStructType(&helpers_, builtin->ReturnType()->As())) { + return false; } - // Exponent is an integer, which HLSL does not have an overload for. - // We need to cast from a float. - line(b) << "float" << width << " float_exp;"; - line(b) << "float" << width << " significand = frexp(" << significand - << ", float_exp);"; { auto l = line(b); - l << exponent << " = "; - if (!EmitType(l, exponent_ty->UnwrapPtr(), ast::StorageClass::kNone, + if (!EmitType(l, builtin->ReturnType(), ast::StorageClass::kNone, ast::Access::kUndefined, "")) { return false; } - l << "(float_exp);"; + l << " result;"; } - line(b) << "return significand;"; + line(b) << "result.sig = frexp(" << params[0] << ", result.exp);"; + line(b) << "return result;"; return true; }); } @@ -1261,10 +1257,12 @@ bool GeneratorImpl::EmitFrexpCall(std::ostream& out, bool GeneratorImpl::EmitDegreesCall(std::ostream& out, const ast::CallExpression* expr, const sem::Builtin* builtin) { + auto* return_elem_type = sem::Type::DeepestElementOf(builtin->ReturnType()); + const std::string suffix = Is(return_elem_type) ? "hf" : "f"; return CallBuiltinHelper(out, expr, builtin, [&](TextBuffer* b, const std::vector& params) { line(b) << "return " << params[0] << " * " << std::setprecision(20) - << sem::kRadToDeg << ";"; + << sem::kRadToDeg << suffix << ";"; return true; }); } @@ -1272,10 +1270,12 @@ bool GeneratorImpl::EmitDegreesCall(std::ostream& out, bool GeneratorImpl::EmitRadiansCall(std::ostream& out, const ast::CallExpression* expr, const sem::Builtin* builtin) { + auto* return_elem_type = sem::Type::DeepestElementOf(builtin->ReturnType()); + const std::string suffix = Is(return_elem_type) ? "hf" : "f"; return CallBuiltinHelper(out, expr, builtin, [&](TextBuffer* b, const std::vector& params) { line(b) << "return " << params[0] << " * " << std::setprecision(20) - << sem::kDegToRad << ";"; + << sem::kDegToRad << suffix << ";"; return true; }); } @@ -1296,9 +1296,10 @@ bool GeneratorImpl::EmitBarrierCall(std::ostream& out, const sem::Builtin* built } const ast::Expression* GeneratorImpl::CreateF32Zero(const sem::Statement* stmt) { - auto* zero = builder_.Expr(0.0f); + auto* zero = builder_.Expr(0_f); auto* f32 = builder_.create(); - auto* sem_zero = builder_.create(zero, f32, stmt, sem::Constant{}, + auto* sem_zero = builder_.create(zero, f32, sem::EvaluationStage::kRuntime, + stmt, /* constant_value */ nullptr, /* has_side_effects */ false); builder_.Sem().Add(zero, sem_zero); return zero; @@ -1315,8 +1316,8 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, // Returns the argument with the given usage auto arg = [&](Usage usage) { - int idx = signature.IndexOf(usage); - return (idx >= 0) ? arguments[idx] : nullptr; + auto idx = signature.IndexOf(usage); + return (idx >= 0) ? arguments[static_cast(idx)] : nullptr; }; auto* texture = arg(Usage::kTexture); @@ -1459,8 +1460,9 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, out << "("; - if (!EmitExpression(out, texture)) + if (!EmitExpression(out, texture)) { return false; + } out << ", "; @@ -1572,10 +1574,13 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) { switch (builtin->Type()) { case sem::BuiltinType::kAbs: case sem::BuiltinType::kAcos: + case sem::BuiltinType::kAcosh: case sem::BuiltinType::kAll: case sem::BuiltinType::kAny: case sem::BuiltinType::kAsin: + case sem::BuiltinType::kAsinh: case sem::BuiltinType::kAtan: + case sem::BuiltinType::kAtanh: case sem::BuiltinType::kCeil: case sem::BuiltinType::kClamp: case sem::BuiltinType::kCos: @@ -1665,7 +1670,6 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) { case sem::BuiltinType::kReverseBits: return "bitfieldReverse"; case sem::BuiltinType::kSmoothstep: - case sem::BuiltinType::kSmoothStep: return "smoothstep"; case sem::BuiltinType::kUnpack2x16float: return "unpackHalf2x16"; @@ -1696,7 +1700,7 @@ bool GeneratorImpl::EmitCase(const ast::CaseStatement* stmt) { return false; } out << ":"; - if (selector == stmt->selectors.back()) { + if (selector == stmt->selectors.Back()) { out << " {"; } } @@ -1718,7 +1722,7 @@ bool GeneratorImpl::EmitCase(const ast::CaseStatement* stmt) { } bool GeneratorImpl::EmitContinue(const ast::ContinueStatement*) { - if (!emit_continuing_()) { + if (!emit_continuing_ || !emit_continuing_()) { return false; } line() << "continue;"; @@ -1733,34 +1737,26 @@ bool GeneratorImpl::EmitDiscard(const ast::DiscardStatement*) { } bool GeneratorImpl::EmitExpression(std::ostream& out, const ast::Expression* expr) { - if (auto* a = expr->As()) { - return EmitIndexAccessor(out, a); + if (auto* sem = builder_.Sem().Get(expr)) { + if (auto* constant = sem->ConstantValue()) { + return EmitConstant(out, constant); + } } - if (auto* b = expr->As()) { - return EmitBinary(out, b); - } - if (auto* b = expr->As()) { - return EmitBitcast(out, b); - } - if (auto* c = expr->As()) { - return EmitCall(out, c); - } - if (auto* i = expr->As()) { - return EmitIdentifier(out, i); - } - if (auto* l = expr->As()) { - return EmitLiteral(out, l); - } - if (auto* m = expr->As()) { - return EmitMemberAccessor(out, m); - } - if (auto* u = expr->As()) { - return EmitUnaryOp(out, u); - } - - diagnostics_.add_error(diag::System::Writer, - "unknown expression type: " + std::string(expr->TypeInfo().name)); - return false; + return Switch( + expr, // + [&](const ast::IndexAccessorExpression* a) { return EmitIndexAccessor(out, a); }, + [&](const ast::BinaryExpression* b) { return EmitBinary(out, b); }, + [&](const ast::BitcastExpression* b) { return EmitBitcast(out, b); }, + [&](const ast::CallExpression* c) { return EmitCall(out, c); }, + [&](const ast::IdentifierExpression* i) { return EmitIdentifier(out, i); }, + [&](const ast::LiteralExpression* l) { return EmitLiteral(out, l); }, + [&](const ast::MemberAccessorExpression* m) { return EmitMemberAccessor(out, m); }, + [&](const ast::UnaryOpExpression* u) { return EmitUnaryOp(out, u); }, + [&](Default) { // + diagnostics_.add_error(diag::System::Writer, "unknown expression type: " + + std::string(expr->TypeInfo().name)); + return false; + }); } bool GeneratorImpl::EmitIdentifier(std::ostream& out, const ast::IdentifierExpression* expr) { @@ -1789,7 +1785,7 @@ bool GeneratorImpl::EmitIf(const ast::IfStatement* stmt) { return false; } } else { - if (!EmitStatementsWithIndent({stmt->else_statement})) { + if (!EmitStatementsWithIndent(utils::Vector{stmt->else_statement})) { return false; } } @@ -1861,81 +1857,93 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) { } bool GeneratorImpl::EmitGlobalVariable(const ast::Variable* global) { - if (global->is_const) { - return EmitProgramConstVariable(global); - } - - auto* sem = builder_.Sem().Get(global); - switch (sem->StorageClass()) { - case ast::StorageClass::kUniform: - return EmitUniformVariable(sem); - case ast::StorageClass::kStorage: - return EmitStorageVariable(sem); - case ast::StorageClass::kHandle: - return EmitHandleVariable(sem); - case ast::StorageClass::kPrivate: - return EmitPrivateVariable(sem); - case ast::StorageClass::kWorkgroup: - return EmitWorkgroupVariable(sem); - case ast::StorageClass::kInput: - case ast::StorageClass::kOutput: - return EmitIOVariable(sem); - default: - break; - } - - TINT_ICE(Writer, diagnostics_) << "unhandled storage class " << sem->StorageClass(); - return false; + return Switch( + global, // + [&](const ast::Var* var) { + auto* sem = builder_.Sem().Get(global); + switch (sem->StorageClass()) { + case ast::StorageClass::kUniform: + return EmitUniformVariable(var, sem); + case ast::StorageClass::kStorage: + return EmitStorageVariable(var, sem); + case ast::StorageClass::kHandle: + return EmitHandleVariable(var, sem); + case ast::StorageClass::kPrivate: + return EmitPrivateVariable(sem); + case ast::StorageClass::kWorkgroup: + return EmitWorkgroupVariable(sem); + case ast::StorageClass::kIn: + case ast::StorageClass::kOut: + return EmitIOVariable(sem); + case ast::StorageClass::kPushConstant: + diagnostics_.add_error( + diag::System::Writer, + "unhandled storage class " + utils::ToString(sem->StorageClass())); + return false; + default: { + TINT_ICE(Writer, diagnostics_) + << "unhandled storage class " << sem->StorageClass(); + return false; + } + } + }, + [&](const ast::Let* let) { return EmitProgramConstVariable(let); }, + [&](const ast::Override* override) { return EmitOverride(override); }, + [&](const ast::Const*) { + return true; // Constants are embedded at their use + }, + [&](Default) { + TINT_ICE(Writer, diagnostics_) + << "unhandled global variable type " << global->TypeInfo().name; + return false; + }); } -bool GeneratorImpl::EmitUniformVariable(const sem::Variable* var) { - auto* decl = var->Declaration(); - auto* type = var->Type()->UnwrapRef(); +bool GeneratorImpl::EmitUniformVariable(const ast::Var* var, const sem::Variable* sem) { + auto* type = sem->Type()->UnwrapRef(); auto* str = type->As(); if (!str) { TINT_ICE(Writer, builder_.Diagnostics()) << "storage variable must be of struct type"; return false; } - ast::VariableBindingPoint bp = decl->BindingPoint(); + auto bp = sem->As()->BindingPoint(); { auto out = line(); - out << "layout(binding = " << bp.binding->value; + out << "layout(binding = " << bp.binding; if (version_.IsDesktop()) { out << ", std140"; } out << ") uniform " << UniqueIdentifier(StructName(str)) << " {"; } EmitStructMembers(current_buffer_, str, /* emit_offsets */ true); - auto name = builder_.Symbols().NameFor(decl->symbol); + auto name = builder_.Symbols().NameFor(var->symbol); line() << "} " << name << ";"; line(); return true; } -bool GeneratorImpl::EmitStorageVariable(const sem::Variable* var) { - auto* decl = var->Declaration(); - auto* type = var->Type()->UnwrapRef(); +bool GeneratorImpl::EmitStorageVariable(const ast::Var* var, const sem::Variable* sem) { + auto* type = sem->Type()->UnwrapRef(); auto* str = type->As(); if (!str) { TINT_ICE(Writer, builder_.Diagnostics()) << "storage variable must be of struct type"; return false; } - ast::VariableBindingPoint bp = decl->BindingPoint(); - line() << "layout(binding = " << bp.binding->value << ", std430) buffer " + auto bp = sem->As()->BindingPoint(); + line() << "layout(binding = " << bp.binding << ", std430) buffer " << UniqueIdentifier(StructName(str)) << " {"; EmitStructMembers(current_buffer_, str, /* emit_offsets */ true); - auto name = builder_.Symbols().NameFor(decl->symbol); + auto name = builder_.Symbols().NameFor(var->symbol); line() << "} " << name << ";"; return true; } -bool GeneratorImpl::EmitHandleVariable(const sem::Variable* var) { - auto* decl = var->Declaration(); +bool GeneratorImpl::EmitHandleVariable(const ast::Var* var, const sem::Variable* sem) { auto out = line(); - auto name = builder_.Symbols().NameFor(decl->symbol); - auto* type = var->Type()->UnwrapRef(); + auto name = builder_.Symbols().NameFor(var->symbol); + auto* type = sem->Type()->UnwrapRef(); if (type->Is()) { // GLSL ignores Sampler variables. return true; @@ -1943,7 +1951,7 @@ bool GeneratorImpl::EmitHandleVariable(const sem::Variable* var) { if (auto* storage = type->As()) { out << "layout(" << convert_texel_format_to_glsl(storage->texel_format()) << ") "; } - if (!EmitTypeAndName(out, type, var->StorageClass(), var->Access(), name)) { + if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(), name)) { return false; } @@ -2032,8 +2040,9 @@ bool GeneratorImpl::EmitIOVariable(const sem::Variable* var) { return true; } -void GeneratorImpl::EmitInterpolationQualifiers(std::ostream& out, - const ast::AttributeList& attributes) { +void GeneratorImpl::EmitInterpolationQualifiers( + std::ostream& out, + utils::VectorRef attributes) { for (auto* attr : attributes) { if (auto* interpolate = attr->As()) { switch (interpolate->type) { @@ -2057,8 +2066,9 @@ void GeneratorImpl::EmitInterpolationQualifiers(std::ostream& out, } } -bool GeneratorImpl::EmitAttributes(std::ostream& out, const ast::AttributeList& attributes) { - if (attributes.empty()) { +bool GeneratorImpl::EmitAttributes(std::ostream& out, + utils::VectorRef attributes) { + if (attributes.IsEmpty()) { return true; } bool first = true; @@ -2087,7 +2097,7 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { // Emit the layout(local_size) attributes. auto wgsize = func_sem->WorkgroupSize(); out << "layout("; - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { if (i > 0) { out << ", "; } @@ -2095,11 +2105,11 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { if (wgsize[i].overridable_const) { auto* global = builder_.Sem().Get(wgsize[i].overridable_const); - if (!global->IsOverridable()) { + if (!global->Declaration()->Is()) { TINT_ICE(Writer, builder_.Diagnostics()) << "expected a pipeline-overridable constant"; } - out << kSpecConstantPrefix << global->ConstantId(); + out << kSpecConstantPrefix << global->OverrideId().value; } else { out << std::to_string(wgsize[i].value); } @@ -2151,7 +2161,7 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { } if (!Is(func->body->Last())) { - ast::ReturnStatement ret(ProgramID(), Source{}); + ast::ReturnStatement ret(ProgramID{}, ast::NodeID{}, Source{}); if (!EmitStatement(&ret)) { return false; } @@ -2163,6 +2173,108 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { return true; } +bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constant) { + return Switch( + constant->Type(), // + [&](const sem::Bool*) { + out << (constant->As() ? "true" : "false"); + return true; + }, + [&](const sem::F32*) { + PrintF32(out, constant->As()); + return true; + }, + [&](const sem::F16*) { return PrintF16(out, constant->As()); }, + [&](const sem::I32*) { + out << constant->As(); + return true; + }, + [&](const sem::U32*) { + out << constant->As() << "u"; + return true; + }, + [&](const sem::Vector* v) { + if (!EmitType(out, v, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { + return false; + } + + ScopedParen sp(out); + + if (constant->AllEqual()) { + return EmitConstant(out, constant->Index(0)); + } + + for (size_t i = 0; i < v->Width(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + return true; + }, + [&](const sem::Matrix* m) { + if (!EmitType(out, m, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { + return false; + } + + ScopedParen sp(out); + + for (size_t column_idx = 0; column_idx < m->columns(); column_idx++) { + if (column_idx > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(column_idx))) { + return false; + } + } + return true; + }, + [&](const sem::Array* a) { + if (!EmitType(out, a, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { + return false; + } + + ScopedParen sp(out); + + for (size_t i = 0; i < a->Count(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + + return true; + }, + [&](const sem::Struct* s) { + if (!EmitType(out, s, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { + return false; + } + + ScopedParen sp(out); + + for (size_t i = 0; i < s->Members().size(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + + return true; + }, + [&](Default) { + diagnostics_.add_error( + diag::System::Writer, + "unhandled constant type: " + builder_.FriendlyName(constant->Type())); + return false; + }); +} + bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* lit) { return Switch( lit, @@ -2171,14 +2283,10 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* return true; }, [&](const ast::FloatLiteralExpression* l) { - if (std::isinf(l->value)) { - out << (l->value >= 0 ? "uintBitsToFloat(0x7f800000u)" - : "uintBitsToFloat(0xff800000u)"); - } else if (std::isnan(l->value)) { - out << "uintBitsToFloat(0x7fc00000u)"; - } else { - out << FloatToString(l->value) << "f"; + if (l->suffix == ast::FloatLiteralExpression::Suffix::kH) { + return PrintF16(out, static_cast(l->value)); } + PrintF32(out, static_cast(l->value)); return true; }, [&](const ast::IntLiteralExpression* l) { @@ -2199,6 +2307,8 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) { out << "false"; } else if (type->Is()) { out << "0.0f"; + } else if (type->Is()) { + out << "0.0hf"; } else if (type->Is()) { out << "0"; } else if (type->Is()) { @@ -2234,7 +2344,7 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) { return false; } bool first = true; - out << "("; + ScopedParen sp(out); for (auto* member : str->Members()) { if (!first) { out << ", "; @@ -2243,19 +2353,17 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) { } EmitZeroValue(out, member->Type()); } - out << ")"; } else if (auto* array = type->As()) { if (!EmitType(out, type, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { return false; } - out << "("; + ScopedParen sp(out); for (uint32_t i = 0; i < array->Count(); i++) { if (i != 0) { out << ", "; } EmitZeroValue(out, array->ElemType()); } - out << ")"; } else { diagnostics_.add_error(diag::System::Writer, "Invalid type for zero emission: " + type->FriendlyName(builder_.Symbols())); @@ -2399,6 +2507,57 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) { return true; } +bool GeneratorImpl::EmitWhile(const ast::WhileStatement* stmt) { + TextBuffer cond_pre; + std::stringstream cond_buf; + { + auto* cond = stmt->condition; + TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre); + if (!EmitExpression(cond_buf, cond)) { + return false; + } + } + + auto emit_continuing = [&]() { return true; }; + TINT_SCOPED_ASSIGNMENT(emit_continuing_, emit_continuing); + + // If the whilehas a multi-statement conditional, then we cannot emit this + // as a regular while in GLSL. Instead we need to generate a `while(true)` loop. + bool emit_as_loop = cond_pre.lines.size() > 0; + if (emit_as_loop) { + line() << "while (true) {"; + increment_indent(); + TINT_DEFER({ + decrement_indent(); + line() << "}"; + }); + + current_buffer_->Append(cond_pre); + line() << "if (!(" << cond_buf.str() << ")) { break; }"; + + if (!EmitStatements(stmt->body->statements)) { + return false; + } + } else { + // While can be generated. + { + auto out = line(); + out << "while"; + { + ScopedParen sp(out); + out << cond_buf.str(); + } + out << " {"; + } + if (!EmitStatementsWithIndent(stmt->body->statements)) { + return false; + } + line() << "}"; + } + + return true; +} + bool GeneratorImpl::EmitMemberAccessor(std::ostream& out, const ast::MemberAccessorExpression* expr) { if (!EmitExpression(out, expr->structure)) { @@ -2431,55 +2590,53 @@ bool GeneratorImpl::EmitReturn(const ast::ReturnStatement* stmt) { } bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { - if (auto* a = stmt->As()) { - return EmitAssign(a); - } - if (auto* b = stmt->As()) { - return EmitBlock(b); - } - if (auto* b = stmt->As()) { - return EmitBreak(b); - } - if (auto* c = stmt->As()) { - auto out = line(); - if (!EmitCall(out, c->expr)) { + return Switch( + stmt, // + [&](const ast::AssignmentStatement* a) { return EmitAssign(a); }, + [&](const ast::BlockStatement* b) { return EmitBlock(b); }, + [&](const ast::BreakStatement* b) { return EmitBreak(b); }, + [&](const ast::CallStatement* c) { + auto out = line(); + if (!EmitCall(out, c->expr)) { + return false; + } + out << ";"; + return true; + }, + [&](const ast::ContinueStatement* c) { return EmitContinue(c); }, + [&](const ast::DiscardStatement* d) { return EmitDiscard(d); }, + [&](const ast::FallthroughStatement*) { + line() << "/* fallthrough */"; + return true; + }, + [&](const ast::IfStatement* i) { return EmitIf(i); }, + [&](const ast::LoopStatement* l) { return EmitLoop(l); }, + [&](const ast::ForLoopStatement* l) { return EmitForLoop(l); }, + [&](const ast::WhileStatement* l) { return EmitWhile(l); }, + [&](const ast::ReturnStatement* r) { return EmitReturn(r); }, + [&](const ast::SwitchStatement* s) { return EmitSwitch(s); }, + [&](const ast::VariableDeclStatement* v) { + return Switch( + v->variable, // + [&](const ast::Var* var) { return EmitVar(var); }, + [&](const ast::Let* let) { return EmitLet(let); }, + [&](const ast::Const*) { + return true; // Constants are embedded at their use + }, + [&](Default) { // + TINT_ICE(Writer, diagnostics_) + << "unknown variable type: " << v->variable->TypeInfo().name; + return false; + }); + }, + [&](const ast::StaticAssert*) { + return true; // Not emitted + }, + [&](Default) { + diagnostics_.add_error(diag::System::Writer, + "unknown statement type: " + std::string(stmt->TypeInfo().name)); return false; - } - out << ";"; - return true; - } - if (auto* c = stmt->As()) { - return EmitContinue(c); - } - if (auto* d = stmt->As()) { - return EmitDiscard(d); - } - if (stmt->As()) { - line() << "/* fallthrough */"; - return true; - } - if (auto* i = stmt->As()) { - return EmitIf(i); - } - if (auto* l = stmt->As()) { - return EmitLoop(l); - } - if (auto* l = stmt->As()) { - return EmitForLoop(l); - } - if (auto* r = stmt->As()) { - return EmitReturn(r); - } - if (auto* s = stmt->As()) { - return EmitSwitch(s); - } - if (auto* v = stmt->As()) { - return EmitVariable(v->variable); - } - - diagnostics_.add_error(diag::System::Writer, - "unknown statement type: " + std::string(stmt->TypeInfo().name)); - return false; + }); } bool GeneratorImpl::EmitSwitch(const ast::SwitchStatement* stmt) { @@ -2516,11 +2673,11 @@ bool GeneratorImpl::EmitType(std::ostream& out, *name_printed = false; } switch (storage_class) { - case ast::StorageClass::kInput: { + case ast::StorageClass::kIn: { out << "in "; break; } - case ast::StorageClass::kOutput: { + case ast::StorageClass::kOut: { out << "out "; break; } @@ -2560,10 +2717,15 @@ bool GeneratorImpl::EmitType(std::ostream& out, out << "bool"; } else if (type->Is()) { out << "float"; + } else if (type->Is()) { + out << "float16_t"; } else if (type->Is()) { out << "int"; } else if (auto* mat = type->As()) { - TINT_ASSERT(Writer, mat->type()->Is()); + TINT_ASSERT(Writer, (mat->type()->IsAnyOf())); + if (mat->type()->Is()) { + out << "f16"; + } out << "mat" << mat->columns(); if (mat->rows() != mat->columns()) { out << "x" << mat->rows(); @@ -2642,6 +2804,8 @@ bool GeneratorImpl::EmitType(std::ostream& out, auto width = vec->Width(); if (vec->type()->Is() && width >= 1 && width <= 4) { out << "vec" << width; + } else if (vec->type()->Is() && width >= 1 && width <= 4) { + out << "f16vec" << width; } else if (vec->type()->Is() && width >= 1 && width <= 4) { out << "ivec" << width; } else if (vec->type()->Is() && width >= 1 && width <= 4) { @@ -2694,6 +2858,14 @@ bool GeneratorImpl::EmitStructType(TextBuffer* b, const sem::Struct* str) { return true; } +bool GeneratorImpl::EmitStructTypeOnce(TextBuffer* buffer, const sem::Struct* str) { + auto it = emitted_structs_.emplace(str); + if (!it.second) { + return true; + } + return EmitStructType(buffer, str); +} + bool GeneratorImpl::EmitStructMembers(TextBuffer* b, const sem::Struct* str, bool emit_offsets) { ScopedIndent si(b); for (auto* mem : str->Members()) { @@ -2734,29 +2906,20 @@ bool GeneratorImpl::EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression* out << "-"; break; } - out << "("; + ScopedParen sp(out); if (!EmitExpression(out, expr->expr)) { return false; } - out << ")"; - return true; } -bool GeneratorImpl::EmitVariable(const ast::Variable* var) { +bool GeneratorImpl::EmitVar(const ast::Var* var) { auto* sem = builder_.Sem().Get(var); auto* type = sem->Type()->UnwrapRef(); - // TODO(dsinclair): Handle variable attributes - if (!var->attributes.empty()) { - diagnostics_.add_error(diag::System::Writer, "Variable attributes are not handled yet"); - return false; - } - auto out = line(); - // TODO(senorblanco): handle const if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(), builder_.Symbols().NameFor(var->symbol))) { return false; @@ -2778,58 +2941,74 @@ bool GeneratorImpl::EmitVariable(const ast::Variable* var) { return true; } -bool GeneratorImpl::EmitProgramConstVariable(const ast::Variable* var) { - for (auto* d : var->attributes) { - if (!d->Is()) { - diagnostics_.add_error(diag::System::Writer, "Decorated const values not valid"); - return false; - } - } - if (!var->is_const) { - diagnostics_.add_error(diag::System::Writer, "Expected a const value"); +bool GeneratorImpl::EmitLet(const ast::Let* let) { + auto* sem = builder_.Sem().Get(let); + auto* type = sem->Type()->UnwrapRef(); + + auto out = line(); + // TODO(senorblanco): handle const + if (!EmitTypeAndName(out, type, ast::StorageClass::kNone, ast::Access::kUndefined, + builder_.Symbols().NameFor(let->symbol))) { return false; } + out << " = "; + + if (!EmitExpression(out, let->constructor)) { + return false; + } + + out << ";"; + + return true; +} + +bool GeneratorImpl::EmitProgramConstVariable(const ast::Variable* var) { auto* sem = builder_.Sem().Get(var); auto* type = sem->Type(); + auto out = line(); + out << "const "; + if (!EmitTypeAndName(out, type, ast::StorageClass::kNone, ast::Access::kUndefined, + builder_.Symbols().NameFor(var->symbol))) { + return false; + } + out << " = "; + if (!EmitExpression(out, var->constructor)) { + return false; + } + out << ";"; + + return true; +} + +bool GeneratorImpl::EmitOverride(const ast::Override* override) { + auto* sem = builder_.Sem().Get(override); + auto* type = sem->Type(); + auto* global = sem->As(); - if (global && global->IsOverridable()) { - auto const_id = global->ConstantId(); + auto override_id = global->OverrideId(); - line() << "#ifndef " << kSpecConstantPrefix << const_id; + line() << "#ifndef " << kSpecConstantPrefix << override_id.value; - if (var->constructor != nullptr) { - auto out = line(); - out << "#define " << kSpecConstantPrefix << const_id << " "; - if (!EmitExpression(out, var->constructor)) { - return false; - } - } else { - line() << "#error spec constant required for constant id " << const_id; - } - line() << "#endif"; - { - auto out = line(); - out << "const "; - if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(), - builder_.Symbols().NameFor(var->symbol))) { - return false; - } - out << " = " << kSpecConstantPrefix << const_id << ";"; + if (override->constructor != nullptr) { + auto out = line(); + out << "#define " << kSpecConstantPrefix << override_id.value << " "; + if (!EmitExpression(out, override->constructor)) { + return false; } } else { + line() << "#error spec constant required for constant id " << override_id.value; + } + line() << "#endif"; + { auto out = line(); out << "const "; - if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(), - builder_.Symbols().NameFor(var->symbol))) { + if (!EmitTypeAndName(out, type, ast::StorageClass::kNone, ast::Access::kUndefined, + builder_.Symbols().NameFor(override->symbol))) { return false; } - out << " = "; - if (!EmitExpression(out, var->constructor)) { - return false; - } - out << ";"; + out << " = " << kSpecConstantPrefix << override_id.value << ";"; } return true; diff --git a/src/tint/writer/glsl/generator_impl.h b/src/tint/writer/glsl/generator_impl.h index 72def34c62..502df8b245 100644 --- a/src/tint/writer/glsl/generator_impl.h +++ b/src/tint/writer/glsl/generator_impl.h @@ -16,6 +16,7 @@ #define SRC_TINT_WRITER_GLSL_GENERATOR_IMPL_H_ #include +#include #include #include #include @@ -42,6 +43,7 @@ // Forward declarations namespace tint::sem { class Call; +class Constant; class Builtin; class TypeConstructor; class TypeConversion; @@ -124,11 +126,11 @@ class GeneratorImpl : public TextGenerator { /// Emits a list of statements /// @param stmts the statement list /// @returns true if the statements were emitted successfully - bool EmitStatements(const ast::StatementList& stmts); + bool EmitStatements(utils::VectorRef stmts); /// Emits a list of statements with an indentation /// @param stmts the statement list /// @returns true if the statements were emitted successfully - bool EmitStatementsWithIndent(const ast::StatementList& stmts); + bool EmitStatementsWithIndent(utils::VectorRef stmts); /// Handles a block statement /// @param stmt the statement to emit /// @returns true if the statement was emitted successfully @@ -174,14 +176,6 @@ class GeneratorImpl : public TextGenerator { /// @param builtin the semantic information for the barrier builtin /// @returns true if the call expression is emitted bool EmitBarrierCall(std::ostream& out, const sem::Builtin* builtin); - /// Handles generating an atomic intrinsic call for a storage buffer variable - /// @param out the output of the expression stream - /// @param expr the call expression - /// @param intrinsic the atomic intrinsic - /// @returns true if the call expression is emitted - bool EmitStorageAtomicCall(std::ostream& out, - const ast::CallExpression* expr, - const transform::DecomposeMemoryAccess::Intrinsic* intrinsic); /// Handles generating an atomic builtin call for a workgroup variable /// @param out the output of the expression stream /// @param expr the call expression @@ -300,19 +294,22 @@ class GeneratorImpl : public TextGenerator { bool EmitGlobalVariable(const ast::Variable* global); /// Handles emitting a global variable with the uniform storage class - /// @param var the global variable + /// @param var the AST node for the 'var' + /// @param sem the semantic node for the 'var' /// @returns true on success - bool EmitUniformVariable(const sem::Variable* var); + bool EmitUniformVariable(const ast::Var* var, const sem::Variable* sem); /// Handles emitting a global variable with the storage storage class - /// @param var the global variable + /// @param var the AST node for the 'var' + /// @param sem the semantic node for the 'var' /// @returns true on success - bool EmitStorageVariable(const sem::Variable* var); + bool EmitStorageVariable(const ast::Var* var, const sem::Variable* sem); /// Handles emitting a global variable with the handle storage class - /// @param var the global variable + /// @param var the AST node for the 'var' + /// @param sem the semantic node for the 'var' /// @returns true on success - bool EmitHandleVariable(const sem::Variable* var); + bool EmitHandleVariable(const ast::Var* var, const sem::Variable* sem); /// Handles emitting a global variable with the private storage class /// @param var the global variable @@ -332,12 +329,13 @@ class GeneratorImpl : public TextGenerator { /// Handles emitting interpolation qualifiers /// @param out the output of the expression stream /// @param attrs the attributes - void EmitInterpolationQualifiers(std::ostream& out, const ast::AttributeList& attrs); + void EmitInterpolationQualifiers(std::ostream& out, + utils::VectorRef attrs); /// Handles emitting attributes /// @param out the output of the expression stream /// @param attrs the attributes /// @returns true if the attributes were emitted - bool EmitAttributes(std::ostream& out, const ast::AttributeList& attrs); + bool EmitAttributes(std::ostream& out, utils::VectorRef attrs); /// Handles emitting the entry point function /// @param func the entry point /// @returns true if the entry point function was emitted @@ -346,6 +344,11 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement to emit /// @returns true if the statement was successfully emitted bool EmitIf(const ast::IfStatement* stmt); + /// Handles a constant value + /// @param out the output stream + /// @param constant the constant value to emit + /// @returns true if the constant value was successfully emitted + bool EmitConstant(std::ostream& out, const sem::Constant* constant); /// Handles a literal /// @param out the output stream /// @param lit the literal to emit @@ -359,6 +362,10 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement to emit /// @returns true if the statement was emitted bool EmitForLoop(const ast::ForLoopStatement* stmt); + /// Handles a while statement + /// @param stmt the statement to emit + /// @returns true if the statement was emitted + bool EmitWhile(const ast::WhileStatement* stmt); /// Handles generating an identifier expression /// @param out the output of the expression stream /// @param expr the identifier expression @@ -413,6 +420,12 @@ class GeneratorImpl : public TextGenerator { /// @param ty the struct to generate /// @returns true if the struct is emitted bool EmitStructType(TextBuffer* buffer, const sem::Struct* ty); + /// Handles generating a structure declaration only the first time called. Subsequent calls are + /// a no-op and return true. + /// @param buffer the text buffer that the type declaration will be written to + /// @param ty the struct to generate + /// @returns true if the struct is emitted + bool EmitStructTypeOnce(TextBuffer* buffer, const sem::Struct* ty); /// Handles generating the members of a structure /// @param buffer the text buffer that the struct members will be written to /// @param ty the struct to generate @@ -429,14 +442,22 @@ class GeneratorImpl : public TextGenerator { /// @param type the type to emit the value for /// @returns true if the zero value was successfully emitted. bool EmitZeroValue(std::ostream& out, const sem::Type* type); - /// Handles generating a variable + /// Handles generating a 'var' declaration /// @param var the variable to generate /// @returns true if the variable was emitted - bool EmitVariable(const ast::Variable* var); - /// Handles generating a program scope constant variable - /// @param var the variable to emit + bool EmitVar(const ast::Var* var); + /// Handles generating a function-scope 'let' declaration + /// @param let the variable to generate /// @returns true if the variable was emitted - bool EmitProgramConstVariable(const ast::Variable* var); + bool EmitLet(const ast::Let* let); + /// Handles generating a module-scope 'let' declaration + /// @param let the 'let' to emit + /// @returns true if the variable was emitted + bool EmitProgramConstVariable(const ast::Variable* let); + /// Handles generating a module-scope 'override' declaration + /// @param override the 'override' to emit + /// @returns true if the variable was emitted + bool EmitOverride(const ast::Override* override); /// Handles generating a builtin method name /// @param builtin the semantic info for the builtin /// @returns the name or "" if not valid @@ -445,11 +466,11 @@ class GeneratorImpl : public TextGenerator { /// @param builtin the builtin to convert /// @param stage pipeline stage in which this builtin is used /// @returns the string name of the builtin or blank on error - const char* builtin_to_string(ast::Builtin builtin, ast::PipelineStage stage); + const char* builtin_to_string(ast::BuiltinValue builtin, ast::PipelineStage stage); /// Converts a builtin to a sem::Type appropriate for GLSL. /// @param builtin the builtin to convert /// @returns the appropriate semantic type or null on error. - sem::Type* builtin_type(ast::Builtin builtin); + sem::Type* builtin_type(ast::BuiltinValue builtin); private: enum class VarType { kIn, kOut }; @@ -459,19 +480,9 @@ class GeneratorImpl : public TextGenerator { std::string var_name; }; - struct DMAIntrinsic { - transform::DecomposeMemoryAccess::Intrinsic::Op op; - transform::DecomposeMemoryAccess::Intrinsic::DataType type; - bool operator==(const DMAIntrinsic& rhs) const { return op == rhs.op && type == rhs.type; } - /// Hasher is a std::hash function for DMAIntrinsic - struct Hasher { - /// @param i the DMAIntrinsic to hash - /// @returns the hash of `i` - inline std::size_t operator()(const DMAIntrinsic& i) const { - return utils::Hash(i.op, i.type); - } - }; - }; + /// The map key for two semantic types. + using BinaryOperandType = + utils::UnorderedKeyWrapper>; /// CallBuiltinHelper will call the builtin helper function, creating it /// if it hasn't been built already. If the builtin needs to be built then @@ -499,14 +510,14 @@ class GeneratorImpl : public TextGenerator { TextBuffer helpers_; // Helper functions emitted at the top of the output std::function emit_continuing_; - std::unordered_map dma_intrinsics_; std::unordered_map builtins_; - std::unordered_map structure_builders_; std::unordered_map dynamic_vector_write_; std::unordered_map int_dot_funcs_; - std::unordered_map float_modulo_funcs_; + std::unordered_map float_modulo_funcs_; + std::unordered_set emitted_structs_; bool requires_oes_sample_variables_ = false; bool requires_default_precision_qualifier_ = false; + bool requires_f16_extension_ = false; Version version_; }; diff --git a/src/tint/writer/glsl/generator_impl_array_accessor_test.cc b/src/tint/writer/glsl/generator_impl_array_accessor_test.cc index d28e5607d8..bbf90fe8a1 100644 --- a/src/tint/writer/glsl/generator_impl_array_accessor_test.cc +++ b/src/tint/writer/glsl/generator_impl_array_accessor_test.cc @@ -22,7 +22,7 @@ namespace { using GlslGeneratorImplTest_Expression = TestHelper; TEST_F(GlslGeneratorImplTest_Expression, IndexAccessor) { - Global("ary", ty.array(), ast::StorageClass::kPrivate); + GlobalVar("ary", ty.array(), ast::StorageClass::kPrivate); auto* expr = IndexAccessor("ary", 5_i); WrapInFunction(expr); diff --git a/src/tint/writer/glsl/generator_impl_assign_test.cc b/src/tint/writer/glsl/generator_impl_assign_test.cc index fbd9f6262c..84b6b30c69 100644 --- a/src/tint/writer/glsl/generator_impl_assign_test.cc +++ b/src/tint/writer/glsl/generator_impl_assign_test.cc @@ -20,8 +20,8 @@ namespace { using GlslGeneratorImplTest_Assign = TestHelper; TEST_F(GlslGeneratorImplTest_Assign, Emit_Assign) { - Global("lhs", ty.i32(), ast::StorageClass::kPrivate); - Global("rhs", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("lhs", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.i32(), ast::StorageClass::kPrivate); auto* assign = Assign("lhs", "rhs"); WrapInFunction(assign); diff --git a/src/tint/writer/glsl/generator_impl_binary_test.cc b/src/tint/writer/glsl/generator_impl_binary_test.cc index 970a2b3d35..9113ae6f8f 100644 --- a/src/tint/writer/glsl/generator_impl_binary_test.cc +++ b/src/tint/writer/glsl/generator_impl_binary_test.cc @@ -43,8 +43,36 @@ TEST_P(GlslBinaryTest, Emit_f32) { return; } - Global("left", ty.f32(), ast::StorageClass::kPrivate); - Global("right", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("left", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("right", ty.f32(), ast::StorageClass::kPrivate); + + auto* left = Expr("left"); + auto* right = Expr("right"); + + auto* expr = create(params.op, left, right); + + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), params.result); +} +TEST_P(GlslBinaryTest, Emit_f16) { + auto params = GetParam(); + + // Skip ops that are illegal for this type + if (params.op == ast::BinaryOp::kAnd || params.op == ast::BinaryOp::kOr || + params.op == ast::BinaryOp::kXor || params.op == ast::BinaryOp::kShiftLeft || + params.op == ast::BinaryOp::kShiftRight || params.op == ast::BinaryOp::kModulo) { + return; + } + + Enable(ast::Extension::kF16); + + GlobalVar("left", ty.f16(), ast::StorageClass::kPrivate); + GlobalVar("right", ty.f16(), ast::StorageClass::kPrivate); auto* left = Expr("left"); auto* right = Expr("right"); @@ -62,8 +90,8 @@ TEST_P(GlslBinaryTest, Emit_f32) { TEST_P(GlslBinaryTest, Emit_u32) { auto params = GetParam(); - Global("left", ty.u32(), ast::StorageClass::kPrivate); - Global("right", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("left", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("right", ty.u32(), ast::StorageClass::kPrivate); auto* left = Expr("left"); auto* right = Expr("right"); @@ -86,8 +114,8 @@ TEST_P(GlslBinaryTest, Emit_i32) { return; } - Global("left", ty.i32(), ast::StorageClass::kPrivate); - Global("right", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("left", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("right", ty.i32(), ast::StorageClass::kPrivate); auto* left = Expr("left"); auto* right = Expr("right"); @@ -122,9 +150,9 @@ INSTANTIATE_TEST_SUITE_P( BinaryData{"(left / right)", ast::BinaryOp::kDivide}, BinaryData{"(left % right)", ast::BinaryOp::kModulo})); -TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar) { - auto* lhs = vec3(1.f, 1.f, 1.f); - auto* rhs = Expr(1.f); +TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar_f32) { + auto* lhs = vec3(1_f, 1_f, 1_f); + auto* rhs = Expr(1_f); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -134,14 +162,14 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar) { std::stringstream out; EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), - "(vec3(1.0f, 1.0f, 1.0f) * " - "1.0f)"); + EXPECT_EQ(out.str(), "(vec3(1.0f) * 1.0f)"); } -TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector) { - auto* lhs = Expr(1.f); - auto* rhs = vec3(1.f, 1.f, 1.f); +TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar_f16) { + Enable(ast::Extension::kF16); + + auto* lhs = vec3(1_h, 1_h, 1_h); + auto* rhs = Expr(1_h); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -151,15 +179,45 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector) { std::stringstream out; EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), - "(1.0f * vec3(1.0f, 1.0f, " - "1.0f))"); + EXPECT_EQ(out.str(), "(f16vec3(1.0hf) * 1.0hf)"); } -TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar) { - Global("mat", ty.mat3x3(), ast::StorageClass::kPrivate); +TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector_f32) { + auto* lhs = Expr(1_f); + auto* rhs = vec3(1_f, 1_f, 1_f); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(1.0f * vec3(1.0f))"); +} + +TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector_f16) { + Enable(ast::Extension::kF16); + + auto* lhs = Expr(1_h); + auto* rhs = vec3(1_h, 1_h, 1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(1.0hf * f16vec3(1.0hf))"); +} + +TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f32) { + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); auto* lhs = Expr("mat"); - auto* rhs = Expr(1.f); + auto* rhs = Expr(1_f); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); WrapInFunction(expr); @@ -171,9 +229,26 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar) { EXPECT_EQ(out.str(), "(mat * 1.0f)"); } -TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix) { - Global("mat", ty.mat3x3(), ast::StorageClass::kPrivate); - auto* lhs = Expr(1.f); +TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr("mat"); + auto* rhs = Expr(1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(mat * 1.0hf)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f32) { + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr(1_f); auto* rhs = Expr("mat"); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -186,24 +261,11 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix) { EXPECT_EQ(out.str(), "(1.0f * mat)"); } -TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector) { - Global("mat", ty.mat3x3(), ast::StorageClass::kPrivate); - auto* lhs = Expr("mat"); - auto* rhs = vec3(1.f, 1.f, 1.f); +TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f16) { + Enable(ast::Extension::kF16); - auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); - WrapInFunction(expr); - - GeneratorImpl& gen = Build(); - - std::stringstream out; - EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), "(mat * vec3(1.0f, 1.0f, 1.0f))"); -} - -TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix) { - Global("mat", ty.mat3x3(), ast::StorageClass::kPrivate); - auto* lhs = vec3(1.f, 1.f, 1.f); + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr(1_h); auto* rhs = Expr("mat"); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -213,12 +275,76 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix) { std::stringstream out; EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), "(vec3(1.0f, 1.0f, 1.0f) * mat)"); + EXPECT_EQ(out.str(), "(1.0hf * mat)"); } -TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix) { - Global("lhs", ty.mat3x3(), ast::StorageClass::kPrivate); - Global("rhs", ty.mat3x3(), ast::StorageClass::kPrivate); +TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector_f32) { + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr("mat"); + auto* rhs = vec3(1_f, 1_f, 1_f); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(mat * vec3(1.0f))"); +} + +TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr("mat"); + auto* rhs = vec3(1_h, 1_h, 1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(mat * f16vec3(1.0hf))"); +} + +TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f32) { + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = vec3(1_f, 1_f, 1_f); + auto* rhs = Expr("mat"); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(vec3(1.0f) * mat)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = vec3(1_h, 1_h, 1_h); + auto* rhs = Expr("mat"); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(f16vec3(1.0hf) * mat)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f32) { + GlobalVar("lhs", ty.mat3x3(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.mat3x3(), ast::StorageClass::kPrivate); auto* expr = create(ast::BinaryOp::kMultiply, Expr("lhs"), Expr("rhs")); WrapInFunction(expr); @@ -230,9 +356,232 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix) { EXPECT_EQ(out.str(), "(lhs * rhs)"); } +TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("lhs", ty.mat3x3(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.mat3x3(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kMultiply, Expr("lhs"), Expr("rhs")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(lhs * rhs)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModF32) { + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.f32(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModF16) { + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.f16(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.f16(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModVec3F32) { + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.vec3(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16) { + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.vec3(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModVec3F32ScalarF32) { + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.f32(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16ScalarF16) { + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.f16(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModScalarF32Vec3F32) { + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.vec3(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModScalarF16Vec3F16) { + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.f16(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.vec3(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModMixedVec3ScalarF32) { + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.f32(), ast::StorageClass::kPrivate); + + auto* expr_vec_mod_vec = + create(ast::BinaryOp::kModulo, Expr("a"), Expr("a")); + auto* expr_vec_mod_scalar = + create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + auto* expr_scalar_mod_vec = + create(ast::BinaryOp::kModulo, Expr("b"), Expr("a")); + WrapInFunction(expr_vec_mod_vec, expr_vec_mod_scalar, expr_scalar_mod_vec); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#version 310 es + +vec3 tint_float_modulo(vec3 lhs, vec3 rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + +vec3 tint_float_modulo_1(vec3 lhs, float rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + +vec3 tint_float_modulo_2(float lhs, vec3 rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +vec3 a = vec3(0.0f, 0.0f, 0.0f); +float b = 0.0f; +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void test_function() { + vec3 tint_symbol = tint_float_modulo(a, a); + vec3 tint_symbol_1 = tint_float_modulo_1(a, b); + vec3 tint_symbol_2 = tint_float_modulo_2(b, a); + return; +} +)"); +} + +TEST_F(GlslGeneratorImplTest_Binary, ModMixedVec3ScalarF16) { + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.f16(), ast::StorageClass::kPrivate); + + auto* expr_vec_mod_vec = + create(ast::BinaryOp::kModulo, Expr("a"), Expr("a")); + auto* expr_vec_mod_scalar = + create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); + auto* expr_scalar_mod_vec = + create(ast::BinaryOp::kModulo, Expr("b"), Expr("a")); + WrapInFunction(expr_vec_mod_vec, expr_vec_mod_scalar, expr_scalar_mod_vec); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_float_modulo(f16vec3 lhs, f16vec3 rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + +f16vec3 tint_float_modulo_1(f16vec3 lhs, float16_t rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + +f16vec3 tint_float_modulo_2(float16_t lhs, f16vec3 rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +f16vec3 a = f16vec3(0.0hf, 0.0hf, 0.0hf); +float16_t b = 0.0hf; +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void test_function() { + f16vec3 tint_symbol = tint_float_modulo(a, a); + f16vec3 tint_symbol_1 = tint_float_modulo_1(a, b); + f16vec3 tint_symbol_2 = tint_float_modulo_2(b, a); + return; +} +)"); +} + TEST_F(GlslGeneratorImplTest_Binary, Logical_And) { - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")); WrapInFunction(expr); @@ -249,40 +598,12 @@ if (tint_tmp) { )"); } -TEST_F(GlslGeneratorImplTest_Binary, ModF32) { - Global("a", ty.f32(), ast::StorageClass::kPrivate); - Global("b", ty.f32(), ast::StorageClass::kPrivate); - - auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); - WrapInFunction(expr); - - GeneratorImpl& gen = Build(); - - std::stringstream out; - ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); -} - -TEST_F(GlslGeneratorImplTest_Binary, ModVec3F32) { - Global("a", ty.vec3(), ast::StorageClass::kPrivate); - Global("b", ty.vec3(), ast::StorageClass::kPrivate); - - auto* expr = create(ast::BinaryOp::kModulo, Expr("a"), Expr("b")); - WrapInFunction(expr); - - GeneratorImpl& gen = Build(); - - std::stringstream out; - ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); -} - TEST_F(GlslGeneratorImplTest_Binary, Logical_Multi) { // (a && b) || (c || d) - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); - Global("d", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("d", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = create( ast::BinaryOp::kLogicalOr, @@ -311,8 +632,8 @@ if (!tint_tmp) { } TEST_F(GlslGeneratorImplTest_Binary, Logical_Or) { - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = create(ast::BinaryOp::kLogicalOr, Expr("a"), Expr("b")); WrapInFunction(expr); @@ -338,16 +659,16 @@ TEST_F(GlslGeneratorImplTest_Binary, If_WithLogical) { // return 3i; // } - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = If(create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")), Block(Return(1_i)), Else(If(create(ast::BinaryOp::kLogicalOr, Expr("b"), Expr("c")), Block(Return(2_i)), Else(Block(Return(3_i)))))); - Func("func", {}, ty.i32(), {WrapInStatement(expr)}); + Func("func", utils::Empty, ty.i32(), utils::Vector{WrapInStatement(expr)}); GeneratorImpl& gen = Build(); @@ -375,15 +696,15 @@ if ((tint_tmp)) { TEST_F(GlslGeneratorImplTest_Binary, Return_WithLogical) { // return (a && b) || c; - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = Return(create( ast::BinaryOp::kLogicalOr, create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")), Expr("c"))); - Func("func", {}, ty.bool_(), {WrapInStatement(expr)}); + Func("func", utils::Empty, ty.bool_(), utils::Vector{WrapInStatement(expr)}); GeneratorImpl& gen = Build(); @@ -403,10 +724,10 @@ return (tint_tmp); TEST_F(GlslGeneratorImplTest_Binary, Assign_WithLogical) { // a = (b || c) && d; - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); - Global("d", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("d", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = Assign(Expr("a"), @@ -434,12 +755,12 @@ a = (tint_tmp); TEST_F(GlslGeneratorImplTest_Binary, Decl_WithLogical) { // var a : bool = (b && c) || d; - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); - Global("d", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("d", ty.bool_(), ast::StorageClass::kPrivate); auto* var = - Var("a", ty.bool_(), ast::StorageClass::kNone, + Var("a", ty.bool_(), create( ast::BinaryOp::kLogicalOr, create(ast::BinaryOp::kLogicalAnd, Expr("b"), Expr("c")), @@ -467,26 +788,25 @@ TEST_F(GlslGeneratorImplTest_Binary, Call_WithLogical) { // foo(a && b, c || d, (a || c) && (b || d)) Func("foo", - { + utils::Vector{ Param(Sym(), ty.bool_()), Param(Sym(), ty.bool_()), Param(Sym(), ty.bool_()), }, - ty.void_(), ast::StatementList{}, ast::AttributeList{}); - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); - Global("d", ty.bool_(), ast::StorageClass::kPrivate); + ty.void_(), utils::Empty, utils::Empty); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("d", ty.bool_(), ast::StorageClass::kPrivate); - ast::ExpressionList params; - params.push_back( - create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b"))); - params.push_back( - create(ast::BinaryOp::kLogicalOr, Expr("c"), Expr("d"))); - params.push_back(create( - ast::BinaryOp::kLogicalAnd, - create(ast::BinaryOp::kLogicalOr, Expr("a"), Expr("c")), - create(ast::BinaryOp::kLogicalOr, Expr("b"), Expr("d")))); + utils::Vector params{ + create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")), + create(ast::BinaryOp::kLogicalOr, Expr("c"), Expr("d")), + create( + ast::BinaryOp::kLogicalAnd, + create(ast::BinaryOp::kLogicalOr, Expr("a"), Expr("c")), + create(ast::BinaryOp::kLogicalOr, Expr("b"), Expr("d"))), + }; auto* expr = CallStmt(Call("foo", params)); WrapInFunction(expr); diff --git a/src/tint/writer/glsl/generator_impl_builtin_test.cc b/src/tint/writer/glsl/generator_impl_builtin_test.cc index 311abd9f66..b8161e2ea2 100644 --- a/src/tint/writer/glsl/generator_impl_builtin_test.cc +++ b/src/tint/writer/glsl/generator_impl_builtin_test.cc @@ -29,36 +29,40 @@ using BuiltinType = sem::BuiltinType; using GlslGeneratorImplTest_Builtin = TestHelper; -enum class ParamType { +enum class CallParamType { kF32, kU32, kBool, + kF16, }; struct BuiltinData { BuiltinType builtin; - ParamType type; + CallParamType type; const char* glsl_name; }; inline std::ostream& operator<<(std::ostream& out, BuiltinData data) { - out << data.glsl_name; + out << data.glsl_name << "<"; switch (data.type) { - case ParamType::kF32: + case CallParamType::kF32: out << "f32"; break; - case ParamType::kU32: + case CallParamType::kU32: out << "u32"; break; - case ParamType::kBool: + case CallParamType::kBool: out << "bool"; break; + case CallParamType::kF16: + out << "f16"; + break; } out << ">"; return out; } const ast::CallExpression* GenerateCall(BuiltinType builtin, - ParamType type, + CallParamType type, ProgramBuilder* builder) { std::string name; std::ostringstream str(name); @@ -96,30 +100,51 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin, case BuiltinType::kTanh: case BuiltinType::kTrunc: case BuiltinType::kSign: - return builder->Call(str.str(), "f2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2"); + } else { + return builder->Call(str.str(), "f2"); + } case BuiltinType::kLdexp: - return builder->Call(str.str(), "f2", "i2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "i2"); + } else { + return builder->Call(str.str(), "f2", "i2"); + } case BuiltinType::kAtan2: case BuiltinType::kDot: case BuiltinType::kDistance: case BuiltinType::kPow: case BuiltinType::kReflect: case BuiltinType::kStep: - return builder->Call(str.str(), "f2", "f2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2"); + } else { + return builder->Call(str.str(), "f2", "f2"); + } case BuiltinType::kCross: - return builder->Call(str.str(), "f3", "f3"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h3", "h3"); + } else { + return builder->Call(str.str(), "f3", "f3"); + } case BuiltinType::kFma: case BuiltinType::kMix: case BuiltinType::kFaceForward: case BuiltinType::kSmoothstep: - case BuiltinType::kSmoothStep: - return builder->Call(str.str(), "f2", "f2", "f2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2", "h2"); + } else { + return builder->Call(str.str(), "f2", "f2", "f2"); + } case BuiltinType::kAll: case BuiltinType::kAny: return builder->Call(str.str(), "b2"); case BuiltinType::kAbs: - if (type == ParamType::kF32) { + if (type == CallParamType::kF32) { return builder->Call(str.str(), "f2"); + } else if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2"); } else { return builder->Call(str.str(), "u2"); } @@ -128,23 +153,39 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin, return builder->Call(str.str(), "u2"); case BuiltinType::kMax: case BuiltinType::kMin: - if (type == ParamType::kF32) { + if (type == CallParamType::kF32) { return builder->Call(str.str(), "f2", "f2"); + } else if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2"); } else { return builder->Call(str.str(), "u2", "u2"); } case BuiltinType::kClamp: - if (type == ParamType::kF32) { + if (type == CallParamType::kF32) { return builder->Call(str.str(), "f2", "f2", "f2"); + } else if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2", "h2"); } else { return builder->Call(str.str(), "u2", "u2", "u2"); } case BuiltinType::kSelect: - return builder->Call(str.str(), "f2", "f2", "b2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2", "b2"); + } else { + return builder->Call(str.str(), "f2", "f2", "b2"); + } case BuiltinType::kDeterminant: - return builder->Call(str.str(), "m2x2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "hm2x2"); + } else { + return builder->Call(str.str(), "m2x2"); + } case BuiltinType::kTranspose: - return builder->Call(str.str(), "m3x2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "hm3x2"); + } else { + return builder->Call(str.str(), "m3x2"); + } default: break; } @@ -154,22 +195,34 @@ using GlslBuiltinTest = TestParamHelper; TEST_P(GlslBuiltinTest, Emit) { auto param = GetParam(); - Global("f2", ty.vec2(), ast::StorageClass::kPrivate); - Global("f3", ty.vec3(), ast::StorageClass::kPrivate); - Global("u2", ty.vec2(), ast::StorageClass::kPrivate); - Global("i2", ty.vec2(), ast::StorageClass::kPrivate); - Global("b2", ty.vec2(), ast::StorageClass::kPrivate); - Global("m2x2", ty.mat2x2(), ast::StorageClass::kPrivate); - Global("m3x2", ty.mat3x2(), ast::StorageClass::kPrivate); + if (param.type == CallParamType::kF16) { + Enable(ast::Extension::kF16); + + GlobalVar("h2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("h3", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("hm2x2", ty.mat2x2(), ast::StorageClass::kPrivate); + GlobalVar("hm3x2", ty.mat3x2(), ast::StorageClass::kPrivate); + } + + GlobalVar("f2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("f3", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("u2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("i2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("b2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("m2x2", ty.mat2x2(), ast::StorageClass::kPrivate); + GlobalVar("m3x2", ty.mat3x2(), ast::StorageClass::kPrivate); auto* call = GenerateCall(param.builtin, param.type, this); ASSERT_NE(nullptr, call) << "Unhandled builtin"; - Func("func", {}, ty.void_(), {CallStmt(call)}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(call), + }, + utils::Vector{create(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = Build(); - auto* sem = program->Sem().Get(call); + auto* sem = program->Sem().Get(call); ASSERT_NE(sem, nullptr); auto* target = sem->Target(); ASSERT_NE(target, nullptr); @@ -181,71 +234,116 @@ TEST_P(GlslBuiltinTest, Emit) { INSTANTIATE_TEST_SUITE_P( GlslGeneratorImplTest_Builtin, GlslBuiltinTest, - testing::Values(BuiltinData{BuiltinType::kAbs, ParamType::kF32, "abs"}, - BuiltinData{BuiltinType::kAbs, ParamType::kU32, "abs"}, - BuiltinData{BuiltinType::kAcos, ParamType::kF32, "acos"}, - BuiltinData{BuiltinType::kAll, ParamType::kBool, "all"}, - BuiltinData{BuiltinType::kAny, ParamType::kBool, "any"}, - BuiltinData{BuiltinType::kAsin, ParamType::kF32, "asin"}, - BuiltinData{BuiltinType::kAtan, ParamType::kF32, "atan"}, - BuiltinData{BuiltinType::kAtan2, ParamType::kF32, "atan"}, - BuiltinData{BuiltinType::kCeil, ParamType::kF32, "ceil"}, - BuiltinData{BuiltinType::kClamp, ParamType::kF32, "clamp"}, - BuiltinData{BuiltinType::kClamp, ParamType::kU32, "clamp"}, - BuiltinData{BuiltinType::kCos, ParamType::kF32, "cos"}, - BuiltinData{BuiltinType::kCosh, ParamType::kF32, "cosh"}, - BuiltinData{BuiltinType::kCountOneBits, ParamType::kU32, "bitCount"}, - BuiltinData{BuiltinType::kCross, ParamType::kF32, "cross"}, - BuiltinData{BuiltinType::kDeterminant, ParamType::kF32, "determinant"}, - BuiltinData{BuiltinType::kDistance, ParamType::kF32, "distance"}, - BuiltinData{BuiltinType::kDot, ParamType::kF32, "dot"}, - BuiltinData{BuiltinType::kDpdx, ParamType::kF32, "dFdx"}, - BuiltinData{BuiltinType::kDpdxCoarse, ParamType::kF32, "dFdx"}, - BuiltinData{BuiltinType::kDpdxFine, ParamType::kF32, "dFdx"}, - BuiltinData{BuiltinType::kDpdy, ParamType::kF32, "dFdy"}, - BuiltinData{BuiltinType::kDpdyCoarse, ParamType::kF32, "dFdy"}, - BuiltinData{BuiltinType::kDpdyFine, ParamType::kF32, "dFdy"}, - BuiltinData{BuiltinType::kExp, ParamType::kF32, "exp"}, - BuiltinData{BuiltinType::kExp2, ParamType::kF32, "exp2"}, - BuiltinData{BuiltinType::kFaceForward, ParamType::kF32, "faceforward"}, - BuiltinData{BuiltinType::kFloor, ParamType::kF32, "floor"}, - BuiltinData{BuiltinType::kFma, ParamType::kF32, "fma"}, - BuiltinData{BuiltinType::kFract, ParamType::kF32, "fract"}, - BuiltinData{BuiltinType::kFwidth, ParamType::kF32, "fwidth"}, - BuiltinData{BuiltinType::kFwidthCoarse, ParamType::kF32, "fwidth"}, - BuiltinData{BuiltinType::kFwidthFine, ParamType::kF32, "fwidth"}, - BuiltinData{BuiltinType::kInverseSqrt, ParamType::kF32, "inversesqrt"}, - BuiltinData{BuiltinType::kLdexp, ParamType::kF32, "ldexp"}, - BuiltinData{BuiltinType::kLength, ParamType::kF32, "length"}, - BuiltinData{BuiltinType::kLog, ParamType::kF32, "log"}, - BuiltinData{BuiltinType::kLog2, ParamType::kF32, "log2"}, - BuiltinData{BuiltinType::kMax, ParamType::kF32, "max"}, - BuiltinData{BuiltinType::kMax, ParamType::kU32, "max"}, - BuiltinData{BuiltinType::kMin, ParamType::kF32, "min"}, - BuiltinData{BuiltinType::kMin, ParamType::kU32, "min"}, - BuiltinData{BuiltinType::kMix, ParamType::kF32, "mix"}, - BuiltinData{BuiltinType::kNormalize, ParamType::kF32, "normalize"}, - BuiltinData{BuiltinType::kPow, ParamType::kF32, "pow"}, - BuiltinData{BuiltinType::kReflect, ParamType::kF32, "reflect"}, - BuiltinData{BuiltinType::kReverseBits, ParamType::kU32, "bitfieldReverse"}, - BuiltinData{BuiltinType::kRound, ParamType::kU32, "round"}, - BuiltinData{BuiltinType::kSign, ParamType::kF32, "sign"}, - BuiltinData{BuiltinType::kSin, ParamType::kF32, "sin"}, - BuiltinData{BuiltinType::kSinh, ParamType::kF32, "sinh"}, - BuiltinData{BuiltinType::kSmoothstep, ParamType::kF32, "smoothstep"}, - BuiltinData{BuiltinType::kSmoothStep, ParamType::kF32, "smoothstep"}, - BuiltinData{BuiltinType::kSqrt, ParamType::kF32, "sqrt"}, - BuiltinData{BuiltinType::kStep, ParamType::kF32, "step"}, - BuiltinData{BuiltinType::kTan, ParamType::kF32, "tan"}, - BuiltinData{BuiltinType::kTanh, ParamType::kF32, "tanh"}, - BuiltinData{BuiltinType::kTranspose, ParamType::kF32, "transpose"}, - BuiltinData{BuiltinType::kTrunc, ParamType::kF32, "trunc"})); + testing::Values(/* Logical built-in */ + BuiltinData{BuiltinType::kAll, CallParamType::kBool, "all"}, + BuiltinData{BuiltinType::kAny, CallParamType::kBool, "any"}, + /* Float built-in */ + BuiltinData{BuiltinType::kAbs, CallParamType::kF32, "abs"}, + BuiltinData{BuiltinType::kAbs, CallParamType::kF16, "abs"}, + BuiltinData{BuiltinType::kAcos, CallParamType::kF32, "acos"}, + BuiltinData{BuiltinType::kAcos, CallParamType::kF16, "acos"}, + BuiltinData{BuiltinType::kAsin, CallParamType::kF32, "asin"}, + BuiltinData{BuiltinType::kAsin, CallParamType::kF16, "asin"}, + BuiltinData{BuiltinType::kAtan, CallParamType::kF32, "atan"}, + BuiltinData{BuiltinType::kAtan, CallParamType::kF16, "atan"}, + BuiltinData{BuiltinType::kAtan2, CallParamType::kF32, "atan"}, + BuiltinData{BuiltinType::kAtan2, CallParamType::kF16, "atan"}, + BuiltinData{BuiltinType::kCeil, CallParamType::kF32, "ceil"}, + BuiltinData{BuiltinType::kCeil, CallParamType::kF16, "ceil"}, + BuiltinData{BuiltinType::kClamp, CallParamType::kF32, "clamp"}, + BuiltinData{BuiltinType::kClamp, CallParamType::kF16, "clamp"}, + BuiltinData{BuiltinType::kCos, CallParamType::kF32, "cos"}, + BuiltinData{BuiltinType::kCos, CallParamType::kF16, "cos"}, + BuiltinData{BuiltinType::kCosh, CallParamType::kF32, "cosh"}, + BuiltinData{BuiltinType::kCosh, CallParamType::kF16, "cosh"}, + BuiltinData{BuiltinType::kCross, CallParamType::kF32, "cross"}, + BuiltinData{BuiltinType::kCross, CallParamType::kF16, "cross"}, + BuiltinData{BuiltinType::kDistance, CallParamType::kF32, "distance"}, + BuiltinData{BuiltinType::kDistance, CallParamType::kF16, "distance"}, + BuiltinData{BuiltinType::kExp, CallParamType::kF32, "exp"}, + BuiltinData{BuiltinType::kExp, CallParamType::kF16, "exp"}, + BuiltinData{BuiltinType::kExp2, CallParamType::kF32, "exp2"}, + BuiltinData{BuiltinType::kExp2, CallParamType::kF16, "exp2"}, + BuiltinData{BuiltinType::kFaceForward, CallParamType::kF32, "faceforward"}, + BuiltinData{BuiltinType::kFaceForward, CallParamType::kF16, "faceforward"}, + BuiltinData{BuiltinType::kFloor, CallParamType::kF32, "floor"}, + BuiltinData{BuiltinType::kFloor, CallParamType::kF16, "floor"}, + BuiltinData{BuiltinType::kFma, CallParamType::kF32, "fma"}, + BuiltinData{BuiltinType::kFma, CallParamType::kF16, "fma"}, + BuiltinData{BuiltinType::kFract, CallParamType::kF32, "fract"}, + BuiltinData{BuiltinType::kFract, CallParamType::kF16, "fract"}, + BuiltinData{BuiltinType::kInverseSqrt, CallParamType::kF32, "inversesqrt"}, + BuiltinData{BuiltinType::kInverseSqrt, CallParamType::kF16, "inversesqrt"}, + BuiltinData{BuiltinType::kLdexp, CallParamType::kF32, "ldexp"}, + BuiltinData{BuiltinType::kLdexp, CallParamType::kF16, "ldexp"}, + BuiltinData{BuiltinType::kLength, CallParamType::kF32, "length"}, + BuiltinData{BuiltinType::kLength, CallParamType::kF16, "length"}, + BuiltinData{BuiltinType::kLog, CallParamType::kF32, "log"}, + BuiltinData{BuiltinType::kLog, CallParamType::kF16, "log"}, + BuiltinData{BuiltinType::kLog2, CallParamType::kF32, "log2"}, + BuiltinData{BuiltinType::kLog2, CallParamType::kF16, "log2"}, + BuiltinData{BuiltinType::kMax, CallParamType::kF32, "max"}, + BuiltinData{BuiltinType::kMax, CallParamType::kF16, "max"}, + BuiltinData{BuiltinType::kMin, CallParamType::kF32, "min"}, + BuiltinData{BuiltinType::kMin, CallParamType::kF16, "min"}, + BuiltinData{BuiltinType::kMix, CallParamType::kF32, "mix"}, + BuiltinData{BuiltinType::kMix, CallParamType::kF16, "mix"}, + BuiltinData{BuiltinType::kNormalize, CallParamType::kF32, "normalize"}, + BuiltinData{BuiltinType::kNormalize, CallParamType::kF16, "normalize"}, + BuiltinData{BuiltinType::kPow, CallParamType::kF32, "pow"}, + BuiltinData{BuiltinType::kPow, CallParamType::kF16, "pow"}, + BuiltinData{BuiltinType::kReflect, CallParamType::kF32, "reflect"}, + BuiltinData{BuiltinType::kReflect, CallParamType::kF16, "reflect"}, + BuiltinData{BuiltinType::kSign, CallParamType::kF32, "sign"}, + BuiltinData{BuiltinType::kSign, CallParamType::kF16, "sign"}, + BuiltinData{BuiltinType::kSin, CallParamType::kF32, "sin"}, + BuiltinData{BuiltinType::kSin, CallParamType::kF16, "sin"}, + BuiltinData{BuiltinType::kSinh, CallParamType::kF32, "sinh"}, + BuiltinData{BuiltinType::kSinh, CallParamType::kF16, "sinh"}, + BuiltinData{BuiltinType::kSmoothstep, CallParamType::kF32, "smoothstep"}, + BuiltinData{BuiltinType::kSmoothstep, CallParamType::kF16, "smoothstep"}, + BuiltinData{BuiltinType::kSqrt, CallParamType::kF32, "sqrt"}, + BuiltinData{BuiltinType::kSqrt, CallParamType::kF16, "sqrt"}, + BuiltinData{BuiltinType::kStep, CallParamType::kF32, "step"}, + BuiltinData{BuiltinType::kStep, CallParamType::kF16, "step"}, + BuiltinData{BuiltinType::kTan, CallParamType::kF32, "tan"}, + BuiltinData{BuiltinType::kTan, CallParamType::kF16, "tan"}, + BuiltinData{BuiltinType::kTanh, CallParamType::kF32, "tanh"}, + BuiltinData{BuiltinType::kTanh, CallParamType::kF16, "tanh"}, + BuiltinData{BuiltinType::kTrunc, CallParamType::kF32, "trunc"}, + BuiltinData{BuiltinType::kTrunc, CallParamType::kF16, "trunc"}, + /* Integer built-in */ + BuiltinData{BuiltinType::kAbs, CallParamType::kU32, "abs"}, + BuiltinData{BuiltinType::kClamp, CallParamType::kU32, "clamp"}, + BuiltinData{BuiltinType::kCountOneBits, CallParamType::kU32, "bitCount"}, + BuiltinData{BuiltinType::kMax, CallParamType::kU32, "max"}, + BuiltinData{BuiltinType::kMin, CallParamType::kU32, "min"}, + BuiltinData{BuiltinType::kReverseBits, CallParamType::kU32, "bitfieldReverse"}, + BuiltinData{BuiltinType::kRound, CallParamType::kU32, "round"}, + /* Matrix built-in */ + BuiltinData{BuiltinType::kDeterminant, CallParamType::kF32, "determinant"}, + BuiltinData{BuiltinType::kDeterminant, CallParamType::kF16, "determinant"}, + BuiltinData{BuiltinType::kTranspose, CallParamType::kF32, "transpose"}, + BuiltinData{BuiltinType::kTranspose, CallParamType::kF16, "transpose"}, + /* Vector built-in */ + BuiltinData{BuiltinType::kDot, CallParamType::kF32, "dot"}, + BuiltinData{BuiltinType::kDot, CallParamType::kF16, "dot"}, + /* Derivate built-in */ + BuiltinData{BuiltinType::kDpdx, CallParamType::kF32, "dFdx"}, + BuiltinData{BuiltinType::kDpdxCoarse, CallParamType::kF32, "dFdx"}, + BuiltinData{BuiltinType::kDpdxFine, CallParamType::kF32, "dFdx"}, + BuiltinData{BuiltinType::kDpdy, CallParamType::kF32, "dFdy"}, + BuiltinData{BuiltinType::kDpdyCoarse, CallParamType::kF32, "dFdy"}, + BuiltinData{BuiltinType::kDpdyFine, CallParamType::kF32, "dFdy"}, + BuiltinData{BuiltinType::kFwidth, CallParamType::kF32, "fwidth"}, + BuiltinData{BuiltinType::kFwidthCoarse, CallParamType::kF32, "fwidth"}, + BuiltinData{BuiltinType::kFwidthFine, CallParamType::kF32, "fwidth"})); TEST_F(GlslGeneratorImplTest_Builtin, Builtin_Call) { auto* call = Call("dot", "param1", "param2"); - Global("param1", ty.vec3(), ast::StorageClass::kPrivate); - Global("param2", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("param1", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.vec3(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); @@ -258,7 +356,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Builtin_Call) { } TEST_F(GlslGeneratorImplTest_Builtin, Select_Scalar) { - auto* call = Call("select", 1.0f, 2.0f, true); + auto* call = Call("select", 1_f, 2_f, true); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -279,8 +377,43 @@ TEST_F(GlslGeneratorImplTest_Builtin, Select_Vector) { EXPECT_EQ(out.str(), "mix(ivec2(1, 2), ivec2(3, 4), bvec2(true, false))"); } -TEST_F(GlslGeneratorImplTest_Builtin, Modf_Scalar) { - auto* call = Call("modf", 1.0f); +TEST_F(GlslGeneratorImplTest_Builtin, FMA_f32) { + auto* call = Call("fma", "a", "b", "c"); + + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.vec3(), ast::StorageClass::kPrivate); + + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); + EXPECT_EQ(out.str(), "((a) * (b) + (c))"); +} + +TEST_F(GlslGeneratorImplTest_Builtin, FMA_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.vec3(), ast::StorageClass::kPrivate); + + auto* call = Call("fma", "a", "b", "c"); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); + EXPECT_EQ(out.str(), "((a) * (b) + (c))"); +} + +TEST_F(GlslGeneratorImplTest_Builtin, Modf_Scalar_f32) { + auto* call = Call("modf", 1_f); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = SanitizeAndBuild(); @@ -312,7 +445,43 @@ void main() { )"); } -TEST_F(GlslGeneratorImplTest_Builtin, Modf_Vector) { +TEST_F(GlslGeneratorImplTest_Builtin, Modf_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("modf", 1_h); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void test_function() { + tint_modf(1.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + test_function(); + return; +} +)"); +} + +TEST_F(GlslGeneratorImplTest_Builtin, Modf_Vector_f32) { auto* call = Call("modf", vec3()); WrapInFunction(CallStmt(call)); @@ -334,7 +503,7 @@ modf_result_vec3 tint_modf(vec3 param_0) { void test_function() { - tint_modf(vec3(0.0f, 0.0f, 0.0f)); + tint_modf(vec3(0.0f)); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -345,8 +514,44 @@ void main() { )"); } -TEST_F(GlslGeneratorImplTest_Builtin, Frexp_Scalar_i32) { - auto* call = Call("frexp", 1.0f); +TEST_F(GlslGeneratorImplTest_Builtin, Modf_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("modf", vec3()); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void test_function() { + tint_modf(f16vec3(0.0hf)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + test_function(); + return; +} +)"); +} + +TEST_F(GlslGeneratorImplTest_Builtin, Frexp_Scalar_f32) { + auto* call = Call("frexp", 1_f); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = SanitizeAndBuild(); @@ -372,7 +577,42 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; )")); } -TEST_F(GlslGeneratorImplTest_Builtin, Frexp_Vector_i32) { +TEST_F(GlslGeneratorImplTest_Builtin, Frexp_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("frexp", 1_h); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr(R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void test_function() { + tint_frexp(1.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + test_function(); + return; +)")); +} + +TEST_F(GlslGeneratorImplTest_Builtin, Frexp_Vector_f32) { auto* call = Call("frexp", vec3()); WrapInFunction(CallStmt(call)); @@ -394,7 +634,7 @@ frexp_result_vec3 tint_frexp(vec3 param_0) { void test_function() { - tint_frexp(vec3(0.0f, 0.0f, 0.0f)); + tint_frexp(vec3(0.0f)); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -404,7 +644,43 @@ void main() { )")); } -TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar) { +TEST_F(GlslGeneratorImplTest_Builtin, Frexp_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("frexp", vec3()); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr(R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void test_function() { + tint_frexp(f16vec3(0.0hf)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + test_function(); + return; +} +)")); +} + +TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar_f32) { auto* val = Var("val", ty.f32()); auto* call = Call("degrees", val); WrapInFunction(val, call); @@ -415,7 +691,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar) { EXPECT_EQ(gen.result(), R"(#version 310 es float tint_degrees(float param_0) { - return param_0 * 57.295779513082322865; + return param_0 * 57.295779513082322865f; } @@ -432,7 +708,7 @@ void main() { )"); } -TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Vector) { +TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Vector_f32) { auto* val = Var("val", ty.vec3()); auto* call = Call("degrees", val); WrapInFunction(val, call); @@ -443,7 +719,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Vector) { EXPECT_EQ(gen.result(), R"(#version 310 es vec3 tint_degrees(vec3 param_0) { - return param_0 * 57.295779513082322865; + return param_0 * 57.295779513082322865f; } @@ -460,7 +736,69 @@ void main() { )"); } -TEST_F(GlslGeneratorImplTest_Builtin, Radians_Scalar) { +TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.f16()); + auto* call = Call("degrees", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void test_function() { + float16_t val = 0.0hf; + float16_t tint_symbol = tint_degrees(val); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + test_function(); + return; +} +)"); +} + +TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.vec3()); + auto* call = Call("degrees", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void test_function() { + f16vec3 val = f16vec3(0.0hf, 0.0hf, 0.0hf); + f16vec3 tint_symbol = tint_degrees(val); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + test_function(); + return; +} +)"); +} + +TEST_F(GlslGeneratorImplTest_Builtin, Radians_Scalar_f32) { auto* val = Var("val", ty.f32()); auto* call = Call("radians", val); WrapInFunction(val, call); @@ -471,7 +809,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Radians_Scalar) { EXPECT_EQ(gen.result(), R"(#version 310 es float tint_radians(float param_0) { - return param_0 * 0.017453292519943295474; + return param_0 * 0.017453292519943295474f; } @@ -488,7 +826,7 @@ void main() { )"); } -TEST_F(GlslGeneratorImplTest_Builtin, Radians_Vector) { +TEST_F(GlslGeneratorImplTest_Builtin, Radians_Vector_f32) { auto* val = Var("val", ty.vec3()); auto* call = Call("radians", val); WrapInFunction(val, call); @@ -499,7 +837,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Radians_Vector) { EXPECT_EQ(gen.result(), R"(#version 310 es vec3 tint_radians(vec3 param_0) { - return param_0 * 0.017453292519943295474; + return param_0 * 0.017453292519943295474f; } @@ -516,6 +854,68 @@ void main() { )"); } +TEST_F(GlslGeneratorImplTest_Builtin, Radians_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.f16()); + auto* call = Call("radians", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void test_function() { + float16_t val = 0.0hf; + float16_t tint_symbol = tint_radians(val); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + test_function(); + return; +} +)"); +} + +TEST_F(GlslGeneratorImplTest_Builtin, Radians_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.vec3()); + auto* call = Call("radians", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void test_function() { + f16vec3 val = f16vec3(0.0hf, 0.0hf, 0.0hf); + f16vec3 tint_symbol = tint_radians(val); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + test_function(); + return; +} +)"); +} + TEST_F(GlslGeneratorImplTest_Builtin, ExtractBits) { auto* v = Var("v", ty.vec3()); auto* offset = Var("offset", ty.u32()); @@ -586,7 +986,7 @@ void main() { TEST_F(GlslGeneratorImplTest_Builtin, Pack4x8Snorm) { auto* call = Call("pack4x8snorm", "p1"); - Global("p1", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec4(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -604,7 +1004,7 @@ void test_function() { TEST_F(GlslGeneratorImplTest_Builtin, Pack4x8Unorm) { auto* call = Call("pack4x8unorm", "p1"); - Global("p1", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec4(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -622,7 +1022,7 @@ void test_function() { TEST_F(GlslGeneratorImplTest_Builtin, Pack2x16Snorm) { auto* call = Call("pack2x16snorm", "p1"); - Global("p1", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec2(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -640,7 +1040,7 @@ void test_function() { TEST_F(GlslGeneratorImplTest_Builtin, Pack2x16Unorm) { auto* call = Call("pack2x16unorm", "p1"); - Global("p1", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec2(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -658,7 +1058,7 @@ void test_function() { TEST_F(GlslGeneratorImplTest_Builtin, Pack2x16Float) { auto* call = Call("pack2x16float", "p1"); - Global("p1", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec2(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -676,7 +1076,7 @@ void test_function() { TEST_F(GlslGeneratorImplTest_Builtin, Unpack4x8Snorm) { auto* call = Call("unpack4x8snorm", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -694,7 +1094,7 @@ void test_function() { TEST_F(GlslGeneratorImplTest_Builtin, Unpack4x8Unorm) { auto* call = Call("unpack4x8unorm", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -712,7 +1112,7 @@ void test_function() { TEST_F(GlslGeneratorImplTest_Builtin, Unpack2x16Snorm) { auto* call = Call("unpack2x16snorm", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -730,7 +1130,7 @@ void test_function() { TEST_F(GlslGeneratorImplTest_Builtin, Unpack2x16Unorm) { auto* call = Call("unpack2x16unorm", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -748,7 +1148,7 @@ void test_function() { TEST_F(GlslGeneratorImplTest_Builtin, Unpack2x16Float) { auto* call = Call("unpack2x16float", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -765,8 +1165,11 @@ void test_function() { } TEST_F(GlslGeneratorImplTest_Builtin, StorageBarrier) { - Func("main", {}, ty.void_(), {CallStmt(Call("storageBarrier"))}, - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("storageBarrier")), + }, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -785,8 +1188,11 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, WorkgroupBarrier) { - Func("main", {}, ty.void_(), {CallStmt(Call("workgroupBarrier"))}, - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("workgroupBarrier")), + }, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -805,7 +1211,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, DotI32) { - Global("v", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(Call("dot", "v", "v"))); GeneratorImpl& gen = SanitizeAndBuild(); @@ -830,25 +1236,8 @@ void main() { )"); } -TEST_F(GlslGeneratorImplTest_Builtin, FMA) { - auto* call = Call("fma", "a", "b", "c"); - - Global("a", ty.vec3(), ast::StorageClass::kPrivate); - Global("b", ty.vec3(), ast::StorageClass::kPrivate); - Global("c", ty.vec3(), ast::StorageClass::kPrivate); - - WrapInFunction(CallStmt(call)); - - GeneratorImpl& gen = Build(); - - gen.increment_indent(); - std::stringstream out; - ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); - EXPECT_EQ(out.str(), "((a) * (b) + (c))"); -} - TEST_F(GlslGeneratorImplTest_Builtin, DotU32) { - Global("v", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(Call("dot", "v", "v"))); GeneratorImpl& gen = SanitizeAndBuild(); diff --git a/src/tint/writer/glsl/generator_impl_builtin_texture_test.cc b/src/tint/writer/glsl/generator_impl_builtin_texture_test.cc index cb111eea7d..8a22798202 100644 --- a/src/tint/writer/glsl/generator_impl_builtin_texture_test.cc +++ b/src/tint/writer/glsl/generator_impl_builtin_texture_test.cc @@ -193,7 +193,7 @@ ExpectedResult expected_texture_overload(ast::builtin::test::ValidTextureOverloa case ValidTextureOverload::kSampleGrad2dF32: return R"(textureGrad(tint_symbol_sampler, vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f));)"; case ValidTextureOverload::kSampleGrad2dOffsetF32: - return R"(textureGradOffset(tint_symbol_sampler, vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f), ivec2(7, 7));)"; + return R"(textureGradOffset(tint_symbol_sampler, vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f), ivec2(7));)"; case ValidTextureOverload::kSampleGrad2dArrayF32: return R"(textureGrad(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));)"; case ValidTextureOverload::kSampleGrad2dArrayOffsetF32: @@ -278,7 +278,8 @@ TEST_P(GlslGeneratorBuiltinTextureTest, Call) { auto* call = Call(param.function, param.args(this)); auto* stmt = CallStmt(call); - Func("main", {}, ty.void_(), {stmt}, {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), utils::Vector{stmt}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = SanitizeAndBuild(); diff --git a/src/tint/writer/glsl/generator_impl_call_test.cc b/src/tint/writer/glsl/generator_impl_call_test.cc index 9b6a1c3699..d264896f72 100644 --- a/src/tint/writer/glsl/generator_impl_call_test.cc +++ b/src/tint/writer/glsl/generator_impl_call_test.cc @@ -15,13 +15,15 @@ #include "src/tint/ast/call_statement.h" #include "src/tint/writer/glsl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::glsl { namespace { using GlslGeneratorImplTest_Call = TestHelper; TEST_F(GlslGeneratorImplTest_Call, EmitExpression_Call_WithoutParams) { - Func("my_func", {}, ty.f32(), {Return(1.23f)}); + Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(1.23_f)}); auto* call = Call("my_func"); WrapInFunction(call); @@ -35,13 +37,13 @@ TEST_F(GlslGeneratorImplTest_Call, EmitExpression_Call_WithoutParams) { TEST_F(GlslGeneratorImplTest_Call, EmitExpression_Call_WithParams) { Func("my_func", - { + utils::Vector{ Param(Sym(), ty.f32()), Param(Sym(), ty.f32()), }, - ty.f32(), {Return(1.23f)}); - Global("param1", ty.f32(), ast::StorageClass::kPrivate); - Global("param2", ty.f32(), ast::StorageClass::kPrivate); + ty.f32(), utils::Vector{Return(1.23_f)}); + GlobalVar("param1", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.f32(), ast::StorageClass::kPrivate); auto* call = Call("my_func", "param1", "param2"); WrapInFunction(call); @@ -55,13 +57,13 @@ TEST_F(GlslGeneratorImplTest_Call, EmitExpression_Call_WithParams) { TEST_F(GlslGeneratorImplTest_Call, EmitStatement_Call) { Func("my_func", - { + utils::Vector{ Param(Sym(), ty.f32()), Param(Sym(), ty.f32()), }, - ty.void_(), ast::StatementList{}, ast::AttributeList{}); - Global("param1", ty.f32(), ast::StorageClass::kPrivate); - Global("param2", ty.f32(), ast::StorageClass::kPrivate); + ty.void_(), utils::Empty, utils::Empty); + GlobalVar("param1", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.f32(), ast::StorageClass::kPrivate); auto* call = CallStmt(Call("my_func", "param1", "param2")); WrapInFunction(call); diff --git a/src/tint/writer/glsl/generator_impl_case_test.cc b/src/tint/writer/glsl/generator_impl_case_test.cc index 02d16654da..1f60781086 100644 --- a/src/tint/writer/glsl/generator_impl_case_test.cc +++ b/src/tint/writer/glsl/generator_impl_case_test.cc @@ -69,7 +69,13 @@ TEST_F(GlslGeneratorImplTest_Case, Emit_Case_WithFallthrough) { } TEST_F(GlslGeneratorImplTest_Case, Emit_Case_MultipleSelectors) { - auto* s = Switch(1_i, Case({Expr(5_i), Expr(6_i)}, Block(create())), + auto* s = Switch(1_i, + Case( + utils::Vector{ + Expr(5_i), + Expr(6_i), + }, + Block(create())), DefaultCase()); WrapInFunction(s); diff --git a/src/tint/writer/glsl/generator_impl_cast_test.cc b/src/tint/writer/glsl/generator_impl_cast_test.cc index 3666782beb..c4f9c05986 100644 --- a/src/tint/writer/glsl/generator_impl_cast_test.cc +++ b/src/tint/writer/glsl/generator_impl_cast_test.cc @@ -29,7 +29,7 @@ TEST_F(GlslGeneratorImplTest_Cast, EmitExpression_Cast_Scalar) { std::stringstream out; ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); - EXPECT_EQ(out.str(), "float(1)"); + EXPECT_EQ(out.str(), "1.0f"); } TEST_F(GlslGeneratorImplTest_Cast, EmitExpression_Cast_Vector) { @@ -40,7 +40,7 @@ TEST_F(GlslGeneratorImplTest_Cast, EmitExpression_Cast_Vector) { std::stringstream out; ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); - EXPECT_EQ(out.str(), "vec3(ivec3(1, 2, 3))"); + EXPECT_EQ(out.str(), "vec3(1.0f, 2.0f, 3.0f)"); } } // namespace diff --git a/src/tint/writer/glsl/generator_impl_constructor_test.cc b/src/tint/writer/glsl/generator_impl_constructor_test.cc index c247bab86a..b987a319bb 100644 --- a/src/tint/writer/glsl/generator_impl_constructor_test.cc +++ b/src/tint/writer/glsl/generator_impl_constructor_test.cc @@ -34,7 +34,7 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Bool) { } TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Int) { - WrapInFunction(Expr(i32(-12345))); + WrapInFunction(Expr(-12345_i)); GeneratorImpl& gen = Build(); @@ -61,13 +61,36 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Float) { EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f")); } -TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Float) { - WrapInFunction(Construct(-1.2e-5f)); +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_F16) { + Enable(ast::Extension::kF16); + + // Use a number close to 1<<16 but whose decimal representation ends in 0. + WrapInFunction(Expr(f16((1 << 15) - 8))); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("float(-0.000012f)")); + EXPECT_THAT(gen.result(), HasSubstr("32752.0hf")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Float) { + WrapInFunction(Construct(-1.2e-5_f)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("-0.000012f")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(Construct(-1.2e-3_h)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("-0.00119972229hf")); } TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Bool) { @@ -76,16 +99,16 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Bool) { GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("bool(true)")); + EXPECT_THAT(gen.result(), HasSubstr("true")); } TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Int) { - WrapInFunction(Construct(i32(-12345))); + WrapInFunction(Construct(-12345_i)); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("int(-12345)")); + EXPECT_THAT(gen.result(), HasSubstr("-12345")); } TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Uint) { @@ -94,11 +117,11 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Uint) { GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("uint(12345u)")); + EXPECT_THAT(gen.result(), HasSubstr("12345u")); } -TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec) { - WrapInFunction(vec3(1.f, 2.f, 3.f)); +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_F32) { + WrapInFunction(vec3(1_f, 2_f, 3_f)); GeneratorImpl& gen = Build(); @@ -106,17 +129,39 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec) { EXPECT_THAT(gen.result(), HasSubstr("vec3(1.0f, 2.0f, 3.0f)")); } -TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_Empty) { +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3(1_h, 2_h, 3_h)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("f16vec3(1.0hf, 2.0hf, 3.0hf)")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_Empty_F32) { WrapInFunction(vec3()); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("vec3(0.0f, 0.0f, 0.0f)")); + EXPECT_THAT(gen.result(), HasSubstr("vec3(0.0f)")); } -TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_Float) { - WrapInFunction(vec3(2.0f)); +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_Empty_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3()); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("f16vec3(0.0hf)")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_F32_Literal) { + WrapInFunction(vec3(2_f)); GeneratorImpl& gen = Build(); @@ -124,6 +169,43 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_ EXPECT_THAT(gen.result(), HasSubstr("vec3(2.0f)")); } +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_F16_Literal) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3(2_h)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("f16vec3(2.0hf)")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_F32_Var) { + auto* var = Var("v", Expr(2_f)); + auto* cast = vec3(var); + WrapInFunction(var, cast); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr(R"(float v = 2.0f; + vec3 tint_symbol = vec3(v);)")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_F16_Var) { + Enable(ast::Extension::kF16); + + auto* var = Var("v", Expr(2_h)); + auto* cast = vec3(var); + WrapInFunction(var, cast); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr(R"(float16_t v = 2.0hf; + f16vec3 tint_symbol = f16vec3(v);)")); +} + TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_Bool) { WrapInFunction(vec3(true)); @@ -151,8 +233,8 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_ EXPECT_THAT(gen.result(), HasSubstr("uvec3(2u)")); } -TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat) { - WrapInFunction(mat2x3(vec3(1.f, 2.f, 3.f), vec3(3.f, 4.f, 5.f))); +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_F32) { + WrapInFunction(mat2x3(vec3(1_f, 2_f, 3_f), vec3(3_f, 4_f, 5_f))); GeneratorImpl& gen = Build(); @@ -161,19 +243,140 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat) { EXPECT_THAT(gen.result(), HasSubstr("mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(3.0f, 4.0f, 5.0f))")); } -TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Empty) { +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(mat2x3(vec3(1_h, 2_h, 3_h), vec3(3_h, 4_h, 5_h))); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), + HasSubstr("f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf))")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Complex_F32) { + // mat4x4( + // vec4(2.0f, 3.0f, 4.0f, 8.0f), + // vec4(), + // vec4(7.0f), + // vec4(vec4(42.0f, 21.0f, 6.0f, -5.0f)), + // ); + auto* vector_literal = + vec4(Expr(f32(2.0)), Expr(f32(3.0)), Expr(f32(4.0)), Expr(f32(8.0))); + auto* vector_zero_ctor = vec4(); + auto* vector_single_scalar_ctor = vec4(Expr(f32(7.0))); + auto* vector_identical_ctor = + vec4(vec4(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0)))); + + auto* constructor = mat4x4(vector_literal, vector_zero_ctor, vector_single_scalar_ctor, + vector_identical_ctor); + + WrapInFunction(constructor); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("mat4(vec4(2.0f, 3.0f, 4.0f, 8.0f), vec4(0.0f), " + "vec4(7.0f), vec4(42.0f, 21.0f, 6.0f, -5.0f))")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Complex_F16) { + // mat4x4( + // vec4(2.0h, 3.0h, 4.0h, 8.0h), + // vec4(), + // vec4(7.0h), + // vec4(vec4(42.0h, 21.0h, 6.0h, -5.0h)), + // ); + Enable(ast::Extension::kF16); + + auto* vector_literal = + vec4(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0))); + auto* vector_zero_ctor = vec4(); + auto* vector_single_scalar_ctor = vec4(Expr(f16(7.0))); + auto* vector_identical_ctor = + vec4(vec4(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0)))); + + auto* constructor = mat4x4(vector_literal, vector_zero_ctor, vector_single_scalar_ctor, + vector_identical_ctor); + + WrapInFunction(constructor); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), + HasSubstr("f16mat4(f16vec4(2.0hf, 3.0hf, 4.0hf, 8.0hf), f16vec4(0.0hf), " + "f16vec4(7.0hf), f16vec4(42.0hf, 21.0hf, 6.0hf, -5.0hf))")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Empty_F32) { WrapInFunction(mat2x3()); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)")); + EXPECT_THAT(gen.result(), HasSubstr("mat2x3 tint_symbol = mat2x3(vec3(0.0f), vec3(0.0f))")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Empty_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(mat2x3()); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), + HasSubstr("f16mat2x3 tint_symbol = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Identity_F32) { + // fn f() { + // var m_1: mat4x4 = mat4x4(); + // var m_2: mat4x4 = mat4x4(m_1); + // } + + auto* m_1 = Var("m_1", ty.mat4x4(ty.f32()), mat4x4()); + auto* m_2 = Var("m_2", ty.mat4x4(ty.f32()), mat4x4(m_1)); + + WrapInFunction(m_1, m_2); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("mat4 m_2 = mat4(m_1);")); +} + +TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Identity_F16) { + // fn f() { + // var m_1: mat4x4 = mat4x4(); + // var m_2: mat4x4 = mat4x4(m_1); + // } + + Enable(ast::Extension::kF16); + + auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4()); + auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4(m_1)); + + WrapInFunction(m_1, m_2); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("f16mat4 m_2 = f16mat4(m_1);")); } TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Array) { - WrapInFunction(Construct(ty.array(ty.vec3(), 3_u), vec3(1.f, 2.f, 3.f), - vec3(4.f, 5.f, 6.f), vec3(7.f, 8.f, 9.f))); + WrapInFunction(Construct(ty.array(ty.vec3(), 3_u), vec3(1_f, 2_f, 3_f), + vec3(4_f, 5_f, 6_f), vec3(7_f, 8_f, 9_f))); GeneratorImpl& gen = Build(); @@ -189,18 +392,17 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Array_Empty) { GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("vec3[3](vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)," - " vec3(0.0f, 0.0f, 0.0f))")); + EXPECT_THAT(gen.result(), HasSubstr("vec3[3](vec3(0.0f), vec3(0.0f), vec3(0.0f))")); } TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct) { - auto* str = Structure("S", { + auto* str = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), Member("c", ty.vec3()), }); - WrapInFunction(Construct(ty.Of(str), 1_i, 2.0f, vec3(3_i, 4_i, 5_i))); + WrapInFunction(Construct(ty.Of(str), 1_i, 2_f, vec3(3_i, 4_i, 5_i))); GeneratorImpl& gen = SanitizeAndBuild(); @@ -209,7 +411,7 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct) { } TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct_Empty) { - auto* str = Structure("S", { + auto* str = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), Member("c", ty.vec3()), diff --git a/src/tint/writer/glsl/generator_impl_function_test.cc b/src/tint/writer/glsl/generator_impl_function_test.cc index 8b91cef51f..90824baf7a 100644 --- a/src/tint/writer/glsl/generator_impl_function_test.cc +++ b/src/tint/writer/glsl/generator_impl_function_test.cc @@ -28,8 +28,8 @@ namespace { using GlslGeneratorImplTest_Function = TestHelper; TEST_F(GlslGeneratorImplTest_Function, Emit_Function) { - Func("my_func", ast::VariableList{}, ty.void_(), - { + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Return(), }); @@ -48,8 +48,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Function) { } TEST_F(GlslGeneratorImplTest_Function, Emit_Function_Name_Collision) { - Func("centroid", ast::VariableList{}, ty.void_(), - { + Func("centroid", utils::Empty, ty.void_(), + utils::Vector{ Return(), }); @@ -64,8 +64,13 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Function_Name_Collision) { } TEST_F(GlslGeneratorImplTest_Function, Emit_Function_WithParams) { - Func("my_func", ast::VariableList{Param("a", ty.f32()), Param("b", ty.i32())}, ty.void_(), - { + Func("my_func", + utils::Vector{ + Param("a", ty.f32()), + Param("b", ty.i32()), + }, + ty.void_(), + utils::Vector{ Return(), }); @@ -84,8 +89,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Function_WithParams) { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_NoReturn_Void) { - Func("func", ast::VariableList{}, ty.void_(), {/* no explicit return */}, - { + Func("func", utils::Empty, ty.void_(), utils::Empty /* no explicit return */, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -105,8 +110,8 @@ TEST_F(GlslGeneratorImplTest_Function, PtrParameter) { // fn f(foo : ptr) -> f32 { // return *foo; // } - Func("f", {Param("foo", ty.pointer(ast::StorageClass::kFunction))}, ty.f32(), - {Return(Deref("foo"))}); + Func("f", utils::Vector{Param("foo", ty.pointer(ast::StorageClass::kFunction))}, ty.f32(), + utils::Vector{Return(Deref("foo"))}); GeneratorImpl& gen = SanitizeAndBuild(); @@ -121,9 +126,20 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_WithInOutVars) // fn frag_main(@location(0) foo : f32) -> @location(1) f32 { // return foo; // } - auto* foo_in = Param("foo", ty.f32(), {Location(0)}); - Func("frag_main", ast::VariableList{foo_in}, ty.f32(), {Return("foo")}, - {Stage(ast::PipelineStage::kFragment)}, {Location(1)}); + Func("frag_main", + utils::Vector{ + Param("foo", ty.f32(), utils::Vector{Location(0)}), + }, + ty.f32(), + utils::Vector{ + Return("foo"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(1), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -149,9 +165,22 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_WithInOut_Built // fn frag_main(@position(0) coord : vec4) -> @frag_depth f32 { // return coord.x; // } - auto* coord_in = Param("coord", ty.vec4(), {Builtin(ast::Builtin::kPosition)}); - Func("frag_main", ast::VariableList{coord_in}, ty.f32(), {Return(MemberAccessor("coord", "x"))}, - {Stage(ast::PipelineStage::kFragment)}, {Builtin(ast::Builtin::kFragDepth)}); + auto* coord_in = + Param("coord", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}); + Func("frag_main", + utils::Vector{ + coord_in, + }, + ty.f32(), + utils::Vector{ + Return(MemberAccessor("coord", "x")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kFragDepth), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -186,24 +215,25 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_SharedStruct_Di // const p = inputs.pos; // } auto* interface_struct = Structure( - "Interface", { - Member("pos", ty.vec4(), {Builtin(ast::Builtin::kPosition)}), - Member("col1", ty.f32(), {Location(1)}), - Member("col2", ty.f32(), {Location(2)}), - }); + "Interface", + utils::Vector{ + Member("pos", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}), + Member("col1", ty.f32(), utils::Vector{Location(1)}), + Member("col2", ty.f32(), utils::Vector{Location(2)}), + }); - Func("vert_main", {}, ty.Of(interface_struct), - {Return(Construct(ty.Of(interface_struct), Construct(ty.vec4()), Expr(0.5f), - Expr(0.25f)))}, - {Stage(ast::PipelineStage::kVertex)}); + Func("vert_main", utils::Empty, ty.Of(interface_struct), + utils::Vector{Return(Construct(ty.Of(interface_struct), Construct(ty.vec4()), + Expr(0.5_f), Expr(0.25_f)))}, + utils::Vector{Stage(ast::PipelineStage::kVertex)}); - Func("frag_main", {Param("inputs", ty.Of(interface_struct))}, ty.void_(), - { + Func("frag_main", utils::Vector{Param("inputs", ty.Of(interface_struct))}, ty.void_(), + utils::Vector{ Decl(Let("r", ty.f32(), MemberAccessor("inputs", "col1"))), Decl(Let("g", ty.f32(), MemberAccessor("inputs", "col2"))), Decl(Let("p", ty.vec4(), MemberAccessor("inputs", "pos"))), }, - {Stage(ast::PipelineStage::kFragment)}); + utils::Vector{Stage(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = SanitizeAndBuild(); @@ -222,7 +252,7 @@ struct Interface { }; Interface vert_main() { - Interface tint_symbol = Interface(vec4(0.0f, 0.0f, 0.0f, 0.0f), 0.5f, 0.25f); + Interface tint_symbol = Interface(vec4(0.0f), 0.5f, 0.25f); return tint_symbol; } @@ -267,21 +297,21 @@ TEST_F(GlslGeneratorImplTest_Function, // } auto* vertex_output_struct = Structure( "VertexOutput", - {Member("pos", ty.vec4(), {Builtin(ast::Builtin::kPosition)})}); + {Member("pos", ty.vec4(), {Builtin(ast::BuiltinValue::kPosition)})}); - Func("foo", {Param("x", ty.f32())}, ty.Of(vertex_output_struct), + Func("foo", utils::Vector{Param("x", ty.f32())}, ty.Of(vertex_output_struct), {Return(Construct(ty.Of(vertex_output_struct), - Construct(ty.vec4(), "x", "x", "x", Expr(1.f))))}, + Construct(ty.vec4(), "x", "x", "x", Expr(1_f))))}, {}); - Func("vert_main1", {}, ty.Of(vertex_output_struct), + Func("vert_main1", utils::Empty, ty.Of(vertex_output_struct), {Return(Construct(ty.Of(vertex_output_struct), - Expr(Call("foo", Expr(0.5f)))))}, + Expr(Call("foo", Expr(0.5_f)))))}, {Stage(ast::PipelineStage::kVertex)}); - Func("vert_main2", {}, ty.Of(vertex_output_struct), + Func("vert_main2", utils::Empty, ty.Of(vertex_output_struct), {Return(Construct(ty.Of(vertex_output_struct), - Expr(Call("foo", Expr(0.25f)))))}, + Expr(Call("foo", Expr(0.25_f)))))}, {Stage(ast::PipelineStage::kVertex)}); GeneratorImpl& gen = SanitizeAndBuild(); @@ -320,30 +350,26 @@ tint_symbol_2 vert_main2() { #endif TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_Uniform) { - auto* ubo_ty = Structure("UBO", {Member("coord", ty.vec4())}); - auto* ubo = Global("ubo", ty.Of(ubo_ty), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(1), - }); + auto* ubo_ty = Structure("UBO", utils::Vector{Member("coord", ty.vec4())}); + auto* ubo = GlobalVar("ubo", ty.Of(ubo_ty), ast::StorageClass::kUniform, Binding(0), Group(1)); Func("sub_func", - { + utils::Vector{ Param("param", ty.f32()), }, ty.f32(), - { + utils::Vector{ Return(MemberAccessor(MemberAccessor(ubo, "coord"), "x")), }); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, Call("sub_func", 1.0f)); + auto* var = Var("v", ty.f32(), Call("sub_func", 1_f)); - Func("frag_main", {}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -373,23 +399,18 @@ void frag_main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_UniformStruct) { - auto* s = Structure("Uniforms", {Member("coord", ty.vec4())}); + auto* s = Structure("Uniforms", utils::Vector{Member("coord", ty.vec4())}); - Global("uniforms", ty.Of(s), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("uniforms", ty.Of(s), ast::StorageClass::kUniform, Binding(0), Group(1)); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, - MemberAccessor(MemberAccessor("uniforms", "coord"), "x")); + auto* var = Var("v", ty.f32(), MemberAccessor(MemberAccessor("uniforms", "coord"), "x")); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -415,25 +436,22 @@ void frag_main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RW_StorageBuffer_Read) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(1)); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b")); + auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b")); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -465,25 +483,22 @@ void main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RO_StorageBuffer_Read) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), + Group(1)); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b")); + auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b")); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -516,23 +531,20 @@ void main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_WO_StorageBuffer_Store) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kWrite, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(1)); - Func("frag_main", ast::VariableList{}, ty.void_(), - { - Assign(MemberAccessor("coord", "b"), Expr(2.0f)), + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ + Assign(MemberAccessor("coord", "b"), Expr(2_f)), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -564,23 +576,20 @@ void main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_StorageBuffer_Store) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(1)); - Func("frag_main", ast::VariableList{}, ty.void_(), - { - Assign(MemberAccessor("coord", "b"), Expr(2.0f)), + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ + Assign(MemberAccessor("coord", "b"), Expr(2_f)), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -612,26 +621,22 @@ void main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_Uniform) { - auto* s = Structure("S", {Member("x", ty.f32())}); - Global("coord", ty.Of(s), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(1), - }); + auto* s = Structure("S", utils::Vector{Member("x", ty.f32())}); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kUniform, Binding(0), Group(1)); - Func("sub_func", ast::VariableList{Param("param", ty.f32())}, ty.f32(), - { + Func("sub_func", utils::Vector{Param("param", ty.f32())}, ty.f32(), + utils::Vector{ Return(MemberAccessor("coord", "x")), }); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, Call("sub_func", 1.0f)); + auto* var = Var("v", ty.f32(), Call("sub_func", 1_f)); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -661,26 +666,23 @@ void frag_main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_StorageBuffer) { - auto* s = Structure("S", {Member("x", ty.f32())}); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(1), - }); + auto* s = Structure("S", utils::Vector{Member("x", ty.f32())}); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(1)); - Func("sub_func", ast::VariableList{Param("param", ty.f32())}, ty.f32(), - { + Func("sub_func", utils::Vector{Param("param", ty.f32())}, ty.f32(), + utils::Vector{ Return(MemberAccessor("coord", "x")), }); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, Call("sub_func", 1.0f)); + auto* var = Var("v", ty.f32(), Call("sub_func", 1_f)); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -715,8 +717,8 @@ void main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_WithNameCollision) { - Func("centroid", ast::VariableList{}, ty.void_(), {}, - { + Func("centroid", utils::Empty, ty.void_(), {}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -737,11 +739,14 @@ void main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute) { - Func("main", ast::VariableList{}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Return(), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); GeneratorImpl& gen = Build(); @@ -756,8 +761,8 @@ void main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute_WithWorkgroup_Literal) { - Func("main", ast::VariableList{}, ty.void_(), {}, - { + Func("main", utils::Empty, ty.void_(), {}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(2_i, 4_i, 6_i), }); @@ -778,8 +783,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute_WithWor GlobalConst("width", ty.i32(), Construct(ty.i32(), 2_i)); GlobalConst("height", ty.i32(), Construct(ty.i32(), 3_i)); GlobalConst("depth", ty.i32(), Construct(ty.i32(), 4_i)); - Func("main", ast::VariableList{}, ty.void_(), {}, - { + Func("main", utils::Empty, ty.void_(), {}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize("width", "height", "depth"), }); @@ -789,9 +794,6 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute_WithWor ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(#version 310 es -const int width = int(2); -const int height = int(3); -const int depth = int(4); layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; void main() { return; @@ -801,11 +803,11 @@ void main() { TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute_WithWorkgroup_OverridableConst) { - Override("width", ty.i32(), Construct(ty.i32(), 2_i), {Id(7u)}); - Override("height", ty.i32(), Construct(ty.i32(), 3_i), {Id(8u)}); - Override("depth", ty.i32(), Construct(ty.i32(), 4_i), {Id(9u)}); - Func("main", ast::VariableList{}, ty.void_(), {}, - { + Override("width", ty.i32(), Construct(ty.i32(), 2_i), Id(7u)); + Override("height", ty.i32(), Construct(ty.i32(), 3_i), Id(8u)); + Override("depth", ty.i32(), Construct(ty.i32(), 4_i), Id(9u)); + Func("main", utils::Empty, ty.void_(), {}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize("width", "height", "depth"), }); @@ -816,15 +818,15 @@ TEST_F(GlslGeneratorImplTest_Function, EXPECT_EQ(gen.result(), R"(#version 310 es #ifndef WGSL_SPEC_CONSTANT_7 -#define WGSL_SPEC_CONSTANT_7 int(2) +#define WGSL_SPEC_CONSTANT_7 2 #endif const int width = WGSL_SPEC_CONSTANT_7; #ifndef WGSL_SPEC_CONSTANT_8 -#define WGSL_SPEC_CONSTANT_8 int(3) +#define WGSL_SPEC_CONSTANT_8 3 #endif const int height = WGSL_SPEC_CONSTANT_8; #ifndef WGSL_SPEC_CONSTANT_9 -#define WGSL_SPEC_CONSTANT_9 int(4) +#define WGSL_SPEC_CONSTANT_9 4 #endif const int depth = WGSL_SPEC_CONSTANT_9; layout(local_size_x = WGSL_SPEC_CONSTANT_7, local_size_y = WGSL_SPEC_CONSTANT_8, local_size_z = WGSL_SPEC_CONSTANT_9) in; @@ -835,8 +837,8 @@ void main() { } TEST_F(GlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) { - Func("my_func", ast::VariableList{Param("a", ty.array())}, ty.void_(), - { + Func("my_func", utils::Vector{Param("a", ty.array())}, ty.void_(), + utils::Vector{ Return(), }); @@ -853,8 +855,8 @@ void my_func(float a[5]) { } TEST_F(GlslGeneratorImplTest_Function, Emit_Function_WithArrayReturn) { - Func("my_func", {}, ty.array(), - { + Func("my_func", utils::Empty, ty.array(), + utils::Vector{ Return(Construct(ty.array())), }); @@ -877,46 +879,49 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Multiple_EntryPoint_With_Same_Module // }; // @binding(0) @group(0) var data : Data; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn a() { // var v = data.d; // return; // } // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn b() { // var v = data.d; // return; // } - auto* s = Structure("Data", {Member("d", ty.f32())}); + auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())}); - Global("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(0)); { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("a", ast::VariableList{}, ty.void_(), - { + Func("a", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); } { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("b", ast::VariableList{}, ty.void_(), - { + Func("b", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); } GeneratorImpl& gen = SanitizeAndBuild(); diff --git a/src/tint/writer/glsl/generator_impl_identifier_test.cc b/src/tint/writer/glsl/generator_impl_identifier_test.cc index 396c261f20..ff9bc88c72 100644 --- a/src/tint/writer/glsl/generator_impl_identifier_test.cc +++ b/src/tint/writer/glsl/generator_impl_identifier_test.cc @@ -20,7 +20,7 @@ namespace { using GlslGeneratorImplTest_Identifier = TestHelper; TEST_F(GlslGeneratorImplTest_Identifier, EmitIdentifierExpression) { - Global("foo", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("foo", ty.i32(), ast::StorageClass::kPrivate); auto* i = Expr("foo"); WrapInFunction(i); diff --git a/src/tint/writer/glsl/generator_impl_if_test.cc b/src/tint/writer/glsl/generator_impl_if_test.cc index 4b0b7bbe7a..82dc307abc 100644 --- a/src/tint/writer/glsl/generator_impl_if_test.cc +++ b/src/tint/writer/glsl/generator_impl_if_test.cc @@ -20,7 +20,7 @@ namespace { using GlslGeneratorImplTest_If = TestHelper; TEST_F(GlslGeneratorImplTest_If, Emit_If) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); auto* cond = Expr("cond"); auto* body = Block(Return()); @@ -38,8 +38,8 @@ TEST_F(GlslGeneratorImplTest_If, Emit_If) { } TEST_F(GlslGeneratorImplTest_If, Emit_IfWithElseIf) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); - Global("else_cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("else_cond", ty.bool_(), ast::StorageClass::kPrivate); auto* else_cond = Expr("else_cond"); auto* else_body = Block(Return()); @@ -65,7 +65,7 @@ TEST_F(GlslGeneratorImplTest_If, Emit_IfWithElseIf) { } TEST_F(GlslGeneratorImplTest_If, Emit_IfWithElse) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); auto* else_body = Block(Return()); @@ -88,8 +88,8 @@ TEST_F(GlslGeneratorImplTest_If, Emit_IfWithElse) { } TEST_F(GlslGeneratorImplTest_If, Emit_IfWithMultiple) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); - Global("else_cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("else_cond", ty.bool_(), ast::StorageClass::kPrivate); auto* else_cond = Expr("else_cond"); diff --git a/src/tint/writer/glsl/generator_impl_import_test.cc b/src/tint/writer/glsl/generator_impl_import_test.cc index a4a6440cda..9e988f1362 100644 --- a/src/tint/writer/glsl/generator_impl_import_test.cc +++ b/src/tint/writer/glsl/generator_impl_import_test.cc @@ -35,7 +35,7 @@ TEST_P(GlslImportData_SingleParamTest, FloatScalar) { auto param = GetParam(); auto* ident = Expr(param.name); - auto* expr = Call(ident, 1.f); + auto* expr = Call(ident, 1_f); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -92,7 +92,7 @@ TEST_P(GlslImportData_SingleVectorParamTest, FloatVector) { auto param = GetParam(); auto* ident = Expr(param.name); - auto* expr = Call(ident, vec3(1.f, 2.f, 3.f)); + auto* expr = Call(ident, vec3(1_f, 2_f, 3_f)); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -132,7 +132,7 @@ using GlslImportData_DualParam_ScalarTest = TestParamHelper; TEST_P(GlslImportData_DualParam_ScalarTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, 1.f, 2.f); + auto* expr = Call(param.name, 1_f, 2_f); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -154,7 +154,7 @@ using GlslImportData_DualParam_VectorTest = TestParamHelper; TEST_P(GlslImportData_DualParam_VectorTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, vec3(1.f, 2.f, 3.f), vec3(4.f, 5.f, 6.f)); + auto* expr = Call(param.name, vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f)); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -197,7 +197,7 @@ using GlslImportData_TripleParam_ScalarTest = TestParamHelper; TEST_P(GlslImportData_TripleParam_ScalarTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, 1.f, 2.f, 3.f); + auto* expr = Call(param.name, 1_f, 2_f, 3_f); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -216,8 +216,8 @@ using GlslImportData_TripleParam_VectorTest = TestParamHelper; TEST_P(GlslImportData_TripleParam_VectorTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, vec3(1.f, 2.f, 3.f), vec3(4.f, 5.f, 6.f), - vec3(7.f, 8.f, 9.f)); + auto* expr = Call(param.name, vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f), + vec3(7_f, 8_f, 9_f)); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -256,7 +256,7 @@ INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_Import, testing::Values(GlslImportData{"clamp", "clamp"})); TEST_F(GlslGeneratorImplTest_Import, GlslImportData_Determinant) { - Global("var", ty.mat3x3(), ast::StorageClass::kPrivate); + GlobalVar("var", ty.mat3x3(), ast::StorageClass::kPrivate); auto* expr = Call("determinant", "var"); WrapInFunction(expr); diff --git a/src/tint/writer/glsl/generator_impl_loop_test.cc b/src/tint/writer/glsl/generator_impl_loop_test.cc index de296220d6..1271463e9b 100644 --- a/src/tint/writer/glsl/generator_impl_loop_test.cc +++ b/src/tint/writer/glsl/generator_impl_loop_test.cc @@ -66,8 +66,8 @@ TEST_F(GlslGeneratorImplTest_Loop, Emit_LoopWithContinuing) { TEST_F(GlslGeneratorImplTest_Loop, Emit_LoopNestedWithContinuing) { Func("a_statement", {}, ty.void_(), {}); - Global("lhs", ty.f32(), ast::StorageClass::kPrivate); - Global("rhs", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("lhs", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.f32(), ast::StorageClass::kPrivate); auto* body = Block(create()); auto* continuing = Block(CallStmt(Call("a_statement"))); @@ -112,10 +112,10 @@ TEST_F(GlslGeneratorImplTest_Loop, Emit_LoopWithVarUsedInContinuing) { // } // } - Global("rhs", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.f32(), ast::StorageClass::kPrivate); - auto* body = Block(Decl(Var("lhs", ty.f32(), Expr(2.4f))), // - Decl(Var("other", ty.f32())), // + auto* body = Block(Decl(Var("lhs", ty.f32(), Expr(2.4_f))), // + Decl(Var("other", ty.f32())), // Break()); auto* continuing = Block(Assign("lhs", "rhs")); auto* outer = Loop(body, continuing); @@ -188,7 +188,7 @@ TEST_F(GlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtInit) { auto* multi_stmt = create(ast::BinaryOp::kLogicalAnd, Expr(true), Expr(false)); - auto* f = For(Decl(Var("b", nullptr, multi_stmt)), nullptr, nullptr, Block(Return())); + auto* f = For(Decl(Var("b", multi_stmt)), nullptr, nullptr, Block(Return())); WrapInFunction(f); GeneratorImpl& gen = Build(); @@ -348,9 +348,8 @@ TEST_F(GlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtInitCondCont) { auto* multi_stmt_c = create(ast::BinaryOp::kLogicalAnd, Expr(true), Expr(false)); - auto* f = - For(Decl(Var("i", nullptr, multi_stmt_a)), multi_stmt_b, Assign("i", multi_stmt_c), // - Block(Return())); + auto* f = For(Decl(Var("i", multi_stmt_a)), multi_stmt_b, Assign("i", multi_stmt_c), // + Block(Return())); WrapInFunction(f); GeneratorImpl& gen = Build(); @@ -381,5 +380,71 @@ TEST_F(GlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtInitCondCont) { )"); } +TEST_F(GlslGeneratorImplTest_Loop, Emit_While) { + // while(true) { + // return; + // } + + auto* f = While(Expr(true), Block(Return())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( while(true) { + return; + } +)"); +} + +TEST_F(GlslGeneratorImplTest_Loop, Emit_While_WithContinue) { + // while(true) { + // continue; + // } + + auto* f = While(Expr(true), Block(Continue())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( while(true) { + continue; + } +)"); +} + +TEST_F(GlslGeneratorImplTest_Loop, Emit_WhileWithMultiStmtCond) { + // while(true && false) { + // return; + // } + + Func("a_statement", {}, ty.void_(), {}); + + auto* multi_stmt = + create(ast::BinaryOp::kLogicalAnd, Expr(true), Expr(false)); + auto* f = While(multi_stmt, Block(CallStmt(Call("a_statement")))); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( while (true) { + bool tint_tmp = true; + if (tint_tmp) { + tint_tmp = false; + } + if (!((tint_tmp))) { break; } + a_statement(); + } +)"); +} + } // namespace } // namespace tint::writer::glsl diff --git a/src/tint/writer/glsl/generator_impl_member_accessor_test.cc b/src/tint/writer/glsl/generator_impl_member_accessor_test.cc index 2fdc83374c..1736ab025a 100644 --- a/src/tint/writer/glsl/generator_impl_member_accessor_test.cc +++ b/src/tint/writer/glsl/generator_impl_member_accessor_test.cc @@ -86,22 +86,19 @@ inline const ast::Type* ty_mat4x4(const ProgramBuilder::TypesBuilder& ty) { template class GlslGeneratorImplTest_MemberAccessorBase : public BASE { public: - void SetupStorageBuffer(ast::StructMemberList members) { + void SetupStorageBuffer(utils::VectorRef members) { ProgramBuilder& b = *this; auto* s = b.Structure("Data", members); - b.Global("data", b.ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - b.create(0), - b.create(1), - }); + b.GlobalVar("data", b.ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, + b.Group(1), b.Binding(0)); } - void SetupFunction(ast::StatementList statements) { + void SetupFunction(utils::VectorRef statements) { ProgramBuilder& b = *this; - b.Func("main", ast::VariableList{}, b.ty.void_(), statements, - ast::AttributeList{ + b.Func("main", utils::Empty, b.ty.void_(), statements, + utils::Vector{ b.Stage(ast::PipelineStage::kFragment), }); } @@ -114,11 +111,11 @@ using GlslGeneratorImplTest_MemberAccessorWithParam = GlslGeneratorImplTest_MemberAccessorBase>; TEST_F(GlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) { - auto* s = Structure("Data", {Member("mem", ty.f32())}); - Global("str", ty.Of(s), ast::StorageClass::kPrivate); + auto* s = Structure("Data", utils::Vector{Member("mem", ty.f32())}); + GlobalVar("str", ty.Of(s), ast::StorageClass::kPrivate); auto* expr = MemberAccessor("str", "mem"); - WrapInFunction(Var("expr", ty.f32(), ast::StorageClass::kNone, expr)); + WrapInFunction(Var("expr", ty.f32(), expr)); GeneratorImpl& gen = SanitizeAndBuild(); @@ -165,13 +162,13 @@ TEST_P(GlslGeneratorImplTest_MemberAccessor_StorageBufferLoad, Test) { auto p = GetParam(); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("a", ty.i32()), Member("b", p.member_type(ty)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, MemberAccessor("data", "b"))), + SetupFunction(utils::Vector{ + Decl(Var("x", MemberAccessor("data", "b"))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -216,14 +213,13 @@ TEST_P(GlslGeneratorImplTest_MemberAccessor_StorageBufferStore, Test) { auto p = GetParam(); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("a", ty.i32()), Member("b", p.member_type(ty)), }); - SetupFunction({ - Decl(Var("value", p.member_type(ty), ast::StorageClass::kNone, - Construct(p.member_type(ty)))), + SetupFunction(utils::Vector{ + Decl(Var("value", p.member_type(ty), Construct(p.member_type(ty)))), Assign(MemberAccessor("data", "b"), Expr("value")), }); @@ -265,13 +261,13 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) { // var data : Data; // data.a = mat2x3(); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("a", ty.i32()), Member("b", ty.mat2x3()), }); - SetupFunction({ - Assign(MemberAccessor("data", "b"), Construct(ty.mat2x3(), ast::ExpressionList{})), + SetupFunction(utils::Vector{ + Assign(MemberAccessor("data", "b"), Construct(ty.mat2x3())), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -291,7 +287,7 @@ layout(binding = 0, std430) buffer Data_1 { mat2x3 b; } data; void tint_symbol() { - data.b = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + data.b = mat2x3(vec3(0.0f), vec3(0.0f)); } void main() { @@ -310,14 +306,13 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_Matrix_Single_El // var data : Data; // data.a[2i][1i]; - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("z", ty.f32()), Member("a", ty.mat4x3()), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, - IndexAccessor(IndexAccessor(MemberAccessor("data", "a"), 2_i), 1_i))), + SetupFunction(utils::Vector{ + Decl(Var("x", IndexAccessor(IndexAccessor(MemberAccessor("data", "a"), 2_i), 1_i))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -356,14 +351,13 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, // var data : Data; // data.a[2]; - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("z", ty.f32()), Member("a", ty.array(4)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, - IndexAccessor(MemberAccessor("data", "a"), 2_i))), + SetupFunction(utils::Vector{ + Decl(Var("x", IndexAccessor(MemberAccessor("data", "a"), 2_i))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -402,14 +396,16 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, // var data : Data; // data.a[(2i + 4i) - 3i]; - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("z", ty.f32()), Member("a", ty.array(4)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, - IndexAccessor(MemberAccessor("data", "a"), Sub(Add(2_i, 4_i), 3_i)))), + SetupFunction(utils::Vector{ + Decl(Var("a", Expr(2_i))), + Decl(Var("b", Expr(4_i))), + Decl(Var("c", Expr(3_i))), + Decl(Var("x", IndexAccessor(MemberAccessor("data", "a"), Sub(Add("a", "b"), "c")))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -429,7 +425,10 @@ layout(binding = 0, std430) buffer Data_1 { int a[5]; } data; void tint_symbol() { - int x = data.a[((2 + 4) - 3)]; + int a = 2; + int b = 4; + int c = 3; + int x = data.a[((a + b) - c)]; } void main() { @@ -447,12 +446,12 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) { // var data : Data; // data.a[2i] = 2i; - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("z", ty.f32()), Member("a", ty.array(4)), }); - SetupFunction({ + SetupFunction(utils::Vector{ Assign(IndexAccessor(MemberAccessor("data", "a"), 2_i), 2_i), }); @@ -496,18 +495,17 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_MultiLevel) { // var data : Pre; // data.c[2i].b - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, - MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"))), + SetupFunction(utils::Vector{ + Decl(Var("x", MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -553,17 +551,17 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_MultiLevel_Swizz // var data : Pre; // data.c[2i].b.xy - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, + SetupFunction(utils::Vector{ + Decl(Var("x", MemberAccessor( MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "xy"))), }); @@ -612,17 +610,17 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, // var data : Pre; // data.c[2i].b.g - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, + SetupFunction(utils::Vector{ + Decl(Var("x", MemberAccessor( MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "g"))), }); @@ -670,17 +668,17 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_MultiLevel_Index // var data : Pre; // data.c[2i].b[1i] - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, + SetupFunction(utils::Vector{ + Decl(Var("x", IndexAccessor(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), 1_i))), }); @@ -728,18 +726,18 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_MultiLevel) { // var data : Pre; // data.c[2i].b = vec3(1.f, 2.f, 3.f); - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ + SetupFunction(utils::Vector{ Assign(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), - vec3(1.f, 2.f, 3.f)), + vec3(1_f, 2_f, 3_f)), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -785,19 +783,19 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Swizzle_SingleL // var data : Pre; // data.c[2i].b.y = 1.f; - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ + SetupFunction(utils::Vector{ Assign(MemberAccessor(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "y"), - Expr(1.f)), + Expr(1_f)), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -832,8 +830,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_MemberAccessor, Swizzle_xyz) { - auto* var = - Var("my_vec", ty.vec4(), ast::StorageClass::kNone, vec4(1.f, 2.f, 3.f, 4.f)); + auto* var = Var("my_vec", ty.vec4(), vec4(1_f, 2_f, 3_f, 4_f)); auto* expr = MemberAccessor("my_vec", "xyz"); WrapInFunction(var, expr); @@ -843,8 +840,7 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, Swizzle_xyz) { } TEST_F(GlslGeneratorImplTest_MemberAccessor, Swizzle_gbr) { - auto* var = - Var("my_vec", ty.vec4(), ast::StorageClass::kNone, vec4(1.f, 2.f, 3.f, 4.f)); + auto* var = Var("my_vec", ty.vec4(), vec4(1_f, 2_f, 3_f, 4_f)); auto* expr = MemberAccessor("my_vec", "gbr"); WrapInFunction(var, expr); diff --git a/src/tint/writer/glsl/generator_impl_module_constant_test.cc b/src/tint/writer/glsl/generator_impl_module_constant_test.cc index 35e1dd262d..e607efc3bf 100644 --- a/src/tint/writer/glsl/generator_impl_module_constant_test.cc +++ b/src/tint/writer/glsl/generator_impl_module_constant_test.cc @@ -15,13 +15,15 @@ #include "src/tint/ast/id_attribute.h" #include "src/tint/writer/glsl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::glsl { namespace { using GlslGeneratorImplTest_ModuleConstant = TestHelper; -TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_ModuleConstant) { - auto* var = Let("pos", ty.array(), array(1.f, 2.f, 3.f)); +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalLet) { + auto* var = Let("pos", ty.array(), array(1_f, 2_f, 3_f)); WrapInFunction(Decl(var)); GeneratorImpl& gen = Build(); @@ -30,15 +32,325 @@ TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_ModuleConstant) { EXPECT_EQ(gen.result(), "const float pos[3] = float[3](1.0f, 2.0f, 3.0f);\n"); } -TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant) { - auto* var = Override("pos", ty.f32(), Expr(3.0f), - ast::AttributeList{ - Id(23), - }); +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_AInt) { + auto* var = GlobalConst("G", Expr(1_a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error(); + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + int l = 1; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_AFloat) { + auto* var = GlobalConst("G", Expr(1._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + float l = 1.0f; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_i32) { + auto* var = GlobalConst("G", Expr(1_i)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + int l = 1; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_u32) { + auto* var = GlobalConst("G", Expr(1_u)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + uint l = 1u; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f32) { + auto* var = GlobalConst("G", Expr(1_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + float l = 1.0f; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalConst("G", Expr(1_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t l = 1.0hf; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_AInt) { + auto* var = GlobalConst("G", Construct(ty.vec3(nullptr), 1_a, 2_a, 3_a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + ivec3 l = ivec3(1, 2, 3); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_AFloat) { + auto* var = GlobalConst("G", Construct(ty.vec3(nullptr), 1._a, 2._a, 3._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + vec3 l = vec3(1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f32) { + auto* var = GlobalConst("G", vec3(1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + vec3 l = vec3(1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalConst("G", vec3(1_h, 2_h, 3_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 l = f16vec3(1.0hf, 2.0hf, 3.0hf); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_AFloat) { + auto* var = + GlobalConst("G", Construct(ty.mat(nullptr, 2, 3), 1._a, 2._a, 3._a, 4._a, 5._a, 6._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + mat2x3 l = mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f32) { + auto* var = GlobalConst("G", mat2x3(1_f, 2_f, 3_f, 4_f, 5_f, 6_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + mat2x3 l = mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalConst("G", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16mat2x3 l = f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf)); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_arr_f32) { + auto* var = GlobalConst("G", Construct(ty.array(), 1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + float l[3] = float[3](1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_arr_vec2_bool) { + auto* var = GlobalConst("G", Construct(ty.array(ty.vec2(), 3_u), // + vec2(true, false), // + vec2(false, true), // + vec2(true, true))); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("l", Expr(var))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + bvec2 l[3] = bvec2[3](bvec2(true, false), bvec2(false, true), bvec2(true)); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_Override) { + auto* var = Override("pos", ty.f32(), Expr(3_f), Id(23)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitOverride(var)) << gen.error(); EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_23 #define WGSL_SPEC_CONSTANT_23 3.0f #endif @@ -46,15 +358,12 @@ const float pos = WGSL_SPEC_CONSTANT_23; )"); } -TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant_NoConstructor) { - auto* var = Override("pos", ty.f32(), nullptr, - ast::AttributeList{ - Id(23), - }); +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_Override_NoConstructor) { + auto* var = Override("pos", ty.f32(), Id(23)); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error(); + ASSERT_TRUE(gen.EmitOverride(var)) << gen.error(); EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_23 #error spec constant required for constant id 23 #endif @@ -62,17 +371,14 @@ const float pos = WGSL_SPEC_CONSTANT_23; )"); } -TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant_NoId) { - auto* a = Override("a", ty.f32(), Expr(3.0f), - ast::AttributeList{ - Id(0), - }); - auto* b = Override("b", ty.f32(), Expr(2.0f)); +TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_Override_NoId) { + auto* a = Override("a", ty.f32(), Expr(3_f), Id(0)); + auto* b = Override("b", ty.f32(), Expr(2_f)); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(a)) << gen.error(); - ASSERT_TRUE(gen.EmitProgramConstVariable(b)) << gen.error(); + ASSERT_TRUE(gen.EmitOverride(a)) << gen.error(); + ASSERT_TRUE(gen.EmitOverride(b)) << gen.error(); EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_0 #define WGSL_SPEC_CONSTANT_0 3.0f #endif diff --git a/src/tint/writer/glsl/generator_impl_return_test.cc b/src/tint/writer/glsl/generator_impl_return_test.cc index 59df38514b..28bbf51b68 100644 --- a/src/tint/writer/glsl/generator_impl_return_test.cc +++ b/src/tint/writer/glsl/generator_impl_return_test.cc @@ -35,7 +35,7 @@ TEST_F(GlslGeneratorImplTest_Return, Emit_Return) { TEST_F(GlslGeneratorImplTest_Return, Emit_ReturnWithValue) { auto* r = Return(123_i); - Func("f", {}, ty.i32(), {r}); + Func("f", utils::Empty, ty.i32(), utils::Vector{r}); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/glsl/generator_impl_sanitizer_test.cc b/src/tint/writer/glsl/generator_impl_sanitizer_test.cc index 874bfd0a52..c801b47868 100644 --- a/src/tint/writer/glsl/generator_impl_sanitizer_test.cc +++ b/src/tint/writer/glsl/generator_impl_sanitizer_test.cc @@ -25,19 +25,14 @@ namespace { using GlslSanitizerTest = TestHelper; TEST_F(GlslSanitizerTest, Call_ArrayLength) { - auto* s = Structure("my_struct", {Member(0, "a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array(4))}); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, - Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -65,22 +60,17 @@ void main() { } TEST_F(GlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) { - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member(0, "z", ty.f32()), Member(4, "a", ty.array(4)), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, - Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -110,23 +100,19 @@ void main() { } TEST_F(GlslSanitizerTest, Call_ArrayLength_ViaLets) { - auto* s = Structure("my_struct", {Member(0, "a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array(4))}); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - auto* p = Let("p", nullptr, AddressOf("b")); - auto* p2 = Let("p2", nullptr, AddressOf(MemberAccessor(Deref(p), "a"))); + auto* p = Let("p", AddressOf("b")); + auto* p2 = Let("p2", AddressOf(MemberAccessor(Deref(p), "a"))); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(p), Decl(p2), - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, Call("arrayLength", p2))), + Decl(Var("len", ty.u32(), Call("arrayLength", p2))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -156,14 +142,13 @@ void main() { TEST_F(GlslSanitizerTest, PromoteArrayInitializerToConstVar) { auto* array_init = array(1_i, 2_i, 3_i, 4_i); - auto* array_index = IndexAccessor(array_init, 3_i); - auto* pos = Var("pos", ty.i32(), ast::StorageClass::kNone, array_index); - Func("main", ast::VariableList{}, ty.void_(), - { - Decl(pos), + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("idx", Expr(3_i))), + Decl(Var("pos", ty.i32(), IndexAccessor(array_init, "idx"))), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -176,8 +161,9 @@ TEST_F(GlslSanitizerTest, PromoteArrayInitializerToConstVar) { precision mediump float; void tint_symbol() { + int idx = 3; int tint_symbol_1[4] = int[4](1, 2, 3, 4); - int pos = tint_symbol_1[3]; + int pos = tint_symbol_1[idx]; } void main() { @@ -189,20 +175,20 @@ void main() { } TEST_F(GlslSanitizerTest, PromoteStructInitializerToConstVar) { - auto* str = Structure("S", { + auto* str = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.vec3()), Member("c", ty.i32()), }); - auto* struct_init = Construct(ty.Of(str), 1_i, vec3(2.f, 3.f, 4.f), 4_i); + auto* struct_init = Construct(ty.Of(str), 1_i, vec3(2_f, 3_f, 4_f), 4_i); auto* struct_access = MemberAccessor(struct_init, "b"); - auto* pos = Var("pos", ty.vec3(), ast::StorageClass::kNone, struct_access); + auto* pos = Var("pos", ty.vec3(), struct_access); - Func("main", ast::VariableList{}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(pos), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -239,15 +225,15 @@ TEST_F(GlslSanitizerTest, InlinePtrLetsBasic) { // let x : i32 = *p; auto* v = Var("v", ty.i32()); auto* p = Let("p", ty.pointer(ast::StorageClass::kFunction), AddressOf(v)); - auto* x = Var("x", ty.i32(), ast::StorageClass::kNone, Deref(p)); + auto* x = Var("x", ty.i32(), Deref(p)); - Func("main", ast::VariableList{}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(v), Decl(p), Decl(x), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -285,17 +271,17 @@ TEST_F(GlslSanitizerTest, InlinePtrLetsComplexChain) { AddressOf(IndexAccessor(Deref(ap), 3_i))); auto* vp = Let("vp", ty.pointer(ty.vec4(), ast::StorageClass::kFunction), AddressOf(IndexAccessor(Deref(mp), 2_i))); - auto* v = Var("v", ty.vec4(), ast::StorageClass::kNone, Deref(vp)); + auto* v = Var("v", ty.vec4(), Deref(vp)); - Func("main", ast::VariableList{}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(a), Decl(ap), Decl(mp), Decl(vp), Decl(v), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); diff --git a/src/tint/writer/glsl/generator_impl_storage_buffer_test.cc b/src/tint/writer/glsl/generator_impl_storage_buffer_test.cc index a12fbbcd9d..0264b0249b 100644 --- a/src/tint/writer/glsl/generator_impl_storage_buffer_test.cc +++ b/src/tint/writer/glsl/generator_impl_storage_buffer_test.cc @@ -13,9 +13,11 @@ // limitations under the License. #include "gmock/gmock.h" +#include "src/tint/number.h" #include "src/tint/writer/glsl/test_helper.h" using ::testing::HasSubstr; +using namespace tint::number_suffixes; // NOLINT namespace tint::writer::glsl { namespace { @@ -29,17 +31,14 @@ void TestAlign(ProgramBuilder* ctx) { // @align(256) louie : f32; // }; // @group(0) @binding(0) var nephews : Nephews; - auto* nephews = - ctx->Structure("Nephews", { - ctx->Member("huey", ctx->ty.f32(), {ctx->MemberAlign(256)}), - ctx->Member("dewey", ctx->ty.f32(), {ctx->MemberAlign(256)}), - ctx->Member("louie", ctx->ty.f32(), {ctx->MemberAlign(256)}), - }); - ctx->Global("nephews", ctx->ty.Of(nephews), ast::StorageClass::kStorage, - ast::AttributeList{ - ctx->create(0), - ctx->create(0), - }); + auto* nephews = ctx->Structure( + "Nephews", utils::Vector{ + ctx->Member("huey", ctx->ty.f32(), utils::Vector{ctx->MemberAlign(256_u)}), + ctx->Member("dewey", ctx->ty.f32(), utils::Vector{ctx->MemberAlign(256_u)}), + ctx->Member("louie", ctx->ty.f32(), utils::Vector{ctx->MemberAlign(256_u)}), + }); + ctx->GlobalVar("nephews", ctx->ty.Of(nephews), ast::StorageClass::kStorage, ctx->Binding(0), + ctx->Group(0)); } TEST_F(GlslGeneratorImplTest_StorageBuffer, Align) { diff --git a/src/tint/writer/glsl/generator_impl_switch_test.cc b/src/tint/writer/glsl/generator_impl_switch_test.cc index 1cc42fb639..c2db3b5ad7 100644 --- a/src/tint/writer/glsl/generator_impl_switch_test.cc +++ b/src/tint/writer/glsl/generator_impl_switch_test.cc @@ -22,21 +22,21 @@ namespace { using GlslGeneratorImplTest_Switch = TestHelper; TEST_F(GlslGeneratorImplTest_Switch, Emit_Switch) { - Global("cond", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.i32(), ast::StorageClass::kPrivate); auto* def_body = Block(create()); - auto* def = create(ast::CaseSelectorList{}, def_body); + auto* def = create(utils::Empty, def_body); - ast::CaseSelectorList case_val; - case_val.push_back(Expr(5_i)); + utils::Vector case_val{Expr(5_i)}; auto* case_body = Block(create()); auto* case_stmt = create(case_val, case_body); - ast::CaseStatementList body; - body.push_back(case_stmt); - body.push_back(def); + utils::Vector body{ + case_stmt, + def, + }; auto* cond = Expr("cond"); auto* s = create(cond, body); diff --git a/src/tint/writer/glsl/generator_impl_test.cc b/src/tint/writer/glsl/generator_impl_test.cc index ad114134e9..919d684b58 100644 --- a/src/tint/writer/glsl/generator_impl_test.cc +++ b/src/tint/writer/glsl/generator_impl_test.cc @@ -19,8 +19,17 @@ namespace { using GlslGeneratorImplTest = TestHelper; +TEST_F(GlslGeneratorImplTest, InvalidProgram) { + Diagnostics().add_error(diag::System::Writer, "make the program invalid"); + ASSERT_FALSE(IsValid()); + auto program = std::make_unique(std::move(*this)); + ASSERT_FALSE(program->IsValid()); + auto result = Generate(program.get(), Options{}, ""); + EXPECT_EQ(result.error, "input program is not valid"); +} + TEST_F(GlslGeneratorImplTest, Generate) { - Func("my_func", ast::VariableList{}, ty.void_(), ast::StatementList{}, ast::AttributeList{}); + Func("my_func", utils::Empty, ty.void_(), utils::Empty); GeneratorImpl& gen = Build(); @@ -34,7 +43,7 @@ void my_func() { } TEST_F(GlslGeneratorImplTest, GenerateDesktop) { - Func("my_func", ast::VariableList{}, ty.void_(), ast::StatementList{}, ast::AttributeList{}); + Func("my_func", utils::Empty, ty.void_(), utils::Empty); GeneratorImpl& gen = Build(Version(Version::Standard::kDesktop, 4, 4)); @@ -48,11 +57,16 @@ void my_func() { } TEST_F(GlslGeneratorImplTest, GenerateSampleIndexES) { - Global("gl_SampleID", ty.i32(), - ast::AttributeList{Builtin(ast::Builtin::kSampleIndex), - Disable(ast::DisabledValidation::kIgnoreStorageClass)}, - ast::StorageClass::kInput); - Func("my_func", {}, ty.i32(), ast::StatementList{Return(Expr("gl_SampleID"))}); + GlobalVar("gl_SampleID", ty.i32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleIndex), + Disable(ast::DisabledValidation::kIgnoreStorageClass), + }, + ast::StorageClass::kIn); + Func("my_func", utils::Empty, ty.i32(), + utils::Vector{ + Return(Expr("gl_SampleID")), + }); GeneratorImpl& gen = Build(Version(Version::Standard::kES, 3, 1)); @@ -68,11 +82,16 @@ int my_func() { } TEST_F(GlslGeneratorImplTest, GenerateSampleIndexDesktop) { - Global("gl_SampleID", ty.i32(), - ast::AttributeList{Builtin(ast::Builtin::kSampleIndex), - Disable(ast::DisabledValidation::kIgnoreStorageClass)}, - ast::StorageClass::kInput); - Func("my_func", {}, ty.i32(), ast::StatementList{Return(Expr("gl_SampleID"))}); + GlobalVar("gl_SampleID", ty.i32(), + utils::Vector{ + Builtin(ast::BuiltinValue::kSampleIndex), + Disable(ast::DisabledValidation::kIgnoreStorageClass), + }, + ast::StorageClass::kIn); + Func("my_func", utils::Empty, ty.i32(), + utils::Vector{ + Return(Expr("gl_SampleID")), + }); GeneratorImpl& gen = Build(Version(Version::Standard::kDesktop, 4, 4)); diff --git a/src/tint/writer/glsl/generator_impl_type_test.cc b/src/tint/writer/glsl/generator_impl_type_test.cc index b7daee263a..23da9759e7 100644 --- a/src/tint/writer/glsl/generator_impl_type_test.cc +++ b/src/tint/writer/glsl/generator_impl_type_test.cc @@ -33,7 +33,7 @@ using GlslGeneratorImplTest_Type = TestHelper; TEST_F(GlslGeneratorImplTest_Type, EmitType_Array) { auto* arr = ty.array(); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -46,7 +46,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Array) { TEST_F(GlslGeneratorImplTest_Type, EmitType_ArrayOfArray) { auto* arr = ty.array(ty.array(), 5_u); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -59,7 +59,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_ArrayOfArray) { TEST_F(GlslGeneratorImplTest_Type, EmitType_ArrayOfArrayOfArray) { auto* arr = ty.array(ty.array(ty.array(), 5_u), 6_u); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -72,7 +72,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_ArrayOfArrayOfArray) { TEST_F(GlslGeneratorImplTest_Type, EmitType_Array_WithoutName) { auto* arr = ty.array(); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -105,6 +105,19 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_F32) { EXPECT_EQ(out.str(), "float"); } +TEST_F(GlslGeneratorImplTest_Type, EmitType_F16) { + Enable(ast::Extension::kF16); + + auto* f16 = create(); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, f16, ast::StorageClass::kNone, ast::Access::kReadWrite, "")) + << gen.error(); + EXPECT_EQ(out.str(), "float16_t"); +} + TEST_F(GlslGeneratorImplTest_Type, EmitType_I32) { auto* i32 = create(); @@ -116,7 +129,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_I32) { EXPECT_EQ(out.str(), "int"); } -TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix) { +TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix_F32) { auto* f32 = create(); auto* vec3 = create(f32, 3u); auto* mat2x3 = create(vec3, 2u); @@ -129,12 +142,27 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix) { EXPECT_EQ(out.str(), "mat2x3"); } +TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix_F16) { + Enable(ast::Extension::kF16); + + auto* f16 = create(); + auto* vec3 = create(f16, 3u); + auto* mat2x3 = create(vec3, 2u); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, mat2x3, ast::StorageClass::kNone, ast::Access::kReadWrite, "")) + << gen.error(); + EXPECT_EQ(out.str(), "f16mat2x3"); +} + TEST_F(GlslGeneratorImplTest_Type, EmitType_StructDecl) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -150,11 +178,11 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_StructDecl) { } TEST_F(GlslGeneratorImplTest_Type, EmitType_Struct) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -166,11 +194,11 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Struct) { } TEST_F(GlslGeneratorImplTest_Type, EmitType_Struct_NameCollision) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("double", ty.i32()), Member("float", ty.f32()), }); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); GeneratorImpl& gen = SanitizeAndBuild(); @@ -183,11 +211,11 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Struct_NameCollision) { } TEST_F(GlslGeneratorImplTest_Type, EmitType_Struct_WithOffsetAttributes) { - auto* s = Structure("S", { - Member("a", ty.i32(), {MemberOffset(0)}), - Member("b", ty.f32(), {MemberOffset(8)}), + auto* s = Structure("S", utils::Vector{ + Member("a", ty.i32(), utils::Vector{MemberOffset(0)}), + Member("b", ty.f32(), utils::Vector{MemberOffset(8)}), }); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -213,7 +241,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_U32) { EXPECT_EQ(out.str(), "uint"); } -TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector) { +TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector_F32) { auto* f32 = create(); auto* vec3 = create(f32, 3u); @@ -225,6 +253,20 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector) { EXPECT_EQ(out.str(), "vec3"); } +TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector_F16) { + Enable(ast::Extension::kF16); + + auto* f16 = create(); + auto* vec3 = create(f16, 3u); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, vec3, ast::StorageClass::kNone, ast::Access::kReadWrite, "")) + << gen.error(); + EXPECT_EQ(out.str(), "f16vec3"); +} + TEST_F(GlslGeneratorImplTest_Type, EmitType_Void) { auto* void_ = create(); @@ -270,14 +312,15 @@ TEST_P(GlslDepthTexturesTest, Emit) { auto* t = ty.depth_texture(params.dim); - Global("tex", t, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("tex", t, Binding(1), Group(2)); - Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("textureDimensions", "tex")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); GeneratorImpl& gen = Build(); @@ -297,14 +340,15 @@ using GlslDepthMultisampledTexturesTest = TestHelper; TEST_F(GlslDepthMultisampledTexturesTest, Emit) { auto* t = ty.depth_multisampled_texture(ast::TextureDimension::k2d); - Global("tex", t, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("tex", t, Binding(1), Group(2)); - Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("textureDimensions", "tex")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); GeneratorImpl& gen = Build(); @@ -340,14 +384,15 @@ TEST_P(GlslSampledTexturesTest, Emit) { } auto* t = ty.sampled_texture(params.dim, datatype); - Global("tex", t, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("tex", t, Binding(1), Group(2)); - Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("textureDimensions", "tex")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); GeneratorImpl& gen = Build(); @@ -474,14 +519,15 @@ TEST_P(GlslStorageTexturesTest, Emit) { auto* t = ty.storage_texture(params.dim, params.imgfmt, ast::Access::kWrite); - Global("tex", t, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("tex", t, Binding(1), Group(2)); - Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("textureDimensions", "tex")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/glsl/generator_impl_unary_op_test.cc b/src/tint/writer/glsl/generator_impl_unary_op_test.cc index 0e318fcf8c..009d173b86 100644 --- a/src/tint/writer/glsl/generator_impl_unary_op_test.cc +++ b/src/tint/writer/glsl/generator_impl_unary_op_test.cc @@ -20,7 +20,7 @@ namespace { using GlslUnaryOpTest = TestHelper; TEST_F(GlslUnaryOpTest, AddressOf) { - Global("expr", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.f32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kAddressOf, Expr("expr")); WrapInFunction(op); @@ -32,7 +32,7 @@ TEST_F(GlslUnaryOpTest, AddressOf) { } TEST_F(GlslUnaryOpTest, Complement) { - Global("expr", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.u32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kComplement, Expr("expr")); WrapInFunction(op); @@ -44,9 +44,8 @@ TEST_F(GlslUnaryOpTest, Complement) { } TEST_F(GlslUnaryOpTest, Indirection) { - Global("G", ty.f32(), ast::StorageClass::kPrivate); - auto* p = - Let("expr", nullptr, create(ast::UnaryOp::kAddressOf, Expr("G"))); + GlobalVar("G", ty.f32(), ast::StorageClass::kPrivate); + auto* p = Let("expr", create(ast::UnaryOp::kAddressOf, Expr("G"))); auto* op = create(ast::UnaryOp::kIndirection, Expr("expr")); WrapInFunction(p, op); @@ -58,7 +57,7 @@ TEST_F(GlslUnaryOpTest, Indirection) { } TEST_F(GlslUnaryOpTest, Not) { - Global("expr", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.bool_(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kNot, Expr("expr")); WrapInFunction(op); @@ -70,7 +69,7 @@ TEST_F(GlslUnaryOpTest, Not) { } TEST_F(GlslUnaryOpTest, Negation) { - Global("expr", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.i32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kNegation, Expr("expr")); WrapInFunction(op); diff --git a/src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc b/src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc index 8709b3dadc..a2e5ee8968 100644 --- a/src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc +++ b/src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc @@ -23,8 +23,8 @@ namespace { using GlslGeneratorImplTest_UniformBuffer = TestHelper; TEST_F(GlslGeneratorImplTest_UniformBuffer, Simple) { - auto* simple = Structure("Simple", {Member("member", ty.f32())}); - Global("simple", ty.Of(simple), ast::StorageClass::kUniform, GroupAndBinding(0, 0)); + auto* simple = Structure("Simple", utils::Vector{Member("member", ty.f32())}); + GlobalVar("simple", ty.Of(simple), ast::StorageClass::kUniform, Group(0), Binding(0)); GeneratorImpl& gen = Build(); @@ -43,8 +43,8 @@ layout(binding = 0) uniform Simple_1 { } TEST_F(GlslGeneratorImplTest_UniformBuffer, Simple_Desktop) { - auto* simple = Structure("Simple", {Member("member", ty.f32())}); - Global("simple", ty.Of(simple), ast::StorageClass::kUniform, GroupAndBinding(0, 0)); + auto* simple = Structure("Simple", utils::Vector{Member("member", ty.f32())}); + GlobalVar("simple", ty.Of(simple), ast::StorageClass::kUniform, Group(0), Binding(0)); GeneratorImpl& gen = Build(Version(Version::Standard::kDesktop, 4, 4)); diff --git a/src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc b/src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc index d293dba94c..6cac4631f3 100644 --- a/src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc +++ b/src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc @@ -16,6 +16,8 @@ #include "src/tint/ast/variable_decl_statement.h" #include "src/tint/writer/glsl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::glsl { namespace { @@ -36,7 +38,7 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement) { EXPECT_EQ(gen.result(), " float a = 0.0f;\n"); } -TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const) { +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Let) { auto* var = Let("a", ty.f32(), Construct(ty.f32())); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -49,6 +51,346 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const) { EXPECT_EQ(gen.result(), " float a = 0.0f;\n"); } +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const) { + auto* var = Const("a", ty.f32(), Construct(ty.f32())); + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), ""); // Not a mistake - 'const' is inlined +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_AInt) { + auto* C = Const("C", Expr(1_a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + int l = 1; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_AFloat) { + auto* C = Const("C", Expr(1._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + float l = 1.0f; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_i32) { + auto* C = Const("C", Expr(1_i)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + int l = 1; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_u32) { + auto* C = Const("C", Expr(1_u)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + uint l = 1u; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f32) { + auto* C = Const("C", Expr(1_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + float l = 1.0f; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", Expr(1_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t l = 1.0hf; +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_AInt) { + auto* C = Const("C", Construct(ty.vec3(nullptr), 1_a, 2_a, 3_a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + ivec3 l = ivec3(1, 2, 3); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_AFloat) { + auto* C = Const("C", Construct(ty.vec3(nullptr), 1._a, 2._a, 3._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + vec3 l = vec3(1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f32) { + auto* C = Const("C", vec3(1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + vec3 l = vec3(1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", vec3(1_h, 2_h, 3_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 l = f16vec3(1.0hf, 2.0hf, 3.0hf); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_AFloat) { + auto* C = Const("C", Construct(ty.mat(nullptr, 2, 3), 1._a, 2._a, 3._a, 4._a, 5._a, 6._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + mat2x3 l = mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f32) { + auto* C = Const("C", mat2x3(1_f, 2_f, 3_f, 4_f, 5_f, 6_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + mat2x3 l = mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16mat2x3 l = f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf)); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_arr_f32) { + auto* C = Const("C", Construct(ty.array(), 1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + float l[3] = float[3](1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_arr_vec2_bool) { + auto* C = Const("C", Construct(ty.array(ty.vec2(), 3_u), // + vec2(true, false), // + vec2(false, true), // + vec2(true, true))); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#version 310 es + +void f() { + bvec2 l[3] = bvec2[3](bvec2(true, false), bvec2(false, true), bvec2(true)); +} + +)"); +} + TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Array) { auto* var = Var("a", ty.array()); @@ -64,7 +406,7 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Array) { } TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Private) { - Global("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); WrapInFunction(Expr("a")); @@ -76,21 +418,8 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Private) { EXPECT_THAT(gen.result(), HasSubstr(" float a = 0.0f;\n")); } -TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_Private) { - Global("initializer", ty.f32(), ast::StorageClass::kPrivate); - Global("a", ty.f32(), ast::StorageClass::kPrivate, Expr("initializer")); - - WrapInFunction(Expr("a")); - - GeneratorImpl& gen = Build(); - - ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr(R"(float a = initializer; -)")); -} - -TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec) { - auto* var = Var("a", ty.vec3(), ast::StorageClass::kNone, vec3()); +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_f32) { + auto* var = Var("a", ty.vec3(), vec3()); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -98,12 +427,27 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); - EXPECT_EQ(gen.result(), R"(vec3 a = vec3(0.0f, 0.0f, 0.0f); + EXPECT_EQ(gen.result(), R"(vec3 a = vec3(0.0f); )"); } -TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat) { - auto* var = Var("a", ty.mat2x3(), ast::StorageClass::kNone, mat2x3()); +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_f16) { + Enable(ast::Extension::kF16); + + auto* var = Var("a", ty.vec3(), vec3()); + + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), R"(f16vec3 a = f16vec3(0.0hf); +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_f32) { + auto* var = Var("a", ty.mat2x3(), mat2x3()); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -112,7 +456,23 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); EXPECT_EQ(gen.result(), - R"(mat2x3 a = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + R"(mat2x3 a = mat2x3(vec3(0.0f), vec3(0.0f)); +)"); +} + +TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_f16) { + Enable(ast::Extension::kF16); + + auto* var = Var("a", ty.mat2x3(), mat2x3()); + + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), + R"(f16mat2x3 a = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); )"); } diff --git a/src/tint/writer/glsl/generator_impl_workgroup_var_test.cc b/src/tint/writer/glsl/generator_impl_workgroup_var_test.cc index a61cb175cc..9b39fda9ae 100644 --- a/src/tint/writer/glsl/generator_impl_workgroup_var_test.cc +++ b/src/tint/writer/glsl/generator_impl_workgroup_var_test.cc @@ -27,10 +27,10 @@ namespace { using GlslGeneratorImplTest_WorkgroupVar = TestHelper; TEST_F(GlslGeneratorImplTest_WorkgroupVar, Basic) { - Global("wg", ty.f32(), ast::StorageClass::kWorkgroup); + GlobalVar("wg", ty.f32(), ast::StorageClass::kWorkgroup); - Func("main", {}, ty.void_(), {Assign("wg", 1.2f)}, - { + Func("main", utils::Empty, ty.void_(), utils::Vector{Assign("wg", 1.2_f)}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -43,10 +43,10 @@ TEST_F(GlslGeneratorImplTest_WorkgroupVar, Basic) { TEST_F(GlslGeneratorImplTest_WorkgroupVar, Aliased) { auto* alias = Alias("F32", ty.f32()); - Global("wg", ty.Of(alias), ast::StorageClass::kWorkgroup); + GlobalVar("wg", ty.Of(alias), ast::StorageClass::kWorkgroup); - Func("main", {}, ty.void_(), {Assign("wg", 1.2f)}, - { + Func("main", utils::Empty, ty.void_(), utils::Vector{Assign("wg", 1.2_f)}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); diff --git a/src/tint/writer/hlsl/generator.cc b/src/tint/writer/hlsl/generator.cc index ff3ffbe38f..b514c2b641 100644 --- a/src/tint/writer/hlsl/generator.cc +++ b/src/tint/writer/hlsl/generator.cc @@ -29,6 +29,10 @@ Result::Result(const Result&) = default; Result Generate(const Program* program, const Options& options) { Result result; + if (!program->IsValid()) { + result.error = "input program is not valid"; + return result; + } // Sanitize the program. auto sanitized_result = Sanitize(program, options); diff --git a/src/tint/writer/hlsl/generator.h b/src/tint/writer/hlsl/generator.h index f658c9949e..233416ea99 100644 --- a/src/tint/writer/hlsl/generator.h +++ b/src/tint/writer/hlsl/generator.h @@ -16,6 +16,7 @@ #define SRC_TINT_WRITER_HLSL_GENERATOR_H_ #include +#include #include #include #include @@ -30,9 +31,6 @@ namespace tint { class Program; } // namespace tint -namespace tint::writer::hlsl { -class GeneratorImpl; -} // namespace tint::writer::hlsl namespace tint::writer::hlsl { @@ -49,7 +47,7 @@ struct Options { Options& operator=(const Options&); /// The binding point to use for information passed via root constants. - sem::BindingPoint root_constant_binding_point; + std::optional root_constant_binding_point; /// Set to `true` to disable workgroup memory zero initialization bool disable_workgroup_init = false; /// Set to 'true' to generates binding mappings for external textures diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc index a64630b4dd..fca1515dd9 100644 --- a/src/tint/writer/hlsl/generator_impl.cc +++ b/src/tint/writer/hlsl/generator_impl.cc @@ -33,6 +33,7 @@ #include "src/tint/sem/atomic.h" #include "src/tint/sem/block_statement.h" #include "src/tint/sem/call.h" +#include "src/tint/sem/constant.h" #include "src/tint/sem/depth_multisampled_texture.h" #include "src/tint/sem/depth_texture.h" #include "src/tint/sem/function.h" @@ -52,23 +53,26 @@ #include "src/tint/transform/calculate_array_length.h" #include "src/tint/transform/canonicalize_entry_point_io.h" #include "src/tint/transform/decompose_memory_access.h" +#include "src/tint/transform/disable_uniformity_analysis.h" #include "src/tint/transform/expand_compound_assignment.h" #include "src/tint/transform/fold_trivial_single_use_lets.h" #include "src/tint/transform/localize_struct_array_assignment.h" #include "src/tint/transform/loop_to_for_loop.h" #include "src/tint/transform/manager.h" #include "src/tint/transform/num_workgroups_from_uniform.h" -#include "src/tint/transform/promote_initializers_to_const_var.h" +#include "src/tint/transform/promote_initializers_to_let.h" #include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/remove_continue_in_switch.h" #include "src/tint/transform/remove_phonies.h" #include "src/tint/transform/simplify_pointers.h" #include "src/tint/transform/unshadow.h" #include "src/tint/transform/unwind_discard_functions.h" +#include "src/tint/transform/vectorize_scalar_matrix_constructors.h" #include "src/tint/transform/zero_init_workgroup_memory.h" #include "src/tint/utils/defer.h" #include "src/tint/utils/map.h" #include "src/tint/utils/scoped_assignment.h" +#include "src/tint/utils/string.h" #include "src/tint/writer/append_vector.h" #include "src/tint/writer/float_to_string.h" #include "src/tint/writer/generate_external_texture_bindings.h" @@ -107,18 +111,40 @@ const char* image_format_to_rwtexture_type(ast::TexelFormat image_format) { } } +void PrintF32(std::ostream& out, float value) { + // Note: Currently inf and nan should not be constructable, but this is implemented for the day + // we support them. + if (std::isinf(value)) { + out << (value >= 0 ? "asfloat(0x7f800000u)" : "asfloat(0xff800000u)"); + } else if (std::isnan(value)) { + out << "asfloat(0x7fc00000u)"; + } else { + out << FloatToString(value) << "f"; + } +} + +bool PrintF16(std::ostream& out, float value) { + // Note: Currently inf and nan should not be constructable, don't emit them. + if (std::isinf(value) || std::isnan(value)) { + return false; + } else { + out << FloatToString(value) << "h"; + return true; + } +} + // Helper for writing " : register(RX, spaceY)", where R is the register, X is // the binding point binding value, and Y is the binding point group value. struct RegisterAndSpace { - RegisterAndSpace(char r, ast::VariableBindingPoint bp) : reg(r), binding_point(bp) {} + RegisterAndSpace(char r, sem::BindingPoint bp) : reg(r), binding_point(bp) {} const char reg; - ast::VariableBindingPoint const binding_point; + sem::BindingPoint const binding_point; }; std::ostream& operator<<(std::ostream& s, const RegisterAndSpace& rs) { - s << " : register(" << rs.reg << rs.binding_point.binding->value << ", space" - << rs.binding_point.group->value << ")"; + s << " : register(" << rs.reg << rs.binding_point.binding << ", space" << rs.binding_point.group + << ")"; return s; } @@ -139,8 +165,13 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { transform::Manager manager; transform::DataMap data; + manager.Add(); + { // Builtin polyfills transform::BuiltinPolyfill::Builtins polyfills; + polyfills.acosh = transform::BuiltinPolyfill::Level::kFull; + polyfills.asinh = true; + polyfills.atanh = transform::BuiltinPolyfill::Level::kFull; // TODO(crbug.com/tint/1449): Some of these can map to HLSL's `firstbitlow` // and `firstbithigh`. polyfills.count_leading_zeros = true; @@ -195,6 +226,7 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { manager.Add(); manager.Add(); manager.Add(); + manager.Add(); manager.Add(); manager.Add(); // ArrayLengthFromUniform must come after InlinePointerLets and Simplify, as @@ -213,7 +245,7 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { // DecomposeMemoryAccess special-cases the arrayLength() intrinsic, which // will be transformed by CalculateArrayLength manager.Add(); - manager.Add(); + manager.Add(); manager.Add(); @@ -243,8 +275,8 @@ bool GeneratorImpl::Generate() { auto* mod = builder_.Sem().Module(); for (auto* decl : mod->DependencyOrderedDeclarations()) { - if (decl->Is()) { - continue; // Ignore aliases. + if (decl->IsAnyOf()) { + continue; // These are not emitted. } // Emit a new line between declarations if the type of declaration has @@ -285,11 +317,6 @@ bool GeneratorImpl::Generate() { } return EmitFunction(func); }, - [&](const ast::Enable*) { - // Currently we don't have to do anything for using a extension in - // HLSL - return true; - }, [&](Default) { TINT_ICE(Writer, diagnostics_) << "unhandled module-scope declaration: " << decl->TypeInfo().name; @@ -348,7 +375,7 @@ bool GeneratorImpl::EmitDynamicVectorAssignment(const ast::AssignmentStatement* out << "vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;"; break; default: - TINT_UNREACHABLE(Writer, builder_.Diagnostics()) + TINT_UNREACHABLE(Writer, diagnostics_) << "invalid vector size " << vec->Width(); break; } @@ -507,7 +534,7 @@ bool GeneratorImpl::EmitDynamicMatrixScalarAssignment(const ast::AssignmentState << vec_name << ";"; break; default: - TINT_UNREACHABLE(Writer, builder_.Diagnostics()) + TINT_UNREACHABLE(Writer, diagnostics_) << "invalid vector size " << vec->Width(); break; } @@ -595,8 +622,7 @@ bool GeneratorImpl::EmitAssign(const ast::AssignmentStatement* stmt) { if (auto* mat = TypeOf(lhs_sub_access->object)->UnwrapRef()->As()) { auto* rhs_col_idx_sem = builder_.Sem().Get(lhs_access->index); auto* rhs_row_idx_sem = builder_.Sem().Get(lhs_sub_access->index); - if (!rhs_col_idx_sem->ConstantValue().IsValid() || - !rhs_row_idx_sem->ConstantValue().IsValid()) { + if (!rhs_col_idx_sem->ConstantValue() || !rhs_row_idx_sem->ConstantValue()) { return EmitDynamicMatrixScalarAssignment(stmt, mat); } } @@ -606,7 +632,7 @@ bool GeneratorImpl::EmitAssign(const ast::AssignmentStatement* stmt) { const auto* lhs_access_type = TypeOf(lhs_access->object)->UnwrapRef(); if (auto* mat = lhs_access_type->As()) { auto* lhs_index_sem = builder_.Sem().Get(lhs_access->index); - if (!lhs_index_sem->ConstantValue().IsValid()) { + if (!lhs_index_sem->ConstantValue()) { return EmitDynamicMatrixVectorAssignment(stmt, mat); } } @@ -614,7 +640,7 @@ bool GeneratorImpl::EmitAssign(const ast::AssignmentStatement* stmt) { // indices if (auto* vec = lhs_access_type->As()) { auto* rhs_sem = builder_.Sem().Get(lhs_access->index); - if (!rhs_sem->ConstantValue().IsValid()) { + if (!rhs_sem->ConstantValue()) { return EmitDynamicVectorAssignment(stmt, vec); } } @@ -634,35 +660,31 @@ bool GeneratorImpl::EmitAssign(const ast::AssignmentStatement* stmt) { bool GeneratorImpl::EmitExpressionOrOneIfZero(std::ostream& out, const ast::Expression* expr) { // For constants, replace literal 0 with 1. - sem::Constant::Scalars elems; - if (const auto& val = builder_.Sem().Get(expr)->ConstantValue()) { - if (!val.AnyZero()) { + if (const auto* val = builder_.Sem().Get(expr)->ConstantValue()) { + if (!val->AnyZero()) { return EmitExpression(out, expr); } - if (val.Type()->IsAnyOf()) { - return EmitValue(out, val.Type(), 1); + auto* ty = val->Type(); + + if (ty->IsAnyOf()) { + return EmitValue(out, ty, 1); } - if (auto* vec = val.Type()->As()) { + if (auto* vec = ty->As()) { auto* elem_ty = vec->type(); - if (!EmitType(out, val.Type(), ast::StorageClass::kNone, ast::Access::kUndefined, "")) { + if (!EmitType(out, ty, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { return false; } out << "("; - for (size_t i = 0; i < val.Elements().size(); ++i) { + for (size_t i = 0; i < vec->Width(); ++i) { if (i != 0) { out << ", "; } - if (!val.WithScalarAt(i, [&](auto&& s) -> bool { - // Use std::equal_to to work around -Wfloat-equal warnings - using T = std::remove_reference_t; - auto equal_to = std::equal_to{}; - bool is_zero = equal_to(s, T(0)); - return EmitValue(out, elem_ty, is_zero ? 1 : static_cast(s)); - })) { + auto s = val->Index(i)->As(); + if (!EmitValue(out, elem_ty, (s == 0) ? 1 : static_cast(s))) { return false; } } @@ -803,8 +825,7 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, const ast::BinaryExpression* e return true; } - out << "("; - TINT_DEFER(out << ")"); + ScopedParen sp(out); if (!EmitExpression(out, expr->lhs)) { return false; @@ -896,7 +917,7 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, const ast::BinaryExpression* e return true; } -bool GeneratorImpl::EmitStatements(const ast::StatementList& stmts) { +bool GeneratorImpl::EmitStatements(utils::VectorRef stmts) { for (auto* s : stmts) { if (!EmitStatement(s)) { return false; @@ -905,7 +926,7 @@ bool GeneratorImpl::EmitStatements(const ast::StatementList& stmts) { return true; } -bool GeneratorImpl::EmitStatementsWithIndent(const ast::StatementList& stmts) { +bool GeneratorImpl::EmitStatementsWithIndent(utils::VectorRef stmts) { ScopedIndent si(this); return EmitStatements(stmts); } @@ -925,7 +946,7 @@ bool GeneratorImpl::EmitBreak(const ast::BreakStatement*) { } bool GeneratorImpl::EmitCall(std::ostream& out, const ast::CallExpression* expr) { - auto* call = builder_.Sem().Get(expr); + auto* call = builder_.Sem().Get(expr); auto* target = call->Target(); return Switch( target, [&](const sem::Function* func) { return EmitFunctionCall(out, call, func); }, @@ -964,7 +985,10 @@ bool GeneratorImpl::EmitFunctionCall(std::ostream& out, case ast::StorageClass::kUniform: return EmitUniformBufferAccess(out, expr, intrinsic); case ast::StorageClass::kStorage: - return EmitStorageBufferAccess(out, expr, intrinsic); + if (!intrinsic->IsAtomic()) { + return EmitStorageBufferAccess(out, expr, intrinsic); + } + break; default: TINT_UNREACHABLE(Writer, diagnostics_) << "unsupported DecomposeMemoryAccess::Intrinsic storage class:" @@ -994,23 +1018,25 @@ bool GeneratorImpl::EmitFunctionCall(std::ostream& out, bool GeneratorImpl::EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin) { + const auto type = builtin->Type(); + auto* expr = call->Declaration(); if (builtin->IsTexture()) { return EmitTextureCall(out, call, builtin); } - if (builtin->Type() == sem::BuiltinType::kSelect) { + if (type == sem::BuiltinType::kSelect) { return EmitSelectCall(out, expr); } - if (builtin->Type() == sem::BuiltinType::kModf) { + if (type == sem::BuiltinType::kModf) { return EmitModfCall(out, expr, builtin); } - if (builtin->Type() == sem::BuiltinType::kFrexp) { + if (type == sem::BuiltinType::kFrexp) { return EmitFrexpCall(out, expr, builtin); } - if (builtin->Type() == sem::BuiltinType::kDegrees) { + if (type == sem::BuiltinType::kDegrees) { return EmitDegreesCall(out, expr, builtin); } - if (builtin->Type() == sem::BuiltinType::kRadians) { + if (type == sem::BuiltinType::kRadians) { return EmitRadiansCall(out, expr, builtin); } if (builtin->IsDataPacking()) { @@ -1025,11 +1051,30 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out, if (builtin->IsAtomic()) { return EmitWorkgroupAtomicCall(out, expr, builtin); } + if (builtin->IsDP4a()) { + return EmitDP4aCall(out, expr, builtin); + } + auto name = generate_builtin_name(builtin); if (name.empty()) { return false; } + // Handle single argument builtins that only accept and return uint (not int overload). We need + // to explicitly cast the return value (we also cast the arg for good measure). See + // crbug.com/tint/1550 + if (type == sem::BuiltinType::kCountOneBits || type == sem::BuiltinType::kReverseBits) { + auto* arg = call->Arguments()[0]; + if (arg->Type()->UnwrapRef()->is_signed_scalar_or_vector()) { + out << "asint(" << name << "(asuint("; + if (!EmitExpression(out, arg->Declaration())) { + return false; + } + out << ")))"; + return true; + } + } + out << name << "("; bool first = true; @@ -1045,6 +1090,7 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out, } out << ")"; + return true; } @@ -1071,23 +1117,29 @@ bool GeneratorImpl::EmitTypeConstructor(std::ostream& out, // If the type constructor is empty then we need to construct with the zero // value for all components. - if (call->Arguments().empty()) { + if (call->Arguments().IsEmpty()) { return EmitZeroValue(out, type); } + // Single parameter matrix initializers must be identity constructor. + // It could also be conversions between f16 and f32 matrix when f16 is properly supported. + if (type->Is() && call->Arguments().Length() == 1) { + if (!ctor->Parameters()[0]->Type()->UnwrapRef()->is_float_matrix()) { + TINT_UNREACHABLE(Writer, diagnostics_) + << "found a single-parameter matrix constructor that is not identity constructor"; + return false; + } + } + bool brackets = type->IsAnyOf(); // For single-value vector initializers, swizzle the scalar to the right // vector dimension using .x const bool is_single_value_vector_init = type->is_scalar_vector() && - call->Arguments().size() == 1 && + call->Arguments().Length() == 1 && ctor->Parameters()[0]->Type()->is_scalar(); - auto it = structure_builders_.find(As(type)); - if (it != structure_builders_.end()) { - out << it->second << "("; - brackets = false; - } else if (brackets) { + if (brackets) { out << "{"; } else { if (!EmitType(out, type, ast::StorageClass::kNone, ast::Access::kReadWrite, "")) { @@ -1133,9 +1185,9 @@ bool GeneratorImpl::EmitUniformBufferAccess( // If true, use scalar_offset_value, otherwise use scalar_offset_expr bool scalar_offset_constant = false; - if (auto val = offset_arg->ConstantValue()) { - TINT_ASSERT(Writer, val.Type()->Is()); - scalar_offset_value = val.Elements()[0].u32; + if (auto* val = offset_arg->ConstantValue()) { + TINT_ASSERT(Writer, val->Type()->Is()); + scalar_offset_value = static_cast(std::get(val->Value())); scalar_offset_value /= 4; // bytes -> scalar index scalar_offset_constant = true; } @@ -1370,19 +1422,10 @@ bool GeneratorImpl::EmitStorageBufferAccess( << static_cast(intrinsic->type); return false; } - - case Op::kAtomicLoad: - case Op::kAtomicStore: - case Op::kAtomicAdd: - case Op::kAtomicSub: - case Op::kAtomicMax: - case Op::kAtomicMin: - case Op::kAtomicAnd: - case Op::kAtomicOr: - case Op::kAtomicXor: - case Op::kAtomicExchange: - case Op::kAtomicCompareExchangeWeak: - return EmitStorageAtomicCall(out, expr, intrinsic); + default: + // Break out to error case below/ + // Note that atomic intrinsics are generated as functions. + break; } TINT_UNREACHABLE(Writer, diagnostics_) @@ -1390,32 +1433,127 @@ bool GeneratorImpl::EmitStorageBufferAccess( return false; } -bool GeneratorImpl::EmitStorageAtomicCall( - std::ostream& out, - const ast::CallExpression* expr, +bool GeneratorImpl::EmitStorageAtomicIntrinsic( + const ast::Function* func, const transform::DecomposeMemoryAccess::Intrinsic* intrinsic) { using Op = transform::DecomposeMemoryAccess::Intrinsic::Op; - auto* result_ty = TypeOf(expr); + const sem::Function* sem_func = builder_.Sem().Get(func); + auto* result_ty = sem_func->ReturnType(); + const auto& params = sem_func->Parameters(); + const auto name = builder_.Symbols().NameFor(func->symbol); + auto& buf = *current_buffer_; - auto& buf = helpers_; + auto rmw = [&](const char* hlsl) -> bool { + { + auto fn = line(&buf); + if (!EmitTypeAndName(fn, result_ty, ast::StorageClass::kNone, ast::Access::kUndefined, + name)) { + return false; + } + fn << "(RWByteAddressBuffer buffer, uint offset, "; + if (!EmitTypeAndName(fn, result_ty, ast::StorageClass::kNone, ast::Access::kUndefined, + "value")) { + return false; + } + fn << ") {"; + } - // generate_helper() generates a helper function that translates the - // DecomposeMemoryAccess::Intrinsic call into the corresponding HLSL - // atomic intrinsic function. - auto generate_helper = [&]() -> std::string { - auto rmw = [&](const char* wgsl, const char* hlsl) -> std::string { - auto name = UniqueIdentifier(wgsl); + buf.IncrementIndent(); + TINT_DEFER({ + buf.DecrementIndent(); + line(&buf) << "}"; + line(&buf); + }); + + { + auto l = line(&buf); + if (!EmitTypeAndName(l, result_ty, ast::StorageClass::kNone, ast::Access::kUndefined, + "original_value")) { + return false; + } + l << " = 0;"; + } + { + auto l = line(&buf); + l << "buffer." << hlsl << "(offset, "; + if (intrinsic->op == Op::kAtomicSub) { + l << "-"; + } + l << "value, original_value);"; + } + line(&buf) << "return original_value;"; + return true; + }; + + switch (intrinsic->op) { + case Op::kAtomicAdd: + return rmw("InterlockedAdd"); + + case Op::kAtomicSub: + // Use add with the operand negated. + return rmw("InterlockedAdd"); + + case Op::kAtomicMax: + return rmw("InterlockedMax"); + + case Op::kAtomicMin: + return rmw("InterlockedMin"); + + case Op::kAtomicAnd: + return rmw("InterlockedAnd"); + + case Op::kAtomicOr: + return rmw("InterlockedOr"); + + case Op::kAtomicXor: + return rmw("InterlockedXor"); + + case Op::kAtomicExchange: + return rmw("InterlockedExchange"); + + case Op::kAtomicLoad: { + // HLSL does not have an InterlockedLoad, so we emulate it with + // InterlockedOr using 0 as the OR value { auto fn = line(&buf); if (!EmitTypeAndName(fn, result_ty, ast::StorageClass::kNone, ast::Access::kUndefined, name)) { - return ""; + return false; } - fn << "(RWByteAddressBuffer buffer, uint offset, "; - if (!EmitTypeAndName(fn, result_ty, ast::StorageClass::kNone, + fn << "(RWByteAddressBuffer buffer, uint offset) {"; + } + + buf.IncrementIndent(); + TINT_DEFER({ + buf.DecrementIndent(); + line(&buf) << "}"; + line(&buf); + }); + + { + auto l = line(&buf); + if (!EmitTypeAndName(l, result_ty, ast::StorageClass::kNone, ast::Access::kUndefined, "value")) { - return ""; + return false; + } + l << " = 0;"; + } + + line(&buf) << "buffer.InterlockedOr(offset, 0, value);"; + line(&buf) << "return value;"; + return true; + } + case Op::kAtomicStore: { + // HLSL does not have an InterlockedStore, so we emulate it with + // InterlockedExchange and discard the returned value + auto* value_ty = params[2]->Type()->UnwrapRef(); + { + auto fn = line(&buf); + fn << "void " << name << "(RWByteAddressBuffer buffer, uint offset, "; + if (!EmitTypeAndName(fn, value_ty, ast::StorageClass::kNone, + ast::Access::kUndefined, "value")) { + return false; } fn << ") {"; } @@ -1429,191 +1567,73 @@ bool GeneratorImpl::EmitStorageAtomicCall( { auto l = line(&buf); - if (!EmitTypeAndName(l, result_ty, ast::StorageClass::kNone, - ast::Access::kUndefined, "original_value")) { - return ""; + if (!EmitTypeAndName(l, value_ty, ast::StorageClass::kNone, ast::Access::kUndefined, + "ignored")) { + return false; } - l << " = 0;"; + l << ";"; } + line(&buf) << "buffer.InterlockedExchange(offset, value, ignored);"; + return true; + } + case Op::kAtomicCompareExchangeWeak: { + // NOTE: We don't need to emit the return type struct here as DecomposeMemoryAccess + // already added it to the AST, and it should have already been emitted by now. + auto* value_ty = params[2]->Type()->UnwrapRef(); { + auto fn = line(&buf); + if (!EmitTypeAndName(fn, result_ty, ast::StorageClass::kNone, + ast::Access::kUndefined, name)) { + return false; + } + fn << "(RWByteAddressBuffer buffer, uint offset, "; + if (!EmitTypeAndName(fn, value_ty, ast::StorageClass::kNone, + ast::Access::kUndefined, "compare")) { + return false; + } + fn << ", "; + if (!EmitTypeAndName(fn, value_ty, ast::StorageClass::kNone, + ast::Access::kUndefined, "value")) { + return false; + } + fn << ") {"; + } + + buf.IncrementIndent(); + TINT_DEFER({ + buf.DecrementIndent(); + line(&buf) << "}"; + line(&buf); + }); + + { // T result = {0}; auto l = line(&buf); - l << "buffer." << hlsl << "(offset, "; - if (intrinsic->op == Op::kAtomicSub) { - l << "-"; + if (!EmitTypeAndName(l, result_ty, ast::StorageClass::kNone, + ast::Access::kUndefined, "result")) { + return false; } - l << "value, original_value);"; + l << "="; + if (!EmitZeroValue(l, result_ty)) { + return false; + } + l << ";"; } - line(&buf) << "return original_value;"; - return name; - }; - switch (intrinsic->op) { - case Op::kAtomicAdd: - return rmw("atomicAdd", "InterlockedAdd"); + line(&buf) << "buffer.InterlockedCompareExchange(offset, compare, value, " + "result.old_value);"; + line(&buf) << "result.exchanged = result.old_value == compare;"; + line(&buf) << "return result;"; - case Op::kAtomicSub: - // Use add with the operand negated. - return rmw("atomicSub", "InterlockedAdd"); - - case Op::kAtomicMax: - return rmw("atomicMax", "InterlockedMax"); - - case Op::kAtomicMin: - return rmw("atomicMin", "InterlockedMin"); - - case Op::kAtomicAnd: - return rmw("atomicAnd", "InterlockedAnd"); - - case Op::kAtomicOr: - return rmw("atomicOr", "InterlockedOr"); - - case Op::kAtomicXor: - return rmw("atomicXor", "InterlockedXor"); - - case Op::kAtomicExchange: - return rmw("atomicExchange", "InterlockedExchange"); - - case Op::kAtomicLoad: { - // HLSL does not have an InterlockedLoad, so we emulate it with - // InterlockedOr using 0 as the OR value - auto name = UniqueIdentifier("atomicLoad"); - { - auto fn = line(&buf); - if (!EmitTypeAndName(fn, result_ty, ast::StorageClass::kNone, - ast::Access::kUndefined, name)) { - return ""; - } - fn << "(RWByteAddressBuffer buffer, uint offset) {"; - } - - buf.IncrementIndent(); - TINT_DEFER({ - buf.DecrementIndent(); - line(&buf) << "}"; - line(&buf); - }); - - { - auto l = line(&buf); - if (!EmitTypeAndName(l, result_ty, ast::StorageClass::kNone, - ast::Access::kUndefined, "value")) { - return ""; - } - l << " = 0;"; - } - - line(&buf) << "buffer.InterlockedOr(offset, 0, value);"; - line(&buf) << "return value;"; - return name; - } - case Op::kAtomicStore: { - // HLSL does not have an InterlockedStore, so we emulate it with - // InterlockedExchange and discard the returned value - auto* value_ty = TypeOf(expr->args[2])->UnwrapRef(); - auto name = UniqueIdentifier("atomicStore"); - { - auto fn = line(&buf); - fn << "void " << name << "(RWByteAddressBuffer buffer, uint offset, "; - if (!EmitTypeAndName(fn, value_ty, ast::StorageClass::kNone, - ast::Access::kUndefined, "value")) { - return ""; - } - fn << ") {"; - } - - buf.IncrementIndent(); - TINT_DEFER({ - buf.DecrementIndent(); - line(&buf) << "}"; - line(&buf); - }); - - { - auto l = line(&buf); - if (!EmitTypeAndName(l, value_ty, ast::StorageClass::kNone, - ast::Access::kUndefined, "ignored")) { - return ""; - } - l << ";"; - } - line(&buf) << "buffer.InterlockedExchange(offset, value, ignored);"; - return name; - } - case Op::kAtomicCompareExchangeWeak: { - auto* value_ty = TypeOf(expr->args[2])->UnwrapRef(); - - auto name = UniqueIdentifier("atomicCompareExchangeWeak"); - { - auto fn = line(&buf); - if (!EmitTypeAndName(fn, result_ty, ast::StorageClass::kNone, - ast::Access::kUndefined, name)) { - return ""; - } - fn << "(RWByteAddressBuffer buffer, uint offset, "; - if (!EmitTypeAndName(fn, value_ty, ast::StorageClass::kNone, - ast::Access::kUndefined, "compare")) { - return ""; - } - fn << ", "; - if (!EmitTypeAndName(fn, value_ty, ast::StorageClass::kNone, - ast::Access::kUndefined, "value")) { - return ""; - } - fn << ") {"; - } - - buf.IncrementIndent(); - TINT_DEFER({ - buf.DecrementIndent(); - line(&buf) << "}"; - line(&buf); - }); - - { // T result = {0, 0}; - auto l = line(&buf); - if (!EmitTypeAndName(l, result_ty, ast::StorageClass::kNone, - ast::Access::kUndefined, "result")) { - return ""; - } - l << " = {0, 0};"; - } - line(&buf) << "buffer.InterlockedCompareExchange(offset, compare, " - "value, result.x);"; - line(&buf) << "result.y = result.x == compare;"; - line(&buf) << "return result;"; - return name; - } - default: - break; + return true; } - TINT_UNREACHABLE(Writer, diagnostics_) - << "unsupported atomic DecomposeMemoryAccess::Intrinsic::Op: " - << static_cast(intrinsic->op); - return ""; - }; - - auto func = utils::GetOrCreate(dma_intrinsics_, DMAIntrinsic{intrinsic->op, intrinsic->type}, - generate_helper); - if (func.empty()) { - return false; + default: + break; } - out << func; - { - ScopedParen sp(out); - bool first = true; - for (auto* arg : expr->args) { - if (!first) { - out << ", "; - } - first = false; - if (!EmitExpression(out, arg)) { - return false; - } - } - } - - return true; + TINT_UNREACHABLE(Writer, diagnostics_) + << "unsupported atomic DecomposeMemoryAccess::Intrinsic::Op: " + << static_cast(intrinsic->op); + return false; } bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out, @@ -1640,7 +1660,7 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out, { ScopedParen sp(pre); - for (size_t i = 0; i < expr->args.size(); i++) { + for (size_t i = 0; i < expr->args.Length(); i++) { auto* arg = expr->args[i]; if (i > 0) { pre << ", "; @@ -1713,6 +1733,12 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out, return true; } case sem::BuiltinType::kAtomicCompareExchangeWeak: { + // Emit the builtin return type unique to this overload. This does not + // exist in the AST, so it will not be generated in Generate(). + if (!EmitStructTypeOnce(&helpers_, builtin->ReturnType()->As())) { + return false; + } + auto* dest = expr->args[0]; auto* compare_value = expr->args[1]; auto* value = expr->args[2]; @@ -1721,8 +1747,8 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out, { // T compare_value = ; auto pre = line(); - if (!EmitTypeAndName(pre, TypeOf(compare_value), ast::StorageClass::kNone, - ast::Access::kUndefined, compare)) { + if (!EmitTypeAndName(pre, TypeOf(compare_value)->UnwrapRef(), + ast::StorageClass::kNone, ast::Access::kUndefined, compare)) { return false; } pre << " = "; @@ -1732,7 +1758,7 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out, pre << ";"; } - { // InterlockedCompareExchange(dst, compare, value, result.x); + { // InterlockedCompareExchange(dst, compare, value, result.old_value); auto pre = line(); pre << "InterlockedCompareExchange"; { @@ -1744,14 +1770,13 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out, if (!EmitExpression(pre, value)) { return false; } - pre << ", " << result << ".x"; + pre << ", " << result << ".old_value"; } pre << ";"; } - { // result.y = result.x == compare; - line() << result << ".y = " << result << ".x == " << compare << ";"; - } + // result.exchanged = result.old_value == compare; + line() << result << ".exchanged = " << result << ".old_value == " << compare << ";"; out << result; return true; @@ -1830,16 +1855,15 @@ bool GeneratorImpl::EmitModfCall(std::ostream& out, return false; } - line(b) << "float" << width << " whole;"; - line(b) << "float" << width << " fract = modf(" << in << ", whole);"; { auto l = line(b); if (!EmitType(l, builtin->ReturnType(), ast::StorageClass::kNone, ast::Access::kUndefined, "")) { return false; } - l << " result = {fract, whole};"; + l << " result;"; } + line(b) << "result.fract = modf(" << params[0] << ", result.whole);"; line(b) << "return result;"; return true; }); @@ -1864,8 +1888,15 @@ bool GeneratorImpl::EmitFrexpCall(std::ostream& out, return false; } - line(b) << "float" << width << " exp;"; - line(b) << "float" << width << " sig = frexp(" << in << ", exp);"; + std::string member_type; + if (Is(sem::Type::DeepestElementOf(ty))) { + member_type = width.empty() ? "float16_t" : ("vector"); + } else { + member_type = "float" + width; + } + + line(b) << member_type << " exp;"; + line(b) << member_type << " sig = frexp(" << in << ", exp);"; { auto l = line(b); if (!EmitType(l, builtin->ReturnType(), ast::StorageClass::kNone, @@ -2031,6 +2062,34 @@ bool GeneratorImpl::EmitDataUnpackingCall(std::ostream& out, }); } +bool GeneratorImpl::EmitDP4aCall(std::ostream& out, + const ast::CallExpression* expr, + const sem::Builtin* builtin) { + // TODO(crbug.com/tint/1497): support the polyfill version of DP4a functions. + return CallBuiltinHelper( + out, expr, builtin, [&](TextBuffer* b, const std::vector& params) { + std::string functionName; + switch (builtin->Type()) { + case sem::BuiltinType::kDot4I8Packed: + line(b) << "int accumulator = 0;"; + functionName = "dot4add_i8packed"; + break; + case sem::BuiltinType::kDot4U8Packed: + line(b) << "uint accumulator = 0u;"; + functionName = "dot4add_u8packed"; + break; + default: + diagnostics_.add_error(diag::System::Writer, + "Internal error: unhandled DP4a builtin"); + return false; + } + line(b) << "return " << functionName << "(" << params[0] << ", " << params[1] + << ", accumulator);"; + + return true; + }); +} + bool GeneratorImpl::EmitBarrierCall(std::ostream& out, const sem::Builtin* builtin) { // TODO(crbug.com/tint/661): Combine sequential barriers to a single // instruction. @@ -2058,7 +2117,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, // Returns the argument with the given usage auto arg = [&](Usage usage) { int idx = signature.IndexOf(usage); - return (idx >= 0) ? arguments[idx] : nullptr; + return (idx >= 0) ? arguments[static_cast(idx)] : nullptr; }; auto* texture = arg(Usage::kTexture); @@ -2245,8 +2304,9 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, break; } - if (!EmitExpression(out, texture)) + if (!EmitExpression(out, texture)) { return false; + } // If pack_level_in_coords is true, then the mip level will be appended as the // last value of the coordinates argument. If the WGSL builtin overload does @@ -2287,7 +2347,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, case sem::BuiltinType::kTextureGather: out << ".Gather"; if (builtin->Parameters()[0]->Usage() == sem::ParameterUsage::kComponent) { - switch (call->Arguments()[0]->ConstantValue().Elements()[0].i32) { + switch (call->Arguments()[0]->ConstantValue()->As()) { case 0: out << "Red"; break; @@ -2318,8 +2378,9 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, } if (auto* sampler = arg(Usage::kSampler)) { - if (!EmitExpression(out, sampler)) + if (!EmitExpression(out, sampler)) { return false; + } out << ", "; } @@ -2333,8 +2394,10 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, auto* i32 = builder_.create(); auto* zero = builder_.Expr(0_i); auto* stmt = builder_.Sem().Get(vector)->Stmt(); - builder_.Sem().Add(zero, builder_.create(zero, i32, stmt, sem::Constant{}, - /* has_side_effects */ false)); + builder_.Sem().Add( + zero, builder_.create(zero, i32, sem::EvaluationStage::kRuntime, stmt, + /* constant_value */ nullptr, + /* has_side_effects */ false)); auto* packed = AppendVector(&builder_, vector, zero); return EmitExpression(out, packed->Declaration()); }; @@ -2459,7 +2522,7 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) { case sem::BuiltinType::kTranspose: case sem::BuiltinType::kTrunc: return builtin->str(); - case sem::BuiltinType::kCountOneBits: + case sem::BuiltinType::kCountOneBits: // uint return "countbits"; case sem::BuiltinType::kDpdx: return "ddx"; @@ -2487,10 +2550,9 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) { return "rsqrt"; case sem::BuiltinType::kMix: return "lerp"; - case sem::BuiltinType::kReverseBits: + case sem::BuiltinType::kReverseBits: // uint return "reversebits"; case sem::BuiltinType::kSmoothstep: - case sem::BuiltinType::kSmoothStep: return "smoothstep"; default: diagnostics_.add_error(diag::System::Writer, @@ -2512,7 +2574,7 @@ bool GeneratorImpl::EmitCase(const ast::SwitchStatement* s, size_t case_idx) { return false; } out << ":"; - if (selector == stmt->selectors.back()) { + if (selector == stmt->selectors.Back()) { out << " {"; } } @@ -2548,7 +2610,7 @@ bool GeneratorImpl::EmitCase(const ast::SwitchStatement* s, size_t case_idx) { } bool GeneratorImpl::EmitContinue(const ast::ContinueStatement*) { - if (!emit_continuing_()) { + if (!emit_continuing_ || !emit_continuing_()) { return false; } line() << "continue;"; @@ -2563,33 +2625,22 @@ bool GeneratorImpl::EmitDiscard(const ast::DiscardStatement*) { } bool GeneratorImpl::EmitExpression(std::ostream& out, const ast::Expression* expr) { + if (auto* sem = builder_.Sem().Get(expr)) { + if (auto* constant = sem->ConstantValue()) { + return EmitConstant(out, constant); + } + } return Switch( - expr, - [&](const ast::IndexAccessorExpression* a) { // - return EmitIndexAccessor(out, a); - }, - [&](const ast::BinaryExpression* b) { // - return EmitBinary(out, b); - }, - [&](const ast::BitcastExpression* b) { // - return EmitBitcast(out, b); - }, - [&](const ast::CallExpression* c) { // - return EmitCall(out, c); - }, - [&](const ast::IdentifierExpression* i) { // - return EmitIdentifier(out, i); - }, - [&](const ast::LiteralExpression* l) { // - return EmitLiteral(out, l); - }, - [&](const ast::MemberAccessorExpression* m) { // - return EmitMemberAccessor(out, m); - }, - [&](const ast::UnaryOpExpression* u) { // - return EmitUnaryOp(out, u); - }, - [&](Default) { // + expr, // + [&](const ast::IndexAccessorExpression* a) { return EmitIndexAccessor(out, a); }, + [&](const ast::BinaryExpression* b) { return EmitBinary(out, b); }, + [&](const ast::BitcastExpression* b) { return EmitBitcast(out, b); }, + [&](const ast::CallExpression* c) { return EmitCall(out, c); }, + [&](const ast::IdentifierExpression* i) { return EmitIdentifier(out, i); }, + [&](const ast::LiteralExpression* l) { return EmitLiteral(out, l); }, + [&](const ast::MemberAccessorExpression* m) { return EmitMemberAccessor(out, m); }, + [&](const ast::UnaryOpExpression* u) { return EmitUnaryOp(out, u); }, + [&](Default) { diagnostics_.add_error(diag::System::Writer, "unknown expression type: " + std::string(expr->TypeInfo().name)); return false; @@ -2622,7 +2673,7 @@ bool GeneratorImpl::EmitIf(const ast::IfStatement* stmt) { return false; } } else { - if (!EmitStatementsWithIndent({stmt->else_statement})) { + if (!EmitStatementsWithIndent(utils::Vector{stmt->else_statement})) { return false; } } @@ -2635,6 +2686,17 @@ bool GeneratorImpl::EmitIf(const ast::IfStatement* stmt) { bool GeneratorImpl::EmitFunction(const ast::Function* func) { auto* sem = builder_.Sem().Get(func); + // Emit storage atomic helpers + if (auto* intrinsic = + ast::GetAttribute(func->attributes)) { + if (intrinsic->storage_class == ast::StorageClass::kStorage && intrinsic->IsAtomic()) { + if (!EmitStorageAtomicIntrinsic(func, intrinsic)) { + return false; + } + } + return true; + } + if (ast::HasAttribute(func->attributes)) { // An internal function. Do not emit. return true; @@ -2673,14 +2735,25 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) { first = false; auto const* type = v->Type(); + auto storage_class = ast::StorageClass::kNone; + auto access = ast::Access::kUndefined; if (auto* ptr = type->As()) { - // Transform pointer parameters in to `inout` parameters. - // The WGSL spec is highly restrictive in what can be passed in pointer - // parameters, which allows for this transformation. See: - // https://gpuweb.github.io/gpuweb/wgsl/#function-restriction - out << "inout "; type = ptr->StoreType(); + switch (ptr->StorageClass()) { + case ast::StorageClass::kStorage: + case ast::StorageClass::kUniform: + // Not allowed by WGSL, but is used by certain transforms (e.g. DMA) to pass + // storage buffers and uniform buffers down into transform-generated + // functions. In this situation we want to generate the parameter without an + // 'inout', using the storage class and access from the pointer. + storage_class = ptr->StorageClass(); + access = ptr->Access(); + break; + default: + // Transform regular WGSL pointer parameters in to `inout` parameters. + out << "inout "; + } } // Note: WGSL only allows for StorageClass::kNone on parameters, however @@ -2689,7 +2762,7 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) { // StorageClass::kStorage or StorageClass::kUniform. This is required to // correctly translate the parameter to a [RW]ByteAddressBuffer for // storage buffers and a uint4[N] for uniform buffers. - if (!EmitTypeAndName(out, type, v->StorageClass(), v->Access(), + if (!EmitTypeAndName(out, type, storage_class, access, builder_.Symbols().NameFor(v->Declaration()->symbol))) { return false; } @@ -2748,41 +2821,55 @@ bool GeneratorImpl::EmitFunctionBodyWithDiscard(const ast::Function* func) { } bool GeneratorImpl::EmitGlobalVariable(const ast::Variable* global) { - if (global->is_const) { - return EmitProgramConstVariable(global); - } + return Switch( + global, // + [&](const ast::Var* var) { + auto* sem = builder_.Sem().Get(global); + switch (sem->StorageClass()) { + case ast::StorageClass::kUniform: + return EmitUniformVariable(var, sem); + case ast::StorageClass::kStorage: + return EmitStorageVariable(var, sem); + case ast::StorageClass::kHandle: + return EmitHandleVariable(var, sem); + case ast::StorageClass::kPrivate: + return EmitPrivateVariable(sem); + case ast::StorageClass::kWorkgroup: + return EmitWorkgroupVariable(sem); + case ast::StorageClass::kPushConstant: + diagnostics_.add_error( + diag::System::Writer, + "unhandled storage class " + utils::ToString(sem->StorageClass())); + return false; + default: { + TINT_ICE(Writer, diagnostics_) + << "unhandled storage class " << sem->StorageClass(); + return false; + } + } + }, + [&](const ast::Override* override) { return EmitOverride(override); }, + [&](const ast::Const*) { + return true; // Constants are embedded at their use + }, + [&](Default) { + TINT_ICE(Writer, diagnostics_) + << "unhandled global variable type " << global->TypeInfo().name; - auto* sem = builder_.Sem().Get(global); - switch (sem->StorageClass()) { - case ast::StorageClass::kUniform: - return EmitUniformVariable(sem); - case ast::StorageClass::kStorage: - return EmitStorageVariable(sem); - case ast::StorageClass::kHandle: - return EmitHandleVariable(sem); - case ast::StorageClass::kPrivate: - return EmitPrivateVariable(sem); - case ast::StorageClass::kWorkgroup: - return EmitWorkgroupVariable(sem); - default: - break; - } - - TINT_ICE(Writer, diagnostics_) << "unhandled storage class " << sem->StorageClass(); - return false; + return false; + }); } -bool GeneratorImpl::EmitUniformVariable(const sem::Variable* var) { - auto* decl = var->Declaration(); - auto binding_point = decl->BindingPoint(); - auto* type = var->Type()->UnwrapRef(); - auto name = builder_.Symbols().NameFor(decl->symbol); +bool GeneratorImpl::EmitUniformVariable(const ast::Var* var, const sem::Variable* sem) { + auto binding_point = sem->As()->BindingPoint(); + auto* type = sem->Type()->UnwrapRef(); + auto name = builder_.Symbols().NameFor(var->symbol); line() << "cbuffer cbuffer_" << name << RegisterAndSpace('b', binding_point) << " {"; { ScopedIndent si(this); auto out = line(); - if (!EmitTypeAndName(out, type, ast::StorageClass::kUniform, var->Access(), name)) { + if (!EmitTypeAndName(out, type, ast::StorageClass::kUniform, sem->Access(), name)) { return false; } out << ";"; @@ -2793,29 +2880,29 @@ bool GeneratorImpl::EmitUniformVariable(const sem::Variable* var) { return true; } -bool GeneratorImpl::EmitStorageVariable(const sem::Variable* var) { - auto* decl = var->Declaration(); - auto* type = var->Type()->UnwrapRef(); +bool GeneratorImpl::EmitStorageVariable(const ast::Var* var, const sem::Variable* sem) { + auto* type = sem->Type()->UnwrapRef(); auto out = line(); - if (!EmitTypeAndName(out, type, ast::StorageClass::kStorage, var->Access(), - builder_.Symbols().NameFor(decl->symbol))) { + if (!EmitTypeAndName(out, type, ast::StorageClass::kStorage, sem->Access(), + builder_.Symbols().NameFor(var->symbol))) { return false; } - out << RegisterAndSpace(var->Access() == ast::Access::kRead ? 't' : 'u', decl->BindingPoint()) + auto* global_sem = sem->As(); + out << RegisterAndSpace(sem->Access() == ast::Access::kRead ? 't' : 'u', + global_sem->BindingPoint()) << ";"; return true; } -bool GeneratorImpl::EmitHandleVariable(const sem::Variable* var) { - auto* decl = var->Declaration(); - auto* unwrapped_type = var->Type()->UnwrapRef(); +bool GeneratorImpl::EmitHandleVariable(const ast::Var* var, const sem::Variable* sem) { + auto* unwrapped_type = sem->Type()->UnwrapRef(); auto out = line(); - auto name = builder_.Symbols().NameFor(decl->symbol); - auto* type = var->Type()->UnwrapRef(); - if (!EmitTypeAndName(out, type, var->StorageClass(), var->Access(), name)) { + auto name = builder_.Symbols().NameFor(var->symbol); + auto* type = sem->Type()->UnwrapRef(); + if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(), name)) { return false; } @@ -2831,9 +2918,8 @@ bool GeneratorImpl::EmitHandleVariable(const sem::Variable* var) { } if (register_space) { - auto bp = decl->BindingPoint(); - out << " : register(" << register_space << bp.binding->value << ", space" << bp.group->value - << ")"; + auto bp = sem->As()->BindingPoint(); + out << " : register(" << register_space << bp.binding << ", space" << bp.group << ")"; } out << ";"; @@ -2890,29 +2976,29 @@ bool GeneratorImpl::EmitWorkgroupVariable(const sem::Variable* var) { return true; } -std::string GeneratorImpl::builtin_to_attribute(ast::Builtin builtin) const { +std::string GeneratorImpl::builtin_to_attribute(ast::BuiltinValue builtin) const { switch (builtin) { - case ast::Builtin::kPosition: + case ast::BuiltinValue::kPosition: return "SV_Position"; - case ast::Builtin::kVertexIndex: + case ast::BuiltinValue::kVertexIndex: return "SV_VertexID"; - case ast::Builtin::kInstanceIndex: + case ast::BuiltinValue::kInstanceIndex: return "SV_InstanceID"; - case ast::Builtin::kFrontFacing: + case ast::BuiltinValue::kFrontFacing: return "SV_IsFrontFace"; - case ast::Builtin::kFragDepth: + case ast::BuiltinValue::kFragDepth: return "SV_Depth"; - case ast::Builtin::kLocalInvocationId: + case ast::BuiltinValue::kLocalInvocationId: return "SV_GroupThreadID"; - case ast::Builtin::kLocalInvocationIndex: + case ast::BuiltinValue::kLocalInvocationIndex: return "SV_GroupIndex"; - case ast::Builtin::kGlobalInvocationId: + case ast::BuiltinValue::kGlobalInvocationId: return "SV_DispatchThreadID"; - case ast::Builtin::kWorkgroupId: + case ast::BuiltinValue::kWorkgroupId: return "SV_GroupID"; - case ast::Builtin::kSampleIndex: + case ast::BuiltinValue::kSampleIndex: return "SV_SampleIndex"; - case ast::Builtin::kSampleMask: + case ast::BuiltinValue::kSampleMask: return "SV_Coverage"; default: break; @@ -2957,7 +3043,7 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { // Emit the workgroup_size attribute. auto wgsize = func_sem->WorkgroupSize(); out << "[numthreads("; - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { if (i > 0) { out << ", "; } @@ -2965,11 +3051,11 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { if (wgsize[i].overridable_const) { auto* global = builder_.Sem().Get(wgsize[i].overridable_const); - if (!global->IsOverridable()) { - TINT_ICE(Writer, builder_.Diagnostics()) + if (!global->Declaration()->Is()) { + TINT_ICE(Writer, diagnostics_) << "expected a pipeline-overridable constant"; } - out << kSpecConstantPrefix << global->ConstantId(); + out << kSpecConstantPrefix << global->OverrideId().value; } else { out << std::to_string(wgsize[i].value); } @@ -3015,7 +3101,7 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { } if (!Is(func->body->Last())) { - ast::ReturnStatement ret(ProgramID(), Source{}); + ast::ReturnStatement ret(ProgramID(), ast::NodeID{}, Source{}); if (!EmitStatement(&ret)) { return false; } @@ -3027,6 +3113,136 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { return true; } +bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constant) { + return Switch( + constant->Type(), // + [&](const sem::Bool*) { + out << (constant->As() ? "true" : "false"); + return true; + }, + [&](const sem::F32*) { + PrintF32(out, constant->As()); + return true; + }, + [&](const sem::F16*) { + // emit a f16 scalar with explicit float16_t type declaration. + out << "float16_t("; + bool valid = PrintF16(out, constant->As()); + out << ")"; + return valid; + }, + [&](const sem::I32*) { + out << constant->As(); + return true; + }, + [&](const sem::U32*) { + out << constant->As() << "u"; + return true; + }, + [&](const sem::Vector* v) { + if (constant->AllEqual()) { + { + ScopedParen sp(out); + if (!EmitConstant(out, constant->Index(0))) { + return false; + } + } + out << "."; + for (size_t i = 0; i < v->Width(); i++) { + out << "x"; + } + return true; + } + + if (!EmitType(out, v, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { + return false; + } + + ScopedParen sp(out); + + for (size_t i = 0; i < v->Width(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + return true; + }, + [&](const sem::Matrix* m) { + if (!EmitType(out, m, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { + return false; + } + + ScopedParen sp(out); + + for (size_t i = 0; i < m->columns(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + return true; + }, + [&](const sem::Array* a) { + if (constant->AllZero()) { + out << "("; + if (!EmitType(out, a, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { + return false; + } + out << ")0"; + return true; + } + + out << "{"; + TINT_DEFER(out << "}"); + + for (size_t i = 0; i < a->Count(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + + return true; + }, + [&](const sem::Struct* s) { + if (constant->AllZero()) { + out << "("; + if (!EmitType(out, s, ast::StorageClass::kNone, ast::Access::kUndefined, "")) { + return false; + } + out << ")0"; + return true; + } + + out << "{"; + TINT_DEFER(out << "}"); + + for (size_t i = 0; i < s->Members().size(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + + return true; + }, + [&](Default) { + diagnostics_.add_error( + diag::System::Writer, + "unhandled constant type: " + builder_.FriendlyName(constant->Type())); + return false; + }); +} + bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* lit) { return Switch( lit, @@ -3034,14 +3250,15 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* out << (l->value ? "true" : "false"); return true; }, - [&](const ast::FloatLiteralExpression* fl) { - if (std::isinf(fl->value)) { - out << (fl->value >= 0 ? "asfloat(0x7f800000u)" : "asfloat(0xff800000u)"); - } else if (std::isnan(fl->value)) { - out << "asfloat(0x7fc00000u)"; - } else { - out << FloatToString(fl->value) << "f"; + [&](const ast::FloatLiteralExpression* l) { + if (l->suffix == ast::FloatLiteralExpression::Suffix::kH) { + // Emit f16 literal with explicit float16_t type declaration. + out << "float16_t("; + bool valid = PrintF16(out, static_cast(l->value)); + out << ")"; + return valid; } + PrintF32(out, static_cast(l->value)); return true; }, [&](const ast::IntLiteralExpression* i) { @@ -3074,6 +3291,10 @@ bool GeneratorImpl::EmitValue(std::ostream& out, const sem::Type* type, int valu out << value << ".0f"; return true; }, + [&](const sem::F16*) { + out << "float16_t(" << value << ".0h)"; + return true; + }, [&](const sem::I32*) { out << value; return true; @@ -3269,6 +3490,56 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) { return true; } +bool GeneratorImpl::EmitWhile(const ast::WhileStatement* stmt) { + TextBuffer cond_pre; + std::stringstream cond_buf; + { + auto* cond = stmt->condition; + TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre); + if (!EmitExpression(cond_buf, cond)) { + return false; + } + } + + auto emit_continuing = [&]() { return true; }; + TINT_SCOPED_ASSIGNMENT(emit_continuing_, emit_continuing); + + // If the while has a multi-statement conditional, then we cannot emit this + // as a regular while in HLSL. Instead we need to generate a `while(true)` loop. + bool emit_as_loop = cond_pre.lines.size() > 0; + if (emit_as_loop) { + line() << LoopAttribute() << "while (true) {"; + increment_indent(); + TINT_DEFER({ + decrement_indent(); + line() << "}"; + }); + + current_buffer_->Append(cond_pre); + line() << "if (!(" << cond_buf.str() << ")) { break; }"; + if (!EmitStatements(stmt->body->statements)) { + return false; + } + } else { + // While can be generated. + { + auto out = line(); + out << LoopAttribute() << "while"; + { + ScopedParen sp(out); + out << cond_buf.str(); + } + out << " {"; + } + if (!EmitStatementsWithIndent(stmt->body->statements)) { + return false; + } + line() << "}"; + } + + return true; +} + bool GeneratorImpl::EmitMemberAccessor(std::ostream& out, const ast::MemberAccessorExpression* expr) { if (!EmitExpression(out, expr->structure)) { @@ -3339,6 +3610,9 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { [&](const ast::ForLoopStatement* l) { // return EmitForLoop(l); }, + [&](const ast::WhileStatement* l) { // + return EmitWhile(l); + }, [&](const ast::ReturnStatement* r) { // return EmitReturn(r); }, @@ -3346,7 +3620,21 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { return EmitSwitch(s); }, [&](const ast::VariableDeclStatement* v) { // - return EmitVariable(v->variable); + return Switch( + v->variable, // + [&](const ast::Var* var) { return EmitVar(var); }, + [&](const ast::Let* let) { return EmitLet(let); }, + [&](const ast::Const*) { + return true; // Constants are embedded at their use + }, + [&](Default) { // + TINT_ICE(Writer, diagnostics_) + << "unknown variable type: " << v->variable->TypeInfo().name; + return false; + }); + }, + [&](const ast::StaticAssert*) { + return true; // Not emitted }, [&](Default) { // diagnostics_.add_error(diag::System::Writer, @@ -3356,7 +3644,7 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { } bool GeneratorImpl::EmitDefaultOnlySwitch(const ast::SwitchStatement* stmt) { - TINT_ASSERT(Writer, stmt->body.size() == 1 && stmt->body[0]->IsDefault()); + TINT_ASSERT(Writer, stmt->body.Length() == 1 && stmt->body[0]->IsDefault()); // FXC fails to compile a switch with just a default case, ignoring the // default case body. We work around this here by emitting the default case @@ -3389,7 +3677,7 @@ bool GeneratorImpl::EmitDefaultOnlySwitch(const ast::SwitchStatement* stmt) { bool GeneratorImpl::EmitSwitch(const ast::SwitchStatement* stmt) { // BUG(crbug.com/tint/1188): work around default-only switches - if (stmt->body.size() == 1 && stmt->body[0]->IsDefault()) { + if (stmt->body.Length() == 1 && stmt->body[0]->IsDefault()) { return EmitDefaultOnlySwitch(stmt); } @@ -3404,7 +3692,7 @@ bool GeneratorImpl::EmitSwitch(const ast::SwitchStatement* stmt) { { ScopedIndent si(this); - for (size_t i = 0; i < stmt->body.size(); i++) { + for (size_t i = 0; i < stmt->body.Length(); i++) { if (!EmitCase(stmt, i)) { return false; } @@ -3452,9 +3740,8 @@ bool GeneratorImpl::EmitType(std::ostream& out, while (auto* arr = base_type->As()) { if (arr->IsRuntimeSized()) { TINT_ICE(Writer, diagnostics_) - << "Runtime arrays may only exist in storage buffers, which " - "should " - "have been transformed into a ByteAddressBuffer"; + << "Runtime arrays may only exist in storage buffers, which should have " + "been transformed into a ByteAddressBuffer"; return false; } sizes.push_back(arr->Count()); @@ -3482,11 +3769,24 @@ bool GeneratorImpl::EmitType(std::ostream& out, out << "float"; return true; }, + [&](const sem::F16*) { + out << "float16_t"; + return true; + }, [&](const sem::I32*) { out << "int"; return true; }, [&](const sem::Matrix* mat) { + if (mat->type()->Is()) { + // Use matrix for f16 matrix + out << "matrix<"; + if (!EmitType(out, mat->type(), storage_class, access, "")) { + return false; + } + out << ", " << mat->columns() << ", " << mat->rows() << ">"; + return true; + } if (!EmitType(out, mat->type(), storage_class, access, "")) { return false; } @@ -3602,6 +3902,7 @@ bool GeneratorImpl::EmitType(std::ostream& out, } else if (vec->type()->Is() && width >= 1 && width <= 4) { out << "bool" << width; } else { + // For example, use "vector" for f16 vector. out << "vector<"; if (!EmitType(out, vec->type(), storage_class, access, "")) { return false; @@ -3644,13 +3945,9 @@ bool GeneratorImpl::EmitStructType(TextBuffer* b, const sem::Struct* str) { ScopedIndent si(b); for (auto* mem : str->Members()) { auto mem_name = builder_.Symbols().NameFor(mem->Name()); - auto* ty = mem->Type(); - auto out = line(b); - std::string pre, post; - if (auto* decl = mem->Declaration()) { for (auto* attr : decl->attributes) { if (auto* location = attr->As()) { @@ -3715,10 +4012,17 @@ bool GeneratorImpl::EmitStructType(TextBuffer* b, const sem::Struct* str) { } line(b) << "};"; - return true; } +bool GeneratorImpl::EmitStructTypeOnce(TextBuffer* buffer, const sem::Struct* str) { + auto it = emitted_structs_.emplace(str); + if (!it.second) { + return true; + } + return EmitStructType(buffer, str); +} + bool GeneratorImpl::EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression* expr) { switch (expr->op) { case ast::UnaryOp::kIndirection: @@ -3745,20 +4049,11 @@ bool GeneratorImpl::EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression* return true; } -bool GeneratorImpl::EmitVariable(const ast::Variable* var) { +bool GeneratorImpl::EmitVar(const ast::Var* var) { auto* sem = builder_.Sem().Get(var); auto* type = sem->Type()->UnwrapRef(); - // TODO(dsinclair): Handle variable attributes - if (!var->attributes.empty()) { - diagnostics_.add_error(diag::System::Writer, "Variable attributes are not handled yet"); - return false; - } - auto out = line(); - if (var->is_const) { - out << "const "; - } if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(), builder_.Symbols().NameFor(var->symbol))) { return false; @@ -3780,60 +4075,52 @@ bool GeneratorImpl::EmitVariable(const ast::Variable* var) { return true; } -bool GeneratorImpl::EmitProgramConstVariable(const ast::Variable* var) { - for (auto* d : var->attributes) { - if (!d->Is()) { - diagnostics_.add_error(diag::System::Writer, "Decorated const values not valid"); - return false; - } - } - if (!var->is_const) { - diagnostics_.add_error(diag::System::Writer, "Expected a const value"); +bool GeneratorImpl::EmitLet(const ast::Let* let) { + auto* sem = builder_.Sem().Get(let); + auto* type = sem->Type()->UnwrapRef(); + + auto out = line(); + out << "const "; + if (!EmitTypeAndName(out, type, ast::StorageClass::kNone, ast::Access::kUndefined, + builder_.Symbols().NameFor(let->symbol))) { return false; } + out << " = "; + if (!EmitExpression(out, let->constructor)) { + return false; + } + out << ";"; - auto* sem = builder_.Sem().Get(var); + return true; +} + +bool GeneratorImpl::EmitOverride(const ast::Override* override) { + auto* sem = builder_.Sem().Get(override); auto* type = sem->Type(); - auto* global = sem->As(); - if (global && global->IsOverridable()) { - auto const_id = global->ConstantId(); + auto override_id = sem->OverrideId(); - line() << "#ifndef " << kSpecConstantPrefix << const_id; + line() << "#ifndef " << kSpecConstantPrefix << override_id.value; - if (var->constructor != nullptr) { - auto out = line(); - out << "#define " << kSpecConstantPrefix << const_id << " "; - if (!EmitExpression(out, var->constructor)) { - return false; - } - } else { - line() << "#error spec constant required for constant id " << const_id; - } - line() << "#endif"; - { - auto out = line(); - out << "static const "; - if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(), - builder_.Symbols().NameFor(var->symbol))) { - return false; - } - out << " = " << kSpecConstantPrefix << const_id << ";"; + if (override->constructor != nullptr) { + auto out = line(); + out << "#define " << kSpecConstantPrefix << override_id.value << " "; + if (!EmitExpression(out, override->constructor)) { + return false; } } else { + line() << "#error spec constant required for constant id " << override_id.value; + } + line() << "#endif"; + { auto out = line(); out << "static const "; if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(), - builder_.Symbols().NameFor(var->symbol))) { + builder_.Symbols().NameFor(override->symbol))) { return false; } - out << " = "; - if (!EmitExpression(out, var->constructor)) { - return false; - } - out << ";"; + out << " = " << kSpecConstantPrefix << override_id.value << ";"; } - return true; } diff --git a/src/tint/writer/hlsl/generator_impl.h b/src/tint/writer/hlsl/generator_impl.h index e3296383f0..78680c8f9f 100644 --- a/src/tint/writer/hlsl/generator_impl.h +++ b/src/tint/writer/hlsl/generator_impl.h @@ -43,6 +43,7 @@ // Forward declarations namespace tint::sem { class Call; +class Constant; class Builtin; class TypeConstructor; class TypeConversion; @@ -92,7 +93,8 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement to emit /// @returns true if the statement was emitted successfully bool EmitAssign(const ast::AssignmentStatement* stmt); - /// Emits code such that if `expr` is zero, it emits one, else `expr` + /// Emits code such that if `expr` is zero, it emits one, else `expr`. + /// Used to avoid divide-by-zeros by substituting constant zeros with ones. /// @param out the output of the expression stream /// @param expr the expression /// @returns true if the expression was emitted, false otherwise @@ -110,11 +112,11 @@ class GeneratorImpl : public TextGenerator { /// Emits a list of statements /// @param stmts the statement list /// @returns true if the statements were emitted successfully - bool EmitStatements(const ast::StatementList& stmts); + bool EmitStatements(utils::VectorRef stmts); /// Emits a list of statements with an indentation /// @param stmts the statement list /// @returns true if the statements were emitted successfully - bool EmitStatementsWithIndent(const ast::StatementList& stmts); + bool EmitStatementsWithIndent(utils::VectorRef stmts); /// Handles a block statement /// @param stmt the statement to emit /// @returns true if the statement was emitted successfully @@ -187,6 +189,12 @@ class GeneratorImpl : public TextGenerator { bool EmitStorageAtomicCall(std::ostream& out, const ast::CallExpression* expr, const transform::DecomposeMemoryAccess::Intrinsic* intrinsic); + /// Handles generating the helper function for the atomic intrinsic function + /// @param func the function + /// @param intrinsic the atomic intrinsic + /// @returns true if the function is emitted + bool EmitStorageAtomicIntrinsic(const ast::Function* func, + const transform::DecomposeMemoryAccess::Intrinsic* intrinsic); /// Handles generating an atomic intrinsic call for a workgroup variable /// @param out the output of the expression stream /// @param expr the call expression @@ -242,7 +250,7 @@ class GeneratorImpl : public TextGenerator { /// Handles generating a call to data packing builtin /// @param out the output of the expression stream /// @param expr the call expression - /// @param builtin the semantic information for the texture builtin + /// @param builtin the semantic information for the builtin /// @returns true if the call expression is emitted bool EmitDataPackingCall(std::ostream& out, const ast::CallExpression* expr, @@ -250,11 +258,19 @@ class GeneratorImpl : public TextGenerator { /// Handles generating a call to data unpacking builtin /// @param out the output of the expression stream /// @param expr the call expression - /// @param builtin the semantic information for the texture builtin + /// @param builtin the semantic information for the builtin /// @returns true if the call expression is emitted bool EmitDataUnpackingCall(std::ostream& out, const ast::CallExpression* expr, const sem::Builtin* builtin); + /// Handles generating a call to DP4a builtins (dot4I8Packed and dot4U8Packed) + /// @param out the output of the expression stream + /// @param expr the call expression + /// @param builtin the semantic information for the builtin + /// @returns true if the call expression is emitted + bool EmitDP4aCall(std::ostream& out, + const ast::CallExpression* expr, + const sem::Builtin* builtin); /// Handles a case statement /// @param s the switch statement /// @param case_idx the index of the switch case in the switch statement @@ -288,19 +304,22 @@ class GeneratorImpl : public TextGenerator { bool EmitGlobalVariable(const ast::Variable* global); /// Handles emitting a global variable with the uniform storage class - /// @param var the global variable + /// @param var the AST node for the 'var' + /// @param sem the semantic node for the 'var' /// @returns true on success - bool EmitUniformVariable(const sem::Variable* var); + bool EmitUniformVariable(const ast::Var* var, const sem::Variable* sem); /// Handles emitting a global variable with the storage storage class - /// @param var the global variable + /// @param var the AST node for the 'var' + /// @param sem the semantic node for the 'var' /// @returns true on success - bool EmitStorageVariable(const sem::Variable* var); + bool EmitStorageVariable(const ast::Var* var, const sem::Variable* sem); /// Handles emitting a global variable with the handle storage class - /// @param var the global variable + /// @param var the AST node for the 'var' + /// @param sem the semantic node for the 'var' /// @returns true on success - bool EmitHandleVariable(const sem::Variable* var); + bool EmitHandleVariable(const ast::Var* var, const sem::Variable* sem); /// Handles emitting a global variable with the private storage class /// @param var the global variable @@ -320,6 +339,11 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement to emit /// @returns true if the statement was successfully emitted bool EmitIf(const ast::IfStatement* stmt); + /// Handles a constant value + /// @param out the output stream + /// @param constant the constant value to emit + /// @returns true if the constant value was successfully emitted + bool EmitConstant(std::ostream& out, const sem::Constant* constant); /// Handles a literal /// @param out the output stream /// @param lit the literal to emit @@ -333,6 +357,10 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement to emit /// @returns true if the statement was emitted bool EmitForLoop(const ast::ForLoopStatement* stmt); + /// Handles a while statement + /// @param stmt the statement to emit + /// @returns true if the statement was emitted + bool EmitWhile(const ast::WhileStatement* stmt); /// Handles generating an identifier expression /// @param out the output of the expression stream /// @param expr the identifier expression @@ -391,6 +419,12 @@ class GeneratorImpl : public TextGenerator { /// @param ty the struct to generate /// @returns true if the struct is emitted bool EmitStructType(TextBuffer* buffer, const sem::Struct* ty); + /// Handles generating a structure declaration only the first time called. Subsequent calls are + /// a no-op and return true. + /// @param buffer the text buffer that the type declaration will be written to + /// @param ty the struct to generate + /// @returns true if the struct is emitted + bool EmitStructTypeOnce(TextBuffer* buffer, const sem::Struct* ty); /// Handles a unary op expression /// @param out the output of the expression stream /// @param expr the expression to emit @@ -407,14 +441,18 @@ class GeneratorImpl : public TextGenerator { /// @param type the type to emit the value for /// @returns true if the zero value was successfully emitted. bool EmitZeroValue(std::ostream& out, const sem::Type* type); - /// Handles generating a variable + /// Handles generating a 'var' declaration /// @param var the variable to generate /// @returns true if the variable was emitted - bool EmitVariable(const ast::Variable* var); - /// Handles generating a program scope constant variable - /// @param var the variable to emit + bool EmitVar(const ast::Var* var); + /// Handles generating a function-scope 'let' declaration + /// @param let the variable to generate /// @returns true if the variable was emitted - bool EmitProgramConstVariable(const ast::Variable* var); + bool EmitLet(const ast::Let* let); + /// Handles generating a module-scope 'override' declaration + /// @param override the 'override' to emit + /// @returns true if the variable was emitted + bool EmitOverride(const ast::Override* override); /// Emits call to a helper vector assignment function for the input assignment /// statement and vector type. This is used to work around FXC issues where /// assignments to vectors with dynamic indices cause compilation failures. @@ -451,7 +489,7 @@ class GeneratorImpl : public TextGenerator { /// Converts a builtin to an attribute name /// @param builtin the builtin to convert /// @returns the string name of the builtin or blank on error - std::string builtin_to_attribute(ast::Builtin builtin) const; + std::string builtin_to_attribute(ast::BuiltinValue builtin) const; /// Converts interpolation attributes to a HLSL modifiers /// @param type the interpolation type @@ -503,13 +541,13 @@ class GeneratorImpl : public TextGenerator { TextBuffer helpers_; // Helper functions emitted at the top of the output std::function emit_continuing_; - std::unordered_map dma_intrinsics_; + std::unordered_map matrix_scalar_ctors_; std::unordered_map builtins_; - std::unordered_map structure_builders_; std::unordered_map dynamic_vector_write_; std::unordered_map dynamic_matrix_vector_write_; std::unordered_map dynamic_matrix_scalar_write_; std::unordered_map value_or_one_if_zero_; + std::unordered_set emitted_structs_; }; } // namespace tint::writer::hlsl diff --git a/src/tint/writer/hlsl/generator_impl_array_accessor_test.cc b/src/tint/writer/hlsl/generator_impl_array_accessor_test.cc index bbdeb10fd1..dfa3d67087 100644 --- a/src/tint/writer/hlsl/generator_impl_array_accessor_test.cc +++ b/src/tint/writer/hlsl/generator_impl_array_accessor_test.cc @@ -22,7 +22,7 @@ namespace { using HlslGeneratorImplTest_Expression = TestHelper; TEST_F(HlslGeneratorImplTest_Expression, IndexAccessor) { - Global("ary", ty.array(), ast::StorageClass::kPrivate); + GlobalVar("ary", ty.array(), ast::StorageClass::kPrivate); auto* expr = IndexAccessor("ary", 5_i); WrapInFunction(expr); diff --git a/src/tint/writer/hlsl/generator_impl_assign_test.cc b/src/tint/writer/hlsl/generator_impl_assign_test.cc index 5e5f031666..a01903efde 100644 --- a/src/tint/writer/hlsl/generator_impl_assign_test.cc +++ b/src/tint/writer/hlsl/generator_impl_assign_test.cc @@ -22,8 +22,8 @@ namespace { using HlslGeneratorImplTest_Assign = TestHelper; TEST_F(HlslGeneratorImplTest_Assign, Emit_Assign) { - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("lhs", ty.i32())), Decl(Var("rhs", ty.i32())), Assign("lhs", "rhs"), @@ -41,9 +41,9 @@ TEST_F(HlslGeneratorImplTest_Assign, Emit_Assign) { )"); } -TEST_F(HlslGeneratorImplTest_Assign, Emit_Vector_Assign_ConstantIndex) { - Func("fn", {}, ty.void_(), - { +TEST_F(HlslGeneratorImplTest_Assign, Emit_Vector_Assign_LetIndex) { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("lhs", ty.vec3())), Decl(Var("rhs", ty.f32())), Decl(Let("index", ty.u32(), Expr(0_u))), @@ -54,18 +54,43 @@ TEST_F(HlslGeneratorImplTest_Assign, Emit_Vector_Assign_ConstantIndex) { ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.result(), - R"(void fn() { + R"(void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void fn() { float3 lhs = float3(0.0f, 0.0f, 0.0f); float rhs = 0.0f; const uint index = 0u; - lhs[index] = rhs; + set_float3(lhs, index, rhs); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Assign, Emit_Vector_Assign_ConstIndex) { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("lhs", ty.vec3())), + Decl(Var("rhs", ty.f32())), + Decl(Const("index", ty.u32(), Expr(0_u))), + Assign(IndexAccessor("lhs", "index"), "rhs"), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()); + EXPECT_EQ(gen.result(), + R"(void fn() { + float3 lhs = float3(0.0f, 0.0f, 0.0f); + float rhs = 0.0f; + lhs[0u] = rhs; } )"); } TEST_F(HlslGeneratorImplTest_Assign, Emit_Vector_Assign_DynamicIndex) { - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("lhs", ty.vec3())), Decl(Var("rhs", ty.f32())), Decl(Var("index", ty.u32())), @@ -89,9 +114,9 @@ void fn() { )"); } -TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Vector_ConstantIndex) { - Func("fn", {}, ty.void_(), - { +TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Vector_LetIndex) { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("lhs", ty.mat4x2())), Decl(Var("rhs", ty.vec2())), Decl(Let("index", ty.u32(), Expr(0_u))), @@ -102,18 +127,48 @@ TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Vector_ConstantIndex) { ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.result(), - R"(void fn() { + R"(void set_vector_float4x2(inout float4x2 mat, int col, float2 val) { + switch (col) { + case 0: mat[0] = val; break; + case 1: mat[1] = val; break; + case 2: mat[2] = val; break; + case 3: mat[3] = val; break; + } +} + +void fn() { float4x2 lhs = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); float2 rhs = float2(0.0f, 0.0f); const uint index = 0u; - lhs[index] = rhs; + set_vector_float4x2(lhs, index, rhs); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Vector_ConstIndex) { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("lhs", ty.mat4x2())), + Decl(Var("rhs", ty.vec2())), + Decl(Const("index", ty.u32(), Expr(0_u))), + Assign(IndexAccessor("lhs", "index"), "rhs"), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()); + EXPECT_EQ(gen.result(), + R"(void fn() { + float4x2 lhs = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float2 rhs = float2(0.0f, 0.0f); + lhs[0u] = rhs; } )"); } TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Vector_DynamicIndex) { - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("lhs", ty.mat4x2())), Decl(Var("rhs", ty.vec2())), Decl(Var("index", ty.u32())), @@ -142,9 +197,9 @@ void fn() { )"); } -TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Scalar_ConstantIndex) { - Func("fn", {}, ty.void_(), - { +TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Scalar_LetIndex) { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("lhs", ty.mat4x2())), Decl(Var("rhs", ty.f32())), Decl(Let("index", ty.u32(), Expr(0_u))), @@ -155,18 +210,56 @@ TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Scalar_ConstantIndex) { ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.result(), - R"(void fn() { + R"(void set_scalar_float4x2(inout float4x2 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; + break; + case 1: + mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; + break; + case 2: + mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; + break; + case 3: + mat[3] = (row.xx == int2(0, 1)) ? val.xx : mat[3]; + break; + } +} + +void fn() { float4x2 lhs = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); float rhs = 0.0f; const uint index = 0u; - lhs[index][index] = rhs; + set_scalar_float4x2(lhs, index, index, rhs); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Scalar_ConstIndex) { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("lhs", ty.mat4x2())), + Decl(Var("rhs", ty.f32())), + Decl(Const("index", ty.u32(), Expr(0_u))), + Assign(IndexAccessor(IndexAccessor("lhs", "index"), "index"), "rhs"), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()); + EXPECT_EQ(gen.result(), + R"(void fn() { + float4x2 lhs = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float rhs = 0.0f; + lhs[0u][0u] = rhs; } )"); } TEST_F(HlslGeneratorImplTest_Assign, Emit_Matrix_Assign_Scalar_DynamicIndex) { - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("lhs", ty.mat4x2())), Decl(Var("rhs", ty.f32())), Decl(Var("index", ty.u32())), diff --git a/src/tint/writer/hlsl/generator_impl_binary_test.cc b/src/tint/writer/hlsl/generator_impl_binary_test.cc index 4d628855bb..aa541441e8 100644 --- a/src/tint/writer/hlsl/generator_impl_binary_test.cc +++ b/src/tint/writer/hlsl/generator_impl_binary_test.cc @@ -50,8 +50,40 @@ TEST_P(HlslBinaryTest, Emit_f32) { return; } - Global("left", ty.f32(), ast::StorageClass::kPrivate); - Global("right", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("left", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("right", ty.f32(), ast::StorageClass::kPrivate); + + auto* left = Expr("left"); + auto* right = Expr("right"); + + auto* expr = create(params.op, left, right); + + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), params.result); +} +TEST_P(HlslBinaryTest, Emit_f16) { + auto params = GetParam(); + + if ((params.valid_for & BinaryData::Types::Float) == 0) { + return; + } + + // Skip ops that are illegal for this type + if (params.op == ast::BinaryOp::kAnd || params.op == ast::BinaryOp::kOr || + params.op == ast::BinaryOp::kXor || params.op == ast::BinaryOp::kShiftLeft || + params.op == ast::BinaryOp::kShiftRight) { + return; + } + + Enable(ast::Extension::kF16); + + GlobalVar("left", ty.f16(), ast::StorageClass::kPrivate); + GlobalVar("right", ty.f16(), ast::StorageClass::kPrivate); auto* left = Expr("left"); auto* right = Expr("right"); @@ -73,8 +105,8 @@ TEST_P(HlslBinaryTest, Emit_u32) { return; } - Global("left", ty.u32(), ast::StorageClass::kPrivate); - Global("right", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("left", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("right", ty.u32(), ast::StorageClass::kPrivate); auto* left = Expr("left"); auto* right = Expr("right"); @@ -101,8 +133,8 @@ TEST_P(HlslBinaryTest, Emit_i32) { return; } - Global("left", ty.i32(), ast::StorageClass::kPrivate); - Global("right", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("left", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("right", ty.i32(), ast::StorageClass::kPrivate); auto* left = Expr("left"); auto* right = Expr("right"); @@ -140,9 +172,9 @@ INSTANTIATE_TEST_SUITE_P( BinaryData{"(left % right)", ast::BinaryOp::kModulo, BinaryData::Types::Float})); -TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorScalar) { - auto* lhs = vec3(1.f, 1.f, 1.f); - auto* rhs = Expr(1.f); +TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorScalar_f32) { + auto* lhs = vec3(1_f, 1_f, 1_f); + auto* rhs = Expr(1_f); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -152,14 +184,14 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorScalar) { std::stringstream out; EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), - "(float3(1.0f, 1.0f, 1.0f) * " - "1.0f)"); + EXPECT_EQ(out.str(), "((1.0f).xxx * 1.0f)"); } -TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarVector) { - auto* lhs = Expr(1.f); - auto* rhs = vec3(1.f, 1.f, 1.f); +TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorScalar_f16) { + Enable(ast::Extension::kF16); + + auto* lhs = vec3(1_h, 1_h, 1_h); + auto* rhs = Expr(1_h); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -169,15 +201,45 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarVector) { std::stringstream out; EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), - "(1.0f * float3(1.0f, 1.0f, " - "1.0f))"); + EXPECT_EQ(out.str(), "((float16_t(1.0h)).xxx * float16_t(1.0h))"); } -TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixScalar) { - Global("mat", ty.mat3x3(), ast::StorageClass::kPrivate); +TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarVector_f32) { + auto* lhs = Expr(1_f); + auto* rhs = vec3(1_f, 1_f, 1_f); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(1.0f * (1.0f).xxx)"); +} + +TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarVector_f16) { + Enable(ast::Extension::kF16); + + auto* lhs = Expr(1_h); + auto* rhs = vec3(1_h, 1_h, 1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(float16_t(1.0h) * (float16_t(1.0h)).xxx)"); +} + +TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f32) { + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); auto* lhs = Expr("mat"); - auto* rhs = Expr(1.f); + auto* rhs = Expr(1_f); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); WrapInFunction(expr); @@ -189,9 +251,26 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixScalar) { EXPECT_EQ(out.str(), "(mat * 1.0f)"); } -TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarMatrix) { - Global("mat", ty.mat3x3(), ast::StorageClass::kPrivate); - auto* lhs = Expr(1.f); +TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr("mat"); + auto* rhs = Expr(1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "(mat * float16_t(1.0h))"); +} + +TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f32) { + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr(1_f); auto* rhs = Expr("mat"); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -204,24 +283,11 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarMatrix) { EXPECT_EQ(out.str(), "(1.0f * mat)"); } -TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixVector) { - Global("mat", ty.mat3x3(), ast::StorageClass::kPrivate); - auto* lhs = Expr("mat"); - auto* rhs = vec3(1.f, 1.f, 1.f); +TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f16) { + Enable(ast::Extension::kF16); - auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); - WrapInFunction(expr); - - GeneratorImpl& gen = Build(); - - std::stringstream out; - EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), "mul(float3(1.0f, 1.0f, 1.0f), mat)"); -} - -TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorMatrix) { - Global("mat", ty.mat3x3(), ast::StorageClass::kPrivate); - auto* lhs = vec3(1.f, 1.f, 1.f); + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr(1_h); auto* rhs = Expr("mat"); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -231,12 +297,92 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorMatrix) { std::stringstream out; EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); - EXPECT_EQ(out.str(), "mul(mat, float3(1.0f, 1.0f, 1.0f))"); + EXPECT_EQ(out.str(), "(float16_t(1.0h) * mat)"); } -TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixMatrix) { - Global("lhs", ty.mat3x3(), ast::StorageClass::kPrivate); - Global("rhs", ty.mat3x3(), ast::StorageClass::kPrivate); +TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixVector_f32) { + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr("mat"); + auto* rhs = vec3(1_f, 1_f, 1_f); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "mul((1.0f).xxx, mat)"); +} + +TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixVector_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = Expr("mat"); + auto* rhs = vec3(1_h, 1_h, 1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "mul((float16_t(1.0h)).xxx, mat)"); +} + +TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f32) { + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = vec3(1_f, 1_f, 1_f); + auto* rhs = Expr("mat"); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "mul(mat, (1.0f).xxx)"); +} + +TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("mat", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* lhs = vec3(1_h, 1_h, 1_h); + auto* rhs = Expr("mat"); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "mul(mat, (float16_t(1.0h)).xxx)"); +} + +TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f32) { + GlobalVar("lhs", ty.mat3x3(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.mat3x3(), ast::StorageClass::kPrivate); + + auto* expr = create(ast::BinaryOp::kMultiply, Expr("lhs"), Expr("rhs")); + WrapInFunction(expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "mul(rhs, lhs)"); +} + +TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f16) { + Enable(ast::Extension::kF16); + + GlobalVar("lhs", ty.mat3x3(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.mat3x3(), ast::StorageClass::kPrivate); auto* expr = create(ast::BinaryOp::kMultiply, Expr("lhs"), Expr("rhs")); WrapInFunction(expr); @@ -249,8 +395,8 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixMatrix) { } TEST_F(HlslGeneratorImplTest_Binary, Logical_And) { - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")); WrapInFunction(expr); @@ -269,10 +415,10 @@ if (tint_tmp) { TEST_F(HlslGeneratorImplTest_Binary, Logical_Multi) { // (a && b) || (c || d) - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); - Global("d", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("d", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = create( ast::BinaryOp::kLogicalOr, @@ -301,8 +447,8 @@ if (!tint_tmp) { } TEST_F(HlslGeneratorImplTest_Binary, Logical_Or) { - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = create(ast::BinaryOp::kLogicalOr, Expr("a"), Expr("b")); WrapInFunction(expr); @@ -328,16 +474,16 @@ TEST_F(HlslGeneratorImplTest_Binary, If_WithLogical) { // return 3i; // } - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = If(create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")), Block(Return(1_i)), Else(If(create(ast::BinaryOp::kLogicalOr, Expr("b"), Expr("c")), Block(Return(2_i)), Else(Block(Return(3_i)))))); - Func("func", {}, ty.i32(), {WrapInStatement(expr)}); + Func("func", utils::Empty, ty.i32(), utils::Vector{WrapInStatement(expr)}); GeneratorImpl& gen = Build(); @@ -365,15 +511,15 @@ if ((tint_tmp)) { TEST_F(HlslGeneratorImplTest_Binary, Return_WithLogical) { // return (a && b) || c; - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = Return(create( ast::BinaryOp::kLogicalOr, create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")), Expr("c"))); - Func("func", {}, ty.bool_(), {WrapInStatement(expr)}); + Func("func", utils::Empty, ty.bool_(), utils::Vector{WrapInStatement(expr)}); GeneratorImpl& gen = Build(); @@ -393,10 +539,10 @@ return (tint_tmp); TEST_F(HlslGeneratorImplTest_Binary, Assign_WithLogical) { // a = (b || c) && d; - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); - Global("d", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("d", ty.bool_(), ast::StorageClass::kPrivate); auto* expr = Assign(Expr("a"), @@ -424,9 +570,9 @@ a = (tint_tmp); TEST_F(HlslGeneratorImplTest_Binary, Decl_WithLogical) { // var a : bool = (b && c) || d; - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); - Global("d", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("d", ty.bool_(), ast::StorageClass::kPrivate); auto* var = Var("a", ty.bool_(), ast::StorageClass::kNone, @@ -457,26 +603,25 @@ TEST_F(HlslGeneratorImplTest_Binary, Call_WithLogical) { // foo(a && b, c || d, (a || c) && (b || d)) Func("foo", - { + utils::Vector{ Param(Sym(), ty.bool_()), Param(Sym(), ty.bool_()), Param(Sym(), ty.bool_()), }, - ty.void_(), ast::StatementList{}, ast::AttributeList{}); - Global("a", ty.bool_(), ast::StorageClass::kPrivate); - Global("b", ty.bool_(), ast::StorageClass::kPrivate); - Global("c", ty.bool_(), ast::StorageClass::kPrivate); - Global("d", ty.bool_(), ast::StorageClass::kPrivate); + ty.void_(), utils::Empty, utils::Empty); + GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("d", ty.bool_(), ast::StorageClass::kPrivate); - ast::ExpressionList params; - params.push_back( - create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b"))); - params.push_back( - create(ast::BinaryOp::kLogicalOr, Expr("c"), Expr("d"))); - params.push_back(create( - ast::BinaryOp::kLogicalAnd, - create(ast::BinaryOp::kLogicalOr, Expr("a"), Expr("c")), - create(ast::BinaryOp::kLogicalOr, Expr("b"), Expr("d")))); + utils::Vector params{ + create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")), + create(ast::BinaryOp::kLogicalOr, Expr("c"), Expr("d")), + create( + ast::BinaryOp::kLogicalAnd, + create(ast::BinaryOp::kLogicalOr, Expr("a"), Expr("c")), + create(ast::BinaryOp::kLogicalOr, Expr("b"), Expr("d"))), + }; auto* expr = CallStmt(Call("foo", params)); WrapInFunction(expr); @@ -530,10 +675,10 @@ INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest, testing::Values(Params{Params::Type::Div}, Params{Params::Type::Mod})); TEST_P(HlslGeneratorDivModTest, DivOrModByLiteralZero_i32) { - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("a", ty.i32())), - Decl(Let("r", nullptr, Op("a", 0_i))), + Decl(Let("r", Op("a", 0_i))), }); GeneratorImpl& gen = Build(); @@ -548,10 +693,10 @@ TEST_P(HlslGeneratorDivModTest, DivOrModByLiteralZero_i32) { } TEST_P(HlslGeneratorDivModTest, DivOrModByLiteralZero_u32) { - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("a", ty.u32())), - Decl(Let("r", nullptr, Op("a", 0_u))), + Decl(Let("r", Op("a", 0_u))), }); GeneratorImpl& gen = Build(); @@ -563,49 +708,49 @@ TEST_P(HlslGeneratorDivModTest, DivOrModByLiteralZero_u32) { R"( 1u); } )"); -} // namespace HlslGeneratorDivMod +} TEST_P(HlslGeneratorDivModTest, DivOrModByLiteralZero_vec_by_vec_i32) { - Func("fn", {}, ty.void_(), - { - Decl(Var("a", nullptr, vec4(100_i, 100_i, 100_i, 100_i))), - Decl(Let("r", nullptr, Op("a", vec4(50_i, 0_i, 25_i, 0_i)))), + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("a", vec4(100_i, 100_i, 100_i, 100_i))), + Decl(Let("r", Op("a", vec4(50_i, 0_i, 25_i, 0_i)))), }); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.result(), R"(void fn() { - int4 a = int4(100, 100, 100, 100); + int4 a = (100).xxxx; const int4 r = (a )" + Token() + R"( int4(50, 1, 25, 1)); } )"); -} // namespace +} TEST_P(HlslGeneratorDivModTest, DivOrModByLiteralZero_vec_by_scalar_i32) { - Func("fn", {}, ty.void_(), - { - Decl(Var("a", nullptr, vec4(100_i, 100_i, 100_i, 100_i))), - Decl(Let("r", nullptr, Op("a", 0_i))), + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("a", vec4(100_i, 100_i, 100_i, 100_i))), + Decl(Let("r", Op("a", 0_i))), }); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()); EXPECT_EQ(gen.result(), R"(void fn() { - int4 a = int4(100, 100, 100, 100); + int4 a = (100).xxxx; const int4 r = (a )" + Token() + R"( 1); } )"); -} // namespace hlsl +} TEST_P(HlslGeneratorDivModTest, DivOrModByIdentifier_i32) { - Func("fn", {Param("b", ty.i32())}, ty.void_(), - { + Func("fn", utils::Vector{Param("b", ty.i32())}, ty.void_(), + utils::Vector{ Decl(Var("a", ty.i32())), - Decl(Let("r", nullptr, Op("a", "b"))), + Decl(Let("r", Op("a", "b"))), }); GeneratorImpl& gen = Build(); @@ -617,13 +762,13 @@ TEST_P(HlslGeneratorDivModTest, DivOrModByIdentifier_i32) { R"( (b == 0 ? 1 : b)); } )"); -} // namespace writer +} TEST_P(HlslGeneratorDivModTest, DivOrModByIdentifier_u32) { - Func("fn", {Param("b", ty.u32())}, ty.void_(), - { + Func("fn", utils::Vector{Param("b", ty.u32())}, ty.void_(), + utils::Vector{ Decl(Var("a", ty.u32())), - Decl(Let("r", nullptr, Op("a", "b"))), + Decl(Let("r", Op("a", "b"))), }); GeneratorImpl& gen = Build(); @@ -635,13 +780,13 @@ TEST_P(HlslGeneratorDivModTest, DivOrModByIdentifier_u32) { R"( (b == 0u ? 1u : b)); } )"); -} // namespace tint +} TEST_P(HlslGeneratorDivModTest, DivOrModByIdentifier_vec_by_vec_i32) { - Func("fn", {Param("b", ty.vec3())}, ty.void_(), - { + Func("fn", utils::Vector{Param("b", ty.vec3())}, ty.void_(), + utils::Vector{ Decl(Var("a", ty.vec3())), - Decl(Let("r", nullptr, Op("a", "b"))), + Decl(Let("r", Op("a", "b"))), }); GeneratorImpl& gen = Build(); @@ -656,10 +801,10 @@ TEST_P(HlslGeneratorDivModTest, DivOrModByIdentifier_vec_by_vec_i32) { } TEST_P(HlslGeneratorDivModTest, DivOrModByIdentifier_vec_by_scalar_i32) { - Func("fn", {Param("b", ty.i32())}, ty.void_(), - { + Func("fn", utils::Vector{Param("b", ty.i32())}, ty.void_(), + utils::Vector{ Decl(Var("a", ty.vec3())), - Decl(Let("r", nullptr, Op("a", "b"))), + Decl(Let("r", Op("a", "b"))), }); GeneratorImpl& gen = Build(); @@ -674,15 +819,15 @@ TEST_P(HlslGeneratorDivModTest, DivOrModByIdentifier_vec_by_scalar_i32) { } TEST_P(HlslGeneratorDivModTest, DivOrModByExpression_i32) { - Func("zero", {}, ty.i32(), - { + Func("zero", utils::Empty, ty.i32(), + utils::Vector{ Return(Expr(0_i)), }); - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("a", ty.i32())), - Decl(Let("r", nullptr, Op("a", Call("zero")))), + Decl(Let("r", Op("a", Call("zero")))), }); GeneratorImpl& gen = Build(); @@ -705,15 +850,15 @@ void fn() { } TEST_P(HlslGeneratorDivModTest, DivOrModByExpression_u32) { - Func("zero", {}, ty.u32(), - { + Func("zero", utils::Empty, ty.u32(), + utils::Vector{ Return(Expr(0_u)), }); - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("a", ty.u32())), - Decl(Let("r", nullptr, Op("a", Call("zero")))), + Decl(Let("r", Op("a", Call("zero")))), }); GeneratorImpl& gen = Build(); @@ -736,15 +881,15 @@ void fn() { } TEST_P(HlslGeneratorDivModTest, DivOrModByExpression_vec_by_vec_i32) { - Func("zero", {}, ty.vec3(), - { + Func("zero", utils::Empty, ty.vec3(), + utils::Vector{ Return(vec3(0_i, 0_i, 0_i)), }); - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("a", ty.vec3())), - Decl(Let("r", nullptr, Op("a", Call("zero")))), + Decl(Let("r", Op("a", Call("zero")))), }); GeneratorImpl& gen = Build(); @@ -755,7 +900,7 @@ TEST_P(HlslGeneratorDivModTest, DivOrModByExpression_vec_by_vec_i32) { } int3 zero() { - return int3(0, 0, 0); + return (0).xxx; } void fn() { @@ -767,15 +912,15 @@ void fn() { } TEST_P(HlslGeneratorDivModTest, DivOrModByExpression_vec_by_scalar_i32) { - Func("zero", {}, ty.i32(), - { + Func("zero", utils::Empty, ty.i32(), + utils::Vector{ Return(0_i), }); - Func("fn", {}, ty.void_(), - { + Func("fn", utils::Empty, ty.void_(), + utils::Vector{ Decl(Var("a", ty.vec3())), - Decl(Let("r", nullptr, Op("a", Call("zero")))), + Decl(Let("r", Op("a", Call("zero")))), }); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/hlsl/generator_impl_builtin_test.cc b/src/tint/writer/hlsl/generator_impl_builtin_test.cc index ada17f18e6..3f9cfa79a8 100644 --- a/src/tint/writer/hlsl/generator_impl_builtin_test.cc +++ b/src/tint/writer/hlsl/generator_impl_builtin_test.cc @@ -28,36 +28,40 @@ namespace { using BuiltinType = sem::BuiltinType; using HlslGeneratorImplTest_Builtin = TestHelper; -enum class ParamType { +enum class CallParamType { kF32, kU32, kBool, + kF16, }; struct BuiltinData { BuiltinType builtin; - ParamType type; + CallParamType type; const char* hlsl_name; }; inline std::ostream& operator<<(std::ostream& out, BuiltinData data) { - out << data.hlsl_name; + out << data.hlsl_name << "<"; switch (data.type) { - case ParamType::kF32: + case CallParamType::kF32: out << "f32"; break; - case ParamType::kU32: + case CallParamType::kU32: out << "u32"; break; - case ParamType::kBool: + case CallParamType::kBool: out << "bool"; break; + case CallParamType::kF16: + out << "f16"; + break; } out << ">"; return out; } const ast::CallExpression* GenerateCall(BuiltinType builtin, - ParamType type, + CallParamType type, ProgramBuilder* builder) { std::string name; std::ostringstream str(name); @@ -95,30 +99,51 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin, case BuiltinType::kTanh: case BuiltinType::kTrunc: case BuiltinType::kSign: - return builder->Call(str.str(), "f2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2"); + } else { + return builder->Call(str.str(), "f2"); + } case BuiltinType::kLdexp: - return builder->Call(str.str(), "f2", "i2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "i2"); + } else { + return builder->Call(str.str(), "f2", "i2"); + } case BuiltinType::kAtan2: case BuiltinType::kDot: case BuiltinType::kDistance: case BuiltinType::kPow: case BuiltinType::kReflect: case BuiltinType::kStep: - return builder->Call(str.str(), "f2", "f2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2"); + } else { + return builder->Call(str.str(), "f2", "f2"); + } case BuiltinType::kCross: - return builder->Call(str.str(), "f3", "f3"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h3", "h3"); + } else { + return builder->Call(str.str(), "f3", "f3"); + } case BuiltinType::kFma: case BuiltinType::kMix: case BuiltinType::kFaceForward: case BuiltinType::kSmoothstep: - case BuiltinType::kSmoothStep: - return builder->Call(str.str(), "f2", "f2", "f2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2", "h2"); + } else { + return builder->Call(str.str(), "f2", "f2", "f2"); + } case BuiltinType::kAll: case BuiltinType::kAny: return builder->Call(str.str(), "b2"); case BuiltinType::kAbs: - if (type == ParamType::kF32) { + if (type == CallParamType::kF32) { return builder->Call(str.str(), "f2"); + } else if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2"); } else { return builder->Call(str.str(), "u2"); } @@ -127,48 +152,77 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin, return builder->Call(str.str(), "u2"); case BuiltinType::kMax: case BuiltinType::kMin: - if (type == ParamType::kF32) { + if (type == CallParamType::kF32) { return builder->Call(str.str(), "f2", "f2"); + } else if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2"); } else { return builder->Call(str.str(), "u2", "u2"); } case BuiltinType::kClamp: - if (type == ParamType::kF32) { + if (type == CallParamType::kF32) { return builder->Call(str.str(), "f2", "f2", "f2"); + } else if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2", "h2"); } else { return builder->Call(str.str(), "u2", "u2", "u2"); } case BuiltinType::kSelect: - return builder->Call(str.str(), "f2", "f2", "b2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2", "b2"); + } else { + return builder->Call(str.str(), "f2", "f2", "b2"); + } case BuiltinType::kDeterminant: - return builder->Call(str.str(), "m2x2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "hm2x2"); + } else { + return builder->Call(str.str(), "m2x2"); + } case BuiltinType::kTranspose: - return builder->Call(str.str(), "m3x2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "hm3x2"); + } else { + return builder->Call(str.str(), "m3x2"); + } default: break; } return nullptr; } + using HlslBuiltinTest = TestParamHelper; TEST_P(HlslBuiltinTest, Emit) { auto param = GetParam(); - Global("f2", ty.vec2(), ast::StorageClass::kPrivate); - Global("f3", ty.vec3(), ast::StorageClass::kPrivate); - Global("u2", ty.vec2(), ast::StorageClass::kPrivate); - Global("i2", ty.vec2(), ast::StorageClass::kPrivate); - Global("b2", ty.vec2(), ast::StorageClass::kPrivate); - Global("m2x2", ty.mat2x2(), ast::StorageClass::kPrivate); - Global("m3x2", ty.mat3x2(), ast::StorageClass::kPrivate); + if (param.type == CallParamType::kF16) { + Enable(ast::Extension::kF16); + + GlobalVar("h2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("h3", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("hm2x2", ty.mat2x2(), ast::StorageClass::kPrivate); + GlobalVar("hm3x2", ty.mat3x2(), ast::StorageClass::kPrivate); + } + + GlobalVar("f2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("f3", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("u2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("i2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("b2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("m2x2", ty.mat2x2(), ast::StorageClass::kPrivate); + GlobalVar("m3x2", ty.mat3x2(), ast::StorageClass::kPrivate); auto* call = GenerateCall(param.builtin, param.type, this); ASSERT_NE(nullptr, call) << "Unhandled builtin"; - Func("func", {}, ty.void_(), {CallStmt(call)}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(call), + }, + utils::Vector{create(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = Build(); - auto* sem = program->Sem().Get(call); + auto* sem = program->Sem().Get(call); ASSERT_NE(sem, nullptr); auto* target = sem->Target(); ASSERT_NE(target, nullptr); @@ -180,71 +234,116 @@ TEST_P(HlslBuiltinTest, Emit) { INSTANTIATE_TEST_SUITE_P( HlslGeneratorImplTest_Builtin, HlslBuiltinTest, - testing::Values(BuiltinData{BuiltinType::kAbs, ParamType::kF32, "abs"}, - BuiltinData{BuiltinType::kAbs, ParamType::kU32, "abs"}, - BuiltinData{BuiltinType::kAcos, ParamType::kF32, "acos"}, - BuiltinData{BuiltinType::kAll, ParamType::kBool, "all"}, - BuiltinData{BuiltinType::kAny, ParamType::kBool, "any"}, - BuiltinData{BuiltinType::kAsin, ParamType::kF32, "asin"}, - BuiltinData{BuiltinType::kAtan, ParamType::kF32, "atan"}, - BuiltinData{BuiltinType::kAtan2, ParamType::kF32, "atan2"}, - BuiltinData{BuiltinType::kCeil, ParamType::kF32, "ceil"}, - BuiltinData{BuiltinType::kClamp, ParamType::kF32, "clamp"}, - BuiltinData{BuiltinType::kClamp, ParamType::kU32, "clamp"}, - BuiltinData{BuiltinType::kCos, ParamType::kF32, "cos"}, - BuiltinData{BuiltinType::kCosh, ParamType::kF32, "cosh"}, - BuiltinData{BuiltinType::kCountOneBits, ParamType::kU32, "countbits"}, - BuiltinData{BuiltinType::kCross, ParamType::kF32, "cross"}, - BuiltinData{BuiltinType::kDeterminant, ParamType::kF32, "determinant"}, - BuiltinData{BuiltinType::kDistance, ParamType::kF32, "distance"}, - BuiltinData{BuiltinType::kDot, ParamType::kF32, "dot"}, - BuiltinData{BuiltinType::kDpdx, ParamType::kF32, "ddx"}, - BuiltinData{BuiltinType::kDpdxCoarse, ParamType::kF32, "ddx_coarse"}, - BuiltinData{BuiltinType::kDpdxFine, ParamType::kF32, "ddx_fine"}, - BuiltinData{BuiltinType::kDpdy, ParamType::kF32, "ddy"}, - BuiltinData{BuiltinType::kDpdyCoarse, ParamType::kF32, "ddy_coarse"}, - BuiltinData{BuiltinType::kDpdyFine, ParamType::kF32, "ddy_fine"}, - BuiltinData{BuiltinType::kExp, ParamType::kF32, "exp"}, - BuiltinData{BuiltinType::kExp2, ParamType::kF32, "exp2"}, - BuiltinData{BuiltinType::kFaceForward, ParamType::kF32, "faceforward"}, - BuiltinData{BuiltinType::kFloor, ParamType::kF32, "floor"}, - BuiltinData{BuiltinType::kFma, ParamType::kF32, "mad"}, - BuiltinData{BuiltinType::kFract, ParamType::kF32, "frac"}, - BuiltinData{BuiltinType::kFwidth, ParamType::kF32, "fwidth"}, - BuiltinData{BuiltinType::kFwidthCoarse, ParamType::kF32, "fwidth"}, - BuiltinData{BuiltinType::kFwidthFine, ParamType::kF32, "fwidth"}, - BuiltinData{BuiltinType::kInverseSqrt, ParamType::kF32, "rsqrt"}, - BuiltinData{BuiltinType::kLdexp, ParamType::kF32, "ldexp"}, - BuiltinData{BuiltinType::kLength, ParamType::kF32, "length"}, - BuiltinData{BuiltinType::kLog, ParamType::kF32, "log"}, - BuiltinData{BuiltinType::kLog2, ParamType::kF32, "log2"}, - BuiltinData{BuiltinType::kMax, ParamType::kF32, "max"}, - BuiltinData{BuiltinType::kMax, ParamType::kU32, "max"}, - BuiltinData{BuiltinType::kMin, ParamType::kF32, "min"}, - BuiltinData{BuiltinType::kMin, ParamType::kU32, "min"}, - BuiltinData{BuiltinType::kMix, ParamType::kF32, "lerp"}, - BuiltinData{BuiltinType::kNormalize, ParamType::kF32, "normalize"}, - BuiltinData{BuiltinType::kPow, ParamType::kF32, "pow"}, - BuiltinData{BuiltinType::kReflect, ParamType::kF32, "reflect"}, - BuiltinData{BuiltinType::kReverseBits, ParamType::kU32, "reversebits"}, - BuiltinData{BuiltinType::kRound, ParamType::kU32, "round"}, - BuiltinData{BuiltinType::kSign, ParamType::kF32, "sign"}, - BuiltinData{BuiltinType::kSin, ParamType::kF32, "sin"}, - BuiltinData{BuiltinType::kSinh, ParamType::kF32, "sinh"}, - BuiltinData{BuiltinType::kSmoothstep, ParamType::kF32, "smoothstep"}, - BuiltinData{BuiltinType::kSmoothStep, ParamType::kF32, "smoothstep"}, - BuiltinData{BuiltinType::kSqrt, ParamType::kF32, "sqrt"}, - BuiltinData{BuiltinType::kStep, ParamType::kF32, "step"}, - BuiltinData{BuiltinType::kTan, ParamType::kF32, "tan"}, - BuiltinData{BuiltinType::kTanh, ParamType::kF32, "tanh"}, - BuiltinData{BuiltinType::kTranspose, ParamType::kF32, "transpose"}, - BuiltinData{BuiltinType::kTrunc, ParamType::kF32, "trunc"})); + testing::Values(/* Logical built-in */ + BuiltinData{BuiltinType::kAll, CallParamType::kBool, "all"}, + BuiltinData{BuiltinType::kAny, CallParamType::kBool, "any"}, + /* Float built-in */ + BuiltinData{BuiltinType::kAbs, CallParamType::kF32, "abs"}, + BuiltinData{BuiltinType::kAbs, CallParamType::kF16, "abs"}, + BuiltinData{BuiltinType::kAcos, CallParamType::kF32, "acos"}, + BuiltinData{BuiltinType::kAcos, CallParamType::kF16, "acos"}, + BuiltinData{BuiltinType::kAsin, CallParamType::kF32, "asin"}, + BuiltinData{BuiltinType::kAsin, CallParamType::kF16, "asin"}, + BuiltinData{BuiltinType::kAtan, CallParamType::kF32, "atan"}, + BuiltinData{BuiltinType::kAtan, CallParamType::kF16, "atan"}, + BuiltinData{BuiltinType::kAtan2, CallParamType::kF32, "atan2"}, + BuiltinData{BuiltinType::kAtan2, CallParamType::kF16, "atan2"}, + BuiltinData{BuiltinType::kCeil, CallParamType::kF32, "ceil"}, + BuiltinData{BuiltinType::kCeil, CallParamType::kF16, "ceil"}, + BuiltinData{BuiltinType::kClamp, CallParamType::kF32, "clamp"}, + BuiltinData{BuiltinType::kClamp, CallParamType::kF16, "clamp"}, + BuiltinData{BuiltinType::kCos, CallParamType::kF32, "cos"}, + BuiltinData{BuiltinType::kCos, CallParamType::kF16, "cos"}, + BuiltinData{BuiltinType::kCosh, CallParamType::kF32, "cosh"}, + BuiltinData{BuiltinType::kCosh, CallParamType::kF16, "cosh"}, + BuiltinData{BuiltinType::kCross, CallParamType::kF32, "cross"}, + BuiltinData{BuiltinType::kCross, CallParamType::kF16, "cross"}, + BuiltinData{BuiltinType::kDistance, CallParamType::kF32, "distance"}, + BuiltinData{BuiltinType::kDistance, CallParamType::kF16, "distance"}, + BuiltinData{BuiltinType::kExp, CallParamType::kF32, "exp"}, + BuiltinData{BuiltinType::kExp, CallParamType::kF16, "exp"}, + BuiltinData{BuiltinType::kExp2, CallParamType::kF32, "exp2"}, + BuiltinData{BuiltinType::kExp2, CallParamType::kF16, "exp2"}, + BuiltinData{BuiltinType::kFaceForward, CallParamType::kF32, "faceforward"}, + BuiltinData{BuiltinType::kFaceForward, CallParamType::kF16, "faceforward"}, + BuiltinData{BuiltinType::kFloor, CallParamType::kF32, "floor"}, + BuiltinData{BuiltinType::kFloor, CallParamType::kF16, "floor"}, + BuiltinData{BuiltinType::kFma, CallParamType::kF32, "mad"}, + BuiltinData{BuiltinType::kFma, CallParamType::kF16, "mad"}, + BuiltinData{BuiltinType::kFract, CallParamType::kF32, "frac"}, + BuiltinData{BuiltinType::kFract, CallParamType::kF16, "frac"}, + BuiltinData{BuiltinType::kInverseSqrt, CallParamType::kF32, "rsqrt"}, + BuiltinData{BuiltinType::kInverseSqrt, CallParamType::kF16, "rsqrt"}, + BuiltinData{BuiltinType::kLdexp, CallParamType::kF32, "ldexp"}, + BuiltinData{BuiltinType::kLdexp, CallParamType::kF16, "ldexp"}, + BuiltinData{BuiltinType::kLength, CallParamType::kF32, "length"}, + BuiltinData{BuiltinType::kLength, CallParamType::kF16, "length"}, + BuiltinData{BuiltinType::kLog, CallParamType::kF32, "log"}, + BuiltinData{BuiltinType::kLog, CallParamType::kF16, "log"}, + BuiltinData{BuiltinType::kLog2, CallParamType::kF32, "log2"}, + BuiltinData{BuiltinType::kLog2, CallParamType::kF16, "log2"}, + BuiltinData{BuiltinType::kMax, CallParamType::kF32, "max"}, + BuiltinData{BuiltinType::kMax, CallParamType::kF16, "max"}, + BuiltinData{BuiltinType::kMin, CallParamType::kF32, "min"}, + BuiltinData{BuiltinType::kMin, CallParamType::kF16, "min"}, + BuiltinData{BuiltinType::kMix, CallParamType::kF32, "lerp"}, + BuiltinData{BuiltinType::kMix, CallParamType::kF16, "lerp"}, + BuiltinData{BuiltinType::kNormalize, CallParamType::kF32, "normalize"}, + BuiltinData{BuiltinType::kNormalize, CallParamType::kF16, "normalize"}, + BuiltinData{BuiltinType::kPow, CallParamType::kF32, "pow"}, + BuiltinData{BuiltinType::kPow, CallParamType::kF16, "pow"}, + BuiltinData{BuiltinType::kReflect, CallParamType::kF32, "reflect"}, + BuiltinData{BuiltinType::kReflect, CallParamType::kF16, "reflect"}, + BuiltinData{BuiltinType::kSign, CallParamType::kF32, "sign"}, + BuiltinData{BuiltinType::kSign, CallParamType::kF16, "sign"}, + BuiltinData{BuiltinType::kSin, CallParamType::kF32, "sin"}, + BuiltinData{BuiltinType::kSin, CallParamType::kF16, "sin"}, + BuiltinData{BuiltinType::kSinh, CallParamType::kF32, "sinh"}, + BuiltinData{BuiltinType::kSinh, CallParamType::kF16, "sinh"}, + BuiltinData{BuiltinType::kSmoothstep, CallParamType::kF32, "smoothstep"}, + BuiltinData{BuiltinType::kSmoothstep, CallParamType::kF16, "smoothstep"}, + BuiltinData{BuiltinType::kSqrt, CallParamType::kF32, "sqrt"}, + BuiltinData{BuiltinType::kSqrt, CallParamType::kF16, "sqrt"}, + BuiltinData{BuiltinType::kStep, CallParamType::kF32, "step"}, + BuiltinData{BuiltinType::kStep, CallParamType::kF16, "step"}, + BuiltinData{BuiltinType::kTan, CallParamType::kF32, "tan"}, + BuiltinData{BuiltinType::kTan, CallParamType::kF16, "tan"}, + BuiltinData{BuiltinType::kTanh, CallParamType::kF32, "tanh"}, + BuiltinData{BuiltinType::kTanh, CallParamType::kF16, "tanh"}, + BuiltinData{BuiltinType::kTrunc, CallParamType::kF32, "trunc"}, + BuiltinData{BuiltinType::kTrunc, CallParamType::kF16, "trunc"}, + /* Integer built-in */ + BuiltinData{BuiltinType::kAbs, CallParamType::kU32, "abs"}, + BuiltinData{BuiltinType::kClamp, CallParamType::kU32, "clamp"}, + BuiltinData{BuiltinType::kCountOneBits, CallParamType::kU32, "countbits"}, + BuiltinData{BuiltinType::kMax, CallParamType::kU32, "max"}, + BuiltinData{BuiltinType::kMin, CallParamType::kU32, "min"}, + BuiltinData{BuiltinType::kReverseBits, CallParamType::kU32, "reversebits"}, + BuiltinData{BuiltinType::kRound, CallParamType::kU32, "round"}, + /* Matrix built-in */ + BuiltinData{BuiltinType::kDeterminant, CallParamType::kF32, "determinant"}, + BuiltinData{BuiltinType::kDeterminant, CallParamType::kF16, "determinant"}, + BuiltinData{BuiltinType::kTranspose, CallParamType::kF32, "transpose"}, + BuiltinData{BuiltinType::kTranspose, CallParamType::kF16, "transpose"}, + /* Vector built-in */ + BuiltinData{BuiltinType::kDot, CallParamType::kF32, "dot"}, + BuiltinData{BuiltinType::kDot, CallParamType::kF16, "dot"}, + /* Derivate built-in */ + BuiltinData{BuiltinType::kDpdx, CallParamType::kF32, "ddx"}, + BuiltinData{BuiltinType::kDpdxCoarse, CallParamType::kF32, "ddx_coarse"}, + BuiltinData{BuiltinType::kDpdxFine, CallParamType::kF32, "ddx_fine"}, + BuiltinData{BuiltinType::kDpdy, CallParamType::kF32, "ddy"}, + BuiltinData{BuiltinType::kDpdyCoarse, CallParamType::kF32, "ddy_coarse"}, + BuiltinData{BuiltinType::kDpdyFine, CallParamType::kF32, "ddy_fine"}, + BuiltinData{BuiltinType::kFwidth, CallParamType::kF32, "fwidth"}, + BuiltinData{BuiltinType::kFwidthCoarse, CallParamType::kF32, "fwidth"}, + BuiltinData{BuiltinType::kFwidthFine, CallParamType::kF32, "fwidth"})); TEST_F(HlslGeneratorImplTest_Builtin, Builtin_Call) { auto* call = Call("dot", "param1", "param2"); - Global("param1", ty.vec3(), ast::StorageClass::kPrivate); - Global("param2", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("param1", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.vec3(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); @@ -257,7 +356,7 @@ TEST_F(HlslGeneratorImplTest_Builtin, Builtin_Call) { } TEST_F(HlslGeneratorImplTest_Builtin, Select_Scalar) { - auto* call = Call("select", 1.0f, 2.0f, true); + auto* call = Call("select", 1_f, 2_f, true); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -278,8 +377,8 @@ TEST_F(HlslGeneratorImplTest_Builtin, Select_Vector) { EXPECT_EQ(out.str(), "(bool2(true, false) ? int2(3, 4) : int2(1, 2))"); } -TEST_F(HlslGeneratorImplTest_Builtin, Modf_Scalar) { - auto* call = Call("modf", 1.0f); +TEST_F(HlslGeneratorImplTest_Builtin, Modf_Scalar_f32) { + auto* call = Call("modf", 1_f); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = SanitizeAndBuild(); @@ -290,9 +389,8 @@ TEST_F(HlslGeneratorImplTest_Builtin, Modf_Scalar) { float whole; }; modf_result tint_modf(float param_0) { - float whole; - float fract = modf(param_0, whole); - modf_result result = {fract, whole}; + modf_result result; + result.fract = modf(param_0, result.whole); return result; } @@ -304,7 +402,34 @@ void test_function() { )"); } -TEST_F(HlslGeneratorImplTest_Builtin, Modf_Vector) { +TEST_F(HlslGeneratorImplTest_Builtin, Modf_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("modf", 1_h); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +[numthreads(1, 1, 1)] +void test_function() { + tint_modf(float16_t(1.0h)); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, Modf_Vector_f32) { auto* call = Call("modf", vec3()); WrapInFunction(CallStmt(call)); @@ -316,22 +441,48 @@ TEST_F(HlslGeneratorImplTest_Builtin, Modf_Vector) { float3 whole; }; modf_result_vec3 tint_modf(float3 param_0) { - float3 whole; - float3 fract = modf(param_0, whole); - modf_result_vec3 result = {fract, whole}; + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); return result; } [numthreads(1, 1, 1)] void test_function() { - tint_modf(float3(0.0f, 0.0f, 0.0f)); + tint_modf((0.0f).xxx); return; } )"); } -TEST_F(HlslGeneratorImplTest_Builtin, Frexp_Scalar_i32) { - auto* call = Call("frexp", 1.0f); +TEST_F(HlslGeneratorImplTest_Builtin, Modf_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("modf", vec3()); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(struct modf_result_vec3_f16 { + vector fract; + vector whole; +}; +modf_result_vec3_f16 tint_modf(vector param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +[numthreads(1, 1, 1)] +void test_function() { + tint_modf((float16_t(0.0h)).xxx); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, Frexp_Scalar_f32) { + auto* call = Call("frexp", 1_f); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = SanitizeAndBuild(); @@ -356,7 +507,35 @@ void test_function() { )"); } -TEST_F(HlslGeneratorImplTest_Builtin, Frexp_Vector_i32) { +TEST_F(HlslGeneratorImplTest_Builtin, Frexp_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("frexp", 1_h); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(struct frexp_result_f16 { + float16_t sig; + int exp; +}; +frexp_result_f16 tint_frexp(float16_t param_0) { + float16_t exp; + float16_t sig = frexp(param_0, exp); + frexp_result_f16 result = {sig, int(exp)}; + return result; +} + +[numthreads(1, 1, 1)] +void test_function() { + tint_frexp(float16_t(1.0h)); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, Frexp_Vector_f32) { auto* call = Call("frexp", vec3()); WrapInFunction(CallStmt(call)); @@ -376,13 +555,41 @@ frexp_result_vec3 tint_frexp(float3 param_0) { [numthreads(1, 1, 1)] void test_function() { - tint_frexp(float3(0.0f, 0.0f, 0.0f)); + tint_frexp((0.0f).xxx); return; } )"); } -TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Scalar) { +TEST_F(HlslGeneratorImplTest_Builtin, Frexp_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("frexp", vec3()); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(struct frexp_result_vec3_f16 { + vector sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec3_f16 result = {sig, int3(exp)}; + return result; +} + +[numthreads(1, 1, 1)] +void test_function() { + tint_frexp((float16_t(0.0h)).xxx); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Scalar_f32) { auto* val = Var("val", ty.f32()); auto* call = Call("degrees", val); WrapInFunction(val, call); @@ -403,7 +610,7 @@ void test_function() { )"); } -TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Vector) { +TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Vector_f32) { auto* val = Var("val", ty.vec3()); auto* call = Call("degrees", val); WrapInFunction(val, call); @@ -424,7 +631,53 @@ void test_function() { )"); } -TEST_F(HlslGeneratorImplTest_Builtin, Radians_Scalar) { +TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.f16()); + auto* call = Call("degrees", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865; +} + +[numthreads(1, 1, 1)] +void test_function() { + float16_t val = float16_t(0.0h); + const float16_t tint_symbol = tint_degrees(val); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.vec3()); + auto* call = Call("degrees", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +[numthreads(1, 1, 1)] +void test_function() { + vector val = vector(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); + const vector tint_symbol = tint_degrees(val); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, Radians_Scalar_f32) { auto* val = Var("val", ty.f32()); auto* call = Call("radians", val); WrapInFunction(val, call); @@ -445,7 +698,7 @@ void test_function() { )"); } -TEST_F(HlslGeneratorImplTest_Builtin, Radians_Vector) { +TEST_F(HlslGeneratorImplTest_Builtin, Radians_Vector_f32) { auto* val = Var("val", ty.vec3()); auto* call = Call("radians", val); WrapInFunction(val, call); @@ -466,9 +719,55 @@ void test_function() { )"); } +TEST_F(HlslGeneratorImplTest_Builtin, Radians_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.f16()); + auto* call = Call("radians", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474; +} + +[numthreads(1, 1, 1)] +void test_function() { + float16_t val = float16_t(0.0h); + const float16_t tint_symbol = tint_radians(val); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, Radians_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.vec3()); + auto* call = Call("radians", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +[numthreads(1, 1, 1)] +void test_function() { + vector val = vector(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); + const vector tint_symbol = tint_radians(val); + return; +} +)"); +} + TEST_F(HlslGeneratorImplTest_Builtin, Pack4x8Snorm) { auto* call = Call("pack4x8snorm", "p1"); - Global("p1", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec4(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -490,7 +789,7 @@ void test_function() { TEST_F(HlslGeneratorImplTest_Builtin, Pack4x8Unorm) { auto* call = Call("pack4x8unorm", "p1"); - Global("p1", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec4(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -512,7 +811,7 @@ void test_function() { TEST_F(HlslGeneratorImplTest_Builtin, Pack2x16Snorm) { auto* call = Call("pack2x16snorm", "p1"); - Global("p1", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec2(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -534,7 +833,7 @@ void test_function() { TEST_F(HlslGeneratorImplTest_Builtin, Pack2x16Unorm) { auto* call = Call("pack2x16unorm", "p1"); - Global("p1", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec2(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -556,7 +855,7 @@ void test_function() { TEST_F(HlslGeneratorImplTest_Builtin, Pack2x16Float) { auto* call = Call("pack2x16float", "p1"); - Global("p1", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec2(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -578,7 +877,7 @@ void test_function() { TEST_F(HlslGeneratorImplTest_Builtin, Unpack4x8Snorm) { auto* call = Call("unpack4x8snorm", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -601,7 +900,7 @@ void test_function() { TEST_F(HlslGeneratorImplTest_Builtin, Unpack4x8Unorm) { auto* call = Call("unpack4x8unorm", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -624,7 +923,7 @@ void test_function() { TEST_F(HlslGeneratorImplTest_Builtin, Unpack2x16Snorm) { auto* call = Call("unpack2x16snorm", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -647,7 +946,7 @@ void test_function() { TEST_F(HlslGeneratorImplTest_Builtin, Unpack2x16Unorm) { auto* call = Call("unpack2x16unorm", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -670,7 +969,7 @@ void test_function() { TEST_F(HlslGeneratorImplTest_Builtin, Unpack2x16Float) { auto* call = Call("unpack2x16float", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -691,8 +990,11 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, StorageBarrier) { - Func("main", {}, ty.void_(), {CallStmt(Call("storageBarrier"))}, - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("storageBarrier")), + }, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -709,8 +1011,11 @@ void main() { } TEST_F(HlslGeneratorImplTest_Builtin, WorkgroupBarrier) { - Func("main", {}, ty.void_(), {CallStmt(Call("workgroupBarrier"))}, - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("workgroupBarrier")), + }, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -726,5 +1031,91 @@ void main() { )"); } +TEST_F(HlslGeneratorImplTest_Builtin, Dot4I8Packed) { + Enable(ast::Extension::kChromiumExperimentalDp4A); + + auto* val1 = Var("val1", ty.u32()); + auto* val2 = Var("val2", ty.u32()); + auto* call = Call("dot4I8Packed", val1, val2); + WrapInFunction(val1, val2, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(int tint_dot4I8Packed(uint param_0, uint param_1) { + int accumulator = 0; + return dot4add_i8packed(param_0, param_1, accumulator); +} + +[numthreads(1, 1, 1)] +void test_function() { + uint val1 = 0u; + uint val2 = 0u; + const int tint_symbol = tint_dot4I8Packed(val1, val2); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, Dot4U8Packed) { + Enable(ast::Extension::kChromiumExperimentalDp4A); + + auto* val1 = Var("val1", ty.u32()); + auto* val2 = Var("val2", ty.u32()); + auto* call = Call("dot4U8Packed", val1, val2); + WrapInFunction(val1, val2, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(uint tint_dot4U8Packed(uint param_0, uint param_1) { + uint accumulator = 0u; + return dot4add_u8packed(param_0, param_1, accumulator); +} + +[numthreads(1, 1, 1)] +void test_function() { + uint val1 = 0u; + uint val2 = 0u; + const uint tint_symbol = tint_dot4U8Packed(val1, val2); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, CountOneBits) { + auto* val = Var("val1", ty.i32()); + auto* call = Call("countOneBits", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)] +void test_function() { + int val1 = 0; + const int tint_symbol = asint(countbits(asuint(val1))); + return; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_Builtin, ReverseBits) { + auto* val = Var("val1", ty.i32()); + auto* call = Call("reverseBits", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)] +void test_function() { + int val1 = 0; + const int tint_symbol = asint(reversebits(asuint(val1))); + return; +} +)"); +} + } // namespace } // namespace tint::writer::hlsl diff --git a/src/tint/writer/hlsl/generator_impl_builtin_texture_test.cc b/src/tint/writer/hlsl/generator_impl_builtin_texture_test.cc index 60bd303d94..b996b70e7d 100644 --- a/src/tint/writer/hlsl/generator_impl_builtin_texture_test.cc +++ b/src/tint/writer/hlsl/generator_impl_builtin_texture_test.cc @@ -285,7 +285,7 @@ ExpectedResult expected_texture_overload(ast::builtin::test::ValidTextureOverloa case ValidTextureOverload::kSampleGrad2dF32: return R"(tint_symbol.SampleGrad(tint_symbol_1, float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f));)"; case ValidTextureOverload::kSampleGrad2dOffsetF32: - return R"(tint_symbol.SampleGrad(tint_symbol_1, float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), int2(7, 7));)"; + return R"(tint_symbol.SampleGrad(tint_symbol_1, float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), (7).xx);)"; case ValidTextureOverload::kSampleGrad2dArrayF32: return R"(tint_symbol.SampleGrad(tint_symbol_1, float3(1.0f, 2.0f, float(3)), float2(4.0f, 5.0f), float2(6.0f, 7.0f));)"; case ValidTextureOverload::kSampleGrad2dArrayOffsetF32: @@ -370,7 +370,8 @@ TEST_P(HlslGeneratorBuiltinTextureTest, Call) { auto* call = Call(param.function, param.args(this)); auto* stmt = CallStmt(call); - Func("main", {}, ty.void_(), {stmt}, {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), utils::Vector{stmt}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = SanitizeAndBuild(); diff --git a/src/tint/writer/hlsl/generator_impl_call_test.cc b/src/tint/writer/hlsl/generator_impl_call_test.cc index e905e88cae..82fb9264cf 100644 --- a/src/tint/writer/hlsl/generator_impl_call_test.cc +++ b/src/tint/writer/hlsl/generator_impl_call_test.cc @@ -15,13 +15,15 @@ #include "src/tint/ast/call_statement.h" #include "src/tint/writer/hlsl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::hlsl { namespace { using HlslGeneratorImplTest_Call = TestHelper; TEST_F(HlslGeneratorImplTest_Call, EmitExpression_Call_WithoutParams) { - Func("my_func", {}, ty.f32(), {Return(1.23f)}); + Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(1.23_f)}); auto* call = Call("my_func"); WrapInFunction(call); @@ -35,13 +37,13 @@ TEST_F(HlslGeneratorImplTest_Call, EmitExpression_Call_WithoutParams) { TEST_F(HlslGeneratorImplTest_Call, EmitExpression_Call_WithParams) { Func("my_func", - { + utils::Vector{ Param(Sym(), ty.f32()), Param(Sym(), ty.f32()), }, - ty.f32(), {Return(1.23f)}); - Global("param1", ty.f32(), ast::StorageClass::kPrivate); - Global("param2", ty.f32(), ast::StorageClass::kPrivate); + ty.f32(), utils::Vector{Return(1.23_f)}); + GlobalVar("param1", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.f32(), ast::StorageClass::kPrivate); auto* call = Call("my_func", "param1", "param2"); WrapInFunction(call); @@ -55,13 +57,13 @@ TEST_F(HlslGeneratorImplTest_Call, EmitExpression_Call_WithParams) { TEST_F(HlslGeneratorImplTest_Call, EmitStatement_Call) { Func("my_func", - { + utils::Vector{ Param(Sym(), ty.f32()), Param(Sym(), ty.f32()), }, - ty.void_(), ast::StatementList{}, ast::AttributeList{}); - Global("param1", ty.f32(), ast::StorageClass::kPrivate); - Global("param2", ty.f32(), ast::StorageClass::kPrivate); + ty.void_(), utils::Empty, utils::Empty); + GlobalVar("param1", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.f32(), ast::StorageClass::kPrivate); auto* call = CallStmt(Call("my_func", "param1", "param2")); WrapInFunction(call); diff --git a/src/tint/writer/hlsl/generator_impl_case_test.cc b/src/tint/writer/hlsl/generator_impl_case_test.cc index ee3acfcc06..c55f14b6a1 100644 --- a/src/tint/writer/hlsl/generator_impl_case_test.cc +++ b/src/tint/writer/hlsl/generator_impl_case_test.cc @@ -75,8 +75,9 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_WithFallthrough) { } TEST_F(HlslGeneratorImplTest_Case, Emit_Case_MultipleSelectors) { - auto* s = Switch(1_i, Case({Expr(5_i), Expr(6_i)}, Block(create())), - DefaultCase()); + auto* s = + Switch(1_i, Case(utils::Vector{Expr(5_i), Expr(6_i)}, Block(create())), + DefaultCase()); WrapInFunction(s); GeneratorImpl& gen = Build(); @@ -99,7 +100,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_Default) { gen.increment_indent(); - ASSERT_TRUE(gen.EmitCase(s, 0_i)) << gen.error(); + ASSERT_TRUE(gen.EmitCase(s, 0u)) << gen.error(); EXPECT_EQ(gen.result(), R"( default: { break; } diff --git a/src/tint/writer/hlsl/generator_impl_cast_test.cc b/src/tint/writer/hlsl/generator_impl_cast_test.cc index 458f07d109..2c4690a718 100644 --- a/src/tint/writer/hlsl/generator_impl_cast_test.cc +++ b/src/tint/writer/hlsl/generator_impl_cast_test.cc @@ -29,7 +29,7 @@ TEST_F(HlslGeneratorImplTest_Cast, EmitExpression_Cast_Scalar) { std::stringstream out; ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); - EXPECT_EQ(out.str(), "float(1)"); + EXPECT_EQ(out.str(), "1.0f"); } TEST_F(HlslGeneratorImplTest_Cast, EmitExpression_Cast_Vector) { @@ -40,7 +40,7 @@ TEST_F(HlslGeneratorImplTest_Cast, EmitExpression_Cast_Vector) { std::stringstream out; ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); - EXPECT_EQ(out.str(), "float3(int3(1, 2, 3))"); + EXPECT_EQ(out.str(), "float3(1.0f, 2.0f, 3.0f)"); } } // namespace diff --git a/src/tint/writer/hlsl/generator_impl_constructor_test.cc b/src/tint/writer/hlsl/generator_impl_constructor_test.cc index 5916b0ac0b..e5157d9f67 100644 --- a/src/tint/writer/hlsl/generator_impl_constructor_test.cc +++ b/src/tint/writer/hlsl/generator_impl_constructor_test.cc @@ -34,7 +34,7 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Bool) { } TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Int) { - WrapInFunction(Expr(i32(-12345))); + WrapInFunction(Expr(-12345_i)); GeneratorImpl& gen = Build(); @@ -61,13 +61,36 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Float) { EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f")); } -TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Float) { - WrapInFunction(Construct(-1.2e-5f)); +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_F16) { + Enable(ast::Extension::kF16); + + // Use a number close to 1<<16 but whose decimal representation ends in 0. + WrapInFunction(Expr(f16((1 << 15) - 8))); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("float(-0.000012f)")); + EXPECT_THAT(gen.result(), HasSubstr("float16_t(32752.0h)")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Float) { + WrapInFunction(Construct(-1.2e-5_f)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("-0.000012f")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(Construct(-1.2e-3_h)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("float16_t(-0.00119972229h)")); } TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Bool) { @@ -76,16 +99,16 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Bool) { GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("bool(true)")); + EXPECT_THAT(gen.result(), HasSubstr("true")); } TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Int) { - WrapInFunction(Construct(i32(-12345))); + WrapInFunction(Construct(-12345_i)); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("int(-12345)")); + EXPECT_THAT(gen.result(), HasSubstr("-12345")); } TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Uint) { @@ -94,11 +117,11 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Uint) { GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("uint(12345u)")); + EXPECT_THAT(gen.result(), HasSubstr("12345u")); } -TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec) { - WrapInFunction(vec3(1.f, 2.f, 3.f)); +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_F32) { + WrapInFunction(vec3(1_f, 2_f, 3_f)); GeneratorImpl& gen = Build(); @@ -106,26 +129,61 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec) { EXPECT_THAT(gen.result(), HasSubstr("float3(1.0f, 2.0f, 3.0f)")); } -TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_Empty) { +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3(1_h, 2_h, 3_h)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT( + gen.result(), + HasSubstr("vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h))")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_Empty_F32) { WrapInFunction(vec3()); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("float3(0.0f, 0.0f, 0.0f)")); + EXPECT_THAT(gen.result(), HasSubstr("0.0f).xxx")); } -TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_Float_Literal) { - WrapInFunction(vec3(2.0f)); +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_Empty_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3()); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("float3((2.0f).xxx)")); + EXPECT_THAT(gen.result(), HasSubstr("(float16_t(0.0h)).xxx")); } -TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_Float_Var) { - auto* var = Var("v", nullptr, Expr(2.0f)); +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_F32_Literal) { + WrapInFunction(vec3(2_f)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("2.0f).xxx")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_F16_Literal) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3(2_h)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("(float16_t(2.0h)).xxx")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_F32_Var) { + auto* var = Var("v", Expr(2_f)); auto* cast = vec3(var); WrapInFunction(var, cast); @@ -136,17 +194,31 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_ const float3 tint_symbol = float3((v).xxx);)")); } +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_F16_Var) { + Enable(ast::Extension::kF16); + + auto* var = Var("v", Expr(2_h)); + auto* cast = vec3(var); + WrapInFunction(var, cast); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr(R"(float16_t v = float16_t(2.0h); + const vector tint_symbol = vector((v).xxx);)")); +} + TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_Bool_Literal) { WrapInFunction(vec3(true)); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("bool3((true).xxx)")); + EXPECT_THAT(gen.result(), HasSubstr("(true).xxx")); } TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_Bool_Var) { - auto* var = Var("v", nullptr, Expr(true)); + auto* var = Var("v", Expr(true)); auto* cast = vec3(var); WrapInFunction(var, cast); @@ -163,7 +235,7 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_ GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("int3((2).xxx)")); + EXPECT_THAT(gen.result(), HasSubstr("2).xxx")); } TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_UInt) { @@ -172,11 +244,11 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Vec_SingleScalar_ GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("uint3((2u).xxx)")); + EXPECT_THAT(gen.result(), HasSubstr("2u).xxx")); } -TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat) { - WrapInFunction(mat2x3(vec3(1.f, 2.f, 3.f), vec3(3.f, 4.f, 5.f))); +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_F32) { + WrapInFunction(mat2x3(vec3(1_f, 2_f, 3_f), vec3(3_f, 4_f, 5_f))); GeneratorImpl& gen = Build(); @@ -186,19 +258,146 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat) { HasSubstr("float2x3(float3(1.0f, 2.0f, 3.0f), float3(3.0f, 4.0f, 5.0f))")); } -TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Empty) { +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(mat2x3(vec3(1_h, 2_h, 3_h), vec3(3_h, 4_h, 5_h))); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), + HasSubstr("matrix(vector(float16_t(1.0h), " + "float16_t(2.0h), float16_t(3.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)))")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Complex_F32) { + // mat4x4( + // vec4(2.0f, 3.0f, 4.0f, 8.0f), + // vec4(), + // vec4(7.0f), + // vec4(vec4(42.0f, 21.0f, 6.0f, -5.0f)), + // ); + auto* vector_literal = + vec4(Expr(f32(2.0)), Expr(f32(3.0)), Expr(f32(4.0)), Expr(f32(8.0))); + auto* vector_zero_ctor = vec4(); + auto* vector_single_scalar_ctor = vec4(Expr(f32(7.0))); + auto* vector_identical_ctor = + vec4(vec4(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0)))); + + auto* constructor = mat4x4(vector_literal, vector_zero_ctor, vector_single_scalar_ctor, + vector_identical_ctor); + + WrapInFunction(constructor); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("float4x4(float4(2.0f, 3.0f, 4.0f, 8.0f), (0.0f).xxxx, " + "(7.0f).xxxx, float4(42.0f, 21.0f, 6.0f, -5.0f))")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Complex_F16) { + // mat4x4( + // vec4(2.0h, 3.0h, 4.0h, 8.0h), + // vec4(), + // vec4(7.0h), + // vec4(vec4(42.0h, 21.0h, 6.0h, -5.0h)), + // ); + Enable(ast::Extension::kF16); + + auto* vector_literal = + vec4(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0))); + auto* vector_zero_ctor = vec4(); + auto* vector_single_scalar_ctor = vec4(Expr(f16(7.0))); + auto* vector_identical_ctor = + vec4(vec4(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0)))); + + auto* constructor = mat4x4(vector_literal, vector_zero_ctor, vector_single_scalar_ctor, + vector_identical_ctor); + + WrapInFunction(constructor); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("matrix(" + "vector(float16_t(2.0h), float16_t(3.0h), " + "float16_t(4.0h), float16_t(8.0h)), " + "(float16_t(0.0h)).xxxx, (float16_t(7.0h)).xxxx, " + "vector(float16_t(42.0h), float16_t(21.0h), " + "float16_t(6.0h), float16_t(-5.0h)))")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Empty_F32) { WrapInFunction(mat2x3()); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)")); + EXPECT_THAT(gen.result(), HasSubstr("float2x3 tint_symbol = float2x3((0.0f).xxx, (0.0f).xxx)")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Empty_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(mat2x3()); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), + HasSubstr("matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Identity_F32) { + // fn f() { + // var m_1: mat4x4 = mat4x4(); + // var m_2: mat4x4 = mat4x4(m_1); + // } + + auto* m_1 = Var("m_1", ty.mat4x4(ty.f32()), mat4x4()); + auto* m_2 = Var("m_2", ty.mat4x4(ty.f32()), mat4x4(m_1)); + + WrapInFunction(m_1, m_2); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("float4x4 m_2 = float4x4(m_1);")); +} + +TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Mat_Identity_F16) { + // fn f() { + // var m_1: mat4x4 = mat4x4(); + // var m_2: mat4x4 = mat4x4(m_1); + // } + + Enable(ast::Extension::kF16); + + auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4()); + auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4(m_1)); + + WrapInFunction(m_1, m_2); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), + HasSubstr("matrix m_2 = matrix(m_1);")); } TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Array) { - WrapInFunction(Construct(ty.array(ty.vec3(), 3_u), vec3(1.f, 2.f, 3.f), - vec3(4.f, 5.f, 6.f), vec3(7.f, 8.f, 9.f))); + WrapInFunction(Construct(ty.array(ty.vec3(), 3_u), vec3(1_f, 2_f, 3_f), + vec3(4_f, 5_f, 6_f), vec3(7_f, 8_f, 9_f))); GeneratorImpl& gen = Build(); @@ -217,13 +416,13 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Array_Empty) { } TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct) { - auto* str = Structure("S", { + auto* str = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), Member("c", ty.vec3()), }); - WrapInFunction(Construct(ty.Of(str), 1_i, 2.0f, vec3(3_i, 4_i, 5_i))); + WrapInFunction(Construct(ty.Of(str), 1_i, 2_f, vec3(3_i, 4_i, 5_i))); GeneratorImpl& gen = SanitizeAndBuild(); @@ -232,7 +431,7 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct) { } TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct_Empty) { - auto* str = Structure("S", { + auto* str = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), Member("c", ty.vec3()), diff --git a/src/tint/writer/hlsl/generator_impl_function_test.cc b/src/tint/writer/hlsl/generator_impl_function_test.cc index 0525fa664e..5bff35efd1 100644 --- a/src/tint/writer/hlsl/generator_impl_function_test.cc +++ b/src/tint/writer/hlsl/generator_impl_function_test.cc @@ -28,8 +28,8 @@ namespace { using HlslGeneratorImplTest_Function = TestHelper; TEST_F(HlslGeneratorImplTest_Function, Emit_Function) { - Func("my_func", ast::VariableList{}, ty.void_(), - { + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Return(), }); @@ -45,8 +45,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function) { } TEST_F(HlslGeneratorImplTest_Function, Emit_Function_Name_Collision) { - Func("GeometryShader", ast::VariableList{}, ty.void_(), - { + Func("GeometryShader", utils::Empty, ty.void_(), + utils::Vector{ Return(), }); @@ -61,8 +61,13 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_Name_Collision) { } TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithParams) { - Func("my_func", ast::VariableList{Param("a", ty.f32()), Param("b", ty.i32())}, ty.void_(), - { + Func("my_func", + utils::Vector{ + Param("a", ty.f32()), + Param("b", ty.i32()), + }, + ty.void_(), + utils::Vector{ Return(), }); @@ -78,8 +83,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithParams) { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_NoReturn_Void) { - Func("main", ast::VariableList{}, ty.void_(), {/* no explicit return */}, - { + Func("main", utils::Empty, ty.void_(), utils::Empty /* no explicit return */, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -96,8 +101,8 @@ TEST_F(HlslGeneratorImplTest_Function, PtrParameter) { // fn f(foo : ptr) -> f32 { // return *foo; // } - Func("f", {Param("foo", ty.pointer(ast::StorageClass::kFunction))}, ty.f32(), - {Return(Deref("foo"))}); + Func("f", utils::Vector{Param("foo", ty.pointer(ast::StorageClass::kFunction))}, ty.f32(), + utils::Vector{Return(Deref("foo"))}); GeneratorImpl& gen = SanitizeAndBuild(); @@ -112,9 +117,17 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_WithInOutVars) // fn frag_main(@location(0) foo : f32) -> @location(1) f32 { // return foo; // } - auto* foo_in = Param("foo", ty.f32(), {Location(0)}); - Func("frag_main", ast::VariableList{foo_in}, ty.f32(), {Return("foo")}, - {Stage(ast::PipelineStage::kFragment)}, {Location(1)}); + auto* foo_in = Param("foo", ty.f32(), utils::Vector{Location(0)}); + Func("frag_main", utils::Vector{foo_in}, ty.f32(), + utils::Vector{ + Return("foo"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(1), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -143,9 +156,18 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_WithInOut_Built // fn frag_main(@position(0) coord : vec4) -> @frag_depth f32 { // return coord.x; // } - auto* coord_in = Param("coord", ty.vec4(), {Builtin(ast::Builtin::kPosition)}); - Func("frag_main", ast::VariableList{coord_in}, ty.f32(), {Return(MemberAccessor("coord", "x"))}, - {Stage(ast::PipelineStage::kFragment)}, {Builtin(ast::Builtin::kFragDepth)}); + auto* coord_in = + Param("coord", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}); + Func("frag_main", utils::Vector{coord_in}, ty.f32(), + utils::Vector{ + Return(MemberAccessor("coord", "x")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kFragDepth), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -185,24 +207,27 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_SharedStruct_Di // const p = inputs.pos; // } auto* interface_struct = Structure( - "Interface", { - Member("pos", ty.vec4(), {Builtin(ast::Builtin::kPosition)}), - Member("col1", ty.f32(), {Location(1)}), - Member("col2", ty.f32(), {Location(2)}), - }); + "Interface", + utils::Vector{ + Member("pos", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}), + Member("col1", ty.f32(), utils::Vector{Location(1)}), + Member("col2", ty.f32(), utils::Vector{Location(2)}), + }); - Func("vert_main", {}, ty.Of(interface_struct), - {Return(Construct(ty.Of(interface_struct), Construct(ty.vec4()), Expr(0.5f), - Expr(0.25f)))}, - {Stage(ast::PipelineStage::kVertex)}); + Func("vert_main", utils::Empty, ty.Of(interface_struct), + utils::Vector{ + Return(Construct(ty.Of(interface_struct), Construct(ty.vec4()), Expr(0.5_f), + Expr(0.25_f))), + }, + utils::Vector{Stage(ast::PipelineStage::kVertex)}); - Func("frag_main", {Param("inputs", ty.Of(interface_struct))}, ty.void_(), - { + Func("frag_main", utils::Vector{Param("inputs", ty.Of(interface_struct))}, ty.void_(), + utils::Vector{ Decl(Let("r", ty.f32(), MemberAccessor("inputs", "col1"))), Decl(Let("g", ty.f32(), MemberAccessor("inputs", "col2"))), Decl(Let("p", ty.vec4(), MemberAccessor("inputs", "pos"))), }, - {Stage(ast::PipelineStage::kFragment)}); + utils::Vector{Stage(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = SanitizeAndBuild(); @@ -219,7 +244,7 @@ struct tint_symbol { }; Interface vert_main_inner() { - const Interface tint_symbol_3 = {float4(0.0f, 0.0f, 0.0f, 0.0f), 0.5f, 0.25f}; + const Interface tint_symbol_3 = {(0.0f).xxxx, 0.5f, 0.25f}; return tint_symbol_3; } @@ -265,19 +290,29 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_SharedStruct_He // fn vert_main2() -> VertexOutput { // return foo(0.25); // } - auto* vertex_output_struct = Structure( - "VertexOutput", {Member("pos", ty.vec4(), {Builtin(ast::Builtin::kPosition)})}); + auto* vertex_output_struct = + Structure("VertexOutput", + utils::Vector{Member("pos", ty.vec4(), + utils::Vector{Builtin(ast::BuiltinValue::kPosition)})}); - Func("foo", {Param("x", ty.f32())}, ty.Of(vertex_output_struct), - {Return(Construct(ty.Of(vertex_output_struct), - Construct(ty.vec4(), "x", "x", "x", Expr(1.f))))}, - {}); + Func("foo", utils::Vector{Param("x", ty.f32())}, ty.Of(vertex_output_struct), + utils::Vector{ + Return(Construct(ty.Of(vertex_output_struct), + Construct(ty.vec4(), "x", "x", "x", Expr(1_f)))), + }, + utils::Empty); - Func("vert_main1", {}, ty.Of(vertex_output_struct), {Return(Call("foo", Expr(0.5f)))}, - {Stage(ast::PipelineStage::kVertex)}); + Func("vert_main1", utils::Empty, ty.Of(vertex_output_struct), + utils::Vector{ + Return(Call("foo", Expr(0.5_f))), + }, + utils::Vector{Stage(ast::PipelineStage::kVertex)}); - Func("vert_main2", {}, ty.Of(vertex_output_struct), {Return(Call("foo", Expr(0.25f)))}, - {Stage(ast::PipelineStage::kVertex)}); + Func("vert_main2", utils::Empty, ty.Of(vertex_output_struct), + utils::Vector{ + Return(Call("foo", Expr(0.25_f))), + }, + utils::Vector{Stage(ast::PipelineStage::kVertex)}); GeneratorImpl& gen = SanitizeAndBuild(); @@ -324,30 +359,26 @@ tint_symbol_1 vert_main2() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_Uniform) { - auto* ubo_ty = Structure("UBO", {Member("coord", ty.vec4())}); - auto* ubo = Global("ubo", ty.Of(ubo_ty), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(1), - }); + auto* ubo_ty = Structure("UBO", utils::Vector{Member("coord", ty.vec4())}); + auto* ubo = GlobalVar("ubo", ty.Of(ubo_ty), ast::StorageClass::kUniform, Binding(0), Group(1)); Func("sub_func", - { + utils::Vector{ Param("param", ty.f32()), }, ty.f32(), - { + utils::Vector{ Return(MemberAccessor(MemberAccessor(ubo, "coord"), "x")), }); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, Call("sub_func", 1.0f)); + auto* var = Var("v", ty.f32(), Call("sub_func", 1_f)); - Func("frag_main", {}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -370,23 +401,18 @@ void frag_main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_UniformStruct) { - auto* s = Structure("Uniforms", {Member("coord", ty.vec4())}); + auto* s = Structure("Uniforms", utils::Vector{Member("coord", ty.vec4())}); - Global("uniforms", ty.Of(s), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("uniforms", ty.Of(s), ast::StorageClass::kUniform, Binding(0), Group(1)); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, - MemberAccessor(MemberAccessor("uniforms", "coord"), "x")); + auto* var = Var("v", ty.f32(), MemberAccessor(MemberAccessor("uniforms", "coord"), "x")); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -405,25 +431,22 @@ void frag_main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RW_StorageBuffer_Read) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(1)); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b")); + auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b")); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -441,25 +464,22 @@ void frag_main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RO_StorageBuffer_Read) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), + Group(1)); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b")); + auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b")); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -477,23 +497,20 @@ void frag_main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_WO_StorageBuffer_Store) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kWrite, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(1)); - Func("frag_main", ast::VariableList{}, ty.void_(), - { - Assign(MemberAccessor("coord", "b"), Expr(2.0f)), + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ + Assign(MemberAccessor("coord", "b"), Expr(2_f)), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -511,23 +528,20 @@ void frag_main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_StorageBuffer_Store) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(1), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(1)); - Func("frag_main", ast::VariableList{}, ty.void_(), - { - Assign(MemberAccessor("coord", "b"), Expr(2.0f)), + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ + Assign(MemberAccessor("coord", "b"), Expr(2_f)), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -545,26 +559,26 @@ void frag_main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_Uniform) { - auto* s = Structure("S", {Member("x", ty.f32())}); - Global("coord", ty.Of(s), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(1), - }); + auto* s = Structure("S", utils::Vector{Member("x", ty.f32())}); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kUniform, Binding(0), Group(1)); - Func("sub_func", ast::VariableList{Param("param", ty.f32())}, ty.f32(), - { + Func("sub_func", + utils::Vector{ + Param("param", ty.f32()), + }, + ty.f32(), + utils::Vector{ Return(MemberAccessor("coord", "x")), }); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, Call("sub_func", 1.0f)); + auto* var = Var("v", ty.f32(), Call("sub_func", 1_f)); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -587,26 +601,27 @@ void frag_main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_StorageBuffer) { - auto* s = Structure("S", {Member("x", ty.f32())}); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(1), - }); + auto* s = Structure("S", utils::Vector{Member("x", ty.f32())}); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(1)); - Func("sub_func", ast::VariableList{Param("param", ty.f32())}, ty.f32(), - { + Func("sub_func", + utils::Vector{ + Param("param", ty.f32()), + }, + ty.f32(), + utils::Vector{ Return(MemberAccessor("coord", "x")), }); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, Call("sub_func", 1.0f)); + auto* var = Var("v", ty.f32(), Call("sub_func", 1_f)); - Func("frag_main", ast::VariableList{}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -628,8 +643,8 @@ void frag_main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_WithNameCollision) { - Func("GeometryShader", ast::VariableList{}, ty.void_(), {}, - { + Func("GeometryShader", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -643,11 +658,11 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_WithNameCollisi } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute) { - Func("main", ast::VariableList{}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Return(), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); GeneratorImpl& gen = Build(); @@ -660,8 +675,8 @@ void main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute_WithWorkgroup_Literal) { - Func("main", ast::VariableList{}, ty.void_(), {}, - { + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(2_i, 4_i, 6_i), }); @@ -680,8 +695,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute_WithWor GlobalConst("width", ty.i32(), Construct(ty.i32(), 2_i)); GlobalConst("height", ty.i32(), Construct(ty.i32(), 3_i)); GlobalConst("depth", ty.i32(), Construct(ty.i32(), 4_i)); - Func("main", ast::VariableList{}, ty.void_(), {}, - { + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize("width", "height", "depth"), }); @@ -689,11 +704,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute_WithWor GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_EQ(gen.result(), R"(static const int width = int(2); -static const int height = int(3); -static const int depth = int(4); - -[numthreads(2, 3, 4)] + EXPECT_EQ(gen.result(), R"([numthreads(2, 3, 4)] void main() { return; } @@ -702,11 +713,11 @@ void main() { TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_Compute_WithWorkgroup_OverridableConst) { - Override("width", ty.i32(), Construct(ty.i32(), 2_i), {Id(7u)}); - Override("height", ty.i32(), Construct(ty.i32(), 3_i), {Id(8u)}); - Override("depth", ty.i32(), Construct(ty.i32(), 4_i), {Id(9u)}); - Func("main", ast::VariableList{}, ty.void_(), {}, - { + Override("width", ty.i32(), Construct(ty.i32(), 2_i), Id(7u)); + Override("height", ty.i32(), Construct(ty.i32(), 3_i), Id(8u)); + Override("depth", ty.i32(), Construct(ty.i32(), 4_i), Id(9u)); + Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize("width", "height", "depth"), }); @@ -715,15 +726,15 @@ TEST_F(HlslGeneratorImplTest_Function, ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_7 -#define WGSL_SPEC_CONSTANT_7 int(2) +#define WGSL_SPEC_CONSTANT_7 2 #endif static const int width = WGSL_SPEC_CONSTANT_7; #ifndef WGSL_SPEC_CONSTANT_8 -#define WGSL_SPEC_CONSTANT_8 int(3) +#define WGSL_SPEC_CONSTANT_8 3 #endif static const int height = WGSL_SPEC_CONSTANT_8; #ifndef WGSL_SPEC_CONSTANT_9 -#define WGSL_SPEC_CONSTANT_9 int(4) +#define WGSL_SPEC_CONSTANT_9 4 #endif static const int depth = WGSL_SPEC_CONSTANT_9; @@ -735,8 +746,12 @@ void main() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) { - Func("my_func", ast::VariableList{Param("a", ty.array())}, ty.void_(), - { + Func("my_func", + utils::Vector{ + Param("a", ty.array()), + }, + ty.void_(), + utils::Vector{ Return(), }); @@ -750,8 +765,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) { } TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayReturn) { - Func("my_func", {}, ty.array(), - { + Func("my_func", utils::Empty, ty.array(), + utils::Vector{ Return(Construct(ty.array())), }); @@ -766,8 +781,8 @@ my_func_ret my_func() { } TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithDiscardAndVoidReturn) { - Func("my_func", {Param("a", ty.i32())}, ty.void_(), - { + Func("my_func", utils::Vector{Param("a", ty.i32())}, ty.void_(), + utils::Vector{ If(Equal("a", 0_i), // Block(create())), Return(), @@ -786,8 +801,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithDiscardAndVoidReturn) { } TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithDiscardAndNonVoidReturn) { - Func("my_func", {Param("a", ty.i32())}, ty.i32(), - { + Func("my_func", utils::Vector{Param("a", ty.i32())}, ty.i32(), + utils::Vector{ If(Equal("a", 0_i), // Block(create())), Return(42_i), @@ -816,46 +831,49 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Multiple_EntryPoint_With_Same_Module // }; // @binding(0) @group(0) var data : Data; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn a() { // var v = data.d; // return; // } // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn b() { // var v = data.d; // return; // } - auto* s = Structure("Data", {Member("d", ty.f32())}); + auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())}); - Global("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(0)); { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("a", ast::VariableList{}, ty.void_(), - { + Func("a", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); } { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("b", ast::VariableList{}, ty.void_(), - { + Func("b", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); } GeneratorImpl& gen = SanitizeAndBuild(); diff --git a/src/tint/writer/hlsl/generator_impl_identifier_test.cc b/src/tint/writer/hlsl/generator_impl_identifier_test.cc index d982e1e7df..d4b645f6bd 100644 --- a/src/tint/writer/hlsl/generator_impl_identifier_test.cc +++ b/src/tint/writer/hlsl/generator_impl_identifier_test.cc @@ -20,7 +20,7 @@ namespace { using HlslGeneratorImplTest_Identifier = TestHelper; TEST_F(HlslGeneratorImplTest_Identifier, EmitIdentifierExpression) { - Global("foo", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("foo", ty.i32(), ast::StorageClass::kPrivate); auto* i = Expr("foo"); WrapInFunction(i); diff --git a/src/tint/writer/hlsl/generator_impl_if_test.cc b/src/tint/writer/hlsl/generator_impl_if_test.cc index 1668d71cb8..3195a06ca7 100644 --- a/src/tint/writer/hlsl/generator_impl_if_test.cc +++ b/src/tint/writer/hlsl/generator_impl_if_test.cc @@ -20,7 +20,7 @@ namespace { using HlslGeneratorImplTest_If = TestHelper; TEST_F(HlslGeneratorImplTest_If, Emit_If) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); auto* cond = Expr("cond"); auto* body = Block(Return()); @@ -38,8 +38,8 @@ TEST_F(HlslGeneratorImplTest_If, Emit_If) { } TEST_F(HlslGeneratorImplTest_If, Emit_IfWithElseIf) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); - Global("else_cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("else_cond", ty.bool_(), ast::StorageClass::kPrivate); auto* else_cond = Expr("else_cond"); auto* else_body = Block(Return()); @@ -65,7 +65,7 @@ TEST_F(HlslGeneratorImplTest_If, Emit_IfWithElseIf) { } TEST_F(HlslGeneratorImplTest_If, Emit_IfWithElse) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); auto* else_body = Block(Return()); @@ -88,8 +88,8 @@ TEST_F(HlslGeneratorImplTest_If, Emit_IfWithElse) { } TEST_F(HlslGeneratorImplTest_If, Emit_IfWithMultiple) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); - Global("else_cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("else_cond", ty.bool_(), ast::StorageClass::kPrivate); auto* else_cond = Expr("else_cond"); diff --git a/src/tint/writer/hlsl/generator_impl_import_test.cc b/src/tint/writer/hlsl/generator_impl_import_test.cc index 73e3161d03..d6fdeac1d0 100644 --- a/src/tint/writer/hlsl/generator_impl_import_test.cc +++ b/src/tint/writer/hlsl/generator_impl_import_test.cc @@ -35,7 +35,7 @@ TEST_P(HlslImportData_SingleParamTest, FloatScalar) { auto param = GetParam(); auto* ident = Expr(param.name); - auto* expr = Call(ident, 1.f); + auto* expr = Call(ident, 1_f); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -92,7 +92,7 @@ TEST_P(HlslImportData_SingleVectorParamTest, FloatVector) { auto param = GetParam(); auto* ident = Expr(param.name); - auto* expr = Call(ident, vec3(1.f, 2.f, 3.f)); + auto* expr = Call(ident, vec3(1_f, 2_f, 3_f)); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -132,7 +132,7 @@ using HlslImportData_DualParam_ScalarTest = TestParamHelper; TEST_P(HlslImportData_DualParam_ScalarTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, 1.f, 2.f); + auto* expr = Call(param.name, 1_f, 2_f); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -154,7 +154,7 @@ using HlslImportData_DualParam_VectorTest = TestParamHelper; TEST_P(HlslImportData_DualParam_VectorTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, vec3(1.f, 2.f, 3.f), vec3(4.f, 5.f, 6.f)); + auto* expr = Call(param.name, vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f)); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -197,7 +197,7 @@ using HlslImportData_TripleParam_ScalarTest = TestParamHelper; TEST_P(HlslImportData_TripleParam_ScalarTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, 1.f, 2.f, 3.f); + auto* expr = Call(param.name, 1_f, 2_f, 3_f); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -217,8 +217,8 @@ using HlslImportData_TripleParam_VectorTest = TestParamHelper; TEST_P(HlslImportData_TripleParam_VectorTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, vec3(1.f, 2.f, 3.f), vec3(4.f, 5.f, 6.f), - vec3(7.f, 8.f, 9.f)); + auto* expr = Call(param.name, vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f), + vec3(7_f, 8_f, 9_f)); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -259,7 +259,7 @@ INSTANTIATE_TEST_SUITE_P(HlslGeneratorImplTest_Import, testing::Values(HlslImportData{"clamp", "clamp"})); TEST_F(HlslGeneratorImplTest_Import, HlslImportData_Determinant) { - Global("var", ty.mat3x3(), ast::StorageClass::kPrivate); + GlobalVar("var", ty.mat3x3(), ast::StorageClass::kPrivate); auto* expr = Call("determinant", "var"); WrapInFunction(expr); diff --git a/src/tint/writer/hlsl/generator_impl_loop_test.cc b/src/tint/writer/hlsl/generator_impl_loop_test.cc index 0bd1f7542d..77f0dd430f 100644 --- a/src/tint/writer/hlsl/generator_impl_loop_test.cc +++ b/src/tint/writer/hlsl/generator_impl_loop_test.cc @@ -66,8 +66,8 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopWithContinuing) { TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopNestedWithContinuing) { Func("a_statement", {}, ty.void_(), {}); - Global("lhs", ty.f32(), ast::StorageClass::kPrivate); - Global("rhs", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("lhs", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.f32(), ast::StorageClass::kPrivate); auto* body = Block(create()); auto* continuing = Block(CallStmt(Call("a_statement"))); @@ -112,10 +112,10 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_LoopWithVarUsedInContinuing) { // } // } - Global("rhs", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.f32(), ast::StorageClass::kPrivate); - auto* body = Block(Decl(Var("lhs", ty.f32(), Expr(2.4f))), // - Decl(Var("other", ty.f32())), // + auto* body = Block(Decl(Var("lhs", ty.f32(), Expr(2.4_f))), // + Decl(Var("other", ty.f32())), // Break()); auto* continuing = Block(Assign("lhs", "rhs")); @@ -187,7 +187,7 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtInit) { auto* multi_stmt = create(ast::BinaryOp::kLogicalAnd, Expr(true), Expr(false)); - auto* f = For(Decl(Var("b", nullptr, multi_stmt)), nullptr, nullptr, Block(Return())); + auto* f = For(Decl(Var("b", multi_stmt)), nullptr, nullptr, Block(Return())); WrapInFunction(f); GeneratorImpl& gen = Build(); @@ -341,8 +341,8 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtInitCondCont) { auto* multi_stmt_c = create(ast::BinaryOp::kLogicalAnd, Expr(true), Expr(false)); - auto* f = For(Decl(Var("i", nullptr, multi_stmt_a)), multi_stmt_b, Assign("i", multi_stmt_c), - Block(Return())); + auto* f = + For(Decl(Var("i", multi_stmt_a)), multi_stmt_b, Assign("i", multi_stmt_c), Block(Return())); WrapInFunction(f); GeneratorImpl& gen = Build(); @@ -373,5 +373,69 @@ TEST_F(HlslGeneratorImplTest_Loop, Emit_ForLoopWithMultiStmtInitCondCont) { )"); } +TEST_F(HlslGeneratorImplTest_Loop, Emit_While) { + // while(true) { + // return; + // } + + auto* f = While(Expr(true), Block(Return())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( [loop] while(true) { + return; + } +)"); +} + +TEST_F(HlslGeneratorImplTest_Loop, Emit_While_WithContinue) { + // while(true) { + // continue; + // } + + auto* f = While(Expr(true), Block(Continue())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( [loop] while(true) { + continue; + } +)"); +} + +TEST_F(HlslGeneratorImplTest_Loop, Emit_WhileWithMultiStmtCond) { + // while(true && false) { + // return; + // } + + auto* multi_stmt = + create(ast::BinaryOp::kLogicalAnd, Expr(true), Expr(false)); + auto* f = While(multi_stmt, Block(Return())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( [loop] while (true) { + bool tint_tmp = true; + if (tint_tmp) { + tint_tmp = false; + } + if (!((tint_tmp))) { break; } + return; + } +)"); +} + } // namespace } // namespace tint::writer::hlsl diff --git a/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc b/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc index ad1e973e76..39dd86cb9a 100644 --- a/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc +++ b/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc @@ -86,24 +86,20 @@ inline const ast::Type* ty_mat4x4(const ProgramBuilder::TypesBuilder& ty) { template class HlslGeneratorImplTest_MemberAccessorBase : public BASE { public: - void SetupStorageBuffer(ast::StructMemberList members) { + void SetupStorageBuffer(utils::VectorRef members) { ProgramBuilder& b = *this; - auto* s = b.Structure("Data", members); - b.Global("data", b.ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - b.create(0), - b.create(1), - }); + b.GlobalVar("data", b.ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, + b.Group(1), b.Binding(0)); } - void SetupFunction(ast::StatementList statements) { + void SetupFunction(utils::VectorRef statements) { ProgramBuilder& b = *this; - b.Func("main", ast::VariableList{}, b.ty.void_(), statements, - ast::AttributeList{ - b.Stage(ast::PipelineStage::kFragment), - }); + utils::Vector attrs{ + b.Stage(ast::PipelineStage::kFragment), + }; + b.Func("main", utils::Empty, b.ty.void_(), std::move(statements), std::move(attrs)); } }; @@ -114,11 +110,11 @@ using HlslGeneratorImplTest_MemberAccessorWithParam = HlslGeneratorImplTest_MemberAccessorBase>; TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) { - auto* s = Structure("Data", {Member("mem", ty.f32())}); - Global("str", ty.Of(s), ast::StorageClass::kPrivate); + auto* s = Structure("Data", utils::Vector{Member("mem", ty.f32())}); + GlobalVar("str", ty.Of(s), ast::StorageClass::kPrivate); auto* expr = MemberAccessor("str", "mem"); - WrapInFunction(Var("expr", ty.f32(), ast::StorageClass::kNone, expr)); + WrapInFunction(Var("expr", ty.f32(), expr)); GeneratorImpl& gen = SanitizeAndBuild(); @@ -160,13 +156,13 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_StorageBufferLoad, Test) { auto p = GetParam(); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("a", ty.i32()), Member("b", p.member_type(ty)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, MemberAccessor("data", "b"))), + SetupFunction(utils::Vector{ + Decl(Var("x", MemberAccessor("data", "b"))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -231,14 +227,13 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_StorageBufferStore, Test) { auto p = GetParam(); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("a", ty.i32()), Member("b", p.member_type(ty)), }); - SetupFunction({ - Decl(Var("value", p.member_type(ty), ast::StorageClass::kNone, - Construct(p.member_type(ty)))), + SetupFunction(utils::Vector{ + Decl(Var("value", p.member_type(ty), Construct(p.member_type(ty)))), Assign(MemberAccessor("data", "b"), Expr("value")), }); @@ -316,13 +311,13 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) { // var data : Data; // data.a = mat2x3(); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("a", ty.i32()), Member("b", ty.mat2x3()), }); - SetupFunction({ - Assign(MemberAccessor("data", "b"), Construct(ty.mat2x3(), ast::ExpressionList{})), + SetupFunction(utils::Vector{ + Assign(MemberAccessor("data", "b"), Construct(ty.mat2x3())), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -337,7 +332,7 @@ void tint_symbol(RWByteAddressBuffer buffer, uint offset, float2x3 value) { } void main() { - tint_symbol(data, 16u, float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); + tint_symbol(data, 16u, float2x3((0.0f).xxx, (0.0f).xxx)); return; } )"; @@ -352,14 +347,13 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_Matrix_Single_El // var data : Data; // data.a[2i][1i]; - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("z", ty.f32()), Member("a", ty.mat4x3()), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, - IndexAccessor(IndexAccessor(MemberAccessor("data", "a"), 2_i), 1_i))), + SetupFunction(utils::Vector{ + Decl(Var("x", IndexAccessor(IndexAccessor(MemberAccessor("data", "a"), 2_i), 1_i))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -384,14 +378,13 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, // var data : Data; // data.a[2]; - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("z", ty.f32()), Member("a", ty.array(4)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, - IndexAccessor(MemberAccessor("data", "a"), 2_i))), + SetupFunction(utils::Vector{ + Decl(Var("x", IndexAccessor(MemberAccessor("data", "a"), 2_i))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -416,14 +409,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, // var data : Data; // data.a[(2i + 4i) - 3i]; - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("z", ty.f32()), Member("a", ty.array(4)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, - IndexAccessor(MemberAccessor("data", "a"), Sub(Add(2_i, Expr(4_i)), Expr(3_i))))), + SetupFunction(utils::Vector{ + Decl(Var("a", Expr(2_i))), + Decl(Var("b", Expr(4_i))), + Decl(Var("c", Expr(3_i))), + Decl(Var("x", IndexAccessor(MemberAccessor("data", "a"), Sub(Add("a", "b"), "c")))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -433,7 +428,10 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, R"(RWByteAddressBuffer data : register(u0, space1); void main() { - int x = asint(data.Load((4u + (4u * uint(((2 + 4) - 3)))))); + int a = 2; + int b = 4; + int c = 3; + int x = asint(data.Load((4u + (4u * uint(((a + b) - c)))))); return; } )"; @@ -447,12 +445,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) { // var data : Data; // data.a[2] = 2; - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("z", ty.f32()), Member("a", ty.array(4)), }); - SetupFunction({ + SetupFunction(utils::Vector{ Assign(IndexAccessor(MemberAccessor("data", "a"), 2_i), 2_i), }); @@ -482,18 +480,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_MultiLevel) { // var data : Pre; // data.c[2].b - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, - MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"))), + SetupFunction(utils::Vector{ + Decl(Var("x", MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"))), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -522,17 +519,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_MultiLevel_Swizz // var data : Pre; // data.c[2].b.xy - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, + SetupFunction(utils::Vector{ + Decl(Var("x", MemberAccessor( MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "xy"))), }); @@ -564,17 +561,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, // var data : Pre; // data.c[2].b.g - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, + SetupFunction(utils::Vector{ + Decl(Var("x", MemberAccessor( MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "g"))), }); @@ -605,17 +602,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_MultiLevel_Index // var data : Pre; // data.c[2].b[1] - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ - Decl(Var("x", nullptr, ast::StorageClass::kNone, + SetupFunction(utils::Vector{ + Decl(Var("x", IndexAccessor(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), 1_i))), }); @@ -644,20 +641,20 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_MultiLevel) { // }; // // var data : Pre; - // data.c[2].b = vec3(1.f, 2.f, 3.f); + // data.c[2].b = vec3(1_f, 2_f, 3_f); - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ + SetupFunction(utils::Vector{ Assign(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), - vec3(1.f, 2.f, 3.f)), + vec3(1_f, 2_f, 3_f)), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -686,19 +683,19 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Swizzle_SingleL // var data : Pre; // data.c[2].b.y = 1.f; - auto* inner = Structure("Inner", { + auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.vec3()), Member("b", ty.vec3()), }); - SetupStorageBuffer({ + SetupStorageBuffer(utils::Vector{ Member("c", ty.array(ty.Of(inner), 4_u, 32)), }); - SetupFunction({ + SetupFunction(utils::Vector{ Assign(MemberAccessor(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "y"), - Expr(1.f)), + Expr(1_f)), }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -716,8 +713,7 @@ void main() { } TEST_F(HlslGeneratorImplTest_MemberAccessor, Swizzle_xyz) { - auto* var = - Var("my_vec", ty.vec4(), ast::StorageClass::kNone, vec4(1.f, 2.f, 3.f, 4.f)); + auto* var = Var("my_vec", ty.vec4(), vec4(1_f, 2_f, 3_f, 4_f)); auto* expr = MemberAccessor("my_vec", "xyz"); WrapInFunction(var, expr); @@ -727,8 +723,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, Swizzle_xyz) { } TEST_F(HlslGeneratorImplTest_MemberAccessor, Swizzle_gbr) { - auto* var = - Var("my_vec", ty.vec4(), ast::StorageClass::kNone, vec4(1.f, 2.f, 3.f, 4.f)); + auto* var = Var("my_vec", ty.vec4(), vec4(1_f, 2_f, 3_f, 4_f)); auto* expr = MemberAccessor("my_vec", "gbr"); WrapInFunction(var, expr); diff --git a/src/tint/writer/hlsl/generator_impl_module_constant_test.cc b/src/tint/writer/hlsl/generator_impl_module_constant_test.cc index 14e8e9368d..49cf831b46 100644 --- a/src/tint/writer/hlsl/generator_impl_module_constant_test.cc +++ b/src/tint/writer/hlsl/generator_impl_module_constant_test.cc @@ -15,30 +15,239 @@ #include "src/tint/ast/id_attribute.h" #include "src/tint/writer/hlsl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::hlsl { namespace { using HlslGeneratorImplTest_ModuleConstant = TestHelper; -TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_ModuleConstant) { - auto* var = Let("pos", ty.array(), array(1.f, 2.f, 3.f)); - WrapInFunction(Decl(var)); +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_AInt) { + auto* var = GlobalConst("G", Expr(1_a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error(); - EXPECT_EQ(gen.result(), "static const float pos[3] = {1.0f, 2.0f, 3.0f};\n"); + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const int l = 1; +} +)"); } -TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant) { - auto* var = Override("pos", ty.f32(), Expr(3.0f), - ast::AttributeList{ - Id(23), - }); +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_AFloat) { + auto* var = GlobalConst("G", Expr(1._a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error(); + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float l = 1.0f; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_i32) { + auto* var = GlobalConst("G", Expr(1_i)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const int l = 1; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_u32) { + auto* var = GlobalConst("G", Expr(1_u)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const uint l = 1u; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f32) { + auto* var = GlobalConst("G", Expr(1_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float l = 1.0f; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalConst("G", Expr(1_h)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float16_t l = float16_t(1.0h); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_AInt) { + auto* var = GlobalConst("G", Construct(ty.vec3(nullptr), 1_a, 2_a, 3_a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const int3 l = int3(1, 2, 3); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_AFloat) { + auto* var = GlobalConst("G", Construct(ty.vec3(nullptr), 1._a, 2._a, 3._a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float3 l = float3(1.0f, 2.0f, 3.0f); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f32) { + auto* var = GlobalConst("G", vec3(1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float3 l = float3(1.0f, 2.0f, 3.0f); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalConst("G", vec3(1_h, 2_h, 3_h)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const vector l = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_AFloat) { + auto* var = + GlobalConst("G", Construct(ty.mat(nullptr, 2, 3), 1._a, 2._a, 3._a, 4._a, 5._a, 6._a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float2x3 l = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f32) { + auto* var = GlobalConst("G", mat2x3(1_f, 2_f, 3_f, 4_f, 5_f, 6_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float2x3 l = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalConst("G", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const matrix l = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h))); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_arr_f32) { + auto* var = GlobalConst("G", Construct(ty.array(), 1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float l[3] = {1.0f, 2.0f, 3.0f}; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_arr_vec2_bool) { + auto* var = GlobalConst("G", Construct(ty.array(ty.vec2(), 3_u), // + vec2(true, false), // + vec2(false, true), // + vec2(true, true))); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const bool2 l[3] = {bool2(true, false), bool2(false, true), (true).xx}; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_Override) { + auto* var = Override("pos", ty.f32(), Expr(3_f), Id(23)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitOverride(var)) << gen.error(); EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_23 #define WGSL_SPEC_CONSTANT_23 3.0f #endif @@ -46,15 +255,12 @@ static const float pos = WGSL_SPEC_CONSTANT_23; )"); } -TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant_NoConstructor) { - auto* var = Override("pos", ty.f32(), nullptr, - ast::AttributeList{ - Id(23), - }); +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_Override_NoConstructor) { + auto* var = Override("pos", ty.f32(), Id(23)); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error(); + ASSERT_TRUE(gen.EmitOverride(var)) << gen.error(); EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_23 #error spec constant required for constant id 23 #endif @@ -62,17 +268,14 @@ static const float pos = WGSL_SPEC_CONSTANT_23; )"); } -TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant_NoId) { - auto* a = Override("a", ty.f32(), Expr(3.0f), - ast::AttributeList{ - Id(0), - }); - auto* b = Override("b", ty.f32(), Expr(2.0f)); +TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_Override_NoId) { + auto* a = Override("a", ty.f32(), Expr(3_f), Id(0)); + auto* b = Override("b", ty.f32(), Expr(2_f)); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(a)) << gen.error(); - ASSERT_TRUE(gen.EmitProgramConstVariable(b)) << gen.error(); + ASSERT_TRUE(gen.EmitOverride(a)) << gen.error(); + ASSERT_TRUE(gen.EmitOverride(b)) << gen.error(); EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_0 #define WGSL_SPEC_CONSTANT_0 3.0f #endif diff --git a/src/tint/writer/hlsl/generator_impl_return_test.cc b/src/tint/writer/hlsl/generator_impl_return_test.cc index 1813645206..91b4159b12 100644 --- a/src/tint/writer/hlsl/generator_impl_return_test.cc +++ b/src/tint/writer/hlsl/generator_impl_return_test.cc @@ -35,7 +35,7 @@ TEST_F(HlslGeneratorImplTest_Return, Emit_Return) { TEST_F(HlslGeneratorImplTest_Return, Emit_ReturnWithValue) { auto* r = Return(123_i); - Func("f", {}, ty.i32(), {r}); + Func("f", utils::Empty, ty.i32(), utils::Vector{r}); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/hlsl/generator_impl_sanitizer_test.cc b/src/tint/writer/hlsl/generator_impl_sanitizer_test.cc index b68c950fd0..62a236ed3a 100644 --- a/src/tint/writer/hlsl/generator_impl_sanitizer_test.cc +++ b/src/tint/writer/hlsl/generator_impl_sanitizer_test.cc @@ -25,19 +25,14 @@ namespace { using HlslSanitizerTest = TestHelper; TEST_F(HlslSanitizerTest, Call_ArrayLength) { - auto* s = Structure("my_struct", {Member(0, "a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array(4))}); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, - Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -60,22 +55,17 @@ void a_func() { } TEST_F(HlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) { - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member(0, "z", ty.f32()), Member(4, "a", ty.array(4)), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, - Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -99,23 +89,19 @@ void a_func() { } TEST_F(HlslSanitizerTest, Call_ArrayLength_ViaLets) { - auto* s = Structure("my_struct", {Member(0, "a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array(4))}); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - auto* p = Let("p", nullptr, AddressOf("b")); - auto* p2 = Let("p2", nullptr, AddressOf(MemberAccessor(Deref(p), "a"))); + auto* p = Let("p", AddressOf("b")); + auto* p2 = Let("p2", AddressOf(MemberAccessor(Deref(p), "a"))); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(p), Decl(p2), - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, Call("arrayLength", p2))), + Decl(Var("len", ty.u32(), Call("arrayLength", p2))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -139,25 +125,17 @@ void a_func() { } TEST_F(HlslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniform) { - auto* s = Structure("my_struct", {Member(0, "a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); - Global("c", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(2), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array(4))}); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); + GlobalVar("c", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(2), Group(2)); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("len", ty.u32(), Add(Call("arrayLength", AddressOf(MemberAccessor("b", "a"))), Call("arrayLength", AddressOf(MemberAccessor("c", "a")))))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -188,14 +166,13 @@ void a_func() { TEST_F(HlslSanitizerTest, PromoteArrayInitializerToConstVar) { auto* array_init = array(1_i, 2_i, 3_i, 4_i); - auto* array_index = IndexAccessor(array_init, 3_i); - auto* pos = Var("pos", ty.i32(), ast::StorageClass::kNone, array_index); - Func("main", ast::VariableList{}, ty.void_(), - { - Decl(pos), + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("idx", Expr(3_i))), + Decl(Var("pos", ty.i32(), IndexAccessor(array_init, "idx"))), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -205,8 +182,9 @@ TEST_F(HlslSanitizerTest, PromoteArrayInitializerToConstVar) { auto got = gen.result(); auto* expect = R"(void main() { + int idx = 3; const int tint_symbol[4] = {1, 2, 3, 4}; - int pos = tint_symbol[3]; + int pos = tint_symbol[idx]; return; } )"; @@ -214,20 +192,20 @@ TEST_F(HlslSanitizerTest, PromoteArrayInitializerToConstVar) { } TEST_F(HlslSanitizerTest, PromoteStructInitializerToConstVar) { - auto* str = Structure("S", { + auto* str = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.vec3()), Member("c", ty.i32()), }); - auto* struct_init = Construct(ty.Of(str), 1_i, vec3(2.f, 3.f, 4.f), 4_i); + auto* struct_init = Construct(ty.Of(str), 1_i, vec3(2_f, 3_f, 4_f), 4_i); auto* struct_access = MemberAccessor(struct_init, "b"); - auto* pos = Var("pos", ty.vec3(), ast::StorageClass::kNone, struct_access); + auto* pos = Var("pos", ty.vec3(), struct_access); - Func("main", ast::VariableList{}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(pos), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -257,15 +235,15 @@ TEST_F(HlslSanitizerTest, InlinePtrLetsBasic) { // let x : i32 = *p; auto* v = Var("v", ty.i32()); auto* p = Let("p", ty.pointer(ast::StorageClass::kFunction), AddressOf(v)); - auto* x = Var("x", ty.i32(), ast::StorageClass::kNone, Deref(p)); + auto* x = Var("x", ty.i32(), Deref(p)); - Func("main", ast::VariableList{}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(v), Decl(p), Decl(x), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -296,17 +274,17 @@ TEST_F(HlslSanitizerTest, InlinePtrLetsComplexChain) { AddressOf(IndexAccessor(Deref(ap), 3_i))); auto* vp = Let("vp", ty.pointer(ty.vec4(), ast::StorageClass::kFunction), AddressOf(IndexAccessor(Deref(mp), 2_i))); - auto* v = Var("v", ty.vec4(), ast::StorageClass::kNone, Deref(vp)); + auto* v = Var("v", ty.vec4(), Deref(vp)); - Func("main", ast::VariableList{}, ty.void_(), - { + Func("main", utils::Empty, ty.void_(), + utils::Vector{ Decl(a), Decl(ap), Decl(mp), Decl(vp), Decl(v), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); diff --git a/src/tint/writer/hlsl/generator_impl_static_assert_test.cc b/src/tint/writer/hlsl/generator_impl_static_assert_test.cc new file mode 100644 index 0000000000..8ae5dd8b00 --- /dev/null +++ b/src/tint/writer/hlsl/generator_impl_static_assert_test.cc @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/writer/hlsl/test_helper.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::writer::hlsl { +namespace { + +using HlslGeneratorImplTest = TestHelper; + +TEST_F(HlslGeneratorImplTest, Emit_GlobalStaticAssert) { + GlobalStaticAssert(true); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + // static asserts are not emitted + EXPECT_EQ(gen.result(), ""); +} + +TEST_F(HlslGeneratorImplTest, Emit_FunctionStaticAssert) { + Func("f", utils::Empty, ty.void_(), utils::Vector{StaticAssert(true)}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + // static asserts are not emitted + EXPECT_EQ(gen.result(), R"(void f() { +} +)"); +} + +} // namespace +} // namespace tint::writer::hlsl diff --git a/src/tint/writer/hlsl/generator_impl_switch_test.cc b/src/tint/writer/hlsl/generator_impl_switch_test.cc index 3ef1a7be88..7d89672118 100644 --- a/src/tint/writer/hlsl/generator_impl_switch_test.cc +++ b/src/tint/writer/hlsl/generator_impl_switch_test.cc @@ -22,7 +22,7 @@ namespace { using HlslGeneratorImplTest_Switch = TestHelper; TEST_F(HlslGeneratorImplTest_Switch, Emit_Switch) { - Global("cond", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.i32(), ast::StorageClass::kPrivate); auto* s = Switch( // Expr("cond"), // Case(Expr(5_i), Block(Break())), // @@ -46,8 +46,8 @@ TEST_F(HlslGeneratorImplTest_Switch, Emit_Switch) { } TEST_F(HlslGeneratorImplTest_Switch, Emit_Switch_OnlyDefaultCase) { - Global("cond", ty.i32(), ast::StorageClass::kPrivate); - Global("a", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); auto* s = Switch( // Expr("cond"), // DefaultCase(Block(Assign(Expr("a"), Expr(42_i))))); diff --git a/src/tint/writer/hlsl/generator_impl_test.cc b/src/tint/writer/hlsl/generator_impl_test.cc index 460b202694..35b9c82de7 100644 --- a/src/tint/writer/hlsl/generator_impl_test.cc +++ b/src/tint/writer/hlsl/generator_impl_test.cc @@ -19,8 +19,17 @@ namespace { using HlslGeneratorImplTest = TestHelper; +TEST_F(HlslGeneratorImplTest, InvalidProgram) { + Diagnostics().add_error(diag::System::Writer, "make the program invalid"); + ASSERT_FALSE(IsValid()); + auto program = std::make_unique(std::move(*this)); + ASSERT_FALSE(program->IsValid()); + auto result = Generate(program.get(), Options{}); + EXPECT_EQ(result.error, "input program is not valid"); +} + TEST_F(HlslGeneratorImplTest, Generate) { - Func("my_func", ast::VariableList{}, ty.void_(), ast::StatementList{}, ast::AttributeList{}); + Func("my_func", {}, ty.void_(), {}); GeneratorImpl& gen = Build(); @@ -31,7 +40,7 @@ TEST_F(HlslGeneratorImplTest, Generate) { } struct HlslBuiltinData { - ast::Builtin builtin; + ast::BuiltinValue builtin; const char* attribute_name; }; inline std::ostream& operator<<(std::ostream& out, HlslBuiltinData data) { @@ -48,17 +57,17 @@ TEST_P(HlslBuiltinConversionTest, Emit) { INSTANTIATE_TEST_SUITE_P( HlslGeneratorImplTest, HlslBuiltinConversionTest, - testing::Values(HlslBuiltinData{ast::Builtin::kPosition, "SV_Position"}, - HlslBuiltinData{ast::Builtin::kVertexIndex, "SV_VertexID"}, - HlslBuiltinData{ast::Builtin::kInstanceIndex, "SV_InstanceID"}, - HlslBuiltinData{ast::Builtin::kFrontFacing, "SV_IsFrontFace"}, - HlslBuiltinData{ast::Builtin::kFragDepth, "SV_Depth"}, - HlslBuiltinData{ast::Builtin::kLocalInvocationId, "SV_GroupThreadID"}, - HlslBuiltinData{ast::Builtin::kLocalInvocationIndex, "SV_GroupIndex"}, - HlslBuiltinData{ast::Builtin::kGlobalInvocationId, "SV_DispatchThreadID"}, - HlslBuiltinData{ast::Builtin::kWorkgroupId, "SV_GroupID"}, - HlslBuiltinData{ast::Builtin::kSampleIndex, "SV_SampleIndex"}, - HlslBuiltinData{ast::Builtin::kSampleMask, "SV_Coverage"})); + testing::Values(HlslBuiltinData{ast::BuiltinValue::kPosition, "SV_Position"}, + HlslBuiltinData{ast::BuiltinValue::kVertexIndex, "SV_VertexID"}, + HlslBuiltinData{ast::BuiltinValue::kInstanceIndex, "SV_InstanceID"}, + HlslBuiltinData{ast::BuiltinValue::kFrontFacing, "SV_IsFrontFace"}, + HlslBuiltinData{ast::BuiltinValue::kFragDepth, "SV_Depth"}, + HlslBuiltinData{ast::BuiltinValue::kLocalInvocationId, "SV_GroupThreadID"}, + HlslBuiltinData{ast::BuiltinValue::kLocalInvocationIndex, "SV_GroupIndex"}, + HlslBuiltinData{ast::BuiltinValue::kGlobalInvocationId, "SV_DispatchThreadID"}, + HlslBuiltinData{ast::BuiltinValue::kWorkgroupId, "SV_GroupID"}, + HlslBuiltinData{ast::BuiltinValue::kSampleIndex, "SV_SampleIndex"}, + HlslBuiltinData{ast::BuiltinValue::kSampleMask, "SV_Coverage"})); } // namespace } // namespace tint::writer::hlsl diff --git a/src/tint/writer/hlsl/generator_impl_type_test.cc b/src/tint/writer/hlsl/generator_impl_type_test.cc index b99f06eddc..e89c5008a6 100644 --- a/src/tint/writer/hlsl/generator_impl_type_test.cc +++ b/src/tint/writer/hlsl/generator_impl_type_test.cc @@ -33,7 +33,7 @@ using HlslGeneratorImplTest_Type = TestHelper; TEST_F(HlslGeneratorImplTest_Type, EmitType_Array) { auto* arr = ty.array(); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -46,7 +46,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Array) { TEST_F(HlslGeneratorImplTest_Type, EmitType_ArrayOfArray) { auto* arr = ty.array(ty.array(), 5_u); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -59,7 +59,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_ArrayOfArray) { TEST_F(HlslGeneratorImplTest_Type, EmitType_ArrayOfArrayOfArray) { auto* arr = ty.array(ty.array(ty.array(), 5_u), 6_u); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -72,7 +72,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_ArrayOfArrayOfArray) { TEST_F(HlslGeneratorImplTest_Type, EmitType_Array_WithoutName) { auto* arr = ty.array(); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -94,6 +94,17 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Bool) { EXPECT_EQ(out.str(), "bool"); } +TEST_F(HlslGeneratorImplTest_Type, EmitType_F16) { + auto* f16 = create(); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, f16, ast::StorageClass::kNone, ast::Access::kReadWrite, "")) + << gen.error(); + EXPECT_EQ(out.str(), "float16_t"); +} + TEST_F(HlslGeneratorImplTest_Type, EmitType_F32) { auto* f32 = create(); @@ -116,7 +127,20 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_I32) { EXPECT_EQ(out.str(), "int"); } -TEST_F(HlslGeneratorImplTest_Type, EmitType_Matrix) { +TEST_F(HlslGeneratorImplTest_Type, EmitType_Matrix_F16) { + auto* f16 = create(); + auto* vec3 = create(f16, 3u); + auto* mat2x3 = create(vec3, 2u); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, mat2x3, ast::StorageClass::kNone, ast::Access::kReadWrite, "")) + << gen.error(); + EXPECT_EQ(out.str(), "matrix"); +} + +TEST_F(HlslGeneratorImplTest_Type, EmitType_Matrix_F32) { auto* f32 = create(); auto* vec3 = create(f32, 3u); auto* mat2x3 = create(vec3, 2u); @@ -130,11 +154,11 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Matrix) { } TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -149,15 +173,12 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) { } TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl_OmittedIfStorageBuffer) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(0)); GeneratorImpl& gen = Build(); @@ -166,11 +187,11 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl_OmittedIfStorageBuffer) { } TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -182,11 +203,11 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct) { } TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct_NameCollision) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("double", ty.i32()), Member("float", ty.f32()), }); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); GeneratorImpl& gen = SanitizeAndBuild(); @@ -199,11 +220,11 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct_NameCollision) { } TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct_WithOffsetAttributes) { - auto* s = Structure("S", { - Member("a", ty.i32(), {MemberOffset(0)}), - Member("b", ty.f32(), {MemberOffset(8)}), + auto* s = Structure("S", utils::Vector{ + Member("a", ty.i32(), utils::Vector{MemberOffset(0)}), + Member("b", ty.f32(), utils::Vector{MemberOffset(8)}), }); - Global("g", ty.Of(s), ast::StorageClass::kPrivate); + GlobalVar("g", ty.Of(s), ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -287,14 +308,15 @@ TEST_P(HlslDepthTexturesTest, Emit) { auto* t = ty.depth_texture(params.dim); - Global("tex", t, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("tex", t, Binding(1), Group(2)); - Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("textureDimensions", "tex")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); GeneratorImpl& gen = Build(); @@ -317,14 +339,15 @@ using HlslDepthMultisampledTexturesTest = TestHelper; TEST_F(HlslDepthMultisampledTexturesTest, Emit) { auto* t = ty.depth_multisampled_texture(ast::TextureDimension::k2d); - Global("tex", t, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("tex", t, Binding(1), Group(2)); - Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("textureDimensions", "tex")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); GeneratorImpl& gen = Build(); @@ -360,14 +383,15 @@ TEST_P(HlslSampledTexturesTest, Emit) { } auto* t = ty.sampled_texture(params.dim, datatype); - Global("tex", t, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("tex", t, Binding(1), Group(2)); - Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("textureDimensions", "tex")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); GeneratorImpl& gen = Build(); @@ -495,10 +519,19 @@ TEST_P(HlslStorageTexturesTest, Emit) { auto* t = ty.storage_texture(params.dim, params.imgfmt, ast::Access::kWrite); - Global("tex", t, ast::AttributeList{GroupAndBinding(2, 1)}); + GlobalVar("tex", t, + utils::Vector{ + Group(2), + Binding(1), + }); - Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call("textureDimensions", "tex")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/hlsl/generator_impl_unary_op_test.cc b/src/tint/writer/hlsl/generator_impl_unary_op_test.cc index c9abf1f250..d3110614c9 100644 --- a/src/tint/writer/hlsl/generator_impl_unary_op_test.cc +++ b/src/tint/writer/hlsl/generator_impl_unary_op_test.cc @@ -20,7 +20,7 @@ namespace { using HlslUnaryOpTest = TestHelper; TEST_F(HlslUnaryOpTest, AddressOf) { - Global("expr", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.f32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kAddressOf, Expr("expr")); WrapInFunction(op); @@ -32,7 +32,7 @@ TEST_F(HlslUnaryOpTest, AddressOf) { } TEST_F(HlslUnaryOpTest, Complement) { - Global("expr", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.u32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kComplement, Expr("expr")); WrapInFunction(op); @@ -44,9 +44,8 @@ TEST_F(HlslUnaryOpTest, Complement) { } TEST_F(HlslUnaryOpTest, Indirection) { - Global("G", ty.f32(), ast::StorageClass::kPrivate); - auto* p = - Let("expr", nullptr, create(ast::UnaryOp::kAddressOf, Expr("G"))); + GlobalVar("G", ty.f32(), ast::StorageClass::kPrivate); + auto* p = Let("expr", create(ast::UnaryOp::kAddressOf, Expr("G"))); auto* op = create(ast::UnaryOp::kIndirection, Expr("expr")); WrapInFunction(p, op); @@ -58,7 +57,7 @@ TEST_F(HlslUnaryOpTest, Indirection) { } TEST_F(HlslUnaryOpTest, Not) { - Global("expr", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.bool_(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kNot, Expr("expr")); WrapInFunction(op); @@ -70,7 +69,7 @@ TEST_F(HlslUnaryOpTest, Not) { } TEST_F(HlslUnaryOpTest, Negation) { - Global("expr", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.i32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kNegation, Expr("expr")); WrapInFunction(op); diff --git a/src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc b/src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc index 580ad468bb..4e4643fbc0 100644 --- a/src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc +++ b/src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc @@ -16,6 +16,8 @@ #include "src/tint/ast/variable_decl_statement.h" #include "src/tint/writer/hlsl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::hlsl { namespace { @@ -36,7 +38,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement) { EXPECT_EQ(gen.result(), " float a = 0.0f;\n"); } -TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const) { +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Let) { auto* var = Let("a", ty.f32(), Construct(ty.f32())); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -49,6 +51,298 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const) { EXPECT_EQ(gen.result(), " const float a = 0.0f;\n"); } +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const) { + auto* var = Const("a", ty.f32(), Construct(ty.f32())); + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), ""); // Not a mistake - 'const' is inlined +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_AInt) { + auto* C = Const("C", Expr(1_a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const int l = 1; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_AFloat) { + auto* C = Const("C", Expr(1._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float l = 1.0f; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_i32) { + auto* C = Const("C", Expr(1_i)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const int l = 1; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_u32) { + auto* C = Const("C", Expr(1_u)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const uint l = 1u; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f32) { + auto* C = Const("C", Expr(1_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float l = 1.0f; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", Expr(1_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float16_t l = float16_t(1.0h); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_AInt) { + auto* C = Const("C", Construct(ty.vec3(nullptr), 1_a, 2_a, 3_a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const int3 l = int3(1, 2, 3); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_AFloat) { + auto* C = Const("C", Construct(ty.vec3(nullptr), 1._a, 2._a, 3._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float3 l = float3(1.0f, 2.0f, 3.0f); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f32) { + auto* C = Const("C", vec3(1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float3 l = float3(1.0f, 2.0f, 3.0f); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", vec3(1_h, 2_h, 3_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const vector l = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_AFloat) { + auto* C = Const("C", Construct(ty.mat(nullptr, 2, 3), 1._a, 2._a, 3._a, 4._a, 5._a, 6._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float2x3 l = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f32) { + auto* C = Const("C", mat2x3(1_f, 2_f, 3_f, 4_f, 5_f, 6_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float2x3 l = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const matrix l = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h))); +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_arr_f32) { + auto* C = Const("C", Construct(ty.array(), 1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const float l[3] = {1.0f, 2.0f, 3.0f}; +} +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_arr_vec2_bool) { + auto* C = Const("C", Construct(ty.array(ty.vec2(), 3_u), // + vec2(true, false), // + vec2(false, true), // + vec2(true, true))); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(void f() { + const bool2 l[3] = {bool2(true, false), bool2(false, true), (true).xx}; +} +)"); +} + TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Array) { auto* var = Var("a", ty.array()); @@ -63,7 +357,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Array) { } TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Private) { - Global("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); WrapInFunction(Expr("a")); @@ -75,21 +369,8 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Private) { EXPECT_THAT(gen.result(), HasSubstr(" static float a = 0.0f;\n")); } -TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_Private) { - Global("initializer", ty.f32(), ast::StorageClass::kPrivate); - Global("a", ty.f32(), ast::StorageClass::kPrivate, Expr("initializer")); - - WrapInFunction(Expr("a")); - - GeneratorImpl& gen = Build(); - - ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr(R"(float a = initializer; -)")); -} - -TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec) { - auto* var = Var("a", ty.vec3(), ast::StorageClass::kNone, vec3()); +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_F32) { + auto* var = Var("a", ty.vec3(), vec3()); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -97,12 +378,27 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); - EXPECT_EQ(gen.result(), R"(float3 a = float3(0.0f, 0.0f, 0.0f); + EXPECT_EQ(gen.result(), R"(float3 a = (0.0f).xxx; )"); } -TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat) { - auto* var = Var("a", ty.mat2x3(), ast::StorageClass::kNone, mat2x3()); +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_F16) { + Enable(ast::Extension::kF16); + + auto* var = Var("a", ty.vec3(), vec3()); + + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), R"(vector a = (float16_t(0.0h)).xxx; +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_F32) { + auto* var = Var("a", ty.mat2x3(), mat2x3()); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -111,7 +407,24 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); EXPECT_EQ(gen.result(), - R"(float2x3 a = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + R"(float2x3 a = float2x3((0.0f).xxx, (0.0f).xxx); +)"); +} + +TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_F16) { + Enable(ast::Extension::kF16); + + auto* var = Var("a", ty.mat2x3(), mat2x3()); + + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ( + gen.result(), + R"(matrix a = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); )"); } diff --git a/src/tint/writer/hlsl/generator_impl_workgroup_var_test.cc b/src/tint/writer/hlsl/generator_impl_workgroup_var_test.cc index 466c871b8e..9e8be017a5 100644 --- a/src/tint/writer/hlsl/generator_impl_workgroup_var_test.cc +++ b/src/tint/writer/hlsl/generator_impl_workgroup_var_test.cc @@ -27,10 +27,10 @@ namespace { using HlslGeneratorImplTest_WorkgroupVar = TestHelper; TEST_F(HlslGeneratorImplTest_WorkgroupVar, Basic) { - Global("wg", ty.f32(), ast::StorageClass::kWorkgroup); + GlobalVar("wg", ty.f32(), ast::StorageClass::kWorkgroup); - Func("main", {}, ty.void_(), {Assign("wg", 1.2f)}, - { + Func("main", utils::Empty, ty.void_(), utils::Vector{Assign("wg", 1.2_f)}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -43,10 +43,10 @@ TEST_F(HlslGeneratorImplTest_WorkgroupVar, Basic) { TEST_F(HlslGeneratorImplTest_WorkgroupVar, Aliased) { auto* alias = Alias("F32", ty.f32()); - Global("wg", ty.Of(alias), ast::StorageClass::kWorkgroup); + GlobalVar("wg", ty.Of(alias), ast::StorageClass::kWorkgroup); - Func("main", {}, ty.void_(), {Assign("wg", 1.2f)}, - { + Func("main", utils::Empty, ty.void_(), utils::Vector{Assign("wg", 1.2_f)}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); diff --git a/src/tint/writer/msl/generator.cc b/src/tint/writer/msl/generator.cc index 6d09a86c54..5cd9ac879d 100644 --- a/src/tint/writer/msl/generator.cc +++ b/src/tint/writer/msl/generator.cc @@ -31,6 +31,10 @@ Result::Result(const Result&) = default; Result Generate(const Program* program, const Options& options) { Result result; + if (!program->IsValid()) { + result.error = "input program is not valid"; + return result; + } // Sanitize the program. auto sanitized_result = Sanitize(program, options); diff --git a/src/tint/writer/msl/generator.h b/src/tint/writer/msl/generator.h index 43b0cb7417..d4208cc262 100644 --- a/src/tint/writer/msl/generator.h +++ b/src/tint/writer/msl/generator.h @@ -28,9 +28,6 @@ namespace tint { class Program; } // namespace tint -namespace tint::writer::msl { -class GeneratorImpl; -} // namespace tint::writer::msl namespace tint::writer::msl { diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc index 8665cdb851..76176786ff 100644 --- a/src/tint/writer/msl/generator_impl.cc +++ b/src/tint/writer/msl/generator_impl.cc @@ -36,8 +36,10 @@ #include "src/tint/sem/atomic.h" #include "src/tint/sem/bool.h" #include "src/tint/sem/call.h" +#include "src/tint/sem/constant.h" #include "src/tint/sem/depth_multisampled_texture.h" #include "src/tint/sem/depth_texture.h" +#include "src/tint/sem/f16.h" #include "src/tint/sem/f32.h" #include "src/tint/sem/function.h" #include "src/tint/sem/i32.h" @@ -59,17 +61,17 @@ #include "src/tint/transform/array_length_from_uniform.h" #include "src/tint/transform/builtin_polyfill.h" #include "src/tint/transform/canonicalize_entry_point_io.h" +#include "src/tint/transform/disable_uniformity_analysis.h" #include "src/tint/transform/expand_compound_assignment.h" #include "src/tint/transform/manager.h" #include "src/tint/transform/module_scope_var_to_entry_point_param.h" -#include "src/tint/transform/promote_initializers_to_const_var.h" +#include "src/tint/transform/promote_initializers_to_let.h" #include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/remove_phonies.h" #include "src/tint/transform/simplify_pointers.h" #include "src/tint/transform/unshadow.h" #include "src/tint/transform/unwind_discard_functions.h" #include "src/tint/transform/vectorize_scalar_matrix_constructors.h" -#include "src/tint/transform/wrap_arrays_in_structs.h" #include "src/tint/transform/zero_init_workgroup_memory.h" #include "src/tint/utils/defer.h" #include "src/tint/utils/map.h" @@ -84,6 +86,45 @@ bool last_is_break_or_fallthrough(const ast::BlockStatement* stmts) { return IsAnyOf(stmts->Last()); } +void PrintF32(std::ostream& out, float value) { + // Note: Currently inf and nan should not be constructable, but this is implemented for the day + // we support them. + if (std::isinf(value)) { + out << (value >= 0 ? "INFINITY" : "-INFINITY"); + } else if (std::isnan(value)) { + out << "NAN"; + } else { + out << FloatToString(value) << "f"; + } +} + +void PrintF16(std::ostream& out, float value) { + // Note: Currently inf and nan should not be constructable, but this is implemented for the day + // we support them. + if (std::isinf(value)) { + // HUGE_VALH evaluates to +infinity. + out << (value >= 0 ? "HUGE_VALH" : "-HUGE_VALH"); + } else if (std::isnan(value)) { + // There is no NaN expr for half in MSL, "NAN" is of float type. + out << "NAN"; + } else { + out << FloatToString(value) << "h"; + } +} + +void PrintI32(std::ostream& out, int32_t value) { + // MSL (and C++) parse `-2147483648` as a `long` because it parses unary minus and `2147483648` + // as separate tokens, and the latter doesn't fit into an (32-bit) `int`. + // WGSL, on the other hand, parses this as an `i32`. + // To avoid issues with `long` to `int` casts, emit `(-2147483647 - 1)` instead, which ensures + // the expression type is `int`. + if (auto int_min = std::numeric_limits::min(); value == int_min) { + out << "(" << int_min + 1 << " - 1)"; + } else { + out << value; + } +} + class ScopedBitCast { public: ScopedBitCast(GeneratorImpl* generator, @@ -121,8 +162,12 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { transform::Manager manager; transform::DataMap data; + manager.Add(); + { // Builtin polyfills transform::BuiltinPolyfill::Builtins polyfills; + polyfills.acosh = transform::BuiltinPolyfill::Level::kRangeCheck; + polyfills.atanh = transform::BuiltinPolyfill::Level::kRangeCheck; polyfills.extract_bits = transform::BuiltinPolyfill::Level::kClampParameters; polyfills.first_leading_bit = true; polyfills.first_trailing_bit = true; @@ -176,10 +221,9 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { manager.Add(); manager.Add(); manager.Add(); - manager.Add(); + manager.Add(); manager.Add(); - manager.Add(); manager.Add(); manager.Add(); // ArrayLengthFromUniform must come after SimplifyPointers, as @@ -224,16 +268,12 @@ bool GeneratorImpl::Generate() { [&](const ast::Alias*) { return true; // folded away by the writer }, - [&](const ast::Variable* var) { - if (var->is_const) { - TINT_DEFER(line()); - return EmitProgramConstVariable(var); - } - // These are pushed into the entry point by sanitizer transforms. - TINT_ICE(Writer, diagnostics_) - << "module-scope variables should have been handled by the MSL " - "sanitizer"; - return false; + [&](const ast::Const*) { + return true; // Constants are embedded at their use + }, + [&](const ast::Override* override) { + TINT_DEFER(line()); + return EmitOverride(override); }, [&](const ast::Function* func) { TINT_DEFER(line()); @@ -246,6 +286,9 @@ bool GeneratorImpl::Generate() { // Do nothing for enabling extension in MSL return true; }, + [&](const ast::StaticAssert*) { + return true; // Not emitted + }, [&](Default) { // These are pushed into the entry point by sanitizer transforms. TINT_ICE(Writer, diagnostics_) << "unhandled type: " << decl->TypeInfo().name; @@ -510,6 +553,22 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, const ast::BinaryExpression* e return true; } + // Handle '&' and '|' of booleans. + if ((expr->IsAnd() || expr->IsOr()) && lhs_type->Is()) { + out << "bool"; + ScopedParen sp(out); + if (!EmitExpression(out, expr->lhs)) { + return false; + } + if (!emit_op()) { + return false; + } + if (!EmitExpression(out, expr->rhs)) { + return false; + } + return true; + } + // Emit as usual ScopedParen sp(out); if (!EmitExpression(out, expr->lhs)) { @@ -531,7 +590,7 @@ bool GeneratorImpl::EmitBreak(const ast::BreakStatement*) { } bool GeneratorImpl::EmitCall(std::ostream& out, const ast::CallExpression* expr) { - auto* call = program_->Sem().Get(expr); + auto* call = program_->Sem().Get(expr); auto* target = call->Target(); return Switch( target, [&](const sem::Function* func) { return EmitFunctionCall(out, call, func); }, @@ -689,16 +748,36 @@ bool GeneratorImpl::EmitTypeConstructor(std::ostream& out, const sem::TypeConstructor* ctor) { auto* type = ctor->ReturnType(); - if (type->IsAnyOf()) { - out << "{"; - } else { - if (!EmitType(out, type, "")) { - return false; - } - out << "("; + const char* terminator = ")"; + TINT_DEFER(out << terminator); + + bool ok = Switch( + type, + [&](const sem::Array*) { + if (!EmitType(out, type, "")) { + return false; + } + out << "{"; + terminator = "}"; + return true; + }, + [&](const sem::Struct*) { + out << "{"; + terminator = "}"; + return true; + }, + [&](Default) { + if (!EmitType(out, type, "")) { + return false; + } + out << "("; + return true; + }); + if (!ok) { + return false; } - int i = 0; + size_t i = 0; for (auto* arg : call->Arguments()) { if (i > 0) { out << ", "; @@ -718,11 +797,6 @@ bool GeneratorImpl::EmitTypeConstructor(std::ostream& out, i++; } - if (type->IsAnyOf()) { - out << "}"; - } else { - out << ")"; - } return true; } @@ -733,7 +807,7 @@ bool GeneratorImpl::EmitAtomicCall(std::ostream& out, out << name; { ScopedParen sp(out); - for (size_t i = 0; i < expr->args.size(); i++) { + for (size_t i = 0; i < expr->args.Length(); i++) { auto* arg = expr->args[i]; if (i > 0) { out << ", "; @@ -783,37 +857,64 @@ bool GeneratorImpl::EmitAtomicCall(std::ostream& out, case sem::BuiltinType::kAtomicCompareExchangeWeak: { auto* ptr_ty = TypeOf(expr->args[0])->UnwrapRef()->As(); auto sc = ptr_ty->StorageClass(); + auto* str = builtin->ReturnType()->As(); - auto func = utils::GetOrCreate(atomicCompareExchangeWeak_, sc, [&]() -> std::string { - auto name = UniqueIdentifier("atomicCompareExchangeWeak"); - auto& buf = helpers_; - - line(&buf) << "template "; - { - auto f = line(&buf); - f << "vec " << name << "("; - if (!EmitStorageClass(f, sc)) { + auto func = utils::GetOrCreate( + atomicCompareExchangeWeak_, ACEWKeyType{{sc, str}}, [&]() -> std::string { + // Emit the builtin return type unique to this overload. This does not + // exist in the AST, so it will not be generated in Generate(). + if (!EmitStructTypeOnce(&helpers_, builtin->ReturnType()->As())) { return ""; } - f << " A* atomic, T compare, T value) {"; - } - buf.IncrementIndent(); - TINT_DEFER({ - buf.DecrementIndent(); - line(&buf) << "}"; - line(&buf); + auto name = UniqueIdentifier("atomicCompareExchangeWeak"); + auto& buf = helpers_; + auto* atomic_ty = builtin->Parameters()[0]->Type(); + auto* arg_ty = builtin->Parameters()[1]->Type(); + + { + auto f = line(&buf); + auto str_name = StructName(builtin->ReturnType()->As()); + f << str_name << " " << name << "("; + if (!EmitTypeAndName(f, atomic_ty, "atomic")) { + return ""; + } + f << ", "; + if (!EmitTypeAndName(f, arg_ty, "compare")) { + return ""; + } + f << ", "; + if (!EmitTypeAndName(f, arg_ty, "value")) { + return ""; + } + f << ") {"; + } + + buf.IncrementIndent(); + TINT_DEFER({ + buf.DecrementIndent(); + line(&buf) << "}"; + line(&buf); + }); + + { + auto f = line(&buf); + if (!EmitTypeAndName(f, arg_ty, "old_value")) { + return ""; + } + f << " = compare;"; + } + line(&buf) << "bool exchanged = " + "atomic_compare_exchange_weak_explicit(atomic, " + "&old_value, value, memory_order_relaxed, " + "memory_order_relaxed);"; + line(&buf) << "return {old_value, exchanged};"; + return name; }); - line(&buf) << "T prev_value = compare;"; - line(&buf) << "bool matched = " - "atomic_compare_exchange_weak_explicit(atomic, " - "&prev_value, value, memory_order_relaxed, " - "memory_order_relaxed);"; - line(&buf) << "return {prev_value, matched};"; - return name; - }); - + if (func.empty()) { + return false; + } return call(func, false); } @@ -837,7 +938,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, // Returns the argument with the given usage auto arg = [&](Usage usage) { int idx = signature.IndexOf(usage); - return (idx >= 0) ? arguments[idx] : nullptr; + return (idx >= 0) ? arguments[static_cast(idx)] : nullptr; }; auto* texture = arg(Usage::kTexture)->Declaration(); @@ -1024,8 +1125,9 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, } } - if (!EmitExpression(out, e->Declaration())) + if (!EmitExpression(out, e->Declaration())) { return false; + } if (casted) { out << ")"; @@ -1117,8 +1219,8 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, break; // Other texture dimensions don't have an offset } } - auto c = component->ConstantValue().Elements()[0].i32; - switch (c) { + auto c = component->ConstantValue()->As(); + switch (c.value) { case 0: out << "component::x"; break; @@ -1206,9 +1308,9 @@ bool GeneratorImpl::EmitModfCall(std::ostream& out, return false; } - line(b) << "float" << width << " whole;"; - line(b) << "float" << width << " fract = modf(" << in << ", whole);"; - line(b) << "return {fract, whole};"; + line(b) << StructName(builtin->ReturnType()->As()) << " result;"; + line(b) << "result.fract = modf(" << in << ", result.whole);"; + line(b) << "return result;"; return true; }); } @@ -1232,9 +1334,9 @@ bool GeneratorImpl::EmitFrexpCall(std::ostream& out, return false; } - line(b) << "int" << width << " exp;"; - line(b) << "float" << width << " sig = frexp(" << in << ", exp);"; - line(b) << "return {sig, exp};"; + line(b) << StructName(builtin->ReturnType()->As()) << " result;"; + line(b) << "result.sig = frexp(" << in << ", result.exp);"; + line(b) << "return result;"; return true; }); } @@ -1265,9 +1367,12 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) { std::string out = ""; switch (builtin->Type()) { case sem::BuiltinType::kAcos: + case sem::BuiltinType::kAcosh: case sem::BuiltinType::kAll: case sem::BuiltinType::kAny: case sem::BuiltinType::kAsin: + case sem::BuiltinType::kAsinh: + case sem::BuiltinType::kAtanh: case sem::BuiltinType::kAtan: case sem::BuiltinType::kAtan2: case sem::BuiltinType::kCeil: @@ -1379,7 +1484,6 @@ std::string GeneratorImpl::generate_builtin_name(const sem::Builtin* builtin) { out += "rint"; break; case sem::BuiltinType::kSmoothstep: - case sem::BuiltinType::kSmoothStep: out += "smoothstep"; break; case sem::BuiltinType::kInverseSqrt: @@ -1423,7 +1527,7 @@ bool GeneratorImpl::EmitCase(const ast::CaseStatement* stmt) { return false; } out << ":"; - if (selector == stmt->selectors.back()) { + if (selector == stmt->selectors.Back()) { out << " {"; } } @@ -1449,7 +1553,7 @@ bool GeneratorImpl::EmitCase(const ast::CaseStatement* stmt) { } bool GeneratorImpl::EmitContinue(const ast::ContinueStatement*) { - if (!emit_continuing_()) { + if (!emit_continuing_ || !emit_continuing_()) { return false; } @@ -1464,6 +1568,10 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) { out << "false"; return true; }, + [&](const sem::F16*) { + out << "0.0h"; + return true; + }, [&](const sem::F32*) { out << "0.0f"; return true; @@ -1483,14 +1591,12 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) { if (!EmitType(out, mat, "")) { return false; } - out << "("; - TINT_DEFER(out << ")"); + ScopedParen sp(out); return EmitZeroValue(out, mat->type()); }, - [&](const sem::Array* arr) { - out << "{"; - TINT_DEFER(out << "}"); - return EmitZeroValue(out, arr->ElemType()); + [&](const sem::Array*) { + out << "{}"; + return true; }, [&](const sem::Struct*) { out << "{}"; @@ -1504,6 +1610,122 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) { }); } +bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constant) { + return Switch( + constant->Type(), // + [&](const sem::Bool*) { + out << (constant->As() ? "true" : "false"); + return true; + }, + [&](const sem::F32*) { + PrintF32(out, constant->As()); + return true; + }, + [&](const sem::F16*) { + PrintF16(out, constant->As()); + return true; + }, + [&](const sem::I32*) { + PrintI32(out, constant->As()); + return true; + }, + [&](const sem::U32*) { + out << constant->As() << "u"; + return true; + }, + [&](const sem::Vector* v) { + if (!EmitType(out, v, "")) { + return false; + } + + ScopedParen sp(out); + + if (constant->AllEqual()) { + if (!EmitConstant(out, constant->Index(0))) { + return false; + } + return true; + } + + for (size_t i = 0; i < v->Width(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + return true; + }, + [&](const sem::Matrix* m) { + if (!EmitType(out, m, "")) { + return false; + } + + ScopedParen sp(out); + + for (size_t i = 0; i < m->columns(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + return true; + }, + [&](const sem::Array* a) { + if (!EmitType(out, a, "")) { + return false; + } + + out << "{"; + TINT_DEFER(out << "}"); + + if (constant->AllZero()) { + return true; + } + + for (size_t i = 0; i < a->Count(); i++) { + if (i > 0) { + out << ", "; + } + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + + return true; + }, + [&](const sem::Struct* s) { + out << program_->Symbols().NameFor(s->Name()) << "{"; + TINT_DEFER(out << "}"); + + if (constant->AllZero()) { + return true; + } + + auto& members = s->Members(); + for (size_t i = 0; i < members.size(); i++) { + if (i > 0) { + out << ", "; + } + out << "." << program_->Symbols().NameFor(members[i]->Name()) << "="; + if (!EmitConstant(out, constant->Index(i))) { + return false; + } + } + + return true; + }, + [&](Default) { + diagnostics_.add_error( + diag::System::Writer, + "unhandled constant type: " + builder_.FriendlyName(constant->Type())); + return false; + }); +} + bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* lit) { return Switch( lit, @@ -1512,12 +1734,10 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* return true; }, [&](const ast::FloatLiteralExpression* l) { - if (std::isinf(l->value)) { - out << (l->value >= 0 ? "INFINITY" : "-INFINITY"); - } else if (std::isnan(l->value)) { - out << "NAN"; + if (l->suffix == ast::FloatLiteralExpression::Suffix::kH) { + PrintF16(out, static_cast(l->value)); } else { - out << FloatToString(l->value) << "f"; + PrintF32(out, static_cast(l->value)); } return true; }, @@ -1525,18 +1745,7 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* switch (i->suffix) { case ast::IntLiteralExpression::Suffix::kNone: case ast::IntLiteralExpression::Suffix::kI: { - // MSL (and C++) parse `-2147483648` as a `long` because it parses - // unary minus and `2147483648` as separate tokens, and the latter - // doesn't fit into an (32-bit) `int`. WGSL, OTOH, parses this as an - // `i32`. To avoid issues with `long` to `int` casts, emit - // `(2147483647 - 1)` instead, which ensures the expression type is - // `int`. - const auto int_min = std::numeric_limits::min(); - if (i->value == int_min) { - out << "(" << int_min + 1 << " - 1)"; - } else { - out << i->value; - } + PrintI32(out, static_cast(i->value)); return true; } case ast::IntLiteralExpression::Suffix::kU: { @@ -1554,32 +1763,21 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* } bool GeneratorImpl::EmitExpression(std::ostream& out, const ast::Expression* expr) { + if (auto* sem = builder_.Sem().Get(expr)) { + if (auto* constant = sem->ConstantValue()) { + return EmitConstant(out, constant); + } + } return Switch( - expr, - [&](const ast::IndexAccessorExpression* a) { // - return EmitIndexAccessor(out, a); - }, - [&](const ast::BinaryExpression* b) { // - return EmitBinary(out, b); - }, - [&](const ast::BitcastExpression* b) { // - return EmitBitcast(out, b); - }, - [&](const ast::CallExpression* c) { // - return EmitCall(out, c); - }, - [&](const ast::IdentifierExpression* i) { // - return EmitIdentifier(out, i); - }, - [&](const ast::LiteralExpression* l) { // - return EmitLiteral(out, l); - }, - [&](const ast::MemberAccessorExpression* m) { // - return EmitMemberAccessor(out, m); - }, - [&](const ast::UnaryOpExpression* u) { // - return EmitUnaryOp(out, u); - }, + expr, // + [&](const ast::IndexAccessorExpression* a) { return EmitIndexAccessor(out, a); }, + [&](const ast::BinaryExpression* b) { return EmitBinary(out, b); }, + [&](const ast::BitcastExpression* b) { return EmitBitcast(out, b); }, + [&](const ast::CallExpression* c) { return EmitCall(out, c); }, + [&](const ast::IdentifierExpression* i) { return EmitIdentifier(out, i); }, + [&](const ast::LiteralExpression* l) { return EmitLiteral(out, l); }, + [&](const ast::MemberAccessorExpression* m) { return EmitMemberAccessor(out, m); }, + [&](const ast::UnaryOpExpression* u) { return EmitUnaryOp(out, u); }, [&](Default) { // diagnostics_.add_error(diag::System::Writer, "unknown expression type: " + std::string(expr->TypeInfo().name)); @@ -1627,8 +1825,8 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) { if (!EmitType(out, type, param_name)) { return false; } - // Parameter name is output as part of the type for arrays and pointers. - if (!type->Is() && !type->Is()) { + // Parameter name is output as part of the type for pointers. + if (!type->Is()) { out << " " << program_->Symbols().NameFor(v->symbol); } } @@ -1645,33 +1843,33 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) { return true; } -std::string GeneratorImpl::builtin_to_attribute(ast::Builtin builtin) const { +std::string GeneratorImpl::builtin_to_attribute(ast::BuiltinValue builtin) const { switch (builtin) { - case ast::Builtin::kPosition: + case ast::BuiltinValue::kPosition: return "position"; - case ast::Builtin::kVertexIndex: + case ast::BuiltinValue::kVertexIndex: return "vertex_id"; - case ast::Builtin::kInstanceIndex: + case ast::BuiltinValue::kInstanceIndex: return "instance_id"; - case ast::Builtin::kFrontFacing: + case ast::BuiltinValue::kFrontFacing: return "front_facing"; - case ast::Builtin::kFragDepth: + case ast::BuiltinValue::kFragDepth: return "depth(any)"; - case ast::Builtin::kLocalInvocationId: + case ast::BuiltinValue::kLocalInvocationId: return "thread_position_in_threadgroup"; - case ast::Builtin::kLocalInvocationIndex: + case ast::BuiltinValue::kLocalInvocationIndex: return "thread_index_in_threadgroup"; - case ast::Builtin::kGlobalInvocationId: + case ast::BuiltinValue::kGlobalInvocationId: return "thread_position_in_grid"; - case ast::Builtin::kWorkgroupId: + case ast::BuiltinValue::kWorkgroupId: return "threadgroup_position_in_grid"; - case ast::Builtin::kNumWorkgroups: + case ast::BuiltinValue::kNumWorkgroups: return "threadgroups_per_grid"; - case ast::Builtin::kSampleIndex: + case ast::BuiltinValue::kSampleIndex: return "sample_id"; - case ast::Builtin::kSampleMask: + case ast::BuiltinValue::kSampleMask: return "sample_mask"; - case ast::Builtin::kPointSize: + case ast::BuiltinValue::kPointSize: return "point_size"; default: break; @@ -1715,19 +1913,20 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { // Returns the binding index of a variable, requiring that the group // attribute have a value of zero. const uint32_t kInvalidBindingIndex = std::numeric_limits::max(); - auto get_binding_index = [&](const ast::Variable* var) -> uint32_t { - auto bp = var->BindingPoint(); - if (bp.group == nullptr || bp.binding == nullptr) { + auto get_binding_index = [&](const ast::Parameter* param) -> uint32_t { + if (!param->HasBindingPoint()) { TINT_ICE(Writer, diagnostics_) << "missing binding attributes for entry point parameter"; return kInvalidBindingIndex; } - if (bp.group->value != 0) { + auto* param_sem = program_->Sem().Get(param); + auto bp = param_sem->BindingPoint(); + if (bp.group != 0) { TINT_ICE(Writer, diagnostics_) << "encountered non-zero resource group index (use " "BindingRemapper to fix)"; return kInvalidBindingIndex; } - return bp.binding->value; + return bp.binding; }; { @@ -1739,46 +1938,46 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { // Emit entry point parameters. bool first = true; - for (auto* var : func->params) { + for (auto* param : func->params) { if (!first) { out << ", "; } first = false; - auto* type = program_->Sem().Get(var)->Type()->UnwrapRef(); + auto* type = program_->Sem().Get(param)->Type()->UnwrapRef(); - auto param_name = program_->Symbols().NameFor(var->symbol); + auto param_name = program_->Symbols().NameFor(param->symbol); if (!EmitType(out, type, param_name)) { return false; } - // Parameter name is output as part of the type for arrays and pointers. - if (!type->Is() && !type->Is()) { + // Parameter name is output as part of the type for pointers. + if (!type->Is()) { out << " " << param_name; } if (type->Is()) { out << " [[stage_in]]"; } else if (type->is_handle()) { - uint32_t binding = get_binding_index(var); + uint32_t binding = get_binding_index(param); if (binding == kInvalidBindingIndex) { return false; } - if (var->type->Is()) { + if (param->type->Is()) { out << " [[sampler(" << binding << ")]]"; - } else if (var->type->Is()) { + } else if (param->type->Is()) { out << " [[texture(" << binding << ")]]"; } else { TINT_ICE(Writer, diagnostics_) << "invalid handle type entry point parameter"; return false; } - } else if (auto* ptr = var->type->As()) { + } else if (auto* ptr = param->type->As()) { auto sc = ptr->storage_class; if (sc == ast::StorageClass::kWorkgroup) { auto& allocations = workgroup_allocations_[func_name]; out << " [[threadgroup(" << allocations.size() << ")]]"; allocations.push_back(program_->Sem().Get(ptr->type)->Size()); } else if (sc == ast::StorageClass::kStorage || sc == ast::StorageClass::kUniform) { - uint32_t binding = get_binding_index(var); + uint32_t binding = get_binding_index(param); if (binding == kInvalidBindingIndex) { return false; } @@ -1789,7 +1988,7 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { return false; } } else { - auto& attrs = var->attributes; + auto& attrs = param->attributes; bool builtin_found = false; for (auto* attr : attrs) { auto* builtin = attr->As(); @@ -1822,7 +2021,7 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { } if (!Is(func->body->Last())) { - ast::ReturnStatement ret(ProgramID{}, Source{}); + ast::ReturnStatement ret(ProgramID{}, ast::NodeID{}, Source{}); if (!EmitStatement(&ret)) { return false; } @@ -1973,6 +2172,56 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) { return true; } +bool GeneratorImpl::EmitWhile(const ast::WhileStatement* stmt) { + TextBuffer cond_pre; + std::stringstream cond_buf; + + { + auto* cond = stmt->condition; + TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre); + if (!EmitExpression(cond_buf, cond)) { + return false; + } + } + + auto emit_continuing = [&]() { return true; }; + TINT_SCOPED_ASSIGNMENT(emit_continuing_, emit_continuing); + + // If the while has a multi-statement conditional, then we cannot emit this + // as a regular while in MSL. Instead we need to generate a `while(true)` loop. + bool emit_as_loop = cond_pre.lines.size() > 0; + if (emit_as_loop) { + line() << "while (true) {"; + increment_indent(); + TINT_DEFER({ + decrement_indent(); + line() << "}"; + }); + + current_buffer_->Append(cond_pre); + line() << "if (!(" << cond_buf.str() << ")) { break; }"; + if (!EmitStatements(stmt->body->statements)) { + return false; + } + } else { + // While can be generated. + { + auto out = line(); + out << "while"; + { + ScopedParen sp(out); + out << cond_buf.str(); + } + out << " {"; + } + if (!EmitStatementsWithIndent(stmt->body->statements)) { + return false; + } + line() << "}"; + } + return true; +} + bool GeneratorImpl::EmitDiscard(const ast::DiscardStatement*) { // TODO(dsinclair): Verify this is correct when the discard semantics are // defined for WGSL (https://github.com/gpuweb/gpuweb/issues/361) @@ -2001,7 +2250,7 @@ bool GeneratorImpl::EmitIf(const ast::IfStatement* stmt) { return false; } } else { - if (!EmitStatementsWithIndent({stmt->else_statement})) { + if (!EmitStatementsWithIndent(utils::Vector{stmt->else_statement})) { return false; } } @@ -2037,7 +2286,7 @@ bool GeneratorImpl::EmitMemberAccessor(std::ostream& out, // For multi-element swizzles, we need to cast to a regular vector type // first. Note that we do not currently allow assignments to swizzles, so // the casting which will convert the l-value to r-value is fine. - if (swizzle->Indices().size() == 1) { + if (swizzle->Indices().Length() == 1) { if (!write_lhs()) { return false; } @@ -2129,6 +2378,9 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { [&](const ast::ForLoopStatement* l) { // return EmitForLoop(l); }, + [&](const ast::WhileStatement* l) { // + return EmitWhile(l); + }, [&](const ast::ReturnStatement* r) { // return EmitReturn(r); }, @@ -2136,8 +2388,21 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { return EmitSwitch(s); }, [&](const ast::VariableDeclStatement* v) { // - auto* var = program_->Sem().Get(v->variable); - return EmitVariable(var); + return Switch( + v->variable, // + [&](const ast::Var* var) { return EmitVar(var); }, + [&](const ast::Let* let) { return EmitLet(let); }, + [&](const ast::Const*) { + return true; // Constants are embedded at their use + }, + [&](Default) { // + TINT_ICE(Writer, diagnostics_) + << "unknown statement type: " << stmt->TypeInfo().name; + return false; + }); + }, + [&](const ast::StaticAssert*) { + return true; // Not emitted }, [&](Default) { diagnostics_.add_error(diag::System::Writer, @@ -2146,7 +2411,7 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { }); } -bool GeneratorImpl::EmitStatements(const ast::StatementList& stmts) { +bool GeneratorImpl::EmitStatements(utils::VectorRef stmts) { for (auto* s : stmts) { if (!EmitStatement(s)) { return false; @@ -2155,7 +2420,7 @@ bool GeneratorImpl::EmitStatements(const ast::StatementList& stmts) { return true; } -bool GeneratorImpl::EmitStatementsWithIndent(const ast::StatementList& stmts) { +bool GeneratorImpl::EmitStatementsWithIndent(utils::VectorRef stmts) { ScopedIndent si(this); return EmitStatements(stmts); } @@ -2207,35 +2472,22 @@ bool GeneratorImpl::EmitType(std::ostream& out, << "unhandled atomic type " << atomic->Type()->FriendlyName(builder_.Symbols()); return false; }, - [&](const sem::Array* ary) { - const sem::Type* base_type = ary; - std::vector sizes; - while (auto* arr = base_type->As()) { - if (arr->IsRuntimeSized()) { - sizes.push_back(1); - } else { - sizes.push_back(arr->Count()); - } - base_type = arr->ElemType(); - } - if (!EmitType(out, base_type, "")) { + [&](const sem::Array* arr) { + out << ArrayType() << "<"; + if (!EmitType(out, arr->ElemType(), "")) { return false; } - if (!name.empty()) { - out << " " << name; - if (name_printed) { - *name_printed = true; - } - } - for (uint32_t size : sizes) { - out << "[" << size << "]"; - } + out << ", " << (arr->IsRuntimeSized() ? 1u : arr->Count()) << ">"; return true; }, [&](const sem::Bool*) { out << "bool"; return true; }, + [&](const sem::F16*) { + out << "half"; + return true; + }, [&](const sem::F32*) { out << "float"; return true; @@ -2259,22 +2511,12 @@ bool GeneratorImpl::EmitType(std::ostream& out, return false; } out << " "; - if (ptr->StoreType()->Is()) { - std::string inner = "(*" + name + ")"; - if (!EmitType(out, ptr->StoreType(), inner)) { - return false; - } - if (name_printed) { - *name_printed = true; - } - } else { - if (!EmitType(out, ptr->StoreType(), "")) { - return false; - } - out << "* " << name; - if (name_printed) { - *name_printed = true; - } + if (!EmitType(out, ptr->StoreType(), "")) { + return false; + } + out << "* " << name; + if (name_printed) { + *name_printed = true; } return true; }, @@ -2490,7 +2732,7 @@ bool GeneratorImpl::EmitStructType(TextBuffer* b, const sem::Struct* str) { auto out = line(b); add_byte_offset_comment(out, msl_offset); - out << "int8_t " << name << "[" << size << "];"; + out << ArrayType() << " " << name << ";"; }; b->IncrementIndent(); @@ -2528,11 +2770,7 @@ bool GeneratorImpl::EmitStructType(TextBuffer* b, const sem::Struct* str) { auto* ty = mem->Type(); - // Array member name will be output with the type - if (!ty->Is()) { - out << " " << mem_name; - } - + out << " " << mem_name; // Emit attributes if (auto* decl = mem->Declaration()) { for (auto* attr : decl->attributes) { @@ -2628,6 +2866,14 @@ bool GeneratorImpl::EmitStructType(TextBuffer* b, const sem::Struct* str) { return true; } +bool GeneratorImpl::EmitStructTypeOnce(TextBuffer* buffer, const sem::Struct* str) { + auto it = emitted_structs_.emplace(str); + if (!it.second) { + return true; + } + return EmitStructType(buffer, str); +} + bool GeneratorImpl::EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression* expr) { // Handle `-e` when `e` is signed, so that we ensure that if `e` is the // largest negative value, it returns `e`. @@ -2701,19 +2947,13 @@ bool GeneratorImpl::EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression* return true; } -bool GeneratorImpl::EmitVariable(const sem::Variable* var) { - auto* decl = var->Declaration(); - - for (auto* attr : decl->attributes) { - if (!attr->Is()) { - TINT_ICE(Writer, diagnostics_) << "unexpected variable attribute"; - return false; - } - } +bool GeneratorImpl::EmitVar(const ast::Var* var) { + auto* sem = program_->Sem().Get(var); + auto* type = sem->Type()->UnwrapRef(); auto out = line(); - switch (var->StorageClass()) { + switch (sem->StorageClass()) { case ast::StorageClass::kFunction: case ast::StorageClass::kHandle: case ast::StorageClass::kNone: @@ -2729,28 +2969,23 @@ bool GeneratorImpl::EmitVariable(const sem::Variable* var) { return false; } - auto* type = var->Type()->UnwrapRef(); - - std::string name = program_->Symbols().NameFor(decl->symbol); - if (decl->is_const) { - name = "const " + name; - } + std::string name = program_->Symbols().NameFor(var->symbol); if (!EmitType(out, type, name)) { return false; } - // Variable name is output as part of the type for arrays and pointers. - if (!type->Is() && !type->Is()) { + // Variable name is output as part of the type for pointers. + if (!type->Is()) { out << " " << name; } - if (decl->constructor != nullptr) { + if (var->constructor != nullptr) { out << " = "; - if (!EmitExpression(out, decl->constructor)) { + if (!EmitExpression(out, var->constructor)) { return false; } - } else if (var->StorageClass() == ast::StorageClass::kPrivate || - var->StorageClass() == ast::StorageClass::kFunction || - var->StorageClass() == ast::StorageClass::kNone) { + } else if (sem->StorageClass() == ast::StorageClass::kPrivate || + sem->StorageClass() == ast::StorageClass::kFunction || + sem->StorageClass() == ast::StorageClass::kNone) { out << " = "; if (!EmitZeroValue(out, type)) { return false; @@ -2761,38 +2996,59 @@ bool GeneratorImpl::EmitVariable(const sem::Variable* var) { return true; } -bool GeneratorImpl::EmitProgramConstVariable(const ast::Variable* var) { - for (auto* d : var->attributes) { - if (!d->Is()) { - diagnostics_.add_error(diag::System::Writer, "Decorated const values not valid"); +bool GeneratorImpl::EmitLet(const ast::Let* let) { + auto* sem = program_->Sem().Get(let); + auto* type = sem->Type(); + + auto out = line(); + + switch (sem->StorageClass()) { + case ast::StorageClass::kFunction: + case ast::StorageClass::kHandle: + case ast::StorageClass::kNone: + break; + case ast::StorageClass::kPrivate: + out << "thread "; + break; + case ast::StorageClass::kWorkgroup: + out << "threadgroup "; + break; + default: + TINT_ICE(Writer, diagnostics_) << "unhandled variable storage class"; return false; - } } - if (!var->is_const) { - diagnostics_.add_error(diag::System::Writer, "Expected a const value"); + + std::string name = "const " + program_->Symbols().NameFor(let->symbol); + if (!EmitType(out, type, name)) { return false; } + // Variable name is output as part of the type for pointers. + if (!type->Is()) { + out << " " << name; + } + + out << " = "; + if (!EmitExpression(out, let->constructor)) { + return false; + } + out << ";"; + + return true; +} + +bool GeneratorImpl::EmitOverride(const ast::Override* override) { + auto* global = program_->Sem().Get(override); + auto* type = global->Type(); + auto out = line(); out << "constant "; - auto* type = program_->Sem().Get(var)->Type()->UnwrapRef(); - if (!EmitType(out, type, program_->Symbols().NameFor(var->symbol))) { + if (!EmitType(out, type, program_->Symbols().NameFor(override->symbol))) { return false; } - if (!type->Is()) { - out << " " << program_->Symbols().NameFor(var->symbol); - } + out << " " << program_->Symbols().NameFor(override->symbol); - auto* global = program_->Sem().Get(var); - if (global && global->IsOverridable()) { - out << " [[function_constant(" << global->ConstantId() << ")]]"; - } else if (var->constructor != nullptr) { - out << " = "; - if (!EmitExpression(out, var->constructor)) { - return false; - } - } - out << ";"; + out << " [[function_constant(" << global->OverrideId().value << ")]];"; return true; } @@ -2812,20 +3068,25 @@ GeneratorImpl::SizeAndAlign GeneratorImpl::MslPackedTypeSizeAndAlign(const sem:: [&](const sem::F32*) { return SizeAndAlign{4, 4}; }, + [&](const sem::F16*) { + return SizeAndAlign{2, 2}; + }, [&](const sem::Vector* vec) { auto num_els = vec->Width(); auto* el_ty = vec->type(); - if (el_ty->IsAnyOf()) { + SizeAndAlign el_size_align = MslPackedTypeSizeAndAlign(el_ty); + if (el_ty->IsAnyOf()) { // Use a packed_vec type for 3-element vectors only. if (num_els == 3) { // https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf // 2.2.3 Packed Vector Types - return SizeAndAlign{num_els * 4, 4}; + return SizeAndAlign{num_els * el_size_align.size, el_size_align.align}; } else { // https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf // 2.2 Vector Data Types - return SizeAndAlign{num_els * 4, num_els * 4}; + // Vector data types are aligned to their size. + return SizeAndAlign{num_els * el_size_align.size, num_els * el_size_align.size}; } } TINT_UNREACHABLE(Writer, diagnostics_) @@ -2839,8 +3100,9 @@ GeneratorImpl::SizeAndAlign GeneratorImpl::MslPackedTypeSizeAndAlign(const sem:: auto cols = mat->columns(); auto rows = mat->rows(); auto* el_ty = mat->type(); - if (el_ty->IsAnyOf()) { - static constexpr SizeAndAlign table[] = { + // Metal only support half and float matrix. + if (el_ty->IsAnyOf()) { + static constexpr SizeAndAlign table_f32[] = { /* float2x2 */ {16, 8}, /* float2x3 */ {32, 16}, /* float2x4 */ {32, 16}, @@ -2851,8 +3113,23 @@ GeneratorImpl::SizeAndAlign GeneratorImpl::MslPackedTypeSizeAndAlign(const sem:: /* float4x3 */ {64, 16}, /* float4x4 */ {64, 16}, }; + static constexpr SizeAndAlign table_f16[] = { + /* half2x2 */ {8, 4}, + /* half2x3 */ {16, 8}, + /* half2x4 */ {16, 8}, + /* half3x2 */ {12, 4}, + /* half3x3 */ {24, 8}, + /* half3x4 */ {24, 8}, + /* half4x2 */ {16, 4}, + /* half4x3 */ {32, 8}, + /* half4x4 */ {32, 8}, + }; if (cols >= 2 && cols <= 4 && rows >= 2 && rows <= 4) { - return table[(3 * (cols - 2)) + (rows - 2)]; + if (el_ty->Is()) { + return table_f32[(3 * (cols - 2)) + (rows - 2)]; + } else { + return table_f16[(3 * (cols - 2)) + (rows - 2)]; + } } } @@ -2863,8 +3140,8 @@ GeneratorImpl::SizeAndAlign GeneratorImpl::MslPackedTypeSizeAndAlign(const sem:: [&](const sem::Array* arr) { if (!arr->IsStrideImplicit()) { - TINT_ICE(Writer, diagnostics_) << "arrays with explicit strides not " - "exist past the SPIR-V reader"; + TINT_ICE(Writer, diagnostics_) + << "arrays with explicit strides should not exist past the SPIR-V reader"; return SizeAndAlign{}; } auto num_els = std::max(arr->Count(), 1); @@ -2951,4 +3228,25 @@ bool GeneratorImpl::CallBuiltinHelper(std::ostream& out, return true; } +const std::string& GeneratorImpl::ArrayType() { + if (array_template_name_.empty()) { + array_template_name_ = UniqueIdentifier("tint_array"); + auto* buf = &helpers_; + line(buf) << "template"; + line(buf) << "struct " << array_template_name_ << " {"; + line(buf) << " const constant T& operator[](size_t i) const constant" + << " { return elements[i]; }"; + for (auto* space : {"device", "thread", "threadgroup"}) { + line(buf) << " " << space << " T& operator[](size_t i) " << space + << " { return elements[i]; }"; + line(buf) << " const " << space << " T& operator[](size_t i) const " << space + << " { return elements[i]; }"; + } + line(buf) << " T elements[N];"; + line(buf) << "};"; + line(buf); + } + return array_template_name_; +} + } // namespace tint::writer::msl diff --git a/src/tint/writer/msl/generator_impl.h b/src/tint/writer/msl/generator_impl.h index b7a202983e..72ee42c376 100644 --- a/src/tint/writer/msl/generator_impl.h +++ b/src/tint/writer/msl/generator_impl.h @@ -16,6 +16,7 @@ #define SRC_TINT_WRITER_MSL_GENERATOR_IMPL_H_ #include +#include #include #include #include @@ -45,6 +46,7 @@ // Forward declarations namespace tint::sem { class Call; +class Constant; class Builtin; class TypeConstructor; class TypeConversion; @@ -250,6 +252,11 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement to emit /// @returns true if the statement was successfully emitted bool EmitIf(const ast::IfStatement* stmt); + /// Handles a constant value + /// @param out the output stream + /// @param constant the constant value to emit + /// @returns true if the constant value was successfully emitted + bool EmitConstant(std::ostream& out, const sem::Constant* constant); /// Handles a literal /// @param out the output of the expression stream /// @param lit the literal to emit @@ -263,6 +270,10 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement to emit /// @returns true if the statement was emitted bool EmitForLoop(const ast::ForLoopStatement* stmt); + /// Handles a while statement + /// @param stmt the statement to emit + /// @returns true if the statement was emitted + bool EmitWhile(const ast::WhileStatement* stmt); /// Handles a member accessor expression /// @param out the output of the expression stream /// @param expr the member accessor expression @@ -283,11 +294,11 @@ class GeneratorImpl : public TextGenerator { /// Emits a list of statements /// @param stmts the statement list /// @returns true if the statements were emitted successfully - bool EmitStatements(const ast::StatementList& stmts); + bool EmitStatements(utils::VectorRef stmts); /// Emits a list of statements with an indentation /// @param stmts the statement list /// @returns true if the statements were emitted successfully - bool EmitStatementsWithIndent(const ast::StatementList& stmts); + bool EmitStatementsWithIndent(utils::VectorRef stmts); /// Handles generating a switch statement /// @param stmt the statement to emit /// @returns true if the statement was emitted @@ -326,19 +337,29 @@ class GeneratorImpl : public TextGenerator { /// @param str the struct to generate /// @returns true if the struct is emitted bool EmitStructType(TextBuffer* buffer, const sem::Struct* str); + /// Handles generating a structure declaration only the first time called. Subsequent calls are + /// a no-op and return true. + /// @param buffer the text buffer that the type declaration will be written to + /// @param ty the struct to generate + /// @returns true if the struct is emitted + bool EmitStructTypeOnce(TextBuffer* buffer, const sem::Struct* ty); /// Handles a unary op expression /// @param out the output of the expression stream /// @param expr the expression to emit /// @returns true if the expression was emitted bool EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression* expr); - /// Handles generating a variable + /// Handles generating a 'var' declaration /// @param var the variable to generate /// @returns true if the variable was emitted - bool EmitVariable(const sem::Variable* var); - /// Handles generating a program scope constant variable - /// @param var the variable to emit + bool EmitVar(const ast::Var* var); + /// Handles generating a function-scope 'let' declaration + /// @param let the variable to generate /// @returns true if the variable was emitted - bool EmitProgramConstVariable(const ast::Variable* var); + bool EmitLet(const ast::Let* let); + /// Handles generating a module-scope 'override' declaration + /// @param override the 'override' to emit + /// @returns true if the variable was emitted + bool EmitOverride(const ast::Override* override); /// Emits the zero value for the given type /// @param out the output of the expression stream /// @param type the type to emit the value for @@ -353,7 +374,7 @@ class GeneratorImpl : public TextGenerator { /// Converts a builtin to an attribute name /// @param builtin the builtin to convert /// @returns the string name of the builtin or blank on error - std::string builtin_to_attribute(ast::Builtin builtin) const; + std::string builtin_to_attribute(ast::BuiltinValue builtin) const; /// Converts interpolation attributes to an MSL attribute /// @param type the interpolation type @@ -388,27 +409,35 @@ class GeneratorImpl : public TextGenerator { const sem::Builtin* builtin, F&& build); + /// @returns the name of the templated tint_array helper type, generating it if this is the + /// first call. + const std::string& ArrayType(); + TextBuffer helpers_; // Helper functions emitted at the top of the output /// @returns the MSL packed type size and alignment in bytes for the given /// type. SizeAndAlign MslPackedTypeSizeAndAlign(const sem::Type* ty); - using StorageClassToString = std::unordered_map; - std::function emit_continuing_; /// Name of atomicCompareExchangeWeak() helper for the given pointer storage - /// class. - StorageClassToString atomicCompareExchangeWeak_; + /// class and struct return type + using ACEWKeyType = + utils::UnorderedKeyWrapper>; + std::unordered_map atomicCompareExchangeWeak_; - /// Unique name of the 'TINT_INVARIANT' preprocessor define. Non-empty only if - /// an invariant attribute has been generated. + /// Unique name of the 'TINT_INVARIANT' preprocessor define. + /// Non-empty only if an invariant attribute has been generated. std::string invariant_define_name_; /// True if matrix-packed_vector operator overloads have been generated. bool matrix_packed_vector_overloads_ = false; + /// Unique name of the tint_array template. + /// Non-empty only if the template has been generated. + std::string array_template_name_; + /// A map from entry point name to a list of dynamic workgroup allocations. /// Each entry in the vector is the size of the workgroup allocation that /// should be created for that index. @@ -417,6 +446,7 @@ class GeneratorImpl : public TextGenerator { std::unordered_map builtins_; std::unordered_map unary_minus_funcs_; std::unordered_map int_dot_funcs_; + std::unordered_set emitted_structs_; }; } // namespace tint::writer::msl diff --git a/src/tint/writer/msl/generator_impl_array_accessor_test.cc b/src/tint/writer/msl/generator_impl_array_accessor_test.cc index 7475b6768a..e058ff5ce1 100644 --- a/src/tint/writer/msl/generator_impl_array_accessor_test.cc +++ b/src/tint/writer/msl/generator_impl_array_accessor_test.cc @@ -34,9 +34,9 @@ TEST_F(MslGeneratorImplTest, IndexAccessor) { } TEST_F(MslGeneratorImplTest, IndexAccessor_OfDref) { - Global("ary", ty.array(), ast::StorageClass::kPrivate); + GlobalVar("ary", ty.array(), ast::StorageClass::kPrivate); - auto* p = Let("p", nullptr, AddressOf("ary")); + auto* p = Let("p", AddressOf("ary")); auto* expr = IndexAccessor(Deref("p"), 5_i); WrapInFunction(p, expr); diff --git a/src/tint/writer/msl/generator_impl_binary_test.cc b/src/tint/writer/msl/generator_impl_binary_test.cc index 5262b97eec..e08c420c6b 100644 --- a/src/tint/writer/msl/generator_impl_binary_test.cc +++ b/src/tint/writer/msl/generator_impl_binary_test.cc @@ -158,6 +158,21 @@ TEST_F(MslBinaryTest, ModF32) { EXPECT_EQ(out.str(), "fmod(left, right)"); } +TEST_F(MslBinaryTest, ModF16) { + Enable(ast::Extension::kF16); + + auto* left = Var("left", ty.f16()); + auto* right = Var("right", ty.f16()); + auto* expr = create(ast::BinaryOp::kModulo, Expr(left), Expr(right)); + WrapInFunction(left, right, expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "fmod(left, right)"); +} + TEST_F(MslBinaryTest, ModVec3F32) { auto* left = Var("left", ty.vec3()); auto* right = Var("right", ty.vec3()); @@ -171,5 +186,46 @@ TEST_F(MslBinaryTest, ModVec3F32) { EXPECT_EQ(out.str(), "fmod(left, right)"); } +TEST_F(MslBinaryTest, ModVec3F16) { + Enable(ast::Extension::kF16); + + auto* left = Var("left", ty.vec3()); + auto* right = Var("right", ty.vec3()); + auto* expr = create(ast::BinaryOp::kModulo, Expr(left), Expr(right)); + WrapInFunction(left, right, expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "fmod(left, right)"); +} + +TEST_F(MslBinaryTest, BoolAnd) { + auto* left = Var("left", Expr(true)); + auto* right = Var("right", Expr(false)); + auto* expr = create(ast::BinaryOp::kAnd, Expr(left), Expr(right)); + WrapInFunction(left, right, expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "bool(left & right)"); +} + +TEST_F(MslBinaryTest, BoolOr) { + auto* left = Var("left", Expr(true)); + auto* right = Var("right", Expr(false)); + auto* expr = create(ast::BinaryOp::kOr, Expr(left), Expr(right)); + WrapInFunction(left, right, expr); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); + EXPECT_EQ(out.str(), "bool(left | right)"); +} + } // namespace } // namespace tint::writer::msl diff --git a/src/tint/writer/msl/generator_impl_builtin_test.cc b/src/tint/writer/msl/generator_impl_builtin_test.cc index 752fc73eec..9f75691237 100644 --- a/src/tint/writer/msl/generator_impl_builtin_test.cc +++ b/src/tint/writer/msl/generator_impl_builtin_test.cc @@ -25,36 +25,40 @@ using BuiltinType = sem::BuiltinType; using MslGeneratorImplTest = TestHelper; -enum class ParamType { +enum class CallParamType { kF32, kU32, kBool, + kF16, }; struct BuiltinData { BuiltinType builtin; - ParamType type; + CallParamType type; const char* msl_name; }; inline std::ostream& operator<<(std::ostream& out, BuiltinData data) { out << data.msl_name << "<"; switch (data.type) { - case ParamType::kF32: + case CallParamType::kF32: out << "f32"; break; - case ParamType::kU32: + case CallParamType::kU32: out << "u32"; break; - case ParamType::kBool: + case CallParamType::kBool: out << "bool"; break; + case CallParamType::kF16: + out << "f16"; + break; } out << ">"; return out; } const ast::CallExpression* GenerateCall(BuiltinType builtin, - ParamType type, + CallParamType type, ProgramBuilder* builder) { std::string name; std::ostringstream str(name); @@ -92,32 +96,53 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin, case BuiltinType::kTanh: case BuiltinType::kTrunc: case BuiltinType::kSign: - return builder->Call(str.str(), "f2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2"); + } else { + return builder->Call(str.str(), "f2"); + } case BuiltinType::kLdexp: - return builder->Call(str.str(), "f2", "i2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "i2"); + } else { + return builder->Call(str.str(), "f2", "i2"); + } case BuiltinType::kAtan2: case BuiltinType::kDot: case BuiltinType::kDistance: case BuiltinType::kPow: case BuiltinType::kReflect: case BuiltinType::kStep: - return builder->Call(str.str(), "f2", "f2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2"); + } else { + return builder->Call(str.str(), "f2", "f2"); + } case BuiltinType::kStorageBarrier: return builder->Call(str.str()); case BuiltinType::kCross: - return builder->Call(str.str(), "f3", "f3"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h3", "h3"); + } else { + return builder->Call(str.str(), "f3", "f3"); + } case BuiltinType::kFma: case BuiltinType::kMix: case BuiltinType::kFaceForward: case BuiltinType::kSmoothstep: - case BuiltinType::kSmoothStep: - return builder->Call(str.str(), "f2", "f2", "f2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2", "h2"); + } else { + return builder->Call(str.str(), "f2", "f2", "f2"); + } case BuiltinType::kAll: case BuiltinType::kAny: return builder->Call(str.str(), "b2"); case BuiltinType::kAbs: - if (type == ParamType::kF32) { + if (type == CallParamType::kF32) { return builder->Call(str.str(), "f2"); + } else if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2"); } else { return builder->Call(str.str(), "u2"); } @@ -132,21 +157,33 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin, return builder->Call(str.str(), "u2", "u2", "u1", "u1"); case BuiltinType::kMax: case BuiltinType::kMin: - if (type == ParamType::kF32) { + if (type == CallParamType::kF32) { return builder->Call(str.str(), "f2", "f2"); + } else if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2"); } else { return builder->Call(str.str(), "u2", "u2"); } case BuiltinType::kClamp: - if (type == ParamType::kF32) { + if (type == CallParamType::kF32) { return builder->Call(str.str(), "f2", "f2", "f2"); + } else if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2", "h2"); } else { return builder->Call(str.str(), "u2", "u2", "u2"); } case BuiltinType::kSelect: - return builder->Call(str.str(), "f2", "f2", "b2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "h2", "h2", "b2"); + } else { + return builder->Call(str.str(), "f2", "f2", "b2"); + } case BuiltinType::kDeterminant: - return builder->Call(str.str(), "m2x2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "hm2x2"); + } else { + return builder->Call(str.str(), "m2x2"); + } case BuiltinType::kPack2x16snorm: case BuiltinType::kPack2x16unorm: return builder->Call(str.str(), "f2"); @@ -161,7 +198,11 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin, case BuiltinType::kWorkgroupBarrier: return builder->Call(str.str()); case BuiltinType::kTranspose: - return builder->Call(str.str(), "m3x2"); + if (type == CallParamType::kF16) { + return builder->Call(str.str(), "hm3x2"); + } else { + return builder->Call(str.str(), "m3x2"); + } default: break; } @@ -172,24 +213,33 @@ using MslBuiltinTest = TestParamHelper; TEST_P(MslBuiltinTest, Emit) { auto param = GetParam(); - Global("f2", ty.vec2(), ast::StorageClass::kPrivate); - Global("f3", ty.vec3(), ast::StorageClass::kPrivate); - Global("f4", ty.vec4(), ast::StorageClass::kPrivate); - Global("u1", ty.u32(), ast::StorageClass::kPrivate); - Global("u2", ty.vec2(), ast::StorageClass::kPrivate); - Global("i2", ty.vec2(), ast::StorageClass::kPrivate); - Global("b2", ty.vec2(), ast::StorageClass::kPrivate); - Global("m2x2", ty.mat2x2(), ast::StorageClass::kPrivate); - Global("m3x2", ty.mat3x2(), ast::StorageClass::kPrivate); + if (param.type == CallParamType::kF16) { + Enable(ast::Extension::kF16); + + GlobalVar("h2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("h3", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("hm2x2", ty.mat2x2(), ast::StorageClass::kPrivate); + GlobalVar("hm3x2", ty.mat3x2(), ast::StorageClass::kPrivate); + } + + GlobalVar("f2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("f3", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("f4", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("u1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("u2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("i2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("b2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("m2x2", ty.mat2x2(), ast::StorageClass::kPrivate); + GlobalVar("m3x2", ty.mat3x2(), ast::StorageClass::kPrivate); auto* call = GenerateCall(param.builtin, param.type, this); ASSERT_NE(nullptr, call) << "Unhandled builtin"; - Func("func", {}, ty.void_(), {Ignore(call)}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), utils::Vector{Ignore(call)}, + utils::Vector{create(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = Build(); - auto* sem = program->Sem().Get(call); + auto* sem = program->Sem().Get(call); ASSERT_NE(sem, nullptr); auto* target = sem->Target(); ASSERT_NE(target, nullptr); @@ -202,81 +252,126 @@ INSTANTIATE_TEST_SUITE_P( MslGeneratorImplTest, MslBuiltinTest, testing::Values( - BuiltinData{BuiltinType::kAbs, ParamType::kF32, "fabs"}, - BuiltinData{BuiltinType::kAbs, ParamType::kU32, "abs"}, - BuiltinData{BuiltinType::kAcos, ParamType::kF32, "acos"}, - BuiltinData{BuiltinType::kAll, ParamType::kBool, "all"}, - BuiltinData{BuiltinType::kAny, ParamType::kBool, "any"}, - BuiltinData{BuiltinType::kAsin, ParamType::kF32, "asin"}, - BuiltinData{BuiltinType::kAtan, ParamType::kF32, "atan"}, - BuiltinData{BuiltinType::kAtan2, ParamType::kF32, "atan2"}, - BuiltinData{BuiltinType::kCeil, ParamType::kF32, "ceil"}, - BuiltinData{BuiltinType::kClamp, ParamType::kF32, "clamp"}, - BuiltinData{BuiltinType::kClamp, ParamType::kU32, "clamp"}, - BuiltinData{BuiltinType::kCos, ParamType::kF32, "cos"}, - BuiltinData{BuiltinType::kCosh, ParamType::kF32, "cosh"}, - BuiltinData{BuiltinType::kCountLeadingZeros, ParamType::kU32, "clz"}, - BuiltinData{BuiltinType::kCountOneBits, ParamType::kU32, "popcount"}, - BuiltinData{BuiltinType::kCountTrailingZeros, ParamType::kU32, "ctz"}, - BuiltinData{BuiltinType::kCross, ParamType::kF32, "cross"}, - BuiltinData{BuiltinType::kDeterminant, ParamType::kF32, "determinant"}, - BuiltinData{BuiltinType::kDistance, ParamType::kF32, "distance"}, - BuiltinData{BuiltinType::kDot, ParamType::kF32, "dot"}, - BuiltinData{BuiltinType::kDpdx, ParamType::kF32, "dfdx"}, - BuiltinData{BuiltinType::kDpdxCoarse, ParamType::kF32, "dfdx"}, - BuiltinData{BuiltinType::kDpdxFine, ParamType::kF32, "dfdx"}, - BuiltinData{BuiltinType::kDpdy, ParamType::kF32, "dfdy"}, - BuiltinData{BuiltinType::kDpdyCoarse, ParamType::kF32, "dfdy"}, - BuiltinData{BuiltinType::kDpdyFine, ParamType::kF32, "dfdy"}, - BuiltinData{BuiltinType::kExp, ParamType::kF32, "exp"}, - BuiltinData{BuiltinType::kExp2, ParamType::kF32, "exp2"}, - BuiltinData{BuiltinType::kExtractBits, ParamType::kU32, "extract_bits"}, - BuiltinData{BuiltinType::kFaceForward, ParamType::kF32, "faceforward"}, - BuiltinData{BuiltinType::kFloor, ParamType::kF32, "floor"}, - BuiltinData{BuiltinType::kFma, ParamType::kF32, "fma"}, - BuiltinData{BuiltinType::kFract, ParamType::kF32, "fract"}, - BuiltinData{BuiltinType::kFwidth, ParamType::kF32, "fwidth"}, - BuiltinData{BuiltinType::kFwidthCoarse, ParamType::kF32, "fwidth"}, - BuiltinData{BuiltinType::kFwidthFine, ParamType::kF32, "fwidth"}, - BuiltinData{BuiltinType::kInsertBits, ParamType::kU32, "insert_bits"}, - BuiltinData{BuiltinType::kInverseSqrt, ParamType::kF32, "rsqrt"}, - BuiltinData{BuiltinType::kLdexp, ParamType::kF32, "ldexp"}, - BuiltinData{BuiltinType::kLength, ParamType::kF32, "length"}, - BuiltinData{BuiltinType::kLog, ParamType::kF32, "log"}, - BuiltinData{BuiltinType::kLog2, ParamType::kF32, "log2"}, - BuiltinData{BuiltinType::kMax, ParamType::kF32, "fmax"}, - BuiltinData{BuiltinType::kMax, ParamType::kU32, "max"}, - BuiltinData{BuiltinType::kMin, ParamType::kF32, "fmin"}, - BuiltinData{BuiltinType::kMin, ParamType::kU32, "min"}, - BuiltinData{BuiltinType::kNormalize, ParamType::kF32, "normalize"}, - BuiltinData{BuiltinType::kPack4x8snorm, ParamType::kF32, "pack_float_to_snorm4x8"}, - BuiltinData{BuiltinType::kPack4x8unorm, ParamType::kF32, "pack_float_to_unorm4x8"}, - BuiltinData{BuiltinType::kPack2x16snorm, ParamType::kF32, "pack_float_to_snorm2x16"}, - BuiltinData{BuiltinType::kPack2x16unorm, ParamType::kF32, "pack_float_to_unorm2x16"}, - BuiltinData{BuiltinType::kPow, ParamType::kF32, "pow"}, - BuiltinData{BuiltinType::kReflect, ParamType::kF32, "reflect"}, - BuiltinData{BuiltinType::kReverseBits, ParamType::kU32, "reverse_bits"}, - BuiltinData{BuiltinType::kRound, ParamType::kU32, "rint"}, - BuiltinData{BuiltinType::kSelect, ParamType::kF32, "select"}, - BuiltinData{BuiltinType::kSign, ParamType::kF32, "sign"}, - BuiltinData{BuiltinType::kSin, ParamType::kF32, "sin"}, - BuiltinData{BuiltinType::kSinh, ParamType::kF32, "sinh"}, - BuiltinData{BuiltinType::kSmoothstep, ParamType::kF32, "smoothstep"}, - BuiltinData{BuiltinType::kSmoothStep, ParamType::kF32, "smoothstep"}, - BuiltinData{BuiltinType::kSqrt, ParamType::kF32, "sqrt"}, - BuiltinData{BuiltinType::kStep, ParamType::kF32, "step"}, - BuiltinData{BuiltinType::kTan, ParamType::kF32, "tan"}, - BuiltinData{BuiltinType::kTanh, ParamType::kF32, "tanh"}, - BuiltinData{BuiltinType::kTranspose, ParamType::kF32, "transpose"}, - BuiltinData{BuiltinType::kTrunc, ParamType::kF32, "trunc"}, - BuiltinData{BuiltinType::kUnpack4x8snorm, ParamType::kU32, "unpack_snorm4x8_to_float"}, - BuiltinData{BuiltinType::kUnpack4x8unorm, ParamType::kU32, "unpack_unorm4x8_to_float"}, - BuiltinData{BuiltinType::kUnpack2x16snorm, ParamType::kU32, "unpack_snorm2x16_to_float"}, - BuiltinData{BuiltinType::kUnpack2x16unorm, ParamType::kU32, "unpack_unorm2x16_to_float"})); + /* Logical built-in */ + BuiltinData{BuiltinType::kAll, CallParamType::kBool, "all"}, + BuiltinData{BuiltinType::kAny, CallParamType::kBool, "any"}, + BuiltinData{BuiltinType::kSelect, CallParamType::kF32, "select"}, + /* Float built-in */ + BuiltinData{BuiltinType::kAbs, CallParamType::kF32, "fabs"}, + BuiltinData{BuiltinType::kAbs, CallParamType::kF16, "fabs"}, + BuiltinData{BuiltinType::kAcos, CallParamType::kF32, "acos"}, + BuiltinData{BuiltinType::kAcos, CallParamType::kF16, "acos"}, + BuiltinData{BuiltinType::kAsin, CallParamType::kF32, "asin"}, + BuiltinData{BuiltinType::kAsin, CallParamType::kF16, "asin"}, + BuiltinData{BuiltinType::kAtan, CallParamType::kF32, "atan"}, + BuiltinData{BuiltinType::kAtan, CallParamType::kF16, "atan"}, + BuiltinData{BuiltinType::kAtan2, CallParamType::kF32, "atan2"}, + BuiltinData{BuiltinType::kAtan2, CallParamType::kF16, "atan2"}, + BuiltinData{BuiltinType::kCeil, CallParamType::kF32, "ceil"}, + BuiltinData{BuiltinType::kCeil, CallParamType::kF16, "ceil"}, + BuiltinData{BuiltinType::kClamp, CallParamType::kF32, "clamp"}, + BuiltinData{BuiltinType::kClamp, CallParamType::kF16, "clamp"}, + BuiltinData{BuiltinType::kCos, CallParamType::kF32, "cos"}, + BuiltinData{BuiltinType::kCos, CallParamType::kF16, "cos"}, + BuiltinData{BuiltinType::kCosh, CallParamType::kF32, "cosh"}, + BuiltinData{BuiltinType::kCosh, CallParamType::kF16, "cosh"}, + BuiltinData{BuiltinType::kCross, CallParamType::kF32, "cross"}, + BuiltinData{BuiltinType::kCross, CallParamType::kF16, "cross"}, + BuiltinData{BuiltinType::kDistance, CallParamType::kF32, "distance"}, + BuiltinData{BuiltinType::kDistance, CallParamType::kF16, "distance"}, + BuiltinData{BuiltinType::kExp, CallParamType::kF32, "exp"}, + BuiltinData{BuiltinType::kExp, CallParamType::kF16, "exp"}, + BuiltinData{BuiltinType::kExp2, CallParamType::kF32, "exp2"}, + BuiltinData{BuiltinType::kExp2, CallParamType::kF16, "exp2"}, + BuiltinData{BuiltinType::kFaceForward, CallParamType::kF32, "faceforward"}, + BuiltinData{BuiltinType::kFaceForward, CallParamType::kF16, "faceforward"}, + BuiltinData{BuiltinType::kFloor, CallParamType::kF32, "floor"}, + BuiltinData{BuiltinType::kFloor, CallParamType::kF16, "floor"}, + BuiltinData{BuiltinType::kFma, CallParamType::kF32, "fma"}, + BuiltinData{BuiltinType::kFma, CallParamType::kF16, "fma"}, + BuiltinData{BuiltinType::kFract, CallParamType::kF32, "fract"}, + BuiltinData{BuiltinType::kFract, CallParamType::kF16, "fract"}, + BuiltinData{BuiltinType::kInverseSqrt, CallParamType::kF32, "rsqrt"}, + BuiltinData{BuiltinType::kInverseSqrt, CallParamType::kF16, "rsqrt"}, + BuiltinData{BuiltinType::kLdexp, CallParamType::kF32, "ldexp"}, + BuiltinData{BuiltinType::kLdexp, CallParamType::kF16, "ldexp"}, + BuiltinData{BuiltinType::kLength, CallParamType::kF32, "length"}, + BuiltinData{BuiltinType::kLength, CallParamType::kF16, "length"}, + BuiltinData{BuiltinType::kLog, CallParamType::kF32, "log"}, + BuiltinData{BuiltinType::kLog, CallParamType::kF16, "log"}, + BuiltinData{BuiltinType::kLog2, CallParamType::kF32, "log2"}, + BuiltinData{BuiltinType::kLog2, CallParamType::kF16, "log2"}, + BuiltinData{BuiltinType::kMax, CallParamType::kF32, "fmax"}, + BuiltinData{BuiltinType::kMax, CallParamType::kF16, "fmax"}, + BuiltinData{BuiltinType::kMin, CallParamType::kF32, "fmin"}, + BuiltinData{BuiltinType::kMin, CallParamType::kF16, "fmin"}, + BuiltinData{BuiltinType::kNormalize, CallParamType::kF32, "normalize"}, + BuiltinData{BuiltinType::kNormalize, CallParamType::kF16, "normalize"}, + BuiltinData{BuiltinType::kPow, CallParamType::kF32, "pow"}, + BuiltinData{BuiltinType::kPow, CallParamType::kF16, "pow"}, + BuiltinData{BuiltinType::kReflect, CallParamType::kF32, "reflect"}, + BuiltinData{BuiltinType::kReflect, CallParamType::kF16, "reflect"}, + BuiltinData{BuiltinType::kSign, CallParamType::kF32, "sign"}, + BuiltinData{BuiltinType::kSign, CallParamType::kF16, "sign"}, + BuiltinData{BuiltinType::kSin, CallParamType::kF32, "sin"}, + BuiltinData{BuiltinType::kSin, CallParamType::kF16, "sin"}, + BuiltinData{BuiltinType::kSinh, CallParamType::kF32, "sinh"}, + BuiltinData{BuiltinType::kSinh, CallParamType::kF16, "sinh"}, + BuiltinData{BuiltinType::kSmoothstep, CallParamType::kF32, "smoothstep"}, + BuiltinData{BuiltinType::kSmoothstep, CallParamType::kF16, "smoothstep"}, + BuiltinData{BuiltinType::kSqrt, CallParamType::kF32, "sqrt"}, + BuiltinData{BuiltinType::kSqrt, CallParamType::kF16, "sqrt"}, + BuiltinData{BuiltinType::kStep, CallParamType::kF32, "step"}, + BuiltinData{BuiltinType::kStep, CallParamType::kF16, "step"}, + BuiltinData{BuiltinType::kTan, CallParamType::kF32, "tan"}, + BuiltinData{BuiltinType::kTan, CallParamType::kF16, "tan"}, + BuiltinData{BuiltinType::kTanh, CallParamType::kF32, "tanh"}, + BuiltinData{BuiltinType::kTanh, CallParamType::kF16, "tanh"}, + BuiltinData{BuiltinType::kTrunc, CallParamType::kF32, "trunc"}, + BuiltinData{BuiltinType::kTrunc, CallParamType::kF16, "trunc"}, + /* Integer built-in */ + BuiltinData{BuiltinType::kAbs, CallParamType::kU32, "abs"}, + BuiltinData{BuiltinType::kClamp, CallParamType::kU32, "clamp"}, + BuiltinData{BuiltinType::kCountLeadingZeros, CallParamType::kU32, "clz"}, + BuiltinData{BuiltinType::kCountOneBits, CallParamType::kU32, "popcount"}, + BuiltinData{BuiltinType::kCountTrailingZeros, CallParamType::kU32, "ctz"}, + BuiltinData{BuiltinType::kExtractBits, CallParamType::kU32, "extract_bits"}, + BuiltinData{BuiltinType::kInsertBits, CallParamType::kU32, "insert_bits"}, + BuiltinData{BuiltinType::kMax, CallParamType::kU32, "max"}, + BuiltinData{BuiltinType::kMin, CallParamType::kU32, "min"}, + BuiltinData{BuiltinType::kReverseBits, CallParamType::kU32, "reverse_bits"}, + BuiltinData{BuiltinType::kRound, CallParamType::kU32, "rint"}, + /* Matrix built-in */ + BuiltinData{BuiltinType::kDeterminant, CallParamType::kF32, "determinant"}, + BuiltinData{BuiltinType::kTranspose, CallParamType::kF32, "transpose"}, + /* Vector built-in */ + BuiltinData{BuiltinType::kDot, CallParamType::kF32, "dot"}, + /* Derivate built-in */ + BuiltinData{BuiltinType::kDpdx, CallParamType::kF32, "dfdx"}, + BuiltinData{BuiltinType::kDpdxCoarse, CallParamType::kF32, "dfdx"}, + BuiltinData{BuiltinType::kDpdxFine, CallParamType::kF32, "dfdx"}, + BuiltinData{BuiltinType::kDpdy, CallParamType::kF32, "dfdy"}, + BuiltinData{BuiltinType::kDpdyCoarse, CallParamType::kF32, "dfdy"}, + BuiltinData{BuiltinType::kDpdyFine, CallParamType::kF32, "dfdy"}, + BuiltinData{BuiltinType::kFwidth, CallParamType::kF32, "fwidth"}, + BuiltinData{BuiltinType::kFwidthCoarse, CallParamType::kF32, "fwidth"}, + BuiltinData{BuiltinType::kFwidthFine, CallParamType::kF32, "fwidth"}, + /* Data packing builtin */ + BuiltinData{BuiltinType::kPack4x8snorm, CallParamType::kF32, "pack_float_to_snorm4x8"}, + BuiltinData{BuiltinType::kPack4x8unorm, CallParamType::kF32, "pack_float_to_unorm4x8"}, + BuiltinData{BuiltinType::kPack2x16snorm, CallParamType::kF32, "pack_float_to_snorm2x16"}, + BuiltinData{BuiltinType::kPack2x16unorm, CallParamType::kF32, "pack_float_to_unorm2x16"}, + /* Data unpacking builtin */ + BuiltinData{BuiltinType::kUnpack4x8snorm, CallParamType::kU32, "unpack_snorm4x8_to_float"}, + BuiltinData{BuiltinType::kUnpack4x8unorm, CallParamType::kU32, "unpack_unorm4x8_to_float"}, + BuiltinData{BuiltinType::kUnpack2x16snorm, CallParamType::kU32, + "unpack_snorm2x16_to_float"}, + BuiltinData{BuiltinType::kUnpack2x16unorm, CallParamType::kU32, + "unpack_unorm2x16_to_float"})); TEST_F(MslGeneratorImplTest, Builtin_Call) { - Global("param1", ty.vec2(), ast::StorageClass::kPrivate); - Global("param2", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("param1", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.vec2(), ast::StorageClass::kPrivate); auto* call = Call("dot", "param1", "param2"); WrapInFunction(CallStmt(call)); @@ -310,12 +405,252 @@ TEST_F(MslGeneratorImplTest, WorkgroupBarrier) { EXPECT_EQ(out.str(), "threadgroup_barrier(mem_flags::mem_threadgroup)"); } -TEST_F(MslGeneratorImplTest, Degrees_Scalar) { +TEST_F(MslGeneratorImplTest, Modf_Scalar_f32) { + auto* call = Call("modf", 1_f); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +kernel void test_function() { + tint_modf(1.0f); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Modf_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("modf", 1_h); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +struct modf_result_f16 { + half fract; + half whole; +}; +modf_result_f16 tint_modf(half param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +kernel void test_function() { + tint_modf(1.0h); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Modf_Vector_f32) { + auto* call = Call("modf", vec3()); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +struct modf_result_vec3 { + float3 fract; + float3 whole; +}; +modf_result_vec3 tint_modf(float3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + +kernel void test_function() { + tint_modf(float3(0.0f)); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Modf_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("modf", vec3()); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +struct modf_result_vec3_f16 { + half3 fract; + half3 whole; +}; +modf_result_vec3_f16 tint_modf(half3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +kernel void test_function() { + tint_modf(half3(0.0h)); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Frexp_Scalar_f32) { + auto* call = Call("frexp", 1_f); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + +kernel void test_function() { + tint_frexp(1.0f); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Frexp_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("frexp", 1_h); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +struct frexp_result_f16 { + half sig; + int exp; +}; +frexp_result_f16 tint_frexp(half param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +kernel void test_function() { + tint_frexp(1.0h); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Frexp_Vector_f32) { + auto* call = Call("frexp", vec3()); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +struct frexp_result_vec3 { + float3 sig; + int3 exp; +}; +frexp_result_vec3 tint_frexp(float3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +kernel void test_function() { + tint_frexp(float3(0.0f)); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Frexp_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* call = Call("frexp", vec3()); + WrapInFunction(CallStmt(call)); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +struct frexp_result_vec3_f16 { + half3 sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(half3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +kernel void test_function() { + tint_frexp(half3(0.0h)); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Degrees_Scalar_f32) { auto* val = Var("val", ty.f32()); auto* call = Call("degrees", val); WrapInFunction(val, call); - GeneratorImpl& gen = Build(); + GeneratorImpl& gen = SanitizeAndBuild(); ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(#include @@ -335,12 +670,12 @@ kernel void test_function() { )"); } -TEST_F(MslGeneratorImplTest, Degrees_Vector) { +TEST_F(MslGeneratorImplTest, Degrees_Vector_f32) { auto* val = Var("val", ty.vec3()); auto* call = Call("degrees", val); WrapInFunction(val, call); - GeneratorImpl& gen = Build(); + GeneratorImpl& gen = SanitizeAndBuild(); ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(#include @@ -360,12 +695,66 @@ kernel void test_function() { )"); } -TEST_F(MslGeneratorImplTest, Radians_Scalar) { +TEST_F(MslGeneratorImplTest, Degrees_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.f16()); + auto* call = Call("degrees", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +half tint_degrees(half param_0) { + return param_0 * 57.295779513082322865; +} + +kernel void test_function() { + half val = 0.0h; + half const tint_symbol = tint_degrees(val); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Degrees_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.vec3()); + auto* call = Call("degrees", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +half3 tint_degrees(half3 param_0) { + return param_0 * 57.295779513082322865; +} + +kernel void test_function() { + half3 val = 0.0h; + half3 const tint_symbol = tint_degrees(val); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Radians_Scalar_f32) { auto* val = Var("val", ty.f32()); auto* call = Call("radians", val); WrapInFunction(val, call); - GeneratorImpl& gen = Build(); + GeneratorImpl& gen = SanitizeAndBuild(); ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(#include @@ -385,12 +774,12 @@ kernel void test_function() { )"); } -TEST_F(MslGeneratorImplTest, Radians_Vector) { +TEST_F(MslGeneratorImplTest, Radians_Vector_f32) { auto* val = Var("val", ty.vec3()); auto* call = Call("radians", val); WrapInFunction(val, call); - GeneratorImpl& gen = Build(); + GeneratorImpl& gen = SanitizeAndBuild(); ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(#include @@ -410,9 +799,63 @@ kernel void test_function() { )"); } +TEST_F(MslGeneratorImplTest, Radians_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.f16()); + auto* call = Call("radians", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +half tint_radians(half param_0) { + return param_0 * 0.017453292519943295474; +} + +kernel void test_function() { + half val = 0.0h; + half const tint_symbol = tint_radians(val); + return; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Radians_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* val = Var("val", ty.vec3()); + auto* call = Call("radians", val); + WrapInFunction(val, call); + + GeneratorImpl& gen = SanitizeAndBuild(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +half3 tint_radians(half3 param_0) { + return param_0 * 0.017453292519943295474; +} + +kernel void test_function() { + half3 val = 0.0h; + half3 const tint_symbol = tint_radians(val); + return; +} + +)"); +} + TEST_F(MslGeneratorImplTest, Pack2x16Float) { auto* call = Call("pack2x16float", "p1"); - Global("p1", ty.vec2(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.vec2(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -424,7 +867,7 @@ TEST_F(MslGeneratorImplTest, Pack2x16Float) { TEST_F(MslGeneratorImplTest, Unpack2x16Float) { auto* call = Call("unpack2x16float", "p1"); - Global("p1", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("p1", ty.u32(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(call)); GeneratorImpl& gen = Build(); @@ -435,7 +878,7 @@ TEST_F(MslGeneratorImplTest, Unpack2x16Float) { } TEST_F(MslGeneratorImplTest, DotI32) { - Global("v", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); WrapInFunction(CallStmt(Call("dot", "v", "v"))); GeneratorImpl& gen = SanitizeAndBuild(); @@ -459,11 +902,11 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Ignore) { - Func("f", {Param("a", ty.i32()), Param("b", ty.i32()), Param("c", ty.i32())}, ty.i32(), - {Return(Mul(Add("a", "b"), "c"))}); + Func("f", utils::Vector{Param("a", ty.i32()), Param("b", ty.i32()), Param("c", ty.i32())}, + ty.i32(), utils::Vector{Return(Mul(Add("a", "b"), "c"))}); - Func("func", {}, ty.void_(), {CallStmt(Call("f", 1_i, 2_i, 3_i))}, - { + Func("func", utils::Empty, ty.void_(), utils::Vector{CallStmt(Call("f", 1_i, 2_i, 3_i))}, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); diff --git a/src/tint/writer/msl/generator_impl_builtin_texture_test.cc b/src/tint/writer/msl/generator_impl_builtin_texture_test.cc index a78a255c5a..dd4a92f371 100644 --- a/src/tint/writer/msl/generator_impl_builtin_texture_test.cc +++ b/src/tint/writer/msl/generator_impl_builtin_texture_test.cc @@ -184,7 +184,7 @@ std::string expected_texture_overload(ast::builtin::test::ValidTextureOverload o case ValidTextureOverload::kSampleGrad2dF32: return R"(texture.sample(sampler, float2(1.0f, 2.0f), gradient2d(float2(3.0f, 4.0f), float2(5.0f, 6.0f))))"; case ValidTextureOverload::kSampleGrad2dOffsetF32: - return R"(texture.sample(sampler, float2(1.0f, 2.0f), gradient2d(float2(3.0f, 4.0f), float2(5.0f, 6.0f)), int2(7, 7)))"; + return R"(texture.sample(sampler, float2(1.0f, 2.0f), gradient2d(float2(3.0f, 4.0f), float2(5.0f, 6.0f)), int2(7)))"; case ValidTextureOverload::kSampleGrad2dArrayF32: return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3, gradient2d(float2(4.0f, 5.0f), float2(6.0f, 7.0f))))"; case ValidTextureOverload::kSampleGrad2dArrayOffsetF32: @@ -280,7 +280,8 @@ TEST_P(MslGeneratorBuiltinTextureTest, Call) { auto* call = Call(Expr(param.function), param.args(this)); auto* stmt = CallStmt(call); - Func("main", {}, ty.void_(), {stmt}, {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), utils::Vector{stmt}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/msl/generator_impl_call_test.cc b/src/tint/writer/msl/generator_impl_call_test.cc index 9fc7b8fc47..1011ebd725 100644 --- a/src/tint/writer/msl/generator_impl_call_test.cc +++ b/src/tint/writer/msl/generator_impl_call_test.cc @@ -15,13 +15,15 @@ #include "src/tint/ast/call_statement.h" #include "src/tint/writer/msl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::msl { namespace { using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, EmitExpression_Call_WithoutParams) { - Func("my_func", {}, ty.f32(), {Return(1.23f)}); + Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(1.23_f)}); auto* call = Call("my_func"); WrapInFunction(call); @@ -35,13 +37,16 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Call_WithoutParams) { TEST_F(MslGeneratorImplTest, EmitExpression_Call_WithParams) { Func("my_func", - { + utils::Vector{ Param(Sym(), ty.f32()), Param(Sym(), ty.f32()), }, - ty.f32(), {Return(1.23f)}); - Global("param1", ty.f32(), ast::StorageClass::kPrivate); - Global("param2", ty.f32(), ast::StorageClass::kPrivate); + ty.f32(), + utils::Vector{ + Return(1.23_f), + }); + GlobalVar("param1", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.f32(), ast::StorageClass::kPrivate); auto* call = Call("my_func", "param1", "param2"); WrapInFunction(call); @@ -55,13 +60,13 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Call_WithParams) { TEST_F(MslGeneratorImplTest, EmitStatement_Call) { Func("my_func", - { + utils::Vector{ Param(Sym(), ty.f32()), Param(Sym(), ty.f32()), }, - ty.void_(), ast::StatementList{}, ast::AttributeList{}); - Global("param1", ty.f32(), ast::StorageClass::kPrivate); - Global("param2", ty.f32(), ast::StorageClass::kPrivate); + ty.void_(), utils::Empty, utils::Empty); + GlobalVar("param1", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.f32(), ast::StorageClass::kPrivate); auto* call = Call("my_func", "param1", "param2"); auto* stmt = CallStmt(call); diff --git a/src/tint/writer/msl/generator_impl_case_test.cc b/src/tint/writer/msl/generator_impl_case_test.cc index 8fc1bc95b5..250d67d9c7 100644 --- a/src/tint/writer/msl/generator_impl_case_test.cc +++ b/src/tint/writer/msl/generator_impl_case_test.cc @@ -69,7 +69,13 @@ TEST_F(MslGeneratorImplTest, Emit_Case_WithFallthrough) { } TEST_F(MslGeneratorImplTest, Emit_Case_MultipleSelectors) { - auto* s = Switch(1_i, Case({Expr(5_i), Expr(6_i)}, Block(create())), + auto* s = Switch(1_i, + Case( + utils::Vector{ + Expr(5_i), + Expr(6_i), + }, + Block(create())), DefaultCase()); WrapInFunction(s); diff --git a/src/tint/writer/msl/generator_impl_cast_test.cc b/src/tint/writer/msl/generator_impl_cast_test.cc index 0eca1910ad..4b9e3f28d9 100644 --- a/src/tint/writer/msl/generator_impl_cast_test.cc +++ b/src/tint/writer/msl/generator_impl_cast_test.cc @@ -29,7 +29,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Cast_Scalar) { std::stringstream out; ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); - EXPECT_EQ(out.str(), "float(1)"); + EXPECT_EQ(out.str(), "1.0f"); } TEST_F(MslGeneratorImplTest, EmitExpression_Cast_Vector) { @@ -40,7 +40,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Cast_Vector) { std::stringstream out; ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); - EXPECT_EQ(out.str(), "float3(int3(1, 2, 3))"); + EXPECT_EQ(out.str(), "float3(1.0f, 2.0f, 3.0f)"); } TEST_F(MslGeneratorImplTest, EmitExpression_Cast_IntMin) { @@ -51,7 +51,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Cast_IntMin) { std::stringstream out; ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); - EXPECT_EQ(out.str(), "uint((-2147483647 - 1))"); + EXPECT_EQ(out.str(), "0u"); } } // namespace diff --git a/src/tint/writer/msl/generator_impl_constructor_test.cc b/src/tint/writer/msl/generator_impl_constructor_test.cc index 134a7aed93..4626e6779c 100644 --- a/src/tint/writer/msl/generator_impl_constructor_test.cc +++ b/src/tint/writer/msl/generator_impl_constructor_test.cc @@ -34,7 +34,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Bool) { } TEST_F(MslGeneratorImplTest, EmitConstructor_Int) { - WrapInFunction(Expr(i32(-12345))); + WrapInFunction(Expr(-12345_i)); GeneratorImpl& gen = Build(); @@ -53,7 +53,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_UInt) { TEST_F(MslGeneratorImplTest, EmitConstructor_Float) { // Use a number close to 1<<30 but whose decimal representation ends in 0. - WrapInFunction(Expr(static_cast((1 << 30) - 4))); + WrapInFunction(Expr(f32((1 << 30) - 4))); GeneratorImpl& gen = Build(); @@ -61,13 +61,36 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Float) { EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f")); } -TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Float) { - WrapInFunction(Construct(-1.2e-5f)); +TEST_F(MslGeneratorImplTest, EmitConstructor_F16) { + Enable(ast::Extension::kF16); + + // Use a number close to 1<<16 but whose decimal representation ends in 0. + WrapInFunction(Expr(f16((1 << 15) - 8))); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("float(-0.000012f)")); + EXPECT_THAT(gen.result(), HasSubstr("32752.0h")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Float) { + WrapInFunction(Construct(-1.2e-5_f)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("-0.000012f")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(Construct(-1.2e-3_h)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("-0.00119972229h")); } TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Bool) { @@ -76,16 +99,16 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Bool) { GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("bool(true)")); + EXPECT_THAT(gen.result(), HasSubstr("true")); } TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Int) { - WrapInFunction(Construct(i32(-12345))); + WrapInFunction(Construct(-12345_i)); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("int(-12345)")); + EXPECT_THAT(gen.result(), HasSubstr("-12345")); } TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Uint) { @@ -94,11 +117,11 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Uint) { GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("uint(12345u)")); + EXPECT_THAT(gen.result(), HasSubstr("12345u")); } -TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec) { - WrapInFunction(vec3(1.f, 2.f, 3.f)); +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_F32) { + WrapInFunction(vec3(1_f, 2_f, 3_f)); GeneratorImpl& gen = Build(); @@ -106,41 +129,255 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec) { EXPECT_THAT(gen.result(), HasSubstr("float3(1.0f, 2.0f, 3.0f)")); } -TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_Empty) { +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3(1_h, 2_h, 3_h)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("half3(1.0h, 2.0h, 3.0h)")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_Empty_F32) { WrapInFunction(vec3()); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("float3()")); + EXPECT_THAT(gen.result(), HasSubstr("float3(0.0f)")); } -TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat) { - WrapInFunction( - Construct(ty.mat2x3(), vec3(1.0f, 2.0f, 3.0f), vec3(3.0f, 4.0f, 5.0f))); +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_Empty_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3()); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("half3(0.0h)")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_SingleScalar_F32_Literal) { + WrapInFunction(vec3(2_f)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("float3(2.0f)")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_SingleScalar_F16_Literal) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3(2_h)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("half3(2.0h)")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_SingleScalar_F32_Var) { + auto* var = Var("v", Expr(2_f)); + auto* cast = vec3(var); + WrapInFunction(var, cast); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr(R"(float v = 2.0f; + float3 const tint_symbol = float3(v);)")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_SingleScalar_F16_Var) { + Enable(ast::Extension::kF16); + + auto* var = Var("v", Expr(2_h)); + auto* cast = vec3(var); + WrapInFunction(var, cast); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr(R"(half v = 2.0h; + half3 const tint_symbol = half3(v);)")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_SingleScalar_Bool) { + WrapInFunction(vec3(true)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("bool3(true)")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_SingleScalar_Int) { + WrapInFunction(vec3(2_i)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("int3(2)")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Vec_SingleScalar_UInt) { + WrapInFunction(vec3(2_u)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("uint3(2u)")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat_F32) { + WrapInFunction(mat2x3(vec3(1_f, 2_f, 3_f), vec3(3_f, 4_f, 5_f))); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - // A matrix of type T with n columns and m rows can also be constructed from - // n vectors of type T with m components. EXPECT_THAT(gen.result(), HasSubstr("float2x3(float3(1.0f, 2.0f, 3.0f), float3(3.0f, 4.0f, 5.0f))")); } -TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat_Empty) { - WrapInFunction(mat4x4()); +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(mat2x3(vec3(1_h, 2_h, 3_h), vec3(3_h, 4_h, 5_h))); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("float4x4()")); + + EXPECT_THAT(gen.result(), + HasSubstr("half2x3(half3(1.0h, 2.0h, 3.0h), half3(3.0h, 4.0h, 5.0h))")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat_Complex_F32) { + // mat4x4( + // vec4(2.0f, 3.0f, 4.0f, 8.0f), + // vec4(), + // vec4(7.0f), + // vec4(vec4(42.0f, 21.0f, 6.0f, -5.0f)), + // ); + auto* vector_literal = + vec4(Expr(f32(2.0)), Expr(f32(3.0)), Expr(f32(4.0)), Expr(f32(8.0))); + auto* vector_zero_ctor = vec4(); + auto* vector_single_scalar_ctor = vec4(Expr(f32(7.0))); + auto* vector_identical_ctor = + vec4(vec4(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0)))); + + auto* constructor = mat4x4(vector_literal, vector_zero_ctor, vector_single_scalar_ctor, + vector_identical_ctor); + + WrapInFunction(constructor); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("float4x4(float4(2.0f, 3.0f, 4.0f, 8.0f), float4(0.0f), " + "float4(7.0f), float4(42.0f, 21.0f, 6.0f, -5.0f))")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat_Complex_F16) { + // mat4x4( + // vec4(2.0h, 3.0h, 4.0h, 8.0h), + // vec4(), + // vec4(7.0h), + // vec4(vec4(42.0h, 21.0h, 6.0h, -5.0h)), + // ); + Enable(ast::Extension::kF16); + + auto* vector_literal = + vec4(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0))); + auto* vector_zero_ctor = vec4(); + auto* vector_single_scalar_ctor = vec4(Expr(f16(7.0))); + auto* vector_identical_ctor = + vec4(vec4(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0)))); + + auto* constructor = mat4x4(vector_literal, vector_zero_ctor, vector_single_scalar_ctor, + vector_identical_ctor); + + WrapInFunction(constructor); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("half4x4(half4(2.0h, 3.0h, 4.0h, 8.0h), half4(0.0h), " + "half4(7.0h), half4(42.0h, 21.0h, 6.0h, -5.0h))")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat_Empty_F32) { + WrapInFunction(mat2x3()); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), + HasSubstr("float2x3 const tint_symbol = float2x3(float3(0.0f), float3(0.0f))")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat_Empty_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(mat2x3()); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), + HasSubstr("half2x3 const tint_symbol = half2x3(half3(0.0h), half3(0.0h))")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat_Identity_F32) { + // fn f() { + // var m_1: mat4x4 = mat4x4(); + // var m_2: mat4x4 = mat4x4(m_1); + // } + + auto* m_1 = Var("m_1", ty.mat4x4(ty.f32()), mat4x4()); + auto* m_2 = Var("m_2", ty.mat4x4(ty.f32()), mat4x4(m_1)); + + WrapInFunction(m_1, m_2); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("float4x4 m_2 = float4x4(m_1);")); +} + +TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Mat_Identity_F16) { + // fn f() { + // var m_1: mat4x4 = mat4x4(); + // var m_2: mat4x4 = mat4x4(m_1); + // } + + Enable(ast::Extension::kF16); + + auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4()); + auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4(m_1)); + + WrapInFunction(m_1, m_2); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_THAT(gen.result(), HasSubstr("half4x4 m_2 = half4x4(m_1);")); } TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Array) { - WrapInFunction(Construct(ty.array(ty.vec3(), 3_u), vec3(1.0f, 2.0f, 3.0f), - vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f))); + WrapInFunction(Construct(ty.array(ty.vec3(), 3_u), vec3(1_f, 2_f, 3_f), + vec3(4_f, 5_f, 6_f), vec3(7_f, 8_f, 9_f))); GeneratorImpl& gen = Build(); @@ -150,13 +387,13 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Array) { } TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Struct) { - auto* str = Structure("S", { + auto* str = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), Member("c", ty.vec3()), }); - WrapInFunction(Construct(ty.Of(str), 1_i, 2.0f, vec3(3_i, 4_i, 5_i))); + WrapInFunction(Construct(ty.Of(str), 1_i, 2_f, vec3(3_i, 4_i, 5_i))); GeneratorImpl& gen = Build(); @@ -165,7 +402,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Struct) { } TEST_F(MslGeneratorImplTest, EmitConstructor_Type_Struct_Empty) { - auto* str = Structure("S", { + auto* str = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), Member("c", ty.vec3()), diff --git a/src/tint/writer/msl/generator_impl_function_test.cc b/src/tint/writer/msl/generator_impl_function_test.cc index 063fda80ad..56761a77d2 100644 --- a/src/tint/writer/msl/generator_impl_function_test.cc +++ b/src/tint/writer/msl/generator_impl_function_test.cc @@ -24,11 +24,10 @@ namespace { using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, Emit_Function) { - Func("my_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Return(), - }, - {}); + }); GeneratorImpl& gen = Build(); @@ -46,15 +45,15 @@ TEST_F(MslGeneratorImplTest, Emit_Function) { } TEST_F(MslGeneratorImplTest, Emit_Function_WithParams) { - ast::VariableList params; - params.push_back(Param("a", ty.f32())); - params.push_back(Param("b", ty.i32())); - - Func("my_func", params, ty.void_(), - ast::StatementList{ - Return(), + Func("my_func", + utils::Vector{ + Param("a", ty.f32()), + Param("b", ty.i32()), }, - {}); + ty.void_(), + utils::Vector{ + Return(), + }); GeneratorImpl& gen = Build(); @@ -72,8 +71,8 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithParams) { } TEST_F(MslGeneratorImplTest, Emit_Attribute_EntryPoint_NoReturn_Void) { - Func("main", ast::VariableList{}, ty.void_(), ast::StatementList{/* no explicit return */}, - {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), {/* no explicit return */}, + utils::Vector{Stage(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = Build(); @@ -92,9 +91,17 @@ TEST_F(MslGeneratorImplTest, Emit_Attribute_EntryPoint_WithInOutVars) { // fn frag_main(@location(0) foo : f32) -> @location(1) f32 { // return foo; // } - auto* foo_in = Param("foo", ty.f32(), {Location(0)}); - Func("frag_main", ast::VariableList{foo_in}, ty.f32(), {Return("foo")}, - {Stage(ast::PipelineStage::kFragment)}, {Location(1)}); + auto* foo_in = Param("foo", ty.f32(), utils::Vector{Location(0)}); + Func("frag_main", utils::Vector{foo_in}, ty.f32(), + utils::Vector{ + Return("foo"), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Location(1), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -128,9 +135,18 @@ TEST_F(MslGeneratorImplTest, Emit_Attribute_EntryPoint_WithInOut_Builtins) { // fn frag_main(@position(0) coord : vec4) -> @frag_depth f32 { // return coord.x; // } - auto* coord_in = Param("coord", ty.vec4(), {Builtin(ast::Builtin::kPosition)}); - Func("frag_main", ast::VariableList{coord_in}, ty.f32(), {Return(MemberAccessor("coord", "x"))}, - {Stage(ast::PipelineStage::kFragment)}, {Builtin(ast::Builtin::kFragDepth)}); + auto* coord_in = + Param("coord", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}); + Func("frag_main", utils::Vector{coord_in}, ty.f32(), + utils::Vector{ + Return(MemberAccessor("coord", "x")), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kFragDepth), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -170,23 +186,24 @@ TEST_F(MslGeneratorImplTest, Emit_Attribute_EntryPoint_SharedStruct_DifferentSta // const g = colors.col2; // } auto* interface_struct = Structure( - "Interface", { - Member("col1", ty.f32(), {Location(1)}), - Member("col2", ty.f32(), {Location(2)}), - Member("pos", ty.vec4(), {Builtin(ast::Builtin::kPosition)}), - }); + "Interface", + utils::Vector{ + Member("col1", ty.f32(), utils::Vector{Location(1)}), + Member("col2", ty.f32(), utils::Vector{Location(2)}), + Member("pos", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}), + }); - Func("vert_main", {}, ty.Of(interface_struct), - {Return(Construct(ty.Of(interface_struct), Expr(0.5f), Expr(0.25f), - Construct(ty.vec4())))}, - {Stage(ast::PipelineStage::kVertex)}); + Func("vert_main", utils::Empty, ty.Of(interface_struct), + utils::Vector{Return(Construct(ty.Of(interface_struct), Expr(0.5_f), Expr(0.25_f), + Construct(ty.vec4())))}, + utils::Vector{Stage(ast::PipelineStage::kVertex)}); - Func("frag_main", {Param("colors", ty.Of(interface_struct))}, ty.void_(), - { + Func("frag_main", utils::Vector{Param("colors", ty.Of(interface_struct))}, ty.void_(), + utils::Vector{ WrapInStatement(Let("r", ty.f32(), MemberAccessor("colors", "col1"))), WrapInStatement(Let("g", ty.f32(), MemberAccessor("colors", "col2"))), }, - {Stage(ast::PipelineStage::kFragment)}); + utils::Vector{Stage(ast::PipelineStage::kFragment)}); GeneratorImpl& gen = SanitizeAndBuild(); @@ -207,7 +224,7 @@ struct tint_symbol { }; Interface vert_main_inner() { - Interface const tint_symbol_3 = {.col1=0.5f, .col2=0.25f, .pos=float4()}; + Interface const tint_symbol_3 = Interface{.col1=0.5f, .col2=0.25f, .pos=float4(0.0f)}; return tint_symbol_3; } @@ -253,18 +270,23 @@ TEST_F(MslGeneratorImplTest, Emit_Attribute_EntryPoint_SharedStruct_HelperFuncti // return foo(0.25); // } auto* vertex_output_struct = Structure( - "VertexOutput", {Member("pos", ty.vec4(), {Builtin(ast::Builtin::kPosition)})}); + "VertexOutput", + utils::Vector{ + Member("pos", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}), + }); - Func("foo", {Param("x", ty.f32())}, ty.Of(vertex_output_struct), - {Return(Construct(ty.Of(vertex_output_struct), - Construct(ty.vec4(), "x", "x", "x", Expr(1.f))))}, - {}); + Func("foo", utils::Vector{Param("x", ty.f32())}, ty.Of(vertex_output_struct), + utils::Vector{ + Return(Construct(ty.Of(vertex_output_struct), + Construct(ty.vec4(), "x", "x", "x", Expr(1_f)))), + }); + Func("vert_main1", utils::Empty, ty.Of(vertex_output_struct), + utils::Vector{Return(Expr(Call("foo", Expr(0.5_f))))}, + utils::Vector{Stage(ast::PipelineStage::kVertex)}); - Func("vert_main1", {}, ty.Of(vertex_output_struct), {Return(Expr(Call("foo", Expr(0.5f))))}, - {Stage(ast::PipelineStage::kVertex)}); - - Func("vert_main2", {}, ty.Of(vertex_output_struct), {Return(Expr(Call("foo", Expr(0.25f))))}, - {Stage(ast::PipelineStage::kVertex)}); + Func("vert_main2", utils::Empty, ty.Of(vertex_output_struct), + utils::Vector{Return(Expr(Call("foo", Expr(0.25_f))))}, + utils::Vector{Stage(ast::PipelineStage::kVertex)}); GeneratorImpl& gen = SanitizeAndBuild(); @@ -315,25 +337,22 @@ vertex tint_symbol_1 vert_main2() { } TEST_F(MslGeneratorImplTest, Emit_FunctionAttribute_EntryPoint_With_RW_StorageBuffer) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Group(0), + Binding(0)); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b")); + auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b")); - Func("frag_main", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -357,25 +376,22 @@ fragment void frag_main(device Data* tint_symbol [[buffer(0)]]) { } TEST_F(MslGeneratorImplTest, Emit_FunctionAttribute_EntryPoint_With_RO_StorageBuffer) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Group(0), + Binding(0)); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b")); + auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b")); - Func("frag_main", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -399,30 +415,26 @@ fragment void frag_main(const device Data* tint_symbol [[buffer(0)]]) { } TEST_F(MslGeneratorImplTest, Emit_Attribute_Called_By_EntryPoint_With_Uniform) { - auto* ubo_ty = Structure("UBO", {Member("coord", ty.vec4())}); - auto* ubo = Global("ubo", ty.Of(ubo_ty), ast::StorageClass::kUniform, - ast::AttributeList{ - create(0), - create(0), - }); + auto* ubo_ty = Structure("UBO", utils::Vector{Member("coord", ty.vec4())}); + auto* ubo = GlobalVar("ubo", ty.Of(ubo_ty), ast::StorageClass::kUniform, Group(0), Binding(0)); Func("sub_func", - { + utils::Vector{ Param("param", ty.f32()), }, ty.f32(), - { + utils::Vector{ Return(MemberAccessor(MemberAccessor(ubo, "coord"), "x")), }); - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, Call("sub_func", 1.0f)); + auto* var = Var("v", ty.f32(), Call("sub_func", 1_f)); - Func("frag_main", {}, ty.void_(), - { + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -449,32 +461,31 @@ fragment void frag_main(const constant UBO* tint_symbol_1 [[buffer(0)]]) { } TEST_F(MslGeneratorImplTest, Emit_FunctionAttribute_Called_By_EntryPoint_With_RW_StorageBuffer) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Group(0), + Binding(0)); - ast::VariableList params; - params.push_back(Param("param", ty.f32())); + Func("sub_func", + utils::Vector{ + Param("param", ty.f32()), + }, + ty.f32(), + utils::Vector{ + Return(MemberAccessor("coord", "b")), + }); - auto body = ast::StatementList{Return(MemberAccessor("coord", "b"))}; + auto* var = Var("v", ty.f32(), Call("sub_func", 1_f)); - Func("sub_func", params, ty.f32(), body, {}); - - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, Call("sub_func", 1.0f)); - - Func("frag_main", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -502,32 +513,31 @@ fragment void frag_main(device Data* tint_symbol_1 [[buffer(0)]]) { } TEST_F(MslGeneratorImplTest, Emit_FunctionAttribute_Called_By_EntryPoint_With_RO_StorageBuffer) { - auto* s = Structure("Data", { + auto* s = Structure("Data", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Group(0), + Binding(0)); - ast::VariableList params; - params.push_back(Param("param", ty.f32())); + Func("sub_func", + utils::Vector{ + Param("param", ty.f32()), + }, + ty.f32(), + utils::Vector{ + Return(MemberAccessor("coord", "b")), + }); - auto body = ast::StatementList{Return(MemberAccessor("coord", "b"))}; + auto* var = Var("v", ty.f32(), Call("sub_func", 1_f)); - Func("sub_func", params, ty.f32(), body, {}); - - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, Call("sub_func", 1.0f)); - - Func("frag_main", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("frag_main", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -555,11 +565,12 @@ fragment void frag_main(const device Data* tint_symbol_1 [[buffer(0)]]) { } TEST_F(MslGeneratorImplTest, Emit_Function_WithArrayParams) { - ast::VariableList params; - params.push_back(Param("a", ty.array())); - - Func("my_func", params, ty.void_(), - { + Func("my_func", + utils::Vector{ + Param("a", ty.array()), + }, + ty.void_(), + utils::Vector{ Return(), }); @@ -571,11 +582,20 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithArrayParams) { EXPECT_EQ(gen.result(), R"( #include using namespace metal; - struct tint_array_wrapper { - float arr[5]; - }; - void my_func(tint_array_wrapper a) { +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + + void my_func(tint_array a) { return; } @@ -583,8 +603,8 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithArrayParams) { } TEST_F(MslGeneratorImplTest, Emit_Function_WithArrayReturn) { - Func("my_func", {}, ty.array(), - { + Func("my_func", utils::Empty, ty.array(), + utils::Vector{ Return(Construct(ty.array())), }); @@ -596,12 +616,21 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithArrayReturn) { EXPECT_EQ(gen.result(), R"( #include using namespace metal; - struct tint_array_wrapper { - float arr[5]; - }; - tint_array_wrapper my_func() { - tint_array_wrapper const tint_symbol = {.arr={}}; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + + tint_array my_func() { + tint_array const tint_symbol = tint_array{}; return tint_symbol; } @@ -615,43 +644,44 @@ TEST_F(MslGeneratorImplTest, Emit_Function_Multiple_EntryPoint_With_Same_ModuleV // }; // @binding(0) @group(0) var data : Data; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn a() { // return; // } // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn b() { // return; // } - auto* s = Structure("Data", {Member("d", ty.f32())}); + auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())}); - Global("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Group(0), + Binding(0)); { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("a", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("a", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - { + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); } { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("b", ast::VariableList{}, ty.void_(), ast::StatementList{Decl(var), Return()}, - { + Func("b", utils::Empty, ty.void_(), + utils::Vector{ + Decl(var), + Return(), + }, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); diff --git a/src/tint/writer/msl/generator_impl_import_test.cc b/src/tint/writer/msl/generator_impl_import_test.cc index fa5519a3cb..7b79569b17 100644 --- a/src/tint/writer/msl/generator_impl_import_test.cc +++ b/src/tint/writer/msl/generator_impl_import_test.cc @@ -33,14 +33,14 @@ inline std::ostream& operator<<(std::ostream& out, MslImportData data) { using MslImportData_SingleParamTest = TestParamHelper; TEST_P(MslImportData_SingleParamTest, FloatScalar) { auto param = GetParam(); - auto* call = Call(param.name, 1.f); + auto* call = Call(param.name, 1_f); // The resolver will set the builtin data for the ident WrapInFunction(call); GeneratorImpl& gen = Build(); - auto* sem = program->Sem().Get(call); + auto* sem = program->Sem().Get(call); ASSERT_NE(sem, nullptr); auto* target = sem->Target(); ASSERT_NE(target, nullptr); @@ -87,7 +87,7 @@ TEST_F(MslGeneratorImplTest, MslImportData_SingleParamTest_IntScalar) { } TEST_F(MslGeneratorImplTest, MslImportData_SingleParamTest_ScalarLength) { - auto* expr = Call("length", 2.f); + auto* expr = Call("length", 2_f); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -100,7 +100,7 @@ TEST_F(MslGeneratorImplTest, MslImportData_SingleParamTest_ScalarLength) { using MslImportData_DualParam_ScalarTest = TestParamHelper; TEST_P(MslImportData_DualParam_ScalarTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, 1.0f, 2.0f); + auto* expr = Call(param.name, 1_f, 2_f); WrapInFunction(expr); @@ -119,7 +119,7 @@ INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest, MslImportData{"step", "step"})); TEST_F(MslGeneratorImplTest, MslImportData_DualParam_ScalarDistance) { - auto* expr = Call("distance", 2.f, 3.f); + auto* expr = Call("distance", 2_f, 3_f); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -133,7 +133,7 @@ using MslImportData_DualParam_VectorTest = TestParamHelper; TEST_P(MslImportData_DualParam_VectorTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, vec3(1.f, 2.f, 3.f), vec3(4.f, 5.f, 6.f)); + auto* expr = Call(param.name, vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f)); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -175,7 +175,7 @@ using MslImportData_TripleParam_ScalarTest = TestParamHelper; TEST_P(MslImportData_TripleParam_ScalarTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, 1.f, 2.f, 3.f); + auto* expr = Call(param.name, 1_f, 2_f, 3_f); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -195,8 +195,8 @@ using MslImportData_TripleParam_VectorTest = TestParamHelper; TEST_P(MslImportData_TripleParam_VectorTest, Float) { auto param = GetParam(); - auto* expr = Call(param.name, vec3(1.f, 2.f, 3.f), vec3(4.f, 5.f, 6.f), - vec3(7.f, 8.f, 9.f)); + auto* expr = Call(param.name, vec3(1_f, 2_f, 3_f), vec3(4_f, 5_f, 6_f), + vec3(7_f, 8_f, 9_f)); WrapInFunction(expr); GeneratorImpl& gen = Build(); @@ -234,7 +234,7 @@ INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest, MslImportData{"clamp", "clamp"})); TEST_F(MslGeneratorImplTest, MslImportData_Determinant) { - Global("var", ty.mat3x3(), ast::StorageClass::kPrivate); + GlobalVar("var", ty.mat3x3(), ast::StorageClass::kPrivate); auto* expr = Call("determinant", "var"); diff --git a/src/tint/writer/msl/generator_impl_loop_test.cc b/src/tint/writer/msl/generator_impl_loop_test.cc index 1df74867fd..7c84db0150 100644 --- a/src/tint/writer/msl/generator_impl_loop_test.cc +++ b/src/tint/writer/msl/generator_impl_loop_test.cc @@ -40,7 +40,7 @@ TEST_F(MslGeneratorImplTest, Emit_Loop) { } TEST_F(MslGeneratorImplTest, Emit_LoopWithContinuing) { - Func("a_statement", {}, ty.void_(), {}); + Func("a_statement", {}, ty.void_(), utils::Empty); auto* body = Block(create()); auto* continuing = Block(CallStmt(Call("a_statement"))); @@ -62,10 +62,10 @@ TEST_F(MslGeneratorImplTest, Emit_LoopWithContinuing) { } TEST_F(MslGeneratorImplTest, Emit_LoopNestedWithContinuing) { - Func("a_statement", {}, ty.void_(), {}); + Func("a_statement", {}, ty.void_(), utils::Empty); - Global("lhs", ty.f32(), ast::StorageClass::kPrivate); - Global("rhs", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("lhs", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.f32(), ast::StorageClass::kPrivate); auto* body = Block(create()); auto* continuing = Block(CallStmt(Call("a_statement"))); @@ -107,10 +107,10 @@ TEST_F(MslGeneratorImplTest, Emit_LoopWithVarUsedInContinuing) { // } // - Global("rhs", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("rhs", ty.f32(), ast::StorageClass::kPrivate); - auto* body = Block(Decl(Var("lhs", ty.f32(), Expr(2.4f))), // - Decl(Var("other", ty.f32())), // + auto* body = Block(Decl(Var("lhs", ty.f32(), Expr(2.4_f))), // + Decl(Var("other", ty.f32())), // Break()); auto* continuing = Block(Assign("lhs", "rhs")); @@ -181,10 +181,10 @@ TEST_F(MslGeneratorImplTest, Emit_ForLoopWithMultiStmtInit) { // return; // } - Func("f", {Param("i", ty.i32())}, ty.void_(), {}); + Func("f", utils::Vector{Param("i", ty.i32())}, ty.void_(), utils::Empty); auto f = [&](auto&& expr) { return CallStmt(Call("f", expr)); }; - Global("a", ty.atomic(), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.atomic(), ast::StorageClass::kWorkgroup); auto* multi_stmt = Block(f(1_i), f(2_i)); auto* loop = For(multi_stmt, nullptr, nullptr, // Block(Return())); @@ -257,10 +257,10 @@ TEST_F(MslGeneratorImplTest, Emit_ForLoopWithMultiStmtCont) { // return; // } - Func("f", {Param("i", ty.i32())}, ty.void_(), {}); + Func("f", utils::Vector{Param("i", ty.i32())}, ty.void_(), utils::Empty); auto f = [&](auto&& expr) { return CallStmt(Call("f", expr)); }; - Global("a", ty.atomic(), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.atomic(), ast::StorageClass::kWorkgroup); auto* multi_stmt = Block(f(1_i), f(2_i)); auto* loop = For(nullptr, nullptr, multi_stmt, // Block(Return())); @@ -286,7 +286,7 @@ TEST_F(MslGeneratorImplTest, Emit_ForLoopWithSimpleInitCondCont) { // return; // } - Func("a_statement", {}, ty.void_(), {}); + Func("a_statement", {}, ty.void_(), utils::Empty); auto* f = For(Decl(Var("i", ty.i32())), true, Assign("i", Add("i", 1_i)), Block(CallStmt(Call("a_statement")))); @@ -312,10 +312,10 @@ TEST_F(MslGeneratorImplTest, Emit_ForLoopWithMultiStmtInitCondCont) { // return; // } - Func("f", {Param("i", ty.i32())}, ty.void_(), {}); + Func("f", utils::Vector{Param("i", ty.i32())}, ty.void_(), utils::Empty); auto f = [&](auto&& expr) { return CallStmt(Call("f", expr)); }; - Global("a", ty.atomic(), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.atomic(), ast::StorageClass::kWorkgroup); auto* multi_stmt_a = Block(f(1_i), f(2_i)); auto* multi_stmt_b = Block(f(3_i), f(4_i)); auto* loop = For(multi_stmt_a, Expr(true), multi_stmt_b, // @@ -344,5 +344,64 @@ TEST_F(MslGeneratorImplTest, Emit_ForLoopWithMultiStmtInitCondCont) { )"); } +TEST_F(MslGeneratorImplTest, Emit_While) { + // while(true) { + // return; + // } + + auto* f = While(Expr(true), Block(Return())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( while(true) { + return; + } +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_While_WithContinue) { + // while(true) { + // continue; + // } + + auto* f = While(Expr(true), Block(Continue())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( while(true) { + continue; + } +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_WhileWithMultiCond) { + // while(true && false) { + // return; + // } + + auto* multi_stmt = + create(ast::BinaryOp::kLogicalAnd, Expr(true), Expr(false)); + auto* f = While(multi_stmt, Block(Return())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( while((true && false)) { + return; + } +)"); +} + } // namespace } // namespace tint::writer::msl diff --git a/src/tint/writer/msl/generator_impl_member_accessor_test.cc b/src/tint/writer/msl/generator_impl_member_accessor_test.cc index c9f3da074a..e1899103ef 100644 --- a/src/tint/writer/msl/generator_impl_member_accessor_test.cc +++ b/src/tint/writer/msl/generator_impl_member_accessor_test.cc @@ -20,8 +20,8 @@ namespace { using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, EmitExpression_MemberAccessor) { - Global("str", ty.Of(Structure("my_str", {Member("mem", ty.f32())})), - ast::StorageClass::kPrivate); + GlobalVar("str", ty.Of(Structure("my_str", utils::Vector{Member("mem", ty.f32())})), + ast::StorageClass::kPrivate); auto* expr = MemberAccessor("str", "mem"); WrapInFunction(expr); @@ -33,7 +33,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_MemberAccessor) { } TEST_F(MslGeneratorImplTest, EmitExpression_MemberAccessor_Swizzle_xyz) { - Global("my_vec", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("my_vec", ty.vec4(), ast::StorageClass::kPrivate); auto* expr = MemberAccessor("my_vec", "xyz"); WrapInFunction(expr); @@ -45,7 +45,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_MemberAccessor_Swizzle_xyz) { } TEST_F(MslGeneratorImplTest, EmitExpression_MemberAccessor_Swizzle_gbr) { - Global("my_vec", ty.vec4(), ast::StorageClass::kPrivate); + GlobalVar("my_vec", ty.vec4(), ast::StorageClass::kPrivate); auto* expr = MemberAccessor("my_vec", "gbr"); WrapInFunction(expr); diff --git a/src/tint/writer/msl/generator_impl_module_constant_test.cc b/src/tint/writer/msl/generator_impl_module_constant_test.cc index 59cc2eb252..fd7b5d6f03 100644 --- a/src/tint/writer/msl/generator_impl_module_constant_test.cc +++ b/src/tint/writer/msl/generator_impl_module_constant_test.cc @@ -15,43 +15,336 @@ #include "src/tint/ast/id_attribute.h" #include "src/tint/writer/msl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::msl { namespace { using MslGeneratorImplTest = TestHelper; -TEST_F(MslGeneratorImplTest, Emit_ModuleConstant) { - auto* var = GlobalConst("pos", ty.array(), array(1.f, 2.f, 3.f)); +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_AInt) { + auto* var = GlobalConst("G", Expr(1_a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error(); - EXPECT_EQ(gen.result(), "constant float pos[3] = {1.0f, 2.0f, 3.0f};\n"); + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + int const l = 1; } -TEST_F(MslGeneratorImplTest, Emit_SpecConstant) { - auto* var = Override("pos", ty.f32(), Expr(3.f), - ast::AttributeList{ - Id(23), - }); +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_AFloat) { + auto* var = GlobalConst("G", Expr(1._a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error(); + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float const l = 1.0f; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_i32) { + auto* var = GlobalConst("G", Expr(1_i)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + int const l = 1; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_u32) { + auto* var = GlobalConst("G", Expr(1_u)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + uint const l = 1u; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_f32) { + auto* var = GlobalConst("G", Expr(1_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float const l = 1.0f; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalConst("G", Expr(1_h)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + half const l = 1.0h; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_vec3_AInt) { + auto* var = GlobalConst("G", Construct(ty.vec3(nullptr), 1_a, 2_a, 3_a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + int3 const l = int3(1, 2, 3); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_vec3_AFloat) { + auto* var = GlobalConst("G", Construct(ty.vec3(nullptr), 1._a, 2._a, 3._a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float3 const l = float3(1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_vec3_f32) { + auto* var = GlobalConst("G", vec3(1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float3 const l = float3(1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_vec3_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalConst("G", vec3(1_h, 2_h, 3_h)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + half3 const l = half3(1.0h, 2.0h, 3.0h); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_mat2x3_AFloat) { + auto* var = + GlobalConst("G", Construct(ty.mat(nullptr, 2, 3), 1._a, 2._a, 3._a, 4._a, 5._a, 6._a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float2x3 const l = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_mat2x3_f32) { + auto* var = GlobalConst("G", mat2x3(1_f, 2_f, 3_f, 4_f, 5_f, 6_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float2x3 const l = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_mat2x3_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalConst("G", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + half2x3 const l = half2x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h)); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_arr_f32) { + auto* var = GlobalConst("G", Construct(ty.array(), 1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + tint_array const l = tint_array{1.0f, 2.0f, 3.0f}; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_GlobalConst_arr_vec2_bool) { + auto* var = GlobalConst("G", Construct(ty.array(ty.vec2(), 3_u), // + vec2(true, false), // + vec2(false, true), // + vec2(true, true))); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + tint_array const l = tint_array{bool2(true, false), bool2(false, true), bool2(true)}; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_Override) { + auto* var = Override("pos", ty.f32(), Expr(3_f), Id(23)); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitOverride(var)) << gen.error(); EXPECT_EQ(gen.result(), "constant float pos [[function_constant(23)]];\n"); } -TEST_F(MslGeneratorImplTest, Emit_SpecConstant_NoId) { - auto* var_a = Override("a", ty.f32(), nullptr, - ast::AttributeList{ - Id(0), - }); - auto* var_b = Override("b", ty.f32(), nullptr); +TEST_F(MslGeneratorImplTest, Emit_Override_NoId) { + auto* var_a = Override("a", ty.f32(), Id(0)); + auto* var_b = Override("b", ty.f32()); GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitProgramConstVariable(var_a)) << gen.error(); - ASSERT_TRUE(gen.EmitProgramConstVariable(var_b)) << gen.error(); + ASSERT_TRUE(gen.EmitOverride(var_a)) << gen.error(); + ASSERT_TRUE(gen.EmitOverride(var_b)) << gen.error(); EXPECT_EQ(gen.result(), R"(constant float a [[function_constant(0)]]; constant float b [[function_constant(1)]]; )"); diff --git a/src/tint/writer/msl/generator_impl_return_test.cc b/src/tint/writer/msl/generator_impl_return_test.cc index 144320962b..c9c3de786e 100644 --- a/src/tint/writer/msl/generator_impl_return_test.cc +++ b/src/tint/writer/msl/generator_impl_return_test.cc @@ -35,7 +35,7 @@ TEST_F(MslGeneratorImplTest, Emit_Return) { TEST_F(MslGeneratorImplTest, Emit_ReturnWithValue) { auto* r = Return(123_i); - Func("f", {}, ty.i32(), {r}); + Func("f", utils::Empty, ty.i32(), utils::Vector{r}); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/msl/generator_impl_sanitizer_test.cc b/src/tint/writer/msl/generator_impl_sanitizer_test.cc index 32ddb42700..472822bc4a 100644 --- a/src/tint/writer/msl/generator_impl_sanitizer_test.cc +++ b/src/tint/writer/msl/generator_impl_sanitizer_test.cc @@ -26,19 +26,14 @@ using ::testing::HasSubstr; using MslSanitizerTest = TestHelper; TEST_F(MslSanitizerTest, Call_ArrayLength) { - auto* s = Structure("my_struct", {Member(0, "a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array(4))}); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, - Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -50,12 +45,25 @@ TEST_F(MslSanitizerTest, Call_ArrayLength) { auto* expect = R"(#include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; struct my_struct { - float a[1]; + tint_array a; }; fragment void a_func(const constant tint_symbol* tint_symbol_2 [[buffer(30)]]) { @@ -68,22 +76,17 @@ fragment void a_func(const constant tint_symbol* tint_symbol_2 [[buffer(30)]]) { } TEST_F(MslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) { - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member(0, "z", ty.f32()), Member(4, "a", ty.array(4)), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, - Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -95,13 +98,26 @@ TEST_F(MslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) { auto* expect = R"(#include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; struct my_struct { float z; - float a[1]; + tint_array a; }; fragment void a_func(const constant tint_symbol* tint_symbol_2 [[buffer(30)]]) { @@ -115,23 +131,19 @@ fragment void a_func(const constant tint_symbol* tint_symbol_2 [[buffer(30)]]) { } TEST_F(MslSanitizerTest, Call_ArrayLength_ViaLets) { - auto* s = Structure("my_struct", {Member(0, "a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array(4))}); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - auto* p = Let("p", nullptr, AddressOf("b")); - auto* p2 = Let("p2", nullptr, AddressOf(MemberAccessor(Deref(p), "a"))); + auto* p = Let("p", AddressOf("b")); + auto* p2 = Let("p2", AddressOf(MemberAccessor(Deref(p), "a"))); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(p), Decl(p2), - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, Call("arrayLength", p2))), + Decl(Var("len", ty.u32(), Call("arrayLength", p2))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -143,12 +155,25 @@ TEST_F(MslSanitizerTest, Call_ArrayLength_ViaLets) { auto* expect = R"(#include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; struct my_struct { - float a[1]; + tint_array a; }; fragment void a_func(const constant tint_symbol* tint_symbol_2 [[buffer(30)]]) { @@ -162,25 +187,17 @@ fragment void a_func(const constant tint_symbol* tint_symbol_2 [[buffer(30)]]) { } TEST_F(MslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniform) { - auto* s = Structure("my_struct", {Member(0, "a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(0), - }); - Global("c", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(2), - create(0), - }); + auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array(4))}); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(0)); + GlobalVar("c", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(2), Group(0)); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("len", ty.u32(), Add(Call("arrayLength", AddressOf(MemberAccessor("b", "a"))), Call("arrayLength", AddressOf(MemberAccessor("c", "a")))))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -196,12 +213,25 @@ TEST_F(MslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniform) { auto* expect = R"(#include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol { - /* 0x0000 */ uint4 buffer_size[2]; + /* 0x0000 */ tint_array buffer_size; }; struct my_struct { - float a[1]; + tint_array a; }; fragment void a_func(const constant tint_symbol* tint_symbol_2 [[buffer(29)]]) { @@ -214,25 +244,17 @@ fragment void a_func(const constant tint_symbol* tint_symbol_2 [[buffer(29)]]) { } TEST_F(MslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniformMissingBinding) { - auto* s = Structure("my_struct", {Member(0, "a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(0), - }); - Global("c", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(2), - create(0), - }); + auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array(4))}); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(0)); + GlobalVar("c", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(2), Group(0)); - Func("a_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ - Decl(Var("len", ty.u32(), ast::StorageClass::kNone, + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("len", ty.u32(), Add(Call("arrayLength", AddressOf(MemberAccessor("b", "a"))), Call("arrayLength", AddressOf(MemberAccessor("c", "a")))))), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); diff --git a/src/tint/writer/msl/generator_impl_static_assert_test.cc b/src/tint/writer/msl/generator_impl_static_assert_test.cc new file mode 100644 index 0000000000..5b8ca3fd94 --- /dev/null +++ b/src/tint/writer/msl/generator_impl_static_assert_test.cc @@ -0,0 +1,54 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/writer/msl/test_helper.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::writer::msl { +namespace { + +using MslGeneratorImplTest = TestHelper; + +TEST_F(MslGeneratorImplTest, Emit_GlobalStaticAssert) { + GlobalStaticAssert(true); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + // static asserts are not emitted + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_FunctionStaticAssert) { + Func("f", utils::Empty, ty.void_(), utils::Vector{StaticAssert(true)}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + // static asserts are not emitted + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { +} + +)"); +} + +} // namespace +} // namespace tint::writer::msl diff --git a/src/tint/writer/msl/generator_impl_switch_test.cc b/src/tint/writer/msl/generator_impl_switch_test.cc index ce8087b0a3..b327f34f36 100644 --- a/src/tint/writer/msl/generator_impl_switch_test.cc +++ b/src/tint/writer/msl/generator_impl_switch_test.cc @@ -25,19 +25,15 @@ TEST_F(MslGeneratorImplTest, Emit_Switch) { auto* cond = Var("cond", ty.i32()); auto* def_body = Block(create()); - auto* def = create(ast::CaseSelectorList{}, def_body); + auto* def = create(utils::Empty, def_body); - ast::CaseSelectorList case_val; - case_val.push_back(Expr(5_i)); + utils::Vector case_val{Expr(5_i)}; auto* case_body = Block(create()); auto* case_stmt = create(case_val, case_body); - ast::CaseStatementList body; - body.push_back(case_stmt); - body.push_back(def); - + utils::Vector body{case_stmt, def}; auto* s = create(Expr(cond), body); WrapInFunction(cond, s); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/msl/generator_impl_test.cc b/src/tint/writer/msl/generator_impl_test.cc index b5af8e4646..9b3d0bc150 100644 --- a/src/tint/writer/msl/generator_impl_test.cc +++ b/src/tint/writer/msl/generator_impl_test.cc @@ -22,9 +22,18 @@ namespace { using MslGeneratorImplTest = TestHelper; +TEST_F(MslGeneratorImplTest, InvalidProgram) { + Diagnostics().add_error(diag::System::Writer, "make the program invalid"); + ASSERT_FALSE(IsValid()); + auto program = std::make_unique(std::move(*this)); + ASSERT_FALSE(program->IsValid()); + auto result = Generate(program.get(), Options{}); + EXPECT_EQ(result.error, "input program is not valid"); +} + TEST_F(MslGeneratorImplTest, Generate) { - Func("my_func", ast::VariableList{}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + Func("my_func", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -43,7 +52,7 @@ kernel void my_func() { } struct MslBuiltinData { - ast::Builtin builtin; + ast::BuiltinValue builtin; const char* attribute_name; }; inline std::ostream& operator<<(std::ostream& out, MslBuiltinData data) { @@ -62,25 +71,32 @@ INSTANTIATE_TEST_SUITE_P( MslGeneratorImplTest, MslBuiltinConversionTest, testing::Values( - MslBuiltinData{ast::Builtin::kPosition, "position"}, - MslBuiltinData{ast::Builtin::kVertexIndex, "vertex_id"}, - MslBuiltinData{ast::Builtin::kInstanceIndex, "instance_id"}, - MslBuiltinData{ast::Builtin::kFrontFacing, "front_facing"}, - MslBuiltinData{ast::Builtin::kFragDepth, "depth(any)"}, - MslBuiltinData{ast::Builtin::kLocalInvocationId, "thread_position_in_threadgroup"}, - MslBuiltinData{ast::Builtin::kLocalInvocationIndex, "thread_index_in_threadgroup"}, - MslBuiltinData{ast::Builtin::kGlobalInvocationId, "thread_position_in_grid"}, - MslBuiltinData{ast::Builtin::kWorkgroupId, "threadgroup_position_in_grid"}, - MslBuiltinData{ast::Builtin::kNumWorkgroups, "threadgroups_per_grid"}, - MslBuiltinData{ast::Builtin::kSampleIndex, "sample_id"}, - MslBuiltinData{ast::Builtin::kSampleMask, "sample_mask"}, - MslBuiltinData{ast::Builtin::kPointSize, "point_size"})); + MslBuiltinData{ast::BuiltinValue::kPosition, "position"}, + MslBuiltinData{ast::BuiltinValue::kVertexIndex, "vertex_id"}, + MslBuiltinData{ast::BuiltinValue::kInstanceIndex, "instance_id"}, + MslBuiltinData{ast::BuiltinValue::kFrontFacing, "front_facing"}, + MslBuiltinData{ast::BuiltinValue::kFragDepth, "depth(any)"}, + MslBuiltinData{ast::BuiltinValue::kLocalInvocationId, "thread_position_in_threadgroup"}, + MslBuiltinData{ast::BuiltinValue::kLocalInvocationIndex, "thread_index_in_threadgroup"}, + MslBuiltinData{ast::BuiltinValue::kGlobalInvocationId, "thread_position_in_grid"}, + MslBuiltinData{ast::BuiltinValue::kWorkgroupId, "threadgroup_position_in_grid"}, + MslBuiltinData{ast::BuiltinValue::kNumWorkgroups, "threadgroups_per_grid"}, + MslBuiltinData{ast::BuiltinValue::kSampleIndex, "sample_id"}, + MslBuiltinData{ast::BuiltinValue::kSampleMask, "sample_mask"}, + MslBuiltinData{ast::BuiltinValue::kPointSize, "point_size"})); TEST_F(MslGeneratorImplTest, HasInvariantAttribute_True) { - auto* out = Structure( - "Out", {Member("pos", ty.vec4(), {Builtin(ast::Builtin::kPosition), Invariant()})}); - Func("vert_main", ast::VariableList{}, ty.Of(out), {Return(Construct(ty.Of(out)))}, - {Stage(ast::PipelineStage::kVertex)}); + auto* out = Structure("Out", utils::Vector{ + Member("pos", ty.vec4(), + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + Invariant(), + }), + }); + Func("vert_main", utils::Empty, ty.Of(out), utils::Vector{Return(Construct(ty.Of(out)))}, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }); GeneratorImpl& gen = Build(); @@ -101,17 +117,23 @@ struct Out { }; vertex Out vert_main() { - return {}; + return Out{}; } )"); } TEST_F(MslGeneratorImplTest, HasInvariantAttribute_False) { - auto* out = - Structure("Out", {Member("pos", ty.vec4(), {Builtin(ast::Builtin::kPosition)})}); - Func("vert_main", ast::VariableList{}, ty.Of(out), {Return(Construct(ty.Of(out)))}, - {Stage(ast::PipelineStage::kVertex)}); + auto* out = Structure("Out", utils::Vector{ + Member("pos", ty.vec4(), + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }), + }); + Func("vert_main", utils::Empty, ty.Of(out), utils::Vector{Return(Construct(ty.Of(out)))}, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }); GeneratorImpl& gen = Build(); @@ -125,16 +147,19 @@ struct Out { }; vertex Out vert_main() { - return {}; + return Out{}; } )"); } TEST_F(MslGeneratorImplTest, WorkgroupMatrix) { - Global("m", ty.mat2x2(), ast::StorageClass::kWorkgroup); - Func("comp_main", ast::VariableList{}, ty.void_(), {Decl(Let("x", nullptr, Expr("m")))}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + GlobalVar("m", ty.mat2x2(), ast::StorageClass::kWorkgroup); + Func("comp_main", utils::Empty, ty.void_(), utils::Vector{Decl(Let("x", Expr("m")))}, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -148,7 +173,7 @@ struct tint_symbol_3 { void comp_main_inner(uint local_invocation_index, threadgroup float2x2* const tint_symbol) { { - *(tint_symbol) = float2x2(); + *(tint_symbol) = float2x2(float2(0.0f), float2(0.0f)); } threadgroup_barrier(mem_flags::mem_threadgroup); float2x2 const x = *(tint_symbol); @@ -169,9 +194,12 @@ kernel void comp_main(threadgroup tint_symbol_3* tint_symbol_2 [[threadgroup(0)] } TEST_F(MslGeneratorImplTest, WorkgroupMatrixInArray) { - Global("m", ty.array(ty.mat2x2(), 4_i), ast::StorageClass::kWorkgroup); - Func("comp_main", ast::VariableList{}, ty.void_(), {Decl(Let("x", nullptr, Expr("m")))}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + GlobalVar("m", ty.array(ty.mat2x2(), 4_i), ast::StorageClass::kWorkgroup); + Func("comp_main", utils::Empty, ty.void_(), utils::Vector{Decl(Let("x", Expr("m")))}, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -179,25 +207,34 @@ TEST_F(MslGeneratorImplTest, WorkgroupMatrixInArray) { EXPECT_EQ(gen.result(), R"(#include using namespace metal; -struct tint_array_wrapper { - float2x2 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct tint_symbol_3 { - tint_array_wrapper m; + tint_array m; }; -void comp_main_inner(uint local_invocation_index, threadgroup tint_array_wrapper* const tint_symbol) { +void comp_main_inner(uint local_invocation_index, threadgroup tint_array* const tint_symbol) { for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { uint const i = idx; - (*(tint_symbol)).arr[i] = float2x2(); + (*(tint_symbol))[i] = float2x2(float2(0.0f), float2(0.0f)); } threadgroup_barrier(mem_flags::mem_threadgroup); - tint_array_wrapper const x = *(tint_symbol); + tint_array const x = *(tint_symbol); } kernel void comp_main(threadgroup tint_symbol_3* tint_symbol_2 [[threadgroup(0)]], uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup tint_array_wrapper* const tint_symbol_1 = &((*(tint_symbol_2)).m); + threadgroup tint_array* const tint_symbol_1 = &((*(tint_symbol_2)).m); comp_main_inner(local_invocation_index, tint_symbol_1); return; } @@ -211,16 +248,19 @@ kernel void comp_main(threadgroup tint_symbol_3* tint_symbol_2 [[threadgroup(0)] } TEST_F(MslGeneratorImplTest, WorkgroupMatrixInStruct) { - Structure("S1", { + Structure("S1", utils::Vector{ Member("m1", ty.mat2x2()), Member("m2", ty.mat4x4()), }); - Structure("S2", { + Structure("S2", utils::Vector{ Member("s", ty.type_name("S1")), }); - Global("s", ty.type_name("S2"), ast::StorageClass::kWorkgroup); - Func("comp_main", ast::VariableList{}, ty.void_(), {Decl(Let("x", nullptr, Expr("s")))}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + GlobalVar("s", ty.type_name("S2"), ast::StorageClass::kWorkgroup); + Func("comp_main", utils::Empty, ty.void_(), utils::Vector{Decl(Let("x", Expr("s")))}, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -243,7 +283,7 @@ struct tint_symbol_4 { void comp_main_inner(uint local_invocation_index, threadgroup S2* const tint_symbol_1) { { - S2 const tint_symbol = {}; + S2 const tint_symbol = S2{}; *(tint_symbol_1) = tint_symbol; } threadgroup_barrier(mem_flags::mem_threadgroup); @@ -265,38 +305,50 @@ kernel void comp_main(threadgroup tint_symbol_4* tint_symbol_3 [[threadgroup(0)] } TEST_F(MslGeneratorImplTest, WorkgroupMatrix_Multiples) { - Global("m1", ty.mat2x2(), ast::StorageClass::kWorkgroup); - Global("m2", ty.mat2x3(), ast::StorageClass::kWorkgroup); - Global("m3", ty.mat2x4(), ast::StorageClass::kWorkgroup); - Global("m4", ty.mat3x2(), ast::StorageClass::kWorkgroup); - Global("m5", ty.mat3x3(), ast::StorageClass::kWorkgroup); - Global("m6", ty.mat3x4(), ast::StorageClass::kWorkgroup); - Global("m7", ty.mat4x2(), ast::StorageClass::kWorkgroup); - Global("m8", ty.mat4x3(), ast::StorageClass::kWorkgroup); - Global("m9", ty.mat4x4(), ast::StorageClass::kWorkgroup); - Func("main1", ast::VariableList{}, ty.void_(), - { - Decl(Let("a1", nullptr, Expr("m1"))), - Decl(Let("a2", nullptr, Expr("m2"))), - Decl(Let("a3", nullptr, Expr("m3"))), + GlobalVar("m1", ty.mat2x2(), ast::StorageClass::kWorkgroup); + GlobalVar("m2", ty.mat2x3(), ast::StorageClass::kWorkgroup); + GlobalVar("m3", ty.mat2x4(), ast::StorageClass::kWorkgroup); + GlobalVar("m4", ty.mat3x2(), ast::StorageClass::kWorkgroup); + GlobalVar("m5", ty.mat3x3(), ast::StorageClass::kWorkgroup); + GlobalVar("m6", ty.mat3x4(), ast::StorageClass::kWorkgroup); + GlobalVar("m7", ty.mat4x2(), ast::StorageClass::kWorkgroup); + GlobalVar("m8", ty.mat4x3(), ast::StorageClass::kWorkgroup); + GlobalVar("m9", ty.mat4x4(), ast::StorageClass::kWorkgroup); + Func("main1", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("a1", Expr("m1"))), + Decl(Let("a2", Expr("m2"))), + Decl(Let("a3", Expr("m3"))), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); - Func("main2", ast::VariableList{}, ty.void_(), - { - Decl(Let("a1", nullptr, Expr("m4"))), - Decl(Let("a2", nullptr, Expr("m5"))), - Decl(Let("a3", nullptr, Expr("m6"))), + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); + Func("main2", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("a1", Expr("m4"))), + Decl(Let("a2", Expr("m5"))), + Decl(Let("a3", Expr("m6"))), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); - Func("main3", ast::VariableList{}, ty.void_(), - { - Decl(Let("a1", nullptr, Expr("m7"))), - Decl(Let("a2", nullptr, Expr("m8"))), - Decl(Let("a3", nullptr, Expr("m9"))), + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); + Func("main3", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("a1", Expr("m7"))), + Decl(Let("a2", Expr("m8"))), + Decl(Let("a3", Expr("m9"))), }, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); - Func("main4_no_usages", ast::VariableList{}, ty.void_(), {}, - {Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); + Func("main4_no_usages", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kCompute), + WorkgroupSize(1_i), + }); GeneratorImpl& gen = SanitizeAndBuild(); @@ -324,9 +376,9 @@ struct tint_symbol_23 { void main1_inner(uint local_invocation_index, threadgroup float2x2* const tint_symbol, threadgroup float2x3* const tint_symbol_1, threadgroup float2x4* const tint_symbol_2) { { - *(tint_symbol) = float2x2(); - *(tint_symbol_1) = float2x3(); - *(tint_symbol_2) = float2x4(); + *(tint_symbol) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_1) = float2x3(float3(0.0f), float3(0.0f)); + *(tint_symbol_2) = float2x4(float4(0.0f), float4(0.0f)); } threadgroup_barrier(mem_flags::mem_threadgroup); float2x2 const a1 = *(tint_symbol); @@ -344,9 +396,9 @@ kernel void main1(threadgroup tint_symbol_7* tint_symbol_4 [[threadgroup(0)]], u void main2_inner(uint local_invocation_index_1, threadgroup float3x2* const tint_symbol_8, threadgroup float3x3* const tint_symbol_9, threadgroup float3x4* const tint_symbol_10) { { - *(tint_symbol_8) = float3x2(); - *(tint_symbol_9) = float3x3(); - *(tint_symbol_10) = float3x4(); + *(tint_symbol_8) = float3x2(float2(0.0f), float2(0.0f), float2(0.0f)); + *(tint_symbol_9) = float3x3(float3(0.0f), float3(0.0f), float3(0.0f)); + *(tint_symbol_10) = float3x4(float4(0.0f), float4(0.0f), float4(0.0f)); } threadgroup_barrier(mem_flags::mem_threadgroup); float3x2 const a1 = *(tint_symbol_8); @@ -364,9 +416,9 @@ kernel void main2(threadgroup tint_symbol_15* tint_symbol_12 [[threadgroup(0)]], void main3_inner(uint local_invocation_index_2, threadgroup float4x2* const tint_symbol_16, threadgroup float4x3* const tint_symbol_17, threadgroup float4x4* const tint_symbol_18) { { - *(tint_symbol_16) = float4x2(); - *(tint_symbol_17) = float4x3(); - *(tint_symbol_18) = float4x4(); + *(tint_symbol_16) = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f)); + *(tint_symbol_17) = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f)); + *(tint_symbol_18) = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f)); } threadgroup_barrier(mem_flags::mem_threadgroup); float4x2 const a1 = *(tint_symbol_16); diff --git a/src/tint/writer/msl/generator_impl_type_test.cc b/src/tint/writer/msl/generator_impl_type_test.cc index 257468bff3..531a45d72e 100644 --- a/src/tint/writer/msl/generator_impl_type_test.cc +++ b/src/tint/writer/msl/generator_impl_type_test.cc @@ -31,6 +31,20 @@ using namespace tint::number_suffixes; // NOLINT namespace tint::writer::msl { namespace { +void FormatMSLField(std::stringstream& out, + const char* addr, + const char* type, + size_t array_count, + const char* name) { + out << " /* " << std::string(addr) << " */ "; + if (array_count == 0) { + out << type << " "; + } else { + out << "tint_array<" << type << ", " << std::to_string(array_count) << "> "; + } + out << name << ";\n"; +} + #define CHECK_TYPE_SIZE_AND_ALIGN(TYPE, SIZE, ALIGN) \ static_assert(sizeof(TYPE) == SIZE, "Bad type size"); \ static_assert(alignof(TYPE) == ALIGN, "Bad type alignment") @@ -57,66 +71,78 @@ DECLARE_TYPE(float3x4, 48, 16); DECLARE_TYPE(float4x2, 32, 8); DECLARE_TYPE(float4x3, 64, 16); DECLARE_TYPE(float4x4, 64, 16); +DECLARE_TYPE(half2, 4, 4); +DECLARE_TYPE(packed_half3, 6, 2); +DECLARE_TYPE(half4, 8, 8); +DECLARE_TYPE(half2x2, 8, 4); +DECLARE_TYPE(half2x3, 16, 8); +DECLARE_TYPE(half2x4, 16, 8); +DECLARE_TYPE(half3x2, 12, 4); +DECLARE_TYPE(half3x3, 24, 8); +DECLARE_TYPE(half3x4, 24, 8); +DECLARE_TYPE(half4x2, 16, 4); +DECLARE_TYPE(half4x3, 32, 8); +DECLARE_TYPE(half4x4, 32, 8); using uint = unsigned int; using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, EmitType_Array) { auto* arr = ty.array(); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); std::stringstream out; ASSERT_TRUE(gen.EmitType(out, program->TypeOf(arr), "ary")) << gen.error(); - EXPECT_EQ(out.str(), "bool ary[4]"); + EXPECT_EQ(out.str(), "tint_array"); } TEST_F(MslGeneratorImplTest, EmitType_ArrayOfArray) { auto* a = ty.array(); auto* b = ty.array(a, 5_u); - Global("G", b, ast::StorageClass::kPrivate); + GlobalVar("G", b, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); std::stringstream out; ASSERT_TRUE(gen.EmitType(out, program->TypeOf(b), "ary")) << gen.error(); - EXPECT_EQ(out.str(), "bool ary[5][4]"); + EXPECT_EQ(out.str(), "tint_array, 5>"); } TEST_F(MslGeneratorImplTest, EmitType_ArrayOfArrayOfArray) { auto* a = ty.array(); auto* b = ty.array(a, 5_u); auto* c = ty.array(b, 6_u); - Global("G", c, ast::StorageClass::kPrivate); + GlobalVar("G", c, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); std::stringstream out; ASSERT_TRUE(gen.EmitType(out, program->TypeOf(c), "ary")) << gen.error(); - EXPECT_EQ(out.str(), "bool ary[6][5][4]"); + EXPECT_EQ(out.str(), "tint_array, 5>, 6>"); } TEST_F(MslGeneratorImplTest, EmitType_Array_WithoutName) { auto* arr = ty.array(); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); std::stringstream out; ASSERT_TRUE(gen.EmitType(out, program->TypeOf(arr), "")) << gen.error(); - EXPECT_EQ(out.str(), "bool[4]"); + EXPECT_EQ(out.str(), "tint_array"); } TEST_F(MslGeneratorImplTest, EmitType_RuntimeArray) { auto* arr = ty.array(); - Global("G", arr, ast::StorageClass::kPrivate); + GlobalVar("G", arr, ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); std::stringstream out; ASSERT_TRUE(gen.EmitType(out, program->TypeOf(arr), "ary")) << gen.error(); - EXPECT_EQ(out.str(), "bool ary[1]"); + EXPECT_EQ(out.str(), "tint_array"); } TEST_F(MslGeneratorImplTest, EmitType_Bool) { @@ -139,6 +165,16 @@ TEST_F(MslGeneratorImplTest, EmitType_F32) { EXPECT_EQ(out.str(), "float"); } +TEST_F(MslGeneratorImplTest, EmitType_F16) { + auto* f16 = create(); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, f16, "")) << gen.error(); + EXPECT_EQ(out.str(), "half"); +} + TEST_F(MslGeneratorImplTest, EmitType_I32) { auto* i32 = create(); @@ -149,7 +185,7 @@ TEST_F(MslGeneratorImplTest, EmitType_I32) { EXPECT_EQ(out.str(), "int"); } -TEST_F(MslGeneratorImplTest, EmitType_Matrix) { +TEST_F(MslGeneratorImplTest, EmitType_Matrix_F32) { auto* f32 = create(); auto* vec3 = create(f32, 3u); auto* mat2x3 = create(vec3, 2u); @@ -161,6 +197,18 @@ TEST_F(MslGeneratorImplTest, EmitType_Matrix) { EXPECT_EQ(out.str(), "float2x3"); } +TEST_F(MslGeneratorImplTest, EmitType_Matrix_F16) { + auto* f16 = create(); + auto* vec3 = create(f16, 3u); + auto* mat2x3 = create(vec3, 2u); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, mat2x3, "")) << gen.error(); + EXPECT_EQ(out.str(), "half2x3"); +} + TEST_F(MslGeneratorImplTest, EmitType_Pointer) { auto* f32 = create(); auto* p = create(f32, ast::StorageClass::kWorkgroup, ast::Access::kReadWrite); @@ -173,7 +221,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Pointer) { } TEST_F(MslGeneratorImplTest, EmitType_Struct) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); @@ -186,7 +234,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct) { } TEST_F(MslGeneratorImplTest, EmitType_StructDecl) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); @@ -204,40 +252,37 @@ TEST_F(MslGeneratorImplTest, EmitType_StructDecl) { } TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_NonComposites) { - auto* s = Structure("S", { - Member("a", ty.i32(), {MemberSize(32)}), - Member("b", ty.f32(), {MemberAlign(128), MemberSize(128)}), - Member("c", ty.vec2()), - Member("d", ty.u32()), - Member("e", ty.vec3()), - Member("f", ty.u32()), - Member("g", ty.vec4()), - Member("h", ty.u32()), - Member("i", ty.mat2x2()), - Member("j", ty.u32()), - Member("k", ty.mat2x3()), - Member("l", ty.u32()), - Member("m", ty.mat2x4()), - Member("n", ty.u32()), - Member("o", ty.mat3x2()), - Member("p", ty.u32()), - Member("q", ty.mat3x3()), - Member("r", ty.u32()), - Member("s", ty.mat3x4()), - Member("t", ty.u32()), - Member("u", ty.mat4x2()), - Member("v", ty.u32()), - Member("w", ty.mat4x3()), - Member("x", ty.u32()), - Member("y", ty.mat4x4()), - Member("z", ty.f32()), - }); + auto* s = Structure( + "S", utils::Vector{ + Member("a", ty.i32(), utils::Vector{MemberSize(32)}), + Member("b", ty.f32(), utils::Vector{MemberAlign(128_u), MemberSize(128)}), + Member("c", ty.vec2()), + Member("d", ty.u32()), + Member("e", ty.vec3()), + Member("f", ty.u32()), + Member("g", ty.vec4()), + Member("h", ty.u32()), + Member("i", ty.mat2x2()), + Member("j", ty.u32()), + Member("k", ty.mat2x3()), + Member("l", ty.u32()), + Member("m", ty.mat2x4()), + Member("n", ty.u32()), + Member("o", ty.mat3x2()), + Member("p", ty.u32()), + Member("q", ty.mat3x3()), + Member("r", ty.u32()), + Member("s", ty.mat3x4()), + Member("t", ty.u32()), + Member("u", ty.mat4x2()), + Member("v", ty.u32()), + Member("w", ty.mat4x3()), + Member("x", ty.u32()), + Member("y", ty.mat4x4()), + Member("z", ty.f32()), + }); - Global("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); GeneratorImpl& gen = Build(); @@ -245,54 +290,58 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_NonComposites) { auto* sem_s = program->TypeOf(s)->As(); ASSERT_TRUE(gen.EmitStructType(&buf, sem_s)) << gen.error(); - // ALL_FIELDS() calls the macro FIELD(ADDR, TYPE, NAME, SUFFIX) + // ALL_FIELDS() calls the macro FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) // for each field of the structure s. -#define ALL_FIELDS() \ - FIELD(0x0000, int, a, /*NO SUFFIX*/) \ - FIELD(0x0004, int8_t, tint_pad, [124]) \ - FIELD(0x0080, float, b, /*NO SUFFIX*/) \ - FIELD(0x0084, int8_t, tint_pad_1, [124]) \ - FIELD(0x0100, float2, c, /*NO SUFFIX*/) \ - FIELD(0x0108, uint, d, /*NO SUFFIX*/) \ - FIELD(0x010c, int8_t, tint_pad_2, [4]) \ - FIELD(0x0110, packed_float3, e, /*NO SUFFIX*/) \ - FIELD(0x011c, uint, f, /*NO SUFFIX*/) \ - FIELD(0x0120, float4, g, /*NO SUFFIX*/) \ - FIELD(0x0130, uint, h, /*NO SUFFIX*/) \ - FIELD(0x0134, int8_t, tint_pad_3, [4]) \ - FIELD(0x0138, float2x2, i, /*NO SUFFIX*/) \ - FIELD(0x0148, uint, j, /*NO SUFFIX*/) \ - FIELD(0x014c, int8_t, tint_pad_4, [4]) \ - FIELD(0x0150, float2x3, k, /*NO SUFFIX*/) \ - FIELD(0x0170, uint, l, /*NO SUFFIX*/) \ - FIELD(0x0174, int8_t, tint_pad_5, [12]) \ - FIELD(0x0180, float2x4, m, /*NO SUFFIX*/) \ - FIELD(0x01a0, uint, n, /*NO SUFFIX*/) \ - FIELD(0x01a4, int8_t, tint_pad_6, [4]) \ - FIELD(0x01a8, float3x2, o, /*NO SUFFIX*/) \ - FIELD(0x01c0, uint, p, /*NO SUFFIX*/) \ - FIELD(0x01c4, int8_t, tint_pad_7, [12]) \ - FIELD(0x01d0, float3x3, q, /*NO SUFFIX*/) \ - FIELD(0x0200, uint, r, /*NO SUFFIX*/) \ - FIELD(0x0204, int8_t, tint_pad_8, [12]) \ - FIELD(0x0210, float3x4, s, /*NO SUFFIX*/) \ - FIELD(0x0240, uint, t, /*NO SUFFIX*/) \ - FIELD(0x0244, int8_t, tint_pad_9, [4]) \ - FIELD(0x0248, float4x2, u, /*NO SUFFIX*/) \ - FIELD(0x0268, uint, v, /*NO SUFFIX*/) \ - FIELD(0x026c, int8_t, tint_pad_10, [4]) \ - FIELD(0x0270, float4x3, w, /*NO SUFFIX*/) \ - FIELD(0x02b0, uint, x, /*NO SUFFIX*/) \ - FIELD(0x02b4, int8_t, tint_pad_11, [12]) \ - FIELD(0x02c0, float4x4, y, /*NO SUFFIX*/) \ - FIELD(0x0300, float, z, /*NO SUFFIX*/) \ - FIELD(0x0304, int8_t, tint_pad_12, [124]) +#define ALL_FIELDS() \ + FIELD(0x0000, int, 0, a) \ + FIELD(0x0004, int8_t, 124, tint_pad) \ + FIELD(0x0080, float, 0, b) \ + FIELD(0x0084, int8_t, 124, tint_pad_1) \ + FIELD(0x0100, float2, 0, c) \ + FIELD(0x0108, uint, 0, d) \ + FIELD(0x010c, int8_t, 4, tint_pad_2) \ + FIELD(0x0110, packed_float3, 0, e) \ + FIELD(0x011c, uint, 0, f) \ + FIELD(0x0120, float4, 0, g) \ + FIELD(0x0130, uint, 0, h) \ + FIELD(0x0134, int8_t, 4, tint_pad_3) \ + FIELD(0x0138, float2x2, 0, i) \ + FIELD(0x0148, uint, 0, j) \ + FIELD(0x014c, int8_t, 4, tint_pad_4) \ + FIELD(0x0150, float2x3, 0, k) \ + FIELD(0x0170, uint, 0, l) \ + FIELD(0x0174, int8_t, 12, tint_pad_5) \ + FIELD(0x0180, float2x4, 0, m) \ + FIELD(0x01a0, uint, 0, n) \ + FIELD(0x01a4, int8_t, 4, tint_pad_6) \ + FIELD(0x01a8, float3x2, 0, o) \ + FIELD(0x01c0, uint, 0, p) \ + FIELD(0x01c4, int8_t, 12, tint_pad_7) \ + FIELD(0x01d0, float3x3, 0, q) \ + FIELD(0x0200, uint, 0, r) \ + FIELD(0x0204, int8_t, 12, tint_pad_8) \ + FIELD(0x0210, float3x4, 0, s) \ + FIELD(0x0240, uint, 0, t) \ + FIELD(0x0244, int8_t, 4, tint_pad_9) \ + FIELD(0x0248, float4x2, 0, u) \ + FIELD(0x0268, uint, 0, v) \ + FIELD(0x026c, int8_t, 4, tint_pad_10) \ + FIELD(0x0270, float4x3, 0, w) \ + FIELD(0x02b0, uint, 0, x) \ + FIELD(0x02b4, int8_t, 12, tint_pad_11) \ + FIELD(0x02c0, float4x4, 0, y) \ + FIELD(0x0300, float, 0, z) \ + FIELD(0x0304, int8_t, 124, tint_pad_12) // Check that the generated string is as expected. -#define FIELD(ADDR, TYPE, NAME, SUFFIX) " /* " #ADDR " */ " #TYPE " " #NAME #SUFFIX ";\n" - auto* expect = "struct S {\n" ALL_FIELDS() "};\n"; + std::stringstream expect; + expect << "struct S {\n"; +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \ + FormatMSLField(expect, #ADDR, #TYPE, ARRAY_COUNT, #NAME); + ALL_FIELDS() #undef FIELD - EXPECT_EQ(buf.String(), expect); + expect << "};\n"; + EXPECT_EQ(buf.String(), expect.str()); // 1.4 Metal and C++14 // The Metal programming language is a C++14-based Specification with @@ -304,12 +353,12 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_NonComposites) { // layout is as expected for C++14 / MSL. { struct S { -#define FIELD(ADDR, TYPE, NAME, SUFFIX) TYPE NAME SUFFIX; +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) std::array NAME; ALL_FIELDS() #undef FIELD }; -#define FIELD(ADDR, TYPE, NAME, SUFFIX) \ +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \ EXPECT_EQ(ADDR, static_cast(offsetof(S, NAME))) << "Field " << #NAME; ALL_FIELDS() #undef FIELD @@ -319,18 +368,19 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_NonComposites) { TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_Structures) { // inner_x: size(1024), align(512) - auto* inner_x = Structure("inner_x", { - Member("a", ty.i32()), - Member("b", ty.f32(), {MemberAlign(512)}), - }); + auto* inner_x = + Structure("inner_x", utils::Vector{ + Member("a", ty.i32()), + Member("b", ty.f32(), utils::Vector{MemberAlign(512_u)}), + }); // inner_y: size(516), align(4) - auto* inner_y = Structure("inner_y", { - Member("a", ty.i32(), {MemberSize(512)}), + auto* inner_y = Structure("inner_y", utils::Vector{ + Member("a", ty.i32(), utils::Vector{MemberSize(512)}), Member("b", ty.f32()), }); - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.Of(inner_x)), Member("c", ty.f32()), @@ -338,11 +388,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_Structures) { Member("e", ty.f32()), }); - Global("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); GeneratorImpl& gen = Build(); @@ -350,22 +396,26 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_Structures) { auto* sem_s = program->TypeOf(s)->As(); ASSERT_TRUE(gen.EmitStructType(&buf, sem_s)) << gen.error(); - // ALL_FIELDS() calls the macro FIELD(ADDR, TYPE, NAME, SUFFIX) + // ALL_FIELDS() calls the macro FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) // for each field of the structure s. -#define ALL_FIELDS() \ - FIELD(0x0000, int, a, /*NO SUFFIX*/) \ - FIELD(0x0004, int8_t, tint_pad, [508]) \ - FIELD(0x0200, inner_x, b, /*NO SUFFIX*/) \ - FIELD(0x0600, float, c, /*NO SUFFIX*/) \ - FIELD(0x0604, inner_y, d, /*NO SUFFIX*/) \ - FIELD(0x0808, float, e, /*NO SUFFIX*/) \ - FIELD(0x080c, int8_t, tint_pad_1, [500]) +#define ALL_FIELDS() \ + FIELD(0x0000, int, 0, a) \ + FIELD(0x0004, int8_t, 508, tint_pad) \ + FIELD(0x0200, inner_x, 0, b) \ + FIELD(0x0600, float, 0, c) \ + FIELD(0x0604, inner_y, 0, d) \ + FIELD(0x0808, float, 0, e) \ + FIELD(0x080c, int8_t, 500, tint_pad_1) // Check that the generated string is as expected. -#define FIELD(ADDR, TYPE, NAME, SUFFIX) " /* " #ADDR " */ " #TYPE " " #NAME #SUFFIX ";\n" - auto* expect = "struct S {\n" ALL_FIELDS() "};\n"; + std::stringstream expect; + expect << "struct S {\n"; +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \ + FormatMSLField(expect, #ADDR, #TYPE, ARRAY_COUNT, #NAME); + ALL_FIELDS() #undef FIELD - EXPECT_EQ(buf.String(), expect); + expect << "};\n"; + EXPECT_EQ(buf.String(), expect.str()); // 1.4 Metal and C++14 // The Metal programming language is a C++14-based Specification with @@ -389,12 +439,12 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_Structures) { CHECK_TYPE_SIZE_AND_ALIGN(inner_y, 516, 4); struct S { -#define FIELD(ADDR, TYPE, NAME, SUFFIX) TYPE NAME SUFFIX; +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) std::array NAME; ALL_FIELDS() #undef FIELD }; -#define FIELD(ADDR, TYPE, NAME, SUFFIX) \ +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \ EXPECT_EQ(ADDR, static_cast(offsetof(S, NAME))) << "Field " << #NAME; ALL_FIELDS() #undef FIELD @@ -405,9 +455,9 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_Structures) { TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayDefaultStride) { // inner: size(1024), align(512) - auto* inner = Structure("inner", { + auto* inner = Structure("inner", utils::Vector{ Member("a", ty.i32()), - Member("b", ty.f32(), {MemberAlign(512)}), + Member("b", ty.f32(), utils::Vector{MemberAlign(512_u)}), }); // array_x: size(28), align(4) @@ -419,7 +469,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayDefaultStride) { // array_z: size(4), align(4) auto* array_z = ty.array(); - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", array_x), Member("c", ty.f32()), @@ -428,11 +478,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayDefaultStride) { Member("f", array_z), }); - Global("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); GeneratorImpl& gen = Build(); @@ -440,23 +486,27 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayDefaultStride) { auto* sem_s = program->TypeOf(s)->As(); ASSERT_TRUE(gen.EmitStructType(&buf, sem_s)) << gen.error(); - // ALL_FIELDS() calls the macro FIELD(ADDR, TYPE, NAME, SUFFIX) + // ALL_FIELDS() calls the macro FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) // for each field of the structure s. -#define ALL_FIELDS() \ - FIELD(0x0000, int, a, /*NO SUFFIX*/) \ - FIELD(0x0004, float, b, [7]) \ - FIELD(0x0020, float, c, /*NO SUFFIX*/) \ - FIELD(0x0024, int8_t, tint_pad, [476]) \ - FIELD(0x0200, inner, d, [4]) \ - FIELD(0x1200, float, e, /*NO SUFFIX*/) \ - FIELD(0x1204, float, f, [1]) \ - FIELD(0x1208, int8_t, tint_pad_1, [504]) +#define ALL_FIELDS() \ + FIELD(0x0000, int, 0, a) \ + FIELD(0x0004, float, 7, b) \ + FIELD(0x0020, float, 0, c) \ + FIELD(0x0024, int8_t, 476, tint_pad) \ + FIELD(0x0200, inner, 4, d) \ + FIELD(0x1200, float, 0, e) \ + FIELD(0x1204, float, 1, f) \ + FIELD(0x1208, int8_t, 504, tint_pad_1) // Check that the generated string is as expected. -#define FIELD(ADDR, TYPE, NAME, SUFFIX) " /* " #ADDR " */ " #TYPE " " #NAME #SUFFIX ";\n" - auto* expect = "struct S {\n" ALL_FIELDS() "};\n"; + std::stringstream expect; + expect << "struct S {\n"; +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \ + FormatMSLField(expect, #ADDR, #TYPE, ARRAY_COUNT, #NAME); + ALL_FIELDS() #undef FIELD - EXPECT_EQ(buf.String(), expect); + expect << "};\n"; + EXPECT_EQ(buf.String(), expect.str()); // 1.4 Metal and C++14 // The Metal programming language is a C++14-based Specification with @@ -486,12 +536,12 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayDefaultStride) { CHECK_TYPE_SIZE_AND_ALIGN(array_z, 4, 4); struct S { -#define FIELD(ADDR, TYPE, NAME, SUFFIX) TYPE NAME SUFFIX; +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) std::array NAME; ALL_FIELDS() #undef FIELD }; -#define FIELD(ADDR, TYPE, NAME, SUFFIX) \ +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \ EXPECT_EQ(ADDR, static_cast(offsetof(S, NAME))) << "Field " << #NAME; ALL_FIELDS() #undef FIELD @@ -504,17 +554,13 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayVec3DefaultStride) { // array: size(64), align(16) auto* array = ty.array(ty.vec3(), 4_u); - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", array), Member("c", ty.i32()), }); - Global("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); GeneratorImpl& gen = Build(); @@ -522,59 +568,59 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayVec3DefaultStride) { auto* sem_s = program->TypeOf(s)->As(); ASSERT_TRUE(gen.EmitStructType(&buf, sem_s)) << gen.error(); - // ALL_FIELDS() calls the macro FIELD(ADDR, TYPE, NAME, SUFFIX) + // ALL_FIELDS() calls the macro FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) // for each field of the structure s. -#define ALL_FIELDS() \ - FIELD(0x0000, int, a, /*NO SUFFIX*/) \ - FIELD(0x0004, int8_t, tint_pad, [12]) \ - FIELD(0x0010, float3, b, [4]) \ - FIELD(0x0050, int, c, /*NO SUFFIX*/) \ - FIELD(0x0054, int8_t, tint_pad_1, [12]) +#define ALL_FIELDS() \ + FIELD(0x0000, int, 0, a) \ + FIELD(0x0004, int8_t, 12, tint_pad) \ + FIELD(0x0010, float3, 4, b) \ + FIELD(0x0050, int, 0, c) \ + FIELD(0x0054, int8_t, 12, tint_pad_1) // Check that the generated string is as expected. -#define FIELD(ADDR, TYPE, NAME, SUFFIX) " /* " #ADDR " */ " #TYPE " " #NAME #SUFFIX ";\n" - auto* expect = "struct S {\n" ALL_FIELDS() "};\n"; + std::stringstream expect; + expect << "struct S {\n"; +#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \ + FormatMSLField(expect, #ADDR, #TYPE, ARRAY_COUNT, #NAME); + ALL_FIELDS() #undef FIELD - EXPECT_EQ(buf.String(), expect); + expect << "};\n"; + EXPECT_EQ(buf.String(), expect.str()); } TEST_F(MslGeneratorImplTest, AttemptTintPadSymbolCollision) { - auto* s = - Structure("S", { - // uses symbols tint_pad_[0..9] and tint_pad_[20..35] - Member("tint_pad_2", ty.i32(), {MemberSize(32)}), - Member("tint_pad_20", ty.f32(), {MemberAlign(128), MemberSize(128)}), - Member("tint_pad_33", ty.vec2()), - Member("tint_pad_1", ty.u32()), - Member("tint_pad_3", ty.vec3()), - Member("tint_pad_7", ty.u32()), - Member("tint_pad_25", ty.vec4()), - Member("tint_pad_5", ty.u32()), - Member("tint_pad_27", ty.mat2x2()), - Member("tint_pad_24", ty.u32()), - Member("tint_pad_23", ty.mat2x3()), - Member("tint_pad", ty.u32()), - Member("tint_pad_8", ty.mat2x4()), - Member("tint_pad_26", ty.u32()), - Member("tint_pad_29", ty.mat3x2()), - Member("tint_pad_6", ty.u32()), - Member("tint_pad_22", ty.mat3x3()), - Member("tint_pad_32", ty.u32()), - Member("tint_pad_34", ty.mat3x4()), - Member("tint_pad_35", ty.u32()), - Member("tint_pad_30", ty.mat4x2()), - Member("tint_pad_9", ty.u32()), - Member("tint_pad_31", ty.mat4x3()), - Member("tint_pad_28", ty.u32()), - Member("tint_pad_4", ty.mat4x4()), - Member("tint_pad_21", ty.f32()), - }); + auto* s = Structure("S", utils::Vector{ + // uses symbols tint_pad_[0..9] and tint_pad_[20..35] + Member("tint_pad_2", ty.i32(), utils::Vector{MemberSize(32)}), + Member("tint_pad_20", ty.f32(), + utils::Vector{MemberAlign(128_u), MemberSize(128_u)}), + Member("tint_pad_33", ty.vec2()), + Member("tint_pad_1", ty.u32()), + Member("tint_pad_3", ty.vec3()), + Member("tint_pad_7", ty.u32()), + Member("tint_pad_25", ty.vec4()), + Member("tint_pad_5", ty.u32()), + Member("tint_pad_27", ty.mat2x2()), + Member("tint_pad_24", ty.u32()), + Member("tint_pad_23", ty.mat2x3()), + Member("tint_pad", ty.u32()), + Member("tint_pad_8", ty.mat2x4()), + Member("tint_pad_26", ty.u32()), + Member("tint_pad_29", ty.mat3x2()), + Member("tint_pad_6", ty.u32()), + Member("tint_pad_22", ty.mat3x3()), + Member("tint_pad_32", ty.u32()), + Member("tint_pad_34", ty.mat3x4()), + Member("tint_pad_35", ty.u32()), + Member("tint_pad_30", ty.mat4x2()), + Member("tint_pad_9", ty.u32()), + Member("tint_pad_31", ty.mat4x3()), + Member("tint_pad_28", ty.u32()), + Member("tint_pad_4", ty.mat4x4()), + Member("tint_pad_21", ty.f32()), + }); - Global("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); GeneratorImpl& gen = Build(); @@ -583,59 +629,55 @@ TEST_F(MslGeneratorImplTest, AttemptTintPadSymbolCollision) { ASSERT_TRUE(gen.EmitStructType(&buf, sem_s)) << gen.error(); EXPECT_EQ(buf.String(), R"(struct S { /* 0x0000 */ int tint_pad_2; - /* 0x0004 */ int8_t tint_pad_10[124]; + /* 0x0004 */ tint_array tint_pad_10; /* 0x0080 */ float tint_pad_20; - /* 0x0084 */ int8_t tint_pad_11[124]; + /* 0x0084 */ tint_array tint_pad_11; /* 0x0100 */ float2 tint_pad_33; /* 0x0108 */ uint tint_pad_1; - /* 0x010c */ int8_t tint_pad_12[4]; + /* 0x010c */ tint_array tint_pad_12; /* 0x0110 */ packed_float3 tint_pad_3; /* 0x011c */ uint tint_pad_7; /* 0x0120 */ float4 tint_pad_25; /* 0x0130 */ uint tint_pad_5; - /* 0x0134 */ int8_t tint_pad_13[4]; + /* 0x0134 */ tint_array tint_pad_13; /* 0x0138 */ float2x2 tint_pad_27; /* 0x0148 */ uint tint_pad_24; - /* 0x014c */ int8_t tint_pad_14[4]; + /* 0x014c */ tint_array tint_pad_14; /* 0x0150 */ float2x3 tint_pad_23; /* 0x0170 */ uint tint_pad; - /* 0x0174 */ int8_t tint_pad_15[12]; + /* 0x0174 */ tint_array tint_pad_15; /* 0x0180 */ float2x4 tint_pad_8; /* 0x01a0 */ uint tint_pad_26; - /* 0x01a4 */ int8_t tint_pad_16[4]; + /* 0x01a4 */ tint_array tint_pad_16; /* 0x01a8 */ float3x2 tint_pad_29; /* 0x01c0 */ uint tint_pad_6; - /* 0x01c4 */ int8_t tint_pad_17[12]; + /* 0x01c4 */ tint_array tint_pad_17; /* 0x01d0 */ float3x3 tint_pad_22; /* 0x0200 */ uint tint_pad_32; - /* 0x0204 */ int8_t tint_pad_18[12]; + /* 0x0204 */ tint_array tint_pad_18; /* 0x0210 */ float3x4 tint_pad_34; /* 0x0240 */ uint tint_pad_35; - /* 0x0244 */ int8_t tint_pad_19[4]; + /* 0x0244 */ tint_array tint_pad_19; /* 0x0248 */ float4x2 tint_pad_30; /* 0x0268 */ uint tint_pad_9; - /* 0x026c */ int8_t tint_pad_36[4]; + /* 0x026c */ tint_array tint_pad_36; /* 0x0270 */ float4x3 tint_pad_31; /* 0x02b0 */ uint tint_pad_28; - /* 0x02b4 */ int8_t tint_pad_37[12]; + /* 0x02b4 */ tint_array tint_pad_37; /* 0x02c0 */ float4x4 tint_pad_4; /* 0x0300 */ float tint_pad_21; - /* 0x0304 */ int8_t tint_pad_38[124]; + /* 0x0304 */ tint_array tint_pad_38; }; )"); } TEST_F(MslGeneratorImplTest, EmitType_Struct_WithAttribute) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); - Global("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); GeneratorImpl& gen = Build(); @@ -798,11 +840,7 @@ TEST_P(MslStorageTexturesTest, Emit) { auto params = GetParam(); auto* s = ty.storage_texture(params.dim, ast::TexelFormat::kR32Float, ast::Access::kWrite); - Global("test_var", s, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("test_var", s, Binding(0), Group(0)); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/msl/generator_impl_unary_op_test.cc b/src/tint/writer/msl/generator_impl_unary_op_test.cc index a1aecd9e64..5f86bb5634 100644 --- a/src/tint/writer/msl/generator_impl_unary_op_test.cc +++ b/src/tint/writer/msl/generator_impl_unary_op_test.cc @@ -20,7 +20,7 @@ namespace { using MslUnaryOpTest = TestHelper; TEST_F(MslUnaryOpTest, AddressOf) { - Global("expr", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.f32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kAddressOf, Expr("expr")); WrapInFunction(op); @@ -32,7 +32,7 @@ TEST_F(MslUnaryOpTest, AddressOf) { } TEST_F(MslUnaryOpTest, Complement) { - Global("expr", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.i32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kComplement, Expr("expr")); WrapInFunction(op); @@ -44,9 +44,8 @@ TEST_F(MslUnaryOpTest, Complement) { } TEST_F(MslUnaryOpTest, Indirection) { - Global("G", ty.f32(), ast::StorageClass::kPrivate); - auto* p = - Let("expr", nullptr, create(ast::UnaryOp::kAddressOf, Expr("G"))); + GlobalVar("G", ty.f32(), ast::StorageClass::kPrivate); + auto* p = Let("expr", create(ast::UnaryOp::kAddressOf, Expr("G"))); auto* op = create(ast::UnaryOp::kIndirection, Expr("expr")); WrapInFunction(p, op); @@ -58,7 +57,7 @@ TEST_F(MslUnaryOpTest, Indirection) { } TEST_F(MslUnaryOpTest, Not) { - Global("expr", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.bool_(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kNot, Expr("expr")); WrapInFunction(op); @@ -70,7 +69,7 @@ TEST_F(MslUnaryOpTest, Not) { } TEST_F(MslUnaryOpTest, Negation) { - Global("expr", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.i32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kNegation, Expr("expr")); WrapInFunction(op); @@ -81,16 +80,15 @@ TEST_F(MslUnaryOpTest, Negation) { EXPECT_EQ(out.str(), "tint_unary_minus(expr)"); } -TEST_F(MslUnaryOpTest, NegationOfIntMin) { - auto* op = create(ast::UnaryOp::kNegation, - Expr(i32(std::numeric_limits::min()))); +TEST_F(MslUnaryOpTest, IntMin) { + auto* op = Expr(i32(std::numeric_limits::min())); WrapInFunction(op); GeneratorImpl& gen = Build(); std::stringstream out; ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error(); - EXPECT_EQ(out.str(), "tint_unary_minus((-2147483647 - 1))"); + EXPECT_EQ(out.str(), "(-2147483647 - 1)"); } } // namespace diff --git a/src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc b/src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc index cd8190fc8c..3152f6ce59 100644 --- a/src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc +++ b/src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc @@ -16,6 +16,8 @@ #include "src/tint/ast/variable_decl_statement.h" #include "src/tint/writer/msl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::msl { namespace { @@ -24,7 +26,7 @@ using ::testing::HasSubstr; using MslGeneratorImplTest = TestHelper; TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement) { - auto* var = Var("a", ty.f32(), ast::StorageClass::kNone); + auto* var = Var("a", ty.f32()); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -36,7 +38,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement) { EXPECT_EQ(gen.result(), " float a = 0.0f;\n"); } -TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const) { +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Let) { auto* var = Let("a", ty.f32(), Construct(ty.f32())); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -46,11 +48,11 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const) { gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); - EXPECT_EQ(gen.result(), " float const a = float();\n"); + EXPECT_EQ(gen.result(), " float const a = 0.0f;\n"); } -TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Array) { - auto* var = Var("a", ty.array(), ast::StorageClass::kNone); +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const) { + auto* var = Const("a", ty.f32(), Construct(ty.f32())); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -59,16 +61,334 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Array) { gen.increment_indent(); ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); - EXPECT_EQ(gen.result(), " float a[5] = {0.0f};\n"); + EXPECT_EQ(gen.result(), ""); // Not a mistake - 'const' is inlined +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_AInt) { + auto* C = Const("C", Expr(1_a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + int const l = 1; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_AFloat) { + auto* C = Const("C", Expr(1._a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float const l = 1.0f; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_i32) { + auto* C = Const("C", Expr(1_i)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + int const l = 1; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_u32) { + auto* C = Const("C", Expr(1_u)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + uint const l = 1u; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_f32) { + auto* C = Const("C", Expr(1_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float const l = 1.0f; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", Expr(1_h)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + half const l = 1.0h; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_AInt) { + auto* C = Const("C", Construct(ty.vec3(nullptr), 1_a, 2_a, 3_a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + int3 const l = int3(1, 2, 3); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_AFloat) { + auto* C = Const("C", Construct(ty.vec3(nullptr), 1._a, 2._a, 3._a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float3 const l = float3(1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_f32) { + auto* C = Const("C", vec3(1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float3 const l = float3(1.0f, 2.0f, 3.0f); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", vec3(1_h, 2_h, 3_h)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + half3 const l = half3(1.0h, 2.0h, 3.0h); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_AFloat) { + auto* C = Const("C", Construct(ty.mat(nullptr, 2, 3), 1._a, 2._a, 3._a, 4._a, 5._a, 6._a)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float2x3 const l = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_f32) { + auto* C = Const("C", mat2x3(1_f, 2_f, 3_f, 4_f, 5_f, 6_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + float2x3 const l = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; +void f() { + half2x3 const l = half2x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h)); +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_arr_f32) { + auto* C = Const("C", Construct(ty.array(), 1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + tint_array const l = tint_array{1.0f, 2.0f, 3.0f}; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_arr_vec2_bool) { + auto* C = Const("C", Construct(ty.array(ty.vec2(), 3_u), // + vec2(true, false), // + vec2(false, true), // + vec2(true, true))); + Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + tint_array const l = tint_array{bool2(true, false), bool2(false, true), bool2(true)}; +} + +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Array) { + auto* var = Var("a", ty.array()); + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), " tint_array a = {};\n"); } TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Struct) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.f32()), Member("b", ty.f32()), }); - auto* var = Var("a", ty.Of(s), ast::StorageClass::kNone); + auto* var = Var("a", ty.Of(s)); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -81,7 +401,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Struct) { )"); } -TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector) { +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector_f32) { auto* var = Var("a", ty.vec2()); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -94,7 +414,22 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector) { EXPECT_EQ(gen.result(), " float2 a = 0.0f;\n"); } -TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix) { +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* var = Var("a", ty.vec2()); + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), " half2 a = 0.0h;\n"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix_f32) { auto* var = Var("a", ty.mat3x2()); auto* stmt = Decl(var); @@ -108,8 +443,82 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix) { EXPECT_EQ(gen.result(), " float3x2 a = float3x2(0.0f);\n"); } +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix_f16) { + Enable(ast::Extension::kF16); + + auto* var = Var("a", ty.mat3x2()); + + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), " half3x2 a = half3x2(0.0h);\n"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroVec_f32) { + auto* var = Var("a", ty.vec3(), vec3()); + + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), R"(float3 a = float3(0.0f); +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroVec_f16) { + Enable(ast::Extension::kF16); + + auto* var = Var("a", ty.vec3(), vec3()); + + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), R"(half3 a = half3(0.0h); +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroMat_f32) { + auto* var = Var("a", ty.mat2x3(), mat2x3()); + + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), + R"(float2x3 a = float2x3(float3(0.0f), float3(0.0f)); +)"); +} + +TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroMat_f16) { + Enable(ast::Extension::kF16); + + auto* var = Var("a", ty.mat2x3(), mat2x3()); + + auto* stmt = Decl(var); + WrapInFunction(stmt); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); + EXPECT_EQ(gen.result(), + R"(half2x3 a = half2x3(half3(0.0h), half3(0.0h)); +)"); +} + TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Private) { - Global("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); WrapInFunction(Expr("a")); @@ -121,20 +530,8 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Private) { EXPECT_THAT(gen.result(), HasSubstr("thread float tint_symbol_1 = 0.0f;\n")); } -TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_Private) { - GlobalConst("initializer", ty.f32(), Expr(0.f)); - Global("a", ty.f32(), ast::StorageClass::kPrivate, Expr("initializer")); - - WrapInFunction(Expr("a")); - - GeneratorImpl& gen = SanitizeAndBuild(); - - ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("thread float tint_symbol_1 = initializer;\n")); -} - TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Workgroup) { - Global("a", ty.f32(), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.f32(), ast::StorageClass::kWorkgroup); WrapInFunction(Expr("a")); @@ -146,19 +543,5 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Workgroup) { EXPECT_THAT(gen.result(), HasSubstr("threadgroup float tint_symbol_2;\n")); } -TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroVec) { - auto* zero_vec = vec3(); - - auto* var = Var("a", ty.vec3(), ast::StorageClass::kNone, zero_vec); - auto* stmt = Decl(var); - WrapInFunction(stmt); - - GeneratorImpl& gen = Build(); - - ASSERT_TRUE(gen.EmitStatement(stmt)) << gen.error(); - EXPECT_EQ(gen.result(), R"(float3 a = float3(); -)"); -} - } // namespace } // namespace tint::writer::msl diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc index 72a0962814..933b562bc5 100644 --- a/src/tint/writer/spirv/builder.cc +++ b/src/tint/writer/spirv/builder.cc @@ -27,9 +27,11 @@ #include "src/tint/sem/atomic.h" #include "src/tint/sem/builtin.h" #include "src/tint/sem/call.h" +#include "src/tint/sem/constant.h" #include "src/tint/sem/depth_multisampled_texture.h" #include "src/tint/sem/depth_texture.h" #include "src/tint/sem/function.h" +#include "src/tint/sem/materialize.h" #include "src/tint/sem/member_accessor_expression.h" #include "src/tint/sem/module.h" #include "src/tint/sem/multisampled_texture.h" @@ -55,8 +57,9 @@ const char kGLSLstd450[] = "GLSL.std.450"; uint32_t size_of(const InstructionList& instructions) { uint32_t size = 0; - for (const auto& inst : instructions) + for (const auto& inst : instructions) { size += inst.word_length(); + } return size; } @@ -100,12 +103,18 @@ uint32_t builtin_to_glsl_method(const sem::Builtin* builtin) { switch (builtin->Type()) { case BuiltinType::kAcos: return GLSLstd450Acos; + case BuiltinType::kAcosh: + return GLSLstd450Acosh; case BuiltinType::kAsin: return GLSLstd450Asin; + case BuiltinType::kAsinh: + return GLSLstd450Asinh; case BuiltinType::kAtan: return GLSLstd450Atan; case BuiltinType::kAtan2: return GLSLstd450Atan2; + case BuiltinType::kAtanh: + return GLSLstd450Atanh; case BuiltinType::kCeil: return GLSLstd450Ceil; case BuiltinType::kClamp: @@ -201,7 +210,6 @@ uint32_t builtin_to_glsl_method(const sem::Builtin* builtin) { case BuiltinType::kSinh: return GLSLstd450Sinh; case BuiltinType::kSmoothstep: - case BuiltinType::kSmoothStep: return GLSLstd450SmoothStep; case BuiltinType::kSqrt: return GLSLstd450Sqrt; @@ -256,7 +264,7 @@ bool Builder::Build() { push_memory_model(spv::Op::OpMemoryModel, {U32Operand(SpvAddressingModelLogical), U32Operand(SpvMemoryModelGLSL450)}); - for (auto ext : builder_.AST().Extensions()) { + for (auto ext : builder_.Sem().Module()->Extensions()) { GenerateExtension(ext); } @@ -366,17 +374,26 @@ void Builder::push_capability(uint32_t cap) { } } -bool Builder::GenerateExtension(ast::Enable::ExtensionKind) { - /* - For each supported extension, push corresponding capability into the builder. - For example: - if (kind == ast::Extension::Kind::kF16) { - push_capability(SpvCapabilityFloat16); - push_capability(SpvCapabilityUniformAndStorageBuffer16BitAccess); - push_capability(SpvCapabilityStorageBuffer16BitAccess); - push_capability(SpvCapabilityStorageInputOutput16); - } - */ +void Builder::push_extension(const char* extension) { + extensions_.push_back(Instruction{spv::Op::OpExtension, {Operand(extension)}}); +} + +bool Builder::GenerateExtension(ast::Extension extension) { + switch (extension) { + case ast::Extension::kChromiumExperimentalDp4A: + push_extension("SPV_KHR_integer_dot_product"); + push_capability(SpvCapabilityDotProductKHR); + push_capability(SpvCapabilityDotProductInput4x8BitPackedKHR); + break; + case ast::Extension::kF16: + push_capability(SpvCapabilityFloat16); + push_capability(SpvCapabilityUniformAndStorageBuffer16BitAccess); + push_capability(SpvCapabilityStorageBuffer16BitAccess); + push_capability(SpvCapabilityStorageInputOutput16); + break; + default: + return false; + } return true; } @@ -391,6 +408,11 @@ bool Builder::GenerateLabel(uint32_t id) { bool Builder::GenerateAssignStatement(const ast::AssignmentStatement* assign) { if (assign->lhs->Is()) { + if (builder_.Sem().Get(assign->rhs)->ConstantValue()) { + // RHS of phony assignment is constant. + // Constants can't have side-effects, so just drop this. + return true; + } auto rhs_id = GenerateExpression(assign->rhs); if (rhs_id == 0) { return false; @@ -455,8 +477,8 @@ bool Builder::GenerateEntryPoint(const ast::Function* func, uint32_t id) { for (const auto* var : func_sem->TransitivelyReferencedGlobals()) { // For SPIR-V 1.3 we only output Input/output variables. If we update to // SPIR-V 1.4 or later this should be all variables. - if (var->StorageClass() != ast::StorageClass::kInput && - var->StorageClass() != ast::StorageClass::kOutput) { + if (var->StorageClass() != ast::StorageClass::kIn && + var->StorageClass() != ast::StorageClass::kOut) { continue; } @@ -507,18 +529,18 @@ bool Builder::GenerateExecutionModes(const ast::Function* func, uint32_t id) { wgsize_ops.push_back(wgsize_result); // Generate OpConstant instructions for each dimension. - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { auto constant = ScalarConstant::U32(wgsize[i].value); if (wgsize[i].overridable_const) { // Make the constant specializable. auto* sem_const = builder_.Sem().Get(wgsize[i].overridable_const); - if (!sem_const->IsOverridable()) { + if (!sem_const->Declaration()->Is()) { TINT_ICE(Writer, builder_.Diagnostics()) << "expected a pipeline-overridable constant"; } constant.is_spec_op = true; - constant.constant_id = sem_const->ConstantId(); + constant.constant_id = sem_const->OverrideId().value; } auto result = GenerateConstantIfNeeded(constant); @@ -541,7 +563,7 @@ bool Builder::GenerateExecutionModes(const ast::Function* func, uint32_t id) { } for (auto builtin : func_sem->TransitivelyReferencedBuiltinVariables()) { - if (builtin.second->builtin == ast::Builtin::kFragDepth) { + if (builtin.second->builtin == ast::BuiltinValue::kFragDepth) { push_execution_mode(spv::Op::OpExecutionMode, {Operand(id), U32Operand(SpvExecutionModeDepthReplacing)}); } @@ -551,8 +573,14 @@ bool Builder::GenerateExecutionModes(const ast::Function* func, uint32_t id) { } uint32_t Builder::GenerateExpression(const ast::Expression* expr) { + if (auto* sem = builder_.Sem().Get(expr)) { + if (auto constant = sem->ConstantValue()) { + return GenerateConstantIfNeeded(constant); + } + } return Switch( - expr, [&](const ast::IndexAccessorExpression* a) { return GenerateAccessorExpression(a); }, + expr, // + [&](const ast::IndexAccessorExpression* a) { return GenerateAccessorExpression(a); }, [&](const ast::BinaryExpression* b) { return GenerateBinaryExpression(b); }, [&](const ast::BitcastExpression* b) { return GenerateBitcastExpression(b); }, [&](const ast::CallExpression* c) { return GenerateCallExpression(c); }, @@ -666,20 +694,26 @@ uint32_t Builder::GenerateFunctionTypeIfNeeded(const sem::Function* func) { }); } -bool Builder::GenerateFunctionVariable(const ast::Variable* var) { +bool Builder::GenerateFunctionVariable(const ast::Variable* v) { + if (v->Is()) { + // Constants are generated at their use. This is required as the 'const' declaration may be + // abstract-numeric, which has no SPIR-V type. + return true; + } + uint32_t init_id = 0; - if (var->constructor) { - init_id = GenerateExpressionWithLoadIfNeeded(var->constructor); + if (v->constructor) { + init_id = GenerateExpressionWithLoadIfNeeded(v->constructor); if (init_id == 0) { return false; } } - auto* sem = builder_.Sem().Get(var); + auto* sem = builder_.Sem().Get(v); - if (var->is_const) { - if (!var->constructor) { - error_ = "missing constructor for constant"; + if (v->Is()) { + if (!v->constructor) { + error_ = "missing constructor for let"; return false; } RegisterVariable(sem, init_id); @@ -695,8 +729,7 @@ bool Builder::GenerateFunctionVariable(const ast::Variable* var) { return false; } - push_debug(spv::Op::OpName, - {Operand(var_id), Operand(builder_.Symbols().NameFor(var->symbol))}); + push_debug(spv::Op::OpName, {Operand(var_id), Operand(builder_.Symbols().NameFor(v->symbol))}); // TODO(dsinclair) We could detect if the constructor is fully const and emit // an initializer value for the variable instead of doing the OpLoad. @@ -707,7 +740,7 @@ bool Builder::GenerateFunctionVariable(const ast::Variable* var) { push_function_var( {Operand(type_id), result, U32Operand(ConvertStorageClass(sc)), Operand(null_id)}); - if (var->constructor) { + if (v->constructor) { if (!GenerateStore(var_id, init_id)) { return false; } @@ -722,57 +755,59 @@ bool Builder::GenerateStore(uint32_t to, uint32_t from) { return push_function_inst(spv::Op::OpStore, {Operand(to), Operand(from)}); } -bool Builder::GenerateGlobalVariable(const ast::Variable* var) { - auto* sem = builder_.Sem().Get(var); +bool Builder::GenerateGlobalVariable(const ast::Variable* v) { + if (v->Is()) { + // Constants are generated at their use. This is required as the 'const' declaration may be + // abstract-numeric, which has no SPIR-V type. + return true; + } + + auto* sem = builder_.Sem().Get(v); auto* type = sem->Type()->UnwrapRef(); uint32_t init_id = 0; - if (var->constructor) { - init_id = GenerateConstructorExpression(var, var->constructor); + if (auto* ctor = v->constructor) { + init_id = GenerateConstructorExpression(v, ctor); if (init_id == 0) { return false; } } - if (var->is_const) { - if (!var->constructor) { - // Constants must have an initializer unless they are overridable. - if (!var->is_overridable) { - error_ = "missing constructor for constant"; - return false; - } - - // SPIR-V requires specialization constants to have initializers. - init_id = Switch( - type, // - [&](const sem::F32*) { - ast::FloatLiteralExpression l(ProgramID{}, Source{}, 0.0f); - return GenerateLiteralIfNeeded(var, &l); - }, - [&](const sem::U32*) { - ast::IntLiteralExpression l(ProgramID{}, Source{}, 0, - ast::IntLiteralExpression::Suffix::kU); - return GenerateLiteralIfNeeded(var, &l); - }, - [&](const sem::I32*) { - ast::IntLiteralExpression l(ProgramID{}, Source{}, 0, - ast::IntLiteralExpression::Suffix::kI); - return GenerateLiteralIfNeeded(var, &l); - }, - [&](const sem::Bool*) { - ast::BoolLiteralExpression l(ProgramID{}, Source{}, false); - return GenerateLiteralIfNeeded(var, &l); - }, - [&](Default) { - error_ = "invalid type for pipeline constant ID, must be scalar"; - return 0; - }); - if (init_id == 0) { + if (auto* override = v->As(); override && !override->constructor) { + // SPIR-V requires specialization constants to have initializers. + init_id = Switch( + type, // + [&](const sem::F32*) { + ast::FloatLiteralExpression l(ProgramID{}, ast::NodeID{}, Source{}, 0, + ast::FloatLiteralExpression::Suffix::kF); + return GenerateLiteralIfNeeded(override, &l); + }, + [&](const sem::U32*) { + ast::IntLiteralExpression l(ProgramID{}, ast::NodeID{}, Source{}, 0, + ast::IntLiteralExpression::Suffix::kU); + return GenerateLiteralIfNeeded(override, &l); + }, + [&](const sem::I32*) { + ast::IntLiteralExpression l(ProgramID{}, ast::NodeID{}, Source{}, 0, + ast::IntLiteralExpression::Suffix::kI); + return GenerateLiteralIfNeeded(override, &l); + }, + [&](const sem::Bool*) { + ast::BoolLiteralExpression l(ProgramID{}, ast::NodeID{}, Source{}, false); + return GenerateLiteralIfNeeded(override, &l); + }, + [&](Default) { + error_ = "invalid type for pipeline constant ID, must be scalar"; return 0; - } + }); + if (init_id == 0) { + return 0; } + } + + if (v->Is()) { push_debug(spv::Op::OpName, - {Operand(init_id), Operand(builder_.Symbols().NameFor(var->symbol))}); + {Operand(init_id), Operand(builder_.Symbols().NameFor(v->symbol))}); RegisterVariable(sem, init_id); return true; @@ -789,12 +824,11 @@ bool Builder::GenerateGlobalVariable(const ast::Variable* var) { return false; } - push_debug(spv::Op::OpName, - {Operand(var_id), Operand(builder_.Symbols().NameFor(var->symbol))}); + push_debug(spv::Op::OpName, {Operand(var_id), Operand(builder_.Symbols().NameFor(v->symbol))}); OperandList ops = {Operand(type_id), result, U32Operand(ConvertStorageClass(sc))}; - if (var->constructor) { + if (v->constructor) { ops.push_back(Operand(init_id)); } else { auto* st = type->As(); @@ -822,7 +856,7 @@ bool Builder::GenerateGlobalVariable(const ast::Variable* var) { // VK_KHR_zero_initialize_workgroup_memory extension is enabled, we should // also zero-initialize. if (sem->StorageClass() == ast::StorageClass::kPrivate || - sem->StorageClass() == ast::StorageClass::kOutput || + sem->StorageClass() == ast::StorageClass::kOut || (zero_initialize_workgroup_memory_ && sem->StorageClass() == ast::StorageClass::kWorkgroup)) { init_id = GenerateConstantNullIfNeeded(type); @@ -836,7 +870,7 @@ bool Builder::GenerateGlobalVariable(const ast::Variable* var) { push_type(spv::Op::OpVariable, std::move(ops)); - for (auto* attr : var->attributes) { + for (auto* attr : v->attributes) { bool ok = Switch( attr, [&](const ast::BuiltinAttribute* builtin) { @@ -921,7 +955,7 @@ bool Builder::GenerateIndexAccessor(const ast::IndexAccessorExpression* expr, Ac Operand(result_type_id), extract, Operand(info->source_id), - Operand(idx_constval.ElementAs(0)), + Operand(idx_constval->As()), })) { return false; } @@ -989,7 +1023,7 @@ bool Builder::GenerateMemberAccessor(const ast::MemberAccessorExpression* expr, if (auto* swizzle = expr_sem->As()) { // Single element swizzle is either an access chain or a composite extract auto& indices = swizzle->Indices(); - if (indices.size() == 1) { + if (indices.Length() == 1) { if (info->source_type->Is()) { auto idx_id = GenerateConstantIfNeeded(ScalarConstant::U32(indices[0])); if (idx_id == 0) { @@ -1252,8 +1286,16 @@ uint32_t Builder::GetGLSLstd450Import() { uint32_t Builder::GenerateConstructorExpression(const ast::Variable* var, const ast::Expression* expr) { - if (auto* literal = expr->As()) { - return GenerateLiteralIfNeeded(var, literal); + if (Is(var)) { + if (auto* literal = expr->As()) { + return GenerateLiteralIfNeeded(var, literal); + } + } else { + if (auto* sem = builder_.Sem().Get(expr)) { + if (auto constant = sem->ConstantValue()) { + return GenerateConstantIfNeeded(constant); + } + } } if (auto* call = builder_.Sem().Get(expr)) { if (call->Target()->IsAnyOf()) { @@ -1271,7 +1313,13 @@ bool Builder::IsConstructorConst(const ast::Expression* expr) { return ast::TraverseAction::Descend; } if (auto* ce = e->As()) { - auto* call = builder_.Sem().Get(ce); + auto* sem = builder_.Sem().Get(ce); + if (sem->Is()) { + // Materialize can only occur on compile time expressions, so this sub-tree must be + // constant. + return ast::TraverseAction::Skip; + } + auto* call = sem->As(); if (call->Target()->Is()) { return ast::TraverseAction::Descend; } @@ -1290,9 +1338,9 @@ uint32_t Builder::GenerateTypeConstructorOrConversion(const sem::Call* call, auto* result_type = call->Type(); // Generate the zero initializer if there are no values provided. - if (args.empty()) { - if (global_var && global_var->IsOverridable()) { - auto constant_id = global_var->ConstantId(); + if (args.IsEmpty()) { + if (global_var && global_var->Declaration()->Is()) { + auto constant_id = global_var->OverrideId().value; if (result_type->Is()) { return GenerateConstantIfNeeded(ScalarConstant::I32(0).AsSpecOp(constant_id)); } @@ -1302,6 +1350,9 @@ uint32_t Builder::GenerateTypeConstructorOrConversion(const sem::Call* call, if (result_type->Is()) { return GenerateConstantIfNeeded(ScalarConstant::F32(0).AsSpecOp(constant_id)); } + if (result_type->Is()) { + return GenerateConstantIfNeeded(ScalarConstant::F16(0).AsSpecOp(constant_id)); + } if (result_type->Is()) { return GenerateConstantIfNeeded(ScalarConstant::Bool(false).AsSpecOp(constant_id)); } @@ -1328,6 +1379,15 @@ uint32_t Builder::GenerateTypeConstructorOrConversion(const sem::Call* call, } } + if (auto* res_mat = result_type->As()) { + auto* value_type = args[0]->Type()->UnwrapRef(); + if (auto* val_mat = value_type->As()) { + // Generate passthrough for matrices of the same type + can_cast_or_copy = + (res_mat->columns() == val_mat->columns()) && (res_mat->rows() == val_mat->rows()); + } + } + if (can_cast_or_copy) { return GenerateCastOrCopyOrPassthrough(result_type, args[0]->Declaration(), global_var); } @@ -1431,7 +1491,7 @@ uint32_t Builder::GenerateTypeConstructorOrConversion(const sem::Call* call, // For a single-value vector initializer, splat the initializer value. auto* const init_result_type = call->Type()->UnwrapRef(); - if (args.size() == 1 && init_result_type->is_scalar_vector() && + if (args.Length() == 1 && init_result_type->is_scalar_vector() && args[0]->Type()->UnwrapRef()->is_scalar()) { size_t vec_size = init_result_type->As()->Width(); for (size_t i = 0; i < (vec_size - 1); ++i) { @@ -1499,22 +1559,23 @@ uint32_t Builder::GenerateCastOrCopyOrPassthrough(const sem::Type* to_type, auto* from_type = TypeOf(from_expr)->UnwrapRef(); spv::Op op = spv::Op::OpNop; - if ((from_type->Is() && to_type->Is()) || + if ((from_type->Is() && to_type->is_float_scalar()) || (from_type->is_signed_integer_vector() && to_type->is_float_vector())) { op = spv::Op::OpConvertSToF; - } else if ((from_type->Is() && to_type->Is()) || + } else if ((from_type->Is() && to_type->is_float_scalar()) || (from_type->is_unsigned_integer_vector() && to_type->is_float_vector())) { op = spv::Op::OpConvertUToF; - } else if ((from_type->Is() && to_type->Is()) || + } else if ((from_type->is_float_scalar() && to_type->Is()) || (from_type->is_float_vector() && to_type->is_signed_integer_vector())) { op = spv::Op::OpConvertFToS; - } else if ((from_type->Is() && to_type->Is()) || + } else if ((from_type->is_float_scalar() && to_type->Is()) || (from_type->is_float_vector() && to_type->is_unsigned_integer_vector())) { op = spv::Op::OpConvertFToU; } else if ((from_type->Is() && to_type->Is()) || (from_type->Is() && to_type->Is()) || (from_type->Is() && to_type->Is()) || (from_type->Is() && to_type->Is()) || + (from_type->Is() && to_type->Is()) || (from_type->Is() && (from_type == to_type))) { return val_id; } else if ((from_type->Is() && to_type->Is()) || @@ -1547,6 +1608,9 @@ uint32_t Builder::GenerateCastOrCopyOrPassthrough(const sem::Type* to_type, if (to_elem_type->Is()) { zero_id = GenerateConstantIfNeeded(ScalarConstant::F32(0)); one_id = GenerateConstantIfNeeded(ScalarConstant::F32(1)); + } else if (to_elem_type->Is()) { + zero_id = GenerateConstantIfNeeded(ScalarConstant::F16(0)); + one_id = GenerateConstantIfNeeded(ScalarConstant::F16(1)); } else if (to_elem_type->Is()) { zero_id = GenerateConstantIfNeeded(ScalarConstant::U32(0)); one_id = GenerateConstantIfNeeded(ScalarConstant::U32(1)); @@ -1573,6 +1637,8 @@ uint32_t Builder::GenerateCastOrCopyOrPassthrough(const sem::Type* to_type, } return result_id; + } else if (from_type->Is()) { + return val_id; } else { TINT_ICE(Writer, builder_.Diagnostics()) << "Invalid from_type"; } @@ -1596,9 +1662,9 @@ uint32_t Builder::GenerateLiteralIfNeeded(const ast::Variable* var, ScalarConstant constant; auto* global = builder_.Sem().Get(var); - if (global && global->IsOverridable()) { + if (global && global->Declaration()->Is()) { constant.is_spec_op = true; - constant.constant_id = global->ConstantId(); + constant.constant_id = global->OverrideId().value; } Switch( @@ -1621,8 +1687,17 @@ uint32_t Builder::GenerateLiteralIfNeeded(const ast::Variable* var, } }, [&](const ast::FloatLiteralExpression* f) { - constant.kind = ScalarConstant::Kind::kF32; - constant.value.f32 = f->value; + switch (f->suffix) { + case ast::FloatLiteralExpression::Suffix::kNone: + case ast::FloatLiteralExpression::Suffix::kF: + constant.kind = ScalarConstant::Kind::kF32; + constant.value.f32 = static_cast(f->value); + return; + case ast::FloatLiteralExpression::Suffix::kH: + constant.kind = ScalarConstant::Kind::kF16; + constant.value.f16 = {f16(static_cast(f->value)).BitsRepresentation()}; + return; + } }, [&](Default) { error_ = "unknown literal type"; }); @@ -1633,6 +1708,75 @@ uint32_t Builder::GenerateLiteralIfNeeded(const ast::Variable* var, return GenerateConstantIfNeeded(constant); } +uint32_t Builder::GenerateConstantIfNeeded(const sem::Constant* constant) { + if (constant->AllZero()) { + return GenerateConstantNullIfNeeded(constant->Type()); + } + auto* ty = constant->Type(); + + auto composite = [&](size_t el_count) -> uint32_t { + auto type_id = GenerateTypeIfNeeded(ty); + if (!type_id) { + return 0; + } + + static constexpr size_t kOpsResultIdx = 1; // operand index of the result + + std::vector ops; + ops.reserve(el_count + 2); + ops.emplace_back(type_id); + ops.push_back(Operand(0u)); // Placeholder for the result ID + + for (size_t i = 0; i < el_count; i++) { + auto id = GenerateConstantIfNeeded(constant->Index(i)); + if (!id) { + return 0; + } + ops.emplace_back(id); + } + + auto& global_scope = scope_stack_[0]; + return utils::GetOrCreate(global_scope.type_ctor_to_id_, OperandListKey{ops}, + [&]() -> uint32_t { + auto result = result_op(); + ops[kOpsResultIdx] = result; + push_type(spv::Op::OpConstantComposite, std::move(ops)); + return std::get(result); + }); + }; + + return Switch( + ty, // + [&](const sem::Bool*) { + bool val = constant->As(); + return GenerateConstantIfNeeded(ScalarConstant::Bool(val)); + }, + [&](const sem::F32*) { + auto val = constant->As(); + return GenerateConstantIfNeeded(ScalarConstant::F32(val.value)); + }, + [&](const sem::F16*) { + auto val = constant->As(); + return GenerateConstantIfNeeded(ScalarConstant::F16(val.value)); + }, + [&](const sem::I32*) { + auto val = constant->As(); + return GenerateConstantIfNeeded(ScalarConstant::I32(val.value)); + }, + [&](const sem::U32*) { + auto val = constant->As(); + return GenerateConstantIfNeeded(ScalarConstant::U32(val.value)); + }, + [&](const sem::Vector* v) { return composite(v->Width()); }, + [&](const sem::Matrix* m) { return composite(m->columns()); }, + [&](const sem::Array* a) { return composite(a->Count()); }, + [&](const sem::Struct* s) { return composite(s->Members().size()); }, + [&](Default) { + error_ = "unhandled constant type: " + builder_.FriendlyName(ty); + return false; + }); +} + uint32_t Builder::GenerateConstantIfNeeded(const ScalarConstant& constant) { auto it = const_to_id_.find(constant); if (it != const_to_id_.end()) { @@ -1654,6 +1798,10 @@ uint32_t Builder::GenerateConstantIfNeeded(const ScalarConstant& constant) { type_id = GenerateTypeIfNeeded(builder_.create()); break; } + case ScalarConstant::Kind::kF16: { + type_id = GenerateTypeIfNeeded(builder_.create()); + break; + } case ScalarConstant::Kind::kBool: { type_id = GenerateTypeIfNeeded(builder_.create()); break; @@ -1688,6 +1836,12 @@ uint32_t Builder::GenerateConstantIfNeeded(const ScalarConstant& constant) { {Operand(type_id), result, Operand(constant.value.f32)}); break; } + case ScalarConstant::Kind::kF16: { + push_type( + constant.is_spec_op ? spv::Op::OpSpecConstant : spv::Op::OpConstant, + {Operand(type_id), result, U32Operand(constant.value.f16.bits_representation)}); + break; + } case ScalarConstant::Kind::kBool: { if (constant.value.b) { push_type( @@ -2145,7 +2299,7 @@ bool Builder::GenerateBlockStatementWithoutScoping(const ast::BlockStatement* st } uint32_t Builder::GenerateCallExpression(const ast::CallExpression* expr) { - auto* call = builder_.Sem().Get(expr); + auto* call = builder_.Sem().Get(expr); auto* target = call->Target(); return Switch( target, [&](const sem::Function* func) { return GenerateFunctionCall(call, func); }, @@ -2310,7 +2464,7 @@ uint32_t Builder::GenerateBuiltinCall(const sem::Call* call, const sem::Builtin* } // Runtime array must be the last member in the structure params.push_back( - Operand(uint32_t(type->As()->Declaration()->members.size() - 1))); + Operand(uint32_t(type->As()->Declaration()->members.Length() - 1))); if (!push_function_inst(spv::Op::OpArrayLength, params)) { return 0; @@ -2473,6 +2627,30 @@ uint32_t Builder::GenerateBuiltinCall(const sem::Call* call, const sem::Builtin* glsl_std450(GLSLstd450SAbs); } break; + case BuiltinType::kDot4I8Packed: { + auto first_param_id = get_arg_as_value_id(0); + auto second_param_id = get_arg_as_value_id(1); + if (!push_function_inst(spv::Op::OpSDotKHR, + {Operand(result_type_id), result, Operand(first_param_id), + Operand(second_param_id), + Operand(static_cast( + spv::PackedVectorFormat::PackedVectorFormat4x8BitKHR))})) { + return 0; + } + return result_id; + } + case BuiltinType::kDot4U8Packed: { + auto first_param_id = get_arg_as_value_id(0); + auto second_param_id = get_arg_as_value_id(1); + if (!push_function_inst(spv::Op::OpUDotKHR, + {Operand(result_type_id), result, Operand(first_param_id), + Operand(second_param_id), + Operand(static_cast( + spv::PackedVectorFormat::PackedVectorFormat4x8BitKHR))})) { + return 0; + } + return result_id; + } default: { auto inst_id = builtin_to_glsl_method(builtin); if (inst_id == 0) { @@ -2489,7 +2667,7 @@ uint32_t Builder::GenerateBuiltinCall(const sem::Call* call, const sem::Builtin* return 0; } - for (size_t i = 0; i < call->Arguments().size(); i++) { + for (size_t i = 0; i < call->Arguments().Length(); i++) { if (auto val_id = get_arg_as_value_id(i)) { params.emplace_back(Operand(val_id)); } else { @@ -2522,7 +2700,7 @@ bool Builder::GenerateTextureBuiltin(const sem::Call* call, // Returns the argument with the given usage auto arg = [&](Usage usage) { int idx = signature.IndexOf(usage); - return (idx >= 0) ? arguments[idx] : nullptr; + return (idx >= 0) ? arguments[static_cast(idx)] : nullptr; }; // Generates the argument with the given usage, returning the operand ID @@ -2878,9 +3056,9 @@ bool Builder::GenerateTextureBuiltin(const sem::Call* call, } spirv_params.emplace_back(gen_arg(Usage::kDepthRef)); - ast::FloatLiteralExpression float_0(ProgramID(), Source{}, 0.0); - image_operands.emplace_back(ImageOperand{ - SpvImageOperandsLodMask, Operand(GenerateLiteralIfNeeded(nullptr, &float_0))}); + image_operands.emplace_back( + ImageOperand{SpvImageOperandsLodMask, + Operand(GenerateConstantIfNeeded(ScalarConstant::F32(0.0)))}); break; } default: @@ -2994,8 +3172,8 @@ bool Builder::GenerateAtomicBuiltin(const sem::Call* call, } uint32_t value_id = 0; - if (call->Arguments().size() > 1) { - value_id = GenerateExpressionWithLoadIfNeeded(call->Arguments().back()); + if (call->Arguments().Length() > 1) { + value_id = GenerateExpressionWithLoadIfNeeded(call->Arguments().Back()); if (value_id == 0) { return false; } @@ -3097,12 +3275,13 @@ bool Builder::GenerateAtomicBuiltin(const sem::Call* call, value, }); case sem::BuiltinType::kAtomicCompareExchangeWeak: { - auto comparator = GenerateExpression(call->Arguments()[1]->Declaration()); + auto comparator = + GenerateExpressionWithLoadIfNeeded(call->Arguments()[1]->Declaration()); if (comparator == 0) { return false; } - auto* value_sem_type = TypeOf(call->Arguments()[2]->Declaration()); + auto* value_sem_type = call->Target()->Signature().parameters[2]->Type(); auto value_type = GenerateTypeIfNeeded(value_sem_type); if (value_type == 0) { @@ -3142,42 +3321,12 @@ bool Builder::GenerateAtomicBuiltin(const sem::Call* call, return false; } - // zero := T(0) - // one := T(1) - uint32_t zero = 0; - uint32_t one = 0; - if (value_sem_type->Is()) { - zero = GenerateConstantIfNeeded(ScalarConstant::I32(0u)); - one = GenerateConstantIfNeeded(ScalarConstant::I32(1u)); - } else if (value_sem_type->Is()) { - zero = GenerateConstantIfNeeded(ScalarConstant::U32(0u)); - one = GenerateConstantIfNeeded(ScalarConstant::U32(1u)); - } else { - TINT_UNREACHABLE(Writer, builder_.Diagnostics()) - << "unsupported atomic type " << value_sem_type->TypeInfo().name; - } - if (zero == 0 || one == 0) { - return false; - } - - // xchg_success := values_equal ? one : zero - auto xchg_success = result_op(); - if (!push_function_inst(spv::Op::OpSelect, { - Operand(value_type), - xchg_success, - values_equal, - Operand(one), - Operand(zero), - })) { - return false; - } - - // result := vec2(original_value, xchg_success) + // result := __atomic_compare_exchange_result(original_value, values_equal) return push_function_inst(spv::Op::OpCompositeConstruct, { result_type, result_id, original_value, - xchg_success, + values_equal, }); } default: @@ -3337,7 +3486,7 @@ bool Builder::GenerateIfStatement(const ast::IfStatement* stmt) { // if (cond) {} else {break;} // } auto is_just_a_break = [](const ast::BlockStatement* block) { - return block && (block->statements.size() == 1) && + return block && (block->statements.Length() == 1) && block->Last()->Is(); }; if (is_just_a_break(stmt->body) && stmt->else_statement == nullptr) { @@ -3427,7 +3576,7 @@ bool Builder::GenerateSwitchStatement(const ast::SwitchStatement* stmt) { // source. Each fallthrough goes to the next case entry, so is a forward // branch, otherwise the branch is to the merge block which comes after // the switch statement. - for (uint32_t i = 0; i < body.size(); i++) { + for (uint32_t i = 0; i < body.Length(); i++) { auto* item = body[i]; if (item->IsDefault()) { @@ -3442,7 +3591,7 @@ bool Builder::GenerateSwitchStatement(const ast::SwitchStatement* stmt) { } if (LastIsFallthrough(item->body)) { - if (i == (body.size() - 1)) { + if (i == (body.Length() - 1)) { // This case is caught by Resolver validation TINT_UNREACHABLE(Writer, builder_.Diagnostics()); return false; @@ -3574,12 +3723,8 @@ bool Builder::GenerateLoopStatement(const ast::LoopStatement* stmt) { bool Builder::GenerateStatement(const ast::Statement* stmt) { return Switch( stmt, [&](const ast::AssignmentStatement* a) { return GenerateAssignStatement(a); }, - [&](const ast::BlockStatement* b) { // - return GenerateBlockStatement(b); - }, - [&](const ast::BreakStatement* b) { // - return GenerateBreakStatement(b); - }, + [&](const ast::BlockStatement* b) { return GenerateBlockStatement(b); }, + [&](const ast::BreakStatement* b) { return GenerateBreakStatement(b); }, [&](const ast::CallStatement* c) { return GenerateCallExpression(c->expr) != 0; }, [&](const ast::ContinueStatement* c) { return GenerateContinueStatement(c); }, [&](const ast::DiscardStatement* d) { return GenerateDiscardStatement(d); }, @@ -3587,19 +3732,14 @@ bool Builder::GenerateStatement(const ast::Statement* stmt) { // Do nothing here, the fallthrough gets handled by the switch code. return true; }, - [&](const ast::IfStatement* i) { // - return GenerateIfStatement(i); - }, - [&](const ast::LoopStatement* l) { // - return GenerateLoopStatement(l); - }, - [&](const ast::ReturnStatement* r) { // - return GenerateReturnStatement(r); - }, - [&](const ast::SwitchStatement* s) { // - return GenerateSwitchStatement(s); - }, + [&](const ast::IfStatement* i) { return GenerateIfStatement(i); }, + [&](const ast::LoopStatement* l) { return GenerateLoopStatement(l); }, + [&](const ast::ReturnStatement* r) { return GenerateReturnStatement(r); }, + [&](const ast::SwitchStatement* s) { return GenerateSwitchStatement(s); }, [&](const ast::VariableDeclStatement* v) { return GenerateVariableDeclStatement(v); }, + [&](const ast::StaticAssert*) { + return true; // Not emitted + }, [&](Default) { error_ = "Unknown statement: " + std::string(stmt->TypeInfo().name); return false; @@ -3665,6 +3805,10 @@ uint32_t Builder::GenerateTypeIfNeeded(const sem::Type* type) { push_type(spv::Op::OpTypeFloat, {result, Operand(32u)}); return true; }, + [&](const sem::F16*) { + push_type(spv::Op::OpTypeFloat, {result, Operand(16u)}); + return true; + }, [&](const sem::I32*) { push_type(spv::Op::OpTypeInt, {result, Operand(32u), Operand(1u)}); return true; @@ -3960,14 +4104,16 @@ SpvStorageClass Builder::ConvertStorageClass(ast::StorageClass klass) const { switch (klass) { case ast::StorageClass::kInvalid: return SpvStorageClassMax; - case ast::StorageClass::kInput: + case ast::StorageClass::kIn: return SpvStorageClassInput; - case ast::StorageClass::kOutput: + case ast::StorageClass::kOut: return SpvStorageClassOutput; case ast::StorageClass::kUniform: return SpvStorageClassUniform; case ast::StorageClass::kWorkgroup: return SpvStorageClassWorkgroup; + case ast::StorageClass::kPushConstant: + return SpvStorageClassPushConstant; case ast::StorageClass::kHandle: return SpvStorageClassUniformConstant; case ast::StorageClass::kStorage: @@ -3982,43 +4128,43 @@ SpvStorageClass Builder::ConvertStorageClass(ast::StorageClass klass) const { return SpvStorageClassMax; } -SpvBuiltIn Builder::ConvertBuiltin(ast::Builtin builtin, ast::StorageClass storage) { +SpvBuiltIn Builder::ConvertBuiltin(ast::BuiltinValue builtin, ast::StorageClass storage) { switch (builtin) { - case ast::Builtin::kPosition: - if (storage == ast::StorageClass::kInput) { + case ast::BuiltinValue::kPosition: + if (storage == ast::StorageClass::kIn) { return SpvBuiltInFragCoord; - } else if (storage == ast::StorageClass::kOutput) { + } else if (storage == ast::StorageClass::kOut) { return SpvBuiltInPosition; } else { TINT_ICE(Writer, builder_.Diagnostics()) << "invalid storage class for builtin"; break; } - case ast::Builtin::kVertexIndex: + case ast::BuiltinValue::kVertexIndex: return SpvBuiltInVertexIndex; - case ast::Builtin::kInstanceIndex: + case ast::BuiltinValue::kInstanceIndex: return SpvBuiltInInstanceIndex; - case ast::Builtin::kFrontFacing: + case ast::BuiltinValue::kFrontFacing: return SpvBuiltInFrontFacing; - case ast::Builtin::kFragDepth: + case ast::BuiltinValue::kFragDepth: return SpvBuiltInFragDepth; - case ast::Builtin::kLocalInvocationId: + case ast::BuiltinValue::kLocalInvocationId: return SpvBuiltInLocalInvocationId; - case ast::Builtin::kLocalInvocationIndex: + case ast::BuiltinValue::kLocalInvocationIndex: return SpvBuiltInLocalInvocationIndex; - case ast::Builtin::kGlobalInvocationId: + case ast::BuiltinValue::kGlobalInvocationId: return SpvBuiltInGlobalInvocationId; - case ast::Builtin::kPointSize: + case ast::BuiltinValue::kPointSize: return SpvBuiltInPointSize; - case ast::Builtin::kWorkgroupId: + case ast::BuiltinValue::kWorkgroupId: return SpvBuiltInWorkgroupId; - case ast::Builtin::kNumWorkgroups: + case ast::BuiltinValue::kNumWorkgroups: return SpvBuiltInNumWorkgroups; - case ast::Builtin::kSampleIndex: + case ast::BuiltinValue::kSampleIndex: push_capability(SpvCapabilitySampleRateShading); return SpvBuiltInSampleId; - case ast::Builtin::kSampleMask: + case ast::BuiltinValue::kSampleMask: return SpvBuiltInSampleMask; - case ast::Builtin::kNone: + case ast::BuiltinValue::kInvalid: break; } return SpvBuiltInMax; @@ -4088,7 +4234,7 @@ SpvImageFormat Builder::convert_texel_format_to_spv(const ast::TexelFormat forma return SpvImageFormatRgba32i; case ast::TexelFormat::kRgba32Float: return SpvImageFormatRgba32f; - case ast::TexelFormat::kNone: + case ast::TexelFormat::kInvalid: return SpvImageFormatUnknown; } return SpvImageFormatUnknown; diff --git a/src/tint/writer/spirv/builder.h b/src/tint/writer/spirv/builder.h index 34cfd76292..a0eff107bc 100644 --- a/src/tint/writer/spirv/builder.h +++ b/src/tint/writer/spirv/builder.h @@ -43,6 +43,7 @@ // Forward declarations namespace tint::sem { class Call; +class Constant; class Reference; class TypeConstructor; class TypeConversion; @@ -113,11 +114,8 @@ class Builder { /// @returns the capabilities const InstructionList& capabilities() const { return capabilities_; } /// Adds an instruction to the extensions - /// @param op the op to set - /// @param operands the operands for the instruction - void push_extension(spv::Op op, const OperandList& operands) { - extensions_.push_back(Instruction{op, operands}); - } + /// @param extension the name of the extension + void push_extension(const char* extension); /// @returns the extensions const InstructionList& extensions() const { return extensions_; } /// Adds an instruction to the ext import @@ -213,7 +211,7 @@ class Builder { /// @param builtin the builtin to convert /// @param storage the storage class that this builtin is being used with /// @returns the SPIR-V builtin or SpvBuiltInMax on error. - SpvBuiltIn ConvertBuiltin(ast::Builtin builtin, ast::StorageClass storage); + SpvBuiltIn ConvertBuiltin(ast::BuiltinValue builtin, ast::StorageClass storage); /// Converts an interpolate attribute to SPIR-V decorations and pushes a /// capability if needed. @@ -224,11 +222,11 @@ class Builder { ast::InterpolationType type, ast::InterpolationSampling sampling); - /// Generates a extension for the given extension kind. Emits an error and - /// returns false if the extension kind is not supported. - /// @param kind ExtensionKind of the extension to generate + /// Generates the enabling of an extension. Emits an error and returns false if the extension is + /// not supported. + /// @param ext the extension to generate /// @returns true on success. - bool GenerateExtension(ast::Enable::ExtensionKind kind); + bool GenerateExtension(ast::Extension ext); /// Generates a label for the given id. Emits an error and returns false if /// we're currently outside a function. /// @param id the id to use for the label @@ -553,6 +551,11 @@ class Builder { /// @param expr the expression const sem::Type* TypeOf(const ast::Expression* expr) const { return builder_.TypeOf(expr); } + /// Generates a constant value if needed + /// @param constant the constant to generate. + /// @returns the ID on success or 0 on failure + uint32_t GenerateConstantIfNeeded(const sem::Constant* constant); + /// Generates a scalar constant if needed /// @param constant the constant to generate. /// @returns the ID on success or 0 on failure diff --git a/src/tint/writer/spirv/builder_accessor_expression_test.cc b/src/tint/writer/spirv/builder_accessor_expression_test.cc index 67ee1859ec..ae755bb6cb 100644 --- a/src/tint/writer/spirv/builder_accessor_expression_test.cc +++ b/src/tint/writer/spirv/builder_accessor_expression_test.cc @@ -22,193 +22,871 @@ namespace { using BuilderTest = TestHelper; -TEST_F(BuilderTest, IndexAccessor_VectorRef_Literal) { - // var ary : vec3; - // ary[1] -> ref +TEST_F(BuilderTest, Let_IndexAccessor_Vector) { + // let ary = vec3(1, 2, 3); + // var x = ary[1i]; - auto* var = Var("ary", ty.vec3()); + auto* ary = Let("ary", vec3(1_i, 2_i, 3_i)); + auto* x = Var("x", IndexAccessor(ary, 1_i)); + WrapInFunction(ary, x); - auto* ary = Expr("ary"); - auto* idx_expr = Expr(1_i); + spirv::Builder& b = SanitizeAndBuild(); - auto* expr = IndexAccessor(ary, idx_expr); - WrapInFunction(var, expr); + ASSERT_TRUE(b.Build()) << b.error(); - spirv::Builder& b = Build(); - - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); - - EXPECT_EQ(b.GenerateAccessorExpression(expr), 9u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Function %3 -%5 = OpConstantNull %3 -%6 = OpTypeInt 32 1 -%7 = OpConstant %6 1 -%8 = OpTypePointer Function %4 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %5 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%9 = OpAccessChain %8 %1 %7 -)"); -} - -TEST_F(BuilderTest, IndexAccessor_VectorRef_Dynamic) { - // var ary : vec3; - // var idx : i32; - // ary[idx] -> ref - - auto* var = Var("ary", ty.vec3()); - auto* idx = Var("idx", ty.i32()); - - auto* ary = Expr("ary"); - auto* idx_expr = Expr("idx"); - - auto* expr = IndexAccessor(ary, idx_expr); - WrapInFunction(var, idx, expr); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunctionVariable(idx)) << b.error(); - - EXPECT_EQ(b.GenerateAccessorExpression(expr), 12u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Function %3 -%5 = OpConstantNull %3 -%8 = OpTypeInt 32 1 -%7 = OpTypePointer Function %8 -%9 = OpConstantNull %8 -%11 = OpTypePointer Function %4 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %5 -%6 = OpVariable %7 Function %9 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%10 = OpLoad %8 %6 -%12 = OpAccessChain %11 %1 %10 -)"); -} - -TEST_F(BuilderTest, IndexAccessor_VectorRef_Dynamic2) { - // var ary : vec3; - // ary[1 + 2] -> ref - - auto* var = Var("ary", ty.vec3()); - - auto* ary = Expr("ary"); - - auto* expr = IndexAccessor(ary, Add(1_i, 2_i)); - WrapInFunction(var, expr); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); - - EXPECT_EQ(b.GenerateAccessorExpression(expr), 11u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Function %3 -%5 = OpConstantNull %3 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 %6 = OpTypeInt 32 1 +%5 = OpTypeVector %6 3 %7 = OpConstant %6 1 %8 = OpConstant %6 2 -%10 = OpTypePointer Function %4 +%9 = OpConstant %6 3 +%10 = OpConstantComposite %5 %7 %8 %9 +%13 = OpTypePointer Function %6 +%14 = OpConstantNull %6 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %5 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%12 = OpVariable %13 Function %14 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%9 = OpIAdd %6 %7 %8 -%11 = OpAccessChain %10 %1 %9 + R"(%11 = OpCompositeExtract %6 %10 1 +OpStore %12 %11 +OpReturn )"); + + Validate(b); } -TEST_F(BuilderTest, IndexAccessor_ArrayRef_MultiLevel) { - auto* ary4 = ty.array(ty.vec3(), 4_u); +TEST_F(BuilderTest, Const_IndexAccessor_Vector) { + // const ary = vec3(1, 2, 3); + // var x = ary[1i]; - // var ary : array, 4u> - // ary[3i][2i]; + auto* ary = Const("ary", vec3(1_i, 2_i, 3_i)); + auto* x = Var("x", IndexAccessor(ary, 1_i)); + WrapInFunction(ary, x); - auto* var = Var("ary", ary4); + spirv::Builder& b = SanitizeAndBuild(); - auto* expr = IndexAccessor(IndexAccessor("ary", 3_i), 2_i); - WrapInFunction(var, expr); + ASSERT_TRUE(b.Build()) << b.error(); - spirv::Builder& b = Build(); - - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); - - EXPECT_EQ(b.GenerateAccessorExpression(expr), 13u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32 -%4 = OpTypeVector %5 3 -%6 = OpTypeInt 32 0 -%7 = OpConstant %6 4 -%3 = OpTypeArray %4 %7 -%2 = OpTypePointer Function %3 -%8 = OpConstantNull %3 -%9 = OpTypeInt 32 1 -%10 = OpConstant %9 3 -%11 = OpConstant %9 2 -%12 = OpTypePointer Function %5 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeInt 32 1 +%6 = OpConstant %5 2 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %8 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%7 = OpVariable %8 Function %9 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%13 = OpAccessChain %12 %1 %10 %11 + R"(OpStore %7 %6 +OpReturn )"); + + Validate(b); } -TEST_F(BuilderTest, IndexAccessor_ArrayRef_ArrayWithSwizzle) { - auto* ary4 = ty.array(ty.vec3(), 4_u); +TEST_F(BuilderTest, Runtime_IndexAccessor_Vector) { + // var ary : vec3; + // var x = ary[1i]; - // var a : array, 4u>; - // a[2i].xy; + auto* ary = Var("ary", ty.vec3()); + auto* x = Var("x", IndexAccessor(ary, 1_i)); + WrapInFunction(ary, x); - auto* var = Var("ary", ary4); + spirv::Builder& b = SanitizeAndBuild(); - auto* expr = MemberAccessor(IndexAccessor("ary", 2_i), "xy"); - WrapInFunction(var, expr); + ASSERT_TRUE(b.Build()) << b.error(); - spirv::Builder& b = Build(); - - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 15u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32 -%4 = OpTypeVector %5 3 -%6 = OpTypeInt 32 0 -%7 = OpConstant %6 4 -%3 = OpTypeArray %4 %7 -%2 = OpTypePointer Function %3 -%8 = OpConstantNull %3 -%9 = OpTypeInt 32 1 -%10 = OpConstant %9 2 -%11 = OpTypePointer Function %4 -%13 = OpTypeVector %5 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeInt 32 0 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%10 = OpTypeInt 32 1 +%11 = OpConstant %10 1 +%12 = OpTypePointer Function %8 +%16 = OpConstantNull %8 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %8 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +%15 = OpVariable %12 Function %16 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%13 = OpAccessChain %12 %5 %11 +%14 = OpLoad %8 %13 +OpStore %15 %14 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Dynamic_IndexAccessor_Vector) { + // var ary : vec3; + // var idx : i32; + // var x = ary[idx]; + + auto* ary = Var("ary", ty.vec3()); + auto* idx = Var("idx", ty.i32()); + auto* x = Var("x", IndexAccessor(ary, idx)); + WrapInFunction(ary, idx, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%12 = OpTypeInt 32 1 +%11 = OpTypePointer Function %12 +%13 = OpConstantNull %12 +%15 = OpTypePointer Function %8 +%19 = OpConstantNull %8 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +%10 = OpVariable %11 Function %13 +%18 = OpVariable %15 Function %19 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%14 = OpLoad %12 %10 +%16 = OpAccessChain %15 %5 %14 +%17 = OpLoad %8 %16 +OpStore %18 %17 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Const_IndexAccessor_Vector2) { + // let ary : vec3(1, 2, 3); + // var x = ary[1i + 1i]; + + auto* ary = Let("ary", vec3(1_i, 2_i, 3_i)); + auto* x = Var("x", IndexAccessor(ary, Add(1_i, 1_i))); + WrapInFunction(ary, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeInt 32 1 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 1 +%8 = OpConstant %6 2 +%9 = OpConstant %6 3 +%10 = OpConstantComposite %5 %7 %8 %9 +%13 = OpTypePointer Function %6 +%14 = OpConstantNull %6 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%12 = OpVariable %13 Function %14 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%12 = OpAccessChain %11 %1 %10 -%14 = OpLoad %4 %12 -%15 = OpVectorShuffle %13 %14 %14 0 1 + R"(%11 = OpCompositeExtract %6 %10 2 +OpStore %12 %11 +OpReturn )"); + + Validate(b); +} + +TEST_F(BuilderTest, Runtime_IndexAccessor_Vector2) { + // var ary : vec3; + // var x = ary[1i + 1i]; + + auto* ary = Var("ary", ty.vec3()); + auto* x = Var("x", IndexAccessor(ary, Add(1_i, 1_i))); + WrapInFunction(ary, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%10 = OpTypeInt 32 1 +%11 = OpConstant %10 2 +%12 = OpTypePointer Function %8 +%16 = OpConstantNull %8 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +%15 = OpVariable %12 Function %16 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%13 = OpAccessChain %12 %5 %11 +%14 = OpLoad %8 %13 +OpStore %15 %14 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Dynamic_IndexAccessor_Vector2) { + // var ary : vec3; + // var one = 1i; + // var x = ary[one + 2i]; + + auto* ary = Var("ary", ty.vec3()); + auto* one = Var("one", Expr(1_i)); + auto* x = Var("x", IndexAccessor(ary, Add(one, 2_i))); + WrapInFunction(ary, one, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%10 = OpTypeInt 32 1 +%11 = OpConstant %10 1 +%13 = OpTypePointer Function %10 +%14 = OpConstantNull %10 +%16 = OpConstant %10 2 +%18 = OpTypePointer Function %8 +%22 = OpConstantNull %8 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +%12 = OpVariable %13 Function %14 +%21 = OpVariable %18 Function %22 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %12 %11 +%15 = OpLoad %10 %12 +%17 = OpIAdd %10 %15 %16 +%19 = OpAccessChain %18 %5 %17 +%20 = OpLoad %8 %19 +OpStore %21 %20 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Let_IndexAccessor_Array_MultiLevel) { + // let ary = array, 2u>(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); + // var x = ary[1i][2i]; + + auto* ary = Let("ary", array(ty.vec3(), 2_u, vec3(1._f, 2._f, 3._f), + vec3(4._f, 5._f, 6._f))); + auto* x = Var("x", IndexAccessor(IndexAccessor(ary, 1_i), 2_i)); + WrapInFunction(ary, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%7 = OpTypeFloat 32 +%6 = OpTypeVector %7 3 +%8 = OpTypeInt 32 0 +%9 = OpConstant %8 2 +%5 = OpTypeArray %6 %9 +%10 = OpConstant %7 1 +%11 = OpConstant %7 2 +%12 = OpConstant %7 3 +%13 = OpConstantComposite %6 %10 %11 %12 +%14 = OpConstant %7 4 +%15 = OpConstant %7 5 +%16 = OpConstant %7 6 +%17 = OpConstantComposite %6 %14 %15 %16 +%18 = OpConstantComposite %5 %13 %17 +%19 = OpTypeInt 32 1 +%20 = OpConstant %19 1 +%22 = OpConstant %19 2 +%25 = OpTypePointer Function %7 +%26 = OpConstantNull %7 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%24 = OpVariable %25 Function %26 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%21 = OpCompositeExtract %6 %18 1 +%23 = OpCompositeExtract %7 %21 2 +OpStore %24 %23 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Const_IndexAccessor_Array_MultiLevel) { + // const ary = array, 2u>(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); + // var x = ary[1i][2i]; + + auto* ary = Const("ary", array(ty.vec3(), 2_u, vec3(1._f, 2._f, 3._f), + vec3(4._f, 5._f, 6._f))); + auto* x = Var("x", IndexAccessor(IndexAccessor(ary, 1_i), 2_i)); + WrapInFunction(ary, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 32 +%6 = OpConstant %5 6 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%7 = OpVariable %8 Function %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %7 %6 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Runtime_IndexAccessor_Array_MultiLevel) { + // var ary : array, 4u>; + // var x = ary[1i][2i]; + + auto* ary = Var("ary", ty.array(ty.vec3(), 4_u)); + auto* x = Var("x", IndexAccessor(IndexAccessor(ary, 1_i), 2_i)); + WrapInFunction(ary, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeVector %9 3 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 4 +%7 = OpTypeArray %8 %11 +%6 = OpTypePointer Function %7 +%12 = OpConstantNull %7 +%13 = OpTypeInt 32 1 +%14 = OpConstant %13 1 +%15 = OpConstant %13 2 +%16 = OpTypePointer Function %9 +%20 = OpConstantNull %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %12 +%19 = OpVariable %16 Function %20 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%17 = OpAccessChain %16 %5 %14 %15 +%18 = OpLoad %9 %17 +OpStore %19 %18 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Dynamic_IndexAccessor_Array_MultiLevel) { + // var ary : array, 4u>; + // var one = 1i; + // var x = ary[one][2i]; + + auto* ary = Var("ary", ty.array(ty.vec3(), 4_u)); + auto* one = Var("one", Expr(3_i)); + auto* x = Var("x", IndexAccessor(IndexAccessor(ary, one), 2_i)); + WrapInFunction(ary, one, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeVector %9 3 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 4 +%7 = OpTypeArray %8 %11 +%6 = OpTypePointer Function %7 +%12 = OpConstantNull %7 +%13 = OpTypeInt 32 1 +%14 = OpConstant %13 3 +%16 = OpTypePointer Function %13 +%17 = OpConstantNull %13 +%19 = OpConstant %13 2 +%20 = OpTypePointer Function %9 +%24 = OpConstantNull %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %12 +%15 = OpVariable %16 Function %17 +%23 = OpVariable %20 Function %24 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %15 %14 +%18 = OpLoad %13 %15 +%21 = OpAccessChain %20 %5 %18 %19 +%22 = OpLoad %9 %21 +OpStore %23 %22 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Const_IndexAccessor_Array_ArrayWithSwizzle) { + // let ary = array, 2u>(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); + // var x = a[1i].xy; + + auto* ary = Let("ary", array(ty.vec3(), 2_u, vec3(1._f, 2._f, 3._f), + vec3(4._f, 5._f, 6._f))); + auto* x = Var("x", MemberAccessor(IndexAccessor("ary", 1_i), "xy")); + WrapInFunction(ary, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%7 = OpTypeFloat 32 +%6 = OpTypeVector %7 3 +%8 = OpTypeInt 32 0 +%9 = OpConstant %8 2 +%5 = OpTypeArray %6 %9 +%10 = OpConstant %7 1 +%11 = OpConstant %7 2 +%12 = OpConstant %7 3 +%13 = OpConstantComposite %6 %10 %11 %12 +%14 = OpConstant %7 4 +%15 = OpConstant %7 5 +%16 = OpConstant %7 6 +%17 = OpConstantComposite %6 %14 %15 %16 +%18 = OpConstantComposite %5 %13 %17 +%19 = OpTypeInt 32 1 +%20 = OpConstant %19 1 +%22 = OpTypeVector %7 2 +%25 = OpTypePointer Function %22 +%26 = OpConstantNull %22 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%24 = OpVariable %25 Function %26 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%21 = OpCompositeExtract %6 %18 1 +%23 = OpVectorShuffle %22 %21 %21 0 1 +OpStore %24 %23 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Runtime_IndexAccessor_Array_ArrayWithSwizzle) { + // var ary : array, 4u>; + // var x = ary[1i].xy; + + auto* ary = Var("ary", ty.array(ty.vec3(), 4_u)); + auto* x = Var("x", MemberAccessor(IndexAccessor("ary", 1_i), "xy")); + WrapInFunction(ary, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeVector %9 3 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 4 +%7 = OpTypeArray %8 %11 +%6 = OpTypePointer Function %7 +%12 = OpConstantNull %7 +%13 = OpTypeInt 32 1 +%14 = OpConstant %13 1 +%15 = OpTypePointer Function %8 +%17 = OpTypeVector %9 2 +%21 = OpTypePointer Function %17 +%22 = OpConstantNull %17 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %12 +%20 = OpVariable %21 Function %22 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%16 = OpAccessChain %15 %5 %14 +%18 = OpLoad %8 %16 +%19 = OpVectorShuffle %17 %18 %18 0 1 +OpStore %20 %19 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Dynamic_IndexAccessor_Array_ArrayWithSwizzle) { + // var ary : array, 4u>; + // var one = 1i; + // var x = ary[one].xy; + + auto* ary = Var("ary", ty.array(ty.vec3(), 4_u)); + auto* one = Var("one", Expr(1_i)); + auto* x = Var("x", MemberAccessor(IndexAccessor("ary", one), "xy")); + WrapInFunction(ary, one, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeVector %9 3 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 4 +%7 = OpTypeArray %8 %11 +%6 = OpTypePointer Function %7 +%12 = OpConstantNull %7 +%13 = OpTypeInt 32 1 +%14 = OpConstant %13 1 +%16 = OpTypePointer Function %13 +%17 = OpConstantNull %13 +%19 = OpTypePointer Function %8 +%21 = OpTypeVector %9 2 +%25 = OpTypePointer Function %21 +%26 = OpConstantNull %21 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %12 +%15 = OpVariable %16 Function %17 +%24 = OpVariable %25 Function %26 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %15 %14 +%18 = OpLoad %13 %15 +%20 = OpAccessChain %19 %5 %18 +%22 = OpLoad %8 %20 +%23 = OpVectorShuffle %21 %22 %22 0 1 +OpStore %24 %23 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Let_IndexAccessor_Nested_Array_f32) { + // let pos : array, 3u> = array, 3u>( + // array(0.0, 0.5), + // array(-0.5, -0.5), + // array(0.5, -0.5)); + // var x = pos[1u][0u]; + + auto* pos = Let("pos", ty.array(ty.vec2(), 3_u), + Construct(ty.array(ty.vec2(), 3_u), vec2(0_f, 0.5_f), + vec2(-0.5_f, -0.5_f), vec2(0.5_f, -0.5_f))); + auto* x = Var("x", IndexAccessor(IndexAccessor(pos, 1_u), 0_u)); + WrapInFunction(pos, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%7 = OpTypeFloat 32 +%6 = OpTypeVector %7 2 +%8 = OpTypeInt 32 0 +%9 = OpConstant %8 3 +%5 = OpTypeArray %6 %9 +%10 = OpConstantNull %7 +%11 = OpConstant %7 0.5 +%12 = OpConstantComposite %6 %10 %11 +%13 = OpConstant %7 -0.5 +%14 = OpConstantComposite %6 %13 %13 +%15 = OpConstantComposite %6 %11 %13 +%16 = OpConstantComposite %5 %12 %14 %15 +%17 = OpConstant %8 1 +%19 = OpConstantNull %8 +%22 = OpTypePointer Function %7 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%21 = OpVariable %22 Function %10 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%18 = OpCompositeExtract %6 %16 1 +%20 = OpCompositeExtract %7 %18 0 +OpStore %21 %20 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Const_IndexAccessor_Nested_Array_f32) { + // const pos : array, 3u> = array, 3u>( + // array(0.0, 0.5), + // array(-0.5, -0.5), + // array(0.5, -0.5)); + // var x = pos[1u][0u]; + + auto* pos = Const("pos", ty.array(ty.vec2(), 3_u), + Construct(ty.array(ty.vec2(), 3_u), vec2(0_f, 0.5_f), + vec2(-0.5_f, -0.5_f), vec2(0.5_f, -0.5_f))); + auto* x = Var("x", IndexAccessor(IndexAccessor(pos, 1_u), 0_u)); + WrapInFunction(pos, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 32 +%6 = OpConstant %5 -0.5 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%7 = OpVariable %8 Function %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %7 %6 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Runtime_IndexAccessor_Nested_Array_f32) { + // var pos : array, 3u>; + // var x = pos[1u][2u]; + + auto* pos = Var("pos", ty.array(ty.vec2(), 3_u)); + auto* x = Var("x", IndexAccessor(IndexAccessor(pos, 1_u), 2_u)); + WrapInFunction(pos, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeVector %9 2 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 3 +%7 = OpTypeArray %8 %11 +%6 = OpTypePointer Function %7 +%12 = OpConstantNull %7 +%13 = OpConstant %10 1 +%14 = OpConstant %10 2 +%15 = OpTypePointer Function %9 +%19 = OpConstantNull %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %12 +%18 = OpVariable %15 Function %19 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%16 = OpAccessChain %15 %5 %13 %14 +%17 = OpLoad %9 %16 +OpStore %18 %17 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Dynamic_IndexAccessor_Nested_Array_f32) { + // var pos : array, 3u>; + // var one = 1u; + // var x = pos[one][2u]; + + auto* pos = Var("pos", ty.array(ty.vec2(), 3_u)); + auto* one = Var("one", Expr(2_u)); + auto* x = Var("x", IndexAccessor(IndexAccessor(pos, "one"), 2_u)); + WrapInFunction(pos, one, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeVector %9 2 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 3 +%7 = OpTypeArray %8 %11 +%6 = OpTypePointer Function %7 +%12 = OpConstantNull %7 +%13 = OpConstant %10 2 +%15 = OpTypePointer Function %10 +%16 = OpConstantNull %10 +%18 = OpTypePointer Function %9 +%22 = OpConstantNull %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %12 +%14 = OpVariable %15 Function %16 +%21 = OpVariable %18 Function %22 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %14 %13 +%17 = OpLoad %10 %14 +%19 = OpAccessChain %18 %5 %17 %13 +%20 = OpLoad %9 %19 +OpStore %21 %20 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Let_IndexAccessor_Matrix) { + // let a : mat2x2(vec2(1., 2.), vec2(3., 4.)); + // var x = a[1i] + + auto* a = Let("a", ty.mat2x2(), + Construct(ty.mat2x2(), Construct(ty.vec2(), 1_f, 2_f), + Construct(ty.vec2(), 3_f, 4_f))); + auto* x = Var("x", IndexAccessor("a", 1_i)); + WrapInFunction(a, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%7 = OpTypeFloat 32 +%6 = OpTypeVector %7 2 +%5 = OpTypeMatrix %6 2 +%8 = OpConstant %7 1 +%9 = OpConstant %7 2 +%10 = OpConstantComposite %6 %8 %9 +%11 = OpConstant %7 3 +%12 = OpConstant %7 4 +%13 = OpConstantComposite %6 %11 %12 +%14 = OpConstantComposite %5 %10 %13 +%15 = OpTypeInt 32 1 +%16 = OpConstant %15 1 +%19 = OpTypePointer Function %6 +%20 = OpConstantNull %6 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%18 = OpVariable %19 Function %20 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%17 = OpCompositeExtract %6 %14 1 +OpStore %18 %17 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Const_IndexAccessor_Matrix) { + // const a : mat2x2(vec2(1., 2.), vec2(3., 4.)); + // var x = a[1i] + + auto* a = Const("a", ty.mat2x2(), + Construct(ty.mat2x2(), Construct(ty.vec2(), 1_f, 2_f), + Construct(ty.vec2(), 3_f, 4_f))); + auto* x = Var("x", IndexAccessor("a", 1_i)); + WrapInFunction(a, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 3 +%8 = OpConstant %6 4 +%9 = OpConstantComposite %5 %7 %8 +%11 = OpTypePointer Function %5 +%12 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%10 = OpVariable %11 Function %12 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %10 %9 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Runtime_IndexAccessor_Matrix) { + // var a : mat2x2; + // var x = a[1i] + + auto* a = Var("a", ty.mat2x2()); + auto* x = Var("x", IndexAccessor("a", 1_i)); + WrapInFunction(a, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeVector %9 2 +%7 = OpTypeMatrix %8 2 +%6 = OpTypePointer Function %7 +%10 = OpConstantNull %7 +%11 = OpTypeInt 32 1 +%12 = OpConstant %11 1 +%13 = OpTypePointer Function %8 +%17 = OpConstantNull %8 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %10 +%16 = OpVariable %13 Function %17 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%14 = OpAccessChain %13 %5 %12 +%15 = OpLoad %8 %14 +OpStore %16 %15 +OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, Dynamic_IndexAccessor_Matrix) { + // var a : mat2x2; + // var idx : i32 + // var x = a[idx] + + auto* a = Var("a", ty.mat2x2()); + auto* idx = Var("idx", ty.i32()); + auto* x = Var("x", IndexAccessor("a", idx)); + WrapInFunction(a, idx, x); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeVector %9 2 +%7 = OpTypeMatrix %8 2 +%6 = OpTypePointer Function %7 +%10 = OpConstantNull %7 +%13 = OpTypeInt 32 1 +%12 = OpTypePointer Function %13 +%14 = OpConstantNull %13 +%16 = OpTypePointer Function %8 +%20 = OpConstantNull %8 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %10 +%11 = OpVariable %12 Function %14 +%19 = OpVariable %16 Function %20 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%15 = OpLoad %13 %11 +%17 = OpAccessChain %16 %5 %15 +%18 = OpLoad %8 %17 +OpStore %19 %18 +OpReturn +)"); + + Validate(b); } TEST_F(BuilderTest, MemberAccessor) { @@ -219,7 +897,7 @@ TEST_F(BuilderTest, MemberAccessor) { // var ident : my_struct // ident.b - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member("a", ty.f32()), Member("b", ty.f32()), }); @@ -229,27 +907,28 @@ TEST_F(BuilderTest, MemberAccessor) { auto* expr = MemberAccessor("ident", "b"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 9u); + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeFloat 32 +%7 = OpTypeStruct %8 %8 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 1 +%12 = OpTypePointer Function %8 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%13 = OpAccessChain %12 %5 %11 +%14 = OpLoad %8 %13 +OpReturn +)"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeStruct %4 %4 -%2 = OpTypePointer Function %3 -%5 = OpConstantNull %3 -%6 = OpTypeInt 32 0 -%7 = OpConstant %6 1 -%8 = OpTypePointer Function %4 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %5 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%9 = OpAccessChain %8 %1 %7 -)"); + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Nested) { @@ -263,40 +942,42 @@ TEST_F(BuilderTest, MemberAccessor_Nested) { // // var ident : my_struct // ident.inner.a - auto* inner_struct = Structure("Inner", { + auto* inner_struct = Structure("Inner", utils::Vector{ Member("a", ty.f32()), Member("b", ty.f32()), }); - auto* s_type = Structure("my_struct", {Member("inner", ty.Of(inner_struct))}); + auto* s_type = Structure("my_struct", utils::Vector{Member("inner", ty.Of(inner_struct))}); auto* var = Var("ident", ty.Of(s_type)); auto* expr = MemberAccessor(MemberAccessor("ident", "inner"), "b"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 11u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32 -%4 = OpTypeStruct %5 %5 -%3 = OpTypeStruct %4 -%2 = OpTypePointer Function %3 -%6 = OpConstantNull %3 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%9 = OpConstant %7 1 -%10 = OpTypePointer Function %5 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeStruct %9 %9 +%7 = OpTypeStruct %8 +%6 = OpTypePointer Function %7 +%10 = OpConstantNull %7 +%11 = OpTypeInt 32 0 +%12 = OpConstant %11 0 +%13 = OpConstant %11 1 +%14 = OpTypePointer Function %9 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %6 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %10 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%11 = OpAccessChain %10 %1 %8 %9 + R"(%15 = OpAccessChain %14 %5 %12 %13 +%16 = OpLoad %9 %15 +OpReturn )"); + + Validate(b); } TEST_F(BuilderTest, MemberAccessor_NonPointer) { @@ -307,31 +988,32 @@ TEST_F(BuilderTest, MemberAccessor_NonPointer) { // let ident : my_struct = my_struct(); // ident.b - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member("a", ty.f32()), Member("b", ty.f32()), }); - auto* var = Let("ident", ty.Of(s), Construct(ty.Of(s), 0.f, 0.f)); + auto* var = Let("ident", ty.Of(s), Construct(ty.Of(s), 0_f, 0_f)); auto* expr = MemberAccessor("ident", "b"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 5u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeStruct %2 %2 -%3 = OpConstant %2 0 -%4 = OpConstantComposite %1 %3 %3 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeStruct %6 %6 +%7 = OpConstantNull %5 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%5 = OpCompositeExtract %2 %4 1 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%8 = OpCompositeExtract %6 %7 1 +OpReturn )"); + + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Nested_NonPointer) { @@ -345,36 +1027,37 @@ TEST_F(BuilderTest, MemberAccessor_Nested_NonPointer) { // // let ident : my_struct = my_struct(); // ident.inner.a - auto* inner_struct = Structure("Inner", { + auto* inner_struct = Structure("Inner", utils::Vector{ Member("a", ty.f32()), Member("b", ty.f32()), }); - auto* s_type = Structure("my_struct", {Member("inner", ty.Of(inner_struct))}); + auto* s_type = Structure("my_struct", utils::Vector{Member("inner", ty.Of(inner_struct))}); auto* var = Let("ident", ty.Of(s_type), - Construct(ty.Of(s_type), Construct(ty.Of(inner_struct), 0.f, 0.f))); + Construct(ty.Of(s_type), Construct(ty.Of(inner_struct), 0_f, 0_f))); auto* expr = MemberAccessor(MemberAccessor("ident", "inner"), "b"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 8u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32 -%2 = OpTypeStruct %3 %3 -%1 = OpTypeStruct %2 -%4 = OpConstant %3 0 -%5 = OpConstantComposite %2 %4 %4 -%6 = OpConstantComposite %1 %5 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%7 = OpTypeFloat 32 +%6 = OpTypeStruct %7 %7 +%5 = OpTypeStruct %6 +%8 = OpConstantNull %5 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%7 = OpCompositeExtract %2 %6 0 -%8 = OpCompositeExtract %3 %7 1 + R"(%9 = OpCompositeExtract %6 %8 0 +%10 = OpCompositeExtract %7 %9 1 +OpReturn )"); + + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Nested_WithAlias) { @@ -389,40 +1072,42 @@ TEST_F(BuilderTest, MemberAccessor_Nested_WithAlias) { // // var ident : my_struct // ident.inner.a - auto* inner_struct = Structure("Inner", { + auto* inner_struct = Structure("Inner", utils::Vector{ Member("a", ty.f32()), Member("b", ty.f32()), }); auto* alias = Alias("Alias", ty.Of(inner_struct)); - auto* s_type = Structure("Outer", {Member("inner", ty.Of(alias))}); + auto* s_type = Structure("Outer", utils::Vector{Member("inner", ty.Of(alias))}); auto* var = Var("ident", ty.Of(s_type)); auto* expr = MemberAccessor(MemberAccessor("ident", "inner"), "a"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 10u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32 -%4 = OpTypeStruct %5 %5 -%3 = OpTypeStruct %4 -%2 = OpTypePointer Function %3 -%6 = OpConstantNull %3 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%9 = OpTypePointer Function %5 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeStruct %9 %9 +%7 = OpTypeStruct %8 +%6 = OpTypePointer Function %7 +%10 = OpConstantNull %7 +%11 = OpTypeInt 32 0 +%12 = OpConstant %11 0 +%13 = OpTypePointer Function %9 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %6 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %10 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%10 = OpAccessChain %9 %1 %8 %8 + R"(%14 = OpAccessChain %13 %5 %12 %12 +%15 = OpLoad %9 %14 +OpReturn )"); + + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_LHS) { @@ -435,41 +1120,42 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_LHS) { // // var ident : my_struct // ident.inner.a = 2.0f; - auto* inner_struct = Structure("Inner", { + auto* inner_struct = Structure("Inner", utils::Vector{ Member("a", ty.f32()), Member("b", ty.f32()), }); - auto* s_type = Structure("my_struct", {Member("inner", ty.Of(inner_struct))}); + auto* s_type = Structure("my_struct", utils::Vector{Member("inner", ty.Of(inner_struct))}); auto* var = Var("ident", ty.Of(s_type)); - auto* expr = Assign(MemberAccessor(MemberAccessor("ident", "inner"), "a"), Expr(2.0f)); + auto* expr = Assign(MemberAccessor(MemberAccessor("ident", "inner"), "a"), Expr(2_f)); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_TRUE(b.GenerateAssignStatement(expr)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32 -%4 = OpTypeStruct %5 %5 -%3 = OpTypeStruct %4 -%2 = OpTypePointer Function %3 -%6 = OpConstantNull %3 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%9 = OpTypePointer Function %5 -%11 = OpConstant %5 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeStruct %9 %9 +%7 = OpTypeStruct %8 +%6 = OpTypePointer Function %7 +%10 = OpConstantNull %7 +%11 = OpTypeInt 32 0 +%12 = OpConstant %11 0 +%13 = OpTypePointer Function %9 +%15 = OpConstant %9 2 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %6 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %10 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%10 = OpAccessChain %9 %1 %8 %8 -OpStore %10 %11 + R"(%14 = OpAccessChain %13 %5 %12 %12 +OpStore %14 %15 +OpReturn )"); + + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_RHS) { @@ -483,12 +1169,12 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_RHS) { // var ident : my_struct // var store : f32 = ident.inner.a - auto* inner_struct = Structure("Inner", { + auto* inner_struct = Structure("Inner", utils::Vector{ Member("a", ty.f32()), Member("b", ty.f32()), }); - auto* s_type = Structure("my_struct", {Member("inner", ty.Of(inner_struct))}); + auto* s_type = Structure("my_struct", utils::Vector{Member("inner", ty.Of(inner_struct))}); auto* var = Var("ident", ty.Of(s_type)); auto* store = Var("store", ty.f32()); @@ -497,33 +1183,33 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_RHS) { auto* expr = Assign("store", rhs); WrapInFunction(var, store, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunctionVariable(store)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_TRUE(b.GenerateAssignStatement(expr)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeFloat 32 -%4 = OpTypeStruct %5 %5 -%3 = OpTypeStruct %4 -%2 = OpTypePointer Function %3 -%6 = OpConstantNull %3 -%8 = OpTypePointer Function %5 -%9 = OpConstantNull %5 -%10 = OpTypeInt 32 0 -%11 = OpConstant %10 0 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%9 = OpTypeFloat 32 +%8 = OpTypeStruct %9 %9 +%7 = OpTypeStruct %8 +%6 = OpTypePointer Function %7 +%10 = OpConstantNull %7 +%12 = OpTypePointer Function %9 +%13 = OpConstantNull %9 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 0 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %6 -%7 = OpVariable %8 Function %9 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %10 +%11 = OpVariable %12 Function %13 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%12 = OpAccessChain %8 %1 %11 %11 -%13 = OpLoad %5 %12 -OpStore %7 %13 + R"(%16 = OpAccessChain %12 %5 %15 %15 +%17 = OpLoad %9 %16 +OpStore %11 %17 +OpReturn )"); + + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Swizzle_Single) { @@ -534,27 +1220,28 @@ TEST_F(BuilderTest, MemberAccessor_Swizzle_Single) { auto* expr = MemberAccessor("ident", "y"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 9u); + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 1 +%12 = OpTypePointer Function %8 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%13 = OpAccessChain %12 %5 %11 +%14 = OpLoad %8 %13 +OpReturn +)"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Function %3 -%5 = OpConstantNull %3 -%6 = OpTypeInt 32 0 -%7 = OpConstant %6 1 -%8 = OpTypePointer Function %4 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %5 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%9 = OpAccessChain %8 %1 %7 -)"); + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Swizzle_MultipleNames) { @@ -565,26 +1252,26 @@ TEST_F(BuilderTest, MemberAccessor_Swizzle_MultipleNames) { auto* expr = MemberAccessor("ident", "yx"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 8u); + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%10 = OpTypeVector %8 2 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%11 = OpLoad %7 %5 +%12 = OpVectorShuffle %10 %11 %11 1 0 +OpReturn +)"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Function %3 -%5 = OpConstantNull %3 -%6 = OpTypeVector %4 2 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %5 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%7 = OpLoad %3 %1 -%8 = OpVectorShuffle %6 %7 %7 1 0 -)"); + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Swizzle_of_Swizzle) { @@ -595,27 +1282,27 @@ TEST_F(BuilderTest, MemberAccessor_Swizzle_of_Swizzle) { auto* expr = MemberAccessor(MemberAccessor("ident", "yxz"), "xz"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 9u); + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%12 = OpTypeVector %8 2 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%10 = OpLoad %7 %5 +%11 = OpVectorShuffle %7 %10 %10 1 0 2 +%13 = OpVectorShuffle %12 %11 %11 0 2 +OpReturn +)"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Function %3 -%5 = OpConstantNull %3 -%8 = OpTypeVector %4 2 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %5 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpLoad %3 %1 -%7 = OpVectorShuffle %3 %6 %6 1 0 2 -%9 = OpVectorShuffle %8 %7 %7 0 2 -)"); + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Member_of_Swizzle) { @@ -626,26 +1313,26 @@ TEST_F(BuilderTest, MemberAccessor_Member_of_Swizzle) { auto* expr = MemberAccessor(MemberAccessor("ident", "yxz"), "x"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 8u); + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%10 = OpLoad %7 %5 +%11 = OpVectorShuffle %7 %10 %10 1 0 2 +%12 = OpCompositeExtract %8 %11 0 +OpReturn +)"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Function %3 -%5 = OpConstantNull %3 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %5 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpLoad %3 %1 -%7 = OpVectorShuffle %3 %6 %6 1 0 2 -%8 = OpCompositeExtract %4 %7 0 -)"); + Validate(b); } TEST_F(BuilderTest, MemberAccessor_Array_of_Swizzle) { @@ -656,28 +1343,28 @@ TEST_F(BuilderTest, MemberAccessor_Array_of_Swizzle) { auto* expr = IndexAccessor(MemberAccessor("ident", "yxz"), 1_i); WrapInFunction(var, expr); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 10u); + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%12 = OpTypeInt 32 1 +%13 = OpConstant %12 1 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %9 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%10 = OpLoad %7 %5 +%11 = OpVectorShuffle %7 %10 %10 1 0 2 +%14 = OpCompositeExtract %8 %11 1 +OpReturn +)"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Function %3 -%5 = OpConstantNull %3 -%8 = OpTypeInt 32 1 -%9 = OpConstant %8 1 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %5 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpLoad %3 %1 -%7 = OpVectorShuffle %3 %6 %6 1 0 2 -%10 = OpCompositeExtract %4 %7 1 -)"); + Validate(b); } TEST_F(BuilderTest, IndexAccessor_Mixed_ArrayAndMember) { @@ -693,11 +1380,11 @@ TEST_F(BuilderTest, IndexAccessor_Mixed_ArrayAndMember) { // var index : array // index[0i].foo[2i].bar.baz.yx - auto* c_type = Structure("C", {Member("baz", ty.vec3())}); + auto* c_type = Structure("C", utils::Vector{Member("baz", ty.vec3())}); - auto* b_type = Structure("B", {Member("bar", ty.Of(c_type))}); + auto* b_type = Structure("B", utils::Vector{Member("bar", ty.Of(c_type))}); auto* b_ary_type = ty.array(ty.Of(b_type), 3_u); - auto* a_type = Structure("A", {Member("foo", b_ary_type)}); + auto* a_type = Structure("A", utils::Vector{Member("foo", b_ary_type)}); auto* a_ary_type = ty.array(ty.Of(a_type), 2_u); auto* var = Var("index", a_ary_type); @@ -709,323 +1396,37 @@ TEST_F(BuilderTest, IndexAccessor_Mixed_ArrayAndMember) { "yx"); WrapInFunction(var, expr); - spirv::Builder& b = Build(); - - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); - - EXPECT_EQ(b.GenerateAccessorExpression(expr), 22u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%9 = OpTypeFloat 32 -%8 = OpTypeVector %9 3 -%7 = OpTypeStruct %8 -%6 = OpTypeStruct %7 -%10 = OpTypeInt 32 0 -%11 = OpConstant %10 3 -%5 = OpTypeArray %6 %11 -%4 = OpTypeStruct %5 -%12 = OpConstant %10 2 -%3 = OpTypeArray %4 %12 -%2 = OpTypePointer Function %3 -%13 = OpConstantNull %3 -%14 = OpTypeInt 32 1 -%15 = OpConstant %14 0 -%16 = OpConstant %10 0 -%17 = OpConstant %14 2 -%18 = OpTypePointer Function %8 -%20 = OpTypeVector %9 2 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%1 = OpVariable %2 Function %13 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%19 = OpAccessChain %18 %1 %15 %16 %17 %16 %16 -%21 = OpLoad %8 %19 -%22 = OpVectorShuffle %20 %21 %21 1 0 -)"); -} - -TEST_F(BuilderTest, IndexAccessor_Of_Vec) { - // let pos : array, 3u> = array, 3u>( - // vec2(0.0, 0.5), - // vec2(-0.5, -0.5), - // vec2(0.5, -0.5)); - // pos[1u] - - auto* var = Let("pos", ty.array(ty.vec2(), 3_u), - Construct(ty.array(ty.vec2(), 3_u), vec2(0.0f, 0.5f), - vec2(-0.5f, -0.5f), vec2(0.5f, -0.5f))); - - auto* expr = IndexAccessor("pos", 1_u); - WrapInFunction(var, expr); - spirv::Builder& b = SanitizeAndBuild(); - ASSERT_TRUE(b.Build()); + ASSERT_TRUE(b.Build()) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid %1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 2 -%8 = OpTypeInt 32 0 -%9 = OpConstant %8 3 -%5 = OpTypeArray %6 %9 -%10 = OpConstant %7 0 -%11 = OpConstant %7 0.5 -%12 = OpConstantComposite %6 %10 %11 -%13 = OpConstant %7 -0.5 -%14 = OpConstantComposite %6 %13 %13 -%15 = OpConstantComposite %6 %11 %13 -%16 = OpConstantComposite %5 %12 %14 %15 -%17 = OpConstant %8 1 +%13 = OpTypeFloat 32 +%12 = OpTypeVector %13 3 +%11 = OpTypeStruct %12 +%10 = OpTypeStruct %11 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 3 +%9 = OpTypeArray %10 %15 +%8 = OpTypeStruct %9 +%16 = OpConstant %14 2 +%7 = OpTypeArray %8 %16 +%6 = OpTypePointer Function %7 +%17 = OpConstantNull %7 +%18 = OpTypeInt 32 1 +%19 = OpConstantNull %18 +%20 = OpConstant %14 0 +%21 = OpConstant %18 2 +%22 = OpTypePointer Function %12 +%24 = OpTypeVector %13 2 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%18 = OpCompositeExtract %6 %16 1 -OpReturn -)"); - - Validate(b); -} - -TEST_F(BuilderTest, IndexAccessor_Of_Array_Of_f32) { - // let pos : array, 3u> = array, 3u>( - // array(0.0, 0.5), - // array(-0.5, -0.5), - // array(0.5, -0.5)); - // pos[2u][1u] - - auto* var = Let("pos", ty.array(ty.vec2(), 3_u), - Construct(ty.array(ty.vec2(), 3_u), vec2(0.0f, 0.5f), - vec2(-0.5f, -0.5f), vec2(0.5f, -0.5f))); - - auto* expr = IndexAccessor(IndexAccessor("pos", 2_u), 1_u); - WrapInFunction(var, expr); - - spirv::Builder& b = SanitizeAndBuild(); - - ASSERT_TRUE(b.Build()); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 2 -%8 = OpTypeInt 32 0 -%9 = OpConstant %8 3 -%5 = OpTypeArray %6 %9 -%10 = OpConstant %7 0 -%11 = OpConstant %7 0.5 -%12 = OpConstantComposite %6 %10 %11 -%13 = OpConstant %7 -0.5 -%14 = OpConstantComposite %6 %13 %13 -%15 = OpConstantComposite %6 %11 %13 -%16 = OpConstantComposite %5 %12 %14 %15 -%17 = OpConstant %8 2 -%19 = OpConstant %8 1 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%18 = OpCompositeExtract %6 %16 2 -%20 = OpCompositeExtract %7 %18 1 -OpReturn -)"); - - Validate(b); -} - -TEST_F(BuilderTest, IndexAccessor_Vec_Literal) { - // let pos : vec2 = vec2(0.0, 0.5); - // pos[1] - - auto* var = Let("pos", ty.vec2(), vec2(0.0f, 0.5f)); - - auto* expr = IndexAccessor("pos", 1_u); - WrapInFunction(var, expr); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 8u) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 2 -%3 = OpConstant %2 0 -%4 = OpConstant %2 0.5 -%5 = OpConstantComposite %1 %3 %4 -%6 = OpTypeInt 32 0 -%7 = OpConstant %6 1 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), ""); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%8 = OpCompositeExtract %2 %5 1 -)"); -} - -TEST_F(BuilderTest, IndexAccessor_Vec_Dynamic) { - // let pos : vec2 = vec2(0.0, 0.5); - // idx : i32 - // pos[idx] - - auto* var = Let("pos", ty.vec2(), vec2(0.0f, 0.5f)); - auto* idx = Var("idx", ty.i32()); - auto* expr = IndexAccessor("pos", idx); - - WrapInFunction(var, idx, expr); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunctionVariable(idx)) << b.error(); - EXPECT_EQ(b.GenerateAccessorExpression(expr), 11u) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 2 -%3 = OpConstant %2 0 -%4 = OpConstant %2 0.5 -%5 = OpConstantComposite %1 %3 %4 -%8 = OpTypeInt 32 1 -%7 = OpTypePointer Function %8 -%9 = OpConstantNull %8 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%6 = OpVariable %7 Function %9 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%5 = OpVariable %6 Function %17 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%10 = OpLoad %8 %6 -%11 = OpVectorExtractDynamic %2 %5 %10 -)"); -} - -TEST_F(BuilderTest, IndexAccessor_Array_Literal) { - // let a : array; - // a[2i] - - auto* var = Let("a", ty.array(), Construct(ty.array(), 0.0f, 0.5f, 1.0f)); - auto* expr = IndexAccessor("a", 2_i); - WrapInFunction(var, expr); - - spirv::Builder& b = SanitizeAndBuild(); - - ASSERT_TRUE(b.Build()); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeFloat 32 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 3 -%5 = OpTypeArray %6 %8 -%9 = OpConstant %6 0 -%10 = OpConstant %6 0.5 -%11 = OpConstant %6 1 -%12 = OpConstantComposite %5 %9 %10 %11 -%13 = OpTypeInt 32 1 -%14 = OpConstant %13 2 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), ""); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%15 = OpCompositeExtract %6 %12 2 -OpReturn -)"); - - Validate(b); -} - -TEST_F(BuilderTest, IndexAccessor_Array_Dynamic) { - // let a : array; - // idx : i32 - // a[idx] - - auto* var = Let("a", ty.array(), Construct(ty.array(), 0.0f, 0.5f, 1.0f)); - - auto* idx = Var("idx", ty.i32()); - auto* expr = IndexAccessor("a", idx); - - WrapInFunction(var, idx, expr); - - spirv::Builder& b = SanitizeAndBuild(); - - ASSERT_TRUE(b.Build()); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeFloat 32 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 3 -%5 = OpTypeArray %6 %8 -%9 = OpConstant %6 0 -%10 = OpConstant %6 0.5 -%11 = OpConstant %6 1 -%12 = OpConstantComposite %5 %9 %10 %11 -%15 = OpTypeInt 32 1 -%14 = OpTypePointer Function %15 -%16 = OpConstantNull %15 -%18 = OpTypePointer Function %5 -%19 = OpConstantNull %5 -%21 = OpTypePointer Function %6 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%13 = OpVariable %14 Function %16 -%17 = OpVariable %18 Function %19 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(OpStore %17 %12 -%20 = OpLoad %15 %13 -%22 = OpAccessChain %21 %17 %20 -%23 = OpLoad %6 %22 -OpReturn -)"); - - Validate(b); -} - -TEST_F(BuilderTest, IndexAccessor_Matrix_Dynamic) { - // let a : mat2x2(vec2(1., 2.), vec2(3., 4.)); - // idx : i32 - // a[idx] - - auto* var = Let("a", ty.mat2x2(), - Construct(ty.mat2x2(), Construct(ty.vec2(), 1.f, 2.f), - Construct(ty.vec2(), 3.f, 4.f))); - - auto* idx = Var("idx", ty.i32()); - auto* expr = IndexAccessor("a", idx); - - WrapInFunction(var, idx, expr); - - spirv::Builder& b = SanitizeAndBuild(); - - ASSERT_TRUE(b.Build()); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 2 -%5 = OpTypeMatrix %6 2 -%8 = OpConstant %7 1 -%9 = OpConstant %7 2 -%10 = OpConstantComposite %6 %8 %9 -%11 = OpConstant %7 3 -%12 = OpConstant %7 4 -%13 = OpConstantComposite %6 %11 %12 -%14 = OpConstantComposite %5 %10 %13 -%17 = OpTypeInt 32 1 -%16 = OpTypePointer Function %17 -%18 = OpConstantNull %17 -%20 = OpTypePointer Function %5 -%21 = OpConstantNull %5 -%23 = OpTypePointer Function %6 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), - R"(%15 = OpVariable %16 Function %18 -%19 = OpVariable %20 Function %21 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(OpStore %19 %14 -%22 = OpLoad %17 %15 -%24 = OpAccessChain %23 %19 %22 -%25 = OpLoad %6 %24 + R"(%23 = OpAccessChain %22 %5 %19 %20 %21 %20 %20 +%25 = OpLoad %12 %23 +%26 = OpVectorShuffle %24 %25 %25 1 0 OpReturn )"); diff --git a/src/tint/writer/spirv/builder_assign_test.cc b/src/tint/writer/spirv/builder_assign_test.cc index 1e02e27787..be30dc76c3 100644 --- a/src/tint/writer/spirv/builder_assign_test.cc +++ b/src/tint/writer/spirv/builder_assign_test.cc @@ -23,9 +23,9 @@ namespace { using BuilderTest = TestHelper; TEST_F(BuilderTest, Assign_Var) { - auto* v = Global("var", ty.f32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.f32(), ast::StorageClass::kPrivate); - auto* assign = Assign("var", 1.f); + auto* assign = Assign("var", 1_f); WrapInFunction(assign); @@ -51,9 +51,9 @@ TEST_F(BuilderTest, Assign_Var) { } TEST_F(BuilderTest, Assign_Var_OutsideFunction_IsError) { - auto* v = Global("var", ty.f32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.f32(), ast::StorageClass::kPrivate); - auto* assign = Assign("var", Expr(1.f)); + auto* assign = Assign("var", Expr(1_f)); WrapInFunction(assign); @@ -70,7 +70,7 @@ TEST_F(BuilderTest, Assign_Var_OutsideFunction_IsError) { } TEST_F(BuilderTest, Assign_Var_ZeroConstructor) { - auto* v = Global("var", ty.vec3(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.vec3(), ast::StorageClass::kPrivate); auto* val = vec3(); auto* assign = Assign("var", val); @@ -98,10 +98,10 @@ TEST_F(BuilderTest, Assign_Var_ZeroConstructor) { )"); } -TEST_F(BuilderTest, Assign_Var_Complex_ConstructorWithExtract) { - auto* init = vec3(vec2(1.f, 2.f), 3.f); +TEST_F(BuilderTest, Assign_Var_Complex_ConstructorNestedVector) { + auto* init = vec3(vec2(1_f, 2_f), 3_f); - auto* v = Global("var", ty.vec3(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.vec3(), ast::StorageClass::kPrivate); auto* assign = Assign("var", init); @@ -121,24 +121,20 @@ TEST_F(BuilderTest, Assign_Var_Complex_ConstructorWithExtract) { %2 = OpTypePointer Private %3 %5 = OpConstantNull %3 %1 = OpVariable %2 Private %5 -%6 = OpTypeVector %4 2 -%7 = OpConstant %4 1 -%8 = OpConstant %4 2 -%9 = OpConstantComposite %6 %7 %8 -%12 = OpConstant %4 3 +%6 = OpConstant %4 1 +%7 = OpConstant %4 2 +%8 = OpConstant %4 3 +%9 = OpConstantComposite %3 %6 %7 %8 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%10 = OpCompositeExtract %4 %9 0 -%11 = OpCompositeExtract %4 %9 1 -%13 = OpCompositeConstruct %3 %10 %11 %12 -OpStore %1 %13 + R"(OpStore %1 %9 )"); } TEST_F(BuilderTest, Assign_Var_Complex_Constructor) { - auto* init = vec3(1.f, 2.f, 3.f); + auto* init = vec3(1_f, 2_f, 3_f); - auto* v = Global("var", ty.vec3(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.vec3(), ast::StorageClass::kPrivate); auto* assign = Assign("var", init); @@ -176,14 +172,14 @@ TEST_F(BuilderTest, Assign_StructMember) { // var ident : my_struct // ident.b = 4.0; - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member("a", ty.f32()), Member("b", ty.f32()), }); auto* v = Var("ident", ty.Of(s)); - auto* assign = Assign(MemberAccessor("ident", "b"), Expr(4.f)); + auto* assign = Assign(MemberAccessor("ident", "b"), Expr(4_f)); WrapInFunction(v, assign); @@ -213,9 +209,9 @@ OpStore %8 %9 } TEST_F(BuilderTest, Assign_Vector) { - auto* v = Global("var", ty.vec3(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.vec3(), ast::StorageClass::kPrivate); - auto* val = vec3(1.f, 1.f, 3.f); + auto* val = vec3(1_f, 1_f, 3_f); auto* assign = Assign("var", val); WrapInFunction(assign); @@ -247,9 +243,9 @@ TEST_F(BuilderTest, Assign_Vector) { TEST_F(BuilderTest, Assign_Vector_MemberByName) { // var.y = 1 - auto* v = Global("var", ty.vec3(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.vec3(), ast::StorageClass::kPrivate); - auto* assign = Assign(MemberAccessor("var", "y"), Expr(1.f)); + auto* assign = Assign(MemberAccessor("var", "y"), Expr(1_f)); WrapInFunction(assign); @@ -282,9 +278,9 @@ OpStore %9 %10 TEST_F(BuilderTest, Assign_Vector_MemberByIndex) { // var[1] = 1 - auto* v = Global("var", ty.vec3(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.vec3(), ast::StorageClass::kPrivate); - auto* assign = Assign(IndexAccessor("var", 1_i), Expr(1.f)); + auto* assign = Assign(IndexAccessor("var", 1_i), Expr(1_f)); WrapInFunction(assign); diff --git a/src/tint/writer/spirv/builder_binary_expression_test.cc b/src/tint/writer/spirv/builder_binary_expression_test.cc index 17ca134e96..922473eb43 100644 --- a/src/tint/writer/spirv/builder_binary_expression_test.cc +++ b/src/tint/writer/spirv/builder_binary_expression_test.cc @@ -191,12 +191,12 @@ INSTANTIATE_TEST_SUITE_P( BinaryData{ast::BinaryOp::kSubtract, "OpISub"}, BinaryData{ast::BinaryOp::kXor, "OpBitwiseXor"})); -using BinaryArithFloatTest = TestParamHelper; -TEST_P(BinaryArithFloatTest, Scalar) { +using BinaryArithF32Test = TestParamHelper; +TEST_P(BinaryArithF32Test, Scalar) { auto param = GetParam(); - auto* lhs = Expr(3.2f); - auto* rhs = Expr(4.5f); + auto* lhs = Expr(3.2_f); + auto* rhs = Expr(4.5_f); auto* expr = create(param.op, lhs, rhs); @@ -215,11 +215,11 @@ TEST_P(BinaryArithFloatTest, Scalar) { "%4 = " + param.name + " %1 %2 %3\n"); } -TEST_P(BinaryArithFloatTest, Vector) { +TEST_P(BinaryArithF32Test, Vector) { auto param = GetParam(); - auto* lhs = vec3(1.f, 1.f, 1.f); - auto* rhs = vec3(1.f, 1.f, 1.f); + auto* lhs = vec3(1_f, 1_f, 1_f); + auto* rhs = vec3(1_f, 1_f, 1_f); auto* expr = create(param.op, lhs, rhs); @@ -239,7 +239,66 @@ TEST_P(BinaryArithFloatTest, Vector) { "%5 = " + param.name + " %1 %4 %4\n"); } INSTANTIATE_TEST_SUITE_P(BuilderTest, - BinaryArithFloatTest, + BinaryArithF32Test, + testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpFAdd"}, + BinaryData{ast::BinaryOp::kDivide, "OpFDiv"}, + BinaryData{ast::BinaryOp::kModulo, "OpFRem"}, + BinaryData{ast::BinaryOp::kMultiply, "OpFMul"}, + BinaryData{ast::BinaryOp::kSubtract, "OpFSub"})); + +using BinaryArithF16Test = TestParamHelper; +TEST_P(BinaryArithF16Test, Scalar) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + + auto* lhs = Expr(3.2_h); + auto* rhs = Expr(4.5_h); + + auto* expr = create(param.op, lhs, rhs); + + WrapInFunction(expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 4u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1.998p+1 +%3 = OpConstant %1 0x1.2p+2 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + "%4 = " + param.name + " %1 %2 %3\n"); +} + +TEST_P(BinaryArithF16Test, Vector) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + + auto* lhs = vec3(1_h, 1_h, 1_h); + auto* rhs = vec3(1_h, 1_h, 1_h); + + auto* expr = create(param.op, lhs, rhs); + + WrapInFunction(expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 5u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstantComposite %1 %3 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + "%5 = " + param.name + " %1 %4 %4\n"); +} +INSTANTIATE_TEST_SUITE_P(BuilderTest, + BinaryArithF16Test, testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpFAdd"}, BinaryData{ast::BinaryOp::kDivide, "OpFDiv"}, BinaryData{ast::BinaryOp::kModulo, "OpFRem"}, @@ -264,7 +323,7 @@ TEST_P(BinaryOperatorBoolTest, Scalar) { EXPECT_EQ(b.GenerateBinaryExpression(expr), 4u) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeBool %2 = OpConstantTrue %1 -%3 = OpConstantFalse %1 +%3 = OpConstantNull %1 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), "%4 = " + param.name + " %1 %2 %3\n"); @@ -287,7 +346,7 @@ TEST_P(BinaryOperatorBoolTest, Vector) { EXPECT_EQ(b.GenerateBinaryExpression(expr), 7u) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeBool %1 = OpTypeVector %2 3 -%3 = OpConstantFalse %2 +%3 = OpConstantNull %2 %4 = OpConstantTrue %2 %5 = OpConstantComposite %1 %3 %4 %3 %6 = OpConstantComposite %1 %4 %3 %4 @@ -422,12 +481,12 @@ INSTANTIATE_TEST_SUITE_P( BinaryData{ast::BinaryOp::kLessThanEqual, "OpSLessThanEqual"}, BinaryData{ast::BinaryOp::kNotEqual, "OpINotEqual"})); -using BinaryCompareFloatTest = TestParamHelper; -TEST_P(BinaryCompareFloatTest, Scalar) { +using BinaryCompareF32Test = TestParamHelper; +TEST_P(BinaryCompareF32Test, Scalar) { auto param = GetParam(); - auto* lhs = Expr(3.2f); - auto* rhs = Expr(4.5f); + auto* lhs = Expr(3.2_f); + auto* rhs = Expr(4.5_f); auto* expr = create(param.op, lhs, rhs); @@ -447,11 +506,11 @@ TEST_P(BinaryCompareFloatTest, Scalar) { "%4 = " + param.name + " %5 %2 %3\n"); } -TEST_P(BinaryCompareFloatTest, Vector) { +TEST_P(BinaryCompareF32Test, Vector) { auto param = GetParam(); - auto* lhs = vec3(1.f, 1.f, 1.f); - auto* rhs = vec3(1.f, 1.f, 1.f); + auto* lhs = vec3(1_f, 1_f, 1_f); + auto* rhs = vec3(1_f, 1_f, 1_f); auto* expr = create(param.op, lhs, rhs); @@ -474,7 +533,7 @@ TEST_P(BinaryCompareFloatTest, Vector) { } INSTANTIATE_TEST_SUITE_P( BuilderTest, - BinaryCompareFloatTest, + BinaryCompareF32Test, testing::Values(BinaryData{ast::BinaryOp::kEqual, "OpFOrdEqual"}, BinaryData{ast::BinaryOp::kGreaterThan, "OpFOrdGreaterThan"}, BinaryData{ast::BinaryOp::kGreaterThanEqual, "OpFOrdGreaterThanEqual"}, @@ -482,9 +541,73 @@ INSTANTIATE_TEST_SUITE_P( BinaryData{ast::BinaryOp::kLessThanEqual, "OpFOrdLessThanEqual"}, BinaryData{ast::BinaryOp::kNotEqual, "OpFOrdNotEqual"})); -TEST_F(BuilderTest, Binary_Multiply_VectorScalar) { - auto* lhs = vec3(1.f, 1.f, 1.f); - auto* rhs = Expr(1.f); +using BinaryCompareF16Test = TestParamHelper; +TEST_P(BinaryCompareF16Test, Scalar) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + + auto* lhs = Expr(3.2_h); + auto* rhs = Expr(4.5_h); + + auto* expr = create(param.op, lhs, rhs); + + WrapInFunction(expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 4u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1.998p+1 +%3 = OpConstant %1 0x1.2p+2 +%5 = OpTypeBool +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + "%4 = " + param.name + " %5 %2 %3\n"); +} + +TEST_P(BinaryCompareF16Test, Vector) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + + auto* lhs = vec3(1_h, 1_h, 1_h); + auto* rhs = vec3(1_h, 1_h, 1_h); + + auto* expr = create(param.op, lhs, rhs); + + WrapInFunction(expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 5u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstantComposite %1 %3 %3 %3 +%7 = OpTypeBool +%6 = OpTypeVector %7 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + "%5 = " + param.name + " %6 %4 %4\n"); +} +INSTANTIATE_TEST_SUITE_P( + BuilderTest, + BinaryCompareF16Test, + testing::Values(BinaryData{ast::BinaryOp::kEqual, "OpFOrdEqual"}, + BinaryData{ast::BinaryOp::kGreaterThan, "OpFOrdGreaterThan"}, + BinaryData{ast::BinaryOp::kGreaterThanEqual, "OpFOrdGreaterThanEqual"}, + BinaryData{ast::BinaryOp::kLessThan, "OpFOrdLessThan"}, + BinaryData{ast::BinaryOp::kLessThanEqual, "OpFOrdLessThanEqual"}, + BinaryData{ast::BinaryOp::kNotEqual, "OpFOrdNotEqual"})); + +TEST_F(BuilderTest, Binary_Multiply_VectorScalar_F32) { + auto* lhs = vec3(1_f, 1_f, 1_f); + auto* rhs = Expr(1_f); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -505,9 +628,34 @@ TEST_F(BuilderTest, Binary_Multiply_VectorScalar) { "%5 = OpVectorTimesScalar %1 %4 %3\n"); } -TEST_F(BuilderTest, Binary_Multiply_ScalarVector) { - auto* lhs = Expr(1.f); - auto* rhs = vec3(1.f, 1.f, 1.f); +TEST_F(BuilderTest, Binary_Multiply_VectorScalar_F16) { + Enable(ast::Extension::kF16); + + auto* lhs = vec3(1_h, 1_h, 1_h); + auto* rhs = Expr(1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + + WrapInFunction(expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 5u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), + R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstantComposite %1 %3 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + "%5 = OpVectorTimesScalar %1 %4 %3\n"); +} + +TEST_F(BuilderTest, Binary_Multiply_ScalarVector_F32) { + auto* lhs = Expr(1_f); + auto* rhs = vec3(1_f, 1_f, 1_f); auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); @@ -528,10 +676,35 @@ TEST_F(BuilderTest, Binary_Multiply_ScalarVector) { "%5 = OpVectorTimesScalar %3 %4 %2\n"); } -TEST_F(BuilderTest, Binary_Multiply_MatrixScalar) { +TEST_F(BuilderTest, Binary_Multiply_ScalarVector_F16) { + Enable(ast::Extension::kF16); + + auto* lhs = Expr(1_h); + auto* rhs = vec3(1_h, 1_h, 1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, rhs); + + WrapInFunction(expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 5u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), + R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1p+0 +%3 = OpTypeVector %1 3 +%4 = OpConstantComposite %3 %2 %2 %2 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + "%5 = OpVectorTimesScalar %3 %4 %2\n"); +} + +TEST_F(BuilderTest, Binary_Multiply_MatrixScalar_F32) { auto* var = Var("mat", ty.mat3x3()); - auto* expr = create(ast::BinaryOp::kMultiply, Expr("mat"), Expr(1.f)); + auto* expr = create(ast::BinaryOp::kMultiply, Expr("mat"), Expr(1_f)); WrapInFunction(var, expr); @@ -555,10 +728,39 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixScalar) { )"); } -TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix) { +TEST_F(BuilderTest, Binary_Multiply_MatrixScalar_F16) { + Enable(ast::Extension::kF16); + + auto* var = Var("mat", ty.mat3x3()); + + auto* expr = create(ast::BinaryOp::kMultiply, Expr("mat"), Expr(1_h)); + + WrapInFunction(var, expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 8u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), + R"(%5 = OpTypeFloat 16 +%4 = OpTypeVector %5 3 +%3 = OpTypeMatrix %4 3 +%2 = OpTypePointer Function %3 +%1 = OpVariable %2 Function +%7 = OpConstant %5 0x1p+0 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%6 = OpLoad %3 %1 +%8 = OpMatrixTimesScalar %3 %6 %7 +)"); +} + +TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix_F32) { auto* var = Var("mat", ty.mat3x3()); - auto* expr = create(ast::BinaryOp::kMultiply, Expr(1.f), Expr("mat")); + auto* expr = create(ast::BinaryOp::kMultiply, Expr(1_f), Expr("mat")); WrapInFunction(var, expr); @@ -582,9 +784,38 @@ TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix) { )"); } -TEST_F(BuilderTest, Binary_Multiply_MatrixVector) { +TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix_F16) { + Enable(ast::Extension::kF16); + + auto* var = Var("mat", ty.mat3x3()); + + auto* expr = create(ast::BinaryOp::kMultiply, Expr(1_h), Expr("mat")); + + WrapInFunction(var, expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 8u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), + R"(%5 = OpTypeFloat 16 +%4 = OpTypeVector %5 3 +%3 = OpTypeMatrix %4 3 +%2 = OpTypePointer Function %3 +%1 = OpVariable %2 Function +%6 = OpConstant %5 0x1p+0 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%7 = OpLoad %3 %1 +%8 = OpMatrixTimesScalar %3 %7 %6 +)"); +} + +TEST_F(BuilderTest, Binary_Multiply_MatrixVector_F32) { auto* var = Var("mat", ty.mat3x3()); - auto* rhs = vec3(1.f, 1.f, 1.f); + auto* rhs = vec3(1_f, 1_f, 1_f); auto* expr = create(ast::BinaryOp::kMultiply, Expr("mat"), rhs); @@ -611,9 +842,40 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixVector) { )"); } -TEST_F(BuilderTest, Binary_Multiply_VectorMatrix) { +TEST_F(BuilderTest, Binary_Multiply_MatrixVector_F16) { + Enable(ast::Extension::kF16); + + auto* var = Var("mat", ty.mat3x3()); + auto* rhs = vec3(1_h, 1_h, 1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, Expr("mat"), rhs); + + WrapInFunction(var, expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 9u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), + R"(%5 = OpTypeFloat 16 +%4 = OpTypeVector %5 3 +%3 = OpTypeMatrix %4 3 +%2 = OpTypePointer Function %3 +%1 = OpVariable %2 Function +%7 = OpConstant %5 0x1p+0 +%8 = OpConstantComposite %4 %7 %7 %7 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%6 = OpLoad %3 %1 +%9 = OpMatrixTimesVector %4 %6 %8 +)"); +} + +TEST_F(BuilderTest, Binary_Multiply_VectorMatrix_F32) { auto* var = Var("mat", ty.mat3x3()); - auto* lhs = vec3(1.f, 1.f, 1.f); + auto* lhs = vec3(1_f, 1_f, 1_f); auto* expr = create(ast::BinaryOp::kMultiply, lhs, Expr("mat")); @@ -640,7 +902,38 @@ TEST_F(BuilderTest, Binary_Multiply_VectorMatrix) { )"); } -TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix) { +TEST_F(BuilderTest, Binary_Multiply_VectorMatrix_F16) { + Enable(ast::Extension::kF16); + + auto* var = Var("mat", ty.mat3x3()); + auto* lhs = vec3(1_h, 1_h, 1_h); + + auto* expr = create(ast::BinaryOp::kMultiply, lhs, Expr("mat")); + + WrapInFunction(var, expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 9u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), + R"(%5 = OpTypeFloat 16 +%4 = OpTypeVector %5 3 +%3 = OpTypeMatrix %4 3 +%2 = OpTypePointer Function %3 +%1 = OpVariable %2 Function +%6 = OpConstant %5 0x1p+0 +%7 = OpConstantComposite %4 %6 %6 %6 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%8 = OpLoad %3 %1 +%9 = OpVectorTimesMatrix %4 %7 %8 +)"); +} + +TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix_F32) { auto* var = Var("mat", ty.mat3x3()); auto* expr = create(ast::BinaryOp::kMultiply, Expr("mat"), Expr("mat")); @@ -667,6 +960,35 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix) { )"); } +TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix_F16) { + Enable(ast::Extension::kF16); + + auto* var = Var("mat", ty.mat3x3()); + + auto* expr = create(ast::BinaryOp::kMultiply, Expr("mat"), Expr("mat")); + + WrapInFunction(var, expr); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + + EXPECT_EQ(b.GenerateBinaryExpression(expr), 8u) << b.error(); + EXPECT_EQ(DumpInstructions(b.types()), + R"(%5 = OpTypeFloat 16 +%4 = OpTypeVector %5 3 +%3 = OpTypeMatrix %4 3 +%2 = OpTypePointer Function %3 +%1 = OpVariable %2 Function +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%6 = OpLoad %3 %1 +%7 = OpLoad %3 %1 +%8 = OpMatrixTimesMatrix %3 %6 %7 +)"); +} + TEST_F(BuilderTest, Binary_LogicalAnd) { auto* lhs = create(ast::BinaryOp::kEqual, Expr(1_i), Expr(2_i)); @@ -704,8 +1026,8 @@ OpBranch %7 } TEST_F(BuilderTest, Binary_LogicalAnd_WithLoads) { - auto* a_var = Global("a", ty.bool_(), ast::StorageClass::kPrivate, Expr(true)); - auto* b_var = Global("b", ty.bool_(), ast::StorageClass::kPrivate, Expr(false)); + auto* a_var = GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate, Expr(true)); + auto* b_var = GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate, Expr(false)); auto* expr = create(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")); @@ -724,7 +1046,7 @@ TEST_F(BuilderTest, Binary_LogicalAnd_WithLoads) { %3 = OpConstantTrue %2 %5 = OpTypePointer Private %2 %4 = OpVariable %5 Private %3 -%6 = OpConstantFalse %2 +%6 = OpConstantNull %2 %7 = OpVariable %5 Private %6 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), @@ -761,7 +1083,7 @@ TEST_F(BuilderTest, Binary_logicalOr_Nested_LogicalAnd) { EXPECT_EQ(b.GenerateBinaryExpression(expr), 10u) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeBool %3 = OpConstantTrue %2 -%8 = OpConstantFalse %2 +%8 = OpConstantNull %2 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%1 = OpLabel @@ -801,7 +1123,7 @@ TEST_F(BuilderTest, Binary_logicalAnd_Nested_LogicalOr) { EXPECT_EQ(b.GenerateBinaryExpression(expr), 10u) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeBool %3 = OpConstantTrue %2 -%8 = OpConstantFalse %2 +%8 = OpConstantNull %2 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%1 = OpLabel @@ -857,8 +1179,8 @@ OpBranch %7 } TEST_F(BuilderTest, Binary_LogicalOr_WithLoads) { - auto* a_var = Global("a", ty.bool_(), ast::StorageClass::kPrivate, Expr(true)); - auto* b_var = Global("b", ty.bool_(), ast::StorageClass::kPrivate, Expr(false)); + auto* a_var = GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate, Expr(true)); + auto* b_var = GlobalVar("b", ty.bool_(), ast::StorageClass::kPrivate, Expr(false)); auto* expr = create(ast::BinaryOp::kLogicalOr, Expr("a"), Expr("b")); @@ -877,7 +1199,7 @@ TEST_F(BuilderTest, Binary_LogicalOr_WithLoads) { %3 = OpConstantTrue %2 %5 = OpTypePointer Private %2 %4 = OpVariable %5 Private %3 -%6 = OpConstantFalse %2 +%6 = OpConstantNull %2 %7 = OpVariable %5 Private %6 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), @@ -895,33 +1217,57 @@ OpBranch %9 namespace BinaryArithVectorScalar { -enum class Type { f32, i32, u32 }; +enum class Type { f32, f16, i32, u32 }; static const ast::Expression* MakeVectorExpr(ProgramBuilder* builder, Type type) { + auto name = builder->Symbols().New(); switch (type) { case Type::f32: - return builder->vec3(1.f, 1.f, 1.f); + builder->GlobalVar(name, builder->ty.vec3(), builder->vec3(1_f, 1_f, 1_f), + ast::StorageClass::kPrivate); + break; + case Type::f16: + builder->GlobalVar(name, builder->ty.vec3(), builder->vec3(1_h, 1_h, 1_h), + ast::StorageClass::kPrivate); + break; case Type::i32: - return builder->vec3(1_i, 1_i, 1_i); + builder->GlobalVar(name, builder->ty.vec3(), builder->vec3(1_i, 1_i, 1_i), + ast::StorageClass::kPrivate); + break; case Type::u32: - return builder->vec3(1_u, 1_u, 1_u); + builder->GlobalVar(name, builder->ty.vec3(), builder->vec3(1_u, 1_u, 1_u), + ast::StorageClass::kPrivate); + break; } - return nullptr; + return builder->Expr(name); } static const ast::Expression* MakeScalarExpr(ProgramBuilder* builder, Type type) { + auto name = builder->Symbols().New(); switch (type) { case Type::f32: - return builder->Expr(1.f); + builder->GlobalVar(name, builder->ty.f32(), builder->Expr(1_f), + ast::StorageClass::kPrivate); + break; + case Type::f16: + builder->GlobalVar(name, builder->ty.f16(), builder->Expr(1_h), + ast::StorageClass::kPrivate); + break; case Type::i32: - return builder->Expr(1_i); + builder->GlobalVar(name, builder->ty.i32(), builder->Expr(1_i), + ast::StorageClass::kPrivate); + break; case Type::u32: - return builder->Expr(1_u); + builder->GlobalVar(name, builder->ty.u32(), builder->Expr(1_u), + ast::StorageClass::kPrivate); + break; } - return nullptr; + return builder->Expr(name); } static std::string OpTypeDecl(Type type) { switch (type) { case Type::f32: return "OpTypeFloat 32"; + case Type::f16: + return "OpTypeFloat 16"; case Type::i32: return "OpTypeInt 32 1"; case Type::u32: @@ -929,6 +1275,32 @@ static std::string OpTypeDecl(Type type) { } return {}; } +static std::string ConstantValue(Type type) { + switch (type) { + case Type::f32: + case Type::i32: + case Type::u32: + return "1"; + case Type::f16: + return "0x1p+0"; + } + return {}; +} +static std::string CapabilityDecl(Type type) { + switch (type) { + case Type::f32: + case Type::i32: + case Type::u32: + return "OpCapability Shader"; + case Type::f16: + return R"(OpCapability Shader +OpCapability Float16 +OpCapability UniformAndStorageBuffer16BitAccess +OpCapability StorageBuffer16BitAccess +OpCapability StorageInputOutput16)"; + } + return {}; +} struct Param { Type type; @@ -940,9 +1312,15 @@ using BinaryArithVectorScalarTest = TestParamHelper; TEST_P(BinaryArithVectorScalarTest, VectorScalar) { auto& param = GetParam(); + if (param.type == Type::f16) { + Enable(ast::Extension::kF16); + } + const ast::Expression* lhs = MakeVectorExpr(this, param.type); const ast::Expression* rhs = MakeScalarExpr(this, param.type); std::string op_type_decl = OpTypeDecl(param.type); + std::string constant_value = ConstantValue(param.type); + std::string capability_decl = CapabilityDecl(param.type); auto* expr = create(param.op, lhs, rhs); @@ -950,25 +1328,33 @@ TEST_P(BinaryArithVectorScalarTest, VectorScalar) { spirv::Builder& b = Build(); ASSERT_TRUE(b.Build()) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader + EXPECT_EQ(DumpBuilder(b), capability_decl + R"( OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = )" + op_type_decl + R"( -%5 = OpTypeVector %6 3 -%7 = OpConstant %6 1 -%8 = OpConstantComposite %5 %7 %7 %7 -%11 = OpTypePointer Function %5 -%12 = OpConstantNull %5 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%10 = OpVariable %11 Function %12 -%13 = OpCompositeConstruct %5 %7 %7 %7 -%9 = )" + param.name + R"( %5 %8 %13 +OpEntryPoint GLCompute %11 "test_function" +OpExecutionMode %11 LocalSize 1 1 1 +OpName %5 "tint_symbol" +OpName %7 "tint_symbol_1" +OpName %11 "test_function" +%2 = )" + op_type_decl + R"( +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 )" + constant_value + + R"( +%4 = OpConstantComposite %1 %3 %3 %3 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%8 = OpTypePointer Private %2 +%7 = OpVariable %8 Private %3 +%10 = OpTypeVoid +%9 = OpTypeFunction %10 +%17 = OpTypePointer Function %1 +%18 = OpConstantNull %1 +%11 = OpFunction %10 None %9 +%12 = OpLabel +%16 = OpVariable %17 Function %18 +%13 = OpLoad %1 %5 +%14 = OpLoad %2 %7 +%19 = OpCompositeConstruct %1 %14 %14 %14 +%15 = )" + param.name + R"( %1 %13 %19 OpReturn OpFunctionEnd )"); @@ -978,9 +1364,15 @@ OpFunctionEnd TEST_P(BinaryArithVectorScalarTest, ScalarVector) { auto& param = GetParam(); + if (param.type == Type::f16) { + Enable(ast::Extension::kF16); + } + const ast::Expression* lhs = MakeScalarExpr(this, param.type); const ast::Expression* rhs = MakeVectorExpr(this, param.type); std::string op_type_decl = OpTypeDecl(param.type); + std::string constant_value = ConstantValue(param.type); + std::string capability_decl = CapabilityDecl(param.type); auto* expr = create(param.op, lhs, rhs); @@ -988,25 +1380,33 @@ TEST_P(BinaryArithVectorScalarTest, ScalarVector) { spirv::Builder& b = Build(); ASSERT_TRUE(b.Build()) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader + EXPECT_EQ(DumpBuilder(b), capability_decl + R"( OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%5 = )" + op_type_decl + R"( -%6 = OpConstant %5 1 -%7 = OpTypeVector %5 3 -%8 = OpConstantComposite %7 %6 %6 %6 -%11 = OpTypePointer Function %7 -%12 = OpConstantNull %7 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%10 = OpVariable %11 Function %12 -%13 = OpCompositeConstruct %7 %6 %6 %6 -%9 = )" + param.name + R"( %7 %13 %8 +OpEntryPoint GLCompute %11 "test_function" +OpExecutionMode %11 LocalSize 1 1 1 +OpName %3 "tint_symbol" +OpName %7 "tint_symbol_1" +OpName %11 "test_function" +%1 = )" + op_type_decl + R"( +%2 = OpConstant %1 )" + constant_value + + R"( +%4 = OpTypePointer Private %1 +%3 = OpVariable %4 Private %2 +%5 = OpTypeVector %1 3 +%6 = OpConstantComposite %5 %2 %2 %2 +%8 = OpTypePointer Private %5 +%7 = OpVariable %8 Private %6 +%10 = OpTypeVoid +%9 = OpTypeFunction %10 +%17 = OpTypePointer Function %5 +%18 = OpConstantNull %5 +%11 = OpFunction %10 None %9 +%12 = OpLabel +%16 = OpVariable %17 Function %18 +%13 = OpLoad %1 %3 +%14 = OpLoad %5 %7 +%19 = OpCompositeConstruct %5 %13 %13 %13 +%15 = )" + param.name + R"( %5 %19 %14 OpReturn OpFunctionEnd )"); @@ -1024,6 +1424,10 @@ INSTANTIATE_TEST_SUITE_P(BuilderTest, // Param{Type::i32, ast::BinaryOp::kMultiply, "OpIMul"}, Param{Type::f32, ast::BinaryOp::kSubtract, "OpFSub"}, + Param{Type::f16, ast::BinaryOp::kAdd, "OpFAdd"}, + Param{Type::f16, ast::BinaryOp::kDivide, "OpFDiv"}, + Param{Type::f16, ast::BinaryOp::kSubtract, "OpFSub"}, + Param{Type::i32, ast::BinaryOp::kAdd, "OpIAdd"}, Param{Type::i32, ast::BinaryOp::kDivide, "OpSDiv"}, Param{Type::i32, ast::BinaryOp::kModulo, "OpSMod"}, @@ -1040,9 +1444,15 @@ using BinaryArithVectorScalarMultiplyTest = TestParamHelper; TEST_P(BinaryArithVectorScalarMultiplyTest, VectorScalar) { auto& param = GetParam(); + if (param.type == Type::f16) { + Enable(ast::Extension::kF16); + } + const ast::Expression* lhs = MakeVectorExpr(this, param.type); const ast::Expression* rhs = MakeScalarExpr(this, param.type); std::string op_type_decl = OpTypeDecl(param.type); + std::string constant_value = ConstantValue(param.type); + std::string capability_decl = CapabilityDecl(param.type); auto* expr = create(param.op, lhs, rhs); @@ -1050,21 +1460,29 @@ TEST_P(BinaryArithVectorScalarMultiplyTest, VectorScalar) { spirv::Builder& b = Build(); ASSERT_TRUE(b.Build()) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader + EXPECT_EQ(DumpBuilder(b), capability_decl + R"( OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = )" + op_type_decl + R"( -%5 = OpTypeVector %6 3 -%7 = OpConstant %6 1 -%8 = OpConstantComposite %5 %7 %7 %7 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%9 = OpVectorTimesScalar %5 %8 %7 +OpEntryPoint GLCompute %11 "test_function" +OpExecutionMode %11 LocalSize 1 1 1 +OpName %5 "tint_symbol" +OpName %7 "tint_symbol_1" +OpName %11 "test_function" +%2 = )" + op_type_decl + R"( +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 )" + constant_value + + R"( +%4 = OpConstantComposite %1 %3 %3 %3 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%8 = OpTypePointer Private %2 +%7 = OpVariable %8 Private %3 +%10 = OpTypeVoid +%9 = OpTypeFunction %10 +%11 = OpFunction %10 None %9 +%12 = OpLabel +%13 = OpLoad %1 %5 +%14 = OpLoad %2 %7 +%15 = OpVectorTimesScalar %1 %13 %14 OpReturn OpFunctionEnd )"); @@ -1074,9 +1492,15 @@ OpFunctionEnd TEST_P(BinaryArithVectorScalarMultiplyTest, ScalarVector) { auto& param = GetParam(); + if (param.type == Type::f16) { + Enable(ast::Extension::kF16); + } + const ast::Expression* lhs = MakeScalarExpr(this, param.type); const ast::Expression* rhs = MakeVectorExpr(this, param.type); std::string op_type_decl = OpTypeDecl(param.type); + std::string constant_value = ConstantValue(param.type); + std::string capability_decl = CapabilityDecl(param.type); auto* expr = create(param.op, lhs, rhs); @@ -1084,21 +1508,29 @@ TEST_P(BinaryArithVectorScalarMultiplyTest, ScalarVector) { spirv::Builder& b = Build(); ASSERT_TRUE(b.Build()) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader + EXPECT_EQ(DumpBuilder(b), capability_decl + R"( OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%5 = )" + op_type_decl + R"( -%6 = OpConstant %5 1 -%7 = OpTypeVector %5 3 -%8 = OpConstantComposite %7 %6 %6 %6 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%9 = OpVectorTimesScalar %7 %8 %6 +OpEntryPoint GLCompute %11 "test_function" +OpExecutionMode %11 LocalSize 1 1 1 +OpName %3 "tint_symbol" +OpName %7 "tint_symbol_1" +OpName %11 "test_function" +%1 = )" + op_type_decl + R"( +%2 = OpConstant %1 )" + constant_value + + R"( +%4 = OpTypePointer Private %1 +%3 = OpVariable %4 Private %2 +%5 = OpTypeVector %1 3 +%6 = OpConstantComposite %5 %2 %2 %2 +%8 = OpTypePointer Private %5 +%7 = OpVariable %8 Private %6 +%10 = OpTypeVoid +%9 = OpTypeFunction %10 +%11 = OpFunction %10 None %9 +%12 = OpLabel +%13 = OpLoad %1 %3 +%14 = OpLoad %5 %7 +%15 = OpVectorTimesScalar %5 %14 %13 OpReturn OpFunctionEnd )"); @@ -1107,13 +1539,66 @@ OpFunctionEnd } INSTANTIATE_TEST_SUITE_P(BuilderTest, BinaryArithVectorScalarMultiplyTest, - testing::Values(Param{Type::f32, ast::BinaryOp::kMultiply, "OpFMul"})); + testing::Values(Param{Type::f32, ast::BinaryOp::kMultiply, "OpFMul"}, + Param{Type::f16, ast::BinaryOp::kMultiply, "OpFMul"})); } // namespace BinaryArithVectorScalar namespace BinaryArithMatrixMatrix { +enum class Type { f32, f16 }; +static const ast::Expression* MakeMat3x4Expr(ProgramBuilder* builder, Type type) { + auto name = builder->Symbols().New(); + switch (type) { + case Type::f32: + builder->GlobalVar(name, builder->ty.mat3x4(), builder->mat3x4(), + ast::StorageClass::kPrivate); + break; + case Type::f16: + builder->GlobalVar(name, builder->ty.mat3x4(), builder->mat3x4(), + ast::StorageClass::kPrivate); + break; + } + return builder->Expr(name); +} +static const ast::Expression* MakeMat4x3Expr(ProgramBuilder* builder, Type type) { + auto name = builder->Symbols().New(); + switch (type) { + case Type::f32: + builder->GlobalVar(name, builder->ty.mat4x3(), builder->mat4x3(), + ast::StorageClass::kPrivate); + break; + case Type::f16: + builder->GlobalVar(name, builder->ty.mat4x3(), builder->mat4x3(), + ast::StorageClass::kPrivate); + } + return builder->Expr(name); +} +static std::string OpTypeDecl(Type type) { + switch (type) { + case Type::f32: + return "OpTypeFloat 32"; + case Type::f16: + return "OpTypeFloat 16"; + } + return {}; +} +static std::string CapabilityDecl(Type type) { + switch (type) { + case Type::f32: + return "OpCapability Shader"; + case Type::f16: + return R"(OpCapability Shader +OpCapability Float16 +OpCapability UniformAndStorageBuffer16BitAccess +OpCapability StorageBuffer16BitAccess +OpCapability StorageInputOutput16)"; + } + return {}; +} + struct Param { + Type type; ast::BinaryOp op; std::string name; }; @@ -1122,8 +1607,14 @@ using BinaryArithMatrixMatrix = TestParamHelper; TEST_P(BinaryArithMatrixMatrix, AddOrSubtract) { auto& param = GetParam(); - const ast::Expression* lhs = mat3x4(); - const ast::Expression* rhs = mat3x4(); + if (param.type == Type::f16) { + Enable(ast::Extension::kF16); + } + + const ast::Expression* lhs = MakeMat3x4Expr(this, param.type); + const ast::Expression* rhs = MakeMat3x4Expr(this, param.type); + std::string op_type_decl = OpTypeDecl(param.type); + std::string capability_decl = CapabilityDecl(param.type); auto* expr = create(param.op, lhs, rhs); @@ -1131,30 +1622,36 @@ TEST_P(BinaryArithMatrixMatrix, AddOrSubtract) { spirv::Builder& b = Build(); ASSERT_TRUE(b.Build()) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader + EXPECT_EQ(DumpBuilder(b), capability_decl + R"( OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 4 -%5 = OpTypeMatrix %6 3 -%8 = OpConstantNull %5 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%10 = OpCompositeExtract %6 %8 0 -%11 = OpCompositeExtract %6 %8 0 -%12 = )" + param.name + R"( %6 %10 %11 -%13 = OpCompositeExtract %6 %8 1 -%14 = OpCompositeExtract %6 %8 1 -%15 = )" + param.name + R"( %6 %13 %14 -%16 = OpCompositeExtract %6 %8 2 -%17 = OpCompositeExtract %6 %8 2 -%18 = )" + param.name + R"( %6 %16 %17 -%19 = OpCompositeConstruct %5 %12 %15 %18 +OpEntryPoint GLCompute %10 "test_function" +OpExecutionMode %10 LocalSize 1 1 1 +OpName %5 "tint_symbol" +OpName %7 "tint_symbol_1" +OpName %10 "test_function" +%3 = )" + op_type_decl + R"( +%2 = OpTypeVector %3 4 +%1 = OpTypeMatrix %2 3 +%4 = OpConstantNull %1 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%7 = OpVariable %6 Private %4 +%9 = OpTypeVoid +%8 = OpTypeFunction %9 +%10 = OpFunction %9 None %8 +%11 = OpLabel +%12 = OpLoad %1 %5 +%13 = OpLoad %1 %7 +%15 = OpCompositeExtract %2 %12 0 +%16 = OpCompositeExtract %2 %13 0 +%17 = )" + param.name + R"( %2 %15 %16 +%18 = OpCompositeExtract %2 %12 1 +%19 = OpCompositeExtract %2 %13 1 +%20 = )" + param.name + R"( %2 %18 %19 +%21 = OpCompositeExtract %2 %12 2 +%22 = OpCompositeExtract %2 %13 2 +%23 = )" + param.name + R"( %2 %21 %22 +%24 = OpCompositeConstruct %1 %17 %20 %23 OpReturn OpFunctionEnd )"); @@ -1164,15 +1661,23 @@ OpFunctionEnd INSTANTIATE_TEST_SUITE_P( // BuilderTest, BinaryArithMatrixMatrix, - testing::Values(Param{ast::BinaryOp::kAdd, "OpFAdd"}, - Param{ast::BinaryOp::kSubtract, "OpFSub"})); + testing::Values(Param{Type::f32, ast::BinaryOp::kAdd, "OpFAdd"}, + Param{Type::f32, ast::BinaryOp::kSubtract, "OpFSub"}, + Param{Type::f16, ast::BinaryOp::kAdd, "OpFAdd"}, + Param{Type::f16, ast::BinaryOp::kSubtract, "OpFSub"})); using BinaryArithMatrixMatrixMultiply = TestParamHelper; TEST_P(BinaryArithMatrixMatrixMultiply, Multiply) { auto& param = GetParam(); - const ast::Expression* lhs = mat3x4(); - const ast::Expression* rhs = mat4x3(); + if (param.type == Type::f16) { + Enable(ast::Extension::kF16); + } + + const ast::Expression* lhs = MakeMat3x4Expr(this, param.type); + const ast::Expression* rhs = MakeMat4x3Expr(this, param.type); + std::string op_type_decl = OpTypeDecl(param.type); + std::string capability_decl = CapabilityDecl(param.type); auto* expr = create(param.op, lhs, rhs); @@ -1180,25 +1685,32 @@ TEST_P(BinaryArithMatrixMatrixMultiply, Multiply) { spirv::Builder& b = Build(); ASSERT_TRUE(b.Build()) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader + EXPECT_EQ(DumpBuilder(b), capability_decl + R"( OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 4 -%5 = OpTypeMatrix %6 3 -%8 = OpConstantNull %5 -%10 = OpTypeVector %7 3 -%9 = OpTypeMatrix %10 4 -%11 = OpConstantNull %9 -%13 = OpTypeMatrix %6 4 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%12 = OpMatrixTimesMatrix %13 %8 %11 +OpEntryPoint GLCompute %14 "test_function" +OpExecutionMode %14 LocalSize 1 1 1 +OpName %5 "tint_symbol" +OpName %10 "tint_symbol_1" +OpName %14 "test_function" +%3 = )" + op_type_decl + R"( +%2 = OpTypeVector %3 4 +%1 = OpTypeMatrix %2 3 +%4 = OpConstantNull %1 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%8 = OpTypeVector %3 3 +%7 = OpTypeMatrix %8 4 +%9 = OpConstantNull %7 +%11 = OpTypePointer Private %7 +%10 = OpVariable %11 Private %9 +%13 = OpTypeVoid +%12 = OpTypeFunction %13 +%19 = OpTypeMatrix %2 4 +%14 = OpFunction %13 None %12 +%15 = OpLabel +%16 = OpLoad %1 %5 +%17 = OpLoad %7 %10 +%18 = OpMatrixTimesMatrix %19 %16 %17 OpReturn OpFunctionEnd )"); @@ -1208,7 +1720,8 @@ OpFunctionEnd INSTANTIATE_TEST_SUITE_P( // BuilderTest, BinaryArithMatrixMatrixMultiply, - testing::Values(Param{ast::BinaryOp::kMultiply, "OpFMul"})); + testing::Values(Param{Type::f32, ast::BinaryOp::kMultiply, ""}, + Param{Type::f16, ast::BinaryOp::kMultiply, ""})); } // namespace BinaryArithMatrixMatrix diff --git a/src/tint/writer/spirv/builder_bitcast_expression_test.cc b/src/tint/writer/spirv/builder_bitcast_expression_test.cc index 073d000adc..9dff5f675e 100644 --- a/src/tint/writer/spirv/builder_bitcast_expression_test.cc +++ b/src/tint/writer/spirv/builder_bitcast_expression_test.cc @@ -15,13 +15,15 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; TEST_F(BuilderTest, Bitcast) { - auto* bitcast = create(ty.u32(), Expr(2.4f)); + auto* bitcast = create(ty.u32(), Expr(2.4_f)); WrapInFunction(bitcast); @@ -40,7 +42,7 @@ TEST_F(BuilderTest, Bitcast) { } TEST_F(BuilderTest, Bitcast_DuplicateType) { - auto* bitcast = create(ty.f32(), Expr(2.4f)); + auto* bitcast = create(ty.f32(), Expr(2.4_f)); WrapInFunction(bitcast); diff --git a/src/tint/writer/spirv/builder_block_test.cc b/src/tint/writer/spirv/builder_block_test.cc index ea70b6c221..76f7556ad6 100644 --- a/src/tint/writer/spirv/builder_block_test.cc +++ b/src/tint/writer/spirv/builder_block_test.cc @@ -15,6 +15,8 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::spirv { namespace { @@ -23,9 +25,9 @@ using BuilderTest = TestHelper; TEST_F(BuilderTest, Block) { // Note, this test uses shadow variables which aren't allowed in WGSL but // serves to prove the block code is pushing new scopes as needed. - auto* inner = Block(Decl(Var("var", ty.f32(), ast::StorageClass::kNone)), Assign("var", 2.f)); - auto* outer = Block(Decl(Var("var", ty.f32(), ast::StorageClass::kNone)), Assign("var", 1.f), - inner, Assign("var", 3.f)); + auto* inner = Block(Decl(Var("var", ty.f32())), Assign("var", 2_f)); + auto* outer = Block(Decl(Var("var", ty.f32())), Assign("var", 1_f), + inner, Assign("var", 3_f)); WrapInFunction(outer); diff --git a/src/tint/writer/spirv/builder_builtin_test.cc b/src/tint/writer/spirv/builder_builtin_test.cc index 901abad89d..f4b6096a69 100644 --- a/src/tint/writer/spirv/builder_builtin_test.cc +++ b/src/tint/writer/spirv/builder_builtin_test.cc @@ -38,436 +38,27 @@ inline std::ostream& operator<<(std::ostream& out, BuiltinData data) { return out; } -using BuiltinBoolTest = BuiltinBuilderTestWithParam; -TEST_P(BuiltinBoolTest, Call_Bool_Scalar) { - auto param = GetParam(); - auto* var = Global("v", ty.bool_(), ast::StorageClass::kPrivate); - auto* expr = Call(param.name, "v"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeBool -%2 = OpTypePointer Private %3 -%4 = OpConstantNull %3 -%1 = OpVariable %2 Private %4 -%6 = OpTypeVoid -%5 = OpTypeFunction %6 -)"); - - // both any and all are 'passthrough' for scalar booleans - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), "%10 = OpLoad %3 %1\nOpReturn\n"); -} - -TEST_P(BuiltinBoolTest, Call_Bool_Vector) { - auto param = GetParam(); - auto* var = Global("v", ty.vec3(), ast::StorageClass::kPrivate); - auto* expr = Call(param.name, "v"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeBool -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Private %3 -%5 = OpConstantNull %3 -%1 = OpVariable %2 Private %5 -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -)"); - - auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1 -%10 = ${op} %4 %11 -OpReturn -)", - "${op}", param.op); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - BuiltinBoolTest, - testing::Values(BuiltinData{"any", "OpAny"}, BuiltinData{"all", "OpAll"})); - -using BuiltinIntTest = BuiltinBuilderTestWithParam; -TEST_P(BuiltinIntTest, Call_SInt_Scalar) { - auto param = GetParam(); - auto* var = Global("v", ty.i32(), ast::StorageClass::kPrivate); - auto* expr = Call(param.name, "v"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeInt 32 1 -%2 = OpTypePointer Private %3 -%4 = OpConstantNull %3 -%1 = OpVariable %2 Private %4 -%6 = OpTypeVoid -%5 = OpTypeFunction %6 -)"); - - auto expected = utils::ReplaceAll(R"(%10 = OpLoad %3 %1 -%9 = ${op} %3 %10 -OpReturn -)", - "${op}", param.op); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); -} - -TEST_P(BuiltinIntTest, Call_SInt_Vector) { - auto param = GetParam(); - auto* var = Global("v", ty.vec3(), ast::StorageClass::kPrivate); - auto* expr = Call(param.name, "v"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Private %3 -%5 = OpConstantNull %3 -%1 = OpVariable %2 Private %5 -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -)"); - - auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1 -%10 = ${op} %3 %11 -OpReturn -)", - "${op}", param.op); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); -} - -TEST_P(BuiltinIntTest, Call_UInt_Scalar) { - auto param = GetParam(); - auto* var = Global("v", ty.u32(), ast::StorageClass::kPrivate); - auto* expr = Call(param.name, "v"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeInt 32 0 -%2 = OpTypePointer Private %3 -%4 = OpConstantNull %3 -%1 = OpVariable %2 Private %4 -%6 = OpTypeVoid -%5 = OpTypeFunction %6 -)"); - - auto expected = utils::ReplaceAll(R"(%10 = OpLoad %3 %1 -%9 = ${op} %3 %10 -OpReturn -)", - "${op}", param.op); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); -} - -TEST_P(BuiltinIntTest, Call_UInt_Vector) { - auto param = GetParam(); - auto* var = Global("v", ty.vec3(), ast::StorageClass::kPrivate); - auto* expr = Call(param.name, "v"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 0 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Private %3 -%5 = OpConstantNull %3 -%1 = OpVariable %2 Private %5 -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -)"); - - auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1 -%10 = ${op} %3 %11 -OpReturn -)", - "${op}", param.op); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - BuiltinIntTest, - testing::Values(BuiltinData{"countOneBits", "OpBitCount"}, - BuiltinData{"reverseBits", "OpBitReverse"})); - -TEST_F(BuiltinBuilderTest, Call_Dot_F32) { - auto* var = Global("v", ty.vec3(), ast::StorageClass::kPrivate); - auto* expr = Call("dot", "v", "v"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Private %3 -%5 = OpConstantNull %3 -%1 = OpVariable %2 Private %5 -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%11 = OpLoad %3 %1 -%12 = OpLoad %3 %1 -%10 = OpDot %4 %11 %12 -OpReturn -)"); -} - -TEST_F(BuiltinBuilderTest, Call_Dot_U32) { - auto* var = Global("v", ty.vec3(), ast::StorageClass::kPrivate); - auto* expr = Call("dot", "v", "v"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 0 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Private %3 -%5 = OpConstantNull %3 -%1 = OpVariable %2 Private %5 -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%11 = OpLoad %3 %1 -%12 = OpLoad %3 %1 -%13 = OpCompositeExtract %4 %11 0 -%14 = OpCompositeExtract %4 %12 0 -%15 = OpIMul %4 %13 %14 -%16 = OpCompositeExtract %4 %11 1 -%17 = OpCompositeExtract %4 %12 1 -%18 = OpIMul %4 %16 %17 -%19 = OpIAdd %4 %15 %18 -%20 = OpCompositeExtract %4 %11 2 -%21 = OpCompositeExtract %4 %12 2 -%22 = OpIMul %4 %20 %21 -%10 = OpIAdd %4 %19 %22 -OpReturn -)"); -} - -TEST_F(BuiltinBuilderTest, Call_Dot_I32) { - auto* var = Global("v", ty.vec3(), ast::StorageClass::kPrivate); - auto* expr = Call("dot", "v", "v"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Private %3 -%5 = OpConstantNull %3 -%1 = OpVariable %2 Private %5 -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%11 = OpLoad %3 %1 -%12 = OpLoad %3 %1 -%13 = OpCompositeExtract %4 %11 0 -%14 = OpCompositeExtract %4 %12 0 -%15 = OpIMul %4 %13 %14 -%16 = OpCompositeExtract %4 %11 1 -%17 = OpCompositeExtract %4 %12 1 -%18 = OpIMul %4 %16 %17 -%19 = OpIAdd %4 %15 %18 -%20 = OpCompositeExtract %4 %11 2 -%21 = OpCompositeExtract %4 %12 2 -%22 = OpIMul %4 %20 %21 -%10 = OpIAdd %4 %19 %22 -OpReturn -)"); -} - -using BuiltinDeriveTest = BuiltinBuilderTestWithParam; -TEST_P(BuiltinDeriveTest, Call_Derivative_Scalar) { - auto param = GetParam(); - auto* var = Global("v", ty.f32(), ast::StorageClass::kPrivate); - auto* expr = Call(param.name, "v"); - auto* func = - Func("func", {}, ty.void_(), {CallStmt(expr)}, {Stage(ast::PipelineStage::kFragment)}); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32 -%2 = OpTypePointer Private %3 -%4 = OpConstantNull %3 -%1 = OpVariable %2 Private %4 -%6 = OpTypeVoid -%5 = OpTypeFunction %6 -)"); - - auto expected = utils::ReplaceAll(R"(%10 = OpLoad %3 %1 -%9 = ${op} %3 %10 -OpReturn -)", - "${op}", param.op); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); -} - -TEST_P(BuiltinDeriveTest, Call_Derivative_Vector) { - auto param = GetParam(); - auto* var = Global("v", ty.vec3(), ast::StorageClass::kPrivate); - auto* expr = Call(param.name, "v"); - auto* func = - Func("func", {}, ty.void_(), {CallStmt(expr)}, {Stage(ast::PipelineStage::kFragment)}); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - if (param.name != "dpdx" && param.name != "dpdy" && param.name != "fwidth") { - EXPECT_EQ(DumpInstructions(b.capabilities()), - R"(OpCapability DerivativeControl -)"); - } - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Private %3 -%5 = OpConstantNull %3 -%1 = OpVariable %2 Private %5 -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -)"); - - auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1 -%10 = ${op} %3 %11 -OpReturn -)", - "${op}", param.op); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - BuiltinDeriveTest, - testing::Values(BuiltinData{"dpdx", "OpDPdx"}, - BuiltinData{"dpdxFine", "OpDPdxFine"}, - BuiltinData{"dpdxCoarse", "OpDPdxCoarse"}, - BuiltinData{"dpdy", "OpDPdy"}, - BuiltinData{"dpdyFine", "OpDPdyFine"}, - BuiltinData{"dpdyCoarse", "OpDPdyCoarse"}, - BuiltinData{"fwidth", "OpFwidth"}, - BuiltinData{"fwidthFine", "OpFwidthFine"}, - BuiltinData{"fwidthCoarse", "OpFwidthCoarse"})); - -TEST_F(BuiltinBuilderTest, Call_Select) { - auto* v3 = Global("v3", ty.vec3(), ast::StorageClass::kPrivate); - - auto* bool_v3 = Global("bool_v3", ty.vec3(), ast::StorageClass::kPrivate); - auto* expr = Call("select", "v3", "v3", "bool_v3"); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateGlobalVariable(v3)) << b.error(); - ASSERT_TRUE(b.GenerateGlobalVariable(bool_v3)) << b.error(); - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Private %3 -%5 = OpConstantNull %3 -%1 = OpVariable %2 Private %5 -%9 = OpTypeBool -%8 = OpTypeVector %9 3 -%7 = OpTypePointer Private %8 -%10 = OpConstantNull %8 -%6 = OpVariable %7 Private %10 -%12 = OpTypeVoid -%11 = OpTypeFunction %12 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%16 = OpLoad %8 %6 -%17 = OpLoad %3 %1 -%18 = OpLoad %3 %1 -%15 = OpSelect %3 %16 %17 %18 -OpReturn -)"); -} - // This tests that we do not push OpTypeSampledImage and float_0 type twice. TEST_F(BuiltinBuilderTest, Call_TextureSampleCompare_Twice) { auto* s = ty.sampler(ast::SamplerKind::kComparisonSampler); auto* t = ty.depth_texture(ast::TextureDimension::k2d); - auto* tex = Global("texture", t, - ast::AttributeList{ - create(0), - create(0), - }); + auto* tex = GlobalVar("texture", t, Binding(0), Group(0)); + auto* sampler = GlobalVar("sampler", s, Binding(1), Group(0)); - auto* sampler = Global("sampler", s, - ast::AttributeList{ - create(1), - create(0), - }); + auto* expr1 = Call("textureSampleCompare", "texture", "sampler", vec2(1_f, 2_f), 2_f); + auto* expr2 = Call("textureSampleCompare", "texture", "sampler", vec2(1_f, 2_f), 2_f); - auto* expr1 = Call("textureSampleCompare", "texture", "sampler", vec2(1.0f, 2.0f), 2.0f); - auto* expr2 = Call("textureSampleCompare", "texture", "sampler", vec2(1.0f, 2.0f), 2.0f); - - Func("f1", {}, ty.void_(), {CallStmt(expr1)}, {}); - Func("f2", {}, ty.void_(), {CallStmt(expr2)}, {}); + Func("f1", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(expr1), + }, + utils::Empty); + Func("f2", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(expr2), + }, + utils::Empty); spirv::Builder& b = Build(); @@ -505,11 +96,11 @@ TEST_F(BuiltinBuilderTest, Call_TextureSampleCompare_Twice) { )"); } -TEST_F(BuiltinBuilderTest, Call_GLSLMethod_WithLoad) { - auto* var = Global("ident", ty.f32(), ast::StorageClass::kPrivate); +TEST_F(BuiltinBuilderTest, Call_GLSLMethod_WithLoad_f32) { + auto* var = GlobalVar("ident", ty.f32(), ast::StorageClass::kPrivate); auto* expr = Call("round", "ident"); - auto* func = Func("a_func", {}, ty.void_(), - { + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Assign(Phony(), expr), }); @@ -518,7 +109,9 @@ TEST_F(BuiltinBuilderTest, Call_GLSLMethod_WithLoad) { ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - EXPECT_EQ(DumpBuilder(b), R"(%10 = OpExtInstImport "GLSL.std.450" + auto got = DumpBuilder(b); + auto expect = + R"(%10 = OpExtInstImport "GLSL.std.450" OpName %1 "ident" OpName %7 "a_func" %3 = OpTypeFloat 32 @@ -533,867 +126,17 @@ OpName %7 "a_func" %9 = OpExtInst %3 %10 RoundEven %11 OpReturn OpFunctionEnd -)"); -} - -using Builtin_Builtin_SingleParam_Float_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_SingleParam_Float_Test, Call_Scalar) { - auto param = GetParam(); - auto* expr = Call(param.name, 1.0f); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeFloat 32 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(Builtin_Builtin_SingleParam_Float_Test, Call_Vector) { - auto param = GetParam(); - auto* expr = Call(param.name, vec2(1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 -OpReturn -OpFunctionEnd -)"); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_SingleParam_Float_Test, - testing::Values(BuiltinData{"abs", "FAbs"}, - BuiltinData{"acos", "Acos"}, - BuiltinData{"asin", "Asin"}, - BuiltinData{"atan", "Atan"}, - BuiltinData{"ceil", "Ceil"}, - BuiltinData{"cos", "Cos"}, - BuiltinData{"cosh", "Cosh"}, - BuiltinData{"degrees", "Degrees"}, - BuiltinData{"exp", "Exp"}, - BuiltinData{"exp2", "Exp2"}, - BuiltinData{"floor", "Floor"}, - BuiltinData{"fract", "Fract"}, - BuiltinData{"inverseSqrt", "InverseSqrt"}, - BuiltinData{"log", "Log"}, - BuiltinData{"log2", "Log2"}, - BuiltinData{"radians", "Radians"}, - BuiltinData{"round", "RoundEven"}, - BuiltinData{"sign", "FSign"}, - BuiltinData{"sin", "Sin"}, - BuiltinData{"sinh", "Sinh"}, - BuiltinData{"sqrt", "Sqrt"}, - BuiltinData{"tan", "Tan"}, - BuiltinData{"tanh", "Tanh"}, - BuiltinData{"trunc", "Trunc"})); - -TEST_F(BuiltinBuilderTest, Call_Length_Scalar) { - auto* expr = Call("length", 1.0f); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeFloat 32 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 Length %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_Length_Vector) { - auto* expr = Call("length", vec2(1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeFloat 32 -%8 = OpTypeVector %6 2 -%9 = OpConstant %6 1 -%10 = OpConstantComposite %8 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 Length %10 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_Normalize) { - auto* expr = Call("normalize", vec2(1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 Normalize %10 -OpReturn -OpFunctionEnd -)"); -} - -using Builtin_Builtin_DualParam_Float_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_DualParam_Float_Test, Call_Scalar) { - auto param = GetParam(); - auto* expr = Call(param.name, 1.0f, 1.0f); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeFloat 32 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %8 %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(Builtin_Builtin_DualParam_Float_Test, Call_Vector) { - auto param = GetParam(); - auto* expr = Call(param.name, vec2(1.0f, 1.0f), vec2(1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 %10 -OpReturn -OpFunctionEnd -)"); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_DualParam_Float_Test, - testing::Values(BuiltinData{"atan2", "Atan2"}, - BuiltinData{"max", "NMax"}, - BuiltinData{"min", "NMin"}, - BuiltinData{"pow", "Pow"}, - BuiltinData{"step", "Step"})); - -TEST_F(BuiltinBuilderTest, Call_Reflect_Vector) { - auto* expr = Call("reflect", vec2(1.0f, 1.0f), vec2(1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 Reflect %10 %10 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_Distance_Scalar) { - auto* expr = Call("distance", 1.0f, 1.0f); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeFloat 32 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 Distance %8 %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_Distance_Vector) { - auto* expr = Call("distance", vec2(1.0f, 1.0f), vec2(1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeFloat 32 -%8 = OpTypeVector %6 2 -%9 = OpConstant %6 1 -%10 = OpConstantComposite %8 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 Distance %10 %10 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_Cross) { - auto* expr = Call("cross", vec3(1.0f, 1.0f, 1.0f), vec3(1.0f, 1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 3 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 Cross %10 %10 -OpReturn -OpFunctionEnd -)"); -} - -using Builtin_Builtin_ThreeParam_Float_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_ThreeParam_Float_Test, Call_Scalar) { - auto param = GetParam(); - auto* expr = Call(param.name, 1.0f, 1.0f, 1.0f); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeFloat 32 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %8 %8 %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(Builtin_Builtin_ThreeParam_Float_Test, Call_Vector) { - auto param = GetParam(); - auto* expr = - Call(param.name, vec2(1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 %10 %10 -OpReturn -OpFunctionEnd -)"); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_ThreeParam_Float_Test, - testing::Values(BuiltinData{"clamp", "NClamp"}, - BuiltinData{"fma", "Fma"}, - BuiltinData{"mix", "FMix"}, - - BuiltinData{"smoothstep", "SmoothStep"})); - -TEST_F(BuiltinBuilderTest, Call_FaceForward_Vector) { - auto* expr = - Call("faceForward", vec2(1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeFloat 32 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 FaceForward %10 %10 %10 -OpReturn -OpFunctionEnd -)"); -} - -using Builtin_Builtin_SingleParam_Sint_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_SingleParam_Sint_Test, Call_Scalar) { - auto param = GetParam(); - auto* expr = Call(param.name, 1_i); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeInt 32 1 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(Builtin_Builtin_SingleParam_Sint_Test, Call_Vector) { - auto param = GetParam(); - auto* expr = Call(param.name, vec2(1_i, 1_i)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeInt 32 1 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 -OpReturn -OpFunctionEnd -)"); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_SingleParam_Sint_Test, - testing::Values(BuiltinData{"abs", "SAbs"})); - -// Calling abs() on an unsigned integer scalar / vector is a no-op. -using Builtin_Builtin_Abs_Uint_Test = BuiltinBuilderTest; -TEST_F(Builtin_Builtin_Abs_Uint_Test, Call_Scalar) { - auto* expr = Call("abs", 1_u); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeInt 32 0 -%7 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(Builtin_Builtin_Abs_Uint_Test, Call_Vector) { - auto* expr = Call("abs", vec2(1_u, 1_u)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeInt 32 0 -%6 = OpTypeVector %7 2 -%8 = OpConstant %7 1 -%9 = OpConstantComposite %6 %8 %8 -%3 = OpFunction %2 None %1 -%4 = OpLabel -OpReturn -OpFunctionEnd -)"); -} - -using Builtin_Builtin_DualParam_SInt_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_DualParam_SInt_Test, Call_Scalar) { - auto param = GetParam(); - auto* expr = Call(param.name, 1_i, 1_i); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeInt 32 1 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %8 %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(Builtin_Builtin_DualParam_SInt_Test, Call_Vector) { - auto param = GetParam(); - auto* expr = Call(param.name, vec2(1_i, 1_i), vec2(1_i, 1_i)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeInt 32 1 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 %10 -OpReturn -OpFunctionEnd -)"); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_DualParam_SInt_Test, - testing::Values(BuiltinData{"max", "SMax"}, BuiltinData{"min", "SMin"})); - -using Builtin_Builtin_DualParam_UInt_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_DualParam_UInt_Test, Call_Scalar) { - auto param = GetParam(); - auto* expr = Call(param.name, 1_u, 1_u); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeInt 32 0 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %8 %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(Builtin_Builtin_DualParam_UInt_Test, Call_Vector) { - auto param = GetParam(); - auto* expr = Call(param.name, vec2(1_u, 1_u), vec2(1_u, 1_u)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeInt 32 0 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 %10 -OpReturn -OpFunctionEnd -)"); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_DualParam_UInt_Test, - testing::Values(BuiltinData{"max", "UMax"}, BuiltinData{"min", "UMin"})); - -using Builtin_Builtin_ThreeParam_Sint_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_ThreeParam_Sint_Test, Call_Scalar) { - auto param = GetParam(); - auto* expr = Call(param.name, 1_i, 1_i, 1_i); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeInt 32 1 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %8 %8 %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(Builtin_Builtin_ThreeParam_Sint_Test, Call_Vector) { - auto param = GetParam(); - auto* expr = Call(param.name, vec2(1_i, 1_i), vec2(1_i, 1_i), vec2(1_i, 1_i)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeInt 32 1 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 %10 %10 -OpReturn -OpFunctionEnd -)"); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_ThreeParam_Sint_Test, - testing::Values(BuiltinData{"clamp", "SClamp"})); - -using Builtin_Builtin_ThreeParam_Uint_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_ThreeParam_Uint_Test, Call_Scalar) { - auto param = GetParam(); - auto* expr = Call(param.name, 1_u, 1_u, 1_u); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%6 = OpTypeInt 32 0 -%8 = OpConstant %6 1 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %8 %8 %8 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(Builtin_Builtin_ThreeParam_Uint_Test, Call_Vector) { - auto param = GetParam(); - auto* expr = Call(param.name, vec2(1_u, 1_u), vec2(1_u, 1_u), vec2(1_u, 1_u)); - auto* func = Func("a_func", {}, ty.void_(), - { - Assign(Phony(), expr), - }); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" -OpName %3 "a_func" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeInt 32 0 -%6 = OpTypeVector %7 2 -%9 = OpConstant %7 1 -%10 = OpConstantComposite %6 %9 %9 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 %10 %10 -OpReturn -OpFunctionEnd -)"); -} -INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_ThreeParam_Uint_Test, - testing::Values(BuiltinData{"clamp", "UClamp"})); - -TEST_F(BuiltinBuilderTest, Call_Modf) { - auto* expr = Call("modf", vec2(1.0f, 2.0f)); - Func("a_func", {}, ty.void_(), {CallStmt(expr)}, {Stage(ast::PipelineStage::kFragment)}); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.Build()) << b.error(); - auto got = DumpBuilder(b); - auto* expect = R"(OpCapability Shader -%9 = OpExtInstImport "GLSL.std.450" -OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %3 "a_func" -OpExecutionMode %3 OriginUpperLeft -OpName %3 "a_func" -OpName %6 "__modf_result_vec2" -OpMemberName %6 0 "fract" -OpMemberName %6 1 "whole" -OpMemberDecorate %6 0 Offset 0 -OpMemberDecorate %6 1 Offset 8 -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%8 = OpTypeFloat 32 -%7 = OpTypeVector %8 2 -%6 = OpTypeStruct %7 %7 -%10 = OpConstant %8 1 -%11 = OpConstant %8 2 -%12 = OpConstantComposite %7 %10 %11 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %9 ModfStruct %12 -OpReturn -OpFunctionEnd )"; - EXPECT_EQ(expect, got); - - Validate(b); + EXPECT_EQ(got, expect); } -TEST_F(BuiltinBuilderTest, Call_Frexp) { - auto* expr = Call("frexp", vec2(1.0f, 2.0f)); - Func("a_func", {}, ty.void_(), {CallStmt(expr)}, {Stage(ast::PipelineStage::kFragment)}); +TEST_F(BuiltinBuilderTest, Call_GLSLMethod_WithLoad_f16) { + Enable(ast::Extension::kF16); - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.Build()) << b.error(); - auto got = DumpBuilder(b); - auto* expect = R"(OpCapability Shader -%11 = OpExtInstImport "GLSL.std.450" -OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %3 "a_func" -OpExecutionMode %3 OriginUpperLeft -OpName %3 "a_func" -OpName %6 "__frexp_result_vec2" -OpMemberName %6 0 "sig" -OpMemberName %6 1 "exp" -OpMemberDecorate %6 0 Offset 0 -OpMemberDecorate %6 1 Offset 8 -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%8 = OpTypeFloat 32 -%7 = OpTypeVector %8 2 -%10 = OpTypeInt 32 1 -%9 = OpTypeVector %10 2 -%6 = OpTypeStruct %7 %9 -%12 = OpConstant %8 1 -%13 = OpConstant %8 2 -%14 = OpConstantComposite %7 %12 %13 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpExtInst %6 %11 FrexpStruct %14 -OpReturn -OpFunctionEnd -)"; - EXPECT_EQ(expect, got); - - Validate(b); -} - -TEST_F(BuiltinBuilderTest, Call_Determinant) { - auto* var = Global("var", ty.mat3x3(), ast::StorageClass::kPrivate); - auto* expr = Call("determinant", "var"); - auto* func = Func("a_func", {}, ty.void_(), - { + auto* var = GlobalVar("ident", ty.f16(), ast::StorageClass::kPrivate); + auto* expr = Call("round", "ident"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Assign(Phony(), expr), }); @@ -1402,31 +145,37 @@ TEST_F(BuiltinBuilderTest, Call_Determinant) { ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - EXPECT_EQ(DumpBuilder(b), R"(%12 = OpExtInstImport "GLSL.std.450" -OpName %1 "var" -OpName %9 "a_func" -%5 = OpTypeFloat 32 -%4 = OpTypeVector %5 3 -%3 = OpTypeMatrix %4 3 + auto got = DumpBuilder(b); + auto expect = + R"(%10 = OpExtInstImport "GLSL.std.450" +OpName %1 "ident" +OpName %7 "a_func" +%3 = OpTypeFloat 16 %2 = OpTypePointer Private %3 -%6 = OpConstantNull %3 -%1 = OpVariable %2 Private %6 -%8 = OpTypeVoid -%7 = OpTypeFunction %8 -%9 = OpFunction %8 None %7 -%10 = OpLabel -%13 = OpLoad %3 %1 -%11 = OpExtInst %5 %12 Determinant %13 +%4 = OpConstantNull %3 +%1 = OpVariable %2 Private %4 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 +%7 = OpFunction %6 None %5 +%8 = OpLabel +%11 = OpLoad %3 %1 +%9 = OpExtInst %3 %10 RoundEven %11 OpReturn OpFunctionEnd -)"); +)"; + EXPECT_EQ(got, expect); } -TEST_F(BuiltinBuilderTest, Call_Transpose) { - auto* var = Global("var", ty.mat2x3(), ast::StorageClass::kPrivate); - auto* expr = Call("transpose", "var"); - auto* func = Func("a_func", {}, ty.void_(), - { +// Tests for Logical builtins +namespace logical_builtin_tests { + +using BuiltinBoolTest = BuiltinBuilderTestWithParam; +TEST_P(BuiltinBoolTest, Call_Bool_Scalar) { + auto param = GetParam(); + auto* var = GlobalVar("v", ty.bool_(), ast::StorageClass::kPrivate); + auto* expr = Call(param.name, "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Assign(Phony(), expr), }); @@ -1435,41 +184,107 @@ TEST_F(BuiltinBuilderTest, Call_Transpose) { ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - EXPECT_EQ(DumpBuilder(b), R"(OpName %1 "var" -OpName %9 "a_func" -%5 = OpTypeFloat 32 -%4 = OpTypeVector %5 3 -%3 = OpTypeMatrix %4 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeBool %2 = OpTypePointer Private %3 -%6 = OpConstantNull %3 -%1 = OpVariable %2 Private %6 -%8 = OpTypeVoid -%7 = OpTypeFunction %8 -%13 = OpTypeVector %5 2 -%12 = OpTypeMatrix %13 3 -%9 = OpFunction %8 None %7 -%10 = OpLabel -%14 = OpLoad %3 %1 -%11 = OpTranspose %12 %14 +%4 = OpConstantNull %3 +%1 = OpVariable %2 Private %4 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 +)"); + + // both any and all are 'passthrough' for scalar booleans + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), "%10 = OpLoad %3 %1\nOpReturn\n"); +} + +TEST_P(BuiltinBoolTest, Call_Bool_Vector) { + auto param = GetParam(); + auto* var = GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); + auto* expr = Call(param.name, "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeBool +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +)"); + + auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1 +%10 = ${op} %4 %11 +OpReturn +)", + "${op}", param.op); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); +} +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + BuiltinBoolTest, + testing::Values(BuiltinData{"any", "OpAny"}, BuiltinData{"all", "OpAll"})); + +TEST_F(BuiltinBuilderTest, Call_Select) { + auto* v3 = GlobalVar("v3", ty.vec3(), ast::StorageClass::kPrivate); + + auto* bool_v3 = GlobalVar("bool_v3", ty.vec3(), ast::StorageClass::kPrivate); + auto* expr = Call("select", "v3", "v3", "bool_v3"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(v3)) << b.error(); + ASSERT_TRUE(b.GenerateGlobalVariable(bool_v3)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%9 = OpTypeBool +%8 = OpTypeVector %9 3 +%7 = OpTypePointer Private %8 +%10 = OpConstantNull %8 +%6 = OpVariable %7 Private %10 +%12 = OpTypeVoid +%11 = OpTypeFunction %12 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%16 = OpLoad %8 %6 +%17 = OpLoad %3 %1 +%18 = OpLoad %3 %1 +%15 = OpSelect %3 %16 %17 %18 OpReturn -OpFunctionEnd )"); } +} // namespace logical_builtin_tests + +// Tests for Array builtins +namespace array_builtin_tests { + TEST_F(BuiltinBuilderTest, Call_ArrayLength) { - auto* s = Structure("my_struct", {Member("a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{ + Member("a", ty.array(4)), + }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); auto* expr = Call("arrayLength", AddressOf(MemberAccessor("b", "a"))); - Func("a_func", {}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(expr), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1501,22 +316,18 @@ OpReturn } TEST_F(BuiltinBuilderTest, Call_ArrayLength_OtherMembersInStruct) { - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member("z", ty.f32()), Member(4, "a", ty.array(4)), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); auto* expr = Call("arrayLength", AddressOf(MemberAccessor("b", "a"))); - Func("a_func", {}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(expr), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1548,24 +359,22 @@ OpReturn } TEST_F(BuiltinBuilderTest, Call_ArrayLength_ViaLets) { - auto* s = Structure("my_struct", {Member("a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{ + Member("a", ty.array(4)), + }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - auto* p = Let("p", nullptr, AddressOf("b")); - auto* p2 = Let("p2", nullptr, AddressOf(MemberAccessor(Deref(p), "a"))); + auto* p = Let("p", AddressOf("b")); + auto* p2 = Let("p2", AddressOf(MemberAccessor(Deref(p), "a"))); auto* expr = Call("arrayLength", p2); - Func("a_func", {}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(p), Decl(p2), CallStmt(expr), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1608,26 +417,24 @@ TEST_F(BuiltinBuilderTest, Call_ArrayLength_ViaLets_WithPtrNoise) { // let p3 = &((*p).a); // arrayLength(&*p3); // } - auto* s = Structure("my_struct", {Member("a", ty.array(4))}); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(1), - create(2), - }); + auto* s = Structure("my_struct", utils::Vector{ + Member("a", ty.array(4)), + }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(1), Group(2)); - auto* p = Let("p", nullptr, AddressOf(Deref(AddressOf("b")))); - auto* p2 = Let("p2", nullptr, AddressOf(Deref(p))); - auto* p3 = Let("p3", nullptr, AddressOf(MemberAccessor(Deref(p2), "a"))); + auto* p = Let("p", AddressOf(Deref(AddressOf("b")))); + auto* p2 = Let("p2", AddressOf(Deref(p))); + auto* p3 = Let("p3", AddressOf(MemberAccessor(Deref(p2), "a"))); auto* expr = Call("arrayLength", AddressOf(Deref(p3))); - Func("a_func", {}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(p), Decl(p2), Decl(p3), CallStmt(expr), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -1658,6 +465,2744 @@ OpReturn Validate(b); } +} // namespace array_builtin_tests + +// Tests for Numeric builtins with float parameter +namespace float_builtin_tests { + +using Builtin_Builder_SingleParam_Float_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Scalar_f32) { + auto param = GetParam(); + // Use a variable to prevent the function being evaluated as constant. + auto* scalar = Var("a", Expr(1_f)); + auto* expr = Call(param.name, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 32 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + // Use a variable to prevent the function being evaluated as constant. + auto* scalar = Var("a", Expr(1_h)); + auto* expr = Call(param.name, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 16 +%6 = OpConstant %5 0x1p+0 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Vector_f32) { + auto param = GetParam(); + + // Use a variable to prevent the function being evaluated as constant. + auto* vec = Var("a", vec2(1_f, 1_f)); + auto* expr = Call(param.name, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Vector_f16) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + + // Use a variable to prevent the function being evaluated as constant. + auto* vec = Var("a", vec2(1_h, 1_h)); + auto* expr = Call(param.name, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + Builtin_Builder_SingleParam_Float_Test, + testing::Values(BuiltinData{"abs", "FAbs"}, + BuiltinData{"acos", "Acos"}, + BuiltinData{"asin", "Asin"}, + BuiltinData{"atan", "Atan"}, + BuiltinData{"ceil", "Ceil"}, + BuiltinData{"cos", "Cos"}, + BuiltinData{"cosh", "Cosh"}, + BuiltinData{"degrees", "Degrees"}, + BuiltinData{"exp", "Exp"}, + BuiltinData{"exp2", "Exp2"}, + BuiltinData{"floor", "Floor"}, + BuiltinData{"fract", "Fract"}, + BuiltinData{"inverseSqrt", "InverseSqrt"}, + BuiltinData{"log", "Log"}, + BuiltinData{"log2", "Log2"}, + BuiltinData{"radians", "Radians"}, + BuiltinData{"round", "RoundEven"}, + BuiltinData{"sign", "FSign"}, + BuiltinData{"sin", "Sin"}, + BuiltinData{"sinh", "Sinh"}, + BuiltinData{"sqrt", "Sqrt"}, + BuiltinData{"tan", "Tan"}, + BuiltinData{"tanh", "Tanh"}, + BuiltinData{"trunc", "Trunc"})); + +TEST_F(BuiltinBuilderTest, Call_Length_Scalar_f32) { + auto* scalar = Var("a", Expr(1_f)); + auto* expr = Call("length", scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 32 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 Length %12 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Length_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* scalar = Var("a", Expr(1_h)); + auto* expr = Call("length", scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 16 +%6 = OpConstant %5 0x1p+0 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 Length %12 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Length_Vector_f32) { + auto* vec = Var("a", vec2(1_f, 1_f)); + auto* expr = Call("length", vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%12 = OpExtInst %6 %13 Length %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Length_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* vec = Var("a", vec2(1_h, 1_h)); + auto* expr = Call("length", vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%12 = OpExtInst %6 %13 Length %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Normalize_f32) { + auto* vec = Var("a", vec2(1_f, 1_f)); + auto* expr = Call("normalize", vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 Normalize %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Normalize_f16) { + Enable(ast::Extension::kF16); + + auto* vec = Var("a", vec2(1_h, 1_h)); + auto* expr = Call("normalize", vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "a" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 Normalize %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +using Builtin_Builder_DualParam_Float_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Scalar_f32) { + auto param = GetParam(); + auto* scalar = Var("scalar", Expr(1_f)); + auto* expr = Call(param.name, scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 32 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 %13 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + auto* scalar = Var("scalar", Expr(1_h)); + auto* expr = Call(param.name, scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 16 +%6 = OpConstant %5 0x1p+0 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 %13 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Vector_f32) { + auto param = GetParam(); + auto* vec = Var("vec", vec2(1_f, 1_f)); + auto* expr = Call(param.name, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Vector_f16) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + auto* vec = Var("vec", vec2(1_h, 1_h)); + auto* expr = Call(param.name, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + Builtin_Builder_DualParam_Float_Test, + testing::Values(BuiltinData{"atan2", "Atan2"}, + BuiltinData{"max", "NMax"}, + BuiltinData{"min", "NMin"}, + BuiltinData{"pow", "Pow"}, + BuiltinData{"step", "Step"})); + +TEST_F(BuiltinBuilderTest, Call_Reflect_Vector_f32) { + auto* vec = Var("vec", vec2(1_f, 1_f)); + auto* expr = Call("reflect", vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 Reflect %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Reflect_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* vec = Var("vec", vec2(1_h, 1_h)); + auto* expr = Call("reflect", vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 Reflect %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Distance_Scalar_f32) { + auto* scalar = Var("scalar", Expr(1_f)); + auto* expr = Call("distance", scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 32 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 Distance %12 %13 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Distance_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto* scalar = Var("scalar", Expr(1_h)); + auto* expr = Call("distance", scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 16 +%6 = OpConstant %5 0x1p+0 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 Distance %12 %13 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Distance_Vector_f32) { + auto* vec = Var("vec", vec2(1_f, 1_f)); + auto* expr = Call("distance", vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %6 %13 Distance %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Distance_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* vec = Var("vec", vec2(1_h, 1_h)); + auto* expr = Call("distance", vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %6 %13 Distance %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Cross_f32) { + auto* vec = Var("vec", vec3(1_f, 1_f, 1_f)); + auto* expr = Call("cross", vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 Cross %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Cross_f16) { + Enable(ast::Extension::kF16); + + auto* vec = Var("vec", vec3(1_h, 1_h, 1_h)); + auto* expr = Call("cross", vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 Cross %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +using Builtin_Builder_ThreeParam_Float_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Scalar_f32) { + auto param = GetParam(); + auto* scalar = Var("scalar", Expr(1_f)); + auto* expr = Call(param.name, scalar, scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 32 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%14 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 %13 %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Scalar_f16) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + auto* scalar = Var("scalar", Expr(1_h)); + auto* expr = Call(param.name, scalar, scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 16 +%6 = OpConstant %5 0x1p+0 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%14 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 %13 %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Vector_f32) { + auto param = GetParam(); + auto* vec = Var("vec", vec2(1_f, 1_f)); + auto* expr = Call(param.name, vec, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%16 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 %15 %16 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Vector_f16) { + Enable(ast::Extension::kF16); + + auto param = GetParam(); + auto* vec = Var("vec", vec2(1_h, 1_h)); + auto* expr = Call(param.name, vec, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%16 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 %15 %16 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + Builtin_Builder_ThreeParam_Float_Test, + testing::Values(BuiltinData{"clamp", "NClamp"}, + BuiltinData{"fma", "Fma"}, + BuiltinData{"mix", "FMix"}, + + BuiltinData{"smoothstep", "SmoothStep"})); + +TEST_F(BuiltinBuilderTest, Call_FaceForward_Vector_f32) { + auto* vec = Var("vec", vec2(1_f, 1_f)); + auto* expr = Call("faceForward", vec, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%16 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 FaceForward %14 %15 %16 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_FaceForward_Vector_f16) { + Enable(ast::Extension::kF16); + + auto* vec = Var("vec", vec2(1_h, 1_h)); + auto* expr = Call("faceForward", vec, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%16 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 FaceForward %14 %15 %16 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Modf_f32) { + auto* vec = Var("vec", vec2(1_f, 2_f)); + auto* expr = Call("modf", vec); + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + CallStmt(expr), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.Build()) << b.error(); + auto got = DumpBuilder(b); + auto* expect = R"(OpCapability Shader +%15 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %3 "a_func" +OpExecutionMode %3 OriginUpperLeft +OpName %3 "a_func" +OpName %10 "vec" +OpName %14 "__modf_result_vec2" +OpMemberName %14 0 "fract" +OpMemberName %14 1 "whole" +OpMemberDecorate %14 0 Offset 0 +OpMemberDecorate %14 1 Offset 8 +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstant %6 2 +%9 = OpConstantComposite %5 %7 %8 +%11 = OpTypePointer Function %5 +%12 = OpConstantNull %5 +%14 = OpTypeStruct %5 %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%10 = OpVariable %11 Function %12 +OpStore %10 %9 +%16 = OpLoad %5 %10 +%13 = OpExtInst %14 %15 ModfStruct %16 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(expect, got); + + Validate(b); +} + +TEST_F(BuiltinBuilderTest, Call_Modf_f16) { + Enable(ast::Extension::kF16); + + auto* vec = Var("vec", vec2(1_h, 2_h)); + auto* expr = Call("modf", vec); + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + CallStmt(expr), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.Build()) << b.error(); + auto got = DumpBuilder(b); + auto* expect = R"(OpCapability Shader +OpCapability Float16 +OpCapability UniformAndStorageBuffer16BitAccess +OpCapability StorageBuffer16BitAccess +OpCapability StorageInputOutput16 +%15 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %3 "a_func" +OpExecutionMode %3 OriginUpperLeft +OpName %3 "a_func" +OpName %10 "vec" +OpName %14 "__modf_result_vec2_f16" +OpMemberName %14 0 "fract" +OpMemberName %14 1 "whole" +OpMemberDecorate %14 0 Offset 0 +OpMemberDecorate %14 1 Offset 4 +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstant %6 0x1p+1 +%9 = OpConstantComposite %5 %7 %8 +%11 = OpTypePointer Function %5 +%12 = OpConstantNull %5 +%14 = OpTypeStruct %5 %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%10 = OpVariable %11 Function %12 +OpStore %10 %9 +%16 = OpLoad %5 %10 +%13 = OpExtInst %14 %15 ModfStruct %16 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(expect, got); + + Validate(b); +} + +TEST_F(BuiltinBuilderTest, Call_Frexp_f32) { + auto* vec = Var("vec", vec2(1_f, 2_f)); + auto* expr = Call("frexp", vec); + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + CallStmt(expr), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.Build()) << b.error(); + auto got = DumpBuilder(b); + auto* expect = R"(OpCapability Shader +%17 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %3 "a_func" +OpExecutionMode %3 OriginUpperLeft +OpName %3 "a_func" +OpName %10 "vec" +OpName %14 "__frexp_result_vec2" +OpMemberName %14 0 "sig" +OpMemberName %14 1 "exp" +OpMemberDecorate %14 0 Offset 0 +OpMemberDecorate %14 1 Offset 8 +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstant %6 2 +%9 = OpConstantComposite %5 %7 %8 +%11 = OpTypePointer Function %5 +%12 = OpConstantNull %5 +%16 = OpTypeInt 32 1 +%15 = OpTypeVector %16 2 +%14 = OpTypeStruct %5 %15 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%10 = OpVariable %11 Function %12 +OpStore %10 %9 +%18 = OpLoad %5 %10 +%13 = OpExtInst %14 %17 FrexpStruct %18 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(expect, got); + + Validate(b); +} + +TEST_F(BuiltinBuilderTest, Call_Frexp_f16) { + Enable(ast::Extension::kF16); + + auto* vec = Var("vec", vec2(1_h, 2_h)); + auto* expr = Call("frexp", vec); + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + CallStmt(expr), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.Build()) << b.error(); + auto got = DumpBuilder(b); + auto* expect = R"(OpCapability Shader +OpCapability Float16 +OpCapability UniformAndStorageBuffer16BitAccess +OpCapability StorageBuffer16BitAccess +OpCapability StorageInputOutput16 +%17 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %3 "a_func" +OpExecutionMode %3 OriginUpperLeft +OpName %3 "a_func" +OpName %10 "vec" +OpName %14 "__frexp_result_vec2_f16" +OpMemberName %14 0 "sig" +OpMemberName %14 1 "exp" +OpMemberDecorate %14 0 Offset 0 +OpMemberDecorate %14 1 Offset 8 +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+0 +%8 = OpConstant %6 0x1p+1 +%9 = OpConstantComposite %5 %7 %8 +%11 = OpTypePointer Function %5 +%12 = OpConstantNull %5 +%16 = OpTypeInt 32 1 +%15 = OpTypeVector %16 2 +%14 = OpTypeStruct %5 %15 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%10 = OpVariable %11 Function %12 +OpStore %10 %9 +%18 = OpLoad %5 %10 +%13 = OpExtInst %14 %17 FrexpStruct %18 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(expect, got); + + Validate(b); +} + +} // namespace float_builtin_tests + +// Tests for Numeric builtins with all integer parameter +namespace integer_builtin_tests { + +using BuiltinIntTest = BuiltinBuilderTestWithParam; +TEST_P(BuiltinIntTest, Call_SInt_Scalar) { + auto param = GetParam(); + auto* var = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); + auto* expr = Call(param.name, "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeInt 32 1 +%2 = OpTypePointer Private %3 +%4 = OpConstantNull %3 +%1 = OpVariable %2 Private %4 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 +)"); + + auto expected = utils::ReplaceAll(R"(%10 = OpLoad %3 %1 +%9 = ${op} %3 %10 +OpReturn +)", + "${op}", param.op); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); +} + +TEST_P(BuiltinIntTest, Call_SInt_Vector) { + auto param = GetParam(); + auto* var = GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); + auto* expr = Call(param.name, "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +)"); + + auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1 +%10 = ${op} %3 %11 +OpReturn +)", + "${op}", param.op); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); +} + +TEST_P(BuiltinIntTest, Call_UInt_Scalar) { + auto param = GetParam(); + auto* var = GlobalVar("v", ty.u32(), ast::StorageClass::kPrivate); + auto* expr = Call(param.name, "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeInt 32 0 +%2 = OpTypePointer Private %3 +%4 = OpConstantNull %3 +%1 = OpVariable %2 Private %4 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 +)"); + + auto expected = utils::ReplaceAll(R"(%10 = OpLoad %3 %1 +%9 = ${op} %3 %10 +OpReturn +)", + "${op}", param.op); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); +} + +TEST_P(BuiltinIntTest, Call_UInt_Vector) { + auto param = GetParam(); + auto* var = GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); + auto* expr = Call(param.name, "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 0 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +)"); + + auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1 +%10 = ${op} %3 %11 +OpReturn +)", + "${op}", param.op); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); +} +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + BuiltinIntTest, + testing::Values(BuiltinData{"countOneBits", "OpBitCount"}, + BuiltinData{"reverseBits", "OpBitReverse"})); + +using Builtin_Builder_SingleParam_Sint_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_SingleParam_Sint_Test, Call_Scalar) { + auto param = GetParam(); + auto* scalar = Var("scalar", Expr(1_i)); + auto* expr = Call(param.name, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeInt 32 1 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_SingleParam_Sint_Test, Call_Vector) { + auto param = GetParam(); + auto* vec = Var("vec", vec2(1_i, 1_i)); + auto* expr = Call(param.name, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeInt 32 1 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + Builtin_Builder_SingleParam_Sint_Test, + testing::Values(BuiltinData{"abs", "SAbs"})); + +// Calling abs() on an unsigned integer scalar / vector is a no-op. +using Builtin_Builder_Abs_Uint_Test = BuiltinBuilderTest; +TEST_F(Builtin_Builder_Abs_Uint_Test, Call_Scalar) { + auto* scalar = Var("scalar", Expr(1_u)); + auto* expr = Call("abs", scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeInt 32 0 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%11 = OpLoad %5 %7 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(Builtin_Builder_Abs_Uint_Test, Call_Vector) { + auto* scalar = Var("scalar", vec2(1_u, 1_u)); + auto* expr = Call("abs", scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpName %3 "a_func" +OpName %9 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeInt 32 0 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%13 = OpLoad %5 %9 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +using Builtin_Builder_DualParam_SInt_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_DualParam_SInt_Test, Call_Scalar) { + auto param = GetParam(); + auto* scalar = Var("scalar", Expr(1_i)); + auto* expr = Call(param.name, scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeInt 32 1 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 %13 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_DualParam_SInt_Test, Call_Vector) { + auto param = GetParam(); + auto* vec = Var("vec", vec2(1_i, 1_i)); + auto* expr = Call(param.name, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeInt 32 1 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + Builtin_Builder_DualParam_SInt_Test, + testing::Values(BuiltinData{"max", "SMax"}, BuiltinData{"min", "SMin"})); + +using Builtin_Builder_DualParam_UInt_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_DualParam_UInt_Test, Call_Scalar) { + auto param = GetParam(); + auto* scalar = Var("scalar", Expr(1_u)); + auto* expr = Call(param.name, scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeInt 32 0 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 %13 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_DualParam_UInt_Test, Call_Vector) { + auto param = GetParam(); + auto* vec = Var("vec", vec2(1_u, 1_u)); + auto* expr = Call(param.name, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeInt 32 0 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 %15 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + Builtin_Builder_DualParam_UInt_Test, + testing::Values(BuiltinData{"max", "UMax"}, BuiltinData{"min", "UMin"})); + +using Builtin_Builder_ThreeParam_Sint_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_ThreeParam_Sint_Test, Call_Scalar) { + auto param = GetParam(); + auto* scalar = Var("scalar", Expr(1_i)); + auto* expr = Call(param.name, scalar, scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeInt 32 1 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%14 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 %13 %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_ThreeParam_Sint_Test, Call_Vector) { + auto param = GetParam(); + auto* vec = Var("vec", vec2(1_i, 1_i)); + auto* expr = Call(param.name, vec, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeInt 32 1 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%16 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 %15 %16 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + Builtin_Builder_ThreeParam_Sint_Test, + testing::Values(BuiltinData{"clamp", "SClamp"})); + +using Builtin_Builder_ThreeParam_Uint_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_ThreeParam_Uint_Test, Call_Scalar) { + auto param = GetParam(); + auto* scalar = Var("scalar", Expr(1_u)); + auto* expr = Call(param.name, scalar, scalar, scalar); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(scalar), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%11 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %7 "scalar" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeInt 32 0 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%7 = OpVariable %8 Function %9 +OpStore %7 %6 +%12 = OpLoad %5 %7 +%13 = OpLoad %5 %7 +%14 = OpLoad %5 %7 +%10 = OpExtInst %5 %11 )" + + param.op + + R"( %12 %13 %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_P(Builtin_Builder_ThreeParam_Uint_Test, Call_Vector) { + auto param = GetParam(); + auto* vec = Var("vec", vec2(1_u, 1_u)); + auto* expr = Call(param.name, vec, vec, vec); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(vec), + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%13 = OpExtInstImport "GLSL.std.450" +OpName %3 "a_func" +OpName %9 "vec" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeInt 32 0 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%9 = OpVariable %10 Function %11 +OpStore %9 %8 +%14 = OpLoad %5 %9 +%15 = OpLoad %5 %9 +%16 = OpLoad %5 %9 +%12 = OpExtInst %5 %13 )" + + param.op + + R"( %14 %15 %16 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + Builtin_Builder_ThreeParam_Uint_Test, + testing::Values(BuiltinData{"clamp", "UClamp"})); + +TEST_F(BuiltinBuilderTest, Call_ExtractBits_i32) { + auto* v = Var("v", ty.i32()); + auto* offset = Var("offset", ty.u32()); + auto* count = Var("count", ty.u32()); + auto* call = Call("extractBits", v, offset, count); + auto* func = WrapInFunction(v, offset, count, call); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" +OpExecutionMode %3 LocalSize 1 1 1 +OpName %3 "test_function" +OpName %5 "v" +OpName %9 "offset" +OpName %13 "count" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%7 = OpTypeInt 32 1 +%6 = OpTypePointer Function %7 +%8 = OpConstantNull %7 +%11 = OpTypeInt 32 0 +%10 = OpTypePointer Function %11 +%12 = OpConstantNull %11 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%5 = OpVariable %6 Function %8 +%9 = OpVariable %10 Function %12 +%13 = OpVariable %10 Function %12 +%15 = OpLoad %7 %5 +%16 = OpLoad %11 %9 +%17 = OpLoad %11 %13 +%14 = OpBitFieldSExtract %7 %15 %16 %17 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_ExtractBits_u32) { + auto* v = Var("v", ty.u32()); + auto* offset = Var("offset", ty.u32()); + auto* count = Var("count", ty.u32()); + auto* call = Call("extractBits", v, offset, count); + auto* func = WrapInFunction(v, offset, count, call); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" +OpExecutionMode %3 LocalSize 1 1 1 +OpName %3 "test_function" +OpName %5 "v" +OpName %9 "offset" +OpName %10 "count" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%7 = OpTypeInt 32 0 +%6 = OpTypePointer Function %7 +%8 = OpConstantNull %7 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%5 = OpVariable %6 Function %8 +%9 = OpVariable %6 Function %8 +%10 = OpVariable %6 Function %8 +%12 = OpLoad %7 %5 +%13 = OpLoad %7 %9 +%14 = OpLoad %7 %10 +%11 = OpBitFieldUExtract %7 %12 %13 %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_ExtractBits_vec3_i32) { + auto* v = Var("v", ty.vec3()); + auto* offset = Var("offset", ty.u32()); + auto* count = Var("count", ty.u32()); + auto* call = Call("extractBits", v, offset, count); + auto* func = WrapInFunction(v, offset, count, call); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" +OpExecutionMode %3 LocalSize 1 1 1 +OpName %3 "test_function" +OpName %5 "v" +OpName %10 "offset" +OpName %14 "count" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeInt 32 1 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%12 = OpTypeInt 32 0 +%11 = OpTypePointer Function %12 +%13 = OpConstantNull %12 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%5 = OpVariable %6 Function %9 +%10 = OpVariable %11 Function %13 +%14 = OpVariable %11 Function %13 +%16 = OpLoad %7 %5 +%17 = OpLoad %12 %10 +%18 = OpLoad %12 %14 +%15 = OpBitFieldSExtract %7 %16 %17 %18 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_ExtractBits_vec3_u32) { + auto* v = Var("v", ty.vec3()); + auto* offset = Var("offset", ty.u32()); + auto* count = Var("count", ty.u32()); + auto* call = Call("extractBits", v, offset, count); + auto* func = WrapInFunction(v, offset, count, call); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" +OpExecutionMode %3 LocalSize 1 1 1 +OpName %3 "test_function" +OpName %5 "v" +OpName %10 "offset" +OpName %13 "count" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeInt 32 0 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%11 = OpTypePointer Function %8 +%12 = OpConstantNull %8 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%5 = OpVariable %6 Function %9 +%10 = OpVariable %11 Function %12 +%13 = OpVariable %11 Function %12 +%15 = OpLoad %7 %5 +%16 = OpLoad %8 %10 +%17 = OpLoad %8 %13 +%14 = OpBitFieldUExtract %7 %15 %16 %17 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_InsertBits_i32) { + auto* v = Var("v", ty.i32()); + auto* n = Var("n", ty.i32()); + auto* offset = Var("offset", ty.u32()); + auto* count = Var("count", ty.u32()); + auto* call = Call("insertBits", v, n, offset, count); + auto* func = WrapInFunction(v, n, offset, count, call); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" +OpExecutionMode %3 LocalSize 1 1 1 +OpName %3 "test_function" +OpName %5 "v" +OpName %9 "n" +OpName %10 "offset" +OpName %14 "count" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%7 = OpTypeInt 32 1 +%6 = OpTypePointer Function %7 +%8 = OpConstantNull %7 +%12 = OpTypeInt 32 0 +%11 = OpTypePointer Function %12 +%13 = OpConstantNull %12 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%5 = OpVariable %6 Function %8 +%9 = OpVariable %6 Function %8 +%10 = OpVariable %11 Function %13 +%14 = OpVariable %11 Function %13 +%16 = OpLoad %7 %5 +%17 = OpLoad %7 %9 +%18 = OpLoad %12 %10 +%19 = OpLoad %12 %14 +%15 = OpBitFieldInsert %7 %16 %17 %18 %19 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_InsertBits_u32) { + auto* v = Var("v", ty.u32()); + auto* n = Var("n", ty.u32()); + auto* offset = Var("offset", ty.u32()); + auto* count = Var("count", ty.u32()); + auto* call = Call("insertBits", v, n, offset, count); + auto* func = WrapInFunction(v, n, offset, count, call); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" +OpExecutionMode %3 LocalSize 1 1 1 +OpName %3 "test_function" +OpName %5 "v" +OpName %9 "n" +OpName %10 "offset" +OpName %11 "count" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%7 = OpTypeInt 32 0 +%6 = OpTypePointer Function %7 +%8 = OpConstantNull %7 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%5 = OpVariable %6 Function %8 +%9 = OpVariable %6 Function %8 +%10 = OpVariable %6 Function %8 +%11 = OpVariable %6 Function %8 +%13 = OpLoad %7 %5 +%14 = OpLoad %7 %9 +%15 = OpLoad %7 %10 +%16 = OpLoad %7 %11 +%12 = OpBitFieldInsert %7 %13 %14 %15 %16 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_InsertBits_vec3_i32) { + auto* v = Var("v", ty.vec3()); + auto* n = Var("n", ty.vec3()); + auto* offset = Var("offset", ty.u32()); + auto* count = Var("count", ty.u32()); + auto* call = Call("insertBits", v, n, offset, count); + auto* func = WrapInFunction(v, n, offset, count, call); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" +OpExecutionMode %3 LocalSize 1 1 1 +OpName %3 "test_function" +OpName %5 "v" +OpName %10 "n" +OpName %11 "offset" +OpName %15 "count" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeInt 32 1 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%13 = OpTypeInt 32 0 +%12 = OpTypePointer Function %13 +%14 = OpConstantNull %13 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%5 = OpVariable %6 Function %9 +%10 = OpVariable %6 Function %9 +%11 = OpVariable %12 Function %14 +%15 = OpVariable %12 Function %14 +%17 = OpLoad %7 %5 +%18 = OpLoad %7 %10 +%19 = OpLoad %13 %11 +%20 = OpLoad %13 %15 +%16 = OpBitFieldInsert %7 %17 %18 %19 %20 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_InsertBits_vec3_u32) { + auto* v = Var("v", ty.vec3()); + auto* n = Var("n", ty.vec3()); + auto* offset = Var("offset", ty.u32()); + auto* count = Var("count", ty.u32()); + auto* call = Call("insertBits", v, n, offset, count); + auto* func = WrapInFunction(v, n, offset, count, call); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" +OpExecutionMode %3 LocalSize 1 1 1 +OpName %3 "test_function" +OpName %5 "v" +OpName %10 "n" +OpName %11 "offset" +OpName %14 "count" +%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%8 = OpTypeInt 32 0 +%7 = OpTypeVector %8 3 +%6 = OpTypePointer Function %7 +%9 = OpConstantNull %7 +%12 = OpTypePointer Function %8 +%13 = OpConstantNull %8 +%3 = OpFunction %2 None %1 +%4 = OpLabel +%5 = OpVariable %6 Function %9 +%10 = OpVariable %6 Function %9 +%11 = OpVariable %12 Function %13 +%14 = OpVariable %12 Function %13 +%16 = OpLoad %7 %5 +%17 = OpLoad %7 %10 +%18 = OpLoad %8 %11 +%19 = OpLoad %8 %14 +%15 = OpBitFieldInsert %7 %16 %17 %18 %19 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +} // namespace integer_builtin_tests + +// Tests for Numeric builtins with matrix parameter, i.e. "determinant" and "transpose" +namespace matrix_builtin_tests { + +TEST_F(BuiltinBuilderTest, Call_Determinant_f32) { + auto* var = GlobalVar("var", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* expr = Call("determinant", "var"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%12 = OpExtInstImport "GLSL.std.450" +OpName %1 "var" +OpName %9 "a_func" +%5 = OpTypeFloat 32 +%4 = OpTypeVector %5 3 +%3 = OpTypeMatrix %4 3 +%2 = OpTypePointer Private %3 +%6 = OpConstantNull %3 +%1 = OpVariable %2 Private %6 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +%9 = OpFunction %8 None %7 +%10 = OpLabel +%13 = OpLoad %3 %1 +%11 = OpExtInst %5 %12 Determinant %13 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Determinant_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalVar("var", ty.mat3x3(), ast::StorageClass::kPrivate); + auto* expr = Call("determinant", "var"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(%12 = OpExtInstImport "GLSL.std.450" +OpName %1 "var" +OpName %9 "a_func" +%5 = OpTypeFloat 16 +%4 = OpTypeVector %5 3 +%3 = OpTypeMatrix %4 3 +%2 = OpTypePointer Private %3 +%6 = OpConstantNull %3 +%1 = OpVariable %2 Private %6 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +%9 = OpFunction %8 None %7 +%10 = OpLabel +%13 = OpLoad %3 %1 +%11 = OpExtInst %5 %12 Determinant %13 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Transpose_f32) { + auto* var = GlobalVar("var", ty.mat2x3(), ast::StorageClass::kPrivate); + auto* expr = Call("transpose", "var"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpName %1 "var" +OpName %9 "a_func" +%5 = OpTypeFloat 32 +%4 = OpTypeVector %5 3 +%3 = OpTypeMatrix %4 2 +%2 = OpTypePointer Private %3 +%6 = OpConstantNull %3 +%1 = OpVariable %2 Private %6 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +%13 = OpTypeVector %5 2 +%12 = OpTypeMatrix %13 3 +%9 = OpFunction %8 None %7 +%10 = OpLabel +%14 = OpLoad %3 %1 +%11 = OpTranspose %12 %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +TEST_F(BuiltinBuilderTest, Call_Transpose_f16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalVar("var", ty.mat2x3(), ast::StorageClass::kPrivate); + auto* expr = Call("transpose", "var"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + auto got = DumpBuilder(b); + auto expect = R"(OpName %1 "var" +OpName %9 "a_func" +%5 = OpTypeFloat 16 +%4 = OpTypeVector %5 3 +%3 = OpTypeMatrix %4 2 +%2 = OpTypePointer Private %3 +%6 = OpConstantNull %3 +%1 = OpVariable %2 Private %6 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +%13 = OpTypeVector %5 2 +%12 = OpTypeMatrix %13 3 +%9 = OpFunction %8 None %7 +%10 = OpLabel +%14 = OpLoad %3 %1 +%11 = OpTranspose %12 %14 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(got, expect); +} + +} // namespace matrix_builtin_tests + +// Tests for Numeric builtins with float and integer vector parameter, i.e. "dot" +namespace vector_builtin_tests { + +TEST_F(BuiltinBuilderTest, Call_Dot_F32) { + auto* var = GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); + auto* expr = Call("dot", "v", "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%11 = OpLoad %3 %1 +%12 = OpLoad %3 %1 +%10 = OpDot %4 %11 %12 +OpReturn +)"); +} + +TEST_F(BuiltinBuilderTest, Call_Dot_F16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); + auto* expr = Call("dot", "v", "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 16 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%11 = OpLoad %3 %1 +%12 = OpLoad %3 %1 +%10 = OpDot %4 %11 %12 +OpReturn +)"); +} + +TEST_F(BuiltinBuilderTest, Call_Dot_U32) { + auto* var = GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); + auto* expr = Call("dot", "v", "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 0 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%11 = OpLoad %3 %1 +%12 = OpLoad %3 %1 +%13 = OpCompositeExtract %4 %11 0 +%14 = OpCompositeExtract %4 %12 0 +%15 = OpIMul %4 %13 %14 +%16 = OpCompositeExtract %4 %11 1 +%17 = OpCompositeExtract %4 %12 1 +%18 = OpIMul %4 %16 %17 +%19 = OpIAdd %4 %15 %18 +%20 = OpCompositeExtract %4 %11 2 +%21 = OpCompositeExtract %4 %12 2 +%22 = OpIMul %4 %20 %21 +%10 = OpIAdd %4 %19 %22 +OpReturn +)"); +} + +TEST_F(BuiltinBuilderTest, Call_Dot_I32) { + auto* var = GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); + auto* expr = Call("dot", "v", "v"); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Assign(Phony(), expr), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%11 = OpLoad %3 %1 +%12 = OpLoad %3 %1 +%13 = OpCompositeExtract %4 %11 0 +%14 = OpCompositeExtract %4 %12 0 +%15 = OpIMul %4 %13 %14 +%16 = OpCompositeExtract %4 %11 1 +%17 = OpCompositeExtract %4 %12 1 +%18 = OpIMul %4 %16 %17 +%19 = OpIAdd %4 %15 %18 +%20 = OpCompositeExtract %4 %11 2 +%21 = OpCompositeExtract %4 %12 2 +%22 = OpIMul %4 %20 %21 +%10 = OpIAdd %4 %19 %22 +OpReturn +)"); +} + +} // namespace vector_builtin_tests + +// Tests for Derivative builtins +namespace derivative_builtin_tests { + +using BuiltinDeriveTest = BuiltinBuilderTestWithParam; +TEST_P(BuiltinDeriveTest, Call_Derivative_Scalar) { + auto param = GetParam(); + auto* var = GlobalVar("v", ty.f32(), ast::StorageClass::kPrivate); + auto* expr = Call(param.name, "v"); + auto* func = Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(expr), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32 +%2 = OpTypePointer Private %3 +%4 = OpConstantNull %3 +%1 = OpVariable %2 Private %4 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 +)"); + + auto expected = utils::ReplaceAll(R"(%10 = OpLoad %3 %1 +%9 = ${op} %3 %10 +OpReturn +)", + "${op}", param.op); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); +} + +TEST_P(BuiltinDeriveTest, Call_Derivative_Vector) { + auto param = GetParam(); + auto* var = GlobalVar("v", ty.vec3(), ast::StorageClass::kPrivate); + auto* expr = Call(param.name, "v"); + auto* func = Func("func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(expr), + }, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); + + if (param.name != "dpdx" && param.name != "dpdy" && param.name != "fwidth") { + EXPECT_EQ(DumpInstructions(b.capabilities()), + R"(OpCapability DerivativeControl +)"); + } + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +)"); + + auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1 +%10 = ${op} %3 %11 +OpReturn +)", + "${op}", param.op); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), expected); +} +INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, + BuiltinDeriveTest, + testing::Values(BuiltinData{"dpdx", "OpDPdx"}, + BuiltinData{"dpdxFine", "OpDPdxFine"}, + BuiltinData{"dpdxCoarse", "OpDPdxCoarse"}, + BuiltinData{"dpdy", "OpDPdy"}, + BuiltinData{"dpdyFine", "OpDPdyFine"}, + BuiltinData{"dpdyCoarse", "OpDPdyCoarse"}, + BuiltinData{"fwidth", "OpFwidth"}, + BuiltinData{"fwidthFine", "OpFwidthFine"}, + BuiltinData{"fwidthCoarse", "OpFwidthCoarse"})); + +} // namespace derivative_builtin_tests + +// Tests for Atomic builtins +namespace atomic_builtin_tests { + TEST_F(BuiltinBuilderTest, Call_AtomicLoad) { // struct S { // u : atomic; @@ -1670,22 +3215,21 @@ TEST_F(BuiltinBuilderTest, Call_AtomicLoad) { // let u : u32 = atomicLoad(&b.u); // let i : i32 = atomicLoad(&b.i); // } - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("u", ty.atomic()), Member("i", ty.atomic()), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(1), + Group(2)); - Func("a_func", {}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Decl(Let("u", ty.u32(), Call("atomicLoad", AddressOf(MemberAccessor("b", "u"))))), Decl(Let("i", ty.i32(), Call("atomicLoad", AddressOf(MemberAccessor("b", "i"))))), }, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = SanitizeAndBuild(); @@ -1734,24 +3278,23 @@ TEST_F(BuiltinBuilderTest, Call_AtomicStore) { // atomicStore(&b.u, u); // atomicStore(&b.i, i); // } - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("u", ty.atomic()), Member("i", ty.atomic()), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(1), + Group(2)); - Func("a_func", {}, ty.void_(), - ast::StatementList{ - Decl(Var("u", nullptr, Expr(1_u))), - Decl(Var("i", nullptr, Expr(2_i))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("u", Expr(1_u))), + Decl(Var("i", Expr(2_i))), CallStmt(Call("atomicStore", AddressOf(MemberAccessor("b", "u")), "u")), CallStmt(Call("atomicStore", AddressOf(MemberAccessor("b", "i")), "i")), }, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = SanitizeAndBuild(); @@ -1795,8 +3338,8 @@ OpReturn Validate(b); } -using Builtin_Builtin_AtomicRMW_i32 = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_AtomicRMW_i32, Test) { +using Builtin_Builder_AtomicRMW_i32 = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_AtomicRMW_i32, Test) { // struct S { // v : atomic; // } @@ -1807,22 +3350,21 @@ TEST_P(Builtin_Builtin_AtomicRMW_i32, Test) { // var v = 10; // let x : i32 = atomicOP(&b.v, v); // } - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("v", ty.atomic()), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(1), + Group(2)); - Func("a_func", {}, ty.void_(), - ast::StatementList{ - Decl(Var("v", nullptr, Expr(10_i))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("v", Expr(10_i))), Decl(Let("x", ty.i32(), Call(GetParam().name, AddressOf(MemberAccessor("b", "v")), "v"))), }, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = SanitizeAndBuild(); @@ -1860,7 +3402,7 @@ TEST_P(Builtin_Builtin_AtomicRMW_i32, Test) { Validate(b); } INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_AtomicRMW_i32, + Builtin_Builder_AtomicRMW_i32, testing::Values(BuiltinData{"atomicAdd", "OpAtomicIAdd"}, BuiltinData{"atomicMax", "OpAtomicSMax"}, BuiltinData{"atomicMin", "OpAtomicSMin"}, @@ -1868,8 +3410,8 @@ INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, BuiltinData{"atomicOr", "OpAtomicOr"}, BuiltinData{"atomicXor", "OpAtomicXor"})); -using Builtin_Builtin_AtomicRMW_u32 = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_AtomicRMW_u32, Test) { +using Builtin_Builder_AtomicRMW_u32 = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_AtomicRMW_u32, Test) { // struct S { // v : atomic; // } @@ -1880,22 +3422,21 @@ TEST_P(Builtin_Builtin_AtomicRMW_u32, Test) { // var v = 10u; // let x : u32 = atomicOP(&b.v, v); // } - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("v", ty.atomic()), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(1), + Group(2)); - Func("a_func", {}, ty.void_(), - ast::StatementList{ - Decl(Var("v", nullptr, Expr(10_u))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("v", Expr(10_u))), Decl(Let("x", ty.u32(), Call(GetParam().name, AddressOf(MemberAccessor("b", "v")), "v"))), }, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = SanitizeAndBuild(); @@ -1932,7 +3473,7 @@ TEST_P(Builtin_Builtin_AtomicRMW_u32, Test) { Validate(b); } INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_AtomicRMW_u32, + Builtin_Builder_AtomicRMW_u32, testing::Values(BuiltinData{"atomicAdd", "OpAtomicIAdd"}, BuiltinData{"atomicMax", "OpAtomicUMax"}, BuiltinData{"atomicMin", "OpAtomicUMin"}, @@ -1954,26 +3495,25 @@ TEST_F(BuiltinBuilderTest, Call_AtomicExchange) { // let r : u32 = atomicExchange(&b.u, u); // let s : i32 = atomicExchange(&b.i, i); // } - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("u", ty.atomic()), Member("i", ty.atomic()), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(1), + Group(2)); - Func("a_func", {}, ty.void_(), - ast::StatementList{ - Decl(Var("u", nullptr, Expr(10_u))), - Decl(Var("i", nullptr, Expr(10_i))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Var("u", Expr(10_u))), + Decl(Var("i", Expr(10_i))), Decl(Let("r", ty.u32(), Call("atomicExchange", AddressOf(MemberAccessor("b", "u")), "u"))), Decl(Let("s", ty.i32(), Call("atomicExchange", AddressOf(MemberAccessor("b", "i")), "i"))), }, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = SanitizeAndBuild(); @@ -2020,36 +3560,33 @@ OpReturn TEST_F(BuiltinBuilderTest, Call_AtomicCompareExchangeWeak) { // struct S { - // u : atomic; - // i : atomic; + // u : atomic, + // i : atomic, // } // // @binding(1) @group(2) var b : S; // // fn a_func() { - // let u : vec2 = atomicCompareExchangeWeak(&b.u, 10u); - // let i : vec2 = atomicCompareExchangeWeak(&b.i, 10); + // let u = atomicCompareExchangeWeak(&b.u, 10u, 20u); + // let i = atomicCompareExchangeWeak(&b.i, 10, 10); // } - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("u", ty.atomic()), Member("i", ty.atomic()), }); - Global("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(1), + Group(2)); - Func("a_func", {}, ty.void_(), - ast::StatementList{ - Decl(Let("u", ty.vec2(), - Call("atomicCompareExchangeWeak", AddressOf(MemberAccessor("b", "u")), 10_u, - 20_u))), - Decl(Let("i", ty.vec2(), - Call("atomicCompareExchangeWeak", AddressOf(MemberAccessor("b", "i")), 10_i, - 20_i))), + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Decl(Let("u", Call("atomicCompareExchangeWeak", AddressOf(MemberAccessor("b", "u")), + 10_u, 20_u))), + Decl(Let("i", Call("atomicCompareExchangeWeak", AddressOf(MemberAccessor("b", "i")), + 10_i, 20_i))), }, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}); + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = SanitizeAndBuild(); @@ -2064,33 +3601,29 @@ TEST_F(BuiltinBuilderTest, Call_AtomicCompareExchangeWeak) { %1 = OpVariable %2 StorageBuffer %7 = OpTypeVoid %6 = OpTypeFunction %7 -%11 = OpTypeVector %4 2 -%12 = OpConstant %4 1 -%13 = OpConstant %4 0 -%15 = OpTypePointer StorageBuffer %4 -%17 = OpConstant %4 20 -%18 = OpConstant %4 10 -%19 = OpTypeBool -%24 = OpTypeVector %5 2 -%26 = OpTypePointer StorageBuffer %5 -%28 = OpConstant %5 20 -%29 = OpConstant %5 10 -%32 = OpConstant %5 0 -%33 = OpConstant %5 1 +%12 = OpTypeBool +%11 = OpTypeStruct %4 %12 +%13 = OpConstant %4 1 +%14 = OpConstant %4 0 +%16 = OpTypePointer StorageBuffer %4 +%18 = OpConstant %4 20 +%19 = OpConstant %4 10 +%23 = OpTypeStruct %5 %12 +%25 = OpTypePointer StorageBuffer %5 +%27 = OpConstant %5 20 +%28 = OpConstant %5 10 )"; auto got_types = DumpInstructions(b.types()); EXPECT_EQ(expected_types, got_types); - auto* expected_instructions = R"(%16 = OpAccessChain %15 %1 %13 -%20 = OpAtomicCompareExchange %4 %16 %12 %13 %13 %17 %18 -%21 = OpIEqual %19 %20 %17 -%22 = OpSelect %4 %21 %12 %13 -%10 = OpCompositeConstruct %11 %20 %22 -%27 = OpAccessChain %26 %1 %12 -%30 = OpAtomicCompareExchange %5 %27 %12 %13 %13 %28 %29 -%31 = OpIEqual %19 %30 %28 -%34 = OpSelect %5 %31 %33 %32 -%23 = OpCompositeConstruct %24 %30 %34 + auto* expected_instructions = R"(%17 = OpAccessChain %16 %1 %14 +%20 = OpAtomicCompareExchange %4 %17 %13 %14 %14 %18 %19 +%21 = OpIEqual %12 %20 %18 +%10 = OpCompositeConstruct %11 %20 %21 +%26 = OpAccessChain %25 %1 %13 +%29 = OpAtomicCompareExchange %5 %26 %13 %14 %14 %27 %28 +%30 = OpIEqual %12 %29 %27 +%22 = OpCompositeConstruct %23 %29 %30 OpReturn )"; auto got_instructions = DumpInstructions(b.functions()[0].instructions()); @@ -2099,21 +3632,30 @@ OpReturn Validate(b); } -using Builtin_Builtin_DataPacking_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_DataPacking_Test, Binary) { +} // namespace atomic_builtin_tests + +// Tests for Data Packing builtins +namespace data_packing_builtin_tests { + +using Builtin_Builder_DataPacking_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_DataPacking_Test, Binary) { auto param = GetParam(); bool pack4 = param.name == "pack4x8snorm" || param.name == "pack4x8unorm"; - auto* call = pack4 ? Call(param.name, vec4(1.0f, 1.0f, 1.0f, 1.0f)) - : Call(param.name, vec2(1.0f, 1.0f)); - auto* func = Func("a_func", {}, ty.void_(), {CallStmt(call)}); + auto* call = pack4 ? Call(param.name, vec4(1_f, 1_f, 1_f, 1_f)) + : Call(param.name, vec2(1_f, 1_f)); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(call), + }); spirv::Builder& b = Build(); ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); if (pack4) { - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" + auto got = DumpBuilder(b); + auto expect = R"(%7 = OpExtInstImport "GLSL.std.450" OpName %3 "a_func" %2 = OpTypeVoid %1 = OpTypeFunction %2 @@ -2124,13 +3666,16 @@ OpName %3 "a_func" %11 = OpConstantComposite %8 %10 %10 %10 %10 %3 = OpFunction %2 None %1 %4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %11 +%5 = OpExtInst %6 %7 )" + + param.op + + R"( %11 OpReturn OpFunctionEnd -)"); +)"; + EXPECT_EQ(got, expect); } else { - EXPECT_EQ(DumpBuilder(b), R"(%7 = OpExtInstImport "GLSL.std.450" + auto got = DumpBuilder(b); + auto expect = R"(%7 = OpExtInstImport "GLSL.std.450" OpName %3 "a_func" %2 = OpTypeVoid %1 = OpTypeFunction %2 @@ -2141,35 +3686,46 @@ OpName %3 "a_func" %11 = OpConstantComposite %8 %10 %10 %3 = OpFunction %2 None %1 %4 = OpLabel -%5 = OpExtInst %6 %7 )" + param.op + - R"( %11 +%5 = OpExtInst %6 %7 )" + + param.op + + R"( %11 OpReturn OpFunctionEnd -)"); +)"; + EXPECT_EQ(got, expect); } } INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_DataPacking_Test, + Builtin_Builder_DataPacking_Test, testing::Values(BuiltinData{"pack4x8snorm", "PackSnorm4x8"}, BuiltinData{"pack4x8unorm", "PackUnorm4x8"}, BuiltinData{"pack2x16snorm", "PackSnorm2x16"}, BuiltinData{"pack2x16unorm", "PackUnorm2x16"}, BuiltinData{"pack2x16float", "PackHalf2x16"})); -using Builtin_Builtin_DataUnpacking_Test = BuiltinBuilderTestWithParam; -TEST_P(Builtin_Builtin_DataUnpacking_Test, Binary) { +} // namespace data_packing_builtin_tests + +// Tests for Data Unpacking builtins +namespace data_unpacking_builtin_tests { + +using Builtin_Builder_DataUnpacking_Test = BuiltinBuilderTestWithParam; +TEST_P(Builtin_Builder_DataUnpacking_Test, Binary) { auto param = GetParam(); bool pack4 = param.name == "unpack4x8snorm" || param.name == "unpack4x8unorm"; - auto* func = Func("a_func", {}, ty.void_(), {CallStmt(Call(param.name, 1_u))}); + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + CallStmt(Call(param.name, 1_u)), + }); spirv::Builder& b = Build(); ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); if (pack4) { - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" + auto got = DumpBuilder(b); + auto expect = R"(%8 = OpExtInstImport "GLSL.std.450" OpName %3 "a_func" %2 = OpTypeVoid %1 = OpTypeFunction %2 @@ -2179,13 +3735,16 @@ OpName %3 "a_func" %10 = OpConstant %9 1 %3 = OpFunction %2 None %1 %4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 +%5 = OpExtInst %6 %8 )" + + param.op + + R"( %10 OpReturn OpFunctionEnd -)"); +)"; + EXPECT_EQ(got, expect); } else { - EXPECT_EQ(DumpBuilder(b), R"(%8 = OpExtInstImport "GLSL.std.450" + auto got = DumpBuilder(b); + auto expect = R"(%8 = OpExtInstImport "GLSL.std.450" OpName %3 "a_func" %2 = OpTypeVoid %1 = OpTypeFunction %2 @@ -2195,28 +3754,35 @@ OpName %3 "a_func" %10 = OpConstant %9 1 %3 = OpFunction %2 None %1 %4 = OpLabel -%5 = OpExtInst %6 %8 )" + param.op + - R"( %10 +%5 = OpExtInst %6 %8 )" + + param.op + + R"( %10 OpReturn OpFunctionEnd -)"); +)"; + EXPECT_EQ(got, expect); } } INSTANTIATE_TEST_SUITE_P(BuiltinBuilderTest, - Builtin_Builtin_DataUnpacking_Test, + Builtin_Builder_DataUnpacking_Test, testing::Values(BuiltinData{"unpack4x8snorm", "UnpackSnorm4x8"}, BuiltinData{"unpack4x8unorm", "UnpackUnorm4x8"}, BuiltinData{"unpack2x16snorm", "UnpackSnorm2x16"}, BuiltinData{"unpack2x16unorm", "UnpackUnorm2x16"}, BuiltinData{"unpack2x16float", "UnpackHalf2x16"})); +} // namespace data_unpacking_builtin_tests + +// Tests for Synchronization builtins +namespace synchronization_builtin_tests { + TEST_F(BuiltinBuilderTest, Call_WorkgroupBarrier) { - Func("f", {}, ty.void_(), - ast::StatementList{ + Func("f", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call("workgroupBarrier")), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -2246,11 +3812,11 @@ OpReturn } TEST_F(BuiltinBuilderTest, Call_StorageBarrier) { - Func("f", {}, ty.void_(), - ast::StatementList{ + Func("f", utils::Empty, ty.void_(), + utils::Vector{ CallStmt(Call("storageBarrier")), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -2279,222 +3845,72 @@ OpReturn Validate(b); } -TEST_F(BuiltinBuilderTest, Call_ExtractBits_i32) { - auto* v = Var("v", ty.i32()); - auto* offset = Var("offset", ty.u32()); - auto* count = Var("count", ty.u32()); - auto* call = Call("extractBits", v, offset, count); - auto* func = WrapInFunction(v, offset, count, call); +} // namespace synchronization_builtin_tests + +// Tests for DP4A builtins, tint:1497 +namespace DP4A_builtin_tests { + +TEST_F(BuiltinBuilderTest, Call_Dot4I8Packed) { + auto* ext = + create(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}}, + ast::Extension::kChromiumExperimentalDp4A); + AST().AddEnable(ext); + + auto* val1 = Var("val1", ty.u32()); + auto* val2 = Var("val2", ty.u32()); + auto* call = Call("dot4I8Packed", val1, val2); + auto* func = WrapInFunction(val1, val2, call); spirv::Builder& b = Build(); ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - EXPECT_EQ(DumpBuilder(b), R"(OpEntryPoint GLCompute %3 "test_function" + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" OpExecutionMode %3 LocalSize 1 1 1 OpName %3 "test_function" -OpName %5 "v" -OpName %9 "offset" -OpName %13 "count" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeInt 32 1 -%6 = OpTypePointer Function %7 -%8 = OpConstantNull %7 -%11 = OpTypeInt 32 0 -%10 = OpTypePointer Function %11 -%12 = OpConstantNull %11 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpVariable %6 Function %8 -%9 = OpVariable %10 Function %12 -%13 = OpVariable %10 Function %12 -%15 = OpLoad %7 %5 -%16 = OpLoad %11 %9 -%17 = OpLoad %11 %13 -%14 = OpBitFieldSExtract %7 %15 %16 %17 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_ExtractBits_u32) { - auto* v = Var("v", ty.u32()); - auto* offset = Var("offset", ty.u32()); - auto* count = Var("count", ty.u32()); - auto* call = Call("extractBits", v, offset, count); - auto* func = WrapInFunction(v, offset, count, call); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -OpName %5 "v" -OpName %9 "offset" -OpName %10 "count" +OpName %5 "val1" +OpName %9 "val2" %2 = OpTypeVoid %1 = OpTypeFunction %2 %7 = OpTypeInt 32 0 %6 = OpTypePointer Function %7 %8 = OpConstantNull %7 +%11 = OpTypeInt 32 1 %3 = OpFunction %2 None %1 %4 = OpLabel %5 = OpVariable %6 Function %8 %9 = OpVariable %6 Function %8 -%10 = OpVariable %6 Function %8 %12 = OpLoad %7 %5 %13 = OpLoad %7 %9 -%14 = OpLoad %7 %10 -%11 = OpBitFieldUExtract %7 %12 %13 %14 +%10 = OpSDot %11 %12 %13 PackedVectorFormat4x8Bit OpReturn OpFunctionEnd -)"); +)"; + EXPECT_EQ(got, expect); } -TEST_F(BuiltinBuilderTest, Call_ExtractBits_vec3_i32) { - auto* v = Var("v", ty.vec3()); - auto* offset = Var("offset", ty.u32()); - auto* count = Var("count", ty.u32()); - auto* call = Call("extractBits", v, offset, count); - auto* func = WrapInFunction(v, offset, count, call); +TEST_F(BuiltinBuilderTest, Call_Dot4U8Packed) { + auto* ext = + create(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}}, + ast::Extension::kChromiumExperimentalDp4A); + AST().AddEnable(ext); + + auto* val1 = Var("val1", ty.u32()); + auto* val2 = Var("val2", ty.u32()); + auto* call = Call("dot4U8Packed", val1, val2); + auto* func = WrapInFunction(val1, val2, call); spirv::Builder& b = Build(); ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - EXPECT_EQ(DumpBuilder(b), R"(OpEntryPoint GLCompute %3 "test_function" + auto got = DumpBuilder(b); + auto expect = R"(OpEntryPoint GLCompute %3 "test_function" OpExecutionMode %3 LocalSize 1 1 1 OpName %3 "test_function" -OpName %5 "v" -OpName %10 "offset" -OpName %14 "count" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%8 = OpTypeInt 32 1 -%7 = OpTypeVector %8 3 -%6 = OpTypePointer Function %7 -%9 = OpConstantNull %7 -%12 = OpTypeInt 32 0 -%11 = OpTypePointer Function %12 -%13 = OpConstantNull %12 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpVariable %6 Function %9 -%10 = OpVariable %11 Function %13 -%14 = OpVariable %11 Function %13 -%16 = OpLoad %7 %5 -%17 = OpLoad %12 %10 -%18 = OpLoad %12 %14 -%15 = OpBitFieldSExtract %7 %16 %17 %18 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_ExtractBits_vec3_u32) { - auto* v = Var("v", ty.vec3()); - auto* offset = Var("offset", ty.u32()); - auto* count = Var("count", ty.u32()); - auto* call = Call("extractBits", v, offset, count); - auto* func = WrapInFunction(v, offset, count, call); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -OpName %5 "v" -OpName %10 "offset" -OpName %13 "count" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%8 = OpTypeInt 32 0 -%7 = OpTypeVector %8 3 -%6 = OpTypePointer Function %7 -%9 = OpConstantNull %7 -%11 = OpTypePointer Function %8 -%12 = OpConstantNull %8 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpVariable %6 Function %9 -%10 = OpVariable %11 Function %12 -%13 = OpVariable %11 Function %12 -%15 = OpLoad %7 %5 -%16 = OpLoad %8 %10 -%17 = OpLoad %8 %13 -%14 = OpBitFieldUExtract %7 %15 %16 %17 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_InsertBits_i32) { - auto* v = Var("v", ty.i32()); - auto* n = Var("n", ty.i32()); - auto* offset = Var("offset", ty.u32()); - auto* count = Var("count", ty.u32()); - auto* call = Call("insertBits", v, n, offset, count); - auto* func = WrapInFunction(v, n, offset, count, call); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -OpName %5 "v" -OpName %9 "n" -OpName %10 "offset" -OpName %14 "count" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%7 = OpTypeInt 32 1 -%6 = OpTypePointer Function %7 -%8 = OpConstantNull %7 -%12 = OpTypeInt 32 0 -%11 = OpTypePointer Function %12 -%13 = OpConstantNull %12 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpVariable %6 Function %8 -%9 = OpVariable %6 Function %8 -%10 = OpVariable %11 Function %13 -%14 = OpVariable %11 Function %13 -%16 = OpLoad %7 %5 -%17 = OpLoad %7 %9 -%18 = OpLoad %12 %10 -%19 = OpLoad %12 %14 -%15 = OpBitFieldInsert %7 %16 %17 %18 %19 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_InsertBits_u32) { - auto* v = Var("v", ty.u32()); - auto* n = Var("n", ty.u32()); - auto* offset = Var("offset", ty.u32()); - auto* count = Var("count", ty.u32()); - auto* call = Call("insertBits", v, n, offset, count); - auto* func = WrapInFunction(v, n, offset, count, call); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -OpName %5 "v" -OpName %9 "n" -OpName %10 "offset" -OpName %11 "count" +OpName %5 "val1" +OpName %9 "val2" %2 = OpTypeVoid %1 = OpTypeFunction %2 %7 = OpTypeInt 32 0 @@ -2504,104 +3920,16 @@ OpName %11 "count" %4 = OpLabel %5 = OpVariable %6 Function %8 %9 = OpVariable %6 Function %8 -%10 = OpVariable %6 Function %8 -%11 = OpVariable %6 Function %8 -%13 = OpLoad %7 %5 -%14 = OpLoad %7 %9 -%15 = OpLoad %7 %10 -%16 = OpLoad %7 %11 -%12 = OpBitFieldInsert %7 %13 %14 %15 %16 +%11 = OpLoad %7 %5 +%12 = OpLoad %7 %9 +%10 = OpUDot %7 %11 %12 PackedVectorFormat4x8Bit OpReturn OpFunctionEnd -)"); +)"; + EXPECT_EQ(got, expect); } -TEST_F(BuiltinBuilderTest, Call_InsertBits_vec3_i32) { - auto* v = Var("v", ty.vec3()); - auto* n = Var("n", ty.vec3()); - auto* offset = Var("offset", ty.u32()); - auto* count = Var("count", ty.u32()); - auto* call = Call("insertBits", v, n, offset, count); - auto* func = WrapInFunction(v, n, offset, count, call); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -OpName %5 "v" -OpName %10 "n" -OpName %11 "offset" -OpName %15 "count" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%8 = OpTypeInt 32 1 -%7 = OpTypeVector %8 3 -%6 = OpTypePointer Function %7 -%9 = OpConstantNull %7 -%13 = OpTypeInt 32 0 -%12 = OpTypePointer Function %13 -%14 = OpConstantNull %13 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpVariable %6 Function %9 -%10 = OpVariable %6 Function %9 -%11 = OpVariable %12 Function %14 -%15 = OpVariable %12 Function %14 -%17 = OpLoad %7 %5 -%18 = OpLoad %7 %10 -%19 = OpLoad %13 %11 -%20 = OpLoad %13 %15 -%16 = OpBitFieldInsert %7 %17 %18 %19 %20 -OpReturn -OpFunctionEnd -)"); -} - -TEST_F(BuiltinBuilderTest, Call_InsertBits_vec3_u32) { - auto* v = Var("v", ty.vec3()); - auto* n = Var("n", ty.vec3()); - auto* offset = Var("offset", ty.u32()); - auto* count = Var("count", ty.u32()); - auto* call = Call("insertBits", v, n, offset, count); - auto* func = WrapInFunction(v, n, offset, count, call); - - spirv::Builder& b = Build(); - - ASSERT_TRUE(b.GenerateFunction(func)) << b.error(); - - EXPECT_EQ(DumpBuilder(b), R"(OpEntryPoint GLCompute %3 "test_function" -OpExecutionMode %3 LocalSize 1 1 1 -OpName %3 "test_function" -OpName %5 "v" -OpName %10 "n" -OpName %11 "offset" -OpName %14 "count" -%2 = OpTypeVoid -%1 = OpTypeFunction %2 -%8 = OpTypeInt 32 0 -%7 = OpTypeVector %8 3 -%6 = OpTypePointer Function %7 -%9 = OpConstantNull %7 -%12 = OpTypePointer Function %8 -%13 = OpConstantNull %8 -%3 = OpFunction %2 None %1 -%4 = OpLabel -%5 = OpVariable %6 Function %9 -%10 = OpVariable %6 Function %9 -%11 = OpVariable %12 Function %13 -%14 = OpVariable %12 Function %13 -%16 = OpLoad %7 %5 -%17 = OpLoad %7 %10 -%18 = OpLoad %8 %11 -%19 = OpLoad %8 %14 -%15 = OpBitFieldInsert %7 %16 %17 %18 %19 -OpReturn -OpFunctionEnd -)"); -} +} // namespace DP4A_builtin_tests } // namespace } // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_builtin_texture_test.cc b/src/tint/writer/spirv/builder_builtin_texture_test.cc index e76e4787fb..b5fcc9c631 100644 --- a/src/tint/writer/spirv/builder_builtin_texture_test.cc +++ b/src/tint/writer/spirv/builder_builtin_texture_test.cc @@ -589,7 +589,7 @@ OpCapability ImageQuery %16 = OpConstant %4 2 %17 = OpConstantComposite %14 %15 %16 %18 = OpTypeInt 32 1 -%19 = OpConstant %18 0 +%19 = OpConstantNull %18 )", R"( %10 = OpLoad %7 %5 @@ -615,7 +615,7 @@ OpCapability ImageQuery %16 = OpConstant %4 2 %17 = OpConstantComposite %14 %15 %16 %18 = OpTypeInt 32 1 -%19 = OpConstant %18 0 +%19 = OpConstantNull %18 %20 = OpTypeVector %18 2 %21 = OpConstant %18 3 %22 = OpConstant %18 4 @@ -645,7 +645,7 @@ OpCapability ImageQuery %16 = OpConstant %4 2 %18 = OpTypeInt 32 1 %19 = OpConstant %18 3 -%21 = OpConstant %18 0 +%21 = OpConstantNull %18 )", R"( %10 = OpLoad %7 %5 @@ -673,7 +673,7 @@ OpCapability ImageQuery %16 = OpConstant %4 2 %18 = OpTypeInt 32 1 %19 = OpConstant %18 3 -%21 = OpConstant %18 0 +%21 = OpConstantNull %18 %22 = OpTypeVector %18 2 %23 = OpConstant %18 4 %24 = OpConstant %18 5 @@ -706,7 +706,7 @@ OpCapability ImageQuery %17 = OpConstant %4 3 %18 = OpConstantComposite %14 %15 %16 %17 %19 = OpTypeInt 32 1 -%20 = OpConstant %19 0 +%20 = OpConstantNull %19 )", R"( %10 = OpLoad %7 %5 @@ -732,7 +732,7 @@ OpCapability ImageQuery %16 = OpConstant %4 3 %18 = OpTypeInt 32 1 %19 = OpConstant %18 4 -%21 = OpConstant %18 0 +%21 = OpConstantNull %18 )", R"( %10 = OpLoad %7 %5 @@ -2683,7 +2683,7 @@ OpCapability SampledCubeArray %26 = OpConstantComposite %14 %23 %24 %25 %28 = OpTypeInt 32 1 %27 = OpTypeVector %28 3 -%29 = OpConstant %28 0 +%29 = OpConstantNull %28 %30 = OpConstant %28 1 %31 = OpConstant %28 2 %32 = OpConstantComposite %27 %29 %30 %31 @@ -3684,7 +3684,10 @@ TEST_P(BuiltinTextureTest, Call) { auto* call = Call(param.function, param.args(this)); auto* stmt = CallStmt(call); - Func("func", {}, ty.void_(), {stmt}, {Stage(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), utils::Vector{stmt}, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = Build(); @@ -3710,7 +3713,10 @@ TEST_P(BuiltinTextureTest, ValidateSPIRV) { auto* call = Call(param.function, param.args(this)); auto* stmt = CallStmt(call); - Func("main", {}, ty.void_(), {stmt}, {Stage(ast::PipelineStage::kFragment)}); + Func("main", utils::Empty, ty.void_(), utils::Vector{stmt}, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = Build(); @@ -3730,8 +3736,10 @@ TEST_P(BuiltinTextureTest, OutsideFunction_IsError) { auto* call = Call(param.function, param.args(this)); auto* stmt = CallStmt(call); - Func("func", {}, ty.void_(), {stmt}, - {create(ast::PipelineStage::kFragment)}); + Func("func", utils::Empty, ty.void_(), utils::Vector{stmt}, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = Build(); diff --git a/src/tint/writer/spirv/builder_call_test.cc b/src/tint/writer/spirv/builder_call_test.cc index 782b008fe1..a0631ea3c5 100644 --- a/src/tint/writer/spirv/builder_call_test.cc +++ b/src/tint/writer/spirv/builder_call_test.cc @@ -17,18 +17,22 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; TEST_F(BuilderTest, Expression_Call) { - ast::VariableList func_params; - func_params.push_back(Param("a", ty.f32())); - func_params.push_back(Param("b", ty.f32())); - - auto* a_func = Func("a_func", func_params, ty.f32(), {Return(Add("a", "b"))}); - auto* func = Func("main", {}, ty.void_(), {Assign(Phony(), Call("a_func", 1.f, 1.f))}); + auto* a_func = Func("a_func", + utils::Vector{ + Param("a", ty.f32()), + Param("b", ty.f32()), + }, + ty.f32(), utils::Vector{Return(Add("a", "b"))}); + auto* func = Func("main", utils::Empty, ty.void_(), + utils::Vector{Assign(Phony(), Call("a_func", 1_f, 1_f))}); spirv::Builder& b = Build(); @@ -60,13 +64,15 @@ OpFunctionEnd } TEST_F(BuilderTest, Statement_Call) { - ast::VariableList func_params; - func_params.push_back(Param("a", ty.f32())); - func_params.push_back(Param("b", ty.f32())); + auto* a_func = Func("a_func", + utils::Vector{ + Param("a", ty.f32()), + Param("b", ty.f32()), + }, + ty.f32(), utils::Vector{Return(Add("a", "b"))}); - auto* a_func = Func("a_func", func_params, ty.f32(), {Return(Add("a", "b"))}); - - auto* func = Func("main", {}, ty.void_(), {CallStmt(Call("a_func", 1.f, 1.f))}); + auto* func = + Func("main", utils::Empty, ty.void_(), utils::Vector{CallStmt(Call("a_func", 1_f, 1_f))}); spirv::Builder& b = Build(); diff --git a/src/tint/writer/spirv/builder_constructor_expression_test.cc b/src/tint/writer/spirv/builder_constructor_expression_test.cc index 41409aff95..9c9bd74da4 100644 --- a/src/tint/writer/spirv/builder_constructor_expression_test.cc +++ b/src/tint/writer/spirv/builder_constructor_expression_test.cc @@ -23,8 +23,8 @@ namespace { using SpvBuilderConstructorTest = TestHelper; TEST_F(SpvBuilderConstructorTest, Const) { - auto* c = Expr(42.2f); - auto* g = Global("g", ty.f32(), c, ast::StorageClass::kPrivate); + auto* c = Expr(42.2_f); + auto* g = GlobalVar("g", ty.f32(), c, ast::StorageClass::kPrivate); spirv::Builder& b = Build(); @@ -36,21 +36,8 @@ TEST_F(SpvBuilderConstructorTest, Const) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_WithCasts_OutsideFunction_IsError) { - auto* t = Construct(Construct(1_i)); - WrapInFunction(t); - - spirv::Builder& b = Build(); - - EXPECT_EQ(b.GenerateExpression(t), 0u); - EXPECT_TRUE(b.has_error()) << b.error(); - EXPECT_EQ(b.error(), - "Internal error: trying to add SPIR-V instruction 124 outside a " - "function"); -} - TEST_F(SpvBuilderConstructorTest, Type) { - auto* t = vec3(1.0f, 1.0f, 3.0f); + auto* t = vec3(1_f, 1_f, 3_f); WrapInFunction(t); spirv::Builder& b = Build(); @@ -74,19 +61,15 @@ TEST_F(SpvBuilderConstructorTest, Type_WithCasts) { b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(t), 7u); + EXPECT_EQ(b.GenerateExpression(t), 4u); ASSERT_FALSE(b.has_error()) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 2 -%4 = OpTypeInt 32 1 -%5 = OpConstant %4 1 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%3 = OpConvertSToF %2 %5 -%6 = OpConvertSToF %2 %5 -%7 = OpCompositeConstruct %1 %3 %6 +%3 = OpConstant %2 1 +%4 = OpConstantComposite %1 %3 %3 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_WithAlias) { @@ -94,27 +77,24 @@ TEST_F(SpvBuilderConstructorTest, Type_WithAlias) { // cast(2.3f) auto* alias = Alias("Int", ty.i32()); - auto* cast = Construct(ty.Of(alias), 2.3f); + auto* cast = Construct(ty.Of(alias), 2.3_f); WrapInFunction(cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 1u); + EXPECT_EQ(b.GenerateExpression(cast), 2u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1 -%3 = OpTypeFloat 32 -%4 = OpConstant %3 2.29999995 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%1 = OpConvertFToS %2 %4 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1 +%2 = OpConstant %1 2 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_IdentifierExpression_Param) { auto* var = Var("ident", ty.f32()); - auto* t = vec2(1.0f, "ident"); + auto* t = vec2(1_f, "ident"); WrapInFunction(var, t); spirv::Builder& b = Build(); @@ -142,26 +122,31 @@ TEST_F(SpvBuilderConstructorTest, Type_IdentifierExpression_Param) { } TEST_F(SpvBuilderConstructorTest, Vector_Bitcast_Params) { - auto* t = vec2(Construct(1_i), Construct(1_i)); - WrapInFunction(t); + auto* var = Var("v", vec3(1_f, 2_f, 3_f)); + auto* cast = Bitcast(ty.vec3(), var); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); + ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); + ASSERT_EQ(b.GenerateExpression(cast), 10u) << b.error(); - EXPECT_EQ(b.GenerateExpression(t), 7u); - ASSERT_FALSE(b.has_error()) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 0 -%1 = OpTypeVector %2 2 -%4 = OpTypeInt 32 1 -%5 = OpConstant %4 1 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 +%8 = OpTypePointer Function %1 +%9 = OpConstantNull %1 +%12 = OpTypeInt 32 0 +%11 = OpTypeVector %12 3 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%3 = OpBitcast %2 %5 -%6 = OpBitcast %2 %5 -%7 = OpCompositeConstruct %1 %3 %6 + R"(OpStore %7 %6 +%13 = OpLoad %1 %7 +%10 = OpBitcast %11 %13 )"); } @@ -173,11 +158,11 @@ TEST_F(SpvBuilderConstructorTest, Type_Bool_With_Bool) { b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 3u); + EXPECT_EQ(b.GenerateExpression(cast), 2u); ASSERT_FALSE(b.has_error()) << b.error(); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeBool -%3 = OpConstantTrue %2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeBool +%2 = OpConstantTrue %1 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } @@ -189,10 +174,10 @@ TEST_F(SpvBuilderConstructorTest, Type_I32_With_I32) { spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 3u); + EXPECT_EQ(b.GenerateExpression(cast), 2u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1 -%3 = OpConstant %2 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1 +%2 = OpConstant %1 2 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } @@ -204,25 +189,42 @@ TEST_F(SpvBuilderConstructorTest, Type_U32_With_U32) { spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 3u); + EXPECT_EQ(b.GenerateExpression(cast), 2u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 0 -%3 = OpConstant %2 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0 +%2 = OpConstant %1 2 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_F32_With_F32) { - auto* cast = Construct(2.0f); + auto* cast = Construct(2_f); WrapInFunction(cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 3u); + EXPECT_EQ(b.GenerateExpression(cast), 2u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%3 = OpConstant %2 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 2 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_F16_With_F16) { + Enable(ast::Extension::kF16); + + auto* cast = Construct(2_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 2u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1p+1 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } @@ -245,7 +247,7 @@ TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_Bool_Literal) { } TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_Bool_Var) { - auto* var = Var("v", nullptr, Expr(true)); + auto* var = Var("v", Expr(true)); auto* cast = vec2(var); WrapInFunction(var, cast); @@ -269,7 +271,7 @@ TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_Bool_Var) { } TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_Literal) { - auto* cast = vec2(2.0f); + auto* cast = vec2(2_f); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -285,16 +287,35 @@ TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_Literal) { EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } -TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_Var) { - auto* var = Var("v", nullptr, Expr(2.0f)); - auto* cast = vec2(var); +TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F16_Literal) { + Enable(ast::Extension::kF16); + + auto* cast = vec2(2_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_F32) { + auto* var = Decl(Var("x", ty.f32(), Expr(2_f))); + auto* cast = vec2("x", "x"); WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - ASSERT_TRUE(b.GenerateFunctionVariable(var)) << b.error(); - ASSERT_EQ(b.GenerateExpression(cast), 8u) << b.error(); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 9u); EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 %2 = OpConstant %1 2 @@ -302,31 +323,43 @@ TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_Var) { %5 = OpConstantNull %1 %6 = OpTypeVector %1 2 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %3 %2 + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 %7 = OpLoad %1 %3 -%8 = OpCompositeConstruct %6 %7 %7 +%8 = OpLoad %1 %3 +%9 = OpCompositeConstruct %6 %7 %8 )"); } -TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_F32) { - auto* cast = vec2(2.0f, 2.0f); - WrapInFunction(cast); +TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F16_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); + auto* cast = vec2("x", "x"); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 4u); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 9u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 2 -%3 = OpConstant %2 2 -%4 = OpConstantComposite %1 %3 %3 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1p+1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 2 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpLoad %1 %3 +%9 = OpCompositeConstruct %6 %7 %8 )"); } -TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_Vec2) { - auto* value = vec2(2.0f, 2.0f); - auto* cast = vec2(value); +TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F32_F32_Const) { + auto* cast = vec2(1_f, 2_f); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -334,109 +367,247 @@ TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_Vec2) { b.push_function(Function{}); EXPECT_EQ(b.GenerateExpression(cast), 5u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32 -%2 = OpTypeVector %3 2 -%4 = OpConstant %3 2 -%5 = OpConstantComposite %2 %4 %4 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstantComposite %1 %3 %4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec2_With_F16_F16_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec2(1_h, 2_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 5u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstantComposite %1 %3 %4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec2_F32_With_Vec2) { + auto* var = Decl(Var("x", ty.vec2(), vec2(1_f, 2_f))); + auto* cast = vec2("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 10u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec2_F16_With_Vec2) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); + auto* cast = vec2("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 10u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec2_F32_With_Vec2_Const) { + auto* cast = vec2(vec2(1_f, 2_f)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 5u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstantComposite %1 %3 %4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec2_F16_With_Vec2_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec2(vec2(1_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 5u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstantComposite %1 %3 %4 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32) { - auto* cast = vec3(2.0f); + auto* var = Decl(Var("x", ty.f32(), Expr(2_f))); + auto* cast = vec3("x", "x", "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 10u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpLoad %1 %3 +%9 = OpLoad %1 %3 +%10 = OpCompositeConstruct %6 %7 %8 %9 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); + auto* cast = vec3("x", "x", "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 10u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1p+1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpLoad %1 %3 +%9 = OpLoad %1 %3 +%10 = OpCompositeConstruct %6 %7 %8 %9 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_Const) { + auto* cast = vec3(1_f, 2_f, 3_f); WrapInFunction(cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 4u); + EXPECT_EQ(b.GenerateExpression(cast), 6u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 3 -%3 = OpConstant %2 2 -%4 = OpConstantComposite %1 %3 %3 %3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(1_h, 2_h, 3_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstantComposite %1 %3 %4 %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Bool) { - auto* cast = vec3(true); - WrapInFunction(cast); + auto* var = Decl(Var("x", ty.bool_(), Expr(true))); + auto* cast = vec3("x", "x", "x"); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 4u); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 10u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeBool -%1 = OpTypeVector %2 3 -%3 = OpConstantTrue %2 -%4 = OpConstantComposite %1 %3 %3 %3 -)"); -} - -TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_F32_F32) { - auto* cast = vec3(2.0f, 2.0f, 2.0f); - WrapInFunction(cast); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 4u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 3 -%3 = OpConstant %2 2 -%4 = OpConstantComposite %1 %3 %3 %3 -)"); -} - -TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_Vec2) { - auto* cast = vec3(2.0f, vec2(2.0f, 2.0f)); - WrapInFunction(cast); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 8u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 3 -%3 = OpConstant %2 2 -%4 = OpTypeVector %2 2 -%5 = OpConstantComposite %4 %3 %3 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeBool +%2 = OpConstantTrue %1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 3 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpCompositeExtract %2 %5 0 -%7 = OpCompositeExtract %2 %5 1 -%8 = OpCompositeConstruct %1 %3 %6 %7 + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpLoad %1 %3 +%9 = OpLoad %1 %3 +%10 = OpCompositeConstruct %6 %7 %8 %9 )"); } -TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec2_F32) { - auto* cast = vec3(vec2(2.0f, 2.0f), 2.0f); - WrapInFunction(cast); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 8u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 3 -%3 = OpTypeVector %2 2 -%4 = OpConstant %2 2 -%5 = OpConstantComposite %3 %4 %4 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpCompositeExtract %2 %5 0 -%7 = OpCompositeExtract %2 %5 1 -%8 = OpCompositeConstruct %1 %6 %7 %4 -)"); -} - -TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec3) { - auto* value = vec3(2.0f, 2.0f, 2.0f); - auto* cast = vec3(value); +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Bool_Const) { + auto* cast = vec3(true, false, true); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -444,15 +615,432 @@ TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec3) { b.push_function(Function{}); EXPECT_EQ(b.GenerateExpression(cast), 5u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32 -%2 = OpTypeVector %3 3 -%4 = OpConstant %3 2 -%5 = OpConstantComposite %2 %4 %4 %4 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeBool +%1 = OpTypeVector %2 3 +%3 = OpConstantTrue %2 +%4 = OpConstantNull %2 +%5 = OpConstantComposite %1 %3 %4 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_F32_F32) { + auto* var = Decl(Var("x", ty.f32(), Expr(2_f))); + auto* cast = vec3("x", "x", "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 10u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpLoad %1 %3 +%9 = OpLoad %1 %3 +%10 = OpCompositeConstruct %6 %7 %8 %9 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_F16_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); + auto* cast = vec3("x", "x", "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 10u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1p+1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpLoad %1 %3 +%9 = OpLoad %1 %3 +%10 = OpCompositeConstruct %6 %7 %8 %9 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_F32_F32_Const) { + auto* cast = vec3(1_f, 2_f, 3_f); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_F16_F16_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(1_h, 2_h, 3_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstantComposite %1 %3 %4 %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_Vec2) { + auto* var = Decl(Var("x", ty.vec2(), vec2(2_f, 3_f))); + auto* cast = vec3(1_f, "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 14u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 2 +%4 = OpConstant %2 3 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 3 +%10 = OpConstant %2 1 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%11 = OpLoad %1 %6 +%12 = OpCompositeExtract %2 %11 0 +%13 = OpCompositeExtract %2 %11 1 +%14 = OpCompositeConstruct %9 %10 %12 %13 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_Vec2) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec2(), vec2(2_h, 3_h))); + auto* cast = vec3(1_h, "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 14u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstant %2 0x1.8p+1 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 3 +%10 = OpConstant %2 0x1p+0 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%11 = OpLoad %1 %6 +%12 = OpCompositeExtract %2 %11 0 +%13 = OpCompositeExtract %2 %11 1 +%14 = OpCompositeConstruct %9 %10 %12 %13 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F32_Vec2_Const) { + auto* cast = vec3(1_f, vec2(2_f, 3_f)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_F16_Vec2_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(1_h, vec2(2_h, 3_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstantComposite %1 %3 %4 %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec2_F32) { + auto* var = Decl(Var("x", ty.vec2(), vec2(1_f, 2_f))); + auto* cast = vec3("x", 3_f); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 14u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 3 +%13 = OpConstant %2 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +%11 = OpCompositeExtract %2 %10 0 +%12 = OpCompositeExtract %2 %10 1 +%14 = OpCompositeConstruct %9 %11 %12 %13 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec2_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); + auto* cast = vec3("x", 3_h); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 14u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 3 +%13 = OpConstant %2 0x1.8p+1 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +%11 = OpCompositeExtract %2 %10 0 +%12 = OpCompositeExtract %2 %10 1 +%14 = OpCompositeConstruct %9 %11 %12 %13 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec2_F32_Const) { + auto* cast = vec3(vec2(1_f, 2_f), 3_f); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_With_Vec2_F16_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(vec2(1_h, 2_h), 3_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstantComposite %1 %3 %4 %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_F32_With_Vec3) { + auto* var = Decl(Var("x", ty.vec3(), vec3(1_f, 2_f, 3_f))); + auto* cast = vec3("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 11u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 +%8 = OpTypePointer Function %1 +%9 = OpConstantNull %1 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %7 %6 +%11 = OpLoad %1 %7 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_F16_With_Vec3) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec3(), vec3(1_h, 2_h, 3_h))); + auto* cast = vec3("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 11u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstantComposite %1 %3 %4 %5 +%8 = OpTypePointer Function %1 +%9 = OpConstantNull %1 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %7 %6 +%11 = OpLoad %1 %7 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_F32_With_Vec3_Const) { + auto* cast = vec3(vec3(1_f, 2_f, 3_f)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec3_F16_With_Vec3_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(vec3(1_h, 2_h, 3_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstantComposite %1 %3 %4 %5 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Bool) { + auto* var = Decl(Var("x", ty.bool_(), Expr(true))); + auto* cast = vec4("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 8u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeBool +%2 = OpConstantTrue %1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpCompositeConstruct %6 %7 %7 %7 %7 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Bool_Const) { auto* cast = vec4(true); WrapInFunction(cast); @@ -466,10 +1054,61 @@ TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Bool) { %3 = OpConstantTrue %2 %4 = OpConstantComposite %1 %3 %3 %3 %3 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32) { - auto* cast = vec4(2.0f); + auto* var = Decl(Var("x", ty.f32(), Expr(2_f))); + auto* cast = vec4("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 8u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpCompositeConstruct %6 %7 %7 %7 %7 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); + auto* cast = vec4("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 8u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1p+1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpCompositeConstruct %6 %7 %7 %7 %7 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Const) { + auto* cast = vec4(2_f); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -482,163 +1121,508 @@ TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32) { %3 = OpConstant %2 2 %4 = OpConstantComposite %1 %3 %3 %3 %3 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(2_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_F32_F32_F32) { - auto* cast = vec4(2.0f, 2.0f, 2.0f, 2.0f); + auto* var = Decl(Var("x", ty.f32(), Expr(2_f))); + auto* cast = vec4("x", "x", "x", "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 11u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpLoad %1 %3 +%9 = OpLoad %1 %3 +%10 = OpLoad %1 %3 +%11 = OpCompositeConstruct %6 %7 %8 %9 %10 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_F16_F16_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); + auto* cast = vec4("x", "x", "x", "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 11u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1p+1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%6 = OpTypeVector %1 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%7 = OpLoad %1 %3 +%8 = OpLoad %1 %3 +%9 = OpLoad %1 %3 +%10 = OpLoad %1 %3 +%11 = OpCompositeConstruct %6 %7 %8 %9 %10 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_F32_F32_F32_Const) { + auto* cast = vec4(1_f, 2_f, 3_f, 4_f); WrapInFunction(cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 4u); + EXPECT_EQ(b.GenerateExpression(cast), 7u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 4 -%3 = OpConstant %2 2 -%4 = OpConstantComposite %1 %3 %3 %3 %3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstant %2 4 +%7 = OpConstantComposite %1 %3 %4 %5 %6 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_F16_F16_F16_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(1_h, 2_h, 3_h, 4_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 7u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstant %2 0x1p+2 +%7 = OpConstantComposite %1 %3 %4 %5 %6 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_F32_Vec2) { - auto* cast = vec4(2.0f, 2.0f, vec2(2.0f, 2.0f)); + auto* var = Decl(Var("x", ty.vec2(), vec2(1_f, 2_f))); + auto* cast = vec4(1_f, 2_f, "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 13u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +%11 = OpCompositeExtract %2 %10 0 +%12 = OpCompositeExtract %2 %10 1 +%13 = OpCompositeConstruct %9 %3 %4 %11 %12 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_F16_Vec2) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); + auto* cast = vec4(1_h, 2_h, "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 13u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +%11 = OpCompositeExtract %2 %10 0 +%12 = OpCompositeExtract %2 %10 1 +%13 = OpCompositeConstruct %9 %3 %4 %11 %12 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_F32_Vec2_Const) { + auto* cast = vec4(1_f, 2_f, vec2(3_f, 4_f)); WrapInFunction(cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 8u); + EXPECT_EQ(b.GenerateExpression(cast), 7u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 4 -%3 = OpConstant %2 2 -%4 = OpTypeVector %2 2 -%5 = OpConstantComposite %4 %3 %3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstant %2 4 +%7 = OpConstantComposite %1 %3 %4 %5 %6 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpCompositeExtract %2 %5 0 -%7 = OpCompositeExtract %2 %5 1 -%8 = OpCompositeConstruct %1 %3 %3 %6 %7 + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_F16_Vec2_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(1_h, 2_h, vec2(3_h, 4_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 7u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstant %2 0x1p+2 +%7 = OpConstantComposite %1 %3 %4 %5 %6 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Vec2_F32) { - auto* cast = vec4(2.0f, vec2(2.0f, 2.0f), 2.0f); + auto* var = Decl(Var("x", ty.vec2(), vec2(2_f, 3_f))); + auto* cast = vec4(1_f, "x", 4_f); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 15u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 2 +%4 = OpConstant %2 3 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 4 +%10 = OpConstant %2 1 +%14 = OpConstant %2 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%11 = OpLoad %1 %6 +%12 = OpCompositeExtract %2 %11 0 +%13 = OpCompositeExtract %2 %11 1 +%15 = OpCompositeConstruct %9 %10 %12 %13 %14 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Vec2_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec2(), vec2(2_h, 3_h))); + auto* cast = vec4(1_h, "x", 4_h); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 15u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstant %2 0x1.8p+1 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 4 +%10 = OpConstant %2 0x1p+0 +%14 = OpConstant %2 0x1p+2 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%11 = OpLoad %1 %6 +%12 = OpCompositeExtract %2 %11 0 +%13 = OpCompositeExtract %2 %11 1 +%15 = OpCompositeConstruct %9 %10 %12 %13 %14 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Vec2_F32_Const) { + auto* cast = vec4(1_f, vec2(2_f, 3_f), 4_f); WrapInFunction(cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 8u); + EXPECT_EQ(b.GenerateExpression(cast), 7u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 4 -%3 = OpConstant %2 2 -%4 = OpTypeVector %2 2 -%5 = OpConstantComposite %4 %3 %3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstant %2 4 +%7 = OpConstantComposite %1 %3 %4 %5 %6 )"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpCompositeExtract %2 %5 0 -%7 = OpCompositeExtract %2 %5 1 -%8 = OpCompositeConstruct %1 %3 %6 %7 %3 + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Vec2_F16_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(1_h, vec2(2_h, 3_h), 4_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 7u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstant %2 0x1p+2 +%7 = OpConstantComposite %1 %3 %4 %5 %6 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec2_F32_F32) { - auto* cast = vec4(vec2(2.0f, 2.0f), 2.0f, 2.0f); - WrapInFunction(cast); + auto* var = Decl(Var("x", ty.vec2(), vec2(1_f, 2_f))); + auto* cast = vec4("x", 3_f, 4_f); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 8u); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 15u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 4 -%3 = OpTypeVector %2 2 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 1 %4 = OpConstant %2 2 -%5 = OpConstantComposite %3 %4 %4 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 4 +%13 = OpConstant %2 3 +%14 = OpConstant %2 4 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpCompositeExtract %2 %5 0 -%7 = OpCompositeExtract %2 %5 1 -%8 = OpCompositeConstruct %1 %6 %7 %4 %4 + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +%11 = OpCompositeExtract %2 %10 0 +%12 = OpCompositeExtract %2 %10 1 +%15 = OpCompositeConstruct %9 %11 %12 %13 %14 )"); } -TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec2_Vec2) { - auto* cast = vec4(vec2(2.0f, 2.0f), vec2(2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec2_F16_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); + auto* cast = vec4("x", 3_h, 4_h); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 15u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 4 +%13 = OpConstant %2 0x1.8p+1 +%14 = OpConstant %2 0x1p+2 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +%11 = OpCompositeExtract %2 %10 0 +%12 = OpCompositeExtract %2 %10 1 +%15 = OpCompositeConstruct %9 %11 %12 %13 %14 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec2_F32_F32_Const) { + auto* cast = vec4(vec2(1_f, 2_f), 3_f, 4_f); WrapInFunction(cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 10u); + EXPECT_EQ(b.GenerateExpression(cast), 7u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 4 -%3 = OpTypeVector %2 2 +%3 = OpConstant %2 1 %4 = OpConstant %2 2 -%5 = OpConstantComposite %3 %4 %4 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpCompositeExtract %2 %5 0 -%7 = OpCompositeExtract %2 %5 1 -%8 = OpCompositeExtract %2 %5 0 -%9 = OpCompositeExtract %2 %5 1 -%10 = OpCompositeConstruct %1 %6 %7 %8 %9 +%5 = OpConstant %2 3 +%6 = OpConstant %2 4 +%7 = OpConstantComposite %1 %3 %4 %5 %6 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } -TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Vec3) { - auto* cast = vec4(2.0f, vec3(2.0f, 2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec2_F16_F16_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec2(1_h, 2_h), 3_h, 4_h); WrapInFunction(cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 9u); + EXPECT_EQ(b.GenerateExpression(cast), 7u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 %1 = OpTypeVector %2 4 -%3 = OpConstant %2 2 -%4 = OpTypeVector %2 3 -%5 = OpConstantComposite %4 %3 %3 %3 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpCompositeExtract %2 %5 0 -%7 = OpCompositeExtract %2 %5 1 -%8 = OpCompositeExtract %2 %5 2 -%9 = OpCompositeConstruct %1 %3 %6 %7 %8 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstant %2 0x1p+2 +%7 = OpConstantComposite %1 %3 %4 %5 %6 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } -TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec3_F32) { - auto* cast = vec4(vec3(2.0f, 2.0f, 2.0f), 2.0f); - WrapInFunction(cast); +TEST_F(SpvBuilderConstructorTest, Type_Vec4_F32_With_Vec2_Vec2) { + auto* var = Decl(Var("x", ty.vec2(), vec2(1_f, 2_f))); + auto* cast = vec4("x", "x"); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 9u); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 16u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 4 -%3 = OpTypeVector %2 3 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 1 %4 = OpConstant %2 2 -%5 = OpConstantComposite %3 %4 %4 %4 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 4 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%6 = OpCompositeExtract %2 %5 0 -%7 = OpCompositeExtract %2 %5 1 -%8 = OpCompositeExtract %2 %5 2 -%9 = OpCompositeConstruct %1 %6 %7 %8 %4 + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +%11 = OpCompositeExtract %2 %10 0 +%12 = OpCompositeExtract %2 %10 1 +%13 = OpLoad %1 %6 +%14 = OpCompositeExtract %2 %13 0 +%15 = OpCompositeExtract %2 %13 1 +%16 = OpCompositeConstruct %9 %11 %12 %14 %15 )"); } -TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec4) { - auto* value = vec4(2.0f, 2.0f, 2.0f, 2.0f); - auto* cast = vec4(value); +TEST_F(SpvBuilderConstructorTest, Type_Vec4_F16_With_Vec2_Vec2) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); + auto* cast = vec4("x", "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 16u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstantComposite %1 %3 %4 +%7 = OpTypePointer Function %1 +%8 = OpConstantNull %1 +%9 = OpTypeVector %2 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %6 %5 +%10 = OpLoad %1 %6 +%11 = OpCompositeExtract %2 %10 0 +%12 = OpCompositeExtract %2 %10 1 +%13 = OpLoad %1 %6 +%14 = OpCompositeExtract %2 %13 0 +%15 = OpCompositeExtract %2 %13 1 +%16 = OpCompositeConstruct %9 %11 %12 %14 %15 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_F32_With_Vec2_Vec2_Const) { + auto* cast = vec4(vec2(1_f, 2_f), vec2(1_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -646,47 +1630,476 @@ TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec4) { b.push_function(Function{}); EXPECT_EQ(b.GenerateExpression(cast), 5u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 32 -%2 = OpTypeVector %3 4 -%4 = OpConstant %3 2 -%5 = OpConstantComposite %2 %4 %4 %4 %4 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstantComposite %1 %3 %4 %3 %4 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_F32_With_F32) { - auto* ctor = Construct(2.0f); +TEST_F(SpvBuilderConstructorTest, Type_Vec4_F16_With_Vec2_Vec2_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec2(1_h, 2_h), vec2(1_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 5u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstantComposite %1 %3 %4 %3 %4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Vec3) { + auto* var = Decl(Var("x", ty.vec3(), vec3(2_f, 2_f, 2_f))); + auto* cast = vec4(2_f, "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 13u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 2 +%4 = OpConstantComposite %1 %3 %3 %3 +%6 = OpTypePointer Function %1 +%7 = OpConstantNull %1 +%8 = OpTypeVector %2 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %5 %4 +%9 = OpLoad %1 %5 +%10 = OpCompositeExtract %2 %9 0 +%11 = OpCompositeExtract %2 %9 1 +%12 = OpCompositeExtract %2 %9 2 +%13 = OpCompositeConstruct %8 %3 %10 %11 %12 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Vec3) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec3(), vec3(2_h, 2_h, 2_h))); + auto* cast = vec4(2_h, "x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 13u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 +%6 = OpTypePointer Function %1 +%7 = OpConstantNull %1 +%8 = OpTypeVector %2 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %5 %4 +%9 = OpLoad %1 %5 +%10 = OpCompositeExtract %2 %9 0 +%11 = OpCompositeExtract %2 %9 1 +%12 = OpCompositeExtract %2 %9 2 +%13 = OpCompositeConstruct %8 %3 %10 %11 %12 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F32_Vec3_Const) { + auto* cast = vec4(2_f, vec3(2_f, 2_f, 2_f)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 2 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_F16_Vec3_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(2_h, vec3(2_h, 2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec3_F32) { + auto* var = Decl(Var("x", ty.vec3(), vec3(2_f, 2_f, 2_f))); + auto* cast = vec4("x", 2_f); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 13u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 2 +%4 = OpConstantComposite %1 %3 %3 %3 +%6 = OpTypePointer Function %1 +%7 = OpConstantNull %1 +%8 = OpTypeVector %2 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %5 %4 +%9 = OpLoad %1 %5 +%10 = OpCompositeExtract %2 %9 0 +%11 = OpCompositeExtract %2 %9 1 +%12 = OpCompositeExtract %2 %9 2 +%13 = OpCompositeConstruct %8 %10 %11 %12 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec3_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.vec3(), vec3(2_h, 2_h, 2_h))); + auto* cast = vec4("x", 2_h); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)); + EXPECT_EQ(b.GenerateExpression(cast), 13u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 +%6 = OpTypePointer Function %1 +%7 = OpConstantNull %1 +%8 = OpTypeVector %2 4 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %5 %4 +%9 = OpLoad %1 %5 +%10 = OpCompositeExtract %2 %9 0 +%11 = OpCompositeExtract %2 %9 1 +%12 = OpCompositeExtract %2 %9 2 +%13 = OpCompositeConstruct %8 %10 %11 %12 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec3_F32_Const) { + auto* cast = vec4(vec3(2_f, 2_f, 2_f), 2_f); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 2 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_With_Vec3_F16_Const) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec3(2_h, 2_h, 2_h), 2_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_F32_With_Vec4) { + auto* value = vec4(2_f, 2_f, 2_f, 2_f); + auto* cast = vec4(value); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 2 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Vec4_F16_With_Vec4) { + Enable(ast::Extension::kF16); + + auto* value = vec4(2_h, 2_h, 2_h, 2_h); + auto* cast = vec4(value); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"()"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_F32_With_F32) { + auto* ctor = Construct(2_f); GlobalConst("g", ty.f32(), ctor); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 32 +%6 = OpConstant %5 2 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %7 %6 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_F16_With_F16) { + Enable(ast::Extension::kF16); + + auto* ctor = Construct(2_h); + GlobalConst("g", ty.f16(), ctor); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeFloat 16 +%6 = OpConstant %5 0x1p+1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %7 %6 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_F32_With_F32) { + auto* ctor = Construct(2_f); + GlobalVar("g", ty.f32(), ast::StorageClass::kPrivate, ctor); spirv::Builder& b = SanitizeAndBuild(); ASSERT_TRUE(b.Build()); EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 %2 = OpConstant %1 2 -%4 = OpTypeVoid -%3 = OpTypeFunction %4 +%4 = OpTypePointer Private %1 +%3 = OpVariable %4 Private %2 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 )"); Validate(b); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_U32_With_F32) { - auto* ctor = Construct(1.5f); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_F16_With_F16) { + Enable(ast::Extension::kF16); + + auto* ctor = Construct(2_h); + GlobalVar("g", ty.f16(), ast::StorageClass::kPrivate, ctor); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1p+1 +%4 = OpTypePointer Private %1 +%3 = OpVariable %4 Private %2 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_U32_With_F32) { + auto* ctor = Construct(1.5_f); GlobalConst("g", ty.u32(), ctor); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeInt 32 0 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %7 %6 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_U32_With_F16) { + Enable(ast::Extension::kF16); + + auto* ctor = Construct(1.5_h); + GlobalConst("g", ty.u32(), ctor); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%5 = OpTypeInt 32 0 +%6 = OpConstant %5 1 +%8 = OpTypePointer Function %5 +%9 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %7 %6 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_U32_With_F32) { + auto* ctor = Construct(1.5_f); + GlobalVar("g", ty.u32(), ast::StorageClass::kPrivate, ctor); spirv::Builder& b = SanitizeAndBuild(); ASSERT_TRUE(b.Build()); EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0 %2 = OpConstant %1 1 -%4 = OpTypeVoid -%3 = OpTypeFunction %4 +%4 = OpTypePointer Private %1 +%3 = OpVariable %4 Private %2 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 )"); Validate(b); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec2_With_F32) { - auto* cast = vec2(2.0f); - auto* g = Global("g", ty.vec2(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_U32_With_F16) { + Enable(ast::Extension::kF16); + + auto* ctor = Construct(1.5_h); + GlobalVar("g", ty.u32(), ast::StorageClass::kPrivate, ctor); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0 +%2 = OpConstant %1 1 +%4 = OpTypePointer Private %1 +%3 = OpVariable %4 Private %2 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec2_With_F32) { + auto* cast = vec2(2_f); + GlobalConst("g", ty.vec2(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec2_With_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec2(2_h); + GlobalConst("g", ty.vec2(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec2_With_F32) { + auto* cast = vec2(2_f); + auto* g = GlobalVar("g", ty.vec2(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); @@ -700,9 +2113,75 @@ TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec2_With_F32) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec2_With_Vec2) { - auto* cast = vec2(vec2(2.0f, 2.0f)); - GlobalConst("a", ty.vec2(), cast); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec2_With_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec2(2_h); + auto* g = GlobalVar("g", ty.vec2(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec2_F32_With_Vec2) { + auto* cast = vec2(vec2(2_f, 2_f)); + GlobalConst("g", ty.vec2(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec2_F16_With_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = vec2(vec2(2_h, 2_h)); + GlobalConst("g", ty.vec2(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 2 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec2_F32_With_Vec2) { + auto* cast = vec2(vec2(2_f, 2_f)); + GlobalVar("a", ty.vec2(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = SanitizeAndBuild(); ASSERT_TRUE(b.Build()); @@ -711,16 +2190,88 @@ TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec2_With_Vec2) { %1 = OpTypeVector %2 2 %3 = OpConstant %2 2 %4 = OpConstantComposite %1 %3 %3 -%6 = OpTypeVoid -%5 = OpTypeFunction %6 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 )"); Validate(b); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec3_With_Vec3) { - auto* cast = vec3(vec3(2.0f, 2.0f, 2.0f)); - GlobalConst("a", ty.vec3(), cast); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec2_F16_With_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = vec2(vec2(2_h, 2_h)); + GlobalVar("a", ty.vec2(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 2 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +)"); + + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_F32_With_Vec3) { + auto* cast = vec3(vec3(2_f, 2_f, 2_f)); + GlobalConst("g", ty.vec3(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_F16_With_Vec3) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(vec3(2_h, 2_h, 2_h)); + GlobalConst("g", ty.vec3(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_F32_With_Vec3) { + auto* cast = vec3(vec3(2_f, 2_f, 2_f)); + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = SanitizeAndBuild(); ASSERT_TRUE(b.Build()); @@ -729,16 +2280,88 @@ TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec3_With_Vec3) { %1 = OpTypeVector %2 3 %3 = OpConstant %2 2 %4 = OpConstantComposite %1 %3 %3 %3 -%6 = OpTypeVoid -%5 = OpTypeFunction %6 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 )"); Validate(b); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_Vec4) { - auto* cast = vec4(vec4(2.0f, 2.0f, 2.0f, 2.0f)); - GlobalConst("a", ty.vec4(), cast); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_F16_With_Vec3) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(vec3(2_h, 2_h, 2_h)); + GlobalVar("a", ty.vec3(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +)"); + + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_F32_With_Vec4) { + auto* cast = vec4(vec4(2_f, 2_f, 2_f, 2_f)); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_F16_With_Vec4) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec4(2_h, 2_h, 2_h, 2_h)); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_F32_With_Vec4) { + auto* cast = vec4(vec4(2_f, 2_f, 2_f, 2_f)); + GlobalVar("a", ty.vec4(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = SanitizeAndBuild(); ASSERT_TRUE(b.Build()); @@ -747,16 +2370,88 @@ TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_Vec4) { %1 = OpTypeVector %2 4 %3 = OpConstant %2 2 %4 = OpConstantComposite %1 %3 %3 %3 %3 -%6 = OpTypeVoid -%5 = OpTypeFunction %6 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 )"); Validate(b); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec3_With_F32) { - auto* cast = vec3(2.0f); - auto* g = Global("g", ty.vec3(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_F16_With_Vec4) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec4(2_h, 2_h, 2_h, 2_h)); + GlobalVar("a", ty.vec4(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +%6 = OpTypePointer Private %1 +%5 = OpVariable %6 Private %4 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +)"); + + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_F32) { + auto* cast = vec3(2_f); + GlobalConst("g", ty.vec3(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(2_h); + GlobalConst("g", ty.vec3(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_F32) { + auto* cast = vec3(2_f); + auto* g = GlobalVar("g", ty.vec3(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); @@ -770,55 +2465,239 @@ TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec3_With_F32) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec3_With_F32_Vec2) { - auto* cast = vec3(2.0f, vec2(2.0f, 2.0f)); - auto* g = Global("g", ty.vec3(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(2_h); + auto* g = GlobalVar("g", ty.vec3(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 11u); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_F32_Vec2) { + auto* cast = vec3(2_f, vec2(2_f, 2_f)); + GlobalConst("g", ty.vec3(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_F16_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(2_h, vec2(2_h, 2_h)); + GlobalConst("g", ty.vec3(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_F32_Vec2) { + auto* cast = vec3(2_f, vec2(2_f, 2_f)); + auto* g = GlobalVar("g", ty.vec3(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 3 %3 = OpConstant %2 2 -%4 = OpTypeVector %2 2 -%5 = OpConstantComposite %4 %3 %3 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%6 = OpSpecConstantOp %2 CompositeExtract %5 8 -%10 = OpConstant %7 1 -%9 = OpSpecConstantOp %2 CompositeExtract %5 10 -%11 = OpSpecConstantComposite %1 %3 %6 %9 +%4 = OpConstantComposite %1 %3 %3 %3 )"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec3_With_Vec2_F32) { - auto* cast = vec3(vec2(2.0f, 2.0f), 2.0f); - auto* g = Global("g", ty.vec3(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_F16_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(2_h, vec2(2_h, 2_h)); + auto* g = GlobalVar("g", ty.vec3(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 11u); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 %1 = OpTypeVector %2 3 -%3 = OpTypeVector %2 2 -%4 = OpConstant %2 2 -%5 = OpConstantComposite %3 %4 %4 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%6 = OpSpecConstantOp %2 CompositeExtract %5 8 -%10 = OpConstant %7 1 -%9 = OpSpecConstantOp %2 CompositeExtract %5 10 -%11 = OpSpecConstantComposite %1 %6 %9 %4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 )"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_F32) { - auto* cast = vec4(2.0f); - auto* g = Global("g", ty.vec4(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_Vec2_F32) { + auto* cast = vec3(vec2(2_f, 2_f), 2_f); + GlobalConst("g", ty.vec3(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec3_With_Vec2_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(vec2(2_h, 2_h), 2_h); + GlobalConst("g", ty.vec3(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 3 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_Vec2_F32) { + auto* cast = vec3(vec2(2_f, 2_f), 2_f); + auto* g = GlobalVar("g", ty.vec3(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 2 +%4 = OpConstantComposite %1 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec3_With_Vec2_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(vec2(2_h, 2_h), 2_h); + auto* g = GlobalVar("g", ty.vec3(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F32) { + auto* cast = vec4(2_f); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(2_h); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F32) { + auto* cast = vec4(2_f); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); @@ -832,152 +2711,493 @@ TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_F32) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_F32_F32_Vec2) { - auto* cast = vec4(2.0f, 2.0f, vec2(2.0f, 2.0f)); - auto* g = Global("g", ty.vec4(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(2_h); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 11u); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F32_F32_Vec2) { + auto* cast = vec4(2_f, 2_f, vec2(2_f, 2_f)); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F16_F16_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(2_h, 2_h, vec2(2_h, 2_h)); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F32_F32_Vec2) { + auto* cast = vec4(2_f, 2_f, vec2(2_f, 2_f)); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 4 %3 = OpConstant %2 2 -%4 = OpTypeVector %2 2 -%5 = OpConstantComposite %4 %3 %3 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%6 = OpSpecConstantOp %2 CompositeExtract %5 8 -%10 = OpConstant %7 1 -%9 = OpSpecConstantOp %2 CompositeExtract %5 10 -%11 = OpSpecConstantComposite %1 %3 %3 %6 %9 +%4 = OpConstantComposite %1 %3 %3 %3 %3 )"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_F32_Vec2_F32) { - auto* cast = vec4(2.0f, vec2(2.0f, 2.0f), 2.0f); - auto* g = Global("g", ty.vec4(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F16_F16_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(2_h, 2_h, vec2(2_h, 2_h)); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 11u); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F32_Vec2_F32) { + auto* cast = vec4(2_f, vec2(2_f, 2_f), 2_f); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F16_Vec2_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(2_h, vec2(2_h, 2_h), 2_h); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F32_Vec2_F32) { + auto* cast = vec4(2_f, vec2(2_f, 2_f), 2_f); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 4 %3 = OpConstant %2 2 -%4 = OpTypeVector %2 2 -%5 = OpConstantComposite %4 %3 %3 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%6 = OpSpecConstantOp %2 CompositeExtract %5 8 -%10 = OpConstant %7 1 -%9 = OpSpecConstantOp %2 CompositeExtract %5 10 -%11 = OpSpecConstantComposite %1 %3 %6 %9 %3 +%4 = OpConstantComposite %1 %3 %3 %3 %3 )"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_Vec2_F32_F32) { - auto* cast = vec4(vec2(2.0f, 2.0f), 2.0f, 2.0f); - auto* g = Global("g", ty.vec4(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F16_Vec2_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(2_h, vec2(2_h, 2_h), 2_h); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 11u); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 %1 = OpTypeVector %2 4 -%3 = OpTypeVector %2 2 -%4 = OpConstant %2 2 -%5 = OpConstantComposite %3 %4 %4 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%6 = OpSpecConstantOp %2 CompositeExtract %5 8 -%10 = OpConstant %7 1 -%9 = OpSpecConstantOp %2 CompositeExtract %5 10 -%11 = OpSpecConstantComposite %1 %6 %9 %4 %4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 )"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_Vec2_Vec2) { - auto* cast = vec4(vec2(2.0f, 2.0f), vec2(2.0f, 2.0f)); - auto* g = Global("g", ty.vec4(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_Vec2_F32_F32) { + auto* cast = vec4(vec2(2_f, 2_f), 2_f, 2_f); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_Vec2_F16_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec2(2_h, 2_h), 2_h, 2_h); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_Vec2_F32_F32) { + auto* cast = vec4(vec2(2_f, 2_f), 2_f, 2_f); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 13u); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 4 -%3 = OpTypeVector %2 2 -%4 = OpConstant %2 2 -%5 = OpConstantComposite %3 %4 %4 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%6 = OpSpecConstantOp %2 CompositeExtract %5 8 -%10 = OpConstant %7 1 -%9 = OpSpecConstantOp %2 CompositeExtract %5 10 -%11 = OpSpecConstantOp %2 CompositeExtract %5 8 -%12 = OpSpecConstantOp %2 CompositeExtract %5 10 -%13 = OpSpecConstantComposite %1 %6 %9 %11 %12 -)"); -} - -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_F32_Vec3) { - auto* cast = vec4(2.0f, vec3(2.0f, 2.0f, 2.0f)); - auto* g = Global("g", ty.vec4(), cast, ast::StorageClass::kPrivate); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 13u); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 4 %3 = OpConstant %2 2 -%4 = OpTypeVector %2 3 -%5 = OpConstantComposite %4 %3 %3 %3 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%6 = OpSpecConstantOp %2 CompositeExtract %5 8 -%10 = OpConstant %7 1 -%9 = OpSpecConstantOp %2 CompositeExtract %5 10 -%12 = OpConstant %7 2 -%11 = OpSpecConstantOp %2 CompositeExtract %5 12 -%13 = OpSpecConstantComposite %1 %3 %6 %9 %11 +%4 = OpConstantComposite %1 %3 %3 %3 %3 )"); } -TEST_F(SpvBuilderConstructorTest, Type_ModuleScope_Vec4_With_Vec3_F32) { - auto* cast = vec4(vec3(2.0f, 2.0f, 2.0f), 2.0f); - auto* g = Global("g", ty.vec4(), cast, ast::StorageClass::kPrivate); +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_Vec2_F16_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec2(2_h, 2_h), 2_h, 2_h); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 13u); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 %1 = OpTypeVector %2 4 -%3 = OpTypeVector %2 3 -%4 = OpConstant %2 2 -%5 = OpConstantComposite %3 %4 %4 %4 -%7 = OpTypeInt 32 0 -%8 = OpConstant %7 0 -%6 = OpSpecConstantOp %2 CompositeExtract %5 8 -%10 = OpConstant %7 1 -%9 = OpSpecConstantOp %2 CompositeExtract %5 10 -%12 = OpConstant %7 2 -%11 = OpSpecConstantOp %2 CompositeExtract %5 12 -%13 = OpSpecConstantComposite %1 %6 %9 %11 %4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 )"); } -TEST_F(SpvBuilderConstructorTest, Type_Mat2x2_With_Vec2_Vec2) { - auto* cast = mat2x2(vec2(2.0f, 2.0f), vec2(2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_F32_With_Vec2_Vec2) { + auto* cast = vec4(vec2(2_f, 2_f), vec2(2_f, 2_f)); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_F16_With_Vec2_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec2(2_h, 2_h), vec2(2_h, 2_h)); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_F32_With_Vec2_Vec2) { + auto* cast = vec4(vec2(2_f, 2_f), vec2(2_f, 2_f)); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 2 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_F16_With_Vec2_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec2(2_h, 2_h), vec2(2_h, 2_h)); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_F32_Vec3) { + auto* cast = vec4(2_f, vec3(2_f, 2_f, 2_f)); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F32_Vec3) { + auto* cast = vec4(2_f, vec3(2_f, 2_f, 2_f)); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 2 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_F16_Vec3) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(2_h, vec3(2_h, 2_h, 2_h)); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_Vec3_F32) { + auto* cast = vec4(vec3(2_f, 2_f, 2_f), 2_f); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 32 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 2 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalConst_Vec4_With_Vec3_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec3(2_h, 2_h, 2_h), 2_h); + GlobalConst("g", ty.vec4(), cast); + WrapInFunction(Decl(Var("l", Expr("g")))); + + spirv::Builder& b = SanitizeAndBuild(); + ASSERT_TRUE(b.Build()); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +%6 = OpTypeFloat 16 +%5 = OpTypeVector %6 4 +%7 = OpConstant %6 0x1p+1 +%8 = OpConstantComposite %5 %7 %7 %7 %7 +%10 = OpTypePointer Function %5 +%11 = OpConstantNull %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %9 %8 +OpReturn +)"); + Validate(b); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_Vec3_F32) { + auto* cast = vec4(vec3(2_f, 2_f, 2_f), 2_f); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 2 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_GlobalVar_Vec4_With_Vec3_F16) { + Enable(ast::Extension::kF16); + + auto* cast = vec4(vec3(2_h, 2_h, 2_h), 2_h); + auto* g = GlobalVar("g", ty.vec4(), ast::StorageClass::kPrivate, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateConstructorExpression(g, cast), 4u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 4 +%3 = OpConstant %2 0x1p+1 +%4 = OpConstantComposite %1 %3 %3 %3 %3 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Mat2x2_F32_With_Vec2_Vec2) { + auto* cast = mat2x2(vec2(2_f, 2_f), vec2(2_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -994,8 +3214,28 @@ TEST_F(SpvBuilderConstructorTest, Type_Mat2x2_With_Vec2_Vec2) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Mat3x2_With_Vec2_Vec2_Vec2) { - auto* cast = mat3x2(vec2(2.0f, 2.0f), vec2(2.0f, 2.0f), vec2(2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Mat2x2_F16_With_Vec2_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = mat2x2(vec2(2_h, 2_h), vec2(2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 2 +%1 = OpTypeMatrix %2 2 +%4 = OpConstant %3 0x1p+1 +%5 = OpConstantComposite %2 %4 %4 +%6 = OpConstantComposite %1 %5 %5 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Mat3x2_F32_With_Vec2_Vec2_Vec2) { + auto* cast = mat3x2(vec2(2_f, 2_f), vec2(2_f, 2_f), vec2(2_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -1012,9 +3252,29 @@ TEST_F(SpvBuilderConstructorTest, Type_Mat3x2_With_Vec2_Vec2_Vec2) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Mat4x2_With_Vec2_Vec2_Vec2_Vec2) { - auto* cast = mat4x2(vec2(2.0f, 2.0f), vec2(2.0f, 2.0f), vec2(2.0f, 2.0f), - vec2(2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Mat3x2_F16_With_Vec2_Vec2_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = mat3x2(vec2(2_h, 2_h), vec2(2_h, 2_h), vec2(2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 2 +%1 = OpTypeMatrix %2 3 +%4 = OpConstant %3 0x1p+1 +%5 = OpConstantComposite %2 %4 %4 +%6 = OpConstantComposite %1 %5 %5 %5 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Mat4x2_F32_With_Vec2_Vec2_Vec2_Vec2) { + auto* cast = mat4x2(vec2(2_f, 2_f), vec2(2_f, 2_f), vec2(2_f, 2_f), + vec2(2_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -1031,8 +3291,29 @@ TEST_F(SpvBuilderConstructorTest, Type_Mat4x2_With_Vec2_Vec2_Vec2_Vec2) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Mat2x3_With_Vec3_Vec3) { - auto* cast = mat2x3(vec3(2.0f, 2.0f, 2.0f), vec3(2.0f, 2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Mat4x2_F16_With_Vec2_Vec2_Vec2_Vec2) { + Enable(ast::Extension::kF16); + + auto* cast = mat4x2(vec2(2_h, 2_h), vec2(2_h, 2_h), vec2(2_h, 2_h), + vec2(2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 2 +%1 = OpTypeMatrix %2 4 +%4 = OpConstant %3 0x1p+1 +%5 = OpConstantComposite %2 %4 %4 +%6 = OpConstantComposite %1 %5 %5 %5 %5 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Mat2x3_F32_With_Vec3_Vec3) { + auto* cast = mat2x3(vec3(2_f, 2_f, 2_f), vec3(2_f, 2_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -1049,9 +3330,29 @@ TEST_F(SpvBuilderConstructorTest, Type_Mat2x3_With_Vec3_Vec3) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Mat3x3_With_Vec3_Vec3_Vec3) { - auto* cast = mat3x3(vec3(2.0f, 2.0f, 2.0f), vec3(2.0f, 2.0f, 2.0f), - vec3(2.0f, 2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Mat2x3_F16_With_Vec3_Vec3) { + Enable(ast::Extension::kF16); + + auto* cast = mat2x3(vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 3 +%1 = OpTypeMatrix %2 2 +%4 = OpConstant %3 0x1p+1 +%5 = OpConstantComposite %2 %4 %4 %4 +%6 = OpConstantComposite %1 %5 %5 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Mat3x3_F32_With_Vec3_Vec3_Vec3) { + auto* cast = + mat3x3(vec3(2_f, 2_f, 2_f), vec3(2_f, 2_f, 2_f), vec3(2_f, 2_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -1068,9 +3369,30 @@ TEST_F(SpvBuilderConstructorTest, Type_Mat3x3_With_Vec3_Vec3_Vec3) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Mat4x3_With_Vec3_Vec3_Vec3_Vec3) { - auto* cast = mat4x3(vec3(2.0f, 2.0f, 2.0f), vec3(2.0f, 2.0f, 2.0f), - vec3(2.0f, 2.0f, 2.0f), vec3(2.0f, 2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Mat3x3_F16_With_Vec3_Vec3_Vec3) { + Enable(ast::Extension::kF16); + + auto* cast = + mat3x3(vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 3 +%1 = OpTypeMatrix %2 3 +%4 = OpConstant %3 0x1p+1 +%5 = OpConstantComposite %2 %4 %4 %4 +%6 = OpConstantComposite %1 %5 %5 %5 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Mat4x3_F32_With_Vec3_Vec3_Vec3_Vec3) { + auto* cast = mat4x3(vec3(2_f, 2_f, 2_f), vec3(2_f, 2_f, 2_f), + vec3(2_f, 2_f, 2_f), vec3(2_f, 2_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -1087,8 +3409,29 @@ TEST_F(SpvBuilderConstructorTest, Type_Mat4x3_With_Vec3_Vec3_Vec3_Vec3) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Mat2x4_With_Vec4_Vec4) { - auto* cast = mat2x4(vec4(2.0f, 2.0f, 2.0f, 2.0f), vec4(2.0f, 2.0f, 2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Mat4x3_F16_With_Vec3_Vec3_Vec3_Vec3) { + Enable(ast::Extension::kF16); + + auto* cast = mat4x3(vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h), + vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 3 +%1 = OpTypeMatrix %2 4 +%4 = OpConstant %3 0x1p+1 +%5 = OpConstantComposite %2 %4 %4 %4 +%6 = OpConstantComposite %1 %5 %5 %5 %5 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Mat2x4_F32_With_Vec4_Vec4) { + auto* cast = mat2x4(vec4(2_f, 2_f, 2_f, 2_f), vec4(2_f, 2_f, 2_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -1105,9 +3448,29 @@ TEST_F(SpvBuilderConstructorTest, Type_Mat2x4_With_Vec4_Vec4) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Mat3x4_With_Vec4_Vec4_Vec4) { - auto* cast = mat3x4(vec4(2.0f, 2.0f, 2.0f, 2.0f), vec4(2.0f, 2.0f, 2.0f, 2.0f), - vec4(2.0f, 2.0f, 2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Mat2x4_F16_With_Vec4_Vec4) { + Enable(ast::Extension::kF16); + + auto* cast = mat2x4(vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 4 +%1 = OpTypeMatrix %2 2 +%4 = OpConstant %3 0x1p+1 +%5 = OpConstantComposite %2 %4 %4 %4 %4 +%6 = OpConstantComposite %1 %5 %5 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Mat3x4_F32_With_Vec4_Vec4_Vec4) { + auto* cast = mat3x4(vec4(2_f, 2_f, 2_f, 2_f), vec4(2_f, 2_f, 2_f, 2_f), + vec4(2_f, 2_f, 2_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -1124,9 +3487,30 @@ TEST_F(SpvBuilderConstructorTest, Type_Mat3x4_With_Vec4_Vec4_Vec4) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Mat4x4_With_Vec4_Vec4_Vec4_Vec4) { - auto* cast = mat4x4(vec4(2.0f, 2.0f, 2.0f, 2.0f), vec4(2.0f, 2.0f, 2.0f, 2.0f), - vec4(2.0f, 2.0f, 2.0f, 2.0f), vec4(2.0f, 2.0f, 2.0f, 2.0f)); +TEST_F(SpvBuilderConstructorTest, Type_Mat3x4_F16_With_Vec4_Vec4_Vec4) { + Enable(ast::Extension::kF16); + + auto* cast = mat3x4(vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h), + vec4(2_h, 2_h, 2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 4 +%1 = OpTypeMatrix %2 3 +%4 = OpConstant %3 0x1p+1 +%5 = OpConstantComposite %2 %4 %4 %4 %4 +%6 = OpConstantComposite %1 %5 %5 %5 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Mat4x4_F32_With_Vec4_Vec4_Vec4_Vec4) { + auto* cast = mat4x4(vec4(2_f, 2_f, 2_f, 2_f), vec4(2_f, 2_f, 2_f, 2_f), + vec4(2_f, 2_f, 2_f, 2_f), vec4(2_f, 2_f, 2_f, 2_f)); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -1143,8 +3527,29 @@ TEST_F(SpvBuilderConstructorTest, Type_Mat4x4_With_Vec4_Vec4_Vec4_Vec4) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Mat4x4_F16_With_Vec4_Vec4_Vec4_Vec4) { + Enable(ast::Extension::kF16); + + auto* cast = mat4x4(vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h), + vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h)); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 4 +%1 = OpTypeMatrix %2 4 +%4 = OpConstant %3 0x1p+1 +%5 = OpConstantComposite %2 %4 %4 %4 %4 +%6 = OpConstantComposite %1 %5 %5 %5 %5 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_Array_5_F32) { - auto* cast = array(2.0f, 2.0f, 2.0f, 2.0f, 2.0f); + auto* cast = array(2_f, 2_f, 2_f, 2_f, 2_f); WrapInFunction(cast); spirv::Builder& b = Build(); @@ -1161,9 +3566,29 @@ TEST_F(SpvBuilderConstructorTest, Type_Array_5_F32) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Array_2_Vec3) { - auto* first = vec3(1.f, 2.f, 3.f); - auto* second = vec3(1.f, 2.f, 3.f); +TEST_F(SpvBuilderConstructorTest, Type_Array_5_F16) { + Enable(ast::Extension::kF16); + + auto* cast = array(2_h, 2_h, 2_h, 2_h, 2_h); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(cast), 6u); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%3 = OpTypeInt 32 0 +%4 = OpConstant %3 5 +%1 = OpTypeArray %2 %4 +%5 = OpConstant %2 0x1p+1 +%6 = OpConstantComposite %1 %5 %5 %5 %5 %5 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Array_2_Vec3_F32) { + auto* first = vec3(1_f, 2_f, 3_f); + auto* second = vec3(1_f, 2_f, 3_f); auto* t = Construct(ty.array(ty.vec3(), 2_u), first, second); WrapInFunction(t); spirv::Builder& b = Build(); @@ -1183,14 +3608,34 @@ TEST_F(SpvBuilderConstructorTest, Type_Array_2_Vec3) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Array_2_Vec3_F16) { + Enable(ast::Extension::kF16); + + auto* first = vec3(1_h, 2_h, 3_h); + auto* second = vec3(1_h, 2_h, 3_h); + auto* t = Construct(ty.array(ty.vec3(), 2_u), first, second); + WrapInFunction(t); + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_EQ(b.GenerateExpression(t), 10u); + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 3 +%4 = OpTypeInt 32 0 +%5 = OpConstant %4 2 +%1 = OpTypeArray %2 %5 +%6 = OpConstant %3 0x1p+0 +%7 = OpConstant %3 0x1p+1 +%8 = OpConstant %3 0x1.8p+1 +%9 = OpConstantComposite %2 %6 %7 %8 +%10 = OpConstantComposite %1 %9 %9 +)"); +} + TEST_F(SpvBuilderConstructorTest, CommonInitializer_TwoVectors) { - auto* v1 = vec3(2.0f, 2.0f, 2.0f); - auto* v2 = vec3(2.0f, 2.0f, 2.0f); - ast::StatementList stmts = { - WrapInStatement(v1), - WrapInStatement(v2), - }; - WrapInFunction(stmts); + auto* v1 = vec3(2_f, 2_f, 2_f); + auto* v2 = vec3(2_f, 2_f, 2_f); + WrapInFunction(WrapInStatement(v1), WrapInStatement(v2)); spirv::Builder& b = Build(); @@ -1206,13 +3651,9 @@ TEST_F(SpvBuilderConstructorTest, CommonInitializer_TwoVectors) { } TEST_F(SpvBuilderConstructorTest, CommonInitializer_TwoArrays) { - auto* a1 = array(2.0f, 2.0f, 2.0f); - auto* a2 = array(2.0f, 2.0f, 2.0f); - ast::StatementList stmts = { - WrapInStatement(a1), - WrapInStatement(a2), - }; - WrapInFunction(stmts); + auto* a1 = array(2_f, 2_f, 2_f); + auto* a2 = array(2_f, 2_f, 2_f); + WrapInFunction(WrapInStatement(a1), WrapInStatement(a2)); spirv::Builder& b = Build(); @@ -1233,13 +3674,9 @@ TEST_F(SpvBuilderConstructorTest, CommonInitializer_Array_VecArray) { // Test that initializers of different types with the same values produce // different OpConstantComposite instructions. // crbug.com/tint/777 - auto* a1 = array(1.0f, 2.0f); - auto* a2 = vec2(1.0f, 2.0f); - ast::StatementList stmts = { - WrapInStatement(a1), - WrapInStatement(a2), - }; - WrapInFunction(stmts); + auto* a1 = array(1_f, 2_f); + auto* a2 = vec2(1_f, 2_f); + WrapInFunction(WrapInStatement(a1), WrapInStatement(a2)); spirv::Builder& b = Build(); b.push_function(Function{}); @@ -1259,12 +3696,12 @@ TEST_F(SpvBuilderConstructorTest, CommonInitializer_Array_VecArray) { } TEST_F(SpvBuilderConstructorTest, Type_Struct) { - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member("a", ty.f32()), Member("b", ty.vec3()), }); - auto* t = Construct(ty.Of(s), 2.0f, vec3(2.0f, 2.0f, 2.0f)); + auto* t = Construct(ty.Of(s), 2_f, vec3(2_f, 2_f, 2_f)); WrapInFunction(t); spirv::Builder& b = Build(); @@ -1300,6 +3737,25 @@ TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_F32) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_F16) { + Enable(ast::Extension::kF16); + + auto* t = Construct(); + + WrapInFunction(t); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + + EXPECT_EQ(b.GenerateExpression(t), 2u); + ASSERT_FALSE(b.has_error()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstantNull %1 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_I32) { auto* t = Construct(); @@ -1369,7 +3825,7 @@ TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Vector) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Matrix) { +TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Matrix_F32) { auto* t = mat4x2(); WrapInFunction(t); @@ -1388,6 +3844,27 @@ TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Matrix) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Matrix_F16) { + Enable(ast::Extension::kF16); + + auto* t = mat4x2(); + + WrapInFunction(t); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + + EXPECT_EQ(b.GenerateExpression(t), 4u); + ASSERT_FALSE(b.has_error()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 2 +%1 = OpTypeMatrix %2 4 +%4 = OpConstantNull %1 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Array) { auto* t = array(); @@ -1409,7 +3886,7 @@ TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Array) { } TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Struct) { - auto* s = Structure("my_struct", {Member("a", ty.f32())}); + auto* s = Structure("my_struct", utils::Vector{Member("a", ty.f32())}); auto* t = Construct(ty.Of(s)); WrapInFunction(t); @@ -1427,115 +3904,255 @@ TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Struct) { } TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_I32) { - auto* cast = Construct(2_u); - WrapInFunction(cast); + auto* var = Decl(Var("x", ty.u32(), Expr(2_u))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 1u); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1 -%3 = OpTypeInt 32 0 -%4 = OpConstant %3 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeInt 32 1 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%1 = OpBitcast %2 %4 + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpBitcast %7 %8 )"); } TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_U32) { - auto* cast = Construct(2_i); - WrapInFunction(cast); + auto* var = Decl(Var("x", ty.i32(), Expr(2_i))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 1u); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 0 -%3 = OpTypeInt 32 1 -%4 = OpConstant %3 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeInt 32 0 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%1 = OpBitcast %2 %4 + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpBitcast %7 %8 )"); } TEST_F(SpvBuilderConstructorTest, Type_Convert_F32_To_I32) { - auto* cast = Construct(2.4f); - WrapInFunction(cast); + auto* var = Decl(Var("x", ty.f32(), Expr(2.4_f))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 1u); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1 -%3 = OpTypeFloat 32 -%4 = OpConstant %3 2.4000001 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 2.4000001 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeInt 32 1 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%1 = OpConvertFToS %2 %4 + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpConvertFToS %7 %8 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Convert_F16_To_I32) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1.33p+1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeInt 32 1 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpConvertFToS %7 %8 )"); } TEST_F(SpvBuilderConstructorTest, Type_Convert_F32_To_U32) { - auto* cast = Construct(2.4f); - WrapInFunction(cast); + auto* var = Decl(Var("x", ty.f32(), Expr(2.4_f))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 1u); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 0 -%3 = OpTypeFloat 32 -%4 = OpConstant %3 2.4000001 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 2.4000001 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeInt 32 0 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%1 = OpConvertFToU %2 %4 + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpConvertFToU %7 %8 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Convert_F16_To_U32) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1.33p+1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeInt 32 0 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpConvertFToU %7 %8 )"); } TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_F32) { - auto* cast = Construct(2_i); - WrapInFunction(cast); + auto* var = Decl(Var("x", ty.i32(), Expr(2_i))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 1u); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%3 = OpTypeInt 32 1 -%4 = OpConstant %3 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeFloat 32 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%1 = OpConvertSToF %2 %4 + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpConvertSToF %7 %8 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.i32(), Expr(2_i))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeFloat 16 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpConvertSToF %7 %8 )"); } TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_F32) { - auto* cast = Construct(2_u); - WrapInFunction(cast); + auto* var = Decl(Var("x", ty.u32(), Expr(2_u))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); spirv::Builder& b = Build(); b.push_function(Function{}); - EXPECT_EQ(b.GenerateExpression(cast), 1u); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%3 = OpTypeInt 32 0 -%4 = OpConstant %3 2 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeFloat 32 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%1 = OpConvertUToF %2 %4 + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpConvertUToF %7 %8 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.u32(), Expr(2_u))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeFloat 16 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpConvertUToF %7 %8 )"); } TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_I32) { - auto* var = Global("i", ty.vec3(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); auto* cast = vec3("i"); WrapInFunction(cast); @@ -1561,7 +4178,7 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_I32) { } TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F32_to_I32) { - auto* var = Global("i", ty.vec3(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); auto* cast = vec3("i"); WrapInFunction(cast); @@ -1586,8 +4203,36 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F32_to_I32) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F16_to_I32) { + Enable(ast::Extension::kF16); + + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); + + auto* cast = vec3("i"); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 16 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%8 = OpTypeInt 32 1 +%7 = OpTypeVector %8 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%9 = OpLoad %3 %1 +%6 = OpConvertFToS %7 %9 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_U32) { - auto* var = Global("i", ty.vec3(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); auto* cast = vec3("i"); WrapInFunction(cast); @@ -1613,7 +4258,7 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_U32) { } TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F32_to_U32) { - auto* var = Global("i", ty.vec3(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); auto* cast = vec3("i"); WrapInFunction(cast); @@ -1638,8 +4283,36 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F32_to_U32) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F16_to_U32) { + Enable(ast::Extension::kF16); + + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); + + auto* cast = vec3("i"); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 16 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%8 = OpTypeInt 32 0 +%7 = OpTypeVector %8 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%9 = OpLoad %3 %1 +%6 = OpConvertFToU %7 %9 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_F32) { - auto* var = Global("i", ty.vec3(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); auto* cast = vec3("i"); WrapInFunction(cast); @@ -1664,8 +4337,36 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_F32) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_F16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); + + auto* cast = vec3("i"); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%8 = OpTypeFloat 16 +%7 = OpTypeVector %8 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%9 = OpLoad %3 %1 +%6 = OpConvertSToF %7 %9 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_F32) { - auto* var = Global("i", ty.vec3(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); auto* cast = vec3("i"); WrapInFunction(cast); @@ -1690,9 +4391,37 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_F32) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_F16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); + + auto* cast = vec3("i"); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 0 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%8 = OpTypeFloat 16 +%7 = OpTypeVector %8 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%9 = OpLoad %3 %1 +%6 = OpConvertUToF %7 %9 +)"); +} + TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalVectorWithAllConstConstructors) { // vec3(1.0, 2.0, 3.0) -> true - auto* t = vec3(1.f, 2.f, 3.f); + auto* t = vec3(1_f, 2_f, 3_f); WrapInFunction(t); spirv::Builder& b = Build(); @@ -1704,8 +4433,8 @@ TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalVectorWithAllConstCon TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalArrayWithAllConstConstructors) { // array, 2u>(vec3(1.0, 2.0, 3.0), vec3(1.0, 2.0, 3.0)) // -> true - auto* t = Construct(ty.array(ty.vec3(), 2_u), vec3(1.f, 2.f, 3.f), - vec3(1.f, 2.f, 3.f)); + auto* t = Construct(ty.array(ty.vec3(), 2_u), vec3(1_f, 2_f, 3_f), + vec3(1_f, 2_f, 3_f)); WrapInFunction(t); spirv::Builder& b = Build(); @@ -1717,7 +4446,7 @@ TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalArrayWithAllConstCons TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalVectorWithMatchingTypeConstructors) { // vec2(f32(1.0), f32(2.0)) -> false - auto* t = vec2(Construct(1.f), Construct(2.f)); + auto* t = vec2(Construct(1_f), Construct(2_f)); WrapInFunction(t); spirv::Builder& b = Build(); @@ -1741,7 +4470,7 @@ TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalWithTypeConversionCon TEST_F(SpvBuilderConstructorTest, IsConstructorConst_VectorWithAllConstConstructors) { // vec3(1.0, 2.0, 3.0) -> true - auto* t = vec3(1.f, 2.f, 3.f); + auto* t = vec3(1_f, 2_f, 3_f); WrapInFunction(t); spirv::Builder& b = Build(); @@ -1753,9 +4482,9 @@ TEST_F(SpvBuilderConstructorTest, IsConstructorConst_VectorWithAllConstConstruct TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Vector_WithIdent) { // vec3(a, b, c) -> false - Global("a", ty.f32(), ast::StorageClass::kPrivate); - Global("b", ty.f32(), ast::StorageClass::kPrivate); - Global("c", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("c", ty.f32(), ast::StorageClass::kPrivate); auto* t = vec3("a", "b", "c"); WrapInFunction(t); @@ -1770,8 +4499,8 @@ TEST_F(SpvBuilderConstructorTest, IsConstructorConst_ArrayWithAllConstConstructo // array, 2u>(vec3(1.0, 2.0, 3.0), vec3(1.0, 2.0, 3.0)) // -> true - auto* first = vec3(1.f, 2.f, 3.f); - auto* second = vec3(1.f, 2.f, 3.f); + auto* first = vec3(1_f, 2_f, 3_f); + auto* second = vec3(1_f, 2_f, 3_f); auto* t = Construct(ty.array(ty.vec3(), 2_u), first, second); WrapInFunction(t); @@ -1805,12 +4534,12 @@ TEST_F(SpvBuilderConstructorTest, IsConstructorConst_BitCastScalars) { } TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Struct) { - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member("a", ty.f32()), Member("b", ty.vec3()), }); - auto* t = Construct(ty.Of(s), 2.f, vec3(2.f, 2.f, 2.f)); + auto* t = Construct(ty.Of(s), 2_f, vec3(2_f, 2_f, 2_f)); WrapInFunction(t); spirv::Builder& b = Build(); @@ -1820,13 +4549,13 @@ TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Struct) { } TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Struct_WithIdentSubExpression) { - auto* s = Structure("my_struct", { + auto* s = Structure("my_struct", utils::Vector{ Member("a", ty.f32()), Member("b", ty.vec3()), }); - Global("a", ty.f32(), ast::StorageClass::kPrivate); - Global("b", ty.vec3(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("b", ty.vec3(), ast::StorageClass::kPrivate); auto* t = Construct(ty.Of(s), "a", "b"); WrapInFunction(t); @@ -1843,8 +4572,8 @@ TEST_F(SpvBuilderConstructorTest, ConstantCompositeScoping) { // } // let y = vec3(1.0, 2.0, 3.0); // Reuses the ID 'x' - WrapInFunction(If(true, Block(Decl(Let("x", nullptr, vec3(1.f, 2.f, 3.f))))), - Decl(Let("y", nullptr, vec3(1.f, 2.f, 3.f)))); + WrapInFunction(If(true, Block(Decl(Let("x", vec3(1_f, 2_f, 3_f))))), + Decl(Let("y", vec3(1_f, 2_f, 3_f)))); spirv::Builder& b = SanitizeAndBuild(); ASSERT_TRUE(b.Build()); @@ -1887,9 +4616,9 @@ TEST_F(SpvBuilderConstructorTest, CompositeConstructScoping) { // } // let y = vec3(one, 2.0, 3.0); // Mustn't reuse the ID 'x' - WrapInFunction(Decl(Var("one", nullptr, Expr(1.f))), - If(true, Block(Decl(Let("x", nullptr, vec3("one", 2.f, 3.f))))), - Decl(Let("y", nullptr, vec3("one", 2.f, 3.f)))); + WrapInFunction(Decl(Var("one", Expr(1_f))), + If(true, Block(Decl(Let("x", vec3("one", 2_f, 3_f))))), + Decl(Let("y", vec3("one", 2_f, 3_f)))); spirv::Builder& b = SanitizeAndBuild(); ASSERT_TRUE(b.Build()); diff --git a/src/tint/writer/spirv/builder_entry_point_test.cc b/src/tint/writer/spirv/builder_entry_point_test.cc index a38bb8e6b0..424e89b5c2 100644 --- a/src/tint/writer/spirv/builder_entry_point_test.cc +++ b/src/tint/writer/spirv/builder_entry_point_test.cc @@ -15,8 +15,8 @@ #include #include "gtest/gtest.h" -#include "src/tint/ast/builtin.h" #include "src/tint/ast/builtin_attribute.h" +#include "src/tint/ast/builtin_value.h" #include "src/tint/ast/location_attribute.h" #include "src/tint/ast/return_statement.h" #include "src/tint/ast/stage_attribute.h" @@ -37,18 +37,23 @@ namespace { using BuilderTest = TestHelper; TEST_F(BuilderTest, EntryPoint_Parameters) { - // @stage(fragment) + // @fragment // fn frag_main(@builtin(position) coord : vec4, // @location(1) loc1 : f32) { // var col : f32 = (coord.x * loc1); // } - auto* coord = Param("coord", ty.vec4(), {Builtin(ast::Builtin::kPosition)}); - auto* loc1 = Param("loc1", ty.f32(), {Location(1u)}); + auto* coord = Param("coord", ty.vec4(), + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); + auto* loc1 = Param("loc1", ty.f32(), + utils::Vector{ + Location(1u), + }); auto* mul = Mul(Expr(MemberAccessor("coord", "x")), Expr("loc1")); - auto* col = Var("col", ty.f32(), ast::StorageClass::kNone, mul); - Func("frag_main", ast::VariableList{coord, loc1}, ty.void_(), - ast::StatementList{WrapInStatement(col)}, - ast::AttributeList{ + auto* col = Var("col", ty.f32(), mul); + Func("frag_main", utils::Vector{coord, loc1}, ty.void_(), utils::Vector{WrapInStatement(col)}, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -105,7 +110,7 @@ OpFunctionEnd } TEST_F(BuilderTest, EntryPoint_ReturnValue) { - // @stage(fragment) + // @fragment // fn frag_main(@location(0) @interpolate(flat) loc_in : u32) // -> @location(0) f32 { // if (loc_in > 10) { @@ -113,18 +118,24 @@ TEST_F(BuilderTest, EntryPoint_ReturnValue) { // } // return 1.0; // } - auto* loc_in = Param("loc_in", ty.u32(), {Location(0), Flat()}); + auto* loc_in = Param("loc_in", ty.u32(), + utils::Vector{ + Location(0), + Flat(), + }); auto* cond = create(ast::BinaryOp::kGreaterThan, Expr("loc_in"), Expr(10_u)); - Func("frag_main", ast::VariableList{loc_in}, ty.f32(), - ast::StatementList{ - If(cond, Block(Return(0.5f))), - Return(1.0f), + Func("frag_main", utils::Vector{loc_in}, ty.f32(), + utils::Vector{ + If(cond, Block(Return(0.5_f))), + Return(1_f), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }, - ast::AttributeList{Location(0)}); + utils::Vector{ + Location(0), + }); spirv::Builder& b = SanitizeAndBuild(); @@ -187,31 +198,38 @@ TEST_F(BuilderTest, EntryPoint_SharedStruct) { // @builtin(position) pos : vec4; // }; // - // @stage(vertex) + // @vertex // fn vert_main() -> Interface { // return Interface(42.0, vec4()); // } // - // @stage(fragment) + // @fragment // fn frag_main(inputs : Interface) -> @builtin(frag_depth) f32 { // return inputs.value; // } auto* interface = Structure( "Interface", - { - Member("value", ty.f32(), ast::AttributeList{Location(1u)}), - Member("pos", ty.vec4(), ast::AttributeList{Builtin(ast::Builtin::kPosition)}), + utils::Vector{ + Member("value", ty.f32(), utils::Vector{Location(1u)}), + Member("pos", ty.vec4(), utils::Vector{Builtin(ast::BuiltinValue::kPosition)}), }); - auto* vert_retval = Construct(ty.Of(interface), 42.f, Construct(ty.vec4())); - Func("vert_main", ast::VariableList{}, ty.Of(interface), {Return(vert_retval)}, - {Stage(ast::PipelineStage::kVertex)}); + auto* vert_retval = Construct(ty.Of(interface), 42_f, Construct(ty.vec4())); + Func("vert_main", utils::Empty, ty.Of(interface), utils::Vector{Return(vert_retval)}, + utils::Vector{ + Stage(ast::PipelineStage::kVertex), + }); auto* frag_inputs = Param("inputs", ty.Of(interface)); - Func("frag_main", ast::VariableList{frag_inputs}, ty.f32(), - {Return(MemberAccessor(Expr("inputs"), "value"))}, {Stage(ast::PipelineStage::kFragment)}, - {Builtin(ast::Builtin::kFragDepth)}); + Func("frag_main", utils::Vector{frag_inputs}, ty.f32(), + utils::Vector{ + Return(MemberAccessor(Expr("inputs"), "value")), + }, + utils::Vector{Stage(ast::PipelineStage::kFragment)}, + utils::Vector{ + Builtin(ast::BuiltinValue::kFragDepth), + }); spirv::Builder& b = SanitizeAndBuild(); @@ -302,8 +320,13 @@ OpFunctionEnd } TEST_F(BuilderTest, SampleIndex_SampleRateShadingCapability) { - Func("main", {Param("sample_index", ty.u32(), {Builtin(ast::Builtin::kSampleIndex)})}, - ty.void_(), {}, {Stage(ast::PipelineStage::kFragment)}); + Func("main", + utils::Vector{Param("sample_index", ty.u32(), + utils::Vector{Builtin(ast::BuiltinValue::kSampleIndex)})}, + ty.void_(), utils::Empty, + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }); spirv::Builder& b = SanitizeAndBuild(); @@ -311,9 +334,12 @@ TEST_F(BuilderTest, SampleIndex_SampleRateShadingCapability) { // Make sure we generate the SampleRateShading capability. EXPECT_EQ(DumpInstructions(b.capabilities()), - "OpCapability Shader\n" - "OpCapability SampleRateShading\n"); - EXPECT_EQ(DumpInstructions(b.annots()), "OpDecorate %1 BuiltIn SampleId\n"); + R"(OpCapability Shader +OpCapability SampleRateShading +)"); + EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %1 BuiltIn SampleId +OpDecorate %1 Flat +)"); } } // namespace diff --git a/src/tint/writer/spirv/builder_function_attribute_test.cc b/src/tint/writer/spirv/builder_function_attribute_test.cc index f4fdf6ef89..554c028807 100644 --- a/src/tint/writer/spirv/builder_function_attribute_test.cc +++ b/src/tint/writer/spirv/builder_function_attribute_test.cc @@ -25,8 +25,8 @@ namespace { using BuilderTest = TestHelper; TEST_F(BuilderTest, Attribute_Stage) { - auto* func = Func("main", {}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -52,22 +52,22 @@ TEST_P(Attribute_StageTest, Emit) { const ast::Variable* var = nullptr; const ast::Type* ret_type = nullptr; - ast::AttributeList ret_type_attrs; - ast::StatementList body; + utils::Vector ret_type_attrs; + utils::Vector body; if (params.stage == ast::PipelineStage::kVertex) { ret_type = ty.vec4(); - ret_type_attrs.push_back(Builtin(ast::Builtin::kPosition)); - body.push_back(Return(Construct(ty.vec4()))); + ret_type_attrs.Push(Builtin(ast::BuiltinValue::kPosition)); + body.Push(Return(Construct(ty.vec4()))); } else { ret_type = ty.void_(); } - auto deco_list = ast::AttributeList{Stage(params.stage)}; + utils::Vector deco_list{Stage(params.stage)}; if (params.stage == ast::PipelineStage::kCompute) { - deco_list.push_back(WorkgroupSize(1_i)); + deco_list.Push(WorkgroupSize(1_i)); } - auto* func = Func("main", {}, ret_type, body, deco_list, ret_type_attrs); + auto* func = Func("main", utils::Empty, ret_type, body, deco_list, ret_type_attrs); spirv::Builder& b = Build(); @@ -91,8 +91,8 @@ INSTANTIATE_TEST_SUITE_P( FunctionStageData{ast::PipelineStage::kCompute, SpvExecutionModelGLCompute})); TEST_F(BuilderTest, Decoration_ExecutionMode_Fragment_OriginUpperLeft) { - auto* func = Func("main", {}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -105,8 +105,8 @@ TEST_F(BuilderTest, Decoration_ExecutionMode_Fragment_OriginUpperLeft) { } TEST_F(BuilderTest, Decoration_ExecutionMode_WorkgroupSize_Default) { - auto* func = Func("main", {}, ty.void_(), ast::StatementList{}, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); spirv::Builder& b = Build(); @@ -117,8 +117,8 @@ TEST_F(BuilderTest, Decoration_ExecutionMode_WorkgroupSize_Default) { } TEST_F(BuilderTest, Decoration_ExecutionMode_WorkgroupSize_Literals) { - auto* func = Func("main", {}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ WorkgroupSize(2_i, 4_i, 6_i), Stage(ast::PipelineStage::kCompute), }); @@ -135,8 +135,8 @@ TEST_F(BuilderTest, Decoration_ExecutionMode_WorkgroupSize_Const) { GlobalConst("width", ty.i32(), Construct(ty.i32(), 2_i)); GlobalConst("height", ty.i32(), Construct(ty.i32(), 3_i)); GlobalConst("depth", ty.i32(), Construct(ty.i32(), 4_i)); - auto* func = Func("main", {}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ WorkgroupSize("width", "height", "depth"), Stage(ast::PipelineStage::kCompute), }); @@ -150,11 +150,11 @@ TEST_F(BuilderTest, Decoration_ExecutionMode_WorkgroupSize_Const) { } TEST_F(BuilderTest, Decoration_ExecutionMode_WorkgroupSize_OverridableConst) { - Override("width", ty.i32(), Construct(ty.i32(), 2_i), {Id(7u)}); - Override("height", ty.i32(), Construct(ty.i32(), 3_i), {Id(8u)}); - Override("depth", ty.i32(), Construct(ty.i32(), 4_i), {Id(9u)}); - auto* func = Func("main", {}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + Override("width", ty.i32(), Construct(ty.i32(), 2_i), Id(7u)); + Override("height", ty.i32(), Construct(ty.i32(), 3_i), Id(8u)); + Override("depth", ty.i32(), Construct(ty.i32(), 4_i), Id(9u)); + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ WorkgroupSize("width", "height", "depth"), Stage(ast::PipelineStage::kCompute), }); @@ -180,10 +180,10 @@ OpDecorate %3 BuiltIn WorkgroupSize } TEST_F(BuilderTest, Decoration_ExecutionMode_WorkgroupSize_LiteralAndConst) { - Override("height", ty.i32(), Construct(ty.i32(), 2_i), {Id(7u)}); + Override("height", ty.i32(), Construct(ty.i32(), 2_i), Id(7u)); GlobalConst("depth", ty.i32(), Construct(ty.i32(), 3_i)); - auto* func = Func("main", {}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ WorkgroupSize(4_i, "height", "depth"), Stage(ast::PipelineStage::kCompute), }); @@ -207,13 +207,13 @@ OpDecorate %3 BuiltIn WorkgroupSize } TEST_F(BuilderTest, Decoration_ExecutionMode_MultipleFragment) { - auto* func1 = Func("main1", {}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + auto* func1 = Func("main1", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); - auto* func2 = Func("main2", {}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + auto* func2 = Func("main2", utils::Empty, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -242,13 +242,15 @@ OpFunctionEnd } TEST_F(BuilderTest, Decoration_ExecutionMode_FragDepth) { - Func("main", ast::VariableList{}, ty.f32(), - ast::StatementList{ - Return(Expr(1.f)), + Func("main", utils::Empty, ty.f32(), + utils::Vector{ + Return(Expr(1_f)), }, - ast::AttributeList{Stage(ast::PipelineStage::kFragment)}, - ast::AttributeList{ - Builtin(ast::Builtin::kFragDepth), + utils::Vector{ + Stage(ast::PipelineStage::kFragment), + }, + utils::Vector{ + Builtin(ast::BuiltinValue::kFragDepth), }); spirv::Builder& b = SanitizeAndBuild(); diff --git a/src/tint/writer/spirv/builder_function_test.cc b/src/tint/writer/spirv/builder_function_test.cc index fdb6a34b92..d1c0e9f76f 100644 --- a/src/tint/writer/spirv/builder_function_test.cc +++ b/src/tint/writer/spirv/builder_function_test.cc @@ -24,7 +24,7 @@ namespace { using BuilderTest = TestHelper; TEST_F(BuilderTest, Function_Empty) { - Func("a_func", {}, ty.void_(), ast::StatementList{}, ast::AttributeList{}); + Func("a_func", utils::Empty, ty.void_(), utils::Empty); spirv::Builder& b = Build(); @@ -41,11 +41,10 @@ OpFunctionEnd } TEST_F(BuilderTest, Function_Terminator_Return) { - Func("a_func", {}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Return(), - }, - ast::AttributeList{}); + }); spirv::Builder& b = Build(); @@ -62,9 +61,9 @@ OpFunctionEnd } TEST_F(BuilderTest, Function_Terminator_ReturnValue) { - Global("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); - Func("a_func", {}, ty.f32(), ast::StatementList{Return("a")}, ast::AttributeList{}); + Func("a_func", utils::Empty, ty.f32(), utils::Vector{Return("a")}, utils::Empty); spirv::Builder& b = Build(); @@ -89,11 +88,10 @@ OpFunctionEnd } TEST_F(BuilderTest, Function_Terminator_Discard) { - Func("a_func", {}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ create(), - }, - ast::AttributeList{}); + }); spirv::Builder& b = Build(); @@ -110,9 +108,12 @@ OpFunctionEnd } TEST_F(BuilderTest, Function_WithParams) { - ast::VariableList params = {Param("a", ty.f32()), Param("b", ty.i32())}; - - Func("a_func", params, ty.f32(), ast::StatementList{Return("a")}, ast::AttributeList{}); + Func("a_func", + utils::Vector{ + Param("a", ty.f32()), + Param("b", ty.i32()), + }, + ty.f32(), utils::Vector{Return("a")}, utils::Empty); spirv::Builder& b = Build(); @@ -134,11 +135,10 @@ OpFunctionEnd } TEST_F(BuilderTest, Function_WithBody) { - Func("a_func", {}, ty.void_(), - ast::StatementList{ + Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Return(), - }, - ast::AttributeList{}); + }); spirv::Builder& b = Build(); @@ -155,7 +155,7 @@ OpFunctionEnd } TEST_F(BuilderTest, FunctionType) { - Func("a_func", {}, ty.void_(), ast::StatementList{}, ast::AttributeList{}); + Func("a_func", utils::Empty, ty.void_(), utils::Empty, utils::Empty); spirv::Builder& b = Build(); @@ -167,8 +167,8 @@ TEST_F(BuilderTest, FunctionType) { } TEST_F(BuilderTest, FunctionType_DeDuplicate) { - auto* func1 = Func("a_func", {}, ty.void_(), ast::StatementList{}, ast::AttributeList{}); - auto* func2 = Func("b_func", {}, ty.void_(), ast::StatementList{}, ast::AttributeList{}); + auto* func1 = Func("a_func", utils::Empty, ty.void_(), utils::Empty, utils::Empty); + auto* func2 = Func("b_func", utils::Empty, ty.void_(), utils::Empty, utils::Empty); spirv::Builder& b = Build(); @@ -186,44 +186,41 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { // }; // @binding(0) @group(0) var data : Data; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn a() { // return; // } // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn b() { // return; // } - auto* s = Structure("Data", {Member("d", ty.f32())}); + auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())}); - Global("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(0)); { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("a", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("a", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); } { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("b", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("b", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - ast::AttributeList{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); + utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}); } spirv::Builder& b = SanitizeAndBuild(); diff --git a/src/tint/writer/spirv/builder_function_variable_test.cc b/src/tint/writer/spirv/builder_function_variable_test.cc index a3989a0ca5..40bc85d9e7 100644 --- a/src/tint/writer/spirv/builder_function_variable_test.cc +++ b/src/tint/writer/spirv/builder_function_variable_test.cc @@ -15,6 +15,8 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::spirv { namespace { @@ -42,7 +44,7 @@ TEST_F(BuilderTest, FunctionVar_NoStorageClass) { } TEST_F(BuilderTest, FunctionVar_WithConstantConstructor) { - auto* init = vec3(1.f, 1.f, 3.f); + auto* init = vec3(1_f, 1_f, 3_f); auto* v = Var("var", ty.vec3(), ast::StorageClass::kFunction, init); WrapInFunction(v); @@ -71,32 +73,34 @@ TEST_F(BuilderTest, FunctionVar_WithConstantConstructor) { } TEST_F(BuilderTest, FunctionVar_WithNonConstantConstructor) { - auto* init = vec2(1.f, Add(3.f, 3.f)); + auto* a = Let("a", Expr(3_f)); + auto* init = vec2(1_f, Add(Expr("a"), 3_f)); - auto* v = Var("var", ty.vec2(), ast::StorageClass::kNone, init); - WrapInFunction(v); + auto* v = Var("var", ty.vec2(), init); + WrapInFunction(a, v); spirv::Builder& b = Build(); b.push_function(Function{}); + EXPECT_TRUE(b.GenerateFunctionVariable(a)) << b.error(); EXPECT_TRUE(b.GenerateFunctionVariable(v)) << b.error(); ASSERT_FALSE(b.has_error()) << b.error(); EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %7 "var" )"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 2 -%3 = OpConstant %2 1 -%4 = OpConstant %2 3 -%8 = OpTypePointer Function %1 -%9 = OpConstantNull %1 + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 3 +%3 = OpTypeVector %1 2 +%4 = OpConstant %1 1 +%8 = OpTypePointer Function %3 +%9 = OpConstantNull %3 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%7 = OpVariable %8 Function %9 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%5 = OpFAdd %2 %4 %4 -%6 = OpCompositeConstruct %1 %3 %5 + R"(%5 = OpFAdd %1 %2 %2 +%6 = OpCompositeConstruct %3 %4 %5 OpStore %7 %6 )"); } @@ -105,9 +109,44 @@ TEST_F(BuilderTest, FunctionVar_WithNonConstantConstructorLoadedFromVar) { // var v : f32 = 1.0; // var v2 : f32 = v; // Should generate the load and store automatically. - auto* v = Var("v", ty.f32(), ast::StorageClass::kNone, Expr(1.f)); + auto* v = Var("v", ty.f32(), Expr(1_f)); - auto* v2 = Var("v2", ty.f32(), ast::StorageClass::kNone, Expr("v")); + auto* v2 = Var("v2", ty.f32(), Expr("v")); + WrapInFunction(v, v2); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateFunctionVariable(v)) << b.error(); + EXPECT_TRUE(b.GenerateFunctionVariable(v2)) << b.error(); + ASSERT_FALSE(b.has_error()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "v" +OpName %7 "v2" +)"); + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), + R"(%3 = OpVariable %4 Function %5 +%7 = OpVariable %4 Function %5 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%6 = OpLoad %1 %3 +OpStore %7 %6 +)"); +} + +TEST_F(BuilderTest, FunctionVar_LetWithVarInitializer) { + // var v : f32 = 1.0; + // let v2 : f32 = v; // Should generate the load + + auto* v = Var("v", ty.f32(), Expr(1_f)); + + auto* v2 = Var("v2", ty.f32(), Expr("v")); WrapInFunction(v, v2); spirv::Builder& b = Build(); @@ -137,12 +176,12 @@ OpStore %7 %6 } TEST_F(BuilderTest, FunctionVar_ConstWithVarInitializer) { - // var v : f32 = 1.0; - // let v2 : f32 = v; // Should generate the load + // const v : f32 = 1.0; + // let v2 : f32 = v; - auto* v = Var("v", ty.f32(), ast::StorageClass::kNone, Expr(1.f)); + auto* v = Const("v", ty.f32(), Expr(1_f)); - auto* v2 = Var("v2", ty.f32(), ast::StorageClass::kNone, Expr("v")); + auto* v2 = Var("v2", ty.f32(), Expr("v")); WrapInFunction(v, v2); spirv::Builder& b = Build(); @@ -152,8 +191,7 @@ TEST_F(BuilderTest, FunctionVar_ConstWithVarInitializer) { EXPECT_TRUE(b.GenerateFunctionVariable(v2)) << b.error(); ASSERT_FALSE(b.has_error()) << b.error(); - EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "v" -OpName %7 "v2" + EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "v2" )"); EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 %2 = OpConstant %1 1 @@ -162,17 +200,14 @@ OpName %7 "v2" )"); EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"(%3 = OpVariable %4 Function %5 -%7 = OpVariable %4 Function %5 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpStore %3 %2 -%6 = OpLoad %1 %3 -OpStore %7 %6 )"); } -TEST_F(BuilderTest, FunctionVar_Const) { - auto* init = vec3(1.f, 1.f, 3.f); +TEST_F(BuilderTest, FunctionVar_Let) { + auto* init = vec3(1_f, 1_f, 3_f); auto* v = Let("var", ty.vec3(), init); @@ -191,5 +226,20 @@ TEST_F(BuilderTest, FunctionVar_Const) { )"); } +TEST_F(BuilderTest, FunctionVar_Const) { + auto* init = vec3(1_f, 1_f, 3_f); + + auto* v = Const("var", ty.vec3(), init); + + WrapInFunction(v); + + spirv::Builder& b = Build(); + + EXPECT_TRUE(b.GenerateFunctionVariable(v)) << b.error(); + ASSERT_FALSE(b.has_error()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), ""); // Not a mistake - 'const' is inlined +} + } // namespace } // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_global_variable_test.cc b/src/tint/writer/spirv/builder_global_variable_test.cc index 727c573c06..bfecdf14da 100644 --- a/src/tint/writer/spirv/builder_global_variable_test.cc +++ b/src/tint/writer/spirv/builder_global_variable_test.cc @@ -17,13 +17,15 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::spirv { namespace { using BuilderTest = TestHelper; TEST_F(BuilderTest, GlobalVar_WithStorageClass) { - auto* v = Global("var", ty.f32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.f32(), ast::StorageClass::kPrivate); spirv::Builder& b = Build(); @@ -38,9 +40,9 @@ TEST_F(BuilderTest, GlobalVar_WithStorageClass) { } TEST_F(BuilderTest, GlobalVar_WithConstructor) { - auto* init = vec3(1.f, 1.f, 3.f); + auto* init = vec3(1_f, 1_f, 3_f); - auto* v = Global("var", ty.vec3(), ast::StorageClass::kPrivate, init); + auto* v = GlobalVar("var", ty.vec3(), ast::StorageClass::kPrivate, init); spirv::Builder& b = Build(); @@ -59,35 +61,41 @@ TEST_F(BuilderTest, GlobalVar_WithConstructor) { )"); } -TEST_F(BuilderTest, GlobalVar_Const) { - auto* init = vec3(1.f, 1.f, 3.f); +TEST_F(BuilderTest, GlobalConst) { + // const c = 42; + // var v = c; - auto* v = GlobalConst("var", ty.vec3(), init); + auto* c = GlobalConst("c", Expr(42_a)); + GlobalVar("v", ast::StorageClass::kPrivate, Expr(c)); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); - ASSERT_FALSE(b.has_error()) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); - EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %5 "var" + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1 +%2 = OpConstant %1 42 +%4 = OpTypePointer Private %1 +%3 = OpVariable %4 Private %2 +%6 = OpTypeVoid +%5 = OpTypeFunction %6 )"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 3 -%3 = OpConstant %2 1 -%4 = OpConstant %2 3 -%5 = OpConstantComposite %1 %3 %3 %4 + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpReturn )"); + + Validate(b); } -TEST_F(BuilderTest, GlobalVar_Complex_Constructor) { - auto* init = vec3(ast::ExpressionList{Expr(1.f), Expr(2.f), Expr(3.f)}); +TEST_F(BuilderTest, GlobalConst_Vec_Constructor) { + // const c = vec3(1f, 2f, 3f); + // var v = c; - auto* v = GlobalConst("var", ty.vec3(), init); + auto* c = GlobalConst("c", vec3(1_f, 2_f, 3_f)); + GlobalVar("v", ast::StorageClass::kPrivate, Expr(c)); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); - ASSERT_FALSE(b.has_error()) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 3 @@ -95,42 +103,137 @@ TEST_F(BuilderTest, GlobalVar_Complex_Constructor) { %4 = OpConstant %2 2 %5 = OpConstant %2 3 %6 = OpConstantComposite %1 %3 %4 %5 +%8 = OpTypePointer Private %1 +%7 = OpVariable %8 Private %6 +%10 = OpTypeVoid +%9 = OpTypeFunction %10 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpReturn +)"); + + Validate(b); } -TEST_F(BuilderTest, GlobalVar_Complex_ConstructorWithExtract) { - auto* init = vec3(vec2(1.f, 2.f), 3.f); +TEST_F(BuilderTest, GlobalConst_Vec_F16_Constructor) { + // const c = vec3(1h, 2h, 3h); + // var v = c; + Enable(ast::Extension::kF16); - auto* v = GlobalConst("var", ty.vec3(), init); + auto* c = GlobalConst("c", vec3(1_h, 2_h, 3_h)); + GlobalVar("v", ast::StorageClass::kPrivate, Expr(c)); - spirv::Builder& b = Build(); + spirv::Builder& b = SanitizeAndBuild(); - EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); - ASSERT_FALSE(b.has_error()) << b.error(); + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 16 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 0x1p+0 +%4 = OpConstant %2 0x1p+1 +%5 = OpConstant %2 0x1.8p+1 +%6 = OpConstantComposite %1 %3 %4 %5 +%8 = OpTypePointer Private %1 +%7 = OpVariable %8 Private %6 +%10 = OpTypeVoid +%9 = OpTypeFunction %10 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, GlobalConst_Vec_AInt_Constructor) { + // const c = vec3(1, 2, 3); + // var v = c; + + auto* c = GlobalConst("c", Construct(ty.vec3(nullptr), 1_a, 2_a, 3_a)); + GlobalVar("v", ast::StorageClass::kPrivate, Expr(c)); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeInt 32 1 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 +%8 = OpTypePointer Private %1 +%7 = OpVariable %8 Private %6 +%10 = OpTypeVoid +%9 = OpTypeFunction %10 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, GlobalConst_Vec_AFloat_Constructor) { + // const c = vec3(1.0, 2.0, 3.0); + // var v = c; + + auto* c = GlobalConst("c", Construct(ty.vec3(nullptr), 1._a, 2._a, 3._a)); + GlobalVar("v", ast::StorageClass::kPrivate, Expr(c)); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 %1 = OpTypeVector %2 3 -%3 = OpTypeVector %2 2 -%4 = OpConstant %2 1 -%5 = OpConstant %2 2 -%6 = OpConstantComposite %3 %4 %5 -%8 = OpTypeInt 32 0 -%9 = OpConstant %8 0 -%7 = OpSpecConstantOp %2 CompositeExtract %6 9 -%11 = OpConstant %8 1 -%10 = OpSpecConstantOp %2 CompositeExtract %6 11 -%12 = OpConstant %2 3 -%13 = OpSpecConstantComposite %1 %7 %10 %12 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 +%8 = OpTypePointer Private %1 +%7 = OpVariable %8 Private %6 +%10 = OpTypeVoid +%9 = OpTypeFunction %10 )"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpReturn +)"); + + Validate(b); +} + +TEST_F(BuilderTest, GlobalConst_Nested_Vec_Constructor) { + // const c = vec3(vec2(1f, 2f), 3f)); + // var v = c; + + auto* c = GlobalConst("c", vec3(vec2(1_f, 2_f), 3_f)); + GlobalVar("v", ast::StorageClass::kPrivate, Expr(c)); + + spirv::Builder& b = SanitizeAndBuild(); + + ASSERT_TRUE(b.Build()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 +%1 = OpTypeVector %2 3 +%3 = OpConstant %2 1 +%4 = OpConstant %2 2 +%5 = OpConstant %2 3 +%6 = OpConstantComposite %1 %3 %4 %5 +%8 = OpTypePointer Private %1 +%7 = OpVariable %8 Private %6 +%10 = OpTypeVoid +%9 = OpTypeFunction %10 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].variables()), R"()"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpReturn +)"); + + Validate(b); } TEST_F(BuilderTest, GlobalVar_WithBindingAndGroup) { - auto* v = - Global("var", ty.sampler(ast::SamplerKind::kSampler), ast::StorageClass::kNone, nullptr, - ast::AttributeList{ - create(2), - create(3), - }); + auto* v = GlobalVar("var", ty.sampler(ast::SamplerKind::kSampler), Binding(2), Group(3)); spirv::Builder& b = Build(); @@ -147,10 +250,7 @@ OpDecorate %1 DescriptorSet 3 } TEST_F(BuilderTest, GlobalVar_Override_Bool) { - auto* v = Override("var", ty.bool_(), Expr(true), - ast::AttributeList{ - Id(1200), - }); + auto* v = Override("var", ty.bool_(), Expr(true), Id(1200)); spirv::Builder& b = Build(); @@ -165,10 +265,7 @@ TEST_F(BuilderTest, GlobalVar_Override_Bool) { } TEST_F(BuilderTest, GlobalVar_Override_Bool_ZeroValue) { - auto* v = Override("var", ty.bool_(), Construct(), - ast::AttributeList{ - Id(1200), - }); + auto* v = Override("var", ty.bool_(), Construct(), Id(1200)); spirv::Builder& b = Build(); @@ -183,10 +280,7 @@ TEST_F(BuilderTest, GlobalVar_Override_Bool_ZeroValue) { } TEST_F(BuilderTest, GlobalVar_Override_Bool_NoConstructor) { - auto* v = Override("var", ty.bool_(), nullptr, - ast::AttributeList{ - Id(1200), - }); + auto* v = Override("var", ty.bool_(), Id(1200)); spirv::Builder& b = Build(); @@ -201,10 +295,7 @@ TEST_F(BuilderTest, GlobalVar_Override_Bool_NoConstructor) { } TEST_F(BuilderTest, GlobalVar_Override_Scalar) { - auto* v = Override("var", ty.f32(), Expr(2.f), - ast::AttributeList{ - Id(0), - }); + auto* v = Override("var", ty.f32(), Expr(2_f), Id(0)); spirv::Builder& b = Build(); @@ -219,10 +310,7 @@ TEST_F(BuilderTest, GlobalVar_Override_Scalar) { } TEST_F(BuilderTest, GlobalVar_Override_Scalar_ZeroValue) { - auto* v = Override("var", ty.f32(), Construct(), - ast::AttributeList{ - Id(0), - }); + auto* v = Override("var", ty.f32(), Construct(), Id(0)); spirv::Builder& b = Build(); @@ -237,10 +325,7 @@ TEST_F(BuilderTest, GlobalVar_Override_Scalar_ZeroValue) { } TEST_F(BuilderTest, GlobalVar_Override_Scalar_F32_NoConstructor) { - auto* v = Override("var", ty.f32(), nullptr, - ast::AttributeList{ - Id(0), - }); + auto* v = Override("var", ty.f32(), Id(0)); spirv::Builder& b = Build(); @@ -255,10 +340,7 @@ TEST_F(BuilderTest, GlobalVar_Override_Scalar_F32_NoConstructor) { } TEST_F(BuilderTest, GlobalVar_Override_Scalar_I32_NoConstructor) { - auto* v = Override("var", ty.i32(), nullptr, - ast::AttributeList{ - Id(0), - }); + auto* v = Override("var", ty.i32(), Id(0)); spirv::Builder& b = Build(); @@ -273,10 +355,7 @@ TEST_F(BuilderTest, GlobalVar_Override_Scalar_I32_NoConstructor) { } TEST_F(BuilderTest, GlobalVar_Override_Scalar_U32_NoConstructor) { - auto* v = Override("var", ty.u32(), nullptr, - ast::AttributeList{ - Id(0), - }); + auto* v = Override("var", ty.u32(), Id(0)); spirv::Builder& b = Build(); @@ -291,10 +370,7 @@ TEST_F(BuilderTest, GlobalVar_Override_Scalar_U32_NoConstructor) { } TEST_F(BuilderTest, GlobalVar_Override_NoId) { - auto* var_a = Override("a", ty.bool_(), Expr(true), - ast::AttributeList{ - Id(0), - }); + auto* var_a = Override("a", ty.bool_(), Expr(true), Id(0)); auto* var_b = Override("b", ty.bool_(), Expr(false)); spirv::Builder& b = Build(); @@ -314,7 +390,7 @@ OpDecorate %3 SpecId 1 } struct BuiltinData { - ast::Builtin builtin; + ast::BuiltinValue builtin; ast::StorageClass storage; SpvBuiltIn result; }; @@ -334,30 +410,31 @@ INSTANTIATE_TEST_SUITE_P( BuilderTest_Type, BuiltinDataTest, testing::Values( - BuiltinData{ast::Builtin::kNone, ast::StorageClass::kNone, SpvBuiltInMax}, - BuiltinData{ast::Builtin::kPosition, ast::StorageClass::kInput, SpvBuiltInFragCoord}, - BuiltinData{ast::Builtin::kPosition, ast::StorageClass::kOutput, SpvBuiltInPosition}, + BuiltinData{ast::BuiltinValue::kInvalid, ast::StorageClass::kNone, SpvBuiltInMax}, + BuiltinData{ast::BuiltinValue::kPosition, ast::StorageClass::kIn, SpvBuiltInFragCoord}, + BuiltinData{ast::BuiltinValue::kPosition, ast::StorageClass::kOut, SpvBuiltInPosition}, BuiltinData{ - ast::Builtin::kVertexIndex, - ast::StorageClass::kInput, + ast::BuiltinValue::kVertexIndex, + ast::StorageClass::kIn, SpvBuiltInVertexIndex, }, - BuiltinData{ast::Builtin::kInstanceIndex, ast::StorageClass::kInput, + BuiltinData{ast::BuiltinValue::kInstanceIndex, ast::StorageClass::kIn, SpvBuiltInInstanceIndex}, - BuiltinData{ast::Builtin::kFrontFacing, ast::StorageClass::kInput, SpvBuiltInFrontFacing}, - BuiltinData{ast::Builtin::kFragDepth, ast::StorageClass::kOutput, SpvBuiltInFragDepth}, - BuiltinData{ast::Builtin::kLocalInvocationId, ast::StorageClass::kInput, + BuiltinData{ast::BuiltinValue::kFrontFacing, ast::StorageClass::kIn, SpvBuiltInFrontFacing}, + BuiltinData{ast::BuiltinValue::kFragDepth, ast::StorageClass::kOut, SpvBuiltInFragDepth}, + BuiltinData{ast::BuiltinValue::kLocalInvocationId, ast::StorageClass::kIn, SpvBuiltInLocalInvocationId}, - BuiltinData{ast::Builtin::kLocalInvocationIndex, ast::StorageClass::kInput, + BuiltinData{ast::BuiltinValue::kLocalInvocationIndex, ast::StorageClass::kIn, SpvBuiltInLocalInvocationIndex}, - BuiltinData{ast::Builtin::kGlobalInvocationId, ast::StorageClass::kInput, + BuiltinData{ast::BuiltinValue::kGlobalInvocationId, ast::StorageClass::kIn, SpvBuiltInGlobalInvocationId}, - BuiltinData{ast::Builtin::kWorkgroupId, ast::StorageClass::kInput, SpvBuiltInWorkgroupId}, - BuiltinData{ast::Builtin::kNumWorkgroups, ast::StorageClass::kInput, + BuiltinData{ast::BuiltinValue::kWorkgroupId, ast::StorageClass::kIn, SpvBuiltInWorkgroupId}, + BuiltinData{ast::BuiltinValue::kNumWorkgroups, ast::StorageClass::kIn, SpvBuiltInNumWorkgroups}, - BuiltinData{ast::Builtin::kSampleIndex, ast::StorageClass::kInput, SpvBuiltInSampleId}, - BuiltinData{ast::Builtin::kSampleMask, ast::StorageClass::kInput, SpvBuiltInSampleMask}, - BuiltinData{ast::Builtin::kSampleMask, ast::StorageClass::kOutput, SpvBuiltInSampleMask})); + BuiltinData{ast::BuiltinValue::kSampleIndex, ast::StorageClass::kIn, SpvBuiltInSampleId}, + BuiltinData{ast::BuiltinValue::kSampleMask, ast::StorageClass::kIn, SpvBuiltInSampleMask}, + BuiltinData{ast::BuiltinValue::kSampleMask, ast::StorageClass::kOut, + SpvBuiltInSampleMask})); TEST_F(BuilderTest, GlobalVar_DeclReadOnly) { // struct A { @@ -365,16 +442,12 @@ TEST_F(BuilderTest, GlobalVar_DeclReadOnly) { // }; // var b : A - auto* A = Structure("A", { + auto* A = Structure("A", utils::Vector{ Member("a", ty.i32()), Member("b", ty.i32()), }); - Global("b", ty.Of(A), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("b", ty.Of(A), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); spirv::Builder& b = SanitizeAndBuild(); @@ -409,13 +482,9 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasDeclReadOnly) { // type B = A; // var b : B - auto* A = Structure("A", {Member("a", ty.i32())}); + auto* A = Structure("A", utils::Vector{Member("a", ty.i32())}); auto* B = Alias("B", ty.Of(A)); - Global("b", ty.Of(B), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("b", ty.Of(B), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); spirv::Builder& b = SanitizeAndBuild(); @@ -448,13 +517,9 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasAssignReadOnly) { // type B = A; // var b : B - auto* A = Structure("A", {Member("a", ty.i32())}); + auto* A = Structure("A", utils::Vector{Member("a", ty.i32())}); auto* B = Alias("B", ty.Of(A)); - Global("b", ty.Of(B), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("b", ty.Of(B), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), Group(0)); spirv::Builder& b = SanitizeAndBuild(); @@ -487,17 +552,10 @@ TEST_F(BuilderTest, GlobalVar_TwoVarDeclReadOnly) { // var b : A // var c : A - auto* A = Structure("A", {Member("a", ty.i32())}); - Global("b", ty.Of(A), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); - Global("c", ty.Of(A), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(1), - create(0), - }); + auto* A = Structure("A", utils::Vector{Member("a", ty.i32())}); + GlobalVar("b", ty.Of(A), ast::StorageClass::kStorage, ast::Access::kRead, Group(0), Binding(0)); + GlobalVar("c", ty.Of(A), ast::StorageClass::kStorage, ast::Access::kReadWrite, Group(1), + Binding(0)); spirv::Builder& b = SanitizeAndBuild(); @@ -534,11 +592,7 @@ TEST_F(BuilderTest, GlobalVar_TextureStorageWriteOnly) { auto* type = ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Uint, ast::Access::kWrite); - auto* var_a = Global("a", type, - ast::AttributeList{ - create(0), - create(0), - }); + auto* var_a = GlobalVar("a", type, Binding(0), Group(0)); spirv::Builder& b = Build(); @@ -565,19 +619,11 @@ TEST_F(BuilderTest, DISABLED_GlobalVar_TextureStorageWithDifferentAccess) { auto* type_a = ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Uint, ast::Access::kReadWrite); - auto* var_a = Global("a", type_a, ast::StorageClass::kNone, - ast::AttributeList{ - create(0), - create(0), - }); + auto* var_a = GlobalVar("a", type_a, Binding(0), Group(0)); auto* type_b = ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Uint, ast::Access::kWrite); - auto* var_b = Global("b", type_b, ast::StorageClass::kNone, - ast::AttributeList{ - create(1), - create(0), - }); + auto* var_b = GlobalVar("b", type_b, Binding(1), Group(0)); spirv::Builder& b = Build(); @@ -604,16 +650,16 @@ OpDecorate %5 DescriptorSet 0 TEST_F(BuilderTest, GlobalVar_WorkgroupWithZeroInit) { auto* type_scalar = ty.i32(); - auto* var_scalar = Global("a", type_scalar, ast::StorageClass::kWorkgroup); + auto* var_scalar = GlobalVar("a", type_scalar, ast::StorageClass::kWorkgroup); auto* type_array = ty.array(); - auto* var_array = Global("b", type_array, ast::StorageClass::kWorkgroup); + auto* var_array = GlobalVar("b", type_array, ast::StorageClass::kWorkgroup); - auto* type_struct = Structure("C", { + auto* type_struct = Structure("C", utils::Vector{ Member("a", ty.i32()), Member("b", ty.i32()), }); - auto* var_struct = Global("c", ty.Of(type_struct), ast::StorageClass::kWorkgroup); + auto* var_struct = GlobalVar("c", ty.Of(type_struct), ast::StorageClass::kWorkgroup); program = std::make_unique(std::move(*this)); diff --git a/src/tint/writer/spirv/builder_ident_expression_test.cc b/src/tint/writer/spirv/builder_ident_expression_test.cc index 540b5c1bad..0f24146580 100644 --- a/src/tint/writer/spirv/builder_ident_expression_test.cc +++ b/src/tint/writer/spirv/builder_ident_expression_test.cc @@ -23,11 +23,11 @@ namespace { using BuilderTest = TestHelper; TEST_F(BuilderTest, IdentifierExpression_GlobalConst) { - auto* init = vec3(1.f, 1.f, 3.f); + auto* init = vec3(1_f, 1_f, 3_f); - auto* v = GlobalConst("var", ty.vec3(), init); + auto* v = GlobalConst("c", ty.vec3(), init); - auto* expr = Expr("var"); + auto* expr = Expr("c"); WrapInFunction(expr); spirv::Builder& b = Build(); @@ -35,18 +35,13 @@ TEST_F(BuilderTest, IdentifierExpression_GlobalConst) { EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); ASSERT_FALSE(b.has_error()) << b.error(); - EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32 -%1 = OpTypeVector %2 3 -%3 = OpConstant %2 1 -%4 = OpConstant %2 3 -%5 = OpConstantComposite %1 %3 %3 %4 -)"); + EXPECT_EQ(DumpInstructions(b.types()), R"()"); - EXPECT_EQ(b.GenerateIdentifierExpression(expr), 5u); + EXPECT_EQ(b.GenerateIdentifierExpression(expr), 0u); } TEST_F(BuilderTest, IdentifierExpression_GlobalVar) { - auto* v = Global("var", ty.f32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("var", ty.f32(), ast::StorageClass::kPrivate); auto* expr = Expr("var"); WrapInFunction(expr); @@ -67,7 +62,7 @@ TEST_F(BuilderTest, IdentifierExpression_GlobalVar) { } TEST_F(BuilderTest, IdentifierExpression_FunctionConst) { - auto* init = vec3(1.f, 1.f, 3.f); + auto* init = vec3(1_f, 1_f, 3_f); auto* v = Let("var", ty.vec3(), init); @@ -114,8 +109,7 @@ TEST_F(BuilderTest, IdentifierExpression_FunctionVar) { } TEST_F(BuilderTest, IdentifierExpression_Load) { - auto* var = Global("var", ty.i32(), ast::StorageClass::kPrivate); - + auto* var = GlobalVar("var", ty.i32(), ast::StorageClass::kPrivate); auto* expr = Add("var", "var"); WrapInFunction(expr); @@ -138,15 +132,14 @@ TEST_F(BuilderTest, IdentifierExpression_Load) { } TEST_F(BuilderTest, IdentifierExpression_NoLoadConst) { - auto* var = GlobalConst("var", ty.i32(), Expr(2_i)); - - auto* expr = Add("var", "var"); - WrapInFunction(expr); + auto* let = Let("let", ty.i32(), Expr(2_i)); + auto* expr = Add("let", "let"); + WrapInFunction(let, expr); spirv::Builder& b = Build(); b.push_function(Function{}); - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + ASSERT_TRUE(b.GenerateFunctionVariable(let)) << b.error(); EXPECT_EQ(b.GenerateBinaryExpression(expr->As()), 3u) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1 diff --git a/src/tint/writer/spirv/builder_if_test.cc b/src/tint/writer/spirv/builder_if_test.cc index a32f409036..6705cce586 100644 --- a/src/tint/writer/spirv/builder_if_test.cc +++ b/src/tint/writer/spirv/builder_if_test.cc @@ -68,7 +68,7 @@ TEST_F(BuilderTest, If_WithStatements) { // v = 2; // } - auto* var = Global("v", ty.i32(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); auto* body = Block(Assign("v", 2_i)); auto* expr = If(true, body); WrapInFunction(expr); @@ -104,7 +104,7 @@ TEST_F(BuilderTest, If_WithElse) { // v = 3i; // } - auto* var = Global("v", ty.i32(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); auto* body = Block(Assign("v", 2_i)); auto* else_body = Block(Assign("v", 3_i)); @@ -146,7 +146,7 @@ TEST_F(BuilderTest, If_WithElseIf) { // v = 3i; // } - auto* var = Global("v", ty.i32(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); auto* body = Block(Assign("v", 2_i)); auto* else_body = Block(Assign("v", 3_i)); @@ -197,7 +197,7 @@ TEST_F(BuilderTest, If_WithMultiple) { // v = 5i; // } - auto* var = Global("v", ty.i32(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); auto* body = Block(Assign("v", 2_i)); auto* elseif_1_body = Block(Assign("v", 3_i)); auto* elseif_2_body = Block(Assign("v", 4_i)); @@ -223,7 +223,7 @@ TEST_F(BuilderTest, If_WithMultiple) { %6 = OpConstantTrue %5 %10 = OpConstant %3 2 %14 = OpConstant %3 3 -%15 = OpConstantFalse %5 +%15 = OpConstantNull %5 %19 = OpConstant %3 4 %20 = OpConstant %3 5 )"); @@ -434,7 +434,10 @@ TEST_F(BuilderTest, If_WithReturn) { // return; // } - auto* fn = Func("f", {}, ty.void_(), {If(true, Block(Return()))}); + auto* fn = Func("f", utils::Empty, ty.void_(), + utils::Vector{ + If(true, Block(Return())), + }); spirv::Builder& b = Build(); @@ -460,8 +463,8 @@ TEST_F(BuilderTest, If_WithReturnValue) { // } // return true; - auto* fn = Func("f", {}, ty.bool_(), - { + auto* fn = Func("f", utils::Empty, ty.bool_(), + utils::Vector{ If(true, Block(Return(false))), Return(true), }); @@ -472,7 +475,7 @@ TEST_F(BuilderTest, If_WithReturnValue) { EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeBool %1 = OpTypeFunction %2 %5 = OpConstantTrue %2 -%8 = OpConstantFalse %2 +%8 = OpConstantNull %2 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpSelectionMerge %6 None @@ -491,8 +494,8 @@ TEST_F(BuilderTest, IfElse_BothReturn) { // return true; // } - auto* fn = Func("f", {}, ty.bool_(), - { + auto* fn = Func("f", utils::Empty, ty.bool_(), + utils::Vector{ If(true, // Block(Return(true)), // Else(Block(Return(true)))), @@ -530,8 +533,8 @@ TEST_F(BuilderTest, If_WithNestedBlockReturnValue) { // } // return true; - auto* fn = Func("f", {}, ty.bool_(), - { + auto* fn = Func("f", utils::Empty, ty.bool_(), + utils::Vector{ If(true, Block(Block(Block(Block(Return(false)))))), Return(true), }); @@ -542,7 +545,7 @@ TEST_F(BuilderTest, If_WithNestedBlockReturnValue) { EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeBool %1 = OpTypeFunction %2 %5 = OpConstantTrue %2 -%8 = OpConstantFalse %2 +%8 = OpConstantNull %2 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpSelectionMerge %6 None @@ -559,8 +562,11 @@ TEST_F(BuilderTest, If_WithLoad_Bug327) { // if (a) { // } - auto* var = Global("a", ty.bool_(), ast::StorageClass::kPrivate); - auto* fn = Func("f", {}, ty.void_(), {If("a", Block())}); + auto* var = GlobalVar("a", ty.bool_(), ast::StorageClass::kPrivate); + auto* fn = Func("f", utils::Empty, ty.void_(), + utils::Vector{ + If("a", Block()), + }); spirv::Builder& b = Build(); @@ -592,7 +598,7 @@ TEST_F(BuilderTest, If_ElseIf_WithReturn) { // } auto* if_stmt = If(false, Block(), Else(If(true, Block(Return())))); - auto* fn = Func("f", {}, ty.void_(), {if_stmt}); + auto* fn = Func("f", utils::Empty, ty.void_(), utils::Vector{if_stmt}); spirv::Builder& b = Build(); @@ -600,7 +606,7 @@ TEST_F(BuilderTest, If_ElseIf_WithReturn) { EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid %1 = OpTypeFunction %2 %5 = OpTypeBool -%6 = OpConstantFalse %5 +%6 = OpConstantNull %5 %10 = OpConstantTrue %5 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), @@ -630,7 +636,10 @@ TEST_F(BuilderTest, Loop_If_ElseIf_WithBreak) { // } auto* if_stmt = If(false, Block(), Else(If(true, Block(Break())))); - auto* fn = Func("f", {}, ty.void_(), {Loop(Block(if_stmt))}); + auto* fn = Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Loop(Block(if_stmt)), + }); spirv::Builder& b = Build(); @@ -638,7 +647,7 @@ TEST_F(BuilderTest, Loop_If_ElseIf_WithBreak) { EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid %1 = OpTypeFunction %2 %9 = OpTypeBool -%10 = OpConstantFalse %9 +%10 = OpConstantNull %9 %14 = OpConstantTrue %9 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), diff --git a/src/tint/writer/spirv/builder_literal_test.cc b/src/tint/writer/spirv/builder_literal_test.cc index d8a0311dc1..374c80be12 100644 --- a/src/tint/writer/spirv/builder_literal_test.cc +++ b/src/tint/writer/spirv/builder_literal_test.cc @@ -72,7 +72,7 @@ TEST_F(BuilderTest, Literal_Bool_Dedup) { } TEST_F(BuilderTest, Literal_I32) { - auto* i = Expr(i32(-23)); + auto* i = Expr(-23_i); WrapInFunction(i); spirv::Builder& b = Build(); @@ -86,8 +86,8 @@ TEST_F(BuilderTest, Literal_I32) { } TEST_F(BuilderTest, Literal_I32_Dedup) { - auto* i1 = Expr(i32(-23)); - auto* i2 = Expr(i32(-23)); + auto* i1 = Expr(-23_i); + auto* i2 = Expr(-23_i); WrapInFunction(i1, i2); spirv::Builder& b = Build(); @@ -133,7 +133,7 @@ TEST_F(BuilderTest, Literal_U32_Dedup) { } TEST_F(BuilderTest, Literal_F32) { - auto* i = create(23.245f); + auto* i = create(23.245, ast::FloatLiteralExpression::Suffix::kF); WrapInFunction(i); spirv::Builder& b = Build(); @@ -148,8 +148,8 @@ TEST_F(BuilderTest, Literal_F32) { } TEST_F(BuilderTest, Literal_F32_Dedup) { - auto* i1 = create(23.245f); - auto* i2 = create(23.245f); + auto* i1 = create(23.245, ast::FloatLiteralExpression::Suffix::kF); + auto* i2 = create(23.245, ast::FloatLiteralExpression::Suffix::kF); WrapInFunction(i1, i2); spirv::Builder& b = Build(); @@ -163,4 +163,39 @@ TEST_F(BuilderTest, Literal_F32_Dedup) { )"); } +TEST_F(BuilderTest, Literal_F16) { + Enable(ast::Extension::kF16); + + auto* i = create(23.245, ast::FloatLiteralExpression::Suffix::kH); + WrapInFunction(i); + + spirv::Builder& b = Build(); + + auto id = b.GenerateLiteralIfNeeded(nullptr, i); + ASSERT_FALSE(b.has_error()) << b.error(); + EXPECT_EQ(2u, id); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1.73cp+4 +)"); +} + +TEST_F(BuilderTest, Literal_F16_Dedup) { + Enable(ast::Extension::kF16); + + auto* i1 = create(23.245, ast::FloatLiteralExpression::Suffix::kH); + auto* i2 = create(23.245, ast::FloatLiteralExpression::Suffix::kH); + WrapInFunction(i1, i2); + + spirv::Builder& b = Build(); + + ASSERT_NE(b.GenerateLiteralIfNeeded(nullptr, i1), 0u); + ASSERT_NE(b.GenerateLiteralIfNeeded(nullptr, i2), 0u); + ASSERT_FALSE(b.has_error()) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1.73cp+4 +)"); +} + } // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_loop_test.cc b/src/tint/writer/spirv/builder_loop_test.cc index b4c2baa5e5..7e7f32778e 100644 --- a/src/tint/writer/spirv/builder_loop_test.cc +++ b/src/tint/writer/spirv/builder_loop_test.cc @@ -54,7 +54,7 @@ TEST_F(BuilderTest, Loop_WithoutContinuing) { // break; // } - auto* var = Global("v", ty.i32(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); auto* body = Block(Assign("v", 2_i), // Break()); @@ -96,7 +96,7 @@ TEST_F(BuilderTest, Loop_WithContinuing) { // } // } - auto* var = Global("v", ty.i32(), ast::StorageClass::kPrivate); + auto* var = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); auto* body = Block(Assign("v", 2_i), // Break()); auto* continuing = Block(Assign("v", 3_i)); @@ -304,7 +304,7 @@ TEST_F(BuilderTest, Loop_WithContinuing_BreakIf_ConditionIsVar) { // } // } - auto* cond_var = Decl(Var("cond", nullptr, Expr(true))); + auto* cond_var = Decl(Var("cond", Expr(true))); auto* if_stmt = If(Expr("cond"), Block(Break())); auto* continuing = Block(cond_var, if_stmt); auto* loop = Loop(Block(), continuing); @@ -342,7 +342,7 @@ TEST_F(BuilderTest, Loop_WithContinuing_BreakUnless_ConditionIsVar) { // if (cond) {} else { break; } // } // } - auto* cond_var = Decl(Var("cond", nullptr, Expr(true))); + auto* cond_var = Decl(Var("cond", Expr(true))); auto* if_stmt = If(Expr("cond"), Block(), Else(Block(Break()))); auto* continuing = Block(cond_var, if_stmt); auto* loop = Loop(Block(), continuing); diff --git a/src/tint/writer/spirv/builder_return_test.cc b/src/tint/writer/spirv/builder_return_test.cc index 635db28338..825529e906 100644 --- a/src/tint/writer/spirv/builder_return_test.cc +++ b/src/tint/writer/spirv/builder_return_test.cc @@ -15,6 +15,8 @@ #include "src/tint/writer/spirv/spv_dump.h" #include "src/tint/writer/spirv/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::spirv { namespace { @@ -35,10 +37,10 @@ TEST_F(BuilderTest, Return) { } TEST_F(BuilderTest, Return_WithValue) { - auto* val = vec3(1.f, 1.f, 3.f); + auto* val = vec3(1_f, 1_f, 3_f); auto* ret = Return(val); - Func("test", {}, ty.vec3(), {ret}, {}); + Func("test", utils::Empty, ty.vec3(), utils::Vector{ret}, utils::Empty); spirv::Builder& b = Build(); @@ -61,7 +63,7 @@ TEST_F(BuilderTest, Return_WithValue_GeneratesLoad) { auto* var = Var("param", ty.f32()); auto* ret = Return(var); - Func("test", {}, ty.f32(), {Decl(var), ret}, {}); + Func("test", utils::Empty, ty.f32(), utils::Vector{Decl(var), ret}, utils::Empty); spirv::Builder& b = Build(); diff --git a/src/tint/writer/spirv/builder_static_assert_test.cc b/src/tint/writer/spirv/builder_static_assert_test.cc new file mode 100644 index 0000000000..c6d6a51ec0 --- /dev/null +++ b/src/tint/writer/spirv/builder_static_assert_test.cc @@ -0,0 +1,54 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/ast/fallthrough_statement.h" +#include "src/tint/writer/spirv/spv_dump.h" +#include "src/tint/writer/spirv/test_helper.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::writer::spirv { +namespace { + +using BuilderTest = TestHelper; + +TEST_F(BuilderTest, GlobalStaticAssert) { + GlobalStaticAssert(true); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.Build()) << b.error(); + + // static asserts are not emitted + EXPECT_EQ(DumpInstructions(b.types()), ""); + EXPECT_EQ(b.functions().size(), 0u); +} + +TEST_F(BuilderTest, FunctionStaticAssert) { + Func("f", utils::Empty, ty.void_(), utils::Vector{StaticAssert(true)}); + + spirv::Builder& b = Build(); + + ASSERT_TRUE(b.Build()) << b.error(); + + // static asserts are not emitted + EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeVoid +%1 = OpTypeFunction %2 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(OpReturn +)"); +} + +} // namespace +} // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_switch_test.cc b/src/tint/writer/spirv/builder_switch_test.cc index 7ddd1bdac8..c2f526e5c2 100644 --- a/src/tint/writer/spirv/builder_switch_test.cc +++ b/src/tint/writer/spirv/builder_switch_test.cc @@ -57,11 +57,11 @@ TEST_F(BuilderTest, Switch_WithCase) { // default: {} // } - auto* v = Global("v", ty.i32(), ast::StorageClass::kPrivate); - auto* a = Global("a", ty.i32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); - auto* func = Func("a_func", {}, ty.void_(), - { + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Switch("a", // Case(Expr(1_i), Block(Assign("v", 1_i))), // Case(Expr(2_i), Block(Assign("v", 2_i))), // @@ -114,11 +114,11 @@ TEST_F(BuilderTest, Switch_WithCase_Unsigned) { // default: {} // } - auto* v = Global("v", ty.i32(), ast::StorageClass::kPrivate); - auto* a = Global("a", ty.u32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.u32(), ast::StorageClass::kPrivate); - auto* func = Func("a_func", {}, ty.void_(), - { + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Switch("a", // Case(Expr(1_u), Block(Assign("v", 1_i))), // Case(Expr(2_u), Block(Assign("v", 2_i))), // @@ -171,11 +171,11 @@ TEST_F(BuilderTest, Switch_WithDefault) { // v = 1i; // } - auto* v = Global("v", ty.i32(), ast::StorageClass::kPrivate); - auto* a = Global("a", ty.i32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); - auto* func = Func("a_func", {}, ty.void_(), - { + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Switch("a", // DefaultCase(Block(Assign("v", 1_i)))), // }); @@ -221,16 +221,16 @@ TEST_F(BuilderTest, Switch_WithCaseAndDefault) { // v = 3i; // } - auto* v = Global("v", ty.i32(), ast::StorageClass::kPrivate); - auto* a = Global("a", ty.i32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); - auto* func = Func("a_func", {}, ty.void_(), - { - Switch(Expr("a"), // - Case(Expr(1_i), // - Block(Assign("v", 1_i))), // - Case({Expr(2_i), Expr(3_i)}, // - Block(Assign("v", 2_i))), // + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ + Switch(Expr("a"), // + Case(Expr(1_i), // + Block(Assign("v", 1_i))), // + Case(utils::Vector{Expr(2_i), Expr(3_i)}, // + Block(Assign("v", 2_i))), // DefaultCase(Block(Assign("v", 3_i)))), }); @@ -284,11 +284,11 @@ TEST_F(BuilderTest, Switch_CaseWithFallthrough) { // v = 3i; // } - auto* v = Global("v", ty.i32(), ast::StorageClass::kPrivate); - auto* a = Global("a", ty.i32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); - auto* func = Func("a_func", {}, ty.void_(), - { + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Switch(Expr("a"), // Case(Expr(1_i), // Block(Assign("v", 1_i), Fallthrough())), // @@ -346,11 +346,11 @@ TEST_F(BuilderTest, Switch_WithNestedBreak) { // default: {} // } - auto* v = Global("v", ty.i32(), ast::StorageClass::kPrivate); - auto* a = Global("a", ty.i32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("v", ty.i32(), ast::StorageClass::kPrivate); + auto* a = GlobalVar("a", ty.i32(), ast::StorageClass::kPrivate); - auto* func = Func("a_func", {}, ty.void_(), - { + auto* func = Func("a_func", utils::Empty, ty.void_(), + utils::Vector{ Switch("a", // Case(Expr(1_i), // Block( // @@ -412,8 +412,8 @@ TEST_F(BuilderTest, Switch_AllReturn) { // } // } - auto* fn = Func("f", {}, ty.i32(), - { + auto* fn = Func("f", utils::Empty, ty.i32(), + utils::Vector{ Switch(1_i, // Case(Expr(1_i), Block(Return(1_i))), // Case(Expr(2_i), Block(Fallthrough())), // diff --git a/src/tint/writer/spirv/builder_test.cc b/src/tint/writer/spirv/builder_test.cc index f2475c0a10..24d5b725f5 100644 --- a/src/tint/writer/spirv/builder_test.cc +++ b/src/tint/writer/spirv/builder_test.cc @@ -20,6 +20,15 @@ namespace { using BuilderTest = TestHelper; +TEST_F(BuilderTest, InvalidProgram) { + Diagnostics().add_error(diag::System::Writer, "make the program invalid"); + ASSERT_FALSE(IsValid()); + auto program = std::make_unique(std::move(*this)); + ASSERT_FALSE(program->IsValid()); + auto result = Generate(program.get(), Options{}); + EXPECT_EQ(result.error, "input program is not valid"); +} + TEST_F(BuilderTest, TracksIdBounds) { spirv::Builder& b = Build(); @@ -40,5 +49,13 @@ TEST_F(BuilderTest, Capabilities_Dedup) { EXPECT_EQ(DumpInstructions(b.capabilities()), "OpCapability Shader\n"); } +TEST_F(BuilderTest, DeclareExtension) { + spirv::Builder& b = Build(); + + b.push_extension("SPV_KHR_integer_dot_product"); + + EXPECT_EQ(DumpInstructions(b.extensions()), "OpExtension \"SPV_KHR_integer_dot_product\"\n"); +} + } // namespace } // namespace tint::writer::spirv diff --git a/src/tint/writer/spirv/builder_type_test.cc b/src/tint/writer/spirv/builder_type_test.cc index 8dc048e998..3b8e0b170d 100644 --- a/src/tint/writer/spirv/builder_type_test.cc +++ b/src/tint/writer/spirv/builder_type_test.cc @@ -27,12 +27,9 @@ using BuilderTest_Type = TestHelper; TEST_F(BuilderTest_Type, GenerateRuntimeArray) { auto* ary = ty.array(ty.i32()); - auto* str = Structure("S", {Member("x", ary)}); - Global("a", ty.Of(str), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + auto* str = Structure("S", utils::Vector{Member("x", ary)}); + GlobalVar("a", ty.Of(str), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), + Group(0)); spirv::Builder& b = Build(); @@ -47,12 +44,9 @@ TEST_F(BuilderTest_Type, GenerateRuntimeArray) { TEST_F(BuilderTest_Type, ReturnsGeneratedRuntimeArray) { auto* ary = ty.array(ty.i32()); - auto* str = Structure("S", {Member("x", ary)}); - Global("a", ty.Of(str), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + auto* str = Structure("S", utils::Vector{Member("x", ary)}); + GlobalVar("a", ty.Of(str), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), + Group(0)); spirv::Builder& b = Build(); @@ -67,7 +61,7 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedRuntimeArray) { TEST_F(BuilderTest_Type, GenerateArray) { auto* ary = ty.array(ty.i32(), 4_u); - Global("a", ary, ast::StorageClass::kPrivate); + GlobalVar("a", ary, ast::StorageClass::kPrivate); spirv::Builder& b = Build(); @@ -84,7 +78,7 @@ TEST_F(BuilderTest_Type, GenerateArray) { TEST_F(BuilderTest_Type, GenerateArray_WithStride) { auto* ary = ty.array(ty.i32(), 4_u, 16u); - Global("a", ary, ast::StorageClass::kPrivate); + GlobalVar("a", ary, ast::StorageClass::kPrivate); spirv::Builder& b = Build(); @@ -104,7 +98,7 @@ TEST_F(BuilderTest_Type, GenerateArray_WithStride) { TEST_F(BuilderTest_Type, ReturnsGeneratedArray) { auto* ary = ty.array(ty.i32(), 4_u); - Global("a", ary, ast::StorageClass::kPrivate); + GlobalVar("a", ary, ast::StorageClass::kPrivate); spirv::Builder& b = Build(); @@ -175,6 +169,34 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedF32) { ASSERT_FALSE(b.has_error()) << b.error(); } +TEST_F(BuilderTest_Type, GenerateF16) { + auto* f16 = create(); + + spirv::Builder& b = Build(); + + auto id = b.GenerateTypeIfNeeded(f16); + ASSERT_FALSE(b.has_error()) << b.error(); + EXPECT_EQ(id, 1u); + + ASSERT_EQ(b.types().size(), 1u); + EXPECT_EQ(DumpInstruction(b.types()[0]), R"(%1 = OpTypeFloat 16 +)"); +} + +TEST_F(BuilderTest_Type, ReturnsGeneratedF16) { + auto* f16 = create(); + auto* i32 = create(); + + spirv::Builder& b = Build(); + + EXPECT_EQ(b.GenerateTypeIfNeeded(f16), 1u); + ASSERT_FALSE(b.has_error()) << b.error(); + EXPECT_EQ(b.GenerateTypeIfNeeded(i32), 2u); + ASSERT_FALSE(b.has_error()) << b.error(); + EXPECT_EQ(b.GenerateTypeIfNeeded(f16), 1u); + ASSERT_FALSE(b.has_error()) << b.error(); +} + TEST_F(BuilderTest_Type, GenerateI32) { auto* i32 = create(); @@ -236,9 +258,42 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedMatrix) { ASSERT_FALSE(b.has_error()) << b.error(); } +TEST_F(BuilderTest_Type, GenerateF16Matrix) { + auto* f16 = create(); + auto* vec3 = create(f16, 3u); + auto* mat2x3 = create(vec3, 2u); + + spirv::Builder& b = Build(); + + auto id = b.GenerateTypeIfNeeded(mat2x3); + ASSERT_FALSE(b.has_error()) << b.error(); + EXPECT_EQ(id, 1u); + + EXPECT_EQ(b.types().size(), 3u); + EXPECT_EQ(DumpInstructions(b.types()), R"(%3 = OpTypeFloat 16 +%2 = OpTypeVector %3 3 +%1 = OpTypeMatrix %2 2 +)"); +} + +TEST_F(BuilderTest_Type, ReturnsGeneratedF16Matrix) { + auto* f16 = create(); + auto* col = create(f16, 4u); + auto* mat = create(col, 3u); + + spirv::Builder& b = Build(); + + EXPECT_EQ(b.GenerateTypeIfNeeded(mat), 1u); + ASSERT_FALSE(b.has_error()) << b.error(); + EXPECT_EQ(b.GenerateTypeIfNeeded(f16), 3u); + ASSERT_FALSE(b.has_error()) << b.error(); + EXPECT_EQ(b.GenerateTypeIfNeeded(mat), 1u); + ASSERT_FALSE(b.has_error()) << b.error(); +} + TEST_F(BuilderTest_Type, GeneratePtr) { auto* i32 = create(); - auto* ptr = create(i32, ast::StorageClass::kOutput, ast::Access::kReadWrite); + auto* ptr = create(i32, ast::StorageClass::kOut, ast::Access::kReadWrite); spirv::Builder& b = Build(); @@ -253,7 +308,7 @@ TEST_F(BuilderTest_Type, GeneratePtr) { TEST_F(BuilderTest_Type, ReturnsGeneratedPtr) { auto* i32 = create(); - auto* ptr = create(i32, ast::StorageClass::kOutput, ast::Access::kReadWrite); + auto* ptr = create(i32, ast::StorageClass::kOut, ast::Access::kReadWrite); spirv::Builder& b = Build(); @@ -262,7 +317,7 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedPtr) { } TEST_F(BuilderTest_Type, GenerateStruct) { - auto* s = Structure("my_struct", {Member("a", ty.f32())}); + auto* s = Structure("my_struct", utils::Vector{Member("a", ty.f32())}); spirv::Builder& b = Build(); @@ -279,9 +334,9 @@ OpMemberName %1 0 "a" } TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.f32()), - Member("b", ty.f32(), {MemberAlign(8)}), + Member("b", ty.f32(), utils::Vector{MemberAlign(8_u)}), }); spirv::Builder& b = Build(); @@ -303,7 +358,7 @@ OpMemberDecorate %1 1 Offset 8 } TEST_F(BuilderTest_Type, GenerateStruct_NonLayout_Matrix) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.mat2x2()), Member("b", ty.mat2x3()), Member("c", ty.mat4x4()), @@ -343,7 +398,7 @@ OpMemberDecorate %1 2 MatrixStride 16 TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutMatrix) { // We have to infer layout for matrix when it also has an offset. - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.mat2x2()), Member("b", ty.mat2x3()), Member("c", ty.mat4x4()), @@ -389,7 +444,7 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutArraysOfMatrix) { auto* arr_arr_mat2x3 = ty.array(ty.mat2x3(), 1_u); // Doubly nested array auto* rtarr_mat4x4 = ty.array(ty.mat4x4()); // Runtime array - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", arr_mat2x2), Member("b", arr_arr_mat2x3), Member("c", rtarr_mat4x4), @@ -540,8 +595,8 @@ INSTANTIATE_TEST_SUITE_P( BuilderTest_Type, PtrDataTest, testing::Values(PtrData{ast::StorageClass::kNone, SpvStorageClassMax}, - PtrData{ast::StorageClass::kInput, SpvStorageClassInput}, - PtrData{ast::StorageClass::kOutput, SpvStorageClassOutput}, + PtrData{ast::StorageClass::kIn, SpvStorageClassInput}, + PtrData{ast::StorageClass::kOut, SpvStorageClassOutput}, PtrData{ast::StorageClass::kUniform, SpvStorageClassUniform}, PtrData{ast::StorageClass::kWorkgroup, SpvStorageClassWorkgroup}, PtrData{ast::StorageClass::kHandle, SpvStorageClassUniformConstant}, @@ -781,11 +836,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_1d) { auto* s = ty.storage_texture(ast::TextureDimension::k1d, ast::TexelFormat::kR32Float, ast::Access::kWrite); - Global("test_var", s, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("test_var", s, Binding(0), Group(0)); spirv::Builder& b = Build(); @@ -800,11 +851,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_2d) { auto* s = ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Float, ast::Access::kWrite); - Global("test_var", s, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("test_var", s, Binding(0), Group(0)); spirv::Builder& b = Build(); @@ -819,11 +866,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_2dArray) { auto* s = ty.storage_texture(ast::TextureDimension::k2dArray, ast::TexelFormat::kR32Float, ast::Access::kWrite); - Global("test_var", s, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("test_var", s, Binding(0), Group(0)); spirv::Builder& b = Build(); @@ -838,11 +881,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_3d) { auto* s = ty.storage_texture(ast::TextureDimension::k3d, ast::TexelFormat::kR32Float, ast::Access::kWrite); - Global("test_var", s, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("test_var", s, Binding(0), Group(0)); spirv::Builder& b = Build(); @@ -857,11 +896,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeFloat_Format_r32floa auto* s = ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Float, ast::Access::kWrite); - Global("test_var", s, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("test_var", s, Binding(0), Group(0)); spirv::Builder& b = Build(); @@ -876,11 +911,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeSint_Format_r32sint) auto* s = ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Sint, ast::Access::kWrite); - Global("test_var", s, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("test_var", s, Binding(0), Group(0)); spirv::Builder& b = Build(); @@ -895,11 +926,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeUint_Format_r32uint) auto* s = ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Uint, ast::Access::kWrite); - Global("test_var", s, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("test_var", s, Binding(0), Group(0)); spirv::Builder& b = Build(); diff --git a/src/tint/writer/spirv/builder_unary_op_expression_test.cc b/src/tint/writer/spirv/builder_unary_op_expression_test.cc index c34ae32d3c..e28eb78fa5 100644 --- a/src/tint/writer/spirv/builder_unary_op_expression_test.cc +++ b/src/tint/writer/spirv/builder_unary_op_expression_test.cc @@ -39,7 +39,7 @@ TEST_F(BuilderTest, UnaryOp_Negation_Integer) { } TEST_F(BuilderTest, UnaryOp_Negation_Float) { - auto* expr = create(ast::UnaryOp::kNegation, Expr(1.f)); + auto* expr = create(ast::UnaryOp::kNegation, Expr(1_f)); WrapInFunction(expr); spirv::Builder& b = Build(); @@ -79,7 +79,7 @@ TEST_F(BuilderTest, UnaryOp_Not) { b.push_function(Function{}); EXPECT_EQ(b.GenerateUnaryOpExpression(expr), 1u) << b.error(); EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeBool -%3 = OpConstantFalse %2 +%3 = OpConstantNull %2 )"); EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), R"(%1 = OpLogicalNot %2 %3 diff --git a/src/tint/writer/spirv/generator.cc b/src/tint/writer/spirv/generator.cc index fa67827f81..93ac6e1f67 100644 --- a/src/tint/writer/spirv/generator.cc +++ b/src/tint/writer/spirv/generator.cc @@ -26,6 +26,10 @@ Result::Result(const Result&) = default; Result Generate(const Program* program, const Options& options) { Result result; + if (!program->IsValid()) { + result.error = "input program is not valid"; + return result; + } // Sanitize the program. auto sanitized_result = Sanitize(program, options); diff --git a/src/tint/writer/spirv/generator_impl.cc b/src/tint/writer/spirv/generator_impl.cc index e466a24241..8586562741 100644 --- a/src/tint/writer/spirv/generator_impl.cc +++ b/src/tint/writer/spirv/generator_impl.cc @@ -21,17 +21,19 @@ #include "src/tint/transform/add_spirv_block_attribute.h" #include "src/tint/transform/builtin_polyfill.h" #include "src/tint/transform/canonicalize_entry_point_io.h" +#include "src/tint/transform/disable_uniformity_analysis.h" #include "src/tint/transform/expand_compound_assignment.h" -#include "src/tint/transform/fold_constants.h" #include "src/tint/transform/for_loop_to_loop.h" #include "src/tint/transform/manager.h" #include "src/tint/transform/promote_side_effects_to_decl.h" +#include "src/tint/transform/remove_phonies.h" #include "src/tint/transform/remove_unreachable_statements.h" #include "src/tint/transform/simplify_pointers.h" #include "src/tint/transform/unshadow.h" #include "src/tint/transform/unwind_discard_functions.h" #include "src/tint/transform/var_for_dynamic_index.h" #include "src/tint/transform/vectorize_scalar_matrix_constructors.h" +#include "src/tint/transform/while_to_loop.h" #include "src/tint/transform/zero_init_workgroup_memory.h" #include "src/tint/writer/generate_external_texture_bindings.h" @@ -41,8 +43,12 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { transform::Manager manager; transform::DataMap data; + manager.Add(); + { // Builtin polyfills transform::BuiltinPolyfill::Builtins polyfills; + polyfills.acosh = transform::BuiltinPolyfill::Level::kRangeCheck; + polyfills.atanh = transform::BuiltinPolyfill::Level::kRangeCheck; polyfills.count_leading_zeros = true; polyfills.count_trailing_zeros = true; polyfills.extract_bits = transform::BuiltinPolyfill::Level::kClampParameters; @@ -70,10 +76,10 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { manager.Add(); manager.Add(); manager.Add(); // Required for arrayLength() - manager.Add(); + manager.Add(); manager.Add(); manager.Add(); // Must come after - // ZeroInitWorkgroupMemory + manager.Add(); // ZeroInitWorkgroupMemory manager.Add(); manager.Add(); manager.Add(); diff --git a/src/tint/writer/spirv/operand.h b/src/tint/writer/spirv/operand.h index 3174d0cc30..dab10e9141 100644 --- a/src/tint/writer/spirv/operand.h +++ b/src/tint/writer/spirv/operand.h @@ -17,8 +17,7 @@ #include #include -// TODO(https://crbug.com/dawn/1379) Update cpplint and remove NOLINT -#include // NOLINT(build/include_order) +#include #include #include "src/tint/utils/hash.h" diff --git a/src/tint/writer/spirv/scalar_constant.h b/src/tint/writer/spirv/scalar_constant.h index 14bcefbc17..0629d0cdc4 100644 --- a/src/tint/writer/spirv/scalar_constant.h +++ b/src/tint/writer/spirv/scalar_constant.h @@ -20,6 +20,7 @@ #include #include +#include "src/tint/number.h" #include "src/tint/utils/hash.h" // Forward declarations @@ -31,6 +32,12 @@ namespace tint::writer::spirv { /// ScalarConstant represents a scalar constant value struct ScalarConstant { + /// The struct type to hold the bits representation of f16 in the Value union + struct F16 { + /// The 16 bits representation of the f16, stored as uint16_t + uint16_t bits_representation; + }; + /// The constant value union Value { /// The value as a bool @@ -41,6 +48,8 @@ struct ScalarConstant { int32_t i32; /// The value as a float float f32; + /// The value as bits representation of a f16 + F16 f16; /// The value that is wide enough to encompass all other types (including /// future 64-bit data types). @@ -48,7 +57,7 @@ struct ScalarConstant { }; /// The kind of constant - enum class Kind { kBool, kU32, kI32, kF32 }; + enum class Kind { kBool, kU32, kI32, kF32, kF16 }; /// Constructor inline ScalarConstant() { value.u64 = 0; } @@ -72,7 +81,7 @@ struct ScalarConstant { } /// @param value the value of the constant - /// @returns a new ScalarConstant with the provided value and kind Kind::kI32 + /// @returns a new ScalarConstant with the provided value and kind Kind::kF32 static inline ScalarConstant F32(float value) { ScalarConstant c; c.value.f32 = value; @@ -80,6 +89,15 @@ struct ScalarConstant { return c; } + /// @param value the value of the constant + /// @returns a new ScalarConstant with the provided value and kind Kind::kF16 + static inline ScalarConstant F16(f16::type value) { + ScalarConstant c; + c.value.f16 = {f16(value).BitsRepresentation()}; + c.kind = Kind::kF16; + return c; + } + /// @param value the value of the constant /// @returns a new ScalarConstant with the provided value and kind Kind::kBool static inline ScalarConstant Bool(bool value) { diff --git a/src/tint/writer/spirv/scalar_constant_test.cc b/src/tint/writer/spirv/scalar_constant_test.cc index 196e600e14..b00f82ab0b 100644 --- a/src/tint/writer/spirv/scalar_constant_test.cc +++ b/src/tint/writer/spirv/scalar_constant_test.cc @@ -52,5 +52,12 @@ TEST_F(SpirvScalarConstantTest, U32) { EXPECT_EQ(c.kind, ScalarConstant::Kind::kU32); } +TEST_F(SpirvScalarConstantTest, F16) { + auto c = ScalarConstant::F16(123.456f); + // 123.456f will be quantized to f16 123.4375h, bit pattern 0x57b7 + EXPECT_EQ(c.value.f16.bits_representation, 0x57b7u); + EXPECT_EQ(c.kind, ScalarConstant::Kind::kF16); +} + } // namespace } // namespace tint::writer::spirv diff --git a/src/tint/writer/text_generator.cc b/src/tint/writer/text_generator.cc index 5e4e93f801..3dabb5caaf 100644 --- a/src/tint/writer/text_generator.cc +++ b/src/tint/writer/text_generator.cc @@ -84,12 +84,13 @@ void TextGenerator::TextBuffer::Insert(const std::string& line, size_t before, u << " lines.size(): " << lines.size(); return; } - lines.insert(lines.begin() + before, Line{indent, line}); + using DT = decltype(lines)::difference_type; + lines.insert(lines.begin() + static_cast
(before), Line{indent, line}); } void TextGenerator::TextBuffer::Append(const TextBuffer& tb) { for (auto& line : tb.lines) { - // TODO(bclayton): inefficent, consider optimizing + // TODO(bclayton): inefficient, consider optimizing lines.emplace_back(Line{current_indent + line.indent, line.content}); } } @@ -104,8 +105,10 @@ void TextGenerator::TextBuffer::Insert(const TextBuffer& tb, size_t before, uint } size_t idx = 0; for (auto& line : tb.lines) { - // TODO(bclayton): inefficent, consider optimizing - lines.insert(lines.begin() + before + idx, Line{indent + line.indent, line.content}); + // TODO(bclayton): inefficient, consider optimizing + using DT = decltype(lines)::difference_type; + lines.insert(lines.begin() + static_cast
(before + idx), + Line{indent + line.indent, line.content}); idx++; } } diff --git a/src/tint/writer/wgsl/generator_impl.cc b/src/tint/writer/wgsl/generator_impl.cc index 588a6e9b9e..9f9c4c6809 100644 --- a/src/tint/writer/wgsl/generator_impl.cc +++ b/src/tint/writer/wgsl/generator_impl.cc @@ -62,12 +62,12 @@ GeneratorImpl::~GeneratorImpl() = default; bool GeneratorImpl::Generate() { // Generate enable directives before any other global declarations. - for (auto ext : program_->AST().Extensions()) { - if (!EmitEnableDirective(ext)) { + for (auto enable : program_->AST().Enables()) { + if (!EmitEnable(enable)) { return false; } } - if (!program_->AST().Extensions().empty()) { + if (!program_->AST().Enables().IsEmpty()) { line(); } // Generate global declarations in the order they appear in the module. @@ -80,13 +80,14 @@ bool GeneratorImpl::Generate() { [&](const ast::TypeDecl* td) { return EmitTypeDecl(td); }, [&](const ast::Function* func) { return EmitFunction(func); }, [&](const ast::Variable* var) { return EmitVariable(line(), var); }, + [&](const ast::StaticAssert* sa) { return EmitStaticAssert(sa); }, [&](Default) { TINT_UNREACHABLE(Writer, diagnostics_); return false; })) { return false; } - if (decl != program_->AST().GlobalDeclarations().back()) { + if (decl != program_->AST().GlobalDeclarations().Back()) { line(); } } @@ -94,13 +95,9 @@ bool GeneratorImpl::Generate() { return true; } -bool GeneratorImpl::EmitEnableDirective(const ast::Enable::ExtensionKind ext) { +bool GeneratorImpl::EmitEnable(const ast::Enable* enable) { auto out = line(); - auto extension = ast::Enable::KindToName(ext); - if (extension == "") { - return false; - } - out << "enable " << extension << ";"; + out << "enable " << enable->extension << ";"; return true; } @@ -262,7 +259,11 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* return true; }, [&](const ast::FloatLiteralExpression* l) { // - out << FloatToBitPreservingString(l->value); + // f16 literals are also emitted as float value with suffix "h". + // Note that all normal and subnormal f16 values are normal f32 values, and since NaN + // and Inf are not allowed to be spelled in literal, it should be fine to emit f16 + // literals in this way. + out << FloatToBitPreservingString(static_cast(l->value)) << l->suffix; return true; }, [&](const ast::IntLiteralExpression* l) { // @@ -281,7 +282,7 @@ bool GeneratorImpl::EmitIdentifier(std::ostream& out, const ast::IdentifierExpre } bool GeneratorImpl::EmitFunction(const ast::Function* func) { - if (func->attributes.size()) { + if (func->attributes.Length()) { if (!EmitAttributes(line(), func->attributes)) { return false; } @@ -297,7 +298,7 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) { } first = false; - if (!v->attributes.empty()) { + if (!v->attributes.IsEmpty()) { if (!EmitAttributes(out, v->attributes)) { return false; } @@ -313,10 +314,10 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) { out << ")"; - if (!func->return_type->Is() || !func->return_type_attributes.empty()) { + if (!func->return_type->Is() || !func->return_type_attributes.IsEmpty()) { out << " -> "; - if (!func->return_type_attributes.empty()) { + if (!func->return_type_attributes.IsEmpty()) { if (!EmitAttributes(out, func->return_type_attributes)) { return false; } @@ -345,7 +346,7 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) { bool GeneratorImpl::EmitImageFormat(std::ostream& out, const ast::TexelFormat fmt) { switch (fmt) { - case ast::TexelFormat::kNone: + case ast::TexelFormat::kInvalid: diagnostics_.add_error(diag::System::Writer, "unknown image format"); return false; default: @@ -382,19 +383,22 @@ bool GeneratorImpl::EmitType(std::ostream& out, const ast::Type* ty) { } } - out << "array<"; - if (!EmitType(out, ary->type)) { - return false; - } + out << "array"; + if (ary->type) { + out << "<"; + TINT_DEFER(out << ">"); - if (!ary->IsRuntimeArray()) { - out << ", "; - if (!EmitExpression(out, ary->count)) { + if (!EmitType(out, ary->type)) { return false; } - } - out << ">"; + if (!ary->IsRuntimeArray()) { + out << ", "; + if (!EmitExpression(out, ary->count)) { + return false; + } + } + } return true; }, [&](const ast::Bool*) { @@ -405,6 +409,10 @@ bool GeneratorImpl::EmitType(std::ostream& out, const ast::Type* ty) { out << "f32"; return true; }, + [&](const ast::F16*) { + out << "f16"; + return true; + }, [&](const ast::I32*) { out << "i32"; return true; @@ -575,7 +583,7 @@ bool GeneratorImpl::EmitType(std::ostream& out, const ast::Type* ty) { } bool GeneratorImpl::EmitStructType(const ast::Struct* str) { - if (str->attributes.size()) { + if (str->attributes.Length()) { if (!EmitAttributes(line(), str->attributes)) { return false; } @@ -607,15 +615,15 @@ bool GeneratorImpl::EmitStructType(const ast::Struct* str) { // Offset attributes no longer exist in the WGSL spec, but are emitted // by the SPIR-V reader and are consumed by the Resolver(). These should not // be emitted, but instead struct padding fields should be emitted. - ast::AttributeList attributes_sanitized; - attributes_sanitized.reserve(mem->attributes.size()); + utils::Vector attributes_sanitized; + attributes_sanitized.Reserve(mem->attributes.Length()); for (auto* attr : mem->attributes) { if (!attr->Is()) { - attributes_sanitized.emplace_back(attr); + attributes_sanitized.Push(attr); } } - if (!attributes_sanitized.empty()) { + if (!attributes_sanitized.IsEmpty()) { if (!EmitAttributes(line(), attributes_sanitized)) { return false; } @@ -634,46 +642,64 @@ bool GeneratorImpl::EmitStructType(const ast::Struct* str) { return true; } -bool GeneratorImpl::EmitVariable(std::ostream& out, const ast::Variable* var) { - if (!var->attributes.empty()) { - if (!EmitAttributes(out, var->attributes)) { +bool GeneratorImpl::EmitVariable(std::ostream& out, const ast::Variable* v) { + if (!v->attributes.IsEmpty()) { + if (!EmitAttributes(out, v->attributes)) { return false; } out << " "; } - if (var->is_overridable) { - out << "override"; - } else if (var->is_const) { - out << "let"; - } else { - out << "var"; - auto sc = var->declared_storage_class; - auto ac = var->declared_access; - if (sc != ast::StorageClass::kNone || ac != ast::Access::kUndefined) { - out << "<" << sc; - if (ac != ast::Access::kUndefined) { - out << ", "; - if (!EmitAccess(out, ac)) { - return false; + bool ok = Switch( + v, // + [&](const ast::Var* var) { + out << "var"; + auto sc = var->declared_storage_class; + auto ac = var->declared_access; + if (sc != ast::StorageClass::kNone || ac != ast::Access::kUndefined) { + out << "<" << sc; + if (ac != ast::Access::kUndefined) { + out << ", "; + if (!EmitAccess(out, ac)) { + return false; + } } + out << ">"; } - out << ">"; - } + return true; + }, + [&](const ast::Let*) { + out << "let"; + return true; + }, + [&](const ast::Override*) { + out << "override"; + return true; + }, + [&](const ast::Const*) { + out << "const"; + return true; + }, + [&](Default) { + TINT_ICE(Writer, diagnostics_) << "unhandled variable type " << v->TypeInfo().name; + return false; + }); + if (!ok) { + return false; } - out << " " << program_->Symbols().NameFor(var->symbol); + out << " " << program_->Symbols().NameFor(v->symbol); - if (auto* ty = var->type) { + if (auto* ty = v->type) { out << " : "; if (!EmitType(out, ty)) { return false; } } - if (var->constructor != nullptr) { + if (v->constructor != nullptr) { out << " = "; - if (!EmitExpression(out, var->constructor)) { + if (!EmitExpression(out, v->constructor)) { return false; } } @@ -682,7 +708,8 @@ bool GeneratorImpl::EmitVariable(std::ostream& out, const ast::Variable* var) { return true; } -bool GeneratorImpl::EmitAttributes(std::ostream& out, const ast::AttributeList& attrs) { +bool GeneratorImpl::EmitAttributes(std::ostream& out, + utils::VectorRef attrs) { bool first = true; for (auto* attr : attrs) { if (!first) { @@ -695,7 +722,7 @@ bool GeneratorImpl::EmitAttributes(std::ostream& out, const ast::AttributeList& [&](const ast::WorkgroupAttribute* workgroup) { auto values = workgroup->Values(); out << "workgroup_size("; - for (int i = 0; i < 3; i++) { + for (size_t i = 0; i < 3; i++) { if (values[i]) { if (i > 0) { out << ", "; @@ -709,7 +736,7 @@ bool GeneratorImpl::EmitAttributes(std::ostream& out, const ast::AttributeList& return true; }, [&](const ast::StageAttribute* stage) { - out << "stage(" << stage->stage << ")"; + out << stage->stage; return true; }, [&](const ast::BindingAttribute* binding) { @@ -749,7 +776,11 @@ bool GeneratorImpl::EmitAttributes(std::ostream& out, const ast::AttributeList& return true; }, [&](const ast::StructMemberAlignAttribute* align) { - out << "align(" << align->align << ")"; + out << "align("; + if (!EmitExpression(out, align->align)) { + return false; + } + out << ")"; return true; }, [&](const ast::StrideAttribute* stride) { @@ -918,7 +949,9 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { [&](const ast::IncrementDecrementStatement* l) { return EmitIncrementDecrement(l); }, [&](const ast::LoopStatement* l) { return EmitLoop(l); }, [&](const ast::ForLoopStatement* l) { return EmitForLoop(l); }, + [&](const ast::WhileStatement* l) { return EmitWhile(l); }, [&](const ast::ReturnStatement* r) { return EmitReturn(r); }, + [&](const ast::StaticAssert* s) { return EmitStaticAssert(s); }, [&](const ast::SwitchStatement* s) { return EmitSwitch(s); }, [&](const ast::VariableDeclStatement* v) { return EmitVariable(line(), v->variable); }, [&](Default) { @@ -928,7 +961,7 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { }); } -bool GeneratorImpl::EmitStatements(const ast::StatementList& stmts) { +bool GeneratorImpl::EmitStatements(utils::VectorRef stmts) { for (auto* s : stmts) { if (!EmitStatement(s)) { return false; @@ -937,7 +970,7 @@ bool GeneratorImpl::EmitStatements(const ast::StatementList& stmts) { return true; } -bool GeneratorImpl::EmitStatementsWithIndent(const ast::StatementList& stmts) { +bool GeneratorImpl::EmitStatementsWithIndent(utils::VectorRef stmts) { ScopedIndent si(this); return EmitStatements(stmts); } @@ -1180,6 +1213,30 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) { return true; } +bool GeneratorImpl::EmitWhile(const ast::WhileStatement* stmt) { + { + auto out = line(); + out << "while"; + { + ScopedParen sp(out); + + auto* cond = stmt->condition; + if (!EmitExpression(out, cond)) { + return false; + } + } + out << " {"; + } + + if (!EmitStatementsWithIndent(stmt->body->statements)) { + return false; + } + + line() << "}"; + + return true; +} + bool GeneratorImpl::EmitReturn(const ast::ReturnStatement* stmt) { auto out = line(); out << "return"; @@ -1193,6 +1250,16 @@ bool GeneratorImpl::EmitReturn(const ast::ReturnStatement* stmt) { return true; } +bool GeneratorImpl::EmitStaticAssert(const ast::StaticAssert* stmt) { + auto out = line(); + out << "static_assert "; + if (!EmitExpression(out, stmt->condition)) { + return false; + } + out << ";"; + return true; +} + bool GeneratorImpl::EmitSwitch(const ast::SwitchStatement* stmt) { { auto out = line(); diff --git a/src/tint/writer/wgsl/generator_impl.h b/src/tint/writer/wgsl/generator_impl.h index 8473b4f6fe..f4fc4678c9 100644 --- a/src/tint/writer/wgsl/generator_impl.h +++ b/src/tint/writer/wgsl/generator_impl.h @@ -53,9 +53,9 @@ class GeneratorImpl : public TextGenerator { bool Generate(); /// Handles generating a enable directive - /// @param ext the extension kind in the enable directive to generate + /// @param enable the enable node /// @returns true if the enable directive was emitted - bool EmitEnableDirective(const ast::Enable::ExtensionKind ext); + bool EmitEnable(const ast::Enable* enable); /// Handles generating a declared type /// @param ty the declared type to generate /// @returns true if the declared type was emitted @@ -152,6 +152,10 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement to emit /// @returns true if the statement was emtited bool EmitForLoop(const ast::ForLoopStatement* stmt); + /// Handles a while statement + /// @param stmt the statement to emit + /// @returns true if the statement was emtited + bool EmitWhile(const ast::WhileStatement* stmt); /// Handles a member accessor expression /// @param out the output of the expression stream /// @param expr the member accessor expression @@ -161,6 +165,10 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement to emit /// @returns true if the statement was successfully emitted bool EmitReturn(const ast::ReturnStatement* stmt); + /// Handles static assertion statements + /// @param stmt the statement to emit + /// @returns true if the statement was successfully emitted + bool EmitStaticAssert(const ast::StaticAssert* stmt); /// Handles statement /// @param stmt the statement to emit /// @returns true if the statement was emitted @@ -168,11 +176,11 @@ class GeneratorImpl : public TextGenerator { /// Handles a statement list /// @param stmts the statements to emit /// @returns true if the statements were emitted - bool EmitStatements(const ast::StatementList& stmts); + bool EmitStatements(utils::VectorRef stmts); /// Handles a statement list with an increased indentation /// @param stmts the statements to emit /// @returns true if the statements were emitted - bool EmitStatementsWithIndent(const ast::StatementList& stmts); + bool EmitStatementsWithIndent(utils::VectorRef stmts); /// Handles generating a switch statement /// @param stmt the statement to emit /// @returns true if the statement was emitted @@ -210,7 +218,7 @@ class GeneratorImpl : public TextGenerator { /// @param out the output of the expression stream /// @param attrs the attribute list /// @returns true if the attributes were emitted - bool EmitAttributes(std::ostream& out, const ast::AttributeList& attrs); + bool EmitAttributes(std::ostream& out, utils::VectorRef attrs); }; } // namespace tint::writer::wgsl diff --git a/src/tint/writer/wgsl/generator_impl_alias_type_test.cc b/src/tint/writer/wgsl/generator_impl_alias_type_test.cc index 92a6868f79..dd0584d005 100644 --- a/src/tint/writer/wgsl/generator_impl_alias_type_test.cc +++ b/src/tint/writer/wgsl/generator_impl_alias_type_test.cc @@ -30,7 +30,7 @@ TEST_F(WgslGeneratorImplTest, EmitAlias_F32) { } TEST_F(WgslGeneratorImplTest, EmitTypeDecl_Struct) { - auto* s = Structure("A", { + auto* s = Structure("A", utils::Vector{ Member("a", ty.f32()), Member("b", ty.i32()), }); @@ -50,7 +50,7 @@ type B = A; } TEST_F(WgslGeneratorImplTest, EmitAlias_ToStruct) { - auto* s = Structure("A", { + auto* s = Structure("A", utils::Vector{ Member("a", ty.f32()), Member("b", ty.i32()), }); diff --git a/src/tint/writer/wgsl/generator_impl_array_accessor_test.cc b/src/tint/writer/wgsl/generator_impl_array_accessor_test.cc index 2b4e8b4334..0b28ae911b 100644 --- a/src/tint/writer/wgsl/generator_impl_array_accessor_test.cc +++ b/src/tint/writer/wgsl/generator_impl_array_accessor_test.cc @@ -22,7 +22,7 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, IndexAccessor) { - Global("ary", ty.array(), ast::StorageClass::kPrivate); + GlobalVar("ary", ty.array(), ast::StorageClass::kPrivate); auto* expr = IndexAccessor("ary", 5_i); WrapInFunction(expr); @@ -34,9 +34,9 @@ TEST_F(WgslGeneratorImplTest, IndexAccessor) { } TEST_F(WgslGeneratorImplTest, IndexAccessor_OfDref) { - Global("ary", ty.array(), ast::StorageClass::kPrivate); + GlobalVar("ary", ty.array(), ast::StorageClass::kPrivate); - auto* p = Let("p", nullptr, AddressOf("ary")); + auto* p = Let("p", AddressOf("ary")); auto* expr = IndexAccessor(Deref("p"), 5_i); WrapInFunction(p, expr); diff --git a/src/tint/writer/wgsl/generator_impl_assign_test.cc b/src/tint/writer/wgsl/generator_impl_assign_test.cc index 8d5e75efa1..e390d2f300 100644 --- a/src/tint/writer/wgsl/generator_impl_assign_test.cc +++ b/src/tint/writer/wgsl/generator_impl_assign_test.cc @@ -20,8 +20,8 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Assign) { - auto* lhs = Global("lhs", ty.i32(), ast::StorageClass::kPrivate); - auto* rhs = Global("rhs", ty.i32(), ast::StorageClass::kPrivate); + auto* lhs = GlobalVar("lhs", ty.i32(), ast::StorageClass::kPrivate); + auto* rhs = GlobalVar("rhs", ty.i32(), ast::StorageClass::kPrivate); auto* assign = Assign(lhs, rhs); WrapInFunction(assign); diff --git a/src/tint/writer/wgsl/generator_impl_binary_test.cc b/src/tint/writer/wgsl/generator_impl_binary_test.cc index acc4180755..682c001722 100644 --- a/src/tint/writer/wgsl/generator_impl_binary_test.cc +++ b/src/tint/writer/wgsl/generator_impl_binary_test.cc @@ -37,8 +37,8 @@ TEST_P(WgslBinaryTest, Emit) { } }; - Global("left", op_ty(), ast::StorageClass::kPrivate); - Global("right", op_ty(), ast::StorageClass::kPrivate); + GlobalVar("left", op_ty(), ast::StorageClass::kPrivate); + GlobalVar("right", op_ty(), ast::StorageClass::kPrivate); auto* left = Expr("left"); auto* right = Expr("right"); diff --git a/src/tint/writer/wgsl/generator_impl_call_test.cc b/src/tint/writer/wgsl/generator_impl_call_test.cc index 0736ad8878..4746be2030 100644 --- a/src/tint/writer/wgsl/generator_impl_call_test.cc +++ b/src/tint/writer/wgsl/generator_impl_call_test.cc @@ -15,13 +15,18 @@ #include "src/tint/ast/call_statement.h" #include "src/tint/writer/wgsl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::wgsl { namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, EmitExpression_Call_WithoutParams) { - Func("my_func", {}, ty.f32(), {Return(1.23f)}); + Func("my_func", utils::Empty, ty.f32(), + utils::Vector{ + Return(1.23_f), + }); auto* call = Call("my_func"); WrapInFunction(call); @@ -35,13 +40,16 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Call_WithoutParams) { TEST_F(WgslGeneratorImplTest, EmitExpression_Call_WithParams) { Func("my_func", - { + utils::Vector{ Param(Sym(), ty.f32()), Param(Sym(), ty.f32()), }, - ty.f32(), {Return(1.23f)}); - Global("param1", ty.f32(), ast::StorageClass::kPrivate); - Global("param2", ty.f32(), ast::StorageClass::kPrivate); + ty.f32(), + utils::Vector{ + Return(1.23_f), + }); + GlobalVar("param1", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.f32(), ast::StorageClass::kPrivate); auto* call = Call("my_func", "param1", "param2"); WrapInFunction(call); @@ -55,13 +63,13 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Call_WithParams) { TEST_F(WgslGeneratorImplTest, EmitStatement_Call) { Func("my_func", - { + utils::Vector{ Param(Sym(), ty.f32()), Param(Sym(), ty.f32()), }, - ty.void_(), ast::StatementList{}, ast::AttributeList{}); - Global("param1", ty.f32(), ast::StorageClass::kPrivate); - Global("param2", ty.f32(), ast::StorageClass::kPrivate); + ty.void_(), utils::Empty, utils::Empty); + GlobalVar("param1", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("param2", ty.f32(), ast::StorageClass::kPrivate); auto* call = Call("my_func", "param1", "param2"); auto* stmt = CallStmt(call); diff --git a/src/tint/writer/wgsl/generator_impl_case_test.cc b/src/tint/writer/wgsl/generator_impl_case_test.cc index c12997e3ec..6d59970ff7 100644 --- a/src/tint/writer/wgsl/generator_impl_case_test.cc +++ b/src/tint/writer/wgsl/generator_impl_case_test.cc @@ -37,7 +37,13 @@ TEST_F(WgslGeneratorImplTest, Emit_Case) { } TEST_F(WgslGeneratorImplTest, Emit_Case_MultipleSelectors) { - auto* s = Switch(1_i, Case({Expr(5_i), Expr(6_i)}, Block(create())), + auto* s = Switch(1_i, + Case( + utils::Vector{ + Expr(5_i), + Expr(6_i), + }, + Block(create())), DefaultCase()); WrapInFunction(s); diff --git a/src/tint/writer/wgsl/generator_impl_cast_test.cc b/src/tint/writer/wgsl/generator_impl_cast_test.cc index c423943e40..9b9379b34e 100644 --- a/src/tint/writer/wgsl/generator_impl_cast_test.cc +++ b/src/tint/writer/wgsl/generator_impl_cast_test.cc @@ -21,7 +21,7 @@ namespace { using WgslGeneratorImplTest = TestHelper; -TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Scalar) { +TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Scalar_F32_From_I32) { auto* cast = Construct(1_i); WrapInFunction(cast); @@ -32,7 +32,20 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Scalar) { EXPECT_EQ(out.str(), "f32(1i)"); } -TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Vector) { +TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Scalar_F16_From_I32) { + Enable(ast::Extension::kF16); + + auto* cast = Construct(1_i); + WrapInFunction(cast); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); + EXPECT_EQ(out.str(), "f16(1i)"); +} + +TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Vector_F32_From_I32) { auto* cast = vec3(vec3(1_i, 2_i, 3_i)); WrapInFunction(cast); @@ -43,5 +56,18 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Vector) { EXPECT_EQ(out.str(), "vec3(vec3(1i, 2i, 3i))"); } +TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Vector_F16_From_I32) { + Enable(ast::Extension::kF16); + + auto* cast = vec3(vec3(1_i, 2_i, 3_i)); + WrapInFunction(cast); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); + EXPECT_EQ(out.str(), "vec3(vec3(1i, 2i, 3i))"); +} + } // namespace } // namespace tint::writer::wgsl diff --git a/src/tint/writer/wgsl/generator_impl_constructor_test.cc b/src/tint/writer/wgsl/generator_impl_constructor_test.cc index 3fbf3f1ee3..40bf393b28 100644 --- a/src/tint/writer/wgsl/generator_impl_constructor_test.cc +++ b/src/tint/writer/wgsl/generator_impl_constructor_test.cc @@ -34,7 +34,7 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Bool) { } TEST_F(WgslGeneratorImplTest, EmitConstructor_Int) { - WrapInFunction(Expr(i32(-12345))); + WrapInFunction(Expr(-12345_i)); GeneratorImpl& gen = Build(); @@ -51,23 +51,46 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_UInt) { EXPECT_THAT(gen.result(), HasSubstr("56779u")); } -TEST_F(WgslGeneratorImplTest, EmitConstructor_Float) { +TEST_F(WgslGeneratorImplTest, EmitConstructor_F32) { // Use a number close to 1<<30 but whose decimal representation ends in 0. WrapInFunction(Expr(f32((1 << 30) - 4))); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("1073741824.0")); + EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f")); } -TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Float) { - WrapInFunction(Construct(Expr(-1.2e-5f))); +TEST_F(WgslGeneratorImplTest, EmitConstructor_F16) { + Enable(ast::Extension::kF16); + + // Use a number close to 1<<16 but whose decimal representation ends in 0. + WrapInFunction(Expr(f16((1 << 15) - 8))); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("f32(-0.000012)")); + EXPECT_THAT(gen.result(), HasSubstr("32752.0h")); +} + +TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_F32) { + WrapInFunction(Construct(Expr(-1.2e-5_f))); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("f32(-0.000012f)")); +} + +TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(Construct(Expr(-1.2e-5_h))); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("f16(-1.19805336e-05h)")); } TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Bool) { @@ -80,7 +103,7 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Bool) { } TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Int) { - WrapInFunction(Construct(i32(-12345))); + WrapInFunction(Construct(-12345_i)); GeneratorImpl& gen = Build(); @@ -97,34 +120,70 @@ TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Uint) { EXPECT_THAT(gen.result(), HasSubstr("u32(12345u)")); } -TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Vec) { - WrapInFunction(vec3(1.f, 2.f, 3.f)); +TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Vec_F32) { + WrapInFunction(vec3(1_f, 2_f, 3_f)); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("vec3(1.0, 2.0, 3.0)")); + EXPECT_THAT(gen.result(), HasSubstr("vec3(1.0f, 2.0f, 3.0f)")); } -TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Mat) { - WrapInFunction(mat2x3(vec3(1.f, 2.f, 3.f), vec3(3.f, 4.f, 5.f))); +TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Vec_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(vec3(1_h, 2_h, 3_h)); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("mat2x3(vec3(1.0, 2.0, 3.0), " - "vec3(3.0, 4.0, 5.0))")); + EXPECT_THAT(gen.result(), HasSubstr("vec3(1.0h, 2.0h, 3.0h)")); +} + +TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Mat_F32) { + WrapInFunction(mat2x3(vec3(1_f, 2_f, 3_f), vec3(3_f, 4_f, 5_f))); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("mat2x3(vec3(1.0f, 2.0f, 3.0f), " + "vec3(3.0f, 4.0f, 5.0f))")); +} + +TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Mat_F16) { + Enable(ast::Extension::kF16); + + WrapInFunction(mat2x3(vec3(1_h, 2_h, 3_h), vec3(3_h, 4_h, 5_h))); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), HasSubstr("mat2x3(vec3(1.0h, 2.0h, 3.0h), " + "vec3(3.0h, 4.0h, 5.0h))")); } TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_Array) { - WrapInFunction(Construct(ty.array(ty.vec3(), 3_u), vec3(1.0f, 2.0f, 3.0f), - vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f))); + WrapInFunction(Construct(ty.array(ty.vec3(), 3_u), vec3(1_f, 2_f, 3_f), + vec3(4_f, 5_f, 6_f), vec3(7_f, 8_f, 9_f))); GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_THAT(gen.result(), HasSubstr("array, 3u>(vec3(1.0, 2.0, 3.0), " - "vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0))")); + EXPECT_THAT(gen.result(), + HasSubstr("array, 3u>(vec3(1.0f, 2.0f, 3.0f), " + "vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f))")); +} + +TEST_F(WgslGeneratorImplTest, EmitConstructor_Type_ImplicitArray) { + WrapInFunction(Construct(ty.array(nullptr, nullptr), vec3(1_f, 2_f, 3_f), + vec3(4_f, 5_f, 6_f), vec3(7_f, 8_f, 9_f))); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_THAT(gen.result(), + HasSubstr("array(vec3(1.0f, 2.0f, 3.0f), " + "vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f))")); } } // namespace diff --git a/src/tint/writer/wgsl/generator_impl_enable_test.cc b/src/tint/writer/wgsl/generator_impl_enable_test.cc index f9de37146b..503a9a0022 100644 --- a/src/tint/writer/wgsl/generator_impl_enable_test.cc +++ b/src/tint/writer/wgsl/generator_impl_enable_test.cc @@ -20,10 +20,12 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Enable) { + auto* enable = Enable(ast::Extension::kF16); + GeneratorImpl& gen = Build(); - ASSERT_TRUE(gen.EmitEnableDirective(ast::Enable::ExtensionKind::kInternalExtensionForTesting)); - EXPECT_EQ(gen.result(), R"(enable InternalExtensionForTesting; + ASSERT_TRUE(gen.EmitEnable(enable)); + EXPECT_EQ(gen.result(), R"(enable f16; )"); } diff --git a/src/tint/writer/wgsl/generator_impl_function_test.cc b/src/tint/writer/wgsl/generator_impl_function_test.cc index 79a95d51f2..09e1e8b369 100644 --- a/src/tint/writer/wgsl/generator_impl_function_test.cc +++ b/src/tint/writer/wgsl/generator_impl_function_test.cc @@ -25,11 +25,10 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Function) { - auto* func = Func("my_func", ast::VariableList{}, ty.void_(), - ast::StatementList{ + auto* func = Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ Return(), - }, - ast::AttributeList{}); + }); GeneratorImpl& gen = Build(); @@ -43,12 +42,15 @@ TEST_F(WgslGeneratorImplTest, Emit_Function) { } TEST_F(WgslGeneratorImplTest, Emit_Function_WithParams) { - auto* func = - Func("my_func", ast::VariableList{Param("a", ty.f32()), Param("b", ty.i32())}, ty.void_(), - ast::StatementList{ - Return(), - }, - ast::AttributeList{}); + auto* func = Func("my_func", + utils::Vector{ + Param("a", ty.f32()), + Param("b", ty.i32()), + }, + ty.void_(), + utils::Vector{ + Return(), + }); GeneratorImpl& gen = Build(); @@ -62,8 +64,11 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithParams) { } TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize) { - auto* func = Func("my_func", ast::VariableList{}, ty.void_(), ast::StatementList{Return()}, - ast::AttributeList{ + auto* func = Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(2_i, 4_i, 6_i), }); @@ -73,7 +78,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize) { gen.increment_indent(); ASSERT_TRUE(gen.EmitFunction(func)); - EXPECT_EQ(gen.result(), R"( @stage(compute) @workgroup_size(2i, 4i, 6i) + EXPECT_EQ(gen.result(), R"( @compute @workgroup_size(2i, 4i, 6i) fn my_func() { return; } @@ -82,8 +87,11 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize) { TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize_WithIdent) { GlobalConst("height", ty.i32(), Expr(2_i)); - auto* func = Func("my_func", ast::VariableList{}, ty.void_(), ast::StatementList{Return()}, - ast::AttributeList{ + auto* func = Func("my_func", utils::Empty, ty.void_(), + utils::Vector{ + Return(), + }, + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(2_i, "height"), }); @@ -93,7 +101,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize_WithIden gen.increment_indent(); ASSERT_TRUE(gen.EmitFunction(func)); - EXPECT_EQ(gen.result(), R"( @stage(compute) @workgroup_size(2i, height) + EXPECT_EQ(gen.result(), R"( @compute @workgroup_size(2i, height) fn my_func() { return; } @@ -102,10 +110,16 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithAttribute_WorkgroupSize_WithIden TEST_F(WgslGeneratorImplTest, Emit_Function_EntryPoint_Parameters) { auto* vec4 = ty.vec4(); - auto* coord = Param("coord", vec4, {Builtin(ast::Builtin::kPosition)}); - auto* loc1 = Param("loc1", ty.f32(), {Location(1u)}); - auto* func = Func("frag_main", ast::VariableList{coord, loc1}, ty.void_(), ast::StatementList{}, - ast::AttributeList{ + auto* coord = Param("coord", vec4, + utils::Vector{ + Builtin(ast::BuiltinValue::kPosition), + }); + auto* loc1 = Param("loc1", ty.f32(), + utils::Vector{ + Location(1u), + }); + auto* func = Func("frag_main", utils::Vector{coord, loc1}, ty.void_(), utils::Empty, + utils::Vector{ Stage(ast::PipelineStage::kFragment), }); @@ -114,21 +128,21 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_EntryPoint_Parameters) { gen.increment_indent(); ASSERT_TRUE(gen.EmitFunction(func)); - EXPECT_EQ(gen.result(), R"( @stage(fragment) + EXPECT_EQ(gen.result(), R"( @fragment fn frag_main(@builtin(position) coord : vec4, @location(1) loc1 : f32) { } )"); } TEST_F(WgslGeneratorImplTest, Emit_Function_EntryPoint_ReturnValue) { - auto* func = Func("frag_main", ast::VariableList{}, ty.f32(), - ast::StatementList{ - Return(1.f), + auto* func = Func("frag_main", utils::Empty, ty.f32(), + utils::Vector{ + Return(1_f), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kFragment), }, - ast::AttributeList{ + utils::Vector{ Location(1u), }); @@ -137,9 +151,9 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_EntryPoint_ReturnValue) { gen.increment_indent(); ASSERT_TRUE(gen.EmitFunction(func)); - EXPECT_EQ(gen.result(), R"( @stage(fragment) + EXPECT_EQ(gen.result(), R"( @fragment fn frag_main() -> @location(1) f32 { - return 1.0; + return 1.0f; } )"); } @@ -151,47 +165,46 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_Multiple_EntryPoint_With_Same_Module // }; // @binding(0) @group(0) var data : Data; // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn a() { // return; // } // - // @stage(compute) @workgroup_size(1) + // @compute @workgroup_size(1) // fn b() { // return; // } - auto* s = Structure("Data", {Member("d", ty.f32())}); + auto* s = Structure("Data", utils::Vector{ + Member("d", ty.f32()), + }); - Global("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, Binding(0), + Group(0)); { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("a", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("a", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); } { - auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("data", "d")); + auto* var = Var("v", ty.f32(), MemberAccessor("data", "d")); - Func("b", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("b", utils::Empty, ty.void_(), + utils::Vector{ Decl(var), Return(), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -206,13 +219,13 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_Multiple_EntryPoint_With_Same_Module @binding(0) @group(0) var data : Data; -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn a() { var v : f32 = data.d; return; } -@stage(compute) @workgroup_size(1i) +@compute @workgroup_size(1i) fn b() { var v : f32 = data.d; return; diff --git a/src/tint/writer/wgsl/generator_impl_global_decl_test.cc b/src/tint/writer/wgsl/generator_impl_global_decl_test.cc index 8e1c9a6f23..fc424f6051 100644 --- a/src/tint/writer/wgsl/generator_impl_global_decl_test.cc +++ b/src/tint/writer/wgsl/generator_impl_global_decl_test.cc @@ -28,14 +28,14 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalDeclAfterFunction) { auto* func_var = Var("a", ty.f32()); WrapInFunction(func_var); - Global("a", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); gen.increment_indent(); ASSERT_TRUE(gen.Generate()) << gen.error(); - EXPECT_EQ(gen.result(), R"( @stage(compute) @workgroup_size(1i, 1i, 1i) + EXPECT_EQ(gen.result(), R"( @compute @workgroup_size(1i, 1i, 1i) fn test_function() { var a : f32; } @@ -45,27 +45,31 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalDeclAfterFunction) { } TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) { - Global("a0", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("a0", ty.f32(), ast::StorageClass::kPrivate); - auto* s0 = Structure("S0", {Member("a", ty.i32())}); + auto* s0 = Structure("S0", utils::Vector{ + Member("a", ty.i32()), + }); - Func("func", ast::VariableList{}, ty.f32(), - ast::StatementList{ + Func("func", {}, ty.f32(), + utils::Vector{ Return("a0"), }, - ast::AttributeList{}); + utils::Empty); - Global("a1", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("a1", ty.f32(), ast::StorageClass::kPrivate); - auto* s1 = Structure("S1", {Member("a", ty.i32())}); + auto* s1 = Structure("S1", utils::Vector{ + Member("a", ty.i32()), + }); - Func("main", ast::VariableList{}, ty.void_(), - ast::StatementList{ + Func("main", {}, ty.void_(), + utils::Vector{ Decl(Var("s0", ty.Of(s0))), Decl(Var("s1", ty.Of(s1))), Assign("a1", Call("func")), }, - ast::AttributeList{ + utils::Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), }); @@ -91,7 +95,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) { a : i32, } - @stage(compute) @workgroup_size(1i) + @compute @workgroup_size(1i) fn main() { var s0 : S0; var s1 : S1; @@ -101,11 +105,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) { } TEST_F(WgslGeneratorImplTest, Emit_Global_Sampler) { - Global("s", ty.sampler(ast::SamplerKind::kSampler), - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(0), Binding(0)); GeneratorImpl& gen = Build(); @@ -117,11 +117,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Global_Sampler) { TEST_F(WgslGeneratorImplTest, Emit_Global_Texture) { auto* st = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32()); - Global("t", st, - ast::AttributeList{ - create(0), - create(0), - }); + GlobalVar("t", st, Group(0), Binding(0)); GeneratorImpl& gen = Build(); @@ -131,9 +127,24 @@ TEST_F(WgslGeneratorImplTest, Emit_Global_Texture) { EXPECT_EQ(gen.result(), " @group(0) @binding(0) var t : texture_1d;\n"); } +TEST_F(WgslGeneratorImplTest, Emit_GlobalConst) { + GlobalConst("explicit", ty.f32(), Expr(1_f)); + GlobalConst("inferred", Expr(1_f)); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"( const explicit : f32 = 1.0f; + + const inferred = 1.0f; +)"); +} + TEST_F(WgslGeneratorImplTest, Emit_OverridableConstants) { - Override("a", ty.f32(), nullptr); - Override("b", ty.f32(), nullptr, {Id(7u)}); + Override("a", ty.f32()); + Override("b", ty.f32(), Id(7u)); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/wgsl/generator_impl_identifier_test.cc b/src/tint/writer/wgsl/generator_impl_identifier_test.cc index c6bccf671a..2e20d4c71a 100644 --- a/src/tint/writer/wgsl/generator_impl_identifier_test.cc +++ b/src/tint/writer/wgsl/generator_impl_identifier_test.cc @@ -20,7 +20,7 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, EmitIdentifierExpression_Single) { - Global("glsl", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("glsl", ty.f32(), ast::StorageClass::kPrivate); auto* i = Expr("glsl"); WrapInFunction(i); diff --git a/src/tint/writer/wgsl/generator_impl_if_test.cc b/src/tint/writer/wgsl/generator_impl_if_test.cc index 18c0ffddc4..88f6aba053 100644 --- a/src/tint/writer/wgsl/generator_impl_if_test.cc +++ b/src/tint/writer/wgsl/generator_impl_if_test.cc @@ -20,7 +20,7 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_If) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); auto* cond = Expr("cond"); auto* body = Block(Return()); @@ -39,8 +39,8 @@ TEST_F(WgslGeneratorImplTest, Emit_If) { } TEST_F(WgslGeneratorImplTest, Emit_IfWithElseIf) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); - Global("else_cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("else_cond", ty.bool_(), ast::StorageClass::kPrivate); auto* else_cond = Expr("else_cond"); auto* else_body = Block(Return()); @@ -64,7 +64,7 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithElseIf) { } TEST_F(WgslGeneratorImplTest, Emit_IfWithElse) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); auto* else_body = Block(Return()); @@ -87,8 +87,8 @@ TEST_F(WgslGeneratorImplTest, Emit_IfWithElse) { } TEST_F(WgslGeneratorImplTest, Emit_IfWithMultiple) { - Global("cond", ty.bool_(), ast::StorageClass::kPrivate); - Global("else_cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("else_cond", ty.bool_(), ast::StorageClass::kPrivate); auto* else_cond = Expr("else_cond"); diff --git a/src/tint/writer/wgsl/generator_impl_literal_test.cc b/src/tint/writer/wgsl/generator_impl_literal_test.cc index 64d97a4cef..f33bd0ec69 100644 --- a/src/tint/writer/wgsl/generator_impl_literal_test.cc +++ b/src/tint/writer/wgsl/generator_impl_literal_test.cc @@ -16,6 +16,8 @@ #include "src/tint/writer/wgsl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::wgsl { namespace { @@ -23,7 +25,7 @@ namespace { // - 0 sign if sign is 0, 1 otherwise // - 'exponent_bits' is placed in the exponent space. // So, the exponent bias must already be included. -float MakeFloat(int sign, int biased_exponent, int mantissa) { +f32 MakeF32(uint32_t sign, uint32_t biased_exponent, uint32_t mantissa) { const uint32_t sign_bit = sign ? 0x80000000u : 0u; // The binary32 exponent is 8 bits, just below the sign. const uint32_t exponent_bits = (biased_exponent & 0xffu) << 23; @@ -35,21 +37,78 @@ float MakeFloat(int sign, int biased_exponent, int mantissa) { static_assert(sizeof(result) == sizeof(bits), "expected float and uint32_t to be the same size"); std::memcpy(&result, &bits, sizeof(bits)); - return result; + return f32(result); } -struct FloatData { - float value; +// Get the representation of an IEEE 754 binary16 floating point number with +// - 0 sign if sign is 0, 1 otherwise +// - 'exponent_bits' is placed in the exponent space. +// - the exponent bias (15) already be included. +f16 MakeF16(uint32_t sign, uint32_t f16_biased_exponent, uint16_t f16_mantissa) { + assert((f16_biased_exponent & 0xffffffe0u) == 0); + assert((f16_mantissa & 0xfc00u) == 0); + + const uint32_t sign_bit = sign ? 0x80000000u : 0u; + + // F16 has a exponent bias of 15, and f32 bias 127. Adding 127-15=112 to the f16-biased exponent + // to get f32-biased exponent. + uint32_t f32_biased_exponent = (f16_biased_exponent & 0x1fu) + 112; + assert((f32_biased_exponent & 0xffffff00u) == 0); + + if (f16_biased_exponent == 0) { + // +/- zero, or subnormal + if (f16_mantissa == 0) { + // +/- zero + return sign ? f16(-0.0f) : f16(0.0f); + } + // Subnormal f16, calc the corresponding exponent and mantissa of normal f32. + f32_biased_exponent += 1; + // There must be at least one of the 10 mantissa bits being 1, left-shift the mantissa bits + // until the most significant 1 bit is left-shifted to 10th bit (count from zero), which + // will be omitted in the resulting f32 mantissa part. + assert(f16_mantissa & 0x03ffu); + while ((f16_mantissa & 0x0400u) == 0) { + f16_mantissa = static_cast(f16_mantissa << 1); + f32_biased_exponent--; + } + } + + // The binary32 exponent is 8 bits, just below the sign. + const uint32_t f32_exponent_bits = (f32_biased_exponent & 0xffu) << 23; + // The mantissa is the bottom 23 bits. + const uint32_t f32_mantissa_bits = (f16_mantissa & 0x03ffu) << 13; + + uint32_t bits = sign_bit | f32_exponent_bits | f32_mantissa_bits; + float result = 0.0f; + static_assert(sizeof(result) == sizeof(bits), + "expected float and uint32_t to be the same size"); + std::memcpy(&result, &bits, sizeof(bits)); + return f16(result); +} + +struct F32Data { + f32 value; std::string expected; }; -inline std::ostream& operator<<(std::ostream& out, FloatData data) { + +struct F16Data { + f16 value; + std::string expected; +}; + +inline std::ostream& operator<<(std::ostream& out, F32Data data) { out << "{" << data.value << "," << data.expected << "}"; return out; } -using WgslGenerator_FloatLiteralTest = TestParamHelper; +inline std::ostream& operator<<(std::ostream& out, F16Data data) { + out << "{" << data.value << "," << data.expected << "}"; + return out; +} -TEST_P(WgslGenerator_FloatLiteralTest, Emit) { +using WgslGenerator_F32LiteralTest = TestParamHelper; + +TEST_P(WgslGenerator_F32LiteralTest, Emit) { auto* v = Expr(GetParam().value); SetResolveOnBuild(false); @@ -61,37 +120,37 @@ TEST_P(WgslGenerator_FloatLiteralTest, Emit) { } INSTANTIATE_TEST_SUITE_P(Zero, - WgslGenerator_FloatLiteralTest, - ::testing::ValuesIn(std::vector{{0.0f, "0.0"}, - {MakeFloat(0, 0, 0), "0.0"}, - {MakeFloat(1, 0, 0), "-0.0"}})); + WgslGenerator_F32LiteralTest, + ::testing::ValuesIn(std::vector{{0_f, "0.0f"}, + {MakeF32(0, 0, 0), "0.0f"}, + {MakeF32(1, 0, 0), "-0.0f"}})); INSTANTIATE_TEST_SUITE_P(Normal, - WgslGenerator_FloatLiteralTest, - ::testing::ValuesIn(std::vector{{1.0f, "1.0"}, - {-1.0f, "-1.0"}, - {101.375, "101.375"}})); + WgslGenerator_F32LiteralTest, + ::testing::ValuesIn(std::vector{{1_f, "1.0f"}, + {-1_f, "-1.0f"}, + {101.375_f, "101.375f"}})); INSTANTIATE_TEST_SUITE_P(Subnormal, - WgslGenerator_FloatLiteralTest, - ::testing::ValuesIn(std::vector{ - {MakeFloat(0, 0, 1), "0x1p-149"}, // Smallest - {MakeFloat(1, 0, 1), "-0x1p-149"}, - {MakeFloat(0, 0, 2), "0x1p-148"}, - {MakeFloat(1, 0, 2), "-0x1p-148"}, - {MakeFloat(0, 0, 0x7fffff), "0x1.fffffcp-127"}, // Largest - {MakeFloat(1, 0, 0x7fffff), "-0x1.fffffcp-127"}, // Largest - {MakeFloat(0, 0, 0xcafebe), "0x1.2bfaf8p-127"}, // Scattered bits - {MakeFloat(1, 0, 0xcafebe), "-0x1.2bfaf8p-127"}, // Scattered bits - {MakeFloat(0, 0, 0xaaaaa), "0x1.55554p-130"}, // Scattered bits - {MakeFloat(1, 0, 0xaaaaa), "-0x1.55554p-130"}, // Scattered bits + WgslGenerator_F32LiteralTest, + ::testing::ValuesIn(std::vector{ + {MakeF32(0, 0, 1), "0x1p-149f"}, // Smallest + {MakeF32(1, 0, 1), "-0x1p-149f"}, + {MakeF32(0, 0, 2), "0x1p-148f"}, + {MakeF32(1, 0, 2), "-0x1p-148f"}, + {MakeF32(0, 0, 0x7fffff), "0x1.fffffcp-127f"}, // Largest + {MakeF32(1, 0, 0x7fffff), "-0x1.fffffcp-127f"}, // Largest + {MakeF32(0, 0, 0xcafebe), "0x1.2bfaf8p-127f"}, // Scattered bits + {MakeF32(1, 0, 0xcafebe), "-0x1.2bfaf8p-127f"}, // Scattered bits + {MakeF32(0, 0, 0xaaaaa), "0x1.55554p-130f"}, // Scattered bits + {MakeF32(1, 0, 0xaaaaa), "-0x1.55554p-130f"}, // Scattered bits })); INSTANTIATE_TEST_SUITE_P(Infinity, - WgslGenerator_FloatLiteralTest, - ::testing::ValuesIn(std::vector{ - {MakeFloat(0, 255, 0), "0x1p+128"}, - {MakeFloat(1, 255, 0), "-0x1p+128"}})); + WgslGenerator_F32LiteralTest, + ::testing::ValuesIn(std::vector{ + {MakeF32(0, 255, 0), "0x1p+128f"}, + {MakeF32(1, 255, 0), "-0x1p+128f"}})); INSTANTIATE_TEST_SUITE_P( // TODO(dneto): It's unclear how Infinity and NaN should be handled. @@ -103,23 +162,95 @@ INSTANTIATE_TEST_SUITE_P( // whether the NaN is signalling or quiet, but no agreement between // different machine architectures on whether 1 means signalling or // if 1 means quiet. - WgslGenerator_FloatLiteralTest, - ::testing::ValuesIn(std::vector{ + WgslGenerator_F32LiteralTest, + ::testing::ValuesIn(std::vector{ // LSB only. Smallest mantissa. - {MakeFloat(0, 255, 1), "0x1.000002p+128"}, // Smallest mantissa - {MakeFloat(1, 255, 1), "-0x1.000002p+128"}, + {MakeF32(0, 255, 1), "0x1.000002p+128f"}, // Smallest mantissa + {MakeF32(1, 255, 1), "-0x1.000002p+128f"}, // MSB only. - {MakeFloat(0, 255, 0x400000), "0x1.8p+128"}, - {MakeFloat(1, 255, 0x400000), "-0x1.8p+128"}, + {MakeF32(0, 255, 0x400000), "0x1.8p+128f"}, + {MakeF32(1, 255, 0x400000), "-0x1.8p+128f"}, // All 1s in the mantissa. - {MakeFloat(0, 255, 0x7fffff), "0x1.fffffep+128"}, - {MakeFloat(1, 255, 0x7fffff), "-0x1.fffffep+128"}, + {MakeF32(0, 255, 0x7fffff), "0x1.fffffep+128f"}, + {MakeF32(1, 255, 0x7fffff), "-0x1.fffffep+128f"}, // Scattered bits, with 0 in top mantissa bit. - {MakeFloat(0, 255, 0x20101f), "0x1.40203ep+128"}, - {MakeFloat(1, 255, 0x20101f), "-0x1.40203ep+128"}, + {MakeF32(0, 255, 0x20101f), "0x1.40203ep+128f"}, + {MakeF32(1, 255, 0x20101f), "-0x1.40203ep+128f"}, // Scattered bits, with 1 in top mantissa bit. - {MakeFloat(0, 255, 0x40101f), "0x1.80203ep+128"}, - {MakeFloat(1, 255, 0x40101f), "-0x1.80203ep+128"}})); + {MakeF32(0, 255, 0x40101f), "0x1.80203ep+128f"}, + {MakeF32(1, 255, 0x40101f), "-0x1.80203ep+128f"}})); + +using WgslGenerator_F16LiteralTest = TestParamHelper; + +TEST_P(WgslGenerator_F16LiteralTest, Emit) { + Enable(ast::Extension::kF16); + + auto* v = Expr(GetParam().value); + + SetResolveOnBuild(false); + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitLiteral(out, v)) << gen.error(); + EXPECT_EQ(out.str(), GetParam().expected); +} + +INSTANTIATE_TEST_SUITE_P(Zero, + WgslGenerator_F16LiteralTest, + ::testing::ValuesIn(std::vector{{0_h, "0.0h"}, + {MakeF16(0, 0, 0), "0.0h"}, + {MakeF16(1, 0, 0), "-0.0h"}})); + +INSTANTIATE_TEST_SUITE_P(Normal, + WgslGenerator_F16LiteralTest, + ::testing::ValuesIn(std::vector{{1_h, "1.0h"}, + {-1_h, "-1.0h"}, + {101.375_h, "101.375h"}})); + +INSTANTIATE_TEST_SUITE_P(Subnormal, + WgslGenerator_F16LiteralTest, + ::testing::ValuesIn(std::vector{ + {MakeF16(0, 0, 1), "5.96046448e-08h"}, // Smallest + {MakeF16(1, 0, 1), "-5.96046448e-08h"}, + {MakeF16(0, 0, 2), "1.1920929e-07h"}, + {MakeF16(1, 0, 2), "-1.1920929e-07h"}, + {MakeF16(0, 0, 0x3ffu), "6.09755516e-05h"}, // Largest + {MakeF16(1, 0, 0x3ffu), "-6.09755516e-05h"}, // Largest + {MakeF16(0, 0, 0x3afu), "5.620718e-05h"}, // Scattered bits + {MakeF16(1, 0, 0x3afu), "-5.620718e-05h"}, // Scattered bits + {MakeF16(0, 0, 0x2c7u), "4.23789024e-05h"}, // Scattered bits + {MakeF16(1, 0, 0x2c7u), "-4.23789024e-05h"}, // Scattered bits + })); + +INSTANTIATE_TEST_SUITE_P( + // Currently Inf is impossible to be spelled out in literal. + // https://github.com/gpuweb/gpuweb/issues/1769 + DISABLED_Infinity, + WgslGenerator_F16LiteralTest, + ::testing::ValuesIn(std::vector{{MakeF16(0, 31, 0), "0x1p+128h"}, + {MakeF16(1, 31, 0), "-0x1p+128h"}})); + +INSTANTIATE_TEST_SUITE_P( + // Currently NaN is impossible to be spelled out in literal. + // https://github.com/gpuweb/gpuweb/issues/1769 + DISABLED_NaN, + WgslGenerator_F16LiteralTest, + ::testing::ValuesIn(std::vector{ + // LSB only. Smallest mantissa. + {MakeF16(0, 31, 1), "0x1.004p+128h"}, // Smallest mantissa + {MakeF16(1, 31, 1), "-0x1.004p+128h"}, + // MSB only. + {MakeF16(0, 31, 0x200u), "0x1.8p+128h"}, + {MakeF16(1, 31, 0x200u), "-0x1.8p+128h"}, + // All 1s in the mantissa. + {MakeF16(0, 31, 0x3ffu), "0x1.ffcp+128h"}, + {MakeF16(1, 31, 0x3ffu), "-0x1.ffcp+128h"}, + // Scattered bits, with 0 in top mantissa bit. + {MakeF16(0, 31, 0x11fu), "0x1.47cp+128h"}, + {MakeF16(1, 31, 0x11fu), "-0x1.47cp+128h"}, + // Scattered bits, with 1 in top mantissa bit. + {MakeF16(0, 31, 0x23fu), "0x1.8fcp+128h"}, + {MakeF16(1, 31, 0x23fu), "-0x1.8fcp+128h"}})); } // namespace } // namespace tint::writer::wgsl diff --git a/src/tint/writer/wgsl/generator_impl_loop_test.cc b/src/tint/writer/wgsl/generator_impl_loop_test.cc index 2d6a8f4a7a..3570957dd3 100644 --- a/src/tint/writer/wgsl/generator_impl_loop_test.cc +++ b/src/tint/writer/wgsl/generator_impl_loop_test.cc @@ -68,7 +68,7 @@ TEST_F(WgslGeneratorImplTest, Emit_ForLoopWithMultiStmtInit) { // for({ignore(1i); ignore(2i);}; ; ) { // return; // } - Global("a", ty.atomic(), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.atomic(), ast::StorageClass::kWorkgroup); auto* multi_stmt = Block(Ignore(1_i), Ignore(2_i)); auto* f = For(multi_stmt, nullptr, nullptr, Block(Return())); WrapInFunction(f); @@ -132,7 +132,7 @@ TEST_F(WgslGeneratorImplTest, Emit_ForLoopWithMultiStmtCont) { // return; // } - Global("a", ty.atomic(), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.atomic(), ast::StorageClass::kWorkgroup); auto* multi_stmt = Block(Ignore(1_i), Ignore(2_i)); auto* f = For(nullptr, nullptr, multi_stmt, Block(Return())); WrapInFunction(f); @@ -175,7 +175,7 @@ TEST_F(WgslGeneratorImplTest, Emit_ForLoopWithMultiStmtInitCondCont) { // for({ ignore(1i); ignore(2i); }; true; { ignore(3i); ignore(4i); }) { // return; // } - Global("a", ty.atomic(), ast::StorageClass::kWorkgroup); + GlobalVar("a", ty.atomic(), ast::StorageClass::kWorkgroup); auto* multi_stmt_a = Block(Ignore(1_i), Ignore(2_i)); auto* multi_stmt_b = Block(Ignore(3_i), Ignore(4_i)); auto* f = For(multi_stmt_a, Expr(true), multi_stmt_b, Block(Return())); @@ -198,5 +198,64 @@ TEST_F(WgslGeneratorImplTest, Emit_ForLoopWithMultiStmtInitCondCont) { )"); } +TEST_F(WgslGeneratorImplTest, Emit_While) { + // while(true) { + // return; + // } + + auto* f = While(Expr(true), Block(Return())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( while(true) { + return; + } +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_While_WithContinue) { + // while(true) { + // continue; + // } + + auto* f = While(Expr(true), Block(Continue())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( while(true) { + continue; + } +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_WhileMultiCond) { + // while(true && false) { + // return; + // } + + auto* multi_stmt = + create(ast::BinaryOp::kLogicalAnd, Expr(true), Expr(false)); + auto* f = While(multi_stmt, Block(Return())); + WrapInFunction(f); + + GeneratorImpl& gen = Build(); + + gen.increment_indent(); + + ASSERT_TRUE(gen.EmitStatement(f)) << gen.error(); + EXPECT_EQ(gen.result(), R"( while((true && false)) { + return; + } +)"); +} + } // namespace } // namespace tint::writer::wgsl diff --git a/src/tint/writer/wgsl/generator_impl_member_accessor_test.cc b/src/tint/writer/wgsl/generator_impl_member_accessor_test.cc index d8bd3495f1..849f018960 100644 --- a/src/tint/writer/wgsl/generator_impl_member_accessor_test.cc +++ b/src/tint/writer/wgsl/generator_impl_member_accessor_test.cc @@ -20,8 +20,8 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, EmitExpression_MemberAccessor) { - auto* s = Structure("Data", {Member("mem", ty.f32())}); - Global("str", ty.Of(s), ast::StorageClass::kPrivate); + auto* s = Structure("Data", utils::Vector{Member("mem", ty.f32())}); + GlobalVar("str", ty.Of(s), ast::StorageClass::kPrivate); auto* expr = MemberAccessor("str", "mem"); WrapInFunction(expr); @@ -34,10 +34,10 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_MemberAccessor) { } TEST_F(WgslGeneratorImplTest, EmitExpression_MemberAccessor_OfDref) { - auto* s = Structure("Data", {Member("mem", ty.f32())}); - Global("str", ty.Of(s), ast::StorageClass::kPrivate); + auto* s = Structure("Data", utils::Vector{Member("mem", ty.f32())}); + GlobalVar("str", ty.Of(s), ast::StorageClass::kPrivate); - auto* p = Let("p", nullptr, AddressOf("str")); + auto* p = Let("p", AddressOf("str")); auto* expr = MemberAccessor(Deref("p"), "mem"); WrapInFunction(p, expr); diff --git a/src/tint/writer/wgsl/generator_impl_return_test.cc b/src/tint/writer/wgsl/generator_impl_return_test.cc index ed1027d63b..fbbf9ded64 100644 --- a/src/tint/writer/wgsl/generator_impl_return_test.cc +++ b/src/tint/writer/wgsl/generator_impl_return_test.cc @@ -35,7 +35,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Return) { TEST_F(WgslGeneratorImplTest, Emit_ReturnWithValue) { auto* r = Return(123_i); - Func("f", {}, ty.i32(), {r}); + Func("f", utils::Empty, ty.i32(), utils::Vector{r}); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/wgsl/generator_impl_static_assert_test.cc b/src/tint/writer/wgsl/generator_impl_static_assert_test.cc new file mode 100644 index 0000000000..9e7a1c013a --- /dev/null +++ b/src/tint/writer/wgsl/generator_impl_static_assert_test.cc @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/writer/wgsl/test_helper.h" + +using namespace tint::number_suffixes; // NOLINT + +namespace tint::writer::wgsl { +namespace { + +using WgslGeneratorImplTest = TestHelper; + +TEST_F(WgslGeneratorImplTest, Emit_GlobalStaticAssert) { + GlobalStaticAssert(true); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(static_assert true; +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_FunctionStaticAssert) { + Func("f", utils::Empty, ty.void_(), utils::Vector{StaticAssert(true)}); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + EXPECT_EQ(gen.result(), R"(fn f() { + static_assert true; +} +)"); +} + +} // namespace +} // namespace tint::writer::wgsl diff --git a/src/tint/writer/wgsl/generator_impl_switch_test.cc b/src/tint/writer/wgsl/generator_impl_switch_test.cc index 11424f0f83..491660e2da 100644 --- a/src/tint/writer/wgsl/generator_impl_switch_test.cc +++ b/src/tint/writer/wgsl/generator_impl_switch_test.cc @@ -22,21 +22,21 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Switch) { - Global("cond", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("cond", ty.i32(), ast::StorageClass::kPrivate); auto* def_body = Block(create()); - auto* def = create(ast::CaseSelectorList{}, def_body); + auto* def = create(utils::Empty, def_body); - ast::CaseSelectorList case_val; - case_val.push_back(Expr(5_i)); + utils::Vector case_val{Expr(5_i)}; auto* case_body = Block(create()); auto* case_stmt = create(case_val, case_body); - ast::CaseStatementList body; - body.push_back(case_stmt); - body.push_back(def); + utils::Vector body{ + case_stmt, + def, + }; auto* cond = Expr("cond"); auto* s = create(cond, body); diff --git a/src/tint/writer/wgsl/generator_impl_test.cc b/src/tint/writer/wgsl/generator_impl_test.cc index f8972c7086..4d9815887c 100644 --- a/src/tint/writer/wgsl/generator_impl_test.cc +++ b/src/tint/writer/wgsl/generator_impl_test.cc @@ -21,7 +21,7 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Generate) { - Func("my_func", ast::VariableList{}, ty.void_(), ast::StatementList{}, ast::AttributeList{}); + Func("my_func", {}, ty.void_(), {}, {}); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/wgsl/generator_impl_type_test.cc b/src/tint/writer/wgsl/generator_impl_type_test.cc index 0973ffadad..cdba585176 100644 --- a/src/tint/writer/wgsl/generator_impl_type_test.cc +++ b/src/tint/writer/wgsl/generator_impl_type_test.cc @@ -91,6 +91,19 @@ TEST_F(WgslGeneratorImplTest, EmitType_F32) { EXPECT_EQ(out.str(), "f32"); } +TEST_F(WgslGeneratorImplTest, EmitType_F16) { + Enable(ast::Extension::kF16); + + auto* f16 = ty.f16(); + Alias("make_type_reachable", f16); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, f16)) << gen.error(); + EXPECT_EQ(out.str(), "f16"); +} + TEST_F(WgslGeneratorImplTest, EmitType_I32) { auto* i32 = ty.i32(); Alias("make_type_reachable", i32); @@ -102,7 +115,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_I32) { EXPECT_EQ(out.str(), "i32"); } -TEST_F(WgslGeneratorImplTest, EmitType_Matrix) { +TEST_F(WgslGeneratorImplTest, EmitType_Matrix_F32) { auto* mat2x3 = ty.mat2x3(); Alias("make_type_reachable", mat2x3); @@ -113,6 +126,19 @@ TEST_F(WgslGeneratorImplTest, EmitType_Matrix) { EXPECT_EQ(out.str(), "mat2x3"); } +TEST_F(WgslGeneratorImplTest, EmitType_Matrix_F16) { + Enable(ast::Extension::kF16); + + auto* mat2x3 = ty.mat2x3(); + Alias("make_type_reachable", mat2x3); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, mat2x3)) << gen.error(); + EXPECT_EQ(out.str(), "mat2x3"); +} + TEST_F(WgslGeneratorImplTest, EmitType_Pointer) { auto* p = ty.pointer(ast::StorageClass::kWorkgroup); Alias("make_type_reachable", p); @@ -136,7 +162,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_PointerAccessMode) { } TEST_F(WgslGeneratorImplTest, EmitType_Struct) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.f32()), }); @@ -151,9 +177,9 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct) { } TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl) { - auto* s = Structure("S", { - Member("a", ty.i32(), {MemberOffset(8)}), - Member("b", ty.f32(), {MemberOffset(16)}), + auto* s = Structure("S", utils::Vector{ + Member("a", ty.i32(), utils::Vector{MemberOffset(8)}), + Member("b", ty.f32(), utils::Vector{MemberOffset(16)}), }); GeneratorImpl& gen = Build(); @@ -171,10 +197,11 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl) { } TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl_WithSymbolCollisions) { - auto* s = Structure("S", { - Member("tint_0_padding", ty.i32(), {MemberOffset(8)}), - Member("tint_2_padding", ty.f32(), {MemberOffset(16)}), - }); + auto* s = + Structure("S", utils::Vector{ + Member("tint_0_padding", ty.i32(), utils::Vector{MemberOffset(8)}), + Member("tint_2_padding", ty.f32(), utils::Vector{MemberOffset(16)}), + }); GeneratorImpl& gen = Build(); @@ -191,9 +218,9 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl_WithSymbolCollisions) { } TEST_F(WgslGeneratorImplTest, EmitType_StructAlignDecl) { - auto* s = Structure("S", { - Member("a", ty.i32(), {MemberAlign(8)}), - Member("b", ty.f32(), {MemberAlign(16)}), + auto* s = Structure("S", utils::Vector{ + Member("a", ty.i32(), utils::Vector{MemberAlign(8_a)}), + Member("b", ty.f32(), utils::Vector{MemberAlign(16_a)}), }); GeneratorImpl& gen = Build(); @@ -209,9 +236,9 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructAlignDecl) { } TEST_F(WgslGeneratorImplTest, EmitType_StructSizeDecl) { - auto* s = Structure("S", { - Member("a", ty.i32(), {MemberSize(16)}), - Member("b", ty.f32(), {MemberSize(32)}), + auto* s = Structure("S", utils::Vector{ + Member("a", ty.i32(), utils::Vector{MemberSize(16)}), + Member("b", ty.f32(), utils::Vector{MemberSize(32)}), }); GeneratorImpl& gen = Build(); @@ -227,9 +254,9 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructSizeDecl) { } TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithAttribute) { - auto* s = Structure("S", { + auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), - Member("b", ty.f32(), {MemberAlign(8)}), + Member("b", ty.f32(), utils::Vector{MemberAlign(8_a)}), }); GeneratorImpl& gen = Build(); @@ -245,8 +272,10 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithAttribute) { TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithEntryPointAttributes) { auto* s = Structure( - "S", ast::StructMemberList{Member("a", ty.u32(), {Builtin(ast::Builtin::kVertexIndex)}), - Member("b", ty.f32(), {Location(2u)})}); + "S", utils::Vector{ + Member("a", ty.u32(), utils::Vector{Builtin(ast::BuiltinValue::kVertexIndex)}), + Member("b", ty.f32(), utils::Vector{Location(2u)}), + }); GeneratorImpl& gen = Build(); @@ -271,7 +300,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_U32) { EXPECT_EQ(out.str(), "u32"); } -TEST_F(WgslGeneratorImplTest, EmitType_Vector) { +TEST_F(WgslGeneratorImplTest, EmitType_Vector_F32) { auto* vec3 = ty.vec3(); Alias("make_type_reachable", vec3); @@ -282,6 +311,19 @@ TEST_F(WgslGeneratorImplTest, EmitType_Vector) { EXPECT_EQ(out.str(), "vec3"); } +TEST_F(WgslGeneratorImplTest, EmitType_Vector_F16) { + Enable(ast::Extension::kF16); + + auto* vec3 = ty.vec3(); + Alias("make_type_reachable", vec3); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitType(out, vec3)) << gen.error(); + EXPECT_EQ(out.str(), "vec3"); +} + struct TextureData { ast::TextureDimension dim; const char* name; @@ -420,11 +462,7 @@ TEST_P(WgslGenerator_StorageTextureTest, EmitType_StorageTexture) { auto param = GetParam(); auto* t = ty.storage_texture(param.dim, param.fmt, param.access); - Global("g", t, - ast::AttributeList{ - create(1), - create(2), - }); + GlobalVar("g", t, Binding(1), Group(2)); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/wgsl/generator_impl_unary_op_test.cc b/src/tint/writer/wgsl/generator_impl_unary_op_test.cc index 2c46b44621..dadcede9cc 100644 --- a/src/tint/writer/wgsl/generator_impl_unary_op_test.cc +++ b/src/tint/writer/wgsl/generator_impl_unary_op_test.cc @@ -20,7 +20,7 @@ namespace { using WgslUnaryOpTest = TestHelper; TEST_F(WgslUnaryOpTest, AddressOf) { - Global("expr", ty.f32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.f32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kAddressOf, Expr("expr")); WrapInFunction(op); @@ -32,7 +32,7 @@ TEST_F(WgslUnaryOpTest, AddressOf) { } TEST_F(WgslUnaryOpTest, Complement) { - Global("expr", ty.u32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.u32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kComplement, Expr("expr")); WrapInFunction(op); @@ -44,9 +44,8 @@ TEST_F(WgslUnaryOpTest, Complement) { } TEST_F(WgslUnaryOpTest, Indirection) { - Global("G", ty.f32(), ast::StorageClass::kPrivate); - auto* p = - Let("expr", nullptr, create(ast::UnaryOp::kAddressOf, Expr("G"))); + GlobalVar("G", ty.f32(), ast::StorageClass::kPrivate); + auto* p = Let("expr", create(ast::UnaryOp::kAddressOf, Expr("G"))); auto* op = create(ast::UnaryOp::kIndirection, Expr("expr")); WrapInFunction(p, op); @@ -58,7 +57,7 @@ TEST_F(WgslUnaryOpTest, Indirection) { } TEST_F(WgslUnaryOpTest, Not) { - Global("expr", ty.bool_(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.bool_(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kNot, Expr("expr")); WrapInFunction(op); @@ -70,7 +69,7 @@ TEST_F(WgslUnaryOpTest, Not) { } TEST_F(WgslUnaryOpTest, Negation) { - Global("expr", ty.i32(), ast::StorageClass::kPrivate); + GlobalVar("expr", ty.i32(), ast::StorageClass::kPrivate); auto* op = create(ast::UnaryOp::kNegation, Expr("expr")); WrapInFunction(op); diff --git a/src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc b/src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc index a68932cf59..38c98e90d2 100644 --- a/src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc +++ b/src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc @@ -37,7 +37,7 @@ TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement) { } TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_InferredType) { - auto* var = Var("a", nullptr, ast::StorageClass::kNone, Expr(123_i)); + auto* var = Var("a", Expr(123_i)); auto* stmt = Decl(var); WrapInFunction(stmt); @@ -50,5 +50,304 @@ TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_InferredType) { EXPECT_EQ(gen.result(), " var a = 123i;\n"); } +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_AInt) { + auto* C = Const("C", Expr(1_a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = 1; + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_AFloat) { + auto* C = Const("C", Expr(1._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = 1.0; + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_i32) { + auto* C = Const("C", Expr(1_i)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = 1i; + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_u32) { + auto* C = Const("C", Expr(1_u)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = 1u; + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_f32) { + auto* C = Const("C", Expr(1_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = 1.0f; + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", Expr(1_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(enable f16; + +fn f() { + const C = 1.0h; + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_AInt) { + auto* C = Const("C", Construct(ty.vec3(nullptr), 1_a, 2_a, 3_a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = vec3(1, 2, 3); + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_AFloat) { + auto* C = Const("C", Construct(ty.vec3(nullptr), 1._a, 2._a, 3._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = vec3(1.0, 2.0, 3.0); + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_f32) { + auto* C = Const("C", vec3(1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = vec3(1.0f, 2.0f, 3.0f); + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", vec3(1_h, 2_h, 3_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(enable f16; + +fn f() { + const C = vec3(1.0h, 2.0h, 3.0h); + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_AFloat) { + auto* C = Const("C", Construct(ty.mat(nullptr, 2, 3), 1._a, 2._a, 3._a, 4._a, 5._a, 6._a)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = mat2x3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_f32) { + auto* C = Const("C", mat2x3(1_f, 2_f, 3_f, 4_f, 5_f, 6_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = mat2x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f); + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_f16) { + Enable(ast::Extension::kF16); + + auto* C = Const("C", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(enable f16; + +fn f() { + const C = mat2x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h); + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_arr_f32) { + auto* C = Const("C", Construct(ty.array(), 1_f, 2_f, 3_f)); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = array(1.0f, 2.0f, 3.0f); + let l = C; +} +)"); +} + +TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_arr_vec2_bool) { + auto* C = Const("C", Construct(ty.array(ty.vec2(), 3_u), // + vec2(true, false), // + vec2(false, true), // + vec2(true, true))); + Func("f", utils::Empty, ty.void_(), + utils::Vector{ + Decl(C), + Decl(Let("l", Expr(C))), + }); + + GeneratorImpl& gen = Build(); + + ASSERT_TRUE(gen.Generate()) << gen.error(); + + EXPECT_EQ(gen.result(), R"(fn f() { + const C = array, 3u>(vec2(true, false), vec2(false, true), vec2(true, true)); + let l = C; +} +)"); +} } // namespace } // namespace tint::writer::wgsl diff --git a/src/tint/writer/wgsl/generator_impl_variable_test.cc b/src/tint/writer/wgsl/generator_impl_variable_test.cc index 8ebe6c5584..521d3b6034 100644 --- a/src/tint/writer/wgsl/generator_impl_variable_test.cc +++ b/src/tint/writer/wgsl/generator_impl_variable_test.cc @@ -14,13 +14,15 @@ #include "src/tint/writer/wgsl/test_helper.h" +using namespace tint::number_suffixes; // NOLINT + namespace tint::writer::wgsl { namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, EmitVariable) { - auto* v = Global("a", ty.f32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -30,7 +32,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable) { } TEST_F(WgslGeneratorImplTest, EmitVariable_StorageClass) { - auto* v = Global("a", ty.f32(), ast::StorageClass::kPrivate); + auto* v = GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate); GeneratorImpl& gen = Build(); @@ -40,12 +42,9 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_StorageClass) { } TEST_F(WgslGeneratorImplTest, EmitVariable_Access_Read) { - auto* s = Structure("S", {Member("a", ty.i32())}); - auto* v = Global("a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, - ast::AttributeList{ - create(0), - create(0), - }); + auto* s = Structure("S", utils::Vector{Member("a", ty.i32())}); + auto* v = GlobalVar("a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead, Binding(0), + Group(0)); GeneratorImpl& gen = Build(); @@ -54,28 +53,10 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Access_Read) { EXPECT_EQ(out.str(), R"(@binding(0) @group(0) var a : S;)"); } -TEST_F(WgslGeneratorImplTest, EmitVariable_Access_Write) { - auto* s = Structure("S", {Member("a", ty.i32())}); - auto* v = Global("a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kWrite, - ast::AttributeList{ - create(0), - create(0), - }); - - GeneratorImpl& gen = Build(); - - std::stringstream out; - ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error(); - EXPECT_EQ(out.str(), R"(@binding(0) @group(0) var a : S;)"); -} - TEST_F(WgslGeneratorImplTest, EmitVariable_Access_ReadWrite) { - auto* s = Structure("S", {Member("a", ty.i32())}); - auto* v = Global("a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, - ast::AttributeList{ - create(0), - create(0), - }); + auto* s = Structure("S", utils::Vector{Member("a", ty.i32())}); + auto* v = GlobalVar("a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite, + Binding(0), Group(0)); GeneratorImpl& gen = Build(); @@ -85,11 +66,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Access_ReadWrite) { } TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated) { - auto* v = Global("a", ty.sampler(ast::SamplerKind::kSampler), ast::StorageClass::kNone, nullptr, - ast::AttributeList{ - create(1), - create(2), - }); + auto* v = GlobalVar("a", ty.sampler(ast::SamplerKind::kSampler), Group(1), Binding(2)); GeneratorImpl& gen = Build(); @@ -99,24 +76,57 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated) { } TEST_F(WgslGeneratorImplTest, EmitVariable_Constructor) { - auto* v = Global("a", ty.f32(), ast::StorageClass::kPrivate, Expr(1.0f)); + auto* v = GlobalVar("a", ty.f32(), ast::StorageClass::kPrivate, Expr(1_f)); GeneratorImpl& gen = Build(); std::stringstream out; ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error(); - EXPECT_EQ(out.str(), R"(var a : f32 = 1.0;)"); + EXPECT_EQ(out.str(), R"(var a : f32 = 1.0f;)"); } -TEST_F(WgslGeneratorImplTest, EmitVariable_Const) { - auto* v = Let("a", ty.f32(), Expr(1.0f)); - WrapInFunction(Decl(v)); +TEST_F(WgslGeneratorImplTest, EmitVariable_Let_Explicit) { + auto* v = Let("a", ty.f32(), Expr(1_f)); + WrapInFunction(v); GeneratorImpl& gen = Build(); std::stringstream out; ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error(); - EXPECT_EQ(out.str(), R"(let a : f32 = 1.0;)"); + EXPECT_EQ(out.str(), R"(let a : f32 = 1.0f;)"); +} + +TEST_F(WgslGeneratorImplTest, EmitVariable_Let_Inferred) { + auto* v = Let("a", Expr(1_f)); + WrapInFunction(v); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error(); + EXPECT_EQ(out.str(), R"(let a = 1.0f;)"); +} + +TEST_F(WgslGeneratorImplTest, EmitVariable_Const_Explicit) { + auto* v = Const("a", ty.f32(), Expr(1_f)); + WrapInFunction(v); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error(); + EXPECT_EQ(out.str(), R"(const a : f32 = 1.0f;)"); +} + +TEST_F(WgslGeneratorImplTest, EmitVariable_Const_Inferred) { + auto* v = Const("a", Expr(1_f)); + WrapInFunction(v); + + GeneratorImpl& gen = Build(); + + std::stringstream out; + ASSERT_TRUE(gen.EmitVariable(out, v)) << gen.error(); + EXPECT_EQ(out.str(), R"(const a = 1.0f;)"); } } // namespace diff --git a/test/tint/BUILD.gn b/test/tint/BUILD.gn deleted file mode 100644 index bed8729b43..0000000000 --- a/test/tint/BUILD.gn +++ /dev/null @@ -1,822 +0,0 @@ -# Copyright 2022 The Dawn & Tint Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/build.gni") -import("//testing/test.gni") -import("../../tint_overrides_with_defaults.gni") - -############################################################################### -# Gtest Gmock - Handle building inside and outside of Chromium. -############################################################################### -# When building outside of Chromium we need to define our own targets for GTest -# and GMock. However when compiling inside of Chromium we need to reuse the -# existing targets, both because Chromium has a special harness for swarming -# and because otherwise the "gn check" fails. - -if (!build_with_chromium) { - # When we aren't in Chromium we define out own targets based on the location - # of the googletest repo. - config("gtest_config") { - include_dirs = [ - "${tint_googletest_dir}/googletest", - "${tint_googletest_dir}/googletest/include", - ] - } - static_library("gtest") { - testonly = true - sources = [ "${tint_googletest_dir}/googletest/src/gtest-all.cc" ] - public_configs = [ ":gtest_config" ] - } - - config("gmock_config") { - include_dirs = [ - "${tint_googletest_dir}/googlemock", - "${tint_googletest_dir}/googlemock/include", - "${tint_googletest_dir}/googletest/include", - ] - } - - static_library("gmock") { - testonly = true - sources = [ "${tint_googletest_dir}/googlemock/src/gmock-all.cc" ] - public_configs = [ ":gmock_config" ] - } - - group("gmock_and_gtest") { - testonly = true - public_deps = [ - ":gmock", - ":gtest", - ] - } -} else { - # When we are in Chromium we reuse its targets, and also add some deps that - # are needed to launch the test in swarming mode. - group("gmock_and_gtest") { - testonly = true - public_deps = [ - "//base", - "//base/test:test_support", - "//testing/gmock", - "//testing/gtest", - "//third_party/googletest:gmock", - ] - } -} - -############################################################################### -# Wrapping of Chromium targets -############################################################################### -# These targets are separated because they are Chromium sources files that -# can't use the tint_internal config, otherwise Tint's warning flags get -# applied while compiling a bunch of Chromium's //base (via header inclusion) -source_set("tint_unittests_main") { - testonly = true - deps = [ ":gmock_and_gtest" ] - if (build_with_chromium) { - sources = [ "//gpu/tint_unittests_main.cc" ] - } else { - sources = [ "../../src/tint/test_main.cc" ] - configs += [ ":tint_unittests_config" ] - deps += [ - ":tint_unittests_hlsl_writer_src", - ":tint_unittests_msl_writer_src", - ":tint_unittests_spv_reader_src", - "${tint_root_dir}/src/tint:libtint", - ] - } -} - -############################################################################### -# Tests - For libtint core and optional modules -############################################################################### -config("tint_unittests_config") { - include_dirs = [ - "${tint_googletest_dir}/googlemock/include", - "${tint_googletest_dir}/googletest/include", - ] - - configs = [ - "${tint_root_dir}/src/tint:tint_common_config", - "${tint_root_dir}/src/tint:tint_public_config", - ] -} - -template("tint_unittests_source_set") { - source_set(target_name) { - forward_variables_from(invoker, "*", [ "configs" ]) - - if (defined(invoker.configs)) { - configs += invoker.configs - } - configs += [ ":tint_unittests_config" ] - if (build_with_chromium) { - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - } - - testonly = true - - if (!defined(invoker.deps)) { - deps = [] - } - deps += [ - ":gmock_and_gtest", - "${tint_root_dir}/src/tint:libtint", - "${tint_root_dir}/src/tint:tint_utils_io", - ] - } -} - -tint_unittests_source_set("tint_unittests_ast_src") { - sources = [ - "../../src/tint/ast/alias_test.cc", - "../../src/tint/ast/array_test.cc", - "../../src/tint/ast/assignment_statement_test.cc", - "../../src/tint/ast/atomic_test.cc", - "../../src/tint/ast/binary_expression_test.cc", - "../../src/tint/ast/binding_attribute_test.cc", - "../../src/tint/ast/bitcast_expression_test.cc", - "../../src/tint/ast/block_statement_test.cc", - "../../src/tint/ast/bool_literal_expression_test.cc", - "../../src/tint/ast/bool_test.cc", - "../../src/tint/ast/break_statement_test.cc", - "../../src/tint/ast/builtin_attribute_test.cc", - "../../src/tint/ast/builtin_texture_helper_test.cc", - "../../src/tint/ast/builtin_texture_helper_test.h", - "../../src/tint/ast/call_expression_test.cc", - "../../src/tint/ast/call_statement_test.cc", - "../../src/tint/ast/case_statement_test.cc", - "../../src/tint/ast/compound_assignment_statement_test.cc", - "../../src/tint/ast/continue_statement_test.cc", - "../../src/tint/ast/depth_multisampled_texture_test.cc", - "../../src/tint/ast/depth_texture_test.cc", - "../../src/tint/ast/discard_statement_test.cc", - "../../src/tint/ast/enable_test.cc", - "../../src/tint/ast/external_texture_test.cc", - "../../src/tint/ast/f32_test.cc", - "../../src/tint/ast/fallthrough_statement_test.cc", - "../../src/tint/ast/float_literal_expression_test.cc", - "../../src/tint/ast/for_loop_statement_test.cc", - "../../src/tint/ast/function_test.cc", - "../../src/tint/ast/group_attribute_test.cc", - "../../src/tint/ast/i32_test.cc", - "../../src/tint/ast/id_attribute_test.cc", - "../../src/tint/ast/identifier_expression_test.cc", - "../../src/tint/ast/if_statement_test.cc", - "../../src/tint/ast/increment_decrement_statement_test.cc", - "../../src/tint/ast/index_accessor_expression_test.cc", - "../../src/tint/ast/int_literal_expression_test.cc", - "../../src/tint/ast/interpolate_attribute_test.cc", - "../../src/tint/ast/invariant_attribute_test.cc", - "../../src/tint/ast/location_attribute_test.cc", - "../../src/tint/ast/loop_statement_test.cc", - "../../src/tint/ast/matrix_test.cc", - "../../src/tint/ast/member_accessor_expression_test.cc", - "../../src/tint/ast/module_clone_test.cc", - "../../src/tint/ast/module_test.cc", - "../../src/tint/ast/multisampled_texture_test.cc", - "../../src/tint/ast/phony_expression_test.cc", - "../../src/tint/ast/pointer_test.cc", - "../../src/tint/ast/return_statement_test.cc", - "../../src/tint/ast/sampled_texture_test.cc", - "../../src/tint/ast/sampler_test.cc", - "../../src/tint/ast/stage_attribute_test.cc", - "../../src/tint/ast/storage_texture_test.cc", - "../../src/tint/ast/stride_attribute_test.cc", - "../../src/tint/ast/struct_member_align_attribute_test.cc", - "../../src/tint/ast/struct_member_offset_attribute_test.cc", - "../../src/tint/ast/struct_member_size_attribute_test.cc", - "../../src/tint/ast/struct_member_test.cc", - "../../src/tint/ast/struct_test.cc", - "../../src/tint/ast/switch_statement_test.cc", - "../../src/tint/ast/test_helper.h", - "../../src/tint/ast/texture_test.cc", - "../../src/tint/ast/traverse_expressions_test.cc", - "../../src/tint/ast/u32_test.cc", - "../../src/tint/ast/unary_op_expression_test.cc", - "../../src/tint/ast/variable_decl_statement_test.cc", - "../../src/tint/ast/variable_test.cc", - "../../src/tint/ast/vector_test.cc", - "../../src/tint/ast/workgroup_attribute_test.cc", - ] -} - -tint_unittests_source_set("tint_unittests_diagnostic_src") { - sources = [ - "../../src/tint/diagnostic/diagnostic_test.cc", - "../../src/tint/diagnostic/formatter_test.cc", - "../../src/tint/diagnostic/printer_test.cc", - ] -} - -tint_unittests_source_set("tint_unittests_inspector_src") { - sources = [ - "../../src/tint/inspector/inspector_test.cc", - "../../src/tint/inspector/test_inspector_builder.cc", - "../../src/tint/inspector/test_inspector_builder.h", - "../../src/tint/inspector/test_inspector_runner.cc", - "../../src/tint/inspector/test_inspector_runner.h", - ] -} - -tint_unittests_source_set("tint_unittests_resolver_src") { - sources = [ - "../../src/tint/resolver/array_accessor_test.cc", - "../../src/tint/resolver/assignment_validation_test.cc", - "../../src/tint/resolver/atomics_test.cc", - "../../src/tint/resolver/atomics_validation_test.cc", - "../../src/tint/resolver/attribute_validation_test.cc", - "../../src/tint/resolver/bitcast_validation_test.cc", - "../../src/tint/resolver/builtin_test.cc", - "../../src/tint/resolver/builtin_validation_test.cc", - "../../src/tint/resolver/builtins_validation_test.cc", - "../../src/tint/resolver/call_test.cc", - "../../src/tint/resolver/call_validation_test.cc", - "../../src/tint/resolver/compound_assignment_validation_test.cc", - "../../src/tint/resolver/compound_statement_test.cc", - "../../src/tint/resolver/control_block_validation_test.cc", - "../../src/tint/resolver/dependency_graph_test.cc", - "../../src/tint/resolver/entry_point_validation_test.cc", - "../../src/tint/resolver/function_validation_test.cc", - "../../src/tint/resolver/host_shareable_validation_test.cc", - "../../src/tint/resolver/increment_decrement_validation_test.cc", - "../../src/tint/resolver/intrinsic_table_test.cc", - "../../src/tint/resolver/is_host_shareable_test.cc", - "../../src/tint/resolver/is_storeable_test.cc", - "../../src/tint/resolver/pipeline_overridable_constant_test.cc", - "../../src/tint/resolver/ptr_ref_test.cc", - "../../src/tint/resolver/ptr_ref_validation_test.cc", - "../../src/tint/resolver/resolver_behavior_test.cc", - "../../src/tint/resolver/resolver_constants_test.cc", - "../../src/tint/resolver/resolver_test.cc", - "../../src/tint/resolver/resolver_test_helper.cc", - "../../src/tint/resolver/resolver_test_helper.h", - "../../src/tint/resolver/side_effects_test.cc", - "../../src/tint/resolver/source_variable_test.cc", - "../../src/tint/resolver/storage_class_layout_validation_test.cc", - "../../src/tint/resolver/storage_class_validation_test.cc", - "../../src/tint/resolver/struct_layout_test.cc", - "../../src/tint/resolver/struct_pipeline_stage_use_test.cc", - "../../src/tint/resolver/struct_storage_class_use_test.cc", - "../../src/tint/resolver/type_constructor_validation_test.cc", - "../../src/tint/resolver/type_validation_test.cc", - "../../src/tint/resolver/validation_test.cc", - "../../src/tint/resolver/validator_is_storeable_test.cc", - "../../src/tint/resolver/var_let_test.cc", - "../../src/tint/resolver/var_let_validation_test.cc", - ] - deps = [ ":tint_unittests_ast_src" ] -} - -tint_unittests_source_set("tint_unittests_sem_src") { - sources = [ - "../../src/tint/sem/atomic_test.cc", - "../../src/tint/sem/bool_test.cc", - "../../src/tint/sem/builtin_test.cc", - "../../src/tint/sem/depth_multisampled_texture_test.cc", - "../../src/tint/sem/depth_texture_test.cc", - "../../src/tint/sem/external_texture_test.cc", - "../../src/tint/sem/f32_test.cc", - "../../src/tint/sem/i32_test.cc", - "../../src/tint/sem/matrix_test.cc", - "../../src/tint/sem/multisampled_texture_test.cc", - "../../src/tint/sem/pointer_test.cc", - "../../src/tint/sem/reference_test.cc", - "../../src/tint/sem/sampled_texture_test.cc", - "../../src/tint/sem/sampler_test.cc", - "../../src/tint/sem/sem_array_test.cc", - "../../src/tint/sem/sem_struct_test.cc", - "../../src/tint/sem/storage_texture_test.cc", - "../../src/tint/sem/texture_test.cc", - "../../src/tint/sem/type_manager_test.cc", - "../../src/tint/sem/u32_test.cc", - "../../src/tint/sem/vector_test.cc", - ] -} - -tint_unittests_source_set("tint_unittests_text_src") { - sources = [ "../../src/tint/text/unicode_test.cc" ] -} - -tint_unittests_source_set("tint_unittests_transform_src") { - sources = [ - "../../src/tint/transform/add_empty_entry_point_test.cc", - "../../src/tint/transform/add_spirv_block_attribute_test.cc", - "../../src/tint/transform/array_length_from_uniform_test.cc", - "../../src/tint/transform/binding_remapper_test.cc", - "../../src/tint/transform/builtin_polyfill_test.cc", - "../../src/tint/transform/calculate_array_length_test.cc", - "../../src/tint/transform/canonicalize_entry_point_io_test.cc", - "../../src/tint/transform/combine_samplers_test.cc", - "../../src/tint/transform/decompose_memory_access_test.cc", - "../../src/tint/transform/decompose_strided_array_test.cc", - "../../src/tint/transform/decompose_strided_matrix_test.cc", - "../../src/tint/transform/expand_compound_assignment_test.cc", - "../../src/tint/transform/first_index_offset_test.cc", - "../../src/tint/transform/fold_constants_test.cc", - "../../src/tint/transform/fold_trivial_single_use_lets_test.cc", - "../../src/tint/transform/for_loop_to_loop_test.cc", - "../../src/tint/transform/localize_struct_array_assignment_test.cc", - "../../src/tint/transform/loop_to_for_loop_test.cc", - "../../src/tint/transform/module_scope_var_to_entry_point_param_test.cc", - "../../src/tint/transform/multiplanar_external_texture_test.cc", - "../../src/tint/transform/num_workgroups_from_uniform_test.cc", - "../../src/tint/transform/promote_initializers_to_const_var_test.cc", - "../../src/tint/transform/promote_side_effects_to_decl_test.cc", - "../../src/tint/transform/remove_continue_in_switch_test.cc", - "../../src/tint/transform/remove_phonies_test.cc", - "../../src/tint/transform/remove_unreachable_statements_test.cc", - "../../src/tint/transform/renamer_test.cc", - "../../src/tint/transform/robustness_test.cc", - "../../src/tint/transform/simplify_pointers_test.cc", - "../../src/tint/transform/single_entry_point_test.cc", - "../../src/tint/transform/test_helper.h", - "../../src/tint/transform/transform_test.cc", - "../../src/tint/transform/unshadow_test.cc", - "../../src/tint/transform/unwind_discard_functions_test.cc", - "../../src/tint/transform/utils/get_insertion_point_test.cc", - "../../src/tint/transform/utils/hoist_to_decl_before_test.cc", - "../../src/tint/transform/var_for_dynamic_index_test.cc", - "../../src/tint/transform/vectorize_scalar_matrix_constructors_test.cc", - "../../src/tint/transform/vertex_pulling_test.cc", - "../../src/tint/transform/wrap_arrays_in_structs_test.cc", - "../../src/tint/transform/zero_init_workgroup_memory_test.cc", - ] -} - -tint_unittests_source_set("tint_unittests_utils_src") { - sources = [ - "../../src/tint/utils/bitcast_test.cc", - "../../src/tint/utils/crc32_test.cc", - "../../src/tint/utils/defer_test.cc", - "../../src/tint/utils/enum_set_test.cc", - "../../src/tint/utils/hash_test.cc", - "../../src/tint/utils/io/command_test.cc", - "../../src/tint/utils/io/tmpfile_test.cc", - "../../src/tint/utils/map_test.cc", - "../../src/tint/utils/math_test.cc", - "../../src/tint/utils/reverse_test.cc", - "../../src/tint/utils/scoped_assignment_test.cc", - "../../src/tint/utils/string_test.cc", - "../../src/tint/utils/transform_test.cc", - "../../src/tint/utils/unique_allocator_test.cc", - "../../src/tint/utils/unique_vector_test.cc", - ] -} - -tint_unittests_source_set("tint_unittests_writer_src") { - sources = [ - "../../src/tint/writer/append_vector_test.cc", - "../../src/tint/writer/flatten_bindings_test.cc", - "../../src/tint/writer/float_to_string_test.cc", - "../../src/tint/writer/generate_external_texture_bindings_test.cc", - "../../src/tint/writer/text_generator_test.cc", - ] -} - -tint_unittests_source_set("tint_unittests_spv_reader_src") { - sources = [ - "../../src/tint/reader/spirv/enum_converter_test.cc", - "../../src/tint/reader/spirv/fail_stream_test.cc", - "../../src/tint/reader/spirv/function_arithmetic_test.cc", - "../../src/tint/reader/spirv/function_bit_test.cc", - "../../src/tint/reader/spirv/function_call_test.cc", - "../../src/tint/reader/spirv/function_cfg_test.cc", - "../../src/tint/reader/spirv/function_composite_test.cc", - "../../src/tint/reader/spirv/function_conversion_test.cc", - "../../src/tint/reader/spirv/function_decl_test.cc", - "../../src/tint/reader/spirv/function_glsl_std_450_test.cc", - "../../src/tint/reader/spirv/function_logical_test.cc", - "../../src/tint/reader/spirv/function_memory_test.cc", - "../../src/tint/reader/spirv/function_misc_test.cc", - "../../src/tint/reader/spirv/function_var_test.cc", - "../../src/tint/reader/spirv/namer_test.cc", - "../../src/tint/reader/spirv/parser_impl_barrier_test.cc", - "../../src/tint/reader/spirv/parser_impl_convert_member_decoration_test.cc", - "../../src/tint/reader/spirv/parser_impl_convert_type_test.cc", - "../../src/tint/reader/spirv/parser_impl_function_decl_test.cc", - "../../src/tint/reader/spirv/parser_impl_get_decorations_test.cc", - "../../src/tint/reader/spirv/parser_impl_handle_test.cc", - "../../src/tint/reader/spirv/parser_impl_import_test.cc", - "../../src/tint/reader/spirv/parser_impl_module_var_test.cc", - "../../src/tint/reader/spirv/parser_impl_named_types_test.cc", - "../../src/tint/reader/spirv/parser_impl_test.cc", - "../../src/tint/reader/spirv/parser_impl_test_helper.cc", - "../../src/tint/reader/spirv/parser_impl_test_helper.h", - "../../src/tint/reader/spirv/parser_impl_user_name_test.cc", - "../../src/tint/reader/spirv/parser_test.cc", - "../../src/tint/reader/spirv/parser_type_test.cc", - "../../src/tint/reader/spirv/spirv_tools_helpers_test.cc", - "../../src/tint/reader/spirv/spirv_tools_helpers_test.h", - "../../src/tint/reader/spirv/usage_test.cc", - ] - - deps = [ "${tint_root_dir}/src/tint:libtint_spv_reader_src" ] -} - -tint_unittests_source_set("tint_unittests_spv_writer_src") { - sources = [ - "../../src/tint/writer/spirv/binary_writer_test.cc", - "../../src/tint/writer/spirv/builder_accessor_expression_test.cc", - "../../src/tint/writer/spirv/builder_assign_test.cc", - "../../src/tint/writer/spirv/builder_binary_expression_test.cc", - "../../src/tint/writer/spirv/builder_bitcast_expression_test.cc", - "../../src/tint/writer/spirv/builder_block_test.cc", - "../../src/tint/writer/spirv/builder_builtin_test.cc", - "../../src/tint/writer/spirv/builder_builtin_texture_test.cc", - "../../src/tint/writer/spirv/builder_call_test.cc", - "../../src/tint/writer/spirv/builder_constructor_expression_test.cc", - "../../src/tint/writer/spirv/builder_discard_test.cc", - "../../src/tint/writer/spirv/builder_entry_point_test.cc", - "../../src/tint/writer/spirv/builder_format_conversion_test.cc", - "../../src/tint/writer/spirv/builder_function_attribute_test.cc", - "../../src/tint/writer/spirv/builder_function_test.cc", - "../../src/tint/writer/spirv/builder_function_variable_test.cc", - "../../src/tint/writer/spirv/builder_global_variable_test.cc", - "../../src/tint/writer/spirv/builder_ident_expression_test.cc", - "../../src/tint/writer/spirv/builder_if_test.cc", - "../../src/tint/writer/spirv/builder_literal_test.cc", - "../../src/tint/writer/spirv/builder_loop_test.cc", - "../../src/tint/writer/spirv/builder_return_test.cc", - "../../src/tint/writer/spirv/builder_switch_test.cc", - "../../src/tint/writer/spirv/builder_test.cc", - "../../src/tint/writer/spirv/builder_type_test.cc", - "../../src/tint/writer/spirv/builder_unary_op_expression_test.cc", - "../../src/tint/writer/spirv/instruction_test.cc", - "../../src/tint/writer/spirv/operand_test.cc", - "../../src/tint/writer/spirv/scalar_constant_test.cc", - "../../src/tint/writer/spirv/spv_dump.cc", - "../../src/tint/writer/spirv/spv_dump.h", - "../../src/tint/writer/spirv/test_helper.h", - ] - - deps = [ - ":tint_unittests_ast_src", - "${tint_root_dir}/src/tint:libtint_spv_writer_src", - "${tint_spirv_tools_dir}/:spvtools", - ] -} - -tint_unittests_source_set("tint_unittests_wgsl_reader_src") { - sources = [ - "../../src/tint/reader/wgsl/lexer_test.cc", - "../../src/tint/reader/wgsl/parser_impl_additive_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_and_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_argument_expression_list_test.cc", - "../../src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_body_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_break_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_bug_cases_test.cc", - "../../src/tint/reader/wgsl/parser_impl_call_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_case_body_test.cc", - "../../src/tint/reader/wgsl/parser_impl_const_expr_test.cc", - "../../src/tint/reader/wgsl/parser_impl_const_literal_test.cc", - "../../src/tint/reader/wgsl/parser_impl_continue_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_continuing_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_depth_texture_test.cc", - "../../src/tint/reader/wgsl/parser_impl_enable_directive_test.cc", - "../../src/tint/reader/wgsl/parser_impl_equality_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_error_msg_test.cc", - "../../src/tint/reader/wgsl/parser_impl_error_resync_test.cc", - "../../src/tint/reader/wgsl/parser_impl_exclusive_or_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_external_texture_test.cc", - "../../src/tint/reader/wgsl/parser_impl_for_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_function_attribute_list_test.cc", - "../../src/tint/reader/wgsl/parser_impl_function_attribute_test.cc", - "../../src/tint/reader/wgsl/parser_impl_function_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_function_header_test.cc", - "../../src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_global_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_if_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_inclusive_or_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_increment_decrement_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_logical_and_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_logical_or_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_loop_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_multiplicative_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_param_list_test.cc", - "../../src/tint/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_pipeline_stage_test.cc", - "../../src/tint/reader/wgsl/parser_impl_primary_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_relational_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_reserved_keyword_test.cc", - "../../src/tint/reader/wgsl/parser_impl_sampled_texture_test.cc", - "../../src/tint/reader/wgsl/parser_impl_sampler_test.cc", - "../../src/tint/reader/wgsl/parser_impl_shift_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_singular_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_statement_test.cc", - "../../src/tint/reader/wgsl/parser_impl_statements_test.cc", - "../../src/tint/reader/wgsl/parser_impl_storage_class_test.cc", - "../../src/tint/reader/wgsl/parser_impl_storage_texture_test.cc", - "../../src/tint/reader/wgsl/parser_impl_struct_attribute_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_struct_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_struct_member_attribute_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_struct_member_attribute_test.cc", - "../../src/tint/reader/wgsl/parser_impl_struct_member_test.cc", - "../../src/tint/reader/wgsl/parser_impl_switch_body_test.cc", - "../../src/tint/reader/wgsl/parser_impl_switch_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_impl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_test_helper.cc", - "../../src/tint/reader/wgsl/parser_impl_test_helper.h", - "../../src/tint/reader/wgsl/parser_impl_texel_format_test.cc", - "../../src/tint/reader/wgsl/parser_impl_texture_sampler_test.cc", - "../../src/tint/reader/wgsl/parser_impl_type_alias_test.cc", - "../../src/tint/reader/wgsl/parser_impl_type_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_unary_expression_test.cc", - "../../src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc", - "../../src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc", - "../../src/tint/reader/wgsl/parser_impl_variable_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc", - "../../src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc", - "../../src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc", - "../../src/tint/reader/wgsl/parser_test.cc", - "../../src/tint/reader/wgsl/token_test.cc", - ] - - deps = [ "${tint_root_dir}/src/tint:libtint_wgsl_reader_src" ] -} - -tint_unittests_source_set("tint_unittests_wgsl_writer_src") { - sources = [ - "../../src/tint/writer/wgsl/generator_impl_alias_type_test.cc", - "../../src/tint/writer/wgsl/generator_impl_array_accessor_test.cc", - "../../src/tint/writer/wgsl/generator_impl_assign_test.cc", - "../../src/tint/writer/wgsl/generator_impl_binary_test.cc", - "../../src/tint/writer/wgsl/generator_impl_bitcast_test.cc", - "../../src/tint/writer/wgsl/generator_impl_block_test.cc", - "../../src/tint/writer/wgsl/generator_impl_break_test.cc", - "../../src/tint/writer/wgsl/generator_impl_call_test.cc", - "../../src/tint/writer/wgsl/generator_impl_case_test.cc", - "../../src/tint/writer/wgsl/generator_impl_cast_test.cc", - "../../src/tint/writer/wgsl/generator_impl_constructor_test.cc", - "../../src/tint/writer/wgsl/generator_impl_continue_test.cc", - "../../src/tint/writer/wgsl/generator_impl_discard_test.cc", - "../../src/tint/writer/wgsl/generator_impl_enable_test.cc", - "../../src/tint/writer/wgsl/generator_impl_fallthrough_test.cc", - "../../src/tint/writer/wgsl/generator_impl_function_test.cc", - "../../src/tint/writer/wgsl/generator_impl_global_decl_test.cc", - "../../src/tint/writer/wgsl/generator_impl_identifier_test.cc", - "../../src/tint/writer/wgsl/generator_impl_if_test.cc", - "../../src/tint/writer/wgsl/generator_impl_literal_test.cc", - "../../src/tint/writer/wgsl/generator_impl_loop_test.cc", - "../../src/tint/writer/wgsl/generator_impl_member_accessor_test.cc", - "../../src/tint/writer/wgsl/generator_impl_return_test.cc", - "../../src/tint/writer/wgsl/generator_impl_switch_test.cc", - "../../src/tint/writer/wgsl/generator_impl_test.cc", - "../../src/tint/writer/wgsl/generator_impl_type_test.cc", - "../../src/tint/writer/wgsl/generator_impl_unary_op_test.cc", - "../../src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc", - "../../src/tint/writer/wgsl/generator_impl_variable_test.cc", - "../../src/tint/writer/wgsl/test_helper.h", - ] - - deps = [ - ":tint_unittests_ast_src", - "${tint_root_dir}/src/tint:libtint_wgsl_writer_src", - ] -} - -tint_unittests_source_set("tint_unittests_msl_writer_src") { - sources = [ - "../../src/tint/writer/msl/generator_impl_array_accessor_test.cc", - "../../src/tint/writer/msl/generator_impl_assign_test.cc", - "../../src/tint/writer/msl/generator_impl_binary_test.cc", - "../../src/tint/writer/msl/generator_impl_bitcast_test.cc", - "../../src/tint/writer/msl/generator_impl_block_test.cc", - "../../src/tint/writer/msl/generator_impl_break_test.cc", - "../../src/tint/writer/msl/generator_impl_builtin_test.cc", - "../../src/tint/writer/msl/generator_impl_builtin_texture_test.cc", - "../../src/tint/writer/msl/generator_impl_call_test.cc", - "../../src/tint/writer/msl/generator_impl_case_test.cc", - "../../src/tint/writer/msl/generator_impl_cast_test.cc", - "../../src/tint/writer/msl/generator_impl_constructor_test.cc", - "../../src/tint/writer/msl/generator_impl_continue_test.cc", - "../../src/tint/writer/msl/generator_impl_discard_test.cc", - "../../src/tint/writer/msl/generator_impl_function_test.cc", - "../../src/tint/writer/msl/generator_impl_identifier_test.cc", - "../../src/tint/writer/msl/generator_impl_if_test.cc", - "../../src/tint/writer/msl/generator_impl_import_test.cc", - "../../src/tint/writer/msl/generator_impl_loop_test.cc", - "../../src/tint/writer/msl/generator_impl_member_accessor_test.cc", - "../../src/tint/writer/msl/generator_impl_module_constant_test.cc", - "../../src/tint/writer/msl/generator_impl_return_test.cc", - "../../src/tint/writer/msl/generator_impl_sanitizer_test.cc", - "../../src/tint/writer/msl/generator_impl_switch_test.cc", - "../../src/tint/writer/msl/generator_impl_test.cc", - "../../src/tint/writer/msl/generator_impl_type_test.cc", - "../../src/tint/writer/msl/generator_impl_unary_op_test.cc", - "../../src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc", - "../../src/tint/writer/msl/test_helper.h", - ] - - deps = [ - ":tint_unittests_ast_src", - "${tint_root_dir}/src/tint:libtint_msl_writer_src", - ] -} - -tint_unittests_source_set("tint_unittests_hlsl_writer_src") { - sources = [ - "../../src/tint/writer/hlsl/generator_impl_array_accessor_test.cc", - "../../src/tint/writer/hlsl/generator_impl_assign_test.cc", - "../../src/tint/writer/hlsl/generator_impl_binary_test.cc", - "../../src/tint/writer/hlsl/generator_impl_bitcast_test.cc", - "../../src/tint/writer/hlsl/generator_impl_block_test.cc", - "../../src/tint/writer/hlsl/generator_impl_break_test.cc", - "../../src/tint/writer/hlsl/generator_impl_builtin_test.cc", - "../../src/tint/writer/hlsl/generator_impl_builtin_texture_test.cc", - "../../src/tint/writer/hlsl/generator_impl_call_test.cc", - "../../src/tint/writer/hlsl/generator_impl_case_test.cc", - "../../src/tint/writer/hlsl/generator_impl_cast_test.cc", - "../../src/tint/writer/hlsl/generator_impl_constructor_test.cc", - "../../src/tint/writer/hlsl/generator_impl_continue_test.cc", - "../../src/tint/writer/hlsl/generator_impl_discard_test.cc", - "../../src/tint/writer/hlsl/generator_impl_function_test.cc", - "../../src/tint/writer/hlsl/generator_impl_identifier_test.cc", - "../../src/tint/writer/hlsl/generator_impl_if_test.cc", - "../../src/tint/writer/hlsl/generator_impl_import_test.cc", - "../../src/tint/writer/hlsl/generator_impl_loop_test.cc", - "../../src/tint/writer/hlsl/generator_impl_member_accessor_test.cc", - "../../src/tint/writer/hlsl/generator_impl_module_constant_test.cc", - "../../src/tint/writer/hlsl/generator_impl_return_test.cc", - "../../src/tint/writer/hlsl/generator_impl_sanitizer_test.cc", - "../../src/tint/writer/hlsl/generator_impl_switch_test.cc", - "../../src/tint/writer/hlsl/generator_impl_test.cc", - "../../src/tint/writer/hlsl/generator_impl_type_test.cc", - "../../src/tint/writer/hlsl/generator_impl_unary_op_test.cc", - "../../src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc", - "../../src/tint/writer/hlsl/generator_impl_workgroup_var_test.cc", - "../../src/tint/writer/hlsl/test_helper.h", - ] - - deps = [ - ":tint_unittests_ast_src", - "${tint_root_dir}/src/tint:libtint_hlsl_writer_src", - ] -} - -tint_unittests_source_set("tint_unittests_glsl_writer_src") { - sources = [ - "../../src/tint/writer/glsl/generator_impl_array_accessor_test.cc", - "../../src/tint/writer/glsl/generator_impl_assign_test.cc", - "../../src/tint/writer/glsl/generator_impl_binary_test.cc", - "../../src/tint/writer/glsl/generator_impl_bitcast_test.cc", - "../../src/tint/writer/glsl/generator_impl_block_test.cc", - "../../src/tint/writer/glsl/generator_impl_break_test.cc", - "../../src/tint/writer/glsl/generator_impl_builtin_test.cc", - "../../src/tint/writer/glsl/generator_impl_builtin_texture_test.cc", - "../../src/tint/writer/glsl/generator_impl_call_test.cc", - "../../src/tint/writer/glsl/generator_impl_case_test.cc", - "../../src/tint/writer/glsl/generator_impl_cast_test.cc", - "../../src/tint/writer/glsl/generator_impl_constructor_test.cc", - "../../src/tint/writer/glsl/generator_impl_continue_test.cc", - "../../src/tint/writer/glsl/generator_impl_discard_test.cc", - "../../src/tint/writer/glsl/generator_impl_function_test.cc", - "../../src/tint/writer/glsl/generator_impl_identifier_test.cc", - "../../src/tint/writer/glsl/generator_impl_if_test.cc", - "../../src/tint/writer/glsl/generator_impl_import_test.cc", - "../../src/tint/writer/glsl/generator_impl_loop_test.cc", - "../../src/tint/writer/glsl/generator_impl_member_accessor_test.cc", - "../../src/tint/writer/glsl/generator_impl_module_constant_test.cc", - "../../src/tint/writer/glsl/generator_impl_return_test.cc", - "../../src/tint/writer/glsl/generator_impl_sanitizer_test.cc", - "../../src/tint/writer/glsl/generator_impl_storage_buffer_test.cc", - "../../src/tint/writer/glsl/generator_impl_switch_test.cc", - "../../src/tint/writer/glsl/generator_impl_test.cc", - "../../src/tint/writer/glsl/generator_impl_type_test.cc", - "../../src/tint/writer/glsl/generator_impl_unary_op_test.cc", - "../../src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc", - "../../src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc", - "../../src/tint/writer/glsl/generator_impl_workgroup_var_test.cc", - "../../src/tint/writer/glsl/test_helper.h", - ] - - deps = [ - ":tint_unittests_ast_src", - ":tint_unittests_transform_src", - "${tint_root_dir}/src/tint:libtint_glsl_writer_src", - ] -} - -tint_unittests_source_set("tint_unittests_core_src") { - sources = [ - "../../src/tint/castable_test.cc", - "../../src/tint/clone_context_test.cc", - "../../src/tint/debug_test.cc", - "../../src/tint/demangler_test.cc", - "../../src/tint/program_builder_test.cc", - "../../src/tint/program_test.cc", - "../../src/tint/scope_stack_test.cc", - "../../src/tint/source_test.cc", - "../../src/tint/symbol_table_test.cc", - "../../src/tint/symbol_test.cc", - "../../src/tint/traits_test.cc", - "../../src/tint/utils/block_allocator_test.cc", - ] - - deps = [ ":tint_unittests_ast_src" ] -} - -if (build_with_chromium) { - tint_unittests_source_set("tint_unittests_fuzzer_src") { - sources = [ "../../src/tint/fuzzers/random_generator_test.cc" ] - - deps = [ - ":tint_unittests_core_src", - "${tint_root_dir}/src/tint/fuzzers:tint_fuzzer_common_src", - ] - } -} - -source_set("tint_unittests_src") { - testonly = true - - deps = [ - ":tint_unittests_ast_src", - ":tint_unittests_core_src", - ":tint_unittests_diagnostic_src", - ":tint_unittests_inspector_src", - ":tint_unittests_resolver_src", - ":tint_unittests_sem_src", - ":tint_unittests_text_src", - ":tint_unittests_transform_src", - ":tint_unittests_utils_src", - ":tint_unittests_writer_src", - "${tint_root_dir}/src/tint:libtint_wgsl_reader_src", - "${tint_root_dir}/src/tint:libtint_wgsl_writer_src", - ] - - if (tint_build_spv_reader) { - deps += [ ":tint_unittests_spv_reader_src" ] - } - - if (tint_build_spv_writer) { - deps += [ ":tint_unittests_spv_writer_src" ] - } - - if (tint_build_wgsl_reader) { - deps += [ ":tint_unittests_wgsl_reader_src" ] - } - - if (tint_build_wgsl_writer) { - deps += [ ":tint_unittests_wgsl_writer_src" ] - } - - if (tint_build_msl_writer) { - deps += [ ":tint_unittests_msl_writer_src" ] - } - - if (tint_build_hlsl_writer) { - deps += [ ":tint_unittests_hlsl_writer_src" ] - } - - if (tint_build_glsl_writer) { - deps += [ ":tint_unittests_glsl_writer_src" ] - } - - if (build_with_chromium) { - deps += [ ":tint_unittests_fuzzer_src" ] - } - - configs += [ ":tint_unittests_config" ] - - if (build_with_chromium) { - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - } -} - -test("tint_unittests") { - deps = [ - ":gmock_and_gtest", - ":tint_unittests_src", - "${tint_spirv_tools_dir}/:spvtools", - "${tint_spirv_tools_dir}/:spvtools_opt", - "${tint_spirv_tools_dir}/:spvtools_val", - ] - - deps += [ ":tint_unittests_main" ] - - configs += [ ":tint_unittests_config" ] - - if (build_with_chromium) { - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - } - - testonly = true -} diff --git a/test/tint/access/let/matrix.spvasm.expected.dxc.hlsl b/test/tint/access/let/matrix.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..a78b2e6987 --- /dev/null +++ b/test/tint/access/let/matrix.spvasm.expected.dxc.hlsl @@ -0,0 +1,10 @@ +void main_1() { + const float x_24 = 5.0f; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/access/let/matrix.spvasm.expected.fxc.hlsl b/test/tint/access/let/matrix.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..a78b2e6987 --- /dev/null +++ b/test/tint/access/let/matrix.spvasm.expected.fxc.hlsl @@ -0,0 +1,10 @@ +void main_1() { + const float x_24 = 5.0f; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/access/let/matrix.spvasm.expected.glsl b/test/tint/access/let/matrix.spvasm.expected.glsl index 8292f8948d..28576b7e69 100644 --- a/test/tint/access/let/matrix.spvasm.expected.glsl +++ b/test/tint/access/let/matrix.spvasm.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void main_1() { - float x_24 = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f))[1u].y; + float x_24 = 5.0f; return; } diff --git a/test/tint/access/let/matrix.spvasm.expected.hlsl b/test/tint/access/let/matrix.spvasm.expected.hlsl deleted file mode 100644 index 7f13ac2aae..0000000000 --- a/test/tint/access/let/matrix.spvasm.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -void main_1() { - const float x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y; - return; -} - -[numthreads(1, 1, 1)] -void main() { - main_1(); - return; -} diff --git a/test/tint/access/let/matrix.spvasm.expected.msl b/test/tint/access/let/matrix.spvasm.expected.msl index 74a4b931c4..bbb7ba6df0 100644 --- a/test/tint/access/let/matrix.spvasm.expected.msl +++ b/test/tint/access/let/matrix.spvasm.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void main_1() { - float const x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u][1]; + float const x_24 = 5.0f; return; } diff --git a/test/tint/access/let/matrix.spvasm.expected.spvasm b/test/tint/access/let/matrix.spvasm.expected.spvasm index 7556cb3a49..a95383cf33 100644 --- a/test/tint/access/let/matrix.spvasm.expected.spvasm +++ b/test/tint/access/let/matrix.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 10 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,31 +12,13 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 -%mat3v3float = OpTypeMatrix %v3float 3 - %float_1 = OpConstant %float 1 - %float_2 = OpConstant %float 2 - %float_3 = OpConstant %float 3 - %11 = OpConstantComposite %v3float %float_1 %float_2 %float_3 - %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 - %float_6 = OpConstant %float 6 - %15 = OpConstantComposite %v3float %float_4 %float_5 %float_6 - %float_7 = OpConstant %float 7 - %float_8 = OpConstant %float 8 - %float_9 = OpConstant %float 9 - %19 = OpConstantComposite %v3float %float_7 %float_8 %float_9 - %20 = OpConstantComposite %mat3v3float %11 %15 %19 - %uint = OpTypeInt 32 0 - %uint_1 = OpConstant %uint 1 %main_1 = OpFunction %void None %1 %4 = OpLabel - %23 = OpCompositeExtract %v3float %20 1 - %24 = OpCompositeExtract %float %23 1 OpReturn OpFunctionEnd %main = OpFunction %void None %1 - %26 = OpLabel - %27 = OpFunctionCall %void %main_1 + %8 = OpLabel + %9 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd diff --git a/test/tint/access/let/matrix.spvasm.expected.wgsl b/test/tint/access/let/matrix.spvasm.expected.wgsl index d2a2590d9c..01bd4419ab 100644 --- a/test/tint/access/let/matrix.spvasm.expected.wgsl +++ b/test/tint/access/let/matrix.spvasm.expected.wgsl @@ -1,9 +1,9 @@ fn main_1() { - let x_24 : f32 = mat3x3(vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0))[1u].y; + let x_24 : f32 = mat3x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f))[1u].y; return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/access/let/matrix.wgsl b/test/tint/access/let/matrix.wgsl index b4c77cfb3c..3d96fba6b7 100644 --- a/test/tint/access/let/matrix.wgsl +++ b/test/tint/access/let/matrix.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let m : mat3x3 = mat3x3(vec3(1., 2., 3.), vec3(4., 5., 6.), vec3(7., 8., 9.)); let v : vec3 = m[1]; diff --git a/test/tint/access/let/matrix.wgsl.expected.hlsl b/test/tint/access/let/matrix.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/access/let/matrix.wgsl.expected.hlsl rename to test/tint/access/let/matrix.wgsl.expected.dxc.hlsl diff --git a/test/tint/access/let/matrix.wgsl.expected.fxc.hlsl b/test/tint/access/let/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38129cf901 --- /dev/null +++ b/test/tint/access/let/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void main() { + const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + const float3 v = m[1]; + const float f = v[1]; + return; +} diff --git a/test/tint/access/let/matrix.wgsl.expected.wgsl b/test/tint/access/let/matrix.wgsl.expected.wgsl index f5dbdfb808..bdfd20785b 100644 --- a/test/tint/access/let/matrix.wgsl.expected.wgsl +++ b/test/tint/access/let/matrix.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let m : mat3x3 = mat3x3(vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0)); let v : vec3 = m[1]; diff --git a/test/tint/access/let/vector.spvasm.expected.dxc.hlsl b/test/tint/access/let/vector.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..d5e689bb00 --- /dev/null +++ b/test/tint/access/let/vector.spvasm.expected.dxc.hlsl @@ -0,0 +1,12 @@ +void main_1() { + const float x_11 = 2.0f; + const float2 x_13 = float2(1.0f, 3.0f); + const float3 x_14 = float3(1.0f, 3.0f, 2.0f); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/access/let/vector.spvasm.expected.fxc.hlsl b/test/tint/access/let/vector.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..d5e689bb00 --- /dev/null +++ b/test/tint/access/let/vector.spvasm.expected.fxc.hlsl @@ -0,0 +1,12 @@ +void main_1() { + const float x_11 = 2.0f; + const float2 x_13 = float2(1.0f, 3.0f); + const float3 x_14 = float3(1.0f, 3.0f, 2.0f); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/access/let/vector.spvasm.expected.glsl b/test/tint/access/let/vector.spvasm.expected.glsl index 6d744cd49d..6edf308c27 100644 --- a/test/tint/access/let/vector.spvasm.expected.glsl +++ b/test/tint/access/let/vector.spvasm.expected.glsl @@ -1,9 +1,9 @@ #version 310 es void main_1() { - float x_11 = vec3(1.0f, 2.0f, 3.0f).y; - vec2 x_13 = vec2(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).z); - vec3 x_14 = vec3(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).y); + float x_11 = 2.0f; + vec2 x_13 = vec2(1.0f, 3.0f); + vec3 x_14 = vec3(1.0f, 3.0f, 2.0f); return; } diff --git a/test/tint/access/let/vector.spvasm.expected.hlsl b/test/tint/access/let/vector.spvasm.expected.hlsl deleted file mode 100644 index cc37e54310..0000000000 --- a/test/tint/access/let/vector.spvasm.expected.hlsl +++ /dev/null @@ -1,12 +0,0 @@ -void main_1() { - const float x_11 = float3(1.0f, 2.0f, 3.0f).y; - const float2 x_13 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z); - const float3 x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y); - return; -} - -[numthreads(1, 1, 1)] -void main() { - main_1(); - return; -} diff --git a/test/tint/access/let/vector.spvasm.expected.msl b/test/tint/access/let/vector.spvasm.expected.msl index 354e9b13d2..1277c5a008 100644 --- a/test/tint/access/let/vector.spvasm.expected.msl +++ b/test/tint/access/let/vector.spvasm.expected.msl @@ -2,9 +2,9 @@ using namespace metal; void main_1() { - float const x_11 = float3(1.0f, 2.0f, 3.0f)[1]; - float2 const x_13 = float2(float3(1.0f, 2.0f, 3.0f)[0], float3(1.0f, 2.0f, 3.0f)[2]); - float3 const x_14 = float3(float3(1.0f, 2.0f, 3.0f)[0], float3(1.0f, 2.0f, 3.0f)[2], float3(1.0f, 2.0f, 3.0f)[1]); + float const x_11 = 2.0f; + float2 const x_13 = float2(1.0f, 3.0f); + float3 const x_14 = float3(1.0f, 3.0f, 2.0f); return; } diff --git a/test/tint/access/let/vector.spvasm.expected.spvasm b/test/tint/access/let/vector.spvasm.expected.spvasm index 5b2e1625c3..58ec939637 100644 --- a/test/tint/access/let/vector.spvasm.expected.spvasm +++ b/test/tint/access/let/vector.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,26 +12,19 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %float_3 = OpConstant %float 3 - %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %float_3 = OpConstant %float 3 + %10 = OpConstantComposite %v2float %float_1 %float_3 + %v3float = OpTypeVector %float 3 + %12 = OpConstantComposite %v3float %float_1 %float_3 %float_2 %main_1 = OpFunction %void None %1 %4 = OpLabel - %11 = OpCompositeExtract %float %10 1 - %13 = OpCompositeExtract %float %10 0 - %14 = OpCompositeExtract %float %10 2 - %15 = OpCompositeConstruct %v2float %13 %14 - %16 = OpCompositeExtract %float %10 0 - %17 = OpCompositeExtract %float %10 2 - %18 = OpCompositeExtract %float %10 1 - %19 = OpCompositeConstruct %v3float %16 %17 %18 OpReturn OpFunctionEnd %main = OpFunction %void None %1 - %21 = OpLabel - %22 = OpFunctionCall %void %main_1 + %14 = OpLabel + %15 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd diff --git a/test/tint/access/let/vector.spvasm.expected.wgsl b/test/tint/access/let/vector.spvasm.expected.wgsl index 2781fcc008..d80b9cfb08 100644 --- a/test/tint/access/let/vector.spvasm.expected.wgsl +++ b/test/tint/access/let/vector.spvasm.expected.wgsl @@ -1,11 +1,11 @@ fn main_1() { - let x_11 : f32 = vec3(1.0, 2.0, 3.0).y; - let x_13 : vec2 = vec2(vec3(1.0, 2.0, 3.0).x, vec3(1.0, 2.0, 3.0).z); - let x_14 : vec3 = vec3(vec3(1.0, 2.0, 3.0).x, vec3(1.0, 2.0, 3.0).z, vec3(1.0, 2.0, 3.0).y); + let x_11 : f32 = vec3(1.0f, 2.0f, 3.0f).y; + let x_13 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).z); + let x_14 : vec3 = vec3(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).y); return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/access/let/vector.wgsl b/test/tint/access/let/vector.wgsl index 3589c6b445..87604a91c9 100644 --- a/test/tint/access/let/vector.wgsl +++ b/test/tint/access/let/vector.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let v : vec3 = vec3(1., 2., 3.); let scalar : f32 = v.y; diff --git a/test/tint/access/let/vector.wgsl.expected.hlsl b/test/tint/access/let/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/access/let/vector.wgsl.expected.hlsl rename to test/tint/access/let/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/access/let/vector.wgsl.expected.fxc.hlsl b/test/tint/access/let/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d86c8eda34 --- /dev/null +++ b/test/tint/access/let/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void main() { + const float3 v = float3(1.0f, 2.0f, 3.0f); + const float scalar = v.y; + const float2 swizzle2 = v.xz; + const float3 swizzle3 = v.xzy; + return; +} diff --git a/test/tint/access/let/vector.wgsl.expected.wgsl b/test/tint/access/let/vector.wgsl.expected.wgsl index d7d7a2de0c..6646867042 100644 --- a/test/tint/access/let/vector.wgsl.expected.wgsl +++ b/test/tint/access/let/vector.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let v : vec3 = vec3(1.0, 2.0, 3.0); let scalar : f32 = v.y; diff --git a/test/tint/access/var/matrix.spvasm.expected.dxc.hlsl b/test/tint/access/var/matrix.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..375ea5377c --- /dev/null +++ b/test/tint/access/var/matrix.spvasm.expected.dxc.hlsl @@ -0,0 +1,12 @@ +void main_1() { + float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + const float3 x_15 = m[1]; + const float x_16 = x_15.y; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/access/var/matrix.spvasm.expected.fxc.hlsl b/test/tint/access/var/matrix.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..375ea5377c --- /dev/null +++ b/test/tint/access/var/matrix.spvasm.expected.fxc.hlsl @@ -0,0 +1,12 @@ +void main_1() { + float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + const float3 x_15 = m[1]; + const float x_16 = x_15.y; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/access/var/matrix.spvasm.expected.glsl b/test/tint/access/var/matrix.spvasm.expected.glsl index 41a4d28bd0..dce1470097 100644 --- a/test/tint/access/var/matrix.spvasm.expected.glsl +++ b/test/tint/access/var/matrix.spvasm.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void main_1() { - mat3 m = mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat3 m = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); vec3 x_15 = m[1]; float x_16 = x_15.y; return; diff --git a/test/tint/access/var/matrix.spvasm.expected.hlsl b/test/tint/access/var/matrix.spvasm.expected.hlsl deleted file mode 100644 index 4770aeaf14..0000000000 --- a/test/tint/access/var/matrix.spvasm.expected.hlsl +++ /dev/null @@ -1,12 +0,0 @@ -void main_1() { - float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - const float3 x_15 = m[1]; - const float x_16 = x_15.y; - return; -} - -[numthreads(1, 1, 1)] -void main() { - main_1(); - return; -} diff --git a/test/tint/access/var/matrix.spvasm.expected.msl b/test/tint/access/var/matrix.spvasm.expected.msl index 818eb61690..753587d92e 100644 --- a/test/tint/access/var/matrix.spvasm.expected.msl +++ b/test/tint/access/var/matrix.spvasm.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void main_1() { - float3x3 m = float3x3(); + float3x3 m = float3x3(float3(0.0f), float3(0.0f), float3(0.0f)); float3 const x_15 = m[1]; float const x_16 = x_15[1]; return; diff --git a/test/tint/access/var/matrix.spvasm.expected.wgsl b/test/tint/access/var/matrix.spvasm.expected.wgsl index a187f2c629..df0ad85b02 100644 --- a/test/tint/access/var/matrix.spvasm.expected.wgsl +++ b/test/tint/access/var/matrix.spvasm.expected.wgsl @@ -5,7 +5,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/access/var/matrix.wgsl b/test/tint/access/var/matrix.wgsl index d511bd42d0..92db7c0b20 100644 --- a/test/tint/access/var/matrix.wgsl +++ b/test/tint/access/var/matrix.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m : mat3x3; let v : vec3 = m[1]; diff --git a/test/tint/access/var/matrix.wgsl.expected.hlsl b/test/tint/access/var/matrix.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/access/var/matrix.wgsl.expected.hlsl rename to test/tint/access/var/matrix.wgsl.expected.dxc.hlsl diff --git a/test/tint/access/var/matrix.wgsl.expected.fxc.hlsl b/test/tint/access/var/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b402c70bf5 --- /dev/null +++ b/test/tint/access/var/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void main() { + float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const float3 v = m[1]; + const float f = v[1]; + return; +} diff --git a/test/tint/access/var/matrix.wgsl.expected.wgsl b/test/tint/access/var/matrix.wgsl.expected.wgsl index d511bd42d0..92db7c0b20 100644 --- a/test/tint/access/var/matrix.wgsl.expected.wgsl +++ b/test/tint/access/var/matrix.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m : mat3x3; let v : vec3 = m[1]; diff --git a/test/tint/access/var/vector.spvasm.expected.dxc.hlsl b/test/tint/access/var/vector.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..cc8ef6b895 --- /dev/null +++ b/test/tint/access/var/vector.spvasm.expected.dxc.hlsl @@ -0,0 +1,15 @@ +void main_1() { + float3 v = (0.0f).xxx; + const float x_14 = v.y; + const float3 x_16 = v; + const float2 x_17 = float2(x_16.x, x_16.z); + const float3 x_18 = v; + const float3 x_19 = float3(x_18.x, x_18.z, x_18.y); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/access/var/vector.spvasm.expected.fxc.hlsl b/test/tint/access/var/vector.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..cc8ef6b895 --- /dev/null +++ b/test/tint/access/var/vector.spvasm.expected.fxc.hlsl @@ -0,0 +1,15 @@ +void main_1() { + float3 v = (0.0f).xxx; + const float x_14 = v.y; + const float3 x_16 = v; + const float2 x_17 = float2(x_16.x, x_16.z); + const float3 x_18 = v; + const float3 x_19 = float3(x_18.x, x_18.z, x_18.y); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/access/var/vector.spvasm.expected.glsl b/test/tint/access/var/vector.spvasm.expected.glsl index 44c40a7f37..fb15d08efe 100644 --- a/test/tint/access/var/vector.spvasm.expected.glsl +++ b/test/tint/access/var/vector.spvasm.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void main_1() { - vec3 v = vec3(0.0f, 0.0f, 0.0f); + vec3 v = vec3(0.0f); float x_14 = v.y; vec3 x_16 = v; vec2 x_17 = vec2(x_16.x, x_16.z); diff --git a/test/tint/access/var/vector.spvasm.expected.hlsl b/test/tint/access/var/vector.spvasm.expected.hlsl deleted file mode 100644 index eac892152b..0000000000 --- a/test/tint/access/var/vector.spvasm.expected.hlsl +++ /dev/null @@ -1,15 +0,0 @@ -void main_1() { - float3 v = float3(0.0f, 0.0f, 0.0f); - const float x_14 = v.y; - const float3 x_16 = v; - const float2 x_17 = float2(x_16.x, x_16.z); - const float3 x_18 = v; - const float3 x_19 = float3(x_18.x, x_18.z, x_18.y); - return; -} - -[numthreads(1, 1, 1)] -void main() { - main_1(); - return; -} diff --git a/test/tint/access/var/vector.spvasm.expected.msl b/test/tint/access/var/vector.spvasm.expected.msl index 2f18abfd3f..fa7b3bcddf 100644 --- a/test/tint/access/var/vector.spvasm.expected.msl +++ b/test/tint/access/var/vector.spvasm.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void main_1() { - float3 v = float3(); + float3 v = float3(0.0f); float const x_14 = v[1]; float3 const x_16 = v; float2 const x_17 = float2(x_16[0], x_16[2]); diff --git a/test/tint/access/var/vector.spvasm.expected.wgsl b/test/tint/access/var/vector.spvasm.expected.wgsl index b13bb1aea6..a44d63328b 100644 --- a/test/tint/access/var/vector.spvasm.expected.wgsl +++ b/test/tint/access/var/vector.spvasm.expected.wgsl @@ -8,7 +8,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/access/var/vector.wgsl b/test/tint/access/var/vector.wgsl index 078f82e453..8cc17f879b 100644 --- a/test/tint/access/var/vector.wgsl +++ b/test/tint/access/var/vector.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : vec3; let scalar : f32 = v.y; diff --git a/test/tint/access/var/vector.wgsl.expected.hlsl b/test/tint/access/var/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/access/var/vector.wgsl.expected.hlsl rename to test/tint/access/var/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/access/var/vector.wgsl.expected.fxc.hlsl b/test/tint/access/var/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b9f393c2e --- /dev/null +++ b/test/tint/access/var/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void main() { + float3 v = float3(0.0f, 0.0f, 0.0f); + const float scalar = v.y; + const float2 swizzle2 = v.xz; + const float3 swizzle3 = v.xzy; + return; +} diff --git a/test/tint/access/var/vector.wgsl.expected.wgsl b/test/tint/access/var/vector.wgsl.expected.wgsl index 078f82e453..8cc17f879b 100644 --- a/test/tint/access/var/vector.wgsl.expected.wgsl +++ b/test/tint/access/var/vector.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : vec3; let scalar : f32 = v.y; diff --git a/test/tint/array/assign_to_function_var.wgsl.expected.dxc.hlsl b/test/tint/array/assign_to_function_var.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c6720324e1 --- /dev/null +++ b/test/tint/array/assign_to_function_var.wgsl.expected.dxc.hlsl @@ -0,0 +1,70 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int4 arr[4]; +}; + +static int4 src_private[4] = (int4[4])0; +groupshared int4 src_workgroup[4]; +cbuffer cbuffer_src_uniform : register(b0, space0) { + uint4 src_uniform[4]; +}; +RWByteAddressBuffer src_storage : register(u1, space0); + +typedef int4 ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const int4 tint_symbol_6[4] = (int4[4])0; + return tint_symbol_6; +} + +S ret_struct_arr() { + const S tint_symbol_7 = (S)0; + return tint_symbol_7; +} + +typedef int4 tint_symbol_2_ret[4]; +tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + const uint scalar_offset = ((offset + (i * 16u))) / 4; + arr_1[i] = asint(buffer[scalar_offset / 4]); + } + } + return arr_1; +} + +typedef int4 tint_symbol_4_ret[4]; +tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { + int4 arr_2[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); + } + } + return arr_2; +} + +void foo(int4 src_param[4]) { + int4 src_function[4] = (int4[4])0; + int4 tint_symbol[4] = (int4[4])0; + const int4 tint_symbol_8[4] = {(1).xxxx, (2).xxxx, (3).xxxx, (3).xxxx}; + tint_symbol = tint_symbol_8; + tint_symbol = src_param; + tint_symbol = ret_arr(); + const int4 src_let[4] = (int4[4])0; + tint_symbol = src_let; + tint_symbol = src_function; + tint_symbol = src_private; + tint_symbol = src_workgroup; + const S tint_symbol_1 = ret_struct_arr(); + tint_symbol = tint_symbol_1.arr; + tint_symbol = tint_symbol_2(src_uniform, 0u); + tint_symbol = tint_symbol_4(src_storage, 0u); + int dst_nested[4][3][2] = (int[4][3][2])0; + int src_nested[4][3][2] = (int[4][3][2])0; + dst_nested = src_nested; +} diff --git a/test/tint/array/assign_to_function_var.wgsl.expected.fxc.hlsl b/test/tint/array/assign_to_function_var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6720324e1 --- /dev/null +++ b/test/tint/array/assign_to_function_var.wgsl.expected.fxc.hlsl @@ -0,0 +1,70 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int4 arr[4]; +}; + +static int4 src_private[4] = (int4[4])0; +groupshared int4 src_workgroup[4]; +cbuffer cbuffer_src_uniform : register(b0, space0) { + uint4 src_uniform[4]; +}; +RWByteAddressBuffer src_storage : register(u1, space0); + +typedef int4 ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const int4 tint_symbol_6[4] = (int4[4])0; + return tint_symbol_6; +} + +S ret_struct_arr() { + const S tint_symbol_7 = (S)0; + return tint_symbol_7; +} + +typedef int4 tint_symbol_2_ret[4]; +tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + const uint scalar_offset = ((offset + (i * 16u))) / 4; + arr_1[i] = asint(buffer[scalar_offset / 4]); + } + } + return arr_1; +} + +typedef int4 tint_symbol_4_ret[4]; +tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { + int4 arr_2[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); + } + } + return arr_2; +} + +void foo(int4 src_param[4]) { + int4 src_function[4] = (int4[4])0; + int4 tint_symbol[4] = (int4[4])0; + const int4 tint_symbol_8[4] = {(1).xxxx, (2).xxxx, (3).xxxx, (3).xxxx}; + tint_symbol = tint_symbol_8; + tint_symbol = src_param; + tint_symbol = ret_arr(); + const int4 src_let[4] = (int4[4])0; + tint_symbol = src_let; + tint_symbol = src_function; + tint_symbol = src_private; + tint_symbol = src_workgroup; + const S tint_symbol_1 = ret_struct_arr(); + tint_symbol = tint_symbol_1.arr; + tint_symbol = tint_symbol_2(src_uniform, 0u); + tint_symbol = tint_symbol_4(src_storage, 0u); + int dst_nested[4][3][2] = (int[4][3][2])0; + int src_nested[4][3][2] = (int[4][3][2])0; + dst_nested = src_nested; +} diff --git a/test/tint/array/assign_to_function_var.wgsl.expected.glsl b/test/tint/array/assign_to_function_var.wgsl.expected.glsl index 1440eef359..ef532a6660 100644 --- a/test/tint/array/assign_to_function_var.wgsl.expected.glsl +++ b/test/tint/array/assign_to_function_var.wgsl.expected.glsl @@ -18,12 +18,12 @@ layout(binding = 1, std430) buffer S_2 { ivec4 arr[4]; } src_storage; ivec4[4] ret_arr() { - ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); + ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); return tint_symbol_1; } S ret_struct_arr() { - S tint_symbol_2 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0))); + S tint_symbol_2 = S(ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0))); return tint_symbol_2; } @@ -34,7 +34,7 @@ void foo(ivec4 src_param[4]) { dst = tint_symbol_3; dst = src_param; dst = ret_arr(); - ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); + ivec4 src_let[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); dst = src_let; dst = src_function; dst = src_private; diff --git a/test/tint/array/assign_to_function_var.wgsl.expected.hlsl b/test/tint/array/assign_to_function_var.wgsl.expected.hlsl deleted file mode 100644 index caa64fd05b..0000000000 --- a/test/tint/array/assign_to_function_var.wgsl.expected.hlsl +++ /dev/null @@ -1,70 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -struct S { - int4 arr[4]; -}; - -static int4 src_private[4] = (int4[4])0; -groupshared int4 src_workgroup[4]; -cbuffer cbuffer_src_uniform : register(b0, space0) { - uint4 src_uniform[4]; -}; -RWByteAddressBuffer src_storage : register(u1, space0); - -typedef int4 ret_arr_ret[4]; -ret_arr_ret ret_arr() { - const int4 tint_symbol_6[4] = (int4[4])0; - return tint_symbol_6; -} - -S ret_struct_arr() { - const S tint_symbol_7 = (S)0; - return tint_symbol_7; -} - -typedef int4 tint_symbol_2_ret[4]; -tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) { - int4 arr_1[4] = (int4[4])0; - { - [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { - const uint scalar_offset = ((offset + (i * 16u))) / 4; - arr_1[i] = asint(buffer[scalar_offset / 4]); - } - } - return arr_1; -} - -typedef int4 tint_symbol_4_ret[4]; -tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { - int4 arr_2[4] = (int4[4])0; - { - [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { - arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); - } - } - return arr_2; -} - -void foo(int4 src_param[4]) { - int4 src_function[4] = (int4[4])0; - int4 tint_symbol[4] = (int4[4])0; - const int4 tint_symbol_8[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)}; - tint_symbol = tint_symbol_8; - tint_symbol = src_param; - tint_symbol = ret_arr(); - const int4 src_let[4] = (int4[4])0; - tint_symbol = src_let; - tint_symbol = src_function; - tint_symbol = src_private; - tint_symbol = src_workgroup; - const S tint_symbol_1 = ret_struct_arr(); - tint_symbol = tint_symbol_1.arr; - tint_symbol = tint_symbol_2(src_uniform, 0u); - tint_symbol = tint_symbol_4(src_storage, 0u); - int dst_nested[4][3][2] = (int[4][3][2])0; - int src_nested[4][3][2] = (int[4][3][2])0; - dst_nested = src_nested; -} diff --git a/test/tint/array/assign_to_function_var.wgsl.expected.msl b/test/tint/array/assign_to_function_var.wgsl.expected.msl index 39cf432f3b..a57b60ed74 100644 --- a/test/tint/array/assign_to_function_var.wgsl.expected.msl +++ b/test/tint/array/assign_to_function_var.wgsl.expected.msl @@ -1,54 +1,52 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct S { - /* 0x0000 */ tint_array_wrapper arr; + /* 0x0000 */ tint_array arr; }; -tint_array_wrapper ret_arr() { - tint_array_wrapper const tint_symbol_1 = {.arr={}}; +tint_array ret_arr() { + tint_array const tint_symbol_1 = tint_array{}; return tint_symbol_1; } S ret_struct_arr() { - S const tint_symbol_2 = {}; + S const tint_symbol_2 = S{}; return tint_symbol_2; } -struct tint_array_wrapper_3 { - int arr[2]; -}; - -struct tint_array_wrapper_2 { - tint_array_wrapper_3 arr[3]; -}; - -struct tint_array_wrapper_1 { - tint_array_wrapper_2 arr[4]; -}; - -void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_4, threadgroup tint_array_wrapper* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7) { - tint_array_wrapper src_function = {}; - tint_array_wrapper dst = {}; - tint_array_wrapper const tint_symbol_3 = {.arr={int4(1), int4(2), int4(3), int4(3)}}; +void foo(tint_array src_param, threadgroup tint_array* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7) { + thread tint_array tint_symbol_4 = {}; + tint_array src_function = {}; + tint_array dst = {}; + tint_array const tint_symbol_3 = tint_array{int4(1), int4(2), int4(3), int4(3)}; dst = tint_symbol_3; dst = src_param; dst = ret_arr(); - tint_array_wrapper const src_let = {.arr={}}; + tint_array const src_let = tint_array{}; dst = src_let; dst = src_function; - dst = *(tint_symbol_4); + dst = tint_symbol_4; dst = *(tint_symbol_5); S const tint_symbol = ret_struct_arr(); dst = tint_symbol.arr; dst = (*(tint_symbol_6)).arr; dst = (*(tint_symbol_7)).arr; - tint_array_wrapper_1 dst_nested = {}; - tint_array_wrapper_1 src_nested = {}; + tint_array, 3>, 4> dst_nested = {}; + tint_array, 3>, 4> src_nested = {}; dst_nested = src_nested; } diff --git a/test/tint/array/assign_to_private_var.wgsl.expected.dxc.hlsl b/test/tint/array/assign_to_private_var.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..49525420d7 --- /dev/null +++ b/test/tint/array/assign_to_private_var.wgsl.expected.dxc.hlsl @@ -0,0 +1,70 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int4 arr[4]; +}; + +static int4 src_private[4] = (int4[4])0; +groupshared int4 src_workgroup[4]; +cbuffer cbuffer_src_uniform : register(b0, space0) { + uint4 src_uniform[4]; +}; +RWByteAddressBuffer src_storage : register(u1, space0); +static int4 tint_symbol[4] = (int4[4])0; +static int dst_nested[4][3][2] = (int[4][3][2])0; + +typedef int4 ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const int4 tint_symbol_6[4] = (int4[4])0; + return tint_symbol_6; +} + +S ret_struct_arr() { + const S tint_symbol_7 = (S)0; + return tint_symbol_7; +} + +typedef int4 tint_symbol_2_ret[4]; +tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + const uint scalar_offset = ((offset + (i * 16u))) / 4; + arr_1[i] = asint(buffer[scalar_offset / 4]); + } + } + return arr_1; +} + +typedef int4 tint_symbol_4_ret[4]; +tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { + int4 arr_2[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); + } + } + return arr_2; +} + +void foo(int4 src_param[4]) { + int4 src_function[4] = (int4[4])0; + const int4 tint_symbol_8[4] = {(1).xxxx, (2).xxxx, (3).xxxx, (3).xxxx}; + tint_symbol = tint_symbol_8; + tint_symbol = src_param; + tint_symbol = ret_arr(); + const int4 src_let[4] = (int4[4])0; + tint_symbol = src_let; + tint_symbol = src_function; + tint_symbol = src_private; + tint_symbol = src_workgroup; + const S tint_symbol_1 = ret_struct_arr(); + tint_symbol = tint_symbol_1.arr; + tint_symbol = tint_symbol_2(src_uniform, 0u); + tint_symbol = tint_symbol_4(src_storage, 0u); + int src_nested[4][3][2] = (int[4][3][2])0; + dst_nested = src_nested; +} diff --git a/test/tint/array/assign_to_private_var.wgsl.expected.fxc.hlsl b/test/tint/array/assign_to_private_var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..49525420d7 --- /dev/null +++ b/test/tint/array/assign_to_private_var.wgsl.expected.fxc.hlsl @@ -0,0 +1,70 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int4 arr[4]; +}; + +static int4 src_private[4] = (int4[4])0; +groupshared int4 src_workgroup[4]; +cbuffer cbuffer_src_uniform : register(b0, space0) { + uint4 src_uniform[4]; +}; +RWByteAddressBuffer src_storage : register(u1, space0); +static int4 tint_symbol[4] = (int4[4])0; +static int dst_nested[4][3][2] = (int[4][3][2])0; + +typedef int4 ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const int4 tint_symbol_6[4] = (int4[4])0; + return tint_symbol_6; +} + +S ret_struct_arr() { + const S tint_symbol_7 = (S)0; + return tint_symbol_7; +} + +typedef int4 tint_symbol_2_ret[4]; +tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + const uint scalar_offset = ((offset + (i * 16u))) / 4; + arr_1[i] = asint(buffer[scalar_offset / 4]); + } + } + return arr_1; +} + +typedef int4 tint_symbol_4_ret[4]; +tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { + int4 arr_2[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); + } + } + return arr_2; +} + +void foo(int4 src_param[4]) { + int4 src_function[4] = (int4[4])0; + const int4 tint_symbol_8[4] = {(1).xxxx, (2).xxxx, (3).xxxx, (3).xxxx}; + tint_symbol = tint_symbol_8; + tint_symbol = src_param; + tint_symbol = ret_arr(); + const int4 src_let[4] = (int4[4])0; + tint_symbol = src_let; + tint_symbol = src_function; + tint_symbol = src_private; + tint_symbol = src_workgroup; + const S tint_symbol_1 = ret_struct_arr(); + tint_symbol = tint_symbol_1.arr; + tint_symbol = tint_symbol_2(src_uniform, 0u); + tint_symbol = tint_symbol_4(src_storage, 0u); + int src_nested[4][3][2] = (int[4][3][2])0; + dst_nested = src_nested; +} diff --git a/test/tint/array/assign_to_private_var.wgsl.expected.glsl b/test/tint/array/assign_to_private_var.wgsl.expected.glsl index 7c59609156..6a18417618 100644 --- a/test/tint/array/assign_to_private_var.wgsl.expected.glsl +++ b/test/tint/array/assign_to_private_var.wgsl.expected.glsl @@ -20,12 +20,12 @@ layout(binding = 1, std430) buffer S_2 { ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); ivec4[4] ret_arr() { - ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); + ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); return tint_symbol_1; } S ret_struct_arr() { - S tint_symbol_2 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0))); + S tint_symbol_2 = S(ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0))); return tint_symbol_2; } @@ -35,7 +35,7 @@ void foo(ivec4 src_param[4]) { dst = tint_symbol_3; dst = src_param; dst = ret_arr(); - ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); + ivec4 src_let[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); dst = src_let; dst = src_function; dst = src_private; diff --git a/test/tint/array/assign_to_private_var.wgsl.expected.hlsl b/test/tint/array/assign_to_private_var.wgsl.expected.hlsl deleted file mode 100644 index 38b175907d..0000000000 --- a/test/tint/array/assign_to_private_var.wgsl.expected.hlsl +++ /dev/null @@ -1,70 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -struct S { - int4 arr[4]; -}; - -static int4 src_private[4] = (int4[4])0; -groupshared int4 src_workgroup[4]; -cbuffer cbuffer_src_uniform : register(b0, space0) { - uint4 src_uniform[4]; -}; -RWByteAddressBuffer src_storage : register(u1, space0); -static int4 tint_symbol[4] = (int4[4])0; -static int dst_nested[4][3][2] = (int[4][3][2])0; - -typedef int4 ret_arr_ret[4]; -ret_arr_ret ret_arr() { - const int4 tint_symbol_6[4] = (int4[4])0; - return tint_symbol_6; -} - -S ret_struct_arr() { - const S tint_symbol_7 = (S)0; - return tint_symbol_7; -} - -typedef int4 tint_symbol_2_ret[4]; -tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) { - int4 arr_1[4] = (int4[4])0; - { - [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { - const uint scalar_offset = ((offset + (i * 16u))) / 4; - arr_1[i] = asint(buffer[scalar_offset / 4]); - } - } - return arr_1; -} - -typedef int4 tint_symbol_4_ret[4]; -tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { - int4 arr_2[4] = (int4[4])0; - { - [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { - arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); - } - } - return arr_2; -} - -void foo(int4 src_param[4]) { - int4 src_function[4] = (int4[4])0; - const int4 tint_symbol_8[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)}; - tint_symbol = tint_symbol_8; - tint_symbol = src_param; - tint_symbol = ret_arr(); - const int4 src_let[4] = (int4[4])0; - tint_symbol = src_let; - tint_symbol = src_function; - tint_symbol = src_private; - tint_symbol = src_workgroup; - const S tint_symbol_1 = ret_struct_arr(); - tint_symbol = tint_symbol_1.arr; - tint_symbol = tint_symbol_2(src_uniform, 0u); - tint_symbol = tint_symbol_4(src_storage, 0u); - int src_nested[4][3][2] = (int[4][3][2])0; - dst_nested = src_nested; -} diff --git a/test/tint/array/assign_to_private_var.wgsl.expected.msl b/test/tint/array/assign_to_private_var.wgsl.expected.msl index be8972fe07..20a35cdb5c 100644 --- a/test/tint/array/assign_to_private_var.wgsl.expected.msl +++ b/test/tint/array/assign_to_private_var.wgsl.expected.msl @@ -1,52 +1,52 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct S { - /* 0x0000 */ tint_array_wrapper arr; + /* 0x0000 */ tint_array arr; }; -struct tint_array_wrapper_3 { - int arr[2]; -}; - -struct tint_array_wrapper_2 { - tint_array_wrapper_3 arr[3]; -}; - -struct tint_array_wrapper_1 { - tint_array_wrapper_2 arr[4]; -}; - -tint_array_wrapper ret_arr() { - tint_array_wrapper const tint_symbol_1 = {.arr={}}; +tint_array ret_arr() { + tint_array const tint_symbol_1 = tint_array{}; return tint_symbol_1; } S ret_struct_arr() { - S const tint_symbol_2 = {}; + S const tint_symbol_2 = S{}; return tint_symbol_2; } -void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_4, thread tint_array_wrapper* const tint_symbol_5, threadgroup tint_array_wrapper* const tint_symbol_6, const constant S* const tint_symbol_7, device S* const tint_symbol_8, thread tint_array_wrapper_1* const tint_symbol_9) { - tint_array_wrapper src_function = {}; - tint_array_wrapper const tint_symbol_3 = {.arr={int4(1), int4(2), int4(3), int4(3)}}; - *(tint_symbol_4) = tint_symbol_3; - *(tint_symbol_4) = src_param; - *(tint_symbol_4) = ret_arr(); - tint_array_wrapper const src_let = {.arr={}}; - *(tint_symbol_4) = src_let; - *(tint_symbol_4) = src_function; - *(tint_symbol_4) = *(tint_symbol_5); - *(tint_symbol_4) = *(tint_symbol_6); +void foo(tint_array src_param, threadgroup tint_array* const tint_symbol_6, const constant S* const tint_symbol_7, device S* const tint_symbol_8) { + thread tint_array tint_symbol_4 = {}; + thread tint_array tint_symbol_5 = {}; + thread tint_array, 3>, 4> tint_symbol_9 = {}; + tint_array src_function = {}; + tint_array const tint_symbol_3 = tint_array{int4(1), int4(2), int4(3), int4(3)}; + tint_symbol_4 = tint_symbol_3; + tint_symbol_4 = src_param; + tint_symbol_4 = ret_arr(); + tint_array const src_let = tint_array{}; + tint_symbol_4 = src_let; + tint_symbol_4 = src_function; + tint_symbol_4 = tint_symbol_5; + tint_symbol_4 = *(tint_symbol_6); S const tint_symbol = ret_struct_arr(); - *(tint_symbol_4) = tint_symbol.arr; - *(tint_symbol_4) = (*(tint_symbol_7)).arr; - *(tint_symbol_4) = (*(tint_symbol_8)).arr; - tint_array_wrapper_1 src_nested = {}; - *(tint_symbol_9) = src_nested; + tint_symbol_4 = tint_symbol.arr; + tint_symbol_4 = (*(tint_symbol_7)).arr; + tint_symbol_4 = (*(tint_symbol_8)).arr; + tint_array, 3>, 4> src_nested = {}; + tint_symbol_9 = src_nested; } diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.dxc.hlsl b/test/tint/array/assign_to_storage_var.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1455343334 --- /dev/null +++ b/test/tint/array/assign_to_storage_var.wgsl.expected.dxc.hlsl @@ -0,0 +1,107 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int4 arr[4]; +}; + +static int4 src_private[4] = (int4[4])0; +groupshared int4 src_workgroup[4]; +cbuffer cbuffer_src_uniform : register(b0, space0) { + uint4 src_uniform[4]; +}; +RWByteAddressBuffer src_storage : register(u1, space0); +RWByteAddressBuffer tint_symbol : register(u2, space0); +RWByteAddressBuffer dst_nested : register(u3, space0); + +typedef int4 ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const int4 tint_symbol_13[4] = (int4[4])0; + return tint_symbol_13; +} + +S ret_struct_arr() { + const S tint_symbol_14 = (S)0; + return tint_symbol_14; +} + +void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, int4 value[4]) { + int4 array[4] = value; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + buffer.Store4((offset + (i * 16u)), asuint(array[i])); + } + } +} + +typedef int4 tint_symbol_5_ret[4]; +tint_symbol_5_ret tint_symbol_5(uint4 buffer[4], uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + const uint scalar_offset = ((offset + (i_1 * 16u))) / 4; + arr_1[i_1] = asint(buffer[scalar_offset / 4]); + } + } + return arr_1; +} + +typedef int4 tint_symbol_7_ret[4]; +tint_symbol_7_ret tint_symbol_7(RWByteAddressBuffer buffer, uint offset) { + int4 arr_2[4] = (int4[4])0; + { + [loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) { + arr_2[i_2] = asint(buffer.Load4((offset + (i_2 * 16u)))); + } + } + return arr_2; +} + +void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int value[2]) { + int array_3[2] = value; + { + [loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) { + buffer.Store((offset + (i_3 * 4u)), asuint(array_3[i_3])); + } + } +} + +void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, int value[3][2]) { + int array_2[3][2] = value; + { + [loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) { + tint_symbol_11(buffer, (offset + (i_4 * 8u)), array_2[i_4]); + } + } +} + +void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) { + int array_1[4][3][2] = value; + { + [loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) { + tint_symbol_10(buffer, (offset + (i_5 * 24u)), array_1[i_5]); + } + } +} + +void foo(int4 src_param[4]) { + int4 src_function[4] = (int4[4])0; + const int4 tint_symbol_15[4] = {(1).xxxx, (2).xxxx, (3).xxxx, (3).xxxx}; + tint_symbol_3(tint_symbol, 0u, tint_symbol_15); + tint_symbol_3(tint_symbol, 0u, src_param); + const int4 tint_symbol_1[4] = ret_arr(); + tint_symbol_3(tint_symbol, 0u, tint_symbol_1); + const int4 src_let[4] = (int4[4])0; + tint_symbol_3(tint_symbol, 0u, src_let); + tint_symbol_3(tint_symbol, 0u, src_function); + tint_symbol_3(tint_symbol, 0u, src_private); + tint_symbol_3(tint_symbol, 0u, src_workgroup); + const S tint_symbol_2 = ret_struct_arr(); + tint_symbol_3(tint_symbol, 0u, tint_symbol_2.arr); + tint_symbol_3(tint_symbol, 0u, tint_symbol_5(src_uniform, 0u)); + tint_symbol_3(tint_symbol, 0u, tint_symbol_7(src_storage, 0u)); + int src_nested[4][3][2] = (int[4][3][2])0; + tint_symbol_9(dst_nested, 0u, src_nested); +} diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.fxc.hlsl b/test/tint/array/assign_to_storage_var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1455343334 --- /dev/null +++ b/test/tint/array/assign_to_storage_var.wgsl.expected.fxc.hlsl @@ -0,0 +1,107 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int4 arr[4]; +}; + +static int4 src_private[4] = (int4[4])0; +groupshared int4 src_workgroup[4]; +cbuffer cbuffer_src_uniform : register(b0, space0) { + uint4 src_uniform[4]; +}; +RWByteAddressBuffer src_storage : register(u1, space0); +RWByteAddressBuffer tint_symbol : register(u2, space0); +RWByteAddressBuffer dst_nested : register(u3, space0); + +typedef int4 ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const int4 tint_symbol_13[4] = (int4[4])0; + return tint_symbol_13; +} + +S ret_struct_arr() { + const S tint_symbol_14 = (S)0; + return tint_symbol_14; +} + +void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, int4 value[4]) { + int4 array[4] = value; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + buffer.Store4((offset + (i * 16u)), asuint(array[i])); + } + } +} + +typedef int4 tint_symbol_5_ret[4]; +tint_symbol_5_ret tint_symbol_5(uint4 buffer[4], uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + const uint scalar_offset = ((offset + (i_1 * 16u))) / 4; + arr_1[i_1] = asint(buffer[scalar_offset / 4]); + } + } + return arr_1; +} + +typedef int4 tint_symbol_7_ret[4]; +tint_symbol_7_ret tint_symbol_7(RWByteAddressBuffer buffer, uint offset) { + int4 arr_2[4] = (int4[4])0; + { + [loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) { + arr_2[i_2] = asint(buffer.Load4((offset + (i_2 * 16u)))); + } + } + return arr_2; +} + +void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int value[2]) { + int array_3[2] = value; + { + [loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) { + buffer.Store((offset + (i_3 * 4u)), asuint(array_3[i_3])); + } + } +} + +void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, int value[3][2]) { + int array_2[3][2] = value; + { + [loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) { + tint_symbol_11(buffer, (offset + (i_4 * 8u)), array_2[i_4]); + } + } +} + +void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) { + int array_1[4][3][2] = value; + { + [loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) { + tint_symbol_10(buffer, (offset + (i_5 * 24u)), array_1[i_5]); + } + } +} + +void foo(int4 src_param[4]) { + int4 src_function[4] = (int4[4])0; + const int4 tint_symbol_15[4] = {(1).xxxx, (2).xxxx, (3).xxxx, (3).xxxx}; + tint_symbol_3(tint_symbol, 0u, tint_symbol_15); + tint_symbol_3(tint_symbol, 0u, src_param); + const int4 tint_symbol_1[4] = ret_arr(); + tint_symbol_3(tint_symbol, 0u, tint_symbol_1); + const int4 src_let[4] = (int4[4])0; + tint_symbol_3(tint_symbol, 0u, src_let); + tint_symbol_3(tint_symbol, 0u, src_function); + tint_symbol_3(tint_symbol, 0u, src_private); + tint_symbol_3(tint_symbol, 0u, src_workgroup); + const S tint_symbol_2 = ret_struct_arr(); + tint_symbol_3(tint_symbol, 0u, tint_symbol_2.arr); + tint_symbol_3(tint_symbol, 0u, tint_symbol_5(src_uniform, 0u)); + tint_symbol_3(tint_symbol, 0u, tint_symbol_7(src_storage, 0u)); + int src_nested[4][3][2] = (int[4][3][2])0; + tint_symbol_9(dst_nested, 0u, src_nested); +} diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.glsl b/test/tint/array/assign_to_storage_var.wgsl.expected.glsl index 33c0123ebe..bda5283626 100644 --- a/test/tint/array/assign_to_storage_var.wgsl.expected.glsl +++ b/test/tint/array/assign_to_storage_var.wgsl.expected.glsl @@ -28,12 +28,12 @@ layout(binding = 3, std430) buffer S_nested_1 { int arr[4][3][2]; } dst_nested; ivec4[4] ret_arr() { - ivec4 tint_symbol_2[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); + ivec4 tint_symbol_2[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); return tint_symbol_2; } S ret_struct_arr() { - S tint_symbol_3 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0))); + S tint_symbol_3 = S(ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0))); return tint_symbol_3; } @@ -44,7 +44,7 @@ void foo(ivec4 src_param[4]) { dst.arr = src_param; ivec4 tint_symbol[4] = ret_arr(); dst.arr = tint_symbol; - ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); + ivec4 src_let[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); dst.arr = src_let; dst.arr = src_function; dst.arr = src_private; diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.hlsl b/test/tint/array/assign_to_storage_var.wgsl.expected.hlsl deleted file mode 100644 index fa5b2d882a..0000000000 --- a/test/tint/array/assign_to_storage_var.wgsl.expected.hlsl +++ /dev/null @@ -1,107 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -struct S { - int4 arr[4]; -}; - -static int4 src_private[4] = (int4[4])0; -groupshared int4 src_workgroup[4]; -cbuffer cbuffer_src_uniform : register(b0, space0) { - uint4 src_uniform[4]; -}; -RWByteAddressBuffer src_storage : register(u1, space0); -RWByteAddressBuffer tint_symbol : register(u2, space0); -RWByteAddressBuffer dst_nested : register(u3, space0); - -typedef int4 ret_arr_ret[4]; -ret_arr_ret ret_arr() { - const int4 tint_symbol_13[4] = (int4[4])0; - return tint_symbol_13; -} - -S ret_struct_arr() { - const S tint_symbol_14 = (S)0; - return tint_symbol_14; -} - -void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, int4 value[4]) { - int4 array[4] = value; - { - [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { - buffer.Store4((offset + (i * 16u)), asuint(array[i])); - } - } -} - -typedef int4 tint_symbol_5_ret[4]; -tint_symbol_5_ret tint_symbol_5(uint4 buffer[4], uint offset) { - int4 arr_1[4] = (int4[4])0; - { - [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { - const uint scalar_offset = ((offset + (i_1 * 16u))) / 4; - arr_1[i_1] = asint(buffer[scalar_offset / 4]); - } - } - return arr_1; -} - -typedef int4 tint_symbol_7_ret[4]; -tint_symbol_7_ret tint_symbol_7(RWByteAddressBuffer buffer, uint offset) { - int4 arr_2[4] = (int4[4])0; - { - [loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) { - arr_2[i_2] = asint(buffer.Load4((offset + (i_2 * 16u)))); - } - } - return arr_2; -} - -void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int value[2]) { - int array_3[2] = value; - { - [loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) { - buffer.Store((offset + (i_3 * 4u)), asuint(array_3[i_3])); - } - } -} - -void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, int value[3][2]) { - int array_2[3][2] = value; - { - [loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) { - tint_symbol_11(buffer, (offset + (i_4 * 8u)), array_2[i_4]); - } - } -} - -void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) { - int array_1[4][3][2] = value; - { - [loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) { - tint_symbol_10(buffer, (offset + (i_5 * 24u)), array_1[i_5]); - } - } -} - -void foo(int4 src_param[4]) { - int4 src_function[4] = (int4[4])0; - const int4 tint_symbol_15[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)}; - tint_symbol_3(tint_symbol, 0u, tint_symbol_15); - tint_symbol_3(tint_symbol, 0u, src_param); - const int4 tint_symbol_1[4] = ret_arr(); - tint_symbol_3(tint_symbol, 0u, tint_symbol_1); - const int4 src_let[4] = (int4[4])0; - tint_symbol_3(tint_symbol, 0u, src_let); - tint_symbol_3(tint_symbol, 0u, src_function); - tint_symbol_3(tint_symbol, 0u, src_private); - tint_symbol_3(tint_symbol, 0u, src_workgroup); - const S tint_symbol_2 = ret_struct_arr(); - tint_symbol_3(tint_symbol, 0u, tint_symbol_2.arr); - tint_symbol_3(tint_symbol, 0u, tint_symbol_5(src_uniform, 0u)); - tint_symbol_3(tint_symbol, 0u, tint_symbol_7(src_storage, 0u)); - int src_nested[4][3][2] = (int[4][3][2])0; - tint_symbol_9(dst_nested, 0u, src_nested); -} diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.msl b/test/tint/array/assign_to_storage_var.wgsl.expected.msl index 3bf3ccb66f..ee189f41d7 100644 --- a/test/tint/array/assign_to_storage_var.wgsl.expected.msl +++ b/test/tint/array/assign_to_storage_var.wgsl.expected.msl @@ -1,57 +1,55 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct S { - /* 0x0000 */ tint_array_wrapper arr; -}; - -struct tint_array_wrapper_3 { - /* 0x0000 */ int arr[2]; -}; - -struct tint_array_wrapper_2 { - /* 0x0000 */ tint_array_wrapper_3 arr[3]; -}; - -struct tint_array_wrapper_1 { - /* 0x0000 */ tint_array_wrapper_2 arr[4]; + /* 0x0000 */ tint_array arr; }; struct S_nested { - /* 0x0000 */ tint_array_wrapper_1 arr; + /* 0x0000 */ tint_array, 3>, 4> arr; }; -tint_array_wrapper ret_arr() { - tint_array_wrapper const tint_symbol_2 = {.arr={}}; +tint_array ret_arr() { + tint_array const tint_symbol_2 = tint_array{}; return tint_symbol_2; } S ret_struct_arr() { - S const tint_symbol_3 = {}; + S const tint_symbol_3 = S{}; return tint_symbol_3; } -void foo(tint_array_wrapper src_param, device S* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, threadgroup tint_array_wrapper* const tint_symbol_7, const constant S* const tint_symbol_8, device S* const tint_symbol_9, device S_nested* const tint_symbol_10) { - tint_array_wrapper src_function = {}; - tint_array_wrapper const tint_symbol_4 = {.arr={int4(1), int4(2), int4(3), int4(3)}}; +void foo(tint_array src_param, device S* const tint_symbol_5, threadgroup tint_array* const tint_symbol_7, const constant S* const tint_symbol_8, device S* const tint_symbol_9, device S_nested* const tint_symbol_10) { + thread tint_array tint_symbol_6 = {}; + tint_array src_function = {}; + tint_array const tint_symbol_4 = tint_array{int4(1), int4(2), int4(3), int4(3)}; (*(tint_symbol_5)).arr = tint_symbol_4; (*(tint_symbol_5)).arr = src_param; - tint_array_wrapper const tint_symbol = ret_arr(); + tint_array const tint_symbol = ret_arr(); (*(tint_symbol_5)).arr = tint_symbol; - tint_array_wrapper const src_let = {.arr={}}; + tint_array const src_let = tint_array{}; (*(tint_symbol_5)).arr = src_let; (*(tint_symbol_5)).arr = src_function; - (*(tint_symbol_5)).arr = *(tint_symbol_6); + (*(tint_symbol_5)).arr = tint_symbol_6; (*(tint_symbol_5)).arr = *(tint_symbol_7); S const tint_symbol_1 = ret_struct_arr(); (*(tint_symbol_5)).arr = tint_symbol_1.arr; (*(tint_symbol_5)).arr = (*(tint_symbol_8)).arr; (*(tint_symbol_5)).arr = (*(tint_symbol_9)).arr; - tint_array_wrapper_1 src_nested = {}; + tint_array, 3>, 4> src_nested = {}; (*(tint_symbol_10)).arr = src_nested; } diff --git a/test/tint/array/assign_to_subexpr.wgsl.expected.hlsl b/test/tint/array/assign_to_subexpr.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/array/assign_to_subexpr.wgsl.expected.hlsl rename to test/tint/array/assign_to_subexpr.wgsl.expected.dxc.hlsl diff --git a/test/tint/array/assign_to_subexpr.wgsl.expected.fxc.hlsl b/test/tint/array/assign_to_subexpr.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38802ee51b --- /dev/null +++ b/test/tint/array/assign_to_subexpr.wgsl.expected.fxc.hlsl @@ -0,0 +1,20 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int arr[4]; +}; + +void foo() { + const int src[4] = (int[4])0; + int tint_symbol[4] = (int[4])0; + S dst_struct = (S)0; + int dst_array[2][4] = (int[2][4])0; + dst_struct.arr = src; + dst_array[1] = src; + tint_symbol = src; + dst_struct.arr = src; + dst_array[0] = src; +} diff --git a/test/tint/array/assign_to_subexpr.wgsl.expected.msl b/test/tint/array/assign_to_subexpr.wgsl.expected.msl index 735dc308ac..8851fcd064 100644 --- a/test/tint/array/assign_to_subexpr.wgsl.expected.msl +++ b/test/tint/array/assign_to_subexpr.wgsl.expected.msl @@ -1,27 +1,32 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct S { - tint_array_wrapper arr; -}; - -struct tint_array_wrapper_1 { - tint_array_wrapper arr[2]; + tint_array arr; }; void foo() { - tint_array_wrapper const src = {.arr={}}; - tint_array_wrapper dst = {}; + tint_array const src = tint_array{}; + tint_array dst = {}; S dst_struct = {}; - tint_array_wrapper_1 dst_array = {}; + tint_array, 2> dst_array = {}; dst_struct.arr = src; - dst_array.arr[1] = src; + dst_array[1] = src; dst = src; dst_struct.arr = src; - dst_array.arr[0] = src; + dst_array[0] = src; } diff --git a/test/tint/array/assign_to_subexpr.wgsl.expected.spvasm b/test/tint/array/assign_to_subexpr.wgsl.expected.spvasm index d234c75650..c6ba3d6000 100644 --- a/test/tint/array/assign_to_subexpr.wgsl.expected.spvasm +++ b/test/tint/array/assign_to_subexpr.wgsl.expected.spvasm @@ -34,7 +34,7 @@ %22 = OpConstantNull %_arr__arr_int_uint_4_uint_2 %uint_0 = OpConstant %uint 0 %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 + %28 = OpConstantNull %int %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn @@ -51,7 +51,7 @@ OpStore %dst %11 %27 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_struct %uint_0 OpStore %27 %11 - %29 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_array %int_0 + %29 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_array %28 OpStore %29 %11 OpReturn OpFunctionEnd diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.dxc.hlsl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f55b619ea3 --- /dev/null +++ b/test/tint/array/assign_to_workgroup_var.wgsl.expected.dxc.hlsl @@ -0,0 +1,70 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int4 arr[4]; +}; + +static int4 src_private[4] = (int4[4])0; +groupshared int4 src_workgroup[4]; +cbuffer cbuffer_src_uniform : register(b0, space0) { + uint4 src_uniform[4]; +}; +RWByteAddressBuffer src_storage : register(u1, space0); +groupshared int4 tint_symbol[4]; +groupshared int dst_nested[4][3][2]; + +typedef int4 ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const int4 tint_symbol_6[4] = (int4[4])0; + return tint_symbol_6; +} + +S ret_struct_arr() { + const S tint_symbol_7 = (S)0; + return tint_symbol_7; +} + +typedef int4 tint_symbol_2_ret[4]; +tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + const uint scalar_offset = ((offset + (i * 16u))) / 4; + arr_1[i] = asint(buffer[scalar_offset / 4]); + } + } + return arr_1; +} + +typedef int4 tint_symbol_4_ret[4]; +tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { + int4 arr_2[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); + } + } + return arr_2; +} + +void foo(int4 src_param[4]) { + int4 src_function[4] = (int4[4])0; + const int4 tint_symbol_8[4] = {(1).xxxx, (2).xxxx, (3).xxxx, (3).xxxx}; + tint_symbol = tint_symbol_8; + tint_symbol = src_param; + tint_symbol = ret_arr(); + const int4 src_let[4] = (int4[4])0; + tint_symbol = src_let; + tint_symbol = src_function; + tint_symbol = src_private; + tint_symbol = src_workgroup; + const S tint_symbol_1 = ret_struct_arr(); + tint_symbol = tint_symbol_1.arr; + tint_symbol = tint_symbol_2(src_uniform, 0u); + tint_symbol = tint_symbol_4(src_storage, 0u); + int src_nested[4][3][2] = (int[4][3][2])0; + dst_nested = src_nested; +} diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.fxc.hlsl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f55b619ea3 --- /dev/null +++ b/test/tint/array/assign_to_workgroup_var.wgsl.expected.fxc.hlsl @@ -0,0 +1,70 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int4 arr[4]; +}; + +static int4 src_private[4] = (int4[4])0; +groupshared int4 src_workgroup[4]; +cbuffer cbuffer_src_uniform : register(b0, space0) { + uint4 src_uniform[4]; +}; +RWByteAddressBuffer src_storage : register(u1, space0); +groupshared int4 tint_symbol[4]; +groupshared int dst_nested[4][3][2]; + +typedef int4 ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const int4 tint_symbol_6[4] = (int4[4])0; + return tint_symbol_6; +} + +S ret_struct_arr() { + const S tint_symbol_7 = (S)0; + return tint_symbol_7; +} + +typedef int4 tint_symbol_2_ret[4]; +tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + const uint scalar_offset = ((offset + (i * 16u))) / 4; + arr_1[i] = asint(buffer[scalar_offset / 4]); + } + } + return arr_1; +} + +typedef int4 tint_symbol_4_ret[4]; +tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { + int4 arr_2[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); + } + } + return arr_2; +} + +void foo(int4 src_param[4]) { + int4 src_function[4] = (int4[4])0; + const int4 tint_symbol_8[4] = {(1).xxxx, (2).xxxx, (3).xxxx, (3).xxxx}; + tint_symbol = tint_symbol_8; + tint_symbol = src_param; + tint_symbol = ret_arr(); + const int4 src_let[4] = (int4[4])0; + tint_symbol = src_let; + tint_symbol = src_function; + tint_symbol = src_private; + tint_symbol = src_workgroup; + const S tint_symbol_1 = ret_struct_arr(); + tint_symbol = tint_symbol_1.arr; + tint_symbol = tint_symbol_2(src_uniform, 0u); + tint_symbol = tint_symbol_4(src_storage, 0u); + int src_nested[4][3][2] = (int[4][3][2])0; + dst_nested = src_nested; +} diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl index 9c78086338..e32aa2287b 100644 --- a/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl +++ b/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl @@ -20,12 +20,12 @@ layout(binding = 1, std430) buffer S_2 { shared ivec4 dst[4]; shared int dst_nested[4][3][2]; ivec4[4] ret_arr() { - ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); + ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); return tint_symbol_1; } S ret_struct_arr() { - S tint_symbol_2 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0))); + S tint_symbol_2 = S(ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0))); return tint_symbol_2; } @@ -35,7 +35,7 @@ void foo(ivec4 src_param[4]) { dst = tint_symbol_3; dst = src_param; dst = ret_arr(); - ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); + ivec4 src_let[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); dst = src_let; dst = src_function; dst = src_private; diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.hlsl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.hlsl deleted file mode 100644 index 82bac27a65..0000000000 --- a/test/tint/array/assign_to_workgroup_var.wgsl.expected.hlsl +++ /dev/null @@ -1,70 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -struct S { - int4 arr[4]; -}; - -static int4 src_private[4] = (int4[4])0; -groupshared int4 src_workgroup[4]; -cbuffer cbuffer_src_uniform : register(b0, space0) { - uint4 src_uniform[4]; -}; -RWByteAddressBuffer src_storage : register(u1, space0); -groupshared int4 tint_symbol[4]; -groupshared int dst_nested[4][3][2]; - -typedef int4 ret_arr_ret[4]; -ret_arr_ret ret_arr() { - const int4 tint_symbol_6[4] = (int4[4])0; - return tint_symbol_6; -} - -S ret_struct_arr() { - const S tint_symbol_7 = (S)0; - return tint_symbol_7; -} - -typedef int4 tint_symbol_2_ret[4]; -tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) { - int4 arr_1[4] = (int4[4])0; - { - [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { - const uint scalar_offset = ((offset + (i * 16u))) / 4; - arr_1[i] = asint(buffer[scalar_offset / 4]); - } - } - return arr_1; -} - -typedef int4 tint_symbol_4_ret[4]; -tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { - int4 arr_2[4] = (int4[4])0; - { - [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { - arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); - } - } - return arr_2; -} - -void foo(int4 src_param[4]) { - int4 src_function[4] = (int4[4])0; - const int4 tint_symbol_8[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)}; - tint_symbol = tint_symbol_8; - tint_symbol = src_param; - tint_symbol = ret_arr(); - const int4 src_let[4] = (int4[4])0; - tint_symbol = src_let; - tint_symbol = src_function; - tint_symbol = src_private; - tint_symbol = src_workgroup; - const S tint_symbol_1 = ret_struct_arr(); - tint_symbol = tint_symbol_1.arr; - tint_symbol = tint_symbol_2(src_uniform, 0u); - tint_symbol = tint_symbol_4(src_storage, 0u); - int src_nested[4][3][2] = (int[4][3][2])0; - dst_nested = src_nested; -} diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.msl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.msl index 9fab331781..a356fab2ff 100644 --- a/test/tint/array/assign_to_workgroup_var.wgsl.expected.msl +++ b/test/tint/array/assign_to_workgroup_var.wgsl.expected.msl @@ -1,52 +1,50 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct S { - /* 0x0000 */ tint_array_wrapper arr; + /* 0x0000 */ tint_array arr; }; -struct tint_array_wrapper_3 { - int arr[2]; -}; - -struct tint_array_wrapper_2 { - tint_array_wrapper_3 arr[3]; -}; - -struct tint_array_wrapper_1 { - tint_array_wrapper_2 arr[4]; -}; - -tint_array_wrapper ret_arr() { - tint_array_wrapper const tint_symbol_1 = {.arr={}}; +tint_array ret_arr() { + tint_array const tint_symbol_1 = tint_array{}; return tint_symbol_1; } S ret_struct_arr() { - S const tint_symbol_2 = {}; + S const tint_symbol_2 = S{}; return tint_symbol_2; } -void foo(tint_array_wrapper src_param, threadgroup tint_array_wrapper* const tint_symbol_4, thread tint_array_wrapper* const tint_symbol_5, threadgroup tint_array_wrapper* const tint_symbol_6, const constant S* const tint_symbol_7, device S* const tint_symbol_8, threadgroup tint_array_wrapper_1* const tint_symbol_9) { - tint_array_wrapper src_function = {}; - tint_array_wrapper const tint_symbol_3 = {.arr={int4(1), int4(2), int4(3), int4(3)}}; +void foo(tint_array src_param, threadgroup tint_array* const tint_symbol_4, threadgroup tint_array* const tint_symbol_6, const constant S* const tint_symbol_7, device S* const tint_symbol_8, threadgroup tint_array, 3>, 4>* const tint_symbol_9) { + thread tint_array tint_symbol_5 = {}; + tint_array src_function = {}; + tint_array const tint_symbol_3 = tint_array{int4(1), int4(2), int4(3), int4(3)}; *(tint_symbol_4) = tint_symbol_3; *(tint_symbol_4) = src_param; *(tint_symbol_4) = ret_arr(); - tint_array_wrapper const src_let = {.arr={}}; + tint_array const src_let = tint_array{}; *(tint_symbol_4) = src_let; *(tint_symbol_4) = src_function; - *(tint_symbol_4) = *(tint_symbol_5); + *(tint_symbol_4) = tint_symbol_5; *(tint_symbol_4) = *(tint_symbol_6); S const tint_symbol = ret_struct_arr(); *(tint_symbol_4) = tint_symbol.arr; *(tint_symbol_4) = (*(tint_symbol_7)).arr; *(tint_symbol_4) = (*(tint_symbol_8)).arr; - tint_array_wrapper_1 src_nested = {}; + tint_array, 3>, 4> src_nested = {}; *(tint_symbol_9) = src_nested; } diff --git a/test/tint/array/function_parameter.wgsl b/test/tint/array/function_parameter.wgsl index 23de855764..be06c51413 100644 --- a/test/tint/array/function_parameter.wgsl +++ b/test/tint/array/function_parameter.wgsl @@ -10,7 +10,7 @@ fn f3(a : array, 3>, 2>) -> f32 { return a[1][2][3]; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let a1 : array = array(); let a2 : array, 3> = array, 3>(); diff --git a/test/tint/array/function_parameter.wgsl.expected.hlsl b/test/tint/array/function_parameter.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/array/function_parameter.wgsl.expected.hlsl rename to test/tint/array/function_parameter.wgsl.expected.dxc.hlsl diff --git a/test/tint/array/function_parameter.wgsl.expected.fxc.hlsl b/test/tint/array/function_parameter.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b2e7f4146a --- /dev/null +++ b/test/tint/array/function_parameter.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +float f1(float a[4]) { + return a[3]; +} + +float f2(float a[3][4]) { + return a[2][3]; +} + +float f3(float a[2][3][4]) { + return a[1][2][3]; +} + +[numthreads(1, 1, 1)] +void main() { + const float a1[4] = (float[4])0; + const float a2[3][4] = (float[3][4])0; + const float a3[2][3][4] = (float[2][3][4])0; + const float v1 = f1(a1); + const float v2 = f2(a2); + const float v3 = f3(a3); + return; +} diff --git a/test/tint/array/function_parameter.wgsl.expected.msl b/test/tint/array/function_parameter.wgsl.expected.msl index 277889edbe..bf68a61082 100644 --- a/test/tint/array/function_parameter.wgsl.expected.msl +++ b/test/tint/array/function_parameter.wgsl.expected.msl @@ -1,34 +1,35 @@ #include using namespace metal; -struct tint_array_wrapper { - float arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -float f1(tint_array_wrapper a) { - return a.arr[3]; +float f1(tint_array a) { + return a[3]; } -struct tint_array_wrapper_1 { - tint_array_wrapper arr[3]; -}; - -float f2(tint_array_wrapper_1 a) { - return a.arr[2].arr[3]; +float f2(tint_array, 3> a) { + return a[2][3]; } -struct tint_array_wrapper_2 { - tint_array_wrapper_1 arr[2]; -}; - -float f3(tint_array_wrapper_2 a) { - return a.arr[1].arr[2].arr[3]; +float f3(tint_array, 3>, 2> a) { + return a[1][2][3]; } kernel void tint_symbol() { - tint_array_wrapper const a1 = {.arr={}}; - tint_array_wrapper_1 const a2 = {.arr={}}; - tint_array_wrapper_2 const a3 = {.arr={}}; + tint_array const a1 = tint_array{}; + tint_array, 3> const a2 = tint_array, 3>{}; + tint_array, 3>, 2> const a3 = tint_array, 3>, 2>{}; float const v1 = f1(a1); float const v2 = f2(a2); float const v3 = f3(a3); diff --git a/test/tint/array/function_parameter.wgsl.expected.wgsl b/test/tint/array/function_parameter.wgsl.expected.wgsl index 23de855764..be06c51413 100644 --- a/test/tint/array/function_parameter.wgsl.expected.wgsl +++ b/test/tint/array/function_parameter.wgsl.expected.wgsl @@ -10,7 +10,7 @@ fn f3(a : array, 3>, 2>) -> f32 { return a[1][2][3]; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let a1 : array = array(); let a2 : array, 3> = array, 3>(); diff --git a/test/tint/array/function_return_type.wgsl b/test/tint/array/function_return_type.wgsl index 749124546a..4b5dddc81c 100644 --- a/test/tint/array/function_return_type.wgsl +++ b/test/tint/array/function_return_type.wgsl @@ -10,7 +10,7 @@ fn f3() -> array, 3>, 2> { return array, 3>, 2>(f2(), f2()); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let a1 : array = f1(); let a2 : array, 3> = f2(); diff --git a/test/tint/array/function_return_type.wgsl.expected.hlsl b/test/tint/array/function_return_type.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/array/function_return_type.wgsl.expected.hlsl rename to test/tint/array/function_return_type.wgsl.expected.dxc.hlsl diff --git a/test/tint/array/function_return_type.wgsl.expected.fxc.hlsl b/test/tint/array/function_return_type.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..954b06007c --- /dev/null +++ b/test/tint/array/function_return_type.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +typedef float f1_ret[4]; +f1_ret f1() { + const float tint_symbol_5[4] = (float[4])0; + return tint_symbol_5; +} + +typedef float f2_ret[3][4]; +f2_ret f2() { + const float tint_symbol[4] = f1(); + const float tint_symbol_1[4] = f1(); + const float tint_symbol_2[4] = f1(); + const float tint_symbol_6[3][4] = {tint_symbol, tint_symbol_1, tint_symbol_2}; + return tint_symbol_6; +} + +typedef float f3_ret[2][3][4]; +f3_ret f3() { + const float tint_symbol_3[3][4] = f2(); + const float tint_symbol_4[3][4] = f2(); + const float tint_symbol_7[2][3][4] = {tint_symbol_3, tint_symbol_4}; + return tint_symbol_7; +} + +[numthreads(1, 1, 1)] +void main() { + const float a1[4] = f1(); + const float a2[3][4] = f2(); + const float a3[2][3][4] = f3(); + return; +} diff --git a/test/tint/array/function_return_type.wgsl.expected.msl b/test/tint/array/function_return_type.wgsl.expected.msl index 8d7634a647..703fc8867b 100644 --- a/test/tint/array/function_return_type.wgsl.expected.msl +++ b/test/tint/array/function_return_type.wgsl.expected.msl @@ -1,42 +1,43 @@ #include using namespace metal; -struct tint_array_wrapper { - float arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -tint_array_wrapper f1() { - tint_array_wrapper const tint_symbol_6 = {.arr={}}; +tint_array f1() { + tint_array const tint_symbol_6 = tint_array{}; return tint_symbol_6; } -struct tint_array_wrapper_1 { - tint_array_wrapper arr[3]; -}; - -tint_array_wrapper_1 f2() { - tint_array_wrapper const tint_symbol_1 = f1(); - tint_array_wrapper const tint_symbol_2 = f1(); - tint_array_wrapper const tint_symbol_3 = f1(); - tint_array_wrapper_1 const tint_symbol_7 = {.arr={tint_symbol_1, tint_symbol_2, tint_symbol_3}}; +tint_array, 3> f2() { + tint_array const tint_symbol_1 = f1(); + tint_array const tint_symbol_2 = f1(); + tint_array const tint_symbol_3 = f1(); + tint_array, 3> const tint_symbol_7 = tint_array, 3>{tint_symbol_1, tint_symbol_2, tint_symbol_3}; return tint_symbol_7; } -struct tint_array_wrapper_2 { - tint_array_wrapper_1 arr[2]; -}; - -tint_array_wrapper_2 f3() { - tint_array_wrapper_1 const tint_symbol_4 = f2(); - tint_array_wrapper_1 const tint_symbol_5 = f2(); - tint_array_wrapper_2 const tint_symbol_8 = {.arr={tint_symbol_4, tint_symbol_5}}; +tint_array, 3>, 2> f3() { + tint_array, 3> const tint_symbol_4 = f2(); + tint_array, 3> const tint_symbol_5 = f2(); + tint_array, 3>, 2> const tint_symbol_8 = tint_array, 3>, 2>{tint_symbol_4, tint_symbol_5}; return tint_symbol_8; } kernel void tint_symbol() { - tint_array_wrapper const a1 = f1(); - tint_array_wrapper_1 const a2 = f2(); - tint_array_wrapper_2 const a3 = f3(); + tint_array const a1 = f1(); + tint_array, 3> const a2 = f2(); + tint_array, 3>, 2> const a3 = f3(); return; } diff --git a/test/tint/array/function_return_type.wgsl.expected.wgsl b/test/tint/array/function_return_type.wgsl.expected.wgsl index 749124546a..4b5dddc81c 100644 --- a/test/tint/array/function_return_type.wgsl.expected.wgsl +++ b/test/tint/array/function_return_type.wgsl.expected.wgsl @@ -10,7 +10,7 @@ fn f3() -> array, 3>, 2> { return array, 3>, 2>(f2(), f2()); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let a1 : array = f1(); let a2 : array, 3> = f2(); diff --git a/test/tint/array/size.wgsl b/test/tint/array/size.wgsl index 60721dbf6e..4b2ec371a8 100644 --- a/test/tint/array/size.wgsl +++ b/test/tint/array/size.wgsl @@ -1,7 +1,7 @@ -let slen = 4; -let ulen = 4u; +const slen = 4; +const ulen = 4u; -@stage(fragment) +@fragment fn main() { var signed_literal : array; var unsigned_literal : array; diff --git a/test/tint/array/size.wgsl.expected.dxc.hlsl b/test/tint/array/size.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4753dde800 --- /dev/null +++ b/test/tint/array/size.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void main() { + float signed_literal[4] = (float[4])0; + float unsigned_literal[4] = (float[4])0; + float signed_constant[4] = (float[4])0; + float unsigned_constant[4] = (float[4])0; + signed_literal = unsigned_constant; + signed_constant = unsigned_literal; + return; +} diff --git a/test/tint/array/size.wgsl.expected.fxc.hlsl b/test/tint/array/size.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4753dde800 --- /dev/null +++ b/test/tint/array/size.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void main() { + float signed_literal[4] = (float[4])0; + float unsigned_literal[4] = (float[4])0; + float signed_constant[4] = (float[4])0; + float unsigned_constant[4] = (float[4])0; + signed_literal = unsigned_constant; + signed_constant = unsigned_literal; + return; +} diff --git a/test/tint/array/size.wgsl.expected.glsl b/test/tint/array/size.wgsl.expected.glsl index 762d5c84b8..132511d617 100644 --- a/test/tint/array/size.wgsl.expected.glsl +++ b/test/tint/array/size.wgsl.expected.glsl @@ -1,8 +1,6 @@ #version 310 es precision mediump float; -const int slen = 4; -const uint ulen = 4u; void tint_symbol() { float signed_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); float unsigned_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); diff --git a/test/tint/array/size.wgsl.expected.hlsl b/test/tint/array/size.wgsl.expected.hlsl deleted file mode 100644 index e5fdbd3c7e..0000000000 --- a/test/tint/array/size.wgsl.expected.hlsl +++ /dev/null @@ -1,12 +0,0 @@ -static const int slen = 4; -static const uint ulen = 4u; - -void main() { - float signed_literal[4] = (float[4])0; - float unsigned_literal[4] = (float[4])0; - float signed_constant[4] = (float[4])0; - float unsigned_constant[4] = (float[4])0; - signed_literal = unsigned_constant; - signed_constant = unsigned_literal; - return; -} diff --git a/test/tint/array/size.wgsl.expected.msl b/test/tint/array/size.wgsl.expected.msl index 0150ece50b..f72c5aa9ba 100644 --- a/test/tint/array/size.wgsl.expected.msl +++ b/test/tint/array/size.wgsl.expected.msl @@ -1,19 +1,24 @@ #include using namespace metal; -constant int slen = 4; -constant uint ulen = 4u; - -struct tint_array_wrapper { - float arr[4]; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; fragment void tint_symbol() { - tint_array_wrapper signed_literal = {}; - tint_array_wrapper unsigned_literal = {}; - tint_array_wrapper signed_constant = {}; - tint_array_wrapper unsigned_constant = {}; + tint_array signed_literal = {}; + tint_array unsigned_literal = {}; + tint_array signed_constant = {}; + tint_array unsigned_constant = {}; signed_literal = unsigned_constant; signed_constant = unsigned_literal; return; diff --git a/test/tint/array/size.wgsl.expected.spvasm b/test/tint/array/size.wgsl.expected.spvasm index ada562b6c9..ac1a0c93cb 100644 --- a/test/tint/array/size.wgsl.expected.spvasm +++ b/test/tint/array/size.wgsl.expected.spvasm @@ -1,39 +1,35 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 17 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft - OpName %slen "slen" - OpName %ulen "ulen" OpName %main "main" OpName %signed_literal "signed_literal" OpName %unsigned_literal "unsigned_literal" OpName %signed_constant "signed_constant" OpName %unsigned_constant "unsigned_constant" - OpDecorate %_arr_float_ulen ArrayStride 4 - %int = OpTypeInt 32 1 - %slen = OpConstant %int 4 - %uint = OpTypeInt 32 0 - %ulen = OpConstant %uint 4 + OpDecorate %_arr_float_uint_4 ArrayStride 4 %void = OpTypeVoid - %5 = OpTypeFunction %void + %1 = OpTypeFunction %void %float = OpTypeFloat 32 -%_arr_float_ulen = OpTypeArray %float %ulen -%_ptr_Function__arr_float_ulen = OpTypePointer Function %_arr_float_ulen - %13 = OpConstantNull %_arr_float_ulen - %main = OpFunction %void None %5 - %8 = OpLabel -%signed_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13 -%unsigned_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13 -%signed_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13 -%unsigned_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13 - %17 = OpLoad %_arr_float_ulen %unsigned_constant - OpStore %signed_literal %17 - %18 = OpLoad %_arr_float_ulen %unsigned_literal - OpStore %signed_constant %18 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4 + %11 = OpConstantNull %_arr_float_uint_4 + %main = OpFunction %void None %1 + %4 = OpLabel +%signed_literal = OpVariable %_ptr_Function__arr_float_uint_4 Function %11 +%unsigned_literal = OpVariable %_ptr_Function__arr_float_uint_4 Function %11 +%signed_constant = OpVariable %_ptr_Function__arr_float_uint_4 Function %11 +%unsigned_constant = OpVariable %_ptr_Function__arr_float_uint_4 Function %11 + %15 = OpLoad %_arr_float_uint_4 %unsigned_constant + OpStore %signed_literal %15 + %16 = OpLoad %_arr_float_uint_4 %unsigned_literal + OpStore %signed_constant %16 OpReturn OpFunctionEnd diff --git a/test/tint/array/size.wgsl.expected.wgsl b/test/tint/array/size.wgsl.expected.wgsl index 0998407a21..a82c3773b9 100644 --- a/test/tint/array/size.wgsl.expected.wgsl +++ b/test/tint/array/size.wgsl.expected.wgsl @@ -1,8 +1,8 @@ -let slen = 4; +const slen = 4; -let ulen = 4u; +const ulen = 4u; -@stage(fragment) +@fragment fn main() { var signed_literal : array; var unsigned_literal : array; diff --git a/test/tint/array/strides.spvasm b/test/tint/array/strides.spvasm index d0ae14d7bd..9730642eb1 100644 --- a/test/tint/array/strides.spvasm +++ b/test/tint/array/strides.spvasm @@ -5,7 +5,7 @@ ; }; ; @group(0) @binding(0) var s : S; ; -; @stage(compute) @workgroup_size(1) +; @compute @workgroup_size(1) ; fn f() { ; let a : ARR_B = s.a; ; let b : array<@stride(8) array, 3> = s.a[3]; diff --git a/test/tint/array/strides.spvasm.expected.hlsl b/test/tint/array/strides.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/array/strides.spvasm.expected.hlsl rename to test/tint/array/strides.spvasm.expected.dxc.hlsl diff --git a/test/tint/array/strides.spvasm.expected.fxc.hlsl b/test/tint/array/strides.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..910a49a935 --- /dev/null +++ b/test/tint/array/strides.spvasm.expected.fxc.hlsl @@ -0,0 +1,103 @@ +struct strided_arr { + float el; +}; +struct strided_arr_1 { + strided_arr el[3][2]; +}; + +RWByteAddressBuffer s : register(u0, space0); + +strided_arr tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { + const strided_arr tint_symbol_12 = {asfloat(buffer.Load((offset + 0u)))}; + return tint_symbol_12; +} + +typedef strided_arr tint_symbol_3_ret[2]; +tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) { + strided_arr arr[2] = (strided_arr[2])0; + { + [loop] for(uint i = 0u; (i < 2u); i = (i + 1u)) { + arr[i] = tint_symbol_4(buffer, (offset + (i * 8u))); + } + } + return arr; +} + +typedef strided_arr tint_symbol_2_ret[3][2]; +tint_symbol_2_ret tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { + strided_arr arr_1[3][2] = (strided_arr[3][2])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 3u); i_1 = (i_1 + 1u)) { + arr_1[i_1] = tint_symbol_3(buffer, (offset + (i_1 * 16u))); + } + } + return arr_1; +} + +strided_arr_1 tint_symbol_1(RWByteAddressBuffer buffer, uint offset) { + const strided_arr_1 tint_symbol_13 = {tint_symbol_2(buffer, (offset + 0u))}; + return tint_symbol_13; +} + +typedef strided_arr_1 tint_symbol_ret[4]; +tint_symbol_ret tint_symbol(RWByteAddressBuffer buffer, uint offset) { + strided_arr_1 arr_2[4] = (strided_arr_1[4])0; + { + [loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) { + arr_2[i_2] = tint_symbol_1(buffer, (offset + (i_2 * 128u))); + } + } + return arr_2; +} + +void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, strided_arr value) { + buffer.Store((offset + 0u), asuint(value.el)); +} + +void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, strided_arr value[2]) { + strided_arr array_2[2] = value; + { + [loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) { + tint_symbol_10(buffer, (offset + (i_3 * 8u)), array_2[i_3]); + } + } +} + +void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, strided_arr value[3][2]) { + strided_arr array_1[3][2] = value; + { + [loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) { + tint_symbol_9(buffer, (offset + (i_4 * 16u)), array_1[i_4]); + } + } +} + +void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, strided_arr_1 value) { + tint_symbol_8(buffer, (offset + 0u), value.el); +} + +void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, strided_arr_1 value[4]) { + strided_arr_1 array[4] = value; + { + [loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) { + tint_symbol_7(buffer, (offset + (i_5 * 128u)), array[i_5]); + } + } +} + +void f_1() { + const strided_arr_1 x_19[4] = tint_symbol(s, 0u); + const strided_arr x_24[3][2] = tint_symbol_2(s, 384u); + const strided_arr x_28[2] = tint_symbol_3(s, 416u); + const float x_32 = asfloat(s.Load(424u)); + const strided_arr_1 tint_symbol_14[4] = (strided_arr_1[4])0; + tint_symbol_6(s, 0u, tint_symbol_14); + s.Store(424u, asuint(5.0f)); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/array/strides.spvasm.expected.msl b/test/tint/array/strides.spvasm.expected.msl index 8db28bd2d5..47d578e305 100644 --- a/test/tint/array/strides.spvasm.expected.msl +++ b/test/tint/array/strides.spvasm.expected.msl @@ -1,40 +1,41 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct strided_arr { /* 0x0000 */ float el; - /* 0x0004 */ int8_t tint_pad[4]; -}; - -struct tint_array_wrapper { - /* 0x0000 */ strided_arr arr[2]; -}; - -struct tint_array_wrapper_1 { - /* 0x0000 */ tint_array_wrapper arr[3]; + /* 0x0004 */ tint_array tint_pad; }; struct strided_arr_1 { - /* 0x0000 */ tint_array_wrapper_1 el; - /* 0x0030 */ int8_t tint_pad_1[80]; -}; - -struct tint_array_wrapper_2 { - /* 0x0000 */ strided_arr_1 arr[4]; + /* 0x0000 */ tint_array, 3> el; + /* 0x0030 */ tint_array tint_pad_1; }; struct S { - /* 0x0000 */ tint_array_wrapper_2 a; + /* 0x0000 */ tint_array a; }; void f_1(device S* const tint_symbol_1) { - tint_array_wrapper_2 const x_19 = (*(tint_symbol_1)).a; - tint_array_wrapper_1 const x_24 = (*(tint_symbol_1)).a.arr[3].el; - tint_array_wrapper const x_28 = (*(tint_symbol_1)).a.arr[3].el.arr[2]; - float const x_32 = (*(tint_symbol_1)).a.arr[3].el.arr[2].arr[1].el; - tint_array_wrapper_2 const tint_symbol = {.arr={}}; + tint_array const x_19 = (*(tint_symbol_1)).a; + tint_array, 3> const x_24 = (*(tint_symbol_1)).a[3].el; + tint_array const x_28 = (*(tint_symbol_1)).a[3].el[2]; + float const x_32 = (*(tint_symbol_1)).a[3].el[2][1].el; + tint_array const tint_symbol = tint_array{}; (*(tint_symbol_1)).a = tint_symbol; - (*(tint_symbol_1)).a.arr[3].el.arr[2].arr[1].el = 5.0f; + (*(tint_symbol_1)).a[3].el[2][1].el = 5.0f; return; } diff --git a/test/tint/array/strides.spvasm.expected.wgsl b/test/tint/array/strides.spvasm.expected.wgsl index 6713a1669f..74fe15c627 100644 --- a/test/tint/array/strides.spvasm.expected.wgsl +++ b/test/tint/array/strides.spvasm.expected.wgsl @@ -26,11 +26,11 @@ fn f_1() { let x_28 : Arr = s.a[3i].el[2i]; let x_32 : f32 = s.a[3i].el[2i][1i].el; s.a = array(); - s.a[3i].el[2i][1i].el = 5.0; + s.a[3i].el[2i][1i].el = 5.0f; return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/array/type_constructor.wgsl b/test/tint/array/type_constructor.wgsl index 8a07f39a83..e975089f99 100644 --- a/test/tint/array/type_constructor.wgsl +++ b/test/tint/array/type_constructor.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x : i32 = 42; diff --git a/test/tint/array/type_constructor.wgsl.expected.hlsl b/test/tint/array/type_constructor.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/array/type_constructor.wgsl.expected.hlsl rename to test/tint/array/type_constructor.wgsl.expected.dxc.hlsl diff --git a/test/tint/array/type_constructor.wgsl.expected.fxc.hlsl b/test/tint/array/type_constructor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8640324cbc --- /dev/null +++ b/test/tint/array/type_constructor.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +[numthreads(1, 1, 1)] +void main() { + const int x = 42; + const int empty[4] = (int[4])0; + const int nonempty[4] = {1, 2, 3, 4}; + const int nonempty_with_expr[4] = {1, x, (x + 1), nonempty[3]}; + const int nested_empty[2][3][4] = (int[2][3][4])0; + const int tint_symbol[4] = {1, 2, 3, 4}; + const int tint_symbol_1[4] = {5, 6, 7, 8}; + const int tint_symbol_2[4] = {9, 10, 11, 12}; + const int tint_symbol_3[3][4] = {tint_symbol, tint_symbol_1, tint_symbol_2}; + const int tint_symbol_4[4] = {13, 14, 15, 16}; + const int tint_symbol_5[4] = {17, 18, 19, 20}; + const int tint_symbol_6[4] = {21, 22, 23, 24}; + const int tint_symbol_7[3][4] = {tint_symbol_4, tint_symbol_5, tint_symbol_6}; + const int nested_nonempty[2][3][4] = {tint_symbol_3, tint_symbol_7}; + const int tint_symbol_8[4] = {1, 2, x, (x + 1)}; + const int tint_symbol_9[4] = {5, 6, nonempty[2], (nonempty[3] + 1)}; + const int tint_symbol_10[3][4] = {tint_symbol_8, tint_symbol_9, nonempty}; + const int nested_nonempty_with_expr[2][3][4] = {tint_symbol_10, nested_nonempty[1]}; + const int tint_symbol_11[4] = (int[4])0; + const int subexpr_empty = tint_symbol_11[1]; + const int tint_symbol_12[4] = {1, 2, 3, 4}; + const int subexpr_nonempty = tint_symbol_12[2]; + const int tint_symbol_13[4] = {1, x, (x + 1), nonempty[3]}; + const int subexpr_nonempty_with_expr = tint_symbol_13[2]; + const int tint_symbol_14[2][4] = (int[2][4])0; + const int subexpr_nested_empty[4] = tint_symbol_14[1]; + const int tint_symbol_15[4] = {1, 2, 3, 4}; + const int tint_symbol_16[4] = {5, 6, 7, 8}; + const int tint_symbol_17[2][4] = {tint_symbol_15, tint_symbol_16}; + const int subexpr_nested_nonempty[4] = tint_symbol_17[1]; + const int tint_symbol_18[4] = {1, x, (x + 1), nonempty[3]}; + const int tint_symbol_19[2][4] = {tint_symbol_18, nested_nonempty[1][2]}; + const int subexpr_nested_nonempty_with_expr[4] = tint_symbol_19[1]; + return; +} diff --git a/test/tint/array/type_constructor.wgsl.expected.msl b/test/tint/array/type_constructor.wgsl.expected.msl index bd40591acd..d2ca398fe1 100644 --- a/test/tint/array/type_constructor.wgsl.expected.msl +++ b/test/tint/array/type_constructor.wgsl.expected.msl @@ -1,56 +1,53 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[4]; -}; -struct tint_array_wrapper_2 { - tint_array_wrapper arr[3]; -}; - -struct tint_array_wrapper_1 { - tint_array_wrapper_2 arr[2]; -}; - -struct tint_array_wrapper_3 { - tint_array_wrapper arr[2]; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; kernel void tint_symbol() { int const x = 42; - tint_array_wrapper const empty = {.arr={}}; - tint_array_wrapper const nonempty = {.arr={1, 2, 3, 4}}; - tint_array_wrapper const nonempty_with_expr = {.arr={1, x, as_type((as_type(x) + as_type(1))), nonempty.arr[3]}}; - tint_array_wrapper_1 const nested_empty = {.arr={}}; - tint_array_wrapper const tint_symbol_1 = {.arr={1, 2, 3, 4}}; - tint_array_wrapper const tint_symbol_2 = {.arr={5, 6, 7, 8}}; - tint_array_wrapper const tint_symbol_3 = {.arr={9, 10, 11, 12}}; - tint_array_wrapper_2 const tint_symbol_4 = {.arr={tint_symbol_1, tint_symbol_2, tint_symbol_3}}; - tint_array_wrapper const tint_symbol_5 = {.arr={13, 14, 15, 16}}; - tint_array_wrapper const tint_symbol_6 = {.arr={17, 18, 19, 20}}; - tint_array_wrapper const tint_symbol_7 = {.arr={21, 22, 23, 24}}; - tint_array_wrapper_2 const tint_symbol_8 = {.arr={tint_symbol_5, tint_symbol_6, tint_symbol_7}}; - tint_array_wrapper_1 const nested_nonempty = {.arr={tint_symbol_4, tint_symbol_8}}; - tint_array_wrapper const tint_symbol_9 = {.arr={1, 2, x, as_type((as_type(x) + as_type(1)))}}; - tint_array_wrapper const tint_symbol_10 = {.arr={5, 6, nonempty.arr[2], as_type((as_type(nonempty.arr[3]) + as_type(1)))}}; - tint_array_wrapper_2 const tint_symbol_11 = {.arr={tint_symbol_9, tint_symbol_10, nonempty}}; - tint_array_wrapper_1 const nested_nonempty_with_expr = {.arr={tint_symbol_11, nested_nonempty.arr[1]}}; - tint_array_wrapper const tint_symbol_12 = {.arr={}}; - int const subexpr_empty = tint_symbol_12.arr[1]; - tint_array_wrapper const tint_symbol_13 = {.arr={1, 2, 3, 4}}; - int const subexpr_nonempty = tint_symbol_13.arr[2]; - tint_array_wrapper const tint_symbol_14 = {.arr={1, x, as_type((as_type(x) + as_type(1))), nonempty.arr[3]}}; - int const subexpr_nonempty_with_expr = tint_symbol_14.arr[2]; - tint_array_wrapper_3 const tint_symbol_15 = {.arr={}}; - tint_array_wrapper const subexpr_nested_empty = tint_symbol_15.arr[1]; - tint_array_wrapper const tint_symbol_16 = {.arr={1, 2, 3, 4}}; - tint_array_wrapper const tint_symbol_17 = {.arr={5, 6, 7, 8}}; - tint_array_wrapper_3 const tint_symbol_18 = {.arr={tint_symbol_16, tint_symbol_17}}; - tint_array_wrapper const subexpr_nested_nonempty = tint_symbol_18.arr[1]; - tint_array_wrapper const tint_symbol_19 = {.arr={1, x, as_type((as_type(x) + as_type(1))), nonempty.arr[3]}}; - tint_array_wrapper_3 const tint_symbol_20 = {.arr={tint_symbol_19, nested_nonempty.arr[1].arr[2]}}; - tint_array_wrapper const subexpr_nested_nonempty_with_expr = tint_symbol_20.arr[1]; + tint_array const empty = tint_array{}; + tint_array const nonempty = tint_array{1, 2, 3, 4}; + tint_array const nonempty_with_expr = tint_array{1, x, as_type((as_type(x) + as_type(1))), nonempty[3]}; + tint_array, 3>, 2> const nested_empty = tint_array, 3>, 2>{}; + tint_array const tint_symbol_1 = tint_array{1, 2, 3, 4}; + tint_array const tint_symbol_2 = tint_array{5, 6, 7, 8}; + tint_array const tint_symbol_3 = tint_array{9, 10, 11, 12}; + tint_array, 3> const tint_symbol_4 = tint_array, 3>{tint_symbol_1, tint_symbol_2, tint_symbol_3}; + tint_array const tint_symbol_5 = tint_array{13, 14, 15, 16}; + tint_array const tint_symbol_6 = tint_array{17, 18, 19, 20}; + tint_array const tint_symbol_7 = tint_array{21, 22, 23, 24}; + tint_array, 3> const tint_symbol_8 = tint_array, 3>{tint_symbol_5, tint_symbol_6, tint_symbol_7}; + tint_array, 3>, 2> const nested_nonempty = tint_array, 3>, 2>{tint_symbol_4, tint_symbol_8}; + tint_array const tint_symbol_9 = tint_array{1, 2, x, as_type((as_type(x) + as_type(1)))}; + tint_array const tint_symbol_10 = tint_array{5, 6, nonempty[2], as_type((as_type(nonempty[3]) + as_type(1)))}; + tint_array, 3> const tint_symbol_11 = tint_array, 3>{tint_symbol_9, tint_symbol_10, nonempty}; + tint_array, 3>, 2> const nested_nonempty_with_expr = tint_array, 3>, 2>{tint_symbol_11, nested_nonempty[1]}; + tint_array const tint_symbol_12 = tint_array{}; + int const subexpr_empty = tint_symbol_12[1]; + tint_array const tint_symbol_13 = tint_array{1, 2, 3, 4}; + int const subexpr_nonempty = tint_symbol_13[2]; + tint_array const tint_symbol_14 = tint_array{1, x, as_type((as_type(x) + as_type(1))), nonempty[3]}; + int const subexpr_nonempty_with_expr = tint_symbol_14[2]; + tint_array, 2> const tint_symbol_15 = tint_array, 2>{}; + tint_array const subexpr_nested_empty = tint_symbol_15[1]; + tint_array const tint_symbol_16 = tint_array{1, 2, 3, 4}; + tint_array const tint_symbol_17 = tint_array{5, 6, 7, 8}; + tint_array, 2> const tint_symbol_18 = tint_array, 2>{tint_symbol_16, tint_symbol_17}; + tint_array const subexpr_nested_nonempty = tint_symbol_18[1]; + tint_array const tint_symbol_19 = tint_array{1, x, as_type((as_type(x) + as_type(1))), nonempty[3]}; + tint_array, 2> const tint_symbol_20 = tint_array, 2>{tint_symbol_19, nested_nonempty[1][2]}; + tint_array const subexpr_nested_nonempty_with_expr = tint_symbol_20[1]; return; } diff --git a/test/tint/array/type_constructor.wgsl.expected.spvasm b/test/tint/array/type_constructor.wgsl.expected.spvasm index ecc774da76..5d4084d86f 100644 --- a/test/tint/array/type_constructor.wgsl.expected.spvasm +++ b/test/tint/array/type_constructor.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 79 +; Bound: 74 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -58,9 +58,8 @@ %49 = OpConstantComposite %_arr_int_uint_4 %int_21 %int_22 %int_23 %int_24 %50 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %39 %44 %49 %51 = OpConstantComposite %_arr__arr__arr_int_uint_4_uint_3_uint_2 %34 %50 + %61 = OpConstantNull %int %_arr__arr_int_uint_4_uint_2 = OpTypeArray %_arr_int_uint_4 %uint_2 - %68 = OpConstantNull %_arr__arr_int_uint_4_uint_2 - %70 = OpConstantComposite %_arr__arr_int_uint_4_uint_2 %15 %28 %main = OpFunction %void None %1 %4 = OpLabel %16 = OpIAdd %int %int_42 %int_1 @@ -75,20 +74,16 @@ %58 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_3 %53 %57 %15 %59 = OpCompositeExtract %_arr__arr_int_uint_4_uint_3 %51 1 %60 = OpCompositeConstruct %_arr__arr__arr_int_uint_4_uint_3_uint_2 %58 %59 - %61 = OpCompositeExtract %int %10 1 - %62 = OpCompositeExtract %int %15 2 - %63 = OpIAdd %int %int_42 %int_1 - %64 = OpCompositeExtract %int %15 3 - %65 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %63 %64 - %66 = OpCompositeExtract %int %65 2 - %69 = OpCompositeExtract %_arr_int_uint_4 %68 1 - %71 = OpCompositeExtract %_arr_int_uint_4 %70 1 - %72 = OpIAdd %int %int_42 %int_1 - %73 = OpCompositeExtract %int %15 3 - %74 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %72 %73 - %75 = OpCompositeExtract %_arr__arr_int_uint_4_uint_3 %51 1 - %76 = OpCompositeExtract %_arr_int_uint_4 %75 2 - %77 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_2 %74 %76 - %78 = OpCompositeExtract %_arr_int_uint_4 %77 1 + %62 = OpIAdd %int %int_42 %int_1 + %63 = OpCompositeExtract %int %15 3 + %64 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %62 %63 + %65 = OpCompositeExtract %int %64 2 + %67 = OpIAdd %int %int_42 %int_1 + %68 = OpCompositeExtract %int %15 3 + %69 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %67 %68 + %70 = OpCompositeExtract %_arr__arr_int_uint_4_uint_3 %51 1 + %71 = OpCompositeExtract %_arr_int_uint_4 %70 2 + %72 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_2 %69 %71 + %73 = OpCompositeExtract %_arr_int_uint_4 %72 1 OpReturn OpFunctionEnd diff --git a/test/tint/array/type_constructor.wgsl.expected.wgsl b/test/tint/array/type_constructor.wgsl.expected.wgsl index 4381ec8741..a1a942a25b 100644 --- a/test/tint/array/type_constructor.wgsl.expected.wgsl +++ b/test/tint/array/type_constructor.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x : i32 = 42; let empty : array = array(); diff --git a/test/tint/benchmark/animometer.wgsl b/test/tint/benchmark/animometer.wgsl index 393c487149..db0eae28e3 100644 --- a/test/tint/benchmark/animometer.wgsl +++ b/test/tint/benchmark/animometer.wgsl @@ -21,7 +21,7 @@ struct VertexOutput { v_color : vec4, } -@stage(vertex) +@vertex fn vert_main(@location(0) position : vec4, @location(1) color : vec4) -> VertexOutput { var fade : f32 = ((uniforms.scalarOffset + ((time.value * uniforms.scalar) / 10.0)) % 1.0); if ((fade < 0.5)) { @@ -42,7 +42,7 @@ fn vert_main(@location(0) position : vec4, @location(1) color : vec4) return output; } -@stage(fragment) +@fragment fn frag_main(@location(0) v_color : vec4) -> @location(0) vec4 { return v_color; } diff --git a/test/tint/benchmark/atan2-const-eval.wgsl b/test/tint/benchmark/atan2-const-eval.wgsl new file mode 100644 index 0000000000..c089ca6f42 --- /dev/null +++ b/test/tint/benchmark/atan2-const-eval.wgsl @@ -0,0 +1,1009 @@ +struct Output { + @size(16) value : f32 +}; +@group(0) @binding(0) var outputs : array; + + +@compute @workgroup_size(1) +fn main() { + outputs[0].value = atan2((-1.1754943508222875e-38f), (-1.1754943508222875e-38f)); + outputs[1].value = atan2((-1.1754943508222875e-38f), (-1.4172525838845702e+35f)); + outputs[2].value = atan2((-1.1754943508222875e-38f), (-5.669010335538281e+35f)); + outputs[3].value = atan2((-1.1754943508222875e-38f), (-1.2755273056890725e+36f)); + outputs[4].value = atan2((-1.1754943508222875e-38f), (-2.2676041342153123e+36f)); + outputs[5].value = atan2((-1.1754943508222875e-38f), (-3.54313159836071e+36f)); + outputs[6].value = atan2((-1.1754943508222875e-38f), (-5.10210922275629e+36f)); + outputs[7].value = atan2((-1.1754943508222875e-38f), (-6.944537958140003e+36f)); + outputs[8].value = atan2((-1.1754943508222875e-38f), (-9.070416536861249e+36f)); + outputs[9].value = atan2((-1.1754943508222875e-38f), (-1.1479746226570628e+37f)); + outputs[10].value = atan2((-1.1754943508222875e-38f), (-1.417252639344284e+37f)); + outputs[11].value = atan2((-1.1754943508222875e-38f), (-1.7148755769827283e+37f)); + outputs[12].value = atan2((-1.1754943508222875e-38f), (-2.040843689102516e+37f)); + outputs[13].value = atan2((-1.1754943508222875e-38f), (-2.395156848938587e+37f)); + outputs[14].value = atan2((-1.1754943508222875e-38f), (-2.7778151832560013e+37f)); + outputs[15].value = atan2((-1.1754943508222875e-38f), (-3.188818438524639e+37f)); + outputs[16].value = atan2((-1.1754943508222875e-38f), (-3.6281666147444997e+37f)); + outputs[17].value = atan2((-1.1754943508222875e-38f), (-4.0958599654457038e+37f)); + outputs[18].value = atan2((-1.1754943508222875e-38f), (-4.591898490628251e+37f)); + outputs[19].value = atan2((-1.1754943508222875e-38f), (-5.116281936762022e+37f)); + outputs[20].value = atan2((-1.1754943508222875e-38f), (-5.669010557377136e+37f)); + outputs[21].value = atan2((-1.1754943508222875e-38f), (-6.250083845413353e+37f)); + outputs[22].value = atan2((-1.1754943508222875e-38f), (-6.859502307930913e+37f)); + outputs[23].value = atan2((-1.1754943508222875e-38f), (-7.497265944929817e+37f)); + outputs[24].value = atan2((-1.1754943508222875e-38f), (-8.163374756410064e+37f)); + outputs[25].value = atan2((-1.1754943508222875e-38f), (-8.857828235311414e+37f)); + outputs[26].value = atan2((-1.1754943508222875e-38f), (-9.580627395754348e+37f)); + outputs[27].value = atan2((-1.1754943508222875e-38f), (-1.0331771223618385e+38f)); + outputs[28].value = atan2((-1.1754943508222875e-38f), (-1.1111260733024005e+38f)); + outputs[29].value = atan2((-1.1754943508222875e-38f), (-1.1919093895730249e+38f)); + outputs[30].value = atan2((-1.1754943508222875e-38f), (-1.2755273754098555e+38f)); + outputs[31].value = atan2((-1.1754943508222875e-38f), (-1.3619797265767485e+38f)); + outputs[32].value = atan2((-1.1754943508222875e-38f), (-1.4512666458977999e+38f)); + outputs[33].value = atan2((-1.1754943508222875e-38f), (-1.5433880319609615e+38f)); + outputs[34].value = atan2((-1.1754943508222875e-38f), (-1.6383439861782815e+38f)); + outputs[35].value = atan2((-1.1754943508222875e-38f), (-1.73613450854976e+38f)); + outputs[36].value = atan2((-1.1754943508222875e-38f), (-1.8367593962513005e+38f)); + outputs[37].value = atan2((-1.1754943508222875e-38f), (-1.9402187506949514e+38f)); + outputs[38].value = atan2((-1.1754943508222875e-38f), (-2.0465127747048087e+38f)); + outputs[39].value = atan2((-1.1754943508222875e-38f), (-2.1556412654567764e+38f)); + outputs[40].value = atan2((-1.1754943508222875e-38f), (-2.2676042229508543e+38f)); + outputs[41].value = atan2((-1.1754943508222875e-38f), (-2.3824016471870426e+38f)); + outputs[42].value = atan2((-1.1754943508222875e-38f), (-2.500033538165341e+38f)); + outputs[43].value = atan2((-1.1754943508222875e-38f), (-2.620500098709846e+38f)); + outputs[44].value = atan2((-1.1754943508222875e-38f), (-2.7438009231723654e+38f)); + outputs[45].value = atan2((-1.1754943508222875e-38f), (-2.869936417201091e+38f)); + outputs[46].value = atan2((-1.1754943508222875e-38f), (-2.998906377971927e+38f)); + outputs[47].value = atan2((-1.1754943508222875e-38f), (-3.130711008308969e+38f)); + outputs[48].value = atan2((-1.1754943508222875e-38f), (-3.2653499025640257e+38f)); + outputs[49].value = atan2((-1.1754943508222875e-38f), (-3.4028234663852886e+38f)); + outputs[50].value = atan2((-1.1754943508222875e-38f), (-1.1754942106924411e-38f)); + outputs[51].value = atan2((-1.1754943508222875e-38f), (-1.0448838051176571e-38f)); + outputs[52].value = atan2((-1.1754943508222875e-38f), (-9.142732594130268e-39f)); + outputs[53].value = atan2((-1.1754943508222875e-38f), (-7.836628538382429e-39f)); + outputs[54].value = atan2((-1.1754943508222875e-38f), (-6.530524482634589e-39f)); + outputs[55].value = atan2((-1.1754943508222875e-38f), (-5.224419025588286e-39f)); + outputs[56].value = atan2((-1.1754943508222875e-38f), (-3.9183149698404465e-39f)); + outputs[57].value = atan2((-1.1754943508222875e-38f), (-2.6122109140926072e-39f)); + outputs[58].value = atan2((-1.1754943508222875e-38f), (-1.3061054570463036e-39f)); + outputs[59].value = atan2((-1.1754943508222875e-38f), (-1.401298464324817e-45f)); + outputs[60].value = atan2((-1.1754943508222875e-38f), (0.0f)); + outputs[61].value = atan2((-1.1754943508222875e-38f), (1.401298464324817e-45f)); + outputs[62].value = atan2((-1.1754943508222875e-38f), (1.3061054570463036e-39f)); + outputs[63].value = atan2((-1.1754943508222875e-38f), (2.6122109140926072e-39f)); + outputs[64].value = atan2((-1.1754943508222875e-38f), (3.9183149698404465e-39f)); + outputs[65].value = atan2((-1.1754943508222875e-38f), (5.224419025588286e-39f)); + outputs[66].value = atan2((-1.1754943508222875e-38f), (6.530524482634589e-39f)); + outputs[67].value = atan2((-1.1754943508222875e-38f), (7.836628538382429e-39f)); + outputs[68].value = atan2((-1.1754943508222875e-38f), (9.142732594130268e-39f)); + outputs[69].value = atan2((-1.1754943508222875e-38f), (1.0448838051176571e-38f)); + outputs[70].value = atan2((-1.1754943508222875e-38f), (1.1754942106924411e-38f)); + outputs[71].value = atan2((-1.1754943508222875e-38f), (1.1754943508222875e-38f)); + outputs[72].value = atan2((-1.1754943508222875e-38f), (1.4172525838845702e+35f)); + outputs[73].value = atan2((-1.1754943508222875e-38f), (5.669010335538281e+35f)); + outputs[74].value = atan2((-1.1754943508222875e-38f), (1.2755273056890725e+36f)); + outputs[75].value = atan2((-1.1754943508222875e-38f), (2.2676041342153123e+36f)); + outputs[76].value = atan2((-1.1754943508222875e-38f), (3.54313159836071e+36f)); + outputs[77].value = atan2((-1.1754943508222875e-38f), (5.10210922275629e+36f)); + outputs[78].value = atan2((-1.1754943508222875e-38f), (6.944537958140003e+36f)); + outputs[79].value = atan2((-1.1754943508222875e-38f), (9.070416536861249e+36f)); + outputs[80].value = atan2((-1.1754943508222875e-38f), (1.1479746226570628e+37f)); + outputs[81].value = atan2((-1.1754943508222875e-38f), (1.417252639344284e+37f)); + outputs[82].value = atan2((-1.1754943508222875e-38f), (1.7148755769827283e+37f)); + outputs[83].value = atan2((-1.1754943508222875e-38f), (2.040843689102516e+37f)); + outputs[84].value = atan2((-1.1754943508222875e-38f), (2.395156848938587e+37f)); + outputs[85].value = atan2((-1.1754943508222875e-38f), (2.7778151832560013e+37f)); + outputs[86].value = atan2((-1.1754943508222875e-38f), (3.188818438524639e+37f)); + outputs[87].value = atan2((-1.1754943508222875e-38f), (3.6281666147444997e+37f)); + outputs[88].value = atan2((-1.1754943508222875e-38f), (4.0958599654457038e+37f)); + outputs[89].value = atan2((-1.1754943508222875e-38f), (4.591898490628251e+37f)); + outputs[90].value = atan2((-1.1754943508222875e-38f), (5.116281936762022e+37f)); + outputs[91].value = atan2((-1.1754943508222875e-38f), (5.669010557377136e+37f)); + outputs[92].value = atan2((-1.1754943508222875e-38f), (6.250083845413353e+37f)); + outputs[93].value = atan2((-1.1754943508222875e-38f), (6.859502307930913e+37f)); + outputs[94].value = atan2((-1.1754943508222875e-38f), (7.497265944929817e+37f)); + outputs[95].value = atan2((-1.1754943508222875e-38f), (8.163374756410064e+37f)); + outputs[96].value = atan2((-1.1754943508222875e-38f), (8.857828235311414e+37f)); + outputs[97].value = atan2((-1.1754943508222875e-38f), (9.580627395754348e+37f)); + outputs[98].value = atan2((-1.1754943508222875e-38f), (1.0331771223618385e+38f)); + outputs[99].value = atan2((-1.1754943508222875e-38f), (1.1111260733024005e+38f)); + outputs[100].value = atan2((-1.1754943508222875e-38f), (1.1919093895730249e+38f)); + outputs[101].value = atan2((-1.1754943508222875e-38f), (1.2755273754098555e+38f)); + outputs[102].value = atan2((-1.1754943508222875e-38f), (1.3619797265767485e+38f)); + outputs[103].value = atan2((-1.1754943508222875e-38f), (1.4512666458977999e+38f)); + outputs[104].value = atan2((-1.1754943508222875e-38f), (1.5433880319609615e+38f)); + outputs[105].value = atan2((-1.1754943508222875e-38f), (1.6383439861782815e+38f)); + outputs[106].value = atan2((-1.1754943508222875e-38f), (1.73613450854976e+38f)); + outputs[107].value = atan2((-1.1754943508222875e-38f), (1.8367593962513005e+38f)); + outputs[108].value = atan2((-1.1754943508222875e-38f), (1.9402187506949514e+38f)); + outputs[109].value = atan2((-1.1754943508222875e-38f), (2.0465127747048087e+38f)); + outputs[110].value = atan2((-1.1754943508222875e-38f), (2.1556412654567764e+38f)); + outputs[111].value = atan2((-1.1754943508222875e-38f), (2.2676042229508543e+38f)); + outputs[112].value = atan2((-1.1754943508222875e-38f), (2.3824016471870426e+38f)); + outputs[113].value = atan2((-1.1754943508222875e-38f), (2.500033538165341e+38f)); + outputs[114].value = atan2((-1.1754943508222875e-38f), (2.620500098709846e+38f)); + outputs[115].value = atan2((-1.1754943508222875e-38f), (2.7438009231723654e+38f)); + outputs[116].value = atan2((-1.1754943508222875e-38f), (2.869936417201091e+38f)); + outputs[117].value = atan2((-1.1754943508222875e-38f), (2.998906377971927e+38f)); + outputs[118].value = atan2((-1.1754943508222875e-38f), (3.130711008308969e+38f)); + outputs[119].value = atan2((-1.1754943508222875e-38f), (3.2653499025640257e+38f)); + outputs[120].value = atan2((-1.1754943508222875e-38f), (3.4028234663852886e+38f)); + outputs[121].value = atan2((-1.4172525838845702e+35f), (-1.4172525838845702e+35f)); + outputs[122].value = atan2((-1.4172525838845702e+35f), (-5.669010335538281e+35f)); + outputs[123].value = atan2((-1.4172525838845702e+35f), (-1.2755273056890725e+36f)); + outputs[124].value = atan2((-1.4172525838845702e+35f), (-2.2676041342153123e+36f)); + outputs[125].value = atan2((-1.4172525838845702e+35f), (-3.54313159836071e+36f)); + outputs[126].value = atan2((-1.4172525838845702e+35f), (-5.10210922275629e+36f)); + outputs[127].value = atan2((-1.4172525838845702e+35f), (-6.944537958140003e+36f)); + outputs[128].value = atan2((-1.4172525838845702e+35f), (-9.070416536861249e+36f)); + outputs[129].value = atan2((-1.4172525838845702e+35f), (-1.1479746226570628e+37f)); + outputs[130].value = atan2((-1.4172525838845702e+35f), (-1.417252639344284e+37f)); + outputs[131].value = atan2((-1.4172525838845702e+35f), (-1.7148755769827283e+37f)); + outputs[132].value = atan2((-1.4172525838845702e+35f), (-2.040843689102516e+37f)); + outputs[133].value = atan2((-1.4172525838845702e+35f), (-2.395156848938587e+37f)); + outputs[134].value = atan2((-1.4172525838845702e+35f), (-2.7778151832560013e+37f)); + outputs[135].value = atan2((-1.4172525838845702e+35f), (-3.188818438524639e+37f)); + outputs[136].value = atan2((-1.4172525838845702e+35f), (-3.6281666147444997e+37f)); + outputs[137].value = atan2((-1.4172525838845702e+35f), (-4.0958599654457038e+37f)); + outputs[138].value = atan2((-1.4172525838845702e+35f), (-4.591898490628251e+37f)); + outputs[139].value = atan2((-1.4172525838845702e+35f), (-5.116281936762022e+37f)); + outputs[140].value = atan2((-1.4172525838845702e+35f), (-5.669010557377136e+37f)); + outputs[141].value = atan2((-1.4172525838845702e+35f), (-6.250083845413353e+37f)); + outputs[142].value = atan2((-1.4172525838845702e+35f), (-6.859502307930913e+37f)); + outputs[143].value = atan2((-1.4172525838845702e+35f), (-7.497265944929817e+37f)); + outputs[144].value = atan2((-1.4172525838845702e+35f), (-8.163374756410064e+37f)); + outputs[145].value = atan2((-1.4172525838845702e+35f), (-8.857828235311414e+37f)); + outputs[146].value = atan2((-1.4172525838845702e+35f), (-9.580627395754348e+37f)); + outputs[147].value = atan2((-1.4172525838845702e+35f), (-1.0331771223618385e+38f)); + outputs[148].value = atan2((-1.4172525838845702e+35f), (-1.1111260733024005e+38f)); + outputs[149].value = atan2((-1.4172525838845702e+35f), (-1.1919093895730249e+38f)); + outputs[150].value = atan2((-1.4172525838845702e+35f), (-1.2755273754098555e+38f)); + outputs[151].value = atan2((-1.4172525838845702e+35f), (-1.3619797265767485e+38f)); + outputs[152].value = atan2((-1.4172525838845702e+35f), (-1.4512666458977999e+38f)); + outputs[153].value = atan2((-1.4172525838845702e+35f), (-1.5433880319609615e+38f)); + outputs[154].value = atan2((-1.4172525838845702e+35f), (-1.6383439861782815e+38f)); + outputs[155].value = atan2((-1.4172525838845702e+35f), (-1.73613450854976e+38f)); + outputs[156].value = atan2((-1.4172525838845702e+35f), (-1.8367593962513005e+38f)); + outputs[157].value = atan2((-1.4172525838845702e+35f), (-1.9402187506949514e+38f)); + outputs[158].value = atan2((-1.4172525838845702e+35f), (-2.0465127747048087e+38f)); + outputs[159].value = atan2((-1.4172525838845702e+35f), (-2.1556412654567764e+38f)); + outputs[160].value = atan2((-1.4172525838845702e+35f), (-2.2676042229508543e+38f)); + outputs[161].value = atan2((-1.4172525838845702e+35f), (-2.3824016471870426e+38f)); + outputs[162].value = atan2((-1.4172525838845702e+35f), (-2.500033538165341e+38f)); + outputs[163].value = atan2((-1.4172525838845702e+35f), (-2.620500098709846e+38f)); + outputs[164].value = atan2((-1.4172525838845702e+35f), (-2.7438009231723654e+38f)); + outputs[165].value = atan2((-1.4172525838845702e+35f), (-2.869936417201091e+38f)); + outputs[166].value = atan2((-1.4172525838845702e+35f), (-2.998906377971927e+38f)); + outputs[167].value = atan2((-1.4172525838845702e+35f), (-3.130711008308969e+38f)); + outputs[168].value = atan2((-1.4172525838845702e+35f), (-3.2653499025640257e+38f)); + outputs[169].value = atan2((-1.4172525838845702e+35f), (-3.4028234663852886e+38f)); + outputs[170].value = atan2((-1.4172525838845702e+35f), (-1.1754942106924411e-38f)); + outputs[171].value = atan2((-1.4172525838845702e+35f), (-1.0448838051176571e-38f)); + outputs[172].value = atan2((-1.4172525838845702e+35f), (-9.142732594130268e-39f)); + outputs[173].value = atan2((-1.4172525838845702e+35f), (-7.836628538382429e-39f)); + outputs[174].value = atan2((-1.4172525838845702e+35f), (-6.530524482634589e-39f)); + outputs[175].value = atan2((-1.4172525838845702e+35f), (-5.224419025588286e-39f)); + outputs[176].value = atan2((-1.4172525838845702e+35f), (-3.9183149698404465e-39f)); + outputs[177].value = atan2((-1.4172525838845702e+35f), (-2.6122109140926072e-39f)); + outputs[178].value = atan2((-1.4172525838845702e+35f), (-1.3061054570463036e-39f)); + outputs[179].value = atan2((-1.4172525838845702e+35f), (-1.401298464324817e-45f)); + outputs[180].value = atan2((-1.4172525838845702e+35f), (0.0f)); + outputs[181].value = atan2((-1.4172525838845702e+35f), (1.401298464324817e-45f)); + outputs[182].value = atan2((-1.4172525838845702e+35f), (1.3061054570463036e-39f)); + outputs[183].value = atan2((-1.4172525838845702e+35f), (2.6122109140926072e-39f)); + outputs[184].value = atan2((-1.4172525838845702e+35f), (3.9183149698404465e-39f)); + outputs[185].value = atan2((-1.4172525838845702e+35f), (5.224419025588286e-39f)); + outputs[186].value = atan2((-1.4172525838845702e+35f), (6.530524482634589e-39f)); + outputs[187].value = atan2((-1.4172525838845702e+35f), (7.836628538382429e-39f)); + outputs[188].value = atan2((-1.4172525838845702e+35f), (9.142732594130268e-39f)); + outputs[189].value = atan2((-1.4172525838845702e+35f), (1.0448838051176571e-38f)); + outputs[190].value = atan2((-1.4172525838845702e+35f), (1.1754942106924411e-38f)); + outputs[191].value = atan2((-1.4172525838845702e+35f), (1.1754943508222875e-38f)); + outputs[192].value = atan2((-1.4172525838845702e+35f), (1.4172525838845702e+35f)); + outputs[193].value = atan2((-1.4172525838845702e+35f), (5.669010335538281e+35f)); + outputs[194].value = atan2((-1.4172525838845702e+35f), (1.2755273056890725e+36f)); + outputs[195].value = atan2((-1.4172525838845702e+35f), (2.2676041342153123e+36f)); + outputs[196].value = atan2((-1.4172525838845702e+35f), (3.54313159836071e+36f)); + outputs[197].value = atan2((-1.4172525838845702e+35f), (5.10210922275629e+36f)); + outputs[198].value = atan2((-1.4172525838845702e+35f), (6.944537958140003e+36f)); + outputs[199].value = atan2((-1.4172525838845702e+35f), (9.070416536861249e+36f)); + outputs[200].value = atan2((-1.4172525838845702e+35f), (1.1479746226570628e+37f)); + outputs[201].value = atan2((-1.4172525838845702e+35f), (1.417252639344284e+37f)); + outputs[202].value = atan2((-1.4172525838845702e+35f), (1.7148755769827283e+37f)); + outputs[203].value = atan2((-1.4172525838845702e+35f), (2.040843689102516e+37f)); + outputs[204].value = atan2((-1.4172525838845702e+35f), (2.395156848938587e+37f)); + outputs[205].value = atan2((-1.4172525838845702e+35f), (2.7778151832560013e+37f)); + outputs[206].value = atan2((-1.4172525838845702e+35f), (3.188818438524639e+37f)); + outputs[207].value = atan2((-1.4172525838845702e+35f), (3.6281666147444997e+37f)); + outputs[208].value = atan2((-1.4172525838845702e+35f), (4.0958599654457038e+37f)); + outputs[209].value = atan2((-1.4172525838845702e+35f), (4.591898490628251e+37f)); + outputs[210].value = atan2((-1.4172525838845702e+35f), (5.116281936762022e+37f)); + outputs[211].value = atan2((-1.4172525838845702e+35f), (5.669010557377136e+37f)); + outputs[212].value = atan2((-1.4172525838845702e+35f), (6.250083845413353e+37f)); + outputs[213].value = atan2((-1.4172525838845702e+35f), (6.859502307930913e+37f)); + outputs[214].value = atan2((-1.4172525838845702e+35f), (7.497265944929817e+37f)); + outputs[215].value = atan2((-1.4172525838845702e+35f), (8.163374756410064e+37f)); + outputs[216].value = atan2((-1.4172525838845702e+35f), (8.857828235311414e+37f)); + outputs[217].value = atan2((-1.4172525838845702e+35f), (9.580627395754348e+37f)); + outputs[218].value = atan2((-1.4172525838845702e+35f), (1.0331771223618385e+38f)); + outputs[219].value = atan2((-1.4172525838845702e+35f), (1.1111260733024005e+38f)); + outputs[220].value = atan2((-1.4172525838845702e+35f), (1.1919093895730249e+38f)); + outputs[221].value = atan2((-1.4172525838845702e+35f), (1.2755273754098555e+38f)); + outputs[222].value = atan2((-1.4172525838845702e+35f), (1.3619797265767485e+38f)); + outputs[223].value = atan2((-1.4172525838845702e+35f), (1.4512666458977999e+38f)); + outputs[224].value = atan2((-1.4172525838845702e+35f), (1.5433880319609615e+38f)); + outputs[225].value = atan2((-1.4172525838845702e+35f), (1.6383439861782815e+38f)); + outputs[226].value = atan2((-1.4172525838845702e+35f), (1.73613450854976e+38f)); + outputs[227].value = atan2((-1.4172525838845702e+35f), (1.8367593962513005e+38f)); + outputs[228].value = atan2((-1.4172525838845702e+35f), (1.9402187506949514e+38f)); + outputs[229].value = atan2((-1.4172525838845702e+35f), (2.0465127747048087e+38f)); + outputs[230].value = atan2((-1.4172525838845702e+35f), (2.1556412654567764e+38f)); + outputs[231].value = atan2((-1.4172525838845702e+35f), (2.2676042229508543e+38f)); + outputs[232].value = atan2((-1.4172525838845702e+35f), (2.3824016471870426e+38f)); + outputs[233].value = atan2((-1.4172525838845702e+35f), (2.500033538165341e+38f)); + outputs[234].value = atan2((-1.4172525838845702e+35f), (2.620500098709846e+38f)); + outputs[235].value = atan2((-1.4172525838845702e+35f), (2.7438009231723654e+38f)); + outputs[236].value = atan2((-1.4172525838845702e+35f), (2.869936417201091e+38f)); + outputs[237].value = atan2((-1.4172525838845702e+35f), (2.998906377971927e+38f)); + outputs[238].value = atan2((-1.4172525838845702e+35f), (3.130711008308969e+38f)); + outputs[239].value = atan2((-1.4172525838845702e+35f), (3.2653499025640257e+38f)); + outputs[240].value = atan2((-1.4172525838845702e+35f), (3.4028234663852886e+38f)); + outputs[241].value = atan2((-5.669010335538281e+35f), (-5.669010335538281e+35f)); + outputs[242].value = atan2((-5.669010335538281e+35f), (-1.2755273056890725e+36f)); + outputs[243].value = atan2((-5.669010335538281e+35f), (-2.2676041342153123e+36f)); + outputs[244].value = atan2((-5.669010335538281e+35f), (-3.54313159836071e+36f)); + outputs[245].value = atan2((-5.669010335538281e+35f), (-5.10210922275629e+36f)); + outputs[246].value = atan2((-5.669010335538281e+35f), (-6.944537958140003e+36f)); + outputs[247].value = atan2((-5.669010335538281e+35f), (-9.070416536861249e+36f)); + outputs[248].value = atan2((-5.669010335538281e+35f), (-1.1479746226570628e+37f)); + outputs[249].value = atan2((-5.669010335538281e+35f), (-1.417252639344284e+37f)); + outputs[250].value = atan2((-5.669010335538281e+35f), (-1.7148755769827283e+37f)); + outputs[251].value = atan2((-5.669010335538281e+35f), (-2.040843689102516e+37f)); + outputs[252].value = atan2((-5.669010335538281e+35f), (-2.395156848938587e+37f)); + outputs[253].value = atan2((-5.669010335538281e+35f), (-2.7778151832560013e+37f)); + outputs[254].value = atan2((-5.669010335538281e+35f), (-3.188818438524639e+37f)); + outputs[255].value = atan2((-5.669010335538281e+35f), (-3.6281666147444997e+37f)); + outputs[256].value = atan2((-5.669010335538281e+35f), (-4.0958599654457038e+37f)); + outputs[257].value = atan2((-5.669010335538281e+35f), (-4.591898490628251e+37f)); + outputs[258].value = atan2((-5.669010335538281e+35f), (-5.116281936762022e+37f)); + outputs[259].value = atan2((-5.669010335538281e+35f), (-5.669010557377136e+37f)); + outputs[260].value = atan2((-5.669010335538281e+35f), (-6.250083845413353e+37f)); + outputs[261].value = atan2((-5.669010335538281e+35f), (-6.859502307930913e+37f)); + outputs[262].value = atan2((-5.669010335538281e+35f), (-7.497265944929817e+37f)); + outputs[263].value = atan2((-5.669010335538281e+35f), (-8.163374756410064e+37f)); + outputs[264].value = atan2((-5.669010335538281e+35f), (-8.857828235311414e+37f)); + outputs[265].value = atan2((-5.669010335538281e+35f), (-9.580627395754348e+37f)); + outputs[266].value = atan2((-5.669010335538281e+35f), (-1.0331771223618385e+38f)); + outputs[267].value = atan2((-5.669010335538281e+35f), (-1.1111260733024005e+38f)); + outputs[268].value = atan2((-5.669010335538281e+35f), (-1.1919093895730249e+38f)); + outputs[269].value = atan2((-5.669010335538281e+35f), (-1.2755273754098555e+38f)); + outputs[270].value = atan2((-5.669010335538281e+35f), (-1.3619797265767485e+38f)); + outputs[271].value = atan2((-5.669010335538281e+35f), (-1.4512666458977999e+38f)); + outputs[272].value = atan2((-5.669010335538281e+35f), (-1.5433880319609615e+38f)); + outputs[273].value = atan2((-5.669010335538281e+35f), (-1.6383439861782815e+38f)); + outputs[274].value = atan2((-5.669010335538281e+35f), (-1.73613450854976e+38f)); + outputs[275].value = atan2((-5.669010335538281e+35f), (-1.8367593962513005e+38f)); + outputs[276].value = atan2((-5.669010335538281e+35f), (-1.9402187506949514e+38f)); + outputs[277].value = atan2((-5.669010335538281e+35f), (-2.0465127747048087e+38f)); + outputs[278].value = atan2((-5.669010335538281e+35f), (-2.1556412654567764e+38f)); + outputs[279].value = atan2((-5.669010335538281e+35f), (-2.2676042229508543e+38f)); + outputs[280].value = atan2((-5.669010335538281e+35f), (-2.3824016471870426e+38f)); + outputs[281].value = atan2((-5.669010335538281e+35f), (-2.500033538165341e+38f)); + outputs[282].value = atan2((-5.669010335538281e+35f), (-2.620500098709846e+38f)); + outputs[283].value = atan2((-5.669010335538281e+35f), (-2.7438009231723654e+38f)); + outputs[284].value = atan2((-5.669010335538281e+35f), (-2.869936417201091e+38f)); + outputs[285].value = atan2((-5.669010335538281e+35f), (-2.998906377971927e+38f)); + outputs[286].value = atan2((-5.669010335538281e+35f), (-3.130711008308969e+38f)); + outputs[287].value = atan2((-5.669010335538281e+35f), (-3.2653499025640257e+38f)); + outputs[288].value = atan2((-5.669010335538281e+35f), (-3.4028234663852886e+38f)); + outputs[289].value = atan2((-5.669010335538281e+35f), (-1.1754942106924411e-38f)); + outputs[290].value = atan2((-5.669010335538281e+35f), (-1.0448838051176571e-38f)); + outputs[291].value = atan2((-5.669010335538281e+35f), (-9.142732594130268e-39f)); + outputs[292].value = atan2((-5.669010335538281e+35f), (-7.836628538382429e-39f)); + outputs[293].value = atan2((-5.669010335538281e+35f), (-6.530524482634589e-39f)); + outputs[294].value = atan2((-5.669010335538281e+35f), (-5.224419025588286e-39f)); + outputs[295].value = atan2((-5.669010335538281e+35f), (-3.9183149698404465e-39f)); + outputs[296].value = atan2((-5.669010335538281e+35f), (-2.6122109140926072e-39f)); + outputs[297].value = atan2((-5.669010335538281e+35f), (-1.3061054570463036e-39f)); + outputs[298].value = atan2((-5.669010335538281e+35f), (-1.401298464324817e-45f)); + outputs[299].value = atan2((-5.669010335538281e+35f), (0.0f)); + outputs[300].value = atan2((-5.669010335538281e+35f), (1.401298464324817e-45f)); + outputs[301].value = atan2((-5.669010335538281e+35f), (1.3061054570463036e-39f)); + outputs[302].value = atan2((-5.669010335538281e+35f), (2.6122109140926072e-39f)); + outputs[303].value = atan2((-5.669010335538281e+35f), (3.9183149698404465e-39f)); + outputs[304].value = atan2((-5.669010335538281e+35f), (5.224419025588286e-39f)); + outputs[305].value = atan2((-5.669010335538281e+35f), (6.530524482634589e-39f)); + outputs[306].value = atan2((-5.669010335538281e+35f), (7.836628538382429e-39f)); + outputs[307].value = atan2((-5.669010335538281e+35f), (9.142732594130268e-39f)); + outputs[308].value = atan2((-5.669010335538281e+35f), (1.0448838051176571e-38f)); + outputs[309].value = atan2((-5.669010335538281e+35f), (1.1754942106924411e-38f)); + outputs[310].value = atan2((-5.669010335538281e+35f), (1.1754943508222875e-38f)); + outputs[311].value = atan2((-5.669010335538281e+35f), (1.4172525838845702e+35f)); + outputs[312].value = atan2((-5.669010335538281e+35f), (5.669010335538281e+35f)); + outputs[313].value = atan2((-5.669010335538281e+35f), (1.2755273056890725e+36f)); + outputs[314].value = atan2((-5.669010335538281e+35f), (2.2676041342153123e+36f)); + outputs[315].value = atan2((-5.669010335538281e+35f), (3.54313159836071e+36f)); + outputs[316].value = atan2((-5.669010335538281e+35f), (5.10210922275629e+36f)); + outputs[317].value = atan2((-5.669010335538281e+35f), (6.944537958140003e+36f)); + outputs[318].value = atan2((-5.669010335538281e+35f), (9.070416536861249e+36f)); + outputs[319].value = atan2((-5.669010335538281e+35f), (1.1479746226570628e+37f)); + outputs[320].value = atan2((-5.669010335538281e+35f), (1.417252639344284e+37f)); + outputs[321].value = atan2((-5.669010335538281e+35f), (1.7148755769827283e+37f)); + outputs[322].value = atan2((-5.669010335538281e+35f), (2.040843689102516e+37f)); + outputs[323].value = atan2((-5.669010335538281e+35f), (2.395156848938587e+37f)); + outputs[324].value = atan2((-5.669010335538281e+35f), (2.7778151832560013e+37f)); + outputs[325].value = atan2((-5.669010335538281e+35f), (3.188818438524639e+37f)); + outputs[326].value = atan2((-5.669010335538281e+35f), (3.6281666147444997e+37f)); + outputs[327].value = atan2((-5.669010335538281e+35f), (4.0958599654457038e+37f)); + outputs[328].value = atan2((-5.669010335538281e+35f), (4.591898490628251e+37f)); + outputs[329].value = atan2((-5.669010335538281e+35f), (5.116281936762022e+37f)); + outputs[330].value = atan2((-5.669010335538281e+35f), (5.669010557377136e+37f)); + outputs[331].value = atan2((-5.669010335538281e+35f), (6.250083845413353e+37f)); + outputs[332].value = atan2((-5.669010335538281e+35f), (6.859502307930913e+37f)); + outputs[333].value = atan2((-5.669010335538281e+35f), (7.497265944929817e+37f)); + outputs[334].value = atan2((-5.669010335538281e+35f), (8.163374756410064e+37f)); + outputs[335].value = atan2((-5.669010335538281e+35f), (8.857828235311414e+37f)); + outputs[336].value = atan2((-5.669010335538281e+35f), (9.580627395754348e+37f)); + outputs[337].value = atan2((-5.669010335538281e+35f), (1.0331771223618385e+38f)); + outputs[338].value = atan2((-5.669010335538281e+35f), (1.1111260733024005e+38f)); + outputs[339].value = atan2((-5.669010335538281e+35f), (1.1919093895730249e+38f)); + outputs[340].value = atan2((-5.669010335538281e+35f), (1.2755273754098555e+38f)); + outputs[341].value = atan2((-5.669010335538281e+35f), (1.3619797265767485e+38f)); + outputs[342].value = atan2((-5.669010335538281e+35f), (1.4512666458977999e+38f)); + outputs[343].value = atan2((-5.669010335538281e+35f), (1.5433880319609615e+38f)); + outputs[344].value = atan2((-5.669010335538281e+35f), (1.6383439861782815e+38f)); + outputs[345].value = atan2((-5.669010335538281e+35f), (1.73613450854976e+38f)); + outputs[346].value = atan2((-5.669010335538281e+35f), (1.8367593962513005e+38f)); + outputs[347].value = atan2((-5.669010335538281e+35f), (1.9402187506949514e+38f)); + outputs[348].value = atan2((-5.669010335538281e+35f), (2.0465127747048087e+38f)); + outputs[349].value = atan2((-5.669010335538281e+35f), (2.1556412654567764e+38f)); + outputs[350].value = atan2((-5.669010335538281e+35f), (2.2676042229508543e+38f)); + outputs[351].value = atan2((-5.669010335538281e+35f), (2.3824016471870426e+38f)); + outputs[352].value = atan2((-5.669010335538281e+35f), (2.500033538165341e+38f)); + outputs[353].value = atan2((-5.669010335538281e+35f), (2.620500098709846e+38f)); + outputs[354].value = atan2((-5.669010335538281e+35f), (2.7438009231723654e+38f)); + outputs[355].value = atan2((-5.669010335538281e+35f), (2.869936417201091e+38f)); + outputs[356].value = atan2((-5.669010335538281e+35f), (2.998906377971927e+38f)); + outputs[357].value = atan2((-5.669010335538281e+35f), (3.130711008308969e+38f)); + outputs[358].value = atan2((-5.669010335538281e+35f), (3.2653499025640257e+38f)); + outputs[359].value = atan2((-5.669010335538281e+35f), (3.4028234663852886e+38f)); + outputs[360].value = atan2((-1.2755273056890725e+36f), (-1.2755273056890725e+36f)); + outputs[361].value = atan2((-1.2755273056890725e+36f), (-2.2676041342153123e+36f)); + outputs[362].value = atan2((-1.2755273056890725e+36f), (-3.54313159836071e+36f)); + outputs[363].value = atan2((-1.2755273056890725e+36f), (-5.10210922275629e+36f)); + outputs[364].value = atan2((-1.2755273056890725e+36f), (-6.944537958140003e+36f)); + outputs[365].value = atan2((-1.2755273056890725e+36f), (-9.070416536861249e+36f)); + outputs[366].value = atan2((-1.2755273056890725e+36f), (-1.1479746226570628e+37f)); + outputs[367].value = atan2((-1.2755273056890725e+36f), (-1.417252639344284e+37f)); + outputs[368].value = atan2((-1.2755273056890725e+36f), (-1.7148755769827283e+37f)); + outputs[369].value = atan2((-1.2755273056890725e+36f), (-2.040843689102516e+37f)); + outputs[370].value = atan2((-1.2755273056890725e+36f), (-2.395156848938587e+37f)); + outputs[371].value = atan2((-1.2755273056890725e+36f), (-2.7778151832560013e+37f)); + outputs[372].value = atan2((-1.2755273056890725e+36f), (-3.188818438524639e+37f)); + outputs[373].value = atan2((-1.2755273056890725e+36f), (-3.6281666147444997e+37f)); + outputs[374].value = atan2((-1.2755273056890725e+36f), (-4.0958599654457038e+37f)); + outputs[375].value = atan2((-1.2755273056890725e+36f), (-4.591898490628251e+37f)); + outputs[376].value = atan2((-1.2755273056890725e+36f), (-5.116281936762022e+37f)); + outputs[377].value = atan2((-1.2755273056890725e+36f), (-5.669010557377136e+37f)); + outputs[378].value = atan2((-1.2755273056890725e+36f), (-6.250083845413353e+37f)); + outputs[379].value = atan2((-1.2755273056890725e+36f), (-6.859502307930913e+37f)); + outputs[380].value = atan2((-1.2755273056890725e+36f), (-7.497265944929817e+37f)); + outputs[381].value = atan2((-1.2755273056890725e+36f), (-8.163374756410064e+37f)); + outputs[382].value = atan2((-1.2755273056890725e+36f), (-8.857828235311414e+37f)); + outputs[383].value = atan2((-1.2755273056890725e+36f), (-9.580627395754348e+37f)); + outputs[384].value = atan2((-1.2755273056890725e+36f), (-1.0331771223618385e+38f)); + outputs[385].value = atan2((-1.2755273056890725e+36f), (-1.1111260733024005e+38f)); + outputs[386].value = atan2((-1.2755273056890725e+36f), (-1.1919093895730249e+38f)); + outputs[387].value = atan2((-1.2755273056890725e+36f), (-1.2755273754098555e+38f)); + outputs[388].value = atan2((-1.2755273056890725e+36f), (-1.3619797265767485e+38f)); + outputs[389].value = atan2((-1.2755273056890725e+36f), (-1.4512666458977999e+38f)); + outputs[390].value = atan2((-1.2755273056890725e+36f), (-1.5433880319609615e+38f)); + outputs[391].value = atan2((-1.2755273056890725e+36f), (-1.6383439861782815e+38f)); + outputs[392].value = atan2((-1.2755273056890725e+36f), (-1.73613450854976e+38f)); + outputs[393].value = atan2((-1.2755273056890725e+36f), (-1.8367593962513005e+38f)); + outputs[394].value = atan2((-1.2755273056890725e+36f), (-1.9402187506949514e+38f)); + outputs[395].value = atan2((-1.2755273056890725e+36f), (-2.0465127747048087e+38f)); + outputs[396].value = atan2((-1.2755273056890725e+36f), (-2.1556412654567764e+38f)); + outputs[397].value = atan2((-1.2755273056890725e+36f), (-2.2676042229508543e+38f)); + outputs[398].value = atan2((-1.2755273056890725e+36f), (-2.3824016471870426e+38f)); + outputs[399].value = atan2((-1.2755273056890725e+36f), (-2.500033538165341e+38f)); + outputs[400].value = atan2((-1.2755273056890725e+36f), (-2.620500098709846e+38f)); + outputs[401].value = atan2((-1.2755273056890725e+36f), (-2.7438009231723654e+38f)); + outputs[402].value = atan2((-1.2755273056890725e+36f), (-2.869936417201091e+38f)); + outputs[403].value = atan2((-1.2755273056890725e+36f), (-2.998906377971927e+38f)); + outputs[404].value = atan2((-1.2755273056890725e+36f), (-3.130711008308969e+38f)); + outputs[405].value = atan2((-1.2755273056890725e+36f), (-3.2653499025640257e+38f)); + outputs[406].value = atan2((-1.2755273056890725e+36f), (-3.4028234663852886e+38f)); + outputs[407].value = atan2((-1.2755273056890725e+36f), (-1.1754942106924411e-38f)); + outputs[408].value = atan2((-1.2755273056890725e+36f), (-1.0448838051176571e-38f)); + outputs[409].value = atan2((-1.2755273056890725e+36f), (-9.142732594130268e-39f)); + outputs[410].value = atan2((-1.2755273056890725e+36f), (-7.836628538382429e-39f)); + outputs[411].value = atan2((-1.2755273056890725e+36f), (-6.530524482634589e-39f)); + outputs[412].value = atan2((-1.2755273056890725e+36f), (-5.224419025588286e-39f)); + outputs[413].value = atan2((-1.2755273056890725e+36f), (-3.9183149698404465e-39f)); + outputs[414].value = atan2((-1.2755273056890725e+36f), (-2.6122109140926072e-39f)); + outputs[415].value = atan2((-1.2755273056890725e+36f), (-1.3061054570463036e-39f)); + outputs[416].value = atan2((-1.2755273056890725e+36f), (-1.401298464324817e-45f)); + outputs[417].value = atan2((-1.2755273056890725e+36f), (0.0f)); + outputs[418].value = atan2((-1.2755273056890725e+36f), (1.401298464324817e-45f)); + outputs[419].value = atan2((-1.2755273056890725e+36f), (1.3061054570463036e-39f)); + outputs[420].value = atan2((-1.2755273056890725e+36f), (2.6122109140926072e-39f)); + outputs[421].value = atan2((-1.2755273056890725e+36f), (3.9183149698404465e-39f)); + outputs[422].value = atan2((-1.2755273056890725e+36f), (5.224419025588286e-39f)); + outputs[423].value = atan2((-1.2755273056890725e+36f), (6.530524482634589e-39f)); + outputs[424].value = atan2((-1.2755273056890725e+36f), (7.836628538382429e-39f)); + outputs[425].value = atan2((-1.2755273056890725e+36f), (9.142732594130268e-39f)); + outputs[426].value = atan2((-1.2755273056890725e+36f), (1.0448838051176571e-38f)); + outputs[427].value = atan2((-1.2755273056890725e+36f), (1.1754942106924411e-38f)); + outputs[428].value = atan2((-1.2755273056890725e+36f), (1.1754943508222875e-38f)); + outputs[429].value = atan2((-1.2755273056890725e+36f), (1.4172525838845702e+35f)); + outputs[430].value = atan2((-1.2755273056890725e+36f), (5.669010335538281e+35f)); + outputs[431].value = atan2((-1.2755273056890725e+36f), (1.2755273056890725e+36f)); + outputs[432].value = atan2((-1.2755273056890725e+36f), (2.2676041342153123e+36f)); + outputs[433].value = atan2((-1.2755273056890725e+36f), (3.54313159836071e+36f)); + outputs[434].value = atan2((-1.2755273056890725e+36f), (5.10210922275629e+36f)); + outputs[435].value = atan2((-1.2755273056890725e+36f), (6.944537958140003e+36f)); + outputs[436].value = atan2((-1.2755273056890725e+36f), (9.070416536861249e+36f)); + outputs[437].value = atan2((-1.2755273056890725e+36f), (1.1479746226570628e+37f)); + outputs[438].value = atan2((-1.2755273056890725e+36f), (1.417252639344284e+37f)); + outputs[439].value = atan2((-1.2755273056890725e+36f), (1.7148755769827283e+37f)); + outputs[440].value = atan2((-1.2755273056890725e+36f), (2.040843689102516e+37f)); + outputs[441].value = atan2((-1.2755273056890725e+36f), (2.395156848938587e+37f)); + outputs[442].value = atan2((-1.2755273056890725e+36f), (2.7778151832560013e+37f)); + outputs[443].value = atan2((-1.2755273056890725e+36f), (3.188818438524639e+37f)); + outputs[444].value = atan2((-1.2755273056890725e+36f), (3.6281666147444997e+37f)); + outputs[445].value = atan2((-1.2755273056890725e+36f), (4.0958599654457038e+37f)); + outputs[446].value = atan2((-1.2755273056890725e+36f), (4.591898490628251e+37f)); + outputs[447].value = atan2((-1.2755273056890725e+36f), (5.116281936762022e+37f)); + outputs[448].value = atan2((-1.2755273056890725e+36f), (5.669010557377136e+37f)); + outputs[449].value = atan2((-1.2755273056890725e+36f), (6.250083845413353e+37f)); + outputs[450].value = atan2((-1.2755273056890725e+36f), (6.859502307930913e+37f)); + outputs[451].value = atan2((-1.2755273056890725e+36f), (7.497265944929817e+37f)); + outputs[452].value = atan2((-1.2755273056890725e+36f), (8.163374756410064e+37f)); + outputs[453].value = atan2((-1.2755273056890725e+36f), (8.857828235311414e+37f)); + outputs[454].value = atan2((-1.2755273056890725e+36f), (9.580627395754348e+37f)); + outputs[455].value = atan2((-1.2755273056890725e+36f), (1.0331771223618385e+38f)); + outputs[456].value = atan2((-1.2755273056890725e+36f), (1.1111260733024005e+38f)); + outputs[457].value = atan2((-1.2755273056890725e+36f), (1.1919093895730249e+38f)); + outputs[458].value = atan2((-1.2755273056890725e+36f), (1.2755273754098555e+38f)); + outputs[459].value = atan2((-1.2755273056890725e+36f), (1.3619797265767485e+38f)); + outputs[460].value = atan2((-1.2755273056890725e+36f), (1.4512666458977999e+38f)); + outputs[461].value = atan2((-1.2755273056890725e+36f), (1.5433880319609615e+38f)); + outputs[462].value = atan2((-1.2755273056890725e+36f), (1.6383439861782815e+38f)); + outputs[463].value = atan2((-1.2755273056890725e+36f), (1.73613450854976e+38f)); + outputs[464].value = atan2((-1.2755273056890725e+36f), (1.8367593962513005e+38f)); + outputs[465].value = atan2((-1.2755273056890725e+36f), (1.9402187506949514e+38f)); + outputs[466].value = atan2((-1.2755273056890725e+36f), (2.0465127747048087e+38f)); + outputs[467].value = atan2((-1.2755273056890725e+36f), (2.1556412654567764e+38f)); + outputs[468].value = atan2((-1.2755273056890725e+36f), (2.2676042229508543e+38f)); + outputs[469].value = atan2((-1.2755273056890725e+36f), (2.3824016471870426e+38f)); + outputs[470].value = atan2((-1.2755273056890725e+36f), (2.500033538165341e+38f)); + outputs[471].value = atan2((-1.2755273056890725e+36f), (2.620500098709846e+38f)); + outputs[472].value = atan2((-1.2755273056890725e+36f), (2.7438009231723654e+38f)); + outputs[473].value = atan2((-1.2755273056890725e+36f), (2.869936417201091e+38f)); + outputs[474].value = atan2((-1.2755273056890725e+36f), (2.998906377971927e+38f)); + outputs[475].value = atan2((-1.2755273056890725e+36f), (3.130711008308969e+38f)); + outputs[476].value = atan2((-1.2755273056890725e+36f), (3.2653499025640257e+38f)); + outputs[477].value = atan2((-1.2755273056890725e+36f), (3.4028234663852886e+38f)); + outputs[478].value = atan2((-2.2676041342153123e+36f), (-2.2676041342153123e+36f)); + outputs[479].value = atan2((-2.2676041342153123e+36f), (-3.54313159836071e+36f)); + outputs[480].value = atan2((-2.2676041342153123e+36f), (-5.10210922275629e+36f)); + outputs[481].value = atan2((-2.2676041342153123e+36f), (-6.944537958140003e+36f)); + outputs[482].value = atan2((-2.2676041342153123e+36f), (-9.070416536861249e+36f)); + outputs[483].value = atan2((-2.2676041342153123e+36f), (-1.1479746226570628e+37f)); + outputs[484].value = atan2((-2.2676041342153123e+36f), (-1.417252639344284e+37f)); + outputs[485].value = atan2((-2.2676041342153123e+36f), (-1.7148755769827283e+37f)); + outputs[486].value = atan2((-2.2676041342153123e+36f), (-2.040843689102516e+37f)); + outputs[487].value = atan2((-2.2676041342153123e+36f), (-2.395156848938587e+37f)); + outputs[488].value = atan2((-2.2676041342153123e+36f), (-2.7778151832560013e+37f)); + outputs[489].value = atan2((-2.2676041342153123e+36f), (-3.188818438524639e+37f)); + outputs[490].value = atan2((-2.2676041342153123e+36f), (-3.6281666147444997e+37f)); + outputs[491].value = atan2((-2.2676041342153123e+36f), (-4.0958599654457038e+37f)); + outputs[492].value = atan2((-2.2676041342153123e+36f), (-4.591898490628251e+37f)); + outputs[493].value = atan2((-2.2676041342153123e+36f), (-5.116281936762022e+37f)); + outputs[494].value = atan2((-2.2676041342153123e+36f), (-5.669010557377136e+37f)); + outputs[495].value = atan2((-2.2676041342153123e+36f), (-6.250083845413353e+37f)); + outputs[496].value = atan2((-2.2676041342153123e+36f), (-6.859502307930913e+37f)); + outputs[497].value = atan2((-2.2676041342153123e+36f), (-7.497265944929817e+37f)); + outputs[498].value = atan2((-2.2676041342153123e+36f), (-8.163374756410064e+37f)); + outputs[499].value = atan2((-2.2676041342153123e+36f), (-8.857828235311414e+37f)); + outputs[500].value = atan2((-2.2676041342153123e+36f), (-9.580627395754348e+37f)); + outputs[501].value = atan2((-2.2676041342153123e+36f), (-1.0331771223618385e+38f)); + outputs[502].value = atan2((-2.2676041342153123e+36f), (-1.1111260733024005e+38f)); + outputs[503].value = atan2((-2.2676041342153123e+36f), (-1.1919093895730249e+38f)); + outputs[504].value = atan2((-2.2676041342153123e+36f), (-1.2755273754098555e+38f)); + outputs[505].value = atan2((-2.2676041342153123e+36f), (-1.3619797265767485e+38f)); + outputs[506].value = atan2((-2.2676041342153123e+36f), (-1.4512666458977999e+38f)); + outputs[507].value = atan2((-2.2676041342153123e+36f), (-1.5433880319609615e+38f)); + outputs[508].value = atan2((-2.2676041342153123e+36f), (-1.6383439861782815e+38f)); + outputs[509].value = atan2((-2.2676041342153123e+36f), (-1.73613450854976e+38f)); + outputs[510].value = atan2((-2.2676041342153123e+36f), (-1.8367593962513005e+38f)); + outputs[511].value = atan2((-2.2676041342153123e+36f), (-1.9402187506949514e+38f)); + outputs[512].value = atan2((-2.2676041342153123e+36f), (-2.0465127747048087e+38f)); + outputs[513].value = atan2((-2.2676041342153123e+36f), (-2.1556412654567764e+38f)); + outputs[514].value = atan2((-2.2676041342153123e+36f), (-2.2676042229508543e+38f)); + outputs[515].value = atan2((-2.2676041342153123e+36f), (-2.3824016471870426e+38f)); + outputs[516].value = atan2((-2.2676041342153123e+36f), (-2.500033538165341e+38f)); + outputs[517].value = atan2((-2.2676041342153123e+36f), (-2.620500098709846e+38f)); + outputs[518].value = atan2((-2.2676041342153123e+36f), (-2.7438009231723654e+38f)); + outputs[519].value = atan2((-2.2676041342153123e+36f), (-2.869936417201091e+38f)); + outputs[520].value = atan2((-2.2676041342153123e+36f), (-2.998906377971927e+38f)); + outputs[521].value = atan2((-2.2676041342153123e+36f), (-3.130711008308969e+38f)); + outputs[522].value = atan2((-2.2676041342153123e+36f), (-3.2653499025640257e+38f)); + outputs[523].value = atan2((-2.2676041342153123e+36f), (-3.4028234663852886e+38f)); + outputs[524].value = atan2((-2.2676041342153123e+36f), (-1.1754942106924411e-38f)); + outputs[525].value = atan2((-2.2676041342153123e+36f), (-1.0448838051176571e-38f)); + outputs[526].value = atan2((-2.2676041342153123e+36f), (-9.142732594130268e-39f)); + outputs[527].value = atan2((-2.2676041342153123e+36f), (-7.836628538382429e-39f)); + outputs[528].value = atan2((-2.2676041342153123e+36f), (-6.530524482634589e-39f)); + outputs[529].value = atan2((-2.2676041342153123e+36f), (-5.224419025588286e-39f)); + outputs[530].value = atan2((-2.2676041342153123e+36f), (-3.9183149698404465e-39f)); + outputs[531].value = atan2((-2.2676041342153123e+36f), (-2.6122109140926072e-39f)); + outputs[532].value = atan2((-2.2676041342153123e+36f), (-1.3061054570463036e-39f)); + outputs[533].value = atan2((-2.2676041342153123e+36f), (-1.401298464324817e-45f)); + outputs[534].value = atan2((-2.2676041342153123e+36f), (0.0f)); + outputs[535].value = atan2((-2.2676041342153123e+36f), (1.401298464324817e-45f)); + outputs[536].value = atan2((-2.2676041342153123e+36f), (1.3061054570463036e-39f)); + outputs[537].value = atan2((-2.2676041342153123e+36f), (2.6122109140926072e-39f)); + outputs[538].value = atan2((-2.2676041342153123e+36f), (3.9183149698404465e-39f)); + outputs[539].value = atan2((-2.2676041342153123e+36f), (5.224419025588286e-39f)); + outputs[540].value = atan2((-2.2676041342153123e+36f), (6.530524482634589e-39f)); + outputs[541].value = atan2((-2.2676041342153123e+36f), (7.836628538382429e-39f)); + outputs[542].value = atan2((-2.2676041342153123e+36f), (9.142732594130268e-39f)); + outputs[543].value = atan2((-2.2676041342153123e+36f), (1.0448838051176571e-38f)); + outputs[544].value = atan2((-2.2676041342153123e+36f), (1.1754942106924411e-38f)); + outputs[545].value = atan2((-2.2676041342153123e+36f), (1.1754943508222875e-38f)); + outputs[546].value = atan2((-2.2676041342153123e+36f), (1.4172525838845702e+35f)); + outputs[547].value = atan2((-2.2676041342153123e+36f), (5.669010335538281e+35f)); + outputs[548].value = atan2((-2.2676041342153123e+36f), (1.2755273056890725e+36f)); + outputs[549].value = atan2((-2.2676041342153123e+36f), (2.2676041342153123e+36f)); + outputs[550].value = atan2((-2.2676041342153123e+36f), (3.54313159836071e+36f)); + outputs[551].value = atan2((-2.2676041342153123e+36f), (5.10210922275629e+36f)); + outputs[552].value = atan2((-2.2676041342153123e+36f), (6.944537958140003e+36f)); + outputs[553].value = atan2((-2.2676041342153123e+36f), (9.070416536861249e+36f)); + outputs[554].value = atan2((-2.2676041342153123e+36f), (1.1479746226570628e+37f)); + outputs[555].value = atan2((-2.2676041342153123e+36f), (1.417252639344284e+37f)); + outputs[556].value = atan2((-2.2676041342153123e+36f), (1.7148755769827283e+37f)); + outputs[557].value = atan2((-2.2676041342153123e+36f), (2.040843689102516e+37f)); + outputs[558].value = atan2((-2.2676041342153123e+36f), (2.395156848938587e+37f)); + outputs[559].value = atan2((-2.2676041342153123e+36f), (2.7778151832560013e+37f)); + outputs[560].value = atan2((-2.2676041342153123e+36f), (3.188818438524639e+37f)); + outputs[561].value = atan2((-2.2676041342153123e+36f), (3.6281666147444997e+37f)); + outputs[562].value = atan2((-2.2676041342153123e+36f), (4.0958599654457038e+37f)); + outputs[563].value = atan2((-2.2676041342153123e+36f), (4.591898490628251e+37f)); + outputs[564].value = atan2((-2.2676041342153123e+36f), (5.116281936762022e+37f)); + outputs[565].value = atan2((-2.2676041342153123e+36f), (5.669010557377136e+37f)); + outputs[566].value = atan2((-2.2676041342153123e+36f), (6.250083845413353e+37f)); + outputs[567].value = atan2((-2.2676041342153123e+36f), (6.859502307930913e+37f)); + outputs[568].value = atan2((-2.2676041342153123e+36f), (7.497265944929817e+37f)); + outputs[569].value = atan2((-2.2676041342153123e+36f), (8.163374756410064e+37f)); + outputs[570].value = atan2((-2.2676041342153123e+36f), (8.857828235311414e+37f)); + outputs[571].value = atan2((-2.2676041342153123e+36f), (9.580627395754348e+37f)); + outputs[572].value = atan2((-2.2676041342153123e+36f), (1.0331771223618385e+38f)); + outputs[573].value = atan2((-2.2676041342153123e+36f), (1.1111260733024005e+38f)); + outputs[574].value = atan2((-2.2676041342153123e+36f), (1.1919093895730249e+38f)); + outputs[575].value = atan2((-2.2676041342153123e+36f), (1.2755273754098555e+38f)); + outputs[576].value = atan2((-2.2676041342153123e+36f), (1.3619797265767485e+38f)); + outputs[577].value = atan2((-2.2676041342153123e+36f), (1.4512666458977999e+38f)); + outputs[578].value = atan2((-2.2676041342153123e+36f), (1.5433880319609615e+38f)); + outputs[579].value = atan2((-2.2676041342153123e+36f), (1.6383439861782815e+38f)); + outputs[580].value = atan2((-2.2676041342153123e+36f), (1.73613450854976e+38f)); + outputs[581].value = atan2((-2.2676041342153123e+36f), (1.8367593962513005e+38f)); + outputs[582].value = atan2((-2.2676041342153123e+36f), (1.9402187506949514e+38f)); + outputs[583].value = atan2((-2.2676041342153123e+36f), (2.0465127747048087e+38f)); + outputs[584].value = atan2((-2.2676041342153123e+36f), (2.1556412654567764e+38f)); + outputs[585].value = atan2((-2.2676041342153123e+36f), (2.2676042229508543e+38f)); + outputs[586].value = atan2((-2.2676041342153123e+36f), (2.3824016471870426e+38f)); + outputs[587].value = atan2((-2.2676041342153123e+36f), (2.500033538165341e+38f)); + outputs[588].value = atan2((-2.2676041342153123e+36f), (2.620500098709846e+38f)); + outputs[589].value = atan2((-2.2676041342153123e+36f), (2.7438009231723654e+38f)); + outputs[590].value = atan2((-2.2676041342153123e+36f), (2.869936417201091e+38f)); + outputs[591].value = atan2((-2.2676041342153123e+36f), (2.998906377971927e+38f)); + outputs[592].value = atan2((-2.2676041342153123e+36f), (3.130711008308969e+38f)); + outputs[593].value = atan2((-2.2676041342153123e+36f), (3.2653499025640257e+38f)); + outputs[594].value = atan2((-2.2676041342153123e+36f), (3.4028234663852886e+38f)); + outputs[595].value = atan2((-3.54313159836071e+36f), (-3.54313159836071e+36f)); + outputs[596].value = atan2((-3.54313159836071e+36f), (-5.10210922275629e+36f)); + outputs[597].value = atan2((-3.54313159836071e+36f), (-6.944537958140003e+36f)); + outputs[598].value = atan2((-3.54313159836071e+36f), (-9.070416536861249e+36f)); + outputs[599].value = atan2((-3.54313159836071e+36f), (-1.1479746226570628e+37f)); + outputs[600].value = atan2((-3.54313159836071e+36f), (-1.417252639344284e+37f)); + outputs[601].value = atan2((-3.54313159836071e+36f), (-1.7148755769827283e+37f)); + outputs[602].value = atan2((-3.54313159836071e+36f), (-2.040843689102516e+37f)); + outputs[603].value = atan2((-3.54313159836071e+36f), (-2.395156848938587e+37f)); + outputs[604].value = atan2((-3.54313159836071e+36f), (-2.7778151832560013e+37f)); + outputs[605].value = atan2((-3.54313159836071e+36f), (-3.188818438524639e+37f)); + outputs[606].value = atan2((-3.54313159836071e+36f), (-3.6281666147444997e+37f)); + outputs[607].value = atan2((-3.54313159836071e+36f), (-4.0958599654457038e+37f)); + outputs[608].value = atan2((-3.54313159836071e+36f), (-4.591898490628251e+37f)); + outputs[609].value = atan2((-3.54313159836071e+36f), (-5.116281936762022e+37f)); + outputs[610].value = atan2((-3.54313159836071e+36f), (-5.669010557377136e+37f)); + outputs[611].value = atan2((-3.54313159836071e+36f), (-6.250083845413353e+37f)); + outputs[612].value = atan2((-3.54313159836071e+36f), (-6.859502307930913e+37f)); + outputs[613].value = atan2((-3.54313159836071e+36f), (-7.497265944929817e+37f)); + outputs[614].value = atan2((-3.54313159836071e+36f), (-8.163374756410064e+37f)); + outputs[615].value = atan2((-3.54313159836071e+36f), (-8.857828235311414e+37f)); + outputs[616].value = atan2((-3.54313159836071e+36f), (-9.580627395754348e+37f)); + outputs[617].value = atan2((-3.54313159836071e+36f), (-1.0331771223618385e+38f)); + outputs[618].value = atan2((-3.54313159836071e+36f), (-1.1111260733024005e+38f)); + outputs[619].value = atan2((-3.54313159836071e+36f), (-1.1919093895730249e+38f)); + outputs[620].value = atan2((-3.54313159836071e+36f), (-1.2755273754098555e+38f)); + outputs[621].value = atan2((-3.54313159836071e+36f), (-1.3619797265767485e+38f)); + outputs[622].value = atan2((-3.54313159836071e+36f), (-1.4512666458977999e+38f)); + outputs[623].value = atan2((-3.54313159836071e+36f), (-1.5433880319609615e+38f)); + outputs[624].value = atan2((-3.54313159836071e+36f), (-1.6383439861782815e+38f)); + outputs[625].value = atan2((-3.54313159836071e+36f), (-1.73613450854976e+38f)); + outputs[626].value = atan2((-3.54313159836071e+36f), (-1.8367593962513005e+38f)); + outputs[627].value = atan2((-3.54313159836071e+36f), (-1.9402187506949514e+38f)); + outputs[628].value = atan2((-3.54313159836071e+36f), (-2.0465127747048087e+38f)); + outputs[629].value = atan2((-3.54313159836071e+36f), (-2.1556412654567764e+38f)); + outputs[630].value = atan2((-3.54313159836071e+36f), (-2.2676042229508543e+38f)); + outputs[631].value = atan2((-3.54313159836071e+36f), (-2.3824016471870426e+38f)); + outputs[632].value = atan2((-3.54313159836071e+36f), (-2.500033538165341e+38f)); + outputs[633].value = atan2((-3.54313159836071e+36f), (-2.620500098709846e+38f)); + outputs[634].value = atan2((-3.54313159836071e+36f), (-2.7438009231723654e+38f)); + outputs[635].value = atan2((-3.54313159836071e+36f), (-2.869936417201091e+38f)); + outputs[636].value = atan2((-3.54313159836071e+36f), (-2.998906377971927e+38f)); + outputs[637].value = atan2((-3.54313159836071e+36f), (-3.130711008308969e+38f)); + outputs[638].value = atan2((-3.54313159836071e+36f), (-3.2653499025640257e+38f)); + outputs[639].value = atan2((-3.54313159836071e+36f), (-3.4028234663852886e+38f)); + outputs[640].value = atan2((-3.54313159836071e+36f), (-1.1754942106924411e-38f)); + outputs[641].value = atan2((-3.54313159836071e+36f), (-1.0448838051176571e-38f)); + outputs[642].value = atan2((-3.54313159836071e+36f), (-9.142732594130268e-39f)); + outputs[643].value = atan2((-3.54313159836071e+36f), (-7.836628538382429e-39f)); + outputs[644].value = atan2((-3.54313159836071e+36f), (-6.530524482634589e-39f)); + outputs[645].value = atan2((-3.54313159836071e+36f), (-5.224419025588286e-39f)); + outputs[646].value = atan2((-3.54313159836071e+36f), (-3.9183149698404465e-39f)); + outputs[647].value = atan2((-3.54313159836071e+36f), (-2.6122109140926072e-39f)); + outputs[648].value = atan2((-3.54313159836071e+36f), (-1.3061054570463036e-39f)); + outputs[649].value = atan2((-3.54313159836071e+36f), (-1.401298464324817e-45f)); + outputs[650].value = atan2((-3.54313159836071e+36f), (0.0f)); + outputs[651].value = atan2((-3.54313159836071e+36f), (1.401298464324817e-45f)); + outputs[652].value = atan2((-3.54313159836071e+36f), (1.3061054570463036e-39f)); + outputs[653].value = atan2((-3.54313159836071e+36f), (2.6122109140926072e-39f)); + outputs[654].value = atan2((-3.54313159836071e+36f), (3.9183149698404465e-39f)); + outputs[655].value = atan2((-3.54313159836071e+36f), (5.224419025588286e-39f)); + outputs[656].value = atan2((-3.54313159836071e+36f), (6.530524482634589e-39f)); + outputs[657].value = atan2((-3.54313159836071e+36f), (7.836628538382429e-39f)); + outputs[658].value = atan2((-3.54313159836071e+36f), (9.142732594130268e-39f)); + outputs[659].value = atan2((-3.54313159836071e+36f), (1.0448838051176571e-38f)); + outputs[660].value = atan2((-3.54313159836071e+36f), (1.1754942106924411e-38f)); + outputs[661].value = atan2((-3.54313159836071e+36f), (1.1754943508222875e-38f)); + outputs[662].value = atan2((-3.54313159836071e+36f), (1.4172525838845702e+35f)); + outputs[663].value = atan2((-3.54313159836071e+36f), (5.669010335538281e+35f)); + outputs[664].value = atan2((-3.54313159836071e+36f), (1.2755273056890725e+36f)); + outputs[665].value = atan2((-3.54313159836071e+36f), (2.2676041342153123e+36f)); + outputs[666].value = atan2((-3.54313159836071e+36f), (3.54313159836071e+36f)); + outputs[667].value = atan2((-3.54313159836071e+36f), (5.10210922275629e+36f)); + outputs[668].value = atan2((-3.54313159836071e+36f), (6.944537958140003e+36f)); + outputs[669].value = atan2((-3.54313159836071e+36f), (9.070416536861249e+36f)); + outputs[670].value = atan2((-3.54313159836071e+36f), (1.1479746226570628e+37f)); + outputs[671].value = atan2((-3.54313159836071e+36f), (1.417252639344284e+37f)); + outputs[672].value = atan2((-3.54313159836071e+36f), (1.7148755769827283e+37f)); + outputs[673].value = atan2((-3.54313159836071e+36f), (2.040843689102516e+37f)); + outputs[674].value = atan2((-3.54313159836071e+36f), (2.395156848938587e+37f)); + outputs[675].value = atan2((-3.54313159836071e+36f), (2.7778151832560013e+37f)); + outputs[676].value = atan2((-3.54313159836071e+36f), (3.188818438524639e+37f)); + outputs[677].value = atan2((-3.54313159836071e+36f), (3.6281666147444997e+37f)); + outputs[678].value = atan2((-3.54313159836071e+36f), (4.0958599654457038e+37f)); + outputs[679].value = atan2((-3.54313159836071e+36f), (4.591898490628251e+37f)); + outputs[680].value = atan2((-3.54313159836071e+36f), (5.116281936762022e+37f)); + outputs[681].value = atan2((-3.54313159836071e+36f), (5.669010557377136e+37f)); + outputs[682].value = atan2((-3.54313159836071e+36f), (6.250083845413353e+37f)); + outputs[683].value = atan2((-3.54313159836071e+36f), (6.859502307930913e+37f)); + outputs[684].value = atan2((-3.54313159836071e+36f), (7.497265944929817e+37f)); + outputs[685].value = atan2((-3.54313159836071e+36f), (8.163374756410064e+37f)); + outputs[686].value = atan2((-3.54313159836071e+36f), (8.857828235311414e+37f)); + outputs[687].value = atan2((-3.54313159836071e+36f), (9.580627395754348e+37f)); + outputs[688].value = atan2((-3.54313159836071e+36f), (1.0331771223618385e+38f)); + outputs[689].value = atan2((-3.54313159836071e+36f), (1.1111260733024005e+38f)); + outputs[690].value = atan2((-3.54313159836071e+36f), (1.1919093895730249e+38f)); + outputs[691].value = atan2((-3.54313159836071e+36f), (1.2755273754098555e+38f)); + outputs[692].value = atan2((-3.54313159836071e+36f), (1.3619797265767485e+38f)); + outputs[693].value = atan2((-3.54313159836071e+36f), (1.4512666458977999e+38f)); + outputs[694].value = atan2((-3.54313159836071e+36f), (1.5433880319609615e+38f)); + outputs[695].value = atan2((-3.54313159836071e+36f), (1.6383439861782815e+38f)); + outputs[696].value = atan2((-3.54313159836071e+36f), (1.73613450854976e+38f)); + outputs[697].value = atan2((-3.54313159836071e+36f), (1.8367593962513005e+38f)); + outputs[698].value = atan2((-3.54313159836071e+36f), (1.9402187506949514e+38f)); + outputs[699].value = atan2((-3.54313159836071e+36f), (2.0465127747048087e+38f)); + outputs[700].value = atan2((-3.54313159836071e+36f), (2.1556412654567764e+38f)); + outputs[701].value = atan2((-3.54313159836071e+36f), (2.2676042229508543e+38f)); + outputs[702].value = atan2((-3.54313159836071e+36f), (2.3824016471870426e+38f)); + outputs[703].value = atan2((-3.54313159836071e+36f), (2.500033538165341e+38f)); + outputs[704].value = atan2((-3.54313159836071e+36f), (2.620500098709846e+38f)); + outputs[705].value = atan2((-3.54313159836071e+36f), (2.7438009231723654e+38f)); + outputs[706].value = atan2((-3.54313159836071e+36f), (2.869936417201091e+38f)); + outputs[707].value = atan2((-3.54313159836071e+36f), (2.998906377971927e+38f)); + outputs[708].value = atan2((-3.54313159836071e+36f), (3.130711008308969e+38f)); + outputs[709].value = atan2((-3.54313159836071e+36f), (3.2653499025640257e+38f)); + outputs[710].value = atan2((-3.54313159836071e+36f), (3.4028234663852886e+38f)); + outputs[711].value = atan2((-5.10210922275629e+36f), (-5.10210922275629e+36f)); + outputs[712].value = atan2((-5.10210922275629e+36f), (-6.944537958140003e+36f)); + outputs[713].value = atan2((-5.10210922275629e+36f), (-9.070416536861249e+36f)); + outputs[714].value = atan2((-5.10210922275629e+36f), (-1.1479746226570628e+37f)); + outputs[715].value = atan2((-5.10210922275629e+36f), (-1.417252639344284e+37f)); + outputs[716].value = atan2((-5.10210922275629e+36f), (-1.7148755769827283e+37f)); + outputs[717].value = atan2((-5.10210922275629e+36f), (-2.040843689102516e+37f)); + outputs[718].value = atan2((-5.10210922275629e+36f), (-2.395156848938587e+37f)); + outputs[719].value = atan2((-5.10210922275629e+36f), (-2.7778151832560013e+37f)); + outputs[720].value = atan2((-5.10210922275629e+36f), (-3.188818438524639e+37f)); + outputs[721].value = atan2((-5.10210922275629e+36f), (-3.6281666147444997e+37f)); + outputs[722].value = atan2((-5.10210922275629e+36f), (-4.0958599654457038e+37f)); + outputs[723].value = atan2((-5.10210922275629e+36f), (-4.591898490628251e+37f)); + outputs[724].value = atan2((-5.10210922275629e+36f), (-5.116281936762022e+37f)); + outputs[725].value = atan2((-5.10210922275629e+36f), (-5.669010557377136e+37f)); + outputs[726].value = atan2((-5.10210922275629e+36f), (-6.250083845413353e+37f)); + outputs[727].value = atan2((-5.10210922275629e+36f), (-6.859502307930913e+37f)); + outputs[728].value = atan2((-5.10210922275629e+36f), (-7.497265944929817e+37f)); + outputs[729].value = atan2((-5.10210922275629e+36f), (-8.163374756410064e+37f)); + outputs[730].value = atan2((-5.10210922275629e+36f), (-8.857828235311414e+37f)); + outputs[731].value = atan2((-5.10210922275629e+36f), (-9.580627395754348e+37f)); + outputs[732].value = atan2((-5.10210922275629e+36f), (-1.0331771223618385e+38f)); + outputs[733].value = atan2((-5.10210922275629e+36f), (-1.1111260733024005e+38f)); + outputs[734].value = atan2((-5.10210922275629e+36f), (-1.1919093895730249e+38f)); + outputs[735].value = atan2((-5.10210922275629e+36f), (-1.2755273754098555e+38f)); + outputs[736].value = atan2((-5.10210922275629e+36f), (-1.3619797265767485e+38f)); + outputs[737].value = atan2((-5.10210922275629e+36f), (-1.4512666458977999e+38f)); + outputs[738].value = atan2((-5.10210922275629e+36f), (-1.5433880319609615e+38f)); + outputs[739].value = atan2((-5.10210922275629e+36f), (-1.6383439861782815e+38f)); + outputs[740].value = atan2((-5.10210922275629e+36f), (-1.73613450854976e+38f)); + outputs[741].value = atan2((-5.10210922275629e+36f), (-1.8367593962513005e+38f)); + outputs[742].value = atan2((-5.10210922275629e+36f), (-1.9402187506949514e+38f)); + outputs[743].value = atan2((-5.10210922275629e+36f), (-2.0465127747048087e+38f)); + outputs[744].value = atan2((-5.10210922275629e+36f), (-2.1556412654567764e+38f)); + outputs[745].value = atan2((-5.10210922275629e+36f), (-2.2676042229508543e+38f)); + outputs[746].value = atan2((-5.10210922275629e+36f), (-2.3824016471870426e+38f)); + outputs[747].value = atan2((-5.10210922275629e+36f), (-2.500033538165341e+38f)); + outputs[748].value = atan2((-5.10210922275629e+36f), (-2.620500098709846e+38f)); + outputs[749].value = atan2((-5.10210922275629e+36f), (-2.7438009231723654e+38f)); + outputs[750].value = atan2((-5.10210922275629e+36f), (-2.869936417201091e+38f)); + outputs[751].value = atan2((-5.10210922275629e+36f), (-2.998906377971927e+38f)); + outputs[752].value = atan2((-5.10210922275629e+36f), (-3.130711008308969e+38f)); + outputs[753].value = atan2((-5.10210922275629e+36f), (-3.2653499025640257e+38f)); + outputs[754].value = atan2((-5.10210922275629e+36f), (-3.4028234663852886e+38f)); + outputs[755].value = atan2((-5.10210922275629e+36f), (-1.1754942106924411e-38f)); + outputs[756].value = atan2((-5.10210922275629e+36f), (-1.0448838051176571e-38f)); + outputs[757].value = atan2((-5.10210922275629e+36f), (-9.142732594130268e-39f)); + outputs[758].value = atan2((-5.10210922275629e+36f), (-7.836628538382429e-39f)); + outputs[759].value = atan2((-5.10210922275629e+36f), (-6.530524482634589e-39f)); + outputs[760].value = atan2((-5.10210922275629e+36f), (-5.224419025588286e-39f)); + outputs[761].value = atan2((-5.10210922275629e+36f), (-3.9183149698404465e-39f)); + outputs[762].value = atan2((-5.10210922275629e+36f), (-2.6122109140926072e-39f)); + outputs[763].value = atan2((-5.10210922275629e+36f), (-1.3061054570463036e-39f)); + outputs[764].value = atan2((-5.10210922275629e+36f), (-1.401298464324817e-45f)); + outputs[765].value = atan2((-5.10210922275629e+36f), (0.0f)); + outputs[766].value = atan2((-5.10210922275629e+36f), (1.401298464324817e-45f)); + outputs[767].value = atan2((-5.10210922275629e+36f), (1.3061054570463036e-39f)); + outputs[768].value = atan2((-5.10210922275629e+36f), (2.6122109140926072e-39f)); + outputs[769].value = atan2((-5.10210922275629e+36f), (3.9183149698404465e-39f)); + outputs[770].value = atan2((-5.10210922275629e+36f), (5.224419025588286e-39f)); + outputs[771].value = atan2((-5.10210922275629e+36f), (6.530524482634589e-39f)); + outputs[772].value = atan2((-5.10210922275629e+36f), (7.836628538382429e-39f)); + outputs[773].value = atan2((-5.10210922275629e+36f), (9.142732594130268e-39f)); + outputs[774].value = atan2((-5.10210922275629e+36f), (1.0448838051176571e-38f)); + outputs[775].value = atan2((-5.10210922275629e+36f), (1.1754942106924411e-38f)); + outputs[776].value = atan2((-5.10210922275629e+36f), (1.1754943508222875e-38f)); + outputs[777].value = atan2((-5.10210922275629e+36f), (1.4172525838845702e+35f)); + outputs[778].value = atan2((-5.10210922275629e+36f), (5.669010335538281e+35f)); + outputs[779].value = atan2((-5.10210922275629e+36f), (1.2755273056890725e+36f)); + outputs[780].value = atan2((-5.10210922275629e+36f), (2.2676041342153123e+36f)); + outputs[781].value = atan2((-5.10210922275629e+36f), (3.54313159836071e+36f)); + outputs[782].value = atan2((-5.10210922275629e+36f), (5.10210922275629e+36f)); + outputs[783].value = atan2((-5.10210922275629e+36f), (6.944537958140003e+36f)); + outputs[784].value = atan2((-5.10210922275629e+36f), (9.070416536861249e+36f)); + outputs[785].value = atan2((-5.10210922275629e+36f), (1.1479746226570628e+37f)); + outputs[786].value = atan2((-5.10210922275629e+36f), (1.417252639344284e+37f)); + outputs[787].value = atan2((-5.10210922275629e+36f), (1.7148755769827283e+37f)); + outputs[788].value = atan2((-5.10210922275629e+36f), (2.040843689102516e+37f)); + outputs[789].value = atan2((-5.10210922275629e+36f), (2.395156848938587e+37f)); + outputs[790].value = atan2((-5.10210922275629e+36f), (2.7778151832560013e+37f)); + outputs[791].value = atan2((-5.10210922275629e+36f), (3.188818438524639e+37f)); + outputs[792].value = atan2((-5.10210922275629e+36f), (3.6281666147444997e+37f)); + outputs[793].value = atan2((-5.10210922275629e+36f), (4.0958599654457038e+37f)); + outputs[794].value = atan2((-5.10210922275629e+36f), (4.591898490628251e+37f)); + outputs[795].value = atan2((-5.10210922275629e+36f), (5.116281936762022e+37f)); + outputs[796].value = atan2((-5.10210922275629e+36f), (5.669010557377136e+37f)); + outputs[797].value = atan2((-5.10210922275629e+36f), (6.250083845413353e+37f)); + outputs[798].value = atan2((-5.10210922275629e+36f), (6.859502307930913e+37f)); + outputs[799].value = atan2((-5.10210922275629e+36f), (7.497265944929817e+37f)); + outputs[800].value = atan2((-5.10210922275629e+36f), (8.163374756410064e+37f)); + outputs[801].value = atan2((-5.10210922275629e+36f), (8.857828235311414e+37f)); + outputs[802].value = atan2((-5.10210922275629e+36f), (9.580627395754348e+37f)); + outputs[803].value = atan2((-5.10210922275629e+36f), (1.0331771223618385e+38f)); + outputs[804].value = atan2((-5.10210922275629e+36f), (1.1111260733024005e+38f)); + outputs[805].value = atan2((-5.10210922275629e+36f), (1.1919093895730249e+38f)); + outputs[806].value = atan2((-5.10210922275629e+36f), (1.2755273754098555e+38f)); + outputs[807].value = atan2((-5.10210922275629e+36f), (1.3619797265767485e+38f)); + outputs[808].value = atan2((-5.10210922275629e+36f), (1.4512666458977999e+38f)); + outputs[809].value = atan2((-5.10210922275629e+36f), (1.5433880319609615e+38f)); + outputs[810].value = atan2((-5.10210922275629e+36f), (1.6383439861782815e+38f)); + outputs[811].value = atan2((-5.10210922275629e+36f), (1.73613450854976e+38f)); + outputs[812].value = atan2((-5.10210922275629e+36f), (1.8367593962513005e+38f)); + outputs[813].value = atan2((-5.10210922275629e+36f), (1.9402187506949514e+38f)); + outputs[814].value = atan2((-5.10210922275629e+36f), (2.0465127747048087e+38f)); + outputs[815].value = atan2((-5.10210922275629e+36f), (2.1556412654567764e+38f)); + outputs[816].value = atan2((-5.10210922275629e+36f), (2.2676042229508543e+38f)); + outputs[817].value = atan2((-5.10210922275629e+36f), (2.3824016471870426e+38f)); + outputs[818].value = atan2((-5.10210922275629e+36f), (2.500033538165341e+38f)); + outputs[819].value = atan2((-5.10210922275629e+36f), (2.620500098709846e+38f)); + outputs[820].value = atan2((-5.10210922275629e+36f), (2.7438009231723654e+38f)); + outputs[821].value = atan2((-5.10210922275629e+36f), (2.869936417201091e+38f)); + outputs[822].value = atan2((-5.10210922275629e+36f), (2.998906377971927e+38f)); + outputs[823].value = atan2((-5.10210922275629e+36f), (3.130711008308969e+38f)); + outputs[824].value = atan2((-5.10210922275629e+36f), (3.2653499025640257e+38f)); + outputs[825].value = atan2((-5.10210922275629e+36f), (3.4028234663852886e+38f)); + outputs[826].value = atan2((-6.944537958140003e+36f), (-6.944537958140003e+36f)); + outputs[827].value = atan2((-6.944537958140003e+36f), (-9.070416536861249e+36f)); + outputs[828].value = atan2((-6.944537958140003e+36f), (-1.1479746226570628e+37f)); + outputs[829].value = atan2((-6.944537958140003e+36f), (-1.417252639344284e+37f)); + outputs[830].value = atan2((-6.944537958140003e+36f), (-1.7148755769827283e+37f)); + outputs[831].value = atan2((-6.944537958140003e+36f), (-2.040843689102516e+37f)); + outputs[832].value = atan2((-6.944537958140003e+36f), (-2.395156848938587e+37f)); + outputs[833].value = atan2((-6.944537958140003e+36f), (-2.7778151832560013e+37f)); + outputs[834].value = atan2((-6.944537958140003e+36f), (-3.188818438524639e+37f)); + outputs[835].value = atan2((-6.944537958140003e+36f), (-3.6281666147444997e+37f)); + outputs[836].value = atan2((-6.944537958140003e+36f), (-4.0958599654457038e+37f)); + outputs[837].value = atan2((-6.944537958140003e+36f), (-4.591898490628251e+37f)); + outputs[838].value = atan2((-6.944537958140003e+36f), (-5.116281936762022e+37f)); + outputs[839].value = atan2((-6.944537958140003e+36f), (-5.669010557377136e+37f)); + outputs[840].value = atan2((-6.944537958140003e+36f), (-6.250083845413353e+37f)); + outputs[841].value = atan2((-6.944537958140003e+36f), (-6.859502307930913e+37f)); + outputs[842].value = atan2((-6.944537958140003e+36f), (-7.497265944929817e+37f)); + outputs[843].value = atan2((-6.944537958140003e+36f), (-8.163374756410064e+37f)); + outputs[844].value = atan2((-6.944537958140003e+36f), (-8.857828235311414e+37f)); + outputs[845].value = atan2((-6.944537958140003e+36f), (-9.580627395754348e+37f)); + outputs[846].value = atan2((-6.944537958140003e+36f), (-1.0331771223618385e+38f)); + outputs[847].value = atan2((-6.944537958140003e+36f), (-1.1111260733024005e+38f)); + outputs[848].value = atan2((-6.944537958140003e+36f), (-1.1919093895730249e+38f)); + outputs[849].value = atan2((-6.944537958140003e+36f), (-1.2755273754098555e+38f)); + outputs[850].value = atan2((-6.944537958140003e+36f), (-1.3619797265767485e+38f)); + outputs[851].value = atan2((-6.944537958140003e+36f), (-1.4512666458977999e+38f)); + outputs[852].value = atan2((-6.944537958140003e+36f), (-1.5433880319609615e+38f)); + outputs[853].value = atan2((-6.944537958140003e+36f), (-1.6383439861782815e+38f)); + outputs[854].value = atan2((-6.944537958140003e+36f), (-1.73613450854976e+38f)); + outputs[855].value = atan2((-6.944537958140003e+36f), (-1.8367593962513005e+38f)); + outputs[856].value = atan2((-6.944537958140003e+36f), (-1.9402187506949514e+38f)); + outputs[857].value = atan2((-6.944537958140003e+36f), (-2.0465127747048087e+38f)); + outputs[858].value = atan2((-6.944537958140003e+36f), (-2.1556412654567764e+38f)); + outputs[859].value = atan2((-6.944537958140003e+36f), (-2.2676042229508543e+38f)); + outputs[860].value = atan2((-6.944537958140003e+36f), (-2.3824016471870426e+38f)); + outputs[861].value = atan2((-6.944537958140003e+36f), (-2.500033538165341e+38f)); + outputs[862].value = atan2((-6.944537958140003e+36f), (-2.620500098709846e+38f)); + outputs[863].value = atan2((-6.944537958140003e+36f), (-2.7438009231723654e+38f)); + outputs[864].value = atan2((-6.944537958140003e+36f), (-2.869936417201091e+38f)); + outputs[865].value = atan2((-6.944537958140003e+36f), (-2.998906377971927e+38f)); + outputs[866].value = atan2((-6.944537958140003e+36f), (-3.130711008308969e+38f)); + outputs[867].value = atan2((-6.944537958140003e+36f), (-3.2653499025640257e+38f)); + outputs[868].value = atan2((-6.944537958140003e+36f), (-3.4028234663852886e+38f)); + outputs[869].value = atan2((-6.944537958140003e+36f), (-1.1754942106924411e-38f)); + outputs[870].value = atan2((-6.944537958140003e+36f), (-1.0448838051176571e-38f)); + outputs[871].value = atan2((-6.944537958140003e+36f), (-9.142732594130268e-39f)); + outputs[872].value = atan2((-6.944537958140003e+36f), (-7.836628538382429e-39f)); + outputs[873].value = atan2((-6.944537958140003e+36f), (-6.530524482634589e-39f)); + outputs[874].value = atan2((-6.944537958140003e+36f), (-5.224419025588286e-39f)); + outputs[875].value = atan2((-6.944537958140003e+36f), (-3.9183149698404465e-39f)); + outputs[876].value = atan2((-6.944537958140003e+36f), (-2.6122109140926072e-39f)); + outputs[877].value = atan2((-6.944537958140003e+36f), (-1.3061054570463036e-39f)); + outputs[878].value = atan2((-6.944537958140003e+36f), (-1.401298464324817e-45f)); + outputs[879].value = atan2((-6.944537958140003e+36f), (0.0f)); + outputs[880].value = atan2((-6.944537958140003e+36f), (1.401298464324817e-45f)); + outputs[881].value = atan2((-6.944537958140003e+36f), (1.3061054570463036e-39f)); + outputs[882].value = atan2((-6.944537958140003e+36f), (2.6122109140926072e-39f)); + outputs[883].value = atan2((-6.944537958140003e+36f), (3.9183149698404465e-39f)); + outputs[884].value = atan2((-6.944537958140003e+36f), (5.224419025588286e-39f)); + outputs[885].value = atan2((-6.944537958140003e+36f), (6.530524482634589e-39f)); + outputs[886].value = atan2((-6.944537958140003e+36f), (7.836628538382429e-39f)); + outputs[887].value = atan2((-6.944537958140003e+36f), (9.142732594130268e-39f)); + outputs[888].value = atan2((-6.944537958140003e+36f), (1.0448838051176571e-38f)); + outputs[889].value = atan2((-6.944537958140003e+36f), (1.1754942106924411e-38f)); + outputs[890].value = atan2((-6.944537958140003e+36f), (1.1754943508222875e-38f)); + outputs[891].value = atan2((-6.944537958140003e+36f), (1.4172525838845702e+35f)); + outputs[892].value = atan2((-6.944537958140003e+36f), (5.669010335538281e+35f)); + outputs[893].value = atan2((-6.944537958140003e+36f), (1.2755273056890725e+36f)); + outputs[894].value = atan2((-6.944537958140003e+36f), (2.2676041342153123e+36f)); + outputs[895].value = atan2((-6.944537958140003e+36f), (3.54313159836071e+36f)); + outputs[896].value = atan2((-6.944537958140003e+36f), (5.10210922275629e+36f)); + outputs[897].value = atan2((-6.944537958140003e+36f), (6.944537958140003e+36f)); + outputs[898].value = atan2((-6.944537958140003e+36f), (9.070416536861249e+36f)); + outputs[899].value = atan2((-6.944537958140003e+36f), (1.1479746226570628e+37f)); + outputs[900].value = atan2((-6.944537958140003e+36f), (1.417252639344284e+37f)); + outputs[901].value = atan2((-6.944537958140003e+36f), (1.7148755769827283e+37f)); + outputs[902].value = atan2((-6.944537958140003e+36f), (2.040843689102516e+37f)); + outputs[903].value = atan2((-6.944537958140003e+36f), (2.395156848938587e+37f)); + outputs[904].value = atan2((-6.944537958140003e+36f), (2.7778151832560013e+37f)); + outputs[905].value = atan2((-6.944537958140003e+36f), (3.188818438524639e+37f)); + outputs[906].value = atan2((-6.944537958140003e+36f), (3.6281666147444997e+37f)); + outputs[907].value = atan2((-6.944537958140003e+36f), (4.0958599654457038e+37f)); + outputs[908].value = atan2((-6.944537958140003e+36f), (4.591898490628251e+37f)); + outputs[909].value = atan2((-6.944537958140003e+36f), (5.116281936762022e+37f)); + outputs[910].value = atan2((-6.944537958140003e+36f), (5.669010557377136e+37f)); + outputs[911].value = atan2((-6.944537958140003e+36f), (6.250083845413353e+37f)); + outputs[912].value = atan2((-6.944537958140003e+36f), (6.859502307930913e+37f)); + outputs[913].value = atan2((-6.944537958140003e+36f), (7.497265944929817e+37f)); + outputs[914].value = atan2((-6.944537958140003e+36f), (8.163374756410064e+37f)); + outputs[915].value = atan2((-6.944537958140003e+36f), (8.857828235311414e+37f)); + outputs[916].value = atan2((-6.944537958140003e+36f), (9.580627395754348e+37f)); + outputs[917].value = atan2((-6.944537958140003e+36f), (1.0331771223618385e+38f)); + outputs[918].value = atan2((-6.944537958140003e+36f), (1.1111260733024005e+38f)); + outputs[919].value = atan2((-6.944537958140003e+36f), (1.1919093895730249e+38f)); + outputs[920].value = atan2((-6.944537958140003e+36f), (1.2755273754098555e+38f)); + outputs[921].value = atan2((-6.944537958140003e+36f), (1.3619797265767485e+38f)); + outputs[922].value = atan2((-6.944537958140003e+36f), (1.4512666458977999e+38f)); + outputs[923].value = atan2((-6.944537958140003e+36f), (1.5433880319609615e+38f)); + outputs[924].value = atan2((-6.944537958140003e+36f), (1.6383439861782815e+38f)); + outputs[925].value = atan2((-6.944537958140003e+36f), (1.73613450854976e+38f)); + outputs[926].value = atan2((-6.944537958140003e+36f), (1.8367593962513005e+38f)); + outputs[927].value = atan2((-6.944537958140003e+36f), (1.9402187506949514e+38f)); + outputs[928].value = atan2((-6.944537958140003e+36f), (2.0465127747048087e+38f)); + outputs[929].value = atan2((-6.944537958140003e+36f), (2.1556412654567764e+38f)); + outputs[930].value = atan2((-6.944537958140003e+36f), (2.2676042229508543e+38f)); + outputs[931].value = atan2((-6.944537958140003e+36f), (2.3824016471870426e+38f)); + outputs[932].value = atan2((-6.944537958140003e+36f), (2.500033538165341e+38f)); + outputs[933].value = atan2((-6.944537958140003e+36f), (2.620500098709846e+38f)); + outputs[934].value = atan2((-6.944537958140003e+36f), (2.7438009231723654e+38f)); + outputs[935].value = atan2((-6.944537958140003e+36f), (2.869936417201091e+38f)); + outputs[936].value = atan2((-6.944537958140003e+36f), (2.998906377971927e+38f)); + outputs[937].value = atan2((-6.944537958140003e+36f), (3.130711008308969e+38f)); + outputs[938].value = atan2((-6.944537958140003e+36f), (3.2653499025640257e+38f)); + outputs[939].value = atan2((-6.944537958140003e+36f), (3.4028234663852886e+38f)); + outputs[940].value = atan2((-9.070416536861249e+36f), (-9.070416536861249e+36f)); + outputs[941].value = atan2((-9.070416536861249e+36f), (-1.1479746226570628e+37f)); + outputs[942].value = atan2((-9.070416536861249e+36f), (-1.417252639344284e+37f)); + outputs[943].value = atan2((-9.070416536861249e+36f), (-1.7148755769827283e+37f)); + outputs[944].value = atan2((-9.070416536861249e+36f), (-2.040843689102516e+37f)); + outputs[945].value = atan2((-9.070416536861249e+36f), (-2.395156848938587e+37f)); + outputs[946].value = atan2((-9.070416536861249e+36f), (-2.7778151832560013e+37f)); + outputs[947].value = atan2((-9.070416536861249e+36f), (-3.188818438524639e+37f)); + outputs[948].value = atan2((-9.070416536861249e+36f), (-3.6281666147444997e+37f)); + outputs[949].value = atan2((-9.070416536861249e+36f), (-4.0958599654457038e+37f)); + outputs[950].value = atan2((-9.070416536861249e+36f), (-4.591898490628251e+37f)); + outputs[951].value = atan2((-9.070416536861249e+36f), (-5.116281936762022e+37f)); + outputs[952].value = atan2((-9.070416536861249e+36f), (-5.669010557377136e+37f)); + outputs[953].value = atan2((-9.070416536861249e+36f), (-6.250083845413353e+37f)); + outputs[954].value = atan2((-9.070416536861249e+36f), (-6.859502307930913e+37f)); + outputs[955].value = atan2((-9.070416536861249e+36f), (-7.497265944929817e+37f)); + outputs[956].value = atan2((-9.070416536861249e+36f), (-8.163374756410064e+37f)); + outputs[957].value = atan2((-9.070416536861249e+36f), (-8.857828235311414e+37f)); + outputs[958].value = atan2((-9.070416536861249e+36f), (-9.580627395754348e+37f)); + outputs[959].value = atan2((-9.070416536861249e+36f), (-1.0331771223618385e+38f)); + outputs[960].value = atan2((-9.070416536861249e+36f), (-1.1111260733024005e+38f)); + outputs[961].value = atan2((-9.070416536861249e+36f), (-1.1919093895730249e+38f)); + outputs[962].value = atan2((-9.070416536861249e+36f), (-1.2755273754098555e+38f)); + outputs[963].value = atan2((-9.070416536861249e+36f), (-1.3619797265767485e+38f)); + outputs[964].value = atan2((-9.070416536861249e+36f), (-1.4512666458977999e+38f)); + outputs[965].value = atan2((-9.070416536861249e+36f), (-1.5433880319609615e+38f)); + outputs[966].value = atan2((-9.070416536861249e+36f), (-1.6383439861782815e+38f)); + outputs[967].value = atan2((-9.070416536861249e+36f), (-1.73613450854976e+38f)); + outputs[968].value = atan2((-9.070416536861249e+36f), (-1.8367593962513005e+38f)); + outputs[969].value = atan2((-9.070416536861249e+36f), (-1.9402187506949514e+38f)); + outputs[970].value = atan2((-9.070416536861249e+36f), (-2.0465127747048087e+38f)); + outputs[971].value = atan2((-9.070416536861249e+36f), (-2.1556412654567764e+38f)); + outputs[972].value = atan2((-9.070416536861249e+36f), (-2.2676042229508543e+38f)); + outputs[973].value = atan2((-9.070416536861249e+36f), (-2.3824016471870426e+38f)); + outputs[974].value = atan2((-9.070416536861249e+36f), (-2.500033538165341e+38f)); + outputs[975].value = atan2((-9.070416536861249e+36f), (-2.620500098709846e+38f)); + outputs[976].value = atan2((-9.070416536861249e+36f), (-2.7438009231723654e+38f)); + outputs[977].value = atan2((-9.070416536861249e+36f), (-2.869936417201091e+38f)); + outputs[978].value = atan2((-9.070416536861249e+36f), (-2.998906377971927e+38f)); + outputs[979].value = atan2((-9.070416536861249e+36f), (-3.130711008308969e+38f)); + outputs[980].value = atan2((-9.070416536861249e+36f), (-3.2653499025640257e+38f)); + outputs[981].value = atan2((-9.070416536861249e+36f), (-3.4028234663852886e+38f)); + outputs[982].value = atan2((-9.070416536861249e+36f), (-1.1754942106924411e-38f)); + outputs[983].value = atan2((-9.070416536861249e+36f), (-1.0448838051176571e-38f)); + outputs[984].value = atan2((-9.070416536861249e+36f), (-9.142732594130268e-39f)); + outputs[985].value = atan2((-9.070416536861249e+36f), (-7.836628538382429e-39f)); + outputs[986].value = atan2((-9.070416536861249e+36f), (-6.530524482634589e-39f)); + outputs[987].value = atan2((-9.070416536861249e+36f), (-5.224419025588286e-39f)); + outputs[988].value = atan2((-9.070416536861249e+36f), (-3.9183149698404465e-39f)); + outputs[989].value = atan2((-9.070416536861249e+36f), (-2.6122109140926072e-39f)); + outputs[990].value = atan2((-9.070416536861249e+36f), (-1.3061054570463036e-39f)); + outputs[991].value = atan2((-9.070416536861249e+36f), (-1.401298464324817e-45f)); + outputs[992].value = atan2((-9.070416536861249e+36f), (0.0f)); + outputs[993].value = atan2((-9.070416536861249e+36f), (1.401298464324817e-45f)); + outputs[994].value = atan2((-9.070416536861249e+36f), (1.3061054570463036e-39f)); + outputs[995].value = atan2((-9.070416536861249e+36f), (2.6122109140926072e-39f)); + outputs[996].value = atan2((-9.070416536861249e+36f), (3.9183149698404465e-39f)); + outputs[997].value = atan2((-9.070416536861249e+36f), (5.224419025588286e-39f)); + outputs[998].value = atan2((-9.070416536861249e+36f), (6.530524482634589e-39f)); + outputs[999].value = atan2((-9.070416536861249e+36f), (7.836628538382429e-39f)); +} diff --git a/test/tint/benchmark/bloom-vertical-blur.wgsl b/test/tint/benchmark/bloom-vertical-blur.wgsl index 79145c95af..f95264b0c8 100644 --- a/test/tint/benchmark/bloom-vertical-blur.wgsl +++ b/test/tint/benchmark/bloom-vertical-blur.wgsl @@ -1,4 +1,4 @@ -let bloomDir = vec2(0.0, 1.0); +const bloomDir = vec2(0.0, 1.0); var offsets : array = array(0.0, 1.384615421, 3.230769157); @@ -34,7 +34,7 @@ fn getGaussianBlur(texCoord : vec2) -> vec4 { @group(0) @binding(3) var prevTexture : texture_2d; -@stage(fragment) +@fragment fn fragmentMain(input : FragmentInput) -> @location(0) vec4 { let blurColor = getGaussianBlur(input.texCoord); let dimColor = (textureSample(prevTexture, bloomSampler, input.texCoord) * bloom.dim); diff --git a/test/tint/benchmark/cluster-lights.wgsl b/test/tint/benchmark/cluster-lights.wgsl index 81d937c483..d29aab3c52 100644 --- a/test/tint/benchmark/cluster-lights.wgsl +++ b/test/tint/benchmark/cluster-lights.wgsl @@ -53,7 +53,7 @@ struct GlobalLights { @group(0) @binding(3) var globalLights : GlobalLights; -let tileCount = vec3(32u, 18u, 48u); +const tileCount = vec3(32u, 18u, 48u); fn linearDepth(depthSample : f32) -> f32 { return ((camera.zFar * camera.zNear) / fma(depthSample, (camera.zNear - camera.zFar), camera.zFar)); @@ -85,7 +85,7 @@ fn sqDistPointAABB(point : vec3, minAABB : vec3, maxAABB : vec3) return sqDist; } -@stage(compute) @workgroup_size(4, 2, 4) +@compute @workgroup_size(4, 2, 4) fn computeMain(@builtin(global_invocation_id) global_id : vec3) { let tileIndex = ((global_id.x + (global_id.y * tileCount.x)) + ((global_id.z * tileCount.x) * tileCount.y)); var clusterLightCount = 0u; diff --git a/test/tint/benchmark/metaball-isosurface.wgsl b/test/tint/benchmark/metaball-isosurface.wgsl index e5dd3811bc..beecb2f42c 100644 --- a/test/tint/benchmark/metaball-isosurface.wgsl +++ b/test/tint/benchmark/metaball-isosurface.wgsl @@ -14,25 +14,25 @@ struct IsosurfaceVolume { values : array, } -@group(0) @binding(1) var volume : IsosurfaceVolume; +@group(0) @binding(1) var volume : IsosurfaceVolume; struct PositionBuffer { values : array, } -@group(0) @binding(2) var positionsOut : PositionBuffer; +@group(0) @binding(2) var positionsOut : PositionBuffer; struct NormalBuffer { values : array, } -@group(0) @binding(3) var normalsOut : NormalBuffer; +@group(0) @binding(3) var normalsOut : NormalBuffer; struct IndexBuffer { tris : array, } -@group(0) @binding(4) var indicesOut : IndexBuffer; +@group(0) @binding(4) var indicesOut : IndexBuffer; struct DrawIndirectArgs { vc : u32, @@ -102,7 +102,7 @@ fn interpZ(index : u32, i : vec3, va : f32, vb : f32) { cubeVerts = (cubeVerts + 1u); } -@stage(compute) @workgroup_size(4, 4, 4) +@compute @workgroup_size(4, 4, 4) fn computeMain(@builtin(global_invocation_id) global_id : vec3) { let i0 = global_id; let i1 = (global_id + vec3(1u, 0u, 0u)); diff --git a/test/tint/benchmark/particles.wgsl b/test/tint/benchmark/particles.wgsl index 416f878394..48628fffbf 100644 --- a/test/tint/benchmark/particles.wgsl +++ b/test/tint/benchmark/particles.wgsl @@ -31,7 +31,7 @@ struct VertexOutput { @location(1) quad_pos : vec2, // -1..+1 }; -@stage(vertex) +@vertex fn vs_main(in : VertexInput) -> VertexOutput { var quad_pos = mat2x3(render_params.right, render_params.up) * in.quad_pos; var position = in.position + quad_pos * 0.01; @@ -45,7 +45,7 @@ fn vs_main(in : VertexInput) -> VertexOutput { //////////////////////////////////////////////////////////////////////////////// // Fragment shader //////////////////////////////////////////////////////////////////////////////// -@stage(fragment) +@fragment fn fs_main(in : VertexOutput) -> @location(0) vec4 { var color = in.color; // Apply a circular particle alpha mask @@ -76,7 +76,7 @@ struct Particles { @binding(1) @group(0) var data : Particles; @binding(2) @group(0) var texture : texture_2d; -@stage(compute) @workgroup_size(64) +@compute @workgroup_size(64) fn simulate(@builtin(global_invocation_id) GlobalInvocationID : vec3) { rand_seed = (sim_params.seed.xy + vec2(GlobalInvocationID.xy)) * sim_params.seed.zw; @@ -148,7 +148,7 @@ struct Buffer { // Loads the alpha channel from a texel of the source image, and writes it to // the buf_out.weights. //////////////////////////////////////////////////////////////////////////////// -@stage(compute) @workgroup_size(64) +@compute @workgroup_size(64) fn import_level(@builtin(global_invocation_id) coord : vec3) { _ = &buf_in; let offset = coord.x + coord.y * ubo.width; @@ -163,7 +163,7 @@ fn import_level(@builtin(global_invocation_id) coord : vec3) { // mip level of tex_out. See simulate() in particle.wgsl to understand the // probability logic. //////////////////////////////////////////////////////////////////////////////// -@stage(compute) @workgroup_size(64) +@compute @workgroup_size(64) fn export_level(@builtin(global_invocation_id) coord : vec3) { if (all(coord.xy < vec2(textureDimensions(tex_out)))) { let dst_offset = coord.x + coord.y * ubo.width; diff --git a/test/tint/benchmark/particles.wgsl.expected.glsl b/test/tint/benchmark/particles.wgsl.expected.glsl index 0aba76a527..88e51566bc 100644 --- a/test/tint/benchmark/particles.wgsl.expected.glsl +++ b/test/tint/benchmark/particles.wgsl.expected.glsl @@ -181,7 +181,7 @@ void simulate(uvec3 GlobalInvocationID) { particle.lifetime = (particle.lifetime - sim_params.deltaTime); particle.color.a = smoothstep(0.0f, 0.5f, particle.lifetime); if ((particle.lifetime < 0.0f)) { - ivec2 coord = ivec2(0, 0); + ivec2 coord = ivec2(0); { for(int level = (textureQueryLevels(tint_symbol_6) - 1); (level > 0); level = (level - 1)) { vec4 probabilites = texelFetch(tint_symbol_6, coord, level); diff --git a/test/tint/benchmark/shadow-fragment.wgsl b/test/tint/benchmark/shadow-fragment.wgsl index ee8269e532..c2da83859f 100644 --- a/test/tint/benchmark/shadow-fragment.wgsl +++ b/test/tint/benchmark/shadow-fragment.wgsl @@ -21,11 +21,11 @@ struct FragmentInput { fragNorm : vec3, } -let albedo : vec3 = vec3(0.899999976, 0.899999976, 0.899999976); +const albedo : vec3 = vec3(0.899999976, 0.899999976, 0.899999976); -let ambientFactor : f32 = 0.200000003; +const ambientFactor : f32 = 0.200000003; -@stage(fragment) +@fragment fn main(input : FragmentInput) -> @location(0) vec4 { var visibility : f32 = 0.0; let oneOverShadowDepthTextureSize = (1.0 / shadowDepthTextureSize); diff --git a/test/tint/benchmark/simple-compute.wgsl b/test/tint/benchmark/simple-compute.wgsl index d2c2f20e79..427e51ccea 100644 --- a/test/tint/benchmark/simple-compute.wgsl +++ b/test/tint/benchmark/simple-compute.wgsl @@ -4,7 +4,7 @@ struct SB { @group(0) @binding(0) var buffer : SB; -@stage(compute) @workgroup_size(1, 2, 3) +@compute @workgroup_size(1, 2, 3) fn main(@builtin(global_invocation_id) id : vec3) { buffer.data[id.x] = buffer.data[id.x] + 1; } diff --git a/test/tint/benchmark/simple-fragment.wgsl b/test/tint/benchmark/simple-fragment.wgsl index 70413551e5..73e8ff87a8 100644 --- a/test/tint/benchmark/simple-fragment.wgsl +++ b/test/tint/benchmark/simple-fragment.wgsl @@ -6,7 +6,7 @@ struct Output { @location(0) color: vec4, }; -@stage(fragment) +@fragment fn main(in : Input) -> Output { return Output(in.color); } diff --git a/test/tint/benchmark/simple-vertex.wgsl b/test/tint/benchmark/simple-vertex.wgsl index b3e260eb2e..45b6bce4da 100644 --- a/test/tint/benchmark/simple-vertex.wgsl +++ b/test/tint/benchmark/simple-vertex.wgsl @@ -6,7 +6,7 @@ struct Output { @builtin(position) position : vec4, }; -@stage(vertex) +@vertex fn main(in : Input) -> Output { return Output(in.position); } diff --git a/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl b/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl index 5aa8758a8b..d0f8354616 100644 --- a/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl +++ b/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl @@ -1,4 +1,4 @@ -let GAMMA = 2.200000048; +const GAMMA = 2.200000048; fn linearTosRGB(linear : vec3) -> vec3 { let INV_GAMMA = (1.0 / GAMMA); @@ -53,7 +53,7 @@ struct GlobalLights { @binding(2) @group(0) var globalLights : GlobalLights; -let tileCount = vec3(32u, 18u, 48u); +const tileCount = vec3(32u, 18u, 48u); fn linearDepth(depthSample : f32) -> f32 { return ((camera.zFar * camera.zNear) / fma(depthSample, (camera.zNear - camera.zFar), camera.zFar)); @@ -85,7 +85,7 @@ struct LightShadowTable { var shadowSampleOffsets : array, 16> = array, 16>(vec2(-1.5, -1.5), vec2(-1.5, -0.5), vec2(-1.5, 0.5), vec2(-1.5, 1.5), vec2(-0.5, -1.5), vec2(-0.5, -0.5), vec2(-0.5, 0.5), vec2(-0.5, 1.5), vec2(0.5, -1.5), vec2(0.5, -0.5), vec2(0.5, 0.5), vec2(0.5, 1.5), vec2(1.5, -1.5), vec2(1.5, -0.5), vec2(1.5, 0.5), vec2(1.5, 1.5)); -let shadowSampleCount = 16u; +const shadowSampleCount = 16u; struct ShadowProperties { viewport : vec4, @@ -249,13 +249,13 @@ fn GetSurfaceInfo(input : VertexOutput) -> SurfaceInfo { return surface; } -let PI = 3.141592741; +const PI = 3.141592741; -let LightType_Point = 0u; +const LightType_Point = 0u; -let LightType_Spot = 1u; +const LightType_Spot = 1u; -let LightType_Directional = 2u; +const LightType_Directional = 2u; struct PuctualLight { lightType : u32, @@ -330,7 +330,7 @@ struct FragmentOutput { emissive : vec4, } -@stage(fragment) +@fragment fn fragmentMain(input : VertexOutput) -> FragmentOutput { let surface = GetSurfaceInfo(input); var Lo = vec3(0.0, 0.0, 0.0); diff --git a/test/tint/benchmark/skinned-shadowed-pbr-vertex.wgsl b/test/tint/benchmark/skinned-shadowed-pbr-vertex.wgsl index 593ba23f69..daef31d1ec 100644 --- a/test/tint/benchmark/skinned-shadowed-pbr-vertex.wgsl +++ b/test/tint/benchmark/skinned-shadowed-pbr-vertex.wgsl @@ -80,7 +80,7 @@ fn getSkinMatrix(input : VertexInput) -> mat4x4 { return skinMatrix; } -@stage(vertex) +@vertex fn vertexMain(input : VertexInput) -> VertexOutput { var output : VertexOutput; let modelMatrix = getSkinMatrix(input); diff --git a/test/tint/benchmark/uniformity-analysis-pointer-parameters.wgsl b/test/tint/benchmark/uniformity-analysis-pointer-parameters.wgsl new file mode 100644 index 0000000000..f73abefe8c --- /dev/null +++ b/test/tint/benchmark/uniformity-analysis-pointer-parameters.wgsl @@ -0,0 +1,1065 @@ +// Create a function with the maximum number of parameters, all pointers, to stress the +// quadratic nature of the uniformity analysis. + +fn foo( + p0 : ptr, + p1 : ptr, + p2 : ptr, + p3 : ptr, + p4 : ptr, + p5 : ptr, + p6 : ptr, + p7 : ptr, + p8 : ptr, + p9 : ptr, + p10 : ptr, + p11 : ptr, + p12 : ptr, + p13 : ptr, + p14 : ptr, + p15 : ptr, + p16 : ptr, + p17 : ptr, + p18 : ptr, + p19 : ptr, + p20 : ptr, + p21 : ptr, + p22 : ptr, + p23 : ptr, + p24 : ptr, + p25 : ptr, + p26 : ptr, + p27 : ptr, + p28 : ptr, + p29 : ptr, + p30 : ptr, + p31 : ptr, + p32 : ptr, + p33 : ptr, + p34 : ptr, + p35 : ptr, + p36 : ptr, + p37 : ptr, + p38 : ptr, + p39 : ptr, + p40 : ptr, + p41 : ptr, + p42 : ptr, + p43 : ptr, + p44 : ptr, + p45 : ptr, + p46 : ptr, + p47 : ptr, + p48 : ptr, + p49 : ptr, + p50 : ptr, + p51 : ptr, + p52 : ptr, + p53 : ptr, + p54 : ptr, + p55 : ptr, + p56 : ptr, + p57 : ptr, + p58 : ptr, + p59 : ptr, + p60 : ptr, + p61 : ptr, + p62 : ptr, + p63 : ptr, + p64 : ptr, + p65 : ptr, + p66 : ptr, + p67 : ptr, + p68 : ptr, + p69 : ptr, + p70 : ptr, + p71 : ptr, + p72 : ptr, + p73 : ptr, + p74 : ptr, + p75 : ptr, + p76 : ptr, + p77 : ptr, + p78 : ptr, + p79 : ptr, + p80 : ptr, + p81 : ptr, + p82 : ptr, + p83 : ptr, + p84 : ptr, + p85 : ptr, + p86 : ptr, + p87 : ptr, + p88 : ptr, + p89 : ptr, + p90 : ptr, + p91 : ptr, + p92 : ptr, + p93 : ptr, + p94 : ptr, + p95 : ptr, + p96 : ptr, + p97 : ptr, + p98 : ptr, + p99 : ptr, + p100 : ptr, + p101 : ptr, + p102 : ptr, + p103 : ptr, + p104 : ptr, + p105 : ptr, + p106 : ptr, + p107 : ptr, + p108 : ptr, + p109 : ptr, + p110 : ptr, + p111 : ptr, + p112 : ptr, + p113 : ptr, + p114 : ptr, + p115 : ptr, + p116 : ptr, + p117 : ptr, + p118 : ptr, + p119 : ptr, + p120 : ptr, + p121 : ptr, + p122 : ptr, + p123 : ptr, + p124 : ptr, + p125 : ptr, + p126 : ptr, + p127 : ptr, + p128 : ptr, + p129 : ptr, + p130 : ptr, + p131 : ptr, + p132 : ptr, + p133 : ptr, + p134 : ptr, + p135 : ptr, + p136 : ptr, + p137 : ptr, + p138 : ptr, + p139 : ptr, + p140 : ptr, + p141 : ptr, + p142 : ptr, + p143 : ptr, + p144 : ptr, + p145 : ptr, + p146 : ptr, + p147 : ptr, + p148 : ptr, + p149 : ptr, + p150 : ptr, + p151 : ptr, + p152 : ptr, + p153 : ptr, + p154 : ptr, + p155 : ptr, + p156 : ptr, + p157 : ptr, + p158 : ptr, + p159 : ptr, + p160 : ptr, + p161 : ptr, + p162 : ptr, + p163 : ptr, + p164 : ptr, + p165 : ptr, + p166 : ptr, + p167 : ptr, + p168 : ptr, + p169 : ptr, + p170 : ptr, + p171 : ptr, + p172 : ptr, + p173 : ptr, + p174 : ptr, + p175 : ptr, + p176 : ptr, + p177 : ptr, + p178 : ptr, + p179 : ptr, + p180 : ptr, + p181 : ptr, + p182 : ptr, + p183 : ptr, + p184 : ptr, + p185 : ptr, + p186 : ptr, + p187 : ptr, + p188 : ptr, + p189 : ptr, + p190 : ptr, + p191 : ptr, + p192 : ptr, + p193 : ptr, + p194 : ptr, + p195 : ptr, + p196 : ptr, + p197 : ptr, + p198 : ptr, + p199 : ptr, + p200 : ptr, + p201 : ptr, + p202 : ptr, + p203 : ptr, + p204 : ptr, + p205 : ptr, + p206 : ptr, + p207 : ptr, + p208 : ptr, + p209 : ptr, + p210 : ptr, + p211 : ptr, + p212 : ptr, + p213 : ptr, + p214 : ptr, + p215 : ptr, + p216 : ptr, + p217 : ptr, + p218 : ptr, + p219 : ptr, + p220 : ptr, + p221 : ptr, + p222 : ptr, + p223 : ptr, + p224 : ptr, + p225 : ptr, + p226 : ptr, + p227 : ptr, + p228 : ptr, + p229 : ptr, + p230 : ptr, + p231 : ptr, + p232 : ptr, + p233 : ptr, + p234 : ptr, + p235 : ptr, + p236 : ptr, + p237 : ptr, + p238 : ptr, + p239 : ptr, + p240 : ptr, + p241 : ptr, + p242 : ptr, + p243 : ptr, + p244 : ptr, + p245 : ptr, + p246 : ptr, + p247 : ptr, + p248 : ptr, + p249 : ptr, + p250 : ptr, + p251 : ptr, + p252 : ptr, + p253 : ptr, + p254 : ptr, +) { + var rhs = *p0 + *p1 + *p2 + *p3 + *p4 + *p5 + *p6 + *p7; + rhs += *p8 + *p9 + *p10 + *p11 + *p12 + *p13 + *p14 + *p15; + rhs += *p16 + *p17 + *p18 + *p19 + *p20 + *p21 + *p22 + *p23; + rhs += *p24 + *p25 + *p26 + *p27 + *p28 + *p29 + *p30 + *p31; + rhs += *p32 + *p33 + *p34 + *p35 + *p36 + *p37 + *p38 + *p39; + rhs += *p40 + *p41 + *p42 + *p43 + *p44 + *p45 + *p46 + *p47; + rhs += *p48 + *p49 + *p50 + *p51 + *p52 + *p53 + *p54 + *p55; + rhs += *p56 + *p57 + *p58 + *p59 + *p60 + *p61 + *p62 + *p63; + rhs += *p64 + *p65 + *p66 + *p67 + *p68 + *p69 + *p70 + *p71; + rhs += *p72 + *p73 + *p74 + *p75 + *p76 + *p77 + *p78 + *p79; + rhs += *p80 + *p81 + *p82 + *p83 + *p84 + *p85 + *p86 + *p87; + rhs += *p88 + *p89 + *p90 + *p91 + *p92 + *p93 + *p94 + *p95; + rhs += *p96 + *p97 + *p98 + *p99 + *p100 + *p101 + *p102 + *p103; + rhs += *p104 + *p105 + *p106 + *p107 + *p108 + *p109 + *p110 + *p111; + rhs += *p112 + *p113 + *p114 + *p115 + *p116 + *p117 + *p118 + *p119; + rhs += *p120 + *p121 + *p122 + *p123 + *p124 + *p125 + *p126 + *p127; + rhs += *p128 + *p129 + *p130 + *p131 + *p132 + *p133 + *p134 + *p135; + rhs += *p136 + *p137 + *p138 + *p139 + *p140 + *p141 + *p142 + *p143; + rhs += *p144 + *p145 + *p146 + *p147 + *p148 + *p149 + *p150 + *p151; + rhs += *p152 + *p153 + *p154 + *p155 + *p156 + *p157 + *p158 + *p159; + rhs += *p160 + *p161 + *p162 + *p163 + *p164 + *p165 + *p166 + *p167; + rhs += *p168 + *p169 + *p170 + *p171 + *p172 + *p173 + *p174 + *p175; + rhs += *p176 + *p177 + *p178 + *p179 + *p180 + *p181 + *p182 + *p183; + rhs += *p184 + *p185 + *p186 + *p187 + *p188 + *p189 + *p190 + *p191; + rhs += *p192 + *p193 + *p194 + *p195 + *p196 + *p197 + *p198 + *p199; + rhs += *p200 + *p201 + *p202 + *p203 + *p204 + *p205 + *p206 + *p207; + rhs += *p208 + *p209 + *p210 + *p211 + *p212 + *p213 + *p214 + *p215; + rhs += *p216 + *p217 + *p218 + *p219 + *p220 + *p221 + *p222 + *p223; + rhs += *p224 + *p225 + *p226 + *p227 + *p228 + *p229 + *p230 + *p231; + rhs += *p232 + *p233 + *p234 + *p235 + *p236 + *p237 + *p238 + *p239; + rhs += *p240 + *p241 + *p242 + *p243 + *p244 + *p245 + *p246 + *p247; + rhs += *p248 + *p249 + *p250 + *p251 + *p252 + *p253 + *p254; + *p1 = rhs; + *p2 = rhs; + *p3 = rhs; + *p4 = rhs; + *p5 = rhs; + *p6 = rhs; + *p7 = rhs; + *p8 = rhs; + *p9 = rhs; + *p10 = rhs; + *p11 = rhs; + *p12 = rhs; + *p13 = rhs; + *p14 = rhs; + *p15 = rhs; + *p16 = rhs; + *p17 = rhs; + *p18 = rhs; + *p19 = rhs; + *p20 = rhs; + *p21 = rhs; + *p22 = rhs; + *p23 = rhs; + *p24 = rhs; + *p25 = rhs; + *p26 = rhs; + *p27 = rhs; + *p28 = rhs; + *p29 = rhs; + *p30 = rhs; + *p31 = rhs; + *p32 = rhs; + *p33 = rhs; + *p34 = rhs; + *p35 = rhs; + *p36 = rhs; + *p37 = rhs; + *p38 = rhs; + *p39 = rhs; + *p40 = rhs; + *p41 = rhs; + *p42 = rhs; + *p43 = rhs; + *p44 = rhs; + *p45 = rhs; + *p46 = rhs; + *p47 = rhs; + *p48 = rhs; + *p49 = rhs; + *p50 = rhs; + *p51 = rhs; + *p52 = rhs; + *p53 = rhs; + *p54 = rhs; + *p55 = rhs; + *p56 = rhs; + *p57 = rhs; + *p58 = rhs; + *p59 = rhs; + *p60 = rhs; + *p61 = rhs; + *p62 = rhs; + *p63 = rhs; + *p64 = rhs; + *p65 = rhs; + *p66 = rhs; + *p67 = rhs; + *p68 = rhs; + *p69 = rhs; + *p70 = rhs; + *p71 = rhs; + *p72 = rhs; + *p73 = rhs; + *p74 = rhs; + *p75 = rhs; + *p76 = rhs; + *p77 = rhs; + *p78 = rhs; + *p79 = rhs; + *p80 = rhs; + *p81 = rhs; + *p82 = rhs; + *p83 = rhs; + *p84 = rhs; + *p85 = rhs; + *p86 = rhs; + *p87 = rhs; + *p88 = rhs; + *p89 = rhs; + *p90 = rhs; + *p91 = rhs; + *p92 = rhs; + *p93 = rhs; + *p94 = rhs; + *p95 = rhs; + *p96 = rhs; + *p97 = rhs; + *p98 = rhs; + *p99 = rhs; + *p100 = rhs; + *p101 = rhs; + *p102 = rhs; + *p103 = rhs; + *p104 = rhs; + *p105 = rhs; + *p106 = rhs; + *p107 = rhs; + *p108 = rhs; + *p109 = rhs; + *p110 = rhs; + *p111 = rhs; + *p112 = rhs; + *p113 = rhs; + *p114 = rhs; + *p115 = rhs; + *p116 = rhs; + *p117 = rhs; + *p118 = rhs; + *p119 = rhs; + *p120 = rhs; + *p121 = rhs; + *p122 = rhs; + *p123 = rhs; + *p124 = rhs; + *p125 = rhs; + *p126 = rhs; + *p127 = rhs; + *p128 = rhs; + *p129 = rhs; + *p130 = rhs; + *p131 = rhs; + *p132 = rhs; + *p133 = rhs; + *p134 = rhs; + *p135 = rhs; + *p136 = rhs; + *p137 = rhs; + *p138 = rhs; + *p139 = rhs; + *p140 = rhs; + *p141 = rhs; + *p142 = rhs; + *p143 = rhs; + *p144 = rhs; + *p145 = rhs; + *p146 = rhs; + *p147 = rhs; + *p148 = rhs; + *p149 = rhs; + *p150 = rhs; + *p151 = rhs; + *p152 = rhs; + *p153 = rhs; + *p154 = rhs; + *p155 = rhs; + *p156 = rhs; + *p157 = rhs; + *p158 = rhs; + *p159 = rhs; + *p160 = rhs; + *p161 = rhs; + *p162 = rhs; + *p163 = rhs; + *p164 = rhs; + *p165 = rhs; + *p166 = rhs; + *p167 = rhs; + *p168 = rhs; + *p169 = rhs; + *p170 = rhs; + *p171 = rhs; + *p172 = rhs; + *p173 = rhs; + *p174 = rhs; + *p175 = rhs; + *p176 = rhs; + *p177 = rhs; + *p178 = rhs; + *p179 = rhs; + *p180 = rhs; + *p181 = rhs; + *p182 = rhs; + *p183 = rhs; + *p184 = rhs; + *p185 = rhs; + *p186 = rhs; + *p187 = rhs; + *p188 = rhs; + *p189 = rhs; + *p190 = rhs; + *p191 = rhs; + *p192 = rhs; + *p193 = rhs; + *p194 = rhs; + *p195 = rhs; + *p196 = rhs; + *p197 = rhs; + *p198 = rhs; + *p199 = rhs; + *p200 = rhs; + *p201 = rhs; + *p202 = rhs; + *p203 = rhs; + *p204 = rhs; + *p205 = rhs; + *p206 = rhs; + *p207 = rhs; + *p208 = rhs; + *p209 = rhs; + *p210 = rhs; + *p211 = rhs; + *p212 = rhs; + *p213 = rhs; + *p214 = rhs; + *p215 = rhs; + *p216 = rhs; + *p217 = rhs; + *p218 = rhs; + *p219 = rhs; + *p220 = rhs; + *p221 = rhs; + *p222 = rhs; + *p223 = rhs; + *p224 = rhs; + *p225 = rhs; + *p226 = rhs; + *p227 = rhs; + *p228 = rhs; + *p229 = rhs; + *p230 = rhs; + *p231 = rhs; + *p232 = rhs; + *p233 = rhs; + *p234 = rhs; + *p235 = rhs; + *p236 = rhs; + *p237 = rhs; + *p238 = rhs; + *p239 = rhs; + *p240 = rhs; + *p241 = rhs; + *p242 = rhs; + *p243 = rhs; + *p244 = rhs; + *p245 = rhs; + *p246 = rhs; + *p247 = rhs; + *p248 = rhs; + *p249 = rhs; + *p250 = rhs; + *p251 = rhs; + *p252 = rhs; + *p253 = rhs; + *p254 = rhs; +} + +fn main() { + var v0 : i32; + var v1 : i32; + var v2 : i32; + var v3 : i32; + var v4 : i32; + var v5 : i32; + var v6 : i32; + var v7 : i32; + var v8 : i32; + var v9 : i32; + var v10 : i32; + var v11 : i32; + var v12 : i32; + var v13 : i32; + var v14 : i32; + var v15 : i32; + var v16 : i32; + var v17 : i32; + var v18 : i32; + var v19 : i32; + var v20 : i32; + var v21 : i32; + var v22 : i32; + var v23 : i32; + var v24 : i32; + var v25 : i32; + var v26 : i32; + var v27 : i32; + var v28 : i32; + var v29 : i32; + var v30 : i32; + var v31 : i32; + var v32 : i32; + var v33 : i32; + var v34 : i32; + var v35 : i32; + var v36 : i32; + var v37 : i32; + var v38 : i32; + var v39 : i32; + var v40 : i32; + var v41 : i32; + var v42 : i32; + var v43 : i32; + var v44 : i32; + var v45 : i32; + var v46 : i32; + var v47 : i32; + var v48 : i32; + var v49 : i32; + var v50 : i32; + var v51 : i32; + var v52 : i32; + var v53 : i32; + var v54 : i32; + var v55 : i32; + var v56 : i32; + var v57 : i32; + var v58 : i32; + var v59 : i32; + var v60 : i32; + var v61 : i32; + var v62 : i32; + var v63 : i32; + var v64 : i32; + var v65 : i32; + var v66 : i32; + var v67 : i32; + var v68 : i32; + var v69 : i32; + var v70 : i32; + var v71 : i32; + var v72 : i32; + var v73 : i32; + var v74 : i32; + var v75 : i32; + var v76 : i32; + var v77 : i32; + var v78 : i32; + var v79 : i32; + var v80 : i32; + var v81 : i32; + var v82 : i32; + var v83 : i32; + var v84 : i32; + var v85 : i32; + var v86 : i32; + var v87 : i32; + var v88 : i32; + var v89 : i32; + var v90 : i32; + var v91 : i32; + var v92 : i32; + var v93 : i32; + var v94 : i32; + var v95 : i32; + var v96 : i32; + var v97 : i32; + var v98 : i32; + var v99 : i32; + var v100 : i32; + var v101 : i32; + var v102 : i32; + var v103 : i32; + var v104 : i32; + var v105 : i32; + var v106 : i32; + var v107 : i32; + var v108 : i32; + var v109 : i32; + var v110 : i32; + var v111 : i32; + var v112 : i32; + var v113 : i32; + var v114 : i32; + var v115 : i32; + var v116 : i32; + var v117 : i32; + var v118 : i32; + var v119 : i32; + var v120 : i32; + var v121 : i32; + var v122 : i32; + var v123 : i32; + var v124 : i32; + var v125 : i32; + var v126 : i32; + var v127 : i32; + var v128 : i32; + var v129 : i32; + var v130 : i32; + var v131 : i32; + var v132 : i32; + var v133 : i32; + var v134 : i32; + var v135 : i32; + var v136 : i32; + var v137 : i32; + var v138 : i32; + var v139 : i32; + var v140 : i32; + var v141 : i32; + var v142 : i32; + var v143 : i32; + var v144 : i32; + var v145 : i32; + var v146 : i32; + var v147 : i32; + var v148 : i32; + var v149 : i32; + var v150 : i32; + var v151 : i32; + var v152 : i32; + var v153 : i32; + var v154 : i32; + var v155 : i32; + var v156 : i32; + var v157 : i32; + var v158 : i32; + var v159 : i32; + var v160 : i32; + var v161 : i32; + var v162 : i32; + var v163 : i32; + var v164 : i32; + var v165 : i32; + var v166 : i32; + var v167 : i32; + var v168 : i32; + var v169 : i32; + var v170 : i32; + var v171 : i32; + var v172 : i32; + var v173 : i32; + var v174 : i32; + var v175 : i32; + var v176 : i32; + var v177 : i32; + var v178 : i32; + var v179 : i32; + var v180 : i32; + var v181 : i32; + var v182 : i32; + var v183 : i32; + var v184 : i32; + var v185 : i32; + var v186 : i32; + var v187 : i32; + var v188 : i32; + var v189 : i32; + var v190 : i32; + var v191 : i32; + var v192 : i32; + var v193 : i32; + var v194 : i32; + var v195 : i32; + var v196 : i32; + var v197 : i32; + var v198 : i32; + var v199 : i32; + var v200 : i32; + var v201 : i32; + var v202 : i32; + var v203 : i32; + var v204 : i32; + var v205 : i32; + var v206 : i32; + var v207 : i32; + var v208 : i32; + var v209 : i32; + var v210 : i32; + var v211 : i32; + var v212 : i32; + var v213 : i32; + var v214 : i32; + var v215 : i32; + var v216 : i32; + var v217 : i32; + var v218 : i32; + var v219 : i32; + var v220 : i32; + var v221 : i32; + var v222 : i32; + var v223 : i32; + var v224 : i32; + var v225 : i32; + var v226 : i32; + var v227 : i32; + var v228 : i32; + var v229 : i32; + var v230 : i32; + var v231 : i32; + var v232 : i32; + var v233 : i32; + var v234 : i32; + var v235 : i32; + var v236 : i32; + var v237 : i32; + var v238 : i32; + var v239 : i32; + var v240 : i32; + var v241 : i32; + var v242 : i32; + var v243 : i32; + var v244 : i32; + var v245 : i32; + var v246 : i32; + var v247 : i32; + var v248 : i32; + var v249 : i32; + var v250 : i32; + var v251 : i32; + var v252 : i32; + var v253 : i32; + var v254 : i32; + foo( + &v0, + &v1, + &v2, + &v3, + &v4, + &v5, + &v6, + &v7, + &v8, + &v9, + &v10, + &v11, + &v12, + &v13, + &v14, + &v15, + &v16, + &v17, + &v18, + &v19, + &v20, + &v21, + &v22, + &v23, + &v24, + &v25, + &v26, + &v27, + &v28, + &v29, + &v30, + &v31, + &v32, + &v33, + &v34, + &v35, + &v36, + &v37, + &v38, + &v39, + &v40, + &v41, + &v42, + &v43, + &v44, + &v45, + &v46, + &v47, + &v48, + &v49, + &v50, + &v51, + &v52, + &v53, + &v54, + &v55, + &v56, + &v57, + &v58, + &v59, + &v60, + &v61, + &v62, + &v63, + &v64, + &v65, + &v66, + &v67, + &v68, + &v69, + &v70, + &v71, + &v72, + &v73, + &v74, + &v75, + &v76, + &v77, + &v78, + &v79, + &v80, + &v81, + &v82, + &v83, + &v84, + &v85, + &v86, + &v87, + &v88, + &v89, + &v90, + &v91, + &v92, + &v93, + &v94, + &v95, + &v96, + &v97, + &v98, + &v99, + &v100, + &v101, + &v102, + &v103, + &v104, + &v105, + &v106, + &v107, + &v108, + &v109, + &v110, + &v111, + &v112, + &v113, + &v114, + &v115, + &v116, + &v117, + &v118, + &v119, + &v120, + &v121, + &v122, + &v123, + &v124, + &v125, + &v126, + &v127, + &v128, + &v129, + &v130, + &v131, + &v132, + &v133, + &v134, + &v135, + &v136, + &v137, + &v138, + &v139, + &v140, + &v141, + &v142, + &v143, + &v144, + &v145, + &v146, + &v147, + &v148, + &v149, + &v150, + &v151, + &v152, + &v153, + &v154, + &v155, + &v156, + &v157, + &v158, + &v159, + &v160, + &v161, + &v162, + &v163, + &v164, + &v165, + &v166, + &v167, + &v168, + &v169, + &v170, + &v171, + &v172, + &v173, + &v174, + &v175, + &v176, + &v177, + &v178, + &v179, + &v180, + &v181, + &v182, + &v183, + &v184, + &v185, + &v186, + &v187, + &v188, + &v189, + &v190, + &v191, + &v192, + &v193, + &v194, + &v195, + &v196, + &v197, + &v198, + &v199, + &v200, + &v201, + &v202, + &v203, + &v204, + &v205, + &v206, + &v207, + &v208, + &v209, + &v210, + &v211, + &v212, + &v213, + &v214, + &v215, + &v216, + &v217, + &v218, + &v219, + &v220, + &v221, + &v222, + &v223, + &v224, + &v225, + &v226, + &v227, + &v228, + &v229, + &v230, + &v231, + &v232, + &v233, + &v234, + &v235, + &v236, + &v237, + &v238, + &v239, + &v240, + &v241, + &v242, + &v243, + &v244, + &v245, + &v246, + &v247, + &v248, + &v249, + &v250, + &v251, + &v252, + &v253, + &v254, + ); + if (v254 == 0) { + workgroupBarrier(); + } +} diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl b/test/tint/buffer/storage/dynamic_index/read.wgsl index d46694aa00..7c50c42f0f 100644 --- a/test/tint/buffer/storage/dynamic_index/read.wgsl +++ b/test/tint/buffer/storage/dynamic_index/read.wgsl @@ -16,7 +16,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(local_invocation_index) idx : u32) { let a = s.arr[idx].a; let b = s.arr[idx].b; diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.hlsl b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/dynamic_index/read.wgsl.expected.hlsl rename to test/tint/buffer/storage/dynamic_index/read.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..25056c12eb --- /dev/null +++ b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.fxc.hlsl @@ -0,0 +1,42 @@ +ByteAddressBuffer s : register(t0, space0); + +struct tint_symbol_1 { + uint idx : SV_GroupIndex; +}; + +float2x3 tint_symbol_8(ByteAddressBuffer buffer, uint offset) { + return float2x3(asfloat(buffer.Load3((offset + 0u))), asfloat(buffer.Load3((offset + 16u)))); +} + +float3x2 tint_symbol_9(ByteAddressBuffer buffer, uint offset) { + return float3x2(asfloat(buffer.Load2((offset + 0u))), asfloat(buffer.Load2((offset + 8u))), asfloat(buffer.Load2((offset + 16u)))); +} + +typedef int4 tint_symbol_11_ret[4]; +tint_symbol_11_ret tint_symbol_11(ByteAddressBuffer buffer, uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr_1[i_1] = asint(buffer.Load4((offset + (i_1 * 16u)))); + } + } + return arr_1; +} + +void main_inner(uint idx) { + const int3 a = asint(s.Load3((176u * idx))); + const int b = asint(s.Load(((176u * idx) + 12u))); + const uint3 c = s.Load3(((176u * idx) + 16u)); + const uint d = s.Load(((176u * idx) + 28u)); + const float3 e = asfloat(s.Load3(((176u * idx) + 32u))); + const float f = asfloat(s.Load(((176u * idx) + 44u))); + const float2x3 g = tint_symbol_8(s, ((176u * idx) + 48u)); + const float3x2 h = tint_symbol_9(s, ((176u * idx) + 80u)); + const int4 i[4] = tint_symbol_11(s, ((176u * idx) + 112u)); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.idx); + return; +} diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.msl b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.msl index 530148b9c2..549e70fa1a 100644 --- a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.msl +++ b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.msl @@ -12,8 +12,16 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct Inner { @@ -25,12 +33,12 @@ struct Inner { /* 0x002c */ float f; /* 0x0030 */ float2x3 g; /* 0x0050 */ float3x2 h; - /* 0x0068 */ int8_t tint_pad[8]; - /* 0x0070 */ tint_array_wrapper i; + /* 0x0068 */ tint_array tint_pad; + /* 0x0070 */ tint_array i; }; struct S { - /* 0x0000 */ Inner arr[1]; + /* 0x0000 */ tint_array arr; }; void tint_symbol_inner(uint idx, const device S* const tint_symbol_1) { @@ -42,7 +50,7 @@ void tint_symbol_inner(uint idx, const device S* const tint_symbol_1) { float const f = (*(tint_symbol_1)).arr[idx].f; float2x3 const g = (*(tint_symbol_1)).arr[idx].g; float3x2 const h = (*(tint_symbol_1)).arr[idx].h; - tint_array_wrapper const i = (*(tint_symbol_1)).arr[idx].i; + tint_array const i = (*(tint_symbol_1)).arr[idx].i; } kernel void tint_symbol(const device S* tint_symbol_2 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) { diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.wgsl b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.wgsl index ddfe806d1e..f082887d02 100644 --- a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(local_invocation_index) idx : u32) { let a = s.arr[idx].a; let b = s.arr[idx].b; diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl b/test/tint/buffer/storage/dynamic_index/write.wgsl index 03980d577f..38f202cc0d 100644 --- a/test/tint/buffer/storage/dynamic_index/write.wgsl +++ b/test/tint/buffer/storage/dynamic_index/write.wgsl @@ -16,7 +16,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(local_invocation_index) idx : u32) { s.arr[idx].a = vec3(); s.arr[idx].b = i32(); diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.dxc.hlsl b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..34275cff78 --- /dev/null +++ b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.dxc.hlsl @@ -0,0 +1,44 @@ +RWByteAddressBuffer s : register(u0, space0); + +struct tint_symbol_1 { + uint idx : SV_GroupIndex; +}; + +void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, float2x3 value) { + buffer.Store3((offset + 0u), asuint(value[0u])); + buffer.Store3((offset + 16u), asuint(value[1u])); +} + +void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, float3x2 value) { + buffer.Store2((offset + 0u), asuint(value[0u])); + buffer.Store2((offset + 8u), asuint(value[1u])); + buffer.Store2((offset + 16u), asuint(value[2u])); +} + +void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int4 value[4]) { + int4 array[4] = value; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + buffer.Store4((offset + (i_1 * 16u)), asuint(array[i_1])); + } + } +} + +void main_inner(uint idx) { + s.Store3((176u * idx), asuint((0).xxx)); + s.Store(((176u * idx) + 12u), asuint(0)); + s.Store3(((176u * idx) + 16u), asuint((0u).xxx)); + s.Store(((176u * idx) + 28u), asuint(0u)); + s.Store3(((176u * idx) + 32u), asuint((0.0f).xxx)); + s.Store(((176u * idx) + 44u), asuint(0.0f)); + tint_symbol_8(s, ((176u * idx) + 48u), float2x3((0.0f).xxx, (0.0f).xxx)); + tint_symbol_9(s, ((176u * idx) + 80u), float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); + const int4 tint_symbol_13[4] = (int4[4])0; + tint_symbol_11(s, ((176u * idx) + 112u), tint_symbol_13); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.idx); + return; +} diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..34275cff78 --- /dev/null +++ b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.fxc.hlsl @@ -0,0 +1,44 @@ +RWByteAddressBuffer s : register(u0, space0); + +struct tint_symbol_1 { + uint idx : SV_GroupIndex; +}; + +void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, float2x3 value) { + buffer.Store3((offset + 0u), asuint(value[0u])); + buffer.Store3((offset + 16u), asuint(value[1u])); +} + +void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, float3x2 value) { + buffer.Store2((offset + 0u), asuint(value[0u])); + buffer.Store2((offset + 8u), asuint(value[1u])); + buffer.Store2((offset + 16u), asuint(value[2u])); +} + +void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int4 value[4]) { + int4 array[4] = value; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + buffer.Store4((offset + (i_1 * 16u)), asuint(array[i_1])); + } + } +} + +void main_inner(uint idx) { + s.Store3((176u * idx), asuint((0).xxx)); + s.Store(((176u * idx) + 12u), asuint(0)); + s.Store3(((176u * idx) + 16u), asuint((0u).xxx)); + s.Store(((176u * idx) + 28u), asuint(0u)); + s.Store3(((176u * idx) + 32u), asuint((0.0f).xxx)); + s.Store(((176u * idx) + 44u), asuint(0.0f)); + tint_symbol_8(s, ((176u * idx) + 48u), float2x3((0.0f).xxx, (0.0f).xxx)); + tint_symbol_9(s, ((176u * idx) + 80u), float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); + const int4 tint_symbol_13[4] = (int4[4])0; + tint_symbol_11(s, ((176u * idx) + 112u), tint_symbol_13); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.idx); + return; +} diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.glsl b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.glsl index 5d063fa9c9..827ccccd27 100644 --- a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.glsl +++ b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.glsl @@ -16,15 +16,15 @@ layout(binding = 0, std430) buffer S_1 { Inner arr[]; } s; void tint_symbol(uint idx) { - s.arr[idx].a = ivec3(0, 0, 0); + s.arr[idx].a = ivec3(0); s.arr[idx].b = 0; - s.arr[idx].c = uvec3(0u, 0u, 0u); + s.arr[idx].c = uvec3(0u); s.arr[idx].d = 0u; - s.arr[idx].e = vec3(0.0f, 0.0f, 0.0f); + s.arr[idx].e = vec3(0.0f); s.arr[idx].f = 0.0f; - s.arr[idx].g = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - s.arr[idx].h = mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); + s.arr[idx].g = mat2x3(vec3(0.0f), vec3(0.0f)); + s.arr[idx].h = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); + ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); s.arr[idx].i = tint_symbol_1; } diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.hlsl b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.hlsl deleted file mode 100644 index 3fb60a25d5..0000000000 --- a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.hlsl +++ /dev/null @@ -1,44 +0,0 @@ -RWByteAddressBuffer s : register(u0, space0); - -struct tint_symbol_1 { - uint idx : SV_GroupIndex; -}; - -void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, float2x3 value) { - buffer.Store3((offset + 0u), asuint(value[0u])); - buffer.Store3((offset + 16u), asuint(value[1u])); -} - -void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, float3x2 value) { - buffer.Store2((offset + 0u), asuint(value[0u])); - buffer.Store2((offset + 8u), asuint(value[1u])); - buffer.Store2((offset + 16u), asuint(value[2u])); -} - -void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int4 value[4]) { - int4 array[4] = value; - { - [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { - buffer.Store4((offset + (i_1 * 16u)), asuint(array[i_1])); - } - } -} - -void main_inner(uint idx) { - s.Store3((176u * idx), asuint(int3(0, 0, 0))); - s.Store(((176u * idx) + 12u), asuint(0)); - s.Store3(((176u * idx) + 16u), asuint(uint3(0u, 0u, 0u))); - s.Store(((176u * idx) + 28u), asuint(0u)); - s.Store3(((176u * idx) + 32u), asuint(float3(0.0f, 0.0f, 0.0f))); - s.Store(((176u * idx) + 44u), asuint(0.0f)); - tint_symbol_8(s, ((176u * idx) + 48u), float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - tint_symbol_9(s, ((176u * idx) + 80u), float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - const int4 tint_symbol_13[4] = (int4[4])0; - tint_symbol_11(s, ((176u * idx) + 112u), tint_symbol_13); -} - -[numthreads(1, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.idx); - return; -} diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.msl b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.msl index d2debe94f0..e2430dfba9 100644 --- a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.msl +++ b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.msl @@ -12,8 +12,16 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct Inner { @@ -25,24 +33,24 @@ struct Inner { /* 0x002c */ float f; /* 0x0030 */ float2x3 g; /* 0x0050 */ float3x2 h; - /* 0x0068 */ int8_t tint_pad[8]; - /* 0x0070 */ tint_array_wrapper i; + /* 0x0068 */ tint_array tint_pad; + /* 0x0070 */ tint_array i; }; struct S { - /* 0x0000 */ Inner arr[1]; + /* 0x0000 */ tint_array arr; }; void tint_symbol_inner(uint idx, device S* const tint_symbol_2) { - (*(tint_symbol_2)).arr[idx].a = int3(); - (*(tint_symbol_2)).arr[idx].b = int(); - (*(tint_symbol_2)).arr[idx].c = uint3(); - (*(tint_symbol_2)).arr[idx].d = uint(); - (*(tint_symbol_2)).arr[idx].e = float3(); - (*(tint_symbol_2)).arr[idx].f = float(); - (*(tint_symbol_2)).arr[idx].g = float2x3(); - (*(tint_symbol_2)).arr[idx].h = float3x2(); - tint_array_wrapper const tint_symbol_1 = {.arr={}}; + (*(tint_symbol_2)).arr[idx].a = int3(0); + (*(tint_symbol_2)).arr[idx].b = 0; + (*(tint_symbol_2)).arr[idx].c = uint3(0u); + (*(tint_symbol_2)).arr[idx].d = 0u; + (*(tint_symbol_2)).arr[idx].e = float3(0.0f); + (*(tint_symbol_2)).arr[idx].f = 0.0f; + (*(tint_symbol_2)).arr[idx].g = float2x3(float3(0.0f), float3(0.0f)); + (*(tint_symbol_2)).arr[idx].h = float3x2(float2(0.0f), float2(0.0f), float2(0.0f)); + tint_array const tint_symbol_1 = tint_array{}; (*(tint_symbol_2)).arr[idx].i = tint_symbol_1; } diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.wgsl b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.wgsl index dc76bc0bc5..d2fbdfffc6 100644 --- a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(local_invocation_index) idx : u32) { s.arr[idx].a = vec3(); s.arr[idx].b = i32(); diff --git a/test/tint/buffer/storage/static_index/read.wgsl b/test/tint/buffer/storage/static_index/read.wgsl index fb56a9c349..84c51486c4 100644 --- a/test/tint/buffer/storage/static_index/read.wgsl +++ b/test/tint/buffer/storage/static_index/read.wgsl @@ -17,7 +17,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let a = s.a; let b = s.b; diff --git a/test/tint/buffer/storage/static_index/read.wgsl.expected.hlsl b/test/tint/buffer/storage/static_index/read.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/static_index/read.wgsl.expected.hlsl rename to test/tint/buffer/storage/static_index/read.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/static_index/read.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/static_index/read.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9062d007ed --- /dev/null +++ b/test/tint/buffer/storage/static_index/read.wgsl.expected.fxc.hlsl @@ -0,0 +1,44 @@ +struct Inner { + int x; +}; + +ByteAddressBuffer s : register(t0, space0); + +float2x3 tint_symbol_6(ByteAddressBuffer buffer, uint offset) { + return float2x3(asfloat(buffer.Load3((offset + 0u))), asfloat(buffer.Load3((offset + 16u)))); +} + +float3x2 tint_symbol_7(ByteAddressBuffer buffer, uint offset) { + return float3x2(asfloat(buffer.Load2((offset + 0u))), asfloat(buffer.Load2((offset + 8u))), asfloat(buffer.Load2((offset + 16u)))); +} + +Inner tint_symbol_9(ByteAddressBuffer buffer, uint offset) { + const Inner tint_symbol_11 = {asint(buffer.Load((offset + 0u)))}; + return tint_symbol_11; +} + +typedef Inner tint_symbol_10_ret[4]; +tint_symbol_10_ret tint_symbol_10(ByteAddressBuffer buffer, uint offset) { + Inner arr[4] = (Inner[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr[i_1] = tint_symbol_9(buffer, (offset + (i_1 * 4u))); + } + } + return arr; +} + +[numthreads(1, 1, 1)] +void main() { + const int3 a = asint(s.Load3(0u)); + const int b = asint(s.Load(12u)); + const uint3 c = s.Load3(16u); + const uint d = s.Load(28u); + const float3 e = asfloat(s.Load3(32u)); + const float f = asfloat(s.Load(44u)); + const float2x3 g = tint_symbol_6(s, 48u); + const float3x2 h = tint_symbol_7(s, 80u); + const Inner i = tint_symbol_9(s, 104u); + const Inner j[4] = tint_symbol_10(s, 108u); + return; +} diff --git a/test/tint/buffer/storage/static_index/read.wgsl.expected.msl b/test/tint/buffer/storage/static_index/read.wgsl.expected.msl index 8a4f444509..8f891a2e3c 100644 --- a/test/tint/buffer/storage/static_index/read.wgsl.expected.msl +++ b/test/tint/buffer/storage/static_index/read.wgsl.expected.msl @@ -12,12 +12,20 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } -struct Inner { - /* 0x0000 */ int x; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -struct tint_array_wrapper { - /* 0x0000 */ Inner arr[4]; +struct Inner { + /* 0x0000 */ int x; }; struct S { @@ -30,8 +38,8 @@ struct S { /* 0x0030 */ float2x3 g; /* 0x0050 */ float3x2 h; /* 0x0068 */ Inner i; - /* 0x006c */ tint_array_wrapper j; - /* 0x007c */ int8_t tint_pad[4]; + /* 0x006c */ tint_array j; + /* 0x007c */ tint_array tint_pad; }; kernel void tint_symbol(const device S* tint_symbol_1 [[buffer(0)]]) { @@ -44,7 +52,7 @@ kernel void tint_symbol(const device S* tint_symbol_1 [[buffer(0)]]) { float2x3 const g = (*(tint_symbol_1)).g; float3x2 const h = (*(tint_symbol_1)).h; Inner const i = (*(tint_symbol_1)).i; - tint_array_wrapper const j = (*(tint_symbol_1)).j; + tint_array const j = (*(tint_symbol_1)).j; return; } diff --git a/test/tint/buffer/storage/static_index/read.wgsl.expected.wgsl b/test/tint/buffer/storage/static_index/read.wgsl.expected.wgsl index 6a5f32bb9d..89ab3c2c2f 100644 --- a/test/tint/buffer/storage/static_index/read.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/static_index/read.wgsl.expected.wgsl @@ -17,7 +17,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let a = s.a; let b = s.b; diff --git a/test/tint/buffer/storage/static_index/write.wgsl b/test/tint/buffer/storage/static_index/write.wgsl index d9c16cf83a..5290db8051 100644 --- a/test/tint/buffer/storage/static_index/write.wgsl +++ b/test/tint/buffer/storage/static_index/write.wgsl @@ -15,9 +15,9 @@ struct S { j : array, }; -@binding(0) @group(0) var s : S; +@binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { s.a = vec3(); s.b = i32(); diff --git a/test/tint/buffer/storage/static_index/write.wgsl.expected.dxc.hlsl b/test/tint/buffer/storage/static_index/write.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2917dcf865 --- /dev/null +++ b/test/tint/buffer/storage/static_index/write.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +struct Inner { + int x; +}; + +RWByteAddressBuffer s : register(u0, space0); + +void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, float2x3 value) { + buffer.Store3((offset + 0u), asuint(value[0u])); + buffer.Store3((offset + 16u), asuint(value[1u])); +} + +void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, float3x2 value) { + buffer.Store2((offset + 0u), asuint(value[0u])); + buffer.Store2((offset + 8u), asuint(value[1u])); + buffer.Store2((offset + 16u), asuint(value[2u])); +} + +void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, Inner value) { + buffer.Store((offset + 0u), asuint(value.x)); +} + +void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, Inner value[4]) { + Inner array[4] = value; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + tint_symbol_9(buffer, (offset + (i_1 * 4u)), array[i_1]); + } + } +} + +[numthreads(1, 1, 1)] +void main() { + s.Store3(0u, asuint((0).xxx)); + s.Store(12u, asuint(0)); + s.Store3(16u, asuint((0u).xxx)); + s.Store(28u, asuint(0u)); + s.Store3(32u, asuint((0.0f).xxx)); + s.Store(44u, asuint(0.0f)); + tint_symbol_6(s, 48u, float2x3((0.0f).xxx, (0.0f).xxx)); + tint_symbol_7(s, 80u, float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); + const Inner tint_symbol_11 = (Inner)0; + tint_symbol_9(s, 104u, tint_symbol_11); + const Inner tint_symbol_12[4] = (Inner[4])0; + tint_symbol_10(s, 108u, tint_symbol_12); + return; +} diff --git a/test/tint/buffer/storage/static_index/write.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/static_index/write.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2917dcf865 --- /dev/null +++ b/test/tint/buffer/storage/static_index/write.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +struct Inner { + int x; +}; + +RWByteAddressBuffer s : register(u0, space0); + +void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, float2x3 value) { + buffer.Store3((offset + 0u), asuint(value[0u])); + buffer.Store3((offset + 16u), asuint(value[1u])); +} + +void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, float3x2 value) { + buffer.Store2((offset + 0u), asuint(value[0u])); + buffer.Store2((offset + 8u), asuint(value[1u])); + buffer.Store2((offset + 16u), asuint(value[2u])); +} + +void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, Inner value) { + buffer.Store((offset + 0u), asuint(value.x)); +} + +void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, Inner value[4]) { + Inner array[4] = value; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + tint_symbol_9(buffer, (offset + (i_1 * 4u)), array[i_1]); + } + } +} + +[numthreads(1, 1, 1)] +void main() { + s.Store3(0u, asuint((0).xxx)); + s.Store(12u, asuint(0)); + s.Store3(16u, asuint((0u).xxx)); + s.Store(28u, asuint(0u)); + s.Store3(32u, asuint((0.0f).xxx)); + s.Store(44u, asuint(0.0f)); + tint_symbol_6(s, 48u, float2x3((0.0f).xxx, (0.0f).xxx)); + tint_symbol_7(s, 80u, float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx)); + const Inner tint_symbol_11 = (Inner)0; + tint_symbol_9(s, 104u, tint_symbol_11); + const Inner tint_symbol_12[4] = (Inner[4])0; + tint_symbol_10(s, 108u, tint_symbol_12); + return; +} diff --git a/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl b/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl index d463db6c4c..947728e3a0 100644 --- a/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl +++ b/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl @@ -30,14 +30,14 @@ layout(binding = 0, std430) buffer S_1 { Inner j[4]; } s; void tint_symbol() { - s.a = ivec3(0, 0, 0); + s.a = ivec3(0); s.b = 0; - s.c = uvec3(0u, 0u, 0u); + s.c = uvec3(0u); s.d = 0u; - s.e = vec3(0.0f, 0.0f, 0.0f); + s.e = vec3(0.0f); s.f = 0.0f; - s.g = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - s.h = mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + s.g = mat2x3(vec3(0.0f), vec3(0.0f)); + s.h = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); Inner tint_symbol_1 = Inner(0); s.i = tint_symbol_1; Inner tint_symbol_2[4] = Inner[4](Inner(0), Inner(0), Inner(0), Inner(0)); diff --git a/test/tint/buffer/storage/static_index/write.wgsl.expected.hlsl b/test/tint/buffer/storage/static_index/write.wgsl.expected.hlsl deleted file mode 100644 index f4d174547f..0000000000 --- a/test/tint/buffer/storage/static_index/write.wgsl.expected.hlsl +++ /dev/null @@ -1,46 +0,0 @@ -struct Inner { - int x; -}; - -RWByteAddressBuffer s : register(u0, space0); - -void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, float2x3 value) { - buffer.Store3((offset + 0u), asuint(value[0u])); - buffer.Store3((offset + 16u), asuint(value[1u])); -} - -void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, float3x2 value) { - buffer.Store2((offset + 0u), asuint(value[0u])); - buffer.Store2((offset + 8u), asuint(value[1u])); - buffer.Store2((offset + 16u), asuint(value[2u])); -} - -void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, Inner value) { - buffer.Store((offset + 0u), asuint(value.x)); -} - -void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, Inner value[4]) { - Inner array[4] = value; - { - [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { - tint_symbol_9(buffer, (offset + (i_1 * 4u)), array[i_1]); - } - } -} - -[numthreads(1, 1, 1)] -void main() { - s.Store3(0u, asuint(int3(0, 0, 0))); - s.Store(12u, asuint(0)); - s.Store3(16u, asuint(uint3(0u, 0u, 0u))); - s.Store(28u, asuint(0u)); - s.Store3(32u, asuint(float3(0.0f, 0.0f, 0.0f))); - s.Store(44u, asuint(0.0f)); - tint_symbol_6(s, 48u, float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - tint_symbol_7(s, 80u, float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - const Inner tint_symbol_11 = (Inner)0; - tint_symbol_9(s, 104u, tint_symbol_11); - const Inner tint_symbol_12[4] = (Inner[4])0; - tint_symbol_10(s, 108u, tint_symbol_12); - return; -} diff --git a/test/tint/buffer/storage/static_index/write.wgsl.expected.msl b/test/tint/buffer/storage/static_index/write.wgsl.expected.msl index 95b3ff2a9a..251e06f9ea 100644 --- a/test/tint/buffer/storage/static_index/write.wgsl.expected.msl +++ b/test/tint/buffer/storage/static_index/write.wgsl.expected.msl @@ -12,12 +12,20 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } -struct Inner { - /* 0x0000 */ int x; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -struct tint_array_wrapper { - /* 0x0000 */ Inner arr[4]; +struct Inner { + /* 0x0000 */ int x; }; struct S { @@ -30,22 +38,22 @@ struct S { /* 0x0030 */ float2x3 g; /* 0x0050 */ float3x2 h; /* 0x0068 */ Inner i; - /* 0x006c */ tint_array_wrapper j; - /* 0x007c */ int8_t tint_pad[4]; + /* 0x006c */ tint_array j; + /* 0x007c */ tint_array tint_pad; }; kernel void tint_symbol(device S* tint_symbol_3 [[buffer(0)]]) { - (*(tint_symbol_3)).a = int3(); - (*(tint_symbol_3)).b = int(); - (*(tint_symbol_3)).c = uint3(); - (*(tint_symbol_3)).d = uint(); - (*(tint_symbol_3)).e = float3(); - (*(tint_symbol_3)).f = float(); - (*(tint_symbol_3)).g = float2x3(); - (*(tint_symbol_3)).h = float3x2(); - Inner const tint_symbol_1 = {}; + (*(tint_symbol_3)).a = int3(0); + (*(tint_symbol_3)).b = 0; + (*(tint_symbol_3)).c = uint3(0u); + (*(tint_symbol_3)).d = 0u; + (*(tint_symbol_3)).e = float3(0.0f); + (*(tint_symbol_3)).f = 0.0f; + (*(tint_symbol_3)).g = float2x3(float3(0.0f), float3(0.0f)); + (*(tint_symbol_3)).h = float3x2(float2(0.0f), float2(0.0f), float2(0.0f)); + Inner const tint_symbol_1 = Inner{}; (*(tint_symbol_3)).i = tint_symbol_1; - tint_array_wrapper const tint_symbol_2 = {.arr={}}; + tint_array const tint_symbol_2 = tint_array{}; (*(tint_symbol_3)).j = tint_symbol_2; return; } diff --git a/test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm b/test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm index c099dbda02..5f06f4ef83 100644 --- a/test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm +++ b/test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm @@ -39,7 +39,6 @@ OpMemberDecorate %Inner 0 Offset 0 OpMemberDecorate %S 9 Offset 108 OpDecorate %_arr_Inner_uint_4 ArrayStride 4 - OpDecorate %s NonReadable OpDecorate %s Binding 0 OpDecorate %s DescriptorSet 0 %int = OpTypeInt 32 1 diff --git a/test/tint/buffer/storage/static_index/write.wgsl.expected.wgsl b/test/tint/buffer/storage/static_index/write.wgsl.expected.wgsl index 74e590268a..af8c2de8d4 100644 --- a/test/tint/buffer/storage/static_index/write.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/static_index/write.wgsl.expected.wgsl @@ -15,9 +15,9 @@ struct S { j : array, } -@binding(0) @group(0) var s : S; +@binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { s.a = vec3(); s.b = i32(); diff --git a/test/tint/buffer/storage/types/array.wgsl b/test/tint/buffer/storage/types/array.wgsl index ae79369091..b78ebdc87f 100644 --- a/test/tint/buffer/storage/types/array.wgsl +++ b/test/tint/buffer/storage/types/array.wgsl @@ -4,7 +4,7 @@ var in : array; @group(0) @binding(1) var out : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/array.wgsl.expected.hlsl b/test/tint/buffer/storage/types/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/array.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/array.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b02ccdd25 --- /dev/null +++ b/test/tint/buffer/storage/types/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,28 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float value[4]) { + float array[4] = value; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + buffer.Store((offset + (i * 4u)), asuint(array[i])); + } + } +} + +typedef float tint_symbol_4_ret[4]; +tint_symbol_4_ret tint_symbol_4(ByteAddressBuffer buffer, uint offset) { + float arr[4] = (float[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr[i_1] = asfloat(buffer.Load((offset + (i_1 * 4u)))); + } + } + return arr; +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u)); + return; +} diff --git a/test/tint/buffer/storage/types/array.wgsl.expected.msl b/test/tint/buffer/storage/types/array.wgsl.expected.msl index 685b94a589..9155f75551 100644 --- a/test/tint/buffer/storage/types/array.wgsl.expected.msl +++ b/test/tint/buffer/storage/types/array.wgsl.expected.msl @@ -1,11 +1,20 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ float arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -kernel void tint_symbol(device tint_array_wrapper* tint_symbol_1 [[buffer(0)]], const device tint_array_wrapper* tint_symbol_2 [[buffer(1)]]) { +kernel void tint_symbol(device tint_array* tint_symbol_1 [[buffer(0)]], const device tint_array* tint_symbol_2 [[buffer(1)]]) { *(tint_symbol_1) = *(tint_symbol_2); return; } diff --git a/test/tint/buffer/storage/types/array.wgsl.expected.wgsl b/test/tint/buffer/storage/types/array.wgsl.expected.wgsl index 7cfa5a3ed2..690258d73b 100644 --- a/test/tint/buffer/storage/types/array.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/array.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/f32.wgsl b/test/tint/buffer/storage/types/f32.wgsl index d8d60afb26..08826f4162 100644 --- a/test/tint/buffer/storage/types/f32.wgsl +++ b/test/tint/buffer/storage/types/f32.wgsl @@ -4,7 +4,7 @@ var in : f32; @group(0) @binding(1) var out : f32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/f32.wgsl.expected.hlsl b/test/tint/buffer/storage/types/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/f32.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/f32.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6dca9ed16 --- /dev/null +++ b/test/tint/buffer/storage/types/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_1.Store(0u, asuint(asfloat(tint_symbol.Load(0u)))); + return; +} diff --git a/test/tint/buffer/storage/types/f32.wgsl.expected.wgsl b/test/tint/buffer/storage/types/f32.wgsl.expected.wgsl index fc61aa9c81..968b335a60 100644 --- a/test/tint/buffer/storage/types/f32.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/f32.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : f32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/i32.wgsl b/test/tint/buffer/storage/types/i32.wgsl index fa63f1dce5..63f64e55e0 100644 --- a/test/tint/buffer/storage/types/i32.wgsl +++ b/test/tint/buffer/storage/types/i32.wgsl @@ -4,7 +4,7 @@ var in : i32; @group(0) @binding(1) var out : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/i32.wgsl.expected.hlsl b/test/tint/buffer/storage/types/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/i32.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/i32.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c53558620 --- /dev/null +++ b/test/tint/buffer/storage/types/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_1.Store(0u, asuint(asint(tint_symbol.Load(0u)))); + return; +} diff --git a/test/tint/buffer/storage/types/i32.wgsl.expected.wgsl b/test/tint/buffer/storage/types/i32.wgsl.expected.wgsl index f4b6b78ee3..9e0bc0f87b 100644 --- a/test/tint/buffer/storage/types/i32.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/i32.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/mat2x2.wgsl b/test/tint/buffer/storage/types/mat2x2.wgsl index 0fece1843d..0e2b545a4f 100644 --- a/test/tint/buffer/storage/types/mat2x2.wgsl +++ b/test/tint/buffer/storage/types/mat2x2.wgsl @@ -4,7 +4,7 @@ var in : mat2x2; @group(0) @binding(1) var out : mat2x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/mat2x2.wgsl.expected.hlsl b/test/tint/buffer/storage/types/mat2x2.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/mat2x2.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/mat2x2.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/mat2x2.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/mat2x2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1fc1b643f --- /dev/null +++ b/test/tint/buffer/storage/types/mat2x2.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float2x2 value) { + buffer.Store2((offset + 0u), asuint(value[0u])); + buffer.Store2((offset + 8u), asuint(value[1u])); +} + +float2x2 tint_symbol_4(ByteAddressBuffer buffer, uint offset) { + return float2x2(asfloat(buffer.Load2((offset + 0u))), asfloat(buffer.Load2((offset + 8u)))); +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u)); + return; +} diff --git a/test/tint/buffer/storage/types/mat2x2.wgsl.expected.wgsl b/test/tint/buffer/storage/types/mat2x2.wgsl.expected.wgsl index 5d3e65083b..75a7f2814f 100644 --- a/test/tint/buffer/storage/types/mat2x2.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/mat2x2.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : mat2x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/mat2x3.wgsl b/test/tint/buffer/storage/types/mat2x3.wgsl index 7d64f7ba4c..f4cc6d264f 100644 --- a/test/tint/buffer/storage/types/mat2x3.wgsl +++ b/test/tint/buffer/storage/types/mat2x3.wgsl @@ -4,7 +4,7 @@ var in : mat2x3; @group(0) @binding(1) var out : mat2x3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/mat2x3.wgsl.expected.hlsl b/test/tint/buffer/storage/types/mat2x3.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/mat2x3.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/mat2x3.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/mat2x3.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/mat2x3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..baff4c5904 --- /dev/null +++ b/test/tint/buffer/storage/types/mat2x3.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float2x3 value) { + buffer.Store3((offset + 0u), asuint(value[0u])); + buffer.Store3((offset + 16u), asuint(value[1u])); +} + +float2x3 tint_symbol_4(ByteAddressBuffer buffer, uint offset) { + return float2x3(asfloat(buffer.Load3((offset + 0u))), asfloat(buffer.Load3((offset + 16u)))); +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u)); + return; +} diff --git a/test/tint/buffer/storage/types/mat2x3.wgsl.expected.wgsl b/test/tint/buffer/storage/types/mat2x3.wgsl.expected.wgsl index 48eda48043..b3d979a956 100644 --- a/test/tint/buffer/storage/types/mat2x3.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/mat2x3.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : mat2x3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/mat3x2.wgsl b/test/tint/buffer/storage/types/mat3x2.wgsl index e3f972f456..b9eee8ccbe 100644 --- a/test/tint/buffer/storage/types/mat3x2.wgsl +++ b/test/tint/buffer/storage/types/mat3x2.wgsl @@ -4,7 +4,7 @@ var in : mat3x2; @group(0) @binding(1) var out : mat3x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/mat3x2.wgsl.expected.hlsl b/test/tint/buffer/storage/types/mat3x2.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/mat3x2.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/mat3x2.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/mat3x2.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/mat3x2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31d606bf03 --- /dev/null +++ b/test/tint/buffer/storage/types/mat3x2.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float3x2 value) { + buffer.Store2((offset + 0u), asuint(value[0u])); + buffer.Store2((offset + 8u), asuint(value[1u])); + buffer.Store2((offset + 16u), asuint(value[2u])); +} + +float3x2 tint_symbol_4(ByteAddressBuffer buffer, uint offset) { + return float3x2(asfloat(buffer.Load2((offset + 0u))), asfloat(buffer.Load2((offset + 8u))), asfloat(buffer.Load2((offset + 16u)))); +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u)); + return; +} diff --git a/test/tint/buffer/storage/types/mat3x2.wgsl.expected.wgsl b/test/tint/buffer/storage/types/mat3x2.wgsl.expected.wgsl index d5db4366c9..aa300eaee3 100644 --- a/test/tint/buffer/storage/types/mat3x2.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/mat3x2.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : mat3x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/mat4x4.wgsl b/test/tint/buffer/storage/types/mat4x4.wgsl index 673d9d3e3f..7a2d7730bd 100644 --- a/test/tint/buffer/storage/types/mat4x4.wgsl +++ b/test/tint/buffer/storage/types/mat4x4.wgsl @@ -4,7 +4,7 @@ var in : mat4x4; @group(0) @binding(1) var out : mat4x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/mat4x4.wgsl.expected.hlsl b/test/tint/buffer/storage/types/mat4x4.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/mat4x4.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/mat4x4.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/mat4x4.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/mat4x4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e818c0922d --- /dev/null +++ b/test/tint/buffer/storage/types/mat4x4.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float4x4 value) { + buffer.Store4((offset + 0u), asuint(value[0u])); + buffer.Store4((offset + 16u), asuint(value[1u])); + buffer.Store4((offset + 32u), asuint(value[2u])); + buffer.Store4((offset + 48u), asuint(value[3u])); +} + +float4x4 tint_symbol_4(ByteAddressBuffer buffer, uint offset) { + return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u)); + return; +} diff --git a/test/tint/buffer/storage/types/mat4x4.wgsl.expected.wgsl b/test/tint/buffer/storage/types/mat4x4.wgsl.expected.wgsl index 402743f69b..d06843b7e4 100644 --- a/test/tint/buffer/storage/types/mat4x4.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/mat4x4.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : mat4x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/runtime_array.wgsl b/test/tint/buffer/storage/types/runtime_array.wgsl index 156fd68912..4ecdc37a82 100644 --- a/test/tint/buffer/storage/types/runtime_array.wgsl +++ b/test/tint/buffer/storage/types/runtime_array.wgsl @@ -8,7 +8,7 @@ var in : array; @group(0) @binding(1) var out : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out[0] = in[0]; } diff --git a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.dxc.hlsl b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..084353983b --- /dev/null +++ b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.dxc.hlsl @@ -0,0 +1,21 @@ +struct S { + float f; +}; + +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) { + buffer.Store((offset + 0u), asuint(value.f)); +} + +S tint_symbol_4(ByteAddressBuffer buffer, uint offset) { + const S tint_symbol_6 = {asfloat(buffer.Load((offset + 0u)))}; + return tint_symbol_6; +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u)); + return; +} diff --git a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..084353983b --- /dev/null +++ b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +struct S { + float f; +}; + +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) { + buffer.Store((offset + 0u), asuint(value.f)); +} + +S tint_symbol_4(ByteAddressBuffer buffer, uint offset) { + const S tint_symbol_6 = {asfloat(buffer.Load((offset + 0u)))}; + return tint_symbol_6; +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u)); + return; +} diff --git a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.hlsl b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.hlsl deleted file mode 100644 index 035878ad15..0000000000 --- a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -struct S { - float f; -}; - -ByteAddressBuffer tint_symbol : register(t0, space0); -RWByteAddressBuffer tint_symbol_1 : register(u1, space0); - -void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) { - buffer.Store((offset + 0u), asuint(value.f)); -} - -S tint_symbol_4(ByteAddressBuffer buffer, uint offset) { - const S tint_symbol_6 = {asfloat(buffer.Load((offset + 0u)))}; - return tint_symbol_6; -} - -[numthreads(1, 1, 1)] -void main() { - tint_symbol_2(tint_symbol_1, (4u * uint(0)), tint_symbol_4(tint_symbol, (4u * uint(0)))); - return; -} diff --git a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.msl b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.msl index 47fcb21c59..836dba180b 100644 --- a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.msl +++ b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.msl @@ -1,16 +1,29 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ float f; }; struct tint_symbol_2 { - /* 0x0000 */ S arr[1]; + /* 0x0000 */ tint_array arr; }; struct tint_symbol_4 { - /* 0x0000 */ S arr[1]; + /* 0x0000 */ tint_array arr; }; kernel void tint_symbol(device tint_symbol_2* tint_symbol_1 [[buffer(0)]], const device tint_symbol_4* tint_symbol_3 [[buffer(1)]]) { diff --git a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.spvasm b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.spvasm index 5a63e67be4..8fbc2cae04 100644 --- a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.spvasm +++ b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.spvasm @@ -35,12 +35,12 @@ %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %15 = OpConstantNull %int %_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %main = OpFunction %void None %8 %11 = OpLabel - %17 = OpAccessChain %_ptr_StorageBuffer_S %out %uint_0 %int_0 - %18 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0 %int_0 + %17 = OpAccessChain %_ptr_StorageBuffer_S %out %uint_0 %15 + %18 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0 %15 %19 = OpLoad %S %18 OpStore %17 %19 OpReturn diff --git a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.wgsl b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.wgsl index 5ceee23fe8..394663575a 100644 --- a/test/tint/buffer/storage/types/runtime_array.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/runtime_array.wgsl.expected.wgsl @@ -6,7 +6,7 @@ struct S { @group(0) @binding(1) var out : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out[0] = in[0]; } diff --git a/test/tint/buffer/storage/types/struct.wgsl b/test/tint/buffer/storage/types/struct.wgsl index 57ad78af52..ad75a94e18 100644 --- a/test/tint/buffer/storage/types/struct.wgsl +++ b/test/tint/buffer/storage/types/struct.wgsl @@ -11,7 +11,7 @@ var in : S; @group(0) @binding(1) var out : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/struct.wgsl.expected.hlsl b/test/tint/buffer/storage/types/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/struct.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/struct.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..05be6006f9 --- /dev/null +++ b/test/tint/buffer/storage/types/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +struct Inner { + float f; +}; +struct S { + Inner inner; +}; + +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, Inner value) { + buffer.Store((offset + 0u), asuint(value.f)); +} + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) { + tint_symbol_3(buffer, (offset + 0u), value.inner); +} + +Inner tint_symbol_6(ByteAddressBuffer buffer, uint offset) { + const Inner tint_symbol_8 = {asfloat(buffer.Load((offset + 0u)))}; + return tint_symbol_8; +} + +S tint_symbol_5(ByteAddressBuffer buffer, uint offset) { + const S tint_symbol_9 = {tint_symbol_6(buffer, (offset + 0u))}; + return tint_symbol_9; +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_5(tint_symbol, 0u)); + return; +} diff --git a/test/tint/buffer/storage/types/struct.wgsl.expected.wgsl b/test/tint/buffer/storage/types/struct.wgsl.expected.wgsl index 553d4b7847..ad3cde32dd 100644 --- a/test/tint/buffer/storage/types/struct.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/struct.wgsl.expected.wgsl @@ -10,7 +10,7 @@ struct S { @group(0) @binding(1) var out : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/u32.wgsl b/test/tint/buffer/storage/types/u32.wgsl index 0b875101d6..421ec82f9e 100644 --- a/test/tint/buffer/storage/types/u32.wgsl +++ b/test/tint/buffer/storage/types/u32.wgsl @@ -4,7 +4,7 @@ var in : u32; @group(0) @binding(1) var out : u32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/u32.wgsl.expected.hlsl b/test/tint/buffer/storage/types/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/u32.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/u32.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8574dafdc8 --- /dev/null +++ b/test/tint/buffer/storage/types/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_1.Store(0u, asuint(tint_symbol.Load(0u))); + return; +} diff --git a/test/tint/buffer/storage/types/u32.wgsl.expected.wgsl b/test/tint/buffer/storage/types/u32.wgsl.expected.wgsl index 2cebf5e9da..896139e11e 100644 --- a/test/tint/buffer/storage/types/u32.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/u32.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : u32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/vec2.wgsl b/test/tint/buffer/storage/types/vec2.wgsl index d1466d5d1b..ae7b643e97 100644 --- a/test/tint/buffer/storage/types/vec2.wgsl +++ b/test/tint/buffer/storage/types/vec2.wgsl @@ -4,7 +4,7 @@ var in : vec2; @group(0) @binding(1) var out : vec2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/vec2.wgsl.expected.hlsl b/test/tint/buffer/storage/types/vec2.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/vec2.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/vec2.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/vec2.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/vec2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c5c7d7ebe --- /dev/null +++ b/test/tint/buffer/storage/types/vec2.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_1.Store2(0u, asuint(asint(tint_symbol.Load2(0u)))); + return; +} diff --git a/test/tint/buffer/storage/types/vec2.wgsl.expected.wgsl b/test/tint/buffer/storage/types/vec2.wgsl.expected.wgsl index 806600b8cd..a129911494 100644 --- a/test/tint/buffer/storage/types/vec2.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/vec2.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : vec2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/vec3.wgsl b/test/tint/buffer/storage/types/vec3.wgsl index 38e25d074d..d7872e4555 100644 --- a/test/tint/buffer/storage/types/vec3.wgsl +++ b/test/tint/buffer/storage/types/vec3.wgsl @@ -4,7 +4,7 @@ var in : vec3; @group(0) @binding(1) var out : vec3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/vec3.wgsl.expected.hlsl b/test/tint/buffer/storage/types/vec3.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/vec3.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/vec3.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/vec3.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/vec3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9af25f4d63 --- /dev/null +++ b/test/tint/buffer/storage/types/vec3.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_1.Store3(0u, asuint(tint_symbol.Load3(0u))); + return; +} diff --git a/test/tint/buffer/storage/types/vec3.wgsl.expected.wgsl b/test/tint/buffer/storage/types/vec3.wgsl.expected.wgsl index a3fcf3a70f..a476b2fe1d 100644 --- a/test/tint/buffer/storage/types/vec3.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/vec3.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : vec3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/vec4.wgsl b/test/tint/buffer/storage/types/vec4.wgsl index b9bf279e75..c5041b6949 100644 --- a/test/tint/buffer/storage/types/vec4.wgsl +++ b/test/tint/buffer/storage/types/vec4.wgsl @@ -4,7 +4,7 @@ var in : vec4; @group(0) @binding(1) var out : vec4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/storage/types/vec4.wgsl.expected.hlsl b/test/tint/buffer/storage/types/vec4.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/storage/types/vec4.wgsl.expected.hlsl rename to test/tint/buffer/storage/types/vec4.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/storage/types/vec4.wgsl.expected.fxc.hlsl b/test/tint/buffer/storage/types/vec4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd068ba25a --- /dev/null +++ b/test/tint/buffer/storage/types/vec4.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_1.Store4(0u, asuint(asfloat(tint_symbol.Load4(0u)))); + return; +} diff --git a/test/tint/buffer/storage/types/vec4.wgsl.expected.wgsl b/test/tint/buffer/storage/types/vec4.wgsl.expected.wgsl index 22065c76cd..5450df4695 100644 --- a/test/tint/buffer/storage/types/vec4.wgsl.expected.wgsl +++ b/test/tint/buffer/storage/types/vec4.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var out : vec4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { out = in; } diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl b/test/tint/buffer/uniform/dynamic_index/read.wgsl index 6057810309..05d1083a69 100644 --- a/test/tint/buffer/uniform/dynamic_index/read.wgsl +++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl @@ -18,7 +18,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(local_invocation_index) idx : u32) { let a = s.arr[idx].a; let b = s.arr[idx].b; diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.hlsl b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.hlsl rename to test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0d7bd06a72 --- /dev/null +++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.fxc.hlsl @@ -0,0 +1,65 @@ +cbuffer cbuffer_s : register(b0, space0) { + uint4 s[96]; +}; + +struct tint_symbol_1 { + uint idx : SV_GroupIndex; +}; + +float2x3 tint_symbol_9(uint4 buffer[96], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + return float2x3(asfloat(buffer[scalar_offset / 4].xyz), asfloat(buffer[scalar_offset_1 / 4].xyz)); +} + +float3x2 tint_symbol_10(uint4 buffer[96], uint offset) { + const uint scalar_offset_2 = ((offset + 0u)) / 4; + uint4 ubo_load = buffer[scalar_offset_2 / 4]; + const uint scalar_offset_3 = ((offset + 8u)) / 4; + uint4 ubo_load_1 = buffer[scalar_offset_3 / 4]; + const uint scalar_offset_4 = ((offset + 16u)) / 4; + uint4 ubo_load_2 = buffer[scalar_offset_4 / 4]; + return float3x2(asfloat(((scalar_offset_2 & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_3 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_4 & 2) ? ubo_load_2.zw : ubo_load_2.xy))); +} + +typedef int4 tint_symbol_12_ret[4]; +tint_symbol_12_ret tint_symbol_12(uint4 buffer[96], uint offset) { + int4 arr_1[4] = (int4[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + const uint scalar_offset_5 = ((offset + (i_1 * 16u))) / 4; + arr_1[i_1] = asint(buffer[scalar_offset_5 / 4]); + } + } + return arr_1; +} + +void main_inner(uint idx) { + const uint scalar_offset_6 = ((192u * idx)) / 4; + const int3 a = asint(s[scalar_offset_6 / 4].xyz); + const uint scalar_offset_7 = (((192u * idx) + 12u)) / 4; + const int b = asint(s[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = (((192u * idx) + 16u)) / 4; + const uint3 c = s[scalar_offset_8 / 4].xyz; + const uint scalar_offset_9 = (((192u * idx) + 28u)) / 4; + const uint d = s[scalar_offset_9 / 4][scalar_offset_9 % 4]; + const uint scalar_offset_10 = (((192u * idx) + 32u)) / 4; + const float3 e = asfloat(s[scalar_offset_10 / 4].xyz); + const uint scalar_offset_11 = (((192u * idx) + 44u)) / 4; + const float f = asfloat(s[scalar_offset_11 / 4][scalar_offset_11 % 4]); + const uint scalar_offset_12 = (((192u * idx) + 48u)) / 4; + uint4 ubo_load_3 = s[scalar_offset_12 / 4]; + const int2 g = asint(((scalar_offset_12 & 2) ? ubo_load_3.zw : ubo_load_3.xy)); + const uint scalar_offset_13 = (((192u * idx) + 56u)) / 4; + uint4 ubo_load_4 = s[scalar_offset_13 / 4]; + const int2 h = asint(((scalar_offset_13 & 2) ? ubo_load_4.zw : ubo_load_4.xy)); + const float2x3 i = tint_symbol_9(s, ((192u * idx) + 64u)); + const float3x2 j = tint_symbol_10(s, ((192u * idx) + 96u)); + const int4 k[4] = tint_symbol_12(s, ((192u * idx) + 128u)); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.idx); + return; +} diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.msl b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.msl index d781b86e19..e361022682 100644 --- a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.msl +++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.msl @@ -12,8 +12,16 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct Inner { @@ -27,30 +35,26 @@ struct Inner { /* 0x0038 */ int2 h; /* 0x0040 */ float2x3 i; /* 0x0060 */ float3x2 j; - /* 0x0078 */ int8_t tint_pad[8]; - /* 0x0080 */ tint_array_wrapper k; -}; - -struct tint_array_wrapper_1 { - /* 0x0000 */ Inner arr[8]; + /* 0x0078 */ tint_array tint_pad; + /* 0x0080 */ tint_array k; }; struct S { - /* 0x0000 */ tint_array_wrapper_1 arr; + /* 0x0000 */ tint_array arr; }; void tint_symbol_inner(uint idx, const constant S* const tint_symbol_1) { - int3 const a = (*(tint_symbol_1)).arr.arr[idx].a; - int const b = (*(tint_symbol_1)).arr.arr[idx].b; - uint3 const c = (*(tint_symbol_1)).arr.arr[idx].c; - uint const d = (*(tint_symbol_1)).arr.arr[idx].d; - float3 const e = (*(tint_symbol_1)).arr.arr[idx].e; - float const f = (*(tint_symbol_1)).arr.arr[idx].f; - int2 const g = (*(tint_symbol_1)).arr.arr[idx].g; - int2 const h = (*(tint_symbol_1)).arr.arr[idx].h; - float2x3 const i = (*(tint_symbol_1)).arr.arr[idx].i; - float3x2 const j = (*(tint_symbol_1)).arr.arr[idx].j; - tint_array_wrapper const k = (*(tint_symbol_1)).arr.arr[idx].k; + int3 const a = (*(tint_symbol_1)).arr[idx].a; + int const b = (*(tint_symbol_1)).arr[idx].b; + uint3 const c = (*(tint_symbol_1)).arr[idx].c; + uint const d = (*(tint_symbol_1)).arr[idx].d; + float3 const e = (*(tint_symbol_1)).arr[idx].e; + float const f = (*(tint_symbol_1)).arr[idx].f; + int2 const g = (*(tint_symbol_1)).arr[idx].g; + int2 const h = (*(tint_symbol_1)).arr[idx].h; + float2x3 const i = (*(tint_symbol_1)).arr[idx].i; + float3x2 const j = (*(tint_symbol_1)).arr[idx].j; + tint_array const k = (*(tint_symbol_1)).arr[idx].k; } kernel void tint_symbol(const constant S* tint_symbol_2 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) { diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.spvasm b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.spvasm index 9f34e036f3..8837281694 100644 --- a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.spvasm +++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.spvasm @@ -1,3 +1,5 @@ +SKIP: FAILED + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 @@ -125,3 +127,6 @@ %71 = OpFunctionCall %void %main_inner %72 OpReturn OpFunctionEnd +1:1: Structure id 8 decorated as Block for variable in Uniform storage class must follow relaxed uniform buffer layout rules: member 9 is a matrix with stride 8 not satisfying alignment to 16 + %Inner = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %v2int %v2int %mat2v3float %mat3v2float %_arr_v4int_uint_4 + diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.wgsl b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.wgsl index 486b22b6e1..8c8e684ddf 100644 --- a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.wgsl @@ -20,7 +20,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(local_invocation_index) idx : u32) { let a = s.arr[idx].a; let b = s.arr[idx].b; diff --git a/test/tint/buffer/uniform/static_index/read.wgsl b/test/tint/buffer/uniform/static_index/read.wgsl index 85552f369e..ed6e7dc133 100644 --- a/test/tint/buffer/uniform/static_index/read.wgsl +++ b/test/tint/buffer/uniform/static_index/read.wgsl @@ -19,7 +19,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let a = s.a; let b = s.b; diff --git a/test/tint/buffer/uniform/static_index/read.wgsl.expected.hlsl b/test/tint/buffer/uniform/static_index/read.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/static_index/read.wgsl.expected.hlsl rename to test/tint/buffer/uniform/static_index/read.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/static_index/read.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/static_index/read.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1446321b6b --- /dev/null +++ b/test/tint/buffer/uniform/static_index/read.wgsl.expected.fxc.hlsl @@ -0,0 +1,57 @@ +struct Inner { + int x; +}; + +cbuffer cbuffer_s : register(b0, space0) { + uint4 s[13]; +}; + +float2x3 tint_symbol_7(uint4 buffer[13], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + return float2x3(asfloat(buffer[scalar_offset / 4].xyz), asfloat(buffer[scalar_offset_1 / 4].xyz)); +} + +float3x2 tint_symbol_8(uint4 buffer[13], uint offset) { + const uint scalar_offset_2 = ((offset + 0u)) / 4; + uint4 ubo_load = buffer[scalar_offset_2 / 4]; + const uint scalar_offset_3 = ((offset + 8u)) / 4; + uint4 ubo_load_1 = buffer[scalar_offset_3 / 4]; + const uint scalar_offset_4 = ((offset + 16u)) / 4; + uint4 ubo_load_2 = buffer[scalar_offset_4 / 4]; + return float3x2(asfloat(((scalar_offset_2 & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_3 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_4 & 2) ? ubo_load_2.zw : ubo_load_2.xy))); +} + +Inner tint_symbol_10(uint4 buffer[13], uint offset) { + const uint scalar_offset_5 = ((offset + 0u)) / 4; + const Inner tint_symbol_12 = {asint(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4])}; + return tint_symbol_12; +} + +typedef Inner tint_symbol_11_ret[4]; +tint_symbol_11_ret tint_symbol_11(uint4 buffer[13], uint offset) { + Inner arr[4] = (Inner[4])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) { + arr[i_1] = tint_symbol_10(buffer, (offset + (i_1 * 16u))); + } + } + return arr; +} + +[numthreads(1, 1, 1)] +void main() { + const int3 a = asint(s[0].xyz); + const int b = asint(s[0].w); + const uint3 c = s[1].xyz; + const uint d = s[1].w; + const float3 e = asfloat(s[2].xyz); + const float f = asfloat(s[2].w); + const int2 g = asint(s[3].xy); + const int2 h = asint(s[3].zw); + const float2x3 i = tint_symbol_7(s, 64u); + const float3x2 j = tint_symbol_8(s, 96u); + const Inner k = tint_symbol_10(s, 128u); + const Inner l[4] = tint_symbol_11(s, 144u); + return; +} diff --git a/test/tint/buffer/uniform/static_index/read.wgsl.expected.msl b/test/tint/buffer/uniform/static_index/read.wgsl.expected.msl index 26abf26e28..26497bd6d4 100644 --- a/test/tint/buffer/uniform/static_index/read.wgsl.expected.msl +++ b/test/tint/buffer/uniform/static_index/read.wgsl.expected.msl @@ -2,6 +2,18 @@ using namespace metal; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + template inline vec operator*(matrix lhs, packed_vec rhs) { return lhs * vec(rhs); @@ -14,11 +26,7 @@ inline vec operator*(packed_vec lhs, matrix rhs) { struct Inner { /* 0x0000 */ int x; - /* 0x0004 */ int8_t tint_pad[12]; -}; - -struct tint_array_wrapper { - /* 0x0000 */ Inner arr[4]; + /* 0x0004 */ tint_array tint_pad; }; struct S { @@ -32,9 +40,9 @@ struct S { /* 0x0038 */ int2 h; /* 0x0040 */ float2x3 i; /* 0x0060 */ float3x2 j; - /* 0x0078 */ int8_t tint_pad_1[8]; + /* 0x0078 */ tint_array tint_pad_1; /* 0x0080 */ Inner k; - /* 0x0090 */ tint_array_wrapper l; + /* 0x0090 */ tint_array l; }; kernel void tint_symbol(const constant S* tint_symbol_1 [[buffer(0)]]) { @@ -49,7 +57,7 @@ kernel void tint_symbol(const constant S* tint_symbol_1 [[buffer(0)]]) { float2x3 const i = (*(tint_symbol_1)).i; float3x2 const j = (*(tint_symbol_1)).j; Inner const k = (*(tint_symbol_1)).k; - tint_array_wrapper const l = (*(tint_symbol_1)).l; + tint_array const l = (*(tint_symbol_1)).l; return; } diff --git a/test/tint/buffer/uniform/static_index/read.wgsl.expected.spvasm b/test/tint/buffer/uniform/static_index/read.wgsl.expected.spvasm index 25854c6281..88be5bee40 100644 --- a/test/tint/buffer/uniform/static_index/read.wgsl.expected.spvasm +++ b/test/tint/buffer/uniform/static_index/read.wgsl.expected.spvasm @@ -1,3 +1,5 @@ +SKIP: FAILED + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 @@ -114,3 +116,6 @@ %66 = OpLoad %_arr_Inner_uint_4 %65 OpReturn OpFunctionEnd +1:1: Structure id 3 decorated as Block for variable in Uniform storage class must follow relaxed uniform buffer layout rules: member 9 is a matrix with stride 8 not satisfying alignment to 16 + %S = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %v2int %v2int %mat2v3float %mat3v2float %Inner %_arr_Inner_uint_4 + diff --git a/test/tint/buffer/uniform/static_index/read.wgsl.expected.wgsl b/test/tint/buffer/uniform/static_index/read.wgsl.expected.wgsl index eb0a0f1c5b..3c5c891fd5 100644 --- a/test/tint/buffer/uniform/static_index/read.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/static_index/read.wgsl.expected.wgsl @@ -22,7 +22,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let a = s.a; let b = s.b; diff --git a/test/tint/buffer/uniform/types/array.wgsl b/test/tint/buffer/uniform/types/array.wgsl index 01a7138b51..90a400cea3 100644 --- a/test/tint/buffer/uniform/types/array.wgsl +++ b/test/tint/buffer/uniform/types/array.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : array, 4>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/array.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/array.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/array.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..34e3ef1c6a --- /dev/null +++ b/test/tint/buffer/uniform/types/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[4]; +}; + +typedef float4 tint_symbol_ret[4]; +tint_symbol_ret tint_symbol(uint4 buffer[4], uint offset) { + float4 arr[4] = (float4[4])0; + { + [loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) { + const uint scalar_offset = ((offset + (i * 16u))) / 4; + arr[i] = asfloat(buffer[scalar_offset / 4]); + } + } + return arr; +} + +[numthreads(1, 1, 1)] +void main() { + const float4 x[4] = tint_symbol(u, 0u); + return; +} diff --git a/test/tint/buffer/uniform/types/array.wgsl.expected.msl b/test/tint/buffer/uniform/types/array.wgsl.expected.msl index 71c0b99b0f..730f4b18aa 100644 --- a/test/tint/buffer/uniform/types/array.wgsl.expected.msl +++ b/test/tint/buffer/uniform/types/array.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ float4 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -kernel void tint_symbol(const constant tint_array_wrapper* tint_symbol_1 [[buffer(0)]]) { - tint_array_wrapper const x = *(tint_symbol_1); +kernel void tint_symbol(const constant tint_array* tint_symbol_1 [[buffer(0)]]) { + tint_array const x = *(tint_symbol_1); return; } diff --git a/test/tint/buffer/uniform/types/array.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/array.wgsl.expected.wgsl index 43d91c8c5c..8c2b5f09ac 100644 --- a/test/tint/buffer/uniform/types/array.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/array.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : array, 4>; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/f32.wgsl b/test/tint/buffer/uniform/types/f32.wgsl index bd785bb963..5826ac71be 100644 --- a/test/tint/buffer/uniform/types/f32.wgsl +++ b/test/tint/buffer/uniform/types/f32.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : f32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/f32.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/f32.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/f32.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..496e5c9fd4 --- /dev/null +++ b/test/tint/buffer/uniform/types/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + const float x = asfloat(u[0].x); + return; +} diff --git a/test/tint/buffer/uniform/types/f32.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/f32.wgsl.expected.wgsl index ef2fa27baa..967dc09275 100644 --- a/test/tint/buffer/uniform/types/f32.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/f32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : f32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/i32.wgsl b/test/tint/buffer/uniform/types/i32.wgsl index 9d6e5d4ce2..ce51ee86ce 100644 --- a/test/tint/buffer/uniform/types/i32.wgsl +++ b/test/tint/buffer/uniform/types/i32.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/i32.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/i32.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/i32.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6ed76ea43 --- /dev/null +++ b/test/tint/buffer/uniform/types/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + const int x = asint(u[0].x); + return; +} diff --git a/test/tint/buffer/uniform/types/i32.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/i32.wgsl.expected.wgsl index 794f018acb..5862e44aa1 100644 --- a/test/tint/buffer/uniform/types/i32.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/i32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/mat2x2.wgsl b/test/tint/buffer/uniform/types/mat2x2.wgsl index 5522accced..cedb1d62bf 100644 --- a/test/tint/buffer/uniform/types/mat2x2.wgsl +++ b/test/tint/buffer/uniform/types/mat2x2.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : mat2x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/mat2x2.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/mat2x2.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c34b4c53df --- /dev/null +++ b/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[1]; +}; + +float2x2 tint_symbol(uint4 buffer[1], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + uint4 ubo_load = buffer[scalar_offset / 4]; + const uint scalar_offset_1 = ((offset + 8u)) / 4; + uint4 ubo_load_1 = buffer[scalar_offset_1 / 4]; + return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy))); +} + +[numthreads(1, 1, 1)] +void main() { + const float2x2 x = tint_symbol(u, 0u); + return; +} diff --git a/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.spvasm b/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.spvasm index b5fb3179b8..dd16f09e53 100644 --- a/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.spvasm +++ b/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.spvasm @@ -1,3 +1,5 @@ +SKIP: FAILED + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 @@ -35,3 +37,6 @@ %15 = OpLoad %mat2v2float %14 OpReturn OpFunctionEnd +1:1: Structure id 3 decorated as Block for variable in Uniform storage class must follow relaxed uniform buffer layout rules: member 0 is a matrix with stride 8 not satisfying alignment to 16 + %u_block = OpTypeStruct %mat2v2float + diff --git a/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.wgsl index 49ce708690..815d3d376a 100644 --- a/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : mat2x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/mat2x3.wgsl b/test/tint/buffer/uniform/types/mat2x3.wgsl index 5179d281bf..4ded5c4e9e 100644 --- a/test/tint/buffer/uniform/types/mat2x3.wgsl +++ b/test/tint/buffer/uniform/types/mat2x3.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : mat2x3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/mat2x3.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/mat2x3.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e92e916135 --- /dev/null +++ b/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[2]; +}; + +float2x3 tint_symbol(uint4 buffer[2], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + return float2x3(asfloat(buffer[scalar_offset / 4].xyz), asfloat(buffer[scalar_offset_1 / 4].xyz)); +} + +[numthreads(1, 1, 1)] +void main() { + const float2x3 x = tint_symbol(u, 0u); + return; +} diff --git a/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.wgsl index e7f00733d4..58b2268c8e 100644 --- a/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : mat2x3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/mat3x2.wgsl b/test/tint/buffer/uniform/types/mat3x2.wgsl index 0a308b4775..2f6d0b7061 100644 --- a/test/tint/buffer/uniform/types/mat3x2.wgsl +++ b/test/tint/buffer/uniform/types/mat3x2.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : mat3x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/mat3x2.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/mat3x2.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44f2aa4431 --- /dev/null +++ b/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[2]; +}; + +float3x2 tint_symbol(uint4 buffer[2], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + uint4 ubo_load = buffer[scalar_offset / 4]; + const uint scalar_offset_1 = ((offset + 8u)) / 4; + uint4 ubo_load_1 = buffer[scalar_offset_1 / 4]; + const uint scalar_offset_2 = ((offset + 16u)) / 4; + uint4 ubo_load_2 = buffer[scalar_offset_2 / 4]; + return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy))); +} + +[numthreads(1, 1, 1)] +void main() { + const float3x2 x = tint_symbol(u, 0u); + return; +} diff --git a/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.spvasm b/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.spvasm index 550ed15496..efa01c7ab5 100644 --- a/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.spvasm +++ b/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.spvasm @@ -1,3 +1,5 @@ +SKIP: FAILED + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 @@ -35,3 +37,6 @@ %15 = OpLoad %mat3v2float %14 OpReturn OpFunctionEnd +1:1: Structure id 3 decorated as Block for variable in Uniform storage class must follow relaxed uniform buffer layout rules: member 0 is a matrix with stride 8 not satisfying alignment to 16 + %u_block = OpTypeStruct %mat3v2float + diff --git a/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.wgsl index 874cf97757..f1c0ae0f99 100644 --- a/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : mat3x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/mat4x4.wgsl b/test/tint/buffer/uniform/types/mat4x4.wgsl index a9bf3ca73d..7b587afbb2 100644 --- a/test/tint/buffer/uniform/types/mat4x4.wgsl +++ b/test/tint/buffer/uniform/types/mat4x4.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : mat4x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/mat4x4.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/mat4x4.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0b14de0372 --- /dev/null +++ b/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[4]; +}; + +float4x4 tint_symbol(uint4 buffer[4], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + const uint scalar_offset_3 = ((offset + 48u)) / 4; + return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4])); +} + +[numthreads(1, 1, 1)] +void main() { + const float4x4 x = tint_symbol(u, 0u); + return; +} diff --git a/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.wgsl index aa2f714c26..ac47c7d52b 100644 --- a/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : mat4x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/struct.wgsl b/test/tint/buffer/uniform/types/struct.wgsl index 91dbeb1f89..c50edb34c6 100644 --- a/test/tint/buffer/uniform/types/struct.wgsl +++ b/test/tint/buffer/uniform/types/struct.wgsl @@ -8,7 +8,7 @@ struct S { @group(0) @binding(0) var u : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/struct.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/struct.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/struct.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d15eb31450 --- /dev/null +++ b/test/tint/buffer/uniform/types/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +struct Inner { + float f; +}; +struct S { + Inner inner; +}; + +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[1]; +}; + +Inner tint_symbol_1(uint4 buffer[1], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const Inner tint_symbol_3 = {asfloat(buffer[scalar_offset / 4][scalar_offset % 4])}; + return tint_symbol_3; +} + +S tint_symbol(uint4 buffer[1], uint offset) { + const S tint_symbol_4 = {tint_symbol_1(buffer, (offset + 0u))}; + return tint_symbol_4; +} + +[numthreads(1, 1, 1)] +void main() { + const S x = tint_symbol(u, 0u); + return; +} diff --git a/test/tint/buffer/uniform/types/struct.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/struct.wgsl.expected.wgsl index 745979dbd0..552be2cfc8 100644 --- a/test/tint/buffer/uniform/types/struct.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/struct.wgsl.expected.wgsl @@ -8,7 +8,7 @@ struct S { @group(0) @binding(0) var u : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/u32.wgsl b/test/tint/buffer/uniform/types/u32.wgsl index 3afc920224..ffccee1a5d 100644 --- a/test/tint/buffer/uniform/types/u32.wgsl +++ b/test/tint/buffer/uniform/types/u32.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : u32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/u32.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/u32.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/u32.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f033091a5a --- /dev/null +++ b/test/tint/buffer/uniform/types/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + const uint x = u[0].x; + return; +} diff --git a/test/tint/buffer/uniform/types/u32.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/u32.wgsl.expected.wgsl index d5d7e7ff8b..ab6b39f218 100644 --- a/test/tint/buffer/uniform/types/u32.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/u32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : u32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/vec2.wgsl b/test/tint/buffer/uniform/types/vec2.wgsl index 89e888916a..d86481ffa5 100644 --- a/test/tint/buffer/uniform/types/vec2.wgsl +++ b/test/tint/buffer/uniform/types/vec2.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : vec2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/vec2.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/vec2.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/vec2.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/vec2.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/vec2.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/vec2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a36e25c3a9 --- /dev/null +++ b/test/tint/buffer/uniform/types/vec2.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + const int2 x = asint(u[0].xy); + return; +} diff --git a/test/tint/buffer/uniform/types/vec2.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/vec2.wgsl.expected.wgsl index 44de55f4ec..0aa9b70a69 100644 --- a/test/tint/buffer/uniform/types/vec2.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/vec2.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : vec2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/vec3.wgsl b/test/tint/buffer/uniform/types/vec3.wgsl index e571c47ee3..60e53dffd2 100644 --- a/test/tint/buffer/uniform/types/vec3.wgsl +++ b/test/tint/buffer/uniform/types/vec3.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : vec3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/vec3.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/vec3.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/vec3.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/vec3.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/vec3.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/vec3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e081c8a73 --- /dev/null +++ b/test/tint/buffer/uniform/types/vec3.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + const uint3 x = u[0].xyz; + return; +} diff --git a/test/tint/buffer/uniform/types/vec3.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/vec3.wgsl.expected.wgsl index be459f763e..07e210299b 100644 --- a/test/tint/buffer/uniform/types/vec3.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/vec3.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : vec3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/vec4.wgsl b/test/tint/buffer/uniform/types/vec4.wgsl index f15e971f8f..f3f92cc935 100644 --- a/test/tint/buffer/uniform/types/vec4.wgsl +++ b/test/tint/buffer/uniform/types/vec4.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var u : vec4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/buffer/uniform/types/vec4.wgsl.expected.hlsl b/test/tint/buffer/uniform/types/vec4.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/buffer/uniform/types/vec4.wgsl.expected.hlsl rename to test/tint/buffer/uniform/types/vec4.wgsl.expected.dxc.hlsl diff --git a/test/tint/buffer/uniform/types/vec4.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/types/vec4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ae2ec1970 --- /dev/null +++ b/test/tint/buffer/uniform/types/vec4.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + const float4 x = asfloat(u[0]); + return; +} diff --git a/test/tint/buffer/uniform/types/vec4.wgsl.expected.wgsl b/test/tint/buffer/uniform/types/vec4.wgsl.expected.wgsl index 41a4f37939..e3a8eb7ed4 100644 --- a/test/tint/buffer/uniform/types/vec4.wgsl.expected.wgsl +++ b/test/tint/buffer/uniform/types/vec4.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var u : vec4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x = u; } diff --git a/test/tint/bug/chromium/1221120.wgsl b/test/tint/bug/chromium/1221120.wgsl index d36adc1a06..1781a8c1ee 100644 --- a/test/tint/bug/chromium/1221120.wgsl +++ b/test/tint/bug/chromium/1221120.wgsl @@ -1,2 +1,2 @@ -let +const H=1; diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/1221120.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..051e8c381c --- /dev/null +++ b/test/tint/bug/chromium/1221120.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1221120.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..051e8c381c --- /dev/null +++ b/test/tint/bug/chromium/1221120.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.glsl b/test/tint/bug/chromium/1221120.wgsl.expected.glsl index 5274814ccb..6473d3034c 100644 --- a/test/tint/bug/chromium/1221120.wgsl.expected.glsl +++ b/test/tint/bug/chromium/1221120.wgsl.expected.glsl @@ -4,4 +4,3 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const int H = 1; diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.hlsl b/test/tint/bug/chromium/1221120.wgsl.expected.hlsl deleted file mode 100644 index d79e95b9ab..0000000000 --- a/test/tint/bug/chromium/1221120.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const int H = 1; diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.msl b/test/tint/bug/chromium/1221120.wgsl.expected.msl index 0c40f2b81d..466ceaa5d6 100644 --- a/test/tint/bug/chromium/1221120.wgsl.expected.msl +++ b/test/tint/bug/chromium/1221120.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant int H = 1; - diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.spvasm b/test/tint/bug/chromium/1221120.wgsl.expected.spvasm index 2ab63a45ef..65bef946a5 100644 --- a/test/tint/bug/chromium/1221120.wgsl.expected.spvasm +++ b/test/tint/bug/chromium/1221120.wgsl.expected.spvasm @@ -1,19 +1,16 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 5 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 - OpName %H "H" OpName %unused_entry_point "unused_entry_point" - %int = OpTypeInt 32 1 - %H = OpConstant %int 1 %void = OpTypeVoid - %3 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/chromium/1221120.wgsl.expected.wgsl b/test/tint/bug/chromium/1221120.wgsl.expected.wgsl index 2e0a5a5a20..2b66778d09 100644 --- a/test/tint/bug/chromium/1221120.wgsl.expected.wgsl +++ b/test/tint/bug/chromium/1221120.wgsl.expected.wgsl @@ -1 +1 @@ -let H = 1; +const H = 1; diff --git a/test/tint/bug/chromium/1236161.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/1236161.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..136105307d --- /dev/null +++ b/test/tint/bug/chromium/1236161.wgsl.expected.dxc.hlsl @@ -0,0 +1,18 @@ +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void i() { + const float s = tint_modf(1.0f).whole; +} diff --git a/test/tint/bug/chromium/1236161.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1236161.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..136105307d --- /dev/null +++ b/test/tint/bug/chromium/1236161.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void i() { + const float s = tint_modf(1.0f).whole; +} diff --git a/test/tint/bug/chromium/1236161.wgsl.expected.hlsl b/test/tint/bug/chromium/1236161.wgsl.expected.hlsl deleted file mode 100644 index a0d44d90a7..0000000000 --- a/test/tint/bug/chromium/1236161.wgsl.expected.hlsl +++ /dev/null @@ -1,19 +0,0 @@ -struct modf_result { - float fract; - float whole; -}; -modf_result tint_modf(float param_0) { - float whole; - float fract = modf(param_0, whole); - modf_result result = {fract, whole}; - return result; -} - -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void i() { - const float s = tint_modf(1.0f).whole; -} diff --git a/test/tint/bug/chromium/1236161.wgsl.expected.msl b/test/tint/bug/chromium/1236161.wgsl.expected.msl index 4eb36e602b..8d7aa31d32 100644 --- a/test/tint/bug/chromium/1236161.wgsl.expected.msl +++ b/test/tint/bug/chromium/1236161.wgsl.expected.msl @@ -7,9 +7,9 @@ struct modf_result { float whole; }; modf_result tint_modf(float param_0) { - float whole; - float fract = modf(param_0, whole); - return {fract, whole}; + modf_result result; + result.fract = modf(param_0, result.whole); + return result; } void i() { diff --git a/test/tint/bug/chromium/1251009.wgsl b/test/tint/bug/chromium/1251009.wgsl index 436cd2f11c..7d4a346a5d 100644 --- a/test/tint/bug/chromium/1251009.wgsl +++ b/test/tint/bug/chromium/1251009.wgsl @@ -7,7 +7,7 @@ struct VertexInputs1 { @location(3) loc3 : vec4, }; -@stage(vertex) +@vertex fn main( inputs0 : VertexInputs0, @location(1) loc1 : u32, diff --git a/test/tint/bug/chromium/1251009.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/1251009.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6531385ca6 --- /dev/null +++ b/test/tint/bug/chromium/1251009.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +struct VertexInputs0 { + uint vertex_index; + int loc0; +}; +struct VertexInputs1 { + uint loc1; + float4 loc3; +}; +struct tint_symbol_1 { + int loc0 : TEXCOORD0; + uint loc1 : TEXCOORD1; + uint loc1_1 : TEXCOORD2; + float4 loc3 : TEXCOORD3; + uint vertex_index : SV_VertexID; + uint instance_index : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) { + const uint foo = (inputs0.vertex_index + instance_index); + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexInputs0 tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.loc0}; + const VertexInputs1 tint_symbol_4 = {tint_symbol.loc1_1, tint_symbol.loc3}; + const float4 inner_result = main_inner(tint_symbol_3, tint_symbol.loc1, tint_symbol.instance_index, tint_symbol_4); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/chromium/1251009.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1251009.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6531385ca6 --- /dev/null +++ b/test/tint/bug/chromium/1251009.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +struct VertexInputs0 { + uint vertex_index; + int loc0; +}; +struct VertexInputs1 { + uint loc1; + float4 loc3; +}; +struct tint_symbol_1 { + int loc0 : TEXCOORD0; + uint loc1 : TEXCOORD1; + uint loc1_1 : TEXCOORD2; + float4 loc3 : TEXCOORD3; + uint vertex_index : SV_VertexID; + uint instance_index : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) { + const uint foo = (inputs0.vertex_index + instance_index); + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexInputs0 tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.loc0}; + const VertexInputs1 tint_symbol_4 = {tint_symbol.loc1_1, tint_symbol.loc3}; + const float4 inner_result = main_inner(tint_symbol_3, tint_symbol.loc1, tint_symbol.instance_index, tint_symbol_4); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/chromium/1251009.wgsl.expected.glsl b/test/tint/bug/chromium/1251009.wgsl.expected.glsl index 930840f2c5..5ae88f4b4e 100644 --- a/test/tint/bug/chromium/1251009.wgsl.expected.glsl +++ b/test/tint/bug/chromium/1251009.wgsl.expected.glsl @@ -16,7 +16,7 @@ struct VertexInputs1 { vec4 tint_symbol(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) { uint foo = (inputs0.vertex_index + instance_index); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/bug/chromium/1251009.wgsl.expected.hlsl b/test/tint/bug/chromium/1251009.wgsl.expected.hlsl deleted file mode 100644 index d0c8230887..0000000000 --- a/test/tint/bug/chromium/1251009.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -struct VertexInputs0 { - uint vertex_index; - int loc0; -}; -struct VertexInputs1 { - uint loc1; - float4 loc3; -}; -struct tint_symbol_1 { - int loc0 : TEXCOORD0; - uint loc1 : TEXCOORD1; - uint loc1_1 : TEXCOORD2; - float4 loc3 : TEXCOORD3; - uint vertex_index : SV_VertexID; - uint instance_index : SV_InstanceID; -}; -struct tint_symbol_2 { - float4 value : SV_Position; -}; - -float4 main_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) { - const uint foo = (inputs0.vertex_index + instance_index); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const VertexInputs0 tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.loc0}; - const VertexInputs1 tint_symbol_4 = {tint_symbol.loc1_1, tint_symbol.loc3}; - const float4 inner_result = main_inner(tint_symbol_3, tint_symbol.loc1, tint_symbol.instance_index, tint_symbol_4); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/bug/chromium/1251009.wgsl.expected.msl b/test/tint/bug/chromium/1251009.wgsl.expected.msl index 495192a98c..b0c0e2df4c 100644 --- a/test/tint/bug/chromium/1251009.wgsl.expected.msl +++ b/test/tint/bug/chromium/1251009.wgsl.expected.msl @@ -24,7 +24,7 @@ struct tint_symbol_3 { float4 tint_symbol_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) { uint const foo = (inputs0.vertex_index + instance_index); - return float4(); + return float4(0.0f); } vertex tint_symbol_3 tint_symbol(uint vertex_index [[vertex_id]], uint instance_index [[instance_id]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { diff --git a/test/tint/bug/chromium/1251009.wgsl.expected.wgsl b/test/tint/bug/chromium/1251009.wgsl.expected.wgsl index 745618e4e5..17b12cebcb 100644 --- a/test/tint/bug/chromium/1251009.wgsl.expected.wgsl +++ b/test/tint/bug/chromium/1251009.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct VertexInputs1 { loc3 : vec4, } -@stage(vertex) +@vertex fn main(inputs0 : VertexInputs0, @location(1) loc1 : u32, @builtin(instance_index) instance_index : u32, inputs1 : VertexInputs1) -> @builtin(position) vec4 { let foo : u32 = (inputs0.vertex_index + instance_index); return vec4(); diff --git a/test/tint/bug/chromium/1273230.wgsl b/test/tint/bug/chromium/1273230.wgsl index 4fcf8f92e0..674edaf327 100644 --- a/test/tint/bug/chromium/1273230.wgsl +++ b/test/tint/bug/chromium/1273230.wgsl @@ -101,7 +101,7 @@ fn doIgnore() { var g55 = atomicLoad(&(LUT.values[0])); } -@stage(compute) @workgroup_size(128) +@compute @workgroup_size(128) fn main_count(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var triangleIndex = GlobalInvocationID.x; if ((triangleIndex >= uniforms.numTriangles)) { diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/1273230.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f37fc2baec --- /dev/null +++ b/test/tint/bug/chromium/1273230.wgsl.expected.dxc.hlsl @@ -0,0 +1,102 @@ +uint value_or_one_if_zero_uint(uint value) { + return value == 0u ? 1u : value; +} + +void marg8uintin() { +} + +cbuffer cbuffer_uniforms : register(b0, space0) { + uint4 uniforms[3]; +}; +RWByteAddressBuffer indices : register(u10, space0); +RWByteAddressBuffer positions : register(u11, space0); +RWByteAddressBuffer counters : register(u20, space0); +RWByteAddressBuffer LUT : register(u21, space0); +RWByteAddressBuffer dbg : register(u50, space0); + +float3 toVoxelPos(float3 position) { + float3 bbMin = float3(asfloat(uniforms[1].x), asfloat(uniforms[1].y), asfloat(uniforms[1].z)); + float3 bbMax = float3(asfloat(uniforms[2].x), asfloat(uniforms[2].y), asfloat(uniforms[2].z)); + float3 bbSize = (bbMin - bbMin); + float cubeSize = max(max(bbMax.x, bbMax.y), bbSize.z); + float gridSize = float(uniforms[0].y); + float gx = ((cubeSize * (position.x - asfloat(uniforms[1].x))) / cubeSize); + float gy = ((gx * (position.y - asfloat(uniforms[1].y))) / gridSize); + float gz = ((gridSize * (position.z - asfloat(uniforms[1].z))) / gridSize); + return float3(gz, gz, gz); +} + +uint toIndex1D(uint gridSize, float3 voxelPos) { + uint3 icoord = uint3(voxelPos); + return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); +} + +uint3 toIndex4D(uint gridSize, uint index) { + uint z_1 = (gridSize / value_or_one_if_zero_uint((index * index))); + uint y_1 = ((gridSize - ((gridSize * gridSize) * z_1)) / (gridSize == 0u ? 1u : gridSize)); + uint x_1 = (index % (gridSize == 0u ? 1u : gridSize)); + return uint3(z_1, y_1, y_1); +} + +float3 loadPosition(uint vertexIndex) { + float3 position = float3(asfloat(positions.Load((4u * ((3u * vertexIndex) + 0u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 1u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 2u))))); + return position; +} + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void doIgnore() { + uint g43 = uniforms[0].x; + uint kj6 = dbg.Load(20u); + uint b53 = tint_atomicLoad(counters, 0u); + uint rwg = indices.Load(0u); + float rb5 = asfloat(positions.Load(0u)); + int g55 = tint_atomicLoad_1(LUT, 0u); +} + +struct tint_symbol_1 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void main_count_inner(uint3 GlobalInvocationID) { + uint triangleIndex = GlobalInvocationID.x; + if ((triangleIndex >= uniforms[0].x)) { + return; + } + doIgnore(); + uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u))); + uint i1 = indices.Load((4u * ((3u * i0) + 1u))); + uint i2 = indices.Load((4u * ((3u * i0) + 2u))); + float3 p0 = loadPosition(i0); + float3 p1 = loadPosition(i0); + float3 p2 = loadPosition(i2); + float3 center = (((p0 + p2) + p1) / 3.0f); + float3 voxelPos = toVoxelPos(p1); + uint lIndex = toIndex1D(uniforms[0].y, p0); + int triangleOffset = tint_atomicAdd(LUT, (4u * i1), 1); +} + +[numthreads(128, 1, 1)] +void main_count(tint_symbol_1 tint_symbol) { + main_count_inner(tint_symbol.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1273230.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f37fc2baec --- /dev/null +++ b/test/tint/bug/chromium/1273230.wgsl.expected.fxc.hlsl @@ -0,0 +1,102 @@ +uint value_or_one_if_zero_uint(uint value) { + return value == 0u ? 1u : value; +} + +void marg8uintin() { +} + +cbuffer cbuffer_uniforms : register(b0, space0) { + uint4 uniforms[3]; +}; +RWByteAddressBuffer indices : register(u10, space0); +RWByteAddressBuffer positions : register(u11, space0); +RWByteAddressBuffer counters : register(u20, space0); +RWByteAddressBuffer LUT : register(u21, space0); +RWByteAddressBuffer dbg : register(u50, space0); + +float3 toVoxelPos(float3 position) { + float3 bbMin = float3(asfloat(uniforms[1].x), asfloat(uniforms[1].y), asfloat(uniforms[1].z)); + float3 bbMax = float3(asfloat(uniforms[2].x), asfloat(uniforms[2].y), asfloat(uniforms[2].z)); + float3 bbSize = (bbMin - bbMin); + float cubeSize = max(max(bbMax.x, bbMax.y), bbSize.z); + float gridSize = float(uniforms[0].y); + float gx = ((cubeSize * (position.x - asfloat(uniforms[1].x))) / cubeSize); + float gy = ((gx * (position.y - asfloat(uniforms[1].y))) / gridSize); + float gz = ((gridSize * (position.z - asfloat(uniforms[1].z))) / gridSize); + return float3(gz, gz, gz); +} + +uint toIndex1D(uint gridSize, float3 voxelPos) { + uint3 icoord = uint3(voxelPos); + return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); +} + +uint3 toIndex4D(uint gridSize, uint index) { + uint z_1 = (gridSize / value_or_one_if_zero_uint((index * index))); + uint y_1 = ((gridSize - ((gridSize * gridSize) * z_1)) / (gridSize == 0u ? 1u : gridSize)); + uint x_1 = (index % (gridSize == 0u ? 1u : gridSize)); + return uint3(z_1, y_1, y_1); +} + +float3 loadPosition(uint vertexIndex) { + float3 position = float3(asfloat(positions.Load((4u * ((3u * vertexIndex) + 0u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 1u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 2u))))); + return position; +} + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void doIgnore() { + uint g43 = uniforms[0].x; + uint kj6 = dbg.Load(20u); + uint b53 = tint_atomicLoad(counters, 0u); + uint rwg = indices.Load(0u); + float rb5 = asfloat(positions.Load(0u)); + int g55 = tint_atomicLoad_1(LUT, 0u); +} + +struct tint_symbol_1 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void main_count_inner(uint3 GlobalInvocationID) { + uint triangleIndex = GlobalInvocationID.x; + if ((triangleIndex >= uniforms[0].x)) { + return; + } + doIgnore(); + uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u))); + uint i1 = indices.Load((4u * ((3u * i0) + 1u))); + uint i2 = indices.Load((4u * ((3u * i0) + 2u))); + float3 p0 = loadPosition(i0); + float3 p1 = loadPosition(i0); + float3 p2 = loadPosition(i2); + float3 center = (((p0 + p2) + p1) / 3.0f); + float3 voxelPos = toVoxelPos(p1); + uint lIndex = toIndex1D(uniforms[0].y, p0); + int triangleOffset = tint_atomicAdd(LUT, (4u * i1), 1); +} + +[numthreads(128, 1, 1)] +void main_count(tint_symbol_1 tint_symbol) { + main_count_inner(tint_symbol.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.hlsl b/test/tint/bug/chromium/1273230.wgsl.expected.hlsl deleted file mode 100644 index 5b6f132b18..0000000000 --- a/test/tint/bug/chromium/1273230.wgsl.expected.hlsl +++ /dev/null @@ -1,99 +0,0 @@ -uint value_or_one_if_zero_uint(uint value) { - return value == 0u ? 1u : value; -} - -uint atomicLoad_1(RWByteAddressBuffer buffer, uint offset) { - uint value = 0; - buffer.InterlockedOr(offset, 0, value); - return value; -} - -int atomicLoad_2(RWByteAddressBuffer buffer, uint offset) { - int value = 0; - buffer.InterlockedOr(offset, 0, value); - return value; -} - -int atomicAdd_1(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedAdd(offset, value, original_value); - return original_value; -} - -void marg8uintin() { -} - -cbuffer cbuffer_uniforms : register(b0, space0) { - uint4 uniforms[3]; -}; -RWByteAddressBuffer indices : register(u10, space0); -RWByteAddressBuffer positions : register(u11, space0); -RWByteAddressBuffer counters : register(u20, space0); -RWByteAddressBuffer LUT : register(u21, space0); -RWByteAddressBuffer dbg : register(u50, space0); - -float3 toVoxelPos(float3 position) { - float3 bbMin = float3(asfloat(uniforms[1].x), asfloat(uniforms[1].y), asfloat(uniforms[1].z)); - float3 bbMax = float3(asfloat(uniforms[2].x), asfloat(uniforms[2].y), asfloat(uniforms[2].z)); - float3 bbSize = (bbMin - bbMin); - float cubeSize = max(max(bbMax.x, bbMax.y), bbSize.z); - float gridSize = float(uniforms[0].y); - float gx = ((cubeSize * (position.x - asfloat(uniforms[1].x))) / cubeSize); - float gy = ((gx * (position.y - asfloat(uniforms[1].y))) / gridSize); - float gz = ((gridSize * (position.z - asfloat(uniforms[1].z))) / gridSize); - return float3(gz, gz, gz); -} - -uint toIndex1D(uint gridSize, float3 voxelPos) { - uint3 icoord = uint3(voxelPos); - return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); -} - -uint3 toIndex4D(uint gridSize, uint index) { - uint z_1 = (gridSize / value_or_one_if_zero_uint((index * index))); - uint y_1 = ((gridSize - ((gridSize * gridSize) * z_1)) / (gridSize == 0u ? 1u : gridSize)); - uint x_1 = (index % (gridSize == 0u ? 1u : gridSize)); - return uint3(z_1, y_1, y_1); -} - -float3 loadPosition(uint vertexIndex) { - float3 position = float3(asfloat(positions.Load((4u * ((3u * vertexIndex) + 0u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 1u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 2u))))); - return position; -} - -void doIgnore() { - uint g43 = uniforms[0].x; - uint kj6 = dbg.Load(20u); - uint b53 = atomicLoad_1(counters, (4u * uint(0))); - uint rwg = indices.Load((4u * uint(0))); - float rb5 = asfloat(positions.Load((4u * uint(0)))); - int g55 = atomicLoad_2(LUT, (4u * uint(0))); -} - -struct tint_symbol_1 { - uint3 GlobalInvocationID : SV_DispatchThreadID; -}; - -void main_count_inner(uint3 GlobalInvocationID) { - uint triangleIndex = GlobalInvocationID.x; - if ((triangleIndex >= uniforms[0].x)) { - return; - } - doIgnore(); - uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u))); - uint i1 = indices.Load((4u * ((3u * i0) + 1u))); - uint i2 = indices.Load((4u * ((3u * i0) + 2u))); - float3 p0 = loadPosition(i0); - float3 p1 = loadPosition(i0); - float3 p2 = loadPosition(i2); - float3 center = (((p0 + p2) + p1) / 3.0f); - float3 voxelPos = toVoxelPos(p1); - uint lIndex = toIndex1D(uniforms[0].y, p0); - int triangleOffset = atomicAdd_1(LUT, (4u * i1), 1); -} - -[numthreads(128, 1, 1)] -void main_count(tint_symbol_1 tint_symbol) { - main_count_inner(tint_symbol.GlobalInvocationID); - return; -} diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.msl b/test/tint/bug/chromium/1273230.wgsl.expected.msl index 0052f59ea2..08f7854102 100644 --- a/test/tint/bug/chromium/1273230.wgsl.expected.msl +++ b/test/tint/bug/chromium/1273230.wgsl.expected.msl @@ -12,6 +12,18 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + void marg8uintin() { } @@ -21,9 +33,9 @@ struct Uniforms { /* 0x0008 */ uint puuuuuuuuuuuuuuuuad1; /* 0x000c */ uint pad2; /* 0x0010 */ packed_float3 bbMin; - /* 0x001c */ int8_t tint_pad[4]; + /* 0x001c */ tint_array tint_pad; /* 0x0020 */ packed_float3 bbMax; - /* 0x002c */ int8_t tint_pad_1[4]; + /* 0x002c */ tint_array tint_pad_1; }; struct Dbg { @@ -42,23 +54,23 @@ struct Dbg { }; struct F32s { - /* 0x0000 */ float values[1]; + /* 0x0000 */ tint_array values; }; struct U32s { - /* 0x0000 */ uint values[1]; + /* 0x0000 */ tint_array values; }; struct I32s { - int values[1]; + tint_array values; }; struct AU32s { - /* 0x0000 */ atomic_uint values[1]; + /* 0x0000 */ tint_array values; }; struct AI32s { - /* 0x0000 */ atomic_int values[1]; + /* 0x0000 */ tint_array values; }; float3 toVoxelPos(float3 position, const constant Uniforms* const tint_symbol) { diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.spvasm b/test/tint/bug/chromium/1273230.wgsl.expected.spvasm index 71068d20c3..8a5f8fb0a4 100644 --- a/test/tint/bug/chromium/1273230.wgsl.expected.spvasm +++ b/test/tint/bug/chromium/1273230.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 277 +; Bound: 273 ; Schema: 0 OpCapability Shader - %71 = OpExtInstImport "GLSL.std.450" + %67 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1 OpExecutionMode %main_count LocalSize 128 1 1 @@ -165,37 +165,33 @@ %dbg = OpVariable %_ptr_StorageBuffer_Dbg StorageBuffer %void = OpTypeVoid %30 = OpTypeFunction %void - %int_0 = OpConstant %int 0 - %v4float = OpTypeVector %float 4 - %float_2 = OpConstant %float 2 - %37 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 - %38 = OpTypeFunction %v3float %v3float + %34 = OpTypeFunction %v3float %v3float %uint_4 = OpConstant %uint 4 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_float = OpTypePointer Uniform %float %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %_ptr_Function_v3float = OpTypePointer Function %v3float - %56 = OpConstantNull %v3float + %52 = OpConstantNull %v3float %uint_5 = OpConstant %uint 5 %_ptr_Function_float = OpTypePointer Function %float - %81 = OpConstantNull %float + %77 = OpConstantNull %float %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %118 = OpTypeFunction %uint %uint %v3float + %114 = OpTypeFunction %uint %uint %v3float %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %126 = OpConstantNull %v3uint + %122 = OpConstantNull %v3uint %_ptr_Function_uint = OpTypePointer Function %uint - %139 = OpTypeFunction %v3uint %uint %uint - %147 = OpConstantNull %uint - %160 = OpTypeFunction %v3float %uint + %135 = OpTypeFunction %v3uint %uint %uint + %143 = OpConstantNull %uint + %156 = OpTypeFunction %v3float %uint %uint_3 = OpConstant %uint 3 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %188 = OpConstantNull %int %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Function_int = OpTypePointer Function %int - %207 = OpConstantNull %int - %208 = OpTypeFunction %void %v3uint + %204 = OpTypeFunction %void %v3uint %bool = OpTypeBool %float_3 = OpConstant %float 3 %int_1 = OpConstant %int 1 @@ -203,255 +199,255 @@ %33 = OpLabel OpReturn OpFunctionEnd - %toVoxelPos = OpFunction %v3float None %38 + %toVoxelPos = OpFunction %v3float None %34 %position = OpFunctionParameter %v3float - %41 = OpLabel - %bbMin = OpVariable %_ptr_Function_v3float Function %56 - %bbMax = OpVariable %_ptr_Function_v3float Function %56 - %bbSize = OpVariable %_ptr_Function_v3float Function %56 - %cubeSize = OpVariable %_ptr_Function_float Function %81 - %gridSize = OpVariable %_ptr_Function_float Function %81 - %gx = OpVariable %_ptr_Function_float Function %81 - %gy = OpVariable %_ptr_Function_float Function %81 - %gz = OpVariable %_ptr_Function_float Function %81 - %45 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 - %46 = OpLoad %float %45 - %48 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 - %49 = OpLoad %float %48 - %51 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 - %52 = OpLoad %float %51 - %53 = OpCompositeConstruct %v3float %46 %49 %52 - OpStore %bbMin %53 - %58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_0 + %37 = OpLabel + %bbMin = OpVariable %_ptr_Function_v3float Function %52 + %bbMax = OpVariable %_ptr_Function_v3float Function %52 + %bbSize = OpVariable %_ptr_Function_v3float Function %52 + %cubeSize = OpVariable %_ptr_Function_float Function %77 + %gridSize = OpVariable %_ptr_Function_float Function %77 + %gx = OpVariable %_ptr_Function_float Function %77 + %gy = OpVariable %_ptr_Function_float Function %77 + %gz = OpVariable %_ptr_Function_float Function %77 + %41 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 + %48 = OpLoad %float %47 + %49 = OpCompositeConstruct %v3float %42 %45 %48 + OpStore %bbMin %49 + %54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_1 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_2 %59 = OpLoad %float %58 - %60 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_1 - %61 = OpLoad %float %60 - %62 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_2 - %63 = OpLoad %float %62 - %64 = OpCompositeConstruct %v3float %59 %61 %63 - OpStore %bbMax %64 - %66 = OpLoad %v3float %bbMin - %67 = OpLoad %v3float %bbMin - %68 = OpFSub %v3float %66 %67 - OpStore %bbSize %68 - %74 = OpAccessChain %_ptr_Function_float %bbMax %uint_0 + %60 = OpCompositeConstruct %v3float %55 %57 %59 + OpStore %bbMax %60 + %62 = OpLoad %v3float %bbMin + %63 = OpLoad %v3float %bbMin + %64 = OpFSub %v3float %62 %63 + OpStore %bbSize %64 + %70 = OpAccessChain %_ptr_Function_float %bbMax %uint_0 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Function_float %bbMax %uint_1 + %73 = OpLoad %float %72 + %68 = OpExtInst %float %67 NMax %71 %73 + %74 = OpAccessChain %_ptr_Function_float %bbSize %uint_2 %75 = OpLoad %float %74 - %76 = OpAccessChain %_ptr_Function_float %bbMax %uint_1 - %77 = OpLoad %float %76 - %72 = OpExtInst %float %71 NMax %75 %77 - %78 = OpAccessChain %_ptr_Function_float %bbSize %uint_2 - %79 = OpLoad %float %78 - %70 = OpExtInst %float %71 NMax %72 %79 - OpStore %cubeSize %70 - %84 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %85 = OpLoad %uint %84 - %82 = OpConvertUToF %float %85 - OpStore %gridSize %82 - %87 = OpLoad %float %cubeSize - %88 = OpCompositeExtract %float %position 0 - %89 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 - %90 = OpLoad %float %89 - %91 = OpFSub %float %88 %90 - %92 = OpFMul %float %87 %91 - %93 = OpLoad %float %cubeSize - %94 = OpFDiv %float %92 %93 - OpStore %gx %94 - %96 = OpLoad %float %gx - %97 = OpCompositeExtract %float %position 1 - %98 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 - %99 = OpLoad %float %98 - %100 = OpFSub %float %97 %99 - %101 = OpFMul %float %96 %100 - %102 = OpLoad %float %gridSize - %103 = OpFDiv %float %101 %102 - OpStore %gy %103 - %105 = OpLoad %float %gridSize - %106 = OpCompositeExtract %float %position 2 - %107 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 - %108 = OpLoad %float %107 - %109 = OpFSub %float %106 %108 - %110 = OpFMul %float %105 %109 - %111 = OpLoad %float %gridSize - %112 = OpFDiv %float %110 %111 - OpStore %gz %112 - %114 = OpLoad %float %gz - %115 = OpLoad %float %gz - %116 = OpLoad %float %gz - %117 = OpCompositeConstruct %v3float %114 %115 %116 - OpReturnValue %117 + %66 = OpExtInst %float %67 NMax %68 %75 + OpStore %cubeSize %66 + %80 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %81 = OpLoad %uint %80 + %78 = OpConvertUToF %float %81 + OpStore %gridSize %78 + %83 = OpLoad %float %cubeSize + %84 = OpCompositeExtract %float %position 0 + %85 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 + %86 = OpLoad %float %85 + %87 = OpFSub %float %84 %86 + %88 = OpFMul %float %83 %87 + %89 = OpLoad %float %cubeSize + %90 = OpFDiv %float %88 %89 + OpStore %gx %90 + %92 = OpLoad %float %gx + %93 = OpCompositeExtract %float %position 1 + %94 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 + %95 = OpLoad %float %94 + %96 = OpFSub %float %93 %95 + %97 = OpFMul %float %92 %96 + %98 = OpLoad %float %gridSize + %99 = OpFDiv %float %97 %98 + OpStore %gy %99 + %101 = OpLoad %float %gridSize + %102 = OpCompositeExtract %float %position 2 + %103 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 + %104 = OpLoad %float %103 + %105 = OpFSub %float %102 %104 + %106 = OpFMul %float %101 %105 + %107 = OpLoad %float %gridSize + %108 = OpFDiv %float %106 %107 + OpStore %gz %108 + %110 = OpLoad %float %gz + %111 = OpLoad %float %gz + %112 = OpLoad %float %gz + %113 = OpCompositeConstruct %v3float %110 %111 %112 + OpReturnValue %113 OpFunctionEnd - %toIndex1D = OpFunction %uint None %118 + %toIndex1D = OpFunction %uint None %114 %gridSize_0 = OpFunctionParameter %uint %voxelPos = OpFunctionParameter %v3float - %122 = OpLabel - %icoord = OpVariable %_ptr_Function_v3uint Function %126 - %123 = OpConvertFToU %v3uint %voxelPos - OpStore %icoord %123 - %128 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 - %129 = OpLoad %uint %128 - %130 = OpAccessChain %_ptr_Function_uint %icoord %uint_1 - %131 = OpLoad %uint %130 - %132 = OpIMul %uint %gridSize_0 %131 - %133 = OpIAdd %uint %129 %132 - %134 = OpIMul %uint %gridSize_0 %gridSize_0 - %135 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 - %136 = OpLoad %uint %135 - %137 = OpIMul %uint %134 %136 - %138 = OpIAdd %uint %133 %137 - OpReturnValue %138 + %118 = OpLabel + %icoord = OpVariable %_ptr_Function_v3uint Function %122 + %119 = OpConvertFToU %v3uint %voxelPos + OpStore %icoord %119 + %124 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 + %125 = OpLoad %uint %124 + %126 = OpAccessChain %_ptr_Function_uint %icoord %uint_1 + %127 = OpLoad %uint %126 + %128 = OpIMul %uint %gridSize_0 %127 + %129 = OpIAdd %uint %125 %128 + %130 = OpIMul %uint %gridSize_0 %gridSize_0 + %131 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 + %132 = OpLoad %uint %131 + %133 = OpIMul %uint %130 %132 + %134 = OpIAdd %uint %129 %133 + OpReturnValue %134 OpFunctionEnd - %toIndex4D = OpFunction %v3uint None %139 + %toIndex4D = OpFunction %v3uint None %135 %gridSize_1 = OpFunctionParameter %uint %index = OpFunctionParameter %uint - %143 = OpLabel - %z = OpVariable %_ptr_Function_uint Function %147 - %y = OpVariable %_ptr_Function_uint Function %147 - %x = OpVariable %_ptr_Function_uint Function %147 - %144 = OpIMul %uint %index %index - %145 = OpUDiv %uint %gridSize_1 %144 - OpStore %z %145 - %148 = OpIMul %uint %gridSize_1 %gridSize_1 - %149 = OpLoad %uint %z - %150 = OpIMul %uint %148 %149 - %151 = OpISub %uint %gridSize_1 %150 - %152 = OpUDiv %uint %151 %gridSize_1 - OpStore %y %152 - %154 = OpUMod %uint %index %gridSize_1 - OpStore %x %154 - %156 = OpLoad %uint %z - %157 = OpLoad %uint %y - %158 = OpLoad %uint %y - %159 = OpCompositeConstruct %v3uint %156 %157 %158 - OpReturnValue %159 + %139 = OpLabel + %z = OpVariable %_ptr_Function_uint Function %143 + %y = OpVariable %_ptr_Function_uint Function %143 + %x = OpVariable %_ptr_Function_uint Function %143 + %140 = OpIMul %uint %index %index + %141 = OpUDiv %uint %gridSize_1 %140 + OpStore %z %141 + %144 = OpIMul %uint %gridSize_1 %gridSize_1 + %145 = OpLoad %uint %z + %146 = OpIMul %uint %144 %145 + %147 = OpISub %uint %gridSize_1 %146 + %148 = OpUDiv %uint %147 %gridSize_1 + OpStore %y %148 + %150 = OpUMod %uint %index %gridSize_1 + OpStore %x %150 + %152 = OpLoad %uint %z + %153 = OpLoad %uint %y + %154 = OpLoad %uint %y + %155 = OpCompositeConstruct %v3uint %152 %153 %154 + OpReturnValue %155 OpFunctionEnd -%loadPosition = OpFunction %v3float None %160 +%loadPosition = OpFunction %v3float None %156 %vertexIndex = OpFunctionParameter %uint - %163 = OpLabel - %position_0 = OpVariable %_ptr_Function_v3float Function %56 - %165 = OpIMul %uint %uint_3 %vertexIndex - %166 = OpIAdd %uint %165 %uint_0 - %168 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %166 + %159 = OpLabel + %position_0 = OpVariable %_ptr_Function_v3float Function %52 + %161 = OpIMul %uint %uint_3 %vertexIndex + %162 = OpIAdd %uint %161 %143 + %164 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %162 + %165 = OpLoad %float %164 + %166 = OpIMul %uint %uint_3 %vertexIndex + %167 = OpIAdd %uint %166 %uint_1 + %168 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %167 %169 = OpLoad %float %168 %170 = OpIMul %uint %uint_3 %vertexIndex - %171 = OpIAdd %uint %170 %uint_1 + %171 = OpIAdd %uint %170 %uint_2 %172 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %171 %173 = OpLoad %float %172 - %174 = OpIMul %uint %uint_3 %vertexIndex - %175 = OpIAdd %uint %174 %uint_2 - %176 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %175 - %177 = OpLoad %float %176 - %178 = OpCompositeConstruct %v3float %169 %173 %177 - OpStore %position_0 %178 - %180 = OpLoad %v3float %position_0 - OpReturnValue %180 + %174 = OpCompositeConstruct %v3float %165 %169 %173 + OpStore %position_0 %174 + %176 = OpLoad %v3float %position_0 + OpReturnValue %176 OpFunctionEnd %doIgnore = OpFunction %void None %30 - %182 = OpLabel - %g43 = OpVariable %_ptr_Function_uint Function %147 - %kj6 = OpVariable %_ptr_Function_uint Function %147 - %b53 = OpVariable %_ptr_Function_uint Function %147 - %rwg = OpVariable %_ptr_Function_uint Function %147 - %rb5 = OpVariable %_ptr_Function_float Function %81 - %g55 = OpVariable %_ptr_Function_int Function %207 - %183 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %178 = OpLabel + %g43 = OpVariable %_ptr_Function_uint Function %143 + %kj6 = OpVariable %_ptr_Function_uint Function %143 + %b53 = OpVariable %_ptr_Function_uint Function %143 + %rwg = OpVariable %_ptr_Function_uint Function %143 + %rb5 = OpVariable %_ptr_Function_float Function %77 + %g55 = OpVariable %_ptr_Function_int Function %188 + %179 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %180 = OpLoad %uint %179 + OpStore %g43 %180 + %183 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_5 %184 = OpLoad %uint %183 - OpStore %g43 %184 - %187 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_5 - %188 = OpLoad %uint %187 - OpStore %kj6 %188 - %193 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %int_0 - %190 = OpAtomicLoad %uint %193 %uint_1 %uint_0 - OpStore %b53 %190 - %195 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %int_0 - %196 = OpLoad %uint %195 - OpStore %rwg %196 - %198 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %int_0 - %199 = OpLoad %float %198 - OpStore %rb5 %199 - %204 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %int_0 - %201 = OpAtomicLoad %int %204 %uint_1 %uint_0 - OpStore %g55 %201 + OpStore %kj6 %184 + %190 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %188 + %186 = OpAtomicLoad %uint %190 %uint_1 %uint_0 + OpStore %b53 %186 + %192 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %188 + %193 = OpLoad %uint %192 + OpStore %rwg %193 + %195 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %188 + %196 = OpLoad %float %195 + OpStore %rb5 %196 + %201 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %188 + %198 = OpAtomicLoad %int %201 %uint_1 %uint_0 + OpStore %g55 %198 OpReturn OpFunctionEnd -%main_count_inner = OpFunction %void None %208 +%main_count_inner = OpFunction %void None %204 %GlobalInvocationID = OpFunctionParameter %v3uint - %211 = OpLabel -%triangleIndex = OpVariable %_ptr_Function_uint Function %147 - %i0 = OpVariable %_ptr_Function_uint Function %147 - %i1 = OpVariable %_ptr_Function_uint Function %147 - %i2 = OpVariable %_ptr_Function_uint Function %147 - %p0 = OpVariable %_ptr_Function_v3float Function %56 - %p1 = OpVariable %_ptr_Function_v3float Function %56 - %p2 = OpVariable %_ptr_Function_v3float Function %56 - %256 = OpVariable %_ptr_Function_v3float Function %56 - %center = OpVariable %_ptr_Function_v3float Function %56 - %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %56 - %lIndex = OpVariable %_ptr_Function_uint Function %147 -%triangleOffset = OpVariable %_ptr_Function_int Function %207 - %212 = OpCompositeExtract %uint %GlobalInvocationID 0 - OpStore %triangleIndex %212 - %214 = OpLoad %uint %triangleIndex - %215 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %216 = OpLoad %uint %215 - %217 = OpUGreaterThanEqual %bool %214 %216 - OpSelectionMerge %219 None - OpBranchConditional %217 %220 %219 - %220 = OpLabel + %207 = OpLabel +%triangleIndex = OpVariable %_ptr_Function_uint Function %143 + %i0 = OpVariable %_ptr_Function_uint Function %143 + %i1 = OpVariable %_ptr_Function_uint Function %143 + %i2 = OpVariable %_ptr_Function_uint Function %143 + %p0 = OpVariable %_ptr_Function_v3float Function %52 + %p1 = OpVariable %_ptr_Function_v3float Function %52 + %p2 = OpVariable %_ptr_Function_v3float Function %52 + %252 = OpVariable %_ptr_Function_v3float Function %52 + %center = OpVariable %_ptr_Function_v3float Function %52 + %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %52 + %lIndex = OpVariable %_ptr_Function_uint Function %143 +%triangleOffset = OpVariable %_ptr_Function_int Function %188 + %208 = OpCompositeExtract %uint %GlobalInvocationID 0 + OpStore %triangleIndex %208 + %210 = OpLoad %uint %triangleIndex + %211 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %212 = OpLoad %uint %211 + %213 = OpUGreaterThanEqual %bool %210 %212 + OpSelectionMerge %215 None + OpBranchConditional %213 %216 %215 + %216 = OpLabel OpReturn - %219 = OpLabel - %221 = OpFunctionCall %void %doIgnore - %222 = OpLoad %uint %triangleIndex - %223 = OpIMul %uint %uint_3 %222 - %224 = OpIAdd %uint %223 %uint_0 - %225 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %224 - %226 = OpLoad %uint %225 - OpStore %i0 %226 - %228 = OpLoad %uint %i0 - %229 = OpIMul %uint %uint_3 %228 - %230 = OpIAdd %uint %229 %uint_1 - %231 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %230 - %232 = OpLoad %uint %231 - OpStore %i1 %232 - %234 = OpLoad %uint %i0 - %235 = OpIMul %uint %uint_3 %234 - %236 = OpIAdd %uint %235 %uint_2 - %237 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %236 - %238 = OpLoad %uint %237 - OpStore %i2 %238 - %241 = OpLoad %uint %i0 - %240 = OpFunctionCall %v3float %loadPosition %241 - OpStore %p0 %240 - %244 = OpLoad %uint %i0 - %243 = OpFunctionCall %v3float %loadPosition %244 - OpStore %p1 %243 - %247 = OpLoad %uint %i2 - %246 = OpFunctionCall %v3float %loadPosition %247 - OpStore %p2 %246 - %249 = OpLoad %v3float %p0 - %250 = OpLoad %v3float %p2 - %251 = OpFAdd %v3float %249 %250 - %252 = OpLoad %v3float %p1 - %253 = OpFAdd %v3float %251 %252 - %257 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 - %255 = OpFDiv %v3float %253 %257 - OpStore %center %255 - %260 = OpLoad %v3float %p1 - %259 = OpFunctionCall %v3float %toVoxelPos %260 - OpStore %voxelPos_0 %259 - %263 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %264 = OpLoad %uint %263 - %265 = OpLoad %v3float %p0 - %262 = OpFunctionCall %uint %toIndex1D %264 %265 - OpStore %lIndex %262 - %269 = OpLoad %uint %i1 - %270 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %269 - %267 = OpAtomicIAdd %int %270 %uint_1 %uint_0 %int_1 - OpStore %triangleOffset %267 + %215 = OpLabel + %217 = OpFunctionCall %void %doIgnore + %218 = OpLoad %uint %triangleIndex + %219 = OpIMul %uint %uint_3 %218 + %220 = OpIAdd %uint %219 %143 + %221 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %220 + %222 = OpLoad %uint %221 + OpStore %i0 %222 + %224 = OpLoad %uint %i0 + %225 = OpIMul %uint %uint_3 %224 + %226 = OpIAdd %uint %225 %uint_1 + %227 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %226 + %228 = OpLoad %uint %227 + OpStore %i1 %228 + %230 = OpLoad %uint %i0 + %231 = OpIMul %uint %uint_3 %230 + %232 = OpIAdd %uint %231 %uint_2 + %233 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %232 + %234 = OpLoad %uint %233 + OpStore %i2 %234 + %237 = OpLoad %uint %i0 + %236 = OpFunctionCall %v3float %loadPosition %237 + OpStore %p0 %236 + %240 = OpLoad %uint %i0 + %239 = OpFunctionCall %v3float %loadPosition %240 + OpStore %p1 %239 + %243 = OpLoad %uint %i2 + %242 = OpFunctionCall %v3float %loadPosition %243 + OpStore %p2 %242 + %245 = OpLoad %v3float %p0 + %246 = OpLoad %v3float %p2 + %247 = OpFAdd %v3float %245 %246 + %248 = OpLoad %v3float %p1 + %249 = OpFAdd %v3float %247 %248 + %253 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 + %251 = OpFDiv %v3float %249 %253 + OpStore %center %251 + %256 = OpLoad %v3float %p1 + %255 = OpFunctionCall %v3float %toVoxelPos %256 + OpStore %voxelPos_0 %255 + %259 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %260 = OpLoad %uint %259 + %261 = OpLoad %v3float %p0 + %258 = OpFunctionCall %uint %toIndex1D %260 %261 + OpStore %lIndex %258 + %265 = OpLoad %uint %i1 + %266 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %265 + %263 = OpAtomicIAdd %int %266 %uint_1 %uint_0 %int_1 + OpStore %triangleOffset %263 OpReturn OpFunctionEnd %main_count = OpFunction %void None %30 - %274 = OpLabel - %276 = OpLoad %v3uint %GlobalInvocationID_1 - %275 = OpFunctionCall %void %main_count_inner %276 + %270 = OpLabel + %272 = OpLoad %v3uint %GlobalInvocationID_1 + %271 = OpFunctionCall %void %main_count_inner %272 OpReturn OpFunctionEnd diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.wgsl b/test/tint/bug/chromium/1273230.wgsl.expected.wgsl index 165ae07139..80a32cdc95 100644 --- a/test/tint/bug/chromium/1273230.wgsl.expected.wgsl +++ b/test/tint/bug/chromium/1273230.wgsl.expected.wgsl @@ -98,7 +98,7 @@ fn doIgnore() { var g55 = atomicLoad(&(LUT.values[0])); } -@stage(compute) @workgroup_size(128) +@compute @workgroup_size(128) fn main_count(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var triangleIndex = GlobalInvocationID.x; if ((triangleIndex >= uniforms.numTriangles)) { diff --git a/test/tint/bug/chromium/1273451.wgsl.expected.hlsl b/test/tint/bug/chromium/1273451.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/chromium/1273451.wgsl.expected.hlsl rename to test/tint/bug/chromium/1273451.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/chromium/1273451.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1273451.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dddd92f31b --- /dev/null +++ b/test/tint/bug/chromium/1273451.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct A { + int a; +}; +struct B { + int b; +}; + +B f(A a) { + const B tint_symbol = (B)0; + return tint_symbol; +} diff --git a/test/tint/bug/chromium/1273451.wgsl.expected.msl b/test/tint/bug/chromium/1273451.wgsl.expected.msl index 5510459868..4b803a96c7 100644 --- a/test/tint/bug/chromium/1273451.wgsl.expected.msl +++ b/test/tint/bug/chromium/1273451.wgsl.expected.msl @@ -10,7 +10,7 @@ struct B { }; B f(A a) { - B const tint_symbol = {}; + B const tint_symbol = B{}; return tint_symbol; } diff --git a/test/tint/bug/chromium/1290107.wgsl b/test/tint/bug/chromium/1290107.wgsl index 22899ad08b..de69aad725 100644 --- a/test/tint/bug/chromium/1290107.wgsl +++ b/test/tint/bug/chromium/1290107.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var arr : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let len = arrayLength(&arr); } diff --git a/test/tint/bug/chromium/1290107.wgsl.expected.hlsl b/test/tint/bug/chromium/1290107.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/chromium/1290107.wgsl.expected.hlsl rename to test/tint/bug/chromium/1290107.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/chromium/1290107.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1290107.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95e8cb7e13 --- /dev/null +++ b/test/tint/bug/chromium/1290107.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +ByteAddressBuffer arr : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + arr.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = (tint_symbol_1 / 4u); + const uint len = tint_symbol_2; + return; +} diff --git a/test/tint/bug/chromium/1290107.wgsl.expected.msl b/test/tint/bug/chromium/1290107.wgsl.expected.msl index 5b9d426d79..de7b6e3c9d 100644 --- a/test/tint/bug/chromium/1290107.wgsl.expected.msl +++ b/test/tint/bug/chromium/1290107.wgsl.expected.msl @@ -1,8 +1,21 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; struct S { diff --git a/test/tint/bug/chromium/1290107.wgsl.expected.wgsl b/test/tint/bug/chromium/1290107.wgsl.expected.wgsl index 99d1abba51..24eb88f491 100644 --- a/test/tint/bug/chromium/1290107.wgsl.expected.wgsl +++ b/test/tint/bug/chromium/1290107.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var arr : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let len = arrayLength(&(arr)); } diff --git a/test/tint/bug/chromium/1341475.wgsl b/test/tint/bug/chromium/1341475.wgsl new file mode 100644 index 0000000000..5d5aef68e7 --- /dev/null +++ b/test/tint/bug/chromium/1341475.wgsl @@ -0,0 +1,4 @@ +@compute @workgroup_size(1) +fn main() { + let a = mix(1.0, vec2(1.0).y, 1.0); +} diff --git a/test/tint/bug/chromium/1341475.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/1341475.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e897714728 --- /dev/null +++ b/test/tint/bug/chromium/1341475.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void main() { + const float a = lerp(1.0f, 1.0f, 1.0f); + return; +} diff --git a/test/tint/bug/chromium/1341475.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1341475.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e897714728 --- /dev/null +++ b/test/tint/bug/chromium/1341475.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void main() { + const float a = lerp(1.0f, 1.0f, 1.0f); + return; +} diff --git a/test/tint/bug/chromium/1341475.wgsl.expected.glsl b/test/tint/bug/chromium/1341475.wgsl.expected.glsl new file mode 100644 index 0000000000..641a2bde3e --- /dev/null +++ b/test/tint/bug/chromium/1341475.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +void tint_symbol() { + float a = mix(1.0f, 1.0f, 1.0f); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/bug/chromium/1341475.wgsl.expected.msl b/test/tint/bug/chromium/1341475.wgsl.expected.msl new file mode 100644 index 0000000000..4591847722 --- /dev/null +++ b/test/tint/bug/chromium/1341475.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +kernel void tint_symbol() { + float const a = mix(1.0f, 1.0f, 1.0f); + return; +} + diff --git a/test/tint/bug/chromium/1341475.wgsl.expected.spvasm b/test/tint/bug/chromium/1341475.wgsl.expected.spvasm new file mode 100644 index 0000000000..784c1dec9c --- /dev/null +++ b/test/tint/bug/chromium/1341475.wgsl.expected.spvasm @@ -0,0 +1,20 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + %7 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %1 + %4 = OpLabel + %5 = OpExtInst %float %7 FMix %float_1 %float_1 %float_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/chromium/1341475.wgsl.expected.wgsl b/test/tint/bug/chromium/1341475.wgsl.expected.wgsl new file mode 100644 index 0000000000..770d94d7bc --- /dev/null +++ b/test/tint/bug/chromium/1341475.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +@compute @workgroup_size(1) +fn main() { + let a = mix(1.0, vec2(1.0).y, 1.0); +} diff --git a/test/tint/bug/chromium/1343242.wgsl b/test/tint/bug/chromium/1343242.wgsl new file mode 100644 index 0000000000..5b73ca26c2 --- /dev/null +++ b/test/tint/bug/chromium/1343242.wgsl @@ -0,0 +1 @@ +varo=bool(~1); diff --git a/test/tint/bug/chromium/1343242.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/1343242.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e2052cfedd --- /dev/null +++ b/test/tint/bug/chromium/1343242.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool o = true; diff --git a/test/tint/bug/chromium/1343242.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1343242.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e2052cfedd --- /dev/null +++ b/test/tint/bug/chromium/1343242.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool o = true; diff --git a/test/tint/bug/chromium/1343242.wgsl.expected.glsl b/test/tint/bug/chromium/1343242.wgsl.expected.glsl new file mode 100644 index 0000000000..9e7842669e --- /dev/null +++ b/test/tint/bug/chromium/1343242.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool o = true; diff --git a/test/tint/bug/chromium/1343242.wgsl.expected.msl b/test/tint/bug/chromium/1343242.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/bug/chromium/1343242.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/bug/chromium/1343242.wgsl.expected.spvasm b/test/tint/bug/chromium/1343242.wgsl.expected.spvasm new file mode 100644 index 0000000000..a36ea73b84 --- /dev/null +++ b/test/tint/bug/chromium/1343242.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %o "o" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_bool = OpTypePointer Private %bool + %o = OpVariable %_ptr_Private_bool Private %true + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/chromium/1343242.wgsl.expected.wgsl b/test/tint/bug/chromium/1343242.wgsl.expected.wgsl new file mode 100644 index 0000000000..0580ed8e71 --- /dev/null +++ b/test/tint/bug/chromium/1343242.wgsl.expected.wgsl @@ -0,0 +1 @@ +var o = bool(~(1)); diff --git a/test/tint/bug/chromium/1345468.wgsl b/test/tint/bug/chromium/1345468.wgsl new file mode 100644 index 0000000000..97369e9b89 --- /dev/null +++ b/test/tint/bug/chromium/1345468.wgsl @@ -0,0 +1,8 @@ + +fn f(){ + const m = mat4x2(0, 0, 0, 0, 4., 0, 0, 0); // abstract matrix + const v = vec2(0, 1); // abstract vector + var i = 1; // runtime-evaluated index + var a = m[i]; // materialize m before index + var b = v[i]; // materialize v before index +} diff --git a/test/tint/bug/chromium/1345468.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/1345468.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b3556b9f5 --- /dev/null +++ b/test/tint/bug/chromium/1345468.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int i = 1; + float2 a = float4x2((0.0f).xx, (0.0f).xx, float2(4.0f, 0.0f), (0.0f).xx)[i]; + int b = int2(0, 1)[i]; +} diff --git a/test/tint/bug/chromium/1345468.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1345468.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b3556b9f5 --- /dev/null +++ b/test/tint/bug/chromium/1345468.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int i = 1; + float2 a = float4x2((0.0f).xx, (0.0f).xx, float2(4.0f, 0.0f), (0.0f).xx)[i]; + int b = int2(0, 1)[i]; +} diff --git a/test/tint/bug/chromium/1345468.wgsl.expected.glsl b/test/tint/bug/chromium/1345468.wgsl.expected.glsl new file mode 100644 index 0000000000..e915c629c0 --- /dev/null +++ b/test/tint/bug/chromium/1345468.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + int i = 1; + vec2 a = mat4x2(vec2(0.0f), vec2(0.0f), vec2(4.0f, 0.0f), vec2(0.0f))[i]; + int b = ivec2(0, 1)[i]; +} + diff --git a/test/tint/bug/chromium/1345468.wgsl.expected.msl b/test/tint/bug/chromium/1345468.wgsl.expected.msl new file mode 100644 index 0000000000..c0c1a74021 --- /dev/null +++ b/test/tint/bug/chromium/1345468.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + int i = 1; + float2 a = float4x2(float2(0.0f), float2(0.0f), float2(4.0f, 0.0f), float2(0.0f))[i]; + int b = int2(0, 1)[i]; +} + diff --git a/test/tint/bug/chromium/1345468.wgsl.expected.spvasm b/test/tint/bug/chromium/1345468.wgsl.expected.spvasm new file mode 100644 index 0000000000..17453d9e34 --- /dev/null +++ b/test/tint/bug/chromium/1345468.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %i "i" + OpName %var_for_index "var_for_index" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %11 = OpConstantNull %int + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %15 = OpConstantNull %v2float + %float_4 = OpConstant %float 4 + %17 = OpConstantNull %float + %18 = OpConstantComposite %v2float %float_4 %17 + %19 = OpConstantComposite %mat4v2float %15 %15 %18 %15 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %22 = OpConstantNull %mat4v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v2int = OpTypeVector %int 2 + %29 = OpConstantComposite %v2int %11 %int_1 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %i = OpVariable %_ptr_Function_int Function %11 +%var_for_index = OpVariable %_ptr_Function_mat4v2float Function %22 + %a = OpVariable %_ptr_Function_v2float Function %15 + %b = OpVariable %_ptr_Function_int Function %11 + OpStore %i %int_1 + OpStore %var_for_index %19 + %23 = OpLoad %int %i + %25 = OpAccessChain %_ptr_Function_v2float %var_for_index %23 + %26 = OpLoad %v2float %25 + OpStore %a %26 + %30 = OpLoad %int %i + %31 = OpVectorExtractDynamic %int %29 %30 + OpStore %b %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/chromium/1345468.wgsl.expected.wgsl b/test/tint/bug/chromium/1345468.wgsl.expected.wgsl new file mode 100644 index 0000000000..014a19b495 --- /dev/null +++ b/test/tint/bug/chromium/1345468.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +fn f() { + const m = mat4x2(0, 0, 0, 0, 4.0, 0, 0, 0); + const v = vec2(0, 1); + var i = 1; + var a = m[i]; + var b = v[i]; +} diff --git a/test/tint/bug/chromium/1350147.wgsl b/test/tint/bug/chromium/1350147.wgsl new file mode 100644 index 0000000000..a2a289a71f --- /dev/null +++ b/test/tint/bug/chromium/1350147.wgsl @@ -0,0 +1,25 @@ +fn original_clusterfuzz_code() { + atan2(1,.1); +} + +fn more_tests_that_would_fail() { + // Builtin calls with mixed abstract args would fail because AInt would not materialize to AFloat. + { + let a = atan2(1, 0.1); + let b = atan2(0.1, 1); + } + + // Same for binary operators + { + let a = 1 + 1.5; + let b = 1.5 + 1; + } + + // Once above was fixed, builtin calls without assignment would also fail in backends because + // abstract constant value is not handled by backends. These should be removed by RemovePhonies + // transform. + { + atan2(1, 0.1); + atan2(0.1, 1); + } +} diff --git a/test/tint/bug/chromium/1350147.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/1350147.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d6d05621d --- /dev/null +++ b/test/tint/bug/chromium/1350147.wgsl.expected.dxc.hlsl @@ -0,0 +1,20 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void original_clusterfuzz_code() { +} + +void more_tests_that_would_fail() { + { + const float a = 1.471127629f; + const float b = 0.099668652f; + } + { + const float a = 2.5f; + const float b = 2.5f; + } + { + } +} diff --git a/test/tint/bug/chromium/1350147.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1350147.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d6d05621d --- /dev/null +++ b/test/tint/bug/chromium/1350147.wgsl.expected.fxc.hlsl @@ -0,0 +1,20 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void original_clusterfuzz_code() { +} + +void more_tests_that_would_fail() { + { + const float a = 1.471127629f; + const float b = 0.099668652f; + } + { + const float a = 2.5f; + const float b = 2.5f; + } + { + } +} diff --git a/test/tint/bug/chromium/1350147.wgsl.expected.glsl b/test/tint/bug/chromium/1350147.wgsl.expected.glsl new file mode 100644 index 0000000000..0b8a55cc22 --- /dev/null +++ b/test/tint/bug/chromium/1350147.wgsl.expected.glsl @@ -0,0 +1,22 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void original_clusterfuzz_code() { +} + +void more_tests_that_would_fail() { + { + float a = 1.471127629f; + float b = 0.099668652f; + } + { + float a = 2.5f; + float b = 2.5f; + } + { + } +} + diff --git a/test/tint/bug/chromium/1350147.wgsl.expected.msl b/test/tint/bug/chromium/1350147.wgsl.expected.msl new file mode 100644 index 0000000000..9c6dde8f31 --- /dev/null +++ b/test/tint/bug/chromium/1350147.wgsl.expected.msl @@ -0,0 +1,19 @@ +#include + +using namespace metal; +void original_clusterfuzz_code() { +} + +void more_tests_that_would_fail() { + { + float const a = 1.471127629f; + float const b = 0.099668652f; + } + { + float const a = 2.5f; + float const b = 2.5f; + } + { + } +} + diff --git a/test/tint/bug/chromium/1350147.wgsl.expected.spvasm b/test/tint/bug/chromium/1350147.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b29287b63 --- /dev/null +++ b/test/tint/bug/chromium/1350147.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %original_clusterfuzz_code "original_clusterfuzz_code" + OpName %more_tests_that_would_fail "more_tests_that_would_fail" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 +%float_1_47112763 = OpConstant %float 1.47112763 +%float_0_0996686518 = OpConstant %float 0.0996686518 + %float_2_5 = OpConstant %float 2.5 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd +%original_clusterfuzz_code = OpFunction %void None %1 + %6 = OpLabel + OpReturn + OpFunctionEnd +%more_tests_that_would_fail = OpFunction %void None %1 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/chromium/1350147.wgsl.expected.wgsl b/test/tint/bug/chromium/1350147.wgsl.expected.wgsl new file mode 100644 index 0000000000..03763dba48 --- /dev/null +++ b/test/tint/bug/chromium/1350147.wgsl.expected.wgsl @@ -0,0 +1,18 @@ +fn original_clusterfuzz_code() { + atan2(1, 0.100000001); +} + +fn more_tests_that_would_fail() { + { + let a = atan2(1, 0.100000001); + let b = atan2(0.100000001, 1); + } + { + let a = (1 + 1.5); + let b = (1.5 + 1); + } + { + atan2(1, 0.100000001); + atan2(0.100000001, 1); + } +} diff --git a/test/tint/bug/dawn/947.wgsl b/test/tint/bug/dawn/947.wgsl index f89542ff94..5c5fa77029 100644 --- a/test/tint/bug/dawn/947.wgsl +++ b/test/tint/bug/dawn/947.wgsl @@ -9,7 +9,7 @@ struct VertexOutputs { @builtin(position) position : vec4, }; -@stage(vertex) fn vs_main( +@vertex fn vs_main( @builtin(vertex_index) VertexIndex : u32 ) -> VertexOutputs { var texcoord = array, 3>( @@ -46,7 +46,7 @@ struct VertexOutputs { @binding(1) @group(0) var mySampler: sampler; @binding(2) @group(0) var myTexture: texture_2d; -@stage(fragment) fn fs_main( +@fragment fn fs_main( @location(0) texcoord : vec2 ) -> @location(0) vec4 { // Clamp the texcoord and discard the out-of-bound pixels. diff --git a/test/tint/bug/dawn/947.wgsl.expected.dxc.hlsl b/test/tint/bug/dawn/947.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..be587b091d --- /dev/null +++ b/test/tint/bug/dawn/947.wgsl.expected.dxc.hlsl @@ -0,0 +1,86 @@ +bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from uniform control flow + var srcColor = textureSample(myTexture, mySampler, texcoord); + ^^^^^^^^^^^^^ + +bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^ + +bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may result in a non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^^^^^^^ + +cbuffer cbuffer_uniforms : register(b0, space0) { + uint4 uniforms[1]; +}; + +struct VertexOutputs { + float2 texcoords; + float4 position; +}; +struct tint_symbol_1 { + uint VertexIndex : SV_VertexID; +}; +struct tint_symbol_2 { + float2 texcoords : TEXCOORD0; + float4 position : SV_Position; +}; + +VertexOutputs vs_main_inner(uint VertexIndex) { + float2 texcoord[3] = {float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)}; + VertexOutputs output = (VertexOutputs)0; + output.position = float4(((texcoord[VertexIndex] * 2.0f) - (1.0f).xx), 0.0f, 1.0f); + bool flipY = (asfloat(uniforms[0].y) < 0.0f); + if (flipY) { + output.texcoords = ((((texcoord[VertexIndex] * asfloat(uniforms[0].xy)) + asfloat(uniforms[0].zw)) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)); + } else { + output.texcoords = ((((texcoord[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * asfloat(uniforms[0].xy)) + asfloat(uniforms[0].zw)); + } + return output; +} + +tint_symbol_2 vs_main(tint_symbol_1 tint_symbol) { + const VertexOutputs inner_result = vs_main_inner(tint_symbol.VertexIndex); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.texcoords = inner_result.texcoords; + wrapper_result.position = inner_result.position; + return wrapper_result; +} + +SamplerState mySampler : register(s1, space0); +Texture2D myTexture : register(t2, space0); + +struct tint_symbol_4 { + float2 texcoord : TEXCOORD0; +}; +struct tint_symbol_5 { + float4 value : SV_Target0; +}; + +static bool tint_discard = false; + +float4 fs_main_inner(float2 texcoord) { + float2 clampedTexcoord = clamp(texcoord, (0.0f).xx, (1.0f).xx); + if (!(all((clampedTexcoord == texcoord)))) { + tint_discard = true; + return (0.0f).xxxx; + } + float4 srcColor = myTexture.Sample(mySampler, texcoord); + return srcColor; +} + +void tint_discard_func() { + discard; +} + +tint_symbol_5 fs_main(tint_symbol_4 tint_symbol_3) { + const float4 inner_result_1 = fs_main_inner(tint_symbol_3.texcoord); + if (tint_discard) { + tint_discard_func(); + const tint_symbol_5 tint_symbol_8 = (tint_symbol_5)0; + return tint_symbol_8; + } + tint_symbol_5 wrapper_result_1 = (tint_symbol_5)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} diff --git a/test/tint/bug/dawn/947.wgsl.expected.fxc.hlsl b/test/tint/bug/dawn/947.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..be587b091d --- /dev/null +++ b/test/tint/bug/dawn/947.wgsl.expected.fxc.hlsl @@ -0,0 +1,86 @@ +bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from uniform control flow + var srcColor = textureSample(myTexture, mySampler, texcoord); + ^^^^^^^^^^^^^ + +bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^ + +bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may result in a non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^^^^^^^ + +cbuffer cbuffer_uniforms : register(b0, space0) { + uint4 uniforms[1]; +}; + +struct VertexOutputs { + float2 texcoords; + float4 position; +}; +struct tint_symbol_1 { + uint VertexIndex : SV_VertexID; +}; +struct tint_symbol_2 { + float2 texcoords : TEXCOORD0; + float4 position : SV_Position; +}; + +VertexOutputs vs_main_inner(uint VertexIndex) { + float2 texcoord[3] = {float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)}; + VertexOutputs output = (VertexOutputs)0; + output.position = float4(((texcoord[VertexIndex] * 2.0f) - (1.0f).xx), 0.0f, 1.0f); + bool flipY = (asfloat(uniforms[0].y) < 0.0f); + if (flipY) { + output.texcoords = ((((texcoord[VertexIndex] * asfloat(uniforms[0].xy)) + asfloat(uniforms[0].zw)) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)); + } else { + output.texcoords = ((((texcoord[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * asfloat(uniforms[0].xy)) + asfloat(uniforms[0].zw)); + } + return output; +} + +tint_symbol_2 vs_main(tint_symbol_1 tint_symbol) { + const VertexOutputs inner_result = vs_main_inner(tint_symbol.VertexIndex); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.texcoords = inner_result.texcoords; + wrapper_result.position = inner_result.position; + return wrapper_result; +} + +SamplerState mySampler : register(s1, space0); +Texture2D myTexture : register(t2, space0); + +struct tint_symbol_4 { + float2 texcoord : TEXCOORD0; +}; +struct tint_symbol_5 { + float4 value : SV_Target0; +}; + +static bool tint_discard = false; + +float4 fs_main_inner(float2 texcoord) { + float2 clampedTexcoord = clamp(texcoord, (0.0f).xx, (1.0f).xx); + if (!(all((clampedTexcoord == texcoord)))) { + tint_discard = true; + return (0.0f).xxxx; + } + float4 srcColor = myTexture.Sample(mySampler, texcoord); + return srcColor; +} + +void tint_discard_func() { + discard; +} + +tint_symbol_5 fs_main(tint_symbol_4 tint_symbol_3) { + const float4 inner_result_1 = fs_main_inner(tint_symbol_3.texcoord); + if (tint_discard) { + tint_discard_func(); + const tint_symbol_5 tint_symbol_8 = (tint_symbol_5)0; + return tint_symbol_8; + } + tint_symbol_5 wrapper_result_1 = (tint_symbol_5)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} diff --git a/test/tint/bug/dawn/947.wgsl.expected.glsl b/test/tint/bug/dawn/947.wgsl.expected.glsl index 413ee0e635..ce20459b0a 100644 --- a/test/tint/bug/dawn/947.wgsl.expected.glsl +++ b/test/tint/bug/dawn/947.wgsl.expected.glsl @@ -1,3 +1,15 @@ +bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from uniform control flow + var srcColor = textureSample(myTexture, mySampler, texcoord); + ^^^^^^^^^^^^^ + +bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^ + +bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may result in a non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^^^^^^^ + #version 310 es layout(location = 0) out vec2 texcoords_1; @@ -19,7 +31,7 @@ struct VertexOutputs { VertexOutputs vs_main(uint VertexIndex) { vec2 texcoord[3] = vec2[3](vec2(-0.5f, 0.0f), vec2(1.5f, 0.0f), vec2(0.5f, 2.0f)); VertexOutputs tint_symbol = VertexOutputs(vec2(0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); - tint_symbol.position = vec4(((texcoord[VertexIndex] * 2.0f) - vec2(1.0f, 1.0f)), 0.0f, 1.0f); + tint_symbol.position = vec4(((texcoord[VertexIndex] * 2.0f) - vec2(1.0f)), 0.0f, 1.0f); bool flipY = (uniforms.u_scale.y < 0.0f); if (flipY) { tint_symbol.texcoords = ((((texcoord[VertexIndex] * uniforms.u_scale) + uniforms.u_offset) * vec2(1.0f, -1.0f)) + vec2(0.0f, 1.0f)); @@ -57,10 +69,10 @@ bool tint_discard = false; uniform highp sampler2D myTexture_mySampler; vec4 fs_main(vec2 texcoord) { - vec2 clampedTexcoord = clamp(texcoord, vec2(0.0f, 0.0f), vec2(1.0f, 1.0f)); + vec2 clampedTexcoord = clamp(texcoord, vec2(0.0f), vec2(1.0f)); if (!(all(equal(clampedTexcoord, texcoord)))) { tint_discard = true; - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } vec4 srcColor = texture(myTexture_mySampler, texcoord); return srcColor; diff --git a/test/tint/bug/dawn/947.wgsl.expected.hlsl b/test/tint/bug/dawn/947.wgsl.expected.hlsl deleted file mode 100644 index 7bcadcb34e..0000000000 --- a/test/tint/bug/dawn/947.wgsl.expected.hlsl +++ /dev/null @@ -1,74 +0,0 @@ -cbuffer cbuffer_uniforms : register(b0, space0) { - uint4 uniforms[1]; -}; - -struct VertexOutputs { - float2 texcoords; - float4 position; -}; -struct tint_symbol_1 { - uint VertexIndex : SV_VertexID; -}; -struct tint_symbol_2 { - float2 texcoords : TEXCOORD0; - float4 position : SV_Position; -}; - -VertexOutputs vs_main_inner(uint VertexIndex) { - float2 texcoord[3] = {float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)}; - VertexOutputs output = (VertexOutputs)0; - output.position = float4(((texcoord[VertexIndex] * 2.0f) - float2(1.0f, 1.0f)), 0.0f, 1.0f); - bool flipY = (asfloat(uniforms[0].y) < 0.0f); - if (flipY) { - output.texcoords = ((((texcoord[VertexIndex] * asfloat(uniforms[0].xy)) + asfloat(uniforms[0].zw)) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)); - } else { - output.texcoords = ((((texcoord[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * asfloat(uniforms[0].xy)) + asfloat(uniforms[0].zw)); - } - return output; -} - -tint_symbol_2 vs_main(tint_symbol_1 tint_symbol) { - const VertexOutputs inner_result = vs_main_inner(tint_symbol.VertexIndex); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.texcoords = inner_result.texcoords; - wrapper_result.position = inner_result.position; - return wrapper_result; -} - -SamplerState mySampler : register(s1, space0); -Texture2D myTexture : register(t2, space0); - -struct tint_symbol_4 { - float2 texcoord : TEXCOORD0; -}; -struct tint_symbol_5 { - float4 value : SV_Target0; -}; - -static bool tint_discard = false; - -float4 fs_main_inner(float2 texcoord) { - float2 clampedTexcoord = clamp(texcoord, float2(0.0f, 0.0f), float2(1.0f, 1.0f)); - if (!(all((clampedTexcoord == texcoord)))) { - tint_discard = true; - return float4(0.0f, 0.0f, 0.0f, 0.0f); - } - float4 srcColor = myTexture.Sample(mySampler, texcoord); - return srcColor; -} - -void tint_discard_func() { - discard; -} - -tint_symbol_5 fs_main(tint_symbol_4 tint_symbol_3) { - const float4 inner_result_1 = fs_main_inner(tint_symbol_3.texcoord); - if (tint_discard) { - tint_discard_func(); - const tint_symbol_5 tint_symbol_8 = (tint_symbol_5)0; - return tint_symbol_8; - } - tint_symbol_5 wrapper_result_1 = (tint_symbol_5)0; - wrapper_result_1.value = inner_result_1; - return wrapper_result_1; -} diff --git a/test/tint/bug/dawn/947.wgsl.expected.msl b/test/tint/bug/dawn/947.wgsl.expected.msl index 15efcd04c4..b30de3057e 100644 --- a/test/tint/bug/dawn/947.wgsl.expected.msl +++ b/test/tint/bug/dawn/947.wgsl.expected.msl @@ -1,6 +1,31 @@ +bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from uniform control flow + var srcColor = textureSample(myTexture, mySampler, texcoord); + ^^^^^^^^^^^^^ + +bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^ + +bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may result in a non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^^^^^^^ + #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ float2 u_scale; /* 0x0008 */ float2 u_offset; @@ -16,19 +41,15 @@ struct tint_symbol { float4 position [[position]]; }; -struct tint_array_wrapper { - float2 arr[3]; -}; - VertexOutputs vs_main_inner(uint VertexIndex, const constant Uniforms* const tint_symbol_5) { - tint_array_wrapper texcoord = {.arr={float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)}}; + tint_array texcoord = tint_array{float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)}; VertexOutputs output = {}; - output.position = float4(((texcoord.arr[VertexIndex] * 2.0f) - float2(1.0f, 1.0f)), 0.0f, 1.0f); + output.position = float4(((texcoord[VertexIndex] * 2.0f) - float2(1.0f)), 0.0f, 1.0f); bool flipY = ((*(tint_symbol_5)).u_scale[1] < 0.0f); if (flipY) { - output.texcoords = ((((texcoord.arr[VertexIndex] * (*(tint_symbol_5)).u_scale) + (*(tint_symbol_5)).u_offset) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)); + output.texcoords = ((((texcoord[VertexIndex] * (*(tint_symbol_5)).u_scale) + (*(tint_symbol_5)).u_offset) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)); } else { - output.texcoords = ((((texcoord.arr[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * (*(tint_symbol_5)).u_scale) + (*(tint_symbol_5)).u_offset); + output.texcoords = ((((texcoord[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * (*(tint_symbol_5)).u_scale) + (*(tint_symbol_5)).u_offset); } return output; } @@ -50,10 +71,10 @@ struct tint_symbol_3 { }; float4 fs_main_inner(float2 texcoord, thread bool* const tint_symbol_7, texture2d tint_symbol_8, sampler tint_symbol_9) { - float2 clampedTexcoord = clamp(texcoord, float2(0.0f, 0.0f), float2(1.0f, 1.0f)); + float2 clampedTexcoord = clamp(texcoord, float2(0.0f), float2(1.0f)); if (!(all((clampedTexcoord == texcoord)))) { *(tint_symbol_7) = true; - return float4(); + return float4(0.0f); } float4 srcColor = tint_symbol_8.sample(tint_symbol_9, texcoord); return srcColor; @@ -68,7 +89,7 @@ fragment tint_symbol_3 fs_main(texture2d tint_symbol_11 [ float4 const inner_result_1 = fs_main_inner(tint_symbol_1.texcoord, &(tint_symbol_10), tint_symbol_11, tint_symbol_12); if (tint_symbol_10) { tint_discard_func(); - tint_symbol_3 const tint_symbol_4 = {}; + tint_symbol_3 const tint_symbol_4 = tint_symbol_3{}; return tint_symbol_4; } tint_symbol_3 wrapper_result_1 = {}; diff --git a/test/tint/bug/dawn/947.wgsl.expected.spvasm b/test/tint/bug/dawn/947.wgsl.expected.spvasm index df48a9a9a6..636dbca046 100644 --- a/test/tint/bug/dawn/947.wgsl.expected.spvasm +++ b/test/tint/bug/dawn/947.wgsl.expected.spvasm @@ -1,10 +1,22 @@ +bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from uniform control flow + var srcColor = textureSample(myTexture, mySampler, texcoord); + ^^^^^^^^^^^^^ + +bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^ + +bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may result in a non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^^^^^^^ + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 140 +; Bound: 138 ; Schema: 0 OpCapability Shader - %118 = OpExtInstImport "GLSL.std.450" + %117 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vs_main "vs_main" %VertexIndex_1 %texcoords_1 %position_1 %vertex_point_size OpEntryPoint Fragment %fs_main "fs_main" %texcoord_1 %value @@ -87,137 +99,135 @@ %uint_3 = OpConstant %uint 3 %_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 %float_n0_5 = OpConstant %float -0.5 - %float_0 = OpConstant %float 0 - %37 = OpConstantComposite %v2float %float_n0_5 %float_0 + %36 = OpConstantComposite %v2float %float_n0_5 %15 %float_1_5 = OpConstant %float 1.5 - %39 = OpConstantComposite %v2float %float_1_5 %float_0 + %38 = OpConstantComposite %v2float %float_1_5 %15 %float_0_5 = OpConstant %float 0.5 %float_2 = OpConstant %float 2 - %42 = OpConstantComposite %v2float %float_0_5 %float_2 - %43 = OpConstantComposite %_arr_v2float_uint_3 %37 %39 %42 + %41 = OpConstantComposite %v2float %float_0_5 %float_2 + %42 = OpConstantComposite %_arr_v2float_uint_3 %36 %38 %41 %_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3 - %46 = OpConstantNull %_arr_v2float_uint_3 + %45 = OpConstantNull %_arr_v2float_uint_3 %_ptr_Function_VertexOutputs = OpTypePointer Function %VertexOutputs - %49 = OpConstantNull %VertexOutputs + %48 = OpConstantNull %VertexOutputs %uint_1 = OpConstant %uint 1 %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v2float = OpTypePointer Function %v2float %float_1 = OpConstant %float 1 - %58 = OpConstantComposite %v2float %float_1 %float_1 + %57 = OpConstantComposite %v2float %float_1 %float_1 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_float = OpTypePointer Uniform %float %bool = OpTypeBool %_ptr_Function_bool = OpTypePointer Function %bool - %71 = OpConstantNull %bool + %70 = OpConstantNull %bool %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %float_n1 = OpConstant %float -1 - %87 = OpConstantComposite %v2float %float_1 %float_n1 - %89 = OpConstantComposite %v2float %float_0 %float_1 + %86 = OpConstantComposite %v2float %float_1 %float_n1 + %88 = OpConstantComposite %v2float %15 %float_1 %void = OpTypeVoid - %103 = OpTypeFunction %void - %113 = OpTypeFunction %v4float %v2float - %119 = OpConstantComposite %v2float %float_0 %float_0 + %102 = OpTypeFunction %void + %112 = OpTypeFunction %v4float %v2float %v2bool = OpTypeVector %bool 2 - %132 = OpTypeSampledImage %27 + %130 = OpTypeSampledImage %27 %vs_main_inner = OpFunction %VertexOutputs None %28 %VertexIndex = OpFunctionParameter %uint %32 = OpLabel - %texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %46 - %output = OpVariable %_ptr_Function_VertexOutputs Function %49 - %flipY = OpVariable %_ptr_Function_bool Function %71 - OpStore %texcoord %43 - %52 = OpAccessChain %_ptr_Function_v4float %output %uint_1 - %54 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex - %55 = OpLoad %v2float %54 - %56 = OpVectorTimesScalar %v2float %55 %float_2 - %59 = OpFSub %v2float %56 %58 - %60 = OpCompositeExtract %float %59 0 - %61 = OpCompositeExtract %float %59 1 - %62 = OpCompositeConstruct %v4float %60 %61 %float_0 %float_1 - OpStore %52 %62 - %65 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1 - %66 = OpLoad %float %65 - %67 = OpFOrdLessThan %bool %66 %float_0 - OpStore %flipY %67 - %72 = OpLoad %bool %flipY - OpSelectionMerge %73 None - OpBranchConditional %72 %74 %75 - %74 = OpLabel - %76 = OpAccessChain %_ptr_Function_v2float %output %uint_0 - %77 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex - %78 = OpLoad %v2float %77 - %80 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 - %81 = OpLoad %v2float %80 - %82 = OpFMul %v2float %78 %81 - %83 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1 - %84 = OpLoad %v2float %83 - %85 = OpFAdd %v2float %82 %84 - %88 = OpFMul %v2float %85 %87 - %90 = OpFAdd %v2float %88 %89 - OpStore %76 %90 - OpBranch %73 - %75 = OpLabel - %91 = OpAccessChain %_ptr_Function_v2float %output %uint_0 - %92 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex - %93 = OpLoad %v2float %92 - %94 = OpFMul %v2float %93 %87 - %95 = OpFAdd %v2float %94 %89 - %96 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 - %97 = OpLoad %v2float %96 - %98 = OpFMul %v2float %95 %97 - %99 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1 - %100 = OpLoad %v2float %99 - %101 = OpFAdd %v2float %98 %100 - OpStore %91 %101 - OpBranch %73 + %texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %45 + %output = OpVariable %_ptr_Function_VertexOutputs Function %48 + %flipY = OpVariable %_ptr_Function_bool Function %70 + OpStore %texcoord %42 + %51 = OpAccessChain %_ptr_Function_v4float %output %uint_1 + %53 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex + %54 = OpLoad %v2float %53 + %55 = OpVectorTimesScalar %v2float %54 %float_2 + %58 = OpFSub %v2float %55 %57 + %59 = OpCompositeExtract %float %58 0 + %60 = OpCompositeExtract %float %58 1 + %61 = OpCompositeConstruct %v4float %59 %60 %15 %float_1 + OpStore %51 %61 + %64 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1 + %65 = OpLoad %float %64 + %66 = OpFOrdLessThan %bool %65 %15 + OpStore %flipY %66 + %71 = OpLoad %bool %flipY + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 %73 = OpLabel - %102 = OpLoad %VertexOutputs %output - OpReturnValue %102 + %75 = OpAccessChain %_ptr_Function_v2float %output %uint_0 + %76 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex + %77 = OpLoad %v2float %76 + %79 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 + %80 = OpLoad %v2float %79 + %81 = OpFMul %v2float %77 %80 + %82 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1 + %83 = OpLoad %v2float %82 + %84 = OpFAdd %v2float %81 %83 + %87 = OpFMul %v2float %84 %86 + %89 = OpFAdd %v2float %87 %88 + OpStore %75 %89 + OpBranch %72 + %74 = OpLabel + %90 = OpAccessChain %_ptr_Function_v2float %output %uint_0 + %91 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex + %92 = OpLoad %v2float %91 + %93 = OpFMul %v2float %92 %86 + %94 = OpFAdd %v2float %93 %88 + %95 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 + %96 = OpLoad %v2float %95 + %97 = OpFMul %v2float %94 %96 + %98 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1 + %99 = OpLoad %v2float %98 + %100 = OpFAdd %v2float %97 %99 + OpStore %90 %100 + OpBranch %72 + %72 = OpLabel + %101 = OpLoad %VertexOutputs %output + OpReturnValue %101 OpFunctionEnd - %vs_main = OpFunction %void None %103 - %106 = OpLabel - %108 = OpLoad %uint %VertexIndex_1 - %107 = OpFunctionCall %VertexOutputs %vs_main_inner %108 - %109 = OpCompositeExtract %v2float %107 0 - OpStore %texcoords_1 %109 - %110 = OpCompositeExtract %v4float %107 1 - OpStore %position_1 %110 + %vs_main = OpFunction %void None %102 + %105 = OpLabel + %107 = OpLoad %uint %VertexIndex_1 + %106 = OpFunctionCall %VertexOutputs %vs_main_inner %107 + %108 = OpCompositeExtract %v2float %106 0 + OpStore %texcoords_1 %108 + %109 = OpCompositeExtract %v4float %106 1 + OpStore %position_1 %109 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd -%tint_discard_func = OpFunction %void None %103 - %112 = OpLabel +%tint_discard_func = OpFunction %void None %102 + %111 = OpLabel OpKill OpFunctionEnd -%fs_main_inner = OpFunction %v4float None %113 +%fs_main_inner = OpFunction %v4float None %112 %texcoord_0 = OpFunctionParameter %v2float - %116 = OpLabel + %115 = OpLabel %clampedTexcoord = OpVariable %_ptr_Function_v2float Function %8 %srcColor = OpVariable %_ptr_Function_v4float Function %12 - %117 = OpExtInst %v2float %118 NClamp %texcoord_0 %119 %58 - OpStore %clampedTexcoord %117 - %123 = OpLoad %v2float %clampedTexcoord - %124 = OpFOrdEqual %v2bool %123 %texcoord_0 - %122 = OpAll %bool %124 - %121 = OpLogicalNot %bool %122 - OpSelectionMerge %126 None - OpBranchConditional %121 %127 %126 - %127 = OpLabel - %128 = OpFunctionCall %void %tint_discard_func + %116 = OpExtInst %v2float %117 NClamp %texcoord_0 %8 %57 + OpStore %clampedTexcoord %116 + %121 = OpLoad %v2float %clampedTexcoord + %122 = OpFOrdEqual %v2bool %121 %texcoord_0 + %120 = OpAll %bool %122 + %119 = OpLogicalNot %bool %120 + OpSelectionMerge %124 None + OpBranchConditional %119 %125 %124 + %125 = OpLabel + %126 = OpFunctionCall %void %tint_discard_func OpReturnValue %12 - %126 = OpLabel - %130 = OpLoad %24 %mySampler - %131 = OpLoad %27 %myTexture - %133 = OpSampledImage %132 %131 %130 - %129 = OpImageSampleImplicitLod %v4float %133 %texcoord_0 - OpStore %srcColor %129 - %135 = OpLoad %v4float %srcColor - OpReturnValue %135 + %124 = OpLabel + %128 = OpLoad %24 %mySampler + %129 = OpLoad %27 %myTexture + %131 = OpSampledImage %130 %129 %128 + %127 = OpImageSampleImplicitLod %v4float %131 %texcoord_0 + OpStore %srcColor %127 + %133 = OpLoad %v4float %srcColor + OpReturnValue %133 OpFunctionEnd - %fs_main = OpFunction %void None %103 - %137 = OpLabel - %139 = OpLoad %v2float %texcoord_1 - %138 = OpFunctionCall %v4float %fs_main_inner %139 - OpStore %value %138 + %fs_main = OpFunction %void None %102 + %135 = OpLabel + %137 = OpLoad %v2float %texcoord_1 + %136 = OpFunctionCall %v4float %fs_main_inner %137 + OpStore %value %136 OpReturn OpFunctionEnd diff --git a/test/tint/bug/dawn/947.wgsl.expected.wgsl b/test/tint/bug/dawn/947.wgsl.expected.wgsl index 063f354cc7..69590c5e2f 100644 --- a/test/tint/bug/dawn/947.wgsl.expected.wgsl +++ b/test/tint/bug/dawn/947.wgsl.expected.wgsl @@ -1,3 +1,15 @@ +bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from uniform control flow + var srcColor = textureSample(myTexture, mySampler, texcoord); + ^^^^^^^^^^^^^ + +bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^ + +bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may result in a non-uniform value + if (!all(clampedTexcoord == texcoord)) { + ^^^^^^^^ + struct Uniforms { u_scale : vec2, u_offset : vec2, @@ -12,7 +24,7 @@ struct VertexOutputs { position : vec4, } -@stage(vertex) +@vertex fn vs_main(@builtin(vertex_index) VertexIndex : u32) -> VertexOutputs { var texcoord = array, 3>(vec2(-0.5, 0.0), vec2(1.5, 0.0), vec2(0.5, 2.0)); var output : VertexOutputs; @@ -30,7 +42,7 @@ fn vs_main(@builtin(vertex_index) VertexIndex : u32) -> VertexOutputs { @binding(2) @group(0) var myTexture : texture_2d; -@stage(fragment) +@fragment fn fs_main(@location(0) texcoord : vec2) -> @location(0) vec4 { var clampedTexcoord = clamp(texcoord, vec2(0.0, 0.0), vec2(1.0, 1.0)); if (!(all((clampedTexcoord == texcoord)))) { diff --git a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl index 549d2671d6..089d82b2ce 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl @@ -10,7 +10,7 @@ struct Result { }; @group(0) @binding(1) var result: Result; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var s : S; result.out = s.data[ubo.dynamic_idx]; diff --git a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b9a46178c5 --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +struct S { + int data[64]; +}; + +RWByteAddressBuffer result : register(u1, space0); + +[numthreads(1, 1, 1)] +void f() { + S s = (S)0; + result.Store(0u, asuint(s.data[asint(ubo[0].x)])); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.msl index 271eaa17d7..8f724a613c 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.msl @@ -1,16 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; -struct tint_array_wrapper { - int arr[64]; -}; - struct S { - tint_array_wrapper data; + tint_array data; }; struct Result { @@ -19,7 +28,7 @@ struct Result { kernel void f(device Result* tint_symbol [[buffer(1)]], const constant UBO* tint_symbol_1 [[buffer(0)]]) { S s = {}; - (*(tint_symbol)).out = s.data.arr[(*(tint_symbol_1)).dynamic_idx]; + (*(tint_symbol)).out = s.data[(*(tint_symbol_1)).dynamic_idx]; return; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.wgsl index 74fe1680b9..0d74328c66 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.wgsl @@ -14,7 +14,7 @@ struct Result { @group(0) @binding(1) var result : Result; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var s : S; result.out = s.data[ubo.dynamic_idx]; diff --git a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl index 28cf03278b..838c01f83c 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl @@ -12,7 +12,7 @@ struct Result { var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { result.out = s.data[ubo.dynamic_idx]; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ef50e8a3ce --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +struct S { + int data[64]; +}; + +RWByteAddressBuffer result : register(u1, space0); +static S s = (S)0; + +[numthreads(1, 1, 1)] +void f() { + result.Store(0u, asuint(s.data[asint(ubo[0].x)])); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.msl index 00b6f03656..8ac81148c7 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.msl @@ -1,16 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; -struct tint_array_wrapper { - int arr[64]; -}; - struct S { - tint_array_wrapper data; + tint_array data; }; struct Result { @@ -19,7 +28,7 @@ struct Result { kernel void f(device Result* tint_symbol [[buffer(1)]], const constant UBO* tint_symbol_2 [[buffer(0)]]) { thread S tint_symbol_1 = {}; - (*(tint_symbol)).out = tint_symbol_1.data.arr[(*(tint_symbol_2)).dynamic_idx]; + (*(tint_symbol)).out = tint_symbol_1.data[(*(tint_symbol_2)).dynamic_idx]; return; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.wgsl index e8ecf948fb..53ae23a49d 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct Result { var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { result.out = s.data[ubo.dynamic_idx]; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl index c665d8e74c..eed6688b31 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl @@ -12,7 +12,7 @@ struct SSBO { }; @group(0) @binding(1) var ssbo: SSBO; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { result.out = ssbo.data[ubo.dynamic_idx]; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dada6d4c9d --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +RWByteAddressBuffer result : register(u2, space0); + +RWByteAddressBuffer ssbo : register(u1, space0); + +[numthreads(1, 1, 1)] +void f() { + result.Store(0u, asuint(asint(ssbo.Load((4u * uint(asint(ubo[0].x))))))); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.msl index 92fb6e6aff..c802c8f11e 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; @@ -9,16 +22,12 @@ struct Result { /* 0x0000 */ int out; }; -struct tint_array_wrapper { - /* 0x0000 */ int arr[4]; -}; - struct SSBO { - /* 0x0000 */ tint_array_wrapper data; + /* 0x0000 */ tint_array data; }; kernel void f(device Result* tint_symbol [[buffer(1)]], device SSBO* tint_symbol_1 [[buffer(2)]], const constant UBO* tint_symbol_2 [[buffer(0)]]) { - (*(tint_symbol)).out = (*(tint_symbol_1)).data.arr[(*(tint_symbol_2)).dynamic_idx]; + (*(tint_symbol)).out = (*(tint_symbol_1)).data[(*(tint_symbol_2)).dynamic_idx]; return; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.wgsl index 82b357d4e9..537156dc80 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct SSBO { @group(0) @binding(1) var ssbo : SSBO; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { result.out = ssbo.data[ubo.dynamic_idx]; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl index 0201af50db..c5140a7be1 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl @@ -8,7 +8,7 @@ struct Result { }; @group(0) @binding(2) var result: Result; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { result.out = ubo.data[ubo.dynamic_idx].x; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01e61f78b5 --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[5]; +}; + +RWByteAddressBuffer result : register(u2, space0); + +[numthreads(1, 1, 1)] +void f() { + const uint scalar_offset = ((16u * uint(asint(ubo[4].x)))) / 4; + result.Store(0u, asuint(asint(ubo[scalar_offset / 4][scalar_offset % 4]))); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.msl index 48d71bef81..c9ab95918e 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.msl @@ -1,14 +1,23 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct UBO { - /* 0x0000 */ tint_array_wrapper data; + /* 0x0000 */ tint_array data; /* 0x0040 */ int dynamic_idx; - /* 0x0044 */ int8_t tint_pad[12]; + /* 0x0044 */ tint_array tint_pad; }; struct Result { @@ -16,7 +25,7 @@ struct Result { }; kernel void f(device Result* tint_symbol [[buffer(1)]], const constant UBO* tint_symbol_1 [[buffer(0)]]) { - (*(tint_symbol)).out = (*(tint_symbol_1)).data.arr[(*(tint_symbol_1)).dynamic_idx][0]; + (*(tint_symbol)).out = (*(tint_symbol_1)).data[(*(tint_symbol_1)).dynamic_idx][0]; return; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.wgsl index 1a0f804926..d1903e378f 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.wgsl @@ -11,7 +11,7 @@ struct Result { @group(0) @binding(2) var result : Result; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { result.out = ubo.data[ubo.dynamic_idx].x; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl index 44d7f1eda9..210adfef4d 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl @@ -12,7 +12,7 @@ struct Result { var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { result.out = s.data[ubo.dynamic_idx]; } diff --git a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c590e46bc --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +struct S { + int data[64]; +}; + +RWByteAddressBuffer result : register(u1, space0); +groupshared S s; + +struct tint_symbol_2 { + uint local_invocation_index : SV_GroupIndex; +}; + +void f_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) { + const uint i = idx; + s.data[i] = 0; + } + } + GroupMemoryBarrierWithGroupSync(); + result.Store(0u, asuint(s.data[asint(ubo[0].x)])); +} + +[numthreads(1, 1, 1)] +void f(tint_symbol_2 tint_symbol_1) { + f_inner(tint_symbol_1.local_invocation_index); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.msl index b4746d6aab..b8557fd296 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.msl @@ -1,16 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; -struct tint_array_wrapper { - int arr[64]; -}; - struct S { - tint_array_wrapper data; + tint_array data; }; struct Result { @@ -20,10 +29,10 @@ struct Result { void f_inner(uint local_invocation_index, threadgroup S* const tint_symbol, device Result* const tint_symbol_1, const constant UBO* const tint_symbol_2) { for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) { uint const i = idx; - (*(tint_symbol)).data.arr[i] = int(); + (*(tint_symbol)).data[i] = 0; } threadgroup_barrier(mem_flags::mem_threadgroup); - (*(tint_symbol_1)).out = (*(tint_symbol)).data.arr[(*(tint_symbol_2)).dynamic_idx]; + (*(tint_symbol_1)).out = (*(tint_symbol)).data[(*(tint_symbol_2)).dynamic_idx]; } kernel void f(device Result* tint_symbol_4 [[buffer(1)]], const constant UBO* tint_symbol_5 [[buffer(0)]], uint local_invocation_index [[thread_index_in_threadgroup]]) { diff --git a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.wgsl index 35d672ab39..c49cc40ed6 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct Result { var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { result.out = s.data[ubo.dynamic_idx]; } diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl index f8b1cbbaaf..b19ea5395c 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl @@ -10,7 +10,7 @@ struct Result { }; @group(0) @binding(1) var result: Result; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var s : S; s.data[ubo.dynamic_idx] = 1; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60c1a89bb1 --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +struct S { + int data[64]; +}; + +RWByteAddressBuffer result : register(u1, space0); + +[numthreads(1, 1, 1)] +void f() { + S s = (S)0; + { + int tint_symbol_2[64] = s.data; + tint_symbol_2[asint(ubo[0].x)] = 1; + s.data = tint_symbol_2; + } + result.Store(0u, asuint(s.data[3])); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.msl index c4e1dfff9d..1fe02f1809 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.msl @@ -1,16 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; -struct tint_array_wrapper { - int arr[64]; -}; - struct S { - tint_array_wrapper data; + tint_array data; }; struct Result { @@ -19,8 +28,8 @@ struct Result { kernel void f(const constant UBO* tint_symbol [[buffer(0)]], device Result* tint_symbol_1 [[buffer(1)]]) { S s = {}; - s.data.arr[(*(tint_symbol)).dynamic_idx] = 1; - (*(tint_symbol_1)).out = s.data.arr[3]; + s.data[(*(tint_symbol)).dynamic_idx] = 1; + (*(tint_symbol_1)).out = s.data[3]; return; } diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.wgsl index 4d3b911407..4c2070d5da 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.wgsl @@ -14,7 +14,7 @@ struct Result { @group(0) @binding(1) var result : Result; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var s : S; s.data[ubo.dynamic_idx] = 1; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl index 4fcf160442..15863252aa 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl @@ -14,7 +14,7 @@ fn x(p : ptr) { (*p).data[ubo.dynamic_idx] = 1; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var s : S; x(&s); diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6d73fa8f2d --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +struct S { + int data[64]; +}; + +RWByteAddressBuffer result : register(u1, space0); + +void x(inout S p) { + { + int tint_symbol_2[64] = p.data; + tint_symbol_2[asint(ubo[0].x)] = 1; + p.data = tint_symbol_2; + } +} + +[numthreads(1, 1, 1)] +void f() { + S s = (S)0; + x(s); + result.Store(0u, asuint(s.data[3])); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.msl index b9efff8ceb..5aabd3a012 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.msl @@ -1,16 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; -struct tint_array_wrapper { - int arr[64]; -}; - struct S { - tint_array_wrapper data; + tint_array data; }; struct Result { @@ -18,13 +27,13 @@ struct Result { }; void x(thread S* const p, const constant UBO* const tint_symbol) { - (*(p)).data.arr[(*(tint_symbol)).dynamic_idx] = 1; + (*(p)).data[(*(tint_symbol)).dynamic_idx] = 1; } kernel void f(const constant UBO* tint_symbol_1 [[buffer(0)]], device Result* tint_symbol_2 [[buffer(1)]]) { S s = {}; x(&(s), tint_symbol_1); - (*(tint_symbol_2)).out = s.data.arr[3]; + (*(tint_symbol_2)).out = s.data[3]; return; } diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.wgsl index 79b222285f..85c61a5f71 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.wgsl @@ -18,7 +18,7 @@ fn x(p : ptr) { (*(p)).data[ubo.dynamic_idx] = 1; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var s : S; x(&(s)); diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl index c86094a1c7..a6e4f17c41 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl @@ -12,7 +12,7 @@ struct Result { var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { s.data[ubo.dynamic_idx] = 1; result.out = s.data[3]; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..755fa553f4 --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +struct S { + int data[64]; +}; + +RWByteAddressBuffer result : register(u1, space0); +static S s = (S)0; + +[numthreads(1, 1, 1)] +void f() { + { + int tint_symbol_2[64] = s.data; + tint_symbol_2[asint(ubo[0].x)] = 1; + s.data = tint_symbol_2; + } + result.Store(0u, asuint(s.data[3])); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.msl index 2a59ee45bf..6f94f2467a 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.msl @@ -1,16 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; -struct tint_array_wrapper { - int arr[64]; -}; - struct S { - tint_array_wrapper data; + tint_array data; }; struct Result { @@ -19,8 +28,8 @@ struct Result { kernel void f(const constant UBO* tint_symbol_1 [[buffer(0)]], device Result* tint_symbol_2 [[buffer(1)]]) { thread S tint_symbol = {}; - tint_symbol.data.arr[(*(tint_symbol_1)).dynamic_idx] = 1; - (*(tint_symbol_2)).out = tint_symbol.data.arr[3]; + tint_symbol.data[(*(tint_symbol_1)).dynamic_idx] = 1; + (*(tint_symbol_2)).out = tint_symbol.data[3]; return; } diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.wgsl index 31d7c74d53..5505a8b909 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct Result { var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { s.data[ubo.dynamic_idx] = 1; result.out = s.data[3]; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl index 94329c6c00..67706cd377 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl @@ -16,7 +16,7 @@ fn x(p : ptr) { (*p).data[ubo.dynamic_idx] = 1; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { x(&s); result.out = s.data[3]; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8d8ff4e1c --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +struct S { + int data[64]; +}; + +RWByteAddressBuffer result : register(u1, space0); +static S s = (S)0; + +void x(inout S p) { + { + int tint_symbol_2[64] = p.data; + tint_symbol_2[asint(ubo[0].x)] = 1; + p.data = tint_symbol_2; + } +} + +[numthreads(1, 1, 1)] +void f() { + x(s); + result.Store(0u, asuint(s.data[3])); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.msl index a27679e997..0a31f28c68 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.msl @@ -1,16 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; -struct tint_array_wrapper { - int arr[64]; -}; - struct S { - tint_array_wrapper data; + tint_array data; }; struct Result { @@ -18,13 +27,13 @@ struct Result { }; void x(thread S* const p, const constant UBO* const tint_symbol) { - (*(p)).data.arr[(*(tint_symbol)).dynamic_idx] = 1; + (*(p)).data[(*(tint_symbol)).dynamic_idx] = 1; } kernel void f(const constant UBO* tint_symbol_2 [[buffer(0)]], device Result* tint_symbol_3 [[buffer(1)]]) { thread S tint_symbol_1 = {}; x(&(tint_symbol_1), tint_symbol_2); - (*(tint_symbol_3)).out = tint_symbol_1.data.arr[3]; + (*(tint_symbol_3)).out = tint_symbol_1.data[3]; return; } diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.wgsl index 9724ec040d..21d815f8ff 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.wgsl @@ -20,7 +20,7 @@ fn x(p : ptr) { (*(p)).data[ubo.dynamic_idx] = 1; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { x(&(s)); result.out = s.data[3]; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl index f0204babff..9429cf66c6 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl @@ -12,7 +12,7 @@ struct SSBO { }; @group(0) @binding(1) var ssbo: SSBO; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { ssbo.data[ubo.dynamic_idx] = 1; result.out = ssbo.data[3]; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..005f32199f --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +RWByteAddressBuffer result : register(u2, space0); + +RWByteAddressBuffer ssbo : register(u1, space0); + +[numthreads(1, 1, 1)] +void f() { + ssbo.Store((4u * uint(asint(ubo[0].x))), asuint(1)); + result.Store(0u, asuint(asint(ssbo.Load(12u)))); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.msl index ca1afb53b6..747fc40852 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; @@ -9,17 +22,13 @@ struct Result { /* 0x0000 */ int out; }; -struct tint_array_wrapper { - /* 0x0000 */ int arr[4]; -}; - struct SSBO { - /* 0x0000 */ tint_array_wrapper data; + /* 0x0000 */ tint_array data; }; kernel void f(device SSBO* tint_symbol [[buffer(1)]], const constant UBO* tint_symbol_1 [[buffer(0)]], device Result* tint_symbol_2 [[buffer(2)]]) { - (*(tint_symbol)).data.arr[(*(tint_symbol_1)).dynamic_idx] = 1; - (*(tint_symbol_2)).out = (*(tint_symbol)).data.arr[3]; + (*(tint_symbol)).data[(*(tint_symbol_1)).dynamic_idx] = 1; + (*(tint_symbol_2)).out = (*(tint_symbol)).data[3]; return; } diff --git a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.wgsl index 942aea7358..aa07c77732 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct SSBO { @group(0) @binding(1) var ssbo : SSBO; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { ssbo.data[ubo.dynamic_idx] = 1; result.out = ssbo.data[3]; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl index 8aa0ab3693..08bacaa902 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl @@ -12,7 +12,7 @@ struct Result { var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { s.data[ubo.dynamic_idx] = 1; result.out = s.data[3]; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.hlsl rename to test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5080be8b95 --- /dev/null +++ b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +cbuffer cbuffer_ubo : register(b0, space0) { + uint4 ubo[1]; +}; + +struct S { + int data[64]; +}; + +RWByteAddressBuffer result : register(u1, space0); +groupshared S s; + +struct tint_symbol_2 { + uint local_invocation_index : SV_GroupIndex; +}; + +void f_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) { + const uint i = idx; + s.data[i] = 0; + } + } + GroupMemoryBarrierWithGroupSync(); + s.data[asint(ubo[0].x)] = 1; + result.Store(0u, asuint(s.data[3])); +} + +[numthreads(1, 1, 1)] +void f(tint_symbol_2 tint_symbol_1) { + f_inner(tint_symbol_1.local_invocation_index); + return; +} diff --git a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.msl b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.msl index 1f436cd970..fa5f6872a1 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.msl +++ b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.msl @@ -1,16 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UBO { /* 0x0000 */ int dynamic_idx; }; -struct tint_array_wrapper { - int arr[64]; -}; - struct S { - tint_array_wrapper data; + tint_array data; }; struct Result { @@ -20,11 +29,11 @@ struct Result { void f_inner(uint local_invocation_index, threadgroup S* const tint_symbol, const constant UBO* const tint_symbol_1, device Result* const tint_symbol_2) { for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) { uint const i = idx; - (*(tint_symbol)).data.arr[i] = int(); + (*(tint_symbol)).data[i] = 0; } threadgroup_barrier(mem_flags::mem_threadgroup); - (*(tint_symbol)).data.arr[(*(tint_symbol_1)).dynamic_idx] = 1; - (*(tint_symbol_2)).out = (*(tint_symbol)).data.arr[3]; + (*(tint_symbol)).data[(*(tint_symbol_1)).dynamic_idx] = 1; + (*(tint_symbol_2)).out = (*(tint_symbol)).data[3]; } kernel void f(const constant UBO* tint_symbol_4 [[buffer(0)]], device Result* tint_symbol_5 [[buffer(1)]], uint local_invocation_index [[thread_index_in_threadgroup]]) { diff --git a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.wgsl b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.wgsl index 59c68f2090..0bdf4ac2ec 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct Result { var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { s.data[ubo.dynamic_idx] = 1; result.out = s.data[3]; diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl index a18d525655..dab8b71a34 100644 --- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl +++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl @@ -3,7 +3,7 @@ @group(0) @binding(1) var randomTexture: texture_2d; @group(0) @binding(2) var depthTexture: texture_2d; -@stage(fragment) +@fragment fn main(@location(0) vUV : vec2) -> @location(0) vec4 { let random: vec3 = textureSample(randomTexture, Sampler, vUV).rgb; diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d8ef362ca9 --- /dev/null +++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.dxc.hlsl @@ -0,0 +1,60 @@ +bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow + let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r; + ^^^^^^^^^^^^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value + if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) { + ^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform + let random: vec3 = textureSample(randomTexture, Sampler, vUV).rgb; + ^^^^^^^^^^^^^ + +SamplerState tint_symbol : register(s0, space0); +Texture2D randomTexture : register(t1, space0); +Texture2D depthTexture : register(t2, space0); + +struct tint_symbol_2 { + float2 vUV : TEXCOORD0; +}; +struct tint_symbol_3 { + float4 value : SV_Target0; +}; + +float4 main_inner(float2 vUV) { + const float3 random = randomTexture.Sample(tint_symbol, vUV).rgb; + int i = 0; + [loop] while (true) { + if ((i < 1)) { + } else { + break; + } + const float3 offset = float3((random.x).xxx); + bool tint_tmp_2 = (offset.x < 0.0f); + if (!tint_tmp_2) { + tint_tmp_2 = (offset.y < 0.0f); + } + bool tint_tmp_1 = (tint_tmp_2); + if (!tint_tmp_1) { + tint_tmp_1 = (offset.x > 1.0f); + } + bool tint_tmp = (tint_tmp_1); + if (!tint_tmp) { + tint_tmp = (offset.y > 1.0f); + } + if ((tint_tmp)) { + i = (i + 1); + continue; + } + const float sampleDepth = depthTexture.Sample(tint_symbol, offset.xy).r; + i = (i + 1); + } + return (1.0f).xxxx; +} + +tint_symbol_3 main(tint_symbol_2 tint_symbol_1) { + const float4 inner_result = main_inner(tint_symbol_1.vUV); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d8ef362ca9 --- /dev/null +++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.fxc.hlsl @@ -0,0 +1,60 @@ +bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow + let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r; + ^^^^^^^^^^^^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value + if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) { + ^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform + let random: vec3 = textureSample(randomTexture, Sampler, vUV).rgb; + ^^^^^^^^^^^^^ + +SamplerState tint_symbol : register(s0, space0); +Texture2D randomTexture : register(t1, space0); +Texture2D depthTexture : register(t2, space0); + +struct tint_symbol_2 { + float2 vUV : TEXCOORD0; +}; +struct tint_symbol_3 { + float4 value : SV_Target0; +}; + +float4 main_inner(float2 vUV) { + const float3 random = randomTexture.Sample(tint_symbol, vUV).rgb; + int i = 0; + [loop] while (true) { + if ((i < 1)) { + } else { + break; + } + const float3 offset = float3((random.x).xxx); + bool tint_tmp_2 = (offset.x < 0.0f); + if (!tint_tmp_2) { + tint_tmp_2 = (offset.y < 0.0f); + } + bool tint_tmp_1 = (tint_tmp_2); + if (!tint_tmp_1) { + tint_tmp_1 = (offset.x > 1.0f); + } + bool tint_tmp = (tint_tmp_1); + if (!tint_tmp) { + tint_tmp = (offset.y > 1.0f); + } + if ((tint_tmp)) { + i = (i + 1); + continue; + } + const float sampleDepth = depthTexture.Sample(tint_symbol, offset.xy).r; + i = (i + 1); + } + return (1.0f).xxxx; +} + +tint_symbol_3 main(tint_symbol_2 tint_symbol_1) { + const float4 inner_result = main_inner(tint_symbol_1.vUV); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.glsl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.glsl index b11b4b2831..d91730385d 100644 --- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.glsl +++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.glsl @@ -1,3 +1,15 @@ +bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow + let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r; + ^^^^^^^^^^^^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value + if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) { + ^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform + let random: vec3 = textureSample(randomTexture, Sampler, vUV).rgb; + ^^^^^^^^^^^^^ + #version 310 es precision mediump float; diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.hlsl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.hlsl deleted file mode 100644 index 4c8362a02a..0000000000 --- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.hlsl +++ /dev/null @@ -1,48 +0,0 @@ -SamplerState tint_symbol : register(s0, space0); -Texture2D randomTexture : register(t1, space0); -Texture2D depthTexture : register(t2, space0); - -struct tint_symbol_2 { - float2 vUV : TEXCOORD0; -}; -struct tint_symbol_3 { - float4 value : SV_Target0; -}; - -float4 main_inner(float2 vUV) { - const float3 random = randomTexture.Sample(tint_symbol, vUV).rgb; - int i = 0; - [loop] while (true) { - if ((i < 1)) { - } else { - break; - } - const float3 offset = float3((random.x).xxx); - bool tint_tmp_2 = (offset.x < 0.0f); - if (!tint_tmp_2) { - tint_tmp_2 = (offset.y < 0.0f); - } - bool tint_tmp_1 = (tint_tmp_2); - if (!tint_tmp_1) { - tint_tmp_1 = (offset.x > 1.0f); - } - bool tint_tmp = (tint_tmp_1); - if (!tint_tmp) { - tint_tmp = (offset.y > 1.0f); - } - if ((tint_tmp)) { - i = (i + 1); - continue; - } - const float sampleDepth = depthTexture.Sample(tint_symbol, offset.xy).r; - i = (i + 1); - } - return float4((1.0f).xxxx); -} - -tint_symbol_3 main(tint_symbol_2 tint_symbol_1) { - const float4 inner_result = main_inner(tint_symbol_1.vUV); - tint_symbol_3 wrapper_result = (tint_symbol_3)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.msl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.msl index 3b00074e21..c3386fd281 100644 --- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.msl +++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.msl @@ -1,3 +1,15 @@ +bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow + let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r; + ^^^^^^^^^^^^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value + if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) { + ^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform + let random: vec3 = textureSample(randomTexture, Sampler, vUV).rgb; + ^^^^^^^^^^^^^ + #include using namespace metal; diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.spvasm b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.spvasm index 49aff3ba86..42fde31b2d 100644 --- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.spvasm @@ -1,7 +1,19 @@ +bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow + let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r; + ^^^^^^^^^^^^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value + if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) { + ^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform + let random: vec3 = textureSample(randomTexture, Sampler, vUV).rgb; + ^^^^^^^^^^^^^ + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 83 +; Bound: 82 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -43,95 +55,94 @@ %23 = OpTypeSampledImage %14 %v3float = OpTypeVector %float 3 %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %28 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %31 = OpConstantNull %int %int_1 = OpConstant %int 1 %bool = OpTypeBool - %float_0 = OpConstant %float 0 + %45 = OpConstantNull %float %float_1 = OpConstant %float 1 - %76 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %75 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %void = OpTypeVoid - %77 = OpTypeFunction %void + %76 = OpTypeFunction %void %main_inner = OpFunction %v4float None %16 %vUV = OpFunctionParameter %v2float %19 = OpLabel - %i = OpVariable %_ptr_Function_int Function %31 + %i = OpVariable %_ptr_Function_int Function %28 %21 = OpLoad %11 %Sampler %22 = OpLoad %14 %randomTexture %24 = OpSampledImage %23 %22 %21 %20 = OpImageSampleImplicitLod %v4float %24 %vUV %26 = OpVectorShuffle %v3float %20 %20 0 1 2 - OpStore %i %int_0 - OpBranch %32 - %32 = OpLabel - OpLoopMerge %33 %34 None - OpBranch %35 - %35 = OpLabel - %36 = OpLoad %int %i - %38 = OpSLessThan %bool %36 %int_1 - OpSelectionMerge %40 None - OpBranchConditional %38 %41 %42 - %41 = OpLabel - OpBranch %40 - %42 = OpLabel - OpBranch %33 - %40 = OpLabel - %43 = OpCompositeExtract %float %26 0 - %44 = OpCompositeConstruct %v3float %43 %43 %43 - %45 = OpCompositeExtract %float %44 0 - %47 = OpFOrdLessThan %bool %45 %float_0 - OpSelectionMerge %48 None - OpBranchConditional %47 %48 %49 - %49 = OpLabel - %50 = OpCompositeExtract %float %44 1 - %51 = OpFOrdLessThan %bool %50 %float_0 - OpBranch %48 - %48 = OpLabel - %52 = OpPhi %bool %47 %40 %51 %49 - OpSelectionMerge %53 None - OpBranchConditional %52 %53 %54 - %54 = OpLabel - %55 = OpCompositeExtract %float %44 0 - %57 = OpFOrdGreaterThan %bool %55 %float_1 - OpBranch %53 - %53 = OpLabel - %58 = OpPhi %bool %52 %48 %57 %54 - OpSelectionMerge %59 None - OpBranchConditional %58 %59 %60 - %60 = OpLabel - %61 = OpCompositeExtract %float %44 1 - %62 = OpFOrdGreaterThan %bool %61 %float_1 - OpBranch %59 - %59 = OpLabel - %63 = OpPhi %bool %58 %53 %62 %60 - OpSelectionMerge %64 None - OpBranchConditional %63 %65 %64 - %65 = OpLabel - %66 = OpLoad %int %i - %67 = OpIAdd %int %66 %int_1 - OpStore %i %67 - OpBranch %34 - %64 = OpLabel - %69 = OpLoad %11 %Sampler - %70 = OpLoad %14 %depthTexture - %71 = OpSampledImage %23 %70 %69 - %72 = OpVectorShuffle %v2float %44 %44 0 1 - %68 = OpImageSampleImplicitLod %v4float %71 %72 - %73 = OpCompositeExtract %float %68 0 - %74 = OpLoad %int %i - %75 = OpIAdd %int %74 %int_1 - OpStore %i %75 + OpStore %i %28 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None OpBranch %34 %34 = OpLabel + %35 = OpLoad %int %i + %37 = OpSLessThan %bool %35 %int_1 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel OpBranch %32 + %39 = OpLabel + %42 = OpCompositeExtract %float %26 0 + %43 = OpCompositeConstruct %v3float %42 %42 %42 + %44 = OpCompositeExtract %float %43 0 + %46 = OpFOrdLessThan %bool %44 %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %47 %48 + %48 = OpLabel + %49 = OpCompositeExtract %float %43 1 + %50 = OpFOrdLessThan %bool %49 %45 + OpBranch %47 + %47 = OpLabel + %51 = OpPhi %bool %46 %39 %50 %48 + OpSelectionMerge %52 None + OpBranchConditional %51 %52 %53 + %53 = OpLabel + %54 = OpCompositeExtract %float %43 0 + %56 = OpFOrdGreaterThan %bool %54 %float_1 + OpBranch %52 + %52 = OpLabel + %57 = OpPhi %bool %51 %47 %56 %53 + OpSelectionMerge %58 None + OpBranchConditional %57 %58 %59 + %59 = OpLabel + %60 = OpCompositeExtract %float %43 1 + %61 = OpFOrdGreaterThan %bool %60 %float_1 + OpBranch %58 + %58 = OpLabel + %62 = OpPhi %bool %57 %52 %61 %59 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpLoad %int %i + %66 = OpIAdd %int %65 %int_1 + OpStore %i %66 + OpBranch %33 + %63 = OpLabel + %68 = OpLoad %11 %Sampler + %69 = OpLoad %14 %depthTexture + %70 = OpSampledImage %23 %69 %68 + %71 = OpVectorShuffle %v2float %43 %43 0 1 + %67 = OpImageSampleImplicitLod %v4float %70 %71 + %72 = OpCompositeExtract %float %67 0 + %73 = OpLoad %int %i + %74 = OpIAdd %int %73 %int_1 + OpStore %i %74 + OpBranch %33 %33 = OpLabel - OpReturnValue %76 + OpBranch %31 + %32 = OpLabel + OpReturnValue %75 OpFunctionEnd - %main = OpFunction %void None %77 - %80 = OpLabel - %82 = OpLoad %v2float %vUV_1 - %81 = OpFunctionCall %v4float %main_inner %82 - OpStore %value %81 + %main = OpFunction %void None %76 + %79 = OpLabel + %81 = OpLoad %v2float %vUV_1 + %80 = OpFunctionCall %v4float %main_inner %81 + OpStore %value %80 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.wgsl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.wgsl index 0998c72f76..1c743a40ad 100644 --- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.wgsl @@ -1,10 +1,22 @@ +bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow + let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r; + ^^^^^^^^^^^^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value + if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) { + ^^ + +bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform + let random: vec3 = textureSample(randomTexture, Sampler, vUV).rgb; + ^^^^^^^^^^^^^ + @group(0) @binding(0) var Sampler : sampler; @group(0) @binding(1) var randomTexture : texture_2d; @group(0) @binding(2) var depthTexture : texture_2d; -@stage(fragment) +@fragment fn main(@location(0) vUV : vec2) -> @location(0) vec4 { let random : vec3 = textureSample(randomTexture, Sampler, vUV).rgb; var i = 0; diff --git a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl index 4ac0a51ce2..7008e7853a 100644 --- a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl +++ b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl @@ -16,7 +16,7 @@ struct Particles { @group(1) @binding(3) var particles : Particles; @group(1) @binding(4) var sim : Simulation; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var particle = particles.p[0]; particle.position[sim.i] = particle.position[sim.i]; diff --git a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8167f72278 --- /dev/null +++ b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +struct Particle { + float3 position[8]; + float lifetime; + float4 color; + float3 velocity; +}; + +ByteAddressBuffer particles : register(t3, space1); +cbuffer cbuffer_sim : register(b4, space1) { + uint4 sim[1]; +}; + +typedef float3 tint_symbol_3_ret[8]; +tint_symbol_3_ret tint_symbol_3(ByteAddressBuffer buffer, uint offset) { + float3 arr[8] = (float3[8])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 8u); i_1 = (i_1 + 1u)) { + arr[i_1] = asfloat(buffer.Load3((offset + (i_1 * 16u)))); + } + } + return arr; +} + +Particle tint_symbol_2(ByteAddressBuffer buffer, uint offset) { + const Particle tint_symbol_8 = {tint_symbol_3(buffer, (offset + 0u)), asfloat(buffer.Load((offset + 128u))), asfloat(buffer.Load4((offset + 144u))), asfloat(buffer.Load3((offset + 160u)))}; + return tint_symbol_8; +} + +[numthreads(1, 1, 1)] +void main() { + Particle particle = tint_symbol_2(particles, 0u); + { + float3 tint_symbol_1[8] = particle.position; + tint_symbol_1[sim[0].x] = particle.position[sim[0].x]; + particle.position = tint_symbol_1; + } + return; +} diff --git a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8167f72278 --- /dev/null +++ b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +struct Particle { + float3 position[8]; + float lifetime; + float4 color; + float3 velocity; +}; + +ByteAddressBuffer particles : register(t3, space1); +cbuffer cbuffer_sim : register(b4, space1) { + uint4 sim[1]; +}; + +typedef float3 tint_symbol_3_ret[8]; +tint_symbol_3_ret tint_symbol_3(ByteAddressBuffer buffer, uint offset) { + float3 arr[8] = (float3[8])0; + { + [loop] for(uint i_1 = 0u; (i_1 < 8u); i_1 = (i_1 + 1u)) { + arr[i_1] = asfloat(buffer.Load3((offset + (i_1 * 16u)))); + } + } + return arr; +} + +Particle tint_symbol_2(ByteAddressBuffer buffer, uint offset) { + const Particle tint_symbol_8 = {tint_symbol_3(buffer, (offset + 0u)), asfloat(buffer.Load((offset + 128u))), asfloat(buffer.Load4((offset + 144u))), asfloat(buffer.Load3((offset + 160u)))}; + return tint_symbol_8; +} + +[numthreads(1, 1, 1)] +void main() { + Particle particle = tint_symbol_2(particles, 0u); + { + float3 tint_symbol_1[8] = particle.position; + tint_symbol_1[sim[0].x] = particle.position[sim[0].x]; + particle.position = tint_symbol_1; + } + return; +} diff --git a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.hlsl b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.hlsl deleted file mode 100644 index e1302946cf..0000000000 --- a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -struct Particle { - float3 position[8]; - float lifetime; - float4 color; - float3 velocity; -}; - -ByteAddressBuffer particles : register(t3, space1); -cbuffer cbuffer_sim : register(b4, space1) { - uint4 sim[1]; -}; - -typedef float3 tint_symbol_3_ret[8]; -tint_symbol_3_ret tint_symbol_3(ByteAddressBuffer buffer, uint offset) { - float3 arr[8] = (float3[8])0; - { - [loop] for(uint i_1 = 0u; (i_1 < 8u); i_1 = (i_1 + 1u)) { - arr[i_1] = asfloat(buffer.Load3((offset + (i_1 * 16u)))); - } - } - return arr; -} - -Particle tint_symbol_2(ByteAddressBuffer buffer, uint offset) { - const Particle tint_symbol_8 = {tint_symbol_3(buffer, (offset + 0u)), asfloat(buffer.Load((offset + 128u))), asfloat(buffer.Load4((offset + 144u))), asfloat(buffer.Load3((offset + 160u)))}; - return tint_symbol_8; -} - -[numthreads(1, 1, 1)] -void main() { - Particle particle = tint_symbol_2(particles, (176u * uint(0))); - { - float3 tint_symbol_1[8] = particle.position; - tint_symbol_1[sim[0].x] = particle.position[sim[0].x]; - particle.position = tint_symbol_1; - } - return; -} diff --git a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.msl b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.msl index de2ff47c0b..6507f5803f 100644 --- a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.msl +++ b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.msl @@ -2,6 +2,18 @@ using namespace metal; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + template inline vec operator*(matrix lhs, packed_vec rhs) { return lhs * vec(rhs); @@ -16,26 +28,22 @@ struct Simulation { /* 0x0000 */ uint i; }; -struct tint_array_wrapper { - /* 0x0000 */ float3 arr[8]; -}; - struct Particle { - /* 0x0000 */ tint_array_wrapper position; + /* 0x0000 */ tint_array position; /* 0x0080 */ float lifetime; - /* 0x0084 */ int8_t tint_pad[12]; + /* 0x0084 */ tint_array tint_pad; /* 0x0090 */ float4 color; /* 0x00a0 */ packed_float3 velocity; - /* 0x00ac */ int8_t tint_pad_1[4]; + /* 0x00ac */ tint_array tint_pad_1; }; struct Particles { - /* 0x0000 */ Particle p[1]; + /* 0x0000 */ tint_array p; }; kernel void tint_symbol(const device Particles* tint_symbol_1 [[buffer(1)]], const constant Simulation* tint_symbol_2 [[buffer(0)]]) { Particle particle = (*(tint_symbol_1)).p[0]; - particle.position.arr[(*(tint_symbol_2)).i] = particle.position.arr[(*(tint_symbol_2)).i]; + particle.position[(*(tint_symbol_2)).i] = particle.position[(*(tint_symbol_2)).i]; return; } diff --git a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.spvasm b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.spvasm index 68c8ccd8a1..7a4afd73a8 100644 --- a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.spvasm @@ -54,7 +54,7 @@ %15 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %21 = OpConstantNull %int %_ptr_StorageBuffer_Particle = OpTypePointer StorageBuffer %Particle %_ptr_Function_Particle = OpTypePointer Function %Particle %27 = OpConstantNull %Particle @@ -63,7 +63,7 @@ %main = OpFunction %void None %15 %18 = OpLabel %particle = OpVariable %_ptr_Function_Particle Function %27 - %23 = OpAccessChain %_ptr_StorageBuffer_Particle %particles %uint_0 %int_0 + %23 = OpAccessChain %_ptr_StorageBuffer_Particle %particles %uint_0 %21 %24 = OpLoad %Particle %23 OpStore %particle %24 %29 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0 diff --git a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.wgsl b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.wgsl index 25f718b317..d27f5567ee 100644 --- a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.wgsl @@ -17,7 +17,7 @@ struct Particles { @group(1) @binding(4) var sim : Simulation; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var particle = particles.p[0]; particle.position[sim.i] = particle.position[sim.i]; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl index 2e7870bfb2..934ac92724 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl @@ -5,7 +5,7 @@ @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m1 : mat2x4; m1[uniforms.i][0] = 1.0; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.hlsl rename to test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d9c9833994 --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + set_scalar_float2x4(m1, 0, uniforms[0].x, 1.0f); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.spvasm index c2b242a8ee..808ef9122f 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.spvasm @@ -33,7 +33,7 @@ %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %20 = OpConstantNull %int %_ptr_Function_float = OpTypePointer Function %float %float_1 = OpConstant %float 1 %main = OpFunction %void None %5 @@ -41,7 +41,7 @@ %m1 = OpVariable %_ptr_Function_mat2v4float Function %14 %17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %18 = OpLoad %uint %17 - %22 = OpAccessChain %_ptr_Function_float %m1 %18 %int_0 + %22 = OpAccessChain %_ptr_Function_float %m1 %18 %20 OpStore %22 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.wgsl index 03abbbb0dc..b3f2644c77 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct Uniforms { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m1 : mat2x4; m1[uniforms.i][0] = 1.0; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl index 11678921c3..8384885433 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl @@ -5,7 +5,7 @@ @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m1 : mat2x4; m1[uniforms.i][uniforms.j] = 1.0; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.hlsl rename to test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..254519f61e --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + set_scalar_float2x4(m1, uniforms[0].y, uniforms[0].x, 1.0f); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.wgsl index 76c2e489c4..2d7f64566c 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct Uniforms { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m1 : mat2x4; m1[uniforms.i][uniforms.j] = 1.0; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl index 138c9a7c34..15112c5d00 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl @@ -7,7 +7,7 @@ var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[0][uniforms.j] = 1.0; } diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.hlsl rename to test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.hlsl rename to test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.fxc.hlsl diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.spvasm index 3f68ce15e1..9f46f7d0a7 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.spvasm @@ -32,7 +32,7 @@ %void = OpTypeVoid %11 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %16 = OpConstantNull %int %uint_1 = OpConstant %uint 1 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Private_float = OpTypePointer Private %float @@ -41,7 +41,7 @@ %14 = OpLabel %19 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %20 = OpLoad %uint %19 - %22 = OpAccessChain %_ptr_Private_float %m1 %int_0 %20 + %22 = OpAccessChain %_ptr_Private_float %m1 %16 %20 OpStore %22 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.wgsl index f58814701d..24e47abc17 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct Uniforms { var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[0][uniforms.j] = 1.0; } diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl index e531d92d9c..4e51c4e356 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl @@ -5,7 +5,7 @@ @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m1 : mat2x4; m1[uniforms.i] = vec4(1.0); diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c4a4418bfa --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { + switch (col) { + case 0: mat[0] = val; break; + case 1: mat[1] = val; break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c4a4418bfa --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { + switch (col) { + case 0: mat[0] = val; break; + case 1: mat[1] = val; break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.hlsl deleted file mode 100644 index 4b5af7190b..0000000000 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.hlsl +++ /dev/null @@ -1,17 +0,0 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { - switch (col) { - case 0: mat[0] = val; break; - case 1: mat[1] = val; break; - } -} - -cbuffer cbuffer_uniforms : register(b4, space1) { - uint4 uniforms[1]; -}; - -[numthreads(1, 1, 1)] -void main() { - float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - set_vector_float2x4(m1, uniforms[0].x, float4((1.0f).xxxx)); - return; -} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.wgsl index d03625decf..fa5e1121e2 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct Uniforms { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m1 : mat2x4; m1[uniforms.i] = vec4(1.0); diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl index 0ec75d9e54..8d866e9a4a 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl @@ -7,7 +7,7 @@ var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[uniforms.i][0] = 1.0; } diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.hlsl rename to test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c52f157379 --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; +static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + +[numthreads(1, 1, 1)] +void main() { + set_scalar_float2x4(m1, 0, uniforms[0].x, 1.0f); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.spvasm index b2bb365694..7b3fc5cd69 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.spvasm @@ -34,14 +34,14 @@ %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %20 = OpConstantNull %int %_ptr_Private_float = OpTypePointer Private %float %float_1 = OpConstant %float 1 %main = OpFunction %void None %11 %14 = OpLabel %17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %18 = OpLoad %uint %17 - %22 = OpAccessChain %_ptr_Private_float %m1 %18 %int_0 + %22 = OpAccessChain %_ptr_Private_float %m1 %18 %20 OpStore %22 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.wgsl index 4f4c665e47..ec0a575b00 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct Uniforms { var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[uniforms.i][0] = 1.0; } diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl index 89630b73a6..324ba03a32 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl @@ -7,7 +7,7 @@ var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[uniforms.i][uniforms.j] = 1.0; } diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.hlsl rename to test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1487ddd1d9 --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; +static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + +[numthreads(1, 1, 1)] +void main() { + set_scalar_float2x4(m1, uniforms[0].y, uniforms[0].x, 1.0f); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.wgsl index 931ae51dd4..a231286d95 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct Uniforms { var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[uniforms.i][uniforms.j] = 1.0; } diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl index 138c9a7c34..15112c5d00 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl @@ -7,7 +7,7 @@ var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[0][uniforms.j] = 1.0; } diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..75a62179b4 --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.dxc.hlsl @@ -0,0 +1,21 @@ +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; +static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + +[numthreads(1, 1, 1)] +void main() { + set_scalar_float2x4(m1, uniforms[0].y, 0, 1.0f); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..75a62179b4 --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; +static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + +[numthreads(1, 1, 1)] +void main() { + set_scalar_float2x4(m1, uniforms[0].y, 0, 1.0f); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.spvasm index 3f68ce15e1..9f46f7d0a7 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.spvasm @@ -32,7 +32,7 @@ %void = OpTypeVoid %11 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %16 = OpConstantNull %int %uint_1 = OpConstant %uint 1 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Private_float = OpTypePointer Private %float @@ -41,7 +41,7 @@ %14 = OpLabel %19 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 %20 = OpLoad %uint %19 - %22 = OpAccessChain %_ptr_Private_float %m1 %int_0 %20 + %22 = OpAccessChain %_ptr_Private_float %m1 %16 %20 OpStore %22 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.wgsl index f58814701d..24e47abc17 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct Uniforms { var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[0][uniforms.j] = 1.0; } diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl index 31cee85a6f..0c80983ceb 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl @@ -7,7 +7,7 @@ var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[uniforms.i] = vec4(1.0); } diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..263c2bc023 --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { + switch (col) { + case 0: mat[0] = val; break; + case 1: mat[1] = val; break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; +static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + +[numthreads(1, 1, 1)] +void main() { + set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..263c2bc023 --- /dev/null +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { + switch (col) { + case 0: mat[0] = val; break; + case 1: mat[1] = val; break; + } +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; +static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + +[numthreads(1, 1, 1)] +void main() { + set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx); + return; +} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.hlsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.hlsl deleted file mode 100644 index bf033730c7..0000000000 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.hlsl +++ /dev/null @@ -1,17 +0,0 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { - switch (col) { - case 0: mat[0] = val; break; - case 1: mat[1] = val; break; - } -} - -cbuffer cbuffer_uniforms : register(b4, space1) { - uint4 uniforms[1]; -}; -static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - -[numthreads(1, 1, 1)] -void main() { - set_vector_float2x4(m1, uniforms[0].x, float4((1.0f).xxxx)); - return; -} diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.wgsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.wgsl index 913ff02d7d..7ca896fddc 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct Uniforms { var m1 : mat2x4; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { m1[uniforms.i] = vec4(1.0); } diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl index 82fdac2ce1..9dd26c78d8 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl @@ -12,7 +12,7 @@ fn foo() { } } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { for (var i : i32 = 0; i < 2; i = i + 1) { diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.hlsl rename to test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..00000e97cd --- /dev/null +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_int3(inout int3 vec, int idx, int val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_uint4(inout uint4 vec, int idx, uint val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_bool2(inout bool2 vec, int idx, bool val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +static float2 v2f = float2(0.0f, 0.0f); +static int3 v3i = int3(0, 0, 0); +static uint4 v4u = uint4(0u, 0u, 0u, 0u); +static bool2 v2b = bool2(false, false); + +void foo() { + { + [loop] for(int i = 0; (i < 2); i = (i + 1)) { + set_float2(v2f, i, 1.0f); + set_int3(v3i, i, 1); + set_uint4(v4u, i, 1u); + set_bool2(v2b, i, true); + } + } +} + +[numthreads(1, 1, 1)] +void main() { + { + [loop] for(int i = 0; (i < 2); i = (i + 1)) { + foo(); + } + } + return; +} diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.msl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.msl index 1e1cbee395..e30b1c16c8 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.msl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.msl @@ -1,22 +1,22 @@ #include using namespace metal; -void foo(thread float2* const tint_symbol_1, thread int3* const tint_symbol_2, thread uint4* const tint_symbol_3, thread bool2* const tint_symbol_4) { +void foo() { + thread float2 tint_symbol_1 = 0.0f; + thread int3 tint_symbol_2 = 0; + thread uint4 tint_symbol_3 = 0u; + thread bool2 tint_symbol_4 = false; for(int i = 0; (i < 2); i = as_type((as_type(i) + as_type(1)))) { - (*(tint_symbol_1))[i] = 1.0f; - (*(tint_symbol_2))[i] = 1; - (*(tint_symbol_3))[i] = 1u; - (*(tint_symbol_4))[i] = true; + tint_symbol_1[i] = 1.0f; + tint_symbol_2[i] = 1; + tint_symbol_3[i] = 1u; + tint_symbol_4[i] = true; } } kernel void tint_symbol() { - thread float2 tint_symbol_5 = 0.0f; - thread int3 tint_symbol_6 = 0; - thread uint4 tint_symbol_7 = 0u; - thread bool2 tint_symbol_8 = false; for(int i = 0; (i < 2); i = as_type((as_type(i) + as_type(1)))) { - foo(&(tint_symbol_5), &(tint_symbol_6), &(tint_symbol_7), &(tint_symbol_8)); + foo(); } return; } diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.spvasm b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.spvasm index 212a926008..647e2c72a0 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 72 +; Bound: 71 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -37,9 +37,8 @@ %v2b = OpVariable %_ptr_Private_v2bool Private %20 %void = OpTypeVoid %21 = OpTypeFunction %void - %int_0 = OpConstant %int 0 + %25 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %28 = OpConstantNull %int %int_2 = OpConstant %int 2 %_ptr_Private_float = OpTypePointer Private %float %float_1 = OpConstant %float 1 @@ -51,66 +50,66 @@ %true = OpConstantTrue %bool %foo = OpFunction %void None %21 %24 = OpLabel - %i = OpVariable %_ptr_Function_int Function %28 - OpStore %i %int_0 - OpBranch %29 - %29 = OpLabel - OpLoopMerge %30 %31 None - OpBranch %32 - %32 = OpLabel - %34 = OpLoad %int %i - %36 = OpSLessThan %bool %34 %int_2 - %33 = OpLogicalNot %bool %36 - OpSelectionMerge %37 None - OpBranchConditional %33 %38 %37 - %38 = OpLabel - OpBranch %30 - %37 = OpLabel - %39 = OpLoad %int %i - %41 = OpAccessChain %_ptr_Private_float %v2f %39 - OpStore %41 %float_1 - %43 = OpLoad %int %i - %45 = OpAccessChain %_ptr_Private_int %v3i %43 - OpStore %45 %int_1 - %47 = OpLoad %int %i - %49 = OpAccessChain %_ptr_Private_uint %v4u %47 - OpStore %49 %uint_1 - %51 = OpLoad %int %i - %53 = OpAccessChain %_ptr_Private_bool %v2b %51 - OpStore %53 %true + %i = OpVariable %_ptr_Function_int Function %25 + OpStore %i %25 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None OpBranch %31 %31 = OpLabel - %55 = OpLoad %int %i - %56 = OpIAdd %int %55 %int_1 - OpStore %i %56 + %33 = OpLoad %int %i + %35 = OpSLessThan %bool %33 %int_2 + %32 = OpLogicalNot %bool %35 + OpSelectionMerge %36 None + OpBranchConditional %32 %37 %36 + %37 = OpLabel OpBranch %29 + %36 = OpLabel + %38 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Private_float %v2f %38 + OpStore %40 %float_1 + %42 = OpLoad %int %i + %44 = OpAccessChain %_ptr_Private_int %v3i %42 + OpStore %44 %int_1 + %46 = OpLoad %int %i + %48 = OpAccessChain %_ptr_Private_uint %v4u %46 + OpStore %48 %uint_1 + %50 = OpLoad %int %i + %52 = OpAccessChain %_ptr_Private_bool %v2b %50 + OpStore %52 %true + OpBranch %30 %30 = OpLabel + %54 = OpLoad %int %i + %55 = OpIAdd %int %54 %int_1 + OpStore %i %55 + OpBranch %28 + %29 = OpLabel OpReturn OpFunctionEnd %main = OpFunction %void None %21 - %58 = OpLabel - %i_0 = OpVariable %_ptr_Function_int Function %28 - OpStore %i_0 %int_0 - OpBranch %60 - %60 = OpLabel - OpLoopMerge %61 %62 None - OpBranch %63 - %63 = OpLabel - %65 = OpLoad %int %i_0 - %66 = OpSLessThan %bool %65 %int_2 - %64 = OpLogicalNot %bool %66 - OpSelectionMerge %67 None - OpBranchConditional %64 %68 %67 - %68 = OpLabel - OpBranch %61 - %67 = OpLabel - %69 = OpFunctionCall %void %foo + %57 = OpLabel + %i_0 = OpVariable %_ptr_Function_int Function %25 + OpStore %i_0 %25 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None OpBranch %62 %62 = OpLabel - %70 = OpLoad %int %i_0 - %71 = OpIAdd %int %70 %int_1 - OpStore %i_0 %71 + %64 = OpLoad %int %i_0 + %65 = OpSLessThan %bool %64 %int_2 + %63 = OpLogicalNot %bool %65 + OpSelectionMerge %66 None + OpBranchConditional %63 %67 %66 + %67 = OpLabel OpBranch %60 + %66 = OpLabel + %68 = OpFunctionCall %void %foo + OpBranch %61 %61 = OpLabel + %69 = OpLoad %int %i_0 + %70 = OpIAdd %int %69 %int_1 + OpStore %i_0 %70 + OpBranch %59 + %60 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.wgsl index be75b1848b..4bac1fdac0 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_loop.wgsl.expected.wgsl @@ -15,7 +15,7 @@ fn foo() { } } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { for(var i : i32 = 0; (i < 2); i = (i + 1)) { foo(); diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl index f7d64cdb94..02b5ab0f65 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl @@ -11,7 +11,7 @@ fn foo() { v2b[i] = true; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { for (var i : i32 = 0; i < 2; i = i + 1) { diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.hlsl rename to test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc096ac700 --- /dev/null +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_int3(inout int3 vec, int idx, int val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_uint4(inout uint4 vec, int idx, uint val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_bool2(inout bool2 vec, int idx, bool val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +static float2 v2f = float2(0.0f, 0.0f); +static int3 v3i = int3(0, 0, 0); +static uint4 v4u = uint4(0u, 0u, 0u, 0u); +static bool2 v2b = bool2(false, false); + +void foo() { + int i = 0; + set_float2(v2f, i, 1.0f); + set_int3(v3i, i, 1); + set_uint4(v4u, i, 1u); + set_bool2(v2b, i, true); +} + +[numthreads(1, 1, 1)] +void main() { + { + [loop] for(int i = 0; (i < 2); i = (i + 1)) { + foo(); + } + } + return; +} diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.msl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.msl index ec498ee014..920f566342 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.msl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.msl @@ -1,21 +1,21 @@ #include using namespace metal; -void foo(thread float2* const tint_symbol_1, thread int3* const tint_symbol_2, thread uint4* const tint_symbol_3, thread bool2* const tint_symbol_4) { +void foo() { + thread float2 tint_symbol_1 = 0.0f; + thread int3 tint_symbol_2 = 0; + thread uint4 tint_symbol_3 = 0u; + thread bool2 tint_symbol_4 = false; int i = 0; - (*(tint_symbol_1))[i] = 1.0f; - (*(tint_symbol_2))[i] = 1; - (*(tint_symbol_3))[i] = 1u; - (*(tint_symbol_4))[i] = true; + tint_symbol_1[i] = 1.0f; + tint_symbol_2[i] = 1; + tint_symbol_3[i] = 1u; + tint_symbol_4[i] = true; } kernel void tint_symbol() { - thread float2 tint_symbol_5 = 0.0f; - thread int3 tint_symbol_6 = 0; - thread uint4 tint_symbol_7 = 0u; - thread bool2 tint_symbol_8 = false; for(int i = 0; (i < 2); i = as_type((as_type(i) + as_type(1)))) { - foo(&(tint_symbol_5), &(tint_symbol_6), &(tint_symbol_7), &(tint_symbol_8)); + foo(); } return; } diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.spvasm b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.spvasm index d0b731b01a..f2cdc97c9f 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 61 +; Bound: 60 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -37,9 +37,8 @@ %v2b = OpVariable %_ptr_Private_v2bool Private %20 %void = OpTypeVoid %21 = OpTypeFunction %void - %int_0 = OpConstant %int 0 + %25 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %28 = OpConstantNull %int %_ptr_Private_float = OpTypePointer Private %float %float_1 = OpConstant %float 1 %_ptr_Private_int = OpTypePointer Private %int @@ -51,46 +50,46 @@ %int_2 = OpConstant %int 2 %foo = OpFunction %void None %21 %24 = OpLabel - %i = OpVariable %_ptr_Function_int Function %28 - OpStore %i %int_0 - %29 = OpLoad %int %i - %31 = OpAccessChain %_ptr_Private_float %v2f %29 - OpStore %31 %float_1 - %33 = OpLoad %int %i - %35 = OpAccessChain %_ptr_Private_int %v3i %33 - OpStore %35 %int_1 - %37 = OpLoad %int %i - %39 = OpAccessChain %_ptr_Private_uint %v4u %37 - OpStore %39 %uint_1 - %41 = OpLoad %int %i - %43 = OpAccessChain %_ptr_Private_bool %v2b %41 - OpStore %43 %true + %i = OpVariable %_ptr_Function_int Function %25 + OpStore %i %25 + %28 = OpLoad %int %i + %30 = OpAccessChain %_ptr_Private_float %v2f %28 + OpStore %30 %float_1 + %32 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Private_int %v3i %32 + OpStore %34 %int_1 + %36 = OpLoad %int %i + %38 = OpAccessChain %_ptr_Private_uint %v4u %36 + OpStore %38 %uint_1 + %40 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Private_bool %v2b %40 + OpStore %42 %true OpReturn OpFunctionEnd %main = OpFunction %void None %21 - %46 = OpLabel - %i_0 = OpVariable %_ptr_Function_int Function %28 - OpStore %i_0 %int_0 - OpBranch %48 - %48 = OpLabel - OpLoopMerge %49 %50 None - OpBranch %51 - %51 = OpLabel - %53 = OpLoad %int %i_0 - %55 = OpSLessThan %bool %53 %int_2 - %52 = OpLogicalNot %bool %55 - OpSelectionMerge %56 None - OpBranchConditional %52 %57 %56 - %57 = OpLabel - OpBranch %49 - %56 = OpLabel - %58 = OpFunctionCall %void %foo + %45 = OpLabel + %i_0 = OpVariable %_ptr_Function_int Function %25 + OpStore %i_0 %25 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None OpBranch %50 %50 = OpLabel - %59 = OpLoad %int %i_0 - %60 = OpIAdd %int %59 %int_1 - OpStore %i_0 %60 + %52 = OpLoad %int %i_0 + %54 = OpSLessThan %bool %52 %int_2 + %51 = OpLogicalNot %bool %54 + OpSelectionMerge %55 None + OpBranchConditional %51 %56 %55 + %56 = OpLabel OpBranch %48 + %55 = OpLabel + %57 = OpFunctionCall %void %foo + OpBranch %49 %49 = OpLabel + %58 = OpLoad %int %i_0 + %59 = OpIAdd %int %58 %int_1 + OpStore %i_0 %59 + OpBranch %47 + %48 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.wgsl index 8b055f2b13..84a1ba7b35 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_call_with_no_loop.wgsl.expected.wgsl @@ -14,7 +14,7 @@ fn foo() { v2b[i] = true; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { for(var i : i32 = 0; (i < 2); i = (i + 1)) { foo(); diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl index 51460ebd1b..d382062459 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { var v2f : vec2; var v3f : vec3; diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.hlsl rename to test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13dd87cfd2 --- /dev/null +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.fxc.hlsl @@ -0,0 +1,80 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_int2(inout int2 vec, int idx, int val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_int3(inout int3 vec, int idx, int val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_int4(inout int4 vec, int idx, int val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_uint2(inout uint2 vec, int idx, uint val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_uint3(inout uint3 vec, int idx, uint val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_uint4(inout uint4 vec, int idx, uint val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_bool2(inout bool2 vec, int idx, bool val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_bool3(inout bool3 vec, int idx, bool val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_bool4(inout bool4 vec, int idx, bool val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +[numthreads(1, 1, 1)] +void main() { + float2 v2f = float2(0.0f, 0.0f); + float3 v3f = float3(0.0f, 0.0f, 0.0f); + float4 v4f = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 v2i = int2(0, 0); + int3 v3i = int3(0, 0, 0); + int4 v4i = int4(0, 0, 0, 0); + uint2 v2u = uint2(0u, 0u); + uint3 v3u = uint3(0u, 0u, 0u); + uint4 v4u = uint4(0u, 0u, 0u, 0u); + bool2 v2b = bool2(false, false); + bool3 v3b = bool3(false, false, false); + bool4 v4b = bool4(false, false, false, false); + { + [loop] for(int i = 0; (i < 2); i = (i + 1)) { + set_float2(v2f, i, 1.0f); + set_float3(v3f, i, 1.0f); + set_float4(v4f, i, 1.0f); + set_int2(v2i, i, 1); + set_int3(v3i, i, 1); + set_int4(v4i, i, 1); + set_uint2(v2u, i, 1u); + set_uint3(v3u, i, 1u); + set_uint4(v4u, i, 1u); + set_bool2(v2b, i, true); + set_bool3(v3b, i, true); + set_bool4(v4b, i, true); + } + } + return; +} diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.spvasm b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.spvasm index 5a80cc6b72..f49873071d 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 104 +; Bound: 103 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -63,9 +63,8 @@ %v4bool = OpTypeVector %bool 4 %_ptr_Function_v4bool = OpTypePointer Function %v4bool %56 = OpConstantNull %v4bool - %int_0 = OpConstant %int 0 + %57 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %60 = OpConstantNull %int %int_2 = OpConstant %int 2 %_ptr_Function_float = OpTypePointer Function %float %float_1 = OpConstant %float 1 @@ -88,63 +87,63 @@ %v2b = OpVariable %_ptr_Function_v2bool Function %48 %v3b = OpVariable %_ptr_Function_v3bool Function %52 %v4b = OpVariable %_ptr_Function_v4bool Function %56 - %i = OpVariable %_ptr_Function_int Function %60 - OpStore %i %int_0 - OpBranch %61 - %61 = OpLabel - OpLoopMerge %62 %63 None - OpBranch %64 - %64 = OpLabel - %66 = OpLoad %int %i - %68 = OpSLessThan %bool %66 %int_2 - %65 = OpLogicalNot %bool %68 - OpSelectionMerge %69 None - OpBranchConditional %65 %70 %69 - %70 = OpLabel - OpBranch %62 - %69 = OpLabel - %71 = OpLoad %int %i - %73 = OpAccessChain %_ptr_Function_float %v2f %71 - OpStore %73 %float_1 - %75 = OpLoad %int %i - %76 = OpAccessChain %_ptr_Function_float %v3f %75 - OpStore %76 %float_1 - %77 = OpLoad %int %i - %78 = OpAccessChain %_ptr_Function_float %v4f %77 - OpStore %78 %float_1 - %79 = OpLoad %int %i - %80 = OpAccessChain %_ptr_Function_int %v2i %79 - OpStore %80 %int_1 - %82 = OpLoad %int %i - %83 = OpAccessChain %_ptr_Function_int %v3i %82 - OpStore %83 %int_1 - %84 = OpLoad %int %i - %85 = OpAccessChain %_ptr_Function_int %v4i %84 - OpStore %85 %int_1 - %86 = OpLoad %int %i - %88 = OpAccessChain %_ptr_Function_uint %v2u %86 - OpStore %88 %uint_1 - %90 = OpLoad %int %i - %91 = OpAccessChain %_ptr_Function_uint %v3u %90 - OpStore %91 %uint_1 - %92 = OpLoad %int %i - %93 = OpAccessChain %_ptr_Function_uint %v4u %92 - OpStore %93 %uint_1 - %94 = OpLoad %int %i - %96 = OpAccessChain %_ptr_Function_bool %v2b %94 - OpStore %96 %true - %98 = OpLoad %int %i - %99 = OpAccessChain %_ptr_Function_bool %v3b %98 - OpStore %99 %true - %100 = OpLoad %int %i - %101 = OpAccessChain %_ptr_Function_bool %v4b %100 - OpStore %101 %true + %i = OpVariable %_ptr_Function_int Function %57 + OpStore %i %57 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None OpBranch %63 %63 = OpLabel - %102 = OpLoad %int %i - %103 = OpIAdd %int %102 %int_1 - OpStore %i %103 + %65 = OpLoad %int %i + %67 = OpSLessThan %bool %65 %int_2 + %64 = OpLogicalNot %bool %67 + OpSelectionMerge %68 None + OpBranchConditional %64 %69 %68 + %69 = OpLabel OpBranch %61 + %68 = OpLabel + %70 = OpLoad %int %i + %72 = OpAccessChain %_ptr_Function_float %v2f %70 + OpStore %72 %float_1 + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Function_float %v3f %74 + OpStore %75 %float_1 + %76 = OpLoad %int %i + %77 = OpAccessChain %_ptr_Function_float %v4f %76 + OpStore %77 %float_1 + %78 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Function_int %v2i %78 + OpStore %79 %int_1 + %81 = OpLoad %int %i + %82 = OpAccessChain %_ptr_Function_int %v3i %81 + OpStore %82 %int_1 + %83 = OpLoad %int %i + %84 = OpAccessChain %_ptr_Function_int %v4i %83 + OpStore %84 %int_1 + %85 = OpLoad %int %i + %87 = OpAccessChain %_ptr_Function_uint %v2u %85 + OpStore %87 %uint_1 + %89 = OpLoad %int %i + %90 = OpAccessChain %_ptr_Function_uint %v3u %89 + OpStore %90 %uint_1 + %91 = OpLoad %int %i + %92 = OpAccessChain %_ptr_Function_uint %v4u %91 + OpStore %92 %uint_1 + %93 = OpLoad %int %i + %95 = OpAccessChain %_ptr_Function_bool %v2b %93 + OpStore %95 %true + %97 = OpLoad %int %i + %98 = OpAccessChain %_ptr_Function_bool %v3b %97 + OpStore %98 %true + %99 = OpLoad %int %i + %100 = OpAccessChain %_ptr_Function_bool %v4b %99 + OpStore %100 %true + OpBranch %62 %62 = OpLabel + %101 = OpLoad %int %i + %102 = OpIAdd %int %101 %int_1 + OpStore %i %102 + OpBranch %60 + %61 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.wgsl index 45acb5d00a..8c4a734ddf 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_all.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { var v2f : vec2; var v3f : vec3; diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl index beeaa2cbe0..eda040dce9 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { var v2f : vec2; var v2f_2 : vec2; diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.hlsl rename to test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c3db07790 --- /dev/null +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_int3(inout int3 vec, int idx, int val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_uint4(inout uint4 vec, int idx, uint val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_bool2(inout bool2 vec, int idx, bool val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +[numthreads(1, 1, 1)] +void main() { + float2 v2f = float2(0.0f, 0.0f); + float2 v2f_2 = float2(0.0f, 0.0f); + int3 v3i = int3(0, 0, 0); + int3 v3i_2 = int3(0, 0, 0); + uint4 v4u = uint4(0u, 0u, 0u, 0u); + uint4 v4u_2 = uint4(0u, 0u, 0u, 0u); + bool2 v2b = bool2(false, false); + bool2 v2b_2 = bool2(false, false); + { + [loop] for(int i = 0; (i < 2); i = (i + 1)) { + set_float2(v2f, i, 1.0f); + set_int3(v3i, i, 1); + set_uint4(v4u, i, 1u); + set_bool2(v2b, i, true); + set_float2(v2f_2, i, 1.0f); + set_int3(v3i_2, i, 1); + set_uint4(v4u_2, i, 1u); + set_bool2(v2b_2, i, true); + } + } + return; +} diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.spvasm b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.spvasm index ee5714c43e..828eea3786 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 68 +; Bound: 67 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -35,9 +35,8 @@ %v2bool = OpTypeVector %bool 2 %_ptr_Function_v2bool = OpTypePointer Function %v2bool %27 = OpConstantNull %v2bool - %int_0 = OpConstant %int 0 + %29 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %32 = OpConstantNull %int %int_2 = OpConstant %int 2 %_ptr_Function_float = OpTypePointer Function %float %float_1 = OpConstant %float 1 @@ -56,51 +55,51 @@ %v4u_2 = OpVariable %_ptr_Function_v4uint Function %21 %v2b = OpVariable %_ptr_Function_v2bool Function %27 %v2b_2 = OpVariable %_ptr_Function_v2bool Function %27 - %i = OpVariable %_ptr_Function_int Function %32 - OpStore %i %int_0 - OpBranch %33 - %33 = OpLabel - OpLoopMerge %34 %35 None - OpBranch %36 - %36 = OpLabel - %38 = OpLoad %int %i - %40 = OpSLessThan %bool %38 %int_2 - %37 = OpLogicalNot %bool %40 - OpSelectionMerge %41 None - OpBranchConditional %37 %42 %41 - %42 = OpLabel - OpBranch %34 - %41 = OpLabel - %43 = OpLoad %int %i - %45 = OpAccessChain %_ptr_Function_float %v2f %43 - OpStore %45 %float_1 - %47 = OpLoad %int %i - %48 = OpAccessChain %_ptr_Function_int %v3i %47 - OpStore %48 %int_1 - %50 = OpLoad %int %i - %52 = OpAccessChain %_ptr_Function_uint %v4u %50 - OpStore %52 %uint_1 - %54 = OpLoad %int %i - %56 = OpAccessChain %_ptr_Function_bool %v2b %54 - OpStore %56 %true - %58 = OpLoad %int %i - %59 = OpAccessChain %_ptr_Function_float %v2f_2 %58 - OpStore %59 %float_1 - %60 = OpLoad %int %i - %61 = OpAccessChain %_ptr_Function_int %v3i_2 %60 - OpStore %61 %int_1 - %62 = OpLoad %int %i - %63 = OpAccessChain %_ptr_Function_uint %v4u_2 %62 - OpStore %63 %uint_1 - %64 = OpLoad %int %i - %65 = OpAccessChain %_ptr_Function_bool %v2b_2 %64 - OpStore %65 %true + %i = OpVariable %_ptr_Function_int Function %29 + OpStore %i %29 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None OpBranch %35 %35 = OpLabel - %66 = OpLoad %int %i - %67 = OpIAdd %int %66 %int_1 - OpStore %i %67 + %37 = OpLoad %int %i + %39 = OpSLessThan %bool %37 %int_2 + %36 = OpLogicalNot %bool %39 + OpSelectionMerge %40 None + OpBranchConditional %36 %41 %40 + %41 = OpLabel OpBranch %33 + %40 = OpLabel + %42 = OpLoad %int %i + %44 = OpAccessChain %_ptr_Function_float %v2f %42 + OpStore %44 %float_1 + %46 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Function_int %v3i %46 + OpStore %47 %int_1 + %49 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Function_uint %v4u %49 + OpStore %51 %uint_1 + %53 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Function_bool %v2b %53 + OpStore %55 %true + %57 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Function_float %v2f_2 %57 + OpStore %58 %float_1 + %59 = OpLoad %int %i + %60 = OpAccessChain %_ptr_Function_int %v3i_2 %59 + OpStore %60 %int_1 + %61 = OpLoad %int %i + %62 = OpAccessChain %_ptr_Function_uint %v4u_2 %61 + OpStore %62 %uint_1 + %63 = OpLoad %int %i + %64 = OpAccessChain %_ptr_Function_bool %v2b_2 %63 + OpStore %64 %true + OpBranch %34 %34 = OpLabel + %65 = OpLoad %int %i + %66 = OpIAdd %int %65 %int_1 + OpStore %i %66 + OpBranch %32 + %33 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.wgsl index 659db4954e..2776a1887a 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_repeated.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { var v2f : vec2; var v2f_2 : vec2; diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl index c48c1a8cd1..56f5adc56a 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { var v2f : vec2; var v3f : vec3; diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.hlsl rename to test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0740864c6c --- /dev/null +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.fxc.hlsl @@ -0,0 +1,81 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_int2(inout int2 vec, int idx, int val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_uint2(inout uint2 vec, int idx, uint val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_bool2(inout bool2 vec, int idx, bool val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_int3(inout int3 vec, int idx, int val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_int4(inout int4 vec, int idx, int val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_uint3(inout uint3 vec, int idx, uint val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_uint4(inout uint4 vec, int idx, uint val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_bool3(inout bool3 vec, int idx, bool val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_bool4(inout bool4 vec, int idx, bool val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +[numthreads(1, 1, 1)] +void main() { + float2 v2f = float2(0.0f, 0.0f); + float3 v3f = float3(0.0f, 0.0f, 0.0f); + float4 v4f = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 v2i = int2(0, 0); + int3 v3i = int3(0, 0, 0); + int4 v4i = int4(0, 0, 0, 0); + uint2 v2u = uint2(0u, 0u); + uint3 v3u = uint3(0u, 0u, 0u); + uint4 v4u = uint4(0u, 0u, 0u, 0u); + bool2 v2b = bool2(false, false); + bool3 v3b = bool3(false, false, false); + bool4 v4b = bool4(false, false, false, false); + { + [loop] for(int i = 0; (i < 2); i = (i + 1)) { + set_float2(v2f, i, 1.0f); + set_int2(v2i, i, 1); + set_uint2(v2u, i, 1u); + set_bool2(v2b, i, true); + } + } + int i = 0; + set_float3(v3f, i, 1.0f); + set_float4(v4f, i, 1.0f); + set_int3(v3i, i, 1); + set_int4(v4i, i, 1); + set_uint3(v3u, i, 1u); + set_uint4(v4u, i, 1u); + set_bool3(v3b, i, true); + set_bool4(v4b, i, true); + return; +} diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.spvasm b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.spvasm index d2938bbe2c..200f46f245 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 105 +; Bound: 104 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -64,9 +64,8 @@ %v4bool = OpTypeVector %bool 4 %_ptr_Function_v4bool = OpTypePointer Function %v4bool %56 = OpConstantNull %v4bool - %int_0 = OpConstant %int 0 + %57 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %60 = OpConstantNull %int %int_2 = OpConstant %int 2 %_ptr_Function_float = OpTypePointer Function %float %float_1 = OpConstant %float 1 @@ -89,65 +88,65 @@ %v2b = OpVariable %_ptr_Function_v2bool Function %48 %v3b = OpVariable %_ptr_Function_v3bool Function %52 %v4b = OpVariable %_ptr_Function_v4bool Function %56 - %i = OpVariable %_ptr_Function_int Function %60 - %i_0 = OpVariable %_ptr_Function_int Function %60 - OpStore %i %int_0 - OpBranch %61 - %61 = OpLabel - OpLoopMerge %62 %63 None - OpBranch %64 - %64 = OpLabel - %66 = OpLoad %int %i - %68 = OpSLessThan %bool %66 %int_2 - %65 = OpLogicalNot %bool %68 - OpSelectionMerge %69 None - OpBranchConditional %65 %70 %69 - %70 = OpLabel - OpBranch %62 - %69 = OpLabel - %71 = OpLoad %int %i - %73 = OpAccessChain %_ptr_Function_float %v2f %71 - OpStore %73 %float_1 - %75 = OpLoad %int %i - %76 = OpAccessChain %_ptr_Function_int %v2i %75 - OpStore %76 %int_1 - %78 = OpLoad %int %i - %80 = OpAccessChain %_ptr_Function_uint %v2u %78 - OpStore %80 %uint_1 - %82 = OpLoad %int %i - %84 = OpAccessChain %_ptr_Function_bool %v2b %82 - OpStore %84 %true + %i = OpVariable %_ptr_Function_int Function %57 + %i_0 = OpVariable %_ptr_Function_int Function %57 + OpStore %i %57 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None OpBranch %63 %63 = OpLabel - %86 = OpLoad %int %i - %87 = OpIAdd %int %86 %int_1 - OpStore %i %87 + %65 = OpLoad %int %i + %67 = OpSLessThan %bool %65 %int_2 + %64 = OpLogicalNot %bool %67 + OpSelectionMerge %68 None + OpBranchConditional %64 %69 %68 + %69 = OpLabel OpBranch %61 + %68 = OpLabel + %70 = OpLoad %int %i + %72 = OpAccessChain %_ptr_Function_float %v2f %70 + OpStore %72 %float_1 + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Function_int %v2i %74 + OpStore %75 %int_1 + %77 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Function_uint %v2u %77 + OpStore %79 %uint_1 + %81 = OpLoad %int %i + %83 = OpAccessChain %_ptr_Function_bool %v2b %81 + OpStore %83 %true + OpBranch %62 %62 = OpLabel - OpStore %i_0 %int_0 - %89 = OpLoad %int %i_0 - %90 = OpAccessChain %_ptr_Function_float %v3f %89 - OpStore %90 %float_1 - %91 = OpLoad %int %i_0 - %92 = OpAccessChain %_ptr_Function_float %v4f %91 - OpStore %92 %float_1 - %93 = OpLoad %int %i_0 - %94 = OpAccessChain %_ptr_Function_int %v3i %93 - OpStore %94 %int_1 - %95 = OpLoad %int %i_0 - %96 = OpAccessChain %_ptr_Function_int %v4i %95 - OpStore %96 %int_1 - %97 = OpLoad %int %i_0 - %98 = OpAccessChain %_ptr_Function_uint %v3u %97 - OpStore %98 %uint_1 - %99 = OpLoad %int %i_0 - %100 = OpAccessChain %_ptr_Function_uint %v4u %99 - OpStore %100 %uint_1 - %101 = OpLoad %int %i_0 - %102 = OpAccessChain %_ptr_Function_bool %v3b %101 - OpStore %102 %true - %103 = OpLoad %int %i_0 - %104 = OpAccessChain %_ptr_Function_bool %v4b %103 - OpStore %104 %true + %85 = OpLoad %int %i + %86 = OpIAdd %int %85 %int_1 + OpStore %i %86 + OpBranch %60 + %61 = OpLabel + OpStore %i_0 %57 + %88 = OpLoad %int %i_0 + %89 = OpAccessChain %_ptr_Function_float %v3f %88 + OpStore %89 %float_1 + %90 = OpLoad %int %i_0 + %91 = OpAccessChain %_ptr_Function_float %v4f %90 + OpStore %91 %float_1 + %92 = OpLoad %int %i_0 + %93 = OpAccessChain %_ptr_Function_int %v3i %92 + OpStore %93 %int_1 + %94 = OpLoad %int %i_0 + %95 = OpAccessChain %_ptr_Function_int %v4i %94 + OpStore %95 %int_1 + %96 = OpLoad %int %i_0 + %97 = OpAccessChain %_ptr_Function_uint %v3u %96 + OpStore %97 %uint_1 + %98 = OpLoad %int %i_0 + %99 = OpAccessChain %_ptr_Function_uint %v4u %98 + OpStore %99 %uint_1 + %100 = OpLoad %int %i_0 + %101 = OpAccessChain %_ptr_Function_bool %v3b %100 + OpStore %101 %true + %102 = OpLoad %int %i_0 + %103 = OpAccessChain %_ptr_Function_bool %v4b %102 + OpStore %103 %true OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.wgsl index 01115a6b4d..b59e49ea7a 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/loop_types_some.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { var v2f : vec2; var v3f : vec3; diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl index 2ff69eb70a..63bf302a87 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { var v2f : vec2; var v3f : vec3; diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.hlsl rename to test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..69170f0b0a --- /dev/null +++ b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.fxc.hlsl @@ -0,0 +1,77 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_int2(inout int2 vec, int idx, int val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_int3(inout int3 vec, int idx, int val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_int4(inout int4 vec, int idx, int val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_uint2(inout uint2 vec, int idx, uint val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_uint3(inout uint3 vec, int idx, uint val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_uint4(inout uint4 vec, int idx, uint val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_bool2(inout bool2 vec, int idx, bool val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +void set_bool3(inout bool3 vec, int idx, bool val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_bool4(inout bool4 vec, int idx, bool val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +[numthreads(1, 1, 1)] +void main() { + float2 v2f = float2(0.0f, 0.0f); + float3 v3f = float3(0.0f, 0.0f, 0.0f); + float4 v4f = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 v2i = int2(0, 0); + int3 v3i = int3(0, 0, 0); + int4 v4i = int4(0, 0, 0, 0); + uint2 v2u = uint2(0u, 0u); + uint3 v3u = uint3(0u, 0u, 0u); + uint4 v4u = uint4(0u, 0u, 0u, 0u); + bool2 v2b = bool2(false, false); + bool3 v3b = bool3(false, false, false); + bool4 v4b = bool4(false, false, false, false); + int i = 0; + set_float2(v2f, i, 1.0f); + set_float3(v3f, i, 1.0f); + set_float4(v4f, i, 1.0f); + set_int2(v2i, i, 1); + set_int3(v3i, i, 1); + set_int4(v4i, i, 1); + set_uint2(v2u, i, 1u); + set_uint3(v3u, i, 1u); + set_uint4(v4u, i, 1u); + set_bool2(v2b, i, true); + set_bool3(v3b, i, true); + set_bool4(v4b, i, true); + return; +} diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.spvasm b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.spvasm index fc900eeeab..bc18539e7f 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 92 +; Bound: 91 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -63,9 +63,8 @@ %v4bool = OpTypeVector %bool 4 %_ptr_Function_v4bool = OpTypePointer Function %v4bool %56 = OpConstantNull %v4bool - %int_0 = OpConstant %int 0 + %57 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %60 = OpConstantNull %int %_ptr_Function_float = OpTypePointer Function %float %float_1 = OpConstant %float 1 %int_1 = OpConstant %int 1 @@ -87,43 +86,43 @@ %v2b = OpVariable %_ptr_Function_v2bool Function %48 %v3b = OpVariable %_ptr_Function_v3bool Function %52 %v4b = OpVariable %_ptr_Function_v4bool Function %56 - %i = OpVariable %_ptr_Function_int Function %60 - OpStore %i %int_0 - %61 = OpLoad %int %i - %63 = OpAccessChain %_ptr_Function_float %v2f %61 - OpStore %63 %float_1 - %65 = OpLoad %int %i - %66 = OpAccessChain %_ptr_Function_float %v3f %65 - OpStore %66 %float_1 - %67 = OpLoad %int %i - %68 = OpAccessChain %_ptr_Function_float %v4f %67 - OpStore %68 %float_1 - %69 = OpLoad %int %i - %70 = OpAccessChain %_ptr_Function_int %v2i %69 - OpStore %70 %int_1 - %72 = OpLoad %int %i - %73 = OpAccessChain %_ptr_Function_int %v3i %72 - OpStore %73 %int_1 - %74 = OpLoad %int %i - %75 = OpAccessChain %_ptr_Function_int %v4i %74 - OpStore %75 %int_1 - %76 = OpLoad %int %i - %78 = OpAccessChain %_ptr_Function_uint %v2u %76 - OpStore %78 %uint_1 - %80 = OpLoad %int %i - %81 = OpAccessChain %_ptr_Function_uint %v3u %80 - OpStore %81 %uint_1 - %82 = OpLoad %int %i - %83 = OpAccessChain %_ptr_Function_uint %v4u %82 - OpStore %83 %uint_1 - %84 = OpLoad %int %i - %86 = OpAccessChain %_ptr_Function_bool %v2b %84 - OpStore %86 %true - %88 = OpLoad %int %i - %89 = OpAccessChain %_ptr_Function_bool %v3b %88 - OpStore %89 %true - %90 = OpLoad %int %i - %91 = OpAccessChain %_ptr_Function_bool %v4b %90 - OpStore %91 %true + %i = OpVariable %_ptr_Function_int Function %57 + OpStore %i %57 + %60 = OpLoad %int %i + %62 = OpAccessChain %_ptr_Function_float %v2f %60 + OpStore %62 %float_1 + %64 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Function_float %v3f %64 + OpStore %65 %float_1 + %66 = OpLoad %int %i + %67 = OpAccessChain %_ptr_Function_float %v4f %66 + OpStore %67 %float_1 + %68 = OpLoad %int %i + %69 = OpAccessChain %_ptr_Function_int %v2i %68 + OpStore %69 %int_1 + %71 = OpLoad %int %i + %72 = OpAccessChain %_ptr_Function_int %v3i %71 + OpStore %72 %int_1 + %73 = OpLoad %int %i + %74 = OpAccessChain %_ptr_Function_int %v4i %73 + OpStore %74 %int_1 + %75 = OpLoad %int %i + %77 = OpAccessChain %_ptr_Function_uint %v2u %75 + OpStore %77 %uint_1 + %79 = OpLoad %int %i + %80 = OpAccessChain %_ptr_Function_uint %v3u %79 + OpStore %80 %uint_1 + %81 = OpLoad %int %i + %82 = OpAccessChain %_ptr_Function_uint %v4u %81 + OpStore %82 %uint_1 + %83 = OpLoad %int %i + %85 = OpAccessChain %_ptr_Function_bool %v2b %83 + OpStore %85 %true + %87 = OpLoad %int %i + %88 = OpAccessChain %_ptr_Function_bool %v3b %87 + OpStore %88 %true + %89 = OpLoad %int %i + %90 = OpAccessChain %_ptr_Function_bool %v4b %89 + OpStore %90 %true OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.wgsl b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.wgsl index 72a4494bd9..5013baf57f 100644 --- a/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.wgsl +++ b/test/tint/bug/fxc/vector_assignment_in_loop/no_loop.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { var v2f : vec2; var v3f : vec3; diff --git a/test/tint/bug/tint/1046.wgsl b/test/tint/bug/tint/1046.wgsl index 4acfe95006..4c3e5318a5 100644 --- a/test/tint/bug/tint/1046.wgsl +++ b/test/tint/bug/tint/1046.wgsl @@ -16,7 +16,7 @@ struct PointLight { }; @binding(0) @group(0) var uniforms : Uniforms; -@binding(1) @group(0) var pointLights : PointLights; +@binding(1) @group(0) var pointLights : PointLights; @binding(2) @group(0) var mySampler: sampler; @binding(3) @group(0) var myTexture: texture_2d; @@ -63,7 +63,7 @@ fn getColor(fragment : FragmentInput) -> vec4{ return color; }; -@stage(fragment) +@fragment fn main(fragment : FragmentInput) -> FragmentOutput { var output : FragmentOutput; diff --git a/test/tint/bug/tint/1046.wgsl.expected.hlsl b/test/tint/bug/tint/1046.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/1046.wgsl.expected.hlsl rename to test/tint/bug/tint/1046.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/1046.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1046.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e3e72045ce --- /dev/null +++ b/test/tint/bug/tint/1046.wgsl.expected.fxc.hlsl @@ -0,0 +1,63 @@ +cbuffer cbuffer_uniforms : register(b0, space0) { + uint4 uniforms[10]; +}; +ByteAddressBuffer pointLights : register(t1, space0); +SamplerState mySampler : register(s2, space0); +Texture2D myTexture : register(t3, space0); + +struct FragmentInput { + float4 position; + float4 view_position; + float4 normal; + float2 uv; + float4 color; +}; +struct FragmentOutput { + float4 color; +}; + +float4 getColor(FragmentInput fragment) { + float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + if ((uniforms[8].y == 0u)) { + color = fragment.color; + } else { + if ((uniforms[8].y == 1u)) { + color = fragment.normal; + color.a = 1.0f; + } else { + if ((uniforms[8].y == 2u)) { + color = asfloat(uniforms[9]); + } else { + if ((uniforms[8].y == 3u)) { + color = myTexture.Sample(mySampler, fragment.uv); + } + } + } + } + return color; +} + +struct tint_symbol_1 { + float4 view_position : TEXCOORD0; + float4 normal : TEXCOORD1; + float2 uv : TEXCOORD2; + float4 color : TEXCOORD3; + float4 position : SV_Position; +}; +struct tint_symbol_2 { + float4 color : SV_Target0; +}; + +FragmentOutput main_inner(FragmentInput fragment) { + FragmentOutput output = (FragmentOutput)0; + output.color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return output; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const FragmentInput tint_symbol_5 = {tint_symbol.position, tint_symbol.view_position, tint_symbol.normal, tint_symbol.uv, tint_symbol.color}; + const FragmentOutput inner_result = main_inner(tint_symbol_5); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.color = inner_result.color; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1046.wgsl.expected.msl b/test/tint/bug/tint/1046.wgsl.expected.msl index feb5d4d52e..c79bc0aa45 100644 --- a/test/tint/bug/tint/1046.wgsl.expected.msl +++ b/test/tint/bug/tint/1046.wgsl.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct PointLight { float4 position; }; struct PointLights { - PointLight values[1]; + tint_array values; }; struct Uniforms { @@ -14,7 +27,7 @@ struct Uniforms { /* 0x0040 */ float4x4 proj; /* 0x0080 */ uint numPointLights; /* 0x0084 */ uint color_source; - /* 0x0088 */ int8_t tint_pad[8]; + /* 0x0088 */ tint_array tint_pad; /* 0x0090 */ float4 color; }; diff --git a/test/tint/bug/tint/1046.wgsl.expected.spvasm b/test/tint/bug/tint/1046.wgsl.expected.spvasm index bcf15dc40e..5d68d323f0 100644 --- a/test/tint/bug/tint/1046.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1046.wgsl.expected.spvasm @@ -112,7 +112,7 @@ %_ptr_Function_v4float = OpTypePointer Function %v4float %uint_3 = OpConstant %uint 3 %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %uint_0 = OpConstant %uint 0 + %41 = OpConstantNull %uint %bool = OpTypeBool %uint_1 = OpConstant %uint 1 %_ptr_Function_float = OpTypePointer Function %float @@ -125,8 +125,9 @@ %82 = OpTypeFunction %FragmentOutput %FragmentInput %_ptr_Function_FragmentOutput = OpTypePointer Function %FragmentOutput %89 = OpConstantNull %FragmentOutput - %float_0 = OpConstant %float 0 - %92 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint_0 = OpConstant %uint 0 + %92 = OpConstantNull %float + %93 = OpConstantComposite %v4float %float_1 %92 %92 %float_1 %void = OpTypeVoid %95 = OpTypeFunction %void %getColor = OpFunction %v4float None %30 @@ -135,7 +136,7 @@ %color = OpVariable %_ptr_Function_v4float Function %13 %39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 %40 = OpLoad %uint %39 - %42 = OpIEqual %bool %40 %uint_0 + %42 = OpIEqual %bool %40 %41 OpSelectionMerge %44 None OpBranchConditional %42 %45 %46 %45 = OpLabel @@ -193,8 +194,8 @@ %fragment_0 = OpFunctionParameter %FragmentInput %86 = OpLabel %output = OpVariable %_ptr_Function_FragmentOutput Function %89 - %90 = OpAccessChain %_ptr_Function_v4float %output %uint_0 - OpStore %90 %92 + %91 = OpAccessChain %_ptr_Function_v4float %output %uint_0 + OpStore %91 %93 %94 = OpLoad %FragmentOutput %output OpReturnValue %94 OpFunctionEnd diff --git a/test/tint/bug/tint/1046.wgsl.expected.wgsl b/test/tint/bug/tint/1046.wgsl.expected.wgsl index 430eb9d511..56a8c8ea26 100644 --- a/test/tint/bug/tint/1046.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1046.wgsl.expected.wgsl @@ -55,7 +55,7 @@ fn getColor(fragment : FragmentInput) -> vec4 { return color; } -@stage(fragment) +@fragment fn main(fragment : FragmentInput) -> FragmentOutput { var output : FragmentOutput; output.color = vec4(1.0, 0.0, 0.0, 1.0); diff --git a/test/tint/bug/tint/1064.wgsl b/test/tint/bug/tint/1064.wgsl index 4ab5117d0f..db344ea90d 100644 --- a/test/tint/bug/tint/1064.wgsl +++ b/test/tint/bug/tint/1064.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn main() { loop { if (false) { diff --git a/test/tint/bug/tint/1064.wgsl.expected.hlsl b/test/tint/bug/tint/1064.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/1064.wgsl.expected.hlsl rename to test/tint/bug/tint/1064.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/1064.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1064.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ed00540a4b --- /dev/null +++ b/test/tint/bug/tint/1064.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +void main() { + [loop] while (true) { + if (false) { + } else { + break; + } + { + if (true) { + } else { + break; + } + } + } + return; +} diff --git a/test/tint/bug/tint/1064.wgsl.expected.spvasm b/test/tint/bug/tint/1064.wgsl.expected.spvasm index 5ebd236719..139a11061d 100644 --- a/test/tint/bug/tint/1064.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1064.wgsl.expected.spvasm @@ -11,7 +11,7 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %bool = OpTypeBool - %false = OpConstantFalse %bool + %10 = OpConstantNull %bool %true = OpConstantTrue %bool %main = OpFunction %void None %1 %4 = OpLabel @@ -21,7 +21,7 @@ OpBranch %8 %8 = OpLabel OpSelectionMerge %11 None - OpBranchConditional %false %12 %13 + OpBranchConditional %10 %12 %13 %12 = OpLabel OpBranch %11 %13 = OpLabel diff --git a/test/tint/bug/tint/1064.wgsl.expected.wgsl b/test/tint/bug/tint/1064.wgsl.expected.wgsl index 581cb90764..2fe72ba178 100644 --- a/test/tint/bug/tint/1064.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1064.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn main() { loop { if (false) { diff --git a/test/tint/bug/tint/1076.wgsl b/test/tint/bug/tint/1076.wgsl index 4ce9001e06..c4077408f5 100644 --- a/test/tint/bug/tint/1076.wgsl +++ b/test/tint/bug/tint/1076.wgsl @@ -3,7 +3,7 @@ struct FragIn { @builtin(sample_mask) mask : u32, }; -@stage(fragment) +@fragment fn main(in : FragIn, @location(1) b : f32) -> FragIn { if (in.mask == 0u) { return in; diff --git a/test/tint/bug/tint/1076.wgsl.expected.hlsl b/test/tint/bug/tint/1076.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/1076.wgsl.expected.hlsl rename to test/tint/bug/tint/1076.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/1076.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1076.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..868773bfbf --- /dev/null +++ b/test/tint/bug/tint/1076.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +struct FragIn { + float a; + uint mask; +}; +struct tint_symbol_2 { + float a : TEXCOORD0; + float b : TEXCOORD1; + uint mask : SV_Coverage; +}; +struct tint_symbol_3 { + float a : SV_Target0; + uint mask : SV_Coverage; +}; + +FragIn main_inner(FragIn tint_symbol, float b) { + if ((tint_symbol.mask == 0u)) { + return tint_symbol; + } + const FragIn tint_symbol_4 = {b, 1u}; + return tint_symbol_4; +} + +tint_symbol_3 main(tint_symbol_2 tint_symbol_1) { + const FragIn tint_symbol_5 = {tint_symbol_1.a, tint_symbol_1.mask}; + const FragIn inner_result = main_inner(tint_symbol_5, tint_symbol_1.b); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.a = inner_result.a; + wrapper_result.mask = inner_result.mask; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1076.wgsl.expected.spvasm b/test/tint/bug/tint/1076.wgsl.expected.spvasm index 33e81b1a8f..b7a980ac74 100644 --- a/test/tint/bug/tint/1076.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1076.wgsl.expected.spvasm @@ -22,6 +22,7 @@ OpDecorate %a_1 Location 0 OpDecorate %_arr_uint_uint_1 ArrayStride 4 OpDecorate %mask_1 BuiltIn SampleMask + OpDecorate %mask_1 Flat OpDecorate %b_1 Location 1 OpDecorate %a_2 Location 0 OpDecorate %mask_2 BuiltIn SampleMask @@ -44,12 +45,12 @@ %mask_2 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %15 %FragIn = OpTypeStruct %float %uint %16 = OpTypeFunction %FragIn %FragIn %float - %uint_0 = OpConstant %uint 0 + %23 = OpConstantNull %uint %bool = OpTypeBool %void = OpTypeVoid %29 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %36 = OpConstantNull %int %_ptr_Input_uint = OpTypePointer Input %uint %_ptr_Output_uint = OpTypePointer Output %uint %main_inner = OpFunction %FragIn None %16 @@ -57,7 +58,7 @@ %b = OpFunctionParameter %float %21 = OpLabel %22 = OpCompositeExtract %uint %in 1 - %24 = OpIEqual %bool %22 %uint_0 + %24 = OpIEqual %bool %22 %23 OpSelectionMerge %26 None OpBranchConditional %24 %27 %26 %27 = OpLabel @@ -69,14 +70,14 @@ %main = OpFunction %void None %29 %32 = OpLabel %34 = OpLoad %float %a_1 - %38 = OpAccessChain %_ptr_Input_uint %mask_1 %int_0 + %38 = OpAccessChain %_ptr_Input_uint %mask_1 %36 %39 = OpLoad %uint %38 %40 = OpCompositeConstruct %FragIn %34 %39 %41 = OpLoad %float %b_1 %33 = OpFunctionCall %FragIn %main_inner %40 %41 %42 = OpCompositeExtract %float %33 0 OpStore %a_2 %42 - %44 = OpAccessChain %_ptr_Output_uint %mask_2 %int_0 + %44 = OpAccessChain %_ptr_Output_uint %mask_2 %36 %45 = OpCompositeExtract %uint %33 1 OpStore %44 %45 OpReturn diff --git a/test/tint/bug/tint/1076.wgsl.expected.wgsl b/test/tint/bug/tint/1076.wgsl.expected.wgsl index 716cb9186b..0a21df0251 100644 --- a/test/tint/bug/tint/1076.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1076.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct FragIn { mask : u32, } -@stage(fragment) +@fragment fn main(in : FragIn, @location(1) b : f32) -> FragIn { if ((in.mask == 0u)) { return in; diff --git a/test/tint/bug/tint/1081.wgsl b/test/tint/bug/tint/1081.wgsl index 6d339a87cc..14ba2edf9f 100644 --- a/test/tint/bug/tint/1081.wgsl +++ b/test/tint/bug/tint/1081.wgsl @@ -5,7 +5,7 @@ fn f(x : i32) -> i32 { return x; } -@stage(fragment) +@fragment fn main(@location(1) @interpolate(flat) x: vec3) -> @location(2) i32 { var y = x.x; loop { diff --git a/test/tint/bug/tint/1081.wgsl.expected.hlsl b/test/tint/bug/tint/1081.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/1081.wgsl.expected.hlsl rename to test/tint/bug/tint/1081.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/1081.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1081.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60ace97a3c --- /dev/null +++ b/test/tint/bug/tint/1081.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static bool tint_discard = false; + +int f(int x) { + if ((x == 10)) { + tint_discard = true; + return 0; + } + return x; +} + +struct tint_symbol_1 { + nointerpolation int3 x : TEXCOORD1; +}; +struct tint_symbol_2 { + int value : SV_Target2; +}; + +int main_inner(int3 x) { + int y = x.x; + [loop] while (true) { + const int r = f(y); + if (tint_discard) { + return 0; + } + if ((r == 0)) { + break; + } + } + return y; +} + +void tint_discard_func() { + discard; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const int inner_result = main_inner(tint_symbol.x); + if (tint_discard) { + tint_discard_func(); + const tint_symbol_2 tint_symbol_3 = (tint_symbol_2)0; + return tint_symbol_3; + } + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1081.wgsl.expected.msl b/test/tint/bug/tint/1081.wgsl.expected.msl index 8304df1281..d60e03286f 100644 --- a/test/tint/bug/tint/1081.wgsl.expected.msl +++ b/test/tint/bug/tint/1081.wgsl.expected.msl @@ -4,7 +4,7 @@ using namespace metal; int f(int x, thread bool* const tint_symbol_5) { if ((x == 10)) { *(tint_symbol_5) = true; - return int(); + return 0; } return x; } @@ -22,7 +22,7 @@ int tint_symbol_inner(int3 x, thread bool* const tint_symbol_6) { while (true) { int const r = f(y, tint_symbol_6); if (*(tint_symbol_6)) { - return int(); + return 0; } if ((r == 0)) { break; @@ -40,7 +40,7 @@ fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { int const inner_result = tint_symbol_inner(tint_symbol_1.x, &(tint_symbol_7)); if (tint_symbol_7) { tint_discard_func(); - tint_symbol_3 const tint_symbol_4 = {}; + tint_symbol_3 const tint_symbol_4 = tint_symbol_3{}; return tint_symbol_4; } tint_symbol_3 wrapper_result = {}; diff --git a/test/tint/bug/tint/1081.wgsl.expected.spvasm b/test/tint/bug/tint/1081.wgsl.expected.spvasm index 53e025c9eb..bee21ae78c 100644 --- a/test/tint/bug/tint/1081.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1081.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 51 +; Bound: 50 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -28,9 +28,9 @@ %7 = OpConstantNull %int %value = OpVariable %_ptr_Output_int Output %7 %bool = OpTypeBool - %false = OpConstantFalse %bool + %9 = OpConstantNull %bool %_ptr_Private_bool = OpTypePointer Private %bool -%tint_discard = OpVariable %_ptr_Private_bool Private %false +%tint_discard = OpVariable %_ptr_Private_bool Private %9 %12 = OpTypeFunction %int %int %int_10 = OpConstant %int 10 %true = OpConstantTrue %bool @@ -38,7 +38,6 @@ %21 = OpTypeFunction %void %25 = OpTypeFunction %int %v3int %_ptr_Function_int = OpTypePointer Function %int - %int_0 = OpConstant %int 0 %f = OpFunction %int None %12 %x = OpFunctionParameter %int %15 = OpLabel @@ -75,23 +74,23 @@ %41 = OpFunctionCall %void %tint_discard_func OpReturnValue %7 %39 = OpLabel - %43 = OpIEqual %bool %36 %int_0 - OpSelectionMerge %44 None - OpBranchConditional %43 %45 %44 - %45 = OpLabel - OpBranch %33 + %42 = OpIEqual %bool %36 %7 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 %44 = OpLabel + OpBranch %33 + %43 = OpLabel OpBranch %34 %34 = OpLabel OpBranch %32 %33 = OpLabel - %46 = OpLoad %int %y - OpReturnValue %46 + %45 = OpLoad %int %y + OpReturnValue %45 OpFunctionEnd %main = OpFunction %void None %21 - %48 = OpLabel - %50 = OpLoad %v3int %x_1 - %49 = OpFunctionCall %int %main_inner %50 - OpStore %value %49 + %47 = OpLabel + %49 = OpLoad %v3int %x_1 + %48 = OpFunctionCall %int %main_inner %49 + OpStore %value %48 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1081.wgsl.expected.wgsl b/test/tint/bug/tint/1081.wgsl.expected.wgsl index 3f7cc7a4d2..61b05684aa 100644 --- a/test/tint/bug/tint/1081.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1081.wgsl.expected.wgsl @@ -5,7 +5,7 @@ fn f(x : i32) -> i32 { return x; } -@stage(fragment) +@fragment fn main(@location(1) @interpolate(flat) x : vec3) -> @location(2) i32 { var y = x.x; loop { diff --git a/test/tint/bug/tint/1083.wgsl b/test/tint/bug/tint/1083.wgsl index 12e985ff86..046d356ba0 100644 --- a/test/tint/bug/tint/1083.wgsl +++ b/test/tint/bug/tint/1083.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 0; diff --git a/test/tint/bug/tint/1083.wgsl.expected.hlsl b/test/tint/bug/tint/1083.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/1083.wgsl.expected.hlsl rename to test/tint/bug/tint/1083.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/1083.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1083.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e793e0d74d --- /dev/null +++ b/test/tint/bug/tint/1083.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int c = (1 / 1); + return; +} diff --git a/test/tint/bug/tint/1083.wgsl.expected.spvasm b/test/tint/bug/tint/1083.wgsl.expected.spvasm index 47589eb15f..fa188bd8fe 100644 --- a/test/tint/bug/tint/1083.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1083.wgsl.expected.spvasm @@ -12,9 +12,9 @@ %1 = OpTypeFunction %void %int = OpTypeInt 32 1 %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 + %7 = OpConstantNull %int %f = OpFunction %void None %1 %4 = OpLabel - %8 = OpSDiv %int %int_1 %int_0 + %8 = OpSDiv %int %int_1 %7 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1083.wgsl.expected.wgsl b/test/tint/bug/tint/1083.wgsl.expected.wgsl index 4d2024cace..b664e4c9bb 100644 --- a/test/tint/bug/tint/1083.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1083.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 0; diff --git a/test/tint/bug/tint/1086.wgsl b/test/tint/bug/tint/1086.wgsl index a5c2982b05..0c2e0fea87 100644 --- a/test/tint/bug/tint/1086.wgsl +++ b/test/tint/bug/tint/1086.wgsl @@ -8,7 +8,7 @@ fn g() { x(&v); } -@stage(fragment) +@fragment fn f() { g(); } diff --git a/test/tint/bug/tint/1086.wgsl.expected.hlsl b/test/tint/bug/tint/1086.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/1086.wgsl.expected.hlsl rename to test/tint/bug/tint/1086.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/1086.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1086.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c161767a7d --- /dev/null +++ b/test/tint/bug/tint/1086.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +static float v = 0.0f; + +void x(inout float p) { + p = 0.0f; +} + +void g() { + x(v); +} + +void f() { + g(); + return; +} diff --git a/test/tint/bug/tint/1086.wgsl.expected.msl b/test/tint/bug/tint/1086.wgsl.expected.msl index b75a05c9ae..8ea0e8973d 100644 --- a/test/tint/bug/tint/1086.wgsl.expected.msl +++ b/test/tint/bug/tint/1086.wgsl.expected.msl @@ -5,13 +5,13 @@ void x(thread float* const p) { *(p) = 0.0f; } -void g(thread float* const tint_symbol) { - x(tint_symbol); +void g() { + thread float tint_symbol = 0.0f; + x(&(tint_symbol)); } fragment void f() { - thread float tint_symbol_1 = 0.0f; - g(&(tint_symbol_1)); + g(); return; } diff --git a/test/tint/bug/tint/1086.wgsl.expected.spvasm b/test/tint/bug/tint/1086.wgsl.expected.spvasm index c2a13c6005..2c300ad818 100644 --- a/test/tint/bug/tint/1086.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1086.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 20 +; Bound: 19 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -18,21 +18,20 @@ %v = OpVariable %_ptr_Private_float Private %4 %void = OpTypeVoid %5 = OpTypeFunction %void %_ptr_Private_float - %float_0 = OpConstant %float 0 - %12 = OpTypeFunction %void + %11 = OpTypeFunction %void %x = OpFunction %void None %5 %p = OpFunctionParameter %_ptr_Private_float %9 = OpLabel - OpStore %p %float_0 + OpStore %p %4 OpReturn OpFunctionEnd - %g = OpFunction %void None %12 - %14 = OpLabel - %15 = OpFunctionCall %void %x %v + %g = OpFunction %void None %11 + %13 = OpLabel + %14 = OpFunctionCall %void %x %v OpReturn OpFunctionEnd - %f = OpFunction %void None %12 - %18 = OpLabel - %19 = OpFunctionCall %void %g + %f = OpFunction %void None %11 + %17 = OpLabel + %18 = OpFunctionCall %void %g OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1086.wgsl.expected.wgsl b/test/tint/bug/tint/1086.wgsl.expected.wgsl index 9c7a8fcfff..f8e4bea653 100644 --- a/test/tint/bug/tint/1086.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1086.wgsl.expected.wgsl @@ -8,7 +8,7 @@ fn g() { x(&(v)); } -@stage(fragment) +@fragment fn f() { g(); } diff --git a/test/tint/bug/tint/1088.spvasm.expected.dxc.hlsl b/test/tint/bug/tint/1088.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..abd9ffefc3 --- /dev/null +++ b/test/tint/bug/tint/1088.spvasm.expected.dxc.hlsl @@ -0,0 +1,71 @@ +static float3 position = float3(0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_14 : register(b2, space2) { + uint4 x_14[17]; +}; +static float2 vUV = float2(0.0f, 0.0f); +static float2 uv = float2(0.0f, 0.0f); +static float3 normal = float3(0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4x4 tint_symbol_4(uint4 buffer[17], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + const uint scalar_offset_3 = ((offset + 48u)) / 4; + return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4])); +} + +void main_1() { + float4 q = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 p = float3(0.0f, 0.0f, 0.0f); + const float3 x_13 = position; + q = float4(x_13.x, x_13.y, x_13.z, 1.0f); + const float4 x_21 = q; + p = float3(x_21.x, x_21.y, x_21.z); + const float x_27 = p.x; + const float x_41 = asfloat(x_14[13].x); + const float x_45 = position.y; + const float x_49 = asfloat(x_14[4].x); + p.x = (x_27 + sin(((x_41 * x_45) + x_49))); + const float x_55 = p.y; + const float x_57 = asfloat(x_14[4].x); + p.y = (x_55 + sin((x_57 + 4.0f))); + const float4x4 x_69 = tint_symbol_4(x_14, 0u); + const float3 x_70 = p; + gl_Position = mul(float4(x_70.x, x_70.y, x_70.z, 1.0f), x_69); + vUV = uv; + const float x_87 = gl_Position.y; + gl_Position.y = (x_87 * -1.0f); + return; +} + +struct main_out { + float4 gl_Position; + float2 vUV_1; +}; +struct tint_symbol_1 { + float3 position_param : TEXCOORD0; + float3 normal_param : TEXCOORD1; + float2 uv_param : TEXCOORD2; +}; +struct tint_symbol_2 { + float2 vUV_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +main_out main_inner(float3 position_param, float2 uv_param, float3 normal_param) { + position = position_param; + uv = uv_param; + normal = normal_param; + main_1(); + const main_out tint_symbol_6 = {gl_Position, vUV}; + return tint_symbol_6; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.position_param, tint_symbol.uv_param, tint_symbol.normal_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.gl_Position = inner_result.gl_Position; + wrapper_result.vUV_1 = inner_result.vUV_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1088.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/1088.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..abd9ffefc3 --- /dev/null +++ b/test/tint/bug/tint/1088.spvasm.expected.fxc.hlsl @@ -0,0 +1,71 @@ +static float3 position = float3(0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_14 : register(b2, space2) { + uint4 x_14[17]; +}; +static float2 vUV = float2(0.0f, 0.0f); +static float2 uv = float2(0.0f, 0.0f); +static float3 normal = float3(0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4x4 tint_symbol_4(uint4 buffer[17], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + const uint scalar_offset_3 = ((offset + 48u)) / 4; + return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4])); +} + +void main_1() { + float4 q = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 p = float3(0.0f, 0.0f, 0.0f); + const float3 x_13 = position; + q = float4(x_13.x, x_13.y, x_13.z, 1.0f); + const float4 x_21 = q; + p = float3(x_21.x, x_21.y, x_21.z); + const float x_27 = p.x; + const float x_41 = asfloat(x_14[13].x); + const float x_45 = position.y; + const float x_49 = asfloat(x_14[4].x); + p.x = (x_27 + sin(((x_41 * x_45) + x_49))); + const float x_55 = p.y; + const float x_57 = asfloat(x_14[4].x); + p.y = (x_55 + sin((x_57 + 4.0f))); + const float4x4 x_69 = tint_symbol_4(x_14, 0u); + const float3 x_70 = p; + gl_Position = mul(float4(x_70.x, x_70.y, x_70.z, 1.0f), x_69); + vUV = uv; + const float x_87 = gl_Position.y; + gl_Position.y = (x_87 * -1.0f); + return; +} + +struct main_out { + float4 gl_Position; + float2 vUV_1; +}; +struct tint_symbol_1 { + float3 position_param : TEXCOORD0; + float3 normal_param : TEXCOORD1; + float2 uv_param : TEXCOORD2; +}; +struct tint_symbol_2 { + float2 vUV_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +main_out main_inner(float3 position_param, float2 uv_param, float3 normal_param) { + position = position_param; + uv = uv_param; + normal = normal_param; + main_1(); + const main_out tint_symbol_6 = {gl_Position, vUV}; + return tint_symbol_6; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.position_param, tint_symbol.uv_param, tint_symbol.normal_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.gl_Position = inner_result.gl_Position; + wrapper_result.vUV_1 = inner_result.vUV_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1088.spvasm.expected.hlsl b/test/tint/bug/tint/1088.spvasm.expected.hlsl deleted file mode 100644 index c2274dbc71..0000000000 --- a/test/tint/bug/tint/1088.spvasm.expected.hlsl +++ /dev/null @@ -1,72 +0,0 @@ -static float3 position = float3(0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_14 : register(b2, space2) { - uint4 x_14[17]; -}; -static float2 vUV = float2(0.0f, 0.0f); -static float2 uv = float2(0.0f, 0.0f); -static float3 normal = float3(0.0f, 0.0f, 0.0f); -static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); - -float4x4 tint_symbol_4(uint4 buffer[17], uint offset) { - const uint scalar_offset = ((offset + 0u)) / 4; - const uint scalar_offset_1 = ((offset + 16u)) / 4; - const uint scalar_offset_2 = ((offset + 32u)) / 4; - const uint scalar_offset_3 = ((offset + 48u)) / 4; - return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4])); -} - -void main_1() { - float4 q = float4(0.0f, 0.0f, 0.0f, 0.0f); - float3 p = float3(0.0f, 0.0f, 0.0f); - const float3 x_13 = position; - q = float4(x_13.x, x_13.y, x_13.z, 1.0f); - const float4 x_21 = q; - p = float3(x_21.x, x_21.y, x_21.z); - const float x_27 = p.x; - const uint scalar_offset_4 = ((208u + (16u * uint(0)))) / 4; - const float x_41 = asfloat(x_14[scalar_offset_4 / 4][scalar_offset_4 % 4]); - const float x_45 = position.y; - const float x_49 = asfloat(x_14[4].x); - p.x = (x_27 + sin(((x_41 * x_45) + x_49))); - const float x_55 = p.y; - const float x_57 = asfloat(x_14[4].x); - p.y = (x_55 + sin((x_57 + 4.0f))); - const float4x4 x_69 = tint_symbol_4(x_14, 0u); - const float3 x_70 = p; - gl_Position = mul(float4(x_70.x, x_70.y, x_70.z, 1.0f), x_69); - vUV = uv; - const float x_87 = gl_Position.y; - gl_Position.y = (x_87 * -1.0f); - return; -} - -struct main_out { - float4 gl_Position; - float2 vUV_1; -}; -struct tint_symbol_1 { - float3 position_param : TEXCOORD0; - float3 normal_param : TEXCOORD1; - float2 uv_param : TEXCOORD2; -}; -struct tint_symbol_2 { - float2 vUV_1 : TEXCOORD0; - float4 gl_Position : SV_Position; -}; - -main_out main_inner(float3 position_param, float2 uv_param, float3 normal_param) { - position = position_param; - uv = uv_param; - normal = normal_param; - main_1(); - const main_out tint_symbol_6 = {gl_Position, vUV}; - return tint_symbol_6; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.position_param, tint_symbol.uv_param, tint_symbol.normal_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.gl_Position = inner_result.gl_Position; - wrapper_result.vUV_1 = inner_result.vUV_1; - return wrapper_result; -} diff --git a/test/tint/bug/tint/1088.spvasm.expected.msl b/test/tint/bug/tint/1088.spvasm.expected.msl index b2533c6284..5970249e5e 100644 --- a/test/tint/bug/tint/1088.spvasm.expected.msl +++ b/test/tint/bug/tint/1088.spvasm.expected.msl @@ -1,25 +1,30 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ float4x4 arr[2]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct strided_arr { /* 0x0000 */ float el; - /* 0x0004 */ int8_t tint_pad[12]; -}; - -struct tint_array_wrapper_1 { - /* 0x0000 */ strided_arr arr[4]; + /* 0x0004 */ tint_array tint_pad; }; struct LeftOver { /* 0x0000 */ float4x4 worldViewProjection; /* 0x0040 */ float time; - /* 0x0044 */ int8_t tint_pad_1[12]; - /* 0x0050 */ tint_array_wrapper test2; - /* 0x00d0 */ tint_array_wrapper_1 test; + /* 0x0044 */ tint_array tint_pad_1; + /* 0x0050 */ tint_array test2; + /* 0x00d0 */ tint_array test; }; void main_1(thread float3* const tint_symbol_5, const constant LeftOver* const tint_symbol_6, thread float4* const tint_symbol_7, thread float2* const tint_symbol_8, thread float2* const tint_symbol_9) { @@ -30,7 +35,7 @@ void main_1(thread float3* const tint_symbol_5, const constant LeftOver* const t float4 const x_21 = q; p = float3(x_21[0], x_21[1], x_21[2]); float const x_27 = p[0]; - float const x_41 = (*(tint_symbol_6)).test.arr[0].el; + float const x_41 = (*(tint_symbol_6)).test[0].el; float const x_45 = (*(tint_symbol_5))[1]; float const x_49 = (*(tint_symbol_6)).time; p[0] = (x_27 + sin(((x_41 * x_45) + x_49))); @@ -63,22 +68,22 @@ struct tint_symbol_3 { float4 gl_Position [[position]]; }; -main_out tint_symbol_inner(float3 position_param, float2 uv_param, float3 normal_param, thread float3* const tint_symbol_10, thread float2* const tint_symbol_11, thread float3* const tint_symbol_12, const constant LeftOver* const tint_symbol_13, thread float4* const tint_symbol_14, thread float2* const tint_symbol_15) { +main_out tint_symbol_inner(float3 position_param, float2 uv_param, float3 normal_param, thread float3* const tint_symbol_10, thread float2* const tint_symbol_11, const constant LeftOver* const tint_symbol_13, thread float4* const tint_symbol_14, thread float2* const tint_symbol_15) { + thread float3 tint_symbol_12 = 0.0f; *(tint_symbol_10) = position_param; *(tint_symbol_11) = uv_param; - *(tint_symbol_12) = normal_param; + tint_symbol_12 = normal_param; main_1(tint_symbol_10, tint_symbol_13, tint_symbol_14, tint_symbol_11, tint_symbol_15); main_out const tint_symbol_4 = {.gl_Position=*(tint_symbol_14), .vUV_1=*(tint_symbol_15)}; return tint_symbol_4; } -vertex tint_symbol_3 tint_symbol(const constant LeftOver* tint_symbol_19 [[buffer(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { +vertex tint_symbol_3 tint_symbol(const constant LeftOver* tint_symbol_18 [[buffer(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { thread float3 tint_symbol_16 = 0.0f; thread float2 tint_symbol_17 = 0.0f; - thread float3 tint_symbol_18 = 0.0f; - thread float4 tint_symbol_20 = 0.0f; - thread float2 tint_symbol_21 = 0.0f; - main_out const inner_result = tint_symbol_inner(tint_symbol_1.position_param, tint_symbol_1.uv_param, tint_symbol_1.normal_param, &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18), tint_symbol_19, &(tint_symbol_20), &(tint_symbol_21)); + thread float4 tint_symbol_19 = 0.0f; + thread float2 tint_symbol_20 = 0.0f; + main_out const inner_result = tint_symbol_inner(tint_symbol_1.position_param, tint_symbol_1.uv_param, tint_symbol_1.normal_param, &(tint_symbol_16), &(tint_symbol_17), tint_symbol_18, &(tint_symbol_19), &(tint_symbol_20)); tint_symbol_3 wrapper_result = {}; wrapper_result.gl_Position = inner_result.gl_Position; wrapper_result.vUV_1 = inner_result.vUV_1; diff --git a/test/tint/bug/tint/1088.spvasm.expected.spvasm b/test/tint/bug/tint/1088.spvasm.expected.spvasm index f157cd1751..6b84892307 100644 --- a/test/tint/bug/tint/1088.spvasm.expected.spvasm +++ b/test/tint/bug/tint/1088.spvasm.expected.spvasm @@ -106,7 +106,7 @@ %_ptr_Function_float = OpTypePointer Function %float %uint_3 = OpConstant %uint 3 %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %63 = OpConstantNull %int %_ptr_Uniform_float = OpTypePointer Uniform %float %uint_1 = OpConstant %uint 1 %_ptr_Private_float = OpTypePointer Private %float @@ -133,7 +133,7 @@ OpStore %p %56 %59 = OpAccessChain %_ptr_Function_float %p %uint_0 %60 = OpLoad %float %59 - %65 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_3 %int_0 %uint_0 + %65 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_3 %63 %uint_0 %66 = OpLoad %float %65 %69 = OpAccessChain %_ptr_Private_float %position %uint_1 %70 = OpLoad %float %69 diff --git a/test/tint/bug/tint/1088.spvasm.expected.wgsl b/test/tint/bug/tint/1088.spvasm.expected.wgsl index e8db8e1a8f..74fb32d09b 100644 --- a/test/tint/bug/tint/1088.spvasm.expected.wgsl +++ b/test/tint/bug/tint/1088.spvasm.expected.wgsl @@ -32,7 +32,7 @@ fn main_1() { var q : vec4; var p : vec3; let x_13 : vec3 = position; - q = vec4(x_13.x, x_13.y, x_13.z, 1.0); + q = vec4(x_13.x, x_13.y, x_13.z, 1.0f); let x_21 : vec4 = q; p = vec3(x_21.x, x_21.y, x_21.z); let x_27 : f32 = p.x; @@ -42,14 +42,14 @@ fn main_1() { p.x = (x_27 + sin(((x_41 * x_45) + x_49))); let x_55 : f32 = p.y; let x_57 : f32 = x_14.time; - p.y = (x_55 + sin((x_57 + 4.0))); + p.y = (x_55 + sin((x_57 + 4.0f))); let x_69 : mat4x4 = x_14.worldViewProjection; let x_70 : vec3 = p; - gl_Position = (x_69 * vec4(x_70.x, x_70.y, x_70.z, 1.0)); + gl_Position = (x_69 * vec4(x_70.x, x_70.y, x_70.z, 1.0f)); let x_83 : vec2 = uv; vUV = x_83; let x_87 : f32 = gl_Position.y; - gl_Position.y = (x_87 * -1.0); + gl_Position.y = (x_87 * -1.0f); return; } @@ -60,7 +60,7 @@ struct main_out { vUV_1 : vec2, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec3, @location(2) uv_param : vec2, @location(1) normal_param : vec3) -> main_out { position = position_param; uv = uv_param; diff --git a/test/tint/bug/tint/1113.wgsl b/test/tint/bug/tint/1113.wgsl index 1b38021deb..e1c2ce8018 100644 --- a/test/tint/bug/tint/1113.wgsl +++ b/test/tint/bug/tint/1113.wgsl @@ -95,7 +95,7 @@ fn doIgnore(){ } -@stage(compute) @workgroup_size(128) +@compute @workgroup_size(128) fn main_count(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var triangleIndex = GlobalInvocationID.x; @@ -132,7 +132,7 @@ fn main_count(@builtin(global_invocation_id) GlobalInvocationID : vec3) { } -@stage(compute) @workgroup_size(128) +@compute @workgroup_size(128) fn main_create_lut(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var voxelIndex = GlobalInvocationID.x; @@ -155,7 +155,7 @@ fn main_create_lut(@builtin(global_invocation_id) GlobalInvocationID : vec3 } -@stage(compute) @workgroup_size(128) +@compute @workgroup_size(128) fn main_sort_triangles(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var triangleIndex = GlobalInvocationID.x; diff --git a/test/tint/bug/tint/1113.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1113.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..978093c5d2 --- /dev/null +++ b/test/tint/bug/tint/1113.wgsl.expected.dxc.hlsl @@ -0,0 +1,179 @@ +uint value_or_one_if_zero_uint(uint value) { + return value == 0u ? 1u : value; +} + +cbuffer cbuffer_uniforms : register(b0, space0) { + uint4 uniforms[3]; +}; +RWByteAddressBuffer indices : register(u10, space0); +RWByteAddressBuffer positions : register(u11, space0); +RWByteAddressBuffer counters : register(u20, space0); +RWByteAddressBuffer LUT : register(u21, space0); +RWByteAddressBuffer dbg : register(u50, space0); + +float3 toVoxelPos(float3 position) { + float3 bbMin = float3(asfloat(uniforms[1].x), asfloat(uniforms[1].y), asfloat(uniforms[1].z)); + float3 bbMax = float3(asfloat(uniforms[2].x), asfloat(uniforms[2].y), asfloat(uniforms[2].z)); + float3 bbSize = (bbMax - bbMin); + float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z); + float gridSize = float(uniforms[0].y); + float gx = ((gridSize * (position.x - asfloat(uniforms[1].x))) / cubeSize); + float gy = ((gridSize * (position.y - asfloat(uniforms[1].y))) / cubeSize); + float gz = ((gridSize * (position.z - asfloat(uniforms[1].z))) / cubeSize); + return float3(gx, gy, gz); +} + +uint toIndex1D(uint gridSize, float3 voxelPos) { + uint3 icoord = uint3(voxelPos); + return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); +} + +uint3 toIndex3D(uint gridSize, uint index) { + uint z_1 = (index / value_or_one_if_zero_uint((gridSize * gridSize))); + uint y_1 = ((index - ((gridSize * gridSize) * z_1)) / (gridSize == 0u ? 1u : gridSize)); + uint x_1 = (index % (gridSize == 0u ? 1u : gridSize)); + return uint3(x_1, y_1, z_1); +} + +float3 loadPosition(uint vertexIndex) { + float3 position = float3(asfloat(positions.Load((4u * ((3u * vertexIndex) + 0u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 1u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 2u))))); + return position; +} + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void doIgnore() { + uint g42 = uniforms[0].x; + uint kj6 = dbg.Load(20u); + uint b53 = tint_atomicLoad(counters, 0u); + uint rwg = indices.Load(0u); + float rb5 = asfloat(positions.Load(0u)); + int g55 = tint_atomicLoad_1(LUT, 0u); +} + +struct tint_symbol_1 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void main_count_inner(uint3 GlobalInvocationID) { + uint triangleIndex = GlobalInvocationID.x; + if ((triangleIndex >= uniforms[0].x)) { + return; + } + doIgnore(); + uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u))); + uint i1 = indices.Load((4u * ((3u * triangleIndex) + 1u))); + uint i2 = indices.Load((4u * ((3u * triangleIndex) + 2u))); + float3 p0 = loadPosition(i0); + float3 p1 = loadPosition(i1); + float3 p2 = loadPosition(i2); + float3 center = (((p0 + p1) + p2) / 3.0f); + float3 voxelPos = toVoxelPos(center); + uint voxelIndex = toIndex1D(uniforms[0].y, voxelPos); + uint acefg = tint_atomicAdd(counters, (4u * voxelIndex), 1u); + if ((triangleIndex == 0u)) { + dbg.Store(16u, asuint(uniforms[0].y)); + dbg.Store(32u, asuint(center.x)); + dbg.Store(36u, asuint(center.y)); + dbg.Store(40u, asuint(center.z)); + } +} + +[numthreads(128, 1, 1)] +void main_count(tint_symbol_1 tint_symbol) { + main_count_inner(tint_symbol.GlobalInvocationID); + return; +} + +struct tint_symbol_3 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +uint tint_atomicAdd_1(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void main_create_lut_inner(uint3 GlobalInvocationID) { + uint voxelIndex = GlobalInvocationID.x; + doIgnore(); + uint maxVoxels = ((uniforms[0].y * uniforms[0].y) * uniforms[0].y); + if ((voxelIndex >= maxVoxels)) { + return; + } + uint numTriangles = tint_atomicLoad(counters, (4u * voxelIndex)); + int offset = -1; + if ((numTriangles > 0u)) { + const uint tint_symbol_6 = tint_atomicAdd_1(dbg, 0u, numTriangles); + offset = int(tint_symbol_6); + } + tint_atomicStore(LUT, (4u * voxelIndex), offset); +} + +[numthreads(128, 1, 1)] +void main_create_lut(tint_symbol_3 tint_symbol_2) { + main_create_lut_inner(tint_symbol_2.GlobalInvocationID); + return; +} + +struct tint_symbol_5 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +int tint_atomicAdd_2(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void main_sort_triangles_inner(uint3 GlobalInvocationID) { + uint triangleIndex = GlobalInvocationID.x; + doIgnore(); + if ((triangleIndex >= uniforms[0].x)) { + return; + } + uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u))); + uint i1 = indices.Load((4u * ((3u * triangleIndex) + 1u))); + uint i2 = indices.Load((4u * ((3u * triangleIndex) + 2u))); + float3 p0 = loadPosition(i0); + float3 p1 = loadPosition(i1); + float3 p2 = loadPosition(i2); + float3 center = (((p0 + p1) + p2) / 3.0f); + float3 voxelPos = toVoxelPos(center); + uint voxelIndex = toIndex1D(uniforms[0].y, voxelPos); + int triangleOffset = tint_atomicAdd_2(LUT, (4u * voxelIndex), 1); +} + +[numthreads(128, 1, 1)] +void main_sort_triangles(tint_symbol_5 tint_symbol_4) { + main_sort_triangles_inner(tint_symbol_4.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/tint/1113.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1113.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..978093c5d2 --- /dev/null +++ b/test/tint/bug/tint/1113.wgsl.expected.fxc.hlsl @@ -0,0 +1,179 @@ +uint value_or_one_if_zero_uint(uint value) { + return value == 0u ? 1u : value; +} + +cbuffer cbuffer_uniforms : register(b0, space0) { + uint4 uniforms[3]; +}; +RWByteAddressBuffer indices : register(u10, space0); +RWByteAddressBuffer positions : register(u11, space0); +RWByteAddressBuffer counters : register(u20, space0); +RWByteAddressBuffer LUT : register(u21, space0); +RWByteAddressBuffer dbg : register(u50, space0); + +float3 toVoxelPos(float3 position) { + float3 bbMin = float3(asfloat(uniforms[1].x), asfloat(uniforms[1].y), asfloat(uniforms[1].z)); + float3 bbMax = float3(asfloat(uniforms[2].x), asfloat(uniforms[2].y), asfloat(uniforms[2].z)); + float3 bbSize = (bbMax - bbMin); + float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z); + float gridSize = float(uniforms[0].y); + float gx = ((gridSize * (position.x - asfloat(uniforms[1].x))) / cubeSize); + float gy = ((gridSize * (position.y - asfloat(uniforms[1].y))) / cubeSize); + float gz = ((gridSize * (position.z - asfloat(uniforms[1].z))) / cubeSize); + return float3(gx, gy, gz); +} + +uint toIndex1D(uint gridSize, float3 voxelPos) { + uint3 icoord = uint3(voxelPos); + return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); +} + +uint3 toIndex3D(uint gridSize, uint index) { + uint z_1 = (index / value_or_one_if_zero_uint((gridSize * gridSize))); + uint y_1 = ((index - ((gridSize * gridSize) * z_1)) / (gridSize == 0u ? 1u : gridSize)); + uint x_1 = (index % (gridSize == 0u ? 1u : gridSize)); + return uint3(x_1, y_1, z_1); +} + +float3 loadPosition(uint vertexIndex) { + float3 position = float3(asfloat(positions.Load((4u * ((3u * vertexIndex) + 0u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 1u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 2u))))); + return position; +} + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void doIgnore() { + uint g42 = uniforms[0].x; + uint kj6 = dbg.Load(20u); + uint b53 = tint_atomicLoad(counters, 0u); + uint rwg = indices.Load(0u); + float rb5 = asfloat(positions.Load(0u)); + int g55 = tint_atomicLoad_1(LUT, 0u); +} + +struct tint_symbol_1 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void main_count_inner(uint3 GlobalInvocationID) { + uint triangleIndex = GlobalInvocationID.x; + if ((triangleIndex >= uniforms[0].x)) { + return; + } + doIgnore(); + uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u))); + uint i1 = indices.Load((4u * ((3u * triangleIndex) + 1u))); + uint i2 = indices.Load((4u * ((3u * triangleIndex) + 2u))); + float3 p0 = loadPosition(i0); + float3 p1 = loadPosition(i1); + float3 p2 = loadPosition(i2); + float3 center = (((p0 + p1) + p2) / 3.0f); + float3 voxelPos = toVoxelPos(center); + uint voxelIndex = toIndex1D(uniforms[0].y, voxelPos); + uint acefg = tint_atomicAdd(counters, (4u * voxelIndex), 1u); + if ((triangleIndex == 0u)) { + dbg.Store(16u, asuint(uniforms[0].y)); + dbg.Store(32u, asuint(center.x)); + dbg.Store(36u, asuint(center.y)); + dbg.Store(40u, asuint(center.z)); + } +} + +[numthreads(128, 1, 1)] +void main_count(tint_symbol_1 tint_symbol) { + main_count_inner(tint_symbol.GlobalInvocationID); + return; +} + +struct tint_symbol_3 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +uint tint_atomicAdd_1(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void main_create_lut_inner(uint3 GlobalInvocationID) { + uint voxelIndex = GlobalInvocationID.x; + doIgnore(); + uint maxVoxels = ((uniforms[0].y * uniforms[0].y) * uniforms[0].y); + if ((voxelIndex >= maxVoxels)) { + return; + } + uint numTriangles = tint_atomicLoad(counters, (4u * voxelIndex)); + int offset = -1; + if ((numTriangles > 0u)) { + const uint tint_symbol_6 = tint_atomicAdd_1(dbg, 0u, numTriangles); + offset = int(tint_symbol_6); + } + tint_atomicStore(LUT, (4u * voxelIndex), offset); +} + +[numthreads(128, 1, 1)] +void main_create_lut(tint_symbol_3 tint_symbol_2) { + main_create_lut_inner(tint_symbol_2.GlobalInvocationID); + return; +} + +struct tint_symbol_5 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +int tint_atomicAdd_2(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void main_sort_triangles_inner(uint3 GlobalInvocationID) { + uint triangleIndex = GlobalInvocationID.x; + doIgnore(); + if ((triangleIndex >= uniforms[0].x)) { + return; + } + uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u))); + uint i1 = indices.Load((4u * ((3u * triangleIndex) + 1u))); + uint i2 = indices.Load((4u * ((3u * triangleIndex) + 2u))); + float3 p0 = loadPosition(i0); + float3 p1 = loadPosition(i1); + float3 p2 = loadPosition(i2); + float3 center = (((p0 + p1) + p2) / 3.0f); + float3 voxelPos = toVoxelPos(center); + uint voxelIndex = toIndex1D(uniforms[0].y, voxelPos); + int triangleOffset = tint_atomicAdd_2(LUT, (4u * voxelIndex), 1); +} + +[numthreads(128, 1, 1)] +void main_sort_triangles(tint_symbol_5 tint_symbol_4) { + main_sort_triangles_inner(tint_symbol_4.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/tint/1113.wgsl.expected.hlsl b/test/tint/bug/tint/1113.wgsl.expected.hlsl deleted file mode 100644 index fa8e7e281e..0000000000 --- a/test/tint/bug/tint/1113.wgsl.expected.hlsl +++ /dev/null @@ -1,167 +0,0 @@ -uint value_or_one_if_zero_uint(uint value) { - return value == 0u ? 1u : value; -} - -uint atomicLoad_1(RWByteAddressBuffer buffer, uint offset) { - uint value = 0; - buffer.InterlockedOr(offset, 0, value); - return value; -} - -int atomicLoad_2(RWByteAddressBuffer buffer, uint offset) { - int value = 0; - buffer.InterlockedOr(offset, 0, value); - return value; -} - -uint atomicAdd_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedAdd(offset, value, original_value); - return original_value; -} - -void atomicStore_1(RWByteAddressBuffer buffer, uint offset, int value) { - int ignored; - buffer.InterlockedExchange(offset, value, ignored); -} - -int atomicAdd_2(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedAdd(offset, value, original_value); - return original_value; -} - -cbuffer cbuffer_uniforms : register(b0, space0) { - uint4 uniforms[3]; -}; -RWByteAddressBuffer indices : register(u10, space0); -RWByteAddressBuffer positions : register(u11, space0); -RWByteAddressBuffer counters : register(u20, space0); -RWByteAddressBuffer LUT : register(u21, space0); -RWByteAddressBuffer dbg : register(u50, space0); - -float3 toVoxelPos(float3 position) { - float3 bbMin = float3(asfloat(uniforms[1].x), asfloat(uniforms[1].y), asfloat(uniforms[1].z)); - float3 bbMax = float3(asfloat(uniforms[2].x), asfloat(uniforms[2].y), asfloat(uniforms[2].z)); - float3 bbSize = (bbMax - bbMin); - float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z); - float gridSize = float(uniforms[0].y); - float gx = ((gridSize * (position.x - asfloat(uniforms[1].x))) / cubeSize); - float gy = ((gridSize * (position.y - asfloat(uniforms[1].y))) / cubeSize); - float gz = ((gridSize * (position.z - asfloat(uniforms[1].z))) / cubeSize); - return float3(gx, gy, gz); -} - -uint toIndex1D(uint gridSize, float3 voxelPos) { - uint3 icoord = uint3(voxelPos); - return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z)); -} - -uint3 toIndex3D(uint gridSize, uint index) { - uint z_1 = (index / value_or_one_if_zero_uint((gridSize * gridSize))); - uint y_1 = ((index - ((gridSize * gridSize) * z_1)) / (gridSize == 0u ? 1u : gridSize)); - uint x_1 = (index % (gridSize == 0u ? 1u : gridSize)); - return uint3(x_1, y_1, z_1); -} - -float3 loadPosition(uint vertexIndex) { - float3 position = float3(asfloat(positions.Load((4u * ((3u * vertexIndex) + 0u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 1u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 2u))))); - return position; -} - -void doIgnore() { - uint g42 = uniforms[0].x; - uint kj6 = dbg.Load(20u); - uint b53 = atomicLoad_1(counters, (4u * uint(0))); - uint rwg = indices.Load((4u * uint(0))); - float rb5 = asfloat(positions.Load((4u * uint(0)))); - int g55 = atomicLoad_2(LUT, (4u * uint(0))); -} - -struct tint_symbol_1 { - uint3 GlobalInvocationID : SV_DispatchThreadID; -}; - -void main_count_inner(uint3 GlobalInvocationID) { - uint triangleIndex = GlobalInvocationID.x; - if ((triangleIndex >= uniforms[0].x)) { - return; - } - doIgnore(); - uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u))); - uint i1 = indices.Load((4u * ((3u * triangleIndex) + 1u))); - uint i2 = indices.Load((4u * ((3u * triangleIndex) + 2u))); - float3 p0 = loadPosition(i0); - float3 p1 = loadPosition(i1); - float3 p2 = loadPosition(i2); - float3 center = (((p0 + p1) + p2) / 3.0f); - float3 voxelPos = toVoxelPos(center); - uint voxelIndex = toIndex1D(uniforms[0].y, voxelPos); - uint acefg = atomicAdd_1(counters, (4u * voxelIndex), 1u); - if ((triangleIndex == 0u)) { - dbg.Store(16u, asuint(uniforms[0].y)); - dbg.Store(32u, asuint(center.x)); - dbg.Store(36u, asuint(center.y)); - dbg.Store(40u, asuint(center.z)); - } -} - -[numthreads(128, 1, 1)] -void main_count(tint_symbol_1 tint_symbol) { - main_count_inner(tint_symbol.GlobalInvocationID); - return; -} - -struct tint_symbol_3 { - uint3 GlobalInvocationID : SV_DispatchThreadID; -}; - -void main_create_lut_inner(uint3 GlobalInvocationID) { - uint voxelIndex = GlobalInvocationID.x; - doIgnore(); - uint maxVoxels = ((uniforms[0].y * uniforms[0].y) * uniforms[0].y); - if ((voxelIndex >= maxVoxels)) { - return; - } - uint numTriangles = atomicLoad_1(counters, (4u * voxelIndex)); - int offset = -1; - if ((numTriangles > 0u)) { - const uint tint_symbol_6 = atomicAdd_1(dbg, 0u, numTriangles); - offset = int(tint_symbol_6); - } - atomicStore_1(LUT, (4u * voxelIndex), offset); -} - -[numthreads(128, 1, 1)] -void main_create_lut(tint_symbol_3 tint_symbol_2) { - main_create_lut_inner(tint_symbol_2.GlobalInvocationID); - return; -} - -struct tint_symbol_5 { - uint3 GlobalInvocationID : SV_DispatchThreadID; -}; - -void main_sort_triangles_inner(uint3 GlobalInvocationID) { - uint triangleIndex = GlobalInvocationID.x; - doIgnore(); - if ((triangleIndex >= uniforms[0].x)) { - return; - } - uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u))); - uint i1 = indices.Load((4u * ((3u * triangleIndex) + 1u))); - uint i2 = indices.Load((4u * ((3u * triangleIndex) + 2u))); - float3 p0 = loadPosition(i0); - float3 p1 = loadPosition(i1); - float3 p2 = loadPosition(i2); - float3 center = (((p0 + p1) + p2) / 3.0f); - float3 voxelPos = toVoxelPos(center); - uint voxelIndex = toIndex1D(uniforms[0].y, voxelPos); - int triangleOffset = atomicAdd_2(LUT, (4u * voxelIndex), 1); -} - -[numthreads(128, 1, 1)] -void main_sort_triangles(tint_symbol_5 tint_symbol_4) { - main_sort_triangles_inner(tint_symbol_4.GlobalInvocationID); - return; -} diff --git a/test/tint/bug/tint/1113.wgsl.expected.msl b/test/tint/bug/tint/1113.wgsl.expected.msl index 2c4dcc8081..b62d4c5f7d 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.msl +++ b/test/tint/bug/tint/1113.wgsl.expected.msl @@ -12,15 +12,27 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint numTriangles; /* 0x0004 */ uint gridSize; /* 0x0008 */ uint pad1; /* 0x000c */ uint pad2; /* 0x0010 */ packed_float3 bbMin; - /* 0x001c */ int8_t tint_pad[4]; + /* 0x001c */ tint_array tint_pad; /* 0x0020 */ packed_float3 bbMax; - /* 0x002c */ int8_t tint_pad_1[4]; + /* 0x002c */ tint_array tint_pad_1; }; struct Dbg { @@ -39,23 +51,23 @@ struct Dbg { }; struct F32s { - /* 0x0000 */ float values[1]; + /* 0x0000 */ tint_array values; }; struct U32s { - /* 0x0000 */ uint values[1]; + /* 0x0000 */ tint_array values; }; struct I32s { - int values[1]; + tint_array values; }; struct AU32s { - /* 0x0000 */ atomic_uint values[1]; + /* 0x0000 */ tint_array values; }; struct AI32s { - /* 0x0000 */ atomic_int values[1]; + /* 0x0000 */ tint_array values; }; float3 toVoxelPos(float3 position, const constant Uniforms* const tint_symbol_1) { diff --git a/test/tint/bug/tint/1113.wgsl.expected.spvasm b/test/tint/bug/tint/1113.wgsl.expected.spvasm index 124f9cf86d..8a91127124 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1113.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 403 +; Bound: 402 ; Schema: 0 OpCapability Shader %65 = OpExtInstImport "GLSL.std.450" @@ -217,12 +217,11 @@ %void = OpTypeVoid %175 = OpTypeFunction %void %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %int_0 = OpConstant %int 0 + %188 = OpConstantNull %int %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Function_int = OpTypePointer Function %int - %204 = OpConstantNull %int - %205 = OpTypeFunction %void %v3uint + %204 = OpTypeFunction %void %v3uint %bool = OpTypeBool %float_3 = OpConstant %float 3 %uint_8 = OpConstant %uint 8 @@ -356,7 +355,7 @@ %157 = OpLabel %position_0 = OpVariable %_ptr_Function_v3float Function %50 %159 = OpIMul %uint %uint_3 %vertexIndex - %160 = OpIAdd %uint %159 %uint_0 + %160 = OpIAdd %uint %159 %141 %162 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %160 %163 = OpLoad %float %162 %164 = OpIMul %uint %uint_3 %vertexIndex @@ -379,30 +378,30 @@ %b53 = OpVariable %_ptr_Function_uint Function %141 %rwg = OpVariable %_ptr_Function_uint Function %141 %rb5 = OpVariable %_ptr_Function_float Function %75 - %g55 = OpVariable %_ptr_Function_int Function %204 + %g55 = OpVariable %_ptr_Function_int Function %188 %179 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %180 = OpLoad %uint %179 OpStore %g42 %180 %183 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_5 %184 = OpLoad %uint %183 OpStore %kj6 %184 - %190 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %int_0 + %190 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %188 %186 = OpAtomicLoad %uint %190 %uint_1 %uint_0 OpStore %b53 %186 - %192 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %int_0 + %192 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %188 %193 = OpLoad %uint %192 OpStore %rwg %193 - %195 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %int_0 + %195 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %188 %196 = OpLoad %float %195 OpStore %rb5 %196 - %201 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %int_0 + %201 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %188 %198 = OpAtomicLoad %int %201 %uint_1 %uint_0 OpStore %g55 %198 OpReturn OpFunctionEnd -%main_count_inner = OpFunction %void None %205 +%main_count_inner = OpFunction %void None %204 %GlobalInvocationID = OpFunctionParameter %v3uint - %208 = OpLabel + %207 = OpLabel %triangleIndex = OpVariable %_ptr_Function_uint Function %141 %i0 = OpVariable %_ptr_Function_uint Function %141 %i1 = OpVariable %_ptr_Function_uint Function %141 @@ -410,160 +409,160 @@ %p0 = OpVariable %_ptr_Function_v3float Function %50 %p1 = OpVariable %_ptr_Function_v3float Function %50 %p2 = OpVariable %_ptr_Function_v3float Function %50 - %253 = OpVariable %_ptr_Function_v3float Function %50 + %252 = OpVariable %_ptr_Function_v3float Function %50 %center = OpVariable %_ptr_Function_v3float Function %50 %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %50 %voxelIndex = OpVariable %_ptr_Function_uint Function %141 %acefg = OpVariable %_ptr_Function_uint Function %141 - %209 = OpCompositeExtract %uint %GlobalInvocationID 0 - OpStore %triangleIndex %209 - %211 = OpLoad %uint %triangleIndex - %212 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %213 = OpLoad %uint %212 - %214 = OpUGreaterThanEqual %bool %211 %213 - OpSelectionMerge %216 None - OpBranchConditional %214 %217 %216 - %217 = OpLabel - OpReturn + %208 = OpCompositeExtract %uint %GlobalInvocationID 0 + OpStore %triangleIndex %208 + %210 = OpLoad %uint %triangleIndex + %211 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %212 = OpLoad %uint %211 + %213 = OpUGreaterThanEqual %bool %210 %212 + OpSelectionMerge %215 None + OpBranchConditional %213 %216 %215 %216 = OpLabel - %218 = OpFunctionCall %void %doIgnore - %219 = OpLoad %uint %triangleIndex - %220 = OpIMul %uint %uint_3 %219 - %221 = OpIAdd %uint %220 %uint_0 - %222 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %221 - %223 = OpLoad %uint %222 - OpStore %i0 %223 - %225 = OpLoad %uint %triangleIndex - %226 = OpIMul %uint %uint_3 %225 - %227 = OpIAdd %uint %226 %uint_1 - %228 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %227 - %229 = OpLoad %uint %228 - OpStore %i1 %229 - %231 = OpLoad %uint %triangleIndex - %232 = OpIMul %uint %uint_3 %231 - %233 = OpIAdd %uint %232 %uint_2 - %234 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %233 - %235 = OpLoad %uint %234 - OpStore %i2 %235 - %238 = OpLoad %uint %i0 - %237 = OpFunctionCall %v3float %loadPosition %238 - OpStore %p0 %237 - %241 = OpLoad %uint %i1 - %240 = OpFunctionCall %v3float %loadPosition %241 - OpStore %p1 %240 - %244 = OpLoad %uint %i2 - %243 = OpFunctionCall %v3float %loadPosition %244 - OpStore %p2 %243 - %246 = OpLoad %v3float %p0 - %247 = OpLoad %v3float %p1 - %248 = OpFAdd %v3float %246 %247 - %249 = OpLoad %v3float %p2 - %250 = OpFAdd %v3float %248 %249 - %254 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 - %252 = OpFDiv %v3float %250 %254 - OpStore %center %252 - %257 = OpLoad %v3float %center - %256 = OpFunctionCall %v3float %toVoxelPos %257 - OpStore %voxelPos_0 %256 - %260 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %261 = OpLoad %uint %260 - %262 = OpLoad %v3float %voxelPos_0 - %259 = OpFunctionCall %uint %toIndex1D %261 %262 - OpStore %voxelIndex %259 - %266 = OpLoad %uint %voxelIndex - %267 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %266 - %264 = OpAtomicIAdd %uint %267 %uint_1 %uint_0 %uint_1 - OpStore %acefg %264 - %269 = OpLoad %uint %triangleIndex - %270 = OpIEqual %bool %269 %uint_0 - OpSelectionMerge %271 None - OpBranchConditional %270 %272 %271 - %272 = OpLabel - %273 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_4 - %274 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %275 = OpLoad %uint %274 - OpStore %273 %275 - %277 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_8 - %278 = OpAccessChain %_ptr_Function_float %center %uint_0 - %279 = OpLoad %float %278 - OpStore %277 %279 - %281 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_9 - %282 = OpAccessChain %_ptr_Function_float %center %uint_1 - %283 = OpLoad %float %282 - OpStore %281 %283 - %285 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_10 - %286 = OpAccessChain %_ptr_Function_float %center %uint_2 - %287 = OpLoad %float %286 - OpStore %285 %287 - OpBranch %271 + OpReturn + %215 = OpLabel + %217 = OpFunctionCall %void %doIgnore + %218 = OpLoad %uint %triangleIndex + %219 = OpIMul %uint %uint_3 %218 + %220 = OpIAdd %uint %219 %141 + %221 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %220 + %222 = OpLoad %uint %221 + OpStore %i0 %222 + %224 = OpLoad %uint %triangleIndex + %225 = OpIMul %uint %uint_3 %224 + %226 = OpIAdd %uint %225 %uint_1 + %227 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %226 + %228 = OpLoad %uint %227 + OpStore %i1 %228 + %230 = OpLoad %uint %triangleIndex + %231 = OpIMul %uint %uint_3 %230 + %232 = OpIAdd %uint %231 %uint_2 + %233 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %232 + %234 = OpLoad %uint %233 + OpStore %i2 %234 + %237 = OpLoad %uint %i0 + %236 = OpFunctionCall %v3float %loadPosition %237 + OpStore %p0 %236 + %240 = OpLoad %uint %i1 + %239 = OpFunctionCall %v3float %loadPosition %240 + OpStore %p1 %239 + %243 = OpLoad %uint %i2 + %242 = OpFunctionCall %v3float %loadPosition %243 + OpStore %p2 %242 + %245 = OpLoad %v3float %p0 + %246 = OpLoad %v3float %p1 + %247 = OpFAdd %v3float %245 %246 + %248 = OpLoad %v3float %p2 + %249 = OpFAdd %v3float %247 %248 + %253 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 + %251 = OpFDiv %v3float %249 %253 + OpStore %center %251 + %256 = OpLoad %v3float %center + %255 = OpFunctionCall %v3float %toVoxelPos %256 + OpStore %voxelPos_0 %255 + %259 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %260 = OpLoad %uint %259 + %261 = OpLoad %v3float %voxelPos_0 + %258 = OpFunctionCall %uint %toIndex1D %260 %261 + OpStore %voxelIndex %258 + %265 = OpLoad %uint %voxelIndex + %266 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %265 + %263 = OpAtomicIAdd %uint %266 %uint_1 %uint_0 %uint_1 + OpStore %acefg %263 + %268 = OpLoad %uint %triangleIndex + %269 = OpIEqual %bool %268 %141 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %270 %271 = OpLabel + %272 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_4 + %273 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %274 = OpLoad %uint %273 + OpStore %272 %274 + %276 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_8 + %277 = OpAccessChain %_ptr_Function_float %center %uint_0 + %278 = OpLoad %float %277 + OpStore %276 %278 + %280 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_9 + %281 = OpAccessChain %_ptr_Function_float %center %uint_1 + %282 = OpLoad %float %281 + OpStore %280 %282 + %284 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_10 + %285 = OpAccessChain %_ptr_Function_float %center %uint_2 + %286 = OpLoad %float %285 + OpStore %284 %286 + OpBranch %270 + %270 = OpLabel OpReturn OpFunctionEnd %main_count = OpFunction %void None %175 - %289 = OpLabel - %291 = OpLoad %v3uint %GlobalInvocationID_1 - %290 = OpFunctionCall %void %main_count_inner %291 + %288 = OpLabel + %290 = OpLoad %v3uint %GlobalInvocationID_1 + %289 = OpFunctionCall %void %main_count_inner %290 OpReturn OpFunctionEnd -%main_create_lut_inner = OpFunction %void None %205 +%main_create_lut_inner = OpFunction %void None %204 %GlobalInvocationID_0 = OpFunctionParameter %v3uint - %294 = OpLabel + %293 = OpLabel %voxelIndex_0 = OpVariable %_ptr_Function_uint Function %141 %maxVoxels = OpVariable %_ptr_Function_uint Function %141 %numTriangles = OpVariable %_ptr_Function_uint Function %141 - %offset = OpVariable %_ptr_Function_int Function %204 - %295 = OpCompositeExtract %uint %GlobalInvocationID_0 0 - OpStore %voxelIndex_0 %295 - %297 = OpFunctionCall %void %doIgnore - %298 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %299 = OpLoad %uint %298 - %300 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %301 = OpLoad %uint %300 - %302 = OpIMul %uint %299 %301 - %303 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %304 = OpLoad %uint %303 - %305 = OpIMul %uint %302 %304 - OpStore %maxVoxels %305 - %307 = OpLoad %uint %voxelIndex_0 - %308 = OpLoad %uint %maxVoxels - %309 = OpUGreaterThanEqual %bool %307 %308 - OpSelectionMerge %310 None - OpBranchConditional %309 %311 %310 - %311 = OpLabel - OpReturn + %offset = OpVariable %_ptr_Function_int Function %188 + %294 = OpCompositeExtract %uint %GlobalInvocationID_0 0 + OpStore %voxelIndex_0 %294 + %296 = OpFunctionCall %void %doIgnore + %297 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %298 = OpLoad %uint %297 + %299 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %300 = OpLoad %uint %299 + %301 = OpIMul %uint %298 %300 + %302 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %303 = OpLoad %uint %302 + %304 = OpIMul %uint %301 %303 + OpStore %maxVoxels %304 + %306 = OpLoad %uint %voxelIndex_0 + %307 = OpLoad %uint %maxVoxels + %308 = OpUGreaterThanEqual %bool %306 %307 + OpSelectionMerge %309 None + OpBranchConditional %308 %310 %309 %310 = OpLabel - %314 = OpLoad %uint %voxelIndex_0 - %315 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %314 - %312 = OpAtomicLoad %uint %315 %uint_1 %uint_0 - OpStore %numTriangles %312 + OpReturn + %309 = OpLabel + %313 = OpLoad %uint %voxelIndex_0 + %314 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %313 + %311 = OpAtomicLoad %uint %314 %uint_1 %uint_0 + OpStore %numTriangles %311 OpStore %offset %int_n1 - %319 = OpLoad %uint %numTriangles - %320 = OpUGreaterThan %bool %319 %uint_0 - OpSelectionMerge %321 None - OpBranchConditional %320 %322 %321 - %322 = OpLabel - %325 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0 - %326 = OpLoad %uint %numTriangles - %323 = OpAtomicIAdd %uint %325 %uint_1 %uint_0 %326 - %327 = OpBitcast %int %323 - OpStore %offset %327 - OpBranch %321 + %318 = OpLoad %uint %numTriangles + %319 = OpUGreaterThan %bool %318 %141 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %320 %321 = OpLabel - %330 = OpLoad %uint %voxelIndex_0 - %331 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %330 - %332 = OpLoad %int %offset - OpAtomicStore %331 %uint_1 %uint_0 %332 + %324 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0 + %325 = OpLoad %uint %numTriangles + %322 = OpAtomicIAdd %uint %324 %uint_1 %uint_0 %325 + %326 = OpBitcast %int %322 + OpStore %offset %326 + OpBranch %320 + %320 = OpLabel + %329 = OpLoad %uint %voxelIndex_0 + %330 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %329 + %331 = OpLoad %int %offset + OpAtomicStore %330 %uint_1 %uint_0 %331 OpReturn OpFunctionEnd %main_create_lut = OpFunction %void None %175 - %334 = OpLabel - %336 = OpLoad %v3uint %GlobalInvocationID_2 - %335 = OpFunctionCall %void %main_create_lut_inner %336 + %333 = OpLabel + %335 = OpLoad %v3uint %GlobalInvocationID_2 + %334 = OpFunctionCall %void %main_create_lut_inner %335 OpReturn OpFunctionEnd -%main_sort_triangles_inner = OpFunction %void None %205 +%main_sort_triangles_inner = OpFunction %void None %204 %GlobalInvocationID_4 = OpFunctionParameter %v3uint - %339 = OpLabel + %338 = OpLabel %triangleIndex_0 = OpVariable %_ptr_Function_uint Function %141 %i0_0 = OpVariable %_ptr_Function_uint Function %141 %i1_0 = OpVariable %_ptr_Function_uint Function %141 @@ -571,75 +570,75 @@ %p0_0 = OpVariable %_ptr_Function_v3float Function %50 %p1_0 = OpVariable %_ptr_Function_v3float Function %50 %p2_0 = OpVariable %_ptr_Function_v3float Function %50 - %382 = OpVariable %_ptr_Function_v3float Function %50 + %381 = OpVariable %_ptr_Function_v3float Function %50 %center_0 = OpVariable %_ptr_Function_v3float Function %50 %voxelPos_1 = OpVariable %_ptr_Function_v3float Function %50 %voxelIndex_1 = OpVariable %_ptr_Function_uint Function %141 -%triangleOffset = OpVariable %_ptr_Function_int Function %204 - %340 = OpCompositeExtract %uint %GlobalInvocationID_4 0 - OpStore %triangleIndex_0 %340 - %342 = OpFunctionCall %void %doIgnore - %343 = OpLoad %uint %triangleIndex_0 - %344 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %345 = OpLoad %uint %344 - %346 = OpUGreaterThanEqual %bool %343 %345 - OpSelectionMerge %347 None - OpBranchConditional %346 %348 %347 - %348 = OpLabel - OpReturn +%triangleOffset = OpVariable %_ptr_Function_int Function %188 + %339 = OpCompositeExtract %uint %GlobalInvocationID_4 0 + OpStore %triangleIndex_0 %339 + %341 = OpFunctionCall %void %doIgnore + %342 = OpLoad %uint %triangleIndex_0 + %343 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %344 = OpLoad %uint %343 + %345 = OpUGreaterThanEqual %bool %342 %344 + OpSelectionMerge %346 None + OpBranchConditional %345 %347 %346 %347 = OpLabel - %349 = OpLoad %uint %triangleIndex_0 - %350 = OpIMul %uint %uint_3 %349 - %351 = OpIAdd %uint %350 %uint_0 - %352 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %351 - %353 = OpLoad %uint %352 - OpStore %i0_0 %353 - %355 = OpLoad %uint %triangleIndex_0 - %356 = OpIMul %uint %uint_3 %355 - %357 = OpIAdd %uint %356 %uint_1 - %358 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %357 - %359 = OpLoad %uint %358 - OpStore %i1_0 %359 - %361 = OpLoad %uint %triangleIndex_0 - %362 = OpIMul %uint %uint_3 %361 - %363 = OpIAdd %uint %362 %uint_2 - %364 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %363 - %365 = OpLoad %uint %364 - OpStore %i2_0 %365 - %368 = OpLoad %uint %i0_0 - %367 = OpFunctionCall %v3float %loadPosition %368 - OpStore %p0_0 %367 - %371 = OpLoad %uint %i1_0 - %370 = OpFunctionCall %v3float %loadPosition %371 - OpStore %p1_0 %370 - %374 = OpLoad %uint %i2_0 - %373 = OpFunctionCall %v3float %loadPosition %374 - OpStore %p2_0 %373 - %376 = OpLoad %v3float %p0_0 - %377 = OpLoad %v3float %p1_0 - %378 = OpFAdd %v3float %376 %377 - %379 = OpLoad %v3float %p2_0 - %380 = OpFAdd %v3float %378 %379 - %383 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 - %381 = OpFDiv %v3float %380 %383 - OpStore %center_0 %381 - %386 = OpLoad %v3float %center_0 - %385 = OpFunctionCall %v3float %toVoxelPos %386 - OpStore %voxelPos_1 %385 - %389 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %390 = OpLoad %uint %389 - %391 = OpLoad %v3float %voxelPos_1 - %388 = OpFunctionCall %uint %toIndex1D %390 %391 - OpStore %voxelIndex_1 %388 - %395 = OpLoad %uint %voxelIndex_1 - %396 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %395 - %393 = OpAtomicIAdd %int %396 %uint_1 %uint_0 %int_1 - OpStore %triangleOffset %393 + OpReturn + %346 = OpLabel + %348 = OpLoad %uint %triangleIndex_0 + %349 = OpIMul %uint %uint_3 %348 + %350 = OpIAdd %uint %349 %141 + %351 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %350 + %352 = OpLoad %uint %351 + OpStore %i0_0 %352 + %354 = OpLoad %uint %triangleIndex_0 + %355 = OpIMul %uint %uint_3 %354 + %356 = OpIAdd %uint %355 %uint_1 + %357 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %356 + %358 = OpLoad %uint %357 + OpStore %i1_0 %358 + %360 = OpLoad %uint %triangleIndex_0 + %361 = OpIMul %uint %uint_3 %360 + %362 = OpIAdd %uint %361 %uint_2 + %363 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %362 + %364 = OpLoad %uint %363 + OpStore %i2_0 %364 + %367 = OpLoad %uint %i0_0 + %366 = OpFunctionCall %v3float %loadPosition %367 + OpStore %p0_0 %366 + %370 = OpLoad %uint %i1_0 + %369 = OpFunctionCall %v3float %loadPosition %370 + OpStore %p1_0 %369 + %373 = OpLoad %uint %i2_0 + %372 = OpFunctionCall %v3float %loadPosition %373 + OpStore %p2_0 %372 + %375 = OpLoad %v3float %p0_0 + %376 = OpLoad %v3float %p1_0 + %377 = OpFAdd %v3float %375 %376 + %378 = OpLoad %v3float %p2_0 + %379 = OpFAdd %v3float %377 %378 + %382 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 + %380 = OpFDiv %v3float %379 %382 + OpStore %center_0 %380 + %385 = OpLoad %v3float %center_0 + %384 = OpFunctionCall %v3float %toVoxelPos %385 + OpStore %voxelPos_1 %384 + %388 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %389 = OpLoad %uint %388 + %390 = OpLoad %v3float %voxelPos_1 + %387 = OpFunctionCall %uint %toIndex1D %389 %390 + OpStore %voxelIndex_1 %387 + %394 = OpLoad %uint %voxelIndex_1 + %395 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %394 + %392 = OpAtomicIAdd %int %395 %uint_1 %uint_0 %int_1 + OpStore %triangleOffset %392 OpReturn OpFunctionEnd %main_sort_triangles = OpFunction %void None %175 - %400 = OpLabel - %402 = OpLoad %v3uint %GlobalInvocationID_3 - %401 = OpFunctionCall %void %main_sort_triangles_inner %402 + %399 = OpLabel + %401 = OpLoad %v3uint %GlobalInvocationID_3 + %400 = OpFunctionCall %void %main_sort_triangles_inner %401 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1113.wgsl.expected.wgsl b/test/tint/bug/tint/1113.wgsl.expected.wgsl index 187c752ef8..1d69ccdb63 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1113.wgsl.expected.wgsl @@ -92,7 +92,7 @@ fn doIgnore() { var g55 = atomicLoad(&(LUT.values[0])); } -@stage(compute) @workgroup_size(128) +@compute @workgroup_size(128) fn main_count(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var triangleIndex = GlobalInvocationID.x; if ((triangleIndex >= uniforms.numTriangles)) { @@ -117,7 +117,7 @@ fn main_count(@builtin(global_invocation_id) GlobalInvocationID : vec3) { } } -@stage(compute) @workgroup_size(128) +@compute @workgroup_size(128) fn main_create_lut(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var voxelIndex = GlobalInvocationID.x; doIgnore(); @@ -133,7 +133,7 @@ fn main_create_lut(@builtin(global_invocation_id) GlobalInvocationID : vec3 atomicStore(&(LUT.values[voxelIndex]), offset); } -@stage(compute) @workgroup_size(128) +@compute @workgroup_size(128) fn main_sort_triangles(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var triangleIndex = GlobalInvocationID.x; doIgnore(); diff --git a/test/tint/bug/tint/1118.wgsl b/test/tint/bug/tint/1118.wgsl index bd59a5f3f1..67703f92ca 100644 --- a/test/tint/bug/tint/1118.wgsl +++ b/test/tint/bug/tint/1118.wgsl @@ -108,7 +108,7 @@ struct main_out { glFragColor_1 : vec4, }; -@stage(fragment) +@fragment fn main(@location(2) fClipDistance3_param : f32, @location(3) fClipDistance4_param : f32) -> main_out { fClipDistance3 = fClipDistance3_param; fClipDistance4 = fClipDistance4_param; diff --git a/test/tint/bug/tint/1118.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1118.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..91abf604d5 --- /dev/null +++ b/test/tint/bug/tint/1118.wgsl.expected.dxc.hlsl @@ -0,0 +1,134 @@ +bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform control flow + normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64)))); + ^^^^ + +bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value + if ((x_9 > 0.0)) { + ^^ + +bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value + let x_9 : f32 = fClipDistance3; + ^^^^^^^^^^^^^^ + +static float fClipDistance3 = 0.0f; +static float fClipDistance4 = 0.0f; +cbuffer cbuffer_x_29 : register(b0, space0) { + uint4 x_29[1]; +}; +cbuffer cbuffer_x_49 : register(b1, space0) { + uint4 x_49[3]; +}; +cbuffer cbuffer_x_137 : register(b2, space0) { + uint4 x_137[1]; +}; +static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static bool tint_discard = false; + +void main_1() { + float3 viewDirectionW = float3(0.0f, 0.0f, 0.0f); + float4 baseColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 diffuseColor = float3(0.0f, 0.0f, 0.0f); + float alpha = 0.0f; + float3 normalW = float3(0.0f, 0.0f, 0.0f); + float2 uvOffset = float2(0.0f, 0.0f); + float3 baseAmbientColor = float3(0.0f, 0.0f, 0.0f); + float glossiness = 0.0f; + float3 diffuseBase = float3(0.0f, 0.0f, 0.0f); + float shadow = 0.0f; + float4 refractionColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 reflectionColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 emissiveColor = float3(0.0f, 0.0f, 0.0f); + float3 finalDiffuse = float3(0.0f, 0.0f, 0.0f); + float3 finalSpecular = float3(0.0f, 0.0f, 0.0f); + float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + if ((fClipDistance3 > 0.0f)) { + tint_discard = true; + return; + } + if ((fClipDistance4 > 0.0f)) { + tint_discard = true; + return; + } + const float4 x_34 = asfloat(x_29[0]); + const float3 x_38 = (0.0f).xxx; + viewDirectionW = normalize((float3(x_34.x, x_34.y, x_34.z) - x_38)); + baseColor = (1.0f).xxxx; + const float4 x_52 = asfloat(x_49[0]); + diffuseColor = float3(x_52.x, x_52.y, x_52.z); + const float x_60 = asfloat(x_49[0].w); + alpha = x_60; + const float3 x_62 = (0.0f).xxx; + const float3 x_64 = (0.0f).xxx; + normalW = normalize(-(cross(ddx(x_62), ddy(x_64)))); + uvOffset = (0.0f).xx; + const float4 x_74 = (0.0f).xxxx; + const float4 x_76 = baseColor; + const float3 x_78 = (float3(x_76.x, x_76.y, x_76.z) * float3(x_74.x, x_74.y, x_74.z)); + baseColor = float4(x_78.x, x_78.y, x_78.z, baseColor.w); + baseAmbientColor = (1.0f).xxx; + glossiness = 0.0f; + diffuseBase = (0.0f).xxx; + shadow = 1.0f; + refractionColor = float4(0.0f, 0.0f, 0.0f, 1.0f); + reflectionColor = float4(0.0f, 0.0f, 0.0f, 1.0f); + const float3 x_94 = asfloat(x_49[2].xyz); + emissiveColor = x_94; + const float3 x_96 = diffuseBase; + const float3 x_97 = diffuseColor; + const float3 x_99 = emissiveColor; + const float3 x_103 = asfloat(x_49[1].xyz); + const float4 x_108 = baseColor; + finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), (0.0f).xxx, (1.0f).xxx) * float3(x_108.x, x_108.y, x_108.z)); + finalSpecular = (0.0f).xxx; + const float4 x_118 = reflectionColor; + const float4 x_121 = refractionColor; + const float3 x_123 = ((((finalDiffuse * baseAmbientColor) + finalSpecular) + float3(x_118.x, x_118.y, x_118.z)) + float3(x_121.x, x_121.y, x_121.z)); + color = float4(x_123.x, x_123.y, x_123.z, alpha); + const float4 x_129 = color; + const float3 x_132 = max(float3(x_129.x, x_129.y, x_129.z), (0.0f).xxx); + color = float4(x_132.x, x_132.y, x_132.z, color.w); + const float x_140 = asfloat(x_137[0].x); + const float x_142 = color.w; + color.w = (x_142 * x_140); + glFragColor = color; + return; +} + +struct main_out { + float4 glFragColor_1; +}; +struct tint_symbol_1 { + float fClipDistance3_param : TEXCOORD2; + float fClipDistance4_param : TEXCOORD3; +}; +struct tint_symbol_2 { + float4 glFragColor_1 : SV_Target0; +}; + +main_out main_inner(float fClipDistance3_param, float fClipDistance4_param) { + fClipDistance3 = fClipDistance3_param; + fClipDistance4 = fClipDistance4_param; + main_1(); + if (tint_discard) { + const main_out tint_symbol_8 = (main_out)0; + return tint_symbol_8; + } + const main_out tint_symbol_9 = {glFragColor}; + return tint_symbol_9; +} + +void tint_discard_func() { + discard; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.fClipDistance3_param, tint_symbol.fClipDistance4_param); + if (tint_discard) { + tint_discard_func(); + const tint_symbol_2 tint_symbol_10 = (tint_symbol_2)0; + return tint_symbol_10; + } + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.glFragColor_1 = inner_result.glFragColor_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1118.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1118.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..91abf604d5 --- /dev/null +++ b/test/tint/bug/tint/1118.wgsl.expected.fxc.hlsl @@ -0,0 +1,134 @@ +bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform control flow + normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64)))); + ^^^^ + +bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value + if ((x_9 > 0.0)) { + ^^ + +bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value + let x_9 : f32 = fClipDistance3; + ^^^^^^^^^^^^^^ + +static float fClipDistance3 = 0.0f; +static float fClipDistance4 = 0.0f; +cbuffer cbuffer_x_29 : register(b0, space0) { + uint4 x_29[1]; +}; +cbuffer cbuffer_x_49 : register(b1, space0) { + uint4 x_49[3]; +}; +cbuffer cbuffer_x_137 : register(b2, space0) { + uint4 x_137[1]; +}; +static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static bool tint_discard = false; + +void main_1() { + float3 viewDirectionW = float3(0.0f, 0.0f, 0.0f); + float4 baseColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 diffuseColor = float3(0.0f, 0.0f, 0.0f); + float alpha = 0.0f; + float3 normalW = float3(0.0f, 0.0f, 0.0f); + float2 uvOffset = float2(0.0f, 0.0f); + float3 baseAmbientColor = float3(0.0f, 0.0f, 0.0f); + float glossiness = 0.0f; + float3 diffuseBase = float3(0.0f, 0.0f, 0.0f); + float shadow = 0.0f; + float4 refractionColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 reflectionColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 emissiveColor = float3(0.0f, 0.0f, 0.0f); + float3 finalDiffuse = float3(0.0f, 0.0f, 0.0f); + float3 finalSpecular = float3(0.0f, 0.0f, 0.0f); + float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + if ((fClipDistance3 > 0.0f)) { + tint_discard = true; + return; + } + if ((fClipDistance4 > 0.0f)) { + tint_discard = true; + return; + } + const float4 x_34 = asfloat(x_29[0]); + const float3 x_38 = (0.0f).xxx; + viewDirectionW = normalize((float3(x_34.x, x_34.y, x_34.z) - x_38)); + baseColor = (1.0f).xxxx; + const float4 x_52 = asfloat(x_49[0]); + diffuseColor = float3(x_52.x, x_52.y, x_52.z); + const float x_60 = asfloat(x_49[0].w); + alpha = x_60; + const float3 x_62 = (0.0f).xxx; + const float3 x_64 = (0.0f).xxx; + normalW = normalize(-(cross(ddx(x_62), ddy(x_64)))); + uvOffset = (0.0f).xx; + const float4 x_74 = (0.0f).xxxx; + const float4 x_76 = baseColor; + const float3 x_78 = (float3(x_76.x, x_76.y, x_76.z) * float3(x_74.x, x_74.y, x_74.z)); + baseColor = float4(x_78.x, x_78.y, x_78.z, baseColor.w); + baseAmbientColor = (1.0f).xxx; + glossiness = 0.0f; + diffuseBase = (0.0f).xxx; + shadow = 1.0f; + refractionColor = float4(0.0f, 0.0f, 0.0f, 1.0f); + reflectionColor = float4(0.0f, 0.0f, 0.0f, 1.0f); + const float3 x_94 = asfloat(x_49[2].xyz); + emissiveColor = x_94; + const float3 x_96 = diffuseBase; + const float3 x_97 = diffuseColor; + const float3 x_99 = emissiveColor; + const float3 x_103 = asfloat(x_49[1].xyz); + const float4 x_108 = baseColor; + finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), (0.0f).xxx, (1.0f).xxx) * float3(x_108.x, x_108.y, x_108.z)); + finalSpecular = (0.0f).xxx; + const float4 x_118 = reflectionColor; + const float4 x_121 = refractionColor; + const float3 x_123 = ((((finalDiffuse * baseAmbientColor) + finalSpecular) + float3(x_118.x, x_118.y, x_118.z)) + float3(x_121.x, x_121.y, x_121.z)); + color = float4(x_123.x, x_123.y, x_123.z, alpha); + const float4 x_129 = color; + const float3 x_132 = max(float3(x_129.x, x_129.y, x_129.z), (0.0f).xxx); + color = float4(x_132.x, x_132.y, x_132.z, color.w); + const float x_140 = asfloat(x_137[0].x); + const float x_142 = color.w; + color.w = (x_142 * x_140); + glFragColor = color; + return; +} + +struct main_out { + float4 glFragColor_1; +}; +struct tint_symbol_1 { + float fClipDistance3_param : TEXCOORD2; + float fClipDistance4_param : TEXCOORD3; +}; +struct tint_symbol_2 { + float4 glFragColor_1 : SV_Target0; +}; + +main_out main_inner(float fClipDistance3_param, float fClipDistance4_param) { + fClipDistance3 = fClipDistance3_param; + fClipDistance4 = fClipDistance4_param; + main_1(); + if (tint_discard) { + const main_out tint_symbol_8 = (main_out)0; + return tint_symbol_8; + } + const main_out tint_symbol_9 = {glFragColor}; + return tint_symbol_9; +} + +void tint_discard_func() { + discard; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.fClipDistance3_param, tint_symbol.fClipDistance4_param); + if (tint_discard) { + tint_discard_func(); + const tint_symbol_2 tint_symbol_10 = (tint_symbol_2)0; + return tint_symbol_10; + } + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.glFragColor_1 = inner_result.glFragColor_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1118.wgsl.expected.glsl b/test/tint/bug/tint/1118.wgsl.expected.glsl index 1a8acc6627..a39c375bcb 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.glsl +++ b/test/tint/bug/tint/1118.wgsl.expected.glsl @@ -1,3 +1,15 @@ +bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform control flow + normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64)))); + ^^^^ + +bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value + if ((x_9 > 0.0)) { + ^^ + +bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value + let x_9 : f32 = fClipDistance3; + ^^^^^^^^^^^^^^ + #version 310 es precision mediump float; @@ -66,24 +78,24 @@ void main_1() { return; } vec4 x_34 = x_29.vEyePosition; - vec3 x_38 = vec3(0.0f, 0.0f, 0.0f); + vec3 x_38 = vec3(0.0f); viewDirectionW = normalize((vec3(x_34.x, x_34.y, x_34.z) - x_38)); - baseColor = vec4(1.0f, 1.0f, 1.0f, 1.0f); + baseColor = vec4(1.0f); vec4 x_52 = x_49.vDiffuseColor; diffuseColor = vec3(x_52.x, x_52.y, x_52.z); float x_60 = x_49.vDiffuseColor.w; alpha = x_60; - vec3 x_62 = vec3(0.0f, 0.0f, 0.0f); - vec3 x_64 = vec3(0.0f, 0.0f, 0.0f); + vec3 x_62 = vec3(0.0f); + vec3 x_64 = vec3(0.0f); normalW = normalize(-(cross(dFdx(x_62), dFdy(x_64)))); - uvOffset = vec2(0.0f, 0.0f); - vec4 x_74 = vec4(0.0f, 0.0f, 0.0f, 0.0f); + uvOffset = vec2(0.0f); + vec4 x_74 = vec4(0.0f); vec4 x_76 = baseColor; vec3 x_78 = (vec3(x_76.x, x_76.y, x_76.z) * vec3(x_74.x, x_74.y, x_74.z)); baseColor = vec4(x_78.x, x_78.y, x_78.z, baseColor.w); - baseAmbientColor = vec3(1.0f, 1.0f, 1.0f); + baseAmbientColor = vec3(1.0f); glossiness = 0.0f; - diffuseBase = vec3(0.0f, 0.0f, 0.0f); + diffuseBase = vec3(0.0f); shadow = 1.0f; refractionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f); reflectionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f); @@ -94,14 +106,14 @@ void main_1() { vec3 x_99 = emissiveColor; vec3 x_103 = x_49.vAmbientColor; vec4 x_108 = baseColor; - finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3(0.0f, 0.0f, 0.0f), vec3(1.0f, 1.0f, 1.0f)) * vec3(x_108.x, x_108.y, x_108.z)); - finalSpecular = vec3(0.0f, 0.0f, 0.0f); + finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3(0.0f), vec3(1.0f)) * vec3(x_108.x, x_108.y, x_108.z)); + finalSpecular = vec3(0.0f); vec4 x_118 = reflectionColor; vec4 x_121 = refractionColor; vec3 x_123 = ((((finalDiffuse * baseAmbientColor) + finalSpecular) + vec3(x_118.x, x_118.y, x_118.z)) + vec3(x_121.x, x_121.y, x_121.z)); color = vec4(x_123.x, x_123.y, x_123.z, alpha); vec4 x_129 = color; - vec3 x_132 = max(vec3(x_129.x, x_129.y, x_129.z), vec3(0.0f, 0.0f, 0.0f)); + vec3 x_132 = max(vec3(x_129.x, x_129.y, x_129.z), vec3(0.0f)); color = vec4(x_132.x, x_132.y, x_132.z, color.w); float x_140 = x_137.visibility; float x_142 = color.w; @@ -119,7 +131,7 @@ main_out tint_symbol(float fClipDistance3_param, float fClipDistance4_param) { fClipDistance4 = fClipDistance4_param; main_1(); if (tint_discard) { - main_out tint_symbol_1 = main_out(vec4(0.0f, 0.0f, 0.0f, 0.0f)); + main_out tint_symbol_1 = main_out(vec4(0.0f)); return tint_symbol_1; } main_out tint_symbol_2 = main_out(glFragColor); diff --git a/test/tint/bug/tint/1118.wgsl.expected.hlsl b/test/tint/bug/tint/1118.wgsl.expected.hlsl deleted file mode 100644 index 117a578417..0000000000 --- a/test/tint/bug/tint/1118.wgsl.expected.hlsl +++ /dev/null @@ -1,122 +0,0 @@ -static float fClipDistance3 = 0.0f; -static float fClipDistance4 = 0.0f; -cbuffer cbuffer_x_29 : register(b0, space0) { - uint4 x_29[1]; -}; -cbuffer cbuffer_x_49 : register(b1, space0) { - uint4 x_49[3]; -}; -cbuffer cbuffer_x_137 : register(b2, space0) { - uint4 x_137[1]; -}; -static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); -static bool tint_discard = false; - -void main_1() { - float3 viewDirectionW = float3(0.0f, 0.0f, 0.0f); - float4 baseColor = float4(0.0f, 0.0f, 0.0f, 0.0f); - float3 diffuseColor = float3(0.0f, 0.0f, 0.0f); - float alpha = 0.0f; - float3 normalW = float3(0.0f, 0.0f, 0.0f); - float2 uvOffset = float2(0.0f, 0.0f); - float3 baseAmbientColor = float3(0.0f, 0.0f, 0.0f); - float glossiness = 0.0f; - float3 diffuseBase = float3(0.0f, 0.0f, 0.0f); - float shadow = 0.0f; - float4 refractionColor = float4(0.0f, 0.0f, 0.0f, 0.0f); - float4 reflectionColor = float4(0.0f, 0.0f, 0.0f, 0.0f); - float3 emissiveColor = float3(0.0f, 0.0f, 0.0f); - float3 finalDiffuse = float3(0.0f, 0.0f, 0.0f); - float3 finalSpecular = float3(0.0f, 0.0f, 0.0f); - float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); - if ((fClipDistance3 > 0.0f)) { - tint_discard = true; - return; - } - if ((fClipDistance4 > 0.0f)) { - tint_discard = true; - return; - } - const float4 x_34 = asfloat(x_29[0]); - const float3 x_38 = float3(0.0f, 0.0f, 0.0f); - viewDirectionW = normalize((float3(x_34.x, x_34.y, x_34.z) - x_38)); - baseColor = float4(1.0f, 1.0f, 1.0f, 1.0f); - const float4 x_52 = asfloat(x_49[0]); - diffuseColor = float3(x_52.x, x_52.y, x_52.z); - const float x_60 = asfloat(x_49[0].w); - alpha = x_60; - const float3 x_62 = float3(0.0f, 0.0f, 0.0f); - const float3 x_64 = float3(0.0f, 0.0f, 0.0f); - normalW = normalize(-(cross(ddx(x_62), ddy(x_64)))); - uvOffset = float2(0.0f, 0.0f); - const float4 x_74 = float4(0.0f, 0.0f, 0.0f, 0.0f); - const float4 x_76 = baseColor; - const float3 x_78 = (float3(x_76.x, x_76.y, x_76.z) * float3(x_74.x, x_74.y, x_74.z)); - baseColor = float4(x_78.x, x_78.y, x_78.z, baseColor.w); - baseAmbientColor = float3(1.0f, 1.0f, 1.0f); - glossiness = 0.0f; - diffuseBase = float3(0.0f, 0.0f, 0.0f); - shadow = 1.0f; - refractionColor = float4(0.0f, 0.0f, 0.0f, 1.0f); - reflectionColor = float4(0.0f, 0.0f, 0.0f, 1.0f); - const float3 x_94 = asfloat(x_49[2].xyz); - emissiveColor = x_94; - const float3 x_96 = diffuseBase; - const float3 x_97 = diffuseColor; - const float3 x_99 = emissiveColor; - const float3 x_103 = asfloat(x_49[1].xyz); - const float4 x_108 = baseColor; - finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), float3(0.0f, 0.0f, 0.0f), float3(1.0f, 1.0f, 1.0f)) * float3(x_108.x, x_108.y, x_108.z)); - finalSpecular = float3(0.0f, 0.0f, 0.0f); - const float4 x_118 = reflectionColor; - const float4 x_121 = refractionColor; - const float3 x_123 = ((((finalDiffuse * baseAmbientColor) + finalSpecular) + float3(x_118.x, x_118.y, x_118.z)) + float3(x_121.x, x_121.y, x_121.z)); - color = float4(x_123.x, x_123.y, x_123.z, alpha); - const float4 x_129 = color; - const float3 x_132 = max(float3(x_129.x, x_129.y, x_129.z), float3(0.0f, 0.0f, 0.0f)); - color = float4(x_132.x, x_132.y, x_132.z, color.w); - const float x_140 = asfloat(x_137[0].x); - const float x_142 = color.w; - color.w = (x_142 * x_140); - glFragColor = color; - return; -} - -struct main_out { - float4 glFragColor_1; -}; -struct tint_symbol_1 { - float fClipDistance3_param : TEXCOORD2; - float fClipDistance4_param : TEXCOORD3; -}; -struct tint_symbol_2 { - float4 glFragColor_1 : SV_Target0; -}; - -main_out main_inner(float fClipDistance3_param, float fClipDistance4_param) { - fClipDistance3 = fClipDistance3_param; - fClipDistance4 = fClipDistance4_param; - main_1(); - if (tint_discard) { - const main_out tint_symbol_8 = (main_out)0; - return tint_symbol_8; - } - const main_out tint_symbol_9 = {glFragColor}; - return tint_symbol_9; -} - -void tint_discard_func() { - discard; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.fClipDistance3_param, tint_symbol.fClipDistance4_param); - if (tint_discard) { - tint_discard_func(); - const tint_symbol_2 tint_symbol_10 = (tint_symbol_2)0; - return tint_symbol_10; - } - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.glFragColor_1 = inner_result.glFragColor_1; - return wrapper_result; -} diff --git a/test/tint/bug/tint/1118.wgsl.expected.msl b/test/tint/bug/tint/1118.wgsl.expected.msl index 06a0d7d4a0..f913012cdc 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.msl +++ b/test/tint/bug/tint/1118.wgsl.expected.msl @@ -1,3 +1,15 @@ +bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform control flow + normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64)))); + ^^^^ + +bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value + if ((x_9 > 0.0)) { + ^^ + +bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value + let x_9 : f32 = fClipDistance3; + ^^^^^^^^^^^^^^ + #include using namespace metal; @@ -56,25 +68,25 @@ void main_1(thread float* const tint_symbol_7, thread bool* const tint_symbol_8, return; } float4 const x_34 = (*(tint_symbol_10)).vEyePosition; - float3 const x_38 = float3(0.0f, 0.0f, 0.0f); + float3 const x_38 = float3(0.0f); viewDirectionW = normalize((float3(x_34[0], x_34[1], x_34[2]) - x_38)); - baseColor = float4(1.0f, 1.0f, 1.0f, 1.0f); + baseColor = float4(1.0f); float4 const x_52 = (*(tint_symbol_11)).vDiffuseColor; diffuseColor = float3(x_52[0], x_52[1], x_52[2]); float const x_60 = (*(tint_symbol_11)).vDiffuseColor[3]; alpha = x_60; - float3 const x_62 = float3(0.0f, 0.0f, 0.0f); - float3 const x_64 = float3(0.0f, 0.0f, 0.0f); + float3 const x_62 = float3(0.0f); + float3 const x_64 = float3(0.0f); normalW = normalize(-(cross(dfdx(x_62), dfdy(x_64)))); - uvOffset = float2(0.0f, 0.0f); - float4 const x_74 = float4(0.0f, 0.0f, 0.0f, 0.0f); + uvOffset = float2(0.0f); + float4 const x_74 = float4(0.0f); float4 const x_76 = baseColor; float3 const x_78 = (float3(x_76[0], x_76[1], x_76[2]) * float3(x_74[0], x_74[1], x_74[2])); float4 const x_79 = baseColor; baseColor = float4(x_78[0], x_78[1], x_78[2], x_79[3]); - baseAmbientColor = float3(1.0f, 1.0f, 1.0f); + baseAmbientColor = float3(1.0f); glossiness = 0.0f; - diffuseBase = float3(0.0f, 0.0f, 0.0f); + diffuseBase = float3(0.0f); shadow = 1.0f; refractionColor = float4(0.0f, 0.0f, 0.0f, 1.0f); reflectionColor = float4(0.0f, 0.0f, 0.0f, 1.0f); @@ -85,8 +97,8 @@ void main_1(thread float* const tint_symbol_7, thread bool* const tint_symbol_8, float3 const x_99 = emissiveColor; float3 const x_103 = (*(tint_symbol_11)).vAmbientColor; float4 const x_108 = baseColor; - finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), float3(0.0f, 0.0f, 0.0f), float3(1.0f, 1.0f, 1.0f)) * float3(x_108[0], x_108[1], x_108[2])); - finalSpecular = float3(0.0f, 0.0f, 0.0f); + finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), float3(0.0f), float3(1.0f)) * float3(x_108[0], x_108[1], x_108[2])); + finalSpecular = float3(0.0f); float3 const x_113 = finalDiffuse; float3 const x_114 = baseAmbientColor; float3 const x_116 = finalSpecular; @@ -96,7 +108,7 @@ void main_1(thread float* const tint_symbol_7, thread bool* const tint_symbol_8, float const x_124 = alpha; color = float4(x_123[0], x_123[1], x_123[2], x_124); float4 const x_129 = color; - float3 const x_132 = fmax(float3(x_129[0], x_129[1], x_129[2]), float3(0.0f, 0.0f, 0.0f)); + float3 const x_132 = fmax(float3(x_129[0], x_129[1], x_129[2]), float3(0.0f)); float4 const x_133 = color; color = float4(x_132[0], x_132[1], x_132[2], x_133[3]); float const x_140 = (*(tint_symbol_12)).visibility; @@ -125,7 +137,7 @@ main_out tint_symbol_inner(float fClipDistance3_param, float fClipDistance4_para *(tint_symbol_15) = fClipDistance4_param; main_1(tint_symbol_14, tint_symbol_16, tint_symbol_15, tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20); if (*(tint_symbol_16)) { - main_out const tint_symbol_4 = {}; + main_out const tint_symbol_4 = main_out{}; return tint_symbol_4; } main_out const tint_symbol_5 = {.glFragColor_1=*(tint_symbol_20)}; @@ -144,7 +156,7 @@ fragment tint_symbol_3 tint_symbol(const constant Scene* tint_symbol_24 [[buffer main_out const inner_result = tint_symbol_inner(tint_symbol_1.fClipDistance3_param, tint_symbol_1.fClipDistance4_param, &(tint_symbol_21), &(tint_symbol_22), &(tint_symbol_23), tint_symbol_24, tint_symbol_25, tint_symbol_26, &(tint_symbol_27)); if (tint_symbol_23) { tint_discard_func(); - tint_symbol_3 const tint_symbol_6 = {}; + tint_symbol_3 const tint_symbol_6 = tint_symbol_3{}; return tint_symbol_6; } tint_symbol_3 wrapper_result = {}; diff --git a/test/tint/bug/tint/1118.wgsl.expected.spvasm b/test/tint/bug/tint/1118.wgsl.expected.spvasm index 55d6f1dfe6..8266cfa76b 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1118.wgsl.expected.spvasm @@ -1,10 +1,22 @@ +bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform control flow + normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64)))); + ^^^^ + +bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value + if ((x_9 > 0.0)) { + ^^ + +bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value + let x_9 : f32 = fClipDistance3; + ^^^^^^^^^^^^^^ + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 198 +; Bound: 194 ; Schema: 0 OpCapability Shader - %73 = OpExtInstImport "GLSL.std.450" + %71 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" %fClipDistance3_param_1 %fClipDistance4_param_1 %glFragColor_1_1 OpExecutionMode %main OriginUpperLeft @@ -100,9 +112,9 @@ %_ptr_Private_v4float = OpTypePointer Private %v4float %glFragColor = OpVariable %_ptr_Private_v4float Private %8 %bool = OpTypeBool - %false = OpConstantFalse %bool + %26 = OpConstantNull %bool %_ptr_Private_bool = OpTypePointer Private %bool -%tint_discard = OpVariable %_ptr_Private_bool Private %false +%tint_discard = OpVariable %_ptr_Private_bool Private %26 %void = OpTypeVoid %29 = OpTypeFunction %void %_ptr_Function_v3float = OpTypePointer Function %v3float @@ -112,25 +124,21 @@ %v2float = OpTypeVector %float 2 %_ptr_Function_v2float = OpTypePointer Function %v2float %45 = OpConstantNull %v2float - %float_0 = OpConstant %float 0 %true = OpConstantTrue %bool %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float - %71 = OpConstantComposite %v3float %float_0 %float_0 %float_0 %float_1 = OpConstant %float 1 - %80 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %78 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %uint_3 = OpConstant %uint 3 %_ptr_Uniform_float = OpTypePointer Uniform %float - %96 = OpConstantComposite %v2float %float_0 %float_0 - %97 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 - %114 = OpConstantComposite %v3float %float_1 %float_1 %float_1 - %115 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %110 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %111 = OpConstantComposite %v4float %11 %11 %11 %float_1 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float %uint_1 = OpConstant %uint 1 %main_out = OpTypeStruct %v4float - %178 = OpTypeFunction %main_out %float %float - %189 = OpConstantNull %main_out + %174 = OpTypeFunction %main_out %float %float + %185 = OpConstantNull %main_out %main_1 = OpFunction %void None %29 %32 = OpLabel %viewDirectionW = OpVariable %_ptr_Function_v3float Function %35 @@ -150,166 +158,166 @@ %finalSpecular = OpVariable %_ptr_Function_v3float Function %35 %color = OpVariable %_ptr_Function_v4float Function %8 %56 = OpLoad %float %fClipDistance3 - %58 = OpFOrdGreaterThan %bool %56 %float_0 - OpSelectionMerge %59 None - OpBranchConditional %58 %60 %59 - %60 = OpLabel - OpStore %tint_discard %true - OpReturn + %57 = OpFOrdGreaterThan %bool %56 %11 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 %59 = OpLabel - %62 = OpLoad %float %fClipDistance4 - %63 = OpFOrdGreaterThan %bool %62 %float_0 - OpSelectionMerge %64 None - OpBranchConditional %63 %65 %64 - %65 = OpLabel OpStore %tint_discard %true OpReturn + %58 = OpLabel + %61 = OpLoad %float %fClipDistance4 + %62 = OpFOrdGreaterThan %bool %61 %11 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 %64 = OpLabel - %69 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 - %70 = OpLoad %v4float %69 - %74 = OpCompositeExtract %float %70 0 - %75 = OpCompositeExtract %float %70 1 - %76 = OpCompositeExtract %float %70 2 - %77 = OpCompositeConstruct %v3float %74 %75 %76 - %78 = OpFSub %v3float %77 %71 - %72 = OpExtInst %v3float %73 Normalize %78 - OpStore %viewDirectionW %72 - OpStore %baseColor %80 - %81 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 - %82 = OpLoad %v4float %81 - %83 = OpCompositeExtract %float %82 0 - %84 = OpCompositeExtract %float %82 1 - %85 = OpCompositeExtract %float %82 2 - %86 = OpCompositeConstruct %v3float %83 %84 %85 - OpStore %diffuseColor %86 - %89 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_3 - %90 = OpLoad %float %89 - OpStore %alpha %90 - %94 = OpDPdx %v3float %71 - %95 = OpDPdy %v3float %71 - %93 = OpExtInst %v3float %73 Cross %94 %95 - %92 = OpFNegate %v3float %93 - %91 = OpExtInst %v3float %73 Normalize %92 - OpStore %normalW %91 - OpStore %uvOffset %96 - %98 = OpLoad %v4float %baseColor - %99 = OpCompositeExtract %float %98 0 - %100 = OpCompositeExtract %float %98 1 - %101 = OpCompositeExtract %float %98 2 + OpStore %tint_discard %true + OpReturn + %63 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 + %69 = OpLoad %v4float %68 + %72 = OpCompositeExtract %float %69 0 + %73 = OpCompositeExtract %float %69 1 + %74 = OpCompositeExtract %float %69 2 + %75 = OpCompositeConstruct %v3float %72 %73 %74 + %76 = OpFSub %v3float %75 %35 + %70 = OpExtInst %v3float %71 Normalize %76 + OpStore %viewDirectionW %70 + OpStore %baseColor %78 + %79 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 + %80 = OpLoad %v4float %79 + %81 = OpCompositeExtract %float %80 0 + %82 = OpCompositeExtract %float %80 1 + %83 = OpCompositeExtract %float %80 2 + %84 = OpCompositeConstruct %v3float %81 %82 %83 + OpStore %diffuseColor %84 + %87 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_3 + %88 = OpLoad %float %87 + OpStore %alpha %88 + %92 = OpDPdx %v3float %35 + %93 = OpDPdy %v3float %35 + %91 = OpExtInst %v3float %71 Cross %92 %93 + %90 = OpFNegate %v3float %91 + %89 = OpExtInst %v3float %71 Normalize %90 + OpStore %normalW %89 + OpStore %uvOffset %45 + %94 = OpLoad %v4float %baseColor + %95 = OpCompositeExtract %float %94 0 + %96 = OpCompositeExtract %float %94 1 + %97 = OpCompositeExtract %float %94 2 + %98 = OpCompositeConstruct %v3float %95 %96 %97 + %99 = OpCompositeExtract %float %8 0 + %100 = OpCompositeExtract %float %8 1 + %101 = OpCompositeExtract %float %8 2 %102 = OpCompositeConstruct %v3float %99 %100 %101 - %103 = OpCompositeExtract %float %97 0 - %104 = OpCompositeExtract %float %97 1 - %105 = OpCompositeExtract %float %97 2 - %106 = OpCompositeConstruct %v3float %103 %104 %105 - %107 = OpFMul %v3float %102 %106 - %108 = OpLoad %v4float %baseColor - %109 = OpCompositeExtract %float %107 0 - %110 = OpCompositeExtract %float %107 1 - %111 = OpCompositeExtract %float %107 2 - %112 = OpCompositeExtract %float %108 3 - %113 = OpCompositeConstruct %v4float %109 %110 %111 %112 - OpStore %baseColor %113 - OpStore %baseAmbientColor %114 - OpStore %glossiness %float_0 - OpStore %diffuseBase %71 + %103 = OpFMul %v3float %98 %102 + %104 = OpLoad %v4float %baseColor + %105 = OpCompositeExtract %float %103 0 + %106 = OpCompositeExtract %float %103 1 + %107 = OpCompositeExtract %float %103 2 + %108 = OpCompositeExtract %float %104 3 + %109 = OpCompositeConstruct %v4float %105 %106 %107 %108 + OpStore %baseColor %109 + OpStore %baseAmbientColor %110 + OpStore %glossiness %11 + OpStore %diffuseBase %35 OpStore %shadow %float_1 - OpStore %refractionColor %115 - OpStore %reflectionColor %115 - %117 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_3 - %118 = OpLoad %v3float %117 - OpStore %emissiveColor %118 - %119 = OpLoad %v3float %diffuseBase - %120 = OpLoad %v3float %diffuseColor - %121 = OpLoad %v3float %emissiveColor - %123 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_1 - %124 = OpLoad %v3float %123 - %125 = OpLoad %v4float %baseColor - %127 = OpFMul %v3float %119 %120 - %128 = OpFAdd %v3float %127 %121 - %129 = OpFAdd %v3float %128 %124 - %126 = OpExtInst %v3float %73 NClamp %129 %71 %114 - %130 = OpCompositeExtract %float %125 0 - %131 = OpCompositeExtract %float %125 1 - %132 = OpCompositeExtract %float %125 2 - %133 = OpCompositeConstruct %v3float %130 %131 %132 - %134 = OpFMul %v3float %126 %133 - OpStore %finalDiffuse %134 - OpStore %finalSpecular %71 - %135 = OpLoad %v3float %finalDiffuse - %136 = OpLoad %v3float %baseAmbientColor - %137 = OpLoad %v3float %finalSpecular - %138 = OpLoad %v4float %reflectionColor - %139 = OpLoad %v4float %refractionColor - %140 = OpFMul %v3float %135 %136 - %141 = OpFAdd %v3float %140 %137 - %142 = OpCompositeExtract %float %138 0 - %143 = OpCompositeExtract %float %138 1 - %144 = OpCompositeExtract %float %138 2 - %145 = OpCompositeConstruct %v3float %142 %143 %144 - %146 = OpFAdd %v3float %141 %145 - %147 = OpCompositeExtract %float %139 0 - %148 = OpCompositeExtract %float %139 1 - %149 = OpCompositeExtract %float %139 2 - %150 = OpCompositeConstruct %v3float %147 %148 %149 - %151 = OpFAdd %v3float %146 %150 - %152 = OpLoad %float %alpha - %153 = OpCompositeExtract %float %151 0 - %154 = OpCompositeExtract %float %151 1 - %155 = OpCompositeExtract %float %151 2 - %156 = OpCompositeConstruct %v4float %153 %154 %155 %152 - OpStore %color %156 - %157 = OpLoad %v4float %color - %159 = OpCompositeExtract %float %157 0 - %160 = OpCompositeExtract %float %157 1 - %161 = OpCompositeExtract %float %157 2 - %162 = OpCompositeConstruct %v3float %159 %160 %161 - %158 = OpExtInst %v3float %73 NMax %162 %71 - %163 = OpLoad %v4float %color - %164 = OpCompositeExtract %float %158 0 - %165 = OpCompositeExtract %float %158 1 - %166 = OpCompositeExtract %float %158 2 - %167 = OpCompositeExtract %float %163 3 - %168 = OpCompositeConstruct %v4float %164 %165 %166 %167 - OpStore %color %168 - %169 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 - %170 = OpLoad %float %169 - %171 = OpAccessChain %_ptr_Function_float %color %uint_3 - %172 = OpLoad %float %171 - %173 = OpAccessChain %_ptr_Function_float %color %uint_3 - %174 = OpFMul %float %172 %170 - OpStore %173 %174 - %175 = OpLoad %v4float %color - OpStore %glFragColor %175 + OpStore %refractionColor %111 + OpStore %reflectionColor %111 + %113 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_3 + %114 = OpLoad %v3float %113 + OpStore %emissiveColor %114 + %115 = OpLoad %v3float %diffuseBase + %116 = OpLoad %v3float %diffuseColor + %117 = OpLoad %v3float %emissiveColor + %119 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_1 + %120 = OpLoad %v3float %119 + %121 = OpLoad %v4float %baseColor + %123 = OpFMul %v3float %115 %116 + %124 = OpFAdd %v3float %123 %117 + %125 = OpFAdd %v3float %124 %120 + %122 = OpExtInst %v3float %71 NClamp %125 %35 %110 + %126 = OpCompositeExtract %float %121 0 + %127 = OpCompositeExtract %float %121 1 + %128 = OpCompositeExtract %float %121 2 + %129 = OpCompositeConstruct %v3float %126 %127 %128 + %130 = OpFMul %v3float %122 %129 + OpStore %finalDiffuse %130 + OpStore %finalSpecular %35 + %131 = OpLoad %v3float %finalDiffuse + %132 = OpLoad %v3float %baseAmbientColor + %133 = OpLoad %v3float %finalSpecular + %134 = OpLoad %v4float %reflectionColor + %135 = OpLoad %v4float %refractionColor + %136 = OpFMul %v3float %131 %132 + %137 = OpFAdd %v3float %136 %133 + %138 = OpCompositeExtract %float %134 0 + %139 = OpCompositeExtract %float %134 1 + %140 = OpCompositeExtract %float %134 2 + %141 = OpCompositeConstruct %v3float %138 %139 %140 + %142 = OpFAdd %v3float %137 %141 + %143 = OpCompositeExtract %float %135 0 + %144 = OpCompositeExtract %float %135 1 + %145 = OpCompositeExtract %float %135 2 + %146 = OpCompositeConstruct %v3float %143 %144 %145 + %147 = OpFAdd %v3float %142 %146 + %148 = OpLoad %float %alpha + %149 = OpCompositeExtract %float %147 0 + %150 = OpCompositeExtract %float %147 1 + %151 = OpCompositeExtract %float %147 2 + %152 = OpCompositeConstruct %v4float %149 %150 %151 %148 + OpStore %color %152 + %153 = OpLoad %v4float %color + %155 = OpCompositeExtract %float %153 0 + %156 = OpCompositeExtract %float %153 1 + %157 = OpCompositeExtract %float %153 2 + %158 = OpCompositeConstruct %v3float %155 %156 %157 + %154 = OpExtInst %v3float %71 NMax %158 %35 + %159 = OpLoad %v4float %color + %160 = OpCompositeExtract %float %154 0 + %161 = OpCompositeExtract %float %154 1 + %162 = OpCompositeExtract %float %154 2 + %163 = OpCompositeExtract %float %159 3 + %164 = OpCompositeConstruct %v4float %160 %161 %162 %163 + OpStore %color %164 + %165 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 + %166 = OpLoad %float %165 + %167 = OpAccessChain %_ptr_Function_float %color %uint_3 + %168 = OpLoad %float %167 + %169 = OpAccessChain %_ptr_Function_float %color %uint_3 + %170 = OpFMul %float %168 %166 + OpStore %169 %170 + %171 = OpLoad %v4float %color + OpStore %glFragColor %171 OpReturn OpFunctionEnd %tint_discard_func = OpFunction %void None %29 - %177 = OpLabel + %173 = OpLabel OpKill OpFunctionEnd - %main_inner = OpFunction %main_out None %178 + %main_inner = OpFunction %main_out None %174 %fClipDistance3_param = OpFunctionParameter %float %fClipDistance4_param = OpFunctionParameter %float - %183 = OpLabel + %179 = OpLabel OpStore %fClipDistance3 %fClipDistance3_param OpStore %fClipDistance4 %fClipDistance4_param - %184 = OpFunctionCall %void %main_1 - %185 = OpLoad %bool %tint_discard - OpSelectionMerge %186 None - OpBranchConditional %185 %187 %186 - %187 = OpLabel - %188 = OpFunctionCall %void %tint_discard_func - OpReturnValue %189 - %186 = OpLabel - %190 = OpLoad %v4float %glFragColor - %191 = OpCompositeConstruct %main_out %190 - OpReturnValue %191 + %180 = OpFunctionCall %void %main_1 + %181 = OpLoad %bool %tint_discard + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpFunctionCall %void %tint_discard_func + OpReturnValue %185 + %182 = OpLabel + %186 = OpLoad %v4float %glFragColor + %187 = OpCompositeConstruct %main_out %186 + OpReturnValue %187 OpFunctionEnd %main = OpFunction %void None %29 - %193 = OpLabel - %195 = OpLoad %float %fClipDistance3_param_1 - %196 = OpLoad %float %fClipDistance4_param_1 - %194 = OpFunctionCall %main_out %main_inner %195 %196 - %197 = OpCompositeExtract %v4float %194 0 - OpStore %glFragColor_1_1 %197 + %189 = OpLabel + %191 = OpLoad %float %fClipDistance3_param_1 + %192 = OpLoad %float %fClipDistance4_param_1 + %190 = OpFunctionCall %main_out %main_inner %191 %192 + %193 = OpCompositeExtract %v4float %190 0 + OpStore %glFragColor_1_1 %193 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1118.wgsl.expected.wgsl b/test/tint/bug/tint/1118.wgsl.expected.wgsl index 1274782bbe..a82080aed0 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1118.wgsl.expected.wgsl @@ -1,3 +1,15 @@ +bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform control flow + normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64)))); + ^^^^ + +bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value + if ((x_9 > 0.0)) { + ^^ + +bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value + let x_9 : f32 = fClipDistance3; + ^^^^^^^^^^^^^^ + struct Scene { vEyePosition : vec4, } @@ -108,7 +120,7 @@ struct main_out { glFragColor_1 : vec4, } -@stage(fragment) +@fragment fn main(@location(2) fClipDistance3_param : f32, @location(3) fClipDistance4_param : f32) -> main_out { fClipDistance3 = fClipDistance3_param; fClipDistance4 = fClipDistance4_param; diff --git a/test/tint/bug/tint/1121.wgsl b/test/tint/bug/tint/1121.wgsl index 7e5cfd0d88..fa82219cad 100644 --- a/test/tint/bug/tint/1121.wgsl +++ b/test/tint/bug/tint/1121.wgsl @@ -44,7 +44,7 @@ struct TileLightIdData { fullScreenSize : vec4, // width, height }; @group(3) @binding(0) var uniforms: Uniforms; -@stage(compute) @workgroup_size(64, 1, 1) +@compute @workgroup_size(64, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var index = GlobalInvocationID.x; if (index >= config.numLights) { diff --git a/test/tint/bug/tint/1121.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1121.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bfff4638cf --- /dev/null +++ b/test/tint/bug/tint/1121.wgsl.expected.dxc.hlsl @@ -0,0 +1,116 @@ +RWByteAddressBuffer lightsBuffer : register(u0, space0); + +RWByteAddressBuffer tileLightId : register(u0, space1); + +cbuffer cbuffer_config : register(b0, space2) { + uint4 config[2]; +}; + +cbuffer cbuffer_uniforms : register(b0, space3) { + uint4 uniforms[11]; +}; + +struct tint_symbol_1 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +float4x4 tint_symbol_6(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + const uint scalar_offset_3 = ((offset + 48u)) / 4; + return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4])); +} + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void main_inner(uint3 GlobalInvocationID) { + uint index = GlobalInvocationID.x; + if ((index >= config[0].x)) { + return; + } + lightsBuffer.Store(((32u * index) + 4u), asuint(((asfloat(lightsBuffer.Load(((32u * index) + 4u))) - 0.100000001f) + (0.001f * (float(index) - (64.0f * floor((float(index) / 64.0f)))))))); + if ((asfloat(lightsBuffer.Load(((32u * index) + 4u))) < asfloat(uniforms[0].y))) { + lightsBuffer.Store(((32u * index) + 4u), asuint(asfloat(uniforms[1].y))); + } + float4x4 M = tint_symbol_6(uniforms, 96u); + float viewNear = (-(M[3][2]) / (-1.0f + M[2][2])); + float viewFar = (-(M[3][2]) / (1.0f + M[2][2])); + float4 lightPos = asfloat(lightsBuffer.Load4((32u * index))); + lightPos = mul(lightPos, tint_symbol_6(uniforms, 32u)); + lightPos = (lightPos / lightPos.w); + float lightRadius = asfloat(lightsBuffer.Load(((32u * index) + 28u))); + float4 boxMin = (lightPos - float4(float3((lightRadius).xxx), 0.0f)); + float4 boxMax = (lightPos + float4(float3((lightRadius).xxx), 0.0f)); + float4 frustumPlanes[6] = (float4[6])0; + frustumPlanes[4] = float4(0.0f, 0.0f, -1.0f, viewNear); + frustumPlanes[5] = float4(0.0f, 0.0f, 1.0f, -(viewFar)); + const int TILE_SIZE = 16; + const int TILE_COUNT_X = 2; + { + [loop] for(int y_1 = 0; (y_1 < 2); y_1 = (y_1 + 1)) { + { + [loop] for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) { + int2 tilePixel0Idx = int2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE)); + float2 floorCoord = (((2.0f * float2(tilePixel0Idx)) / asfloat(uniforms[10]).xy) - (1.0f).xx); + float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + int2((TILE_SIZE).xx)))) / asfloat(uniforms[10]).xy) - (1.0f).xx); + float2 viewFloorCoord = float2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1])); + float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1])); + frustumPlanes[0] = float4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f); + frustumPlanes[1] = float4(-1.0f, 0.0f, (viewCeilCoord.x / viewNear), 0.0f); + frustumPlanes[2] = float4(0.0f, 1.0f, (-(viewFloorCoord.y) / viewNear), 0.0f); + frustumPlanes[3] = float4(0.0f, -1.0f, (viewCeilCoord.y / viewNear), 0.0f); + float dp = 0.0f; + { + [loop] for(uint i = 0u; (i < 6u); i = (i + 1u)) { + float4 p = float4(0.0f, 0.0f, 0.0f, 0.0f); + if ((frustumPlanes[i].x > 0.0f)) { + p.x = boxMax.x; + } else { + p.x = boxMin.x; + } + if ((frustumPlanes[i].y > 0.0f)) { + p.y = boxMax.y; + } else { + p.y = boxMin.y; + } + if ((frustumPlanes[i].z > 0.0f)) { + p.z = boxMax.z; + } else { + p.z = boxMin.z; + } + p.w = 1.0f; + dp = (dp + min(0.0f, dot(p, frustumPlanes[i]))); + } + } + if ((dp >= 0.0f)) { + uint tileId = uint((x_1 + (y_1 * TILE_COUNT_X))); + bool tint_tmp = (tileId < 0u); + if (!tint_tmp) { + tint_tmp = (tileId >= config[0].y); + } + if ((tint_tmp)) { + continue; + } + uint offset = tint_atomicAdd(tileLightId, (260u * tileId), 1u); + if ((offset >= config[1].x)) { + continue; + } + tileLightId.Store((((260u * tileId) + 4u) + (4u * offset)), asuint(GlobalInvocationID.x)); + } + } + } + } + } +} + +[numthreads(64, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/tint/1121.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1121.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bfff4638cf --- /dev/null +++ b/test/tint/bug/tint/1121.wgsl.expected.fxc.hlsl @@ -0,0 +1,116 @@ +RWByteAddressBuffer lightsBuffer : register(u0, space0); + +RWByteAddressBuffer tileLightId : register(u0, space1); + +cbuffer cbuffer_config : register(b0, space2) { + uint4 config[2]; +}; + +cbuffer cbuffer_uniforms : register(b0, space3) { + uint4 uniforms[11]; +}; + +struct tint_symbol_1 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +float4x4 tint_symbol_6(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + const uint scalar_offset_3 = ((offset + 48u)) / 4; + return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4])); +} + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void main_inner(uint3 GlobalInvocationID) { + uint index = GlobalInvocationID.x; + if ((index >= config[0].x)) { + return; + } + lightsBuffer.Store(((32u * index) + 4u), asuint(((asfloat(lightsBuffer.Load(((32u * index) + 4u))) - 0.100000001f) + (0.001f * (float(index) - (64.0f * floor((float(index) / 64.0f)))))))); + if ((asfloat(lightsBuffer.Load(((32u * index) + 4u))) < asfloat(uniforms[0].y))) { + lightsBuffer.Store(((32u * index) + 4u), asuint(asfloat(uniforms[1].y))); + } + float4x4 M = tint_symbol_6(uniforms, 96u); + float viewNear = (-(M[3][2]) / (-1.0f + M[2][2])); + float viewFar = (-(M[3][2]) / (1.0f + M[2][2])); + float4 lightPos = asfloat(lightsBuffer.Load4((32u * index))); + lightPos = mul(lightPos, tint_symbol_6(uniforms, 32u)); + lightPos = (lightPos / lightPos.w); + float lightRadius = asfloat(lightsBuffer.Load(((32u * index) + 28u))); + float4 boxMin = (lightPos - float4(float3((lightRadius).xxx), 0.0f)); + float4 boxMax = (lightPos + float4(float3((lightRadius).xxx), 0.0f)); + float4 frustumPlanes[6] = (float4[6])0; + frustumPlanes[4] = float4(0.0f, 0.0f, -1.0f, viewNear); + frustumPlanes[5] = float4(0.0f, 0.0f, 1.0f, -(viewFar)); + const int TILE_SIZE = 16; + const int TILE_COUNT_X = 2; + { + [loop] for(int y_1 = 0; (y_1 < 2); y_1 = (y_1 + 1)) { + { + [loop] for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) { + int2 tilePixel0Idx = int2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE)); + float2 floorCoord = (((2.0f * float2(tilePixel0Idx)) / asfloat(uniforms[10]).xy) - (1.0f).xx); + float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + int2((TILE_SIZE).xx)))) / asfloat(uniforms[10]).xy) - (1.0f).xx); + float2 viewFloorCoord = float2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1])); + float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1])); + frustumPlanes[0] = float4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f); + frustumPlanes[1] = float4(-1.0f, 0.0f, (viewCeilCoord.x / viewNear), 0.0f); + frustumPlanes[2] = float4(0.0f, 1.0f, (-(viewFloorCoord.y) / viewNear), 0.0f); + frustumPlanes[3] = float4(0.0f, -1.0f, (viewCeilCoord.y / viewNear), 0.0f); + float dp = 0.0f; + { + [loop] for(uint i = 0u; (i < 6u); i = (i + 1u)) { + float4 p = float4(0.0f, 0.0f, 0.0f, 0.0f); + if ((frustumPlanes[i].x > 0.0f)) { + p.x = boxMax.x; + } else { + p.x = boxMin.x; + } + if ((frustumPlanes[i].y > 0.0f)) { + p.y = boxMax.y; + } else { + p.y = boxMin.y; + } + if ((frustumPlanes[i].z > 0.0f)) { + p.z = boxMax.z; + } else { + p.z = boxMin.z; + } + p.w = 1.0f; + dp = (dp + min(0.0f, dot(p, frustumPlanes[i]))); + } + } + if ((dp >= 0.0f)) { + uint tileId = uint((x_1 + (y_1 * TILE_COUNT_X))); + bool tint_tmp = (tileId < 0u); + if (!tint_tmp) { + tint_tmp = (tileId >= config[0].y); + } + if ((tint_tmp)) { + continue; + } + uint offset = tint_atomicAdd(tileLightId, (260u * tileId), 1u); + if ((offset >= config[1].x)) { + continue; + } + tileLightId.Store((((260u * tileId) + 4u) + (4u * offset)), asuint(GlobalInvocationID.x)); + } + } + } + } + } +} + +[numthreads(64, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/tint/1121.wgsl.expected.hlsl b/test/tint/bug/tint/1121.wgsl.expected.hlsl deleted file mode 100644 index a5ab12d742..0000000000 --- a/test/tint/bug/tint/1121.wgsl.expected.hlsl +++ /dev/null @@ -1,115 +0,0 @@ -uint atomicAdd_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedAdd(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer lightsBuffer : register(u0, space0); - -RWByteAddressBuffer tileLightId : register(u0, space1); - -cbuffer cbuffer_config : register(b0, space2) { - uint4 config[2]; -}; - -cbuffer cbuffer_uniforms : register(b0, space3) { - uint4 uniforms[11]; -}; - -struct tint_symbol_1 { - uint3 GlobalInvocationID : SV_DispatchThreadID; -}; - -float4x4 tint_symbol_6(uint4 buffer[11], uint offset) { - const uint scalar_offset = ((offset + 0u)) / 4; - const uint scalar_offset_1 = ((offset + 16u)) / 4; - const uint scalar_offset_2 = ((offset + 32u)) / 4; - const uint scalar_offset_3 = ((offset + 48u)) / 4; - return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4])); -} - -void main_inner(uint3 GlobalInvocationID) { - uint index = GlobalInvocationID.x; - if ((index >= config[0].x)) { - return; - } - lightsBuffer.Store(((32u * index) + 4u), asuint(((asfloat(lightsBuffer.Load(((32u * index) + 4u))) - 0.100000001f) + (0.001f * (float(index) - (64.0f * floor((float(index) / 64.0f)))))))); - if ((asfloat(lightsBuffer.Load(((32u * index) + 4u))) < asfloat(uniforms[0].y))) { - lightsBuffer.Store(((32u * index) + 4u), asuint(asfloat(uniforms[1].y))); - } - float4x4 M = tint_symbol_6(uniforms, 96u); - float viewNear = (-(M[3][2]) / (-1.0f + M[2][2])); - float viewFar = (-(M[3][2]) / (1.0f + M[2][2])); - float4 lightPos = asfloat(lightsBuffer.Load4((32u * index))); - lightPos = mul(lightPos, tint_symbol_6(uniforms, 32u)); - lightPos = (lightPos / lightPos.w); - float lightRadius = asfloat(lightsBuffer.Load(((32u * index) + 28u))); - float4 boxMin = (lightPos - float4(float3((lightRadius).xxx), 0.0f)); - float4 boxMax = (lightPos + float4(float3((lightRadius).xxx), 0.0f)); - float4 frustumPlanes[6] = (float4[6])0; - frustumPlanes[4] = float4(0.0f, 0.0f, -1.0f, viewNear); - frustumPlanes[5] = float4(0.0f, 0.0f, 1.0f, -(viewFar)); - const int TILE_SIZE = 16; - const int TILE_COUNT_X = 2; - { - [loop] for(int y_1 = 0; (y_1 < 2); y_1 = (y_1 + 1)) { - { - [loop] for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) { - int2 tilePixel0Idx = int2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE)); - float2 floorCoord = (((2.0f * float2(tilePixel0Idx)) / asfloat(uniforms[10]).xy) - float2((1.0f).xx)); - float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + int2((TILE_SIZE).xx)))) / asfloat(uniforms[10]).xy) - float2((1.0f).xx)); - float2 viewFloorCoord = float2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1])); - float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1])); - frustumPlanes[0] = float4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f); - frustumPlanes[1] = float4(-1.0f, 0.0f, (viewCeilCoord.x / viewNear), 0.0f); - frustumPlanes[2] = float4(0.0f, 1.0f, (-(viewFloorCoord.y) / viewNear), 0.0f); - frustumPlanes[3] = float4(0.0f, -1.0f, (viewCeilCoord.y / viewNear), 0.0f); - float dp = 0.0f; - { - [loop] for(uint i = 0u; (i < 6u); i = (i + 1u)) { - float4 p = float4(0.0f, 0.0f, 0.0f, 0.0f); - if ((frustumPlanes[i].x > 0.0f)) { - p.x = boxMax.x; - } else { - p.x = boxMin.x; - } - if ((frustumPlanes[i].y > 0.0f)) { - p.y = boxMax.y; - } else { - p.y = boxMin.y; - } - if ((frustumPlanes[i].z > 0.0f)) { - p.z = boxMax.z; - } else { - p.z = boxMin.z; - } - p.w = 1.0f; - dp = (dp + min(0.0f, dot(p, frustumPlanes[i]))); - } - } - if ((dp >= 0.0f)) { - uint tileId = uint((x_1 + (y_1 * TILE_COUNT_X))); - bool tint_tmp = (tileId < 0u); - if (!tint_tmp) { - tint_tmp = (tileId >= config[0].y); - } - if ((tint_tmp)) { - continue; - } - uint offset = atomicAdd_1(tileLightId, (260u * tileId), 1u); - if ((offset >= config[1].x)) { - continue; - } - tileLightId.Store((((260u * tileId) + 4u) + (4u * offset)), asuint(GlobalInvocationID.x)); - } - } - } - } - } -} - -[numthreads(64, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.GlobalInvocationID); - return; -} diff --git a/test/tint/bug/tint/1121.wgsl.expected.msl b/test/tint/bug/tint/1121.wgsl.expected.msl index 8ac140b799..ca262ff03b 100644 --- a/test/tint/bug/tint/1121.wgsl.expected.msl +++ b/test/tint/bug/tint/1121.wgsl.expected.msl @@ -12,6 +12,18 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct LightData { /* 0x0000 */ float4 position; /* 0x0010 */ packed_float3 color; @@ -19,24 +31,16 @@ struct LightData { }; struct LightsBuffer { - /* 0x0000 */ LightData lights[1]; -}; - -struct tint_array_wrapper { - /* 0x0000 */ uint arr[64]; + /* 0x0000 */ tint_array lights; }; struct TileLightIdData { /* 0x0000 */ atomic_uint count; - /* 0x0004 */ tint_array_wrapper lightId; -}; - -struct tint_array_wrapper_1 { - /* 0x0000 */ TileLightIdData arr[4]; + /* 0x0004 */ tint_array lightId; }; struct Tiles { - /* 0x0000 */ tint_array_wrapper_1 data; + /* 0x0000 */ tint_array data; }; struct Config { @@ -56,10 +60,6 @@ struct Uniforms { /* 0x00a0 */ float4 fullScreenSize; }; -struct tint_array_wrapper_2 { - float4 arr[6]; -}; - void tint_symbol_inner(uint3 GlobalInvocationID, const constant Config* const tint_symbol_1, device LightsBuffer* const tint_symbol_2, const constant Uniforms* const tint_symbol_3, device Tiles* const tint_symbol_4) { uint index = GlobalInvocationID[0]; if ((index >= (*(tint_symbol_1)).numLights)) { @@ -78,9 +78,9 @@ void tint_symbol_inner(uint3 GlobalInvocationID, const constant Config* const ti float lightRadius = (*(tint_symbol_2)).lights[index].radius; float4 boxMin = (lightPos - float4(float3(lightRadius), 0.0f)); float4 boxMax = (lightPos + float4(float3(lightRadius), 0.0f)); - tint_array_wrapper_2 frustumPlanes = {}; - frustumPlanes.arr[4] = float4(0.0f, 0.0f, -1.0f, viewNear); - frustumPlanes.arr[5] = float4(0.0f, 0.0f, 1.0f, -(viewFar)); + tint_array frustumPlanes = {}; + frustumPlanes[4] = float4(0.0f, 0.0f, -1.0f, viewNear); + frustumPlanes[5] = float4(0.0f, 0.0f, 1.0f, -(viewFar)); int const TILE_SIZE = 16; int const TILE_COUNT_X = 2; int const TILE_COUNT_Y = 2; @@ -91,41 +91,41 @@ void tint_symbol_inner(uint3 GlobalInvocationID, const constant Config* const ti float2 ceilCoord = (((2.0f * float2(as_type((as_type(tilePixel0Idx) + as_type(int2(TILE_SIZE)))))) / float4((*(tint_symbol_3)).fullScreenSize).xy) - float2(1.0f)); float2 viewFloorCoord = float2((((-(viewNear) * floorCoord[0]) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord[1]) - (M[2][1] * viewNear)) / M[1][1])); float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord[0]) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord[1]) - (M[2][1] * viewNear)) / M[1][1])); - frustumPlanes.arr[0] = float4(1.0f, 0.0f, (-(viewFloorCoord[0]) / viewNear), 0.0f); - frustumPlanes.arr[1] = float4(-1.0f, 0.0f, (viewCeilCoord[0] / viewNear), 0.0f); - frustumPlanes.arr[2] = float4(0.0f, 1.0f, (-(viewFloorCoord[1]) / viewNear), 0.0f); - frustumPlanes.arr[3] = float4(0.0f, -1.0f, (viewCeilCoord[1] / viewNear), 0.0f); + frustumPlanes[0] = float4(1.0f, 0.0f, (-(viewFloorCoord[0]) / viewNear), 0.0f); + frustumPlanes[1] = float4(-1.0f, 0.0f, (viewCeilCoord[0] / viewNear), 0.0f); + frustumPlanes[2] = float4(0.0f, 1.0f, (-(viewFloorCoord[1]) / viewNear), 0.0f); + frustumPlanes[3] = float4(0.0f, -1.0f, (viewCeilCoord[1] / viewNear), 0.0f); float dp = 0.0f; for(uint i = 0u; (i < 6u); i = (i + 1u)) { float4 p = 0.0f; - if ((frustumPlanes.arr[i][0] > 0.0f)) { + if ((frustumPlanes[i][0] > 0.0f)) { p[0] = boxMax[0]; } else { p[0] = boxMin[0]; } - if ((frustumPlanes.arr[i][1] > 0.0f)) { + if ((frustumPlanes[i][1] > 0.0f)) { p[1] = boxMax[1]; } else { p[1] = boxMin[1]; } - if ((frustumPlanes.arr[i][2] > 0.0f)) { + if ((frustumPlanes[i][2] > 0.0f)) { p[2] = boxMax[2]; } else { p[2] = boxMin[2]; } p[3] = 1.0f; - dp = (dp + fmin(0.0f, dot(p, frustumPlanes.arr[i]))); + dp = (dp + fmin(0.0f, dot(p, frustumPlanes[i]))); } if ((dp >= 0.0f)) { uint tileId = uint(as_type((as_type(x_1) + as_type(as_type((as_type(y_1) * as_type(TILE_COUNT_X))))))); if (((tileId < 0u) || (tileId >= (*(tint_symbol_1)).numTiles))) { continue; } - uint offset = atomic_fetch_add_explicit(&((*(tint_symbol_4)).data.arr[tileId].count), 1u, memory_order_relaxed); + uint offset = atomic_fetch_add_explicit(&((*(tint_symbol_4)).data[tileId].count), 1u, memory_order_relaxed); if ((offset >= (*(tint_symbol_1)).numTileLightSlot)) { continue; } - (*(tint_symbol_4)).data.arr[tileId].lightId.arr[offset] = GlobalInvocationID[0]; + (*(tint_symbol_4)).data[tileId].lightId[offset] = GlobalInvocationID[0]; } } } diff --git a/test/tint/bug/tint/1121.wgsl.expected.spvasm b/test/tint/bug/tint/1121.wgsl.expected.spvasm index e9ee84c048..5dc7f31d4d 100644 --- a/test/tint/bug/tint/1121.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1121.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 417 +; Bound: 415 ; Schema: 0 OpCapability Shader %60 = OpExtInstImport "GLSL.std.450" @@ -157,31 +157,28 @@ %_ptr_Function_v4float = OpTypePointer Function %v4float %117 = OpConstantNull %v4float %uint_2 = OpConstant %uint 2 - %float_0 = OpConstant %float 0 %uint_6 = OpConstant %uint 6 %_arr_v4float_uint_6 = OpTypeArray %v4float %uint_6 %_ptr_Function__arr_v4float_uint_6 = OpTypePointer Function %_arr_v4float_uint_6 - %156 = OpConstantNull %_arr_v4float_uint_6 + %155 = OpConstantNull %_arr_v4float_uint_6 %int_4 = OpConstant %int 4 %int_5 = OpConstant %int 5 %int_16 = OpConstant %int 16 - %int_0 = OpConstant %int 0 + %166 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %170 = OpConstantNull %int %v2int = OpTypeVector %int 2 %_ptr_Function_v2int = OpTypePointer Function %v2int - %198 = OpConstantNull %v2int + %196 = OpConstantNull %v2int %float_2 = OpConstant %float 2 %v2float = OpTypeVector %float 2 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float - %209 = OpConstantComposite %v2float %float_1 %float_1 + %207 = OpConstantComposite %v2float %float_1 %float_1 %_ptr_Function_v2float = OpTypePointer Function %v2float - %213 = OpConstantNull %v2float - %216 = OpConstantComposite %v2int %int_16 %int_16 + %211 = OpConstantNull %v2float %int_1 = OpConstant %int 1 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint - %412 = OpTypeFunction %void + %410 = OpTypeFunction %void %main_inner = OpFunction %void None %28 %GlobalInvocationID = OpFunctionParameter %v3uint %32 = OpLabel @@ -194,14 +191,14 @@ %lightRadius = OpVariable %_ptr_Function_float Function %101 %boxMin = OpVariable %_ptr_Function_v4float Function %117 %boxMax = OpVariable %_ptr_Function_v4float Function %117 -%frustumPlanes = OpVariable %_ptr_Function__arr_v4float_uint_6 Function %156 - %y = OpVariable %_ptr_Function_int Function %170 - %x = OpVariable %_ptr_Function_int Function %170 -%tilePixel0Idx = OpVariable %_ptr_Function_v2int Function %198 - %floorCoord = OpVariable %_ptr_Function_v2float Function %213 - %ceilCoord = OpVariable %_ptr_Function_v2float Function %213 -%viewFloorCoord = OpVariable %_ptr_Function_v2float Function %213 -%viewCeilCoord = OpVariable %_ptr_Function_v2float Function %213 +%frustumPlanes = OpVariable %_ptr_Function__arr_v4float_uint_6 Function %155 + %y = OpVariable %_ptr_Function_int Function %166 + %x = OpVariable %_ptr_Function_int Function %166 +%tilePixel0Idx = OpVariable %_ptr_Function_v2int Function %196 + %floorCoord = OpVariable %_ptr_Function_v2float Function %211 + %ceilCoord = OpVariable %_ptr_Function_v2float Function %211 +%viewFloorCoord = OpVariable %_ptr_Function_v2float Function %211 +%viewCeilCoord = OpVariable %_ptr_Function_v2float Function %211 %dp = OpVariable %_ptr_Function_float Function %101 %i = OpVariable %_ptr_Function_uint Function %36 %p = OpVariable %_ptr_Function_v4float Function %117 @@ -295,323 +292,324 @@ %136 = OpCompositeExtract %float %135 0 %137 = OpCompositeExtract %float %135 1 %138 = OpCompositeExtract %float %135 2 - %140 = OpCompositeConstruct %v4float %136 %137 %138 %float_0 - %141 = OpFSub %v4float %133 %140 - OpStore %boxMin %141 - %143 = OpLoad %v4float %lightPos - %144 = OpLoad %float %lightRadius - %145 = OpCompositeConstruct %v3float %144 %144 %144 - %146 = OpCompositeExtract %float %145 0 - %147 = OpCompositeExtract %float %145 1 - %148 = OpCompositeExtract %float %145 2 - %149 = OpCompositeConstruct %v4float %146 %147 %148 %float_0 - %150 = OpFAdd %v4float %143 %149 - OpStore %boxMax %150 - %158 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_4 - %159 = OpLoad %float %viewNear - %160 = OpCompositeConstruct %v4float %float_0 %float_0 %float_n1 %159 - OpStore %158 %160 - %162 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_5 - %164 = OpLoad %float %viewFar - %163 = OpFNegate %float %164 - %165 = OpCompositeConstruct %v4float %float_0 %float_0 %float_1 %163 - OpStore %162 %165 - OpStore %y %int_0 - OpBranch %171 - %171 = OpLabel - OpLoopMerge %172 %173 None - OpBranch %174 - %174 = OpLabel - %176 = OpLoad %int %y - %177 = OpSLessThan %bool %176 %int_2 - %175 = OpLogicalNot %bool %177 - OpSelectionMerge %178 None - OpBranchConditional %175 %179 %178 - %179 = OpLabel + %139 = OpCompositeConstruct %v4float %136 %137 %138 %101 + %140 = OpFSub %v4float %133 %139 + OpStore %boxMin %140 + %142 = OpLoad %v4float %lightPos + %143 = OpLoad %float %lightRadius + %144 = OpCompositeConstruct %v3float %143 %143 %143 + %145 = OpCompositeExtract %float %144 0 + %146 = OpCompositeExtract %float %144 1 + %147 = OpCompositeExtract %float %144 2 + %148 = OpCompositeConstruct %v4float %145 %146 %147 %101 + %149 = OpFAdd %v4float %142 %148 + OpStore %boxMax %149 + %157 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_4 + %158 = OpLoad %float %viewNear + %159 = OpCompositeConstruct %v4float %101 %101 %float_n1 %158 + OpStore %157 %159 + %161 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_5 + %163 = OpLoad %float %viewFar + %162 = OpFNegate %float %163 + %164 = OpCompositeConstruct %v4float %101 %101 %float_1 %162 + OpStore %161 %164 + OpStore %y %166 + OpBranch %169 + %169 = OpLabel + OpLoopMerge %170 %171 None OpBranch %172 - %178 = OpLabel - OpStore %x %int_0 - OpBranch %181 - %181 = OpLabel - OpLoopMerge %182 %183 None - OpBranch %184 - %184 = OpLabel - %186 = OpLoad %int %x - %187 = OpSLessThan %bool %186 %int_2 - %185 = OpLogicalNot %bool %187 - OpSelectionMerge %188 None - OpBranchConditional %185 %189 %188 - %189 = OpLabel + %172 = OpLabel + %174 = OpLoad %int %y + %175 = OpSLessThan %bool %174 %int_2 + %173 = OpLogicalNot %bool %175 + OpSelectionMerge %176 None + OpBranchConditional %173 %177 %176 + %177 = OpLabel + OpBranch %170 + %176 = OpLabel + OpStore %x %166 + OpBranch %179 + %179 = OpLabel + OpLoopMerge %180 %181 None OpBranch %182 - %188 = OpLabel - %191 = OpLoad %int %x + %182 = OpLabel + %184 = OpLoad %int %x + %185 = OpSLessThan %bool %184 %int_2 + %183 = OpLogicalNot %bool %185 + OpSelectionMerge %186 None + OpBranchConditional %183 %187 %186 + %187 = OpLabel + OpBranch %180 + %186 = OpLabel + %189 = OpLoad %int %x + %190 = OpIMul %int %189 %int_16 + %191 = OpLoad %int %y %192 = OpIMul %int %191 %int_16 - %193 = OpLoad %int %y - %194 = OpIMul %int %193 %int_16 - %195 = OpCompositeConstruct %v2int %192 %194 - OpStore %tilePixel0Idx %195 - %202 = OpLoad %v2int %tilePixel0Idx - %200 = OpConvertSToF %v2float %202 - %203 = OpVectorTimesScalar %v2float %200 %float_2 - %205 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 - %206 = OpLoad %v4float %205 - %207 = OpVectorShuffle %v2float %206 %206 0 1 - %208 = OpFDiv %v2float %203 %207 - %210 = OpFSub %v2float %208 %209 - OpStore %floorCoord %210 - %215 = OpLoad %v2int %tilePixel0Idx - %217 = OpIAdd %v2int %215 %216 - %214 = OpConvertSToF %v2float %217 - %218 = OpVectorTimesScalar %v2float %214 %float_2 - %219 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 - %220 = OpLoad %v4float %219 - %221 = OpVectorShuffle %v2float %220 %220 0 1 - %222 = OpFDiv %v2float %218 %221 - %223 = OpFSub %v2float %222 %209 - OpStore %ceilCoord %223 - %226 = OpLoad %float %viewNear - %225 = OpFNegate %float %226 - %227 = OpAccessChain %_ptr_Function_float %floorCoord %uint_0 - %228 = OpLoad %float %227 - %229 = OpFMul %float %225 %228 - %230 = OpAccessChain %_ptr_Function_float %M %int_2 %int_0 - %231 = OpLoad %float %230 - %232 = OpLoad %float %viewNear - %233 = OpFMul %float %231 %232 - %234 = OpFSub %float %229 %233 - %235 = OpAccessChain %_ptr_Function_float %M %int_0 %int_0 - %236 = OpLoad %float %235 - %237 = OpFDiv %float %234 %236 - %239 = OpLoad %float %viewNear - %238 = OpFNegate %float %239 - %240 = OpAccessChain %_ptr_Function_float %floorCoord %uint_1 - %241 = OpLoad %float %240 - %242 = OpFMul %float %238 %241 - %244 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 - %245 = OpLoad %float %244 - %246 = OpLoad %float %viewNear - %247 = OpFMul %float %245 %246 - %248 = OpFSub %float %242 %247 - %249 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 - %250 = OpLoad %float %249 - %251 = OpFDiv %float %248 %250 - %252 = OpCompositeConstruct %v2float %237 %251 - OpStore %viewFloorCoord %252 - %255 = OpLoad %float %viewNear - %254 = OpFNegate %float %255 - %256 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_0 - %257 = OpLoad %float %256 - %258 = OpFMul %float %254 %257 - %259 = OpAccessChain %_ptr_Function_float %M %int_2 %int_0 - %260 = OpLoad %float %259 - %261 = OpLoad %float %viewNear - %262 = OpFMul %float %260 %261 - %263 = OpFSub %float %258 %262 - %264 = OpAccessChain %_ptr_Function_float %M %int_0 %int_0 - %265 = OpLoad %float %264 - %266 = OpFDiv %float %263 %265 - %268 = OpLoad %float %viewNear - %267 = OpFNegate %float %268 - %269 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_1 - %270 = OpLoad %float %269 - %271 = OpFMul %float %267 %270 - %272 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 - %273 = OpLoad %float %272 - %274 = OpLoad %float %viewNear - %275 = OpFMul %float %273 %274 - %276 = OpFSub %float %271 %275 - %277 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 - %278 = OpLoad %float %277 - %279 = OpFDiv %float %276 %278 - %280 = OpCompositeConstruct %v2float %266 %279 - OpStore %viewCeilCoord %280 - %282 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_0 - %284 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_0 - %285 = OpLoad %float %284 - %283 = OpFNegate %float %285 - %286 = OpLoad %float %viewNear - %287 = OpFDiv %float %283 %286 - %288 = OpCompositeConstruct %v4float %float_1 %float_0 %287 %float_0 - OpStore %282 %288 - %289 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_1 - %290 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_0 - %291 = OpLoad %float %290 - %292 = OpLoad %float %viewNear - %293 = OpFDiv %float %291 %292 - %294 = OpCompositeConstruct %v4float %float_n1 %float_0 %293 %float_0 - OpStore %289 %294 - %295 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_2 - %297 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_1 - %298 = OpLoad %float %297 - %296 = OpFNegate %float %298 - %299 = OpLoad %float %viewNear - %300 = OpFDiv %float %296 %299 - %301 = OpCompositeConstruct %v4float %float_0 %float_1 %300 %float_0 - OpStore %295 %301 - %302 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_3 - %303 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_1 - %304 = OpLoad %float %303 - %305 = OpLoad %float %viewNear - %306 = OpFDiv %float %304 %305 - %307 = OpCompositeConstruct %v4float %float_0 %float_n1 %306 %float_0 - OpStore %302 %307 - OpStore %dp %float_0 - OpStore %i %uint_0 + %193 = OpCompositeConstruct %v2int %190 %192 + OpStore %tilePixel0Idx %193 + %200 = OpLoad %v2int %tilePixel0Idx + %198 = OpConvertSToF %v2float %200 + %201 = OpVectorTimesScalar %v2float %198 %float_2 + %203 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 + %204 = OpLoad %v4float %203 + %205 = OpVectorShuffle %v2float %204 %204 0 1 + %206 = OpFDiv %v2float %201 %205 + %208 = OpFSub %v2float %206 %207 + OpStore %floorCoord %208 + %213 = OpLoad %v2int %tilePixel0Idx + %214 = OpCompositeConstruct %v2int %int_16 %int_16 + %215 = OpIAdd %v2int %213 %214 + %212 = OpConvertSToF %v2float %215 + %216 = OpVectorTimesScalar %v2float %212 %float_2 + %217 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 + %218 = OpLoad %v4float %217 + %219 = OpVectorShuffle %v2float %218 %218 0 1 + %220 = OpFDiv %v2float %216 %219 + %221 = OpFSub %v2float %220 %207 + OpStore %ceilCoord %221 + %224 = OpLoad %float %viewNear + %223 = OpFNegate %float %224 + %225 = OpAccessChain %_ptr_Function_float %floorCoord %uint_0 + %226 = OpLoad %float %225 + %227 = OpFMul %float %223 %226 + %228 = OpAccessChain %_ptr_Function_float %M %int_2 %166 + %229 = OpLoad %float %228 + %230 = OpLoad %float %viewNear + %231 = OpFMul %float %229 %230 + %232 = OpFSub %float %227 %231 + %233 = OpAccessChain %_ptr_Function_float %M %166 %166 + %234 = OpLoad %float %233 + %235 = OpFDiv %float %232 %234 + %237 = OpLoad %float %viewNear + %236 = OpFNegate %float %237 + %238 = OpAccessChain %_ptr_Function_float %floorCoord %uint_1 + %239 = OpLoad %float %238 + %240 = OpFMul %float %236 %239 + %242 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 + %243 = OpLoad %float %242 + %244 = OpLoad %float %viewNear + %245 = OpFMul %float %243 %244 + %246 = OpFSub %float %240 %245 + %247 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 + %248 = OpLoad %float %247 + %249 = OpFDiv %float %246 %248 + %250 = OpCompositeConstruct %v2float %235 %249 + OpStore %viewFloorCoord %250 + %253 = OpLoad %float %viewNear + %252 = OpFNegate %float %253 + %254 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_0 + %255 = OpLoad %float %254 + %256 = OpFMul %float %252 %255 + %257 = OpAccessChain %_ptr_Function_float %M %int_2 %166 + %258 = OpLoad %float %257 + %259 = OpLoad %float %viewNear + %260 = OpFMul %float %258 %259 + %261 = OpFSub %float %256 %260 + %262 = OpAccessChain %_ptr_Function_float %M %166 %166 + %263 = OpLoad %float %262 + %264 = OpFDiv %float %261 %263 + %266 = OpLoad %float %viewNear + %265 = OpFNegate %float %266 + %267 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_1 + %268 = OpLoad %float %267 + %269 = OpFMul %float %265 %268 + %270 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 + %271 = OpLoad %float %270 + %272 = OpLoad %float %viewNear + %273 = OpFMul %float %271 %272 + %274 = OpFSub %float %269 %273 + %275 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 + %276 = OpLoad %float %275 + %277 = OpFDiv %float %274 %276 + %278 = OpCompositeConstruct %v2float %264 %277 + OpStore %viewCeilCoord %278 + %280 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %166 + %282 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_0 + %283 = OpLoad %float %282 + %281 = OpFNegate %float %283 + %284 = OpLoad %float %viewNear + %285 = OpFDiv %float %281 %284 + %286 = OpCompositeConstruct %v4float %float_1 %101 %285 %101 + OpStore %280 %286 + %287 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_1 + %288 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_0 + %289 = OpLoad %float %288 + %290 = OpLoad %float %viewNear + %291 = OpFDiv %float %289 %290 + %292 = OpCompositeConstruct %v4float %float_n1 %101 %291 %101 + OpStore %287 %292 + %293 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_2 + %295 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_1 + %296 = OpLoad %float %295 + %294 = OpFNegate %float %296 + %297 = OpLoad %float %viewNear + %298 = OpFDiv %float %294 %297 + %299 = OpCompositeConstruct %v4float %101 %float_1 %298 %101 + OpStore %293 %299 + %300 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_3 + %301 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_1 + %302 = OpLoad %float %301 + %303 = OpLoad %float %viewNear + %304 = OpFDiv %float %302 %303 + %305 = OpCompositeConstruct %v4float %101 %float_n1 %304 %101 + OpStore %300 %305 + OpStore %dp %101 + OpStore %i %36 + OpBranch %308 + %308 = OpLabel + OpLoopMerge %309 %310 None + OpBranch %311 + %311 = OpLabel + %313 = OpLoad %uint %i + %314 = OpULessThan %bool %313 %uint_6 + %312 = OpLogicalNot %bool %314 + OpSelectionMerge %315 None + OpBranchConditional %312 %316 %315 + %316 = OpLabel + OpBranch %309 + %315 = OpLabel + %318 = OpLoad %uint %i + %319 = OpAccessChain %_ptr_Function_float %frustumPlanes %318 %uint_0 + %320 = OpLoad %float %319 + %321 = OpFOrdGreaterThan %bool %320 %101 + OpSelectionMerge %322 None + OpBranchConditional %321 %323 %324 + %323 = OpLabel + %325 = OpAccessChain %_ptr_Function_float %p %uint_0 + %326 = OpAccessChain %_ptr_Function_float %boxMax %uint_0 + %327 = OpLoad %float %326 + OpStore %325 %327 + OpBranch %322 + %324 = OpLabel + %328 = OpAccessChain %_ptr_Function_float %p %uint_0 + %329 = OpAccessChain %_ptr_Function_float %boxMin %uint_0 + %330 = OpLoad %float %329 + OpStore %328 %330 + OpBranch %322 + %322 = OpLabel + %331 = OpLoad %uint %i + %332 = OpAccessChain %_ptr_Function_float %frustumPlanes %331 %uint_1 + %333 = OpLoad %float %332 + %334 = OpFOrdGreaterThan %bool %333 %101 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %336 = OpLabel + %338 = OpAccessChain %_ptr_Function_float %p %uint_1 + %339 = OpAccessChain %_ptr_Function_float %boxMax %uint_1 + %340 = OpLoad %float %339 + OpStore %338 %340 + OpBranch %335 + %337 = OpLabel + %341 = OpAccessChain %_ptr_Function_float %p %uint_1 + %342 = OpAccessChain %_ptr_Function_float %boxMin %uint_1 + %343 = OpLoad %float %342 + OpStore %341 %343 + OpBranch %335 + %335 = OpLabel + %344 = OpLoad %uint %i + %345 = OpAccessChain %_ptr_Function_float %frustumPlanes %344 %uint_2 + %346 = OpLoad %float %345 + %347 = OpFOrdGreaterThan %bool %346 %101 + OpSelectionMerge %348 None + OpBranchConditional %347 %349 %350 + %349 = OpLabel + %351 = OpAccessChain %_ptr_Function_float %p %uint_2 + %352 = OpAccessChain %_ptr_Function_float %boxMax %uint_2 + %353 = OpLoad %float %352 + OpStore %351 %353 + OpBranch %348 + %350 = OpLabel + %354 = OpAccessChain %_ptr_Function_float %p %uint_2 + %355 = OpAccessChain %_ptr_Function_float %boxMin %uint_2 + %356 = OpLoad %float %355 + OpStore %354 %356 + OpBranch %348 + %348 = OpLabel + %357 = OpAccessChain %_ptr_Function_float %p %uint_3 + OpStore %357 %float_1 + %358 = OpLoad %float %dp + %361 = OpLoad %v4float %p + %362 = OpLoad %uint %i + %363 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %362 + %364 = OpLoad %v4float %363 + %360 = OpDot %float %361 %364 + %359 = OpExtInst %float %60 NMin %101 %360 + %365 = OpFAdd %float %358 %359 + OpStore %dp %365 OpBranch %310 %310 = OpLabel - OpLoopMerge %311 %312 None - OpBranch %313 - %313 = OpLabel - %315 = OpLoad %uint %i - %316 = OpULessThan %bool %315 %uint_6 - %314 = OpLogicalNot %bool %316 - OpSelectionMerge %317 None - OpBranchConditional %314 %318 %317 - %318 = OpLabel - OpBranch %311 - %317 = OpLabel - %320 = OpLoad %uint %i - %321 = OpAccessChain %_ptr_Function_float %frustumPlanes %320 %uint_0 - %322 = OpLoad %float %321 - %323 = OpFOrdGreaterThan %bool %322 %float_0 - OpSelectionMerge %324 None - OpBranchConditional %323 %325 %326 - %325 = OpLabel - %327 = OpAccessChain %_ptr_Function_float %p %uint_0 - %328 = OpAccessChain %_ptr_Function_float %boxMax %uint_0 - %329 = OpLoad %float %328 - OpStore %327 %329 - OpBranch %324 - %326 = OpLabel - %330 = OpAccessChain %_ptr_Function_float %p %uint_0 - %331 = OpAccessChain %_ptr_Function_float %boxMin %uint_0 - %332 = OpLoad %float %331 - OpStore %330 %332 - OpBranch %324 - %324 = OpLabel - %333 = OpLoad %uint %i - %334 = OpAccessChain %_ptr_Function_float %frustumPlanes %333 %uint_1 - %335 = OpLoad %float %334 - %336 = OpFOrdGreaterThan %bool %335 %float_0 - OpSelectionMerge %337 None - OpBranchConditional %336 %338 %339 - %338 = OpLabel - %340 = OpAccessChain %_ptr_Function_float %p %uint_1 - %341 = OpAccessChain %_ptr_Function_float %boxMax %uint_1 - %342 = OpLoad %float %341 - OpStore %340 %342 - OpBranch %337 - %339 = OpLabel - %343 = OpAccessChain %_ptr_Function_float %p %uint_1 - %344 = OpAccessChain %_ptr_Function_float %boxMin %uint_1 - %345 = OpLoad %float %344 - OpStore %343 %345 - OpBranch %337 - %337 = OpLabel - %346 = OpLoad %uint %i - %347 = OpAccessChain %_ptr_Function_float %frustumPlanes %346 %uint_2 - %348 = OpLoad %float %347 - %349 = OpFOrdGreaterThan %bool %348 %float_0 - OpSelectionMerge %350 None - OpBranchConditional %349 %351 %352 - %351 = OpLabel - %353 = OpAccessChain %_ptr_Function_float %p %uint_2 - %354 = OpAccessChain %_ptr_Function_float %boxMax %uint_2 - %355 = OpLoad %float %354 - OpStore %353 %355 - OpBranch %350 - %352 = OpLabel - %356 = OpAccessChain %_ptr_Function_float %p %uint_2 - %357 = OpAccessChain %_ptr_Function_float %boxMin %uint_2 - %358 = OpLoad %float %357 - OpStore %356 %358 - OpBranch %350 - %350 = OpLabel - %359 = OpAccessChain %_ptr_Function_float %p %uint_3 - OpStore %359 %float_1 - %360 = OpLoad %float %dp - %363 = OpLoad %v4float %p - %364 = OpLoad %uint %i - %365 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %364 - %366 = OpLoad %v4float %365 - %362 = OpDot %float %363 %366 - %361 = OpExtInst %float %60 NMin %float_0 %362 - %367 = OpFAdd %float %360 %361 - OpStore %dp %367 - OpBranch %312 - %312 = OpLabel - %368 = OpLoad %uint %i - %369 = OpIAdd %uint %368 %uint_1 - OpStore %i %369 - OpBranch %310 - %311 = OpLabel - %370 = OpLoad %float %dp - %371 = OpFOrdGreaterThanEqual %bool %370 %float_0 - OpSelectionMerge %372 None - OpBranchConditional %371 %373 %372 - %373 = OpLabel - %375 = OpLoad %int %x - %376 = OpLoad %int %y - %377 = OpIMul %int %376 %int_2 - %378 = OpIAdd %int %375 %377 - %374 = OpBitcast %uint %378 - OpStore %tileId %374 - %380 = OpLoad %uint %tileId - %381 = OpULessThan %bool %380 %uint_0 - OpSelectionMerge %382 None - OpBranchConditional %381 %382 %383 - %383 = OpLabel - %384 = OpLoad %uint %tileId - %385 = OpAccessChain %_ptr_Uniform_uint %config %uint_1 - %386 = OpLoad %uint %385 - %387 = OpUGreaterThanEqual %bool %384 %386 - OpBranch %382 - %382 = OpLabel - %388 = OpPhi %bool %381 %373 %387 %383 - OpSelectionMerge %389 None - OpBranchConditional %388 %390 %389 - %390 = OpLabel - OpBranch %183 - %389 = OpLabel - %393 = OpLoad %uint %tileId - %395 = OpAccessChain %_ptr_StorageBuffer_uint %tileLightId %uint_0 %393 %uint_0 - %391 = OpAtomicIAdd %uint %395 %uint_1 %uint_0 %uint_1 - OpStore %offset %391 - %397 = OpLoad %uint %offset - %398 = OpAccessChain %_ptr_Uniform_uint %config %uint_4 - %399 = OpLoad %uint %398 - %400 = OpUGreaterThanEqual %bool %397 %399 - OpSelectionMerge %401 None - OpBranchConditional %400 %402 %401 - %402 = OpLabel - OpBranch %183 - %401 = OpLabel - %403 = OpLoad %uint %tileId - %404 = OpLoad %uint %offset - %406 = OpAccessChain %_ptr_StorageBuffer_uint_0 %tileLightId %uint_0 %403 %uint_1 %404 - %407 = OpCompositeExtract %uint %GlobalInvocationID 0 - OpStore %406 %407 - OpBranch %372 - %372 = OpLabel - OpBranch %183 - %183 = OpLabel - %408 = OpLoad %int %x - %409 = OpIAdd %int %408 %int_1 - OpStore %x %409 + %366 = OpLoad %uint %i + %367 = OpIAdd %uint %366 %uint_1 + OpStore %i %367 + OpBranch %308 + %309 = OpLabel + %368 = OpLoad %float %dp + %369 = OpFOrdGreaterThanEqual %bool %368 %101 + OpSelectionMerge %370 None + OpBranchConditional %369 %371 %370 + %371 = OpLabel + %373 = OpLoad %int %x + %374 = OpLoad %int %y + %375 = OpIMul %int %374 %int_2 + %376 = OpIAdd %int %373 %375 + %372 = OpBitcast %uint %376 + OpStore %tileId %372 + %378 = OpLoad %uint %tileId + %379 = OpULessThan %bool %378 %36 + OpSelectionMerge %380 None + OpBranchConditional %379 %380 %381 + %381 = OpLabel + %382 = OpLoad %uint %tileId + %383 = OpAccessChain %_ptr_Uniform_uint %config %uint_1 + %384 = OpLoad %uint %383 + %385 = OpUGreaterThanEqual %bool %382 %384 + OpBranch %380 + %380 = OpLabel + %386 = OpPhi %bool %379 %371 %385 %381 + OpSelectionMerge %387 None + OpBranchConditional %386 %388 %387 + %388 = OpLabel OpBranch %181 - %182 = OpLabel - OpBranch %173 - %173 = OpLabel - %410 = OpLoad %int %y - %411 = OpIAdd %int %410 %int_1 - OpStore %y %411 + %387 = OpLabel + %391 = OpLoad %uint %tileId + %393 = OpAccessChain %_ptr_StorageBuffer_uint %tileLightId %uint_0 %391 %uint_0 + %389 = OpAtomicIAdd %uint %393 %uint_1 %uint_0 %uint_1 + OpStore %offset %389 + %395 = OpLoad %uint %offset + %396 = OpAccessChain %_ptr_Uniform_uint %config %uint_4 + %397 = OpLoad %uint %396 + %398 = OpUGreaterThanEqual %bool %395 %397 + OpSelectionMerge %399 None + OpBranchConditional %398 %400 %399 + %400 = OpLabel + OpBranch %181 + %399 = OpLabel + %401 = OpLoad %uint %tileId + %402 = OpLoad %uint %offset + %404 = OpAccessChain %_ptr_StorageBuffer_uint_0 %tileLightId %uint_0 %401 %uint_1 %402 + %405 = OpCompositeExtract %uint %GlobalInvocationID 0 + OpStore %404 %405 + OpBranch %370 + %370 = OpLabel + OpBranch %181 + %181 = OpLabel + %406 = OpLoad %int %x + %407 = OpIAdd %int %406 %int_1 + OpStore %x %407 + OpBranch %179 + %180 = OpLabel OpBranch %171 - %172 = OpLabel + %171 = OpLabel + %408 = OpLoad %int %y + %409 = OpIAdd %int %408 %int_1 + OpStore %y %409 + OpBranch %169 + %170 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %412 - %414 = OpLabel - %416 = OpLoad %v3uint %GlobalInvocationID_1 - %415 = OpFunctionCall %void %main_inner %416 + %main = OpFunction %void None %410 + %412 = OpLabel + %414 = OpLoad %v3uint %GlobalInvocationID_1 + %413 = OpFunctionCall %void %main_inner %414 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1121.wgsl.expected.wgsl b/test/tint/bug/tint/1121.wgsl.expected.wgsl index 9207245ff6..bea6cabe0c 100644 --- a/test/tint/bug/tint/1121.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1121.wgsl.expected.wgsl @@ -42,7 +42,7 @@ struct Uniforms { @group(3) @binding(0) var uniforms : Uniforms; -@stage(compute) @workgroup_size(64, 1, 1) +@compute @workgroup_size(64, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var index = GlobalInvocationID.x; if ((index >= config.numLights)) { diff --git a/test/tint/bug/tint/1136.wgsl.expected.hlsl b/test/tint/bug/tint/1136.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/1136.wgsl.expected.hlsl rename to test/tint/bug/tint/1136.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/1136.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1136.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c50c331517 --- /dev/null +++ b/test/tint/bug/tint/1136.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer buffer : register(u0, space0); + +void main() { + buffer.Store(0u, asuint((buffer.Load(0u) + 1u))); +} diff --git a/test/tint/bug/tint/1321.wgsl b/test/tint/bug/tint/1321.wgsl index 1ab9e23e70..b2ec2f7ff6 100644 --- a/test/tint/bug/tint/1321.wgsl +++ b/test/tint/bug/tint/1321.wgsl @@ -2,7 +2,7 @@ fn foo() -> i32 { return 1; } -@stage(fragment) +@fragment fn main() { var arr = array(); for (let a = &arr[foo()]; ;) { diff --git a/test/tint/bug/tint/1321.wgsl.expected.hlsl b/test/tint/bug/tint/1321.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/1321.wgsl.expected.hlsl rename to test/tint/bug/tint/1321.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/1321.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1321.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1da087fd7c --- /dev/null +++ b/test/tint/bug/tint/1321.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +int foo() { + return 1; +} + +void main() { + float arr[4] = (float[4])0; + const int a_save = foo(); + { + [loop] for(; ; ) { + const float x = arr[a_save]; + break; + } + } + return; +} diff --git a/test/tint/bug/tint/1321.wgsl.expected.msl b/test/tint/bug/tint/1321.wgsl.expected.msl index 8c96d14ec6..c67bb760ea 100644 --- a/test/tint/bug/tint/1321.wgsl.expected.msl +++ b/test/tint/bug/tint/1321.wgsl.expected.msl @@ -1,20 +1,29 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + int foo() { return 1; } -struct tint_array_wrapper { - float arr[4]; -}; - fragment void tint_symbol() { - tint_array_wrapper arr = {.arr={}}; + tint_array arr = tint_array{}; int const tint_symbol_1 = foo(); int const a_save = tint_symbol_1; for(; ; ) { - float const x = arr.arr[a_save]; + float const x = arr[a_save]; break; } return; diff --git a/test/tint/bug/tint/1321.wgsl.expected.wgsl b/test/tint/bug/tint/1321.wgsl.expected.wgsl index 21173939f1..a6d0d98e1d 100644 --- a/test/tint/bug/tint/1321.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1321.wgsl.expected.wgsl @@ -2,7 +2,7 @@ fn foo() -> i32 { return 1; } -@stage(fragment) +@fragment fn main() { var arr = array(); for(let a = &(arr[foo()]); ; ) { diff --git a/test/tint/bug/tint/1332.wgsl b/test/tint/bug/tint/1332.wgsl new file mode 100644 index 0000000000..d83c3ab456 --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl @@ -0,0 +1,5 @@ +@compute @workgroup_size(1) +fn compute_main() { + let a = 1.23; + var b = max(a, 1.17549435e-38); +} diff --git a/test/tint/bug/tint/1332.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1332.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a9a78badf --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void compute_main() { + float b = max(1.230000019f, 1.17549435e-38f); + return; +} diff --git a/test/tint/bug/tint/1332.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1332.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a9a78badf --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void compute_main() { + float b = max(1.230000019f, 1.17549435e-38f); + return; +} diff --git a/test/tint/bug/tint/1332.wgsl.expected.glsl b/test/tint/bug/tint/1332.wgsl.expected.glsl new file mode 100644 index 0000000000..ce7977b410 --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +void compute_main() { + float b = max(1.230000019f, 1.17549435e-38f); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/bug/tint/1332.wgsl.expected.msl b/test/tint/bug/tint/1332.wgsl.expected.msl new file mode 100644 index 0000000000..7ae877138b --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +kernel void compute_main() { + float const a = 1.230000019f; + float b = fmax(a, 1.17549435e-38f); + return; +} + diff --git a/test/tint/bug/tint/1332.wgsl.expected.spvasm b/test/tint/bug/tint/1332.wgsl.expected.spvasm new file mode 100644 index 0000000000..005dab5227 --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %8 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %compute_main "compute_main" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 +%float_1_23000002 = OpConstant %float 1.23000002 +%float_1_17549435en38 = OpConstant %float 1.17549435e-38 +%_ptr_Function_float = OpTypePointer Function %float + %12 = OpConstantNull %float +%compute_main = OpFunction %void None %1 + %4 = OpLabel + %b = OpVariable %_ptr_Function_float Function %12 + %7 = OpExtInst %float %8 NMax %float_1_23000002 %float_1_17549435en38 + OpStore %b %7 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1332.wgsl.expected.wgsl b/test/tint/bug/tint/1332.wgsl.expected.wgsl new file mode 100644 index 0000000000..f95540e197 --- /dev/null +++ b/test/tint/bug/tint/1332.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +@compute @workgroup_size(1) +fn compute_main() { + let a = 1.230000019; + var b = max(a, 1.17549435e-38); +} diff --git a/test/tint/bug/tint/1369.wgsl b/test/tint/bug/tint/1369.wgsl index b90b8e31a1..30e3d019a7 100644 --- a/test/tint/bug/tint/1369.wgsl +++ b/test/tint/bug/tint/1369.wgsl @@ -3,7 +3,7 @@ fn call_discard() -> bool { return true; } -@stage(fragment) +@fragment fn f() { var v = call_discard(); var also_unreachable : bool; diff --git a/test/tint/bug/tint/1369.wgsl.expected.hlsl b/test/tint/bug/tint/1369.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/1369.wgsl.expected.hlsl rename to test/tint/bug/tint/1369.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/1369.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1369.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d0fffc5379 --- /dev/null +++ b/test/tint/bug/tint/1369.wgsl.expected.fxc.hlsl @@ -0,0 +1,29 @@ +bug/tint/1369.wgsl:3:3 warning: code is unreachable + return true; + ^^^^^^ + +bug/tint/1369.wgsl:9:9 warning: code is unreachable + var also_unreachable : bool; + ^^^^^^^^^^^^^^^^ + +static bool tint_discard = false; + +bool call_discard() { + tint_discard = true; + return false; + return true; +} + +void tint_discard_func() { + discard; +} + +void f() { + bool v = call_discard(); + if (tint_discard) { + tint_discard_func(); + return; + } + bool also_unreachable = false; + return; +} diff --git a/test/tint/bug/tint/1369.wgsl.expected.msl b/test/tint/bug/tint/1369.wgsl.expected.msl index e5ce3962e6..4fc75b1fea 100644 --- a/test/tint/bug/tint/1369.wgsl.expected.msl +++ b/test/tint/bug/tint/1369.wgsl.expected.msl @@ -11,7 +11,7 @@ bug/tint/1369.wgsl:9:9 warning: code is unreachable using namespace metal; bool call_discard(thread bool* const tint_symbol) { *(tint_symbol) = true; - return bool(); + return false; return true; } diff --git a/test/tint/bug/tint/1369.wgsl.expected.spvasm b/test/tint/bug/tint/1369.wgsl.expected.spvasm index e3ece9c26b..f9013117ed 100644 --- a/test/tint/bug/tint/1369.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1369.wgsl.expected.spvasm @@ -9,7 +9,7 @@ bug/tint/1369.wgsl:9:9 warning: code is unreachable ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -21,35 +21,34 @@ bug/tint/1369.wgsl:9:9 warning: code is unreachable OpName %f "f" OpName %v "v" %bool = OpTypeBool - %false = OpConstantFalse %bool + %2 = OpConstantNull %bool %_ptr_Private_bool = OpTypePointer Private %bool -%tint_discard = OpVariable %_ptr_Private_bool Private %false +%tint_discard = OpVariable %_ptr_Private_bool Private %2 %5 = OpTypeFunction %bool %true = OpConstantTrue %bool - %9 = OpConstantNull %bool %void = OpTypeVoid - %10 = OpTypeFunction %void + %9 = OpTypeFunction %void %_ptr_Function_bool = OpTypePointer Function %bool %call_discard = OpFunction %bool None %5 %7 = OpLabel OpStore %tint_discard %true - OpReturnValue %9 + OpReturnValue %2 OpFunctionEnd -%tint_discard_func = OpFunction %void None %10 - %13 = OpLabel +%tint_discard_func = OpFunction %void None %9 + %12 = OpLabel OpKill OpFunctionEnd - %f = OpFunction %void None %10 - %15 = OpLabel - %v = OpVariable %_ptr_Function_bool Function %9 - %16 = OpFunctionCall %bool %call_discard - OpStore %v %16 - %19 = OpLoad %bool %tint_discard - OpSelectionMerge %20 None - OpBranchConditional %19 %21 %20 - %21 = OpLabel - %22 = OpFunctionCall %void %tint_discard_func - OpReturn + %f = OpFunction %void None %9 + %14 = OpLabel + %v = OpVariable %_ptr_Function_bool Function %2 + %15 = OpFunctionCall %bool %call_discard + OpStore %v %15 + %18 = OpLoad %bool %tint_discard + OpSelectionMerge %19 None + OpBranchConditional %18 %20 %19 %20 = OpLabel + %21 = OpFunctionCall %void %tint_discard_func + OpReturn + %19 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1369.wgsl.expected.wgsl b/test/tint/bug/tint/1369.wgsl.expected.wgsl index 2da3171c6b..818f5a33fa 100644 --- a/test/tint/bug/tint/1369.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1369.wgsl.expected.wgsl @@ -11,7 +11,7 @@ fn call_discard() -> bool { return true; } -@stage(fragment) +@fragment fn f() { var v = call_discard(); var also_unreachable : bool; diff --git a/test/tint/bug/tint/1385.wgsl b/test/tint/bug/tint/1385.wgsl index 78f402ed64..9be207ea44 100644 --- a/test/tint/bug/tint/1385.wgsl +++ b/test/tint/bug/tint/1385.wgsl @@ -5,7 +5,7 @@ fn foo() -> i32 { return data[0]; } -@stage(compute) @workgroup_size(16, 16, 1) +@compute @workgroup_size(16, 16, 1) fn main() { foo(); } diff --git a/test/tint/bug/tint/1385.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1385.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..19f9fb1a57 --- /dev/null +++ b/test/tint/bug/tint/1385.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +ByteAddressBuffer data : register(t1, space0); + +int foo() { + return asint(data.Load(0u)); +} + +[numthreads(16, 16, 1)] +void main() { + foo(); + return; +} diff --git a/test/tint/bug/tint/1385.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1385.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..19f9fb1a57 --- /dev/null +++ b/test/tint/bug/tint/1385.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +ByteAddressBuffer data : register(t1, space0); + +int foo() { + return asint(data.Load(0u)); +} + +[numthreads(16, 16, 1)] +void main() { + foo(); + return; +} diff --git a/test/tint/bug/tint/1385.wgsl.expected.hlsl b/test/tint/bug/tint/1385.wgsl.expected.hlsl deleted file mode 100644 index 40ccc12542..0000000000 --- a/test/tint/bug/tint/1385.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -ByteAddressBuffer data : register(t1, space0); - -int foo() { - return asint(data.Load((4u * uint(0)))); -} - -[numthreads(16, 16, 1)] -void main() { - foo(); - return; -} diff --git a/test/tint/bug/tint/1385.wgsl.expected.msl b/test/tint/bug/tint/1385.wgsl.expected.msl index 838babdeec..c57afcec6c 100644 --- a/test/tint/bug/tint/1385.wgsl.expected.msl +++ b/test/tint/bug/tint/1385.wgsl.expected.msl @@ -1,11 +1,24 @@ #include using namespace metal; -struct tint_symbol_3 { - /* 0x0000 */ int arr[1]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -int foo(const device int (*const tint_symbol_1)[1]) { +struct tint_symbol_3 { + /* 0x0000 */ tint_array arr; +}; + +int foo(const device tint_array* const tint_symbol_1) { return (*(tint_symbol_1))[0]; } diff --git a/test/tint/bug/tint/1385.wgsl.expected.spvasm b/test/tint/bug/tint/1385.wgsl.expected.spvasm index a7f1b74341..6b9da4dd90 100644 --- a/test/tint/bug/tint/1385.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1385.wgsl.expected.spvasm @@ -26,13 +26,13 @@ %6 = OpTypeFunction %int %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 - %int_0 = OpConstant %int 0 + %11 = OpConstantNull %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %void = OpTypeVoid %15 = OpTypeFunction %void %foo = OpFunction %int None %6 %8 = OpLabel - %13 = OpAccessChain %_ptr_StorageBuffer_int %data %uint_0 %int_0 + %13 = OpAccessChain %_ptr_StorageBuffer_int %data %uint_0 %11 %14 = OpLoad %int %13 OpReturnValue %14 OpFunctionEnd diff --git a/test/tint/bug/tint/1385.wgsl.expected.wgsl b/test/tint/bug/tint/1385.wgsl.expected.wgsl index 3e522fd41b..f4f5d94920 100644 --- a/test/tint/bug/tint/1385.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1385.wgsl.expected.wgsl @@ -4,7 +4,7 @@ fn foo() -> i32 { return data[0]; } -@stage(compute) @workgroup_size(16, 16, 1) +@compute @workgroup_size(16, 16, 1) fn main() { foo(); } diff --git a/test/tint/bug/tint/1509.wgsl b/test/tint/bug/tint/1509.wgsl new file mode 100644 index 0000000000..0ba56e0d05 --- /dev/null +++ b/test/tint/bug/tint/1509.wgsl @@ -0,0 +1,3009 @@ +var v0 : u32; + +var v1 : u32; + +var v2 : u32; + +var v3 : u32; + +var v4 : u32; + +var v5 : u32; + +var v6 : u32; + +var v7 : u32; + +var v8 : u32; + +var v9 : u32; + +var v10 : u32; + +var v11 : u32; + +var v12 : u32; + +var v13 : u32; + +var v14 : u32; + +var v15 : u32; + +var v16 : u32; + +var v17 : u32; + +var v18 : u32; + +var v19 : u32; + +var v20 : u32; + +var v21 : u32; + +var v22 : u32; + +var v23 : u32; + +var v24 : u32; + +var v25 : u32; + +var v26 : u32; + +var v27 : u32; + +var v28 : u32; + +var v29 : u32; + +var v30 : u32; + +var v31 : u32; + +var v32 : u32; + +var v33 : u32; + +var v34 : u32; + +var v35 : u32; + +var v36 : u32; + +var v37 : u32; + +var v38 : u32; + +var v39 : u32; + +var v40 : u32; + +var v41 : u32; + +var v42 : u32; + +var v43 : u32; + +var v44 : u32; + +var v45 : u32; + +var v46 : u32; + +var v47 : u32; + +var v48 : u32; + +var v49 : u32; + +var v50 : u32; + +var v51 : u32; + +var v52 : u32; + +var v53 : u32; + +var v54 : u32; + +var v55 : u32; + +var v56 : u32; + +var v57 : u32; + +var v58 : u32; + +var v59 : u32; + +var v60 : u32; + +var v61 : u32; + +var v62 : u32; + +var v63 : u32; + +var v64 : u32; + +var v65 : u32; + +var v66 : u32; + +var v67 : u32; + +var v68 : u32; + +var v69 : u32; + +var v70 : u32; + +var v71 : u32; + +var v72 : u32; + +var v73 : u32; + +var v74 : u32; + +var v75 : u32; + +var v76 : u32; + +var v77 : u32; + +var v78 : u32; + +var v79 : u32; + +var v80 : u32; + +var v81 : u32; + +var v82 : u32; + +var v83 : u32; + +var v84 : u32; + +var v85 : u32; + +var v86 : u32; + +var v87 : u32; + +var v88 : u32; + +var v89 : u32; + +var v90 : u32; + +var v91 : u32; + +var v92 : u32; + +var v93 : u32; + +var v94 : u32; + +var v95 : u32; + +var v96 : u32; + +var v97 : u32; + +var v98 : u32; + +var v99 : u32; + +var v100 : u32; + +var v101 : u32; + +var v102 : u32; + +var v103 : u32; + +var v104 : u32; + +var v105 : u32; + +var v106 : u32; + +var v107 : u32; + +var v108 : u32; + +var v109 : u32; + +var v110 : u32; + +var v111 : u32; + +var v112 : u32; + +var v113 : u32; + +var v114 : u32; + +var v115 : u32; + +var v116 : u32; + +var v117 : u32; + +var v118 : u32; + +var v119 : u32; + +var v120 : u32; + +var v121 : u32; + +var v122 : u32; + +var v123 : u32; + +var v124 : u32; + +var v125 : u32; + +var v126 : u32; + +var v127 : u32; + +var v128 : u32; + +var v129 : u32; + +var v130 : u32; + +var v131 : u32; + +var v132 : u32; + +var v133 : u32; + +var v134 : u32; + +var v135 : u32; + +var v136 : u32; + +var v137 : u32; + +var v138 : u32; + +var v139 : u32; + +var v140 : u32; + +var v141 : u32; + +var v142 : u32; + +var v143 : u32; + +var v144 : u32; + +var v145 : u32; + +var v146 : u32; + +var v147 : u32; + +var v148 : u32; + +var v149 : u32; + +var v150 : u32; + +var v151 : u32; + +var v152 : u32; + +var v153 : u32; + +var v154 : u32; + +var v155 : u32; + +var v156 : u32; + +var v157 : u32; + +var v158 : u32; + +var v159 : u32; + +var v160 : u32; + +var v161 : u32; + +var v162 : u32; + +var v163 : u32; + +var v164 : u32; + +var v165 : u32; + +var v166 : u32; + +var v167 : u32; + +var v168 : u32; + +var v169 : u32; + +var v170 : u32; + +var v171 : u32; + +var v172 : u32; + +var v173 : u32; + +var v174 : u32; + +var v175 : u32; + +var v176 : u32; + +var v177 : u32; + +var v178 : u32; + +var v179 : u32; + +var v180 : u32; + +var v181 : u32; + +var v182 : u32; + +var v183 : u32; + +var v184 : u32; + +var v185 : u32; + +var v186 : u32; + +var v187 : u32; + +var v188 : u32; + +var v189 : u32; + +var v190 : u32; + +var v191 : u32; + +var v192 : u32; + +var v193 : u32; + +var v194 : u32; + +var v195 : u32; + +var v196 : u32; + +var v197 : u32; + +var v198 : u32; + +var v199 : u32; + +var v200 : u32; + +var v201 : u32; + +var v202 : u32; + +var v203 : u32; + +var v204 : u32; + +var v205 : u32; + +var v206 : u32; + +var v207 : u32; + +var v208 : u32; + +var v209 : u32; + +var v210 : u32; + +var v211 : u32; + +var v212 : u32; + +var v213 : u32; + +var v214 : u32; + +var v215 : u32; + +var v216 : u32; + +var v217 : u32; + +var v218 : u32; + +var v219 : u32; + +var v220 : u32; + +var v221 : u32; + +var v222 : u32; + +var v223 : u32; + +var v224 : u32; + +var v225 : u32; + +var v226 : u32; + +var v227 : u32; + +var v228 : u32; + +var v229 : u32; + +var v230 : u32; + +var v231 : u32; + +var v232 : u32; + +var v233 : u32; + +var v234 : u32; + +var v235 : u32; + +var v236 : u32; + +var v237 : u32; + +var v238 : u32; + +var v239 : u32; + +var v240 : u32; + +var v241 : u32; + +var v242 : u32; + +var v243 : u32; + +var v244 : u32; + +var v245 : u32; + +var v246 : u32; + +var v247 : u32; + +var v248 : u32; + +var v249 : u32; + +var v250 : u32; + +var v251 : u32; + +var v252 : u32; + +var v253 : u32; + +var v254 : u32; + +var v255 : u32; + +var v256 : u32; + +var v257 : u32; + +var v258 : u32; + +var v259 : u32; + +var v260 : u32; + +var v261 : u32; + +var v262 : u32; + +var v263 : u32; + +var v264 : u32; + +var v265 : u32; + +var v266 : u32; + +var v267 : u32; + +var v268 : u32; + +var v269 : u32; + +var v270 : u32; + +var v271 : u32; + +var v272 : u32; + +var v273 : u32; + +var v274 : u32; + +var v275 : u32; + +var v276 : u32; + +var v277 : u32; + +var v278 : u32; + +var v279 : u32; + +var v280 : u32; + +var v281 : u32; + +var v282 : u32; + +var v283 : u32; + +var v284 : u32; + +var v285 : u32; + +var v286 : u32; + +var v287 : u32; + +var v288 : u32; + +var v289 : u32; + +var v290 : u32; + +var v291 : u32; + +var v292 : u32; + +var v293 : u32; + +var v294 : u32; + +var v295 : u32; + +var v296 : u32; + +var v297 : u32; + +var v298 : u32; + +var v299 : u32; + +var v300 : u32; + +var v301 : u32; + +var v302 : u32; + +var v303 : u32; + +var v304 : u32; + +var v305 : u32; + +var v306 : u32; + +var v307 : u32; + +var v308 : u32; + +var v309 : u32; + +var v310 : u32; + +var v311 : u32; + +var v312 : u32; + +var v313 : u32; + +var v314 : u32; + +var v315 : u32; + +var v316 : u32; + +var v317 : u32; + +var v318 : u32; + +var v319 : u32; + +var v320 : u32; + +var v321 : u32; + +var v322 : u32; + +var v323 : u32; + +var v324 : u32; + +var v325 : u32; + +var v326 : u32; + +var v327 : u32; + +var v328 : u32; + +var v329 : u32; + +var v330 : u32; + +var v331 : u32; + +var v332 : u32; + +var v333 : u32; + +var v334 : u32; + +var v335 : u32; + +var v336 : u32; + +var v337 : u32; + +var v338 : u32; + +var v339 : u32; + +var v340 : u32; + +var v341 : u32; + +var v342 : u32; + +var v343 : u32; + +var v344 : u32; + +var v345 : u32; + +var v346 : u32; + +var v347 : u32; + +var v348 : u32; + +var v349 : u32; + +var v350 : u32; + +var v351 : u32; + +var v352 : u32; + +var v353 : u32; + +var v354 : u32; + +var v355 : u32; + +var v356 : u32; + +var v357 : u32; + +var v358 : u32; + +var v359 : u32; + +var v360 : u32; + +var v361 : u32; + +var v362 : u32; + +var v363 : u32; + +var v364 : u32; + +var v365 : u32; + +var v366 : u32; + +var v367 : u32; + +var v368 : u32; + +var v369 : u32; + +var v370 : u32; + +var v371 : u32; + +var v372 : u32; + +var v373 : u32; + +var v374 : u32; + +var v375 : u32; + +var v376 : u32; + +var v377 : u32; + +var v378 : u32; + +var v379 : u32; + +var v380 : u32; + +var v381 : u32; + +var v382 : u32; + +var v383 : u32; + +var v384 : u32; + +var v385 : u32; + +var v386 : u32; + +var v387 : u32; + +var v388 : u32; + +var v389 : u32; + +var v390 : u32; + +var v391 : u32; + +var v392 : u32; + +var v393 : u32; + +var v394 : u32; + +var v395 : u32; + +var v396 : u32; + +var v397 : u32; + +var v398 : u32; + +var v399 : u32; + +var v400 : u32; + +var v401 : u32; + +var v402 : u32; + +var v403 : u32; + +var v404 : u32; + +var v405 : u32; + +var v406 : u32; + +var v407 : u32; + +var v408 : u32; + +var v409 : u32; + +var v410 : u32; + +var v411 : u32; + +var v412 : u32; + +var v413 : u32; + +var v414 : u32; + +var v415 : u32; + +var v416 : u32; + +var v417 : u32; + +var v418 : u32; + +var v419 : u32; + +var v420 : u32; + +var v421 : u32; + +var v422 : u32; + +var v423 : u32; + +var v424 : u32; + +var v425 : u32; + +var v426 : u32; + +var v427 : u32; + +var v428 : u32; + +var v429 : u32; + +var v430 : u32; + +var v431 : u32; + +var v432 : u32; + +var v433 : u32; + +var v434 : u32; + +var v435 : u32; + +var v436 : u32; + +var v437 : u32; + +var v438 : u32; + +var v439 : u32; + +var v440 : u32; + +var v441 : u32; + +var v442 : u32; + +var v443 : u32; + +var v444 : u32; + +var v445 : u32; + +var v446 : u32; + +var v447 : u32; + +var v448 : u32; + +var v449 : u32; + +var v450 : u32; + +var v451 : u32; + +var v452 : u32; + +var v453 : u32; + +var v454 : u32; + +var v455 : u32; + +var v456 : u32; + +var v457 : u32; + +var v458 : u32; + +var v459 : u32; + +var v460 : u32; + +var v461 : u32; + +var v462 : u32; + +var v463 : u32; + +var v464 : u32; + +var v465 : u32; + +var v466 : u32; + +var v467 : u32; + +var v468 : u32; + +var v469 : u32; + +var v470 : u32; + +var v471 : u32; + +var v472 : u32; + +var v473 : u32; + +var v474 : u32; + +var v475 : u32; + +var v476 : u32; + +var v477 : u32; + +var v478 : u32; + +var v479 : u32; + +var v480 : u32; + +var v481 : u32; + +var v482 : u32; + +var v483 : u32; + +var v484 : u32; + +var v485 : u32; + +var v486 : u32; + +var v487 : u32; + +var v488 : u32; + +var v489 : u32; + +var v490 : u32; + +var v491 : u32; + +var v492 : u32; + +var v493 : u32; + +var v494 : u32; + +var v495 : u32; + +var v496 : u32; + +var v497 : u32; + +var v498 : u32; + +var v499 : u32; + +var v500 : u32; + +var v501 : u32; + +var v502 : u32; + +var v503 : u32; + +var v504 : u32; + +var v505 : u32; + +var v506 : u32; + +var v507 : u32; + +var v508 : u32; + +var v509 : u32; + +var v510 : u32; + +var v511 : u32; + +var v512 : u32; + +var v513 : u32; + +var v514 : u32; + +var v515 : u32; + +var v516 : u32; + +var v517 : u32; + +var v518 : u32; + +var v519 : u32; + +var v520 : u32; + +var v521 : u32; + +var v522 : u32; + +var v523 : u32; + +var v524 : u32; + +var v525 : u32; + +var v526 : u32; + +var v527 : u32; + +var v528 : u32; + +var v529 : u32; + +var v530 : u32; + +var v531 : u32; + +var v532 : u32; + +var v533 : u32; + +var v534 : u32; + +var v535 : u32; + +var v536 : u32; + +var v537 : u32; + +var v538 : u32; + +var v539 : u32; + +var v540 : u32; + +var v541 : u32; + +var v542 : u32; + +var v543 : u32; + +var v544 : u32; + +var v545 : u32; + +var v546 : u32; + +var v547 : u32; + +var v548 : u32; + +var v549 : u32; + +var v550 : u32; + +var v551 : u32; + +var v552 : u32; + +var v553 : u32; + +var v554 : u32; + +var v555 : u32; + +var v556 : u32; + +var v557 : u32; + +var v558 : u32; + +var v559 : u32; + +var v560 : u32; + +var v561 : u32; + +var v562 : u32; + +var v563 : u32; + +var v564 : u32; + +var v565 : u32; + +var v566 : u32; + +var v567 : u32; + +var v568 : u32; + +var v569 : u32; + +var v570 : u32; + +var v571 : u32; + +var v572 : u32; + +var v573 : u32; + +var v574 : u32; + +var v575 : u32; + +var v576 : u32; + +var v577 : u32; + +var v578 : u32; + +var v579 : u32; + +var v580 : u32; + +var v581 : u32; + +var v582 : u32; + +var v583 : u32; + +var v584 : u32; + +var v585 : u32; + +var v586 : u32; + +var v587 : u32; + +var v588 : u32; + +var v589 : u32; + +var v590 : u32; + +var v591 : u32; + +var v592 : u32; + +var v593 : u32; + +var v594 : u32; + +var v595 : u32; + +var v596 : u32; + +var v597 : u32; + +var v598 : u32; + +var v599 : u32; + +var v600 : u32; + +var v601 : u32; + +var v602 : u32; + +var v603 : u32; + +var v604 : u32; + +var v605 : u32; + +var v606 : u32; + +var v607 : u32; + +var v608 : u32; + +var v609 : u32; + +var v610 : u32; + +var v611 : u32; + +var v612 : u32; + +var v613 : u32; + +var v614 : u32; + +var v615 : u32; + +var v616 : u32; + +var v617 : u32; + +var v618 : u32; + +var v619 : u32; + +var v620 : u32; + +var v621 : u32; + +var v622 : u32; + +var v623 : u32; + +var v624 : u32; + +var v625 : u32; + +var v626 : u32; + +var v627 : u32; + +var v628 : u32; + +var v629 : u32; + +var v630 : u32; + +var v631 : u32; + +var v632 : u32; + +var v633 : u32; + +var v634 : u32; + +var v635 : u32; + +var v636 : u32; + +var v637 : u32; + +var v638 : u32; + +var v639 : u32; + +var v640 : u32; + +var v641 : u32; + +var v642 : u32; + +var v643 : u32; + +var v644 : u32; + +var v645 : u32; + +var v646 : u32; + +var v647 : u32; + +var v648 : u32; + +var v649 : u32; + +var v650 : u32; + +var v651 : u32; + +var v652 : u32; + +var v653 : u32; + +var v654 : u32; + +var v655 : u32; + +var v656 : u32; + +var v657 : u32; + +var v658 : u32; + +var v659 : u32; + +var v660 : u32; + +var v661 : u32; + +var v662 : u32; + +var v663 : u32; + +var v664 : u32; + +var v665 : u32; + +var v666 : u32; + +var v667 : u32; + +var v668 : u32; + +var v669 : u32; + +var v670 : u32; + +var v671 : u32; + +var v672 : u32; + +var v673 : u32; + +var v674 : u32; + +var v675 : u32; + +var v676 : u32; + +var v677 : u32; + +var v678 : u32; + +var v679 : u32; + +var v680 : u32; + +var v681 : u32; + +var v682 : u32; + +var v683 : u32; + +var v684 : u32; + +var v685 : u32; + +var v686 : u32; + +var v687 : u32; + +var v688 : u32; + +var v689 : u32; + +var v690 : u32; + +var v691 : u32; + +var v692 : u32; + +var v693 : u32; + +var v694 : u32; + +var v695 : u32; + +var v696 : u32; + +var v697 : u32; + +var v698 : u32; + +var v699 : u32; + +var v700 : u32; + +var v701 : u32; + +var v702 : u32; + +var v703 : u32; + +var v704 : u32; + +var v705 : u32; + +var v706 : u32; + +var v707 : u32; + +var v708 : u32; + +var v709 : u32; + +var v710 : u32; + +var v711 : u32; + +var v712 : u32; + +var v713 : u32; + +var v714 : u32; + +var v715 : u32; + +var v716 : u32; + +var v717 : u32; + +var v718 : u32; + +var v719 : u32; + +var v720 : u32; + +var v721 : u32; + +var v722 : u32; + +var v723 : u32; + +var v724 : u32; + +var v725 : u32; + +var v726 : u32; + +var v727 : u32; + +var v728 : u32; + +var v729 : u32; + +var v730 : u32; + +var v731 : u32; + +var v732 : u32; + +var v733 : u32; + +var v734 : u32; + +var v735 : u32; + +var v736 : u32; + +var v737 : u32; + +var v738 : u32; + +var v739 : u32; + +var v740 : u32; + +var v741 : u32; + +var v742 : u32; + +var v743 : u32; + +var v744 : u32; + +var v745 : u32; + +var v746 : u32; + +var v747 : u32; + +var v748 : u32; + +var v749 : u32; + +var v750 : u32; + +var v751 : u32; + +var v752 : u32; + +var v753 : u32; + +var v754 : u32; + +var v755 : u32; + +var v756 : u32; + +var v757 : u32; + +var v758 : u32; + +var v759 : u32; + +var v760 : u32; + +var v761 : u32; + +var v762 : u32; + +var v763 : u32; + +var v764 : u32; + +var v765 : u32; + +var v766 : u32; + +var v767 : u32; + +var v768 : u32; + +var v769 : u32; + +var v770 : u32; + +var v771 : u32; + +var v772 : u32; + +var v773 : u32; + +var v774 : u32; + +var v775 : u32; + +var v776 : u32; + +var v777 : u32; + +var v778 : u32; + +var v779 : u32; + +var v780 : u32; + +var v781 : u32; + +var v782 : u32; + +var v783 : u32; + +var v784 : u32; + +var v785 : u32; + +var v786 : u32; + +var v787 : u32; + +var v788 : u32; + +var v789 : u32; + +var v790 : u32; + +var v791 : u32; + +var v792 : u32; + +var v793 : u32; + +var v794 : u32; + +var v795 : u32; + +var v796 : u32; + +var v797 : u32; + +var v798 : u32; + +var v799 : u32; + +var v800 : u32; + +var v801 : u32; + +var v802 : u32; + +var v803 : u32; + +var v804 : u32; + +var v805 : u32; + +var v806 : u32; + +var v807 : u32; + +var v808 : u32; + +var v809 : u32; + +var v810 : u32; + +var v811 : u32; + +var v812 : u32; + +var v813 : u32; + +var v814 : u32; + +var v815 : u32; + +var v816 : u32; + +var v817 : u32; + +var v818 : u32; + +var v819 : u32; + +var v820 : u32; + +var v821 : u32; + +var v822 : u32; + +var v823 : u32; + +var v824 : u32; + +var v825 : u32; + +var v826 : u32; + +var v827 : u32; + +var v828 : u32; + +var v829 : u32; + +var v830 : u32; + +var v831 : u32; + +var v832 : u32; + +var v833 : u32; + +var v834 : u32; + +var v835 : u32; + +var v836 : u32; + +var v837 : u32; + +var v838 : u32; + +var v839 : u32; + +var v840 : u32; + +var v841 : u32; + +var v842 : u32; + +var v843 : u32; + +var v844 : u32; + +var v845 : u32; + +var v846 : u32; + +var v847 : u32; + +var v848 : u32; + +var v849 : u32; + +var v850 : u32; + +var v851 : u32; + +var v852 : u32; + +var v853 : u32; + +var v854 : u32; + +var v855 : u32; + +var v856 : u32; + +var v857 : u32; + +var v858 : u32; + +var v859 : u32; + +var v860 : u32; + +var v861 : u32; + +var v862 : u32; + +var v863 : u32; + +var v864 : u32; + +var v865 : u32; + +var v866 : u32; + +var v867 : u32; + +var v868 : u32; + +var v869 : u32; + +var v870 : u32; + +var v871 : u32; + +var v872 : u32; + +var v873 : u32; + +var v874 : u32; + +var v875 : u32; + +var v876 : u32; + +var v877 : u32; + +var v878 : u32; + +var v879 : u32; + +var v880 : u32; + +var v881 : u32; + +var v882 : u32; + +var v883 : u32; + +var v884 : u32; + +var v885 : u32; + +var v886 : u32; + +var v887 : u32; + +var v888 : u32; + +var v889 : u32; + +var v890 : u32; + +var v891 : u32; + +var v892 : u32; + +var v893 : u32; + +var v894 : u32; + +var v895 : u32; + +var v896 : u32; + +var v897 : u32; + +var v898 : u32; + +var v899 : u32; + +var v900 : u32; + +var v901 : u32; + +var v902 : u32; + +var v903 : u32; + +var v904 : u32; + +var v905 : u32; + +var v906 : u32; + +var v907 : u32; + +var v908 : u32; + +var v909 : u32; + +var v910 : u32; + +var v911 : u32; + +var v912 : u32; + +var v913 : u32; + +var v914 : u32; + +var v915 : u32; + +var v916 : u32; + +var v917 : u32; + +var v918 : u32; + +var v919 : u32; + +var v920 : u32; + +var v921 : u32; + +var v922 : u32; + +var v923 : u32; + +var v924 : u32; + +var v925 : u32; + +var v926 : u32; + +var v927 : u32; + +var v928 : u32; + +var v929 : u32; + +var v930 : u32; + +var v931 : u32; + +var v932 : u32; + +var v933 : u32; + +var v934 : u32; + +var v935 : u32; + +var v936 : u32; + +var v937 : u32; + +var v938 : u32; + +var v939 : u32; + +var v940 : u32; + +var v941 : u32; + +var v942 : u32; + +var v943 : u32; + +var v944 : u32; + +var v945 : u32; + +var v946 : u32; + +var v947 : u32; + +var v948 : u32; + +var v949 : u32; + +var v950 : u32; + +var v951 : u32; + +var v952 : u32; + +var v953 : u32; + +var v954 : u32; + +var v955 : u32; + +var v956 : u32; + +var v957 : u32; + +var v958 : u32; + +var v959 : u32; + +var v960 : u32; + +var v961 : u32; + +var v962 : u32; + +var v963 : u32; + +var v964 : u32; + +var v965 : u32; + +var v966 : u32; + +var v967 : u32; + +var v968 : u32; + +var v969 : u32; + +var v970 : u32; + +var v971 : u32; + +var v972 : u32; + +var v973 : u32; + +var v974 : u32; + +var v975 : u32; + +var v976 : u32; + +var v977 : u32; + +var v978 : u32; + +var v979 : u32; + +var v980 : u32; + +var v981 : u32; + +var v982 : u32; + +var v983 : u32; + +var v984 : u32; + +var v985 : u32; + +var v986 : u32; + +var v987 : u32; + +var v988 : u32; + +var v989 : u32; + +var v990 : u32; + +var v991 : u32; + +var v992 : u32; + +var v993 : u32; + +var v994 : u32; + +var v995 : u32; + +var v996 : u32; + +var v997 : u32; + +var v998 : u32; + +var v999 : u32; + +fn foo() -> u32 { + var x = 0u; + x += v0; + x += v1; + x += v2; + x += v3; + x += v4; + x += v5; + x += v6; + x += v7; + x += v8; + x += v9; + x += v10; + x += v11; + x += v12; + x += v13; + x += v14; + x += v15; + x += v16; + x += v17; + x += v18; + x += v19; + x += v20; + x += v21; + x += v22; + x += v23; + x += v24; + x += v25; + x += v26; + x += v27; + x += v28; + x += v29; + x += v30; + x += v31; + x += v32; + x += v33; + x += v34; + x += v35; + x += v36; + x += v37; + x += v38; + x += v39; + x += v40; + x += v41; + x += v42; + x += v43; + x += v44; + x += v45; + x += v46; + x += v47; + x += v48; + x += v49; + x += v50; + x += v51; + x += v52; + x += v53; + x += v54; + x += v55; + x += v56; + x += v57; + x += v58; + x += v59; + x += v60; + x += v61; + x += v62; + x += v63; + x += v64; + x += v65; + x += v66; + x += v67; + x += v68; + x += v69; + x += v70; + x += v71; + x += v72; + x += v73; + x += v74; + x += v75; + x += v76; + x += v77; + x += v78; + x += v79; + x += v80; + x += v81; + x += v82; + x += v83; + x += v84; + x += v85; + x += v86; + x += v87; + x += v88; + x += v89; + x += v90; + x += v91; + x += v92; + x += v93; + x += v94; + x += v95; + x += v96; + x += v97; + x += v98; + x += v99; + x += v100; + x += v101; + x += v102; + x += v103; + x += v104; + x += v105; + x += v106; + x += v107; + x += v108; + x += v109; + x += v110; + x += v111; + x += v112; + x += v113; + x += v114; + x += v115; + x += v116; + x += v117; + x += v118; + x += v119; + x += v120; + x += v121; + x += v122; + x += v123; + x += v124; + x += v125; + x += v126; + x += v127; + x += v128; + x += v129; + x += v130; + x += v131; + x += v132; + x += v133; + x += v134; + x += v135; + x += v136; + x += v137; + x += v138; + x += v139; + x += v140; + x += v141; + x += v142; + x += v143; + x += v144; + x += v145; + x += v146; + x += v147; + x += v148; + x += v149; + x += v150; + x += v151; + x += v152; + x += v153; + x += v154; + x += v155; + x += v156; + x += v157; + x += v158; + x += v159; + x += v160; + x += v161; + x += v162; + x += v163; + x += v164; + x += v165; + x += v166; + x += v167; + x += v168; + x += v169; + x += v170; + x += v171; + x += v172; + x += v173; + x += v174; + x += v175; + x += v176; + x += v177; + x += v178; + x += v179; + x += v180; + x += v181; + x += v182; + x += v183; + x += v184; + x += v185; + x += v186; + x += v187; + x += v188; + x += v189; + x += v190; + x += v191; + x += v192; + x += v193; + x += v194; + x += v195; + x += v196; + x += v197; + x += v198; + x += v199; + x += v200; + x += v201; + x += v202; + x += v203; + x += v204; + x += v205; + x += v206; + x += v207; + x += v208; + x += v209; + x += v210; + x += v211; + x += v212; + x += v213; + x += v214; + x += v215; + x += v216; + x += v217; + x += v218; + x += v219; + x += v220; + x += v221; + x += v222; + x += v223; + x += v224; + x += v225; + x += v226; + x += v227; + x += v228; + x += v229; + x += v230; + x += v231; + x += v232; + x += v233; + x += v234; + x += v235; + x += v236; + x += v237; + x += v238; + x += v239; + x += v240; + x += v241; + x += v242; + x += v243; + x += v244; + x += v245; + x += v246; + x += v247; + x += v248; + x += v249; + x += v250; + x += v251; + x += v252; + x += v253; + x += v254; + x += v255; + x += v256; + x += v257; + x += v258; + x += v259; + x += v260; + x += v261; + x += v262; + x += v263; + x += v264; + x += v265; + x += v266; + x += v267; + x += v268; + x += v269; + x += v270; + x += v271; + x += v272; + x += v273; + x += v274; + x += v275; + x += v276; + x += v277; + x += v278; + x += v279; + x += v280; + x += v281; + x += v282; + x += v283; + x += v284; + x += v285; + x += v286; + x += v287; + x += v288; + x += v289; + x += v290; + x += v291; + x += v292; + x += v293; + x += v294; + x += v295; + x += v296; + x += v297; + x += v298; + x += v299; + x += v300; + x += v301; + x += v302; + x += v303; + x += v304; + x += v305; + x += v306; + x += v307; + x += v308; + x += v309; + x += v310; + x += v311; + x += v312; + x += v313; + x += v314; + x += v315; + x += v316; + x += v317; + x += v318; + x += v319; + x += v320; + x += v321; + x += v322; + x += v323; + x += v324; + x += v325; + x += v326; + x += v327; + x += v328; + x += v329; + x += v330; + x += v331; + x += v332; + x += v333; + x += v334; + x += v335; + x += v336; + x += v337; + x += v338; + x += v339; + x += v340; + x += v341; + x += v342; + x += v343; + x += v344; + x += v345; + x += v346; + x += v347; + x += v348; + x += v349; + x += v350; + x += v351; + x += v352; + x += v353; + x += v354; + x += v355; + x += v356; + x += v357; + x += v358; + x += v359; + x += v360; + x += v361; + x += v362; + x += v363; + x += v364; + x += v365; + x += v366; + x += v367; + x += v368; + x += v369; + x += v370; + x += v371; + x += v372; + x += v373; + x += v374; + x += v375; + x += v376; + x += v377; + x += v378; + x += v379; + x += v380; + x += v381; + x += v382; + x += v383; + x += v384; + x += v385; + x += v386; + x += v387; + x += v388; + x += v389; + x += v390; + x += v391; + x += v392; + x += v393; + x += v394; + x += v395; + x += v396; + x += v397; + x += v398; + x += v399; + x += v400; + x += v401; + x += v402; + x += v403; + x += v404; + x += v405; + x += v406; + x += v407; + x += v408; + x += v409; + x += v410; + x += v411; + x += v412; + x += v413; + x += v414; + x += v415; + x += v416; + x += v417; + x += v418; + x += v419; + x += v420; + x += v421; + x += v422; + x += v423; + x += v424; + x += v425; + x += v426; + x += v427; + x += v428; + x += v429; + x += v430; + x += v431; + x += v432; + x += v433; + x += v434; + x += v435; + x += v436; + x += v437; + x += v438; + x += v439; + x += v440; + x += v441; + x += v442; + x += v443; + x += v444; + x += v445; + x += v446; + x += v447; + x += v448; + x += v449; + x += v450; + x += v451; + x += v452; + x += v453; + x += v454; + x += v455; + x += v456; + x += v457; + x += v458; + x += v459; + x += v460; + x += v461; + x += v462; + x += v463; + x += v464; + x += v465; + x += v466; + x += v467; + x += v468; + x += v469; + x += v470; + x += v471; + x += v472; + x += v473; + x += v474; + x += v475; + x += v476; + x += v477; + x += v478; + x += v479; + x += v480; + x += v481; + x += v482; + x += v483; + x += v484; + x += v485; + x += v486; + x += v487; + x += v488; + x += v489; + x += v490; + x += v491; + x += v492; + x += v493; + x += v494; + x += v495; + x += v496; + x += v497; + x += v498; + x += v499; + x += v500; + x += v501; + x += v502; + x += v503; + x += v504; + x += v505; + x += v506; + x += v507; + x += v508; + x += v509; + x += v510; + x += v511; + x += v512; + x += v513; + x += v514; + x += v515; + x += v516; + x += v517; + x += v518; + x += v519; + x += v520; + x += v521; + x += v522; + x += v523; + x += v524; + x += v525; + x += v526; + x += v527; + x += v528; + x += v529; + x += v530; + x += v531; + x += v532; + x += v533; + x += v534; + x += v535; + x += v536; + x += v537; + x += v538; + x += v539; + x += v540; + x += v541; + x += v542; + x += v543; + x += v544; + x += v545; + x += v546; + x += v547; + x += v548; + x += v549; + x += v550; + x += v551; + x += v552; + x += v553; + x += v554; + x += v555; + x += v556; + x += v557; + x += v558; + x += v559; + x += v560; + x += v561; + x += v562; + x += v563; + x += v564; + x += v565; + x += v566; + x += v567; + x += v568; + x += v569; + x += v570; + x += v571; + x += v572; + x += v573; + x += v574; + x += v575; + x += v576; + x += v577; + x += v578; + x += v579; + x += v580; + x += v581; + x += v582; + x += v583; + x += v584; + x += v585; + x += v586; + x += v587; + x += v588; + x += v589; + x += v590; + x += v591; + x += v592; + x += v593; + x += v594; + x += v595; + x += v596; + x += v597; + x += v598; + x += v599; + x += v600; + x += v601; + x += v602; + x += v603; + x += v604; + x += v605; + x += v606; + x += v607; + x += v608; + x += v609; + x += v610; + x += v611; + x += v612; + x += v613; + x += v614; + x += v615; + x += v616; + x += v617; + x += v618; + x += v619; + x += v620; + x += v621; + x += v622; + x += v623; + x += v624; + x += v625; + x += v626; + x += v627; + x += v628; + x += v629; + x += v630; + x += v631; + x += v632; + x += v633; + x += v634; + x += v635; + x += v636; + x += v637; + x += v638; + x += v639; + x += v640; + x += v641; + x += v642; + x += v643; + x += v644; + x += v645; + x += v646; + x += v647; + x += v648; + x += v649; + x += v650; + x += v651; + x += v652; + x += v653; + x += v654; + x += v655; + x += v656; + x += v657; + x += v658; + x += v659; + x += v660; + x += v661; + x += v662; + x += v663; + x += v664; + x += v665; + x += v666; + x += v667; + x += v668; + x += v669; + x += v670; + x += v671; + x += v672; + x += v673; + x += v674; + x += v675; + x += v676; + x += v677; + x += v678; + x += v679; + x += v680; + x += v681; + x += v682; + x += v683; + x += v684; + x += v685; + x += v686; + x += v687; + x += v688; + x += v689; + x += v690; + x += v691; + x += v692; + x += v693; + x += v694; + x += v695; + x += v696; + x += v697; + x += v698; + x += v699; + x += v700; + x += v701; + x += v702; + x += v703; + x += v704; + x += v705; + x += v706; + x += v707; + x += v708; + x += v709; + x += v710; + x += v711; + x += v712; + x += v713; + x += v714; + x += v715; + x += v716; + x += v717; + x += v718; + x += v719; + x += v720; + x += v721; + x += v722; + x += v723; + x += v724; + x += v725; + x += v726; + x += v727; + x += v728; + x += v729; + x += v730; + x += v731; + x += v732; + x += v733; + x += v734; + x += v735; + x += v736; + x += v737; + x += v738; + x += v739; + x += v740; + x += v741; + x += v742; + x += v743; + x += v744; + x += v745; + x += v746; + x += v747; + x += v748; + x += v749; + x += v750; + x += v751; + x += v752; + x += v753; + x += v754; + x += v755; + x += v756; + x += v757; + x += v758; + x += v759; + x += v760; + x += v761; + x += v762; + x += v763; + x += v764; + x += v765; + x += v766; + x += v767; + x += v768; + x += v769; + x += v770; + x += v771; + x += v772; + x += v773; + x += v774; + x += v775; + x += v776; + x += v777; + x += v778; + x += v779; + x += v780; + x += v781; + x += v782; + x += v783; + x += v784; + x += v785; + x += v786; + x += v787; + x += v788; + x += v789; + x += v790; + x += v791; + x += v792; + x += v793; + x += v794; + x += v795; + x += v796; + x += v797; + x += v798; + x += v799; + x += v800; + x += v801; + x += v802; + x += v803; + x += v804; + x += v805; + x += v806; + x += v807; + x += v808; + x += v809; + x += v810; + x += v811; + x += v812; + x += v813; + x += v814; + x += v815; + x += v816; + x += v817; + x += v818; + x += v819; + x += v820; + x += v821; + x += v822; + x += v823; + x += v824; + x += v825; + x += v826; + x += v827; + x += v828; + x += v829; + x += v830; + x += v831; + x += v832; + x += v833; + x += v834; + x += v835; + x += v836; + x += v837; + x += v838; + x += v839; + x += v840; + x += v841; + x += v842; + x += v843; + x += v844; + x += v845; + x += v846; + x += v847; + x += v848; + x += v849; + x += v850; + x += v851; + x += v852; + x += v853; + x += v854; + x += v855; + x += v856; + x += v857; + x += v858; + x += v859; + x += v860; + x += v861; + x += v862; + x += v863; + x += v864; + x += v865; + x += v866; + x += v867; + x += v868; + x += v869; + x += v870; + x += v871; + x += v872; + x += v873; + x += v874; + x += v875; + x += v876; + x += v877; + x += v878; + x += v879; + x += v880; + x += v881; + x += v882; + x += v883; + x += v884; + x += v885; + x += v886; + x += v887; + x += v888; + x += v889; + x += v890; + x += v891; + x += v892; + x += v893; + x += v894; + x += v895; + x += v896; + x += v897; + x += v898; + x += v899; + x += v900; + x += v901; + x += v902; + x += v903; + x += v904; + x += v905; + x += v906; + x += v907; + x += v908; + x += v909; + x += v910; + x += v911; + x += v912; + x += v913; + x += v914; + x += v915; + x += v916; + x += v917; + x += v918; + x += v919; + x += v920; + x += v921; + x += v922; + x += v923; + x += v924; + x += v925; + x += v926; + x += v927; + x += v928; + x += v929; + x += v930; + x += v931; + x += v932; + x += v933; + x += v934; + x += v935; + x += v936; + x += v937; + x += v938; + x += v939; + x += v940; + x += v941; + x += v942; + x += v943; + x += v944; + x += v945; + x += v946; + x += v947; + x += v948; + x += v949; + x += v950; + x += v951; + x += v952; + x += v953; + x += v954; + x += v955; + x += v956; + x += v957; + x += v958; + x += v959; + x += v960; + x += v961; + x += v962; + x += v963; + x += v964; + x += v965; + x += v966; + x += v967; + x += v968; + x += v969; + x += v970; + x += v971; + x += v972; + x += v973; + x += v974; + x += v975; + x += v976; + x += v977; + x += v978; + x += v979; + x += v980; + x += v981; + x += v982; + x += v983; + x += v984; + x += v985; + x += v986; + x += v987; + x += v988; + x += v989; + x += v990; + x += v991; + x += v992; + x += v993; + x += v994; + x += v995; + x += v996; + x += v997; + x += v998; + x += v999; + return x; +} + +@fragment +fn main() -> @location(0) u32 { + return foo(); +} diff --git a/test/tint/bug/tint/1509.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1509.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f03ad7ccf --- /dev/null +++ b/test/tint/bug/tint/1509.wgsl.expected.dxc.hlsl @@ -0,0 +1,2020 @@ +static uint v0 = 0u; +static uint v1 = 0u; +static uint v2 = 0u; +static uint v3 = 0u; +static uint v4 = 0u; +static uint v5 = 0u; +static uint v6 = 0u; +static uint v7 = 0u; +static uint v8 = 0u; +static uint v9 = 0u; +static uint v10 = 0u; +static uint v11 = 0u; +static uint v12 = 0u; +static uint v13 = 0u; +static uint v14 = 0u; +static uint v15 = 0u; +static uint v16 = 0u; +static uint v17 = 0u; +static uint v18 = 0u; +static uint v19 = 0u; +static uint v20 = 0u; +static uint v21 = 0u; +static uint v22 = 0u; +static uint v23 = 0u; +static uint v24 = 0u; +static uint v25 = 0u; +static uint v26 = 0u; +static uint v27 = 0u; +static uint v28 = 0u; +static uint v29 = 0u; +static uint v30 = 0u; +static uint v31 = 0u; +static uint v32 = 0u; +static uint v33 = 0u; +static uint v34 = 0u; +static uint v35 = 0u; +static uint v36 = 0u; +static uint v37 = 0u; +static uint v38 = 0u; +static uint v39 = 0u; +static uint v40 = 0u; +static uint v41 = 0u; +static uint v42 = 0u; +static uint v43 = 0u; +static uint v44 = 0u; +static uint v45 = 0u; +static uint v46 = 0u; +static uint v47 = 0u; +static uint v48 = 0u; +static uint v49 = 0u; +static uint v50 = 0u; +static uint v51 = 0u; +static uint v52 = 0u; +static uint v53 = 0u; +static uint v54 = 0u; +static uint v55 = 0u; +static uint v56 = 0u; +static uint v57 = 0u; +static uint v58 = 0u; +static uint v59 = 0u; +static uint v60 = 0u; +static uint v61 = 0u; +static uint v62 = 0u; +static uint v63 = 0u; +static uint v64 = 0u; +static uint v65 = 0u; +static uint v66 = 0u; +static uint v67 = 0u; +static uint v68 = 0u; +static uint v69 = 0u; +static uint v70 = 0u; +static uint v71 = 0u; +static uint v72 = 0u; +static uint v73 = 0u; +static uint v74 = 0u; +static uint v75 = 0u; +static uint v76 = 0u; +static uint v77 = 0u; +static uint v78 = 0u; +static uint v79 = 0u; +static uint v80 = 0u; +static uint v81 = 0u; +static uint v82 = 0u; +static uint v83 = 0u; +static uint v84 = 0u; +static uint v85 = 0u; +static uint v86 = 0u; +static uint v87 = 0u; +static uint v88 = 0u; +static uint v89 = 0u; +static uint v90 = 0u; +static uint v91 = 0u; +static uint v92 = 0u; +static uint v93 = 0u; +static uint v94 = 0u; +static uint v95 = 0u; +static uint v96 = 0u; +static uint v97 = 0u; +static uint v98 = 0u; +static uint v99 = 0u; +static uint v100 = 0u; +static uint v101 = 0u; +static uint v102 = 0u; +static uint v103 = 0u; +static uint v104 = 0u; +static uint v105 = 0u; +static uint v106 = 0u; +static uint v107 = 0u; +static uint v108 = 0u; +static uint v109 = 0u; +static uint v110 = 0u; +static uint v111 = 0u; +static uint v112 = 0u; +static uint v113 = 0u; +static uint v114 = 0u; +static uint v115 = 0u; +static uint v116 = 0u; +static uint v117 = 0u; +static uint v118 = 0u; +static uint v119 = 0u; +static uint v120 = 0u; +static uint v121 = 0u; +static uint v122 = 0u; +static uint v123 = 0u; +static uint v124 = 0u; +static uint v125 = 0u; +static uint v126 = 0u; +static uint v127 = 0u; +static uint v128 = 0u; +static uint v129 = 0u; +static uint v130 = 0u; +static uint v131 = 0u; +static uint v132 = 0u; +static uint v133 = 0u; +static uint v134 = 0u; +static uint v135 = 0u; +static uint v136 = 0u; +static uint v137 = 0u; +static uint v138 = 0u; +static uint v139 = 0u; +static uint v140 = 0u; +static uint v141 = 0u; +static uint v142 = 0u; +static uint v143 = 0u; +static uint v144 = 0u; +static uint v145 = 0u; +static uint v146 = 0u; +static uint v147 = 0u; +static uint v148 = 0u; +static uint v149 = 0u; +static uint v150 = 0u; +static uint v151 = 0u; +static uint v152 = 0u; +static uint v153 = 0u; +static uint v154 = 0u; +static uint v155 = 0u; +static uint v156 = 0u; +static uint v157 = 0u; +static uint v158 = 0u; +static uint v159 = 0u; +static uint v160 = 0u; +static uint v161 = 0u; +static uint v162 = 0u; +static uint v163 = 0u; +static uint v164 = 0u; +static uint v165 = 0u; +static uint v166 = 0u; +static uint v167 = 0u; +static uint v168 = 0u; +static uint v169 = 0u; +static uint v170 = 0u; +static uint v171 = 0u; +static uint v172 = 0u; +static uint v173 = 0u; +static uint v174 = 0u; +static uint v175 = 0u; +static uint v176 = 0u; +static uint v177 = 0u; +static uint v178 = 0u; +static uint v179 = 0u; +static uint v180 = 0u; +static uint v181 = 0u; +static uint v182 = 0u; +static uint v183 = 0u; +static uint v184 = 0u; +static uint v185 = 0u; +static uint v186 = 0u; +static uint v187 = 0u; +static uint v188 = 0u; +static uint v189 = 0u; +static uint v190 = 0u; +static uint v191 = 0u; +static uint v192 = 0u; +static uint v193 = 0u; +static uint v194 = 0u; +static uint v195 = 0u; +static uint v196 = 0u; +static uint v197 = 0u; +static uint v198 = 0u; +static uint v199 = 0u; +static uint v200 = 0u; +static uint v201 = 0u; +static uint v202 = 0u; +static uint v203 = 0u; +static uint v204 = 0u; +static uint v205 = 0u; +static uint v206 = 0u; +static uint v207 = 0u; +static uint v208 = 0u; +static uint v209 = 0u; +static uint v210 = 0u; +static uint v211 = 0u; +static uint v212 = 0u; +static uint v213 = 0u; +static uint v214 = 0u; +static uint v215 = 0u; +static uint v216 = 0u; +static uint v217 = 0u; +static uint v218 = 0u; +static uint v219 = 0u; +static uint v220 = 0u; +static uint v221 = 0u; +static uint v222 = 0u; +static uint v223 = 0u; +static uint v224 = 0u; +static uint v225 = 0u; +static uint v226 = 0u; +static uint v227 = 0u; +static uint v228 = 0u; +static uint v229 = 0u; +static uint v230 = 0u; +static uint v231 = 0u; +static uint v232 = 0u; +static uint v233 = 0u; +static uint v234 = 0u; +static uint v235 = 0u; +static uint v236 = 0u; +static uint v237 = 0u; +static uint v238 = 0u; +static uint v239 = 0u; +static uint v240 = 0u; +static uint v241 = 0u; +static uint v242 = 0u; +static uint v243 = 0u; +static uint v244 = 0u; +static uint v245 = 0u; +static uint v246 = 0u; +static uint v247 = 0u; +static uint v248 = 0u; +static uint v249 = 0u; +static uint v250 = 0u; +static uint v251 = 0u; +static uint v252 = 0u; +static uint v253 = 0u; +static uint v254 = 0u; +static uint v255 = 0u; +static uint v256 = 0u; +static uint v257 = 0u; +static uint v258 = 0u; +static uint v259 = 0u; +static uint v260 = 0u; +static uint v261 = 0u; +static uint v262 = 0u; +static uint v263 = 0u; +static uint v264 = 0u; +static uint v265 = 0u; +static uint v266 = 0u; +static uint v267 = 0u; +static uint v268 = 0u; +static uint v269 = 0u; +static uint v270 = 0u; +static uint v271 = 0u; +static uint v272 = 0u; +static uint v273 = 0u; +static uint v274 = 0u; +static uint v275 = 0u; +static uint v276 = 0u; +static uint v277 = 0u; +static uint v278 = 0u; +static uint v279 = 0u; +static uint v280 = 0u; +static uint v281 = 0u; +static uint v282 = 0u; +static uint v283 = 0u; +static uint v284 = 0u; +static uint v285 = 0u; +static uint v286 = 0u; +static uint v287 = 0u; +static uint v288 = 0u; +static uint v289 = 0u; +static uint v290 = 0u; +static uint v291 = 0u; +static uint v292 = 0u; +static uint v293 = 0u; +static uint v294 = 0u; +static uint v295 = 0u; +static uint v296 = 0u; +static uint v297 = 0u; +static uint v298 = 0u; +static uint v299 = 0u; +static uint v300 = 0u; +static uint v301 = 0u; +static uint v302 = 0u; +static uint v303 = 0u; +static uint v304 = 0u; +static uint v305 = 0u; +static uint v306 = 0u; +static uint v307 = 0u; +static uint v308 = 0u; +static uint v309 = 0u; +static uint v310 = 0u; +static uint v311 = 0u; +static uint v312 = 0u; +static uint v313 = 0u; +static uint v314 = 0u; +static uint v315 = 0u; +static uint v316 = 0u; +static uint v317 = 0u; +static uint v318 = 0u; +static uint v319 = 0u; +static uint v320 = 0u; +static uint v321 = 0u; +static uint v322 = 0u; +static uint v323 = 0u; +static uint v324 = 0u; +static uint v325 = 0u; +static uint v326 = 0u; +static uint v327 = 0u; +static uint v328 = 0u; +static uint v329 = 0u; +static uint v330 = 0u; +static uint v331 = 0u; +static uint v332 = 0u; +static uint v333 = 0u; +static uint v334 = 0u; +static uint v335 = 0u; +static uint v336 = 0u; +static uint v337 = 0u; +static uint v338 = 0u; +static uint v339 = 0u; +static uint v340 = 0u; +static uint v341 = 0u; +static uint v342 = 0u; +static uint v343 = 0u; +static uint v344 = 0u; +static uint v345 = 0u; +static uint v346 = 0u; +static uint v347 = 0u; +static uint v348 = 0u; +static uint v349 = 0u; +static uint v350 = 0u; +static uint v351 = 0u; +static uint v352 = 0u; +static uint v353 = 0u; +static uint v354 = 0u; +static uint v355 = 0u; +static uint v356 = 0u; +static uint v357 = 0u; +static uint v358 = 0u; +static uint v359 = 0u; +static uint v360 = 0u; +static uint v361 = 0u; +static uint v362 = 0u; +static uint v363 = 0u; +static uint v364 = 0u; +static uint v365 = 0u; +static uint v366 = 0u; +static uint v367 = 0u; +static uint v368 = 0u; +static uint v369 = 0u; +static uint v370 = 0u; +static uint v371 = 0u; +static uint v372 = 0u; +static uint v373 = 0u; +static uint v374 = 0u; +static uint v375 = 0u; +static uint v376 = 0u; +static uint v377 = 0u; +static uint v378 = 0u; +static uint v379 = 0u; +static uint v380 = 0u; +static uint v381 = 0u; +static uint v382 = 0u; +static uint v383 = 0u; +static uint v384 = 0u; +static uint v385 = 0u; +static uint v386 = 0u; +static uint v387 = 0u; +static uint v388 = 0u; +static uint v389 = 0u; +static uint v390 = 0u; +static uint v391 = 0u; +static uint v392 = 0u; +static uint v393 = 0u; +static uint v394 = 0u; +static uint v395 = 0u; +static uint v396 = 0u; +static uint v397 = 0u; +static uint v398 = 0u; +static uint v399 = 0u; +static uint v400 = 0u; +static uint v401 = 0u; +static uint v402 = 0u; +static uint v403 = 0u; +static uint v404 = 0u; +static uint v405 = 0u; +static uint v406 = 0u; +static uint v407 = 0u; +static uint v408 = 0u; +static uint v409 = 0u; +static uint v410 = 0u; +static uint v411 = 0u; +static uint v412 = 0u; +static uint v413 = 0u; +static uint v414 = 0u; +static uint v415 = 0u; +static uint v416 = 0u; +static uint v417 = 0u; +static uint v418 = 0u; +static uint v419 = 0u; +static uint v420 = 0u; +static uint v421 = 0u; +static uint v422 = 0u; +static uint v423 = 0u; +static uint v424 = 0u; +static uint v425 = 0u; +static uint v426 = 0u; +static uint v427 = 0u; +static uint v428 = 0u; +static uint v429 = 0u; +static uint v430 = 0u; +static uint v431 = 0u; +static uint v432 = 0u; +static uint v433 = 0u; +static uint v434 = 0u; +static uint v435 = 0u; +static uint v436 = 0u; +static uint v437 = 0u; +static uint v438 = 0u; +static uint v439 = 0u; +static uint v440 = 0u; +static uint v441 = 0u; +static uint v442 = 0u; +static uint v443 = 0u; +static uint v444 = 0u; +static uint v445 = 0u; +static uint v446 = 0u; +static uint v447 = 0u; +static uint v448 = 0u; +static uint v449 = 0u; +static uint v450 = 0u; +static uint v451 = 0u; +static uint v452 = 0u; +static uint v453 = 0u; +static uint v454 = 0u; +static uint v455 = 0u; +static uint v456 = 0u; +static uint v457 = 0u; +static uint v458 = 0u; +static uint v459 = 0u; +static uint v460 = 0u; +static uint v461 = 0u; +static uint v462 = 0u; +static uint v463 = 0u; +static uint v464 = 0u; +static uint v465 = 0u; +static uint v466 = 0u; +static uint v467 = 0u; +static uint v468 = 0u; +static uint v469 = 0u; +static uint v470 = 0u; +static uint v471 = 0u; +static uint v472 = 0u; +static uint v473 = 0u; +static uint v474 = 0u; +static uint v475 = 0u; +static uint v476 = 0u; +static uint v477 = 0u; +static uint v478 = 0u; +static uint v479 = 0u; +static uint v480 = 0u; +static uint v481 = 0u; +static uint v482 = 0u; +static uint v483 = 0u; +static uint v484 = 0u; +static uint v485 = 0u; +static uint v486 = 0u; +static uint v487 = 0u; +static uint v488 = 0u; +static uint v489 = 0u; +static uint v490 = 0u; +static uint v491 = 0u; +static uint v492 = 0u; +static uint v493 = 0u; +static uint v494 = 0u; +static uint v495 = 0u; +static uint v496 = 0u; +static uint v497 = 0u; +static uint v498 = 0u; +static uint v499 = 0u; +static uint v500 = 0u; +static uint v501 = 0u; +static uint v502 = 0u; +static uint v503 = 0u; +static uint v504 = 0u; +static uint v505 = 0u; +static uint v506 = 0u; +static uint v507 = 0u; +static uint v508 = 0u; +static uint v509 = 0u; +static uint v510 = 0u; +static uint v511 = 0u; +static uint v512 = 0u; +static uint v513 = 0u; +static uint v514 = 0u; +static uint v515 = 0u; +static uint v516 = 0u; +static uint v517 = 0u; +static uint v518 = 0u; +static uint v519 = 0u; +static uint v520 = 0u; +static uint v521 = 0u; +static uint v522 = 0u; +static uint v523 = 0u; +static uint v524 = 0u; +static uint v525 = 0u; +static uint v526 = 0u; +static uint v527 = 0u; +static uint v528 = 0u; +static uint v529 = 0u; +static uint v530 = 0u; +static uint v531 = 0u; +static uint v532 = 0u; +static uint v533 = 0u; +static uint v534 = 0u; +static uint v535 = 0u; +static uint v536 = 0u; +static uint v537 = 0u; +static uint v538 = 0u; +static uint v539 = 0u; +static uint v540 = 0u; +static uint v541 = 0u; +static uint v542 = 0u; +static uint v543 = 0u; +static uint v544 = 0u; +static uint v545 = 0u; +static uint v546 = 0u; +static uint v547 = 0u; +static uint v548 = 0u; +static uint v549 = 0u; +static uint v550 = 0u; +static uint v551 = 0u; +static uint v552 = 0u; +static uint v553 = 0u; +static uint v554 = 0u; +static uint v555 = 0u; +static uint v556 = 0u; +static uint v557 = 0u; +static uint v558 = 0u; +static uint v559 = 0u; +static uint v560 = 0u; +static uint v561 = 0u; +static uint v562 = 0u; +static uint v563 = 0u; +static uint v564 = 0u; +static uint v565 = 0u; +static uint v566 = 0u; +static uint v567 = 0u; +static uint v568 = 0u; +static uint v569 = 0u; +static uint v570 = 0u; +static uint v571 = 0u; +static uint v572 = 0u; +static uint v573 = 0u; +static uint v574 = 0u; +static uint v575 = 0u; +static uint v576 = 0u; +static uint v577 = 0u; +static uint v578 = 0u; +static uint v579 = 0u; +static uint v580 = 0u; +static uint v581 = 0u; +static uint v582 = 0u; +static uint v583 = 0u; +static uint v584 = 0u; +static uint v585 = 0u; +static uint v586 = 0u; +static uint v587 = 0u; +static uint v588 = 0u; +static uint v589 = 0u; +static uint v590 = 0u; +static uint v591 = 0u; +static uint v592 = 0u; +static uint v593 = 0u; +static uint v594 = 0u; +static uint v595 = 0u; +static uint v596 = 0u; +static uint v597 = 0u; +static uint v598 = 0u; +static uint v599 = 0u; +static uint v600 = 0u; +static uint v601 = 0u; +static uint v602 = 0u; +static uint v603 = 0u; +static uint v604 = 0u; +static uint v605 = 0u; +static uint v606 = 0u; +static uint v607 = 0u; +static uint v608 = 0u; +static uint v609 = 0u; +static uint v610 = 0u; +static uint v611 = 0u; +static uint v612 = 0u; +static uint v613 = 0u; +static uint v614 = 0u; +static uint v615 = 0u; +static uint v616 = 0u; +static uint v617 = 0u; +static uint v618 = 0u; +static uint v619 = 0u; +static uint v620 = 0u; +static uint v621 = 0u; +static uint v622 = 0u; +static uint v623 = 0u; +static uint v624 = 0u; +static uint v625 = 0u; +static uint v626 = 0u; +static uint v627 = 0u; +static uint v628 = 0u; +static uint v629 = 0u; +static uint v630 = 0u; +static uint v631 = 0u; +static uint v632 = 0u; +static uint v633 = 0u; +static uint v634 = 0u; +static uint v635 = 0u; +static uint v636 = 0u; +static uint v637 = 0u; +static uint v638 = 0u; +static uint v639 = 0u; +static uint v640 = 0u; +static uint v641 = 0u; +static uint v642 = 0u; +static uint v643 = 0u; +static uint v644 = 0u; +static uint v645 = 0u; +static uint v646 = 0u; +static uint v647 = 0u; +static uint v648 = 0u; +static uint v649 = 0u; +static uint v650 = 0u; +static uint v651 = 0u; +static uint v652 = 0u; +static uint v653 = 0u; +static uint v654 = 0u; +static uint v655 = 0u; +static uint v656 = 0u; +static uint v657 = 0u; +static uint v658 = 0u; +static uint v659 = 0u; +static uint v660 = 0u; +static uint v661 = 0u; +static uint v662 = 0u; +static uint v663 = 0u; +static uint v664 = 0u; +static uint v665 = 0u; +static uint v666 = 0u; +static uint v667 = 0u; +static uint v668 = 0u; +static uint v669 = 0u; +static uint v670 = 0u; +static uint v671 = 0u; +static uint v672 = 0u; +static uint v673 = 0u; +static uint v674 = 0u; +static uint v675 = 0u; +static uint v676 = 0u; +static uint v677 = 0u; +static uint v678 = 0u; +static uint v679 = 0u; +static uint v680 = 0u; +static uint v681 = 0u; +static uint v682 = 0u; +static uint v683 = 0u; +static uint v684 = 0u; +static uint v685 = 0u; +static uint v686 = 0u; +static uint v687 = 0u; +static uint v688 = 0u; +static uint v689 = 0u; +static uint v690 = 0u; +static uint v691 = 0u; +static uint v692 = 0u; +static uint v693 = 0u; +static uint v694 = 0u; +static uint v695 = 0u; +static uint v696 = 0u; +static uint v697 = 0u; +static uint v698 = 0u; +static uint v699 = 0u; +static uint v700 = 0u; +static uint v701 = 0u; +static uint v702 = 0u; +static uint v703 = 0u; +static uint v704 = 0u; +static uint v705 = 0u; +static uint v706 = 0u; +static uint v707 = 0u; +static uint v708 = 0u; +static uint v709 = 0u; +static uint v710 = 0u; +static uint v711 = 0u; +static uint v712 = 0u; +static uint v713 = 0u; +static uint v714 = 0u; +static uint v715 = 0u; +static uint v716 = 0u; +static uint v717 = 0u; +static uint v718 = 0u; +static uint v719 = 0u; +static uint v720 = 0u; +static uint v721 = 0u; +static uint v722 = 0u; +static uint v723 = 0u; +static uint v724 = 0u; +static uint v725 = 0u; +static uint v726 = 0u; +static uint v727 = 0u; +static uint v728 = 0u; +static uint v729 = 0u; +static uint v730 = 0u; +static uint v731 = 0u; +static uint v732 = 0u; +static uint v733 = 0u; +static uint v734 = 0u; +static uint v735 = 0u; +static uint v736 = 0u; +static uint v737 = 0u; +static uint v738 = 0u; +static uint v739 = 0u; +static uint v740 = 0u; +static uint v741 = 0u; +static uint v742 = 0u; +static uint v743 = 0u; +static uint v744 = 0u; +static uint v745 = 0u; +static uint v746 = 0u; +static uint v747 = 0u; +static uint v748 = 0u; +static uint v749 = 0u; +static uint v750 = 0u; +static uint v751 = 0u; +static uint v752 = 0u; +static uint v753 = 0u; +static uint v754 = 0u; +static uint v755 = 0u; +static uint v756 = 0u; +static uint v757 = 0u; +static uint v758 = 0u; +static uint v759 = 0u; +static uint v760 = 0u; +static uint v761 = 0u; +static uint v762 = 0u; +static uint v763 = 0u; +static uint v764 = 0u; +static uint v765 = 0u; +static uint v766 = 0u; +static uint v767 = 0u; +static uint v768 = 0u; +static uint v769 = 0u; +static uint v770 = 0u; +static uint v771 = 0u; +static uint v772 = 0u; +static uint v773 = 0u; +static uint v774 = 0u; +static uint v775 = 0u; +static uint v776 = 0u; +static uint v777 = 0u; +static uint v778 = 0u; +static uint v779 = 0u; +static uint v780 = 0u; +static uint v781 = 0u; +static uint v782 = 0u; +static uint v783 = 0u; +static uint v784 = 0u; +static uint v785 = 0u; +static uint v786 = 0u; +static uint v787 = 0u; +static uint v788 = 0u; +static uint v789 = 0u; +static uint v790 = 0u; +static uint v791 = 0u; +static uint v792 = 0u; +static uint v793 = 0u; +static uint v794 = 0u; +static uint v795 = 0u; +static uint v796 = 0u; +static uint v797 = 0u; +static uint v798 = 0u; +static uint v799 = 0u; +static uint v800 = 0u; +static uint v801 = 0u; +static uint v802 = 0u; +static uint v803 = 0u; +static uint v804 = 0u; +static uint v805 = 0u; +static uint v806 = 0u; +static uint v807 = 0u; +static uint v808 = 0u; +static uint v809 = 0u; +static uint v810 = 0u; +static uint v811 = 0u; +static uint v812 = 0u; +static uint v813 = 0u; +static uint v814 = 0u; +static uint v815 = 0u; +static uint v816 = 0u; +static uint v817 = 0u; +static uint v818 = 0u; +static uint v819 = 0u; +static uint v820 = 0u; +static uint v821 = 0u; +static uint v822 = 0u; +static uint v823 = 0u; +static uint v824 = 0u; +static uint v825 = 0u; +static uint v826 = 0u; +static uint v827 = 0u; +static uint v828 = 0u; +static uint v829 = 0u; +static uint v830 = 0u; +static uint v831 = 0u; +static uint v832 = 0u; +static uint v833 = 0u; +static uint v834 = 0u; +static uint v835 = 0u; +static uint v836 = 0u; +static uint v837 = 0u; +static uint v838 = 0u; +static uint v839 = 0u; +static uint v840 = 0u; +static uint v841 = 0u; +static uint v842 = 0u; +static uint v843 = 0u; +static uint v844 = 0u; +static uint v845 = 0u; +static uint v846 = 0u; +static uint v847 = 0u; +static uint v848 = 0u; +static uint v849 = 0u; +static uint v850 = 0u; +static uint v851 = 0u; +static uint v852 = 0u; +static uint v853 = 0u; +static uint v854 = 0u; +static uint v855 = 0u; +static uint v856 = 0u; +static uint v857 = 0u; +static uint v858 = 0u; +static uint v859 = 0u; +static uint v860 = 0u; +static uint v861 = 0u; +static uint v862 = 0u; +static uint v863 = 0u; +static uint v864 = 0u; +static uint v865 = 0u; +static uint v866 = 0u; +static uint v867 = 0u; +static uint v868 = 0u; +static uint v869 = 0u; +static uint v870 = 0u; +static uint v871 = 0u; +static uint v872 = 0u; +static uint v873 = 0u; +static uint v874 = 0u; +static uint v875 = 0u; +static uint v876 = 0u; +static uint v877 = 0u; +static uint v878 = 0u; +static uint v879 = 0u; +static uint v880 = 0u; +static uint v881 = 0u; +static uint v882 = 0u; +static uint v883 = 0u; +static uint v884 = 0u; +static uint v885 = 0u; +static uint v886 = 0u; +static uint v887 = 0u; +static uint v888 = 0u; +static uint v889 = 0u; +static uint v890 = 0u; +static uint v891 = 0u; +static uint v892 = 0u; +static uint v893 = 0u; +static uint v894 = 0u; +static uint v895 = 0u; +static uint v896 = 0u; +static uint v897 = 0u; +static uint v898 = 0u; +static uint v899 = 0u; +static uint v900 = 0u; +static uint v901 = 0u; +static uint v902 = 0u; +static uint v903 = 0u; +static uint v904 = 0u; +static uint v905 = 0u; +static uint v906 = 0u; +static uint v907 = 0u; +static uint v908 = 0u; +static uint v909 = 0u; +static uint v910 = 0u; +static uint v911 = 0u; +static uint v912 = 0u; +static uint v913 = 0u; +static uint v914 = 0u; +static uint v915 = 0u; +static uint v916 = 0u; +static uint v917 = 0u; +static uint v918 = 0u; +static uint v919 = 0u; +static uint v920 = 0u; +static uint v921 = 0u; +static uint v922 = 0u; +static uint v923 = 0u; +static uint v924 = 0u; +static uint v925 = 0u; +static uint v926 = 0u; +static uint v927 = 0u; +static uint v928 = 0u; +static uint v929 = 0u; +static uint v930 = 0u; +static uint v931 = 0u; +static uint v932 = 0u; +static uint v933 = 0u; +static uint v934 = 0u; +static uint v935 = 0u; +static uint v936 = 0u; +static uint v937 = 0u; +static uint v938 = 0u; +static uint v939 = 0u; +static uint v940 = 0u; +static uint v941 = 0u; +static uint v942 = 0u; +static uint v943 = 0u; +static uint v944 = 0u; +static uint v945 = 0u; +static uint v946 = 0u; +static uint v947 = 0u; +static uint v948 = 0u; +static uint v949 = 0u; +static uint v950 = 0u; +static uint v951 = 0u; +static uint v952 = 0u; +static uint v953 = 0u; +static uint v954 = 0u; +static uint v955 = 0u; +static uint v956 = 0u; +static uint v957 = 0u; +static uint v958 = 0u; +static uint v959 = 0u; +static uint v960 = 0u; +static uint v961 = 0u; +static uint v962 = 0u; +static uint v963 = 0u; +static uint v964 = 0u; +static uint v965 = 0u; +static uint v966 = 0u; +static uint v967 = 0u; +static uint v968 = 0u; +static uint v969 = 0u; +static uint v970 = 0u; +static uint v971 = 0u; +static uint v972 = 0u; +static uint v973 = 0u; +static uint v974 = 0u; +static uint v975 = 0u; +static uint v976 = 0u; +static uint v977 = 0u; +static uint v978 = 0u; +static uint v979 = 0u; +static uint v980 = 0u; +static uint v981 = 0u; +static uint v982 = 0u; +static uint v983 = 0u; +static uint v984 = 0u; +static uint v985 = 0u; +static uint v986 = 0u; +static uint v987 = 0u; +static uint v988 = 0u; +static uint v989 = 0u; +static uint v990 = 0u; +static uint v991 = 0u; +static uint v992 = 0u; +static uint v993 = 0u; +static uint v994 = 0u; +static uint v995 = 0u; +static uint v996 = 0u; +static uint v997 = 0u; +static uint v998 = 0u; +static uint v999 = 0u; + +uint foo() { + uint x = 0u; + x = (x + v0); + x = (x + v1); + x = (x + v2); + x = (x + v3); + x = (x + v4); + x = (x + v5); + x = (x + v6); + x = (x + v7); + x = (x + v8); + x = (x + v9); + x = (x + v10); + x = (x + v11); + x = (x + v12); + x = (x + v13); + x = (x + v14); + x = (x + v15); + x = (x + v16); + x = (x + v17); + x = (x + v18); + x = (x + v19); + x = (x + v20); + x = (x + v21); + x = (x + v22); + x = (x + v23); + x = (x + v24); + x = (x + v25); + x = (x + v26); + x = (x + v27); + x = (x + v28); + x = (x + v29); + x = (x + v30); + x = (x + v31); + x = (x + v32); + x = (x + v33); + x = (x + v34); + x = (x + v35); + x = (x + v36); + x = (x + v37); + x = (x + v38); + x = (x + v39); + x = (x + v40); + x = (x + v41); + x = (x + v42); + x = (x + v43); + x = (x + v44); + x = (x + v45); + x = (x + v46); + x = (x + v47); + x = (x + v48); + x = (x + v49); + x = (x + v50); + x = (x + v51); + x = (x + v52); + x = (x + v53); + x = (x + v54); + x = (x + v55); + x = (x + v56); + x = (x + v57); + x = (x + v58); + x = (x + v59); + x = (x + v60); + x = (x + v61); + x = (x + v62); + x = (x + v63); + x = (x + v64); + x = (x + v65); + x = (x + v66); + x = (x + v67); + x = (x + v68); + x = (x + v69); + x = (x + v70); + x = (x + v71); + x = (x + v72); + x = (x + v73); + x = (x + v74); + x = (x + v75); + x = (x + v76); + x = (x + v77); + x = (x + v78); + x = (x + v79); + x = (x + v80); + x = (x + v81); + x = (x + v82); + x = (x + v83); + x = (x + v84); + x = (x + v85); + x = (x + v86); + x = (x + v87); + x = (x + v88); + x = (x + v89); + x = (x + v90); + x = (x + v91); + x = (x + v92); + x = (x + v93); + x = (x + v94); + x = (x + v95); + x = (x + v96); + x = (x + v97); + x = (x + v98); + x = (x + v99); + x = (x + v100); + x = (x + v101); + x = (x + v102); + x = (x + v103); + x = (x + v104); + x = (x + v105); + x = (x + v106); + x = (x + v107); + x = (x + v108); + x = (x + v109); + x = (x + v110); + x = (x + v111); + x = (x + v112); + x = (x + v113); + x = (x + v114); + x = (x + v115); + x = (x + v116); + x = (x + v117); + x = (x + v118); + x = (x + v119); + x = (x + v120); + x = (x + v121); + x = (x + v122); + x = (x + v123); + x = (x + v124); + x = (x + v125); + x = (x + v126); + x = (x + v127); + x = (x + v128); + x = (x + v129); + x = (x + v130); + x = (x + v131); + x = (x + v132); + x = (x + v133); + x = (x + v134); + x = (x + v135); + x = (x + v136); + x = (x + v137); + x = (x + v138); + x = (x + v139); + x = (x + v140); + x = (x + v141); + x = (x + v142); + x = (x + v143); + x = (x + v144); + x = (x + v145); + x = (x + v146); + x = (x + v147); + x = (x + v148); + x = (x + v149); + x = (x + v150); + x = (x + v151); + x = (x + v152); + x = (x + v153); + x = (x + v154); + x = (x + v155); + x = (x + v156); + x = (x + v157); + x = (x + v158); + x = (x + v159); + x = (x + v160); + x = (x + v161); + x = (x + v162); + x = (x + v163); + x = (x + v164); + x = (x + v165); + x = (x + v166); + x = (x + v167); + x = (x + v168); + x = (x + v169); + x = (x + v170); + x = (x + v171); + x = (x + v172); + x = (x + v173); + x = (x + v174); + x = (x + v175); + x = (x + v176); + x = (x + v177); + x = (x + v178); + x = (x + v179); + x = (x + v180); + x = (x + v181); + x = (x + v182); + x = (x + v183); + x = (x + v184); + x = (x + v185); + x = (x + v186); + x = (x + v187); + x = (x + v188); + x = (x + v189); + x = (x + v190); + x = (x + v191); + x = (x + v192); + x = (x + v193); + x = (x + v194); + x = (x + v195); + x = (x + v196); + x = (x + v197); + x = (x + v198); + x = (x + v199); + x = (x + v200); + x = (x + v201); + x = (x + v202); + x = (x + v203); + x = (x + v204); + x = (x + v205); + x = (x + v206); + x = (x + v207); + x = (x + v208); + x = (x + v209); + x = (x + v210); + x = (x + v211); + x = (x + v212); + x = (x + v213); + x = (x + v214); + x = (x + v215); + x = (x + v216); + x = (x + v217); + x = (x + v218); + x = (x + v219); + x = (x + v220); + x = (x + v221); + x = (x + v222); + x = (x + v223); + x = (x + v224); + x = (x + v225); + x = (x + v226); + x = (x + v227); + x = (x + v228); + x = (x + v229); + x = (x + v230); + x = (x + v231); + x = (x + v232); + x = (x + v233); + x = (x + v234); + x = (x + v235); + x = (x + v236); + x = (x + v237); + x = (x + v238); + x = (x + v239); + x = (x + v240); + x = (x + v241); + x = (x + v242); + x = (x + v243); + x = (x + v244); + x = (x + v245); + x = (x + v246); + x = (x + v247); + x = (x + v248); + x = (x + v249); + x = (x + v250); + x = (x + v251); + x = (x + v252); + x = (x + v253); + x = (x + v254); + x = (x + v255); + x = (x + v256); + x = (x + v257); + x = (x + v258); + x = (x + v259); + x = (x + v260); + x = (x + v261); + x = (x + v262); + x = (x + v263); + x = (x + v264); + x = (x + v265); + x = (x + v266); + x = (x + v267); + x = (x + v268); + x = (x + v269); + x = (x + v270); + x = (x + v271); + x = (x + v272); + x = (x + v273); + x = (x + v274); + x = (x + v275); + x = (x + v276); + x = (x + v277); + x = (x + v278); + x = (x + v279); + x = (x + v280); + x = (x + v281); + x = (x + v282); + x = (x + v283); + x = (x + v284); + x = (x + v285); + x = (x + v286); + x = (x + v287); + x = (x + v288); + x = (x + v289); + x = (x + v290); + x = (x + v291); + x = (x + v292); + x = (x + v293); + x = (x + v294); + x = (x + v295); + x = (x + v296); + x = (x + v297); + x = (x + v298); + x = (x + v299); + x = (x + v300); + x = (x + v301); + x = (x + v302); + x = (x + v303); + x = (x + v304); + x = (x + v305); + x = (x + v306); + x = (x + v307); + x = (x + v308); + x = (x + v309); + x = (x + v310); + x = (x + v311); + x = (x + v312); + x = (x + v313); + x = (x + v314); + x = (x + v315); + x = (x + v316); + x = (x + v317); + x = (x + v318); + x = (x + v319); + x = (x + v320); + x = (x + v321); + x = (x + v322); + x = (x + v323); + x = (x + v324); + x = (x + v325); + x = (x + v326); + x = (x + v327); + x = (x + v328); + x = (x + v329); + x = (x + v330); + x = (x + v331); + x = (x + v332); + x = (x + v333); + x = (x + v334); + x = (x + v335); + x = (x + v336); + x = (x + v337); + x = (x + v338); + x = (x + v339); + x = (x + v340); + x = (x + v341); + x = (x + v342); + x = (x + v343); + x = (x + v344); + x = (x + v345); + x = (x + v346); + x = (x + v347); + x = (x + v348); + x = (x + v349); + x = (x + v350); + x = (x + v351); + x = (x + v352); + x = (x + v353); + x = (x + v354); + x = (x + v355); + x = (x + v356); + x = (x + v357); + x = (x + v358); + x = (x + v359); + x = (x + v360); + x = (x + v361); + x = (x + v362); + x = (x + v363); + x = (x + v364); + x = (x + v365); + x = (x + v366); + x = (x + v367); + x = (x + v368); + x = (x + v369); + x = (x + v370); + x = (x + v371); + x = (x + v372); + x = (x + v373); + x = (x + v374); + x = (x + v375); + x = (x + v376); + x = (x + v377); + x = (x + v378); + x = (x + v379); + x = (x + v380); + x = (x + v381); + x = (x + v382); + x = (x + v383); + x = (x + v384); + x = (x + v385); + x = (x + v386); + x = (x + v387); + x = (x + v388); + x = (x + v389); + x = (x + v390); + x = (x + v391); + x = (x + v392); + x = (x + v393); + x = (x + v394); + x = (x + v395); + x = (x + v396); + x = (x + v397); + x = (x + v398); + x = (x + v399); + x = (x + v400); + x = (x + v401); + x = (x + v402); + x = (x + v403); + x = (x + v404); + x = (x + v405); + x = (x + v406); + x = (x + v407); + x = (x + v408); + x = (x + v409); + x = (x + v410); + x = (x + v411); + x = (x + v412); + x = (x + v413); + x = (x + v414); + x = (x + v415); + x = (x + v416); + x = (x + v417); + x = (x + v418); + x = (x + v419); + x = (x + v420); + x = (x + v421); + x = (x + v422); + x = (x + v423); + x = (x + v424); + x = (x + v425); + x = (x + v426); + x = (x + v427); + x = (x + v428); + x = (x + v429); + x = (x + v430); + x = (x + v431); + x = (x + v432); + x = (x + v433); + x = (x + v434); + x = (x + v435); + x = (x + v436); + x = (x + v437); + x = (x + v438); + x = (x + v439); + x = (x + v440); + x = (x + v441); + x = (x + v442); + x = (x + v443); + x = (x + v444); + x = (x + v445); + x = (x + v446); + x = (x + v447); + x = (x + v448); + x = (x + v449); + x = (x + v450); + x = (x + v451); + x = (x + v452); + x = (x + v453); + x = (x + v454); + x = (x + v455); + x = (x + v456); + x = (x + v457); + x = (x + v458); + x = (x + v459); + x = (x + v460); + x = (x + v461); + x = (x + v462); + x = (x + v463); + x = (x + v464); + x = (x + v465); + x = (x + v466); + x = (x + v467); + x = (x + v468); + x = (x + v469); + x = (x + v470); + x = (x + v471); + x = (x + v472); + x = (x + v473); + x = (x + v474); + x = (x + v475); + x = (x + v476); + x = (x + v477); + x = (x + v478); + x = (x + v479); + x = (x + v480); + x = (x + v481); + x = (x + v482); + x = (x + v483); + x = (x + v484); + x = (x + v485); + x = (x + v486); + x = (x + v487); + x = (x + v488); + x = (x + v489); + x = (x + v490); + x = (x + v491); + x = (x + v492); + x = (x + v493); + x = (x + v494); + x = (x + v495); + x = (x + v496); + x = (x + v497); + x = (x + v498); + x = (x + v499); + x = (x + v500); + x = (x + v501); + x = (x + v502); + x = (x + v503); + x = (x + v504); + x = (x + v505); + x = (x + v506); + x = (x + v507); + x = (x + v508); + x = (x + v509); + x = (x + v510); + x = (x + v511); + x = (x + v512); + x = (x + v513); + x = (x + v514); + x = (x + v515); + x = (x + v516); + x = (x + v517); + x = (x + v518); + x = (x + v519); + x = (x + v520); + x = (x + v521); + x = (x + v522); + x = (x + v523); + x = (x + v524); + x = (x + v525); + x = (x + v526); + x = (x + v527); + x = (x + v528); + x = (x + v529); + x = (x + v530); + x = (x + v531); + x = (x + v532); + x = (x + v533); + x = (x + v534); + x = (x + v535); + x = (x + v536); + x = (x + v537); + x = (x + v538); + x = (x + v539); + x = (x + v540); + x = (x + v541); + x = (x + v542); + x = (x + v543); + x = (x + v544); + x = (x + v545); + x = (x + v546); + x = (x + v547); + x = (x + v548); + x = (x + v549); + x = (x + v550); + x = (x + v551); + x = (x + v552); + x = (x + v553); + x = (x + v554); + x = (x + v555); + x = (x + v556); + x = (x + v557); + x = (x + v558); + x = (x + v559); + x = (x + v560); + x = (x + v561); + x = (x + v562); + x = (x + v563); + x = (x + v564); + x = (x + v565); + x = (x + v566); + x = (x + v567); + x = (x + v568); + x = (x + v569); + x = (x + v570); + x = (x + v571); + x = (x + v572); + x = (x + v573); + x = (x + v574); + x = (x + v575); + x = (x + v576); + x = (x + v577); + x = (x + v578); + x = (x + v579); + x = (x + v580); + x = (x + v581); + x = (x + v582); + x = (x + v583); + x = (x + v584); + x = (x + v585); + x = (x + v586); + x = (x + v587); + x = (x + v588); + x = (x + v589); + x = (x + v590); + x = (x + v591); + x = (x + v592); + x = (x + v593); + x = (x + v594); + x = (x + v595); + x = (x + v596); + x = (x + v597); + x = (x + v598); + x = (x + v599); + x = (x + v600); + x = (x + v601); + x = (x + v602); + x = (x + v603); + x = (x + v604); + x = (x + v605); + x = (x + v606); + x = (x + v607); + x = (x + v608); + x = (x + v609); + x = (x + v610); + x = (x + v611); + x = (x + v612); + x = (x + v613); + x = (x + v614); + x = (x + v615); + x = (x + v616); + x = (x + v617); + x = (x + v618); + x = (x + v619); + x = (x + v620); + x = (x + v621); + x = (x + v622); + x = (x + v623); + x = (x + v624); + x = (x + v625); + x = (x + v626); + x = (x + v627); + x = (x + v628); + x = (x + v629); + x = (x + v630); + x = (x + v631); + x = (x + v632); + x = (x + v633); + x = (x + v634); + x = (x + v635); + x = (x + v636); + x = (x + v637); + x = (x + v638); + x = (x + v639); + x = (x + v640); + x = (x + v641); + x = (x + v642); + x = (x + v643); + x = (x + v644); + x = (x + v645); + x = (x + v646); + x = (x + v647); + x = (x + v648); + x = (x + v649); + x = (x + v650); + x = (x + v651); + x = (x + v652); + x = (x + v653); + x = (x + v654); + x = (x + v655); + x = (x + v656); + x = (x + v657); + x = (x + v658); + x = (x + v659); + x = (x + v660); + x = (x + v661); + x = (x + v662); + x = (x + v663); + x = (x + v664); + x = (x + v665); + x = (x + v666); + x = (x + v667); + x = (x + v668); + x = (x + v669); + x = (x + v670); + x = (x + v671); + x = (x + v672); + x = (x + v673); + x = (x + v674); + x = (x + v675); + x = (x + v676); + x = (x + v677); + x = (x + v678); + x = (x + v679); + x = (x + v680); + x = (x + v681); + x = (x + v682); + x = (x + v683); + x = (x + v684); + x = (x + v685); + x = (x + v686); + x = (x + v687); + x = (x + v688); + x = (x + v689); + x = (x + v690); + x = (x + v691); + x = (x + v692); + x = (x + v693); + x = (x + v694); + x = (x + v695); + x = (x + v696); + x = (x + v697); + x = (x + v698); + x = (x + v699); + x = (x + v700); + x = (x + v701); + x = (x + v702); + x = (x + v703); + x = (x + v704); + x = (x + v705); + x = (x + v706); + x = (x + v707); + x = (x + v708); + x = (x + v709); + x = (x + v710); + x = (x + v711); + x = (x + v712); + x = (x + v713); + x = (x + v714); + x = (x + v715); + x = (x + v716); + x = (x + v717); + x = (x + v718); + x = (x + v719); + x = (x + v720); + x = (x + v721); + x = (x + v722); + x = (x + v723); + x = (x + v724); + x = (x + v725); + x = (x + v726); + x = (x + v727); + x = (x + v728); + x = (x + v729); + x = (x + v730); + x = (x + v731); + x = (x + v732); + x = (x + v733); + x = (x + v734); + x = (x + v735); + x = (x + v736); + x = (x + v737); + x = (x + v738); + x = (x + v739); + x = (x + v740); + x = (x + v741); + x = (x + v742); + x = (x + v743); + x = (x + v744); + x = (x + v745); + x = (x + v746); + x = (x + v747); + x = (x + v748); + x = (x + v749); + x = (x + v750); + x = (x + v751); + x = (x + v752); + x = (x + v753); + x = (x + v754); + x = (x + v755); + x = (x + v756); + x = (x + v757); + x = (x + v758); + x = (x + v759); + x = (x + v760); + x = (x + v761); + x = (x + v762); + x = (x + v763); + x = (x + v764); + x = (x + v765); + x = (x + v766); + x = (x + v767); + x = (x + v768); + x = (x + v769); + x = (x + v770); + x = (x + v771); + x = (x + v772); + x = (x + v773); + x = (x + v774); + x = (x + v775); + x = (x + v776); + x = (x + v777); + x = (x + v778); + x = (x + v779); + x = (x + v780); + x = (x + v781); + x = (x + v782); + x = (x + v783); + x = (x + v784); + x = (x + v785); + x = (x + v786); + x = (x + v787); + x = (x + v788); + x = (x + v789); + x = (x + v790); + x = (x + v791); + x = (x + v792); + x = (x + v793); + x = (x + v794); + x = (x + v795); + x = (x + v796); + x = (x + v797); + x = (x + v798); + x = (x + v799); + x = (x + v800); + x = (x + v801); + x = (x + v802); + x = (x + v803); + x = (x + v804); + x = (x + v805); + x = (x + v806); + x = (x + v807); + x = (x + v808); + x = (x + v809); + x = (x + v810); + x = (x + v811); + x = (x + v812); + x = (x + v813); + x = (x + v814); + x = (x + v815); + x = (x + v816); + x = (x + v817); + x = (x + v818); + x = (x + v819); + x = (x + v820); + x = (x + v821); + x = (x + v822); + x = (x + v823); + x = (x + v824); + x = (x + v825); + x = (x + v826); + x = (x + v827); + x = (x + v828); + x = (x + v829); + x = (x + v830); + x = (x + v831); + x = (x + v832); + x = (x + v833); + x = (x + v834); + x = (x + v835); + x = (x + v836); + x = (x + v837); + x = (x + v838); + x = (x + v839); + x = (x + v840); + x = (x + v841); + x = (x + v842); + x = (x + v843); + x = (x + v844); + x = (x + v845); + x = (x + v846); + x = (x + v847); + x = (x + v848); + x = (x + v849); + x = (x + v850); + x = (x + v851); + x = (x + v852); + x = (x + v853); + x = (x + v854); + x = (x + v855); + x = (x + v856); + x = (x + v857); + x = (x + v858); + x = (x + v859); + x = (x + v860); + x = (x + v861); + x = (x + v862); + x = (x + v863); + x = (x + v864); + x = (x + v865); + x = (x + v866); + x = (x + v867); + x = (x + v868); + x = (x + v869); + x = (x + v870); + x = (x + v871); + x = (x + v872); + x = (x + v873); + x = (x + v874); + x = (x + v875); + x = (x + v876); + x = (x + v877); + x = (x + v878); + x = (x + v879); + x = (x + v880); + x = (x + v881); + x = (x + v882); + x = (x + v883); + x = (x + v884); + x = (x + v885); + x = (x + v886); + x = (x + v887); + x = (x + v888); + x = (x + v889); + x = (x + v890); + x = (x + v891); + x = (x + v892); + x = (x + v893); + x = (x + v894); + x = (x + v895); + x = (x + v896); + x = (x + v897); + x = (x + v898); + x = (x + v899); + x = (x + v900); + x = (x + v901); + x = (x + v902); + x = (x + v903); + x = (x + v904); + x = (x + v905); + x = (x + v906); + x = (x + v907); + x = (x + v908); + x = (x + v909); + x = (x + v910); + x = (x + v911); + x = (x + v912); + x = (x + v913); + x = (x + v914); + x = (x + v915); + x = (x + v916); + x = (x + v917); + x = (x + v918); + x = (x + v919); + x = (x + v920); + x = (x + v921); + x = (x + v922); + x = (x + v923); + x = (x + v924); + x = (x + v925); + x = (x + v926); + x = (x + v927); + x = (x + v928); + x = (x + v929); + x = (x + v930); + x = (x + v931); + x = (x + v932); + x = (x + v933); + x = (x + v934); + x = (x + v935); + x = (x + v936); + x = (x + v937); + x = (x + v938); + x = (x + v939); + x = (x + v940); + x = (x + v941); + x = (x + v942); + x = (x + v943); + x = (x + v944); + x = (x + v945); + x = (x + v946); + x = (x + v947); + x = (x + v948); + x = (x + v949); + x = (x + v950); + x = (x + v951); + x = (x + v952); + x = (x + v953); + x = (x + v954); + x = (x + v955); + x = (x + v956); + x = (x + v957); + x = (x + v958); + x = (x + v959); + x = (x + v960); + x = (x + v961); + x = (x + v962); + x = (x + v963); + x = (x + v964); + x = (x + v965); + x = (x + v966); + x = (x + v967); + x = (x + v968); + x = (x + v969); + x = (x + v970); + x = (x + v971); + x = (x + v972); + x = (x + v973); + x = (x + v974); + x = (x + v975); + x = (x + v976); + x = (x + v977); + x = (x + v978); + x = (x + v979); + x = (x + v980); + x = (x + v981); + x = (x + v982); + x = (x + v983); + x = (x + v984); + x = (x + v985); + x = (x + v986); + x = (x + v987); + x = (x + v988); + x = (x + v989); + x = (x + v990); + x = (x + v991); + x = (x + v992); + x = (x + v993); + x = (x + v994); + x = (x + v995); + x = (x + v996); + x = (x + v997); + x = (x + v998); + x = (x + v999); + return x; +} + +struct tint_symbol { + uint value : SV_Target0; +}; + +uint main_inner() { + return foo(); +} + +tint_symbol main() { + const uint inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1509.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1509.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2f03ad7ccf --- /dev/null +++ b/test/tint/bug/tint/1509.wgsl.expected.fxc.hlsl @@ -0,0 +1,2020 @@ +static uint v0 = 0u; +static uint v1 = 0u; +static uint v2 = 0u; +static uint v3 = 0u; +static uint v4 = 0u; +static uint v5 = 0u; +static uint v6 = 0u; +static uint v7 = 0u; +static uint v8 = 0u; +static uint v9 = 0u; +static uint v10 = 0u; +static uint v11 = 0u; +static uint v12 = 0u; +static uint v13 = 0u; +static uint v14 = 0u; +static uint v15 = 0u; +static uint v16 = 0u; +static uint v17 = 0u; +static uint v18 = 0u; +static uint v19 = 0u; +static uint v20 = 0u; +static uint v21 = 0u; +static uint v22 = 0u; +static uint v23 = 0u; +static uint v24 = 0u; +static uint v25 = 0u; +static uint v26 = 0u; +static uint v27 = 0u; +static uint v28 = 0u; +static uint v29 = 0u; +static uint v30 = 0u; +static uint v31 = 0u; +static uint v32 = 0u; +static uint v33 = 0u; +static uint v34 = 0u; +static uint v35 = 0u; +static uint v36 = 0u; +static uint v37 = 0u; +static uint v38 = 0u; +static uint v39 = 0u; +static uint v40 = 0u; +static uint v41 = 0u; +static uint v42 = 0u; +static uint v43 = 0u; +static uint v44 = 0u; +static uint v45 = 0u; +static uint v46 = 0u; +static uint v47 = 0u; +static uint v48 = 0u; +static uint v49 = 0u; +static uint v50 = 0u; +static uint v51 = 0u; +static uint v52 = 0u; +static uint v53 = 0u; +static uint v54 = 0u; +static uint v55 = 0u; +static uint v56 = 0u; +static uint v57 = 0u; +static uint v58 = 0u; +static uint v59 = 0u; +static uint v60 = 0u; +static uint v61 = 0u; +static uint v62 = 0u; +static uint v63 = 0u; +static uint v64 = 0u; +static uint v65 = 0u; +static uint v66 = 0u; +static uint v67 = 0u; +static uint v68 = 0u; +static uint v69 = 0u; +static uint v70 = 0u; +static uint v71 = 0u; +static uint v72 = 0u; +static uint v73 = 0u; +static uint v74 = 0u; +static uint v75 = 0u; +static uint v76 = 0u; +static uint v77 = 0u; +static uint v78 = 0u; +static uint v79 = 0u; +static uint v80 = 0u; +static uint v81 = 0u; +static uint v82 = 0u; +static uint v83 = 0u; +static uint v84 = 0u; +static uint v85 = 0u; +static uint v86 = 0u; +static uint v87 = 0u; +static uint v88 = 0u; +static uint v89 = 0u; +static uint v90 = 0u; +static uint v91 = 0u; +static uint v92 = 0u; +static uint v93 = 0u; +static uint v94 = 0u; +static uint v95 = 0u; +static uint v96 = 0u; +static uint v97 = 0u; +static uint v98 = 0u; +static uint v99 = 0u; +static uint v100 = 0u; +static uint v101 = 0u; +static uint v102 = 0u; +static uint v103 = 0u; +static uint v104 = 0u; +static uint v105 = 0u; +static uint v106 = 0u; +static uint v107 = 0u; +static uint v108 = 0u; +static uint v109 = 0u; +static uint v110 = 0u; +static uint v111 = 0u; +static uint v112 = 0u; +static uint v113 = 0u; +static uint v114 = 0u; +static uint v115 = 0u; +static uint v116 = 0u; +static uint v117 = 0u; +static uint v118 = 0u; +static uint v119 = 0u; +static uint v120 = 0u; +static uint v121 = 0u; +static uint v122 = 0u; +static uint v123 = 0u; +static uint v124 = 0u; +static uint v125 = 0u; +static uint v126 = 0u; +static uint v127 = 0u; +static uint v128 = 0u; +static uint v129 = 0u; +static uint v130 = 0u; +static uint v131 = 0u; +static uint v132 = 0u; +static uint v133 = 0u; +static uint v134 = 0u; +static uint v135 = 0u; +static uint v136 = 0u; +static uint v137 = 0u; +static uint v138 = 0u; +static uint v139 = 0u; +static uint v140 = 0u; +static uint v141 = 0u; +static uint v142 = 0u; +static uint v143 = 0u; +static uint v144 = 0u; +static uint v145 = 0u; +static uint v146 = 0u; +static uint v147 = 0u; +static uint v148 = 0u; +static uint v149 = 0u; +static uint v150 = 0u; +static uint v151 = 0u; +static uint v152 = 0u; +static uint v153 = 0u; +static uint v154 = 0u; +static uint v155 = 0u; +static uint v156 = 0u; +static uint v157 = 0u; +static uint v158 = 0u; +static uint v159 = 0u; +static uint v160 = 0u; +static uint v161 = 0u; +static uint v162 = 0u; +static uint v163 = 0u; +static uint v164 = 0u; +static uint v165 = 0u; +static uint v166 = 0u; +static uint v167 = 0u; +static uint v168 = 0u; +static uint v169 = 0u; +static uint v170 = 0u; +static uint v171 = 0u; +static uint v172 = 0u; +static uint v173 = 0u; +static uint v174 = 0u; +static uint v175 = 0u; +static uint v176 = 0u; +static uint v177 = 0u; +static uint v178 = 0u; +static uint v179 = 0u; +static uint v180 = 0u; +static uint v181 = 0u; +static uint v182 = 0u; +static uint v183 = 0u; +static uint v184 = 0u; +static uint v185 = 0u; +static uint v186 = 0u; +static uint v187 = 0u; +static uint v188 = 0u; +static uint v189 = 0u; +static uint v190 = 0u; +static uint v191 = 0u; +static uint v192 = 0u; +static uint v193 = 0u; +static uint v194 = 0u; +static uint v195 = 0u; +static uint v196 = 0u; +static uint v197 = 0u; +static uint v198 = 0u; +static uint v199 = 0u; +static uint v200 = 0u; +static uint v201 = 0u; +static uint v202 = 0u; +static uint v203 = 0u; +static uint v204 = 0u; +static uint v205 = 0u; +static uint v206 = 0u; +static uint v207 = 0u; +static uint v208 = 0u; +static uint v209 = 0u; +static uint v210 = 0u; +static uint v211 = 0u; +static uint v212 = 0u; +static uint v213 = 0u; +static uint v214 = 0u; +static uint v215 = 0u; +static uint v216 = 0u; +static uint v217 = 0u; +static uint v218 = 0u; +static uint v219 = 0u; +static uint v220 = 0u; +static uint v221 = 0u; +static uint v222 = 0u; +static uint v223 = 0u; +static uint v224 = 0u; +static uint v225 = 0u; +static uint v226 = 0u; +static uint v227 = 0u; +static uint v228 = 0u; +static uint v229 = 0u; +static uint v230 = 0u; +static uint v231 = 0u; +static uint v232 = 0u; +static uint v233 = 0u; +static uint v234 = 0u; +static uint v235 = 0u; +static uint v236 = 0u; +static uint v237 = 0u; +static uint v238 = 0u; +static uint v239 = 0u; +static uint v240 = 0u; +static uint v241 = 0u; +static uint v242 = 0u; +static uint v243 = 0u; +static uint v244 = 0u; +static uint v245 = 0u; +static uint v246 = 0u; +static uint v247 = 0u; +static uint v248 = 0u; +static uint v249 = 0u; +static uint v250 = 0u; +static uint v251 = 0u; +static uint v252 = 0u; +static uint v253 = 0u; +static uint v254 = 0u; +static uint v255 = 0u; +static uint v256 = 0u; +static uint v257 = 0u; +static uint v258 = 0u; +static uint v259 = 0u; +static uint v260 = 0u; +static uint v261 = 0u; +static uint v262 = 0u; +static uint v263 = 0u; +static uint v264 = 0u; +static uint v265 = 0u; +static uint v266 = 0u; +static uint v267 = 0u; +static uint v268 = 0u; +static uint v269 = 0u; +static uint v270 = 0u; +static uint v271 = 0u; +static uint v272 = 0u; +static uint v273 = 0u; +static uint v274 = 0u; +static uint v275 = 0u; +static uint v276 = 0u; +static uint v277 = 0u; +static uint v278 = 0u; +static uint v279 = 0u; +static uint v280 = 0u; +static uint v281 = 0u; +static uint v282 = 0u; +static uint v283 = 0u; +static uint v284 = 0u; +static uint v285 = 0u; +static uint v286 = 0u; +static uint v287 = 0u; +static uint v288 = 0u; +static uint v289 = 0u; +static uint v290 = 0u; +static uint v291 = 0u; +static uint v292 = 0u; +static uint v293 = 0u; +static uint v294 = 0u; +static uint v295 = 0u; +static uint v296 = 0u; +static uint v297 = 0u; +static uint v298 = 0u; +static uint v299 = 0u; +static uint v300 = 0u; +static uint v301 = 0u; +static uint v302 = 0u; +static uint v303 = 0u; +static uint v304 = 0u; +static uint v305 = 0u; +static uint v306 = 0u; +static uint v307 = 0u; +static uint v308 = 0u; +static uint v309 = 0u; +static uint v310 = 0u; +static uint v311 = 0u; +static uint v312 = 0u; +static uint v313 = 0u; +static uint v314 = 0u; +static uint v315 = 0u; +static uint v316 = 0u; +static uint v317 = 0u; +static uint v318 = 0u; +static uint v319 = 0u; +static uint v320 = 0u; +static uint v321 = 0u; +static uint v322 = 0u; +static uint v323 = 0u; +static uint v324 = 0u; +static uint v325 = 0u; +static uint v326 = 0u; +static uint v327 = 0u; +static uint v328 = 0u; +static uint v329 = 0u; +static uint v330 = 0u; +static uint v331 = 0u; +static uint v332 = 0u; +static uint v333 = 0u; +static uint v334 = 0u; +static uint v335 = 0u; +static uint v336 = 0u; +static uint v337 = 0u; +static uint v338 = 0u; +static uint v339 = 0u; +static uint v340 = 0u; +static uint v341 = 0u; +static uint v342 = 0u; +static uint v343 = 0u; +static uint v344 = 0u; +static uint v345 = 0u; +static uint v346 = 0u; +static uint v347 = 0u; +static uint v348 = 0u; +static uint v349 = 0u; +static uint v350 = 0u; +static uint v351 = 0u; +static uint v352 = 0u; +static uint v353 = 0u; +static uint v354 = 0u; +static uint v355 = 0u; +static uint v356 = 0u; +static uint v357 = 0u; +static uint v358 = 0u; +static uint v359 = 0u; +static uint v360 = 0u; +static uint v361 = 0u; +static uint v362 = 0u; +static uint v363 = 0u; +static uint v364 = 0u; +static uint v365 = 0u; +static uint v366 = 0u; +static uint v367 = 0u; +static uint v368 = 0u; +static uint v369 = 0u; +static uint v370 = 0u; +static uint v371 = 0u; +static uint v372 = 0u; +static uint v373 = 0u; +static uint v374 = 0u; +static uint v375 = 0u; +static uint v376 = 0u; +static uint v377 = 0u; +static uint v378 = 0u; +static uint v379 = 0u; +static uint v380 = 0u; +static uint v381 = 0u; +static uint v382 = 0u; +static uint v383 = 0u; +static uint v384 = 0u; +static uint v385 = 0u; +static uint v386 = 0u; +static uint v387 = 0u; +static uint v388 = 0u; +static uint v389 = 0u; +static uint v390 = 0u; +static uint v391 = 0u; +static uint v392 = 0u; +static uint v393 = 0u; +static uint v394 = 0u; +static uint v395 = 0u; +static uint v396 = 0u; +static uint v397 = 0u; +static uint v398 = 0u; +static uint v399 = 0u; +static uint v400 = 0u; +static uint v401 = 0u; +static uint v402 = 0u; +static uint v403 = 0u; +static uint v404 = 0u; +static uint v405 = 0u; +static uint v406 = 0u; +static uint v407 = 0u; +static uint v408 = 0u; +static uint v409 = 0u; +static uint v410 = 0u; +static uint v411 = 0u; +static uint v412 = 0u; +static uint v413 = 0u; +static uint v414 = 0u; +static uint v415 = 0u; +static uint v416 = 0u; +static uint v417 = 0u; +static uint v418 = 0u; +static uint v419 = 0u; +static uint v420 = 0u; +static uint v421 = 0u; +static uint v422 = 0u; +static uint v423 = 0u; +static uint v424 = 0u; +static uint v425 = 0u; +static uint v426 = 0u; +static uint v427 = 0u; +static uint v428 = 0u; +static uint v429 = 0u; +static uint v430 = 0u; +static uint v431 = 0u; +static uint v432 = 0u; +static uint v433 = 0u; +static uint v434 = 0u; +static uint v435 = 0u; +static uint v436 = 0u; +static uint v437 = 0u; +static uint v438 = 0u; +static uint v439 = 0u; +static uint v440 = 0u; +static uint v441 = 0u; +static uint v442 = 0u; +static uint v443 = 0u; +static uint v444 = 0u; +static uint v445 = 0u; +static uint v446 = 0u; +static uint v447 = 0u; +static uint v448 = 0u; +static uint v449 = 0u; +static uint v450 = 0u; +static uint v451 = 0u; +static uint v452 = 0u; +static uint v453 = 0u; +static uint v454 = 0u; +static uint v455 = 0u; +static uint v456 = 0u; +static uint v457 = 0u; +static uint v458 = 0u; +static uint v459 = 0u; +static uint v460 = 0u; +static uint v461 = 0u; +static uint v462 = 0u; +static uint v463 = 0u; +static uint v464 = 0u; +static uint v465 = 0u; +static uint v466 = 0u; +static uint v467 = 0u; +static uint v468 = 0u; +static uint v469 = 0u; +static uint v470 = 0u; +static uint v471 = 0u; +static uint v472 = 0u; +static uint v473 = 0u; +static uint v474 = 0u; +static uint v475 = 0u; +static uint v476 = 0u; +static uint v477 = 0u; +static uint v478 = 0u; +static uint v479 = 0u; +static uint v480 = 0u; +static uint v481 = 0u; +static uint v482 = 0u; +static uint v483 = 0u; +static uint v484 = 0u; +static uint v485 = 0u; +static uint v486 = 0u; +static uint v487 = 0u; +static uint v488 = 0u; +static uint v489 = 0u; +static uint v490 = 0u; +static uint v491 = 0u; +static uint v492 = 0u; +static uint v493 = 0u; +static uint v494 = 0u; +static uint v495 = 0u; +static uint v496 = 0u; +static uint v497 = 0u; +static uint v498 = 0u; +static uint v499 = 0u; +static uint v500 = 0u; +static uint v501 = 0u; +static uint v502 = 0u; +static uint v503 = 0u; +static uint v504 = 0u; +static uint v505 = 0u; +static uint v506 = 0u; +static uint v507 = 0u; +static uint v508 = 0u; +static uint v509 = 0u; +static uint v510 = 0u; +static uint v511 = 0u; +static uint v512 = 0u; +static uint v513 = 0u; +static uint v514 = 0u; +static uint v515 = 0u; +static uint v516 = 0u; +static uint v517 = 0u; +static uint v518 = 0u; +static uint v519 = 0u; +static uint v520 = 0u; +static uint v521 = 0u; +static uint v522 = 0u; +static uint v523 = 0u; +static uint v524 = 0u; +static uint v525 = 0u; +static uint v526 = 0u; +static uint v527 = 0u; +static uint v528 = 0u; +static uint v529 = 0u; +static uint v530 = 0u; +static uint v531 = 0u; +static uint v532 = 0u; +static uint v533 = 0u; +static uint v534 = 0u; +static uint v535 = 0u; +static uint v536 = 0u; +static uint v537 = 0u; +static uint v538 = 0u; +static uint v539 = 0u; +static uint v540 = 0u; +static uint v541 = 0u; +static uint v542 = 0u; +static uint v543 = 0u; +static uint v544 = 0u; +static uint v545 = 0u; +static uint v546 = 0u; +static uint v547 = 0u; +static uint v548 = 0u; +static uint v549 = 0u; +static uint v550 = 0u; +static uint v551 = 0u; +static uint v552 = 0u; +static uint v553 = 0u; +static uint v554 = 0u; +static uint v555 = 0u; +static uint v556 = 0u; +static uint v557 = 0u; +static uint v558 = 0u; +static uint v559 = 0u; +static uint v560 = 0u; +static uint v561 = 0u; +static uint v562 = 0u; +static uint v563 = 0u; +static uint v564 = 0u; +static uint v565 = 0u; +static uint v566 = 0u; +static uint v567 = 0u; +static uint v568 = 0u; +static uint v569 = 0u; +static uint v570 = 0u; +static uint v571 = 0u; +static uint v572 = 0u; +static uint v573 = 0u; +static uint v574 = 0u; +static uint v575 = 0u; +static uint v576 = 0u; +static uint v577 = 0u; +static uint v578 = 0u; +static uint v579 = 0u; +static uint v580 = 0u; +static uint v581 = 0u; +static uint v582 = 0u; +static uint v583 = 0u; +static uint v584 = 0u; +static uint v585 = 0u; +static uint v586 = 0u; +static uint v587 = 0u; +static uint v588 = 0u; +static uint v589 = 0u; +static uint v590 = 0u; +static uint v591 = 0u; +static uint v592 = 0u; +static uint v593 = 0u; +static uint v594 = 0u; +static uint v595 = 0u; +static uint v596 = 0u; +static uint v597 = 0u; +static uint v598 = 0u; +static uint v599 = 0u; +static uint v600 = 0u; +static uint v601 = 0u; +static uint v602 = 0u; +static uint v603 = 0u; +static uint v604 = 0u; +static uint v605 = 0u; +static uint v606 = 0u; +static uint v607 = 0u; +static uint v608 = 0u; +static uint v609 = 0u; +static uint v610 = 0u; +static uint v611 = 0u; +static uint v612 = 0u; +static uint v613 = 0u; +static uint v614 = 0u; +static uint v615 = 0u; +static uint v616 = 0u; +static uint v617 = 0u; +static uint v618 = 0u; +static uint v619 = 0u; +static uint v620 = 0u; +static uint v621 = 0u; +static uint v622 = 0u; +static uint v623 = 0u; +static uint v624 = 0u; +static uint v625 = 0u; +static uint v626 = 0u; +static uint v627 = 0u; +static uint v628 = 0u; +static uint v629 = 0u; +static uint v630 = 0u; +static uint v631 = 0u; +static uint v632 = 0u; +static uint v633 = 0u; +static uint v634 = 0u; +static uint v635 = 0u; +static uint v636 = 0u; +static uint v637 = 0u; +static uint v638 = 0u; +static uint v639 = 0u; +static uint v640 = 0u; +static uint v641 = 0u; +static uint v642 = 0u; +static uint v643 = 0u; +static uint v644 = 0u; +static uint v645 = 0u; +static uint v646 = 0u; +static uint v647 = 0u; +static uint v648 = 0u; +static uint v649 = 0u; +static uint v650 = 0u; +static uint v651 = 0u; +static uint v652 = 0u; +static uint v653 = 0u; +static uint v654 = 0u; +static uint v655 = 0u; +static uint v656 = 0u; +static uint v657 = 0u; +static uint v658 = 0u; +static uint v659 = 0u; +static uint v660 = 0u; +static uint v661 = 0u; +static uint v662 = 0u; +static uint v663 = 0u; +static uint v664 = 0u; +static uint v665 = 0u; +static uint v666 = 0u; +static uint v667 = 0u; +static uint v668 = 0u; +static uint v669 = 0u; +static uint v670 = 0u; +static uint v671 = 0u; +static uint v672 = 0u; +static uint v673 = 0u; +static uint v674 = 0u; +static uint v675 = 0u; +static uint v676 = 0u; +static uint v677 = 0u; +static uint v678 = 0u; +static uint v679 = 0u; +static uint v680 = 0u; +static uint v681 = 0u; +static uint v682 = 0u; +static uint v683 = 0u; +static uint v684 = 0u; +static uint v685 = 0u; +static uint v686 = 0u; +static uint v687 = 0u; +static uint v688 = 0u; +static uint v689 = 0u; +static uint v690 = 0u; +static uint v691 = 0u; +static uint v692 = 0u; +static uint v693 = 0u; +static uint v694 = 0u; +static uint v695 = 0u; +static uint v696 = 0u; +static uint v697 = 0u; +static uint v698 = 0u; +static uint v699 = 0u; +static uint v700 = 0u; +static uint v701 = 0u; +static uint v702 = 0u; +static uint v703 = 0u; +static uint v704 = 0u; +static uint v705 = 0u; +static uint v706 = 0u; +static uint v707 = 0u; +static uint v708 = 0u; +static uint v709 = 0u; +static uint v710 = 0u; +static uint v711 = 0u; +static uint v712 = 0u; +static uint v713 = 0u; +static uint v714 = 0u; +static uint v715 = 0u; +static uint v716 = 0u; +static uint v717 = 0u; +static uint v718 = 0u; +static uint v719 = 0u; +static uint v720 = 0u; +static uint v721 = 0u; +static uint v722 = 0u; +static uint v723 = 0u; +static uint v724 = 0u; +static uint v725 = 0u; +static uint v726 = 0u; +static uint v727 = 0u; +static uint v728 = 0u; +static uint v729 = 0u; +static uint v730 = 0u; +static uint v731 = 0u; +static uint v732 = 0u; +static uint v733 = 0u; +static uint v734 = 0u; +static uint v735 = 0u; +static uint v736 = 0u; +static uint v737 = 0u; +static uint v738 = 0u; +static uint v739 = 0u; +static uint v740 = 0u; +static uint v741 = 0u; +static uint v742 = 0u; +static uint v743 = 0u; +static uint v744 = 0u; +static uint v745 = 0u; +static uint v746 = 0u; +static uint v747 = 0u; +static uint v748 = 0u; +static uint v749 = 0u; +static uint v750 = 0u; +static uint v751 = 0u; +static uint v752 = 0u; +static uint v753 = 0u; +static uint v754 = 0u; +static uint v755 = 0u; +static uint v756 = 0u; +static uint v757 = 0u; +static uint v758 = 0u; +static uint v759 = 0u; +static uint v760 = 0u; +static uint v761 = 0u; +static uint v762 = 0u; +static uint v763 = 0u; +static uint v764 = 0u; +static uint v765 = 0u; +static uint v766 = 0u; +static uint v767 = 0u; +static uint v768 = 0u; +static uint v769 = 0u; +static uint v770 = 0u; +static uint v771 = 0u; +static uint v772 = 0u; +static uint v773 = 0u; +static uint v774 = 0u; +static uint v775 = 0u; +static uint v776 = 0u; +static uint v777 = 0u; +static uint v778 = 0u; +static uint v779 = 0u; +static uint v780 = 0u; +static uint v781 = 0u; +static uint v782 = 0u; +static uint v783 = 0u; +static uint v784 = 0u; +static uint v785 = 0u; +static uint v786 = 0u; +static uint v787 = 0u; +static uint v788 = 0u; +static uint v789 = 0u; +static uint v790 = 0u; +static uint v791 = 0u; +static uint v792 = 0u; +static uint v793 = 0u; +static uint v794 = 0u; +static uint v795 = 0u; +static uint v796 = 0u; +static uint v797 = 0u; +static uint v798 = 0u; +static uint v799 = 0u; +static uint v800 = 0u; +static uint v801 = 0u; +static uint v802 = 0u; +static uint v803 = 0u; +static uint v804 = 0u; +static uint v805 = 0u; +static uint v806 = 0u; +static uint v807 = 0u; +static uint v808 = 0u; +static uint v809 = 0u; +static uint v810 = 0u; +static uint v811 = 0u; +static uint v812 = 0u; +static uint v813 = 0u; +static uint v814 = 0u; +static uint v815 = 0u; +static uint v816 = 0u; +static uint v817 = 0u; +static uint v818 = 0u; +static uint v819 = 0u; +static uint v820 = 0u; +static uint v821 = 0u; +static uint v822 = 0u; +static uint v823 = 0u; +static uint v824 = 0u; +static uint v825 = 0u; +static uint v826 = 0u; +static uint v827 = 0u; +static uint v828 = 0u; +static uint v829 = 0u; +static uint v830 = 0u; +static uint v831 = 0u; +static uint v832 = 0u; +static uint v833 = 0u; +static uint v834 = 0u; +static uint v835 = 0u; +static uint v836 = 0u; +static uint v837 = 0u; +static uint v838 = 0u; +static uint v839 = 0u; +static uint v840 = 0u; +static uint v841 = 0u; +static uint v842 = 0u; +static uint v843 = 0u; +static uint v844 = 0u; +static uint v845 = 0u; +static uint v846 = 0u; +static uint v847 = 0u; +static uint v848 = 0u; +static uint v849 = 0u; +static uint v850 = 0u; +static uint v851 = 0u; +static uint v852 = 0u; +static uint v853 = 0u; +static uint v854 = 0u; +static uint v855 = 0u; +static uint v856 = 0u; +static uint v857 = 0u; +static uint v858 = 0u; +static uint v859 = 0u; +static uint v860 = 0u; +static uint v861 = 0u; +static uint v862 = 0u; +static uint v863 = 0u; +static uint v864 = 0u; +static uint v865 = 0u; +static uint v866 = 0u; +static uint v867 = 0u; +static uint v868 = 0u; +static uint v869 = 0u; +static uint v870 = 0u; +static uint v871 = 0u; +static uint v872 = 0u; +static uint v873 = 0u; +static uint v874 = 0u; +static uint v875 = 0u; +static uint v876 = 0u; +static uint v877 = 0u; +static uint v878 = 0u; +static uint v879 = 0u; +static uint v880 = 0u; +static uint v881 = 0u; +static uint v882 = 0u; +static uint v883 = 0u; +static uint v884 = 0u; +static uint v885 = 0u; +static uint v886 = 0u; +static uint v887 = 0u; +static uint v888 = 0u; +static uint v889 = 0u; +static uint v890 = 0u; +static uint v891 = 0u; +static uint v892 = 0u; +static uint v893 = 0u; +static uint v894 = 0u; +static uint v895 = 0u; +static uint v896 = 0u; +static uint v897 = 0u; +static uint v898 = 0u; +static uint v899 = 0u; +static uint v900 = 0u; +static uint v901 = 0u; +static uint v902 = 0u; +static uint v903 = 0u; +static uint v904 = 0u; +static uint v905 = 0u; +static uint v906 = 0u; +static uint v907 = 0u; +static uint v908 = 0u; +static uint v909 = 0u; +static uint v910 = 0u; +static uint v911 = 0u; +static uint v912 = 0u; +static uint v913 = 0u; +static uint v914 = 0u; +static uint v915 = 0u; +static uint v916 = 0u; +static uint v917 = 0u; +static uint v918 = 0u; +static uint v919 = 0u; +static uint v920 = 0u; +static uint v921 = 0u; +static uint v922 = 0u; +static uint v923 = 0u; +static uint v924 = 0u; +static uint v925 = 0u; +static uint v926 = 0u; +static uint v927 = 0u; +static uint v928 = 0u; +static uint v929 = 0u; +static uint v930 = 0u; +static uint v931 = 0u; +static uint v932 = 0u; +static uint v933 = 0u; +static uint v934 = 0u; +static uint v935 = 0u; +static uint v936 = 0u; +static uint v937 = 0u; +static uint v938 = 0u; +static uint v939 = 0u; +static uint v940 = 0u; +static uint v941 = 0u; +static uint v942 = 0u; +static uint v943 = 0u; +static uint v944 = 0u; +static uint v945 = 0u; +static uint v946 = 0u; +static uint v947 = 0u; +static uint v948 = 0u; +static uint v949 = 0u; +static uint v950 = 0u; +static uint v951 = 0u; +static uint v952 = 0u; +static uint v953 = 0u; +static uint v954 = 0u; +static uint v955 = 0u; +static uint v956 = 0u; +static uint v957 = 0u; +static uint v958 = 0u; +static uint v959 = 0u; +static uint v960 = 0u; +static uint v961 = 0u; +static uint v962 = 0u; +static uint v963 = 0u; +static uint v964 = 0u; +static uint v965 = 0u; +static uint v966 = 0u; +static uint v967 = 0u; +static uint v968 = 0u; +static uint v969 = 0u; +static uint v970 = 0u; +static uint v971 = 0u; +static uint v972 = 0u; +static uint v973 = 0u; +static uint v974 = 0u; +static uint v975 = 0u; +static uint v976 = 0u; +static uint v977 = 0u; +static uint v978 = 0u; +static uint v979 = 0u; +static uint v980 = 0u; +static uint v981 = 0u; +static uint v982 = 0u; +static uint v983 = 0u; +static uint v984 = 0u; +static uint v985 = 0u; +static uint v986 = 0u; +static uint v987 = 0u; +static uint v988 = 0u; +static uint v989 = 0u; +static uint v990 = 0u; +static uint v991 = 0u; +static uint v992 = 0u; +static uint v993 = 0u; +static uint v994 = 0u; +static uint v995 = 0u; +static uint v996 = 0u; +static uint v997 = 0u; +static uint v998 = 0u; +static uint v999 = 0u; + +uint foo() { + uint x = 0u; + x = (x + v0); + x = (x + v1); + x = (x + v2); + x = (x + v3); + x = (x + v4); + x = (x + v5); + x = (x + v6); + x = (x + v7); + x = (x + v8); + x = (x + v9); + x = (x + v10); + x = (x + v11); + x = (x + v12); + x = (x + v13); + x = (x + v14); + x = (x + v15); + x = (x + v16); + x = (x + v17); + x = (x + v18); + x = (x + v19); + x = (x + v20); + x = (x + v21); + x = (x + v22); + x = (x + v23); + x = (x + v24); + x = (x + v25); + x = (x + v26); + x = (x + v27); + x = (x + v28); + x = (x + v29); + x = (x + v30); + x = (x + v31); + x = (x + v32); + x = (x + v33); + x = (x + v34); + x = (x + v35); + x = (x + v36); + x = (x + v37); + x = (x + v38); + x = (x + v39); + x = (x + v40); + x = (x + v41); + x = (x + v42); + x = (x + v43); + x = (x + v44); + x = (x + v45); + x = (x + v46); + x = (x + v47); + x = (x + v48); + x = (x + v49); + x = (x + v50); + x = (x + v51); + x = (x + v52); + x = (x + v53); + x = (x + v54); + x = (x + v55); + x = (x + v56); + x = (x + v57); + x = (x + v58); + x = (x + v59); + x = (x + v60); + x = (x + v61); + x = (x + v62); + x = (x + v63); + x = (x + v64); + x = (x + v65); + x = (x + v66); + x = (x + v67); + x = (x + v68); + x = (x + v69); + x = (x + v70); + x = (x + v71); + x = (x + v72); + x = (x + v73); + x = (x + v74); + x = (x + v75); + x = (x + v76); + x = (x + v77); + x = (x + v78); + x = (x + v79); + x = (x + v80); + x = (x + v81); + x = (x + v82); + x = (x + v83); + x = (x + v84); + x = (x + v85); + x = (x + v86); + x = (x + v87); + x = (x + v88); + x = (x + v89); + x = (x + v90); + x = (x + v91); + x = (x + v92); + x = (x + v93); + x = (x + v94); + x = (x + v95); + x = (x + v96); + x = (x + v97); + x = (x + v98); + x = (x + v99); + x = (x + v100); + x = (x + v101); + x = (x + v102); + x = (x + v103); + x = (x + v104); + x = (x + v105); + x = (x + v106); + x = (x + v107); + x = (x + v108); + x = (x + v109); + x = (x + v110); + x = (x + v111); + x = (x + v112); + x = (x + v113); + x = (x + v114); + x = (x + v115); + x = (x + v116); + x = (x + v117); + x = (x + v118); + x = (x + v119); + x = (x + v120); + x = (x + v121); + x = (x + v122); + x = (x + v123); + x = (x + v124); + x = (x + v125); + x = (x + v126); + x = (x + v127); + x = (x + v128); + x = (x + v129); + x = (x + v130); + x = (x + v131); + x = (x + v132); + x = (x + v133); + x = (x + v134); + x = (x + v135); + x = (x + v136); + x = (x + v137); + x = (x + v138); + x = (x + v139); + x = (x + v140); + x = (x + v141); + x = (x + v142); + x = (x + v143); + x = (x + v144); + x = (x + v145); + x = (x + v146); + x = (x + v147); + x = (x + v148); + x = (x + v149); + x = (x + v150); + x = (x + v151); + x = (x + v152); + x = (x + v153); + x = (x + v154); + x = (x + v155); + x = (x + v156); + x = (x + v157); + x = (x + v158); + x = (x + v159); + x = (x + v160); + x = (x + v161); + x = (x + v162); + x = (x + v163); + x = (x + v164); + x = (x + v165); + x = (x + v166); + x = (x + v167); + x = (x + v168); + x = (x + v169); + x = (x + v170); + x = (x + v171); + x = (x + v172); + x = (x + v173); + x = (x + v174); + x = (x + v175); + x = (x + v176); + x = (x + v177); + x = (x + v178); + x = (x + v179); + x = (x + v180); + x = (x + v181); + x = (x + v182); + x = (x + v183); + x = (x + v184); + x = (x + v185); + x = (x + v186); + x = (x + v187); + x = (x + v188); + x = (x + v189); + x = (x + v190); + x = (x + v191); + x = (x + v192); + x = (x + v193); + x = (x + v194); + x = (x + v195); + x = (x + v196); + x = (x + v197); + x = (x + v198); + x = (x + v199); + x = (x + v200); + x = (x + v201); + x = (x + v202); + x = (x + v203); + x = (x + v204); + x = (x + v205); + x = (x + v206); + x = (x + v207); + x = (x + v208); + x = (x + v209); + x = (x + v210); + x = (x + v211); + x = (x + v212); + x = (x + v213); + x = (x + v214); + x = (x + v215); + x = (x + v216); + x = (x + v217); + x = (x + v218); + x = (x + v219); + x = (x + v220); + x = (x + v221); + x = (x + v222); + x = (x + v223); + x = (x + v224); + x = (x + v225); + x = (x + v226); + x = (x + v227); + x = (x + v228); + x = (x + v229); + x = (x + v230); + x = (x + v231); + x = (x + v232); + x = (x + v233); + x = (x + v234); + x = (x + v235); + x = (x + v236); + x = (x + v237); + x = (x + v238); + x = (x + v239); + x = (x + v240); + x = (x + v241); + x = (x + v242); + x = (x + v243); + x = (x + v244); + x = (x + v245); + x = (x + v246); + x = (x + v247); + x = (x + v248); + x = (x + v249); + x = (x + v250); + x = (x + v251); + x = (x + v252); + x = (x + v253); + x = (x + v254); + x = (x + v255); + x = (x + v256); + x = (x + v257); + x = (x + v258); + x = (x + v259); + x = (x + v260); + x = (x + v261); + x = (x + v262); + x = (x + v263); + x = (x + v264); + x = (x + v265); + x = (x + v266); + x = (x + v267); + x = (x + v268); + x = (x + v269); + x = (x + v270); + x = (x + v271); + x = (x + v272); + x = (x + v273); + x = (x + v274); + x = (x + v275); + x = (x + v276); + x = (x + v277); + x = (x + v278); + x = (x + v279); + x = (x + v280); + x = (x + v281); + x = (x + v282); + x = (x + v283); + x = (x + v284); + x = (x + v285); + x = (x + v286); + x = (x + v287); + x = (x + v288); + x = (x + v289); + x = (x + v290); + x = (x + v291); + x = (x + v292); + x = (x + v293); + x = (x + v294); + x = (x + v295); + x = (x + v296); + x = (x + v297); + x = (x + v298); + x = (x + v299); + x = (x + v300); + x = (x + v301); + x = (x + v302); + x = (x + v303); + x = (x + v304); + x = (x + v305); + x = (x + v306); + x = (x + v307); + x = (x + v308); + x = (x + v309); + x = (x + v310); + x = (x + v311); + x = (x + v312); + x = (x + v313); + x = (x + v314); + x = (x + v315); + x = (x + v316); + x = (x + v317); + x = (x + v318); + x = (x + v319); + x = (x + v320); + x = (x + v321); + x = (x + v322); + x = (x + v323); + x = (x + v324); + x = (x + v325); + x = (x + v326); + x = (x + v327); + x = (x + v328); + x = (x + v329); + x = (x + v330); + x = (x + v331); + x = (x + v332); + x = (x + v333); + x = (x + v334); + x = (x + v335); + x = (x + v336); + x = (x + v337); + x = (x + v338); + x = (x + v339); + x = (x + v340); + x = (x + v341); + x = (x + v342); + x = (x + v343); + x = (x + v344); + x = (x + v345); + x = (x + v346); + x = (x + v347); + x = (x + v348); + x = (x + v349); + x = (x + v350); + x = (x + v351); + x = (x + v352); + x = (x + v353); + x = (x + v354); + x = (x + v355); + x = (x + v356); + x = (x + v357); + x = (x + v358); + x = (x + v359); + x = (x + v360); + x = (x + v361); + x = (x + v362); + x = (x + v363); + x = (x + v364); + x = (x + v365); + x = (x + v366); + x = (x + v367); + x = (x + v368); + x = (x + v369); + x = (x + v370); + x = (x + v371); + x = (x + v372); + x = (x + v373); + x = (x + v374); + x = (x + v375); + x = (x + v376); + x = (x + v377); + x = (x + v378); + x = (x + v379); + x = (x + v380); + x = (x + v381); + x = (x + v382); + x = (x + v383); + x = (x + v384); + x = (x + v385); + x = (x + v386); + x = (x + v387); + x = (x + v388); + x = (x + v389); + x = (x + v390); + x = (x + v391); + x = (x + v392); + x = (x + v393); + x = (x + v394); + x = (x + v395); + x = (x + v396); + x = (x + v397); + x = (x + v398); + x = (x + v399); + x = (x + v400); + x = (x + v401); + x = (x + v402); + x = (x + v403); + x = (x + v404); + x = (x + v405); + x = (x + v406); + x = (x + v407); + x = (x + v408); + x = (x + v409); + x = (x + v410); + x = (x + v411); + x = (x + v412); + x = (x + v413); + x = (x + v414); + x = (x + v415); + x = (x + v416); + x = (x + v417); + x = (x + v418); + x = (x + v419); + x = (x + v420); + x = (x + v421); + x = (x + v422); + x = (x + v423); + x = (x + v424); + x = (x + v425); + x = (x + v426); + x = (x + v427); + x = (x + v428); + x = (x + v429); + x = (x + v430); + x = (x + v431); + x = (x + v432); + x = (x + v433); + x = (x + v434); + x = (x + v435); + x = (x + v436); + x = (x + v437); + x = (x + v438); + x = (x + v439); + x = (x + v440); + x = (x + v441); + x = (x + v442); + x = (x + v443); + x = (x + v444); + x = (x + v445); + x = (x + v446); + x = (x + v447); + x = (x + v448); + x = (x + v449); + x = (x + v450); + x = (x + v451); + x = (x + v452); + x = (x + v453); + x = (x + v454); + x = (x + v455); + x = (x + v456); + x = (x + v457); + x = (x + v458); + x = (x + v459); + x = (x + v460); + x = (x + v461); + x = (x + v462); + x = (x + v463); + x = (x + v464); + x = (x + v465); + x = (x + v466); + x = (x + v467); + x = (x + v468); + x = (x + v469); + x = (x + v470); + x = (x + v471); + x = (x + v472); + x = (x + v473); + x = (x + v474); + x = (x + v475); + x = (x + v476); + x = (x + v477); + x = (x + v478); + x = (x + v479); + x = (x + v480); + x = (x + v481); + x = (x + v482); + x = (x + v483); + x = (x + v484); + x = (x + v485); + x = (x + v486); + x = (x + v487); + x = (x + v488); + x = (x + v489); + x = (x + v490); + x = (x + v491); + x = (x + v492); + x = (x + v493); + x = (x + v494); + x = (x + v495); + x = (x + v496); + x = (x + v497); + x = (x + v498); + x = (x + v499); + x = (x + v500); + x = (x + v501); + x = (x + v502); + x = (x + v503); + x = (x + v504); + x = (x + v505); + x = (x + v506); + x = (x + v507); + x = (x + v508); + x = (x + v509); + x = (x + v510); + x = (x + v511); + x = (x + v512); + x = (x + v513); + x = (x + v514); + x = (x + v515); + x = (x + v516); + x = (x + v517); + x = (x + v518); + x = (x + v519); + x = (x + v520); + x = (x + v521); + x = (x + v522); + x = (x + v523); + x = (x + v524); + x = (x + v525); + x = (x + v526); + x = (x + v527); + x = (x + v528); + x = (x + v529); + x = (x + v530); + x = (x + v531); + x = (x + v532); + x = (x + v533); + x = (x + v534); + x = (x + v535); + x = (x + v536); + x = (x + v537); + x = (x + v538); + x = (x + v539); + x = (x + v540); + x = (x + v541); + x = (x + v542); + x = (x + v543); + x = (x + v544); + x = (x + v545); + x = (x + v546); + x = (x + v547); + x = (x + v548); + x = (x + v549); + x = (x + v550); + x = (x + v551); + x = (x + v552); + x = (x + v553); + x = (x + v554); + x = (x + v555); + x = (x + v556); + x = (x + v557); + x = (x + v558); + x = (x + v559); + x = (x + v560); + x = (x + v561); + x = (x + v562); + x = (x + v563); + x = (x + v564); + x = (x + v565); + x = (x + v566); + x = (x + v567); + x = (x + v568); + x = (x + v569); + x = (x + v570); + x = (x + v571); + x = (x + v572); + x = (x + v573); + x = (x + v574); + x = (x + v575); + x = (x + v576); + x = (x + v577); + x = (x + v578); + x = (x + v579); + x = (x + v580); + x = (x + v581); + x = (x + v582); + x = (x + v583); + x = (x + v584); + x = (x + v585); + x = (x + v586); + x = (x + v587); + x = (x + v588); + x = (x + v589); + x = (x + v590); + x = (x + v591); + x = (x + v592); + x = (x + v593); + x = (x + v594); + x = (x + v595); + x = (x + v596); + x = (x + v597); + x = (x + v598); + x = (x + v599); + x = (x + v600); + x = (x + v601); + x = (x + v602); + x = (x + v603); + x = (x + v604); + x = (x + v605); + x = (x + v606); + x = (x + v607); + x = (x + v608); + x = (x + v609); + x = (x + v610); + x = (x + v611); + x = (x + v612); + x = (x + v613); + x = (x + v614); + x = (x + v615); + x = (x + v616); + x = (x + v617); + x = (x + v618); + x = (x + v619); + x = (x + v620); + x = (x + v621); + x = (x + v622); + x = (x + v623); + x = (x + v624); + x = (x + v625); + x = (x + v626); + x = (x + v627); + x = (x + v628); + x = (x + v629); + x = (x + v630); + x = (x + v631); + x = (x + v632); + x = (x + v633); + x = (x + v634); + x = (x + v635); + x = (x + v636); + x = (x + v637); + x = (x + v638); + x = (x + v639); + x = (x + v640); + x = (x + v641); + x = (x + v642); + x = (x + v643); + x = (x + v644); + x = (x + v645); + x = (x + v646); + x = (x + v647); + x = (x + v648); + x = (x + v649); + x = (x + v650); + x = (x + v651); + x = (x + v652); + x = (x + v653); + x = (x + v654); + x = (x + v655); + x = (x + v656); + x = (x + v657); + x = (x + v658); + x = (x + v659); + x = (x + v660); + x = (x + v661); + x = (x + v662); + x = (x + v663); + x = (x + v664); + x = (x + v665); + x = (x + v666); + x = (x + v667); + x = (x + v668); + x = (x + v669); + x = (x + v670); + x = (x + v671); + x = (x + v672); + x = (x + v673); + x = (x + v674); + x = (x + v675); + x = (x + v676); + x = (x + v677); + x = (x + v678); + x = (x + v679); + x = (x + v680); + x = (x + v681); + x = (x + v682); + x = (x + v683); + x = (x + v684); + x = (x + v685); + x = (x + v686); + x = (x + v687); + x = (x + v688); + x = (x + v689); + x = (x + v690); + x = (x + v691); + x = (x + v692); + x = (x + v693); + x = (x + v694); + x = (x + v695); + x = (x + v696); + x = (x + v697); + x = (x + v698); + x = (x + v699); + x = (x + v700); + x = (x + v701); + x = (x + v702); + x = (x + v703); + x = (x + v704); + x = (x + v705); + x = (x + v706); + x = (x + v707); + x = (x + v708); + x = (x + v709); + x = (x + v710); + x = (x + v711); + x = (x + v712); + x = (x + v713); + x = (x + v714); + x = (x + v715); + x = (x + v716); + x = (x + v717); + x = (x + v718); + x = (x + v719); + x = (x + v720); + x = (x + v721); + x = (x + v722); + x = (x + v723); + x = (x + v724); + x = (x + v725); + x = (x + v726); + x = (x + v727); + x = (x + v728); + x = (x + v729); + x = (x + v730); + x = (x + v731); + x = (x + v732); + x = (x + v733); + x = (x + v734); + x = (x + v735); + x = (x + v736); + x = (x + v737); + x = (x + v738); + x = (x + v739); + x = (x + v740); + x = (x + v741); + x = (x + v742); + x = (x + v743); + x = (x + v744); + x = (x + v745); + x = (x + v746); + x = (x + v747); + x = (x + v748); + x = (x + v749); + x = (x + v750); + x = (x + v751); + x = (x + v752); + x = (x + v753); + x = (x + v754); + x = (x + v755); + x = (x + v756); + x = (x + v757); + x = (x + v758); + x = (x + v759); + x = (x + v760); + x = (x + v761); + x = (x + v762); + x = (x + v763); + x = (x + v764); + x = (x + v765); + x = (x + v766); + x = (x + v767); + x = (x + v768); + x = (x + v769); + x = (x + v770); + x = (x + v771); + x = (x + v772); + x = (x + v773); + x = (x + v774); + x = (x + v775); + x = (x + v776); + x = (x + v777); + x = (x + v778); + x = (x + v779); + x = (x + v780); + x = (x + v781); + x = (x + v782); + x = (x + v783); + x = (x + v784); + x = (x + v785); + x = (x + v786); + x = (x + v787); + x = (x + v788); + x = (x + v789); + x = (x + v790); + x = (x + v791); + x = (x + v792); + x = (x + v793); + x = (x + v794); + x = (x + v795); + x = (x + v796); + x = (x + v797); + x = (x + v798); + x = (x + v799); + x = (x + v800); + x = (x + v801); + x = (x + v802); + x = (x + v803); + x = (x + v804); + x = (x + v805); + x = (x + v806); + x = (x + v807); + x = (x + v808); + x = (x + v809); + x = (x + v810); + x = (x + v811); + x = (x + v812); + x = (x + v813); + x = (x + v814); + x = (x + v815); + x = (x + v816); + x = (x + v817); + x = (x + v818); + x = (x + v819); + x = (x + v820); + x = (x + v821); + x = (x + v822); + x = (x + v823); + x = (x + v824); + x = (x + v825); + x = (x + v826); + x = (x + v827); + x = (x + v828); + x = (x + v829); + x = (x + v830); + x = (x + v831); + x = (x + v832); + x = (x + v833); + x = (x + v834); + x = (x + v835); + x = (x + v836); + x = (x + v837); + x = (x + v838); + x = (x + v839); + x = (x + v840); + x = (x + v841); + x = (x + v842); + x = (x + v843); + x = (x + v844); + x = (x + v845); + x = (x + v846); + x = (x + v847); + x = (x + v848); + x = (x + v849); + x = (x + v850); + x = (x + v851); + x = (x + v852); + x = (x + v853); + x = (x + v854); + x = (x + v855); + x = (x + v856); + x = (x + v857); + x = (x + v858); + x = (x + v859); + x = (x + v860); + x = (x + v861); + x = (x + v862); + x = (x + v863); + x = (x + v864); + x = (x + v865); + x = (x + v866); + x = (x + v867); + x = (x + v868); + x = (x + v869); + x = (x + v870); + x = (x + v871); + x = (x + v872); + x = (x + v873); + x = (x + v874); + x = (x + v875); + x = (x + v876); + x = (x + v877); + x = (x + v878); + x = (x + v879); + x = (x + v880); + x = (x + v881); + x = (x + v882); + x = (x + v883); + x = (x + v884); + x = (x + v885); + x = (x + v886); + x = (x + v887); + x = (x + v888); + x = (x + v889); + x = (x + v890); + x = (x + v891); + x = (x + v892); + x = (x + v893); + x = (x + v894); + x = (x + v895); + x = (x + v896); + x = (x + v897); + x = (x + v898); + x = (x + v899); + x = (x + v900); + x = (x + v901); + x = (x + v902); + x = (x + v903); + x = (x + v904); + x = (x + v905); + x = (x + v906); + x = (x + v907); + x = (x + v908); + x = (x + v909); + x = (x + v910); + x = (x + v911); + x = (x + v912); + x = (x + v913); + x = (x + v914); + x = (x + v915); + x = (x + v916); + x = (x + v917); + x = (x + v918); + x = (x + v919); + x = (x + v920); + x = (x + v921); + x = (x + v922); + x = (x + v923); + x = (x + v924); + x = (x + v925); + x = (x + v926); + x = (x + v927); + x = (x + v928); + x = (x + v929); + x = (x + v930); + x = (x + v931); + x = (x + v932); + x = (x + v933); + x = (x + v934); + x = (x + v935); + x = (x + v936); + x = (x + v937); + x = (x + v938); + x = (x + v939); + x = (x + v940); + x = (x + v941); + x = (x + v942); + x = (x + v943); + x = (x + v944); + x = (x + v945); + x = (x + v946); + x = (x + v947); + x = (x + v948); + x = (x + v949); + x = (x + v950); + x = (x + v951); + x = (x + v952); + x = (x + v953); + x = (x + v954); + x = (x + v955); + x = (x + v956); + x = (x + v957); + x = (x + v958); + x = (x + v959); + x = (x + v960); + x = (x + v961); + x = (x + v962); + x = (x + v963); + x = (x + v964); + x = (x + v965); + x = (x + v966); + x = (x + v967); + x = (x + v968); + x = (x + v969); + x = (x + v970); + x = (x + v971); + x = (x + v972); + x = (x + v973); + x = (x + v974); + x = (x + v975); + x = (x + v976); + x = (x + v977); + x = (x + v978); + x = (x + v979); + x = (x + v980); + x = (x + v981); + x = (x + v982); + x = (x + v983); + x = (x + v984); + x = (x + v985); + x = (x + v986); + x = (x + v987); + x = (x + v988); + x = (x + v989); + x = (x + v990); + x = (x + v991); + x = (x + v992); + x = (x + v993); + x = (x + v994); + x = (x + v995); + x = (x + v996); + x = (x + v997); + x = (x + v998); + x = (x + v999); + return x; +} + +struct tint_symbol { + uint value : SV_Target0; +}; + +uint main_inner() { + return foo(); +} + +tint_symbol main() { + const uint inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1509.wgsl.expected.glsl b/test/tint/bug/tint/1509.wgsl.expected.glsl new file mode 100644 index 0000000000..30dbc951a9 --- /dev/null +++ b/test/tint/bug/tint/1509.wgsl.expected.glsl @@ -0,0 +1,2018 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out uint value; +uint v0 = 0u; +uint v1 = 0u; +uint v2 = 0u; +uint v3 = 0u; +uint v4 = 0u; +uint v5 = 0u; +uint v6 = 0u; +uint v7 = 0u; +uint v8 = 0u; +uint v9 = 0u; +uint v10 = 0u; +uint v11 = 0u; +uint v12 = 0u; +uint v13 = 0u; +uint v14 = 0u; +uint v15 = 0u; +uint v16 = 0u; +uint v17 = 0u; +uint v18 = 0u; +uint v19 = 0u; +uint v20 = 0u; +uint v21 = 0u; +uint v22 = 0u; +uint v23 = 0u; +uint v24 = 0u; +uint v25 = 0u; +uint v26 = 0u; +uint v27 = 0u; +uint v28 = 0u; +uint v29 = 0u; +uint v30 = 0u; +uint v31 = 0u; +uint v32 = 0u; +uint v33 = 0u; +uint v34 = 0u; +uint v35 = 0u; +uint v36 = 0u; +uint v37 = 0u; +uint v38 = 0u; +uint v39 = 0u; +uint v40 = 0u; +uint v41 = 0u; +uint v42 = 0u; +uint v43 = 0u; +uint v44 = 0u; +uint v45 = 0u; +uint v46 = 0u; +uint v47 = 0u; +uint v48 = 0u; +uint v49 = 0u; +uint v50 = 0u; +uint v51 = 0u; +uint v52 = 0u; +uint v53 = 0u; +uint v54 = 0u; +uint v55 = 0u; +uint v56 = 0u; +uint v57 = 0u; +uint v58 = 0u; +uint v59 = 0u; +uint v60 = 0u; +uint v61 = 0u; +uint v62 = 0u; +uint v63 = 0u; +uint v64 = 0u; +uint v65 = 0u; +uint v66 = 0u; +uint v67 = 0u; +uint v68 = 0u; +uint v69 = 0u; +uint v70 = 0u; +uint v71 = 0u; +uint v72 = 0u; +uint v73 = 0u; +uint v74 = 0u; +uint v75 = 0u; +uint v76 = 0u; +uint v77 = 0u; +uint v78 = 0u; +uint v79 = 0u; +uint v80 = 0u; +uint v81 = 0u; +uint v82 = 0u; +uint v83 = 0u; +uint v84 = 0u; +uint v85 = 0u; +uint v86 = 0u; +uint v87 = 0u; +uint v88 = 0u; +uint v89 = 0u; +uint v90 = 0u; +uint v91 = 0u; +uint v92 = 0u; +uint v93 = 0u; +uint v94 = 0u; +uint v95 = 0u; +uint v96 = 0u; +uint v97 = 0u; +uint v98 = 0u; +uint v99 = 0u; +uint v100 = 0u; +uint v101 = 0u; +uint v102 = 0u; +uint v103 = 0u; +uint v104 = 0u; +uint v105 = 0u; +uint v106 = 0u; +uint v107 = 0u; +uint v108 = 0u; +uint v109 = 0u; +uint v110 = 0u; +uint v111 = 0u; +uint v112 = 0u; +uint v113 = 0u; +uint v114 = 0u; +uint v115 = 0u; +uint v116 = 0u; +uint v117 = 0u; +uint v118 = 0u; +uint v119 = 0u; +uint v120 = 0u; +uint v121 = 0u; +uint v122 = 0u; +uint v123 = 0u; +uint v124 = 0u; +uint v125 = 0u; +uint v126 = 0u; +uint v127 = 0u; +uint v128 = 0u; +uint v129 = 0u; +uint v130 = 0u; +uint v131 = 0u; +uint v132 = 0u; +uint v133 = 0u; +uint v134 = 0u; +uint v135 = 0u; +uint v136 = 0u; +uint v137 = 0u; +uint v138 = 0u; +uint v139 = 0u; +uint v140 = 0u; +uint v141 = 0u; +uint v142 = 0u; +uint v143 = 0u; +uint v144 = 0u; +uint v145 = 0u; +uint v146 = 0u; +uint v147 = 0u; +uint v148 = 0u; +uint v149 = 0u; +uint v150 = 0u; +uint v151 = 0u; +uint v152 = 0u; +uint v153 = 0u; +uint v154 = 0u; +uint v155 = 0u; +uint v156 = 0u; +uint v157 = 0u; +uint v158 = 0u; +uint v159 = 0u; +uint v160 = 0u; +uint v161 = 0u; +uint v162 = 0u; +uint v163 = 0u; +uint v164 = 0u; +uint v165 = 0u; +uint v166 = 0u; +uint v167 = 0u; +uint v168 = 0u; +uint v169 = 0u; +uint v170 = 0u; +uint v171 = 0u; +uint v172 = 0u; +uint v173 = 0u; +uint v174 = 0u; +uint v175 = 0u; +uint v176 = 0u; +uint v177 = 0u; +uint v178 = 0u; +uint v179 = 0u; +uint v180 = 0u; +uint v181 = 0u; +uint v182 = 0u; +uint v183 = 0u; +uint v184 = 0u; +uint v185 = 0u; +uint v186 = 0u; +uint v187 = 0u; +uint v188 = 0u; +uint v189 = 0u; +uint v190 = 0u; +uint v191 = 0u; +uint v192 = 0u; +uint v193 = 0u; +uint v194 = 0u; +uint v195 = 0u; +uint v196 = 0u; +uint v197 = 0u; +uint v198 = 0u; +uint v199 = 0u; +uint v200 = 0u; +uint v201 = 0u; +uint v202 = 0u; +uint v203 = 0u; +uint v204 = 0u; +uint v205 = 0u; +uint v206 = 0u; +uint v207 = 0u; +uint v208 = 0u; +uint v209 = 0u; +uint v210 = 0u; +uint v211 = 0u; +uint v212 = 0u; +uint v213 = 0u; +uint v214 = 0u; +uint v215 = 0u; +uint v216 = 0u; +uint v217 = 0u; +uint v218 = 0u; +uint v219 = 0u; +uint v220 = 0u; +uint v221 = 0u; +uint v222 = 0u; +uint v223 = 0u; +uint v224 = 0u; +uint v225 = 0u; +uint v226 = 0u; +uint v227 = 0u; +uint v228 = 0u; +uint v229 = 0u; +uint v230 = 0u; +uint v231 = 0u; +uint v232 = 0u; +uint v233 = 0u; +uint v234 = 0u; +uint v235 = 0u; +uint v236 = 0u; +uint v237 = 0u; +uint v238 = 0u; +uint v239 = 0u; +uint v240 = 0u; +uint v241 = 0u; +uint v242 = 0u; +uint v243 = 0u; +uint v244 = 0u; +uint v245 = 0u; +uint v246 = 0u; +uint v247 = 0u; +uint v248 = 0u; +uint v249 = 0u; +uint v250 = 0u; +uint v251 = 0u; +uint v252 = 0u; +uint v253 = 0u; +uint v254 = 0u; +uint v255 = 0u; +uint v256 = 0u; +uint v257 = 0u; +uint v258 = 0u; +uint v259 = 0u; +uint v260 = 0u; +uint v261 = 0u; +uint v262 = 0u; +uint v263 = 0u; +uint v264 = 0u; +uint v265 = 0u; +uint v266 = 0u; +uint v267 = 0u; +uint v268 = 0u; +uint v269 = 0u; +uint v270 = 0u; +uint v271 = 0u; +uint v272 = 0u; +uint v273 = 0u; +uint v274 = 0u; +uint v275 = 0u; +uint v276 = 0u; +uint v277 = 0u; +uint v278 = 0u; +uint v279 = 0u; +uint v280 = 0u; +uint v281 = 0u; +uint v282 = 0u; +uint v283 = 0u; +uint v284 = 0u; +uint v285 = 0u; +uint v286 = 0u; +uint v287 = 0u; +uint v288 = 0u; +uint v289 = 0u; +uint v290 = 0u; +uint v291 = 0u; +uint v292 = 0u; +uint v293 = 0u; +uint v294 = 0u; +uint v295 = 0u; +uint v296 = 0u; +uint v297 = 0u; +uint v298 = 0u; +uint v299 = 0u; +uint v300 = 0u; +uint v301 = 0u; +uint v302 = 0u; +uint v303 = 0u; +uint v304 = 0u; +uint v305 = 0u; +uint v306 = 0u; +uint v307 = 0u; +uint v308 = 0u; +uint v309 = 0u; +uint v310 = 0u; +uint v311 = 0u; +uint v312 = 0u; +uint v313 = 0u; +uint v314 = 0u; +uint v315 = 0u; +uint v316 = 0u; +uint v317 = 0u; +uint v318 = 0u; +uint v319 = 0u; +uint v320 = 0u; +uint v321 = 0u; +uint v322 = 0u; +uint v323 = 0u; +uint v324 = 0u; +uint v325 = 0u; +uint v326 = 0u; +uint v327 = 0u; +uint v328 = 0u; +uint v329 = 0u; +uint v330 = 0u; +uint v331 = 0u; +uint v332 = 0u; +uint v333 = 0u; +uint v334 = 0u; +uint v335 = 0u; +uint v336 = 0u; +uint v337 = 0u; +uint v338 = 0u; +uint v339 = 0u; +uint v340 = 0u; +uint v341 = 0u; +uint v342 = 0u; +uint v343 = 0u; +uint v344 = 0u; +uint v345 = 0u; +uint v346 = 0u; +uint v347 = 0u; +uint v348 = 0u; +uint v349 = 0u; +uint v350 = 0u; +uint v351 = 0u; +uint v352 = 0u; +uint v353 = 0u; +uint v354 = 0u; +uint v355 = 0u; +uint v356 = 0u; +uint v357 = 0u; +uint v358 = 0u; +uint v359 = 0u; +uint v360 = 0u; +uint v361 = 0u; +uint v362 = 0u; +uint v363 = 0u; +uint v364 = 0u; +uint v365 = 0u; +uint v366 = 0u; +uint v367 = 0u; +uint v368 = 0u; +uint v369 = 0u; +uint v370 = 0u; +uint v371 = 0u; +uint v372 = 0u; +uint v373 = 0u; +uint v374 = 0u; +uint v375 = 0u; +uint v376 = 0u; +uint v377 = 0u; +uint v378 = 0u; +uint v379 = 0u; +uint v380 = 0u; +uint v381 = 0u; +uint v382 = 0u; +uint v383 = 0u; +uint v384 = 0u; +uint v385 = 0u; +uint v386 = 0u; +uint v387 = 0u; +uint v388 = 0u; +uint v389 = 0u; +uint v390 = 0u; +uint v391 = 0u; +uint v392 = 0u; +uint v393 = 0u; +uint v394 = 0u; +uint v395 = 0u; +uint v396 = 0u; +uint v397 = 0u; +uint v398 = 0u; +uint v399 = 0u; +uint v400 = 0u; +uint v401 = 0u; +uint v402 = 0u; +uint v403 = 0u; +uint v404 = 0u; +uint v405 = 0u; +uint v406 = 0u; +uint v407 = 0u; +uint v408 = 0u; +uint v409 = 0u; +uint v410 = 0u; +uint v411 = 0u; +uint v412 = 0u; +uint v413 = 0u; +uint v414 = 0u; +uint v415 = 0u; +uint v416 = 0u; +uint v417 = 0u; +uint v418 = 0u; +uint v419 = 0u; +uint v420 = 0u; +uint v421 = 0u; +uint v422 = 0u; +uint v423 = 0u; +uint v424 = 0u; +uint v425 = 0u; +uint v426 = 0u; +uint v427 = 0u; +uint v428 = 0u; +uint v429 = 0u; +uint v430 = 0u; +uint v431 = 0u; +uint v432 = 0u; +uint v433 = 0u; +uint v434 = 0u; +uint v435 = 0u; +uint v436 = 0u; +uint v437 = 0u; +uint v438 = 0u; +uint v439 = 0u; +uint v440 = 0u; +uint v441 = 0u; +uint v442 = 0u; +uint v443 = 0u; +uint v444 = 0u; +uint v445 = 0u; +uint v446 = 0u; +uint v447 = 0u; +uint v448 = 0u; +uint v449 = 0u; +uint v450 = 0u; +uint v451 = 0u; +uint v452 = 0u; +uint v453 = 0u; +uint v454 = 0u; +uint v455 = 0u; +uint v456 = 0u; +uint v457 = 0u; +uint v458 = 0u; +uint v459 = 0u; +uint v460 = 0u; +uint v461 = 0u; +uint v462 = 0u; +uint v463 = 0u; +uint v464 = 0u; +uint v465 = 0u; +uint v466 = 0u; +uint v467 = 0u; +uint v468 = 0u; +uint v469 = 0u; +uint v470 = 0u; +uint v471 = 0u; +uint v472 = 0u; +uint v473 = 0u; +uint v474 = 0u; +uint v475 = 0u; +uint v476 = 0u; +uint v477 = 0u; +uint v478 = 0u; +uint v479 = 0u; +uint v480 = 0u; +uint v481 = 0u; +uint v482 = 0u; +uint v483 = 0u; +uint v484 = 0u; +uint v485 = 0u; +uint v486 = 0u; +uint v487 = 0u; +uint v488 = 0u; +uint v489 = 0u; +uint v490 = 0u; +uint v491 = 0u; +uint v492 = 0u; +uint v493 = 0u; +uint v494 = 0u; +uint v495 = 0u; +uint v496 = 0u; +uint v497 = 0u; +uint v498 = 0u; +uint v499 = 0u; +uint v500 = 0u; +uint v501 = 0u; +uint v502 = 0u; +uint v503 = 0u; +uint v504 = 0u; +uint v505 = 0u; +uint v506 = 0u; +uint v507 = 0u; +uint v508 = 0u; +uint v509 = 0u; +uint v510 = 0u; +uint v511 = 0u; +uint v512 = 0u; +uint v513 = 0u; +uint v514 = 0u; +uint v515 = 0u; +uint v516 = 0u; +uint v517 = 0u; +uint v518 = 0u; +uint v519 = 0u; +uint v520 = 0u; +uint v521 = 0u; +uint v522 = 0u; +uint v523 = 0u; +uint v524 = 0u; +uint v525 = 0u; +uint v526 = 0u; +uint v527 = 0u; +uint v528 = 0u; +uint v529 = 0u; +uint v530 = 0u; +uint v531 = 0u; +uint v532 = 0u; +uint v533 = 0u; +uint v534 = 0u; +uint v535 = 0u; +uint v536 = 0u; +uint v537 = 0u; +uint v538 = 0u; +uint v539 = 0u; +uint v540 = 0u; +uint v541 = 0u; +uint v542 = 0u; +uint v543 = 0u; +uint v544 = 0u; +uint v545 = 0u; +uint v546 = 0u; +uint v547 = 0u; +uint v548 = 0u; +uint v549 = 0u; +uint v550 = 0u; +uint v551 = 0u; +uint v552 = 0u; +uint v553 = 0u; +uint v554 = 0u; +uint v555 = 0u; +uint v556 = 0u; +uint v557 = 0u; +uint v558 = 0u; +uint v559 = 0u; +uint v560 = 0u; +uint v561 = 0u; +uint v562 = 0u; +uint v563 = 0u; +uint v564 = 0u; +uint v565 = 0u; +uint v566 = 0u; +uint v567 = 0u; +uint v568 = 0u; +uint v569 = 0u; +uint v570 = 0u; +uint v571 = 0u; +uint v572 = 0u; +uint v573 = 0u; +uint v574 = 0u; +uint v575 = 0u; +uint v576 = 0u; +uint v577 = 0u; +uint v578 = 0u; +uint v579 = 0u; +uint v580 = 0u; +uint v581 = 0u; +uint v582 = 0u; +uint v583 = 0u; +uint v584 = 0u; +uint v585 = 0u; +uint v586 = 0u; +uint v587 = 0u; +uint v588 = 0u; +uint v589 = 0u; +uint v590 = 0u; +uint v591 = 0u; +uint v592 = 0u; +uint v593 = 0u; +uint v594 = 0u; +uint v595 = 0u; +uint v596 = 0u; +uint v597 = 0u; +uint v598 = 0u; +uint v599 = 0u; +uint v600 = 0u; +uint v601 = 0u; +uint v602 = 0u; +uint v603 = 0u; +uint v604 = 0u; +uint v605 = 0u; +uint v606 = 0u; +uint v607 = 0u; +uint v608 = 0u; +uint v609 = 0u; +uint v610 = 0u; +uint v611 = 0u; +uint v612 = 0u; +uint v613 = 0u; +uint v614 = 0u; +uint v615 = 0u; +uint v616 = 0u; +uint v617 = 0u; +uint v618 = 0u; +uint v619 = 0u; +uint v620 = 0u; +uint v621 = 0u; +uint v622 = 0u; +uint v623 = 0u; +uint v624 = 0u; +uint v625 = 0u; +uint v626 = 0u; +uint v627 = 0u; +uint v628 = 0u; +uint v629 = 0u; +uint v630 = 0u; +uint v631 = 0u; +uint v632 = 0u; +uint v633 = 0u; +uint v634 = 0u; +uint v635 = 0u; +uint v636 = 0u; +uint v637 = 0u; +uint v638 = 0u; +uint v639 = 0u; +uint v640 = 0u; +uint v641 = 0u; +uint v642 = 0u; +uint v643 = 0u; +uint v644 = 0u; +uint v645 = 0u; +uint v646 = 0u; +uint v647 = 0u; +uint v648 = 0u; +uint v649 = 0u; +uint v650 = 0u; +uint v651 = 0u; +uint v652 = 0u; +uint v653 = 0u; +uint v654 = 0u; +uint v655 = 0u; +uint v656 = 0u; +uint v657 = 0u; +uint v658 = 0u; +uint v659 = 0u; +uint v660 = 0u; +uint v661 = 0u; +uint v662 = 0u; +uint v663 = 0u; +uint v664 = 0u; +uint v665 = 0u; +uint v666 = 0u; +uint v667 = 0u; +uint v668 = 0u; +uint v669 = 0u; +uint v670 = 0u; +uint v671 = 0u; +uint v672 = 0u; +uint v673 = 0u; +uint v674 = 0u; +uint v675 = 0u; +uint v676 = 0u; +uint v677 = 0u; +uint v678 = 0u; +uint v679 = 0u; +uint v680 = 0u; +uint v681 = 0u; +uint v682 = 0u; +uint v683 = 0u; +uint v684 = 0u; +uint v685 = 0u; +uint v686 = 0u; +uint v687 = 0u; +uint v688 = 0u; +uint v689 = 0u; +uint v690 = 0u; +uint v691 = 0u; +uint v692 = 0u; +uint v693 = 0u; +uint v694 = 0u; +uint v695 = 0u; +uint v696 = 0u; +uint v697 = 0u; +uint v698 = 0u; +uint v699 = 0u; +uint v700 = 0u; +uint v701 = 0u; +uint v702 = 0u; +uint v703 = 0u; +uint v704 = 0u; +uint v705 = 0u; +uint v706 = 0u; +uint v707 = 0u; +uint v708 = 0u; +uint v709 = 0u; +uint v710 = 0u; +uint v711 = 0u; +uint v712 = 0u; +uint v713 = 0u; +uint v714 = 0u; +uint v715 = 0u; +uint v716 = 0u; +uint v717 = 0u; +uint v718 = 0u; +uint v719 = 0u; +uint v720 = 0u; +uint v721 = 0u; +uint v722 = 0u; +uint v723 = 0u; +uint v724 = 0u; +uint v725 = 0u; +uint v726 = 0u; +uint v727 = 0u; +uint v728 = 0u; +uint v729 = 0u; +uint v730 = 0u; +uint v731 = 0u; +uint v732 = 0u; +uint v733 = 0u; +uint v734 = 0u; +uint v735 = 0u; +uint v736 = 0u; +uint v737 = 0u; +uint v738 = 0u; +uint v739 = 0u; +uint v740 = 0u; +uint v741 = 0u; +uint v742 = 0u; +uint v743 = 0u; +uint v744 = 0u; +uint v745 = 0u; +uint v746 = 0u; +uint v747 = 0u; +uint v748 = 0u; +uint v749 = 0u; +uint v750 = 0u; +uint v751 = 0u; +uint v752 = 0u; +uint v753 = 0u; +uint v754 = 0u; +uint v755 = 0u; +uint v756 = 0u; +uint v757 = 0u; +uint v758 = 0u; +uint v759 = 0u; +uint v760 = 0u; +uint v761 = 0u; +uint v762 = 0u; +uint v763 = 0u; +uint v764 = 0u; +uint v765 = 0u; +uint v766 = 0u; +uint v767 = 0u; +uint v768 = 0u; +uint v769 = 0u; +uint v770 = 0u; +uint v771 = 0u; +uint v772 = 0u; +uint v773 = 0u; +uint v774 = 0u; +uint v775 = 0u; +uint v776 = 0u; +uint v777 = 0u; +uint v778 = 0u; +uint v779 = 0u; +uint v780 = 0u; +uint v781 = 0u; +uint v782 = 0u; +uint v783 = 0u; +uint v784 = 0u; +uint v785 = 0u; +uint v786 = 0u; +uint v787 = 0u; +uint v788 = 0u; +uint v789 = 0u; +uint v790 = 0u; +uint v791 = 0u; +uint v792 = 0u; +uint v793 = 0u; +uint v794 = 0u; +uint v795 = 0u; +uint v796 = 0u; +uint v797 = 0u; +uint v798 = 0u; +uint v799 = 0u; +uint v800 = 0u; +uint v801 = 0u; +uint v802 = 0u; +uint v803 = 0u; +uint v804 = 0u; +uint v805 = 0u; +uint v806 = 0u; +uint v807 = 0u; +uint v808 = 0u; +uint v809 = 0u; +uint v810 = 0u; +uint v811 = 0u; +uint v812 = 0u; +uint v813 = 0u; +uint v814 = 0u; +uint v815 = 0u; +uint v816 = 0u; +uint v817 = 0u; +uint v818 = 0u; +uint v819 = 0u; +uint v820 = 0u; +uint v821 = 0u; +uint v822 = 0u; +uint v823 = 0u; +uint v824 = 0u; +uint v825 = 0u; +uint v826 = 0u; +uint v827 = 0u; +uint v828 = 0u; +uint v829 = 0u; +uint v830 = 0u; +uint v831 = 0u; +uint v832 = 0u; +uint v833 = 0u; +uint v834 = 0u; +uint v835 = 0u; +uint v836 = 0u; +uint v837 = 0u; +uint v838 = 0u; +uint v839 = 0u; +uint v840 = 0u; +uint v841 = 0u; +uint v842 = 0u; +uint v843 = 0u; +uint v844 = 0u; +uint v845 = 0u; +uint v846 = 0u; +uint v847 = 0u; +uint v848 = 0u; +uint v849 = 0u; +uint v850 = 0u; +uint v851 = 0u; +uint v852 = 0u; +uint v853 = 0u; +uint v854 = 0u; +uint v855 = 0u; +uint v856 = 0u; +uint v857 = 0u; +uint v858 = 0u; +uint v859 = 0u; +uint v860 = 0u; +uint v861 = 0u; +uint v862 = 0u; +uint v863 = 0u; +uint v864 = 0u; +uint v865 = 0u; +uint v866 = 0u; +uint v867 = 0u; +uint v868 = 0u; +uint v869 = 0u; +uint v870 = 0u; +uint v871 = 0u; +uint v872 = 0u; +uint v873 = 0u; +uint v874 = 0u; +uint v875 = 0u; +uint v876 = 0u; +uint v877 = 0u; +uint v878 = 0u; +uint v879 = 0u; +uint v880 = 0u; +uint v881 = 0u; +uint v882 = 0u; +uint v883 = 0u; +uint v884 = 0u; +uint v885 = 0u; +uint v886 = 0u; +uint v887 = 0u; +uint v888 = 0u; +uint v889 = 0u; +uint v890 = 0u; +uint v891 = 0u; +uint v892 = 0u; +uint v893 = 0u; +uint v894 = 0u; +uint v895 = 0u; +uint v896 = 0u; +uint v897 = 0u; +uint v898 = 0u; +uint v899 = 0u; +uint v900 = 0u; +uint v901 = 0u; +uint v902 = 0u; +uint v903 = 0u; +uint v904 = 0u; +uint v905 = 0u; +uint v906 = 0u; +uint v907 = 0u; +uint v908 = 0u; +uint v909 = 0u; +uint v910 = 0u; +uint v911 = 0u; +uint v912 = 0u; +uint v913 = 0u; +uint v914 = 0u; +uint v915 = 0u; +uint v916 = 0u; +uint v917 = 0u; +uint v918 = 0u; +uint v919 = 0u; +uint v920 = 0u; +uint v921 = 0u; +uint v922 = 0u; +uint v923 = 0u; +uint v924 = 0u; +uint v925 = 0u; +uint v926 = 0u; +uint v927 = 0u; +uint v928 = 0u; +uint v929 = 0u; +uint v930 = 0u; +uint v931 = 0u; +uint v932 = 0u; +uint v933 = 0u; +uint v934 = 0u; +uint v935 = 0u; +uint v936 = 0u; +uint v937 = 0u; +uint v938 = 0u; +uint v939 = 0u; +uint v940 = 0u; +uint v941 = 0u; +uint v942 = 0u; +uint v943 = 0u; +uint v944 = 0u; +uint v945 = 0u; +uint v946 = 0u; +uint v947 = 0u; +uint v948 = 0u; +uint v949 = 0u; +uint v950 = 0u; +uint v951 = 0u; +uint v952 = 0u; +uint v953 = 0u; +uint v954 = 0u; +uint v955 = 0u; +uint v956 = 0u; +uint v957 = 0u; +uint v958 = 0u; +uint v959 = 0u; +uint v960 = 0u; +uint v961 = 0u; +uint v962 = 0u; +uint v963 = 0u; +uint v964 = 0u; +uint v965 = 0u; +uint v966 = 0u; +uint v967 = 0u; +uint v968 = 0u; +uint v969 = 0u; +uint v970 = 0u; +uint v971 = 0u; +uint v972 = 0u; +uint v973 = 0u; +uint v974 = 0u; +uint v975 = 0u; +uint v976 = 0u; +uint v977 = 0u; +uint v978 = 0u; +uint v979 = 0u; +uint v980 = 0u; +uint v981 = 0u; +uint v982 = 0u; +uint v983 = 0u; +uint v984 = 0u; +uint v985 = 0u; +uint v986 = 0u; +uint v987 = 0u; +uint v988 = 0u; +uint v989 = 0u; +uint v990 = 0u; +uint v991 = 0u; +uint v992 = 0u; +uint v993 = 0u; +uint v994 = 0u; +uint v995 = 0u; +uint v996 = 0u; +uint v997 = 0u; +uint v998 = 0u; +uint v999 = 0u; +uint foo() { + uint x = 0u; + x = (x + v0); + x = (x + v1); + x = (x + v2); + x = (x + v3); + x = (x + v4); + x = (x + v5); + x = (x + v6); + x = (x + v7); + x = (x + v8); + x = (x + v9); + x = (x + v10); + x = (x + v11); + x = (x + v12); + x = (x + v13); + x = (x + v14); + x = (x + v15); + x = (x + v16); + x = (x + v17); + x = (x + v18); + x = (x + v19); + x = (x + v20); + x = (x + v21); + x = (x + v22); + x = (x + v23); + x = (x + v24); + x = (x + v25); + x = (x + v26); + x = (x + v27); + x = (x + v28); + x = (x + v29); + x = (x + v30); + x = (x + v31); + x = (x + v32); + x = (x + v33); + x = (x + v34); + x = (x + v35); + x = (x + v36); + x = (x + v37); + x = (x + v38); + x = (x + v39); + x = (x + v40); + x = (x + v41); + x = (x + v42); + x = (x + v43); + x = (x + v44); + x = (x + v45); + x = (x + v46); + x = (x + v47); + x = (x + v48); + x = (x + v49); + x = (x + v50); + x = (x + v51); + x = (x + v52); + x = (x + v53); + x = (x + v54); + x = (x + v55); + x = (x + v56); + x = (x + v57); + x = (x + v58); + x = (x + v59); + x = (x + v60); + x = (x + v61); + x = (x + v62); + x = (x + v63); + x = (x + v64); + x = (x + v65); + x = (x + v66); + x = (x + v67); + x = (x + v68); + x = (x + v69); + x = (x + v70); + x = (x + v71); + x = (x + v72); + x = (x + v73); + x = (x + v74); + x = (x + v75); + x = (x + v76); + x = (x + v77); + x = (x + v78); + x = (x + v79); + x = (x + v80); + x = (x + v81); + x = (x + v82); + x = (x + v83); + x = (x + v84); + x = (x + v85); + x = (x + v86); + x = (x + v87); + x = (x + v88); + x = (x + v89); + x = (x + v90); + x = (x + v91); + x = (x + v92); + x = (x + v93); + x = (x + v94); + x = (x + v95); + x = (x + v96); + x = (x + v97); + x = (x + v98); + x = (x + v99); + x = (x + v100); + x = (x + v101); + x = (x + v102); + x = (x + v103); + x = (x + v104); + x = (x + v105); + x = (x + v106); + x = (x + v107); + x = (x + v108); + x = (x + v109); + x = (x + v110); + x = (x + v111); + x = (x + v112); + x = (x + v113); + x = (x + v114); + x = (x + v115); + x = (x + v116); + x = (x + v117); + x = (x + v118); + x = (x + v119); + x = (x + v120); + x = (x + v121); + x = (x + v122); + x = (x + v123); + x = (x + v124); + x = (x + v125); + x = (x + v126); + x = (x + v127); + x = (x + v128); + x = (x + v129); + x = (x + v130); + x = (x + v131); + x = (x + v132); + x = (x + v133); + x = (x + v134); + x = (x + v135); + x = (x + v136); + x = (x + v137); + x = (x + v138); + x = (x + v139); + x = (x + v140); + x = (x + v141); + x = (x + v142); + x = (x + v143); + x = (x + v144); + x = (x + v145); + x = (x + v146); + x = (x + v147); + x = (x + v148); + x = (x + v149); + x = (x + v150); + x = (x + v151); + x = (x + v152); + x = (x + v153); + x = (x + v154); + x = (x + v155); + x = (x + v156); + x = (x + v157); + x = (x + v158); + x = (x + v159); + x = (x + v160); + x = (x + v161); + x = (x + v162); + x = (x + v163); + x = (x + v164); + x = (x + v165); + x = (x + v166); + x = (x + v167); + x = (x + v168); + x = (x + v169); + x = (x + v170); + x = (x + v171); + x = (x + v172); + x = (x + v173); + x = (x + v174); + x = (x + v175); + x = (x + v176); + x = (x + v177); + x = (x + v178); + x = (x + v179); + x = (x + v180); + x = (x + v181); + x = (x + v182); + x = (x + v183); + x = (x + v184); + x = (x + v185); + x = (x + v186); + x = (x + v187); + x = (x + v188); + x = (x + v189); + x = (x + v190); + x = (x + v191); + x = (x + v192); + x = (x + v193); + x = (x + v194); + x = (x + v195); + x = (x + v196); + x = (x + v197); + x = (x + v198); + x = (x + v199); + x = (x + v200); + x = (x + v201); + x = (x + v202); + x = (x + v203); + x = (x + v204); + x = (x + v205); + x = (x + v206); + x = (x + v207); + x = (x + v208); + x = (x + v209); + x = (x + v210); + x = (x + v211); + x = (x + v212); + x = (x + v213); + x = (x + v214); + x = (x + v215); + x = (x + v216); + x = (x + v217); + x = (x + v218); + x = (x + v219); + x = (x + v220); + x = (x + v221); + x = (x + v222); + x = (x + v223); + x = (x + v224); + x = (x + v225); + x = (x + v226); + x = (x + v227); + x = (x + v228); + x = (x + v229); + x = (x + v230); + x = (x + v231); + x = (x + v232); + x = (x + v233); + x = (x + v234); + x = (x + v235); + x = (x + v236); + x = (x + v237); + x = (x + v238); + x = (x + v239); + x = (x + v240); + x = (x + v241); + x = (x + v242); + x = (x + v243); + x = (x + v244); + x = (x + v245); + x = (x + v246); + x = (x + v247); + x = (x + v248); + x = (x + v249); + x = (x + v250); + x = (x + v251); + x = (x + v252); + x = (x + v253); + x = (x + v254); + x = (x + v255); + x = (x + v256); + x = (x + v257); + x = (x + v258); + x = (x + v259); + x = (x + v260); + x = (x + v261); + x = (x + v262); + x = (x + v263); + x = (x + v264); + x = (x + v265); + x = (x + v266); + x = (x + v267); + x = (x + v268); + x = (x + v269); + x = (x + v270); + x = (x + v271); + x = (x + v272); + x = (x + v273); + x = (x + v274); + x = (x + v275); + x = (x + v276); + x = (x + v277); + x = (x + v278); + x = (x + v279); + x = (x + v280); + x = (x + v281); + x = (x + v282); + x = (x + v283); + x = (x + v284); + x = (x + v285); + x = (x + v286); + x = (x + v287); + x = (x + v288); + x = (x + v289); + x = (x + v290); + x = (x + v291); + x = (x + v292); + x = (x + v293); + x = (x + v294); + x = (x + v295); + x = (x + v296); + x = (x + v297); + x = (x + v298); + x = (x + v299); + x = (x + v300); + x = (x + v301); + x = (x + v302); + x = (x + v303); + x = (x + v304); + x = (x + v305); + x = (x + v306); + x = (x + v307); + x = (x + v308); + x = (x + v309); + x = (x + v310); + x = (x + v311); + x = (x + v312); + x = (x + v313); + x = (x + v314); + x = (x + v315); + x = (x + v316); + x = (x + v317); + x = (x + v318); + x = (x + v319); + x = (x + v320); + x = (x + v321); + x = (x + v322); + x = (x + v323); + x = (x + v324); + x = (x + v325); + x = (x + v326); + x = (x + v327); + x = (x + v328); + x = (x + v329); + x = (x + v330); + x = (x + v331); + x = (x + v332); + x = (x + v333); + x = (x + v334); + x = (x + v335); + x = (x + v336); + x = (x + v337); + x = (x + v338); + x = (x + v339); + x = (x + v340); + x = (x + v341); + x = (x + v342); + x = (x + v343); + x = (x + v344); + x = (x + v345); + x = (x + v346); + x = (x + v347); + x = (x + v348); + x = (x + v349); + x = (x + v350); + x = (x + v351); + x = (x + v352); + x = (x + v353); + x = (x + v354); + x = (x + v355); + x = (x + v356); + x = (x + v357); + x = (x + v358); + x = (x + v359); + x = (x + v360); + x = (x + v361); + x = (x + v362); + x = (x + v363); + x = (x + v364); + x = (x + v365); + x = (x + v366); + x = (x + v367); + x = (x + v368); + x = (x + v369); + x = (x + v370); + x = (x + v371); + x = (x + v372); + x = (x + v373); + x = (x + v374); + x = (x + v375); + x = (x + v376); + x = (x + v377); + x = (x + v378); + x = (x + v379); + x = (x + v380); + x = (x + v381); + x = (x + v382); + x = (x + v383); + x = (x + v384); + x = (x + v385); + x = (x + v386); + x = (x + v387); + x = (x + v388); + x = (x + v389); + x = (x + v390); + x = (x + v391); + x = (x + v392); + x = (x + v393); + x = (x + v394); + x = (x + v395); + x = (x + v396); + x = (x + v397); + x = (x + v398); + x = (x + v399); + x = (x + v400); + x = (x + v401); + x = (x + v402); + x = (x + v403); + x = (x + v404); + x = (x + v405); + x = (x + v406); + x = (x + v407); + x = (x + v408); + x = (x + v409); + x = (x + v410); + x = (x + v411); + x = (x + v412); + x = (x + v413); + x = (x + v414); + x = (x + v415); + x = (x + v416); + x = (x + v417); + x = (x + v418); + x = (x + v419); + x = (x + v420); + x = (x + v421); + x = (x + v422); + x = (x + v423); + x = (x + v424); + x = (x + v425); + x = (x + v426); + x = (x + v427); + x = (x + v428); + x = (x + v429); + x = (x + v430); + x = (x + v431); + x = (x + v432); + x = (x + v433); + x = (x + v434); + x = (x + v435); + x = (x + v436); + x = (x + v437); + x = (x + v438); + x = (x + v439); + x = (x + v440); + x = (x + v441); + x = (x + v442); + x = (x + v443); + x = (x + v444); + x = (x + v445); + x = (x + v446); + x = (x + v447); + x = (x + v448); + x = (x + v449); + x = (x + v450); + x = (x + v451); + x = (x + v452); + x = (x + v453); + x = (x + v454); + x = (x + v455); + x = (x + v456); + x = (x + v457); + x = (x + v458); + x = (x + v459); + x = (x + v460); + x = (x + v461); + x = (x + v462); + x = (x + v463); + x = (x + v464); + x = (x + v465); + x = (x + v466); + x = (x + v467); + x = (x + v468); + x = (x + v469); + x = (x + v470); + x = (x + v471); + x = (x + v472); + x = (x + v473); + x = (x + v474); + x = (x + v475); + x = (x + v476); + x = (x + v477); + x = (x + v478); + x = (x + v479); + x = (x + v480); + x = (x + v481); + x = (x + v482); + x = (x + v483); + x = (x + v484); + x = (x + v485); + x = (x + v486); + x = (x + v487); + x = (x + v488); + x = (x + v489); + x = (x + v490); + x = (x + v491); + x = (x + v492); + x = (x + v493); + x = (x + v494); + x = (x + v495); + x = (x + v496); + x = (x + v497); + x = (x + v498); + x = (x + v499); + x = (x + v500); + x = (x + v501); + x = (x + v502); + x = (x + v503); + x = (x + v504); + x = (x + v505); + x = (x + v506); + x = (x + v507); + x = (x + v508); + x = (x + v509); + x = (x + v510); + x = (x + v511); + x = (x + v512); + x = (x + v513); + x = (x + v514); + x = (x + v515); + x = (x + v516); + x = (x + v517); + x = (x + v518); + x = (x + v519); + x = (x + v520); + x = (x + v521); + x = (x + v522); + x = (x + v523); + x = (x + v524); + x = (x + v525); + x = (x + v526); + x = (x + v527); + x = (x + v528); + x = (x + v529); + x = (x + v530); + x = (x + v531); + x = (x + v532); + x = (x + v533); + x = (x + v534); + x = (x + v535); + x = (x + v536); + x = (x + v537); + x = (x + v538); + x = (x + v539); + x = (x + v540); + x = (x + v541); + x = (x + v542); + x = (x + v543); + x = (x + v544); + x = (x + v545); + x = (x + v546); + x = (x + v547); + x = (x + v548); + x = (x + v549); + x = (x + v550); + x = (x + v551); + x = (x + v552); + x = (x + v553); + x = (x + v554); + x = (x + v555); + x = (x + v556); + x = (x + v557); + x = (x + v558); + x = (x + v559); + x = (x + v560); + x = (x + v561); + x = (x + v562); + x = (x + v563); + x = (x + v564); + x = (x + v565); + x = (x + v566); + x = (x + v567); + x = (x + v568); + x = (x + v569); + x = (x + v570); + x = (x + v571); + x = (x + v572); + x = (x + v573); + x = (x + v574); + x = (x + v575); + x = (x + v576); + x = (x + v577); + x = (x + v578); + x = (x + v579); + x = (x + v580); + x = (x + v581); + x = (x + v582); + x = (x + v583); + x = (x + v584); + x = (x + v585); + x = (x + v586); + x = (x + v587); + x = (x + v588); + x = (x + v589); + x = (x + v590); + x = (x + v591); + x = (x + v592); + x = (x + v593); + x = (x + v594); + x = (x + v595); + x = (x + v596); + x = (x + v597); + x = (x + v598); + x = (x + v599); + x = (x + v600); + x = (x + v601); + x = (x + v602); + x = (x + v603); + x = (x + v604); + x = (x + v605); + x = (x + v606); + x = (x + v607); + x = (x + v608); + x = (x + v609); + x = (x + v610); + x = (x + v611); + x = (x + v612); + x = (x + v613); + x = (x + v614); + x = (x + v615); + x = (x + v616); + x = (x + v617); + x = (x + v618); + x = (x + v619); + x = (x + v620); + x = (x + v621); + x = (x + v622); + x = (x + v623); + x = (x + v624); + x = (x + v625); + x = (x + v626); + x = (x + v627); + x = (x + v628); + x = (x + v629); + x = (x + v630); + x = (x + v631); + x = (x + v632); + x = (x + v633); + x = (x + v634); + x = (x + v635); + x = (x + v636); + x = (x + v637); + x = (x + v638); + x = (x + v639); + x = (x + v640); + x = (x + v641); + x = (x + v642); + x = (x + v643); + x = (x + v644); + x = (x + v645); + x = (x + v646); + x = (x + v647); + x = (x + v648); + x = (x + v649); + x = (x + v650); + x = (x + v651); + x = (x + v652); + x = (x + v653); + x = (x + v654); + x = (x + v655); + x = (x + v656); + x = (x + v657); + x = (x + v658); + x = (x + v659); + x = (x + v660); + x = (x + v661); + x = (x + v662); + x = (x + v663); + x = (x + v664); + x = (x + v665); + x = (x + v666); + x = (x + v667); + x = (x + v668); + x = (x + v669); + x = (x + v670); + x = (x + v671); + x = (x + v672); + x = (x + v673); + x = (x + v674); + x = (x + v675); + x = (x + v676); + x = (x + v677); + x = (x + v678); + x = (x + v679); + x = (x + v680); + x = (x + v681); + x = (x + v682); + x = (x + v683); + x = (x + v684); + x = (x + v685); + x = (x + v686); + x = (x + v687); + x = (x + v688); + x = (x + v689); + x = (x + v690); + x = (x + v691); + x = (x + v692); + x = (x + v693); + x = (x + v694); + x = (x + v695); + x = (x + v696); + x = (x + v697); + x = (x + v698); + x = (x + v699); + x = (x + v700); + x = (x + v701); + x = (x + v702); + x = (x + v703); + x = (x + v704); + x = (x + v705); + x = (x + v706); + x = (x + v707); + x = (x + v708); + x = (x + v709); + x = (x + v710); + x = (x + v711); + x = (x + v712); + x = (x + v713); + x = (x + v714); + x = (x + v715); + x = (x + v716); + x = (x + v717); + x = (x + v718); + x = (x + v719); + x = (x + v720); + x = (x + v721); + x = (x + v722); + x = (x + v723); + x = (x + v724); + x = (x + v725); + x = (x + v726); + x = (x + v727); + x = (x + v728); + x = (x + v729); + x = (x + v730); + x = (x + v731); + x = (x + v732); + x = (x + v733); + x = (x + v734); + x = (x + v735); + x = (x + v736); + x = (x + v737); + x = (x + v738); + x = (x + v739); + x = (x + v740); + x = (x + v741); + x = (x + v742); + x = (x + v743); + x = (x + v744); + x = (x + v745); + x = (x + v746); + x = (x + v747); + x = (x + v748); + x = (x + v749); + x = (x + v750); + x = (x + v751); + x = (x + v752); + x = (x + v753); + x = (x + v754); + x = (x + v755); + x = (x + v756); + x = (x + v757); + x = (x + v758); + x = (x + v759); + x = (x + v760); + x = (x + v761); + x = (x + v762); + x = (x + v763); + x = (x + v764); + x = (x + v765); + x = (x + v766); + x = (x + v767); + x = (x + v768); + x = (x + v769); + x = (x + v770); + x = (x + v771); + x = (x + v772); + x = (x + v773); + x = (x + v774); + x = (x + v775); + x = (x + v776); + x = (x + v777); + x = (x + v778); + x = (x + v779); + x = (x + v780); + x = (x + v781); + x = (x + v782); + x = (x + v783); + x = (x + v784); + x = (x + v785); + x = (x + v786); + x = (x + v787); + x = (x + v788); + x = (x + v789); + x = (x + v790); + x = (x + v791); + x = (x + v792); + x = (x + v793); + x = (x + v794); + x = (x + v795); + x = (x + v796); + x = (x + v797); + x = (x + v798); + x = (x + v799); + x = (x + v800); + x = (x + v801); + x = (x + v802); + x = (x + v803); + x = (x + v804); + x = (x + v805); + x = (x + v806); + x = (x + v807); + x = (x + v808); + x = (x + v809); + x = (x + v810); + x = (x + v811); + x = (x + v812); + x = (x + v813); + x = (x + v814); + x = (x + v815); + x = (x + v816); + x = (x + v817); + x = (x + v818); + x = (x + v819); + x = (x + v820); + x = (x + v821); + x = (x + v822); + x = (x + v823); + x = (x + v824); + x = (x + v825); + x = (x + v826); + x = (x + v827); + x = (x + v828); + x = (x + v829); + x = (x + v830); + x = (x + v831); + x = (x + v832); + x = (x + v833); + x = (x + v834); + x = (x + v835); + x = (x + v836); + x = (x + v837); + x = (x + v838); + x = (x + v839); + x = (x + v840); + x = (x + v841); + x = (x + v842); + x = (x + v843); + x = (x + v844); + x = (x + v845); + x = (x + v846); + x = (x + v847); + x = (x + v848); + x = (x + v849); + x = (x + v850); + x = (x + v851); + x = (x + v852); + x = (x + v853); + x = (x + v854); + x = (x + v855); + x = (x + v856); + x = (x + v857); + x = (x + v858); + x = (x + v859); + x = (x + v860); + x = (x + v861); + x = (x + v862); + x = (x + v863); + x = (x + v864); + x = (x + v865); + x = (x + v866); + x = (x + v867); + x = (x + v868); + x = (x + v869); + x = (x + v870); + x = (x + v871); + x = (x + v872); + x = (x + v873); + x = (x + v874); + x = (x + v875); + x = (x + v876); + x = (x + v877); + x = (x + v878); + x = (x + v879); + x = (x + v880); + x = (x + v881); + x = (x + v882); + x = (x + v883); + x = (x + v884); + x = (x + v885); + x = (x + v886); + x = (x + v887); + x = (x + v888); + x = (x + v889); + x = (x + v890); + x = (x + v891); + x = (x + v892); + x = (x + v893); + x = (x + v894); + x = (x + v895); + x = (x + v896); + x = (x + v897); + x = (x + v898); + x = (x + v899); + x = (x + v900); + x = (x + v901); + x = (x + v902); + x = (x + v903); + x = (x + v904); + x = (x + v905); + x = (x + v906); + x = (x + v907); + x = (x + v908); + x = (x + v909); + x = (x + v910); + x = (x + v911); + x = (x + v912); + x = (x + v913); + x = (x + v914); + x = (x + v915); + x = (x + v916); + x = (x + v917); + x = (x + v918); + x = (x + v919); + x = (x + v920); + x = (x + v921); + x = (x + v922); + x = (x + v923); + x = (x + v924); + x = (x + v925); + x = (x + v926); + x = (x + v927); + x = (x + v928); + x = (x + v929); + x = (x + v930); + x = (x + v931); + x = (x + v932); + x = (x + v933); + x = (x + v934); + x = (x + v935); + x = (x + v936); + x = (x + v937); + x = (x + v938); + x = (x + v939); + x = (x + v940); + x = (x + v941); + x = (x + v942); + x = (x + v943); + x = (x + v944); + x = (x + v945); + x = (x + v946); + x = (x + v947); + x = (x + v948); + x = (x + v949); + x = (x + v950); + x = (x + v951); + x = (x + v952); + x = (x + v953); + x = (x + v954); + x = (x + v955); + x = (x + v956); + x = (x + v957); + x = (x + v958); + x = (x + v959); + x = (x + v960); + x = (x + v961); + x = (x + v962); + x = (x + v963); + x = (x + v964); + x = (x + v965); + x = (x + v966); + x = (x + v967); + x = (x + v968); + x = (x + v969); + x = (x + v970); + x = (x + v971); + x = (x + v972); + x = (x + v973); + x = (x + v974); + x = (x + v975); + x = (x + v976); + x = (x + v977); + x = (x + v978); + x = (x + v979); + x = (x + v980); + x = (x + v981); + x = (x + v982); + x = (x + v983); + x = (x + v984); + x = (x + v985); + x = (x + v986); + x = (x + v987); + x = (x + v988); + x = (x + v989); + x = (x + v990); + x = (x + v991); + x = (x + v992); + x = (x + v993); + x = (x + v994); + x = (x + v995); + x = (x + v996); + x = (x + v997); + x = (x + v998); + x = (x + v999); + return x; +} + +uint tint_symbol() { + return foo(); +} + +void main() { + uint inner_result = tint_symbol(); + value = inner_result; + return; +} diff --git a/test/tint/bug/tint/1509.wgsl.expected.msl b/test/tint/bug/tint/1509.wgsl.expected.msl new file mode 100644 index 0000000000..65784033b8 --- /dev/null +++ b/test/tint/bug/tint/1509.wgsl.expected.msl @@ -0,0 +1,2023 @@ +#include + +using namespace metal; +uint foo() { + thread uint tint_symbol_2 = 0u; + thread uint tint_symbol_3 = 0u; + thread uint tint_symbol_4 = 0u; + thread uint tint_symbol_5 = 0u; + thread uint tint_symbol_6 = 0u; + thread uint tint_symbol_7 = 0u; + thread uint tint_symbol_8 = 0u; + thread uint tint_symbol_9 = 0u; + thread uint tint_symbol_10 = 0u; + thread uint tint_symbol_11 = 0u; + thread uint tint_symbol_12 = 0u; + thread uint tint_symbol_13 = 0u; + thread uint tint_symbol_14 = 0u; + thread uint tint_symbol_15 = 0u; + thread uint tint_symbol_16 = 0u; + thread uint tint_symbol_17 = 0u; + thread uint tint_symbol_18 = 0u; + thread uint tint_symbol_19 = 0u; + thread uint tint_symbol_20 = 0u; + thread uint tint_symbol_21 = 0u; + thread uint tint_symbol_22 = 0u; + thread uint tint_symbol_23 = 0u; + thread uint tint_symbol_24 = 0u; + thread uint tint_symbol_25 = 0u; + thread uint tint_symbol_26 = 0u; + thread uint tint_symbol_27 = 0u; + thread uint tint_symbol_28 = 0u; + thread uint tint_symbol_29 = 0u; + thread uint tint_symbol_30 = 0u; + thread uint tint_symbol_31 = 0u; + thread uint tint_symbol_32 = 0u; + thread uint tint_symbol_33 = 0u; + thread uint tint_symbol_34 = 0u; + thread uint tint_symbol_35 = 0u; + thread uint tint_symbol_36 = 0u; + thread uint tint_symbol_37 = 0u; + thread uint tint_symbol_38 = 0u; + thread uint tint_symbol_39 = 0u; + thread uint tint_symbol_40 = 0u; + thread uint tint_symbol_41 = 0u; + thread uint tint_symbol_42 = 0u; + thread uint tint_symbol_43 = 0u; + thread uint tint_symbol_44 = 0u; + thread uint tint_symbol_45 = 0u; + thread uint tint_symbol_46 = 0u; + thread uint tint_symbol_47 = 0u; + thread uint tint_symbol_48 = 0u; + thread uint tint_symbol_49 = 0u; + thread uint tint_symbol_50 = 0u; + thread uint tint_symbol_51 = 0u; + thread uint tint_symbol_52 = 0u; + thread uint tint_symbol_53 = 0u; + thread uint tint_symbol_54 = 0u; + thread uint tint_symbol_55 = 0u; + thread uint tint_symbol_56 = 0u; + thread uint tint_symbol_57 = 0u; + thread uint tint_symbol_58 = 0u; + thread uint tint_symbol_59 = 0u; + thread uint tint_symbol_60 = 0u; + thread uint tint_symbol_61 = 0u; + thread uint tint_symbol_62 = 0u; + thread uint tint_symbol_63 = 0u; + thread uint tint_symbol_64 = 0u; + thread uint tint_symbol_65 = 0u; + thread uint tint_symbol_66 = 0u; + thread uint tint_symbol_67 = 0u; + thread uint tint_symbol_68 = 0u; + thread uint tint_symbol_69 = 0u; + thread uint tint_symbol_70 = 0u; + thread uint tint_symbol_71 = 0u; + thread uint tint_symbol_72 = 0u; + thread uint tint_symbol_73 = 0u; + thread uint tint_symbol_74 = 0u; + thread uint tint_symbol_75 = 0u; + thread uint tint_symbol_76 = 0u; + thread uint tint_symbol_77 = 0u; + thread uint tint_symbol_78 = 0u; + thread uint tint_symbol_79 = 0u; + thread uint tint_symbol_80 = 0u; + thread uint tint_symbol_81 = 0u; + thread uint tint_symbol_82 = 0u; + thread uint tint_symbol_83 = 0u; + thread uint tint_symbol_84 = 0u; + thread uint tint_symbol_85 = 0u; + thread uint tint_symbol_86 = 0u; + thread uint tint_symbol_87 = 0u; + thread uint tint_symbol_88 = 0u; + thread uint tint_symbol_89 = 0u; + thread uint tint_symbol_90 = 0u; + thread uint tint_symbol_91 = 0u; + thread uint tint_symbol_92 = 0u; + thread uint tint_symbol_93 = 0u; + thread uint tint_symbol_94 = 0u; + thread uint tint_symbol_95 = 0u; + thread uint tint_symbol_96 = 0u; + thread uint tint_symbol_97 = 0u; + thread uint tint_symbol_98 = 0u; + thread uint tint_symbol_99 = 0u; + thread uint tint_symbol_100 = 0u; + thread uint tint_symbol_101 = 0u; + thread uint tint_symbol_102 = 0u; + thread uint tint_symbol_103 = 0u; + thread uint tint_symbol_104 = 0u; + thread uint tint_symbol_105 = 0u; + thread uint tint_symbol_106 = 0u; + thread uint tint_symbol_107 = 0u; + thread uint tint_symbol_108 = 0u; + thread uint tint_symbol_109 = 0u; + thread uint tint_symbol_110 = 0u; + thread uint tint_symbol_111 = 0u; + thread uint tint_symbol_112 = 0u; + thread uint tint_symbol_113 = 0u; + thread uint tint_symbol_114 = 0u; + thread uint tint_symbol_115 = 0u; + thread uint tint_symbol_116 = 0u; + thread uint tint_symbol_117 = 0u; + thread uint tint_symbol_118 = 0u; + thread uint tint_symbol_119 = 0u; + thread uint tint_symbol_120 = 0u; + thread uint tint_symbol_121 = 0u; + thread uint tint_symbol_122 = 0u; + thread uint tint_symbol_123 = 0u; + thread uint tint_symbol_124 = 0u; + thread uint tint_symbol_125 = 0u; + thread uint tint_symbol_126 = 0u; + thread uint tint_symbol_127 = 0u; + thread uint tint_symbol_128 = 0u; + thread uint tint_symbol_129 = 0u; + thread uint tint_symbol_130 = 0u; + thread uint tint_symbol_131 = 0u; + thread uint tint_symbol_132 = 0u; + thread uint tint_symbol_133 = 0u; + thread uint tint_symbol_134 = 0u; + thread uint tint_symbol_135 = 0u; + thread uint tint_symbol_136 = 0u; + thread uint tint_symbol_137 = 0u; + thread uint tint_symbol_138 = 0u; + thread uint tint_symbol_139 = 0u; + thread uint tint_symbol_140 = 0u; + thread uint tint_symbol_141 = 0u; + thread uint tint_symbol_142 = 0u; + thread uint tint_symbol_143 = 0u; + thread uint tint_symbol_144 = 0u; + thread uint tint_symbol_145 = 0u; + thread uint tint_symbol_146 = 0u; + thread uint tint_symbol_147 = 0u; + thread uint tint_symbol_148 = 0u; + thread uint tint_symbol_149 = 0u; + thread uint tint_symbol_150 = 0u; + thread uint tint_symbol_151 = 0u; + thread uint tint_symbol_152 = 0u; + thread uint tint_symbol_153 = 0u; + thread uint tint_symbol_154 = 0u; + thread uint tint_symbol_155 = 0u; + thread uint tint_symbol_156 = 0u; + thread uint tint_symbol_157 = 0u; + thread uint tint_symbol_158 = 0u; + thread uint tint_symbol_159 = 0u; + thread uint tint_symbol_160 = 0u; + thread uint tint_symbol_161 = 0u; + thread uint tint_symbol_162 = 0u; + thread uint tint_symbol_163 = 0u; + thread uint tint_symbol_164 = 0u; + thread uint tint_symbol_165 = 0u; + thread uint tint_symbol_166 = 0u; + thread uint tint_symbol_167 = 0u; + thread uint tint_symbol_168 = 0u; + thread uint tint_symbol_169 = 0u; + thread uint tint_symbol_170 = 0u; + thread uint tint_symbol_171 = 0u; + thread uint tint_symbol_172 = 0u; + thread uint tint_symbol_173 = 0u; + thread uint tint_symbol_174 = 0u; + thread uint tint_symbol_175 = 0u; + thread uint tint_symbol_176 = 0u; + thread uint tint_symbol_177 = 0u; + thread uint tint_symbol_178 = 0u; + thread uint tint_symbol_179 = 0u; + thread uint tint_symbol_180 = 0u; + thread uint tint_symbol_181 = 0u; + thread uint tint_symbol_182 = 0u; + thread uint tint_symbol_183 = 0u; + thread uint tint_symbol_184 = 0u; + thread uint tint_symbol_185 = 0u; + thread uint tint_symbol_186 = 0u; + thread uint tint_symbol_187 = 0u; + thread uint tint_symbol_188 = 0u; + thread uint tint_symbol_189 = 0u; + thread uint tint_symbol_190 = 0u; + thread uint tint_symbol_191 = 0u; + thread uint tint_symbol_192 = 0u; + thread uint tint_symbol_193 = 0u; + thread uint tint_symbol_194 = 0u; + thread uint tint_symbol_195 = 0u; + thread uint tint_symbol_196 = 0u; + thread uint tint_symbol_197 = 0u; + thread uint tint_symbol_198 = 0u; + thread uint tint_symbol_199 = 0u; + thread uint tint_symbol_200 = 0u; + thread uint tint_symbol_201 = 0u; + thread uint tint_symbol_202 = 0u; + thread uint tint_symbol_203 = 0u; + thread uint tint_symbol_204 = 0u; + thread uint tint_symbol_205 = 0u; + thread uint tint_symbol_206 = 0u; + thread uint tint_symbol_207 = 0u; + thread uint tint_symbol_208 = 0u; + thread uint tint_symbol_209 = 0u; + thread uint tint_symbol_210 = 0u; + thread uint tint_symbol_211 = 0u; + thread uint tint_symbol_212 = 0u; + thread uint tint_symbol_213 = 0u; + thread uint tint_symbol_214 = 0u; + thread uint tint_symbol_215 = 0u; + thread uint tint_symbol_216 = 0u; + thread uint tint_symbol_217 = 0u; + thread uint tint_symbol_218 = 0u; + thread uint tint_symbol_219 = 0u; + thread uint tint_symbol_220 = 0u; + thread uint tint_symbol_221 = 0u; + thread uint tint_symbol_222 = 0u; + thread uint tint_symbol_223 = 0u; + thread uint tint_symbol_224 = 0u; + thread uint tint_symbol_225 = 0u; + thread uint tint_symbol_226 = 0u; + thread uint tint_symbol_227 = 0u; + thread uint tint_symbol_228 = 0u; + thread uint tint_symbol_229 = 0u; + thread uint tint_symbol_230 = 0u; + thread uint tint_symbol_231 = 0u; + thread uint tint_symbol_232 = 0u; + thread uint tint_symbol_233 = 0u; + thread uint tint_symbol_234 = 0u; + thread uint tint_symbol_235 = 0u; + thread uint tint_symbol_236 = 0u; + thread uint tint_symbol_237 = 0u; + thread uint tint_symbol_238 = 0u; + thread uint tint_symbol_239 = 0u; + thread uint tint_symbol_240 = 0u; + thread uint tint_symbol_241 = 0u; + thread uint tint_symbol_242 = 0u; + thread uint tint_symbol_243 = 0u; + thread uint tint_symbol_244 = 0u; + thread uint tint_symbol_245 = 0u; + thread uint tint_symbol_246 = 0u; + thread uint tint_symbol_247 = 0u; + thread uint tint_symbol_248 = 0u; + thread uint tint_symbol_249 = 0u; + thread uint tint_symbol_250 = 0u; + thread uint tint_symbol_251 = 0u; + thread uint tint_symbol_252 = 0u; + thread uint tint_symbol_253 = 0u; + thread uint tint_symbol_254 = 0u; + thread uint tint_symbol_255 = 0u; + thread uint tint_symbol_256 = 0u; + thread uint tint_symbol_257 = 0u; + thread uint tint_symbol_258 = 0u; + thread uint tint_symbol_259 = 0u; + thread uint tint_symbol_260 = 0u; + thread uint tint_symbol_261 = 0u; + thread uint tint_symbol_262 = 0u; + thread uint tint_symbol_263 = 0u; + thread uint tint_symbol_264 = 0u; + thread uint tint_symbol_265 = 0u; + thread uint tint_symbol_266 = 0u; + thread uint tint_symbol_267 = 0u; + thread uint tint_symbol_268 = 0u; + thread uint tint_symbol_269 = 0u; + thread uint tint_symbol_270 = 0u; + thread uint tint_symbol_271 = 0u; + thread uint tint_symbol_272 = 0u; + thread uint tint_symbol_273 = 0u; + thread uint tint_symbol_274 = 0u; + thread uint tint_symbol_275 = 0u; + thread uint tint_symbol_276 = 0u; + thread uint tint_symbol_277 = 0u; + thread uint tint_symbol_278 = 0u; + thread uint tint_symbol_279 = 0u; + thread uint tint_symbol_280 = 0u; + thread uint tint_symbol_281 = 0u; + thread uint tint_symbol_282 = 0u; + thread uint tint_symbol_283 = 0u; + thread uint tint_symbol_284 = 0u; + thread uint tint_symbol_285 = 0u; + thread uint tint_symbol_286 = 0u; + thread uint tint_symbol_287 = 0u; + thread uint tint_symbol_288 = 0u; + thread uint tint_symbol_289 = 0u; + thread uint tint_symbol_290 = 0u; + thread uint tint_symbol_291 = 0u; + thread uint tint_symbol_292 = 0u; + thread uint tint_symbol_293 = 0u; + thread uint tint_symbol_294 = 0u; + thread uint tint_symbol_295 = 0u; + thread uint tint_symbol_296 = 0u; + thread uint tint_symbol_297 = 0u; + thread uint tint_symbol_298 = 0u; + thread uint tint_symbol_299 = 0u; + thread uint tint_symbol_300 = 0u; + thread uint tint_symbol_301 = 0u; + thread uint tint_symbol_302 = 0u; + thread uint tint_symbol_303 = 0u; + thread uint tint_symbol_304 = 0u; + thread uint tint_symbol_305 = 0u; + thread uint tint_symbol_306 = 0u; + thread uint tint_symbol_307 = 0u; + thread uint tint_symbol_308 = 0u; + thread uint tint_symbol_309 = 0u; + thread uint tint_symbol_310 = 0u; + thread uint tint_symbol_311 = 0u; + thread uint tint_symbol_312 = 0u; + thread uint tint_symbol_313 = 0u; + thread uint tint_symbol_314 = 0u; + thread uint tint_symbol_315 = 0u; + thread uint tint_symbol_316 = 0u; + thread uint tint_symbol_317 = 0u; + thread uint tint_symbol_318 = 0u; + thread uint tint_symbol_319 = 0u; + thread uint tint_symbol_320 = 0u; + thread uint tint_symbol_321 = 0u; + thread uint tint_symbol_322 = 0u; + thread uint tint_symbol_323 = 0u; + thread uint tint_symbol_324 = 0u; + thread uint tint_symbol_325 = 0u; + thread uint tint_symbol_326 = 0u; + thread uint tint_symbol_327 = 0u; + thread uint tint_symbol_328 = 0u; + thread uint tint_symbol_329 = 0u; + thread uint tint_symbol_330 = 0u; + thread uint tint_symbol_331 = 0u; + thread uint tint_symbol_332 = 0u; + thread uint tint_symbol_333 = 0u; + thread uint tint_symbol_334 = 0u; + thread uint tint_symbol_335 = 0u; + thread uint tint_symbol_336 = 0u; + thread uint tint_symbol_337 = 0u; + thread uint tint_symbol_338 = 0u; + thread uint tint_symbol_339 = 0u; + thread uint tint_symbol_340 = 0u; + thread uint tint_symbol_341 = 0u; + thread uint tint_symbol_342 = 0u; + thread uint tint_symbol_343 = 0u; + thread uint tint_symbol_344 = 0u; + thread uint tint_symbol_345 = 0u; + thread uint tint_symbol_346 = 0u; + thread uint tint_symbol_347 = 0u; + thread uint tint_symbol_348 = 0u; + thread uint tint_symbol_349 = 0u; + thread uint tint_symbol_350 = 0u; + thread uint tint_symbol_351 = 0u; + thread uint tint_symbol_352 = 0u; + thread uint tint_symbol_353 = 0u; + thread uint tint_symbol_354 = 0u; + thread uint tint_symbol_355 = 0u; + thread uint tint_symbol_356 = 0u; + thread uint tint_symbol_357 = 0u; + thread uint tint_symbol_358 = 0u; + thread uint tint_symbol_359 = 0u; + thread uint tint_symbol_360 = 0u; + thread uint tint_symbol_361 = 0u; + thread uint tint_symbol_362 = 0u; + thread uint tint_symbol_363 = 0u; + thread uint tint_symbol_364 = 0u; + thread uint tint_symbol_365 = 0u; + thread uint tint_symbol_366 = 0u; + thread uint tint_symbol_367 = 0u; + thread uint tint_symbol_368 = 0u; + thread uint tint_symbol_369 = 0u; + thread uint tint_symbol_370 = 0u; + thread uint tint_symbol_371 = 0u; + thread uint tint_symbol_372 = 0u; + thread uint tint_symbol_373 = 0u; + thread uint tint_symbol_374 = 0u; + thread uint tint_symbol_375 = 0u; + thread uint tint_symbol_376 = 0u; + thread uint tint_symbol_377 = 0u; + thread uint tint_symbol_378 = 0u; + thread uint tint_symbol_379 = 0u; + thread uint tint_symbol_380 = 0u; + thread uint tint_symbol_381 = 0u; + thread uint tint_symbol_382 = 0u; + thread uint tint_symbol_383 = 0u; + thread uint tint_symbol_384 = 0u; + thread uint tint_symbol_385 = 0u; + thread uint tint_symbol_386 = 0u; + thread uint tint_symbol_387 = 0u; + thread uint tint_symbol_388 = 0u; + thread uint tint_symbol_389 = 0u; + thread uint tint_symbol_390 = 0u; + thread uint tint_symbol_391 = 0u; + thread uint tint_symbol_392 = 0u; + thread uint tint_symbol_393 = 0u; + thread uint tint_symbol_394 = 0u; + thread uint tint_symbol_395 = 0u; + thread uint tint_symbol_396 = 0u; + thread uint tint_symbol_397 = 0u; + thread uint tint_symbol_398 = 0u; + thread uint tint_symbol_399 = 0u; + thread uint tint_symbol_400 = 0u; + thread uint tint_symbol_401 = 0u; + thread uint tint_symbol_402 = 0u; + thread uint tint_symbol_403 = 0u; + thread uint tint_symbol_404 = 0u; + thread uint tint_symbol_405 = 0u; + thread uint tint_symbol_406 = 0u; + thread uint tint_symbol_407 = 0u; + thread uint tint_symbol_408 = 0u; + thread uint tint_symbol_409 = 0u; + thread uint tint_symbol_410 = 0u; + thread uint tint_symbol_411 = 0u; + thread uint tint_symbol_412 = 0u; + thread uint tint_symbol_413 = 0u; + thread uint tint_symbol_414 = 0u; + thread uint tint_symbol_415 = 0u; + thread uint tint_symbol_416 = 0u; + thread uint tint_symbol_417 = 0u; + thread uint tint_symbol_418 = 0u; + thread uint tint_symbol_419 = 0u; + thread uint tint_symbol_420 = 0u; + thread uint tint_symbol_421 = 0u; + thread uint tint_symbol_422 = 0u; + thread uint tint_symbol_423 = 0u; + thread uint tint_symbol_424 = 0u; + thread uint tint_symbol_425 = 0u; + thread uint tint_symbol_426 = 0u; + thread uint tint_symbol_427 = 0u; + thread uint tint_symbol_428 = 0u; + thread uint tint_symbol_429 = 0u; + thread uint tint_symbol_430 = 0u; + thread uint tint_symbol_431 = 0u; + thread uint tint_symbol_432 = 0u; + thread uint tint_symbol_433 = 0u; + thread uint tint_symbol_434 = 0u; + thread uint tint_symbol_435 = 0u; + thread uint tint_symbol_436 = 0u; + thread uint tint_symbol_437 = 0u; + thread uint tint_symbol_438 = 0u; + thread uint tint_symbol_439 = 0u; + thread uint tint_symbol_440 = 0u; + thread uint tint_symbol_441 = 0u; + thread uint tint_symbol_442 = 0u; + thread uint tint_symbol_443 = 0u; + thread uint tint_symbol_444 = 0u; + thread uint tint_symbol_445 = 0u; + thread uint tint_symbol_446 = 0u; + thread uint tint_symbol_447 = 0u; + thread uint tint_symbol_448 = 0u; + thread uint tint_symbol_449 = 0u; + thread uint tint_symbol_450 = 0u; + thread uint tint_symbol_451 = 0u; + thread uint tint_symbol_452 = 0u; + thread uint tint_symbol_453 = 0u; + thread uint tint_symbol_454 = 0u; + thread uint tint_symbol_455 = 0u; + thread uint tint_symbol_456 = 0u; + thread uint tint_symbol_457 = 0u; + thread uint tint_symbol_458 = 0u; + thread uint tint_symbol_459 = 0u; + thread uint tint_symbol_460 = 0u; + thread uint tint_symbol_461 = 0u; + thread uint tint_symbol_462 = 0u; + thread uint tint_symbol_463 = 0u; + thread uint tint_symbol_464 = 0u; + thread uint tint_symbol_465 = 0u; + thread uint tint_symbol_466 = 0u; + thread uint tint_symbol_467 = 0u; + thread uint tint_symbol_468 = 0u; + thread uint tint_symbol_469 = 0u; + thread uint tint_symbol_470 = 0u; + thread uint tint_symbol_471 = 0u; + thread uint tint_symbol_472 = 0u; + thread uint tint_symbol_473 = 0u; + thread uint tint_symbol_474 = 0u; + thread uint tint_symbol_475 = 0u; + thread uint tint_symbol_476 = 0u; + thread uint tint_symbol_477 = 0u; + thread uint tint_symbol_478 = 0u; + thread uint tint_symbol_479 = 0u; + thread uint tint_symbol_480 = 0u; + thread uint tint_symbol_481 = 0u; + thread uint tint_symbol_482 = 0u; + thread uint tint_symbol_483 = 0u; + thread uint tint_symbol_484 = 0u; + thread uint tint_symbol_485 = 0u; + thread uint tint_symbol_486 = 0u; + thread uint tint_symbol_487 = 0u; + thread uint tint_symbol_488 = 0u; + thread uint tint_symbol_489 = 0u; + thread uint tint_symbol_490 = 0u; + thread uint tint_symbol_491 = 0u; + thread uint tint_symbol_492 = 0u; + thread uint tint_symbol_493 = 0u; + thread uint tint_symbol_494 = 0u; + thread uint tint_symbol_495 = 0u; + thread uint tint_symbol_496 = 0u; + thread uint tint_symbol_497 = 0u; + thread uint tint_symbol_498 = 0u; + thread uint tint_symbol_499 = 0u; + thread uint tint_symbol_500 = 0u; + thread uint tint_symbol_501 = 0u; + thread uint tint_symbol_502 = 0u; + thread uint tint_symbol_503 = 0u; + thread uint tint_symbol_504 = 0u; + thread uint tint_symbol_505 = 0u; + thread uint tint_symbol_506 = 0u; + thread uint tint_symbol_507 = 0u; + thread uint tint_symbol_508 = 0u; + thread uint tint_symbol_509 = 0u; + thread uint tint_symbol_510 = 0u; + thread uint tint_symbol_511 = 0u; + thread uint tint_symbol_512 = 0u; + thread uint tint_symbol_513 = 0u; + thread uint tint_symbol_514 = 0u; + thread uint tint_symbol_515 = 0u; + thread uint tint_symbol_516 = 0u; + thread uint tint_symbol_517 = 0u; + thread uint tint_symbol_518 = 0u; + thread uint tint_symbol_519 = 0u; + thread uint tint_symbol_520 = 0u; + thread uint tint_symbol_521 = 0u; + thread uint tint_symbol_522 = 0u; + thread uint tint_symbol_523 = 0u; + thread uint tint_symbol_524 = 0u; + thread uint tint_symbol_525 = 0u; + thread uint tint_symbol_526 = 0u; + thread uint tint_symbol_527 = 0u; + thread uint tint_symbol_528 = 0u; + thread uint tint_symbol_529 = 0u; + thread uint tint_symbol_530 = 0u; + thread uint tint_symbol_531 = 0u; + thread uint tint_symbol_532 = 0u; + thread uint tint_symbol_533 = 0u; + thread uint tint_symbol_534 = 0u; + thread uint tint_symbol_535 = 0u; + thread uint tint_symbol_536 = 0u; + thread uint tint_symbol_537 = 0u; + thread uint tint_symbol_538 = 0u; + thread uint tint_symbol_539 = 0u; + thread uint tint_symbol_540 = 0u; + thread uint tint_symbol_541 = 0u; + thread uint tint_symbol_542 = 0u; + thread uint tint_symbol_543 = 0u; + thread uint tint_symbol_544 = 0u; + thread uint tint_symbol_545 = 0u; + thread uint tint_symbol_546 = 0u; + thread uint tint_symbol_547 = 0u; + thread uint tint_symbol_548 = 0u; + thread uint tint_symbol_549 = 0u; + thread uint tint_symbol_550 = 0u; + thread uint tint_symbol_551 = 0u; + thread uint tint_symbol_552 = 0u; + thread uint tint_symbol_553 = 0u; + thread uint tint_symbol_554 = 0u; + thread uint tint_symbol_555 = 0u; + thread uint tint_symbol_556 = 0u; + thread uint tint_symbol_557 = 0u; + thread uint tint_symbol_558 = 0u; + thread uint tint_symbol_559 = 0u; + thread uint tint_symbol_560 = 0u; + thread uint tint_symbol_561 = 0u; + thread uint tint_symbol_562 = 0u; + thread uint tint_symbol_563 = 0u; + thread uint tint_symbol_564 = 0u; + thread uint tint_symbol_565 = 0u; + thread uint tint_symbol_566 = 0u; + thread uint tint_symbol_567 = 0u; + thread uint tint_symbol_568 = 0u; + thread uint tint_symbol_569 = 0u; + thread uint tint_symbol_570 = 0u; + thread uint tint_symbol_571 = 0u; + thread uint tint_symbol_572 = 0u; + thread uint tint_symbol_573 = 0u; + thread uint tint_symbol_574 = 0u; + thread uint tint_symbol_575 = 0u; + thread uint tint_symbol_576 = 0u; + thread uint tint_symbol_577 = 0u; + thread uint tint_symbol_578 = 0u; + thread uint tint_symbol_579 = 0u; + thread uint tint_symbol_580 = 0u; + thread uint tint_symbol_581 = 0u; + thread uint tint_symbol_582 = 0u; + thread uint tint_symbol_583 = 0u; + thread uint tint_symbol_584 = 0u; + thread uint tint_symbol_585 = 0u; + thread uint tint_symbol_586 = 0u; + thread uint tint_symbol_587 = 0u; + thread uint tint_symbol_588 = 0u; + thread uint tint_symbol_589 = 0u; + thread uint tint_symbol_590 = 0u; + thread uint tint_symbol_591 = 0u; + thread uint tint_symbol_592 = 0u; + thread uint tint_symbol_593 = 0u; + thread uint tint_symbol_594 = 0u; + thread uint tint_symbol_595 = 0u; + thread uint tint_symbol_596 = 0u; + thread uint tint_symbol_597 = 0u; + thread uint tint_symbol_598 = 0u; + thread uint tint_symbol_599 = 0u; + thread uint tint_symbol_600 = 0u; + thread uint tint_symbol_601 = 0u; + thread uint tint_symbol_602 = 0u; + thread uint tint_symbol_603 = 0u; + thread uint tint_symbol_604 = 0u; + thread uint tint_symbol_605 = 0u; + thread uint tint_symbol_606 = 0u; + thread uint tint_symbol_607 = 0u; + thread uint tint_symbol_608 = 0u; + thread uint tint_symbol_609 = 0u; + thread uint tint_symbol_610 = 0u; + thread uint tint_symbol_611 = 0u; + thread uint tint_symbol_612 = 0u; + thread uint tint_symbol_613 = 0u; + thread uint tint_symbol_614 = 0u; + thread uint tint_symbol_615 = 0u; + thread uint tint_symbol_616 = 0u; + thread uint tint_symbol_617 = 0u; + thread uint tint_symbol_618 = 0u; + thread uint tint_symbol_619 = 0u; + thread uint tint_symbol_620 = 0u; + thread uint tint_symbol_621 = 0u; + thread uint tint_symbol_622 = 0u; + thread uint tint_symbol_623 = 0u; + thread uint tint_symbol_624 = 0u; + thread uint tint_symbol_625 = 0u; + thread uint tint_symbol_626 = 0u; + thread uint tint_symbol_627 = 0u; + thread uint tint_symbol_628 = 0u; + thread uint tint_symbol_629 = 0u; + thread uint tint_symbol_630 = 0u; + thread uint tint_symbol_631 = 0u; + thread uint tint_symbol_632 = 0u; + thread uint tint_symbol_633 = 0u; + thread uint tint_symbol_634 = 0u; + thread uint tint_symbol_635 = 0u; + thread uint tint_symbol_636 = 0u; + thread uint tint_symbol_637 = 0u; + thread uint tint_symbol_638 = 0u; + thread uint tint_symbol_639 = 0u; + thread uint tint_symbol_640 = 0u; + thread uint tint_symbol_641 = 0u; + thread uint tint_symbol_642 = 0u; + thread uint tint_symbol_643 = 0u; + thread uint tint_symbol_644 = 0u; + thread uint tint_symbol_645 = 0u; + thread uint tint_symbol_646 = 0u; + thread uint tint_symbol_647 = 0u; + thread uint tint_symbol_648 = 0u; + thread uint tint_symbol_649 = 0u; + thread uint tint_symbol_650 = 0u; + thread uint tint_symbol_651 = 0u; + thread uint tint_symbol_652 = 0u; + thread uint tint_symbol_653 = 0u; + thread uint tint_symbol_654 = 0u; + thread uint tint_symbol_655 = 0u; + thread uint tint_symbol_656 = 0u; + thread uint tint_symbol_657 = 0u; + thread uint tint_symbol_658 = 0u; + thread uint tint_symbol_659 = 0u; + thread uint tint_symbol_660 = 0u; + thread uint tint_symbol_661 = 0u; + thread uint tint_symbol_662 = 0u; + thread uint tint_symbol_663 = 0u; + thread uint tint_symbol_664 = 0u; + thread uint tint_symbol_665 = 0u; + thread uint tint_symbol_666 = 0u; + thread uint tint_symbol_667 = 0u; + thread uint tint_symbol_668 = 0u; + thread uint tint_symbol_669 = 0u; + thread uint tint_symbol_670 = 0u; + thread uint tint_symbol_671 = 0u; + thread uint tint_symbol_672 = 0u; + thread uint tint_symbol_673 = 0u; + thread uint tint_symbol_674 = 0u; + thread uint tint_symbol_675 = 0u; + thread uint tint_symbol_676 = 0u; + thread uint tint_symbol_677 = 0u; + thread uint tint_symbol_678 = 0u; + thread uint tint_symbol_679 = 0u; + thread uint tint_symbol_680 = 0u; + thread uint tint_symbol_681 = 0u; + thread uint tint_symbol_682 = 0u; + thread uint tint_symbol_683 = 0u; + thread uint tint_symbol_684 = 0u; + thread uint tint_symbol_685 = 0u; + thread uint tint_symbol_686 = 0u; + thread uint tint_symbol_687 = 0u; + thread uint tint_symbol_688 = 0u; + thread uint tint_symbol_689 = 0u; + thread uint tint_symbol_690 = 0u; + thread uint tint_symbol_691 = 0u; + thread uint tint_symbol_692 = 0u; + thread uint tint_symbol_693 = 0u; + thread uint tint_symbol_694 = 0u; + thread uint tint_symbol_695 = 0u; + thread uint tint_symbol_696 = 0u; + thread uint tint_symbol_697 = 0u; + thread uint tint_symbol_698 = 0u; + thread uint tint_symbol_699 = 0u; + thread uint tint_symbol_700 = 0u; + thread uint tint_symbol_701 = 0u; + thread uint tint_symbol_702 = 0u; + thread uint tint_symbol_703 = 0u; + thread uint tint_symbol_704 = 0u; + thread uint tint_symbol_705 = 0u; + thread uint tint_symbol_706 = 0u; + thread uint tint_symbol_707 = 0u; + thread uint tint_symbol_708 = 0u; + thread uint tint_symbol_709 = 0u; + thread uint tint_symbol_710 = 0u; + thread uint tint_symbol_711 = 0u; + thread uint tint_symbol_712 = 0u; + thread uint tint_symbol_713 = 0u; + thread uint tint_symbol_714 = 0u; + thread uint tint_symbol_715 = 0u; + thread uint tint_symbol_716 = 0u; + thread uint tint_symbol_717 = 0u; + thread uint tint_symbol_718 = 0u; + thread uint tint_symbol_719 = 0u; + thread uint tint_symbol_720 = 0u; + thread uint tint_symbol_721 = 0u; + thread uint tint_symbol_722 = 0u; + thread uint tint_symbol_723 = 0u; + thread uint tint_symbol_724 = 0u; + thread uint tint_symbol_725 = 0u; + thread uint tint_symbol_726 = 0u; + thread uint tint_symbol_727 = 0u; + thread uint tint_symbol_728 = 0u; + thread uint tint_symbol_729 = 0u; + thread uint tint_symbol_730 = 0u; + thread uint tint_symbol_731 = 0u; + thread uint tint_symbol_732 = 0u; + thread uint tint_symbol_733 = 0u; + thread uint tint_symbol_734 = 0u; + thread uint tint_symbol_735 = 0u; + thread uint tint_symbol_736 = 0u; + thread uint tint_symbol_737 = 0u; + thread uint tint_symbol_738 = 0u; + thread uint tint_symbol_739 = 0u; + thread uint tint_symbol_740 = 0u; + thread uint tint_symbol_741 = 0u; + thread uint tint_symbol_742 = 0u; + thread uint tint_symbol_743 = 0u; + thread uint tint_symbol_744 = 0u; + thread uint tint_symbol_745 = 0u; + thread uint tint_symbol_746 = 0u; + thread uint tint_symbol_747 = 0u; + thread uint tint_symbol_748 = 0u; + thread uint tint_symbol_749 = 0u; + thread uint tint_symbol_750 = 0u; + thread uint tint_symbol_751 = 0u; + thread uint tint_symbol_752 = 0u; + thread uint tint_symbol_753 = 0u; + thread uint tint_symbol_754 = 0u; + thread uint tint_symbol_755 = 0u; + thread uint tint_symbol_756 = 0u; + thread uint tint_symbol_757 = 0u; + thread uint tint_symbol_758 = 0u; + thread uint tint_symbol_759 = 0u; + thread uint tint_symbol_760 = 0u; + thread uint tint_symbol_761 = 0u; + thread uint tint_symbol_762 = 0u; + thread uint tint_symbol_763 = 0u; + thread uint tint_symbol_764 = 0u; + thread uint tint_symbol_765 = 0u; + thread uint tint_symbol_766 = 0u; + thread uint tint_symbol_767 = 0u; + thread uint tint_symbol_768 = 0u; + thread uint tint_symbol_769 = 0u; + thread uint tint_symbol_770 = 0u; + thread uint tint_symbol_771 = 0u; + thread uint tint_symbol_772 = 0u; + thread uint tint_symbol_773 = 0u; + thread uint tint_symbol_774 = 0u; + thread uint tint_symbol_775 = 0u; + thread uint tint_symbol_776 = 0u; + thread uint tint_symbol_777 = 0u; + thread uint tint_symbol_778 = 0u; + thread uint tint_symbol_779 = 0u; + thread uint tint_symbol_780 = 0u; + thread uint tint_symbol_781 = 0u; + thread uint tint_symbol_782 = 0u; + thread uint tint_symbol_783 = 0u; + thread uint tint_symbol_784 = 0u; + thread uint tint_symbol_785 = 0u; + thread uint tint_symbol_786 = 0u; + thread uint tint_symbol_787 = 0u; + thread uint tint_symbol_788 = 0u; + thread uint tint_symbol_789 = 0u; + thread uint tint_symbol_790 = 0u; + thread uint tint_symbol_791 = 0u; + thread uint tint_symbol_792 = 0u; + thread uint tint_symbol_793 = 0u; + thread uint tint_symbol_794 = 0u; + thread uint tint_symbol_795 = 0u; + thread uint tint_symbol_796 = 0u; + thread uint tint_symbol_797 = 0u; + thread uint tint_symbol_798 = 0u; + thread uint tint_symbol_799 = 0u; + thread uint tint_symbol_800 = 0u; + thread uint tint_symbol_801 = 0u; + thread uint tint_symbol_802 = 0u; + thread uint tint_symbol_803 = 0u; + thread uint tint_symbol_804 = 0u; + thread uint tint_symbol_805 = 0u; + thread uint tint_symbol_806 = 0u; + thread uint tint_symbol_807 = 0u; + thread uint tint_symbol_808 = 0u; + thread uint tint_symbol_809 = 0u; + thread uint tint_symbol_810 = 0u; + thread uint tint_symbol_811 = 0u; + thread uint tint_symbol_812 = 0u; + thread uint tint_symbol_813 = 0u; + thread uint tint_symbol_814 = 0u; + thread uint tint_symbol_815 = 0u; + thread uint tint_symbol_816 = 0u; + thread uint tint_symbol_817 = 0u; + thread uint tint_symbol_818 = 0u; + thread uint tint_symbol_819 = 0u; + thread uint tint_symbol_820 = 0u; + thread uint tint_symbol_821 = 0u; + thread uint tint_symbol_822 = 0u; + thread uint tint_symbol_823 = 0u; + thread uint tint_symbol_824 = 0u; + thread uint tint_symbol_825 = 0u; + thread uint tint_symbol_826 = 0u; + thread uint tint_symbol_827 = 0u; + thread uint tint_symbol_828 = 0u; + thread uint tint_symbol_829 = 0u; + thread uint tint_symbol_830 = 0u; + thread uint tint_symbol_831 = 0u; + thread uint tint_symbol_832 = 0u; + thread uint tint_symbol_833 = 0u; + thread uint tint_symbol_834 = 0u; + thread uint tint_symbol_835 = 0u; + thread uint tint_symbol_836 = 0u; + thread uint tint_symbol_837 = 0u; + thread uint tint_symbol_838 = 0u; + thread uint tint_symbol_839 = 0u; + thread uint tint_symbol_840 = 0u; + thread uint tint_symbol_841 = 0u; + thread uint tint_symbol_842 = 0u; + thread uint tint_symbol_843 = 0u; + thread uint tint_symbol_844 = 0u; + thread uint tint_symbol_845 = 0u; + thread uint tint_symbol_846 = 0u; + thread uint tint_symbol_847 = 0u; + thread uint tint_symbol_848 = 0u; + thread uint tint_symbol_849 = 0u; + thread uint tint_symbol_850 = 0u; + thread uint tint_symbol_851 = 0u; + thread uint tint_symbol_852 = 0u; + thread uint tint_symbol_853 = 0u; + thread uint tint_symbol_854 = 0u; + thread uint tint_symbol_855 = 0u; + thread uint tint_symbol_856 = 0u; + thread uint tint_symbol_857 = 0u; + thread uint tint_symbol_858 = 0u; + thread uint tint_symbol_859 = 0u; + thread uint tint_symbol_860 = 0u; + thread uint tint_symbol_861 = 0u; + thread uint tint_symbol_862 = 0u; + thread uint tint_symbol_863 = 0u; + thread uint tint_symbol_864 = 0u; + thread uint tint_symbol_865 = 0u; + thread uint tint_symbol_866 = 0u; + thread uint tint_symbol_867 = 0u; + thread uint tint_symbol_868 = 0u; + thread uint tint_symbol_869 = 0u; + thread uint tint_symbol_870 = 0u; + thread uint tint_symbol_871 = 0u; + thread uint tint_symbol_872 = 0u; + thread uint tint_symbol_873 = 0u; + thread uint tint_symbol_874 = 0u; + thread uint tint_symbol_875 = 0u; + thread uint tint_symbol_876 = 0u; + thread uint tint_symbol_877 = 0u; + thread uint tint_symbol_878 = 0u; + thread uint tint_symbol_879 = 0u; + thread uint tint_symbol_880 = 0u; + thread uint tint_symbol_881 = 0u; + thread uint tint_symbol_882 = 0u; + thread uint tint_symbol_883 = 0u; + thread uint tint_symbol_884 = 0u; + thread uint tint_symbol_885 = 0u; + thread uint tint_symbol_886 = 0u; + thread uint tint_symbol_887 = 0u; + thread uint tint_symbol_888 = 0u; + thread uint tint_symbol_889 = 0u; + thread uint tint_symbol_890 = 0u; + thread uint tint_symbol_891 = 0u; + thread uint tint_symbol_892 = 0u; + thread uint tint_symbol_893 = 0u; + thread uint tint_symbol_894 = 0u; + thread uint tint_symbol_895 = 0u; + thread uint tint_symbol_896 = 0u; + thread uint tint_symbol_897 = 0u; + thread uint tint_symbol_898 = 0u; + thread uint tint_symbol_899 = 0u; + thread uint tint_symbol_900 = 0u; + thread uint tint_symbol_901 = 0u; + thread uint tint_symbol_902 = 0u; + thread uint tint_symbol_903 = 0u; + thread uint tint_symbol_904 = 0u; + thread uint tint_symbol_905 = 0u; + thread uint tint_symbol_906 = 0u; + thread uint tint_symbol_907 = 0u; + thread uint tint_symbol_908 = 0u; + thread uint tint_symbol_909 = 0u; + thread uint tint_symbol_910 = 0u; + thread uint tint_symbol_911 = 0u; + thread uint tint_symbol_912 = 0u; + thread uint tint_symbol_913 = 0u; + thread uint tint_symbol_914 = 0u; + thread uint tint_symbol_915 = 0u; + thread uint tint_symbol_916 = 0u; + thread uint tint_symbol_917 = 0u; + thread uint tint_symbol_918 = 0u; + thread uint tint_symbol_919 = 0u; + thread uint tint_symbol_920 = 0u; + thread uint tint_symbol_921 = 0u; + thread uint tint_symbol_922 = 0u; + thread uint tint_symbol_923 = 0u; + thread uint tint_symbol_924 = 0u; + thread uint tint_symbol_925 = 0u; + thread uint tint_symbol_926 = 0u; + thread uint tint_symbol_927 = 0u; + thread uint tint_symbol_928 = 0u; + thread uint tint_symbol_929 = 0u; + thread uint tint_symbol_930 = 0u; + thread uint tint_symbol_931 = 0u; + thread uint tint_symbol_932 = 0u; + thread uint tint_symbol_933 = 0u; + thread uint tint_symbol_934 = 0u; + thread uint tint_symbol_935 = 0u; + thread uint tint_symbol_936 = 0u; + thread uint tint_symbol_937 = 0u; + thread uint tint_symbol_938 = 0u; + thread uint tint_symbol_939 = 0u; + thread uint tint_symbol_940 = 0u; + thread uint tint_symbol_941 = 0u; + thread uint tint_symbol_942 = 0u; + thread uint tint_symbol_943 = 0u; + thread uint tint_symbol_944 = 0u; + thread uint tint_symbol_945 = 0u; + thread uint tint_symbol_946 = 0u; + thread uint tint_symbol_947 = 0u; + thread uint tint_symbol_948 = 0u; + thread uint tint_symbol_949 = 0u; + thread uint tint_symbol_950 = 0u; + thread uint tint_symbol_951 = 0u; + thread uint tint_symbol_952 = 0u; + thread uint tint_symbol_953 = 0u; + thread uint tint_symbol_954 = 0u; + thread uint tint_symbol_955 = 0u; + thread uint tint_symbol_956 = 0u; + thread uint tint_symbol_957 = 0u; + thread uint tint_symbol_958 = 0u; + thread uint tint_symbol_959 = 0u; + thread uint tint_symbol_960 = 0u; + thread uint tint_symbol_961 = 0u; + thread uint tint_symbol_962 = 0u; + thread uint tint_symbol_963 = 0u; + thread uint tint_symbol_964 = 0u; + thread uint tint_symbol_965 = 0u; + thread uint tint_symbol_966 = 0u; + thread uint tint_symbol_967 = 0u; + thread uint tint_symbol_968 = 0u; + thread uint tint_symbol_969 = 0u; + thread uint tint_symbol_970 = 0u; + thread uint tint_symbol_971 = 0u; + thread uint tint_symbol_972 = 0u; + thread uint tint_symbol_973 = 0u; + thread uint tint_symbol_974 = 0u; + thread uint tint_symbol_975 = 0u; + thread uint tint_symbol_976 = 0u; + thread uint tint_symbol_977 = 0u; + thread uint tint_symbol_978 = 0u; + thread uint tint_symbol_979 = 0u; + thread uint tint_symbol_980 = 0u; + thread uint tint_symbol_981 = 0u; + thread uint tint_symbol_982 = 0u; + thread uint tint_symbol_983 = 0u; + thread uint tint_symbol_984 = 0u; + thread uint tint_symbol_985 = 0u; + thread uint tint_symbol_986 = 0u; + thread uint tint_symbol_987 = 0u; + thread uint tint_symbol_988 = 0u; + thread uint tint_symbol_989 = 0u; + thread uint tint_symbol_990 = 0u; + thread uint tint_symbol_991 = 0u; + thread uint tint_symbol_992 = 0u; + thread uint tint_symbol_993 = 0u; + thread uint tint_symbol_994 = 0u; + thread uint tint_symbol_995 = 0u; + thread uint tint_symbol_996 = 0u; + thread uint tint_symbol_997 = 0u; + thread uint tint_symbol_998 = 0u; + thread uint tint_symbol_999 = 0u; + thread uint tint_symbol_1000 = 0u; + thread uint tint_symbol_1001 = 0u; + uint x = 0u; + x = (x + tint_symbol_2); + x = (x + tint_symbol_3); + x = (x + tint_symbol_4); + x = (x + tint_symbol_5); + x = (x + tint_symbol_6); + x = (x + tint_symbol_7); + x = (x + tint_symbol_8); + x = (x + tint_symbol_9); + x = (x + tint_symbol_10); + x = (x + tint_symbol_11); + x = (x + tint_symbol_12); + x = (x + tint_symbol_13); + x = (x + tint_symbol_14); + x = (x + tint_symbol_15); + x = (x + tint_symbol_16); + x = (x + tint_symbol_17); + x = (x + tint_symbol_18); + x = (x + tint_symbol_19); + x = (x + tint_symbol_20); + x = (x + tint_symbol_21); + x = (x + tint_symbol_22); + x = (x + tint_symbol_23); + x = (x + tint_symbol_24); + x = (x + tint_symbol_25); + x = (x + tint_symbol_26); + x = (x + tint_symbol_27); + x = (x + tint_symbol_28); + x = (x + tint_symbol_29); + x = (x + tint_symbol_30); + x = (x + tint_symbol_31); + x = (x + tint_symbol_32); + x = (x + tint_symbol_33); + x = (x + tint_symbol_34); + x = (x + tint_symbol_35); + x = (x + tint_symbol_36); + x = (x + tint_symbol_37); + x = (x + tint_symbol_38); + x = (x + tint_symbol_39); + x = (x + tint_symbol_40); + x = (x + tint_symbol_41); + x = (x + tint_symbol_42); + x = (x + tint_symbol_43); + x = (x + tint_symbol_44); + x = (x + tint_symbol_45); + x = (x + tint_symbol_46); + x = (x + tint_symbol_47); + x = (x + tint_symbol_48); + x = (x + tint_symbol_49); + x = (x + tint_symbol_50); + x = (x + tint_symbol_51); + x = (x + tint_symbol_52); + x = (x + tint_symbol_53); + x = (x + tint_symbol_54); + x = (x + tint_symbol_55); + x = (x + tint_symbol_56); + x = (x + tint_symbol_57); + x = (x + tint_symbol_58); + x = (x + tint_symbol_59); + x = (x + tint_symbol_60); + x = (x + tint_symbol_61); + x = (x + tint_symbol_62); + x = (x + tint_symbol_63); + x = (x + tint_symbol_64); + x = (x + tint_symbol_65); + x = (x + tint_symbol_66); + x = (x + tint_symbol_67); + x = (x + tint_symbol_68); + x = (x + tint_symbol_69); + x = (x + tint_symbol_70); + x = (x + tint_symbol_71); + x = (x + tint_symbol_72); + x = (x + tint_symbol_73); + x = (x + tint_symbol_74); + x = (x + tint_symbol_75); + x = (x + tint_symbol_76); + x = (x + tint_symbol_77); + x = (x + tint_symbol_78); + x = (x + tint_symbol_79); + x = (x + tint_symbol_80); + x = (x + tint_symbol_81); + x = (x + tint_symbol_82); + x = (x + tint_symbol_83); + x = (x + tint_symbol_84); + x = (x + tint_symbol_85); + x = (x + tint_symbol_86); + x = (x + tint_symbol_87); + x = (x + tint_symbol_88); + x = (x + tint_symbol_89); + x = (x + tint_symbol_90); + x = (x + tint_symbol_91); + x = (x + tint_symbol_92); + x = (x + tint_symbol_93); + x = (x + tint_symbol_94); + x = (x + tint_symbol_95); + x = (x + tint_symbol_96); + x = (x + tint_symbol_97); + x = (x + tint_symbol_98); + x = (x + tint_symbol_99); + x = (x + tint_symbol_100); + x = (x + tint_symbol_101); + x = (x + tint_symbol_102); + x = (x + tint_symbol_103); + x = (x + tint_symbol_104); + x = (x + tint_symbol_105); + x = (x + tint_symbol_106); + x = (x + tint_symbol_107); + x = (x + tint_symbol_108); + x = (x + tint_symbol_109); + x = (x + tint_symbol_110); + x = (x + tint_symbol_111); + x = (x + tint_symbol_112); + x = (x + tint_symbol_113); + x = (x + tint_symbol_114); + x = (x + tint_symbol_115); + x = (x + tint_symbol_116); + x = (x + tint_symbol_117); + x = (x + tint_symbol_118); + x = (x + tint_symbol_119); + x = (x + tint_symbol_120); + x = (x + tint_symbol_121); + x = (x + tint_symbol_122); + x = (x + tint_symbol_123); + x = (x + tint_symbol_124); + x = (x + tint_symbol_125); + x = (x + tint_symbol_126); + x = (x + tint_symbol_127); + x = (x + tint_symbol_128); + x = (x + tint_symbol_129); + x = (x + tint_symbol_130); + x = (x + tint_symbol_131); + x = (x + tint_symbol_132); + x = (x + tint_symbol_133); + x = (x + tint_symbol_134); + x = (x + tint_symbol_135); + x = (x + tint_symbol_136); + x = (x + tint_symbol_137); + x = (x + tint_symbol_138); + x = (x + tint_symbol_139); + x = (x + tint_symbol_140); + x = (x + tint_symbol_141); + x = (x + tint_symbol_142); + x = (x + tint_symbol_143); + x = (x + tint_symbol_144); + x = (x + tint_symbol_145); + x = (x + tint_symbol_146); + x = (x + tint_symbol_147); + x = (x + tint_symbol_148); + x = (x + tint_symbol_149); + x = (x + tint_symbol_150); + x = (x + tint_symbol_151); + x = (x + tint_symbol_152); + x = (x + tint_symbol_153); + x = (x + tint_symbol_154); + x = (x + tint_symbol_155); + x = (x + tint_symbol_156); + x = (x + tint_symbol_157); + x = (x + tint_symbol_158); + x = (x + tint_symbol_159); + x = (x + tint_symbol_160); + x = (x + tint_symbol_161); + x = (x + tint_symbol_162); + x = (x + tint_symbol_163); + x = (x + tint_symbol_164); + x = (x + tint_symbol_165); + x = (x + tint_symbol_166); + x = (x + tint_symbol_167); + x = (x + tint_symbol_168); + x = (x + tint_symbol_169); + x = (x + tint_symbol_170); + x = (x + tint_symbol_171); + x = (x + tint_symbol_172); + x = (x + tint_symbol_173); + x = (x + tint_symbol_174); + x = (x + tint_symbol_175); + x = (x + tint_symbol_176); + x = (x + tint_symbol_177); + x = (x + tint_symbol_178); + x = (x + tint_symbol_179); + x = (x + tint_symbol_180); + x = (x + tint_symbol_181); + x = (x + tint_symbol_182); + x = (x + tint_symbol_183); + x = (x + tint_symbol_184); + x = (x + tint_symbol_185); + x = (x + tint_symbol_186); + x = (x + tint_symbol_187); + x = (x + tint_symbol_188); + x = (x + tint_symbol_189); + x = (x + tint_symbol_190); + x = (x + tint_symbol_191); + x = (x + tint_symbol_192); + x = (x + tint_symbol_193); + x = (x + tint_symbol_194); + x = (x + tint_symbol_195); + x = (x + tint_symbol_196); + x = (x + tint_symbol_197); + x = (x + tint_symbol_198); + x = (x + tint_symbol_199); + x = (x + tint_symbol_200); + x = (x + tint_symbol_201); + x = (x + tint_symbol_202); + x = (x + tint_symbol_203); + x = (x + tint_symbol_204); + x = (x + tint_symbol_205); + x = (x + tint_symbol_206); + x = (x + tint_symbol_207); + x = (x + tint_symbol_208); + x = (x + tint_symbol_209); + x = (x + tint_symbol_210); + x = (x + tint_symbol_211); + x = (x + tint_symbol_212); + x = (x + tint_symbol_213); + x = (x + tint_symbol_214); + x = (x + tint_symbol_215); + x = (x + tint_symbol_216); + x = (x + tint_symbol_217); + x = (x + tint_symbol_218); + x = (x + tint_symbol_219); + x = (x + tint_symbol_220); + x = (x + tint_symbol_221); + x = (x + tint_symbol_222); + x = (x + tint_symbol_223); + x = (x + tint_symbol_224); + x = (x + tint_symbol_225); + x = (x + tint_symbol_226); + x = (x + tint_symbol_227); + x = (x + tint_symbol_228); + x = (x + tint_symbol_229); + x = (x + tint_symbol_230); + x = (x + tint_symbol_231); + x = (x + tint_symbol_232); + x = (x + tint_symbol_233); + x = (x + tint_symbol_234); + x = (x + tint_symbol_235); + x = (x + tint_symbol_236); + x = (x + tint_symbol_237); + x = (x + tint_symbol_238); + x = (x + tint_symbol_239); + x = (x + tint_symbol_240); + x = (x + tint_symbol_241); + x = (x + tint_symbol_242); + x = (x + tint_symbol_243); + x = (x + tint_symbol_244); + x = (x + tint_symbol_245); + x = (x + tint_symbol_246); + x = (x + tint_symbol_247); + x = (x + tint_symbol_248); + x = (x + tint_symbol_249); + x = (x + tint_symbol_250); + x = (x + tint_symbol_251); + x = (x + tint_symbol_252); + x = (x + tint_symbol_253); + x = (x + tint_symbol_254); + x = (x + tint_symbol_255); + x = (x + tint_symbol_256); + x = (x + tint_symbol_257); + x = (x + tint_symbol_258); + x = (x + tint_symbol_259); + x = (x + tint_symbol_260); + x = (x + tint_symbol_261); + x = (x + tint_symbol_262); + x = (x + tint_symbol_263); + x = (x + tint_symbol_264); + x = (x + tint_symbol_265); + x = (x + tint_symbol_266); + x = (x + tint_symbol_267); + x = (x + tint_symbol_268); + x = (x + tint_symbol_269); + x = (x + tint_symbol_270); + x = (x + tint_symbol_271); + x = (x + tint_symbol_272); + x = (x + tint_symbol_273); + x = (x + tint_symbol_274); + x = (x + tint_symbol_275); + x = (x + tint_symbol_276); + x = (x + tint_symbol_277); + x = (x + tint_symbol_278); + x = (x + tint_symbol_279); + x = (x + tint_symbol_280); + x = (x + tint_symbol_281); + x = (x + tint_symbol_282); + x = (x + tint_symbol_283); + x = (x + tint_symbol_284); + x = (x + tint_symbol_285); + x = (x + tint_symbol_286); + x = (x + tint_symbol_287); + x = (x + tint_symbol_288); + x = (x + tint_symbol_289); + x = (x + tint_symbol_290); + x = (x + tint_symbol_291); + x = (x + tint_symbol_292); + x = (x + tint_symbol_293); + x = (x + tint_symbol_294); + x = (x + tint_symbol_295); + x = (x + tint_symbol_296); + x = (x + tint_symbol_297); + x = (x + tint_symbol_298); + x = (x + tint_symbol_299); + x = (x + tint_symbol_300); + x = (x + tint_symbol_301); + x = (x + tint_symbol_302); + x = (x + tint_symbol_303); + x = (x + tint_symbol_304); + x = (x + tint_symbol_305); + x = (x + tint_symbol_306); + x = (x + tint_symbol_307); + x = (x + tint_symbol_308); + x = (x + tint_symbol_309); + x = (x + tint_symbol_310); + x = (x + tint_symbol_311); + x = (x + tint_symbol_312); + x = (x + tint_symbol_313); + x = (x + tint_symbol_314); + x = (x + tint_symbol_315); + x = (x + tint_symbol_316); + x = (x + tint_symbol_317); + x = (x + tint_symbol_318); + x = (x + tint_symbol_319); + x = (x + tint_symbol_320); + x = (x + tint_symbol_321); + x = (x + tint_symbol_322); + x = (x + tint_symbol_323); + x = (x + tint_symbol_324); + x = (x + tint_symbol_325); + x = (x + tint_symbol_326); + x = (x + tint_symbol_327); + x = (x + tint_symbol_328); + x = (x + tint_symbol_329); + x = (x + tint_symbol_330); + x = (x + tint_symbol_331); + x = (x + tint_symbol_332); + x = (x + tint_symbol_333); + x = (x + tint_symbol_334); + x = (x + tint_symbol_335); + x = (x + tint_symbol_336); + x = (x + tint_symbol_337); + x = (x + tint_symbol_338); + x = (x + tint_symbol_339); + x = (x + tint_symbol_340); + x = (x + tint_symbol_341); + x = (x + tint_symbol_342); + x = (x + tint_symbol_343); + x = (x + tint_symbol_344); + x = (x + tint_symbol_345); + x = (x + tint_symbol_346); + x = (x + tint_symbol_347); + x = (x + tint_symbol_348); + x = (x + tint_symbol_349); + x = (x + tint_symbol_350); + x = (x + tint_symbol_351); + x = (x + tint_symbol_352); + x = (x + tint_symbol_353); + x = (x + tint_symbol_354); + x = (x + tint_symbol_355); + x = (x + tint_symbol_356); + x = (x + tint_symbol_357); + x = (x + tint_symbol_358); + x = (x + tint_symbol_359); + x = (x + tint_symbol_360); + x = (x + tint_symbol_361); + x = (x + tint_symbol_362); + x = (x + tint_symbol_363); + x = (x + tint_symbol_364); + x = (x + tint_symbol_365); + x = (x + tint_symbol_366); + x = (x + tint_symbol_367); + x = (x + tint_symbol_368); + x = (x + tint_symbol_369); + x = (x + tint_symbol_370); + x = (x + tint_symbol_371); + x = (x + tint_symbol_372); + x = (x + tint_symbol_373); + x = (x + tint_symbol_374); + x = (x + tint_symbol_375); + x = (x + tint_symbol_376); + x = (x + tint_symbol_377); + x = (x + tint_symbol_378); + x = (x + tint_symbol_379); + x = (x + tint_symbol_380); + x = (x + tint_symbol_381); + x = (x + tint_symbol_382); + x = (x + tint_symbol_383); + x = (x + tint_symbol_384); + x = (x + tint_symbol_385); + x = (x + tint_symbol_386); + x = (x + tint_symbol_387); + x = (x + tint_symbol_388); + x = (x + tint_symbol_389); + x = (x + tint_symbol_390); + x = (x + tint_symbol_391); + x = (x + tint_symbol_392); + x = (x + tint_symbol_393); + x = (x + tint_symbol_394); + x = (x + tint_symbol_395); + x = (x + tint_symbol_396); + x = (x + tint_symbol_397); + x = (x + tint_symbol_398); + x = (x + tint_symbol_399); + x = (x + tint_symbol_400); + x = (x + tint_symbol_401); + x = (x + tint_symbol_402); + x = (x + tint_symbol_403); + x = (x + tint_symbol_404); + x = (x + tint_symbol_405); + x = (x + tint_symbol_406); + x = (x + tint_symbol_407); + x = (x + tint_symbol_408); + x = (x + tint_symbol_409); + x = (x + tint_symbol_410); + x = (x + tint_symbol_411); + x = (x + tint_symbol_412); + x = (x + tint_symbol_413); + x = (x + tint_symbol_414); + x = (x + tint_symbol_415); + x = (x + tint_symbol_416); + x = (x + tint_symbol_417); + x = (x + tint_symbol_418); + x = (x + tint_symbol_419); + x = (x + tint_symbol_420); + x = (x + tint_symbol_421); + x = (x + tint_symbol_422); + x = (x + tint_symbol_423); + x = (x + tint_symbol_424); + x = (x + tint_symbol_425); + x = (x + tint_symbol_426); + x = (x + tint_symbol_427); + x = (x + tint_symbol_428); + x = (x + tint_symbol_429); + x = (x + tint_symbol_430); + x = (x + tint_symbol_431); + x = (x + tint_symbol_432); + x = (x + tint_symbol_433); + x = (x + tint_symbol_434); + x = (x + tint_symbol_435); + x = (x + tint_symbol_436); + x = (x + tint_symbol_437); + x = (x + tint_symbol_438); + x = (x + tint_symbol_439); + x = (x + tint_symbol_440); + x = (x + tint_symbol_441); + x = (x + tint_symbol_442); + x = (x + tint_symbol_443); + x = (x + tint_symbol_444); + x = (x + tint_symbol_445); + x = (x + tint_symbol_446); + x = (x + tint_symbol_447); + x = (x + tint_symbol_448); + x = (x + tint_symbol_449); + x = (x + tint_symbol_450); + x = (x + tint_symbol_451); + x = (x + tint_symbol_452); + x = (x + tint_symbol_453); + x = (x + tint_symbol_454); + x = (x + tint_symbol_455); + x = (x + tint_symbol_456); + x = (x + tint_symbol_457); + x = (x + tint_symbol_458); + x = (x + tint_symbol_459); + x = (x + tint_symbol_460); + x = (x + tint_symbol_461); + x = (x + tint_symbol_462); + x = (x + tint_symbol_463); + x = (x + tint_symbol_464); + x = (x + tint_symbol_465); + x = (x + tint_symbol_466); + x = (x + tint_symbol_467); + x = (x + tint_symbol_468); + x = (x + tint_symbol_469); + x = (x + tint_symbol_470); + x = (x + tint_symbol_471); + x = (x + tint_symbol_472); + x = (x + tint_symbol_473); + x = (x + tint_symbol_474); + x = (x + tint_symbol_475); + x = (x + tint_symbol_476); + x = (x + tint_symbol_477); + x = (x + tint_symbol_478); + x = (x + tint_symbol_479); + x = (x + tint_symbol_480); + x = (x + tint_symbol_481); + x = (x + tint_symbol_482); + x = (x + tint_symbol_483); + x = (x + tint_symbol_484); + x = (x + tint_symbol_485); + x = (x + tint_symbol_486); + x = (x + tint_symbol_487); + x = (x + tint_symbol_488); + x = (x + tint_symbol_489); + x = (x + tint_symbol_490); + x = (x + tint_symbol_491); + x = (x + tint_symbol_492); + x = (x + tint_symbol_493); + x = (x + tint_symbol_494); + x = (x + tint_symbol_495); + x = (x + tint_symbol_496); + x = (x + tint_symbol_497); + x = (x + tint_symbol_498); + x = (x + tint_symbol_499); + x = (x + tint_symbol_500); + x = (x + tint_symbol_501); + x = (x + tint_symbol_502); + x = (x + tint_symbol_503); + x = (x + tint_symbol_504); + x = (x + tint_symbol_505); + x = (x + tint_symbol_506); + x = (x + tint_symbol_507); + x = (x + tint_symbol_508); + x = (x + tint_symbol_509); + x = (x + tint_symbol_510); + x = (x + tint_symbol_511); + x = (x + tint_symbol_512); + x = (x + tint_symbol_513); + x = (x + tint_symbol_514); + x = (x + tint_symbol_515); + x = (x + tint_symbol_516); + x = (x + tint_symbol_517); + x = (x + tint_symbol_518); + x = (x + tint_symbol_519); + x = (x + tint_symbol_520); + x = (x + tint_symbol_521); + x = (x + tint_symbol_522); + x = (x + tint_symbol_523); + x = (x + tint_symbol_524); + x = (x + tint_symbol_525); + x = (x + tint_symbol_526); + x = (x + tint_symbol_527); + x = (x + tint_symbol_528); + x = (x + tint_symbol_529); + x = (x + tint_symbol_530); + x = (x + tint_symbol_531); + x = (x + tint_symbol_532); + x = (x + tint_symbol_533); + x = (x + tint_symbol_534); + x = (x + tint_symbol_535); + x = (x + tint_symbol_536); + x = (x + tint_symbol_537); + x = (x + tint_symbol_538); + x = (x + tint_symbol_539); + x = (x + tint_symbol_540); + x = (x + tint_symbol_541); + x = (x + tint_symbol_542); + x = (x + tint_symbol_543); + x = (x + tint_symbol_544); + x = (x + tint_symbol_545); + x = (x + tint_symbol_546); + x = (x + tint_symbol_547); + x = (x + tint_symbol_548); + x = (x + tint_symbol_549); + x = (x + tint_symbol_550); + x = (x + tint_symbol_551); + x = (x + tint_symbol_552); + x = (x + tint_symbol_553); + x = (x + tint_symbol_554); + x = (x + tint_symbol_555); + x = (x + tint_symbol_556); + x = (x + tint_symbol_557); + x = (x + tint_symbol_558); + x = (x + tint_symbol_559); + x = (x + tint_symbol_560); + x = (x + tint_symbol_561); + x = (x + tint_symbol_562); + x = (x + tint_symbol_563); + x = (x + tint_symbol_564); + x = (x + tint_symbol_565); + x = (x + tint_symbol_566); + x = (x + tint_symbol_567); + x = (x + tint_symbol_568); + x = (x + tint_symbol_569); + x = (x + tint_symbol_570); + x = (x + tint_symbol_571); + x = (x + tint_symbol_572); + x = (x + tint_symbol_573); + x = (x + tint_symbol_574); + x = (x + tint_symbol_575); + x = (x + tint_symbol_576); + x = (x + tint_symbol_577); + x = (x + tint_symbol_578); + x = (x + tint_symbol_579); + x = (x + tint_symbol_580); + x = (x + tint_symbol_581); + x = (x + tint_symbol_582); + x = (x + tint_symbol_583); + x = (x + tint_symbol_584); + x = (x + tint_symbol_585); + x = (x + tint_symbol_586); + x = (x + tint_symbol_587); + x = (x + tint_symbol_588); + x = (x + tint_symbol_589); + x = (x + tint_symbol_590); + x = (x + tint_symbol_591); + x = (x + tint_symbol_592); + x = (x + tint_symbol_593); + x = (x + tint_symbol_594); + x = (x + tint_symbol_595); + x = (x + tint_symbol_596); + x = (x + tint_symbol_597); + x = (x + tint_symbol_598); + x = (x + tint_symbol_599); + x = (x + tint_symbol_600); + x = (x + tint_symbol_601); + x = (x + tint_symbol_602); + x = (x + tint_symbol_603); + x = (x + tint_symbol_604); + x = (x + tint_symbol_605); + x = (x + tint_symbol_606); + x = (x + tint_symbol_607); + x = (x + tint_symbol_608); + x = (x + tint_symbol_609); + x = (x + tint_symbol_610); + x = (x + tint_symbol_611); + x = (x + tint_symbol_612); + x = (x + tint_symbol_613); + x = (x + tint_symbol_614); + x = (x + tint_symbol_615); + x = (x + tint_symbol_616); + x = (x + tint_symbol_617); + x = (x + tint_symbol_618); + x = (x + tint_symbol_619); + x = (x + tint_symbol_620); + x = (x + tint_symbol_621); + x = (x + tint_symbol_622); + x = (x + tint_symbol_623); + x = (x + tint_symbol_624); + x = (x + tint_symbol_625); + x = (x + tint_symbol_626); + x = (x + tint_symbol_627); + x = (x + tint_symbol_628); + x = (x + tint_symbol_629); + x = (x + tint_symbol_630); + x = (x + tint_symbol_631); + x = (x + tint_symbol_632); + x = (x + tint_symbol_633); + x = (x + tint_symbol_634); + x = (x + tint_symbol_635); + x = (x + tint_symbol_636); + x = (x + tint_symbol_637); + x = (x + tint_symbol_638); + x = (x + tint_symbol_639); + x = (x + tint_symbol_640); + x = (x + tint_symbol_641); + x = (x + tint_symbol_642); + x = (x + tint_symbol_643); + x = (x + tint_symbol_644); + x = (x + tint_symbol_645); + x = (x + tint_symbol_646); + x = (x + tint_symbol_647); + x = (x + tint_symbol_648); + x = (x + tint_symbol_649); + x = (x + tint_symbol_650); + x = (x + tint_symbol_651); + x = (x + tint_symbol_652); + x = (x + tint_symbol_653); + x = (x + tint_symbol_654); + x = (x + tint_symbol_655); + x = (x + tint_symbol_656); + x = (x + tint_symbol_657); + x = (x + tint_symbol_658); + x = (x + tint_symbol_659); + x = (x + tint_symbol_660); + x = (x + tint_symbol_661); + x = (x + tint_symbol_662); + x = (x + tint_symbol_663); + x = (x + tint_symbol_664); + x = (x + tint_symbol_665); + x = (x + tint_symbol_666); + x = (x + tint_symbol_667); + x = (x + tint_symbol_668); + x = (x + tint_symbol_669); + x = (x + tint_symbol_670); + x = (x + tint_symbol_671); + x = (x + tint_symbol_672); + x = (x + tint_symbol_673); + x = (x + tint_symbol_674); + x = (x + tint_symbol_675); + x = (x + tint_symbol_676); + x = (x + tint_symbol_677); + x = (x + tint_symbol_678); + x = (x + tint_symbol_679); + x = (x + tint_symbol_680); + x = (x + tint_symbol_681); + x = (x + tint_symbol_682); + x = (x + tint_symbol_683); + x = (x + tint_symbol_684); + x = (x + tint_symbol_685); + x = (x + tint_symbol_686); + x = (x + tint_symbol_687); + x = (x + tint_symbol_688); + x = (x + tint_symbol_689); + x = (x + tint_symbol_690); + x = (x + tint_symbol_691); + x = (x + tint_symbol_692); + x = (x + tint_symbol_693); + x = (x + tint_symbol_694); + x = (x + tint_symbol_695); + x = (x + tint_symbol_696); + x = (x + tint_symbol_697); + x = (x + tint_symbol_698); + x = (x + tint_symbol_699); + x = (x + tint_symbol_700); + x = (x + tint_symbol_701); + x = (x + tint_symbol_702); + x = (x + tint_symbol_703); + x = (x + tint_symbol_704); + x = (x + tint_symbol_705); + x = (x + tint_symbol_706); + x = (x + tint_symbol_707); + x = (x + tint_symbol_708); + x = (x + tint_symbol_709); + x = (x + tint_symbol_710); + x = (x + tint_symbol_711); + x = (x + tint_symbol_712); + x = (x + tint_symbol_713); + x = (x + tint_symbol_714); + x = (x + tint_symbol_715); + x = (x + tint_symbol_716); + x = (x + tint_symbol_717); + x = (x + tint_symbol_718); + x = (x + tint_symbol_719); + x = (x + tint_symbol_720); + x = (x + tint_symbol_721); + x = (x + tint_symbol_722); + x = (x + tint_symbol_723); + x = (x + tint_symbol_724); + x = (x + tint_symbol_725); + x = (x + tint_symbol_726); + x = (x + tint_symbol_727); + x = (x + tint_symbol_728); + x = (x + tint_symbol_729); + x = (x + tint_symbol_730); + x = (x + tint_symbol_731); + x = (x + tint_symbol_732); + x = (x + tint_symbol_733); + x = (x + tint_symbol_734); + x = (x + tint_symbol_735); + x = (x + tint_symbol_736); + x = (x + tint_symbol_737); + x = (x + tint_symbol_738); + x = (x + tint_symbol_739); + x = (x + tint_symbol_740); + x = (x + tint_symbol_741); + x = (x + tint_symbol_742); + x = (x + tint_symbol_743); + x = (x + tint_symbol_744); + x = (x + tint_symbol_745); + x = (x + tint_symbol_746); + x = (x + tint_symbol_747); + x = (x + tint_symbol_748); + x = (x + tint_symbol_749); + x = (x + tint_symbol_750); + x = (x + tint_symbol_751); + x = (x + tint_symbol_752); + x = (x + tint_symbol_753); + x = (x + tint_symbol_754); + x = (x + tint_symbol_755); + x = (x + tint_symbol_756); + x = (x + tint_symbol_757); + x = (x + tint_symbol_758); + x = (x + tint_symbol_759); + x = (x + tint_symbol_760); + x = (x + tint_symbol_761); + x = (x + tint_symbol_762); + x = (x + tint_symbol_763); + x = (x + tint_symbol_764); + x = (x + tint_symbol_765); + x = (x + tint_symbol_766); + x = (x + tint_symbol_767); + x = (x + tint_symbol_768); + x = (x + tint_symbol_769); + x = (x + tint_symbol_770); + x = (x + tint_symbol_771); + x = (x + tint_symbol_772); + x = (x + tint_symbol_773); + x = (x + tint_symbol_774); + x = (x + tint_symbol_775); + x = (x + tint_symbol_776); + x = (x + tint_symbol_777); + x = (x + tint_symbol_778); + x = (x + tint_symbol_779); + x = (x + tint_symbol_780); + x = (x + tint_symbol_781); + x = (x + tint_symbol_782); + x = (x + tint_symbol_783); + x = (x + tint_symbol_784); + x = (x + tint_symbol_785); + x = (x + tint_symbol_786); + x = (x + tint_symbol_787); + x = (x + tint_symbol_788); + x = (x + tint_symbol_789); + x = (x + tint_symbol_790); + x = (x + tint_symbol_791); + x = (x + tint_symbol_792); + x = (x + tint_symbol_793); + x = (x + tint_symbol_794); + x = (x + tint_symbol_795); + x = (x + tint_symbol_796); + x = (x + tint_symbol_797); + x = (x + tint_symbol_798); + x = (x + tint_symbol_799); + x = (x + tint_symbol_800); + x = (x + tint_symbol_801); + x = (x + tint_symbol_802); + x = (x + tint_symbol_803); + x = (x + tint_symbol_804); + x = (x + tint_symbol_805); + x = (x + tint_symbol_806); + x = (x + tint_symbol_807); + x = (x + tint_symbol_808); + x = (x + tint_symbol_809); + x = (x + tint_symbol_810); + x = (x + tint_symbol_811); + x = (x + tint_symbol_812); + x = (x + tint_symbol_813); + x = (x + tint_symbol_814); + x = (x + tint_symbol_815); + x = (x + tint_symbol_816); + x = (x + tint_symbol_817); + x = (x + tint_symbol_818); + x = (x + tint_symbol_819); + x = (x + tint_symbol_820); + x = (x + tint_symbol_821); + x = (x + tint_symbol_822); + x = (x + tint_symbol_823); + x = (x + tint_symbol_824); + x = (x + tint_symbol_825); + x = (x + tint_symbol_826); + x = (x + tint_symbol_827); + x = (x + tint_symbol_828); + x = (x + tint_symbol_829); + x = (x + tint_symbol_830); + x = (x + tint_symbol_831); + x = (x + tint_symbol_832); + x = (x + tint_symbol_833); + x = (x + tint_symbol_834); + x = (x + tint_symbol_835); + x = (x + tint_symbol_836); + x = (x + tint_symbol_837); + x = (x + tint_symbol_838); + x = (x + tint_symbol_839); + x = (x + tint_symbol_840); + x = (x + tint_symbol_841); + x = (x + tint_symbol_842); + x = (x + tint_symbol_843); + x = (x + tint_symbol_844); + x = (x + tint_symbol_845); + x = (x + tint_symbol_846); + x = (x + tint_symbol_847); + x = (x + tint_symbol_848); + x = (x + tint_symbol_849); + x = (x + tint_symbol_850); + x = (x + tint_symbol_851); + x = (x + tint_symbol_852); + x = (x + tint_symbol_853); + x = (x + tint_symbol_854); + x = (x + tint_symbol_855); + x = (x + tint_symbol_856); + x = (x + tint_symbol_857); + x = (x + tint_symbol_858); + x = (x + tint_symbol_859); + x = (x + tint_symbol_860); + x = (x + tint_symbol_861); + x = (x + tint_symbol_862); + x = (x + tint_symbol_863); + x = (x + tint_symbol_864); + x = (x + tint_symbol_865); + x = (x + tint_symbol_866); + x = (x + tint_symbol_867); + x = (x + tint_symbol_868); + x = (x + tint_symbol_869); + x = (x + tint_symbol_870); + x = (x + tint_symbol_871); + x = (x + tint_symbol_872); + x = (x + tint_symbol_873); + x = (x + tint_symbol_874); + x = (x + tint_symbol_875); + x = (x + tint_symbol_876); + x = (x + tint_symbol_877); + x = (x + tint_symbol_878); + x = (x + tint_symbol_879); + x = (x + tint_symbol_880); + x = (x + tint_symbol_881); + x = (x + tint_symbol_882); + x = (x + tint_symbol_883); + x = (x + tint_symbol_884); + x = (x + tint_symbol_885); + x = (x + tint_symbol_886); + x = (x + tint_symbol_887); + x = (x + tint_symbol_888); + x = (x + tint_symbol_889); + x = (x + tint_symbol_890); + x = (x + tint_symbol_891); + x = (x + tint_symbol_892); + x = (x + tint_symbol_893); + x = (x + tint_symbol_894); + x = (x + tint_symbol_895); + x = (x + tint_symbol_896); + x = (x + tint_symbol_897); + x = (x + tint_symbol_898); + x = (x + tint_symbol_899); + x = (x + tint_symbol_900); + x = (x + tint_symbol_901); + x = (x + tint_symbol_902); + x = (x + tint_symbol_903); + x = (x + tint_symbol_904); + x = (x + tint_symbol_905); + x = (x + tint_symbol_906); + x = (x + tint_symbol_907); + x = (x + tint_symbol_908); + x = (x + tint_symbol_909); + x = (x + tint_symbol_910); + x = (x + tint_symbol_911); + x = (x + tint_symbol_912); + x = (x + tint_symbol_913); + x = (x + tint_symbol_914); + x = (x + tint_symbol_915); + x = (x + tint_symbol_916); + x = (x + tint_symbol_917); + x = (x + tint_symbol_918); + x = (x + tint_symbol_919); + x = (x + tint_symbol_920); + x = (x + tint_symbol_921); + x = (x + tint_symbol_922); + x = (x + tint_symbol_923); + x = (x + tint_symbol_924); + x = (x + tint_symbol_925); + x = (x + tint_symbol_926); + x = (x + tint_symbol_927); + x = (x + tint_symbol_928); + x = (x + tint_symbol_929); + x = (x + tint_symbol_930); + x = (x + tint_symbol_931); + x = (x + tint_symbol_932); + x = (x + tint_symbol_933); + x = (x + tint_symbol_934); + x = (x + tint_symbol_935); + x = (x + tint_symbol_936); + x = (x + tint_symbol_937); + x = (x + tint_symbol_938); + x = (x + tint_symbol_939); + x = (x + tint_symbol_940); + x = (x + tint_symbol_941); + x = (x + tint_symbol_942); + x = (x + tint_symbol_943); + x = (x + tint_symbol_944); + x = (x + tint_symbol_945); + x = (x + tint_symbol_946); + x = (x + tint_symbol_947); + x = (x + tint_symbol_948); + x = (x + tint_symbol_949); + x = (x + tint_symbol_950); + x = (x + tint_symbol_951); + x = (x + tint_symbol_952); + x = (x + tint_symbol_953); + x = (x + tint_symbol_954); + x = (x + tint_symbol_955); + x = (x + tint_symbol_956); + x = (x + tint_symbol_957); + x = (x + tint_symbol_958); + x = (x + tint_symbol_959); + x = (x + tint_symbol_960); + x = (x + tint_symbol_961); + x = (x + tint_symbol_962); + x = (x + tint_symbol_963); + x = (x + tint_symbol_964); + x = (x + tint_symbol_965); + x = (x + tint_symbol_966); + x = (x + tint_symbol_967); + x = (x + tint_symbol_968); + x = (x + tint_symbol_969); + x = (x + tint_symbol_970); + x = (x + tint_symbol_971); + x = (x + tint_symbol_972); + x = (x + tint_symbol_973); + x = (x + tint_symbol_974); + x = (x + tint_symbol_975); + x = (x + tint_symbol_976); + x = (x + tint_symbol_977); + x = (x + tint_symbol_978); + x = (x + tint_symbol_979); + x = (x + tint_symbol_980); + x = (x + tint_symbol_981); + x = (x + tint_symbol_982); + x = (x + tint_symbol_983); + x = (x + tint_symbol_984); + x = (x + tint_symbol_985); + x = (x + tint_symbol_986); + x = (x + tint_symbol_987); + x = (x + tint_symbol_988); + x = (x + tint_symbol_989); + x = (x + tint_symbol_990); + x = (x + tint_symbol_991); + x = (x + tint_symbol_992); + x = (x + tint_symbol_993); + x = (x + tint_symbol_994); + x = (x + tint_symbol_995); + x = (x + tint_symbol_996); + x = (x + tint_symbol_997); + x = (x + tint_symbol_998); + x = (x + tint_symbol_999); + x = (x + tint_symbol_1000); + x = (x + tint_symbol_1001); + return x; +} + +struct tint_symbol_1 { + uint value [[color(0)]]; +}; + +uint tint_symbol_inner() { + return foo(); +} + +fragment tint_symbol_1 tint_symbol() { + uint const inner_result = tint_symbol_inner(); + tint_symbol_1 wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + diff --git a/test/tint/bug/tint/1509.wgsl.expected.spvasm b/test/tint/bug/tint/1509.wgsl.expected.spvasm new file mode 100644 index 0000000000..eaf2f4bf66 --- /dev/null +++ b/test/tint/bug/tint/1509.wgsl.expected.spvasm @@ -0,0 +1,6042 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 4020 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %value + OpExecutionMode %main OriginUpperLeft + OpName %value "value" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + OpName %v5 "v5" + OpName %v6 "v6" + OpName %v7 "v7" + OpName %v8 "v8" + OpName %v9 "v9" + OpName %v10 "v10" + OpName %v11 "v11" + OpName %v12 "v12" + OpName %v13 "v13" + OpName %v14 "v14" + OpName %v15 "v15" + OpName %v16 "v16" + OpName %v17 "v17" + OpName %v18 "v18" + OpName %v19 "v19" + OpName %v20 "v20" + OpName %v21 "v21" + OpName %v22 "v22" + OpName %v23 "v23" + OpName %v24 "v24" + OpName %v25 "v25" + OpName %v26 "v26" + OpName %v27 "v27" + OpName %v28 "v28" + OpName %v29 "v29" + OpName %v30 "v30" + OpName %v31 "v31" + OpName %v32 "v32" + OpName %v33 "v33" + OpName %v34 "v34" + OpName %v35 "v35" + OpName %v36 "v36" + OpName %v37 "v37" + OpName %v38 "v38" + OpName %v39 "v39" + OpName %v40 "v40" + OpName %v41 "v41" + OpName %v42 "v42" + OpName %v43 "v43" + OpName %v44 "v44" + OpName %v45 "v45" + OpName %v46 "v46" + OpName %v47 "v47" + OpName %v48 "v48" + OpName %v49 "v49" + OpName %v50 "v50" + OpName %v51 "v51" + OpName %v52 "v52" + OpName %v53 "v53" + OpName %v54 "v54" + OpName %v55 "v55" + OpName %v56 "v56" + OpName %v57 "v57" + OpName %v58 "v58" + OpName %v59 "v59" + OpName %v60 "v60" + OpName %v61 "v61" + OpName %v62 "v62" + OpName %v63 "v63" + OpName %v64 "v64" + OpName %v65 "v65" + OpName %v66 "v66" + OpName %v67 "v67" + OpName %v68 "v68" + OpName %v69 "v69" + OpName %v70 "v70" + OpName %v71 "v71" + OpName %v72 "v72" + OpName %v73 "v73" + OpName %v74 "v74" + OpName %v75 "v75" + OpName %v76 "v76" + OpName %v77 "v77" + OpName %v78 "v78" + OpName %v79 "v79" + OpName %v80 "v80" + OpName %v81 "v81" + OpName %v82 "v82" + OpName %v83 "v83" + OpName %v84 "v84" + OpName %v85 "v85" + OpName %v86 "v86" + OpName %v87 "v87" + OpName %v88 "v88" + OpName %v89 "v89" + OpName %v90 "v90" + OpName %v91 "v91" + OpName %v92 "v92" + OpName %v93 "v93" + OpName %v94 "v94" + OpName %v95 "v95" + OpName %v96 "v96" + OpName %v97 "v97" + OpName %v98 "v98" + OpName %v99 "v99" + OpName %v100 "v100" + OpName %v101 "v101" + OpName %v102 "v102" + OpName %v103 "v103" + OpName %v104 "v104" + OpName %v105 "v105" + OpName %v106 "v106" + OpName %v107 "v107" + OpName %v108 "v108" + OpName %v109 "v109" + OpName %v110 "v110" + OpName %v111 "v111" + OpName %v112 "v112" + OpName %v113 "v113" + OpName %v114 "v114" + OpName %v115 "v115" + OpName %v116 "v116" + OpName %v117 "v117" + OpName %v118 "v118" + OpName %v119 "v119" + OpName %v120 "v120" + OpName %v121 "v121" + OpName %v122 "v122" + OpName %v123 "v123" + OpName %v124 "v124" + OpName %v125 "v125" + OpName %v126 "v126" + OpName %v127 "v127" + OpName %v128 "v128" + OpName %v129 "v129" + OpName %v130 "v130" + OpName %v131 "v131" + OpName %v132 "v132" + OpName %v133 "v133" + OpName %v134 "v134" + OpName %v135 "v135" + OpName %v136 "v136" + OpName %v137 "v137" + OpName %v138 "v138" + OpName %v139 "v139" + OpName %v140 "v140" + OpName %v141 "v141" + OpName %v142 "v142" + OpName %v143 "v143" + OpName %v144 "v144" + OpName %v145 "v145" + OpName %v146 "v146" + OpName %v147 "v147" + OpName %v148 "v148" + OpName %v149 "v149" + OpName %v150 "v150" + OpName %v151 "v151" + OpName %v152 "v152" + OpName %v153 "v153" + OpName %v154 "v154" + OpName %v155 "v155" + OpName %v156 "v156" + OpName %v157 "v157" + OpName %v158 "v158" + OpName %v159 "v159" + OpName %v160 "v160" + OpName %v161 "v161" + OpName %v162 "v162" + OpName %v163 "v163" + OpName %v164 "v164" + OpName %v165 "v165" + OpName %v166 "v166" + OpName %v167 "v167" + OpName %v168 "v168" + OpName %v169 "v169" + OpName %v170 "v170" + OpName %v171 "v171" + OpName %v172 "v172" + OpName %v173 "v173" + OpName %v174 "v174" + OpName %v175 "v175" + OpName %v176 "v176" + OpName %v177 "v177" + OpName %v178 "v178" + OpName %v179 "v179" + OpName %v180 "v180" + OpName %v181 "v181" + OpName %v182 "v182" + OpName %v183 "v183" + OpName %v184 "v184" + OpName %v185 "v185" + OpName %v186 "v186" + OpName %v187 "v187" + OpName %v188 "v188" + OpName %v189 "v189" + OpName %v190 "v190" + OpName %v191 "v191" + OpName %v192 "v192" + OpName %v193 "v193" + OpName %v194 "v194" + OpName %v195 "v195" + OpName %v196 "v196" + OpName %v197 "v197" + OpName %v198 "v198" + OpName %v199 "v199" + OpName %v200 "v200" + OpName %v201 "v201" + OpName %v202 "v202" + OpName %v203 "v203" + OpName %v204 "v204" + OpName %v205 "v205" + OpName %v206 "v206" + OpName %v207 "v207" + OpName %v208 "v208" + OpName %v209 "v209" + OpName %v210 "v210" + OpName %v211 "v211" + OpName %v212 "v212" + OpName %v213 "v213" + OpName %v214 "v214" + OpName %v215 "v215" + OpName %v216 "v216" + OpName %v217 "v217" + OpName %v218 "v218" + OpName %v219 "v219" + OpName %v220 "v220" + OpName %v221 "v221" + OpName %v222 "v222" + OpName %v223 "v223" + OpName %v224 "v224" + OpName %v225 "v225" + OpName %v226 "v226" + OpName %v227 "v227" + OpName %v228 "v228" + OpName %v229 "v229" + OpName %v230 "v230" + OpName %v231 "v231" + OpName %v232 "v232" + OpName %v233 "v233" + OpName %v234 "v234" + OpName %v235 "v235" + OpName %v236 "v236" + OpName %v237 "v237" + OpName %v238 "v238" + OpName %v239 "v239" + OpName %v240 "v240" + OpName %v241 "v241" + OpName %v242 "v242" + OpName %v243 "v243" + OpName %v244 "v244" + OpName %v245 "v245" + OpName %v246 "v246" + OpName %v247 "v247" + OpName %v248 "v248" + OpName %v249 "v249" + OpName %v250 "v250" + OpName %v251 "v251" + OpName %v252 "v252" + OpName %v253 "v253" + OpName %v254 "v254" + OpName %v255 "v255" + OpName %v256 "v256" + OpName %v257 "v257" + OpName %v258 "v258" + OpName %v259 "v259" + OpName %v260 "v260" + OpName %v261 "v261" + OpName %v262 "v262" + OpName %v263 "v263" + OpName %v264 "v264" + OpName %v265 "v265" + OpName %v266 "v266" + OpName %v267 "v267" + OpName %v268 "v268" + OpName %v269 "v269" + OpName %v270 "v270" + OpName %v271 "v271" + OpName %v272 "v272" + OpName %v273 "v273" + OpName %v274 "v274" + OpName %v275 "v275" + OpName %v276 "v276" + OpName %v277 "v277" + OpName %v278 "v278" + OpName %v279 "v279" + OpName %v280 "v280" + OpName %v281 "v281" + OpName %v282 "v282" + OpName %v283 "v283" + OpName %v284 "v284" + OpName %v285 "v285" + OpName %v286 "v286" + OpName %v287 "v287" + OpName %v288 "v288" + OpName %v289 "v289" + OpName %v290 "v290" + OpName %v291 "v291" + OpName %v292 "v292" + OpName %v293 "v293" + OpName %v294 "v294" + OpName %v295 "v295" + OpName %v296 "v296" + OpName %v297 "v297" + OpName %v298 "v298" + OpName %v299 "v299" + OpName %v300 "v300" + OpName %v301 "v301" + OpName %v302 "v302" + OpName %v303 "v303" + OpName %v304 "v304" + OpName %v305 "v305" + OpName %v306 "v306" + OpName %v307 "v307" + OpName %v308 "v308" + OpName %v309 "v309" + OpName %v310 "v310" + OpName %v311 "v311" + OpName %v312 "v312" + OpName %v313 "v313" + OpName %v314 "v314" + OpName %v315 "v315" + OpName %v316 "v316" + OpName %v317 "v317" + OpName %v318 "v318" + OpName %v319 "v319" + OpName %v320 "v320" + OpName %v321 "v321" + OpName %v322 "v322" + OpName %v323 "v323" + OpName %v324 "v324" + OpName %v325 "v325" + OpName %v326 "v326" + OpName %v327 "v327" + OpName %v328 "v328" + OpName %v329 "v329" + OpName %v330 "v330" + OpName %v331 "v331" + OpName %v332 "v332" + OpName %v333 "v333" + OpName %v334 "v334" + OpName %v335 "v335" + OpName %v336 "v336" + OpName %v337 "v337" + OpName %v338 "v338" + OpName %v339 "v339" + OpName %v340 "v340" + OpName %v341 "v341" + OpName %v342 "v342" + OpName %v343 "v343" + OpName %v344 "v344" + OpName %v345 "v345" + OpName %v346 "v346" + OpName %v347 "v347" + OpName %v348 "v348" + OpName %v349 "v349" + OpName %v350 "v350" + OpName %v351 "v351" + OpName %v352 "v352" + OpName %v353 "v353" + OpName %v354 "v354" + OpName %v355 "v355" + OpName %v356 "v356" + OpName %v357 "v357" + OpName %v358 "v358" + OpName %v359 "v359" + OpName %v360 "v360" + OpName %v361 "v361" + OpName %v362 "v362" + OpName %v363 "v363" + OpName %v364 "v364" + OpName %v365 "v365" + OpName %v366 "v366" + OpName %v367 "v367" + OpName %v368 "v368" + OpName %v369 "v369" + OpName %v370 "v370" + OpName %v371 "v371" + OpName %v372 "v372" + OpName %v373 "v373" + OpName %v374 "v374" + OpName %v375 "v375" + OpName %v376 "v376" + OpName %v377 "v377" + OpName %v378 "v378" + OpName %v379 "v379" + OpName %v380 "v380" + OpName %v381 "v381" + OpName %v382 "v382" + OpName %v383 "v383" + OpName %v384 "v384" + OpName %v385 "v385" + OpName %v386 "v386" + OpName %v387 "v387" + OpName %v388 "v388" + OpName %v389 "v389" + OpName %v390 "v390" + OpName %v391 "v391" + OpName %v392 "v392" + OpName %v393 "v393" + OpName %v394 "v394" + OpName %v395 "v395" + OpName %v396 "v396" + OpName %v397 "v397" + OpName %v398 "v398" + OpName %v399 "v399" + OpName %v400 "v400" + OpName %v401 "v401" + OpName %v402 "v402" + OpName %v403 "v403" + OpName %v404 "v404" + OpName %v405 "v405" + OpName %v406 "v406" + OpName %v407 "v407" + OpName %v408 "v408" + OpName %v409 "v409" + OpName %v410 "v410" + OpName %v411 "v411" + OpName %v412 "v412" + OpName %v413 "v413" + OpName %v414 "v414" + OpName %v415 "v415" + OpName %v416 "v416" + OpName %v417 "v417" + OpName %v418 "v418" + OpName %v419 "v419" + OpName %v420 "v420" + OpName %v421 "v421" + OpName %v422 "v422" + OpName %v423 "v423" + OpName %v424 "v424" + OpName %v425 "v425" + OpName %v426 "v426" + OpName %v427 "v427" + OpName %v428 "v428" + OpName %v429 "v429" + OpName %v430 "v430" + OpName %v431 "v431" + OpName %v432 "v432" + OpName %v433 "v433" + OpName %v434 "v434" + OpName %v435 "v435" + OpName %v436 "v436" + OpName %v437 "v437" + OpName %v438 "v438" + OpName %v439 "v439" + OpName %v440 "v440" + OpName %v441 "v441" + OpName %v442 "v442" + OpName %v443 "v443" + OpName %v444 "v444" + OpName %v445 "v445" + OpName %v446 "v446" + OpName %v447 "v447" + OpName %v448 "v448" + OpName %v449 "v449" + OpName %v450 "v450" + OpName %v451 "v451" + OpName %v452 "v452" + OpName %v453 "v453" + OpName %v454 "v454" + OpName %v455 "v455" + OpName %v456 "v456" + OpName %v457 "v457" + OpName %v458 "v458" + OpName %v459 "v459" + OpName %v460 "v460" + OpName %v461 "v461" + OpName %v462 "v462" + OpName %v463 "v463" + OpName %v464 "v464" + OpName %v465 "v465" + OpName %v466 "v466" + OpName %v467 "v467" + OpName %v468 "v468" + OpName %v469 "v469" + OpName %v470 "v470" + OpName %v471 "v471" + OpName %v472 "v472" + OpName %v473 "v473" + OpName %v474 "v474" + OpName %v475 "v475" + OpName %v476 "v476" + OpName %v477 "v477" + OpName %v478 "v478" + OpName %v479 "v479" + OpName %v480 "v480" + OpName %v481 "v481" + OpName %v482 "v482" + OpName %v483 "v483" + OpName %v484 "v484" + OpName %v485 "v485" + OpName %v486 "v486" + OpName %v487 "v487" + OpName %v488 "v488" + OpName %v489 "v489" + OpName %v490 "v490" + OpName %v491 "v491" + OpName %v492 "v492" + OpName %v493 "v493" + OpName %v494 "v494" + OpName %v495 "v495" + OpName %v496 "v496" + OpName %v497 "v497" + OpName %v498 "v498" + OpName %v499 "v499" + OpName %v500 "v500" + OpName %v501 "v501" + OpName %v502 "v502" + OpName %v503 "v503" + OpName %v504 "v504" + OpName %v505 "v505" + OpName %v506 "v506" + OpName %v507 "v507" + OpName %v508 "v508" + OpName %v509 "v509" + OpName %v510 "v510" + OpName %v511 "v511" + OpName %v512 "v512" + OpName %v513 "v513" + OpName %v514 "v514" + OpName %v515 "v515" + OpName %v516 "v516" + OpName %v517 "v517" + OpName %v518 "v518" + OpName %v519 "v519" + OpName %v520 "v520" + OpName %v521 "v521" + OpName %v522 "v522" + OpName %v523 "v523" + OpName %v524 "v524" + OpName %v525 "v525" + OpName %v526 "v526" + OpName %v527 "v527" + OpName %v528 "v528" + OpName %v529 "v529" + OpName %v530 "v530" + OpName %v531 "v531" + OpName %v532 "v532" + OpName %v533 "v533" + OpName %v534 "v534" + OpName %v535 "v535" + OpName %v536 "v536" + OpName %v537 "v537" + OpName %v538 "v538" + OpName %v539 "v539" + OpName %v540 "v540" + OpName %v541 "v541" + OpName %v542 "v542" + OpName %v543 "v543" + OpName %v544 "v544" + OpName %v545 "v545" + OpName %v546 "v546" + OpName %v547 "v547" + OpName %v548 "v548" + OpName %v549 "v549" + OpName %v550 "v550" + OpName %v551 "v551" + OpName %v552 "v552" + OpName %v553 "v553" + OpName %v554 "v554" + OpName %v555 "v555" + OpName %v556 "v556" + OpName %v557 "v557" + OpName %v558 "v558" + OpName %v559 "v559" + OpName %v560 "v560" + OpName %v561 "v561" + OpName %v562 "v562" + OpName %v563 "v563" + OpName %v564 "v564" + OpName %v565 "v565" + OpName %v566 "v566" + OpName %v567 "v567" + OpName %v568 "v568" + OpName %v569 "v569" + OpName %v570 "v570" + OpName %v571 "v571" + OpName %v572 "v572" + OpName %v573 "v573" + OpName %v574 "v574" + OpName %v575 "v575" + OpName %v576 "v576" + OpName %v577 "v577" + OpName %v578 "v578" + OpName %v579 "v579" + OpName %v580 "v580" + OpName %v581 "v581" + OpName %v582 "v582" + OpName %v583 "v583" + OpName %v584 "v584" + OpName %v585 "v585" + OpName %v586 "v586" + OpName %v587 "v587" + OpName %v588 "v588" + OpName %v589 "v589" + OpName %v590 "v590" + OpName %v591 "v591" + OpName %v592 "v592" + OpName %v593 "v593" + OpName %v594 "v594" + OpName %v595 "v595" + OpName %v596 "v596" + OpName %v597 "v597" + OpName %v598 "v598" + OpName %v599 "v599" + OpName %v600 "v600" + OpName %v601 "v601" + OpName %v602 "v602" + OpName %v603 "v603" + OpName %v604 "v604" + OpName %v605 "v605" + OpName %v606 "v606" + OpName %v607 "v607" + OpName %v608 "v608" + OpName %v609 "v609" + OpName %v610 "v610" + OpName %v611 "v611" + OpName %v612 "v612" + OpName %v613 "v613" + OpName %v614 "v614" + OpName %v615 "v615" + OpName %v616 "v616" + OpName %v617 "v617" + OpName %v618 "v618" + OpName %v619 "v619" + OpName %v620 "v620" + OpName %v621 "v621" + OpName %v622 "v622" + OpName %v623 "v623" + OpName %v624 "v624" + OpName %v625 "v625" + OpName %v626 "v626" + OpName %v627 "v627" + OpName %v628 "v628" + OpName %v629 "v629" + OpName %v630 "v630" + OpName %v631 "v631" + OpName %v632 "v632" + OpName %v633 "v633" + OpName %v634 "v634" + OpName %v635 "v635" + OpName %v636 "v636" + OpName %v637 "v637" + OpName %v638 "v638" + OpName %v639 "v639" + OpName %v640 "v640" + OpName %v641 "v641" + OpName %v642 "v642" + OpName %v643 "v643" + OpName %v644 "v644" + OpName %v645 "v645" + OpName %v646 "v646" + OpName %v647 "v647" + OpName %v648 "v648" + OpName %v649 "v649" + OpName %v650 "v650" + OpName %v651 "v651" + OpName %v652 "v652" + OpName %v653 "v653" + OpName %v654 "v654" + OpName %v655 "v655" + OpName %v656 "v656" + OpName %v657 "v657" + OpName %v658 "v658" + OpName %v659 "v659" + OpName %v660 "v660" + OpName %v661 "v661" + OpName %v662 "v662" + OpName %v663 "v663" + OpName %v664 "v664" + OpName %v665 "v665" + OpName %v666 "v666" + OpName %v667 "v667" + OpName %v668 "v668" + OpName %v669 "v669" + OpName %v670 "v670" + OpName %v671 "v671" + OpName %v672 "v672" + OpName %v673 "v673" + OpName %v674 "v674" + OpName %v675 "v675" + OpName %v676 "v676" + OpName %v677 "v677" + OpName %v678 "v678" + OpName %v679 "v679" + OpName %v680 "v680" + OpName %v681 "v681" + OpName %v682 "v682" + OpName %v683 "v683" + OpName %v684 "v684" + OpName %v685 "v685" + OpName %v686 "v686" + OpName %v687 "v687" + OpName %v688 "v688" + OpName %v689 "v689" + OpName %v690 "v690" + OpName %v691 "v691" + OpName %v692 "v692" + OpName %v693 "v693" + OpName %v694 "v694" + OpName %v695 "v695" + OpName %v696 "v696" + OpName %v697 "v697" + OpName %v698 "v698" + OpName %v699 "v699" + OpName %v700 "v700" + OpName %v701 "v701" + OpName %v702 "v702" + OpName %v703 "v703" + OpName %v704 "v704" + OpName %v705 "v705" + OpName %v706 "v706" + OpName %v707 "v707" + OpName %v708 "v708" + OpName %v709 "v709" + OpName %v710 "v710" + OpName %v711 "v711" + OpName %v712 "v712" + OpName %v713 "v713" + OpName %v714 "v714" + OpName %v715 "v715" + OpName %v716 "v716" + OpName %v717 "v717" + OpName %v718 "v718" + OpName %v719 "v719" + OpName %v720 "v720" + OpName %v721 "v721" + OpName %v722 "v722" + OpName %v723 "v723" + OpName %v724 "v724" + OpName %v725 "v725" + OpName %v726 "v726" + OpName %v727 "v727" + OpName %v728 "v728" + OpName %v729 "v729" + OpName %v730 "v730" + OpName %v731 "v731" + OpName %v732 "v732" + OpName %v733 "v733" + OpName %v734 "v734" + OpName %v735 "v735" + OpName %v736 "v736" + OpName %v737 "v737" + OpName %v738 "v738" + OpName %v739 "v739" + OpName %v740 "v740" + OpName %v741 "v741" + OpName %v742 "v742" + OpName %v743 "v743" + OpName %v744 "v744" + OpName %v745 "v745" + OpName %v746 "v746" + OpName %v747 "v747" + OpName %v748 "v748" + OpName %v749 "v749" + OpName %v750 "v750" + OpName %v751 "v751" + OpName %v752 "v752" + OpName %v753 "v753" + OpName %v754 "v754" + OpName %v755 "v755" + OpName %v756 "v756" + OpName %v757 "v757" + OpName %v758 "v758" + OpName %v759 "v759" + OpName %v760 "v760" + OpName %v761 "v761" + OpName %v762 "v762" + OpName %v763 "v763" + OpName %v764 "v764" + OpName %v765 "v765" + OpName %v766 "v766" + OpName %v767 "v767" + OpName %v768 "v768" + OpName %v769 "v769" + OpName %v770 "v770" + OpName %v771 "v771" + OpName %v772 "v772" + OpName %v773 "v773" + OpName %v774 "v774" + OpName %v775 "v775" + OpName %v776 "v776" + OpName %v777 "v777" + OpName %v778 "v778" + OpName %v779 "v779" + OpName %v780 "v780" + OpName %v781 "v781" + OpName %v782 "v782" + OpName %v783 "v783" + OpName %v784 "v784" + OpName %v785 "v785" + OpName %v786 "v786" + OpName %v787 "v787" + OpName %v788 "v788" + OpName %v789 "v789" + OpName %v790 "v790" + OpName %v791 "v791" + OpName %v792 "v792" + OpName %v793 "v793" + OpName %v794 "v794" + OpName %v795 "v795" + OpName %v796 "v796" + OpName %v797 "v797" + OpName %v798 "v798" + OpName %v799 "v799" + OpName %v800 "v800" + OpName %v801 "v801" + OpName %v802 "v802" + OpName %v803 "v803" + OpName %v804 "v804" + OpName %v805 "v805" + OpName %v806 "v806" + OpName %v807 "v807" + OpName %v808 "v808" + OpName %v809 "v809" + OpName %v810 "v810" + OpName %v811 "v811" + OpName %v812 "v812" + OpName %v813 "v813" + OpName %v814 "v814" + OpName %v815 "v815" + OpName %v816 "v816" + OpName %v817 "v817" + OpName %v818 "v818" + OpName %v819 "v819" + OpName %v820 "v820" + OpName %v821 "v821" + OpName %v822 "v822" + OpName %v823 "v823" + OpName %v824 "v824" + OpName %v825 "v825" + OpName %v826 "v826" + OpName %v827 "v827" + OpName %v828 "v828" + OpName %v829 "v829" + OpName %v830 "v830" + OpName %v831 "v831" + OpName %v832 "v832" + OpName %v833 "v833" + OpName %v834 "v834" + OpName %v835 "v835" + OpName %v836 "v836" + OpName %v837 "v837" + OpName %v838 "v838" + OpName %v839 "v839" + OpName %v840 "v840" + OpName %v841 "v841" + OpName %v842 "v842" + OpName %v843 "v843" + OpName %v844 "v844" + OpName %v845 "v845" + OpName %v846 "v846" + OpName %v847 "v847" + OpName %v848 "v848" + OpName %v849 "v849" + OpName %v850 "v850" + OpName %v851 "v851" + OpName %v852 "v852" + OpName %v853 "v853" + OpName %v854 "v854" + OpName %v855 "v855" + OpName %v856 "v856" + OpName %v857 "v857" + OpName %v858 "v858" + OpName %v859 "v859" + OpName %v860 "v860" + OpName %v861 "v861" + OpName %v862 "v862" + OpName %v863 "v863" + OpName %v864 "v864" + OpName %v865 "v865" + OpName %v866 "v866" + OpName %v867 "v867" + OpName %v868 "v868" + OpName %v869 "v869" + OpName %v870 "v870" + OpName %v871 "v871" + OpName %v872 "v872" + OpName %v873 "v873" + OpName %v874 "v874" + OpName %v875 "v875" + OpName %v876 "v876" + OpName %v877 "v877" + OpName %v878 "v878" + OpName %v879 "v879" + OpName %v880 "v880" + OpName %v881 "v881" + OpName %v882 "v882" + OpName %v883 "v883" + OpName %v884 "v884" + OpName %v885 "v885" + OpName %v886 "v886" + OpName %v887 "v887" + OpName %v888 "v888" + OpName %v889 "v889" + OpName %v890 "v890" + OpName %v891 "v891" + OpName %v892 "v892" + OpName %v893 "v893" + OpName %v894 "v894" + OpName %v895 "v895" + OpName %v896 "v896" + OpName %v897 "v897" + OpName %v898 "v898" + OpName %v899 "v899" + OpName %v900 "v900" + OpName %v901 "v901" + OpName %v902 "v902" + OpName %v903 "v903" + OpName %v904 "v904" + OpName %v905 "v905" + OpName %v906 "v906" + OpName %v907 "v907" + OpName %v908 "v908" + OpName %v909 "v909" + OpName %v910 "v910" + OpName %v911 "v911" + OpName %v912 "v912" + OpName %v913 "v913" + OpName %v914 "v914" + OpName %v915 "v915" + OpName %v916 "v916" + OpName %v917 "v917" + OpName %v918 "v918" + OpName %v919 "v919" + OpName %v920 "v920" + OpName %v921 "v921" + OpName %v922 "v922" + OpName %v923 "v923" + OpName %v924 "v924" + OpName %v925 "v925" + OpName %v926 "v926" + OpName %v927 "v927" + OpName %v928 "v928" + OpName %v929 "v929" + OpName %v930 "v930" + OpName %v931 "v931" + OpName %v932 "v932" + OpName %v933 "v933" + OpName %v934 "v934" + OpName %v935 "v935" + OpName %v936 "v936" + OpName %v937 "v937" + OpName %v938 "v938" + OpName %v939 "v939" + OpName %v940 "v940" + OpName %v941 "v941" + OpName %v942 "v942" + OpName %v943 "v943" + OpName %v944 "v944" + OpName %v945 "v945" + OpName %v946 "v946" + OpName %v947 "v947" + OpName %v948 "v948" + OpName %v949 "v949" + OpName %v950 "v950" + OpName %v951 "v951" + OpName %v952 "v952" + OpName %v953 "v953" + OpName %v954 "v954" + OpName %v955 "v955" + OpName %v956 "v956" + OpName %v957 "v957" + OpName %v958 "v958" + OpName %v959 "v959" + OpName %v960 "v960" + OpName %v961 "v961" + OpName %v962 "v962" + OpName %v963 "v963" + OpName %v964 "v964" + OpName %v965 "v965" + OpName %v966 "v966" + OpName %v967 "v967" + OpName %v968 "v968" + OpName %v969 "v969" + OpName %v970 "v970" + OpName %v971 "v971" + OpName %v972 "v972" + OpName %v973 "v973" + OpName %v974 "v974" + OpName %v975 "v975" + OpName %v976 "v976" + OpName %v977 "v977" + OpName %v978 "v978" + OpName %v979 "v979" + OpName %v980 "v980" + OpName %v981 "v981" + OpName %v982 "v982" + OpName %v983 "v983" + OpName %v984 "v984" + OpName %v985 "v985" + OpName %v986 "v986" + OpName %v987 "v987" + OpName %v988 "v988" + OpName %v989 "v989" + OpName %v990 "v990" + OpName %v991 "v991" + OpName %v992 "v992" + OpName %v993 "v993" + OpName %v994 "v994" + OpName %v995 "v995" + OpName %v996 "v996" + OpName %v997 "v997" + OpName %v998 "v998" + OpName %v999 "v999" + OpName %foo "foo" + OpName %x "x" + OpName %main_inner "main_inner" + OpName %main "main" + OpDecorate %value Location 0 + %uint = OpTypeInt 32 0 +%_ptr_Output_uint = OpTypePointer Output %uint + %4 = OpConstantNull %uint + %value = OpVariable %_ptr_Output_uint Output %4 +%_ptr_Private_uint = OpTypePointer Private %uint + %v0 = OpVariable %_ptr_Private_uint Private %4 + %v1 = OpVariable %_ptr_Private_uint Private %4 + %v2 = OpVariable %_ptr_Private_uint Private %4 + %v3 = OpVariable %_ptr_Private_uint Private %4 + %v4 = OpVariable %_ptr_Private_uint Private %4 + %v5 = OpVariable %_ptr_Private_uint Private %4 + %v6 = OpVariable %_ptr_Private_uint Private %4 + %v7 = OpVariable %_ptr_Private_uint Private %4 + %v8 = OpVariable %_ptr_Private_uint Private %4 + %v9 = OpVariable %_ptr_Private_uint Private %4 + %v10 = OpVariable %_ptr_Private_uint Private %4 + %v11 = OpVariable %_ptr_Private_uint Private %4 + %v12 = OpVariable %_ptr_Private_uint Private %4 + %v13 = OpVariable %_ptr_Private_uint Private %4 + %v14 = OpVariable %_ptr_Private_uint Private %4 + %v15 = OpVariable %_ptr_Private_uint Private %4 + %v16 = OpVariable %_ptr_Private_uint Private %4 + %v17 = OpVariable %_ptr_Private_uint Private %4 + %v18 = OpVariable %_ptr_Private_uint Private %4 + %v19 = OpVariable %_ptr_Private_uint Private %4 + %v20 = OpVariable %_ptr_Private_uint Private %4 + %v21 = OpVariable %_ptr_Private_uint Private %4 + %v22 = OpVariable %_ptr_Private_uint Private %4 + %v23 = OpVariable %_ptr_Private_uint Private %4 + %v24 = OpVariable %_ptr_Private_uint Private %4 + %v25 = OpVariable %_ptr_Private_uint Private %4 + %v26 = OpVariable %_ptr_Private_uint Private %4 + %v27 = OpVariable %_ptr_Private_uint Private %4 + %v28 = OpVariable %_ptr_Private_uint Private %4 + %v29 = OpVariable %_ptr_Private_uint Private %4 + %v30 = OpVariable %_ptr_Private_uint Private %4 + %v31 = OpVariable %_ptr_Private_uint Private %4 + %v32 = OpVariable %_ptr_Private_uint Private %4 + %v33 = OpVariable %_ptr_Private_uint Private %4 + %v34 = OpVariable %_ptr_Private_uint Private %4 + %v35 = OpVariable %_ptr_Private_uint Private %4 + %v36 = OpVariable %_ptr_Private_uint Private %4 + %v37 = OpVariable %_ptr_Private_uint Private %4 + %v38 = OpVariable %_ptr_Private_uint Private %4 + %v39 = OpVariable %_ptr_Private_uint Private %4 + %v40 = OpVariable %_ptr_Private_uint Private %4 + %v41 = OpVariable %_ptr_Private_uint Private %4 + %v42 = OpVariable %_ptr_Private_uint Private %4 + %v43 = OpVariable %_ptr_Private_uint Private %4 + %v44 = OpVariable %_ptr_Private_uint Private %4 + %v45 = OpVariable %_ptr_Private_uint Private %4 + %v46 = OpVariable %_ptr_Private_uint Private %4 + %v47 = OpVariable %_ptr_Private_uint Private %4 + %v48 = OpVariable %_ptr_Private_uint Private %4 + %v49 = OpVariable %_ptr_Private_uint Private %4 + %v50 = OpVariable %_ptr_Private_uint Private %4 + %v51 = OpVariable %_ptr_Private_uint Private %4 + %v52 = OpVariable %_ptr_Private_uint Private %4 + %v53 = OpVariable %_ptr_Private_uint Private %4 + %v54 = OpVariable %_ptr_Private_uint Private %4 + %v55 = OpVariable %_ptr_Private_uint Private %4 + %v56 = OpVariable %_ptr_Private_uint Private %4 + %v57 = OpVariable %_ptr_Private_uint Private %4 + %v58 = OpVariable %_ptr_Private_uint Private %4 + %v59 = OpVariable %_ptr_Private_uint Private %4 + %v60 = OpVariable %_ptr_Private_uint Private %4 + %v61 = OpVariable %_ptr_Private_uint Private %4 + %v62 = OpVariable %_ptr_Private_uint Private %4 + %v63 = OpVariable %_ptr_Private_uint Private %4 + %v64 = OpVariable %_ptr_Private_uint Private %4 + %v65 = OpVariable %_ptr_Private_uint Private %4 + %v66 = OpVariable %_ptr_Private_uint Private %4 + %v67 = OpVariable %_ptr_Private_uint Private %4 + %v68 = OpVariable %_ptr_Private_uint Private %4 + %v69 = OpVariable %_ptr_Private_uint Private %4 + %v70 = OpVariable %_ptr_Private_uint Private %4 + %v71 = OpVariable %_ptr_Private_uint Private %4 + %v72 = OpVariable %_ptr_Private_uint Private %4 + %v73 = OpVariable %_ptr_Private_uint Private %4 + %v74 = OpVariable %_ptr_Private_uint Private %4 + %v75 = OpVariable %_ptr_Private_uint Private %4 + %v76 = OpVariable %_ptr_Private_uint Private %4 + %v77 = OpVariable %_ptr_Private_uint Private %4 + %v78 = OpVariable %_ptr_Private_uint Private %4 + %v79 = OpVariable %_ptr_Private_uint Private %4 + %v80 = OpVariable %_ptr_Private_uint Private %4 + %v81 = OpVariable %_ptr_Private_uint Private %4 + %v82 = OpVariable %_ptr_Private_uint Private %4 + %v83 = OpVariable %_ptr_Private_uint Private %4 + %v84 = OpVariable %_ptr_Private_uint Private %4 + %v85 = OpVariable %_ptr_Private_uint Private %4 + %v86 = OpVariable %_ptr_Private_uint Private %4 + %v87 = OpVariable %_ptr_Private_uint Private %4 + %v88 = OpVariable %_ptr_Private_uint Private %4 + %v89 = OpVariable %_ptr_Private_uint Private %4 + %v90 = OpVariable %_ptr_Private_uint Private %4 + %v91 = OpVariable %_ptr_Private_uint Private %4 + %v92 = OpVariable %_ptr_Private_uint Private %4 + %v93 = OpVariable %_ptr_Private_uint Private %4 + %v94 = OpVariable %_ptr_Private_uint Private %4 + %v95 = OpVariable %_ptr_Private_uint Private %4 + %v96 = OpVariable %_ptr_Private_uint Private %4 + %v97 = OpVariable %_ptr_Private_uint Private %4 + %v98 = OpVariable %_ptr_Private_uint Private %4 + %v99 = OpVariable %_ptr_Private_uint Private %4 + %v100 = OpVariable %_ptr_Private_uint Private %4 + %v101 = OpVariable %_ptr_Private_uint Private %4 + %v102 = OpVariable %_ptr_Private_uint Private %4 + %v103 = OpVariable %_ptr_Private_uint Private %4 + %v104 = OpVariable %_ptr_Private_uint Private %4 + %v105 = OpVariable %_ptr_Private_uint Private %4 + %v106 = OpVariable %_ptr_Private_uint Private %4 + %v107 = OpVariable %_ptr_Private_uint Private %4 + %v108 = OpVariable %_ptr_Private_uint Private %4 + %v109 = OpVariable %_ptr_Private_uint Private %4 + %v110 = OpVariable %_ptr_Private_uint Private %4 + %v111 = OpVariable %_ptr_Private_uint Private %4 + %v112 = OpVariable %_ptr_Private_uint Private %4 + %v113 = OpVariable %_ptr_Private_uint Private %4 + %v114 = OpVariable %_ptr_Private_uint Private %4 + %v115 = OpVariable %_ptr_Private_uint Private %4 + %v116 = OpVariable %_ptr_Private_uint Private %4 + %v117 = OpVariable %_ptr_Private_uint Private %4 + %v118 = OpVariable %_ptr_Private_uint Private %4 + %v119 = OpVariable %_ptr_Private_uint Private %4 + %v120 = OpVariable %_ptr_Private_uint Private %4 + %v121 = OpVariable %_ptr_Private_uint Private %4 + %v122 = OpVariable %_ptr_Private_uint Private %4 + %v123 = OpVariable %_ptr_Private_uint Private %4 + %v124 = OpVariable %_ptr_Private_uint Private %4 + %v125 = OpVariable %_ptr_Private_uint Private %4 + %v126 = OpVariable %_ptr_Private_uint Private %4 + %v127 = OpVariable %_ptr_Private_uint Private %4 + %v128 = OpVariable %_ptr_Private_uint Private %4 + %v129 = OpVariable %_ptr_Private_uint Private %4 + %v130 = OpVariable %_ptr_Private_uint Private %4 + %v131 = OpVariable %_ptr_Private_uint Private %4 + %v132 = OpVariable %_ptr_Private_uint Private %4 + %v133 = OpVariable %_ptr_Private_uint Private %4 + %v134 = OpVariable %_ptr_Private_uint Private %4 + %v135 = OpVariable %_ptr_Private_uint Private %4 + %v136 = OpVariable %_ptr_Private_uint Private %4 + %v137 = OpVariable %_ptr_Private_uint Private %4 + %v138 = OpVariable %_ptr_Private_uint Private %4 + %v139 = OpVariable %_ptr_Private_uint Private %4 + %v140 = OpVariable %_ptr_Private_uint Private %4 + %v141 = OpVariable %_ptr_Private_uint Private %4 + %v142 = OpVariable %_ptr_Private_uint Private %4 + %v143 = OpVariable %_ptr_Private_uint Private %4 + %v144 = OpVariable %_ptr_Private_uint Private %4 + %v145 = OpVariable %_ptr_Private_uint Private %4 + %v146 = OpVariable %_ptr_Private_uint Private %4 + %v147 = OpVariable %_ptr_Private_uint Private %4 + %v148 = OpVariable %_ptr_Private_uint Private %4 + %v149 = OpVariable %_ptr_Private_uint Private %4 + %v150 = OpVariable %_ptr_Private_uint Private %4 + %v151 = OpVariable %_ptr_Private_uint Private %4 + %v152 = OpVariable %_ptr_Private_uint Private %4 + %v153 = OpVariable %_ptr_Private_uint Private %4 + %v154 = OpVariable %_ptr_Private_uint Private %4 + %v155 = OpVariable %_ptr_Private_uint Private %4 + %v156 = OpVariable %_ptr_Private_uint Private %4 + %v157 = OpVariable %_ptr_Private_uint Private %4 + %v158 = OpVariable %_ptr_Private_uint Private %4 + %v159 = OpVariable %_ptr_Private_uint Private %4 + %v160 = OpVariable %_ptr_Private_uint Private %4 + %v161 = OpVariable %_ptr_Private_uint Private %4 + %v162 = OpVariable %_ptr_Private_uint Private %4 + %v163 = OpVariable %_ptr_Private_uint Private %4 + %v164 = OpVariable %_ptr_Private_uint Private %4 + %v165 = OpVariable %_ptr_Private_uint Private %4 + %v166 = OpVariable %_ptr_Private_uint Private %4 + %v167 = OpVariable %_ptr_Private_uint Private %4 + %v168 = OpVariable %_ptr_Private_uint Private %4 + %v169 = OpVariable %_ptr_Private_uint Private %4 + %v170 = OpVariable %_ptr_Private_uint Private %4 + %v171 = OpVariable %_ptr_Private_uint Private %4 + %v172 = OpVariable %_ptr_Private_uint Private %4 + %v173 = OpVariable %_ptr_Private_uint Private %4 + %v174 = OpVariable %_ptr_Private_uint Private %4 + %v175 = OpVariable %_ptr_Private_uint Private %4 + %v176 = OpVariable %_ptr_Private_uint Private %4 + %v177 = OpVariable %_ptr_Private_uint Private %4 + %v178 = OpVariable %_ptr_Private_uint Private %4 + %v179 = OpVariable %_ptr_Private_uint Private %4 + %v180 = OpVariable %_ptr_Private_uint Private %4 + %v181 = OpVariable %_ptr_Private_uint Private %4 + %v182 = OpVariable %_ptr_Private_uint Private %4 + %v183 = OpVariable %_ptr_Private_uint Private %4 + %v184 = OpVariable %_ptr_Private_uint Private %4 + %v185 = OpVariable %_ptr_Private_uint Private %4 + %v186 = OpVariable %_ptr_Private_uint Private %4 + %v187 = OpVariable %_ptr_Private_uint Private %4 + %v188 = OpVariable %_ptr_Private_uint Private %4 + %v189 = OpVariable %_ptr_Private_uint Private %4 + %v190 = OpVariable %_ptr_Private_uint Private %4 + %v191 = OpVariable %_ptr_Private_uint Private %4 + %v192 = OpVariable %_ptr_Private_uint Private %4 + %v193 = OpVariable %_ptr_Private_uint Private %4 + %v194 = OpVariable %_ptr_Private_uint Private %4 + %v195 = OpVariable %_ptr_Private_uint Private %4 + %v196 = OpVariable %_ptr_Private_uint Private %4 + %v197 = OpVariable %_ptr_Private_uint Private %4 + %v198 = OpVariable %_ptr_Private_uint Private %4 + %v199 = OpVariable %_ptr_Private_uint Private %4 + %v200 = OpVariable %_ptr_Private_uint Private %4 + %v201 = OpVariable %_ptr_Private_uint Private %4 + %v202 = OpVariable %_ptr_Private_uint Private %4 + %v203 = OpVariable %_ptr_Private_uint Private %4 + %v204 = OpVariable %_ptr_Private_uint Private %4 + %v205 = OpVariable %_ptr_Private_uint Private %4 + %v206 = OpVariable %_ptr_Private_uint Private %4 + %v207 = OpVariable %_ptr_Private_uint Private %4 + %v208 = OpVariable %_ptr_Private_uint Private %4 + %v209 = OpVariable %_ptr_Private_uint Private %4 + %v210 = OpVariable %_ptr_Private_uint Private %4 + %v211 = OpVariable %_ptr_Private_uint Private %4 + %v212 = OpVariable %_ptr_Private_uint Private %4 + %v213 = OpVariable %_ptr_Private_uint Private %4 + %v214 = OpVariable %_ptr_Private_uint Private %4 + %v215 = OpVariable %_ptr_Private_uint Private %4 + %v216 = OpVariable %_ptr_Private_uint Private %4 + %v217 = OpVariable %_ptr_Private_uint Private %4 + %v218 = OpVariable %_ptr_Private_uint Private %4 + %v219 = OpVariable %_ptr_Private_uint Private %4 + %v220 = OpVariable %_ptr_Private_uint Private %4 + %v221 = OpVariable %_ptr_Private_uint Private %4 + %v222 = OpVariable %_ptr_Private_uint Private %4 + %v223 = OpVariable %_ptr_Private_uint Private %4 + %v224 = OpVariable %_ptr_Private_uint Private %4 + %v225 = OpVariable %_ptr_Private_uint Private %4 + %v226 = OpVariable %_ptr_Private_uint Private %4 + %v227 = OpVariable %_ptr_Private_uint Private %4 + %v228 = OpVariable %_ptr_Private_uint Private %4 + %v229 = OpVariable %_ptr_Private_uint Private %4 + %v230 = OpVariable %_ptr_Private_uint Private %4 + %v231 = OpVariable %_ptr_Private_uint Private %4 + %v232 = OpVariable %_ptr_Private_uint Private %4 + %v233 = OpVariable %_ptr_Private_uint Private %4 + %v234 = OpVariable %_ptr_Private_uint Private %4 + %v235 = OpVariable %_ptr_Private_uint Private %4 + %v236 = OpVariable %_ptr_Private_uint Private %4 + %v237 = OpVariable %_ptr_Private_uint Private %4 + %v238 = OpVariable %_ptr_Private_uint Private %4 + %v239 = OpVariable %_ptr_Private_uint Private %4 + %v240 = OpVariable %_ptr_Private_uint Private %4 + %v241 = OpVariable %_ptr_Private_uint Private %4 + %v242 = OpVariable %_ptr_Private_uint Private %4 + %v243 = OpVariable %_ptr_Private_uint Private %4 + %v244 = OpVariable %_ptr_Private_uint Private %4 + %v245 = OpVariable %_ptr_Private_uint Private %4 + %v246 = OpVariable %_ptr_Private_uint Private %4 + %v247 = OpVariable %_ptr_Private_uint Private %4 + %v248 = OpVariable %_ptr_Private_uint Private %4 + %v249 = OpVariable %_ptr_Private_uint Private %4 + %v250 = OpVariable %_ptr_Private_uint Private %4 + %v251 = OpVariable %_ptr_Private_uint Private %4 + %v252 = OpVariable %_ptr_Private_uint Private %4 + %v253 = OpVariable %_ptr_Private_uint Private %4 + %v254 = OpVariable %_ptr_Private_uint Private %4 + %v255 = OpVariable %_ptr_Private_uint Private %4 + %v256 = OpVariable %_ptr_Private_uint Private %4 + %v257 = OpVariable %_ptr_Private_uint Private %4 + %v258 = OpVariable %_ptr_Private_uint Private %4 + %v259 = OpVariable %_ptr_Private_uint Private %4 + %v260 = OpVariable %_ptr_Private_uint Private %4 + %v261 = OpVariable %_ptr_Private_uint Private %4 + %v262 = OpVariable %_ptr_Private_uint Private %4 + %v263 = OpVariable %_ptr_Private_uint Private %4 + %v264 = OpVariable %_ptr_Private_uint Private %4 + %v265 = OpVariable %_ptr_Private_uint Private %4 + %v266 = OpVariable %_ptr_Private_uint Private %4 + %v267 = OpVariable %_ptr_Private_uint Private %4 + %v268 = OpVariable %_ptr_Private_uint Private %4 + %v269 = OpVariable %_ptr_Private_uint Private %4 + %v270 = OpVariable %_ptr_Private_uint Private %4 + %v271 = OpVariable %_ptr_Private_uint Private %4 + %v272 = OpVariable %_ptr_Private_uint Private %4 + %v273 = OpVariable %_ptr_Private_uint Private %4 + %v274 = OpVariable %_ptr_Private_uint Private %4 + %v275 = OpVariable %_ptr_Private_uint Private %4 + %v276 = OpVariable %_ptr_Private_uint Private %4 + %v277 = OpVariable %_ptr_Private_uint Private %4 + %v278 = OpVariable %_ptr_Private_uint Private %4 + %v279 = OpVariable %_ptr_Private_uint Private %4 + %v280 = OpVariable %_ptr_Private_uint Private %4 + %v281 = OpVariable %_ptr_Private_uint Private %4 + %v282 = OpVariable %_ptr_Private_uint Private %4 + %v283 = OpVariable %_ptr_Private_uint Private %4 + %v284 = OpVariable %_ptr_Private_uint Private %4 + %v285 = OpVariable %_ptr_Private_uint Private %4 + %v286 = OpVariable %_ptr_Private_uint Private %4 + %v287 = OpVariable %_ptr_Private_uint Private %4 + %v288 = OpVariable %_ptr_Private_uint Private %4 + %v289 = OpVariable %_ptr_Private_uint Private %4 + %v290 = OpVariable %_ptr_Private_uint Private %4 + %v291 = OpVariable %_ptr_Private_uint Private %4 + %v292 = OpVariable %_ptr_Private_uint Private %4 + %v293 = OpVariable %_ptr_Private_uint Private %4 + %v294 = OpVariable %_ptr_Private_uint Private %4 + %v295 = OpVariable %_ptr_Private_uint Private %4 + %v296 = OpVariable %_ptr_Private_uint Private %4 + %v297 = OpVariable %_ptr_Private_uint Private %4 + %v298 = OpVariable %_ptr_Private_uint Private %4 + %v299 = OpVariable %_ptr_Private_uint Private %4 + %v300 = OpVariable %_ptr_Private_uint Private %4 + %v301 = OpVariable %_ptr_Private_uint Private %4 + %v302 = OpVariable %_ptr_Private_uint Private %4 + %v303 = OpVariable %_ptr_Private_uint Private %4 + %v304 = OpVariable %_ptr_Private_uint Private %4 + %v305 = OpVariable %_ptr_Private_uint Private %4 + %v306 = OpVariable %_ptr_Private_uint Private %4 + %v307 = OpVariable %_ptr_Private_uint Private %4 + %v308 = OpVariable %_ptr_Private_uint Private %4 + %v309 = OpVariable %_ptr_Private_uint Private %4 + %v310 = OpVariable %_ptr_Private_uint Private %4 + %v311 = OpVariable %_ptr_Private_uint Private %4 + %v312 = OpVariable %_ptr_Private_uint Private %4 + %v313 = OpVariable %_ptr_Private_uint Private %4 + %v314 = OpVariable %_ptr_Private_uint Private %4 + %v315 = OpVariable %_ptr_Private_uint Private %4 + %v316 = OpVariable %_ptr_Private_uint Private %4 + %v317 = OpVariable %_ptr_Private_uint Private %4 + %v318 = OpVariable %_ptr_Private_uint Private %4 + %v319 = OpVariable %_ptr_Private_uint Private %4 + %v320 = OpVariable %_ptr_Private_uint Private %4 + %v321 = OpVariable %_ptr_Private_uint Private %4 + %v322 = OpVariable %_ptr_Private_uint Private %4 + %v323 = OpVariable %_ptr_Private_uint Private %4 + %v324 = OpVariable %_ptr_Private_uint Private %4 + %v325 = OpVariable %_ptr_Private_uint Private %4 + %v326 = OpVariable %_ptr_Private_uint Private %4 + %v327 = OpVariable %_ptr_Private_uint Private %4 + %v328 = OpVariable %_ptr_Private_uint Private %4 + %v329 = OpVariable %_ptr_Private_uint Private %4 + %v330 = OpVariable %_ptr_Private_uint Private %4 + %v331 = OpVariable %_ptr_Private_uint Private %4 + %v332 = OpVariable %_ptr_Private_uint Private %4 + %v333 = OpVariable %_ptr_Private_uint Private %4 + %v334 = OpVariable %_ptr_Private_uint Private %4 + %v335 = OpVariable %_ptr_Private_uint Private %4 + %v336 = OpVariable %_ptr_Private_uint Private %4 + %v337 = OpVariable %_ptr_Private_uint Private %4 + %v338 = OpVariable %_ptr_Private_uint Private %4 + %v339 = OpVariable %_ptr_Private_uint Private %4 + %v340 = OpVariable %_ptr_Private_uint Private %4 + %v341 = OpVariable %_ptr_Private_uint Private %4 + %v342 = OpVariable %_ptr_Private_uint Private %4 + %v343 = OpVariable %_ptr_Private_uint Private %4 + %v344 = OpVariable %_ptr_Private_uint Private %4 + %v345 = OpVariable %_ptr_Private_uint Private %4 + %v346 = OpVariable %_ptr_Private_uint Private %4 + %v347 = OpVariable %_ptr_Private_uint Private %4 + %v348 = OpVariable %_ptr_Private_uint Private %4 + %v349 = OpVariable %_ptr_Private_uint Private %4 + %v350 = OpVariable %_ptr_Private_uint Private %4 + %v351 = OpVariable %_ptr_Private_uint Private %4 + %v352 = OpVariable %_ptr_Private_uint Private %4 + %v353 = OpVariable %_ptr_Private_uint Private %4 + %v354 = OpVariable %_ptr_Private_uint Private %4 + %v355 = OpVariable %_ptr_Private_uint Private %4 + %v356 = OpVariable %_ptr_Private_uint Private %4 + %v357 = OpVariable %_ptr_Private_uint Private %4 + %v358 = OpVariable %_ptr_Private_uint Private %4 + %v359 = OpVariable %_ptr_Private_uint Private %4 + %v360 = OpVariable %_ptr_Private_uint Private %4 + %v361 = OpVariable %_ptr_Private_uint Private %4 + %v362 = OpVariable %_ptr_Private_uint Private %4 + %v363 = OpVariable %_ptr_Private_uint Private %4 + %v364 = OpVariable %_ptr_Private_uint Private %4 + %v365 = OpVariable %_ptr_Private_uint Private %4 + %v366 = OpVariable %_ptr_Private_uint Private %4 + %v367 = OpVariable %_ptr_Private_uint Private %4 + %v368 = OpVariable %_ptr_Private_uint Private %4 + %v369 = OpVariable %_ptr_Private_uint Private %4 + %v370 = OpVariable %_ptr_Private_uint Private %4 + %v371 = OpVariable %_ptr_Private_uint Private %4 + %v372 = OpVariable %_ptr_Private_uint Private %4 + %v373 = OpVariable %_ptr_Private_uint Private %4 + %v374 = OpVariable %_ptr_Private_uint Private %4 + %v375 = OpVariable %_ptr_Private_uint Private %4 + %v376 = OpVariable %_ptr_Private_uint Private %4 + %v377 = OpVariable %_ptr_Private_uint Private %4 + %v378 = OpVariable %_ptr_Private_uint Private %4 + %v379 = OpVariable %_ptr_Private_uint Private %4 + %v380 = OpVariable %_ptr_Private_uint Private %4 + %v381 = OpVariable %_ptr_Private_uint Private %4 + %v382 = OpVariable %_ptr_Private_uint Private %4 + %v383 = OpVariable %_ptr_Private_uint Private %4 + %v384 = OpVariable %_ptr_Private_uint Private %4 + %v385 = OpVariable %_ptr_Private_uint Private %4 + %v386 = OpVariable %_ptr_Private_uint Private %4 + %v387 = OpVariable %_ptr_Private_uint Private %4 + %v388 = OpVariable %_ptr_Private_uint Private %4 + %v389 = OpVariable %_ptr_Private_uint Private %4 + %v390 = OpVariable %_ptr_Private_uint Private %4 + %v391 = OpVariable %_ptr_Private_uint Private %4 + %v392 = OpVariable %_ptr_Private_uint Private %4 + %v393 = OpVariable %_ptr_Private_uint Private %4 + %v394 = OpVariable %_ptr_Private_uint Private %4 + %v395 = OpVariable %_ptr_Private_uint Private %4 + %v396 = OpVariable %_ptr_Private_uint Private %4 + %v397 = OpVariable %_ptr_Private_uint Private %4 + %v398 = OpVariable %_ptr_Private_uint Private %4 + %v399 = OpVariable %_ptr_Private_uint Private %4 + %v400 = OpVariable %_ptr_Private_uint Private %4 + %v401 = OpVariable %_ptr_Private_uint Private %4 + %v402 = OpVariable %_ptr_Private_uint Private %4 + %v403 = OpVariable %_ptr_Private_uint Private %4 + %v404 = OpVariable %_ptr_Private_uint Private %4 + %v405 = OpVariable %_ptr_Private_uint Private %4 + %v406 = OpVariable %_ptr_Private_uint Private %4 + %v407 = OpVariable %_ptr_Private_uint Private %4 + %v408 = OpVariable %_ptr_Private_uint Private %4 + %v409 = OpVariable %_ptr_Private_uint Private %4 + %v410 = OpVariable %_ptr_Private_uint Private %4 + %v411 = OpVariable %_ptr_Private_uint Private %4 + %v412 = OpVariable %_ptr_Private_uint Private %4 + %v413 = OpVariable %_ptr_Private_uint Private %4 + %v414 = OpVariable %_ptr_Private_uint Private %4 + %v415 = OpVariable %_ptr_Private_uint Private %4 + %v416 = OpVariable %_ptr_Private_uint Private %4 + %v417 = OpVariable %_ptr_Private_uint Private %4 + %v418 = OpVariable %_ptr_Private_uint Private %4 + %v419 = OpVariable %_ptr_Private_uint Private %4 + %v420 = OpVariable %_ptr_Private_uint Private %4 + %v421 = OpVariable %_ptr_Private_uint Private %4 + %v422 = OpVariable %_ptr_Private_uint Private %4 + %v423 = OpVariable %_ptr_Private_uint Private %4 + %v424 = OpVariable %_ptr_Private_uint Private %4 + %v425 = OpVariable %_ptr_Private_uint Private %4 + %v426 = OpVariable %_ptr_Private_uint Private %4 + %v427 = OpVariable %_ptr_Private_uint Private %4 + %v428 = OpVariable %_ptr_Private_uint Private %4 + %v429 = OpVariable %_ptr_Private_uint Private %4 + %v430 = OpVariable %_ptr_Private_uint Private %4 + %v431 = OpVariable %_ptr_Private_uint Private %4 + %v432 = OpVariable %_ptr_Private_uint Private %4 + %v433 = OpVariable %_ptr_Private_uint Private %4 + %v434 = OpVariable %_ptr_Private_uint Private %4 + %v435 = OpVariable %_ptr_Private_uint Private %4 + %v436 = OpVariable %_ptr_Private_uint Private %4 + %v437 = OpVariable %_ptr_Private_uint Private %4 + %v438 = OpVariable %_ptr_Private_uint Private %4 + %v439 = OpVariable %_ptr_Private_uint Private %4 + %v440 = OpVariable %_ptr_Private_uint Private %4 + %v441 = OpVariable %_ptr_Private_uint Private %4 + %v442 = OpVariable %_ptr_Private_uint Private %4 + %v443 = OpVariable %_ptr_Private_uint Private %4 + %v444 = OpVariable %_ptr_Private_uint Private %4 + %v445 = OpVariable %_ptr_Private_uint Private %4 + %v446 = OpVariable %_ptr_Private_uint Private %4 + %v447 = OpVariable %_ptr_Private_uint Private %4 + %v448 = OpVariable %_ptr_Private_uint Private %4 + %v449 = OpVariable %_ptr_Private_uint Private %4 + %v450 = OpVariable %_ptr_Private_uint Private %4 + %v451 = OpVariable %_ptr_Private_uint Private %4 + %v452 = OpVariable %_ptr_Private_uint Private %4 + %v453 = OpVariable %_ptr_Private_uint Private %4 + %v454 = OpVariable %_ptr_Private_uint Private %4 + %v455 = OpVariable %_ptr_Private_uint Private %4 + %v456 = OpVariable %_ptr_Private_uint Private %4 + %v457 = OpVariable %_ptr_Private_uint Private %4 + %v458 = OpVariable %_ptr_Private_uint Private %4 + %v459 = OpVariable %_ptr_Private_uint Private %4 + %v460 = OpVariable %_ptr_Private_uint Private %4 + %v461 = OpVariable %_ptr_Private_uint Private %4 + %v462 = OpVariable %_ptr_Private_uint Private %4 + %v463 = OpVariable %_ptr_Private_uint Private %4 + %v464 = OpVariable %_ptr_Private_uint Private %4 + %v465 = OpVariable %_ptr_Private_uint Private %4 + %v466 = OpVariable %_ptr_Private_uint Private %4 + %v467 = OpVariable %_ptr_Private_uint Private %4 + %v468 = OpVariable %_ptr_Private_uint Private %4 + %v469 = OpVariable %_ptr_Private_uint Private %4 + %v470 = OpVariable %_ptr_Private_uint Private %4 + %v471 = OpVariable %_ptr_Private_uint Private %4 + %v472 = OpVariable %_ptr_Private_uint Private %4 + %v473 = OpVariable %_ptr_Private_uint Private %4 + %v474 = OpVariable %_ptr_Private_uint Private %4 + %v475 = OpVariable %_ptr_Private_uint Private %4 + %v476 = OpVariable %_ptr_Private_uint Private %4 + %v477 = OpVariable %_ptr_Private_uint Private %4 + %v478 = OpVariable %_ptr_Private_uint Private %4 + %v479 = OpVariable %_ptr_Private_uint Private %4 + %v480 = OpVariable %_ptr_Private_uint Private %4 + %v481 = OpVariable %_ptr_Private_uint Private %4 + %v482 = OpVariable %_ptr_Private_uint Private %4 + %v483 = OpVariable %_ptr_Private_uint Private %4 + %v484 = OpVariable %_ptr_Private_uint Private %4 + %v485 = OpVariable %_ptr_Private_uint Private %4 + %v486 = OpVariable %_ptr_Private_uint Private %4 + %v487 = OpVariable %_ptr_Private_uint Private %4 + %v488 = OpVariable %_ptr_Private_uint Private %4 + %v489 = OpVariable %_ptr_Private_uint Private %4 + %v490 = OpVariable %_ptr_Private_uint Private %4 + %v491 = OpVariable %_ptr_Private_uint Private %4 + %v492 = OpVariable %_ptr_Private_uint Private %4 + %v493 = OpVariable %_ptr_Private_uint Private %4 + %v494 = OpVariable %_ptr_Private_uint Private %4 + %v495 = OpVariable %_ptr_Private_uint Private %4 + %v496 = OpVariable %_ptr_Private_uint Private %4 + %v497 = OpVariable %_ptr_Private_uint Private %4 + %v498 = OpVariable %_ptr_Private_uint Private %4 + %v499 = OpVariable %_ptr_Private_uint Private %4 + %v500 = OpVariable %_ptr_Private_uint Private %4 + %v501 = OpVariable %_ptr_Private_uint Private %4 + %v502 = OpVariable %_ptr_Private_uint Private %4 + %v503 = OpVariable %_ptr_Private_uint Private %4 + %v504 = OpVariable %_ptr_Private_uint Private %4 + %v505 = OpVariable %_ptr_Private_uint Private %4 + %v506 = OpVariable %_ptr_Private_uint Private %4 + %v507 = OpVariable %_ptr_Private_uint Private %4 + %v508 = OpVariable %_ptr_Private_uint Private %4 + %v509 = OpVariable %_ptr_Private_uint Private %4 + %v510 = OpVariable %_ptr_Private_uint Private %4 + %v511 = OpVariable %_ptr_Private_uint Private %4 + %v512 = OpVariable %_ptr_Private_uint Private %4 + %v513 = OpVariable %_ptr_Private_uint Private %4 + %v514 = OpVariable %_ptr_Private_uint Private %4 + %v515 = OpVariable %_ptr_Private_uint Private %4 + %v516 = OpVariable %_ptr_Private_uint Private %4 + %v517 = OpVariable %_ptr_Private_uint Private %4 + %v518 = OpVariable %_ptr_Private_uint Private %4 + %v519 = OpVariable %_ptr_Private_uint Private %4 + %v520 = OpVariable %_ptr_Private_uint Private %4 + %v521 = OpVariable %_ptr_Private_uint Private %4 + %v522 = OpVariable %_ptr_Private_uint Private %4 + %v523 = OpVariable %_ptr_Private_uint Private %4 + %v524 = OpVariable %_ptr_Private_uint Private %4 + %v525 = OpVariable %_ptr_Private_uint Private %4 + %v526 = OpVariable %_ptr_Private_uint Private %4 + %v527 = OpVariable %_ptr_Private_uint Private %4 + %v528 = OpVariable %_ptr_Private_uint Private %4 + %v529 = OpVariable %_ptr_Private_uint Private %4 + %v530 = OpVariable %_ptr_Private_uint Private %4 + %v531 = OpVariable %_ptr_Private_uint Private %4 + %v532 = OpVariable %_ptr_Private_uint Private %4 + %v533 = OpVariable %_ptr_Private_uint Private %4 + %v534 = OpVariable %_ptr_Private_uint Private %4 + %v535 = OpVariable %_ptr_Private_uint Private %4 + %v536 = OpVariable %_ptr_Private_uint Private %4 + %v537 = OpVariable %_ptr_Private_uint Private %4 + %v538 = OpVariable %_ptr_Private_uint Private %4 + %v539 = OpVariable %_ptr_Private_uint Private %4 + %v540 = OpVariable %_ptr_Private_uint Private %4 + %v541 = OpVariable %_ptr_Private_uint Private %4 + %v542 = OpVariable %_ptr_Private_uint Private %4 + %v543 = OpVariable %_ptr_Private_uint Private %4 + %v544 = OpVariable %_ptr_Private_uint Private %4 + %v545 = OpVariable %_ptr_Private_uint Private %4 + %v546 = OpVariable %_ptr_Private_uint Private %4 + %v547 = OpVariable %_ptr_Private_uint Private %4 + %v548 = OpVariable %_ptr_Private_uint Private %4 + %v549 = OpVariable %_ptr_Private_uint Private %4 + %v550 = OpVariable %_ptr_Private_uint Private %4 + %v551 = OpVariable %_ptr_Private_uint Private %4 + %v552 = OpVariable %_ptr_Private_uint Private %4 + %v553 = OpVariable %_ptr_Private_uint Private %4 + %v554 = OpVariable %_ptr_Private_uint Private %4 + %v555 = OpVariable %_ptr_Private_uint Private %4 + %v556 = OpVariable %_ptr_Private_uint Private %4 + %v557 = OpVariable %_ptr_Private_uint Private %4 + %v558 = OpVariable %_ptr_Private_uint Private %4 + %v559 = OpVariable %_ptr_Private_uint Private %4 + %v560 = OpVariable %_ptr_Private_uint Private %4 + %v561 = OpVariable %_ptr_Private_uint Private %4 + %v562 = OpVariable %_ptr_Private_uint Private %4 + %v563 = OpVariable %_ptr_Private_uint Private %4 + %v564 = OpVariable %_ptr_Private_uint Private %4 + %v565 = OpVariable %_ptr_Private_uint Private %4 + %v566 = OpVariable %_ptr_Private_uint Private %4 + %v567 = OpVariable %_ptr_Private_uint Private %4 + %v568 = OpVariable %_ptr_Private_uint Private %4 + %v569 = OpVariable %_ptr_Private_uint Private %4 + %v570 = OpVariable %_ptr_Private_uint Private %4 + %v571 = OpVariable %_ptr_Private_uint Private %4 + %v572 = OpVariable %_ptr_Private_uint Private %4 + %v573 = OpVariable %_ptr_Private_uint Private %4 + %v574 = OpVariable %_ptr_Private_uint Private %4 + %v575 = OpVariable %_ptr_Private_uint Private %4 + %v576 = OpVariable %_ptr_Private_uint Private %4 + %v577 = OpVariable %_ptr_Private_uint Private %4 + %v578 = OpVariable %_ptr_Private_uint Private %4 + %v579 = OpVariable %_ptr_Private_uint Private %4 + %v580 = OpVariable %_ptr_Private_uint Private %4 + %v581 = OpVariable %_ptr_Private_uint Private %4 + %v582 = OpVariable %_ptr_Private_uint Private %4 + %v583 = OpVariable %_ptr_Private_uint Private %4 + %v584 = OpVariable %_ptr_Private_uint Private %4 + %v585 = OpVariable %_ptr_Private_uint Private %4 + %v586 = OpVariable %_ptr_Private_uint Private %4 + %v587 = OpVariable %_ptr_Private_uint Private %4 + %v588 = OpVariable %_ptr_Private_uint Private %4 + %v589 = OpVariable %_ptr_Private_uint Private %4 + %v590 = OpVariable %_ptr_Private_uint Private %4 + %v591 = OpVariable %_ptr_Private_uint Private %4 + %v592 = OpVariable %_ptr_Private_uint Private %4 + %v593 = OpVariable %_ptr_Private_uint Private %4 + %v594 = OpVariable %_ptr_Private_uint Private %4 + %v595 = OpVariable %_ptr_Private_uint Private %4 + %v596 = OpVariable %_ptr_Private_uint Private %4 + %v597 = OpVariable %_ptr_Private_uint Private %4 + %v598 = OpVariable %_ptr_Private_uint Private %4 + %v599 = OpVariable %_ptr_Private_uint Private %4 + %v600 = OpVariable %_ptr_Private_uint Private %4 + %v601 = OpVariable %_ptr_Private_uint Private %4 + %v602 = OpVariable %_ptr_Private_uint Private %4 + %v603 = OpVariable %_ptr_Private_uint Private %4 + %v604 = OpVariable %_ptr_Private_uint Private %4 + %v605 = OpVariable %_ptr_Private_uint Private %4 + %v606 = OpVariable %_ptr_Private_uint Private %4 + %v607 = OpVariable %_ptr_Private_uint Private %4 + %v608 = OpVariable %_ptr_Private_uint Private %4 + %v609 = OpVariable %_ptr_Private_uint Private %4 + %v610 = OpVariable %_ptr_Private_uint Private %4 + %v611 = OpVariable %_ptr_Private_uint Private %4 + %v612 = OpVariable %_ptr_Private_uint Private %4 + %v613 = OpVariable %_ptr_Private_uint Private %4 + %v614 = OpVariable %_ptr_Private_uint Private %4 + %v615 = OpVariable %_ptr_Private_uint Private %4 + %v616 = OpVariable %_ptr_Private_uint Private %4 + %v617 = OpVariable %_ptr_Private_uint Private %4 + %v618 = OpVariable %_ptr_Private_uint Private %4 + %v619 = OpVariable %_ptr_Private_uint Private %4 + %v620 = OpVariable %_ptr_Private_uint Private %4 + %v621 = OpVariable %_ptr_Private_uint Private %4 + %v622 = OpVariable %_ptr_Private_uint Private %4 + %v623 = OpVariable %_ptr_Private_uint Private %4 + %v624 = OpVariable %_ptr_Private_uint Private %4 + %v625 = OpVariable %_ptr_Private_uint Private %4 + %v626 = OpVariable %_ptr_Private_uint Private %4 + %v627 = OpVariable %_ptr_Private_uint Private %4 + %v628 = OpVariable %_ptr_Private_uint Private %4 + %v629 = OpVariable %_ptr_Private_uint Private %4 + %v630 = OpVariable %_ptr_Private_uint Private %4 + %v631 = OpVariable %_ptr_Private_uint Private %4 + %v632 = OpVariable %_ptr_Private_uint Private %4 + %v633 = OpVariable %_ptr_Private_uint Private %4 + %v634 = OpVariable %_ptr_Private_uint Private %4 + %v635 = OpVariable %_ptr_Private_uint Private %4 + %v636 = OpVariable %_ptr_Private_uint Private %4 + %v637 = OpVariable %_ptr_Private_uint Private %4 + %v638 = OpVariable %_ptr_Private_uint Private %4 + %v639 = OpVariable %_ptr_Private_uint Private %4 + %v640 = OpVariable %_ptr_Private_uint Private %4 + %v641 = OpVariable %_ptr_Private_uint Private %4 + %v642 = OpVariable %_ptr_Private_uint Private %4 + %v643 = OpVariable %_ptr_Private_uint Private %4 + %v644 = OpVariable %_ptr_Private_uint Private %4 + %v645 = OpVariable %_ptr_Private_uint Private %4 + %v646 = OpVariable %_ptr_Private_uint Private %4 + %v647 = OpVariable %_ptr_Private_uint Private %4 + %v648 = OpVariable %_ptr_Private_uint Private %4 + %v649 = OpVariable %_ptr_Private_uint Private %4 + %v650 = OpVariable %_ptr_Private_uint Private %4 + %v651 = OpVariable %_ptr_Private_uint Private %4 + %v652 = OpVariable %_ptr_Private_uint Private %4 + %v653 = OpVariable %_ptr_Private_uint Private %4 + %v654 = OpVariable %_ptr_Private_uint Private %4 + %v655 = OpVariable %_ptr_Private_uint Private %4 + %v656 = OpVariable %_ptr_Private_uint Private %4 + %v657 = OpVariable %_ptr_Private_uint Private %4 + %v658 = OpVariable %_ptr_Private_uint Private %4 + %v659 = OpVariable %_ptr_Private_uint Private %4 + %v660 = OpVariable %_ptr_Private_uint Private %4 + %v661 = OpVariable %_ptr_Private_uint Private %4 + %v662 = OpVariable %_ptr_Private_uint Private %4 + %v663 = OpVariable %_ptr_Private_uint Private %4 + %v664 = OpVariable %_ptr_Private_uint Private %4 + %v665 = OpVariable %_ptr_Private_uint Private %4 + %v666 = OpVariable %_ptr_Private_uint Private %4 + %v667 = OpVariable %_ptr_Private_uint Private %4 + %v668 = OpVariable %_ptr_Private_uint Private %4 + %v669 = OpVariable %_ptr_Private_uint Private %4 + %v670 = OpVariable %_ptr_Private_uint Private %4 + %v671 = OpVariable %_ptr_Private_uint Private %4 + %v672 = OpVariable %_ptr_Private_uint Private %4 + %v673 = OpVariable %_ptr_Private_uint Private %4 + %v674 = OpVariable %_ptr_Private_uint Private %4 + %v675 = OpVariable %_ptr_Private_uint Private %4 + %v676 = OpVariable %_ptr_Private_uint Private %4 + %v677 = OpVariable %_ptr_Private_uint Private %4 + %v678 = OpVariable %_ptr_Private_uint Private %4 + %v679 = OpVariable %_ptr_Private_uint Private %4 + %v680 = OpVariable %_ptr_Private_uint Private %4 + %v681 = OpVariable %_ptr_Private_uint Private %4 + %v682 = OpVariable %_ptr_Private_uint Private %4 + %v683 = OpVariable %_ptr_Private_uint Private %4 + %v684 = OpVariable %_ptr_Private_uint Private %4 + %v685 = OpVariable %_ptr_Private_uint Private %4 + %v686 = OpVariable %_ptr_Private_uint Private %4 + %v687 = OpVariable %_ptr_Private_uint Private %4 + %v688 = OpVariable %_ptr_Private_uint Private %4 + %v689 = OpVariable %_ptr_Private_uint Private %4 + %v690 = OpVariable %_ptr_Private_uint Private %4 + %v691 = OpVariable %_ptr_Private_uint Private %4 + %v692 = OpVariable %_ptr_Private_uint Private %4 + %v693 = OpVariable %_ptr_Private_uint Private %4 + %v694 = OpVariable %_ptr_Private_uint Private %4 + %v695 = OpVariable %_ptr_Private_uint Private %4 + %v696 = OpVariable %_ptr_Private_uint Private %4 + %v697 = OpVariable %_ptr_Private_uint Private %4 + %v698 = OpVariable %_ptr_Private_uint Private %4 + %v699 = OpVariable %_ptr_Private_uint Private %4 + %v700 = OpVariable %_ptr_Private_uint Private %4 + %v701 = OpVariable %_ptr_Private_uint Private %4 + %v702 = OpVariable %_ptr_Private_uint Private %4 + %v703 = OpVariable %_ptr_Private_uint Private %4 + %v704 = OpVariable %_ptr_Private_uint Private %4 + %v705 = OpVariable %_ptr_Private_uint Private %4 + %v706 = OpVariable %_ptr_Private_uint Private %4 + %v707 = OpVariable %_ptr_Private_uint Private %4 + %v708 = OpVariable %_ptr_Private_uint Private %4 + %v709 = OpVariable %_ptr_Private_uint Private %4 + %v710 = OpVariable %_ptr_Private_uint Private %4 + %v711 = OpVariable %_ptr_Private_uint Private %4 + %v712 = OpVariable %_ptr_Private_uint Private %4 + %v713 = OpVariable %_ptr_Private_uint Private %4 + %v714 = OpVariable %_ptr_Private_uint Private %4 + %v715 = OpVariable %_ptr_Private_uint Private %4 + %v716 = OpVariable %_ptr_Private_uint Private %4 + %v717 = OpVariable %_ptr_Private_uint Private %4 + %v718 = OpVariable %_ptr_Private_uint Private %4 + %v719 = OpVariable %_ptr_Private_uint Private %4 + %v720 = OpVariable %_ptr_Private_uint Private %4 + %v721 = OpVariable %_ptr_Private_uint Private %4 + %v722 = OpVariable %_ptr_Private_uint Private %4 + %v723 = OpVariable %_ptr_Private_uint Private %4 + %v724 = OpVariable %_ptr_Private_uint Private %4 + %v725 = OpVariable %_ptr_Private_uint Private %4 + %v726 = OpVariable %_ptr_Private_uint Private %4 + %v727 = OpVariable %_ptr_Private_uint Private %4 + %v728 = OpVariable %_ptr_Private_uint Private %4 + %v729 = OpVariable %_ptr_Private_uint Private %4 + %v730 = OpVariable %_ptr_Private_uint Private %4 + %v731 = OpVariable %_ptr_Private_uint Private %4 + %v732 = OpVariable %_ptr_Private_uint Private %4 + %v733 = OpVariable %_ptr_Private_uint Private %4 + %v734 = OpVariable %_ptr_Private_uint Private %4 + %v735 = OpVariable %_ptr_Private_uint Private %4 + %v736 = OpVariable %_ptr_Private_uint Private %4 + %v737 = OpVariable %_ptr_Private_uint Private %4 + %v738 = OpVariable %_ptr_Private_uint Private %4 + %v739 = OpVariable %_ptr_Private_uint Private %4 + %v740 = OpVariable %_ptr_Private_uint Private %4 + %v741 = OpVariable %_ptr_Private_uint Private %4 + %v742 = OpVariable %_ptr_Private_uint Private %4 + %v743 = OpVariable %_ptr_Private_uint Private %4 + %v744 = OpVariable %_ptr_Private_uint Private %4 + %v745 = OpVariable %_ptr_Private_uint Private %4 + %v746 = OpVariable %_ptr_Private_uint Private %4 + %v747 = OpVariable %_ptr_Private_uint Private %4 + %v748 = OpVariable %_ptr_Private_uint Private %4 + %v749 = OpVariable %_ptr_Private_uint Private %4 + %v750 = OpVariable %_ptr_Private_uint Private %4 + %v751 = OpVariable %_ptr_Private_uint Private %4 + %v752 = OpVariable %_ptr_Private_uint Private %4 + %v753 = OpVariable %_ptr_Private_uint Private %4 + %v754 = OpVariable %_ptr_Private_uint Private %4 + %v755 = OpVariable %_ptr_Private_uint Private %4 + %v756 = OpVariable %_ptr_Private_uint Private %4 + %v757 = OpVariable %_ptr_Private_uint Private %4 + %v758 = OpVariable %_ptr_Private_uint Private %4 + %v759 = OpVariable %_ptr_Private_uint Private %4 + %v760 = OpVariable %_ptr_Private_uint Private %4 + %v761 = OpVariable %_ptr_Private_uint Private %4 + %v762 = OpVariable %_ptr_Private_uint Private %4 + %v763 = OpVariable %_ptr_Private_uint Private %4 + %v764 = OpVariable %_ptr_Private_uint Private %4 + %v765 = OpVariable %_ptr_Private_uint Private %4 + %v766 = OpVariable %_ptr_Private_uint Private %4 + %v767 = OpVariable %_ptr_Private_uint Private %4 + %v768 = OpVariable %_ptr_Private_uint Private %4 + %v769 = OpVariable %_ptr_Private_uint Private %4 + %v770 = OpVariable %_ptr_Private_uint Private %4 + %v771 = OpVariable %_ptr_Private_uint Private %4 + %v772 = OpVariable %_ptr_Private_uint Private %4 + %v773 = OpVariable %_ptr_Private_uint Private %4 + %v774 = OpVariable %_ptr_Private_uint Private %4 + %v775 = OpVariable %_ptr_Private_uint Private %4 + %v776 = OpVariable %_ptr_Private_uint Private %4 + %v777 = OpVariable %_ptr_Private_uint Private %4 + %v778 = OpVariable %_ptr_Private_uint Private %4 + %v779 = OpVariable %_ptr_Private_uint Private %4 + %v780 = OpVariable %_ptr_Private_uint Private %4 + %v781 = OpVariable %_ptr_Private_uint Private %4 + %v782 = OpVariable %_ptr_Private_uint Private %4 + %v783 = OpVariable %_ptr_Private_uint Private %4 + %v784 = OpVariable %_ptr_Private_uint Private %4 + %v785 = OpVariable %_ptr_Private_uint Private %4 + %v786 = OpVariable %_ptr_Private_uint Private %4 + %v787 = OpVariable %_ptr_Private_uint Private %4 + %v788 = OpVariable %_ptr_Private_uint Private %4 + %v789 = OpVariable %_ptr_Private_uint Private %4 + %v790 = OpVariable %_ptr_Private_uint Private %4 + %v791 = OpVariable %_ptr_Private_uint Private %4 + %v792 = OpVariable %_ptr_Private_uint Private %4 + %v793 = OpVariable %_ptr_Private_uint Private %4 + %v794 = OpVariable %_ptr_Private_uint Private %4 + %v795 = OpVariable %_ptr_Private_uint Private %4 + %v796 = OpVariable %_ptr_Private_uint Private %4 + %v797 = OpVariable %_ptr_Private_uint Private %4 + %v798 = OpVariable %_ptr_Private_uint Private %4 + %v799 = OpVariable %_ptr_Private_uint Private %4 + %v800 = OpVariable %_ptr_Private_uint Private %4 + %v801 = OpVariable %_ptr_Private_uint Private %4 + %v802 = OpVariable %_ptr_Private_uint Private %4 + %v803 = OpVariable %_ptr_Private_uint Private %4 + %v804 = OpVariable %_ptr_Private_uint Private %4 + %v805 = OpVariable %_ptr_Private_uint Private %4 + %v806 = OpVariable %_ptr_Private_uint Private %4 + %v807 = OpVariable %_ptr_Private_uint Private %4 + %v808 = OpVariable %_ptr_Private_uint Private %4 + %v809 = OpVariable %_ptr_Private_uint Private %4 + %v810 = OpVariable %_ptr_Private_uint Private %4 + %v811 = OpVariable %_ptr_Private_uint Private %4 + %v812 = OpVariable %_ptr_Private_uint Private %4 + %v813 = OpVariable %_ptr_Private_uint Private %4 + %v814 = OpVariable %_ptr_Private_uint Private %4 + %v815 = OpVariable %_ptr_Private_uint Private %4 + %v816 = OpVariable %_ptr_Private_uint Private %4 + %v817 = OpVariable %_ptr_Private_uint Private %4 + %v818 = OpVariable %_ptr_Private_uint Private %4 + %v819 = OpVariable %_ptr_Private_uint Private %4 + %v820 = OpVariable %_ptr_Private_uint Private %4 + %v821 = OpVariable %_ptr_Private_uint Private %4 + %v822 = OpVariable %_ptr_Private_uint Private %4 + %v823 = OpVariable %_ptr_Private_uint Private %4 + %v824 = OpVariable %_ptr_Private_uint Private %4 + %v825 = OpVariable %_ptr_Private_uint Private %4 + %v826 = OpVariable %_ptr_Private_uint Private %4 + %v827 = OpVariable %_ptr_Private_uint Private %4 + %v828 = OpVariable %_ptr_Private_uint Private %4 + %v829 = OpVariable %_ptr_Private_uint Private %4 + %v830 = OpVariable %_ptr_Private_uint Private %4 + %v831 = OpVariable %_ptr_Private_uint Private %4 + %v832 = OpVariable %_ptr_Private_uint Private %4 + %v833 = OpVariable %_ptr_Private_uint Private %4 + %v834 = OpVariable %_ptr_Private_uint Private %4 + %v835 = OpVariable %_ptr_Private_uint Private %4 + %v836 = OpVariable %_ptr_Private_uint Private %4 + %v837 = OpVariable %_ptr_Private_uint Private %4 + %v838 = OpVariable %_ptr_Private_uint Private %4 + %v839 = OpVariable %_ptr_Private_uint Private %4 + %v840 = OpVariable %_ptr_Private_uint Private %4 + %v841 = OpVariable %_ptr_Private_uint Private %4 + %v842 = OpVariable %_ptr_Private_uint Private %4 + %v843 = OpVariable %_ptr_Private_uint Private %4 + %v844 = OpVariable %_ptr_Private_uint Private %4 + %v845 = OpVariable %_ptr_Private_uint Private %4 + %v846 = OpVariable %_ptr_Private_uint Private %4 + %v847 = OpVariable %_ptr_Private_uint Private %4 + %v848 = OpVariable %_ptr_Private_uint Private %4 + %v849 = OpVariable %_ptr_Private_uint Private %4 + %v850 = OpVariable %_ptr_Private_uint Private %4 + %v851 = OpVariable %_ptr_Private_uint Private %4 + %v852 = OpVariable %_ptr_Private_uint Private %4 + %v853 = OpVariable %_ptr_Private_uint Private %4 + %v854 = OpVariable %_ptr_Private_uint Private %4 + %v855 = OpVariable %_ptr_Private_uint Private %4 + %v856 = OpVariable %_ptr_Private_uint Private %4 + %v857 = OpVariable %_ptr_Private_uint Private %4 + %v858 = OpVariable %_ptr_Private_uint Private %4 + %v859 = OpVariable %_ptr_Private_uint Private %4 + %v860 = OpVariable %_ptr_Private_uint Private %4 + %v861 = OpVariable %_ptr_Private_uint Private %4 + %v862 = OpVariable %_ptr_Private_uint Private %4 + %v863 = OpVariable %_ptr_Private_uint Private %4 + %v864 = OpVariable %_ptr_Private_uint Private %4 + %v865 = OpVariable %_ptr_Private_uint Private %4 + %v866 = OpVariable %_ptr_Private_uint Private %4 + %v867 = OpVariable %_ptr_Private_uint Private %4 + %v868 = OpVariable %_ptr_Private_uint Private %4 + %v869 = OpVariable %_ptr_Private_uint Private %4 + %v870 = OpVariable %_ptr_Private_uint Private %4 + %v871 = OpVariable %_ptr_Private_uint Private %4 + %v872 = OpVariable %_ptr_Private_uint Private %4 + %v873 = OpVariable %_ptr_Private_uint Private %4 + %v874 = OpVariable %_ptr_Private_uint Private %4 + %v875 = OpVariable %_ptr_Private_uint Private %4 + %v876 = OpVariable %_ptr_Private_uint Private %4 + %v877 = OpVariable %_ptr_Private_uint Private %4 + %v878 = OpVariable %_ptr_Private_uint Private %4 + %v879 = OpVariable %_ptr_Private_uint Private %4 + %v880 = OpVariable %_ptr_Private_uint Private %4 + %v881 = OpVariable %_ptr_Private_uint Private %4 + %v882 = OpVariable %_ptr_Private_uint Private %4 + %v883 = OpVariable %_ptr_Private_uint Private %4 + %v884 = OpVariable %_ptr_Private_uint Private %4 + %v885 = OpVariable %_ptr_Private_uint Private %4 + %v886 = OpVariable %_ptr_Private_uint Private %4 + %v887 = OpVariable %_ptr_Private_uint Private %4 + %v888 = OpVariable %_ptr_Private_uint Private %4 + %v889 = OpVariable %_ptr_Private_uint Private %4 + %v890 = OpVariable %_ptr_Private_uint Private %4 + %v891 = OpVariable %_ptr_Private_uint Private %4 + %v892 = OpVariable %_ptr_Private_uint Private %4 + %v893 = OpVariable %_ptr_Private_uint Private %4 + %v894 = OpVariable %_ptr_Private_uint Private %4 + %v895 = OpVariable %_ptr_Private_uint Private %4 + %v896 = OpVariable %_ptr_Private_uint Private %4 + %v897 = OpVariable %_ptr_Private_uint Private %4 + %v898 = OpVariable %_ptr_Private_uint Private %4 + %v899 = OpVariable %_ptr_Private_uint Private %4 + %v900 = OpVariable %_ptr_Private_uint Private %4 + %v901 = OpVariable %_ptr_Private_uint Private %4 + %v902 = OpVariable %_ptr_Private_uint Private %4 + %v903 = OpVariable %_ptr_Private_uint Private %4 + %v904 = OpVariable %_ptr_Private_uint Private %4 + %v905 = OpVariable %_ptr_Private_uint Private %4 + %v906 = OpVariable %_ptr_Private_uint Private %4 + %v907 = OpVariable %_ptr_Private_uint Private %4 + %v908 = OpVariable %_ptr_Private_uint Private %4 + %v909 = OpVariable %_ptr_Private_uint Private %4 + %v910 = OpVariable %_ptr_Private_uint Private %4 + %v911 = OpVariable %_ptr_Private_uint Private %4 + %v912 = OpVariable %_ptr_Private_uint Private %4 + %v913 = OpVariable %_ptr_Private_uint Private %4 + %v914 = OpVariable %_ptr_Private_uint Private %4 + %v915 = OpVariable %_ptr_Private_uint Private %4 + %v916 = OpVariable %_ptr_Private_uint Private %4 + %v917 = OpVariable %_ptr_Private_uint Private %4 + %v918 = OpVariable %_ptr_Private_uint Private %4 + %v919 = OpVariable %_ptr_Private_uint Private %4 + %v920 = OpVariable %_ptr_Private_uint Private %4 + %v921 = OpVariable %_ptr_Private_uint Private %4 + %v922 = OpVariable %_ptr_Private_uint Private %4 + %v923 = OpVariable %_ptr_Private_uint Private %4 + %v924 = OpVariable %_ptr_Private_uint Private %4 + %v925 = OpVariable %_ptr_Private_uint Private %4 + %v926 = OpVariable %_ptr_Private_uint Private %4 + %v927 = OpVariable %_ptr_Private_uint Private %4 + %v928 = OpVariable %_ptr_Private_uint Private %4 + %v929 = OpVariable %_ptr_Private_uint Private %4 + %v930 = OpVariable %_ptr_Private_uint Private %4 + %v931 = OpVariable %_ptr_Private_uint Private %4 + %v932 = OpVariable %_ptr_Private_uint Private %4 + %v933 = OpVariable %_ptr_Private_uint Private %4 + %v934 = OpVariable %_ptr_Private_uint Private %4 + %v935 = OpVariable %_ptr_Private_uint Private %4 + %v936 = OpVariable %_ptr_Private_uint Private %4 + %v937 = OpVariable %_ptr_Private_uint Private %4 + %v938 = OpVariable %_ptr_Private_uint Private %4 + %v939 = OpVariable %_ptr_Private_uint Private %4 + %v940 = OpVariable %_ptr_Private_uint Private %4 + %v941 = OpVariable %_ptr_Private_uint Private %4 + %v942 = OpVariable %_ptr_Private_uint Private %4 + %v943 = OpVariable %_ptr_Private_uint Private %4 + %v944 = OpVariable %_ptr_Private_uint Private %4 + %v945 = OpVariable %_ptr_Private_uint Private %4 + %v946 = OpVariable %_ptr_Private_uint Private %4 + %v947 = OpVariable %_ptr_Private_uint Private %4 + %v948 = OpVariable %_ptr_Private_uint Private %4 + %v949 = OpVariable %_ptr_Private_uint Private %4 + %v950 = OpVariable %_ptr_Private_uint Private %4 + %v951 = OpVariable %_ptr_Private_uint Private %4 + %v952 = OpVariable %_ptr_Private_uint Private %4 + %v953 = OpVariable %_ptr_Private_uint Private %4 + %v954 = OpVariable %_ptr_Private_uint Private %4 + %v955 = OpVariable %_ptr_Private_uint Private %4 + %v956 = OpVariable %_ptr_Private_uint Private %4 + %v957 = OpVariable %_ptr_Private_uint Private %4 + %v958 = OpVariable %_ptr_Private_uint Private %4 + %v959 = OpVariable %_ptr_Private_uint Private %4 + %v960 = OpVariable %_ptr_Private_uint Private %4 + %v961 = OpVariable %_ptr_Private_uint Private %4 + %v962 = OpVariable %_ptr_Private_uint Private %4 + %v963 = OpVariable %_ptr_Private_uint Private %4 + %v964 = OpVariable %_ptr_Private_uint Private %4 + %v965 = OpVariable %_ptr_Private_uint Private %4 + %v966 = OpVariable %_ptr_Private_uint Private %4 + %v967 = OpVariable %_ptr_Private_uint Private %4 + %v968 = OpVariable %_ptr_Private_uint Private %4 + %v969 = OpVariable %_ptr_Private_uint Private %4 + %v970 = OpVariable %_ptr_Private_uint Private %4 + %v971 = OpVariable %_ptr_Private_uint Private %4 + %v972 = OpVariable %_ptr_Private_uint Private %4 + %v973 = OpVariable %_ptr_Private_uint Private %4 + %v974 = OpVariable %_ptr_Private_uint Private %4 + %v975 = OpVariable %_ptr_Private_uint Private %4 + %v976 = OpVariable %_ptr_Private_uint Private %4 + %v977 = OpVariable %_ptr_Private_uint Private %4 + %v978 = OpVariable %_ptr_Private_uint Private %4 + %v979 = OpVariable %_ptr_Private_uint Private %4 + %v980 = OpVariable %_ptr_Private_uint Private %4 + %v981 = OpVariable %_ptr_Private_uint Private %4 + %v982 = OpVariable %_ptr_Private_uint Private %4 + %v983 = OpVariable %_ptr_Private_uint Private %4 + %v984 = OpVariable %_ptr_Private_uint Private %4 + %v985 = OpVariable %_ptr_Private_uint Private %4 + %v986 = OpVariable %_ptr_Private_uint Private %4 + %v987 = OpVariable %_ptr_Private_uint Private %4 + %v988 = OpVariable %_ptr_Private_uint Private %4 + %v989 = OpVariable %_ptr_Private_uint Private %4 + %v990 = OpVariable %_ptr_Private_uint Private %4 + %v991 = OpVariable %_ptr_Private_uint Private %4 + %v992 = OpVariable %_ptr_Private_uint Private %4 + %v993 = OpVariable %_ptr_Private_uint Private %4 + %v994 = OpVariable %_ptr_Private_uint Private %4 + %v995 = OpVariable %_ptr_Private_uint Private %4 + %v996 = OpVariable %_ptr_Private_uint Private %4 + %v997 = OpVariable %_ptr_Private_uint Private %4 + %v998 = OpVariable %_ptr_Private_uint Private %4 + %v999 = OpVariable %_ptr_Private_uint Private %4 + %1006 = OpTypeFunction %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %void = OpTypeVoid + %4015 = OpTypeFunction %void + %foo = OpFunction %uint None %1006 + %1008 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %4 + OpStore %x %4 + %1011 = OpLoad %uint %x + %1012 = OpLoad %uint %v0 + %1013 = OpIAdd %uint %1011 %1012 + OpStore %x %1013 + %1014 = OpLoad %uint %x + %1015 = OpLoad %uint %v1 + %1016 = OpIAdd %uint %1014 %1015 + OpStore %x %1016 + %1017 = OpLoad %uint %x + %1018 = OpLoad %uint %v2 + %1019 = OpIAdd %uint %1017 %1018 + OpStore %x %1019 + %1020 = OpLoad %uint %x + %1021 = OpLoad %uint %v3 + %1022 = OpIAdd %uint %1020 %1021 + OpStore %x %1022 + %1023 = OpLoad %uint %x + %1024 = OpLoad %uint %v4 + %1025 = OpIAdd %uint %1023 %1024 + OpStore %x %1025 + %1026 = OpLoad %uint %x + %1027 = OpLoad %uint %v5 + %1028 = OpIAdd %uint %1026 %1027 + OpStore %x %1028 + %1029 = OpLoad %uint %x + %1030 = OpLoad %uint %v6 + %1031 = OpIAdd %uint %1029 %1030 + OpStore %x %1031 + %1032 = OpLoad %uint %x + %1033 = OpLoad %uint %v7 + %1034 = OpIAdd %uint %1032 %1033 + OpStore %x %1034 + %1035 = OpLoad %uint %x + %1036 = OpLoad %uint %v8 + %1037 = OpIAdd %uint %1035 %1036 + OpStore %x %1037 + %1038 = OpLoad %uint %x + %1039 = OpLoad %uint %v9 + %1040 = OpIAdd %uint %1038 %1039 + OpStore %x %1040 + %1041 = OpLoad %uint %x + %1042 = OpLoad %uint %v10 + %1043 = OpIAdd %uint %1041 %1042 + OpStore %x %1043 + %1044 = OpLoad %uint %x + %1045 = OpLoad %uint %v11 + %1046 = OpIAdd %uint %1044 %1045 + OpStore %x %1046 + %1047 = OpLoad %uint %x + %1048 = OpLoad %uint %v12 + %1049 = OpIAdd %uint %1047 %1048 + OpStore %x %1049 + %1050 = OpLoad %uint %x + %1051 = OpLoad %uint %v13 + %1052 = OpIAdd %uint %1050 %1051 + OpStore %x %1052 + %1053 = OpLoad %uint %x + %1054 = OpLoad %uint %v14 + %1055 = OpIAdd %uint %1053 %1054 + OpStore %x %1055 + %1056 = OpLoad %uint %x + %1057 = OpLoad %uint %v15 + %1058 = OpIAdd %uint %1056 %1057 + OpStore %x %1058 + %1059 = OpLoad %uint %x + %1060 = OpLoad %uint %v16 + %1061 = OpIAdd %uint %1059 %1060 + OpStore %x %1061 + %1062 = OpLoad %uint %x + %1063 = OpLoad %uint %v17 + %1064 = OpIAdd %uint %1062 %1063 + OpStore %x %1064 + %1065 = OpLoad %uint %x + %1066 = OpLoad %uint %v18 + %1067 = OpIAdd %uint %1065 %1066 + OpStore %x %1067 + %1068 = OpLoad %uint %x + %1069 = OpLoad %uint %v19 + %1070 = OpIAdd %uint %1068 %1069 + OpStore %x %1070 + %1071 = OpLoad %uint %x + %1072 = OpLoad %uint %v20 + %1073 = OpIAdd %uint %1071 %1072 + OpStore %x %1073 + %1074 = OpLoad %uint %x + %1075 = OpLoad %uint %v21 + %1076 = OpIAdd %uint %1074 %1075 + OpStore %x %1076 + %1077 = OpLoad %uint %x + %1078 = OpLoad %uint %v22 + %1079 = OpIAdd %uint %1077 %1078 + OpStore %x %1079 + %1080 = OpLoad %uint %x + %1081 = OpLoad %uint %v23 + %1082 = OpIAdd %uint %1080 %1081 + OpStore %x %1082 + %1083 = OpLoad %uint %x + %1084 = OpLoad %uint %v24 + %1085 = OpIAdd %uint %1083 %1084 + OpStore %x %1085 + %1086 = OpLoad %uint %x + %1087 = OpLoad %uint %v25 + %1088 = OpIAdd %uint %1086 %1087 + OpStore %x %1088 + %1089 = OpLoad %uint %x + %1090 = OpLoad %uint %v26 + %1091 = OpIAdd %uint %1089 %1090 + OpStore %x %1091 + %1092 = OpLoad %uint %x + %1093 = OpLoad %uint %v27 + %1094 = OpIAdd %uint %1092 %1093 + OpStore %x %1094 + %1095 = OpLoad %uint %x + %1096 = OpLoad %uint %v28 + %1097 = OpIAdd %uint %1095 %1096 + OpStore %x %1097 + %1098 = OpLoad %uint %x + %1099 = OpLoad %uint %v29 + %1100 = OpIAdd %uint %1098 %1099 + OpStore %x %1100 + %1101 = OpLoad %uint %x + %1102 = OpLoad %uint %v30 + %1103 = OpIAdd %uint %1101 %1102 + OpStore %x %1103 + %1104 = OpLoad %uint %x + %1105 = OpLoad %uint %v31 + %1106 = OpIAdd %uint %1104 %1105 + OpStore %x %1106 + %1107 = OpLoad %uint %x + %1108 = OpLoad %uint %v32 + %1109 = OpIAdd %uint %1107 %1108 + OpStore %x %1109 + %1110 = OpLoad %uint %x + %1111 = OpLoad %uint %v33 + %1112 = OpIAdd %uint %1110 %1111 + OpStore %x %1112 + %1113 = OpLoad %uint %x + %1114 = OpLoad %uint %v34 + %1115 = OpIAdd %uint %1113 %1114 + OpStore %x %1115 + %1116 = OpLoad %uint %x + %1117 = OpLoad %uint %v35 + %1118 = OpIAdd %uint %1116 %1117 + OpStore %x %1118 + %1119 = OpLoad %uint %x + %1120 = OpLoad %uint %v36 + %1121 = OpIAdd %uint %1119 %1120 + OpStore %x %1121 + %1122 = OpLoad %uint %x + %1123 = OpLoad %uint %v37 + %1124 = OpIAdd %uint %1122 %1123 + OpStore %x %1124 + %1125 = OpLoad %uint %x + %1126 = OpLoad %uint %v38 + %1127 = OpIAdd %uint %1125 %1126 + OpStore %x %1127 + %1128 = OpLoad %uint %x + %1129 = OpLoad %uint %v39 + %1130 = OpIAdd %uint %1128 %1129 + OpStore %x %1130 + %1131 = OpLoad %uint %x + %1132 = OpLoad %uint %v40 + %1133 = OpIAdd %uint %1131 %1132 + OpStore %x %1133 + %1134 = OpLoad %uint %x + %1135 = OpLoad %uint %v41 + %1136 = OpIAdd %uint %1134 %1135 + OpStore %x %1136 + %1137 = OpLoad %uint %x + %1138 = OpLoad %uint %v42 + %1139 = OpIAdd %uint %1137 %1138 + OpStore %x %1139 + %1140 = OpLoad %uint %x + %1141 = OpLoad %uint %v43 + %1142 = OpIAdd %uint %1140 %1141 + OpStore %x %1142 + %1143 = OpLoad %uint %x + %1144 = OpLoad %uint %v44 + %1145 = OpIAdd %uint %1143 %1144 + OpStore %x %1145 + %1146 = OpLoad %uint %x + %1147 = OpLoad %uint %v45 + %1148 = OpIAdd %uint %1146 %1147 + OpStore %x %1148 + %1149 = OpLoad %uint %x + %1150 = OpLoad %uint %v46 + %1151 = OpIAdd %uint %1149 %1150 + OpStore %x %1151 + %1152 = OpLoad %uint %x + %1153 = OpLoad %uint %v47 + %1154 = OpIAdd %uint %1152 %1153 + OpStore %x %1154 + %1155 = OpLoad %uint %x + %1156 = OpLoad %uint %v48 + %1157 = OpIAdd %uint %1155 %1156 + OpStore %x %1157 + %1158 = OpLoad %uint %x + %1159 = OpLoad %uint %v49 + %1160 = OpIAdd %uint %1158 %1159 + OpStore %x %1160 + %1161 = OpLoad %uint %x + %1162 = OpLoad %uint %v50 + %1163 = OpIAdd %uint %1161 %1162 + OpStore %x %1163 + %1164 = OpLoad %uint %x + %1165 = OpLoad %uint %v51 + %1166 = OpIAdd %uint %1164 %1165 + OpStore %x %1166 + %1167 = OpLoad %uint %x + %1168 = OpLoad %uint %v52 + %1169 = OpIAdd %uint %1167 %1168 + OpStore %x %1169 + %1170 = OpLoad %uint %x + %1171 = OpLoad %uint %v53 + %1172 = OpIAdd %uint %1170 %1171 + OpStore %x %1172 + %1173 = OpLoad %uint %x + %1174 = OpLoad %uint %v54 + %1175 = OpIAdd %uint %1173 %1174 + OpStore %x %1175 + %1176 = OpLoad %uint %x + %1177 = OpLoad %uint %v55 + %1178 = OpIAdd %uint %1176 %1177 + OpStore %x %1178 + %1179 = OpLoad %uint %x + %1180 = OpLoad %uint %v56 + %1181 = OpIAdd %uint %1179 %1180 + OpStore %x %1181 + %1182 = OpLoad %uint %x + %1183 = OpLoad %uint %v57 + %1184 = OpIAdd %uint %1182 %1183 + OpStore %x %1184 + %1185 = OpLoad %uint %x + %1186 = OpLoad %uint %v58 + %1187 = OpIAdd %uint %1185 %1186 + OpStore %x %1187 + %1188 = OpLoad %uint %x + %1189 = OpLoad %uint %v59 + %1190 = OpIAdd %uint %1188 %1189 + OpStore %x %1190 + %1191 = OpLoad %uint %x + %1192 = OpLoad %uint %v60 + %1193 = OpIAdd %uint %1191 %1192 + OpStore %x %1193 + %1194 = OpLoad %uint %x + %1195 = OpLoad %uint %v61 + %1196 = OpIAdd %uint %1194 %1195 + OpStore %x %1196 + %1197 = OpLoad %uint %x + %1198 = OpLoad %uint %v62 + %1199 = OpIAdd %uint %1197 %1198 + OpStore %x %1199 + %1200 = OpLoad %uint %x + %1201 = OpLoad %uint %v63 + %1202 = OpIAdd %uint %1200 %1201 + OpStore %x %1202 + %1203 = OpLoad %uint %x + %1204 = OpLoad %uint %v64 + %1205 = OpIAdd %uint %1203 %1204 + OpStore %x %1205 + %1206 = OpLoad %uint %x + %1207 = OpLoad %uint %v65 + %1208 = OpIAdd %uint %1206 %1207 + OpStore %x %1208 + %1209 = OpLoad %uint %x + %1210 = OpLoad %uint %v66 + %1211 = OpIAdd %uint %1209 %1210 + OpStore %x %1211 + %1212 = OpLoad %uint %x + %1213 = OpLoad %uint %v67 + %1214 = OpIAdd %uint %1212 %1213 + OpStore %x %1214 + %1215 = OpLoad %uint %x + %1216 = OpLoad %uint %v68 + %1217 = OpIAdd %uint %1215 %1216 + OpStore %x %1217 + %1218 = OpLoad %uint %x + %1219 = OpLoad %uint %v69 + %1220 = OpIAdd %uint %1218 %1219 + OpStore %x %1220 + %1221 = OpLoad %uint %x + %1222 = OpLoad %uint %v70 + %1223 = OpIAdd %uint %1221 %1222 + OpStore %x %1223 + %1224 = OpLoad %uint %x + %1225 = OpLoad %uint %v71 + %1226 = OpIAdd %uint %1224 %1225 + OpStore %x %1226 + %1227 = OpLoad %uint %x + %1228 = OpLoad %uint %v72 + %1229 = OpIAdd %uint %1227 %1228 + OpStore %x %1229 + %1230 = OpLoad %uint %x + %1231 = OpLoad %uint %v73 + %1232 = OpIAdd %uint %1230 %1231 + OpStore %x %1232 + %1233 = OpLoad %uint %x + %1234 = OpLoad %uint %v74 + %1235 = OpIAdd %uint %1233 %1234 + OpStore %x %1235 + %1236 = OpLoad %uint %x + %1237 = OpLoad %uint %v75 + %1238 = OpIAdd %uint %1236 %1237 + OpStore %x %1238 + %1239 = OpLoad %uint %x + %1240 = OpLoad %uint %v76 + %1241 = OpIAdd %uint %1239 %1240 + OpStore %x %1241 + %1242 = OpLoad %uint %x + %1243 = OpLoad %uint %v77 + %1244 = OpIAdd %uint %1242 %1243 + OpStore %x %1244 + %1245 = OpLoad %uint %x + %1246 = OpLoad %uint %v78 + %1247 = OpIAdd %uint %1245 %1246 + OpStore %x %1247 + %1248 = OpLoad %uint %x + %1249 = OpLoad %uint %v79 + %1250 = OpIAdd %uint %1248 %1249 + OpStore %x %1250 + %1251 = OpLoad %uint %x + %1252 = OpLoad %uint %v80 + %1253 = OpIAdd %uint %1251 %1252 + OpStore %x %1253 + %1254 = OpLoad %uint %x + %1255 = OpLoad %uint %v81 + %1256 = OpIAdd %uint %1254 %1255 + OpStore %x %1256 + %1257 = OpLoad %uint %x + %1258 = OpLoad %uint %v82 + %1259 = OpIAdd %uint %1257 %1258 + OpStore %x %1259 + %1260 = OpLoad %uint %x + %1261 = OpLoad %uint %v83 + %1262 = OpIAdd %uint %1260 %1261 + OpStore %x %1262 + %1263 = OpLoad %uint %x + %1264 = OpLoad %uint %v84 + %1265 = OpIAdd %uint %1263 %1264 + OpStore %x %1265 + %1266 = OpLoad %uint %x + %1267 = OpLoad %uint %v85 + %1268 = OpIAdd %uint %1266 %1267 + OpStore %x %1268 + %1269 = OpLoad %uint %x + %1270 = OpLoad %uint %v86 + %1271 = OpIAdd %uint %1269 %1270 + OpStore %x %1271 + %1272 = OpLoad %uint %x + %1273 = OpLoad %uint %v87 + %1274 = OpIAdd %uint %1272 %1273 + OpStore %x %1274 + %1275 = OpLoad %uint %x + %1276 = OpLoad %uint %v88 + %1277 = OpIAdd %uint %1275 %1276 + OpStore %x %1277 + %1278 = OpLoad %uint %x + %1279 = OpLoad %uint %v89 + %1280 = OpIAdd %uint %1278 %1279 + OpStore %x %1280 + %1281 = OpLoad %uint %x + %1282 = OpLoad %uint %v90 + %1283 = OpIAdd %uint %1281 %1282 + OpStore %x %1283 + %1284 = OpLoad %uint %x + %1285 = OpLoad %uint %v91 + %1286 = OpIAdd %uint %1284 %1285 + OpStore %x %1286 + %1287 = OpLoad %uint %x + %1288 = OpLoad %uint %v92 + %1289 = OpIAdd %uint %1287 %1288 + OpStore %x %1289 + %1290 = OpLoad %uint %x + %1291 = OpLoad %uint %v93 + %1292 = OpIAdd %uint %1290 %1291 + OpStore %x %1292 + %1293 = OpLoad %uint %x + %1294 = OpLoad %uint %v94 + %1295 = OpIAdd %uint %1293 %1294 + OpStore %x %1295 + %1296 = OpLoad %uint %x + %1297 = OpLoad %uint %v95 + %1298 = OpIAdd %uint %1296 %1297 + OpStore %x %1298 + %1299 = OpLoad %uint %x + %1300 = OpLoad %uint %v96 + %1301 = OpIAdd %uint %1299 %1300 + OpStore %x %1301 + %1302 = OpLoad %uint %x + %1303 = OpLoad %uint %v97 + %1304 = OpIAdd %uint %1302 %1303 + OpStore %x %1304 + %1305 = OpLoad %uint %x + %1306 = OpLoad %uint %v98 + %1307 = OpIAdd %uint %1305 %1306 + OpStore %x %1307 + %1308 = OpLoad %uint %x + %1309 = OpLoad %uint %v99 + %1310 = OpIAdd %uint %1308 %1309 + OpStore %x %1310 + %1311 = OpLoad %uint %x + %1312 = OpLoad %uint %v100 + %1313 = OpIAdd %uint %1311 %1312 + OpStore %x %1313 + %1314 = OpLoad %uint %x + %1315 = OpLoad %uint %v101 + %1316 = OpIAdd %uint %1314 %1315 + OpStore %x %1316 + %1317 = OpLoad %uint %x + %1318 = OpLoad %uint %v102 + %1319 = OpIAdd %uint %1317 %1318 + OpStore %x %1319 + %1320 = OpLoad %uint %x + %1321 = OpLoad %uint %v103 + %1322 = OpIAdd %uint %1320 %1321 + OpStore %x %1322 + %1323 = OpLoad %uint %x + %1324 = OpLoad %uint %v104 + %1325 = OpIAdd %uint %1323 %1324 + OpStore %x %1325 + %1326 = OpLoad %uint %x + %1327 = OpLoad %uint %v105 + %1328 = OpIAdd %uint %1326 %1327 + OpStore %x %1328 + %1329 = OpLoad %uint %x + %1330 = OpLoad %uint %v106 + %1331 = OpIAdd %uint %1329 %1330 + OpStore %x %1331 + %1332 = OpLoad %uint %x + %1333 = OpLoad %uint %v107 + %1334 = OpIAdd %uint %1332 %1333 + OpStore %x %1334 + %1335 = OpLoad %uint %x + %1336 = OpLoad %uint %v108 + %1337 = OpIAdd %uint %1335 %1336 + OpStore %x %1337 + %1338 = OpLoad %uint %x + %1339 = OpLoad %uint %v109 + %1340 = OpIAdd %uint %1338 %1339 + OpStore %x %1340 + %1341 = OpLoad %uint %x + %1342 = OpLoad %uint %v110 + %1343 = OpIAdd %uint %1341 %1342 + OpStore %x %1343 + %1344 = OpLoad %uint %x + %1345 = OpLoad %uint %v111 + %1346 = OpIAdd %uint %1344 %1345 + OpStore %x %1346 + %1347 = OpLoad %uint %x + %1348 = OpLoad %uint %v112 + %1349 = OpIAdd %uint %1347 %1348 + OpStore %x %1349 + %1350 = OpLoad %uint %x + %1351 = OpLoad %uint %v113 + %1352 = OpIAdd %uint %1350 %1351 + OpStore %x %1352 + %1353 = OpLoad %uint %x + %1354 = OpLoad %uint %v114 + %1355 = OpIAdd %uint %1353 %1354 + OpStore %x %1355 + %1356 = OpLoad %uint %x + %1357 = OpLoad %uint %v115 + %1358 = OpIAdd %uint %1356 %1357 + OpStore %x %1358 + %1359 = OpLoad %uint %x + %1360 = OpLoad %uint %v116 + %1361 = OpIAdd %uint %1359 %1360 + OpStore %x %1361 + %1362 = OpLoad %uint %x + %1363 = OpLoad %uint %v117 + %1364 = OpIAdd %uint %1362 %1363 + OpStore %x %1364 + %1365 = OpLoad %uint %x + %1366 = OpLoad %uint %v118 + %1367 = OpIAdd %uint %1365 %1366 + OpStore %x %1367 + %1368 = OpLoad %uint %x + %1369 = OpLoad %uint %v119 + %1370 = OpIAdd %uint %1368 %1369 + OpStore %x %1370 + %1371 = OpLoad %uint %x + %1372 = OpLoad %uint %v120 + %1373 = OpIAdd %uint %1371 %1372 + OpStore %x %1373 + %1374 = OpLoad %uint %x + %1375 = OpLoad %uint %v121 + %1376 = OpIAdd %uint %1374 %1375 + OpStore %x %1376 + %1377 = OpLoad %uint %x + %1378 = OpLoad %uint %v122 + %1379 = OpIAdd %uint %1377 %1378 + OpStore %x %1379 + %1380 = OpLoad %uint %x + %1381 = OpLoad %uint %v123 + %1382 = OpIAdd %uint %1380 %1381 + OpStore %x %1382 + %1383 = OpLoad %uint %x + %1384 = OpLoad %uint %v124 + %1385 = OpIAdd %uint %1383 %1384 + OpStore %x %1385 + %1386 = OpLoad %uint %x + %1387 = OpLoad %uint %v125 + %1388 = OpIAdd %uint %1386 %1387 + OpStore %x %1388 + %1389 = OpLoad %uint %x + %1390 = OpLoad %uint %v126 + %1391 = OpIAdd %uint %1389 %1390 + OpStore %x %1391 + %1392 = OpLoad %uint %x + %1393 = OpLoad %uint %v127 + %1394 = OpIAdd %uint %1392 %1393 + OpStore %x %1394 + %1395 = OpLoad %uint %x + %1396 = OpLoad %uint %v128 + %1397 = OpIAdd %uint %1395 %1396 + OpStore %x %1397 + %1398 = OpLoad %uint %x + %1399 = OpLoad %uint %v129 + %1400 = OpIAdd %uint %1398 %1399 + OpStore %x %1400 + %1401 = OpLoad %uint %x + %1402 = OpLoad %uint %v130 + %1403 = OpIAdd %uint %1401 %1402 + OpStore %x %1403 + %1404 = OpLoad %uint %x + %1405 = OpLoad %uint %v131 + %1406 = OpIAdd %uint %1404 %1405 + OpStore %x %1406 + %1407 = OpLoad %uint %x + %1408 = OpLoad %uint %v132 + %1409 = OpIAdd %uint %1407 %1408 + OpStore %x %1409 + %1410 = OpLoad %uint %x + %1411 = OpLoad %uint %v133 + %1412 = OpIAdd %uint %1410 %1411 + OpStore %x %1412 + %1413 = OpLoad %uint %x + %1414 = OpLoad %uint %v134 + %1415 = OpIAdd %uint %1413 %1414 + OpStore %x %1415 + %1416 = OpLoad %uint %x + %1417 = OpLoad %uint %v135 + %1418 = OpIAdd %uint %1416 %1417 + OpStore %x %1418 + %1419 = OpLoad %uint %x + %1420 = OpLoad %uint %v136 + %1421 = OpIAdd %uint %1419 %1420 + OpStore %x %1421 + %1422 = OpLoad %uint %x + %1423 = OpLoad %uint %v137 + %1424 = OpIAdd %uint %1422 %1423 + OpStore %x %1424 + %1425 = OpLoad %uint %x + %1426 = OpLoad %uint %v138 + %1427 = OpIAdd %uint %1425 %1426 + OpStore %x %1427 + %1428 = OpLoad %uint %x + %1429 = OpLoad %uint %v139 + %1430 = OpIAdd %uint %1428 %1429 + OpStore %x %1430 + %1431 = OpLoad %uint %x + %1432 = OpLoad %uint %v140 + %1433 = OpIAdd %uint %1431 %1432 + OpStore %x %1433 + %1434 = OpLoad %uint %x + %1435 = OpLoad %uint %v141 + %1436 = OpIAdd %uint %1434 %1435 + OpStore %x %1436 + %1437 = OpLoad %uint %x + %1438 = OpLoad %uint %v142 + %1439 = OpIAdd %uint %1437 %1438 + OpStore %x %1439 + %1440 = OpLoad %uint %x + %1441 = OpLoad %uint %v143 + %1442 = OpIAdd %uint %1440 %1441 + OpStore %x %1442 + %1443 = OpLoad %uint %x + %1444 = OpLoad %uint %v144 + %1445 = OpIAdd %uint %1443 %1444 + OpStore %x %1445 + %1446 = OpLoad %uint %x + %1447 = OpLoad %uint %v145 + %1448 = OpIAdd %uint %1446 %1447 + OpStore %x %1448 + %1449 = OpLoad %uint %x + %1450 = OpLoad %uint %v146 + %1451 = OpIAdd %uint %1449 %1450 + OpStore %x %1451 + %1452 = OpLoad %uint %x + %1453 = OpLoad %uint %v147 + %1454 = OpIAdd %uint %1452 %1453 + OpStore %x %1454 + %1455 = OpLoad %uint %x + %1456 = OpLoad %uint %v148 + %1457 = OpIAdd %uint %1455 %1456 + OpStore %x %1457 + %1458 = OpLoad %uint %x + %1459 = OpLoad %uint %v149 + %1460 = OpIAdd %uint %1458 %1459 + OpStore %x %1460 + %1461 = OpLoad %uint %x + %1462 = OpLoad %uint %v150 + %1463 = OpIAdd %uint %1461 %1462 + OpStore %x %1463 + %1464 = OpLoad %uint %x + %1465 = OpLoad %uint %v151 + %1466 = OpIAdd %uint %1464 %1465 + OpStore %x %1466 + %1467 = OpLoad %uint %x + %1468 = OpLoad %uint %v152 + %1469 = OpIAdd %uint %1467 %1468 + OpStore %x %1469 + %1470 = OpLoad %uint %x + %1471 = OpLoad %uint %v153 + %1472 = OpIAdd %uint %1470 %1471 + OpStore %x %1472 + %1473 = OpLoad %uint %x + %1474 = OpLoad %uint %v154 + %1475 = OpIAdd %uint %1473 %1474 + OpStore %x %1475 + %1476 = OpLoad %uint %x + %1477 = OpLoad %uint %v155 + %1478 = OpIAdd %uint %1476 %1477 + OpStore %x %1478 + %1479 = OpLoad %uint %x + %1480 = OpLoad %uint %v156 + %1481 = OpIAdd %uint %1479 %1480 + OpStore %x %1481 + %1482 = OpLoad %uint %x + %1483 = OpLoad %uint %v157 + %1484 = OpIAdd %uint %1482 %1483 + OpStore %x %1484 + %1485 = OpLoad %uint %x + %1486 = OpLoad %uint %v158 + %1487 = OpIAdd %uint %1485 %1486 + OpStore %x %1487 + %1488 = OpLoad %uint %x + %1489 = OpLoad %uint %v159 + %1490 = OpIAdd %uint %1488 %1489 + OpStore %x %1490 + %1491 = OpLoad %uint %x + %1492 = OpLoad %uint %v160 + %1493 = OpIAdd %uint %1491 %1492 + OpStore %x %1493 + %1494 = OpLoad %uint %x + %1495 = OpLoad %uint %v161 + %1496 = OpIAdd %uint %1494 %1495 + OpStore %x %1496 + %1497 = OpLoad %uint %x + %1498 = OpLoad %uint %v162 + %1499 = OpIAdd %uint %1497 %1498 + OpStore %x %1499 + %1500 = OpLoad %uint %x + %1501 = OpLoad %uint %v163 + %1502 = OpIAdd %uint %1500 %1501 + OpStore %x %1502 + %1503 = OpLoad %uint %x + %1504 = OpLoad %uint %v164 + %1505 = OpIAdd %uint %1503 %1504 + OpStore %x %1505 + %1506 = OpLoad %uint %x + %1507 = OpLoad %uint %v165 + %1508 = OpIAdd %uint %1506 %1507 + OpStore %x %1508 + %1509 = OpLoad %uint %x + %1510 = OpLoad %uint %v166 + %1511 = OpIAdd %uint %1509 %1510 + OpStore %x %1511 + %1512 = OpLoad %uint %x + %1513 = OpLoad %uint %v167 + %1514 = OpIAdd %uint %1512 %1513 + OpStore %x %1514 + %1515 = OpLoad %uint %x + %1516 = OpLoad %uint %v168 + %1517 = OpIAdd %uint %1515 %1516 + OpStore %x %1517 + %1518 = OpLoad %uint %x + %1519 = OpLoad %uint %v169 + %1520 = OpIAdd %uint %1518 %1519 + OpStore %x %1520 + %1521 = OpLoad %uint %x + %1522 = OpLoad %uint %v170 + %1523 = OpIAdd %uint %1521 %1522 + OpStore %x %1523 + %1524 = OpLoad %uint %x + %1525 = OpLoad %uint %v171 + %1526 = OpIAdd %uint %1524 %1525 + OpStore %x %1526 + %1527 = OpLoad %uint %x + %1528 = OpLoad %uint %v172 + %1529 = OpIAdd %uint %1527 %1528 + OpStore %x %1529 + %1530 = OpLoad %uint %x + %1531 = OpLoad %uint %v173 + %1532 = OpIAdd %uint %1530 %1531 + OpStore %x %1532 + %1533 = OpLoad %uint %x + %1534 = OpLoad %uint %v174 + %1535 = OpIAdd %uint %1533 %1534 + OpStore %x %1535 + %1536 = OpLoad %uint %x + %1537 = OpLoad %uint %v175 + %1538 = OpIAdd %uint %1536 %1537 + OpStore %x %1538 + %1539 = OpLoad %uint %x + %1540 = OpLoad %uint %v176 + %1541 = OpIAdd %uint %1539 %1540 + OpStore %x %1541 + %1542 = OpLoad %uint %x + %1543 = OpLoad %uint %v177 + %1544 = OpIAdd %uint %1542 %1543 + OpStore %x %1544 + %1545 = OpLoad %uint %x + %1546 = OpLoad %uint %v178 + %1547 = OpIAdd %uint %1545 %1546 + OpStore %x %1547 + %1548 = OpLoad %uint %x + %1549 = OpLoad %uint %v179 + %1550 = OpIAdd %uint %1548 %1549 + OpStore %x %1550 + %1551 = OpLoad %uint %x + %1552 = OpLoad %uint %v180 + %1553 = OpIAdd %uint %1551 %1552 + OpStore %x %1553 + %1554 = OpLoad %uint %x + %1555 = OpLoad %uint %v181 + %1556 = OpIAdd %uint %1554 %1555 + OpStore %x %1556 + %1557 = OpLoad %uint %x + %1558 = OpLoad %uint %v182 + %1559 = OpIAdd %uint %1557 %1558 + OpStore %x %1559 + %1560 = OpLoad %uint %x + %1561 = OpLoad %uint %v183 + %1562 = OpIAdd %uint %1560 %1561 + OpStore %x %1562 + %1563 = OpLoad %uint %x + %1564 = OpLoad %uint %v184 + %1565 = OpIAdd %uint %1563 %1564 + OpStore %x %1565 + %1566 = OpLoad %uint %x + %1567 = OpLoad %uint %v185 + %1568 = OpIAdd %uint %1566 %1567 + OpStore %x %1568 + %1569 = OpLoad %uint %x + %1570 = OpLoad %uint %v186 + %1571 = OpIAdd %uint %1569 %1570 + OpStore %x %1571 + %1572 = OpLoad %uint %x + %1573 = OpLoad %uint %v187 + %1574 = OpIAdd %uint %1572 %1573 + OpStore %x %1574 + %1575 = OpLoad %uint %x + %1576 = OpLoad %uint %v188 + %1577 = OpIAdd %uint %1575 %1576 + OpStore %x %1577 + %1578 = OpLoad %uint %x + %1579 = OpLoad %uint %v189 + %1580 = OpIAdd %uint %1578 %1579 + OpStore %x %1580 + %1581 = OpLoad %uint %x + %1582 = OpLoad %uint %v190 + %1583 = OpIAdd %uint %1581 %1582 + OpStore %x %1583 + %1584 = OpLoad %uint %x + %1585 = OpLoad %uint %v191 + %1586 = OpIAdd %uint %1584 %1585 + OpStore %x %1586 + %1587 = OpLoad %uint %x + %1588 = OpLoad %uint %v192 + %1589 = OpIAdd %uint %1587 %1588 + OpStore %x %1589 + %1590 = OpLoad %uint %x + %1591 = OpLoad %uint %v193 + %1592 = OpIAdd %uint %1590 %1591 + OpStore %x %1592 + %1593 = OpLoad %uint %x + %1594 = OpLoad %uint %v194 + %1595 = OpIAdd %uint %1593 %1594 + OpStore %x %1595 + %1596 = OpLoad %uint %x + %1597 = OpLoad %uint %v195 + %1598 = OpIAdd %uint %1596 %1597 + OpStore %x %1598 + %1599 = OpLoad %uint %x + %1600 = OpLoad %uint %v196 + %1601 = OpIAdd %uint %1599 %1600 + OpStore %x %1601 + %1602 = OpLoad %uint %x + %1603 = OpLoad %uint %v197 + %1604 = OpIAdd %uint %1602 %1603 + OpStore %x %1604 + %1605 = OpLoad %uint %x + %1606 = OpLoad %uint %v198 + %1607 = OpIAdd %uint %1605 %1606 + OpStore %x %1607 + %1608 = OpLoad %uint %x + %1609 = OpLoad %uint %v199 + %1610 = OpIAdd %uint %1608 %1609 + OpStore %x %1610 + %1611 = OpLoad %uint %x + %1612 = OpLoad %uint %v200 + %1613 = OpIAdd %uint %1611 %1612 + OpStore %x %1613 + %1614 = OpLoad %uint %x + %1615 = OpLoad %uint %v201 + %1616 = OpIAdd %uint %1614 %1615 + OpStore %x %1616 + %1617 = OpLoad %uint %x + %1618 = OpLoad %uint %v202 + %1619 = OpIAdd %uint %1617 %1618 + OpStore %x %1619 + %1620 = OpLoad %uint %x + %1621 = OpLoad %uint %v203 + %1622 = OpIAdd %uint %1620 %1621 + OpStore %x %1622 + %1623 = OpLoad %uint %x + %1624 = OpLoad %uint %v204 + %1625 = OpIAdd %uint %1623 %1624 + OpStore %x %1625 + %1626 = OpLoad %uint %x + %1627 = OpLoad %uint %v205 + %1628 = OpIAdd %uint %1626 %1627 + OpStore %x %1628 + %1629 = OpLoad %uint %x + %1630 = OpLoad %uint %v206 + %1631 = OpIAdd %uint %1629 %1630 + OpStore %x %1631 + %1632 = OpLoad %uint %x + %1633 = OpLoad %uint %v207 + %1634 = OpIAdd %uint %1632 %1633 + OpStore %x %1634 + %1635 = OpLoad %uint %x + %1636 = OpLoad %uint %v208 + %1637 = OpIAdd %uint %1635 %1636 + OpStore %x %1637 + %1638 = OpLoad %uint %x + %1639 = OpLoad %uint %v209 + %1640 = OpIAdd %uint %1638 %1639 + OpStore %x %1640 + %1641 = OpLoad %uint %x + %1642 = OpLoad %uint %v210 + %1643 = OpIAdd %uint %1641 %1642 + OpStore %x %1643 + %1644 = OpLoad %uint %x + %1645 = OpLoad %uint %v211 + %1646 = OpIAdd %uint %1644 %1645 + OpStore %x %1646 + %1647 = OpLoad %uint %x + %1648 = OpLoad %uint %v212 + %1649 = OpIAdd %uint %1647 %1648 + OpStore %x %1649 + %1650 = OpLoad %uint %x + %1651 = OpLoad %uint %v213 + %1652 = OpIAdd %uint %1650 %1651 + OpStore %x %1652 + %1653 = OpLoad %uint %x + %1654 = OpLoad %uint %v214 + %1655 = OpIAdd %uint %1653 %1654 + OpStore %x %1655 + %1656 = OpLoad %uint %x + %1657 = OpLoad %uint %v215 + %1658 = OpIAdd %uint %1656 %1657 + OpStore %x %1658 + %1659 = OpLoad %uint %x + %1660 = OpLoad %uint %v216 + %1661 = OpIAdd %uint %1659 %1660 + OpStore %x %1661 + %1662 = OpLoad %uint %x + %1663 = OpLoad %uint %v217 + %1664 = OpIAdd %uint %1662 %1663 + OpStore %x %1664 + %1665 = OpLoad %uint %x + %1666 = OpLoad %uint %v218 + %1667 = OpIAdd %uint %1665 %1666 + OpStore %x %1667 + %1668 = OpLoad %uint %x + %1669 = OpLoad %uint %v219 + %1670 = OpIAdd %uint %1668 %1669 + OpStore %x %1670 + %1671 = OpLoad %uint %x + %1672 = OpLoad %uint %v220 + %1673 = OpIAdd %uint %1671 %1672 + OpStore %x %1673 + %1674 = OpLoad %uint %x + %1675 = OpLoad %uint %v221 + %1676 = OpIAdd %uint %1674 %1675 + OpStore %x %1676 + %1677 = OpLoad %uint %x + %1678 = OpLoad %uint %v222 + %1679 = OpIAdd %uint %1677 %1678 + OpStore %x %1679 + %1680 = OpLoad %uint %x + %1681 = OpLoad %uint %v223 + %1682 = OpIAdd %uint %1680 %1681 + OpStore %x %1682 + %1683 = OpLoad %uint %x + %1684 = OpLoad %uint %v224 + %1685 = OpIAdd %uint %1683 %1684 + OpStore %x %1685 + %1686 = OpLoad %uint %x + %1687 = OpLoad %uint %v225 + %1688 = OpIAdd %uint %1686 %1687 + OpStore %x %1688 + %1689 = OpLoad %uint %x + %1690 = OpLoad %uint %v226 + %1691 = OpIAdd %uint %1689 %1690 + OpStore %x %1691 + %1692 = OpLoad %uint %x + %1693 = OpLoad %uint %v227 + %1694 = OpIAdd %uint %1692 %1693 + OpStore %x %1694 + %1695 = OpLoad %uint %x + %1696 = OpLoad %uint %v228 + %1697 = OpIAdd %uint %1695 %1696 + OpStore %x %1697 + %1698 = OpLoad %uint %x + %1699 = OpLoad %uint %v229 + %1700 = OpIAdd %uint %1698 %1699 + OpStore %x %1700 + %1701 = OpLoad %uint %x + %1702 = OpLoad %uint %v230 + %1703 = OpIAdd %uint %1701 %1702 + OpStore %x %1703 + %1704 = OpLoad %uint %x + %1705 = OpLoad %uint %v231 + %1706 = OpIAdd %uint %1704 %1705 + OpStore %x %1706 + %1707 = OpLoad %uint %x + %1708 = OpLoad %uint %v232 + %1709 = OpIAdd %uint %1707 %1708 + OpStore %x %1709 + %1710 = OpLoad %uint %x + %1711 = OpLoad %uint %v233 + %1712 = OpIAdd %uint %1710 %1711 + OpStore %x %1712 + %1713 = OpLoad %uint %x + %1714 = OpLoad %uint %v234 + %1715 = OpIAdd %uint %1713 %1714 + OpStore %x %1715 + %1716 = OpLoad %uint %x + %1717 = OpLoad %uint %v235 + %1718 = OpIAdd %uint %1716 %1717 + OpStore %x %1718 + %1719 = OpLoad %uint %x + %1720 = OpLoad %uint %v236 + %1721 = OpIAdd %uint %1719 %1720 + OpStore %x %1721 + %1722 = OpLoad %uint %x + %1723 = OpLoad %uint %v237 + %1724 = OpIAdd %uint %1722 %1723 + OpStore %x %1724 + %1725 = OpLoad %uint %x + %1726 = OpLoad %uint %v238 + %1727 = OpIAdd %uint %1725 %1726 + OpStore %x %1727 + %1728 = OpLoad %uint %x + %1729 = OpLoad %uint %v239 + %1730 = OpIAdd %uint %1728 %1729 + OpStore %x %1730 + %1731 = OpLoad %uint %x + %1732 = OpLoad %uint %v240 + %1733 = OpIAdd %uint %1731 %1732 + OpStore %x %1733 + %1734 = OpLoad %uint %x + %1735 = OpLoad %uint %v241 + %1736 = OpIAdd %uint %1734 %1735 + OpStore %x %1736 + %1737 = OpLoad %uint %x + %1738 = OpLoad %uint %v242 + %1739 = OpIAdd %uint %1737 %1738 + OpStore %x %1739 + %1740 = OpLoad %uint %x + %1741 = OpLoad %uint %v243 + %1742 = OpIAdd %uint %1740 %1741 + OpStore %x %1742 + %1743 = OpLoad %uint %x + %1744 = OpLoad %uint %v244 + %1745 = OpIAdd %uint %1743 %1744 + OpStore %x %1745 + %1746 = OpLoad %uint %x + %1747 = OpLoad %uint %v245 + %1748 = OpIAdd %uint %1746 %1747 + OpStore %x %1748 + %1749 = OpLoad %uint %x + %1750 = OpLoad %uint %v246 + %1751 = OpIAdd %uint %1749 %1750 + OpStore %x %1751 + %1752 = OpLoad %uint %x + %1753 = OpLoad %uint %v247 + %1754 = OpIAdd %uint %1752 %1753 + OpStore %x %1754 + %1755 = OpLoad %uint %x + %1756 = OpLoad %uint %v248 + %1757 = OpIAdd %uint %1755 %1756 + OpStore %x %1757 + %1758 = OpLoad %uint %x + %1759 = OpLoad %uint %v249 + %1760 = OpIAdd %uint %1758 %1759 + OpStore %x %1760 + %1761 = OpLoad %uint %x + %1762 = OpLoad %uint %v250 + %1763 = OpIAdd %uint %1761 %1762 + OpStore %x %1763 + %1764 = OpLoad %uint %x + %1765 = OpLoad %uint %v251 + %1766 = OpIAdd %uint %1764 %1765 + OpStore %x %1766 + %1767 = OpLoad %uint %x + %1768 = OpLoad %uint %v252 + %1769 = OpIAdd %uint %1767 %1768 + OpStore %x %1769 + %1770 = OpLoad %uint %x + %1771 = OpLoad %uint %v253 + %1772 = OpIAdd %uint %1770 %1771 + OpStore %x %1772 + %1773 = OpLoad %uint %x + %1774 = OpLoad %uint %v254 + %1775 = OpIAdd %uint %1773 %1774 + OpStore %x %1775 + %1776 = OpLoad %uint %x + %1777 = OpLoad %uint %v255 + %1778 = OpIAdd %uint %1776 %1777 + OpStore %x %1778 + %1779 = OpLoad %uint %x + %1780 = OpLoad %uint %v256 + %1781 = OpIAdd %uint %1779 %1780 + OpStore %x %1781 + %1782 = OpLoad %uint %x + %1783 = OpLoad %uint %v257 + %1784 = OpIAdd %uint %1782 %1783 + OpStore %x %1784 + %1785 = OpLoad %uint %x + %1786 = OpLoad %uint %v258 + %1787 = OpIAdd %uint %1785 %1786 + OpStore %x %1787 + %1788 = OpLoad %uint %x + %1789 = OpLoad %uint %v259 + %1790 = OpIAdd %uint %1788 %1789 + OpStore %x %1790 + %1791 = OpLoad %uint %x + %1792 = OpLoad %uint %v260 + %1793 = OpIAdd %uint %1791 %1792 + OpStore %x %1793 + %1794 = OpLoad %uint %x + %1795 = OpLoad %uint %v261 + %1796 = OpIAdd %uint %1794 %1795 + OpStore %x %1796 + %1797 = OpLoad %uint %x + %1798 = OpLoad %uint %v262 + %1799 = OpIAdd %uint %1797 %1798 + OpStore %x %1799 + %1800 = OpLoad %uint %x + %1801 = OpLoad %uint %v263 + %1802 = OpIAdd %uint %1800 %1801 + OpStore %x %1802 + %1803 = OpLoad %uint %x + %1804 = OpLoad %uint %v264 + %1805 = OpIAdd %uint %1803 %1804 + OpStore %x %1805 + %1806 = OpLoad %uint %x + %1807 = OpLoad %uint %v265 + %1808 = OpIAdd %uint %1806 %1807 + OpStore %x %1808 + %1809 = OpLoad %uint %x + %1810 = OpLoad %uint %v266 + %1811 = OpIAdd %uint %1809 %1810 + OpStore %x %1811 + %1812 = OpLoad %uint %x + %1813 = OpLoad %uint %v267 + %1814 = OpIAdd %uint %1812 %1813 + OpStore %x %1814 + %1815 = OpLoad %uint %x + %1816 = OpLoad %uint %v268 + %1817 = OpIAdd %uint %1815 %1816 + OpStore %x %1817 + %1818 = OpLoad %uint %x + %1819 = OpLoad %uint %v269 + %1820 = OpIAdd %uint %1818 %1819 + OpStore %x %1820 + %1821 = OpLoad %uint %x + %1822 = OpLoad %uint %v270 + %1823 = OpIAdd %uint %1821 %1822 + OpStore %x %1823 + %1824 = OpLoad %uint %x + %1825 = OpLoad %uint %v271 + %1826 = OpIAdd %uint %1824 %1825 + OpStore %x %1826 + %1827 = OpLoad %uint %x + %1828 = OpLoad %uint %v272 + %1829 = OpIAdd %uint %1827 %1828 + OpStore %x %1829 + %1830 = OpLoad %uint %x + %1831 = OpLoad %uint %v273 + %1832 = OpIAdd %uint %1830 %1831 + OpStore %x %1832 + %1833 = OpLoad %uint %x + %1834 = OpLoad %uint %v274 + %1835 = OpIAdd %uint %1833 %1834 + OpStore %x %1835 + %1836 = OpLoad %uint %x + %1837 = OpLoad %uint %v275 + %1838 = OpIAdd %uint %1836 %1837 + OpStore %x %1838 + %1839 = OpLoad %uint %x + %1840 = OpLoad %uint %v276 + %1841 = OpIAdd %uint %1839 %1840 + OpStore %x %1841 + %1842 = OpLoad %uint %x + %1843 = OpLoad %uint %v277 + %1844 = OpIAdd %uint %1842 %1843 + OpStore %x %1844 + %1845 = OpLoad %uint %x + %1846 = OpLoad %uint %v278 + %1847 = OpIAdd %uint %1845 %1846 + OpStore %x %1847 + %1848 = OpLoad %uint %x + %1849 = OpLoad %uint %v279 + %1850 = OpIAdd %uint %1848 %1849 + OpStore %x %1850 + %1851 = OpLoad %uint %x + %1852 = OpLoad %uint %v280 + %1853 = OpIAdd %uint %1851 %1852 + OpStore %x %1853 + %1854 = OpLoad %uint %x + %1855 = OpLoad %uint %v281 + %1856 = OpIAdd %uint %1854 %1855 + OpStore %x %1856 + %1857 = OpLoad %uint %x + %1858 = OpLoad %uint %v282 + %1859 = OpIAdd %uint %1857 %1858 + OpStore %x %1859 + %1860 = OpLoad %uint %x + %1861 = OpLoad %uint %v283 + %1862 = OpIAdd %uint %1860 %1861 + OpStore %x %1862 + %1863 = OpLoad %uint %x + %1864 = OpLoad %uint %v284 + %1865 = OpIAdd %uint %1863 %1864 + OpStore %x %1865 + %1866 = OpLoad %uint %x + %1867 = OpLoad %uint %v285 + %1868 = OpIAdd %uint %1866 %1867 + OpStore %x %1868 + %1869 = OpLoad %uint %x + %1870 = OpLoad %uint %v286 + %1871 = OpIAdd %uint %1869 %1870 + OpStore %x %1871 + %1872 = OpLoad %uint %x + %1873 = OpLoad %uint %v287 + %1874 = OpIAdd %uint %1872 %1873 + OpStore %x %1874 + %1875 = OpLoad %uint %x + %1876 = OpLoad %uint %v288 + %1877 = OpIAdd %uint %1875 %1876 + OpStore %x %1877 + %1878 = OpLoad %uint %x + %1879 = OpLoad %uint %v289 + %1880 = OpIAdd %uint %1878 %1879 + OpStore %x %1880 + %1881 = OpLoad %uint %x + %1882 = OpLoad %uint %v290 + %1883 = OpIAdd %uint %1881 %1882 + OpStore %x %1883 + %1884 = OpLoad %uint %x + %1885 = OpLoad %uint %v291 + %1886 = OpIAdd %uint %1884 %1885 + OpStore %x %1886 + %1887 = OpLoad %uint %x + %1888 = OpLoad %uint %v292 + %1889 = OpIAdd %uint %1887 %1888 + OpStore %x %1889 + %1890 = OpLoad %uint %x + %1891 = OpLoad %uint %v293 + %1892 = OpIAdd %uint %1890 %1891 + OpStore %x %1892 + %1893 = OpLoad %uint %x + %1894 = OpLoad %uint %v294 + %1895 = OpIAdd %uint %1893 %1894 + OpStore %x %1895 + %1896 = OpLoad %uint %x + %1897 = OpLoad %uint %v295 + %1898 = OpIAdd %uint %1896 %1897 + OpStore %x %1898 + %1899 = OpLoad %uint %x + %1900 = OpLoad %uint %v296 + %1901 = OpIAdd %uint %1899 %1900 + OpStore %x %1901 + %1902 = OpLoad %uint %x + %1903 = OpLoad %uint %v297 + %1904 = OpIAdd %uint %1902 %1903 + OpStore %x %1904 + %1905 = OpLoad %uint %x + %1906 = OpLoad %uint %v298 + %1907 = OpIAdd %uint %1905 %1906 + OpStore %x %1907 + %1908 = OpLoad %uint %x + %1909 = OpLoad %uint %v299 + %1910 = OpIAdd %uint %1908 %1909 + OpStore %x %1910 + %1911 = OpLoad %uint %x + %1912 = OpLoad %uint %v300 + %1913 = OpIAdd %uint %1911 %1912 + OpStore %x %1913 + %1914 = OpLoad %uint %x + %1915 = OpLoad %uint %v301 + %1916 = OpIAdd %uint %1914 %1915 + OpStore %x %1916 + %1917 = OpLoad %uint %x + %1918 = OpLoad %uint %v302 + %1919 = OpIAdd %uint %1917 %1918 + OpStore %x %1919 + %1920 = OpLoad %uint %x + %1921 = OpLoad %uint %v303 + %1922 = OpIAdd %uint %1920 %1921 + OpStore %x %1922 + %1923 = OpLoad %uint %x + %1924 = OpLoad %uint %v304 + %1925 = OpIAdd %uint %1923 %1924 + OpStore %x %1925 + %1926 = OpLoad %uint %x + %1927 = OpLoad %uint %v305 + %1928 = OpIAdd %uint %1926 %1927 + OpStore %x %1928 + %1929 = OpLoad %uint %x + %1930 = OpLoad %uint %v306 + %1931 = OpIAdd %uint %1929 %1930 + OpStore %x %1931 + %1932 = OpLoad %uint %x + %1933 = OpLoad %uint %v307 + %1934 = OpIAdd %uint %1932 %1933 + OpStore %x %1934 + %1935 = OpLoad %uint %x + %1936 = OpLoad %uint %v308 + %1937 = OpIAdd %uint %1935 %1936 + OpStore %x %1937 + %1938 = OpLoad %uint %x + %1939 = OpLoad %uint %v309 + %1940 = OpIAdd %uint %1938 %1939 + OpStore %x %1940 + %1941 = OpLoad %uint %x + %1942 = OpLoad %uint %v310 + %1943 = OpIAdd %uint %1941 %1942 + OpStore %x %1943 + %1944 = OpLoad %uint %x + %1945 = OpLoad %uint %v311 + %1946 = OpIAdd %uint %1944 %1945 + OpStore %x %1946 + %1947 = OpLoad %uint %x + %1948 = OpLoad %uint %v312 + %1949 = OpIAdd %uint %1947 %1948 + OpStore %x %1949 + %1950 = OpLoad %uint %x + %1951 = OpLoad %uint %v313 + %1952 = OpIAdd %uint %1950 %1951 + OpStore %x %1952 + %1953 = OpLoad %uint %x + %1954 = OpLoad %uint %v314 + %1955 = OpIAdd %uint %1953 %1954 + OpStore %x %1955 + %1956 = OpLoad %uint %x + %1957 = OpLoad %uint %v315 + %1958 = OpIAdd %uint %1956 %1957 + OpStore %x %1958 + %1959 = OpLoad %uint %x + %1960 = OpLoad %uint %v316 + %1961 = OpIAdd %uint %1959 %1960 + OpStore %x %1961 + %1962 = OpLoad %uint %x + %1963 = OpLoad %uint %v317 + %1964 = OpIAdd %uint %1962 %1963 + OpStore %x %1964 + %1965 = OpLoad %uint %x + %1966 = OpLoad %uint %v318 + %1967 = OpIAdd %uint %1965 %1966 + OpStore %x %1967 + %1968 = OpLoad %uint %x + %1969 = OpLoad %uint %v319 + %1970 = OpIAdd %uint %1968 %1969 + OpStore %x %1970 + %1971 = OpLoad %uint %x + %1972 = OpLoad %uint %v320 + %1973 = OpIAdd %uint %1971 %1972 + OpStore %x %1973 + %1974 = OpLoad %uint %x + %1975 = OpLoad %uint %v321 + %1976 = OpIAdd %uint %1974 %1975 + OpStore %x %1976 + %1977 = OpLoad %uint %x + %1978 = OpLoad %uint %v322 + %1979 = OpIAdd %uint %1977 %1978 + OpStore %x %1979 + %1980 = OpLoad %uint %x + %1981 = OpLoad %uint %v323 + %1982 = OpIAdd %uint %1980 %1981 + OpStore %x %1982 + %1983 = OpLoad %uint %x + %1984 = OpLoad %uint %v324 + %1985 = OpIAdd %uint %1983 %1984 + OpStore %x %1985 + %1986 = OpLoad %uint %x + %1987 = OpLoad %uint %v325 + %1988 = OpIAdd %uint %1986 %1987 + OpStore %x %1988 + %1989 = OpLoad %uint %x + %1990 = OpLoad %uint %v326 + %1991 = OpIAdd %uint %1989 %1990 + OpStore %x %1991 + %1992 = OpLoad %uint %x + %1993 = OpLoad %uint %v327 + %1994 = OpIAdd %uint %1992 %1993 + OpStore %x %1994 + %1995 = OpLoad %uint %x + %1996 = OpLoad %uint %v328 + %1997 = OpIAdd %uint %1995 %1996 + OpStore %x %1997 + %1998 = OpLoad %uint %x + %1999 = OpLoad %uint %v329 + %2000 = OpIAdd %uint %1998 %1999 + OpStore %x %2000 + %2001 = OpLoad %uint %x + %2002 = OpLoad %uint %v330 + %2003 = OpIAdd %uint %2001 %2002 + OpStore %x %2003 + %2004 = OpLoad %uint %x + %2005 = OpLoad %uint %v331 + %2006 = OpIAdd %uint %2004 %2005 + OpStore %x %2006 + %2007 = OpLoad %uint %x + %2008 = OpLoad %uint %v332 + %2009 = OpIAdd %uint %2007 %2008 + OpStore %x %2009 + %2010 = OpLoad %uint %x + %2011 = OpLoad %uint %v333 + %2012 = OpIAdd %uint %2010 %2011 + OpStore %x %2012 + %2013 = OpLoad %uint %x + %2014 = OpLoad %uint %v334 + %2015 = OpIAdd %uint %2013 %2014 + OpStore %x %2015 + %2016 = OpLoad %uint %x + %2017 = OpLoad %uint %v335 + %2018 = OpIAdd %uint %2016 %2017 + OpStore %x %2018 + %2019 = OpLoad %uint %x + %2020 = OpLoad %uint %v336 + %2021 = OpIAdd %uint %2019 %2020 + OpStore %x %2021 + %2022 = OpLoad %uint %x + %2023 = OpLoad %uint %v337 + %2024 = OpIAdd %uint %2022 %2023 + OpStore %x %2024 + %2025 = OpLoad %uint %x + %2026 = OpLoad %uint %v338 + %2027 = OpIAdd %uint %2025 %2026 + OpStore %x %2027 + %2028 = OpLoad %uint %x + %2029 = OpLoad %uint %v339 + %2030 = OpIAdd %uint %2028 %2029 + OpStore %x %2030 + %2031 = OpLoad %uint %x + %2032 = OpLoad %uint %v340 + %2033 = OpIAdd %uint %2031 %2032 + OpStore %x %2033 + %2034 = OpLoad %uint %x + %2035 = OpLoad %uint %v341 + %2036 = OpIAdd %uint %2034 %2035 + OpStore %x %2036 + %2037 = OpLoad %uint %x + %2038 = OpLoad %uint %v342 + %2039 = OpIAdd %uint %2037 %2038 + OpStore %x %2039 + %2040 = OpLoad %uint %x + %2041 = OpLoad %uint %v343 + %2042 = OpIAdd %uint %2040 %2041 + OpStore %x %2042 + %2043 = OpLoad %uint %x + %2044 = OpLoad %uint %v344 + %2045 = OpIAdd %uint %2043 %2044 + OpStore %x %2045 + %2046 = OpLoad %uint %x + %2047 = OpLoad %uint %v345 + %2048 = OpIAdd %uint %2046 %2047 + OpStore %x %2048 + %2049 = OpLoad %uint %x + %2050 = OpLoad %uint %v346 + %2051 = OpIAdd %uint %2049 %2050 + OpStore %x %2051 + %2052 = OpLoad %uint %x + %2053 = OpLoad %uint %v347 + %2054 = OpIAdd %uint %2052 %2053 + OpStore %x %2054 + %2055 = OpLoad %uint %x + %2056 = OpLoad %uint %v348 + %2057 = OpIAdd %uint %2055 %2056 + OpStore %x %2057 + %2058 = OpLoad %uint %x + %2059 = OpLoad %uint %v349 + %2060 = OpIAdd %uint %2058 %2059 + OpStore %x %2060 + %2061 = OpLoad %uint %x + %2062 = OpLoad %uint %v350 + %2063 = OpIAdd %uint %2061 %2062 + OpStore %x %2063 + %2064 = OpLoad %uint %x + %2065 = OpLoad %uint %v351 + %2066 = OpIAdd %uint %2064 %2065 + OpStore %x %2066 + %2067 = OpLoad %uint %x + %2068 = OpLoad %uint %v352 + %2069 = OpIAdd %uint %2067 %2068 + OpStore %x %2069 + %2070 = OpLoad %uint %x + %2071 = OpLoad %uint %v353 + %2072 = OpIAdd %uint %2070 %2071 + OpStore %x %2072 + %2073 = OpLoad %uint %x + %2074 = OpLoad %uint %v354 + %2075 = OpIAdd %uint %2073 %2074 + OpStore %x %2075 + %2076 = OpLoad %uint %x + %2077 = OpLoad %uint %v355 + %2078 = OpIAdd %uint %2076 %2077 + OpStore %x %2078 + %2079 = OpLoad %uint %x + %2080 = OpLoad %uint %v356 + %2081 = OpIAdd %uint %2079 %2080 + OpStore %x %2081 + %2082 = OpLoad %uint %x + %2083 = OpLoad %uint %v357 + %2084 = OpIAdd %uint %2082 %2083 + OpStore %x %2084 + %2085 = OpLoad %uint %x + %2086 = OpLoad %uint %v358 + %2087 = OpIAdd %uint %2085 %2086 + OpStore %x %2087 + %2088 = OpLoad %uint %x + %2089 = OpLoad %uint %v359 + %2090 = OpIAdd %uint %2088 %2089 + OpStore %x %2090 + %2091 = OpLoad %uint %x + %2092 = OpLoad %uint %v360 + %2093 = OpIAdd %uint %2091 %2092 + OpStore %x %2093 + %2094 = OpLoad %uint %x + %2095 = OpLoad %uint %v361 + %2096 = OpIAdd %uint %2094 %2095 + OpStore %x %2096 + %2097 = OpLoad %uint %x + %2098 = OpLoad %uint %v362 + %2099 = OpIAdd %uint %2097 %2098 + OpStore %x %2099 + %2100 = OpLoad %uint %x + %2101 = OpLoad %uint %v363 + %2102 = OpIAdd %uint %2100 %2101 + OpStore %x %2102 + %2103 = OpLoad %uint %x + %2104 = OpLoad %uint %v364 + %2105 = OpIAdd %uint %2103 %2104 + OpStore %x %2105 + %2106 = OpLoad %uint %x + %2107 = OpLoad %uint %v365 + %2108 = OpIAdd %uint %2106 %2107 + OpStore %x %2108 + %2109 = OpLoad %uint %x + %2110 = OpLoad %uint %v366 + %2111 = OpIAdd %uint %2109 %2110 + OpStore %x %2111 + %2112 = OpLoad %uint %x + %2113 = OpLoad %uint %v367 + %2114 = OpIAdd %uint %2112 %2113 + OpStore %x %2114 + %2115 = OpLoad %uint %x + %2116 = OpLoad %uint %v368 + %2117 = OpIAdd %uint %2115 %2116 + OpStore %x %2117 + %2118 = OpLoad %uint %x + %2119 = OpLoad %uint %v369 + %2120 = OpIAdd %uint %2118 %2119 + OpStore %x %2120 + %2121 = OpLoad %uint %x + %2122 = OpLoad %uint %v370 + %2123 = OpIAdd %uint %2121 %2122 + OpStore %x %2123 + %2124 = OpLoad %uint %x + %2125 = OpLoad %uint %v371 + %2126 = OpIAdd %uint %2124 %2125 + OpStore %x %2126 + %2127 = OpLoad %uint %x + %2128 = OpLoad %uint %v372 + %2129 = OpIAdd %uint %2127 %2128 + OpStore %x %2129 + %2130 = OpLoad %uint %x + %2131 = OpLoad %uint %v373 + %2132 = OpIAdd %uint %2130 %2131 + OpStore %x %2132 + %2133 = OpLoad %uint %x + %2134 = OpLoad %uint %v374 + %2135 = OpIAdd %uint %2133 %2134 + OpStore %x %2135 + %2136 = OpLoad %uint %x + %2137 = OpLoad %uint %v375 + %2138 = OpIAdd %uint %2136 %2137 + OpStore %x %2138 + %2139 = OpLoad %uint %x + %2140 = OpLoad %uint %v376 + %2141 = OpIAdd %uint %2139 %2140 + OpStore %x %2141 + %2142 = OpLoad %uint %x + %2143 = OpLoad %uint %v377 + %2144 = OpIAdd %uint %2142 %2143 + OpStore %x %2144 + %2145 = OpLoad %uint %x + %2146 = OpLoad %uint %v378 + %2147 = OpIAdd %uint %2145 %2146 + OpStore %x %2147 + %2148 = OpLoad %uint %x + %2149 = OpLoad %uint %v379 + %2150 = OpIAdd %uint %2148 %2149 + OpStore %x %2150 + %2151 = OpLoad %uint %x + %2152 = OpLoad %uint %v380 + %2153 = OpIAdd %uint %2151 %2152 + OpStore %x %2153 + %2154 = OpLoad %uint %x + %2155 = OpLoad %uint %v381 + %2156 = OpIAdd %uint %2154 %2155 + OpStore %x %2156 + %2157 = OpLoad %uint %x + %2158 = OpLoad %uint %v382 + %2159 = OpIAdd %uint %2157 %2158 + OpStore %x %2159 + %2160 = OpLoad %uint %x + %2161 = OpLoad %uint %v383 + %2162 = OpIAdd %uint %2160 %2161 + OpStore %x %2162 + %2163 = OpLoad %uint %x + %2164 = OpLoad %uint %v384 + %2165 = OpIAdd %uint %2163 %2164 + OpStore %x %2165 + %2166 = OpLoad %uint %x + %2167 = OpLoad %uint %v385 + %2168 = OpIAdd %uint %2166 %2167 + OpStore %x %2168 + %2169 = OpLoad %uint %x + %2170 = OpLoad %uint %v386 + %2171 = OpIAdd %uint %2169 %2170 + OpStore %x %2171 + %2172 = OpLoad %uint %x + %2173 = OpLoad %uint %v387 + %2174 = OpIAdd %uint %2172 %2173 + OpStore %x %2174 + %2175 = OpLoad %uint %x + %2176 = OpLoad %uint %v388 + %2177 = OpIAdd %uint %2175 %2176 + OpStore %x %2177 + %2178 = OpLoad %uint %x + %2179 = OpLoad %uint %v389 + %2180 = OpIAdd %uint %2178 %2179 + OpStore %x %2180 + %2181 = OpLoad %uint %x + %2182 = OpLoad %uint %v390 + %2183 = OpIAdd %uint %2181 %2182 + OpStore %x %2183 + %2184 = OpLoad %uint %x + %2185 = OpLoad %uint %v391 + %2186 = OpIAdd %uint %2184 %2185 + OpStore %x %2186 + %2187 = OpLoad %uint %x + %2188 = OpLoad %uint %v392 + %2189 = OpIAdd %uint %2187 %2188 + OpStore %x %2189 + %2190 = OpLoad %uint %x + %2191 = OpLoad %uint %v393 + %2192 = OpIAdd %uint %2190 %2191 + OpStore %x %2192 + %2193 = OpLoad %uint %x + %2194 = OpLoad %uint %v394 + %2195 = OpIAdd %uint %2193 %2194 + OpStore %x %2195 + %2196 = OpLoad %uint %x + %2197 = OpLoad %uint %v395 + %2198 = OpIAdd %uint %2196 %2197 + OpStore %x %2198 + %2199 = OpLoad %uint %x + %2200 = OpLoad %uint %v396 + %2201 = OpIAdd %uint %2199 %2200 + OpStore %x %2201 + %2202 = OpLoad %uint %x + %2203 = OpLoad %uint %v397 + %2204 = OpIAdd %uint %2202 %2203 + OpStore %x %2204 + %2205 = OpLoad %uint %x + %2206 = OpLoad %uint %v398 + %2207 = OpIAdd %uint %2205 %2206 + OpStore %x %2207 + %2208 = OpLoad %uint %x + %2209 = OpLoad %uint %v399 + %2210 = OpIAdd %uint %2208 %2209 + OpStore %x %2210 + %2211 = OpLoad %uint %x + %2212 = OpLoad %uint %v400 + %2213 = OpIAdd %uint %2211 %2212 + OpStore %x %2213 + %2214 = OpLoad %uint %x + %2215 = OpLoad %uint %v401 + %2216 = OpIAdd %uint %2214 %2215 + OpStore %x %2216 + %2217 = OpLoad %uint %x + %2218 = OpLoad %uint %v402 + %2219 = OpIAdd %uint %2217 %2218 + OpStore %x %2219 + %2220 = OpLoad %uint %x + %2221 = OpLoad %uint %v403 + %2222 = OpIAdd %uint %2220 %2221 + OpStore %x %2222 + %2223 = OpLoad %uint %x + %2224 = OpLoad %uint %v404 + %2225 = OpIAdd %uint %2223 %2224 + OpStore %x %2225 + %2226 = OpLoad %uint %x + %2227 = OpLoad %uint %v405 + %2228 = OpIAdd %uint %2226 %2227 + OpStore %x %2228 + %2229 = OpLoad %uint %x + %2230 = OpLoad %uint %v406 + %2231 = OpIAdd %uint %2229 %2230 + OpStore %x %2231 + %2232 = OpLoad %uint %x + %2233 = OpLoad %uint %v407 + %2234 = OpIAdd %uint %2232 %2233 + OpStore %x %2234 + %2235 = OpLoad %uint %x + %2236 = OpLoad %uint %v408 + %2237 = OpIAdd %uint %2235 %2236 + OpStore %x %2237 + %2238 = OpLoad %uint %x + %2239 = OpLoad %uint %v409 + %2240 = OpIAdd %uint %2238 %2239 + OpStore %x %2240 + %2241 = OpLoad %uint %x + %2242 = OpLoad %uint %v410 + %2243 = OpIAdd %uint %2241 %2242 + OpStore %x %2243 + %2244 = OpLoad %uint %x + %2245 = OpLoad %uint %v411 + %2246 = OpIAdd %uint %2244 %2245 + OpStore %x %2246 + %2247 = OpLoad %uint %x + %2248 = OpLoad %uint %v412 + %2249 = OpIAdd %uint %2247 %2248 + OpStore %x %2249 + %2250 = OpLoad %uint %x + %2251 = OpLoad %uint %v413 + %2252 = OpIAdd %uint %2250 %2251 + OpStore %x %2252 + %2253 = OpLoad %uint %x + %2254 = OpLoad %uint %v414 + %2255 = OpIAdd %uint %2253 %2254 + OpStore %x %2255 + %2256 = OpLoad %uint %x + %2257 = OpLoad %uint %v415 + %2258 = OpIAdd %uint %2256 %2257 + OpStore %x %2258 + %2259 = OpLoad %uint %x + %2260 = OpLoad %uint %v416 + %2261 = OpIAdd %uint %2259 %2260 + OpStore %x %2261 + %2262 = OpLoad %uint %x + %2263 = OpLoad %uint %v417 + %2264 = OpIAdd %uint %2262 %2263 + OpStore %x %2264 + %2265 = OpLoad %uint %x + %2266 = OpLoad %uint %v418 + %2267 = OpIAdd %uint %2265 %2266 + OpStore %x %2267 + %2268 = OpLoad %uint %x + %2269 = OpLoad %uint %v419 + %2270 = OpIAdd %uint %2268 %2269 + OpStore %x %2270 + %2271 = OpLoad %uint %x + %2272 = OpLoad %uint %v420 + %2273 = OpIAdd %uint %2271 %2272 + OpStore %x %2273 + %2274 = OpLoad %uint %x + %2275 = OpLoad %uint %v421 + %2276 = OpIAdd %uint %2274 %2275 + OpStore %x %2276 + %2277 = OpLoad %uint %x + %2278 = OpLoad %uint %v422 + %2279 = OpIAdd %uint %2277 %2278 + OpStore %x %2279 + %2280 = OpLoad %uint %x + %2281 = OpLoad %uint %v423 + %2282 = OpIAdd %uint %2280 %2281 + OpStore %x %2282 + %2283 = OpLoad %uint %x + %2284 = OpLoad %uint %v424 + %2285 = OpIAdd %uint %2283 %2284 + OpStore %x %2285 + %2286 = OpLoad %uint %x + %2287 = OpLoad %uint %v425 + %2288 = OpIAdd %uint %2286 %2287 + OpStore %x %2288 + %2289 = OpLoad %uint %x + %2290 = OpLoad %uint %v426 + %2291 = OpIAdd %uint %2289 %2290 + OpStore %x %2291 + %2292 = OpLoad %uint %x + %2293 = OpLoad %uint %v427 + %2294 = OpIAdd %uint %2292 %2293 + OpStore %x %2294 + %2295 = OpLoad %uint %x + %2296 = OpLoad %uint %v428 + %2297 = OpIAdd %uint %2295 %2296 + OpStore %x %2297 + %2298 = OpLoad %uint %x + %2299 = OpLoad %uint %v429 + %2300 = OpIAdd %uint %2298 %2299 + OpStore %x %2300 + %2301 = OpLoad %uint %x + %2302 = OpLoad %uint %v430 + %2303 = OpIAdd %uint %2301 %2302 + OpStore %x %2303 + %2304 = OpLoad %uint %x + %2305 = OpLoad %uint %v431 + %2306 = OpIAdd %uint %2304 %2305 + OpStore %x %2306 + %2307 = OpLoad %uint %x + %2308 = OpLoad %uint %v432 + %2309 = OpIAdd %uint %2307 %2308 + OpStore %x %2309 + %2310 = OpLoad %uint %x + %2311 = OpLoad %uint %v433 + %2312 = OpIAdd %uint %2310 %2311 + OpStore %x %2312 + %2313 = OpLoad %uint %x + %2314 = OpLoad %uint %v434 + %2315 = OpIAdd %uint %2313 %2314 + OpStore %x %2315 + %2316 = OpLoad %uint %x + %2317 = OpLoad %uint %v435 + %2318 = OpIAdd %uint %2316 %2317 + OpStore %x %2318 + %2319 = OpLoad %uint %x + %2320 = OpLoad %uint %v436 + %2321 = OpIAdd %uint %2319 %2320 + OpStore %x %2321 + %2322 = OpLoad %uint %x + %2323 = OpLoad %uint %v437 + %2324 = OpIAdd %uint %2322 %2323 + OpStore %x %2324 + %2325 = OpLoad %uint %x + %2326 = OpLoad %uint %v438 + %2327 = OpIAdd %uint %2325 %2326 + OpStore %x %2327 + %2328 = OpLoad %uint %x + %2329 = OpLoad %uint %v439 + %2330 = OpIAdd %uint %2328 %2329 + OpStore %x %2330 + %2331 = OpLoad %uint %x + %2332 = OpLoad %uint %v440 + %2333 = OpIAdd %uint %2331 %2332 + OpStore %x %2333 + %2334 = OpLoad %uint %x + %2335 = OpLoad %uint %v441 + %2336 = OpIAdd %uint %2334 %2335 + OpStore %x %2336 + %2337 = OpLoad %uint %x + %2338 = OpLoad %uint %v442 + %2339 = OpIAdd %uint %2337 %2338 + OpStore %x %2339 + %2340 = OpLoad %uint %x + %2341 = OpLoad %uint %v443 + %2342 = OpIAdd %uint %2340 %2341 + OpStore %x %2342 + %2343 = OpLoad %uint %x + %2344 = OpLoad %uint %v444 + %2345 = OpIAdd %uint %2343 %2344 + OpStore %x %2345 + %2346 = OpLoad %uint %x + %2347 = OpLoad %uint %v445 + %2348 = OpIAdd %uint %2346 %2347 + OpStore %x %2348 + %2349 = OpLoad %uint %x + %2350 = OpLoad %uint %v446 + %2351 = OpIAdd %uint %2349 %2350 + OpStore %x %2351 + %2352 = OpLoad %uint %x + %2353 = OpLoad %uint %v447 + %2354 = OpIAdd %uint %2352 %2353 + OpStore %x %2354 + %2355 = OpLoad %uint %x + %2356 = OpLoad %uint %v448 + %2357 = OpIAdd %uint %2355 %2356 + OpStore %x %2357 + %2358 = OpLoad %uint %x + %2359 = OpLoad %uint %v449 + %2360 = OpIAdd %uint %2358 %2359 + OpStore %x %2360 + %2361 = OpLoad %uint %x + %2362 = OpLoad %uint %v450 + %2363 = OpIAdd %uint %2361 %2362 + OpStore %x %2363 + %2364 = OpLoad %uint %x + %2365 = OpLoad %uint %v451 + %2366 = OpIAdd %uint %2364 %2365 + OpStore %x %2366 + %2367 = OpLoad %uint %x + %2368 = OpLoad %uint %v452 + %2369 = OpIAdd %uint %2367 %2368 + OpStore %x %2369 + %2370 = OpLoad %uint %x + %2371 = OpLoad %uint %v453 + %2372 = OpIAdd %uint %2370 %2371 + OpStore %x %2372 + %2373 = OpLoad %uint %x + %2374 = OpLoad %uint %v454 + %2375 = OpIAdd %uint %2373 %2374 + OpStore %x %2375 + %2376 = OpLoad %uint %x + %2377 = OpLoad %uint %v455 + %2378 = OpIAdd %uint %2376 %2377 + OpStore %x %2378 + %2379 = OpLoad %uint %x + %2380 = OpLoad %uint %v456 + %2381 = OpIAdd %uint %2379 %2380 + OpStore %x %2381 + %2382 = OpLoad %uint %x + %2383 = OpLoad %uint %v457 + %2384 = OpIAdd %uint %2382 %2383 + OpStore %x %2384 + %2385 = OpLoad %uint %x + %2386 = OpLoad %uint %v458 + %2387 = OpIAdd %uint %2385 %2386 + OpStore %x %2387 + %2388 = OpLoad %uint %x + %2389 = OpLoad %uint %v459 + %2390 = OpIAdd %uint %2388 %2389 + OpStore %x %2390 + %2391 = OpLoad %uint %x + %2392 = OpLoad %uint %v460 + %2393 = OpIAdd %uint %2391 %2392 + OpStore %x %2393 + %2394 = OpLoad %uint %x + %2395 = OpLoad %uint %v461 + %2396 = OpIAdd %uint %2394 %2395 + OpStore %x %2396 + %2397 = OpLoad %uint %x + %2398 = OpLoad %uint %v462 + %2399 = OpIAdd %uint %2397 %2398 + OpStore %x %2399 + %2400 = OpLoad %uint %x + %2401 = OpLoad %uint %v463 + %2402 = OpIAdd %uint %2400 %2401 + OpStore %x %2402 + %2403 = OpLoad %uint %x + %2404 = OpLoad %uint %v464 + %2405 = OpIAdd %uint %2403 %2404 + OpStore %x %2405 + %2406 = OpLoad %uint %x + %2407 = OpLoad %uint %v465 + %2408 = OpIAdd %uint %2406 %2407 + OpStore %x %2408 + %2409 = OpLoad %uint %x + %2410 = OpLoad %uint %v466 + %2411 = OpIAdd %uint %2409 %2410 + OpStore %x %2411 + %2412 = OpLoad %uint %x + %2413 = OpLoad %uint %v467 + %2414 = OpIAdd %uint %2412 %2413 + OpStore %x %2414 + %2415 = OpLoad %uint %x + %2416 = OpLoad %uint %v468 + %2417 = OpIAdd %uint %2415 %2416 + OpStore %x %2417 + %2418 = OpLoad %uint %x + %2419 = OpLoad %uint %v469 + %2420 = OpIAdd %uint %2418 %2419 + OpStore %x %2420 + %2421 = OpLoad %uint %x + %2422 = OpLoad %uint %v470 + %2423 = OpIAdd %uint %2421 %2422 + OpStore %x %2423 + %2424 = OpLoad %uint %x + %2425 = OpLoad %uint %v471 + %2426 = OpIAdd %uint %2424 %2425 + OpStore %x %2426 + %2427 = OpLoad %uint %x + %2428 = OpLoad %uint %v472 + %2429 = OpIAdd %uint %2427 %2428 + OpStore %x %2429 + %2430 = OpLoad %uint %x + %2431 = OpLoad %uint %v473 + %2432 = OpIAdd %uint %2430 %2431 + OpStore %x %2432 + %2433 = OpLoad %uint %x + %2434 = OpLoad %uint %v474 + %2435 = OpIAdd %uint %2433 %2434 + OpStore %x %2435 + %2436 = OpLoad %uint %x + %2437 = OpLoad %uint %v475 + %2438 = OpIAdd %uint %2436 %2437 + OpStore %x %2438 + %2439 = OpLoad %uint %x + %2440 = OpLoad %uint %v476 + %2441 = OpIAdd %uint %2439 %2440 + OpStore %x %2441 + %2442 = OpLoad %uint %x + %2443 = OpLoad %uint %v477 + %2444 = OpIAdd %uint %2442 %2443 + OpStore %x %2444 + %2445 = OpLoad %uint %x + %2446 = OpLoad %uint %v478 + %2447 = OpIAdd %uint %2445 %2446 + OpStore %x %2447 + %2448 = OpLoad %uint %x + %2449 = OpLoad %uint %v479 + %2450 = OpIAdd %uint %2448 %2449 + OpStore %x %2450 + %2451 = OpLoad %uint %x + %2452 = OpLoad %uint %v480 + %2453 = OpIAdd %uint %2451 %2452 + OpStore %x %2453 + %2454 = OpLoad %uint %x + %2455 = OpLoad %uint %v481 + %2456 = OpIAdd %uint %2454 %2455 + OpStore %x %2456 + %2457 = OpLoad %uint %x + %2458 = OpLoad %uint %v482 + %2459 = OpIAdd %uint %2457 %2458 + OpStore %x %2459 + %2460 = OpLoad %uint %x + %2461 = OpLoad %uint %v483 + %2462 = OpIAdd %uint %2460 %2461 + OpStore %x %2462 + %2463 = OpLoad %uint %x + %2464 = OpLoad %uint %v484 + %2465 = OpIAdd %uint %2463 %2464 + OpStore %x %2465 + %2466 = OpLoad %uint %x + %2467 = OpLoad %uint %v485 + %2468 = OpIAdd %uint %2466 %2467 + OpStore %x %2468 + %2469 = OpLoad %uint %x + %2470 = OpLoad %uint %v486 + %2471 = OpIAdd %uint %2469 %2470 + OpStore %x %2471 + %2472 = OpLoad %uint %x + %2473 = OpLoad %uint %v487 + %2474 = OpIAdd %uint %2472 %2473 + OpStore %x %2474 + %2475 = OpLoad %uint %x + %2476 = OpLoad %uint %v488 + %2477 = OpIAdd %uint %2475 %2476 + OpStore %x %2477 + %2478 = OpLoad %uint %x + %2479 = OpLoad %uint %v489 + %2480 = OpIAdd %uint %2478 %2479 + OpStore %x %2480 + %2481 = OpLoad %uint %x + %2482 = OpLoad %uint %v490 + %2483 = OpIAdd %uint %2481 %2482 + OpStore %x %2483 + %2484 = OpLoad %uint %x + %2485 = OpLoad %uint %v491 + %2486 = OpIAdd %uint %2484 %2485 + OpStore %x %2486 + %2487 = OpLoad %uint %x + %2488 = OpLoad %uint %v492 + %2489 = OpIAdd %uint %2487 %2488 + OpStore %x %2489 + %2490 = OpLoad %uint %x + %2491 = OpLoad %uint %v493 + %2492 = OpIAdd %uint %2490 %2491 + OpStore %x %2492 + %2493 = OpLoad %uint %x + %2494 = OpLoad %uint %v494 + %2495 = OpIAdd %uint %2493 %2494 + OpStore %x %2495 + %2496 = OpLoad %uint %x + %2497 = OpLoad %uint %v495 + %2498 = OpIAdd %uint %2496 %2497 + OpStore %x %2498 + %2499 = OpLoad %uint %x + %2500 = OpLoad %uint %v496 + %2501 = OpIAdd %uint %2499 %2500 + OpStore %x %2501 + %2502 = OpLoad %uint %x + %2503 = OpLoad %uint %v497 + %2504 = OpIAdd %uint %2502 %2503 + OpStore %x %2504 + %2505 = OpLoad %uint %x + %2506 = OpLoad %uint %v498 + %2507 = OpIAdd %uint %2505 %2506 + OpStore %x %2507 + %2508 = OpLoad %uint %x + %2509 = OpLoad %uint %v499 + %2510 = OpIAdd %uint %2508 %2509 + OpStore %x %2510 + %2511 = OpLoad %uint %x + %2512 = OpLoad %uint %v500 + %2513 = OpIAdd %uint %2511 %2512 + OpStore %x %2513 + %2514 = OpLoad %uint %x + %2515 = OpLoad %uint %v501 + %2516 = OpIAdd %uint %2514 %2515 + OpStore %x %2516 + %2517 = OpLoad %uint %x + %2518 = OpLoad %uint %v502 + %2519 = OpIAdd %uint %2517 %2518 + OpStore %x %2519 + %2520 = OpLoad %uint %x + %2521 = OpLoad %uint %v503 + %2522 = OpIAdd %uint %2520 %2521 + OpStore %x %2522 + %2523 = OpLoad %uint %x + %2524 = OpLoad %uint %v504 + %2525 = OpIAdd %uint %2523 %2524 + OpStore %x %2525 + %2526 = OpLoad %uint %x + %2527 = OpLoad %uint %v505 + %2528 = OpIAdd %uint %2526 %2527 + OpStore %x %2528 + %2529 = OpLoad %uint %x + %2530 = OpLoad %uint %v506 + %2531 = OpIAdd %uint %2529 %2530 + OpStore %x %2531 + %2532 = OpLoad %uint %x + %2533 = OpLoad %uint %v507 + %2534 = OpIAdd %uint %2532 %2533 + OpStore %x %2534 + %2535 = OpLoad %uint %x + %2536 = OpLoad %uint %v508 + %2537 = OpIAdd %uint %2535 %2536 + OpStore %x %2537 + %2538 = OpLoad %uint %x + %2539 = OpLoad %uint %v509 + %2540 = OpIAdd %uint %2538 %2539 + OpStore %x %2540 + %2541 = OpLoad %uint %x + %2542 = OpLoad %uint %v510 + %2543 = OpIAdd %uint %2541 %2542 + OpStore %x %2543 + %2544 = OpLoad %uint %x + %2545 = OpLoad %uint %v511 + %2546 = OpIAdd %uint %2544 %2545 + OpStore %x %2546 + %2547 = OpLoad %uint %x + %2548 = OpLoad %uint %v512 + %2549 = OpIAdd %uint %2547 %2548 + OpStore %x %2549 + %2550 = OpLoad %uint %x + %2551 = OpLoad %uint %v513 + %2552 = OpIAdd %uint %2550 %2551 + OpStore %x %2552 + %2553 = OpLoad %uint %x + %2554 = OpLoad %uint %v514 + %2555 = OpIAdd %uint %2553 %2554 + OpStore %x %2555 + %2556 = OpLoad %uint %x + %2557 = OpLoad %uint %v515 + %2558 = OpIAdd %uint %2556 %2557 + OpStore %x %2558 + %2559 = OpLoad %uint %x + %2560 = OpLoad %uint %v516 + %2561 = OpIAdd %uint %2559 %2560 + OpStore %x %2561 + %2562 = OpLoad %uint %x + %2563 = OpLoad %uint %v517 + %2564 = OpIAdd %uint %2562 %2563 + OpStore %x %2564 + %2565 = OpLoad %uint %x + %2566 = OpLoad %uint %v518 + %2567 = OpIAdd %uint %2565 %2566 + OpStore %x %2567 + %2568 = OpLoad %uint %x + %2569 = OpLoad %uint %v519 + %2570 = OpIAdd %uint %2568 %2569 + OpStore %x %2570 + %2571 = OpLoad %uint %x + %2572 = OpLoad %uint %v520 + %2573 = OpIAdd %uint %2571 %2572 + OpStore %x %2573 + %2574 = OpLoad %uint %x + %2575 = OpLoad %uint %v521 + %2576 = OpIAdd %uint %2574 %2575 + OpStore %x %2576 + %2577 = OpLoad %uint %x + %2578 = OpLoad %uint %v522 + %2579 = OpIAdd %uint %2577 %2578 + OpStore %x %2579 + %2580 = OpLoad %uint %x + %2581 = OpLoad %uint %v523 + %2582 = OpIAdd %uint %2580 %2581 + OpStore %x %2582 + %2583 = OpLoad %uint %x + %2584 = OpLoad %uint %v524 + %2585 = OpIAdd %uint %2583 %2584 + OpStore %x %2585 + %2586 = OpLoad %uint %x + %2587 = OpLoad %uint %v525 + %2588 = OpIAdd %uint %2586 %2587 + OpStore %x %2588 + %2589 = OpLoad %uint %x + %2590 = OpLoad %uint %v526 + %2591 = OpIAdd %uint %2589 %2590 + OpStore %x %2591 + %2592 = OpLoad %uint %x + %2593 = OpLoad %uint %v527 + %2594 = OpIAdd %uint %2592 %2593 + OpStore %x %2594 + %2595 = OpLoad %uint %x + %2596 = OpLoad %uint %v528 + %2597 = OpIAdd %uint %2595 %2596 + OpStore %x %2597 + %2598 = OpLoad %uint %x + %2599 = OpLoad %uint %v529 + %2600 = OpIAdd %uint %2598 %2599 + OpStore %x %2600 + %2601 = OpLoad %uint %x + %2602 = OpLoad %uint %v530 + %2603 = OpIAdd %uint %2601 %2602 + OpStore %x %2603 + %2604 = OpLoad %uint %x + %2605 = OpLoad %uint %v531 + %2606 = OpIAdd %uint %2604 %2605 + OpStore %x %2606 + %2607 = OpLoad %uint %x + %2608 = OpLoad %uint %v532 + %2609 = OpIAdd %uint %2607 %2608 + OpStore %x %2609 + %2610 = OpLoad %uint %x + %2611 = OpLoad %uint %v533 + %2612 = OpIAdd %uint %2610 %2611 + OpStore %x %2612 + %2613 = OpLoad %uint %x + %2614 = OpLoad %uint %v534 + %2615 = OpIAdd %uint %2613 %2614 + OpStore %x %2615 + %2616 = OpLoad %uint %x + %2617 = OpLoad %uint %v535 + %2618 = OpIAdd %uint %2616 %2617 + OpStore %x %2618 + %2619 = OpLoad %uint %x + %2620 = OpLoad %uint %v536 + %2621 = OpIAdd %uint %2619 %2620 + OpStore %x %2621 + %2622 = OpLoad %uint %x + %2623 = OpLoad %uint %v537 + %2624 = OpIAdd %uint %2622 %2623 + OpStore %x %2624 + %2625 = OpLoad %uint %x + %2626 = OpLoad %uint %v538 + %2627 = OpIAdd %uint %2625 %2626 + OpStore %x %2627 + %2628 = OpLoad %uint %x + %2629 = OpLoad %uint %v539 + %2630 = OpIAdd %uint %2628 %2629 + OpStore %x %2630 + %2631 = OpLoad %uint %x + %2632 = OpLoad %uint %v540 + %2633 = OpIAdd %uint %2631 %2632 + OpStore %x %2633 + %2634 = OpLoad %uint %x + %2635 = OpLoad %uint %v541 + %2636 = OpIAdd %uint %2634 %2635 + OpStore %x %2636 + %2637 = OpLoad %uint %x + %2638 = OpLoad %uint %v542 + %2639 = OpIAdd %uint %2637 %2638 + OpStore %x %2639 + %2640 = OpLoad %uint %x + %2641 = OpLoad %uint %v543 + %2642 = OpIAdd %uint %2640 %2641 + OpStore %x %2642 + %2643 = OpLoad %uint %x + %2644 = OpLoad %uint %v544 + %2645 = OpIAdd %uint %2643 %2644 + OpStore %x %2645 + %2646 = OpLoad %uint %x + %2647 = OpLoad %uint %v545 + %2648 = OpIAdd %uint %2646 %2647 + OpStore %x %2648 + %2649 = OpLoad %uint %x + %2650 = OpLoad %uint %v546 + %2651 = OpIAdd %uint %2649 %2650 + OpStore %x %2651 + %2652 = OpLoad %uint %x + %2653 = OpLoad %uint %v547 + %2654 = OpIAdd %uint %2652 %2653 + OpStore %x %2654 + %2655 = OpLoad %uint %x + %2656 = OpLoad %uint %v548 + %2657 = OpIAdd %uint %2655 %2656 + OpStore %x %2657 + %2658 = OpLoad %uint %x + %2659 = OpLoad %uint %v549 + %2660 = OpIAdd %uint %2658 %2659 + OpStore %x %2660 + %2661 = OpLoad %uint %x + %2662 = OpLoad %uint %v550 + %2663 = OpIAdd %uint %2661 %2662 + OpStore %x %2663 + %2664 = OpLoad %uint %x + %2665 = OpLoad %uint %v551 + %2666 = OpIAdd %uint %2664 %2665 + OpStore %x %2666 + %2667 = OpLoad %uint %x + %2668 = OpLoad %uint %v552 + %2669 = OpIAdd %uint %2667 %2668 + OpStore %x %2669 + %2670 = OpLoad %uint %x + %2671 = OpLoad %uint %v553 + %2672 = OpIAdd %uint %2670 %2671 + OpStore %x %2672 + %2673 = OpLoad %uint %x + %2674 = OpLoad %uint %v554 + %2675 = OpIAdd %uint %2673 %2674 + OpStore %x %2675 + %2676 = OpLoad %uint %x + %2677 = OpLoad %uint %v555 + %2678 = OpIAdd %uint %2676 %2677 + OpStore %x %2678 + %2679 = OpLoad %uint %x + %2680 = OpLoad %uint %v556 + %2681 = OpIAdd %uint %2679 %2680 + OpStore %x %2681 + %2682 = OpLoad %uint %x + %2683 = OpLoad %uint %v557 + %2684 = OpIAdd %uint %2682 %2683 + OpStore %x %2684 + %2685 = OpLoad %uint %x + %2686 = OpLoad %uint %v558 + %2687 = OpIAdd %uint %2685 %2686 + OpStore %x %2687 + %2688 = OpLoad %uint %x + %2689 = OpLoad %uint %v559 + %2690 = OpIAdd %uint %2688 %2689 + OpStore %x %2690 + %2691 = OpLoad %uint %x + %2692 = OpLoad %uint %v560 + %2693 = OpIAdd %uint %2691 %2692 + OpStore %x %2693 + %2694 = OpLoad %uint %x + %2695 = OpLoad %uint %v561 + %2696 = OpIAdd %uint %2694 %2695 + OpStore %x %2696 + %2697 = OpLoad %uint %x + %2698 = OpLoad %uint %v562 + %2699 = OpIAdd %uint %2697 %2698 + OpStore %x %2699 + %2700 = OpLoad %uint %x + %2701 = OpLoad %uint %v563 + %2702 = OpIAdd %uint %2700 %2701 + OpStore %x %2702 + %2703 = OpLoad %uint %x + %2704 = OpLoad %uint %v564 + %2705 = OpIAdd %uint %2703 %2704 + OpStore %x %2705 + %2706 = OpLoad %uint %x + %2707 = OpLoad %uint %v565 + %2708 = OpIAdd %uint %2706 %2707 + OpStore %x %2708 + %2709 = OpLoad %uint %x + %2710 = OpLoad %uint %v566 + %2711 = OpIAdd %uint %2709 %2710 + OpStore %x %2711 + %2712 = OpLoad %uint %x + %2713 = OpLoad %uint %v567 + %2714 = OpIAdd %uint %2712 %2713 + OpStore %x %2714 + %2715 = OpLoad %uint %x + %2716 = OpLoad %uint %v568 + %2717 = OpIAdd %uint %2715 %2716 + OpStore %x %2717 + %2718 = OpLoad %uint %x + %2719 = OpLoad %uint %v569 + %2720 = OpIAdd %uint %2718 %2719 + OpStore %x %2720 + %2721 = OpLoad %uint %x + %2722 = OpLoad %uint %v570 + %2723 = OpIAdd %uint %2721 %2722 + OpStore %x %2723 + %2724 = OpLoad %uint %x + %2725 = OpLoad %uint %v571 + %2726 = OpIAdd %uint %2724 %2725 + OpStore %x %2726 + %2727 = OpLoad %uint %x + %2728 = OpLoad %uint %v572 + %2729 = OpIAdd %uint %2727 %2728 + OpStore %x %2729 + %2730 = OpLoad %uint %x + %2731 = OpLoad %uint %v573 + %2732 = OpIAdd %uint %2730 %2731 + OpStore %x %2732 + %2733 = OpLoad %uint %x + %2734 = OpLoad %uint %v574 + %2735 = OpIAdd %uint %2733 %2734 + OpStore %x %2735 + %2736 = OpLoad %uint %x + %2737 = OpLoad %uint %v575 + %2738 = OpIAdd %uint %2736 %2737 + OpStore %x %2738 + %2739 = OpLoad %uint %x + %2740 = OpLoad %uint %v576 + %2741 = OpIAdd %uint %2739 %2740 + OpStore %x %2741 + %2742 = OpLoad %uint %x + %2743 = OpLoad %uint %v577 + %2744 = OpIAdd %uint %2742 %2743 + OpStore %x %2744 + %2745 = OpLoad %uint %x + %2746 = OpLoad %uint %v578 + %2747 = OpIAdd %uint %2745 %2746 + OpStore %x %2747 + %2748 = OpLoad %uint %x + %2749 = OpLoad %uint %v579 + %2750 = OpIAdd %uint %2748 %2749 + OpStore %x %2750 + %2751 = OpLoad %uint %x + %2752 = OpLoad %uint %v580 + %2753 = OpIAdd %uint %2751 %2752 + OpStore %x %2753 + %2754 = OpLoad %uint %x + %2755 = OpLoad %uint %v581 + %2756 = OpIAdd %uint %2754 %2755 + OpStore %x %2756 + %2757 = OpLoad %uint %x + %2758 = OpLoad %uint %v582 + %2759 = OpIAdd %uint %2757 %2758 + OpStore %x %2759 + %2760 = OpLoad %uint %x + %2761 = OpLoad %uint %v583 + %2762 = OpIAdd %uint %2760 %2761 + OpStore %x %2762 + %2763 = OpLoad %uint %x + %2764 = OpLoad %uint %v584 + %2765 = OpIAdd %uint %2763 %2764 + OpStore %x %2765 + %2766 = OpLoad %uint %x + %2767 = OpLoad %uint %v585 + %2768 = OpIAdd %uint %2766 %2767 + OpStore %x %2768 + %2769 = OpLoad %uint %x + %2770 = OpLoad %uint %v586 + %2771 = OpIAdd %uint %2769 %2770 + OpStore %x %2771 + %2772 = OpLoad %uint %x + %2773 = OpLoad %uint %v587 + %2774 = OpIAdd %uint %2772 %2773 + OpStore %x %2774 + %2775 = OpLoad %uint %x + %2776 = OpLoad %uint %v588 + %2777 = OpIAdd %uint %2775 %2776 + OpStore %x %2777 + %2778 = OpLoad %uint %x + %2779 = OpLoad %uint %v589 + %2780 = OpIAdd %uint %2778 %2779 + OpStore %x %2780 + %2781 = OpLoad %uint %x + %2782 = OpLoad %uint %v590 + %2783 = OpIAdd %uint %2781 %2782 + OpStore %x %2783 + %2784 = OpLoad %uint %x + %2785 = OpLoad %uint %v591 + %2786 = OpIAdd %uint %2784 %2785 + OpStore %x %2786 + %2787 = OpLoad %uint %x + %2788 = OpLoad %uint %v592 + %2789 = OpIAdd %uint %2787 %2788 + OpStore %x %2789 + %2790 = OpLoad %uint %x + %2791 = OpLoad %uint %v593 + %2792 = OpIAdd %uint %2790 %2791 + OpStore %x %2792 + %2793 = OpLoad %uint %x + %2794 = OpLoad %uint %v594 + %2795 = OpIAdd %uint %2793 %2794 + OpStore %x %2795 + %2796 = OpLoad %uint %x + %2797 = OpLoad %uint %v595 + %2798 = OpIAdd %uint %2796 %2797 + OpStore %x %2798 + %2799 = OpLoad %uint %x + %2800 = OpLoad %uint %v596 + %2801 = OpIAdd %uint %2799 %2800 + OpStore %x %2801 + %2802 = OpLoad %uint %x + %2803 = OpLoad %uint %v597 + %2804 = OpIAdd %uint %2802 %2803 + OpStore %x %2804 + %2805 = OpLoad %uint %x + %2806 = OpLoad %uint %v598 + %2807 = OpIAdd %uint %2805 %2806 + OpStore %x %2807 + %2808 = OpLoad %uint %x + %2809 = OpLoad %uint %v599 + %2810 = OpIAdd %uint %2808 %2809 + OpStore %x %2810 + %2811 = OpLoad %uint %x + %2812 = OpLoad %uint %v600 + %2813 = OpIAdd %uint %2811 %2812 + OpStore %x %2813 + %2814 = OpLoad %uint %x + %2815 = OpLoad %uint %v601 + %2816 = OpIAdd %uint %2814 %2815 + OpStore %x %2816 + %2817 = OpLoad %uint %x + %2818 = OpLoad %uint %v602 + %2819 = OpIAdd %uint %2817 %2818 + OpStore %x %2819 + %2820 = OpLoad %uint %x + %2821 = OpLoad %uint %v603 + %2822 = OpIAdd %uint %2820 %2821 + OpStore %x %2822 + %2823 = OpLoad %uint %x + %2824 = OpLoad %uint %v604 + %2825 = OpIAdd %uint %2823 %2824 + OpStore %x %2825 + %2826 = OpLoad %uint %x + %2827 = OpLoad %uint %v605 + %2828 = OpIAdd %uint %2826 %2827 + OpStore %x %2828 + %2829 = OpLoad %uint %x + %2830 = OpLoad %uint %v606 + %2831 = OpIAdd %uint %2829 %2830 + OpStore %x %2831 + %2832 = OpLoad %uint %x + %2833 = OpLoad %uint %v607 + %2834 = OpIAdd %uint %2832 %2833 + OpStore %x %2834 + %2835 = OpLoad %uint %x + %2836 = OpLoad %uint %v608 + %2837 = OpIAdd %uint %2835 %2836 + OpStore %x %2837 + %2838 = OpLoad %uint %x + %2839 = OpLoad %uint %v609 + %2840 = OpIAdd %uint %2838 %2839 + OpStore %x %2840 + %2841 = OpLoad %uint %x + %2842 = OpLoad %uint %v610 + %2843 = OpIAdd %uint %2841 %2842 + OpStore %x %2843 + %2844 = OpLoad %uint %x + %2845 = OpLoad %uint %v611 + %2846 = OpIAdd %uint %2844 %2845 + OpStore %x %2846 + %2847 = OpLoad %uint %x + %2848 = OpLoad %uint %v612 + %2849 = OpIAdd %uint %2847 %2848 + OpStore %x %2849 + %2850 = OpLoad %uint %x + %2851 = OpLoad %uint %v613 + %2852 = OpIAdd %uint %2850 %2851 + OpStore %x %2852 + %2853 = OpLoad %uint %x + %2854 = OpLoad %uint %v614 + %2855 = OpIAdd %uint %2853 %2854 + OpStore %x %2855 + %2856 = OpLoad %uint %x + %2857 = OpLoad %uint %v615 + %2858 = OpIAdd %uint %2856 %2857 + OpStore %x %2858 + %2859 = OpLoad %uint %x + %2860 = OpLoad %uint %v616 + %2861 = OpIAdd %uint %2859 %2860 + OpStore %x %2861 + %2862 = OpLoad %uint %x + %2863 = OpLoad %uint %v617 + %2864 = OpIAdd %uint %2862 %2863 + OpStore %x %2864 + %2865 = OpLoad %uint %x + %2866 = OpLoad %uint %v618 + %2867 = OpIAdd %uint %2865 %2866 + OpStore %x %2867 + %2868 = OpLoad %uint %x + %2869 = OpLoad %uint %v619 + %2870 = OpIAdd %uint %2868 %2869 + OpStore %x %2870 + %2871 = OpLoad %uint %x + %2872 = OpLoad %uint %v620 + %2873 = OpIAdd %uint %2871 %2872 + OpStore %x %2873 + %2874 = OpLoad %uint %x + %2875 = OpLoad %uint %v621 + %2876 = OpIAdd %uint %2874 %2875 + OpStore %x %2876 + %2877 = OpLoad %uint %x + %2878 = OpLoad %uint %v622 + %2879 = OpIAdd %uint %2877 %2878 + OpStore %x %2879 + %2880 = OpLoad %uint %x + %2881 = OpLoad %uint %v623 + %2882 = OpIAdd %uint %2880 %2881 + OpStore %x %2882 + %2883 = OpLoad %uint %x + %2884 = OpLoad %uint %v624 + %2885 = OpIAdd %uint %2883 %2884 + OpStore %x %2885 + %2886 = OpLoad %uint %x + %2887 = OpLoad %uint %v625 + %2888 = OpIAdd %uint %2886 %2887 + OpStore %x %2888 + %2889 = OpLoad %uint %x + %2890 = OpLoad %uint %v626 + %2891 = OpIAdd %uint %2889 %2890 + OpStore %x %2891 + %2892 = OpLoad %uint %x + %2893 = OpLoad %uint %v627 + %2894 = OpIAdd %uint %2892 %2893 + OpStore %x %2894 + %2895 = OpLoad %uint %x + %2896 = OpLoad %uint %v628 + %2897 = OpIAdd %uint %2895 %2896 + OpStore %x %2897 + %2898 = OpLoad %uint %x + %2899 = OpLoad %uint %v629 + %2900 = OpIAdd %uint %2898 %2899 + OpStore %x %2900 + %2901 = OpLoad %uint %x + %2902 = OpLoad %uint %v630 + %2903 = OpIAdd %uint %2901 %2902 + OpStore %x %2903 + %2904 = OpLoad %uint %x + %2905 = OpLoad %uint %v631 + %2906 = OpIAdd %uint %2904 %2905 + OpStore %x %2906 + %2907 = OpLoad %uint %x + %2908 = OpLoad %uint %v632 + %2909 = OpIAdd %uint %2907 %2908 + OpStore %x %2909 + %2910 = OpLoad %uint %x + %2911 = OpLoad %uint %v633 + %2912 = OpIAdd %uint %2910 %2911 + OpStore %x %2912 + %2913 = OpLoad %uint %x + %2914 = OpLoad %uint %v634 + %2915 = OpIAdd %uint %2913 %2914 + OpStore %x %2915 + %2916 = OpLoad %uint %x + %2917 = OpLoad %uint %v635 + %2918 = OpIAdd %uint %2916 %2917 + OpStore %x %2918 + %2919 = OpLoad %uint %x + %2920 = OpLoad %uint %v636 + %2921 = OpIAdd %uint %2919 %2920 + OpStore %x %2921 + %2922 = OpLoad %uint %x + %2923 = OpLoad %uint %v637 + %2924 = OpIAdd %uint %2922 %2923 + OpStore %x %2924 + %2925 = OpLoad %uint %x + %2926 = OpLoad %uint %v638 + %2927 = OpIAdd %uint %2925 %2926 + OpStore %x %2927 + %2928 = OpLoad %uint %x + %2929 = OpLoad %uint %v639 + %2930 = OpIAdd %uint %2928 %2929 + OpStore %x %2930 + %2931 = OpLoad %uint %x + %2932 = OpLoad %uint %v640 + %2933 = OpIAdd %uint %2931 %2932 + OpStore %x %2933 + %2934 = OpLoad %uint %x + %2935 = OpLoad %uint %v641 + %2936 = OpIAdd %uint %2934 %2935 + OpStore %x %2936 + %2937 = OpLoad %uint %x + %2938 = OpLoad %uint %v642 + %2939 = OpIAdd %uint %2937 %2938 + OpStore %x %2939 + %2940 = OpLoad %uint %x + %2941 = OpLoad %uint %v643 + %2942 = OpIAdd %uint %2940 %2941 + OpStore %x %2942 + %2943 = OpLoad %uint %x + %2944 = OpLoad %uint %v644 + %2945 = OpIAdd %uint %2943 %2944 + OpStore %x %2945 + %2946 = OpLoad %uint %x + %2947 = OpLoad %uint %v645 + %2948 = OpIAdd %uint %2946 %2947 + OpStore %x %2948 + %2949 = OpLoad %uint %x + %2950 = OpLoad %uint %v646 + %2951 = OpIAdd %uint %2949 %2950 + OpStore %x %2951 + %2952 = OpLoad %uint %x + %2953 = OpLoad %uint %v647 + %2954 = OpIAdd %uint %2952 %2953 + OpStore %x %2954 + %2955 = OpLoad %uint %x + %2956 = OpLoad %uint %v648 + %2957 = OpIAdd %uint %2955 %2956 + OpStore %x %2957 + %2958 = OpLoad %uint %x + %2959 = OpLoad %uint %v649 + %2960 = OpIAdd %uint %2958 %2959 + OpStore %x %2960 + %2961 = OpLoad %uint %x + %2962 = OpLoad %uint %v650 + %2963 = OpIAdd %uint %2961 %2962 + OpStore %x %2963 + %2964 = OpLoad %uint %x + %2965 = OpLoad %uint %v651 + %2966 = OpIAdd %uint %2964 %2965 + OpStore %x %2966 + %2967 = OpLoad %uint %x + %2968 = OpLoad %uint %v652 + %2969 = OpIAdd %uint %2967 %2968 + OpStore %x %2969 + %2970 = OpLoad %uint %x + %2971 = OpLoad %uint %v653 + %2972 = OpIAdd %uint %2970 %2971 + OpStore %x %2972 + %2973 = OpLoad %uint %x + %2974 = OpLoad %uint %v654 + %2975 = OpIAdd %uint %2973 %2974 + OpStore %x %2975 + %2976 = OpLoad %uint %x + %2977 = OpLoad %uint %v655 + %2978 = OpIAdd %uint %2976 %2977 + OpStore %x %2978 + %2979 = OpLoad %uint %x + %2980 = OpLoad %uint %v656 + %2981 = OpIAdd %uint %2979 %2980 + OpStore %x %2981 + %2982 = OpLoad %uint %x + %2983 = OpLoad %uint %v657 + %2984 = OpIAdd %uint %2982 %2983 + OpStore %x %2984 + %2985 = OpLoad %uint %x + %2986 = OpLoad %uint %v658 + %2987 = OpIAdd %uint %2985 %2986 + OpStore %x %2987 + %2988 = OpLoad %uint %x + %2989 = OpLoad %uint %v659 + %2990 = OpIAdd %uint %2988 %2989 + OpStore %x %2990 + %2991 = OpLoad %uint %x + %2992 = OpLoad %uint %v660 + %2993 = OpIAdd %uint %2991 %2992 + OpStore %x %2993 + %2994 = OpLoad %uint %x + %2995 = OpLoad %uint %v661 + %2996 = OpIAdd %uint %2994 %2995 + OpStore %x %2996 + %2997 = OpLoad %uint %x + %2998 = OpLoad %uint %v662 + %2999 = OpIAdd %uint %2997 %2998 + OpStore %x %2999 + %3000 = OpLoad %uint %x + %3001 = OpLoad %uint %v663 + %3002 = OpIAdd %uint %3000 %3001 + OpStore %x %3002 + %3003 = OpLoad %uint %x + %3004 = OpLoad %uint %v664 + %3005 = OpIAdd %uint %3003 %3004 + OpStore %x %3005 + %3006 = OpLoad %uint %x + %3007 = OpLoad %uint %v665 + %3008 = OpIAdd %uint %3006 %3007 + OpStore %x %3008 + %3009 = OpLoad %uint %x + %3010 = OpLoad %uint %v666 + %3011 = OpIAdd %uint %3009 %3010 + OpStore %x %3011 + %3012 = OpLoad %uint %x + %3013 = OpLoad %uint %v667 + %3014 = OpIAdd %uint %3012 %3013 + OpStore %x %3014 + %3015 = OpLoad %uint %x + %3016 = OpLoad %uint %v668 + %3017 = OpIAdd %uint %3015 %3016 + OpStore %x %3017 + %3018 = OpLoad %uint %x + %3019 = OpLoad %uint %v669 + %3020 = OpIAdd %uint %3018 %3019 + OpStore %x %3020 + %3021 = OpLoad %uint %x + %3022 = OpLoad %uint %v670 + %3023 = OpIAdd %uint %3021 %3022 + OpStore %x %3023 + %3024 = OpLoad %uint %x + %3025 = OpLoad %uint %v671 + %3026 = OpIAdd %uint %3024 %3025 + OpStore %x %3026 + %3027 = OpLoad %uint %x + %3028 = OpLoad %uint %v672 + %3029 = OpIAdd %uint %3027 %3028 + OpStore %x %3029 + %3030 = OpLoad %uint %x + %3031 = OpLoad %uint %v673 + %3032 = OpIAdd %uint %3030 %3031 + OpStore %x %3032 + %3033 = OpLoad %uint %x + %3034 = OpLoad %uint %v674 + %3035 = OpIAdd %uint %3033 %3034 + OpStore %x %3035 + %3036 = OpLoad %uint %x + %3037 = OpLoad %uint %v675 + %3038 = OpIAdd %uint %3036 %3037 + OpStore %x %3038 + %3039 = OpLoad %uint %x + %3040 = OpLoad %uint %v676 + %3041 = OpIAdd %uint %3039 %3040 + OpStore %x %3041 + %3042 = OpLoad %uint %x + %3043 = OpLoad %uint %v677 + %3044 = OpIAdd %uint %3042 %3043 + OpStore %x %3044 + %3045 = OpLoad %uint %x + %3046 = OpLoad %uint %v678 + %3047 = OpIAdd %uint %3045 %3046 + OpStore %x %3047 + %3048 = OpLoad %uint %x + %3049 = OpLoad %uint %v679 + %3050 = OpIAdd %uint %3048 %3049 + OpStore %x %3050 + %3051 = OpLoad %uint %x + %3052 = OpLoad %uint %v680 + %3053 = OpIAdd %uint %3051 %3052 + OpStore %x %3053 + %3054 = OpLoad %uint %x + %3055 = OpLoad %uint %v681 + %3056 = OpIAdd %uint %3054 %3055 + OpStore %x %3056 + %3057 = OpLoad %uint %x + %3058 = OpLoad %uint %v682 + %3059 = OpIAdd %uint %3057 %3058 + OpStore %x %3059 + %3060 = OpLoad %uint %x + %3061 = OpLoad %uint %v683 + %3062 = OpIAdd %uint %3060 %3061 + OpStore %x %3062 + %3063 = OpLoad %uint %x + %3064 = OpLoad %uint %v684 + %3065 = OpIAdd %uint %3063 %3064 + OpStore %x %3065 + %3066 = OpLoad %uint %x + %3067 = OpLoad %uint %v685 + %3068 = OpIAdd %uint %3066 %3067 + OpStore %x %3068 + %3069 = OpLoad %uint %x + %3070 = OpLoad %uint %v686 + %3071 = OpIAdd %uint %3069 %3070 + OpStore %x %3071 + %3072 = OpLoad %uint %x + %3073 = OpLoad %uint %v687 + %3074 = OpIAdd %uint %3072 %3073 + OpStore %x %3074 + %3075 = OpLoad %uint %x + %3076 = OpLoad %uint %v688 + %3077 = OpIAdd %uint %3075 %3076 + OpStore %x %3077 + %3078 = OpLoad %uint %x + %3079 = OpLoad %uint %v689 + %3080 = OpIAdd %uint %3078 %3079 + OpStore %x %3080 + %3081 = OpLoad %uint %x + %3082 = OpLoad %uint %v690 + %3083 = OpIAdd %uint %3081 %3082 + OpStore %x %3083 + %3084 = OpLoad %uint %x + %3085 = OpLoad %uint %v691 + %3086 = OpIAdd %uint %3084 %3085 + OpStore %x %3086 + %3087 = OpLoad %uint %x + %3088 = OpLoad %uint %v692 + %3089 = OpIAdd %uint %3087 %3088 + OpStore %x %3089 + %3090 = OpLoad %uint %x + %3091 = OpLoad %uint %v693 + %3092 = OpIAdd %uint %3090 %3091 + OpStore %x %3092 + %3093 = OpLoad %uint %x + %3094 = OpLoad %uint %v694 + %3095 = OpIAdd %uint %3093 %3094 + OpStore %x %3095 + %3096 = OpLoad %uint %x + %3097 = OpLoad %uint %v695 + %3098 = OpIAdd %uint %3096 %3097 + OpStore %x %3098 + %3099 = OpLoad %uint %x + %3100 = OpLoad %uint %v696 + %3101 = OpIAdd %uint %3099 %3100 + OpStore %x %3101 + %3102 = OpLoad %uint %x + %3103 = OpLoad %uint %v697 + %3104 = OpIAdd %uint %3102 %3103 + OpStore %x %3104 + %3105 = OpLoad %uint %x + %3106 = OpLoad %uint %v698 + %3107 = OpIAdd %uint %3105 %3106 + OpStore %x %3107 + %3108 = OpLoad %uint %x + %3109 = OpLoad %uint %v699 + %3110 = OpIAdd %uint %3108 %3109 + OpStore %x %3110 + %3111 = OpLoad %uint %x + %3112 = OpLoad %uint %v700 + %3113 = OpIAdd %uint %3111 %3112 + OpStore %x %3113 + %3114 = OpLoad %uint %x + %3115 = OpLoad %uint %v701 + %3116 = OpIAdd %uint %3114 %3115 + OpStore %x %3116 + %3117 = OpLoad %uint %x + %3118 = OpLoad %uint %v702 + %3119 = OpIAdd %uint %3117 %3118 + OpStore %x %3119 + %3120 = OpLoad %uint %x + %3121 = OpLoad %uint %v703 + %3122 = OpIAdd %uint %3120 %3121 + OpStore %x %3122 + %3123 = OpLoad %uint %x + %3124 = OpLoad %uint %v704 + %3125 = OpIAdd %uint %3123 %3124 + OpStore %x %3125 + %3126 = OpLoad %uint %x + %3127 = OpLoad %uint %v705 + %3128 = OpIAdd %uint %3126 %3127 + OpStore %x %3128 + %3129 = OpLoad %uint %x + %3130 = OpLoad %uint %v706 + %3131 = OpIAdd %uint %3129 %3130 + OpStore %x %3131 + %3132 = OpLoad %uint %x + %3133 = OpLoad %uint %v707 + %3134 = OpIAdd %uint %3132 %3133 + OpStore %x %3134 + %3135 = OpLoad %uint %x + %3136 = OpLoad %uint %v708 + %3137 = OpIAdd %uint %3135 %3136 + OpStore %x %3137 + %3138 = OpLoad %uint %x + %3139 = OpLoad %uint %v709 + %3140 = OpIAdd %uint %3138 %3139 + OpStore %x %3140 + %3141 = OpLoad %uint %x + %3142 = OpLoad %uint %v710 + %3143 = OpIAdd %uint %3141 %3142 + OpStore %x %3143 + %3144 = OpLoad %uint %x + %3145 = OpLoad %uint %v711 + %3146 = OpIAdd %uint %3144 %3145 + OpStore %x %3146 + %3147 = OpLoad %uint %x + %3148 = OpLoad %uint %v712 + %3149 = OpIAdd %uint %3147 %3148 + OpStore %x %3149 + %3150 = OpLoad %uint %x + %3151 = OpLoad %uint %v713 + %3152 = OpIAdd %uint %3150 %3151 + OpStore %x %3152 + %3153 = OpLoad %uint %x + %3154 = OpLoad %uint %v714 + %3155 = OpIAdd %uint %3153 %3154 + OpStore %x %3155 + %3156 = OpLoad %uint %x + %3157 = OpLoad %uint %v715 + %3158 = OpIAdd %uint %3156 %3157 + OpStore %x %3158 + %3159 = OpLoad %uint %x + %3160 = OpLoad %uint %v716 + %3161 = OpIAdd %uint %3159 %3160 + OpStore %x %3161 + %3162 = OpLoad %uint %x + %3163 = OpLoad %uint %v717 + %3164 = OpIAdd %uint %3162 %3163 + OpStore %x %3164 + %3165 = OpLoad %uint %x + %3166 = OpLoad %uint %v718 + %3167 = OpIAdd %uint %3165 %3166 + OpStore %x %3167 + %3168 = OpLoad %uint %x + %3169 = OpLoad %uint %v719 + %3170 = OpIAdd %uint %3168 %3169 + OpStore %x %3170 + %3171 = OpLoad %uint %x + %3172 = OpLoad %uint %v720 + %3173 = OpIAdd %uint %3171 %3172 + OpStore %x %3173 + %3174 = OpLoad %uint %x + %3175 = OpLoad %uint %v721 + %3176 = OpIAdd %uint %3174 %3175 + OpStore %x %3176 + %3177 = OpLoad %uint %x + %3178 = OpLoad %uint %v722 + %3179 = OpIAdd %uint %3177 %3178 + OpStore %x %3179 + %3180 = OpLoad %uint %x + %3181 = OpLoad %uint %v723 + %3182 = OpIAdd %uint %3180 %3181 + OpStore %x %3182 + %3183 = OpLoad %uint %x + %3184 = OpLoad %uint %v724 + %3185 = OpIAdd %uint %3183 %3184 + OpStore %x %3185 + %3186 = OpLoad %uint %x + %3187 = OpLoad %uint %v725 + %3188 = OpIAdd %uint %3186 %3187 + OpStore %x %3188 + %3189 = OpLoad %uint %x + %3190 = OpLoad %uint %v726 + %3191 = OpIAdd %uint %3189 %3190 + OpStore %x %3191 + %3192 = OpLoad %uint %x + %3193 = OpLoad %uint %v727 + %3194 = OpIAdd %uint %3192 %3193 + OpStore %x %3194 + %3195 = OpLoad %uint %x + %3196 = OpLoad %uint %v728 + %3197 = OpIAdd %uint %3195 %3196 + OpStore %x %3197 + %3198 = OpLoad %uint %x + %3199 = OpLoad %uint %v729 + %3200 = OpIAdd %uint %3198 %3199 + OpStore %x %3200 + %3201 = OpLoad %uint %x + %3202 = OpLoad %uint %v730 + %3203 = OpIAdd %uint %3201 %3202 + OpStore %x %3203 + %3204 = OpLoad %uint %x + %3205 = OpLoad %uint %v731 + %3206 = OpIAdd %uint %3204 %3205 + OpStore %x %3206 + %3207 = OpLoad %uint %x + %3208 = OpLoad %uint %v732 + %3209 = OpIAdd %uint %3207 %3208 + OpStore %x %3209 + %3210 = OpLoad %uint %x + %3211 = OpLoad %uint %v733 + %3212 = OpIAdd %uint %3210 %3211 + OpStore %x %3212 + %3213 = OpLoad %uint %x + %3214 = OpLoad %uint %v734 + %3215 = OpIAdd %uint %3213 %3214 + OpStore %x %3215 + %3216 = OpLoad %uint %x + %3217 = OpLoad %uint %v735 + %3218 = OpIAdd %uint %3216 %3217 + OpStore %x %3218 + %3219 = OpLoad %uint %x + %3220 = OpLoad %uint %v736 + %3221 = OpIAdd %uint %3219 %3220 + OpStore %x %3221 + %3222 = OpLoad %uint %x + %3223 = OpLoad %uint %v737 + %3224 = OpIAdd %uint %3222 %3223 + OpStore %x %3224 + %3225 = OpLoad %uint %x + %3226 = OpLoad %uint %v738 + %3227 = OpIAdd %uint %3225 %3226 + OpStore %x %3227 + %3228 = OpLoad %uint %x + %3229 = OpLoad %uint %v739 + %3230 = OpIAdd %uint %3228 %3229 + OpStore %x %3230 + %3231 = OpLoad %uint %x + %3232 = OpLoad %uint %v740 + %3233 = OpIAdd %uint %3231 %3232 + OpStore %x %3233 + %3234 = OpLoad %uint %x + %3235 = OpLoad %uint %v741 + %3236 = OpIAdd %uint %3234 %3235 + OpStore %x %3236 + %3237 = OpLoad %uint %x + %3238 = OpLoad %uint %v742 + %3239 = OpIAdd %uint %3237 %3238 + OpStore %x %3239 + %3240 = OpLoad %uint %x + %3241 = OpLoad %uint %v743 + %3242 = OpIAdd %uint %3240 %3241 + OpStore %x %3242 + %3243 = OpLoad %uint %x + %3244 = OpLoad %uint %v744 + %3245 = OpIAdd %uint %3243 %3244 + OpStore %x %3245 + %3246 = OpLoad %uint %x + %3247 = OpLoad %uint %v745 + %3248 = OpIAdd %uint %3246 %3247 + OpStore %x %3248 + %3249 = OpLoad %uint %x + %3250 = OpLoad %uint %v746 + %3251 = OpIAdd %uint %3249 %3250 + OpStore %x %3251 + %3252 = OpLoad %uint %x + %3253 = OpLoad %uint %v747 + %3254 = OpIAdd %uint %3252 %3253 + OpStore %x %3254 + %3255 = OpLoad %uint %x + %3256 = OpLoad %uint %v748 + %3257 = OpIAdd %uint %3255 %3256 + OpStore %x %3257 + %3258 = OpLoad %uint %x + %3259 = OpLoad %uint %v749 + %3260 = OpIAdd %uint %3258 %3259 + OpStore %x %3260 + %3261 = OpLoad %uint %x + %3262 = OpLoad %uint %v750 + %3263 = OpIAdd %uint %3261 %3262 + OpStore %x %3263 + %3264 = OpLoad %uint %x + %3265 = OpLoad %uint %v751 + %3266 = OpIAdd %uint %3264 %3265 + OpStore %x %3266 + %3267 = OpLoad %uint %x + %3268 = OpLoad %uint %v752 + %3269 = OpIAdd %uint %3267 %3268 + OpStore %x %3269 + %3270 = OpLoad %uint %x + %3271 = OpLoad %uint %v753 + %3272 = OpIAdd %uint %3270 %3271 + OpStore %x %3272 + %3273 = OpLoad %uint %x + %3274 = OpLoad %uint %v754 + %3275 = OpIAdd %uint %3273 %3274 + OpStore %x %3275 + %3276 = OpLoad %uint %x + %3277 = OpLoad %uint %v755 + %3278 = OpIAdd %uint %3276 %3277 + OpStore %x %3278 + %3279 = OpLoad %uint %x + %3280 = OpLoad %uint %v756 + %3281 = OpIAdd %uint %3279 %3280 + OpStore %x %3281 + %3282 = OpLoad %uint %x + %3283 = OpLoad %uint %v757 + %3284 = OpIAdd %uint %3282 %3283 + OpStore %x %3284 + %3285 = OpLoad %uint %x + %3286 = OpLoad %uint %v758 + %3287 = OpIAdd %uint %3285 %3286 + OpStore %x %3287 + %3288 = OpLoad %uint %x + %3289 = OpLoad %uint %v759 + %3290 = OpIAdd %uint %3288 %3289 + OpStore %x %3290 + %3291 = OpLoad %uint %x + %3292 = OpLoad %uint %v760 + %3293 = OpIAdd %uint %3291 %3292 + OpStore %x %3293 + %3294 = OpLoad %uint %x + %3295 = OpLoad %uint %v761 + %3296 = OpIAdd %uint %3294 %3295 + OpStore %x %3296 + %3297 = OpLoad %uint %x + %3298 = OpLoad %uint %v762 + %3299 = OpIAdd %uint %3297 %3298 + OpStore %x %3299 + %3300 = OpLoad %uint %x + %3301 = OpLoad %uint %v763 + %3302 = OpIAdd %uint %3300 %3301 + OpStore %x %3302 + %3303 = OpLoad %uint %x + %3304 = OpLoad %uint %v764 + %3305 = OpIAdd %uint %3303 %3304 + OpStore %x %3305 + %3306 = OpLoad %uint %x + %3307 = OpLoad %uint %v765 + %3308 = OpIAdd %uint %3306 %3307 + OpStore %x %3308 + %3309 = OpLoad %uint %x + %3310 = OpLoad %uint %v766 + %3311 = OpIAdd %uint %3309 %3310 + OpStore %x %3311 + %3312 = OpLoad %uint %x + %3313 = OpLoad %uint %v767 + %3314 = OpIAdd %uint %3312 %3313 + OpStore %x %3314 + %3315 = OpLoad %uint %x + %3316 = OpLoad %uint %v768 + %3317 = OpIAdd %uint %3315 %3316 + OpStore %x %3317 + %3318 = OpLoad %uint %x + %3319 = OpLoad %uint %v769 + %3320 = OpIAdd %uint %3318 %3319 + OpStore %x %3320 + %3321 = OpLoad %uint %x + %3322 = OpLoad %uint %v770 + %3323 = OpIAdd %uint %3321 %3322 + OpStore %x %3323 + %3324 = OpLoad %uint %x + %3325 = OpLoad %uint %v771 + %3326 = OpIAdd %uint %3324 %3325 + OpStore %x %3326 + %3327 = OpLoad %uint %x + %3328 = OpLoad %uint %v772 + %3329 = OpIAdd %uint %3327 %3328 + OpStore %x %3329 + %3330 = OpLoad %uint %x + %3331 = OpLoad %uint %v773 + %3332 = OpIAdd %uint %3330 %3331 + OpStore %x %3332 + %3333 = OpLoad %uint %x + %3334 = OpLoad %uint %v774 + %3335 = OpIAdd %uint %3333 %3334 + OpStore %x %3335 + %3336 = OpLoad %uint %x + %3337 = OpLoad %uint %v775 + %3338 = OpIAdd %uint %3336 %3337 + OpStore %x %3338 + %3339 = OpLoad %uint %x + %3340 = OpLoad %uint %v776 + %3341 = OpIAdd %uint %3339 %3340 + OpStore %x %3341 + %3342 = OpLoad %uint %x + %3343 = OpLoad %uint %v777 + %3344 = OpIAdd %uint %3342 %3343 + OpStore %x %3344 + %3345 = OpLoad %uint %x + %3346 = OpLoad %uint %v778 + %3347 = OpIAdd %uint %3345 %3346 + OpStore %x %3347 + %3348 = OpLoad %uint %x + %3349 = OpLoad %uint %v779 + %3350 = OpIAdd %uint %3348 %3349 + OpStore %x %3350 + %3351 = OpLoad %uint %x + %3352 = OpLoad %uint %v780 + %3353 = OpIAdd %uint %3351 %3352 + OpStore %x %3353 + %3354 = OpLoad %uint %x + %3355 = OpLoad %uint %v781 + %3356 = OpIAdd %uint %3354 %3355 + OpStore %x %3356 + %3357 = OpLoad %uint %x + %3358 = OpLoad %uint %v782 + %3359 = OpIAdd %uint %3357 %3358 + OpStore %x %3359 + %3360 = OpLoad %uint %x + %3361 = OpLoad %uint %v783 + %3362 = OpIAdd %uint %3360 %3361 + OpStore %x %3362 + %3363 = OpLoad %uint %x + %3364 = OpLoad %uint %v784 + %3365 = OpIAdd %uint %3363 %3364 + OpStore %x %3365 + %3366 = OpLoad %uint %x + %3367 = OpLoad %uint %v785 + %3368 = OpIAdd %uint %3366 %3367 + OpStore %x %3368 + %3369 = OpLoad %uint %x + %3370 = OpLoad %uint %v786 + %3371 = OpIAdd %uint %3369 %3370 + OpStore %x %3371 + %3372 = OpLoad %uint %x + %3373 = OpLoad %uint %v787 + %3374 = OpIAdd %uint %3372 %3373 + OpStore %x %3374 + %3375 = OpLoad %uint %x + %3376 = OpLoad %uint %v788 + %3377 = OpIAdd %uint %3375 %3376 + OpStore %x %3377 + %3378 = OpLoad %uint %x + %3379 = OpLoad %uint %v789 + %3380 = OpIAdd %uint %3378 %3379 + OpStore %x %3380 + %3381 = OpLoad %uint %x + %3382 = OpLoad %uint %v790 + %3383 = OpIAdd %uint %3381 %3382 + OpStore %x %3383 + %3384 = OpLoad %uint %x + %3385 = OpLoad %uint %v791 + %3386 = OpIAdd %uint %3384 %3385 + OpStore %x %3386 + %3387 = OpLoad %uint %x + %3388 = OpLoad %uint %v792 + %3389 = OpIAdd %uint %3387 %3388 + OpStore %x %3389 + %3390 = OpLoad %uint %x + %3391 = OpLoad %uint %v793 + %3392 = OpIAdd %uint %3390 %3391 + OpStore %x %3392 + %3393 = OpLoad %uint %x + %3394 = OpLoad %uint %v794 + %3395 = OpIAdd %uint %3393 %3394 + OpStore %x %3395 + %3396 = OpLoad %uint %x + %3397 = OpLoad %uint %v795 + %3398 = OpIAdd %uint %3396 %3397 + OpStore %x %3398 + %3399 = OpLoad %uint %x + %3400 = OpLoad %uint %v796 + %3401 = OpIAdd %uint %3399 %3400 + OpStore %x %3401 + %3402 = OpLoad %uint %x + %3403 = OpLoad %uint %v797 + %3404 = OpIAdd %uint %3402 %3403 + OpStore %x %3404 + %3405 = OpLoad %uint %x + %3406 = OpLoad %uint %v798 + %3407 = OpIAdd %uint %3405 %3406 + OpStore %x %3407 + %3408 = OpLoad %uint %x + %3409 = OpLoad %uint %v799 + %3410 = OpIAdd %uint %3408 %3409 + OpStore %x %3410 + %3411 = OpLoad %uint %x + %3412 = OpLoad %uint %v800 + %3413 = OpIAdd %uint %3411 %3412 + OpStore %x %3413 + %3414 = OpLoad %uint %x + %3415 = OpLoad %uint %v801 + %3416 = OpIAdd %uint %3414 %3415 + OpStore %x %3416 + %3417 = OpLoad %uint %x + %3418 = OpLoad %uint %v802 + %3419 = OpIAdd %uint %3417 %3418 + OpStore %x %3419 + %3420 = OpLoad %uint %x + %3421 = OpLoad %uint %v803 + %3422 = OpIAdd %uint %3420 %3421 + OpStore %x %3422 + %3423 = OpLoad %uint %x + %3424 = OpLoad %uint %v804 + %3425 = OpIAdd %uint %3423 %3424 + OpStore %x %3425 + %3426 = OpLoad %uint %x + %3427 = OpLoad %uint %v805 + %3428 = OpIAdd %uint %3426 %3427 + OpStore %x %3428 + %3429 = OpLoad %uint %x + %3430 = OpLoad %uint %v806 + %3431 = OpIAdd %uint %3429 %3430 + OpStore %x %3431 + %3432 = OpLoad %uint %x + %3433 = OpLoad %uint %v807 + %3434 = OpIAdd %uint %3432 %3433 + OpStore %x %3434 + %3435 = OpLoad %uint %x + %3436 = OpLoad %uint %v808 + %3437 = OpIAdd %uint %3435 %3436 + OpStore %x %3437 + %3438 = OpLoad %uint %x + %3439 = OpLoad %uint %v809 + %3440 = OpIAdd %uint %3438 %3439 + OpStore %x %3440 + %3441 = OpLoad %uint %x + %3442 = OpLoad %uint %v810 + %3443 = OpIAdd %uint %3441 %3442 + OpStore %x %3443 + %3444 = OpLoad %uint %x + %3445 = OpLoad %uint %v811 + %3446 = OpIAdd %uint %3444 %3445 + OpStore %x %3446 + %3447 = OpLoad %uint %x + %3448 = OpLoad %uint %v812 + %3449 = OpIAdd %uint %3447 %3448 + OpStore %x %3449 + %3450 = OpLoad %uint %x + %3451 = OpLoad %uint %v813 + %3452 = OpIAdd %uint %3450 %3451 + OpStore %x %3452 + %3453 = OpLoad %uint %x + %3454 = OpLoad %uint %v814 + %3455 = OpIAdd %uint %3453 %3454 + OpStore %x %3455 + %3456 = OpLoad %uint %x + %3457 = OpLoad %uint %v815 + %3458 = OpIAdd %uint %3456 %3457 + OpStore %x %3458 + %3459 = OpLoad %uint %x + %3460 = OpLoad %uint %v816 + %3461 = OpIAdd %uint %3459 %3460 + OpStore %x %3461 + %3462 = OpLoad %uint %x + %3463 = OpLoad %uint %v817 + %3464 = OpIAdd %uint %3462 %3463 + OpStore %x %3464 + %3465 = OpLoad %uint %x + %3466 = OpLoad %uint %v818 + %3467 = OpIAdd %uint %3465 %3466 + OpStore %x %3467 + %3468 = OpLoad %uint %x + %3469 = OpLoad %uint %v819 + %3470 = OpIAdd %uint %3468 %3469 + OpStore %x %3470 + %3471 = OpLoad %uint %x + %3472 = OpLoad %uint %v820 + %3473 = OpIAdd %uint %3471 %3472 + OpStore %x %3473 + %3474 = OpLoad %uint %x + %3475 = OpLoad %uint %v821 + %3476 = OpIAdd %uint %3474 %3475 + OpStore %x %3476 + %3477 = OpLoad %uint %x + %3478 = OpLoad %uint %v822 + %3479 = OpIAdd %uint %3477 %3478 + OpStore %x %3479 + %3480 = OpLoad %uint %x + %3481 = OpLoad %uint %v823 + %3482 = OpIAdd %uint %3480 %3481 + OpStore %x %3482 + %3483 = OpLoad %uint %x + %3484 = OpLoad %uint %v824 + %3485 = OpIAdd %uint %3483 %3484 + OpStore %x %3485 + %3486 = OpLoad %uint %x + %3487 = OpLoad %uint %v825 + %3488 = OpIAdd %uint %3486 %3487 + OpStore %x %3488 + %3489 = OpLoad %uint %x + %3490 = OpLoad %uint %v826 + %3491 = OpIAdd %uint %3489 %3490 + OpStore %x %3491 + %3492 = OpLoad %uint %x + %3493 = OpLoad %uint %v827 + %3494 = OpIAdd %uint %3492 %3493 + OpStore %x %3494 + %3495 = OpLoad %uint %x + %3496 = OpLoad %uint %v828 + %3497 = OpIAdd %uint %3495 %3496 + OpStore %x %3497 + %3498 = OpLoad %uint %x + %3499 = OpLoad %uint %v829 + %3500 = OpIAdd %uint %3498 %3499 + OpStore %x %3500 + %3501 = OpLoad %uint %x + %3502 = OpLoad %uint %v830 + %3503 = OpIAdd %uint %3501 %3502 + OpStore %x %3503 + %3504 = OpLoad %uint %x + %3505 = OpLoad %uint %v831 + %3506 = OpIAdd %uint %3504 %3505 + OpStore %x %3506 + %3507 = OpLoad %uint %x + %3508 = OpLoad %uint %v832 + %3509 = OpIAdd %uint %3507 %3508 + OpStore %x %3509 + %3510 = OpLoad %uint %x + %3511 = OpLoad %uint %v833 + %3512 = OpIAdd %uint %3510 %3511 + OpStore %x %3512 + %3513 = OpLoad %uint %x + %3514 = OpLoad %uint %v834 + %3515 = OpIAdd %uint %3513 %3514 + OpStore %x %3515 + %3516 = OpLoad %uint %x + %3517 = OpLoad %uint %v835 + %3518 = OpIAdd %uint %3516 %3517 + OpStore %x %3518 + %3519 = OpLoad %uint %x + %3520 = OpLoad %uint %v836 + %3521 = OpIAdd %uint %3519 %3520 + OpStore %x %3521 + %3522 = OpLoad %uint %x + %3523 = OpLoad %uint %v837 + %3524 = OpIAdd %uint %3522 %3523 + OpStore %x %3524 + %3525 = OpLoad %uint %x + %3526 = OpLoad %uint %v838 + %3527 = OpIAdd %uint %3525 %3526 + OpStore %x %3527 + %3528 = OpLoad %uint %x + %3529 = OpLoad %uint %v839 + %3530 = OpIAdd %uint %3528 %3529 + OpStore %x %3530 + %3531 = OpLoad %uint %x + %3532 = OpLoad %uint %v840 + %3533 = OpIAdd %uint %3531 %3532 + OpStore %x %3533 + %3534 = OpLoad %uint %x + %3535 = OpLoad %uint %v841 + %3536 = OpIAdd %uint %3534 %3535 + OpStore %x %3536 + %3537 = OpLoad %uint %x + %3538 = OpLoad %uint %v842 + %3539 = OpIAdd %uint %3537 %3538 + OpStore %x %3539 + %3540 = OpLoad %uint %x + %3541 = OpLoad %uint %v843 + %3542 = OpIAdd %uint %3540 %3541 + OpStore %x %3542 + %3543 = OpLoad %uint %x + %3544 = OpLoad %uint %v844 + %3545 = OpIAdd %uint %3543 %3544 + OpStore %x %3545 + %3546 = OpLoad %uint %x + %3547 = OpLoad %uint %v845 + %3548 = OpIAdd %uint %3546 %3547 + OpStore %x %3548 + %3549 = OpLoad %uint %x + %3550 = OpLoad %uint %v846 + %3551 = OpIAdd %uint %3549 %3550 + OpStore %x %3551 + %3552 = OpLoad %uint %x + %3553 = OpLoad %uint %v847 + %3554 = OpIAdd %uint %3552 %3553 + OpStore %x %3554 + %3555 = OpLoad %uint %x + %3556 = OpLoad %uint %v848 + %3557 = OpIAdd %uint %3555 %3556 + OpStore %x %3557 + %3558 = OpLoad %uint %x + %3559 = OpLoad %uint %v849 + %3560 = OpIAdd %uint %3558 %3559 + OpStore %x %3560 + %3561 = OpLoad %uint %x + %3562 = OpLoad %uint %v850 + %3563 = OpIAdd %uint %3561 %3562 + OpStore %x %3563 + %3564 = OpLoad %uint %x + %3565 = OpLoad %uint %v851 + %3566 = OpIAdd %uint %3564 %3565 + OpStore %x %3566 + %3567 = OpLoad %uint %x + %3568 = OpLoad %uint %v852 + %3569 = OpIAdd %uint %3567 %3568 + OpStore %x %3569 + %3570 = OpLoad %uint %x + %3571 = OpLoad %uint %v853 + %3572 = OpIAdd %uint %3570 %3571 + OpStore %x %3572 + %3573 = OpLoad %uint %x + %3574 = OpLoad %uint %v854 + %3575 = OpIAdd %uint %3573 %3574 + OpStore %x %3575 + %3576 = OpLoad %uint %x + %3577 = OpLoad %uint %v855 + %3578 = OpIAdd %uint %3576 %3577 + OpStore %x %3578 + %3579 = OpLoad %uint %x + %3580 = OpLoad %uint %v856 + %3581 = OpIAdd %uint %3579 %3580 + OpStore %x %3581 + %3582 = OpLoad %uint %x + %3583 = OpLoad %uint %v857 + %3584 = OpIAdd %uint %3582 %3583 + OpStore %x %3584 + %3585 = OpLoad %uint %x + %3586 = OpLoad %uint %v858 + %3587 = OpIAdd %uint %3585 %3586 + OpStore %x %3587 + %3588 = OpLoad %uint %x + %3589 = OpLoad %uint %v859 + %3590 = OpIAdd %uint %3588 %3589 + OpStore %x %3590 + %3591 = OpLoad %uint %x + %3592 = OpLoad %uint %v860 + %3593 = OpIAdd %uint %3591 %3592 + OpStore %x %3593 + %3594 = OpLoad %uint %x + %3595 = OpLoad %uint %v861 + %3596 = OpIAdd %uint %3594 %3595 + OpStore %x %3596 + %3597 = OpLoad %uint %x + %3598 = OpLoad %uint %v862 + %3599 = OpIAdd %uint %3597 %3598 + OpStore %x %3599 + %3600 = OpLoad %uint %x + %3601 = OpLoad %uint %v863 + %3602 = OpIAdd %uint %3600 %3601 + OpStore %x %3602 + %3603 = OpLoad %uint %x + %3604 = OpLoad %uint %v864 + %3605 = OpIAdd %uint %3603 %3604 + OpStore %x %3605 + %3606 = OpLoad %uint %x + %3607 = OpLoad %uint %v865 + %3608 = OpIAdd %uint %3606 %3607 + OpStore %x %3608 + %3609 = OpLoad %uint %x + %3610 = OpLoad %uint %v866 + %3611 = OpIAdd %uint %3609 %3610 + OpStore %x %3611 + %3612 = OpLoad %uint %x + %3613 = OpLoad %uint %v867 + %3614 = OpIAdd %uint %3612 %3613 + OpStore %x %3614 + %3615 = OpLoad %uint %x + %3616 = OpLoad %uint %v868 + %3617 = OpIAdd %uint %3615 %3616 + OpStore %x %3617 + %3618 = OpLoad %uint %x + %3619 = OpLoad %uint %v869 + %3620 = OpIAdd %uint %3618 %3619 + OpStore %x %3620 + %3621 = OpLoad %uint %x + %3622 = OpLoad %uint %v870 + %3623 = OpIAdd %uint %3621 %3622 + OpStore %x %3623 + %3624 = OpLoad %uint %x + %3625 = OpLoad %uint %v871 + %3626 = OpIAdd %uint %3624 %3625 + OpStore %x %3626 + %3627 = OpLoad %uint %x + %3628 = OpLoad %uint %v872 + %3629 = OpIAdd %uint %3627 %3628 + OpStore %x %3629 + %3630 = OpLoad %uint %x + %3631 = OpLoad %uint %v873 + %3632 = OpIAdd %uint %3630 %3631 + OpStore %x %3632 + %3633 = OpLoad %uint %x + %3634 = OpLoad %uint %v874 + %3635 = OpIAdd %uint %3633 %3634 + OpStore %x %3635 + %3636 = OpLoad %uint %x + %3637 = OpLoad %uint %v875 + %3638 = OpIAdd %uint %3636 %3637 + OpStore %x %3638 + %3639 = OpLoad %uint %x + %3640 = OpLoad %uint %v876 + %3641 = OpIAdd %uint %3639 %3640 + OpStore %x %3641 + %3642 = OpLoad %uint %x + %3643 = OpLoad %uint %v877 + %3644 = OpIAdd %uint %3642 %3643 + OpStore %x %3644 + %3645 = OpLoad %uint %x + %3646 = OpLoad %uint %v878 + %3647 = OpIAdd %uint %3645 %3646 + OpStore %x %3647 + %3648 = OpLoad %uint %x + %3649 = OpLoad %uint %v879 + %3650 = OpIAdd %uint %3648 %3649 + OpStore %x %3650 + %3651 = OpLoad %uint %x + %3652 = OpLoad %uint %v880 + %3653 = OpIAdd %uint %3651 %3652 + OpStore %x %3653 + %3654 = OpLoad %uint %x + %3655 = OpLoad %uint %v881 + %3656 = OpIAdd %uint %3654 %3655 + OpStore %x %3656 + %3657 = OpLoad %uint %x + %3658 = OpLoad %uint %v882 + %3659 = OpIAdd %uint %3657 %3658 + OpStore %x %3659 + %3660 = OpLoad %uint %x + %3661 = OpLoad %uint %v883 + %3662 = OpIAdd %uint %3660 %3661 + OpStore %x %3662 + %3663 = OpLoad %uint %x + %3664 = OpLoad %uint %v884 + %3665 = OpIAdd %uint %3663 %3664 + OpStore %x %3665 + %3666 = OpLoad %uint %x + %3667 = OpLoad %uint %v885 + %3668 = OpIAdd %uint %3666 %3667 + OpStore %x %3668 + %3669 = OpLoad %uint %x + %3670 = OpLoad %uint %v886 + %3671 = OpIAdd %uint %3669 %3670 + OpStore %x %3671 + %3672 = OpLoad %uint %x + %3673 = OpLoad %uint %v887 + %3674 = OpIAdd %uint %3672 %3673 + OpStore %x %3674 + %3675 = OpLoad %uint %x + %3676 = OpLoad %uint %v888 + %3677 = OpIAdd %uint %3675 %3676 + OpStore %x %3677 + %3678 = OpLoad %uint %x + %3679 = OpLoad %uint %v889 + %3680 = OpIAdd %uint %3678 %3679 + OpStore %x %3680 + %3681 = OpLoad %uint %x + %3682 = OpLoad %uint %v890 + %3683 = OpIAdd %uint %3681 %3682 + OpStore %x %3683 + %3684 = OpLoad %uint %x + %3685 = OpLoad %uint %v891 + %3686 = OpIAdd %uint %3684 %3685 + OpStore %x %3686 + %3687 = OpLoad %uint %x + %3688 = OpLoad %uint %v892 + %3689 = OpIAdd %uint %3687 %3688 + OpStore %x %3689 + %3690 = OpLoad %uint %x + %3691 = OpLoad %uint %v893 + %3692 = OpIAdd %uint %3690 %3691 + OpStore %x %3692 + %3693 = OpLoad %uint %x + %3694 = OpLoad %uint %v894 + %3695 = OpIAdd %uint %3693 %3694 + OpStore %x %3695 + %3696 = OpLoad %uint %x + %3697 = OpLoad %uint %v895 + %3698 = OpIAdd %uint %3696 %3697 + OpStore %x %3698 + %3699 = OpLoad %uint %x + %3700 = OpLoad %uint %v896 + %3701 = OpIAdd %uint %3699 %3700 + OpStore %x %3701 + %3702 = OpLoad %uint %x + %3703 = OpLoad %uint %v897 + %3704 = OpIAdd %uint %3702 %3703 + OpStore %x %3704 + %3705 = OpLoad %uint %x + %3706 = OpLoad %uint %v898 + %3707 = OpIAdd %uint %3705 %3706 + OpStore %x %3707 + %3708 = OpLoad %uint %x + %3709 = OpLoad %uint %v899 + %3710 = OpIAdd %uint %3708 %3709 + OpStore %x %3710 + %3711 = OpLoad %uint %x + %3712 = OpLoad %uint %v900 + %3713 = OpIAdd %uint %3711 %3712 + OpStore %x %3713 + %3714 = OpLoad %uint %x + %3715 = OpLoad %uint %v901 + %3716 = OpIAdd %uint %3714 %3715 + OpStore %x %3716 + %3717 = OpLoad %uint %x + %3718 = OpLoad %uint %v902 + %3719 = OpIAdd %uint %3717 %3718 + OpStore %x %3719 + %3720 = OpLoad %uint %x + %3721 = OpLoad %uint %v903 + %3722 = OpIAdd %uint %3720 %3721 + OpStore %x %3722 + %3723 = OpLoad %uint %x + %3724 = OpLoad %uint %v904 + %3725 = OpIAdd %uint %3723 %3724 + OpStore %x %3725 + %3726 = OpLoad %uint %x + %3727 = OpLoad %uint %v905 + %3728 = OpIAdd %uint %3726 %3727 + OpStore %x %3728 + %3729 = OpLoad %uint %x + %3730 = OpLoad %uint %v906 + %3731 = OpIAdd %uint %3729 %3730 + OpStore %x %3731 + %3732 = OpLoad %uint %x + %3733 = OpLoad %uint %v907 + %3734 = OpIAdd %uint %3732 %3733 + OpStore %x %3734 + %3735 = OpLoad %uint %x + %3736 = OpLoad %uint %v908 + %3737 = OpIAdd %uint %3735 %3736 + OpStore %x %3737 + %3738 = OpLoad %uint %x + %3739 = OpLoad %uint %v909 + %3740 = OpIAdd %uint %3738 %3739 + OpStore %x %3740 + %3741 = OpLoad %uint %x + %3742 = OpLoad %uint %v910 + %3743 = OpIAdd %uint %3741 %3742 + OpStore %x %3743 + %3744 = OpLoad %uint %x + %3745 = OpLoad %uint %v911 + %3746 = OpIAdd %uint %3744 %3745 + OpStore %x %3746 + %3747 = OpLoad %uint %x + %3748 = OpLoad %uint %v912 + %3749 = OpIAdd %uint %3747 %3748 + OpStore %x %3749 + %3750 = OpLoad %uint %x + %3751 = OpLoad %uint %v913 + %3752 = OpIAdd %uint %3750 %3751 + OpStore %x %3752 + %3753 = OpLoad %uint %x + %3754 = OpLoad %uint %v914 + %3755 = OpIAdd %uint %3753 %3754 + OpStore %x %3755 + %3756 = OpLoad %uint %x + %3757 = OpLoad %uint %v915 + %3758 = OpIAdd %uint %3756 %3757 + OpStore %x %3758 + %3759 = OpLoad %uint %x + %3760 = OpLoad %uint %v916 + %3761 = OpIAdd %uint %3759 %3760 + OpStore %x %3761 + %3762 = OpLoad %uint %x + %3763 = OpLoad %uint %v917 + %3764 = OpIAdd %uint %3762 %3763 + OpStore %x %3764 + %3765 = OpLoad %uint %x + %3766 = OpLoad %uint %v918 + %3767 = OpIAdd %uint %3765 %3766 + OpStore %x %3767 + %3768 = OpLoad %uint %x + %3769 = OpLoad %uint %v919 + %3770 = OpIAdd %uint %3768 %3769 + OpStore %x %3770 + %3771 = OpLoad %uint %x + %3772 = OpLoad %uint %v920 + %3773 = OpIAdd %uint %3771 %3772 + OpStore %x %3773 + %3774 = OpLoad %uint %x + %3775 = OpLoad %uint %v921 + %3776 = OpIAdd %uint %3774 %3775 + OpStore %x %3776 + %3777 = OpLoad %uint %x + %3778 = OpLoad %uint %v922 + %3779 = OpIAdd %uint %3777 %3778 + OpStore %x %3779 + %3780 = OpLoad %uint %x + %3781 = OpLoad %uint %v923 + %3782 = OpIAdd %uint %3780 %3781 + OpStore %x %3782 + %3783 = OpLoad %uint %x + %3784 = OpLoad %uint %v924 + %3785 = OpIAdd %uint %3783 %3784 + OpStore %x %3785 + %3786 = OpLoad %uint %x + %3787 = OpLoad %uint %v925 + %3788 = OpIAdd %uint %3786 %3787 + OpStore %x %3788 + %3789 = OpLoad %uint %x + %3790 = OpLoad %uint %v926 + %3791 = OpIAdd %uint %3789 %3790 + OpStore %x %3791 + %3792 = OpLoad %uint %x + %3793 = OpLoad %uint %v927 + %3794 = OpIAdd %uint %3792 %3793 + OpStore %x %3794 + %3795 = OpLoad %uint %x + %3796 = OpLoad %uint %v928 + %3797 = OpIAdd %uint %3795 %3796 + OpStore %x %3797 + %3798 = OpLoad %uint %x + %3799 = OpLoad %uint %v929 + %3800 = OpIAdd %uint %3798 %3799 + OpStore %x %3800 + %3801 = OpLoad %uint %x + %3802 = OpLoad %uint %v930 + %3803 = OpIAdd %uint %3801 %3802 + OpStore %x %3803 + %3804 = OpLoad %uint %x + %3805 = OpLoad %uint %v931 + %3806 = OpIAdd %uint %3804 %3805 + OpStore %x %3806 + %3807 = OpLoad %uint %x + %3808 = OpLoad %uint %v932 + %3809 = OpIAdd %uint %3807 %3808 + OpStore %x %3809 + %3810 = OpLoad %uint %x + %3811 = OpLoad %uint %v933 + %3812 = OpIAdd %uint %3810 %3811 + OpStore %x %3812 + %3813 = OpLoad %uint %x + %3814 = OpLoad %uint %v934 + %3815 = OpIAdd %uint %3813 %3814 + OpStore %x %3815 + %3816 = OpLoad %uint %x + %3817 = OpLoad %uint %v935 + %3818 = OpIAdd %uint %3816 %3817 + OpStore %x %3818 + %3819 = OpLoad %uint %x + %3820 = OpLoad %uint %v936 + %3821 = OpIAdd %uint %3819 %3820 + OpStore %x %3821 + %3822 = OpLoad %uint %x + %3823 = OpLoad %uint %v937 + %3824 = OpIAdd %uint %3822 %3823 + OpStore %x %3824 + %3825 = OpLoad %uint %x + %3826 = OpLoad %uint %v938 + %3827 = OpIAdd %uint %3825 %3826 + OpStore %x %3827 + %3828 = OpLoad %uint %x + %3829 = OpLoad %uint %v939 + %3830 = OpIAdd %uint %3828 %3829 + OpStore %x %3830 + %3831 = OpLoad %uint %x + %3832 = OpLoad %uint %v940 + %3833 = OpIAdd %uint %3831 %3832 + OpStore %x %3833 + %3834 = OpLoad %uint %x + %3835 = OpLoad %uint %v941 + %3836 = OpIAdd %uint %3834 %3835 + OpStore %x %3836 + %3837 = OpLoad %uint %x + %3838 = OpLoad %uint %v942 + %3839 = OpIAdd %uint %3837 %3838 + OpStore %x %3839 + %3840 = OpLoad %uint %x + %3841 = OpLoad %uint %v943 + %3842 = OpIAdd %uint %3840 %3841 + OpStore %x %3842 + %3843 = OpLoad %uint %x + %3844 = OpLoad %uint %v944 + %3845 = OpIAdd %uint %3843 %3844 + OpStore %x %3845 + %3846 = OpLoad %uint %x + %3847 = OpLoad %uint %v945 + %3848 = OpIAdd %uint %3846 %3847 + OpStore %x %3848 + %3849 = OpLoad %uint %x + %3850 = OpLoad %uint %v946 + %3851 = OpIAdd %uint %3849 %3850 + OpStore %x %3851 + %3852 = OpLoad %uint %x + %3853 = OpLoad %uint %v947 + %3854 = OpIAdd %uint %3852 %3853 + OpStore %x %3854 + %3855 = OpLoad %uint %x + %3856 = OpLoad %uint %v948 + %3857 = OpIAdd %uint %3855 %3856 + OpStore %x %3857 + %3858 = OpLoad %uint %x + %3859 = OpLoad %uint %v949 + %3860 = OpIAdd %uint %3858 %3859 + OpStore %x %3860 + %3861 = OpLoad %uint %x + %3862 = OpLoad %uint %v950 + %3863 = OpIAdd %uint %3861 %3862 + OpStore %x %3863 + %3864 = OpLoad %uint %x + %3865 = OpLoad %uint %v951 + %3866 = OpIAdd %uint %3864 %3865 + OpStore %x %3866 + %3867 = OpLoad %uint %x + %3868 = OpLoad %uint %v952 + %3869 = OpIAdd %uint %3867 %3868 + OpStore %x %3869 + %3870 = OpLoad %uint %x + %3871 = OpLoad %uint %v953 + %3872 = OpIAdd %uint %3870 %3871 + OpStore %x %3872 + %3873 = OpLoad %uint %x + %3874 = OpLoad %uint %v954 + %3875 = OpIAdd %uint %3873 %3874 + OpStore %x %3875 + %3876 = OpLoad %uint %x + %3877 = OpLoad %uint %v955 + %3878 = OpIAdd %uint %3876 %3877 + OpStore %x %3878 + %3879 = OpLoad %uint %x + %3880 = OpLoad %uint %v956 + %3881 = OpIAdd %uint %3879 %3880 + OpStore %x %3881 + %3882 = OpLoad %uint %x + %3883 = OpLoad %uint %v957 + %3884 = OpIAdd %uint %3882 %3883 + OpStore %x %3884 + %3885 = OpLoad %uint %x + %3886 = OpLoad %uint %v958 + %3887 = OpIAdd %uint %3885 %3886 + OpStore %x %3887 + %3888 = OpLoad %uint %x + %3889 = OpLoad %uint %v959 + %3890 = OpIAdd %uint %3888 %3889 + OpStore %x %3890 + %3891 = OpLoad %uint %x + %3892 = OpLoad %uint %v960 + %3893 = OpIAdd %uint %3891 %3892 + OpStore %x %3893 + %3894 = OpLoad %uint %x + %3895 = OpLoad %uint %v961 + %3896 = OpIAdd %uint %3894 %3895 + OpStore %x %3896 + %3897 = OpLoad %uint %x + %3898 = OpLoad %uint %v962 + %3899 = OpIAdd %uint %3897 %3898 + OpStore %x %3899 + %3900 = OpLoad %uint %x + %3901 = OpLoad %uint %v963 + %3902 = OpIAdd %uint %3900 %3901 + OpStore %x %3902 + %3903 = OpLoad %uint %x + %3904 = OpLoad %uint %v964 + %3905 = OpIAdd %uint %3903 %3904 + OpStore %x %3905 + %3906 = OpLoad %uint %x + %3907 = OpLoad %uint %v965 + %3908 = OpIAdd %uint %3906 %3907 + OpStore %x %3908 + %3909 = OpLoad %uint %x + %3910 = OpLoad %uint %v966 + %3911 = OpIAdd %uint %3909 %3910 + OpStore %x %3911 + %3912 = OpLoad %uint %x + %3913 = OpLoad %uint %v967 + %3914 = OpIAdd %uint %3912 %3913 + OpStore %x %3914 + %3915 = OpLoad %uint %x + %3916 = OpLoad %uint %v968 + %3917 = OpIAdd %uint %3915 %3916 + OpStore %x %3917 + %3918 = OpLoad %uint %x + %3919 = OpLoad %uint %v969 + %3920 = OpIAdd %uint %3918 %3919 + OpStore %x %3920 + %3921 = OpLoad %uint %x + %3922 = OpLoad %uint %v970 + %3923 = OpIAdd %uint %3921 %3922 + OpStore %x %3923 + %3924 = OpLoad %uint %x + %3925 = OpLoad %uint %v971 + %3926 = OpIAdd %uint %3924 %3925 + OpStore %x %3926 + %3927 = OpLoad %uint %x + %3928 = OpLoad %uint %v972 + %3929 = OpIAdd %uint %3927 %3928 + OpStore %x %3929 + %3930 = OpLoad %uint %x + %3931 = OpLoad %uint %v973 + %3932 = OpIAdd %uint %3930 %3931 + OpStore %x %3932 + %3933 = OpLoad %uint %x + %3934 = OpLoad %uint %v974 + %3935 = OpIAdd %uint %3933 %3934 + OpStore %x %3935 + %3936 = OpLoad %uint %x + %3937 = OpLoad %uint %v975 + %3938 = OpIAdd %uint %3936 %3937 + OpStore %x %3938 + %3939 = OpLoad %uint %x + %3940 = OpLoad %uint %v976 + %3941 = OpIAdd %uint %3939 %3940 + OpStore %x %3941 + %3942 = OpLoad %uint %x + %3943 = OpLoad %uint %v977 + %3944 = OpIAdd %uint %3942 %3943 + OpStore %x %3944 + %3945 = OpLoad %uint %x + %3946 = OpLoad %uint %v978 + %3947 = OpIAdd %uint %3945 %3946 + OpStore %x %3947 + %3948 = OpLoad %uint %x + %3949 = OpLoad %uint %v979 + %3950 = OpIAdd %uint %3948 %3949 + OpStore %x %3950 + %3951 = OpLoad %uint %x + %3952 = OpLoad %uint %v980 + %3953 = OpIAdd %uint %3951 %3952 + OpStore %x %3953 + %3954 = OpLoad %uint %x + %3955 = OpLoad %uint %v981 + %3956 = OpIAdd %uint %3954 %3955 + OpStore %x %3956 + %3957 = OpLoad %uint %x + %3958 = OpLoad %uint %v982 + %3959 = OpIAdd %uint %3957 %3958 + OpStore %x %3959 + %3960 = OpLoad %uint %x + %3961 = OpLoad %uint %v983 + %3962 = OpIAdd %uint %3960 %3961 + OpStore %x %3962 + %3963 = OpLoad %uint %x + %3964 = OpLoad %uint %v984 + %3965 = OpIAdd %uint %3963 %3964 + OpStore %x %3965 + %3966 = OpLoad %uint %x + %3967 = OpLoad %uint %v985 + %3968 = OpIAdd %uint %3966 %3967 + OpStore %x %3968 + %3969 = OpLoad %uint %x + %3970 = OpLoad %uint %v986 + %3971 = OpIAdd %uint %3969 %3970 + OpStore %x %3971 + %3972 = OpLoad %uint %x + %3973 = OpLoad %uint %v987 + %3974 = OpIAdd %uint %3972 %3973 + OpStore %x %3974 + %3975 = OpLoad %uint %x + %3976 = OpLoad %uint %v988 + %3977 = OpIAdd %uint %3975 %3976 + OpStore %x %3977 + %3978 = OpLoad %uint %x + %3979 = OpLoad %uint %v989 + %3980 = OpIAdd %uint %3978 %3979 + OpStore %x %3980 + %3981 = OpLoad %uint %x + %3982 = OpLoad %uint %v990 + %3983 = OpIAdd %uint %3981 %3982 + OpStore %x %3983 + %3984 = OpLoad %uint %x + %3985 = OpLoad %uint %v991 + %3986 = OpIAdd %uint %3984 %3985 + OpStore %x %3986 + %3987 = OpLoad %uint %x + %3988 = OpLoad %uint %v992 + %3989 = OpIAdd %uint %3987 %3988 + OpStore %x %3989 + %3990 = OpLoad %uint %x + %3991 = OpLoad %uint %v993 + %3992 = OpIAdd %uint %3990 %3991 + OpStore %x %3992 + %3993 = OpLoad %uint %x + %3994 = OpLoad %uint %v994 + %3995 = OpIAdd %uint %3993 %3994 + OpStore %x %3995 + %3996 = OpLoad %uint %x + %3997 = OpLoad %uint %v995 + %3998 = OpIAdd %uint %3996 %3997 + OpStore %x %3998 + %3999 = OpLoad %uint %x + %4000 = OpLoad %uint %v996 + %4001 = OpIAdd %uint %3999 %4000 + OpStore %x %4001 + %4002 = OpLoad %uint %x + %4003 = OpLoad %uint %v997 + %4004 = OpIAdd %uint %4002 %4003 + OpStore %x %4004 + %4005 = OpLoad %uint %x + %4006 = OpLoad %uint %v998 + %4007 = OpIAdd %uint %4005 %4006 + OpStore %x %4007 + %4008 = OpLoad %uint %x + %4009 = OpLoad %uint %v999 + %4010 = OpIAdd %uint %4008 %4009 + OpStore %x %4010 + %4011 = OpLoad %uint %x + OpReturnValue %4011 + OpFunctionEnd + %main_inner = OpFunction %uint None %1006 + %4013 = OpLabel + %4014 = OpFunctionCall %uint %foo + OpReturnValue %4014 + OpFunctionEnd + %main = OpFunction %void None %4015 + %4018 = OpLabel + %4019 = OpFunctionCall %uint %main_inner + OpStore %value %4019 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1509.wgsl.expected.wgsl b/test/tint/bug/tint/1509.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ba56e0d05 --- /dev/null +++ b/test/tint/bug/tint/1509.wgsl.expected.wgsl @@ -0,0 +1,3009 @@ +var v0 : u32; + +var v1 : u32; + +var v2 : u32; + +var v3 : u32; + +var v4 : u32; + +var v5 : u32; + +var v6 : u32; + +var v7 : u32; + +var v8 : u32; + +var v9 : u32; + +var v10 : u32; + +var v11 : u32; + +var v12 : u32; + +var v13 : u32; + +var v14 : u32; + +var v15 : u32; + +var v16 : u32; + +var v17 : u32; + +var v18 : u32; + +var v19 : u32; + +var v20 : u32; + +var v21 : u32; + +var v22 : u32; + +var v23 : u32; + +var v24 : u32; + +var v25 : u32; + +var v26 : u32; + +var v27 : u32; + +var v28 : u32; + +var v29 : u32; + +var v30 : u32; + +var v31 : u32; + +var v32 : u32; + +var v33 : u32; + +var v34 : u32; + +var v35 : u32; + +var v36 : u32; + +var v37 : u32; + +var v38 : u32; + +var v39 : u32; + +var v40 : u32; + +var v41 : u32; + +var v42 : u32; + +var v43 : u32; + +var v44 : u32; + +var v45 : u32; + +var v46 : u32; + +var v47 : u32; + +var v48 : u32; + +var v49 : u32; + +var v50 : u32; + +var v51 : u32; + +var v52 : u32; + +var v53 : u32; + +var v54 : u32; + +var v55 : u32; + +var v56 : u32; + +var v57 : u32; + +var v58 : u32; + +var v59 : u32; + +var v60 : u32; + +var v61 : u32; + +var v62 : u32; + +var v63 : u32; + +var v64 : u32; + +var v65 : u32; + +var v66 : u32; + +var v67 : u32; + +var v68 : u32; + +var v69 : u32; + +var v70 : u32; + +var v71 : u32; + +var v72 : u32; + +var v73 : u32; + +var v74 : u32; + +var v75 : u32; + +var v76 : u32; + +var v77 : u32; + +var v78 : u32; + +var v79 : u32; + +var v80 : u32; + +var v81 : u32; + +var v82 : u32; + +var v83 : u32; + +var v84 : u32; + +var v85 : u32; + +var v86 : u32; + +var v87 : u32; + +var v88 : u32; + +var v89 : u32; + +var v90 : u32; + +var v91 : u32; + +var v92 : u32; + +var v93 : u32; + +var v94 : u32; + +var v95 : u32; + +var v96 : u32; + +var v97 : u32; + +var v98 : u32; + +var v99 : u32; + +var v100 : u32; + +var v101 : u32; + +var v102 : u32; + +var v103 : u32; + +var v104 : u32; + +var v105 : u32; + +var v106 : u32; + +var v107 : u32; + +var v108 : u32; + +var v109 : u32; + +var v110 : u32; + +var v111 : u32; + +var v112 : u32; + +var v113 : u32; + +var v114 : u32; + +var v115 : u32; + +var v116 : u32; + +var v117 : u32; + +var v118 : u32; + +var v119 : u32; + +var v120 : u32; + +var v121 : u32; + +var v122 : u32; + +var v123 : u32; + +var v124 : u32; + +var v125 : u32; + +var v126 : u32; + +var v127 : u32; + +var v128 : u32; + +var v129 : u32; + +var v130 : u32; + +var v131 : u32; + +var v132 : u32; + +var v133 : u32; + +var v134 : u32; + +var v135 : u32; + +var v136 : u32; + +var v137 : u32; + +var v138 : u32; + +var v139 : u32; + +var v140 : u32; + +var v141 : u32; + +var v142 : u32; + +var v143 : u32; + +var v144 : u32; + +var v145 : u32; + +var v146 : u32; + +var v147 : u32; + +var v148 : u32; + +var v149 : u32; + +var v150 : u32; + +var v151 : u32; + +var v152 : u32; + +var v153 : u32; + +var v154 : u32; + +var v155 : u32; + +var v156 : u32; + +var v157 : u32; + +var v158 : u32; + +var v159 : u32; + +var v160 : u32; + +var v161 : u32; + +var v162 : u32; + +var v163 : u32; + +var v164 : u32; + +var v165 : u32; + +var v166 : u32; + +var v167 : u32; + +var v168 : u32; + +var v169 : u32; + +var v170 : u32; + +var v171 : u32; + +var v172 : u32; + +var v173 : u32; + +var v174 : u32; + +var v175 : u32; + +var v176 : u32; + +var v177 : u32; + +var v178 : u32; + +var v179 : u32; + +var v180 : u32; + +var v181 : u32; + +var v182 : u32; + +var v183 : u32; + +var v184 : u32; + +var v185 : u32; + +var v186 : u32; + +var v187 : u32; + +var v188 : u32; + +var v189 : u32; + +var v190 : u32; + +var v191 : u32; + +var v192 : u32; + +var v193 : u32; + +var v194 : u32; + +var v195 : u32; + +var v196 : u32; + +var v197 : u32; + +var v198 : u32; + +var v199 : u32; + +var v200 : u32; + +var v201 : u32; + +var v202 : u32; + +var v203 : u32; + +var v204 : u32; + +var v205 : u32; + +var v206 : u32; + +var v207 : u32; + +var v208 : u32; + +var v209 : u32; + +var v210 : u32; + +var v211 : u32; + +var v212 : u32; + +var v213 : u32; + +var v214 : u32; + +var v215 : u32; + +var v216 : u32; + +var v217 : u32; + +var v218 : u32; + +var v219 : u32; + +var v220 : u32; + +var v221 : u32; + +var v222 : u32; + +var v223 : u32; + +var v224 : u32; + +var v225 : u32; + +var v226 : u32; + +var v227 : u32; + +var v228 : u32; + +var v229 : u32; + +var v230 : u32; + +var v231 : u32; + +var v232 : u32; + +var v233 : u32; + +var v234 : u32; + +var v235 : u32; + +var v236 : u32; + +var v237 : u32; + +var v238 : u32; + +var v239 : u32; + +var v240 : u32; + +var v241 : u32; + +var v242 : u32; + +var v243 : u32; + +var v244 : u32; + +var v245 : u32; + +var v246 : u32; + +var v247 : u32; + +var v248 : u32; + +var v249 : u32; + +var v250 : u32; + +var v251 : u32; + +var v252 : u32; + +var v253 : u32; + +var v254 : u32; + +var v255 : u32; + +var v256 : u32; + +var v257 : u32; + +var v258 : u32; + +var v259 : u32; + +var v260 : u32; + +var v261 : u32; + +var v262 : u32; + +var v263 : u32; + +var v264 : u32; + +var v265 : u32; + +var v266 : u32; + +var v267 : u32; + +var v268 : u32; + +var v269 : u32; + +var v270 : u32; + +var v271 : u32; + +var v272 : u32; + +var v273 : u32; + +var v274 : u32; + +var v275 : u32; + +var v276 : u32; + +var v277 : u32; + +var v278 : u32; + +var v279 : u32; + +var v280 : u32; + +var v281 : u32; + +var v282 : u32; + +var v283 : u32; + +var v284 : u32; + +var v285 : u32; + +var v286 : u32; + +var v287 : u32; + +var v288 : u32; + +var v289 : u32; + +var v290 : u32; + +var v291 : u32; + +var v292 : u32; + +var v293 : u32; + +var v294 : u32; + +var v295 : u32; + +var v296 : u32; + +var v297 : u32; + +var v298 : u32; + +var v299 : u32; + +var v300 : u32; + +var v301 : u32; + +var v302 : u32; + +var v303 : u32; + +var v304 : u32; + +var v305 : u32; + +var v306 : u32; + +var v307 : u32; + +var v308 : u32; + +var v309 : u32; + +var v310 : u32; + +var v311 : u32; + +var v312 : u32; + +var v313 : u32; + +var v314 : u32; + +var v315 : u32; + +var v316 : u32; + +var v317 : u32; + +var v318 : u32; + +var v319 : u32; + +var v320 : u32; + +var v321 : u32; + +var v322 : u32; + +var v323 : u32; + +var v324 : u32; + +var v325 : u32; + +var v326 : u32; + +var v327 : u32; + +var v328 : u32; + +var v329 : u32; + +var v330 : u32; + +var v331 : u32; + +var v332 : u32; + +var v333 : u32; + +var v334 : u32; + +var v335 : u32; + +var v336 : u32; + +var v337 : u32; + +var v338 : u32; + +var v339 : u32; + +var v340 : u32; + +var v341 : u32; + +var v342 : u32; + +var v343 : u32; + +var v344 : u32; + +var v345 : u32; + +var v346 : u32; + +var v347 : u32; + +var v348 : u32; + +var v349 : u32; + +var v350 : u32; + +var v351 : u32; + +var v352 : u32; + +var v353 : u32; + +var v354 : u32; + +var v355 : u32; + +var v356 : u32; + +var v357 : u32; + +var v358 : u32; + +var v359 : u32; + +var v360 : u32; + +var v361 : u32; + +var v362 : u32; + +var v363 : u32; + +var v364 : u32; + +var v365 : u32; + +var v366 : u32; + +var v367 : u32; + +var v368 : u32; + +var v369 : u32; + +var v370 : u32; + +var v371 : u32; + +var v372 : u32; + +var v373 : u32; + +var v374 : u32; + +var v375 : u32; + +var v376 : u32; + +var v377 : u32; + +var v378 : u32; + +var v379 : u32; + +var v380 : u32; + +var v381 : u32; + +var v382 : u32; + +var v383 : u32; + +var v384 : u32; + +var v385 : u32; + +var v386 : u32; + +var v387 : u32; + +var v388 : u32; + +var v389 : u32; + +var v390 : u32; + +var v391 : u32; + +var v392 : u32; + +var v393 : u32; + +var v394 : u32; + +var v395 : u32; + +var v396 : u32; + +var v397 : u32; + +var v398 : u32; + +var v399 : u32; + +var v400 : u32; + +var v401 : u32; + +var v402 : u32; + +var v403 : u32; + +var v404 : u32; + +var v405 : u32; + +var v406 : u32; + +var v407 : u32; + +var v408 : u32; + +var v409 : u32; + +var v410 : u32; + +var v411 : u32; + +var v412 : u32; + +var v413 : u32; + +var v414 : u32; + +var v415 : u32; + +var v416 : u32; + +var v417 : u32; + +var v418 : u32; + +var v419 : u32; + +var v420 : u32; + +var v421 : u32; + +var v422 : u32; + +var v423 : u32; + +var v424 : u32; + +var v425 : u32; + +var v426 : u32; + +var v427 : u32; + +var v428 : u32; + +var v429 : u32; + +var v430 : u32; + +var v431 : u32; + +var v432 : u32; + +var v433 : u32; + +var v434 : u32; + +var v435 : u32; + +var v436 : u32; + +var v437 : u32; + +var v438 : u32; + +var v439 : u32; + +var v440 : u32; + +var v441 : u32; + +var v442 : u32; + +var v443 : u32; + +var v444 : u32; + +var v445 : u32; + +var v446 : u32; + +var v447 : u32; + +var v448 : u32; + +var v449 : u32; + +var v450 : u32; + +var v451 : u32; + +var v452 : u32; + +var v453 : u32; + +var v454 : u32; + +var v455 : u32; + +var v456 : u32; + +var v457 : u32; + +var v458 : u32; + +var v459 : u32; + +var v460 : u32; + +var v461 : u32; + +var v462 : u32; + +var v463 : u32; + +var v464 : u32; + +var v465 : u32; + +var v466 : u32; + +var v467 : u32; + +var v468 : u32; + +var v469 : u32; + +var v470 : u32; + +var v471 : u32; + +var v472 : u32; + +var v473 : u32; + +var v474 : u32; + +var v475 : u32; + +var v476 : u32; + +var v477 : u32; + +var v478 : u32; + +var v479 : u32; + +var v480 : u32; + +var v481 : u32; + +var v482 : u32; + +var v483 : u32; + +var v484 : u32; + +var v485 : u32; + +var v486 : u32; + +var v487 : u32; + +var v488 : u32; + +var v489 : u32; + +var v490 : u32; + +var v491 : u32; + +var v492 : u32; + +var v493 : u32; + +var v494 : u32; + +var v495 : u32; + +var v496 : u32; + +var v497 : u32; + +var v498 : u32; + +var v499 : u32; + +var v500 : u32; + +var v501 : u32; + +var v502 : u32; + +var v503 : u32; + +var v504 : u32; + +var v505 : u32; + +var v506 : u32; + +var v507 : u32; + +var v508 : u32; + +var v509 : u32; + +var v510 : u32; + +var v511 : u32; + +var v512 : u32; + +var v513 : u32; + +var v514 : u32; + +var v515 : u32; + +var v516 : u32; + +var v517 : u32; + +var v518 : u32; + +var v519 : u32; + +var v520 : u32; + +var v521 : u32; + +var v522 : u32; + +var v523 : u32; + +var v524 : u32; + +var v525 : u32; + +var v526 : u32; + +var v527 : u32; + +var v528 : u32; + +var v529 : u32; + +var v530 : u32; + +var v531 : u32; + +var v532 : u32; + +var v533 : u32; + +var v534 : u32; + +var v535 : u32; + +var v536 : u32; + +var v537 : u32; + +var v538 : u32; + +var v539 : u32; + +var v540 : u32; + +var v541 : u32; + +var v542 : u32; + +var v543 : u32; + +var v544 : u32; + +var v545 : u32; + +var v546 : u32; + +var v547 : u32; + +var v548 : u32; + +var v549 : u32; + +var v550 : u32; + +var v551 : u32; + +var v552 : u32; + +var v553 : u32; + +var v554 : u32; + +var v555 : u32; + +var v556 : u32; + +var v557 : u32; + +var v558 : u32; + +var v559 : u32; + +var v560 : u32; + +var v561 : u32; + +var v562 : u32; + +var v563 : u32; + +var v564 : u32; + +var v565 : u32; + +var v566 : u32; + +var v567 : u32; + +var v568 : u32; + +var v569 : u32; + +var v570 : u32; + +var v571 : u32; + +var v572 : u32; + +var v573 : u32; + +var v574 : u32; + +var v575 : u32; + +var v576 : u32; + +var v577 : u32; + +var v578 : u32; + +var v579 : u32; + +var v580 : u32; + +var v581 : u32; + +var v582 : u32; + +var v583 : u32; + +var v584 : u32; + +var v585 : u32; + +var v586 : u32; + +var v587 : u32; + +var v588 : u32; + +var v589 : u32; + +var v590 : u32; + +var v591 : u32; + +var v592 : u32; + +var v593 : u32; + +var v594 : u32; + +var v595 : u32; + +var v596 : u32; + +var v597 : u32; + +var v598 : u32; + +var v599 : u32; + +var v600 : u32; + +var v601 : u32; + +var v602 : u32; + +var v603 : u32; + +var v604 : u32; + +var v605 : u32; + +var v606 : u32; + +var v607 : u32; + +var v608 : u32; + +var v609 : u32; + +var v610 : u32; + +var v611 : u32; + +var v612 : u32; + +var v613 : u32; + +var v614 : u32; + +var v615 : u32; + +var v616 : u32; + +var v617 : u32; + +var v618 : u32; + +var v619 : u32; + +var v620 : u32; + +var v621 : u32; + +var v622 : u32; + +var v623 : u32; + +var v624 : u32; + +var v625 : u32; + +var v626 : u32; + +var v627 : u32; + +var v628 : u32; + +var v629 : u32; + +var v630 : u32; + +var v631 : u32; + +var v632 : u32; + +var v633 : u32; + +var v634 : u32; + +var v635 : u32; + +var v636 : u32; + +var v637 : u32; + +var v638 : u32; + +var v639 : u32; + +var v640 : u32; + +var v641 : u32; + +var v642 : u32; + +var v643 : u32; + +var v644 : u32; + +var v645 : u32; + +var v646 : u32; + +var v647 : u32; + +var v648 : u32; + +var v649 : u32; + +var v650 : u32; + +var v651 : u32; + +var v652 : u32; + +var v653 : u32; + +var v654 : u32; + +var v655 : u32; + +var v656 : u32; + +var v657 : u32; + +var v658 : u32; + +var v659 : u32; + +var v660 : u32; + +var v661 : u32; + +var v662 : u32; + +var v663 : u32; + +var v664 : u32; + +var v665 : u32; + +var v666 : u32; + +var v667 : u32; + +var v668 : u32; + +var v669 : u32; + +var v670 : u32; + +var v671 : u32; + +var v672 : u32; + +var v673 : u32; + +var v674 : u32; + +var v675 : u32; + +var v676 : u32; + +var v677 : u32; + +var v678 : u32; + +var v679 : u32; + +var v680 : u32; + +var v681 : u32; + +var v682 : u32; + +var v683 : u32; + +var v684 : u32; + +var v685 : u32; + +var v686 : u32; + +var v687 : u32; + +var v688 : u32; + +var v689 : u32; + +var v690 : u32; + +var v691 : u32; + +var v692 : u32; + +var v693 : u32; + +var v694 : u32; + +var v695 : u32; + +var v696 : u32; + +var v697 : u32; + +var v698 : u32; + +var v699 : u32; + +var v700 : u32; + +var v701 : u32; + +var v702 : u32; + +var v703 : u32; + +var v704 : u32; + +var v705 : u32; + +var v706 : u32; + +var v707 : u32; + +var v708 : u32; + +var v709 : u32; + +var v710 : u32; + +var v711 : u32; + +var v712 : u32; + +var v713 : u32; + +var v714 : u32; + +var v715 : u32; + +var v716 : u32; + +var v717 : u32; + +var v718 : u32; + +var v719 : u32; + +var v720 : u32; + +var v721 : u32; + +var v722 : u32; + +var v723 : u32; + +var v724 : u32; + +var v725 : u32; + +var v726 : u32; + +var v727 : u32; + +var v728 : u32; + +var v729 : u32; + +var v730 : u32; + +var v731 : u32; + +var v732 : u32; + +var v733 : u32; + +var v734 : u32; + +var v735 : u32; + +var v736 : u32; + +var v737 : u32; + +var v738 : u32; + +var v739 : u32; + +var v740 : u32; + +var v741 : u32; + +var v742 : u32; + +var v743 : u32; + +var v744 : u32; + +var v745 : u32; + +var v746 : u32; + +var v747 : u32; + +var v748 : u32; + +var v749 : u32; + +var v750 : u32; + +var v751 : u32; + +var v752 : u32; + +var v753 : u32; + +var v754 : u32; + +var v755 : u32; + +var v756 : u32; + +var v757 : u32; + +var v758 : u32; + +var v759 : u32; + +var v760 : u32; + +var v761 : u32; + +var v762 : u32; + +var v763 : u32; + +var v764 : u32; + +var v765 : u32; + +var v766 : u32; + +var v767 : u32; + +var v768 : u32; + +var v769 : u32; + +var v770 : u32; + +var v771 : u32; + +var v772 : u32; + +var v773 : u32; + +var v774 : u32; + +var v775 : u32; + +var v776 : u32; + +var v777 : u32; + +var v778 : u32; + +var v779 : u32; + +var v780 : u32; + +var v781 : u32; + +var v782 : u32; + +var v783 : u32; + +var v784 : u32; + +var v785 : u32; + +var v786 : u32; + +var v787 : u32; + +var v788 : u32; + +var v789 : u32; + +var v790 : u32; + +var v791 : u32; + +var v792 : u32; + +var v793 : u32; + +var v794 : u32; + +var v795 : u32; + +var v796 : u32; + +var v797 : u32; + +var v798 : u32; + +var v799 : u32; + +var v800 : u32; + +var v801 : u32; + +var v802 : u32; + +var v803 : u32; + +var v804 : u32; + +var v805 : u32; + +var v806 : u32; + +var v807 : u32; + +var v808 : u32; + +var v809 : u32; + +var v810 : u32; + +var v811 : u32; + +var v812 : u32; + +var v813 : u32; + +var v814 : u32; + +var v815 : u32; + +var v816 : u32; + +var v817 : u32; + +var v818 : u32; + +var v819 : u32; + +var v820 : u32; + +var v821 : u32; + +var v822 : u32; + +var v823 : u32; + +var v824 : u32; + +var v825 : u32; + +var v826 : u32; + +var v827 : u32; + +var v828 : u32; + +var v829 : u32; + +var v830 : u32; + +var v831 : u32; + +var v832 : u32; + +var v833 : u32; + +var v834 : u32; + +var v835 : u32; + +var v836 : u32; + +var v837 : u32; + +var v838 : u32; + +var v839 : u32; + +var v840 : u32; + +var v841 : u32; + +var v842 : u32; + +var v843 : u32; + +var v844 : u32; + +var v845 : u32; + +var v846 : u32; + +var v847 : u32; + +var v848 : u32; + +var v849 : u32; + +var v850 : u32; + +var v851 : u32; + +var v852 : u32; + +var v853 : u32; + +var v854 : u32; + +var v855 : u32; + +var v856 : u32; + +var v857 : u32; + +var v858 : u32; + +var v859 : u32; + +var v860 : u32; + +var v861 : u32; + +var v862 : u32; + +var v863 : u32; + +var v864 : u32; + +var v865 : u32; + +var v866 : u32; + +var v867 : u32; + +var v868 : u32; + +var v869 : u32; + +var v870 : u32; + +var v871 : u32; + +var v872 : u32; + +var v873 : u32; + +var v874 : u32; + +var v875 : u32; + +var v876 : u32; + +var v877 : u32; + +var v878 : u32; + +var v879 : u32; + +var v880 : u32; + +var v881 : u32; + +var v882 : u32; + +var v883 : u32; + +var v884 : u32; + +var v885 : u32; + +var v886 : u32; + +var v887 : u32; + +var v888 : u32; + +var v889 : u32; + +var v890 : u32; + +var v891 : u32; + +var v892 : u32; + +var v893 : u32; + +var v894 : u32; + +var v895 : u32; + +var v896 : u32; + +var v897 : u32; + +var v898 : u32; + +var v899 : u32; + +var v900 : u32; + +var v901 : u32; + +var v902 : u32; + +var v903 : u32; + +var v904 : u32; + +var v905 : u32; + +var v906 : u32; + +var v907 : u32; + +var v908 : u32; + +var v909 : u32; + +var v910 : u32; + +var v911 : u32; + +var v912 : u32; + +var v913 : u32; + +var v914 : u32; + +var v915 : u32; + +var v916 : u32; + +var v917 : u32; + +var v918 : u32; + +var v919 : u32; + +var v920 : u32; + +var v921 : u32; + +var v922 : u32; + +var v923 : u32; + +var v924 : u32; + +var v925 : u32; + +var v926 : u32; + +var v927 : u32; + +var v928 : u32; + +var v929 : u32; + +var v930 : u32; + +var v931 : u32; + +var v932 : u32; + +var v933 : u32; + +var v934 : u32; + +var v935 : u32; + +var v936 : u32; + +var v937 : u32; + +var v938 : u32; + +var v939 : u32; + +var v940 : u32; + +var v941 : u32; + +var v942 : u32; + +var v943 : u32; + +var v944 : u32; + +var v945 : u32; + +var v946 : u32; + +var v947 : u32; + +var v948 : u32; + +var v949 : u32; + +var v950 : u32; + +var v951 : u32; + +var v952 : u32; + +var v953 : u32; + +var v954 : u32; + +var v955 : u32; + +var v956 : u32; + +var v957 : u32; + +var v958 : u32; + +var v959 : u32; + +var v960 : u32; + +var v961 : u32; + +var v962 : u32; + +var v963 : u32; + +var v964 : u32; + +var v965 : u32; + +var v966 : u32; + +var v967 : u32; + +var v968 : u32; + +var v969 : u32; + +var v970 : u32; + +var v971 : u32; + +var v972 : u32; + +var v973 : u32; + +var v974 : u32; + +var v975 : u32; + +var v976 : u32; + +var v977 : u32; + +var v978 : u32; + +var v979 : u32; + +var v980 : u32; + +var v981 : u32; + +var v982 : u32; + +var v983 : u32; + +var v984 : u32; + +var v985 : u32; + +var v986 : u32; + +var v987 : u32; + +var v988 : u32; + +var v989 : u32; + +var v990 : u32; + +var v991 : u32; + +var v992 : u32; + +var v993 : u32; + +var v994 : u32; + +var v995 : u32; + +var v996 : u32; + +var v997 : u32; + +var v998 : u32; + +var v999 : u32; + +fn foo() -> u32 { + var x = 0u; + x += v0; + x += v1; + x += v2; + x += v3; + x += v4; + x += v5; + x += v6; + x += v7; + x += v8; + x += v9; + x += v10; + x += v11; + x += v12; + x += v13; + x += v14; + x += v15; + x += v16; + x += v17; + x += v18; + x += v19; + x += v20; + x += v21; + x += v22; + x += v23; + x += v24; + x += v25; + x += v26; + x += v27; + x += v28; + x += v29; + x += v30; + x += v31; + x += v32; + x += v33; + x += v34; + x += v35; + x += v36; + x += v37; + x += v38; + x += v39; + x += v40; + x += v41; + x += v42; + x += v43; + x += v44; + x += v45; + x += v46; + x += v47; + x += v48; + x += v49; + x += v50; + x += v51; + x += v52; + x += v53; + x += v54; + x += v55; + x += v56; + x += v57; + x += v58; + x += v59; + x += v60; + x += v61; + x += v62; + x += v63; + x += v64; + x += v65; + x += v66; + x += v67; + x += v68; + x += v69; + x += v70; + x += v71; + x += v72; + x += v73; + x += v74; + x += v75; + x += v76; + x += v77; + x += v78; + x += v79; + x += v80; + x += v81; + x += v82; + x += v83; + x += v84; + x += v85; + x += v86; + x += v87; + x += v88; + x += v89; + x += v90; + x += v91; + x += v92; + x += v93; + x += v94; + x += v95; + x += v96; + x += v97; + x += v98; + x += v99; + x += v100; + x += v101; + x += v102; + x += v103; + x += v104; + x += v105; + x += v106; + x += v107; + x += v108; + x += v109; + x += v110; + x += v111; + x += v112; + x += v113; + x += v114; + x += v115; + x += v116; + x += v117; + x += v118; + x += v119; + x += v120; + x += v121; + x += v122; + x += v123; + x += v124; + x += v125; + x += v126; + x += v127; + x += v128; + x += v129; + x += v130; + x += v131; + x += v132; + x += v133; + x += v134; + x += v135; + x += v136; + x += v137; + x += v138; + x += v139; + x += v140; + x += v141; + x += v142; + x += v143; + x += v144; + x += v145; + x += v146; + x += v147; + x += v148; + x += v149; + x += v150; + x += v151; + x += v152; + x += v153; + x += v154; + x += v155; + x += v156; + x += v157; + x += v158; + x += v159; + x += v160; + x += v161; + x += v162; + x += v163; + x += v164; + x += v165; + x += v166; + x += v167; + x += v168; + x += v169; + x += v170; + x += v171; + x += v172; + x += v173; + x += v174; + x += v175; + x += v176; + x += v177; + x += v178; + x += v179; + x += v180; + x += v181; + x += v182; + x += v183; + x += v184; + x += v185; + x += v186; + x += v187; + x += v188; + x += v189; + x += v190; + x += v191; + x += v192; + x += v193; + x += v194; + x += v195; + x += v196; + x += v197; + x += v198; + x += v199; + x += v200; + x += v201; + x += v202; + x += v203; + x += v204; + x += v205; + x += v206; + x += v207; + x += v208; + x += v209; + x += v210; + x += v211; + x += v212; + x += v213; + x += v214; + x += v215; + x += v216; + x += v217; + x += v218; + x += v219; + x += v220; + x += v221; + x += v222; + x += v223; + x += v224; + x += v225; + x += v226; + x += v227; + x += v228; + x += v229; + x += v230; + x += v231; + x += v232; + x += v233; + x += v234; + x += v235; + x += v236; + x += v237; + x += v238; + x += v239; + x += v240; + x += v241; + x += v242; + x += v243; + x += v244; + x += v245; + x += v246; + x += v247; + x += v248; + x += v249; + x += v250; + x += v251; + x += v252; + x += v253; + x += v254; + x += v255; + x += v256; + x += v257; + x += v258; + x += v259; + x += v260; + x += v261; + x += v262; + x += v263; + x += v264; + x += v265; + x += v266; + x += v267; + x += v268; + x += v269; + x += v270; + x += v271; + x += v272; + x += v273; + x += v274; + x += v275; + x += v276; + x += v277; + x += v278; + x += v279; + x += v280; + x += v281; + x += v282; + x += v283; + x += v284; + x += v285; + x += v286; + x += v287; + x += v288; + x += v289; + x += v290; + x += v291; + x += v292; + x += v293; + x += v294; + x += v295; + x += v296; + x += v297; + x += v298; + x += v299; + x += v300; + x += v301; + x += v302; + x += v303; + x += v304; + x += v305; + x += v306; + x += v307; + x += v308; + x += v309; + x += v310; + x += v311; + x += v312; + x += v313; + x += v314; + x += v315; + x += v316; + x += v317; + x += v318; + x += v319; + x += v320; + x += v321; + x += v322; + x += v323; + x += v324; + x += v325; + x += v326; + x += v327; + x += v328; + x += v329; + x += v330; + x += v331; + x += v332; + x += v333; + x += v334; + x += v335; + x += v336; + x += v337; + x += v338; + x += v339; + x += v340; + x += v341; + x += v342; + x += v343; + x += v344; + x += v345; + x += v346; + x += v347; + x += v348; + x += v349; + x += v350; + x += v351; + x += v352; + x += v353; + x += v354; + x += v355; + x += v356; + x += v357; + x += v358; + x += v359; + x += v360; + x += v361; + x += v362; + x += v363; + x += v364; + x += v365; + x += v366; + x += v367; + x += v368; + x += v369; + x += v370; + x += v371; + x += v372; + x += v373; + x += v374; + x += v375; + x += v376; + x += v377; + x += v378; + x += v379; + x += v380; + x += v381; + x += v382; + x += v383; + x += v384; + x += v385; + x += v386; + x += v387; + x += v388; + x += v389; + x += v390; + x += v391; + x += v392; + x += v393; + x += v394; + x += v395; + x += v396; + x += v397; + x += v398; + x += v399; + x += v400; + x += v401; + x += v402; + x += v403; + x += v404; + x += v405; + x += v406; + x += v407; + x += v408; + x += v409; + x += v410; + x += v411; + x += v412; + x += v413; + x += v414; + x += v415; + x += v416; + x += v417; + x += v418; + x += v419; + x += v420; + x += v421; + x += v422; + x += v423; + x += v424; + x += v425; + x += v426; + x += v427; + x += v428; + x += v429; + x += v430; + x += v431; + x += v432; + x += v433; + x += v434; + x += v435; + x += v436; + x += v437; + x += v438; + x += v439; + x += v440; + x += v441; + x += v442; + x += v443; + x += v444; + x += v445; + x += v446; + x += v447; + x += v448; + x += v449; + x += v450; + x += v451; + x += v452; + x += v453; + x += v454; + x += v455; + x += v456; + x += v457; + x += v458; + x += v459; + x += v460; + x += v461; + x += v462; + x += v463; + x += v464; + x += v465; + x += v466; + x += v467; + x += v468; + x += v469; + x += v470; + x += v471; + x += v472; + x += v473; + x += v474; + x += v475; + x += v476; + x += v477; + x += v478; + x += v479; + x += v480; + x += v481; + x += v482; + x += v483; + x += v484; + x += v485; + x += v486; + x += v487; + x += v488; + x += v489; + x += v490; + x += v491; + x += v492; + x += v493; + x += v494; + x += v495; + x += v496; + x += v497; + x += v498; + x += v499; + x += v500; + x += v501; + x += v502; + x += v503; + x += v504; + x += v505; + x += v506; + x += v507; + x += v508; + x += v509; + x += v510; + x += v511; + x += v512; + x += v513; + x += v514; + x += v515; + x += v516; + x += v517; + x += v518; + x += v519; + x += v520; + x += v521; + x += v522; + x += v523; + x += v524; + x += v525; + x += v526; + x += v527; + x += v528; + x += v529; + x += v530; + x += v531; + x += v532; + x += v533; + x += v534; + x += v535; + x += v536; + x += v537; + x += v538; + x += v539; + x += v540; + x += v541; + x += v542; + x += v543; + x += v544; + x += v545; + x += v546; + x += v547; + x += v548; + x += v549; + x += v550; + x += v551; + x += v552; + x += v553; + x += v554; + x += v555; + x += v556; + x += v557; + x += v558; + x += v559; + x += v560; + x += v561; + x += v562; + x += v563; + x += v564; + x += v565; + x += v566; + x += v567; + x += v568; + x += v569; + x += v570; + x += v571; + x += v572; + x += v573; + x += v574; + x += v575; + x += v576; + x += v577; + x += v578; + x += v579; + x += v580; + x += v581; + x += v582; + x += v583; + x += v584; + x += v585; + x += v586; + x += v587; + x += v588; + x += v589; + x += v590; + x += v591; + x += v592; + x += v593; + x += v594; + x += v595; + x += v596; + x += v597; + x += v598; + x += v599; + x += v600; + x += v601; + x += v602; + x += v603; + x += v604; + x += v605; + x += v606; + x += v607; + x += v608; + x += v609; + x += v610; + x += v611; + x += v612; + x += v613; + x += v614; + x += v615; + x += v616; + x += v617; + x += v618; + x += v619; + x += v620; + x += v621; + x += v622; + x += v623; + x += v624; + x += v625; + x += v626; + x += v627; + x += v628; + x += v629; + x += v630; + x += v631; + x += v632; + x += v633; + x += v634; + x += v635; + x += v636; + x += v637; + x += v638; + x += v639; + x += v640; + x += v641; + x += v642; + x += v643; + x += v644; + x += v645; + x += v646; + x += v647; + x += v648; + x += v649; + x += v650; + x += v651; + x += v652; + x += v653; + x += v654; + x += v655; + x += v656; + x += v657; + x += v658; + x += v659; + x += v660; + x += v661; + x += v662; + x += v663; + x += v664; + x += v665; + x += v666; + x += v667; + x += v668; + x += v669; + x += v670; + x += v671; + x += v672; + x += v673; + x += v674; + x += v675; + x += v676; + x += v677; + x += v678; + x += v679; + x += v680; + x += v681; + x += v682; + x += v683; + x += v684; + x += v685; + x += v686; + x += v687; + x += v688; + x += v689; + x += v690; + x += v691; + x += v692; + x += v693; + x += v694; + x += v695; + x += v696; + x += v697; + x += v698; + x += v699; + x += v700; + x += v701; + x += v702; + x += v703; + x += v704; + x += v705; + x += v706; + x += v707; + x += v708; + x += v709; + x += v710; + x += v711; + x += v712; + x += v713; + x += v714; + x += v715; + x += v716; + x += v717; + x += v718; + x += v719; + x += v720; + x += v721; + x += v722; + x += v723; + x += v724; + x += v725; + x += v726; + x += v727; + x += v728; + x += v729; + x += v730; + x += v731; + x += v732; + x += v733; + x += v734; + x += v735; + x += v736; + x += v737; + x += v738; + x += v739; + x += v740; + x += v741; + x += v742; + x += v743; + x += v744; + x += v745; + x += v746; + x += v747; + x += v748; + x += v749; + x += v750; + x += v751; + x += v752; + x += v753; + x += v754; + x += v755; + x += v756; + x += v757; + x += v758; + x += v759; + x += v760; + x += v761; + x += v762; + x += v763; + x += v764; + x += v765; + x += v766; + x += v767; + x += v768; + x += v769; + x += v770; + x += v771; + x += v772; + x += v773; + x += v774; + x += v775; + x += v776; + x += v777; + x += v778; + x += v779; + x += v780; + x += v781; + x += v782; + x += v783; + x += v784; + x += v785; + x += v786; + x += v787; + x += v788; + x += v789; + x += v790; + x += v791; + x += v792; + x += v793; + x += v794; + x += v795; + x += v796; + x += v797; + x += v798; + x += v799; + x += v800; + x += v801; + x += v802; + x += v803; + x += v804; + x += v805; + x += v806; + x += v807; + x += v808; + x += v809; + x += v810; + x += v811; + x += v812; + x += v813; + x += v814; + x += v815; + x += v816; + x += v817; + x += v818; + x += v819; + x += v820; + x += v821; + x += v822; + x += v823; + x += v824; + x += v825; + x += v826; + x += v827; + x += v828; + x += v829; + x += v830; + x += v831; + x += v832; + x += v833; + x += v834; + x += v835; + x += v836; + x += v837; + x += v838; + x += v839; + x += v840; + x += v841; + x += v842; + x += v843; + x += v844; + x += v845; + x += v846; + x += v847; + x += v848; + x += v849; + x += v850; + x += v851; + x += v852; + x += v853; + x += v854; + x += v855; + x += v856; + x += v857; + x += v858; + x += v859; + x += v860; + x += v861; + x += v862; + x += v863; + x += v864; + x += v865; + x += v866; + x += v867; + x += v868; + x += v869; + x += v870; + x += v871; + x += v872; + x += v873; + x += v874; + x += v875; + x += v876; + x += v877; + x += v878; + x += v879; + x += v880; + x += v881; + x += v882; + x += v883; + x += v884; + x += v885; + x += v886; + x += v887; + x += v888; + x += v889; + x += v890; + x += v891; + x += v892; + x += v893; + x += v894; + x += v895; + x += v896; + x += v897; + x += v898; + x += v899; + x += v900; + x += v901; + x += v902; + x += v903; + x += v904; + x += v905; + x += v906; + x += v907; + x += v908; + x += v909; + x += v910; + x += v911; + x += v912; + x += v913; + x += v914; + x += v915; + x += v916; + x += v917; + x += v918; + x += v919; + x += v920; + x += v921; + x += v922; + x += v923; + x += v924; + x += v925; + x += v926; + x += v927; + x += v928; + x += v929; + x += v930; + x += v931; + x += v932; + x += v933; + x += v934; + x += v935; + x += v936; + x += v937; + x += v938; + x += v939; + x += v940; + x += v941; + x += v942; + x += v943; + x += v944; + x += v945; + x += v946; + x += v947; + x += v948; + x += v949; + x += v950; + x += v951; + x += v952; + x += v953; + x += v954; + x += v955; + x += v956; + x += v957; + x += v958; + x += v959; + x += v960; + x += v961; + x += v962; + x += v963; + x += v964; + x += v965; + x += v966; + x += v967; + x += v968; + x += v969; + x += v970; + x += v971; + x += v972; + x += v973; + x += v974; + x += v975; + x += v976; + x += v977; + x += v978; + x += v979; + x += v980; + x += v981; + x += v982; + x += v983; + x += v984; + x += v985; + x += v986; + x += v987; + x += v988; + x += v989; + x += v990; + x += v991; + x += v992; + x += v993; + x += v994; + x += v995; + x += v996; + x += v997; + x += v998; + x += v999; + return x; +} + +@fragment +fn main() -> @location(0) u32 { + return foo(); +} diff --git a/test/tint/bug/tint/1520.spvasm.expected.dxc.hlsl b/test/tint/bug/tint/1520.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..3e2d65fd8c --- /dev/null +++ b/test/tint/bug/tint/1520.spvasm.expected.dxc.hlsl @@ -0,0 +1,168 @@ +int4 value_or_one_if_zero_int4(int4 value) { + return value == int4(0, 0, 0, 0) ? int4(1, 1, 1, 1) : value; +} + +cbuffer cbuffer_x_4 : register(b0, space0) { + uint4 x_4[7]; +}; +static float4 sk_FragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static bool sk_Clockwise = false; +static float4 vcolor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f); + +bool test_int_S1_c0_b() { + int unknown = 0; + bool ok = false; + int4 val = int4(0, 0, 0, 0); + bool x_40 = false; + bool x_54 = false; + bool x_65 = false; + bool x_41_phi = false; + bool x_55_phi = false; + bool x_66_phi = false; + const float x_26 = asfloat(x_4[1].x); + const int x_27 = int(x_26); + unknown = x_27; + ok = true; + x_41_phi = false; + if (true) { + x_40 = all((((0).xxxx / value_or_one_if_zero_int4(int4(x_27, x_27, x_27, x_27))) == (0).xxxx)); + x_41_phi = x_40; + } + const bool x_41 = x_41_phi; + ok = x_41; + const int4 x_44 = int4(x_27, x_27, x_27, x_27); + val = x_44; + const int4 x_47 = (x_44 + (1).xxxx); + val = x_47; + const int4 x_48 = (x_47 - (1).xxxx); + val = x_48; + const int4 x_49 = (x_48 + (1).xxxx); + val = x_49; + const int4 x_50 = (x_49 - (1).xxxx); + val = x_50; + x_55_phi = false; + if (x_41) { + x_54 = all((x_50 == x_44)); + x_55_phi = x_54; + } + const bool x_55 = x_55_phi; + ok = x_55; + const int4 x_58 = (x_50 * (2).xxxx); + val = x_58; + const int4 x_59 = (x_58 / (2).xxxx); + val = x_59; + const int4 x_60 = (x_59 * (2).xxxx); + val = x_60; + const int4 x_61 = (x_60 / (2).xxxx); + val = x_61; + x_66_phi = false; + if (x_55) { + x_65 = all((x_61 == x_44)); + x_66_phi = x_65; + } + const bool x_66 = x_66_phi; + ok = x_66; + return x_66; +} + +void main_1() { + float4 outputColor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 output_S1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float x_8_unknown = 0.0f; + bool x_9_ok = false; + float4 x_10_val = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_116 = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_86 = false; + bool x_99 = false; + bool x_110 = false; + bool x_114 = false; + bool x_87_phi = false; + bool x_100_phi = false; + bool x_111_phi = false; + bool x_115_phi = false; + outputColor_S0 = vcolor_S0; + const float x_77 = asfloat(x_4[1].x); + x_8_unknown = x_77; + x_9_ok = true; + x_87_phi = false; + if (true) { + x_86 = all((((0.0f).xxxx / float4(x_77, x_77, x_77, x_77)) == (0.0f).xxxx)); + x_87_phi = x_86; + } + const bool x_87 = x_87_phi; + x_9_ok = x_87; + const float4 x_89 = float4(x_77, x_77, x_77, x_77); + x_10_val = x_89; + const float4 x_92 = (x_89 + (1.0f).xxxx); + x_10_val = x_92; + const float4 x_93 = (x_92 - (1.0f).xxxx); + x_10_val = x_93; + const float4 x_94 = (x_93 + (1.0f).xxxx); + x_10_val = x_94; + const float4 x_95 = (x_94 - (1.0f).xxxx); + x_10_val = x_95; + x_100_phi = false; + if (x_87) { + x_99 = all((x_95 == x_89)); + x_100_phi = x_99; + } + const bool x_100 = x_100_phi; + x_9_ok = x_100; + const float4 x_103 = (x_95 * (2.0f).xxxx); + x_10_val = x_103; + const float4 x_104 = (x_103 / (2.0f).xxxx); + x_10_val = x_104; + const float4 x_105 = (x_104 * (2.0f).xxxx); + x_10_val = x_105; + const float4 x_106 = (x_105 / (2.0f).xxxx); + x_10_val = x_106; + x_111_phi = false; + if (x_100) { + x_110 = all((x_106 == x_89)); + x_111_phi = x_110; + } + const bool x_111 = x_111_phi; + x_9_ok = x_111; + x_115_phi = false; + if (x_111) { + x_114 = test_int_S1_c0_b(); + x_115_phi = x_114; + } + if (x_115_phi) { + const float4 x_122 = asfloat(x_4[3]); + x_116 = x_122; + } else { + const float4 x_124 = asfloat(x_4[2]); + x_116 = x_124; + } + const float4 x_125 = x_116; + output_S1 = x_125; + sk_FragColor = x_125; + return; +} + +struct main_out { + float4 sk_FragColor_1; +}; +struct tint_symbol_1 { + float4 vcolor_S0_param : TEXCOORD0; + bool sk_Clockwise_param : SV_IsFrontFace; +}; +struct tint_symbol_2 { + float4 sk_FragColor_1 : SV_Target0; +}; + +main_out main_inner(bool sk_Clockwise_param, float4 vcolor_S0_param) { + sk_Clockwise = sk_Clockwise_param; + vcolor_S0 = vcolor_S0_param; + main_1(); + const main_out tint_symbol_5 = {sk_FragColor}; + return tint_symbol_5; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.sk_Clockwise_param, tint_symbol.vcolor_S0_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.sk_FragColor_1 = inner_result.sk_FragColor_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1520.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/1520.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..3e2d65fd8c --- /dev/null +++ b/test/tint/bug/tint/1520.spvasm.expected.fxc.hlsl @@ -0,0 +1,168 @@ +int4 value_or_one_if_zero_int4(int4 value) { + return value == int4(0, 0, 0, 0) ? int4(1, 1, 1, 1) : value; +} + +cbuffer cbuffer_x_4 : register(b0, space0) { + uint4 x_4[7]; +}; +static float4 sk_FragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static bool sk_Clockwise = false; +static float4 vcolor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f); + +bool test_int_S1_c0_b() { + int unknown = 0; + bool ok = false; + int4 val = int4(0, 0, 0, 0); + bool x_40 = false; + bool x_54 = false; + bool x_65 = false; + bool x_41_phi = false; + bool x_55_phi = false; + bool x_66_phi = false; + const float x_26 = asfloat(x_4[1].x); + const int x_27 = int(x_26); + unknown = x_27; + ok = true; + x_41_phi = false; + if (true) { + x_40 = all((((0).xxxx / value_or_one_if_zero_int4(int4(x_27, x_27, x_27, x_27))) == (0).xxxx)); + x_41_phi = x_40; + } + const bool x_41 = x_41_phi; + ok = x_41; + const int4 x_44 = int4(x_27, x_27, x_27, x_27); + val = x_44; + const int4 x_47 = (x_44 + (1).xxxx); + val = x_47; + const int4 x_48 = (x_47 - (1).xxxx); + val = x_48; + const int4 x_49 = (x_48 + (1).xxxx); + val = x_49; + const int4 x_50 = (x_49 - (1).xxxx); + val = x_50; + x_55_phi = false; + if (x_41) { + x_54 = all((x_50 == x_44)); + x_55_phi = x_54; + } + const bool x_55 = x_55_phi; + ok = x_55; + const int4 x_58 = (x_50 * (2).xxxx); + val = x_58; + const int4 x_59 = (x_58 / (2).xxxx); + val = x_59; + const int4 x_60 = (x_59 * (2).xxxx); + val = x_60; + const int4 x_61 = (x_60 / (2).xxxx); + val = x_61; + x_66_phi = false; + if (x_55) { + x_65 = all((x_61 == x_44)); + x_66_phi = x_65; + } + const bool x_66 = x_66_phi; + ok = x_66; + return x_66; +} + +void main_1() { + float4 outputColor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 output_S1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float x_8_unknown = 0.0f; + bool x_9_ok = false; + float4 x_10_val = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_116 = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_86 = false; + bool x_99 = false; + bool x_110 = false; + bool x_114 = false; + bool x_87_phi = false; + bool x_100_phi = false; + bool x_111_phi = false; + bool x_115_phi = false; + outputColor_S0 = vcolor_S0; + const float x_77 = asfloat(x_4[1].x); + x_8_unknown = x_77; + x_9_ok = true; + x_87_phi = false; + if (true) { + x_86 = all((((0.0f).xxxx / float4(x_77, x_77, x_77, x_77)) == (0.0f).xxxx)); + x_87_phi = x_86; + } + const bool x_87 = x_87_phi; + x_9_ok = x_87; + const float4 x_89 = float4(x_77, x_77, x_77, x_77); + x_10_val = x_89; + const float4 x_92 = (x_89 + (1.0f).xxxx); + x_10_val = x_92; + const float4 x_93 = (x_92 - (1.0f).xxxx); + x_10_val = x_93; + const float4 x_94 = (x_93 + (1.0f).xxxx); + x_10_val = x_94; + const float4 x_95 = (x_94 - (1.0f).xxxx); + x_10_val = x_95; + x_100_phi = false; + if (x_87) { + x_99 = all((x_95 == x_89)); + x_100_phi = x_99; + } + const bool x_100 = x_100_phi; + x_9_ok = x_100; + const float4 x_103 = (x_95 * (2.0f).xxxx); + x_10_val = x_103; + const float4 x_104 = (x_103 / (2.0f).xxxx); + x_10_val = x_104; + const float4 x_105 = (x_104 * (2.0f).xxxx); + x_10_val = x_105; + const float4 x_106 = (x_105 / (2.0f).xxxx); + x_10_val = x_106; + x_111_phi = false; + if (x_100) { + x_110 = all((x_106 == x_89)); + x_111_phi = x_110; + } + const bool x_111 = x_111_phi; + x_9_ok = x_111; + x_115_phi = false; + if (x_111) { + x_114 = test_int_S1_c0_b(); + x_115_phi = x_114; + } + if (x_115_phi) { + const float4 x_122 = asfloat(x_4[3]); + x_116 = x_122; + } else { + const float4 x_124 = asfloat(x_4[2]); + x_116 = x_124; + } + const float4 x_125 = x_116; + output_S1 = x_125; + sk_FragColor = x_125; + return; +} + +struct main_out { + float4 sk_FragColor_1; +}; +struct tint_symbol_1 { + float4 vcolor_S0_param : TEXCOORD0; + bool sk_Clockwise_param : SV_IsFrontFace; +}; +struct tint_symbol_2 { + float4 sk_FragColor_1 : SV_Target0; +}; + +main_out main_inner(bool sk_Clockwise_param, float4 vcolor_S0_param) { + sk_Clockwise = sk_Clockwise_param; + vcolor_S0 = vcolor_S0_param; + main_1(); + const main_out tint_symbol_5 = {sk_FragColor}; + return tint_symbol_5; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.sk_Clockwise_param, tint_symbol.vcolor_S0_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.sk_FragColor_1 = inner_result.sk_FragColor_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1520.spvasm.expected.glsl b/test/tint/bug/tint/1520.spvasm.expected.glsl index 358bd77bbf..468864c04f 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.glsl +++ b/test/tint/bug/tint/1520.spvasm.expected.glsl @@ -36,20 +36,20 @@ bool test_int_S1_c0_b() { ok = true; x_41_phi = false; if (true) { - x_40 = all(equal((ivec4(0, 0, 0, 0) / ivec4(x_27, x_27, x_27, x_27)), ivec4(0, 0, 0, 0))); + x_40 = all(equal((ivec4(0) / ivec4(x_27, x_27, x_27, x_27)), ivec4(0))); x_41_phi = x_40; } bool x_41 = x_41_phi; ok = x_41; ivec4 x_44 = ivec4(x_27, x_27, x_27, x_27); val = x_44; - ivec4 x_47 = (x_44 + ivec4(1, 1, 1, 1)); + ivec4 x_47 = (x_44 + ivec4(1)); val = x_47; - ivec4 x_48 = (x_47 - ivec4(1, 1, 1, 1)); + ivec4 x_48 = (x_47 - ivec4(1)); val = x_48; - ivec4 x_49 = (x_48 + ivec4(1, 1, 1, 1)); + ivec4 x_49 = (x_48 + ivec4(1)); val = x_49; - ivec4 x_50 = (x_49 - ivec4(1, 1, 1, 1)); + ivec4 x_50 = (x_49 - ivec4(1)); val = x_50; x_55_phi = false; if (x_41) { @@ -58,13 +58,13 @@ bool test_int_S1_c0_b() { } bool x_55 = x_55_phi; ok = x_55; - ivec4 x_58 = (x_50 * ivec4(2, 2, 2, 2)); + ivec4 x_58 = (x_50 * ivec4(2)); val = x_58; - ivec4 x_59 = (x_58 / ivec4(2, 2, 2, 2)); + ivec4 x_59 = (x_58 / ivec4(2)); val = x_59; - ivec4 x_60 = (x_59 * ivec4(2, 2, 2, 2)); + ivec4 x_60 = (x_59 * ivec4(2)); val = x_60; - ivec4 x_61 = (x_60 / ivec4(2, 2, 2, 2)); + ivec4 x_61 = (x_60 / ivec4(2)); val = x_61; x_66_phi = false; if (x_55) { @@ -97,20 +97,20 @@ void main_1() { x_9_ok = true; x_87_phi = false; if (true) { - x_86 = all(equal((vec4(0.0f, 0.0f, 0.0f, 0.0f) / vec4(x_77, x_77, x_77, x_77)), vec4(0.0f, 0.0f, 0.0f, 0.0f))); + x_86 = all(equal((vec4(0.0f) / vec4(x_77, x_77, x_77, x_77)), vec4(0.0f))); x_87_phi = x_86; } bool x_87 = x_87_phi; x_9_ok = x_87; vec4 x_89 = vec4(x_77, x_77, x_77, x_77); x_10_val = x_89; - vec4 x_92 = (x_89 + vec4(1.0f, 1.0f, 1.0f, 1.0f)); + vec4 x_92 = (x_89 + vec4(1.0f)); x_10_val = x_92; - vec4 x_93 = (x_92 - vec4(1.0f, 1.0f, 1.0f, 1.0f)); + vec4 x_93 = (x_92 - vec4(1.0f)); x_10_val = x_93; - vec4 x_94 = (x_93 + vec4(1.0f, 1.0f, 1.0f, 1.0f)); + vec4 x_94 = (x_93 + vec4(1.0f)); x_10_val = x_94; - vec4 x_95 = (x_94 - vec4(1.0f, 1.0f, 1.0f, 1.0f)); + vec4 x_95 = (x_94 - vec4(1.0f)); x_10_val = x_95; x_100_phi = false; if (x_87) { @@ -119,13 +119,13 @@ void main_1() { } bool x_100 = x_100_phi; x_9_ok = x_100; - vec4 x_103 = (x_95 * vec4(2.0f, 2.0f, 2.0f, 2.0f)); + vec4 x_103 = (x_95 * vec4(2.0f)); x_10_val = x_103; - vec4 x_104 = (x_103 / vec4(2.0f, 2.0f, 2.0f, 2.0f)); + vec4 x_104 = (x_103 / vec4(2.0f)); x_10_val = x_104; - vec4 x_105 = (x_104 * vec4(2.0f, 2.0f, 2.0f, 2.0f)); + vec4 x_105 = (x_104 * vec4(2.0f)); x_10_val = x_105; - vec4 x_106 = (x_105 / vec4(2.0f, 2.0f, 2.0f, 2.0f)); + vec4 x_106 = (x_105 / vec4(2.0f)); x_10_val = x_106; x_111_phi = false; if (x_100) { diff --git a/test/tint/bug/tint/1520.spvasm.expected.hlsl b/test/tint/bug/tint/1520.spvasm.expected.hlsl deleted file mode 100644 index 052cd99b88..0000000000 --- a/test/tint/bug/tint/1520.spvasm.expected.hlsl +++ /dev/null @@ -1,168 +0,0 @@ -int4 value_or_one_if_zero_int4(int4 value) { - return value == int4(0, 0, 0, 0) ? int4(1, 1, 1, 1) : value; -} - -cbuffer cbuffer_x_4 : register(b0, space0) { - uint4 x_4[7]; -}; -static float4 sk_FragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); -static bool sk_Clockwise = false; -static float4 vcolor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f); - -bool test_int_S1_c0_b() { - int unknown = 0; - bool ok = false; - int4 val = int4(0, 0, 0, 0); - bool x_40 = false; - bool x_54 = false; - bool x_65 = false; - bool x_41_phi = false; - bool x_55_phi = false; - bool x_66_phi = false; - const float x_26 = asfloat(x_4[1].x); - const int x_27 = int(x_26); - unknown = x_27; - ok = true; - x_41_phi = false; - if (true) { - x_40 = all(((int4(0, 0, 0, 0) / value_or_one_if_zero_int4(int4(x_27, x_27, x_27, x_27))) == int4(0, 0, 0, 0))); - x_41_phi = x_40; - } - const bool x_41 = x_41_phi; - ok = x_41; - const int4 x_44 = int4(x_27, x_27, x_27, x_27); - val = x_44; - const int4 x_47 = (x_44 + int4(1, 1, 1, 1)); - val = x_47; - const int4 x_48 = (x_47 - int4(1, 1, 1, 1)); - val = x_48; - const int4 x_49 = (x_48 + int4(1, 1, 1, 1)); - val = x_49; - const int4 x_50 = (x_49 - int4(1, 1, 1, 1)); - val = x_50; - x_55_phi = false; - if (x_41) { - x_54 = all((x_50 == x_44)); - x_55_phi = x_54; - } - const bool x_55 = x_55_phi; - ok = x_55; - const int4 x_58 = (x_50 * int4(2, 2, 2, 2)); - val = x_58; - const int4 x_59 = (x_58 / int4(2, 2, 2, 2)); - val = x_59; - const int4 x_60 = (x_59 * int4(2, 2, 2, 2)); - val = x_60; - const int4 x_61 = (x_60 / int4(2, 2, 2, 2)); - val = x_61; - x_66_phi = false; - if (x_55) { - x_65 = all((x_61 == x_44)); - x_66_phi = x_65; - } - const bool x_66 = x_66_phi; - ok = x_66; - return x_66; -} - -void main_1() { - float4 outputColor_S0 = float4(0.0f, 0.0f, 0.0f, 0.0f); - float4 output_S1 = float4(0.0f, 0.0f, 0.0f, 0.0f); - float x_8_unknown = 0.0f; - bool x_9_ok = false; - float4 x_10_val = float4(0.0f, 0.0f, 0.0f, 0.0f); - float4 x_116 = float4(0.0f, 0.0f, 0.0f, 0.0f); - bool x_86 = false; - bool x_99 = false; - bool x_110 = false; - bool x_114 = false; - bool x_87_phi = false; - bool x_100_phi = false; - bool x_111_phi = false; - bool x_115_phi = false; - outputColor_S0 = vcolor_S0; - const float x_77 = asfloat(x_4[1].x); - x_8_unknown = x_77; - x_9_ok = true; - x_87_phi = false; - if (true) { - x_86 = all(((float4(0.0f, 0.0f, 0.0f, 0.0f) / float4(x_77, x_77, x_77, x_77)) == float4(0.0f, 0.0f, 0.0f, 0.0f))); - x_87_phi = x_86; - } - const bool x_87 = x_87_phi; - x_9_ok = x_87; - const float4 x_89 = float4(x_77, x_77, x_77, x_77); - x_10_val = x_89; - const float4 x_92 = (x_89 + float4(1.0f, 1.0f, 1.0f, 1.0f)); - x_10_val = x_92; - const float4 x_93 = (x_92 - float4(1.0f, 1.0f, 1.0f, 1.0f)); - x_10_val = x_93; - const float4 x_94 = (x_93 + float4(1.0f, 1.0f, 1.0f, 1.0f)); - x_10_val = x_94; - const float4 x_95 = (x_94 - float4(1.0f, 1.0f, 1.0f, 1.0f)); - x_10_val = x_95; - x_100_phi = false; - if (x_87) { - x_99 = all((x_95 == x_89)); - x_100_phi = x_99; - } - const bool x_100 = x_100_phi; - x_9_ok = x_100; - const float4 x_103 = (x_95 * float4(2.0f, 2.0f, 2.0f, 2.0f)); - x_10_val = x_103; - const float4 x_104 = (x_103 / float4(2.0f, 2.0f, 2.0f, 2.0f)); - x_10_val = x_104; - const float4 x_105 = (x_104 * float4(2.0f, 2.0f, 2.0f, 2.0f)); - x_10_val = x_105; - const float4 x_106 = (x_105 / float4(2.0f, 2.0f, 2.0f, 2.0f)); - x_10_val = x_106; - x_111_phi = false; - if (x_100) { - x_110 = all((x_106 == x_89)); - x_111_phi = x_110; - } - const bool x_111 = x_111_phi; - x_9_ok = x_111; - x_115_phi = false; - if (x_111) { - x_114 = test_int_S1_c0_b(); - x_115_phi = x_114; - } - if (x_115_phi) { - const float4 x_122 = asfloat(x_4[3]); - x_116 = x_122; - } else { - const float4 x_124 = asfloat(x_4[2]); - x_116 = x_124; - } - const float4 x_125 = x_116; - output_S1 = x_125; - sk_FragColor = x_125; - return; -} - -struct main_out { - float4 sk_FragColor_1; -}; -struct tint_symbol_1 { - float4 vcolor_S0_param : TEXCOORD0; - bool sk_Clockwise_param : SV_IsFrontFace; -}; -struct tint_symbol_2 { - float4 sk_FragColor_1 : SV_Target0; -}; - -main_out main_inner(bool sk_Clockwise_param, float4 vcolor_S0_param) { - sk_Clockwise = sk_Clockwise_param; - vcolor_S0 = vcolor_S0_param; - main_1(); - const main_out tint_symbol_5 = {sk_FragColor}; - return tint_symbol_5; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.sk_Clockwise_param, tint_symbol.vcolor_S0_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.sk_FragColor_1 = inner_result.sk_FragColor_1; - return wrapper_result; -} diff --git a/test/tint/bug/tint/1520.spvasm.expected.msl b/test/tint/bug/tint/1520.spvasm.expected.msl index 3e2b30a23b..030f92f3b8 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.msl +++ b/test/tint/bug/tint/1520.spvasm.expected.msl @@ -1,10 +1,23 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct UniformBuffer { - /* 0x0000 */ int8_t tint_pad[16]; + /* 0x0000 */ tint_array tint_pad; /* 0x0010 */ float unknownInput_S1_c0; - /* 0x0014 */ int8_t tint_pad_1[12]; + /* 0x0014 */ tint_array tint_pad_1; /* 0x0020 */ float4 ucolorRed_S1_c0; /* 0x0030 */ float4 ucolorGreen_S1_c0; /* 0x0040 */ float3x3 umatrix_S1; @@ -26,20 +39,20 @@ bool test_int_S1_c0_b(const constant UniformBuffer* const tint_symbol_5) { ok = true; x_41_phi = false; if (true) { - x_40 = all(((int4(0, 0, 0, 0) / int4(x_27, x_27, x_27, x_27)) == int4(0, 0, 0, 0))); + x_40 = all(((int4(0) / int4(x_27, x_27, x_27, x_27)) == int4(0))); x_41_phi = x_40; } bool const x_41 = x_41_phi; ok = x_41; int4 const x_44 = int4(x_27, x_27, x_27, x_27); val = x_44; - int4 const x_47 = as_type((as_type(x_44) + as_type(int4(1, 1, 1, 1)))); + int4 const x_47 = as_type((as_type(x_44) + as_type(int4(1)))); val = x_47; - int4 const x_48 = as_type((as_type(x_47) - as_type(int4(1, 1, 1, 1)))); + int4 const x_48 = as_type((as_type(x_47) - as_type(int4(1)))); val = x_48; - int4 const x_49 = as_type((as_type(x_48) + as_type(int4(1, 1, 1, 1)))); + int4 const x_49 = as_type((as_type(x_48) + as_type(int4(1)))); val = x_49; - int4 const x_50 = as_type((as_type(x_49) - as_type(int4(1, 1, 1, 1)))); + int4 const x_50 = as_type((as_type(x_49) - as_type(int4(1)))); val = x_50; x_55_phi = false; if (x_41) { @@ -48,13 +61,13 @@ bool test_int_S1_c0_b(const constant UniformBuffer* const tint_symbol_5) { } bool const x_55 = x_55_phi; ok = x_55; - int4 const x_58 = as_type((as_type(x_50) * as_type(int4(2, 2, 2, 2)))); + int4 const x_58 = as_type((as_type(x_50) * as_type(int4(2)))); val = x_58; - int4 const x_59 = (x_58 / int4(2, 2, 2, 2)); + int4 const x_59 = (x_58 / int4(2)); val = x_59; - int4 const x_60 = as_type((as_type(x_59) * as_type(int4(2, 2, 2, 2)))); + int4 const x_60 = as_type((as_type(x_59) * as_type(int4(2)))); val = x_60; - int4 const x_61 = (x_60 / int4(2, 2, 2, 2)); + int4 const x_61 = (x_60 / int4(2)); val = x_61; x_66_phi = false; if (x_55) { @@ -88,20 +101,20 @@ void main_1(thread float4* const tint_symbol_6, const constant UniformBuffer* co x_9_ok = true; x_87_phi = false; if (true) { - x_86 = all(((float4(0.0f, 0.0f, 0.0f, 0.0f) / float4(x_77, x_77, x_77, x_77)) == float4(0.0f, 0.0f, 0.0f, 0.0f))); + x_86 = all(((float4(0.0f) / float4(x_77, x_77, x_77, x_77)) == float4(0.0f))); x_87_phi = x_86; } bool const x_87 = x_87_phi; x_9_ok = x_87; float4 const x_89 = float4(x_77, x_77, x_77, x_77); x_10_val = x_89; - float4 const x_92 = (x_89 + float4(1.0f, 1.0f, 1.0f, 1.0f)); + float4 const x_92 = (x_89 + float4(1.0f)); x_10_val = x_92; - float4 const x_93 = (x_92 - float4(1.0f, 1.0f, 1.0f, 1.0f)); + float4 const x_93 = (x_92 - float4(1.0f)); x_10_val = x_93; - float4 const x_94 = (x_93 + float4(1.0f, 1.0f, 1.0f, 1.0f)); + float4 const x_94 = (x_93 + float4(1.0f)); x_10_val = x_94; - float4 const x_95 = (x_94 - float4(1.0f, 1.0f, 1.0f, 1.0f)); + float4 const x_95 = (x_94 - float4(1.0f)); x_10_val = x_95; x_100_phi = false; if (x_87) { @@ -110,13 +123,13 @@ void main_1(thread float4* const tint_symbol_6, const constant UniformBuffer* co } bool const x_100 = x_100_phi; x_9_ok = x_100; - float4 const x_103 = (x_95 * float4(2.0f, 2.0f, 2.0f, 2.0f)); + float4 const x_103 = (x_95 * float4(2.0f)); x_10_val = x_103; - float4 const x_104 = (x_103 / float4(2.0f, 2.0f, 2.0f, 2.0f)); + float4 const x_104 = (x_103 / float4(2.0f)); x_10_val = x_104; - float4 const x_105 = (x_104 * float4(2.0f, 2.0f, 2.0f, 2.0f)); + float4 const x_105 = (x_104 * float4(2.0f)); x_10_val = x_105; - float4 const x_106 = (x_105 / float4(2.0f, 2.0f, 2.0f, 2.0f)); + float4 const x_106 = (x_105 / float4(2.0f)); x_10_val = x_106; x_111_phi = false; if (x_100) { @@ -156,19 +169,19 @@ struct tint_symbol_3 { float4 sk_FragColor_1 [[color(0)]]; }; -main_out tint_symbol_inner(bool sk_Clockwise_param, float4 vcolor_S0_param, thread bool* const tint_symbol_9, thread float4* const tint_symbol_10, const constant UniformBuffer* const tint_symbol_11, thread float4* const tint_symbol_12) { - *(tint_symbol_9) = sk_Clockwise_param; +main_out tint_symbol_inner(bool sk_Clockwise_param, float4 vcolor_S0_param, thread float4* const tint_symbol_10, const constant UniformBuffer* const tint_symbol_11, thread float4* const tint_symbol_12) { + thread bool tint_symbol_9 = false; + tint_symbol_9 = sk_Clockwise_param; *(tint_symbol_10) = vcolor_S0_param; main_1(tint_symbol_10, tint_symbol_11, tint_symbol_12); main_out const tint_symbol_4 = {.sk_FragColor_1=*(tint_symbol_12)}; return tint_symbol_4; } -fragment tint_symbol_3 tint_symbol(const constant UniformBuffer* tint_symbol_15 [[buffer(0)]], bool sk_Clockwise_param [[front_facing]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { - thread bool tint_symbol_13 = false; - thread float4 tint_symbol_14 = 0.0f; - thread float4 tint_symbol_16 = 0.0f; - main_out const inner_result = tint_symbol_inner(sk_Clockwise_param, tint_symbol_1.vcolor_S0_param, &(tint_symbol_13), &(tint_symbol_14), tint_symbol_15, &(tint_symbol_16)); +fragment tint_symbol_3 tint_symbol(const constant UniformBuffer* tint_symbol_14 [[buffer(0)]], bool sk_Clockwise_param [[front_facing]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_13 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + main_out const inner_result = tint_symbol_inner(sk_Clockwise_param, tint_symbol_1.vcolor_S0_param, &(tint_symbol_13), tint_symbol_14, &(tint_symbol_15)); tint_symbol_3 wrapper_result = {}; wrapper_result.sk_FragColor_1 = inner_result.sk_FragColor_1; return wrapper_result; diff --git a/test/tint/bug/tint/1520.spvasm.expected.spvasm b/test/tint/bug/tint/1520.spvasm.expected.spvasm index ad913296c2..b5fd273820 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.spvasm +++ b/test/tint/bug/tint/1520.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 175 +; Bound: 170 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -97,30 +97,25 @@ %uint_0 = OpConstant %uint 0 %_ptr_Uniform_float = OpTypePointer Uniform %float %true = OpConstantTrue %bool - %false = OpConstantFalse %bool - %int_0 = OpConstant %int 0 - %53 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 %v4bool = OpTypeVector %bool 4 %int_1 = OpConstant %int 1 - %62 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 + %59 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %int_2 = OpConstant %int 2 - %74 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 + %71 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %void = OpTypeVoid - %85 = OpTypeFunction %void + %82 = OpTypeFunction %void %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_float = OpTypePointer Function %float - %94 = OpConstantNull %float - %float_0 = OpConstant %float 0 - %113 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %91 = OpConstantNull %float %float_1 = OpConstant %float 1 - %121 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %116 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %float_2 = OpConstant %float 2 - %133 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %128 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 %uint_2 = OpConstant %uint 2 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %uint_1 = OpConstant %uint 1 %main_out = OpTypeStruct %v4float - %160 = OpTypeFunction %main_out %bool %v4float + %155 = OpTypeFunction %main_out %bool %v4float %test_int_S1_c0_b = OpFunction %bool None %22 %24 = OpLabel %unknown = OpVariable %_ptr_Function_int Function %28 @@ -137,72 +132,72 @@ %46 = OpConvertFToS %int %45 OpStore %unknown %46 OpStore %ok %true - OpStore %x_41_phi %false - OpSelectionMerge %49 None - OpBranchConditional %true %50 %49 - %50 = OpLabel - %54 = OpCompositeConstruct %v4int %46 %46 %46 %46 - %55 = OpSDiv %v4int %53 %54 - %56 = OpIEqual %v4bool %55 %53 - %51 = OpAll %bool %56 - OpStore %x_40 %51 - %58 = OpLoad %bool %x_40 - OpStore %x_41_phi %58 - OpBranch %49 + OpStore %x_41_phi %20 + OpSelectionMerge %48 None + OpBranchConditional %true %49 %48 %49 = OpLabel - %59 = OpLoad %bool %x_41_phi - OpStore %ok %59 - %60 = OpCompositeConstruct %v4int %46 %46 %46 %46 + %51 = OpCompositeConstruct %v4int %46 %46 %46 %46 + %52 = OpSDiv %v4int %34 %51 + %53 = OpIEqual %v4bool %52 %34 + %50 = OpAll %bool %53 + OpStore %x_40 %50 + %55 = OpLoad %bool %x_40 + OpStore %x_41_phi %55 + OpBranch %48 + %48 = OpLabel + %56 = OpLoad %bool %x_41_phi + OpStore %ok %56 + %57 = OpCompositeConstruct %v4int %46 %46 %46 %46 + OpStore %val %57 + %60 = OpIAdd %v4int %57 %59 OpStore %val %60 - %63 = OpIAdd %v4int %60 %62 + %61 = OpISub %v4int %60 %59 + OpStore %val %61 + %62 = OpIAdd %v4int %61 %59 + OpStore %val %62 + %63 = OpISub %v4int %62 %59 OpStore %val %63 - %64 = OpISub %v4int %63 %62 - OpStore %val %64 - %65 = OpIAdd %v4int %64 %62 - OpStore %val %65 - %66 = OpISub %v4int %65 %62 - OpStore %val %66 - OpStore %x_55_phi %false - OpSelectionMerge %67 None - OpBranchConditional %59 %68 %67 - %68 = OpLabel - %70 = OpIEqual %v4bool %66 %60 - %69 = OpAll %bool %70 - OpStore %x_54 %69 - %71 = OpLoad %bool %x_54 - OpStore %x_55_phi %71 - OpBranch %67 - %67 = OpLabel - %72 = OpLoad %bool %x_55_phi - OpStore %ok %72 - %75 = OpIMul %v4int %66 %74 + OpStore %x_55_phi %20 + OpSelectionMerge %64 None + OpBranchConditional %56 %65 %64 + %65 = OpLabel + %67 = OpIEqual %v4bool %63 %57 + %66 = OpAll %bool %67 + OpStore %x_54 %66 + %68 = OpLoad %bool %x_54 + OpStore %x_55_phi %68 + OpBranch %64 + %64 = OpLabel + %69 = OpLoad %bool %x_55_phi + OpStore %ok %69 + %72 = OpIMul %v4int %63 %71 + OpStore %val %72 + %73 = OpSDiv %v4int %72 %71 + OpStore %val %73 + %74 = OpIMul %v4int %73 %71 + OpStore %val %74 + %75 = OpSDiv %v4int %74 %71 OpStore %val %75 - %76 = OpSDiv %v4int %75 %74 - OpStore %val %76 - %77 = OpIMul %v4int %76 %74 - OpStore %val %77 - %78 = OpSDiv %v4int %77 %74 - OpStore %val %78 - OpStore %x_66_phi %false - OpSelectionMerge %79 None - OpBranchConditional %72 %80 %79 - %80 = OpLabel - %82 = OpIEqual %v4bool %78 %60 - %81 = OpAll %bool %82 - OpStore %x_65 %81 - %83 = OpLoad %bool %x_65 - OpStore %x_66_phi %83 - OpBranch %79 - %79 = OpLabel - %84 = OpLoad %bool %x_66_phi - OpStore %ok %84 - OpReturnValue %84 + OpStore %x_66_phi %20 + OpSelectionMerge %76 None + OpBranchConditional %69 %77 %76 + %77 = OpLabel + %79 = OpIEqual %v4bool %75 %57 + %78 = OpAll %bool %79 + OpStore %x_65 %78 + %80 = OpLoad %bool %x_65 + OpStore %x_66_phi %80 + OpBranch %76 + %76 = OpLabel + %81 = OpLoad %bool %x_66_phi + OpStore %ok %81 + OpReturnValue %81 OpFunctionEnd - %main_1 = OpFunction %void None %85 - %88 = OpLabel + %main_1 = OpFunction %void None %82 + %85 = OpLabel %outputColor_S0 = OpVariable %_ptr_Function_v4float Function %10 %output_S1 = OpVariable %_ptr_Function_v4float Function %10 -%x_8_unknown = OpVariable %_ptr_Function_float Function %94 +%x_8_unknown = OpVariable %_ptr_Function_float Function %91 %x_9_ok = OpVariable %_ptr_Function_bool Function %20 %x_10_val = OpVariable %_ptr_Function_v4float Function %10 %x_116 = OpVariable %_ptr_Function_v4float Function %10 @@ -214,117 +209,117 @@ %x_100_phi = OpVariable %_ptr_Function_bool Function %20 %x_111_phi = OpVariable %_ptr_Function_bool Function %20 %x_115_phi = OpVariable %_ptr_Function_bool Function %20 - %106 = OpLoad %v4float %vcolor_S0 - OpStore %outputColor_S0 %106 - %107 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 - %108 = OpLoad %float %107 - OpStore %x_8_unknown %108 + %103 = OpLoad %v4float %vcolor_S0 + OpStore %outputColor_S0 %103 + %104 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 + %105 = OpLoad %float %104 + OpStore %x_8_unknown %105 OpStore %x_9_ok %true - OpStore %x_87_phi %false - OpSelectionMerge %109 None - OpBranchConditional %true %110 %109 - %110 = OpLabel - %114 = OpCompositeConstruct %v4float %108 %108 %108 %108 - %115 = OpFDiv %v4float %113 %114 - %116 = OpFOrdEqual %v4bool %115 %113 - %111 = OpAll %bool %116 - OpStore %x_86 %111 - %117 = OpLoad %bool %x_86 - OpStore %x_87_phi %117 - OpBranch %109 - %109 = OpLabel - %118 = OpLoad %bool %x_87_phi - OpStore %x_9_ok %118 - %119 = OpCompositeConstruct %v4float %108 %108 %108 %108 + OpStore %x_87_phi %20 + OpSelectionMerge %106 None + OpBranchConditional %true %107 %106 + %107 = OpLabel + %109 = OpCompositeConstruct %v4float %105 %105 %105 %105 + %110 = OpFDiv %v4float %10 %109 + %111 = OpFOrdEqual %v4bool %110 %10 + %108 = OpAll %bool %111 + OpStore %x_86 %108 + %112 = OpLoad %bool %x_86 + OpStore %x_87_phi %112 + OpBranch %106 + %106 = OpLabel + %113 = OpLoad %bool %x_87_phi + OpStore %x_9_ok %113 + %114 = OpCompositeConstruct %v4float %105 %105 %105 %105 + OpStore %x_10_val %114 + %117 = OpFAdd %v4float %114 %116 + OpStore %x_10_val %117 + %118 = OpFSub %v4float %117 %116 + OpStore %x_10_val %118 + %119 = OpFAdd %v4float %118 %116 OpStore %x_10_val %119 - %122 = OpFAdd %v4float %119 %121 - OpStore %x_10_val %122 - %123 = OpFSub %v4float %122 %121 - OpStore %x_10_val %123 - %124 = OpFAdd %v4float %123 %121 - OpStore %x_10_val %124 - %125 = OpFSub %v4float %124 %121 - OpStore %x_10_val %125 - OpStore %x_100_phi %false - OpSelectionMerge %126 None - OpBranchConditional %118 %127 %126 - %127 = OpLabel - %129 = OpFOrdEqual %v4bool %125 %119 - %128 = OpAll %bool %129 - OpStore %x_99 %128 - %130 = OpLoad %bool %x_99 - OpStore %x_100_phi %130 - OpBranch %126 - %126 = OpLabel - %131 = OpLoad %bool %x_100_phi - OpStore %x_9_ok %131 - %134 = OpFMul %v4float %125 %133 - OpStore %x_10_val %134 - %135 = OpFDiv %v4float %134 %133 - OpStore %x_10_val %135 - %136 = OpFMul %v4float %135 %133 - OpStore %x_10_val %136 - %137 = OpFDiv %v4float %136 %133 - OpStore %x_10_val %137 - OpStore %x_111_phi %false - OpSelectionMerge %138 None - OpBranchConditional %131 %139 %138 + %120 = OpFSub %v4float %119 %116 + OpStore %x_10_val %120 + OpStore %x_100_phi %20 + OpSelectionMerge %121 None + OpBranchConditional %113 %122 %121 + %122 = OpLabel + %124 = OpFOrdEqual %v4bool %120 %114 + %123 = OpAll %bool %124 + OpStore %x_99 %123 + %125 = OpLoad %bool %x_99 + OpStore %x_100_phi %125 + OpBranch %121 + %121 = OpLabel + %126 = OpLoad %bool %x_100_phi + OpStore %x_9_ok %126 + %129 = OpFMul %v4float %120 %128 + OpStore %x_10_val %129 + %130 = OpFDiv %v4float %129 %128 + OpStore %x_10_val %130 + %131 = OpFMul %v4float %130 %128 + OpStore %x_10_val %131 + %132 = OpFDiv %v4float %131 %128 + OpStore %x_10_val %132 + OpStore %x_111_phi %20 + OpSelectionMerge %133 None + OpBranchConditional %126 %134 %133 + %134 = OpLabel + %136 = OpFOrdEqual %v4bool %132 %114 + %135 = OpAll %bool %136 + OpStore %x_110 %135 + %137 = OpLoad %bool %x_110 + OpStore %x_111_phi %137 + OpBranch %133 + %133 = OpLabel + %138 = OpLoad %bool %x_111_phi + OpStore %x_9_ok %138 + OpStore %x_115_phi %20 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpFunctionCall %bool %test_int_S1_c0_b + OpStore %x_114 %141 + %142 = OpLoad %bool %x_114 + OpStore %x_115_phi %142 + OpBranch %139 %139 = OpLabel - %141 = OpFOrdEqual %v4bool %137 %119 - %140 = OpAll %bool %141 - OpStore %x_110 %140 - %142 = OpLoad %bool %x_110 - OpStore %x_111_phi %142 - OpBranch %138 - %138 = OpLabel - %143 = OpLoad %bool %x_111_phi - OpStore %x_9_ok %143 - OpStore %x_115_phi %false + %143 = OpLoad %bool %x_115_phi OpSelectionMerge %144 None - OpBranchConditional %143 %145 %144 + OpBranchConditional %143 %145 %146 %145 = OpLabel - %146 = OpFunctionCall %bool %test_int_S1_c0_b - OpStore %x_114 %146 - %147 = OpLoad %bool %x_114 - OpStore %x_115_phi %147 + %149 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_2 + %150 = OpLoad %v4float %149 + OpStore %x_116 %150 + OpBranch %144 + %146 = OpLabel + %152 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_1 + %153 = OpLoad %v4float %152 + OpStore %x_116 %153 OpBranch %144 %144 = OpLabel - %148 = OpLoad %bool %x_115_phi - OpSelectionMerge %149 None - OpBranchConditional %148 %150 %151 - %150 = OpLabel - %154 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_2 - %155 = OpLoad %v4float %154 - OpStore %x_116 %155 - OpBranch %149 - %151 = OpLabel - %157 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_1 - %158 = OpLoad %v4float %157 - OpStore %x_116 %158 - OpBranch %149 - %149 = OpLabel - %159 = OpLoad %v4float %x_116 - OpStore %output_S1 %159 - OpStore %sk_FragColor %159 + %154 = OpLoad %v4float %x_116 + OpStore %output_S1 %154 + OpStore %sk_FragColor %154 OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %160 + %main_inner = OpFunction %main_out None %155 %sk_Clockwise_param = OpFunctionParameter %bool %vcolor_S0_param = OpFunctionParameter %v4float - %165 = OpLabel + %160 = OpLabel OpStore %sk_Clockwise %sk_Clockwise_param OpStore %vcolor_S0 %vcolor_S0_param - %166 = OpFunctionCall %void %main_1 - %167 = OpLoad %v4float %sk_FragColor - %168 = OpCompositeConstruct %main_out %167 - OpReturnValue %168 + %161 = OpFunctionCall %void %main_1 + %162 = OpLoad %v4float %sk_FragColor + %163 = OpCompositeConstruct %main_out %162 + OpReturnValue %163 OpFunctionEnd - %main = OpFunction %void None %85 - %170 = OpLabel - %172 = OpLoad %bool %sk_Clockwise_param_1 - %173 = OpLoad %v4float %vcolor_S0_param_1 - %171 = OpFunctionCall %main_out %main_inner %172 %173 - %174 = OpCompositeExtract %v4float %171 0 - OpStore %sk_FragColor_1_1 %174 + %main = OpFunction %void None %82 + %165 = OpLabel + %167 = OpLoad %bool %sk_Clockwise_param_1 + %168 = OpLoad %v4float %vcolor_S0_param_1 + %166 = OpFunctionCall %main_out %main_inner %167 %168 + %169 = OpCompositeExtract %v4float %166 0 + OpStore %sk_FragColor_1_1 %169 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1520.spvasm.expected.wgsl b/test/tint/bug/tint/1520.spvasm.expected.wgsl index 108847dbf3..e3b92b828c 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.wgsl +++ b/test/tint/bug/tint/1520.spvasm.expected.wgsl @@ -95,20 +95,20 @@ fn main_1() { x_9_ok = true; x_87_phi = false; if (true) { - x_86 = all(((vec4(0.0, 0.0, 0.0, 0.0) / vec4(x_77, x_77, x_77, x_77)) == vec4(0.0, 0.0, 0.0, 0.0))); + x_86 = all(((vec4(0.0f, 0.0f, 0.0f, 0.0f) / vec4(x_77, x_77, x_77, x_77)) == vec4(0.0f, 0.0f, 0.0f, 0.0f))); x_87_phi = x_86; } let x_87 : bool = x_87_phi; x_9_ok = x_87; let x_89 : vec4 = vec4(x_77, x_77, x_77, x_77); x_10_val = x_89; - let x_92 : vec4 = (x_89 + vec4(1.0, 1.0, 1.0, 1.0)); + let x_92 : vec4 = (x_89 + vec4(1.0f, 1.0f, 1.0f, 1.0f)); x_10_val = x_92; - let x_93 : vec4 = (x_92 - vec4(1.0, 1.0, 1.0, 1.0)); + let x_93 : vec4 = (x_92 - vec4(1.0f, 1.0f, 1.0f, 1.0f)); x_10_val = x_93; - let x_94 : vec4 = (x_93 + vec4(1.0, 1.0, 1.0, 1.0)); + let x_94 : vec4 = (x_93 + vec4(1.0f, 1.0f, 1.0f, 1.0f)); x_10_val = x_94; - let x_95 : vec4 = (x_94 - vec4(1.0, 1.0, 1.0, 1.0)); + let x_95 : vec4 = (x_94 - vec4(1.0f, 1.0f, 1.0f, 1.0f)); x_10_val = x_95; x_100_phi = false; if (x_87) { @@ -117,13 +117,13 @@ fn main_1() { } let x_100 : bool = x_100_phi; x_9_ok = x_100; - let x_103 : vec4 = (x_95 * vec4(2.0, 2.0, 2.0, 2.0)); + let x_103 : vec4 = (x_95 * vec4(2.0f, 2.0f, 2.0f, 2.0f)); x_10_val = x_103; - let x_104 : vec4 = (x_103 / vec4(2.0, 2.0, 2.0, 2.0)); + let x_104 : vec4 = (x_103 / vec4(2.0f, 2.0f, 2.0f, 2.0f)); x_10_val = x_104; - let x_105 : vec4 = (x_104 * vec4(2.0, 2.0, 2.0, 2.0)); + let x_105 : vec4 = (x_104 * vec4(2.0f, 2.0f, 2.0f, 2.0f)); x_10_val = x_105; - let x_106 : vec4 = (x_105 / vec4(2.0, 2.0, 2.0, 2.0)); + let x_106 : vec4 = (x_105 / vec4(2.0f, 2.0f, 2.0f, 2.0f)); x_10_val = x_106; x_111_phi = false; if (x_100) { @@ -156,7 +156,7 @@ struct main_out { sk_FragColor_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(front_facing) sk_Clockwise_param : bool, @location(0) vcolor_S0_param : vec4) -> main_out { sk_Clockwise = sk_Clockwise_param; vcolor_S0 = vcolor_S0_param; diff --git a/test/tint/bug/tint/1540.wgsl b/test/tint/bug/tint/1540.wgsl new file mode 100644 index 0000000000..54314d1102 --- /dev/null +++ b/test/tint/bug/tint/1540.wgsl @@ -0,0 +1,10 @@ +struct S { + e: bool, +} + +@compute +@workgroup_size(1) +fn main() { + var b : bool; + var v = S(true & b); +} diff --git a/test/tint/bug/tint/1540.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1540.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..396172fd90 --- /dev/null +++ b/test/tint/bug/tint/1540.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +struct S { + bool e; +}; + +[numthreads(1, 1, 1)] +void main() { + bool b = false; + S v = {(true & b)}; + return; +} diff --git a/test/tint/bug/tint/1540.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1540.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..396172fd90 --- /dev/null +++ b/test/tint/bug/tint/1540.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +struct S { + bool e; +}; + +[numthreads(1, 1, 1)] +void main() { + bool b = false; + S v = {(true & b)}; + return; +} diff --git a/test/tint/bug/tint/1540.wgsl.expected.glsl b/test/tint/bug/tint/1540.wgsl.expected.glsl new file mode 100644 index 0000000000..5e3a4100f0 --- /dev/null +++ b/test/tint/bug/tint/1540.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es + +struct S { + bool e; +}; + +void tint_symbol() { + bool b = false; + S v = S(bool(uint(true) & uint(b))); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/bug/tint/1540.wgsl.expected.msl b/test/tint/bug/tint/1540.wgsl.expected.msl new file mode 100644 index 0000000000..387b86be6e --- /dev/null +++ b/test/tint/bug/tint/1540.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +struct S { + bool e; +}; + +kernel void tint_symbol() { + bool b = false; + S v = {.e=bool(true & b)}; + return; +} + diff --git a/test/tint/bug/tint/1540.wgsl.expected.spvasm b/test/tint/bug/tint/1540.wgsl.expected.spvasm new file mode 100644 index 0000000000..2a2d626882 --- /dev/null +++ b/test/tint/bug/tint/1540.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %b "b" + OpName %S "S" + OpMemberName %S 0 "e" + OpName %v "v" + OpMemberDecorate %S 0 Offset 0 + %void = OpTypeVoid + %1 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %8 = OpConstantNull %bool + %S = OpTypeStruct %bool + %true = OpConstantTrue %bool +%_ptr_Function_S = OpTypePointer Function %S + %16 = OpConstantNull %S + %main = OpFunction %void None %1 + %4 = OpLabel + %b = OpVariable %_ptr_Function_bool Function %8 + %v = OpVariable %_ptr_Function_S Function %16 + %11 = OpLoad %bool %b + %12 = OpLogicalAnd %bool %true %11 + %13 = OpCompositeConstruct %S %12 + OpStore %v %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1540.wgsl.expected.wgsl b/test/tint/bug/tint/1540.wgsl.expected.wgsl new file mode 100644 index 0000000000..d19be0ff15 --- /dev/null +++ b/test/tint/bug/tint/1540.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + e : bool, +} + +@compute @workgroup_size(1) +fn main() { + var b : bool; + var v = S((true & b)); +} diff --git a/test/tint/bug/tint/1541.wgsl b/test/tint/bug/tint/1541.wgsl new file mode 100644 index 0000000000..afcec54df5 --- /dev/null +++ b/test/tint/bug/tint/1541.wgsl @@ -0,0 +1,5 @@ +@compute +@workgroup_size(1) +fn main() { + var v = select(true & true, true, false); +} diff --git a/test/tint/bug/tint/1541.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1541.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3eb2b64c3b --- /dev/null +++ b/test/tint/bug/tint/1541.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void main() { + bool v = (false ? true : (true & true)); + return; +} diff --git a/test/tint/bug/tint/1541.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1541.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3eb2b64c3b --- /dev/null +++ b/test/tint/bug/tint/1541.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void main() { + bool v = (false ? true : (true & true)); + return; +} diff --git a/test/tint/bug/tint/1541.wgsl.expected.glsl b/test/tint/bug/tint/1541.wgsl.expected.glsl new file mode 100644 index 0000000000..260a8e522e --- /dev/null +++ b/test/tint/bug/tint/1541.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +void tint_symbol() { + bool v = (false ? true : bool(uint(true) & uint(true))); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/bug/tint/1541.wgsl.expected.msl b/test/tint/bug/tint/1541.wgsl.expected.msl new file mode 100644 index 0000000000..d339bd2621 --- /dev/null +++ b/test/tint/bug/tint/1541.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +kernel void tint_symbol() { + bool v = select(bool(true & true), true, false); + return; +} + diff --git a/test/tint/bug/tint/1541.wgsl.expected.spvasm b/test/tint/bug/tint/1541.wgsl.expected.spvasm new file mode 100644 index 0000000000..af44c3be67 --- /dev/null +++ b/test/tint/bug/tint/1541.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %bool = OpTypeBool + %7 = OpConstantNull %bool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %main = OpFunction %void None %1 + %4 = OpLabel + %v = OpVariable %_ptr_Function_bool Function %7 + %9 = OpLogicalAnd %bool %true %true + %5 = OpSelect %bool %7 %true %9 + OpStore %v %5 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1541.wgsl.expected.wgsl b/test/tint/bug/tint/1541.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc554b1e90 --- /dev/null +++ b/test/tint/bug/tint/1541.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +@compute @workgroup_size(1) +fn main() { + var v = select((true & true), true, false); +} diff --git a/test/tint/bug/tint/1564.wgsl b/test/tint/bug/tint/1564.wgsl new file mode 100644 index 0000000000..8a56b9cb47 --- /dev/null +++ b/test/tint/bug/tint/1564.wgsl @@ -0,0 +1,3 @@ +fn foo() { + let b = 1e-40f; +} diff --git a/test/tint/bug/tint/1564.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1564.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..df3fb92e29 --- /dev/null +++ b/test/tint/bug/tint/1564.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void foo() { + const float b = 9.9999461e-41f; +} diff --git a/test/tint/bug/tint/1564.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1564.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..df3fb92e29 --- /dev/null +++ b/test/tint/bug/tint/1564.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void foo() { + const float b = 9.9999461e-41f; +} diff --git a/test/tint/bug/tint/1564.wgsl.expected.glsl b/test/tint/bug/tint/1564.wgsl.expected.glsl new file mode 100644 index 0000000000..4888eb3dc1 --- /dev/null +++ b/test/tint/bug/tint/1564.wgsl.expected.glsl @@ -0,0 +1,10 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void foo() { + float b = 9.9999461e-41f; +} + diff --git a/test/tint/bug/tint/1564.wgsl.expected.msl b/test/tint/bug/tint/1564.wgsl.expected.msl new file mode 100644 index 0000000000..6fc899775c --- /dev/null +++ b/test/tint/bug/tint/1564.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void foo() { + float const b = 9.9999461e-41f; +} + diff --git a/test/tint/bug/tint/1564.wgsl.expected.spvasm b/test/tint/bug/tint/1564.wgsl.expected.spvasm new file mode 100644 index 0000000000..c7c18d1c43 --- /dev/null +++ b/test/tint/bug/tint/1564.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %foo "foo" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 +%float_0x1_16c2pn133 = OpConstant %float 0x1.16c2p-133 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %foo = OpFunction %void None %1 + %6 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1564.wgsl.expected.wgsl b/test/tint/bug/tint/1564.wgsl.expected.wgsl new file mode 100644 index 0000000000..851d66ac9b --- /dev/null +++ b/test/tint/bug/tint/1564.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +fn foo() { + let b = 0x1.16c2p-133f; +} diff --git a/test/tint/bug/tint/1573.wgsl b/test/tint/bug/tint/1573.wgsl new file mode 100644 index 0000000000..b8c3c8174d --- /dev/null +++ b/test/tint/bug/tint/1573.wgsl @@ -0,0 +1,8 @@ +@group(0) @binding(0) +var a : atomic; + +@compute @workgroup_size(16) +fn main() { + var value = 42u; + let result = atomicCompareExchangeWeak(&a, 0u, value); +} diff --git a/test/tint/bug/tint/1573.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1573.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a19a5806e1 --- /dev/null +++ b/test/tint/bug/tint/1573.wgsl.expected.dxc.hlsl @@ -0,0 +1,21 @@ +RWByteAddressBuffer a : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +[numthreads(16, 1, 1)] +void main() { + uint value = 42u; + const atomic_compare_exchange_weak_ret_type result = tint_atomicCompareExchangeWeak(a, 0u, 0u, value); + return; +} diff --git a/test/tint/bug/tint/1573.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1573.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a19a5806e1 --- /dev/null +++ b/test/tint/bug/tint/1573.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +RWByteAddressBuffer a : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +[numthreads(16, 1, 1)] +void main() { + uint value = 42u; + const atomic_compare_exchange_weak_ret_type result = tint_atomicCompareExchangeWeak(a, 0u, 0u, value); + return; +} diff --git a/test/tint/bug/tint/1573.wgsl.expected.glsl b/test/tint/bug/tint/1573.wgsl.expected.glsl new file mode 100644 index 0000000000..013839ef12 --- /dev/null +++ b/test/tint/bug/tint/1573.wgsl.expected.glsl @@ -0,0 +1,28 @@ +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct a_block { + uint inner; +}; + +layout(binding = 0, std430) buffer a_block_1 { + uint inner; +} a; +void tint_symbol() { + uint value = 42u; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(a.inner, 0u, value); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 0u; + atomic_compare_exchange_resultu32 result = atomic_compare_result; +} + +layout(local_size_x = 16, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/bug/tint/1573.wgsl.expected.msl b/test/tint/bug/tint/1573.wgsl.expected.msl new file mode 100644 index 0000000000..0aef1728fa --- /dev/null +++ b/test/tint/bug/tint/1573.wgsl.expected.msl @@ -0,0 +1,20 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(device atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +kernel void tint_symbol(device atomic_uint* tint_symbol_1 [[buffer(0)]]) { + uint value = 42u; + atomic_compare_exchange_resultu32 const result = atomicCompareExchangeWeak_1(tint_symbol_1, 0u, value); + return; +} + diff --git a/test/tint/bug/tint/1573.wgsl.expected.spvasm b/test/tint/bug/tint/1573.wgsl.expected.spvasm new file mode 100644 index 0000000000..84757262c0 --- /dev/null +++ b/test/tint/bug/tint/1573.wgsl.expected.spvasm @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 16 1 1 + OpName %a_block "a_block" + OpMemberName %a_block 0 "inner" + OpName %a "a" + OpName %main "main" + OpName %value "value" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpDecorate %a_block Block + OpMemberDecorate %a_block 0 Offset 0 + OpDecorate %a DescriptorSet 0 + OpDecorate %a Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 + %a_block = OpTypeStruct %uint +%_ptr_StorageBuffer_a_block = OpTypePointer StorageBuffer %a_block + %a = OpVariable %_ptr_StorageBuffer_a_block StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_42 = OpConstant %uint 42 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %main = OpFunction %void None %5 + %8 = OpLabel + %value = OpVariable %_ptr_Function_uint Function %12 + OpStore %value %uint_42 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %a %uint_0 + %21 = OpLoad %uint %value + %22 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %21 %12 + %23 = OpIEqual %bool %22 %21 + %13 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %22 %23 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1573.wgsl.expected.wgsl b/test/tint/bug/tint/1573.wgsl.expected.wgsl new file mode 100644 index 0000000000..be83957e4e --- /dev/null +++ b/test/tint/bug/tint/1573.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +@group(0) @binding(0) var a : atomic; + +@compute @workgroup_size(16) +fn main() { + var value = 42u; + let result = atomicCompareExchangeWeak(&(a), 0u, value); +} diff --git a/test/tint/bug/tint/1574.wgsl b/test/tint/bug/tint/1574.wgsl new file mode 100644 index 0000000000..fb0723997a --- /dev/null +++ b/test/tint/bug/tint/1574.wgsl @@ -0,0 +1,39 @@ +@group(0) @binding(0) +var a_u32 : atomic; + +@group(0) @binding(1) +var a_i32 : atomic; + +var b_u32 : atomic; + +var b_i32 : atomic; + + +@compute @workgroup_size(16) +fn main() { + { + var value = 42u; + let r1 = atomicCompareExchangeWeak(&a_u32, 0u, value); + let r2 = atomicCompareExchangeWeak(&a_u32, 0u, value); + let r3 = atomicCompareExchangeWeak(&a_u32, 0u, value); + } + { + var value = 42; + let r1 = atomicCompareExchangeWeak(&a_i32, 0, value); + let r2 = atomicCompareExchangeWeak(&a_i32, 0, value); + let r3 = atomicCompareExchangeWeak(&a_i32, 0, value); + } + { + var value = 42u; + let r1 = atomicCompareExchangeWeak(&b_u32, 0u, value); + let r2 = atomicCompareExchangeWeak(&b_u32, 0u, value); + let r3 = atomicCompareExchangeWeak(&b_u32, 0u, value); + } + { + var value = 42; + let r1 = atomicCompareExchangeWeak(&b_i32, 0, value); + let r2 = atomicCompareExchangeWeak(&b_i32, 0, value); + let r3 = atomicCompareExchangeWeak(&b_i32, 0, value); + } + +} diff --git a/test/tint/bug/tint/1574.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1574.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aad4961f4a --- /dev/null +++ b/test/tint/bug/tint/1574.wgsl.expected.dxc.hlsl @@ -0,0 +1,105 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +RWByteAddressBuffer a_u32 : register(u0, space0); +RWByteAddressBuffer a_i32 : register(u1, space0); +groupshared uint b_u32; +groupshared int b_i32; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +struct atomic_compare_exchange_weak_ret_type_1 { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type_1 tint_atomicCompareExchangeWeak_1(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type_1 result=(atomic_compare_exchange_weak_ret_type_1)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void main_inner(uint local_invocation_index) { + if ((local_invocation_index < 1u)) { + uint atomic_result = 0u; + InterlockedExchange(b_u32, 0u, atomic_result); + int atomic_result_1 = 0; + InterlockedExchange(b_i32, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + { + uint value = 42u; + const atomic_compare_exchange_weak_ret_type r1 = tint_atomicCompareExchangeWeak(a_u32, 0u, 0u, value); + const atomic_compare_exchange_weak_ret_type r2 = tint_atomicCompareExchangeWeak(a_u32, 0u, 0u, value); + const atomic_compare_exchange_weak_ret_type r3 = tint_atomicCompareExchangeWeak(a_u32, 0u, 0u, value); + } + { + int value = 42; + const atomic_compare_exchange_weak_ret_type_1 r1 = tint_atomicCompareExchangeWeak_1(a_i32, 0u, 0, value); + const atomic_compare_exchange_weak_ret_type_1 r2 = tint_atomicCompareExchangeWeak_1(a_i32, 0u, 0, value); + const atomic_compare_exchange_weak_ret_type_1 r3 = tint_atomicCompareExchangeWeak_1(a_i32, 0u, 0, value); + } + { + uint value = 42u; + atomic_compare_exchange_resultu32 atomic_result_2 = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = 0u; + InterlockedCompareExchange(b_u32, atomic_compare_value, value, atomic_result_2.old_value); + atomic_result_2.exchanged = atomic_result_2.old_value == atomic_compare_value; + const atomic_compare_exchange_resultu32 r1 = atomic_result_2; + atomic_compare_exchange_resultu32 atomic_result_3 = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value_1 = 0u; + InterlockedCompareExchange(b_u32, atomic_compare_value_1, value, atomic_result_3.old_value); + atomic_result_3.exchanged = atomic_result_3.old_value == atomic_compare_value_1; + const atomic_compare_exchange_resultu32 r2 = atomic_result_3; + atomic_compare_exchange_resultu32 atomic_result_4 = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value_2 = 0u; + InterlockedCompareExchange(b_u32, atomic_compare_value_2, value, atomic_result_4.old_value); + atomic_result_4.exchanged = atomic_result_4.old_value == atomic_compare_value_2; + const atomic_compare_exchange_resultu32 r3 = atomic_result_4; + } + { + int value = 42; + atomic_compare_exchange_resulti32 atomic_result_5 = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value_3 = 0; + InterlockedCompareExchange(b_i32, atomic_compare_value_3, value, atomic_result_5.old_value); + atomic_result_5.exchanged = atomic_result_5.old_value == atomic_compare_value_3; + const atomic_compare_exchange_resulti32 r1 = atomic_result_5; + atomic_compare_exchange_resulti32 atomic_result_6 = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value_4 = 0; + InterlockedCompareExchange(b_i32, atomic_compare_value_4, value, atomic_result_6.old_value); + atomic_result_6.exchanged = atomic_result_6.old_value == atomic_compare_value_4; + const atomic_compare_exchange_resulti32 r2 = atomic_result_6; + atomic_compare_exchange_resulti32 atomic_result_7 = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value_5 = 0; + InterlockedCompareExchange(b_i32, atomic_compare_value_5, value, atomic_result_7.old_value); + atomic_result_7.exchanged = atomic_result_7.old_value == atomic_compare_value_5; + const atomic_compare_exchange_resulti32 r3 = atomic_result_7; + } +} + +[numthreads(16, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/bug/tint/1574.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1574.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aad4961f4a --- /dev/null +++ b/test/tint/bug/tint/1574.wgsl.expected.fxc.hlsl @@ -0,0 +1,105 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +RWByteAddressBuffer a_u32 : register(u0, space0); +RWByteAddressBuffer a_i32 : register(u1, space0); +groupshared uint b_u32; +groupshared int b_i32; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +struct atomic_compare_exchange_weak_ret_type_1 { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type_1 tint_atomicCompareExchangeWeak_1(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type_1 result=(atomic_compare_exchange_weak_ret_type_1)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void main_inner(uint local_invocation_index) { + if ((local_invocation_index < 1u)) { + uint atomic_result = 0u; + InterlockedExchange(b_u32, 0u, atomic_result); + int atomic_result_1 = 0; + InterlockedExchange(b_i32, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + { + uint value = 42u; + const atomic_compare_exchange_weak_ret_type r1 = tint_atomicCompareExchangeWeak(a_u32, 0u, 0u, value); + const atomic_compare_exchange_weak_ret_type r2 = tint_atomicCompareExchangeWeak(a_u32, 0u, 0u, value); + const atomic_compare_exchange_weak_ret_type r3 = tint_atomicCompareExchangeWeak(a_u32, 0u, 0u, value); + } + { + int value = 42; + const atomic_compare_exchange_weak_ret_type_1 r1 = tint_atomicCompareExchangeWeak_1(a_i32, 0u, 0, value); + const atomic_compare_exchange_weak_ret_type_1 r2 = tint_atomicCompareExchangeWeak_1(a_i32, 0u, 0, value); + const atomic_compare_exchange_weak_ret_type_1 r3 = tint_atomicCompareExchangeWeak_1(a_i32, 0u, 0, value); + } + { + uint value = 42u; + atomic_compare_exchange_resultu32 atomic_result_2 = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = 0u; + InterlockedCompareExchange(b_u32, atomic_compare_value, value, atomic_result_2.old_value); + atomic_result_2.exchanged = atomic_result_2.old_value == atomic_compare_value; + const atomic_compare_exchange_resultu32 r1 = atomic_result_2; + atomic_compare_exchange_resultu32 atomic_result_3 = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value_1 = 0u; + InterlockedCompareExchange(b_u32, atomic_compare_value_1, value, atomic_result_3.old_value); + atomic_result_3.exchanged = atomic_result_3.old_value == atomic_compare_value_1; + const atomic_compare_exchange_resultu32 r2 = atomic_result_3; + atomic_compare_exchange_resultu32 atomic_result_4 = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value_2 = 0u; + InterlockedCompareExchange(b_u32, atomic_compare_value_2, value, atomic_result_4.old_value); + atomic_result_4.exchanged = atomic_result_4.old_value == atomic_compare_value_2; + const atomic_compare_exchange_resultu32 r3 = atomic_result_4; + } + { + int value = 42; + atomic_compare_exchange_resulti32 atomic_result_5 = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value_3 = 0; + InterlockedCompareExchange(b_i32, atomic_compare_value_3, value, atomic_result_5.old_value); + atomic_result_5.exchanged = atomic_result_5.old_value == atomic_compare_value_3; + const atomic_compare_exchange_resulti32 r1 = atomic_result_5; + atomic_compare_exchange_resulti32 atomic_result_6 = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value_4 = 0; + InterlockedCompareExchange(b_i32, atomic_compare_value_4, value, atomic_result_6.old_value); + atomic_result_6.exchanged = atomic_result_6.old_value == atomic_compare_value_4; + const atomic_compare_exchange_resulti32 r2 = atomic_result_6; + atomic_compare_exchange_resulti32 atomic_result_7 = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value_5 = 0; + InterlockedCompareExchange(b_i32, atomic_compare_value_5, value, atomic_result_7.old_value); + atomic_result_7.exchanged = atomic_result_7.old_value == atomic_compare_value_5; + const atomic_compare_exchange_resulti32 r3 = atomic_result_7; + } +} + +[numthreads(16, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/bug/tint/1574.wgsl.expected.glsl b/test/tint/bug/tint/1574.wgsl.expected.glsl new file mode 100644 index 0000000000..bf711e7891 --- /dev/null +++ b/test/tint/bug/tint/1574.wgsl.expected.glsl @@ -0,0 +1,102 @@ +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct a_u32_block { + uint inner; +}; + +layout(binding = 0, std430) buffer a_u32_block_1 { + uint inner; +} a_u32; +struct a_i32_block { + int inner; +}; + +layout(binding = 1, std430) buffer a_i32_block_1 { + int inner; +} a_i32; +shared uint b_u32; +shared int b_i32; +void tint_symbol(uint local_invocation_index) { + if ((local_invocation_index < 1u)) { + atomicExchange(b_u32, 0u); + atomicExchange(b_i32, 0); + } + barrier(); + { + uint value = 42u; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(a_u32.inner, 0u, value); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 0u; + atomic_compare_exchange_resultu32 r1 = atomic_compare_result; + atomic_compare_exchange_resultu32 atomic_compare_result_1; + atomic_compare_result_1.old_value = atomicCompSwap(a_u32.inner, 0u, value); + atomic_compare_result_1.exchanged = atomic_compare_result_1.old_value == 0u; + atomic_compare_exchange_resultu32 r2 = atomic_compare_result_1; + atomic_compare_exchange_resultu32 atomic_compare_result_2; + atomic_compare_result_2.old_value = atomicCompSwap(a_u32.inner, 0u, value); + atomic_compare_result_2.exchanged = atomic_compare_result_2.old_value == 0u; + atomic_compare_exchange_resultu32 r3 = atomic_compare_result_2; + } + { + int value = 42; + atomic_compare_exchange_resulti32 atomic_compare_result_3; + atomic_compare_result_3.old_value = atomicCompSwap(a_i32.inner, 0, value); + atomic_compare_result_3.exchanged = atomic_compare_result_3.old_value == 0; + atomic_compare_exchange_resulti32 r1 = atomic_compare_result_3; + atomic_compare_exchange_resulti32 atomic_compare_result_4; + atomic_compare_result_4.old_value = atomicCompSwap(a_i32.inner, 0, value); + atomic_compare_result_4.exchanged = atomic_compare_result_4.old_value == 0; + atomic_compare_exchange_resulti32 r2 = atomic_compare_result_4; + atomic_compare_exchange_resulti32 atomic_compare_result_5; + atomic_compare_result_5.old_value = atomicCompSwap(a_i32.inner, 0, value); + atomic_compare_result_5.exchanged = atomic_compare_result_5.old_value == 0; + atomic_compare_exchange_resulti32 r3 = atomic_compare_result_5; + } + { + uint value = 42u; + atomic_compare_exchange_resultu32 atomic_compare_result_6; + atomic_compare_result_6.old_value = atomicCompSwap(b_u32, 0u, value); + atomic_compare_result_6.exchanged = atomic_compare_result_6.old_value == 0u; + atomic_compare_exchange_resultu32 r1 = atomic_compare_result_6; + atomic_compare_exchange_resultu32 atomic_compare_result_7; + atomic_compare_result_7.old_value = atomicCompSwap(b_u32, 0u, value); + atomic_compare_result_7.exchanged = atomic_compare_result_7.old_value == 0u; + atomic_compare_exchange_resultu32 r2 = atomic_compare_result_7; + atomic_compare_exchange_resultu32 atomic_compare_result_8; + atomic_compare_result_8.old_value = atomicCompSwap(b_u32, 0u, value); + atomic_compare_result_8.exchanged = atomic_compare_result_8.old_value == 0u; + atomic_compare_exchange_resultu32 r3 = atomic_compare_result_8; + } + { + int value = 42; + atomic_compare_exchange_resulti32 atomic_compare_result_9; + atomic_compare_result_9.old_value = atomicCompSwap(b_i32, 0, value); + atomic_compare_result_9.exchanged = atomic_compare_result_9.old_value == 0; + atomic_compare_exchange_resulti32 r1 = atomic_compare_result_9; + atomic_compare_exchange_resulti32 atomic_compare_result_10; + atomic_compare_result_10.old_value = atomicCompSwap(b_i32, 0, value); + atomic_compare_result_10.exchanged = atomic_compare_result_10.old_value == 0; + atomic_compare_exchange_resulti32 r2 = atomic_compare_result_10; + atomic_compare_exchange_resulti32 atomic_compare_result_11; + atomic_compare_result_11.old_value = atomicCompSwap(b_i32, 0, value); + atomic_compare_result_11.exchanged = atomic_compare_result_11.old_value == 0; + atomic_compare_exchange_resulti32 r3 = atomic_compare_result_11; + } +} + +layout(local_size_x = 16, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/bug/tint/1574.wgsl.expected.msl b/test/tint/bug/tint/1574.wgsl.expected.msl new file mode 100644 index 0000000000..80ab0b68be --- /dev/null +++ b/test/tint/bug/tint/1574.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(device atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_2(device atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_3(threadgroup atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_4(threadgroup atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +void tint_symbol_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1, threadgroup atomic_int* const tint_symbol_2, device atomic_uint* const tint_symbol_3, device atomic_int* const tint_symbol_4) { + if ((local_invocation_index < 1u)) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + atomic_store_explicit(tint_symbol_2, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + { + uint value = 42u; + atomic_compare_exchange_resultu32 const r1 = atomicCompareExchangeWeak_1(tint_symbol_3, 0u, value); + atomic_compare_exchange_resultu32 const r2 = atomicCompareExchangeWeak_1(tint_symbol_3, 0u, value); + atomic_compare_exchange_resultu32 const r3 = atomicCompareExchangeWeak_1(tint_symbol_3, 0u, value); + } + { + int value = 42; + atomic_compare_exchange_resulti32 const r1 = atomicCompareExchangeWeak_2(tint_symbol_4, 0, value); + atomic_compare_exchange_resulti32 const r2 = atomicCompareExchangeWeak_2(tint_symbol_4, 0, value); + atomic_compare_exchange_resulti32 const r3 = atomicCompareExchangeWeak_2(tint_symbol_4, 0, value); + } + { + uint value = 42u; + atomic_compare_exchange_resultu32 const r1 = atomicCompareExchangeWeak_3(tint_symbol_1, 0u, value); + atomic_compare_exchange_resultu32 const r2 = atomicCompareExchangeWeak_3(tint_symbol_1, 0u, value); + atomic_compare_exchange_resultu32 const r3 = atomicCompareExchangeWeak_3(tint_symbol_1, 0u, value); + } + { + int value = 42; + atomic_compare_exchange_resulti32 const r1 = atomicCompareExchangeWeak_4(tint_symbol_2, 0, value); + atomic_compare_exchange_resulti32 const r2 = atomicCompareExchangeWeak_4(tint_symbol_2, 0, value); + atomic_compare_exchange_resulti32 const r3 = atomicCompareExchangeWeak_4(tint_symbol_2, 0, value); + } +} + +kernel void tint_symbol(device atomic_uint* tint_symbol_7 [[buffer(0)]], device atomic_int* tint_symbol_8 [[buffer(1)]], uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_5; + threadgroup atomic_int tint_symbol_6; + tint_symbol_inner(local_invocation_index, &(tint_symbol_5), &(tint_symbol_6), tint_symbol_7, tint_symbol_8); + return; +} + diff --git a/test/tint/bug/tint/1574.wgsl.expected.spvasm b/test/tint/bug/tint/1574.wgsl.expected.spvasm new file mode 100644 index 0000000000..be3e7f0a6a --- /dev/null +++ b/test/tint/bug/tint/1574.wgsl.expected.spvasm @@ -0,0 +1,158 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 118 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %local_invocation_index_1 + OpExecutionMode %main LocalSize 16 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %a_u32_block "a_u32_block" + OpMemberName %a_u32_block 0 "inner" + OpName %a_u32 "a_u32" + OpName %a_i32_block "a_i32_block" + OpMemberName %a_i32_block 0 "inner" + OpName %a_i32 "a_i32" + OpName %b_u32 "b_u32" + OpName %b_i32 "b_i32" + OpName %main_inner "main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %value "value" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %value_0 "value" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %value_1 "value" + OpName %value_2 "value" + OpName %main "main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpDecorate %a_u32_block Block + OpMemberDecorate %a_u32_block 0 Offset 0 + OpDecorate %a_u32 DescriptorSet 0 + OpDecorate %a_u32 Binding 0 + OpDecorate %a_i32_block Block + OpMemberDecorate %a_i32_block 0 Offset 0 + OpDecorate %a_i32 DescriptorSet 0 + OpDecorate %a_i32 Binding 1 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%a_u32_block = OpTypeStruct %uint +%_ptr_StorageBuffer_a_u32_block = OpTypePointer StorageBuffer %a_u32_block + %a_u32 = OpVariable %_ptr_StorageBuffer_a_u32_block StorageBuffer + %int = OpTypeInt 32 1 +%a_i32_block = OpTypeStruct %int +%_ptr_StorageBuffer_a_i32_block = OpTypePointer StorageBuffer %a_i32_block + %a_i32 = OpVariable %_ptr_StorageBuffer_a_i32_block StorageBuffer +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %b_u32 = OpVariable %_ptr_Workgroup_uint Workgroup +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %b_i32 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %15 = OpTypeFunction %void %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %29 = OpConstantNull %uint + %32 = OpConstantNull %int + %uint_264 = OpConstant %uint 264 + %uint_42 = OpConstant %uint 42 +%_ptr_Function_uint = OpTypePointer Function %uint +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int_42 = OpConstant %int 42 +%_ptr_Function_int = OpTypePointer Function %int +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %113 = OpTypeFunction %void + %main_inner = OpFunction %void None %15 +%local_invocation_index = OpFunctionParameter %uint + %19 = OpLabel + %value = OpVariable %_ptr_Function_uint Function %29 + %value_0 = OpVariable %_ptr_Function_int Function %32 + %value_1 = OpVariable %_ptr_Function_uint Function %29 + %value_2 = OpVariable %_ptr_Function_int Function %32 + %21 = OpULessThan %bool %local_invocation_index %uint_1 + OpSelectionMerge %23 None + OpBranchConditional %21 %24 %23 + %24 = OpLabel + OpAtomicStore %b_u32 %uint_2 %uint_0 %29 + OpAtomicStore %b_i32 %uint_2 %uint_0 %32 + OpBranch %23 + %23 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %value %uint_42 + %42 = OpAccessChain %_ptr_StorageBuffer_uint %a_u32 %uint_0 + %43 = OpLoad %uint %value + %44 = OpAtomicCompareExchange %uint %42 %uint_1 %uint_0 %uint_0 %43 %29 + %45 = OpIEqual %bool %44 %43 + %38 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %44 %45 + %48 = OpAccessChain %_ptr_StorageBuffer_uint %a_u32 %uint_0 + %49 = OpLoad %uint %value + %50 = OpAtomicCompareExchange %uint %48 %uint_1 %uint_0 %uint_0 %49 %29 + %51 = OpIEqual %bool %50 %49 + %46 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %50 %51 + %54 = OpAccessChain %_ptr_StorageBuffer_uint %a_u32 %uint_0 + %55 = OpLoad %uint %value + %56 = OpAtomicCompareExchange %uint %54 %uint_1 %uint_0 %uint_0 %55 %29 + %57 = OpIEqual %bool %56 %55 + %52 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %56 %57 + OpStore %value_0 %int_42 + %65 = OpAccessChain %_ptr_StorageBuffer_int %a_i32 %uint_0 + %66 = OpLoad %int %value_0 + %67 = OpAtomicCompareExchange %int %65 %uint_1 %uint_0 %uint_0 %66 %32 + %68 = OpIEqual %bool %67 %66 + %61 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %67 %68 + %71 = OpAccessChain %_ptr_StorageBuffer_int %a_i32 %uint_0 + %72 = OpLoad %int %value_0 + %73 = OpAtomicCompareExchange %int %71 %uint_1 %uint_0 %uint_0 %72 %32 + %74 = OpIEqual %bool %73 %72 + %69 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %73 %74 + %77 = OpAccessChain %_ptr_StorageBuffer_int %a_i32 %uint_0 + %78 = OpLoad %int %value_0 + %79 = OpAtomicCompareExchange %int %77 %uint_1 %uint_0 %uint_0 %78 %32 + %80 = OpIEqual %bool %79 %78 + %75 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %79 %80 + OpStore %value_1 %uint_42 + %84 = OpLoad %uint %value_1 + %85 = OpAtomicCompareExchange %uint %b_u32 %uint_2 %uint_0 %uint_0 %84 %29 + %86 = OpIEqual %bool %85 %84 + %82 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %85 %86 + %89 = OpLoad %uint %value_1 + %90 = OpAtomicCompareExchange %uint %b_u32 %uint_2 %uint_0 %uint_0 %89 %29 + %91 = OpIEqual %bool %90 %89 + %87 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %90 %91 + %94 = OpLoad %uint %value_1 + %95 = OpAtomicCompareExchange %uint %b_u32 %uint_2 %uint_0 %uint_0 %94 %29 + %96 = OpIEqual %bool %95 %94 + %92 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %95 %96 + OpStore %value_2 %int_42 + %100 = OpLoad %int %value_2 + %101 = OpAtomicCompareExchange %int %b_i32 %uint_2 %uint_0 %uint_0 %100 %32 + %102 = OpIEqual %bool %101 %100 + %98 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %101 %102 + %105 = OpLoad %int %value_2 + %106 = OpAtomicCompareExchange %int %b_i32 %uint_2 %uint_0 %uint_0 %105 %32 + %107 = OpIEqual %bool %106 %105 + %103 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %106 %107 + %110 = OpLoad %int %value_2 + %111 = OpAtomicCompareExchange %int %b_i32 %uint_2 %uint_0 %uint_0 %110 %32 + %112 = OpIEqual %bool %111 %110 + %108 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %111 %112 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %113 + %115 = OpLabel + %117 = OpLoad %uint %local_invocation_index_1 + %116 = OpFunctionCall %void %main_inner %117 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1574.wgsl.expected.wgsl b/test/tint/bug/tint/1574.wgsl.expected.wgsl new file mode 100644 index 0000000000..e5ca3c9287 --- /dev/null +++ b/test/tint/bug/tint/1574.wgsl.expected.wgsl @@ -0,0 +1,35 @@ +@group(0) @binding(0) var a_u32 : atomic; + +@group(0) @binding(1) var a_i32 : atomic; + +var b_u32 : atomic; + +var b_i32 : atomic; + +@compute @workgroup_size(16) +fn main() { + { + var value = 42u; + let r1 = atomicCompareExchangeWeak(&(a_u32), 0u, value); + let r2 = atomicCompareExchangeWeak(&(a_u32), 0u, value); + let r3 = atomicCompareExchangeWeak(&(a_u32), 0u, value); + } + { + var value = 42; + let r1 = atomicCompareExchangeWeak(&(a_i32), 0, value); + let r2 = atomicCompareExchangeWeak(&(a_i32), 0, value); + let r3 = atomicCompareExchangeWeak(&(a_i32), 0, value); + } + { + var value = 42u; + let r1 = atomicCompareExchangeWeak(&(b_u32), 0u, value); + let r2 = atomicCompareExchangeWeak(&(b_u32), 0u, value); + let r3 = atomicCompareExchangeWeak(&(b_u32), 0u, value); + } + { + var value = 42; + let r1 = atomicCompareExchangeWeak(&(b_i32), 0, value); + let r2 = atomicCompareExchangeWeak(&(b_i32), 0, value); + let r3 = atomicCompareExchangeWeak(&(b_i32), 0, value); + } +} diff --git a/test/tint/bug/tint/1641.wgsl b/test/tint/bug/tint/1641.wgsl new file mode 100644 index 0000000000..b2a7387dec --- /dev/null +++ b/test/tint/bug/tint/1641.wgsl @@ -0,0 +1,11 @@ +struct Normals { + f : vec3, +} +const faceNormals = array( + Normals(vec3(0, 0, 1)), +); + +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(faceNormals[0].f, 1.); +} diff --git a/test/tint/bug/tint/1641.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1641.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1c77da508d --- /dev/null +++ b/test/tint/bug/tint/1641.wgsl.expected.dxc.hlsl @@ -0,0 +1,19 @@ +struct Normals { + float3 f; +}; + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 main_inner() { + const Normals tint_symbol_1[1] = {{float3(0.0f, 0.0f, 1.0f)}}; + return float4(tint_symbol_1[0].f, 1.0f); +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1641.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1641.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c77da508d --- /dev/null +++ b/test/tint/bug/tint/1641.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +struct Normals { + float3 f; +}; + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 main_inner() { + const Normals tint_symbol_1[1] = {{float3(0.0f, 0.0f, 1.0f)}}; + return float4(tint_symbol_1[0].f, 1.0f); +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1641.wgsl.expected.glsl b/test/tint/bug/tint/1641.wgsl.expected.glsl new file mode 100644 index 0000000000..e5ac2be6ec --- /dev/null +++ b/test/tint/bug/tint/1641.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es + +struct Normals { + vec3 f; +}; + +vec4 tint_symbol() { + Normals tint_symbol_1[1] = Normals[1](Normals(vec3(0.0f, 0.0f, 1.0f))); + return vec4(tint_symbol_1[0].f, 1.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = tint_symbol(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} diff --git a/test/tint/bug/tint/1641.wgsl.expected.msl b/test/tint/bug/tint/1641.wgsl.expected.msl new file mode 100644 index 0000000000..0d8c095f6a --- /dev/null +++ b/test/tint/bug/tint/1641.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct Normals { + float3 f; +}; + +struct tint_symbol_1 { + float4 value [[position]]; +}; + +float4 tint_symbol_inner() { + tint_array const tint_symbol_2 = tint_array{Normals{.f=float3(0.0f, 0.0f, 1.0f)}}; + return float4(tint_symbol_2[0].f, 1.0f); +} + +vertex tint_symbol_1 tint_symbol() { + float4 const inner_result = tint_symbol_inner(); + tint_symbol_1 wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + diff --git a/test/tint/bug/tint/1641.wgsl.expected.spvasm b/test/tint/bug/tint/1641.wgsl.expected.spvasm new file mode 100644 index 0000000000..b73e967c20 --- /dev/null +++ b/test/tint/bug/tint/1641.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %value %vertex_point_size + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %main_inner "main_inner" + OpName %main "main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %9 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %13 = OpConstantComposite %v4float %8 %8 %float_1 %float_1 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %main_inner = OpFunction %v4float None %9 + %11 = OpLabel + OpReturnValue %13 + OpFunctionEnd + %main = OpFunction %void None %14 + %17 = OpLabel + %18 = OpFunctionCall %v4float %main_inner + OpStore %value %18 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1641.wgsl.expected.wgsl b/test/tint/bug/tint/1641.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f235e7561 --- /dev/null +++ b/test/tint/bug/tint/1641.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +struct Normals { + f : vec3, +} + +const faceNormals = array(Normals(vec3(0, 0, 1))); + +@vertex +fn main() -> @builtin(position) vec4 { + return vec4(faceNormals[0].f, 1.0); +} diff --git a/test/tint/bug/tint/1653.wgsl b/test/tint/bug/tint/1653.wgsl new file mode 100644 index 0000000000..5b76964287 --- /dev/null +++ b/test/tint/bug/tint/1653.wgsl @@ -0,0 +1,10 @@ +const TRI_VERTICES = array( + vec4(0., 0., 0., 1.), + vec4(0., 1., 0., 1.), + vec4(1., 1., 0., 1.), +); + +@vertex +fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4 { + return TRI_VERTICES[in_vertex_index]; +} diff --git a/test/tint/bug/tint/1653.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1653.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ac385e01f9 --- /dev/null +++ b/test/tint/bug/tint/1653.wgsl.expected.dxc.hlsl @@ -0,0 +1,18 @@ +struct tint_symbol_1 { + uint in_vertex_index : SV_VertexID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 vs_main_inner(uint in_vertex_index) { + const float4 tint_symbol_3[3] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f)}; + return tint_symbol_3[in_vertex_index]; +} + +tint_symbol_2 vs_main(tint_symbol_1 tint_symbol) { + const float4 inner_result = vs_main_inner(tint_symbol.in_vertex_index); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1653.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1653.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac385e01f9 --- /dev/null +++ b/test/tint/bug/tint/1653.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +struct tint_symbol_1 { + uint in_vertex_index : SV_VertexID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 vs_main_inner(uint in_vertex_index) { + const float4 tint_symbol_3[3] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f)}; + return tint_symbol_3[in_vertex_index]; +} + +tint_symbol_2 vs_main(tint_symbol_1 tint_symbol) { + const float4 inner_result = vs_main_inner(tint_symbol.in_vertex_index); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/1653.wgsl.expected.glsl b/test/tint/bug/tint/1653.wgsl.expected.glsl new file mode 100644 index 0000000000..7775d99641 --- /dev/null +++ b/test/tint/bug/tint/1653.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es + +vec4 vs_main(uint in_vertex_index) { + vec4 tint_symbol[3] = vec4[3](vec4(0.0f, 0.0f, 0.0f, 1.0f), vec4(0.0f, 1.0f, 0.0f, 1.0f), vec4(1.0f, 1.0f, 0.0f, 1.0f)); + return tint_symbol[in_vertex_index]; +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vs_main(uint(gl_VertexID)); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} diff --git a/test/tint/bug/tint/1653.wgsl.expected.msl b/test/tint/bug/tint/1653.wgsl.expected.msl new file mode 100644 index 0000000000..09bd662f26 --- /dev/null +++ b/test/tint/bug/tint/1653.wgsl.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vs_main_inner(uint in_vertex_index) { + tint_array const tint_symbol_1 = tint_array{float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f)}; + return tint_symbol_1[in_vertex_index]; +} + +vertex tint_symbol vs_main(uint in_vertex_index [[vertex_id]]) { + float4 const inner_result = vs_main_inner(in_vertex_index); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + diff --git a/test/tint/bug/tint/1653.wgsl.expected.spvasm b/test/tint/bug/tint/1653.wgsl.expected.spvasm new file mode 100644 index 0000000000..b74723f99c --- /dev/null +++ b/test/tint/bug/tint/1653.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vs_main "vs_main" %in_vertex_index_1 %value %vertex_point_size + OpName %in_vertex_index_1 "in_vertex_index_1" + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %vs_main_inner "vs_main_inner" + OpName %in_vertex_index "in_vertex_index" + OpName %var_for_index "var_for_index" + OpName %vs_main "vs_main" + OpDecorate %in_vertex_index_1 BuiltIn VertexIndex + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %_arr_v4float_uint_3 ArrayStride 16 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%in_vertex_index_1 = OpVariable %_ptr_Input_uint Input + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %8 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %8 +%_ptr_Output_float = OpTypePointer Output %float + %11 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %11 + %12 = OpTypeFunction %v4float %uint + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v4float %11 %11 %11 %float_1 + %20 = OpConstantComposite %v4float %11 %float_1 %11 %float_1 + %21 = OpConstantComposite %v4float %float_1 %float_1 %11 %float_1 + %22 = OpConstantComposite %_arr_v4float_uint_3 %19 %20 %21 +%_ptr_Function__arr_v4float_uint_3 = OpTypePointer Function %_arr_v4float_uint_3 + %25 = OpConstantNull %_arr_v4float_uint_3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %void = OpTypeVoid + %29 = OpTypeFunction %void +%vs_main_inner = OpFunction %v4float None %12 +%in_vertex_index = OpFunctionParameter %uint + %15 = OpLabel +%var_for_index = OpVariable %_ptr_Function__arr_v4float_uint_3 Function %25 + OpStore %var_for_index %22 + %27 = OpAccessChain %_ptr_Function_v4float %var_for_index %in_vertex_index + %28 = OpLoad %v4float %27 + OpReturnValue %28 + OpFunctionEnd + %vs_main = OpFunction %void None %29 + %32 = OpLabel + %34 = OpLoad %uint %in_vertex_index_1 + %33 = OpFunctionCall %v4float %vs_main_inner %34 + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1653.wgsl.expected.wgsl b/test/tint/bug/tint/1653.wgsl.expected.wgsl new file mode 100644 index 0000000000..19056be0ed --- /dev/null +++ b/test/tint/bug/tint/1653.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +const TRI_VERTICES = array(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0)); + +@vertex +fn vs_main(@builtin(vertex_index) in_vertex_index : u32) -> @builtin(position) vec4 { + return TRI_VERTICES[in_vertex_index]; +} diff --git a/test/tint/bug/tint/219.spvasm.expected.hlsl b/test/tint/bug/tint/219.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/219.spvasm.expected.hlsl rename to test/tint/bug/tint/219.spvasm.expected.dxc.hlsl diff --git a/test/tint/bug/tint/219.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/219.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..f8a2ad7099 --- /dev/null +++ b/test/tint/bug/tint/219.spvasm.expected.fxc.hlsl @@ -0,0 +1,16 @@ +float x_200(inout float2 x_201) { + const float x_212 = x_201.x; + return x_212; +} + +void main_1() { + float2 x_11 = float2(0.0f, 0.0f); + const float x_12 = x_200(x_11); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/bug/tint/219.spvasm.expected.wgsl b/test/tint/bug/tint/219.spvasm.expected.wgsl index 3f4fca292a..edcc23c697 100644 --- a/test/tint/bug/tint/219.spvasm.expected.wgsl +++ b/test/tint/bug/tint/219.spvasm.expected.wgsl @@ -9,7 +9,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/bug/tint/221.wgsl b/test/tint/bug/tint/221.wgsl index 3beb8ed457..49c40d1fbf 100644 --- a/test/tint/bug/tint/221.wgsl +++ b/test/tint/bug/tint/221.wgsl @@ -7,7 +7,7 @@ struct Buf{ @group(0) @binding(0) var b : Buf; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : u32 = 0u; loop { diff --git a/test/tint/bug/tint/221.wgsl.expected.hlsl b/test/tint/bug/tint/221.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/221.wgsl.expected.hlsl rename to test/tint/bug/tint/221.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/221.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/221.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04406bba52 --- /dev/null +++ b/test/tint/bug/tint/221.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +RWByteAddressBuffer b : register(u0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint i = 0u; + [loop] while (true) { + if ((i >= b.Load(0u))) { + break; + } + const uint p_save = i; + if (((i % 2u) == 0u)) { + { + b.Store((4u + (4u * p_save)), asuint((b.Load((4u + (4u * p_save))) * 2u))); + i = (i + 1u); + } + continue; + } + b.Store((4u + (4u * p_save)), asuint(0u)); + { + b.Store((4u + (4u * p_save)), asuint((b.Load((4u + (4u * p_save))) * 2u))); + i = (i + 1u); + } + } + return; +} diff --git a/test/tint/bug/tint/221.wgsl.expected.msl b/test/tint/bug/tint/221.wgsl.expected.msl index 880fc07c00..ad7d150b6b 100644 --- a/test/tint/bug/tint/221.wgsl.expected.msl +++ b/test/tint/bug/tint/221.wgsl.expected.msl @@ -1,13 +1,22 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ uint arr[50]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct Buf { /* 0x0000 */ uint count; - /* 0x0004 */ tint_array_wrapper data; + /* 0x0004 */ tint_array data; }; kernel void tint_symbol(device Buf* tint_symbol_1 [[buffer(0)]]) { @@ -19,14 +28,14 @@ kernel void tint_symbol(device Buf* tint_symbol_1 [[buffer(0)]]) { uint const p_save = i; if (((i % 2u) == 0u)) { { - (*(tint_symbol_1)).data.arr[p_save] = ((*(tint_symbol_1)).data.arr[p_save] * 2u); + (*(tint_symbol_1)).data[p_save] = ((*(tint_symbol_1)).data[p_save] * 2u); i = (i + 1u); } continue; } - (*(tint_symbol_1)).data.arr[p_save] = 0u; + (*(tint_symbol_1)).data[p_save] = 0u; { - (*(tint_symbol_1)).data.arr[p_save] = ((*(tint_symbol_1)).data.arr[p_save] * 2u); + (*(tint_symbol_1)).data[p_save] = ((*(tint_symbol_1)).data[p_save] * 2u); i = (i + 1u); } } diff --git a/test/tint/bug/tint/221.wgsl.expected.spvasm b/test/tint/bug/tint/221.wgsl.expected.spvasm index 955f7d0d27..486cb6af88 100644 --- a/test/tint/bug/tint/221.wgsl.expected.spvasm +++ b/test/tint/bug/tint/221.wgsl.expected.spvasm @@ -27,44 +27,44 @@ %b = OpVariable %_ptr_StorageBuffer_Buf StorageBuffer %void = OpTypeVoid %7 = OpTypeFunction %void - %uint_0 = OpConstant %uint 0 + %11 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %14 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %bool = OpTypeBool %uint_2 = OpConstant %uint 2 %uint_1 = OpConstant %uint 1 %main = OpFunction %void None %7 %10 = OpLabel - %i = OpVariable %_ptr_Function_uint Function %14 - OpStore %i %uint_0 - OpBranch %15 - %15 = OpLabel - OpLoopMerge %16 %17 None - OpBranch %18 - %18 = OpLabel - %19 = OpLoad %uint %i + %i = OpVariable %_ptr_Function_uint Function %11 + OpStore %i %11 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %15 %16 None + OpBranch %17 + %17 = OpLabel + %18 = OpLoad %uint %i %21 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %22 = OpLoad %uint %21 - %23 = OpUGreaterThanEqual %bool %19 %22 + %23 = OpUGreaterThanEqual %bool %18 %22 OpSelectionMerge %25 None OpBranchConditional %23 %26 %25 %26 = OpLabel - OpBranch %16 + OpBranch %15 %25 = OpLabel %27 = OpLoad %uint %i %28 = OpLoad %uint %i %30 = OpUMod %uint %28 %uint_2 - %31 = OpIEqual %bool %30 %uint_0 + %31 = OpIEqual %bool %30 %11 OpSelectionMerge %32 None OpBranchConditional %31 %33 %32 %33 = OpLabel - OpBranch %17 + OpBranch %16 %32 = OpLabel %35 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_1 %27 - OpStore %35 %uint_0 - OpBranch %17 - %17 = OpLabel + OpStore %35 %11 + OpBranch %16 + %16 = OpLabel %36 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_1 %27 %37 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_1 %27 %38 = OpLoad %uint %37 @@ -73,7 +73,7 @@ %40 = OpLoad %uint %i %41 = OpIAdd %uint %40 %uint_1 OpStore %i %41 - OpBranch %15 - %16 = OpLabel + OpBranch %14 + %15 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/221.wgsl.expected.wgsl b/test/tint/bug/tint/221.wgsl.expected.wgsl index ee36aeaad3..0a49ba5000 100644 --- a/test/tint/bug/tint/221.wgsl.expected.wgsl +++ b/test/tint/bug/tint/221.wgsl.expected.wgsl @@ -7,7 +7,7 @@ struct Buf { @group(0) @binding(0) var b : Buf; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : u32 = 0u; loop { diff --git a/test/tint/bug/tint/292.wgsl b/test/tint/bug/tint/292.wgsl index daebb4f96f..ac2b421309 100644 --- a/test/tint/bug/tint/292.wgsl +++ b/test/tint/bug/tint/292.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main() -> @builtin(position) vec4 { var light : vec3 = vec3(1.2, 1., 2.); var negative_light : vec3 = -light; diff --git a/test/tint/bug/tint/292.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/292.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bb6e936f9d --- /dev/null +++ b/test/tint/bug/tint/292.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 main_inner() { + float3 light = float3(1.200000048f, 1.0f, 2.0f); + float3 negative_light = -(light); + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/292.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/292.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bb6e936f9d --- /dev/null +++ b/test/tint/bug/tint/292.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 main_inner() { + float3 light = float3(1.200000048f, 1.0f, 2.0f); + float3 negative_light = -(light); + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/292.wgsl.expected.glsl b/test/tint/bug/tint/292.wgsl.expected.glsl index 6a9c904908..6d1158685f 100644 --- a/test/tint/bug/tint/292.wgsl.expected.glsl +++ b/test/tint/bug/tint/292.wgsl.expected.glsl @@ -3,7 +3,7 @@ vec4 tint_symbol() { vec3 light = vec3(1.200000048f, 1.0f, 2.0f); vec3 negative_light = -(light); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/bug/tint/292.wgsl.expected.hlsl b/test/tint/bug/tint/292.wgsl.expected.hlsl deleted file mode 100644 index 37debaef76..0000000000 --- a/test/tint/bug/tint/292.wgsl.expected.hlsl +++ /dev/null @@ -1,16 +0,0 @@ -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 main_inner() { - float3 light = float3(1.200000048f, 1.0f, 2.0f); - float3 negative_light = -(light); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol main() { - const float4 inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/bug/tint/292.wgsl.expected.msl b/test/tint/bug/tint/292.wgsl.expected.msl index 4874e057df..c1f9d496be 100644 --- a/test/tint/bug/tint/292.wgsl.expected.msl +++ b/test/tint/bug/tint/292.wgsl.expected.msl @@ -8,7 +8,7 @@ struct tint_symbol_1 { float4 tint_symbol_inner() { float3 light = float3(1.200000048f, 1.0f, 2.0f); float3 negative_light = -(light); - return float4(); + return float4(0.0f); } vertex tint_symbol_1 tint_symbol() { diff --git a/test/tint/bug/tint/292.wgsl.expected.wgsl b/test/tint/bug/tint/292.wgsl.expected.wgsl index 071b9da8dd..b89b32731c 100644 --- a/test/tint/bug/tint/292.wgsl.expected.wgsl +++ b/test/tint/bug/tint/292.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main() -> @builtin(position) vec4 { var light : vec3 = vec3(1.200000048, 1.0, 2.0); var negative_light : vec3 = -(light); diff --git a/test/tint/bug/tint/294.wgsl.expected.hlsl b/test/tint/bug/tint/294.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/294.wgsl.expected.hlsl rename to test/tint/bug/tint/294.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/294.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/294.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f4843df71d --- /dev/null +++ b/test/tint/bug/tint/294.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +ByteAddressBuffer lights : register(t1, space0); diff --git a/test/tint/bug/tint/294.wgsl.expected.msl b/test/tint/bug/tint/294.wgsl.expected.msl index 09c1cf563a..77c8cea6d5 100644 --- a/test/tint/bug/tint/294.wgsl.expected.msl +++ b/test/tint/bug/tint/294.wgsl.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Light { float3 position; float3 colour; }; struct Lights { - Light light[1]; + tint_array light; }; diff --git a/test/tint/bug/tint/369.wgsl.expected.hlsl b/test/tint/bug/tint/369.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/369.wgsl.expected.hlsl rename to test/tint/bug/tint/369.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/369.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/369.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f7ba4cfc90 --- /dev/null +++ b/test/tint/bug/tint/369.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +ByteAddressBuffer SSBO : register(t0, space0); +cbuffer cbuffer_UBO : register(b0, space0) { + uint4 UBO[1]; +}; diff --git a/test/tint/bug/tint/369.wgsl.expected.spvasm b/test/tint/bug/tint/369.wgsl.expected.spvasm index f71cf08004..898a0f37ee 100644 --- a/test/tint/bug/tint/369.wgsl.expected.spvasm +++ b/test/tint/bug/tint/369.wgsl.expected.spvasm @@ -1,3 +1,5 @@ +SKIP: FAILED + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 @@ -36,3 +38,6 @@ %12 = OpLabel OpReturn OpFunctionEnd +1:1: Structure id 3 decorated as Block for variable in Uniform storage class must follow relaxed uniform buffer layout rules: member 0 is a matrix with stride 8 not satisfying alignment to 16 + %S = OpTypeStruct %mat2v2float + diff --git a/test/tint/bug/tint/403.wgsl b/test/tint/bug/tint/403.wgsl index 1c2a46fcbc..ed20da631b 100644 --- a/test/tint/bug/tint/403.wgsl +++ b/test/tint/bug/tint/403.wgsl @@ -10,7 +10,7 @@ struct vertexUniformBuffer2 { @group(1) @binding(0) var x_26 : vertexUniformBuffer2; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) gl_VertexIndex : u32) -> @builtin(position) vec4 { var indexable : array, 3>; let x_23 : mat2x2 = x_20.transform1; diff --git a/test/tint/bug/tint/403.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/403.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..de76d9e16a --- /dev/null +++ b/test/tint/bug/tint/403.wgsl.expected.dxc.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_20 : register(b0, space0) { + uint4 x_20[1]; +}; +cbuffer cbuffer_x_26 : register(b0, space1) { + uint4 x_26[1]; +}; + +struct tint_symbol_1 { + uint gl_VertexIndex : SV_VertexID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float2x2 tint_symbol_3(uint4 buffer[1], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + uint4 ubo_load = buffer[scalar_offset / 4]; + const uint scalar_offset_1 = ((offset + 8u)) / 4; + uint4 ubo_load_1 = buffer[scalar_offset_1 / 4]; + return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy))); +} + +float2x2 tint_symbol_5(uint4 buffer[1], uint offset) { + const uint scalar_offset_2 = ((offset + 0u)) / 4; + uint4 ubo_load_2 = buffer[scalar_offset_2 / 4]; + const uint scalar_offset_3 = ((offset + 8u)) / 4; + uint4 ubo_load_3 = buffer[scalar_offset_3 / 4]; + return float2x2(asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)), asfloat(((scalar_offset_3 & 2) ? ubo_load_3.zw : ubo_load_3.xy))); +} + +float4 main_inner(uint gl_VertexIndex) { + float2 indexable[3] = (float2[3])0; + const float2x2 x_23 = tint_symbol_3(x_20, 0u); + const float2x2 x_28 = tint_symbol_5(x_26, 0u); + const uint x_46 = gl_VertexIndex; + const float2 tint_symbol_7[3] = {float2(-1.0f, 1.0f), (1.0f).xx, (-1.0f).xx}; + indexable = tint_symbol_7; + const float2 x_51 = indexable[x_46]; + const float2 x_52 = mul(x_51, float2x2((x_23[0u] + x_28[0u]), (x_23[1u] + x_28[1u]))); + return float4(x_52.x, x_52.y, 0.0f, 1.0f); +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 inner_result = main_inner(tint_symbol.gl_VertexIndex); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/403.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/403.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..de76d9e16a --- /dev/null +++ b/test/tint/bug/tint/403.wgsl.expected.fxc.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_20 : register(b0, space0) { + uint4 x_20[1]; +}; +cbuffer cbuffer_x_26 : register(b0, space1) { + uint4 x_26[1]; +}; + +struct tint_symbol_1 { + uint gl_VertexIndex : SV_VertexID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float2x2 tint_symbol_3(uint4 buffer[1], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + uint4 ubo_load = buffer[scalar_offset / 4]; + const uint scalar_offset_1 = ((offset + 8u)) / 4; + uint4 ubo_load_1 = buffer[scalar_offset_1 / 4]; + return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy))); +} + +float2x2 tint_symbol_5(uint4 buffer[1], uint offset) { + const uint scalar_offset_2 = ((offset + 0u)) / 4; + uint4 ubo_load_2 = buffer[scalar_offset_2 / 4]; + const uint scalar_offset_3 = ((offset + 8u)) / 4; + uint4 ubo_load_3 = buffer[scalar_offset_3 / 4]; + return float2x2(asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)), asfloat(((scalar_offset_3 & 2) ? ubo_load_3.zw : ubo_load_3.xy))); +} + +float4 main_inner(uint gl_VertexIndex) { + float2 indexable[3] = (float2[3])0; + const float2x2 x_23 = tint_symbol_3(x_20, 0u); + const float2x2 x_28 = tint_symbol_5(x_26, 0u); + const uint x_46 = gl_VertexIndex; + const float2 tint_symbol_7[3] = {float2(-1.0f, 1.0f), (1.0f).xx, (-1.0f).xx}; + indexable = tint_symbol_7; + const float2 x_51 = indexable[x_46]; + const float2 x_52 = mul(x_51, float2x2((x_23[0u] + x_28[0u]), (x_23[1u] + x_28[1u]))); + return float4(x_52.x, x_52.y, 0.0f, 1.0f); +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 inner_result = main_inner(tint_symbol.gl_VertexIndex); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/403.wgsl.expected.glsl b/test/tint/bug/tint/403.wgsl.expected.glsl index de1c92f3b0..d82b85d63e 100644 --- a/test/tint/bug/tint/403.wgsl.expected.glsl +++ b/test/tint/bug/tint/403.wgsl.expected.glsl @@ -21,7 +21,7 @@ vec4 tint_symbol(uint tint_symbol_1) { mat2 x_23 = x_20.transform1; mat2 x_28 = x_26.transform2; uint x_46 = tint_symbol_1; - vec2 tint_symbol_2[3] = vec2[3](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f)); + vec2 tint_symbol_2[3] = vec2[3](vec2(-1.0f, 1.0f), vec2(1.0f), vec2(-1.0f)); indexable = tint_symbol_2; vec2 x_51 = indexable[x_46]; vec2 x_52 = (mat2((x_23[0u] + x_28[0u]), (x_23[1u] + x_28[1u])) * x_51); diff --git a/test/tint/bug/tint/403.wgsl.expected.hlsl b/test/tint/bug/tint/403.wgsl.expected.hlsl deleted file mode 100644 index 69c48bed02..0000000000 --- a/test/tint/bug/tint/403.wgsl.expected.hlsl +++ /dev/null @@ -1,48 +0,0 @@ -cbuffer cbuffer_x_20 : register(b0, space0) { - uint4 x_20[1]; -}; -cbuffer cbuffer_x_26 : register(b0, space1) { - uint4 x_26[1]; -}; - -struct tint_symbol_1 { - uint gl_VertexIndex : SV_VertexID; -}; -struct tint_symbol_2 { - float4 value : SV_Position; -}; - -float2x2 tint_symbol_3(uint4 buffer[1], uint offset) { - const uint scalar_offset = ((offset + 0u)) / 4; - uint4 ubo_load = buffer[scalar_offset / 4]; - const uint scalar_offset_1 = ((offset + 8u)) / 4; - uint4 ubo_load_1 = buffer[scalar_offset_1 / 4]; - return float2x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy))); -} - -float2x2 tint_symbol_5(uint4 buffer[1], uint offset) { - const uint scalar_offset_2 = ((offset + 0u)) / 4; - uint4 ubo_load_2 = buffer[scalar_offset_2 / 4]; - const uint scalar_offset_3 = ((offset + 8u)) / 4; - uint4 ubo_load_3 = buffer[scalar_offset_3 / 4]; - return float2x2(asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy)), asfloat(((scalar_offset_3 & 2) ? ubo_load_3.zw : ubo_load_3.xy))); -} - -float4 main_inner(uint gl_VertexIndex) { - float2 indexable[3] = (float2[3])0; - const float2x2 x_23 = tint_symbol_3(x_20, 0u); - const float2x2 x_28 = tint_symbol_5(x_26, 0u); - const uint x_46 = gl_VertexIndex; - const float2 tint_symbol_7[3] = {float2(-1.0f, 1.0f), float2(1.0f, 1.0f), float2(-1.0f, -1.0f)}; - indexable = tint_symbol_7; - const float2 x_51 = indexable[x_46]; - const float2 x_52 = mul(x_51, float2x2((x_23[0u] + x_28[0u]), (x_23[1u] + x_28[1u]))); - return float4(x_52.x, x_52.y, 0.0f, 1.0f); -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const float4 inner_result = main_inner(tint_symbol.gl_VertexIndex); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/bug/tint/403.wgsl.expected.msl b/test/tint/bug/tint/403.wgsl.expected.msl index caff5f35ff..10c2d04a86 100644 --- a/test/tint/bug/tint/403.wgsl.expected.msl +++ b/test/tint/bug/tint/403.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct vertexUniformBuffer1 { /* 0x0000 */ float2x2 transform1; }; @@ -13,18 +26,14 @@ struct tint_symbol_1 { float4 value [[position]]; }; -struct tint_array_wrapper { - float2 arr[3]; -}; - float4 tint_symbol_inner(uint gl_VertexIndex, const constant vertexUniformBuffer1* const tint_symbol_3, const constant vertexUniformBuffer2* const tint_symbol_4) { - tint_array_wrapper indexable = {}; + tint_array indexable = {}; float2x2 const x_23 = (*(tint_symbol_3)).transform1; float2x2 const x_28 = (*(tint_symbol_4)).transform2; uint const x_46 = gl_VertexIndex; - tint_array_wrapper const tint_symbol_2 = {.arr={float2(-1.0f, 1.0f), float2(1.0f, 1.0f), float2(-1.0f, -1.0f)}}; + tint_array const tint_symbol_2 = tint_array{float2(-1.0f, 1.0f), float2(1.0f), float2(-1.0f)}; indexable = tint_symbol_2; - float2 const x_51 = indexable.arr[x_46]; + float2 const x_51 = indexable[x_46]; float2 const x_52 = (float2x2((x_23[0u] + x_28[0u]), (x_23[1u] + x_28[1u])) * x_51); return float4(x_52[0], x_52[1], 0.0f, 1.0f); } diff --git a/test/tint/bug/tint/403.wgsl.expected.spvasm b/test/tint/bug/tint/403.wgsl.expected.spvasm index acde02b713..3491de40aa 100644 --- a/test/tint/bug/tint/403.wgsl.expected.spvasm +++ b/test/tint/bug/tint/403.wgsl.expected.spvasm @@ -1,3 +1,5 @@ +SKIP: FAILED + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 @@ -70,8 +72,8 @@ %39 = OpConstantComposite %v2float %float_n1 %float_n1 %40 = OpConstantComposite %_arr_v2float_uint_3 %37 %38 %39 %_ptr_Function_v2float = OpTypePointer Function %v2float + %44 = OpConstantNull %uint %uint_1 = OpConstant %uint 1 - %float_0 = OpConstant %float 0 %void = OpTypeVoid %57 = OpTypeFunction %void %main_inner = OpFunction %v4float None %20 @@ -85,17 +87,17 @@ OpStore %indexable %40 %42 = OpAccessChain %_ptr_Function_v2float %indexable %gl_VertexIndex %43 = OpLoad %v2float %42 - %44 = OpCompositeExtract %v2float %32 0 - %45 = OpCompositeExtract %v2float %34 0 - %46 = OpFAdd %v2float %44 %45 - %48 = OpCompositeExtract %v2float %32 1 - %49 = OpCompositeExtract %v2float %34 1 - %50 = OpFAdd %v2float %48 %49 - %51 = OpCompositeConstruct %mat2v2float %46 %50 - %52 = OpMatrixTimesVector %v2float %51 %43 - %53 = OpCompositeExtract %float %52 0 - %54 = OpCompositeExtract %float %52 1 - %56 = OpCompositeConstruct %v4float %53 %54 %float_0 %float_1 + %45 = OpCompositeExtract %v2float %32 0 + %46 = OpCompositeExtract %v2float %34 0 + %47 = OpFAdd %v2float %45 %46 + %49 = OpCompositeExtract %v2float %32 1 + %50 = OpCompositeExtract %v2float %34 1 + %51 = OpFAdd %v2float %49 %50 + %52 = OpCompositeConstruct %mat2v2float %47 %51 + %53 = OpMatrixTimesVector %v2float %52 %43 + %54 = OpCompositeExtract %float %53 0 + %55 = OpCompositeExtract %float %53 1 + %56 = OpCompositeConstruct %v4float %54 %55 %11 %float_1 OpReturnValue %56 OpFunctionEnd %main = OpFunction %void None %57 @@ -106,3 +108,6 @@ OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd +1:1: Structure id 14 decorated as Block for variable in Uniform storage class must follow relaxed uniform buffer layout rules: member 0 is a matrix with stride 8 not satisfying alignment to 16 + %vertexUniformBuffer1 = OpTypeStruct %mat2v2float + diff --git a/test/tint/bug/tint/403.wgsl.expected.wgsl b/test/tint/bug/tint/403.wgsl.expected.wgsl index 9ab50eca1d..a88948337f 100644 --- a/test/tint/bug/tint/403.wgsl.expected.wgsl +++ b/test/tint/bug/tint/403.wgsl.expected.wgsl @@ -10,7 +10,7 @@ struct vertexUniformBuffer2 { @group(1) @binding(0) var x_26 : vertexUniformBuffer2; -@stage(vertex) +@vertex fn main(@builtin(vertex_index) gl_VertexIndex : u32) -> @builtin(position) vec4 { var indexable : array, 3>; let x_23 : mat2x2 = x_20.transform1; diff --git a/test/tint/bug/tint/413.spvasm.expected.dxc.hlsl b/test/tint/bug/tint/413.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..309ad000ad --- /dev/null +++ b/test/tint/bug/tint/413.spvasm.expected.dxc.hlsl @@ -0,0 +1,18 @@ +Texture2D Src : register(t0, space0); +RWTexture2D Dst : register(u1, space0); + +void main_1() { + uint4 srcValue = uint4(0u, 0u, 0u, 0u); + const uint4 x_18 = Src.Load(int3(0, 0, 0)); + srcValue = x_18; + const uint x_22 = srcValue.x; + srcValue.x = (x_22 + asuint(1)); + Dst[(0).xx] = srcValue; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/bug/tint/413.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/413.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..309ad000ad --- /dev/null +++ b/test/tint/bug/tint/413.spvasm.expected.fxc.hlsl @@ -0,0 +1,18 @@ +Texture2D Src : register(t0, space0); +RWTexture2D Dst : register(u1, space0); + +void main_1() { + uint4 srcValue = uint4(0u, 0u, 0u, 0u); + const uint4 x_18 = Src.Load(int3(0, 0, 0)); + srcValue = x_18; + const uint x_22 = srcValue.x; + srcValue.x = (x_22 + asuint(1)); + Dst[(0).xx] = srcValue; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/bug/tint/413.spvasm.expected.glsl b/test/tint/bug/tint/413.spvasm.expected.glsl index 2853804b07..4d7262d660 100644 --- a/test/tint/bug/tint/413.spvasm.expected.glsl +++ b/test/tint/bug/tint/413.spvasm.expected.glsl @@ -4,11 +4,11 @@ layout(r32ui) uniform highp writeonly uimage2D Dst; uniform highp usampler2D Src_1; void main_1() { uvec4 srcValue = uvec4(0u, 0u, 0u, 0u); - uvec4 x_18 = texelFetch(Src_1, ivec2(0, 0), 0); + uvec4 x_18 = texelFetch(Src_1, ivec2(0), 0); srcValue = x_18; uint x_22 = srcValue.x; srcValue.x = (x_22 + uint(1)); - imageStore(Dst, ivec2(0, 0), srcValue); + imageStore(Dst, ivec2(0), srcValue); return; } diff --git a/test/tint/bug/tint/413.spvasm.expected.hlsl b/test/tint/bug/tint/413.spvasm.expected.hlsl deleted file mode 100644 index 8b5111a2f5..0000000000 --- a/test/tint/bug/tint/413.spvasm.expected.hlsl +++ /dev/null @@ -1,18 +0,0 @@ -Texture2D Src : register(t0, space0); -RWTexture2D Dst : register(u1, space0); - -void main_1() { - uint4 srcValue = uint4(0u, 0u, 0u, 0u); - const uint4 x_18 = Src.Load(int3(0, 0, 0)); - srcValue = x_18; - const uint x_22 = srcValue.x; - srcValue.x = (x_22 + asuint(1)); - Dst[int2(0, 0)] = srcValue; - return; -} - -[numthreads(1, 1, 1)] -void main() { - main_1(); - return; -} diff --git a/test/tint/bug/tint/413.spvasm.expected.msl b/test/tint/bug/tint/413.spvasm.expected.msl index d62ec29d9f..244b34abf3 100644 --- a/test/tint/bug/tint/413.spvasm.expected.msl +++ b/test/tint/bug/tint/413.spvasm.expected.msl @@ -3,12 +3,12 @@ using namespace metal; void main_1(texture2d tint_symbol_1, texture2d tint_symbol_2) { uint4 srcValue = 0u; - uint4 const x_18 = tint_symbol_1.read(uint2(int2(0, 0)), 0); + uint4 const x_18 = tint_symbol_1.read(uint2(int2(0)), 0); srcValue = x_18; uint const x_22 = srcValue[0]; srcValue[0] = (x_22 + as_type(1)); uint4 const x_27 = srcValue; - tint_symbol_2.write(x_27, uint2(int2(0, 0))); + tint_symbol_2.write(x_27, uint2(int2(0))); return; } diff --git a/test/tint/bug/tint/413.spvasm.expected.spvasm b/test/tint/bug/tint/413.spvasm.expected.spvasm index 1bab131c47..a918f6579a 100644 --- a/test/tint/bug/tint/413.spvasm.expected.spvasm +++ b/test/tint/bug/tint/413.spvasm.expected.spvasm @@ -31,8 +31,8 @@ %15 = OpConstantNull %v4uint %int = OpTypeInt 32 1 %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 - %21 = OpConstantComposite %v2int %int_0 %int_0 + %20 = OpConstantNull %v2int + %21 = OpConstantNull %int %uint_0 = OpConstant %uint 0 %_ptr_Function_uint = OpTypePointer Function %uint %int_1 = OpConstant %int 1 @@ -40,7 +40,7 @@ %11 = OpLabel %srcValue = OpVariable %_ptr_Function_v4uint Function %15 %17 = OpLoad %3 %Src - %16 = OpImageFetch %v4uint %17 %21 Lod %int_0 + %16 = OpImageFetch %v4uint %17 %20 Lod %21 OpStore %srcValue %16 %24 = OpAccessChain %_ptr_Function_uint %srcValue %uint_0 %25 = OpLoad %uint %24 @@ -50,7 +50,7 @@ OpStore %26 %29 %30 = OpLoad %v4uint %srcValue %32 = OpLoad %7 %Dst - OpImageWrite %32 %21 %30 + OpImageWrite %32 %20 %30 OpReturn OpFunctionEnd %main = OpFunction %void None %8 diff --git a/test/tint/bug/tint/413.spvasm.expected.wgsl b/test/tint/bug/tint/413.spvasm.expected.wgsl index 623f45adb0..e9101a2893 100644 --- a/test/tint/bug/tint/413.spvasm.expected.wgsl +++ b/test/tint/bug/tint/413.spvasm.expected.wgsl @@ -13,7 +13,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/bug/tint/453.wgsl b/test/tint/bug/tint/453.wgsl index 99e53b4c19..e45e85f0ee 100644 --- a/test/tint/bug/tint/453.wgsl +++ b/test/tint/bug/tint/453.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var Src : texture_2d; @group(0) @binding(1) var Dst : texture_storage_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var srcValue : vec4; let x_22 : vec4 = textureLoad(Src, vec2(0, 0), 0); diff --git a/test/tint/bug/tint/453.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/453.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e9260ee9e --- /dev/null +++ b/test/tint/bug/tint/453.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture2D Src : register(t0, space0); +RWTexture2D Dst : register(u1, space0); + +[numthreads(1, 1, 1)] +void main() { + uint4 srcValue = uint4(0u, 0u, 0u, 0u); + const uint4 x_22 = Src.Load(int3(0, 0, 0)); + srcValue = x_22; + const uint x_24 = srcValue.x; + const uint x_25 = (x_24 + 1u); + Dst[(0).xx] = srcValue.xxxx; + return; +} diff --git a/test/tint/bug/tint/453.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/453.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4e9260ee9e --- /dev/null +++ b/test/tint/bug/tint/453.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture2D Src : register(t0, space0); +RWTexture2D Dst : register(u1, space0); + +[numthreads(1, 1, 1)] +void main() { + uint4 srcValue = uint4(0u, 0u, 0u, 0u); + const uint4 x_22 = Src.Load(int3(0, 0, 0)); + srcValue = x_22; + const uint x_24 = srcValue.x; + const uint x_25 = (x_24 + 1u); + Dst[(0).xx] = srcValue.xxxx; + return; +} diff --git a/test/tint/bug/tint/453.wgsl.expected.glsl b/test/tint/bug/tint/453.wgsl.expected.glsl index c400cdf80d..1059fb2e99 100644 --- a/test/tint/bug/tint/453.wgsl.expected.glsl +++ b/test/tint/bug/tint/453.wgsl.expected.glsl @@ -4,11 +4,11 @@ layout(r32ui) uniform highp writeonly uimage2D Dst; uniform highp usampler2D Src_1; void tint_symbol() { uvec4 srcValue = uvec4(0u, 0u, 0u, 0u); - uvec4 x_22 = texelFetch(Src_1, ivec2(0, 0), 0); + uvec4 x_22 = texelFetch(Src_1, ivec2(0), 0); srcValue = x_22; uint x_24 = srcValue.x; uint x_25 = (x_24 + 1u); - imageStore(Dst, ivec2(0, 0), srcValue.xxxx); + imageStore(Dst, ivec2(0), srcValue.xxxx); return; } diff --git a/test/tint/bug/tint/453.wgsl.expected.hlsl b/test/tint/bug/tint/453.wgsl.expected.hlsl deleted file mode 100644 index 3dcf77f4a8..0000000000 --- a/test/tint/bug/tint/453.wgsl.expected.hlsl +++ /dev/null @@ -1,13 +0,0 @@ -Texture2D Src : register(t0, space0); -RWTexture2D Dst : register(u1, space0); - -[numthreads(1, 1, 1)] -void main() { - uint4 srcValue = uint4(0u, 0u, 0u, 0u); - const uint4 x_22 = Src.Load(int3(0, 0, 0)); - srcValue = x_22; - const uint x_24 = srcValue.x; - const uint x_25 = (x_24 + 1u); - Dst[int2(0, 0)] = srcValue.xxxx; - return; -} diff --git a/test/tint/bug/tint/453.wgsl.expected.msl b/test/tint/bug/tint/453.wgsl.expected.msl index d51ef16337..bde6be8511 100644 --- a/test/tint/bug/tint/453.wgsl.expected.msl +++ b/test/tint/bug/tint/453.wgsl.expected.msl @@ -3,12 +3,12 @@ using namespace metal; kernel void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], texture2d tint_symbol_2 [[texture(1)]]) { uint4 srcValue = 0u; - uint4 const x_22 = tint_symbol_1.read(uint2(int2(0, 0)), 0); + uint4 const x_22 = tint_symbol_1.read(uint2(int2(0)), 0); srcValue = x_22; uint const x_24 = srcValue[0]; uint const x_25 = (x_24 + 1u); uint4 const x_27 = srcValue; - tint_symbol_2.write(uint4(x_27).xxxx, uint2(int2(0, 0))); + tint_symbol_2.write(uint4(x_27).xxxx, uint2(int2(0))); return; } diff --git a/test/tint/bug/tint/453.wgsl.expected.spvasm b/test/tint/bug/tint/453.wgsl.expected.spvasm index 826d1d21b2..946633cefb 100644 --- a/test/tint/bug/tint/453.wgsl.expected.spvasm +++ b/test/tint/bug/tint/453.wgsl.expected.spvasm @@ -30,8 +30,8 @@ %15 = OpConstantNull %v4uint %int = OpTypeInt 32 1 %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 - %21 = OpConstantComposite %v2int %int_0 %int_0 + %20 = OpConstantNull %v2int + %21 = OpConstantNull %int %uint_0 = OpConstant %uint 0 %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 @@ -39,7 +39,7 @@ %11 = OpLabel %srcValue = OpVariable %_ptr_Function_v4uint Function %15 %17 = OpLoad %3 %Src - %16 = OpImageFetch %v4uint %17 %21 Lod %int_0 + %16 = OpImageFetch %v4uint %17 %20 Lod %21 OpStore %srcValue %16 %24 = OpAccessChain %_ptr_Function_uint %srcValue %uint_0 %25 = OpLoad %uint %24 @@ -47,6 +47,6 @@ %28 = OpLoad %v4uint %srcValue %30 = OpLoad %7 %Dst %31 = OpVectorShuffle %v4uint %28 %28 0 0 0 0 - OpImageWrite %30 %21 %31 + OpImageWrite %30 %20 %31 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/453.wgsl.expected.wgsl b/test/tint/bug/tint/453.wgsl.expected.wgsl index 8fe57951c8..87f03dfa2d 100644 --- a/test/tint/bug/tint/453.wgsl.expected.wgsl +++ b/test/tint/bug/tint/453.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var Dst : texture_storage_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var srcValue : vec4; let x_22 : vec4 = textureLoad(Src, vec2(0, 0), 0); diff --git a/test/tint/bug/tint/492.wgsl b/test/tint/bug/tint/492.wgsl index 7f361f4f08..e9cc78f344 100644 --- a/test/tint/bug/tint/492.wgsl +++ b/test/tint/bug/tint/492.wgsl @@ -1,7 +1,7 @@ struct S { a : i32, }; @group(0) @binding(0) var buf : S; -@stage(compute) @workgroup_size(1) fn main() { +@compute @workgroup_size(1) fn main() { let p : ptr = &buf.a; *p = 12; } diff --git a/test/tint/bug/tint/492.wgsl.expected.hlsl b/test/tint/bug/tint/492.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/492.wgsl.expected.hlsl rename to test/tint/bug/tint/492.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/492.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/492.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b33044d5b --- /dev/null +++ b/test/tint/bug/tint/492.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +RWByteAddressBuffer buf : register(u0, space0); + +[numthreads(1, 1, 1)] +void main() { + buf.Store(0u, asuint(12)); + return; +} diff --git a/test/tint/bug/tint/492.wgsl.expected.wgsl b/test/tint/bug/tint/492.wgsl.expected.wgsl index 9831e48fc7..0d16b19a71 100644 --- a/test/tint/bug/tint/492.wgsl.expected.wgsl +++ b/test/tint/bug/tint/492.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var buf : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p : ptr = &(buf.a); *(p) = 12; diff --git a/test/tint/bug/tint/534.wgsl b/test/tint/bug/tint/534.wgsl index 6a41cc417b..e716f8e4df 100644 --- a/test/tint/bug/tint/534.wgsl +++ b/test/tint/bug/tint/534.wgsl @@ -9,7 +9,7 @@ }; @group(0) @binding(0) var src : texture_2d; @group(0) @binding(1) var dst : texture_2d; -@group(0) @binding(2) var output : OutputBuf; +@group(0) @binding(2) var output : OutputBuf; @group(0) @binding(3) var uniforms : Uniforms; //@builtin(global_invocation_id) var GlobalInvocationID : vec3; // Fp16 logic @@ -18,7 +18,7 @@ fn ConvertToFp16FloatValue(fp32 : f32) -> u32 { return 1u; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var size : vec2 = textureDimensions(src); var dstTexCoord : vec2 = vec2(GlobalInvocationID.xy); diff --git a/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..801fe6ed34 --- /dev/null +++ b/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl @@ -0,0 +1,57 @@ +void set_uint4(inout uint4 vec, int idx, uint val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +Texture2D src : register(t0, space0); +Texture2D tint_symbol : register(t1, space0); +RWByteAddressBuffer output : register(u2, space0); +cbuffer cbuffer_uniforms : register(b3, space0) { + uint4 uniforms[1]; +}; + +uint ConvertToFp16FloatValue(float fp32) { + return 1u; +} + +struct tint_symbol_2 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +void main_inner(uint3 GlobalInvocationID) { + int2 tint_tmp; + src.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 size = tint_tmp; + int2 dstTexCoord = int2(GlobalInvocationID.xy); + int2 srcTexCoord = dstTexCoord; + if ((uniforms[0].x == 1u)) { + srcTexCoord.y = ((size.y - dstTexCoord.y) - 1); + } + float4 srcColor = src.Load(int3(srcTexCoord, 0)); + float4 dstColor = tint_symbol.Load(int3(dstTexCoord, 0)); + bool success = true; + uint4 srcColorBits = uint4(0u, 0u, 0u, 0u); + uint4 dstColorBits = uint4(dstColor); + { + [loop] for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) { + const uint tint_symbol_3 = ConvertToFp16FloatValue(srcColor[i]); + set_uint4(srcColorBits, i, tint_symbol_3); + bool tint_tmp_1 = success; + if (tint_tmp_1) { + tint_tmp_1 = (srcColorBits[i] == dstColorBits[i]); + } + success = (tint_tmp_1); + } + } + uint outputIndex = ((GlobalInvocationID.y * uint(size.x)) + GlobalInvocationID.x); + if (success) { + output.Store((4u * outputIndex), asuint(1u)); + } else { + output.Store((4u * outputIndex), asuint(0u)); + } +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_2 tint_symbol_1) { + main_inner(tint_symbol_1.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..801fe6ed34 --- /dev/null +++ b/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl @@ -0,0 +1,57 @@ +void set_uint4(inout uint4 vec, int idx, uint val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +Texture2D src : register(t0, space0); +Texture2D tint_symbol : register(t1, space0); +RWByteAddressBuffer output : register(u2, space0); +cbuffer cbuffer_uniforms : register(b3, space0) { + uint4 uniforms[1]; +}; + +uint ConvertToFp16FloatValue(float fp32) { + return 1u; +} + +struct tint_symbol_2 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +void main_inner(uint3 GlobalInvocationID) { + int2 tint_tmp; + src.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 size = tint_tmp; + int2 dstTexCoord = int2(GlobalInvocationID.xy); + int2 srcTexCoord = dstTexCoord; + if ((uniforms[0].x == 1u)) { + srcTexCoord.y = ((size.y - dstTexCoord.y) - 1); + } + float4 srcColor = src.Load(int3(srcTexCoord, 0)); + float4 dstColor = tint_symbol.Load(int3(dstTexCoord, 0)); + bool success = true; + uint4 srcColorBits = uint4(0u, 0u, 0u, 0u); + uint4 dstColorBits = uint4(dstColor); + { + [loop] for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) { + const uint tint_symbol_3 = ConvertToFp16FloatValue(srcColor[i]); + set_uint4(srcColorBits, i, tint_symbol_3); + bool tint_tmp_1 = success; + if (tint_tmp_1) { + tint_tmp_1 = (srcColorBits[i] == dstColorBits[i]); + } + success = (tint_tmp_1); + } + } + uint outputIndex = ((GlobalInvocationID.y * uint(size.x)) + GlobalInvocationID.x); + if (success) { + output.Store((4u * outputIndex), asuint(1u)); + } else { + output.Store((4u * outputIndex), asuint(0u)); + } +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_2 tint_symbol_1) { + main_inner(tint_symbol_1.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/tint/534.wgsl.expected.glsl b/test/tint/bug/tint/534.wgsl.expected.glsl index 1b68dd7590..cf35895643 100644 --- a/test/tint/bug/tint/534.wgsl.expected.glsl +++ b/test/tint/bug/tint/534.wgsl.expected.glsl @@ -48,9 +48,9 @@ void tint_symbol_1(uvec3 GlobalInvocationID) { } uint outputIndex = ((GlobalInvocationID.y * uint(size.x)) + GlobalInvocationID.x); if (success) { - tint_symbol.result[outputIndex] = uint(1); + tint_symbol.result[outputIndex] = 1u; } else { - tint_symbol.result[outputIndex] = uint(0); + tint_symbol.result[outputIndex] = 0u; } } diff --git a/test/tint/bug/tint/534.wgsl.expected.hlsl b/test/tint/bug/tint/534.wgsl.expected.hlsl deleted file mode 100644 index ecd26aa54b..0000000000 --- a/test/tint/bug/tint/534.wgsl.expected.hlsl +++ /dev/null @@ -1,57 +0,0 @@ -void set_uint4(inout uint4 vec, int idx, uint val) { - vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; -} - -Texture2D src : register(t0, space0); -Texture2D tint_symbol : register(t1, space0); -RWByteAddressBuffer output : register(u2, space0); -cbuffer cbuffer_uniforms : register(b3, space0) { - uint4 uniforms[1]; -}; - -uint ConvertToFp16FloatValue(float fp32) { - return 1u; -} - -struct tint_symbol_2 { - uint3 GlobalInvocationID : SV_DispatchThreadID; -}; - -void main_inner(uint3 GlobalInvocationID) { - int2 tint_tmp; - src.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 size = tint_tmp; - int2 dstTexCoord = int2(GlobalInvocationID.xy); - int2 srcTexCoord = dstTexCoord; - if ((uniforms[0].x == 1u)) { - srcTexCoord.y = ((size.y - dstTexCoord.y) - 1); - } - float4 srcColor = src.Load(int3(srcTexCoord, 0)); - float4 dstColor = tint_symbol.Load(int3(dstTexCoord, 0)); - bool success = true; - uint4 srcColorBits = uint4(0u, 0u, 0u, 0u); - uint4 dstColorBits = uint4(dstColor); - { - [loop] for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) { - const uint tint_symbol_3 = ConvertToFp16FloatValue(srcColor[i]); - set_uint4(srcColorBits, i, tint_symbol_3); - bool tint_tmp_1 = success; - if (tint_tmp_1) { - tint_tmp_1 = (srcColorBits[i] == dstColorBits[i]); - } - success = (tint_tmp_1); - } - } - uint outputIndex = ((GlobalInvocationID.y * uint(size.x)) + GlobalInvocationID.x); - if (success) { - output.Store((4u * outputIndex), asuint(uint(1))); - } else { - output.Store((4u * outputIndex), asuint(uint(0))); - } -} - -[numthreads(1, 1, 1)] -void main(tint_symbol_2 tint_symbol_1) { - main_inner(tint_symbol_1.GlobalInvocationID); - return; -} diff --git a/test/tint/bug/tint/534.wgsl.expected.msl b/test/tint/bug/tint/534.wgsl.expected.msl index 041713a79d..2323162a45 100644 --- a/test/tint/bug/tint/534.wgsl.expected.msl +++ b/test/tint/bug/tint/534.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint dstTextureFlipY; /* 0x0004 */ uint isFloat16; @@ -9,7 +22,7 @@ struct Uniforms { }; struct OutputBuf { - /* 0x0000 */ uint result[1]; + /* 0x0000 */ tint_array result; }; uint ConvertToFp16FloatValue(float fp32) { @@ -35,9 +48,9 @@ void tint_symbol_inner(uint3 GlobalInvocationID, texture2d u32 { return 1u; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var size : vec2 = textureDimensions(src); var dstTexCoord : vec2 = vec2(GlobalInvocationID.xy); diff --git a/test/tint/bug/tint/744.wgsl b/test/tint/bug/tint/744.wgsl index 4391fd8c7f..a978f81573 100644 --- a/test/tint/bug/tint/744.wgsl +++ b/test/tint/bug/tint/744.wgsl @@ -9,10 +9,10 @@ @group(0) @binding(0) var firstMatrix : Matrix; @group(0) @binding(1) var secondMatrix : Matrix; -@group(0) @binding(2) var resultMatrix : Matrix; +@group(0) @binding(2) var resultMatrix : Matrix; @group(0) @binding(3) var uniforms : Uniforms; -@stage(compute) @workgroup_size(2,2,1) +@compute @workgroup_size(2,2,1) fn main(@builtin(global_invocation_id) global_id : vec3) { let resultCell : vec2 = vec2(global_id.y, global_id.x); let dimInner : u32 = uniforms.aShape.y; diff --git a/test/tint/bug/tint/744.wgsl.expected.hlsl b/test/tint/bug/tint/744.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/744.wgsl.expected.hlsl rename to test/tint/bug/tint/744.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/744.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/744.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7870d26585 --- /dev/null +++ b/test/tint/bug/tint/744.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +ByteAddressBuffer firstMatrix : register(t0, space0); +ByteAddressBuffer secondMatrix : register(t1, space0); +RWByteAddressBuffer resultMatrix : register(u2, space0); +cbuffer cbuffer_uniforms : register(b3, space0) { + uint4 uniforms[2]; +}; + +struct tint_symbol_1 { + uint3 global_id : SV_DispatchThreadID; +}; + +void main_inner(uint3 global_id) { + const uint2 resultCell = uint2(global_id.y, global_id.x); + const uint dimInner = uniforms[0].y; + const uint dimOutter = uniforms[1].y; + uint result = 0u; + { + [loop] for(uint i = 0u; (i < dimInner); i = (i + 1u)) { + const uint a = (i + (resultCell.x * dimInner)); + const uint b = (resultCell.y + (i * dimOutter)); + result = (result + (firstMatrix.Load((4u * a)) * secondMatrix.Load((4u * b)))); + } + } + const uint index = (resultCell.y + (resultCell.x * dimOutter)); + resultMatrix.Store((4u * index), asuint(result)); +} + +[numthreads(2, 2, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.global_id); + return; +} diff --git a/test/tint/bug/tint/744.wgsl.expected.msl b/test/tint/bug/tint/744.wgsl.expected.msl index c4dc5b4193..7c01635f48 100644 --- a/test/tint/bug/tint/744.wgsl.expected.msl +++ b/test/tint/bug/tint/744.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint2 aShape; /* 0x0008 */ uint2 bShape; @@ -8,7 +21,7 @@ struct Uniforms { }; struct Matrix { - /* 0x0000 */ uint numbers[1]; + /* 0x0000 */ tint_array numbers; }; void tint_symbol_inner(uint3 global_id, const constant Uniforms* const tint_symbol_1, const device Matrix* const tint_symbol_2, const device Matrix* const tint_symbol_3, device Matrix* const tint_symbol_4) { diff --git a/test/tint/bug/tint/744.wgsl.expected.spvasm b/test/tint/bug/tint/744.wgsl.expected.spvasm index 33d57e0a32..f83372b822 100644 --- a/test/tint/bug/tint/744.wgsl.expected.spvasm +++ b/test/tint/bug/tint/744.wgsl.expected.spvasm @@ -33,7 +33,6 @@ OpDecorate %secondMatrix NonWritable OpDecorate %secondMatrix DescriptorSet 0 OpDecorate %secondMatrix Binding 1 - OpDecorate %resultMatrix NonReadable OpDecorate %resultMatrix DescriptorSet 0 OpDecorate %resultMatrix Binding 2 OpDecorate %Uniforms Block @@ -63,16 +62,16 @@ %uint_1 = OpConstant %uint 1 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_2 = OpConstant %uint 2 + %31 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %33 = OpConstantNull %uint %bool = OpTypeBool %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %69 = OpTypeFunction %void %main_inner = OpFunction %void None %15 %global_id = OpFunctionParameter %v3uint %19 = OpLabel - %result = OpVariable %_ptr_Function_uint Function %33 - %i = OpVariable %_ptr_Function_uint Function %33 + %result = OpVariable %_ptr_Function_uint Function %31 + %i = OpVariable %_ptr_Function_uint Function %31 %20 = OpCompositeExtract %uint %global_id 1 %21 = OpCompositeExtract %uint %global_id 0 %22 = OpCompositeConstruct %v2uint %20 %21 @@ -80,8 +79,8 @@ %27 = OpLoad %uint %26 %29 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 %uint_1 %30 = OpLoad %uint %29 - OpStore %result %uint_0 - OpStore %i %uint_0 + OpStore %result %31 + OpStore %i %31 OpBranch %35 %35 = OpLabel OpLoopMerge %36 %37 None diff --git a/test/tint/bug/tint/744.wgsl.expected.wgsl b/test/tint/bug/tint/744.wgsl.expected.wgsl index 9ac2447830..ec33a80731 100644 --- a/test/tint/bug/tint/744.wgsl.expected.wgsl +++ b/test/tint/bug/tint/744.wgsl.expected.wgsl @@ -12,11 +12,11 @@ struct Matrix { @group(0) @binding(1) var secondMatrix : Matrix; -@group(0) @binding(2) var resultMatrix : Matrix; +@group(0) @binding(2) var resultMatrix : Matrix; @group(0) @binding(3) var uniforms : Uniforms; -@stage(compute) @workgroup_size(2, 2, 1) +@compute @workgroup_size(2, 2, 1) fn main(@builtin(global_invocation_id) global_id : vec3) { let resultCell : vec2 = vec2(global_id.y, global_id.x); let dimInner : u32 = uniforms.aShape.y; diff --git a/test/tint/bug/tint/749.spvasm.expected.dxc.hlsl b/test/tint/bug/tint/749.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..8605266c5b --- /dev/null +++ b/test/tint/bug/tint/749.spvasm.expected.dxc.hlsl @@ -0,0 +1,1658 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_188 : register(b0, space0) { + uint4 x_188[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_932 = temp; + temp = 0; + temp = x_932; + const float3 x_523 = float3(3.0f, 2.0f, 3.0f); + const int x_933 = i; + i = 0; + i = x_933; + const int x_28 = i; + const int x_934 = j; + j = 0; + j = x_934; + const float3 x_524 = float3(x_523.y, x_523.x, x_523.y); + const int x_935 = temp; + temp = 0; + temp = x_935; + const int x_30_save = x_28; + const int x_936 = obj.numbers[x_30_save]; + { + int tint_symbol_1[10] = obj.numbers; + tint_symbol_1[x_30_save] = 0; + obj.numbers = tint_symbol_1; + } + { + int tint_symbol_3[10] = obj.numbers; + tint_symbol_3[x_30_save] = x_936; + obj.numbers = tint_symbol_3; + } + const int x_31 = obj.numbers[x_30_save]; + const int x_937 = temp; + temp = 0; + temp = x_937; + temp = x_31; + const int x_938 = j; + j = 0; + j = x_938; + const float3 x_525 = float3(x_523.z, 1.0f, x_523.y); + const int x_939 = i; + i = 0; + i = x_939; + const int x_32 = i; + const int x_940 = obj.numbers[x_30_save]; + { + int tint_symbol_5[10] = obj.numbers; + tint_symbol_5[x_30_save] = 0; + obj.numbers = tint_symbol_5; + } + { + int tint_symbol_7[10] = obj.numbers; + tint_symbol_7[x_30_save] = x_940; + obj.numbers = tint_symbol_7; + } + const int x_33 = j; + const int x_941 = i; + i = 0; + i = x_941; + const float3 x_526 = float3(x_525.x, x_525.z, x_525.z); + const int x_942 = obj.numbers[x_30_save]; + { + int tint_symbol_9[10] = obj.numbers; + tint_symbol_9[x_30_save] = 0; + obj.numbers = tint_symbol_9; + } + { + int tint_symbol_11[10] = obj.numbers; + tint_symbol_11[x_30_save] = x_942; + obj.numbers = tint_symbol_11; + } + const int x_34_save = x_33; + const int x_35 = obj.numbers[x_34_save]; + const QuicksortObject x_943 = obj; + const int tint_symbol_52[10] = (int[10])0; + const QuicksortObject tint_symbol_53 = {tint_symbol_52}; + obj = tint_symbol_53; + obj = x_943; + const float2 x_527 = float2(x_526.x, x_526.x); + const int x_36_save = x_32; + const float3 x_528 = float3(x_524.x, x_524.z, x_524.x); + { + int tint_symbol_13[10] = obj.numbers; + tint_symbol_13[x_36_save] = x_35; + obj.numbers = tint_symbol_13; + } + const QuicksortObject x_944 = obj; + const int tint_symbol_54[10] = (int[10])0; + const QuicksortObject tint_symbol_55 = {tint_symbol_54}; + obj = tint_symbol_55; + obj = x_944; + const float3 x_529 = float3(x_526.y, x_526.z, x_526.x); + const int x_945 = i; + i = 0; + i = x_945; + const int x_37 = j; + const int x_946 = temp; + temp = 0; + temp = x_946; + const float2 x_530 = float2(x_529.z, x_529.y); + const int x_947 = obj.numbers[x_34_save]; + { + int tint_symbol_15[10] = obj.numbers; + tint_symbol_15[x_34_save] = 0; + obj.numbers = tint_symbol_15; + } + { + int tint_symbol_17[10] = obj.numbers; + tint_symbol_17[x_34_save] = x_947; + obj.numbers = tint_symbol_17; + } + const int x_38 = temp; + const int x_948 = j; + j = 0; + j = x_948; + const float3 x_531 = float3(x_527.x, x_526.y, x_526.x); + const int x_949 = obj.numbers[x_36_save]; + { + int tint_symbol_19[10] = obj.numbers; + tint_symbol_19[x_36_save] = 0; + obj.numbers = tint_symbol_19; + } + { + int tint_symbol_21[10] = obj.numbers; + tint_symbol_21[x_36_save] = x_949; + obj.numbers = tint_symbol_21; + } + const QuicksortObject x_950 = obj; + const int tint_symbol_56[10] = (int[10])0; + const QuicksortObject tint_symbol_57 = {tint_symbol_56}; + obj = tint_symbol_57; + obj = x_950; + const float3 x_532 = float3(x_528.x, x_528.y, x_528.x); + const int x_951 = obj.numbers[x_34_save]; + { + int tint_symbol_23[10] = obj.numbers; + tint_symbol_23[x_34_save] = 0; + obj.numbers = tint_symbol_23; + } + { + int tint_symbol_25[10] = obj.numbers; + tint_symbol_25[x_34_save] = x_951; + obj.numbers = tint_symbol_25; + } + { + int tint_symbol_27[10] = obj.numbers; + tint_symbol_27[x_37] = x_38; + obj.numbers = tint_symbol_27; + } + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int param_3 = 0; + int i_1 = 0; + int j_1 = 0; + int param_2 = 0; + int param_1 = 0; + int param = 0; + int pivot = 0; + float2 x_537 = float2(0.0f, 0.0f); + float3 x_538 = float3(0.0f, 0.0f, 0.0f); + const int x_952 = h; + h = 0; + h = x_952; + const int x_41 = h; + const int x_953 = l; + l = 0; + l = x_953; + const int x_42_save = x_41; + const int x_954 = obj.numbers[x_42_save]; + { + int tint_symbol_29[10] = obj.numbers; + tint_symbol_29[x_42_save] = 0; + obj.numbers = tint_symbol_29; + } + { + int tint_symbol_31[10] = obj.numbers; + tint_symbol_31[x_42_save] = x_954; + obj.numbers = tint_symbol_31; + } + const int x_43 = obj.numbers[x_42_save]; + const int x_955 = param_3; + param_3 = 0; + param_3 = x_955; + const float3 x_534 = float3(3.0f, 1.0f, 3.0f); + const int x_956 = param_1; + param_1 = 0; + param_1 = x_956; + pivot = x_43; + const int x_45 = l; + const int x_957 = h; + h = 0; + h = x_957; + const int x_958 = j_1; + j_1 = 0; + j_1 = x_958; + const float3 x_535 = float3(x_534.y, x_534.z, x_534.y); + const int x_959 = l; + l = 0; + l = x_959; + i_1 = (x_45 - asint(1u)); + const int x_49 = l; + const float3 x_536 = float3(x_534.x, x_534.z, x_535.x); + j_1 = 10; + const QuicksortObject x_960 = obj; + const int tint_symbol_58[10] = (int[10])0; + const QuicksortObject tint_symbol_59 = {tint_symbol_58}; + obj = tint_symbol_59; + obj = x_960; + [loop] while (true) { + const int x_961 = pivot; + pivot = 0; + pivot = x_961; + const int x_962 = param_1; + param_1 = 0; + param_1 = x_962; + const int x_55 = j_1; + const int x_963 = pivot; + pivot = 0; + pivot = x_963; + x_537 = float2(2.0f, 3.0f); + const QuicksortObject x_964 = obj; + const int tint_symbol_60[10] = (int[10])0; + const QuicksortObject tint_symbol_61 = {tint_symbol_60}; + obj = tint_symbol_61; + obj = x_964; + const int x_56 = h; + const int x_965 = h; + h = 0; + h = x_965; + const int x_966 = param; + param = 0; + param = x_966; + const int x_967 = j_1; + j_1 = 0; + j_1 = x_967; + x_538 = float3(x_534.x, x_537.y, x_534.z); + const int x_968 = param; + param = 0; + param = x_968; + if ((x_55 <= (x_56 - asint(1u)))) { + } else { + break; + } + const int x_60 = j_1; + const int x_969 = obj.numbers[x_42_save]; + { + int tint_symbol_33[10] = obj.numbers; + tint_symbol_33[x_42_save] = 0; + obj.numbers = tint_symbol_33; + } + { + int tint_symbol_35[10] = obj.numbers; + tint_symbol_35[x_42_save] = x_969; + obj.numbers = tint_symbol_35; + } + const int x_61_save = x_60; + const int x_970 = h; + h = 0; + h = x_970; + const float3 x_539 = float3(x_537.x, x_535.z, x_537.x); + const int x_971 = param_1; + param_1 = 0; + param_1 = x_971; + const int x_62 = obj.numbers[x_61_save]; + const QuicksortObject x_972 = obj; + const int tint_symbol_62[10] = (int[10])0; + const QuicksortObject tint_symbol_63 = {tint_symbol_62}; + obj = tint_symbol_63; + obj = x_972; + const int x_63 = pivot; + const float2 x_540 = float2(2.0f, x_534.z); + const int x_973 = i_1; + i_1 = 0; + i_1 = x_973; + const int x_974 = l; + l = 0; + l = x_974; + const float3 x_541 = float3(x_534.y, x_534.x, x_534.y); + const int x_975 = pivot; + pivot = 0; + pivot = x_975; + if ((x_62 <= x_63)) { + const float3 x_542 = float3(x_541.z, x_541.x, x_541.x); + const int x_976 = param_3; + param_3 = 0; + param_3 = x_976; + const int x_67 = i_1; + const int x_977 = pivot; + pivot = 0; + pivot = x_977; + const float2 x_543 = float2(x_539.x, x_541.y); + const int x_978 = i_1; + i_1 = 0; + i_1 = x_978; + const int x_979 = param; + param = 0; + param = x_979; + i_1 = (x_67 + asint(1u)); + const int x_980 = l; + l = 0; + l = x_980; + const float3 x_544 = float3(3.0f, 2.0f, x_540.x); + const int x_70 = i_1; + const float2 x_545 = float2(x_537.y, x_538.x); + const int x_981 = param; + param = 0; + param = x_981; + param = x_70; + const int x_982 = param; + param = 0; + param = x_982; + const float2 x_546 = float2(x_545.x, x_545.x); + const int x_983 = i_1; + i_1 = 0; + i_1 = x_983; + param_1 = j_1; + const int x_984 = param_3; + param_3 = 0; + param_3 = x_984; + swap_i1_i1_(param, param_1); + const int x_985 = param_1; + param_1 = 0; + param_1 = x_985; + } + const QuicksortObject x_986 = obj; + const int tint_symbol_64[10] = (int[10])0; + const QuicksortObject tint_symbol_65 = {tint_symbol_64}; + obj = tint_symbol_65; + obj = x_986; + { + const int x_987 = h; + h = 0; + h = x_987; + const int x_74 = j_1; + const int x_988 = h; + h = 0; + h = x_988; + const float3 x_547 = float3(x_539.x, x_541.z, x_541.z); + const int x_989 = obj.numbers[x_61_save]; + { + int tint_symbol_37[10] = obj.numbers; + tint_symbol_37[x_61_save] = 0; + obj.numbers = tint_symbol_37; + } + { + int tint_symbol_39[10] = obj.numbers; + tint_symbol_39[x_61_save] = x_989; + obj.numbers = tint_symbol_39; + } + const int x_990 = param; + param = 0; + param = x_990; + j_1 = (1 + x_74); + const int x_991 = param_1; + param_1 = 0; + param_1 = x_991; + const float3 x_548 = float3(x_541.y, x_541.z, x_541.x); + const int x_992 = obj.numbers[x_61_save]; + { + int tint_symbol_41[10] = obj.numbers; + tint_symbol_41[x_61_save] = 0; + obj.numbers = tint_symbol_41; + } + { + int tint_symbol_43[10] = obj.numbers; + tint_symbol_43[x_61_save] = x_992; + obj.numbers = tint_symbol_43; + } + } + } + const int x_76 = i_1; + const int x_993 = obj.numbers[x_42_save]; + { + int tint_symbol_45[10] = obj.numbers; + tint_symbol_45[x_42_save] = 0; + obj.numbers = tint_symbol_45; + } + { + int tint_symbol_47[10] = obj.numbers; + tint_symbol_47[x_42_save] = x_993; + obj.numbers = tint_symbol_47; + } + const float2 x_549 = float2(x_534.x, x_534.y); + const QuicksortObject x_994 = obj; + const int tint_symbol_66[10] = (int[10])0; + const QuicksortObject tint_symbol_67 = {tint_symbol_66}; + obj = tint_symbol_67; + obj = x_994; + const int x_995 = h; + h = 0; + h = x_995; + i_1 = (1 + x_76); + const int x_996 = param_1; + param_1 = 0; + param_1 = x_996; + const int x_79 = i_1; + const int x_997 = j_1; + j_1 = 0; + j_1 = x_997; + const float2 x_550 = float2(x_534.x, x_534.x); + const int x_998 = param_1; + param_1 = 0; + param_1 = x_998; + param_2 = x_79; + const float2 x_551 = float2(x_534.y, x_536.x); + const int x_999 = pivot; + pivot = 0; + pivot = x_999; + const int x_81 = h; + const float2 x_552 = float2(x_550.x, x_549.y); + const int x_1000 = h; + h = 0; + h = x_1000; + param_3 = x_81; + const int x_1001 = i_1; + i_1 = 0; + i_1 = x_1001; + const float2 x_553 = float2(x_549.y, x_552.x); + const int x_1002 = h; + h = 0; + h = x_1002; + swap_i1_i1_(param_2, param_3); + const int x_1003 = l; + l = 0; + l = x_1003; + const float2 x_554 = float2(x_536.z, 2.0f); + const int x_1004 = param_1; + param_1 = 0; + param_1 = x_1004; + const int x_83 = i_1; + const int x_1005 = param; + param = 0; + param = x_1005; + const float2 x_555 = float2(x_534.y, x_534.x); + const int x_1006 = j_1; + j_1 = 0; + j_1 = x_1006; + return x_83; +} + +void quicksort_() { + int param_4 = 0; + int h_1 = 0; + int p = 0; + int l_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int param_5 = 0; + l_1 = 0; + const int x_1007 = param_5; + param_5 = 0; + param_5 = x_1007; + h_1 = 9; + const int x_1008[10] = stack; + const int tint_symbol_68[10] = (int[10])0; + stack = tint_symbol_68; + stack = x_1008; + const float2 x_556 = (2.0f).xx; + const int x_1009 = param_5; + param_5 = 0; + param_5 = x_1009; + top = -1; + const int x_1010 = p; + p = 0; + p = x_1010; + const int x_93 = top; + const float2 x_557 = (1.0f).xx; + const int x_1011 = p; + p = 0; + p = x_1011; + const int x_94 = (x_93 + asint(1u)); + const int x_1012 = top; + top = 0; + top = x_1012; + const float2 x_558 = float2(x_556.y, x_557.y); + const int x_1013 = param_4; + param_4 = 0; + param_4 = x_1013; + top = x_94; + const int x_1014 = h_1; + h_1 = 0; + h_1 = x_1014; + const float3 x_559 = float3(x_557.y, x_557.x, x_557.x); + const int x_1015 = param_4; + param_4 = 0; + param_4 = x_1015; + const int x_95 = l_1; + const QuicksortObject x_1016 = obj; + const int tint_symbol_69[10] = (int[10])0; + const QuicksortObject tint_symbol_70 = {tint_symbol_69}; + obj = tint_symbol_70; + obj = x_1016; + const float3 x_560 = float3(x_559.y, x_559.x, x_557.x); + const int x_96_save = x_94; + const int x_1017[10] = stack; + const int tint_symbol_71[10] = (int[10])0; + stack = tint_symbol_71; + stack = x_1017; + const float3 x_561 = float3(x_556.y, x_556.y, x_556.y); + const int x_1018 = l_1; + l_1 = 0; + l_1 = 0; + stack[x_96_save] = x_95; + const int x_1019 = param_5; + param_5 = 0; + param_5 = x_1019; + const int x_97 = top; + const int x_1020 = param_4; + param_4 = 0; + param_4 = x_1020; + const float3 x_562 = float3(3.0f, x_558.y, 2.0f); + const int x_1021 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1021; + const int x_98 = (x_97 + 1); + const int x_1022 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1022; + const float3 x_563 = float3(x_559.x, x_559.z, x_556.y); + top = x_98; + const int x_1023 = param_4; + param_4 = 0; + param_4 = x_1023; + const int x_99 = h_1; + const int x_1024 = param_4; + param_4 = 0; + param_4 = x_1024; + const float3 x_564 = float3(x_558.x, x_561.x, x_558.y); + const int x_1025 = l_1; + l_1 = 0; + l_1 = x_1025; + const int x_100_save = x_98; + const int x_1026 = param_5; + param_5 = 0; + param_5 = x_1026; + const float2 x_565 = float2(x_564.z, x_564.z); + const int x_1027 = p; + p = 0; + p = x_1027; + stack[x_100_save] = x_99; + [loop] while (true) { + const float3 x_566 = float3(x_563.x, x_563.x, x_563.x); + const int x_1028 = h_1; + h_1 = 0; + h_1 = x_1028; + const int x_1029[10] = stack; + const int tint_symbol_72[10] = (int[10])0; + stack = tint_symbol_72; + stack = x_1029; + const int x_106 = top; + const int x_1030[10] = stack; + const int tint_symbol_73[10] = (int[10])0; + stack = tint_symbol_73; + stack = x_1030; + const float2 x_567 = float2(x_558.x, x_564.z); + const int x_1031 = param_4; + param_4 = 0; + param_4 = x_1031; + if ((x_106 >= asint(0u))) { + } else { + break; + } + const QuicksortObject x_1032 = obj; + const int tint_symbol_74[10] = (int[10])0; + const QuicksortObject tint_symbol_75 = {tint_symbol_74}; + obj = tint_symbol_75; + obj = x_1032; + const float3 x_568 = float3(x_559.y, x_559.x, x_563.y); + const int x_1033 = param_4; + param_4 = 0; + param_4 = x_1033; + const int x_108 = top; + const float3 x_569 = float3(x_565.x, x_567.y, x_565.x); + const int x_1034 = h_1; + h_1 = 0; + h_1 = x_1034; + const float2 x_570 = float2(x_556.x, x_556.x); + const int x_1035 = p; + p = 0; + p = x_1035; + top = (x_108 - asint(1u)); + const int x_1036 = p; + p = 0; + p = x_1036; + const int x_110_save = x_108; + const int x_1037 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1037; + const int x_111 = stack[x_110_save]; + const int x_1038[10] = stack; + const int tint_symbol_76[10] = (int[10])0; + stack = tint_symbol_76; + stack = x_1038; + const float3 x_571 = float3(x_559.y, x_559.x, x_564.y); + const int x_1039 = l_1; + l_1 = 0; + l_1 = x_1039; + h_1 = x_111; + const int x_1040[10] = stack; + const int tint_symbol_77[10] = (int[10])0; + stack = tint_symbol_77; + stack = x_1040; + const float2 x_572 = float2(x_562.y, x_561.y); + const int x_1041 = p; + p = 0; + p = x_1041; + const int x_112 = top; + const int x_1042 = param_4; + param_4 = 0; + param_4 = x_1042; + const int x_1043 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1043; + const float2 x_573 = float2(2.0f, 3.0f); + top = (x_112 - 1); + const int x_1044 = param_5; + param_5 = 0; + param_5 = x_1044; + const float3 x_574 = float3(x_570.y, x_565.x, x_570.y); + const int x_1045 = h_1; + h_1 = 0; + h_1 = x_1045; + const int x_114_save = x_112; + const float2 x_575 = float2(x_564.y, x_564.z); + const int x_1046 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1046; + const int x_115 = stack[x_114_save]; + const int x_1047 = p; + p = 0; + p = x_1047; + const float3 x_576 = float3(x_573.y, x_573.y, x_565.x); + const int x_1048 = param_5; + param_5 = 0; + param_5 = x_1048; + l_1 = x_115; + const int x_1049 = top; + top = 0; + top = x_1049; + param_4 = l_1; + const int x_1050 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1050; + const float2 x_577 = float2(x_569.y, x_569.z); + const int x_120 = h_1; + const float2 x_578 = float2(x_558.x, 2.0f); + param_5 = x_120; + const int x_1051 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1051; + const int x_121 = performPartition_i1_i1_(param_4, param_5); + const float2 x_579 = float2(x_567.x, x_568.x); + const int x_1052 = param_5; + param_5 = 0; + param_5 = x_1052; + p = x_121; + const int x_1053 = param_4; + param_4 = 0; + param_4 = x_1053; + const int x_122 = p; + const int x_1054 = h_1; + h_1 = 0; + h_1 = x_1054; + const float2 x_580 = float2(x_568.y, x_568.y); + const int x_1055 = l_1; + l_1 = 0; + l_1 = x_1055; + const int x_1056 = h_1; + h_1 = 0; + h_1 = x_1056; + const int x_124 = l_1; + const int x_1057 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1057; + const int x_1058 = h_1; + h_1 = 0; + h_1 = x_1058; + const float2 x_582 = float2(x_567.y, x_573.x); + const int x_1059 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1059; + if (((x_122 - asint(1u)) > x_124)) { + const int x_1060 = param_4; + param_4 = 0; + param_4 = x_1060; + const int x_128 = top; + const float2 x_583 = float2(x_571.y, x_556.y); + const int x_1061 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1061; + const int x_1062[10] = stack; + const int tint_symbol_78[10] = (int[10])0; + stack = tint_symbol_78; + stack = x_1062; + const float2 x_584 = float2(x_569.z, x_569.y); + const float3 x_585 = float3(x_580.y, x_577.x, x_577.x); + const int x_130 = l_1; + const int x_1063 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1063; + const float2 x_586 = float2(x_564.x, x_585.x); + const int x_1064 = param_5; + param_5 = 0; + param_5 = x_1064; + const int x_131_save = (1 + x_128); + const int x_1065 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1065; + const float3 x_587 = float3(x_566.y, x_566.y, x_563.x); + const int x_1066 = param_5; + param_5 = 0; + param_5 = x_1066; + stack[x_131_save] = x_130; + const int x_132 = top; + const int x_1067 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1067; + const float2 x_588 = float2(x_575.y, x_575.x); + const int x_1068 = stack[x_131_save]; + stack[x_131_save] = 0; + stack[x_131_save] = x_1068; + const int x_133 = asint((1u + asuint(x_132))); + const int x_1069 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1069; + const float3 x_589 = float3(x_576.z, x_588.y, x_576.z); + const int x_1070 = h_1; + h_1 = 0; + h_1 = x_1070; + top = x_133; + const int x_1071[10] = stack; + const int tint_symbol_79[10] = (int[10])0; + stack = tint_symbol_79; + stack = x_1071; + const int x_134 = p; + const float2 x_590 = float2(x_576.x, x_573.y); + const int x_1072 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1072; + const int x_136_save = x_133; + const int x_1073 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1073; + stack[x_136_save] = (x_134 - asint(1u)); + const int x_1074 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1074; + const float2 x_591 = float2(x_569.z, x_569.y); + const int x_1075 = stack[x_136_save]; + stack[x_136_save] = 0; + stack[x_136_save] = x_1075; + } + const int x_1076 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1076; + const float2 x_592 = float2(1.0f, 2.0f); + const QuicksortObject x_1077 = obj; + const int tint_symbol_80[10] = (int[10])0; + const QuicksortObject tint_symbol_81 = {tint_symbol_80}; + obj = tint_symbol_81; + obj = x_1077; + const int x_137 = p; + const int x_1078 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1078; + const float3 x_593 = float3(x_571.z, x_556.x, x_556.y); + const int x_1079 = p; + p = 0; + p = x_1079; + const float3 x_594 = float3(x_563.z, x_563.x, x_575.x); + const int x_1080 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1080; + const int x_139 = h_1; + const int x_1081 = top; + top = 0; + top = x_1081; + const float3 x_595 = float3(x_560.z, x_568.x, x_560.x); + const int x_1082 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1082; + const int x_1083 = p; + p = 0; + p = x_1083; + if ((asint((1u + asuint(x_137))) < x_139)) { + const int x_1084 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1084; + const float2 x_596 = float2(x_592.y, x_582.x); + const int x_1085 = l_1; + l_1 = 0; + l_1 = x_1085; + const int x_143 = top; + const int x_1086 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1086; + const float3 x_597 = float3(x_562.y, x_560.y, x_560.y); + const int x_144 = (x_143 + 1); + const int x_1087 = param_5; + param_5 = 0; + param_5 = x_1087; + top = x_144; + const int x_1088 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1088; + const int x_145 = p; + const int x_1089 = param_5; + param_5 = 0; + param_5 = x_1089; + const float3 x_599 = float3(x_560.z, x_560.x, x_568.x); + const int x_1090 = p; + p = 0; + p = x_1090; + const float3 x_600 = float3(x_556.x, x_580.x, x_580.x); + const int x_1091 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1091; + const int x_147_save = x_144; + const int x_1092 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1092; + const float2 x_601 = float2(x_563.x, x_563.y); + stack[x_147_save] = asint((1u + asuint(x_145))); + const int x_1093[10] = stack; + const int tint_symbol_82[10] = (int[10])0; + stack = tint_symbol_82; + stack = x_1093; + const int x_148 = top; + const int x_1094 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1094; + const float2 x_602 = float2(x_565.y, x_599.y); + const int x_1095[10] = stack; + const int tint_symbol_83[10] = (int[10])0; + stack = tint_symbol_83; + stack = x_1095; + const int x_149 = (x_148 + asint(1u)); + const int x_1096 = stack[x_147_save]; + stack[x_147_save] = 0; + stack[x_147_save] = x_1096; + top = x_149; + const int x_1097 = param_4; + param_4 = 0; + param_4 = x_1097; + const int x_150 = h_1; + const int x_1098 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1098; + const int x_1099 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1099; + stack[x_149] = x_150; + const int x_1100 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1100; + const float3 x_603 = float3(x_568.y, x_564.x, x_564.x); + const int x_1101 = l_1; + l_1 = 0; + l_1 = x_1101; + } + const int x_1102 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1102; + { + const int x_1103 = l_1; + l_1 = 0; + l_1 = x_1103; + const float2 x_604 = float2(x_563.z, x_564.x); + const QuicksortObject x_1104 = obj; + const int tint_symbol_84[10] = (int[10])0; + const QuicksortObject tint_symbol_85 = {tint_symbol_84}; + obj = tint_symbol_85; + obj = x_1104; + } + } + const int x_1105 = h_1; + h_1 = 0; + h_1 = x_1105; + return; +} + +void main_1() { + float3 color = float3(0.0f, 0.0f, 0.0f); + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + const float2 x_717 = uv; + uv = (0.0f).xx; + uv = x_717; + i_2 = 0; + const QuicksortObject x_721 = obj; + const int tint_symbol_86[10] = (int[10])0; + const QuicksortObject tint_symbol_87 = {tint_symbol_86}; + obj = tint_symbol_87; + obj = x_721; + if (true) { + const QuicksortObject x_722 = obj; + const int tint_symbol_88[10] = (int[10])0; + const QuicksortObject tint_symbol_89 = {tint_symbol_88}; + obj = tint_symbol_89; + obj = x_722; + const float2 x_431 = (1.0f).xx; + const int x_158 = i_2; + const float2 x_723 = uv; + uv = (0.0f).xx; + uv = x_723; + const float3 x_725 = color; + color = (0.0f).xxx; + color = x_725; + const float2 x_432 = float2(x_431.y, x_431.y); + const QuicksortObject x_726 = obj; + const int tint_symbol_90[10] = (int[10])0; + const QuicksortObject tint_symbol_91 = {tint_symbol_90}; + obj = tint_symbol_91; + obj = x_726; + } + const QuicksortObject x_756 = obj; + const int tint_symbol_92[10] = (int[10])0; + const QuicksortObject tint_symbol_93 = {tint_symbol_92}; + obj = tint_symbol_93; + obj = x_756; + const float2 x_446 = (0.0f).xx; + const int x_757 = i_2; + i_2 = 0; + i_2 = x_757; + quicksort_(); + const QuicksortObject x_758 = obj; + const int tint_symbol_94[10] = (int[10])0; + const QuicksortObject tint_symbol_95 = {tint_symbol_94}; + obj = tint_symbol_95; + obj = x_758; + const float4 x_184 = gl_FragCoord; + const float2 x_759 = uv; + uv = (0.0f).xx; + uv = x_759; + const float2 x_447 = (0.0f).xx; + const float2 x_760 = uv; + uv = (0.0f).xx; + uv = x_760; + const float2 x_185 = float2(x_184.x, x_184.y); + const float3 x_448 = float3(x_185.y, x_446.y, x_446.y); + const QuicksortObject x_761 = obj; + const int tint_symbol_96[10] = (int[10])0; + const QuicksortObject tint_symbol_97 = {tint_symbol_96}; + obj = tint_symbol_97; + obj = x_761; + const float2 x_762 = uv; + uv = (0.0f).xx; + uv = x_762; + const float2 x_191 = asfloat(x_188[0].xy); + const QuicksortObject x_763 = obj; + const int tint_symbol_98[10] = (int[10])0; + const QuicksortObject tint_symbol_99 = {tint_symbol_98}; + obj = tint_symbol_99; + obj = x_763; + const float3 x_449 = float3(x_184.y, 3.0f, x_184.w); + const float3 x_764 = color; + color = (0.0f).xxx; + color = x_764; + const float2 x_192 = (x_185 / x_191); + const QuicksortObject x_765 = obj; + const int tint_symbol_100[10] = (int[10])0; + const QuicksortObject tint_symbol_101 = {tint_symbol_100}; + obj = tint_symbol_101; + obj = x_765; + const float2 x_450 = float2(x_447.x, x_185.y); + const float3 x_766 = color; + color = (0.0f).xxx; + const float3 x_767 = color; + color = (0.0f).xxx; + color = x_767; + color = x_766; + uv = x_192; + color = float3(1.0f, 2.0f, 3.0f); + const float3 x_768 = color; + color = (0.0f).xxx; + color = x_768; + const float3 x_451 = float3(x_185.x, x_185.y, x_446.y); + const QuicksortObject x_769 = obj; + const int tint_symbol_102[10] = (int[10])0; + const QuicksortObject tint_symbol_103 = {tint_symbol_102}; + obj = tint_symbol_103; + obj = x_769; + const int x_770 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_770; + const int x_201 = obj.numbers[0u]; + const QuicksortObject x_771 = obj; + const int tint_symbol_104[10] = (int[10])0; + const QuicksortObject tint_symbol_105 = {tint_symbol_104}; + obj = tint_symbol_105; + obj = x_771; + const int x_772 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_772; + const float x_206 = color.x; + const float x_773 = color.x; + color.x = 0.0f; + color.x = x_773; + const float2 x_452 = float2(3.0f, 2.0f); + const int x_774 = i_2; + i_2 = 0; + i_2 = x_774; + const QuicksortObject x_775 = obj; + const int tint_symbol_106[10] = (int[10])0; + const QuicksortObject tint_symbol_107 = {tint_symbol_106}; + obj = tint_symbol_107; + obj = x_775; + const float3 x_453 = float3(x_451.x, x_450.x, x_450.y); + color.x = (x_206 + float(x_201)); + const float2 x_776 = uv; + uv = (0.0f).xx; + uv = x_776; + const float2 x_777 = uv; + uv = (0.0f).xx; + uv = x_777; + const float2 x_454 = float2(x_184.y, x_184.y); + const float x_210 = uv.x; + const float2 x_455 = float2(x_192.y, x_192.x); + const float x_778 = uv.x; + uv.x = 0.0f; + uv.x = x_778; + const QuicksortObject x_779 = obj; + const int tint_symbol_108[10] = (int[10])0; + const QuicksortObject tint_symbol_109 = {tint_symbol_108}; + obj = tint_symbol_109; + obj = x_779; + if ((x_210 > 0.25f)) { + const int x_780 = i_2; + i_2 = 0; + i_2 = x_780; + const int x_781 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_781; + const float3 x_456 = float3(0.0f, x_448.y, x_448.y); + const float x_782 = uv.x; + uv.x = 0.0f; + uv.x = x_782; + const int x_216 = obj.numbers[1]; + const QuicksortObject x_783 = obj; + const int tint_symbol_110[10] = (int[10])0; + const QuicksortObject tint_symbol_111 = {tint_symbol_110}; + obj = tint_symbol_111; + obj = x_783; + const float2 x_457 = float2(x_454.x, x_454.x); + const float2 x_784 = uv; + uv = (0.0f).xx; + uv = x_784; + const QuicksortObject x_785 = obj; + const int tint_symbol_112[10] = (int[10])0; + const QuicksortObject tint_symbol_113 = {tint_symbol_112}; + obj = tint_symbol_113; + obj = x_785; + const float2 x_458 = float2(3.0f, 0.0f); + const int x_786 = i_2; + i_2 = 0; + i_2 = x_786; + const float x_219 = color[0]; + const float x_787 = color[0]; + color[0] = 0.0f; + color[0] = x_787; + const float3 x_788 = color; + color = (0.0f).xxx; + color = x_788; + const float3 x_789 = color; + color = (0.0f).xxx; + color = x_789; + const float3 x_459 = float3(x_454.y, x_454.y, x_447.y); + const float x_790 = color[0]; + color[0] = 0.0f; + color[0] = x_790; + color.x = (float(x_216) + x_219); + const int x_791 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_791; + } + const float x_792 = uv.x; + uv.x = 0.0f; + uv.x = x_792; + const float x_793 = uv.x; + uv.x = 0.0f; + uv.x = x_793; + const float x_223 = uv.x; + const float x_794 = uv.x; + uv.x = 0.0f; + uv.x = x_794; + const float3 x_460 = float3(x_453.z, x_453.y, x_453.y); + const float2 x_795 = uv; + uv = (0.0f).xx; + uv = x_795; + const float x_796 = uv.x; + uv.x = 0.0f; + uv.x = x_796; + const float2 x_461 = (0.0f).xx; + const float x_797 = uv.x; + uv.x = 0.0f; + uv.x = x_797; + if ((x_223 > 0.5f)) { + const float x_798 = uv.x; + uv.x = 0.0f; + uv.x = x_798; + const float2 x_462 = float2(x_446.x, x_446.x); + const float x_799 = color.x; + color.x = 0.0f; + color.x = x_799; + const float x_800 = color.x; + color.x = 0.0f; + color.x = x_800; + const float3 x_463 = float3(x_453.x, x_453.z, x_461.y); + const float x_801 = color.x; + color.x = 0.0f; + color.x = x_801; + const int x_230 = obj.numbers[2u]; + const float x_802 = uv.x; + uv.x = 0.0f; + uv.x = x_802; + const float x_803 = color.x; + color.x = 0.0f; + color.x = x_803; + const int x_804 = obj.numbers[2u]; + obj.numbers[2u] = 0; + obj.numbers[2u] = x_804; + const float2 x_464 = float2(x_450.y, x_191.x); + const float x_805 = color.y; + color.y = 0.0f; + color.y = x_805; + const float x_234 = color.y; + const int x_806 = obj.numbers[2u]; + obj.numbers[2u] = 0; + obj.numbers[2u] = x_806; + const float2 x_465 = float2(x_463.x, x_185.x); + const float x_807 = color.x; + color.x = 0.0f; + color.x = x_807; + const int x_808 = i_2; + i_2 = 0; + i_2 = x_808; + const float2 x_466 = float2(x_455.y, 0.0f); + const int x_809 = i_2; + i_2 = 0; + i_2 = x_809; + color.y = (float(x_230) + x_234); + const float x_810 = uv.x; + uv.x = 0.0f; + uv.x = x_810; + } + const int x_811 = i_2; + i_2 = 0; + i_2 = x_811; + const float2 x_467 = float2(x_191.x, x_191.x); + const float x_812 = uv.x; + uv.x = 0.0f; + uv.x = x_812; + const float x_238 = uv[0]; + const float3 x_813 = color; + color = (0.0f).xxx; + color = x_813; + const float x_814 = color.x; + color.x = 0.0f; + color.x = x_814; + if ((x_238 > 0.75f)) { + const float x_815 = color.x; + color.x = 0.0f; + color.x = x_815; + const int x_245 = obj.numbers[3]; + const float x_816 = color.x; + color.x = 0.0f; + color.x = x_816; + const QuicksortObject x_817 = obj; + const int tint_symbol_114[10] = (int[10])0; + const QuicksortObject tint_symbol_115 = {tint_symbol_114}; + obj = tint_symbol_115; + obj = x_817; + const float3 x_468 = float3(x_467.x, x_467.x, x_467.x); + const float x_818 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_818; + const float x_819 = uv.x; + uv.x = 0.0f; + uv.x = x_819; + const float x_249 = color.z; + const float3 x_820 = color; + color = (0.0f).xxx; + color = x_820; + const float3 x_469 = float3(x_467.x, x_191.y, x_467.y); + const float x_821 = color.z; + color.z = 0.0f; + color.z = x_821; + const int x_822 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_822; + const float2 x_470 = (0.0f).xx; + const float x_823 = color.z; + color.z = 0.0f; + color.z = x_823; + color.z = (x_249 + float(x_245)); + const float2 x_824 = uv; + uv = (0.0f).xx; + uv = x_824; + const float2 x_471 = float2(x_470.y, x_470.y); + } + const float x_825 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_825; + const float3 x_472 = float3(x_454.x, x_454.y, x_454.y); + const int x_254 = obj.numbers[4]; + const float x_826 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_826; + const float3 x_827 = color; + color = (0.0f).xxx; + color = x_827; + const float3 x_473 = float3(x_446.y, x_453.x, x_453.x); + const int x_828 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_828; + const float2 x_474 = float2(x_191.x, x_184.z); + const float x_829 = uv.x; + uv.x = 0.0f; + uv.x = x_829; + const float x_257 = color.y; + const float x_830 = color.y; + color.y = 0.0f; + color.y = x_830; + const float2 x_475 = float2(x_467.x, x_450.x); + const float x_831 = uv.x; + uv.x = 0.0f; + uv.x = x_831; + const float x_832 = color.x; + color.x = 0.0f; + color.x = x_832; + const float2 x_476 = float2(x_451.z, x_460.y); + color.y = (x_257 + float(x_254)); + const float3 x_477 = float3(0.0f, x_472.x, 0.0f); + const float x_833 = uv.x; + uv.x = 0.0f; + uv.x = x_833; + const float x_834 = color.x; + color.x = 0.0f; + color.x = x_834; + const float2 x_478 = float2(x_472.x, x_472.y); + const float x_835 = uv.y; + uv.y = 0.0f; + uv.y = x_835; + const float x_261 = uv.y; + const int x_836 = i_2; + i_2 = 0; + i_2 = x_836; + const float3 x_479 = float3(0.0f, x_454.y, 0.0f); + const int x_837 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_837; + const float x_838 = color.y; + color.y = 0.0f; + color.y = x_838; + const float3 x_480 = float3(x_446.x, x_446.x, 0.0f); + const float x_839 = uv.x; + uv.x = 0.0f; + uv.x = x_839; + if ((x_261 > 0.25f)) { + const float2 x_481 = float2(x_447.x, x_480.z); + const float3 x_840 = color; + color = (0.0f).xxx; + color = x_840; + const int x_267 = obj.numbers[5u]; + const float x_841 = color.x; + color.x = 0.0f; + color.x = x_841; + const int x_842 = i_2; + i_2 = 0; + i_2 = x_842; + const int x_843 = i_2; + i_2 = 0; + i_2 = x_843; + const float x_270 = color.x; + const float x_844 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_844; + const float3 x_482 = float3(x_455.x, x_475.y, x_455.y); + const QuicksortObject x_845 = obj; + const int tint_symbol_116[10] = (int[10])0; + const QuicksortObject tint_symbol_117 = {tint_symbol_116}; + obj = tint_symbol_117; + obj = x_845; + const float x_846 = uv.y; + uv.y = 0.0f; + uv.y = x_846; + const int x_847 = i_2; + i_2 = 0; + i_2 = x_847; + const float3 x_483 = float3(x_184.w, x_184.w, x_192.x); + const float x_848 = uv.x; + uv.x = 0.0f; + uv.x = x_848; + color.x = (float(x_267) + x_270); + const float3 x_484 = float3(x_454.y, x_450.x, x_454.y); + const float x_849 = uv.x; + uv.x = 0.0f; + uv.x = x_849; + } + const float x_850 = color.x; + color.x = 0.0f; + color.x = x_850; + const float3 x_485 = float3(x_467.x, x_450.y, x_450.x); + const float x_851 = uv.y; + uv.y = 0.0f; + uv.y = x_851; + const int x_852 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_852; + const float x_274 = uv.y; + const int x_853 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_853; + if ((x_274 > 0.5f)) { + const float x_854 = uv.x; + uv.x = 0.0f; + uv.x = x_854; + const float2 x_486 = float2(x_480.y, x_455.y); + const float x_855 = color.y; + color.y = 0.0f; + color.y = x_855; + const float2 x_487 = float2(x_449.z, x_449.y); + const float x_856 = uv.y; + uv.y = 0.0f; + uv.y = x_856; + const int x_280 = obj.numbers[6u]; + const float x_857 = uv.y; + uv.y = 0.0f; + uv.y = x_857; + const int x_858 = i_2; + i_2 = 0; + i_2 = x_858; + const int x_859 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_859; + const float2 x_488 = float2(x_473.z, x_473.y); + const float x_283 = color.y; + const float2 x_860 = uv; + uv = (0.0f).xx; + uv = x_860; + const float x_861 = color.x; + color.x = 0.0f; + color.x = x_861; + const float2 x_489 = float2(x_475.y, x_475.x); + const int x_862 = obj.numbers[6u]; + obj.numbers[6u] = 0; + obj.numbers[6u] = x_862; + const int x_863 = obj.numbers[6u]; + obj.numbers[6u] = 0; + obj.numbers[6u] = x_863; + const float2 x_490 = float2(x_480.z, x_480.z); + const QuicksortObject x_864 = obj; + const int tint_symbol_118[10] = (int[10])0; + const QuicksortObject tint_symbol_119 = {tint_symbol_118}; + obj = tint_symbol_119; + obj = x_864; + color.y = (float(x_280) + x_283); + const float x_865 = color.x; + color.x = 0.0f; + color.x = x_865; + const float2 x_491 = float2(2.0f, x_454.x); + const float x_866 = color.y; + color.y = 0.0f; + color.y = x_866; + } + const float2 x_492 = float2(x_455.y, x_455.y); + const float x_867 = color.x; + color.x = 0.0f; + color.x = x_867; + const float x_287 = uv.y; + const QuicksortObject x_868 = obj; + const int tint_symbol_120[10] = (int[10])0; + const QuicksortObject tint_symbol_121 = {tint_symbol_120}; + obj = tint_symbol_121; + obj = x_868; + const float2 x_493 = float2(x_475.x, x_475.y); + const float x_869 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_869; + const float x_870 = color.y; + color.y = 0.0f; + color.y = x_870; + const float3 x_494 = float3(x_191.x, x_191.y, x_191.y); + const int x_871 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_871; + if ((x_287 > 0.75f)) { + const float3 x_872 = color; + color = (0.0f).xxx; + color = x_872; + const float x_873 = color.x; + color.x = 0.0f; + color.x = x_873; + const float3 x_495 = float3(x_192.y, x_192.x, x_192.y); + const float3 x_874 = color; + color = (0.0f).xxx; + color = x_874; + const int x_293 = obj.numbers[7]; + const float x_875 = uv.x; + uv.x = 0.0f; + uv.x = x_875; + const float3 x_496 = float3(x_475.x, x_467.y, x_467.x); + const float x_876 = color.y; + color.y = 0.0f; + color.y = x_876; + const float2 x_497 = float2(x_477.x, x_461.y); + const int x_877 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_877; + const float x_878 = color.y; + color.y = 0.0f; + color.y = x_878; + const float3 x_498 = float3(x_478.x, x_478.y, x_478.x); + const float x_879 = color.x; + color.x = 0.0f; + color.x = x_879; + const float x_296 = color.z; + const float x_880 = uv.y; + uv.y = 0.0f; + uv.y = x_880; + const float2 x_499 = float2(x_184.x, x_184.y); + const float x_881 = uv.x; + uv.x = 0.0f; + uv.x = x_881; + const float x_882 = uv.y; + uv.y = 0.0f; + uv.y = x_882; + const float x_883 = uv.y; + uv.y = 0.0f; + uv.y = x_883; + const float3 x_500 = float3(x_499.y, x_499.y, x_494.z); + const float x_884 = color.z; + color.z = 0.0f; + color.z = x_884; + color.z = (float(x_293) + x_296); + const float x_885 = color.y; + color.y = 0.0f; + color.y = x_885; + const float2 x_501 = float2(x_453.x, x_453.z); + const float x_886 = color.x; + color.x = 0.0f; + color.x = x_886; + } + const int x_887 = i_2; + i_2 = 0; + i_2 = x_887; + const float2 x_502 = float2(x_451.y, x_192.y); + const float2 x_888 = uv; + uv = (0.0f).xx; + uv = x_888; + const int x_301 = obj.numbers[8]; + const int x_889 = i_2; + i_2 = 0; + i_2 = x_889; + const float2 x_503 = float2(x_185.x, x_451.z); + const int x_890 = obj.numbers[8]; + obj.numbers[8] = 0; + obj.numbers[8] = x_890; + const float x_891 = color.y; + color.y = 0.0f; + color.y = x_891; + const float2 x_504 = float2(x_453.y, 0.0f); + const float x_892 = color.x; + color.x = 0.0f; + color.x = x_892; + const float3 x_505 = float3(x_504.x, x_504.y, x_504.x); + const float x_893 = color.z; + color.z = 0.0f; + color.z = x_893; + const float x_304 = color.z; + const float x_894 = color.x; + color.x = 0.0f; + color.x = x_894; + const float2 x_506 = float2(x_493.x, x_492.x); + const int x_895 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_895; + const float x_896 = uv.y; + uv.y = 0.0f; + uv.y = x_896; + const float2 x_507 = float2(x_461.x, x_447.x); + const float x_897 = color.y; + color.y = 0.0f; + color.y = x_897; + color.z = (x_304 + float(x_301)); + const float2 x_898 = uv; + uv = (0.0f).xx; + uv = x_898; + const float x_899 = uv.x; + uv.x = 0.0f; + uv.x = x_899; + const float3 x_508 = float3(x_461.y, x_461.x, x_506.y); + const float x_900 = uv.x; + uv.x = 0.0f; + uv.x = x_900; + const float x_308 = uv.x; + const float x_901 = color.y; + color.y = 0.0f; + color.y = x_901; + const float3 x_509 = float3(x_503.y, x_503.x, x_448.z); + const float x_902 = uv.y; + uv.y = 0.0f; + uv.y = x_902; + const float x_310 = uv.y; + const float x_903 = uv.y; + uv.y = 0.0f; + uv.y = x_903; + const float x_904 = color.z; + color.z = 0.0f; + color.z = x_904; + const float3 x_510 = float3(2.0f, x_485.y, x_485.z); + const float x_905 = color.z; + color.z = 0.0f; + color.z = x_905; + const int x_906 = i_2; + i_2 = 0; + i_2 = x_906; + const float2 x_511 = float2(x_485.z, x_485.y); + const float3 x_907 = color; + color = (0.0f).xxx; + color = x_907; + const float x_908 = uv.y; + uv.y = 0.0f; + uv.y = x_908; + const float3 x_512 = float3(x_455.y, x_455.y, x_455.y); + const int x_909 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_909; + if ((abs((x_308 - x_310)) < 0.25f)) { + const float x_910 = uv.x; + uv.x = 0.0f; + uv.x = x_910; + const QuicksortObject x_911 = obj; + const int tint_symbol_122[10] = (int[10])0; + const QuicksortObject tint_symbol_123 = {tint_symbol_122}; + obj = tint_symbol_123; + obj = x_911; + const float3 x_513 = float3(x_505.z, x_505.x, x_448.x); + const int x_912 = obj.numbers[8]; + obj.numbers[8] = 0; + obj.numbers[8] = x_912; + const int x_317 = obj.numbers[9u]; + const float3 x_514 = float3(x_474.y, x_474.y, x_474.y); + const float x_913 = uv.y; + uv.y = 0.0f; + uv.y = x_913; + const float x_320 = color.x; + const float x_914 = uv.y; + uv.y = 0.0f; + uv.y = x_914; + const float2 x_515 = float2(x_502.x, x_502.y); + const float x_915 = color.x; + color.x = 0.0f; + color.x = x_915; + const float3 x_916 = color; + color = (0.0f).xxx; + color = x_916; + const float2 x_516 = float2(x_452.x, x_452.x); + const float2 x_917 = uv; + uv = (0.0f).xx; + uv = x_917; + const float x_918 = uv.x; + uv.x = 0.0f; + uv.x = x_918; + const float3 x_517 = (0.0f).xxx; + color.x = (float(x_317) + x_320); + const float x_919 = color.x; + color.x = 0.0f; + color.x = x_919; + const float3 x_518 = float3(x_480.y, x_508.x, x_480.x); + const float x_920 = color.x; + color.x = 0.0f; + color.x = x_920; + } + const float x_921 = uv.y; + uv.y = 0.0f; + uv.y = x_921; + const float3 x_325 = color; + const float x_922 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_922; + const float3 x_519 = float3(x_447.x, x_446.x, x_446.y); + const float3 x_326 = normalize(x_325); + const float x_923 = uv.x; + uv.x = 0.0f; + uv.x = x_923; + const QuicksortObject x_924 = obj; + const int tint_symbol_124[10] = (int[10])0; + const QuicksortObject tint_symbol_125 = {tint_symbol_124}; + obj = tint_symbol_125; + obj = x_924; + const QuicksortObject x_925 = obj; + const int tint_symbol_126[10] = (int[10])0; + const QuicksortObject tint_symbol_127 = {tint_symbol_126}; + obj = tint_symbol_127; + obj = x_925; + const float x_926 = color.y; + color.y = 0.0f; + color.y = x_926; + const float2 x_520 = float2(x_506.y, x_519.y); + const float x_927 = color.y; + color.y = 0.0f; + color.y = x_927; + const float4 x_330 = float4(x_326.x, x_326.y, x_326.z, 1.0f); + const float x_928 = uv.y; + uv.y = 0.0f; + uv.y = x_928; + const float3 x_521 = float3(2.0f, 2.0f, x_520.y); + const float x_929 = uv.x; + uv.x = 0.0f; + uv.x = x_929; + x_GLF_color = x_330; + const QuicksortObject x_930 = obj; + const int tint_symbol_128[10] = (int[10])0; + const QuicksortObject tint_symbol_129 = {tint_symbol_128}; + obj = tint_symbol_129; + obj = x_930; + const float3 x_522 = float3(x_330.w, x_330.y, x_493.x); + const float x_931 = color.x; + color.x = 0.0f; + color.x = x_931; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_49 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_50 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_130 = {x_GLF_color}; + return tint_symbol_130; +} + +tint_symbol_50 main(tint_symbol_49 tint_symbol_48) { + const main_out inner_result = main_inner(tint_symbol_48.gl_FragCoord_param); + tint_symbol_50 wrapper_result = (tint_symbol_50)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/749.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/749.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..8605266c5b --- /dev/null +++ b/test/tint/bug/tint/749.spvasm.expected.fxc.hlsl @@ -0,0 +1,1658 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_188 : register(b0, space0) { + uint4 x_188[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_932 = temp; + temp = 0; + temp = x_932; + const float3 x_523 = float3(3.0f, 2.0f, 3.0f); + const int x_933 = i; + i = 0; + i = x_933; + const int x_28 = i; + const int x_934 = j; + j = 0; + j = x_934; + const float3 x_524 = float3(x_523.y, x_523.x, x_523.y); + const int x_935 = temp; + temp = 0; + temp = x_935; + const int x_30_save = x_28; + const int x_936 = obj.numbers[x_30_save]; + { + int tint_symbol_1[10] = obj.numbers; + tint_symbol_1[x_30_save] = 0; + obj.numbers = tint_symbol_1; + } + { + int tint_symbol_3[10] = obj.numbers; + tint_symbol_3[x_30_save] = x_936; + obj.numbers = tint_symbol_3; + } + const int x_31 = obj.numbers[x_30_save]; + const int x_937 = temp; + temp = 0; + temp = x_937; + temp = x_31; + const int x_938 = j; + j = 0; + j = x_938; + const float3 x_525 = float3(x_523.z, 1.0f, x_523.y); + const int x_939 = i; + i = 0; + i = x_939; + const int x_32 = i; + const int x_940 = obj.numbers[x_30_save]; + { + int tint_symbol_5[10] = obj.numbers; + tint_symbol_5[x_30_save] = 0; + obj.numbers = tint_symbol_5; + } + { + int tint_symbol_7[10] = obj.numbers; + tint_symbol_7[x_30_save] = x_940; + obj.numbers = tint_symbol_7; + } + const int x_33 = j; + const int x_941 = i; + i = 0; + i = x_941; + const float3 x_526 = float3(x_525.x, x_525.z, x_525.z); + const int x_942 = obj.numbers[x_30_save]; + { + int tint_symbol_9[10] = obj.numbers; + tint_symbol_9[x_30_save] = 0; + obj.numbers = tint_symbol_9; + } + { + int tint_symbol_11[10] = obj.numbers; + tint_symbol_11[x_30_save] = x_942; + obj.numbers = tint_symbol_11; + } + const int x_34_save = x_33; + const int x_35 = obj.numbers[x_34_save]; + const QuicksortObject x_943 = obj; + const int tint_symbol_52[10] = (int[10])0; + const QuicksortObject tint_symbol_53 = {tint_symbol_52}; + obj = tint_symbol_53; + obj = x_943; + const float2 x_527 = float2(x_526.x, x_526.x); + const int x_36_save = x_32; + const float3 x_528 = float3(x_524.x, x_524.z, x_524.x); + { + int tint_symbol_13[10] = obj.numbers; + tint_symbol_13[x_36_save] = x_35; + obj.numbers = tint_symbol_13; + } + const QuicksortObject x_944 = obj; + const int tint_symbol_54[10] = (int[10])0; + const QuicksortObject tint_symbol_55 = {tint_symbol_54}; + obj = tint_symbol_55; + obj = x_944; + const float3 x_529 = float3(x_526.y, x_526.z, x_526.x); + const int x_945 = i; + i = 0; + i = x_945; + const int x_37 = j; + const int x_946 = temp; + temp = 0; + temp = x_946; + const float2 x_530 = float2(x_529.z, x_529.y); + const int x_947 = obj.numbers[x_34_save]; + { + int tint_symbol_15[10] = obj.numbers; + tint_symbol_15[x_34_save] = 0; + obj.numbers = tint_symbol_15; + } + { + int tint_symbol_17[10] = obj.numbers; + tint_symbol_17[x_34_save] = x_947; + obj.numbers = tint_symbol_17; + } + const int x_38 = temp; + const int x_948 = j; + j = 0; + j = x_948; + const float3 x_531 = float3(x_527.x, x_526.y, x_526.x); + const int x_949 = obj.numbers[x_36_save]; + { + int tint_symbol_19[10] = obj.numbers; + tint_symbol_19[x_36_save] = 0; + obj.numbers = tint_symbol_19; + } + { + int tint_symbol_21[10] = obj.numbers; + tint_symbol_21[x_36_save] = x_949; + obj.numbers = tint_symbol_21; + } + const QuicksortObject x_950 = obj; + const int tint_symbol_56[10] = (int[10])0; + const QuicksortObject tint_symbol_57 = {tint_symbol_56}; + obj = tint_symbol_57; + obj = x_950; + const float3 x_532 = float3(x_528.x, x_528.y, x_528.x); + const int x_951 = obj.numbers[x_34_save]; + { + int tint_symbol_23[10] = obj.numbers; + tint_symbol_23[x_34_save] = 0; + obj.numbers = tint_symbol_23; + } + { + int tint_symbol_25[10] = obj.numbers; + tint_symbol_25[x_34_save] = x_951; + obj.numbers = tint_symbol_25; + } + { + int tint_symbol_27[10] = obj.numbers; + tint_symbol_27[x_37] = x_38; + obj.numbers = tint_symbol_27; + } + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int param_3 = 0; + int i_1 = 0; + int j_1 = 0; + int param_2 = 0; + int param_1 = 0; + int param = 0; + int pivot = 0; + float2 x_537 = float2(0.0f, 0.0f); + float3 x_538 = float3(0.0f, 0.0f, 0.0f); + const int x_952 = h; + h = 0; + h = x_952; + const int x_41 = h; + const int x_953 = l; + l = 0; + l = x_953; + const int x_42_save = x_41; + const int x_954 = obj.numbers[x_42_save]; + { + int tint_symbol_29[10] = obj.numbers; + tint_symbol_29[x_42_save] = 0; + obj.numbers = tint_symbol_29; + } + { + int tint_symbol_31[10] = obj.numbers; + tint_symbol_31[x_42_save] = x_954; + obj.numbers = tint_symbol_31; + } + const int x_43 = obj.numbers[x_42_save]; + const int x_955 = param_3; + param_3 = 0; + param_3 = x_955; + const float3 x_534 = float3(3.0f, 1.0f, 3.0f); + const int x_956 = param_1; + param_1 = 0; + param_1 = x_956; + pivot = x_43; + const int x_45 = l; + const int x_957 = h; + h = 0; + h = x_957; + const int x_958 = j_1; + j_1 = 0; + j_1 = x_958; + const float3 x_535 = float3(x_534.y, x_534.z, x_534.y); + const int x_959 = l; + l = 0; + l = x_959; + i_1 = (x_45 - asint(1u)); + const int x_49 = l; + const float3 x_536 = float3(x_534.x, x_534.z, x_535.x); + j_1 = 10; + const QuicksortObject x_960 = obj; + const int tint_symbol_58[10] = (int[10])0; + const QuicksortObject tint_symbol_59 = {tint_symbol_58}; + obj = tint_symbol_59; + obj = x_960; + [loop] while (true) { + const int x_961 = pivot; + pivot = 0; + pivot = x_961; + const int x_962 = param_1; + param_1 = 0; + param_1 = x_962; + const int x_55 = j_1; + const int x_963 = pivot; + pivot = 0; + pivot = x_963; + x_537 = float2(2.0f, 3.0f); + const QuicksortObject x_964 = obj; + const int tint_symbol_60[10] = (int[10])0; + const QuicksortObject tint_symbol_61 = {tint_symbol_60}; + obj = tint_symbol_61; + obj = x_964; + const int x_56 = h; + const int x_965 = h; + h = 0; + h = x_965; + const int x_966 = param; + param = 0; + param = x_966; + const int x_967 = j_1; + j_1 = 0; + j_1 = x_967; + x_538 = float3(x_534.x, x_537.y, x_534.z); + const int x_968 = param; + param = 0; + param = x_968; + if ((x_55 <= (x_56 - asint(1u)))) { + } else { + break; + } + const int x_60 = j_1; + const int x_969 = obj.numbers[x_42_save]; + { + int tint_symbol_33[10] = obj.numbers; + tint_symbol_33[x_42_save] = 0; + obj.numbers = tint_symbol_33; + } + { + int tint_symbol_35[10] = obj.numbers; + tint_symbol_35[x_42_save] = x_969; + obj.numbers = tint_symbol_35; + } + const int x_61_save = x_60; + const int x_970 = h; + h = 0; + h = x_970; + const float3 x_539 = float3(x_537.x, x_535.z, x_537.x); + const int x_971 = param_1; + param_1 = 0; + param_1 = x_971; + const int x_62 = obj.numbers[x_61_save]; + const QuicksortObject x_972 = obj; + const int tint_symbol_62[10] = (int[10])0; + const QuicksortObject tint_symbol_63 = {tint_symbol_62}; + obj = tint_symbol_63; + obj = x_972; + const int x_63 = pivot; + const float2 x_540 = float2(2.0f, x_534.z); + const int x_973 = i_1; + i_1 = 0; + i_1 = x_973; + const int x_974 = l; + l = 0; + l = x_974; + const float3 x_541 = float3(x_534.y, x_534.x, x_534.y); + const int x_975 = pivot; + pivot = 0; + pivot = x_975; + if ((x_62 <= x_63)) { + const float3 x_542 = float3(x_541.z, x_541.x, x_541.x); + const int x_976 = param_3; + param_3 = 0; + param_3 = x_976; + const int x_67 = i_1; + const int x_977 = pivot; + pivot = 0; + pivot = x_977; + const float2 x_543 = float2(x_539.x, x_541.y); + const int x_978 = i_1; + i_1 = 0; + i_1 = x_978; + const int x_979 = param; + param = 0; + param = x_979; + i_1 = (x_67 + asint(1u)); + const int x_980 = l; + l = 0; + l = x_980; + const float3 x_544 = float3(3.0f, 2.0f, x_540.x); + const int x_70 = i_1; + const float2 x_545 = float2(x_537.y, x_538.x); + const int x_981 = param; + param = 0; + param = x_981; + param = x_70; + const int x_982 = param; + param = 0; + param = x_982; + const float2 x_546 = float2(x_545.x, x_545.x); + const int x_983 = i_1; + i_1 = 0; + i_1 = x_983; + param_1 = j_1; + const int x_984 = param_3; + param_3 = 0; + param_3 = x_984; + swap_i1_i1_(param, param_1); + const int x_985 = param_1; + param_1 = 0; + param_1 = x_985; + } + const QuicksortObject x_986 = obj; + const int tint_symbol_64[10] = (int[10])0; + const QuicksortObject tint_symbol_65 = {tint_symbol_64}; + obj = tint_symbol_65; + obj = x_986; + { + const int x_987 = h; + h = 0; + h = x_987; + const int x_74 = j_1; + const int x_988 = h; + h = 0; + h = x_988; + const float3 x_547 = float3(x_539.x, x_541.z, x_541.z); + const int x_989 = obj.numbers[x_61_save]; + { + int tint_symbol_37[10] = obj.numbers; + tint_symbol_37[x_61_save] = 0; + obj.numbers = tint_symbol_37; + } + { + int tint_symbol_39[10] = obj.numbers; + tint_symbol_39[x_61_save] = x_989; + obj.numbers = tint_symbol_39; + } + const int x_990 = param; + param = 0; + param = x_990; + j_1 = (1 + x_74); + const int x_991 = param_1; + param_1 = 0; + param_1 = x_991; + const float3 x_548 = float3(x_541.y, x_541.z, x_541.x); + const int x_992 = obj.numbers[x_61_save]; + { + int tint_symbol_41[10] = obj.numbers; + tint_symbol_41[x_61_save] = 0; + obj.numbers = tint_symbol_41; + } + { + int tint_symbol_43[10] = obj.numbers; + tint_symbol_43[x_61_save] = x_992; + obj.numbers = tint_symbol_43; + } + } + } + const int x_76 = i_1; + const int x_993 = obj.numbers[x_42_save]; + { + int tint_symbol_45[10] = obj.numbers; + tint_symbol_45[x_42_save] = 0; + obj.numbers = tint_symbol_45; + } + { + int tint_symbol_47[10] = obj.numbers; + tint_symbol_47[x_42_save] = x_993; + obj.numbers = tint_symbol_47; + } + const float2 x_549 = float2(x_534.x, x_534.y); + const QuicksortObject x_994 = obj; + const int tint_symbol_66[10] = (int[10])0; + const QuicksortObject tint_symbol_67 = {tint_symbol_66}; + obj = tint_symbol_67; + obj = x_994; + const int x_995 = h; + h = 0; + h = x_995; + i_1 = (1 + x_76); + const int x_996 = param_1; + param_1 = 0; + param_1 = x_996; + const int x_79 = i_1; + const int x_997 = j_1; + j_1 = 0; + j_1 = x_997; + const float2 x_550 = float2(x_534.x, x_534.x); + const int x_998 = param_1; + param_1 = 0; + param_1 = x_998; + param_2 = x_79; + const float2 x_551 = float2(x_534.y, x_536.x); + const int x_999 = pivot; + pivot = 0; + pivot = x_999; + const int x_81 = h; + const float2 x_552 = float2(x_550.x, x_549.y); + const int x_1000 = h; + h = 0; + h = x_1000; + param_3 = x_81; + const int x_1001 = i_1; + i_1 = 0; + i_1 = x_1001; + const float2 x_553 = float2(x_549.y, x_552.x); + const int x_1002 = h; + h = 0; + h = x_1002; + swap_i1_i1_(param_2, param_3); + const int x_1003 = l; + l = 0; + l = x_1003; + const float2 x_554 = float2(x_536.z, 2.0f); + const int x_1004 = param_1; + param_1 = 0; + param_1 = x_1004; + const int x_83 = i_1; + const int x_1005 = param; + param = 0; + param = x_1005; + const float2 x_555 = float2(x_534.y, x_534.x); + const int x_1006 = j_1; + j_1 = 0; + j_1 = x_1006; + return x_83; +} + +void quicksort_() { + int param_4 = 0; + int h_1 = 0; + int p = 0; + int l_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int param_5 = 0; + l_1 = 0; + const int x_1007 = param_5; + param_5 = 0; + param_5 = x_1007; + h_1 = 9; + const int x_1008[10] = stack; + const int tint_symbol_68[10] = (int[10])0; + stack = tint_symbol_68; + stack = x_1008; + const float2 x_556 = (2.0f).xx; + const int x_1009 = param_5; + param_5 = 0; + param_5 = x_1009; + top = -1; + const int x_1010 = p; + p = 0; + p = x_1010; + const int x_93 = top; + const float2 x_557 = (1.0f).xx; + const int x_1011 = p; + p = 0; + p = x_1011; + const int x_94 = (x_93 + asint(1u)); + const int x_1012 = top; + top = 0; + top = x_1012; + const float2 x_558 = float2(x_556.y, x_557.y); + const int x_1013 = param_4; + param_4 = 0; + param_4 = x_1013; + top = x_94; + const int x_1014 = h_1; + h_1 = 0; + h_1 = x_1014; + const float3 x_559 = float3(x_557.y, x_557.x, x_557.x); + const int x_1015 = param_4; + param_4 = 0; + param_4 = x_1015; + const int x_95 = l_1; + const QuicksortObject x_1016 = obj; + const int tint_symbol_69[10] = (int[10])0; + const QuicksortObject tint_symbol_70 = {tint_symbol_69}; + obj = tint_symbol_70; + obj = x_1016; + const float3 x_560 = float3(x_559.y, x_559.x, x_557.x); + const int x_96_save = x_94; + const int x_1017[10] = stack; + const int tint_symbol_71[10] = (int[10])0; + stack = tint_symbol_71; + stack = x_1017; + const float3 x_561 = float3(x_556.y, x_556.y, x_556.y); + const int x_1018 = l_1; + l_1 = 0; + l_1 = 0; + stack[x_96_save] = x_95; + const int x_1019 = param_5; + param_5 = 0; + param_5 = x_1019; + const int x_97 = top; + const int x_1020 = param_4; + param_4 = 0; + param_4 = x_1020; + const float3 x_562 = float3(3.0f, x_558.y, 2.0f); + const int x_1021 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1021; + const int x_98 = (x_97 + 1); + const int x_1022 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1022; + const float3 x_563 = float3(x_559.x, x_559.z, x_556.y); + top = x_98; + const int x_1023 = param_4; + param_4 = 0; + param_4 = x_1023; + const int x_99 = h_1; + const int x_1024 = param_4; + param_4 = 0; + param_4 = x_1024; + const float3 x_564 = float3(x_558.x, x_561.x, x_558.y); + const int x_1025 = l_1; + l_1 = 0; + l_1 = x_1025; + const int x_100_save = x_98; + const int x_1026 = param_5; + param_5 = 0; + param_5 = x_1026; + const float2 x_565 = float2(x_564.z, x_564.z); + const int x_1027 = p; + p = 0; + p = x_1027; + stack[x_100_save] = x_99; + [loop] while (true) { + const float3 x_566 = float3(x_563.x, x_563.x, x_563.x); + const int x_1028 = h_1; + h_1 = 0; + h_1 = x_1028; + const int x_1029[10] = stack; + const int tint_symbol_72[10] = (int[10])0; + stack = tint_symbol_72; + stack = x_1029; + const int x_106 = top; + const int x_1030[10] = stack; + const int tint_symbol_73[10] = (int[10])0; + stack = tint_symbol_73; + stack = x_1030; + const float2 x_567 = float2(x_558.x, x_564.z); + const int x_1031 = param_4; + param_4 = 0; + param_4 = x_1031; + if ((x_106 >= asint(0u))) { + } else { + break; + } + const QuicksortObject x_1032 = obj; + const int tint_symbol_74[10] = (int[10])0; + const QuicksortObject tint_symbol_75 = {tint_symbol_74}; + obj = tint_symbol_75; + obj = x_1032; + const float3 x_568 = float3(x_559.y, x_559.x, x_563.y); + const int x_1033 = param_4; + param_4 = 0; + param_4 = x_1033; + const int x_108 = top; + const float3 x_569 = float3(x_565.x, x_567.y, x_565.x); + const int x_1034 = h_1; + h_1 = 0; + h_1 = x_1034; + const float2 x_570 = float2(x_556.x, x_556.x); + const int x_1035 = p; + p = 0; + p = x_1035; + top = (x_108 - asint(1u)); + const int x_1036 = p; + p = 0; + p = x_1036; + const int x_110_save = x_108; + const int x_1037 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1037; + const int x_111 = stack[x_110_save]; + const int x_1038[10] = stack; + const int tint_symbol_76[10] = (int[10])0; + stack = tint_symbol_76; + stack = x_1038; + const float3 x_571 = float3(x_559.y, x_559.x, x_564.y); + const int x_1039 = l_1; + l_1 = 0; + l_1 = x_1039; + h_1 = x_111; + const int x_1040[10] = stack; + const int tint_symbol_77[10] = (int[10])0; + stack = tint_symbol_77; + stack = x_1040; + const float2 x_572 = float2(x_562.y, x_561.y); + const int x_1041 = p; + p = 0; + p = x_1041; + const int x_112 = top; + const int x_1042 = param_4; + param_4 = 0; + param_4 = x_1042; + const int x_1043 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1043; + const float2 x_573 = float2(2.0f, 3.0f); + top = (x_112 - 1); + const int x_1044 = param_5; + param_5 = 0; + param_5 = x_1044; + const float3 x_574 = float3(x_570.y, x_565.x, x_570.y); + const int x_1045 = h_1; + h_1 = 0; + h_1 = x_1045; + const int x_114_save = x_112; + const float2 x_575 = float2(x_564.y, x_564.z); + const int x_1046 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1046; + const int x_115 = stack[x_114_save]; + const int x_1047 = p; + p = 0; + p = x_1047; + const float3 x_576 = float3(x_573.y, x_573.y, x_565.x); + const int x_1048 = param_5; + param_5 = 0; + param_5 = x_1048; + l_1 = x_115; + const int x_1049 = top; + top = 0; + top = x_1049; + param_4 = l_1; + const int x_1050 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1050; + const float2 x_577 = float2(x_569.y, x_569.z); + const int x_120 = h_1; + const float2 x_578 = float2(x_558.x, 2.0f); + param_5 = x_120; + const int x_1051 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1051; + const int x_121 = performPartition_i1_i1_(param_4, param_5); + const float2 x_579 = float2(x_567.x, x_568.x); + const int x_1052 = param_5; + param_5 = 0; + param_5 = x_1052; + p = x_121; + const int x_1053 = param_4; + param_4 = 0; + param_4 = x_1053; + const int x_122 = p; + const int x_1054 = h_1; + h_1 = 0; + h_1 = x_1054; + const float2 x_580 = float2(x_568.y, x_568.y); + const int x_1055 = l_1; + l_1 = 0; + l_1 = x_1055; + const int x_1056 = h_1; + h_1 = 0; + h_1 = x_1056; + const int x_124 = l_1; + const int x_1057 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1057; + const int x_1058 = h_1; + h_1 = 0; + h_1 = x_1058; + const float2 x_582 = float2(x_567.y, x_573.x); + const int x_1059 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1059; + if (((x_122 - asint(1u)) > x_124)) { + const int x_1060 = param_4; + param_4 = 0; + param_4 = x_1060; + const int x_128 = top; + const float2 x_583 = float2(x_571.y, x_556.y); + const int x_1061 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1061; + const int x_1062[10] = stack; + const int tint_symbol_78[10] = (int[10])0; + stack = tint_symbol_78; + stack = x_1062; + const float2 x_584 = float2(x_569.z, x_569.y); + const float3 x_585 = float3(x_580.y, x_577.x, x_577.x); + const int x_130 = l_1; + const int x_1063 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1063; + const float2 x_586 = float2(x_564.x, x_585.x); + const int x_1064 = param_5; + param_5 = 0; + param_5 = x_1064; + const int x_131_save = (1 + x_128); + const int x_1065 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1065; + const float3 x_587 = float3(x_566.y, x_566.y, x_563.x); + const int x_1066 = param_5; + param_5 = 0; + param_5 = x_1066; + stack[x_131_save] = x_130; + const int x_132 = top; + const int x_1067 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1067; + const float2 x_588 = float2(x_575.y, x_575.x); + const int x_1068 = stack[x_131_save]; + stack[x_131_save] = 0; + stack[x_131_save] = x_1068; + const int x_133 = asint((1u + asuint(x_132))); + const int x_1069 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1069; + const float3 x_589 = float3(x_576.z, x_588.y, x_576.z); + const int x_1070 = h_1; + h_1 = 0; + h_1 = x_1070; + top = x_133; + const int x_1071[10] = stack; + const int tint_symbol_79[10] = (int[10])0; + stack = tint_symbol_79; + stack = x_1071; + const int x_134 = p; + const float2 x_590 = float2(x_576.x, x_573.y); + const int x_1072 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1072; + const int x_136_save = x_133; + const int x_1073 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1073; + stack[x_136_save] = (x_134 - asint(1u)); + const int x_1074 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1074; + const float2 x_591 = float2(x_569.z, x_569.y); + const int x_1075 = stack[x_136_save]; + stack[x_136_save] = 0; + stack[x_136_save] = x_1075; + } + const int x_1076 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1076; + const float2 x_592 = float2(1.0f, 2.0f); + const QuicksortObject x_1077 = obj; + const int tint_symbol_80[10] = (int[10])0; + const QuicksortObject tint_symbol_81 = {tint_symbol_80}; + obj = tint_symbol_81; + obj = x_1077; + const int x_137 = p; + const int x_1078 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1078; + const float3 x_593 = float3(x_571.z, x_556.x, x_556.y); + const int x_1079 = p; + p = 0; + p = x_1079; + const float3 x_594 = float3(x_563.z, x_563.x, x_575.x); + const int x_1080 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1080; + const int x_139 = h_1; + const int x_1081 = top; + top = 0; + top = x_1081; + const float3 x_595 = float3(x_560.z, x_568.x, x_560.x); + const int x_1082 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1082; + const int x_1083 = p; + p = 0; + p = x_1083; + if ((asint((1u + asuint(x_137))) < x_139)) { + const int x_1084 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1084; + const float2 x_596 = float2(x_592.y, x_582.x); + const int x_1085 = l_1; + l_1 = 0; + l_1 = x_1085; + const int x_143 = top; + const int x_1086 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1086; + const float3 x_597 = float3(x_562.y, x_560.y, x_560.y); + const int x_144 = (x_143 + 1); + const int x_1087 = param_5; + param_5 = 0; + param_5 = x_1087; + top = x_144; + const int x_1088 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1088; + const int x_145 = p; + const int x_1089 = param_5; + param_5 = 0; + param_5 = x_1089; + const float3 x_599 = float3(x_560.z, x_560.x, x_568.x); + const int x_1090 = p; + p = 0; + p = x_1090; + const float3 x_600 = float3(x_556.x, x_580.x, x_580.x); + const int x_1091 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1091; + const int x_147_save = x_144; + const int x_1092 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1092; + const float2 x_601 = float2(x_563.x, x_563.y); + stack[x_147_save] = asint((1u + asuint(x_145))); + const int x_1093[10] = stack; + const int tint_symbol_82[10] = (int[10])0; + stack = tint_symbol_82; + stack = x_1093; + const int x_148 = top; + const int x_1094 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1094; + const float2 x_602 = float2(x_565.y, x_599.y); + const int x_1095[10] = stack; + const int tint_symbol_83[10] = (int[10])0; + stack = tint_symbol_83; + stack = x_1095; + const int x_149 = (x_148 + asint(1u)); + const int x_1096 = stack[x_147_save]; + stack[x_147_save] = 0; + stack[x_147_save] = x_1096; + top = x_149; + const int x_1097 = param_4; + param_4 = 0; + param_4 = x_1097; + const int x_150 = h_1; + const int x_1098 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1098; + const int x_1099 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1099; + stack[x_149] = x_150; + const int x_1100 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1100; + const float3 x_603 = float3(x_568.y, x_564.x, x_564.x); + const int x_1101 = l_1; + l_1 = 0; + l_1 = x_1101; + } + const int x_1102 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1102; + { + const int x_1103 = l_1; + l_1 = 0; + l_1 = x_1103; + const float2 x_604 = float2(x_563.z, x_564.x); + const QuicksortObject x_1104 = obj; + const int tint_symbol_84[10] = (int[10])0; + const QuicksortObject tint_symbol_85 = {tint_symbol_84}; + obj = tint_symbol_85; + obj = x_1104; + } + } + const int x_1105 = h_1; + h_1 = 0; + h_1 = x_1105; + return; +} + +void main_1() { + float3 color = float3(0.0f, 0.0f, 0.0f); + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + const float2 x_717 = uv; + uv = (0.0f).xx; + uv = x_717; + i_2 = 0; + const QuicksortObject x_721 = obj; + const int tint_symbol_86[10] = (int[10])0; + const QuicksortObject tint_symbol_87 = {tint_symbol_86}; + obj = tint_symbol_87; + obj = x_721; + if (true) { + const QuicksortObject x_722 = obj; + const int tint_symbol_88[10] = (int[10])0; + const QuicksortObject tint_symbol_89 = {tint_symbol_88}; + obj = tint_symbol_89; + obj = x_722; + const float2 x_431 = (1.0f).xx; + const int x_158 = i_2; + const float2 x_723 = uv; + uv = (0.0f).xx; + uv = x_723; + const float3 x_725 = color; + color = (0.0f).xxx; + color = x_725; + const float2 x_432 = float2(x_431.y, x_431.y); + const QuicksortObject x_726 = obj; + const int tint_symbol_90[10] = (int[10])0; + const QuicksortObject tint_symbol_91 = {tint_symbol_90}; + obj = tint_symbol_91; + obj = x_726; + } + const QuicksortObject x_756 = obj; + const int tint_symbol_92[10] = (int[10])0; + const QuicksortObject tint_symbol_93 = {tint_symbol_92}; + obj = tint_symbol_93; + obj = x_756; + const float2 x_446 = (0.0f).xx; + const int x_757 = i_2; + i_2 = 0; + i_2 = x_757; + quicksort_(); + const QuicksortObject x_758 = obj; + const int tint_symbol_94[10] = (int[10])0; + const QuicksortObject tint_symbol_95 = {tint_symbol_94}; + obj = tint_symbol_95; + obj = x_758; + const float4 x_184 = gl_FragCoord; + const float2 x_759 = uv; + uv = (0.0f).xx; + uv = x_759; + const float2 x_447 = (0.0f).xx; + const float2 x_760 = uv; + uv = (0.0f).xx; + uv = x_760; + const float2 x_185 = float2(x_184.x, x_184.y); + const float3 x_448 = float3(x_185.y, x_446.y, x_446.y); + const QuicksortObject x_761 = obj; + const int tint_symbol_96[10] = (int[10])0; + const QuicksortObject tint_symbol_97 = {tint_symbol_96}; + obj = tint_symbol_97; + obj = x_761; + const float2 x_762 = uv; + uv = (0.0f).xx; + uv = x_762; + const float2 x_191 = asfloat(x_188[0].xy); + const QuicksortObject x_763 = obj; + const int tint_symbol_98[10] = (int[10])0; + const QuicksortObject tint_symbol_99 = {tint_symbol_98}; + obj = tint_symbol_99; + obj = x_763; + const float3 x_449 = float3(x_184.y, 3.0f, x_184.w); + const float3 x_764 = color; + color = (0.0f).xxx; + color = x_764; + const float2 x_192 = (x_185 / x_191); + const QuicksortObject x_765 = obj; + const int tint_symbol_100[10] = (int[10])0; + const QuicksortObject tint_symbol_101 = {tint_symbol_100}; + obj = tint_symbol_101; + obj = x_765; + const float2 x_450 = float2(x_447.x, x_185.y); + const float3 x_766 = color; + color = (0.0f).xxx; + const float3 x_767 = color; + color = (0.0f).xxx; + color = x_767; + color = x_766; + uv = x_192; + color = float3(1.0f, 2.0f, 3.0f); + const float3 x_768 = color; + color = (0.0f).xxx; + color = x_768; + const float3 x_451 = float3(x_185.x, x_185.y, x_446.y); + const QuicksortObject x_769 = obj; + const int tint_symbol_102[10] = (int[10])0; + const QuicksortObject tint_symbol_103 = {tint_symbol_102}; + obj = tint_symbol_103; + obj = x_769; + const int x_770 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_770; + const int x_201 = obj.numbers[0u]; + const QuicksortObject x_771 = obj; + const int tint_symbol_104[10] = (int[10])0; + const QuicksortObject tint_symbol_105 = {tint_symbol_104}; + obj = tint_symbol_105; + obj = x_771; + const int x_772 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_772; + const float x_206 = color.x; + const float x_773 = color.x; + color.x = 0.0f; + color.x = x_773; + const float2 x_452 = float2(3.0f, 2.0f); + const int x_774 = i_2; + i_2 = 0; + i_2 = x_774; + const QuicksortObject x_775 = obj; + const int tint_symbol_106[10] = (int[10])0; + const QuicksortObject tint_symbol_107 = {tint_symbol_106}; + obj = tint_symbol_107; + obj = x_775; + const float3 x_453 = float3(x_451.x, x_450.x, x_450.y); + color.x = (x_206 + float(x_201)); + const float2 x_776 = uv; + uv = (0.0f).xx; + uv = x_776; + const float2 x_777 = uv; + uv = (0.0f).xx; + uv = x_777; + const float2 x_454 = float2(x_184.y, x_184.y); + const float x_210 = uv.x; + const float2 x_455 = float2(x_192.y, x_192.x); + const float x_778 = uv.x; + uv.x = 0.0f; + uv.x = x_778; + const QuicksortObject x_779 = obj; + const int tint_symbol_108[10] = (int[10])0; + const QuicksortObject tint_symbol_109 = {tint_symbol_108}; + obj = tint_symbol_109; + obj = x_779; + if ((x_210 > 0.25f)) { + const int x_780 = i_2; + i_2 = 0; + i_2 = x_780; + const int x_781 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_781; + const float3 x_456 = float3(0.0f, x_448.y, x_448.y); + const float x_782 = uv.x; + uv.x = 0.0f; + uv.x = x_782; + const int x_216 = obj.numbers[1]; + const QuicksortObject x_783 = obj; + const int tint_symbol_110[10] = (int[10])0; + const QuicksortObject tint_symbol_111 = {tint_symbol_110}; + obj = tint_symbol_111; + obj = x_783; + const float2 x_457 = float2(x_454.x, x_454.x); + const float2 x_784 = uv; + uv = (0.0f).xx; + uv = x_784; + const QuicksortObject x_785 = obj; + const int tint_symbol_112[10] = (int[10])0; + const QuicksortObject tint_symbol_113 = {tint_symbol_112}; + obj = tint_symbol_113; + obj = x_785; + const float2 x_458 = float2(3.0f, 0.0f); + const int x_786 = i_2; + i_2 = 0; + i_2 = x_786; + const float x_219 = color[0]; + const float x_787 = color[0]; + color[0] = 0.0f; + color[0] = x_787; + const float3 x_788 = color; + color = (0.0f).xxx; + color = x_788; + const float3 x_789 = color; + color = (0.0f).xxx; + color = x_789; + const float3 x_459 = float3(x_454.y, x_454.y, x_447.y); + const float x_790 = color[0]; + color[0] = 0.0f; + color[0] = x_790; + color.x = (float(x_216) + x_219); + const int x_791 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_791; + } + const float x_792 = uv.x; + uv.x = 0.0f; + uv.x = x_792; + const float x_793 = uv.x; + uv.x = 0.0f; + uv.x = x_793; + const float x_223 = uv.x; + const float x_794 = uv.x; + uv.x = 0.0f; + uv.x = x_794; + const float3 x_460 = float3(x_453.z, x_453.y, x_453.y); + const float2 x_795 = uv; + uv = (0.0f).xx; + uv = x_795; + const float x_796 = uv.x; + uv.x = 0.0f; + uv.x = x_796; + const float2 x_461 = (0.0f).xx; + const float x_797 = uv.x; + uv.x = 0.0f; + uv.x = x_797; + if ((x_223 > 0.5f)) { + const float x_798 = uv.x; + uv.x = 0.0f; + uv.x = x_798; + const float2 x_462 = float2(x_446.x, x_446.x); + const float x_799 = color.x; + color.x = 0.0f; + color.x = x_799; + const float x_800 = color.x; + color.x = 0.0f; + color.x = x_800; + const float3 x_463 = float3(x_453.x, x_453.z, x_461.y); + const float x_801 = color.x; + color.x = 0.0f; + color.x = x_801; + const int x_230 = obj.numbers[2u]; + const float x_802 = uv.x; + uv.x = 0.0f; + uv.x = x_802; + const float x_803 = color.x; + color.x = 0.0f; + color.x = x_803; + const int x_804 = obj.numbers[2u]; + obj.numbers[2u] = 0; + obj.numbers[2u] = x_804; + const float2 x_464 = float2(x_450.y, x_191.x); + const float x_805 = color.y; + color.y = 0.0f; + color.y = x_805; + const float x_234 = color.y; + const int x_806 = obj.numbers[2u]; + obj.numbers[2u] = 0; + obj.numbers[2u] = x_806; + const float2 x_465 = float2(x_463.x, x_185.x); + const float x_807 = color.x; + color.x = 0.0f; + color.x = x_807; + const int x_808 = i_2; + i_2 = 0; + i_2 = x_808; + const float2 x_466 = float2(x_455.y, 0.0f); + const int x_809 = i_2; + i_2 = 0; + i_2 = x_809; + color.y = (float(x_230) + x_234); + const float x_810 = uv.x; + uv.x = 0.0f; + uv.x = x_810; + } + const int x_811 = i_2; + i_2 = 0; + i_2 = x_811; + const float2 x_467 = float2(x_191.x, x_191.x); + const float x_812 = uv.x; + uv.x = 0.0f; + uv.x = x_812; + const float x_238 = uv[0]; + const float3 x_813 = color; + color = (0.0f).xxx; + color = x_813; + const float x_814 = color.x; + color.x = 0.0f; + color.x = x_814; + if ((x_238 > 0.75f)) { + const float x_815 = color.x; + color.x = 0.0f; + color.x = x_815; + const int x_245 = obj.numbers[3]; + const float x_816 = color.x; + color.x = 0.0f; + color.x = x_816; + const QuicksortObject x_817 = obj; + const int tint_symbol_114[10] = (int[10])0; + const QuicksortObject tint_symbol_115 = {tint_symbol_114}; + obj = tint_symbol_115; + obj = x_817; + const float3 x_468 = float3(x_467.x, x_467.x, x_467.x); + const float x_818 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_818; + const float x_819 = uv.x; + uv.x = 0.0f; + uv.x = x_819; + const float x_249 = color.z; + const float3 x_820 = color; + color = (0.0f).xxx; + color = x_820; + const float3 x_469 = float3(x_467.x, x_191.y, x_467.y); + const float x_821 = color.z; + color.z = 0.0f; + color.z = x_821; + const int x_822 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_822; + const float2 x_470 = (0.0f).xx; + const float x_823 = color.z; + color.z = 0.0f; + color.z = x_823; + color.z = (x_249 + float(x_245)); + const float2 x_824 = uv; + uv = (0.0f).xx; + uv = x_824; + const float2 x_471 = float2(x_470.y, x_470.y); + } + const float x_825 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_825; + const float3 x_472 = float3(x_454.x, x_454.y, x_454.y); + const int x_254 = obj.numbers[4]; + const float x_826 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_826; + const float3 x_827 = color; + color = (0.0f).xxx; + color = x_827; + const float3 x_473 = float3(x_446.y, x_453.x, x_453.x); + const int x_828 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_828; + const float2 x_474 = float2(x_191.x, x_184.z); + const float x_829 = uv.x; + uv.x = 0.0f; + uv.x = x_829; + const float x_257 = color.y; + const float x_830 = color.y; + color.y = 0.0f; + color.y = x_830; + const float2 x_475 = float2(x_467.x, x_450.x); + const float x_831 = uv.x; + uv.x = 0.0f; + uv.x = x_831; + const float x_832 = color.x; + color.x = 0.0f; + color.x = x_832; + const float2 x_476 = float2(x_451.z, x_460.y); + color.y = (x_257 + float(x_254)); + const float3 x_477 = float3(0.0f, x_472.x, 0.0f); + const float x_833 = uv.x; + uv.x = 0.0f; + uv.x = x_833; + const float x_834 = color.x; + color.x = 0.0f; + color.x = x_834; + const float2 x_478 = float2(x_472.x, x_472.y); + const float x_835 = uv.y; + uv.y = 0.0f; + uv.y = x_835; + const float x_261 = uv.y; + const int x_836 = i_2; + i_2 = 0; + i_2 = x_836; + const float3 x_479 = float3(0.0f, x_454.y, 0.0f); + const int x_837 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_837; + const float x_838 = color.y; + color.y = 0.0f; + color.y = x_838; + const float3 x_480 = float3(x_446.x, x_446.x, 0.0f); + const float x_839 = uv.x; + uv.x = 0.0f; + uv.x = x_839; + if ((x_261 > 0.25f)) { + const float2 x_481 = float2(x_447.x, x_480.z); + const float3 x_840 = color; + color = (0.0f).xxx; + color = x_840; + const int x_267 = obj.numbers[5u]; + const float x_841 = color.x; + color.x = 0.0f; + color.x = x_841; + const int x_842 = i_2; + i_2 = 0; + i_2 = x_842; + const int x_843 = i_2; + i_2 = 0; + i_2 = x_843; + const float x_270 = color.x; + const float x_844 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_844; + const float3 x_482 = float3(x_455.x, x_475.y, x_455.y); + const QuicksortObject x_845 = obj; + const int tint_symbol_116[10] = (int[10])0; + const QuicksortObject tint_symbol_117 = {tint_symbol_116}; + obj = tint_symbol_117; + obj = x_845; + const float x_846 = uv.y; + uv.y = 0.0f; + uv.y = x_846; + const int x_847 = i_2; + i_2 = 0; + i_2 = x_847; + const float3 x_483 = float3(x_184.w, x_184.w, x_192.x); + const float x_848 = uv.x; + uv.x = 0.0f; + uv.x = x_848; + color.x = (float(x_267) + x_270); + const float3 x_484 = float3(x_454.y, x_450.x, x_454.y); + const float x_849 = uv.x; + uv.x = 0.0f; + uv.x = x_849; + } + const float x_850 = color.x; + color.x = 0.0f; + color.x = x_850; + const float3 x_485 = float3(x_467.x, x_450.y, x_450.x); + const float x_851 = uv.y; + uv.y = 0.0f; + uv.y = x_851; + const int x_852 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_852; + const float x_274 = uv.y; + const int x_853 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_853; + if ((x_274 > 0.5f)) { + const float x_854 = uv.x; + uv.x = 0.0f; + uv.x = x_854; + const float2 x_486 = float2(x_480.y, x_455.y); + const float x_855 = color.y; + color.y = 0.0f; + color.y = x_855; + const float2 x_487 = float2(x_449.z, x_449.y); + const float x_856 = uv.y; + uv.y = 0.0f; + uv.y = x_856; + const int x_280 = obj.numbers[6u]; + const float x_857 = uv.y; + uv.y = 0.0f; + uv.y = x_857; + const int x_858 = i_2; + i_2 = 0; + i_2 = x_858; + const int x_859 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_859; + const float2 x_488 = float2(x_473.z, x_473.y); + const float x_283 = color.y; + const float2 x_860 = uv; + uv = (0.0f).xx; + uv = x_860; + const float x_861 = color.x; + color.x = 0.0f; + color.x = x_861; + const float2 x_489 = float2(x_475.y, x_475.x); + const int x_862 = obj.numbers[6u]; + obj.numbers[6u] = 0; + obj.numbers[6u] = x_862; + const int x_863 = obj.numbers[6u]; + obj.numbers[6u] = 0; + obj.numbers[6u] = x_863; + const float2 x_490 = float2(x_480.z, x_480.z); + const QuicksortObject x_864 = obj; + const int tint_symbol_118[10] = (int[10])0; + const QuicksortObject tint_symbol_119 = {tint_symbol_118}; + obj = tint_symbol_119; + obj = x_864; + color.y = (float(x_280) + x_283); + const float x_865 = color.x; + color.x = 0.0f; + color.x = x_865; + const float2 x_491 = float2(2.0f, x_454.x); + const float x_866 = color.y; + color.y = 0.0f; + color.y = x_866; + } + const float2 x_492 = float2(x_455.y, x_455.y); + const float x_867 = color.x; + color.x = 0.0f; + color.x = x_867; + const float x_287 = uv.y; + const QuicksortObject x_868 = obj; + const int tint_symbol_120[10] = (int[10])0; + const QuicksortObject tint_symbol_121 = {tint_symbol_120}; + obj = tint_symbol_121; + obj = x_868; + const float2 x_493 = float2(x_475.x, x_475.y); + const float x_869 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_869; + const float x_870 = color.y; + color.y = 0.0f; + color.y = x_870; + const float3 x_494 = float3(x_191.x, x_191.y, x_191.y); + const int x_871 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_871; + if ((x_287 > 0.75f)) { + const float3 x_872 = color; + color = (0.0f).xxx; + color = x_872; + const float x_873 = color.x; + color.x = 0.0f; + color.x = x_873; + const float3 x_495 = float3(x_192.y, x_192.x, x_192.y); + const float3 x_874 = color; + color = (0.0f).xxx; + color = x_874; + const int x_293 = obj.numbers[7]; + const float x_875 = uv.x; + uv.x = 0.0f; + uv.x = x_875; + const float3 x_496 = float3(x_475.x, x_467.y, x_467.x); + const float x_876 = color.y; + color.y = 0.0f; + color.y = x_876; + const float2 x_497 = float2(x_477.x, x_461.y); + const int x_877 = obj.numbers[0u]; + obj.numbers[0u] = 0; + obj.numbers[0u] = x_877; + const float x_878 = color.y; + color.y = 0.0f; + color.y = x_878; + const float3 x_498 = float3(x_478.x, x_478.y, x_478.x); + const float x_879 = color.x; + color.x = 0.0f; + color.x = x_879; + const float x_296 = color.z; + const float x_880 = uv.y; + uv.y = 0.0f; + uv.y = x_880; + const float2 x_499 = float2(x_184.x, x_184.y); + const float x_881 = uv.x; + uv.x = 0.0f; + uv.x = x_881; + const float x_882 = uv.y; + uv.y = 0.0f; + uv.y = x_882; + const float x_883 = uv.y; + uv.y = 0.0f; + uv.y = x_883; + const float3 x_500 = float3(x_499.y, x_499.y, x_494.z); + const float x_884 = color.z; + color.z = 0.0f; + color.z = x_884; + color.z = (float(x_293) + x_296); + const float x_885 = color.y; + color.y = 0.0f; + color.y = x_885; + const float2 x_501 = float2(x_453.x, x_453.z); + const float x_886 = color.x; + color.x = 0.0f; + color.x = x_886; + } + const int x_887 = i_2; + i_2 = 0; + i_2 = x_887; + const float2 x_502 = float2(x_451.y, x_192.y); + const float2 x_888 = uv; + uv = (0.0f).xx; + uv = x_888; + const int x_301 = obj.numbers[8]; + const int x_889 = i_2; + i_2 = 0; + i_2 = x_889; + const float2 x_503 = float2(x_185.x, x_451.z); + const int x_890 = obj.numbers[8]; + obj.numbers[8] = 0; + obj.numbers[8] = x_890; + const float x_891 = color.y; + color.y = 0.0f; + color.y = x_891; + const float2 x_504 = float2(x_453.y, 0.0f); + const float x_892 = color.x; + color.x = 0.0f; + color.x = x_892; + const float3 x_505 = float3(x_504.x, x_504.y, x_504.x); + const float x_893 = color.z; + color.z = 0.0f; + color.z = x_893; + const float x_304 = color.z; + const float x_894 = color.x; + color.x = 0.0f; + color.x = x_894; + const float2 x_506 = float2(x_493.x, x_492.x); + const int x_895 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_895; + const float x_896 = uv.y; + uv.y = 0.0f; + uv.y = x_896; + const float2 x_507 = float2(x_461.x, x_447.x); + const float x_897 = color.y; + color.y = 0.0f; + color.y = x_897; + color.z = (x_304 + float(x_301)); + const float2 x_898 = uv; + uv = (0.0f).xx; + uv = x_898; + const float x_899 = uv.x; + uv.x = 0.0f; + uv.x = x_899; + const float3 x_508 = float3(x_461.y, x_461.x, x_506.y); + const float x_900 = uv.x; + uv.x = 0.0f; + uv.x = x_900; + const float x_308 = uv.x; + const float x_901 = color.y; + color.y = 0.0f; + color.y = x_901; + const float3 x_509 = float3(x_503.y, x_503.x, x_448.z); + const float x_902 = uv.y; + uv.y = 0.0f; + uv.y = x_902; + const float x_310 = uv.y; + const float x_903 = uv.y; + uv.y = 0.0f; + uv.y = x_903; + const float x_904 = color.z; + color.z = 0.0f; + color.z = x_904; + const float3 x_510 = float3(2.0f, x_485.y, x_485.z); + const float x_905 = color.z; + color.z = 0.0f; + color.z = x_905; + const int x_906 = i_2; + i_2 = 0; + i_2 = x_906; + const float2 x_511 = float2(x_485.z, x_485.y); + const float3 x_907 = color; + color = (0.0f).xxx; + color = x_907; + const float x_908 = uv.y; + uv.y = 0.0f; + uv.y = x_908; + const float3 x_512 = float3(x_455.y, x_455.y, x_455.y); + const int x_909 = obj.numbers[4]; + obj.numbers[4] = 0; + obj.numbers[4] = x_909; + if ((abs((x_308 - x_310)) < 0.25f)) { + const float x_910 = uv.x; + uv.x = 0.0f; + uv.x = x_910; + const QuicksortObject x_911 = obj; + const int tint_symbol_122[10] = (int[10])0; + const QuicksortObject tint_symbol_123 = {tint_symbol_122}; + obj = tint_symbol_123; + obj = x_911; + const float3 x_513 = float3(x_505.z, x_505.x, x_448.x); + const int x_912 = obj.numbers[8]; + obj.numbers[8] = 0; + obj.numbers[8] = x_912; + const int x_317 = obj.numbers[9u]; + const float3 x_514 = float3(x_474.y, x_474.y, x_474.y); + const float x_913 = uv.y; + uv.y = 0.0f; + uv.y = x_913; + const float x_320 = color.x; + const float x_914 = uv.y; + uv.y = 0.0f; + uv.y = x_914; + const float2 x_515 = float2(x_502.x, x_502.y); + const float x_915 = color.x; + color.x = 0.0f; + color.x = x_915; + const float3 x_916 = color; + color = (0.0f).xxx; + color = x_916; + const float2 x_516 = float2(x_452.x, x_452.x); + const float2 x_917 = uv; + uv = (0.0f).xx; + uv = x_917; + const float x_918 = uv.x; + uv.x = 0.0f; + uv.x = x_918; + const float3 x_517 = (0.0f).xxx; + color.x = (float(x_317) + x_320); + const float x_919 = color.x; + color.x = 0.0f; + color.x = x_919; + const float3 x_518 = float3(x_480.y, x_508.x, x_480.x); + const float x_920 = color.x; + color.x = 0.0f; + color.x = x_920; + } + const float x_921 = uv.y; + uv.y = 0.0f; + uv.y = x_921; + const float3 x_325 = color; + const float x_922 = uv[0]; + uv[0] = 0.0f; + uv[0] = x_922; + const float3 x_519 = float3(x_447.x, x_446.x, x_446.y); + const float3 x_326 = normalize(x_325); + const float x_923 = uv.x; + uv.x = 0.0f; + uv.x = x_923; + const QuicksortObject x_924 = obj; + const int tint_symbol_124[10] = (int[10])0; + const QuicksortObject tint_symbol_125 = {tint_symbol_124}; + obj = tint_symbol_125; + obj = x_924; + const QuicksortObject x_925 = obj; + const int tint_symbol_126[10] = (int[10])0; + const QuicksortObject tint_symbol_127 = {tint_symbol_126}; + obj = tint_symbol_127; + obj = x_925; + const float x_926 = color.y; + color.y = 0.0f; + color.y = x_926; + const float2 x_520 = float2(x_506.y, x_519.y); + const float x_927 = color.y; + color.y = 0.0f; + color.y = x_927; + const float4 x_330 = float4(x_326.x, x_326.y, x_326.z, 1.0f); + const float x_928 = uv.y; + uv.y = 0.0f; + uv.y = x_928; + const float3 x_521 = float3(2.0f, 2.0f, x_520.y); + const float x_929 = uv.x; + uv.x = 0.0f; + uv.x = x_929; + x_GLF_color = x_330; + const QuicksortObject x_930 = obj; + const int tint_symbol_128[10] = (int[10])0; + const QuicksortObject tint_symbol_129 = {tint_symbol_128}; + obj = tint_symbol_129; + obj = x_930; + const float3 x_522 = float3(x_330.w, x_330.y, x_493.x); + const float x_931 = color.x; + color.x = 0.0f; + color.x = x_931; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_49 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_50 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_130 = {x_GLF_color}; + return tint_symbol_130; +} + +tint_symbol_50 main(tint_symbol_49 tint_symbol_48) { + const main_out inner_result = main_inner(tint_symbol_48.gl_FragCoord_param); + tint_symbol_50 wrapper_result = (tint_symbol_50)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/749.spvasm.expected.glsl b/test/tint/bug/tint/749.spvasm.expected.glsl index 61e049016d..ea9ce91b46 100644 --- a/test/tint/bug/tint/749.spvasm.expected.glsl +++ b/test/tint/bug/tint/749.spvasm.expected.glsl @@ -22,7 +22,7 @@ void swap_i1_i1_(inout int i, inout int j) { int x_932 = temp; temp = 0; temp = x_932; - vec3 x_523 = vec3(vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).z); + vec3 x_523 = vec3(3.0f, 2.0f, 3.0f); int x_933 = i; i = 0; i = x_933; @@ -46,7 +46,7 @@ void swap_i1_i1_(inout int i, inout int j) { int x_938 = j; j = 0; j = x_938; - vec3 x_525 = vec3(x_523.z, vec3(1.0f, 2.0f, 3.0f).x, x_523.y); + vec3 x_525 = vec3(x_523.z, 1.0f, x_523.y); int x_939 = i; i = 0; i = x_939; @@ -136,7 +136,7 @@ int performPartition_i1_i1_(inout int l, inout int h) { int x_955 = param_3; param_3 = 0; param_3 = x_955; - vec3 x_534 = vec3(vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).z); + vec3 x_534 = vec3(3.0f, 1.0f, 3.0f); int x_956 = param_1; param_1 = 0; param_1 = x_956; @@ -172,7 +172,7 @@ int performPartition_i1_i1_(inout int l, inout int h) { int x_963 = pivot; pivot = 0; pivot = x_963; - x_537 = vec2(vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).z); + x_537 = vec2(2.0f, 3.0f); QuicksortObject x_964 = obj; int tint_symbol_11[10] = int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0); QuicksortObject tint_symbol_12 = QuicksortObject(tint_symbol_11); @@ -215,7 +215,7 @@ int performPartition_i1_i1_(inout int l, inout int h) { obj = tint_symbol_14; obj = x_972; int x_63 = pivot; - vec2 x_540 = vec2(vec3(1.0f, 2.0f, 3.0f).y, x_534.z); + vec2 x_540 = vec2(2.0f, x_534.z); int x_973 = i_1; i_1 = 0; i_1 = x_973; @@ -246,7 +246,7 @@ int performPartition_i1_i1_(inout int l, inout int h) { int x_980 = l; l = 0; l = x_980; - vec3 x_544 = vec3(vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).y, x_540.x); + vec3 x_544 = vec3(3.0f, 2.0f, x_540.x); int x_70 = i_1; vec2 x_545 = vec2(x_537.y, x_538.x); int x_981 = param; @@ -346,7 +346,7 @@ int performPartition_i1_i1_(inout int l, inout int h) { int x_1003 = l; l = 0; l = x_1003; - vec2 x_554 = vec2(x_536.z, vec3(1.0f, 2.0f, 3.0f).y); + vec2 x_554 = vec2(x_536.z, 2.0f); int x_1004 = param_1; param_1 = 0; param_1 = x_1004; @@ -378,7 +378,7 @@ void quicksort_() { int tint_symbol_19[10] = int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0); stack = tint_symbol_19; stack = x_1008; - vec2 x_556 = vec2(vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).y); + vec2 x_556 = vec2(2.0f); int x_1009 = param_5; param_5 = 0; param_5 = x_1009; @@ -387,7 +387,7 @@ void quicksort_() { p = 0; p = x_1010; int x_93 = top; - vec2 x_557 = vec2(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).x); + vec2 x_557 = vec2(1.0f); int x_1011 = p; p = 0; p = x_1011; @@ -431,7 +431,7 @@ void quicksort_() { int x_1020 = param_4; param_4 = 0; param_4 = x_1020; - vec3 x_562 = vec3(vec3(1.0f, 2.0f, 3.0f).z, x_558.y, vec3(1.0f, 2.0f, 3.0f).y); + vec3 x_562 = vec3(3.0f, x_558.y, 2.0f); int x_1021 = stack[x_96_save]; stack[x_96_save] = 0; stack[x_96_save] = x_1021; @@ -534,7 +534,7 @@ void quicksort_() { int x_1043 = stack[x_100_save]; stack[x_100_save] = 0; stack[x_100_save] = x_1043; - vec2 x_573 = vec2(vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).z); + vec2 x_573 = vec2(2.0f, 3.0f); top = (x_112 - 1); int x_1044 = param_5; param_5 = 0; @@ -566,7 +566,7 @@ void quicksort_() { stack[x_110_save] = x_1050; vec2 x_577 = vec2(x_569.y, x_569.z); int x_120 = h_1; - vec2 x_578 = vec2(x_558.x, vec3(1.0f, 2.0f, 3.0f).y); + vec2 x_578 = vec2(x_558.x, 2.0f); param_5 = x_120; int x_1051 = stack[x_100_save]; stack[x_100_save] = 0; @@ -676,7 +676,7 @@ void quicksort_() { int x_1076 = stack[x_96_save]; stack[x_96_save] = 0; stack[x_96_save] = x_1076; - vec2 x_592 = vec2(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).y); + vec2 x_592 = vec2(1.0f, 2.0f); QuicksortObject x_1077 = obj; int tint_symbol_31[10] = int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0); QuicksortObject tint_symbol_32 = QuicksortObject(tint_symbol_31); @@ -807,7 +807,7 @@ void main_1() { int i_2 = 0; vec2 uv = vec2(0.0f, 0.0f); vec2 x_717 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_717; i_2 = 0; QuicksortObject x_721 = obj; @@ -821,13 +821,13 @@ void main_1() { QuicksortObject tint_symbol_40 = QuicksortObject(tint_symbol_39); obj = tint_symbol_40; obj = x_722; - vec2 x_431 = vec2(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).x); + vec2 x_431 = vec2(1.0f); int x_158 = i_2; vec2 x_723 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_723; vec3 x_725 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_725; vec2 x_432 = vec2(x_431.y, x_431.y); QuicksortObject x_726 = obj; @@ -841,7 +841,7 @@ void main_1() { QuicksortObject tint_symbol_44 = QuicksortObject(tint_symbol_43); obj = tint_symbol_44; obj = x_756; - vec2 x_446 = vec2(vec2(0.0f, 0.0f).x, vec2(0.0f, 0.0f).x); + vec2 x_446 = vec2(0.0f); int x_757 = i_2; i_2 = 0; i_2 = x_757; @@ -853,11 +853,11 @@ void main_1() { obj = x_758; vec4 x_184 = tint_symbol; vec2 x_759 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_759; - vec2 x_447 = vec2(vec2(0.0f, 0.0f).y, vec2(0.0f, 0.0f).y); + vec2 x_447 = vec2(0.0f); vec2 x_760 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_760; vec2 x_185 = vec2(x_184.x, x_184.y); vec3 x_448 = vec3(x_185.y, x_446.y, x_446.y); @@ -867,7 +867,7 @@ void main_1() { obj = tint_symbol_48; obj = x_761; vec2 x_762 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_762; vec2 x_191 = x_188.resolution; QuicksortObject x_763 = obj; @@ -875,9 +875,9 @@ void main_1() { QuicksortObject tint_symbol_50 = QuicksortObject(tint_symbol_49); obj = tint_symbol_50; obj = x_763; - vec3 x_449 = vec3(x_184.y, vec3(1.0f, 2.0f, 3.0f).z, x_184.w); + vec3 x_449 = vec3(x_184.y, 3.0f, x_184.w); vec3 x_764 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_764; vec2 x_192 = (x_185 / x_191); QuicksortObject x_765 = obj; @@ -887,15 +887,15 @@ void main_1() { obj = x_765; vec2 x_450 = vec2(x_447.x, x_185.y); vec3 x_766 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); vec3 x_767 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_767; color = x_766; uv = x_192; color = vec3(1.0f, 2.0f, 3.0f); vec3 x_768 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_768; vec3 x_451 = vec3(x_185.x, x_185.y, x_446.y); QuicksortObject x_769 = obj; @@ -919,7 +919,7 @@ void main_1() { float x_773 = color.x; color.x = 0.0f; color.x = x_773; - vec2 x_452 = vec2(vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).y); + vec2 x_452 = vec2(3.0f, 2.0f); int x_774 = i_2; i_2 = 0; i_2 = x_774; @@ -931,10 +931,10 @@ void main_1() { vec3 x_453 = vec3(x_451.x, x_450.x, x_450.y); color.x = (x_206 + float(x_201)); vec2 x_776 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_776; vec2 x_777 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_777; vec2 x_454 = vec2(x_184.y, x_184.y); float x_210 = uv.x; @@ -954,7 +954,7 @@ void main_1() { int x_781 = obj.numbers[0u]; obj.numbers[0u] = 0; obj.numbers[0u] = x_781; - vec3 x_456 = vec3(vec2(0.0f, 0.0f).y, x_448.y, x_448.y); + vec3 x_456 = vec3(0.0f, x_448.y, x_448.y); float x_782 = uv.x; uv.x = 0.0f; uv.x = x_782; @@ -966,14 +966,14 @@ void main_1() { obj = x_783; vec2 x_457 = vec2(x_454.x, x_454.x); vec2 x_784 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_784; QuicksortObject x_785 = obj; int tint_symbol_63[10] = int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0); QuicksortObject tint_symbol_64 = QuicksortObject(tint_symbol_63); obj = tint_symbol_64; obj = x_785; - vec2 x_458 = vec2(vec3(1.0f, 2.0f, 3.0f).z, vec2(0.0f, 0.0f).y); + vec2 x_458 = vec2(3.0f, 0.0f); int x_786 = i_2; i_2 = 0; i_2 = x_786; @@ -982,10 +982,10 @@ void main_1() { color[0] = 0.0f; color[0] = x_787; vec3 x_788 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_788; vec3 x_789 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_789; vec3 x_459 = vec3(x_454.y, x_454.y, x_447.y); float x_790 = color[0]; @@ -1008,12 +1008,12 @@ void main_1() { uv.x = x_794; vec3 x_460 = vec3(x_453.z, x_453.y, x_453.y); vec2 x_795 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_795; float x_796 = uv.x; uv.x = 0.0f; uv.x = x_796; - vec2 x_461 = vec2(vec2(0.0f, 0.0f).y, vec2(0.0f, 0.0f).y); + vec2 x_461 = vec2(0.0f); float x_797 = uv.x; uv.x = 0.0f; uv.x = x_797; @@ -1057,7 +1057,7 @@ void main_1() { int x_808 = i_2; i_2 = 0; i_2 = x_808; - vec2 x_466 = vec2(x_455.y, vec2(0.0f, 0.0f).y); + vec2 x_466 = vec2(x_455.y, 0.0f); int x_809 = i_2; i_2 = 0; i_2 = x_809; @@ -1075,7 +1075,7 @@ void main_1() { uv.x = x_812; float x_238 = uv[0]; vec3 x_813 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_813; float x_814 = color.x; color.x = 0.0f; @@ -1102,7 +1102,7 @@ void main_1() { uv.x = x_819; float x_249 = color.z; vec3 x_820 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_820; vec3 x_469 = vec3(x_467.x, x_191.y, x_467.y); float x_821 = color.z; @@ -1111,13 +1111,13 @@ void main_1() { int x_822 = obj.numbers[0u]; obj.numbers[0u] = 0; obj.numbers[0u] = x_822; - vec2 x_470 = vec2(vec2(0.0f, 0.0f).x, vec2(0.0f, 0.0f).y); + vec2 x_470 = vec2(0.0f); float x_823 = color.z; color.z = 0.0f; color.z = x_823; color.z = (x_249 + float(x_245)); vec2 x_824 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_824; vec2 x_471 = vec2(x_470.y, x_470.y); } @@ -1130,7 +1130,7 @@ void main_1() { uv[0] = 0.0f; uv[0] = x_826; vec3 x_827 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_827; vec3 x_473 = vec3(x_446.y, x_453.x, x_453.x); int x_828 = obj.numbers[4]; @@ -1153,7 +1153,7 @@ void main_1() { color.x = x_832; vec2 x_476 = vec2(x_451.z, x_460.y); color.y = (x_257 + float(x_254)); - vec3 x_477 = vec3(vec2(0.0f, 0.0f).x, x_472.x, vec2(0.0f, 0.0f).y); + vec3 x_477 = vec3(0.0f, x_472.x, 0.0f); float x_833 = uv.x; uv.x = 0.0f; uv.x = x_833; @@ -1168,21 +1168,21 @@ void main_1() { int x_836 = i_2; i_2 = 0; i_2 = x_836; - vec3 x_479 = vec3(vec2(0.0f, 0.0f).y, x_454.y, vec2(0.0f, 0.0f).x); + vec3 x_479 = vec3(0.0f, x_454.y, 0.0f); int x_837 = obj.numbers[0u]; obj.numbers[0u] = 0; obj.numbers[0u] = x_837; float x_838 = color.y; color.y = 0.0f; color.y = x_838; - vec3 x_480 = vec3(x_446.x, x_446.x, vec2(0.0f, 0.0f).y); + vec3 x_480 = vec3(x_446.x, x_446.x, 0.0f); float x_839 = uv.x; uv.x = 0.0f; uv.x = x_839; if ((x_261 > 0.25f)) { vec2 x_481 = vec2(x_447.x, x_480.z); vec3 x_840 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_840; int x_267 = obj.numbers[5u]; float x_841 = color.x; @@ -1259,7 +1259,7 @@ void main_1() { vec2 x_488 = vec2(x_473.z, x_473.y); float x_283 = color.y; vec2 x_860 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_860; float x_861 = color.x; color.x = 0.0f; @@ -1281,7 +1281,7 @@ void main_1() { float x_865 = color.x; color.x = 0.0f; color.x = x_865; - vec2 x_491 = vec2(vec3(1.0f, 2.0f, 3.0f).y, x_454.x); + vec2 x_491 = vec2(2.0f, x_454.x); float x_866 = color.y; color.y = 0.0f; color.y = x_866; @@ -1309,14 +1309,14 @@ void main_1() { obj.numbers[4] = x_871; if ((x_287 > 0.75f)) { vec3 x_872 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_872; float x_873 = color.x; color.x = 0.0f; color.x = x_873; vec3 x_495 = vec3(x_192.y, x_192.x, x_192.y); vec3 x_874 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_874; int x_293 = obj.numbers[7]; float x_875 = uv.x; @@ -1369,7 +1369,7 @@ void main_1() { i_2 = x_887; vec2 x_502 = vec2(x_451.y, x_192.y); vec2 x_888 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_888; int x_301 = obj.numbers[8]; int x_889 = i_2; @@ -1382,7 +1382,7 @@ void main_1() { float x_891 = color.y; color.y = 0.0f; color.y = x_891; - vec2 x_504 = vec2(x_453.y, vec2(0.0f, 0.0f).x); + vec2 x_504 = vec2(x_453.y, 0.0f); float x_892 = color.x; color.x = 0.0f; color.x = x_892; @@ -1407,7 +1407,7 @@ void main_1() { color.y = x_897; color.z = (x_304 + float(x_301)); vec2 x_898 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_898; float x_899 = uv.x; uv.x = 0.0f; @@ -1431,7 +1431,7 @@ void main_1() { float x_904 = color.z; color.z = 0.0f; color.z = x_904; - vec3 x_510 = vec3(vec3(1.0f, 2.0f, 3.0f).y, x_485.y, x_485.z); + vec3 x_510 = vec3(2.0f, x_485.y, x_485.z); float x_905 = color.z; color.z = 0.0f; color.z = x_905; @@ -1440,7 +1440,7 @@ void main_1() { i_2 = x_906; vec2 x_511 = vec2(x_485.z, x_485.y); vec3 x_907 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_907; float x_908 = uv.y; uv.y = 0.0f; @@ -1476,16 +1476,16 @@ void main_1() { color.x = 0.0f; color.x = x_915; vec3 x_916 = color; - color = vec3(0.0f, 0.0f, 0.0f); + color = vec3(0.0f); color = x_916; vec2 x_516 = vec2(x_452.x, x_452.x); vec2 x_917 = uv; - uv = vec2(0.0f, 0.0f); + uv = vec2(0.0f); uv = x_917; float x_918 = uv.x; uv.x = 0.0f; uv.x = x_918; - vec3 x_517 = vec3(vec2(0.0f, 0.0f).x, vec2(0.0f, 0.0f).x, vec2(0.0f, 0.0f).y); + vec3 x_517 = vec3(0.0f); color.x = (float(x_317) + x_320); float x_919 = color.x; color.x = 0.0f; @@ -1528,7 +1528,7 @@ void main_1() { float x_928 = uv.y; uv.y = 0.0f; uv.y = x_928; - vec3 x_521 = vec3(vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).y, x_520.y); + vec3 x_521 = vec3(2.0f, 2.0f, x_520.y); float x_929 = uv.x; uv.x = 0.0f; uv.x = x_929; diff --git a/test/tint/bug/tint/749.spvasm.expected.hlsl b/test/tint/bug/tint/749.spvasm.expected.hlsl deleted file mode 100644 index d6f801a9cf..0000000000 --- a/test/tint/bug/tint/749.spvasm.expected.hlsl +++ /dev/null @@ -1,1658 +0,0 @@ -struct QuicksortObject { - int numbers[10]; -}; - -static QuicksortObject obj = (QuicksortObject)0; -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_188 : register(b0, space0) { - uint4 x_188[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void swap_i1_i1_(inout int i, inout int j) { - int temp = 0; - const int x_932 = temp; - temp = 0; - temp = x_932; - const float3 x_523 = float3(float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y, float3(1.0f, 2.0f, 3.0f).z); - const int x_933 = i; - i = 0; - i = x_933; - const int x_28 = i; - const int x_934 = j; - j = 0; - j = x_934; - const float3 x_524 = float3(x_523.y, x_523.x, x_523.y); - const int x_935 = temp; - temp = 0; - temp = x_935; - const int x_30_save = x_28; - const int x_936 = obj.numbers[x_30_save]; - { - int tint_symbol_1[10] = obj.numbers; - tint_symbol_1[x_30_save] = 0; - obj.numbers = tint_symbol_1; - } - { - int tint_symbol_3[10] = obj.numbers; - tint_symbol_3[x_30_save] = x_936; - obj.numbers = tint_symbol_3; - } - const int x_31 = obj.numbers[x_30_save]; - const int x_937 = temp; - temp = 0; - temp = x_937; - temp = x_31; - const int x_938 = j; - j = 0; - j = x_938; - const float3 x_525 = float3(x_523.z, float3(1.0f, 2.0f, 3.0f).x, x_523.y); - const int x_939 = i; - i = 0; - i = x_939; - const int x_32 = i; - const int x_940 = obj.numbers[x_30_save]; - { - int tint_symbol_5[10] = obj.numbers; - tint_symbol_5[x_30_save] = 0; - obj.numbers = tint_symbol_5; - } - { - int tint_symbol_7[10] = obj.numbers; - tint_symbol_7[x_30_save] = x_940; - obj.numbers = tint_symbol_7; - } - const int x_33 = j; - const int x_941 = i; - i = 0; - i = x_941; - const float3 x_526 = float3(x_525.x, x_525.z, x_525.z); - const int x_942 = obj.numbers[x_30_save]; - { - int tint_symbol_9[10] = obj.numbers; - tint_symbol_9[x_30_save] = 0; - obj.numbers = tint_symbol_9; - } - { - int tint_symbol_11[10] = obj.numbers; - tint_symbol_11[x_30_save] = x_942; - obj.numbers = tint_symbol_11; - } - const int x_34_save = x_33; - const int x_35 = obj.numbers[x_34_save]; - const QuicksortObject x_943 = obj; - const int tint_symbol_52[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_53 = {tint_symbol_52}; - obj = tint_symbol_53; - obj = x_943; - const float2 x_527 = float2(x_526.x, x_526.x); - const int x_36_save = x_32; - const float3 x_528 = float3(x_524.x, x_524.z, x_524.x); - { - int tint_symbol_13[10] = obj.numbers; - tint_symbol_13[x_36_save] = x_35; - obj.numbers = tint_symbol_13; - } - const QuicksortObject x_944 = obj; - const int tint_symbol_54[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_55 = {tint_symbol_54}; - obj = tint_symbol_55; - obj = x_944; - const float3 x_529 = float3(x_526.y, x_526.z, x_526.x); - const int x_945 = i; - i = 0; - i = x_945; - const int x_37 = j; - const int x_946 = temp; - temp = 0; - temp = x_946; - const float2 x_530 = float2(x_529.z, x_529.y); - const int x_947 = obj.numbers[x_34_save]; - { - int tint_symbol_15[10] = obj.numbers; - tint_symbol_15[x_34_save] = 0; - obj.numbers = tint_symbol_15; - } - { - int tint_symbol_17[10] = obj.numbers; - tint_symbol_17[x_34_save] = x_947; - obj.numbers = tint_symbol_17; - } - const int x_38 = temp; - const int x_948 = j; - j = 0; - j = x_948; - const float3 x_531 = float3(x_527.x, x_526.y, x_526.x); - const int x_949 = obj.numbers[x_36_save]; - { - int tint_symbol_19[10] = obj.numbers; - tint_symbol_19[x_36_save] = 0; - obj.numbers = tint_symbol_19; - } - { - int tint_symbol_21[10] = obj.numbers; - tint_symbol_21[x_36_save] = x_949; - obj.numbers = tint_symbol_21; - } - const QuicksortObject x_950 = obj; - const int tint_symbol_56[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_57 = {tint_symbol_56}; - obj = tint_symbol_57; - obj = x_950; - const float3 x_532 = float3(x_528.x, x_528.y, x_528.x); - const int x_951 = obj.numbers[x_34_save]; - { - int tint_symbol_23[10] = obj.numbers; - tint_symbol_23[x_34_save] = 0; - obj.numbers = tint_symbol_23; - } - { - int tint_symbol_25[10] = obj.numbers; - tint_symbol_25[x_34_save] = x_951; - obj.numbers = tint_symbol_25; - } - { - int tint_symbol_27[10] = obj.numbers; - tint_symbol_27[x_37] = x_38; - obj.numbers = tint_symbol_27; - } - return; -} - -int performPartition_i1_i1_(inout int l, inout int h) { - int param_3 = 0; - int i_1 = 0; - int j_1 = 0; - int param_2 = 0; - int param_1 = 0; - int param = 0; - int pivot = 0; - float2 x_537 = float2(0.0f, 0.0f); - float3 x_538 = float3(0.0f, 0.0f, 0.0f); - const int x_952 = h; - h = 0; - h = x_952; - const int x_41 = h; - const int x_953 = l; - l = 0; - l = x_953; - const int x_42_save = x_41; - const int x_954 = obj.numbers[x_42_save]; - { - int tint_symbol_29[10] = obj.numbers; - tint_symbol_29[x_42_save] = 0; - obj.numbers = tint_symbol_29; - } - { - int tint_symbol_31[10] = obj.numbers; - tint_symbol_31[x_42_save] = x_954; - obj.numbers = tint_symbol_31; - } - const int x_43 = obj.numbers[x_42_save]; - const int x_955 = param_3; - param_3 = 0; - param_3 = x_955; - const float3 x_534 = float3(float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z); - const int x_956 = param_1; - param_1 = 0; - param_1 = x_956; - pivot = x_43; - const int x_45 = l; - const int x_957 = h; - h = 0; - h = x_957; - const int x_958 = j_1; - j_1 = 0; - j_1 = x_958; - const float3 x_535 = float3(x_534.y, x_534.z, x_534.y); - const int x_959 = l; - l = 0; - l = x_959; - i_1 = (x_45 - asint(1u)); - const int x_49 = l; - const float3 x_536 = float3(x_534.x, x_534.z, x_535.x); - j_1 = 10; - const QuicksortObject x_960 = obj; - const int tint_symbol_58[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_59 = {tint_symbol_58}; - obj = tint_symbol_59; - obj = x_960; - [loop] while (true) { - const int x_961 = pivot; - pivot = 0; - pivot = x_961; - const int x_962 = param_1; - param_1 = 0; - param_1 = x_962; - const int x_55 = j_1; - const int x_963 = pivot; - pivot = 0; - pivot = x_963; - x_537 = float2(float3(1.0f, 2.0f, 3.0f).y, float3(1.0f, 2.0f, 3.0f).z); - const QuicksortObject x_964 = obj; - const int tint_symbol_60[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_61 = {tint_symbol_60}; - obj = tint_symbol_61; - obj = x_964; - const int x_56 = h; - const int x_965 = h; - h = 0; - h = x_965; - const int x_966 = param; - param = 0; - param = x_966; - const int x_967 = j_1; - j_1 = 0; - j_1 = x_967; - x_538 = float3(x_534.x, x_537.y, x_534.z); - const int x_968 = param; - param = 0; - param = x_968; - if ((x_55 <= (x_56 - asint(1u)))) { - } else { - break; - } - const int x_60 = j_1; - const int x_969 = obj.numbers[x_42_save]; - { - int tint_symbol_33[10] = obj.numbers; - tint_symbol_33[x_42_save] = 0; - obj.numbers = tint_symbol_33; - } - { - int tint_symbol_35[10] = obj.numbers; - tint_symbol_35[x_42_save] = x_969; - obj.numbers = tint_symbol_35; - } - const int x_61_save = x_60; - const int x_970 = h; - h = 0; - h = x_970; - const float3 x_539 = float3(x_537.x, x_535.z, x_537.x); - const int x_971 = param_1; - param_1 = 0; - param_1 = x_971; - const int x_62 = obj.numbers[x_61_save]; - const QuicksortObject x_972 = obj; - const int tint_symbol_62[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_63 = {tint_symbol_62}; - obj = tint_symbol_63; - obj = x_972; - const int x_63 = pivot; - const float2 x_540 = float2(float3(1.0f, 2.0f, 3.0f).y, x_534.z); - const int x_973 = i_1; - i_1 = 0; - i_1 = x_973; - const int x_974 = l; - l = 0; - l = x_974; - const float3 x_541 = float3(x_534.y, x_534.x, x_534.y); - const int x_975 = pivot; - pivot = 0; - pivot = x_975; - if ((x_62 <= x_63)) { - const float3 x_542 = float3(x_541.z, x_541.x, x_541.x); - const int x_976 = param_3; - param_3 = 0; - param_3 = x_976; - const int x_67 = i_1; - const int x_977 = pivot; - pivot = 0; - pivot = x_977; - const float2 x_543 = float2(x_539.x, x_541.y); - const int x_978 = i_1; - i_1 = 0; - i_1 = x_978; - const int x_979 = param; - param = 0; - param = x_979; - i_1 = (x_67 + asint(1u)); - const int x_980 = l; - l = 0; - l = x_980; - const float3 x_544 = float3(float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y, x_540.x); - const int x_70 = i_1; - const float2 x_545 = float2(x_537.y, x_538.x); - const int x_981 = param; - param = 0; - param = x_981; - param = x_70; - const int x_982 = param; - param = 0; - param = x_982; - const float2 x_546 = float2(x_545.x, x_545.x); - const int x_983 = i_1; - i_1 = 0; - i_1 = x_983; - param_1 = j_1; - const int x_984 = param_3; - param_3 = 0; - param_3 = x_984; - swap_i1_i1_(param, param_1); - const int x_985 = param_1; - param_1 = 0; - param_1 = x_985; - } - const QuicksortObject x_986 = obj; - const int tint_symbol_64[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_65 = {tint_symbol_64}; - obj = tint_symbol_65; - obj = x_986; - { - const int x_987 = h; - h = 0; - h = x_987; - const int x_74 = j_1; - const int x_988 = h; - h = 0; - h = x_988; - const float3 x_547 = float3(x_539.x, x_541.z, x_541.z); - const int x_989 = obj.numbers[x_61_save]; - { - int tint_symbol_37[10] = obj.numbers; - tint_symbol_37[x_61_save] = 0; - obj.numbers = tint_symbol_37; - } - { - int tint_symbol_39[10] = obj.numbers; - tint_symbol_39[x_61_save] = x_989; - obj.numbers = tint_symbol_39; - } - const int x_990 = param; - param = 0; - param = x_990; - j_1 = (1 + x_74); - const int x_991 = param_1; - param_1 = 0; - param_1 = x_991; - const float3 x_548 = float3(x_541.y, x_541.z, x_541.x); - const int x_992 = obj.numbers[x_61_save]; - { - int tint_symbol_41[10] = obj.numbers; - tint_symbol_41[x_61_save] = 0; - obj.numbers = tint_symbol_41; - } - { - int tint_symbol_43[10] = obj.numbers; - tint_symbol_43[x_61_save] = x_992; - obj.numbers = tint_symbol_43; - } - } - } - const int x_76 = i_1; - const int x_993 = obj.numbers[x_42_save]; - { - int tint_symbol_45[10] = obj.numbers; - tint_symbol_45[x_42_save] = 0; - obj.numbers = tint_symbol_45; - } - { - int tint_symbol_47[10] = obj.numbers; - tint_symbol_47[x_42_save] = x_993; - obj.numbers = tint_symbol_47; - } - const float2 x_549 = float2(x_534.x, x_534.y); - const QuicksortObject x_994 = obj; - const int tint_symbol_66[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_67 = {tint_symbol_66}; - obj = tint_symbol_67; - obj = x_994; - const int x_995 = h; - h = 0; - h = x_995; - i_1 = (1 + x_76); - const int x_996 = param_1; - param_1 = 0; - param_1 = x_996; - const int x_79 = i_1; - const int x_997 = j_1; - j_1 = 0; - j_1 = x_997; - const float2 x_550 = float2(x_534.x, x_534.x); - const int x_998 = param_1; - param_1 = 0; - param_1 = x_998; - param_2 = x_79; - const float2 x_551 = float2(x_534.y, x_536.x); - const int x_999 = pivot; - pivot = 0; - pivot = x_999; - const int x_81 = h; - const float2 x_552 = float2(x_550.x, x_549.y); - const int x_1000 = h; - h = 0; - h = x_1000; - param_3 = x_81; - const int x_1001 = i_1; - i_1 = 0; - i_1 = x_1001; - const float2 x_553 = float2(x_549.y, x_552.x); - const int x_1002 = h; - h = 0; - h = x_1002; - swap_i1_i1_(param_2, param_3); - const int x_1003 = l; - l = 0; - l = x_1003; - const float2 x_554 = float2(x_536.z, float3(1.0f, 2.0f, 3.0f).y); - const int x_1004 = param_1; - param_1 = 0; - param_1 = x_1004; - const int x_83 = i_1; - const int x_1005 = param; - param = 0; - param = x_1005; - const float2 x_555 = float2(x_534.y, x_534.x); - const int x_1006 = j_1; - j_1 = 0; - j_1 = x_1006; - return x_83; -} - -void quicksort_() { - int param_4 = 0; - int h_1 = 0; - int p = 0; - int l_1 = 0; - int top = 0; - int stack[10] = (int[10])0; - int param_5 = 0; - l_1 = 0; - const int x_1007 = param_5; - param_5 = 0; - param_5 = x_1007; - h_1 = 9; - const int x_1008[10] = stack; - const int tint_symbol_68[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_68; - stack = x_1008; - const float2 x_556 = float2(float3(1.0f, 2.0f, 3.0f).y, float3(1.0f, 2.0f, 3.0f).y); - const int x_1009 = param_5; - param_5 = 0; - param_5 = x_1009; - top = -1; - const int x_1010 = p; - p = 0; - p = x_1010; - const int x_93 = top; - const float2 x_557 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).x); - const int x_1011 = p; - p = 0; - p = x_1011; - const int x_94 = (x_93 + asint(1u)); - const int x_1012 = top; - top = 0; - top = x_1012; - const float2 x_558 = float2(x_556.y, x_557.y); - const int x_1013 = param_4; - param_4 = 0; - param_4 = x_1013; - top = x_94; - const int x_1014 = h_1; - h_1 = 0; - h_1 = x_1014; - const float3 x_559 = float3(x_557.y, x_557.x, x_557.x); - const int x_1015 = param_4; - param_4 = 0; - param_4 = x_1015; - const int x_95 = l_1; - const QuicksortObject x_1016 = obj; - const int tint_symbol_69[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_70 = {tint_symbol_69}; - obj = tint_symbol_70; - obj = x_1016; - const float3 x_560 = float3(x_559.y, x_559.x, x_557.x); - const int x_96_save = x_94; - const int x_1017[10] = stack; - const int tint_symbol_71[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_71; - stack = x_1017; - const float3 x_561 = float3(x_556.y, x_556.y, x_556.y); - const int x_1018 = l_1; - l_1 = 0; - l_1 = 0; - stack[x_96_save] = x_95; - const int x_1019 = param_5; - param_5 = 0; - param_5 = x_1019; - const int x_97 = top; - const int x_1020 = param_4; - param_4 = 0; - param_4 = x_1020; - const float3 x_562 = float3(float3(1.0f, 2.0f, 3.0f).z, x_558.y, float3(1.0f, 2.0f, 3.0f).y); - const int x_1021 = stack[x_96_save]; - stack[x_96_save] = 0; - stack[x_96_save] = x_1021; - const int x_98 = (x_97 + 1); - const int x_1022 = stack[x_96_save]; - stack[x_96_save] = 0; - stack[x_96_save] = x_1022; - const float3 x_563 = float3(x_559.x, x_559.z, x_556.y); - top = x_98; - const int x_1023 = param_4; - param_4 = 0; - param_4 = x_1023; - const int x_99 = h_1; - const int x_1024 = param_4; - param_4 = 0; - param_4 = x_1024; - const float3 x_564 = float3(x_558.x, x_561.x, x_558.y); - const int x_1025 = l_1; - l_1 = 0; - l_1 = x_1025; - const int x_100_save = x_98; - const int x_1026 = param_5; - param_5 = 0; - param_5 = x_1026; - const float2 x_565 = float2(x_564.z, x_564.z); - const int x_1027 = p; - p = 0; - p = x_1027; - stack[x_100_save] = x_99; - [loop] while (true) { - const float3 x_566 = float3(x_563.x, x_563.x, x_563.x); - const int x_1028 = h_1; - h_1 = 0; - h_1 = x_1028; - const int x_1029[10] = stack; - const int tint_symbol_72[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_72; - stack = x_1029; - const int x_106 = top; - const int x_1030[10] = stack; - const int tint_symbol_73[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_73; - stack = x_1030; - const float2 x_567 = float2(x_558.x, x_564.z); - const int x_1031 = param_4; - param_4 = 0; - param_4 = x_1031; - if ((x_106 >= asint(0u))) { - } else { - break; - } - const QuicksortObject x_1032 = obj; - const int tint_symbol_74[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_75 = {tint_symbol_74}; - obj = tint_symbol_75; - obj = x_1032; - const float3 x_568 = float3(x_559.y, x_559.x, x_563.y); - const int x_1033 = param_4; - param_4 = 0; - param_4 = x_1033; - const int x_108 = top; - const float3 x_569 = float3(x_565.x, x_567.y, x_565.x); - const int x_1034 = h_1; - h_1 = 0; - h_1 = x_1034; - const float2 x_570 = float2(x_556.x, x_556.x); - const int x_1035 = p; - p = 0; - p = x_1035; - top = (x_108 - asint(1u)); - const int x_1036 = p; - p = 0; - p = x_1036; - const int x_110_save = x_108; - const int x_1037 = stack[x_96_save]; - stack[x_96_save] = 0; - stack[x_96_save] = x_1037; - const int x_111 = stack[x_110_save]; - const int x_1038[10] = stack; - const int tint_symbol_76[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_76; - stack = x_1038; - const float3 x_571 = float3(x_559.y, x_559.x, x_564.y); - const int x_1039 = l_1; - l_1 = 0; - l_1 = x_1039; - h_1 = x_111; - const int x_1040[10] = stack; - const int tint_symbol_77[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_77; - stack = x_1040; - const float2 x_572 = float2(x_562.y, x_561.y); - const int x_1041 = p; - p = 0; - p = x_1041; - const int x_112 = top; - const int x_1042 = param_4; - param_4 = 0; - param_4 = x_1042; - const int x_1043 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1043; - const float2 x_573 = float2(float3(1.0f, 2.0f, 3.0f).y, float3(1.0f, 2.0f, 3.0f).z); - top = (x_112 - 1); - const int x_1044 = param_5; - param_5 = 0; - param_5 = x_1044; - const float3 x_574 = float3(x_570.y, x_565.x, x_570.y); - const int x_1045 = h_1; - h_1 = 0; - h_1 = x_1045; - const int x_114_save = x_112; - const float2 x_575 = float2(x_564.y, x_564.z); - const int x_1046 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1046; - const int x_115 = stack[x_114_save]; - const int x_1047 = p; - p = 0; - p = x_1047; - const float3 x_576 = float3(x_573.y, x_573.y, x_565.x); - const int x_1048 = param_5; - param_5 = 0; - param_5 = x_1048; - l_1 = x_115; - const int x_1049 = top; - top = 0; - top = x_1049; - param_4 = l_1; - const int x_1050 = stack[x_110_save]; - stack[x_110_save] = 0; - stack[x_110_save] = x_1050; - const float2 x_577 = float2(x_569.y, x_569.z); - const int x_120 = h_1; - const float2 x_578 = float2(x_558.x, float3(1.0f, 2.0f, 3.0f).y); - param_5 = x_120; - const int x_1051 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1051; - const int x_121 = performPartition_i1_i1_(param_4, param_5); - const float2 x_579 = float2(x_567.x, x_568.x); - const int x_1052 = param_5; - param_5 = 0; - param_5 = x_1052; - p = x_121; - const int x_1053 = param_4; - param_4 = 0; - param_4 = x_1053; - const int x_122 = p; - const int x_1054 = h_1; - h_1 = 0; - h_1 = x_1054; - const float2 x_580 = float2(x_568.y, x_568.y); - const int x_1055 = l_1; - l_1 = 0; - l_1 = x_1055; - const int x_1056 = h_1; - h_1 = 0; - h_1 = x_1056; - const int x_124 = l_1; - const int x_1057 = stack[x_110_save]; - stack[x_110_save] = 0; - stack[x_110_save] = x_1057; - const int x_1058 = h_1; - h_1 = 0; - h_1 = x_1058; - const float2 x_582 = float2(x_567.y, x_573.x); - const int x_1059 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1059; - if (((x_122 - asint(1u)) > x_124)) { - const int x_1060 = param_4; - param_4 = 0; - param_4 = x_1060; - const int x_128 = top; - const float2 x_583 = float2(x_571.y, x_556.y); - const int x_1061 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1061; - const int x_1062[10] = stack; - const int tint_symbol_78[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_78; - stack = x_1062; - const float2 x_584 = float2(x_569.z, x_569.y); - const float3 x_585 = float3(x_580.y, x_577.x, x_577.x); - const int x_130 = l_1; - const int x_1063 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1063; - const float2 x_586 = float2(x_564.x, x_585.x); - const int x_1064 = param_5; - param_5 = 0; - param_5 = x_1064; - const int x_131_save = (1 + x_128); - const int x_1065 = stack[x_110_save]; - stack[x_110_save] = 0; - stack[x_110_save] = x_1065; - const float3 x_587 = float3(x_566.y, x_566.y, x_563.x); - const int x_1066 = param_5; - param_5 = 0; - param_5 = x_1066; - stack[x_131_save] = x_130; - const int x_132 = top; - const int x_1067 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1067; - const float2 x_588 = float2(x_575.y, x_575.x); - const int x_1068 = stack[x_131_save]; - stack[x_131_save] = 0; - stack[x_131_save] = x_1068; - const int x_133 = asint((1u + asuint(x_132))); - const int x_1069 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1069; - const float3 x_589 = float3(x_576.z, x_588.y, x_576.z); - const int x_1070 = h_1; - h_1 = 0; - h_1 = x_1070; - top = x_133; - const int x_1071[10] = stack; - const int tint_symbol_79[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_79; - stack = x_1071; - const int x_134 = p; - const float2 x_590 = float2(x_576.x, x_573.y); - const int x_1072 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1072; - const int x_136_save = x_133; - const int x_1073 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1073; - stack[x_136_save] = (x_134 - asint(1u)); - const int x_1074 = stack[x_96_save]; - stack[x_96_save] = 0; - stack[x_96_save] = x_1074; - const float2 x_591 = float2(x_569.z, x_569.y); - const int x_1075 = stack[x_136_save]; - stack[x_136_save] = 0; - stack[x_136_save] = x_1075; - } - const int x_1076 = stack[x_96_save]; - stack[x_96_save] = 0; - stack[x_96_save] = x_1076; - const float2 x_592 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).y); - const QuicksortObject x_1077 = obj; - const int tint_symbol_80[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_81 = {tint_symbol_80}; - obj = tint_symbol_81; - obj = x_1077; - const int x_137 = p; - const int x_1078 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1078; - const float3 x_593 = float3(x_571.z, x_556.x, x_556.y); - const int x_1079 = p; - p = 0; - p = x_1079; - const float3 x_594 = float3(x_563.z, x_563.x, x_575.x); - const int x_1080 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1080; - const int x_139 = h_1; - const int x_1081 = top; - top = 0; - top = x_1081; - const float3 x_595 = float3(x_560.z, x_568.x, x_560.x); - const int x_1082 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1082; - const int x_1083 = p; - p = 0; - p = x_1083; - if ((asint((1u + asuint(x_137))) < x_139)) { - const int x_1084 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1084; - const float2 x_596 = float2(x_592.y, x_582.x); - const int x_1085 = l_1; - l_1 = 0; - l_1 = x_1085; - const int x_143 = top; - const int x_1086 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1086; - const float3 x_597 = float3(x_562.y, x_560.y, x_560.y); - const int x_144 = (x_143 + 1); - const int x_1087 = param_5; - param_5 = 0; - param_5 = x_1087; - top = x_144; - const int x_1088 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1088; - const int x_145 = p; - const int x_1089 = param_5; - param_5 = 0; - param_5 = x_1089; - const float3 x_599 = float3(x_560.z, x_560.x, x_568.x); - const int x_1090 = p; - p = 0; - p = x_1090; - const float3 x_600 = float3(x_556.x, x_580.x, x_580.x); - const int x_1091 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1091; - const int x_147_save = x_144; - const int x_1092 = stack[x_110_save]; - stack[x_110_save] = 0; - stack[x_110_save] = x_1092; - const float2 x_601 = float2(x_563.x, x_563.y); - stack[x_147_save] = asint((1u + asuint(x_145))); - const int x_1093[10] = stack; - const int tint_symbol_82[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_82; - stack = x_1093; - const int x_148 = top; - const int x_1094 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1094; - const float2 x_602 = float2(x_565.y, x_599.y); - const int x_1095[10] = stack; - const int tint_symbol_83[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - stack = tint_symbol_83; - stack = x_1095; - const int x_149 = (x_148 + asint(1u)); - const int x_1096 = stack[x_147_save]; - stack[x_147_save] = 0; - stack[x_147_save] = x_1096; - top = x_149; - const int x_1097 = param_4; - param_4 = 0; - param_4 = x_1097; - const int x_150 = h_1; - const int x_1098 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1098; - const int x_1099 = stack[x_96_save]; - stack[x_96_save] = 0; - stack[x_96_save] = x_1099; - stack[x_149] = x_150; - const int x_1100 = stack[x_114_save]; - stack[x_114_save] = 0; - stack[x_114_save] = x_1100; - const float3 x_603 = float3(x_568.y, x_564.x, x_564.x); - const int x_1101 = l_1; - l_1 = 0; - l_1 = x_1101; - } - const int x_1102 = stack[x_100_save]; - stack[x_100_save] = 0; - stack[x_100_save] = x_1102; - { - const int x_1103 = l_1; - l_1 = 0; - l_1 = x_1103; - const float2 x_604 = float2(x_563.z, x_564.x); - const QuicksortObject x_1104 = obj; - const int tint_symbol_84[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_85 = {tint_symbol_84}; - obj = tint_symbol_85; - obj = x_1104; - } - } - const int x_1105 = h_1; - h_1 = 0; - h_1 = x_1105; - return; -} - -void main_1() { - float3 color = float3(0.0f, 0.0f, 0.0f); - int i_2 = 0; - float2 uv = float2(0.0f, 0.0f); - const float2 x_717 = uv; - uv = float2(0.0f, 0.0f); - uv = x_717; - i_2 = 0; - const QuicksortObject x_721 = obj; - const int tint_symbol_86[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_87 = {tint_symbol_86}; - obj = tint_symbol_87; - obj = x_721; - if (true) { - const QuicksortObject x_722 = obj; - const int tint_symbol_88[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_89 = {tint_symbol_88}; - obj = tint_symbol_89; - obj = x_722; - const float2 x_431 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).x); - const int x_158 = i_2; - const float2 x_723 = uv; - uv = float2(0.0f, 0.0f); - uv = x_723; - const float3 x_725 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_725; - const float2 x_432 = float2(x_431.y, x_431.y); - const QuicksortObject x_726 = obj; - const int tint_symbol_90[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_91 = {tint_symbol_90}; - obj = tint_symbol_91; - obj = x_726; - } - const QuicksortObject x_756 = obj; - const int tint_symbol_92[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_93 = {tint_symbol_92}; - obj = tint_symbol_93; - obj = x_756; - const float2 x_446 = float2(float2(0.0f, 0.0f).x, float2(0.0f, 0.0f).x); - const int x_757 = i_2; - i_2 = 0; - i_2 = x_757; - quicksort_(); - const QuicksortObject x_758 = obj; - const int tint_symbol_94[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_95 = {tint_symbol_94}; - obj = tint_symbol_95; - obj = x_758; - const float4 x_184 = gl_FragCoord; - const float2 x_759 = uv; - uv = float2(0.0f, 0.0f); - uv = x_759; - const float2 x_447 = float2(float2(0.0f, 0.0f).y, float2(0.0f, 0.0f).y); - const float2 x_760 = uv; - uv = float2(0.0f, 0.0f); - uv = x_760; - const float2 x_185 = float2(x_184.x, x_184.y); - const float3 x_448 = float3(x_185.y, x_446.y, x_446.y); - const QuicksortObject x_761 = obj; - const int tint_symbol_96[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_97 = {tint_symbol_96}; - obj = tint_symbol_97; - obj = x_761; - const float2 x_762 = uv; - uv = float2(0.0f, 0.0f); - uv = x_762; - const float2 x_191 = asfloat(x_188[0].xy); - const QuicksortObject x_763 = obj; - const int tint_symbol_98[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_99 = {tint_symbol_98}; - obj = tint_symbol_99; - obj = x_763; - const float3 x_449 = float3(x_184.y, float3(1.0f, 2.0f, 3.0f).z, x_184.w); - const float3 x_764 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_764; - const float2 x_192 = (x_185 / x_191); - const QuicksortObject x_765 = obj; - const int tint_symbol_100[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_101 = {tint_symbol_100}; - obj = tint_symbol_101; - obj = x_765; - const float2 x_450 = float2(x_447.x, x_185.y); - const float3 x_766 = color; - color = float3(0.0f, 0.0f, 0.0f); - const float3 x_767 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_767; - color = x_766; - uv = x_192; - color = float3(1.0f, 2.0f, 3.0f); - const float3 x_768 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_768; - const float3 x_451 = float3(x_185.x, x_185.y, x_446.y); - const QuicksortObject x_769 = obj; - const int tint_symbol_102[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_103 = {tint_symbol_102}; - obj = tint_symbol_103; - obj = x_769; - const int x_770 = obj.numbers[0u]; - obj.numbers[0u] = 0; - obj.numbers[0u] = x_770; - const int x_201 = obj.numbers[0u]; - const QuicksortObject x_771 = obj; - const int tint_symbol_104[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_105 = {tint_symbol_104}; - obj = tint_symbol_105; - obj = x_771; - const int x_772 = obj.numbers[0u]; - obj.numbers[0u] = 0; - obj.numbers[0u] = x_772; - const float x_206 = color.x; - const float x_773 = color.x; - color.x = 0.0f; - color.x = x_773; - const float2 x_452 = float2(float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y); - const int x_774 = i_2; - i_2 = 0; - i_2 = x_774; - const QuicksortObject x_775 = obj; - const int tint_symbol_106[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_107 = {tint_symbol_106}; - obj = tint_symbol_107; - obj = x_775; - const float3 x_453 = float3(x_451.x, x_450.x, x_450.y); - color.x = (x_206 + float(x_201)); - const float2 x_776 = uv; - uv = float2(0.0f, 0.0f); - uv = x_776; - const float2 x_777 = uv; - uv = float2(0.0f, 0.0f); - uv = x_777; - const float2 x_454 = float2(x_184.y, x_184.y); - const float x_210 = uv.x; - const float2 x_455 = float2(x_192.y, x_192.x); - const float x_778 = uv.x; - uv.x = 0.0f; - uv.x = x_778; - const QuicksortObject x_779 = obj; - const int tint_symbol_108[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_109 = {tint_symbol_108}; - obj = tint_symbol_109; - obj = x_779; - if ((x_210 > 0.25f)) { - const int x_780 = i_2; - i_2 = 0; - i_2 = x_780; - const int x_781 = obj.numbers[0u]; - obj.numbers[0u] = 0; - obj.numbers[0u] = x_781; - const float3 x_456 = float3(float2(0.0f, 0.0f).y, x_448.y, x_448.y); - const float x_782 = uv.x; - uv.x = 0.0f; - uv.x = x_782; - const int x_216 = obj.numbers[1]; - const QuicksortObject x_783 = obj; - const int tint_symbol_110[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_111 = {tint_symbol_110}; - obj = tint_symbol_111; - obj = x_783; - const float2 x_457 = float2(x_454.x, x_454.x); - const float2 x_784 = uv; - uv = float2(0.0f, 0.0f); - uv = x_784; - const QuicksortObject x_785 = obj; - const int tint_symbol_112[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_113 = {tint_symbol_112}; - obj = tint_symbol_113; - obj = x_785; - const float2 x_458 = float2(float3(1.0f, 2.0f, 3.0f).z, float2(0.0f, 0.0f).y); - const int x_786 = i_2; - i_2 = 0; - i_2 = x_786; - const float x_219 = color[0]; - const float x_787 = color[0]; - color[0] = 0.0f; - color[0] = x_787; - const float3 x_788 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_788; - const float3 x_789 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_789; - const float3 x_459 = float3(x_454.y, x_454.y, x_447.y); - const float x_790 = color[0]; - color[0] = 0.0f; - color[0] = x_790; - color.x = (float(x_216) + x_219); - const int x_791 = obj.numbers[0u]; - obj.numbers[0u] = 0; - obj.numbers[0u] = x_791; - } - const float x_792 = uv.x; - uv.x = 0.0f; - uv.x = x_792; - const float x_793 = uv.x; - uv.x = 0.0f; - uv.x = x_793; - const float x_223 = uv.x; - const float x_794 = uv.x; - uv.x = 0.0f; - uv.x = x_794; - const float3 x_460 = float3(x_453.z, x_453.y, x_453.y); - const float2 x_795 = uv; - uv = float2(0.0f, 0.0f); - uv = x_795; - const float x_796 = uv.x; - uv.x = 0.0f; - uv.x = x_796; - const float2 x_461 = float2(float2(0.0f, 0.0f).y, float2(0.0f, 0.0f).y); - const float x_797 = uv.x; - uv.x = 0.0f; - uv.x = x_797; - if ((x_223 > 0.5f)) { - const float x_798 = uv.x; - uv.x = 0.0f; - uv.x = x_798; - const float2 x_462 = float2(x_446.x, x_446.x); - const float x_799 = color.x; - color.x = 0.0f; - color.x = x_799; - const float x_800 = color.x; - color.x = 0.0f; - color.x = x_800; - const float3 x_463 = float3(x_453.x, x_453.z, x_461.y); - const float x_801 = color.x; - color.x = 0.0f; - color.x = x_801; - const int x_230 = obj.numbers[2u]; - const float x_802 = uv.x; - uv.x = 0.0f; - uv.x = x_802; - const float x_803 = color.x; - color.x = 0.0f; - color.x = x_803; - const int x_804 = obj.numbers[2u]; - obj.numbers[2u] = 0; - obj.numbers[2u] = x_804; - const float2 x_464 = float2(x_450.y, x_191.x); - const float x_805 = color.y; - color.y = 0.0f; - color.y = x_805; - const float x_234 = color.y; - const int x_806 = obj.numbers[2u]; - obj.numbers[2u] = 0; - obj.numbers[2u] = x_806; - const float2 x_465 = float2(x_463.x, x_185.x); - const float x_807 = color.x; - color.x = 0.0f; - color.x = x_807; - const int x_808 = i_2; - i_2 = 0; - i_2 = x_808; - const float2 x_466 = float2(x_455.y, float2(0.0f, 0.0f).y); - const int x_809 = i_2; - i_2 = 0; - i_2 = x_809; - color.y = (float(x_230) + x_234); - const float x_810 = uv.x; - uv.x = 0.0f; - uv.x = x_810; - } - const int x_811 = i_2; - i_2 = 0; - i_2 = x_811; - const float2 x_467 = float2(x_191.x, x_191.x); - const float x_812 = uv.x; - uv.x = 0.0f; - uv.x = x_812; - const float x_238 = uv[0]; - const float3 x_813 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_813; - const float x_814 = color.x; - color.x = 0.0f; - color.x = x_814; - if ((x_238 > 0.75f)) { - const float x_815 = color.x; - color.x = 0.0f; - color.x = x_815; - const int x_245 = obj.numbers[3]; - const float x_816 = color.x; - color.x = 0.0f; - color.x = x_816; - const QuicksortObject x_817 = obj; - const int tint_symbol_114[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_115 = {tint_symbol_114}; - obj = tint_symbol_115; - obj = x_817; - const float3 x_468 = float3(x_467.x, x_467.x, x_467.x); - const float x_818 = uv[0]; - uv[0] = 0.0f; - uv[0] = x_818; - const float x_819 = uv.x; - uv.x = 0.0f; - uv.x = x_819; - const float x_249 = color.z; - const float3 x_820 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_820; - const float3 x_469 = float3(x_467.x, x_191.y, x_467.y); - const float x_821 = color.z; - color.z = 0.0f; - color.z = x_821; - const int x_822 = obj.numbers[0u]; - obj.numbers[0u] = 0; - obj.numbers[0u] = x_822; - const float2 x_470 = float2(float2(0.0f, 0.0f).x, float2(0.0f, 0.0f).y); - const float x_823 = color.z; - color.z = 0.0f; - color.z = x_823; - color.z = (x_249 + float(x_245)); - const float2 x_824 = uv; - uv = float2(0.0f, 0.0f); - uv = x_824; - const float2 x_471 = float2(x_470.y, x_470.y); - } - const float x_825 = uv[0]; - uv[0] = 0.0f; - uv[0] = x_825; - const float3 x_472 = float3(x_454.x, x_454.y, x_454.y); - const int x_254 = obj.numbers[4]; - const float x_826 = uv[0]; - uv[0] = 0.0f; - uv[0] = x_826; - const float3 x_827 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_827; - const float3 x_473 = float3(x_446.y, x_453.x, x_453.x); - const int x_828 = obj.numbers[4]; - obj.numbers[4] = 0; - obj.numbers[4] = x_828; - const float2 x_474 = float2(x_191.x, x_184.z); - const float x_829 = uv.x; - uv.x = 0.0f; - uv.x = x_829; - const float x_257 = color.y; - const float x_830 = color.y; - color.y = 0.0f; - color.y = x_830; - const float2 x_475 = float2(x_467.x, x_450.x); - const float x_831 = uv.x; - uv.x = 0.0f; - uv.x = x_831; - const float x_832 = color.x; - color.x = 0.0f; - color.x = x_832; - const float2 x_476 = float2(x_451.z, x_460.y); - color.y = (x_257 + float(x_254)); - const float3 x_477 = float3(float2(0.0f, 0.0f).x, x_472.x, float2(0.0f, 0.0f).y); - const float x_833 = uv.x; - uv.x = 0.0f; - uv.x = x_833; - const float x_834 = color.x; - color.x = 0.0f; - color.x = x_834; - const float2 x_478 = float2(x_472.x, x_472.y); - const float x_835 = uv.y; - uv.y = 0.0f; - uv.y = x_835; - const float x_261 = uv.y; - const int x_836 = i_2; - i_2 = 0; - i_2 = x_836; - const float3 x_479 = float3(float2(0.0f, 0.0f).y, x_454.y, float2(0.0f, 0.0f).x); - const int x_837 = obj.numbers[0u]; - obj.numbers[0u] = 0; - obj.numbers[0u] = x_837; - const float x_838 = color.y; - color.y = 0.0f; - color.y = x_838; - const float3 x_480 = float3(x_446.x, x_446.x, float2(0.0f, 0.0f).y); - const float x_839 = uv.x; - uv.x = 0.0f; - uv.x = x_839; - if ((x_261 > 0.25f)) { - const float2 x_481 = float2(x_447.x, x_480.z); - const float3 x_840 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_840; - const int x_267 = obj.numbers[5u]; - const float x_841 = color.x; - color.x = 0.0f; - color.x = x_841; - const int x_842 = i_2; - i_2 = 0; - i_2 = x_842; - const int x_843 = i_2; - i_2 = 0; - i_2 = x_843; - const float x_270 = color.x; - const float x_844 = uv[0]; - uv[0] = 0.0f; - uv[0] = x_844; - const float3 x_482 = float3(x_455.x, x_475.y, x_455.y); - const QuicksortObject x_845 = obj; - const int tint_symbol_116[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_117 = {tint_symbol_116}; - obj = tint_symbol_117; - obj = x_845; - const float x_846 = uv.y; - uv.y = 0.0f; - uv.y = x_846; - const int x_847 = i_2; - i_2 = 0; - i_2 = x_847; - const float3 x_483 = float3(x_184.w, x_184.w, x_192.x); - const float x_848 = uv.x; - uv.x = 0.0f; - uv.x = x_848; - color.x = (float(x_267) + x_270); - const float3 x_484 = float3(x_454.y, x_450.x, x_454.y); - const float x_849 = uv.x; - uv.x = 0.0f; - uv.x = x_849; - } - const float x_850 = color.x; - color.x = 0.0f; - color.x = x_850; - const float3 x_485 = float3(x_467.x, x_450.y, x_450.x); - const float x_851 = uv.y; - uv.y = 0.0f; - uv.y = x_851; - const int x_852 = obj.numbers[4]; - obj.numbers[4] = 0; - obj.numbers[4] = x_852; - const float x_274 = uv.y; - const int x_853 = obj.numbers[0u]; - obj.numbers[0u] = 0; - obj.numbers[0u] = x_853; - if ((x_274 > 0.5f)) { - const float x_854 = uv.x; - uv.x = 0.0f; - uv.x = x_854; - const float2 x_486 = float2(x_480.y, x_455.y); - const float x_855 = color.y; - color.y = 0.0f; - color.y = x_855; - const float2 x_487 = float2(x_449.z, x_449.y); - const float x_856 = uv.y; - uv.y = 0.0f; - uv.y = x_856; - const int x_280 = obj.numbers[6u]; - const float x_857 = uv.y; - uv.y = 0.0f; - uv.y = x_857; - const int x_858 = i_2; - i_2 = 0; - i_2 = x_858; - const int x_859 = obj.numbers[4]; - obj.numbers[4] = 0; - obj.numbers[4] = x_859; - const float2 x_488 = float2(x_473.z, x_473.y); - const float x_283 = color.y; - const float2 x_860 = uv; - uv = float2(0.0f, 0.0f); - uv = x_860; - const float x_861 = color.x; - color.x = 0.0f; - color.x = x_861; - const float2 x_489 = float2(x_475.y, x_475.x); - const int x_862 = obj.numbers[6u]; - obj.numbers[6u] = 0; - obj.numbers[6u] = x_862; - const int x_863 = obj.numbers[6u]; - obj.numbers[6u] = 0; - obj.numbers[6u] = x_863; - const float2 x_490 = float2(x_480.z, x_480.z); - const QuicksortObject x_864 = obj; - const int tint_symbol_118[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_119 = {tint_symbol_118}; - obj = tint_symbol_119; - obj = x_864; - color.y = (float(x_280) + x_283); - const float x_865 = color.x; - color.x = 0.0f; - color.x = x_865; - const float2 x_491 = float2(float3(1.0f, 2.0f, 3.0f).y, x_454.x); - const float x_866 = color.y; - color.y = 0.0f; - color.y = x_866; - } - const float2 x_492 = float2(x_455.y, x_455.y); - const float x_867 = color.x; - color.x = 0.0f; - color.x = x_867; - const float x_287 = uv.y; - const QuicksortObject x_868 = obj; - const int tint_symbol_120[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_121 = {tint_symbol_120}; - obj = tint_symbol_121; - obj = x_868; - const float2 x_493 = float2(x_475.x, x_475.y); - const float x_869 = uv[0]; - uv[0] = 0.0f; - uv[0] = x_869; - const float x_870 = color.y; - color.y = 0.0f; - color.y = x_870; - const float3 x_494 = float3(x_191.x, x_191.y, x_191.y); - const int x_871 = obj.numbers[4]; - obj.numbers[4] = 0; - obj.numbers[4] = x_871; - if ((x_287 > 0.75f)) { - const float3 x_872 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_872; - const float x_873 = color.x; - color.x = 0.0f; - color.x = x_873; - const float3 x_495 = float3(x_192.y, x_192.x, x_192.y); - const float3 x_874 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_874; - const int x_293 = obj.numbers[7]; - const float x_875 = uv.x; - uv.x = 0.0f; - uv.x = x_875; - const float3 x_496 = float3(x_475.x, x_467.y, x_467.x); - const float x_876 = color.y; - color.y = 0.0f; - color.y = x_876; - const float2 x_497 = float2(x_477.x, x_461.y); - const int x_877 = obj.numbers[0u]; - obj.numbers[0u] = 0; - obj.numbers[0u] = x_877; - const float x_878 = color.y; - color.y = 0.0f; - color.y = x_878; - const float3 x_498 = float3(x_478.x, x_478.y, x_478.x); - const float x_879 = color.x; - color.x = 0.0f; - color.x = x_879; - const float x_296 = color.z; - const float x_880 = uv.y; - uv.y = 0.0f; - uv.y = x_880; - const float2 x_499 = float2(x_184.x, x_184.y); - const float x_881 = uv.x; - uv.x = 0.0f; - uv.x = x_881; - const float x_882 = uv.y; - uv.y = 0.0f; - uv.y = x_882; - const float x_883 = uv.y; - uv.y = 0.0f; - uv.y = x_883; - const float3 x_500 = float3(x_499.y, x_499.y, x_494.z); - const float x_884 = color.z; - color.z = 0.0f; - color.z = x_884; - color.z = (float(x_293) + x_296); - const float x_885 = color.y; - color.y = 0.0f; - color.y = x_885; - const float2 x_501 = float2(x_453.x, x_453.z); - const float x_886 = color.x; - color.x = 0.0f; - color.x = x_886; - } - const int x_887 = i_2; - i_2 = 0; - i_2 = x_887; - const float2 x_502 = float2(x_451.y, x_192.y); - const float2 x_888 = uv; - uv = float2(0.0f, 0.0f); - uv = x_888; - const int x_301 = obj.numbers[8]; - const int x_889 = i_2; - i_2 = 0; - i_2 = x_889; - const float2 x_503 = float2(x_185.x, x_451.z); - const int x_890 = obj.numbers[8]; - obj.numbers[8] = 0; - obj.numbers[8] = x_890; - const float x_891 = color.y; - color.y = 0.0f; - color.y = x_891; - const float2 x_504 = float2(x_453.y, float2(0.0f, 0.0f).x); - const float x_892 = color.x; - color.x = 0.0f; - color.x = x_892; - const float3 x_505 = float3(x_504.x, x_504.y, x_504.x); - const float x_893 = color.z; - color.z = 0.0f; - color.z = x_893; - const float x_304 = color.z; - const float x_894 = color.x; - color.x = 0.0f; - color.x = x_894; - const float2 x_506 = float2(x_493.x, x_492.x); - const int x_895 = obj.numbers[4]; - obj.numbers[4] = 0; - obj.numbers[4] = x_895; - const float x_896 = uv.y; - uv.y = 0.0f; - uv.y = x_896; - const float2 x_507 = float2(x_461.x, x_447.x); - const float x_897 = color.y; - color.y = 0.0f; - color.y = x_897; - color.z = (x_304 + float(x_301)); - const float2 x_898 = uv; - uv = float2(0.0f, 0.0f); - uv = x_898; - const float x_899 = uv.x; - uv.x = 0.0f; - uv.x = x_899; - const float3 x_508 = float3(x_461.y, x_461.x, x_506.y); - const float x_900 = uv.x; - uv.x = 0.0f; - uv.x = x_900; - const float x_308 = uv.x; - const float x_901 = color.y; - color.y = 0.0f; - color.y = x_901; - const float3 x_509 = float3(x_503.y, x_503.x, x_448.z); - const float x_902 = uv.y; - uv.y = 0.0f; - uv.y = x_902; - const float x_310 = uv.y; - const float x_903 = uv.y; - uv.y = 0.0f; - uv.y = x_903; - const float x_904 = color.z; - color.z = 0.0f; - color.z = x_904; - const float3 x_510 = float3(float3(1.0f, 2.0f, 3.0f).y, x_485.y, x_485.z); - const float x_905 = color.z; - color.z = 0.0f; - color.z = x_905; - const int x_906 = i_2; - i_2 = 0; - i_2 = x_906; - const float2 x_511 = float2(x_485.z, x_485.y); - const float3 x_907 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_907; - const float x_908 = uv.y; - uv.y = 0.0f; - uv.y = x_908; - const float3 x_512 = float3(x_455.y, x_455.y, x_455.y); - const int x_909 = obj.numbers[4]; - obj.numbers[4] = 0; - obj.numbers[4] = x_909; - if ((abs((x_308 - x_310)) < 0.25f)) { - const float x_910 = uv.x; - uv.x = 0.0f; - uv.x = x_910; - const QuicksortObject x_911 = obj; - const int tint_symbol_122[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_123 = {tint_symbol_122}; - obj = tint_symbol_123; - obj = x_911; - const float3 x_513 = float3(x_505.z, x_505.x, x_448.x); - const int x_912 = obj.numbers[8]; - obj.numbers[8] = 0; - obj.numbers[8] = x_912; - const int x_317 = obj.numbers[9u]; - const float3 x_514 = float3(x_474.y, x_474.y, x_474.y); - const float x_913 = uv.y; - uv.y = 0.0f; - uv.y = x_913; - const float x_320 = color.x; - const float x_914 = uv.y; - uv.y = 0.0f; - uv.y = x_914; - const float2 x_515 = float2(x_502.x, x_502.y); - const float x_915 = color.x; - color.x = 0.0f; - color.x = x_915; - const float3 x_916 = color; - color = float3(0.0f, 0.0f, 0.0f); - color = x_916; - const float2 x_516 = float2(x_452.x, x_452.x); - const float2 x_917 = uv; - uv = float2(0.0f, 0.0f); - uv = x_917; - const float x_918 = uv.x; - uv.x = 0.0f; - uv.x = x_918; - const float3 x_517 = float3(float2(0.0f, 0.0f).x, float2(0.0f, 0.0f).x, float2(0.0f, 0.0f).y); - color.x = (float(x_317) + x_320); - const float x_919 = color.x; - color.x = 0.0f; - color.x = x_919; - const float3 x_518 = float3(x_480.y, x_508.x, x_480.x); - const float x_920 = color.x; - color.x = 0.0f; - color.x = x_920; - } - const float x_921 = uv.y; - uv.y = 0.0f; - uv.y = x_921; - const float3 x_325 = color; - const float x_922 = uv[0]; - uv[0] = 0.0f; - uv[0] = x_922; - const float3 x_519 = float3(x_447.x, x_446.x, x_446.y); - const float3 x_326 = normalize(x_325); - const float x_923 = uv.x; - uv.x = 0.0f; - uv.x = x_923; - const QuicksortObject x_924 = obj; - const int tint_symbol_124[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_125 = {tint_symbol_124}; - obj = tint_symbol_125; - obj = x_924; - const QuicksortObject x_925 = obj; - const int tint_symbol_126[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_127 = {tint_symbol_126}; - obj = tint_symbol_127; - obj = x_925; - const float x_926 = color.y; - color.y = 0.0f; - color.y = x_926; - const float2 x_520 = float2(x_506.y, x_519.y); - const float x_927 = color.y; - color.y = 0.0f; - color.y = x_927; - const float4 x_330 = float4(x_326.x, x_326.y, x_326.z, 1.0f); - const float x_928 = uv.y; - uv.y = 0.0f; - uv.y = x_928; - const float3 x_521 = float3(float3(1.0f, 2.0f, 3.0f).y, float3(1.0f, 2.0f, 3.0f).y, x_520.y); - const float x_929 = uv.x; - uv.x = 0.0f; - uv.x = x_929; - x_GLF_color = x_330; - const QuicksortObject x_930 = obj; - const int tint_symbol_128[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - const QuicksortObject tint_symbol_129 = {tint_symbol_128}; - obj = tint_symbol_129; - obj = x_930; - const float3 x_522 = float3(x_330.w, x_330.y, x_493.x); - const float x_931 = color.x; - color.x = 0.0f; - color.x = x_931; - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_49 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_50 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_130 = {x_GLF_color}; - return tint_symbol_130; -} - -tint_symbol_50 main(tint_symbol_49 tint_symbol_48) { - const main_out inner_result = main_inner(tint_symbol_48.gl_FragCoord_param); - tint_symbol_50 wrapper_result = (tint_symbol_50)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} diff --git a/test/tint/bug/tint/749.spvasm.expected.msl b/test/tint/bug/tint/749.spvasm.expected.msl index 1349abdcd2..119081c18e 100644 --- a/test/tint/bug/tint/749.spvasm.expected.msl +++ b/test/tint/bug/tint/749.spvasm.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[10]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct QuicksortObject { - tint_array_wrapper numbers; + tint_array numbers; }; struct buf0 { @@ -18,7 +27,7 @@ void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObjec int const x_932 = temp; temp = 0; temp = x_932; - float3 const x_523 = float3(float3(1.0f, 2.0f, 3.0f)[2], float3(1.0f, 2.0f, 3.0f)[1], float3(1.0f, 2.0f, 3.0f)[2]); + float3 const x_523 = float3(3.0f, 2.0f, 3.0f); int const x_933 = *(i); *(i) = 0; *(i) = x_933; @@ -31,10 +40,10 @@ void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObjec temp = 0; temp = x_935; int const x_30_save = x_28; - int const x_936 = (*(tint_symbol_81)).numbers.arr[x_30_save]; - (*(tint_symbol_81)).numbers.arr[x_30_save] = 0; - (*(tint_symbol_81)).numbers.arr[x_30_save] = x_936; - int const x_31 = (*(tint_symbol_81)).numbers.arr[x_30_save]; + int const x_936 = (*(tint_symbol_81)).numbers[x_30_save]; + (*(tint_symbol_81)).numbers[x_30_save] = 0; + (*(tint_symbol_81)).numbers[x_30_save] = x_936; + int const x_31 = (*(tint_symbol_81)).numbers[x_30_save]; int const x_937 = temp; temp = 0; temp = x_937; @@ -42,35 +51,35 @@ void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObjec int const x_938 = *(j); *(j) = 0; *(j) = x_938; - float3 const x_525 = float3(x_523[2], float3(1.0f, 2.0f, 3.0f)[0], x_523[1]); + float3 const x_525 = float3(x_523[2], 1.0f, x_523[1]); int const x_939 = *(i); *(i) = 0; *(i) = x_939; int const x_32 = *(i); - int const x_940 = (*(tint_symbol_81)).numbers.arr[x_30_save]; - (*(tint_symbol_81)).numbers.arr[x_30_save] = 0; - (*(tint_symbol_81)).numbers.arr[x_30_save] = x_940; + int const x_940 = (*(tint_symbol_81)).numbers[x_30_save]; + (*(tint_symbol_81)).numbers[x_30_save] = 0; + (*(tint_symbol_81)).numbers[x_30_save] = x_940; int const x_33 = *(j); int const x_941 = *(i); *(i) = 0; *(i) = x_941; float3 const x_526 = float3(x_525[0], x_525[2], x_525[2]); - int const x_942 = (*(tint_symbol_81)).numbers.arr[x_30_save]; - (*(tint_symbol_81)).numbers.arr[x_30_save] = 0; - (*(tint_symbol_81)).numbers.arr[x_30_save] = x_942; + int const x_942 = (*(tint_symbol_81)).numbers[x_30_save]; + (*(tint_symbol_81)).numbers[x_30_save] = 0; + (*(tint_symbol_81)).numbers[x_30_save] = x_942; int const x_34_save = x_33; - int const x_35 = (*(tint_symbol_81)).numbers.arr[x_34_save]; + int const x_35 = (*(tint_symbol_81)).numbers[x_34_save]; QuicksortObject const x_943 = *(tint_symbol_81); - tint_array_wrapper const tint_symbol_2 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_2 = tint_array{}; QuicksortObject const tint_symbol_3 = {.numbers=tint_symbol_2}; *(tint_symbol_81) = tint_symbol_3; *(tint_symbol_81) = x_943; float2 const x_527 = float2(x_526[0], x_526[0]); int const x_36_save = x_32; float3 const x_528 = float3(x_524[0], x_524[2], x_524[0]); - (*(tint_symbol_81)).numbers.arr[x_36_save] = x_35; + (*(tint_symbol_81)).numbers[x_36_save] = x_35; QuicksortObject const x_944 = *(tint_symbol_81); - tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_4 = tint_array{}; QuicksortObject const tint_symbol_5 = {.numbers=tint_symbol_4}; *(tint_symbol_81) = tint_symbol_5; *(tint_symbol_81) = x_944; @@ -83,27 +92,27 @@ void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObjec temp = 0; temp = x_946; float2 const x_530 = float2(x_529[2], x_529[1]); - int const x_947 = (*(tint_symbol_81)).numbers.arr[x_34_save]; - (*(tint_symbol_81)).numbers.arr[x_34_save] = 0; - (*(tint_symbol_81)).numbers.arr[x_34_save] = x_947; + int const x_947 = (*(tint_symbol_81)).numbers[x_34_save]; + (*(tint_symbol_81)).numbers[x_34_save] = 0; + (*(tint_symbol_81)).numbers[x_34_save] = x_947; int const x_38 = temp; int const x_948 = *(j); *(j) = 0; *(j) = x_948; float3 const x_531 = float3(x_527[0], x_526[1], x_526[0]); - int const x_949 = (*(tint_symbol_81)).numbers.arr[x_36_save]; - (*(tint_symbol_81)).numbers.arr[x_36_save] = 0; - (*(tint_symbol_81)).numbers.arr[x_36_save] = x_949; + int const x_949 = (*(tint_symbol_81)).numbers[x_36_save]; + (*(tint_symbol_81)).numbers[x_36_save] = 0; + (*(tint_symbol_81)).numbers[x_36_save] = x_949; QuicksortObject const x_950 = *(tint_symbol_81); - tint_array_wrapper const tint_symbol_6 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_6 = tint_array{}; QuicksortObject const tint_symbol_7 = {.numbers=tint_symbol_6}; *(tint_symbol_81) = tint_symbol_7; *(tint_symbol_81) = x_950; float3 const x_532 = float3(x_528[0], x_528[1], x_528[0]); - int const x_951 = (*(tint_symbol_81)).numbers.arr[x_34_save]; - (*(tint_symbol_81)).numbers.arr[x_34_save] = 0; - (*(tint_symbol_81)).numbers.arr[x_34_save] = x_951; - (*(tint_symbol_81)).numbers.arr[x_37] = x_38; + int const x_951 = (*(tint_symbol_81)).numbers[x_34_save]; + (*(tint_symbol_81)).numbers[x_34_save] = 0; + (*(tint_symbol_81)).numbers[x_34_save] = x_951; + (*(tint_symbol_81)).numbers[x_37] = x_38; return; } @@ -125,14 +134,14 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui *(l) = 0; *(l) = x_953; int const x_42_save = x_41; - int const x_954 = (*(tint_symbol_82)).numbers.arr[x_42_save]; - (*(tint_symbol_82)).numbers.arr[x_42_save] = 0; - (*(tint_symbol_82)).numbers.arr[x_42_save] = x_954; - int const x_43 = (*(tint_symbol_82)).numbers.arr[x_42_save]; + int const x_954 = (*(tint_symbol_82)).numbers[x_42_save]; + (*(tint_symbol_82)).numbers[x_42_save] = 0; + (*(tint_symbol_82)).numbers[x_42_save] = x_954; + int const x_43 = (*(tint_symbol_82)).numbers[x_42_save]; int const x_955 = param_3; param_3 = 0; param_3 = x_955; - float3 const x_534 = float3(float3(1.0f, 2.0f, 3.0f)[2], float3(1.0f, 2.0f, 3.0f)[0], float3(1.0f, 2.0f, 3.0f)[2]); + float3 const x_534 = float3(3.0f, 1.0f, 3.0f); int const x_956 = param_1; param_1 = 0; param_1 = x_956; @@ -153,7 +162,7 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui float3 const x_536 = float3(x_534[0], x_534[2], x_535[0]); j_1 = 10; QuicksortObject const x_960 = *(tint_symbol_82); - tint_array_wrapper const tint_symbol_8 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_8 = tint_array{}; QuicksortObject const tint_symbol_9 = {.numbers=tint_symbol_8}; *(tint_symbol_82) = tint_symbol_9; *(tint_symbol_82) = x_960; @@ -168,9 +177,9 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui int const x_963 = pivot; pivot = 0; pivot = x_963; - x_537 = float2(float3(1.0f, 2.0f, 3.0f)[1], float3(1.0f, 2.0f, 3.0f)[2]); + x_537 = float2(2.0f, 3.0f); QuicksortObject const x_964 = *(tint_symbol_82); - tint_array_wrapper const tint_symbol_10 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_10 = tint_array{}; QuicksortObject const tint_symbol_11 = {.numbers=tint_symbol_10}; *(tint_symbol_82) = tint_symbol_11; *(tint_symbol_82) = x_964; @@ -193,9 +202,9 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui break; } int const x_60 = j_1; - int const x_969 = (*(tint_symbol_82)).numbers.arr[x_42_save]; - (*(tint_symbol_82)).numbers.arr[x_42_save] = 0; - (*(tint_symbol_82)).numbers.arr[x_42_save] = x_969; + int const x_969 = (*(tint_symbol_82)).numbers[x_42_save]; + (*(tint_symbol_82)).numbers[x_42_save] = 0; + (*(tint_symbol_82)).numbers[x_42_save] = x_969; int const x_61_save = x_60; int const x_970 = *(h); *(h) = 0; @@ -204,14 +213,14 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui int const x_971 = param_1; param_1 = 0; param_1 = x_971; - int const x_62 = (*(tint_symbol_82)).numbers.arr[x_61_save]; + int const x_62 = (*(tint_symbol_82)).numbers[x_61_save]; QuicksortObject const x_972 = *(tint_symbol_82); - tint_array_wrapper const tint_symbol_12 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_12 = tint_array{}; QuicksortObject const tint_symbol_13 = {.numbers=tint_symbol_12}; *(tint_symbol_82) = tint_symbol_13; *(tint_symbol_82) = x_972; int const x_63 = pivot; - float2 const x_540 = float2(float3(1.0f, 2.0f, 3.0f)[1], x_534[2]); + float2 const x_540 = float2(2.0f, x_534[2]); int const x_973 = i_1; i_1 = 0; i_1 = x_973; @@ -242,7 +251,7 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui int const x_980 = *(l); *(l) = 0; *(l) = x_980; - float3 const x_544 = float3(float3(1.0f, 2.0f, 3.0f)[2], float3(1.0f, 2.0f, 3.0f)[1], x_540[0]); + float3 const x_544 = float3(3.0f, 2.0f, x_540[0]); int const x_70 = i_1; float2 const x_545 = float2(x_537[1], x_538[0]); int const x_981 = param; @@ -267,7 +276,7 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui param_1 = x_985; } QuicksortObject const x_986 = *(tint_symbol_82); - tint_array_wrapper const tint_symbol_14 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_14 = tint_array{}; QuicksortObject const tint_symbol_15 = {.numbers=tint_symbol_14}; *(tint_symbol_82) = tint_symbol_15; *(tint_symbol_82) = x_986; @@ -280,9 +289,9 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui *(h) = 0; *(h) = x_988; float3 const x_547 = float3(x_539[0], x_541[2], x_541[2]); - int const x_989 = (*(tint_symbol_82)).numbers.arr[x_61_save]; - (*(tint_symbol_82)).numbers.arr[x_61_save] = 0; - (*(tint_symbol_82)).numbers.arr[x_61_save] = x_989; + int const x_989 = (*(tint_symbol_82)).numbers[x_61_save]; + (*(tint_symbol_82)).numbers[x_61_save] = 0; + (*(tint_symbol_82)).numbers[x_61_save] = x_989; int const x_990 = param; param = 0; param = x_990; @@ -291,18 +300,18 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui param_1 = 0; param_1 = x_991; float3 const x_548 = float3(x_541[1], x_541[2], x_541[0]); - int const x_992 = (*(tint_symbol_82)).numbers.arr[x_61_save]; - (*(tint_symbol_82)).numbers.arr[x_61_save] = 0; - (*(tint_symbol_82)).numbers.arr[x_61_save] = x_992; + int const x_992 = (*(tint_symbol_82)).numbers[x_61_save]; + (*(tint_symbol_82)).numbers[x_61_save] = 0; + (*(tint_symbol_82)).numbers[x_61_save] = x_992; } } int const x_76 = i_1; - int const x_993 = (*(tint_symbol_82)).numbers.arr[x_42_save]; - (*(tint_symbol_82)).numbers.arr[x_42_save] = 0; - (*(tint_symbol_82)).numbers.arr[x_42_save] = x_993; + int const x_993 = (*(tint_symbol_82)).numbers[x_42_save]; + (*(tint_symbol_82)).numbers[x_42_save] = 0; + (*(tint_symbol_82)).numbers[x_42_save] = x_993; float2 const x_549 = float2(x_534[0], x_534[1]); QuicksortObject const x_994 = *(tint_symbol_82); - tint_array_wrapper const tint_symbol_16 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_16 = tint_array{}; QuicksortObject const tint_symbol_17 = {.numbers=tint_symbol_16}; *(tint_symbol_82) = tint_symbol_17; *(tint_symbol_82) = x_994; @@ -343,7 +352,7 @@ int performPartition_i1_i1_(thread int* const l, thread int* const h, thread Qui int const x_1003 = *(l); *(l) = 0; *(l) = x_1003; - float2 const x_554 = float2(x_536[2], float3(1.0f, 2.0f, 3.0f)[1]); + float2 const x_554 = float2(x_536[2], 2.0f); int const x_1004 = param_1; param_1 = 0; param_1 = x_1004; @@ -364,18 +373,18 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { int p = 0; int l_1 = 0; int top = 0; - tint_array_wrapper stack = {}; + tint_array stack = {}; int param_5 = 0; l_1 = 0; int const x_1007 = param_5; param_5 = 0; param_5 = x_1007; h_1 = 9; - tint_array_wrapper const x_1008 = stack; - tint_array_wrapper const tint_symbol_18 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const x_1008 = stack; + tint_array const tint_symbol_18 = tint_array{}; stack = tint_symbol_18; stack = x_1008; - float2 const x_556 = float2(float3(1.0f, 2.0f, 3.0f)[1], float3(1.0f, 2.0f, 3.0f)[1]); + float2 const x_556 = float2(2.0f); int const x_1009 = param_5; param_5 = 0; param_5 = x_1009; @@ -384,7 +393,7 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { p = 0; p = x_1010; int const x_93 = top; - float2 const x_557 = float2(float3(1.0f, 2.0f, 3.0f)[0], float3(1.0f, 2.0f, 3.0f)[0]); + float2 const x_557 = float2(1.0f); int const x_1011 = p; p = 0; p = x_1011; @@ -406,21 +415,21 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { param_4 = x_1015; int const x_95 = l_1; QuicksortObject const x_1016 = *(tint_symbol_83); - tint_array_wrapper const tint_symbol_19 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_19 = tint_array{}; QuicksortObject const tint_symbol_20 = {.numbers=tint_symbol_19}; *(tint_symbol_83) = tint_symbol_20; *(tint_symbol_83) = x_1016; float3 const x_560 = float3(x_559[1], x_559[0], x_557[0]); int const x_96_save = x_94; - tint_array_wrapper const x_1017 = stack; - tint_array_wrapper const tint_symbol_21 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const x_1017 = stack; + tint_array const tint_symbol_21 = tint_array{}; stack = tint_symbol_21; stack = x_1017; float3 const x_561 = float3(x_556[1], x_556[1], x_556[1]); int const x_1018 = l_1; l_1 = 0; l_1 = 0; - stack.arr[x_96_save] = x_95; + stack[x_96_save] = x_95; int const x_1019 = param_5; param_5 = 0; param_5 = x_1019; @@ -428,14 +437,14 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { int const x_1020 = param_4; param_4 = 0; param_4 = x_1020; - float3 const x_562 = float3(float3(1.0f, 2.0f, 3.0f)[2], x_558[1], float3(1.0f, 2.0f, 3.0f)[1]); - int const x_1021 = stack.arr[x_96_save]; - stack.arr[x_96_save] = 0; - stack.arr[x_96_save] = x_1021; + float3 const x_562 = float3(3.0f, x_558[1], 2.0f); + int const x_1021 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1021; int const x_98 = as_type((as_type(x_97) + as_type(1))); - int const x_1022 = stack.arr[x_96_save]; - stack.arr[x_96_save] = 0; - stack.arr[x_96_save] = x_1022; + int const x_1022 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1022; float3 const x_563 = float3(x_559[0], x_559[2], x_556[1]); top = x_98; int const x_1023 = param_4; @@ -457,19 +466,19 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { int const x_1027 = p; p = 0; p = x_1027; - stack.arr[x_100_save] = x_99; + stack[x_100_save] = x_99; while (true) { float3 const x_566 = float3(x_563[0], x_563[0], x_563[0]); int const x_1028 = h_1; h_1 = 0; h_1 = x_1028; - tint_array_wrapper const x_1029 = stack; - tint_array_wrapper const tint_symbol_22 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const x_1029 = stack; + tint_array const tint_symbol_22 = tint_array{}; stack = tint_symbol_22; stack = x_1029; int const x_106 = top; - tint_array_wrapper const x_1030 = stack; - tint_array_wrapper const tint_symbol_23 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const x_1030 = stack; + tint_array const tint_symbol_23 = tint_array{}; stack = tint_symbol_23; stack = x_1030; float2 const x_567 = float2(x_558[0], x_564[2]); @@ -481,7 +490,7 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { break; } QuicksortObject const x_1032 = *(tint_symbol_83); - tint_array_wrapper const tint_symbol_24 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_24 = tint_array{}; QuicksortObject const tint_symbol_25 = {.numbers=tint_symbol_24}; *(tint_symbol_83) = tint_symbol_25; *(tint_symbol_83) = x_1032; @@ -503,12 +512,12 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { p = 0; p = x_1036; int const x_110_save = x_108; - int const x_1037 = stack.arr[x_96_save]; - stack.arr[x_96_save] = 0; - stack.arr[x_96_save] = x_1037; - int const x_111 = stack.arr[x_110_save]; - tint_array_wrapper const x_1038 = stack; - tint_array_wrapper const tint_symbol_26 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + int const x_1037 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1037; + int const x_111 = stack[x_110_save]; + tint_array const x_1038 = stack; + tint_array const tint_symbol_26 = tint_array{}; stack = tint_symbol_26; stack = x_1038; float3 const x_571 = float3(x_559[1], x_559[0], x_564[1]); @@ -516,8 +525,8 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { l_1 = 0; l_1 = x_1039; h_1 = x_111; - tint_array_wrapper const x_1040 = stack; - tint_array_wrapper const tint_symbol_27 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const x_1040 = stack; + tint_array const tint_symbol_27 = tint_array{}; stack = tint_symbol_27; stack = x_1040; float2 const x_572 = float2(x_562[1], x_561[1]); @@ -528,10 +537,10 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { int const x_1042 = param_4; param_4 = 0; param_4 = x_1042; - int const x_1043 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1043; - float2 const x_573 = float2(float3(1.0f, 2.0f, 3.0f)[1], float3(1.0f, 2.0f, 3.0f)[2]); + int const x_1043 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1043; + float2 const x_573 = float2(2.0f, 3.0f); top = as_type((as_type(x_112) - as_type(1))); int const x_1044 = param_5; param_5 = 0; @@ -542,10 +551,10 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { h_1 = x_1045; int const x_114_save = x_112; float2 const x_575 = float2(x_564[1], x_564[2]); - int const x_1046 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1046; - int const x_115 = stack.arr[x_114_save]; + int const x_1046 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1046; + int const x_115 = stack[x_114_save]; int const x_1047 = p; p = 0; p = x_1047; @@ -559,16 +568,16 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { top = x_1049; int const x_118 = l_1; param_4 = x_118; - int const x_1050 = stack.arr[x_110_save]; - stack.arr[x_110_save] = 0; - stack.arr[x_110_save] = x_1050; + int const x_1050 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1050; float2 const x_577 = float2(x_569[1], x_569[2]); int const x_120 = h_1; - float2 const x_578 = float2(x_558[0], float3(1.0f, 2.0f, 3.0f)[1]); + float2 const x_578 = float2(x_558[0], 2.0f); param_5 = x_120; - int const x_1051 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1051; + int const x_1051 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1051; int const x_121 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_83); float2 const x_579 = float2(x_567[0], x_568[0]); int const x_1052 = param_5; @@ -590,140 +599,140 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { h_1 = 0; h_1 = x_1056; int const x_124 = l_1; - int const x_1057 = stack.arr[x_110_save]; - stack.arr[x_110_save] = 0; - stack.arr[x_110_save] = x_1057; + int const x_1057 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1057; int const x_1058 = h_1; h_1 = 0; h_1 = x_1058; float2 const x_582 = float2(x_567[1], x_573[0]); - int const x_1059 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1059; + int const x_1059 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1059; if ((as_type((as_type(x_122) - as_type(as_type(1u)))) > x_124)) { int const x_1060 = param_4; param_4 = 0; param_4 = x_1060; int const x_128 = top; float2 const x_583 = float2(x_571[1], x_556[1]); - int const x_1061 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1061; - tint_array_wrapper const x_1062 = stack; - tint_array_wrapper const tint_symbol_28 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + int const x_1061 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1061; + tint_array const x_1062 = stack; + tint_array const tint_symbol_28 = tint_array{}; stack = tint_symbol_28; stack = x_1062; float2 const x_584 = float2(x_569[2], x_569[1]); float3 const x_585 = float3(x_580[1], x_577[0], x_577[0]); int const x_130 = l_1; - int const x_1063 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1063; + int const x_1063 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1063; float2 const x_586 = float2(x_564[0], x_585[0]); int const x_1064 = param_5; param_5 = 0; param_5 = x_1064; int const x_131_save = as_type((as_type(1) + as_type(x_128))); - int const x_1065 = stack.arr[x_110_save]; - stack.arr[x_110_save] = 0; - stack.arr[x_110_save] = x_1065; + int const x_1065 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1065; float3 const x_587 = float3(x_566[1], x_566[1], x_563[0]); int const x_1066 = param_5; param_5 = 0; param_5 = x_1066; - stack.arr[x_131_save] = x_130; + stack[x_131_save] = x_130; int const x_132 = top; - int const x_1067 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1067; + int const x_1067 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1067; float2 const x_588 = float2(x_575[1], x_575[0]); - int const x_1068 = stack.arr[x_131_save]; - stack.arr[x_131_save] = 0; - stack.arr[x_131_save] = x_1068; + int const x_1068 = stack[x_131_save]; + stack[x_131_save] = 0; + stack[x_131_save] = x_1068; int const x_133 = as_type((1u + as_type(x_132))); - int const x_1069 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1069; + int const x_1069 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1069; float3 const x_589 = float3(x_576[2], x_588[1], x_576[2]); int const x_1070 = h_1; h_1 = 0; h_1 = x_1070; top = x_133; - tint_array_wrapper const x_1071 = stack; - tint_array_wrapper const tint_symbol_29 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const x_1071 = stack; + tint_array const tint_symbol_29 = tint_array{}; stack = tint_symbol_29; stack = x_1071; int const x_134 = p; float2 const x_590 = float2(x_576[0], x_573[1]); - int const x_1072 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1072; + int const x_1072 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1072; int const x_136_save = x_133; - int const x_1073 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1073; - stack.arr[x_136_save] = as_type((as_type(x_134) - as_type(as_type(1u)))); - int const x_1074 = stack.arr[x_96_save]; - stack.arr[x_96_save] = 0; - stack.arr[x_96_save] = x_1074; + int const x_1073 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1073; + stack[x_136_save] = as_type((as_type(x_134) - as_type(as_type(1u)))); + int const x_1074 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1074; float2 const x_591 = float2(x_569[2], x_569[1]); - int const x_1075 = stack.arr[x_136_save]; - stack.arr[x_136_save] = 0; - stack.arr[x_136_save] = x_1075; + int const x_1075 = stack[x_136_save]; + stack[x_136_save] = 0; + stack[x_136_save] = x_1075; } - int const x_1076 = stack.arr[x_96_save]; - stack.arr[x_96_save] = 0; - stack.arr[x_96_save] = x_1076; - float2 const x_592 = float2(float3(1.0f, 2.0f, 3.0f)[0], float3(1.0f, 2.0f, 3.0f)[1]); + int const x_1076 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1076; + float2 const x_592 = float2(1.0f, 2.0f); QuicksortObject const x_1077 = *(tint_symbol_83); - tint_array_wrapper const tint_symbol_30 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_30 = tint_array{}; QuicksortObject const tint_symbol_31 = {.numbers=tint_symbol_30}; *(tint_symbol_83) = tint_symbol_31; *(tint_symbol_83) = x_1077; int const x_137 = p; - int const x_1078 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1078; + int const x_1078 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1078; float3 const x_593 = float3(x_571[2], x_556[0], x_556[1]); int const x_1079 = p; p = 0; p = x_1079; float3 const x_594 = float3(x_563[2], x_563[0], x_575[0]); - int const x_1080 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1080; + int const x_1080 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1080; int const x_139 = h_1; int const x_1081 = top; top = 0; top = x_1081; float3 const x_595 = float3(x_560[2], x_568[0], x_560[0]); - int const x_1082 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1082; + int const x_1082 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1082; int const x_1083 = p; p = 0; p = x_1083; if ((as_type((1u + as_type(x_137))) < x_139)) { - int const x_1084 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1084; + int const x_1084 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1084; float2 const x_596 = float2(x_592[1], x_582[0]); int const x_1085 = l_1; l_1 = 0; l_1 = x_1085; int const x_143 = top; - int const x_1086 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1086; + int const x_1086 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1086; float3 const x_597 = float3(x_562[1], x_560[1], x_560[1]); int const x_144 = as_type((as_type(x_143) + as_type(1))); int const x_1087 = param_5; param_5 = 0; param_5 = x_1087; top = x_144; - int const x_1088 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1088; + int const x_1088 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1088; int const x_145 = p; int const x_1089 = param_5; param_5 = 0; @@ -733,62 +742,62 @@ void quicksort_(thread QuicksortObject* const tint_symbol_83) { p = 0; p = x_1090; float3 const x_600 = float3(x_556[0], x_580[0], x_580[0]); - int const x_1091 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1091; + int const x_1091 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1091; int const x_147_save = x_144; - int const x_1092 = stack.arr[x_110_save]; - stack.arr[x_110_save] = 0; - stack.arr[x_110_save] = x_1092; + int const x_1092 = stack[x_110_save]; + stack[x_110_save] = 0; + stack[x_110_save] = x_1092; float2 const x_601 = float2(x_563[0], x_563[1]); - stack.arr[x_147_save] = as_type((1u + as_type(x_145))); - tint_array_wrapper const x_1093 = stack; - tint_array_wrapper const tint_symbol_32 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + stack[x_147_save] = as_type((1u + as_type(x_145))); + tint_array const x_1093 = stack; + tint_array const tint_symbol_32 = tint_array{}; stack = tint_symbol_32; stack = x_1093; int const x_148 = top; - int const x_1094 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1094; + int const x_1094 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1094; float2 const x_602 = float2(x_565[1], x_599[1]); - tint_array_wrapper const x_1095 = stack; - tint_array_wrapper const tint_symbol_33 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const x_1095 = stack; + tint_array const tint_symbol_33 = tint_array{}; stack = tint_symbol_33; stack = x_1095; int const x_149 = as_type((as_type(x_148) + as_type(as_type(1u)))); - int const x_1096 = stack.arr[x_147_save]; - stack.arr[x_147_save] = 0; - stack.arr[x_147_save] = x_1096; + int const x_1096 = stack[x_147_save]; + stack[x_147_save] = 0; + stack[x_147_save] = x_1096; top = x_149; int const x_1097 = param_4; param_4 = 0; param_4 = x_1097; int const x_150 = h_1; - int const x_1098 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1098; - int const x_1099 = stack.arr[x_96_save]; - stack.arr[x_96_save] = 0; - stack.arr[x_96_save] = x_1099; - stack.arr[x_149] = x_150; - int const x_1100 = stack.arr[x_114_save]; - stack.arr[x_114_save] = 0; - stack.arr[x_114_save] = x_1100; + int const x_1098 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1098; + int const x_1099 = stack[x_96_save]; + stack[x_96_save] = 0; + stack[x_96_save] = x_1099; + stack[x_149] = x_150; + int const x_1100 = stack[x_114_save]; + stack[x_114_save] = 0; + stack[x_114_save] = x_1100; float3 const x_603 = float3(x_568[1], x_564[0], x_564[0]); int const x_1101 = l_1; l_1 = 0; l_1 = x_1101; } - int const x_1102 = stack.arr[x_100_save]; - stack.arr[x_100_save] = 0; - stack.arr[x_100_save] = x_1102; + int const x_1102 = stack[x_100_save]; + stack[x_100_save] = 0; + stack[x_100_save] = x_1102; { int const x_1103 = l_1; l_1 = 0; l_1 = x_1103; float2 const x_604 = float2(x_563[2], x_564[0]); QuicksortObject const x_1104 = *(tint_symbol_83); - tint_array_wrapper const tint_symbol_34 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_34 = tint_array{}; QuicksortObject const tint_symbol_35 = {.numbers=tint_symbol_34}; *(tint_symbol_83) = tint_symbol_35; *(tint_symbol_83) = x_1104; @@ -805,134 +814,134 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t int i_2 = 0; float2 uv = 0.0f; float2 const x_717 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_717; i_2 = 0; QuicksortObject const x_721 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_36 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_36 = tint_array{}; QuicksortObject const tint_symbol_37 = {.numbers=tint_symbol_36}; *(tint_symbol_84) = tint_symbol_37; *(tint_symbol_84) = x_721; if (true) { QuicksortObject const x_722 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_38 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_38 = tint_array{}; QuicksortObject const tint_symbol_39 = {.numbers=tint_symbol_38}; *(tint_symbol_84) = tint_symbol_39; *(tint_symbol_84) = x_722; - float2 const x_431 = float2(float3(1.0f, 2.0f, 3.0f)[0], float3(1.0f, 2.0f, 3.0f)[0]); + float2 const x_431 = float2(1.0f); int const x_158 = i_2; float2 const x_723 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_723; float3 const x_725 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_725; float2 const x_432 = float2(x_431[1], x_431[1]); QuicksortObject const x_726 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_40 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_40 = tint_array{}; QuicksortObject const tint_symbol_41 = {.numbers=tint_symbol_40}; *(tint_symbol_84) = tint_symbol_41; *(tint_symbol_84) = x_726; } QuicksortObject const x_756 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_42 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_42 = tint_array{}; QuicksortObject const tint_symbol_43 = {.numbers=tint_symbol_42}; *(tint_symbol_84) = tint_symbol_43; *(tint_symbol_84) = x_756; - float2 const x_446 = float2(float2()[0], float2()[0]); + float2 const x_446 = float2(0.0f); int const x_757 = i_2; i_2 = 0; i_2 = x_757; quicksort_(tint_symbol_84); QuicksortObject const x_758 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_44 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_44 = tint_array{}; QuicksortObject const tint_symbol_45 = {.numbers=tint_symbol_44}; *(tint_symbol_84) = tint_symbol_45; *(tint_symbol_84) = x_758; float4 const x_184 = *(tint_symbol_85); float2 const x_759 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_759; - float2 const x_447 = float2(float2()[1], float2()[1]); + float2 const x_447 = float2(0.0f); float2 const x_760 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_760; float2 const x_185 = float2(x_184[0], x_184[1]); float3 const x_448 = float3(x_185[1], x_446[1], x_446[1]); QuicksortObject const x_761 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_46 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_46 = tint_array{}; QuicksortObject const tint_symbol_47 = {.numbers=tint_symbol_46}; *(tint_symbol_84) = tint_symbol_47; *(tint_symbol_84) = x_761; float2 const x_762 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_762; float2 const x_191 = (*(tint_symbol_86)).resolution; QuicksortObject const x_763 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_48 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_48 = tint_array{}; QuicksortObject const tint_symbol_49 = {.numbers=tint_symbol_48}; *(tint_symbol_84) = tint_symbol_49; *(tint_symbol_84) = x_763; - float3 const x_449 = float3(x_184[1], float3(1.0f, 2.0f, 3.0f)[2], x_184[3]); + float3 const x_449 = float3(x_184[1], 3.0f, x_184[3]); float3 const x_764 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_764; float2 const x_192 = (x_185 / x_191); QuicksortObject const x_765 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_50 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_50 = tint_array{}; QuicksortObject const tint_symbol_51 = {.numbers=tint_symbol_50}; *(tint_symbol_84) = tint_symbol_51; *(tint_symbol_84) = x_765; float2 const x_450 = float2(x_447[0], x_185[1]); float3 const x_766 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); float3 const x_767 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_767; color = x_766; uv = x_192; color = float3(1.0f, 2.0f, 3.0f); float3 const x_768 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_768; float3 const x_451 = float3(x_185[0], x_185[1], x_446[1]); QuicksortObject const x_769 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_52 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_52 = tint_array{}; QuicksortObject const tint_symbol_53 = {.numbers=tint_symbol_52}; *(tint_symbol_84) = tint_symbol_53; *(tint_symbol_84) = x_769; - int const x_770 = (*(tint_symbol_84)).numbers.arr[0u]; - (*(tint_symbol_84)).numbers.arr[0u] = 0; - (*(tint_symbol_84)).numbers.arr[0u] = x_770; - int const x_201 = (*(tint_symbol_84)).numbers.arr[0u]; + int const x_770 = (*(tint_symbol_84)).numbers[0u]; + (*(tint_symbol_84)).numbers[0u] = 0; + (*(tint_symbol_84)).numbers[0u] = x_770; + int const x_201 = (*(tint_symbol_84)).numbers[0u]; QuicksortObject const x_771 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_54 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_54 = tint_array{}; QuicksortObject const tint_symbol_55 = {.numbers=tint_symbol_54}; *(tint_symbol_84) = tint_symbol_55; *(tint_symbol_84) = x_771; - int const x_772 = (*(tint_symbol_84)).numbers.arr[0u]; - (*(tint_symbol_84)).numbers.arr[0u] = 0; - (*(tint_symbol_84)).numbers.arr[0u] = x_772; + int const x_772 = (*(tint_symbol_84)).numbers[0u]; + (*(tint_symbol_84)).numbers[0u] = 0; + (*(tint_symbol_84)).numbers[0u] = x_772; float const x_206 = color[0]; float const x_773 = color[0]; color[0] = 0.0f; color[0] = x_773; - float2 const x_452 = float2(float3(1.0f, 2.0f, 3.0f)[2], float3(1.0f, 2.0f, 3.0f)[1]); + float2 const x_452 = float2(3.0f, 2.0f); int const x_774 = i_2; i_2 = 0; i_2 = x_774; QuicksortObject const x_775 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_56 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_56 = tint_array{}; QuicksortObject const tint_symbol_57 = {.numbers=tint_symbol_56}; *(tint_symbol_84) = tint_symbol_57; *(tint_symbol_84) = x_775; float3 const x_453 = float3(x_451[0], x_450[0], x_450[1]); color[0] = (x_206 + float(x_201)); float2 const x_776 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_776; float2 const x_777 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_777; float2 const x_454 = float2(x_184[1], x_184[1]); float const x_210 = uv[0]; @@ -941,7 +950,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t uv[0] = 0.0f; uv[0] = x_778; QuicksortObject const x_779 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_58 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_58 = tint_array{}; QuicksortObject const tint_symbol_59 = {.numbers=tint_symbol_58}; *(tint_symbol_84) = tint_symbol_59; *(tint_symbol_84) = x_779; @@ -949,29 +958,29 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t int const x_780 = i_2; i_2 = 0; i_2 = x_780; - int const x_781 = (*(tint_symbol_84)).numbers.arr[0u]; - (*(tint_symbol_84)).numbers.arr[0u] = 0; - (*(tint_symbol_84)).numbers.arr[0u] = x_781; - float3 const x_456 = float3(float2()[1], x_448[1], x_448[1]); + int const x_781 = (*(tint_symbol_84)).numbers[0u]; + (*(tint_symbol_84)).numbers[0u] = 0; + (*(tint_symbol_84)).numbers[0u] = x_781; + float3 const x_456 = float3(0.0f, x_448[1], x_448[1]); float const x_782 = uv[0]; uv[0] = 0.0f; uv[0] = x_782; - int const x_216 = (*(tint_symbol_84)).numbers.arr[1]; + int const x_216 = (*(tint_symbol_84)).numbers[1]; QuicksortObject const x_783 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_60 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_60 = tint_array{}; QuicksortObject const tint_symbol_61 = {.numbers=tint_symbol_60}; *(tint_symbol_84) = tint_symbol_61; *(tint_symbol_84) = x_783; float2 const x_457 = float2(x_454[0], x_454[0]); float2 const x_784 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_784; QuicksortObject const x_785 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_62 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_62 = tint_array{}; QuicksortObject const tint_symbol_63 = {.numbers=tint_symbol_62}; *(tint_symbol_84) = tint_symbol_63; *(tint_symbol_84) = x_785; - float2 const x_458 = float2(float3(1.0f, 2.0f, 3.0f)[2], float2()[1]); + float2 const x_458 = float2(3.0f, 0.0f); int const x_786 = i_2; i_2 = 0; i_2 = x_786; @@ -980,19 +989,19 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t color[0] = 0.0f; color[0] = x_787; float3 const x_788 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_788; float3 const x_789 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_789; float3 const x_459 = float3(x_454[1], x_454[1], x_447[1]); float const x_790 = color[0]; color[0] = 0.0f; color[0] = x_790; color[0] = (float(x_216) + x_219); - int const x_791 = (*(tint_symbol_84)).numbers.arr[0u]; - (*(tint_symbol_84)).numbers.arr[0u] = 0; - (*(tint_symbol_84)).numbers.arr[0u] = x_791; + int const x_791 = (*(tint_symbol_84)).numbers[0u]; + (*(tint_symbol_84)).numbers[0u] = 0; + (*(tint_symbol_84)).numbers[0u] = x_791; } float const x_792 = uv[0]; uv[0] = 0.0f; @@ -1006,12 +1015,12 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t uv[0] = x_794; float3 const x_460 = float3(x_453[2], x_453[1], x_453[1]); float2 const x_795 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_795; float const x_796 = uv[0]; uv[0] = 0.0f; uv[0] = x_796; - float2 const x_461 = float2(float2()[1], float2()[1]); + float2 const x_461 = float2(0.0f); float const x_797 = uv[0]; uv[0] = 0.0f; uv[0] = x_797; @@ -1030,24 +1039,24 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t float const x_801 = color[0]; color[0] = 0.0f; color[0] = x_801; - int const x_230 = (*(tint_symbol_84)).numbers.arr[2u]; + int const x_230 = (*(tint_symbol_84)).numbers[2u]; float const x_802 = uv[0]; uv[0] = 0.0f; uv[0] = x_802; float const x_803 = color[0]; color[0] = 0.0f; color[0] = x_803; - int const x_804 = (*(tint_symbol_84)).numbers.arr[2u]; - (*(tint_symbol_84)).numbers.arr[2u] = 0; - (*(tint_symbol_84)).numbers.arr[2u] = x_804; + int const x_804 = (*(tint_symbol_84)).numbers[2u]; + (*(tint_symbol_84)).numbers[2u] = 0; + (*(tint_symbol_84)).numbers[2u] = x_804; float2 const x_464 = float2(x_450[1], x_191[0]); float const x_805 = color[1]; color[1] = 0.0f; color[1] = x_805; float const x_234 = color[1]; - int const x_806 = (*(tint_symbol_84)).numbers.arr[2u]; - (*(tint_symbol_84)).numbers.arr[2u] = 0; - (*(tint_symbol_84)).numbers.arr[2u] = x_806; + int const x_806 = (*(tint_symbol_84)).numbers[2u]; + (*(tint_symbol_84)).numbers[2u] = 0; + (*(tint_symbol_84)).numbers[2u] = x_806; float2 const x_465 = float2(x_463[0], x_185[0]); float const x_807 = color[0]; color[0] = 0.0f; @@ -1055,7 +1064,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t int const x_808 = i_2; i_2 = 0; i_2 = x_808; - float2 const x_466 = float2(x_455[1], float2()[1]); + float2 const x_466 = float2(x_455[1], 0.0f); int const x_809 = i_2; i_2 = 0; i_2 = x_809; @@ -1073,7 +1082,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t uv[0] = x_812; float const x_238 = uv[0]; float3 const x_813 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_813; float const x_814 = color[0]; color[0] = 0.0f; @@ -1082,12 +1091,12 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t float const x_815 = color[0]; color[0] = 0.0f; color[0] = x_815; - int const x_245 = (*(tint_symbol_84)).numbers.arr[3]; + int const x_245 = (*(tint_symbol_84)).numbers[3]; float const x_816 = color[0]; color[0] = 0.0f; color[0] = x_816; QuicksortObject const x_817 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_64 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_64 = tint_array{}; QuicksortObject const tint_symbol_65 = {.numbers=tint_symbol_64}; *(tint_symbol_84) = tint_symbol_65; *(tint_symbol_84) = x_817; @@ -1100,22 +1109,22 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t uv[0] = x_819; float const x_249 = color[2]; float3 const x_820 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_820; float3 const x_469 = float3(x_467[0], x_191[1], x_467[1]); float const x_821 = color[2]; color[2] = 0.0f; color[2] = x_821; - int const x_822 = (*(tint_symbol_84)).numbers.arr[0u]; - (*(tint_symbol_84)).numbers.arr[0u] = 0; - (*(tint_symbol_84)).numbers.arr[0u] = x_822; - float2 const x_470 = float2(float2()[0], float2()[1]); + int const x_822 = (*(tint_symbol_84)).numbers[0u]; + (*(tint_symbol_84)).numbers[0u] = 0; + (*(tint_symbol_84)).numbers[0u] = x_822; + float2 const x_470 = float2(0.0f); float const x_823 = color[2]; color[2] = 0.0f; color[2] = x_823; color[2] = (x_249 + float(x_245)); float2 const x_824 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_824; float2 const x_471 = float2(x_470[1], x_470[1]); } @@ -1123,17 +1132,17 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t uv[0] = 0.0f; uv[0] = x_825; float3 const x_472 = float3(x_454[0], x_454[1], x_454[1]); - int const x_254 = (*(tint_symbol_84)).numbers.arr[4]; + int const x_254 = (*(tint_symbol_84)).numbers[4]; float const x_826 = uv[0]; uv[0] = 0.0f; uv[0] = x_826; float3 const x_827 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_827; float3 const x_473 = float3(x_446[1], x_453[0], x_453[0]); - int const x_828 = (*(tint_symbol_84)).numbers.arr[4]; - (*(tint_symbol_84)).numbers.arr[4] = 0; - (*(tint_symbol_84)).numbers.arr[4] = x_828; + int const x_828 = (*(tint_symbol_84)).numbers[4]; + (*(tint_symbol_84)).numbers[4] = 0; + (*(tint_symbol_84)).numbers[4] = x_828; float2 const x_474 = float2(x_191[0], x_184[2]); float const x_829 = uv[0]; uv[0] = 0.0f; @@ -1151,7 +1160,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t color[0] = x_832; float2 const x_476 = float2(x_451[2], x_460[1]); color[1] = (x_257 + float(x_254)); - float3 const x_477 = float3(float2()[0], x_472[0], float2()[1]); + float3 const x_477 = float3(0.0f, x_472[0], 0.0f); float const x_833 = uv[0]; uv[0] = 0.0f; uv[0] = x_833; @@ -1166,23 +1175,23 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t int const x_836 = i_2; i_2 = 0; i_2 = x_836; - float3 const x_479 = float3(float2()[1], x_454[1], float2()[0]); - int const x_837 = (*(tint_symbol_84)).numbers.arr[0u]; - (*(tint_symbol_84)).numbers.arr[0u] = 0; - (*(tint_symbol_84)).numbers.arr[0u] = x_837; + float3 const x_479 = float3(0.0f, x_454[1], 0.0f); + int const x_837 = (*(tint_symbol_84)).numbers[0u]; + (*(tint_symbol_84)).numbers[0u] = 0; + (*(tint_symbol_84)).numbers[0u] = x_837; float const x_838 = color[1]; color[1] = 0.0f; color[1] = x_838; - float3 const x_480 = float3(x_446[0], x_446[0], float2()[1]); + float3 const x_480 = float3(x_446[0], x_446[0], 0.0f); float const x_839 = uv[0]; uv[0] = 0.0f; uv[0] = x_839; if ((x_261 > 0.25f)) { float2 const x_481 = float2(x_447[0], x_480[2]); float3 const x_840 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_840; - int const x_267 = (*(tint_symbol_84)).numbers.arr[5u]; + int const x_267 = (*(tint_symbol_84)).numbers[5u]; float const x_841 = color[0]; color[0] = 0.0f; color[0] = x_841; @@ -1198,7 +1207,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t uv[0] = x_844; float3 const x_482 = float3(x_455[0], x_475[1], x_455[1]); QuicksortObject const x_845 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_66 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_66 = tint_array{}; QuicksortObject const tint_symbol_67 = {.numbers=tint_symbol_66}; *(tint_symbol_84) = tint_symbol_67; *(tint_symbol_84) = x_845; @@ -1225,13 +1234,13 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t float const x_851 = uv[1]; uv[1] = 0.0f; uv[1] = x_851; - int const x_852 = (*(tint_symbol_84)).numbers.arr[4]; - (*(tint_symbol_84)).numbers.arr[4] = 0; - (*(tint_symbol_84)).numbers.arr[4] = x_852; + int const x_852 = (*(tint_symbol_84)).numbers[4]; + (*(tint_symbol_84)).numbers[4] = 0; + (*(tint_symbol_84)).numbers[4] = x_852; float const x_274 = uv[1]; - int const x_853 = (*(tint_symbol_84)).numbers.arr[0u]; - (*(tint_symbol_84)).numbers.arr[0u] = 0; - (*(tint_symbol_84)).numbers.arr[0u] = x_853; + int const x_853 = (*(tint_symbol_84)).numbers[0u]; + (*(tint_symbol_84)).numbers[0u] = 0; + (*(tint_symbol_84)).numbers[0u] = x_853; if ((x_274 > 0.5f)) { float const x_854 = uv[0]; uv[0] = 0.0f; @@ -1244,34 +1253,34 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t float const x_856 = uv[1]; uv[1] = 0.0f; uv[1] = x_856; - int const x_280 = (*(tint_symbol_84)).numbers.arr[6u]; + int const x_280 = (*(tint_symbol_84)).numbers[6u]; float const x_857 = uv[1]; uv[1] = 0.0f; uv[1] = x_857; int const x_858 = i_2; i_2 = 0; i_2 = x_858; - int const x_859 = (*(tint_symbol_84)).numbers.arr[4]; - (*(tint_symbol_84)).numbers.arr[4] = 0; - (*(tint_symbol_84)).numbers.arr[4] = x_859; + int const x_859 = (*(tint_symbol_84)).numbers[4]; + (*(tint_symbol_84)).numbers[4] = 0; + (*(tint_symbol_84)).numbers[4] = x_859; float2 const x_488 = float2(x_473[2], x_473[1]); float const x_283 = color[1]; float2 const x_860 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_860; float const x_861 = color[0]; color[0] = 0.0f; color[0] = x_861; float2 const x_489 = float2(x_475[1], x_475[0]); - int const x_862 = (*(tint_symbol_84)).numbers.arr[6u]; - (*(tint_symbol_84)).numbers.arr[6u] = 0; - (*(tint_symbol_84)).numbers.arr[6u] = x_862; - int const x_863 = (*(tint_symbol_84)).numbers.arr[6u]; - (*(tint_symbol_84)).numbers.arr[6u] = 0; - (*(tint_symbol_84)).numbers.arr[6u] = x_863; + int const x_862 = (*(tint_symbol_84)).numbers[6u]; + (*(tint_symbol_84)).numbers[6u] = 0; + (*(tint_symbol_84)).numbers[6u] = x_862; + int const x_863 = (*(tint_symbol_84)).numbers[6u]; + (*(tint_symbol_84)).numbers[6u] = 0; + (*(tint_symbol_84)).numbers[6u] = x_863; float2 const x_490 = float2(x_480[2], x_480[2]); QuicksortObject const x_864 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_68 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_68 = tint_array{}; QuicksortObject const tint_symbol_69 = {.numbers=tint_symbol_68}; *(tint_symbol_84) = tint_symbol_69; *(tint_symbol_84) = x_864; @@ -1279,7 +1288,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t float const x_865 = color[0]; color[0] = 0.0f; color[0] = x_865; - float2 const x_491 = float2(float3(1.0f, 2.0f, 3.0f)[1], x_454[0]); + float2 const x_491 = float2(2.0f, x_454[0]); float const x_866 = color[1]; color[1] = 0.0f; color[1] = x_866; @@ -1290,7 +1299,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t color[0] = x_867; float const x_287 = uv[1]; QuicksortObject const x_868 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_70 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_70 = tint_array{}; QuicksortObject const tint_symbol_71 = {.numbers=tint_symbol_70}; *(tint_symbol_84) = tint_symbol_71; *(tint_symbol_84) = x_868; @@ -1302,21 +1311,21 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t color[1] = 0.0f; color[1] = x_870; float3 const x_494 = float3(x_191[0], x_191[1], x_191[1]); - int const x_871 = (*(tint_symbol_84)).numbers.arr[4]; - (*(tint_symbol_84)).numbers.arr[4] = 0; - (*(tint_symbol_84)).numbers.arr[4] = x_871; + int const x_871 = (*(tint_symbol_84)).numbers[4]; + (*(tint_symbol_84)).numbers[4] = 0; + (*(tint_symbol_84)).numbers[4] = x_871; if ((x_287 > 0.75f)) { float3 const x_872 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_872; float const x_873 = color[0]; color[0] = 0.0f; color[0] = x_873; float3 const x_495 = float3(x_192[1], x_192[0], x_192[1]); float3 const x_874 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_874; - int const x_293 = (*(tint_symbol_84)).numbers.arr[7]; + int const x_293 = (*(tint_symbol_84)).numbers[7]; float const x_875 = uv[0]; uv[0] = 0.0f; uv[0] = x_875; @@ -1325,9 +1334,9 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t color[1] = 0.0f; color[1] = x_876; float2 const x_497 = float2(x_477[0], x_461[1]); - int const x_877 = (*(tint_symbol_84)).numbers.arr[0u]; - (*(tint_symbol_84)).numbers.arr[0u] = 0; - (*(tint_symbol_84)).numbers.arr[0u] = x_877; + int const x_877 = (*(tint_symbol_84)).numbers[0u]; + (*(tint_symbol_84)).numbers[0u] = 0; + (*(tint_symbol_84)).numbers[0u] = x_877; float const x_878 = color[1]; color[1] = 0.0f; color[1] = x_878; @@ -1367,20 +1376,20 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t i_2 = x_887; float2 const x_502 = float2(x_451[1], x_192[1]); float2 const x_888 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_888; - int const x_301 = (*(tint_symbol_84)).numbers.arr[8]; + int const x_301 = (*(tint_symbol_84)).numbers[8]; int const x_889 = i_2; i_2 = 0; i_2 = x_889; float2 const x_503 = float2(x_185[0], x_451[2]); - int const x_890 = (*(tint_symbol_84)).numbers.arr[8]; - (*(tint_symbol_84)).numbers.arr[8] = 0; - (*(tint_symbol_84)).numbers.arr[8] = x_890; + int const x_890 = (*(tint_symbol_84)).numbers[8]; + (*(tint_symbol_84)).numbers[8] = 0; + (*(tint_symbol_84)).numbers[8] = x_890; float const x_891 = color[1]; color[1] = 0.0f; color[1] = x_891; - float2 const x_504 = float2(x_453[1], float2()[0]); + float2 const x_504 = float2(x_453[1], 0.0f); float const x_892 = color[0]; color[0] = 0.0f; color[0] = x_892; @@ -1393,9 +1402,9 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t color[0] = 0.0f; color[0] = x_894; float2 const x_506 = float2(x_493[0], x_492[0]); - int const x_895 = (*(tint_symbol_84)).numbers.arr[4]; - (*(tint_symbol_84)).numbers.arr[4] = 0; - (*(tint_symbol_84)).numbers.arr[4] = x_895; + int const x_895 = (*(tint_symbol_84)).numbers[4]; + (*(tint_symbol_84)).numbers[4] = 0; + (*(tint_symbol_84)).numbers[4] = x_895; float const x_896 = uv[1]; uv[1] = 0.0f; uv[1] = x_896; @@ -1405,7 +1414,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t color[1] = x_897; color[2] = (x_304 + float(x_301)); float2 const x_898 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_898; float const x_899 = uv[0]; uv[0] = 0.0f; @@ -1429,7 +1438,7 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t float const x_904 = color[2]; color[2] = 0.0f; color[2] = x_904; - float3 const x_510 = float3(float3(1.0f, 2.0f, 3.0f)[1], x_485[1], x_485[2]); + float3 const x_510 = float3(2.0f, x_485[1], x_485[2]); float const x_905 = color[2]; color[2] = 0.0f; color[2] = x_905; @@ -1438,29 +1447,29 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t i_2 = x_906; float2 const x_511 = float2(x_485[2], x_485[1]); float3 const x_907 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_907; float const x_908 = uv[1]; uv[1] = 0.0f; uv[1] = x_908; float3 const x_512 = float3(x_455[1], x_455[1], x_455[1]); - int const x_909 = (*(tint_symbol_84)).numbers.arr[4]; - (*(tint_symbol_84)).numbers.arr[4] = 0; - (*(tint_symbol_84)).numbers.arr[4] = x_909; + int const x_909 = (*(tint_symbol_84)).numbers[4]; + (*(tint_symbol_84)).numbers[4] = 0; + (*(tint_symbol_84)).numbers[4] = x_909; if ((fabs((x_308 - x_310)) < 0.25f)) { float const x_910 = uv[0]; uv[0] = 0.0f; uv[0] = x_910; QuicksortObject const x_911 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_72 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_72 = tint_array{}; QuicksortObject const tint_symbol_73 = {.numbers=tint_symbol_72}; *(tint_symbol_84) = tint_symbol_73; *(tint_symbol_84) = x_911; float3 const x_513 = float3(x_505[2], x_505[0], x_448[0]); - int const x_912 = (*(tint_symbol_84)).numbers.arr[8]; - (*(tint_symbol_84)).numbers.arr[8] = 0; - (*(tint_symbol_84)).numbers.arr[8] = x_912; - int const x_317 = (*(tint_symbol_84)).numbers.arr[9u]; + int const x_912 = (*(tint_symbol_84)).numbers[8]; + (*(tint_symbol_84)).numbers[8] = 0; + (*(tint_symbol_84)).numbers[8] = x_912; + int const x_317 = (*(tint_symbol_84)).numbers[9u]; float3 const x_514 = float3(x_474[1], x_474[1], x_474[1]); float const x_913 = uv[1]; uv[1] = 0.0f; @@ -1474,16 +1483,16 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t color[0] = 0.0f; color[0] = x_915; float3 const x_916 = color; - color = float3(0.0f, 0.0f, 0.0f); + color = float3(0.0f); color = x_916; float2 const x_516 = float2(x_452[0], x_452[0]); float2 const x_917 = uv; - uv = float2(0.0f, 0.0f); + uv = float2(0.0f); uv = x_917; float const x_918 = uv[0]; uv[0] = 0.0f; uv[0] = x_918; - float3 const x_517 = float3(float2()[0], float2()[0], float2()[1]); + float3 const x_517 = float3(0.0f); color[0] = (float(x_317) + x_320); float const x_919 = color[0]; color[0] = 0.0f; @@ -1506,12 +1515,12 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t uv[0] = 0.0f; uv[0] = x_923; QuicksortObject const x_924 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_74 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_74 = tint_array{}; QuicksortObject const tint_symbol_75 = {.numbers=tint_symbol_74}; *(tint_symbol_84) = tint_symbol_75; *(tint_symbol_84) = x_924; QuicksortObject const x_925 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_76 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_76 = tint_array{}; QuicksortObject const tint_symbol_77 = {.numbers=tint_symbol_76}; *(tint_symbol_84) = tint_symbol_77; *(tint_symbol_84) = x_925; @@ -1526,13 +1535,13 @@ void main_1(thread QuicksortObject* const tint_symbol_84, thread float4* const t float const x_928 = uv[1]; uv[1] = 0.0f; uv[1] = x_928; - float3 const x_521 = float3(float3(1.0f, 2.0f, 3.0f)[1], float3(1.0f, 2.0f, 3.0f)[1], x_520[1]); + float3 const x_521 = float3(2.0f, 2.0f, x_520[1]); float const x_929 = uv[0]; uv[0] = 0.0f; uv[0] = x_929; *(tint_symbol_87) = x_330; QuicksortObject const x_930 = *(tint_symbol_84); - tint_array_wrapper const tint_symbol_78 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + tint_array const tint_symbol_78 = tint_array{}; QuicksortObject const tint_symbol_79 = {.numbers=tint_symbol_78}; *(tint_symbol_84) = tint_symbol_79; *(tint_symbol_84) = x_930; diff --git a/test/tint/bug/tint/749.spvasm.expected.spvasm b/test/tint/bug/tint/749.spvasm.expected.spvasm index 5f5c422d9f..2953b7a1c6 100644 --- a/test/tint/bug/tint/749.spvasm.expected.spvasm +++ b/test/tint/bug/tint/749.spvasm.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 1833 +; Bound: 1768 ; Schema: 0 OpCapability Shader - %1694 = OpExtInstImport "GLSL.std.450" + %1635 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" %gl_FragCoord_param_1 %x_GLF_color_1_1 OpExecutionMode %main OriginUpperLeft @@ -87,37 +87,41 @@ %_ptr_Function_int = OpTypePointer Function %int %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %31 = OpConstantNull %int - %int_0 = OpConstant %int 0 %v3float = OpTypeVector %float 3 - %float_1 = OpConstant %float 1 - %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %38 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_2 = OpConstant %float 2 + %36 = OpConstantComposite %v3float %float_3 %float_2 %float_3 %uint_0 = OpConstant %uint 0 %_ptr_Private_int = OpTypePointer Private %int - %102 = OpConstantComposite %_arr_int_uint_10 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 - %103 = OpConstantComposite %QuicksortObject %102 - %154 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %float_1 = OpConstant %float 1 + %146 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int %_ptr_Function_v2float = OpTypePointer Function %v2float - %168 = OpConstantNull %v2float + %160 = OpConstantNull %v2float %_ptr_Function_v3float = OpTypePointer Function %v3float - %171 = OpConstantNull %v3float + %163 = OpConstantNull %v3float + %181 = OpConstantComposite %v3float %float_3 %float_1 %float_3 %uint_1 = OpConstant %uint 1 %int_10 = OpConstant %int 10 + %217 = OpConstantComposite %v2float %float_2 %float_3 %_ptr_Function_float = OpTypePointer Function %float %bool = OpTypeBool %int_1 = OpConstant %int 1 - %419 = OpTypeFunction %void + %402 = OpTypeFunction %void %_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 - %429 = OpConstantNull %_arr_int_uint_10 + %412 = OpConstantNull %_arr_int_uint_10 %int_9 = OpConstant %int 9 + %417 = OpConstantComposite %v2float %float_2 %float_2 %int_n1 = OpConstant %int -1 - %float_0 = OpConstant %float 0 - %876 = OpConstantComposite %v2float %float_0 %float_0 + %422 = OpConstantComposite %v2float %float_1 %float_1 + %499 = OpConstantNull %uint + %709 = OpConstantComposite %v2float %float_1 %float_2 %true = OpConstantTrue %bool - %888 = OpConstantComposite %v3float %float_0 %float_0 %float_0 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %890 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %913 = OpConstantNull %float + %915 = OpConstantComposite %v2float %float_3 %float_2 %float_0_25 = OpConstant %float 0.25 + %964 = OpConstantComposite %v2float %float_3 %913 %float_0_5 = OpConstant %float 0.5 %uint_2 = OpConstant %uint 2 %float_0_75 = OpConstant %float 0.75 @@ -129,148 +133,143 @@ %int_8 = OpConstant %int 8 %uint_9 = OpConstant %uint 9 %main_out = OpTypeStruct %v4float - %1820 = OpTypeFunction %main_out %v4float + %1755 = OpTypeFunction %main_out %v4float %swap_i1_i1_ = OpFunction %void None %23 %i = OpFunctionParameter %_ptr_Function_int %j = OpFunctionParameter %_ptr_Function_int %29 = OpLabel %temp = OpVariable %_ptr_Function_int Function %31 %32 = OpLoad %int %temp - OpStore %temp %int_0 + OpStore %temp %31 OpStore %temp %32 - %39 = OpCompositeExtract %float %38 2 - %40 = OpCompositeExtract %float %38 1 - %41 = OpCompositeExtract %float %38 2 - %42 = OpCompositeConstruct %v3float %39 %40 %41 - %44 = OpLoad %int %i - OpStore %i %int_0 - OpStore %i %44 - %48 = OpLoad %int %i - %50 = OpLoad %int %j - OpStore %j %int_0 - OpStore %j %50 - %53 = OpCompositeExtract %float %42 1 - %54 = OpCompositeExtract %float %42 0 - %55 = OpCompositeExtract %float %42 1 - %56 = OpCompositeConstruct %v3float %53 %54 %55 - %57 = OpLoad %int %temp - OpStore %temp %int_0 - OpStore %temp %57 - %60 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - %61 = OpLoad %int %60 - %62 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - OpStore %62 %int_0 - %63 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - OpStore %63 %61 - %64 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - %65 = OpLoad %int %64 - %66 = OpLoad %int %temp - OpStore %temp %int_0 - OpStore %temp %66 - OpStore %temp %65 - %68 = OpLoad %int %j - OpStore %j %int_0 - OpStore %j %68 - %71 = OpCompositeExtract %float %42 2 - %72 = OpCompositeExtract %float %38 0 - %73 = OpCompositeExtract %float %42 1 - %74 = OpCompositeConstruct %v3float %71 %72 %73 - %76 = OpLoad %int %i - OpStore %i %int_0 - OpStore %i %76 - %80 = OpLoad %int %i - %81 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - %82 = OpLoad %int %81 - %83 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - OpStore %83 %int_0 - %84 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - OpStore %84 %82 - %86 = OpLoad %int %j - %88 = OpLoad %int %i - OpStore %i %int_0 - OpStore %i %88 - %91 = OpCompositeExtract %float %74 0 - %92 = OpCompositeExtract %float %74 2 - %93 = OpCompositeExtract %float %74 2 - %94 = OpCompositeConstruct %v3float %91 %92 %93 - %95 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - %96 = OpLoad %int %95 - %97 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - OpStore %97 %int_0 - %98 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 - OpStore %98 %96 - %99 = OpAccessChain %_ptr_Private_int %obj %uint_0 %86 - %100 = OpLoad %int %99 - %101 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %101 - %104 = OpCompositeExtract %float %94 0 - %105 = OpCompositeExtract %float %94 0 - %106 = OpCompositeConstruct %v2float %104 %105 - %107 = OpCompositeExtract %float %56 0 - %108 = OpCompositeExtract %float %56 2 - %109 = OpCompositeExtract %float %56 0 - %110 = OpCompositeConstruct %v3float %107 %108 %109 - %111 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 - OpStore %111 %100 - %112 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %112 - %113 = OpCompositeExtract %float %94 1 - %114 = OpCompositeExtract %float %94 2 - %115 = OpCompositeExtract %float %94 0 - %116 = OpCompositeConstruct %v3float %113 %114 %115 - %118 = OpLoad %int %i - OpStore %i %int_0 - OpStore %i %118 - %122 = OpLoad %int %j + %38 = OpLoad %int %i + OpStore %i %31 + OpStore %i %38 + %42 = OpLoad %int %i + %44 = OpLoad %int %j + OpStore %j %31 + OpStore %j %44 + %47 = OpCompositeExtract %float %36 1 + %48 = OpCompositeExtract %float %36 0 + %49 = OpCompositeExtract %float %36 1 + %50 = OpCompositeConstruct %v3float %47 %48 %49 + %51 = OpLoad %int %temp + OpStore %temp %31 + OpStore %temp %51 + %54 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + OpStore %56 %31 + %57 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + OpStore %57 %55 + %58 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + %59 = OpLoad %int %58 + %60 = OpLoad %int %temp + OpStore %temp %31 + OpStore %temp %60 + OpStore %temp %59 + %62 = OpLoad %int %j + OpStore %j %31 + OpStore %j %62 + %65 = OpCompositeExtract %float %36 2 + %67 = OpCompositeExtract %float %36 1 + %68 = OpCompositeConstruct %v3float %65 %float_1 %67 + %70 = OpLoad %int %i + OpStore %i %31 + OpStore %i %70 + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + OpStore %77 %31 + %78 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + OpStore %78 %76 + %80 = OpLoad %int %j + %82 = OpLoad %int %i + OpStore %i %31 + OpStore %i %82 + %85 = OpCompositeExtract %float %68 0 + %86 = OpCompositeExtract %float %68 2 + %87 = OpCompositeExtract %float %68 2 + %88 = OpCompositeConstruct %v3float %85 %86 %87 + %89 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + OpStore %91 %31 + %92 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + OpStore %92 %90 + %93 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 + %94 = OpLoad %int %93 + %95 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %95 + %96 = OpCompositeExtract %float %88 0 + %97 = OpCompositeExtract %float %88 0 + %98 = OpCompositeConstruct %v2float %96 %97 + %99 = OpCompositeExtract %float %50 0 + %100 = OpCompositeExtract %float %50 2 + %101 = OpCompositeExtract %float %50 0 + %102 = OpCompositeConstruct %v3float %99 %100 %101 + %103 = OpAccessChain %_ptr_Private_int %obj %uint_0 %74 + OpStore %103 %94 + %104 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %104 + %105 = OpCompositeExtract %float %88 1 + %106 = OpCompositeExtract %float %88 2 + %107 = OpCompositeExtract %float %88 0 + %108 = OpCompositeConstruct %v3float %105 %106 %107 + %110 = OpLoad %int %i + OpStore %i %31 + OpStore %i %110 + %114 = OpLoad %int %j + %115 = OpLoad %int %temp + OpStore %temp %31 + OpStore %temp %115 + %116 = OpCompositeExtract %float %108 2 + %117 = OpCompositeExtract %float %108 1 + %118 = OpCompositeConstruct %v2float %116 %117 + %119 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 + OpStore %121 %31 + %122 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 + OpStore %122 %120 %123 = OpLoad %int %temp - OpStore %temp %int_0 - OpStore %temp %123 - %124 = OpCompositeExtract %float %116 2 - %125 = OpCompositeExtract %float %116 1 - %126 = OpCompositeConstruct %v2float %124 %125 - %127 = OpAccessChain %_ptr_Private_int %obj %uint_0 %86 - %128 = OpLoad %int %127 - %129 = OpAccessChain %_ptr_Private_int %obj %uint_0 %86 - OpStore %129 %int_0 - %130 = OpAccessChain %_ptr_Private_int %obj %uint_0 %86 - OpStore %130 %128 - %131 = OpLoad %int %temp - %133 = OpLoad %int %j - OpStore %j %int_0 - OpStore %j %133 - %136 = OpCompositeExtract %float %106 0 - %137 = OpCompositeExtract %float %94 1 - %138 = OpCompositeExtract %float %94 0 - %139 = OpCompositeConstruct %v3float %136 %137 %138 - %140 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 - %141 = OpLoad %int %140 - %142 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 - OpStore %142 %int_0 + %125 = OpLoad %int %j + OpStore %j %31 + OpStore %j %125 + %128 = OpCompositeExtract %float %98 0 + %129 = OpCompositeExtract %float %88 1 + %130 = OpCompositeExtract %float %88 0 + %131 = OpCompositeConstruct %v3float %128 %129 %130 + %132 = OpAccessChain %_ptr_Private_int %obj %uint_0 %74 + %133 = OpLoad %int %132 + %134 = OpAccessChain %_ptr_Private_int %obj %uint_0 %74 + OpStore %134 %31 + %135 = OpAccessChain %_ptr_Private_int %obj %uint_0 %74 + OpStore %135 %133 + %136 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %136 + %137 = OpCompositeExtract %float %102 0 + %138 = OpCompositeExtract %float %102 1 + %139 = OpCompositeExtract %float %102 0 + %140 = OpCompositeConstruct %v3float %137 %138 %139 + %141 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 + %142 = OpLoad %int %141 %143 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 - OpStore %143 %141 - %144 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %144 - %145 = OpCompositeExtract %float %110 0 - %146 = OpCompositeExtract %float %110 1 - %147 = OpCompositeExtract %float %110 0 - %148 = OpCompositeConstruct %v3float %145 %146 %147 - %149 = OpAccessChain %_ptr_Private_int %obj %uint_0 %86 - %150 = OpLoad %int %149 - %151 = OpAccessChain %_ptr_Private_int %obj %uint_0 %86 - OpStore %151 %int_0 - %152 = OpAccessChain %_ptr_Private_int %obj %uint_0 %86 - OpStore %152 %150 - %153 = OpAccessChain %_ptr_Private_int %obj %uint_0 %122 - OpStore %153 %131 + OpStore %143 %31 + %144 = OpAccessChain %_ptr_Private_int %obj %uint_0 %80 + OpStore %144 %142 + %145 = OpAccessChain %_ptr_Private_int %obj %uint_0 %114 + OpStore %145 %123 OpReturn OpFunctionEnd -%performPartition_i1_i1_ = OpFunction %int None %154 +%performPartition_i1_i1_ = OpFunction %int None %146 %l = OpFunctionParameter %_ptr_Function_int %h = OpFunctionParameter %_ptr_Function_int - %158 = OpLabel + %150 = OpLabel %param_3 = OpVariable %_ptr_Function_int Function %31 %i_1 = OpVariable %_ptr_Function_int Function %31 %j_1 = OpVariable %_ptr_Function_int Function %31 @@ -278,2366 +277,2302 @@ %param_1 = OpVariable %_ptr_Function_int Function %31 %param = OpVariable %_ptr_Function_int Function %31 %pivot = OpVariable %_ptr_Function_int Function %31 - %x_537 = OpVariable %_ptr_Function_v2float Function %168 - %x_538 = OpVariable %_ptr_Function_v3float Function %171 - %173 = OpLoad %int %h - OpStore %h %int_0 - OpStore %h %173 - %177 = OpLoad %int %h - %179 = OpLoad %int %l - OpStore %l %int_0 - OpStore %l %179 - %182 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - %183 = OpLoad %int %182 - %184 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - OpStore %184 %int_0 - %185 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - OpStore %185 %183 - %186 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - %187 = OpLoad %int %186 - %188 = OpLoad %int %param_3 - OpStore %param_3 %int_0 - OpStore %param_3 %188 - %189 = OpCompositeExtract %float %38 2 - %190 = OpCompositeExtract %float %38 0 - %191 = OpCompositeExtract %float %38 2 - %192 = OpCompositeConstruct %v3float %189 %190 %191 - %193 = OpLoad %int %param_1 - OpStore %param_1 %int_0 - OpStore %param_1 %193 - OpStore %pivot %187 + %x_537 = OpVariable %_ptr_Function_v2float Function %160 + %x_538 = OpVariable %_ptr_Function_v3float Function %163 + %165 = OpLoad %int %h + OpStore %h %31 + OpStore %h %165 + %169 = OpLoad %int %h + %171 = OpLoad %int %l + OpStore %l %31 + OpStore %l %171 + %174 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + %175 = OpLoad %int %174 + %176 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + OpStore %176 %31 + %177 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + OpStore %177 %175 + %178 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + %179 = OpLoad %int %178 + %180 = OpLoad %int %param_3 + OpStore %param_3 %31 + OpStore %param_3 %180 + %182 = OpLoad %int %param_1 + OpStore %param_1 %31 + OpStore %param_1 %182 + OpStore %pivot %179 + %184 = OpLoad %int %l + %186 = OpLoad %int %h + OpStore %h %31 + OpStore %h %186 + %189 = OpLoad %int %j_1 + OpStore %j_1 %31 + OpStore %j_1 %189 + %190 = OpCompositeExtract %float %181 1 + %191 = OpCompositeExtract %float %181 2 + %192 = OpCompositeExtract %float %181 1 + %193 = OpCompositeConstruct %v3float %190 %191 %192 %195 = OpLoad %int %l - %197 = OpLoad %int %h - OpStore %h %int_0 - OpStore %h %197 - %200 = OpLoad %int %j_1 - OpStore %j_1 %int_0 - OpStore %j_1 %200 - %201 = OpCompositeExtract %float %192 1 - %202 = OpCompositeExtract %float %192 2 - %203 = OpCompositeExtract %float %192 1 - %204 = OpCompositeConstruct %v3float %201 %202 %203 - %206 = OpLoad %int %l - OpStore %l %int_0 - OpStore %l %206 - %209 = OpBitcast %int %uint_1 - %211 = OpISub %int %195 %209 - OpStore %i_1 %211 - %213 = OpLoad %int %l - %214 = OpCompositeExtract %float %192 0 - %215 = OpCompositeExtract %float %192 2 - %216 = OpCompositeExtract %float %204 0 - %217 = OpCompositeConstruct %v3float %214 %215 %216 + OpStore %l %31 + OpStore %l %195 + %198 = OpBitcast %int %uint_1 + %200 = OpISub %int %184 %198 + OpStore %i_1 %200 + %202 = OpLoad %int %l + %203 = OpCompositeExtract %float %181 0 + %204 = OpCompositeExtract %float %181 2 + %205 = OpCompositeExtract %float %193 0 + %206 = OpCompositeConstruct %v3float %203 %204 %205 OpStore %j_1 %int_10 - %219 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %219 - OpBranch %220 - %220 = OpLabel - OpLoopMerge %221 %222 None - OpBranch %223 - %223 = OpLabel - %224 = OpLoad %int %pivot - OpStore %pivot %int_0 - OpStore %pivot %224 - %225 = OpLoad %int %param_1 - OpStore %param_1 %int_0 - OpStore %param_1 %225 + %208 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %208 + OpBranch %209 + %209 = OpLabel + OpLoopMerge %210 %211 None + OpBranch %212 + %212 = OpLabel + %213 = OpLoad %int %pivot + OpStore %pivot %31 + OpStore %pivot %213 + %214 = OpLoad %int %param_1 + OpStore %param_1 %31 + OpStore %param_1 %214 + %215 = OpLoad %int %j_1 + %216 = OpLoad %int %pivot + OpStore %pivot %31 + OpStore %pivot %216 + OpStore %x_537 %217 + %218 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %218 + %220 = OpLoad %int %h + %222 = OpLoad %int %h + OpStore %h %31 + OpStore %h %222 + %225 = OpLoad %int %param + OpStore %param %31 + OpStore %param %225 %226 = OpLoad %int %j_1 - %227 = OpLoad %int %pivot - OpStore %pivot %int_0 - OpStore %pivot %227 - %228 = OpCompositeExtract %float %38 1 - %229 = OpCompositeExtract %float %38 2 - %230 = OpCompositeConstruct %v2float %228 %229 - OpStore %x_537 %230 - %231 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %231 - %233 = OpLoad %int %h - %235 = OpLoad %int %h - OpStore %h %int_0 - OpStore %h %235 - %238 = OpLoad %int %param - OpStore %param %int_0 - OpStore %param %238 - %239 = OpLoad %int %j_1 - OpStore %j_1 %int_0 - OpStore %j_1 %239 - %240 = OpCompositeExtract %float %192 0 - %242 = OpAccessChain %_ptr_Function_float %x_537 %uint_1 - %243 = OpLoad %float %242 - %244 = OpCompositeExtract %float %192 2 - %245 = OpCompositeConstruct %v3float %240 %243 %244 - OpStore %x_538 %245 - %246 = OpLoad %int %param - OpStore %param %int_0 - OpStore %param %246 - %247 = OpBitcast %int %uint_1 - %248 = OpISub %int %233 %247 - %249 = OpSLessThanEqual %bool %226 %248 - OpSelectionMerge %251 None - OpBranchConditional %249 %252 %253 - %252 = OpLabel - OpBranch %251 - %253 = OpLabel - OpBranch %221 - %251 = OpLabel - %254 = OpLoad %int %j_1 - %255 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - %256 = OpLoad %int %255 - %257 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - OpStore %257 %int_0 - %258 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - OpStore %258 %256 - %260 = OpLoad %int %h - OpStore %h %int_0 - OpStore %h %260 - %263 = OpAccessChain %_ptr_Function_float %x_537 %uint_0 - %264 = OpLoad %float %263 - %265 = OpCompositeExtract %float %204 2 - %266 = OpAccessChain %_ptr_Function_float %x_537 %uint_0 - %267 = OpLoad %float %266 - %268 = OpCompositeConstruct %v3float %264 %265 %267 - %269 = OpLoad %int %param_1 - OpStore %param_1 %int_0 - OpStore %param_1 %269 - %270 = OpAccessChain %_ptr_Private_int %obj %uint_0 %254 - %271 = OpLoad %int %270 - %272 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %272 - %273 = OpLoad %int %pivot - %274 = OpCompositeExtract %float %38 1 - %275 = OpCompositeExtract %float %192 2 - %276 = OpCompositeConstruct %v2float %274 %275 - %277 = OpLoad %int %i_1 - OpStore %i_1 %int_0 - OpStore %i_1 %277 - %279 = OpLoad %int %l - OpStore %l %int_0 - OpStore %l %279 - %282 = OpCompositeExtract %float %192 1 - %283 = OpCompositeExtract %float %192 0 - %284 = OpCompositeExtract %float %192 1 - %285 = OpCompositeConstruct %v3float %282 %283 %284 - %286 = OpLoad %int %pivot - OpStore %pivot %int_0 - OpStore %pivot %286 - %287 = OpSLessThanEqual %bool %271 %273 - OpSelectionMerge %288 None - OpBranchConditional %287 %289 %288 - %289 = OpLabel - %290 = OpCompositeExtract %float %285 2 - %291 = OpCompositeExtract %float %285 0 - %292 = OpCompositeExtract %float %285 0 - %293 = OpCompositeConstruct %v3float %290 %291 %292 - %294 = OpLoad %int %param_3 - OpStore %param_3 %int_0 - OpStore %param_3 %294 - %295 = OpLoad %int %i_1 - %296 = OpLoad %int %pivot - OpStore %pivot %int_0 - OpStore %pivot %296 - %297 = OpCompositeExtract %float %268 0 - %298 = OpCompositeExtract %float %285 1 - %299 = OpCompositeConstruct %v2float %297 %298 - %300 = OpLoad %int %i_1 - OpStore %i_1 %int_0 - OpStore %i_1 %300 - %301 = OpLoad %int %param - OpStore %param %int_0 - OpStore %param %301 - %302 = OpBitcast %int %uint_1 - %303 = OpIAdd %int %295 %302 - OpStore %i_1 %303 - %305 = OpLoad %int %l - OpStore %l %int_0 - OpStore %l %305 - %308 = OpCompositeExtract %float %38 2 - %309 = OpCompositeExtract %float %38 1 - %310 = OpCompositeExtract %float %276 0 - %311 = OpCompositeConstruct %v3float %308 %309 %310 - %312 = OpLoad %int %i_1 - %313 = OpAccessChain %_ptr_Function_float %x_537 %uint_1 - %314 = OpLoad %float %313 - %315 = OpAccessChain %_ptr_Function_float %x_538 %uint_0 - %316 = OpLoad %float %315 - %317 = OpCompositeConstruct %v2float %314 %316 - %318 = OpLoad %int %param - OpStore %param %int_0 - OpStore %param %318 - OpStore %param %312 - %319 = OpLoad %int %param - OpStore %param %int_0 - OpStore %param %319 - %320 = OpCompositeExtract %float %317 0 - %321 = OpCompositeExtract %float %317 0 - %322 = OpCompositeConstruct %v2float %320 %321 - %323 = OpLoad %int %i_1 - OpStore %i_1 %int_0 - OpStore %i_1 %323 - %324 = OpLoad %int %j_1 - OpStore %param_1 %324 - %325 = OpLoad %int %param_3 - OpStore %param_3 %int_0 - OpStore %param_3 %325 - %326 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 - %329 = OpLoad %int %param_1 - OpStore %param_1 %int_0 - OpStore %param_1 %329 - OpBranch %288 - %288 = OpLabel - %330 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %330 - OpBranch %222 - %222 = OpLabel - %332 = OpLoad %int %h - OpStore %h %int_0 - OpStore %h %332 - %335 = OpLoad %int %j_1 - %337 = OpLoad %int %h - OpStore %h %int_0 - OpStore %h %337 - %340 = OpCompositeExtract %float %268 0 - %341 = OpCompositeExtract %float %285 2 - %342 = OpCompositeExtract %float %285 2 - %343 = OpCompositeConstruct %v3float %340 %341 %342 - %344 = OpAccessChain %_ptr_Private_int %obj %uint_0 %254 - %345 = OpLoad %int %344 - %346 = OpAccessChain %_ptr_Private_int %obj %uint_0 %254 - OpStore %346 %int_0 - %347 = OpAccessChain %_ptr_Private_int %obj %uint_0 %254 - OpStore %347 %345 - %348 = OpLoad %int %param - OpStore %param %int_0 - OpStore %param %348 - %350 = OpIAdd %int %int_1 %335 - OpStore %j_1 %350 - %351 = OpLoad %int %param_1 - OpStore %param_1 %int_0 - OpStore %param_1 %351 - %352 = OpCompositeExtract %float %285 1 - %353 = OpCompositeExtract %float %285 2 - %354 = OpCompositeExtract %float %285 0 - %355 = OpCompositeConstruct %v3float %352 %353 %354 - %356 = OpAccessChain %_ptr_Private_int %obj %uint_0 %254 - %357 = OpLoad %int %356 - %358 = OpAccessChain %_ptr_Private_int %obj %uint_0 %254 - OpStore %358 %int_0 - %359 = OpAccessChain %_ptr_Private_int %obj %uint_0 %254 - OpStore %359 %357 - OpBranch %220 - %221 = OpLabel - %360 = OpLoad %int %i_1 - %361 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - %362 = OpLoad %int %361 - %363 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - OpStore %363 %int_0 - %364 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 - OpStore %364 %362 - %365 = OpCompositeExtract %float %192 0 - %366 = OpCompositeExtract %float %192 1 + OpStore %j_1 %31 + OpStore %j_1 %226 + %227 = OpCompositeExtract %float %181 0 + %229 = OpAccessChain %_ptr_Function_float %x_537 %uint_1 + %230 = OpLoad %float %229 + %231 = OpCompositeExtract %float %181 2 + %232 = OpCompositeConstruct %v3float %227 %230 %231 + OpStore %x_538 %232 + %233 = OpLoad %int %param + OpStore %param %31 + OpStore %param %233 + %234 = OpBitcast %int %uint_1 + %235 = OpISub %int %220 %234 + %236 = OpSLessThanEqual %bool %215 %235 + OpSelectionMerge %238 None + OpBranchConditional %236 %239 %240 + %239 = OpLabel + OpBranch %238 + %240 = OpLabel + OpBranch %210 + %238 = OpLabel + %241 = OpLoad %int %j_1 + %242 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + %243 = OpLoad %int %242 + %244 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + OpStore %244 %31 + %245 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + OpStore %245 %243 + %247 = OpLoad %int %h + OpStore %h %31 + OpStore %h %247 + %250 = OpAccessChain %_ptr_Function_float %x_537 %uint_0 + %251 = OpLoad %float %250 + %252 = OpCompositeExtract %float %193 2 + %253 = OpAccessChain %_ptr_Function_float %x_537 %uint_0 + %254 = OpLoad %float %253 + %255 = OpCompositeConstruct %v3float %251 %252 %254 + %256 = OpLoad %int %param_1 + OpStore %param_1 %31 + OpStore %param_1 %256 + %257 = OpAccessChain %_ptr_Private_int %obj %uint_0 %241 + %258 = OpLoad %int %257 + %259 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %259 + %260 = OpLoad %int %pivot + %261 = OpCompositeExtract %float %181 2 + %262 = OpCompositeConstruct %v2float %float_2 %261 + %263 = OpLoad %int %i_1 + OpStore %i_1 %31 + OpStore %i_1 %263 + %265 = OpLoad %int %l + OpStore %l %31 + OpStore %l %265 + %268 = OpCompositeExtract %float %181 1 + %269 = OpCompositeExtract %float %181 0 + %270 = OpCompositeExtract %float %181 1 + %271 = OpCompositeConstruct %v3float %268 %269 %270 + %272 = OpLoad %int %pivot + OpStore %pivot %31 + OpStore %pivot %272 + %273 = OpSLessThanEqual %bool %258 %260 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %274 + %275 = OpLabel + %276 = OpCompositeExtract %float %271 2 + %277 = OpCompositeExtract %float %271 0 + %278 = OpCompositeExtract %float %271 0 + %279 = OpCompositeConstruct %v3float %276 %277 %278 + %280 = OpLoad %int %param_3 + OpStore %param_3 %31 + OpStore %param_3 %280 + %281 = OpLoad %int %i_1 + %282 = OpLoad %int %pivot + OpStore %pivot %31 + OpStore %pivot %282 + %283 = OpCompositeExtract %float %255 0 + %284 = OpCompositeExtract %float %271 1 + %285 = OpCompositeConstruct %v2float %283 %284 + %286 = OpLoad %int %i_1 + OpStore %i_1 %31 + OpStore %i_1 %286 + %287 = OpLoad %int %param + OpStore %param %31 + OpStore %param %287 + %288 = OpBitcast %int %uint_1 + %289 = OpIAdd %int %281 %288 + OpStore %i_1 %289 + %291 = OpLoad %int %l + OpStore %l %31 + OpStore %l %291 + %294 = OpCompositeExtract %float %262 0 + %295 = OpCompositeConstruct %v3float %float_3 %float_2 %294 + %296 = OpLoad %int %i_1 + %297 = OpAccessChain %_ptr_Function_float %x_537 %uint_1 + %298 = OpLoad %float %297 + %299 = OpAccessChain %_ptr_Function_float %x_538 %uint_0 + %300 = OpLoad %float %299 + %301 = OpCompositeConstruct %v2float %298 %300 + %302 = OpLoad %int %param + OpStore %param %31 + OpStore %param %302 + OpStore %param %296 + %303 = OpLoad %int %param + OpStore %param %31 + OpStore %param %303 + %304 = OpCompositeExtract %float %301 0 + %305 = OpCompositeExtract %float %301 0 + %306 = OpCompositeConstruct %v2float %304 %305 + %307 = OpLoad %int %i_1 + OpStore %i_1 %31 + OpStore %i_1 %307 + %308 = OpLoad %int %j_1 + OpStore %param_1 %308 + %309 = OpLoad %int %param_3 + OpStore %param_3 %31 + OpStore %param_3 %309 + %310 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + %313 = OpLoad %int %param_1 + OpStore %param_1 %31 + OpStore %param_1 %313 + OpBranch %274 + %274 = OpLabel + %314 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %314 + OpBranch %211 + %211 = OpLabel + %316 = OpLoad %int %h + OpStore %h %31 + OpStore %h %316 + %319 = OpLoad %int %j_1 + %321 = OpLoad %int %h + OpStore %h %31 + OpStore %h %321 + %324 = OpCompositeExtract %float %255 0 + %325 = OpCompositeExtract %float %271 2 + %326 = OpCompositeExtract %float %271 2 + %327 = OpCompositeConstruct %v3float %324 %325 %326 + %328 = OpAccessChain %_ptr_Private_int %obj %uint_0 %241 + %329 = OpLoad %int %328 + %330 = OpAccessChain %_ptr_Private_int %obj %uint_0 %241 + OpStore %330 %31 + %331 = OpAccessChain %_ptr_Private_int %obj %uint_0 %241 + OpStore %331 %329 + %332 = OpLoad %int %param + OpStore %param %31 + OpStore %param %332 + %334 = OpIAdd %int %int_1 %319 + OpStore %j_1 %334 + %335 = OpLoad %int %param_1 + OpStore %param_1 %31 + OpStore %param_1 %335 + %336 = OpCompositeExtract %float %271 1 + %337 = OpCompositeExtract %float %271 2 + %338 = OpCompositeExtract %float %271 0 + %339 = OpCompositeConstruct %v3float %336 %337 %338 + %340 = OpAccessChain %_ptr_Private_int %obj %uint_0 %241 + %341 = OpLoad %int %340 + %342 = OpAccessChain %_ptr_Private_int %obj %uint_0 %241 + OpStore %342 %31 + %343 = OpAccessChain %_ptr_Private_int %obj %uint_0 %241 + OpStore %343 %341 + OpBranch %209 + %210 = OpLabel + %344 = OpLoad %int %i_1 + %345 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + %346 = OpLoad %int %345 + %347 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + OpStore %347 %31 + %348 = OpAccessChain %_ptr_Private_int %obj %uint_0 %169 + OpStore %348 %346 + %349 = OpCompositeExtract %float %181 0 + %350 = OpCompositeExtract %float %181 1 + %351 = OpCompositeConstruct %v2float %349 %350 + %352 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %352 + %354 = OpLoad %int %h + OpStore %h %31 + OpStore %h %354 + %357 = OpIAdd %int %int_1 %344 + OpStore %i_1 %357 + %358 = OpLoad %int %param_1 + OpStore %param_1 %31 + OpStore %param_1 %358 + %359 = OpLoad %int %i_1 + %360 = OpLoad %int %j_1 + OpStore %j_1 %31 + OpStore %j_1 %360 + %361 = OpCompositeExtract %float %181 0 + %362 = OpCompositeExtract %float %181 0 + %363 = OpCompositeConstruct %v2float %361 %362 + %364 = OpLoad %int %param_1 + OpStore %param_1 %31 + OpStore %param_1 %364 + OpStore %param_2 %359 + %365 = OpCompositeExtract %float %181 1 + %366 = OpCompositeExtract %float %206 0 %367 = OpCompositeConstruct %v2float %365 %366 - %368 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %368 + %368 = OpLoad %int %pivot + OpStore %pivot %31 + OpStore %pivot %368 %370 = OpLoad %int %h - OpStore %h %int_0 - OpStore %h %370 - %373 = OpIAdd %int %int_1 %360 - OpStore %i_1 %373 - %374 = OpLoad %int %param_1 - OpStore %param_1 %int_0 - OpStore %param_1 %374 - %375 = OpLoad %int %i_1 - %376 = OpLoad %int %j_1 - OpStore %j_1 %int_0 - OpStore %j_1 %376 - %377 = OpCompositeExtract %float %192 0 - %378 = OpCompositeExtract %float %192 0 - %379 = OpCompositeConstruct %v2float %377 %378 - %380 = OpLoad %int %param_1 - OpStore %param_1 %int_0 - OpStore %param_1 %380 - OpStore %param_2 %375 - %381 = OpCompositeExtract %float %192 1 - %382 = OpCompositeExtract %float %217 0 - %383 = OpCompositeConstruct %v2float %381 %382 - %384 = OpLoad %int %pivot - OpStore %pivot %int_0 - OpStore %pivot %384 - %386 = OpLoad %int %h - %387 = OpCompositeExtract %float %379 0 - %388 = OpCompositeExtract %float %367 1 - %389 = OpCompositeConstruct %v2float %387 %388 - %391 = OpLoad %int %h - OpStore %h %int_0 - OpStore %h %391 - OpStore %param_3 %386 - %394 = OpLoad %int %i_1 - OpStore %i_1 %int_0 - OpStore %i_1 %394 - %395 = OpCompositeExtract %float %367 1 - %396 = OpCompositeExtract %float %389 0 - %397 = OpCompositeConstruct %v2float %395 %396 - %399 = OpLoad %int %h - OpStore %h %int_0 - OpStore %h %399 - %402 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 - %406 = OpLoad %int %l - OpStore %l %int_0 - OpStore %l %406 - %409 = OpCompositeExtract %float %217 2 - %410 = OpCompositeExtract %float %38 1 - %411 = OpCompositeConstruct %v2float %409 %410 - %412 = OpLoad %int %param_1 - OpStore %param_1 %int_0 - OpStore %param_1 %412 - %413 = OpLoad %int %i_1 - %414 = OpLoad %int %param - OpStore %param %int_0 - OpStore %param %414 - %415 = OpCompositeExtract %float %192 1 - %416 = OpCompositeExtract %float %192 0 - %417 = OpCompositeConstruct %v2float %415 %416 - %418 = OpLoad %int %j_1 - OpStore %j_1 %int_0 - OpStore %j_1 %418 - OpReturnValue %413 + %371 = OpCompositeExtract %float %363 0 + %372 = OpCompositeExtract %float %351 1 + %373 = OpCompositeConstruct %v2float %371 %372 + %375 = OpLoad %int %h + OpStore %h %31 + OpStore %h %375 + OpStore %param_3 %370 + %378 = OpLoad %int %i_1 + OpStore %i_1 %31 + OpStore %i_1 %378 + %379 = OpCompositeExtract %float %351 1 + %380 = OpCompositeExtract %float %373 0 + %381 = OpCompositeConstruct %v2float %379 %380 + %383 = OpLoad %int %h + OpStore %h %31 + OpStore %h %383 + %386 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %390 = OpLoad %int %l + OpStore %l %31 + OpStore %l %390 + %393 = OpCompositeExtract %float %206 2 + %394 = OpCompositeConstruct %v2float %393 %float_2 + %395 = OpLoad %int %param_1 + OpStore %param_1 %31 + OpStore %param_1 %395 + %396 = OpLoad %int %i_1 + %397 = OpLoad %int %param + OpStore %param %31 + OpStore %param %397 + %398 = OpCompositeExtract %float %181 1 + %399 = OpCompositeExtract %float %181 0 + %400 = OpCompositeConstruct %v2float %398 %399 + %401 = OpLoad %int %j_1 + OpStore %j_1 %31 + OpStore %j_1 %401 + OpReturnValue %396 OpFunctionEnd - %quicksort_ = OpFunction %void None %419 - %421 = OpLabel + %quicksort_ = OpFunction %void None %402 + %404 = OpLabel %param_4 = OpVariable %_ptr_Function_int Function %31 %h_1 = OpVariable %_ptr_Function_int Function %31 %p = OpVariable %_ptr_Function_int Function %31 %l_1 = OpVariable %_ptr_Function_int Function %31 %top = OpVariable %_ptr_Function_int Function %31 - %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %429 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %412 %param_5 = OpVariable %_ptr_Function_int Function %31 - OpStore %l_1 %int_0 - %431 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %431 + OpStore %l_1 %31 + %414 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %414 OpStore %h_1 %int_9 - %433 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %433 - %434 = OpCompositeExtract %float %38 1 - %435 = OpCompositeExtract %float %38 1 - %436 = OpCompositeConstruct %v2float %434 %435 - %437 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %437 + %416 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %416 + %418 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %418 OpStore %top %int_n1 - %439 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %439 - %440 = OpLoad %int %top - %441 = OpCompositeExtract %float %38 0 - %442 = OpCompositeExtract %float %38 0 - %443 = OpCompositeConstruct %v2float %441 %442 - %444 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %444 - %445 = OpBitcast %int %uint_1 - %446 = OpIAdd %int %440 %445 - %447 = OpLoad %int %top - OpStore %top %int_0 - OpStore %top %447 - %448 = OpCompositeExtract %float %436 1 - %449 = OpCompositeExtract %float %443 1 - %450 = OpCompositeConstruct %v2float %448 %449 - %451 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %451 - OpStore %top %446 - %452 = OpLoad %int %h_1 - OpStore %h_1 %int_0 - OpStore %h_1 %452 - %453 = OpCompositeExtract %float %443 1 - %454 = OpCompositeExtract %float %443 0 - %455 = OpCompositeExtract %float %443 0 - %456 = OpCompositeConstruct %v3float %453 %454 %455 - %457 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %457 - %458 = OpLoad %int %l_1 - %459 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %459 - %460 = OpCompositeExtract %float %456 1 - %461 = OpCompositeExtract %float %456 0 - %462 = OpCompositeExtract %float %443 0 - %463 = OpCompositeConstruct %v3float %460 %461 %462 - %464 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %464 - %465 = OpCompositeExtract %float %436 1 - %466 = OpCompositeExtract %float %436 1 - %467 = OpCompositeExtract %float %436 1 - %468 = OpCompositeConstruct %v3float %465 %466 %467 - %469 = OpLoad %int %l_1 - OpStore %l_1 %int_0 - OpStore %l_1 %int_0 - %470 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %470 %458 - %471 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %471 - %472 = OpLoad %int %top - %473 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %473 - %474 = OpCompositeExtract %float %38 2 - %475 = OpCompositeExtract %float %450 1 - %476 = OpCompositeExtract %float %38 1 - %477 = OpCompositeConstruct %v3float %474 %475 %476 - %478 = OpAccessChain %_ptr_Function_int %stack %446 - %479 = OpLoad %int %478 - %480 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %480 %int_0 - %481 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %481 %479 - %482 = OpIAdd %int %472 %int_1 - %483 = OpAccessChain %_ptr_Function_int %stack %446 - %484 = OpLoad %int %483 - %485 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %485 %int_0 - %486 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %486 %484 - %487 = OpCompositeExtract %float %456 0 - %488 = OpCompositeExtract %float %456 2 - %489 = OpCompositeExtract %float %436 1 - %490 = OpCompositeConstruct %v3float %487 %488 %489 - OpStore %top %482 - %491 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %491 - %492 = OpLoad %int %h_1 - %493 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %493 - %494 = OpCompositeExtract %float %450 0 - %495 = OpCompositeExtract %float %468 0 - %496 = OpCompositeExtract %float %450 1 - %497 = OpCompositeConstruct %v3float %494 %495 %496 - %498 = OpLoad %int %l_1 - OpStore %l_1 %int_0 - OpStore %l_1 %498 - %499 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %499 - %500 = OpCompositeExtract %float %497 2 - %501 = OpCompositeExtract %float %497 2 - %502 = OpCompositeConstruct %v2float %500 %501 - %503 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %503 - %504 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %504 %492 - OpBranch %505 - %505 = OpLabel - OpLoopMerge %506 %507 None - OpBranch %508 - %508 = OpLabel - %509 = OpCompositeExtract %float %490 0 - %510 = OpCompositeExtract %float %490 0 - %511 = OpCompositeExtract %float %490 0 - %512 = OpCompositeConstruct %v3float %509 %510 %511 - %513 = OpLoad %int %h_1 - OpStore %h_1 %int_0 - OpStore %h_1 %513 - %514 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %514 - %515 = OpLoad %int %top - %516 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %516 - %517 = OpCompositeExtract %float %450 0 - %518 = OpCompositeExtract %float %497 2 - %519 = OpCompositeConstruct %v2float %517 %518 - %520 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %520 - %521 = OpBitcast %int %uint_0 - %522 = OpSGreaterThanEqual %bool %515 %521 - OpSelectionMerge %523 None - OpBranchConditional %522 %524 %525 - %524 = OpLabel - OpBranch %523 - %525 = OpLabel - OpBranch %506 - %523 = OpLabel - %526 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %526 - %527 = OpCompositeExtract %float %456 1 - %528 = OpCompositeExtract %float %456 0 - %529 = OpCompositeExtract %float %490 1 - %530 = OpCompositeConstruct %v3float %527 %528 %529 - %531 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %531 - %532 = OpLoad %int %top - %533 = OpCompositeExtract %float %502 0 - %534 = OpCompositeExtract %float %519 1 - %535 = OpCompositeExtract %float %502 0 - %536 = OpCompositeConstruct %v3float %533 %534 %535 - %537 = OpLoad %int %h_1 - OpStore %h_1 %int_0 - OpStore %h_1 %537 - %538 = OpCompositeExtract %float %436 0 - %539 = OpCompositeExtract %float %436 0 - %540 = OpCompositeConstruct %v2float %538 %539 - %541 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %541 - %542 = OpBitcast %int %uint_1 - %543 = OpISub %int %532 %542 - OpStore %top %543 - %544 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %544 - %545 = OpAccessChain %_ptr_Function_int %stack %446 - %546 = OpLoad %int %545 - %547 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %547 %int_0 - %548 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %548 %546 - %549 = OpAccessChain %_ptr_Function_int %stack %532 - %550 = OpLoad %int %549 - %551 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %551 - %552 = OpCompositeExtract %float %456 1 - %553 = OpCompositeExtract %float %456 0 - %554 = OpCompositeExtract %float %497 1 - %555 = OpCompositeConstruct %v3float %552 %553 %554 - %556 = OpLoad %int %l_1 - OpStore %l_1 %int_0 - OpStore %l_1 %556 - OpStore %h_1 %550 - %557 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %557 - %558 = OpCompositeExtract %float %477 1 - %559 = OpCompositeExtract %float %468 1 - %560 = OpCompositeConstruct %v2float %558 %559 - %561 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %561 - %562 = OpLoad %int %top - %563 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %563 - %564 = OpAccessChain %_ptr_Function_int %stack %482 - %565 = OpLoad %int %564 - %566 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %566 %int_0 - %567 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %567 %565 - %568 = OpCompositeExtract %float %38 1 - %569 = OpCompositeExtract %float %38 2 - %570 = OpCompositeConstruct %v2float %568 %569 - %571 = OpISub %int %562 %int_1 - OpStore %top %571 - %572 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %572 - %573 = OpCompositeExtract %float %540 1 - %574 = OpCompositeExtract %float %502 0 - %575 = OpCompositeExtract %float %540 1 - %576 = OpCompositeConstruct %v3float %573 %574 %575 + %420 = OpLoad %int %p + OpStore %p %31 + OpStore %p %420 + %421 = OpLoad %int %top + %423 = OpLoad %int %p + OpStore %p %31 + OpStore %p %423 + %424 = OpBitcast %int %uint_1 + %425 = OpIAdd %int %421 %424 + %426 = OpLoad %int %top + OpStore %top %31 + OpStore %top %426 + %427 = OpCompositeExtract %float %417 1 + %428 = OpCompositeExtract %float %422 1 + %429 = OpCompositeConstruct %v2float %427 %428 + %430 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %430 + OpStore %top %425 + %431 = OpLoad %int %h_1 + OpStore %h_1 %31 + OpStore %h_1 %431 + %432 = OpCompositeExtract %float %422 1 + %433 = OpCompositeExtract %float %422 0 + %434 = OpCompositeExtract %float %422 0 + %435 = OpCompositeConstruct %v3float %432 %433 %434 + %436 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %436 + %437 = OpLoad %int %l_1 + %438 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %438 + %439 = OpCompositeExtract %float %435 1 + %440 = OpCompositeExtract %float %435 0 + %441 = OpCompositeExtract %float %422 0 + %442 = OpCompositeConstruct %v3float %439 %440 %441 + %443 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %443 + %444 = OpCompositeExtract %float %417 1 + %445 = OpCompositeExtract %float %417 1 + %446 = OpCompositeExtract %float %417 1 + %447 = OpCompositeConstruct %v3float %444 %445 %446 + %448 = OpLoad %int %l_1 + OpStore %l_1 %31 + OpStore %l_1 %31 + %449 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %449 %437 + %450 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %450 + %451 = OpLoad %int %top + %452 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %452 + %453 = OpCompositeExtract %float %429 1 + %454 = OpCompositeConstruct %v3float %float_3 %453 %float_2 + %455 = OpAccessChain %_ptr_Function_int %stack %425 + %456 = OpLoad %int %455 + %457 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %457 %31 + %458 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %458 %456 + %459 = OpIAdd %int %451 %int_1 + %460 = OpAccessChain %_ptr_Function_int %stack %425 + %461 = OpLoad %int %460 + %462 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %462 %31 + %463 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %463 %461 + %464 = OpCompositeExtract %float %435 0 + %465 = OpCompositeExtract %float %435 2 + %466 = OpCompositeExtract %float %417 1 + %467 = OpCompositeConstruct %v3float %464 %465 %466 + OpStore %top %459 + %468 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %468 + %469 = OpLoad %int %h_1 + %470 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %470 + %471 = OpCompositeExtract %float %429 0 + %472 = OpCompositeExtract %float %447 0 + %473 = OpCompositeExtract %float %429 1 + %474 = OpCompositeConstruct %v3float %471 %472 %473 + %475 = OpLoad %int %l_1 + OpStore %l_1 %31 + OpStore %l_1 %475 + %476 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %476 + %477 = OpCompositeExtract %float %474 2 + %478 = OpCompositeExtract %float %474 2 + %479 = OpCompositeConstruct %v2float %477 %478 + %480 = OpLoad %int %p + OpStore %p %31 + OpStore %p %480 + %481 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %481 %469 + OpBranch %482 + %482 = OpLabel + OpLoopMerge %483 %484 None + OpBranch %485 + %485 = OpLabel + %486 = OpCompositeExtract %float %467 0 + %487 = OpCompositeExtract %float %467 0 + %488 = OpCompositeExtract %float %467 0 + %489 = OpCompositeConstruct %v3float %486 %487 %488 + %490 = OpLoad %int %h_1 + OpStore %h_1 %31 + OpStore %h_1 %490 + %491 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %491 + %492 = OpLoad %int %top + %493 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %493 + %494 = OpCompositeExtract %float %429 0 + %495 = OpCompositeExtract %float %474 2 + %496 = OpCompositeConstruct %v2float %494 %495 + %497 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %497 + %498 = OpBitcast %int %499 + %500 = OpSGreaterThanEqual %bool %492 %498 + OpSelectionMerge %501 None + OpBranchConditional %500 %502 %503 + %502 = OpLabel + OpBranch %501 + %503 = OpLabel + OpBranch %483 + %501 = OpLabel + %504 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %504 + %505 = OpCompositeExtract %float %435 1 + %506 = OpCompositeExtract %float %435 0 + %507 = OpCompositeExtract %float %467 1 + %508 = OpCompositeConstruct %v3float %505 %506 %507 + %509 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %509 + %510 = OpLoad %int %top + %511 = OpCompositeExtract %float %479 0 + %512 = OpCompositeExtract %float %496 1 + %513 = OpCompositeExtract %float %479 0 + %514 = OpCompositeConstruct %v3float %511 %512 %513 + %515 = OpLoad %int %h_1 + OpStore %h_1 %31 + OpStore %h_1 %515 + %516 = OpCompositeExtract %float %417 0 + %517 = OpCompositeExtract %float %417 0 + %518 = OpCompositeConstruct %v2float %516 %517 + %519 = OpLoad %int %p + OpStore %p %31 + OpStore %p %519 + %520 = OpBitcast %int %uint_1 + %521 = OpISub %int %510 %520 + OpStore %top %521 + %522 = OpLoad %int %p + OpStore %p %31 + OpStore %p %522 + %523 = OpAccessChain %_ptr_Function_int %stack %425 + %524 = OpLoad %int %523 + %525 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %525 %31 + %526 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %526 %524 + %527 = OpAccessChain %_ptr_Function_int %stack %510 + %528 = OpLoad %int %527 + %529 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %529 + %530 = OpCompositeExtract %float %435 1 + %531 = OpCompositeExtract %float %435 0 + %532 = OpCompositeExtract %float %474 1 + %533 = OpCompositeConstruct %v3float %530 %531 %532 + %534 = OpLoad %int %l_1 + OpStore %l_1 %31 + OpStore %l_1 %534 + OpStore %h_1 %528 + %535 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %535 + %536 = OpCompositeExtract %float %454 1 + %537 = OpCompositeExtract %float %447 1 + %538 = OpCompositeConstruct %v2float %536 %537 + %539 = OpLoad %int %p + OpStore %p %31 + OpStore %p %539 + %540 = OpLoad %int %top + %541 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %541 + %542 = OpAccessChain %_ptr_Function_int %stack %459 + %543 = OpLoad %int %542 + %544 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %544 %31 + %545 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %545 %543 + %546 = OpISub %int %540 %int_1 + OpStore %top %546 + %547 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %547 + %548 = OpCompositeExtract %float %518 1 + %549 = OpCompositeExtract %float %479 0 + %550 = OpCompositeExtract %float %518 1 + %551 = OpCompositeConstruct %v3float %548 %549 %550 + %552 = OpLoad %int %h_1 + OpStore %h_1 %31 + OpStore %h_1 %552 + %553 = OpCompositeExtract %float %474 1 + %554 = OpCompositeExtract %float %474 2 + %555 = OpCompositeConstruct %v2float %553 %554 + %556 = OpAccessChain %_ptr_Function_int %stack %459 + %557 = OpLoad %int %556 + %558 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %558 %31 + %559 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %559 %557 + %560 = OpAccessChain %_ptr_Function_int %stack %540 + %561 = OpLoad %int %560 + %562 = OpLoad %int %p + OpStore %p %31 + OpStore %p %562 + %563 = OpCompositeExtract %float %217 1 + %564 = OpCompositeExtract %float %217 1 + %565 = OpCompositeExtract %float %479 0 + %566 = OpCompositeConstruct %v3float %563 %564 %565 + %567 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %567 + OpStore %l_1 %561 + %568 = OpLoad %int %top + OpStore %top %31 + OpStore %top %568 + %569 = OpLoad %int %l_1 + OpStore %param_4 %569 + %570 = OpAccessChain %_ptr_Function_int %stack %510 + %571 = OpLoad %int %570 + %572 = OpAccessChain %_ptr_Function_int %stack %510 + OpStore %572 %31 + %573 = OpAccessChain %_ptr_Function_int %stack %510 + OpStore %573 %571 + %574 = OpCompositeExtract %float %514 1 + %575 = OpCompositeExtract %float %514 2 + %576 = OpCompositeConstruct %v2float %574 %575 %577 = OpLoad %int %h_1 - OpStore %h_1 %int_0 - OpStore %h_1 %577 - %578 = OpCompositeExtract %float %497 1 - %579 = OpCompositeExtract %float %497 2 - %580 = OpCompositeConstruct %v2float %578 %579 - %581 = OpAccessChain %_ptr_Function_int %stack %482 - %582 = OpLoad %int %581 - %583 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %583 %int_0 - %584 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %584 %582 - %585 = OpAccessChain %_ptr_Function_int %stack %562 - %586 = OpLoad %int %585 - %587 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %587 - %588 = OpCompositeExtract %float %570 1 - %589 = OpCompositeExtract %float %570 1 - %590 = OpCompositeExtract %float %502 0 - %591 = OpCompositeConstruct %v3float %588 %589 %590 - %592 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %592 - OpStore %l_1 %586 - %593 = OpLoad %int %top - OpStore %top %int_0 - OpStore %top %593 - %594 = OpLoad %int %l_1 - OpStore %param_4 %594 - %595 = OpAccessChain %_ptr_Function_int %stack %532 - %596 = OpLoad %int %595 - %597 = OpAccessChain %_ptr_Function_int %stack %532 - OpStore %597 %int_0 - %598 = OpAccessChain %_ptr_Function_int %stack %532 - OpStore %598 %596 - %599 = OpCompositeExtract %float %536 1 - %600 = OpCompositeExtract %float %536 2 - %601 = OpCompositeConstruct %v2float %599 %600 - %602 = OpLoad %int %h_1 - %603 = OpCompositeExtract %float %450 0 - %604 = OpCompositeExtract %float %38 1 - %605 = OpCompositeConstruct %v2float %603 %604 - OpStore %param_5 %602 - %606 = OpAccessChain %_ptr_Function_int %stack %482 - %607 = OpLoad %int %606 - %608 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %608 %int_0 - %609 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %609 %607 - %610 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 - %613 = OpCompositeExtract %float %519 0 - %614 = OpCompositeExtract %float %530 0 - %615 = OpCompositeConstruct %v2float %613 %614 - %616 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %616 - OpStore %p %610 + %578 = OpCompositeExtract %float %429 0 + %579 = OpCompositeConstruct %v2float %578 %float_2 + OpStore %param_5 %577 + %580 = OpAccessChain %_ptr_Function_int %stack %459 + %581 = OpLoad %int %580 + %582 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %582 %31 + %583 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %583 %581 + %584 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + %587 = OpCompositeExtract %float %496 0 + %588 = OpCompositeExtract %float %508 0 + %589 = OpCompositeConstruct %v2float %587 %588 + %590 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %590 + OpStore %p %584 + %591 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %591 + %592 = OpLoad %int %p + %593 = OpLoad %int %h_1 + OpStore %h_1 %31 + OpStore %h_1 %593 + %594 = OpCompositeExtract %float %508 1 + %595 = OpCompositeExtract %float %508 1 + %596 = OpCompositeConstruct %v2float %594 %595 + %597 = OpLoad %int %l_1 + OpStore %l_1 %31 + OpStore %l_1 %597 + %598 = OpLoad %int %h_1 + OpStore %h_1 %31 + OpStore %h_1 %598 + %599 = OpLoad %int %l_1 + %600 = OpAccessChain %_ptr_Function_int %stack %510 + %601 = OpLoad %int %600 + %602 = OpAccessChain %_ptr_Function_int %stack %510 + OpStore %602 %31 + %603 = OpAccessChain %_ptr_Function_int %stack %510 + OpStore %603 %601 + %604 = OpLoad %int %h_1 + OpStore %h_1 %31 + OpStore %h_1 %604 + %605 = OpCompositeExtract %float %496 1 + %606 = OpCompositeExtract %float %217 0 + %607 = OpCompositeConstruct %v2float %605 %606 + %608 = OpAccessChain %_ptr_Function_int %stack %459 + %609 = OpLoad %int %608 + %610 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %610 %31 + %611 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %611 %609 + %612 = OpBitcast %int %uint_1 + %613 = OpISub %int %592 %612 + %614 = OpSGreaterThan %bool %613 %599 + OpSelectionMerge %615 None + OpBranchConditional %614 %616 %615 + %616 = OpLabel %617 = OpLoad %int %param_4 - OpStore %param_4 %int_0 + OpStore %param_4 %31 OpStore %param_4 %617 - %618 = OpLoad %int %p - %619 = OpLoad %int %h_1 - OpStore %h_1 %int_0 - OpStore %h_1 %619 - %620 = OpCompositeExtract %float %530 1 - %621 = OpCompositeExtract %float %530 1 - %622 = OpCompositeConstruct %v2float %620 %621 - %623 = OpLoad %int %l_1 - OpStore %l_1 %int_0 - OpStore %l_1 %623 - %624 = OpLoad %int %h_1 - OpStore %h_1 %int_0 - OpStore %h_1 %624 - %625 = OpLoad %int %l_1 - %626 = OpAccessChain %_ptr_Function_int %stack %532 - %627 = OpLoad %int %626 - %628 = OpAccessChain %_ptr_Function_int %stack %532 - OpStore %628 %int_0 - %629 = OpAccessChain %_ptr_Function_int %stack %532 - OpStore %629 %627 - %630 = OpLoad %int %h_1 - OpStore %h_1 %int_0 - OpStore %h_1 %630 - %631 = OpCompositeExtract %float %519 1 - %632 = OpCompositeExtract %float %570 0 - %633 = OpCompositeConstruct %v2float %631 %632 - %634 = OpAccessChain %_ptr_Function_int %stack %482 - %635 = OpLoad %int %634 - %636 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %636 %int_0 - %637 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %637 %635 - %638 = OpBitcast %int %uint_1 - %639 = OpISub %int %618 %638 - %640 = OpSGreaterThan %bool %639 %625 - OpSelectionMerge %641 None - OpBranchConditional %640 %642 %641 - %642 = OpLabel - %643 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %643 - %644 = OpLoad %int %top - %645 = OpCompositeExtract %float %555 1 - %646 = OpCompositeExtract %float %436 1 - %647 = OpCompositeConstruct %v2float %645 %646 - %648 = OpAccessChain %_ptr_Function_int %stack %482 - %649 = OpLoad %int %648 - %650 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %650 %int_0 - %651 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %651 %649 - %652 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %652 - %653 = OpCompositeExtract %float %536 2 - %654 = OpCompositeExtract %float %536 1 - %655 = OpCompositeConstruct %v2float %653 %654 - %656 = OpCompositeExtract %float %622 1 - %657 = OpCompositeExtract %float %601 0 - %658 = OpCompositeExtract %float %601 0 - %659 = OpCompositeConstruct %v3float %656 %657 %658 - %660 = OpLoad %int %l_1 - %661 = OpAccessChain %_ptr_Function_int %stack %562 - %662 = OpLoad %int %661 - %663 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %663 %int_0 - %664 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %664 %662 - %665 = OpCompositeExtract %float %497 0 - %666 = OpCompositeExtract %float %659 0 - %667 = OpCompositeConstruct %v2float %665 %666 - %668 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %668 - %669 = OpIAdd %int %int_1 %644 - %670 = OpAccessChain %_ptr_Function_int %stack %532 - %671 = OpLoad %int %670 - %672 = OpAccessChain %_ptr_Function_int %stack %532 - OpStore %672 %int_0 - %673 = OpAccessChain %_ptr_Function_int %stack %532 - OpStore %673 %671 - %674 = OpCompositeExtract %float %512 1 - %675 = OpCompositeExtract %float %512 1 - %676 = OpCompositeExtract %float %490 0 - %677 = OpCompositeConstruct %v3float %674 %675 %676 - %678 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %678 - %679 = OpAccessChain %_ptr_Function_int %stack %669 - OpStore %679 %660 - %680 = OpLoad %int %top - %681 = OpAccessChain %_ptr_Function_int %stack %482 - %682 = OpLoad %int %681 - %683 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %683 %int_0 - %684 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %684 %682 - %685 = OpCompositeExtract %float %580 1 - %686 = OpCompositeExtract %float %580 0 - %687 = OpCompositeConstruct %v2float %685 %686 - %688 = OpAccessChain %_ptr_Function_int %stack %669 - %689 = OpLoad %int %688 - %690 = OpAccessChain %_ptr_Function_int %stack %669 - OpStore %690 %int_0 - %691 = OpAccessChain %_ptr_Function_int %stack %669 - OpStore %691 %689 - %693 = OpBitcast %uint %680 - %694 = OpIAdd %uint %uint_1 %693 - %692 = OpBitcast %int %694 - %695 = OpAccessChain %_ptr_Function_int %stack %482 - %696 = OpLoad %int %695 - %697 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %697 %int_0 - %698 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %698 %696 - %699 = OpCompositeExtract %float %591 2 - %700 = OpCompositeExtract %float %687 1 - %701 = OpCompositeExtract %float %591 2 - %702 = OpCompositeConstruct %v3float %699 %700 %701 - %703 = OpLoad %int %h_1 - OpStore %h_1 %int_0 - OpStore %h_1 %703 - OpStore %top %692 - %704 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %704 - %705 = OpLoad %int %p - %706 = OpCompositeExtract %float %591 0 - %707 = OpCompositeExtract %float %570 1 - %708 = OpCompositeConstruct %v2float %706 %707 - %709 = OpAccessChain %_ptr_Function_int %stack %562 - %710 = OpLoad %int %709 - %711 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %711 %int_0 - %712 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %712 %710 - %713 = OpAccessChain %_ptr_Function_int %stack %562 - %714 = OpLoad %int %713 - %715 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %715 %int_0 - %716 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %716 %714 - %717 = OpAccessChain %_ptr_Function_int %stack %692 - %718 = OpBitcast %int %uint_1 - %719 = OpISub %int %705 %718 - OpStore %717 %719 - %720 = OpAccessChain %_ptr_Function_int %stack %446 - %721 = OpLoad %int %720 - %722 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %722 %int_0 - %723 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %723 %721 - %724 = OpCompositeExtract %float %536 2 - %725 = OpCompositeExtract %float %536 1 - %726 = OpCompositeConstruct %v2float %724 %725 - %727 = OpAccessChain %_ptr_Function_int %stack %692 - %728 = OpLoad %int %727 - %729 = OpAccessChain %_ptr_Function_int %stack %692 - OpStore %729 %int_0 - %730 = OpAccessChain %_ptr_Function_int %stack %692 - OpStore %730 %728 - OpBranch %641 - %641 = OpLabel - %731 = OpAccessChain %_ptr_Function_int %stack %446 - %732 = OpLoad %int %731 - %733 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %733 %int_0 - %734 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %734 %732 - %735 = OpCompositeExtract %float %38 0 - %736 = OpCompositeExtract %float %38 1 - %737 = OpCompositeConstruct %v2float %735 %736 - %738 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %738 + %618 = OpLoad %int %top + %619 = OpCompositeExtract %float %533 1 + %620 = OpCompositeExtract %float %417 1 + %621 = OpCompositeConstruct %v2float %619 %620 + %622 = OpAccessChain %_ptr_Function_int %stack %459 + %623 = OpLoad %int %622 + %624 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %624 %31 + %625 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %625 %623 + %626 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %626 + %627 = OpCompositeExtract %float %514 2 + %628 = OpCompositeExtract %float %514 1 + %629 = OpCompositeConstruct %v2float %627 %628 + %630 = OpCompositeExtract %float %596 1 + %631 = OpCompositeExtract %float %576 0 + %632 = OpCompositeExtract %float %576 0 + %633 = OpCompositeConstruct %v3float %630 %631 %632 + %634 = OpLoad %int %l_1 + %635 = OpAccessChain %_ptr_Function_int %stack %540 + %636 = OpLoad %int %635 + %637 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %637 %31 + %638 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %638 %636 + %639 = OpCompositeExtract %float %474 0 + %640 = OpCompositeExtract %float %633 0 + %641 = OpCompositeConstruct %v2float %639 %640 + %642 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %642 + %643 = OpIAdd %int %int_1 %618 + %644 = OpAccessChain %_ptr_Function_int %stack %510 + %645 = OpLoad %int %644 + %646 = OpAccessChain %_ptr_Function_int %stack %510 + OpStore %646 %31 + %647 = OpAccessChain %_ptr_Function_int %stack %510 + OpStore %647 %645 + %648 = OpCompositeExtract %float %489 1 + %649 = OpCompositeExtract %float %489 1 + %650 = OpCompositeExtract %float %467 0 + %651 = OpCompositeConstruct %v3float %648 %649 %650 + %652 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %652 + %653 = OpAccessChain %_ptr_Function_int %stack %643 + OpStore %653 %634 + %654 = OpLoad %int %top + %655 = OpAccessChain %_ptr_Function_int %stack %459 + %656 = OpLoad %int %655 + %657 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %657 %31 + %658 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %658 %656 + %659 = OpCompositeExtract %float %555 1 + %660 = OpCompositeExtract %float %555 0 + %661 = OpCompositeConstruct %v2float %659 %660 + %662 = OpAccessChain %_ptr_Function_int %stack %643 + %663 = OpLoad %int %662 + %664 = OpAccessChain %_ptr_Function_int %stack %643 + OpStore %664 %31 + %665 = OpAccessChain %_ptr_Function_int %stack %643 + OpStore %665 %663 + %667 = OpBitcast %uint %654 + %668 = OpIAdd %uint %uint_1 %667 + %666 = OpBitcast %int %668 + %669 = OpAccessChain %_ptr_Function_int %stack %459 + %670 = OpLoad %int %669 + %671 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %671 %31 + %672 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %672 %670 + %673 = OpCompositeExtract %float %566 2 + %674 = OpCompositeExtract %float %661 1 + %675 = OpCompositeExtract %float %566 2 + %676 = OpCompositeConstruct %v3float %673 %674 %675 + %677 = OpLoad %int %h_1 + OpStore %h_1 %31 + OpStore %h_1 %677 + OpStore %top %666 + %678 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %678 + %679 = OpLoad %int %p + %680 = OpCompositeExtract %float %566 0 + %681 = OpCompositeExtract %float %217 1 + %682 = OpCompositeConstruct %v2float %680 %681 + %683 = OpAccessChain %_ptr_Function_int %stack %540 + %684 = OpLoad %int %683 + %685 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %685 %31 + %686 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %686 %684 + %687 = OpAccessChain %_ptr_Function_int %stack %540 + %688 = OpLoad %int %687 + %689 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %689 %31 + %690 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %690 %688 + %691 = OpAccessChain %_ptr_Function_int %stack %666 + %692 = OpBitcast %int %uint_1 + %693 = OpISub %int %679 %692 + OpStore %691 %693 + %694 = OpAccessChain %_ptr_Function_int %stack %425 + %695 = OpLoad %int %694 + %696 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %696 %31 + %697 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %697 %695 + %698 = OpCompositeExtract %float %514 2 + %699 = OpCompositeExtract %float %514 1 + %700 = OpCompositeConstruct %v2float %698 %699 + %701 = OpAccessChain %_ptr_Function_int %stack %666 + %702 = OpLoad %int %701 + %703 = OpAccessChain %_ptr_Function_int %stack %666 + OpStore %703 %31 + %704 = OpAccessChain %_ptr_Function_int %stack %666 + OpStore %704 %702 + OpBranch %615 + %615 = OpLabel + %705 = OpAccessChain %_ptr_Function_int %stack %425 + %706 = OpLoad %int %705 + %707 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %707 %31 + %708 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %708 %706 + %710 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %710 + %711 = OpLoad %int %p + %712 = OpAccessChain %_ptr_Function_int %stack %540 + %713 = OpLoad %int %712 + %714 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %714 %31 + %715 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %715 %713 + %716 = OpCompositeExtract %float %533 2 + %717 = OpCompositeExtract %float %417 0 + %718 = OpCompositeExtract %float %417 1 + %719 = OpCompositeConstruct %v3float %716 %717 %718 + %720 = OpLoad %int %p + OpStore %p %31 + OpStore %p %720 + %721 = OpCompositeExtract %float %467 2 + %722 = OpCompositeExtract %float %467 0 + %723 = OpCompositeExtract %float %555 0 + %724 = OpCompositeConstruct %v3float %721 %722 %723 + %725 = OpAccessChain %_ptr_Function_int %stack %540 + %726 = OpLoad %int %725 + %727 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %727 %31 + %728 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %728 %726 + %729 = OpLoad %int %h_1 + %730 = OpLoad %int %top + OpStore %top %31 + OpStore %top %730 + %731 = OpCompositeExtract %float %442 2 + %732 = OpCompositeExtract %float %508 0 + %733 = OpCompositeExtract %float %442 0 + %734 = OpCompositeConstruct %v3float %731 %732 %733 + %735 = OpAccessChain %_ptr_Function_int %stack %459 + %736 = OpLoad %int %735 + %737 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %737 %31 + %738 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %738 %736 %739 = OpLoad %int %p - %740 = OpAccessChain %_ptr_Function_int %stack %562 - %741 = OpLoad %int %740 - %742 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %742 %int_0 - %743 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %743 %741 - %744 = OpCompositeExtract %float %555 2 - %745 = OpCompositeExtract %float %436 0 - %746 = OpCompositeExtract %float %436 1 - %747 = OpCompositeConstruct %v3float %744 %745 %746 - %748 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %748 - %749 = OpCompositeExtract %float %490 2 - %750 = OpCompositeExtract %float %490 0 - %751 = OpCompositeExtract %float %580 0 - %752 = OpCompositeConstruct %v3float %749 %750 %751 - %753 = OpAccessChain %_ptr_Function_int %stack %562 - %754 = OpLoad %int %753 - %755 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %755 %int_0 - %756 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %756 %754 - %757 = OpLoad %int %h_1 - %758 = OpLoad %int %top - OpStore %top %int_0 - OpStore %top %758 - %759 = OpCompositeExtract %float %463 2 - %760 = OpCompositeExtract %float %530 0 - %761 = OpCompositeExtract %float %463 0 + OpStore %p %31 + OpStore %p %739 + %741 = OpBitcast %uint %711 + %742 = OpIAdd %uint %uint_1 %741 + %740 = OpBitcast %int %742 + %743 = OpSLessThan %bool %740 %729 + OpSelectionMerge %744 None + OpBranchConditional %743 %745 %744 + %745 = OpLabel + %746 = OpAccessChain %_ptr_Function_int %stack %540 + %747 = OpLoad %int %746 + %748 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %748 %31 + %749 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %749 %747 + %750 = OpCompositeExtract %float %709 1 + %751 = OpCompositeExtract %float %607 0 + %752 = OpCompositeConstruct %v2float %750 %751 + %753 = OpLoad %int %l_1 + OpStore %l_1 %31 + OpStore %l_1 %753 + %754 = OpLoad %int %top + %755 = OpAccessChain %_ptr_Function_int %stack %540 + %756 = OpLoad %int %755 + %757 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %757 %31 + %758 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %758 %756 + %759 = OpCompositeExtract %float %454 1 + %760 = OpCompositeExtract %float %442 1 + %761 = OpCompositeExtract %float %442 1 %762 = OpCompositeConstruct %v3float %759 %760 %761 - %763 = OpAccessChain %_ptr_Function_int %stack %482 - %764 = OpLoad %int %763 - %765 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %765 %int_0 - %766 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %766 %764 - %767 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %767 - %769 = OpBitcast %uint %739 - %770 = OpIAdd %uint %uint_1 %769 - %768 = OpBitcast %int %770 - %771 = OpSLessThan %bool %768 %757 - OpSelectionMerge %772 None - OpBranchConditional %771 %773 %772 - %773 = OpLabel - %774 = OpAccessChain %_ptr_Function_int %stack %562 - %775 = OpLoad %int %774 - %776 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %776 %int_0 - %777 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %777 %775 - %778 = OpCompositeExtract %float %737 1 - %779 = OpCompositeExtract %float %633 0 - %780 = OpCompositeConstruct %v2float %778 %779 - %781 = OpLoad %int %l_1 - OpStore %l_1 %int_0 - OpStore %l_1 %781 - %782 = OpLoad %int %top - %783 = OpAccessChain %_ptr_Function_int %stack %562 - %784 = OpLoad %int %783 - %785 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %785 %int_0 - %786 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %786 %784 - %787 = OpCompositeExtract %float %477 1 - %788 = OpCompositeExtract %float %463 1 - %789 = OpCompositeExtract %float %463 1 - %790 = OpCompositeConstruct %v3float %787 %788 %789 - %791 = OpIAdd %int %782 %int_1 - %792 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %792 - OpStore %top %791 - %793 = OpAccessChain %_ptr_Function_int %stack %562 - %794 = OpLoad %int %793 - %795 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %795 %int_0 - %796 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %796 %794 - %797 = OpLoad %int %p - %798 = OpLoad %int %param_5 - OpStore %param_5 %int_0 - OpStore %param_5 %798 - %799 = OpCompositeExtract %float %463 2 - %800 = OpCompositeExtract %float %463 0 - %801 = OpCompositeExtract %float %530 0 - %802 = OpCompositeConstruct %v3float %799 %800 %801 - %803 = OpLoad %int %p - OpStore %p %int_0 - OpStore %p %803 - %804 = OpCompositeExtract %float %436 0 - %805 = OpCompositeExtract %float %622 0 - %806 = OpCompositeExtract %float %622 0 - %807 = OpCompositeConstruct %v3float %804 %805 %806 - %808 = OpAccessChain %_ptr_Function_int %stack %482 - %809 = OpLoad %int %808 - %810 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %810 %int_0 - %811 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %811 %809 - %812 = OpAccessChain %_ptr_Function_int %stack %532 - %813 = OpLoad %int %812 - %814 = OpAccessChain %_ptr_Function_int %stack %532 - OpStore %814 %int_0 - %815 = OpAccessChain %_ptr_Function_int %stack %532 - OpStore %815 %813 - %816 = OpCompositeExtract %float %490 0 - %817 = OpCompositeExtract %float %490 1 - %818 = OpCompositeConstruct %v2float %816 %817 - %819 = OpAccessChain %_ptr_Function_int %stack %791 - %821 = OpBitcast %uint %797 - %822 = OpIAdd %uint %uint_1 %821 - %820 = OpBitcast %int %822 - OpStore %819 %820 - %823 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %823 - %824 = OpLoad %int %top - %825 = OpAccessChain %_ptr_Function_int %stack %562 - %826 = OpLoad %int %825 - %827 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %827 %int_0 - %828 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %828 %826 - %829 = OpCompositeExtract %float %502 1 - %830 = OpCompositeExtract %float %802 1 - %831 = OpCompositeConstruct %v2float %829 %830 - %832 = OpLoad %_arr_int_uint_10 %stack - OpStore %stack %102 - OpStore %stack %832 - %833 = OpBitcast %int %uint_1 - %834 = OpIAdd %int %824 %833 - %835 = OpAccessChain %_ptr_Function_int %stack %791 - %836 = OpLoad %int %835 - %837 = OpAccessChain %_ptr_Function_int %stack %791 - OpStore %837 %int_0 - %838 = OpAccessChain %_ptr_Function_int %stack %791 - OpStore %838 %836 - OpStore %top %834 - %839 = OpLoad %int %param_4 - OpStore %param_4 %int_0 - OpStore %param_4 %839 + %763 = OpIAdd %int %754 %int_1 + %764 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %764 + OpStore %top %763 + %765 = OpAccessChain %_ptr_Function_int %stack %540 + %766 = OpLoad %int %765 + %767 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %767 %31 + %768 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %768 %766 + %769 = OpLoad %int %p + %770 = OpLoad %int %param_5 + OpStore %param_5 %31 + OpStore %param_5 %770 + %771 = OpCompositeExtract %float %442 2 + %772 = OpCompositeExtract %float %442 0 + %773 = OpCompositeExtract %float %508 0 + %774 = OpCompositeConstruct %v3float %771 %772 %773 + %775 = OpLoad %int %p + OpStore %p %31 + OpStore %p %775 + %776 = OpCompositeExtract %float %417 0 + %777 = OpCompositeExtract %float %596 0 + %778 = OpCompositeExtract %float %596 0 + %779 = OpCompositeConstruct %v3float %776 %777 %778 + %780 = OpAccessChain %_ptr_Function_int %stack %459 + %781 = OpLoad %int %780 + %782 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %782 %31 + %783 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %783 %781 + %784 = OpAccessChain %_ptr_Function_int %stack %510 + %785 = OpLoad %int %784 + %786 = OpAccessChain %_ptr_Function_int %stack %510 + OpStore %786 %31 + %787 = OpAccessChain %_ptr_Function_int %stack %510 + OpStore %787 %785 + %788 = OpCompositeExtract %float %467 0 + %789 = OpCompositeExtract %float %467 1 + %790 = OpCompositeConstruct %v2float %788 %789 + %791 = OpAccessChain %_ptr_Function_int %stack %763 + %793 = OpBitcast %uint %769 + %794 = OpIAdd %uint %uint_1 %793 + %792 = OpBitcast %int %794 + OpStore %791 %792 + %795 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %795 + %796 = OpLoad %int %top + %797 = OpAccessChain %_ptr_Function_int %stack %540 + %798 = OpLoad %int %797 + %799 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %799 %31 + %800 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %800 %798 + %801 = OpCompositeExtract %float %479 1 + %802 = OpCompositeExtract %float %774 1 + %803 = OpCompositeConstruct %v2float %801 %802 + %804 = OpLoad %_arr_int_uint_10 %stack + OpStore %stack %412 + OpStore %stack %804 + %805 = OpBitcast %int %uint_1 + %806 = OpIAdd %int %796 %805 + %807 = OpAccessChain %_ptr_Function_int %stack %763 + %808 = OpLoad %int %807 + %809 = OpAccessChain %_ptr_Function_int %stack %763 + OpStore %809 %31 + %810 = OpAccessChain %_ptr_Function_int %stack %763 + OpStore %810 %808 + OpStore %top %806 + %811 = OpLoad %int %param_4 + OpStore %param_4 %31 + OpStore %param_4 %811 + %812 = OpLoad %int %h_1 + %813 = OpAccessChain %_ptr_Function_int %stack %459 + %814 = OpLoad %int %813 + %815 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %815 %31 + %816 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %816 %814 + %817 = OpAccessChain %_ptr_Function_int %stack %425 + %818 = OpLoad %int %817 + %819 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %819 %31 + %820 = OpAccessChain %_ptr_Function_int %stack %425 + OpStore %820 %818 + %821 = OpAccessChain %_ptr_Function_int %stack %806 + OpStore %821 %812 + %822 = OpAccessChain %_ptr_Function_int %stack %540 + %823 = OpLoad %int %822 + %824 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %824 %31 + %825 = OpAccessChain %_ptr_Function_int %stack %540 + OpStore %825 %823 + %826 = OpCompositeExtract %float %508 1 + %827 = OpCompositeExtract %float %474 0 + %828 = OpCompositeExtract %float %474 0 + %829 = OpCompositeConstruct %v3float %826 %827 %828 + %830 = OpLoad %int %l_1 + OpStore %l_1 %31 + OpStore %l_1 %830 + OpBranch %744 + %744 = OpLabel + %831 = OpAccessChain %_ptr_Function_int %stack %459 + %832 = OpLoad %int %831 + %833 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %833 %31 + %834 = OpAccessChain %_ptr_Function_int %stack %459 + OpStore %834 %832 + OpBranch %484 + %484 = OpLabel + %835 = OpLoad %int %l_1 + OpStore %l_1 %31 + OpStore %l_1 %835 + %836 = OpCompositeExtract %float %467 2 + %837 = OpCompositeExtract %float %474 0 + %838 = OpCompositeConstruct %v2float %836 %837 + %839 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %839 + OpBranch %482 + %483 = OpLabel %840 = OpLoad %int %h_1 - %841 = OpAccessChain %_ptr_Function_int %stack %482 - %842 = OpLoad %int %841 - %843 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %843 %int_0 - %844 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %844 %842 - %845 = OpAccessChain %_ptr_Function_int %stack %446 - %846 = OpLoad %int %845 - %847 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %847 %int_0 - %848 = OpAccessChain %_ptr_Function_int %stack %446 - OpStore %848 %846 - %849 = OpAccessChain %_ptr_Function_int %stack %834 - OpStore %849 %840 - %850 = OpAccessChain %_ptr_Function_int %stack %562 - %851 = OpLoad %int %850 - %852 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %852 %int_0 - %853 = OpAccessChain %_ptr_Function_int %stack %562 - OpStore %853 %851 - %854 = OpCompositeExtract %float %530 1 - %855 = OpCompositeExtract %float %497 0 - %856 = OpCompositeExtract %float %497 0 - %857 = OpCompositeConstruct %v3float %854 %855 %856 - %858 = OpLoad %int %l_1 - OpStore %l_1 %int_0 - OpStore %l_1 %858 - OpBranch %772 - %772 = OpLabel - %859 = OpAccessChain %_ptr_Function_int %stack %482 - %860 = OpLoad %int %859 - %861 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %861 %int_0 - %862 = OpAccessChain %_ptr_Function_int %stack %482 - OpStore %862 %860 - OpBranch %507 - %507 = OpLabel - %863 = OpLoad %int %l_1 - OpStore %l_1 %int_0 - OpStore %l_1 %863 - %864 = OpCompositeExtract %float %490 2 - %865 = OpCompositeExtract %float %497 0 - %866 = OpCompositeConstruct %v2float %864 %865 - %867 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %867 - OpBranch %505 - %506 = OpLabel - %868 = OpLoad %int %h_1 - OpStore %h_1 %int_0 - OpStore %h_1 %868 + OpStore %h_1 %31 + OpStore %h_1 %840 OpReturn OpFunctionEnd - %main_1 = OpFunction %void None %419 - %870 = OpLabel - %color = OpVariable %_ptr_Function_v3float Function %171 + %main_1 = OpFunction %void None %402 + %842 = OpLabel + %color = OpVariable %_ptr_Function_v3float Function %163 %i_2 = OpVariable %_ptr_Function_int Function %31 - %uv = OpVariable %_ptr_Function_v2float Function %168 + %uv = OpVariable %_ptr_Function_v2float Function %160 + %846 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %846 + OpStore %i_2 %31 + %847 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %847 + OpSelectionMerge %849 None + OpBranchConditional %true %850 %849 + %850 = OpLabel + %851 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %851 + %852 = OpLoad %int %i_2 + %853 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %853 + %854 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %854 + %855 = OpCompositeExtract %float %422 1 + %856 = OpCompositeExtract %float %422 1 + %857 = OpCompositeConstruct %v2float %855 %856 + %858 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %858 + OpBranch %849 + %849 = OpLabel + %859 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %859 + %860 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %860 + %861 = OpFunctionCall %void %quicksort_ + %862 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %862 + %863 = OpLoad %v4float %gl_FragCoord + %864 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %864 + %865 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %865 + %866 = OpCompositeExtract %float %863 0 + %867 = OpCompositeExtract %float %863 1 + %868 = OpCompositeConstruct %v2float %866 %867 + %869 = OpCompositeExtract %float %868 1 + %870 = OpCompositeExtract %float %160 1 + %871 = OpCompositeExtract %float %160 1 + %872 = OpCompositeConstruct %v3float %869 %870 %871 + %873 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %873 %874 = OpLoad %v2float %uv - OpStore %uv %876 + OpStore %uv %160 OpStore %uv %874 - OpStore %i_2 %int_0 - %877 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %877 - OpSelectionMerge %879 None - OpBranchConditional %true %880 %879 - %880 = OpLabel - %881 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %881 - %882 = OpCompositeExtract %float %38 0 - %883 = OpCompositeExtract %float %38 0 - %884 = OpCompositeConstruct %v2float %882 %883 - %885 = OpLoad %int %i_2 - %886 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %886 - %887 = OpLoad %v3float %color + %876 = OpAccessChain %_ptr_Uniform_v2float %x_188 %uint_0 + %877 = OpLoad %v2float %876 + %878 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %878 + %879 = OpCompositeExtract %float %863 1 + %880 = OpCompositeExtract %float %863 3 + %881 = OpCompositeConstruct %v3float %879 %float_3 %880 + %882 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %882 + %883 = OpFDiv %v2float %868 %877 + %884 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %884 + %885 = OpCompositeExtract %float %160 0 + %886 = OpCompositeExtract %float %868 1 + %887 = OpCompositeConstruct %v2float %885 %886 + %888 = OpLoad %v3float %color + OpStore %color %163 + %889 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %889 OpStore %color %888 - OpStore %color %887 - %889 = OpCompositeExtract %float %884 1 - %890 = OpCompositeExtract %float %884 1 - %891 = OpCompositeConstruct %v2float %889 %890 - %892 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %892 - OpBranch %879 - %879 = OpLabel - %893 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %893 - %894 = OpCompositeExtract %float %168 0 - %895 = OpCompositeExtract %float %168 0 - %896 = OpCompositeConstruct %v2float %894 %895 - %897 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %897 - %898 = OpFunctionCall %void %quicksort_ - %899 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %899 - %900 = OpLoad %v4float %gl_FragCoord - %901 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %901 - %902 = OpCompositeExtract %float %168 1 - %903 = OpCompositeExtract %float %168 1 - %904 = OpCompositeConstruct %v2float %902 %903 - %905 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %905 - %906 = OpCompositeExtract %float %900 0 - %907 = OpCompositeExtract %float %900 1 - %908 = OpCompositeConstruct %v2float %906 %907 - %909 = OpCompositeExtract %float %908 1 - %910 = OpCompositeExtract %float %896 1 - %911 = OpCompositeExtract %float %896 1 - %912 = OpCompositeConstruct %v3float %909 %910 %911 - %913 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %913 - %914 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %914 - %916 = OpAccessChain %_ptr_Uniform_v2float %x_188 %uint_0 - %917 = OpLoad %v2float %916 - %918 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %918 - %919 = OpCompositeExtract %float %900 1 - %920 = OpCompositeExtract %float %38 2 - %921 = OpCompositeExtract %float %900 3 - %922 = OpCompositeConstruct %v3float %919 %920 %921 - %923 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %923 - %924 = OpFDiv %v2float %908 %917 - %925 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %925 - %926 = OpCompositeExtract %float %904 0 - %927 = OpCompositeExtract %float %908 1 - %928 = OpCompositeConstruct %v2float %926 %927 - %929 = OpLoad %v3float %color - OpStore %color %888 - %930 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %930 - OpStore %color %929 - OpStore %uv %924 - OpStore %color %38 - %931 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %931 - %932 = OpCompositeExtract %float %908 0 - %933 = OpCompositeExtract %float %908 1 - %934 = OpCompositeExtract %float %896 1 - %935 = OpCompositeConstruct %v3float %932 %933 %934 - %936 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %936 - %937 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - %938 = OpLoad %int %937 - %939 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %939 %int_0 - %940 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %940 %938 - %941 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - %942 = OpLoad %int %941 - %943 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %943 - %944 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - %945 = OpLoad %int %944 - %946 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %946 %int_0 - %947 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %947 %945 - %948 = OpAccessChain %_ptr_Function_float %color %uint_0 - %949 = OpLoad %float %948 - %950 = OpAccessChain %_ptr_Function_float %color %uint_0 - %951 = OpLoad %float %950 - %952 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %952 %float_0 - %953 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %953 %951 - %954 = OpCompositeExtract %float %38 2 - %955 = OpCompositeExtract %float %38 1 - %956 = OpCompositeConstruct %v2float %954 %955 - %957 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %957 + OpStore %uv %883 + OpStore %color %890 + %891 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %891 + %892 = OpCompositeExtract %float %868 0 + %893 = OpCompositeExtract %float %868 1 + %894 = OpCompositeExtract %float %160 1 + %895 = OpCompositeConstruct %v3float %892 %893 %894 + %896 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %896 + %897 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + %898 = OpLoad %int %897 + %899 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %899 %31 + %900 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %900 %898 + %901 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + %902 = OpLoad %int %901 + %903 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %903 + %904 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + %905 = OpLoad %int %904 + %906 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %906 %31 + %907 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %907 %905 + %908 = OpAccessChain %_ptr_Function_float %color %uint_0 + %909 = OpLoad %float %908 + %910 = OpAccessChain %_ptr_Function_float %color %uint_0 + %911 = OpLoad %float %910 + %912 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %912 %913 + %914 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %914 %911 + %916 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %916 + %917 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %917 + %918 = OpCompositeExtract %float %895 0 + %919 = OpCompositeExtract %float %887 0 + %920 = OpCompositeExtract %float %887 1 + %921 = OpCompositeConstruct %v3float %918 %919 %920 + %922 = OpAccessChain %_ptr_Function_float %color %uint_0 + %923 = OpConvertSToF %float %902 + %924 = OpFAdd %float %909 %923 + OpStore %922 %924 + %925 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %925 + %926 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %926 + %927 = OpCompositeExtract %float %863 1 + %928 = OpCompositeExtract %float %863 1 + %929 = OpCompositeConstruct %v2float %927 %928 + %930 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %931 = OpLoad %float %930 + %932 = OpCompositeExtract %float %883 1 + %933 = OpCompositeExtract %float %883 0 + %934 = OpCompositeConstruct %v2float %932 %933 + %935 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %936 = OpLoad %float %935 + %937 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %937 %913 + %938 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %938 %936 + %939 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %939 + %941 = OpFOrdGreaterThan %bool %931 %float_0_25 + OpSelectionMerge %942 None + OpBranchConditional %941 %943 %942 + %943 = OpLabel + %944 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %944 + %945 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + %946 = OpLoad %int %945 + %947 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %947 %31 + %948 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %948 %946 + %949 = OpCompositeExtract %float %872 1 + %950 = OpCompositeExtract %float %872 1 + %951 = OpCompositeConstruct %v3float %913 %949 %950 + %952 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %953 = OpLoad %float %952 + %954 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %954 %913 + %955 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %955 %953 + %956 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %957 = OpLoad %int %956 %958 = OpLoad %QuicksortObject %obj - OpStore %obj %103 + OpStore %obj %15 OpStore %obj %958 - %959 = OpCompositeExtract %float %935 0 - %960 = OpCompositeExtract %float %928 0 - %961 = OpCompositeExtract %float %928 1 - %962 = OpCompositeConstruct %v3float %959 %960 %961 - %963 = OpAccessChain %_ptr_Function_float %color %uint_0 - %964 = OpConvertSToF %float %942 - %965 = OpFAdd %float %949 %964 - OpStore %963 %965 - %966 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %966 - %967 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %967 - %968 = OpCompositeExtract %float %900 1 - %969 = OpCompositeExtract %float %900 1 - %970 = OpCompositeConstruct %v2float %968 %969 - %971 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %972 = OpLoad %float %971 - %973 = OpCompositeExtract %float %924 1 - %974 = OpCompositeExtract %float %924 0 - %975 = OpCompositeConstruct %v2float %973 %974 - %976 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %977 = OpLoad %float %976 - %978 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %978 %float_0 - %979 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %979 %977 - %980 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %980 - %982 = OpFOrdGreaterThan %bool %972 %float_0_25 - OpSelectionMerge %983 None - OpBranchConditional %982 %984 %983 - %984 = OpLabel - %985 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %985 - %986 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - %987 = OpLoad %int %986 - %988 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %988 %int_0 - %989 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %989 %987 - %990 = OpCompositeExtract %float %168 1 - %991 = OpCompositeExtract %float %912 1 - %992 = OpCompositeExtract %float %912 1 - %993 = OpCompositeConstruct %v3float %990 %991 %992 - %994 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %995 = OpLoad %float %994 + %959 = OpCompositeExtract %float %929 0 + %960 = OpCompositeExtract %float %929 0 + %961 = OpCompositeConstruct %v2float %959 %960 + %962 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %962 + %963 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %963 + %965 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %965 + %966 = OpAccessChain %_ptr_Function_float %color %31 + %967 = OpLoad %float %966 + %968 = OpAccessChain %_ptr_Function_float %color %31 + %969 = OpLoad %float %968 + %970 = OpAccessChain %_ptr_Function_float %color %31 + OpStore %970 %913 + %971 = OpAccessChain %_ptr_Function_float %color %31 + OpStore %971 %969 + %972 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %972 + %973 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %973 + %974 = OpCompositeExtract %float %929 1 + %975 = OpCompositeExtract %float %929 1 + %976 = OpCompositeExtract %float %160 1 + %977 = OpCompositeConstruct %v3float %974 %975 %976 + %978 = OpAccessChain %_ptr_Function_float %color %31 + %979 = OpLoad %float %978 + %980 = OpAccessChain %_ptr_Function_float %color %31 + OpStore %980 %913 + %981 = OpAccessChain %_ptr_Function_float %color %31 + OpStore %981 %979 + %982 = OpAccessChain %_ptr_Function_float %color %uint_0 + %983 = OpConvertSToF %float %957 + %984 = OpFAdd %float %983 %967 + OpStore %982 %984 + %985 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + %986 = OpLoad %int %985 + %987 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %987 %31 + %988 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %988 %986 + OpBranch %942 + %942 = OpLabel + %989 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %990 = OpLoad %float %989 + %991 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %991 %913 + %992 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %992 %990 + %993 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %994 = OpLoad %float %993 + %995 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %995 %913 %996 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %996 %float_0 + OpStore %996 %994 %997 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %997 %995 - %998 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 - %999 = OpLoad %int %998 - %1000 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1000 - %1001 = OpCompositeExtract %float %970 0 - %1002 = OpCompositeExtract %float %970 0 - %1003 = OpCompositeConstruct %v2float %1001 %1002 - %1004 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %1004 - %1005 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1005 - %1006 = OpCompositeExtract %float %38 2 - %1007 = OpCompositeExtract %float %168 1 - %1008 = OpCompositeConstruct %v2float %1006 %1007 - %1009 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1009 - %1010 = OpAccessChain %_ptr_Function_float %color %int_0 - %1011 = OpLoad %float %1010 - %1012 = OpAccessChain %_ptr_Function_float %color %int_0 + %998 = OpLoad %float %997 + %999 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1000 = OpLoad %float %999 + %1001 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1001 %913 + %1002 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1002 %1000 + %1003 = OpCompositeExtract %float %921 2 + %1004 = OpCompositeExtract %float %921 1 + %1005 = OpCompositeExtract %float %921 1 + %1006 = OpCompositeConstruct %v3float %1003 %1004 %1005 + %1007 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %1007 + %1008 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1009 = OpLoad %float %1008 + %1010 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1010 %913 + %1011 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1011 %1009 + %1012 = OpAccessChain %_ptr_Function_float %uv %uint_0 %1013 = OpLoad %float %1012 - %1014 = OpAccessChain %_ptr_Function_float %color %int_0 - OpStore %1014 %float_0 - %1015 = OpAccessChain %_ptr_Function_float %color %int_0 + %1014 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1014 %913 + %1015 = OpAccessChain %_ptr_Function_float %uv %uint_0 OpStore %1015 %1013 - %1016 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1016 - %1017 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1017 - %1018 = OpCompositeExtract %float %970 1 - %1019 = OpCompositeExtract %float %970 1 - %1020 = OpCompositeExtract %float %904 1 - %1021 = OpCompositeConstruct %v3float %1018 %1019 %1020 - %1022 = OpAccessChain %_ptr_Function_float %color %int_0 - %1023 = OpLoad %float %1022 - %1024 = OpAccessChain %_ptr_Function_float %color %int_0 - OpStore %1024 %float_0 - %1025 = OpAccessChain %_ptr_Function_float %color %int_0 - OpStore %1025 %1023 - %1026 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1027 = OpConvertSToF %float %999 - %1028 = OpFAdd %float %1027 %1011 - OpStore %1026 %1028 - %1029 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - %1030 = OpLoad %int %1029 - %1031 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %1031 %int_0 - %1032 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %1032 %1030 - OpBranch %983 - %983 = OpLabel - %1033 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1034 = OpLoad %float %1033 - %1035 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1035 %float_0 - %1036 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1036 %1034 - %1037 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1038 = OpLoad %float %1037 - %1039 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1039 %float_0 - %1040 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1040 %1038 - %1041 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1042 = OpLoad %float %1041 - %1043 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1044 = OpLoad %float %1043 - %1045 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1045 %float_0 + %1017 = OpFOrdGreaterThan %bool %998 %float_0_5 + OpSelectionMerge %1018 None + OpBranchConditional %1017 %1019 %1018 + %1019 = OpLabel + %1020 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1021 = OpLoad %float %1020 + %1022 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1022 %913 + %1023 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1023 %1021 + %1024 = OpCompositeExtract %float %160 0 + %1025 = OpCompositeExtract %float %160 0 + %1026 = OpCompositeConstruct %v2float %1024 %1025 + %1027 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1028 = OpLoad %float %1027 + %1029 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1029 %913 + %1030 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1030 %1028 + %1031 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1032 = OpLoad %float %1031 + %1033 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1033 %913 + %1034 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1034 %1032 + %1035 = OpCompositeExtract %float %921 0 + %1036 = OpCompositeExtract %float %921 2 + %1037 = OpCompositeExtract %float %160 1 + %1038 = OpCompositeConstruct %v3float %1035 %1036 %1037 + %1039 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1040 = OpLoad %float %1039 + %1041 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1041 %913 + %1042 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1042 %1040 + %1044 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 + %1045 = OpLoad %int %1044 %1046 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1046 %1044 - %1047 = OpCompositeExtract %float %962 2 - %1048 = OpCompositeExtract %float %962 1 - %1049 = OpCompositeExtract %float %962 1 - %1050 = OpCompositeConstruct %v3float %1047 %1048 %1049 - %1051 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %1051 - %1052 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1053 = OpLoad %float %1052 - %1054 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1054 %float_0 - %1055 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1055 %1053 - %1056 = OpCompositeExtract %float %168 1 - %1057 = OpCompositeExtract %float %168 1 - %1058 = OpCompositeConstruct %v2float %1056 %1057 - %1059 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1060 = OpLoad %float %1059 - %1061 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1061 %float_0 - %1062 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1062 %1060 - %1064 = OpFOrdGreaterThan %bool %1042 %float_0_5 - OpSelectionMerge %1065 None - OpBranchConditional %1064 %1066 %1065 - %1066 = OpLabel - %1067 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1068 = OpLoad %float %1067 - %1069 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1069 %float_0 - %1070 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1047 = OpLoad %float %1046 + %1048 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1048 %913 + %1049 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1049 %1047 + %1050 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1051 = OpLoad %float %1050 + %1052 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1052 %913 + %1053 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1053 %1051 + %1054 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 + %1055 = OpLoad %int %1054 + %1056 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 + OpStore %1056 %31 + %1057 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 + OpStore %1057 %1055 + %1058 = OpCompositeExtract %float %887 1 + %1059 = OpCompositeExtract %float %877 0 + %1060 = OpCompositeConstruct %v2float %1058 %1059 + %1061 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1062 = OpLoad %float %1061 + %1063 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1063 %913 + %1064 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1064 %1062 + %1065 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1066 = OpLoad %float %1065 + %1067 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 + %1068 = OpLoad %int %1067 + %1069 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 + OpStore %1069 %31 + %1070 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 OpStore %1070 %1068 - %1071 = OpCompositeExtract %float %896 0 - %1072 = OpCompositeExtract %float %896 0 + %1071 = OpCompositeExtract %float %1038 0 + %1072 = OpCompositeExtract %float %868 0 %1073 = OpCompositeConstruct %v2float %1071 %1072 %1074 = OpAccessChain %_ptr_Function_float %color %uint_0 %1075 = OpLoad %float %1074 %1076 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1076 %float_0 + OpStore %1076 %913 %1077 = OpAccessChain %_ptr_Function_float %color %uint_0 OpStore %1077 %1075 - %1078 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1079 = OpLoad %float %1078 - %1080 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1080 %float_0 - %1081 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1081 %1079 - %1082 = OpCompositeExtract %float %962 0 - %1083 = OpCompositeExtract %float %962 2 - %1084 = OpCompositeExtract %float %1058 1 - %1085 = OpCompositeConstruct %v3float %1082 %1083 %1084 - %1086 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1087 = OpLoad %float %1086 - %1088 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1088 %float_0 - %1089 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1089 %1087 - %1091 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 - %1092 = OpLoad %int %1091 + %1078 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1078 + %1079 = OpCompositeExtract %float %934 1 + %1080 = OpCompositeConstruct %v2float %1079 %913 + %1081 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1081 + %1082 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1083 = OpConvertSToF %float %1045 + %1084 = OpFAdd %float %1083 %1066 + OpStore %1082 %1084 + %1085 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1086 = OpLoad %float %1085 + %1087 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1087 %913 + %1088 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1088 %1086 + OpBranch %1018 + %1018 = OpLabel + %1089 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1089 + %1090 = OpCompositeExtract %float %877 0 + %1091 = OpCompositeExtract %float %877 0 + %1092 = OpCompositeConstruct %v2float %1090 %1091 %1093 = OpAccessChain %_ptr_Function_float %uv %uint_0 %1094 = OpLoad %float %1093 %1095 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1095 %float_0 + OpStore %1095 %913 %1096 = OpAccessChain %_ptr_Function_float %uv %uint_0 OpStore %1096 %1094 - %1097 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1097 = OpAccessChain %_ptr_Function_float %uv %31 %1098 = OpLoad %float %1097 - %1099 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1099 %float_0 + %1099 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %1099 %1100 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1100 %1098 - %1101 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 - %1102 = OpLoad %int %1101 - %1103 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 - OpStore %1103 %int_0 - %1104 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 - OpStore %1104 %1102 - %1105 = OpCompositeExtract %float %928 1 - %1106 = OpCompositeExtract %float %917 0 - %1107 = OpCompositeConstruct %v2float %1105 %1106 - %1108 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1101 = OpLoad %float %1100 + %1102 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1102 %913 + %1103 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1103 %1101 + %1105 = OpFOrdGreaterThan %bool %1098 %float_0_75 + OpSelectionMerge %1106 None + OpBranchConditional %1105 %1107 %1106 + %1107 = OpLabel + %1108 = OpAccessChain %_ptr_Function_float %color %uint_0 %1109 = OpLoad %float %1108 - %1110 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1110 %float_0 - %1111 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1110 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1110 %913 + %1111 = OpAccessChain %_ptr_Function_float %color %uint_0 OpStore %1111 %1109 - %1112 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1113 = OpLoad %float %1112 - %1114 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 - %1115 = OpLoad %int %1114 - %1116 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 - OpStore %1116 %int_0 - %1117 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_2 - OpStore %1117 %1115 - %1118 = OpCompositeExtract %float %1085 0 - %1119 = OpCompositeExtract %float %908 0 - %1120 = OpCompositeConstruct %v2float %1118 %1119 - %1121 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1122 = OpLoad %float %1121 - %1123 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1123 %float_0 - %1124 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1124 %1122 - %1125 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1125 - %1126 = OpCompositeExtract %float %975 1 - %1127 = OpCompositeExtract %float %168 1 - %1128 = OpCompositeConstruct %v2float %1126 %1127 - %1129 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1129 - %1130 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1131 = OpConvertSToF %float %1092 - %1132 = OpFAdd %float %1131 %1113 - OpStore %1130 %1132 - %1133 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1134 = OpLoad %float %1133 - %1135 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1135 %float_0 - %1136 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1136 %1134 - OpBranch %1065 - %1065 = OpLabel - %1137 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1137 - %1138 = OpCompositeExtract %float %917 0 - %1139 = OpCompositeExtract %float %917 0 - %1140 = OpCompositeConstruct %v2float %1138 %1139 - %1141 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1142 = OpLoad %float %1141 - %1143 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1143 %float_0 - %1144 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1144 %1142 - %1145 = OpAccessChain %_ptr_Function_float %uv %int_0 - %1146 = OpLoad %float %1145 - %1147 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1147 - %1148 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1149 = OpLoad %float %1148 - %1150 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1150 %float_0 - %1151 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1151 %1149 - %1153 = OpFOrdGreaterThan %bool %1146 %float_0_75 - OpSelectionMerge %1154 None - OpBranchConditional %1153 %1155 %1154 - %1155 = OpLabel - %1156 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1157 = OpLoad %float %1156 - %1158 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1158 %float_0 - %1159 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1159 %1157 - %1161 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 - %1162 = OpLoad %int %1161 - %1163 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1164 = OpLoad %float %1163 - %1165 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1165 %float_0 - %1166 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1166 %1164 - %1167 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1167 - %1168 = OpCompositeExtract %float %1140 0 - %1169 = OpCompositeExtract %float %1140 0 - %1170 = OpCompositeExtract %float %1140 0 - %1171 = OpCompositeConstruct %v3float %1168 %1169 %1170 - %1172 = OpAccessChain %_ptr_Function_float %uv %int_0 - %1173 = OpLoad %float %1172 - %1174 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1174 %float_0 - %1175 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1175 %1173 - %1176 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1177 = OpLoad %float %1176 - %1178 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1178 %float_0 - %1179 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1179 %1177 - %1180 = OpAccessChain %_ptr_Function_float %color %uint_2 - %1181 = OpLoad %float %1180 - %1182 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1182 - %1183 = OpCompositeExtract %float %1140 0 - %1184 = OpCompositeExtract %float %917 1 - %1185 = OpCompositeExtract %float %1140 1 - %1186 = OpCompositeConstruct %v3float %1183 %1184 %1185 - %1187 = OpAccessChain %_ptr_Function_float %color %uint_2 - %1188 = OpLoad %float %1187 - %1189 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1189 %float_0 - %1190 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1190 %1188 - %1191 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - %1192 = OpLoad %int %1191 - %1193 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %1193 %int_0 - %1194 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 + %1113 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %1114 = OpLoad %int %1113 + %1115 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1116 = OpLoad %float %1115 + %1117 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1117 %913 + %1118 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1118 %1116 + %1119 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %1119 + %1120 = OpCompositeExtract %float %1092 0 + %1121 = OpCompositeExtract %float %1092 0 + %1122 = OpCompositeExtract %float %1092 0 + %1123 = OpCompositeConstruct %v3float %1120 %1121 %1122 + %1124 = OpAccessChain %_ptr_Function_float %uv %31 + %1125 = OpLoad %float %1124 + %1126 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1126 %913 + %1127 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1127 %1125 + %1128 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1129 = OpLoad %float %1128 + %1130 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1130 %913 + %1131 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1131 %1129 + %1132 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1133 = OpLoad %float %1132 + %1134 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %1134 + %1135 = OpCompositeExtract %float %1092 0 + %1136 = OpCompositeExtract %float %877 1 + %1137 = OpCompositeExtract %float %1092 1 + %1138 = OpCompositeConstruct %v3float %1135 %1136 %1137 + %1139 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1140 = OpLoad %float %1139 + %1141 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1141 %913 + %1142 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1142 %1140 + %1143 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + %1144 = OpLoad %int %1143 + %1145 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %1145 %31 + %1146 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %1146 %1144 + %1147 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1148 = OpLoad %float %1147 + %1149 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1149 %913 + %1150 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1150 %1148 + %1151 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1152 = OpConvertSToF %float %1114 + %1153 = OpFAdd %float %1133 %1152 + OpStore %1151 %1153 + %1154 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %1154 + %1155 = OpCompositeExtract %float %160 1 + %1156 = OpCompositeExtract %float %160 1 + %1157 = OpCompositeConstruct %v2float %1155 %1156 + OpBranch %1106 + %1106 = OpLabel + %1158 = OpAccessChain %_ptr_Function_float %uv %31 + %1159 = OpLoad %float %1158 + %1160 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1160 %913 + %1161 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1161 %1159 + %1162 = OpCompositeExtract %float %929 0 + %1163 = OpCompositeExtract %float %929 1 + %1164 = OpCompositeExtract %float %929 1 + %1165 = OpCompositeConstruct %v3float %1162 %1163 %1164 + %1167 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1168 = OpLoad %int %1167 + %1169 = OpAccessChain %_ptr_Function_float %uv %31 + %1170 = OpLoad %float %1169 + %1171 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1171 %913 + %1172 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1172 %1170 + %1173 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %1173 + %1174 = OpCompositeExtract %float %160 1 + %1175 = OpCompositeExtract %float %921 0 + %1176 = OpCompositeExtract %float %921 0 + %1177 = OpCompositeConstruct %v3float %1174 %1175 %1176 + %1178 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1179 = OpLoad %int %1178 + %1180 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1180 %31 + %1181 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1181 %1179 + %1182 = OpCompositeExtract %float %877 0 + %1183 = OpCompositeExtract %float %863 2 + %1184 = OpCompositeConstruct %v2float %1182 %1183 + %1185 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1186 = OpLoad %float %1185 + %1187 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1187 %913 + %1188 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1188 %1186 + %1189 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1190 = OpLoad %float %1189 + %1191 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1192 = OpLoad %float %1191 + %1193 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1193 %913 + %1194 = OpAccessChain %_ptr_Function_float %color %uint_1 OpStore %1194 %1192 - %1195 = OpCompositeExtract %float %168 0 - %1196 = OpCompositeExtract %float %168 1 + %1195 = OpCompositeExtract %float %1092 0 + %1196 = OpCompositeExtract %float %887 0 %1197 = OpCompositeConstruct %v2float %1195 %1196 - %1198 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1198 = OpAccessChain %_ptr_Function_float %uv %uint_0 %1199 = OpLoad %float %1198 - %1200 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1200 %float_0 - %1201 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1200 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1200 %913 + %1201 = OpAccessChain %_ptr_Function_float %uv %uint_0 OpStore %1201 %1199 - %1202 = OpAccessChain %_ptr_Function_float %color %uint_2 - %1203 = OpConvertSToF %float %1162 - %1204 = OpFAdd %float %1181 %1203 - OpStore %1202 %1204 - %1205 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %1205 - %1206 = OpCompositeExtract %float %1197 1 - %1207 = OpCompositeExtract %float %1197 1 + %1202 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1203 = OpLoad %float %1202 + %1204 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1204 %913 + %1205 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1205 %1203 + %1206 = OpCompositeExtract %float %895 2 + %1207 = OpCompositeExtract %float %1006 1 %1208 = OpCompositeConstruct %v2float %1206 %1207 - OpBranch %1154 - %1154 = OpLabel - %1209 = OpAccessChain %_ptr_Function_float %uv %int_0 - %1210 = OpLoad %float %1209 - %1211 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1211 %float_0 - %1212 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1212 %1210 - %1213 = OpCompositeExtract %float %970 0 - %1214 = OpCompositeExtract %float %970 1 - %1215 = OpCompositeExtract %float %970 1 - %1216 = OpCompositeConstruct %v3float %1213 %1214 %1215 - %1218 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - %1219 = OpLoad %int %1218 - %1220 = OpAccessChain %_ptr_Function_float %uv %int_0 - %1221 = OpLoad %float %1220 - %1222 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1222 %float_0 - %1223 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1223 %1221 - %1224 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1224 - %1225 = OpCompositeExtract %float %896 1 - %1226 = OpCompositeExtract %float %962 0 - %1227 = OpCompositeExtract %float %962 0 - %1228 = OpCompositeConstruct %v3float %1225 %1226 %1227 - %1229 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - %1230 = OpLoad %int %1229 - %1231 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - OpStore %1231 %int_0 - %1232 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - OpStore %1232 %1230 - %1233 = OpCompositeExtract %float %917 0 - %1234 = OpCompositeExtract %float %900 2 - %1235 = OpCompositeConstruct %v2float %1233 %1234 - %1236 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1237 = OpLoad %float %1236 - %1238 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1238 %float_0 - %1239 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1239 %1237 + %1209 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1210 = OpConvertSToF %float %1168 + %1211 = OpFAdd %float %1190 %1210 + OpStore %1209 %1211 + %1212 = OpCompositeExtract %float %1165 0 + %1213 = OpCompositeConstruct %v3float %913 %1212 %913 + %1214 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1215 = OpLoad %float %1214 + %1216 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1216 %913 + %1217 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1217 %1215 + %1218 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1219 = OpLoad %float %1218 + %1220 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1220 %913 + %1221 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1221 %1219 + %1222 = OpCompositeExtract %float %1165 0 + %1223 = OpCompositeExtract %float %1165 1 + %1224 = OpCompositeConstruct %v2float %1222 %1223 + %1225 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1226 = OpLoad %float %1225 + %1227 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1227 %913 + %1228 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1228 %1226 + %1229 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1230 = OpLoad %float %1229 + %1231 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1231 + %1232 = OpCompositeExtract %float %929 1 + %1233 = OpCompositeConstruct %v3float %913 %1232 %913 + %1234 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + %1235 = OpLoad %int %1234 + %1236 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %1236 %31 + %1237 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %1237 %1235 + %1238 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1239 = OpLoad %float %1238 %1240 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1241 = OpLoad %float %1240 - %1242 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1243 = OpLoad %float %1242 - %1244 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1244 %float_0 - %1245 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1245 %1243 - %1246 = OpCompositeExtract %float %1140 0 - %1247 = OpCompositeExtract %float %928 0 - %1248 = OpCompositeConstruct %v2float %1246 %1247 - %1249 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1250 = OpLoad %float %1249 - %1251 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1251 %float_0 - %1252 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1252 %1250 - %1253 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1254 = OpLoad %float %1253 - %1255 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1255 %float_0 - %1256 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1256 %1254 - %1257 = OpCompositeExtract %float %935 2 - %1258 = OpCompositeExtract %float %1050 1 - %1259 = OpCompositeConstruct %v2float %1257 %1258 - %1260 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1261 = OpConvertSToF %float %1219 - %1262 = OpFAdd %float %1241 %1261 - OpStore %1260 %1262 - %1263 = OpCompositeExtract %float %168 0 - %1264 = OpCompositeExtract %float %1216 0 - %1265 = OpCompositeExtract %float %168 1 - %1266 = OpCompositeConstruct %v3float %1263 %1264 %1265 - %1267 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1240 %913 + %1241 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1241 %1239 + %1242 = OpCompositeExtract %float %160 0 + %1243 = OpCompositeExtract %float %160 0 + %1244 = OpCompositeConstruct %v3float %1242 %1243 %913 + %1245 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1246 = OpLoad %float %1245 + %1247 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1247 %913 + %1248 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1248 %1246 + %1249 = OpFOrdGreaterThan %bool %1230 %float_0_25 + OpSelectionMerge %1250 None + OpBranchConditional %1249 %1251 %1250 + %1251 = OpLabel + %1252 = OpCompositeExtract %float %160 0 + %1253 = OpCompositeExtract %float %1244 2 + %1254 = OpCompositeConstruct %v2float %1252 %1253 + %1255 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %1255 + %1257 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_5 + %1258 = OpLoad %int %1257 + %1259 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1260 = OpLoad %float %1259 + %1261 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1261 %913 + %1262 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1262 %1260 + %1263 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1263 + %1264 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1264 + %1265 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1266 = OpLoad %float %1265 + %1267 = OpAccessChain %_ptr_Function_float %uv %31 %1268 = OpLoad %float %1267 - %1269 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1269 %float_0 - %1270 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1269 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1269 %913 + %1270 = OpAccessChain %_ptr_Function_float %uv %31 OpStore %1270 %1268 - %1271 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1272 = OpLoad %float %1271 - %1273 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1273 %float_0 - %1274 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1274 %1272 - %1275 = OpCompositeExtract %float %1216 0 - %1276 = OpCompositeExtract %float %1216 1 - %1277 = OpCompositeConstruct %v2float %1275 %1276 + %1271 = OpCompositeExtract %float %934 0 + %1272 = OpCompositeExtract %float %1197 1 + %1273 = OpCompositeExtract %float %934 1 + %1274 = OpCompositeConstruct %v3float %1271 %1272 %1273 + %1275 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %1275 + %1276 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1277 = OpLoad %float %1276 %1278 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1279 = OpLoad %float %1278 - %1280 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1280 %float_0 - %1281 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1281 %1279 - %1282 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1283 = OpLoad %float %1282 - %1284 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1284 - %1285 = OpCompositeExtract %float %168 1 - %1286 = OpCompositeExtract %float %970 1 - %1287 = OpCompositeExtract %float %168 0 - %1288 = OpCompositeConstruct %v3float %1285 %1286 %1287 - %1289 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - %1290 = OpLoad %int %1289 - %1291 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %1291 %int_0 - %1292 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %1292 %1290 - %1293 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1294 = OpLoad %float %1293 - %1295 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1295 %float_0 - %1296 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1296 %1294 - %1297 = OpCompositeExtract %float %896 0 - %1298 = OpCompositeExtract %float %896 0 - %1299 = OpCompositeExtract %float %168 1 - %1300 = OpCompositeConstruct %v3float %1297 %1298 %1299 - %1301 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1302 = OpLoad %float %1301 - %1303 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1303 %float_0 - %1304 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1304 %1302 - %1305 = OpFOrdGreaterThan %bool %1283 %float_0_25 - OpSelectionMerge %1306 None - OpBranchConditional %1305 %1307 %1306 - %1307 = OpLabel - %1308 = OpCompositeExtract %float %904 0 - %1309 = OpCompositeExtract %float %1300 2 - %1310 = OpCompositeConstruct %v2float %1308 %1309 - %1311 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1311 - %1313 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_5 - %1314 = OpLoad %int %1313 - %1315 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1316 = OpLoad %float %1315 - %1317 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1317 %float_0 - %1318 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1318 %1316 - %1319 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1319 - %1320 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1320 - %1321 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1322 = OpLoad %float %1321 - %1323 = OpAccessChain %_ptr_Function_float %uv %int_0 - %1324 = OpLoad %float %1323 - %1325 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1325 %float_0 - %1326 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1326 %1324 - %1327 = OpCompositeExtract %float %975 0 - %1328 = OpCompositeExtract %float %1248 1 - %1329 = OpCompositeExtract %float %975 1 - %1330 = OpCompositeConstruct %v3float %1327 %1328 %1329 - %1331 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1331 - %1332 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1278 %913 + %1279 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1279 %1277 + %1280 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1280 + %1281 = OpCompositeExtract %float %863 3 + %1282 = OpCompositeExtract %float %863 3 + %1283 = OpCompositeExtract %float %883 0 + %1284 = OpCompositeConstruct %v3float %1281 %1282 %1283 + %1285 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1286 = OpLoad %float %1285 + %1287 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1287 %913 + %1288 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1288 %1286 + %1289 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1290 = OpConvertSToF %float %1258 + %1291 = OpFAdd %float %1290 %1266 + OpStore %1289 %1291 + %1292 = OpCompositeExtract %float %929 1 + %1293 = OpCompositeExtract %float %887 0 + %1294 = OpCompositeExtract %float %929 1 + %1295 = OpCompositeConstruct %v3float %1292 %1293 %1294 + %1296 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1297 = OpLoad %float %1296 + %1298 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1298 %913 + %1299 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1299 %1297 + OpBranch %1250 + %1250 = OpLabel + %1300 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1301 = OpLoad %float %1300 + %1302 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1302 %913 + %1303 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1303 %1301 + %1304 = OpCompositeExtract %float %1092 0 + %1305 = OpCompositeExtract %float %887 1 + %1306 = OpCompositeExtract %float %887 0 + %1307 = OpCompositeConstruct %v3float %1304 %1305 %1306 + %1308 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1309 = OpLoad %float %1308 + %1310 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1310 %913 + %1311 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1311 %1309 + %1312 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1313 = OpLoad %int %1312 + %1314 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1314 %31 + %1315 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1315 %1313 + %1316 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1317 = OpLoad %float %1316 + %1318 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + %1319 = OpLoad %int %1318 + %1320 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %1320 %31 + %1321 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %1321 %1319 + %1322 = OpFOrdGreaterThan %bool %1317 %float_0_5 + OpSelectionMerge %1323 None + OpBranchConditional %1322 %1324 %1323 + %1324 = OpLabel + %1325 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1326 = OpLoad %float %1325 + %1327 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1327 %913 + %1328 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1328 %1326 + %1329 = OpCompositeExtract %float %1244 1 + %1330 = OpCompositeExtract %float %934 1 + %1331 = OpCompositeConstruct %v2float %1329 %1330 + %1332 = OpAccessChain %_ptr_Function_float %color %uint_1 %1333 = OpLoad %float %1332 - %1334 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1334 %float_0 - %1335 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1334 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1334 %913 + %1335 = OpAccessChain %_ptr_Function_float %color %uint_1 OpStore %1335 %1333 - %1336 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1336 - %1337 = OpCompositeExtract %float %900 3 - %1338 = OpCompositeExtract %float %900 3 - %1339 = OpCompositeExtract %float %924 0 - %1340 = OpCompositeConstruct %v3float %1337 %1338 %1339 - %1341 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1342 = OpLoad %float %1341 - %1343 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1343 %float_0 - %1344 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1344 %1342 - %1345 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1346 = OpConvertSToF %float %1314 - %1347 = OpFAdd %float %1346 %1322 - OpStore %1345 %1347 - %1348 = OpCompositeExtract %float %970 1 - %1349 = OpCompositeExtract %float %928 0 - %1350 = OpCompositeExtract %float %970 1 - %1351 = OpCompositeConstruct %v3float %1348 %1349 %1350 - %1352 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1353 = OpLoad %float %1352 - %1354 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1354 %float_0 - %1355 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1355 %1353 - OpBranch %1306 - %1306 = OpLabel - %1356 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1357 = OpLoad %float %1356 - %1358 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1358 %float_0 - %1359 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1359 %1357 - %1360 = OpCompositeExtract %float %1140 0 - %1361 = OpCompositeExtract %float %928 1 - %1362 = OpCompositeExtract %float %928 0 - %1363 = OpCompositeConstruct %v3float %1360 %1361 %1362 - %1364 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1365 = OpLoad %float %1364 - %1366 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1366 %float_0 - %1367 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1367 %1365 - %1368 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1336 = OpCompositeExtract %float %881 2 + %1337 = OpCompositeExtract %float %881 1 + %1338 = OpCompositeConstruct %v2float %1336 %1337 + %1339 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1340 = OpLoad %float %1339 + %1341 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1341 %913 + %1342 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1342 %1340 + %1344 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 + %1345 = OpLoad %int %1344 + %1346 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1347 = OpLoad %float %1346 + %1348 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1348 %913 + %1349 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1349 %1347 + %1350 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1350 + %1351 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1352 = OpLoad %int %1351 + %1353 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1353 %31 + %1354 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1354 %1352 + %1355 = OpCompositeExtract %float %1177 2 + %1356 = OpCompositeExtract %float %1177 1 + %1357 = OpCompositeConstruct %v2float %1355 %1356 + %1358 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1359 = OpLoad %float %1358 + %1360 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %1360 + %1361 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1362 = OpLoad %float %1361 + %1363 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1363 %913 + %1364 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1364 %1362 + %1365 = OpCompositeExtract %float %1197 1 + %1366 = OpCompositeExtract %float %1197 0 + %1367 = OpCompositeConstruct %v2float %1365 %1366 + %1368 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 %1369 = OpLoad %int %1368 - %1370 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - OpStore %1370 %int_0 - %1371 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1370 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 + OpStore %1370 %31 + %1371 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 OpStore %1371 %1369 - %1372 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1373 = OpLoad %float %1372 - %1374 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - %1375 = OpLoad %int %1374 - %1376 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %1376 %int_0 - %1377 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %1377 %1375 - %1378 = OpFOrdGreaterThan %bool %1373 %float_0_5 - OpSelectionMerge %1379 None - OpBranchConditional %1378 %1380 %1379 - %1380 = OpLabel - %1381 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1382 = OpLoad %float %1381 - %1383 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1383 %float_0 - %1384 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1384 %1382 - %1385 = OpCompositeExtract %float %1300 1 - %1386 = OpCompositeExtract %float %975 1 - %1387 = OpCompositeConstruct %v2float %1385 %1386 - %1388 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1389 = OpLoad %float %1388 - %1390 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1390 %float_0 + %1372 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 + %1373 = OpLoad %int %1372 + %1374 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 + OpStore %1374 %31 + %1375 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 + OpStore %1375 %1373 + %1376 = OpCompositeExtract %float %1244 2 + %1377 = OpCompositeExtract %float %1244 2 + %1378 = OpCompositeConstruct %v2float %1376 %1377 + %1379 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %1379 + %1380 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1381 = OpConvertSToF %float %1345 + %1382 = OpFAdd %float %1381 %1359 + OpStore %1380 %1382 + %1383 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1384 = OpLoad %float %1383 + %1385 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1385 %913 + %1386 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1386 %1384 + %1387 = OpCompositeExtract %float %929 0 + %1388 = OpCompositeConstruct %v2float %float_2 %1387 + %1389 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1390 = OpLoad %float %1389 %1391 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1391 %1389 - %1392 = OpCompositeExtract %float %922 2 - %1393 = OpCompositeExtract %float %922 1 - %1394 = OpCompositeConstruct %v2float %1392 %1393 - %1395 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1396 = OpLoad %float %1395 - %1397 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1397 %float_0 - %1398 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1398 %1396 - %1400 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 - %1401 = OpLoad %int %1400 - %1402 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1403 = OpLoad %float %1402 - %1404 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1404 %float_0 - %1405 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1405 %1403 - %1406 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1406 - %1407 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - %1408 = OpLoad %int %1407 - %1409 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - OpStore %1409 %int_0 - %1410 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - OpStore %1410 %1408 - %1411 = OpCompositeExtract %float %1228 2 - %1412 = OpCompositeExtract %float %1228 1 - %1413 = OpCompositeConstruct %v2float %1411 %1412 - %1414 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1415 = OpLoad %float %1414 - %1416 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %1416 - %1417 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1418 = OpLoad %float %1417 - %1419 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1419 %float_0 - %1420 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1420 %1418 - %1421 = OpCompositeExtract %float %1248 1 - %1422 = OpCompositeExtract %float %1248 0 - %1423 = OpCompositeConstruct %v2float %1421 %1422 - %1424 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 - %1425 = OpLoad %int %1424 - %1426 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 - OpStore %1426 %int_0 - %1427 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 - OpStore %1427 %1425 - %1428 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 - %1429 = OpLoad %int %1428 - %1430 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 - OpStore %1430 %int_0 - %1431 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_6 - OpStore %1431 %1429 - %1432 = OpCompositeExtract %float %1300 2 - %1433 = OpCompositeExtract %float %1300 2 - %1434 = OpCompositeConstruct %v2float %1432 %1433 - %1435 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1435 - %1436 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1437 = OpConvertSToF %float %1401 - %1438 = OpFAdd %float %1437 %1415 - OpStore %1436 %1438 - %1439 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1440 = OpLoad %float %1439 - %1441 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1441 %float_0 - %1442 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1442 %1440 - %1443 = OpCompositeExtract %float %38 1 - %1444 = OpCompositeExtract %float %970 0 - %1445 = OpCompositeConstruct %v2float %1443 %1444 + OpStore %1391 %913 + %1392 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1392 %1390 + OpBranch %1323 + %1323 = OpLabel + %1393 = OpCompositeExtract %float %934 1 + %1394 = OpCompositeExtract %float %934 1 + %1395 = OpCompositeConstruct %v2float %1393 %1394 + %1396 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1397 = OpLoad %float %1396 + %1398 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1398 %913 + %1399 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1399 %1397 + %1400 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1401 = OpLoad %float %1400 + %1402 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %1402 + %1403 = OpCompositeExtract %float %1197 0 + %1404 = OpCompositeExtract %float %1197 1 + %1405 = OpCompositeConstruct %v2float %1403 %1404 + %1406 = OpAccessChain %_ptr_Function_float %uv %31 + %1407 = OpLoad %float %1406 + %1408 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1408 %913 + %1409 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1409 %1407 + %1410 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1411 = OpLoad %float %1410 + %1412 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1412 %913 + %1413 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1413 %1411 + %1414 = OpCompositeExtract %float %877 0 + %1415 = OpCompositeExtract %float %877 1 + %1416 = OpCompositeExtract %float %877 1 + %1417 = OpCompositeConstruct %v3float %1414 %1415 %1416 + %1418 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1419 = OpLoad %int %1418 + %1420 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1420 %31 + %1421 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1421 %1419 + %1422 = OpFOrdGreaterThan %bool %1401 %float_0_75 + OpSelectionMerge %1423 None + OpBranchConditional %1422 %1424 %1423 + %1424 = OpLabel + %1425 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %1425 + %1426 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1427 = OpLoad %float %1426 + %1428 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1428 %913 + %1429 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1429 %1427 + %1430 = OpCompositeExtract %float %883 1 + %1431 = OpCompositeExtract %float %883 0 + %1432 = OpCompositeExtract %float %883 1 + %1433 = OpCompositeConstruct %v3float %1430 %1431 %1432 + %1434 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %1434 + %1436 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %1437 = OpLoad %int %1436 + %1438 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1439 = OpLoad %float %1438 + %1440 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1440 %913 + %1441 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1441 %1439 + %1442 = OpCompositeExtract %float %1197 0 + %1443 = OpCompositeExtract %float %1092 1 + %1444 = OpCompositeExtract %float %1092 0 + %1445 = OpCompositeConstruct %v3float %1442 %1443 %1444 %1446 = OpAccessChain %_ptr_Function_float %color %uint_1 %1447 = OpLoad %float %1446 %1448 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1448 %float_0 + OpStore %1448 %913 %1449 = OpAccessChain %_ptr_Function_float %color %uint_1 OpStore %1449 %1447 - OpBranch %1379 - %1379 = OpLabel - %1450 = OpCompositeExtract %float %975 1 - %1451 = OpCompositeExtract %float %975 1 + %1450 = OpCompositeExtract %float %1213 0 + %1451 = OpCompositeExtract %float %160 1 %1452 = OpCompositeConstruct %v2float %1450 %1451 - %1453 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1454 = OpLoad %float %1453 - %1455 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1455 %float_0 - %1456 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1453 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + %1454 = OpLoad %int %1453 + %1455 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 + OpStore %1455 %31 + %1456 = OpAccessChain %_ptr_Private_int %obj %uint_0 %499 OpStore %1456 %1454 - %1457 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1457 = OpAccessChain %_ptr_Function_float %color %uint_1 %1458 = OpLoad %float %1457 - %1459 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1459 - %1460 = OpCompositeExtract %float %1248 0 - %1461 = OpCompositeExtract %float %1248 1 - %1462 = OpCompositeConstruct %v2float %1460 %1461 - %1463 = OpAccessChain %_ptr_Function_float %uv %int_0 - %1464 = OpLoad %float %1463 - %1465 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1465 %float_0 - %1466 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1466 %1464 - %1467 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1468 = OpLoad %float %1467 - %1469 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1469 %float_0 - %1470 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1470 %1468 - %1471 = OpCompositeExtract %float %917 0 - %1472 = OpCompositeExtract %float %917 1 - %1473 = OpCompositeExtract %float %917 1 - %1474 = OpCompositeConstruct %v3float %1471 %1472 %1473 - %1475 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - %1476 = OpLoad %int %1475 - %1477 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - OpStore %1477 %int_0 - %1478 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - OpStore %1478 %1476 - %1479 = OpFOrdGreaterThan %bool %1458 %float_0_75 - OpSelectionMerge %1480 None - OpBranchConditional %1479 %1481 %1480 - %1481 = OpLabel - %1482 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1482 - %1483 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1484 = OpLoad %float %1483 - %1485 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1485 %float_0 - %1486 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1486 %1484 - %1487 = OpCompositeExtract %float %924 1 - %1488 = OpCompositeExtract %float %924 0 - %1489 = OpCompositeExtract %float %924 1 - %1490 = OpCompositeConstruct %v3float %1487 %1488 %1489 - %1491 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1491 - %1493 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 - %1494 = OpLoad %int %1493 - %1495 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1496 = OpLoad %float %1495 - %1497 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1497 %float_0 - %1498 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1498 %1496 - %1499 = OpCompositeExtract %float %1248 0 - %1500 = OpCompositeExtract %float %1140 1 - %1501 = OpCompositeExtract %float %1140 0 - %1502 = OpCompositeConstruct %v3float %1499 %1500 %1501 + %1459 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1459 %913 + %1460 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1460 %1458 + %1461 = OpCompositeExtract %float %1224 0 + %1462 = OpCompositeExtract %float %1224 1 + %1463 = OpCompositeExtract %float %1224 0 + %1464 = OpCompositeConstruct %v3float %1461 %1462 %1463 + %1465 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1466 = OpLoad %float %1465 + %1467 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1467 %913 + %1468 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1468 %1466 + %1469 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1470 = OpLoad %float %1469 + %1471 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1472 = OpLoad %float %1471 + %1473 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1473 %913 + %1474 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1474 %1472 + %1475 = OpCompositeExtract %float %863 0 + %1476 = OpCompositeExtract %float %863 1 + %1477 = OpCompositeConstruct %v2float %1475 %1476 + %1478 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1479 = OpLoad %float %1478 + %1480 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1480 %913 + %1481 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1481 %1479 + %1482 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1483 = OpLoad %float %1482 + %1484 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1484 %913 + %1485 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1485 %1483 + %1486 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1487 = OpLoad %float %1486 + %1488 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1488 %913 + %1489 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1489 %1487 + %1490 = OpCompositeExtract %float %1477 1 + %1491 = OpCompositeExtract %float %1477 1 + %1492 = OpCompositeExtract %float %1417 2 + %1493 = OpCompositeConstruct %v3float %1490 %1491 %1492 + %1494 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1495 = OpLoad %float %1494 + %1496 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1496 %913 + %1497 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1497 %1495 + %1498 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1499 = OpConvertSToF %float %1437 + %1500 = OpFAdd %float %1499 %1470 + OpStore %1498 %1500 + %1501 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1502 = OpLoad %float %1501 %1503 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1504 = OpLoad %float %1503 - %1505 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1505 %float_0 - %1506 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1506 %1504 - %1507 = OpCompositeExtract %float %1266 0 - %1508 = OpCompositeExtract %float %1058 1 - %1509 = OpCompositeConstruct %v2float %1507 %1508 - %1510 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - %1511 = OpLoad %int %1510 - %1512 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %1512 %int_0 - %1513 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_0 - OpStore %1513 %1511 - %1514 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1515 = OpLoad %float %1514 - %1516 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1516 %float_0 - %1517 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1517 %1515 - %1518 = OpCompositeExtract %float %1277 0 - %1519 = OpCompositeExtract %float %1277 1 - %1520 = OpCompositeExtract %float %1277 0 - %1521 = OpCompositeConstruct %v3float %1518 %1519 %1520 - %1522 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1523 = OpLoad %float %1522 - %1524 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1524 %float_0 - %1525 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1525 %1523 - %1526 = OpAccessChain %_ptr_Function_float %color %uint_2 - %1527 = OpLoad %float %1526 - %1528 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1503 %913 + %1504 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1504 %1502 + %1505 = OpCompositeExtract %float %921 0 + %1506 = OpCompositeExtract %float %921 2 + %1507 = OpCompositeConstruct %v2float %1505 %1506 + %1508 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1509 = OpLoad %float %1508 + %1510 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1510 %913 + %1511 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1511 %1509 + OpBranch %1423 + %1423 = OpLabel + %1512 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1512 + %1513 = OpCompositeExtract %float %895 1 + %1514 = OpCompositeExtract %float %883 1 + %1515 = OpCompositeConstruct %v2float %1513 %1514 + %1516 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %1516 + %1518 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %1519 = OpLoad %int %1518 + %1520 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1520 + %1521 = OpCompositeExtract %float %868 0 + %1522 = OpCompositeExtract %float %895 2 + %1523 = OpCompositeConstruct %v2float %1521 %1522 + %1524 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %1525 = OpLoad %int %1524 + %1526 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + OpStore %1526 %31 + %1527 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + OpStore %1527 %1525 + %1528 = OpAccessChain %_ptr_Function_float %color %uint_1 %1529 = OpLoad %float %1528 - %1530 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1530 %float_0 - %1531 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1530 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1530 %913 + %1531 = OpAccessChain %_ptr_Function_float %color %uint_1 OpStore %1531 %1529 - %1532 = OpCompositeExtract %float %900 0 - %1533 = OpCompositeExtract %float %900 1 - %1534 = OpCompositeConstruct %v2float %1532 %1533 - %1535 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1536 = OpLoad %float %1535 - %1537 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1537 %float_0 - %1538 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1538 %1536 - %1539 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1540 = OpLoad %float %1539 - %1541 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1541 %float_0 - %1542 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1542 %1540 - %1543 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1544 = OpLoad %float %1543 - %1545 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1545 %float_0 - %1546 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1546 %1544 - %1547 = OpCompositeExtract %float %1534 1 - %1548 = OpCompositeExtract %float %1534 1 - %1549 = OpCompositeExtract %float %1474 2 - %1550 = OpCompositeConstruct %v3float %1547 %1548 %1549 - %1551 = OpAccessChain %_ptr_Function_float %color %uint_2 - %1552 = OpLoad %float %1551 - %1553 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1553 %float_0 - %1554 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1554 %1552 - %1555 = OpAccessChain %_ptr_Function_float %color %uint_2 - %1556 = OpConvertSToF %float %1494 - %1557 = OpFAdd %float %1556 %1527 - OpStore %1555 %1557 - %1558 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1559 = OpLoad %float %1558 - %1560 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1560 %float_0 - %1561 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1561 %1559 - %1562 = OpCompositeExtract %float %962 0 - %1563 = OpCompositeExtract %float %962 2 - %1564 = OpCompositeConstruct %v2float %1562 %1563 - %1565 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1566 = OpLoad %float %1565 - %1567 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1567 %float_0 - %1568 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1568 %1566 - OpBranch %1480 - %1480 = OpLabel - %1569 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1569 - %1570 = OpCompositeExtract %float %935 1 - %1571 = OpCompositeExtract %float %924 1 - %1572 = OpCompositeConstruct %v2float %1570 %1571 + %1532 = OpCompositeExtract %float %921 1 + %1533 = OpCompositeConstruct %v2float %1532 %913 + %1534 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1535 = OpLoad %float %1534 + %1536 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1536 %913 + %1537 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1537 %1535 + %1538 = OpCompositeExtract %float %1533 0 + %1539 = OpCompositeExtract %float %1533 1 + %1540 = OpCompositeExtract %float %1533 0 + %1541 = OpCompositeConstruct %v3float %1538 %1539 %1540 + %1542 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1543 = OpLoad %float %1542 + %1544 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1544 %913 + %1545 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1545 %1543 + %1546 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1547 = OpLoad %float %1546 + %1548 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1549 = OpLoad %float %1548 + %1550 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1550 %913 + %1551 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1551 %1549 + %1552 = OpCompositeExtract %float %1405 0 + %1553 = OpCompositeExtract %float %1395 0 + %1554 = OpCompositeConstruct %v2float %1552 %1553 + %1555 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1556 = OpLoad %int %1555 + %1557 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1557 %31 + %1558 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1558 %1556 + %1559 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1560 = OpLoad %float %1559 + %1561 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1561 %913 + %1562 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1562 %1560 + %1563 = OpCompositeExtract %float %160 0 + %1564 = OpCompositeExtract %float %160 0 + %1565 = OpCompositeConstruct %v2float %1563 %1564 + %1566 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1567 = OpLoad %float %1566 + %1568 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1568 %913 + %1569 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1569 %1567 + %1570 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1571 = OpConvertSToF %float %1519 + %1572 = OpFAdd %float %1547 %1571 + OpStore %1570 %1572 %1573 = OpLoad %v2float %uv - OpStore %uv %876 + OpStore %uv %160 OpStore %uv %1573 - %1575 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 - %1576 = OpLoad %int %1575 - %1577 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1577 - %1578 = OpCompositeExtract %float %908 0 - %1579 = OpCompositeExtract %float %935 2 - %1580 = OpCompositeConstruct %v2float %1578 %1579 - %1581 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 - %1582 = OpLoad %int %1581 - %1583 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 - OpStore %1583 %int_0 - %1584 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 - OpStore %1584 %1582 - %1585 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1586 = OpLoad %float %1585 - %1587 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1587 %float_0 + %1574 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1575 = OpLoad %float %1574 + %1576 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1576 %913 + %1577 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1577 %1575 + %1578 = OpCompositeExtract %float %160 1 + %1579 = OpCompositeExtract %float %160 0 + %1580 = OpCompositeExtract %float %1554 1 + %1581 = OpCompositeConstruct %v3float %1578 %1579 %1580 + %1582 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1583 = OpLoad %float %1582 + %1584 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1584 %913 + %1585 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1585 %1583 + %1586 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1587 = OpLoad %float %1586 %1588 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1588 %1586 - %1589 = OpCompositeExtract %float %962 1 - %1590 = OpCompositeExtract %float %168 0 - %1591 = OpCompositeConstruct %v2float %1589 %1590 - %1592 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1593 = OpLoad %float %1592 - %1594 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1594 %float_0 - %1595 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1595 %1593 - %1596 = OpCompositeExtract %float %1591 0 - %1597 = OpCompositeExtract %float %1591 1 - %1598 = OpCompositeExtract %float %1591 0 - %1599 = OpCompositeConstruct %v3float %1596 %1597 %1598 - %1600 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1589 = OpLoad %float %1588 + %1590 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1590 %913 + %1591 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1591 %1589 + %1592 = OpCompositeExtract %float %1523 1 + %1593 = OpCompositeExtract %float %1523 0 + %1594 = OpCompositeExtract %float %872 2 + %1595 = OpCompositeConstruct %v3float %1592 %1593 %1594 + %1596 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1597 = OpLoad %float %1596 + %1598 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1598 %913 + %1599 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1599 %1597 + %1600 = OpAccessChain %_ptr_Function_float %uv %uint_1 %1601 = OpLoad %float %1600 - %1602 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1602 %float_0 - %1603 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1603 %1601 - %1604 = OpAccessChain %_ptr_Function_float %color %uint_2 - %1605 = OpLoad %float %1604 - %1606 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1602 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1603 = OpLoad %float %1602 + %1604 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1604 %913 + %1605 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1605 %1603 + %1606 = OpAccessChain %_ptr_Function_float %color %uint_2 %1607 = OpLoad %float %1606 - %1608 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1608 %float_0 - %1609 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1608 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1608 %913 + %1609 = OpAccessChain %_ptr_Function_float %color %uint_2 OpStore %1609 %1607 - %1610 = OpCompositeExtract %float %1462 0 - %1611 = OpCompositeExtract %float %1452 0 - %1612 = OpCompositeConstruct %v2float %1610 %1611 - %1613 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - %1614 = OpLoad %int %1613 - %1615 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - OpStore %1615 %int_0 - %1616 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1610 = OpCompositeExtract %float %1307 1 + %1611 = OpCompositeExtract %float %1307 2 + %1612 = OpCompositeConstruct %v3float %float_2 %1610 %1611 + %1613 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1614 = OpLoad %float %1613 + %1615 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %1615 %913 + %1616 = OpAccessChain %_ptr_Function_float %color %uint_2 OpStore %1616 %1614 - %1617 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1618 = OpLoad %float %1617 - %1619 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1619 %float_0 - %1620 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1620 %1618 - %1621 = OpCompositeExtract %float %1058 0 - %1622 = OpCompositeExtract %float %904 0 - %1623 = OpCompositeConstruct %v2float %1621 %1622 - %1624 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1625 = OpLoad %float %1624 - %1626 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1626 %float_0 - %1627 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1627 %1625 - %1628 = OpAccessChain %_ptr_Function_float %color %uint_2 - %1629 = OpConvertSToF %float %1576 - %1630 = OpFAdd %float %1605 %1629 - OpStore %1628 %1630 - %1631 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %1631 - %1632 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1633 = OpLoad %float %1632 - %1634 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1634 %float_0 - %1635 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1635 %1633 - %1636 = OpCompositeExtract %float %1058 1 - %1637 = OpCompositeExtract %float %1058 0 - %1638 = OpCompositeExtract %float %1612 1 - %1639 = OpCompositeConstruct %v3float %1636 %1637 %1638 + %1617 = OpLoad %int %i_2 + OpStore %i_2 %31 + OpStore %i_2 %1617 + %1618 = OpCompositeExtract %float %1307 2 + %1619 = OpCompositeExtract %float %1307 1 + %1620 = OpCompositeConstruct %v2float %1618 %1619 + %1621 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %1621 + %1622 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1623 = OpLoad %float %1622 + %1624 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1624 %913 + %1625 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1625 %1623 + %1626 = OpCompositeExtract %float %934 1 + %1627 = OpCompositeExtract %float %934 1 + %1628 = OpCompositeExtract %float %934 1 + %1629 = OpCompositeConstruct %v3float %1626 %1627 %1628 + %1630 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1631 = OpLoad %int %1630 + %1632 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1632 %31 + %1633 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + OpStore %1633 %1631 + %1636 = OpFSub %float %1587 %1601 + %1634 = OpExtInst %float %1635 FAbs %1636 + %1637 = OpFOrdLessThan %bool %1634 %float_0_25 + OpSelectionMerge %1638 None + OpBranchConditional %1637 %1639 %1638 + %1639 = OpLabel %1640 = OpAccessChain %_ptr_Function_float %uv %uint_0 %1641 = OpLoad %float %1640 %1642 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1642 %float_0 + OpStore %1642 %913 %1643 = OpAccessChain %_ptr_Function_float %uv %uint_0 OpStore %1643 %1641 - %1644 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1645 = OpLoad %float %1644 - %1646 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1647 = OpLoad %float %1646 - %1648 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1648 %float_0 - %1649 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1649 %1647 - %1650 = OpCompositeExtract %float %1580 1 - %1651 = OpCompositeExtract %float %1580 0 - %1652 = OpCompositeExtract %float %912 2 - %1653 = OpCompositeConstruct %v3float %1650 %1651 %1652 - %1654 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1655 = OpLoad %float %1654 - %1656 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1656 %float_0 - %1657 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1657 %1655 - %1658 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1659 = OpLoad %float %1658 + %1644 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %1644 + %1645 = OpCompositeExtract %float %1541 2 + %1646 = OpCompositeExtract %float %1541 0 + %1647 = OpCompositeExtract %float %872 0 + %1648 = OpCompositeConstruct %v3float %1645 %1646 %1647 + %1649 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %1650 = OpLoad %int %1649 + %1651 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + OpStore %1651 %31 + %1652 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + OpStore %1652 %1650 + %1654 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_9 + %1655 = OpLoad %int %1654 + %1656 = OpCompositeExtract %float %1184 1 + %1657 = OpCompositeExtract %float %1184 1 + %1658 = OpCompositeExtract %float %1184 1 + %1659 = OpCompositeConstruct %v3float %1656 %1657 %1658 %1660 = OpAccessChain %_ptr_Function_float %uv %uint_1 %1661 = OpLoad %float %1660 %1662 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1662 %float_0 + OpStore %1662 %913 %1663 = OpAccessChain %_ptr_Function_float %uv %uint_1 OpStore %1663 %1661 - %1664 = OpAccessChain %_ptr_Function_float %color %uint_2 + %1664 = OpAccessChain %_ptr_Function_float %color %uint_0 %1665 = OpLoad %float %1664 - %1666 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1666 %float_0 - %1667 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1667 %1665 - %1668 = OpCompositeExtract %float %38 1 - %1669 = OpCompositeExtract %float %1363 1 - %1670 = OpCompositeExtract %float %1363 2 - %1671 = OpCompositeConstruct %v3float %1668 %1669 %1670 - %1672 = OpAccessChain %_ptr_Function_float %color %uint_2 - %1673 = OpLoad %float %1672 - %1674 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1674 %float_0 - %1675 = OpAccessChain %_ptr_Function_float %color %uint_2 - OpStore %1675 %1673 - %1676 = OpLoad %int %i_2 - OpStore %i_2 %int_0 - OpStore %i_2 %1676 - %1677 = OpCompositeExtract %float %1363 2 - %1678 = OpCompositeExtract %float %1363 1 - %1679 = OpCompositeConstruct %v2float %1677 %1678 - %1680 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1680 - %1681 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1682 = OpLoad %float %1681 - %1683 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1683 %float_0 - %1684 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1684 %1682 - %1685 = OpCompositeExtract %float %975 1 - %1686 = OpCompositeExtract %float %975 1 - %1687 = OpCompositeExtract %float %975 1 - %1688 = OpCompositeConstruct %v3float %1685 %1686 %1687 - %1689 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - %1690 = OpLoad %int %1689 - %1691 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 - OpStore %1691 %int_0 - %1692 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %1666 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1667 = OpLoad %float %1666 + %1668 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1668 %913 + %1669 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1669 %1667 + %1670 = OpCompositeExtract %float %1515 0 + %1671 = OpCompositeExtract %float %1515 1 + %1672 = OpCompositeConstruct %v2float %1670 %1671 + %1673 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1674 = OpLoad %float %1673 + %1675 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1675 %913 + %1676 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1676 %1674 + %1677 = OpLoad %v3float %color + OpStore %color %163 + OpStore %color %1677 + %1678 = OpCompositeExtract %float %915 0 + %1679 = OpCompositeExtract %float %915 0 + %1680 = OpCompositeConstruct %v2float %1678 %1679 + %1681 = OpLoad %v2float %uv + OpStore %uv %160 + OpStore %uv %1681 + %1682 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1683 = OpLoad %float %1682 + %1684 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1684 %913 + %1685 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1685 %1683 + %1686 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1687 = OpConvertSToF %float %1655 + %1688 = OpFAdd %float %1687 %1665 + OpStore %1686 %1688 + %1689 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1690 = OpLoad %float %1689 + %1691 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1691 %913 + %1692 = OpAccessChain %_ptr_Function_float %color %uint_0 OpStore %1692 %1690 - %1695 = OpFSub %float %1645 %1659 - %1693 = OpExtInst %float %1694 FAbs %1695 - %1696 = OpFOrdLessThan %bool %1693 %float_0_25 - OpSelectionMerge %1697 None - OpBranchConditional %1696 %1698 %1697 - %1698 = OpLabel - %1699 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1700 = OpLoad %float %1699 - %1701 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1701 %float_0 - %1702 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1702 %1700 - %1703 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1703 - %1704 = OpCompositeExtract %float %1599 2 - %1705 = OpCompositeExtract %float %1599 0 - %1706 = OpCompositeExtract %float %912 0 - %1707 = OpCompositeConstruct %v3float %1704 %1705 %1706 - %1708 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 - %1709 = OpLoad %int %1708 - %1710 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 - OpStore %1710 %int_0 - %1711 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 - OpStore %1711 %1709 - %1713 = OpAccessChain %_ptr_Private_int %obj %uint_0 %uint_9 - %1714 = OpLoad %int %1713 - %1715 = OpCompositeExtract %float %1235 1 - %1716 = OpCompositeExtract %float %1235 1 - %1717 = OpCompositeExtract %float %1235 1 - %1718 = OpCompositeConstruct %v3float %1715 %1716 %1717 - %1719 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1720 = OpLoad %float %1719 - %1721 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1721 %float_0 - %1722 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1722 %1720 - %1723 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1724 = OpLoad %float %1723 - %1725 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1726 = OpLoad %float %1725 - %1727 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1727 %float_0 - %1728 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1728 %1726 - %1729 = OpCompositeExtract %float %1572 0 - %1730 = OpCompositeExtract %float %1572 1 - %1731 = OpCompositeConstruct %v2float %1729 %1730 - %1732 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1733 = OpLoad %float %1732 - %1734 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1734 %float_0 - %1735 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1735 %1733 - %1736 = OpLoad %v3float %color - OpStore %color %888 - OpStore %color %1736 - %1737 = OpCompositeExtract %float %956 0 - %1738 = OpCompositeExtract %float %956 0 - %1739 = OpCompositeConstruct %v2float %1737 %1738 - %1740 = OpLoad %v2float %uv - OpStore %uv %876 - OpStore %uv %1740 - %1741 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1742 = OpLoad %float %1741 - %1743 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1743 %float_0 + %1693 = OpCompositeExtract %float %1244 1 + %1694 = OpCompositeExtract %float %1581 0 + %1695 = OpCompositeExtract %float %1244 0 + %1696 = OpCompositeConstruct %v3float %1693 %1694 %1695 + %1697 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1698 = OpLoad %float %1697 + %1699 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1699 %913 + %1700 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1700 %1698 + OpBranch %1638 + %1638 = OpLabel + %1701 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1702 = OpLoad %float %1701 + %1703 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1703 %913 + %1704 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1704 %1702 + %1705 = OpLoad %v3float %color + %1706 = OpAccessChain %_ptr_Function_float %uv %31 + %1707 = OpLoad %float %1706 + %1708 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1708 %913 + %1709 = OpAccessChain %_ptr_Function_float %uv %31 + OpStore %1709 %1707 + %1710 = OpCompositeExtract %float %160 0 + %1711 = OpCompositeExtract %float %160 0 + %1712 = OpCompositeExtract %float %160 1 + %1713 = OpCompositeConstruct %v3float %1710 %1711 %1712 + %1714 = OpExtInst %v3float %1635 Normalize %1705 + %1715 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1716 = OpLoad %float %1715 + %1717 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1717 %913 + %1718 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1718 %1716 + %1719 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %1719 + %1720 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %1720 + %1721 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1722 = OpLoad %float %1721 + %1723 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1723 %913 + %1724 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1724 %1722 + %1725 = OpCompositeExtract %float %1554 1 + %1726 = OpCompositeExtract %float %1713 1 + %1727 = OpCompositeConstruct %v2float %1725 %1726 + %1728 = OpAccessChain %_ptr_Function_float %color %uint_1 + %1729 = OpLoad %float %1728 + %1730 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1730 %913 + %1731 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %1731 %1729 + %1732 = OpCompositeExtract %float %1714 0 + %1733 = OpCompositeExtract %float %1714 1 + %1734 = OpCompositeExtract %float %1714 2 + %1735 = OpCompositeConstruct %v4float %1732 %1733 %1734 %float_1 + %1736 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %1737 = OpLoad %float %1736 + %1738 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1738 %913 + %1739 = OpAccessChain %_ptr_Function_float %uv %uint_1 + OpStore %1739 %1737 + %1740 = OpCompositeExtract %float %1727 1 + %1741 = OpCompositeConstruct %v3float %float_2 %float_2 %1740 + %1742 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %1743 = OpLoad %float %1742 %1744 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1744 %1742 - %1745 = OpCompositeExtract %float %168 0 - %1746 = OpCompositeExtract %float %168 0 - %1747 = OpCompositeExtract %float %168 1 - %1748 = OpCompositeConstruct %v3float %1745 %1746 %1747 - %1749 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1750 = OpConvertSToF %float %1714 - %1751 = OpFAdd %float %1750 %1724 - OpStore %1749 %1751 - %1752 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1753 = OpLoad %float %1752 + OpStore %1744 %913 + %1745 = OpAccessChain %_ptr_Function_float %uv %uint_0 + OpStore %1745 %1743 + OpStore %x_GLF_color %1735 + %1746 = OpLoad %QuicksortObject %obj + OpStore %obj %15 + OpStore %obj %1746 + %1747 = OpCompositeExtract %float %1735 3 + %1748 = OpCompositeExtract %float %1735 1 + %1749 = OpCompositeExtract %float %1405 0 + %1750 = OpCompositeConstruct %v3float %1747 %1748 %1749 + %1751 = OpAccessChain %_ptr_Function_float %color %uint_0 + %1752 = OpLoad %float %1751 + %1753 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %1753 %913 %1754 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1754 %float_0 - %1755 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1755 %1753 - %1756 = OpCompositeExtract %float %1300 1 - %1757 = OpCompositeExtract %float %1639 0 - %1758 = OpCompositeExtract %float %1300 0 - %1759 = OpCompositeConstruct %v3float %1756 %1757 %1758 - %1760 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1761 = OpLoad %float %1760 - %1762 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1762 %float_0 - %1763 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1763 %1761 - OpBranch %1697 - %1697 = OpLabel - %1764 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1765 = OpLoad %float %1764 - %1766 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1766 %float_0 - %1767 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1767 %1765 - %1768 = OpLoad %v3float %color - %1769 = OpAccessChain %_ptr_Function_float %uv %int_0 - %1770 = OpLoad %float %1769 - %1771 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1771 %float_0 - %1772 = OpAccessChain %_ptr_Function_float %uv %int_0 - OpStore %1772 %1770 - %1773 = OpCompositeExtract %float %904 0 - %1774 = OpCompositeExtract %float %896 0 - %1775 = OpCompositeExtract %float %896 1 - %1776 = OpCompositeConstruct %v3float %1773 %1774 %1775 - %1777 = OpExtInst %v3float %1694 Normalize %1768 - %1778 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1779 = OpLoad %float %1778 - %1780 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1780 %float_0 - %1781 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1781 %1779 - %1782 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1782 - %1783 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1783 - %1784 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1785 = OpLoad %float %1784 - %1786 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1786 %float_0 - %1787 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1787 %1785 - %1788 = OpCompositeExtract %float %1612 1 - %1789 = OpCompositeExtract %float %1776 1 - %1790 = OpCompositeConstruct %v2float %1788 %1789 - %1791 = OpAccessChain %_ptr_Function_float %color %uint_1 - %1792 = OpLoad %float %1791 - %1793 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1793 %float_0 - %1794 = OpAccessChain %_ptr_Function_float %color %uint_1 - OpStore %1794 %1792 - %1795 = OpCompositeExtract %float %1777 0 - %1796 = OpCompositeExtract %float %1777 1 - %1797 = OpCompositeExtract %float %1777 2 - %1798 = OpCompositeConstruct %v4float %1795 %1796 %1797 %float_1 - %1799 = OpAccessChain %_ptr_Function_float %uv %uint_1 - %1800 = OpLoad %float %1799 - %1801 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1801 %float_0 - %1802 = OpAccessChain %_ptr_Function_float %uv %uint_1 - OpStore %1802 %1800 - %1803 = OpCompositeExtract %float %38 1 - %1804 = OpCompositeExtract %float %38 1 - %1805 = OpCompositeExtract %float %1790 1 - %1806 = OpCompositeConstruct %v3float %1803 %1804 %1805 - %1807 = OpAccessChain %_ptr_Function_float %uv %uint_0 - %1808 = OpLoad %float %1807 - %1809 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1809 %float_0 - %1810 = OpAccessChain %_ptr_Function_float %uv %uint_0 - OpStore %1810 %1808 - OpStore %x_GLF_color %1798 - %1811 = OpLoad %QuicksortObject %obj - OpStore %obj %103 - OpStore %obj %1811 - %1812 = OpCompositeExtract %float %1798 3 - %1813 = OpCompositeExtract %float %1798 1 - %1814 = OpCompositeExtract %float %1462 0 - %1815 = OpCompositeConstruct %v3float %1812 %1813 %1814 - %1816 = OpAccessChain %_ptr_Function_float %color %uint_0 - %1817 = OpLoad %float %1816 - %1818 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1818 %float_0 - %1819 = OpAccessChain %_ptr_Function_float %color %uint_0 - OpStore %1819 %1817 + OpStore %1754 %1752 OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %1820 + %main_inner = OpFunction %main_out None %1755 %gl_FragCoord_param = OpFunctionParameter %v4float - %1824 = OpLabel + %1759 = OpLabel OpStore %gl_FragCoord %gl_FragCoord_param - %1825 = OpFunctionCall %void %main_1 - %1826 = OpLoad %v4float %x_GLF_color - %1827 = OpCompositeConstruct %main_out %1826 - OpReturnValue %1827 + %1760 = OpFunctionCall %void %main_1 + %1761 = OpLoad %v4float %x_GLF_color + %1762 = OpCompositeConstruct %main_out %1761 + OpReturnValue %1762 OpFunctionEnd - %main = OpFunction %void None %419 - %1829 = OpLabel - %1831 = OpLoad %v4float %gl_FragCoord_param_1 - %1830 = OpFunctionCall %main_out %main_inner %1831 - %1832 = OpCompositeExtract %v4float %1830 0 - OpStore %x_GLF_color_1_1 %1832 + %main = OpFunction %void None %402 + %1764 = OpLabel + %1766 = OpLoad %v4float %gl_FragCoord_param_1 + %1765 = OpFunctionCall %main_out %main_inner %1766 + %1767 = OpCompositeExtract %v4float %1765 0 + OpStore %x_GLF_color_1_1 %1767 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/749.spvasm.expected.wgsl b/test/tint/bug/tint/749.spvasm.expected.wgsl index e48b877f56..2592686dee 100644 --- a/test/tint/bug/tint/749.spvasm.expected.wgsl +++ b/test/tint/bug/tint/749.spvasm.expected.wgsl @@ -19,7 +19,7 @@ fn swap_i1_i1_(i : ptr, j : ptr) { let x_932 : i32 = temp; temp = 0i; temp = x_932; - let x_523 : vec3 = vec3(vec3(1.0, 2.0, 3.0).z, vec3(1.0, 2.0, 3.0).y, vec3(1.0, 2.0, 3.0).z); + let x_523 : vec3 = vec3(vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).z); let x_933 : i32 = *(i); *(i) = 0i; *(i) = x_933; @@ -43,7 +43,7 @@ fn swap_i1_i1_(i : ptr, j : ptr) { let x_938 : i32 = *(j); *(j) = 0i; *(j) = x_938; - let x_525 : vec3 = vec3(x_523.z, vec3(1.0, 2.0, 3.0).x, x_523.y); + let x_525 : vec3 = vec3(x_523.z, vec3(1.0f, 2.0f, 3.0f).x, x_523.y); let x_939 : i32 = *(i); *(i) = 0i; *(i) = x_939; @@ -127,7 +127,7 @@ fn performPartition_i1_i1_(l : ptr, h : ptr) -> i3 let x_955 : i32 = param_3; param_3 = 0i; param_3 = x_955; - let x_534 : vec3 = vec3(vec3(1.0, 2.0, 3.0).z, vec3(1.0, 2.0, 3.0).x, vec3(1.0, 2.0, 3.0).z); + let x_534 : vec3 = vec3(vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).z); let x_956 : i32 = param_1; param_1 = 0i; param_1 = x_956; @@ -161,7 +161,7 @@ fn performPartition_i1_i1_(l : ptr, h : ptr) -> i3 let x_963 : i32 = pivot; pivot = 0i; pivot = x_963; - x_537 = vec2(vec3(1.0, 2.0, 3.0).y, vec3(1.0, 2.0, 3.0).z); + x_537 = vec2(vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).z); let x_964 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_964; @@ -200,7 +200,7 @@ fn performPartition_i1_i1_(l : ptr, h : ptr) -> i3 obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_972; let x_63 : i32 = pivot; - let x_540 : vec2 = vec2(vec3(1.0, 2.0, 3.0).y, x_534.z); + let x_540 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).y, x_534.z); let x_973 : i32 = i_1; i_1 = 0i; i_1 = x_973; @@ -231,7 +231,7 @@ fn performPartition_i1_i1_(l : ptr, h : ptr) -> i3 let x_980 : i32 = *(l); *(l) = 0i; *(l) = x_980; - let x_544 : vec3 = vec3(vec3(1.0, 2.0, 3.0).z, vec3(1.0, 2.0, 3.0).y, x_540.x); + let x_544 : vec3 = vec3(vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).y, x_540.x); let x_70 : i32 = i_1; let x_545 : vec2 = vec2(x_537.y, x_538.x); let x_981 : i32 = param; @@ -329,7 +329,7 @@ fn performPartition_i1_i1_(l : ptr, h : ptr) -> i3 let x_1003 : i32 = *(l); *(l) = 0i; *(l) = x_1003; - let x_554 : vec2 = vec2(x_536.z, vec3(1.0, 2.0, 3.0).y); + let x_554 : vec2 = vec2(x_536.z, vec3(1.0f, 2.0f, 3.0f).y); let x_1004 : i32 = param_1; param_1 = 0i; param_1 = x_1004; @@ -360,7 +360,7 @@ fn quicksort_() { let x_1008 : array = stack; stack = array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i); stack = x_1008; - let x_556 : vec2 = vec2(vec3(1.0, 2.0, 3.0).y, vec3(1.0, 2.0, 3.0).y); + let x_556 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).y); let x_1009 : i32 = param_5; param_5 = 0i; param_5 = x_1009; @@ -369,7 +369,7 @@ fn quicksort_() { p = 0i; p = x_1010; let x_93 : i32 = top; - let x_557 : vec2 = vec2(vec3(1.0, 2.0, 3.0).x, vec3(1.0, 2.0, 3.0).x); + let x_557 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).x); let x_1011 : i32 = p; p = 0i; p = x_1011; @@ -410,7 +410,7 @@ fn quicksort_() { let x_1020 : i32 = param_4; param_4 = 0i; param_4 = x_1020; - let x_562 : vec3 = vec3(vec3(1.0, 2.0, 3.0).z, x_558.y, vec3(1.0, 2.0, 3.0).y); + let x_562 : vec3 = vec3(vec3(1.0f, 2.0f, 3.0f).z, x_558.y, vec3(1.0f, 2.0f, 3.0f).y); let x_1021 : i32 = stack[x_96_save]; stack[x_96_save] = 0i; stack[x_96_save] = x_1021; @@ -507,7 +507,7 @@ fn quicksort_() { let x_1043 : i32 = stack[x_100_save]; stack[x_100_save] = 0i; stack[x_100_save] = x_1043; - let x_573 : vec2 = vec2(vec3(1.0, 2.0, 3.0).y, vec3(1.0, 2.0, 3.0).z); + let x_573 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).z); top = (x_112 - 1i); let x_1044 : i32 = param_5; param_5 = 0i; @@ -540,7 +540,7 @@ fn quicksort_() { stack[x_110_save] = x_1050; let x_577 : vec2 = vec2(x_569.y, x_569.z); let x_120 : i32 = h_1; - let x_578 : vec2 = vec2(x_558.x, vec3(1.0, 2.0, 3.0).y); + let x_578 : vec2 = vec2(x_558.x, vec3(1.0f, 2.0f, 3.0f).y); param_5 = x_120; let x_1051 : i32 = stack[x_100_save]; stack[x_100_save] = 0i; @@ -648,7 +648,7 @@ fn quicksort_() { let x_1076 : i32 = stack[x_96_save]; stack[x_96_save] = 0i; stack[x_96_save] = x_1076; - let x_592 : vec2 = vec2(vec3(1.0, 2.0, 3.0).x, vec3(1.0, 2.0, 3.0).y); + let x_592 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).y); let x_1077 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_1077; @@ -774,7 +774,7 @@ fn main_1() { var i_2 : i32; var uv : vec2; let x_717 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_717; i_2 = 0i; let x_721 : QuicksortObject = obj; @@ -784,13 +784,13 @@ fn main_1() { let x_722 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_722; - let x_431 : vec2 = vec2(vec3(1.0, 2.0, 3.0).x, vec3(1.0, 2.0, 3.0).x); + let x_431 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).x); let x_158 : i32 = i_2; let x_723 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_723; let x_725 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_725; let x_432 : vec2 = vec2(x_431.y, x_431.y); let x_726 : QuicksortObject = obj; @@ -810,11 +810,11 @@ fn main_1() { obj = x_758; let x_184 : vec4 = gl_FragCoord; let x_759 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_759; let x_447 : vec2 = vec2(vec2().y, vec2().y); let x_760 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_760; let x_185 : vec2 = vec2(x_184.x, x_184.y); let x_448 : vec3 = vec3(x_185.y, x_446.y, x_446.y); @@ -822,15 +822,15 @@ fn main_1() { obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_761; let x_762 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_762; let x_191 : vec2 = x_188.resolution; let x_763 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_763; - let x_449 : vec3 = vec3(x_184.y, vec3(1.0, 2.0, 3.0).z, x_184.w); + let x_449 : vec3 = vec3(x_184.y, vec3(1.0f, 2.0f, 3.0f).z, x_184.w); let x_764 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_764; let x_192 : vec2 = (x_185 / x_191); let x_765 : QuicksortObject = obj; @@ -838,15 +838,15 @@ fn main_1() { obj = x_765; let x_450 : vec2 = vec2(x_447.x, x_185.y); let x_766 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); let x_767 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_767; color = x_766; uv = x_192; - color = vec3(1.0, 2.0, 3.0); + color = vec3(1.0f, 2.0f, 3.0f); let x_768 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_768; let x_451 : vec3 = vec3(x_185.x, x_185.y, x_446.y); let x_769 : QuicksortObject = obj; @@ -864,9 +864,9 @@ fn main_1() { obj.numbers[0u] = x_772; let x_206 : f32 = color.x; let x_773 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_773; - let x_452 : vec2 = vec2(vec3(1.0, 2.0, 3.0).z, vec3(1.0, 2.0, 3.0).y); + let x_452 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).y); let x_774 : i32 = i_2; i_2 = 0i; i_2 = x_774; @@ -876,21 +876,21 @@ fn main_1() { let x_453 : vec3 = vec3(x_451.x, x_450.x, x_450.y); color.x = (x_206 + f32(x_201)); let x_776 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_776; let x_777 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_777; let x_454 : vec2 = vec2(x_184.y, x_184.y); let x_210 : f32 = uv.x; let x_455 : vec2 = vec2(x_192.y, x_192.x); let x_778 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_778; let x_779 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_779; - if ((x_210 > 0.25)) { + if ((x_210 > 0.25f)) { let x_780 : i32 = i_2; i_2 = 0i; i_2 = x_780; @@ -899,7 +899,7 @@ fn main_1() { obj.numbers[0u] = x_781; let x_456 : vec3 = vec3(vec2().y, x_448.y, x_448.y); let x_782 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_782; let x_216 : i32 = obj.numbers[1i]; let x_783 : QuicksortObject = obj; @@ -907,28 +907,28 @@ fn main_1() { obj = x_783; let x_457 : vec2 = vec2(x_454.x, x_454.x); let x_784 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_784; let x_785 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_785; - let x_458 : vec2 = vec2(vec3(1.0, 2.0, 3.0).z, vec2().y); + let x_458 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).z, vec2().y); let x_786 : i32 = i_2; i_2 = 0i; i_2 = x_786; let x_219 : f32 = color[0i]; let x_787 : f32 = color[0i]; - color[0i] = 0.0; + color[0i] = 0.0f; color[0i] = x_787; let x_788 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_788; let x_789 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_789; let x_459 : vec3 = vec3(x_454.y, x_454.y, x_447.y); let x_790 : f32 = color[0i]; - color[0i] = 0.0; + color[0i] = 0.0f; color[0i] = x_790; color.x = (f32(x_216) + x_219); let x_791 : i32 = obj.numbers[0u]; @@ -936,54 +936,54 @@ fn main_1() { obj.numbers[0u] = x_791; } let x_792 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_792; let x_793 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_793; let x_223 : f32 = uv.x; let x_794 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_794; let x_460 : vec3 = vec3(x_453.z, x_453.y, x_453.y); let x_795 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_795; let x_796 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_796; let x_461 : vec2 = vec2(vec2().y, vec2().y); let x_797 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_797; - if ((x_223 > 0.5)) { + if ((x_223 > 0.5f)) { let x_798 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_798; let x_462 : vec2 = vec2(x_446.x, x_446.x); let x_799 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_799; let x_800 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_800; let x_463 : vec3 = vec3(x_453.x, x_453.z, x_461.y); let x_801 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_801; let x_230 : i32 = obj.numbers[2u]; let x_802 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_802; let x_803 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_803; let x_804 : i32 = obj.numbers[2u]; obj.numbers[2u] = 0i; obj.numbers[2u] = x_804; let x_464 : vec2 = vec2(x_450.y, x_191.x); let x_805 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_805; let x_234 : f32 = color.y; let x_806 : i32 = obj.numbers[2u]; @@ -991,7 +991,7 @@ fn main_1() { obj.numbers[2u] = x_806; let x_465 : vec2 = vec2(x_463.x, x_185.x); let x_807 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_807; let x_808 : i32 = i_2; i_2 = 0i; @@ -1002,7 +1002,7 @@ fn main_1() { i_2 = x_809; color.y = (f32(x_230) + x_234); let x_810 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_810; } let x_811 : i32 = i_2; @@ -1010,64 +1010,64 @@ fn main_1() { i_2 = x_811; let x_467 : vec2 = vec2(x_191.x, x_191.x); let x_812 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_812; let x_238 : f32 = uv[0i]; let x_813 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_813; let x_814 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_814; - if ((x_238 > 0.75)) { + if ((x_238 > 0.75f)) { let x_815 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_815; let x_245 : i32 = obj.numbers[3i]; let x_816 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_816; let x_817 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_817; let x_468 : vec3 = vec3(x_467.x, x_467.x, x_467.x); let x_818 : f32 = uv[0i]; - uv[0i] = 0.0; + uv[0i] = 0.0f; uv[0i] = x_818; let x_819 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_819; let x_249 : f32 = color.z; let x_820 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_820; let x_469 : vec3 = vec3(x_467.x, x_191.y, x_467.y); let x_821 : f32 = color.z; - color.z = 0.0; + color.z = 0.0f; color.z = x_821; let x_822 : i32 = obj.numbers[0u]; obj.numbers[0u] = 0i; obj.numbers[0u] = x_822; let x_470 : vec2 = vec2(vec2().x, vec2().y); let x_823 : f32 = color.z; - color.z = 0.0; + color.z = 0.0f; color.z = x_823; color.z = (x_249 + f32(x_245)); let x_824 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_824; let x_471 : vec2 = vec2(x_470.y, x_470.y); } let x_825 : f32 = uv[0i]; - uv[0i] = 0.0; + uv[0i] = 0.0f; uv[0i] = x_825; let x_472 : vec3 = vec3(x_454.x, x_454.y, x_454.y); let x_254 : i32 = obj.numbers[4i]; let x_826 : f32 = uv[0i]; - uv[0i] = 0.0; + uv[0i] = 0.0f; uv[0i] = x_826; let x_827 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_827; let x_473 : vec3 = vec3(x_446.y, x_453.x, x_453.x); let x_828 : i32 = obj.numbers[4i]; @@ -1075,31 +1075,31 @@ fn main_1() { obj.numbers[4i] = x_828; let x_474 : vec2 = vec2(x_191.x, x_184.z); let x_829 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_829; let x_257 : f32 = color.y; let x_830 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_830; let x_475 : vec2 = vec2(x_467.x, x_450.x); let x_831 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_831; let x_832 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_832; let x_476 : vec2 = vec2(x_451.z, x_460.y); color.y = (x_257 + f32(x_254)); let x_477 : vec3 = vec3(vec2().x, x_472.x, vec2().y); let x_833 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_833; let x_834 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_834; let x_478 : vec2 = vec2(x_472.x, x_472.y); let x_835 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_835; let x_261 : f32 = uv.y; let x_836 : i32 = i_2; @@ -1110,20 +1110,20 @@ fn main_1() { obj.numbers[0u] = 0i; obj.numbers[0u] = x_837; let x_838 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_838; let x_480 : vec3 = vec3(x_446.x, x_446.x, vec2().y); let x_839 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_839; - if ((x_261 > 0.25)) { + if ((x_261 > 0.25f)) { let x_481 : vec2 = vec2(x_447.x, x_480.z); let x_840 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_840; let x_267 : i32 = obj.numbers[5u]; let x_841 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_841; let x_842 : i32 = i_2; i_2 = 0i; @@ -1133,34 +1133,34 @@ fn main_1() { i_2 = x_843; let x_270 : f32 = color.x; let x_844 : f32 = uv[0i]; - uv[0i] = 0.0; + uv[0i] = 0.0f; uv[0i] = x_844; let x_482 : vec3 = vec3(x_455.x, x_475.y, x_455.y); let x_845 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_845; let x_846 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_846; let x_847 : i32 = i_2; i_2 = 0i; i_2 = x_847; let x_483 : vec3 = vec3(x_184.w, x_184.w, x_192.x); let x_848 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_848; color.x = (f32(x_267) + x_270); let x_484 : vec3 = vec3(x_454.y, x_450.x, x_454.y); let x_849 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_849; } let x_850 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_850; let x_485 : vec3 = vec3(x_467.x, x_450.y, x_450.x); let x_851 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_851; let x_852 : i32 = obj.numbers[4i]; obj.numbers[4i] = 0i; @@ -1169,21 +1169,21 @@ fn main_1() { let x_853 : i32 = obj.numbers[0u]; obj.numbers[0u] = 0i; obj.numbers[0u] = x_853; - if ((x_274 > 0.5)) { + if ((x_274 > 0.5f)) { let x_854 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_854; let x_486 : vec2 = vec2(x_480.y, x_455.y); let x_855 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_855; let x_487 : vec2 = vec2(x_449.z, x_449.y); let x_856 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_856; let x_280 : i32 = obj.numbers[6u]; let x_857 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_857; let x_858 : i32 = i_2; i_2 = 0i; @@ -1194,10 +1194,10 @@ fn main_1() { let x_488 : vec2 = vec2(x_473.z, x_473.y); let x_283 : f32 = color.y; let x_860 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_860; let x_861 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_861; let x_489 : vec2 = vec2(x_475.y, x_475.x); let x_862 : i32 = obj.numbers[6u]; @@ -1212,16 +1212,16 @@ fn main_1() { obj = x_864; color.y = (f32(x_280) + x_283); let x_865 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_865; - let x_491 : vec2 = vec2(vec3(1.0, 2.0, 3.0).y, x_454.x); + let x_491 : vec2 = vec2(vec3(1.0f, 2.0f, 3.0f).y, x_454.x); let x_866 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_866; } let x_492 : vec2 = vec2(x_455.y, x_455.y); let x_867 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_867; let x_287 : f32 = uv.y; let x_868 : QuicksortObject = obj; @@ -1229,70 +1229,70 @@ fn main_1() { obj = x_868; let x_493 : vec2 = vec2(x_475.x, x_475.y); let x_869 : f32 = uv[0i]; - uv[0i] = 0.0; + uv[0i] = 0.0f; uv[0i] = x_869; let x_870 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_870; let x_494 : vec3 = vec3(x_191.x, x_191.y, x_191.y); let x_871 : i32 = obj.numbers[4i]; obj.numbers[4i] = 0i; obj.numbers[4i] = x_871; - if ((x_287 > 0.75)) { + if ((x_287 > 0.75f)) { let x_872 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_872; let x_873 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_873; let x_495 : vec3 = vec3(x_192.y, x_192.x, x_192.y); let x_874 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_874; let x_293 : i32 = obj.numbers[7i]; let x_875 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_875; let x_496 : vec3 = vec3(x_475.x, x_467.y, x_467.x); let x_876 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_876; let x_497 : vec2 = vec2(x_477.x, x_461.y); let x_877 : i32 = obj.numbers[0u]; obj.numbers[0u] = 0i; obj.numbers[0u] = x_877; let x_878 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_878; let x_498 : vec3 = vec3(x_478.x, x_478.y, x_478.x); let x_879 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_879; let x_296 : f32 = color.z; let x_880 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_880; let x_499 : vec2 = vec2(x_184.x, x_184.y); let x_881 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_881; let x_882 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_882; let x_883 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_883; let x_500 : vec3 = vec3(x_499.y, x_499.y, x_494.z); let x_884 : f32 = color.z; - color.z = 0.0; + color.z = 0.0f; color.z = x_884; color.z = (f32(x_293) + x_296); let x_885 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_885; let x_501 : vec2 = vec2(x_453.x, x_453.z); let x_886 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_886; } let x_887 : i32 = i_2; @@ -1300,7 +1300,7 @@ fn main_1() { i_2 = x_887; let x_502 : vec2 = vec2(x_451.y, x_192.y); let x_888 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_888; let x_301 : i32 = obj.numbers[8i]; let x_889 : i32 = i_2; @@ -1311,78 +1311,78 @@ fn main_1() { obj.numbers[8i] = 0i; obj.numbers[8i] = x_890; let x_891 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_891; let x_504 : vec2 = vec2(x_453.y, vec2().x); let x_892 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_892; let x_505 : vec3 = vec3(x_504.x, x_504.y, x_504.x); let x_893 : f32 = color.z; - color.z = 0.0; + color.z = 0.0f; color.z = x_893; let x_304 : f32 = color.z; let x_894 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_894; let x_506 : vec2 = vec2(x_493.x, x_492.x); let x_895 : i32 = obj.numbers[4i]; obj.numbers[4i] = 0i; obj.numbers[4i] = x_895; let x_896 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_896; let x_507 : vec2 = vec2(x_461.x, x_447.x); let x_897 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_897; color.z = (x_304 + f32(x_301)); let x_898 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_898; let x_899 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_899; let x_508 : vec3 = vec3(x_461.y, x_461.x, x_506.y); let x_900 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_900; let x_308 : f32 = uv.x; let x_901 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_901; let x_509 : vec3 = vec3(x_503.y, x_503.x, x_448.z); let x_902 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_902; let x_310 : f32 = uv.y; let x_903 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_903; let x_904 : f32 = color.z; - color.z = 0.0; + color.z = 0.0f; color.z = x_904; - let x_510 : vec3 = vec3(vec3(1.0, 2.0, 3.0).y, x_485.y, x_485.z); + let x_510 : vec3 = vec3(vec3(1.0f, 2.0f, 3.0f).y, x_485.y, x_485.z); let x_905 : f32 = color.z; - color.z = 0.0; + color.z = 0.0f; color.z = x_905; let x_906 : i32 = i_2; i_2 = 0i; i_2 = x_906; let x_511 : vec2 = vec2(x_485.z, x_485.y); let x_907 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_907; let x_908 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_908; let x_512 : vec3 = vec3(x_455.y, x_455.y, x_455.y); let x_909 : i32 = obj.numbers[4i]; obj.numbers[4i] = 0i; obj.numbers[4i] = x_909; - if ((abs((x_308 - x_310)) < 0.25)) { + if ((abs((x_308 - x_310)) < 0.25f)) { let x_910 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_910; let x_911 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); @@ -1394,47 +1394,47 @@ fn main_1() { let x_317 : i32 = obj.numbers[9u]; let x_514 : vec3 = vec3(x_474.y, x_474.y, x_474.y); let x_913 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_913; let x_320 : f32 = color.x; let x_914 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_914; let x_515 : vec2 = vec2(x_502.x, x_502.y); let x_915 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_915; let x_916 : vec3 = color; - color = vec3(0.0, 0.0, 0.0); + color = vec3(0.0f, 0.0f, 0.0f); color = x_916; let x_516 : vec2 = vec2(x_452.x, x_452.x); let x_917 : vec2 = uv; - uv = vec2(0.0, 0.0); + uv = vec2(0.0f, 0.0f); uv = x_917; let x_918 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_918; let x_517 : vec3 = vec3(vec2().x, vec2().x, vec2().y); color.x = (f32(x_317) + x_320); let x_919 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_919; let x_518 : vec3 = vec3(x_480.y, x_508.x, x_480.x); let x_920 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_920; } let x_921 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_921; let x_325 : vec3 = color; let x_922 : f32 = uv[0i]; - uv[0i] = 0.0; + uv[0i] = 0.0f; uv[0i] = x_922; let x_519 : vec3 = vec3(x_447.x, x_446.x, x_446.y); let x_326 : vec3 = normalize(x_325); let x_923 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_923; let x_924 : QuicksortObject = obj; obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); @@ -1443,19 +1443,19 @@ fn main_1() { obj = QuicksortObject(array(0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i, 0i)); obj = x_925; let x_926 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_926; let x_520 : vec2 = vec2(x_506.y, x_519.y); let x_927 : f32 = color.y; - color.y = 0.0; + color.y = 0.0f; color.y = x_927; - let x_330 : vec4 = vec4(x_326.x, x_326.y, x_326.z, 1.0); + let x_330 : vec4 = vec4(x_326.x, x_326.y, x_326.z, 1.0f); let x_928 : f32 = uv.y; - uv.y = 0.0; + uv.y = 0.0f; uv.y = x_928; - let x_521 : vec3 = vec3(vec3(1.0, 2.0, 3.0).y, vec3(1.0, 2.0, 3.0).y, x_520.y); + let x_521 : vec3 = vec3(vec3(1.0f, 2.0f, 3.0f).y, vec3(1.0f, 2.0f, 3.0f).y, x_520.y); let x_929 : f32 = uv.x; - uv.x = 0.0; + uv.x = 0.0f; uv.x = x_929; x_GLF_color = x_330; let x_930 : QuicksortObject = obj; @@ -1463,7 +1463,7 @@ fn main_1() { obj = x_930; let x_522 : vec3 = vec3(x_330.w, x_330.y, x_493.x); let x_931 : f32 = color.x; - color.x = 0.0; + color.x = 0.0f; color.x = x_931; return; } @@ -1473,7 +1473,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/bug/tint/757.wgsl b/test/tint/bug/tint/757.wgsl index 437f7b4dfb..d3d01e5a62 100644 --- a/test/tint/bug/tint/757.wgsl +++ b/test/tint/bug/tint/757.wgsl @@ -11,7 +11,7 @@ }; @group(0) @binding(3) var result : Result; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var flatIndex : u32 = 2u * 2u * GlobalInvocationID.z + diff --git a/test/tint/bug/tint/757.wgsl.expected.hlsl b/test/tint/bug/tint/757.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/757.wgsl.expected.hlsl rename to test/tint/bug/tint/757.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/757.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/757.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d144aff8e9 --- /dev/null +++ b/test/tint/bug/tint/757.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +cbuffer cbuffer_constants : register(b0, space0) { + uint4 constants[1]; +}; +Texture2DArray myTexture : register(t1, space0); + +RWByteAddressBuffer result : register(u3, space0); + +struct tint_symbol_1 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +void main_inner(uint3 GlobalInvocationID) { + uint flatIndex = ((((2u * 2u) * GlobalInvocationID.z) + (2u * GlobalInvocationID.y)) + GlobalInvocationID.x); + flatIndex = (flatIndex * 1u); + float4 texel = myTexture.Load(int4(int3(int2(GlobalInvocationID.xy), 0), 0)); + { + [loop] for(uint i = 0u; (i < 1u); i = (i + 1u)) { + result.Store((4u * (flatIndex + i)), asuint(texel.r)); + } + } +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/tint/757.wgsl.expected.msl b/test/tint/bug/tint/757.wgsl.expected.msl index 35bf540fb3..b0644d05d0 100644 --- a/test/tint/bug/tint/757.wgsl.expected.msl +++ b/test/tint/bug/tint/757.wgsl.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Constants { int level; }; struct Result { - /* 0x0000 */ float values[1]; + /* 0x0000 */ tint_array values; }; void tint_symbol_inner(uint3 GlobalInvocationID, texture2d_array tint_symbol_1, device Result* const tint_symbol_2) { diff --git a/test/tint/bug/tint/757.wgsl.expected.spvasm b/test/tint/bug/tint/757.wgsl.expected.spvasm index d19f6438a1..4ad4cef2b4 100644 --- a/test/tint/bug/tint/757.wgsl.expected.spvasm +++ b/test/tint/bug/tint/757.wgsl.expected.spvasm @@ -60,11 +60,11 @@ %v3int = OpTypeVector %int 3 %v2int = OpTypeVector %int 2 %v2uint = OpTypeVector %uint 2 - %int_0 = OpConstant %int 0 + %47 = OpConstantNull %int %_ptr_Function_v4float = OpTypePointer Function %v4float %51 = OpConstantNull %v4float - %uint_0 = OpConstant %uint 0 %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_Function_float = OpTypePointer Function %float %74 = OpTypeFunction %void @@ -91,23 +91,23 @@ %41 = OpBitcast %v2int %44 %45 = OpCompositeExtract %int %41 0 %46 = OpCompositeExtract %int %41 1 - %48 = OpCompositeConstruct %v3int %45 %46 %int_0 - %37 = OpImageFetch %v4float %39 %48 Lod %int_0 + %48 = OpCompositeConstruct %v3int %45 %46 %47 + %37 = OpImageFetch %v4float %39 %48 Lod %47 OpStore %texel %37 - OpStore %i %uint_0 - OpBranch %54 - %54 = OpLabel - OpLoopMerge %55 %56 None - OpBranch %57 - %57 = OpLabel - %59 = OpLoad %uint %i - %60 = OpULessThan %bool %59 %uint_1 - %58 = OpLogicalNot %bool %60 - OpSelectionMerge %62 None - OpBranchConditional %58 %63 %62 - %63 = OpLabel - OpBranch %55 + OpStore %i %33 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %58 = OpLoad %uint %i + %59 = OpULessThan %bool %58 %uint_1 + %57 = OpLogicalNot %bool %59 + OpSelectionMerge %61 None + OpBranchConditional %57 %62 %61 %62 = OpLabel + OpBranch %54 + %61 = OpLabel %64 = OpLoad %uint %flatIndex %65 = OpLoad %uint %i %66 = OpIAdd %uint %64 %65 @@ -115,13 +115,13 @@ %70 = OpAccessChain %_ptr_Function_float %texel %uint_0 %71 = OpLoad %float %70 OpStore %68 %71 - OpBranch %56 - %56 = OpLabel + OpBranch %55 + %55 = OpLabel %72 = OpLoad %uint %i %73 = OpIAdd %uint %72 %uint_1 OpStore %i %73 - OpBranch %54 - %55 = OpLabel + OpBranch %53 + %54 = OpLabel OpReturn OpFunctionEnd %main = OpFunction %void None %74 diff --git a/test/tint/bug/tint/757.wgsl.expected.wgsl b/test/tint/bug/tint/757.wgsl.expected.wgsl index 15f4e3f690..bc2b941f74 100644 --- a/test/tint/bug/tint/757.wgsl.expected.wgsl +++ b/test/tint/bug/tint/757.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct Result { @group(0) @binding(3) var result : Result; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { var flatIndex : u32 = ((((2u * 2u) * GlobalInvocationID.z) + (2u * GlobalInvocationID.y)) + GlobalInvocationID.x); flatIndex = (flatIndex * 1u); diff --git a/test/tint/bug/tint/764.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/764.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b67a7dcfec --- /dev/null +++ b/test/tint/bug/tint/764.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + const float4x4 m = float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); + const float4 v1 = m[0]; + const float a = v1[0]; +} diff --git a/test/tint/bug/tint/764.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/764.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b67a7dcfec --- /dev/null +++ b/test/tint/bug/tint/764.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + const float4x4 m = float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); + const float4 v1 = m[0]; + const float a = v1[0]; +} diff --git a/test/tint/bug/tint/764.wgsl.expected.glsl b/test/tint/bug/tint/764.wgsl.expected.glsl index c104ce3fca..02dcf2fd66 100644 --- a/test/tint/bug/tint/764.wgsl.expected.glsl +++ b/test/tint/bug/tint/764.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } void f() { - mat4 m = mat4(vec4(1.0f, 1.0f, 1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f)); + mat4 m = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f)); vec4 v1 = m[0]; float a = v1[0]; } diff --git a/test/tint/bug/tint/764.wgsl.expected.hlsl b/test/tint/bug/tint/764.wgsl.expected.hlsl deleted file mode 100644 index 592c30903b..0000000000 --- a/test/tint/bug/tint/764.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - const float4x4 m = float4x4(float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)); - const float4 v1 = m[0]; - const float a = v1[0]; -} diff --git a/test/tint/bug/tint/764.wgsl.expected.msl b/test/tint/bug/tint/764.wgsl.expected.msl index 18310523ea..4dae82fe24 100644 --- a/test/tint/bug/tint/764.wgsl.expected.msl +++ b/test/tint/bug/tint/764.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void f() { - float4x4 const m = float4x4(float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)); + float4x4 const m = float4x4(float4(1.0f), float4(1.0f), float4(1.0f), float4(1.0f)); float4 const v1 = m[0]; float const a = v1[0]; } diff --git a/test/tint/bug/tint/764.wgsl.expected.spvasm b/test/tint/bug/tint/764.wgsl.expected.spvasm index 5261691a73..329c64e7df 100644 --- a/test/tint/bug/tint/764.wgsl.expected.spvasm +++ b/test/tint/bug/tint/764.wgsl.expected.spvasm @@ -18,7 +18,7 @@ %11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %12 = OpConstantComposite %mat4v4float %11 %11 %11 %11 %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %14 = OpConstantNull %int %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn diff --git a/test/tint/bug/tint/782.wgsl b/test/tint/bug/tint/782.wgsl index 0a4f31b06a..46868f67a2 100644 --- a/test/tint/bug/tint/782.wgsl +++ b/test/tint/bug/tint/782.wgsl @@ -2,7 +2,7 @@ type ArrayExplicitStride = array; type ArrayImplicitStride = array; fn foo() { - var explicit : ArrayExplicitStride; - var implict : ArrayImplicitStride; - implict = explicit; + var explicitStride : ArrayExplicitStride; + var implictStride : ArrayImplicitStride; + implictStride = explicitStride; } diff --git a/test/tint/bug/tint/782.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/782.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..639dcd3d1e --- /dev/null +++ b/test/tint/bug/tint/782.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void foo() { + int explicitStride[2] = (int[2])0; + int implictStride[2] = (int[2])0; + implictStride = explicitStride; +} diff --git a/test/tint/bug/tint/782.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/782.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..639dcd3d1e --- /dev/null +++ b/test/tint/bug/tint/782.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void foo() { + int explicitStride[2] = (int[2])0; + int implictStride[2] = (int[2])0; + implictStride = explicitStride; +} diff --git a/test/tint/bug/tint/782.wgsl.expected.glsl b/test/tint/bug/tint/782.wgsl.expected.glsl index 799cb66e91..ed2d6edba3 100644 --- a/test/tint/bug/tint/782.wgsl.expected.glsl +++ b/test/tint/bug/tint/782.wgsl.expected.glsl @@ -5,8 +5,8 @@ void unused_entry_point() { return; } void foo() { - int explicit[2] = int[2](0, 0); - int implict[2] = int[2](0, 0); - implict = explicit; + int explicitStride[2] = int[2](0, 0); + int implictStride[2] = int[2](0, 0); + implictStride = explicitStride; } diff --git a/test/tint/bug/tint/782.wgsl.expected.hlsl b/test/tint/bug/tint/782.wgsl.expected.hlsl deleted file mode 100644 index 59bb8da9d2..0000000000 --- a/test/tint/bug/tint/782.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void foo() { - int tint_symbol[2] = (int[2])0; - int implict[2] = (int[2])0; - implict = tint_symbol; -} diff --git a/test/tint/bug/tint/782.wgsl.expected.msl b/test/tint/bug/tint/782.wgsl.expected.msl index a568ecb678..c08bd8e6e1 100644 --- a/test/tint/bug/tint/782.wgsl.expected.msl +++ b/test/tint/bug/tint/782.wgsl.expected.msl @@ -1,13 +1,22 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[2]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; void foo() { - tint_array_wrapper tint_symbol = {}; - tint_array_wrapper implict = {}; - implict = tint_symbol; + tint_array explicitStride = {}; + tint_array implictStride = {}; + implictStride = explicitStride; } diff --git a/test/tint/bug/tint/782.wgsl.expected.spvasm b/test/tint/bug/tint/782.wgsl.expected.spvasm index 91c057f208..2d904dbe55 100644 --- a/test/tint/bug/tint/782.wgsl.expected.spvasm +++ b/test/tint/bug/tint/782.wgsl.expected.spvasm @@ -9,8 +9,8 @@ OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpName %explicit "explicit" - OpName %implict "implict" + OpName %explicitStride "explicitStride" + OpName %implictStride "implictStride" OpDecorate %_arr_int_uint_2 ArrayStride 4 %void = OpTypeVoid %1 = OpTypeFunction %void @@ -26,9 +26,9 @@ OpFunctionEnd %foo = OpFunction %void None %1 %6 = OpLabel - %explicit = OpVariable %_ptr_Function__arr_int_uint_2 Function %13 - %implict = OpVariable %_ptr_Function__arr_int_uint_2 Function %13 - %15 = OpLoad %_arr_int_uint_2 %explicit - OpStore %implict %15 +%explicitStride = OpVariable %_ptr_Function__arr_int_uint_2 Function %13 +%implictStride = OpVariable %_ptr_Function__arr_int_uint_2 Function %13 + %15 = OpLoad %_arr_int_uint_2 %explicitStride + OpStore %implictStride %15 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/782.wgsl.expected.wgsl b/test/tint/bug/tint/782.wgsl.expected.wgsl index 9e895376b1..897e0fcb3f 100644 --- a/test/tint/bug/tint/782.wgsl.expected.wgsl +++ b/test/tint/bug/tint/782.wgsl.expected.wgsl @@ -3,7 +3,7 @@ type ArrayExplicitStride = array; type ArrayImplicitStride = array; fn foo() { - var explicit : ArrayExplicitStride; - var implict : ArrayImplicitStride; - implict = explicit; + var explicitStride : ArrayExplicitStride; + var implictStride : ArrayImplicitStride; + implictStride = explicitStride; } diff --git a/test/tint/bug/tint/804.spv.expected.dxc.hlsl b/test/tint/bug/tint/804.spv.expected.dxc.hlsl new file mode 100644 index 0000000000..be038c9365 --- /dev/null +++ b/test/tint/bug/tint/804.spv.expected.dxc.hlsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:629: Block 191[%191] branches to the loop continue target 192[%192], but is not contained in the associated loop construct 162[%162] + OpBranch %192 + diff --git a/test/tint/bug/tint/804.spv.expected.fxc.hlsl b/test/tint/bug/tint/804.spv.expected.fxc.hlsl new file mode 100644 index 0000000000..be038c9365 --- /dev/null +++ b/test/tint/bug/tint/804.spv.expected.fxc.hlsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:629: Block 191[%191] branches to the loop continue target 192[%192], but is not contained in the associated loop construct 162[%162] + OpBranch %192 + diff --git a/test/tint/bug/tint/804.spv.expected.glsl b/test/tint/bug/tint/804.spv.expected.glsl index 1267d894b0..be038c9365 100644 --- a/test/tint/bug/tint/804.spv.expected.glsl +++ b/test/tint/bug/tint/804.spv.expected.glsl @@ -1,19 +1,7 @@ SKIP: FAILED -struct buf0 { - resolution : vec2, -} -struct S { - field0 : u32, - field1 : u32, -} +error: line:629: Block 191[%191] branches to the loop continue target 192[%192], but is not contained in the associated loop construct 162[%162] + OpBranch %192 -@group(0) @binding(0) var x_75 : buf0; - -var gl_FragCoord : vec4; - -var x_GLF_color : vec4; - -error: extended arithmetic is not finalized for WGSL: https://github.com/gpuweb/gpuweb/issues/1565: %712 = OpISubBorrow %710 %107 %470 diff --git a/test/tint/bug/tint/804.spv.expected.hlsl b/test/tint/bug/tint/804.spv.expected.hlsl deleted file mode 100644 index 146a132ad3..0000000000 --- a/test/tint/bug/tint/804.spv.expected.hlsl +++ /dev/null @@ -1,19 +0,0 @@ -SKIP: FAILED - - -struct buf0 { - resolution : vec2, -}; - -struct S { - field0 : u32, - field1 : u32, -}; - -@group(0) @binding(0) var x_75 : buf0; - -var gl_FragCoord : vec4; - -var x_GLF_color : vec4; - -error: extended arithmetic is not finalized for WGSL: https://github.com/gpuweb/gpuweb/issues/1565: %712 = OpISubBorrow %710 %107 %470 diff --git a/test/tint/bug/tint/804.spv.expected.msl b/test/tint/bug/tint/804.spv.expected.msl index 2bc83db8a5..be038c9365 100644 --- a/test/tint/bug/tint/804.spv.expected.msl +++ b/test/tint/bug/tint/804.spv.expected.msl @@ -1,3 +1,7 @@ SKIP: FAILED -error: extended arithmetic is not finalized for WGSL: https://github.com/gpuweb/gpuweb/issues/1565: %712 = OpISubBorrow %710 %107 %470 + + +error: line:629: Block 191[%191] branches to the loop continue target 192[%192], but is not contained in the associated loop construct 162[%162] + OpBranch %192 + diff --git a/test/tint/bug/tint/804.spv.expected.spvasm b/test/tint/bug/tint/804.spv.expected.spvasm index 2bc83db8a5..be038c9365 100644 --- a/test/tint/bug/tint/804.spv.expected.spvasm +++ b/test/tint/bug/tint/804.spv.expected.spvasm @@ -1,3 +1,7 @@ SKIP: FAILED -error: extended arithmetic is not finalized for WGSL: https://github.com/gpuweb/gpuweb/issues/1565: %712 = OpISubBorrow %710 %107 %470 + + +error: line:629: Block 191[%191] branches to the loop continue target 192[%192], but is not contained in the associated loop construct 162[%162] + OpBranch %192 + diff --git a/test/tint/bug/tint/804.spv.expected.wgsl b/test/tint/bug/tint/804.spv.expected.wgsl index 2bc83db8a5..be038c9365 100644 --- a/test/tint/bug/tint/804.spv.expected.wgsl +++ b/test/tint/bug/tint/804.spv.expected.wgsl @@ -1,3 +1,7 @@ SKIP: FAILED -error: extended arithmetic is not finalized for WGSL: https://github.com/gpuweb/gpuweb/issues/1565: %712 = OpISubBorrow %710 %107 %470 + + +error: line:629: Block 191[%191] branches to the loop continue target 192[%192], but is not contained in the associated loop construct 162[%162] + OpBranch %192 + diff --git a/test/tint/bug/tint/824.wgsl b/test/tint/bug/tint/824.wgsl index 7319fc0f6a..f9e1467dda 100644 --- a/test/tint/bug/tint/824.wgsl +++ b/test/tint/bug/tint/824.wgsl @@ -2,7 +2,7 @@ struct Output { @builtin(position) Position : vec4, @location(0) color : vec4, }; -@stage(vertex) fn main( +@vertex fn main( @builtin(vertex_index) VertexIndex : u32, @builtin(instance_index) InstanceIndex : u32) -> Output { // TODO: remove workaround for Tint unary array access broke diff --git a/test/tint/bug/tint/824.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/824.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d565814d44 --- /dev/null +++ b/test/tint/bug/tint/824.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +struct Output { + float4 Position; + float4 color; +}; +struct tint_symbol_1 { + uint VertexIndex : SV_VertexID; + uint InstanceIndex : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 color : TEXCOORD0; + float4 Position : SV_Position; +}; + +Output main_inner(uint VertexIndex, uint InstanceIndex) { + const float2 zv[4] = {(0.200000003f).xx, (0.300000012f).xx, (-0.100000001f).xx, (1.100000024f).xx}; + const float z = zv[InstanceIndex].x; + Output output = (Output)0; + output.Position = float4(0.5f, 0.5f, z, 1.0f); + const float4 colors[4] = {float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), (1.0f).xxxx}; + output.color = colors[InstanceIndex]; + return output; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const Output inner_result = main_inner(tint_symbol.VertexIndex, tint_symbol.InstanceIndex); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.Position = inner_result.Position; + wrapper_result.color = inner_result.color; + return wrapper_result; +} diff --git a/test/tint/bug/tint/824.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/824.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d565814d44 --- /dev/null +++ b/test/tint/bug/tint/824.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +struct Output { + float4 Position; + float4 color; +}; +struct tint_symbol_1 { + uint VertexIndex : SV_VertexID; + uint InstanceIndex : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 color : TEXCOORD0; + float4 Position : SV_Position; +}; + +Output main_inner(uint VertexIndex, uint InstanceIndex) { + const float2 zv[4] = {(0.200000003f).xx, (0.300000012f).xx, (-0.100000001f).xx, (1.100000024f).xx}; + const float z = zv[InstanceIndex].x; + Output output = (Output)0; + output.Position = float4(0.5f, 0.5f, z, 1.0f); + const float4 colors[4] = {float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), (1.0f).xxxx}; + output.color = colors[InstanceIndex]; + return output; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const Output inner_result = main_inner(tint_symbol.VertexIndex, tint_symbol.InstanceIndex); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.Position = inner_result.Position; + wrapper_result.color = inner_result.color; + return wrapper_result; +} diff --git a/test/tint/bug/tint/824.wgsl.expected.glsl b/test/tint/bug/tint/824.wgsl.expected.glsl index 7ff968b572..0656691f93 100644 --- a/test/tint/bug/tint/824.wgsl.expected.glsl +++ b/test/tint/bug/tint/824.wgsl.expected.glsl @@ -7,11 +7,11 @@ struct Output { }; Output tint_symbol(uint VertexIndex, uint InstanceIndex) { - vec2 zv[4] = vec2[4](vec2(0.200000003f, 0.200000003f), vec2(0.300000012f, 0.300000012f), vec2(-0.100000001f, -0.100000001f), vec2(1.100000024f, 1.100000024f)); + vec2 zv[4] = vec2[4](vec2(0.200000003f), vec2(0.300000012f), vec2(-0.100000001f), vec2(1.100000024f)); float z = zv[InstanceIndex].x; Output tint_symbol_1 = Output(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); tint_symbol_1.Position = vec4(0.5f, 0.5f, z, 1.0f); - vec4 colors[4] = vec4[4](vec4(1.0f, 0.0f, 0.0f, 1.0f), vec4(0.0f, 1.0f, 0.0f, 1.0f), vec4(0.0f, 0.0f, 1.0f, 1.0f), vec4(1.0f, 1.0f, 1.0f, 1.0f)); + vec4 colors[4] = vec4[4](vec4(1.0f, 0.0f, 0.0f, 1.0f), vec4(0.0f, 1.0f, 0.0f, 1.0f), vec4(0.0f, 0.0f, 1.0f, 1.0f), vec4(1.0f)); tint_symbol_1.color = colors[InstanceIndex]; return tint_symbol_1; } diff --git a/test/tint/bug/tint/824.wgsl.expected.hlsl b/test/tint/bug/tint/824.wgsl.expected.hlsl deleted file mode 100644 index 71b1f38230..0000000000 --- a/test/tint/bug/tint/824.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -struct Output { - float4 Position; - float4 color; -}; -struct tint_symbol_1 { - uint VertexIndex : SV_VertexID; - uint InstanceIndex : SV_InstanceID; -}; -struct tint_symbol_2 { - float4 color : TEXCOORD0; - float4 Position : SV_Position; -}; - -Output main_inner(uint VertexIndex, uint InstanceIndex) { - const float2 zv[4] = {float2(0.200000003f, 0.200000003f), float2(0.300000012f, 0.300000012f), float2(-0.100000001f, -0.100000001f), float2(1.100000024f, 1.100000024f)}; - const float z = zv[InstanceIndex].x; - Output output = (Output)0; - output.Position = float4(0.5f, 0.5f, z, 1.0f); - const float4 colors[4] = {float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; - output.color = colors[InstanceIndex]; - return output; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const Output inner_result = main_inner(tint_symbol.VertexIndex, tint_symbol.InstanceIndex); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.Position = inner_result.Position; - wrapper_result.color = inner_result.color; - return wrapper_result; -} diff --git a/test/tint/bug/tint/824.wgsl.expected.msl b/test/tint/bug/tint/824.wgsl.expected.msl index d5f6cb326a..44277739d6 100644 --- a/test/tint/bug/tint/824.wgsl.expected.msl +++ b/test/tint/bug/tint/824.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Output { float4 Position; float4 color; @@ -11,21 +24,13 @@ struct tint_symbol_1 { float4 Position [[position]]; }; -struct tint_array_wrapper { - float2 arr[4]; -}; - -struct tint_array_wrapper_1 { - float4 arr[4]; -}; - Output tint_symbol_inner(uint VertexIndex, uint InstanceIndex) { - tint_array_wrapper const zv = {.arr={float2(0.200000003f, 0.200000003f), float2(0.300000012f, 0.300000012f), float2(-0.100000001f, -0.100000001f), float2(1.100000024f, 1.100000024f)}}; - float const z = zv.arr[InstanceIndex][0]; + tint_array const zv = tint_array{float2(0.200000003f), float2(0.300000012f), float2(-0.100000001f), float2(1.100000024f)}; + float const z = zv[InstanceIndex][0]; Output output = {}; output.Position = float4(0.5f, 0.5f, z, 1.0f); - tint_array_wrapper_1 const colors = {.arr={float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; - output.color = colors.arr[InstanceIndex]; + tint_array const colors = tint_array{float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f)}; + output.color = colors[InstanceIndex]; return output; } diff --git a/test/tint/bug/tint/824.wgsl.expected.spvasm b/test/tint/bug/tint/824.wgsl.expected.spvasm index 1af29d53ab..9b7e663bc3 100644 --- a/test/tint/bug/tint/824.wgsl.expected.spvasm +++ b/test/tint/bug/tint/824.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 71 +; Bound: 70 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -67,47 +67,46 @@ %float_0_5 = OpConstant %float 0.5 %float_1 = OpConstant %float 1 %_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 - %float_0 = OpConstant %float 0 - %49 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %50 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 - %51 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 - %52 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 - %53 = OpConstantComposite %_arr_v4float_uint_4 %49 %50 %51 %52 + %48 = OpConstantComposite %v4float %float_1 %13 %13 %float_1 + %49 = OpConstantComposite %v4float %13 %float_1 %13 %float_1 + %50 = OpConstantComposite %v4float %13 %13 %float_1 %float_1 + %51 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %52 = OpConstantComposite %_arr_v4float_uint_4 %48 %49 %50 %51 %_ptr_Function__arr_v4float_uint_4 = OpTypePointer Function %_arr_v4float_uint_4 - %56 = OpConstantNull %_arr_v4float_uint_4 + %55 = OpConstantNull %_arr_v4float_uint_4 %uint_1 = OpConstant %uint 1 %void = OpTypeVoid - %62 = OpTypeFunction %void + %61 = OpTypeFunction %void %main_inner = OpFunction %Output None %14 %VertexIndex = OpFunctionParameter %uint %InstanceIndex = OpFunctionParameter %uint %19 = OpLabel %var_for_index = OpVariable %_ptr_Function__arr_v2float_uint_4 Function %34 %output = OpVariable %_ptr_Function_Output Function %41 -%var_for_index_1 = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %56 +%var_for_index_1 = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %55 OpStore %var_for_index %31 %37 = OpAccessChain %_ptr_Function_float %var_for_index %InstanceIndex %uint_0 %38 = OpLoad %float %37 %43 = OpAccessChain %_ptr_Function_v4float %output %uint_0 %46 = OpCompositeConstruct %v4float %float_0_5 %float_0_5 %38 %float_1 OpStore %43 %46 - OpStore %var_for_index_1 %53 - %58 = OpAccessChain %_ptr_Function_v4float %output %uint_1 - %59 = OpAccessChain %_ptr_Function_v4float %var_for_index_1 %InstanceIndex - %60 = OpLoad %v4float %59 - OpStore %58 %60 - %61 = OpLoad %Output %output - OpReturnValue %61 + OpStore %var_for_index_1 %52 + %57 = OpAccessChain %_ptr_Function_v4float %output %uint_1 + %58 = OpAccessChain %_ptr_Function_v4float %var_for_index_1 %InstanceIndex + %59 = OpLoad %v4float %58 + OpStore %57 %59 + %60 = OpLoad %Output %output + OpReturnValue %60 OpFunctionEnd - %main = OpFunction %void None %62 - %65 = OpLabel - %67 = OpLoad %uint %VertexIndex_1 - %68 = OpLoad %uint %InstanceIndex_1 - %66 = OpFunctionCall %Output %main_inner %67 %68 - %69 = OpCompositeExtract %v4float %66 0 - OpStore %Position_1 %69 - %70 = OpCompositeExtract %v4float %66 1 - OpStore %color_1 %70 + %main = OpFunction %void None %61 + %64 = OpLabel + %66 = OpLoad %uint %VertexIndex_1 + %67 = OpLoad %uint %InstanceIndex_1 + %65 = OpFunctionCall %Output %main_inner %66 %67 + %68 = OpCompositeExtract %v4float %65 0 + OpStore %Position_1 %68 + %69 = OpCompositeExtract %v4float %65 1 + OpStore %color_1 %69 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/824.wgsl.expected.wgsl b/test/tint/bug/tint/824.wgsl.expected.wgsl index 7518b89292..9ac4af376e 100644 --- a/test/tint/bug/tint/824.wgsl.expected.wgsl +++ b/test/tint/bug/tint/824.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct Output { color : vec4, } -@stage(vertex) +@vertex fn main(@builtin(vertex_index) VertexIndex : u32, @builtin(instance_index) InstanceIndex : u32) -> Output { let zv : array, 4> = array, 4>(vec2(0.200000003, 0.200000003), vec2(0.300000012, 0.300000012), vec2(-0.100000001, -0.100000001), vec2(1.100000024, 1.100000024)); let z : f32 = zv[InstanceIndex].x; diff --git a/test/tint/bug/tint/825.wgsl.expected.hlsl b/test/tint/bug/tint/825.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/825.wgsl.expected.hlsl rename to test/tint/bug/tint/825.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/825.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/825.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f38475dc0a --- /dev/null +++ b/test/tint/bug/tint/825.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int i = 0; + int j = 0; + const float2x2 m = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + const float f_1 = m[i][j]; +} diff --git a/test/tint/bug/tint/827.wgsl b/test/tint/bug/tint/827.wgsl index d1dbc00b85..1e1b4ad7ac 100644 --- a/test/tint/bug/tint/827.wgsl +++ b/test/tint/bug/tint/827.wgsl @@ -2,12 +2,12 @@ values : array, }; -let width : u32 = 128u; +const width : u32 = 128u; @group(0) @binding(0) var tex : texture_depth_2d; @group(0) @binding(1) var result : Result; -@stage(compute) @workgroup_size(1) fn main( +@compute @workgroup_size(1) fn main( @builtin(global_invocation_id) GlobalInvocationId : vec3 ) { result.values[GlobalInvocationId.y * width + GlobalInvocationId.x] = textureLoad( diff --git a/test/tint/bug/tint/827.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/827.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f1c9fa5b8b --- /dev/null +++ b/test/tint/bug/tint/827.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +Texture2D tex : register(t0, space0); +RWByteAddressBuffer result : register(u1, space0); + +struct tint_symbol_1 { + uint3 GlobalInvocationId : SV_DispatchThreadID; +}; + +void main_inner(uint3 GlobalInvocationId) { + result.Store((4u * ((GlobalInvocationId.y * 128u) + GlobalInvocationId.x)), asuint(tex.Load(int3(int(GlobalInvocationId.x), int(GlobalInvocationId.y), 0)).x)); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.GlobalInvocationId); + return; +} diff --git a/test/tint/bug/tint/827.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/827.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f1c9fa5b8b --- /dev/null +++ b/test/tint/bug/tint/827.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +Texture2D tex : register(t0, space0); +RWByteAddressBuffer result : register(u1, space0); + +struct tint_symbol_1 { + uint3 GlobalInvocationId : SV_DispatchThreadID; +}; + +void main_inner(uint3 GlobalInvocationId) { + result.Store((4u * ((GlobalInvocationId.y * 128u) + GlobalInvocationId.x)), asuint(tex.Load(int3(int(GlobalInvocationId.x), int(GlobalInvocationId.y), 0)).x)); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.GlobalInvocationId); + return; +} diff --git a/test/tint/bug/tint/827.wgsl.expected.glsl b/test/tint/bug/tint/827.wgsl.expected.glsl index 482c7d32e8..4098e5520a 100644 --- a/test/tint/bug/tint/827.wgsl.expected.glsl +++ b/test/tint/bug/tint/827.wgsl.expected.glsl @@ -1,12 +1,11 @@ #version 310 es -const uint width = 128u; layout(binding = 1, std430) buffer Result_1 { float values[]; } result; uniform highp sampler2D tex_1; void tint_symbol(uvec3 GlobalInvocationId) { - result.values[((GlobalInvocationId.y * width) + GlobalInvocationId.x)] = texelFetch(tex_1, ivec2(int(GlobalInvocationId.x), int(GlobalInvocationId.y)), 0).x; + result.values[((GlobalInvocationId.y * 128u) + GlobalInvocationId.x)] = texelFetch(tex_1, ivec2(int(GlobalInvocationId.x), int(GlobalInvocationId.y)), 0).x; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/tint/827.wgsl.expected.hlsl b/test/tint/bug/tint/827.wgsl.expected.hlsl deleted file mode 100644 index 3ad514823a..0000000000 --- a/test/tint/bug/tint/827.wgsl.expected.hlsl +++ /dev/null @@ -1,17 +0,0 @@ -static const uint width = 128u; -Texture2D tex : register(t0, space0); -RWByteAddressBuffer result : register(u1, space0); - -struct tint_symbol_1 { - uint3 GlobalInvocationId : SV_DispatchThreadID; -}; - -void main_inner(uint3 GlobalInvocationId) { - result.Store((4u * ((GlobalInvocationId.y * width) + GlobalInvocationId.x)), asuint(tex.Load(int3(int(GlobalInvocationId.x), int(GlobalInvocationId.y), 0)).x)); -} - -[numthreads(1, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.GlobalInvocationId); - return; -} diff --git a/test/tint/bug/tint/827.wgsl.expected.msl b/test/tint/bug/tint/827.wgsl.expected.msl index 191dd2bb5d..b230160ea3 100644 --- a/test/tint/bug/tint/827.wgsl.expected.msl +++ b/test/tint/bug/tint/827.wgsl.expected.msl @@ -1,14 +1,25 @@ #include using namespace metal; -struct Result { - /* 0x0000 */ float values[1]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -constant uint width = 128u; +struct Result { + /* 0x0000 */ tint_array values; +}; void tint_symbol_inner(uint3 GlobalInvocationId, device Result* const tint_symbol_1, depth2d tint_symbol_2) { - (*(tint_symbol_1)).values[((GlobalInvocationId[1] * width) + GlobalInvocationId[0])] = tint_symbol_2.read(uint2(int2(int(GlobalInvocationId[0]), int(GlobalInvocationId[1]))), 0); + (*(tint_symbol_1)).values[((GlobalInvocationId[1] * 128u) + GlobalInvocationId[0])] = tint_symbol_2.read(uint2(int2(int(GlobalInvocationId[0]), int(GlobalInvocationId[1]))), 0); } kernel void tint_symbol(device Result* tint_symbol_3 [[buffer(0)]], depth2d tint_symbol_4 [[texture(0)]], uint3 GlobalInvocationId [[thread_position_in_grid]]) { diff --git a/test/tint/bug/tint/827.wgsl.expected.spvasm b/test/tint/bug/tint/827.wgsl.expected.spvasm index b1fda45601..de11b1b25a 100644 --- a/test/tint/bug/tint/827.wgsl.expected.spvasm +++ b/test/tint/bug/tint/827.wgsl.expected.spvasm @@ -8,7 +8,6 @@ OpEntryPoint GLCompute %main "main" %GlobalInvocationId_1 OpExecutionMode %main LocalSize 1 1 1 OpName %GlobalInvocationId_1 "GlobalInvocationId_1" - OpName %width "width" OpName %tex "tex" OpName %Result "Result" OpMemberName %Result 0 "values" @@ -28,39 +27,39 @@ %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint %GlobalInvocationId_1 = OpVariable %_ptr_Input_v3uint Input - %width = OpConstant %uint 128 %float = OpTypeFloat 32 - %8 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_8 = OpTypePointer UniformConstant %8 - %tex = OpVariable %_ptr_UniformConstant_8 UniformConstant + %7 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %tex = OpVariable %_ptr_UniformConstant_7 UniformConstant %_runtimearr_float = OpTypeRuntimeArray %float %Result = OpTypeStruct %_runtimearr_float %_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %void = OpTypeVoid - %14 = OpTypeFunction %void %v3uint + %13 = OpTypeFunction %void %v3uint %uint_0 = OpConstant %uint 0 + %uint_128 = OpConstant %uint 128 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %v4float = OpTypeVector %float 4 %int = OpTypeInt 32 1 %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 + %37 = OpConstantNull %int %38 = OpTypeFunction %void - %main_inner = OpFunction %void None %14 + %main_inner = OpFunction %void None %13 %GlobalInvocationId = OpFunctionParameter %v3uint - %18 = OpLabel - %20 = OpCompositeExtract %uint %GlobalInvocationId 1 - %21 = OpIMul %uint %20 %width + %17 = OpLabel + %19 = OpCompositeExtract %uint %GlobalInvocationId 1 + %21 = OpIMul %uint %19 %uint_128 %22 = OpCompositeExtract %uint %GlobalInvocationId 0 %23 = OpIAdd %uint %21 %22 %25 = OpAccessChain %_ptr_StorageBuffer_float %result %uint_0 %23 - %29 = OpLoad %8 %tex + %29 = OpLoad %7 %tex %33 = OpCompositeExtract %uint %GlobalInvocationId 0 %32 = OpBitcast %int %33 %35 = OpCompositeExtract %uint %GlobalInvocationId 1 %34 = OpBitcast %int %35 %36 = OpCompositeConstruct %v2int %32 %34 - %27 = OpImageFetch %v4float %29 %36 Lod %int_0 + %27 = OpImageFetch %v4float %29 %36 Lod %37 %26 = OpCompositeExtract %float %27 0 OpStore %25 %26 OpReturn diff --git a/test/tint/bug/tint/827.wgsl.expected.wgsl b/test/tint/bug/tint/827.wgsl.expected.wgsl index 57561ca0ca..e026916842 100644 --- a/test/tint/bug/tint/827.wgsl.expected.wgsl +++ b/test/tint/bug/tint/827.wgsl.expected.wgsl @@ -2,13 +2,13 @@ struct Result { values : array, } -let width : u32 = 128u; +const width : u32 = 128u; @group(0) @binding(0) var tex : texture_depth_2d; @group(0) @binding(1) var result : Result; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) GlobalInvocationId : vec3) { result.values[((GlobalInvocationId.y * width) + GlobalInvocationId.x)] = textureLoad(tex, vec2(i32(GlobalInvocationId.x), i32(GlobalInvocationId.y)), 0); } diff --git a/test/tint/bug/tint/870.spvasm.expected.hlsl b/test/tint/bug/tint/870.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/870.spvasm.expected.hlsl rename to test/tint/bug/tint/870.spvasm.expected.dxc.hlsl diff --git a/test/tint/bug/tint/870.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/870.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..69b21b914e --- /dev/null +++ b/test/tint/bug/tint/870.spvasm.expected.fxc.hlsl @@ -0,0 +1,29 @@ +ByteAddressBuffer sspp962805860buildInformation : register(t2, space0); + +typedef int tint_symbol_ret[6]; +tint_symbol_ret tint_symbol(ByteAddressBuffer buffer, uint offset) { + int arr[6] = (int[6])0; + { + [loop] for(uint i = 0u; (i < 6u); i = (i + 1u)) { + arr[i] = asint(buffer.Load((offset + (i * 4u)))); + } + } + return arr; +} + +void main_1() { + int orientation[6] = (int[6])0; + const int x_23[6] = tint_symbol(sspp962805860buildInformation, 36u); + orientation[0] = x_23[0u]; + orientation[1] = x_23[1u]; + orientation[2] = x_23[2u]; + orientation[3] = x_23[3u]; + orientation[4] = x_23[4u]; + orientation[5] = x_23[5u]; + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/bug/tint/870.spvasm.expected.msl b/test/tint/bug/tint/870.spvasm.expected.msl index 05b9e33b89..9a97441efd 100644 --- a/test/tint/bug/tint/870.spvasm.expected.msl +++ b/test/tint/bug/tint/870.spvasm.expected.msl @@ -1,15 +1,24 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ int arr[6]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct sspp962805860buildInformationS { /* 0x0000 */ float4 footprint; /* 0x0010 */ float4 offset; /* 0x0020 */ int essence; - /* 0x0024 */ tint_array_wrapper orientation; + /* 0x0024 */ tint_array orientation; }; struct x_B4_BuildInformation { @@ -17,14 +26,14 @@ struct x_B4_BuildInformation { }; void main_1(const device x_B4_BuildInformation* const tint_symbol_1) { - tint_array_wrapper orientation = {}; - tint_array_wrapper const x_23 = (*(tint_symbol_1)).passthru.orientation; - orientation.arr[0] = x_23.arr[0u]; - orientation.arr[1] = x_23.arr[1u]; - orientation.arr[2] = x_23.arr[2u]; - orientation.arr[3] = x_23.arr[3u]; - orientation.arr[4] = x_23.arr[4u]; - orientation.arr[5] = x_23.arr[5u]; + tint_array orientation = {}; + tint_array const x_23 = (*(tint_symbol_1)).passthru.orientation; + orientation[0] = x_23[0u]; + orientation[1] = x_23[1u]; + orientation[2] = x_23[2u]; + orientation[3] = x_23[3u]; + orientation[4] = x_23[4u]; + orientation[5] = x_23[5u]; return; } diff --git a/test/tint/bug/tint/870.spvasm.expected.spvasm b/test/tint/bug/tint/870.spvasm.expected.spvasm index d502ddabf4..9b6a8004f2 100644 --- a/test/tint/bug/tint/870.spvasm.expected.spvasm +++ b/test/tint/bug/tint/870.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 49 +; Bound: 50 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -45,8 +45,9 @@ %uint_0 = OpConstant %uint 0 %uint_3 = OpConstant %uint 3 %_ptr_StorageBuffer__arr_int_uint_6 = OpTypePointer StorageBuffer %_arr_int_uint_6 - %int_0 = OpConstant %int 0 + %23 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %uint %int_1 = OpConstant %int 1 %uint_1 = OpConstant %uint 1 %int_2 = OpConstant %int 2 @@ -61,28 +62,28 @@ %orientation = OpVariable %_ptr_Function__arr_int_uint_6 Function %17 %21 = OpAccessChain %_ptr_StorageBuffer__arr_int_uint_6 %sspp962805860buildInformation %uint_0 %uint_3 %22 = OpLoad %_arr_int_uint_6 %21 - %25 = OpAccessChain %_ptr_Function_int %orientation %int_0 - %26 = OpCompositeExtract %int %22 0 - OpStore %25 %26 - %28 = OpAccessChain %_ptr_Function_int %orientation %int_1 - %30 = OpCompositeExtract %int %22 1 - OpStore %28 %30 - %32 = OpAccessChain %_ptr_Function_int %orientation %int_2 - %34 = OpCompositeExtract %int %22 2 - OpStore %32 %34 - %36 = OpAccessChain %_ptr_Function_int %orientation %int_3 - %37 = OpCompositeExtract %int %22 3 - OpStore %36 %37 - %39 = OpAccessChain %_ptr_Function_int %orientation %int_4 - %41 = OpCompositeExtract %int %22 4 - OpStore %39 %41 - %43 = OpAccessChain %_ptr_Function_int %orientation %int_5 - %45 = OpCompositeExtract %int %22 5 - OpStore %43 %45 + %25 = OpAccessChain %_ptr_Function_int %orientation %23 + %27 = OpCompositeExtract %int %22 0 + OpStore %25 %27 + %29 = OpAccessChain %_ptr_Function_int %orientation %int_1 + %31 = OpCompositeExtract %int %22 1 + OpStore %29 %31 + %33 = OpAccessChain %_ptr_Function_int %orientation %int_2 + %35 = OpCompositeExtract %int %22 2 + OpStore %33 %35 + %37 = OpAccessChain %_ptr_Function_int %orientation %int_3 + %38 = OpCompositeExtract %int %22 3 + OpStore %37 %38 + %40 = OpAccessChain %_ptr_Function_int %orientation %int_4 + %42 = OpCompositeExtract %int %22 4 + OpStore %40 %42 + %44 = OpAccessChain %_ptr_Function_int %orientation %int_5 + %46 = OpCompositeExtract %int %22 5 + OpStore %44 %46 OpReturn OpFunctionEnd %main = OpFunction %void None %11 - %47 = OpLabel - %48 = OpFunctionCall %void %main_1 + %48 = OpLabel + %49 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/870.spvasm.expected.wgsl b/test/tint/bug/tint/870.spvasm.expected.wgsl index c3b7c8f6e8..1dfaaa072b 100644 --- a/test/tint/bug/tint/870.spvasm.expected.wgsl +++ b/test/tint/bug/tint/870.spvasm.expected.wgsl @@ -25,7 +25,7 @@ fn main_1() { return; } -@stage(fragment) +@fragment fn main() { main_1(); } diff --git a/test/tint/bug/tint/913.wgsl b/test/tint/bug/tint/913.wgsl index 5d1ad7a373..a7786d5b44 100644 --- a/test/tint/bug/tint/913.wgsl +++ b/test/tint/bug/tint/913.wgsl @@ -16,7 +16,7 @@ fn aboutEqual(value : f32, expect : f32) -> bool { // The value diff should be smaller than the hard coded tolerance. return abs(value - expect) < 0.001; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let srcSize : vec2 = textureDimensions(src); let dstSize : vec2 = textureDimensions(dst); diff --git a/test/tint/bug/tint/913.wgsl.expected.hlsl b/test/tint/bug/tint/913.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/913.wgsl.expected.hlsl rename to test/tint/bug/tint/913.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/913.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/913.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2c8eb01dac --- /dev/null +++ b/test/tint/bug/tint/913.wgsl.expected.fxc.hlsl @@ -0,0 +1,93 @@ +Texture2D src : register(t0, space0); +Texture2D tint_symbol : register(t1, space0); +RWByteAddressBuffer output : register(u2, space0); +cbuffer cbuffer_uniforms : register(b3, space0) { + uint4 uniforms[2]; +}; + +bool aboutEqual(float value, float expect) { + return (abs((value - expect)) < 0.001f); +} + +struct tint_symbol_2 { + uint3 GlobalInvocationID : SV_DispatchThreadID; +}; + +void main_inner(uint3 GlobalInvocationID) { + int2 tint_tmp; + src.GetDimensions(tint_tmp.x, tint_tmp.y); + const int2 srcSize = tint_tmp; + int2 tint_tmp_1; + tint_symbol.GetDimensions(tint_tmp_1.x, tint_tmp_1.y); + const int2 dstSize = tint_tmp_1; + const uint2 dstTexCoord = uint2(GlobalInvocationID.xy); + const float4 nonCoveredColor = float4(0.0f, 1.0f, 0.0f, 1.0f); + bool success = true; + bool tint_tmp_4 = (dstTexCoord.x < uniforms[1].x); + if (!tint_tmp_4) { + tint_tmp_4 = (dstTexCoord.y < uniforms[1].y); + } + bool tint_tmp_3 = (tint_tmp_4); + if (!tint_tmp_3) { + tint_tmp_3 = (dstTexCoord.x >= (uniforms[1].x + uniforms[1].z)); + } + bool tint_tmp_2 = (tint_tmp_3); + if (!tint_tmp_2) { + tint_tmp_2 = (dstTexCoord.y >= (uniforms[1].y + uniforms[1].w)); + } + if ((tint_tmp_2)) { + bool tint_tmp_5 = success; + if (tint_tmp_5) { + tint_tmp_5 = all((tint_symbol.Load(int3(int2(dstTexCoord), 0)) == nonCoveredColor)); + } + success = (tint_tmp_5); + } else { + uint2 srcTexCoord = ((dstTexCoord - uniforms[1].xy) + uniforms[0].zw); + if ((uniforms[0].x == 1u)) { + srcTexCoord.y = ((uint(srcSize.y) - srcTexCoord.y) - 1u); + } + const float4 srcColor = src.Load(int3(int2(srcTexCoord), 0)); + const float4 dstColor = tint_symbol.Load(int3(int2(dstTexCoord), 0)); + if ((uniforms[0].y == 2u)) { + bool tint_symbol_4 = success; + if (tint_symbol_4) { + tint_symbol_4 = aboutEqual(dstColor.r, srcColor.r); + } + bool tint_symbol_3 = tint_symbol_4; + if (tint_symbol_3) { + tint_symbol_3 = aboutEqual(dstColor.g, srcColor.g); + } + success = tint_symbol_3; + } else { + bool tint_symbol_8 = success; + if (tint_symbol_8) { + tint_symbol_8 = aboutEqual(dstColor.r, srcColor.r); + } + bool tint_symbol_7 = tint_symbol_8; + if (tint_symbol_7) { + tint_symbol_7 = aboutEqual(dstColor.g, srcColor.g); + } + bool tint_symbol_6 = tint_symbol_7; + if (tint_symbol_6) { + tint_symbol_6 = aboutEqual(dstColor.b, srcColor.b); + } + bool tint_symbol_5 = tint_symbol_6; + if (tint_symbol_5) { + tint_symbol_5 = aboutEqual(dstColor.a, srcColor.a); + } + success = tint_symbol_5; + } + } + const uint outputIndex = ((GlobalInvocationID.y * uint(dstSize.x)) + GlobalInvocationID.x); + if (success) { + output.Store((4u * outputIndex), asuint(1u)); + } else { + output.Store((4u * outputIndex), asuint(0u)); + } +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_2 tint_symbol_1) { + main_inner(tint_symbol_1.GlobalInvocationID); + return; +} diff --git a/test/tint/bug/tint/913.wgsl.expected.msl b/test/tint/bug/tint/913.wgsl.expected.msl index 5de26db32d..06f2ded9f2 100644 --- a/test/tint/bug/tint/913.wgsl.expected.msl +++ b/test/tint/bug/tint/913.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint dstTextureFlipY; /* 0x0004 */ uint channelCount; @@ -10,7 +23,7 @@ struct Uniforms { }; struct OutputBuf { - /* 0x0000 */ uint result[1]; + /* 0x0000 */ tint_array result; }; bool aboutEqual(float value, float expect) { diff --git a/test/tint/bug/tint/913.wgsl.expected.spvasm b/test/tint/bug/tint/913.wgsl.expected.spvasm index 73b58b380b..416999d124 100644 --- a/test/tint/bug/tint/913.wgsl.expected.spvasm +++ b/test/tint/bug/tint/913.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 205 +; Bound: 207 ; Schema: 0 OpCapability Shader OpCapability ImageQuery @@ -81,9 +81,9 @@ %v2int = OpTypeVector %int 2 %int_0 = OpConstant %int 0 %v4float = OpTypeVector %float 4 - %float_0 = OpConstant %float 0 + %44 = OpConstantNull %float %float_1 = OpConstant %float 1 - %46 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %46 = OpConstantComposite %v4float %44 %float_1 %44 %float_1 %true = OpConstantTrue %bool %_ptr_Function_bool = OpTypePointer Function %bool %50 = OpConstantNull %bool @@ -92,14 +92,16 @@ %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_1 = OpConstant %uint 1 %uint_4 = OpConstant %uint 4 + %97 = OpConstantNull %int %v4bool = OpTypeVector %bool 4 %_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint %uint_2 = OpConstant %uint 2 %_ptr_Function_v2uint = OpTypePointer Function %v2uint - %110 = OpConstantNull %v2uint + %111 = OpConstantNull %v2uint %_ptr_Function_uint = OpTypePointer Function %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %200 = OpTypeFunction %void + %201 = OpConstantNull %uint + %202 = OpTypeFunction %void %aboutEqual = OpFunction %bool None %18 %value = OpFunctionParameter %float %expect = OpFunctionParameter %float @@ -113,7 +115,7 @@ %GlobalInvocationID = OpFunctionParameter %v3uint %33 = OpLabel %success = OpVariable %_ptr_Function_bool Function %50 -%srcTexCoord = OpVariable %_ptr_Function_v2uint Function %110 +%srcTexCoord = OpVariable %_ptr_Function_v2uint Function %111 %tint_symbol_1 = OpVariable %_ptr_Function_bool Function %50 %tint_symbol = OpVariable %_ptr_Function_bool Function %50 %tint_symbol_5 = OpVariable %_ptr_Function_bool Function %50 @@ -175,156 +177,156 @@ %92 = OpLabel %95 = OpLoad %7 %dst %96 = OpBitcast %v2int %42 - %94 = OpImageFetch %v4float %95 %96 Lod %int_0 - %97 = OpFOrdEqual %v4bool %94 %46 - %93 = OpAll %bool %97 + %94 = OpImageFetch %v4float %95 %96 Lod %97 + %98 = OpFOrdEqual %v4bool %94 %46 + %93 = OpAll %bool %98 OpBranch %91 %91 = OpLabel - %99 = OpPhi %bool %90 %88 %93 %92 - OpStore %success %99 + %100 = OpPhi %bool %90 %88 %93 %92 + OpStore %success %100 OpBranch %87 %89 = OpLabel - %101 = OpAccessChain %_ptr_Uniform_v2uint %uniforms %uint_3 - %102 = OpLoad %v2uint %101 - %103 = OpISub %v2uint %42 %102 - %105 = OpAccessChain %_ptr_Uniform_v2uint %uniforms %uint_2 - %106 = OpLoad %v2uint %105 - %107 = OpIAdd %v2uint %103 %106 - OpStore %srcTexCoord %107 - %111 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %112 = OpLoad %uint %111 - %113 = OpIEqual %bool %112 %uint_1 - OpSelectionMerge %114 None - OpBranchConditional %113 %115 %114 + %102 = OpAccessChain %_ptr_Uniform_v2uint %uniforms %uint_3 + %103 = OpLoad %v2uint %102 + %104 = OpISub %v2uint %42 %103 + %106 = OpAccessChain %_ptr_Uniform_v2uint %uniforms %uint_2 + %107 = OpLoad %v2uint %106 + %108 = OpIAdd %v2uint %104 %107 + OpStore %srcTexCoord %108 + %112 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %113 = OpLoad %uint %112 + %114 = OpIEqual %bool %113 %uint_1 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + %118 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 + %120 = OpCompositeExtract %int %34 1 + %119 = OpBitcast %uint %120 + %121 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 + %122 = OpLoad %uint %121 + %123 = OpISub %uint %119 %122 + %124 = OpISub %uint %123 %uint_1 + OpStore %118 %124 + OpBranch %115 %115 = OpLabel - %117 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 - %119 = OpCompositeExtract %int %34 1 - %118 = OpBitcast %uint %119 - %120 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 - %121 = OpLoad %uint %120 - %122 = OpISub %uint %118 %121 - %123 = OpISub %uint %122 %uint_1 - OpStore %117 %123 - OpBranch %114 - %114 = OpLabel - %125 = OpLoad %7 %src - %127 = OpLoad %v2uint %srcTexCoord - %126 = OpBitcast %v2int %127 - %124 = OpImageFetch %v4float %125 %126 Lod %int_0 - %129 = OpLoad %7 %dst - %130 = OpBitcast %v2int %42 - %128 = OpImageFetch %v4float %129 %130 Lod %int_0 - %131 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %132 = OpLoad %uint %131 - %133 = OpIEqual %bool %132 %uint_2 - OpSelectionMerge %134 None - OpBranchConditional %133 %135 %136 - %135 = OpLabel - %137 = OpLoad %bool %success - OpStore %tint_symbol_1 %137 - %139 = OpLoad %bool %tint_symbol_1 - OpSelectionMerge %140 None - OpBranchConditional %139 %141 %140 - %141 = OpLabel - %143 = OpCompositeExtract %float %128 0 - %144 = OpCompositeExtract %float %124 0 - %142 = OpFunctionCall %bool %aboutEqual %143 %144 - OpStore %tint_symbol_1 %142 - OpBranch %140 - %140 = OpLabel - %145 = OpLoad %bool %tint_symbol_1 - OpStore %tint_symbol %145 - %147 = OpLoad %bool %tint_symbol - OpSelectionMerge %148 None - OpBranchConditional %147 %149 %148 - %149 = OpLabel - %151 = OpCompositeExtract %float %128 1 - %152 = OpCompositeExtract %float %124 1 - %150 = OpFunctionCall %bool %aboutEqual %151 %152 - OpStore %tint_symbol %150 - OpBranch %148 - %148 = OpLabel - %153 = OpLoad %bool %tint_symbol - OpStore %success %153 - OpBranch %134 + %126 = OpLoad %7 %src + %128 = OpLoad %v2uint %srcTexCoord + %127 = OpBitcast %v2int %128 + %125 = OpImageFetch %v4float %126 %127 Lod %97 + %130 = OpLoad %7 %dst + %131 = OpBitcast %v2int %42 + %129 = OpImageFetch %v4float %130 %131 Lod %97 + %132 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %133 = OpLoad %uint %132 + %134 = OpIEqual %bool %133 %uint_2 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 %136 = OpLabel - %154 = OpLoad %bool %success - OpStore %tint_symbol_5 %154 - %156 = OpLoad %bool %tint_symbol_5 - OpSelectionMerge %157 None - OpBranchConditional %156 %158 %157 + %138 = OpLoad %bool %success + OpStore %tint_symbol_1 %138 + %140 = OpLoad %bool %tint_symbol_1 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %144 = OpCompositeExtract %float %129 0 + %145 = OpCompositeExtract %float %125 0 + %143 = OpFunctionCall %bool %aboutEqual %144 %145 + OpStore %tint_symbol_1 %143 + OpBranch %141 + %141 = OpLabel + %146 = OpLoad %bool %tint_symbol_1 + OpStore %tint_symbol %146 + %148 = OpLoad %bool %tint_symbol + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %149 + %150 = OpLabel + %152 = OpCompositeExtract %float %129 1 + %153 = OpCompositeExtract %float %125 1 + %151 = OpFunctionCall %bool %aboutEqual %152 %153 + OpStore %tint_symbol %151 + OpBranch %149 + %149 = OpLabel + %154 = OpLoad %bool %tint_symbol + OpStore %success %154 + OpBranch %135 + %137 = OpLabel + %155 = OpLoad %bool %success + OpStore %tint_symbol_5 %155 + %157 = OpLoad %bool %tint_symbol_5 + OpSelectionMerge %158 None + OpBranchConditional %157 %159 %158 + %159 = OpLabel + %161 = OpCompositeExtract %float %129 0 + %162 = OpCompositeExtract %float %125 0 + %160 = OpFunctionCall %bool %aboutEqual %161 %162 + OpStore %tint_symbol_5 %160 + OpBranch %158 %158 = OpLabel - %160 = OpCompositeExtract %float %128 0 - %161 = OpCompositeExtract %float %124 0 - %159 = OpFunctionCall %bool %aboutEqual %160 %161 - OpStore %tint_symbol_5 %159 - OpBranch %157 - %157 = OpLabel - %162 = OpLoad %bool %tint_symbol_5 - OpStore %tint_symbol_4 %162 - %164 = OpLoad %bool %tint_symbol_4 - OpSelectionMerge %165 None - OpBranchConditional %164 %166 %165 + %163 = OpLoad %bool %tint_symbol_5 + OpStore %tint_symbol_4 %163 + %165 = OpLoad %bool %tint_symbol_4 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %169 = OpCompositeExtract %float %129 1 + %170 = OpCompositeExtract %float %125 1 + %168 = OpFunctionCall %bool %aboutEqual %169 %170 + OpStore %tint_symbol_4 %168 + OpBranch %166 %166 = OpLabel - %168 = OpCompositeExtract %float %128 1 - %169 = OpCompositeExtract %float %124 1 - %167 = OpFunctionCall %bool %aboutEqual %168 %169 - OpStore %tint_symbol_4 %167 - OpBranch %165 - %165 = OpLabel - %170 = OpLoad %bool %tint_symbol_4 - OpStore %tint_symbol_3 %170 - %172 = OpLoad %bool %tint_symbol_3 - OpSelectionMerge %173 None - OpBranchConditional %172 %174 %173 + %171 = OpLoad %bool %tint_symbol_4 + OpStore %tint_symbol_3 %171 + %173 = OpLoad %bool %tint_symbol_3 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %174 + %175 = OpLabel + %177 = OpCompositeExtract %float %129 2 + %178 = OpCompositeExtract %float %125 2 + %176 = OpFunctionCall %bool %aboutEqual %177 %178 + OpStore %tint_symbol_3 %176 + OpBranch %174 %174 = OpLabel - %176 = OpCompositeExtract %float %128 2 - %177 = OpCompositeExtract %float %124 2 - %175 = OpFunctionCall %bool %aboutEqual %176 %177 - OpStore %tint_symbol_3 %175 - OpBranch %173 - %173 = OpLabel - %178 = OpLoad %bool %tint_symbol_3 - OpStore %tint_symbol_2 %178 - %180 = OpLoad %bool %tint_symbol_2 - OpSelectionMerge %181 None - OpBranchConditional %180 %182 %181 + %179 = OpLoad %bool %tint_symbol_3 + OpStore %tint_symbol_2 %179 + %181 = OpLoad %bool %tint_symbol_2 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %185 = OpCompositeExtract %float %129 3 + %186 = OpCompositeExtract %float %125 3 + %184 = OpFunctionCall %bool %aboutEqual %185 %186 + OpStore %tint_symbol_2 %184 + OpBranch %182 %182 = OpLabel - %184 = OpCompositeExtract %float %128 3 - %185 = OpCompositeExtract %float %124 3 - %183 = OpFunctionCall %bool %aboutEqual %184 %185 - OpStore %tint_symbol_2 %183 - OpBranch %181 - %181 = OpLabel - %186 = OpLoad %bool %tint_symbol_2 - OpStore %success %186 - OpBranch %134 - %134 = OpLabel + %187 = OpLoad %bool %tint_symbol_2 + OpStore %success %187 + OpBranch %135 + %135 = OpLabel OpBranch %87 %87 = OpLabel - %187 = OpCompositeExtract %uint %GlobalInvocationID 1 - %189 = OpCompositeExtract %int %39 0 - %188 = OpBitcast %uint %189 - %190 = OpIMul %uint %187 %188 - %191 = OpCompositeExtract %uint %GlobalInvocationID 0 - %192 = OpIAdd %uint %190 %191 - %193 = OpLoad %bool %success - OpSelectionMerge %194 None - OpBranchConditional %193 %195 %196 - %195 = OpLabel - %198 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %192 - OpStore %198 %uint_1 - OpBranch %194 + %188 = OpCompositeExtract %uint %GlobalInvocationID 1 + %190 = OpCompositeExtract %int %39 0 + %189 = OpBitcast %uint %190 + %191 = OpIMul %uint %188 %189 + %192 = OpCompositeExtract %uint %GlobalInvocationID 0 + %193 = OpIAdd %uint %191 %192 + %194 = OpLoad %bool %success + OpSelectionMerge %195 None + OpBranchConditional %194 %196 %197 %196 = OpLabel - %199 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %192 - OpStore %199 %uint_0 - OpBranch %194 - %194 = OpLabel + %199 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %193 + OpStore %199 %uint_1 + OpBranch %195 + %197 = OpLabel + %200 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %193 + OpStore %200 %201 + OpBranch %195 + %195 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %200 - %202 = OpLabel - %204 = OpLoad %v3uint %GlobalInvocationID_1 - %203 = OpFunctionCall %void %main_inner %204 + %main = OpFunction %void None %202 + %204 = OpLabel + %206 = OpLoad %v3uint %GlobalInvocationID_1 + %205 = OpFunctionCall %void %main_inner %206 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/913.wgsl.expected.wgsl b/test/tint/bug/tint/913.wgsl.expected.wgsl index 2e471dafb0..d06c995b6e 100644 --- a/test/tint/bug/tint/913.wgsl.expected.wgsl +++ b/test/tint/bug/tint/913.wgsl.expected.wgsl @@ -22,7 +22,7 @@ fn aboutEqual(value : f32, expect : f32) -> bool { return (abs((value - expect)) < 0.001); } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) { let srcSize : vec2 = textureDimensions(src); let dstSize : vec2 = textureDimensions(dst); diff --git a/test/tint/bug/tint/914.wgsl b/test/tint/bug/tint/914.wgsl index 5ee9ad2255..1fde2626a8 100644 --- a/test/tint/bug/tint/914.wgsl +++ b/test/tint/bug/tint/914.wgsl @@ -9,7 +9,7 @@ @group(0) @binding(0) var firstMatrix : Matrix; @group(0) @binding(1) var secondMatrix : Matrix; -@group(0) @binding(2) var resultMatrix : Matrix; +@group(0) @binding(2) var resultMatrix : Matrix; @group(0) @binding(3) var uniforms : Uniforms; fn mm_readA(row : u32, col : u32) -> f32 { @@ -38,14 +38,14 @@ fn mm_write(row : u32, col : u32, value : f32) { } } -let RowPerThread : u32 = 4u; -let ColPerThread : u32 = 4u; -let TileAOuter : u32 = 64u; -let TileBOuter : u32 = 64u; -let TileInner : u32 = 64u; +const RowPerThread : u32 = 4u; +const ColPerThread : u32 = 4u; +const TileAOuter : u32 = 64u; +const TileBOuter : u32 = 64u; +const TileInner : u32 = 64u; var mm_Asub : array, 64>; var mm_Bsub : array, 64>; -@stage(compute) @workgroup_size(16, 16, 1) +@compute @workgroup_size(16, 16, 1) fn main(@builtin(local_invocation_id) local_id : vec3, @builtin(global_invocation_id) global_id : vec3) { let tileRow : u32 = local_id.y * RowPerThread; diff --git a/test/tint/bug/tint/914.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/914.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a9ca8f839a --- /dev/null +++ b/test/tint/bug/tint/914.wgsl.expected.dxc.hlsl @@ -0,0 +1,145 @@ +ByteAddressBuffer firstMatrix : register(t0, space0); +ByteAddressBuffer secondMatrix : register(t1, space0); +RWByteAddressBuffer resultMatrix : register(u2, space0); +cbuffer cbuffer_uniforms : register(b3, space0) { + uint4 uniforms[1]; +}; + +float mm_readA(uint row, uint col) { + bool tint_tmp = (row < uniforms[0].x); + if (tint_tmp) { + tint_tmp = (col < uniforms[0].y); + } + if ((tint_tmp)) { + const float result = asfloat(firstMatrix.Load((4u * ((row * uniforms[0].y) + col)))); + return result; + } + return 0.0f; +} + +float mm_readB(uint row, uint col) { + bool tint_tmp_1 = (row < uniforms[0].y); + if (tint_tmp_1) { + tint_tmp_1 = (col < uniforms[0].z); + } + if ((tint_tmp_1)) { + const float result = asfloat(secondMatrix.Load((4u * ((row * uniforms[0].z) + col)))); + return result; + } + return 0.0f; +} + +void mm_write(uint row, uint col, float value) { + bool tint_tmp_2 = (row < uniforms[0].x); + if (tint_tmp_2) { + tint_tmp_2 = (col < uniforms[0].z); + } + if ((tint_tmp_2)) { + const uint index = (col + (row * uniforms[0].z)); + resultMatrix.Store((4u * index), asuint(value)); + } +} + +groupshared float mm_Asub[64][64]; +groupshared float mm_Bsub[64][64]; + +struct tint_symbol_1 { + uint3 local_id : SV_GroupThreadID; + uint local_invocation_index : SV_GroupIndex; + uint3 global_id : SV_DispatchThreadID; +}; + +void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) { + const uint i = (idx / 64u); + const uint i_1 = (idx % 64u); + mm_Asub[i][i_1] = 0.0f; + mm_Bsub[i][i_1] = 0.0f; + } + } + GroupMemoryBarrierWithGroupSync(); + const uint tileRow = (local_id.y * 4u); + const uint tileCol = (local_id.x * 4u); + const uint globalRow = (global_id.y * 4u); + const uint globalCol = (global_id.x * 4u); + const uint numTiles = (((uniforms[0].y - 1u) / 64u) + 1u); + float acc[16] = (float[16])0; + float ACached = 0.0f; + float BCached[4] = (float[4])0; + { + [loop] for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) { + acc[index] = 0.0f; + } + } + const uint ColPerThreadA = (64u / 16u); + const uint tileColA = (local_id.x * ColPerThreadA); + const uint RowPerThreadB = (64u / 16u); + const uint tileRowB = (local_id.y * RowPerThreadB); + { + [loop] for(uint t = 0u; (t < numTiles); t = (t + 1u)) { + { + [loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { + { + [loop] for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) { + const uint inputRow = (tileRow + innerRow); + const uint inputCol = (tileColA + innerCol); + const float tint_symbol_2 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol)); + mm_Asub[inputRow][inputCol] = tint_symbol_2; + } + } + } + } + { + [loop] for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) { + { + [loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + const uint inputRow = (tileRowB + innerRow); + const uint inputCol = (tileCol + innerCol); + const float tint_symbol_3 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol)); + mm_Bsub[innerCol][inputCol] = tint_symbol_3; + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + { + [loop] for(uint k = 0u; (k < 64u); k = (k + 1u)) { + { + [loop] for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) { + BCached[inner] = mm_Bsub[k][(tileCol + inner)]; + } + } + { + [loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { + ACached = mm_Asub[(tileRow + innerRow)][k]; + { + [loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + const uint index = ((innerRow * 4u) + innerCol); + acc[index] = (acc[index] + (ACached * BCached[innerCol])); + } + } + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + } + } + { + [loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { + { + [loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + const uint index = ((innerRow * 4u) + innerCol); + mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]); + } + } + } + } +} + +[numthreads(16, 16, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_id, tint_symbol.global_id, tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/bug/tint/914.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/914.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a9ca8f839a --- /dev/null +++ b/test/tint/bug/tint/914.wgsl.expected.fxc.hlsl @@ -0,0 +1,145 @@ +ByteAddressBuffer firstMatrix : register(t0, space0); +ByteAddressBuffer secondMatrix : register(t1, space0); +RWByteAddressBuffer resultMatrix : register(u2, space0); +cbuffer cbuffer_uniforms : register(b3, space0) { + uint4 uniforms[1]; +}; + +float mm_readA(uint row, uint col) { + bool tint_tmp = (row < uniforms[0].x); + if (tint_tmp) { + tint_tmp = (col < uniforms[0].y); + } + if ((tint_tmp)) { + const float result = asfloat(firstMatrix.Load((4u * ((row * uniforms[0].y) + col)))); + return result; + } + return 0.0f; +} + +float mm_readB(uint row, uint col) { + bool tint_tmp_1 = (row < uniforms[0].y); + if (tint_tmp_1) { + tint_tmp_1 = (col < uniforms[0].z); + } + if ((tint_tmp_1)) { + const float result = asfloat(secondMatrix.Load((4u * ((row * uniforms[0].z) + col)))); + return result; + } + return 0.0f; +} + +void mm_write(uint row, uint col, float value) { + bool tint_tmp_2 = (row < uniforms[0].x); + if (tint_tmp_2) { + tint_tmp_2 = (col < uniforms[0].z); + } + if ((tint_tmp_2)) { + const uint index = (col + (row * uniforms[0].z)); + resultMatrix.Store((4u * index), asuint(value)); + } +} + +groupshared float mm_Asub[64][64]; +groupshared float mm_Bsub[64][64]; + +struct tint_symbol_1 { + uint3 local_id : SV_GroupThreadID; + uint local_invocation_index : SV_GroupIndex; + uint3 global_id : SV_DispatchThreadID; +}; + +void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) { + const uint i = (idx / 64u); + const uint i_1 = (idx % 64u); + mm_Asub[i][i_1] = 0.0f; + mm_Bsub[i][i_1] = 0.0f; + } + } + GroupMemoryBarrierWithGroupSync(); + const uint tileRow = (local_id.y * 4u); + const uint tileCol = (local_id.x * 4u); + const uint globalRow = (global_id.y * 4u); + const uint globalCol = (global_id.x * 4u); + const uint numTiles = (((uniforms[0].y - 1u) / 64u) + 1u); + float acc[16] = (float[16])0; + float ACached = 0.0f; + float BCached[4] = (float[4])0; + { + [loop] for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) { + acc[index] = 0.0f; + } + } + const uint ColPerThreadA = (64u / 16u); + const uint tileColA = (local_id.x * ColPerThreadA); + const uint RowPerThreadB = (64u / 16u); + const uint tileRowB = (local_id.y * RowPerThreadB); + { + [loop] for(uint t = 0u; (t < numTiles); t = (t + 1u)) { + { + [loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { + { + [loop] for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) { + const uint inputRow = (tileRow + innerRow); + const uint inputCol = (tileColA + innerCol); + const float tint_symbol_2 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol)); + mm_Asub[inputRow][inputCol] = tint_symbol_2; + } + } + } + } + { + [loop] for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) { + { + [loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + const uint inputRow = (tileRowB + innerRow); + const uint inputCol = (tileCol + innerCol); + const float tint_symbol_3 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol)); + mm_Bsub[innerCol][inputCol] = tint_symbol_3; + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + { + [loop] for(uint k = 0u; (k < 64u); k = (k + 1u)) { + { + [loop] for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) { + BCached[inner] = mm_Bsub[k][(tileCol + inner)]; + } + } + { + [loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { + ACached = mm_Asub[(tileRow + innerRow)][k]; + { + [loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + const uint index = ((innerRow * 4u) + innerCol); + acc[index] = (acc[index] + (ACached * BCached[innerCol])); + } + } + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + } + } + { + [loop] for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { + { + [loop] for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + const uint index = ((innerRow * 4u) + innerCol); + mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]); + } + } + } + } +} + +[numthreads(16, 16, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_id, tint_symbol.global_id, tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/bug/tint/914.wgsl.expected.glsl b/test/tint/bug/tint/914.wgsl.expected.glsl index 5ec38c1501..a40e5ce01b 100644 --- a/test/tint/bug/tint/914.wgsl.expected.glsl +++ b/test/tint/bug/tint/914.wgsl.expected.glsl @@ -56,9 +56,6 @@ void mm_write(uint row, uint col, float value) { } } -const uint RowPerThread = 4u; -const uint ColPerThread = 4u; -const uint TileInner = 64u; shared float mm_Asub[64][64]; shared float mm_Bsub[64][64]; void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { @@ -71,32 +68,32 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { } } barrier(); - uint tileRow = (local_id.y * RowPerThread); - uint tileCol = (local_id.x * ColPerThread); - uint globalRow = (global_id.y * RowPerThread); - uint globalCol = (global_id.x * ColPerThread); - uint numTiles = (((uniforms.dimInner - 1u) / TileInner) + 1u); + uint tileRow = (local_id.y * 4u); + uint tileCol = (local_id.x * 4u); + uint globalRow = (global_id.y * 4u); + uint globalCol = (global_id.x * 4u); + uint numTiles = (((uniforms.dimInner - 1u) / 64u) + 1u); float acc[16] = float[16](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); float ACached = 0.0f; float BCached[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); { - for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) { + for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) { acc[index] = 0.0f; } } - uint ColPerThreadA = (TileInner / 16u); + uint ColPerThreadA = (64u / 16u); uint tileColA = (local_id.x * ColPerThreadA); - uint RowPerThreadB = (TileInner / 16u); + uint RowPerThreadB = (64u / 16u); uint tileRowB = (local_id.y * RowPerThreadB); { for(uint t = 0u; (t < numTiles); t = (t + 1u)) { { - for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) { + for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { { for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) { uint inputRow = (tileRow + innerRow); uint inputCol = (tileColA + innerCol); - float tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol)); + float tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol)); mm_Asub[inputRow][inputCol] = tint_symbol_1; } } @@ -105,10 +102,10 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { { for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) { { - for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) { + for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { uint inputRow = (tileRowB + innerRow); uint inputCol = (tileCol + innerCol); - float tint_symbol_2 = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol)); + float tint_symbol_2 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol)); mm_Bsub[innerCol][inputCol] = tint_symbol_2; } } @@ -116,18 +113,18 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { } barrier(); { - for(uint k = 0u; (k < TileInner); k = (k + 1u)) { + for(uint k = 0u; (k < 64u); k = (k + 1u)) { { - for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) { + for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) { BCached[inner] = mm_Bsub[k][(tileCol + inner)]; } } { - for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) { + for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { ACached = mm_Asub[(tileRow + innerRow)][k]; { - for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) { - uint index = ((innerRow * ColPerThread) + innerCol); + for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + uint index = ((innerRow * 4u) + innerCol); acc[index] = (acc[index] + (ACached * BCached[innerCol])); } } @@ -139,10 +136,10 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { } } { - for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) { + for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { { - for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) { - uint index = ((innerRow * ColPerThread) + innerCol); + for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + uint index = ((innerRow * 4u) + innerCol); mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]); } } diff --git a/test/tint/bug/tint/914.wgsl.expected.hlsl b/test/tint/bug/tint/914.wgsl.expected.hlsl deleted file mode 100644 index 6e88dc08d7..0000000000 --- a/test/tint/bug/tint/914.wgsl.expected.hlsl +++ /dev/null @@ -1,150 +0,0 @@ -ByteAddressBuffer firstMatrix : register(t0, space0); -ByteAddressBuffer secondMatrix : register(t1, space0); -RWByteAddressBuffer resultMatrix : register(u2, space0); -cbuffer cbuffer_uniforms : register(b3, space0) { - uint4 uniforms[1]; -}; - -float mm_readA(uint row, uint col) { - bool tint_tmp = (row < uniforms[0].x); - if (tint_tmp) { - tint_tmp = (col < uniforms[0].y); - } - if ((tint_tmp)) { - const float result = asfloat(firstMatrix.Load((4u * ((row * uniforms[0].y) + col)))); - return result; - } - return 0.0f; -} - -float mm_readB(uint row, uint col) { - bool tint_tmp_1 = (row < uniforms[0].y); - if (tint_tmp_1) { - tint_tmp_1 = (col < uniforms[0].z); - } - if ((tint_tmp_1)) { - const float result = asfloat(secondMatrix.Load((4u * ((row * uniforms[0].z) + col)))); - return result; - } - return 0.0f; -} - -void mm_write(uint row, uint col, float value) { - bool tint_tmp_2 = (row < uniforms[0].x); - if (tint_tmp_2) { - tint_tmp_2 = (col < uniforms[0].z); - } - if ((tint_tmp_2)) { - const uint index = (col + (row * uniforms[0].z)); - resultMatrix.Store((4u * index), asuint(value)); - } -} - -static const uint RowPerThread = 4u; -static const uint ColPerThread = 4u; -static const uint TileAOuter = 64u; -static const uint TileBOuter = 64u; -static const uint TileInner = 64u; -groupshared float mm_Asub[64][64]; -groupshared float mm_Bsub[64][64]; - -struct tint_symbol_1 { - uint3 local_id : SV_GroupThreadID; - uint local_invocation_index : SV_GroupIndex; - uint3 global_id : SV_DispatchThreadID; -}; - -void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { - { - [loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) { - const uint i = (idx / 64u); - const uint i_1 = (idx % 64u); - mm_Asub[i][i_1] = 0.0f; - mm_Bsub[i][i_1] = 0.0f; - } - } - GroupMemoryBarrierWithGroupSync(); - const uint tileRow = (local_id.y * RowPerThread); - const uint tileCol = (local_id.x * ColPerThread); - const uint globalRow = (global_id.y * RowPerThread); - const uint globalCol = (global_id.x * ColPerThread); - const uint numTiles = (((uniforms[0].y - 1u) / TileInner) + 1u); - float acc[16] = (float[16])0; - float ACached = 0.0f; - float BCached[4] = (float[4])0; - { - [loop] for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) { - acc[index] = 0.0f; - } - } - const uint ColPerThreadA = (TileInner / 16u); - const uint tileColA = (local_id.x * ColPerThreadA); - const uint RowPerThreadB = (TileInner / 16u); - const uint tileRowB = (local_id.y * RowPerThreadB); - { - [loop] for(uint t = 0u; (t < numTiles); t = (t + 1u)) { - { - [loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) { - { - [loop] for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) { - const uint inputRow = (tileRow + innerRow); - const uint inputCol = (tileColA + innerCol); - const float tint_symbol_2 = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol)); - mm_Asub[inputRow][inputCol] = tint_symbol_2; - } - } - } - } - { - [loop] for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) { - { - [loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) { - const uint inputRow = (tileRowB + innerRow); - const uint inputCol = (tileCol + innerCol); - const float tint_symbol_3 = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol)); - mm_Bsub[innerCol][inputCol] = tint_symbol_3; - } - } - } - } - GroupMemoryBarrierWithGroupSync(); - { - [loop] for(uint k = 0u; (k < TileInner); k = (k + 1u)) { - { - [loop] for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) { - BCached[inner] = mm_Bsub[k][(tileCol + inner)]; - } - } - { - [loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) { - ACached = mm_Asub[(tileRow + innerRow)][k]; - { - [loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) { - const uint index = ((innerRow * ColPerThread) + innerCol); - acc[index] = (acc[index] + (ACached * BCached[innerCol])); - } - } - } - } - } - } - GroupMemoryBarrierWithGroupSync(); - } - } - { - [loop] for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) { - { - [loop] for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) { - const uint index = ((innerRow * ColPerThread) + innerCol); - mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]); - } - } - } - } -} - -[numthreads(16, 16, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.local_id, tint_symbol.global_id, tint_symbol.local_invocation_index); - return; -} diff --git a/test/tint/bug/tint/914.wgsl.expected.msl b/test/tint/bug/tint/914.wgsl.expected.msl index 2321c84bc2..d70dc36902 100644 --- a/test/tint/bug/tint/914.wgsl.expected.msl +++ b/test/tint/bug/tint/914.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint dimAOuter; /* 0x0004 */ uint dimInner; @@ -8,7 +21,7 @@ struct Uniforms { }; struct Matrix { - /* 0x0000 */ float numbers[1]; + /* 0x0000 */ tint_array numbers; }; float mm_readA(uint row, uint col, const constant Uniforms* const tint_symbol_3, const device Matrix* const tint_symbol_4) { @@ -34,98 +47,72 @@ void mm_write(uint row, uint col, float value, const constant Uniforms* const ti } } -constant uint RowPerThread = 4u; - -constant uint ColPerThread = 4u; - -constant uint TileAOuter = 64u; - -constant uint TileBOuter = 64u; - -constant uint TileInner = 64u; - -struct tint_array_wrapper_1 { - float arr[64]; -}; - -struct tint_array_wrapper { - tint_array_wrapper_1 arr[64]; -}; - -struct tint_array_wrapper_2 { - float arr[16]; -}; - -struct tint_array_wrapper_3 { - float arr[4]; -}; - -void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_index, threadgroup tint_array_wrapper* const tint_symbol_9, threadgroup tint_array_wrapper* const tint_symbol_10, const constant Uniforms* const tint_symbol_11, const device Matrix* const tint_symbol_12, const device Matrix* const tint_symbol_13, device Matrix* const tint_symbol_14) { +void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_index, threadgroup tint_array, 64>* const tint_symbol_9, threadgroup tint_array, 64>* const tint_symbol_10, const constant Uniforms* const tint_symbol_11, const device Matrix* const tint_symbol_12, const device Matrix* const tint_symbol_13, device Matrix* const tint_symbol_14) { for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) { uint const i = (idx / 64u); uint const i_1 = (idx % 64u); - (*(tint_symbol_9)).arr[i].arr[i_1] = float(); - (*(tint_symbol_10)).arr[i].arr[i_1] = float(); + (*(tint_symbol_9))[i][i_1] = 0.0f; + (*(tint_symbol_10))[i][i_1] = 0.0f; } threadgroup_barrier(mem_flags::mem_threadgroup); - uint const tileRow = (local_id[1] * RowPerThread); - uint const tileCol = (local_id[0] * ColPerThread); - uint const globalRow = (global_id[1] * RowPerThread); - uint const globalCol = (global_id[0] * ColPerThread); - uint const numTiles = ((((*(tint_symbol_11)).dimInner - 1u) / TileInner) + 1u); - tint_array_wrapper_2 acc = {}; + uint const tileRow = (local_id[1] * 4u); + uint const tileCol = (local_id[0] * 4u); + uint const globalRow = (global_id[1] * 4u); + uint const globalCol = (global_id[0] * 4u); + uint const numTiles = ((((*(tint_symbol_11)).dimInner - 1u) / 64u) + 1u); + tint_array acc = {}; float ACached = 0.0f; - tint_array_wrapper_3 BCached = {}; - for(uint index = 0u; (index < (RowPerThread * ColPerThread)); index = (index + 1u)) { - acc.arr[index] = 0.0f; + tint_array BCached = {}; + for(uint index = 0u; (index < (4u * 4u)); index = (index + 1u)) { + acc[index] = 0.0f; } - uint const ColPerThreadA = (TileInner / 16u); + uint const ColPerThreadA = (64u / 16u); uint const tileColA = (local_id[0] * ColPerThreadA); - uint const RowPerThreadB = (TileInner / 16u); + uint const RowPerThreadB = (64u / 16u); uint const tileRowB = (local_id[1] * RowPerThreadB); for(uint t = 0u; (t < numTiles); t = (t + 1u)) { - for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) { + for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) { uint const inputRow = (tileRow + innerRow); uint const inputCol = (tileColA + innerCol); - float const tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol), tint_symbol_11, tint_symbol_12); - (*(tint_symbol_9)).arr[inputRow].arr[inputCol] = tint_symbol_1; + float const tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol), tint_symbol_11, tint_symbol_12); + (*(tint_symbol_9))[inputRow][inputCol] = tint_symbol_1; } } for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) { - for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) { + for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { uint const inputRow = (tileRowB + innerRow); uint const inputCol = (tileCol + innerCol); - float const tint_symbol_2 = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol), tint_symbol_11, tint_symbol_13); - (*(tint_symbol_10)).arr[innerCol].arr[inputCol] = tint_symbol_2; + float const tint_symbol_2 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol), tint_symbol_11, tint_symbol_13); + (*(tint_symbol_10))[innerCol][inputCol] = tint_symbol_2; } } threadgroup_barrier(mem_flags::mem_threadgroup); - for(uint k = 0u; (k < TileInner); k = (k + 1u)) { - for(uint inner = 0u; (inner < ColPerThread); inner = (inner + 1u)) { - BCached.arr[inner] = (*(tint_symbol_10)).arr[k].arr[(tileCol + inner)]; + for(uint k = 0u; (k < 64u); k = (k + 1u)) { + for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) { + BCached[inner] = (*(tint_symbol_10))[k][(tileCol + inner)]; } - for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) { - ACached = (*(tint_symbol_9)).arr[(tileRow + innerRow)].arr[k]; - for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) { - uint const index = ((innerRow * ColPerThread) + innerCol); - acc.arr[index] = (acc.arr[index] + (ACached * BCached.arr[innerCol])); + for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { + ACached = (*(tint_symbol_9))[(tileRow + innerRow)][k]; + for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + uint const index = ((innerRow * 4u) + innerCol); + acc[index] = (acc[index] + (ACached * BCached[innerCol])); } } } threadgroup_barrier(mem_flags::mem_threadgroup); } - for(uint innerRow = 0u; (innerRow < RowPerThread); innerRow = (innerRow + 1u)) { - for(uint innerCol = 0u; (innerCol < ColPerThread); innerCol = (innerCol + 1u)) { - uint const index = ((innerRow * ColPerThread) + innerCol); - mm_write((globalRow + innerRow), (globalCol + innerCol), acc.arr[index], tint_symbol_11, tint_symbol_14); + for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { + for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { + uint const index = ((innerRow * 4u) + innerCol); + mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index], tint_symbol_11, tint_symbol_14); } } } kernel void tint_symbol(const constant Uniforms* tint_symbol_17 [[buffer(0)]], const device Matrix* tint_symbol_18 [[buffer(2)]], const device Matrix* tint_symbol_19 [[buffer(3)]], device Matrix* tint_symbol_20 [[buffer(1)]], uint3 local_id [[thread_position_in_threadgroup]], uint3 global_id [[thread_position_in_grid]], uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup tint_array_wrapper tint_symbol_15; - threadgroup tint_array_wrapper tint_symbol_16; + threadgroup tint_array, 64> tint_symbol_15; + threadgroup tint_array, 64> tint_symbol_16; tint_symbol_inner(local_id, global_id, local_invocation_index, &(tint_symbol_15), &(tint_symbol_16), tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20); return; } diff --git a/test/tint/bug/tint/914.wgsl.expected.spvasm b/test/tint/bug/tint/914.wgsl.expected.spvasm index 48ce37eb2c..6506377514 100644 --- a/test/tint/bug/tint/914.wgsl.expected.spvasm +++ b/test/tint/bug/tint/914.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 375 +; Bound: 374 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,11 +20,6 @@ OpMemberName %Uniforms 1 "dimInner" OpMemberName %Uniforms 2 "dimBOuter" OpName %uniforms "uniforms" - OpName %RowPerThread "RowPerThread" - OpName %RowPerThread "ColPerThread" - OpName %TileAOuter "TileAOuter" - OpName %TileAOuter "TileBOuter" - OpName %TileAOuter "TileInner" OpName %mm_Asub "mm_Asub" OpName %mm_Bsub "mm_Bsub" OpName %mm_readA "mm_readA" @@ -70,7 +65,6 @@ OpDecorate %secondMatrix NonWritable OpDecorate %secondMatrix DescriptorSet 0 OpDecorate %secondMatrix Binding 1 - OpDecorate %resultMatrix NonReadable OpDecorate %resultMatrix DescriptorSet 0 OpDecorate %resultMatrix Binding 2 OpDecorate %Uniforms Block @@ -80,10 +74,10 @@ OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 0 OpDecorate %uniforms Binding 3 - OpDecorate %_arr_float_TileAOuter ArrayStride 4 - OpDecorate %_arr__arr_float_TileAOuter_TileAOuter ArrayStride 256 + OpDecorate %_arr_float_uint_64 ArrayStride 4 + OpDecorate %_arr__arr_float_uint_64_uint_64 ArrayStride 256 OpDecorate %_arr_float_uint_16 ArrayStride 4 - OpDecorate %_arr_float_RowPerThread ArrayStride 4 + OpDecorate %_arr_float_uint_4 ArrayStride 4 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %_ptr_Input_v3uint = OpTypePointer Input %v3uint @@ -101,527 +95,526 @@ %Uniforms = OpTypeStruct %uint %uint %uint %_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform -%RowPerThread = OpConstant %uint 4 - %TileAOuter = OpConstant %uint 64 -%_arr_float_TileAOuter = OpTypeArray %float %TileAOuter -%_arr__arr_float_TileAOuter_TileAOuter = OpTypeArray %_arr_float_TileAOuter %TileAOuter -%_ptr_Workgroup__arr__arr_float_TileAOuter_TileAOuter = OpTypePointer Workgroup %_arr__arr_float_TileAOuter_TileAOuter - %mm_Asub = OpVariable %_ptr_Workgroup__arr__arr_float_TileAOuter_TileAOuter Workgroup - %mm_Bsub = OpVariable %_ptr_Workgroup__arr__arr_float_TileAOuter_TileAOuter Workgroup - %25 = OpTypeFunction %float %uint %uint + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_arr__arr_float_uint_64_uint_64 = OpTypeArray %_arr_float_uint_64 %uint_64 +%_ptr_Workgroup__arr__arr_float_uint_64_uint_64 = OpTypePointer Workgroup %_arr__arr_float_uint_64_uint_64 + %mm_Asub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup + %mm_Bsub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup + %24 = OpTypeFunction %float %uint %uint %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %bool = OpTypeBool %uint_1 = OpConstant %uint 1 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float - %float_0 = OpConstant %float 0 + %51 = OpConstantNull %float %uint_2 = OpConstant %uint 2 %void = OpTypeVoid - %75 = OpTypeFunction %void %uint %uint %float - %98 = OpTypeFunction %void %v3uint %v3uint %uint + %74 = OpTypeFunction %void %uint %uint %float + %97 = OpTypeFunction %void %v3uint %v3uint %uint %_ptr_Function_uint = OpTypePointer Function %uint - %106 = OpConstantNull %uint + %105 = OpConstantNull %uint %uint_4096 = OpConstant %uint 4096 %_ptr_Workgroup_float = OpTypePointer Workgroup %float - %123 = OpConstantNull %float %uint_256 = OpConstant %uint 256 %uint_264 = OpConstant %uint 264 + %uint_4 = OpConstant %uint 4 %uint_16 = OpConstant %uint 16 %_arr_float_uint_16 = OpTypeArray %float %uint_16 %_ptr_Function__arr_float_uint_16 = OpTypePointer Function %_arr_float_uint_16 - %147 = OpConstantNull %_arr_float_uint_16 + %146 = OpConstantNull %_arr_float_uint_16 %_ptr_Function_float = OpTypePointer Function %float -%_arr_float_RowPerThread = OpTypeArray %float %RowPerThread -%_ptr_Function__arr_float_RowPerThread = OpTypePointer Function %_arr_float_RowPerThread - %153 = OpConstantNull %_arr_float_RowPerThread - %368 = OpTypeFunction %void - %mm_readA = OpFunction %float None %25 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4 + %152 = OpConstantNull %_arr_float_uint_4 + %367 = OpTypeFunction %void + %mm_readA = OpFunction %float None %24 %row = OpFunctionParameter %uint %col = OpFunctionParameter %uint - %29 = OpLabel - %32 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %33 = OpLoad %uint %32 - %34 = OpULessThan %bool %row %33 - OpSelectionMerge %36 None - OpBranchConditional %34 %37 %36 - %37 = OpLabel - %39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %40 = OpLoad %uint %39 - %41 = OpULessThan %bool %col %40 - OpBranch %36 + %28 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %32 = OpLoad %uint %31 + %33 = OpULessThan %bool %row %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 %36 = OpLabel - %42 = OpPhi %bool %34 %29 %41 %37 - OpSelectionMerge %43 None - OpBranchConditional %42 %44 %43 - %44 = OpLabel - %45 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %46 = OpLoad %uint %45 - %47 = OpIMul %uint %row %46 - %48 = OpIAdd %uint %47 %col - %50 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %48 - %51 = OpLoad %float %50 - OpReturnValue %51 + %38 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %39 = OpLoad %uint %38 + %40 = OpULessThan %bool %col %39 + OpBranch %35 + %35 = OpLabel + %41 = OpPhi %bool %33 %28 %40 %36 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 %43 = OpLabel - OpReturnValue %float_0 + %44 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %45 = OpLoad %uint %44 + %46 = OpIMul %uint %row %45 + %47 = OpIAdd %uint %46 %col + %49 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %47 + %50 = OpLoad %float %49 + OpReturnValue %50 + %42 = OpLabel + OpReturnValue %51 OpFunctionEnd - %mm_readB = OpFunction %float None %25 + %mm_readB = OpFunction %float None %24 %row_0 = OpFunctionParameter %uint %col_0 = OpFunctionParameter %uint - %56 = OpLabel - %57 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %58 = OpLoad %uint %57 - %59 = OpULessThan %bool %row_0 %58 - OpSelectionMerge %60 None - OpBranchConditional %59 %61 %60 - %61 = OpLabel - %63 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 - %64 = OpLoad %uint %63 - %65 = OpULessThan %bool %col_0 %64 - OpBranch %60 + %55 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %57 = OpLoad %uint %56 + %58 = OpULessThan %bool %row_0 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 %60 = OpLabel - %66 = OpPhi %bool %59 %56 %65 %61 - OpSelectionMerge %67 None - OpBranchConditional %66 %68 %67 - %68 = OpLabel - %69 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 - %70 = OpLoad %uint %69 - %71 = OpIMul %uint %row_0 %70 - %72 = OpIAdd %uint %71 %col_0 - %73 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %72 - %74 = OpLoad %float %73 - OpReturnValue %74 + %62 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 + %63 = OpLoad %uint %62 + %64 = OpULessThan %bool %col_0 %63 + OpBranch %59 + %59 = OpLabel + %65 = OpPhi %bool %58 %55 %64 %60 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 %67 = OpLabel - OpReturnValue %float_0 + %68 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 + %69 = OpLoad %uint %68 + %70 = OpIMul %uint %row_0 %69 + %71 = OpIAdd %uint %70 %col_0 + %72 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %71 + %73 = OpLoad %float %72 + OpReturnValue %73 + %66 = OpLabel + OpReturnValue %51 OpFunctionEnd - %mm_write = OpFunction %void None %75 + %mm_write = OpFunction %void None %74 %row_1 = OpFunctionParameter %uint %col_1 = OpFunctionParameter %uint %value = OpFunctionParameter %float - %81 = OpLabel - %82 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %83 = OpLoad %uint %82 - %84 = OpULessThan %bool %row_1 %83 - OpSelectionMerge %85 None - OpBranchConditional %84 %86 %85 - %86 = OpLabel - %87 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 - %88 = OpLoad %uint %87 - %89 = OpULessThan %bool %col_1 %88 - OpBranch %85 + %80 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %82 = OpLoad %uint %81 + %83 = OpULessThan %bool %row_1 %82 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %84 %85 = OpLabel - %90 = OpPhi %bool %84 %81 %89 %86 - OpSelectionMerge %91 None - OpBranchConditional %90 %92 %91 - %92 = OpLabel - %93 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 - %94 = OpLoad %uint %93 - %95 = OpIMul %uint %row_1 %94 - %96 = OpIAdd %uint %col_1 %95 - %97 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %96 - OpStore %97 %value - OpBranch %91 + %86 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 + %87 = OpLoad %uint %86 + %88 = OpULessThan %bool %col_1 %87 + OpBranch %84 + %84 = OpLabel + %89 = OpPhi %bool %83 %80 %88 %85 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 %91 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 + %93 = OpLoad %uint %92 + %94 = OpIMul %uint %row_1 %93 + %95 = OpIAdd %uint %col_1 %94 + %96 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %95 + OpStore %96 %value + OpBranch %90 + %90 = OpLabel OpReturn OpFunctionEnd - %main_inner = OpFunction %void None %98 + %main_inner = OpFunction %void None %97 %local_id = OpFunctionParameter %v3uint %global_id = OpFunctionParameter %v3uint %local_invocation_index = OpFunctionParameter %uint - %103 = OpLabel - %idx = OpVariable %_ptr_Function_uint Function %106 - %acc = OpVariable %_ptr_Function__arr_float_uint_16 Function %147 - %ACached = OpVariable %_ptr_Function_float Function %123 - %BCached = OpVariable %_ptr_Function__arr_float_RowPerThread Function %153 - %index = OpVariable %_ptr_Function_uint Function %106 - %t = OpVariable %_ptr_Function_uint Function %106 - %innerRow = OpVariable %_ptr_Function_uint Function %106 - %innerCol = OpVariable %_ptr_Function_uint Function %106 - %innerRow_0 = OpVariable %_ptr_Function_uint Function %106 - %innerCol_0 = OpVariable %_ptr_Function_uint Function %106 - %k = OpVariable %_ptr_Function_uint Function %106 - %inner = OpVariable %_ptr_Function_uint Function %106 - %innerRow_1 = OpVariable %_ptr_Function_uint Function %106 - %innerCol_1 = OpVariable %_ptr_Function_uint Function %106 - %innerRow_2 = OpVariable %_ptr_Function_uint Function %106 - %innerCol_2 = OpVariable %_ptr_Function_uint Function %106 + %102 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %105 + %acc = OpVariable %_ptr_Function__arr_float_uint_16 Function %146 + %ACached = OpVariable %_ptr_Function_float Function %51 + %BCached = OpVariable %_ptr_Function__arr_float_uint_4 Function %152 + %index = OpVariable %_ptr_Function_uint Function %105 + %t = OpVariable %_ptr_Function_uint Function %105 + %innerRow = OpVariable %_ptr_Function_uint Function %105 + %innerCol = OpVariable %_ptr_Function_uint Function %105 + %innerRow_0 = OpVariable %_ptr_Function_uint Function %105 + %innerCol_0 = OpVariable %_ptr_Function_uint Function %105 + %k = OpVariable %_ptr_Function_uint Function %105 + %inner = OpVariable %_ptr_Function_uint Function %105 + %innerRow_1 = OpVariable %_ptr_Function_uint Function %105 + %innerCol_1 = OpVariable %_ptr_Function_uint Function %105 + %innerRow_2 = OpVariable %_ptr_Function_uint Function %105 + %innerCol_2 = OpVariable %_ptr_Function_uint Function %105 OpStore %idx %local_invocation_index - OpBranch %107 - %107 = OpLabel - OpLoopMerge %108 %109 None - OpBranch %110 - %110 = OpLabel - %112 = OpLoad %uint %idx - %114 = OpULessThan %bool %112 %uint_4096 - %111 = OpLogicalNot %bool %114 - OpSelectionMerge %115 None - OpBranchConditional %111 %116 %115 - %116 = OpLabel - OpBranch %108 - %115 = OpLabel - %117 = OpLoad %uint %idx - %118 = OpUDiv %uint %117 %TileAOuter - %119 = OpLoad %uint %idx - %120 = OpUMod %uint %119 %TileAOuter - %122 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %118 %120 - OpStore %122 %123 - %124 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %118 %120 - OpStore %124 %123 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None OpBranch %109 %109 = OpLabel - %125 = OpLoad %uint %idx - %127 = OpIAdd %uint %125 %uint_256 - OpStore %idx %127 + %111 = OpLoad %uint %idx + %113 = OpULessThan %bool %111 %uint_4096 + %110 = OpLogicalNot %bool %113 + OpSelectionMerge %114 None + OpBranchConditional %110 %115 %114 + %115 = OpLabel OpBranch %107 + %114 = OpLabel + %116 = OpLoad %uint %idx + %117 = OpUDiv %uint %116 %uint_64 + %118 = OpLoad %uint %idx + %119 = OpUMod %uint %118 %uint_64 + %121 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %117 %119 + OpStore %121 %51 + %122 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %117 %119 + OpStore %122 %51 + OpBranch %108 %108 = OpLabel + %123 = OpLoad %uint %idx + %125 = OpIAdd %uint %123 %uint_256 + OpStore %idx %125 + OpBranch %106 + %107 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - %130 = OpCompositeExtract %uint %local_id 1 - %131 = OpIMul %uint %130 %RowPerThread - %132 = OpCompositeExtract %uint %local_id 0 - %133 = OpIMul %uint %132 %RowPerThread - %134 = OpCompositeExtract %uint %global_id 1 - %135 = OpIMul %uint %134 %RowPerThread - %136 = OpCompositeExtract %uint %global_id 0 - %137 = OpIMul %uint %136 %RowPerThread - %138 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %139 = OpLoad %uint %138 - %140 = OpISub %uint %139 %uint_1 - %141 = OpUDiv %uint %140 %TileAOuter - %142 = OpIAdd %uint %141 %uint_1 - OpStore %index %uint_0 - OpBranch %155 - %155 = OpLabel - OpLoopMerge %156 %157 None - OpBranch %158 - %158 = OpLabel - %160 = OpLoad %uint %index - %161 = OpIMul %uint %RowPerThread %RowPerThread - %162 = OpULessThan %bool %160 %161 - %159 = OpLogicalNot %bool %162 - OpSelectionMerge %163 None - OpBranchConditional %159 %164 %163 - %164 = OpLabel - OpBranch %156 - %163 = OpLabel - %165 = OpLoad %uint %index - %166 = OpAccessChain %_ptr_Function_float %acc %165 - OpStore %166 %float_0 + %128 = OpCompositeExtract %uint %local_id 1 + %130 = OpIMul %uint %128 %uint_4 + %131 = OpCompositeExtract %uint %local_id 0 + %132 = OpIMul %uint %131 %uint_4 + %133 = OpCompositeExtract %uint %global_id 1 + %134 = OpIMul %uint %133 %uint_4 + %135 = OpCompositeExtract %uint %global_id 0 + %136 = OpIMul %uint %135 %uint_4 + %137 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %138 = OpLoad %uint %137 + %139 = OpISub %uint %138 %uint_1 + %140 = OpUDiv %uint %139 %uint_64 + %141 = OpIAdd %uint %140 %uint_1 + OpStore %index %105 + OpBranch %154 + %154 = OpLabel + OpLoopMerge %155 %156 None OpBranch %157 %157 = OpLabel - %167 = OpLoad %uint %index - %168 = OpIAdd %uint %167 %uint_1 - OpStore %index %168 + %159 = OpLoad %uint %index + %160 = OpIMul %uint %uint_4 %uint_4 + %161 = OpULessThan %bool %159 %160 + %158 = OpLogicalNot %bool %161 + OpSelectionMerge %162 None + OpBranchConditional %158 %163 %162 + %163 = OpLabel OpBranch %155 + %162 = OpLabel + %164 = OpLoad %uint %index + %165 = OpAccessChain %_ptr_Function_float %acc %164 + OpStore %165 %51 + OpBranch %156 %156 = OpLabel - %169 = OpUDiv %uint %TileAOuter %uint_16 - %170 = OpCompositeExtract %uint %local_id 0 - %171 = OpIMul %uint %170 %169 - %172 = OpUDiv %uint %TileAOuter %uint_16 - %173 = OpCompositeExtract %uint %local_id 1 - %174 = OpIMul %uint %173 %172 - OpStore %t %uint_0 - OpBranch %176 - %176 = OpLabel - OpLoopMerge %177 %178 None - OpBranch %179 - %179 = OpLabel - %181 = OpLoad %uint %t - %182 = OpULessThan %bool %181 %142 - %180 = OpLogicalNot %bool %182 - OpSelectionMerge %183 None - OpBranchConditional %180 %184 %183 - %184 = OpLabel - OpBranch %177 - %183 = OpLabel - OpStore %innerRow %uint_0 - OpBranch %186 - %186 = OpLabel - OpLoopMerge %187 %188 None - OpBranch %189 - %189 = OpLabel - %191 = OpLoad %uint %innerRow - %192 = OpULessThan %bool %191 %RowPerThread - %190 = OpLogicalNot %bool %192 - OpSelectionMerge %193 None - OpBranchConditional %190 %194 %193 - %194 = OpLabel - OpBranch %187 - %193 = OpLabel - OpStore %innerCol %uint_0 - OpBranch %196 - %196 = OpLabel - OpLoopMerge %197 %198 None - OpBranch %199 - %199 = OpLabel - %201 = OpLoad %uint %innerCol - %202 = OpULessThan %bool %201 %169 - %200 = OpLogicalNot %bool %202 - OpSelectionMerge %203 None - OpBranchConditional %200 %204 %203 - %204 = OpLabel - OpBranch %197 - %203 = OpLabel - %205 = OpLoad %uint %innerRow - %206 = OpIAdd %uint %131 %205 - %207 = OpLoad %uint %innerCol - %208 = OpIAdd %uint %171 %207 - %210 = OpLoad %uint %innerRow - %211 = OpIAdd %uint %135 %210 - %212 = OpLoad %uint %t - %213 = OpIMul %uint %212 %TileAOuter - %214 = OpIAdd %uint %213 %208 - %209 = OpFunctionCall %float %mm_readA %211 %214 - %215 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %206 %208 - OpStore %215 %209 - OpBranch %198 - %198 = OpLabel - %216 = OpLoad %uint %innerCol - %217 = OpIAdd %uint %216 %uint_1 - OpStore %innerCol %217 - OpBranch %196 - %197 = OpLabel - OpBranch %188 - %188 = OpLabel - %218 = OpLoad %uint %innerRow - %219 = OpIAdd %uint %218 %uint_1 - OpStore %innerRow %219 - OpBranch %186 - %187 = OpLabel - OpStore %innerRow_0 %uint_0 - OpBranch %221 - %221 = OpLabel - OpLoopMerge %222 %223 None - OpBranch %224 - %224 = OpLabel - %226 = OpLoad %uint %innerRow_0 - %227 = OpULessThan %bool %226 %172 - %225 = OpLogicalNot %bool %227 - OpSelectionMerge %228 None - OpBranchConditional %225 %229 %228 - %229 = OpLabel - OpBranch %222 - %228 = OpLabel - OpStore %innerCol_0 %uint_0 - OpBranch %231 - %231 = OpLabel - OpLoopMerge %232 %233 None - OpBranch %234 - %234 = OpLabel - %236 = OpLoad %uint %innerCol_0 - %237 = OpULessThan %bool %236 %RowPerThread - %235 = OpLogicalNot %bool %237 - OpSelectionMerge %238 None - OpBranchConditional %235 %239 %238 - %239 = OpLabel - OpBranch %232 - %238 = OpLabel - %240 = OpLoad %uint %innerRow_0 - %241 = OpIAdd %uint %174 %240 - %242 = OpLoad %uint %innerCol_0 - %243 = OpIAdd %uint %133 %242 - %245 = OpLoad %uint %t - %246 = OpIMul %uint %245 %TileAOuter - %247 = OpIAdd %uint %246 %241 - %248 = OpLoad %uint %innerCol_0 - %249 = OpIAdd %uint %137 %248 - %244 = OpFunctionCall %float %mm_readB %247 %249 - %250 = OpLoad %uint %innerCol_0 - %251 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %250 %243 - OpStore %251 %244 - OpBranch %233 - %233 = OpLabel - %252 = OpLoad %uint %innerCol_0 - %253 = OpIAdd %uint %252 %uint_1 - OpStore %innerCol_0 %253 - OpBranch %231 - %232 = OpLabel - OpBranch %223 - %223 = OpLabel - %254 = OpLoad %uint %innerRow_0 - %255 = OpIAdd %uint %254 %uint_1 - OpStore %innerRow_0 %255 - OpBranch %221 - %222 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_264 - OpStore %k %uint_0 - OpBranch %258 - %258 = OpLabel - OpLoopMerge %259 %260 None - OpBranch %261 - %261 = OpLabel - %263 = OpLoad %uint %k - %264 = OpULessThan %bool %263 %TileAOuter - %262 = OpLogicalNot %bool %264 - OpSelectionMerge %265 None - OpBranchConditional %262 %266 %265 - %266 = OpLabel - OpBranch %259 - %265 = OpLabel - OpStore %inner %uint_0 - OpBranch %268 - %268 = OpLabel - OpLoopMerge %269 %270 None - OpBranch %271 - %271 = OpLabel - %273 = OpLoad %uint %inner - %274 = OpULessThan %bool %273 %RowPerThread - %272 = OpLogicalNot %bool %274 - OpSelectionMerge %275 None - OpBranchConditional %272 %276 %275 - %276 = OpLabel - OpBranch %269 - %275 = OpLabel - %277 = OpLoad %uint %inner - %278 = OpAccessChain %_ptr_Function_float %BCached %277 - %279 = OpLoad %uint %k - %280 = OpLoad %uint %inner - %281 = OpIAdd %uint %133 %280 - %282 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %279 %281 - %283 = OpLoad %float %282 - OpStore %278 %283 - OpBranch %270 - %270 = OpLabel - %284 = OpLoad %uint %inner - %285 = OpIAdd %uint %284 %uint_1 - OpStore %inner %285 - OpBranch %268 - %269 = OpLabel - OpStore %innerRow_1 %uint_0 - OpBranch %287 - %287 = OpLabel - OpLoopMerge %288 %289 None - OpBranch %290 - %290 = OpLabel - %292 = OpLoad %uint %innerRow_1 - %293 = OpULessThan %bool %292 %RowPerThread - %291 = OpLogicalNot %bool %293 - OpSelectionMerge %294 None - OpBranchConditional %291 %295 %294 - %295 = OpLabel - OpBranch %288 - %294 = OpLabel - %296 = OpLoad %uint %innerRow_1 - %297 = OpIAdd %uint %131 %296 - %298 = OpLoad %uint %k - %299 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %297 %298 - %300 = OpLoad %float %299 - OpStore %ACached %300 - OpStore %innerCol_1 %uint_0 - OpBranch %302 - %302 = OpLabel - OpLoopMerge %303 %304 None - OpBranch %305 - %305 = OpLabel - %307 = OpLoad %uint %innerCol_1 - %308 = OpULessThan %bool %307 %RowPerThread - %306 = OpLogicalNot %bool %308 - OpSelectionMerge %309 None - OpBranchConditional %306 %310 %309 - %310 = OpLabel - OpBranch %303 - %309 = OpLabel - %311 = OpLoad %uint %innerRow_1 - %312 = OpIMul %uint %311 %RowPerThread - %313 = OpLoad %uint %innerCol_1 - %314 = OpIAdd %uint %312 %313 - %315 = OpAccessChain %_ptr_Function_float %acc %314 - %316 = OpAccessChain %_ptr_Function_float %acc %314 - %317 = OpLoad %float %316 - %318 = OpLoad %float %ACached - %319 = OpLoad %uint %innerCol_1 - %320 = OpAccessChain %_ptr_Function_float %BCached %319 - %321 = OpLoad %float %320 - %322 = OpFMul %float %318 %321 - %323 = OpFAdd %float %317 %322 - OpStore %315 %323 - OpBranch %304 - %304 = OpLabel - %324 = OpLoad %uint %innerCol_1 - %325 = OpIAdd %uint %324 %uint_1 - OpStore %innerCol_1 %325 - OpBranch %302 - %303 = OpLabel - OpBranch %289 - %289 = OpLabel - %326 = OpLoad %uint %innerRow_1 - %327 = OpIAdd %uint %326 %uint_1 - OpStore %innerRow_1 %327 - OpBranch %287 - %288 = OpLabel - OpBranch %260 - %260 = OpLabel - %328 = OpLoad %uint %k - %329 = OpIAdd %uint %328 %uint_1 - OpStore %k %329 - OpBranch %258 - %259 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_264 + %166 = OpLoad %uint %index + %167 = OpIAdd %uint %166 %uint_1 + OpStore %index %167 + OpBranch %154 + %155 = OpLabel + %168 = OpUDiv %uint %uint_64 %uint_16 + %169 = OpCompositeExtract %uint %local_id 0 + %170 = OpIMul %uint %169 %168 + %171 = OpUDiv %uint %uint_64 %uint_16 + %172 = OpCompositeExtract %uint %local_id 1 + %173 = OpIMul %uint %172 %171 + OpStore %t %105 + OpBranch %175 + %175 = OpLabel + OpLoopMerge %176 %177 None OpBranch %178 %178 = OpLabel - %331 = OpLoad %uint %t - %332 = OpIAdd %uint %331 %uint_1 - OpStore %t %332 + %180 = OpLoad %uint %t + %181 = OpULessThan %bool %180 %141 + %179 = OpLogicalNot %bool %181 + OpSelectionMerge %182 None + OpBranchConditional %179 %183 %182 + %183 = OpLabel OpBranch %176 + %182 = OpLabel + OpStore %innerRow %105 + OpBranch %185 + %185 = OpLabel + OpLoopMerge %186 %187 None + OpBranch %188 + %188 = OpLabel + %190 = OpLoad %uint %innerRow + %191 = OpULessThan %bool %190 %uint_4 + %189 = OpLogicalNot %bool %191 + OpSelectionMerge %192 None + OpBranchConditional %189 %193 %192 + %193 = OpLabel + OpBranch %186 + %192 = OpLabel + OpStore %innerCol %105 + OpBranch %195 + %195 = OpLabel + OpLoopMerge %196 %197 None + OpBranch %198 + %198 = OpLabel + %200 = OpLoad %uint %innerCol + %201 = OpULessThan %bool %200 %168 + %199 = OpLogicalNot %bool %201 + OpSelectionMerge %202 None + OpBranchConditional %199 %203 %202 + %203 = OpLabel + OpBranch %196 + %202 = OpLabel + %204 = OpLoad %uint %innerRow + %205 = OpIAdd %uint %130 %204 + %206 = OpLoad %uint %innerCol + %207 = OpIAdd %uint %170 %206 + %209 = OpLoad %uint %innerRow + %210 = OpIAdd %uint %134 %209 + %211 = OpLoad %uint %t + %212 = OpIMul %uint %211 %uint_64 + %213 = OpIAdd %uint %212 %207 + %208 = OpFunctionCall %float %mm_readA %210 %213 + %214 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %205 %207 + OpStore %214 %208 + OpBranch %197 + %197 = OpLabel + %215 = OpLoad %uint %innerCol + %216 = OpIAdd %uint %215 %uint_1 + OpStore %innerCol %216 + OpBranch %195 + %196 = OpLabel + OpBranch %187 + %187 = OpLabel + %217 = OpLoad %uint %innerRow + %218 = OpIAdd %uint %217 %uint_1 + OpStore %innerRow %218 + OpBranch %185 + %186 = OpLabel + OpStore %innerRow_0 %105 + OpBranch %220 + %220 = OpLabel + OpLoopMerge %221 %222 None + OpBranch %223 + %223 = OpLabel + %225 = OpLoad %uint %innerRow_0 + %226 = OpULessThan %bool %225 %171 + %224 = OpLogicalNot %bool %226 + OpSelectionMerge %227 None + OpBranchConditional %224 %228 %227 + %228 = OpLabel + OpBranch %221 + %227 = OpLabel + OpStore %innerCol_0 %105 + OpBranch %230 + %230 = OpLabel + OpLoopMerge %231 %232 None + OpBranch %233 + %233 = OpLabel + %235 = OpLoad %uint %innerCol_0 + %236 = OpULessThan %bool %235 %uint_4 + %234 = OpLogicalNot %bool %236 + OpSelectionMerge %237 None + OpBranchConditional %234 %238 %237 + %238 = OpLabel + OpBranch %231 + %237 = OpLabel + %239 = OpLoad %uint %innerRow_0 + %240 = OpIAdd %uint %173 %239 + %241 = OpLoad %uint %innerCol_0 + %242 = OpIAdd %uint %132 %241 + %244 = OpLoad %uint %t + %245 = OpIMul %uint %244 %uint_64 + %246 = OpIAdd %uint %245 %240 + %247 = OpLoad %uint %innerCol_0 + %248 = OpIAdd %uint %136 %247 + %243 = OpFunctionCall %float %mm_readB %246 %248 + %249 = OpLoad %uint %innerCol_0 + %250 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %249 %242 + OpStore %250 %243 + OpBranch %232 + %232 = OpLabel + %251 = OpLoad %uint %innerCol_0 + %252 = OpIAdd %uint %251 %uint_1 + OpStore %innerCol_0 %252 + OpBranch %230 + %231 = OpLabel + OpBranch %222 + %222 = OpLabel + %253 = OpLoad %uint %innerRow_0 + %254 = OpIAdd %uint %253 %uint_1 + OpStore %innerRow_0 %254 + OpBranch %220 + %221 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %k %105 + OpBranch %257 + %257 = OpLabel + OpLoopMerge %258 %259 None + OpBranch %260 + %260 = OpLabel + %262 = OpLoad %uint %k + %263 = OpULessThan %bool %262 %uint_64 + %261 = OpLogicalNot %bool %263 + OpSelectionMerge %264 None + OpBranchConditional %261 %265 %264 + %265 = OpLabel + OpBranch %258 + %264 = OpLabel + OpStore %inner %105 + OpBranch %267 + %267 = OpLabel + OpLoopMerge %268 %269 None + OpBranch %270 + %270 = OpLabel + %272 = OpLoad %uint %inner + %273 = OpULessThan %bool %272 %uint_4 + %271 = OpLogicalNot %bool %273 + OpSelectionMerge %274 None + OpBranchConditional %271 %275 %274 + %275 = OpLabel + OpBranch %268 + %274 = OpLabel + %276 = OpLoad %uint %inner + %277 = OpAccessChain %_ptr_Function_float %BCached %276 + %278 = OpLoad %uint %k + %279 = OpLoad %uint %inner + %280 = OpIAdd %uint %132 %279 + %281 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %278 %280 + %282 = OpLoad %float %281 + OpStore %277 %282 + OpBranch %269 + %269 = OpLabel + %283 = OpLoad %uint %inner + %284 = OpIAdd %uint %283 %uint_1 + OpStore %inner %284 + OpBranch %267 + %268 = OpLabel + OpStore %innerRow_1 %105 + OpBranch %286 + %286 = OpLabel + OpLoopMerge %287 %288 None + OpBranch %289 + %289 = OpLabel + %291 = OpLoad %uint %innerRow_1 + %292 = OpULessThan %bool %291 %uint_4 + %290 = OpLogicalNot %bool %292 + OpSelectionMerge %293 None + OpBranchConditional %290 %294 %293 + %294 = OpLabel + OpBranch %287 + %293 = OpLabel + %295 = OpLoad %uint %innerRow_1 + %296 = OpIAdd %uint %130 %295 + %297 = OpLoad %uint %k + %298 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %296 %297 + %299 = OpLoad %float %298 + OpStore %ACached %299 + OpStore %innerCol_1 %105 + OpBranch %301 + %301 = OpLabel + OpLoopMerge %302 %303 None + OpBranch %304 + %304 = OpLabel + %306 = OpLoad %uint %innerCol_1 + %307 = OpULessThan %bool %306 %uint_4 + %305 = OpLogicalNot %bool %307 + OpSelectionMerge %308 None + OpBranchConditional %305 %309 %308 + %309 = OpLabel + OpBranch %302 + %308 = OpLabel + %310 = OpLoad %uint %innerRow_1 + %311 = OpIMul %uint %310 %uint_4 + %312 = OpLoad %uint %innerCol_1 + %313 = OpIAdd %uint %311 %312 + %314 = OpAccessChain %_ptr_Function_float %acc %313 + %315 = OpAccessChain %_ptr_Function_float %acc %313 + %316 = OpLoad %float %315 + %317 = OpLoad %float %ACached + %318 = OpLoad %uint %innerCol_1 + %319 = OpAccessChain %_ptr_Function_float %BCached %318 + %320 = OpLoad %float %319 + %321 = OpFMul %float %317 %320 + %322 = OpFAdd %float %316 %321 + OpStore %314 %322 + OpBranch %303 + %303 = OpLabel + %323 = OpLoad %uint %innerCol_1 + %324 = OpIAdd %uint %323 %uint_1 + OpStore %innerCol_1 %324 + OpBranch %301 + %302 = OpLabel + OpBranch %288 + %288 = OpLabel + %325 = OpLoad %uint %innerRow_1 + %326 = OpIAdd %uint %325 %uint_1 + OpStore %innerRow_1 %326 + OpBranch %286 + %287 = OpLabel + OpBranch %259 + %259 = OpLabel + %327 = OpLoad %uint %k + %328 = OpIAdd %uint %327 %uint_1 + OpStore %k %328 + OpBranch %257 + %258 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %177 %177 = OpLabel - OpStore %innerRow_2 %uint_0 - OpBranch %334 - %334 = OpLabel - OpLoopMerge %335 %336 None - OpBranch %337 - %337 = OpLabel - %339 = OpLoad %uint %innerRow_2 - %340 = OpULessThan %bool %339 %RowPerThread - %338 = OpLogicalNot %bool %340 - OpSelectionMerge %341 None - OpBranchConditional %338 %342 %341 - %342 = OpLabel - OpBranch %335 - %341 = OpLabel - OpStore %innerCol_2 %uint_0 - OpBranch %344 - %344 = OpLabel - OpLoopMerge %345 %346 None - OpBranch %347 - %347 = OpLabel - %349 = OpLoad %uint %innerCol_2 - %350 = OpULessThan %bool %349 %RowPerThread - %348 = OpLogicalNot %bool %350 - OpSelectionMerge %351 None - OpBranchConditional %348 %352 %351 - %352 = OpLabel - OpBranch %345 - %351 = OpLabel - %353 = OpLoad %uint %innerRow_2 - %354 = OpIMul %uint %353 %RowPerThread - %355 = OpLoad %uint %innerCol_2 - %356 = OpIAdd %uint %354 %355 - %358 = OpLoad %uint %innerRow_2 - %359 = OpIAdd %uint %135 %358 - %360 = OpLoad %uint %innerCol_2 - %361 = OpIAdd %uint %137 %360 - %362 = OpAccessChain %_ptr_Function_float %acc %356 - %363 = OpLoad %float %362 - %357 = OpFunctionCall %void %mm_write %359 %361 %363 - OpBranch %346 - %346 = OpLabel - %364 = OpLoad %uint %innerCol_2 - %365 = OpIAdd %uint %364 %uint_1 - OpStore %innerCol_2 %365 - OpBranch %344 - %345 = OpLabel + %330 = OpLoad %uint %t + %331 = OpIAdd %uint %330 %uint_1 + OpStore %t %331 + OpBranch %175 + %176 = OpLabel + OpStore %innerRow_2 %105 + OpBranch %333 + %333 = OpLabel + OpLoopMerge %334 %335 None OpBranch %336 %336 = OpLabel - %366 = OpLoad %uint %innerRow_2 - %367 = OpIAdd %uint %366 %uint_1 - OpStore %innerRow_2 %367 + %338 = OpLoad %uint %innerRow_2 + %339 = OpULessThan %bool %338 %uint_4 + %337 = OpLogicalNot %bool %339 + OpSelectionMerge %340 None + OpBranchConditional %337 %341 %340 + %341 = OpLabel OpBranch %334 + %340 = OpLabel + OpStore %innerCol_2 %105 + OpBranch %343 + %343 = OpLabel + OpLoopMerge %344 %345 None + OpBranch %346 + %346 = OpLabel + %348 = OpLoad %uint %innerCol_2 + %349 = OpULessThan %bool %348 %uint_4 + %347 = OpLogicalNot %bool %349 + OpSelectionMerge %350 None + OpBranchConditional %347 %351 %350 + %351 = OpLabel + OpBranch %344 + %350 = OpLabel + %352 = OpLoad %uint %innerRow_2 + %353 = OpIMul %uint %352 %uint_4 + %354 = OpLoad %uint %innerCol_2 + %355 = OpIAdd %uint %353 %354 + %357 = OpLoad %uint %innerRow_2 + %358 = OpIAdd %uint %134 %357 + %359 = OpLoad %uint %innerCol_2 + %360 = OpIAdd %uint %136 %359 + %361 = OpAccessChain %_ptr_Function_float %acc %355 + %362 = OpLoad %float %361 + %356 = OpFunctionCall %void %mm_write %358 %360 %362 + OpBranch %345 + %345 = OpLabel + %363 = OpLoad %uint %innerCol_2 + %364 = OpIAdd %uint %363 %uint_1 + OpStore %innerCol_2 %364 + OpBranch %343 + %344 = OpLabel + OpBranch %335 %335 = OpLabel + %365 = OpLoad %uint %innerRow_2 + %366 = OpIAdd %uint %365 %uint_1 + OpStore %innerRow_2 %366 + OpBranch %333 + %334 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %368 - %370 = OpLabel - %372 = OpLoad %v3uint %local_id_1 - %373 = OpLoad %v3uint %global_id_1 - %374 = OpLoad %uint %local_invocation_index_1 - %371 = OpFunctionCall %void %main_inner %372 %373 %374 + %main = OpFunction %void None %367 + %369 = OpLabel + %371 = OpLoad %v3uint %local_id_1 + %372 = OpLoad %v3uint %global_id_1 + %373 = OpLoad %uint %local_invocation_index_1 + %370 = OpFunctionCall %void %main_inner %371 %372 %373 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/914.wgsl.expected.wgsl b/test/tint/bug/tint/914.wgsl.expected.wgsl index 9c5ad0c378..10301a011e 100644 --- a/test/tint/bug/tint/914.wgsl.expected.wgsl +++ b/test/tint/bug/tint/914.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct Matrix { @group(0) @binding(1) var secondMatrix : Matrix; -@group(0) @binding(2) var resultMatrix : Matrix; +@group(0) @binding(2) var resultMatrix : Matrix; @group(0) @binding(3) var uniforms : Uniforms; @@ -39,21 +39,21 @@ fn mm_write(row : u32, col : u32, value : f32) { } } -let RowPerThread : u32 = 4u; +const RowPerThread : u32 = 4u; -let ColPerThread : u32 = 4u; +const ColPerThread : u32 = 4u; -let TileAOuter : u32 = 64u; +const TileAOuter : u32 = 64u; -let TileBOuter : u32 = 64u; +const TileBOuter : u32 = 64u; -let TileInner : u32 = 64u; +const TileInner : u32 = 64u; var mm_Asub : array, 64>; var mm_Bsub : array, 64>; -@stage(compute) @workgroup_size(16, 16, 1) +@compute @workgroup_size(16, 16, 1) fn main(@builtin(local_invocation_id) local_id : vec3, @builtin(global_invocation_id) global_id : vec3) { let tileRow : u32 = (local_id.y * RowPerThread); let tileCol : u32 = (local_id.x * ColPerThread); diff --git a/test/tint/bug/tint/922.wgsl b/test/tint/bug/tint/922.wgsl index 0e7a0cb112..0d83270095 100644 --- a/test/tint/bug/tint/922.wgsl +++ b/test/tint/bug/tint/922.wgsl @@ -283,7 +283,7 @@ fn main1() { } } -@stage(vertex) +@vertex fn main(@location(0) a_Position: vec3, @location(1) a_UV: vec2, @location(2) a_Color: vec4, @location(3) a_Normal: vec3, @location(4) a_PosMtxIdx: f32) -> VertexOutput { a_Position1 = a_Position; a_UV1 = a_UV; diff --git a/test/tint/bug/tint/922.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/922.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0185faea14 --- /dev/null +++ b/test/tint/bug/tint/922.wgsl.expected.dxc.hlsl @@ -0,0 +1,249 @@ +struct Mat4x4_ { + float4 mx; + float4 my; + float4 mz; + float4 mw; +}; +struct Mat4x3_ { + float4 mx; + float4 my; + float4 mz; +}; +struct Mat4x2_ { + float4 mx; + float4 my; +}; +struct VertexOutput { + float4 v_Color; + float2 v_TexCoord; + float4 member; +}; + +cbuffer cbuffer_global : register(b0, space0) { + uint4 global[4]; +}; +cbuffer cbuffer_global1 : register(b1, space0) { + uint4 global1[3]; +}; +cbuffer cbuffer_global2 : register(b2, space0) { + uint4 global2[96]; +}; +static float3 a_Position1 = float3(0.0f, 0.0f, 0.0f); +static float2 a_UV1 = float2(0.0f, 0.0f); +static float4 a_Color1 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float3 a_Normal1 = float3(0.0f, 0.0f, 0.0f); +static float a_PosMtxIdx1 = 0.0f; +static float4 v_Color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2 v_TexCoord = float2(0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 Mat4x3GetCol0_(Mat4x3_ m) { + Mat4x3_ m1 = (Mat4x3_)0; + m1 = m; + return float3(m1.mx.x, m1.my.x, m1.mz.x); +} + +float3 Mat4x3GetCol1_(Mat4x3_ m2) { + Mat4x3_ m3 = (Mat4x3_)0; + m3 = m2; + return float3(m3.mx.y, m3.my.y, m3.mz.y); +} + +float3 Mat4x3GetCol2_(Mat4x3_ m4) { + Mat4x3_ m5 = (Mat4x3_)0; + m5 = m4; + return float3(m5.mx.z, m5.my.z, m5.mz.z); +} + +float3 Mat4x3GetCol3_(Mat4x3_ m6) { + Mat4x3_ m7 = (Mat4x3_)0; + m7 = m6; + return float3(m7.mx.w, m7.my.w, m7.mz.w); +} + +float4 Mul(Mat4x4_ m8, float4 v) { + Mat4x4_ m9 = (Mat4x4_)0; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + m9 = m8; + v1 = v; + return float4(dot(m9.mx, v1), dot(m9.my, v1), dot(m9.mz, v1), dot(m9.mw, v1)); +} + +float3 Mul1(Mat4x3_ m10, float4 v2) { + Mat4x3_ m11 = (Mat4x3_)0; + float4 v3 = float4(0.0f, 0.0f, 0.0f, 0.0f); + m11 = m10; + v3 = v2; + return float3(dot(m11.mx, v3), dot(m11.my, v3), dot(m11.mz, v3)); +} + +float2 Mul2(Mat4x2_ m12, float4 v4) { + Mat4x2_ m13 = (Mat4x2_)0; + float4 v5 = float4(0.0f, 0.0f, 0.0f, 0.0f); + m13 = m12; + v5 = v4; + return float2(dot(m13.mx, v5), dot(m13.my, v5)); +} + +float4 Mul3(float3 v6, Mat4x3_ m14) { + float3 v7 = float3(0.0f, 0.0f, 0.0f); + Mat4x3_ m15 = (Mat4x3_)0; + v7 = v6; + m15 = m14; + const float3 x_e6 = Mat4x3GetCol0_(m15); + const float3 x_e7 = v7; + const float3 x_e11 = Mat4x3GetCol1_(m15); + const float3 x_e12 = v7; + const float3 x_e16 = Mat4x3GetCol2_(m15); + const float3 x_e17 = v7; + const float3 x_e21 = Mat4x3GetCol3_(m15); + return float4(dot(x_e6, x_e7), dot(x_e11, x_e12), dot(x_e16, x_e17), dot(x_e21, v7)); +} + +Mat4x4_ x_Mat4x4_(float n) { + float n1 = 0.0f; + Mat4x4_ o = (Mat4x4_)0; + n1 = n; + o.mx = float4(n1, 0.0f, 0.0f, 0.0f); + o.my = float4(0.0f, n1, 0.0f, 0.0f); + o.mz = float4(0.0f, 0.0f, n1, 0.0f); + o.mw = float4(0.0f, 0.0f, 0.0f, n1); + return o; +} + +Mat4x4_ x_Mat4x4_1(Mat4x3_ m16) { + Mat4x3_ m17 = (Mat4x3_)0; + Mat4x4_ o1 = (Mat4x4_)0; + m17 = m16; + const Mat4x4_ x_e4 = x_Mat4x4_(1.0f); + o1 = x_e4; + o1.mx = m17.mx; + o1.my = m17.my; + o1.mz = m17.mz; + return o1; +} + +Mat4x4_ x_Mat4x4_2(Mat4x2_ m18) { + Mat4x2_ m19 = (Mat4x2_)0; + Mat4x4_ o2 = (Mat4x4_)0; + m19 = m18; + const Mat4x4_ x_e4 = x_Mat4x4_(1.0f); + o2 = x_e4; + o2.mx = m19.mx; + o2.my = m19.my; + return o2; +} + +Mat4x3_ x_Mat4x3_(float n2) { + float n3 = 0.0f; + Mat4x3_ o3 = (Mat4x3_)0; + n3 = n2; + o3.mx = float4(n3, 0.0f, 0.0f, 0.0f); + o3.my = float4(0.0f, n3, 0.0f, 0.0f); + o3.mz = float4(0.0f, 0.0f, n3, 0.0f); + return o3; +} + +Mat4x3_ x_Mat4x3_1(Mat4x4_ m20) { + Mat4x4_ m21 = (Mat4x4_)0; + Mat4x3_ o4 = (Mat4x3_)0; + m21 = m20; + o4.mx = m21.mx; + o4.my = m21.my; + o4.mz = m21.mz; + return o4; +} + +Mat4x3_ tint_symbol_3(uint4 buffer[96], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + const Mat4x3_ tint_symbol_9 = {asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])}; + return tint_symbol_9; +} + +Mat4x4_ tint_symbol_5(uint4 buffer[4], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 16u)) / 4; + const uint scalar_offset_5 = ((offset + 32u)) / 4; + const uint scalar_offset_6 = ((offset + 48u)) / 4; + const Mat4x4_ tint_symbol_10 = {asfloat(buffer[scalar_offset_3 / 4]), asfloat(buffer[scalar_offset_4 / 4]), asfloat(buffer[scalar_offset_5 / 4]), asfloat(buffer[scalar_offset_6 / 4])}; + return tint_symbol_10; +} + +Mat4x2_ tint_symbol_8(uint4 buffer[3], uint offset) { + const uint scalar_offset_7 = ((offset + 0u)) / 4; + const uint scalar_offset_8 = ((offset + 16u)) / 4; + const Mat4x2_ tint_symbol_11 = {asfloat(buffer[scalar_offset_7 / 4]), asfloat(buffer[scalar_offset_8 / 4])}; + return tint_symbol_11; +} + +void main1() { + Mat4x3_ t_PosMtx = (Mat4x3_)0; + float2 t_TexSpaceCoord = float2(0.0f, 0.0f); + const Mat4x3_ x_e18 = tint_symbol_3(global2, (48u * uint(int(a_PosMtxIdx1)))); + t_PosMtx = x_e18; + const Mat4x4_ x_e24 = x_Mat4x4_1(t_PosMtx); + const float3 x_e25 = a_Position1; + const Mat4x4_ x_e30 = x_Mat4x4_1(t_PosMtx); + const float4 x_e34 = Mul(x_e30, float4(a_Position1, 1.0f)); + const Mat4x4_ x_e35 = tint_symbol_5(global, 0u); + const Mat4x4_ x_e38 = x_Mat4x4_1(t_PosMtx); + const float3 x_e39 = a_Position1; + const Mat4x4_ x_e44 = x_Mat4x4_1(t_PosMtx); + const float4 x_e48 = Mul(x_e44, float4(a_Position1, 1.0f)); + const float4 x_e49 = Mul(x_e35, x_e48); + gl_Position = x_e49; + v_Color = a_Color1; + const float4 x_e52 = asfloat(global1[2]); + if ((x_e52.x == 2.0f)) { + { + const float3 x_e59 = a_Normal1; + const Mat4x2_ x_e64 = tint_symbol_8(global1, 0u); + const float2 x_e68 = Mul2(x_e64, float4(a_Normal1, 1.0f)); + v_TexCoord = x_e68.xy; + return; + } + } else { + { + const float2 x_e73 = a_UV1; + const Mat4x2_ x_e79 = tint_symbol_8(global1, 0u); + const float2 x_e84 = Mul2(x_e79, float4(a_UV1, 1.0f, 1.0f)); + v_TexCoord = x_e84.xy; + return; + } + } +} + +struct tint_symbol_1 { + float3 a_Position : TEXCOORD0; + float2 a_UV : TEXCOORD1; + float4 a_Color : TEXCOORD2; + float3 a_Normal : TEXCOORD3; + float a_PosMtxIdx : TEXCOORD4; +}; +struct tint_symbol_2 { + float4 v_Color : TEXCOORD0; + float2 v_TexCoord : TEXCOORD1; + float4 member : SV_Position; +}; + +VertexOutput main_inner(float3 a_Position, float2 a_UV, float4 a_Color, float3 a_Normal, float a_PosMtxIdx) { + a_Position1 = a_Position; + a_UV1 = a_UV; + a_Color1 = a_Color; + a_Normal1 = a_Normal; + a_PosMtxIdx1 = a_PosMtxIdx; + main1(); + const VertexOutput tint_symbol_12 = {v_Color, v_TexCoord, gl_Position}; + return tint_symbol_12; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexOutput inner_result = main_inner(tint_symbol.a_Position, tint_symbol.a_UV, tint_symbol.a_Color, tint_symbol.a_Normal, tint_symbol.a_PosMtxIdx); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.v_Color = inner_result.v_Color; + wrapper_result.v_TexCoord = inner_result.v_TexCoord; + wrapper_result.member = inner_result.member; + return wrapper_result; +} diff --git a/test/tint/bug/tint/922.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/922.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0185faea14 --- /dev/null +++ b/test/tint/bug/tint/922.wgsl.expected.fxc.hlsl @@ -0,0 +1,249 @@ +struct Mat4x4_ { + float4 mx; + float4 my; + float4 mz; + float4 mw; +}; +struct Mat4x3_ { + float4 mx; + float4 my; + float4 mz; +}; +struct Mat4x2_ { + float4 mx; + float4 my; +}; +struct VertexOutput { + float4 v_Color; + float2 v_TexCoord; + float4 member; +}; + +cbuffer cbuffer_global : register(b0, space0) { + uint4 global[4]; +}; +cbuffer cbuffer_global1 : register(b1, space0) { + uint4 global1[3]; +}; +cbuffer cbuffer_global2 : register(b2, space0) { + uint4 global2[96]; +}; +static float3 a_Position1 = float3(0.0f, 0.0f, 0.0f); +static float2 a_UV1 = float2(0.0f, 0.0f); +static float4 a_Color1 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float3 a_Normal1 = float3(0.0f, 0.0f, 0.0f); +static float a_PosMtxIdx1 = 0.0f; +static float4 v_Color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2 v_TexCoord = float2(0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 Mat4x3GetCol0_(Mat4x3_ m) { + Mat4x3_ m1 = (Mat4x3_)0; + m1 = m; + return float3(m1.mx.x, m1.my.x, m1.mz.x); +} + +float3 Mat4x3GetCol1_(Mat4x3_ m2) { + Mat4x3_ m3 = (Mat4x3_)0; + m3 = m2; + return float3(m3.mx.y, m3.my.y, m3.mz.y); +} + +float3 Mat4x3GetCol2_(Mat4x3_ m4) { + Mat4x3_ m5 = (Mat4x3_)0; + m5 = m4; + return float3(m5.mx.z, m5.my.z, m5.mz.z); +} + +float3 Mat4x3GetCol3_(Mat4x3_ m6) { + Mat4x3_ m7 = (Mat4x3_)0; + m7 = m6; + return float3(m7.mx.w, m7.my.w, m7.mz.w); +} + +float4 Mul(Mat4x4_ m8, float4 v) { + Mat4x4_ m9 = (Mat4x4_)0; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + m9 = m8; + v1 = v; + return float4(dot(m9.mx, v1), dot(m9.my, v1), dot(m9.mz, v1), dot(m9.mw, v1)); +} + +float3 Mul1(Mat4x3_ m10, float4 v2) { + Mat4x3_ m11 = (Mat4x3_)0; + float4 v3 = float4(0.0f, 0.0f, 0.0f, 0.0f); + m11 = m10; + v3 = v2; + return float3(dot(m11.mx, v3), dot(m11.my, v3), dot(m11.mz, v3)); +} + +float2 Mul2(Mat4x2_ m12, float4 v4) { + Mat4x2_ m13 = (Mat4x2_)0; + float4 v5 = float4(0.0f, 0.0f, 0.0f, 0.0f); + m13 = m12; + v5 = v4; + return float2(dot(m13.mx, v5), dot(m13.my, v5)); +} + +float4 Mul3(float3 v6, Mat4x3_ m14) { + float3 v7 = float3(0.0f, 0.0f, 0.0f); + Mat4x3_ m15 = (Mat4x3_)0; + v7 = v6; + m15 = m14; + const float3 x_e6 = Mat4x3GetCol0_(m15); + const float3 x_e7 = v7; + const float3 x_e11 = Mat4x3GetCol1_(m15); + const float3 x_e12 = v7; + const float3 x_e16 = Mat4x3GetCol2_(m15); + const float3 x_e17 = v7; + const float3 x_e21 = Mat4x3GetCol3_(m15); + return float4(dot(x_e6, x_e7), dot(x_e11, x_e12), dot(x_e16, x_e17), dot(x_e21, v7)); +} + +Mat4x4_ x_Mat4x4_(float n) { + float n1 = 0.0f; + Mat4x4_ o = (Mat4x4_)0; + n1 = n; + o.mx = float4(n1, 0.0f, 0.0f, 0.0f); + o.my = float4(0.0f, n1, 0.0f, 0.0f); + o.mz = float4(0.0f, 0.0f, n1, 0.0f); + o.mw = float4(0.0f, 0.0f, 0.0f, n1); + return o; +} + +Mat4x4_ x_Mat4x4_1(Mat4x3_ m16) { + Mat4x3_ m17 = (Mat4x3_)0; + Mat4x4_ o1 = (Mat4x4_)0; + m17 = m16; + const Mat4x4_ x_e4 = x_Mat4x4_(1.0f); + o1 = x_e4; + o1.mx = m17.mx; + o1.my = m17.my; + o1.mz = m17.mz; + return o1; +} + +Mat4x4_ x_Mat4x4_2(Mat4x2_ m18) { + Mat4x2_ m19 = (Mat4x2_)0; + Mat4x4_ o2 = (Mat4x4_)0; + m19 = m18; + const Mat4x4_ x_e4 = x_Mat4x4_(1.0f); + o2 = x_e4; + o2.mx = m19.mx; + o2.my = m19.my; + return o2; +} + +Mat4x3_ x_Mat4x3_(float n2) { + float n3 = 0.0f; + Mat4x3_ o3 = (Mat4x3_)0; + n3 = n2; + o3.mx = float4(n3, 0.0f, 0.0f, 0.0f); + o3.my = float4(0.0f, n3, 0.0f, 0.0f); + o3.mz = float4(0.0f, 0.0f, n3, 0.0f); + return o3; +} + +Mat4x3_ x_Mat4x3_1(Mat4x4_ m20) { + Mat4x4_ m21 = (Mat4x4_)0; + Mat4x3_ o4 = (Mat4x3_)0; + m21 = m20; + o4.mx = m21.mx; + o4.my = m21.my; + o4.mz = m21.mz; + return o4; +} + +Mat4x3_ tint_symbol_3(uint4 buffer[96], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + const Mat4x3_ tint_symbol_9 = {asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])}; + return tint_symbol_9; +} + +Mat4x4_ tint_symbol_5(uint4 buffer[4], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 16u)) / 4; + const uint scalar_offset_5 = ((offset + 32u)) / 4; + const uint scalar_offset_6 = ((offset + 48u)) / 4; + const Mat4x4_ tint_symbol_10 = {asfloat(buffer[scalar_offset_3 / 4]), asfloat(buffer[scalar_offset_4 / 4]), asfloat(buffer[scalar_offset_5 / 4]), asfloat(buffer[scalar_offset_6 / 4])}; + return tint_symbol_10; +} + +Mat4x2_ tint_symbol_8(uint4 buffer[3], uint offset) { + const uint scalar_offset_7 = ((offset + 0u)) / 4; + const uint scalar_offset_8 = ((offset + 16u)) / 4; + const Mat4x2_ tint_symbol_11 = {asfloat(buffer[scalar_offset_7 / 4]), asfloat(buffer[scalar_offset_8 / 4])}; + return tint_symbol_11; +} + +void main1() { + Mat4x3_ t_PosMtx = (Mat4x3_)0; + float2 t_TexSpaceCoord = float2(0.0f, 0.0f); + const Mat4x3_ x_e18 = tint_symbol_3(global2, (48u * uint(int(a_PosMtxIdx1)))); + t_PosMtx = x_e18; + const Mat4x4_ x_e24 = x_Mat4x4_1(t_PosMtx); + const float3 x_e25 = a_Position1; + const Mat4x4_ x_e30 = x_Mat4x4_1(t_PosMtx); + const float4 x_e34 = Mul(x_e30, float4(a_Position1, 1.0f)); + const Mat4x4_ x_e35 = tint_symbol_5(global, 0u); + const Mat4x4_ x_e38 = x_Mat4x4_1(t_PosMtx); + const float3 x_e39 = a_Position1; + const Mat4x4_ x_e44 = x_Mat4x4_1(t_PosMtx); + const float4 x_e48 = Mul(x_e44, float4(a_Position1, 1.0f)); + const float4 x_e49 = Mul(x_e35, x_e48); + gl_Position = x_e49; + v_Color = a_Color1; + const float4 x_e52 = asfloat(global1[2]); + if ((x_e52.x == 2.0f)) { + { + const float3 x_e59 = a_Normal1; + const Mat4x2_ x_e64 = tint_symbol_8(global1, 0u); + const float2 x_e68 = Mul2(x_e64, float4(a_Normal1, 1.0f)); + v_TexCoord = x_e68.xy; + return; + } + } else { + { + const float2 x_e73 = a_UV1; + const Mat4x2_ x_e79 = tint_symbol_8(global1, 0u); + const float2 x_e84 = Mul2(x_e79, float4(a_UV1, 1.0f, 1.0f)); + v_TexCoord = x_e84.xy; + return; + } + } +} + +struct tint_symbol_1 { + float3 a_Position : TEXCOORD0; + float2 a_UV : TEXCOORD1; + float4 a_Color : TEXCOORD2; + float3 a_Normal : TEXCOORD3; + float a_PosMtxIdx : TEXCOORD4; +}; +struct tint_symbol_2 { + float4 v_Color : TEXCOORD0; + float2 v_TexCoord : TEXCOORD1; + float4 member : SV_Position; +}; + +VertexOutput main_inner(float3 a_Position, float2 a_UV, float4 a_Color, float3 a_Normal, float a_PosMtxIdx) { + a_Position1 = a_Position; + a_UV1 = a_UV; + a_Color1 = a_Color; + a_Normal1 = a_Normal; + a_PosMtxIdx1 = a_PosMtxIdx; + main1(); + const VertexOutput tint_symbol_12 = {v_Color, v_TexCoord, gl_Position}; + return tint_symbol_12; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexOutput inner_result = main_inner(tint_symbol.a_Position, tint_symbol.a_UV, tint_symbol.a_Color, tint_symbol.a_Normal, tint_symbol.a_PosMtxIdx); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.v_Color = inner_result.v_Color; + wrapper_result.v_TexCoord = inner_result.v_TexCoord; + wrapper_result.member = inner_result.member; + return wrapper_result; +} diff --git a/test/tint/bug/tint/922.wgsl.expected.hlsl b/test/tint/bug/tint/922.wgsl.expected.hlsl deleted file mode 100644 index 70437678d2..0000000000 --- a/test/tint/bug/tint/922.wgsl.expected.hlsl +++ /dev/null @@ -1,249 +0,0 @@ -struct Mat4x4_ { - float4 mx; - float4 my; - float4 mz; - float4 mw; -}; -struct Mat4x3_ { - float4 mx; - float4 my; - float4 mz; -}; -struct Mat4x2_ { - float4 mx; - float4 my; -}; -struct VertexOutput { - float4 v_Color; - float2 v_TexCoord; - float4 member; -}; - -cbuffer cbuffer_global : register(b0, space0) { - uint4 global[4]; -}; -cbuffer cbuffer_global1 : register(b1, space0) { - uint4 global1[3]; -}; -cbuffer cbuffer_global2 : register(b2, space0) { - uint4 global2[96]; -}; -static float3 a_Position1 = float3(0.0f, 0.0f, 0.0f); -static float2 a_UV1 = float2(0.0f, 0.0f); -static float4 a_Color1 = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float3 a_Normal1 = float3(0.0f, 0.0f, 0.0f); -static float a_PosMtxIdx1 = 0.0f; -static float4 v_Color = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float2 v_TexCoord = float2(0.0f, 0.0f); -static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); - -float3 Mat4x3GetCol0_(Mat4x3_ m) { - Mat4x3_ m1 = (Mat4x3_)0; - m1 = m; - return float3(m1.mx.x, m1.my.x, m1.mz.x); -} - -float3 Mat4x3GetCol1_(Mat4x3_ m2) { - Mat4x3_ m3 = (Mat4x3_)0; - m3 = m2; - return float3(m3.mx.y, m3.my.y, m3.mz.y); -} - -float3 Mat4x3GetCol2_(Mat4x3_ m4) { - Mat4x3_ m5 = (Mat4x3_)0; - m5 = m4; - return float3(m5.mx.z, m5.my.z, m5.mz.z); -} - -float3 Mat4x3GetCol3_(Mat4x3_ m6) { - Mat4x3_ m7 = (Mat4x3_)0; - m7 = m6; - return float3(m7.mx.w, m7.my.w, m7.mz.w); -} - -float4 Mul(Mat4x4_ m8, float4 v) { - Mat4x4_ m9 = (Mat4x4_)0; - float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); - m9 = m8; - v1 = v; - return float4(dot(m9.mx, v1), dot(m9.my, v1), dot(m9.mz, v1), dot(m9.mw, v1)); -} - -float3 Mul1(Mat4x3_ m10, float4 v2) { - Mat4x3_ m11 = (Mat4x3_)0; - float4 v3 = float4(0.0f, 0.0f, 0.0f, 0.0f); - m11 = m10; - v3 = v2; - return float3(dot(m11.mx, v3), dot(m11.my, v3), dot(m11.mz, v3)); -} - -float2 Mul2(Mat4x2_ m12, float4 v4) { - Mat4x2_ m13 = (Mat4x2_)0; - float4 v5 = float4(0.0f, 0.0f, 0.0f, 0.0f); - m13 = m12; - v5 = v4; - return float2(dot(m13.mx, v5), dot(m13.my, v5)); -} - -float4 Mul3(float3 v6, Mat4x3_ m14) { - float3 v7 = float3(0.0f, 0.0f, 0.0f); - Mat4x3_ m15 = (Mat4x3_)0; - v7 = v6; - m15 = m14; - const float3 x_e6 = Mat4x3GetCol0_(m15); - const float3 x_e7 = v7; - const float3 x_e11 = Mat4x3GetCol1_(m15); - const float3 x_e12 = v7; - const float3 x_e16 = Mat4x3GetCol2_(m15); - const float3 x_e17 = v7; - const float3 x_e21 = Mat4x3GetCol3_(m15); - return float4(dot(x_e6, x_e7), dot(x_e11, x_e12), dot(x_e16, x_e17), dot(x_e21, v7)); -} - -Mat4x4_ x_Mat4x4_(float n) { - float n1 = 0.0f; - Mat4x4_ o = (Mat4x4_)0; - n1 = n; - o.mx = float4(n1, 0.0f, 0.0f, 0.0f); - o.my = float4(0.0f, n1, 0.0f, 0.0f); - o.mz = float4(0.0f, 0.0f, n1, 0.0f); - o.mw = float4(0.0f, 0.0f, 0.0f, n1); - return o; -} - -Mat4x4_ x_Mat4x4_1(Mat4x3_ m16) { - Mat4x3_ m17 = (Mat4x3_)0; - Mat4x4_ o1 = (Mat4x4_)0; - m17 = m16; - const Mat4x4_ x_e4 = x_Mat4x4_(1.0f); - o1 = x_e4; - o1.mx = m17.mx; - o1.my = m17.my; - o1.mz = m17.mz; - return o1; -} - -Mat4x4_ x_Mat4x4_2(Mat4x2_ m18) { - Mat4x2_ m19 = (Mat4x2_)0; - Mat4x4_ o2 = (Mat4x4_)0; - m19 = m18; - const Mat4x4_ x_e4 = x_Mat4x4_(1.0f); - o2 = x_e4; - o2.mx = m19.mx; - o2.my = m19.my; - return o2; -} - -Mat4x3_ x_Mat4x3_(float n2) { - float n3 = 0.0f; - Mat4x3_ o3 = (Mat4x3_)0; - n3 = n2; - o3.mx = float4(n3, 0.0f, 0.0f, 0.0f); - o3.my = float4(0.0f, n3, 0.0f, 0.0f); - o3.mz = float4(0.0f, 0.0f, n3, 0.0f); - return o3; -} - -Mat4x3_ x_Mat4x3_1(Mat4x4_ m20) { - Mat4x4_ m21 = (Mat4x4_)0; - Mat4x3_ o4 = (Mat4x3_)0; - m21 = m20; - o4.mx = m21.mx; - o4.my = m21.my; - o4.mz = m21.mz; - return o4; -} - -Mat4x3_ tint_symbol_3(uint4 buffer[96], uint offset) { - const uint scalar_offset = ((offset + 0u)) / 4; - const uint scalar_offset_1 = ((offset + 16u)) / 4; - const uint scalar_offset_2 = ((offset + 32u)) / 4; - const Mat4x3_ tint_symbol_9 = {asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])}; - return tint_symbol_9; -} - -Mat4x4_ tint_symbol_5(uint4 buffer[4], uint offset) { - const uint scalar_offset_3 = ((offset + 0u)) / 4; - const uint scalar_offset_4 = ((offset + 16u)) / 4; - const uint scalar_offset_5 = ((offset + 32u)) / 4; - const uint scalar_offset_6 = ((offset + 48u)) / 4; - const Mat4x4_ tint_symbol_10 = {asfloat(buffer[scalar_offset_3 / 4]), asfloat(buffer[scalar_offset_4 / 4]), asfloat(buffer[scalar_offset_5 / 4]), asfloat(buffer[scalar_offset_6 / 4])}; - return tint_symbol_10; -} - -Mat4x2_ tint_symbol_8(uint4 buffer[3], uint offset) { - const uint scalar_offset_7 = ((offset + 0u)) / 4; - const uint scalar_offset_8 = ((offset + 16u)) / 4; - const Mat4x2_ tint_symbol_11 = {asfloat(buffer[scalar_offset_7 / 4]), asfloat(buffer[scalar_offset_8 / 4])}; - return tint_symbol_11; -} - -void main1() { - Mat4x3_ t_PosMtx = (Mat4x3_)0; - float2 t_TexSpaceCoord = float2(0.0f, 0.0f); - const Mat4x3_ x_e18 = tint_symbol_3(global2, (48u * uint(int(a_PosMtxIdx1)))); - t_PosMtx = x_e18; - const Mat4x4_ x_e24 = x_Mat4x4_1(t_PosMtx); - const float3 x_e25 = a_Position1; - const Mat4x4_ x_e30 = x_Mat4x4_1(t_PosMtx); - const float4 x_e34 = Mul(x_e30, float4(a_Position1, 1.0f)); - const Mat4x4_ x_e35 = tint_symbol_5(global, 0u); - const Mat4x4_ x_e38 = x_Mat4x4_1(t_PosMtx); - const float3 x_e39 = a_Position1; - const Mat4x4_ x_e44 = x_Mat4x4_1(t_PosMtx); - const float4 x_e48 = Mul(x_e44, float4(a_Position1, 1.0f)); - const float4 x_e49 = Mul(x_e35, x_e48); - gl_Position = x_e49; - v_Color = a_Color1; - const float4 x_e52 = asfloat(global1[2]); - if ((x_e52.x == 2.0f)) { - { - const float3 x_e59 = a_Normal1; - const Mat4x2_ x_e64 = tint_symbol_8(global1, (32u * uint(0))); - const float2 x_e68 = Mul2(x_e64, float4(a_Normal1, 1.0f)); - v_TexCoord = x_e68.xy; - return; - } - } else { - { - const float2 x_e73 = a_UV1; - const Mat4x2_ x_e79 = tint_symbol_8(global1, (32u * uint(0))); - const float2 x_e84 = Mul2(x_e79, float4(a_UV1, 1.0f, 1.0f)); - v_TexCoord = x_e84.xy; - return; - } - } -} - -struct tint_symbol_1 { - float3 a_Position : TEXCOORD0; - float2 a_UV : TEXCOORD1; - float4 a_Color : TEXCOORD2; - float3 a_Normal : TEXCOORD3; - float a_PosMtxIdx : TEXCOORD4; -}; -struct tint_symbol_2 { - float4 v_Color : TEXCOORD0; - float2 v_TexCoord : TEXCOORD1; - float4 member : SV_Position; -}; - -VertexOutput main_inner(float3 a_Position, float2 a_UV, float4 a_Color, float3 a_Normal, float a_PosMtxIdx) { - a_Position1 = a_Position; - a_UV1 = a_UV; - a_Color1 = a_Color; - a_Normal1 = a_Normal; - a_PosMtxIdx1 = a_PosMtxIdx; - main1(); - const VertexOutput tint_symbol_12 = {v_Color, v_TexCoord, gl_Position}; - return tint_symbol_12; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const VertexOutput inner_result = main_inner(tint_symbol.a_Position, tint_symbol.a_UV, tint_symbol.a_Color, tint_symbol.a_Normal, tint_symbol.a_PosMtxIdx); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.v_Color = inner_result.v_Color; - wrapper_result.v_TexCoord = inner_result.v_TexCoord; - wrapper_result.member = inner_result.member; - return wrapper_result; -} diff --git a/test/tint/bug/tint/922.wgsl.expected.msl b/test/tint/bug/tint/922.wgsl.expected.msl index 584f9e45a0..56d2fe7c07 100644 --- a/test/tint/bug/tint/922.wgsl.expected.msl +++ b/test/tint/bug/tint/922.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Mat4x4_ { /* 0x0000 */ float4 mx; /* 0x0010 */ float4 my; @@ -23,21 +36,13 @@ struct ub_SceneParams { /* 0x0000 */ Mat4x4_ u_Projection; }; -struct tint_array_wrapper { - /* 0x0000 */ Mat4x2_ arr[1]; -}; - struct ub_MaterialParams { - /* 0x0000 */ tint_array_wrapper u_TexMtx; + /* 0x0000 */ tint_array u_TexMtx; /* 0x0020 */ float4 u_Misc0_; }; -struct tint_array_wrapper_1 { - /* 0x0000 */ Mat4x3_ arr[32]; -}; - struct ub_PacketParams { - /* 0x0000 */ tint_array_wrapper_1 u_PosMtx; + /* 0x0000 */ tint_array u_PosMtx; }; struct VertexOutput { @@ -222,7 +227,7 @@ void main1(thread float* const tint_symbol_5, const constant ub_PacketParams* co Mat4x3_ t_PosMtx = {}; float2 t_TexSpaceCoord = 0.0f; float const x_e15 = *(tint_symbol_5); - Mat4x3_ const x_e18 = (*(tint_symbol_6)).u_PosMtx.arr[int(x_e15)]; + Mat4x3_ const x_e18 = (*(tint_symbol_6)).u_PosMtx[int(x_e15)]; t_PosMtx = x_e18; Mat4x3_ const x_e23 = t_PosMtx; Mat4x4_ const x_e24 = x_Mat4x4_1(x_e23); @@ -247,7 +252,7 @@ void main1(thread float* const tint_symbol_5, const constant ub_PacketParams* co if ((x_e52[0] == 2.0f)) { { float3 const x_e59 = *(tint_symbol_13); - Mat4x2_ const x_e64 = (*(tint_symbol_12)).u_TexMtx.arr[0]; + Mat4x2_ const x_e64 = (*(tint_symbol_12)).u_TexMtx[0]; float3 const x_e65 = *(tint_symbol_13); float2 const x_e68 = Mul2(x_e64, float4(x_e65, 1.0f)); *(tint_symbol_14) = float2(x_e68).xy; @@ -256,7 +261,7 @@ void main1(thread float* const tint_symbol_5, const constant ub_PacketParams* co } else { { float2 const x_e73 = *(tint_symbol_15); - Mat4x2_ const x_e79 = (*(tint_symbol_12)).u_TexMtx.arr[0]; + Mat4x2_ const x_e79 = (*(tint_symbol_12)).u_TexMtx[0]; float2 const x_e80 = *(tint_symbol_15); float2 const x_e84 = Mul2(x_e79, float4(x_e80, 1.0f, 1.0f)); *(tint_symbol_14) = float2(x_e84).xy; diff --git a/test/tint/bug/tint/922.wgsl.expected.spvasm b/test/tint/bug/tint/922.wgsl.expected.spvasm index bc29396019..a831e50872 100644 --- a/test/tint/bug/tint/922.wgsl.expected.spvasm +++ b/test/tint/bug/tint/922.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 387 +; Bound: 386 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -219,16 +219,15 @@ %203 = OpTypeFunction %Mat4x4_ %float %_ptr_Function_float = OpTypePointer Function %float %uint_0 = OpConstant %uint 0 - %float_0 = OpConstant %float 0 %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 - %227 = OpTypeFunction %Mat4x4_ %Mat4x3_ + %226 = OpTypeFunction %Mat4x4_ %Mat4x3_ %float_1 = OpConstant %float 1 - %245 = OpTypeFunction %Mat4x4_ %Mat4x2_ - %259 = OpTypeFunction %Mat4x3_ %float - %275 = OpTypeFunction %Mat4x3_ %Mat4x4_ + %244 = OpTypeFunction %Mat4x4_ %Mat4x2_ + %258 = OpTypeFunction %Mat4x3_ %float + %274 = OpTypeFunction %Mat4x3_ %Mat4x4_ %void = OpTypeVoid - %291 = OpTypeFunction %void + %290 = OpTypeFunction %void %_ptr_Function_v2float = OpTypePointer Function %v2float %int = OpTypeInt 32 1 %_ptr_Uniform_Mat4x3_ = OpTypePointer Uniform %Mat4x3_ @@ -236,10 +235,10 @@ %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %float_2 = OpConstant %float 2 %bool = OpTypeBool - %int_0 = OpConstant %int 0 + %341 = OpConstantNull %int %_ptr_Uniform_Mat4x2_ = OpTypePointer Uniform %Mat4x2_ %VertexOutput = OpTypeStruct %v4float %v2float %v4float - %362 = OpTypeFunction %VertexOutput %v3float %v2float %v4float %v3float %float + %361 = OpTypeFunction %VertexOutput %v3float %v2float %v4float %v3float %float %Mat4x3GetCol0_ = OpFunction %v3float None %54 %m = OpFunctionParameter %Mat4x3_ %57 = OpLabel @@ -412,211 +411,211 @@ OpStore %n1 %n %210 = OpLoad %float %n1 %212 = OpAccessChain %_ptr_Function_v4float %o %uint_0 - %214 = OpCompositeConstruct %v4float %210 %float_0 %float_0 %float_0 - OpStore %212 %214 - %215 = OpLoad %float %n1 - %216 = OpAccessChain %_ptr_Function_v4float %o %uint_1 - %217 = OpCompositeConstruct %v4float %float_0 %215 %float_0 %float_0 - OpStore %216 %217 - %218 = OpLoad %float %n1 - %220 = OpAccessChain %_ptr_Function_v4float %o %uint_2 - %221 = OpCompositeConstruct %v4float %float_0 %float_0 %218 %float_0 - OpStore %220 %221 - %222 = OpLoad %float %n1 - %224 = OpAccessChain %_ptr_Function_v4float %o %uint_3 - %225 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %222 - OpStore %224 %225 - %226 = OpLoad %Mat4x4_ %o - OpReturnValue %226 + %213 = OpCompositeConstruct %v4float %210 %23 %23 %23 + OpStore %212 %213 + %214 = OpLoad %float %n1 + %215 = OpAccessChain %_ptr_Function_v4float %o %uint_1 + %216 = OpCompositeConstruct %v4float %23 %214 %23 %23 + OpStore %215 %216 + %217 = OpLoad %float %n1 + %219 = OpAccessChain %_ptr_Function_v4float %o %uint_2 + %220 = OpCompositeConstruct %v4float %23 %23 %217 %23 + OpStore %219 %220 + %221 = OpLoad %float %n1 + %223 = OpAccessChain %_ptr_Function_v4float %o %uint_3 + %224 = OpCompositeConstruct %v4float %23 %23 %23 %221 + OpStore %223 %224 + %225 = OpLoad %Mat4x4_ %o + OpReturnValue %225 OpFunctionEnd - %x_Mat4x4_1 = OpFunction %Mat4x4_ None %227 + %x_Mat4x4_1 = OpFunction %Mat4x4_ None %226 %m16 = OpFunctionParameter %Mat4x3_ - %230 = OpLabel + %229 = OpLabel %m17 = OpVariable %_ptr_Function_Mat4x3_ Function %60 %o1 = OpVariable %_ptr_Function_Mat4x4_ Function %120 OpStore %m17 %m16 - %233 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1 - OpStore %o1 %233 - %235 = OpLoad %Mat4x3_ %m17 - %236 = OpAccessChain %_ptr_Function_v4float %o1 %uint_0 - %237 = OpCompositeExtract %v4float %235 0 - OpStore %236 %237 - %238 = OpLoad %Mat4x3_ %m17 - %239 = OpAccessChain %_ptr_Function_v4float %o1 %uint_1 - %240 = OpCompositeExtract %v4float %238 1 - OpStore %239 %240 - %241 = OpLoad %Mat4x3_ %m17 - %242 = OpAccessChain %_ptr_Function_v4float %o1 %uint_2 - %243 = OpCompositeExtract %v4float %241 2 - OpStore %242 %243 - %244 = OpLoad %Mat4x4_ %o1 - OpReturnValue %244 + %232 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1 + OpStore %o1 %232 + %234 = OpLoad %Mat4x3_ %m17 + %235 = OpAccessChain %_ptr_Function_v4float %o1 %uint_0 + %236 = OpCompositeExtract %v4float %234 0 + OpStore %235 %236 + %237 = OpLoad %Mat4x3_ %m17 + %238 = OpAccessChain %_ptr_Function_v4float %o1 %uint_1 + %239 = OpCompositeExtract %v4float %237 1 + OpStore %238 %239 + %240 = OpLoad %Mat4x3_ %m17 + %241 = OpAccessChain %_ptr_Function_v4float %o1 %uint_2 + %242 = OpCompositeExtract %v4float %240 2 + OpStore %241 %242 + %243 = OpLoad %Mat4x4_ %o1 + OpReturnValue %243 OpFunctionEnd - %x_Mat4x4_2 = OpFunction %Mat4x4_ None %245 + %x_Mat4x4_2 = OpFunction %Mat4x4_ None %244 %m18 = OpFunctionParameter %Mat4x2_ - %248 = OpLabel + %247 = OpLabel %m19 = OpVariable %_ptr_Function_Mat4x2_ Function %167 %o2 = OpVariable %_ptr_Function_Mat4x4_ Function %120 OpStore %m19 %m18 - %251 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1 - OpStore %o2 %251 - %252 = OpLoad %Mat4x2_ %m19 - %253 = OpAccessChain %_ptr_Function_v4float %o2 %uint_0 - %254 = OpCompositeExtract %v4float %252 0 - OpStore %253 %254 - %255 = OpLoad %Mat4x2_ %m19 - %256 = OpAccessChain %_ptr_Function_v4float %o2 %uint_1 - %257 = OpCompositeExtract %v4float %255 1 - OpStore %256 %257 - %258 = OpLoad %Mat4x4_ %o2 - OpReturnValue %258 + %250 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1 + OpStore %o2 %250 + %251 = OpLoad %Mat4x2_ %m19 + %252 = OpAccessChain %_ptr_Function_v4float %o2 %uint_0 + %253 = OpCompositeExtract %v4float %251 0 + OpStore %252 %253 + %254 = OpLoad %Mat4x2_ %m19 + %255 = OpAccessChain %_ptr_Function_v4float %o2 %uint_1 + %256 = OpCompositeExtract %v4float %254 1 + OpStore %255 %256 + %257 = OpLoad %Mat4x4_ %o2 + OpReturnValue %257 OpFunctionEnd - %x_Mat4x3_ = OpFunction %Mat4x3_ None %259 + %x_Mat4x3_ = OpFunction %Mat4x3_ None %258 %n2 = OpFunctionParameter %float - %262 = OpLabel + %261 = OpLabel %n3 = OpVariable %_ptr_Function_float Function %23 %o3 = OpVariable %_ptr_Function_Mat4x3_ Function %60 OpStore %n3 %n2 - %265 = OpLoad %float %n3 - %266 = OpAccessChain %_ptr_Function_v4float %o3 %uint_0 - %267 = OpCompositeConstruct %v4float %265 %float_0 %float_0 %float_0 - OpStore %266 %267 - %268 = OpLoad %float %n3 - %269 = OpAccessChain %_ptr_Function_v4float %o3 %uint_1 - %270 = OpCompositeConstruct %v4float %float_0 %268 %float_0 %float_0 - OpStore %269 %270 - %271 = OpLoad %float %n3 - %272 = OpAccessChain %_ptr_Function_v4float %o3 %uint_2 - %273 = OpCompositeConstruct %v4float %float_0 %float_0 %271 %float_0 - OpStore %272 %273 - %274 = OpLoad %Mat4x3_ %o3 - OpReturnValue %274 + %264 = OpLoad %float %n3 + %265 = OpAccessChain %_ptr_Function_v4float %o3 %uint_0 + %266 = OpCompositeConstruct %v4float %264 %23 %23 %23 + OpStore %265 %266 + %267 = OpLoad %float %n3 + %268 = OpAccessChain %_ptr_Function_v4float %o3 %uint_1 + %269 = OpCompositeConstruct %v4float %23 %267 %23 %23 + OpStore %268 %269 + %270 = OpLoad %float %n3 + %271 = OpAccessChain %_ptr_Function_v4float %o3 %uint_2 + %272 = OpCompositeConstruct %v4float %23 %23 %270 %23 + OpStore %271 %272 + %273 = OpLoad %Mat4x3_ %o3 + OpReturnValue %273 OpFunctionEnd - %x_Mat4x3_1 = OpFunction %Mat4x3_ None %275 + %x_Mat4x3_1 = OpFunction %Mat4x3_ None %274 %m20 = OpFunctionParameter %Mat4x4_ - %278 = OpLabel + %277 = OpLabel %m21 = OpVariable %_ptr_Function_Mat4x4_ Function %120 %o4 = OpVariable %_ptr_Function_Mat4x3_ Function %60 OpStore %m21 %m20 - %281 = OpLoad %Mat4x4_ %m21 - %282 = OpAccessChain %_ptr_Function_v4float %o4 %uint_0 - %283 = OpCompositeExtract %v4float %281 0 - OpStore %282 %283 - %284 = OpLoad %Mat4x4_ %m21 - %285 = OpAccessChain %_ptr_Function_v4float %o4 %uint_1 - %286 = OpCompositeExtract %v4float %284 1 - OpStore %285 %286 - %287 = OpLoad %Mat4x4_ %m21 - %288 = OpAccessChain %_ptr_Function_v4float %o4 %uint_2 - %289 = OpCompositeExtract %v4float %287 2 - OpStore %288 %289 - %290 = OpLoad %Mat4x3_ %o4 - OpReturnValue %290 + %280 = OpLoad %Mat4x4_ %m21 + %281 = OpAccessChain %_ptr_Function_v4float %o4 %uint_0 + %282 = OpCompositeExtract %v4float %280 0 + OpStore %281 %282 + %283 = OpLoad %Mat4x4_ %m21 + %284 = OpAccessChain %_ptr_Function_v4float %o4 %uint_1 + %285 = OpCompositeExtract %v4float %283 1 + OpStore %284 %285 + %286 = OpLoad %Mat4x4_ %m21 + %287 = OpAccessChain %_ptr_Function_v4float %o4 %uint_2 + %288 = OpCompositeExtract %v4float %286 2 + OpStore %287 %288 + %289 = OpLoad %Mat4x3_ %o4 + OpReturnValue %289 OpFunctionEnd - %main1 = OpFunction %void None %291 - %294 = OpLabel + %main1 = OpFunction %void None %290 + %293 = OpLabel %t_PosMtx = OpVariable %_ptr_Function_Mat4x3_ Function %60 %t_TexSpaceCoord = OpVariable %_ptr_Function_v2float Function %19 - %298 = OpLoad %float %a_PosMtxIdx1 - %299 = OpConvertFToS %int %298 - %302 = OpAccessChain %_ptr_Uniform_Mat4x3_ %global2 %uint_0 %299 - %303 = OpLoad %Mat4x3_ %302 - OpStore %t_PosMtx %303 - %304 = OpLoad %Mat4x3_ %t_PosMtx - %305 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %304 - %306 = OpLoad %v3float %a_Position1 - %307 = OpLoad %Mat4x3_ %t_PosMtx - %308 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %307 - %309 = OpLoad %v3float %a_Position1 - %311 = OpCompositeExtract %float %309 0 - %312 = OpCompositeExtract %float %309 1 - %313 = OpCompositeExtract %float %309 2 - %314 = OpCompositeConstruct %v4float %311 %312 %313 %float_1 - %310 = OpFunctionCall %v4float %Mul %308 %314 - %316 = OpAccessChain %_ptr_Uniform_Mat4x4_ %global %uint_0 - %317 = OpLoad %Mat4x4_ %316 - %318 = OpLoad %Mat4x3_ %t_PosMtx - %319 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %318 - %320 = OpLoad %v3float %a_Position1 - %321 = OpLoad %Mat4x3_ %t_PosMtx - %322 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %321 - %323 = OpLoad %v3float %a_Position1 - %325 = OpCompositeExtract %float %323 0 - %326 = OpCompositeExtract %float %323 1 - %327 = OpCompositeExtract %float %323 2 - %328 = OpCompositeConstruct %v4float %325 %326 %327 %float_1 - %324 = OpFunctionCall %v4float %Mul %322 %328 - %329 = OpFunctionCall %v4float %Mul %317 %324 - OpStore %gl_Position %329 - %330 = OpLoad %v4float %a_Color1 - OpStore %v_Color %330 - %332 = OpAccessChain %_ptr_Uniform_v4float %global1 %uint_1 - %333 = OpLoad %v4float %332 - %334 = OpCompositeExtract %float %333 0 - %336 = OpFOrdEqual %bool %334 %float_2 - OpSelectionMerge %338 None - OpBranchConditional %336 %339 %340 - %339 = OpLabel - %341 = OpLoad %v3float %a_Normal1 - %344 = OpAccessChain %_ptr_Uniform_Mat4x2_ %global1 %uint_0 %int_0 - %345 = OpLoad %Mat4x2_ %344 - %346 = OpLoad %v3float %a_Normal1 - %348 = OpCompositeExtract %float %346 0 - %349 = OpCompositeExtract %float %346 1 - %350 = OpCompositeExtract %float %346 2 - %351 = OpCompositeConstruct %v4float %348 %349 %350 %float_1 - %347 = OpFunctionCall %v2float %Mul2 %345 %351 - %352 = OpVectorShuffle %v2float %347 %347 0 1 - OpStore %v_TexCoord %352 - OpReturn - %340 = OpLabel - %353 = OpLoad %v2float %a_UV1 - %354 = OpAccessChain %_ptr_Uniform_Mat4x2_ %global1 %uint_0 %int_0 - %355 = OpLoad %Mat4x2_ %354 - %356 = OpLoad %v2float %a_UV1 - %358 = OpCompositeExtract %float %356 0 - %359 = OpCompositeExtract %float %356 1 - %360 = OpCompositeConstruct %v4float %358 %359 %float_1 %float_1 - %357 = OpFunctionCall %v2float %Mul2 %355 %360 - %361 = OpVectorShuffle %v2float %357 %357 0 1 - OpStore %v_TexCoord %361 - OpReturn + %297 = OpLoad %float %a_PosMtxIdx1 + %298 = OpConvertFToS %int %297 + %301 = OpAccessChain %_ptr_Uniform_Mat4x3_ %global2 %uint_0 %298 + %302 = OpLoad %Mat4x3_ %301 + OpStore %t_PosMtx %302 + %303 = OpLoad %Mat4x3_ %t_PosMtx + %304 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %303 + %305 = OpLoad %v3float %a_Position1 + %306 = OpLoad %Mat4x3_ %t_PosMtx + %307 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %306 + %308 = OpLoad %v3float %a_Position1 + %310 = OpCompositeExtract %float %308 0 + %311 = OpCompositeExtract %float %308 1 + %312 = OpCompositeExtract %float %308 2 + %313 = OpCompositeConstruct %v4float %310 %311 %312 %float_1 + %309 = OpFunctionCall %v4float %Mul %307 %313 + %315 = OpAccessChain %_ptr_Uniform_Mat4x4_ %global %uint_0 + %316 = OpLoad %Mat4x4_ %315 + %317 = OpLoad %Mat4x3_ %t_PosMtx + %318 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %317 + %319 = OpLoad %v3float %a_Position1 + %320 = OpLoad %Mat4x3_ %t_PosMtx + %321 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %320 + %322 = OpLoad %v3float %a_Position1 + %324 = OpCompositeExtract %float %322 0 + %325 = OpCompositeExtract %float %322 1 + %326 = OpCompositeExtract %float %322 2 + %327 = OpCompositeConstruct %v4float %324 %325 %326 %float_1 + %323 = OpFunctionCall %v4float %Mul %321 %327 + %328 = OpFunctionCall %v4float %Mul %316 %323 + OpStore %gl_Position %328 + %329 = OpLoad %v4float %a_Color1 + OpStore %v_Color %329 + %331 = OpAccessChain %_ptr_Uniform_v4float %global1 %uint_1 + %332 = OpLoad %v4float %331 + %333 = OpCompositeExtract %float %332 0 + %335 = OpFOrdEqual %bool %333 %float_2 + OpSelectionMerge %337 None + OpBranchConditional %335 %338 %339 %338 = OpLabel + %340 = OpLoad %v3float %a_Normal1 + %343 = OpAccessChain %_ptr_Uniform_Mat4x2_ %global1 %uint_0 %341 + %344 = OpLoad %Mat4x2_ %343 + %345 = OpLoad %v3float %a_Normal1 + %347 = OpCompositeExtract %float %345 0 + %348 = OpCompositeExtract %float %345 1 + %349 = OpCompositeExtract %float %345 2 + %350 = OpCompositeConstruct %v4float %347 %348 %349 %float_1 + %346 = OpFunctionCall %v2float %Mul2 %344 %350 + %351 = OpVectorShuffle %v2float %346 %346 0 1 + OpStore %v_TexCoord %351 + OpReturn + %339 = OpLabel + %352 = OpLoad %v2float %a_UV1 + %353 = OpAccessChain %_ptr_Uniform_Mat4x2_ %global1 %uint_0 %341 + %354 = OpLoad %Mat4x2_ %353 + %355 = OpLoad %v2float %a_UV1 + %357 = OpCompositeExtract %float %355 0 + %358 = OpCompositeExtract %float %355 1 + %359 = OpCompositeConstruct %v4float %357 %358 %float_1 %float_1 + %356 = OpFunctionCall %v2float %Mul2 %354 %359 + %360 = OpVectorShuffle %v2float %356 %356 0 1 + OpStore %v_TexCoord %360 + OpReturn + %337 = OpLabel OpReturn OpFunctionEnd - %main_inner = OpFunction %VertexOutput None %362 + %main_inner = OpFunction %VertexOutput None %361 %a_Position = OpFunctionParameter %v3float %a_UV = OpFunctionParameter %v2float %a_Color = OpFunctionParameter %v4float %a_Normal = OpFunctionParameter %v3float %a_PosMtxIdx = OpFunctionParameter %float - %370 = OpLabel + %369 = OpLabel OpStore %a_Position1 %a_Position OpStore %a_UV1 %a_UV OpStore %a_Color1 %a_Color OpStore %a_Normal1 %a_Normal OpStore %a_PosMtxIdx1 %a_PosMtxIdx - %371 = OpFunctionCall %void %main1 - %372 = OpLoad %v4float %v_Color - %373 = OpLoad %v2float %v_TexCoord - %374 = OpLoad %v4float %gl_Position - %375 = OpCompositeConstruct %VertexOutput %372 %373 %374 - OpReturnValue %375 + %370 = OpFunctionCall %void %main1 + %371 = OpLoad %v4float %v_Color + %372 = OpLoad %v2float %v_TexCoord + %373 = OpLoad %v4float %gl_Position + %374 = OpCompositeConstruct %VertexOutput %371 %372 %373 + OpReturnValue %374 OpFunctionEnd - %main = OpFunction %void None %291 - %377 = OpLabel - %379 = OpLoad %v3float %a_Position_1 - %380 = OpLoad %v2float %a_UV_1 - %381 = OpLoad %v4float %a_Color_1 - %382 = OpLoad %v3float %a_Normal_1 - %383 = OpLoad %float %a_PosMtxIdx_1 - %378 = OpFunctionCall %VertexOutput %main_inner %379 %380 %381 %382 %383 - %384 = OpCompositeExtract %v4float %378 0 - OpStore %v_Color_1 %384 - %385 = OpCompositeExtract %v2float %378 1 - OpStore %v_TexCoord_1 %385 - %386 = OpCompositeExtract %v4float %378 2 - OpStore %member_1 %386 + %main = OpFunction %void None %290 + %376 = OpLabel + %378 = OpLoad %v3float %a_Position_1 + %379 = OpLoad %v2float %a_UV_1 + %380 = OpLoad %v4float %a_Color_1 + %381 = OpLoad %v3float %a_Normal_1 + %382 = OpLoad %float %a_PosMtxIdx_1 + %377 = OpFunctionCall %VertexOutput %main_inner %378 %379 %380 %381 %382 + %383 = OpCompositeExtract %v4float %377 0 + OpStore %v_Color_1 %383 + %384 = OpCompositeExtract %v2float %377 1 + OpStore %v_TexCoord_1 %384 + %385 = OpCompositeExtract %v4float %377 2 + OpStore %member_1 %385 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/922.wgsl.expected.wgsl b/test/tint/bug/tint/922.wgsl.expected.wgsl index 00055b11a3..82dd43130d 100644 --- a/test/tint/bug/tint/922.wgsl.expected.wgsl +++ b/test/tint/bug/tint/922.wgsl.expected.wgsl @@ -279,7 +279,7 @@ fn main1() { } } -@stage(vertex) +@vertex fn main(@location(0) a_Position : vec3, @location(1) a_UV : vec2, @location(2) a_Color : vec4, @location(3) a_Normal : vec3, @location(4) a_PosMtxIdx : f32) -> VertexOutput { a_Position1 = a_Position; a_UV1 = a_UV; diff --git a/test/tint/bug/tint/926.wgsl b/test/tint/bug/tint/926.wgsl index ba04a7ba29..1fe80571d3 100644 --- a/test/tint/bug/tint/926.wgsl +++ b/test/tint/bug/tint/926.wgsl @@ -5,7 +5,7 @@ var cubeVerts : u32 = 0u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn computeMain(@builtin(global_invocation_id) global_id : vec3) { // Increment cubeVerts based on some criteria... diff --git a/test/tint/bug/tint/926.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/926.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f5ed4b6d4a --- /dev/null +++ b/test/tint/bug/tint/926.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer drawOut : register(u5, space0); +static uint cubeVerts = 0u; + +struct tint_symbol_1 { + uint3 global_id : SV_DispatchThreadID; +}; + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void computeMain_inner(uint3 global_id) { + const uint firstVertex = tint_atomicAdd(drawOut, 0u, cubeVerts); +} + +[numthreads(1, 1, 1)] +void computeMain(tint_symbol_1 tint_symbol) { + computeMain_inner(tint_symbol.global_id); + return; +} diff --git a/test/tint/bug/tint/926.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/926.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f5ed4b6d4a --- /dev/null +++ b/test/tint/bug/tint/926.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer drawOut : register(u5, space0); +static uint cubeVerts = 0u; + +struct tint_symbol_1 { + uint3 global_id : SV_DispatchThreadID; +}; + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void computeMain_inner(uint3 global_id) { + const uint firstVertex = tint_atomicAdd(drawOut, 0u, cubeVerts); +} + +[numthreads(1, 1, 1)] +void computeMain(tint_symbol_1 tint_symbol) { + computeMain_inner(tint_symbol.global_id); + return; +} diff --git a/test/tint/bug/tint/926.wgsl.expected.hlsl b/test/tint/bug/tint/926.wgsl.expected.hlsl deleted file mode 100644 index 9f7e997c6f..0000000000 --- a/test/tint/bug/tint/926.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicAdd_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedAdd(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer drawOut : register(u5, space0); -static uint cubeVerts = 0u; - -struct tint_symbol_1 { - uint3 global_id : SV_DispatchThreadID; -}; - -void computeMain_inner(uint3 global_id) { - const uint firstVertex = atomicAdd_1(drawOut, 0u, cubeVerts); -} - -[numthreads(1, 1, 1)] -void computeMain(tint_symbol_1 tint_symbol) { - computeMain_inner(tint_symbol.global_id); - return; -} diff --git a/test/tint/bug/tint/926.wgsl.expected.msl b/test/tint/bug/tint/926.wgsl.expected.msl index 8da55f652a..34e8d8da58 100644 --- a/test/tint/bug/tint/926.wgsl.expected.msl +++ b/test/tint/bug/tint/926.wgsl.expected.msl @@ -5,13 +5,13 @@ struct DrawIndirectArgs { /* 0x0000 */ atomic_uint vertexCount; }; -void computeMain_inner(uint3 global_id, device DrawIndirectArgs* const tint_symbol, thread uint* const tint_symbol_1) { - uint const firstVertex = atomic_fetch_add_explicit(&((*(tint_symbol)).vertexCount), *(tint_symbol_1), memory_order_relaxed); +void computeMain_inner(uint3 global_id, device DrawIndirectArgs* const tint_symbol) { + thread uint tint_symbol_1 = 0u; + uint const firstVertex = atomic_fetch_add_explicit(&((*(tint_symbol)).vertexCount), tint_symbol_1, memory_order_relaxed); } kernel void computeMain(device DrawIndirectArgs* tint_symbol_2 [[buffer(0)]], uint3 global_id [[thread_position_in_grid]]) { - thread uint tint_symbol_3 = 0u; - computeMain_inner(global_id, tint_symbol_2, &(tint_symbol_3)); + computeMain_inner(global_id, tint_symbol_2); return; } diff --git a/test/tint/bug/tint/926.wgsl.expected.spvasm b/test/tint/bug/tint/926.wgsl.expected.spvasm index 8b29d2780e..f3853ec4bb 100644 --- a/test/tint/bug/tint/926.wgsl.expected.spvasm +++ b/test/tint/bug/tint/926.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 27 +; Bound: 28 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -27,25 +27,26 @@ %DrawIndirectArgs = OpTypeStruct %uint %_ptr_StorageBuffer_DrawIndirectArgs = OpTypePointer StorageBuffer %DrawIndirectArgs %drawOut = OpVariable %_ptr_StorageBuffer_DrawIndirectArgs StorageBuffer - %uint_0 = OpConstant %uint 0 + %8 = OpConstantNull %uint %_ptr_Private_uint = OpTypePointer Private %uint - %cubeVerts = OpVariable %_ptr_Private_uint Private %uint_0 + %cubeVerts = OpVariable %_ptr_Private_uint Private %8 %void = OpTypeVoid %11 = OpTypeFunction %void %v3uint %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %22 = OpTypeFunction %void + %23 = OpTypeFunction %void %computeMain_inner = OpFunction %void None %11 %global_id = OpFunctionParameter %v3uint %15 = OpLabel - %20 = OpAccessChain %_ptr_StorageBuffer_uint %drawOut %uint_0 - %21 = OpLoad %uint %cubeVerts - %16 = OpAtomicIAdd %uint %20 %uint_1 %uint_0 %21 + %21 = OpAccessChain %_ptr_StorageBuffer_uint %drawOut %uint_0 + %22 = OpLoad %uint %cubeVerts + %16 = OpAtomicIAdd %uint %21 %uint_1 %uint_0 %22 OpReturn OpFunctionEnd -%computeMain = OpFunction %void None %22 - %24 = OpLabel - %26 = OpLoad %v3uint %global_id_1 - %25 = OpFunctionCall %void %computeMain_inner %26 +%computeMain = OpFunction %void None %23 + %25 = OpLabel + %27 = OpLoad %v3uint %global_id_1 + %26 = OpFunctionCall %void %computeMain_inner %27 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/926.wgsl.expected.wgsl b/test/tint/bug/tint/926.wgsl.expected.wgsl index 847850d237..bc0535c328 100644 --- a/test/tint/bug/tint/926.wgsl.expected.wgsl +++ b/test/tint/bug/tint/926.wgsl.expected.wgsl @@ -6,7 +6,7 @@ struct DrawIndirectArgs { var cubeVerts : u32 = 0u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn computeMain(@builtin(global_invocation_id) global_id : vec3) { let firstVertex : u32 = atomicAdd(&(drawOut.vertexCount), cubeVerts); } diff --git a/test/tint/bug/tint/942.wgsl b/test/tint/bug/tint/942.wgsl index 722dc75f1b..d4c2bcbddf 100644 --- a/test/tint/bug/tint/942.wgsl +++ b/test/tint/bug/tint/942.wgsl @@ -29,7 +29,7 @@ var tile : array, 256>, 4>; -@stage(compute) @workgroup_size(64, 1, 1) +@compute @workgroup_size(64, 1, 1) fn main( @builtin(workgroup_id) WorkGroupID : vec3, @builtin(local_invocation_id) LocalInvocationID : vec3 diff --git a/test/tint/bug/tint/942.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/942.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..26a04416f9 --- /dev/null +++ b/test/tint/bug/tint/942.wgsl.expected.dxc.hlsl @@ -0,0 +1,84 @@ +SamplerState samp : register(s0, space0); +cbuffer cbuffer_params : register(b1, space0) { + uint4 params[1]; +}; +Texture2D inputTex : register(t1, space1); +RWTexture2D outputTex : register(u2, space1); + +cbuffer cbuffer_flip : register(b3, space1) { + uint4 flip[1]; +}; +groupshared float3 tile[4][256]; + +struct tint_symbol_1 { + uint3 LocalInvocationID : SV_GroupThreadID; + uint local_invocation_index : SV_GroupIndex; + uint3 WorkGroupID : SV_GroupID; +}; + +void main_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) { + const uint i_1 = (idx / 256u); + const uint i_2 = (idx % 256u); + tile[i_1][i_2] = (0.0f).xxx; + } + } + GroupMemoryBarrierWithGroupSync(); + const uint filterOffset = ((params[0].x - 1u) / 2u); + int3 tint_tmp; + inputTex.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + const int2 dims = tint_tmp.xy; + const int2 baseIndex = (int2(((WorkGroupID.xy * uint2(params[0].y, 4u)) + (LocalInvocationID.xy * uint2(4u, 1u)))) - int2(int(filterOffset), 0)); + { + [loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) { + { + [loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) { + int2 loadIndex = (baseIndex + int2(int(c), int(r))); + if ((flip[0].x != 0u)) { + loadIndex = loadIndex.yx; + } + tile[r][((4u * LocalInvocationID.x) + c)] = inputTex.SampleLevel(samp, ((float2(loadIndex) + (0.25f).xx) / float2(dims)), 0.0f).rgb; + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + { + [loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) { + { + [loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) { + int2 writeIndex = (baseIndex + int2(int(c), int(r))); + if ((flip[0].x != 0u)) { + writeIndex = writeIndex.yx; + } + const uint center = ((4u * LocalInvocationID.x) + c); + bool tint_tmp_2 = (center >= filterOffset); + if (tint_tmp_2) { + tint_tmp_2 = (center < (256u - filterOffset)); + } + bool tint_tmp_1 = (tint_tmp_2); + if (tint_tmp_1) { + tint_tmp_1 = all((writeIndex < dims)); + } + if ((tint_tmp_1)) { + float3 acc = (0.0f).xxx; + { + [loop] for(uint f = 0u; (f < params[0].x); f = (f + 1u)) { + uint i = ((center + f) - filterOffset); + acc = (acc + ((1.0f / float(params[0].x)) * tile[r][i])); + } + } + outputTex[writeIndex] = float4(acc, 1.0f); + } + } + } + } + } +} + +[numthreads(64, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.WorkGroupID, tint_symbol.LocalInvocationID, tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/bug/tint/942.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/942.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26a04416f9 --- /dev/null +++ b/test/tint/bug/tint/942.wgsl.expected.fxc.hlsl @@ -0,0 +1,84 @@ +SamplerState samp : register(s0, space0); +cbuffer cbuffer_params : register(b1, space0) { + uint4 params[1]; +}; +Texture2D inputTex : register(t1, space1); +RWTexture2D outputTex : register(u2, space1); + +cbuffer cbuffer_flip : register(b3, space1) { + uint4 flip[1]; +}; +groupshared float3 tile[4][256]; + +struct tint_symbol_1 { + uint3 LocalInvocationID : SV_GroupThreadID; + uint local_invocation_index : SV_GroupIndex; + uint3 WorkGroupID : SV_GroupID; +}; + +void main_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) { + const uint i_1 = (idx / 256u); + const uint i_2 = (idx % 256u); + tile[i_1][i_2] = (0.0f).xxx; + } + } + GroupMemoryBarrierWithGroupSync(); + const uint filterOffset = ((params[0].x - 1u) / 2u); + int3 tint_tmp; + inputTex.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + const int2 dims = tint_tmp.xy; + const int2 baseIndex = (int2(((WorkGroupID.xy * uint2(params[0].y, 4u)) + (LocalInvocationID.xy * uint2(4u, 1u)))) - int2(int(filterOffset), 0)); + { + [loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) { + { + [loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) { + int2 loadIndex = (baseIndex + int2(int(c), int(r))); + if ((flip[0].x != 0u)) { + loadIndex = loadIndex.yx; + } + tile[r][((4u * LocalInvocationID.x) + c)] = inputTex.SampleLevel(samp, ((float2(loadIndex) + (0.25f).xx) / float2(dims)), 0.0f).rgb; + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + { + [loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) { + { + [loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) { + int2 writeIndex = (baseIndex + int2(int(c), int(r))); + if ((flip[0].x != 0u)) { + writeIndex = writeIndex.yx; + } + const uint center = ((4u * LocalInvocationID.x) + c); + bool tint_tmp_2 = (center >= filterOffset); + if (tint_tmp_2) { + tint_tmp_2 = (center < (256u - filterOffset)); + } + bool tint_tmp_1 = (tint_tmp_2); + if (tint_tmp_1) { + tint_tmp_1 = all((writeIndex < dims)); + } + if ((tint_tmp_1)) { + float3 acc = (0.0f).xxx; + { + [loop] for(uint f = 0u; (f < params[0].x); f = (f + 1u)) { + uint i = ((center + f) - filterOffset); + acc = (acc + ((1.0f / float(params[0].x)) * tile[r][i])); + } + } + outputTex[writeIndex] = float4(acc, 1.0f); + } + } + } + } + } +} + +[numthreads(64, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.WorkGroupID, tint_symbol.LocalInvocationID, tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/bug/tint/942.wgsl.expected.glsl b/test/tint/bug/tint/942.wgsl.expected.glsl index bd112c5063..d194f13112 100644 --- a/test/tint/bug/tint/942.wgsl.expected.glsl +++ b/test/tint/bug/tint/942.wgsl.expected.glsl @@ -28,7 +28,7 @@ void tint_symbol(uvec3 WorkGroupID, uvec3 LocalInvocationID, uint local_invocati for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) { uint i_1 = (idx / 256u); uint i_2 = (idx % 256u); - tile[i_1][i_2] = vec3(0.0f, 0.0f, 0.0f); + tile[i_1][i_2] = vec3(0.0f); } } barrier(); @@ -43,7 +43,7 @@ void tint_symbol(uvec3 WorkGroupID, uvec3 LocalInvocationID, uint local_invocati if ((flip.value != 0u)) { loadIndex = loadIndex.yx; } - tile[r][((4u * LocalInvocationID.x) + c)] = textureLod(inputTex_samp, ((vec2(loadIndex) + vec2(0.25f, 0.25f)) / vec2(dims)), 0.0f).rgb; + tile[r][((4u * LocalInvocationID.x) + c)] = textureLod(inputTex_samp, ((vec2(loadIndex) + vec2(0.25f)) / vec2(dims)), 0.0f).rgb; } } } @@ -67,7 +67,7 @@ void tint_symbol(uvec3 WorkGroupID, uvec3 LocalInvocationID, uint local_invocati tint_tmp = all(lessThan(writeIndex, dims)); } if ((tint_tmp)) { - vec3 acc = vec3(0.0f, 0.0f, 0.0f); + vec3 acc = vec3(0.0f); { for(uint f = 0u; (f < params.filterDim); f = (f + 1u)) { uint i = ((center + f) - filterOffset); diff --git a/test/tint/bug/tint/942.wgsl.expected.hlsl b/test/tint/bug/tint/942.wgsl.expected.hlsl deleted file mode 100644 index 7c38bdcd3d..0000000000 --- a/test/tint/bug/tint/942.wgsl.expected.hlsl +++ /dev/null @@ -1,84 +0,0 @@ -SamplerState samp : register(s0, space0); -cbuffer cbuffer_params : register(b1, space0) { - uint4 params[1]; -}; -Texture2D inputTex : register(t1, space1); -RWTexture2D outputTex : register(u2, space1); - -cbuffer cbuffer_flip : register(b3, space1) { - uint4 flip[1]; -}; -groupshared float3 tile[4][256]; - -struct tint_symbol_1 { - uint3 LocalInvocationID : SV_GroupThreadID; - uint local_invocation_index : SV_GroupIndex; - uint3 WorkGroupID : SV_GroupID; -}; - -void main_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocation_index) { - { - [loop] for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) { - const uint i_1 = (idx / 256u); - const uint i_2 = (idx % 256u); - tile[i_1][i_2] = float3(0.0f, 0.0f, 0.0f); - } - } - GroupMemoryBarrierWithGroupSync(); - const uint filterOffset = ((params[0].x - 1u) / 2u); - int3 tint_tmp; - inputTex.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - const int2 dims = tint_tmp.xy; - const int2 baseIndex = (int2(((WorkGroupID.xy * uint2(params[0].y, 4u)) + (LocalInvocationID.xy * uint2(4u, 1u)))) - int2(int(filterOffset), 0)); - { - [loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) { - { - [loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) { - int2 loadIndex = (baseIndex + int2(int(c), int(r))); - if ((flip[0].x != 0u)) { - loadIndex = loadIndex.yx; - } - tile[r][((4u * LocalInvocationID.x) + c)] = inputTex.SampleLevel(samp, ((float2(loadIndex) + float2(0.25f, 0.25f)) / float2(dims)), 0.0f).rgb; - } - } - } - } - GroupMemoryBarrierWithGroupSync(); - { - [loop] for(uint r = 0u; (r < 4u); r = (r + 1u)) { - { - [loop] for(uint c = 0u; (c < 4u); c = (c + 1u)) { - int2 writeIndex = (baseIndex + int2(int(c), int(r))); - if ((flip[0].x != 0u)) { - writeIndex = writeIndex.yx; - } - const uint center = ((4u * LocalInvocationID.x) + c); - bool tint_tmp_2 = (center >= filterOffset); - if (tint_tmp_2) { - tint_tmp_2 = (center < (256u - filterOffset)); - } - bool tint_tmp_1 = (tint_tmp_2); - if (tint_tmp_1) { - tint_tmp_1 = all((writeIndex < dims)); - } - if ((tint_tmp_1)) { - float3 acc = float3(0.0f, 0.0f, 0.0f); - { - [loop] for(uint f = 0u; (f < params[0].x); f = (f + 1u)) { - uint i = ((center + f) - filterOffset); - acc = (acc + ((1.0f / float(params[0].x)) * tile[r][i])); - } - } - outputTex[writeIndex] = float4(acc, 1.0f); - } - } - } - } - } -} - -[numthreads(64, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.WorkGroupID, tint_symbol.LocalInvocationID, tint_symbol.local_invocation_index); - return; -} diff --git a/test/tint/bug/tint/942.wgsl.expected.msl b/test/tint/bug/tint/942.wgsl.expected.msl index 3127a423b6..cca7a67492 100644 --- a/test/tint/bug/tint/942.wgsl.expected.msl +++ b/test/tint/bug/tint/942.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Params { /* 0x0000 */ uint filterDim; /* 0x0004 */ uint blockDim; @@ -10,19 +23,11 @@ struct Flip { /* 0x0000 */ uint value; }; -struct tint_array_wrapper_1 { - float3 arr[256]; -}; - -struct tint_array_wrapper { - tint_array_wrapper_1 arr[4]; -}; - -void tint_symbol_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocation_index, threadgroup tint_array_wrapper* const tint_symbol_1, const constant Params* const tint_symbol_2, texture2d tint_symbol_3, const constant Flip* const tint_symbol_4, sampler tint_symbol_5, texture2d tint_symbol_6) { +void tint_symbol_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_invocation_index, threadgroup tint_array, 4>* const tint_symbol_1, const constant Params* const tint_symbol_2, texture2d tint_symbol_3, const constant Flip* const tint_symbol_4, sampler tint_symbol_5, texture2d tint_symbol_6) { for(uint idx = local_invocation_index; (idx < 1024u); idx = (idx + 64u)) { uint const i_1 = (idx / 256u); uint const i_2 = (idx % 256u); - (*(tint_symbol_1)).arr[i_1].arr[i_2] = float3(); + (*(tint_symbol_1))[i_1][i_2] = float3(0.0f); } threadgroup_barrier(mem_flags::mem_threadgroup); uint const filterOffset = (((*(tint_symbol_2)).filterDim - 1u) / 2u); @@ -34,7 +39,7 @@ void tint_symbol_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_in if (((*(tint_symbol_4)).value != 0u)) { loadIndex = int2(loadIndex).yx; } - (*(tint_symbol_1)).arr[r].arr[((4u * LocalInvocationID[0]) + c)] = float4(tint_symbol_3.sample(tint_symbol_5, ((float2(loadIndex) + float2(0.25f, 0.25f)) / float2(dims)), level(0.0f))).rgb; + (*(tint_symbol_1))[r][((4u * LocalInvocationID[0]) + c)] = float4(tint_symbol_3.sample(tint_symbol_5, ((float2(loadIndex) + float2(0.25f)) / float2(dims)), level(0.0f))).rgb; } } threadgroup_barrier(mem_flags::mem_threadgroup); @@ -46,10 +51,10 @@ void tint_symbol_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_in } uint const center = ((4u * LocalInvocationID[0]) + c); if ((((center >= filterOffset) && (center < (256u - filterOffset))) && all((writeIndex < dims)))) { - float3 acc = float3(0.0f, 0.0f, 0.0f); + float3 acc = float3(0.0f); for(uint f = 0u; (f < (*(tint_symbol_2)).filterDim); f = (f + 1u)) { uint i = ((center + f) - filterOffset); - acc = (acc + ((1.0f / float((*(tint_symbol_2)).filterDim)) * (*(tint_symbol_1)).arr[r].arr[i])); + acc = (acc + ((1.0f / float((*(tint_symbol_2)).filterDim)) * (*(tint_symbol_1))[r][i])); } tint_symbol_6.write(float4(acc, 1.0f), uint2(writeIndex)); } @@ -58,7 +63,7 @@ void tint_symbol_inner(uint3 WorkGroupID, uint3 LocalInvocationID, uint local_in } kernel void tint_symbol(const constant Params* tint_symbol_8 [[buffer(0)]], texture2d tint_symbol_9 [[texture(0)]], const constant Flip* tint_symbol_10 [[buffer(1)]], sampler tint_symbol_11 [[sampler(0)]], texture2d tint_symbol_12 [[texture(1)]], uint3 WorkGroupID [[threadgroup_position_in_grid]], uint3 LocalInvocationID [[thread_position_in_threadgroup]], uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup tint_array_wrapper tint_symbol_7; + threadgroup tint_array, 4> tint_symbol_7; tint_symbol_inner(WorkGroupID, LocalInvocationID, local_invocation_index, &(tint_symbol_7), tint_symbol_8, tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12); return; } diff --git a/test/tint/bug/tint/942.wgsl.expected.spvasm b/test/tint/bug/tint/942.wgsl.expected.spvasm index 0111307583..25417c32a2 100644 --- a/test/tint/bug/tint/942.wgsl.expected.spvasm +++ b/test/tint/bug/tint/942.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 259 +; Bound: 258 ; Schema: 0 OpCapability Shader OpCapability ImageQuery @@ -106,7 +106,7 @@ %uint_1 = OpConstant %uint 1 %int = OpTypeInt 32 1 %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 + %76 = OpConstantNull %int %v2uint = OpTypeVector %uint 2 %85 = OpConstantComposite %v2uint %uint_4 %uint_1 %_ptr_Function_v2int = OpTypePointer Function %v2int @@ -116,12 +116,11 @@ %v2float = OpTypeVector %float 2 %float_0_25 = OpConstant %float 0.25 %143 = OpConstantComposite %v2float %float_0_25 %float_0_25 - %float_0 = OpConstant %float 0 + %147 = OpConstantNull %float %v2bool = OpTypeVector %bool 2 - %207 = OpConstantComposite %v3float %float_0 %float_0 %float_0 %_ptr_Function_v3float = OpTypePointer Function %v3float %float_1 = OpConstant %float 1 - %252 = OpTypeFunction %void + %251 = OpTypeFunction %void %main_inner = OpFunction %void None %31 %WorkGroupID = OpFunctionParameter %v3uint %LocalInvocationID = OpFunctionParameter %v3uint @@ -170,7 +169,7 @@ %70 = OpISub %uint %68 %uint_1 %71 = OpUDiv %uint %70 %uint_2 %75 = OpLoad %16 %inputTex - %72 = OpImageQuerySizeLod %v2int %75 %int_0 + %72 = OpImageQuerySizeLod %v2int %75 %76 %79 = OpVectorShuffle %v2uint %WorkGroupID %WorkGroupID 0 1 %80 = OpAccessChain %_ptr_Uniform_uint %params %uint_1 %81 = OpLoad %uint %80 @@ -181,9 +180,9 @@ %87 = OpIAdd %v2uint %83 %86 %77 = OpBitcast %v2int %87 %88 = OpBitcast %int %71 - %89 = OpCompositeConstruct %v2int %88 %int_0 + %89 = OpCompositeConstruct %v2int %88 %76 %90 = OpISub %v2int %77 %89 - OpStore %r %uint_0 + OpStore %r %40 OpBranch %92 %92 = OpLabel OpLoopMerge %93 %94 None @@ -197,7 +196,7 @@ %100 = OpLabel OpBranch %93 %99 = OpLabel - OpStore %c %uint_0 + OpStore %c %40 OpBranch %102 %102 = OpLabel OpLoopMerge %103 %104 None @@ -220,7 +219,7 @@ OpStore %loadIndex %116 %120 = OpAccessChain %_ptr_Uniform_uint %flip %uint_0 %121 = OpLoad %uint %120 - %122 = OpINotEqual %bool %121 %uint_0 + %122 = OpINotEqual %bool %121 %40 OpSelectionMerge %123 None OpBranchConditional %122 %124 %123 %124 = OpLabel @@ -243,7 +242,7 @@ %144 = OpFAdd %v2float %139 %143 %145 = OpConvertSToF %v2float %72 %146 = OpFDiv %v2float %144 %145 - %133 = OpImageSampleExplicitLod %v4float %138 %146 Lod %float_0 + %133 = OpImageSampleExplicitLod %v4float %138 %146 Lod %147 %148 = OpVectorShuffle %v3float %133 %133 0 1 2 OpStore %132 %148 OpBranch %104 @@ -261,7 +260,7 @@ OpBranch %92 %93 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - OpStore %r_0 %uint_0 + OpStore %r_0 %40 OpBranch %155 %155 = OpLabel OpLoopMerge %156 %157 None @@ -275,7 +274,7 @@ %163 = OpLabel OpBranch %156 %162 = OpLabel - OpStore %c_0 %uint_0 + OpStore %c_0 %40 OpBranch %165 %165 = OpLabel OpLoopMerge %166 %167 None @@ -298,7 +297,7 @@ OpStore %writeIndex %179 %181 = OpAccessChain %_ptr_Uniform_uint %flip %uint_0 %182 = OpLoad %uint %181 - %183 = OpINotEqual %bool %182 %uint_0 + %183 = OpINotEqual %bool %182 %40 OpSelectionMerge %184 None OpBranchConditional %183 %185 %184 %185 = OpLabel @@ -332,77 +331,77 @@ OpSelectionMerge %205 None OpBranchConditional %204 %206 %205 %206 = OpLabel - OpStore %acc %207 - OpStore %f %uint_0 - OpBranch %211 - %211 = OpLabel - OpLoopMerge %212 %213 None - OpBranch %214 - %214 = OpLabel - %216 = OpLoad %uint %f - %217 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 - %218 = OpLoad %uint %217 - %219 = OpULessThan %bool %216 %218 - %215 = OpLogicalNot %bool %219 - OpSelectionMerge %220 None - OpBranchConditional %215 %221 %220 - %221 = OpLabel - OpBranch %212 - %220 = OpLabel - %222 = OpLoad %uint %f - %223 = OpIAdd %uint %191 %222 - %224 = OpISub %uint %223 %71 - OpStore %i %224 - %226 = OpLoad %v3float %acc - %229 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 - %230 = OpLoad %uint %229 - %228 = OpConvertUToF %float %230 - %231 = OpFDiv %float %float_1 %228 - %232 = OpLoad %uint %r_0 - %233 = OpLoad %uint %i - %234 = OpAccessChain %_ptr_Workgroup_v3float %tile %232 %233 - %235 = OpLoad %v3float %234 - %236 = OpVectorTimesScalar %v3float %235 %231 - %237 = OpFAdd %v3float %226 %236 - OpStore %acc %237 + OpStore %acc %58 + OpStore %f %40 + OpBranch %210 + %210 = OpLabel + OpLoopMerge %211 %212 None OpBranch %213 %213 = OpLabel - %238 = OpLoad %uint %f - %239 = OpIAdd %uint %238 %uint_1 - OpStore %f %239 + %215 = OpLoad %uint %f + %216 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 + %217 = OpLoad %uint %216 + %218 = OpULessThan %bool %215 %217 + %214 = OpLogicalNot %bool %218 + OpSelectionMerge %219 None + OpBranchConditional %214 %220 %219 + %220 = OpLabel OpBranch %211 + %219 = OpLabel + %221 = OpLoad %uint %f + %222 = OpIAdd %uint %191 %221 + %223 = OpISub %uint %222 %71 + OpStore %i %223 + %225 = OpLoad %v3float %acc + %228 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 + %229 = OpLoad %uint %228 + %227 = OpConvertUToF %float %229 + %230 = OpFDiv %float %float_1 %227 + %231 = OpLoad %uint %r_0 + %232 = OpLoad %uint %i + %233 = OpAccessChain %_ptr_Workgroup_v3float %tile %231 %232 + %234 = OpLoad %v3float %233 + %235 = OpVectorTimesScalar %v3float %234 %230 + %236 = OpFAdd %v3float %225 %235 + OpStore %acc %236 + OpBranch %212 %212 = OpLabel - %241 = OpLoad %20 %outputTex - %242 = OpLoad %v2int %writeIndex - %243 = OpLoad %v3float %acc - %244 = OpCompositeExtract %float %243 0 - %245 = OpCompositeExtract %float %243 1 - %246 = OpCompositeExtract %float %243 2 - %247 = OpCompositeConstruct %v4float %244 %245 %246 %float_1 - OpImageWrite %241 %242 %247 + %237 = OpLoad %uint %f + %238 = OpIAdd %uint %237 %uint_1 + OpStore %f %238 + OpBranch %210 + %211 = OpLabel + %240 = OpLoad %20 %outputTex + %241 = OpLoad %v2int %writeIndex + %242 = OpLoad %v3float %acc + %243 = OpCompositeExtract %float %242 0 + %244 = OpCompositeExtract %float %242 1 + %245 = OpCompositeExtract %float %242 2 + %246 = OpCompositeConstruct %v4float %243 %244 %245 %float_1 + OpImageWrite %240 %241 %246 OpBranch %205 %205 = OpLabel OpBranch %167 %167 = OpLabel - %248 = OpLoad %uint %c_0 - %249 = OpIAdd %uint %248 %uint_1 - OpStore %c_0 %249 + %247 = OpLoad %uint %c_0 + %248 = OpIAdd %uint %247 %uint_1 + OpStore %c_0 %248 OpBranch %165 %166 = OpLabel OpBranch %157 %157 = OpLabel - %250 = OpLoad %uint %r_0 - %251 = OpIAdd %uint %250 %uint_1 - OpStore %r_0 %251 + %249 = OpLoad %uint %r_0 + %250 = OpIAdd %uint %249 %uint_1 + OpStore %r_0 %250 OpBranch %155 %156 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %252 - %254 = OpLabel - %256 = OpLoad %v3uint %WorkGroupID_1 - %257 = OpLoad %v3uint %LocalInvocationID_1 - %258 = OpLoad %uint %local_invocation_index_1 - %255 = OpFunctionCall %void %main_inner %256 %257 %258 + %main = OpFunction %void None %251 + %253 = OpLabel + %255 = OpLoad %v3uint %WorkGroupID_1 + %256 = OpLoad %v3uint %LocalInvocationID_1 + %257 = OpLoad %uint %local_invocation_index_1 + %254 = OpFunctionCall %void %main_inner %255 %256 %257 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/942.wgsl.expected.wgsl b/test/tint/bug/tint/942.wgsl.expected.wgsl index 99b1bd4646..837581e713 100644 --- a/test/tint/bug/tint/942.wgsl.expected.wgsl +++ b/test/tint/bug/tint/942.wgsl.expected.wgsl @@ -19,7 +19,7 @@ struct Flip { var tile : array, 256>, 4>; -@stage(compute) @workgroup_size(64, 1, 1) +@compute @workgroup_size(64, 1, 1) fn main(@builtin(workgroup_id) WorkGroupID : vec3, @builtin(local_invocation_id) LocalInvocationID : vec3) { let filterOffset : u32 = ((params.filterDim - 1u) / 2u); let dims : vec2 = textureDimensions(inputTex, 0); diff --git a/test/tint/bug/tint/943.spvasm.expected.dxc.hlsl b/test/tint/bug/tint/943.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..ae58a78045 --- /dev/null +++ b/test/tint/bug/tint/943.spvasm.expected.dxc.hlsl @@ -0,0 +1,374 @@ +warning: parameter 'dimInner' of 'mm_matMul_i1_i1_i1_' must be uniform +note: 'workgroupBarrier' must only be called from uniform control flow +note: reading from module-scope private variable 'dimInner_1' may result in a non-uniform value +static int dimAOuter_1 = 0; +cbuffer cbuffer_x_48 : register(b3, space0) { + uint4 x_48[5]; +}; +static int dimInner_1 = 0; +static int dimBOuter_1 = 0; +RWByteAddressBuffer x_54 : register(u0, space0); +static uint3 gl_LocalInvocationID = uint3(0u, 0u, 0u); +static uint3 gl_GlobalInvocationID = uint3(0u, 0u, 0u); +groupshared float mm_Asub[64][64]; +groupshared float mm_Bsub[64][1]; +ByteAddressBuffer x_165 : register(t1, space0); +static int batch = 0; +ByteAddressBuffer x_185 : register(t2, space0); + +bool coordsInBounds_vi2_vi2_(inout int2 coord, inout int2 shape) { + bool x_87 = false; + bool x_88_phi = false; + const int2 x_76 = coord; + const bool x_81 = all((x_76 >= (0).xx)); + x_88_phi = x_81; + if (x_81) { + const int2 x_84 = coord; + const int2 x_85 = shape; + x_87 = all((x_84 < x_85)); + x_88_phi = x_87; + } + return x_88_phi; +} + +float mm_readA_i1_i1_(inout int row, inout int col) { + int batchASize = 0; + int2 param_10 = int2(0, 0); + int2 param_11 = int2(0, 0); + float x_430 = 0.0f; + const int x_417 = asint(x_48[1].y); + const int x_419 = asint(x_48[1].z); + batchASize = (x_417 * x_419); + const int x_421 = row; + const int x_422 = col; + const int x_424 = dimAOuter_1; + const int x_425 = dimInner_1; + param_10 = int2(x_421, x_422); + param_11 = int2(x_424, x_425); + const bool x_429 = coordsInBounds_vi2_vi2_(param_10, param_11); + if (x_429) { + const int x_438 = batch; + const int x_439 = batchASize; + const int x_441 = row; + const int x_442 = dimInner_1; + const int x_445 = col; + const float x_448 = asfloat(x_165.Load((4u * uint((((x_438 * x_439) + (x_441 * x_442)) + x_445))))); + x_430 = x_448; + } else { + x_430 = 0.0f; + } + return x_430; +} + +float mm_readB_i1_i1_(inout int row_1, inout int col_1) { + int batchBSize = 0; + int2 param_12 = int2(0, 0); + int2 param_13 = int2(0, 0); + float x_468 = 0.0f; + const int x_455 = asint(x_48[2].y); + const int x_457 = asint(x_48[2].z); + batchBSize = (x_455 * x_457); + const int x_459 = row_1; + const int x_460 = col_1; + const int x_462 = dimInner_1; + const int x_463 = dimBOuter_1; + param_12 = int2(x_459, x_460); + param_13 = int2(x_462, x_463); + const bool x_467 = coordsInBounds_vi2_vi2_(param_12, param_13); + if (x_467) { + const int x_475 = batch; + const int x_476 = batchBSize; + const int x_478 = row_1; + const int x_479 = dimBOuter_1; + const int x_482 = col_1; + const float x_485 = asfloat(x_185.Load((4u * uint((((x_475 * x_476) + (x_478 * x_479)) + x_482))))); + x_468 = x_485; + } else { + x_468 = 0.0f; + } + return x_468; +} + +int getOutputFlatIndex_vi3_(inout int3 coords) { + const int3 x_99 = coords; + const int x_105 = asint(x_48[4].x); + const int x_107 = asint(x_48[4].y); + return int(dot(float3(x_99), float3(int3(x_105, x_107, 1)))); +} + +void setOutput_i1_f1_(inout int flatIndex, inout float value) { + const int x_95 = flatIndex; + const float x_96 = value; + x_54.Store((4u * uint(x_95)), asuint(x_96)); + return; +} + +void setOutput_i1_i1_i1_f1_(inout int d0, inout int d1, inout int d2, inout float value_1) { + int flatIndex_1 = 0; + int3 param = int3(0, 0, 0); + int param_1 = 0; + float param_2 = 0.0f; + const int x_115 = d0; + const int x_116 = d1; + const int x_117 = d2; + param = int3(x_115, x_116, x_117); + const int x_120 = getOutputFlatIndex_vi3_(param); + flatIndex_1 = x_120; + param_1 = flatIndex_1; + const float x_124 = value_1; + param_2 = x_124; + setOutput_i1_f1_(param_1, param_2); + return; +} + +void mm_write_i1_i1_f1_(inout int row_2, inout int col_2, inout float value_2) { + int3 outCoord = int3(0, 0, 0); + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + float param_17 = 0.0f; + const int x_491 = batch; + const int x_492 = row_2; + const int x_493 = col_2; + outCoord = int3(x_491, x_492, x_493); + param_14 = batch; + const int x_498 = row_2; + param_15 = x_498; + const int x_500 = col_2; + param_16 = x_500; + const float x_502 = value_2; + param_17 = x_502; + setOutput_i1_i1_i1_f1_(param_14, param_15, param_16, param_17); + return; +} + +void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimBOuter) { + int tileRow = 0; + int tileCol = 0; + int globalRow = 0; + int globalCol = 0; + int numTiles = 0; + int innerRow = 0; + int innerCol = 0; + float acc[1][1] = (float[1][1])0; + int tileColA = 0; + int tileRowB = 0; + int t = 0; + int innerRow_1 = 0; + int innerCol_1 = 0; + int inputRow = 0; + int inputCol = 0; + int param_3 = 0; + int param_4 = 0; + int innerRow_2 = 0; + int innerCol_2 = 0; + int inputRow_1 = 0; + int inputCol_1 = 0; + int param_5 = 0; + int param_6 = 0; + int k = 0; + int inner = 0; + float BCached[1] = (float[1])0; + int innerRow_3 = 0; + float ACached = 0.0f; + int innerCol_3 = 0; + int innerRow_4 = 0; + int innerCol_4 = 0; + int param_7 = 0; + int param_8 = 0; + float param_9 = 0.0f; + const uint x_132 = gl_LocalInvocationID.y; + tileRow = (asint(x_132) * 1); + const uint x_137 = gl_LocalInvocationID.x; + tileCol = (asint(x_137) * 1); + const uint x_143 = gl_GlobalInvocationID.y; + globalRow = (asint(x_143) * 1); + const uint x_148 = gl_GlobalInvocationID.x; + globalCol = (asint(x_148) * 1); + const int x_152 = dimInner; + numTiles = (((x_152 - 1) / 64) + 1); + innerRow = 0; + { + [loop] for(; (innerRow < 1); innerRow = (innerRow + 1)) { + innerCol = 0; + { + [loop] for(; (innerCol < 1); innerCol = (innerCol + 1)) { + acc[innerRow][innerCol] = 0.0f; + } + } + } + } + const uint x_187 = gl_LocalInvocationID.x; + tileColA = (asint(x_187) * 64); + const uint x_192 = gl_LocalInvocationID.y; + tileRowB = (asint(x_192) * 1); + t = 0; + { + [loop] for(; (t < numTiles); t = (t + 1)) { + innerRow_1 = 0; + { + [loop] for(; (innerRow_1 < 1); innerRow_1 = (innerRow_1 + 1)) { + innerCol_1 = 0; + { + [loop] for(; (innerCol_1 < 64); innerCol_1 = (innerCol_1 + 1)) { + inputRow = (tileRow + innerRow_1); + inputCol = (tileColA + innerCol_1); + const int x_233 = inputRow; + const int x_234 = inputCol; + const int x_238 = t; + const int x_240 = inputCol; + param_3 = (globalRow + innerRow_1); + param_4 = ((x_238 * 64) + x_240); + const float x_244 = mm_readA_i1_i1_(param_3, param_4); + mm_Asub[x_233][x_234] = x_244; + } + } + } + } + innerRow_2 = 0; + { + [loop] for(; (innerRow_2 < 1); innerRow_2 = (innerRow_2 + 1)) { + innerCol_2 = 0; + { + [loop] for(; (innerCol_2 < 1); innerCol_2 = (innerCol_2 + 1)) { + inputRow_1 = (tileRowB + innerRow_2); + inputCol_1 = (tileCol + innerCol_2); + const int x_278 = inputRow_1; + const int x_279 = inputCol_1; + const int x_284 = globalCol; + const int x_285 = innerCol_2; + param_5 = ((t * 64) + inputRow_1); + param_6 = (x_284 + x_285); + const float x_289 = mm_readB_i1_i1_(param_5, param_6); + mm_Bsub[x_278][x_279] = x_289; + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + k = 0; + { + [loop] for(; (k < 64); k = (k + 1)) { + inner = 0; + { + [loop] for(; (inner < 1); inner = (inner + 1)) { + const int x_314 = inner; + const float x_320 = mm_Bsub[k][(tileCol + inner)]; + BCached[x_314] = x_320; + } + } + innerRow_3 = 0; + { + [loop] for(; (innerRow_3 < 1); innerRow_3 = (innerRow_3 + 1)) { + const float x_338 = mm_Asub[(tileRow + innerRow_3)][k]; + ACached = x_338; + innerCol_3 = 0; + { + [loop] for(; (innerCol_3 < 1); innerCol_3 = (innerCol_3 + 1)) { + const int x_347 = innerRow_3; + const int x_348 = innerCol_3; + const float x_349 = ACached; + const float x_352 = BCached[innerCol_3]; + const float x_355 = acc[x_347][x_348]; + acc[x_347][x_348] = (x_355 + (x_349 * x_352)); + } + } + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + } + } + innerRow_4 = 0; + { + [loop] for(; (innerRow_4 < 1); innerRow_4 = (innerRow_4 + 1)) { + innerCol_4 = 0; + [loop] while (true) { + bool x_393 = false; + bool x_394_phi = false; + if ((innerCol_4 < 1)) { + } else { + break; + } + const int x_382 = globalCol; + const int x_383 = innerCol_4; + const int x_385 = dimBOuter; + const bool x_386 = ((x_382 + x_383) < x_385); + x_394_phi = x_386; + if (x_386) { + const int x_389 = globalRow; + const int x_390 = innerRow_4; + const int x_392 = dimAOuter; + x_393 = ((x_389 + x_390) < x_392); + x_394_phi = x_393; + } + if (x_394_phi) { + const int x_400 = globalCol; + const int x_401 = innerCol_4; + const int x_403 = innerRow_4; + const int x_404 = innerCol_4; + param_7 = (globalRow + innerRow_4); + param_8 = (x_400 + x_401); + const float x_409 = acc[x_403][x_404]; + param_9 = x_409; + mm_write_i1_i1_f1_(param_7, param_8, param_9); + } + { + innerCol_4 = (innerCol_4 + 1); + } + } + } + } + return; +} + +void main_1() { + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + const int x_67 = asint(x_48[1].y); + dimAOuter_1 = x_67; + const int x_71 = asint(x_48[1].z); + dimInner_1 = x_71; + const int x_75 = asint(x_48[2].z); + dimBOuter_1 = x_75; + const uint x_505 = gl_GlobalInvocationID.z; + batch = asint(x_505); + param_18 = dimAOuter_1; + param_19 = dimInner_1; + param_20 = dimBOuter_1; + mm_matMul_i1_i1_i1_(param_18, param_19, param_20); + return; +} + +struct tint_symbol_1 { + uint3 gl_LocalInvocationID_param : SV_GroupThreadID; + uint local_invocation_index : SV_GroupIndex; + uint3 gl_GlobalInvocationID_param : SV_DispatchThreadID; +}; + +void main_inner(uint3 gl_LocalInvocationID_param, uint3 gl_GlobalInvocationID_param, uint local_invocation_index) { + { + const uint i_1 = local_invocation_index; + const uint i_2 = (local_invocation_index % 1u); + mm_Bsub[i_1][i_2] = 0.0f; + } + { + [loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 64u)) { + const uint i = (idx / 64u); + const uint i_1 = (idx % 64u); + mm_Asub[i][i_1] = 0.0f; + } + } + GroupMemoryBarrierWithGroupSync(); + gl_LocalInvocationID = gl_LocalInvocationID_param; + gl_GlobalInvocationID = gl_GlobalInvocationID_param; + main_1(); +} + +[numthreads(1, 64, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.gl_LocalInvocationID_param, tint_symbol.gl_GlobalInvocationID_param, tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/bug/tint/943.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/943.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..ae58a78045 --- /dev/null +++ b/test/tint/bug/tint/943.spvasm.expected.fxc.hlsl @@ -0,0 +1,374 @@ +warning: parameter 'dimInner' of 'mm_matMul_i1_i1_i1_' must be uniform +note: 'workgroupBarrier' must only be called from uniform control flow +note: reading from module-scope private variable 'dimInner_1' may result in a non-uniform value +static int dimAOuter_1 = 0; +cbuffer cbuffer_x_48 : register(b3, space0) { + uint4 x_48[5]; +}; +static int dimInner_1 = 0; +static int dimBOuter_1 = 0; +RWByteAddressBuffer x_54 : register(u0, space0); +static uint3 gl_LocalInvocationID = uint3(0u, 0u, 0u); +static uint3 gl_GlobalInvocationID = uint3(0u, 0u, 0u); +groupshared float mm_Asub[64][64]; +groupshared float mm_Bsub[64][1]; +ByteAddressBuffer x_165 : register(t1, space0); +static int batch = 0; +ByteAddressBuffer x_185 : register(t2, space0); + +bool coordsInBounds_vi2_vi2_(inout int2 coord, inout int2 shape) { + bool x_87 = false; + bool x_88_phi = false; + const int2 x_76 = coord; + const bool x_81 = all((x_76 >= (0).xx)); + x_88_phi = x_81; + if (x_81) { + const int2 x_84 = coord; + const int2 x_85 = shape; + x_87 = all((x_84 < x_85)); + x_88_phi = x_87; + } + return x_88_phi; +} + +float mm_readA_i1_i1_(inout int row, inout int col) { + int batchASize = 0; + int2 param_10 = int2(0, 0); + int2 param_11 = int2(0, 0); + float x_430 = 0.0f; + const int x_417 = asint(x_48[1].y); + const int x_419 = asint(x_48[1].z); + batchASize = (x_417 * x_419); + const int x_421 = row; + const int x_422 = col; + const int x_424 = dimAOuter_1; + const int x_425 = dimInner_1; + param_10 = int2(x_421, x_422); + param_11 = int2(x_424, x_425); + const bool x_429 = coordsInBounds_vi2_vi2_(param_10, param_11); + if (x_429) { + const int x_438 = batch; + const int x_439 = batchASize; + const int x_441 = row; + const int x_442 = dimInner_1; + const int x_445 = col; + const float x_448 = asfloat(x_165.Load((4u * uint((((x_438 * x_439) + (x_441 * x_442)) + x_445))))); + x_430 = x_448; + } else { + x_430 = 0.0f; + } + return x_430; +} + +float mm_readB_i1_i1_(inout int row_1, inout int col_1) { + int batchBSize = 0; + int2 param_12 = int2(0, 0); + int2 param_13 = int2(0, 0); + float x_468 = 0.0f; + const int x_455 = asint(x_48[2].y); + const int x_457 = asint(x_48[2].z); + batchBSize = (x_455 * x_457); + const int x_459 = row_1; + const int x_460 = col_1; + const int x_462 = dimInner_1; + const int x_463 = dimBOuter_1; + param_12 = int2(x_459, x_460); + param_13 = int2(x_462, x_463); + const bool x_467 = coordsInBounds_vi2_vi2_(param_12, param_13); + if (x_467) { + const int x_475 = batch; + const int x_476 = batchBSize; + const int x_478 = row_1; + const int x_479 = dimBOuter_1; + const int x_482 = col_1; + const float x_485 = asfloat(x_185.Load((4u * uint((((x_475 * x_476) + (x_478 * x_479)) + x_482))))); + x_468 = x_485; + } else { + x_468 = 0.0f; + } + return x_468; +} + +int getOutputFlatIndex_vi3_(inout int3 coords) { + const int3 x_99 = coords; + const int x_105 = asint(x_48[4].x); + const int x_107 = asint(x_48[4].y); + return int(dot(float3(x_99), float3(int3(x_105, x_107, 1)))); +} + +void setOutput_i1_f1_(inout int flatIndex, inout float value) { + const int x_95 = flatIndex; + const float x_96 = value; + x_54.Store((4u * uint(x_95)), asuint(x_96)); + return; +} + +void setOutput_i1_i1_i1_f1_(inout int d0, inout int d1, inout int d2, inout float value_1) { + int flatIndex_1 = 0; + int3 param = int3(0, 0, 0); + int param_1 = 0; + float param_2 = 0.0f; + const int x_115 = d0; + const int x_116 = d1; + const int x_117 = d2; + param = int3(x_115, x_116, x_117); + const int x_120 = getOutputFlatIndex_vi3_(param); + flatIndex_1 = x_120; + param_1 = flatIndex_1; + const float x_124 = value_1; + param_2 = x_124; + setOutput_i1_f1_(param_1, param_2); + return; +} + +void mm_write_i1_i1_f1_(inout int row_2, inout int col_2, inout float value_2) { + int3 outCoord = int3(0, 0, 0); + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + float param_17 = 0.0f; + const int x_491 = batch; + const int x_492 = row_2; + const int x_493 = col_2; + outCoord = int3(x_491, x_492, x_493); + param_14 = batch; + const int x_498 = row_2; + param_15 = x_498; + const int x_500 = col_2; + param_16 = x_500; + const float x_502 = value_2; + param_17 = x_502; + setOutput_i1_i1_i1_f1_(param_14, param_15, param_16, param_17); + return; +} + +void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimBOuter) { + int tileRow = 0; + int tileCol = 0; + int globalRow = 0; + int globalCol = 0; + int numTiles = 0; + int innerRow = 0; + int innerCol = 0; + float acc[1][1] = (float[1][1])0; + int tileColA = 0; + int tileRowB = 0; + int t = 0; + int innerRow_1 = 0; + int innerCol_1 = 0; + int inputRow = 0; + int inputCol = 0; + int param_3 = 0; + int param_4 = 0; + int innerRow_2 = 0; + int innerCol_2 = 0; + int inputRow_1 = 0; + int inputCol_1 = 0; + int param_5 = 0; + int param_6 = 0; + int k = 0; + int inner = 0; + float BCached[1] = (float[1])0; + int innerRow_3 = 0; + float ACached = 0.0f; + int innerCol_3 = 0; + int innerRow_4 = 0; + int innerCol_4 = 0; + int param_7 = 0; + int param_8 = 0; + float param_9 = 0.0f; + const uint x_132 = gl_LocalInvocationID.y; + tileRow = (asint(x_132) * 1); + const uint x_137 = gl_LocalInvocationID.x; + tileCol = (asint(x_137) * 1); + const uint x_143 = gl_GlobalInvocationID.y; + globalRow = (asint(x_143) * 1); + const uint x_148 = gl_GlobalInvocationID.x; + globalCol = (asint(x_148) * 1); + const int x_152 = dimInner; + numTiles = (((x_152 - 1) / 64) + 1); + innerRow = 0; + { + [loop] for(; (innerRow < 1); innerRow = (innerRow + 1)) { + innerCol = 0; + { + [loop] for(; (innerCol < 1); innerCol = (innerCol + 1)) { + acc[innerRow][innerCol] = 0.0f; + } + } + } + } + const uint x_187 = gl_LocalInvocationID.x; + tileColA = (asint(x_187) * 64); + const uint x_192 = gl_LocalInvocationID.y; + tileRowB = (asint(x_192) * 1); + t = 0; + { + [loop] for(; (t < numTiles); t = (t + 1)) { + innerRow_1 = 0; + { + [loop] for(; (innerRow_1 < 1); innerRow_1 = (innerRow_1 + 1)) { + innerCol_1 = 0; + { + [loop] for(; (innerCol_1 < 64); innerCol_1 = (innerCol_1 + 1)) { + inputRow = (tileRow + innerRow_1); + inputCol = (tileColA + innerCol_1); + const int x_233 = inputRow; + const int x_234 = inputCol; + const int x_238 = t; + const int x_240 = inputCol; + param_3 = (globalRow + innerRow_1); + param_4 = ((x_238 * 64) + x_240); + const float x_244 = mm_readA_i1_i1_(param_3, param_4); + mm_Asub[x_233][x_234] = x_244; + } + } + } + } + innerRow_2 = 0; + { + [loop] for(; (innerRow_2 < 1); innerRow_2 = (innerRow_2 + 1)) { + innerCol_2 = 0; + { + [loop] for(; (innerCol_2 < 1); innerCol_2 = (innerCol_2 + 1)) { + inputRow_1 = (tileRowB + innerRow_2); + inputCol_1 = (tileCol + innerCol_2); + const int x_278 = inputRow_1; + const int x_279 = inputCol_1; + const int x_284 = globalCol; + const int x_285 = innerCol_2; + param_5 = ((t * 64) + inputRow_1); + param_6 = (x_284 + x_285); + const float x_289 = mm_readB_i1_i1_(param_5, param_6); + mm_Bsub[x_278][x_279] = x_289; + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + k = 0; + { + [loop] for(; (k < 64); k = (k + 1)) { + inner = 0; + { + [loop] for(; (inner < 1); inner = (inner + 1)) { + const int x_314 = inner; + const float x_320 = mm_Bsub[k][(tileCol + inner)]; + BCached[x_314] = x_320; + } + } + innerRow_3 = 0; + { + [loop] for(; (innerRow_3 < 1); innerRow_3 = (innerRow_3 + 1)) { + const float x_338 = mm_Asub[(tileRow + innerRow_3)][k]; + ACached = x_338; + innerCol_3 = 0; + { + [loop] for(; (innerCol_3 < 1); innerCol_3 = (innerCol_3 + 1)) { + const int x_347 = innerRow_3; + const int x_348 = innerCol_3; + const float x_349 = ACached; + const float x_352 = BCached[innerCol_3]; + const float x_355 = acc[x_347][x_348]; + acc[x_347][x_348] = (x_355 + (x_349 * x_352)); + } + } + } + } + } + } + GroupMemoryBarrierWithGroupSync(); + } + } + innerRow_4 = 0; + { + [loop] for(; (innerRow_4 < 1); innerRow_4 = (innerRow_4 + 1)) { + innerCol_4 = 0; + [loop] while (true) { + bool x_393 = false; + bool x_394_phi = false; + if ((innerCol_4 < 1)) { + } else { + break; + } + const int x_382 = globalCol; + const int x_383 = innerCol_4; + const int x_385 = dimBOuter; + const bool x_386 = ((x_382 + x_383) < x_385); + x_394_phi = x_386; + if (x_386) { + const int x_389 = globalRow; + const int x_390 = innerRow_4; + const int x_392 = dimAOuter; + x_393 = ((x_389 + x_390) < x_392); + x_394_phi = x_393; + } + if (x_394_phi) { + const int x_400 = globalCol; + const int x_401 = innerCol_4; + const int x_403 = innerRow_4; + const int x_404 = innerCol_4; + param_7 = (globalRow + innerRow_4); + param_8 = (x_400 + x_401); + const float x_409 = acc[x_403][x_404]; + param_9 = x_409; + mm_write_i1_i1_f1_(param_7, param_8, param_9); + } + { + innerCol_4 = (innerCol_4 + 1); + } + } + } + } + return; +} + +void main_1() { + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + const int x_67 = asint(x_48[1].y); + dimAOuter_1 = x_67; + const int x_71 = asint(x_48[1].z); + dimInner_1 = x_71; + const int x_75 = asint(x_48[2].z); + dimBOuter_1 = x_75; + const uint x_505 = gl_GlobalInvocationID.z; + batch = asint(x_505); + param_18 = dimAOuter_1; + param_19 = dimInner_1; + param_20 = dimBOuter_1; + mm_matMul_i1_i1_i1_(param_18, param_19, param_20); + return; +} + +struct tint_symbol_1 { + uint3 gl_LocalInvocationID_param : SV_GroupThreadID; + uint local_invocation_index : SV_GroupIndex; + uint3 gl_GlobalInvocationID_param : SV_DispatchThreadID; +}; + +void main_inner(uint3 gl_LocalInvocationID_param, uint3 gl_GlobalInvocationID_param, uint local_invocation_index) { + { + const uint i_1 = local_invocation_index; + const uint i_2 = (local_invocation_index % 1u); + mm_Bsub[i_1][i_2] = 0.0f; + } + { + [loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 64u)) { + const uint i = (idx / 64u); + const uint i_1 = (idx % 64u); + mm_Asub[i][i_1] = 0.0f; + } + } + GroupMemoryBarrierWithGroupSync(); + gl_LocalInvocationID = gl_LocalInvocationID_param; + gl_GlobalInvocationID = gl_GlobalInvocationID_param; + main_1(); +} + +[numthreads(1, 64, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.gl_LocalInvocationID_param, tint_symbol.gl_GlobalInvocationID_param, tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/bug/tint/943.spvasm.expected.glsl b/test/tint/bug/tint/943.spvasm.expected.glsl index c488064c12..2f05a683c0 100644 --- a/test/tint/bug/tint/943.spvasm.expected.glsl +++ b/test/tint/bug/tint/943.spvasm.expected.glsl @@ -1,3 +1,6 @@ +warning: parameter 'dimInner' of 'mm_matMul_i1_i1_i1_' must be uniform +note: 'workgroupBarrier' must only be called from uniform control flow +note: reading from module-scope private variable 'dimInner_1' may result in a non-uniform value #version 310 es struct Uniforms { @@ -37,7 +40,7 @@ bool coordsInBounds_vi2_vi2_(inout ivec2 coord, inout ivec2 shape) { bool x_87 = false; bool x_88_phi = false; ivec2 x_76 = coord; - bool x_81 = all(greaterThanEqual(x_76, ivec2(0, 0))); + bool x_81 = all(greaterThanEqual(x_76, ivec2(0))); x_88_phi = x_81; if (x_81) { ivec2 x_84 = coord; diff --git a/test/tint/bug/tint/943.spvasm.expected.hlsl b/test/tint/bug/tint/943.spvasm.expected.hlsl deleted file mode 100644 index bdf9b12cbf..0000000000 --- a/test/tint/bug/tint/943.spvasm.expected.hlsl +++ /dev/null @@ -1,371 +0,0 @@ -static int dimAOuter_1 = 0; -cbuffer cbuffer_x_48 : register(b3, space0) { - uint4 x_48[5]; -}; -static int dimInner_1 = 0; -static int dimBOuter_1 = 0; -RWByteAddressBuffer x_54 : register(u0, space0); -static uint3 gl_LocalInvocationID = uint3(0u, 0u, 0u); -static uint3 gl_GlobalInvocationID = uint3(0u, 0u, 0u); -groupshared float mm_Asub[64][64]; -groupshared float mm_Bsub[64][1]; -ByteAddressBuffer x_165 : register(t1, space0); -static int batch = 0; -ByteAddressBuffer x_185 : register(t2, space0); - -bool coordsInBounds_vi2_vi2_(inout int2 coord, inout int2 shape) { - bool x_87 = false; - bool x_88_phi = false; - const int2 x_76 = coord; - const bool x_81 = all((x_76 >= int2(0, 0))); - x_88_phi = x_81; - if (x_81) { - const int2 x_84 = coord; - const int2 x_85 = shape; - x_87 = all((x_84 < x_85)); - x_88_phi = x_87; - } - return x_88_phi; -} - -float mm_readA_i1_i1_(inout int row, inout int col) { - int batchASize = 0; - int2 param_10 = int2(0, 0); - int2 param_11 = int2(0, 0); - float x_430 = 0.0f; - const int x_417 = asint(x_48[1].y); - const int x_419 = asint(x_48[1].z); - batchASize = (x_417 * x_419); - const int x_421 = row; - const int x_422 = col; - const int x_424 = dimAOuter_1; - const int x_425 = dimInner_1; - param_10 = int2(x_421, x_422); - param_11 = int2(x_424, x_425); - const bool x_429 = coordsInBounds_vi2_vi2_(param_10, param_11); - if (x_429) { - const int x_438 = batch; - const int x_439 = batchASize; - const int x_441 = row; - const int x_442 = dimInner_1; - const int x_445 = col; - const float x_448 = asfloat(x_165.Load((4u * uint((((x_438 * x_439) + (x_441 * x_442)) + x_445))))); - x_430 = x_448; - } else { - x_430 = 0.0f; - } - return x_430; -} - -float mm_readB_i1_i1_(inout int row_1, inout int col_1) { - int batchBSize = 0; - int2 param_12 = int2(0, 0); - int2 param_13 = int2(0, 0); - float x_468 = 0.0f; - const int x_455 = asint(x_48[2].y); - const int x_457 = asint(x_48[2].z); - batchBSize = (x_455 * x_457); - const int x_459 = row_1; - const int x_460 = col_1; - const int x_462 = dimInner_1; - const int x_463 = dimBOuter_1; - param_12 = int2(x_459, x_460); - param_13 = int2(x_462, x_463); - const bool x_467 = coordsInBounds_vi2_vi2_(param_12, param_13); - if (x_467) { - const int x_475 = batch; - const int x_476 = batchBSize; - const int x_478 = row_1; - const int x_479 = dimBOuter_1; - const int x_482 = col_1; - const float x_485 = asfloat(x_185.Load((4u * uint((((x_475 * x_476) + (x_478 * x_479)) + x_482))))); - x_468 = x_485; - } else { - x_468 = 0.0f; - } - return x_468; -} - -int getOutputFlatIndex_vi3_(inout int3 coords) { - const int3 x_99 = coords; - const int x_105 = asint(x_48[4].x); - const int x_107 = asint(x_48[4].y); - return int(dot(float3(x_99), float3(int3(x_105, x_107, 1)))); -} - -void setOutput_i1_f1_(inout int flatIndex, inout float value) { - const int x_95 = flatIndex; - const float x_96 = value; - x_54.Store((4u * uint(x_95)), asuint(x_96)); - return; -} - -void setOutput_i1_i1_i1_f1_(inout int d0, inout int d1, inout int d2, inout float value_1) { - int flatIndex_1 = 0; - int3 param = int3(0, 0, 0); - int param_1 = 0; - float param_2 = 0.0f; - const int x_115 = d0; - const int x_116 = d1; - const int x_117 = d2; - param = int3(x_115, x_116, x_117); - const int x_120 = getOutputFlatIndex_vi3_(param); - flatIndex_1 = x_120; - param_1 = flatIndex_1; - const float x_124 = value_1; - param_2 = x_124; - setOutput_i1_f1_(param_1, param_2); - return; -} - -void mm_write_i1_i1_f1_(inout int row_2, inout int col_2, inout float value_2) { - int3 outCoord = int3(0, 0, 0); - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - float param_17 = 0.0f; - const int x_491 = batch; - const int x_492 = row_2; - const int x_493 = col_2; - outCoord = int3(x_491, x_492, x_493); - param_14 = batch; - const int x_498 = row_2; - param_15 = x_498; - const int x_500 = col_2; - param_16 = x_500; - const float x_502 = value_2; - param_17 = x_502; - setOutput_i1_i1_i1_f1_(param_14, param_15, param_16, param_17); - return; -} - -void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimBOuter) { - int tileRow = 0; - int tileCol = 0; - int globalRow = 0; - int globalCol = 0; - int numTiles = 0; - int innerRow = 0; - int innerCol = 0; - float acc[1][1] = (float[1][1])0; - int tileColA = 0; - int tileRowB = 0; - int t = 0; - int innerRow_1 = 0; - int innerCol_1 = 0; - int inputRow = 0; - int inputCol = 0; - int param_3 = 0; - int param_4 = 0; - int innerRow_2 = 0; - int innerCol_2 = 0; - int inputRow_1 = 0; - int inputCol_1 = 0; - int param_5 = 0; - int param_6 = 0; - int k = 0; - int inner = 0; - float BCached[1] = (float[1])0; - int innerRow_3 = 0; - float ACached = 0.0f; - int innerCol_3 = 0; - int innerRow_4 = 0; - int innerCol_4 = 0; - int param_7 = 0; - int param_8 = 0; - float param_9 = 0.0f; - const uint x_132 = gl_LocalInvocationID.y; - tileRow = (asint(x_132) * 1); - const uint x_137 = gl_LocalInvocationID.x; - tileCol = (asint(x_137) * 1); - const uint x_143 = gl_GlobalInvocationID.y; - globalRow = (asint(x_143) * 1); - const uint x_148 = gl_GlobalInvocationID.x; - globalCol = (asint(x_148) * 1); - const int x_152 = dimInner; - numTiles = (((x_152 - 1) / 64) + 1); - innerRow = 0; - { - [loop] for(; (innerRow < 1); innerRow = (innerRow + 1)) { - innerCol = 0; - { - [loop] for(; (innerCol < 1); innerCol = (innerCol + 1)) { - acc[innerRow][innerCol] = 0.0f; - } - } - } - } - const uint x_187 = gl_LocalInvocationID.x; - tileColA = (asint(x_187) * 64); - const uint x_192 = gl_LocalInvocationID.y; - tileRowB = (asint(x_192) * 1); - t = 0; - { - [loop] for(; (t < numTiles); t = (t + 1)) { - innerRow_1 = 0; - { - [loop] for(; (innerRow_1 < 1); innerRow_1 = (innerRow_1 + 1)) { - innerCol_1 = 0; - { - [loop] for(; (innerCol_1 < 64); innerCol_1 = (innerCol_1 + 1)) { - inputRow = (tileRow + innerRow_1); - inputCol = (tileColA + innerCol_1); - const int x_233 = inputRow; - const int x_234 = inputCol; - const int x_238 = t; - const int x_240 = inputCol; - param_3 = (globalRow + innerRow_1); - param_4 = ((x_238 * 64) + x_240); - const float x_244 = mm_readA_i1_i1_(param_3, param_4); - mm_Asub[x_233][x_234] = x_244; - } - } - } - } - innerRow_2 = 0; - { - [loop] for(; (innerRow_2 < 1); innerRow_2 = (innerRow_2 + 1)) { - innerCol_2 = 0; - { - [loop] for(; (innerCol_2 < 1); innerCol_2 = (innerCol_2 + 1)) { - inputRow_1 = (tileRowB + innerRow_2); - inputCol_1 = (tileCol + innerCol_2); - const int x_278 = inputRow_1; - const int x_279 = inputCol_1; - const int x_284 = globalCol; - const int x_285 = innerCol_2; - param_5 = ((t * 64) + inputRow_1); - param_6 = (x_284 + x_285); - const float x_289 = mm_readB_i1_i1_(param_5, param_6); - mm_Bsub[x_278][x_279] = x_289; - } - } - } - } - GroupMemoryBarrierWithGroupSync(); - k = 0; - { - [loop] for(; (k < 64); k = (k + 1)) { - inner = 0; - { - [loop] for(; (inner < 1); inner = (inner + 1)) { - const int x_314 = inner; - const float x_320 = mm_Bsub[k][(tileCol + inner)]; - BCached[x_314] = x_320; - } - } - innerRow_3 = 0; - { - [loop] for(; (innerRow_3 < 1); innerRow_3 = (innerRow_3 + 1)) { - const float x_338 = mm_Asub[(tileRow + innerRow_3)][k]; - ACached = x_338; - innerCol_3 = 0; - { - [loop] for(; (innerCol_3 < 1); innerCol_3 = (innerCol_3 + 1)) { - const int x_347 = innerRow_3; - const int x_348 = innerCol_3; - const float x_349 = ACached; - const float x_352 = BCached[innerCol_3]; - const float x_355 = acc[x_347][x_348]; - acc[x_347][x_348] = (x_355 + (x_349 * x_352)); - } - } - } - } - } - } - GroupMemoryBarrierWithGroupSync(); - } - } - innerRow_4 = 0; - { - [loop] for(; (innerRow_4 < 1); innerRow_4 = (innerRow_4 + 1)) { - innerCol_4 = 0; - [loop] while (true) { - bool x_393 = false; - bool x_394_phi = false; - if ((innerCol_4 < 1)) { - } else { - break; - } - const int x_382 = globalCol; - const int x_383 = innerCol_4; - const int x_385 = dimBOuter; - const bool x_386 = ((x_382 + x_383) < x_385); - x_394_phi = x_386; - if (x_386) { - const int x_389 = globalRow; - const int x_390 = innerRow_4; - const int x_392 = dimAOuter; - x_393 = ((x_389 + x_390) < x_392); - x_394_phi = x_393; - } - if (x_394_phi) { - const int x_400 = globalCol; - const int x_401 = innerCol_4; - const int x_403 = innerRow_4; - const int x_404 = innerCol_4; - param_7 = (globalRow + innerRow_4); - param_8 = (x_400 + x_401); - const float x_409 = acc[x_403][x_404]; - param_9 = x_409; - mm_write_i1_i1_f1_(param_7, param_8, param_9); - } - { - innerCol_4 = (innerCol_4 + 1); - } - } - } - } - return; -} - -void main_1() { - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - const int x_67 = asint(x_48[1].y); - dimAOuter_1 = x_67; - const int x_71 = asint(x_48[1].z); - dimInner_1 = x_71; - const int x_75 = asint(x_48[2].z); - dimBOuter_1 = x_75; - const uint x_505 = gl_GlobalInvocationID.z; - batch = asint(x_505); - param_18 = dimAOuter_1; - param_19 = dimInner_1; - param_20 = dimBOuter_1; - mm_matMul_i1_i1_i1_(param_18, param_19, param_20); - return; -} - -struct tint_symbol_1 { - uint3 gl_LocalInvocationID_param : SV_GroupThreadID; - uint local_invocation_index : SV_GroupIndex; - uint3 gl_GlobalInvocationID_param : SV_DispatchThreadID; -}; - -void main_inner(uint3 gl_LocalInvocationID_param, uint3 gl_GlobalInvocationID_param, uint local_invocation_index) { - { - const uint i_1 = local_invocation_index; - const uint i_2 = (local_invocation_index % 1u); - mm_Bsub[i_1][i_2] = 0.0f; - } - { - [loop] for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 64u)) { - const uint i = (idx / 64u); - const uint i_1 = (idx % 64u); - mm_Asub[i][i_1] = 0.0f; - } - } - GroupMemoryBarrierWithGroupSync(); - gl_LocalInvocationID = gl_LocalInvocationID_param; - gl_GlobalInvocationID = gl_GlobalInvocationID_param; - main_1(); -} - -[numthreads(1, 64, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.gl_LocalInvocationID_param, tint_symbol.gl_GlobalInvocationID_param, tint_symbol.local_invocation_index); - return; -} diff --git a/test/tint/bug/tint/943.spvasm.expected.msl b/test/tint/bug/tint/943.spvasm.expected.msl index 648486be44..48563e2c00 100644 --- a/test/tint/bug/tint/943.spvasm.expected.msl +++ b/test/tint/bug/tint/943.spvasm.expected.msl @@ -1,51 +1,51 @@ +warning: parameter 'dimInner' of 'mm_matMul_i1_i1_i1_' must be uniform +note: 'workgroupBarrier' must only be called from uniform control flow +note: reading from module-scope private variable 'dimInner_1' may result in a non-uniform value #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ float tint_symbol; - /* 0x0004 */ int8_t tint_pad[12]; + /* 0x0004 */ tint_array tint_pad; /* 0x0010 */ packed_int3 aShape; - /* 0x001c */ int8_t tint_pad_1[4]; + /* 0x001c */ tint_array tint_pad_1; /* 0x0020 */ packed_int3 bShape; - /* 0x002c */ int8_t tint_pad_2[4]; + /* 0x002c */ tint_array tint_pad_2; /* 0x0030 */ packed_int3 outShape; - /* 0x003c */ int8_t tint_pad_3[4]; + /* 0x003c */ tint_array tint_pad_3; /* 0x0040 */ int2 outShapeStrides; }; struct ssbOut { - /* 0x0000 */ float result[1]; + /* 0x0000 */ tint_array result; }; struct ssbA { - /* 0x0000 */ float A[1]; + /* 0x0000 */ tint_array A; }; struct ssbB { - /* 0x0000 */ float B[1]; -}; - -struct tint_array_wrapper_1 { - float arr[64]; -}; - -struct tint_array_wrapper { - tint_array_wrapper_1 arr[64]; -}; - -struct tint_array_wrapper_3 { - float arr[1]; -}; - -struct tint_array_wrapper_2 { - tint_array_wrapper_3 arr[64]; + /* 0x0000 */ tint_array B; }; bool coordsInBounds_vi2_vi2_(thread int2* const coord, thread int2* const shape) { bool x_87 = false; bool x_88_phi = false; int2 const x_76 = *(coord); - bool const x_81 = all((x_76 >= int2(0, 0))); + bool const x_81 = all((x_76 >= int2(0))); x_88_phi = x_81; if (x_81) { int2 const x_84 = *(coord); @@ -172,11 +172,7 @@ void mm_write_i1_i1_f1_(thread int* const row_2, thread int* const col_2, thread return; } -struct tint_array_wrapper_4 { - tint_array_wrapper_3 arr[1]; -}; - -void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner, thread int* const dimBOuter, thread uint3* const tint_symbol_19, thread uint3* const tint_symbol_20, const constant Uniforms* const tint_symbol_21, thread int* const tint_symbol_22, thread int* const tint_symbol_23, thread int* const tint_symbol_24, const device ssbA* const tint_symbol_25, threadgroup tint_array_wrapper* const tint_symbol_26, thread int* const tint_symbol_27, const device ssbB* const tint_symbol_28, threadgroup tint_array_wrapper_2* const tint_symbol_29, device ssbOut* const tint_symbol_30) { +void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner, thread int* const dimBOuter, thread uint3* const tint_symbol_19, thread uint3* const tint_symbol_20, const constant Uniforms* const tint_symbol_21, thread int* const tint_symbol_22, thread int* const tint_symbol_23, thread int* const tint_symbol_24, const device ssbA* const tint_symbol_25, threadgroup tint_array, 64>* const tint_symbol_26, thread int* const tint_symbol_27, const device ssbB* const tint_symbol_28, threadgroup tint_array, 64>* const tint_symbol_29, device ssbOut* const tint_symbol_30) { int tileRow = 0; int tileCol = 0; int globalRow = 0; @@ -184,7 +180,7 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner int numTiles = 0; int innerRow = 0; int innerCol = 0; - tint_array_wrapper_4 acc = {}; + tint_array, 1> acc = {}; int tileColA = 0; int tileRowB = 0; int t = 0; @@ -202,7 +198,7 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner int param_6 = 0; int k = 0; int inner = 0; - tint_array_wrapper_3 BCached = {}; + tint_array BCached = {}; int innerRow_3 = 0; float ACached = 0.0f; int innerCol_3 = 0; @@ -237,7 +233,7 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner } int const x_177 = innerRow; int const x_178 = innerCol; - acc.arr[x_177].arr[x_178] = 0.0f; + acc[x_177][x_178] = 0.0f; { int const x_181 = innerCol; innerCol = as_type((as_type(x_181) + as_type(1))); @@ -289,7 +285,7 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner param_3 = as_type((as_type(x_235) + as_type(x_236))); param_4 = as_type((as_type(as_type((as_type(x_238) * as_type(64)))) + as_type(x_240))); float const x_244 = mm_readA_i1_i1_(&(param_3), &(param_4), tint_symbol_21, tint_symbol_22, tint_symbol_23, tint_symbol_24, tint_symbol_25); - (*(tint_symbol_26)).arr[x_233].arr[x_234] = x_244; + (*(tint_symbol_26))[x_233][x_234] = x_244; { int const x_247 = innerCol_1; innerCol_1 = as_type((as_type(x_247) + as_type(1))); @@ -329,7 +325,7 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner param_5 = as_type((as_type(as_type((as_type(x_280) * as_type(64)))) + as_type(x_282))); param_6 = as_type((as_type(x_284) + as_type(x_285))); float const x_289 = mm_readB_i1_i1_(&(param_5), &(param_6), tint_symbol_21, tint_symbol_23, tint_symbol_27, tint_symbol_24, tint_symbol_28); - (*(tint_symbol_29)).arr[x_278].arr[x_279] = x_289; + (*(tint_symbol_29))[x_278][x_279] = x_289; { int const x_291 = innerCol_2; innerCol_2 = as_type((as_type(x_291) + as_type(1))); @@ -359,8 +355,8 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner int const x_315 = k; int const x_316 = tileCol; int const x_317 = inner; - float const x_320 = (*(tint_symbol_29)).arr[x_315].arr[as_type((as_type(x_316) + as_type(x_317)))]; - BCached.arr[x_314] = x_320; + float const x_320 = (*(tint_symbol_29))[x_315][as_type((as_type(x_316) + as_type(x_317)))]; + BCached[x_314] = x_320; { int const x_322 = inner; inner = as_type((as_type(x_322) + as_type(1))); @@ -376,7 +372,7 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner int const x_333 = tileRow; int const x_334 = innerRow_3; int const x_336 = k; - float const x_338 = (*(tint_symbol_26)).arr[as_type((as_type(x_333) + as_type(x_334)))].arr[x_336]; + float const x_338 = (*(tint_symbol_26))[as_type((as_type(x_333) + as_type(x_334)))][x_336]; ACached = x_338; innerCol_3 = 0; while (true) { @@ -389,9 +385,9 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner int const x_348 = innerCol_3; float const x_349 = ACached; int const x_350 = innerCol_3; - float const x_352 = BCached.arr[x_350]; - float const x_355 = acc.arr[x_347].arr[x_348]; - acc.arr[x_347].arr[x_348] = (x_355 + (x_349 * x_352)); + float const x_352 = BCached[x_350]; + float const x_355 = acc[x_347][x_348]; + acc[x_347][x_348] = (x_355 + (x_349 * x_352)); { int const x_358 = innerCol_3; innerCol_3 = as_type((as_type(x_358) + as_type(1))); @@ -451,7 +447,7 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner int const x_404 = innerCol_4; param_7 = as_type((as_type(x_397) + as_type(x_398))); param_8 = as_type((as_type(x_400) + as_type(x_401))); - float const x_409 = acc.arr[x_403].arr[x_404]; + float const x_409 = acc[x_403][x_404]; param_9 = x_409; mm_write_i1_i1_f1_(&(param_7), &(param_8), &(param_9), tint_symbol_24, tint_symbol_21, tint_symbol_30); } @@ -468,7 +464,7 @@ void mm_matMul_i1_i1_i1_(thread int* const dimAOuter, thread int* const dimInner return; } -void main_1(const constant Uniforms* const tint_symbol_31, thread int* const tint_symbol_32, thread int* const tint_symbol_33, thread int* const tint_symbol_34, thread uint3* const tint_symbol_35, thread int* const tint_symbol_36, thread uint3* const tint_symbol_37, const device ssbA* const tint_symbol_38, threadgroup tint_array_wrapper* const tint_symbol_39, const device ssbB* const tint_symbol_40, threadgroup tint_array_wrapper_2* const tint_symbol_41, device ssbOut* const tint_symbol_42) { +void main_1(const constant Uniforms* const tint_symbol_31, thread int* const tint_symbol_32, thread int* const tint_symbol_33, thread int* const tint_symbol_34, thread uint3* const tint_symbol_35, thread int* const tint_symbol_36, thread uint3* const tint_symbol_37, const device ssbA* const tint_symbol_38, threadgroup tint_array, 64>* const tint_symbol_39, const device ssbB* const tint_symbol_40, threadgroup tint_array, 64>* const tint_symbol_41, device ssbOut* const tint_symbol_42) { int param_18 = 0; int param_19 = 0; int param_20 = 0; @@ -490,16 +486,16 @@ void main_1(const constant Uniforms* const tint_symbol_31, thread int* const tin return; } -void tint_symbol_1_inner(uint3 gl_LocalInvocationID_param, uint3 gl_GlobalInvocationID_param, uint local_invocation_index, threadgroup tint_array_wrapper_2* const tint_symbol_43, threadgroup tint_array_wrapper* const tint_symbol_44, thread uint3* const tint_symbol_45, thread uint3* const tint_symbol_46, const constant Uniforms* const tint_symbol_47, thread int* const tint_symbol_48, thread int* const tint_symbol_49, thread int* const tint_symbol_50, thread int* const tint_symbol_51, const device ssbA* const tint_symbol_52, const device ssbB* const tint_symbol_53, device ssbOut* const tint_symbol_54) { +void tint_symbol_1_inner(uint3 gl_LocalInvocationID_param, uint3 gl_GlobalInvocationID_param, uint local_invocation_index, threadgroup tint_array, 64>* const tint_symbol_43, threadgroup tint_array, 64>* const tint_symbol_44, thread uint3* const tint_symbol_45, thread uint3* const tint_symbol_46, const constant Uniforms* const tint_symbol_47, thread int* const tint_symbol_48, thread int* const tint_symbol_49, thread int* const tint_symbol_50, thread int* const tint_symbol_51, const device ssbA* const tint_symbol_52, const device ssbB* const tint_symbol_53, device ssbOut* const tint_symbol_54) { { uint const i_1 = local_invocation_index; uint const i_2 = (local_invocation_index % 1u); - (*(tint_symbol_43)).arr[i_1].arr[i_2] = float(); + (*(tint_symbol_43))[i_1][i_2] = 0.0f; } for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 64u)) { uint const i = (idx / 64u); uint const i_1 = (idx % 64u); - (*(tint_symbol_44)).arr[i].arr[i_1] = float(); + (*(tint_symbol_44))[i][i_1] = 0.0f; } threadgroup_barrier(mem_flags::mem_threadgroup); *(tint_symbol_45) = gl_LocalInvocationID_param; @@ -508,8 +504,8 @@ void tint_symbol_1_inner(uint3 gl_LocalInvocationID_param, uint3 gl_GlobalInvoca } kernel void tint_symbol_1(const constant Uniforms* tint_symbol_59 [[buffer(0)]], const device ssbA* tint_symbol_64 [[buffer(2)]], const device ssbB* tint_symbol_65 [[buffer(3)]], device ssbOut* tint_symbol_66 [[buffer(1)]], uint3 gl_LocalInvocationID_param [[thread_position_in_threadgroup]], uint3 gl_GlobalInvocationID_param [[thread_position_in_grid]], uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup tint_array_wrapper_2 tint_symbol_55; - threadgroup tint_array_wrapper tint_symbol_56; + threadgroup tint_array, 64> tint_symbol_55; + threadgroup tint_array, 64> tint_symbol_56; thread uint3 tint_symbol_57 = 0u; thread uint3 tint_symbol_58 = 0u; thread int tint_symbol_60 = 0; diff --git a/test/tint/bug/tint/943.spvasm.expected.spvasm b/test/tint/bug/tint/943.spvasm.expected.spvasm index 315f30ea0f..f177fa1d19 100644 --- a/test/tint/bug/tint/943.spvasm.expected.spvasm +++ b/test/tint/bug/tint/943.spvasm.expected.spvasm @@ -1,7 +1,10 @@ +warning: parameter 'dimInner' of 'mm_matMul_i1_i1_i1_' must be uniform +note: 'workgroupBarrier' must only be called from uniform control flow +note: reading from module-scope private variable 'dimInner_1' may result in a non-uniform value ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 633 +; Bound: 630 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -207,43 +210,40 @@ %45 = OpTypeFunction %bool %_ptr_Function_v2int %_ptr_Function_v2int %_ptr_Function_bool = OpTypePointer Function %bool %54 = OpConstantNull %bool - %int_0 = OpConstant %int 0 - %60 = OpConstantComposite %v2int %int_0 %int_0 + %59 = OpConstantNull %v2int %v2bool = OpTypeVector %bool 2 %_ptr_Function_int = OpTypePointer Function %int - %73 = OpTypeFunction %float %_ptr_Function_int %_ptr_Function_int - %81 = OpConstantNull %v2int + %72 = OpTypeFunction %float %_ptr_Function_int %_ptr_Function_int %_ptr_Function_float = OpTypePointer Function %float - %85 = OpConstantNull %float + %83 = OpConstantNull %float %_ptr_Uniform_int = OpTypePointer Uniform %int %uint_2 = OpConstant %uint 2 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float - %float_0 = OpConstant %float 0 %_ptr_Function_v3int = OpTypePointer Function %v3int - %165 = OpTypeFunction %int %_ptr_Function_v3int + %162 = OpTypeFunction %int %_ptr_Function_v3int %uint_4 = OpConstant %uint 4 %v3float = OpTypeVector %float 3 %int_1 = OpConstant %int 1 %void = OpTypeVoid - %184 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_float - %195 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int %_ptr_Function_float - %204 = OpConstantNull %v3int - %222 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_float - %251 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %181 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_float + %192 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int %_ptr_Function_float + %201 = OpConstantNull %v3int + %219 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_float + %248 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int %_arr__arr_float_uint_1_uint_1 = OpTypeArray %_arr_float_uint_1 %uint_1 %_ptr_Function__arr__arr_float_uint_1_uint_1 = OpTypePointer Function %_arr__arr_float_uint_1_uint_1 - %267 = OpConstantNull %_arr__arr_float_uint_1_uint_1 + %264 = OpConstantNull %_arr__arr_float_uint_1_uint_1 %_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 - %287 = OpConstantNull %_arr_float_uint_1 + %284 = OpConstantNull %_arr_float_uint_1 %_ptr_Private_uint = OpTypePointer Private %uint %int_64 = OpConstant %int 64 %_ptr_Workgroup_float = OpTypePointer Workgroup %float %uint_264 = OpConstant %uint 264 - %575 = OpTypeFunction %void - %597 = OpTypeFunction %void %v3uint %v3uint %uint + %572 = OpTypeFunction %void + %594 = OpTypeFunction %void %v3uint %v3uint %uint %_ptr_Function_uint = OpTypePointer Function %uint - %607 = OpConstantNull %uint + %604 = OpConstantNull %uint %uint_4096 = OpConstant %uint 4096 %coordsInBounds_vi2_vi2_ = OpFunction %bool None %45 %coord = OpFunctionParameter %_ptr_Function_v2int @@ -252,196 +252,196 @@ %x_87 = OpVariable %_ptr_Function_bool Function %54 %x_88_phi = OpVariable %_ptr_Function_bool Function %54 %57 = OpLoad %v2int %coord - %61 = OpSGreaterThanEqual %v2bool %57 %60 - %58 = OpAll %bool %61 + %60 = OpSGreaterThanEqual %v2bool %57 %59 + %58 = OpAll %bool %60 OpStore %x_88_phi %58 - OpSelectionMerge %63 None - OpBranchConditional %58 %64 %63 - %64 = OpLabel - %66 = OpLoad %v2int %coord - %68 = OpLoad %v2int %shape - %70 = OpSLessThan %v2bool %66 %68 - %69 = OpAll %bool %70 - OpStore %x_87 %69 - %71 = OpLoad %bool %x_87 - OpStore %x_88_phi %71 - OpBranch %63 + OpSelectionMerge %62 None + OpBranchConditional %58 %63 %62 %63 = OpLabel - %72 = OpLoad %bool %x_88_phi - OpReturnValue %72 + %65 = OpLoad %v2int %coord + %67 = OpLoad %v2int %shape + %69 = OpSLessThan %v2bool %65 %67 + %68 = OpAll %bool %69 + OpStore %x_87 %68 + %70 = OpLoad %bool %x_87 + OpStore %x_88_phi %70 + OpBranch %62 + %62 = OpLabel + %71 = OpLoad %bool %x_88_phi + OpReturnValue %71 OpFunctionEnd -%mm_readA_i1_i1_ = OpFunction %float None %73 +%mm_readA_i1_i1_ = OpFunction %float None %72 %row = OpFunctionParameter %_ptr_Function_int %col = OpFunctionParameter %_ptr_Function_int - %78 = OpLabel + %77 = OpLabel %batchASize = OpVariable %_ptr_Function_int Function %11 - %param_10 = OpVariable %_ptr_Function_v2int Function %81 - %param_11 = OpVariable %_ptr_Function_v2int Function %81 - %x_430 = OpVariable %_ptr_Function_float Function %85 - %87 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_1 %uint_1 - %88 = OpLoad %int %87 - %90 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_1 %uint_2 - %91 = OpLoad %int %90 - %92 = OpIMul %int %88 %91 - OpStore %batchASize %92 - %94 = OpLoad %int %row - %96 = OpLoad %int %col - %97 = OpLoad %int %dimAOuter_1 - %98 = OpLoad %int %dimInner_1 - %99 = OpCompositeConstruct %v2int %94 %96 - OpStore %param_10 %99 - %100 = OpCompositeConstruct %v2int %97 %98 - OpStore %param_11 %100 - %101 = OpFunctionCall %bool %coordsInBounds_vi2_vi2_ %param_10 %param_11 - OpSelectionMerge %104 None - OpBranchConditional %101 %105 %106 - %105 = OpLabel - %107 = OpLoad %int %batch - %108 = OpLoad %int %batchASize - %110 = OpLoad %int %row - %111 = OpLoad %int %dimInner_1 - %113 = OpLoad %int %col - %115 = OpIMul %int %107 %108 - %116 = OpIMul %int %110 %111 - %117 = OpIAdd %int %115 %116 - %118 = OpIAdd %int %117 %113 - %120 = OpAccessChain %_ptr_StorageBuffer_float %x_165 %uint_0 %118 - %121 = OpLoad %float %120 - OpStore %x_430 %121 - OpBranch %104 - %106 = OpLabel - OpStore %x_430 %float_0 - OpBranch %104 + %param_10 = OpVariable %_ptr_Function_v2int Function %59 + %param_11 = OpVariable %_ptr_Function_v2int Function %59 + %x_430 = OpVariable %_ptr_Function_float Function %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_1 %uint_1 + %86 = OpLoad %int %85 + %88 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_1 %uint_2 + %89 = OpLoad %int %88 + %90 = OpIMul %int %86 %89 + OpStore %batchASize %90 + %92 = OpLoad %int %row + %94 = OpLoad %int %col + %95 = OpLoad %int %dimAOuter_1 + %96 = OpLoad %int %dimInner_1 + %97 = OpCompositeConstruct %v2int %92 %94 + OpStore %param_10 %97 + %98 = OpCompositeConstruct %v2int %95 %96 + OpStore %param_11 %98 + %99 = OpFunctionCall %bool %coordsInBounds_vi2_vi2_ %param_10 %param_11 + OpSelectionMerge %102 None + OpBranchConditional %99 %103 %104 + %103 = OpLabel + %105 = OpLoad %int %batch + %106 = OpLoad %int %batchASize + %108 = OpLoad %int %row + %109 = OpLoad %int %dimInner_1 + %111 = OpLoad %int %col + %113 = OpIMul %int %105 %106 + %114 = OpIMul %int %108 %109 + %115 = OpIAdd %int %113 %114 + %116 = OpIAdd %int %115 %111 + %118 = OpAccessChain %_ptr_StorageBuffer_float %x_165 %uint_0 %116 + %119 = OpLoad %float %118 + OpStore %x_430 %119 + OpBranch %102 %104 = OpLabel - %123 = OpLoad %float %x_430 - OpReturnValue %123 + OpStore %x_430 %83 + OpBranch %102 + %102 = OpLabel + %120 = OpLoad %float %x_430 + OpReturnValue %120 OpFunctionEnd -%mm_readB_i1_i1_ = OpFunction %float None %73 +%mm_readB_i1_i1_ = OpFunction %float None %72 %row_1 = OpFunctionParameter %_ptr_Function_int %col_1 = OpFunctionParameter %_ptr_Function_int - %127 = OpLabel + %124 = OpLabel %batchBSize = OpVariable %_ptr_Function_int Function %11 - %param_12 = OpVariable %_ptr_Function_v2int Function %81 - %param_13 = OpVariable %_ptr_Function_v2int Function %81 - %x_468 = OpVariable %_ptr_Function_float Function %85 - %132 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_2 %uint_1 - %133 = OpLoad %int %132 - %134 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_2 %uint_2 - %135 = OpLoad %int %134 - %136 = OpIMul %int %133 %135 - OpStore %batchBSize %136 - %138 = OpLoad %int %row_1 - %140 = OpLoad %int %col_1 - %141 = OpLoad %int %dimInner_1 - %142 = OpLoad %int %dimBOuter_1 - %143 = OpCompositeConstruct %v2int %138 %140 - OpStore %param_12 %143 - %144 = OpCompositeConstruct %v2int %141 %142 - OpStore %param_13 %144 - %145 = OpFunctionCall %bool %coordsInBounds_vi2_vi2_ %param_12 %param_13 - OpSelectionMerge %148 None - OpBranchConditional %145 %149 %150 - %149 = OpLabel - %151 = OpLoad %int %batch - %152 = OpLoad %int %batchBSize - %154 = OpLoad %int %row_1 - %155 = OpLoad %int %dimBOuter_1 - %157 = OpLoad %int %col_1 - %158 = OpIMul %int %151 %152 - %159 = OpIMul %int %154 %155 - %160 = OpIAdd %int %158 %159 - %161 = OpIAdd %int %160 %157 - %162 = OpAccessChain %_ptr_StorageBuffer_float %x_185 %uint_0 %161 - %163 = OpLoad %float %162 - OpStore %x_468 %163 - OpBranch %148 - %150 = OpLabel - OpStore %x_468 %float_0 - OpBranch %148 - %148 = OpLabel - %164 = OpLoad %float %x_468 - OpReturnValue %164 + %param_12 = OpVariable %_ptr_Function_v2int Function %59 + %param_13 = OpVariable %_ptr_Function_v2int Function %59 + %x_468 = OpVariable %_ptr_Function_float Function %83 + %129 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_2 %uint_1 + %130 = OpLoad %int %129 + %131 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_2 %uint_2 + %132 = OpLoad %int %131 + %133 = OpIMul %int %130 %132 + OpStore %batchBSize %133 + %135 = OpLoad %int %row_1 + %137 = OpLoad %int %col_1 + %138 = OpLoad %int %dimInner_1 + %139 = OpLoad %int %dimBOuter_1 + %140 = OpCompositeConstruct %v2int %135 %137 + OpStore %param_12 %140 + %141 = OpCompositeConstruct %v2int %138 %139 + OpStore %param_13 %141 + %142 = OpFunctionCall %bool %coordsInBounds_vi2_vi2_ %param_12 %param_13 + OpSelectionMerge %145 None + OpBranchConditional %142 %146 %147 + %146 = OpLabel + %148 = OpLoad %int %batch + %149 = OpLoad %int %batchBSize + %151 = OpLoad %int %row_1 + %152 = OpLoad %int %dimBOuter_1 + %154 = OpLoad %int %col_1 + %155 = OpIMul %int %148 %149 + %156 = OpIMul %int %151 %152 + %157 = OpIAdd %int %155 %156 + %158 = OpIAdd %int %157 %154 + %159 = OpAccessChain %_ptr_StorageBuffer_float %x_185 %uint_0 %158 + %160 = OpLoad %float %159 + OpStore %x_468 %160 + OpBranch %145 + %147 = OpLabel + OpStore %x_468 %83 + OpBranch %145 + %145 = OpLabel + %161 = OpLoad %float %x_468 + OpReturnValue %161 OpFunctionEnd -%getOutputFlatIndex_vi3_ = OpFunction %int None %165 +%getOutputFlatIndex_vi3_ = OpFunction %int None %162 %coords = OpFunctionParameter %_ptr_Function_v3int - %169 = OpLabel - %171 = OpLoad %v3int %coords - %173 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_4 %uint_0 - %174 = OpLoad %int %173 - %175 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_4 %uint_1 - %176 = OpLoad %int %175 - %179 = OpConvertSToF %v3float %171 - %183 = OpCompositeConstruct %v3int %174 %176 %int_1 - %181 = OpConvertSToF %v3float %183 - %178 = OpDot %float %179 %181 - %177 = OpConvertFToS %int %178 - OpReturnValue %177 + %166 = OpLabel + %168 = OpLoad %v3int %coords + %170 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_4 %uint_0 + %171 = OpLoad %int %170 + %172 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_4 %uint_1 + %173 = OpLoad %int %172 + %176 = OpConvertSToF %v3float %168 + %180 = OpCompositeConstruct %v3int %171 %173 %int_1 + %178 = OpConvertSToF %v3float %180 + %175 = OpDot %float %176 %178 + %174 = OpConvertFToS %int %175 + OpReturnValue %174 OpFunctionEnd -%setOutput_i1_f1_ = OpFunction %void None %184 +%setOutput_i1_f1_ = OpFunction %void None %181 %flatIndex = OpFunctionParameter %_ptr_Function_int %value = OpFunctionParameter %_ptr_Function_float - %189 = OpLabel - %191 = OpLoad %int %flatIndex - %193 = OpLoad %float %value - %194 = OpAccessChain %_ptr_StorageBuffer_float %x_54 %uint_0 %191 - OpStore %194 %193 + %186 = OpLabel + %188 = OpLoad %int %flatIndex + %190 = OpLoad %float %value + %191 = OpAccessChain %_ptr_StorageBuffer_float %x_54 %uint_0 %188 + OpStore %191 %190 OpReturn OpFunctionEnd -%setOutput_i1_i1_i1_f1_ = OpFunction %void None %195 +%setOutput_i1_i1_i1_f1_ = OpFunction %void None %192 %d0 = OpFunctionParameter %_ptr_Function_int %d1 = OpFunctionParameter %_ptr_Function_int %d2 = OpFunctionParameter %_ptr_Function_int %value_1 = OpFunctionParameter %_ptr_Function_float - %201 = OpLabel + %198 = OpLabel %flatIndex_1 = OpVariable %_ptr_Function_int Function %11 - %param = OpVariable %_ptr_Function_v3int Function %204 + %param = OpVariable %_ptr_Function_v3int Function %201 %param_1 = OpVariable %_ptr_Function_int Function %11 - %param_2 = OpVariable %_ptr_Function_float Function %85 - %208 = OpLoad %int %d0 - %210 = OpLoad %int %d1 - %212 = OpLoad %int %d2 - %213 = OpCompositeConstruct %v3int %208 %210 %212 - OpStore %param %213 - %214 = OpFunctionCall %int %getOutputFlatIndex_vi3_ %param - OpStore %flatIndex_1 %214 - %216 = OpLoad %int %flatIndex_1 - OpStore %param_1 %216 - %218 = OpLoad %float %value_1 - OpStore %param_2 %218 - %219 = OpFunctionCall %void %setOutput_i1_f1_ %param_1 %param_2 + %param_2 = OpVariable %_ptr_Function_float Function %83 + %205 = OpLoad %int %d0 + %207 = OpLoad %int %d1 + %209 = OpLoad %int %d2 + %210 = OpCompositeConstruct %v3int %205 %207 %209 + OpStore %param %210 + %211 = OpFunctionCall %int %getOutputFlatIndex_vi3_ %param + OpStore %flatIndex_1 %211 + %213 = OpLoad %int %flatIndex_1 + OpStore %param_1 %213 + %215 = OpLoad %float %value_1 + OpStore %param_2 %215 + %216 = OpFunctionCall %void %setOutput_i1_f1_ %param_1 %param_2 OpReturn OpFunctionEnd -%mm_write_i1_i1_f1_ = OpFunction %void None %222 +%mm_write_i1_i1_f1_ = OpFunction %void None %219 %row_2 = OpFunctionParameter %_ptr_Function_int %col_2 = OpFunctionParameter %_ptr_Function_int %value_2 = OpFunctionParameter %_ptr_Function_float - %227 = OpLabel - %outCoord = OpVariable %_ptr_Function_v3int Function %204 + %224 = OpLabel + %outCoord = OpVariable %_ptr_Function_v3int Function %201 %param_14 = OpVariable %_ptr_Function_int Function %11 %param_15 = OpVariable %_ptr_Function_int Function %11 %param_16 = OpVariable %_ptr_Function_int Function %11 - %param_17 = OpVariable %_ptr_Function_float Function %85 - %233 = OpLoad %int %batch - %235 = OpLoad %int %row_2 - %237 = OpLoad %int %col_2 - %238 = OpCompositeConstruct %v3int %233 %235 %237 - OpStore %outCoord %238 - %239 = OpLoad %int %batch - OpStore %param_14 %239 - %241 = OpLoad %int %row_2 - OpStore %param_15 %241 - %243 = OpLoad %int %col_2 - OpStore %param_16 %243 - %245 = OpLoad %float %value_2 - OpStore %param_17 %245 - %246 = OpFunctionCall %void %setOutput_i1_i1_i1_f1_ %param_14 %param_15 %param_16 %param_17 + %param_17 = OpVariable %_ptr_Function_float Function %83 + %230 = OpLoad %int %batch + %232 = OpLoad %int %row_2 + %234 = OpLoad %int %col_2 + %235 = OpCompositeConstruct %v3int %230 %232 %234 + OpStore %outCoord %235 + %236 = OpLoad %int %batch + OpStore %param_14 %236 + %238 = OpLoad %int %row_2 + OpStore %param_15 %238 + %240 = OpLoad %int %col_2 + OpStore %param_16 %240 + %242 = OpLoad %float %value_2 + OpStore %param_17 %242 + %243 = OpFunctionCall %void %setOutput_i1_i1_i1_f1_ %param_14 %param_15 %param_16 %param_17 OpReturn OpFunctionEnd -%mm_matMul_i1_i1_i1_ = OpFunction %void None %251 +%mm_matMul_i1_i1_i1_ = OpFunction %void None %248 %dimAOuter = OpFunctionParameter %_ptr_Function_int %dimInner = OpFunctionParameter %_ptr_Function_int %dimBOuter = OpFunctionParameter %_ptr_Function_int - %256 = OpLabel + %253 = OpLabel %tileRow = OpVariable %_ptr_Function_int Function %11 %tileCol = OpVariable %_ptr_Function_int Function %11 %globalRow = OpVariable %_ptr_Function_int Function %11 @@ -449,7 +449,7 @@ %numTiles = OpVariable %_ptr_Function_int Function %11 %innerRow = OpVariable %_ptr_Function_int Function %11 %innerCol = OpVariable %_ptr_Function_int Function %11 - %acc = OpVariable %_ptr_Function__arr__arr_float_uint_1_uint_1 Function %267 + %acc = OpVariable %_ptr_Function__arr__arr_float_uint_1_uint_1 Function %264 %tileColA = OpVariable %_ptr_Function_int Function %11 %tileRowB = OpVariable %_ptr_Function_int Function %11 %t = OpVariable %_ptr_Function_int Function %11 @@ -467,532 +467,532 @@ %param_6 = OpVariable %_ptr_Function_int Function %11 %k = OpVariable %_ptr_Function_int Function %11 %inner = OpVariable %_ptr_Function_int Function %11 - %BCached = OpVariable %_ptr_Function__arr_float_uint_1 Function %287 + %BCached = OpVariable %_ptr_Function__arr_float_uint_1 Function %284 %innerRow_3 = OpVariable %_ptr_Function_int Function %11 - %ACached = OpVariable %_ptr_Function_float Function %85 + %ACached = OpVariable %_ptr_Function_float Function %83 %innerCol_3 = OpVariable %_ptr_Function_int Function %11 %innerRow_4 = OpVariable %_ptr_Function_int Function %11 %innerCol_4 = OpVariable %_ptr_Function_int Function %11 %param_7 = OpVariable %_ptr_Function_int Function %11 %param_8 = OpVariable %_ptr_Function_int Function %11 - %param_9 = OpVariable %_ptr_Function_float Function %85 + %param_9 = OpVariable %_ptr_Function_float Function %83 %x_393 = OpVariable %_ptr_Function_bool Function %54 %x_394_phi = OpVariable %_ptr_Function_bool Function %54 - %297 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_1 - %298 = OpLoad %uint %297 - %299 = OpBitcast %int %298 - %300 = OpIMul %int %299 %int_1 - OpStore %tileRow %300 - %301 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_0 - %302 = OpLoad %uint %301 - %303 = OpBitcast %int %302 - %304 = OpIMul %int %303 %int_1 - OpStore %tileCol %304 - %305 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_1 - %306 = OpLoad %uint %305 - %307 = OpBitcast %int %306 - %308 = OpIMul %int %307 %int_1 - OpStore %globalRow %308 - %309 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 - %310 = OpLoad %uint %309 - %311 = OpBitcast %int %310 - %312 = OpIMul %int %311 %int_1 - OpStore %globalCol %312 - %314 = OpLoad %int %dimInner - %315 = OpISub %int %314 %int_1 - %317 = OpSDiv %int %315 %int_64 - %318 = OpIAdd %int %317 %int_1 - OpStore %numTiles %318 - OpStore %innerRow %int_0 + %294 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_1 + %295 = OpLoad %uint %294 + %296 = OpBitcast %int %295 + %297 = OpIMul %int %296 %int_1 + OpStore %tileRow %297 + %298 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_0 + %299 = OpLoad %uint %298 + %300 = OpBitcast %int %299 + %301 = OpIMul %int %300 %int_1 + OpStore %tileCol %301 + %302 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_1 + %303 = OpLoad %uint %302 + %304 = OpBitcast %int %303 + %305 = OpIMul %int %304 %int_1 + OpStore %globalRow %305 + %306 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %307 = OpLoad %uint %306 + %308 = OpBitcast %int %307 + %309 = OpIMul %int %308 %int_1 + OpStore %globalCol %309 + %311 = OpLoad %int %dimInner + %312 = OpISub %int %311 %int_1 + %314 = OpSDiv %int %312 %int_64 + %315 = OpIAdd %int %314 %int_1 + OpStore %numTiles %315 + OpStore %innerRow %11 + OpBranch %316 + %316 = OpLabel + OpLoopMerge %317 %318 None OpBranch %319 %319 = OpLabel - OpLoopMerge %320 %321 None + %320 = OpLoad %int %innerRow + %321 = OpSLessThan %bool %320 %int_1 + OpSelectionMerge %322 None + OpBranchConditional %321 %323 %324 + %323 = OpLabel OpBranch %322 + %324 = OpLabel + OpBranch %317 %322 = OpLabel - %323 = OpLoad %int %innerRow - %324 = OpSLessThan %bool %323 %int_1 - OpSelectionMerge %325 None - OpBranchConditional %324 %326 %327 - %326 = OpLabel + OpStore %innerCol %11 OpBranch %325 - %327 = OpLabel - OpBranch %320 %325 = OpLabel - OpStore %innerCol %int_0 + OpLoopMerge %326 %327 None OpBranch %328 %328 = OpLabel - OpLoopMerge %329 %330 None + %329 = OpLoad %int %innerCol + %330 = OpSLessThan %bool %329 %int_1 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %333 + %332 = OpLabel OpBranch %331 + %333 = OpLabel + OpBranch %326 %331 = OpLabel - %332 = OpLoad %int %innerCol - %333 = OpSLessThan %bool %332 %int_1 - OpSelectionMerge %334 None - OpBranchConditional %333 %335 %336 - %335 = OpLabel - OpBranch %334 - %336 = OpLabel - OpBranch %329 - %334 = OpLabel - %337 = OpLoad %int %innerRow - %338 = OpLoad %int %innerCol - %339 = OpAccessChain %_ptr_Function_float %acc %337 %338 - OpStore %339 %float_0 - OpBranch %330 - %330 = OpLabel - %340 = OpLoad %int %innerCol - %341 = OpIAdd %int %340 %int_1 - OpStore %innerCol %341 - OpBranch %328 - %329 = OpLabel - OpBranch %321 - %321 = OpLabel - %342 = OpLoad %int %innerRow - %343 = OpIAdd %int %342 %int_1 - OpStore %innerRow %343 - OpBranch %319 - %320 = OpLabel - %344 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_0 - %345 = OpLoad %uint %344 - %346 = OpBitcast %int %345 - %347 = OpIMul %int %346 %int_64 - OpStore %tileColA %347 - %348 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_1 - %349 = OpLoad %uint %348 - %350 = OpBitcast %int %349 - %351 = OpIMul %int %350 %int_1 - OpStore %tileRowB %351 - OpStore %t %int_0 + %334 = OpLoad %int %innerRow + %335 = OpLoad %int %innerCol + %336 = OpAccessChain %_ptr_Function_float %acc %334 %335 + OpStore %336 %83 + OpBranch %327 + %327 = OpLabel + %337 = OpLoad %int %innerCol + %338 = OpIAdd %int %337 %int_1 + OpStore %innerCol %338 + OpBranch %325 + %326 = OpLabel + OpBranch %318 + %318 = OpLabel + %339 = OpLoad %int %innerRow + %340 = OpIAdd %int %339 %int_1 + OpStore %innerRow %340 + OpBranch %316 + %317 = OpLabel + %341 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_0 + %342 = OpLoad %uint %341 + %343 = OpBitcast %int %342 + %344 = OpIMul %int %343 %int_64 + OpStore %tileColA %344 + %345 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_1 + %346 = OpLoad %uint %345 + %347 = OpBitcast %int %346 + %348 = OpIMul %int %347 %int_1 + OpStore %tileRowB %348 + OpStore %t %11 + OpBranch %349 + %349 = OpLabel + OpLoopMerge %350 %351 None OpBranch %352 %352 = OpLabel - OpLoopMerge %353 %354 None - OpBranch %355 - %355 = OpLabel - %356 = OpLoad %int %t - %357 = OpLoad %int %numTiles - %358 = OpSLessThan %bool %356 %357 - OpSelectionMerge %359 None - OpBranchConditional %358 %360 %361 - %360 = OpLabel + %353 = OpLoad %int %t + %354 = OpLoad %int %numTiles + %355 = OpSLessThan %bool %353 %354 + OpSelectionMerge %356 None + OpBranchConditional %355 %357 %358 + %357 = OpLabel + OpBranch %356 + %358 = OpLabel + OpBranch %350 + %356 = OpLabel + OpStore %innerRow_1 %11 OpBranch %359 - %361 = OpLabel - OpBranch %353 %359 = OpLabel - OpStore %innerRow_1 %int_0 + OpLoopMerge %360 %361 None OpBranch %362 %362 = OpLabel - OpLoopMerge %363 %364 None + %363 = OpLoad %int %innerRow_1 + %364 = OpSLessThan %bool %363 %int_1 + OpSelectionMerge %365 None + OpBranchConditional %364 %366 %367 + %366 = OpLabel OpBranch %365 + %367 = OpLabel + OpBranch %360 %365 = OpLabel - %366 = OpLoad %int %innerRow_1 - %367 = OpSLessThan %bool %366 %int_1 - OpSelectionMerge %368 None - OpBranchConditional %367 %369 %370 - %369 = OpLabel + OpStore %innerCol_1 %11 OpBranch %368 - %370 = OpLabel - OpBranch %363 %368 = OpLabel - OpStore %innerCol_1 %int_0 + OpLoopMerge %369 %370 None OpBranch %371 %371 = OpLabel - OpLoopMerge %372 %373 None + %372 = OpLoad %int %innerCol_1 + %373 = OpSLessThan %bool %372 %int_64 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %376 + %375 = OpLabel OpBranch %374 + %376 = OpLabel + OpBranch %369 %374 = OpLabel - %375 = OpLoad %int %innerCol_1 - %376 = OpSLessThan %bool %375 %int_64 - OpSelectionMerge %377 None - OpBranchConditional %376 %378 %379 - %378 = OpLabel - OpBranch %377 - %379 = OpLabel - OpBranch %372 - %377 = OpLabel - %380 = OpLoad %int %tileRow - %381 = OpLoad %int %innerRow_1 + %377 = OpLoad %int %tileRow + %378 = OpLoad %int %innerRow_1 + %379 = OpIAdd %int %377 %378 + OpStore %inputRow %379 + %380 = OpLoad %int %tileColA + %381 = OpLoad %int %innerCol_1 %382 = OpIAdd %int %380 %381 - OpStore %inputRow %382 - %383 = OpLoad %int %tileColA - %384 = OpLoad %int %innerCol_1 - %385 = OpIAdd %int %383 %384 - OpStore %inputCol %385 - %386 = OpLoad %int %inputRow - %387 = OpLoad %int %inputCol - %388 = OpLoad %int %globalRow - %389 = OpLoad %int %innerRow_1 - %390 = OpLoad %int %t - %391 = OpLoad %int %inputCol - %392 = OpIAdd %int %388 %389 - OpStore %param_3 %392 - %393 = OpIMul %int %390 %int_64 - %394 = OpIAdd %int %393 %391 - OpStore %param_4 %394 - %395 = OpFunctionCall %float %mm_readA_i1_i1_ %param_3 %param_4 - %399 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %386 %387 - OpStore %399 %395 - OpBranch %373 - %373 = OpLabel - %400 = OpLoad %int %innerCol_1 - %401 = OpIAdd %int %400 %int_1 - OpStore %innerCol_1 %401 - OpBranch %371 - %372 = OpLabel - OpBranch %364 - %364 = OpLabel - %402 = OpLoad %int %innerRow_1 - %403 = OpIAdd %int %402 %int_1 - OpStore %innerRow_1 %403 - OpBranch %362 - %363 = OpLabel - OpStore %innerRow_2 %int_0 + OpStore %inputCol %382 + %383 = OpLoad %int %inputRow + %384 = OpLoad %int %inputCol + %385 = OpLoad %int %globalRow + %386 = OpLoad %int %innerRow_1 + %387 = OpLoad %int %t + %388 = OpLoad %int %inputCol + %389 = OpIAdd %int %385 %386 + OpStore %param_3 %389 + %390 = OpIMul %int %387 %int_64 + %391 = OpIAdd %int %390 %388 + OpStore %param_4 %391 + %392 = OpFunctionCall %float %mm_readA_i1_i1_ %param_3 %param_4 + %396 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %383 %384 + OpStore %396 %392 + OpBranch %370 + %370 = OpLabel + %397 = OpLoad %int %innerCol_1 + %398 = OpIAdd %int %397 %int_1 + OpStore %innerCol_1 %398 + OpBranch %368 + %369 = OpLabel + OpBranch %361 + %361 = OpLabel + %399 = OpLoad %int %innerRow_1 + %400 = OpIAdd %int %399 %int_1 + OpStore %innerRow_1 %400 + OpBranch %359 + %360 = OpLabel + OpStore %innerRow_2 %11 + OpBranch %401 + %401 = OpLabel + OpLoopMerge %402 %403 None OpBranch %404 %404 = OpLabel - OpLoopMerge %405 %406 None + %405 = OpLoad %int %innerRow_2 + %406 = OpSLessThan %bool %405 %int_1 + OpSelectionMerge %407 None + OpBranchConditional %406 %408 %409 + %408 = OpLabel OpBranch %407 + %409 = OpLabel + OpBranch %402 %407 = OpLabel - %408 = OpLoad %int %innerRow_2 - %409 = OpSLessThan %bool %408 %int_1 - OpSelectionMerge %410 None - OpBranchConditional %409 %411 %412 - %411 = OpLabel + OpStore %innerCol_2 %11 OpBranch %410 - %412 = OpLabel - OpBranch %405 %410 = OpLabel - OpStore %innerCol_2 %int_0 + OpLoopMerge %411 %412 None OpBranch %413 %413 = OpLabel - OpLoopMerge %414 %415 None + %414 = OpLoad %int %innerCol_2 + %415 = OpSLessThan %bool %414 %int_1 + OpSelectionMerge %416 None + OpBranchConditional %415 %417 %418 + %417 = OpLabel OpBranch %416 + %418 = OpLabel + OpBranch %411 %416 = OpLabel - %417 = OpLoad %int %innerCol_2 - %418 = OpSLessThan %bool %417 %int_1 - OpSelectionMerge %419 None - OpBranchConditional %418 %420 %421 - %420 = OpLabel - OpBranch %419 - %421 = OpLabel - OpBranch %414 - %419 = OpLabel - %422 = OpLoad %int %tileRowB - %423 = OpLoad %int %innerRow_2 + %419 = OpLoad %int %tileRowB + %420 = OpLoad %int %innerRow_2 + %421 = OpIAdd %int %419 %420 + OpStore %inputRow_1 %421 + %422 = OpLoad %int %tileCol + %423 = OpLoad %int %innerCol_2 %424 = OpIAdd %int %422 %423 - OpStore %inputRow_1 %424 - %425 = OpLoad %int %tileCol - %426 = OpLoad %int %innerCol_2 - %427 = OpIAdd %int %425 %426 - OpStore %inputCol_1 %427 + OpStore %inputCol_1 %424 + %425 = OpLoad %int %inputRow_1 + %426 = OpLoad %int %inputCol_1 + %427 = OpLoad %int %t %428 = OpLoad %int %inputRow_1 - %429 = OpLoad %int %inputCol_1 - %430 = OpLoad %int %t - %431 = OpLoad %int %inputRow_1 - %432 = OpLoad %int %globalCol - %433 = OpLoad %int %innerCol_2 - %434 = OpIMul %int %430 %int_64 - %435 = OpIAdd %int %434 %431 - OpStore %param_5 %435 - %436 = OpIAdd %int %432 %433 - OpStore %param_6 %436 - %437 = OpFunctionCall %float %mm_readB_i1_i1_ %param_5 %param_6 - %440 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %428 %429 - OpStore %440 %437 - OpBranch %415 - %415 = OpLabel - %441 = OpLoad %int %innerCol_2 - %442 = OpIAdd %int %441 %int_1 - OpStore %innerCol_2 %442 - OpBranch %413 - %414 = OpLabel - OpBranch %406 - %406 = OpLabel - %443 = OpLoad %int %innerRow_2 - %444 = OpIAdd %int %443 %int_1 - OpStore %innerRow_2 %444 - OpBranch %404 - %405 = OpLabel + %429 = OpLoad %int %globalCol + %430 = OpLoad %int %innerCol_2 + %431 = OpIMul %int %427 %int_64 + %432 = OpIAdd %int %431 %428 + OpStore %param_5 %432 + %433 = OpIAdd %int %429 %430 + OpStore %param_6 %433 + %434 = OpFunctionCall %float %mm_readB_i1_i1_ %param_5 %param_6 + %437 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %425 %426 + OpStore %437 %434 + OpBranch %412 + %412 = OpLabel + %438 = OpLoad %int %innerCol_2 + %439 = OpIAdd %int %438 %int_1 + OpStore %innerCol_2 %439 + OpBranch %410 + %411 = OpLabel + OpBranch %403 + %403 = OpLabel + %440 = OpLoad %int %innerRow_2 + %441 = OpIAdd %int %440 %int_1 + OpStore %innerRow_2 %441 + OpBranch %401 + %402 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - OpStore %k %int_0 + OpStore %k %11 + OpBranch %444 + %444 = OpLabel + OpLoopMerge %445 %446 None OpBranch %447 %447 = OpLabel - OpLoopMerge %448 %449 None + %448 = OpLoad %int %k + %449 = OpSLessThan %bool %448 %int_64 + OpSelectionMerge %450 None + OpBranchConditional %449 %451 %452 + %451 = OpLabel OpBranch %450 + %452 = OpLabel + OpBranch %445 %450 = OpLabel - %451 = OpLoad %int %k - %452 = OpSLessThan %bool %451 %int_64 - OpSelectionMerge %453 None - OpBranchConditional %452 %454 %455 - %454 = OpLabel + OpStore %inner %11 OpBranch %453 - %455 = OpLabel - OpBranch %448 %453 = OpLabel - OpStore %inner %int_0 + OpLoopMerge %454 %455 None OpBranch %456 %456 = OpLabel - OpLoopMerge %457 %458 None + %457 = OpLoad %int %inner + %458 = OpSLessThan %bool %457 %int_1 + OpSelectionMerge %459 None + OpBranchConditional %458 %460 %461 + %460 = OpLabel OpBranch %459 + %461 = OpLabel + OpBranch %454 %459 = OpLabel - %460 = OpLoad %int %inner - %461 = OpSLessThan %bool %460 %int_1 - OpSelectionMerge %462 None - OpBranchConditional %461 %463 %464 - %463 = OpLabel - OpBranch %462 - %464 = OpLabel - OpBranch %457 - %462 = OpLabel + %462 = OpLoad %int %inner + %463 = OpLoad %int %k + %464 = OpLoad %int %tileCol %465 = OpLoad %int %inner - %466 = OpLoad %int %k - %467 = OpLoad %int %tileCol - %468 = OpLoad %int %inner - %469 = OpIAdd %int %467 %468 - %470 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %466 %469 - %471 = OpLoad %float %470 - %472 = OpAccessChain %_ptr_Function_float %BCached %465 - OpStore %472 %471 - OpBranch %458 - %458 = OpLabel - %473 = OpLoad %int %inner - %474 = OpIAdd %int %473 %int_1 - OpStore %inner %474 - OpBranch %456 - %457 = OpLabel - OpStore %innerRow_3 %int_0 + %466 = OpIAdd %int %464 %465 + %467 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %463 %466 + %468 = OpLoad %float %467 + %469 = OpAccessChain %_ptr_Function_float %BCached %462 + OpStore %469 %468 + OpBranch %455 + %455 = OpLabel + %470 = OpLoad %int %inner + %471 = OpIAdd %int %470 %int_1 + OpStore %inner %471 + OpBranch %453 + %454 = OpLabel + OpStore %innerRow_3 %11 + OpBranch %472 + %472 = OpLabel + OpLoopMerge %473 %474 None OpBranch %475 %475 = OpLabel - OpLoopMerge %476 %477 None + %476 = OpLoad %int %innerRow_3 + %477 = OpSLessThan %bool %476 %int_1 + OpSelectionMerge %478 None + OpBranchConditional %477 %479 %480 + %479 = OpLabel OpBranch %478 + %480 = OpLabel + OpBranch %473 %478 = OpLabel - %479 = OpLoad %int %innerRow_3 - %480 = OpSLessThan %bool %479 %int_1 - OpSelectionMerge %481 None - OpBranchConditional %480 %482 %483 - %482 = OpLabel - OpBranch %481 - %483 = OpLabel - OpBranch %476 - %481 = OpLabel - %484 = OpLoad %int %tileRow - %485 = OpLoad %int %innerRow_3 - %486 = OpLoad %int %k - %487 = OpIAdd %int %484 %485 - %488 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %487 %486 - %489 = OpLoad %float %488 - OpStore %ACached %489 - OpStore %innerCol_3 %int_0 + %481 = OpLoad %int %tileRow + %482 = OpLoad %int %innerRow_3 + %483 = OpLoad %int %k + %484 = OpIAdd %int %481 %482 + %485 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %484 %483 + %486 = OpLoad %float %485 + OpStore %ACached %486 + OpStore %innerCol_3 %11 + OpBranch %487 + %487 = OpLabel + OpLoopMerge %488 %489 None OpBranch %490 %490 = OpLabel - OpLoopMerge %491 %492 None + %491 = OpLoad %int %innerCol_3 + %492 = OpSLessThan %bool %491 %int_1 + OpSelectionMerge %493 None + OpBranchConditional %492 %494 %495 + %494 = OpLabel OpBranch %493 + %495 = OpLabel + OpBranch %488 %493 = OpLabel - %494 = OpLoad %int %innerCol_3 - %495 = OpSLessThan %bool %494 %int_1 - OpSelectionMerge %496 None - OpBranchConditional %495 %497 %498 - %497 = OpLabel - OpBranch %496 - %498 = OpLabel - OpBranch %491 - %496 = OpLabel - %499 = OpLoad %int %innerRow_3 - %500 = OpLoad %int %innerCol_3 - %501 = OpLoad %float %ACached - %502 = OpLoad %int %innerCol_3 - %503 = OpAccessChain %_ptr_Function_float %BCached %502 - %504 = OpLoad %float %503 - %505 = OpAccessChain %_ptr_Function_float %acc %499 %500 - %506 = OpLoad %float %505 - %507 = OpAccessChain %_ptr_Function_float %acc %499 %500 - %508 = OpFMul %float %501 %504 - %509 = OpFAdd %float %506 %508 - OpStore %507 %509 - OpBranch %492 - %492 = OpLabel - %510 = OpLoad %int %innerCol_3 - %511 = OpIAdd %int %510 %int_1 - OpStore %innerCol_3 %511 - OpBranch %490 - %491 = OpLabel - OpBranch %477 - %477 = OpLabel - %512 = OpLoad %int %innerRow_3 - %513 = OpIAdd %int %512 %int_1 - OpStore %innerRow_3 %513 - OpBranch %475 - %476 = OpLabel - OpBranch %449 - %449 = OpLabel - %514 = OpLoad %int %k - %515 = OpIAdd %int %514 %int_1 - OpStore %k %515 - OpBranch %447 - %448 = OpLabel + %496 = OpLoad %int %innerRow_3 + %497 = OpLoad %int %innerCol_3 + %498 = OpLoad %float %ACached + %499 = OpLoad %int %innerCol_3 + %500 = OpAccessChain %_ptr_Function_float %BCached %499 + %501 = OpLoad %float %500 + %502 = OpAccessChain %_ptr_Function_float %acc %496 %497 + %503 = OpLoad %float %502 + %504 = OpAccessChain %_ptr_Function_float %acc %496 %497 + %505 = OpFMul %float %498 %501 + %506 = OpFAdd %float %503 %505 + OpStore %504 %506 + OpBranch %489 + %489 = OpLabel + %507 = OpLoad %int %innerCol_3 + %508 = OpIAdd %int %507 %int_1 + OpStore %innerCol_3 %508 + OpBranch %487 + %488 = OpLabel + OpBranch %474 + %474 = OpLabel + %509 = OpLoad %int %innerRow_3 + %510 = OpIAdd %int %509 %int_1 + OpStore %innerRow_3 %510 + OpBranch %472 + %473 = OpLabel + OpBranch %446 + %446 = OpLabel + %511 = OpLoad %int %k + %512 = OpIAdd %int %511 %int_1 + OpStore %k %512 + OpBranch %444 + %445 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - OpBranch %354 - %354 = OpLabel - %517 = OpLoad %int %t - %518 = OpIAdd %int %517 %int_1 - OpStore %t %518 - OpBranch %352 - %353 = OpLabel - OpStore %innerRow_4 %int_0 + OpBranch %351 + %351 = OpLabel + %514 = OpLoad %int %t + %515 = OpIAdd %int %514 %int_1 + OpStore %t %515 + OpBranch %349 + %350 = OpLabel + OpStore %innerRow_4 %11 + OpBranch %516 + %516 = OpLabel + OpLoopMerge %517 %518 None OpBranch %519 %519 = OpLabel - OpLoopMerge %520 %521 None + %520 = OpLoad %int %innerRow_4 + %521 = OpSLessThan %bool %520 %int_1 + OpSelectionMerge %522 None + OpBranchConditional %521 %523 %524 + %523 = OpLabel OpBranch %522 + %524 = OpLabel + OpBranch %517 %522 = OpLabel - %523 = OpLoad %int %innerRow_4 - %524 = OpSLessThan %bool %523 %int_1 - OpSelectionMerge %525 None - OpBranchConditional %524 %526 %527 - %526 = OpLabel + OpStore %innerCol_4 %11 OpBranch %525 - %527 = OpLabel - OpBranch %520 %525 = OpLabel - OpStore %innerCol_4 %int_0 + OpLoopMerge %526 %527 None OpBranch %528 %528 = OpLabel - OpLoopMerge %529 %530 None - OpBranch %531 - %531 = OpLabel - %534 = OpLoad %int %innerCol_4 - %535 = OpSLessThan %bool %534 %int_1 - OpSelectionMerge %536 None - OpBranchConditional %535 %537 %538 - %537 = OpLabel - OpBranch %536 - %538 = OpLabel - OpBranch %529 - %536 = OpLabel - %539 = OpLoad %int %globalCol - %540 = OpLoad %int %innerCol_4 - %542 = OpLoad %int %dimBOuter - %543 = OpIAdd %int %539 %540 - %544 = OpSLessThan %bool %543 %542 - OpStore %x_394_phi %544 - OpSelectionMerge %545 None - OpBranchConditional %544 %546 %545 - %546 = OpLabel - %547 = OpLoad %int %globalRow - %548 = OpLoad %int %innerRow_4 - %550 = OpLoad %int %dimAOuter - %551 = OpIAdd %int %547 %548 - %552 = OpSLessThan %bool %551 %550 - OpStore %x_393 %552 - %553 = OpLoad %bool %x_393 - OpStore %x_394_phi %553 - OpBranch %545 - %545 = OpLabel - %554 = OpLoad %bool %x_394_phi - OpSelectionMerge %555 None - OpBranchConditional %554 %556 %555 - %556 = OpLabel - %557 = OpLoad %int %globalRow + %531 = OpLoad %int %innerCol_4 + %532 = OpSLessThan %bool %531 %int_1 + OpSelectionMerge %533 None + OpBranchConditional %532 %534 %535 + %534 = OpLabel + OpBranch %533 + %535 = OpLabel + OpBranch %526 + %533 = OpLabel + %536 = OpLoad %int %globalCol + %537 = OpLoad %int %innerCol_4 + %539 = OpLoad %int %dimBOuter + %540 = OpIAdd %int %536 %537 + %541 = OpSLessThan %bool %540 %539 + OpStore %x_394_phi %541 + OpSelectionMerge %542 None + OpBranchConditional %541 %543 %542 + %543 = OpLabel + %544 = OpLoad %int %globalRow + %545 = OpLoad %int %innerRow_4 + %547 = OpLoad %int %dimAOuter + %548 = OpIAdd %int %544 %545 + %549 = OpSLessThan %bool %548 %547 + OpStore %x_393 %549 + %550 = OpLoad %bool %x_393 + OpStore %x_394_phi %550 + OpBranch %542 + %542 = OpLabel + %551 = OpLoad %bool %x_394_phi + OpSelectionMerge %552 None + OpBranchConditional %551 %553 %552 + %553 = OpLabel + %554 = OpLoad %int %globalRow + %555 = OpLoad %int %innerRow_4 + %556 = OpLoad %int %globalCol + %557 = OpLoad %int %innerCol_4 %558 = OpLoad %int %innerRow_4 - %559 = OpLoad %int %globalCol - %560 = OpLoad %int %innerCol_4 - %561 = OpLoad %int %innerRow_4 - %562 = OpLoad %int %innerCol_4 - %563 = OpIAdd %int %557 %558 - OpStore %param_7 %563 - %564 = OpIAdd %int %559 %560 - OpStore %param_8 %564 - %565 = OpAccessChain %_ptr_Function_float %acc %561 %562 - %566 = OpLoad %float %565 - OpStore %param_9 %566 - %567 = OpFunctionCall %void %mm_write_i1_i1_f1_ %param_7 %param_8 %param_9 - OpBranch %555 - %555 = OpLabel - OpBranch %530 - %530 = OpLabel - %571 = OpLoad %int %innerCol_4 - %572 = OpIAdd %int %571 %int_1 - OpStore %innerCol_4 %572 - OpBranch %528 - %529 = OpLabel - OpBranch %521 - %521 = OpLabel - %573 = OpLoad %int %innerRow_4 - %574 = OpIAdd %int %573 %int_1 - OpStore %innerRow_4 %574 - OpBranch %519 - %520 = OpLabel + %559 = OpLoad %int %innerCol_4 + %560 = OpIAdd %int %554 %555 + OpStore %param_7 %560 + %561 = OpIAdd %int %556 %557 + OpStore %param_8 %561 + %562 = OpAccessChain %_ptr_Function_float %acc %558 %559 + %563 = OpLoad %float %562 + OpStore %param_9 %563 + %564 = OpFunctionCall %void %mm_write_i1_i1_f1_ %param_7 %param_8 %param_9 + OpBranch %552 + %552 = OpLabel + OpBranch %527 + %527 = OpLabel + %568 = OpLoad %int %innerCol_4 + %569 = OpIAdd %int %568 %int_1 + OpStore %innerCol_4 %569 + OpBranch %525 + %526 = OpLabel + OpBranch %518 + %518 = OpLabel + %570 = OpLoad %int %innerRow_4 + %571 = OpIAdd %int %570 %int_1 + OpStore %innerRow_4 %571 + OpBranch %516 + %517 = OpLabel OpReturn OpFunctionEnd - %main_1 = OpFunction %void None %575 - %577 = OpLabel + %main_1 = OpFunction %void None %572 + %574 = OpLabel %param_18 = OpVariable %_ptr_Function_int Function %11 %param_19 = OpVariable %_ptr_Function_int Function %11 %param_20 = OpVariable %_ptr_Function_int Function %11 - %581 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_1 %uint_1 - %582 = OpLoad %int %581 - OpStore %dimAOuter_1 %582 - %583 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_1 %uint_2 - %584 = OpLoad %int %583 - OpStore %dimInner_1 %584 - %585 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_2 %uint_2 - %586 = OpLoad %int %585 - OpStore %dimBOuter_1 %586 - %587 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_2 - %588 = OpLoad %uint %587 - %589 = OpBitcast %int %588 - OpStore %batch %589 - %590 = OpLoad %int %dimAOuter_1 - OpStore %param_18 %590 - %591 = OpLoad %int %dimInner_1 - OpStore %param_19 %591 - %592 = OpLoad %int %dimBOuter_1 - OpStore %param_20 %592 - %593 = OpFunctionCall %void %mm_matMul_i1_i1_i1_ %param_18 %param_19 %param_20 + %578 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_1 %uint_1 + %579 = OpLoad %int %578 + OpStore %dimAOuter_1 %579 + %580 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_1 %uint_2 + %581 = OpLoad %int %580 + OpStore %dimInner_1 %581 + %582 = OpAccessChain %_ptr_Uniform_int %x_48 %uint_2 %uint_2 + %583 = OpLoad %int %582 + OpStore %dimBOuter_1 %583 + %584 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_2 + %585 = OpLoad %uint %584 + %586 = OpBitcast %int %585 + OpStore %batch %586 + %587 = OpLoad %int %dimAOuter_1 + OpStore %param_18 %587 + %588 = OpLoad %int %dimInner_1 + OpStore %param_19 %588 + %589 = OpLoad %int %dimBOuter_1 + OpStore %param_20 %589 + %590 = OpFunctionCall %void %mm_matMul_i1_i1_i1_ %param_18 %param_19 %param_20 OpReturn OpFunctionEnd - %main_inner = OpFunction %void None %597 + %main_inner = OpFunction %void None %594 %gl_LocalInvocationID_param = OpFunctionParameter %v3uint %gl_GlobalInvocationID_param = OpFunctionParameter %v3uint %local_invocation_index = OpFunctionParameter %uint - %602 = OpLabel - %idx = OpVariable %_ptr_Function_uint Function %607 - %603 = OpUMod %uint %local_invocation_index %uint_1 - %604 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %local_invocation_index %603 - OpStore %604 %85 + %599 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %604 + %600 = OpUMod %uint %local_invocation_index %uint_1 + %601 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %local_invocation_index %600 + OpStore %601 %83 OpStore %idx %local_invocation_index + OpBranch %605 + %605 = OpLabel + OpLoopMerge %606 %607 None OpBranch %608 %608 = OpLabel - OpLoopMerge %609 %610 None - OpBranch %611 - %611 = OpLabel - %613 = OpLoad %uint %idx - %615 = OpULessThan %bool %613 %uint_4096 - %612 = OpLogicalNot %bool %615 - OpSelectionMerge %616 None - OpBranchConditional %612 %617 %616 - %617 = OpLabel - OpBranch %609 - %616 = OpLabel - %618 = OpLoad %uint %idx - %619 = OpUDiv %uint %618 %uint_64 + %610 = OpLoad %uint %idx + %612 = OpULessThan %bool %610 %uint_4096 + %609 = OpLogicalNot %bool %612 + OpSelectionMerge %613 None + OpBranchConditional %609 %614 %613 + %614 = OpLabel + OpBranch %606 + %613 = OpLabel + %615 = OpLoad %uint %idx + %616 = OpUDiv %uint %615 %uint_64 + %617 = OpLoad %uint %idx + %618 = OpUMod %uint %617 %uint_64 + %619 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %616 %618 + OpStore %619 %83 + OpBranch %607 + %607 = OpLabel %620 = OpLoad %uint %idx - %621 = OpUMod %uint %620 %uint_64 - %622 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %619 %621 - OpStore %622 %85 - OpBranch %610 - %610 = OpLabel - %623 = OpLoad %uint %idx - %624 = OpIAdd %uint %623 %uint_64 - OpStore %idx %624 - OpBranch %608 - %609 = OpLabel + %621 = OpIAdd %uint %620 %uint_64 + OpStore %idx %621 + OpBranch %605 + %606 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 OpStore %gl_LocalInvocationID %gl_LocalInvocationID_param OpStore %gl_GlobalInvocationID %gl_GlobalInvocationID_param - %626 = OpFunctionCall %void %main_1 + %623 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd - %main = OpFunction %void None %575 - %628 = OpLabel - %630 = OpLoad %v3uint %gl_LocalInvocationID_param_1 - %631 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 - %632 = OpLoad %uint %local_invocation_index_1 - %629 = OpFunctionCall %void %main_inner %630 %631 %632 + %main = OpFunction %void None %572 + %625 = OpLabel + %627 = OpLoad %v3uint %gl_LocalInvocationID_param_1 + %628 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 + %629 = OpLoad %uint %local_invocation_index_1 + %626 = OpFunctionCall %void %main_inner %627 %628 %629 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/943.spvasm.expected.wgsl b/test/tint/bug/tint/943.spvasm.expected.wgsl index fe02e98a98..645db5af61 100644 --- a/test/tint/bug/tint/943.spvasm.expected.wgsl +++ b/test/tint/bug/tint/943.spvasm.expected.wgsl @@ -1,3 +1,6 @@ +warning: parameter 'dimInner' of 'mm_matMul_i1_i1_i1_' must be uniform +note: 'workgroupBarrier' must only be called from uniform control flow +note: reading from module-scope private variable 'dimInner_1' may result in a non-uniform value struct Uniforms { NAN : f32, @size(12) @@ -96,7 +99,7 @@ fn mm_readA_i1_i1_(row : ptr, col : ptr) -> f32 { let x_448 : f32 = x_165.A[(((x_438 * x_439) + (x_441 * x_442)) + x_445)]; x_430 = x_448; } else { - x_430 = 0.0; + x_430 = 0.0f; } let x_450 : f32 = x_430; return x_450; @@ -126,7 +129,7 @@ fn mm_readB_i1_i1_(row_1 : ptr, col_1 : ptr) -> f3 let x_485 : f32 = x_185.B[(((x_475 * x_476) + (x_478 * x_479)) + x_482)]; x_468 = x_485; } else { - x_468 = 0.0; + x_468 = 0.0f; } let x_487 : f32 = x_468; return x_487; @@ -248,7 +251,7 @@ fn mm_matMul_i1_i1_i1_(dimAOuter : ptr, dimInner : ptr, @builtin(global_invocation_id) gl_GlobalInvocationID_param : vec3) { gl_LocalInvocationID = gl_LocalInvocationID_param; gl_GlobalInvocationID = gl_GlobalInvocationID_param; diff --git a/test/tint/bug/tint/948.wgsl b/test/tint/bug/tint/948.wgsl index 4cc43296a7..68432d5f6f 100644 --- a/test/tint/bug/tint/948.wgsl +++ b/test/tint/bug/tint/948.wgsl @@ -215,7 +215,7 @@ struct main_out { glFragColor_1 : vec4, }; -@stage(fragment) +@fragment fn main(@location(2) tUV_param : vec2, @location(5) tileID_1_param : vec2, @location(4) levelUnits_param : vec2, @location(3) stageUnits_1_param : vec2, @location(0) vPosition_param : vec3, @location(1) vUV_param : vec2) -> main_out { tUV = tUV_param; tileID_1 = tileID_1_param; diff --git a/test/tint/bug/tint/948.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/948.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1864ff118b --- /dev/null +++ b/test/tint/bug/tint/948.wgsl.expected.dxc.hlsl @@ -0,0 +1,196 @@ +bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from uniform control flow + let x_217 : vec4 = textureSampleBias(animationMapTexture, animationMapSampler, vec2(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0); + ^^^^^^^^^^^^^^^^^ + +bug/tint/948.wgsl:138:9 note: control flow depends on non-uniform value + if ((x_197 > x_198)) { + ^^ + +bug/tint/948.wgsl:137:27 note: reading from module-scope private variable 'mt' may result in a non-uniform value + let x_198 : f32 = mt; + ^^ + +cbuffer cbuffer_x_20 : register(b9, space2) { + uint4 x_20[8]; +}; +Texture2D frameMapTexture : register(t3, space2); +SamplerState frameMapSampler : register(s2, space2); +static float2 tUV = float2(0.0f, 0.0f); +Texture2D tileMapsTexture0 : register(t5, space2); +SamplerState tileMapsSampler : register(s4, space2); +Texture2D tileMapsTexture1 : register(t6, space2); +Texture2D animationMapTexture : register(t8, space2); +SamplerState animationMapSampler : register(s7, space2); +static float mt = 0.0f; +Texture2D spriteSheetTexture : register(t1, space2); +SamplerState spriteSheetSampler : register(s0, space2); +static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2 tileID_1 = float2(0.0f, 0.0f); +static float2 levelUnits = float2(0.0f, 0.0f); +static float2 stageUnits_1 = float2(0.0f, 0.0f); +static float3 vPosition = float3(0.0f, 0.0f, 0.0f); +static float2 vUV = float2(0.0f, 0.0f); + +float4x4 getFrameData_f1_(inout float frameID) { + float fX = 0.0f; + const float x_15 = frameID; + const float x_25 = asfloat(x_20[6].w); + fX = (x_15 / x_25); + const float4 x_40 = frameMapTexture.SampleBias(frameMapSampler, float2(fX, 0.0f), 0.0f); + const float4 x_47 = frameMapTexture.SampleBias(frameMapSampler, float2(fX, 0.25f), 0.0f); + const float4 x_54 = frameMapTexture.SampleBias(frameMapSampler, float2(fX, 0.5f), 0.0f); + return float4x4(float4(x_40.x, x_40.y, x_40.z, x_40.w), float4(x_47.x, x_47.y, x_47.z, x_47.w), float4(x_54.x, x_54.y, x_54.z, x_54.w), (0.0f).xxxx); +} + +void main_1() { + float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2 tileUV = float2(0.0f, 0.0f); + float2 tileID = float2(0.0f, 0.0f); + float2 sheetUnits = float2(0.0f, 0.0f); + float spriteUnits = 0.0f; + float2 stageUnits = float2(0.0f, 0.0f); + int i = 0; + float frameID_1 = 0.0f; + float4 animationData = float4(0.0f, 0.0f, 0.0f, 0.0f); + float f = 0.0f; + float4x4 frameData = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float param = 0.0f; + float2 frameSize = float2(0.0f, 0.0f); + float2 offset_1 = float2(0.0f, 0.0f); + float2 ratio = float2(0.0f, 0.0f); + float4 nc = float4(0.0f, 0.0f, 0.0f, 0.0f); + float alpha = 0.0f; + float3 mixed = float3(0.0f, 0.0f, 0.0f); + color = (0.0f).xxxx; + tileUV = frac(tUV); + const float x_91 = tileUV.y; + tileUV.y = (1.0f - x_91); + tileID = floor(tUV); + const float2 x_101 = asfloat(x_20[6].xy); + sheetUnits = ((1.0f).xx / x_101); + const float x_106 = asfloat(x_20[6].w); + spriteUnits = (1.0f / x_106); + const float2 x_111 = asfloat(x_20[5].zw); + stageUnits = ((1.0f).xx / x_111); + i = 0; + { + [loop] for(; (i < 2); i = (i + 1)) { + switch(i) { + case 1: { + const float2 x_150 = tileID; + const float2 x_154 = asfloat(x_20[5].zw); + const float4 x_156 = tileMapsTexture1.SampleBias(tileMapsSampler, ((x_150 + (0.5f).xx) / x_154), 0.0f); + frameID_1 = x_156.x; + break; + } + case 0: { + const float2 x_136 = tileID; + const float2 x_140 = asfloat(x_20[5].zw); + const float4 x_142 = tileMapsTexture0.SampleBias(tileMapsSampler, ((x_136 + (0.5f).xx) / x_140), 0.0f); + frameID_1 = x_142.x; + break; + } + default: { + break; + } + } + const float x_166 = frameID_1; + const float x_169 = asfloat(x_20[6].w); + const float4 x_172 = animationMapTexture.SampleBias(animationMapSampler, float2(((x_166 + 0.5f) / x_169), 0.0f), 0.0f); + animationData = x_172; + const float x_174 = animationData.y; + if ((x_174 > 0.0f)) { + const float x_181 = asfloat(x_20[0].x); + const float x_184 = animationData.z; + mt = ((x_181 * x_184) % 1.0f); + f = 0.0f; + { + [loop] for(; (f < 8.0f); f = (f + 1.0f)) { + const float x_197 = animationData.y; + if ((x_197 > mt)) { + const float x_203 = animationData.x; + frameID_1 = x_203; + break; + } + const float x_208 = frameID_1; + const float x_211 = asfloat(x_20[6].w); + const float4 x_217 = animationMapTexture.SampleBias(animationMapSampler, float2(((x_208 + 0.5f) / x_211), (0.125f * f)), 0.0f); + animationData = x_217; + } + } + } + param = (frameID_1 + 0.5f); + const float4x4 x_225 = getFrameData_f1_(param); + frameData = x_225; + const float4 x_228 = frameData[0]; + const float2 x_231 = asfloat(x_20[6].xy); + frameSize = (float2(x_228.w, x_228.z) / x_231); + const float4 x_235 = frameData[0]; + offset_1 = (float2(x_235.x, x_235.y) * sheetUnits); + const float4 x_241 = frameData[2]; + const float4 x_244 = frameData[0]; + ratio = (float2(x_241.x, x_241.y) / float2(x_244.w, x_244.z)); + const float x_248 = frameData[2].z; + if ((x_248 == 1.0f)) { + const float2 x_252 = tileUV; + tileUV = float2(x_252.y, x_252.x); + } + if ((i == 0)) { + const float4 x_268 = spriteSheetTexture.Sample(spriteSheetSampler, ((tileUV * frameSize) + offset_1)); + color = x_268; + } else { + const float4 x_279 = spriteSheetTexture.Sample(spriteSheetSampler, ((tileUV * frameSize) + offset_1)); + nc = x_279; + const float x_283 = color.w; + const float x_285 = nc.w; + alpha = min((x_283 + x_285), 1.0f); + const float4 x_290 = color; + const float4 x_292 = nc; + const float x_295 = nc.w; + mixed = lerp(float3(x_290.x, x_290.y, x_290.z), float3(x_292.x, x_292.y, x_292.z), float3(x_295, x_295, x_295)); + const float3 x_298 = mixed; + color = float4(x_298.x, x_298.y, x_298.z, alpha); + } + } + } + const float3 x_310 = asfloat(x_20[7].xyz); + const float4 x_311 = color; + const float3 x_313 = (float3(x_311.x, x_311.y, x_311.z) * x_310); + color = float4(x_313.x, x_313.y, x_313.z, color.w); + glFragColor = color; + return; +} + +struct main_out { + float4 glFragColor_1; +}; +struct tint_symbol_1 { + float3 vPosition_param : TEXCOORD0; + float2 vUV_param : TEXCOORD1; + float2 tUV_param : TEXCOORD2; + float2 stageUnits_1_param : TEXCOORD3; + float2 levelUnits_param : TEXCOORD4; + float2 tileID_1_param : TEXCOORD5; +}; +struct tint_symbol_2 { + float4 glFragColor_1 : SV_Target0; +}; + +main_out main_inner(float2 tUV_param, float2 tileID_1_param, float2 levelUnits_param, float2 stageUnits_1_param, float3 vPosition_param, float2 vUV_param) { + tUV = tUV_param; + tileID_1 = tileID_1_param; + levelUnits = levelUnits_param; + stageUnits_1 = stageUnits_1_param; + vPosition = vPosition_param; + vUV = vUV_param; + main_1(); + const main_out tint_symbol_6 = {glFragColor}; + return tint_symbol_6; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.tUV_param, tint_symbol.tileID_1_param, tint_symbol.levelUnits_param, tint_symbol.stageUnits_1_param, tint_symbol.vPosition_param, tint_symbol.vUV_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.glFragColor_1 = inner_result.glFragColor_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/948.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/948.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1864ff118b --- /dev/null +++ b/test/tint/bug/tint/948.wgsl.expected.fxc.hlsl @@ -0,0 +1,196 @@ +bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from uniform control flow + let x_217 : vec4 = textureSampleBias(animationMapTexture, animationMapSampler, vec2(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0); + ^^^^^^^^^^^^^^^^^ + +bug/tint/948.wgsl:138:9 note: control flow depends on non-uniform value + if ((x_197 > x_198)) { + ^^ + +bug/tint/948.wgsl:137:27 note: reading from module-scope private variable 'mt' may result in a non-uniform value + let x_198 : f32 = mt; + ^^ + +cbuffer cbuffer_x_20 : register(b9, space2) { + uint4 x_20[8]; +}; +Texture2D frameMapTexture : register(t3, space2); +SamplerState frameMapSampler : register(s2, space2); +static float2 tUV = float2(0.0f, 0.0f); +Texture2D tileMapsTexture0 : register(t5, space2); +SamplerState tileMapsSampler : register(s4, space2); +Texture2D tileMapsTexture1 : register(t6, space2); +Texture2D animationMapTexture : register(t8, space2); +SamplerState animationMapSampler : register(s7, space2); +static float mt = 0.0f; +Texture2D spriteSheetTexture : register(t1, space2); +SamplerState spriteSheetSampler : register(s0, space2); +static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2 tileID_1 = float2(0.0f, 0.0f); +static float2 levelUnits = float2(0.0f, 0.0f); +static float2 stageUnits_1 = float2(0.0f, 0.0f); +static float3 vPosition = float3(0.0f, 0.0f, 0.0f); +static float2 vUV = float2(0.0f, 0.0f); + +float4x4 getFrameData_f1_(inout float frameID) { + float fX = 0.0f; + const float x_15 = frameID; + const float x_25 = asfloat(x_20[6].w); + fX = (x_15 / x_25); + const float4 x_40 = frameMapTexture.SampleBias(frameMapSampler, float2(fX, 0.0f), 0.0f); + const float4 x_47 = frameMapTexture.SampleBias(frameMapSampler, float2(fX, 0.25f), 0.0f); + const float4 x_54 = frameMapTexture.SampleBias(frameMapSampler, float2(fX, 0.5f), 0.0f); + return float4x4(float4(x_40.x, x_40.y, x_40.z, x_40.w), float4(x_47.x, x_47.y, x_47.z, x_47.w), float4(x_54.x, x_54.y, x_54.z, x_54.w), (0.0f).xxxx); +} + +void main_1() { + float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2 tileUV = float2(0.0f, 0.0f); + float2 tileID = float2(0.0f, 0.0f); + float2 sheetUnits = float2(0.0f, 0.0f); + float spriteUnits = 0.0f; + float2 stageUnits = float2(0.0f, 0.0f); + int i = 0; + float frameID_1 = 0.0f; + float4 animationData = float4(0.0f, 0.0f, 0.0f, 0.0f); + float f = 0.0f; + float4x4 frameData = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float param = 0.0f; + float2 frameSize = float2(0.0f, 0.0f); + float2 offset_1 = float2(0.0f, 0.0f); + float2 ratio = float2(0.0f, 0.0f); + float4 nc = float4(0.0f, 0.0f, 0.0f, 0.0f); + float alpha = 0.0f; + float3 mixed = float3(0.0f, 0.0f, 0.0f); + color = (0.0f).xxxx; + tileUV = frac(tUV); + const float x_91 = tileUV.y; + tileUV.y = (1.0f - x_91); + tileID = floor(tUV); + const float2 x_101 = asfloat(x_20[6].xy); + sheetUnits = ((1.0f).xx / x_101); + const float x_106 = asfloat(x_20[6].w); + spriteUnits = (1.0f / x_106); + const float2 x_111 = asfloat(x_20[5].zw); + stageUnits = ((1.0f).xx / x_111); + i = 0; + { + [loop] for(; (i < 2); i = (i + 1)) { + switch(i) { + case 1: { + const float2 x_150 = tileID; + const float2 x_154 = asfloat(x_20[5].zw); + const float4 x_156 = tileMapsTexture1.SampleBias(tileMapsSampler, ((x_150 + (0.5f).xx) / x_154), 0.0f); + frameID_1 = x_156.x; + break; + } + case 0: { + const float2 x_136 = tileID; + const float2 x_140 = asfloat(x_20[5].zw); + const float4 x_142 = tileMapsTexture0.SampleBias(tileMapsSampler, ((x_136 + (0.5f).xx) / x_140), 0.0f); + frameID_1 = x_142.x; + break; + } + default: { + break; + } + } + const float x_166 = frameID_1; + const float x_169 = asfloat(x_20[6].w); + const float4 x_172 = animationMapTexture.SampleBias(animationMapSampler, float2(((x_166 + 0.5f) / x_169), 0.0f), 0.0f); + animationData = x_172; + const float x_174 = animationData.y; + if ((x_174 > 0.0f)) { + const float x_181 = asfloat(x_20[0].x); + const float x_184 = animationData.z; + mt = ((x_181 * x_184) % 1.0f); + f = 0.0f; + { + [loop] for(; (f < 8.0f); f = (f + 1.0f)) { + const float x_197 = animationData.y; + if ((x_197 > mt)) { + const float x_203 = animationData.x; + frameID_1 = x_203; + break; + } + const float x_208 = frameID_1; + const float x_211 = asfloat(x_20[6].w); + const float4 x_217 = animationMapTexture.SampleBias(animationMapSampler, float2(((x_208 + 0.5f) / x_211), (0.125f * f)), 0.0f); + animationData = x_217; + } + } + } + param = (frameID_1 + 0.5f); + const float4x4 x_225 = getFrameData_f1_(param); + frameData = x_225; + const float4 x_228 = frameData[0]; + const float2 x_231 = asfloat(x_20[6].xy); + frameSize = (float2(x_228.w, x_228.z) / x_231); + const float4 x_235 = frameData[0]; + offset_1 = (float2(x_235.x, x_235.y) * sheetUnits); + const float4 x_241 = frameData[2]; + const float4 x_244 = frameData[0]; + ratio = (float2(x_241.x, x_241.y) / float2(x_244.w, x_244.z)); + const float x_248 = frameData[2].z; + if ((x_248 == 1.0f)) { + const float2 x_252 = tileUV; + tileUV = float2(x_252.y, x_252.x); + } + if ((i == 0)) { + const float4 x_268 = spriteSheetTexture.Sample(spriteSheetSampler, ((tileUV * frameSize) + offset_1)); + color = x_268; + } else { + const float4 x_279 = spriteSheetTexture.Sample(spriteSheetSampler, ((tileUV * frameSize) + offset_1)); + nc = x_279; + const float x_283 = color.w; + const float x_285 = nc.w; + alpha = min((x_283 + x_285), 1.0f); + const float4 x_290 = color; + const float4 x_292 = nc; + const float x_295 = nc.w; + mixed = lerp(float3(x_290.x, x_290.y, x_290.z), float3(x_292.x, x_292.y, x_292.z), float3(x_295, x_295, x_295)); + const float3 x_298 = mixed; + color = float4(x_298.x, x_298.y, x_298.z, alpha); + } + } + } + const float3 x_310 = asfloat(x_20[7].xyz); + const float4 x_311 = color; + const float3 x_313 = (float3(x_311.x, x_311.y, x_311.z) * x_310); + color = float4(x_313.x, x_313.y, x_313.z, color.w); + glFragColor = color; + return; +} + +struct main_out { + float4 glFragColor_1; +}; +struct tint_symbol_1 { + float3 vPosition_param : TEXCOORD0; + float2 vUV_param : TEXCOORD1; + float2 tUV_param : TEXCOORD2; + float2 stageUnits_1_param : TEXCOORD3; + float2 levelUnits_param : TEXCOORD4; + float2 tileID_1_param : TEXCOORD5; +}; +struct tint_symbol_2 { + float4 glFragColor_1 : SV_Target0; +}; + +main_out main_inner(float2 tUV_param, float2 tileID_1_param, float2 levelUnits_param, float2 stageUnits_1_param, float3 vPosition_param, float2 vUV_param) { + tUV = tUV_param; + tileID_1 = tileID_1_param; + levelUnits = levelUnits_param; + stageUnits_1 = stageUnits_1_param; + vPosition = vPosition_param; + vUV = vUV_param; + main_1(); + const main_out tint_symbol_6 = {glFragColor}; + return tint_symbol_6; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.tUV_param, tint_symbol.tileID_1_param, tint_symbol.levelUnits_param, tint_symbol.stageUnits_1_param, tint_symbol.vPosition_param, tint_symbol.vUV_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.glFragColor_1 = inner_result.glFragColor_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/948.wgsl.expected.glsl b/test/tint/bug/tint/948.wgsl.expected.glsl index e5cd11e363..bdeba4be67 100644 --- a/test/tint/bug/tint/948.wgsl.expected.glsl +++ b/test/tint/bug/tint/948.wgsl.expected.glsl @@ -1,3 +1,15 @@ +bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from uniform control flow + let x_217 : vec4 = textureSampleBias(animationMapTexture, animationMapSampler, vec2(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0); + ^^^^^^^^^^^^^^^^^ + +bug/tint/948.wgsl:138:9 note: control flow depends on non-uniform value + if ((x_197 > x_198)) { + ^^ + +bug/tint/948.wgsl:137:27 note: reading from module-scope private variable 'mt' may result in a non-uniform value + let x_198 : f32 = mt; + ^^ + #version 310 es precision mediump float; @@ -55,7 +67,7 @@ mat4 getFrameData_f1_(inout float frameID) { vec4 x_40 = texture(frameMapTexture_frameMapSampler, vec2(fX, 0.0f), 0.0f); vec4 x_47 = texture(frameMapTexture_frameMapSampler, vec2(fX, 0.25f), 0.0f); vec4 x_54 = texture(frameMapTexture_frameMapSampler, vec2(fX, 0.5f), 0.0f); - return mat4(vec4(x_40.x, x_40.y, x_40.z, x_40.w), vec4(x_47.x, x_47.y, x_47.z, x_47.w), vec4(x_54.x, x_54.y, x_54.z, x_54.w), vec4(vec4(0.0f, 0.0f, 0.0f, 0.0f).x, vec4(0.0f, 0.0f, 0.0f, 0.0f).y, vec4(0.0f, 0.0f, 0.0f, 0.0f).z, vec4(0.0f, 0.0f, 0.0f, 0.0f).w)); + return mat4(vec4(x_40.x, x_40.y, x_40.z, x_40.w), vec4(x_47.x, x_47.y, x_47.z, x_47.w), vec4(x_54.x, x_54.y, x_54.z, x_54.w), vec4(0.0f)); } uniform highp sampler2D tileMapsTexture1_tileMapsSampler; @@ -81,17 +93,17 @@ void main_1() { vec4 nc = vec4(0.0f, 0.0f, 0.0f, 0.0f); float alpha = 0.0f; vec3 mixed = vec3(0.0f, 0.0f, 0.0f); - color = vec4(0.0f, 0.0f, 0.0f, 0.0f); + color = vec4(0.0f); tileUV = fract(tUV); float x_91 = tileUV.y; tileUV.y = (1.0f - x_91); tileID = floor(tUV); vec2 x_101 = x_20.spriteMapSize; - sheetUnits = (vec2(1.0f, 1.0f) / x_101); + sheetUnits = (vec2(1.0f) / x_101); float x_106 = x_20.spriteCount; spriteUnits = (1.0f / x_106); vec2 x_111 = x_20.stageSize; - stageUnits = (vec2(1.0f, 1.0f) / x_111); + stageUnits = (vec2(1.0f) / x_111); i = 0; { for(; (i < 2); i = (i + 1)) { @@ -99,14 +111,14 @@ void main_1() { case 1: { vec2 x_150 = tileID; vec2 x_154 = x_20.stageSize; - vec4 x_156 = texture(tileMapsTexture1_tileMapsSampler, ((x_150 + vec2(0.5f, 0.5f)) / x_154), 0.0f); + vec4 x_156 = texture(tileMapsTexture1_tileMapsSampler, ((x_150 + vec2(0.5f)) / x_154), 0.0f); frameID_1 = x_156.x; break; } case 0: { vec2 x_136 = tileID; vec2 x_140 = x_20.stageSize; - vec4 x_142 = texture(tileMapsTexture0_tileMapsSampler, ((x_136 + vec2(0.5f, 0.5f)) / x_140), 0.0f); + vec4 x_142 = texture(tileMapsTexture0_tileMapsSampler, ((x_136 + vec2(0.5f)) / x_140), 0.0f); frameID_1 = x_142.x; break; } diff --git a/test/tint/bug/tint/948.wgsl.expected.hlsl b/test/tint/bug/tint/948.wgsl.expected.hlsl deleted file mode 100644 index 5a253ad267..0000000000 --- a/test/tint/bug/tint/948.wgsl.expected.hlsl +++ /dev/null @@ -1,184 +0,0 @@ -cbuffer cbuffer_x_20 : register(b9, space2) { - uint4 x_20[8]; -}; -Texture2D frameMapTexture : register(t3, space2); -SamplerState frameMapSampler : register(s2, space2); -static float2 tUV = float2(0.0f, 0.0f); -Texture2D tileMapsTexture0 : register(t5, space2); -SamplerState tileMapsSampler : register(s4, space2); -Texture2D tileMapsTexture1 : register(t6, space2); -Texture2D animationMapTexture : register(t8, space2); -SamplerState animationMapSampler : register(s7, space2); -static float mt = 0.0f; -Texture2D spriteSheetTexture : register(t1, space2); -SamplerState spriteSheetSampler : register(s0, space2); -static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float2 tileID_1 = float2(0.0f, 0.0f); -static float2 levelUnits = float2(0.0f, 0.0f); -static float2 stageUnits_1 = float2(0.0f, 0.0f); -static float3 vPosition = float3(0.0f, 0.0f, 0.0f); -static float2 vUV = float2(0.0f, 0.0f); - -float4x4 getFrameData_f1_(inout float frameID) { - float fX = 0.0f; - const float x_15 = frameID; - const float x_25 = asfloat(x_20[6].w); - fX = (x_15 / x_25); - const float4 x_40 = frameMapTexture.SampleBias(frameMapSampler, float2(fX, 0.0f), 0.0f); - const float4 x_47 = frameMapTexture.SampleBias(frameMapSampler, float2(fX, 0.25f), 0.0f); - const float4 x_54 = frameMapTexture.SampleBias(frameMapSampler, float2(fX, 0.5f), 0.0f); - return float4x4(float4(x_40.x, x_40.y, x_40.z, x_40.w), float4(x_47.x, x_47.y, x_47.z, x_47.w), float4(x_54.x, x_54.y, x_54.z, x_54.w), float4(float4(0.0f, 0.0f, 0.0f, 0.0f).x, float4(0.0f, 0.0f, 0.0f, 0.0f).y, float4(0.0f, 0.0f, 0.0f, 0.0f).z, float4(0.0f, 0.0f, 0.0f, 0.0f).w)); -} - -void main_1() { - float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); - float2 tileUV = float2(0.0f, 0.0f); - float2 tileID = float2(0.0f, 0.0f); - float2 sheetUnits = float2(0.0f, 0.0f); - float spriteUnits = 0.0f; - float2 stageUnits = float2(0.0f, 0.0f); - int i = 0; - float frameID_1 = 0.0f; - float4 animationData = float4(0.0f, 0.0f, 0.0f, 0.0f); - float f = 0.0f; - float4x4 frameData = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float param = 0.0f; - float2 frameSize = float2(0.0f, 0.0f); - float2 offset_1 = float2(0.0f, 0.0f); - float2 ratio = float2(0.0f, 0.0f); - float4 nc = float4(0.0f, 0.0f, 0.0f, 0.0f); - float alpha = 0.0f; - float3 mixed = float3(0.0f, 0.0f, 0.0f); - color = float4(0.0f, 0.0f, 0.0f, 0.0f); - tileUV = frac(tUV); - const float x_91 = tileUV.y; - tileUV.y = (1.0f - x_91); - tileID = floor(tUV); - const float2 x_101 = asfloat(x_20[6].xy); - sheetUnits = (float2(1.0f, 1.0f) / x_101); - const float x_106 = asfloat(x_20[6].w); - spriteUnits = (1.0f / x_106); - const float2 x_111 = asfloat(x_20[5].zw); - stageUnits = (float2(1.0f, 1.0f) / x_111); - i = 0; - { - [loop] for(; (i < 2); i = (i + 1)) { - switch(i) { - case 1: { - const float2 x_150 = tileID; - const float2 x_154 = asfloat(x_20[5].zw); - const float4 x_156 = tileMapsTexture1.SampleBias(tileMapsSampler, ((x_150 + float2(0.5f, 0.5f)) / x_154), 0.0f); - frameID_1 = x_156.x; - break; - } - case 0: { - const float2 x_136 = tileID; - const float2 x_140 = asfloat(x_20[5].zw); - const float4 x_142 = tileMapsTexture0.SampleBias(tileMapsSampler, ((x_136 + float2(0.5f, 0.5f)) / x_140), 0.0f); - frameID_1 = x_142.x; - break; - } - default: { - break; - } - } - const float x_166 = frameID_1; - const float x_169 = asfloat(x_20[6].w); - const float4 x_172 = animationMapTexture.SampleBias(animationMapSampler, float2(((x_166 + 0.5f) / x_169), 0.0f), 0.0f); - animationData = x_172; - const float x_174 = animationData.y; - if ((x_174 > 0.0f)) { - const float x_181 = asfloat(x_20[0].x); - const float x_184 = animationData.z; - mt = ((x_181 * x_184) % 1.0f); - f = 0.0f; - { - [loop] for(; (f < 8.0f); f = (f + 1.0f)) { - const float x_197 = animationData.y; - if ((x_197 > mt)) { - const float x_203 = animationData.x; - frameID_1 = x_203; - break; - } - const float x_208 = frameID_1; - const float x_211 = asfloat(x_20[6].w); - const float4 x_217 = animationMapTexture.SampleBias(animationMapSampler, float2(((x_208 + 0.5f) / x_211), (0.125f * f)), 0.0f); - animationData = x_217; - } - } - } - param = (frameID_1 + 0.5f); - const float4x4 x_225 = getFrameData_f1_(param); - frameData = x_225; - const float4 x_228 = frameData[0]; - const float2 x_231 = asfloat(x_20[6].xy); - frameSize = (float2(x_228.w, x_228.z) / x_231); - const float4 x_235 = frameData[0]; - offset_1 = (float2(x_235.x, x_235.y) * sheetUnits); - const float4 x_241 = frameData[2]; - const float4 x_244 = frameData[0]; - ratio = (float2(x_241.x, x_241.y) / float2(x_244.w, x_244.z)); - const float x_248 = frameData[2].z; - if ((x_248 == 1.0f)) { - const float2 x_252 = tileUV; - tileUV = float2(x_252.y, x_252.x); - } - if ((i == 0)) { - const float4 x_268 = spriteSheetTexture.Sample(spriteSheetSampler, ((tileUV * frameSize) + offset_1)); - color = x_268; - } else { - const float4 x_279 = spriteSheetTexture.Sample(spriteSheetSampler, ((tileUV * frameSize) + offset_1)); - nc = x_279; - const float x_283 = color.w; - const float x_285 = nc.w; - alpha = min((x_283 + x_285), 1.0f); - const float4 x_290 = color; - const float4 x_292 = nc; - const float x_295 = nc.w; - mixed = lerp(float3(x_290.x, x_290.y, x_290.z), float3(x_292.x, x_292.y, x_292.z), float3(x_295, x_295, x_295)); - const float3 x_298 = mixed; - color = float4(x_298.x, x_298.y, x_298.z, alpha); - } - } - } - const float3 x_310 = asfloat(x_20[7].xyz); - const float4 x_311 = color; - const float3 x_313 = (float3(x_311.x, x_311.y, x_311.z) * x_310); - color = float4(x_313.x, x_313.y, x_313.z, color.w); - glFragColor = color; - return; -} - -struct main_out { - float4 glFragColor_1; -}; -struct tint_symbol_1 { - float3 vPosition_param : TEXCOORD0; - float2 vUV_param : TEXCOORD1; - float2 tUV_param : TEXCOORD2; - float2 stageUnits_1_param : TEXCOORD3; - float2 levelUnits_param : TEXCOORD4; - float2 tileID_1_param : TEXCOORD5; -}; -struct tint_symbol_2 { - float4 glFragColor_1 : SV_Target0; -}; - -main_out main_inner(float2 tUV_param, float2 tileID_1_param, float2 levelUnits_param, float2 stageUnits_1_param, float3 vPosition_param, float2 vUV_param) { - tUV = tUV_param; - tileID_1 = tileID_1_param; - levelUnits = levelUnits_param; - stageUnits_1 = stageUnits_1_param; - vPosition = vPosition_param; - vUV = vUV_param; - main_1(); - const main_out tint_symbol_6 = {glFragColor}; - return tint_symbol_6; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.tUV_param, tint_symbol.tileID_1_param, tint_symbol.levelUnits_param, tint_symbol.stageUnits_1_param, tint_symbol.vPosition_param, tint_symbol.vUV_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.glFragColor_1 = inner_result.glFragColor_1; - return wrapper_result; -} diff --git a/test/tint/bug/tint/948.wgsl.expected.msl b/test/tint/bug/tint/948.wgsl.expected.msl index 25febafed1..ad556254fa 100644 --- a/test/tint/bug/tint/948.wgsl.expected.msl +++ b/test/tint/bug/tint/948.wgsl.expected.msl @@ -1,7 +1,31 @@ +bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from uniform control flow + let x_217 : vec4 = textureSampleBias(animationMapTexture, animationMapSampler, vec2(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0); + ^^^^^^^^^^^^^^^^^ + +bug/tint/948.wgsl:138:9 note: control flow depends on non-uniform value + if ((x_197 > x_198)) { + ^^ + +bug/tint/948.wgsl:137:27 note: reading from module-scope private variable 'mt' may result in a non-uniform value + let x_198 : f32 = mt; + ^^ + #include using namespace metal; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + template inline vec operator*(matrix lhs, packed_vec rhs) { return lhs * vec(rhs); @@ -15,7 +39,7 @@ inline vec operator*(packed_vec lhs, matrix rhs) { struct LeftOver { /* 0x0000 */ float time; /* 0x0004 */ uint padding; - /* 0x0008 */ int8_t tint_pad[8]; + /* 0x0008 */ tint_array tint_pad; /* 0x0010 */ float4x4 worldViewProjection; /* 0x0050 */ float2 outputSize; /* 0x0058 */ float2 stageSize; @@ -23,7 +47,7 @@ struct LeftOver { /* 0x0068 */ float stageScale; /* 0x006c */ float spriteCount; /* 0x0070 */ packed_float3 colorMul; - /* 0x007c */ int8_t tint_pad_1[4]; + /* 0x007c */ tint_array tint_pad_1; }; float4x4 getFrameData_f1_(thread float* const frameID, const constant LeftOver* const tint_symbol_5, texture2d tint_symbol_6, sampler tint_symbol_7) { @@ -37,10 +61,11 @@ float4x4 getFrameData_f1_(thread float* const frameID, const constant LeftOver* float4 const x_47 = tint_symbol_6.sample(tint_symbol_7, float2(x_44, 0.25f), bias(0.0f)); float const x_51 = fX; float4 const x_54 = tint_symbol_6.sample(tint_symbol_7, float2(x_51, 0.5f), bias(0.0f)); - return float4x4(float4(x_40[0], x_40[1], x_40[2], x_40[3]), float4(x_47[0], x_47[1], x_47[2], x_47[3]), float4(x_54[0], x_54[1], x_54[2], x_54[3]), float4(float4(0.0f, 0.0f, 0.0f, 0.0f)[0], float4(0.0f, 0.0f, 0.0f, 0.0f)[1], float4(0.0f, 0.0f, 0.0f, 0.0f)[2], float4(0.0f, 0.0f, 0.0f, 0.0f)[3])); + return float4x4(float4(x_40[0], x_40[1], x_40[2], x_40[3]), float4(x_47[0], x_47[1], x_47[2], x_47[3]), float4(x_54[0], x_54[1], x_54[2], x_54[3]), float4(0.0f)); } -void main_1(thread float2* const tint_symbol_8, const constant LeftOver* const tint_symbol_9, texture2d tint_symbol_10, sampler tint_symbol_11, texture2d tint_symbol_12, texture2d tint_symbol_13, sampler tint_symbol_14, thread float* const tint_symbol_15, texture2d tint_symbol_16, sampler tint_symbol_17, texture2d tint_symbol_18, sampler tint_symbol_19, thread float4* const tint_symbol_20) { +void main_1(thread float2* const tint_symbol_8, const constant LeftOver* const tint_symbol_9, texture2d tint_symbol_10, sampler tint_symbol_11, texture2d tint_symbol_12, texture2d tint_symbol_13, sampler tint_symbol_14, texture2d tint_symbol_16, sampler tint_symbol_17, texture2d tint_symbol_18, sampler tint_symbol_19, thread float4* const tint_symbol_20) { + thread float tint_symbol_15 = 0.0f; float4 color = 0.0f; float2 tileUV = 0.0f; float2 tileID = 0.0f; @@ -59,7 +84,7 @@ void main_1(thread float2* const tint_symbol_8, const constant LeftOver* const t float4 nc = 0.0f; float alpha = 0.0f; float3 mixed = 0.0f; - color = float4(0.0f, 0.0f, 0.0f, 0.0f); + color = float4(0.0f); float2 const x_86 = *(tint_symbol_8); tileUV = fract(x_86); float const x_91 = tileUV[1]; @@ -67,11 +92,11 @@ void main_1(thread float2* const tint_symbol_8, const constant LeftOver* const t float2 const x_95 = *(tint_symbol_8); tileID = floor(x_95); float2 const x_101 = (*(tint_symbol_9)).spriteMapSize; - sheetUnits = (float2(1.0f, 1.0f) / x_101); + sheetUnits = (float2(1.0f) / x_101); float const x_106 = (*(tint_symbol_9)).spriteCount; spriteUnits = (1.0f / x_106); float2 const x_111 = (*(tint_symbol_9)).stageSize; - stageUnits = (float2(1.0f, 1.0f) / x_111); + stageUnits = (float2(1.0f) / x_111); i = 0; while (true) { int const x_122 = i; @@ -84,14 +109,14 @@ void main_1(thread float2* const tint_symbol_8, const constant LeftOver* const t case 1: { float2 const x_150 = tileID; float2 const x_154 = (*(tint_symbol_9)).stageSize; - float4 const x_156 = tint_symbol_10.sample(tint_symbol_11, ((x_150 + float2(0.5f, 0.5f)) / x_154), bias(0.0f)); + float4 const x_156 = tint_symbol_10.sample(tint_symbol_11, ((x_150 + float2(0.5f)) / x_154), bias(0.0f)); frameID_1 = x_156[0]; break; } case 0: { float2 const x_136 = tileID; float2 const x_140 = (*(tint_symbol_9)).stageSize; - float4 const x_142 = tint_symbol_12.sample(tint_symbol_11, ((x_136 + float2(0.5f, 0.5f)) / x_140), bias(0.0f)); + float4 const x_142 = tint_symbol_12.sample(tint_symbol_11, ((x_136 + float2(0.5f)) / x_140), bias(0.0f)); frameID_1 = x_142[0]; break; } @@ -107,7 +132,7 @@ void main_1(thread float2* const tint_symbol_8, const constant LeftOver* const t if ((x_174 > 0.0f)) { float const x_181 = (*(tint_symbol_9)).time; float const x_184 = animationData[2]; - *(tint_symbol_15) = fmod((x_181 * x_184), 1.0f); + tint_symbol_15 = fmod((x_181 * x_184), 1.0f); f = 0.0f; while (true) { float const x_193 = f; @@ -116,7 +141,7 @@ void main_1(thread float2* const tint_symbol_8, const constant LeftOver* const t break; } float const x_197 = animationData[1]; - float const x_198 = *(tint_symbol_15); + float const x_198 = tint_symbol_15; if ((x_197 > x_198)) { float const x_203 = animationData[0]; frameID_1 = x_203; @@ -207,28 +232,27 @@ struct tint_symbol_3 { float4 glFragColor_1 [[color(0)]]; }; -main_out tint_symbol_inner(float2 tUV_param, float2 tileID_1_param, float2 levelUnits_param, float2 stageUnits_1_param, float3 vPosition_param, float2 vUV_param, thread float2* const tint_symbol_21, thread float2* const tint_symbol_22, thread float2* const tint_symbol_23, thread float2* const tint_symbol_24, thread float3* const tint_symbol_25, thread float2* const tint_symbol_26, const constant LeftOver* const tint_symbol_27, texture2d tint_symbol_28, sampler tint_symbol_29, texture2d tint_symbol_30, texture2d tint_symbol_31, sampler tint_symbol_32, thread float* const tint_symbol_33, texture2d tint_symbol_34, sampler tint_symbol_35, texture2d tint_symbol_36, sampler tint_symbol_37, thread float4* const tint_symbol_38) { +main_out tint_symbol_inner(float2 tUV_param, float2 tileID_1_param, float2 levelUnits_param, float2 stageUnits_1_param, float3 vPosition_param, float2 vUV_param, thread float2* const tint_symbol_21, const constant LeftOver* const tint_symbol_27, texture2d tint_symbol_28, sampler tint_symbol_29, texture2d tint_symbol_30, texture2d tint_symbol_31, sampler tint_symbol_32, texture2d tint_symbol_33, sampler tint_symbol_34, texture2d tint_symbol_35, sampler tint_symbol_36, thread float4* const tint_symbol_37) { + thread float2 tint_symbol_22 = 0.0f; + thread float2 tint_symbol_23 = 0.0f; + thread float2 tint_symbol_24 = 0.0f; + thread float3 tint_symbol_25 = 0.0f; + thread float2 tint_symbol_26 = 0.0f; *(tint_symbol_21) = tUV_param; - *(tint_symbol_22) = tileID_1_param; - *(tint_symbol_23) = levelUnits_param; - *(tint_symbol_24) = stageUnits_1_param; - *(tint_symbol_25) = vPosition_param; - *(tint_symbol_26) = vUV_param; - main_1(tint_symbol_21, tint_symbol_27, tint_symbol_28, tint_symbol_29, tint_symbol_30, tint_symbol_31, tint_symbol_32, tint_symbol_33, tint_symbol_34, tint_symbol_35, tint_symbol_36, tint_symbol_37, tint_symbol_38); - main_out const tint_symbol_4 = {.glFragColor_1=*(tint_symbol_38)}; + tint_symbol_22 = tileID_1_param; + tint_symbol_23 = levelUnits_param; + tint_symbol_24 = stageUnits_1_param; + tint_symbol_25 = vPosition_param; + tint_symbol_26 = vUV_param; + main_1(tint_symbol_21, tint_symbol_27, tint_symbol_28, tint_symbol_29, tint_symbol_30, tint_symbol_31, tint_symbol_32, tint_symbol_33, tint_symbol_34, tint_symbol_35, tint_symbol_36, tint_symbol_37); + main_out const tint_symbol_4 = {.glFragColor_1=*(tint_symbol_37)}; return tint_symbol_4; } -fragment tint_symbol_3 tint_symbol(const constant LeftOver* tint_symbol_45 [[buffer(0)]], texture2d tint_symbol_46 [[texture(0)]], sampler tint_symbol_47 [[sampler(0)]], texture2d tint_symbol_48 [[texture(1)]], texture2d tint_symbol_49 [[texture(2)]], sampler tint_symbol_50 [[sampler(1)]], texture2d tint_symbol_52 [[texture(3)]], sampler tint_symbol_53 [[sampler(2)]], texture2d tint_symbol_54 [[texture(4)]], sampler tint_symbol_55 [[sampler(3)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { - thread float2 tint_symbol_39 = 0.0f; - thread float2 tint_symbol_40 = 0.0f; - thread float2 tint_symbol_41 = 0.0f; - thread float2 tint_symbol_42 = 0.0f; - thread float3 tint_symbol_43 = 0.0f; - thread float2 tint_symbol_44 = 0.0f; - thread float tint_symbol_51 = 0.0f; - thread float4 tint_symbol_56 = 0.0f; - main_out const inner_result = tint_symbol_inner(tint_symbol_1.tUV_param, tint_symbol_1.tileID_1_param, tint_symbol_1.levelUnits_param, tint_symbol_1.stageUnits_1_param, tint_symbol_1.vPosition_param, tint_symbol_1.vUV_param, &(tint_symbol_39), &(tint_symbol_40), &(tint_symbol_41), &(tint_symbol_42), &(tint_symbol_43), &(tint_symbol_44), tint_symbol_45, tint_symbol_46, tint_symbol_47, tint_symbol_48, tint_symbol_49, tint_symbol_50, &(tint_symbol_51), tint_symbol_52, tint_symbol_53, tint_symbol_54, tint_symbol_55, &(tint_symbol_56)); +fragment tint_symbol_3 tint_symbol(const constant LeftOver* tint_symbol_39 [[buffer(0)]], texture2d tint_symbol_40 [[texture(0)]], sampler tint_symbol_41 [[sampler(0)]], texture2d tint_symbol_42 [[texture(1)]], texture2d tint_symbol_43 [[texture(2)]], sampler tint_symbol_44 [[sampler(1)]], texture2d tint_symbol_45 [[texture(3)]], sampler tint_symbol_46 [[sampler(2)]], texture2d tint_symbol_47 [[texture(4)]], sampler tint_symbol_48 [[sampler(3)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float2 tint_symbol_38 = 0.0f; + thread float4 tint_symbol_49 = 0.0f; + main_out const inner_result = tint_symbol_inner(tint_symbol_1.tUV_param, tint_symbol_1.tileID_1_param, tint_symbol_1.levelUnits_param, tint_symbol_1.stageUnits_1_param, tint_symbol_1.vPosition_param, tint_symbol_1.vUV_param, &(tint_symbol_38), tint_symbol_39, tint_symbol_40, tint_symbol_41, tint_symbol_42, tint_symbol_43, tint_symbol_44, tint_symbol_45, tint_symbol_46, tint_symbol_47, tint_symbol_48, &(tint_symbol_49)); tint_symbol_3 wrapper_result = {}; wrapper_result.glFragColor_1 = inner_result.glFragColor_1; return wrapper_result; diff --git a/test/tint/bug/tint/948.wgsl.expected.spvasm b/test/tint/bug/tint/948.wgsl.expected.spvasm index 51c0bb08ad..91c81d8998 100644 --- a/test/tint/bug/tint/948.wgsl.expected.spvasm +++ b/test/tint/bug/tint/948.wgsl.expected.spvasm @@ -1,10 +1,22 @@ +bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from uniform control flow + let x_217 : vec4 = textureSampleBias(animationMapTexture, animationMapSampler, vec2(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0); + ^^^^^^^^^^^^^^^^^ + +bug/tint/948.wgsl:138:9 note: control flow depends on non-uniform value + if ((x_197 > x_198)) { + ^^ + +bug/tint/948.wgsl:137:27 note: reading from module-scope private variable 'mt' may result in a non-uniform value + let x_198 : f32 = mt; + ^^ + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 386 +; Bound: 378 ; Schema: 0 OpCapability Shader - %138 = OpExtInstImport "GLSL.std.450" + %131 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" %tUV_param_1 %tileID_1_param_1 %levelUnits_param_1 %stageUnits_1_param_1 %vPosition_param_1 %vUV_param_1 %glFragColor_1_1 OpExecutionMode %main OriginUpperLeft @@ -169,30 +181,27 @@ %uint_7 = OpConstant %uint 7 %_ptr_Uniform_float = OpTypePointer Uniform %float %66 = OpTypeSampledImage %23 - %float_0 = OpConstant %float 0 %float_0_25 = OpConstant %float 0.25 %float_0_5 = OpConstant %float 0.5 - %99 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 %void = OpTypeVoid - %106 = OpTypeFunction %void + %99 = OpTypeFunction %void %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v2float = OpTypePointer Function %v2float %int = OpTypeInt 32 1 %_ptr_Function_int = OpTypePointer Function %int - %121 = OpConstantNull %int + %114 = OpConstantNull %int %_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float - %127 = OpConstantNull %mat4v4float + %120 = OpConstantNull %mat4v4float %_ptr_Function_v3float = OpTypePointer Function %v3float %uint_1 = OpConstant %uint 1 %float_1 = OpConstant %float 1 %uint_5 = OpConstant %uint 5 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float - %151 = OpConstantComposite %v2float %float_1 %float_1 + %144 = OpConstantComposite %v2float %float_1 %float_1 %uint_4 = OpConstant %uint 4 - %int_0 = OpConstant %int 0 %int_2 = OpConstant %int 2 %bool = OpTypeBool - %184 = OpConstantComposite %v2float %float_0_5 %float_0_5 + %176 = OpConstantComposite %v2float %float_0_5 %float_0_5 %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 %float_8 = OpConstant %float 8 @@ -202,7 +211,7 @@ %uint_8 = OpConstant %uint 8 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float %main_out = OpTypeStruct %v4float - %363 = OpTypeFunction %main_out %v2float %v2float %v2float %v2float %v3float %v2float + %355 = OpTypeFunction %main_out %v2float %v2float %v2float %v2float %v3float %v2float %getFrameData_f1_ = OpFunction %mat4v4float None %49 %frameID = OpFunctionParameter %_ptr_Function_float %53 = OpLabel @@ -216,56 +225,51 @@ %64 = OpLoad %26 %frameMapSampler %65 = OpLoad %23 %frameMapTexture %67 = OpSampledImage %66 %65 %64 - %69 = OpCompositeConstruct %v2float %62 %float_0 - %63 = OpImageSampleImplicitLod %v4float %67 %69 Bias %float_0 - %70 = OpLoad %float %fX - %72 = OpLoad %26 %frameMapSampler - %73 = OpLoad %23 %frameMapTexture - %74 = OpSampledImage %66 %73 %72 - %76 = OpCompositeConstruct %v2float %70 %float_0_25 - %71 = OpImageSampleImplicitLod %v4float %74 %76 Bias %float_0 - %77 = OpLoad %float %fX - %79 = OpLoad %26 %frameMapSampler - %80 = OpLoad %23 %frameMapTexture - %81 = OpSampledImage %66 %80 %79 - %83 = OpCompositeConstruct %v2float %77 %float_0_5 - %78 = OpImageSampleImplicitLod %v4float %81 %83 Bias %float_0 - %84 = OpCompositeExtract %float %63 0 - %85 = OpCompositeExtract %float %63 1 - %86 = OpCompositeExtract %float %63 2 - %87 = OpCompositeExtract %float %63 3 - %88 = OpCompositeConstruct %v4float %84 %85 %86 %87 - %89 = OpCompositeExtract %float %71 0 - %90 = OpCompositeExtract %float %71 1 - %91 = OpCompositeExtract %float %71 2 - %92 = OpCompositeExtract %float %71 3 - %93 = OpCompositeConstruct %v4float %89 %90 %91 %92 - %94 = OpCompositeExtract %float %78 0 - %95 = OpCompositeExtract %float %78 1 - %96 = OpCompositeExtract %float %78 2 - %97 = OpCompositeExtract %float %78 3 - %98 = OpCompositeConstruct %v4float %94 %95 %96 %97 - %100 = OpCompositeExtract %float %99 0 - %101 = OpCompositeExtract %float %99 1 - %102 = OpCompositeExtract %float %99 2 - %103 = OpCompositeExtract %float %99 3 - %104 = OpCompositeConstruct %v4float %100 %101 %102 %103 - %105 = OpCompositeConstruct %mat4v4float %88 %93 %98 %104 - OpReturnValue %105 + %68 = OpCompositeConstruct %v2float %62 %37 + %63 = OpImageSampleImplicitLod %v4float %67 %68 Bias %37 + %69 = OpLoad %float %fX + %71 = OpLoad %26 %frameMapSampler + %72 = OpLoad %23 %frameMapTexture + %73 = OpSampledImage %66 %72 %71 + %75 = OpCompositeConstruct %v2float %69 %float_0_25 + %70 = OpImageSampleImplicitLod %v4float %73 %75 Bias %37 + %76 = OpLoad %float %fX + %78 = OpLoad %26 %frameMapSampler + %79 = OpLoad %23 %frameMapTexture + %80 = OpSampledImage %66 %79 %78 + %82 = OpCompositeConstruct %v2float %76 %float_0_5 + %77 = OpImageSampleImplicitLod %v4float %80 %82 Bias %37 + %83 = OpCompositeExtract %float %63 0 + %84 = OpCompositeExtract %float %63 1 + %85 = OpCompositeExtract %float %63 2 + %86 = OpCompositeExtract %float %63 3 + %87 = OpCompositeConstruct %v4float %83 %84 %85 %86 + %88 = OpCompositeExtract %float %70 0 + %89 = OpCompositeExtract %float %70 1 + %90 = OpCompositeExtract %float %70 2 + %91 = OpCompositeExtract %float %70 3 + %92 = OpCompositeConstruct %v4float %88 %89 %90 %91 + %93 = OpCompositeExtract %float %77 0 + %94 = OpCompositeExtract %float %77 1 + %95 = OpCompositeExtract %float %77 2 + %96 = OpCompositeExtract %float %77 3 + %97 = OpCompositeConstruct %v4float %93 %94 %95 %96 + %98 = OpCompositeConstruct %mat4v4float %87 %92 %97 %15 + OpReturnValue %98 OpFunctionEnd - %main_1 = OpFunction %void None %106 - %109 = OpLabel + %main_1 = OpFunction %void None %99 + %102 = OpLabel %color = OpVariable %_ptr_Function_v4float Function %15 %tileUV = OpVariable %_ptr_Function_v2float Function %29 %tileID = OpVariable %_ptr_Function_v2float Function %29 %sheetUnits = OpVariable %_ptr_Function_v2float Function %29 %spriteUnits = OpVariable %_ptr_Function_float Function %37 %stageUnits = OpVariable %_ptr_Function_v2float Function %29 - %i = OpVariable %_ptr_Function_int Function %121 + %i = OpVariable %_ptr_Function_int Function %114 %frameID_1 = OpVariable %_ptr_Function_float Function %37 %animationData = OpVariable %_ptr_Function_v4float Function %15 %f = OpVariable %_ptr_Function_float Function %37 - %frameData = OpVariable %_ptr_Function_mat4v4float Function %127 + %frameData = OpVariable %_ptr_Function_mat4v4float Function %120 %param = OpVariable %_ptr_Function_float Function %37 %frameSize = OpVariable %_ptr_Function_v2float Function %29 %offset_1 = OpVariable %_ptr_Function_v2float Function %29 @@ -273,310 +277,310 @@ %nc = OpVariable %_ptr_Function_v4float Function %15 %alpha = OpVariable %_ptr_Function_float Function %37 %mixed = OpVariable %_ptr_Function_v3float Function %47 - OpStore %color %99 - %136 = OpLoad %v2float %tUV - %137 = OpExtInst %v2float %138 Fract %136 - OpStore %tileUV %137 - %140 = OpAccessChain %_ptr_Function_float %tileUV %uint_1 - %141 = OpLoad %float %140 - %142 = OpAccessChain %_ptr_Function_float %tileUV %uint_1 - %144 = OpFSub %float %float_1 %141 - OpStore %142 %144 - %145 = OpLoad %v2float %tUV - %146 = OpExtInst %v2float %138 Floor %145 - OpStore %tileID %146 - %149 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_5 - %150 = OpLoad %v2float %149 - %152 = OpFDiv %v2float %151 %150 - OpStore %sheetUnits %152 - %153 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 - %154 = OpLoad %float %153 - %155 = OpFDiv %float %float_1 %154 - OpStore %spriteUnits %155 - %157 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_4 - %158 = OpLoad %v2float %157 - %159 = OpFDiv %v2float %151 %158 - OpStore %stageUnits %159 - OpStore %i %int_0 + OpStore %color %15 + %129 = OpLoad %v2float %tUV + %130 = OpExtInst %v2float %131 Fract %129 + OpStore %tileUV %130 + %133 = OpAccessChain %_ptr_Function_float %tileUV %uint_1 + %134 = OpLoad %float %133 + %135 = OpAccessChain %_ptr_Function_float %tileUV %uint_1 + %137 = OpFSub %float %float_1 %134 + OpStore %135 %137 + %138 = OpLoad %v2float %tUV + %139 = OpExtInst %v2float %131 Floor %138 + OpStore %tileID %139 + %142 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_5 + %143 = OpLoad %v2float %142 + %145 = OpFDiv %v2float %144 %143 + OpStore %sheetUnits %145 + %146 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 + %147 = OpLoad %float %146 + %148 = OpFDiv %float %float_1 %147 + OpStore %spriteUnits %148 + %150 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_4 + %151 = OpLoad %v2float %150 + %152 = OpFDiv %v2float %144 %151 + OpStore %stageUnits %152 + OpStore %i %114 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %154 %155 None + OpBranch %156 + %156 = OpLabel + %157 = OpLoad %int %i + %159 = OpSLessThan %bool %157 %int_2 + OpSelectionMerge %161 None + OpBranchConditional %159 %162 %163 + %162 = OpLabel OpBranch %161 + %163 = OpLabel + OpBranch %154 %161 = OpLabel - OpLoopMerge %162 %163 None - OpBranch %164 - %164 = OpLabel - %165 = OpLoad %int %i - %167 = OpSLessThan %bool %165 %int_2 - OpSelectionMerge %169 None - OpBranchConditional %167 %170 %171 - %170 = OpLabel - OpBranch %169 - %171 = OpLabel - OpBranch %162 - %169 = OpLabel - %172 = OpLoad %int %i - OpSelectionMerge %173 None - OpSwitch %172 %174 1 %175 0 %176 - %175 = OpLabel - %177 = OpLoad %v2float %tileID - %178 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_4 - %179 = OpLoad %v2float %178 - %181 = OpLoad %26 %tileMapsSampler - %182 = OpLoad %23 %tileMapsTexture1 - %183 = OpSampledImage %66 %182 %181 - %185 = OpFAdd %v2float %177 %184 - %186 = OpFDiv %v2float %185 %179 - %180 = OpImageSampleImplicitLod %v4float %183 %186 Bias %float_0 - %187 = OpCompositeExtract %float %180 0 - OpStore %frameID_1 %187 - OpBranch %173 - %176 = OpLabel - %188 = OpLoad %v2float %tileID - %189 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_4 - %190 = OpLoad %v2float %189 - %192 = OpLoad %26 %tileMapsSampler - %193 = OpLoad %23 %tileMapsTexture0 - %194 = OpSampledImage %66 %193 %192 - %195 = OpFAdd %v2float %188 %184 - %196 = OpFDiv %v2float %195 %190 - %191 = OpImageSampleImplicitLod %v4float %194 %196 Bias %float_0 - %197 = OpCompositeExtract %float %191 0 - OpStore %frameID_1 %197 - OpBranch %173 - %174 = OpLabel - OpBranch %173 - %173 = OpLabel - %198 = OpLoad %float %frameID_1 - %199 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 - %200 = OpLoad %float %199 - %202 = OpLoad %26 %animationMapSampler - %203 = OpLoad %23 %animationMapTexture - %204 = OpSampledImage %66 %203 %202 - %205 = OpFAdd %float %198 %float_0_5 - %206 = OpFDiv %float %205 %200 - %207 = OpCompositeConstruct %v2float %206 %float_0 - %201 = OpImageSampleImplicitLod %v4float %204 %207 Bias %float_0 - OpStore %animationData %201 - %208 = OpAccessChain %_ptr_Function_float %animationData %uint_1 - %209 = OpLoad %float %208 - %210 = OpFOrdGreaterThan %bool %209 %float_0 - OpSelectionMerge %211 None - OpBranchConditional %210 %212 %211 - %212 = OpLabel - %214 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 - %215 = OpLoad %float %214 - %217 = OpAccessChain %_ptr_Function_float %animationData %uint_2 - %218 = OpLoad %float %217 - %219 = OpFMul %float %215 %218 - %220 = OpFRem %float %219 %float_1 - OpStore %mt %220 - OpStore %f %float_0 - OpBranch %221 + %164 = OpLoad %int %i + OpSelectionMerge %165 None + OpSwitch %164 %166 1 %167 0 %168 + %167 = OpLabel + %169 = OpLoad %v2float %tileID + %170 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_4 + %171 = OpLoad %v2float %170 + %173 = OpLoad %26 %tileMapsSampler + %174 = OpLoad %23 %tileMapsTexture1 + %175 = OpSampledImage %66 %174 %173 + %177 = OpFAdd %v2float %169 %176 + %178 = OpFDiv %v2float %177 %171 + %172 = OpImageSampleImplicitLod %v4float %175 %178 Bias %37 + %179 = OpCompositeExtract %float %172 0 + OpStore %frameID_1 %179 + OpBranch %165 + %168 = OpLabel + %180 = OpLoad %v2float %tileID + %181 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_4 + %182 = OpLoad %v2float %181 + %184 = OpLoad %26 %tileMapsSampler + %185 = OpLoad %23 %tileMapsTexture0 + %186 = OpSampledImage %66 %185 %184 + %187 = OpFAdd %v2float %180 %176 + %188 = OpFDiv %v2float %187 %182 + %183 = OpImageSampleImplicitLod %v4float %186 %188 Bias %37 + %189 = OpCompositeExtract %float %183 0 + OpStore %frameID_1 %189 + OpBranch %165 + %166 = OpLabel + OpBranch %165 + %165 = OpLabel + %190 = OpLoad %float %frameID_1 + %191 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 + %192 = OpLoad %float %191 + %194 = OpLoad %26 %animationMapSampler + %195 = OpLoad %23 %animationMapTexture + %196 = OpSampledImage %66 %195 %194 + %197 = OpFAdd %float %190 %float_0_5 + %198 = OpFDiv %float %197 %192 + %199 = OpCompositeConstruct %v2float %198 %37 + %193 = OpImageSampleImplicitLod %v4float %196 %199 Bias %37 + OpStore %animationData %193 + %200 = OpAccessChain %_ptr_Function_float %animationData %uint_1 + %201 = OpLoad %float %200 + %202 = OpFOrdGreaterThan %bool %201 %37 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + %206 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 + %207 = OpLoad %float %206 + %209 = OpAccessChain %_ptr_Function_float %animationData %uint_2 + %210 = OpLoad %float %209 + %211 = OpFMul %float %207 %210 + %212 = OpFRem %float %211 %float_1 + OpStore %mt %212 + OpStore %f %37 + OpBranch %213 + %213 = OpLabel + OpLoopMerge %214 %215 None + OpBranch %216 + %216 = OpLabel + %217 = OpLoad %float %f + %219 = OpFOrdLessThan %bool %217 %float_8 + OpSelectionMerge %220 None + OpBranchConditional %219 %221 %222 %221 = OpLabel - OpLoopMerge %222 %223 None - OpBranch %224 - %224 = OpLabel - %225 = OpLoad %float %f - %227 = OpFOrdLessThan %bool %225 %float_8 - OpSelectionMerge %228 None - OpBranchConditional %227 %229 %230 - %229 = OpLabel - OpBranch %228 - %230 = OpLabel - OpBranch %222 - %228 = OpLabel - %231 = OpAccessChain %_ptr_Function_float %animationData %uint_1 - %232 = OpLoad %float %231 - %233 = OpLoad %float %mt - %234 = OpFOrdGreaterThan %bool %232 %233 - OpSelectionMerge %235 None - OpBranchConditional %234 %236 %235 - %236 = OpLabel - %237 = OpAccessChain %_ptr_Function_float %animationData %uint_0 - %238 = OpLoad %float %237 - OpStore %frameID_1 %238 - OpBranch %222 - %235 = OpLabel - %239 = OpLoad %float %frameID_1 - %240 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 - %241 = OpLoad %float %240 - %242 = OpLoad %float %f - %244 = OpLoad %26 %animationMapSampler - %245 = OpLoad %23 %animationMapTexture - %246 = OpSampledImage %66 %245 %244 - %247 = OpFAdd %float %239 %float_0_5 - %248 = OpFDiv %float %247 %241 - %250 = OpFMul %float %float_0_125 %242 - %251 = OpCompositeConstruct %v2float %248 %250 - %243 = OpImageSampleImplicitLod %v4float %246 %251 Bias %float_0 - OpStore %animationData %243 - OpBranch %223 - %223 = OpLabel - %252 = OpLoad %float %f - %253 = OpFAdd %float %252 %float_1 - OpStore %f %253 - OpBranch %221 + OpBranch %220 %222 = OpLabel - OpBranch %211 - %211 = OpLabel - %254 = OpLoad %float %frameID_1 - %255 = OpFAdd %float %254 %float_0_5 - OpStore %param %255 - %256 = OpFunctionCall %mat4v4float %getFrameData_f1_ %param - OpStore %frameData %256 - %258 = OpAccessChain %_ptr_Function_v4float %frameData %int_0 + OpBranch %214 + %220 = OpLabel + %223 = OpAccessChain %_ptr_Function_float %animationData %uint_1 + %224 = OpLoad %float %223 + %225 = OpLoad %float %mt + %226 = OpFOrdGreaterThan %bool %224 %225 + OpSelectionMerge %227 None + OpBranchConditional %226 %228 %227 + %228 = OpLabel + %229 = OpAccessChain %_ptr_Function_float %animationData %uint_0 + %230 = OpLoad %float %229 + OpStore %frameID_1 %230 + OpBranch %214 + %227 = OpLabel + %231 = OpLoad %float %frameID_1 + %232 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 + %233 = OpLoad %float %232 + %234 = OpLoad %float %f + %236 = OpLoad %26 %animationMapSampler + %237 = OpLoad %23 %animationMapTexture + %238 = OpSampledImage %66 %237 %236 + %239 = OpFAdd %float %231 %float_0_5 + %240 = OpFDiv %float %239 %233 + %242 = OpFMul %float %float_0_125 %234 + %243 = OpCompositeConstruct %v2float %240 %242 + %235 = OpImageSampleImplicitLod %v4float %238 %243 Bias %37 + OpStore %animationData %235 + OpBranch %215 + %215 = OpLabel + %244 = OpLoad %float %f + %245 = OpFAdd %float %244 %float_1 + OpStore %f %245 + OpBranch %213 + %214 = OpLabel + OpBranch %203 + %203 = OpLabel + %246 = OpLoad %float %frameID_1 + %247 = OpFAdd %float %246 %float_0_5 + OpStore %param %247 + %248 = OpFunctionCall %mat4v4float %getFrameData_f1_ %param + OpStore %frameData %248 + %250 = OpAccessChain %_ptr_Function_v4float %frameData %114 + %251 = OpLoad %v4float %250 + %252 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_5 + %253 = OpLoad %v2float %252 + %254 = OpCompositeExtract %float %251 3 + %255 = OpCompositeExtract %float %251 2 + %256 = OpCompositeConstruct %v2float %254 %255 + %257 = OpFDiv %v2float %256 %253 + OpStore %frameSize %257 + %258 = OpAccessChain %_ptr_Function_v4float %frameData %114 %259 = OpLoad %v4float %258 - %260 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_5 - %261 = OpLoad %v2float %260 - %262 = OpCompositeExtract %float %259 3 - %263 = OpCompositeExtract %float %259 2 - %264 = OpCompositeConstruct %v2float %262 %263 - %265 = OpFDiv %v2float %264 %261 - OpStore %frameSize %265 - %266 = OpAccessChain %_ptr_Function_v4float %frameData %int_0 - %267 = OpLoad %v4float %266 - %268 = OpLoad %v2float %sheetUnits - %269 = OpCompositeExtract %float %267 0 - %270 = OpCompositeExtract %float %267 1 + %260 = OpLoad %v2float %sheetUnits + %261 = OpCompositeExtract %float %259 0 + %262 = OpCompositeExtract %float %259 1 + %263 = OpCompositeConstruct %v2float %261 %262 + %264 = OpFMul %v2float %263 %260 + OpStore %offset_1 %264 + %265 = OpAccessChain %_ptr_Function_v4float %frameData %int_2 + %266 = OpLoad %v4float %265 + %267 = OpAccessChain %_ptr_Function_v4float %frameData %114 + %268 = OpLoad %v4float %267 + %269 = OpCompositeExtract %float %266 0 + %270 = OpCompositeExtract %float %266 1 %271 = OpCompositeConstruct %v2float %269 %270 - %272 = OpFMul %v2float %271 %268 - OpStore %offset_1 %272 - %273 = OpAccessChain %_ptr_Function_v4float %frameData %int_2 - %274 = OpLoad %v4float %273 - %275 = OpAccessChain %_ptr_Function_v4float %frameData %int_0 - %276 = OpLoad %v4float %275 - %277 = OpCompositeExtract %float %274 0 - %278 = OpCompositeExtract %float %274 1 - %279 = OpCompositeConstruct %v2float %277 %278 - %280 = OpCompositeExtract %float %276 3 - %281 = OpCompositeExtract %float %276 2 - %282 = OpCompositeConstruct %v2float %280 %281 - %283 = OpFDiv %v2float %279 %282 - OpStore %ratio %283 - %284 = OpAccessChain %_ptr_Function_float %frameData %int_2 %uint_2 - %285 = OpLoad %float %284 - %286 = OpFOrdEqual %bool %285 %float_1 + %272 = OpCompositeExtract %float %268 3 + %273 = OpCompositeExtract %float %268 2 + %274 = OpCompositeConstruct %v2float %272 %273 + %275 = OpFDiv %v2float %271 %274 + OpStore %ratio %275 + %276 = OpAccessChain %_ptr_Function_float %frameData %int_2 %uint_2 + %277 = OpLoad %float %276 + %278 = OpFOrdEqual %bool %277 %float_1 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %279 + %280 = OpLabel + %281 = OpLoad %v2float %tileUV + %282 = OpCompositeExtract %float %281 1 + %283 = OpCompositeExtract %float %281 0 + %284 = OpCompositeConstruct %v2float %282 %283 + OpStore %tileUV %284 + OpBranch %279 + %279 = OpLabel + %285 = OpLoad %int %i + %286 = OpIEqual %bool %285 %114 OpSelectionMerge %287 None - OpBranchConditional %286 %288 %287 + OpBranchConditional %286 %288 %289 %288 = OpLabel - %289 = OpLoad %v2float %tileUV - %290 = OpCompositeExtract %float %289 1 - %291 = OpCompositeExtract %float %289 0 - %292 = OpCompositeConstruct %v2float %290 %291 - OpStore %tileUV %292 + %290 = OpLoad %v2float %tileUV + %291 = OpLoad %v2float %frameSize + %292 = OpLoad %v2float %offset_1 + %294 = OpLoad %26 %spriteSheetSampler + %295 = OpLoad %23 %spriteSheetTexture + %296 = OpSampledImage %66 %295 %294 + %297 = OpFMul %v2float %290 %291 + %298 = OpFAdd %v2float %297 %292 + %293 = OpImageSampleImplicitLod %v4float %296 %298 + OpStore %color %293 + OpBranch %287 + %289 = OpLabel + %299 = OpLoad %v2float %tileUV + %300 = OpLoad %v2float %frameSize + %301 = OpLoad %v2float %offset_1 + %303 = OpLoad %26 %spriteSheetSampler + %304 = OpLoad %23 %spriteSheetTexture + %305 = OpSampledImage %66 %304 %303 + %306 = OpFMul %v2float %299 %300 + %307 = OpFAdd %v2float %306 %301 + %302 = OpImageSampleImplicitLod %v4float %305 %307 + OpStore %nc %302 + %309 = OpAccessChain %_ptr_Function_float %color %uint_3 + %310 = OpLoad %float %309 + %311 = OpAccessChain %_ptr_Function_float %nc %uint_3 + %312 = OpLoad %float %311 + %314 = OpFAdd %float %310 %312 + %313 = OpExtInst %float %131 NMin %314 %float_1 + OpStore %alpha %313 + %315 = OpLoad %v4float %color + %316 = OpLoad %v4float %nc + %317 = OpAccessChain %_ptr_Function_float %nc %uint_3 + %318 = OpLoad %float %317 + %320 = OpCompositeExtract %float %315 0 + %321 = OpCompositeExtract %float %315 1 + %322 = OpCompositeExtract %float %315 2 + %323 = OpCompositeConstruct %v3float %320 %321 %322 + %324 = OpCompositeExtract %float %316 0 + %325 = OpCompositeExtract %float %316 1 + %326 = OpCompositeExtract %float %316 2 + %327 = OpCompositeConstruct %v3float %324 %325 %326 + %328 = OpCompositeConstruct %v3float %318 %318 %318 + %319 = OpExtInst %v3float %131 FMix %323 %327 %328 + OpStore %mixed %319 + %329 = OpLoad %v3float %mixed + %330 = OpLoad %float %alpha + %331 = OpCompositeExtract %float %329 0 + %332 = OpCompositeExtract %float %329 1 + %333 = OpCompositeExtract %float %329 2 + %334 = OpCompositeConstruct %v4float %331 %332 %333 %330 + OpStore %color %334 OpBranch %287 %287 = OpLabel - %293 = OpLoad %int %i - %294 = OpIEqual %bool %293 %int_0 - OpSelectionMerge %295 None - OpBranchConditional %294 %296 %297 - %296 = OpLabel - %298 = OpLoad %v2float %tileUV - %299 = OpLoad %v2float %frameSize - %300 = OpLoad %v2float %offset_1 - %302 = OpLoad %26 %spriteSheetSampler - %303 = OpLoad %23 %spriteSheetTexture - %304 = OpSampledImage %66 %303 %302 - %305 = OpFMul %v2float %298 %299 - %306 = OpFAdd %v2float %305 %300 - %301 = OpImageSampleImplicitLod %v4float %304 %306 - OpStore %color %301 - OpBranch %295 - %297 = OpLabel - %307 = OpLoad %v2float %tileUV - %308 = OpLoad %v2float %frameSize - %309 = OpLoad %v2float %offset_1 - %311 = OpLoad %26 %spriteSheetSampler - %312 = OpLoad %23 %spriteSheetTexture - %313 = OpSampledImage %66 %312 %311 - %314 = OpFMul %v2float %307 %308 - %315 = OpFAdd %v2float %314 %309 - %310 = OpImageSampleImplicitLod %v4float %313 %315 - OpStore %nc %310 - %317 = OpAccessChain %_ptr_Function_float %color %uint_3 - %318 = OpLoad %float %317 - %319 = OpAccessChain %_ptr_Function_float %nc %uint_3 - %320 = OpLoad %float %319 - %322 = OpFAdd %float %318 %320 - %321 = OpExtInst %float %138 NMin %322 %float_1 - OpStore %alpha %321 - %323 = OpLoad %v4float %color - %324 = OpLoad %v4float %nc - %325 = OpAccessChain %_ptr_Function_float %nc %uint_3 - %326 = OpLoad %float %325 - %328 = OpCompositeExtract %float %323 0 - %329 = OpCompositeExtract %float %323 1 - %330 = OpCompositeExtract %float %323 2 - %331 = OpCompositeConstruct %v3float %328 %329 %330 - %332 = OpCompositeExtract %float %324 0 - %333 = OpCompositeExtract %float %324 1 - %334 = OpCompositeExtract %float %324 2 - %335 = OpCompositeConstruct %v3float %332 %333 %334 - %336 = OpCompositeConstruct %v3float %326 %326 %326 - %327 = OpExtInst %v3float %138 FMix %331 %335 %336 - OpStore %mixed %327 - %337 = OpLoad %v3float %mixed - %338 = OpLoad %float %alpha - %339 = OpCompositeExtract %float %337 0 - %340 = OpCompositeExtract %float %337 1 - %341 = OpCompositeExtract %float %337 2 - %342 = OpCompositeConstruct %v4float %339 %340 %341 %338 - OpStore %color %342 - OpBranch %295 - %295 = OpLabel - OpBranch %163 - %163 = OpLabel - %343 = OpLoad %int %i - %345 = OpIAdd %int %343 %int_1 - OpStore %i %345 - OpBranch %161 - %162 = OpLabel - %348 = OpAccessChain %_ptr_Uniform_v3float %x_20 %uint_8 - %349 = OpLoad %v3float %348 - %350 = OpLoad %v4float %color - %351 = OpCompositeExtract %float %350 0 - %352 = OpCompositeExtract %float %350 1 - %353 = OpCompositeExtract %float %350 2 - %354 = OpCompositeConstruct %v3float %351 %352 %353 - %355 = OpFMul %v3float %354 %349 - %356 = OpLoad %v4float %color - %357 = OpCompositeExtract %float %355 0 - %358 = OpCompositeExtract %float %355 1 - %359 = OpCompositeExtract %float %355 2 - %360 = OpCompositeExtract %float %356 3 - %361 = OpCompositeConstruct %v4float %357 %358 %359 %360 - OpStore %color %361 - %362 = OpLoad %v4float %color - OpStore %glFragColor %362 + OpBranch %155 + %155 = OpLabel + %335 = OpLoad %int %i + %337 = OpIAdd %int %335 %int_1 + OpStore %i %337 + OpBranch %153 + %154 = OpLabel + %340 = OpAccessChain %_ptr_Uniform_v3float %x_20 %uint_8 + %341 = OpLoad %v3float %340 + %342 = OpLoad %v4float %color + %343 = OpCompositeExtract %float %342 0 + %344 = OpCompositeExtract %float %342 1 + %345 = OpCompositeExtract %float %342 2 + %346 = OpCompositeConstruct %v3float %343 %344 %345 + %347 = OpFMul %v3float %346 %341 + %348 = OpLoad %v4float %color + %349 = OpCompositeExtract %float %347 0 + %350 = OpCompositeExtract %float %347 1 + %351 = OpCompositeExtract %float %347 2 + %352 = OpCompositeExtract %float %348 3 + %353 = OpCompositeConstruct %v4float %349 %350 %351 %352 + OpStore %color %353 + %354 = OpLoad %v4float %color + OpStore %glFragColor %354 OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %363 + %main_inner = OpFunction %main_out None %355 %tUV_param = OpFunctionParameter %v2float %tileID_1_param = OpFunctionParameter %v2float %levelUnits_param = OpFunctionParameter %v2float %stageUnits_1_param = OpFunctionParameter %v2float %vPosition_param = OpFunctionParameter %v3float %vUV_param = OpFunctionParameter %v2float - %372 = OpLabel + %364 = OpLabel OpStore %tUV %tUV_param OpStore %tileID_1 %tileID_1_param OpStore %levelUnits %levelUnits_param OpStore %stageUnits_1 %stageUnits_1_param OpStore %vPosition %vPosition_param OpStore %vUV %vUV_param - %373 = OpFunctionCall %void %main_1 - %374 = OpLoad %v4float %glFragColor - %375 = OpCompositeConstruct %main_out %374 - OpReturnValue %375 + %365 = OpFunctionCall %void %main_1 + %366 = OpLoad %v4float %glFragColor + %367 = OpCompositeConstruct %main_out %366 + OpReturnValue %367 OpFunctionEnd - %main = OpFunction %void None %106 - %377 = OpLabel - %379 = OpLoad %v2float %tUV_param_1 - %380 = OpLoad %v2float %tileID_1_param_1 - %381 = OpLoad %v2float %levelUnits_param_1 - %382 = OpLoad %v2float %stageUnits_1_param_1 - %383 = OpLoad %v3float %vPosition_param_1 - %384 = OpLoad %v2float %vUV_param_1 - %378 = OpFunctionCall %main_out %main_inner %379 %380 %381 %382 %383 %384 - %385 = OpCompositeExtract %v4float %378 0 - OpStore %glFragColor_1_1 %385 + %main = OpFunction %void None %99 + %369 = OpLabel + %371 = OpLoad %v2float %tUV_param_1 + %372 = OpLoad %v2float %tileID_1_param_1 + %373 = OpLoad %v2float %levelUnits_param_1 + %374 = OpLoad %v2float %stageUnits_1_param_1 + %375 = OpLoad %v3float %vPosition_param_1 + %376 = OpLoad %v2float %vUV_param_1 + %370 = OpFunctionCall %main_out %main_inner %371 %372 %373 %374 %375 %376 + %377 = OpCompositeExtract %v4float %370 0 + OpStore %glFragColor_1_1 %377 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/948.wgsl.expected.wgsl b/test/tint/bug/tint/948.wgsl.expected.wgsl index 3c11fec2d6..a902aec9d7 100644 --- a/test/tint/bug/tint/948.wgsl.expected.wgsl +++ b/test/tint/bug/tint/948.wgsl.expected.wgsl @@ -1,3 +1,15 @@ +bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from uniform control flow + let x_217 : vec4 = textureSampleBias(animationMapTexture, animationMapSampler, vec2(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0); + ^^^^^^^^^^^^^^^^^ + +bug/tint/948.wgsl:138:9 note: control flow depends on non-uniform value + if ((x_197 > x_198)) { + ^^ + +bug/tint/948.wgsl:137:27 note: reading from module-scope private variable 'mt' may result in a non-uniform value + let x_198 : f32 = mt; + ^^ + struct LeftOver { time : f32, @size(12) @@ -215,7 +227,7 @@ struct main_out { glFragColor_1 : vec4, } -@stage(fragment) +@fragment fn main(@location(2) tUV_param : vec2, @location(5) tileID_1_param : vec2, @location(4) levelUnits_param : vec2, @location(3) stageUnits_1_param : vec2, @location(0) vPosition_param : vec3, @location(1) vUV_param : vec2) -> main_out { tUV = tUV_param; tileID_1 = tileID_1_param; diff --git a/test/tint/bug/tint/949.wgsl b/test/tint/bug/tint/949.wgsl index 3b302a6a06..b06e420b93 100644 --- a/test/tint/bug/tint/949.wgsl +++ b/test/tint/bug/tint/949.wgsl @@ -441,7 +441,7 @@ struct main_out { glFragColor_1 : vec4, }; -@stage(fragment) +@fragment fn main(@location(1) vMainuv_param : vec2, @location(0) v_output1_param : vec4, @builtin(front_facing) gl_FrontFacing_param : bool, @location(3) v_uv_param : vec2, @location(2) v_output2_param : vec4) -> main_out { vMainuv = vMainuv_param; v_output1 = v_output1_param; diff --git a/test/tint/bug/tint/949.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/949.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e29a611252 --- /dev/null +++ b/test/tint/bug/tint/949.wgsl.expected.dxc.hlsl @@ -0,0 +1,355 @@ +bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from uniform control flow + let x_397 : vec4 = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395)); + ^^^^^^^^^^^^^ + +bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value + if ((x_400 > x_401)) { + ^^ + +bug/tint/949.wgsl:308:27 note: reading from module-scope private variable 'v_output2' may result in a non-uniform value + let x_366 : vec4 = v_output2; + ^^^^^^^^^ + +struct lightingInfo { + float3 diffuse; + float3 specular; +}; + +static float u_Float = 0.0f; +static float3 u_Color = float3(0.0f, 0.0f, 0.0f); +Texture2D TextureSamplerTexture : register(t1, space2); +SamplerState TextureSamplerSampler : register(s0, space2); +static float2 vMainuv = float2(0.0f, 0.0f); +cbuffer cbuffer_x_269 : register(b6, space2) { + uint4 x_269[11]; +}; +static float4 v_output1 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static bool gl_FrontFacing = false; +static float2 v_uv = float2(0.0f, 0.0f); +static float4 v_output2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +Texture2D TextureSampler1Texture : register(t3, space2); +SamplerState TextureSampler1Sampler : register(s2, space2); +cbuffer cbuffer_light0 : register(b5, space0) { + uint4 light0[6]; +}; +static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +SamplerState bumpSamplerSampler : register(s4, space2); +Texture2D bumpSamplerTexture : register(t5, space2); + +float3x3 cotangent_frame_vf3_vf3_vf2_vf2_(inout float3 normal_1, inout float3 p, inout float2 uv, inout float2 tangentSpaceParams) { + float3 dp1 = float3(0.0f, 0.0f, 0.0f); + float3 dp2 = float3(0.0f, 0.0f, 0.0f); + float2 duv1 = float2(0.0f, 0.0f); + float2 duv2 = float2(0.0f, 0.0f); + float3 dp2perp = float3(0.0f, 0.0f, 0.0f); + float3 dp1perp = float3(0.0f, 0.0f, 0.0f); + float3 tangent = float3(0.0f, 0.0f, 0.0f); + float3 bitangent = float3(0.0f, 0.0f, 0.0f); + float invmax = 0.0f; + const float3 x_133 = p; + dp1 = ddx(x_133); + const float3 x_136 = p; + dp2 = ddy(x_136); + const float2 x_139 = uv; + duv1 = ddx(x_139); + const float2 x_142 = uv; + duv2 = ddy(x_142); + const float3 x_145 = dp2; + const float3 x_146 = normal_1; + dp2perp = cross(x_145, x_146); + const float3 x_149 = normal_1; + dp1perp = cross(x_149, dp1); + const float3 x_153 = dp2perp; + const float x_155 = duv1.x; + const float3 x_157 = dp1perp; + const float x_159 = duv2.x; + tangent = ((x_153 * x_155) + (x_157 * x_159)); + const float3 x_163 = dp2perp; + const float x_165 = duv1.y; + const float3 x_167 = dp1perp; + const float x_169 = duv2.y; + bitangent = ((x_163 * x_165) + (x_167 * x_169)); + const float x_173 = tangentSpaceParams.x; + tangent = (tangent * x_173); + const float x_177 = tangentSpaceParams.y; + bitangent = (bitangent * x_177); + invmax = rsqrt(max(dot(tangent, tangent), dot(bitangent, bitangent))); + const float3 x_191 = (tangent * invmax); + const float3 x_194 = (bitangent * invmax); + const float3 x_195 = normal_1; + return float3x3(float3(x_191.x, x_191.y, x_191.z), float3(x_194.x, x_194.y, x_194.z), float3(x_195.x, x_195.y, x_195.z)); +} + +float3x3 transposeMat3_mf33_(inout float3x3 inMatrix) { + float3 i0 = float3(0.0f, 0.0f, 0.0f); + float3 i1 = float3(0.0f, 0.0f, 0.0f); + float3 i2 = float3(0.0f, 0.0f, 0.0f); + float3x3 outMatrix = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const float3 x_60 = inMatrix[0]; + i0 = x_60; + const float3 x_64 = inMatrix[1]; + i1 = x_64; + const float3 x_68 = inMatrix[2]; + i2 = x_68; + const float x_73 = i0.x; + const float x_75 = i1.x; + const float x_77 = i2.x; + const float3 x_78 = float3(x_73, x_75, x_77); + const float x_81 = i0.y; + const float x_83 = i1.y; + const float x_85 = i2.y; + const float3 x_86 = float3(x_81, x_83, x_85); + const float x_89 = i0.z; + const float x_91 = i1.z; + const float x_93 = i2.z; + const float3 x_94 = float3(x_89, x_91, x_93); + outMatrix = float3x3(float3(x_78.x, x_78.y, x_78.z), float3(x_86.x, x_86.y, x_86.z), float3(x_94.x, x_94.y, x_94.z)); + return outMatrix; +} + +float3 perturbNormalBase_mf33_vf3_f1_(inout float3x3 cotangentFrame, inout float3 normal, inout float scale) { + const float3x3 x_113 = cotangentFrame; + const float3 x_114 = normal; + return normalize(mul(x_114, x_113)); +} + +float3 perturbNormal_mf33_vf3_f1_(inout float3x3 cotangentFrame_1, inout float3 textureSample, inout float scale_1) { + float3x3 param = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 param_1 = float3(0.0f, 0.0f, 0.0f); + float param_2 = 0.0f; + const float3 x_119 = textureSample; + const float3x3 x_125 = cotangentFrame_1; + param = x_125; + param_1 = ((x_119 * 2.0f) - (1.0f).xxx); + const float x_128 = scale_1; + param_2 = x_128; + const float3 x_129 = perturbNormalBase_mf33_vf3_f1_(param, param_1, param_2); + return x_129; +} + +lightingInfo computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_(inout float3 viewDirectionW, inout float3 vNormal, inout float4 lightData, inout float3 diffuseColor, inout float3 specularColor, inout float3 groundColor, inout float glossiness) { + float ndl = 0.0f; + lightingInfo result = (lightingInfo)0; + float3 angleW = float3(0.0f, 0.0f, 0.0f); + float specComp = 0.0f; + const float3 x_212 = vNormal; + const float4 x_213 = lightData; + ndl = ((dot(x_212, float3(x_213.x, x_213.y, x_213.z)) * 0.5f) + 0.5f); + const float3 x_220 = groundColor; + const float3 x_221 = diffuseColor; + const float x_222 = ndl; + result.diffuse = lerp(x_220, x_221, float3(x_222, x_222, x_222)); + const float3 x_227 = viewDirectionW; + const float4 x_228 = lightData; + angleW = normalize((x_227 + float3(x_228.x, x_228.y, x_228.z))); + const float3 x_233 = vNormal; + specComp = max(0.0f, dot(x_233, angleW)); + const float x_237 = specComp; + const float x_238 = glossiness; + specComp = pow(x_237, max(1.0f, x_238)); + const float x_241 = specComp; + const float3 x_242 = specularColor; + result.specular = (x_242 * x_241); + return result; +} + +void main_1() { + float4 tempTextureRead = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 rgb = float3(0.0f, 0.0f, 0.0f); + float3 output5 = float3(0.0f, 0.0f, 0.0f); + float4 output4 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2 uvOffset = float2(0.0f, 0.0f); + float normalScale = 0.0f; + float2 TBNUV = float2(0.0f, 0.0f); + float2 x_299 = float2(0.0f, 0.0f); + float3x3 TBN = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 param_3 = float3(0.0f, 0.0f, 0.0f); + float3 param_4 = float3(0.0f, 0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float3x3 invTBN = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x3 param_7 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float parallaxLimit = 0.0f; + float2 vOffsetDir = float2(0.0f, 0.0f); + float2 vMaxOffset = float2(0.0f, 0.0f); + float numSamples = 0.0f; + float stepSize = 0.0f; + float currRayHeight = 0.0f; + float2 vCurrOffset = float2(0.0f, 0.0f); + float2 vLastOffset = float2(0.0f, 0.0f); + float lastSampledHeight = 0.0f; + float currSampledHeight = 0.0f; + int i = 0; + float delta1 = 0.0f; + float delta2 = 0.0f; + float ratio = 0.0f; + float2 parallaxOcclusion_0 = float2(0.0f, 0.0f); + float3x3 param_8 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 param_9 = float3(0.0f, 0.0f, 0.0f); + float param_10 = 0.0f; + float2 output6 = float2(0.0f, 0.0f); + float4 tempTextureRead1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 rgb1 = float3(0.0f, 0.0f, 0.0f); + float3 viewDirectionW_1 = float3(0.0f, 0.0f, 0.0f); + float shadow = 0.0f; + float glossiness_1 = 0.0f; + float3 diffuseBase = float3(0.0f, 0.0f, 0.0f); + float3 specularBase = float3(0.0f, 0.0f, 0.0f); + float3 normalW = float3(0.0f, 0.0f, 0.0f); + lightingInfo info = (lightingInfo)0; + float3 param_11 = float3(0.0f, 0.0f, 0.0f); + float3 param_12 = float3(0.0f, 0.0f, 0.0f); + float4 param_13 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 param_14 = float3(0.0f, 0.0f, 0.0f); + float3 param_15 = float3(0.0f, 0.0f, 0.0f); + float3 param_16 = float3(0.0f, 0.0f, 0.0f); + float param_17 = 0.0f; + float3 diffuseOutput = float3(0.0f, 0.0f, 0.0f); + float3 specularOutput = float3(0.0f, 0.0f, 0.0f); + float3 output3 = float3(0.0f, 0.0f, 0.0f); + u_Float = 100.0f; + u_Color = (0.5f).xxx; + const float4 x_262 = TextureSamplerTexture.Sample(TextureSamplerSampler, vMainuv); + tempTextureRead = x_262; + const float4 x_264 = tempTextureRead; + const float x_273 = asfloat(x_269[10].x); + rgb = (float3(x_264.x, x_264.y, x_264.z) * x_273); + const float3 x_279 = asfloat(x_269[9].xyz); + const float4 x_282 = v_output1; + output5 = normalize((x_279 - float3(x_282.x, x_282.y, x_282.z))); + output4 = (0.0f).xxxx; + uvOffset = (0.0f).xx; + const float x_292 = asfloat(x_269[8].x); + normalScale = (1.0f / x_292); + if (gl_FrontFacing) { + x_299 = v_uv; + } else { + x_299 = -(v_uv); + } + TBNUV = x_299; + const float4 x_310 = v_output2; + param_3 = (float3(x_310.x, x_310.y, x_310.z) * normalScale); + const float4 x_317 = v_output1; + param_4 = float3(x_317.x, x_317.y, x_317.z); + param_5 = TBNUV; + const float2 x_324 = asfloat(x_269[10].zw); + param_6 = x_324; + const float3x3 x_325 = cotangent_frame_vf3_vf3_vf2_vf2_(param_3, param_4, param_5, param_6); + TBN = x_325; + param_7 = TBN; + const float3x3 x_329 = transposeMat3_mf33_(param_7); + invTBN = x_329; + const float3 x_334 = mul(-(output5), invTBN); + parallaxLimit = (length(float2(x_334.x, x_334.y)) / mul(-(output5), invTBN).z); + const float x_345 = asfloat(x_269[9].w); + parallaxLimit = (parallaxLimit * x_345); + const float3 x_352 = mul(-(output5), invTBN); + vOffsetDir = normalize(float2(x_352.x, x_352.y)); + vMaxOffset = (vOffsetDir * parallaxLimit); + const float4 x_366 = v_output2; + numSamples = (15.0f + (dot(mul(-(output5), invTBN), mul(float3(x_366.x, x_366.y, x_366.z), invTBN)) * -11.0f)); + stepSize = (1.0f / numSamples); + currRayHeight = 1.0f; + vCurrOffset = (0.0f).xx; + vLastOffset = (0.0f).xx; + lastSampledHeight = 1.0f; + currSampledHeight = 1.0f; + i = 0; + { + [loop] for(; (i < 15); i = (i + 1)) { + const float4 x_397 = TextureSamplerTexture.Sample(TextureSamplerSampler, (v_uv + vCurrOffset)); + currSampledHeight = x_397.w; + if ((currSampledHeight > currRayHeight)) { + delta1 = (currSampledHeight - currRayHeight); + delta2 = ((currRayHeight + stepSize) - lastSampledHeight); + ratio = (delta1 / (delta1 + delta2)); + vCurrOffset = ((vLastOffset * ratio) + (vCurrOffset * (1.0f - ratio))); + break; + } else { + currRayHeight = (currRayHeight - stepSize); + vLastOffset = vCurrOffset; + vCurrOffset = (vCurrOffset + (vMaxOffset * stepSize)); + lastSampledHeight = currSampledHeight; + } + } + } + parallaxOcclusion_0 = vCurrOffset; + uvOffset = parallaxOcclusion_0; + const float4 x_452 = TextureSamplerTexture.Sample(TextureSamplerSampler, (v_uv + uvOffset)); + const float x_454 = asfloat(x_269[8].x); + param_8 = TBN; + param_9 = float3(x_452.x, x_452.y, x_452.z); + param_10 = (1.0f / x_454); + const float3 x_461 = perturbNormal_mf33_vf3_f1_(param_8, param_9, param_10); + output4 = float4(x_461.x, x_461.y, x_461.z, output4.w); + output6 = (v_uv + uvOffset); + const float4 x_475 = TextureSampler1Texture.Sample(TextureSampler1Sampler, output6); + tempTextureRead1 = x_475; + const float4 x_477 = tempTextureRead1; + rgb1 = float3(x_477.x, x_477.y, x_477.z); + const float3 x_481 = asfloat(x_269[9].xyz); + const float4 x_482 = v_output1; + viewDirectionW_1 = normalize((x_481 - float3(x_482.x, x_482.y, x_482.z))); + shadow = 1.0f; + glossiness_1 = (1.0f * u_Float); + diffuseBase = (0.0f).xxx; + specularBase = (0.0f).xxx; + const float4 x_494 = output4; + normalW = float3(x_494.x, x_494.y, x_494.z); + param_11 = viewDirectionW_1; + param_12 = normalW; + const float4 x_507 = asfloat(light0[0]); + param_13 = x_507; + const float4 x_510 = asfloat(light0[1]); + param_14 = float3(x_510.x, x_510.y, x_510.z); + const float4 x_514 = asfloat(light0[2]); + param_15 = float3(x_514.x, x_514.y, x_514.z); + const float3 x_518 = asfloat(light0[3].xyz); + param_16 = x_518; + param_17 = glossiness_1; + const lightingInfo x_521 = computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_(param_11, param_12, param_13, param_14, param_15, param_16, param_17); + info = x_521; + shadow = 1.0f; + const float3 x_523 = info.diffuse; + diffuseBase = (diffuseBase + (x_523 * shadow)); + const float3 x_529 = info.specular; + specularBase = (specularBase + (x_529 * shadow)); + diffuseOutput = (diffuseBase * rgb1); + specularOutput = (specularBase * u_Color); + output3 = (diffuseOutput + specularOutput); + const float3 x_548 = output3; + glFragColor = float4(x_548.x, x_548.y, x_548.z, 1.0f); + return; +} + +struct main_out { + float4 glFragColor_1; +}; +struct tint_symbol_1 { + float4 v_output1_param : TEXCOORD0; + float2 vMainuv_param : TEXCOORD1; + float4 v_output2_param : TEXCOORD2; + float2 v_uv_param : TEXCOORD3; + bool gl_FrontFacing_param : SV_IsFrontFace; +}; +struct tint_symbol_2 { + float4 glFragColor_1 : SV_Target0; +}; + +main_out main_inner(float2 vMainuv_param, float4 v_output1_param, bool gl_FrontFacing_param, float2 v_uv_param, float4 v_output2_param) { + vMainuv = vMainuv_param; + v_output1 = v_output1_param; + gl_FrontFacing = gl_FrontFacing_param; + v_uv = v_uv_param; + v_output2 = v_output2_param; + main_1(); + const main_out tint_symbol_8 = {glFragColor}; + return tint_symbol_8; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.vMainuv_param, tint_symbol.v_output1_param, tint_symbol.gl_FrontFacing_param, tint_symbol.v_uv_param, tint_symbol.v_output2_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.glFragColor_1 = inner_result.glFragColor_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/949.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/949.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e29a611252 --- /dev/null +++ b/test/tint/bug/tint/949.wgsl.expected.fxc.hlsl @@ -0,0 +1,355 @@ +bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from uniform control flow + let x_397 : vec4 = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395)); + ^^^^^^^^^^^^^ + +bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value + if ((x_400 > x_401)) { + ^^ + +bug/tint/949.wgsl:308:27 note: reading from module-scope private variable 'v_output2' may result in a non-uniform value + let x_366 : vec4 = v_output2; + ^^^^^^^^^ + +struct lightingInfo { + float3 diffuse; + float3 specular; +}; + +static float u_Float = 0.0f; +static float3 u_Color = float3(0.0f, 0.0f, 0.0f); +Texture2D TextureSamplerTexture : register(t1, space2); +SamplerState TextureSamplerSampler : register(s0, space2); +static float2 vMainuv = float2(0.0f, 0.0f); +cbuffer cbuffer_x_269 : register(b6, space2) { + uint4 x_269[11]; +}; +static float4 v_output1 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static bool gl_FrontFacing = false; +static float2 v_uv = float2(0.0f, 0.0f); +static float4 v_output2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +Texture2D TextureSampler1Texture : register(t3, space2); +SamplerState TextureSampler1Sampler : register(s2, space2); +cbuffer cbuffer_light0 : register(b5, space0) { + uint4 light0[6]; +}; +static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +SamplerState bumpSamplerSampler : register(s4, space2); +Texture2D bumpSamplerTexture : register(t5, space2); + +float3x3 cotangent_frame_vf3_vf3_vf2_vf2_(inout float3 normal_1, inout float3 p, inout float2 uv, inout float2 tangentSpaceParams) { + float3 dp1 = float3(0.0f, 0.0f, 0.0f); + float3 dp2 = float3(0.0f, 0.0f, 0.0f); + float2 duv1 = float2(0.0f, 0.0f); + float2 duv2 = float2(0.0f, 0.0f); + float3 dp2perp = float3(0.0f, 0.0f, 0.0f); + float3 dp1perp = float3(0.0f, 0.0f, 0.0f); + float3 tangent = float3(0.0f, 0.0f, 0.0f); + float3 bitangent = float3(0.0f, 0.0f, 0.0f); + float invmax = 0.0f; + const float3 x_133 = p; + dp1 = ddx(x_133); + const float3 x_136 = p; + dp2 = ddy(x_136); + const float2 x_139 = uv; + duv1 = ddx(x_139); + const float2 x_142 = uv; + duv2 = ddy(x_142); + const float3 x_145 = dp2; + const float3 x_146 = normal_1; + dp2perp = cross(x_145, x_146); + const float3 x_149 = normal_1; + dp1perp = cross(x_149, dp1); + const float3 x_153 = dp2perp; + const float x_155 = duv1.x; + const float3 x_157 = dp1perp; + const float x_159 = duv2.x; + tangent = ((x_153 * x_155) + (x_157 * x_159)); + const float3 x_163 = dp2perp; + const float x_165 = duv1.y; + const float3 x_167 = dp1perp; + const float x_169 = duv2.y; + bitangent = ((x_163 * x_165) + (x_167 * x_169)); + const float x_173 = tangentSpaceParams.x; + tangent = (tangent * x_173); + const float x_177 = tangentSpaceParams.y; + bitangent = (bitangent * x_177); + invmax = rsqrt(max(dot(tangent, tangent), dot(bitangent, bitangent))); + const float3 x_191 = (tangent * invmax); + const float3 x_194 = (bitangent * invmax); + const float3 x_195 = normal_1; + return float3x3(float3(x_191.x, x_191.y, x_191.z), float3(x_194.x, x_194.y, x_194.z), float3(x_195.x, x_195.y, x_195.z)); +} + +float3x3 transposeMat3_mf33_(inout float3x3 inMatrix) { + float3 i0 = float3(0.0f, 0.0f, 0.0f); + float3 i1 = float3(0.0f, 0.0f, 0.0f); + float3 i2 = float3(0.0f, 0.0f, 0.0f); + float3x3 outMatrix = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const float3 x_60 = inMatrix[0]; + i0 = x_60; + const float3 x_64 = inMatrix[1]; + i1 = x_64; + const float3 x_68 = inMatrix[2]; + i2 = x_68; + const float x_73 = i0.x; + const float x_75 = i1.x; + const float x_77 = i2.x; + const float3 x_78 = float3(x_73, x_75, x_77); + const float x_81 = i0.y; + const float x_83 = i1.y; + const float x_85 = i2.y; + const float3 x_86 = float3(x_81, x_83, x_85); + const float x_89 = i0.z; + const float x_91 = i1.z; + const float x_93 = i2.z; + const float3 x_94 = float3(x_89, x_91, x_93); + outMatrix = float3x3(float3(x_78.x, x_78.y, x_78.z), float3(x_86.x, x_86.y, x_86.z), float3(x_94.x, x_94.y, x_94.z)); + return outMatrix; +} + +float3 perturbNormalBase_mf33_vf3_f1_(inout float3x3 cotangentFrame, inout float3 normal, inout float scale) { + const float3x3 x_113 = cotangentFrame; + const float3 x_114 = normal; + return normalize(mul(x_114, x_113)); +} + +float3 perturbNormal_mf33_vf3_f1_(inout float3x3 cotangentFrame_1, inout float3 textureSample, inout float scale_1) { + float3x3 param = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 param_1 = float3(0.0f, 0.0f, 0.0f); + float param_2 = 0.0f; + const float3 x_119 = textureSample; + const float3x3 x_125 = cotangentFrame_1; + param = x_125; + param_1 = ((x_119 * 2.0f) - (1.0f).xxx); + const float x_128 = scale_1; + param_2 = x_128; + const float3 x_129 = perturbNormalBase_mf33_vf3_f1_(param, param_1, param_2); + return x_129; +} + +lightingInfo computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_(inout float3 viewDirectionW, inout float3 vNormal, inout float4 lightData, inout float3 diffuseColor, inout float3 specularColor, inout float3 groundColor, inout float glossiness) { + float ndl = 0.0f; + lightingInfo result = (lightingInfo)0; + float3 angleW = float3(0.0f, 0.0f, 0.0f); + float specComp = 0.0f; + const float3 x_212 = vNormal; + const float4 x_213 = lightData; + ndl = ((dot(x_212, float3(x_213.x, x_213.y, x_213.z)) * 0.5f) + 0.5f); + const float3 x_220 = groundColor; + const float3 x_221 = diffuseColor; + const float x_222 = ndl; + result.diffuse = lerp(x_220, x_221, float3(x_222, x_222, x_222)); + const float3 x_227 = viewDirectionW; + const float4 x_228 = lightData; + angleW = normalize((x_227 + float3(x_228.x, x_228.y, x_228.z))); + const float3 x_233 = vNormal; + specComp = max(0.0f, dot(x_233, angleW)); + const float x_237 = specComp; + const float x_238 = glossiness; + specComp = pow(x_237, max(1.0f, x_238)); + const float x_241 = specComp; + const float3 x_242 = specularColor; + result.specular = (x_242 * x_241); + return result; +} + +void main_1() { + float4 tempTextureRead = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 rgb = float3(0.0f, 0.0f, 0.0f); + float3 output5 = float3(0.0f, 0.0f, 0.0f); + float4 output4 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2 uvOffset = float2(0.0f, 0.0f); + float normalScale = 0.0f; + float2 TBNUV = float2(0.0f, 0.0f); + float2 x_299 = float2(0.0f, 0.0f); + float3x3 TBN = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 param_3 = float3(0.0f, 0.0f, 0.0f); + float3 param_4 = float3(0.0f, 0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float3x3 invTBN = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x3 param_7 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float parallaxLimit = 0.0f; + float2 vOffsetDir = float2(0.0f, 0.0f); + float2 vMaxOffset = float2(0.0f, 0.0f); + float numSamples = 0.0f; + float stepSize = 0.0f; + float currRayHeight = 0.0f; + float2 vCurrOffset = float2(0.0f, 0.0f); + float2 vLastOffset = float2(0.0f, 0.0f); + float lastSampledHeight = 0.0f; + float currSampledHeight = 0.0f; + int i = 0; + float delta1 = 0.0f; + float delta2 = 0.0f; + float ratio = 0.0f; + float2 parallaxOcclusion_0 = float2(0.0f, 0.0f); + float3x3 param_8 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 param_9 = float3(0.0f, 0.0f, 0.0f); + float param_10 = 0.0f; + float2 output6 = float2(0.0f, 0.0f); + float4 tempTextureRead1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 rgb1 = float3(0.0f, 0.0f, 0.0f); + float3 viewDirectionW_1 = float3(0.0f, 0.0f, 0.0f); + float shadow = 0.0f; + float glossiness_1 = 0.0f; + float3 diffuseBase = float3(0.0f, 0.0f, 0.0f); + float3 specularBase = float3(0.0f, 0.0f, 0.0f); + float3 normalW = float3(0.0f, 0.0f, 0.0f); + lightingInfo info = (lightingInfo)0; + float3 param_11 = float3(0.0f, 0.0f, 0.0f); + float3 param_12 = float3(0.0f, 0.0f, 0.0f); + float4 param_13 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3 param_14 = float3(0.0f, 0.0f, 0.0f); + float3 param_15 = float3(0.0f, 0.0f, 0.0f); + float3 param_16 = float3(0.0f, 0.0f, 0.0f); + float param_17 = 0.0f; + float3 diffuseOutput = float3(0.0f, 0.0f, 0.0f); + float3 specularOutput = float3(0.0f, 0.0f, 0.0f); + float3 output3 = float3(0.0f, 0.0f, 0.0f); + u_Float = 100.0f; + u_Color = (0.5f).xxx; + const float4 x_262 = TextureSamplerTexture.Sample(TextureSamplerSampler, vMainuv); + tempTextureRead = x_262; + const float4 x_264 = tempTextureRead; + const float x_273 = asfloat(x_269[10].x); + rgb = (float3(x_264.x, x_264.y, x_264.z) * x_273); + const float3 x_279 = asfloat(x_269[9].xyz); + const float4 x_282 = v_output1; + output5 = normalize((x_279 - float3(x_282.x, x_282.y, x_282.z))); + output4 = (0.0f).xxxx; + uvOffset = (0.0f).xx; + const float x_292 = asfloat(x_269[8].x); + normalScale = (1.0f / x_292); + if (gl_FrontFacing) { + x_299 = v_uv; + } else { + x_299 = -(v_uv); + } + TBNUV = x_299; + const float4 x_310 = v_output2; + param_3 = (float3(x_310.x, x_310.y, x_310.z) * normalScale); + const float4 x_317 = v_output1; + param_4 = float3(x_317.x, x_317.y, x_317.z); + param_5 = TBNUV; + const float2 x_324 = asfloat(x_269[10].zw); + param_6 = x_324; + const float3x3 x_325 = cotangent_frame_vf3_vf3_vf2_vf2_(param_3, param_4, param_5, param_6); + TBN = x_325; + param_7 = TBN; + const float3x3 x_329 = transposeMat3_mf33_(param_7); + invTBN = x_329; + const float3 x_334 = mul(-(output5), invTBN); + parallaxLimit = (length(float2(x_334.x, x_334.y)) / mul(-(output5), invTBN).z); + const float x_345 = asfloat(x_269[9].w); + parallaxLimit = (parallaxLimit * x_345); + const float3 x_352 = mul(-(output5), invTBN); + vOffsetDir = normalize(float2(x_352.x, x_352.y)); + vMaxOffset = (vOffsetDir * parallaxLimit); + const float4 x_366 = v_output2; + numSamples = (15.0f + (dot(mul(-(output5), invTBN), mul(float3(x_366.x, x_366.y, x_366.z), invTBN)) * -11.0f)); + stepSize = (1.0f / numSamples); + currRayHeight = 1.0f; + vCurrOffset = (0.0f).xx; + vLastOffset = (0.0f).xx; + lastSampledHeight = 1.0f; + currSampledHeight = 1.0f; + i = 0; + { + [loop] for(; (i < 15); i = (i + 1)) { + const float4 x_397 = TextureSamplerTexture.Sample(TextureSamplerSampler, (v_uv + vCurrOffset)); + currSampledHeight = x_397.w; + if ((currSampledHeight > currRayHeight)) { + delta1 = (currSampledHeight - currRayHeight); + delta2 = ((currRayHeight + stepSize) - lastSampledHeight); + ratio = (delta1 / (delta1 + delta2)); + vCurrOffset = ((vLastOffset * ratio) + (vCurrOffset * (1.0f - ratio))); + break; + } else { + currRayHeight = (currRayHeight - stepSize); + vLastOffset = vCurrOffset; + vCurrOffset = (vCurrOffset + (vMaxOffset * stepSize)); + lastSampledHeight = currSampledHeight; + } + } + } + parallaxOcclusion_0 = vCurrOffset; + uvOffset = parallaxOcclusion_0; + const float4 x_452 = TextureSamplerTexture.Sample(TextureSamplerSampler, (v_uv + uvOffset)); + const float x_454 = asfloat(x_269[8].x); + param_8 = TBN; + param_9 = float3(x_452.x, x_452.y, x_452.z); + param_10 = (1.0f / x_454); + const float3 x_461 = perturbNormal_mf33_vf3_f1_(param_8, param_9, param_10); + output4 = float4(x_461.x, x_461.y, x_461.z, output4.w); + output6 = (v_uv + uvOffset); + const float4 x_475 = TextureSampler1Texture.Sample(TextureSampler1Sampler, output6); + tempTextureRead1 = x_475; + const float4 x_477 = tempTextureRead1; + rgb1 = float3(x_477.x, x_477.y, x_477.z); + const float3 x_481 = asfloat(x_269[9].xyz); + const float4 x_482 = v_output1; + viewDirectionW_1 = normalize((x_481 - float3(x_482.x, x_482.y, x_482.z))); + shadow = 1.0f; + glossiness_1 = (1.0f * u_Float); + diffuseBase = (0.0f).xxx; + specularBase = (0.0f).xxx; + const float4 x_494 = output4; + normalW = float3(x_494.x, x_494.y, x_494.z); + param_11 = viewDirectionW_1; + param_12 = normalW; + const float4 x_507 = asfloat(light0[0]); + param_13 = x_507; + const float4 x_510 = asfloat(light0[1]); + param_14 = float3(x_510.x, x_510.y, x_510.z); + const float4 x_514 = asfloat(light0[2]); + param_15 = float3(x_514.x, x_514.y, x_514.z); + const float3 x_518 = asfloat(light0[3].xyz); + param_16 = x_518; + param_17 = glossiness_1; + const lightingInfo x_521 = computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_(param_11, param_12, param_13, param_14, param_15, param_16, param_17); + info = x_521; + shadow = 1.0f; + const float3 x_523 = info.diffuse; + diffuseBase = (diffuseBase + (x_523 * shadow)); + const float3 x_529 = info.specular; + specularBase = (specularBase + (x_529 * shadow)); + diffuseOutput = (diffuseBase * rgb1); + specularOutput = (specularBase * u_Color); + output3 = (diffuseOutput + specularOutput); + const float3 x_548 = output3; + glFragColor = float4(x_548.x, x_548.y, x_548.z, 1.0f); + return; +} + +struct main_out { + float4 glFragColor_1; +}; +struct tint_symbol_1 { + float4 v_output1_param : TEXCOORD0; + float2 vMainuv_param : TEXCOORD1; + float4 v_output2_param : TEXCOORD2; + float2 v_uv_param : TEXCOORD3; + bool gl_FrontFacing_param : SV_IsFrontFace; +}; +struct tint_symbol_2 { + float4 glFragColor_1 : SV_Target0; +}; + +main_out main_inner(float2 vMainuv_param, float4 v_output1_param, bool gl_FrontFacing_param, float2 v_uv_param, float4 v_output2_param) { + vMainuv = vMainuv_param; + v_output1 = v_output1_param; + gl_FrontFacing = gl_FrontFacing_param; + v_uv = v_uv_param; + v_output2 = v_output2_param; + main_1(); + const main_out tint_symbol_8 = {glFragColor}; + return tint_symbol_8; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.vMainuv_param, tint_symbol.v_output1_param, tint_symbol.gl_FrontFacing_param, tint_symbol.v_uv_param, tint_symbol.v_output2_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.glFragColor_1 = inner_result.glFragColor_1; + return wrapper_result; +} diff --git a/test/tint/bug/tint/949.wgsl.expected.glsl b/test/tint/bug/tint/949.wgsl.expected.glsl index fbb9d32a3c..8cac3069cf 100644 --- a/test/tint/bug/tint/949.wgsl.expected.glsl +++ b/test/tint/bug/tint/949.wgsl.expected.glsl @@ -1,3 +1,15 @@ +bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from uniform control flow + let x_397 : vec4 = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395)); + ^^^^^^^^^^^^^ + +bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value + if ((x_400 > x_401)) { + ^^ + +bug/tint/949.wgsl:308:27 note: reading from module-scope private variable 'v_output2' may result in a non-uniform value + let x_366 : vec4 = v_output2; + ^^^^^^^^^ + #version 310 es precision mediump float; @@ -147,7 +159,7 @@ vec3 perturbNormal_mf33_vf3_f1_(inout mat3 cotangentFrame_1, inout vec3 textureS vec3 x_119 = textureSample; mat3 x_125 = cotangentFrame_1; param = x_125; - param_1 = ((x_119 * 2.0f) - vec3(1.0f, 1.0f, 1.0f)); + param_1 = ((x_119 * 2.0f) - vec3(1.0f)); float x_128 = scale_1; param_2 = x_128; vec3 x_129 = perturbNormalBase_mf33_vf3_f1_(param, param_1, param_2); @@ -238,7 +250,7 @@ void main_1() { vec3 specularOutput = vec3(0.0f, 0.0f, 0.0f); vec3 output3 = vec3(0.0f, 0.0f, 0.0f); u_Float = 100.0f; - u_Color = vec3(0.5f, 0.5f, 0.5f); + u_Color = vec3(0.5f); vec4 x_262 = texture(TextureSamplerTexture_TextureSamplerSampler, vMainuv); tempTextureRead = x_262; vec4 x_264 = tempTextureRead; @@ -247,8 +259,8 @@ void main_1() { vec3 x_279 = x_269.u_cameraPosition; vec4 x_282 = v_output1; output5 = normalize((x_279 - vec3(x_282.x, x_282.y, x_282.z))); - output4 = vec4(0.0f, 0.0f, 0.0f, 0.0f); - uvOffset = vec2(0.0f, 0.0f); + output4 = vec4(0.0f); + uvOffset = vec2(0.0f); float x_292 = x_269.u_bumpStrength; normalScale = (1.0f / x_292); if (tint_symbol) { @@ -280,8 +292,8 @@ void main_1() { numSamples = (15.0f + (dot((invTBN * -(output5)), (invTBN * vec3(x_366.x, x_366.y, x_366.z))) * -11.0f)); stepSize = (1.0f / numSamples); currRayHeight = 1.0f; - vCurrOffset = vec2(0.0f, 0.0f); - vLastOffset = vec2(0.0f, 0.0f); + vCurrOffset = vec2(0.0f); + vLastOffset = vec2(0.0f); lastSampledHeight = 1.0f; currSampledHeight = 1.0f; i = 0; @@ -322,8 +334,8 @@ void main_1() { viewDirectionW_1 = normalize((x_481 - vec3(x_482.x, x_482.y, x_482.z))); shadow = 1.0f; glossiness_1 = (1.0f * u_Float); - diffuseBase = vec3(0.0f, 0.0f, 0.0f); - specularBase = vec3(0.0f, 0.0f, 0.0f); + diffuseBase = vec3(0.0f); + specularBase = vec3(0.0f); vec4 x_494 = output4; normalW = vec3(x_494.x, x_494.y, x_494.z); param_11 = viewDirectionW_1; diff --git a/test/tint/bug/tint/949.wgsl.expected.hlsl b/test/tint/bug/tint/949.wgsl.expected.hlsl deleted file mode 100644 index 4869166be8..0000000000 --- a/test/tint/bug/tint/949.wgsl.expected.hlsl +++ /dev/null @@ -1,343 +0,0 @@ -struct lightingInfo { - float3 diffuse; - float3 specular; -}; - -static float u_Float = 0.0f; -static float3 u_Color = float3(0.0f, 0.0f, 0.0f); -Texture2D TextureSamplerTexture : register(t1, space2); -SamplerState TextureSamplerSampler : register(s0, space2); -static float2 vMainuv = float2(0.0f, 0.0f); -cbuffer cbuffer_x_269 : register(b6, space2) { - uint4 x_269[11]; -}; -static float4 v_output1 = float4(0.0f, 0.0f, 0.0f, 0.0f); -static bool gl_FrontFacing = false; -static float2 v_uv = float2(0.0f, 0.0f); -static float4 v_output2 = float4(0.0f, 0.0f, 0.0f, 0.0f); -Texture2D TextureSampler1Texture : register(t3, space2); -SamplerState TextureSampler1Sampler : register(s2, space2); -cbuffer cbuffer_light0 : register(b5, space0) { - uint4 light0[6]; -}; -static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f); -SamplerState bumpSamplerSampler : register(s4, space2); -Texture2D bumpSamplerTexture : register(t5, space2); - -float3x3 cotangent_frame_vf3_vf3_vf2_vf2_(inout float3 normal_1, inout float3 p, inout float2 uv, inout float2 tangentSpaceParams) { - float3 dp1 = float3(0.0f, 0.0f, 0.0f); - float3 dp2 = float3(0.0f, 0.0f, 0.0f); - float2 duv1 = float2(0.0f, 0.0f); - float2 duv2 = float2(0.0f, 0.0f); - float3 dp2perp = float3(0.0f, 0.0f, 0.0f); - float3 dp1perp = float3(0.0f, 0.0f, 0.0f); - float3 tangent = float3(0.0f, 0.0f, 0.0f); - float3 bitangent = float3(0.0f, 0.0f, 0.0f); - float invmax = 0.0f; - const float3 x_133 = p; - dp1 = ddx(x_133); - const float3 x_136 = p; - dp2 = ddy(x_136); - const float2 x_139 = uv; - duv1 = ddx(x_139); - const float2 x_142 = uv; - duv2 = ddy(x_142); - const float3 x_145 = dp2; - const float3 x_146 = normal_1; - dp2perp = cross(x_145, x_146); - const float3 x_149 = normal_1; - dp1perp = cross(x_149, dp1); - const float3 x_153 = dp2perp; - const float x_155 = duv1.x; - const float3 x_157 = dp1perp; - const float x_159 = duv2.x; - tangent = ((x_153 * x_155) + (x_157 * x_159)); - const float3 x_163 = dp2perp; - const float x_165 = duv1.y; - const float3 x_167 = dp1perp; - const float x_169 = duv2.y; - bitangent = ((x_163 * x_165) + (x_167 * x_169)); - const float x_173 = tangentSpaceParams.x; - tangent = (tangent * x_173); - const float x_177 = tangentSpaceParams.y; - bitangent = (bitangent * x_177); - invmax = rsqrt(max(dot(tangent, tangent), dot(bitangent, bitangent))); - const float3 x_191 = (tangent * invmax); - const float3 x_194 = (bitangent * invmax); - const float3 x_195 = normal_1; - return float3x3(float3(x_191.x, x_191.y, x_191.z), float3(x_194.x, x_194.y, x_194.z), float3(x_195.x, x_195.y, x_195.z)); -} - -float3x3 transposeMat3_mf33_(inout float3x3 inMatrix) { - float3 i0 = float3(0.0f, 0.0f, 0.0f); - float3 i1 = float3(0.0f, 0.0f, 0.0f); - float3 i2 = float3(0.0f, 0.0f, 0.0f); - float3x3 outMatrix = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - const float3 x_60 = inMatrix[0]; - i0 = x_60; - const float3 x_64 = inMatrix[1]; - i1 = x_64; - const float3 x_68 = inMatrix[2]; - i2 = x_68; - const float x_73 = i0.x; - const float x_75 = i1.x; - const float x_77 = i2.x; - const float3 x_78 = float3(x_73, x_75, x_77); - const float x_81 = i0.y; - const float x_83 = i1.y; - const float x_85 = i2.y; - const float3 x_86 = float3(x_81, x_83, x_85); - const float x_89 = i0.z; - const float x_91 = i1.z; - const float x_93 = i2.z; - const float3 x_94 = float3(x_89, x_91, x_93); - outMatrix = float3x3(float3(x_78.x, x_78.y, x_78.z), float3(x_86.x, x_86.y, x_86.z), float3(x_94.x, x_94.y, x_94.z)); - return outMatrix; -} - -float3 perturbNormalBase_mf33_vf3_f1_(inout float3x3 cotangentFrame, inout float3 normal, inout float scale) { - const float3x3 x_113 = cotangentFrame; - const float3 x_114 = normal; - return normalize(mul(x_114, x_113)); -} - -float3 perturbNormal_mf33_vf3_f1_(inout float3x3 cotangentFrame_1, inout float3 textureSample, inout float scale_1) { - float3x3 param = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3 param_1 = float3(0.0f, 0.0f, 0.0f); - float param_2 = 0.0f; - const float3 x_119 = textureSample; - const float3x3 x_125 = cotangentFrame_1; - param = x_125; - param_1 = ((x_119 * 2.0f) - float3(1.0f, 1.0f, 1.0f)); - const float x_128 = scale_1; - param_2 = x_128; - const float3 x_129 = perturbNormalBase_mf33_vf3_f1_(param, param_1, param_2); - return x_129; -} - -lightingInfo computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_(inout float3 viewDirectionW, inout float3 vNormal, inout float4 lightData, inout float3 diffuseColor, inout float3 specularColor, inout float3 groundColor, inout float glossiness) { - float ndl = 0.0f; - lightingInfo result = (lightingInfo)0; - float3 angleW = float3(0.0f, 0.0f, 0.0f); - float specComp = 0.0f; - const float3 x_212 = vNormal; - const float4 x_213 = lightData; - ndl = ((dot(x_212, float3(x_213.x, x_213.y, x_213.z)) * 0.5f) + 0.5f); - const float3 x_220 = groundColor; - const float3 x_221 = diffuseColor; - const float x_222 = ndl; - result.diffuse = lerp(x_220, x_221, float3(x_222, x_222, x_222)); - const float3 x_227 = viewDirectionW; - const float4 x_228 = lightData; - angleW = normalize((x_227 + float3(x_228.x, x_228.y, x_228.z))); - const float3 x_233 = vNormal; - specComp = max(0.0f, dot(x_233, angleW)); - const float x_237 = specComp; - const float x_238 = glossiness; - specComp = pow(x_237, max(1.0f, x_238)); - const float x_241 = specComp; - const float3 x_242 = specularColor; - result.specular = (x_242 * x_241); - return result; -} - -void main_1() { - float4 tempTextureRead = float4(0.0f, 0.0f, 0.0f, 0.0f); - float3 rgb = float3(0.0f, 0.0f, 0.0f); - float3 output5 = float3(0.0f, 0.0f, 0.0f); - float4 output4 = float4(0.0f, 0.0f, 0.0f, 0.0f); - float2 uvOffset = float2(0.0f, 0.0f); - float normalScale = 0.0f; - float2 TBNUV = float2(0.0f, 0.0f); - float2 x_299 = float2(0.0f, 0.0f); - float3x3 TBN = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3 param_3 = float3(0.0f, 0.0f, 0.0f); - float3 param_4 = float3(0.0f, 0.0f, 0.0f); - float2 param_5 = float2(0.0f, 0.0f); - float2 param_6 = float2(0.0f, 0.0f); - float3x3 invTBN = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3x3 param_7 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float parallaxLimit = 0.0f; - float2 vOffsetDir = float2(0.0f, 0.0f); - float2 vMaxOffset = float2(0.0f, 0.0f); - float numSamples = 0.0f; - float stepSize = 0.0f; - float currRayHeight = 0.0f; - float2 vCurrOffset = float2(0.0f, 0.0f); - float2 vLastOffset = float2(0.0f, 0.0f); - float lastSampledHeight = 0.0f; - float currSampledHeight = 0.0f; - int i = 0; - float delta1 = 0.0f; - float delta2 = 0.0f; - float ratio = 0.0f; - float2 parallaxOcclusion_0 = float2(0.0f, 0.0f); - float3x3 param_8 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3 param_9 = float3(0.0f, 0.0f, 0.0f); - float param_10 = 0.0f; - float2 output6 = float2(0.0f, 0.0f); - float4 tempTextureRead1 = float4(0.0f, 0.0f, 0.0f, 0.0f); - float3 rgb1 = float3(0.0f, 0.0f, 0.0f); - float3 viewDirectionW_1 = float3(0.0f, 0.0f, 0.0f); - float shadow = 0.0f; - float glossiness_1 = 0.0f; - float3 diffuseBase = float3(0.0f, 0.0f, 0.0f); - float3 specularBase = float3(0.0f, 0.0f, 0.0f); - float3 normalW = float3(0.0f, 0.0f, 0.0f); - lightingInfo info = (lightingInfo)0; - float3 param_11 = float3(0.0f, 0.0f, 0.0f); - float3 param_12 = float3(0.0f, 0.0f, 0.0f); - float4 param_13 = float4(0.0f, 0.0f, 0.0f, 0.0f); - float3 param_14 = float3(0.0f, 0.0f, 0.0f); - float3 param_15 = float3(0.0f, 0.0f, 0.0f); - float3 param_16 = float3(0.0f, 0.0f, 0.0f); - float param_17 = 0.0f; - float3 diffuseOutput = float3(0.0f, 0.0f, 0.0f); - float3 specularOutput = float3(0.0f, 0.0f, 0.0f); - float3 output3 = float3(0.0f, 0.0f, 0.0f); - u_Float = 100.0f; - u_Color = float3(0.5f, 0.5f, 0.5f); - const float4 x_262 = TextureSamplerTexture.Sample(TextureSamplerSampler, vMainuv); - tempTextureRead = x_262; - const float4 x_264 = tempTextureRead; - const float x_273 = asfloat(x_269[10].x); - rgb = (float3(x_264.x, x_264.y, x_264.z) * x_273); - const float3 x_279 = asfloat(x_269[9].xyz); - const float4 x_282 = v_output1; - output5 = normalize((x_279 - float3(x_282.x, x_282.y, x_282.z))); - output4 = float4(0.0f, 0.0f, 0.0f, 0.0f); - uvOffset = float2(0.0f, 0.0f); - const float x_292 = asfloat(x_269[8].x); - normalScale = (1.0f / x_292); - if (gl_FrontFacing) { - x_299 = v_uv; - } else { - x_299 = -(v_uv); - } - TBNUV = x_299; - const float4 x_310 = v_output2; - param_3 = (float3(x_310.x, x_310.y, x_310.z) * normalScale); - const float4 x_317 = v_output1; - param_4 = float3(x_317.x, x_317.y, x_317.z); - param_5 = TBNUV; - const float2 x_324 = asfloat(x_269[10].zw); - param_6 = x_324; - const float3x3 x_325 = cotangent_frame_vf3_vf3_vf2_vf2_(param_3, param_4, param_5, param_6); - TBN = x_325; - param_7 = TBN; - const float3x3 x_329 = transposeMat3_mf33_(param_7); - invTBN = x_329; - const float3 x_334 = mul(-(output5), invTBN); - parallaxLimit = (length(float2(x_334.x, x_334.y)) / mul(-(output5), invTBN).z); - const float x_345 = asfloat(x_269[9].w); - parallaxLimit = (parallaxLimit * x_345); - const float3 x_352 = mul(-(output5), invTBN); - vOffsetDir = normalize(float2(x_352.x, x_352.y)); - vMaxOffset = (vOffsetDir * parallaxLimit); - const float4 x_366 = v_output2; - numSamples = (15.0f + (dot(mul(-(output5), invTBN), mul(float3(x_366.x, x_366.y, x_366.z), invTBN)) * -11.0f)); - stepSize = (1.0f / numSamples); - currRayHeight = 1.0f; - vCurrOffset = float2(0.0f, 0.0f); - vLastOffset = float2(0.0f, 0.0f); - lastSampledHeight = 1.0f; - currSampledHeight = 1.0f; - i = 0; - { - [loop] for(; (i < 15); i = (i + 1)) { - const float4 x_397 = TextureSamplerTexture.Sample(TextureSamplerSampler, (v_uv + vCurrOffset)); - currSampledHeight = x_397.w; - if ((currSampledHeight > currRayHeight)) { - delta1 = (currSampledHeight - currRayHeight); - delta2 = ((currRayHeight + stepSize) - lastSampledHeight); - ratio = (delta1 / (delta1 + delta2)); - vCurrOffset = ((vLastOffset * ratio) + (vCurrOffset * (1.0f - ratio))); - break; - } else { - currRayHeight = (currRayHeight - stepSize); - vLastOffset = vCurrOffset; - vCurrOffset = (vCurrOffset + (vMaxOffset * stepSize)); - lastSampledHeight = currSampledHeight; - } - } - } - parallaxOcclusion_0 = vCurrOffset; - uvOffset = parallaxOcclusion_0; - const float4 x_452 = TextureSamplerTexture.Sample(TextureSamplerSampler, (v_uv + uvOffset)); - const float x_454 = asfloat(x_269[8].x); - param_8 = TBN; - param_9 = float3(x_452.x, x_452.y, x_452.z); - param_10 = (1.0f / x_454); - const float3 x_461 = perturbNormal_mf33_vf3_f1_(param_8, param_9, param_10); - output4 = float4(x_461.x, x_461.y, x_461.z, output4.w); - output6 = (v_uv + uvOffset); - const float4 x_475 = TextureSampler1Texture.Sample(TextureSampler1Sampler, output6); - tempTextureRead1 = x_475; - const float4 x_477 = tempTextureRead1; - rgb1 = float3(x_477.x, x_477.y, x_477.z); - const float3 x_481 = asfloat(x_269[9].xyz); - const float4 x_482 = v_output1; - viewDirectionW_1 = normalize((x_481 - float3(x_482.x, x_482.y, x_482.z))); - shadow = 1.0f; - glossiness_1 = (1.0f * u_Float); - diffuseBase = float3(0.0f, 0.0f, 0.0f); - specularBase = float3(0.0f, 0.0f, 0.0f); - const float4 x_494 = output4; - normalW = float3(x_494.x, x_494.y, x_494.z); - param_11 = viewDirectionW_1; - param_12 = normalW; - const float4 x_507 = asfloat(light0[0]); - param_13 = x_507; - const float4 x_510 = asfloat(light0[1]); - param_14 = float3(x_510.x, x_510.y, x_510.z); - const float4 x_514 = asfloat(light0[2]); - param_15 = float3(x_514.x, x_514.y, x_514.z); - const float3 x_518 = asfloat(light0[3].xyz); - param_16 = x_518; - param_17 = glossiness_1; - const lightingInfo x_521 = computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_(param_11, param_12, param_13, param_14, param_15, param_16, param_17); - info = x_521; - shadow = 1.0f; - const float3 x_523 = info.diffuse; - diffuseBase = (diffuseBase + (x_523 * shadow)); - const float3 x_529 = info.specular; - specularBase = (specularBase + (x_529 * shadow)); - diffuseOutput = (diffuseBase * rgb1); - specularOutput = (specularBase * u_Color); - output3 = (diffuseOutput + specularOutput); - const float3 x_548 = output3; - glFragColor = float4(x_548.x, x_548.y, x_548.z, 1.0f); - return; -} - -struct main_out { - float4 glFragColor_1; -}; -struct tint_symbol_1 { - float4 v_output1_param : TEXCOORD0; - float2 vMainuv_param : TEXCOORD1; - float4 v_output2_param : TEXCOORD2; - float2 v_uv_param : TEXCOORD3; - bool gl_FrontFacing_param : SV_IsFrontFace; -}; -struct tint_symbol_2 { - float4 glFragColor_1 : SV_Target0; -}; - -main_out main_inner(float2 vMainuv_param, float4 v_output1_param, bool gl_FrontFacing_param, float2 v_uv_param, float4 v_output2_param) { - vMainuv = vMainuv_param; - v_output1 = v_output1_param; - gl_FrontFacing = gl_FrontFacing_param; - v_uv = v_uv_param; - v_output2 = v_output2_param; - main_1(); - const main_out tint_symbol_8 = {glFragColor}; - return tint_symbol_8; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.vMainuv_param, tint_symbol.v_output1_param, tint_symbol.gl_FrontFacing_param, tint_symbol.v_uv_param, tint_symbol.v_output2_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.glFragColor_1 = inner_result.glFragColor_1; - return wrapper_result; -} diff --git a/test/tint/bug/tint/949.wgsl.expected.msl b/test/tint/bug/tint/949.wgsl.expected.msl index fb89decc8d..2cd37f5bd0 100644 --- a/test/tint/bug/tint/949.wgsl.expected.msl +++ b/test/tint/bug/tint/949.wgsl.expected.msl @@ -1,7 +1,31 @@ +bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from uniform control flow + let x_397 : vec4 = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395)); + ^^^^^^^^^^^^^ + +bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value + if ((x_400 > x_401)) { + ^^ + +bug/tint/949.wgsl:308:27 note: reading from module-scope private variable 'v_output2' may result in a non-uniform value + let x_366 : vec4 = v_output2; + ^^^^^^^^^ + #include using namespace metal; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + template inline vec operator*(matrix lhs, packed_vec rhs) { return lhs * vec(rhs); @@ -22,7 +46,7 @@ struct LeftOver { /* 0x0040 */ float4x4 u_ViewProjection; /* 0x0080 */ float u_bumpStrength; /* 0x0084 */ uint padding; - /* 0x0088 */ int8_t tint_pad[8]; + /* 0x0088 */ tint_array tint_pad; /* 0x0090 */ packed_float3 u_cameraPosition; /* 0x009c */ float u_parallaxScale; /* 0x00a0 */ float textureInfoName; @@ -38,7 +62,7 @@ struct Light0 { /* 0x003c */ uint padding_2; /* 0x0040 */ float4 shadowsInfo; /* 0x0050 */ float2 depthValues; - /* 0x0058 */ int8_t tint_pad_1[8]; + /* 0x0058 */ tint_array tint_pad_1; }; float3x3 cotangent_frame_vf3_vf3_vf2_vf2_(thread float3* const normal_1, thread float3* const p, thread float2* const uv, thread float2* const tangentSpaceParams) { @@ -137,7 +161,7 @@ float3 perturbNormal_mf33_vf3_f1_(thread float3x3* const cotangentFrame_1, threa float3 const x_119 = *(textureSample); float3x3 const x_125 = *(cotangentFrame_1); param = x_125; - param_1 = ((x_119 * 2.0f) - float3(1.0f, 1.0f, 1.0f)); + param_1 = ((x_119 * 2.0f) - float3(1.0f)); float const x_128 = *(scale_1); param_2 = x_128; float3 const x_129 = perturbNormalBase_mf33_vf3_f1_(&(param), &(param_1), &(param_2)); @@ -172,7 +196,9 @@ lightingInfo computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_(thread float return x_245; } -void main_1(thread float* const tint_symbol_5, thread float3* const tint_symbol_6, thread float2* const tint_symbol_7, texture2d tint_symbol_8, sampler tint_symbol_9, const constant LeftOver* const tint_symbol_10, thread float4* const tint_symbol_11, thread bool* const tint_symbol_12, thread float2* const tint_symbol_13, thread float4* const tint_symbol_14, texture2d tint_symbol_15, sampler tint_symbol_16, const constant Light0* const tint_symbol_17, thread float4* const tint_symbol_18) { +void main_1(thread float2* const tint_symbol_7, texture2d tint_symbol_8, sampler tint_symbol_9, const constant LeftOver* const tint_symbol_10, thread float4* const tint_symbol_11, thread bool* const tint_symbol_12, thread float2* const tint_symbol_13, thread float4* const tint_symbol_14, texture2d tint_symbol_15, sampler tint_symbol_16, const constant Light0* const tint_symbol_17, thread float4* const tint_symbol_18) { + thread float tint_symbol_5 = 0.0f; + thread float3 tint_symbol_6 = 0.0f; float4 tempTextureRead = 0.0f; float3 rgb = 0.0f; float3 output5 = 0.0f; @@ -226,8 +252,8 @@ void main_1(thread float* const tint_symbol_5, thread float3* const tint_symbol_ float3 diffuseOutput = 0.0f; float3 specularOutput = 0.0f; float3 output3 = 0.0f; - *(tint_symbol_5) = 100.0f; - *(tint_symbol_6) = float3(0.5f, 0.5f, 0.5f); + tint_symbol_5 = 100.0f; + tint_symbol_6 = float3(0.5f); float2 const x_261 = *(tint_symbol_7); float4 const x_262 = tint_symbol_8.sample(tint_symbol_9, x_261); tempTextureRead = x_262; @@ -237,8 +263,8 @@ void main_1(thread float* const tint_symbol_5, thread float3* const tint_symbol_ float3 const x_279 = (*(tint_symbol_10)).u_cameraPosition; float4 const x_282 = *(tint_symbol_11); output5 = normalize((x_279 - float3(x_282[0], x_282[1], x_282[2]))); - output4 = float4(0.0f, 0.0f, 0.0f, 0.0f); - uvOffset = float2(0.0f, 0.0f); + output4 = float4(0.0f); + uvOffset = float2(0.0f); float const x_292 = (*(tint_symbol_10)).u_bumpStrength; normalScale = (1.0f / x_292); bool const x_298 = *(tint_symbol_12); @@ -290,8 +316,8 @@ void main_1(thread float* const tint_symbol_5, thread float3* const tint_symbol_ float const x_374 = numSamples; stepSize = (1.0f / x_374); currRayHeight = 1.0f; - vCurrOffset = float2(0.0f, 0.0f); - vLastOffset = float2(0.0f, 0.0f); + vCurrOffset = float2(0.0f); + vLastOffset = float2(0.0f); lastSampledHeight = 1.0f; currSampledHeight = 1.0f; i = 0; @@ -370,10 +396,10 @@ void main_1(thread float* const tint_symbol_5, thread float3* const tint_symbol_ float4 const x_482 = *(tint_symbol_11); viewDirectionW_1 = normalize((x_481 - float3(x_482[0], x_482[1], x_482[2]))); shadow = 1.0f; - float const x_488 = *(tint_symbol_5); + float const x_488 = tint_symbol_5; glossiness_1 = (1.0f * x_488); - diffuseBase = float3(0.0f, 0.0f, 0.0f); - specularBase = float3(0.0f, 0.0f, 0.0f); + diffuseBase = float3(0.0f); + specularBase = float3(0.0f); float4 const x_494 = output4; normalW = float3(x_494[0], x_494[1], x_494[2]); float3 const x_501 = viewDirectionW_1; @@ -405,7 +431,7 @@ void main_1(thread float* const tint_symbol_5, thread float3* const tint_symbol_ float3 const x_536 = rgb1; diffuseOutput = (x_535 * x_536); float3 const x_539 = specularBase; - float3 const x_540 = *(tint_symbol_6); + float3 const x_540 = tint_symbol_6; specularOutput = (x_539 * x_540); float3 const x_543 = diffuseOutput; float3 const x_544 = specularOutput; @@ -430,27 +456,25 @@ struct tint_symbol_3 { float4 glFragColor_1 [[color(0)]]; }; -main_out tint_symbol_inner(float2 vMainuv_param, float4 v_output1_param, bool gl_FrontFacing_param, float2 v_uv_param, float4 v_output2_param, thread float2* const tint_symbol_19, thread float4* const tint_symbol_20, thread bool* const tint_symbol_21, thread float2* const tint_symbol_22, thread float4* const tint_symbol_23, thread float* const tint_symbol_24, thread float3* const tint_symbol_25, texture2d tint_symbol_26, sampler tint_symbol_27, const constant LeftOver* const tint_symbol_28, texture2d tint_symbol_29, sampler tint_symbol_30, const constant Light0* const tint_symbol_31, thread float4* const tint_symbol_32) { +main_out tint_symbol_inner(float2 vMainuv_param, float4 v_output1_param, bool gl_FrontFacing_param, float2 v_uv_param, float4 v_output2_param, thread float2* const tint_symbol_19, thread float4* const tint_symbol_20, thread bool* const tint_symbol_21, thread float2* const tint_symbol_22, thread float4* const tint_symbol_23, texture2d tint_symbol_24, sampler tint_symbol_25, const constant LeftOver* const tint_symbol_26, texture2d tint_symbol_27, sampler tint_symbol_28, const constant Light0* const tint_symbol_29, thread float4* const tint_symbol_30) { *(tint_symbol_19) = vMainuv_param; *(tint_symbol_20) = v_output1_param; *(tint_symbol_21) = gl_FrontFacing_param; *(tint_symbol_22) = v_uv_param; *(tint_symbol_23) = v_output2_param; - main_1(tint_symbol_24, tint_symbol_25, tint_symbol_19, tint_symbol_26, tint_symbol_27, tint_symbol_28, tint_symbol_20, tint_symbol_21, tint_symbol_22, tint_symbol_23, tint_symbol_29, tint_symbol_30, tint_symbol_31, tint_symbol_32); - main_out const tint_symbol_4 = {.glFragColor_1=*(tint_symbol_32)}; + main_1(tint_symbol_19, tint_symbol_24, tint_symbol_25, tint_symbol_26, tint_symbol_20, tint_symbol_21, tint_symbol_22, tint_symbol_23, tint_symbol_27, tint_symbol_28, tint_symbol_29, tint_symbol_30); + main_out const tint_symbol_4 = {.glFragColor_1=*(tint_symbol_30)}; return tint_symbol_4; } -fragment tint_symbol_3 tint_symbol(texture2d tint_symbol_40 [[texture(0)]], sampler tint_symbol_41 [[sampler(0)]], const constant LeftOver* tint_symbol_42 [[buffer(0)]], texture2d tint_symbol_43 [[texture(1)]], sampler tint_symbol_44 [[sampler(1)]], const constant Light0* tint_symbol_45 [[buffer(1)]], bool gl_FrontFacing_param [[front_facing]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { - thread float2 tint_symbol_33 = 0.0f; - thread float4 tint_symbol_34 = 0.0f; - thread bool tint_symbol_35 = false; - thread float2 tint_symbol_36 = 0.0f; - thread float4 tint_symbol_37 = 0.0f; - thread float tint_symbol_38 = 0.0f; - thread float3 tint_symbol_39 = 0.0f; - thread float4 tint_symbol_46 = 0.0f; - main_out const inner_result = tint_symbol_inner(tint_symbol_1.vMainuv_param, tint_symbol_1.v_output1_param, gl_FrontFacing_param, tint_symbol_1.v_uv_param, tint_symbol_1.v_output2_param, &(tint_symbol_33), &(tint_symbol_34), &(tint_symbol_35), &(tint_symbol_36), &(tint_symbol_37), &(tint_symbol_38), &(tint_symbol_39), tint_symbol_40, tint_symbol_41, tint_symbol_42, tint_symbol_43, tint_symbol_44, tint_symbol_45, &(tint_symbol_46)); +fragment tint_symbol_3 tint_symbol(texture2d tint_symbol_36 [[texture(0)]], sampler tint_symbol_37 [[sampler(0)]], const constant LeftOver* tint_symbol_38 [[buffer(0)]], texture2d tint_symbol_39 [[texture(1)]], sampler tint_symbol_40 [[sampler(1)]], const constant Light0* tint_symbol_41 [[buffer(1)]], bool gl_FrontFacing_param [[front_facing]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float2 tint_symbol_31 = 0.0f; + thread float4 tint_symbol_32 = 0.0f; + thread bool tint_symbol_33 = false; + thread float2 tint_symbol_34 = 0.0f; + thread float4 tint_symbol_35 = 0.0f; + thread float4 tint_symbol_42 = 0.0f; + main_out const inner_result = tint_symbol_inner(tint_symbol_1.vMainuv_param, tint_symbol_1.v_output1_param, gl_FrontFacing_param, tint_symbol_1.v_uv_param, tint_symbol_1.v_output2_param, &(tint_symbol_31), &(tint_symbol_32), &(tint_symbol_33), &(tint_symbol_34), &(tint_symbol_35), tint_symbol_36, tint_symbol_37, tint_symbol_38, tint_symbol_39, tint_symbol_40, tint_symbol_41, &(tint_symbol_42)); tint_symbol_3 wrapper_result = {}; wrapper_result.glFragColor_1 = inner_result.glFragColor_1; return wrapper_result; diff --git a/test/tint/bug/tint/949.wgsl.expected.spvasm b/test/tint/bug/tint/949.wgsl.expected.spvasm index e2fce0af14..bdee2f548c 100644 --- a/test/tint/bug/tint/949.wgsl.expected.spvasm +++ b/test/tint/bug/tint/949.wgsl.expected.spvasm @@ -1,7 +1,19 @@ +bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from uniform control flow + let x_397 : vec4 = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395)); + ^^^^^^^^^^^^^ + +bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value + if ((x_400 > x_401)) { + ^^ + +bug/tint/949.wgsl:308:27 note: reading from module-scope private variable 'v_output2' may result in a non-uniform value + let x_366 : vec4 = v_output2; + ^^^^^^^^^ + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 675 +; Bound: 670 ; Schema: 0 OpCapability Shader %88 = OpExtInstImport "GLSL.std.450" @@ -268,7 +280,7 @@ %152 = OpTypeFunction %mat3v3float %_ptr_Function_mat3v3float %161 = OpConstantNull %mat3v3float %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %164 = OpConstantNull %int %int_1 = OpConstant %int 1 %int_2 = OpConstant %int 2 %uint_2 = OpConstant %uint 2 @@ -282,31 +294,26 @@ %_ptr_Function_lightingInfo = OpTypePointer Function %lightingInfo %261 = OpConstantNull %lightingInfo %float_0_5 = OpConstant %float 0.5 - %float_0 = OpConstant %float 0 %void = OpTypeVoid - %311 = OpTypeFunction %void + %310 = OpTypeFunction %void %_ptr_Function_int = OpTypePointer Function %int - %342 = OpConstantNull %int %float_100 = OpConstant %float 100 - %371 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 - %376 = OpTypeSampledImage %25 + %369 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %374 = OpTypeSampledImage %25 %uint_6 = OpConstant %uint 6 %_ptr_Uniform_float = OpTypePointer Uniform %float %uint_4 = OpConstant %uint 4 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float - %399 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 - %400 = OpConstantComposite %v2float %float_0 %float_0 %uint_8 = OpConstant %uint 8 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %uint_5 = OpConstant %uint 5 %float_15 = OpConstant %float 15 %float_n11 = OpConstant %float -11 %int_15 = OpConstant %int 15 - %593 = OpConstantComposite %v3float %float_0 %float_0 %float_0 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %uint_3 = OpConstant %uint 3 %main_out = OpTypeStruct %v4float - %654 = OpTypeFunction %main_out %v2float %v4float %bool %v2float %v4float + %649 = OpTypeFunction %main_out %v2float %v4float %bool %v2float %v4float %cotangent_frame_vf3_vf3_vf2_vf2_ = OpFunction %mat3v3float None %52 %normal_1 = OpFunctionParameter %_ptr_Function_v3float %p = OpFunctionParameter %_ptr_Function_v3float @@ -410,7 +417,7 @@ %i1 = OpVariable %_ptr_Function_v3float Function %22 %i2 = OpVariable %_ptr_Function_v3float Function %22 %outMatrix = OpVariable %_ptr_Function_mat3v3float Function %161 - %165 = OpAccessChain %_ptr_Function_v3float %inMatrix %int_0 + %165 = OpAccessChain %_ptr_Function_v3float %inMatrix %164 %166 = OpLoad %v3float %165 OpStore %i0 %166 %169 = OpAccessChain %_ptr_Function_v3float %inMatrix %int_1 @@ -528,24 +535,24 @@ OpStore %angleW %288 %295 = OpLoad %v3float %vNormal %296 = OpLoad %v3float %angleW - %299 = OpDot %float %295 %296 - %297 = OpExtInst %float %88 NMax %float_0 %299 + %298 = OpDot %float %295 %296 + %297 = OpExtInst %float %88 NMax %18 %298 OpStore %specComp %297 - %300 = OpLoad %float %specComp - %302 = OpLoad %float %glossiness - %304 = OpExtInst %float %88 NMax %float_1 %302 - %303 = OpExtInst %float %88 Pow %300 %304 - OpStore %specComp %303 - %305 = OpLoad %float %specComp - %307 = OpLoad %v3float %specularColor - %308 = OpAccessChain %_ptr_Function_v3float %result %uint_1 - %309 = OpVectorTimesScalar %v3float %307 %305 - OpStore %308 %309 - %310 = OpLoad %lightingInfo %result - OpReturnValue %310 + %299 = OpLoad %float %specComp + %301 = OpLoad %float %glossiness + %303 = OpExtInst %float %88 NMax %float_1 %301 + %302 = OpExtInst %float %88 Pow %299 %303 + OpStore %specComp %302 + %304 = OpLoad %float %specComp + %306 = OpLoad %v3float %specularColor + %307 = OpAccessChain %_ptr_Function_v3float %result %uint_1 + %308 = OpVectorTimesScalar %v3float %306 %304 + OpStore %307 %308 + %309 = OpLoad %lightingInfo %result + OpReturnValue %309 OpFunctionEnd - %main_1 = OpFunction %void None %311 - %314 = OpLabel + %main_1 = OpFunction %void None %310 + %313 = OpLabel %tempTextureRead = OpVariable %_ptr_Function_v4float Function %15 %rgb = OpVariable %_ptr_Function_v3float Function %22 %output5 = OpVariable %_ptr_Function_v3float Function %22 @@ -571,7 +578,7 @@ %vLastOffset = OpVariable %_ptr_Function_v2float Function %31 %lastSampledHeight = OpVariable %_ptr_Function_float Function %18 %currSampledHeight = OpVariable %_ptr_Function_float Function %18 - %i = OpVariable %_ptr_Function_int Function %342 + %i = OpVariable %_ptr_Function_int Function %164 %delta1 = OpVariable %_ptr_Function_float Function %18 %delta2 = OpVariable %_ptr_Function_float Function %18 %ratio = OpVariable %_ptr_Function_float Function %18 @@ -600,371 +607,371 @@ %specularOutput = OpVariable %_ptr_Function_v3float Function %22 %output3 = OpVariable %_ptr_Function_v3float Function %22 OpStore %u_Float %float_100 - OpStore %u_Color %371 - %372 = OpLoad %v2float %vMainuv - %374 = OpLoad %28 %TextureSamplerSampler - %375 = OpLoad %25 %TextureSamplerTexture - %377 = OpSampledImage %376 %375 %374 - %373 = OpImageSampleImplicitLod %v4float %377 %372 - OpStore %tempTextureRead %373 - %378 = OpLoad %v4float %tempTextureRead - %381 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_6 - %382 = OpLoad %float %381 - %383 = OpCompositeExtract %float %378 0 - %384 = OpCompositeExtract %float %378 1 - %385 = OpCompositeExtract %float %378 2 - %386 = OpCompositeConstruct %v3float %383 %384 %385 - %387 = OpVectorTimesScalar %v3float %386 %382 - OpStore %rgb %387 - %390 = OpAccessChain %_ptr_Uniform_v3float %x_269 %uint_4 - %391 = OpLoad %v3float %390 - %392 = OpLoad %v4float %v_output1 - %394 = OpCompositeExtract %float %392 0 - %395 = OpCompositeExtract %float %392 1 - %396 = OpCompositeExtract %float %392 2 - %397 = OpCompositeConstruct %v3float %394 %395 %396 - %398 = OpFSub %v3float %391 %397 - %393 = OpExtInst %v3float %88 Normalize %398 - OpStore %output5 %393 - OpStore %output4 %399 - OpStore %uvOffset %400 - %401 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_2 - %402 = OpLoad %float %401 - %403 = OpFDiv %float %float_1 %402 - OpStore %normalScale %403 - %404 = OpLoad %bool %gl_FrontFacing - OpSelectionMerge %405 None - OpBranchConditional %404 %406 %407 - %406 = OpLabel - %408 = OpLoad %v2float %v_uv - OpStore %x_299 %408 - OpBranch %405 - %407 = OpLabel - %409 = OpLoad %v2float %v_uv - %410 = OpFNegate %v2float %409 - OpStore %x_299 %410 - OpBranch %405 - %405 = OpLabel - %411 = OpLoad %v2float %x_299 - OpStore %TBNUV %411 - %412 = OpLoad %v4float %v_output2 - %413 = OpLoad %float %normalScale - %414 = OpCompositeExtract %float %412 0 - %415 = OpCompositeExtract %float %412 1 - %416 = OpCompositeExtract %float %412 2 - %417 = OpCompositeConstruct %v3float %414 %415 %416 - %418 = OpVectorTimesScalar %v3float %417 %413 - OpStore %param_3 %418 - %419 = OpLoad %v4float %v_output1 - %420 = OpCompositeExtract %float %419 0 - %421 = OpCompositeExtract %float %419 1 - %422 = OpCompositeExtract %float %419 2 - %423 = OpCompositeConstruct %v3float %420 %421 %422 - OpStore %param_4 %423 - %424 = OpLoad %v2float %TBNUV - OpStore %param_5 %424 - %427 = OpAccessChain %_ptr_Uniform_v2float %x_269 %uint_8 - %428 = OpLoad %v2float %427 - OpStore %param_6 %428 - %429 = OpFunctionCall %mat3v3float %cotangent_frame_vf3_vf3_vf2_vf2_ %param_3 %param_4 %param_5 %param_6 - OpStore %TBN %429 - %434 = OpLoad %mat3v3float %TBN - OpStore %param_7 %434 - %435 = OpFunctionCall %mat3v3float %transposeMat3_mf33_ %param_7 - OpStore %invTBN %435 + OpStore %u_Color %369 + %370 = OpLoad %v2float %vMainuv + %372 = OpLoad %28 %TextureSamplerSampler + %373 = OpLoad %25 %TextureSamplerTexture + %375 = OpSampledImage %374 %373 %372 + %371 = OpImageSampleImplicitLod %v4float %375 %370 + OpStore %tempTextureRead %371 + %376 = OpLoad %v4float %tempTextureRead + %379 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_6 + %380 = OpLoad %float %379 + %381 = OpCompositeExtract %float %376 0 + %382 = OpCompositeExtract %float %376 1 + %383 = OpCompositeExtract %float %376 2 + %384 = OpCompositeConstruct %v3float %381 %382 %383 + %385 = OpVectorTimesScalar %v3float %384 %380 + OpStore %rgb %385 + %388 = OpAccessChain %_ptr_Uniform_v3float %x_269 %uint_4 + %389 = OpLoad %v3float %388 + %390 = OpLoad %v4float %v_output1 + %392 = OpCompositeExtract %float %390 0 + %393 = OpCompositeExtract %float %390 1 + %394 = OpCompositeExtract %float %390 2 + %395 = OpCompositeConstruct %v3float %392 %393 %394 + %396 = OpFSub %v3float %389 %395 + %391 = OpExtInst %v3float %88 Normalize %396 + OpStore %output5 %391 + OpStore %output4 %15 + OpStore %uvOffset %31 + %397 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_2 + %398 = OpLoad %float %397 + %399 = OpFDiv %float %float_1 %398 + OpStore %normalScale %399 + %400 = OpLoad %bool %gl_FrontFacing + OpSelectionMerge %401 None + OpBranchConditional %400 %402 %403 + %402 = OpLabel + %404 = OpLoad %v2float %v_uv + OpStore %x_299 %404 + OpBranch %401 + %403 = OpLabel + %405 = OpLoad %v2float %v_uv + %406 = OpFNegate %v2float %405 + OpStore %x_299 %406 + OpBranch %401 + %401 = OpLabel + %407 = OpLoad %v2float %x_299 + OpStore %TBNUV %407 + %408 = OpLoad %v4float %v_output2 + %409 = OpLoad %float %normalScale + %410 = OpCompositeExtract %float %408 0 + %411 = OpCompositeExtract %float %408 1 + %412 = OpCompositeExtract %float %408 2 + %413 = OpCompositeConstruct %v3float %410 %411 %412 + %414 = OpVectorTimesScalar %v3float %413 %409 + OpStore %param_3 %414 + %415 = OpLoad %v4float %v_output1 + %416 = OpCompositeExtract %float %415 0 + %417 = OpCompositeExtract %float %415 1 + %418 = OpCompositeExtract %float %415 2 + %419 = OpCompositeConstruct %v3float %416 %417 %418 + OpStore %param_4 %419 + %420 = OpLoad %v2float %TBNUV + OpStore %param_5 %420 + %423 = OpAccessChain %_ptr_Uniform_v2float %x_269 %uint_8 + %424 = OpLoad %v2float %423 + OpStore %param_6 %424 + %425 = OpFunctionCall %mat3v3float %cotangent_frame_vf3_vf3_vf2_vf2_ %param_3 %param_4 %param_5 %param_6 + OpStore %TBN %425 + %430 = OpLoad %mat3v3float %TBN + OpStore %param_7 %430 + %431 = OpFunctionCall %mat3v3float %transposeMat3_mf33_ %param_7 + OpStore %invTBN %431 + %433 = OpLoad %mat3v3float %invTBN + %434 = OpLoad %v3float %output5 + %435 = OpFNegate %v3float %434 + %436 = OpMatrixTimesVector %v3float %433 %435 %437 = OpLoad %mat3v3float %invTBN %438 = OpLoad %v3float %output5 - %439 = OpFNegate %v3float %438 - %440 = OpMatrixTimesVector %v3float %437 %439 - %441 = OpLoad %mat3v3float %invTBN - %442 = OpLoad %v3float %output5 - %444 = OpCompositeExtract %float %440 0 - %445 = OpCompositeExtract %float %440 1 - %446 = OpCompositeConstruct %v2float %444 %445 - %443 = OpExtInst %float %88 Length %446 - %447 = OpFNegate %v3float %442 - %448 = OpMatrixTimesVector %v3float %441 %447 - %449 = OpCompositeExtract %float %448 2 - %450 = OpFDiv %float %443 %449 - OpStore %parallaxLimit %450 - %452 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_5 - %453 = OpLoad %float %452 - %454 = OpLoad %float %parallaxLimit - %455 = OpFMul %float %454 %453 - OpStore %parallaxLimit %455 - %456 = OpLoad %mat3v3float %invTBN - %457 = OpLoad %v3float %output5 - %458 = OpFNegate %v3float %457 - %459 = OpMatrixTimesVector %v3float %456 %458 - %461 = OpCompositeExtract %float %459 0 - %462 = OpCompositeExtract %float %459 1 - %463 = OpCompositeConstruct %v2float %461 %462 - %460 = OpExtInst %v2float %88 Normalize %463 - OpStore %vOffsetDir %460 - %464 = OpLoad %v2float %vOffsetDir - %465 = OpLoad %float %parallaxLimit - %466 = OpVectorTimesScalar %v2float %464 %465 - OpStore %vMaxOffset %466 - %467 = OpLoad %mat3v3float %invTBN - %468 = OpLoad %v3float %output5 - %469 = OpLoad %mat3v3float %invTBN - %470 = OpLoad %v4float %v_output2 - %473 = OpFNegate %v3float %468 - %474 = OpMatrixTimesVector %v3float %467 %473 - %475 = OpCompositeExtract %float %470 0 - %476 = OpCompositeExtract %float %470 1 - %477 = OpCompositeExtract %float %470 2 - %478 = OpCompositeConstruct %v3float %475 %476 %477 - %479 = OpMatrixTimesVector %v3float %469 %478 - %472 = OpDot %float %474 %479 - %481 = OpFMul %float %472 %float_n11 - %482 = OpFAdd %float %float_15 %481 - OpStore %numSamples %482 - %483 = OpLoad %float %numSamples - %484 = OpFDiv %float %float_1 %483 - OpStore %stepSize %484 + %440 = OpCompositeExtract %float %436 0 + %441 = OpCompositeExtract %float %436 1 + %442 = OpCompositeConstruct %v2float %440 %441 + %439 = OpExtInst %float %88 Length %442 + %443 = OpFNegate %v3float %438 + %444 = OpMatrixTimesVector %v3float %437 %443 + %445 = OpCompositeExtract %float %444 2 + %446 = OpFDiv %float %439 %445 + OpStore %parallaxLimit %446 + %448 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_5 + %449 = OpLoad %float %448 + %450 = OpLoad %float %parallaxLimit + %451 = OpFMul %float %450 %449 + OpStore %parallaxLimit %451 + %452 = OpLoad %mat3v3float %invTBN + %453 = OpLoad %v3float %output5 + %454 = OpFNegate %v3float %453 + %455 = OpMatrixTimesVector %v3float %452 %454 + %457 = OpCompositeExtract %float %455 0 + %458 = OpCompositeExtract %float %455 1 + %459 = OpCompositeConstruct %v2float %457 %458 + %456 = OpExtInst %v2float %88 Normalize %459 + OpStore %vOffsetDir %456 + %460 = OpLoad %v2float %vOffsetDir + %461 = OpLoad %float %parallaxLimit + %462 = OpVectorTimesScalar %v2float %460 %461 + OpStore %vMaxOffset %462 + %463 = OpLoad %mat3v3float %invTBN + %464 = OpLoad %v3float %output5 + %465 = OpLoad %mat3v3float %invTBN + %466 = OpLoad %v4float %v_output2 + %469 = OpFNegate %v3float %464 + %470 = OpMatrixTimesVector %v3float %463 %469 + %471 = OpCompositeExtract %float %466 0 + %472 = OpCompositeExtract %float %466 1 + %473 = OpCompositeExtract %float %466 2 + %474 = OpCompositeConstruct %v3float %471 %472 %473 + %475 = OpMatrixTimesVector %v3float %465 %474 + %468 = OpDot %float %470 %475 + %477 = OpFMul %float %468 %float_n11 + %478 = OpFAdd %float %float_15 %477 + OpStore %numSamples %478 + %479 = OpLoad %float %numSamples + %480 = OpFDiv %float %float_1 %479 + OpStore %stepSize %480 OpStore %currRayHeight %float_1 - OpStore %vCurrOffset %400 - OpStore %vLastOffset %400 + OpStore %vCurrOffset %31 + OpStore %vLastOffset %31 OpStore %lastSampledHeight %float_1 OpStore %currSampledHeight %float_1 - OpStore %i %int_0 - OpBranch %485 - %485 = OpLabel - OpLoopMerge %486 %487 None + OpStore %i %164 + OpBranch %481 + %481 = OpLabel + OpLoopMerge %482 %483 None + OpBranch %484 + %484 = OpLabel + %485 = OpLoad %int %i + %487 = OpSLessThan %bool %485 %int_15 + OpSelectionMerge %488 None + OpBranchConditional %487 %489 %490 + %489 = OpLabel OpBranch %488 + %490 = OpLabel + OpBranch %482 %488 = OpLabel - %489 = OpLoad %int %i - %491 = OpSLessThan %bool %489 %int_15 - OpSelectionMerge %492 None - OpBranchConditional %491 %493 %494 - %493 = OpLabel - OpBranch %492 - %494 = OpLabel - OpBranch %486 - %492 = OpLabel - %495 = OpLoad %v2float %v_uv - %496 = OpLoad %v2float %vCurrOffset - %498 = OpLoad %28 %TextureSamplerSampler - %499 = OpLoad %25 %TextureSamplerTexture - %500 = OpSampledImage %376 %499 %498 - %501 = OpFAdd %v2float %495 %496 - %497 = OpImageSampleImplicitLod %v4float %500 %501 - %502 = OpCompositeExtract %float %497 3 - OpStore %currSampledHeight %502 - %503 = OpLoad %float %currSampledHeight - %504 = OpLoad %float %currRayHeight - %505 = OpFOrdGreaterThan %bool %503 %504 - OpSelectionMerge %506 None - OpBranchConditional %505 %507 %508 - %507 = OpLabel - %509 = OpLoad %float %currSampledHeight - %510 = OpLoad %float %currRayHeight - %511 = OpFSub %float %509 %510 - OpStore %delta1 %511 - %512 = OpLoad %float %currRayHeight - %513 = OpLoad %float %stepSize - %514 = OpLoad %float %lastSampledHeight - %515 = OpFAdd %float %512 %513 - %516 = OpFSub %float %515 %514 - OpStore %delta2 %516 - %517 = OpLoad %float %delta1 - %518 = OpLoad %float %delta1 - %519 = OpLoad %float %delta2 - %520 = OpFAdd %float %518 %519 - %521 = OpFDiv %float %517 %520 - OpStore %ratio %521 - %522 = OpLoad %float %ratio - %523 = OpLoad %v2float %vLastOffset - %524 = OpLoad %float %ratio - %525 = OpLoad %v2float %vCurrOffset - %526 = OpVectorTimesScalar %v2float %523 %522 - %527 = OpFSub %float %float_1 %524 - %528 = OpVectorTimesScalar %v2float %525 %527 - %529 = OpFAdd %v2float %526 %528 - OpStore %vCurrOffset %529 - OpBranch %486 - %508 = OpLabel + %491 = OpLoad %v2float %v_uv + %492 = OpLoad %v2float %vCurrOffset + %494 = OpLoad %28 %TextureSamplerSampler + %495 = OpLoad %25 %TextureSamplerTexture + %496 = OpSampledImage %374 %495 %494 + %497 = OpFAdd %v2float %491 %492 + %493 = OpImageSampleImplicitLod %v4float %496 %497 + %498 = OpCompositeExtract %float %493 3 + OpStore %currSampledHeight %498 + %499 = OpLoad %float %currSampledHeight + %500 = OpLoad %float %currRayHeight + %501 = OpFOrdGreaterThan %bool %499 %500 + OpSelectionMerge %502 None + OpBranchConditional %501 %503 %504 + %503 = OpLabel + %505 = OpLoad %float %currSampledHeight + %506 = OpLoad %float %currRayHeight + %507 = OpFSub %float %505 %506 + OpStore %delta1 %507 + %508 = OpLoad %float %currRayHeight + %509 = OpLoad %float %stepSize + %510 = OpLoad %float %lastSampledHeight + %511 = OpFAdd %float %508 %509 + %512 = OpFSub %float %511 %510 + OpStore %delta2 %512 + %513 = OpLoad %float %delta1 + %514 = OpLoad %float %delta1 + %515 = OpLoad %float %delta2 + %516 = OpFAdd %float %514 %515 + %517 = OpFDiv %float %513 %516 + OpStore %ratio %517 + %518 = OpLoad %float %ratio + %519 = OpLoad %v2float %vLastOffset + %520 = OpLoad %float %ratio + %521 = OpLoad %v2float %vCurrOffset + %522 = OpVectorTimesScalar %v2float %519 %518 + %523 = OpFSub %float %float_1 %520 + %524 = OpVectorTimesScalar %v2float %521 %523 + %525 = OpFAdd %v2float %522 %524 + OpStore %vCurrOffset %525 + OpBranch %482 + %504 = OpLabel + %526 = OpLoad %float %stepSize + %527 = OpLoad %float %currRayHeight + %528 = OpFSub %float %527 %526 + OpStore %currRayHeight %528 + %529 = OpLoad %v2float %vCurrOffset + OpStore %vLastOffset %529 %530 = OpLoad %float %stepSize - %531 = OpLoad %float %currRayHeight - %532 = OpFSub %float %531 %530 - OpStore %currRayHeight %532 - %533 = OpLoad %v2float %vCurrOffset - OpStore %vLastOffset %533 - %534 = OpLoad %float %stepSize - %535 = OpLoad %v2float %vMaxOffset - %536 = OpLoad %v2float %vCurrOffset - %537 = OpVectorTimesScalar %v2float %535 %534 - %538 = OpFAdd %v2float %536 %537 - OpStore %vCurrOffset %538 - %539 = OpLoad %float %currSampledHeight - OpStore %lastSampledHeight %539 - OpBranch %506 - %506 = OpLabel - OpBranch %487 - %487 = OpLabel - %540 = OpLoad %int %i - %541 = OpIAdd %int %540 %int_1 - OpStore %i %541 - OpBranch %485 - %486 = OpLabel - %542 = OpLoad %v2float %vCurrOffset - OpStore %parallaxOcclusion_0 %542 - %543 = OpLoad %v2float %parallaxOcclusion_0 - OpStore %uvOffset %543 - %544 = OpLoad %v2float %v_uv - %545 = OpLoad %v2float %uvOffset - %547 = OpLoad %28 %TextureSamplerSampler - %548 = OpLoad %25 %TextureSamplerTexture - %549 = OpSampledImage %376 %548 %547 - %550 = OpFAdd %v2float %544 %545 - %546 = OpImageSampleImplicitLod %v4float %549 %550 - %551 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_2 - %552 = OpLoad %float %551 - %553 = OpLoad %mat3v3float %TBN - OpStore %param_8 %553 - %554 = OpCompositeExtract %float %546 0 - %555 = OpCompositeExtract %float %546 1 - %556 = OpCompositeExtract %float %546 2 - %557 = OpCompositeConstruct %v3float %554 %555 %556 - OpStore %param_9 %557 - %558 = OpFDiv %float %float_1 %552 - OpStore %param_10 %558 - %559 = OpFunctionCall %v3float %perturbNormal_mf33_vf3_f1_ %param_8 %param_9 %param_10 - %563 = OpLoad %v4float %output4 - %564 = OpCompositeExtract %float %559 0 - %565 = OpCompositeExtract %float %559 1 - %566 = OpCompositeExtract %float %559 2 - %567 = OpCompositeExtract %float %563 3 - %568 = OpCompositeConstruct %v4float %564 %565 %566 %567 - OpStore %output4 %568 - %569 = OpLoad %v2float %v_uv - %570 = OpLoad %v2float %uvOffset - %571 = OpFAdd %v2float %569 %570 - OpStore %output6 %571 - %572 = OpLoad %v2float %output6 - %574 = OpLoad %28 %TextureSampler1Sampler - %575 = OpLoad %25 %TextureSampler1Texture - %576 = OpSampledImage %376 %575 %574 - %573 = OpImageSampleImplicitLod %v4float %576 %572 - OpStore %tempTextureRead1 %573 - %577 = OpLoad %v4float %tempTextureRead1 - %578 = OpCompositeExtract %float %577 0 - %579 = OpCompositeExtract %float %577 1 - %580 = OpCompositeExtract %float %577 2 - %581 = OpCompositeConstruct %v3float %578 %579 %580 - OpStore %rgb1 %581 - %582 = OpAccessChain %_ptr_Uniform_v3float %x_269 %uint_4 - %583 = OpLoad %v3float %582 - %584 = OpLoad %v4float %v_output1 - %586 = OpCompositeExtract %float %584 0 - %587 = OpCompositeExtract %float %584 1 - %588 = OpCompositeExtract %float %584 2 - %589 = OpCompositeConstruct %v3float %586 %587 %588 - %590 = OpFSub %v3float %583 %589 - %585 = OpExtInst %v3float %88 Normalize %590 - OpStore %viewDirectionW_1 %585 + %531 = OpLoad %v2float %vMaxOffset + %532 = OpLoad %v2float %vCurrOffset + %533 = OpVectorTimesScalar %v2float %531 %530 + %534 = OpFAdd %v2float %532 %533 + OpStore %vCurrOffset %534 + %535 = OpLoad %float %currSampledHeight + OpStore %lastSampledHeight %535 + OpBranch %502 + %502 = OpLabel + OpBranch %483 + %483 = OpLabel + %536 = OpLoad %int %i + %537 = OpIAdd %int %536 %int_1 + OpStore %i %537 + OpBranch %481 + %482 = OpLabel + %538 = OpLoad %v2float %vCurrOffset + OpStore %parallaxOcclusion_0 %538 + %539 = OpLoad %v2float %parallaxOcclusion_0 + OpStore %uvOffset %539 + %540 = OpLoad %v2float %v_uv + %541 = OpLoad %v2float %uvOffset + %543 = OpLoad %28 %TextureSamplerSampler + %544 = OpLoad %25 %TextureSamplerTexture + %545 = OpSampledImage %374 %544 %543 + %546 = OpFAdd %v2float %540 %541 + %542 = OpImageSampleImplicitLod %v4float %545 %546 + %547 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_2 + %548 = OpLoad %float %547 + %549 = OpLoad %mat3v3float %TBN + OpStore %param_8 %549 + %550 = OpCompositeExtract %float %542 0 + %551 = OpCompositeExtract %float %542 1 + %552 = OpCompositeExtract %float %542 2 + %553 = OpCompositeConstruct %v3float %550 %551 %552 + OpStore %param_9 %553 + %554 = OpFDiv %float %float_1 %548 + OpStore %param_10 %554 + %555 = OpFunctionCall %v3float %perturbNormal_mf33_vf3_f1_ %param_8 %param_9 %param_10 + %559 = OpLoad %v4float %output4 + %560 = OpCompositeExtract %float %555 0 + %561 = OpCompositeExtract %float %555 1 + %562 = OpCompositeExtract %float %555 2 + %563 = OpCompositeExtract %float %559 3 + %564 = OpCompositeConstruct %v4float %560 %561 %562 %563 + OpStore %output4 %564 + %565 = OpLoad %v2float %v_uv + %566 = OpLoad %v2float %uvOffset + %567 = OpFAdd %v2float %565 %566 + OpStore %output6 %567 + %568 = OpLoad %v2float %output6 + %570 = OpLoad %28 %TextureSampler1Sampler + %571 = OpLoad %25 %TextureSampler1Texture + %572 = OpSampledImage %374 %571 %570 + %569 = OpImageSampleImplicitLod %v4float %572 %568 + OpStore %tempTextureRead1 %569 + %573 = OpLoad %v4float %tempTextureRead1 + %574 = OpCompositeExtract %float %573 0 + %575 = OpCompositeExtract %float %573 1 + %576 = OpCompositeExtract %float %573 2 + %577 = OpCompositeConstruct %v3float %574 %575 %576 + OpStore %rgb1 %577 + %578 = OpAccessChain %_ptr_Uniform_v3float %x_269 %uint_4 + %579 = OpLoad %v3float %578 + %580 = OpLoad %v4float %v_output1 + %582 = OpCompositeExtract %float %580 0 + %583 = OpCompositeExtract %float %580 1 + %584 = OpCompositeExtract %float %580 2 + %585 = OpCompositeConstruct %v3float %582 %583 %584 + %586 = OpFSub %v3float %579 %585 + %581 = OpExtInst %v3float %88 Normalize %586 + OpStore %viewDirectionW_1 %581 OpStore %shadow %float_1 - %591 = OpLoad %float %u_Float - %592 = OpFMul %float %float_1 %591 - OpStore %glossiness_1 %592 - OpStore %diffuseBase %593 - OpStore %specularBase %593 - %594 = OpLoad %v4float %output4 - %595 = OpCompositeExtract %float %594 0 - %596 = OpCompositeExtract %float %594 1 - %597 = OpCompositeExtract %float %594 2 - %598 = OpCompositeConstruct %v3float %595 %596 %597 - OpStore %normalW %598 - %599 = OpLoad %v3float %viewDirectionW_1 - OpStore %param_11 %599 - %600 = OpLoad %v3float %normalW - OpStore %param_12 %600 - %602 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_0 - %603 = OpLoad %v4float %602 - OpStore %param_13 %603 - %604 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_1 - %605 = OpLoad %v4float %604 - %606 = OpCompositeExtract %float %605 0 - %607 = OpCompositeExtract %float %605 1 - %608 = OpCompositeExtract %float %605 2 - %609 = OpCompositeConstruct %v3float %606 %607 %608 - OpStore %param_14 %609 - %610 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_2 - %611 = OpLoad %v4float %610 - %612 = OpCompositeExtract %float %611 0 - %613 = OpCompositeExtract %float %611 1 - %614 = OpCompositeExtract %float %611 2 - %615 = OpCompositeConstruct %v3float %612 %613 %614 - OpStore %param_15 %615 - %617 = OpAccessChain %_ptr_Uniform_v3float %light0 %uint_3 - %618 = OpLoad %v3float %617 - OpStore %param_16 %618 - %619 = OpLoad %float %glossiness_1 - OpStore %param_17 %619 - %620 = OpFunctionCall %lightingInfo %computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_ %param_11 %param_12 %param_13 %param_14 %param_15 %param_16 %param_17 - OpStore %info %620 + %587 = OpLoad %float %u_Float + %588 = OpFMul %float %float_1 %587 + OpStore %glossiness_1 %588 + OpStore %diffuseBase %22 + OpStore %specularBase %22 + %589 = OpLoad %v4float %output4 + %590 = OpCompositeExtract %float %589 0 + %591 = OpCompositeExtract %float %589 1 + %592 = OpCompositeExtract %float %589 2 + %593 = OpCompositeConstruct %v3float %590 %591 %592 + OpStore %normalW %593 + %594 = OpLoad %v3float %viewDirectionW_1 + OpStore %param_11 %594 + %595 = OpLoad %v3float %normalW + OpStore %param_12 %595 + %597 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_0 + %598 = OpLoad %v4float %597 + OpStore %param_13 %598 + %599 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_1 + %600 = OpLoad %v4float %599 + %601 = OpCompositeExtract %float %600 0 + %602 = OpCompositeExtract %float %600 1 + %603 = OpCompositeExtract %float %600 2 + %604 = OpCompositeConstruct %v3float %601 %602 %603 + OpStore %param_14 %604 + %605 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_2 + %606 = OpLoad %v4float %605 + %607 = OpCompositeExtract %float %606 0 + %608 = OpCompositeExtract %float %606 1 + %609 = OpCompositeExtract %float %606 2 + %610 = OpCompositeConstruct %v3float %607 %608 %609 + OpStore %param_15 %610 + %612 = OpAccessChain %_ptr_Uniform_v3float %light0 %uint_3 + %613 = OpLoad %v3float %612 + OpStore %param_16 %613 + %614 = OpLoad %float %glossiness_1 + OpStore %param_17 %614 + %615 = OpFunctionCall %lightingInfo %computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_ %param_11 %param_12 %param_13 %param_14 %param_15 %param_16 %param_17 + OpStore %info %615 OpStore %shadow %float_1 - %628 = OpAccessChain %_ptr_Function_v3float %info %uint_0 - %629 = OpLoad %v3float %628 - %630 = OpLoad %float %shadow - %631 = OpLoad %v3float %diffuseBase - %632 = OpVectorTimesScalar %v3float %629 %630 - %633 = OpFAdd %v3float %631 %632 - OpStore %diffuseBase %633 - %634 = OpAccessChain %_ptr_Function_v3float %info %uint_1 - %635 = OpLoad %v3float %634 - %636 = OpLoad %float %shadow - %637 = OpLoad %v3float %specularBase - %638 = OpVectorTimesScalar %v3float %635 %636 - %639 = OpFAdd %v3float %637 %638 - OpStore %specularBase %639 - %640 = OpLoad %v3float %diffuseBase - %641 = OpLoad %v3float %rgb1 - %642 = OpFMul %v3float %640 %641 - OpStore %diffuseOutput %642 - %643 = OpLoad %v3float %specularBase - %644 = OpLoad %v3float %u_Color - %645 = OpFMul %v3float %643 %644 - OpStore %specularOutput %645 - %646 = OpLoad %v3float %diffuseOutput - %647 = OpLoad %v3float %specularOutput - %648 = OpFAdd %v3float %646 %647 - OpStore %output3 %648 - %649 = OpLoad %v3float %output3 - %650 = OpCompositeExtract %float %649 0 - %651 = OpCompositeExtract %float %649 1 - %652 = OpCompositeExtract %float %649 2 - %653 = OpCompositeConstruct %v4float %650 %651 %652 %float_1 - OpStore %glFragColor %653 + %623 = OpAccessChain %_ptr_Function_v3float %info %uint_0 + %624 = OpLoad %v3float %623 + %625 = OpLoad %float %shadow + %626 = OpLoad %v3float %diffuseBase + %627 = OpVectorTimesScalar %v3float %624 %625 + %628 = OpFAdd %v3float %626 %627 + OpStore %diffuseBase %628 + %629 = OpAccessChain %_ptr_Function_v3float %info %uint_1 + %630 = OpLoad %v3float %629 + %631 = OpLoad %float %shadow + %632 = OpLoad %v3float %specularBase + %633 = OpVectorTimesScalar %v3float %630 %631 + %634 = OpFAdd %v3float %632 %633 + OpStore %specularBase %634 + %635 = OpLoad %v3float %diffuseBase + %636 = OpLoad %v3float %rgb1 + %637 = OpFMul %v3float %635 %636 + OpStore %diffuseOutput %637 + %638 = OpLoad %v3float %specularBase + %639 = OpLoad %v3float %u_Color + %640 = OpFMul %v3float %638 %639 + OpStore %specularOutput %640 + %641 = OpLoad %v3float %diffuseOutput + %642 = OpLoad %v3float %specularOutput + %643 = OpFAdd %v3float %641 %642 + OpStore %output3 %643 + %644 = OpLoad %v3float %output3 + %645 = OpCompositeExtract %float %644 0 + %646 = OpCompositeExtract %float %644 1 + %647 = OpCompositeExtract %float %644 2 + %648 = OpCompositeConstruct %v4float %645 %646 %647 %float_1 + OpStore %glFragColor %648 OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %654 + %main_inner = OpFunction %main_out None %649 %vMainuv_param = OpFunctionParameter %v2float %v_output1_param = OpFunctionParameter %v4float %gl_FrontFacing_param = OpFunctionParameter %bool %v_uv_param = OpFunctionParameter %v2float %v_output2_param = OpFunctionParameter %v4float - %662 = OpLabel + %657 = OpLabel OpStore %vMainuv %vMainuv_param OpStore %v_output1 %v_output1_param OpStore %gl_FrontFacing %gl_FrontFacing_param OpStore %v_uv %v_uv_param OpStore %v_output2 %v_output2_param - %663 = OpFunctionCall %void %main_1 - %664 = OpLoad %v4float %glFragColor - %665 = OpCompositeConstruct %main_out %664 - OpReturnValue %665 + %658 = OpFunctionCall %void %main_1 + %659 = OpLoad %v4float %glFragColor + %660 = OpCompositeConstruct %main_out %659 + OpReturnValue %660 OpFunctionEnd - %main = OpFunction %void None %311 - %667 = OpLabel - %669 = OpLoad %v2float %vMainuv_param_1 - %670 = OpLoad %v4float %v_output1_param_1 - %671 = OpLoad %bool %gl_FrontFacing_param_1 - %672 = OpLoad %v2float %v_uv_param_1 - %673 = OpLoad %v4float %v_output2_param_1 - %668 = OpFunctionCall %main_out %main_inner %669 %670 %671 %672 %673 - %674 = OpCompositeExtract %v4float %668 0 - OpStore %glFragColor_1_1 %674 + %main = OpFunction %void None %310 + %662 = OpLabel + %664 = OpLoad %v2float %vMainuv_param_1 + %665 = OpLoad %v4float %v_output1_param_1 + %666 = OpLoad %bool %gl_FrontFacing_param_1 + %667 = OpLoad %v2float %v_uv_param_1 + %668 = OpLoad %v4float %v_output2_param_1 + %663 = OpFunctionCall %main_out %main_inner %664 %665 %666 %667 %668 + %669 = OpCompositeExtract %v4float %663 0 + OpStore %glFragColor_1_1 %669 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/949.wgsl.expected.wgsl b/test/tint/bug/tint/949.wgsl.expected.wgsl index c16bf963cc..aac23a0797 100644 --- a/test/tint/bug/tint/949.wgsl.expected.wgsl +++ b/test/tint/bug/tint/949.wgsl.expected.wgsl @@ -1,3 +1,15 @@ +bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from uniform control flow + let x_397 : vec4 = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395)); + ^^^^^^^^^^^^^ + +bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value + if ((x_400 > x_401)) { + ^^ + +bug/tint/949.wgsl:308:27 note: reading from module-scope private variable 'v_output2' may result in a non-uniform value + let x_366 : vec4 = v_output2; + ^^^^^^^^^ + struct lightingInfo { diffuse : vec3, specular : vec3, @@ -440,7 +452,7 @@ struct main_out { glFragColor_1 : vec4, } -@stage(fragment) +@fragment fn main(@location(1) vMainuv_param : vec2, @location(0) v_output1_param : vec4, @builtin(front_facing) gl_FrontFacing_param : bool, @location(3) v_uv_param : vec2, @location(2) v_output2_param : vec4) -> main_out { vMainuv = vMainuv_param; v_output1 = v_output1_param; diff --git a/test/tint/bug/tint/951.spvasm.expected.hlsl b/test/tint/bug/tint/951.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/951.spvasm.expected.hlsl rename to test/tint/bug/tint/951.spvasm.expected.dxc.hlsl diff --git a/test/tint/bug/tint/951.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/951.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..7f73b88595 --- /dev/null +++ b/test/tint/bug/tint/951.spvasm.expected.fxc.hlsl @@ -0,0 +1,65 @@ +RWByteAddressBuffer x_16 : register(u0, space0); +ByteAddressBuffer x_20 : register(t1, space0); +static uint3 gl_GlobalInvocationID = uint3(0u, 0u, 0u); +cbuffer cbuffer_x_24 : register(b2, space0) { + uint4 x_24[2]; +}; + +float getAAtOutCoords_() { + const uint x_42 = gl_GlobalInvocationID.x; + const float x_44 = asfloat(x_20.Load((4u * x_42))); + return x_44; +} + +float unaryOperation_f1_(inout float a) { + const float x_47 = a; + if ((x_47 < 0.0f)) { + return asfloat(0x7f800000u); + } + const float x_55 = a; + return log(x_55); +} + +void setOutput_i1_f1_(inout int flatIndex, inout float value) { + const int x_27 = flatIndex; + const float x_28 = value; + x_16.Store((4u * uint(x_27)), asuint(x_28)); + return; +} + +void main_1() { + int index = 0; + float a_1 = 0.0f; + float param = 0.0f; + int param_1 = 0; + float param_2 = 0.0f; + const uint x_61 = gl_GlobalInvocationID.x; + index = asint(x_61); + const int x_63 = index; + const int x_70 = asint(x_24[1].x); + if ((x_63 < x_70)) { + const float x_75 = getAAtOutCoords_(); + a_1 = x_75; + param = a_1; + const float x_78 = unaryOperation_f1_(param); + param_1 = index; + param_2 = x_78; + setOutput_i1_f1_(param_1, param_2); + } + return; +} + +struct tint_symbol_1 { + uint3 gl_GlobalInvocationID_param : SV_DispatchThreadID; +}; + +void main_inner(uint3 gl_GlobalInvocationID_param) { + gl_GlobalInvocationID = gl_GlobalInvocationID_param; + main_1(); +} + +[numthreads(128, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.gl_GlobalInvocationID_param); + return; +} diff --git a/test/tint/bug/tint/951.spvasm.expected.msl b/test/tint/bug/tint/951.spvasm.expected.msl index 80a05a7eed..0e5fdfff70 100644 --- a/test/tint/bug/tint/951.spvasm.expected.msl +++ b/test/tint/bug/tint/951.spvasm.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct ssbOut { - /* 0x0000 */ float result[1]; + /* 0x0000 */ tint_array result; }; struct ssbA { - /* 0x0000 */ float A[1]; + /* 0x0000 */ tint_array A; }; struct Uniforms { diff --git a/test/tint/bug/tint/951.spvasm.expected.spvasm b/test/tint/bug/tint/951.spvasm.expected.spvasm index dfbd8ded3d..9bd8675500 100644 --- a/test/tint/bug/tint/951.spvasm.expected.spvasm +++ b/test/tint/bug/tint/951.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 97 +; Bound: 96 ; Schema: 0 OpCapability Shader %46 = OpExtInstImport "GLSL.std.450" @@ -83,7 +83,7 @@ %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_Function_float = OpTypePointer Function %float %30 = OpTypeFunction %float %_ptr_Function_float - %float_0 = OpConstant %float 0 + %37 = OpConstantNull %float %bool = OpTypeBool %float_0x1p_128 = OpConstant %float 0x1p+128 %void = OpTypeVoid @@ -91,10 +91,9 @@ %47 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_float %59 = OpTypeFunction %void %63 = OpConstantNull %int - %65 = OpConstantNull %float %uint_4 = OpConstant %uint 4 %_ptr_Uniform_int = OpTypePointer Uniform %int - %88 = OpTypeFunction %void %v3uint + %87 = OpTypeFunction %void %v3uint %getAAtOutCoords_ = OpFunction %float None %20 %22 = OpLabel %25 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 @@ -107,7 +106,7 @@ %a = OpFunctionParameter %_ptr_Function_float %34 = OpLabel %36 = OpLoad %float %a - %38 = OpFOrdLessThan %bool %36 %float_0 + %38 = OpFOrdLessThan %bool %36 %37 OpSelectionMerge %40 None OpBranchConditional %38 %41 %40 %41 = OpLabel @@ -130,44 +129,44 @@ %main_1 = OpFunction %void None %59 %61 = OpLabel %index = OpVariable %_ptr_Function_int Function %63 - %a_1 = OpVariable %_ptr_Function_float Function %65 - %param = OpVariable %_ptr_Function_float Function %65 + %a_1 = OpVariable %_ptr_Function_float Function %37 + %param = OpVariable %_ptr_Function_float Function %37 %param_1 = OpVariable %_ptr_Function_int Function %63 - %param_2 = OpVariable %_ptr_Function_float Function %65 - %69 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 - %70 = OpLoad %uint %69 - %71 = OpBitcast %int %70 - OpStore %index %71 - %72 = OpLoad %int %index - %75 = OpAccessChain %_ptr_Uniform_int %x_24 %uint_4 - %76 = OpLoad %int %75 - %77 = OpSLessThan %bool %72 %76 - OpSelectionMerge %78 None - OpBranchConditional %77 %79 %78 - %79 = OpLabel - %80 = OpFunctionCall %float %getAAtOutCoords_ - OpStore %a_1 %80 - %81 = OpLoad %float %a_1 - OpStore %param %81 - %82 = OpFunctionCall %float %unaryOperation_f1_ %param - %84 = OpLoad %int %index - OpStore %param_1 %84 - OpStore %param_2 %82 - %85 = OpFunctionCall %void %setOutput_i1_f1_ %param_1 %param_2 - OpBranch %78 + %param_2 = OpVariable %_ptr_Function_float Function %37 + %68 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %69 = OpLoad %uint %68 + %70 = OpBitcast %int %69 + OpStore %index %70 + %71 = OpLoad %int %index + %74 = OpAccessChain %_ptr_Uniform_int %x_24 %uint_4 + %75 = OpLoad %int %74 + %76 = OpSLessThan %bool %71 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 %78 = OpLabel + %79 = OpFunctionCall %float %getAAtOutCoords_ + OpStore %a_1 %79 + %80 = OpLoad %float %a_1 + OpStore %param %80 + %81 = OpFunctionCall %float %unaryOperation_f1_ %param + %83 = OpLoad %int %index + OpStore %param_1 %83 + OpStore %param_2 %81 + %84 = OpFunctionCall %void %setOutput_i1_f1_ %param_1 %param_2 + OpBranch %77 + %77 = OpLabel OpReturn OpFunctionEnd - %main_inner = OpFunction %void None %88 + %main_inner = OpFunction %void None %87 %gl_GlobalInvocationID_param = OpFunctionParameter %v3uint - %91 = OpLabel + %90 = OpLabel OpStore %gl_GlobalInvocationID %gl_GlobalInvocationID_param - %92 = OpFunctionCall %void %main_1 + %91 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd %main = OpFunction %void None %59 - %94 = OpLabel - %96 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 - %95 = OpFunctionCall %void %main_inner %96 + %93 = OpLabel + %95 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 + %94 = OpFunctionCall %void %main_inner %95 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/951.spvasm.expected.wgsl b/test/tint/bug/tint/951.spvasm.expected.wgsl index b9c362e9d8..c59626abe3 100644 --- a/test/tint/bug/tint/951.spvasm.expected.wgsl +++ b/test/tint/bug/tint/951.spvasm.expected.wgsl @@ -34,8 +34,8 @@ fn getAAtOutCoords_() -> f32 { fn unaryOperation_f1_(a : ptr) -> f32 { let x_47 : f32 = *(a); - if ((x_47 < 0.0)) { - return 0x1p+128; + if ((x_47 < 0.0f)) { + return 0x1p+128f; } let x_55 : f32 = *(a); return log(x_55); @@ -72,7 +72,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(128i, 1i, 1i) +@compute @workgroup_size(128i, 1i, 1i) fn main(@builtin(global_invocation_id) gl_GlobalInvocationID_param : vec3) { gl_GlobalInvocationID = gl_GlobalInvocationID_param; main_1(); diff --git a/test/tint/bug/tint/959.wgsl b/test/tint/bug/tint/959.wgsl index e472591a56..8f3d9ba867 100644 --- a/test/tint/bug/tint/959.wgsl +++ b/test/tint/bug/tint/959.wgsl @@ -58,7 +58,7 @@ struct S { @group(14) @binding(300) var s14 : sampler_comparison; @group(15) @binding(300) var s15 : sampler_comparison; -@stage(fragment) +@fragment fn main() { _ = b0; _ = b1; diff --git a/test/tint/bug/tint/959.wgsl.expected.hlsl b/test/tint/bug/tint/959.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/959.wgsl.expected.hlsl rename to test/tint/bug/tint/959.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/959.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/959.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c09714e84 --- /dev/null +++ b/test/tint/bug/tint/959.wgsl.expected.fxc.hlsl @@ -0,0 +1,68 @@ +ByteAddressBuffer b0 : register(t0, space0); +ByteAddressBuffer b1 : register(t0, space1); +ByteAddressBuffer b2 : register(t0, space2); +ByteAddressBuffer b3 : register(t0, space3); +ByteAddressBuffer b4 : register(t0, space4); +ByteAddressBuffer b5 : register(t0, space5); +ByteAddressBuffer b6 : register(t0, space6); +ByteAddressBuffer b7 : register(t0, space7); +cbuffer cbuffer_b8 : register(b1, space9) { + uint4 b8[1]; +}; +cbuffer cbuffer_b9 : register(b1, space8) { + uint4 b9[1]; +}; +cbuffer cbuffer_b10 : register(b1, space10) { + uint4 b10[1]; +}; +cbuffer cbuffer_b11 : register(b1, space11) { + uint4 b11[1]; +}; +cbuffer cbuffer_b12 : register(b1, space12) { + uint4 b12[1]; +}; +cbuffer cbuffer_b13 : register(b1, space13) { + uint4 b13[1]; +}; +cbuffer cbuffer_b14 : register(b1, space14) { + uint4 b14[1]; +}; +cbuffer cbuffer_b15 : register(b1, space15) { + uint4 b15[1]; +}; +Texture2D t0 : register(t1, space0); +Texture2D t1 : register(t1, space1); +Texture2D t2 : register(t1, space2); +Texture2D t3 : register(t1, space3); +Texture2D t4 : register(t1, space4); +Texture2D t5 : register(t1, space5); +Texture2D t6 : register(t1, space6); +Texture2D t7 : register(t1, space7); +Texture2D t8 : register(t200, space8); +Texture2D t9 : register(t200, space9); +Texture2D t10 : register(t200, space10); +Texture2D t11 : register(t200, space11); +Texture2D t12 : register(t200, space12); +Texture2D t13 : register(t200, space13); +Texture2D t14 : register(t200, space14); +Texture2D t15 : register(t200, space15); +SamplerState s0 : register(s200, space0); +SamplerState s1 : register(s200, space1); +SamplerState s2 : register(s200, space2); +SamplerState s3 : register(s200, space3); +SamplerState s4 : register(s200, space4); +SamplerState s5 : register(s200, space5); +SamplerState s6 : register(s200, space6); +SamplerState s7 : register(s200, space7); +SamplerComparisonState s8 : register(s300, space8); +SamplerComparisonState s9 : register(s300, space9); +SamplerComparisonState s10 : register(s300, space10); +SamplerComparisonState s11 : register(s300, space11); +SamplerComparisonState s12 : register(s300, space12); +SamplerComparisonState s13 : register(s300, space13); +SamplerComparisonState s14 : register(s300, space14); +SamplerComparisonState s15 : register(s300, space15); + +void main() { + return; +} diff --git a/test/tint/bug/tint/959.wgsl.expected.wgsl b/test/tint/bug/tint/959.wgsl.expected.wgsl index face4f9b9c..95fad73ee8 100644 --- a/test/tint/bug/tint/959.wgsl.expected.wgsl +++ b/test/tint/bug/tint/959.wgsl.expected.wgsl @@ -98,7 +98,7 @@ struct S { @group(15) @binding(300) var s15 : sampler_comparison; -@stage(fragment) +@fragment fn main() { _ = b0; _ = b1; diff --git a/test/tint/bug/tint/977.spvasm.expected.hlsl b/test/tint/bug/tint/977.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/977.spvasm.expected.hlsl rename to test/tint/bug/tint/977.spvasm.expected.dxc.hlsl diff --git a/test/tint/bug/tint/977.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/977.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..a3d4ec9e36 --- /dev/null +++ b/test/tint/bug/tint/977.spvasm.expected.fxc.hlsl @@ -0,0 +1,58 @@ +static uint3 gl_GlobalInvocationID = uint3(0u, 0u, 0u); +RWByteAddressBuffer resultMatrix : register(u2, space0); +ByteAddressBuffer firstMatrix : register(t0, space0); +ByteAddressBuffer secondMatrix : register(t1, space0); +cbuffer cbuffer_x_46 : register(b3, space0) { + uint4 x_46[1]; +}; + +float binaryOperation_f1_f1_(inout float a, inout float b) { + float x_26 = 0.0f; + const float x_13 = b; + if ((x_13 == 0.0f)) { + return 1.0f; + } + const float x_21 = b; + if (!((round((x_21 - (2.0f * floor((x_21 / 2.0f))))) == 1.0f))) { + const float x_29 = a; + const float x_31 = b; + x_26 = pow(abs(x_29), x_31); + } else { + const float x_34 = a; + const float x_36 = a; + const float x_38 = b; + x_26 = (sign(x_34) * pow(abs(x_36), x_38)); + } + return x_26; +} + +void main_1() { + int index = 0; + int a_1 = 0; + float param = 0.0f; + float param_1 = 0.0f; + const uint x_54 = gl_GlobalInvocationID.x; + index = asint(x_54); + a_1 = -10; + const int x_63 = index; + param = -4.0f; + param_1 = -3.0f; + const float x_68 = binaryOperation_f1_f1_(param, param_1); + resultMatrix.Store((4u * uint(x_63)), asuint(x_68)); + return; +} + +struct tint_symbol_1 { + uint3 gl_GlobalInvocationID_param : SV_DispatchThreadID; +}; + +void main_inner(uint3 gl_GlobalInvocationID_param) { + gl_GlobalInvocationID = gl_GlobalInvocationID_param; + main_1(); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.gl_GlobalInvocationID_param); + return; +} diff --git a/test/tint/bug/tint/977.spvasm.expected.msl b/test/tint/bug/tint/977.spvasm.expected.msl index 16062d0ddf..83b2b6cb0c 100644 --- a/test/tint/bug/tint/977.spvasm.expected.msl +++ b/test/tint/bug/tint/977.spvasm.expected.msl @@ -1,16 +1,29 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct ResultMatrix { - /* 0x0000 */ float numbers[1]; + /* 0x0000 */ tint_array numbers; }; struct FirstMatrix { - float numbers[1]; + tint_array numbers; }; struct SecondMatrix { - float numbers[1]; + tint_array numbers; }; struct Uniforms { diff --git a/test/tint/bug/tint/977.spvasm.expected.spvasm b/test/tint/bug/tint/977.spvasm.expected.spvasm index 46407251ed..fa88dfede5 100644 --- a/test/tint/bug/tint/977.spvasm.expected.spvasm +++ b/test/tint/bug/tint/977.spvasm.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 103 +; Bound: 102 ; Schema: 0 OpCapability Shader - %43 = OpExtInstImport "GLSL.std.450" + %42 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID_param_1 OpExecutionMode %main LocalSize 1 1 1 @@ -84,93 +84,92 @@ %_ptr_Function_float = OpTypePointer Function %float %23 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float %30 = OpConstantNull %float - %float_0 = OpConstant %float 0 %bool = OpTypeBool %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %void = OpTypeVoid - %70 = OpTypeFunction %void + %69 = OpTypeFunction %void %_ptr_Function_int = OpTypePointer Function %int - %76 = OpConstantNull %int + %75 = OpConstantNull %int %uint_0 = OpConstant %uint 0 %_ptr_Private_uint = OpTypePointer Private %uint %int_n10 = OpConstant %int -10 %float_n4 = OpConstant %float -4 %float_n3 = OpConstant %float -3 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float - %94 = OpTypeFunction %void %v3uint + %93 = OpTypeFunction %void %v3uint %binaryOperation_f1_f1_ = OpFunction %float None %23 %a = OpFunctionParameter %_ptr_Function_float %b = OpFunctionParameter %_ptr_Function_float %28 = OpLabel %x_26 = OpVariable %_ptr_Function_float Function %30 %32 = OpLoad %float %b - %34 = OpFOrdEqual %bool %32 %float_0 - OpSelectionMerge %36 None - OpBranchConditional %34 %37 %36 - %37 = OpLabel - OpReturnValue %float_1 + %33 = OpFOrdEqual %bool %32 %30 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 %36 = OpLabel - %40 = OpLoad %float %b - %46 = OpFDiv %float %40 %float_2 - %45 = OpExtInst %float %43 Floor %46 - %47 = OpFMul %float %float_2 %45 - %48 = OpFSub %float %40 %47 - %42 = OpExtInst %float %43 RoundEven %48 - %49 = OpFOrdEqual %bool %42 %float_1 - %41 = OpLogicalNot %bool %49 - OpSelectionMerge %50 None - OpBranchConditional %41 %51 %52 - %51 = OpLabel - %54 = OpLoad %float %a - %56 = OpLoad %float %b - %58 = OpExtInst %float %43 FAbs %54 - %57 = OpExtInst %float %43 Pow %58 %56 - OpStore %x_26 %57 - OpBranch %50 - %52 = OpLabel - %60 = OpLoad %float %a - %62 = OpLoad %float %a - %64 = OpLoad %float %b - %65 = OpExtInst %float %43 FSign %60 - %67 = OpExtInst %float %43 FAbs %62 - %66 = OpExtInst %float %43 Pow %67 %64 - %68 = OpFMul %float %65 %66 - OpStore %x_26 %68 - OpBranch %50 + OpReturnValue %float_1 + %35 = OpLabel + %39 = OpLoad %float %b + %45 = OpFDiv %float %39 %float_2 + %44 = OpExtInst %float %42 Floor %45 + %46 = OpFMul %float %float_2 %44 + %47 = OpFSub %float %39 %46 + %41 = OpExtInst %float %42 RoundEven %47 + %48 = OpFOrdEqual %bool %41 %float_1 + %40 = OpLogicalNot %bool %48 + OpSelectionMerge %49 None + OpBranchConditional %40 %50 %51 %50 = OpLabel - %69 = OpLoad %float %x_26 - OpReturnValue %69 + %53 = OpLoad %float %a + %55 = OpLoad %float %b + %57 = OpExtInst %float %42 FAbs %53 + %56 = OpExtInst %float %42 Pow %57 %55 + OpStore %x_26 %56 + OpBranch %49 + %51 = OpLabel + %59 = OpLoad %float %a + %61 = OpLoad %float %a + %63 = OpLoad %float %b + %64 = OpExtInst %float %42 FSign %59 + %66 = OpExtInst %float %42 FAbs %61 + %65 = OpExtInst %float %42 Pow %66 %63 + %67 = OpFMul %float %64 %65 + OpStore %x_26 %67 + OpBranch %49 + %49 = OpLabel + %68 = OpLoad %float %x_26 + OpReturnValue %68 OpFunctionEnd - %main_1 = OpFunction %void None %70 - %73 = OpLabel - %index = OpVariable %_ptr_Function_int Function %76 - %a_1 = OpVariable %_ptr_Function_int Function %76 + %main_1 = OpFunction %void None %69 + %72 = OpLabel + %index = OpVariable %_ptr_Function_int Function %75 + %a_1 = OpVariable %_ptr_Function_int Function %75 %param = OpVariable %_ptr_Function_float Function %30 %param_1 = OpVariable %_ptr_Function_float Function %30 - %82 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 - %83 = OpLoad %uint %82 - %84 = OpBitcast %int %83 - OpStore %index %84 + %81 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %82 = OpLoad %uint %81 + %83 = OpBitcast %int %82 + OpStore %index %83 OpStore %a_1 %int_n10 - %86 = OpLoad %int %index + %85 = OpLoad %int %index OpStore %param %float_n4 OpStore %param_1 %float_n3 - %89 = OpFunctionCall %float %binaryOperation_f1_f1_ %param %param_1 - %93 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %86 - OpStore %93 %89 + %88 = OpFunctionCall %float %binaryOperation_f1_f1_ %param %param_1 + %92 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %85 + OpStore %92 %88 OpReturn OpFunctionEnd - %main_inner = OpFunction %void None %94 + %main_inner = OpFunction %void None %93 %gl_GlobalInvocationID_param = OpFunctionParameter %v3uint - %97 = OpLabel + %96 = OpLabel OpStore %gl_GlobalInvocationID %gl_GlobalInvocationID_param - %98 = OpFunctionCall %void %main_1 + %97 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd - %main = OpFunction %void None %70 - %100 = OpLabel - %102 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 - %101 = OpFunctionCall %void %main_inner %102 + %main = OpFunction %void None %69 + %99 = OpLabel + %101 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 + %100 = OpFunctionCall %void %main_inner %101 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/977.spvasm.expected.wgsl b/test/tint/bug/tint/977.spvasm.expected.wgsl index 57c9062abc..7ec6a24547 100644 --- a/test/tint/bug/tint/977.spvasm.expected.wgsl +++ b/test/tint/bug/tint/977.spvasm.expected.wgsl @@ -35,11 +35,11 @@ var gl_GlobalInvocationID : vec3; fn binaryOperation_f1_f1_(a : ptr, b : ptr) -> f32 { var x_26 : f32; let x_13 : f32 = *(b); - if ((x_13 == 0.0)) { - return 1.0; + if ((x_13 == 0.0f)) { + return 1.0f; } let x_21 : f32 = *(b); - if (!((round((x_21 - (2.0 * floor((x_21 / 2.0))))) == 1.0))) { + if (!((round((x_21 - (2.0f * floor((x_21 / 2.0f))))) == 1.0f))) { let x_29 : f32 = *(a); let x_31 : f32 = *(b); x_26 = pow(abs(x_29), x_31); @@ -62,14 +62,14 @@ fn main_1() { index = bitcast(x_54); a_1 = -10i; let x_63 : i32 = index; - param = -4.0; - param_1 = -3.0; + param = -4.0f; + param_1 = -3.0f; let x_68 : f32 = binaryOperation_f1_f1_(&(param), &(param_1)); resultMatrix.numbers[x_63] = x_68; return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main(@builtin(global_invocation_id) gl_GlobalInvocationID_param : vec3) { gl_GlobalInvocationID = gl_GlobalInvocationID_param; main_1(); diff --git a/test/tint/bug/tint/978.wgsl b/test/tint/bug/tint/978.wgsl index 3a0635f28c..c0b51329ce 100644 --- a/test/tint/bug/tint/978.wgsl +++ b/test/tint/bug/tint/978.wgsl @@ -14,7 +14,7 @@ struct FragmentOutput @binding(3) @group(1) var texSampler : sampler; -@stage(fragment) +@fragment fn main( fIn : FragmentInput ) -> FragmentOutput { let sample : f32 = textureSample( depthMap , texSampler, fIn.vUv ); diff --git a/test/tint/bug/tint/978.wgsl.expected.hlsl b/test/tint/bug/tint/978.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/978.wgsl.expected.hlsl rename to test/tint/bug/tint/978.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/978.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/978.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a869da4e74 --- /dev/null +++ b/test/tint/bug/tint/978.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +struct FragmentInput { + float2 vUv; +}; +struct FragmentOutput { + float4 color; +}; + +Texture2D depthMap : register(t5, space1); +SamplerState texSampler : register(s3, space1); + +struct tint_symbol_2 { + float2 vUv : TEXCOORD2; +}; +struct tint_symbol_3 { + float4 color : SV_Target0; +}; + +FragmentOutput main_inner(FragmentInput fIn) { + const float tint_symbol = depthMap.Sample(texSampler, fIn.vUv).x; + const float3 color = float3(tint_symbol, tint_symbol, tint_symbol); + FragmentOutput fOut = (FragmentOutput)0; + fOut.color = float4(color, 1.0f); + return fOut; +} + +tint_symbol_3 main(tint_symbol_2 tint_symbol_1) { + const FragmentInput tint_symbol_4 = {tint_symbol_1.vUv}; + const FragmentOutput inner_result = main_inner(tint_symbol_4); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.color = inner_result.color; + return wrapper_result; +} diff --git a/test/tint/bug/tint/978.wgsl.expected.wgsl b/test/tint/bug/tint/978.wgsl.expected.wgsl index 8327a5768a..4b36794333 100644 --- a/test/tint/bug/tint/978.wgsl.expected.wgsl +++ b/test/tint/bug/tint/978.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct FragmentOutput { @binding(3) @group(1) var texSampler : sampler; -@stage(fragment) +@fragment fn main(fIn : FragmentInput) -> FragmentOutput { let sample : f32 = textureSample(depthMap, texSampler, fIn.vUv); let color : vec3 = vec3(sample, sample, sample); diff --git a/test/tint/bug/tint/980.wgsl b/test/tint/bug/tint/980.wgsl index 3188a8080b..5d64cc1ac1 100644 --- a/test/tint/bug/tint/980.wgsl +++ b/test/tint/bug/tint/980.wgsl @@ -7,7 +7,7 @@ fn Bad(index: u32, rd: vec3) -> vec3 { struct S { v : vec3, i : u32, }; @binding(0) @group(0) var io : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(local_invocation_index) idx : u32) { io.v = Bad(io.i, io.v); } diff --git a/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bcec5f7aaa --- /dev/null +++ b/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl @@ -0,0 +1,26 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +float3 Bad(uint index, float3 rd) { + float3 normal = (0.0f).xxx; + set_float3(normal, index, -(sign(rd[index]))); + return normalize(normal); +} + +RWByteAddressBuffer io : register(u0, space0); + +struct tint_symbol_1 { + uint idx : SV_GroupIndex; +}; + +void main_inner(uint idx) { + const float3 tint_symbol_2 = Bad(io.Load(12u), asfloat(io.Load3(0u))); + io.Store3(0u, asuint(tint_symbol_2)); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.idx); + return; +} diff --git a/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bcec5f7aaa --- /dev/null +++ b/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +float3 Bad(uint index, float3 rd) { + float3 normal = (0.0f).xxx; + set_float3(normal, index, -(sign(rd[index]))); + return normalize(normal); +} + +RWByteAddressBuffer io : register(u0, space0); + +struct tint_symbol_1 { + uint idx : SV_GroupIndex; +}; + +void main_inner(uint idx) { + const float3 tint_symbol_2 = Bad(io.Load(12u), asfloat(io.Load3(0u))); + io.Store3(0u, asuint(tint_symbol_2)); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.idx); + return; +} diff --git a/test/tint/bug/tint/980.wgsl.expected.hlsl b/test/tint/bug/tint/980.wgsl.expected.hlsl deleted file mode 100644 index 300688cb68..0000000000 --- a/test/tint/bug/tint/980.wgsl.expected.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -void set_float3(inout float3 vec, int idx, float val) { - vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; -} - -float3 Bad(uint index, float3 rd) { - float3 normal = float3((0.0f).xxx); - set_float3(normal, index, -(sign(rd[index]))); - return normalize(normal); -} - -RWByteAddressBuffer io : register(u0, space0); - -struct tint_symbol_1 { - uint idx : SV_GroupIndex; -}; - -void main_inner(uint idx) { - const float3 tint_symbol_2 = Bad(io.Load(12u), asfloat(io.Load3(0u))); - io.Store3(0u, asuint(tint_symbol_2)); -} - -[numthreads(1, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.idx); - return; -} diff --git a/test/tint/bug/tint/980.wgsl.expected.spvasm b/test/tint/bug/tint/980.wgsl.expected.spvasm index b3534571fd..8eb0c28adf 100644 --- a/test/tint/bug/tint/980.wgsl.expected.spvasm +++ b/test/tint/bug/tint/980.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 47 +; Bound: 45 ; Schema: 0 OpCapability Shader - %23 = OpExtInstImport "GLSL.std.450" + %21 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %idx_1 OpExecutionMode %main LocalSize 1 1 1 @@ -35,48 +35,46 @@ %_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %io = OpVariable %_ptr_StorageBuffer_S StorageBuffer %9 = OpTypeFunction %v3float %uint %v3float - %float_0 = OpConstant %float 0 - %15 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %14 = OpConstantNull %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float - %18 = OpConstantNull %v3float %_ptr_Function_float = OpTypePointer Function %float %void = OpTypeVoid - %27 = OpTypeFunction %void %uint + %25 = OpTypeFunction %void %uint %uint_1 = OpConstant %uint 1 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float - %42 = OpTypeFunction %void + %40 = OpTypeFunction %void %Bad = OpFunction %v3float None %9 %index = OpFunctionParameter %uint %rd = OpFunctionParameter %v3float %13 = OpLabel - %normal = OpVariable %_ptr_Function_v3float Function %18 - OpStore %normal %15 - %20 = OpAccessChain %_ptr_Function_float %normal %index - %24 = OpVectorExtractDynamic %float %rd %index - %22 = OpExtInst %float %23 FSign %24 - %21 = OpFNegate %float %22 - OpStore %20 %21 - %26 = OpLoad %v3float %normal - %25 = OpExtInst %v3float %23 Normalize %26 - OpReturnValue %25 + %normal = OpVariable %_ptr_Function_v3float Function %14 + OpStore %normal %14 + %18 = OpAccessChain %_ptr_Function_float %normal %index + %22 = OpVectorExtractDynamic %float %rd %index + %20 = OpExtInst %float %21 FSign %22 + %19 = OpFNegate %float %20 + OpStore %18 %19 + %24 = OpLoad %v3float %normal + %23 = OpExtInst %v3float %21 Normalize %24 + OpReturnValue %23 OpFunctionEnd - %main_inner = OpFunction %void None %27 + %main_inner = OpFunction %void None %25 %idx = OpFunctionParameter %uint - %31 = OpLabel - %35 = OpAccessChain %_ptr_StorageBuffer_uint %io %uint_1 - %36 = OpLoad %uint %35 + %29 = OpLabel + %33 = OpAccessChain %_ptr_StorageBuffer_uint %io %uint_1 + %34 = OpLoad %uint %33 + %37 = OpAccessChain %_ptr_StorageBuffer_v3float %io %uint_0 + %38 = OpLoad %v3float %37 + %30 = OpFunctionCall %v3float %Bad %34 %38 %39 = OpAccessChain %_ptr_StorageBuffer_v3float %io %uint_0 - %40 = OpLoad %v3float %39 - %32 = OpFunctionCall %v3float %Bad %36 %40 - %41 = OpAccessChain %_ptr_StorageBuffer_v3float %io %uint_0 - OpStore %41 %32 + OpStore %39 %30 OpReturn OpFunctionEnd - %main = OpFunction %void None %42 - %44 = OpLabel - %46 = OpLoad %uint %idx_1 - %45 = OpFunctionCall %void %main_inner %46 + %main = OpFunction %void None %40 + %42 = OpLabel + %44 = OpLoad %uint %idx_1 + %43 = OpFunctionCall %void %main_inner %44 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/980.wgsl.expected.wgsl b/test/tint/bug/tint/980.wgsl.expected.wgsl index 076e4503ab..f7c24e9e5e 100644 --- a/test/tint/bug/tint/980.wgsl.expected.wgsl +++ b/test/tint/bug/tint/980.wgsl.expected.wgsl @@ -11,7 +11,7 @@ struct S { @binding(0) @group(0) var io : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(local_invocation_index) idx : u32) { io.v = Bad(io.i, io.v); } diff --git a/test/tint/bug/tint/990.wgsl.expected.hlsl b/test/tint/bug/tint/990.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/990.wgsl.expected.hlsl rename to test/tint/bug/tint/990.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/990.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/990.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43e268e7ba --- /dev/null +++ b/test/tint/bug/tint/990.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int i = 0; + { + [loop] for(; false; ) { + } + } +} diff --git a/test/tint/bug/tint/990.wgsl.expected.spvasm b/test/tint/bug/tint/990.wgsl.expected.spvasm index 90b0f54117..bea62e1879 100644 --- a/test/tint/bug/tint/990.wgsl.expected.spvasm +++ b/test/tint/bug/tint/990.wgsl.expected.spvasm @@ -16,7 +16,7 @@ %_ptr_Function_int = OpTypePointer Function %int %10 = OpConstantNull %int %bool = OpTypeBool - %false = OpConstantFalse %bool + %17 = OpConstantNull %bool %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn @@ -29,7 +29,7 @@ OpLoopMerge %12 %13 None OpBranch %14 %14 = OpLabel - %15 = OpLogicalNot %bool %false + %15 = OpLogicalNot %bool %17 OpSelectionMerge %18 None OpBranchConditional %15 %19 %18 %19 = OpLabel diff --git a/test/tint/bug/tint/992.wgsl b/test/tint/bug/tint/992.wgsl index 461e17ceae..0e315bf976 100644 --- a/test/tint/bug/tint/992.wgsl +++ b/test/tint/bug/tint/992.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn frag_main() -> @location(0) vec4 { var b: f32 = 0.0; var v: vec3 = vec3(b); diff --git a/test/tint/bug/tint/992.wgsl.expected.hlsl b/test/tint/bug/tint/992.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/992.wgsl.expected.hlsl rename to test/tint/bug/tint/992.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/992.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/992.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7aace922e0 --- /dev/null +++ b/test/tint/bug/tint/992.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 frag_main_inner() { + float b = 0.0f; + float3 v = float3((b).xxx); + return float4(v, 1.0f); +} + +tint_symbol frag_main() { + const float4 inner_result = frag_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/bug/tint/992.wgsl.expected.spvasm b/test/tint/bug/tint/992.wgsl.expected.spvasm index e077344ddb..721b89d7e0 100644 --- a/test/tint/bug/tint/992.wgsl.expected.spvasm +++ b/test/tint/bug/tint/992.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -19,33 +19,32 @@ %5 = OpConstantNull %v4float %value = OpVariable %_ptr_Output_v4float Output %5 %6 = OpTypeFunction %v4float - %float_0 = OpConstant %float 0 + %9 = OpConstantNull %float %_ptr_Function_float = OpTypePointer Function %float - %12 = OpConstantNull %float %v3float = OpTypeVector %float 3 %_ptr_Function_v3float = OpTypePointer Function %v3float - %18 = OpConstantNull %v3float + %17 = OpConstantNull %v3float %float_1 = OpConstant %float 1 %void = OpTypeVoid - %25 = OpTypeFunction %void + %24 = OpTypeFunction %void %frag_main_inner = OpFunction %v4float None %6 %8 = OpLabel - %b = OpVariable %_ptr_Function_float Function %12 - %v = OpVariable %_ptr_Function_v3float Function %18 - OpStore %b %float_0 - %14 = OpLoad %float %b - %15 = OpCompositeConstruct %v3float %14 %14 %14 - OpStore %v %15 - %19 = OpLoad %v3float %v - %20 = OpCompositeExtract %float %19 0 - %21 = OpCompositeExtract %float %19 1 - %22 = OpCompositeExtract %float %19 2 - %24 = OpCompositeConstruct %v4float %20 %21 %22 %float_1 - OpReturnValue %24 + %b = OpVariable %_ptr_Function_float Function %9 + %v = OpVariable %_ptr_Function_v3float Function %17 + OpStore %b %9 + %13 = OpLoad %float %b + %14 = OpCompositeConstruct %v3float %13 %13 %13 + OpStore %v %14 + %18 = OpLoad %v3float %v + %19 = OpCompositeExtract %float %18 0 + %20 = OpCompositeExtract %float %18 1 + %21 = OpCompositeExtract %float %18 2 + %23 = OpCompositeConstruct %v4float %19 %20 %21 %float_1 + OpReturnValue %23 OpFunctionEnd - %frag_main = OpFunction %void None %25 - %28 = OpLabel - %29 = OpFunctionCall %v4float %frag_main_inner - OpStore %value %29 + %frag_main = OpFunction %void None %24 + %27 = OpLabel + %28 = OpFunctionCall %v4float %frag_main_inner + OpStore %value %28 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/992.wgsl.expected.wgsl b/test/tint/bug/tint/992.wgsl.expected.wgsl index 1742838145..60a20228d9 100644 --- a/test/tint/bug/tint/992.wgsl.expected.wgsl +++ b/test/tint/bug/tint/992.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn frag_main() -> @location(0) vec4 { var b : f32 = 0.0; var v : vec3 = vec3(b); diff --git a/test/tint/bug/tint/993.wgsl b/test/tint/bug/tint/993.wgsl index 35f4599e32..345c3cce82 100644 --- a/test/tint/bug/tint/993.wgsl +++ b/test/tint/bug/tint/993.wgsl @@ -7,7 +7,7 @@ struct Result { value: u32, }; -@group(1) @binding(1) var result: Result; +@group(1) @binding(1) var result: Result; struct TestData { data: array,3>, @@ -18,7 +18,7 @@ fn runTest() -> i32 { return atomicLoad(&s.data[(0u) + u32(constants.zero)]); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { result.value = u32(runTest()); } diff --git a/test/tint/bug/tint/993.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/993.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6ec8aed1a5 --- /dev/null +++ b/test/tint/bug/tint/993.wgsl.expected.dxc.hlsl @@ -0,0 +1,26 @@ +cbuffer cbuffer_constants : register(b0, space1) { + uint4 constants[1]; +}; + +RWByteAddressBuffer result : register(u1, space1); + +RWByteAddressBuffer s : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +int runTest() { + return tint_atomicLoad(s, (4u * (0u + uint(constants[0].x)))); +} + +[numthreads(1, 1, 1)] +void main() { + const int tint_symbol = runTest(); + const uint tint_symbol_1 = uint(tint_symbol); + result.Store(0u, asuint(tint_symbol_1)); + return; +} diff --git a/test/tint/bug/tint/993.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/993.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ec8aed1a5 --- /dev/null +++ b/test/tint/bug/tint/993.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +cbuffer cbuffer_constants : register(b0, space1) { + uint4 constants[1]; +}; + +RWByteAddressBuffer result : register(u1, space1); + +RWByteAddressBuffer s : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +int runTest() { + return tint_atomicLoad(s, (4u * (0u + uint(constants[0].x)))); +} + +[numthreads(1, 1, 1)] +void main() { + const int tint_symbol = runTest(); + const uint tint_symbol_1 = uint(tint_symbol); + result.Store(0u, asuint(tint_symbol_1)); + return; +} diff --git a/test/tint/bug/tint/993.wgsl.expected.hlsl b/test/tint/bug/tint/993.wgsl.expected.hlsl deleted file mode 100644 index d1c5d71291..0000000000 --- a/test/tint/bug/tint/993.wgsl.expected.hlsl +++ /dev/null @@ -1,25 +0,0 @@ -int atomicLoad_1(RWByteAddressBuffer buffer, uint offset) { - int value = 0; - buffer.InterlockedOr(offset, 0, value); - return value; -} - -cbuffer cbuffer_constants : register(b0, space1) { - uint4 constants[1]; -}; - -RWByteAddressBuffer result : register(u1, space1); - -RWByteAddressBuffer s : register(u0, space0); - -int runTest() { - return atomicLoad_1(s, (4u * (0u + uint(constants[0].x)))); -} - -[numthreads(1, 1, 1)] -void main() { - const int tint_symbol = runTest(); - const uint tint_symbol_1 = uint(tint_symbol); - result.Store(0u, asuint(tint_symbol_1)); - return; -} diff --git a/test/tint/bug/tint/993.wgsl.expected.msl b/test/tint/bug/tint/993.wgsl.expected.msl index 98f5117b50..7b82d9534f 100644 --- a/test/tint/bug/tint/993.wgsl.expected.msl +++ b/test/tint/bug/tint/993.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Constants { /* 0x0000 */ uint zero; }; @@ -9,16 +22,12 @@ struct Result { /* 0x0000 */ uint value; }; -struct tint_array_wrapper { - /* 0x0000 */ atomic_int arr[3]; -}; - struct TestData { - /* 0x0000 */ tint_array_wrapper data; + /* 0x0000 */ tint_array data; }; int runTest(device TestData* const tint_symbol_3, const constant Constants* const tint_symbol_4) { - return atomic_load_explicit(&((*(tint_symbol_3)).data.arr[(0u + uint((*(tint_symbol_4)).zero))]), memory_order_relaxed); + return atomic_load_explicit(&((*(tint_symbol_3)).data[(0u + uint((*(tint_symbol_4)).zero))]), memory_order_relaxed); } kernel void tint_symbol(device TestData* tint_symbol_5 [[buffer(2)]], const constant Constants* tint_symbol_6 [[buffer(0)]], device Result* tint_symbol_7 [[buffer(1)]]) { diff --git a/test/tint/bug/tint/993.wgsl.expected.spvasm b/test/tint/bug/tint/993.wgsl.expected.spvasm index 25bf0b536b..9abd51a6db 100644 --- a/test/tint/bug/tint/993.wgsl.expected.spvasm +++ b/test/tint/bug/tint/993.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 37 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -25,7 +25,6 @@ OpDecorate %constants Binding 0 OpDecorate %Result Block OpMemberDecorate %Result 0 Offset 0 - OpDecorate %result NonReadable OpDecorate %result DescriptorSet 1 OpDecorate %result Binding 1 OpDecorate %TestData Block @@ -49,25 +48,26 @@ %14 = OpTypeFunction %int %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 + %21 = OpConstantNull %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %void = OpTypeVoid - %28 = OpTypeFunction %void + %29 = OpTypeFunction %void %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %runTest = OpFunction %int None %14 %16 = OpLabel - %23 = OpAccessChain %_ptr_Uniform_uint %constants %uint_0 - %24 = OpLoad %uint %23 - %25 = OpIAdd %uint %uint_0 %24 - %27 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %25 - %17 = OpAtomicLoad %int %27 %uint_1 %uint_0 + %24 = OpAccessChain %_ptr_Uniform_uint %constants %uint_0 + %25 = OpLoad %uint %24 + %26 = OpIAdd %uint %21 %25 + %28 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %26 + %17 = OpAtomicLoad %int %28 %uint_1 %uint_0 OpReturnValue %17 OpFunctionEnd - %main = OpFunction %void None %28 - %31 = OpLabel - %32 = OpFunctionCall %int %runTest - %33 = OpBitcast %uint %32 - %35 = OpAccessChain %_ptr_StorageBuffer_uint %result %uint_0 - OpStore %35 %33 + %main = OpFunction %void None %29 + %32 = OpLabel + %33 = OpFunctionCall %int %runTest + %34 = OpBitcast %uint %33 + %36 = OpAccessChain %_ptr_StorageBuffer_uint %result %uint_0 + OpStore %36 %34 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/993.wgsl.expected.wgsl b/test/tint/bug/tint/993.wgsl.expected.wgsl index 32aefc6403..ef33e7ccc6 100644 --- a/test/tint/bug/tint/993.wgsl.expected.wgsl +++ b/test/tint/bug/tint/993.wgsl.expected.wgsl @@ -8,7 +8,7 @@ struct Result { value : u32, } -@group(1) @binding(1) var result : Result; +@group(1) @binding(1) var result : Result; struct TestData { data : array, 3>, @@ -20,7 +20,7 @@ fn runTest() -> i32 { return atomicLoad(&(s.data[(0u + u32(constants.zero))])); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { result.value = u32(runTest()); } diff --git a/test/tint/bug/tint/998.wgsl b/test/tint/bug/tint/998.wgsl index cb85ddefb9..139e461882 100644 --- a/test/tint/bug/tint/998.wgsl +++ b/test/tint/bug/tint/998.wgsl @@ -6,14 +6,14 @@ struct Result { value: u32, }; -@group(1) @binding(1) var result: Result; +@group(1) @binding(1) var result: Result; struct S { data: array, }; var s: S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { s.data[constants.zero] = 0u; } diff --git a/test/tint/bug/tint/998.wgsl.expected.hlsl b/test/tint/bug/tint/998.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/bug/tint/998.wgsl.expected.hlsl rename to test/tint/bug/tint/998.wgsl.expected.dxc.hlsl diff --git a/test/tint/bug/tint/998.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/998.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a197d251a0 --- /dev/null +++ b/test/tint/bug/tint/998.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +cbuffer cbuffer_constants : register(b0, space1) { + uint4 constants[1]; +}; + +RWByteAddressBuffer result : register(u1, space1); + +struct S { + uint data[3]; +}; + +static S s = (S)0; + +[numthreads(1, 1, 1)] +void main() { + { + uint tint_symbol_1[3] = s.data; + tint_symbol_1[constants[0].x] = 0u; + s.data = tint_symbol_1; + } + return; +} diff --git a/test/tint/bug/tint/998.wgsl.expected.msl b/test/tint/bug/tint/998.wgsl.expected.msl index 740838e1c7..c9dd773dad 100644 --- a/test/tint/bug/tint/998.wgsl.expected.msl +++ b/test/tint/bug/tint/998.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Constants { /* 0x0000 */ uint zero; }; @@ -9,17 +22,13 @@ struct Result { uint value; }; -struct tint_array_wrapper { - uint arr[3]; -}; - struct S { - tint_array_wrapper data; + tint_array data; }; kernel void tint_symbol(const constant Constants* tint_symbol_2 [[buffer(0)]]) { thread S tint_symbol_1 = {}; - tint_symbol_1.data.arr[(*(tint_symbol_2)).zero] = 0u; + tint_symbol_1.data[(*(tint_symbol_2)).zero] = 0u; return; } diff --git a/test/tint/bug/tint/998.wgsl.expected.spvasm b/test/tint/bug/tint/998.wgsl.expected.spvasm index 36525c0b69..82231fbc02 100644 --- a/test/tint/bug/tint/998.wgsl.expected.spvasm +++ b/test/tint/bug/tint/998.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -24,7 +24,6 @@ OpDecorate %constants Binding 0 OpDecorate %Result Block OpMemberDecorate %Result 0 Offset 0 - OpDecorate %result NonReadable OpDecorate %result DescriptorSet 1 OpDecorate %result Binding 1 OpMemberDecorate %S 0 Offset 0 @@ -47,11 +46,12 @@ %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Private_uint = OpTypePointer Private %uint + %24 = OpConstantNull %uint %main = OpFunction %void None %14 %17 = OpLabel %20 = OpAccessChain %_ptr_Uniform_uint %constants %uint_0 %21 = OpLoad %uint %20 %23 = OpAccessChain %_ptr_Private_uint %s %uint_0 %21 - OpStore %23 %uint_0 + OpStore %23 %24 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/998.wgsl.expected.wgsl b/test/tint/bug/tint/998.wgsl.expected.wgsl index 1068851cbb..e05a05cdf4 100644 --- a/test/tint/bug/tint/998.wgsl.expected.wgsl +++ b/test/tint/bug/tint/998.wgsl.expected.wgsl @@ -8,7 +8,7 @@ struct Result { value : u32, } -@group(1) @binding(1) var result : Result; +@group(1) @binding(1) var result : Result; struct S { data : array, @@ -16,7 +16,7 @@ struct S { var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { s.data[constants.zero] = 0u; } diff --git a/test/tint/builtins/arrayLength/complex_via_let.wgsl b/test/tint/builtins/arrayLength/complex_via_let.wgsl index 29c07c9021..85836f04ba 100644 --- a/test/tint/builtins/arrayLength/complex_via_let.wgsl +++ b/test/tint/builtins/arrayLength/complex_via_let.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &G; let p2 = &((*p).a); diff --git a/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.hlsl b/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.hlsl rename to test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/arrayLength/simple.wgsl.expected.hlsl b/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/builtins/arrayLength/simple.wgsl.expected.hlsl rename to test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.fxc.hlsl diff --git a/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.msl b/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.msl index 537a45373b..f92477aa81 100644 --- a/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.msl +++ b/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; struct S { - int a[1]; + tint_array a; }; kernel void tint_symbol(const constant tint_symbol_1* tint_symbol_3 [[buffer(30)]]) { diff --git a/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.wgsl b/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.wgsl index a35b6e4706..6fed13cdbc 100644 --- a/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.wgsl +++ b/test/tint/builtins/arrayLength/complex_via_let.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &(G); let p2 = &((*(p)).a); diff --git a/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl b/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl index 8626deeb04..231dbd25e6 100644 --- a/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl +++ b/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var G : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &G; let p2 = &(*p); diff --git a/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.hlsl b/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.hlsl rename to test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.hlsl b/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.hlsl rename to test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.fxc.hlsl diff --git a/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.msl b/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.msl index 0ab65d100a..3fb52959f5 100644 --- a/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.msl +++ b/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.msl @@ -1,8 +1,21 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; kernel void tint_symbol(const constant tint_symbol_1* tint_symbol_3 [[buffer(30)]]) { diff --git a/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.wgsl b/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.wgsl index 2d06902eb1..2cce05d9c1 100644 --- a/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.wgsl +++ b/test/tint/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var G : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &(G); let p2 = &(*(p)); diff --git a/test/tint/builtins/arrayLength/deprecated.wgsl b/test/tint/builtins/arrayLength/deprecated.wgsl index 0af15ea52e..2de8025615 100644 --- a/test/tint/builtins/arrayLength/deprecated.wgsl +++ b/test/tint/builtins/arrayLength/deprecated.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let l1 : u32 = arrayLength(&G.a); diff --git a/test/tint/builtins/arrayLength/deprecated.wgsl.expected.hlsl b/test/tint/builtins/arrayLength/deprecated.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/arrayLength/deprecated.wgsl.expected.hlsl rename to test/tint/builtins/arrayLength/deprecated.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/arrayLength/deprecated.wgsl.expected.fxc.hlsl b/test/tint/builtins/arrayLength/deprecated.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1a3d5f3c7 --- /dev/null +++ b/test/tint/builtins/arrayLength/deprecated.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +ByteAddressBuffer G : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + G.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u); + const uint l1 = tint_symbol_2; + const uint l2 = tint_symbol_2; + return; +} diff --git a/test/tint/builtins/arrayLength/deprecated.wgsl.expected.msl b/test/tint/builtins/arrayLength/deprecated.wgsl.expected.msl index bf8e5b0422..bc4e7caef1 100644 --- a/test/tint/builtins/arrayLength/deprecated.wgsl.expected.msl +++ b/test/tint/builtins/arrayLength/deprecated.wgsl.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; struct S { - int a[1]; + tint_array a; }; kernel void tint_symbol(const constant tint_symbol_1* tint_symbol_3 [[buffer(30)]]) { diff --git a/test/tint/builtins/arrayLength/deprecated.wgsl.expected.wgsl b/test/tint/builtins/arrayLength/deprecated.wgsl.expected.wgsl index 7d96296e53..fb4b550ede 100644 --- a/test/tint/builtins/arrayLength/deprecated.wgsl.expected.wgsl +++ b/test/tint/builtins/arrayLength/deprecated.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let l1 : u32 = arrayLength(&(G.a)); let p = &(G.a); diff --git a/test/tint/builtins/arrayLength/simple.wgsl b/test/tint/builtins/arrayLength/simple.wgsl index 74ff5cc597..23e917646e 100644 --- a/test/tint/builtins/arrayLength/simple.wgsl +++ b/test/tint/builtins/arrayLength/simple.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let l1 : u32 = arrayLength(&G.a); } diff --git a/test/tint/builtins/arrayLength/via_let.wgsl.expected.hlsl b/test/tint/builtins/arrayLength/simple.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/arrayLength/via_let.wgsl.expected.hlsl rename to test/tint/builtins/arrayLength/simple.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.hlsl b/test/tint/builtins/arrayLength/simple.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.hlsl rename to test/tint/builtins/arrayLength/simple.wgsl.expected.fxc.hlsl diff --git a/test/tint/builtins/arrayLength/simple.wgsl.expected.msl b/test/tint/builtins/arrayLength/simple.wgsl.expected.msl index 537a45373b..f92477aa81 100644 --- a/test/tint/builtins/arrayLength/simple.wgsl.expected.msl +++ b/test/tint/builtins/arrayLength/simple.wgsl.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; struct S { - int a[1]; + tint_array a; }; kernel void tint_symbol(const constant tint_symbol_1* tint_symbol_3 [[buffer(30)]]) { diff --git a/test/tint/builtins/arrayLength/simple.wgsl.expected.wgsl b/test/tint/builtins/arrayLength/simple.wgsl.expected.wgsl index f1db44b0ee..6641075001 100644 --- a/test/tint/builtins/arrayLength/simple.wgsl.expected.wgsl +++ b/test/tint/builtins/arrayLength/simple.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let l1 : u32 = arrayLength(&(G.a)); } diff --git a/test/tint/builtins/arrayLength/simple_no_struct.wgsl b/test/tint/builtins/arrayLength/simple_no_struct.wgsl index 985c87e1be..5f24327531 100644 --- a/test/tint/builtins/arrayLength/simple_no_struct.wgsl +++ b/test/tint/builtins/arrayLength/simple_no_struct.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var G : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let l1 : u32 = arrayLength(&G); } diff --git a/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.hlsl b/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.hlsl rename to test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.hlsl b/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.hlsl rename to test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.fxc.hlsl diff --git a/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.msl b/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.msl index 0ab65d100a..3fb52959f5 100644 --- a/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.msl +++ b/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.msl @@ -1,8 +1,21 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; kernel void tint_symbol(const constant tint_symbol_1* tint_symbol_3 [[buffer(30)]]) { diff --git a/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.wgsl b/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.wgsl index b45cd361c6..463136ce1d 100644 --- a/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.wgsl +++ b/test/tint/builtins/arrayLength/simple_no_struct.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var G : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let l1 : u32 = arrayLength(&(G)); } diff --git a/test/tint/builtins/arrayLength/via_let.wgsl b/test/tint/builtins/arrayLength/via_let.wgsl index e3dff0baad..11b3200432 100644 --- a/test/tint/builtins/arrayLength/via_let.wgsl +++ b/test/tint/builtins/arrayLength/via_let.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &G.a; let p2 = p; diff --git a/test/tint/builtins/arrayLength/via_let.wgsl.expected.dxc.hlsl b/test/tint/builtins/arrayLength/via_let.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9e16082831 --- /dev/null +++ b/test/tint/builtins/arrayLength/via_let.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +ByteAddressBuffer G : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + G.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u); + const uint l1 = tint_symbol_2; + return; +} diff --git a/test/tint/builtins/arrayLength/via_let.wgsl.expected.fxc.hlsl b/test/tint/builtins/arrayLength/via_let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9e16082831 --- /dev/null +++ b/test/tint/builtins/arrayLength/via_let.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +ByteAddressBuffer G : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + G.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u); + const uint l1 = tint_symbol_2; + return; +} diff --git a/test/tint/builtins/arrayLength/via_let.wgsl.expected.msl b/test/tint/builtins/arrayLength/via_let.wgsl.expected.msl index 537a45373b..f92477aa81 100644 --- a/test/tint/builtins/arrayLength/via_let.wgsl.expected.msl +++ b/test/tint/builtins/arrayLength/via_let.wgsl.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; struct S { - int a[1]; + tint_array a; }; kernel void tint_symbol(const constant tint_symbol_1* tint_symbol_3 [[buffer(30)]]) { diff --git a/test/tint/builtins/arrayLength/via_let.wgsl.expected.wgsl b/test/tint/builtins/arrayLength/via_let.wgsl.expected.wgsl index 7a7ffbd510..b2f9d9d4a7 100644 --- a/test/tint/builtins/arrayLength/via_let.wgsl.expected.wgsl +++ b/test/tint/builtins/arrayLength/via_let.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &(G.a); let p2 = p; diff --git a/test/tint/builtins/arrayLength/via_let_complex.wgsl b/test/tint/builtins/arrayLength/via_let_complex.wgsl index a30a39d450..6704983ac8 100644 --- a/test/tint/builtins/arrayLength/via_let_complex.wgsl +++ b/test/tint/builtins/arrayLength/via_let_complex.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &*&G; let p2 = &*p; diff --git a/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.dxc.hlsl b/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9e16082831 --- /dev/null +++ b/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +ByteAddressBuffer G : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + G.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u); + const uint l1 = tint_symbol_2; + return; +} diff --git a/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.fxc.hlsl b/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9e16082831 --- /dev/null +++ b/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +ByteAddressBuffer G : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + G.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u); + const uint l1 = tint_symbol_2; + return; +} diff --git a/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.msl b/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.msl index 537a45373b..f92477aa81 100644 --- a/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.msl +++ b/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; struct S { - int a[1]; + tint_array a; }; kernel void tint_symbol(const constant tint_symbol_1* tint_symbol_3 [[buffer(30)]]) { diff --git a/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.wgsl b/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.wgsl index 2db8863954..b229c01cfd 100644 --- a/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.wgsl +++ b/test/tint/builtins/arrayLength/via_let_complex.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @group(0) @binding(0) var G : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &(*(&(G))); let p2 = &(*(p)); diff --git a/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl index dd8beb64e7..e199d23a90 100644 --- a/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl +++ b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var G : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &*&G; let p2 = &*p; diff --git a/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.dxc.hlsl b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d5cdca5b40 --- /dev/null +++ b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +ByteAddressBuffer G : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + G.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = (tint_symbol_1 / 4u); + const uint l1 = tint_symbol_2; + return; +} diff --git a/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.fxc.hlsl b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5cdca5b40 --- /dev/null +++ b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +ByteAddressBuffer G : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + G.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = (tint_symbol_1 / 4u); + const uint l1 = tint_symbol_2; + return; +} diff --git a/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.msl b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.msl index 0ab65d100a..3fb52959f5 100644 --- a/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.msl +++ b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.msl @@ -1,8 +1,21 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; kernel void tint_symbol(const constant tint_symbol_1* tint_symbol_3 [[buffer(30)]]) { diff --git a/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.wgsl b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.wgsl index a92b9beb26..cb644677cd 100644 --- a/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.wgsl +++ b/test/tint/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var G : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &(*(&(G))); let p2 = &(*(p)); diff --git a/test/tint/builtins/arrayLength/via_let_no_struct.wgsl b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl index 203f0e0666..066c19f5a5 100644 --- a/test/tint/builtins/arrayLength/via_let_no_struct.wgsl +++ b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var G : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &G; let p2 = p; diff --git a/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.dxc.hlsl b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d5cdca5b40 --- /dev/null +++ b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +ByteAddressBuffer G : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + G.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = (tint_symbol_1 / 4u); + const uint l1 = tint_symbol_2; + return; +} diff --git a/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.fxc.hlsl b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5cdca5b40 --- /dev/null +++ b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +ByteAddressBuffer G : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + uint tint_symbol_1 = 0u; + G.GetDimensions(tint_symbol_1); + const uint tint_symbol_2 = (tint_symbol_1 / 4u); + const uint l1 = tint_symbol_2; + return; +} diff --git a/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.msl b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.msl index 0ab65d100a..3fb52959f5 100644 --- a/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.msl +++ b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.msl @@ -1,8 +1,21 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; + /* 0x0000 */ tint_array buffer_size; }; kernel void tint_symbol(const constant tint_symbol_1* tint_symbol_3 [[buffer(30)]]) { diff --git a/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.wgsl b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.wgsl index 3e0760312f..fea405805b 100644 --- a/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.wgsl +++ b/test/tint/builtins/arrayLength/via_let_no_struct.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var G : array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p = &(G); let p2 = p; diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm new file mode 100644 index 0000000000..0dbd964435 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_1 ArrayStride 4 + OpDecorate %_arr__arr_uint_uint_1_uint_2 ArrayStride 4 + OpDecorate %_arr__arr__arr_uint_uint_1_uint_2_uint_3 ArrayStride 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %uint_2 = OpConstant %uint 2 +%_arr__arr_uint_uint_1_uint_2 = OpTypeArray %_arr_uint_uint_1 %uint_2 + %uint_3 = OpConstant %uint 3 +%_arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypeArray %_arr__arr_uint_uint_1_uint_2 %uint_3 +%_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypePointer Workgroup %_arr__arr__arr_uint_uint_1_uint_2_uint_3 + %wg = OpVariable %_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 Workgroup + %void = OpTypeVoid + %12 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %19 = OpConstantNull %uint + %uint_6 = OpConstant %uint 6 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %51 = OpConstantNull %int + %53 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %12 +%local_invocation_index = OpFunctionParameter %uint + %16 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %19 + OpStore %idx %local_invocation_index + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %25 = OpLoad %uint %idx + %27 = OpULessThan %bool %25 %uint_6 + %24 = OpLogicalNot %bool %27 + OpSelectionMerge %29 None + OpBranchConditional %24 %30 %29 + %30 = OpLabel + OpBranch %21 + %29 = OpLabel + %31 = OpLoad %uint %idx + %32 = OpUDiv %uint %31 %uint_2 + %33 = OpLoad %uint %idx + %34 = OpUMod %uint %33 %uint_2 + %35 = OpLoad %uint %idx + %36 = OpUMod %uint %35 %uint_1 + %41 = OpAccessChain %_ptr_Workgroup_uint %wg %32 %34 %36 + OpAtomicStore %41 %uint_2 %uint_0 %19 + OpBranch %22 + %22 = OpLabel + %42 = OpLoad %uint %idx + %43 = OpIAdd %uint %42 %uint_1 + OpStore %idx %43 + OpBranch %20 + %21 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %52 = OpAccessChain %_ptr_Workgroup_uint %wg %int_2 %int_1 %51 + OpAtomicStore %52 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %53 + %55 = OpLabel + %57 = OpLoad %uint %local_invocation_index_1 + %56 = OpFunctionCall %void %compute_main_inner %57 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..16f5d2e59f --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.dxc.hlsl @@ -0,0 +1,47 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint wg[3][2][1]; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 6u))); idx = (idx + 1u)) { + uint atomic_result = 0u; + InterlockedExchange(wg[(idx / 2u)][(idx % 2u)][(idx % 1u)], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[2][1][0], 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { + const uint i = (idx_1 / 2u); + const uint i_1 = (idx_1 % 2u); + const uint i_2 = (idx_1 % 1u); + uint atomic_result_2 = 0u; + InterlockedExchange(wg[i][i_1][i_2], 0u, atomic_result_2); + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..16f5d2e59f --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.fxc.hlsl @@ -0,0 +1,47 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint wg[3][2][1]; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 6u))); idx = (idx + 1u)) { + uint atomic_result = 0u; + InterlockedExchange(wg[(idx / 2u)][(idx % 2u)][(idx % 1u)], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[2][1][0], 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { + const uint i = (idx_1 / 2u); + const uint i_1 = (idx_1 % 2u); + const uint i_2 = (idx_1 % 1u); + uint atomic_result_2 = 0u; + InterlockedExchange(wg[i][i_1][i_2], 0u, atomic_result_2); + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl new file mode 100644 index 0000000000..4cdd505b1a --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl @@ -0,0 +1,41 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint wg[3][2][1]; +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + for(; !(!((idx < 6u))); idx = (idx + 1u)) { + atomicExchange(wg[(idx / 2u)][(idx % 2u)][(idx % 1u)], 0u); + } + } + barrier(); + atomicExchange(wg[2][1][0], 1u); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { + uint i = (idx_1 / 2u); + uint i_1 = (idx_1 % 2u); + uint i_2 = (idx_1 % 1u); + atomicExchange(wg[i][i_1][i_2], 0u); + } + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.msl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.msl new file mode 100644 index 0000000000..943a64cf5c --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup tint_array, 2>, 3>* const tint_symbol) { + uint idx = 0u; + idx = local_invocation_index; + while (true) { + uint const x_25 = idx; + if (!((x_25 < 6u))) { + break; + } + uint const x_31 = idx; + uint const x_33 = idx; + uint const x_35 = idx; + atomic_store_explicit(&((*(tint_symbol))[(x_31 / 2u)][(x_33 % 2u)][(x_35 % 1u)]), 0u, memory_order_relaxed); + { + uint const x_42 = idx; + idx = (x_42 + 1u); + } + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol))[2][1][0]), 1u, memory_order_relaxed); + return; +} + +void compute_main_1(thread uint* const tint_symbol_1, threadgroup tint_array, 2>, 3>* const tint_symbol_2) { + uint const x_57 = *(tint_symbol_1); + compute_main_inner(x_57, tint_symbol_2); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup tint_array, 2>, 3>* const tint_symbol_3, thread uint* const tint_symbol_4) { + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { + uint const i = (idx_1 / 2u); + uint const i_1 = (idx_1 % 2u); + uint const i_2 = (idx_1 % 1u); + atomic_store_explicit(&((*(tint_symbol_3))[i][i_1][i_2]), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup tint_array, 2>, 3> tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); + return; +} + diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.spvasm new file mode 100644 index 0000000000..8091c97689 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %idx_1 "idx_1" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_1 ArrayStride 4 + OpDecorate %_arr__arr_uint_uint_1_uint_2 ArrayStride 4 + OpDecorate %_arr__arr__arr_uint_uint_1_uint_2_uint_3 ArrayStride 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %uint_2 = OpConstant %uint 2 +%_arr__arr_uint_uint_1_uint_2 = OpTypeArray %_arr_uint_uint_1 %uint_2 + %uint_3 = OpConstant %uint 3 +%_arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypeArray %_arr__arr_uint_uint_1_uint_2 %uint_3 +%_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypePointer Workgroup %_arr__arr__arr_uint_uint_1_uint_2_uint_3 + %wg = OpVariable %_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 Workgroup + %void = OpTypeVoid + %15 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_6 = OpConstant %uint 6 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %53 = OpConstantNull %int + %55 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %15 +%local_invocation_index = OpFunctionParameter %uint + %19 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %6 + OpStore %idx %6 + OpStore %idx %local_invocation_index + OpBranch %22 + %22 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %uint %idx + %29 = OpULessThan %bool %26 %uint_6 + %27 = OpLogicalNot %bool %29 + OpSelectionMerge %31 None + OpBranchConditional %27 %32 %31 + %32 = OpLabel + OpBranch %23 + %31 = OpLabel + %33 = OpLoad %uint %idx + %34 = OpLoad %uint %idx + %35 = OpLoad %uint %idx + %39 = OpUDiv %uint %33 %uint_2 + %40 = OpUMod %uint %34 %uint_2 + %41 = OpUMod %uint %35 %uint_1 + %43 = OpAccessChain %_ptr_Workgroup_uint %wg %39 %40 %41 + OpAtomicStore %43 %uint_2 %uint_0 %6 + OpBranch %24 + %24 = OpLabel + %44 = OpLoad %uint %idx + %45 = OpIAdd %uint %44 %uint_1 + OpStore %idx %45 + OpBranch %22 + %23 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %54 = OpAccessChain %_ptr_Workgroup_uint %wg %int_2 %int_1 %53 + OpAtomicStore %54 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %55 + %57 = OpLabel + %58 = OpLoad %uint %local_invocation_index_1 + %59 = OpFunctionCall %void %compute_main_inner %58 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %15 +%local_invocation_index_1_param = OpFunctionParameter %uint + %62 = OpLabel + %idx_1 = OpVariable %_ptr_Function_uint Function %6 + OpStore %idx_1 %local_invocation_index_1_param + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %69 = OpLoad %uint %idx_1 + %70 = OpULessThan %bool %69 %uint_6 + %68 = OpLogicalNot %bool %70 + OpSelectionMerge %71 None + OpBranchConditional %68 %72 %71 + %72 = OpLabel + OpBranch %65 + %71 = OpLabel + %73 = OpLoad %uint %idx_1 + %74 = OpUDiv %uint %73 %uint_2 + %75 = OpLoad %uint %idx_1 + %76 = OpUMod %uint %75 %uint_2 + %77 = OpLoad %uint %idx_1 + %78 = OpUMod %uint %77 %uint_1 + %81 = OpAccessChain %_ptr_Workgroup_uint %wg %74 %76 %78 + OpAtomicStore %81 %uint_2 %uint_0 %6 + OpBranch %66 + %66 = OpLabel + %82 = OpLoad %uint %idx_1 + %83 = OpIAdd %uint %82 %uint_1 + OpStore %idx_1 %83 + OpBranch %64 + %65 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %85 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %55 + %87 = OpLabel + %89 = OpLoad %uint %local_invocation_index_1_param_1 + %88 = OpFunctionCall %void %compute_main_inner_1 %89 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.wgsl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.wgsl new file mode 100644 index 0000000000..2b2b74112c --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +type Arr = array; + +type Arr_1 = array; + +type Arr_2 = array; + +var local_invocation_index_1 : u32; + +var wg : array, 1u>, 2u>, 3u>; + +fn compute_main_inner(local_invocation_index : u32) { + var idx : u32 = 0u; + idx = local_invocation_index; + loop { + let x_25 : u32 = idx; + if (!((x_25 < 6u))) { + break; + } + let x_31 : u32 = idx; + let x_33 : u32 = idx; + let x_35 : u32 = idx; + atomicStore(&(wg[(x_31 / 2u)][(x_33 % 2u)][(x_35 % 1u)]), 0u); + + continuing { + let x_42 : u32 = idx; + idx = (x_42 + 1u); + } + } + workgroupBarrier(); + atomicStore(&(wg[2i][1i][0i]), 1u); + return; +} + +fn compute_main_1() { + let x_57 : u32 = local_invocation_index_1; + compute_main_inner(x_57); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl new file mode 100644 index 0000000000..0f6f01eafe --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl @@ -0,0 +1,11 @@ +type A0 = atomic; +type A1 = array; +type A2 = array; +type A3 = array; + +var wg : A3; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&wg[2][1][0], 1u); +} diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f993d5073 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.dxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint wg[3][2][1]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + const uint i = (idx / 2u); + const uint i_1 = (idx % 2u); + const uint i_2 = (idx % 1u); + uint atomic_result = 0u; + InterlockedExchange(wg[i][i_1][i_2], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[2][1][0], 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6f993d5073 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint wg[3][2][1]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + const uint i = (idx / 2u); + const uint i_1 = (idx % 2u); + const uint i_2 = (idx % 1u); + uint atomic_result = 0u; + InterlockedExchange(wg[i][i_1][i_2], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[2][1][0], 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.glsl b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.glsl new file mode 100644 index 0000000000..598fde91f4 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint wg[3][2][1]; +void compute_main(uint local_invocation_index) { + { + for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + uint i = (idx / 2u); + uint i_1 = (idx % 2u); + uint i_2 = (idx % 1u); + atomicExchange(wg[i][i_1][i_2], 0u); + } + } + barrier(); + atomicExchange(wg[2][1][0], 1u); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.msl b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.msl new file mode 100644 index 0000000000..51e5245e4c --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup tint_array, 2>, 3>* const tint_symbol) { + for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + uint const i = (idx / 2u); + uint const i_1 = (idx % 2u); + uint const i_2 = (idx % 1u); + atomic_store_explicit(&((*(tint_symbol))[i][i_1][i_2]), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol))[2][1][0]), 1u, memory_order_relaxed); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup tint_array, 2>, 3> tint_symbol_1; + compute_main_inner(local_invocation_index, &(tint_symbol_1)); + return; +} + diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.spvasm new file mode 100644 index 0000000000..0dbd964435 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_1 ArrayStride 4 + OpDecorate %_arr__arr_uint_uint_1_uint_2 ArrayStride 4 + OpDecorate %_arr__arr__arr_uint_uint_1_uint_2_uint_3 ArrayStride 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %uint_2 = OpConstant %uint 2 +%_arr__arr_uint_uint_1_uint_2 = OpTypeArray %_arr_uint_uint_1 %uint_2 + %uint_3 = OpConstant %uint 3 +%_arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypeArray %_arr__arr_uint_uint_1_uint_2 %uint_3 +%_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypePointer Workgroup %_arr__arr__arr_uint_uint_1_uint_2_uint_3 + %wg = OpVariable %_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 Workgroup + %void = OpTypeVoid + %12 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %19 = OpConstantNull %uint + %uint_6 = OpConstant %uint 6 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %51 = OpConstantNull %int + %53 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %12 +%local_invocation_index = OpFunctionParameter %uint + %16 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %19 + OpStore %idx %local_invocation_index + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %25 = OpLoad %uint %idx + %27 = OpULessThan %bool %25 %uint_6 + %24 = OpLogicalNot %bool %27 + OpSelectionMerge %29 None + OpBranchConditional %24 %30 %29 + %30 = OpLabel + OpBranch %21 + %29 = OpLabel + %31 = OpLoad %uint %idx + %32 = OpUDiv %uint %31 %uint_2 + %33 = OpLoad %uint %idx + %34 = OpUMod %uint %33 %uint_2 + %35 = OpLoad %uint %idx + %36 = OpUMod %uint %35 %uint_1 + %41 = OpAccessChain %_ptr_Workgroup_uint %wg %32 %34 %36 + OpAtomicStore %41 %uint_2 %uint_0 %19 + OpBranch %22 + %22 = OpLabel + %42 = OpLoad %uint %idx + %43 = OpIAdd %uint %42 %uint_1 + OpStore %idx %43 + OpBranch %20 + %21 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %52 = OpAccessChain %_ptr_Workgroup_uint %wg %int_2 %int_1 %51 + OpAtomicStore %52 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %53 + %55 = OpLabel + %57 = OpLoad %uint %local_invocation_index_1 + %56 = OpFunctionCall %void %compute_main_inner %57 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.wgsl b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a5ac8a00e --- /dev/null +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +type A0 = atomic; + +type A1 = array; + +type A2 = array; + +type A3 = array; + +var wg : A3; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&(wg[2][1][0]), 1u); +} diff --git a/test/tint/builtins/atomicStore/array/array.spvasm b/test/tint/builtins/atomicStore/array/array.spvasm new file mode 100644 index 0000000000..f41ddf706c --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_4 ArrayStride 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %uint_4 = OpConstant %uint 4 +%_arr_uint_uint_4 = OpTypeArray %uint %uint_4 +%_ptr_Workgroup__arr_uint_uint_4 = OpTypePointer Workgroup %_arr_uint_uint_4 + %wg = OpVariable %_ptr_Workgroup__arr_uint_uint_4 Workgroup + %void = OpTypeVoid + %8 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %15 = OpConstantNull %uint + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %43 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %8 +%local_invocation_index = OpFunctionParameter %uint + %12 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %15 + OpStore %idx %local_invocation_index + OpBranch %16 + %16 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %21 = OpLoad %uint %idx + %22 = OpULessThan %bool %21 %uint_4 + %20 = OpLogicalNot %bool %22 + OpSelectionMerge %24 None + OpBranchConditional %20 %25 %24 + %25 = OpLabel + OpBranch %17 + %24 = OpLabel + %26 = OpLoad %uint %idx + %32 = OpAccessChain %_ptr_Workgroup_uint %wg %26 + OpAtomicStore %32 %uint_2 %uint_0 %15 + OpBranch %18 + %18 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpIAdd %uint %33 %uint_1 + OpStore %idx %35 + OpBranch %16 + %17 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %42 = OpAccessChain %_ptr_Workgroup_uint %wg %int_1 + OpAtomicStore %42 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %43 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1 + %46 = OpFunctionCall %void %compute_main_inner %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/array/array.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/array/array.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..76ff7252cb --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.spvasm.expected.dxc.hlsl @@ -0,0 +1,45 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint wg[4]; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 4u))); idx = (idx + 1u)) { + uint atomic_result = 0u; + InterlockedExchange(wg[idx], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[1], 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 4u); idx_1 = (idx_1 + 1u)) { + const uint i = idx_1; + uint atomic_result_2 = 0u; + InterlockedExchange(wg[i], 0u, atomic_result_2); + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/array/array.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/array/array.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..76ff7252cb --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.spvasm.expected.fxc.hlsl @@ -0,0 +1,45 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint wg[4]; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 4u))); idx = (idx + 1u)) { + uint atomic_result = 0u; + InterlockedExchange(wg[idx], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[1], 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 4u); idx_1 = (idx_1 + 1u)) { + const uint i = idx_1; + uint atomic_result_2 = 0u; + InterlockedExchange(wg[i], 0u, atomic_result_2); + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/array/array.spvasm.expected.glsl b/test/tint/builtins/atomicStore/array/array.spvasm.expected.glsl new file mode 100644 index 0000000000..a8c2193462 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint wg[4]; +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + for(; !(!((idx < 4u))); idx = (idx + 1u)) { + atomicExchange(wg[idx], 0u); + } + } + barrier(); + atomicExchange(wg[1], 1u); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 4u); idx_1 = (idx_1 + 1u)) { + uint i = idx_1; + atomicExchange(wg[i], 0u); + } + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/array/array.spvasm.expected.msl b/test/tint/builtins/atomicStore/array/array.spvasm.expected.msl new file mode 100644 index 0000000000..8ef9d3975b --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.spvasm.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup tint_array* const tint_symbol) { + uint idx = 0u; + idx = local_invocation_index; + while (true) { + uint const x_21 = idx; + if (!((x_21 < 4u))) { + break; + } + uint const x_26 = idx; + atomic_store_explicit(&((*(tint_symbol))[x_26]), 0u, memory_order_relaxed); + { + uint const x_33 = idx; + idx = (x_33 + 1u); + } + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol))[1]), 1u, memory_order_relaxed); + return; +} + +void compute_main_1(thread uint* const tint_symbol_1, threadgroup tint_array* const tint_symbol_2) { + uint const x_47 = *(tint_symbol_1); + compute_main_inner(x_47, tint_symbol_2); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup tint_array* const tint_symbol_3, thread uint* const tint_symbol_4) { + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 4u); idx_1 = (idx_1 + 1u)) { + uint const i = idx_1; + atomic_store_explicit(&((*(tint_symbol_3))[i]), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup tint_array tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); + return; +} + diff --git a/test/tint/builtins/atomicStore/array/array.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/array/array.spvasm.expected.spvasm new file mode 100644 index 0000000000..e15c3dbc1a --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.spvasm.expected.spvasm @@ -0,0 +1,123 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %idx_1 "idx_1" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_4 ArrayStride 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %uint_4 = OpConstant %uint 4 +%_arr_uint_uint_4 = OpTypeArray %uint %uint_4 +%_ptr_Workgroup__arr_uint_uint_4 = OpTypePointer Workgroup %_arr_uint_uint_4 + %wg = OpVariable %_ptr_Workgroup__arr_uint_uint_4 Workgroup + %void = OpTypeVoid + %11 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %45 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %11 +%local_invocation_index = OpFunctionParameter %uint + %15 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %6 + OpStore %idx %6 + OpStore %idx %local_invocation_index + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %22 = OpLoad %uint %idx + %24 = OpULessThan %bool %22 %uint_4 + %23 = OpLogicalNot %bool %24 + OpSelectionMerge %26 None + OpBranchConditional %23 %27 %26 + %27 = OpLabel + OpBranch %19 + %26 = OpLabel + %28 = OpLoad %uint %idx + %34 = OpAccessChain %_ptr_Workgroup_uint %wg %28 + OpAtomicStore %34 %uint_2 %uint_0 %6 + OpBranch %20 + %20 = OpLabel + %35 = OpLoad %uint %idx + %37 = OpIAdd %uint %35 %uint_1 + OpStore %idx %37 + OpBranch %18 + %19 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %44 = OpAccessChain %_ptr_Workgroup_uint %wg %int_1 + OpAtomicStore %44 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %45 + %47 = OpLabel + %48 = OpLoad %uint %local_invocation_index_1 + %49 = OpFunctionCall %void %compute_main_inner %48 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %11 +%local_invocation_index_1_param = OpFunctionParameter %uint + %52 = OpLabel + %idx_1 = OpVariable %_ptr_Function_uint Function %6 + OpStore %idx_1 %local_invocation_index_1_param + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %59 = OpLoad %uint %idx_1 + %60 = OpULessThan %bool %59 %uint_4 + %58 = OpLogicalNot %bool %60 + OpSelectionMerge %61 None + OpBranchConditional %58 %62 %61 + %62 = OpLabel + OpBranch %55 + %61 = OpLabel + %63 = OpLoad %uint %idx_1 + %66 = OpAccessChain %_ptr_Workgroup_uint %wg %63 + OpAtomicStore %66 %uint_2 %uint_0 %6 + OpBranch %56 + %56 = OpLabel + %67 = OpLoad %uint %idx_1 + %68 = OpIAdd %uint %67 %uint_1 + OpStore %idx_1 %68 + OpBranch %54 + %55 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %70 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %45 + %72 = OpLabel + %74 = OpLoad %uint %local_invocation_index_1_param_1 + %73 = OpFunctionCall %void %compute_main_inner_1 %74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/array/array.spvasm.expected.wgsl b/test/tint/builtins/atomicStore/array/array.spvasm.expected.wgsl new file mode 100644 index 0000000000..c5971736e2 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.spvasm.expected.wgsl @@ -0,0 +1,38 @@ +type Arr = array; + +var local_invocation_index_1 : u32; + +var wg : array, 4u>; + +fn compute_main_inner(local_invocation_index : u32) { + var idx : u32 = 0u; + idx = local_invocation_index; + loop { + let x_21 : u32 = idx; + if (!((x_21 < 4u))) { + break; + } + let x_26 : u32 = idx; + atomicStore(&(wg[x_26]), 0u); + + continuing { + let x_33 : u32 = idx; + idx = (x_33 + 1u); + } + } + workgroupBarrier(); + atomicStore(&(wg[1i]), 1u); + return; +} + +fn compute_main_1() { + let x_47 : u32 = local_invocation_index_1; + compute_main_inner(x_47); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomicStore/array/array.wgsl b/test/tint/builtins/atomicStore/array/array.wgsl new file mode 100644 index 0000000000..430207a34c --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.wgsl @@ -0,0 +1,6 @@ +var wg : array, 4>; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&wg[1], 1u); +} diff --git a/test/tint/builtins/atomicStore/array/array.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/array/array.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d2ff575cd5 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +groupshared uint wg[4]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { + const uint i = idx; + uint atomic_result = 0u; + InterlockedExchange(wg[i], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[1], 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/array/array.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/array/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d2ff575cd5 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +groupshared uint wg[4]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { + const uint i = idx; + uint atomic_result = 0u; + InterlockedExchange(wg[i], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[1], 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/array/array.wgsl.expected.glsl b/test/tint/builtins/atomicStore/array/array.wgsl.expected.glsl new file mode 100644 index 0000000000..653bae6c55 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es + +shared uint wg[4]; +void compute_main(uint local_invocation_index) { + { + for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { + uint i = idx; + atomicExchange(wg[i], 0u); + } + } + barrier(); + atomicExchange(wg[1], 1u); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/array/array.wgsl.expected.msl b/test/tint/builtins/atomicStore/array/array.wgsl.expected.msl new file mode 100644 index 0000000000..5f20d271bb --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup tint_array* const tint_symbol) { + for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { + uint const i = idx; + atomic_store_explicit(&((*(tint_symbol))[i]), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol))[1]), 1u, memory_order_relaxed); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup tint_array tint_symbol_1; + compute_main_inner(local_invocation_index, &(tint_symbol_1)); + return; +} + diff --git a/test/tint/builtins/atomicStore/array/array.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/array/array.wgsl.expected.spvasm new file mode 100644 index 0000000000..f41ddf706c --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_4 ArrayStride 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %uint_4 = OpConstant %uint 4 +%_arr_uint_uint_4 = OpTypeArray %uint %uint_4 +%_ptr_Workgroup__arr_uint_uint_4 = OpTypePointer Workgroup %_arr_uint_uint_4 + %wg = OpVariable %_ptr_Workgroup__arr_uint_uint_4 Workgroup + %void = OpTypeVoid + %8 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %15 = OpConstantNull %uint + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_1 = OpConstant %uint 1 + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %43 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %8 +%local_invocation_index = OpFunctionParameter %uint + %12 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %15 + OpStore %idx %local_invocation_index + OpBranch %16 + %16 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %21 = OpLoad %uint %idx + %22 = OpULessThan %bool %21 %uint_4 + %20 = OpLogicalNot %bool %22 + OpSelectionMerge %24 None + OpBranchConditional %20 %25 %24 + %25 = OpLabel + OpBranch %17 + %24 = OpLabel + %26 = OpLoad %uint %idx + %32 = OpAccessChain %_ptr_Workgroup_uint %wg %26 + OpAtomicStore %32 %uint_2 %uint_0 %15 + OpBranch %18 + %18 = OpLabel + %33 = OpLoad %uint %idx + %35 = OpIAdd %uint %33 %uint_1 + OpStore %idx %35 + OpBranch %16 + %17 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %42 = OpAccessChain %_ptr_Workgroup_uint %wg %int_1 + OpAtomicStore %42 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %43 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1 + %46 = OpFunctionCall %void %compute_main_inner %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/array/array.wgsl.expected.wgsl b/test/tint/builtins/atomicStore/array/array.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6812d4d30 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/array.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var wg : array, 4>; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&(wg[1]), 1u); +} diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm b/test/tint/builtins/atomicStore/array/arrays.spvasm new file mode 100644 index 0000000000..0dbd964435 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_1 ArrayStride 4 + OpDecorate %_arr__arr_uint_uint_1_uint_2 ArrayStride 4 + OpDecorate %_arr__arr__arr_uint_uint_1_uint_2_uint_3 ArrayStride 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %uint_2 = OpConstant %uint 2 +%_arr__arr_uint_uint_1_uint_2 = OpTypeArray %_arr_uint_uint_1 %uint_2 + %uint_3 = OpConstant %uint 3 +%_arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypeArray %_arr__arr_uint_uint_1_uint_2 %uint_3 +%_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypePointer Workgroup %_arr__arr__arr_uint_uint_1_uint_2_uint_3 + %wg = OpVariable %_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 Workgroup + %void = OpTypeVoid + %12 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %19 = OpConstantNull %uint + %uint_6 = OpConstant %uint 6 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %51 = OpConstantNull %int + %53 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %12 +%local_invocation_index = OpFunctionParameter %uint + %16 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %19 + OpStore %idx %local_invocation_index + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %25 = OpLoad %uint %idx + %27 = OpULessThan %bool %25 %uint_6 + %24 = OpLogicalNot %bool %27 + OpSelectionMerge %29 None + OpBranchConditional %24 %30 %29 + %30 = OpLabel + OpBranch %21 + %29 = OpLabel + %31 = OpLoad %uint %idx + %32 = OpUDiv %uint %31 %uint_2 + %33 = OpLoad %uint %idx + %34 = OpUMod %uint %33 %uint_2 + %35 = OpLoad %uint %idx + %36 = OpUMod %uint %35 %uint_1 + %41 = OpAccessChain %_ptr_Workgroup_uint %wg %32 %34 %36 + OpAtomicStore %41 %uint_2 %uint_0 %19 + OpBranch %22 + %22 = OpLabel + %42 = OpLoad %uint %idx + %43 = OpIAdd %uint %42 %uint_1 + OpStore %idx %43 + OpBranch %20 + %21 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %52 = OpAccessChain %_ptr_Workgroup_uint %wg %int_2 %int_1 %51 + OpAtomicStore %52 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %53 + %55 = OpLabel + %57 = OpLoad %uint %local_invocation_index_1 + %56 = OpFunctionCall %void %compute_main_inner %57 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..16f5d2e59f --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.dxc.hlsl @@ -0,0 +1,47 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint wg[3][2][1]; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 6u))); idx = (idx + 1u)) { + uint atomic_result = 0u; + InterlockedExchange(wg[(idx / 2u)][(idx % 2u)][(idx % 1u)], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[2][1][0], 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { + const uint i = (idx_1 / 2u); + const uint i_1 = (idx_1 % 2u); + const uint i_2 = (idx_1 % 1u); + uint atomic_result_2 = 0u; + InterlockedExchange(wg[i][i_1][i_2], 0u, atomic_result_2); + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..16f5d2e59f --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.fxc.hlsl @@ -0,0 +1,47 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint wg[3][2][1]; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 6u))); idx = (idx + 1u)) { + uint atomic_result = 0u; + InterlockedExchange(wg[(idx / 2u)][(idx % 2u)][(idx % 1u)], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[2][1][0], 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { + const uint i = (idx_1 / 2u); + const uint i_1 = (idx_1 % 2u); + const uint i_2 = (idx_1 % 1u); + uint atomic_result_2 = 0u; + InterlockedExchange(wg[i][i_1][i_2], 0u, atomic_result_2); + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl new file mode 100644 index 0000000000..4cdd505b1a --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl @@ -0,0 +1,41 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint wg[3][2][1]; +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + for(; !(!((idx < 6u))); idx = (idx + 1u)) { + atomicExchange(wg[(idx / 2u)][(idx % 2u)][(idx % 1u)], 0u); + } + } + barrier(); + atomicExchange(wg[2][1][0], 1u); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { + uint i = (idx_1 / 2u); + uint i_1 = (idx_1 % 2u); + uint i_2 = (idx_1 % 1u); + atomicExchange(wg[i][i_1][i_2], 0u); + } + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.msl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.msl new file mode 100644 index 0000000000..943a64cf5c --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup tint_array, 2>, 3>* const tint_symbol) { + uint idx = 0u; + idx = local_invocation_index; + while (true) { + uint const x_25 = idx; + if (!((x_25 < 6u))) { + break; + } + uint const x_31 = idx; + uint const x_33 = idx; + uint const x_35 = idx; + atomic_store_explicit(&((*(tint_symbol))[(x_31 / 2u)][(x_33 % 2u)][(x_35 % 1u)]), 0u, memory_order_relaxed); + { + uint const x_42 = idx; + idx = (x_42 + 1u); + } + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol))[2][1][0]), 1u, memory_order_relaxed); + return; +} + +void compute_main_1(thread uint* const tint_symbol_1, threadgroup tint_array, 2>, 3>* const tint_symbol_2) { + uint const x_57 = *(tint_symbol_1); + compute_main_inner(x_57, tint_symbol_2); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup tint_array, 2>, 3>* const tint_symbol_3, thread uint* const tint_symbol_4) { + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { + uint const i = (idx_1 / 2u); + uint const i_1 = (idx_1 % 2u); + uint const i_2 = (idx_1 % 1u); + atomic_store_explicit(&((*(tint_symbol_3))[i][i_1][i_2]), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup tint_array, 2>, 3> tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); + return; +} + diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.spvasm new file mode 100644 index 0000000000..8091c97689 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %idx_1 "idx_1" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_1 ArrayStride 4 + OpDecorate %_arr__arr_uint_uint_1_uint_2 ArrayStride 4 + OpDecorate %_arr__arr__arr_uint_uint_1_uint_2_uint_3 ArrayStride 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %uint_2 = OpConstant %uint 2 +%_arr__arr_uint_uint_1_uint_2 = OpTypeArray %_arr_uint_uint_1 %uint_2 + %uint_3 = OpConstant %uint 3 +%_arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypeArray %_arr__arr_uint_uint_1_uint_2 %uint_3 +%_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypePointer Workgroup %_arr__arr__arr_uint_uint_1_uint_2_uint_3 + %wg = OpVariable %_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 Workgroup + %void = OpTypeVoid + %15 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_6 = OpConstant %uint 6 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %53 = OpConstantNull %int + %55 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %15 +%local_invocation_index = OpFunctionParameter %uint + %19 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %6 + OpStore %idx %6 + OpStore %idx %local_invocation_index + OpBranch %22 + %22 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %uint %idx + %29 = OpULessThan %bool %26 %uint_6 + %27 = OpLogicalNot %bool %29 + OpSelectionMerge %31 None + OpBranchConditional %27 %32 %31 + %32 = OpLabel + OpBranch %23 + %31 = OpLabel + %33 = OpLoad %uint %idx + %34 = OpLoad %uint %idx + %35 = OpLoad %uint %idx + %39 = OpUDiv %uint %33 %uint_2 + %40 = OpUMod %uint %34 %uint_2 + %41 = OpUMod %uint %35 %uint_1 + %43 = OpAccessChain %_ptr_Workgroup_uint %wg %39 %40 %41 + OpAtomicStore %43 %uint_2 %uint_0 %6 + OpBranch %24 + %24 = OpLabel + %44 = OpLoad %uint %idx + %45 = OpIAdd %uint %44 %uint_1 + OpStore %idx %45 + OpBranch %22 + %23 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %54 = OpAccessChain %_ptr_Workgroup_uint %wg %int_2 %int_1 %53 + OpAtomicStore %54 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %55 + %57 = OpLabel + %58 = OpLoad %uint %local_invocation_index_1 + %59 = OpFunctionCall %void %compute_main_inner %58 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %15 +%local_invocation_index_1_param = OpFunctionParameter %uint + %62 = OpLabel + %idx_1 = OpVariable %_ptr_Function_uint Function %6 + OpStore %idx_1 %local_invocation_index_1_param + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %69 = OpLoad %uint %idx_1 + %70 = OpULessThan %bool %69 %uint_6 + %68 = OpLogicalNot %bool %70 + OpSelectionMerge %71 None + OpBranchConditional %68 %72 %71 + %72 = OpLabel + OpBranch %65 + %71 = OpLabel + %73 = OpLoad %uint %idx_1 + %74 = OpUDiv %uint %73 %uint_2 + %75 = OpLoad %uint %idx_1 + %76 = OpUMod %uint %75 %uint_2 + %77 = OpLoad %uint %idx_1 + %78 = OpUMod %uint %77 %uint_1 + %81 = OpAccessChain %_ptr_Workgroup_uint %wg %74 %76 %78 + OpAtomicStore %81 %uint_2 %uint_0 %6 + OpBranch %66 + %66 = OpLabel + %82 = OpLoad %uint %idx_1 + %83 = OpIAdd %uint %82 %uint_1 + OpStore %idx_1 %83 + OpBranch %64 + %65 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %85 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %55 + %87 = OpLabel + %89 = OpLoad %uint %local_invocation_index_1_param_1 + %88 = OpFunctionCall %void %compute_main_inner_1 %89 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.wgsl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.wgsl new file mode 100644 index 0000000000..2b2b74112c --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +type Arr = array; + +type Arr_1 = array; + +type Arr_2 = array; + +var local_invocation_index_1 : u32; + +var wg : array, 1u>, 2u>, 3u>; + +fn compute_main_inner(local_invocation_index : u32) { + var idx : u32 = 0u; + idx = local_invocation_index; + loop { + let x_25 : u32 = idx; + if (!((x_25 < 6u))) { + break; + } + let x_31 : u32 = idx; + let x_33 : u32 = idx; + let x_35 : u32 = idx; + atomicStore(&(wg[(x_31 / 2u)][(x_33 % 2u)][(x_35 % 1u)]), 0u); + + continuing { + let x_42 : u32 = idx; + idx = (x_42 + 1u); + } + } + workgroupBarrier(); + atomicStore(&(wg[2i][1i][0i]), 1u); + return; +} + +fn compute_main_1() { + let x_57 : u32 = local_invocation_index_1; + compute_main_inner(x_57); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomicStore/array/arrays.wgsl b/test/tint/builtins/atomicStore/array/arrays.wgsl new file mode 100644 index 0000000000..3415c58630 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.wgsl @@ -0,0 +1,6 @@ +var wg : array, 1>, 2>, 3>; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&wg[2][1][0], 1u); +} diff --git a/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f993d5073 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.dxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint wg[3][2][1]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + const uint i = (idx / 2u); + const uint i_1 = (idx % 2u); + const uint i_2 = (idx % 1u); + uint atomic_result = 0u; + InterlockedExchange(wg[i][i_1][i_2], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[2][1][0], 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6f993d5073 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint wg[3][2][1]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + const uint i = (idx / 2u); + const uint i_1 = (idx % 2u); + const uint i_2 = (idx % 1u); + uint atomic_result = 0u; + InterlockedExchange(wg[i][i_1][i_2], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[2][1][0], 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.glsl b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.glsl new file mode 100644 index 0000000000..598fde91f4 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint wg[3][2][1]; +void compute_main(uint local_invocation_index) { + { + for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + uint i = (idx / 2u); + uint i_1 = (idx % 2u); + uint i_2 = (idx % 1u); + atomicExchange(wg[i][i_1][i_2], 0u); + } + } + barrier(); + atomicExchange(wg[2][1][0], 1u); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.msl b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.msl new file mode 100644 index 0000000000..51e5245e4c --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup tint_array, 2>, 3>* const tint_symbol) { + for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + uint const i = (idx / 2u); + uint const i_1 = (idx % 2u); + uint const i_2 = (idx % 1u); + atomic_store_explicit(&((*(tint_symbol))[i][i_1][i_2]), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol))[2][1][0]), 1u, memory_order_relaxed); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup tint_array, 2>, 3> tint_symbol_1; + compute_main_inner(local_invocation_index, &(tint_symbol_1)); + return; +} + diff --git a/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.spvasm new file mode 100644 index 0000000000..0dbd964435 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_uint_uint_1 ArrayStride 4 + OpDecorate %_arr__arr_uint_uint_1_uint_2 ArrayStride 4 + OpDecorate %_arr__arr__arr_uint_uint_1_uint_2_uint_3 ArrayStride 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %uint_2 = OpConstant %uint 2 +%_arr__arr_uint_uint_1_uint_2 = OpTypeArray %_arr_uint_uint_1 %uint_2 + %uint_3 = OpConstant %uint 3 +%_arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypeArray %_arr__arr_uint_uint_1_uint_2 %uint_3 +%_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypePointer Workgroup %_arr__arr__arr_uint_uint_1_uint_2_uint_3 + %wg = OpVariable %_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 Workgroup + %void = OpTypeVoid + %12 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %19 = OpConstantNull %uint + %uint_6 = OpConstant %uint 6 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %51 = OpConstantNull %int + %53 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %12 +%local_invocation_index = OpFunctionParameter %uint + %16 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %19 + OpStore %idx %local_invocation_index + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %25 = OpLoad %uint %idx + %27 = OpULessThan %bool %25 %uint_6 + %24 = OpLogicalNot %bool %27 + OpSelectionMerge %29 None + OpBranchConditional %24 %30 %29 + %30 = OpLabel + OpBranch %21 + %29 = OpLabel + %31 = OpLoad %uint %idx + %32 = OpUDiv %uint %31 %uint_2 + %33 = OpLoad %uint %idx + %34 = OpUMod %uint %33 %uint_2 + %35 = OpLoad %uint %idx + %36 = OpUMod %uint %35 %uint_1 + %41 = OpAccessChain %_ptr_Workgroup_uint %wg %32 %34 %36 + OpAtomicStore %41 %uint_2 %uint_0 %19 + OpBranch %22 + %22 = OpLabel + %42 = OpLoad %uint %idx + %43 = OpIAdd %uint %42 %uint_1 + OpStore %idx %43 + OpBranch %20 + %21 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %52 = OpAccessChain %_ptr_Workgroup_uint %wg %int_2 %int_1 %51 + OpAtomicStore %52 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %53 + %55 = OpLabel + %57 = OpLoad %uint %local_invocation_index_1 + %56 = OpFunctionCall %void %compute_main_inner %57 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.wgsl b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ca5597704 --- /dev/null +++ b/test/tint/builtins/atomicStore/array/arrays.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var wg : array, 1>, 2>, 3>; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&(wg[2][1][0]), 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm new file mode 100644 index 0000000000..b9e0fed8f4 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + OpDecorate %_arr_S_uint_10 ArrayStride 12 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %uint %uint + %uint_10 = OpConstant %uint 10 +%_arr_S_uint_10 = OpTypeArray %S %uint_10 +%_ptr_Workgroup__arr_S_uint_10 = OpTypePointer Workgroup %_arr_S_uint_10 + %wg = OpVariable %_ptr_Workgroup__arr_S_uint_10 Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %32 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int_4 = OpConstant %int 4 + %49 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %10 +%local_invocation_index = OpFunctionParameter %uint + %14 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %17 + OpStore %idx %local_invocation_index + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %23 = OpLoad %uint %idx + %24 = OpULessThan %bool %23 %uint_10 + %22 = OpLogicalNot %bool %24 + OpSelectionMerge %26 None + OpBranchConditional %22 %27 %26 + %27 = OpLabel + OpBranch %19 + %26 = OpLabel + %28 = OpLoad %uint %idx + %31 = OpAccessChain %_ptr_Workgroup_int %wg %28 %uint_0 + OpStore %31 %32 + %38 = OpAccessChain %_ptr_Workgroup_uint %wg %28 %uint_1 + OpAtomicStore %38 %uint_2 %uint_0 %17 + %40 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %28 %uint_2 + OpStore %40 %17 + OpBranch %20 + %20 = OpLabel + %41 = OpLoad %uint %idx + %42 = OpIAdd %uint %41 %uint_1 + OpStore %idx %42 + OpBranch %18 + %19 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %48 = OpAccessChain %_ptr_Workgroup_uint %wg %int_4 %uint_1 + OpAtomicStore %48 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %49 + %51 = OpLabel + %53 = OpLoad %uint %local_invocation_index_1 + %52 = OpFunctionCall %void %compute_main_inner %53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..9d31dd1592 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.dxc.hlsl @@ -0,0 +1,56 @@ +struct S_atomic { + int x; + uint a; + uint y; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg[10]; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 10u))); idx = (idx + 1u)) { + const uint x_28 = idx; + wg[x_28].x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg[x_28].a, 0u, atomic_result); + wg[x_28].y = 0u; + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[4].a, 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 10u); idx_1 = (idx_1 + 1u)) { + const uint i = idx_1; + wg[i].x = 0; + uint atomic_result_2 = 0u; + InterlockedExchange(wg[i].a, 0u, atomic_result_2); + wg[i].y = 0u; + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..9d31dd1592 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.fxc.hlsl @@ -0,0 +1,56 @@ +struct S_atomic { + int x; + uint a; + uint y; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg[10]; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 10u))); idx = (idx + 1u)) { + const uint x_28 = idx; + wg[x_28].x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg[x_28].a, 0u, atomic_result); + wg[x_28].y = 0u; + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[4].a, 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 10u); idx_1 = (idx_1 + 1u)) { + const uint i = idx_1; + wg[i].x = 0; + uint atomic_result_2 = 0u; + InterlockedExchange(wg[i].a, 0u, atomic_result_2); + wg[i].y = 0u; + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.glsl new file mode 100644 index 0000000000..4f23cb92d7 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.glsl @@ -0,0 +1,56 @@ +#version 310 es + +struct S_atomic { + int x; + uint a; + uint y; +}; + +struct S { + int x; + uint a; + uint y; +}; + +uint local_invocation_index_1 = 0u; +shared S_atomic wg[10]; +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + idx = local_invocation_index; + { + for(; !(!((idx < 10u))); idx = (idx + 1u)) { + uint x_28 = idx; + wg[x_28].x = 0; + atomicExchange(wg[x_28].a, 0u); + wg[x_28].y = 0u; + } + } + barrier(); + atomicExchange(wg[4].a, 1u); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 10u); idx_1 = (idx_1 + 1u)) { + uint i = idx_1; + wg[i].x = 0; + atomicExchange(wg[i].a, 0u); + wg[i].y = 0u; + } + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.msl new file mode 100644 index 0000000000..f4fd526a21 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct S_atomic { + int x; + atomic_uint a; + uint y; +}; + +struct S { + int x; + uint a; + uint y; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup tint_array* const tint_symbol) { + uint idx = 0u; + idx = local_invocation_index; + while (true) { + uint const x_23 = idx; + if (!((x_23 < 10u))) { + break; + } + uint const x_28 = idx; + (*(tint_symbol))[x_28].x = 0; + atomic_store_explicit(&((*(tint_symbol))[x_28].a), 0u, memory_order_relaxed); + (*(tint_symbol))[x_28].y = 0u; + { + uint const x_41 = idx; + idx = (x_41 + 1u); + } + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol))[4].a), 1u, memory_order_relaxed); + return; +} + +void compute_main_1(thread uint* const tint_symbol_1, threadgroup tint_array* const tint_symbol_2) { + uint const x_53 = *(tint_symbol_1); + compute_main_inner(x_53, tint_symbol_2); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup tint_array* const tint_symbol_3, thread uint* const tint_symbol_4) { + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 10u); idx_1 = (idx_1 + 1u)) { + uint const i = idx_1; + (*(tint_symbol_3))[i].x = 0; + atomic_store_explicit(&((*(tint_symbol_3))[i].a), 0u, memory_order_relaxed); + (*(tint_symbol_3))[i].y = 0u; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup tint_array tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.spvasm new file mode 100644 index 0000000000..b25f900d0e --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S_atomic "S_atomic" + OpMemberName %S_atomic 0 "x" + OpMemberName %S_atomic 1 "a" + OpMemberName %S_atomic 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %idx_1 "idx_1" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S_atomic 0 Offset 0 + OpMemberDecorate %S_atomic 1 Offset 4 + OpMemberDecorate %S_atomic 2 Offset 8 + OpDecorate %_arr_S_atomic_uint_10 ArrayStride 12 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 + %S_atomic = OpTypeStruct %int %uint %uint + %uint_10 = OpConstant %uint 10 +%_arr_S_atomic_uint_10 = OpTypeArray %S_atomic %uint_10 +%_ptr_Workgroup__arr_S_atomic_uint_10 = OpTypePointer Workgroup %_arr_S_atomic_uint_10 + %wg = OpVariable %_ptr_Workgroup__arr_S_atomic_uint_10 Workgroup + %void = OpTypeVoid + %13 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %34 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int_4 = OpConstant %int 4 + %51 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %13 +%local_invocation_index = OpFunctionParameter %uint + %17 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %6 + OpStore %idx %6 + OpStore %idx %local_invocation_index + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %uint %idx + %26 = OpULessThan %bool %24 %uint_10 + %25 = OpLogicalNot %bool %26 + OpSelectionMerge %28 None + OpBranchConditional %25 %29 %28 + %29 = OpLabel + OpBranch %21 + %28 = OpLabel + %30 = OpLoad %uint %idx + %33 = OpAccessChain %_ptr_Workgroup_int %wg %30 %uint_0 + OpStore %33 %34 + %40 = OpAccessChain %_ptr_Workgroup_uint %wg %30 %uint_1 + OpAtomicStore %40 %uint_2 %uint_0 %6 + %42 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %30 %uint_2 + OpStore %42 %6 + OpBranch %22 + %22 = OpLabel + %43 = OpLoad %uint %idx + %44 = OpIAdd %uint %43 %uint_1 + OpStore %idx %44 + OpBranch %20 + %21 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %50 = OpAccessChain %_ptr_Workgroup_uint %wg %int_4 %uint_1 + OpAtomicStore %50 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %51 + %53 = OpLabel + %54 = OpLoad %uint %local_invocation_index_1 + %55 = OpFunctionCall %void %compute_main_inner %54 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %13 +%local_invocation_index_1_param = OpFunctionParameter %uint + %58 = OpLabel + %idx_1 = OpVariable %_ptr_Function_uint Function %6 + OpStore %idx_1 %local_invocation_index_1_param + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %65 = OpLoad %uint %idx_1 + %66 = OpULessThan %bool %65 %uint_10 + %64 = OpLogicalNot %bool %66 + OpSelectionMerge %67 None + OpBranchConditional %64 %68 %67 + %68 = OpLabel + OpBranch %61 + %67 = OpLabel + %69 = OpLoad %uint %idx_1 + %70 = OpAccessChain %_ptr_Workgroup_int %wg %69 %uint_0 + OpStore %70 %34 + %73 = OpAccessChain %_ptr_Workgroup_uint %wg %69 %uint_1 + OpAtomicStore %73 %uint_2 %uint_0 %6 + %74 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %69 %uint_2 + OpStore %74 %6 + OpBranch %62 + %62 = OpLabel + %75 = OpLoad %uint %idx_1 + %76 = OpIAdd %uint %75 %uint_1 + OpStore %idx_1 %76 + OpBranch %60 + %61 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %78 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %51 + %80 = OpLabel + %82 = OpLoad %uint %local_invocation_index_1_param_1 + %81 = OpFunctionCall %void %compute_main_inner_1 %82 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.wgsl b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.wgsl new file mode 100644 index 0000000000..de42f484ca --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.spvasm.expected.wgsl @@ -0,0 +1,52 @@ +struct S_atomic { + x : i32, + a : atomic, + y : u32, +} + +struct S { + x : i32, + a : u32, + y : u32, +} + +type Arr = array; + +var local_invocation_index_1 : u32; + +var wg : array; + +fn compute_main_inner(local_invocation_index : u32) { + var idx : u32 = 0u; + idx = local_invocation_index; + loop { + let x_23 : u32 = idx; + if (!((x_23 < 10u))) { + break; + } + let x_28 : u32 = idx; + wg[x_28].x = 0i; + atomicStore(&(wg[x_28].a), 0u); + wg[x_28].y = 0u; + + continuing { + let x_41 : u32 = idx; + idx = (x_41 + 1u); + } + } + workgroupBarrier(); + atomicStore(&(wg[4i].a), 1u); + return; +} + +fn compute_main_1() { + let x_53 : u32 = local_invocation_index_1; + compute_main_inner(x_53); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl new file mode 100644 index 0000000000..d49a3fd542 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl @@ -0,0 +1,12 @@ +struct S { + x : i32, + a : atomic, + y : u32, +}; + +var wg : array; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&wg[4].a, 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4642386bf0 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +struct S { + int x; + uint a; + uint y; +}; + +groupshared S wg[10]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 10u); idx = (idx + 1u)) { + const uint i = idx; + wg[i].x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg[i].a, 0u, atomic_result); + wg[i].y = 0u; + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[4].a, 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4642386bf0 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +struct S { + int x; + uint a; + uint y; +}; + +groupshared S wg[10]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 10u); idx = (idx + 1u)) { + const uint i = idx; + wg[i].x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg[i].a, 0u, atomic_result); + wg[i].y = 0u; + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg[4].a, 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.glsl new file mode 100644 index 0000000000..bd0a3ba6bb --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.glsl @@ -0,0 +1,27 @@ +#version 310 es + +struct S { + int x; + uint a; + uint y; +}; + +shared S wg[10]; +void compute_main(uint local_invocation_index) { + { + for(uint idx = local_invocation_index; (idx < 10u); idx = (idx + 1u)) { + uint i = idx; + wg[i].x = 0; + atomicExchange(wg[i].a, 0u); + wg[i].y = 0u; + } + } + barrier(); + atomicExchange(wg[4].a, 1u); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.msl new file mode 100644 index 0000000000..978edb198d --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct S { + int x; + atomic_uint a; + uint y; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup tint_array* const tint_symbol) { + for(uint idx = local_invocation_index; (idx < 10u); idx = (idx + 1u)) { + uint const i = idx; + (*(tint_symbol))[i].x = 0; + atomic_store_explicit(&((*(tint_symbol))[i].a), 0u, memory_order_relaxed); + (*(tint_symbol))[i].y = 0u; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol))[4].a), 1u, memory_order_relaxed); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup tint_array tint_symbol_1; + compute_main_inner(local_invocation_index, &(tint_symbol_1)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9e0fed8f4 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + OpDecorate %_arr_S_uint_10 ArrayStride 12 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %uint %uint + %uint_10 = OpConstant %uint 10 +%_arr_S_uint_10 = OpTypeArray %S %uint_10 +%_ptr_Workgroup__arr_S_uint_10 = OpTypePointer Workgroup %_arr_S_uint_10 + %wg = OpVariable %_ptr_Workgroup__arr_S_uint_10 Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %32 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int_4 = OpConstant %int 4 + %49 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %10 +%local_invocation_index = OpFunctionParameter %uint + %14 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %17 + OpStore %idx %local_invocation_index + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %23 = OpLoad %uint %idx + %24 = OpULessThan %bool %23 %uint_10 + %22 = OpLogicalNot %bool %24 + OpSelectionMerge %26 None + OpBranchConditional %22 %27 %26 + %27 = OpLabel + OpBranch %19 + %26 = OpLabel + %28 = OpLoad %uint %idx + %31 = OpAccessChain %_ptr_Workgroup_int %wg %28 %uint_0 + OpStore %31 %32 + %38 = OpAccessChain %_ptr_Workgroup_uint %wg %28 %uint_1 + OpAtomicStore %38 %uint_2 %uint_0 %17 + %40 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %28 %uint_2 + OpStore %40 %17 + OpBranch %20 + %20 = OpLabel + %41 = OpLoad %uint %idx + %42 = OpIAdd %uint %41 %uint_1 + OpStore %idx %42 + OpBranch %18 + %19 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %48 = OpAccessChain %_ptr_Workgroup_uint %wg %int_4 %uint_1 + OpAtomicStore %48 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %49 + %51 = OpLabel + %53 = OpLoad %uint %local_invocation_index_1 + %52 = OpFunctionCall %void %compute_main_inner %53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.wgsl b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.wgsl new file mode 100644 index 0000000000..1def9bdcfb --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/array_of_struct.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +struct S { + x : i32, + a : atomic, + y : u32, +} + +var wg : array; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&(wg[4].a), 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm new file mode 100644 index 0000000000..f61269c96a --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "b" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %uint %uint +%_ptr_Workgroup_S = OpTypePointer Workgroup %S + %wg = OpVariable %_ptr_Workgroup_S Workgroup + %void = OpTypeVoid + %8 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %16 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %23 = OpConstantNull %uint + %uint_264 = OpConstant %uint 264 + %35 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %8 +%local_invocation_index = OpFunctionParameter %uint + %12 = OpLabel + %15 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %15 %16 + %22 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %22 %uint_2 %uint_0 %23 + %26 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpAtomicStore %26 %uint_2 %uint_0 %23 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %31 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %31 %uint_2 %uint_0 %uint_1 + %34 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpAtomicStore %34 %uint_2 %uint_0 %uint_2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %35 + %37 = OpLabel + %39 = OpLoad %uint %local_invocation_index_1 + %38 = OpFunctionCall %void %compute_main_inner %39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..cb340f21e8 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.dxc.hlsl @@ -0,0 +1,50 @@ +struct S_atomic { + int x; + uint a; + uint b; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.b, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_2); + uint atomic_result_3 = 0u; + InterlockedExchange(wg.b, 2u, atomic_result_3); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + uint atomic_result_4 = 0u; + InterlockedExchange(wg.a, 0u, atomic_result_4); + uint atomic_result_5 = 0u; + InterlockedExchange(wg.b, 0u, atomic_result_5); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..cb340f21e8 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.fxc.hlsl @@ -0,0 +1,50 @@ +struct S_atomic { + int x; + uint a; + uint b; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.b, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_2); + uint atomic_result_3 = 0u; + InterlockedExchange(wg.b, 2u, atomic_result_3); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + uint atomic_result_4 = 0u; + InterlockedExchange(wg.a, 0u, atomic_result_4); + uint atomic_result_5 = 0u; + InterlockedExchange(wg.b, 0u, atomic_result_5); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.glsl new file mode 100644 index 0000000000..4d0836e37c --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.glsl @@ -0,0 +1,47 @@ +#version 310 es + +struct S_atomic { + int x; + uint a; + uint b; +}; + +struct S { + int x; + uint a; + uint b; +}; + +uint local_invocation_index_1 = 0u; +shared S_atomic wg; +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + atomicExchange(wg.a, 0u); + atomicExchange(wg.b, 0u); + barrier(); + atomicExchange(wg.a, 1u); + atomicExchange(wg.b, 2u); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + wg.x = 0; + atomicExchange(wg.a, 0u); + atomicExchange(wg.b, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.msl new file mode 100644 index 0000000000..4e1363de46 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct S_atomic { + int x; + atomic_uint a; + atomic_uint b; +}; + +struct S { + int x; + uint a; + uint b; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S_atomic* const tint_symbol) { + (*(tint_symbol)).x = 0; + atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed); + atomic_store_explicit(&((*(tint_symbol)).b), 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a), 1u, memory_order_relaxed); + atomic_store_explicit(&((*(tint_symbol)).b), 2u, memory_order_relaxed); + return; +} + +void compute_main_1(thread uint* const tint_symbol_1, threadgroup S_atomic* const tint_symbol_2) { + uint const x_39 = *(tint_symbol_1); + compute_main_inner(x_39, tint_symbol_2); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup S_atomic* const tint_symbol_3, thread uint* const tint_symbol_4) { + { + (*(tint_symbol_3)).x = 0; + atomic_store_explicit(&((*(tint_symbol_3)).a), 0u, memory_order_relaxed); + atomic_store_explicit(&((*(tint_symbol_3)).b), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup S_atomic tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.spvasm new file mode 100644 index 0000000000..5ee475d00d --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S_atomic "S_atomic" + OpMemberName %S_atomic 0 "x" + OpMemberName %S_atomic 1 "a" + OpMemberName %S_atomic 2 "b" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S_atomic 0 Offset 0 + OpMemberDecorate %S_atomic 1 Offset 4 + OpMemberDecorate %S_atomic 2 Offset 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 + %S_atomic = OpTypeStruct %int %uint %uint +%_ptr_Workgroup_S_atomic = OpTypePointer Workgroup %S_atomic + %wg = OpVariable %_ptr_Workgroup_S_atomic Workgroup + %void = OpTypeVoid + %11 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %19 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %37 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %11 +%local_invocation_index = OpFunctionParameter %uint + %15 = OpLabel + %18 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %18 %19 + %25 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %25 %uint_2 %uint_0 %6 + %28 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpAtomicStore %28 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %33 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %33 %uint_2 %uint_0 %uint_1 + %36 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpAtomicStore %36 %uint_2 %uint_0 %uint_2 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %37 + %39 = OpLabel + %40 = OpLoad %uint %local_invocation_index_1 + %41 = OpFunctionCall %void %compute_main_inner %40 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %11 +%local_invocation_index_1_param = OpFunctionParameter %uint + %44 = OpLabel + %45 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %45 %19 + %48 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %48 %uint_2 %uint_0 %6 + %51 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpAtomicStore %51 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %53 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %37 + %55 = OpLabel + %57 = OpLoad %uint %local_invocation_index_1_param_1 + %56 = OpFunctionCall %void %compute_main_inner_1 %57 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.wgsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.wgsl new file mode 100644 index 0000000000..20d066a906 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.wgsl @@ -0,0 +1,37 @@ +struct S_atomic { + x : i32, + a : atomic, + b : atomic, +} + +struct S { + x : i32, + a : u32, + b : u32, +} + +var local_invocation_index_1 : u32; + +var wg : S_atomic; + +fn compute_main_inner(local_invocation_index : u32) { + wg.x = 0i; + atomicStore(&(wg.a), 0u); + atomicStore(&(wg.b), 0u); + workgroupBarrier(); + atomicStore(&(wg.a), 1u); + atomicStore(&(wg.b), 2u); + return; +} + +fn compute_main_1() { + let x_39 : u32 = local_invocation_index_1; + compute_main_inner(x_39); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl new file mode 100644 index 0000000000..b055a8f314 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl @@ -0,0 +1,13 @@ +struct S { + x : i32, + a : atomic, + b : atomic, +}; + +var wg: S; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&wg.a, 1u); + atomicStore(&wg.b, 2u); +} diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..35b428feee --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +struct S { + int x; + uint a; + uint b; +}; + +groupshared S wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.b, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_2); + uint atomic_result_3 = 0u; + InterlockedExchange(wg.b, 2u, atomic_result_3); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..35b428feee --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +struct S { + int x; + uint a; + uint b; +}; + +groupshared S wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.b, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_2); + uint atomic_result_3 = 0u; + InterlockedExchange(wg.b, 2u, atomic_result_3); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.glsl new file mode 100644 index 0000000000..d3a4b832ac --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.glsl @@ -0,0 +1,25 @@ +#version 310 es + +struct S { + int x; + uint a; + uint b; +}; + +shared S wg; +void compute_main(uint local_invocation_index) { + { + wg.x = 0; + atomicExchange(wg.a, 0u); + atomicExchange(wg.b, 0u); + } + barrier(); + atomicExchange(wg.a, 1u); + atomicExchange(wg.b, 2u); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.msl new file mode 100644 index 0000000000..3ea40fa37e --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +struct S { + int x; + atomic_uint a; + atomic_uint b; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S* const tint_symbol) { + { + (*(tint_symbol)).x = 0; + atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed); + atomic_store_explicit(&((*(tint_symbol)).b), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a), 1u, memory_order_relaxed); + atomic_store_explicit(&((*(tint_symbol)).b), 2u, memory_order_relaxed); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup S tint_symbol_1; + compute_main_inner(local_invocation_index, &(tint_symbol_1)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.spvasm new file mode 100644 index 0000000000..f61269c96a --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.spvasm @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "b" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %uint %uint +%_ptr_Workgroup_S = OpTypePointer Workgroup %S + %wg = OpVariable %_ptr_Workgroup_S Workgroup + %void = OpTypeVoid + %8 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %16 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %23 = OpConstantNull %uint + %uint_264 = OpConstant %uint 264 + %35 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %8 +%local_invocation_index = OpFunctionParameter %uint + %12 = OpLabel + %15 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %15 %16 + %22 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %22 %uint_2 %uint_0 %23 + %26 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpAtomicStore %26 %uint_2 %uint_0 %23 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %31 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %31 %uint_2 %uint_0 %uint_1 + %34 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpAtomicStore %34 %uint_2 %uint_0 %uint_2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %35 + %37 = OpLabel + %39 = OpLoad %uint %local_invocation_index_1 + %38 = OpFunctionCall %void %compute_main_inner %39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.wgsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d25d8adbd --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +struct S { + x : i32, + a : atomic, + b : atomic, +} + +var wg : S; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&(wg.a), 1u); + atomicStore(&(wg.b), 2u); +} diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm new file mode 100644 index 0000000000..acad988c5f --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %uint %uint +%_ptr_Workgroup_S = OpTypePointer Workgroup %S + %wg = OpVariable %_ptr_Workgroup_S Workgroup + %void = OpTypeVoid + %8 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %16 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %23 = OpConstantNull %uint +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %31 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %8 +%local_invocation_index = OpFunctionParameter %uint + %12 = OpLabel + %15 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %15 %16 + %22 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %22 %uint_2 %uint_0 %23 + %25 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2 + OpStore %25 %23 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %30 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %31 + %33 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..403d1fb811 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +struct S_atomic { + int x; + uint a; + uint y; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + wg.y = 0u; + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a, 0u, atomic_result_2); + wg.y = 0u; + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..403d1fb811 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +struct S_atomic { + int x; + uint a; + uint y; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + wg.y = 0u; + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a, 0u, atomic_result_2); + wg.y = 0u; + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.glsl new file mode 100644 index 0000000000..2b03ef6772 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es + +struct S_atomic { + int x; + uint a; + uint y; +}; + +struct S { + int x; + uint a; + uint y; +}; + +uint local_invocation_index_1 = 0u; +shared S_atomic wg; +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + atomicExchange(wg.a, 0u); + wg.y = 0u; + barrier(); + atomicExchange(wg.a, 1u); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + wg.x = 0; + atomicExchange(wg.a, 0u); + wg.y = 0u; + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.msl new file mode 100644 index 0000000000..524820aff7 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct S_atomic { + int x; + atomic_uint a; + uint y; +}; + +struct S { + int x; + uint a; + uint y; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S_atomic* const tint_symbol) { + (*(tint_symbol)).x = 0; + atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed); + (*(tint_symbol)).y = 0u; + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a), 1u, memory_order_relaxed); + return; +} + +void compute_main_1(thread uint* const tint_symbol_1, threadgroup S_atomic* const tint_symbol_2) { + uint const x_35 = *(tint_symbol_1); + compute_main_inner(x_35, tint_symbol_2); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup S_atomic* const tint_symbol_3, thread uint* const tint_symbol_4) { + { + (*(tint_symbol_3)).x = 0; + atomic_store_explicit(&((*(tint_symbol_3)).a), 0u, memory_order_relaxed); + (*(tint_symbol_3)).y = 0u; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup S_atomic tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.spvasm new file mode 100644 index 0000000000..35d0d2b420 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S_atomic "S_atomic" + OpMemberName %S_atomic 0 "x" + OpMemberName %S_atomic 1 "a" + OpMemberName %S_atomic 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S_atomic 0 Offset 0 + OpMemberDecorate %S_atomic 1 Offset 4 + OpMemberDecorate %S_atomic 2 Offset 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 + %S_atomic = OpTypeStruct %int %uint %uint +%_ptr_Workgroup_S_atomic = OpTypePointer Workgroup %S_atomic + %wg = OpVariable %_ptr_Workgroup_S_atomic Workgroup + %void = OpTypeVoid + %11 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %19 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %33 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %11 +%local_invocation_index = OpFunctionParameter %uint + %15 = OpLabel + %18 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %18 %19 + %25 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %25 %uint_2 %uint_0 %6 + %27 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2 + OpStore %27 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %32 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %33 + %35 = OpLabel + %36 = OpLoad %uint %local_invocation_index_1 + %37 = OpFunctionCall %void %compute_main_inner %36 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %11 +%local_invocation_index_1_param = OpFunctionParameter %uint + %40 = OpLabel + %41 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %41 %19 + %44 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %44 %uint_2 %uint_0 %6 + %45 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2 + OpStore %45 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %47 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %33 + %49 = OpLabel + %51 = OpLoad %uint %local_invocation_index_1_param_1 + %50 = OpFunctionCall %void %compute_main_inner_1 %51 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.wgsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.wgsl new file mode 100644 index 0000000000..2d90f56850 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct S_atomic { + x : i32, + a : atomic, + y : u32, +} + +struct S { + x : i32, + a : u32, + y : u32, +} + +var local_invocation_index_1 : u32; + +var wg : S_atomic; + +fn compute_main_inner(local_invocation_index : u32) { + wg.x = 0i; + atomicStore(&(wg.a), 0u); + wg.y = 0u; + workgroupBarrier(); + atomicStore(&(wg.a), 1u); + return; +} + +fn compute_main_1() { + let x_35 : u32 = local_invocation_index_1; + compute_main_inner(x_35); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl new file mode 100644 index 0000000000..e997e8749e --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl @@ -0,0 +1,12 @@ +struct S { + x : i32, + a : atomic, + y : u32, +}; + +var wg: S; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&wg.a, 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fb93daa369 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.dxc.hlsl @@ -0,0 +1,29 @@ +struct S { + int x; + uint a; + uint y; +}; + +groupshared S wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + wg.y = 0u; + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fb93daa369 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.fxc.hlsl @@ -0,0 +1,29 @@ +struct S { + int x; + uint a; + uint y; +}; + +groupshared S wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + wg.y = 0u; + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.glsl new file mode 100644 index 0000000000..39f13a5880 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.glsl @@ -0,0 +1,24 @@ +#version 310 es + +struct S { + int x; + uint a; + uint y; +}; + +shared S wg; +void compute_main(uint local_invocation_index) { + { + wg.x = 0; + atomicExchange(wg.a, 0u); + wg.y = 0u; + } + barrier(); + atomicExchange(wg.a, 1u); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.msl new file mode 100644 index 0000000000..ccec811b27 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.msl @@ -0,0 +1,25 @@ +#include + +using namespace metal; +struct S { + int x; + atomic_uint a; + uint y; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S* const tint_symbol) { + { + (*(tint_symbol)).x = 0; + atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed); + (*(tint_symbol)).y = 0u; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a), 1u, memory_order_relaxed); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup S tint_symbol_1; + compute_main_inner(local_invocation_index, &(tint_symbol_1)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.spvasm new file mode 100644 index 0000000000..acad988c5f --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.spvasm @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %uint %uint +%_ptr_Workgroup_S = OpTypePointer Workgroup %S + %wg = OpVariable %_ptr_Workgroup_S Workgroup + %void = OpTypeVoid + %8 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %16 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %23 = OpConstantNull %uint +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %31 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %8 +%local_invocation_index = OpFunctionParameter %uint + %12 = OpLabel + %15 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %15 %16 + %22 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %22 %uint_2 %uint_0 %23 + %25 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2 + OpStore %25 %23 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %30 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %31 + %33 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.wgsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.wgsl new file mode 100644 index 0000000000..164ad73445 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +struct S { + x : i32, + a : atomic, + y : u32, +} + +var wg : S; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&(wg.a), 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm b/test/tint/builtins/atomicStore/struct/nested.spvasm new file mode 100644 index 0000000000..a8aaff3d02 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S2 "S2" + OpMemberName %S2 0 "x" + OpMemberName %S2 1 "y" + OpMemberName %S2 2 "z" + OpMemberName %S2 3 "a" + OpName %S1 "S1" + OpMemberName %S1 0 "x" + OpMemberName %S1 1 "a" + OpName %S0 "S0" + OpMemberName %S0 0 "x" + OpMemberName %S0 1 "a" + OpMemberName %S0 2 "y" + OpMemberName %S0 3 "z" + OpMemberName %S1 2 "y" + OpMemberName %S1 3 "z" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S2 0 Offset 0 + OpMemberDecorate %S2 1 Offset 4 + OpMemberDecorate %S2 2 Offset 8 + OpMemberDecorate %S2 3 Offset 12 + OpMemberDecorate %S1 0 Offset 0 + OpMemberDecorate %S1 1 Offset 4 + OpMemberDecorate %S0 0 Offset 0 + OpMemberDecorate %S0 1 Offset 4 + OpMemberDecorate %S0 2 Offset 8 + OpMemberDecorate %S0 3 Offset 12 + OpMemberDecorate %S1 2 Offset 20 + OpMemberDecorate %S1 3 Offset 24 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S0 = OpTypeStruct %int %uint %int %int + %S1 = OpTypeStruct %int %S0 %int %int + %S2 = OpTypeStruct %int %int %int %S1 +%_ptr_Workgroup_S2 = OpTypePointer Workgroup %S2 + %wg = OpVariable %_ptr_Workgroup_S2 Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %18 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %30 = OpConstantNull %uint + %uint_264 = OpConstant %uint 264 + %40 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %10 +%local_invocation_index = OpFunctionParameter %uint + %14 = OpLabel + %17 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %17 %18 + %20 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1 + OpStore %20 %18 + %22 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2 + OpStore %22 %18 + %24 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0 + OpStore %24 %18 + %25 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0 + OpStore %25 %18 + %29 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1 + OpAtomicStore %29 %uint_2 %uint_0 %30 + %31 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2 + OpStore %31 %18 + %32 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3 + OpStore %32 %18 + %33 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2 + OpStore %33 %18 + %34 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3 + OpStore %34 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %39 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1 + OpAtomicStore %39 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %40 + %42 = OpLabel + %44 = OpLoad %uint %local_invocation_index_1 + %43 = OpFunctionCall %void %compute_main_inner %44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..4449c42258 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.dxc.hlsl @@ -0,0 +1,73 @@ +struct S0_atomic { + int x; + uint a; + int y; + int z; +}; +struct S1_atomic { + int x; + S0_atomic a; + int y; + int z; +}; +struct S2_atomic { + int x; + int y; + int z; + S1_atomic a; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S2_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + wg.y = 0; + wg.z = 0; + wg.a.x = 0; + wg.a.a.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a.a.a, 0u, atomic_result); + wg.a.a.y = 0; + wg.a.a.z = 0; + wg.a.y = 0; + wg.a.z = 0; + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a.a.a, 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + wg.y = 0; + wg.z = 0; + wg.a.x = 0; + wg.a.a.x = 0; + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a.a.a, 0u, atomic_result_2); + wg.a.a.y = 0; + wg.a.a.z = 0; + wg.a.y = 0; + wg.a.z = 0; + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4449c42258 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.fxc.hlsl @@ -0,0 +1,73 @@ +struct S0_atomic { + int x; + uint a; + int y; + int z; +}; +struct S1_atomic { + int x; + S0_atomic a; + int y; + int z; +}; +struct S2_atomic { + int x; + int y; + int z; + S1_atomic a; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S2_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + wg.y = 0; + wg.z = 0; + wg.a.x = 0; + wg.a.a.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a.a.a, 0u, atomic_result); + wg.a.a.y = 0; + wg.a.a.z = 0; + wg.a.y = 0; + wg.a.z = 0; + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a.a.a, 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + wg.y = 0; + wg.z = 0; + wg.a.x = 0; + wg.a.a.x = 0; + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a.a.a, 0u, atomic_result_2); + wg.a.a.y = 0; + wg.a.a.z = 0; + wg.a.y = 0; + wg.a.z = 0; + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.glsl new file mode 100644 index 0000000000..1d63b30d48 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.glsl @@ -0,0 +1,90 @@ +#version 310 es + +struct S0_atomic { + int x; + uint a; + int y; + int z; +}; + +struct S0 { + int x; + uint a; + int y; + int z; +}; + +struct S1_atomic { + int x; + S0_atomic a; + int y; + int z; +}; + +struct S1 { + int x; + S0 a; + int y; + int z; +}; + +struct S2_atomic { + int x; + int y; + int z; + S1_atomic a; +}; + +struct S2 { + int x; + int y; + int z; + S1 a; +}; + +uint local_invocation_index_1 = 0u; +shared S2_atomic wg; +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + wg.y = 0; + wg.z = 0; + wg.a.x = 0; + wg.a.a.x = 0; + atomicExchange(wg.a.a.a, 0u); + wg.a.a.y = 0; + wg.a.a.z = 0; + wg.a.y = 0; + wg.a.z = 0; + barrier(); + atomicExchange(wg.a.a.a, 1u); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + wg.x = 0; + wg.y = 0; + wg.z = 0; + wg.a.x = 0; + wg.a.a.x = 0; + atomicExchange(wg.a.a.a, 0u); + wg.a.a.y = 0; + wg.a.a.z = 0; + wg.a.y = 0; + wg.a.z = 0; + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.msl new file mode 100644 index 0000000000..1ed439c62f --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.msl @@ -0,0 +1,92 @@ +#include + +using namespace metal; +struct S0_atomic { + int x; + atomic_uint a; + int y; + int z; +}; + +struct S0 { + int x; + uint a; + int y; + int z; +}; + +struct S1_atomic { + int x; + S0_atomic a; + int y; + int z; +}; + +struct S1 { + int x; + S0 a; + int y; + int z; +}; + +struct S2_atomic { + int x; + int y; + int z; + S1_atomic a; +}; + +struct S2 { + int x; + int y; + int z; + S1 a; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S2_atomic* const tint_symbol) { + (*(tint_symbol)).x = 0; + (*(tint_symbol)).y = 0; + (*(tint_symbol)).z = 0; + (*(tint_symbol)).a.x = 0; + (*(tint_symbol)).a.a.x = 0; + atomic_store_explicit(&((*(tint_symbol)).a.a.a), 0u, memory_order_relaxed); + (*(tint_symbol)).a.a.y = 0; + (*(tint_symbol)).a.a.z = 0; + (*(tint_symbol)).a.y = 0; + (*(tint_symbol)).a.z = 0; + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a.a.a), 1u, memory_order_relaxed); + return; +} + +void compute_main_1(thread uint* const tint_symbol_1, threadgroup S2_atomic* const tint_symbol_2) { + uint const x_44 = *(tint_symbol_1); + compute_main_inner(x_44, tint_symbol_2); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup S2_atomic* const tint_symbol_3, thread uint* const tint_symbol_4) { + { + (*(tint_symbol_3)).x = 0; + (*(tint_symbol_3)).y = 0; + (*(tint_symbol_3)).z = 0; + (*(tint_symbol_3)).a.x = 0; + (*(tint_symbol_3)).a.a.x = 0; + atomic_store_explicit(&((*(tint_symbol_3)).a.a.a), 0u, memory_order_relaxed); + (*(tint_symbol_3)).a.a.y = 0; + (*(tint_symbol_3)).a.a.z = 0; + (*(tint_symbol_3)).a.y = 0; + (*(tint_symbol_3)).a.z = 0; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup S2_atomic tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.spvasm new file mode 100644 index 0000000000..9f756f397e --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.spvasm @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S2_atomic "S2_atomic" + OpMemberName %S2_atomic 0 "x" + OpMemberName %S2_atomic 1 "y" + OpMemberName %S2_atomic 2 "z" + OpMemberName %S2_atomic 3 "a" + OpName %S1_atomic "S1_atomic" + OpMemberName %S1_atomic 0 "x" + OpMemberName %S1_atomic 1 "a" + OpName %S0_atomic "S0_atomic" + OpMemberName %S0_atomic 0 "x" + OpMemberName %S0_atomic 1 "a" + OpMemberName %S0_atomic 2 "y" + OpMemberName %S0_atomic 3 "z" + OpMemberName %S1_atomic 2 "y" + OpMemberName %S1_atomic 3 "z" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S2_atomic 0 Offset 0 + OpMemberDecorate %S2_atomic 1 Offset 4 + OpMemberDecorate %S2_atomic 2 Offset 8 + OpMemberDecorate %S2_atomic 3 Offset 12 + OpMemberDecorate %S1_atomic 0 Offset 0 + OpMemberDecorate %S1_atomic 1 Offset 4 + OpMemberDecorate %S0_atomic 0 Offset 0 + OpMemberDecorate %S0_atomic 1 Offset 4 + OpMemberDecorate %S0_atomic 2 Offset 8 + OpMemberDecorate %S0_atomic 3 Offset 12 + OpMemberDecorate %S1_atomic 2 Offset 20 + OpMemberDecorate %S1_atomic 3 Offset 24 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 + %S0_atomic = OpTypeStruct %int %uint %int %int + %S1_atomic = OpTypeStruct %int %S0_atomic %int %int + %S2_atomic = OpTypeStruct %int %int %int %S1_atomic +%_ptr_Workgroup_S2_atomic = OpTypePointer Workgroup %S2_atomic + %wg = OpVariable %_ptr_Workgroup_S2_atomic Workgroup + %void = OpTypeVoid + %13 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %21 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %42 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %13 +%local_invocation_index = OpFunctionParameter %uint + %17 = OpLabel + %20 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %20 %21 + %23 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1 + OpStore %23 %21 + %25 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2 + OpStore %25 %21 + %27 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0 + OpStore %27 %21 + %28 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0 + OpStore %28 %21 + %32 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1 + OpAtomicStore %32 %uint_2 %uint_0 %6 + %33 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2 + OpStore %33 %21 + %34 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3 + OpStore %34 %21 + %35 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2 + OpStore %35 %21 + %36 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3 + OpStore %36 %21 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %41 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1 + OpAtomicStore %41 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %42 + %44 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1 + %46 = OpFunctionCall %void %compute_main_inner %45 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %13 +%local_invocation_index_1_param = OpFunctionParameter %uint + %49 = OpLabel + %50 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %50 %21 + %51 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1 + OpStore %51 %21 + %52 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2 + OpStore %52 %21 + %53 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0 + OpStore %53 %21 + %54 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0 + OpStore %54 %21 + %57 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1 + OpAtomicStore %57 %uint_2 %uint_0 %6 + %58 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2 + OpStore %58 %21 + %59 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3 + OpStore %59 %21 + %60 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2 + OpStore %60 %21 + %61 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3 + OpStore %61 %21 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %63 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %42 + %65 = OpLabel + %67 = OpLoad %uint %local_invocation_index_1_param_1 + %66 = OpFunctionCall %void %compute_main_inner_1 %67 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.wgsl b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.wgsl new file mode 100644 index 0000000000..7f3c3b3d60 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.wgsl @@ -0,0 +1,73 @@ +struct S0_atomic { + x : i32, + a : atomic, + y : i32, + z : i32, +} + +struct S0 { + x : i32, + a : u32, + y : i32, + z : i32, +} + +struct S1_atomic { + x : i32, + a : S0_atomic, + y : i32, + z : i32, +} + +struct S1 { + x : i32, + a : S0, + y : i32, + z : i32, +} + +struct S2_atomic { + x : i32, + y : i32, + z : i32, + a : S1_atomic, +} + +struct S2 { + x : i32, + y : i32, + z : i32, + a : S1, +} + +var local_invocation_index_1 : u32; + +var wg : S2_atomic; + +fn compute_main_inner(local_invocation_index : u32) { + wg.x = 0i; + wg.y = 0i; + wg.z = 0i; + wg.a.x = 0i; + wg.a.a.x = 0i; + atomicStore(&(wg.a.a.a), 0u); + wg.a.a.y = 0i; + wg.a.a.z = 0i; + wg.a.y = 0i; + wg.a.z = 0i; + workgroupBarrier(); + atomicStore(&(wg.a.a.a), 1u); + return; +} + +fn compute_main_1() { + let x_44 : u32 = local_invocation_index_1; + compute_main_inner(x_44); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl b/test/tint/builtins/atomicStore/struct/nested.wgsl new file mode 100644 index 0000000000..e6b0abe90c --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.wgsl @@ -0,0 +1,27 @@ +struct S0 { + x : i32, + a : atomic, + y : i32, + z : i32, +}; + +struct S1 { + x : i32, + a : S0, + y : i32, + z : i32, +}; + +struct S2 { + x : i32, + y : i32, + z : i32, + a : S1, +}; + +var wg: S2; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&wg.a.a.a, 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ceb2ff2de --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.dxc.hlsl @@ -0,0 +1,49 @@ +struct S0 { + int x; + uint a; + int y; + int z; +}; +struct S1 { + int x; + S0 a; + int y; + int z; +}; +struct S2 { + int x; + int y; + int z; + S1 a; +}; + +groupshared S2 wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + wg.y = 0; + wg.z = 0; + wg.a.x = 0; + wg.a.a.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a.a.a, 0u, atomic_result); + wg.a.a.y = 0; + wg.a.a.z = 0; + wg.a.y = 0; + wg.a.z = 0; + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a.a.a, 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ceb2ff2de --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.fxc.hlsl @@ -0,0 +1,49 @@ +struct S0 { + int x; + uint a; + int y; + int z; +}; +struct S1 { + int x; + S0 a; + int y; + int z; +}; +struct S2 { + int x; + int y; + int z; + S1 a; +}; + +groupshared S2 wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + wg.y = 0; + wg.z = 0; + wg.a.x = 0; + wg.a.a.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a.a.a, 0u, atomic_result); + wg.a.a.y = 0; + wg.a.a.z = 0; + wg.a.y = 0; + wg.a.z = 0; + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a.a.a, 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.glsl new file mode 100644 index 0000000000..10f210371a --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es + +struct S0 { + int x; + uint a; + int y; + int z; +}; + +struct S1 { + int x; + S0 a; + int y; + int z; +}; + +struct S2 { + int x; + int y; + int z; + S1 a; +}; + +shared S2 wg; +void compute_main(uint local_invocation_index) { + { + wg.x = 0; + wg.y = 0; + wg.z = 0; + wg.a.x = 0; + wg.a.a.x = 0; + atomicExchange(wg.a.a.a, 0u); + wg.a.a.y = 0; + wg.a.a.z = 0; + wg.a.y = 0; + wg.a.z = 0; + } + barrier(); + atomicExchange(wg.a.a.a, 1u); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.msl new file mode 100644 index 0000000000..dbe7cc0854 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.msl @@ -0,0 +1,47 @@ +#include + +using namespace metal; +struct S0 { + int x; + atomic_uint a; + int y; + int z; +}; + +struct S1 { + int x; + S0 a; + int y; + int z; +}; + +struct S2 { + int x; + int y; + int z; + S1 a; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S2* const tint_symbol) { + { + (*(tint_symbol)).x = 0; + (*(tint_symbol)).y = 0; + (*(tint_symbol)).z = 0; + (*(tint_symbol)).a.x = 0; + (*(tint_symbol)).a.a.x = 0; + atomic_store_explicit(&((*(tint_symbol)).a.a.a), 0u, memory_order_relaxed); + (*(tint_symbol)).a.a.y = 0; + (*(tint_symbol)).a.a.z = 0; + (*(tint_symbol)).a.y = 0; + (*(tint_symbol)).a.z = 0; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a.a.a), 1u, memory_order_relaxed); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup S2 tint_symbol_1; + compute_main_inner(local_invocation_index, &(tint_symbol_1)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.spvasm new file mode 100644 index 0000000000..a8aaff3d02 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S2 "S2" + OpMemberName %S2 0 "x" + OpMemberName %S2 1 "y" + OpMemberName %S2 2 "z" + OpMemberName %S2 3 "a" + OpName %S1 "S1" + OpMemberName %S1 0 "x" + OpMemberName %S1 1 "a" + OpName %S0 "S0" + OpMemberName %S0 0 "x" + OpMemberName %S0 1 "a" + OpMemberName %S0 2 "y" + OpMemberName %S0 3 "z" + OpMemberName %S1 2 "y" + OpMemberName %S1 3 "z" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S2 0 Offset 0 + OpMemberDecorate %S2 1 Offset 4 + OpMemberDecorate %S2 2 Offset 8 + OpMemberDecorate %S2 3 Offset 12 + OpMemberDecorate %S1 0 Offset 0 + OpMemberDecorate %S1 1 Offset 4 + OpMemberDecorate %S0 0 Offset 0 + OpMemberDecorate %S0 1 Offset 4 + OpMemberDecorate %S0 2 Offset 8 + OpMemberDecorate %S0 3 Offset 12 + OpMemberDecorate %S1 2 Offset 20 + OpMemberDecorate %S1 3 Offset 24 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S0 = OpTypeStruct %int %uint %int %int + %S1 = OpTypeStruct %int %S0 %int %int + %S2 = OpTypeStruct %int %int %int %S1 +%_ptr_Workgroup_S2 = OpTypePointer Workgroup %S2 + %wg = OpVariable %_ptr_Workgroup_S2 Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %18 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %30 = OpConstantNull %uint + %uint_264 = OpConstant %uint 264 + %40 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %10 +%local_invocation_index = OpFunctionParameter %uint + %14 = OpLabel + %17 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %17 %18 + %20 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1 + OpStore %20 %18 + %22 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2 + OpStore %22 %18 + %24 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0 + OpStore %24 %18 + %25 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0 + OpStore %25 %18 + %29 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1 + OpAtomicStore %29 %uint_2 %uint_0 %30 + %31 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2 + OpStore %31 %18 + %32 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3 + OpStore %32 %18 + %33 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2 + OpStore %33 %18 + %34 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3 + OpStore %34 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %39 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1 + OpAtomicStore %39 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %40 + %42 = OpLabel + %44 = OpLoad %uint %local_invocation_index_1 + %43 = OpFunctionCall %void %compute_main_inner %44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.wgsl b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a9bdac1d6 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +struct S0 { + x : i32, + a : atomic, + y : i32, + z : i32, +} + +struct S1 { + x : i32, + a : S0, + y : i32, + z : i32, +} + +struct S2 { + x : i32, + y : i32, + z : i32, + a : S1, +} + +var wg : S2; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&(wg.a.a.a), 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm new file mode 100644 index 0000000000..9d06d130a0 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpDecorate %_arr_uint_uint_10 ArrayStride 4 + OpMemberDecorate %S 2 Offset 44 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %uint_10 = OpConstant %uint 10 +%_arr_uint_uint_10 = OpTypeArray %uint %uint_10 + %S = OpTypeStruct %int %_arr_uint_uint_10 %uint +%_ptr_Workgroup_S = OpTypePointer Workgroup %S + %wg = OpVariable %_ptr_Workgroup_S Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %18 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %22 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int_4 = OpConstant %int 4 + %49 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %10 +%local_invocation_index = OpFunctionParameter %uint + %14 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %22 + %17 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %17 %18 + %21 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpStore %21 %22 + OpStore %idx %local_invocation_index + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %30 = OpLoad %uint %idx + %31 = OpULessThan %bool %30 %uint_10 + %29 = OpLogicalNot %bool %31 + OpSelectionMerge %33 None + OpBranchConditional %29 %34 %33 + %34 = OpLabel + OpBranch %26 + %33 = OpLabel + %35 = OpLoad %uint %idx + %40 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %35 + OpAtomicStore %40 %uint_2 %uint_0 %22 + OpBranch %27 + %27 = OpLabel + %41 = OpLoad %uint %idx + %42 = OpIAdd %uint %41 %uint_1 + OpStore %idx %42 + OpBranch %25 + %26 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %48 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %int_4 + OpAtomicStore %48 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %49 + %51 = OpLabel + %53 = OpLoad %uint %local_invocation_index_1 + %52 = OpFunctionCall %void %compute_main_inner %53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..beb2810121 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.dxc.hlsl @@ -0,0 +1,57 @@ +struct S_atomic { + int x; + uint a[10]; + uint y; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + wg.x = 0; + wg.y = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 10u))); idx = (idx + 1u)) { + uint atomic_result = 0u; + InterlockedExchange(wg.a[idx], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a[4], 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + wg.y = 0u; + } + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 10u); idx_1 = (idx_1 + 1u)) { + const uint i = idx_1; + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a[i], 0u, atomic_result_2); + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..beb2810121 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.fxc.hlsl @@ -0,0 +1,57 @@ +struct S_atomic { + int x; + uint a[10]; + uint y; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + wg.x = 0; + wg.y = 0u; + idx = local_invocation_index; + { + [loop] for(; !(!((idx < 10u))); idx = (idx + 1u)) { + uint atomic_result = 0u; + InterlockedExchange(wg.a[idx], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a[4], 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + wg.y = 0u; + } + { + [loop] for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 10u); idx_1 = (idx_1 + 1u)) { + const uint i = idx_1; + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a[i], 0u, atomic_result_2); + } + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.glsl new file mode 100644 index 0000000000..0a37b132c8 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.glsl @@ -0,0 +1,57 @@ +#version 310 es + +struct S_atomic { + int x; + uint a[10]; + uint y; +}; + +struct S { + int x; + uint a[10]; + uint y; +}; + +uint local_invocation_index_1 = 0u; +shared S_atomic wg; +void compute_main_inner(uint local_invocation_index) { + uint idx = 0u; + wg.x = 0; + wg.y = 0u; + idx = local_invocation_index; + { + for(; !(!((idx < 10u))); idx = (idx + 1u)) { + atomicExchange(wg.a[idx], 0u); + } + } + barrier(); + atomicExchange(wg.a[4], 1u); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + wg.x = 0; + wg.y = 0u; + } + { + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 10u); idx_1 = (idx_1 + 1u)) { + uint i = idx_1; + atomicExchange(wg.a[i], 0u); + } + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.msl new file mode 100644 index 0000000000..69d565e3d5 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.msl @@ -0,0 +1,77 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct S_atomic { + int x; + tint_array a; + uint y; +}; + +struct S { + int x; + tint_array a; + uint y; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S_atomic* const tint_symbol) { + uint idx = 0u; + (*(tint_symbol)).x = 0; + (*(tint_symbol)).y = 0u; + idx = local_invocation_index; + while (true) { + uint const x_30 = idx; + if (!((x_30 < 10u))) { + break; + } + uint const x_35 = idx; + atomic_store_explicit(&((*(tint_symbol)).a[x_35]), 0u, memory_order_relaxed); + { + uint const x_41 = idx; + idx = (x_41 + 1u); + } + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a[4]), 1u, memory_order_relaxed); + return; +} + +void compute_main_1(thread uint* const tint_symbol_1, threadgroup S_atomic* const tint_symbol_2) { + uint const x_53 = *(tint_symbol_1); + compute_main_inner(x_53, tint_symbol_2); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup S_atomic* const tint_symbol_3, thread uint* const tint_symbol_4) { + { + (*(tint_symbol_3)).x = 0; + (*(tint_symbol_3)).y = 0u; + } + for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 10u); idx_1 = (idx_1 + 1u)) { + uint const i = idx_1; + atomic_store_explicit(&((*(tint_symbol_3)).a[i]), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup S_atomic tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.spvasm new file mode 100644 index 0000000000..d7743741fc --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S_atomic "S_atomic" + OpMemberName %S_atomic 0 "x" + OpMemberName %S_atomic 1 "a" + OpMemberName %S_atomic 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %idx_1 "idx_1" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S_atomic 0 Offset 0 + OpMemberDecorate %S_atomic 1 Offset 4 + OpDecorate %_arr_uint_uint_10 ArrayStride 4 + OpMemberDecorate %S_atomic 2 Offset 44 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 + %uint_10 = OpConstant %uint 10 +%_arr_uint_uint_10 = OpTypeArray %uint %uint_10 + %S_atomic = OpTypeStruct %int %_arr_uint_uint_10 %uint +%_ptr_Workgroup_S_atomic = OpTypePointer Workgroup %S_atomic + %wg = OpVariable %_ptr_Workgroup_S_atomic Workgroup + %void = OpTypeVoid + %13 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %23 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int_4 = OpConstant %int 4 + %51 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %13 +%local_invocation_index = OpFunctionParameter %uint + %17 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %6 + OpStore %idx %6 + %22 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %22 %23 + %26 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpStore %26 %6 + OpStore %idx %local_invocation_index + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %uint %idx + %33 = OpULessThan %bool %31 %uint_10 + %32 = OpLogicalNot %bool %33 + OpSelectionMerge %35 None + OpBranchConditional %32 %36 %35 + %36 = OpLabel + OpBranch %28 + %35 = OpLabel + %37 = OpLoad %uint %idx + %42 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %37 + OpAtomicStore %42 %uint_2 %uint_0 %6 + OpBranch %29 + %29 = OpLabel + %43 = OpLoad %uint %idx + %44 = OpIAdd %uint %43 %uint_1 + OpStore %idx %44 + OpBranch %27 + %28 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %50 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %int_4 + OpAtomicStore %50 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %51 + %53 = OpLabel + %54 = OpLoad %uint %local_invocation_index_1 + %55 = OpFunctionCall %void %compute_main_inner %54 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %13 +%local_invocation_index_1_param = OpFunctionParameter %uint + %58 = OpLabel + %idx_1 = OpVariable %_ptr_Function_uint Function %6 + %59 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %59 %23 + %60 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpStore %60 %6 + OpStore %idx_1 %local_invocation_index_1_param + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %67 = OpLoad %uint %idx_1 + %68 = OpULessThan %bool %67 %uint_10 + %66 = OpLogicalNot %bool %68 + OpSelectionMerge %69 None + OpBranchConditional %66 %70 %69 + %70 = OpLabel + OpBranch %63 + %69 = OpLabel + %71 = OpLoad %uint %idx_1 + %74 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %71 + OpAtomicStore %74 %uint_2 %uint_0 %6 + OpBranch %64 + %64 = OpLabel + %75 = OpLoad %uint %idx_1 + %76 = OpIAdd %uint %75 %uint_1 + OpStore %idx_1 %76 + OpBranch %62 + %63 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %78 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %51 + %80 = OpLabel + %82 = OpLoad %uint %local_invocation_index_1_param_1 + %81 = OpFunctionCall %void %compute_main_inner_1 %82 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.wgsl b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.wgsl new file mode 100644 index 0000000000..f82a9ff493 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.wgsl @@ -0,0 +1,52 @@ +type Arr = array; + +struct S_atomic { + x : i32, + a : array, 10u>, + y : u32, +} + +struct S { + x : i32, + a : Arr, + y : u32, +} + +var local_invocation_index_1 : u32; + +var wg : S_atomic; + +fn compute_main_inner(local_invocation_index : u32) { + var idx : u32 = 0u; + wg.x = 0i; + wg.y = 0u; + idx = local_invocation_index; + loop { + let x_30 : u32 = idx; + if (!((x_30 < 10u))) { + break; + } + let x_35 : u32 = idx; + atomicStore(&(wg.a[x_35]), 0u); + + continuing { + let x_41 : u32 = idx; + idx = (x_41 + 1u); + } + } + workgroupBarrier(); + atomicStore(&(wg.a[4i]), 1u); + return; +} + +fn compute_main_1() { + let x_53 : u32 = local_invocation_index_1; + compute_main_inner(x_53); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl new file mode 100644 index 0000000000..ada3ef5456 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl @@ -0,0 +1,12 @@ +struct S { + x : i32, + a : array, 10>, + y : u32, +}; + +var wg : S; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&wg.a[4], 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..855c198a0f --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +struct S { + int x; + uint a[10]; + uint y; +}; + +groupshared S wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + wg.y = 0u; + } + { + [loop] for(uint idx = local_invocation_index; (idx < 10u); idx = (idx + 1u)) { + const uint i = idx; + uint atomic_result = 0u; + InterlockedExchange(wg.a[i], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a[4], 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..855c198a0f --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +struct S { + int x; + uint a[10]; + uint y; +}; + +groupshared S wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + wg.y = 0u; + } + { + [loop] for(uint idx = local_invocation_index; (idx < 10u); idx = (idx + 1u)) { + const uint i = idx; + uint atomic_result = 0u; + InterlockedExchange(wg.a[i], 0u, atomic_result); + } + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a[4], 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.glsl new file mode 100644 index 0000000000..287b69b79b --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.glsl @@ -0,0 +1,29 @@ +#version 310 es + +struct S { + int x; + uint a[10]; + uint y; +}; + +shared S wg; +void compute_main(uint local_invocation_index) { + { + wg.x = 0; + wg.y = 0u; + } + { + for(uint idx = local_invocation_index; (idx < 10u); idx = (idx + 1u)) { + uint i = idx; + atomicExchange(wg.a[i], 0u); + } + } + barrier(); + atomicExchange(wg.a[4], 1u); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.msl new file mode 100644 index 0000000000..00fa7d560b --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct S { + int x; + tint_array a; + uint y; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S* const tint_symbol) { + { + (*(tint_symbol)).x = 0; + (*(tint_symbol)).y = 0u; + } + for(uint idx = local_invocation_index; (idx < 10u); idx = (idx + 1u)) { + uint const i = idx; + atomic_store_explicit(&((*(tint_symbol)).a[i]), 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a[4]), 1u, memory_order_relaxed); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup S tint_symbol_1; + compute_main_inner(local_invocation_index, &(tint_symbol_1)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d06d130a0 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpDecorate %_arr_uint_uint_10 ArrayStride 4 + OpMemberDecorate %S 2 Offset 44 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %uint_10 = OpConstant %uint 10 +%_arr_uint_uint_10 = OpTypeArray %uint %uint_10 + %S = OpTypeStruct %int %_arr_uint_uint_10 %uint +%_ptr_Workgroup_S = OpTypePointer Workgroup %S + %wg = OpVariable %_ptr_Workgroup_S Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %18 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %22 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %int_4 = OpConstant %int 4 + %49 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %10 +%local_invocation_index = OpFunctionParameter %uint + %14 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %22 + %17 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %17 %18 + %21 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2 + OpStore %21 %22 + OpStore %idx %local_invocation_index + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %30 = OpLoad %uint %idx + %31 = OpULessThan %bool %30 %uint_10 + %29 = OpLogicalNot %bool %31 + OpSelectionMerge %33 None + OpBranchConditional %29 %34 %33 + %34 = OpLabel + OpBranch %26 + %33 = OpLabel + %35 = OpLoad %uint %idx + %40 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %35 + OpAtomicStore %40 %uint_2 %uint_0 %22 + OpBranch %27 + %27 = OpLabel + %41 = OpLoad %uint %idx + %42 = OpIAdd %uint %41 %uint_1 + OpStore %idx %42 + OpBranch %25 + %26 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %48 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %int_4 + OpAtomicStore %48 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %49 + %51 = OpLabel + %53 = OpLoad %uint %local_invocation_index_1 + %52 = OpFunctionCall %void %compute_main_inner %53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.wgsl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.wgsl new file mode 100644 index 0000000000..793d8c8c66 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +struct S { + x : i32, + a : array, 10>, + y : u32, +} + +var wg : S; + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore(&(wg.a[4]), 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm new file mode 100644 index 0000000000..acad988c5f --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %uint %uint +%_ptr_Workgroup_S = OpTypePointer Workgroup %S + %wg = OpVariable %_ptr_Workgroup_S Workgroup + %void = OpTypeVoid + %8 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %16 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %23 = OpConstantNull %uint +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %31 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %8 +%local_invocation_index = OpFunctionParameter %uint + %12 = OpLabel + %15 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %15 %16 + %22 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %22 %uint_2 %uint_0 %23 + %25 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2 + OpStore %25 %23 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %30 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %31 + %33 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..403d1fb811 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +struct S_atomic { + int x; + uint a; + uint y; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + wg.y = 0u; + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a, 0u, atomic_result_2); + wg.y = 0u; + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..403d1fb811 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +struct S_atomic { + int x; + uint a; + uint y; +}; + +static uint local_invocation_index_1 = 0u; +groupshared S_atomic wg; + +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + wg.y = 0u; + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_1); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + wg.x = 0; + uint atomic_result_2 = 0u; + InterlockedExchange(wg.a, 0u, atomic_result_2); + wg.y = 0u; + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.glsl new file mode 100644 index 0000000000..2b03ef6772 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es + +struct S_atomic { + int x; + uint a; + uint y; +}; + +struct S { + int x; + uint a; + uint y; +}; + +uint local_invocation_index_1 = 0u; +shared S_atomic wg; +void compute_main_inner(uint local_invocation_index) { + wg.x = 0; + atomicExchange(wg.a, 0u); + wg.y = 0u; + barrier(); + atomicExchange(wg.a, 1u); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + wg.x = 0; + atomicExchange(wg.a, 0u); + wg.y = 0u; + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.msl new file mode 100644 index 0000000000..524820aff7 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct S_atomic { + int x; + atomic_uint a; + uint y; +}; + +struct S { + int x; + uint a; + uint y; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S_atomic* const tint_symbol) { + (*(tint_symbol)).x = 0; + atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed); + (*(tint_symbol)).y = 0u; + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a), 1u, memory_order_relaxed); + return; +} + +void compute_main_1(thread uint* const tint_symbol_1, threadgroup S_atomic* const tint_symbol_2) { + uint const x_35 = *(tint_symbol_1); + compute_main_inner(x_35, tint_symbol_2); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup S_atomic* const tint_symbol_3, thread uint* const tint_symbol_4) { + { + (*(tint_symbol_3)).x = 0; + atomic_store_explicit(&((*(tint_symbol_3)).a), 0u, memory_order_relaxed); + (*(tint_symbol_3)).y = 0u; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup S_atomic tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.spvasm new file mode 100644 index 0000000000..35d0d2b420 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S_atomic "S_atomic" + OpMemberName %S_atomic 0 "x" + OpMemberName %S_atomic 1 "a" + OpMemberName %S_atomic 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S_atomic 0 Offset 0 + OpMemberDecorate %S_atomic 1 Offset 4 + OpMemberDecorate %S_atomic 2 Offset 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 + %S_atomic = OpTypeStruct %int %uint %uint +%_ptr_Workgroup_S_atomic = OpTypePointer Workgroup %S_atomic + %wg = OpVariable %_ptr_Workgroup_S_atomic Workgroup + %void = OpTypeVoid + %11 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %19 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %33 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %11 +%local_invocation_index = OpFunctionParameter %uint + %15 = OpLabel + %18 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %18 %19 + %25 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %25 %uint_2 %uint_0 %6 + %27 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2 + OpStore %27 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %32 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %33 + %35 = OpLabel + %36 = OpLoad %uint %local_invocation_index_1 + %37 = OpFunctionCall %void %compute_main_inner %36 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %11 +%local_invocation_index_1_param = OpFunctionParameter %uint + %40 = OpLabel + %41 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %41 %19 + %44 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %44 %uint_2 %uint_0 %6 + %45 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2 + OpStore %45 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %47 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %33 + %49 = OpLabel + %51 = OpLoad %uint %local_invocation_index_1_param_1 + %50 = OpFunctionCall %void %compute_main_inner_1 %51 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.wgsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.wgsl new file mode 100644 index 0000000000..2d90f56850 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct S_atomic { + x : i32, + a : atomic, + y : u32, +} + +struct S { + x : i32, + a : u32, + y : u32, +} + +var local_invocation_index_1 : u32; + +var wg : S_atomic; + +fn compute_main_inner(local_invocation_index : u32) { + wg.x = 0i; + atomicStore(&(wg.a), 0u); + wg.y = 0u; + workgroupBarrier(); + atomicStore(&(wg.a), 1u); + return; +} + +fn compute_main_1() { + let x_35 : u32 = local_invocation_index_1; + compute_main_inner(x_35); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl new file mode 100644 index 0000000000..64eeb6509e --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl @@ -0,0 +1,14 @@ +struct S { + x : i32, + a : atomic, + y : u32, +}; + +var wg : S; + +@compute @workgroup_size(1) +fn compute_main() { + let p0 = &wg; + let p1 = &((*p0).a); + atomicStore(p1, 1u); +} diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fb93daa369 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.dxc.hlsl @@ -0,0 +1,29 @@ +struct S { + int x; + uint a; + uint y; +}; + +groupshared S wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + wg.y = 0u; + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fb93daa369 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.fxc.hlsl @@ -0,0 +1,29 @@ +struct S { + int x; + uint a; + uint y; +}; + +groupshared S wg; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + wg.x = 0; + uint atomic_result = 0u; + InterlockedExchange(wg.a, 0u, atomic_result); + wg.y = 0u; + } + GroupMemoryBarrierWithGroupSync(); + uint atomic_result_1 = 0u; + InterlockedExchange(wg.a, 1u, atomic_result_1); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.glsl new file mode 100644 index 0000000000..39f13a5880 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.glsl @@ -0,0 +1,24 @@ +#version 310 es + +struct S { + int x; + uint a; + uint y; +}; + +shared S wg; +void compute_main(uint local_invocation_index) { + { + wg.x = 0; + atomicExchange(wg.a, 0u); + wg.y = 0u; + } + barrier(); + atomicExchange(wg.a, 1u); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.msl new file mode 100644 index 0000000000..ccec811b27 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.msl @@ -0,0 +1,25 @@ +#include + +using namespace metal; +struct S { + int x; + atomic_uint a; + uint y; +}; + +void compute_main_inner(uint local_invocation_index, threadgroup S* const tint_symbol) { + { + (*(tint_symbol)).x = 0; + atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed); + (*(tint_symbol)).y = 0u; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomic_store_explicit(&((*(tint_symbol)).a), 1u, memory_order_relaxed); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup S tint_symbol_1; + compute_main_inner(local_invocation_index, &(tint_symbol_1)); + return; +} + diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.spvasm new file mode 100644 index 0000000000..acad988c5f --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.spvasm @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "a" + OpMemberName %S 2 "y" + OpName %wg "wg" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %uint %uint +%_ptr_Workgroup_S = OpTypePointer Workgroup %S + %wg = OpVariable %_ptr_Workgroup_S Workgroup + %void = OpTypeVoid + %8 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %16 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %23 = OpConstantNull %uint +%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint + %uint_264 = OpConstant %uint 264 + %31 = OpTypeFunction %void +%compute_main_inner = OpFunction %void None %8 +%local_invocation_index = OpFunctionParameter %uint + %12 = OpLabel + %15 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0 + OpStore %15 %16 + %22 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %22 %uint_2 %uint_0 %23 + %25 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2 + OpStore %25 %23 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1 + OpAtomicStore %30 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %31 + %33 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.wgsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.wgsl new file mode 100644 index 0000000000..5076b67e18 --- /dev/null +++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +struct S { + x : i32, + a : atomic, + y : u32, +} + +var wg : S; + +@compute @workgroup_size(1) +fn compute_main() { + let p0 = &(wg); + let p1 = &((*(p0)).a); + atomicStore(p1, 1u); +} diff --git a/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..358487bedc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int res = 0; + const int x_9 = tint_atomicAdd(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..358487bedc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int res = 0; + const int x_9 = tint_atomicAdd(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..875dc0857f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int res = 0; + int x_9 = atomicAdd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int res = 0; + int x_9 = atomicAdd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..64027ff549 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicAdd_d32fe4(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_d32fe4(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_d32fe4(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..13f287aef1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicIAdd %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..cfc64fbba6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_d32fe4() { + var res : i32 = 0i; + let x_9 : i32 = atomicAdd(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..bdc43b0733 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint res = 0u; + const uint x_9 = tint_atomicAdd(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..bdc43b0733 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint res = 0u; + const uint x_9 = tint_atomicAdd(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..48a073514d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint res = 0u; + uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint res = 0u; + uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..fa2343bc6a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicAdd_8a199a(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_8a199a(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_8a199a(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..e1bf1e996e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicIAdd %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..b5d5856764 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_8a199a() { + var res : u32 = 0u; + let x_9 : u32 = atomicAdd(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_8a199a(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..ccdf1ad871 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int res = 0; + int atomic_result = 0; + InterlockedAdd(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..ccdf1ad871 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int res = 0; + int atomic_result = 0; + InterlockedAdd(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..b745861ae2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicAdd_794055() { + int res = 0; + int x_11 = atomicAdd(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..62639d7b4a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_fetch_add_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_794055(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..3dc0a5d301 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..723a1135af --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_794055() { + var res : i32 = 0i; + let x_11 : i32 = atomicAdd(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicAdd_794055(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..c36ae576b3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..c36ae576b3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..97c0c6f4d8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicAdd_d5db1d() { + uint res = 0u; + uint x_10 = atomicAdd(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..04a890a74c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_fetch_add_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_d5db1d(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..5daee6404f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..61d34ccb7b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_d5db1d() { + var res : u32 = 0u; + let x_10 : u32 = atomicAdd(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicAdd_d5db1d(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..0cc23ee686 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_152966() { + int res = 0; + const int x_9 = tint_atomicAnd(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAnd_152966(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAnd_152966(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..0cc23ee686 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_152966() { + int res = 0; + const int x_9 = tint_atomicAnd(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAnd_152966(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAnd_152966(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..28adfe0175 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAnd_152966() { + int res = 0; + int x_9 = atomicAnd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAnd_152966(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAnd_152966() { + int res = 0; + int x_9 = atomicAnd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicAnd_152966(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..919a4e12d5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicAnd_152966(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAnd_152966(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAnd_152966(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..0c6eb12ea0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_152966 "atomicAnd_152966" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicAnd_152966 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicAnd %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..c76ec1b616 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAnd_152966() { + var res : i32 = 0i; + let x_9 : i32 = atomicAnd(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicAnd_152966(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAnd_152966(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..897165d2a2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_85a8d9() { + uint res = 0u; + const uint x_9 = tint_atomicAnd(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAnd_85a8d9(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAnd_85a8d9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..897165d2a2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_85a8d9() { + uint res = 0u; + const uint x_9 = tint_atomicAnd(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAnd_85a8d9(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAnd_85a8d9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..6d879c1d3a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAnd_85a8d9() { + uint res = 0u; + uint x_9 = atomicAnd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAnd_85a8d9(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAnd_85a8d9() { + uint res = 0u; + uint x_9 = atomicAnd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicAnd_85a8d9(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..2589380d01 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicAnd_85a8d9(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAnd_85a8d9(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAnd_85a8d9(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..25da8d5d1c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_85a8d9 "atomicAnd_85a8d9" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAnd_85a8d9 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicAnd %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..2f8f4591c5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAnd_85a8d9() { + var res : u32 = 0u; + let x_9 : u32 = atomicAnd(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicAnd_85a8d9(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAnd_85a8d9(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..2e8671392c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAnd_45a819() { + int res = 0; + int atomic_result = 0; + InterlockedAnd(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAnd_45a819(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..2e8671392c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAnd_45a819() { + int res = 0; + int atomic_result = 0; + InterlockedAnd(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAnd_45a819(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..f914b2fc53 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicAnd_45a819() { + int res = 0; + int x_11 = atomicAnd(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicAnd_45a819(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..ee4b602e3f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicAnd_45a819(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_fetch_and_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_45a819(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..b7e9939338 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_45a819 "atomicAnd_45a819" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_45a819 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicAnd_45a819 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..9369271687 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAnd_45a819() { + var res : i32 = 0i; + let x_11 : i32 = atomicAnd(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicAnd_45a819(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..fb9b51677b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAnd_34edd3() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAnd(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAnd_34edd3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..fb9b51677b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAnd_34edd3() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAnd(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAnd_34edd3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..92c68d7e52 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicAnd_34edd3() { + uint res = 0u; + uint x_10 = atomicAnd(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicAnd_34edd3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..ffc5ace33c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicAnd_34edd3(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_fetch_and_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_34edd3(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..02a5b899e1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_34edd3 "atomicAnd_34edd3" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_34edd3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAnd_34edd3 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..ee27cf61cc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAnd_34edd3() { + var res : u32 = 0u; + let x_10 : u32 = atomicAnd(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicAnd_34edd3(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm new file mode 100644 index 0000000000..454abb1a57 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_1bd40a "atomicCompareExchangeWeak_1bd40a" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %23 = OpConstantNull %__atomic_compare_exchange_resulti32 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %23 + %17 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %19 = OpAtomicCompareExchange %int %17 %uint_1 %uint_0 %uint_0 %int_1 %int_1 + %20 = OpIEqual %bool %19 %int_1 + %9 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %19 %20 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..d818bce03f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,50 @@ +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_1bd40a() { + x__atomic_compare_exchange_resulti32 res = (x__atomic_compare_exchange_resulti32)0; + const atomic_compare_exchange_weak_ret_type tint_symbol = tint_atomicCompareExchangeWeak(sb_rw, 0u, 1, 1); + const int old_value_1 = tint_symbol.old_value; + const int x_19 = old_value_1; + const x__atomic_compare_exchange_resulti32 tint_symbol_1 = {x_19, (x_19 == 1)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..d818bce03f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,50 @@ +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_1bd40a() { + x__atomic_compare_exchange_resulti32 res = (x__atomic_compare_exchange_resulti32)0; + const atomic_compare_exchange_weak_ret_type tint_symbol = tint_atomicCompareExchangeWeak(sb_rw, 0u, 1, 1); + const int old_value_1 = tint_symbol.old_value; + const int x_19 = old_value_1; + const x__atomic_compare_exchange_resulti32 tint_symbol_1 = {x_19, (x_19 == 1)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..b46c227b77 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl @@ -0,0 +1,102 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; + atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; + int old_value_1 = tint_symbol.old_value; + int x_19 = old_value_1; + x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_19, (x_19 == 1)); + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; + atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; + int old_value_1 = tint_symbol.old_value; + int x_19 = old_value_1; + x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_19, (x_19 == 1)); + res = tint_symbol_1; + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..c4f2e90ddf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(device atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +void atomicCompareExchangeWeak_1bd40a(device SB_RW_atomic* const tint_symbol_2) { + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32{}; + atomic_compare_exchange_resulti32 const tint_symbol = atomicCompareExchangeWeak_1(&((*(tint_symbol_2)).arg_0), 1, 1); + int const old_value_1 = tint_symbol.old_value; + int const x_19 = old_value_1; + x__atomic_compare_exchange_resulti32 const tint_symbol_1 = {.old_value=x_19, .exchanged=(x_19 == 1)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_3); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + fragment_main_1(tint_symbol_4); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_5) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_5); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_6 [[buffer(0)]]) { + compute_main_1(tint_symbol_6); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..f32384324b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_1bd40a "atomicCompareExchangeWeak_1bd40a" + OpName %x__atomic_compare_exchange_resulti32 "x__atomic_compare_exchange_resulti32" + OpMemberName %x__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %x__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %x__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %x__atomic_compare_exchange_resulti32 1 Offset 4 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool +%x__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %11 = OpConstantNull %x__atomic_compare_exchange_resulti32 +%_ptr_Function_x__atomic_compare_exchange_resulti32 = OpTypePointer Function %x__atomic_compare_exchange_resulti32 +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %11 + OpStore %res %11 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %23 = OpAtomicCompareExchange %int %21 %uint_1 %uint_0 %uint_0 %int_1 %int_1 + %24 = OpIEqual %bool %23 %int_1 + %14 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %23 %24 + %25 = OpCompositeExtract %int %14 0 + %26 = OpIEqual %bool %25 %int_1 + %27 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %25 %26 + OpStore %res %27 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %35 = OpLabel + %36 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %38 = OpLabel + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..cf8754d81a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +struct x__atomic_compare_exchange_resulti32 { + old_value : i32, + exchanged : bool, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicCompareExchangeWeak_1bd40a() { + var res : x__atomic_compare_exchange_resulti32 = x__atomic_compare_exchange_resulti32(0i, false); + let old_value_1 = atomicCompareExchangeWeak(&(sb_rw.arg_0), 1i, 1i).old_value; + let x_19 : i32 = old_value_1; + res = x__atomic_compare_exchange_resulti32(x_19, (x_19 == 1i)); + return; +} + +fn fragment_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm new file mode 100644 index 0000000000..09e83a0ae1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_63d8e6 "atomicCompareExchangeWeak_63d8e6" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %21 = OpConstantNull %__atomic_compare_exchange_resultu32 +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %21 + %16 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %17 = OpAtomicCompareExchange %uint %16 %uint_1 %uint_0 %uint_0 %uint_1 %uint_1 + %18 = OpIEqual %bool %17 %uint_1 + %9 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %17 %18 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..5d1bfd65dd --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,50 @@ +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_63d8e6() { + x__atomic_compare_exchange_resultu32 res = (x__atomic_compare_exchange_resultu32)0; + const atomic_compare_exchange_weak_ret_type tint_symbol = tint_atomicCompareExchangeWeak(sb_rw, 0u, 1u, 1u); + const uint old_value_1 = tint_symbol.old_value; + const uint x_17 = old_value_1; + const x__atomic_compare_exchange_resultu32 tint_symbol_1 = {x_17, (x_17 == 1u)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..5d1bfd65dd --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,50 @@ +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_63d8e6() { + x__atomic_compare_exchange_resultu32 res = (x__atomic_compare_exchange_resultu32)0; + const atomic_compare_exchange_weak_ret_type tint_symbol = tint_atomicCompareExchangeWeak(sb_rw, 0u, 1u, 1u); + const uint old_value_1 = tint_symbol.old_value; + const uint x_17 = old_value_1; + const x__atomic_compare_exchange_resultu32 tint_symbol_1 = {x_17, (x_17 == 1u)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..385735d724 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl @@ -0,0 +1,102 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1u, 1u); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; + atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; + uint old_value_1 = tint_symbol.old_value; + uint x_17 = old_value_1; + x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_17, (x_17 == 1u)); + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1u, 1u); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; + atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; + uint old_value_1 = tint_symbol.old_value; + uint x_17 = old_value_1; + x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_17, (x_17 == 1u)); + res = tint_symbol_1; + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..dae3d285ea --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(device atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +void atomicCompareExchangeWeak_63d8e6(device SB_RW_atomic* const tint_symbol_2) { + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32{}; + atomic_compare_exchange_resultu32 const tint_symbol = atomicCompareExchangeWeak_1(&((*(tint_symbol_2)).arg_0), 1u, 1u); + uint const old_value_1 = tint_symbol.old_value; + uint const x_17 = old_value_1; + x__atomic_compare_exchange_resultu32 const tint_symbol_1 = {.old_value=x_17, .exchanged=(x_17 == 1u)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_3); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + fragment_main_1(tint_symbol_4); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_5) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_5); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_6 [[buffer(0)]]) { + compute_main_1(tint_symbol_6); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..2070e93cf2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_63d8e6 "atomicCompareExchangeWeak_63d8e6" + OpName %x__atomic_compare_exchange_resultu32 "x__atomic_compare_exchange_resultu32" + OpMemberName %x__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %x__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %x__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %x__atomic_compare_exchange_resultu32 1 Offset 4 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool +%x__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %11 = OpConstantNull %x__atomic_compare_exchange_resultu32 +%_ptr_Function_x__atomic_compare_exchange_resultu32 = OpTypePointer Function %x__atomic_compare_exchange_resultu32 +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %11 + OpStore %res %11 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %21 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %uint_1 %uint_1 + %22 = OpIEqual %bool %21 %uint_1 + %14 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %21 %22 + %23 = OpCompositeExtract %uint %14 0 + %24 = OpIEqual %bool %23 %uint_1 + %25 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %23 %24 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %33 = OpLabel + %34 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %36 = OpLabel + %37 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..4382a2338c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +struct x__atomic_compare_exchange_resultu32 { + old_value : u32, + exchanged : bool, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicCompareExchangeWeak_63d8e6() { + var res : x__atomic_compare_exchange_resultu32 = x__atomic_compare_exchange_resultu32(0u, false); + let old_value_1 = atomicCompareExchangeWeak(&(sb_rw.arg_0), 1u, 1u).old_value; + let x_17 : u32 = old_value_1; + res = x__atomic_compare_exchange_resultu32(x_17, (x_17 == 1u)); + return; +} + +fn fragment_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm new file mode 100644 index 0000000000..a0f338c664 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_e88938 "atomicCompareExchangeWeak_e88938" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %22 = OpConstantNull %__atomic_compare_exchange_resulti32 + %23 = OpTypeFunction %void %uint + %29 = OpConstantNull %int + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_e88938 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %22 + %18 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %int_1 %int_1 + %19 = OpIEqual %bool %18 %int_1 + %11 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %18 %19 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %23 +%local_invocation_index = OpFunctionParameter %uint + %26 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %29 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %34 = OpLabel + %36 = OpLoad %uint %local_invocation_index_1 + %35 = OpFunctionCall %void %compute_main_inner %36 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..dae580e222 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,58 @@ +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicCompareExchangeWeak_e88938() { + x__atomic_compare_exchange_resulti32 res = (x__atomic_compare_exchange_resulti32)0; + atomic_compare_exchange_resulti32 atomic_result = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value = 1; + InterlockedCompareExchange(arg_0, atomic_compare_value, 1, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + const atomic_compare_exchange_resulti32 tint_symbol_2 = atomic_result; + const int old_value_1 = tint_symbol_2.old_value; + const int x_18 = old_value_1; + const x__atomic_compare_exchange_resulti32 tint_symbol_3 = {x_18, (x_18 == 1)}; + res = tint_symbol_3; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_e88938(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..dae580e222 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,58 @@ +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicCompareExchangeWeak_e88938() { + x__atomic_compare_exchange_resulti32 res = (x__atomic_compare_exchange_resulti32)0; + atomic_compare_exchange_resulti32 atomic_result = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value = 1; + InterlockedCompareExchange(arg_0, atomic_compare_value, 1, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + const atomic_compare_exchange_resulti32 tint_symbol_2 = atomic_result; + const int old_value_1 = tint_symbol_2.old_value; + const int x_18 = old_value_1; + const x__atomic_compare_exchange_resulti32 tint_symbol_3 = {x_18, (x_18 == 1)}; + res = tint_symbol_3; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_e88938(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..6ccd038883 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,54 @@ +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicCompareExchangeWeak_e88938() { + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, 1, 1); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; + atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; + int old_value_1 = tint_symbol.old_value; + int x_18 = old_value_1; + x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_18, (x_18 == 1)); + res = tint_symbol_1; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicCompareExchangeWeak_e88938(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..a296185998 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(threadgroup atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol_2) { + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32{}; + atomic_compare_exchange_resulti32 const tint_symbol = atomicCompareExchangeWeak_1(tint_symbol_2, 1, 1); + int const old_value_1 = tint_symbol.old_value; + int const x_18 = old_value_1; + x__atomic_compare_exchange_resulti32 const tint_symbol_1 = {.old_value=x_18, .exchanged=(x_18 == 1)}; + res = tint_symbol_1; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_3) { + atomic_store_explicit(tint_symbol_3, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_e88938(tint_symbol_3); + return; +} + +void compute_main_1(thread uint* const tint_symbol_4, threadgroup atomic_int* const tint_symbol_5) { + uint const x_36 = *(tint_symbol_4); + compute_main_inner(x_36, tint_symbol_5); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_6, thread uint* const tint_symbol_7) { + { + atomic_store_explicit(tint_symbol_6, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_7) = local_invocation_index_1_param; + compute_main_1(tint_symbol_7, tint_symbol_6); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_8; + thread uint tint_symbol_9 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_8), &(tint_symbol_9)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..f82b2cb51c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_e88938 "atomicCompareExchangeWeak_e88938" + OpName %x__atomic_compare_exchange_resulti32 "x__atomic_compare_exchange_resulti32" + OpMemberName %x__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %x__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %x__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %x__atomic_compare_exchange_resulti32 1 Offset 4 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %bool = OpTypeBool +%x__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %16 = OpConstantNull %x__atomic_compare_exchange_resulti32 +%_ptr_Function_x__atomic_compare_exchange_resulti32 = OpTypePointer Function %x__atomic_compare_exchange_resulti32 +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %30 = OpTypeFunction %void %uint + %36 = OpConstantNull %int + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_e88938 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %16 + OpStore %res %16 + %25 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %int_1 %int_1 + %26 = OpIEqual %bool %25 %int_1 + %19 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %25 %26 + %27 = OpCompositeExtract %int %19 0 + %28 = OpIEqual %bool %27 %int_1 + %29 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %27 %28 + OpStore %res %29 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %30 +%local_invocation_index = OpFunctionParameter %uint + %33 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %36 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %39 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %41 = OpLabel + %42 = OpLoad %uint %local_invocation_index_1 + %43 = OpFunctionCall %void %compute_main_inner %42 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %30 +%local_invocation_index_1_param = OpFunctionParameter %uint + %46 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %36 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %50 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %52 = OpLabel + %54 = OpLoad %uint %local_invocation_index_1_param_1 + %53 = OpFunctionCall %void %compute_main_inner_1 %54 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..349dccfe6a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,35 @@ +struct x__atomic_compare_exchange_resulti32 { + old_value : i32, + exchanged : bool, +} + +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_e88938() { + var res : x__atomic_compare_exchange_resulti32 = x__atomic_compare_exchange_resulti32(0i, false); + let old_value_1 = atomicCompareExchangeWeak(&(arg_0), 1i, 1i).old_value; + let x_18 : i32 = old_value_1; + res = x__atomic_compare_exchange_resulti32(x_18, (x_18 == 1i)); + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicCompareExchangeWeak_e88938(); + return; +} + +fn compute_main_1() { + let x_36 : u32 = local_invocation_index_1; + compute_main_inner(x_36); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm new file mode 100644 index 0000000000..826498596a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_83580d "atomicCompareExchangeWeak_83580d" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %21 = OpConstantNull %__atomic_compare_exchange_resultu32 + %22 = OpTypeFunction %void %uint + %28 = OpConstantNull %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_83580d = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %21 + %17 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %uint_1 %uint_1 + %18 = OpIEqual %bool %17 %uint_1 + %10 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %17 %18 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %28 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %31 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..b4fbb77cee --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,58 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicCompareExchangeWeak_83580d() { + x__atomic_compare_exchange_resultu32 res = (x__atomic_compare_exchange_resultu32)0; + atomic_compare_exchange_resultu32 atomic_result = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = 1u; + InterlockedCompareExchange(arg_0, atomic_compare_value, 1u, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + const atomic_compare_exchange_resultu32 tint_symbol_2 = atomic_result; + const uint old_value_1 = tint_symbol_2.old_value; + const uint x_17 = old_value_1; + const x__atomic_compare_exchange_resultu32 tint_symbol_3 = {x_17, (x_17 == 1u)}; + res = tint_symbol_3; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_83580d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b4fbb77cee --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,58 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicCompareExchangeWeak_83580d() { + x__atomic_compare_exchange_resultu32 res = (x__atomic_compare_exchange_resultu32)0; + atomic_compare_exchange_resultu32 atomic_result = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = 1u; + InterlockedCompareExchange(arg_0, atomic_compare_value, 1u, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + const atomic_compare_exchange_resultu32 tint_symbol_2 = atomic_result; + const uint old_value_1 = tint_symbol_2.old_value; + const uint x_17 = old_value_1; + const x__atomic_compare_exchange_resultu32 tint_symbol_3 = {x_17, (x_17 == 1u)}; + res = tint_symbol_3; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_83580d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..7bd1617e29 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,54 @@ +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicCompareExchangeWeak_83580d() { + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, 1u, 1u); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; + atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; + uint old_value_1 = tint_symbol.old_value; + uint x_17 = old_value_1; + x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_17, (x_17 == 1u)); + res = tint_symbol_1; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicCompareExchangeWeak_83580d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..c980f5d9d9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(threadgroup atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol_2) { + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32{}; + atomic_compare_exchange_resultu32 const tint_symbol = atomicCompareExchangeWeak_1(tint_symbol_2, 1u, 1u); + uint const old_value_1 = tint_symbol.old_value; + uint const x_17 = old_value_1; + x__atomic_compare_exchange_resultu32 const tint_symbol_1 = {.old_value=x_17, .exchanged=(x_17 == 1u)}; + res = tint_symbol_1; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_3) { + atomic_store_explicit(tint_symbol_3, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_83580d(tint_symbol_3); + return; +} + +void compute_main_1(thread uint* const tint_symbol_4, threadgroup atomic_uint* const tint_symbol_5) { + uint const x_35 = *(tint_symbol_4); + compute_main_inner(x_35, tint_symbol_5); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_6, thread uint* const tint_symbol_7) { + { + atomic_store_explicit(tint_symbol_6, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_7) = local_invocation_index_1_param; + compute_main_1(tint_symbol_7, tint_symbol_6); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_8; + thread uint tint_symbol_9 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_8), &(tint_symbol_9)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..9c927f23b0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_83580d "atomicCompareExchangeWeak_83580d" + OpName %x__atomic_compare_exchange_resultu32 "x__atomic_compare_exchange_resultu32" + OpMemberName %x__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %x__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %x__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %x__atomic_compare_exchange_resultu32 1 Offset 4 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool +%x__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %15 = OpConstantNull %x__atomic_compare_exchange_resultu32 +%_ptr_Function_x__atomic_compare_exchange_resultu32 = OpTypePointer Function %x__atomic_compare_exchange_resultu32 +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %29 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_83580d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %15 + OpStore %res %15 + %24 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %uint_1 %uint_1 + %25 = OpIEqual %bool %24 %uint_1 + %18 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %24 %25 + %26 = OpCompositeExtract %uint %18 0 + %27 = OpIEqual %bool %26 %uint_1 + %28 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %26 %27 + OpStore %res %28 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %29 +%local_invocation_index = OpFunctionParameter %uint + %32 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %37 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %39 = OpLabel + %40 = OpLoad %uint %local_invocation_index_1 + %41 = OpFunctionCall %void %compute_main_inner %40 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %29 +%local_invocation_index_1_param = OpFunctionParameter %uint + %44 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %48 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %50 = OpLabel + %52 = OpLoad %uint %local_invocation_index_1_param_1 + %51 = OpFunctionCall %void %compute_main_inner_1 %52 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..9c897f96b9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,35 @@ +struct x__atomic_compare_exchange_resultu32 { + old_value : u32, + exchanged : bool, +} + +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_83580d() { + var res : x__atomic_compare_exchange_resultu32 = x__atomic_compare_exchange_resultu32(0u, false); + let old_value_1 = atomicCompareExchangeWeak(&(arg_0), 1u, 1u).old_value; + let x_17 : u32 = old_value_1; + res = x__atomic_compare_exchange_resultu32(x_17, (x_17 == 1u)); + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicCompareExchangeWeak_83580d(); + return; +} + +fn compute_main_1() { + let x_35 : u32 = local_invocation_index_1; + compute_main_inner(x_35); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..deffe11da8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_f2e22f() { + int res = 0; + const int x_9 = tint_atomicExchange(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicExchange_f2e22f(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicExchange_f2e22f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..deffe11da8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_f2e22f() { + int res = 0; + const int x_9 = tint_atomicExchange(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicExchange_f2e22f(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicExchange_f2e22f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..4fdae2725f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicExchange_f2e22f() { + int res = 0; + int x_9 = atomicExchange(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicExchange_f2e22f(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicExchange_f2e22f() { + int res = 0; + int x_9 = atomicExchange(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicExchange_f2e22f(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..cbd9391ad0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicExchange_f2e22f(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicExchange_f2e22f(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicExchange_f2e22f(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..10fd286e8a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_f2e22f "atomicExchange_f2e22f" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicExchange_f2e22f = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicExchange %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..625f2c3a43 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicExchange_f2e22f() { + var res : i32 = 0i; + let x_9 : i32 = atomicExchange(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicExchange_f2e22f(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicExchange_f2e22f(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..7b20c963fd --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_d59712() { + uint res = 0u; + const uint x_9 = tint_atomicExchange(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicExchange_d59712(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicExchange_d59712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..7b20c963fd --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_d59712() { + uint res = 0u; + const uint x_9 = tint_atomicExchange(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicExchange_d59712(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicExchange_d59712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..57f02915fa --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicExchange_d59712() { + uint res = 0u; + uint x_9 = atomicExchange(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicExchange_d59712(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicExchange_d59712() { + uint res = 0u; + uint x_9 = atomicExchange(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicExchange_d59712(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..06d01b5a36 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicExchange_d59712(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicExchange_d59712(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicExchange_d59712(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..d282cbfdfd --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_d59712 "atomicExchange_d59712" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicExchange_d59712 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicExchange %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..e80aa80578 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicExchange_d59712() { + var res : u32 = 0u; + let x_9 : u32 = atomicExchange(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicExchange_d59712(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicExchange_d59712(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..b994cfefdb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicExchange_e114ba() { + int res = 0; + int atomic_result = 0; + InterlockedExchange(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicExchange_e114ba(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b994cfefdb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicExchange_e114ba() { + int res = 0; + int atomic_result = 0; + InterlockedExchange(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicExchange_e114ba(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..3775b8f79c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicExchange_e114ba() { + int res = 0; + int x_11 = atomicExchange(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicExchange_e114ba(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..7126a8a502 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicExchange_e114ba(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_exchange_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_e114ba(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..bb829c958f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_e114ba "atomicExchange_e114ba" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_e114ba = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicExchange_e114ba + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..4e35c0e9bf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicExchange_e114ba() { + var res : i32 = 0i; + let x_11 : i32 = atomicExchange(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicExchange_e114ba(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..926f18e3bd --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicExchange_0a5dca() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicExchange_0a5dca(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..926f18e3bd --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicExchange_0a5dca() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicExchange_0a5dca(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..7bfe69fc9c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicExchange_0a5dca() { + uint res = 0u; + uint x_10 = atomicExchange(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicExchange_0a5dca(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..4027c03177 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicExchange_0a5dca(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_exchange_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_0a5dca(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..0aca328ff6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_0a5dca "atomicExchange_0a5dca" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_0a5dca = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicExchange_0a5dca + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..fb71c6d299 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicExchange_0a5dca() { + var res : u32 = 0u; + let x_10 : u32 = atomicExchange(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicExchange_0a5dca(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..8ce9cf2f39 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_0806ad() { + int res = 0; + const int x_9 = tint_atomicLoad(sb_rw, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_0806ad(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicLoad_0806ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..8ce9cf2f39 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_0806ad() { + int res = 0; + const int x_9 = tint_atomicLoad(sb_rw, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_0806ad(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicLoad_0806ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..d034197209 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicLoad_0806ad() { + int res = 0; + int x_9 = atomicOr(sb_rw.arg_0, 0); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_0806ad(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicLoad_0806ad() { + int res = 0; + int x_9 = atomicOr(sb_rw.arg_0, 0); + res = x_9; + return; +} + +void compute_main_1() { + atomicLoad_0806ad(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..1ea07a1c38 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicLoad_0806ad(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicLoad_0806ad(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicLoad_0806ad(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..40034c7744 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_0806ad "atomicLoad_0806ad" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicLoad_0806ad = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicLoad %int %18 %uint_1 %uint_0 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..b13dbfb432 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicLoad_0806ad() { + var res : i32 = 0i; + let x_9 : i32 = atomicLoad(&(sb_rw.arg_0)); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicLoad_0806ad(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicLoad_0806ad(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..454ed3cf18 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_fe6cc3() { + uint res = 0u; + const uint x_9 = tint_atomicLoad(sb_rw, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_fe6cc3(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicLoad_fe6cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..454ed3cf18 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_fe6cc3() { + uint res = 0u; + const uint x_9 = tint_atomicLoad(sb_rw, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_fe6cc3(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicLoad_fe6cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..cebe232998 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicLoad_fe6cc3() { + uint res = 0u; + uint x_9 = atomicOr(sb_rw.arg_0, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_fe6cc3(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicLoad_fe6cc3() { + uint res = 0u; + uint x_9 = atomicOr(sb_rw.arg_0, 0u); + res = x_9; + return; +} + +void compute_main_1() { + atomicLoad_fe6cc3(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..a6cce2757a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicLoad_fe6cc3(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicLoad_fe6cc3(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicLoad_fe6cc3(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..e12b47bae3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_fe6cc3 "atomicLoad_fe6cc3" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicLoad_fe6cc3 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicLoad %uint %17 %uint_1 %uint_0 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..b03da62e6d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicLoad_fe6cc3() { + var res : u32 = 0u; + let x_9 : u32 = atomicLoad(&(sb_rw.arg_0)); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicLoad_fe6cc3(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicLoad_fe6cc3(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..1593c13612 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicLoad_afcc03() { + int res = 0; + int atomic_result = 0; + InterlockedOr(arg_0, 0, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicLoad_afcc03(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1593c13612 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicLoad_afcc03() { + int res = 0; + int atomic_result = 0; + InterlockedOr(arg_0, 0, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicLoad_afcc03(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..e0c158b430 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicLoad_afcc03() { + int res = 0; + int x_11 = atomicOr(arg_0, 0); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicLoad_afcc03(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..8f6ee408a4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicLoad_afcc03(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_load_explicit(tint_symbol, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_afcc03(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..829b8487e3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_afcc03 "atomicLoad_afcc03" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_afcc03 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicLoad_afcc03 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %31 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %33 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %21 +%local_invocation_index_1_param = OpFunctionParameter %uint + %36 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %40 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %42 = OpLabel + %44 = OpLoad %uint %local_invocation_index_1_param_1 + %43 = OpFunctionCall %void %compute_main_inner_1 %44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..af0c057346 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicLoad_afcc03() { + var res : i32 = 0i; + let x_11 : i32 = atomicLoad(&(arg_0)); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicLoad_afcc03(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..803eadd060 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicLoad_361bf1() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedOr(arg_0, 0, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicLoad_361bf1(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..803eadd060 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicLoad_361bf1() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedOr(arg_0, 0, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicLoad_361bf1(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..8bd40a675c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicLoad_361bf1() { + uint res = 0u; + uint x_10 = atomicOr(arg_0, 0u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicLoad_361bf1(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..d7fcb6e569 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicLoad_361bf1(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_load_explicit(tint_symbol, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_361bf1(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_29 = *(tint_symbol_2); + compute_main_inner(x_29, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..7a075badba --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_361bf1 "atomicLoad_361bf1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_361bf1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicLoad_361bf1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %29 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %19 +%local_invocation_index_1_param = OpFunctionParameter %uint + %34 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %38 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %42 = OpLoad %uint %local_invocation_index_1_param_1 + %41 = OpFunctionCall %void %compute_main_inner_1 %42 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..f132c6fa83 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicLoad_361bf1() { + var res : u32 = 0u; + let x_10 : u32 = atomicLoad(&(arg_0)); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicLoad_361bf1(); + return; +} + +fn compute_main_1() { + let x_29 : u32 = local_invocation_index_1; + compute_main_inner(x_29); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..4fd3948e88 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_92aa72() { + int res = 0; + const int x_9 = tint_atomicMax(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMax_92aa72(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMax_92aa72(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4fd3948e88 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_92aa72() { + int res = 0; + const int x_9 = tint_atomicMax(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMax_92aa72(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMax_92aa72(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..63418486d6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicMax_92aa72() { + int res = 0; + int x_9 = atomicMax(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMax_92aa72(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicMax_92aa72() { + int res = 0; + int x_9 = atomicMax(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicMax_92aa72(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..39a434ce30 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicMax_92aa72(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicMax_92aa72(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicMax_92aa72(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..34dd4c3704 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_92aa72 "atomicMax_92aa72" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicMax_92aa72 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicSMax %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..ae52315047 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicMax_92aa72() { + var res : i32 = 0i; + let x_9 : i32 = atomicMax(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicMax_92aa72(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicMax_92aa72(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..9934904856 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_51b9be() { + uint res = 0u; + const uint x_9 = tint_atomicMax(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMax_51b9be(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMax_51b9be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..9934904856 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_51b9be() { + uint res = 0u; + const uint x_9 = tint_atomicMax(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMax_51b9be(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMax_51b9be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..08dd962ca5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicMax_51b9be() { + uint res = 0u; + uint x_9 = atomicMax(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMax_51b9be(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicMax_51b9be() { + uint res = 0u; + uint x_9 = atomicMax(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicMax_51b9be(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..bc40d81b93 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicMax_51b9be(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicMax_51b9be(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicMax_51b9be(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..be00498bd0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_51b9be "atomicMax_51b9be" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMax_51b9be = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicUMax %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..9b20062782 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicMax_51b9be() { + var res : u32 = 0u; + let x_9 : u32 = atomicMax(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicMax_51b9be(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicMax_51b9be(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..bdcfb2a5e7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicMax_a89cc3() { + int res = 0; + int atomic_result = 0; + InterlockedMax(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMax_a89cc3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..bdcfb2a5e7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicMax_a89cc3() { + int res = 0; + int atomic_result = 0; + InterlockedMax(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMax_a89cc3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..44e03cfcff --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicMax_a89cc3() { + int res = 0; + int x_11 = atomicMax(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicMax_a89cc3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..94213828a6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicMax_a89cc3(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_fetch_max_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_a89cc3(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..0360ae68ae --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_a89cc3 "atomicMax_a89cc3" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_a89cc3 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicMax_a89cc3 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..0c3e2a8cbe --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicMax_a89cc3() { + var res : i32 = 0i; + let x_11 : i32 = atomicMax(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicMax_a89cc3(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..9c405cb1d5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicMax_beccfc() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedMax(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMax_beccfc(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..9c405cb1d5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicMax_beccfc() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedMax(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMax_beccfc(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..dc7354cd96 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicMax_beccfc() { + uint res = 0u; + uint x_10 = atomicMax(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicMax_beccfc(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..200a901d1c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicMax_beccfc(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_fetch_max_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_beccfc(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..7f01c87162 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_beccfc "atomicMax_beccfc" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_beccfc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicMax_beccfc + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..39ee5df379 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicMax_beccfc() { + var res : u32 = 0u; + let x_10 : u32 = atomicMax(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicMax_beccfc(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..efe6471b38 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_8e38dc() { + int res = 0; + const int x_9 = tint_atomicMin(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMin_8e38dc(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMin_8e38dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..efe6471b38 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_8e38dc() { + int res = 0; + const int x_9 = tint_atomicMin(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMin_8e38dc(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMin_8e38dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..021d201cf7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicMin_8e38dc() { + int res = 0; + int x_9 = atomicMin(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMin_8e38dc(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicMin_8e38dc() { + int res = 0; + int x_9 = atomicMin(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicMin_8e38dc(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..efe7671038 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicMin_8e38dc(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicMin_8e38dc(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicMin_8e38dc(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..42e5312df3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_8e38dc "atomicMin_8e38dc" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicMin_8e38dc = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicSMin %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..667b13a4a2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicMin_8e38dc() { + var res : i32 = 0i; + let x_9 : i32 = atomicMin(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicMin_8e38dc(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicMin_8e38dc(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..1bb4ca033e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_c67a74() { + uint res = 0u; + const uint x_9 = tint_atomicMin(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMin_c67a74(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMin_c67a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1bb4ca033e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_c67a74() { + uint res = 0u; + const uint x_9 = tint_atomicMin(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMin_c67a74(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMin_c67a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..66cb35135d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicMin_c67a74() { + uint res = 0u; + uint x_9 = atomicMin(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicMin_c67a74(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicMin_c67a74() { + uint res = 0u; + uint x_9 = atomicMin(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicMin_c67a74(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..e03cf33e0c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicMin_c67a74(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicMin_c67a74(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicMin_c67a74(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..c1fc0dcbf5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_c67a74 "atomicMin_c67a74" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMin_c67a74 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicUMin %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..62f9e6aec6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicMin_c67a74() { + var res : u32 = 0u; + let x_9 : u32 = atomicMin(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicMin_c67a74(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicMin_c67a74(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicMin/278235.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicMin/278235.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..72197d7811 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicMin_278235() { + int res = 0; + int atomic_result = 0; + InterlockedMin(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMin_278235(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..72197d7811 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicMin_278235() { + int res = 0; + int atomic_result = 0; + InterlockedMin(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMin_278235(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..f8151e377e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicMin_278235() { + int res = 0; + int x_11 = atomicMin(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicMin_278235(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..3c4bd987dc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicMin_278235(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_fetch_min_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_278235(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..cea2249304 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_278235 "atomicMin_278235" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_278235 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicMin_278235 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..5ddda3e92d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicMin_278235() { + var res : i32 = 0i; + let x_11 : i32 = atomicMin(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicMin_278235(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..f91f02a22c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicMin_69d383() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedMin(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMin_69d383(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..f91f02a22c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicMin_69d383() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedMin(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMin_69d383(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..466b141a8b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicMin_69d383() { + uint res = 0u; + uint x_10 = atomicMin(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicMin_69d383(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..226629f477 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicMin_69d383(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_fetch_min_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_69d383(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..475d1ce488 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_69d383 "atomicMin_69d383" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_69d383 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicMin_69d383 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..8f37c6bbcb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicMin_69d383() { + var res : u32 = 0u; + let x_10 : u32 = atomicMin(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicMin_69d383(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..f9e84d9887 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_8d96a0() { + int res = 0; + const int x_9 = tint_atomicOr(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicOr_8d96a0(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicOr_8d96a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..f9e84d9887 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_8d96a0() { + int res = 0; + const int x_9 = tint_atomicOr(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicOr_8d96a0(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicOr_8d96a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..b9557e323c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicOr_8d96a0() { + int res = 0; + int x_9 = atomicOr(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicOr_8d96a0(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicOr_8d96a0() { + int res = 0; + int x_9 = atomicOr(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicOr_8d96a0(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..2a66f9fab4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicOr_8d96a0(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicOr_8d96a0(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicOr_8d96a0(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..a971056f77 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_8d96a0 "atomicOr_8d96a0" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicOr_8d96a0 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicOr %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..bd4a06b184 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicOr_8d96a0() { + var res : i32 = 0i; + let x_9 : i32 = atomicOr(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicOr_8d96a0(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicOr_8d96a0(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..b0ac7e6e1c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_5e95d4() { + uint res = 0u; + const uint x_9 = tint_atomicOr(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicOr_5e95d4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicOr_5e95d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b0ac7e6e1c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_5e95d4() { + uint res = 0u; + const uint x_9 = tint_atomicOr(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicOr_5e95d4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicOr_5e95d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..5ad5f61f9f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicOr_5e95d4() { + uint res = 0u; + uint x_9 = atomicOr(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicOr_5e95d4(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicOr_5e95d4() { + uint res = 0u; + uint x_9 = atomicOr(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicOr_5e95d4(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..e47c2dbe17 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicOr_5e95d4(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicOr_5e95d4(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicOr_5e95d4(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..a46ca1d0c6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_5e95d4 "atomicOr_5e95d4" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicOr_5e95d4 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicOr %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..4f5bf4c62d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicOr_5e95d4() { + var res : u32 = 0u; + let x_9 : u32 = atomicOr(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicOr_5e95d4(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicOr_5e95d4(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..9f15c6c6ef --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicOr_d09248() { + int res = 0; + int atomic_result = 0; + InterlockedOr(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicOr_d09248(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..9f15c6c6ef --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicOr_d09248() { + int res = 0; + int atomic_result = 0; + InterlockedOr(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicOr_d09248(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..4fdf33826d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicOr_d09248() { + int res = 0; + int x_11 = atomicOr(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicOr_d09248(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..74c1a5852e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicOr_d09248(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_fetch_or_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_d09248(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..9ef589330b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_d09248 "atomicOr_d09248" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_d09248 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicOr_d09248 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..5563b2bee9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicOr_d09248() { + var res : i32 = 0i; + let x_11 : i32 = atomicOr(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicOr_d09248(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..22393c18c5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicOr_5e3d61() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedOr(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicOr_5e3d61(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..22393c18c5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicOr_5e3d61() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedOr(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicOr_5e3d61(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..e9191a7878 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicOr_5e3d61() { + uint res = 0u; + uint x_10 = atomicOr(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicOr_5e3d61(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..2513fa7e93 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicOr_5e3d61(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_fetch_or_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_5e3d61(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..ad9af507a7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_5e3d61 "atomicOr_5e3d61" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_5e3d61 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicOr_5e3d61 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..2e9093ea4a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicOr_5e3d61() { + var res : u32 = 0u; + let x_10 : u32 = atomicOr(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicOr_5e3d61(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..5ef62c96de --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,33 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_d1e9a6() { + tint_atomicStore(sb_rw, 0u, 1); + return; +} + +void fragment_main_1() { + atomicStore_d1e9a6(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicStore_d1e9a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..5ef62c96de --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,33 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_d1e9a6() { + tint_atomicStore(sb_rw, 0u, 1); + return; +} + +void fragment_main_1() { + atomicStore_d1e9a6(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicStore_d1e9a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..24fc51ed53 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicStore_d1e9a6() { + atomicExchange(sb_rw.arg_0, 1); + return; +} + +void fragment_main_1() { + atomicStore_d1e9a6(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicStore_d1e9a6() { + atomicExchange(sb_rw.arg_0, 1); + return; +} + +void compute_main_1() { + atomicStore_d1e9a6(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..03e234a47f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicStore_d1e9a6(device SB_RW_atomic* const tint_symbol) { + atomic_store_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicStore_d1e9a6(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicStore_d1e9a6(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..cabaea35a0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_d1e9a6 "atomicStore_d1e9a6" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicStore_d1e9a6 = OpFunction %void None %5 + %8 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + OpAtomicStore %15 %uint_1 %uint_0 %int_1 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %18 = OpLabel + %19 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..eaf478bdaf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,34 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicStore_d1e9a6() { + atomicStore(&(sb_rw.arg_0), 1i); + return; +} + +fn fragment_main_1() { + atomicStore_d1e9a6(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicStore_d1e9a6(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..259c472a39 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,33 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) { + uint ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_cdc29e() { + tint_atomicStore(sb_rw, 0u, 1u); + return; +} + +void fragment_main_1() { + atomicStore_cdc29e(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicStore_cdc29e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..259c472a39 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,33 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) { + uint ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_cdc29e() { + tint_atomicStore(sb_rw, 0u, 1u); + return; +} + +void fragment_main_1() { + atomicStore_cdc29e(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicStore_cdc29e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..e9c81a233d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicStore_cdc29e() { + atomicExchange(sb_rw.arg_0, 1u); + return; +} + +void fragment_main_1() { + atomicStore_cdc29e(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicStore_cdc29e() { + atomicExchange(sb_rw.arg_0, 1u); + return; +} + +void compute_main_1() { + atomicStore_cdc29e(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..cc29ffd067 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicStore_cdc29e(device SB_RW_atomic* const tint_symbol) { + atomic_store_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicStore_cdc29e(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicStore_cdc29e(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..bcda0e7f9b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,58 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_cdc29e "atomicStore_cdc29e" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicStore_cdc29e = OpFunction %void None %5 + %8 = OpLabel + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + OpAtomicStore %14 %uint_1 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %16 = OpLabel + %17 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..93b7fff109 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,34 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicStore_cdc29e() { + atomicStore(&(sb_rw.arg_0), 1u); + return; +} + +fn fragment_main_1() { + atomicStore_cdc29e(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicStore_cdc29e(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..c2dbd19e89 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,41 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicStore_8bea94() { + int atomic_result = 0; + InterlockedExchange(arg_0, 1, atomic_result); + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicStore_8bea94(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..c2dbd19e89 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,41 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicStore_8bea94() { + int atomic_result = 0; + InterlockedExchange(arg_0, 1, atomic_result); + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicStore_8bea94(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..cc9e431098 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,35 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicStore_8bea94() { + atomicExchange(arg_0, 1); + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicStore_8bea94(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..78e73c54b5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +void atomicStore_8bea94(threadgroup atomic_int* const tint_symbol) { + atomic_store_explicit(tint_symbol, 1, memory_order_relaxed); + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_8bea94(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_29 = *(tint_symbol_2); + compute_main_inner(x_29, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..319461d46c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_8bea94 "atomicStore_8bea94" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %19 = OpTypeFunction %void %uint + %25 = OpConstantNull %int + %uint_264 = OpConstant %uint 264 +%atomicStore_8bea94 = OpFunction %void None %10 + %13 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %int_1 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %25 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicStore_8bea94 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %19 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %25 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..800c8fd231 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicStore_8bea94() { + atomicStore(&(arg_0), 1i); + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicStore_8bea94(); + return; +} + +fn compute_main_1() { + let x_29 : u32 = local_invocation_index_1; + compute_main_inner(x_29); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicStore/726882.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicStore/726882.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..309c7dfb36 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,41 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicStore_726882() { + uint atomic_result = 0u; + InterlockedExchange(arg_0, 1u, atomic_result); + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicStore_726882(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..309c7dfb36 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,41 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicStore_726882() { + uint atomic_result = 0u; + InterlockedExchange(arg_0, 1u, atomic_result); + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicStore_726882(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..678f189b27 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,35 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicStore_726882() { + atomicExchange(arg_0, 1u); + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicStore_726882(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..1a458eb853 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +void atomicStore_726882(threadgroup atomic_uint* const tint_symbol) { + atomic_store_explicit(tint_symbol, 1u, memory_order_relaxed); + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_726882(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_28 = *(tint_symbol_2); + compute_main_inner(x_28, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..6f8e362750 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_726882 "atomicStore_726882" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_726882 = OpFunction %void None %9 + %12 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicStore_726882 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %28 = OpLabel + %29 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %29 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %18 +%local_invocation_index_1_param = OpFunctionParameter %uint + %33 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %37 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %41 = OpLoad %uint %local_invocation_index_1_param_1 + %40 = OpFunctionCall %void %compute_main_inner_1 %41 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..b90d965f68 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicStore_726882() { + atomicStore(&(arg_0), 1u); + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicStore_726882(); + return; +} + +fn compute_main_1() { + let x_28 : u32 = local_invocation_index_1; + compute_main_inner(x_28); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicSub/051100.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicSub/051100.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..3624845ca0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_051100() { + int res = 0; + const int x_9 = tint_atomicSub(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicSub_051100(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicSub_051100(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..3624845ca0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_051100() { + int res = 0; + const int x_9 = tint_atomicSub(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicSub_051100(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicSub_051100(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..8f573dffe3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicSub_051100() { + int res = 0; + int x_9 = atomicAdd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicSub_051100(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicSub_051100() { + int res = 0; + int x_9 = atomicAdd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicSub_051100(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..4696114e18 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicSub_051100(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicSub_051100(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicSub_051100(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..9ada74b558 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_051100 "atomicSub_051100" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicSub_051100 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicISub %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..3fde6a5333 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicSub_051100() { + var res : i32 = 0i; + let x_9 : i32 = atomicSub(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicSub_051100(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicSub_051100(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..1bcbe098b8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_15bfc9() { + uint res = 0u; + const uint x_9 = tint_atomicSub(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicSub_15bfc9(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicSub_15bfc9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1bcbe098b8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_15bfc9() { + uint res = 0u; + const uint x_9 = tint_atomicSub(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicSub_15bfc9(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicSub_15bfc9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..e462c21374 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicSub_15bfc9() { + uint res = 0u; + uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicSub_15bfc9(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicSub_15bfc9() { + uint res = 0u; + uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicSub_15bfc9(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..4cd9ce2dcf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicSub_15bfc9(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicSub_15bfc9(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicSub_15bfc9(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..885f7035b1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_15bfc9 "atomicSub_15bfc9" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicSub_15bfc9 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicISub %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..23ba9fe3a2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicSub_15bfc9() { + var res : u32 = 0u; + let x_9 : u32 = atomicSub(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicSub_15bfc9(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicSub_15bfc9(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..75a1b4a688 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicSub_77883a() { + int res = 0; + int atomic_result = 0; + InterlockedAdd(arg_0, -1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicSub_77883a(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..75a1b4a688 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicSub_77883a() { + int res = 0; + int atomic_result = 0; + InterlockedAdd(arg_0, -1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicSub_77883a(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..0583afc433 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicSub_77883a() { + int res = 0; + int x_11 = atomicAdd(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicSub_77883a(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..86f5de20a3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicSub_77883a(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_fetch_sub_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_77883a(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..820d0ae31f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_77883a "atomicSub_77883a" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_77883a = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicSub_77883a + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..56079fe943 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicSub_77883a() { + var res : i32 = 0i; + let x_11 : i32 = atomicSub(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicSub_77883a(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..e6f8372332 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicSub_0d26c2() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicSub_0d26c2(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..e6f8372332 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicSub_0d26c2() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicSub_0d26c2(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..49553d08db --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicSub_0d26c2() { + uint res = 0u; + uint x_10 = atomicAdd(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicSub_0d26c2(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..91e3b4bdc5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicSub_0d26c2(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_fetch_sub_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_0d26c2(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..c42f0b9bac --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_0d26c2 "atomicSub_0d26c2" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_0d26c2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicSub_0d26c2 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..2b69af66f5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicSub_0d26c2() { + var res : u32 = 0u; + let x_10 : u32 = atomicSub(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicSub_0d26c2(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..605a4d7cdb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_c1b78c() { + int res = 0; + const int x_9 = tint_atomicXor(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicXor_c1b78c(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicXor_c1b78c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..605a4d7cdb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_c1b78c() { + int res = 0; + const int x_9 = tint_atomicXor(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicXor_c1b78c(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicXor_c1b78c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..cc05c2842d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicXor_c1b78c() { + int res = 0; + int x_9 = atomicXor(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicXor_c1b78c(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicXor_c1b78c() { + int res = 0; + int x_9 = atomicXor(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicXor_c1b78c(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..fbde7607d0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicXor_c1b78c(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicXor_c1b78c(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicXor_c1b78c(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..1302c1abc7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_c1b78c "atomicXor_c1b78c" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicXor_c1b78c = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicXor %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..7992f58e4c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicXor_c1b78c() { + var res : i32 = 0i; + let x_9 : i32 = atomicXor(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicXor_c1b78c(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicXor_c1b78c(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..3c2aad77ac --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_54510e() { + uint res = 0u; + const uint x_9 = tint_atomicXor(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicXor_54510e(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicXor_54510e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..3c2aad77ac --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_54510e() { + uint res = 0u; + const uint x_9 = tint_atomicXor(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicXor_54510e(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicXor_54510e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..2893791023 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicXor_54510e() { + uint res = 0u; + uint x_9 = atomicXor(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicXor_54510e(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicXor_54510e() { + uint res = 0u; + uint x_9 = atomicXor(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicXor_54510e(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..dd37adc4f1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicXor_54510e(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicXor_54510e(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicXor_54510e(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..1fb9bcc141 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_54510e "atomicXor_54510e" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicXor_54510e = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicXor %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..7fbc313591 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicXor_54510e() { + var res : u32 = 0u; + let x_9 : u32 = atomicXor(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicXor_54510e(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicXor_54510e(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..5ffbd31c46 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicXor_75dc95() { + int res = 0; + int atomic_result = 0; + InterlockedXor(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicXor_75dc95(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..5ffbd31c46 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicXor_75dc95() { + int res = 0; + int atomic_result = 0; + InterlockedXor(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicXor_75dc95(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..b260d4d2c0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicXor_75dc95() { + int res = 0; + int x_11 = atomicXor(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicXor_75dc95(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..b5c2e2c54b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicXor_75dc95(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_fetch_xor_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_75dc95(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..542376de1a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_75dc95 "atomicXor_75dc95" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_75dc95 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicXor_75dc95 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..f14ac31618 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicXor_75dc95() { + var res : i32 = 0i; + let x_11 : i32 = atomicXor(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicXor_75dc95(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm similarity index 100% rename from test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.spvasm rename to test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..8296d8674e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicXor_c8e6be() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedXor(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicXor_c8e6be(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..8296d8674e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicXor_c8e6be() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedXor(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicXor_c8e6be(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..a15719aef4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicXor_c8e6be() { + uint res = 0u; + uint x_10 = atomicXor(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicXor_c8e6be(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..6993e95c04 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicXor_c8e6be(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_fetch_xor_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_c8e6be(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..4f19634fbf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_c8e6be "atomicXor_c8e6be" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_c8e6be = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicXor_c8e6be + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..53f7436cb6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicXor_c8e6be() { + var res : u32 = 0u; + let x_10 : u32 = atomicXor(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicXor_c8e6be(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm new file mode 100644 index 0000000000..fe8b450a47 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicIDecrement %int %15 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..ab2b1ee161 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int res = 0; + const int x_9 = tint_atomicSub(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..ab2b1ee161 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int res = 0; + const int x_9 = tint_atomicSub(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..875dc0857f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int res = 0; + int x_9 = atomicAdd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int res = 0; + int x_9 = atomicAdd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..8a042c1451 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicAdd_d32fe4(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_d32fe4(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_d32fe4(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..97fa9d7095 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicISub %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..e048762b51 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_d32fe4() { + var res : i32 = 0i; + let x_9 : i32 = atomicSub(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm new file mode 100644 index 0000000000..519752672a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicIDecrement %uint %14 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..6f0bb19b4c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint res = 0u; + const uint x_9 = tint_atomicSub(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..6f0bb19b4c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint res = 0u; + const uint x_9 = tint_atomicSub(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..48a073514d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint res = 0u; + uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint res = 0u; + uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..adfd3c79e5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicAdd_8a199a(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_8a199a(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_8a199a(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..4ea9dce7fc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicISub %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..d22b2aaa0f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_8a199a() { + var res : u32 = 0u; + let x_9 : u32 = atomicSub(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_8a199a(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm new file mode 100644 index 0000000000..eb2f8592f3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicIDecrement %int %arg_0 %uint_2 %uint_0 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..09f225c0a7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int res = 0; + int atomic_result = 0; + InterlockedAdd(arg_0, -1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..09f225c0a7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int res = 0; + int atomic_result = 0; + InterlockedAdd(arg_0, -1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..b745861ae2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicAdd_794055() { + int res = 0; + int x_11 = atomicAdd(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..e7d19e9d5e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_fetch_sub_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_794055(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..32bc60e2a6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..6050ff2687 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_794055() { + var res : i32 = 0i; + let x_11 : i32 = atomicSub(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicAdd_794055(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm new file mode 100644 index 0000000000..8c3ebfce64 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicIDecrement %uint %arg_0 %uint_2 %uint_0 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..33bfa081d7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..33bfa081d7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..97c0c6f4d8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicAdd_d5db1d() { + uint res = 0u; + uint x_10 = atomicAdd(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..bd63c56854 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_fetch_sub_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_d5db1d(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..c50dbaef6a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..f7f5447422 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_d5db1d() { + var res : u32 = 0u; + let x_10 : u32 = atomicSub(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicAdd_d5db1d(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm new file mode 100644 index 0000000000..efd1d3a4f4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicIIncrement %int %15 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..358487bedc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int res = 0; + const int x_9 = tint_atomicAdd(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..358487bedc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int res = 0; + const int x_9 = tint_atomicAdd(sb_rw, 0u, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..875dc0857f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int res = 0; + int x_9 = atomicAdd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int res = 0; + int x_9 = atomicAdd(sb_rw.arg_0, 1); + res = x_9; + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..64027ff549 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicAdd_d32fe4(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_d32fe4(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_d32fe4(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..13f287aef1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicIAdd %int %18 %uint_1 %uint_0 %int_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..cfc64fbba6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_d32fe4() { + var res : i32 = 0i; + let x_9 : i32 = atomicAdd(&(sb_rw.arg_0), 1i); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm new file mode 100644 index 0000000000..a805c5081f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicIIncrement %uint %14 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..bdc43b0733 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint res = 0u; + const uint x_9 = tint_atomicAdd(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..bdc43b0733 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint res = 0u; + const uint x_9 = tint_atomicAdd(sb_rw, 0u, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..48a073514d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint res = 0u; + uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint res = 0u; + uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + res = x_9; + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..fa2343bc6a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicAdd_8a199a(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_8a199a(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_8a199a(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..e1bf1e996e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicIAdd %uint %17 %uint_1 %uint_0 %uint_1 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..b5d5856764 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_8a199a() { + var res : u32 = 0u; + let x_9 : u32 = atomicAdd(&(sb_rw.arg_0), 1u); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_8a199a(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm new file mode 100644 index 0000000000..255bfe1e47 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicIIncrement %int %arg_0 %uint_2 %uint_0 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..ccdf1ad871 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int res = 0; + int atomic_result = 0; + InterlockedAdd(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..ccdf1ad871 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int res = 0; + int atomic_result = 0; + InterlockedAdd(arg_0, 1, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..b745861ae2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicAdd_794055() { + int res = 0; + int x_11 = atomicAdd(arg_0, 1); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..62639d7b4a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_fetch_add_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_794055(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..3dc0a5d301 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..723a1135af --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_794055() { + var res : i32 = 0i; + let x_11 : i32 = atomicAdd(&(arg_0), 1i); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicAdd_794055(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm new file mode 100644 index 0000000000..c26936dcb2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicIIncrement %uint %arg_0 %uint_2 %uint_0 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..c36ae576b3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..c36ae576b3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, 1u, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..97c0c6f4d8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicAdd_d5db1d() { + uint res = 0u; + uint x_10 = atomicAdd(arg_0, 1u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..04a890a74c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_fetch_add_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_d5db1d(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..5daee6404f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %30 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %20 +%local_invocation_index_1_param = OpFunctionParameter %uint + %35 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %39 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %43 = OpLoad %uint %local_invocation_index_1_param_1 + %42 = OpFunctionCall %void %compute_main_inner_1 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..61d34ccb7b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_d5db1d() { + var res : u32 = 0u; + let x_10 : u32 = atomicAdd(&(arg_0), 1u); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicAdd_d5db1d(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm new file mode 100644 index 0000000000..2fd0e19721 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..1b338c9e52 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicAdd(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1b338c9e52 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicAdd(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..bd9f7f8bc3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAdd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAdd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..3106affe24 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicAdd_d32fe4(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_20 = arg_1; + int const x_13 = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), x_20, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_d32fe4(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_d32fe4(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..c38ab553f1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %14 = OpLoad %int %arg_1 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %15 = OpAtomicIAdd %int %21 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..ea83a0587c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_d32fe4() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_20 : i32 = arg_1; + let x_13 : i32 = atomicAdd(&(sb_rw.arg_0), x_20); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm new file mode 100644 index 0000000000..98d9690d34 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicIAdd %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..845d1f7ec7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicAdd(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..845d1f7ec7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicAdd(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..5c1a1b00f9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAdd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAdd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..da05cfb2c5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicAdd_8a199a(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_13 = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), x_18, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_8a199a(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_8a199a(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..d015d498c5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %14 = OpLoad %uint %arg_1 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %15 = OpAtomicIAdd %uint %19 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..887a79869b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_8a199a() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_13 : u32 = atomicAdd(&(sb_rw.arg_0), x_18); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_8a199a(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm new file mode 100644 index 0000000000..9a311f18c4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..0cfd69649d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..0cfd69649d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..89a45772b7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicAdd_794055() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicAdd(arg_0, arg_1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..b30df095e1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_19 = arg_1; + int const x_15 = atomic_fetch_add_explicit(tint_symbol, x_19, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_794055(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..3d67dcfcfc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %24 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %20 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %20 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %24 +%local_invocation_index = OpFunctionParameter %uint + %27 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %34 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %36 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %24 +%local_invocation_index_1_param = OpFunctionParameter %uint + %39 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %43 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1_param_1 + %46 = OpFunctionCall %void %compute_main_inner_1 %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..27e52764a1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_794055() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_19 : i32 = arg_1; + let x_15 : i32 = atomicAdd(&(arg_0), x_19); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicAdd_794055(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm new file mode 100644 index 0000000000..7ab1e8d2e3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..380a1a5ee1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..380a1a5ee1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..07177c98cd --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicAdd_d5db1d() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicAdd(arg_0, arg_1); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..29c6f4b3ca --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_14 = atomic_fetch_add_explicit(tint_symbol, x_18, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_d5db1d(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..1cab36f0a8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpLoad %uint %arg_1 + %18 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %17 + OpStore %res %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..1ef7a33d6a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_d5db1d() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_14 : u32 = atomicAdd(&(arg_0), x_18); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicAdd_d5db1d(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm new file mode 100644 index 0000000000..18408ba002 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_152966 "atomicAnd_152966" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAnd_152966 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicAnd %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..ea4a0f8293 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_152966() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicAnd(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAnd_152966(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAnd_152966(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..ea4a0f8293 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_152966() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicAnd(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAnd_152966(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAnd_152966(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..ea9ff84284 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAnd_152966() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAnd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAnd_152966(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAnd_152966() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAnd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicAnd_152966(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..a9960d6742 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicAnd_152966(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_20 = arg_1; + int const x_13 = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), x_20, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAnd_152966(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAnd_152966(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..3257d23881 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_152966 "atomicAnd_152966" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAnd_152966 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %14 = OpLoad %int %arg_1 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %15 = OpAtomicAnd %int %21 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..bdc601ddf2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAnd_152966() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_20 : i32 = arg_1; + let x_13 : i32 = atomicAnd(&(sb_rw.arg_0), x_20); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicAnd_152966(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAnd_152966(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm new file mode 100644 index 0000000000..d8c4b78793 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_85a8d9 "atomicAnd_85a8d9" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAnd_85a8d9 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicAnd %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..44c8b7d84c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_85a8d9() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicAnd(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAnd_85a8d9(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAnd_85a8d9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..44c8b7d84c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_85a8d9() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicAnd(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAnd_85a8d9(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAnd_85a8d9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..e3abb2a2af --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAnd_85a8d9() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAnd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAnd_85a8d9(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAnd_85a8d9() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAnd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicAnd_85a8d9(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..798abe6580 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicAnd_85a8d9(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_13 = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), x_18, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAnd_85a8d9(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAnd_85a8d9(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..668f193c41 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_85a8d9 "atomicAnd_85a8d9" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAnd_85a8d9 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %14 = OpLoad %uint %arg_1 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %15 = OpAtomicAnd %uint %19 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..4bf4b48b8e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAnd_85a8d9() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_13 : u32 = atomicAnd(&(sb_rw.arg_0), x_18); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicAnd_85a8d9(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAnd_85a8d9(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm new file mode 100644 index 0000000000..e0c9a7e2f3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_45a819 "atomicAnd_45a819" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_45a819 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAnd_45a819 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..cd9a7b7725 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAnd_45a819() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAnd(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAnd_45a819(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..cd9a7b7725 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAnd_45a819() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAnd(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAnd_45a819(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..cc74ce65b6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicAnd_45a819() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicAnd(arg_0, arg_1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicAnd_45a819(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..962a96cce8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicAnd_45a819(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_19 = arg_1; + int const x_15 = atomic_fetch_and_explicit(tint_symbol, x_19, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_45a819(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..598acf25ac --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_45a819 "atomicAnd_45a819" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %24 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_45a819 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %20 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %20 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %24 +%local_invocation_index = OpFunctionParameter %uint + %27 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicAnd_45a819 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %34 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %36 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %24 +%local_invocation_index_1_param = OpFunctionParameter %uint + %39 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %43 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1_param_1 + %46 = OpFunctionCall %void %compute_main_inner_1 %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..d757c09185 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAnd_45a819() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_19 : i32 = arg_1; + let x_15 : i32 = atomicAnd(&(arg_0), x_19); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicAnd_45a819(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm new file mode 100644 index 0000000000..e6e94c1a3a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_34edd3 "atomicAnd_34edd3" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_34edd3 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAnd_34edd3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..37f4feec49 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAnd_34edd3() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAnd(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAnd_34edd3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..37f4feec49 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAnd_34edd3() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAnd(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAnd_34edd3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..39b8c3e506 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicAnd_34edd3() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicAnd(arg_0, arg_1); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicAnd_34edd3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..d1624058bc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicAnd_34edd3(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_14 = atomic_fetch_and_explicit(tint_symbol, x_18, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_34edd3(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..0eeed44ead --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_34edd3 "atomicAnd_34edd3" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_34edd3 = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpLoad %uint %arg_1 + %18 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %17 + OpStore %res %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicAnd_34edd3 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..dba5360f3a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAnd_34edd3() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_14 : u32 = atomicAnd(&(arg_0), x_18); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicAnd_34edd3(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm new file mode 100644 index 0000000000..0999969646 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_1bd40a "atomicCompareExchangeWeak_1bd40a" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %29 = OpConstantNull %__atomic_compare_exchange_resulti32 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %arg_2 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %29 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %23 = OpLoad %int %arg_2 + %24 = OpLoad %int %arg_1 + %25 = OpAtomicCompareExchange %int %22 %uint_1 %uint_0 %uint_0 %23 %24 + %26 = OpIEqual %bool %25 %23 + %14 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %25 %26 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %31 = OpLabel + %32 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %34 = OpLabel + %35 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..d2d0b546bf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,55 @@ +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 0; + int arg_2 = 0; + x__atomic_compare_exchange_resulti32 res = (x__atomic_compare_exchange_resulti32)0; + arg_1 = 1; + arg_2 = 1; + const int x_23 = arg_2; + const atomic_compare_exchange_weak_ret_type tint_symbol = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, x_23); + const int old_value_1 = tint_symbol.old_value; + const int x_25 = old_value_1; + const x__atomic_compare_exchange_resulti32 tint_symbol_1 = {x_25, (x_25 == x_23)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..d2d0b546bf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,55 @@ +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 0; + int arg_2 = 0; + x__atomic_compare_exchange_resulti32 res = (x__atomic_compare_exchange_resulti32)0; + arg_1 = 1; + arg_2 = 1; + const int x_23 = arg_2; + const atomic_compare_exchange_weak_ret_type tint_symbol = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, x_23); + const int old_value_1 = tint_symbol.old_value; + const int x_25 = old_value_1; + const x__atomic_compare_exchange_resulti32 tint_symbol_1 = {x_25, (x_25 == x_23)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..286017ba33 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl @@ -0,0 +1,112 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 0; + int arg_2 = 0; + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + arg_1 = 1; + arg_2 = 1; + int x_23 = arg_2; + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, x_23); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; + int old_value_1 = tint_symbol.old_value; + int x_25 = old_value_1; + x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_25, (x_25 == x_23)); + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 0; + int arg_2 = 0; + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + arg_1 = 1; + arg_2 = 1; + int x_23 = arg_2; + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, x_23); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; + int old_value_1 = tint_symbol.old_value; + int x_25 = old_value_1; + x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_25, (x_25 == x_23)); + res = tint_symbol_1; + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..f629b29269 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(device atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +void atomicCompareExchangeWeak_1bd40a(device SB_RW_atomic* const tint_symbol_2) { + int arg_1 = 0; + int arg_2 = 0; + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32{}; + arg_1 = 1; + arg_2 = 1; + int const x_23 = arg_2; + int const x_24 = arg_1; + atomic_compare_exchange_resulti32 const tint_symbol = atomicCompareExchangeWeak_1(&((*(tint_symbol_2)).arg_0), x_24, x_23); + int const old_value_1 = tint_symbol.old_value; + int const x_25 = old_value_1; + x__atomic_compare_exchange_resulti32 const tint_symbol_1 = {.old_value=x_25, .exchanged=(x_25 == x_23)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_3); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + fragment_main_1(tint_symbol_4); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_5) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_5); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_6 [[buffer(0)]]) { + compute_main_1(tint_symbol_6); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..0c17de2d92 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_1bd40a "atomicCompareExchangeWeak_1bd40a" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %x__atomic_compare_exchange_resulti32 "x__atomic_compare_exchange_resulti32" + OpMemberName %x__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %x__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %x__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %x__atomic_compare_exchange_resulti32 1 Offset 4 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool +%x__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %15 = OpConstantNull %x__atomic_compare_exchange_resulti32 +%_ptr_Function_x__atomic_compare_exchange_resulti32 = OpTypePointer Function %x__atomic_compare_exchange_resulti32 + %int_1 = OpConstant %int 1 +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %arg_2 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %15 + OpStore %arg_1 %9 + OpStore %arg_2 %9 + OpStore %res %15 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %19 = OpLoad %int %arg_2 + %20 = OpLoad %int %arg_1 + %28 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %29 = OpAtomicCompareExchange %int %28 %uint_1 %uint_0 %uint_0 %19 %20 + %30 = OpIEqual %bool %29 %19 + %21 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %29 %30 + %31 = OpCompositeExtract %int %21 0 + %32 = OpIEqual %bool %31 %19 + %33 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %31 %32 + OpStore %res %33 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %35 = OpLabel + %36 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %38 = OpLabel + %39 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %41 = OpLabel + %42 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %44 = OpLabel + %45 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..84a3a29fd5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,48 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +struct x__atomic_compare_exchange_resulti32 { + old_value : i32, + exchanged : bool, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicCompareExchangeWeak_1bd40a() { + var arg_1 : i32 = 0i; + var arg_2 : i32 = 0i; + var res : x__atomic_compare_exchange_resulti32 = x__atomic_compare_exchange_resulti32(0i, false); + arg_1 = 1i; + arg_2 = 1i; + let x_23 : i32 = arg_2; + let x_24 : i32 = arg_1; + let old_value_1 = atomicCompareExchangeWeak(&(sb_rw.arg_0), x_24, x_23).old_value; + let x_25 : i32 = old_value_1; + res = x__atomic_compare_exchange_resulti32(x_25, (x_25 == x_23)); + return; +} + +fn fragment_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm new file mode 100644 index 0000000000..3723643514 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_63d8e6 "atomicCompareExchangeWeak_63d8e6" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %27 = OpConstantNull %__atomic_compare_exchange_resultu32 +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %arg_2 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %27 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %21 = OpLoad %uint %arg_2 + %22 = OpLoad %uint %arg_1 + %23 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %21 %22 + %24 = OpIEqual %bool %23 %21 + %14 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %23 %24 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..b219eb15db --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,55 @@ +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 0u; + uint arg_2 = 0u; + x__atomic_compare_exchange_resultu32 res = (x__atomic_compare_exchange_resultu32)0; + arg_1 = 1u; + arg_2 = 1u; + const uint x_21 = arg_2; + const atomic_compare_exchange_weak_ret_type tint_symbol = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, x_21); + const uint old_value_1 = tint_symbol.old_value; + const uint x_23 = old_value_1; + const x__atomic_compare_exchange_resultu32 tint_symbol_1 = {x_23, (x_23 == x_21)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b219eb15db --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,55 @@ +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 0u; + uint arg_2 = 0u; + x__atomic_compare_exchange_resultu32 res = (x__atomic_compare_exchange_resultu32)0; + arg_1 = 1u; + arg_2 = 1u; + const uint x_21 = arg_2; + const atomic_compare_exchange_weak_ret_type tint_symbol = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, x_21); + const uint old_value_1 = tint_symbol.old_value; + const uint x_23 = old_value_1; + const x__atomic_compare_exchange_resultu32 tint_symbol_1 = {x_23, (x_23 == x_21)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..ec3e6e1996 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl @@ -0,0 +1,112 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 0u; + uint arg_2 = 0u; + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + arg_1 = 1u; + arg_2 = 1u; + uint x_21 = arg_2; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, x_21); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; + uint old_value_1 = tint_symbol.old_value; + uint x_23 = old_value_1; + x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_23, (x_23 == x_21)); + res = tint_symbol_1; + return; +} + +void fragment_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 0u; + uint arg_2 = 0u; + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + arg_1 = 1u; + arg_2 = 1u; + uint x_21 = arg_2; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, x_21); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; + uint old_value_1 = tint_symbol.old_value; + uint x_23 = old_value_1; + x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_23, (x_23 == x_21)); + res = tint_symbol_1; + return; +} + +void compute_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..7aca7ef3fb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(device atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +void atomicCompareExchangeWeak_63d8e6(device SB_RW_atomic* const tint_symbol_2) { + uint arg_1 = 0u; + uint arg_2 = 0u; + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32{}; + arg_1 = 1u; + arg_2 = 1u; + uint const x_21 = arg_2; + uint const x_22 = arg_1; + atomic_compare_exchange_resultu32 const tint_symbol = atomicCompareExchangeWeak_1(&((*(tint_symbol_2)).arg_0), x_22, x_21); + uint const old_value_1 = tint_symbol.old_value; + uint const x_23 = old_value_1; + x__atomic_compare_exchange_resultu32 const tint_symbol_1 = {.old_value=x_23, .exchanged=(x_23 == x_21)}; + res = tint_symbol_1; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_3); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + fragment_main_1(tint_symbol_4); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_5) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_5); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_6 [[buffer(0)]]) { + compute_main_1(tint_symbol_6); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..279b70fb85 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_63d8e6 "atomicCompareExchangeWeak_63d8e6" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %x__atomic_compare_exchange_resultu32 "x__atomic_compare_exchange_resultu32" + OpMemberName %x__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %x__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %x__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %x__atomic_compare_exchange_resultu32 1 Offset 4 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %bool = OpTypeBool +%x__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %15 = OpConstantNull %x__atomic_compare_exchange_resultu32 +%_ptr_Function_x__atomic_compare_exchange_resultu32 = OpTypePointer Function %x__atomic_compare_exchange_resultu32 + %uint_1 = OpConstant %uint 1 +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %arg_2 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %15 + OpStore %arg_1 %9 + OpStore %arg_2 %9 + OpStore %res %15 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %19 = OpLoad %uint %arg_2 + %20 = OpLoad %uint %arg_1 + %26 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %27 = OpAtomicCompareExchange %uint %26 %uint_1 %uint_0 %uint_0 %19 %20 + %28 = OpIEqual %bool %27 %19 + %21 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %27 %28 + %29 = OpCompositeExtract %uint %21 0 + %30 = OpIEqual %bool %29 %19 + %31 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %29 %30 + OpStore %res %31 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %33 = OpLabel + %34 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %36 = OpLabel + %37 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %39 = OpLabel + %40 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %42 = OpLabel + %43 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..c3b661b632 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,48 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +struct x__atomic_compare_exchange_resultu32 { + old_value : u32, + exchanged : bool, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicCompareExchangeWeak_63d8e6() { + var arg_1 : u32 = 0u; + var arg_2 : u32 = 0u; + var res : x__atomic_compare_exchange_resultu32 = x__atomic_compare_exchange_resultu32(0u, false); + arg_1 = 1u; + arg_2 = 1u; + let x_21 : u32 = arg_2; + let x_22 : u32 = arg_1; + let old_value_1 = atomicCompareExchangeWeak(&(sb_rw.arg_0), x_22, x_21).old_value; + let x_23 : u32 = old_value_1; + res = x__atomic_compare_exchange_resultu32(x_23, (x_23 == x_21)); + return; +} + +fn fragment_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm new file mode 100644 index 0000000000..b4e3102de6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_e88938 "atomicCompareExchangeWeak_e88938" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %28 = OpConstantNull %__atomic_compare_exchange_resulti32 + %29 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_e88938 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %arg_2 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %28 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %22 = OpLoad %int %arg_2 + %23 = OpLoad %int %arg_1 + %24 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %22 %23 + %25 = OpIEqual %bool %24 %22 + %16 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %24 %25 + OpStore %res %16 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %29 +%local_invocation_index = OpFunctionParameter %uint + %32 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %37 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %39 = OpLabel + %41 = OpLoad %uint %local_invocation_index_1 + %40 = OpFunctionCall %void %compute_main_inner %41 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..afd64c0d91 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,63 @@ +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicCompareExchangeWeak_e88938() { + int arg_1 = 0; + int arg_2 = 0; + x__atomic_compare_exchange_resulti32 res = (x__atomic_compare_exchange_resulti32)0; + arg_1 = 1; + arg_2 = 1; + const int x_22 = arg_2; + atomic_compare_exchange_resulti32 atomic_result = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value = arg_1; + InterlockedCompareExchange(arg_0, atomic_compare_value, x_22, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + const atomic_compare_exchange_resulti32 tint_symbol_2 = atomic_result; + const int old_value_1 = tint_symbol_2.old_value; + const int x_24 = old_value_1; + const x__atomic_compare_exchange_resulti32 tint_symbol_3 = {x_24, (x_24 == x_22)}; + res = tint_symbol_3; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_e88938(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..afd64c0d91 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,63 @@ +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicCompareExchangeWeak_e88938() { + int arg_1 = 0; + int arg_2 = 0; + x__atomic_compare_exchange_resulti32 res = (x__atomic_compare_exchange_resulti32)0; + arg_1 = 1; + arg_2 = 1; + const int x_22 = arg_2; + atomic_compare_exchange_resulti32 atomic_result = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value = arg_1; + InterlockedCompareExchange(arg_0, atomic_compare_value, x_22, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + const atomic_compare_exchange_resulti32 tint_symbol_2 = atomic_result; + const int old_value_1 = tint_symbol_2.old_value; + const int x_24 = old_value_1; + const x__atomic_compare_exchange_resulti32 tint_symbol_3 = {x_24, (x_24 == x_22)}; + res = tint_symbol_3; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_e88938(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..c370e71096 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,59 @@ +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicCompareExchangeWeak_e88938() { + int arg_1 = 0; + int arg_2 = 0; + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + arg_1 = 1; + arg_2 = 1; + int x_22 = arg_2; + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, arg_1, x_22); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; + int old_value_1 = tint_symbol.old_value; + int x_24 = old_value_1; + x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_24, (x_24 == x_22)); + res = tint_symbol_1; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicCompareExchangeWeak_e88938(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..dd319d0ad5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,64 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(threadgroup atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct x__atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + +void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol_2) { + int arg_1 = 0; + int arg_2 = 0; + x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32{}; + arg_1 = 1; + arg_2 = 1; + int const x_22 = arg_2; + int const x_23 = arg_1; + atomic_compare_exchange_resulti32 const tint_symbol = atomicCompareExchangeWeak_1(tint_symbol_2, x_23, x_22); + int const old_value_1 = tint_symbol.old_value; + int const x_24 = old_value_1; + x__atomic_compare_exchange_resulti32 const tint_symbol_1 = {.old_value=x_24, .exchanged=(x_24 == x_22)}; + res = tint_symbol_1; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_3) { + atomic_store_explicit(tint_symbol_3, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_e88938(tint_symbol_3); + return; +} + +void compute_main_1(thread uint* const tint_symbol_4, threadgroup atomic_int* const tint_symbol_5) { + uint const x_41 = *(tint_symbol_4); + compute_main_inner(x_41, tint_symbol_5); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_6, thread uint* const tint_symbol_7) { + { + atomic_store_explicit(tint_symbol_6, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_7) = local_invocation_index_1_param; + compute_main_1(tint_symbol_7, tint_symbol_6); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_8; + thread uint tint_symbol_9 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_8), &(tint_symbol_9)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..b6cb96d4ee --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_e88938 "atomicCompareExchangeWeak_e88938" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %x__atomic_compare_exchange_resulti32 "x__atomic_compare_exchange_resulti32" + OpMemberName %x__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %x__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %x__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %x__atomic_compare_exchange_resulti32 1 Offset 4 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool +%x__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %20 = OpConstantNull %x__atomic_compare_exchange_resulti32 +%_ptr_Function_x__atomic_compare_exchange_resulti32 = OpTypePointer Function %x__atomic_compare_exchange_resulti32 + %int_1 = OpConstant %int 1 +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %36 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_e88938 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %arg_2 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %20 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + OpStore %res %20 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %24 = OpLoad %int %arg_2 + %25 = OpLoad %int %arg_1 + %31 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %24 %25 + %32 = OpIEqual %bool %31 %24 + %26 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %31 %32 + %33 = OpCompositeExtract %int %26 0 + %34 = OpIEqual %bool %33 %24 + %35 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %33 %34 + OpStore %res %35 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %36 +%local_invocation_index = OpFunctionParameter %uint + %39 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %44 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %46 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1 + %48 = OpFunctionCall %void %compute_main_inner %47 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %36 +%local_invocation_index_1_param = OpFunctionParameter %uint + %51 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %55 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %57 = OpLabel + %59 = OpLoad %uint %local_invocation_index_1_param_1 + %58 = OpFunctionCall %void %compute_main_inner_1 %59 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..aaa949ea64 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +struct x__atomic_compare_exchange_resulti32 { + old_value : i32, + exchanged : bool, +} + +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_e88938() { + var arg_1 : i32 = 0i; + var arg_2 : i32 = 0i; + var res : x__atomic_compare_exchange_resulti32 = x__atomic_compare_exchange_resulti32(0i, false); + arg_1 = 1i; + arg_2 = 1i; + let x_22 : i32 = arg_2; + let x_23 : i32 = arg_1; + let old_value_1 = atomicCompareExchangeWeak(&(arg_0), x_23, x_22).old_value; + let x_24 : i32 = old_value_1; + res = x__atomic_compare_exchange_resulti32(x_24, (x_24 == x_22)); + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicCompareExchangeWeak_e88938(); + return; +} + +fn compute_main_1() { + let x_41 : u32 = local_invocation_index_1; + compute_main_inner(x_41); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm new file mode 100644 index 0000000000..b163b6f12c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_83580d "atomicCompareExchangeWeak_83580d" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %27 = OpConstantNull %__atomic_compare_exchange_resultu32 + %28 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_83580d = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %arg_2 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %27 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %21 = OpLoad %uint %arg_2 + %22 = OpLoad %uint %arg_1 + %23 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %21 %22 + %24 = OpIEqual %bool %23 %21 + %15 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %23 %24 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %28 +%local_invocation_index = OpFunctionParameter %uint + %31 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %36 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %38 = OpLabel + %40 = OpLoad %uint %local_invocation_index_1 + %39 = OpFunctionCall %void %compute_main_inner %40 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..0a1e02663c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,63 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicCompareExchangeWeak_83580d() { + uint arg_1 = 0u; + uint arg_2 = 0u; + x__atomic_compare_exchange_resultu32 res = (x__atomic_compare_exchange_resultu32)0; + arg_1 = 1u; + arg_2 = 1u; + const uint x_21 = arg_2; + atomic_compare_exchange_resultu32 atomic_result = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = arg_1; + InterlockedCompareExchange(arg_0, atomic_compare_value, x_21, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + const atomic_compare_exchange_resultu32 tint_symbol_2 = atomic_result; + const uint old_value_1 = tint_symbol_2.old_value; + const uint x_23 = old_value_1; + const x__atomic_compare_exchange_resultu32 tint_symbol_3 = {x_23, (x_23 == x_21)}; + res = tint_symbol_3; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_83580d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..0a1e02663c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,63 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicCompareExchangeWeak_83580d() { + uint arg_1 = 0u; + uint arg_2 = 0u; + x__atomic_compare_exchange_resultu32 res = (x__atomic_compare_exchange_resultu32)0; + arg_1 = 1u; + arg_2 = 1u; + const uint x_21 = arg_2; + atomic_compare_exchange_resultu32 atomic_result = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = arg_1; + InterlockedCompareExchange(arg_0, atomic_compare_value, x_21, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + const atomic_compare_exchange_resultu32 tint_symbol_2 = atomic_result; + const uint old_value_1 = tint_symbol_2.old_value; + const uint x_23 = old_value_1; + const x__atomic_compare_exchange_resultu32 tint_symbol_3 = {x_23, (x_23 == x_21)}; + res = tint_symbol_3; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_83580d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..645a53e004 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,59 @@ +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicCompareExchangeWeak_83580d() { + uint arg_1 = 0u; + uint arg_2 = 0u; + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + arg_1 = 1u; + arg_2 = 1u; + uint x_21 = arg_2; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, arg_1, x_21); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; + uint old_value_1 = tint_symbol.old_value; + uint x_23 = old_value_1; + x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_23, (x_23 == x_21)); + res = tint_symbol_1; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicCompareExchangeWeak_83580d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..4a2cafc30e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,64 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(threadgroup atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct x__atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + +void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol_2) { + uint arg_1 = 0u; + uint arg_2 = 0u; + x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32{}; + arg_1 = 1u; + arg_2 = 1u; + uint const x_21 = arg_2; + uint const x_22 = arg_1; + atomic_compare_exchange_resultu32 const tint_symbol = atomicCompareExchangeWeak_1(tint_symbol_2, x_22, x_21); + uint const old_value_1 = tint_symbol.old_value; + uint const x_23 = old_value_1; + x__atomic_compare_exchange_resultu32 const tint_symbol_1 = {.old_value=x_23, .exchanged=(x_23 == x_21)}; + res = tint_symbol_1; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_3) { + atomic_store_explicit(tint_symbol_3, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_83580d(tint_symbol_3); + return; +} + +void compute_main_1(thread uint* const tint_symbol_4, threadgroup atomic_uint* const tint_symbol_5) { + uint const x_40 = *(tint_symbol_4); + compute_main_inner(x_40, tint_symbol_5); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_6, thread uint* const tint_symbol_7) { + { + atomic_store_explicit(tint_symbol_6, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_7) = local_invocation_index_1_param; + compute_main_1(tint_symbol_7, tint_symbol_6); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_8; + thread uint tint_symbol_9 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_8), &(tint_symbol_9)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..14223f7760 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_83580d "atomicCompareExchangeWeak_83580d" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %x__atomic_compare_exchange_resultu32 "x__atomic_compare_exchange_resultu32" + OpMemberName %x__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %x__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %x__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %x__atomic_compare_exchange_resultu32 1 Offset 4 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %bool = OpTypeBool +%x__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %18 = OpConstantNull %x__atomic_compare_exchange_resultu32 +%_ptr_Function_x__atomic_compare_exchange_resultu32 = OpTypePointer Function %x__atomic_compare_exchange_resultu32 + %uint_1 = OpConstant %uint 1 +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %34 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_83580d = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %arg_2 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %18 + OpStore %arg_1 %6 + OpStore %arg_2 %6 + OpStore %res %18 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %22 = OpLoad %uint %arg_2 + %23 = OpLoad %uint %arg_1 + %29 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %22 %23 + %30 = OpIEqual %bool %29 %22 + %24 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %29 %30 + %31 = OpCompositeExtract %uint %24 0 + %32 = OpIEqual %bool %31 %22 + %33 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %31 %32 + OpStore %res %33 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %34 +%local_invocation_index = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %42 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %44 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1 + %46 = OpFunctionCall %void %compute_main_inner %45 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %34 +%local_invocation_index_1_param = OpFunctionParameter %uint + %49 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %53 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %55 = OpLabel + %57 = OpLoad %uint %local_invocation_index_1_param_1 + %56 = OpFunctionCall %void %compute_main_inner_1 %57 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..4a5fdf835d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +struct x__atomic_compare_exchange_resultu32 { + old_value : u32, + exchanged : bool, +} + +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_83580d() { + var arg_1 : u32 = 0u; + var arg_2 : u32 = 0u; + var res : x__atomic_compare_exchange_resultu32 = x__atomic_compare_exchange_resultu32(0u, false); + arg_1 = 1u; + arg_2 = 1u; + let x_21 : u32 = arg_2; + let x_22 : u32 = arg_1; + let old_value_1 = atomicCompareExchangeWeak(&(arg_0), x_22, x_21).old_value; + let x_23 : u32 = old_value_1; + res = x__atomic_compare_exchange_resultu32(x_23, (x_23 == x_21)); + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicCompareExchangeWeak_83580d(); + return; +} + +fn compute_main_1() { + let x_40 : u32 = local_invocation_index_1; + compute_main_inner(x_40); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm new file mode 100644 index 0000000000..755a537b01 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_f2e22f "atomicExchange_f2e22f" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicExchange_f2e22f = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicExchange %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..32a2a705bc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_f2e22f() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicExchange(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicExchange_f2e22f(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicExchange_f2e22f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..32a2a705bc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_f2e22f() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicExchange(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicExchange_f2e22f(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicExchange_f2e22f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..284be713fc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicExchange_f2e22f() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicExchange(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicExchange_f2e22f(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicExchange_f2e22f() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicExchange(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicExchange_f2e22f(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..1f5986b375 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicExchange_f2e22f(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_20 = arg_1; + int const x_13 = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), x_20, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicExchange_f2e22f(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicExchange_f2e22f(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..2b2b678143 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_f2e22f "atomicExchange_f2e22f" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicExchange_f2e22f = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %14 = OpLoad %int %arg_1 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %15 = OpAtomicExchange %int %21 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..e4dad2dce0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicExchange_f2e22f() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_20 : i32 = arg_1; + let x_13 : i32 = atomicExchange(&(sb_rw.arg_0), x_20); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicExchange_f2e22f(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicExchange_f2e22f(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm new file mode 100644 index 0000000000..2ec90f3908 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_d59712 "atomicExchange_d59712" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicExchange_d59712 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicExchange %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..84b133b3a3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_d59712() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicExchange(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicExchange_d59712(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicExchange_d59712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..84b133b3a3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_d59712() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicExchange(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicExchange_d59712(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicExchange_d59712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..edc360d54d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicExchange_d59712() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicExchange(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicExchange_d59712(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicExchange_d59712() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicExchange(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicExchange_d59712(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..e27ba223e5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicExchange_d59712(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_13 = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), x_18, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicExchange_d59712(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicExchange_d59712(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..7e620f005e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_d59712 "atomicExchange_d59712" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicExchange_d59712 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %14 = OpLoad %uint %arg_1 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %15 = OpAtomicExchange %uint %19 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..d7b8cb6d08 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicExchange_d59712() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_13 : u32 = atomicExchange(&(sb_rw.arg_0), x_18); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicExchange_d59712(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicExchange_d59712(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm new file mode 100644 index 0000000000..0e6f0a80e1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_e114ba "atomicExchange_e114ba" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_e114ba = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicExchange_e114ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..d0e30a4659 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicExchange_e114ba() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicExchange_e114ba(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..d0e30a4659 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicExchange_e114ba() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicExchange_e114ba(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..03a22c2166 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicExchange_e114ba() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicExchange(arg_0, arg_1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicExchange_e114ba(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..1886d0a165 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicExchange_e114ba(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_19 = arg_1; + int const x_15 = atomic_exchange_explicit(tint_symbol, x_19, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_e114ba(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..e72725be34 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_e114ba "atomicExchange_e114ba" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %24 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_e114ba = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %20 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %20 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %24 +%local_invocation_index = OpFunctionParameter %uint + %27 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicExchange_e114ba + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %34 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %36 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %24 +%local_invocation_index_1_param = OpFunctionParameter %uint + %39 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %43 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1_param_1 + %46 = OpFunctionCall %void %compute_main_inner_1 %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..555469e670 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicExchange_e114ba() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_19 : i32 = arg_1; + let x_15 : i32 = atomicExchange(&(arg_0), x_19); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicExchange_e114ba(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm new file mode 100644 index 0000000000..3bbfe18b89 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_0a5dca "atomicExchange_0a5dca" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_0a5dca = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicExchange_0a5dca + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..f5ff3f7038 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicExchange_0a5dca() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicExchange_0a5dca(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..f5ff3f7038 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicExchange_0a5dca() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicExchange_0a5dca(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..32711c9133 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicExchange_0a5dca() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicExchange(arg_0, arg_1); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicExchange_0a5dca(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..c42c47d438 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicExchange_0a5dca(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_14 = atomic_exchange_explicit(tint_symbol, x_18, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_0a5dca(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..697005356b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_0a5dca "atomicExchange_0a5dca" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_0a5dca = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpLoad %uint %arg_1 + %18 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %17 + OpStore %res %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicExchange_0a5dca + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..89fff60d5c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicExchange_0a5dca() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_14 : u32 = atomicExchange(&(arg_0), x_18); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicExchange_0a5dca(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm new file mode 100644 index 0000000000..d961ea5c86 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_0806ad "atomicLoad_0806ad" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int +%atomicLoad_0806ad = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicLoad %int %15 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..8ce9cf2f39 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_0806ad() { + int res = 0; + const int x_9 = tint_atomicLoad(sb_rw, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_0806ad(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicLoad_0806ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..8ce9cf2f39 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_0806ad() { + int res = 0; + const int x_9 = tint_atomicLoad(sb_rw, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_0806ad(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicLoad_0806ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..d034197209 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicLoad_0806ad() { + int res = 0; + int x_9 = atomicOr(sb_rw.arg_0, 0); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_0806ad(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicLoad_0806ad() { + int res = 0; + int x_9 = atomicOr(sb_rw.arg_0, 0); + res = x_9; + return; +} + +void compute_main_1() { + atomicLoad_0806ad(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..1ea07a1c38 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicLoad_0806ad(device SB_RW_atomic* const tint_symbol) { + int res = 0; + int const x_9 = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicLoad_0806ad(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicLoad_0806ad(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..40034c7744 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_0806ad "atomicLoad_0806ad" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicLoad_0806ad = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %res %9 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %12 = OpAtomicLoad %int %18 %uint_1 %uint_0 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..b13dbfb432 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicLoad_0806ad() { + var res : i32 = 0i; + let x_9 : i32 = atomicLoad(&(sb_rw.arg_0)); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicLoad_0806ad(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicLoad_0806ad(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm new file mode 100644 index 0000000000..776c62c09f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_fe6cc3 "atomicLoad_fe6cc3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicLoad_fe6cc3 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicLoad %uint %14 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..454ed3cf18 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_fe6cc3() { + uint res = 0u; + const uint x_9 = tint_atomicLoad(sb_rw, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_fe6cc3(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicLoad_fe6cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..454ed3cf18 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,36 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_fe6cc3() { + uint res = 0u; + const uint x_9 = tint_atomicLoad(sb_rw, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_fe6cc3(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicLoad_fe6cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..cebe232998 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicLoad_fe6cc3() { + uint res = 0u; + uint x_9 = atomicOr(sb_rw.arg_0, 0u); + res = x_9; + return; +} + +void fragment_main_1() { + atomicLoad_fe6cc3(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicLoad_fe6cc3() { + uint res = 0u; + uint x_9 = atomicOr(sb_rw.arg_0, 0u); + res = x_9; + return; +} + +void compute_main_1() { + atomicLoad_fe6cc3(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..a6cce2757a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicLoad_fe6cc3(device SB_RW_atomic* const tint_symbol) { + uint res = 0u; + uint const x_9 = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed); + res = x_9; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicLoad_fe6cc3(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicLoad_fe6cc3(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..e12b47bae3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_fe6cc3 "atomicLoad_fe6cc3" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicLoad_fe6cc3 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %res %9 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %12 = OpAtomicLoad %uint %17 %uint_1 %uint_0 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..b03da62e6d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicLoad_fe6cc3() { + var res : u32 = 0u; + let x_9 : u32 = atomicLoad(&(sb_rw.arg_0)); + res = x_9; + return; +} + +fn fragment_main_1() { + atomicLoad_fe6cc3(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicLoad_fe6cc3(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm new file mode 100644 index 0000000000..b996359601 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_afcc03 "atomicLoad_afcc03" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_afcc03 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %17 + %11 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicLoad_afcc03 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..1593c13612 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicLoad_afcc03() { + int res = 0; + int atomic_result = 0; + InterlockedOr(arg_0, 0, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicLoad_afcc03(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1593c13612 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicLoad_afcc03() { + int res = 0; + int atomic_result = 0; + InterlockedOr(arg_0, 0, atomic_result); + const int x_11 = atomic_result; + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicLoad_afcc03(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..e0c158b430 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicLoad_afcc03() { + int res = 0; + int x_11 = atomicOr(arg_0, 0); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicLoad_afcc03(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..8f6ee408a4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicLoad_afcc03(threadgroup atomic_int* const tint_symbol) { + int res = 0; + int const x_11 = atomic_load_explicit(tint_symbol, memory_order_relaxed); + res = x_11; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_afcc03(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_30 = *(tint_symbol_2); + compute_main_inner(x_30, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..829b8487e3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_afcc03 "atomicLoad_afcc03" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_afcc03 = OpFunction %void None %10 + %13 = OpLabel + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %res %14 + %17 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicLoad_afcc03 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %31 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %33 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %21 +%local_invocation_index_1_param = OpFunctionParameter %uint + %36 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %40 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %42 = OpLabel + %44 = OpLoad %uint %local_invocation_index_1_param_1 + %43 = OpFunctionCall %void %compute_main_inner_1 %44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..af0c057346 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicLoad_afcc03() { + var res : i32 = 0i; + let x_11 : i32 = atomicLoad(&(arg_0)); + res = x_11; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicLoad_afcc03(); + return; +} + +fn compute_main_1() { + let x_30 : u32 = local_invocation_index_1; + compute_main_inner(x_30); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm new file mode 100644 index 0000000000..20eeca7ef5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_361bf1 "atomicLoad_361bf1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %17 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_361bf1 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %16 + %10 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %17 +%local_invocation_index = OpFunctionParameter %uint + %20 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %16 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %25 = OpFunctionCall %void %atomicLoad_361bf1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %29 = OpLoad %uint %local_invocation_index_1 + %28 = OpFunctionCall %void %compute_main_inner %29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..803eadd060 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicLoad_361bf1() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedOr(arg_0, 0, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicLoad_361bf1(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..803eadd060 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,44 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicLoad_361bf1() { + uint res = 0u; + uint atomic_result = 0u; + InterlockedOr(arg_0, 0, atomic_result); + const uint x_10 = atomic_result; + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicLoad_361bf1(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..8bd40a675c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicLoad_361bf1() { + uint res = 0u; + uint x_10 = atomicOr(arg_0, 0u); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicLoad_361bf1(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..d7fcb6e569 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +void atomicLoad_361bf1(threadgroup atomic_uint* const tint_symbol) { + uint res = 0u; + uint const x_10 = atomic_load_explicit(tint_symbol, memory_order_relaxed); + res = x_10; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_361bf1(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_29 = *(tint_symbol_2); + compute_main_inner(x_29, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..7a075badba --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_361bf1 "atomicLoad_361bf1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_361bf1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %res %6 + %15 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicLoad_361bf1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %29 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %19 +%local_invocation_index_1_param = OpFunctionParameter %uint + %34 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %38 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %42 = OpLoad %uint %local_invocation_index_1_param_1 + %41 = OpFunctionCall %void %compute_main_inner_1 %42 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..f132c6fa83 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicLoad_361bf1() { + var res : u32 = 0u; + let x_10 : u32 = atomicLoad(&(arg_0)); + res = x_10; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicLoad_361bf1(); + return; +} + +fn compute_main_1() { + let x_29 : u32 = local_invocation_index_1; + compute_main_inner(x_29); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm new file mode 100644 index 0000000000..e6ff30ef3a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_92aa72 "atomicMax_92aa72" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicMax_92aa72 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicSMax %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..9b64baf78f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_92aa72() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicMax(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMax_92aa72(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMax_92aa72(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..9b64baf78f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_92aa72() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicMax(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMax_92aa72(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMax_92aa72(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..d458f056ad --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicMax_92aa72() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicMax(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMax_92aa72(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicMax_92aa72() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicMax(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicMax_92aa72(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..61bf2eb800 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicMax_92aa72(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_20 = arg_1; + int const x_13 = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), x_20, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicMax_92aa72(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicMax_92aa72(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..c0a4470ffb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_92aa72 "atomicMax_92aa72" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicMax_92aa72 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %14 = OpLoad %int %arg_1 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %15 = OpAtomicSMax %int %21 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..eea496ef2d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicMax_92aa72() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_20 : i32 = arg_1; + let x_13 : i32 = atomicMax(&(sb_rw.arg_0), x_20); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicMax_92aa72(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicMax_92aa72(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm new file mode 100644 index 0000000000..97bae6a5c4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_51b9be "atomicMax_51b9be" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMax_51b9be = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicUMax %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..e9a8f8456a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_51b9be() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicMax(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMax_51b9be(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMax_51b9be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..e9a8f8456a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_51b9be() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicMax(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMax_51b9be(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMax_51b9be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..e5f7f89955 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicMax_51b9be() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicMax(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMax_51b9be(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicMax_51b9be() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicMax(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicMax_51b9be(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..a77e9cfa68 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicMax_51b9be(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_13 = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), x_18, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicMax_51b9be(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicMax_51b9be(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..4ed13b0a3c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_51b9be "atomicMax_51b9be" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMax_51b9be = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %14 = OpLoad %uint %arg_1 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %15 = OpAtomicUMax %uint %19 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..ea27f1d7c2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicMax_51b9be() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_13 : u32 = atomicMax(&(sb_rw.arg_0), x_18); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicMax_51b9be(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicMax_51b9be(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm new file mode 100644 index 0000000000..2864a14479 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_a89cc3 "atomicMax_a89cc3" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_a89cc3 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicMax_a89cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..3020cf2dca --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicMax_a89cc3() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedMax(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMax_a89cc3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..3020cf2dca --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicMax_a89cc3() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedMax(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMax_a89cc3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..ce19147f59 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicMax_a89cc3() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicMax(arg_0, arg_1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicMax_a89cc3(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..7a3987d5ac --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicMax_a89cc3(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_19 = arg_1; + int const x_15 = atomic_fetch_max_explicit(tint_symbol, x_19, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_a89cc3(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..696868b763 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_a89cc3 "atomicMax_a89cc3" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %24 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_a89cc3 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %20 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %20 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %24 +%local_invocation_index = OpFunctionParameter %uint + %27 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicMax_a89cc3 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %34 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %36 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %24 +%local_invocation_index_1_param = OpFunctionParameter %uint + %39 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %43 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1_param_1 + %46 = OpFunctionCall %void %compute_main_inner_1 %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..9086b7426e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicMax_a89cc3() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_19 : i32 = arg_1; + let x_15 : i32 = atomicMax(&(arg_0), x_19); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicMax_a89cc3(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm new file mode 100644 index 0000000000..03577ee568 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_beccfc "atomicMax_beccfc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_beccfc = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicMax_beccfc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..b87186d8da --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicMax_beccfc() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMax(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMax_beccfc(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b87186d8da --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicMax_beccfc() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMax(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMax_beccfc(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..f20964483c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicMax_beccfc() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicMax(arg_0, arg_1); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicMax_beccfc(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..edd31021e4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicMax_beccfc(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_14 = atomic_fetch_max_explicit(tint_symbol, x_18, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_beccfc(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..ad735e12c7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_beccfc "atomicMax_beccfc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_beccfc = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpLoad %uint %arg_1 + %18 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %17 + OpStore %res %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicMax_beccfc + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..e74059976f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicMax_beccfc() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_14 : u32 = atomicMax(&(arg_0), x_18); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicMax_beccfc(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm new file mode 100644 index 0000000000..f2ca9b8e59 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_8e38dc "atomicMin_8e38dc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicMin_8e38dc = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicSMin %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..e169190664 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_8e38dc() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicMin(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMin_8e38dc(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMin_8e38dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..e169190664 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_8e38dc() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicMin(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMin_8e38dc(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMin_8e38dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..e233a685b8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicMin_8e38dc() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicMin(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMin_8e38dc(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicMin_8e38dc() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicMin(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicMin_8e38dc(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..dfe6ecb27f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicMin_8e38dc(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_20 = arg_1; + int const x_13 = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), x_20, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicMin_8e38dc(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicMin_8e38dc(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..7e5e670ac5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_8e38dc "atomicMin_8e38dc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicMin_8e38dc = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %14 = OpLoad %int %arg_1 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %15 = OpAtomicSMin %int %21 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..0ef454132d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicMin_8e38dc() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_20 : i32 = arg_1; + let x_13 : i32 = atomicMin(&(sb_rw.arg_0), x_20); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicMin_8e38dc(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicMin_8e38dc(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm new file mode 100644 index 0000000000..f3cc67b6e6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_c67a74 "atomicMin_c67a74" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMin_c67a74 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicUMin %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..76447efb9a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_c67a74() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicMin(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMin_c67a74(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMin_c67a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..76447efb9a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_c67a74() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicMin(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMin_c67a74(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicMin_c67a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..06e8d89512 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicMin_c67a74() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicMin(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicMin_c67a74(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicMin_c67a74() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicMin(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicMin_c67a74(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..147d01efb7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicMin_c67a74(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_13 = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), x_18, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicMin_c67a74(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicMin_c67a74(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..309f258a47 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_c67a74 "atomicMin_c67a74" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMin_c67a74 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %14 = OpLoad %uint %arg_1 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %15 = OpAtomicUMin %uint %19 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..3586e32234 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicMin_c67a74() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_13 : u32 = atomicMin(&(sb_rw.arg_0), x_18); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicMin_c67a74(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicMin_c67a74(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm new file mode 100644 index 0000000000..ddfa25a7f9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_278235 "atomicMin_278235" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_278235 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicMin_278235 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..cfc09f24e2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicMin_278235() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedMin(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMin_278235(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..cfc09f24e2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicMin_278235() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedMin(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMin_278235(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..abb7ad0e94 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicMin_278235() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicMin(arg_0, arg_1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicMin_278235(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..8b6eeebddf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicMin_278235(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_19 = arg_1; + int const x_15 = atomic_fetch_min_explicit(tint_symbol, x_19, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_278235(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..564e8b7e97 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_278235 "atomicMin_278235" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %24 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_278235 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %20 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %20 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %24 +%local_invocation_index = OpFunctionParameter %uint + %27 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicMin_278235 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %34 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %36 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %24 +%local_invocation_index_1_param = OpFunctionParameter %uint + %39 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %43 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1_param_1 + %46 = OpFunctionCall %void %compute_main_inner_1 %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..e55849b691 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicMin_278235() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_19 : i32 = arg_1; + let x_15 : i32 = atomicMin(&(arg_0), x_19); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicMin_278235(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm new file mode 100644 index 0000000000..784a0143e3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_69d383 "atomicMin_69d383" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_69d383 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicMin_69d383 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..64c8150087 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicMin_69d383() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMin(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMin_69d383(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..64c8150087 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicMin_69d383() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMin(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicMin_69d383(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..b5b3a4a548 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicMin_69d383() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicMin(arg_0, arg_1); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicMin_69d383(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..6336751508 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicMin_69d383(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_14 = atomic_fetch_min_explicit(tint_symbol, x_18, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_69d383(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..8c0bfde247 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_69d383 "atomicMin_69d383" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_69d383 = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpLoad %uint %arg_1 + %18 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %17 + OpStore %res %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicMin_69d383 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..9a15df0279 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicMin_69d383() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_14 : u32 = atomicMin(&(arg_0), x_18); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicMin_69d383(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm new file mode 100644 index 0000000000..978e4ad7b2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_8d96a0 "atomicOr_8d96a0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicOr_8d96a0 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicOr %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..1daeac4f1c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_8d96a0() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicOr(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicOr_8d96a0(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicOr_8d96a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1daeac4f1c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_8d96a0() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicOr(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicOr_8d96a0(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicOr_8d96a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..dd172741ef --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicOr_8d96a0() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicOr(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicOr_8d96a0(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicOr_8d96a0() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicOr(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicOr_8d96a0(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..a0bf71fd5b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicOr_8d96a0(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_20 = arg_1; + int const x_13 = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), x_20, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicOr_8d96a0(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicOr_8d96a0(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..a5753a7dab --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_8d96a0 "atomicOr_8d96a0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicOr_8d96a0 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %14 = OpLoad %int %arg_1 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %15 = OpAtomicOr %int %21 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..5c96c733a5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicOr_8d96a0() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_20 : i32 = arg_1; + let x_13 : i32 = atomicOr(&(sb_rw.arg_0), x_20); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicOr_8d96a0(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicOr_8d96a0(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm new file mode 100644 index 0000000000..c38fc528ec --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_5e95d4 "atomicOr_5e95d4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicOr_5e95d4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicOr %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..2268f30589 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_5e95d4() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicOr(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicOr_5e95d4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicOr_5e95d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..2268f30589 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_5e95d4() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicOr(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicOr_5e95d4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicOr_5e95d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..ba78059d7a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicOr_5e95d4() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicOr(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicOr_5e95d4(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicOr_5e95d4() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicOr(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicOr_5e95d4(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..fa5456597c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicOr_5e95d4(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_13 = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), x_18, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicOr_5e95d4(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicOr_5e95d4(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..2d2a230427 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_5e95d4 "atomicOr_5e95d4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicOr_5e95d4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %14 = OpLoad %uint %arg_1 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %15 = OpAtomicOr %uint %19 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..8dae20d3b5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicOr_5e95d4() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_13 : u32 = atomicOr(&(sb_rw.arg_0), x_18); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicOr_5e95d4(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicOr_5e95d4(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm new file mode 100644 index 0000000000..6a5541c37d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_d09248 "atomicOr_d09248" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_d09248 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicOr_d09248 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..a4a9b58dad --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicOr_d09248() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedOr(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicOr_d09248(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..a4a9b58dad --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicOr_d09248() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedOr(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicOr_d09248(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..b045e75169 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicOr_d09248() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicOr(arg_0, arg_1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicOr_d09248(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..e262929f5c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicOr_d09248(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_19 = arg_1; + int const x_15 = atomic_fetch_or_explicit(tint_symbol, x_19, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_d09248(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..f2cdcca2b4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_d09248 "atomicOr_d09248" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %24 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_d09248 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %20 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %20 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %24 +%local_invocation_index = OpFunctionParameter %uint + %27 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicOr_d09248 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %34 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %36 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %24 +%local_invocation_index_1_param = OpFunctionParameter %uint + %39 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %43 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1_param_1 + %46 = OpFunctionCall %void %compute_main_inner_1 %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..f0329eb20e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicOr_d09248() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_19 : i32 = arg_1; + let x_15 : i32 = atomicOr(&(arg_0), x_19); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicOr_d09248(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm new file mode 100644 index 0000000000..9db7191d2f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_5e3d61 "atomicOr_5e3d61" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_5e3d61 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicOr_5e3d61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..7a4ad50d89 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicOr_5e3d61() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedOr(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicOr_5e3d61(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..7a4ad50d89 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicOr_5e3d61() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedOr(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicOr_5e3d61(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..2894885906 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicOr_5e3d61() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicOr(arg_0, arg_1); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicOr_5e3d61(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..4078be65eb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicOr_5e3d61(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_14 = atomic_fetch_or_explicit(tint_symbol, x_18, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_5e3d61(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..437d7bf15b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_5e3d61 "atomicOr_5e3d61" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_5e3d61 = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpLoad %uint %arg_1 + %18 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %17 + OpStore %res %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicOr_5e3d61 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..781ca2e3b2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicOr_5e3d61() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_14 : u32 = atomicOr(&(arg_0), x_18); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicOr_5e3d61(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm new file mode 100644 index 0000000000..5d03e4ee54 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_d1e9a6 "atomicStore_d1e9a6" + OpName %arg_1 "arg_1" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicStore_d1e9a6 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + OpAtomicStore %19 %uint_1 %uint_0 %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..4151049395 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_d1e9a6() { + int arg_1 = 0; + arg_1 = 1; + tint_atomicStore(sb_rw, 0u, arg_1); + return; +} + +void fragment_main_1() { + atomicStore_d1e9a6(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicStore_d1e9a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4151049395 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_d1e9a6() { + int arg_1 = 0; + arg_1 = 1; + tint_atomicStore(sb_rw, 0u, arg_1); + return; +} + +void fragment_main_1() { + atomicStore_d1e9a6(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicStore_d1e9a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..cf63c29f5c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicStore_d1e9a6() { + int arg_1 = 0; + arg_1 = 1; + atomicExchange(sb_rw.arg_0, arg_1); + return; +} + +void fragment_main_1() { + atomicStore_d1e9a6(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicStore_d1e9a6() { + int arg_1 = 0; + arg_1 = 1; + atomicExchange(sb_rw.arg_0, arg_1); + return; +} + +void compute_main_1() { + atomicStore_d1e9a6(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..4aa0544815 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicStore_d1e9a6(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + arg_1 = 1; + int const x_20 = arg_1; + atomic_store_explicit(&((*(tint_symbol)).arg_0), x_20, memory_order_relaxed); + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicStore_d1e9a6(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicStore_d1e9a6(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..77ab9b09e1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_d1e9a6 "atomicStore_d1e9a6" + OpName %arg_1 "arg_1" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicStore_d1e9a6 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %arg_1 %int_1 + %13 = OpLoad %int %arg_1 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + OpAtomicStore %20 %uint_1 %uint_0 %13 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..9db31ae995 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,37 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicStore_d1e9a6() { + var arg_1 : i32 = 0i; + arg_1 = 1i; + let x_20 : i32 = arg_1; + atomicStore(&(sb_rw.arg_0), x_20); + return; +} + +fn fragment_main_1() { + atomicStore_d1e9a6(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicStore_d1e9a6(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm new file mode 100644 index 0000000000..f0d74fe1cf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_cdc29e "atomicStore_cdc29e" + OpName %arg_1 "arg_1" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicStore_cdc29e = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + OpAtomicStore %17 %uint_1 %uint_0 %18 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..4550cdd2eb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) { + uint ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_cdc29e() { + uint arg_1 = 0u; + arg_1 = 1u; + tint_atomicStore(sb_rw, 0u, arg_1); + return; +} + +void fragment_main_1() { + atomicStore_cdc29e(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicStore_cdc29e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4550cdd2eb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) { + uint ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_cdc29e() { + uint arg_1 = 0u; + arg_1 = 1u; + tint_atomicStore(sb_rw, 0u, arg_1); + return; +} + +void fragment_main_1() { + atomicStore_cdc29e(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicStore_cdc29e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..7a8d693ac8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.glsl @@ -0,0 +1,68 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicStore_cdc29e() { + uint arg_1 = 0u; + arg_1 = 1u; + atomicExchange(sb_rw.arg_0, arg_1); + return; +} + +void fragment_main_1() { + atomicStore_cdc29e(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicStore_cdc29e() { + uint arg_1 = 0u; + arg_1 = 1u; + atomicExchange(sb_rw.arg_0, arg_1); + return; +} + +void compute_main_1() { + atomicStore_cdc29e(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..21f974662a --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicStore_cdc29e(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + atomic_store_explicit(&((*(tint_symbol)).arg_0), x_18, memory_order_relaxed); + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicStore_cdc29e(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicStore_cdc29e(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..ababfa4ef8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_cdc29e "atomicStore_cdc29e" + OpName %arg_1 "arg_1" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicStore_cdc29e = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %arg_1 %uint_1 + %13 = OpLoad %uint %arg_1 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + OpAtomicStore %18 %uint_1 %uint_0 %13 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..1095ccc7d9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,37 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicStore_cdc29e() { + var arg_1 : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + atomicStore(&(sb_rw.arg_0), x_18); + return; +} + +fn fragment_main_1() { + atomicStore_cdc29e(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicStore_cdc29e(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm new file mode 100644 index 0000000000..a0c7fb72f9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_8bea94 "atomicStore_8bea94" + OpName %arg_1 "arg_1" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_8bea94 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + OpAtomicStore %arg_0 %uint_2 %uint_0 %19 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicStore_8bea94 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..68704dd4a3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,43 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicStore_8bea94() { + int arg_1 = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicStore_8bea94(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..68704dd4a3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,43 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicStore_8bea94() { + int arg_1 = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicStore_8bea94(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..89e564c47f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicStore_8bea94() { + int arg_1 = 0; + arg_1 = 1; + atomicExchange(arg_0, arg_1); + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicStore_8bea94(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..1e0fd57bcd --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +void atomicStore_8bea94(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + arg_1 = 1; + int const x_19 = arg_1; + atomic_store_explicit(tint_symbol, x_19, memory_order_relaxed); + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_8bea94(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..63e93126b1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_8bea94 "atomicStore_8bea94" + OpName %arg_1 "arg_1" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %23 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_8bea94 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %arg_1 %int_1 + %18 = OpLoad %int %arg_1 + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %23 +%local_invocation_index = OpFunctionParameter %uint + %26 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %31 = OpFunctionCall %void %atomicStore_8bea94 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %33 = OpLabel + %34 = OpLoad %uint %local_invocation_index_1 + %35 = OpFunctionCall %void %compute_main_inner %34 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %23 +%local_invocation_index_1_param = OpFunctionParameter %uint + %38 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %42 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %44 = OpLabel + %46 = OpLoad %uint %local_invocation_index_1_param_1 + %45 = OpFunctionCall %void %compute_main_inner_1 %46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..026212237f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,30 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicStore_8bea94() { + var arg_1 : i32 = 0i; + arg_1 = 1i; + let x_19 : i32 = arg_1; + atomicStore(&(arg_0), x_19); + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicStore_8bea94(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm new file mode 100644 index 0000000000..72d2c5fc56 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_726882 "atomicStore_726882" + OpName %arg_1 "arg_1" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_726882 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicStore_726882 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..5c4176348e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,43 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicStore_726882() { + uint arg_1 = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicStore_726882(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..5c4176348e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,43 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicStore_726882() { + uint arg_1 = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicStore_726882(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..dcceb313f5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,37 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicStore_726882() { + uint arg_1 = 0u; + arg_1 = 1u; + atomicExchange(arg_0, arg_1); + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicStore_726882(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..fd362677ce --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +void atomicStore_726882(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + atomic_store_explicit(tint_symbol, x_18, memory_order_relaxed); + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_726882(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_31 = *(tint_symbol_2); + compute_main_inner(x_31, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..2b50c09779 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_726882 "atomicStore_726882" + OpName %arg_1 "arg_1" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_726882 = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %arg_1 %uint_1 + %16 = OpLoad %uint %arg_1 + OpAtomicStore %arg_0 %uint_2 %uint_0 %16 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicStore_726882 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %31 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %33 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %21 +%local_invocation_index_1_param = OpFunctionParameter %uint + %36 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %40 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %44 = OpLoad %uint %local_invocation_index_1_param_1 + %43 = OpFunctionCall %void %compute_main_inner_1 %44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..fa0013aba5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,30 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicStore_726882() { + var arg_1 : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + atomicStore(&(arg_0), x_18); + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicStore_726882(); + return; +} + +fn compute_main_1() { + let x_31 : u32 = local_invocation_index_1; + compute_main_inner(x_31); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm new file mode 100644 index 0000000000..3bbf26a4b0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_051100 "atomicSub_051100" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicSub_051100 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicISub %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..fca2ec1757 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_051100() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicSub(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicSub_051100(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicSub_051100(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..fca2ec1757 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_051100() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicSub(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicSub_051100(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicSub_051100(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..fcc4155037 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicSub_051100() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAdd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicSub_051100(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicSub_051100() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAdd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicSub_051100(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..2a79213ba0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicSub_051100(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_20 = arg_1; + int const x_13 = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), x_20, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicSub_051100(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicSub_051100(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..c40bebac32 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_051100 "atomicSub_051100" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicSub_051100 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %14 = OpLoad %int %arg_1 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %15 = OpAtomicISub %int %21 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..d47d88650f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicSub_051100() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_20 : i32 = arg_1; + let x_13 : i32 = atomicSub(&(sb_rw.arg_0), x_20); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicSub_051100(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicSub_051100(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm new file mode 100644 index 0000000000..4d20c6d426 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_15bfc9 "atomicSub_15bfc9" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicSub_15bfc9 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicISub %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..f036c9002d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_15bfc9() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicSub(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicSub_15bfc9(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicSub_15bfc9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..f036c9002d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_15bfc9() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicSub(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicSub_15bfc9(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicSub_15bfc9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..f91b7f880f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicSub_15bfc9() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAdd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicSub_15bfc9(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicSub_15bfc9() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAdd(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicSub_15bfc9(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..efb4526599 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicSub_15bfc9(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_13 = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), x_18, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicSub_15bfc9(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicSub_15bfc9(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..6704485521 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_15bfc9 "atomicSub_15bfc9" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicSub_15bfc9 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %14 = OpLoad %uint %arg_1 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %15 = OpAtomicISub %uint %19 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..bd9a80c284 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicSub_15bfc9() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_13 : u32 = atomicSub(&(sb_rw.arg_0), x_18); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicSub_15bfc9(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicSub_15bfc9(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm new file mode 100644 index 0000000000..d96432dd36 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_77883a "atomicSub_77883a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_77883a = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicSub_77883a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..988dbad445 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicSub_77883a() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, -arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicSub_77883a(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..988dbad445 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicSub_77883a() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, -arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicSub_77883a(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..e08bb7b4be --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicSub_77883a() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicAdd(arg_0, arg_1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicSub_77883a(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..208e18a20d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicSub_77883a(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_19 = arg_1; + int const x_15 = atomic_fetch_sub_explicit(tint_symbol, x_19, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_77883a(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..9f3a0652f8 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_77883a "atomicSub_77883a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %24 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_77883a = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %20 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %20 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %24 +%local_invocation_index = OpFunctionParameter %uint + %27 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicSub_77883a + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %34 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %36 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %24 +%local_invocation_index_1_param = OpFunctionParameter %uint + %39 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %43 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1_param_1 + %46 = OpFunctionCall %void %compute_main_inner_1 %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..b2781cec60 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicSub_77883a() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_19 : i32 = arg_1; + let x_15 : i32 = atomicSub(&(arg_0), x_19); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicSub_77883a(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm new file mode 100644 index 0000000000..2c6b98e511 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_0d26c2 "atomicSub_0d26c2" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_0d26c2 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicSub_0d26c2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..eb60c8aa26 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicSub_0d26c2() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicSub_0d26c2(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..eb60c8aa26 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicSub_0d26c2() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicSub_0d26c2(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..a11a53ea08 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicSub_0d26c2() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicAdd(arg_0, arg_1); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicSub_0d26c2(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..ec9661dceb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicSub_0d26c2(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_14 = atomic_fetch_sub_explicit(tint_symbol, x_18, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_0d26c2(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..c1b5f7a3c6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_0d26c2 "atomicSub_0d26c2" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_0d26c2 = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpLoad %uint %arg_1 + %18 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %17 + OpStore %res %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicSub_0d26c2 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..77f25f7d70 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicSub_0d26c2() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_14 : u32 = atomicSub(&(arg_0), x_18); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicSub_0d26c2(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm new file mode 100644 index 0000000000..cff5564090 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_c1b78c "atomicXor_c1b78c" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicXor_c1b78c = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicXor %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..195284cb72 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_c1b78c() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicXor(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicXor_c1b78c(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicXor_c1b78c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..195284cb72 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_c1b78c() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicXor(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicXor_c1b78c(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicXor_c1b78c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..4953346784 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicXor_c1b78c() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicXor(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicXor_c1b78c(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicXor_c1b78c() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicXor(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicXor_c1b78c(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..1e98bee8f1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicXor_c1b78c(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_20 = arg_1; + int const x_13 = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), x_20, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicXor_c1b78c(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicXor_c1b78c(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..74a9caa4c6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_c1b78c "atomicXor_c1b78c" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicXor_c1b78c = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %14 = OpLoad %int %arg_1 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %15 = OpAtomicXor %int %21 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..4325da12d4 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicXor_c1b78c() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_20 : i32 = arg_1; + let x_13 : i32 = atomicXor(&(sb_rw.arg_0), x_20); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicXor_c1b78c(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicXor_c1b78c(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm new file mode 100644 index 0000000000..a16daff5f6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_54510e "atomicXor_54510e" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicXor_54510e = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicXor %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..36ccd4793e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_54510e() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicXor(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicXor_54510e(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicXor_54510e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..36ccd4793e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_54510e() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicXor(sb_rw, 0u, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicXor_54510e(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicXor_54510e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..c382bffbcf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicXor_54510e() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicXor(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicXor_54510e(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicXor_54510e() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicXor(sb_rw.arg_0, arg_1); + res = x_13; + return; +} + +void compute_main_1() { + atomicXor_54510e(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..068d4aa69e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicXor_54510e(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_13 = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), x_18, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicXor_54510e(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicXor_54510e(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..786b9f608c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_54510e "atomicXor_54510e" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicXor_54510e = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %14 = OpLoad %uint %arg_1 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %15 = OpAtomicXor %uint %19 %uint_1 %uint_0 %14 + OpStore %res %15 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..2b3dd0d850 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicXor_54510e() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_13 : u32 = atomicXor(&(sb_rw.arg_0), x_18); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicXor_54510e(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicXor_54510e(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm new file mode 100644 index 0000000000..62e03513cf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_75dc95 "atomicXor_75dc95" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_75dc95 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicXor_75dc95 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..2c71c9af5e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicXor_75dc95() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedXor(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicXor_75dc95(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..2c71c9af5e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicXor_75dc95() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedXor(arg_0, arg_1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicXor_75dc95(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..f5685175ea --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicXor_75dc95() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicXor(arg_0, arg_1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicXor_75dc95(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..840c3182c3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicXor_75dc95(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_19 = arg_1; + int const x_15 = atomic_fetch_xor_explicit(tint_symbol, x_19, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_75dc95(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..2bac01dfc2 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_75dc95 "atomicXor_75dc95" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %24 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_75dc95 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %20 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %20 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %24 +%local_invocation_index = OpFunctionParameter %uint + %27 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicXor_75dc95 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %34 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %36 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %24 +%local_invocation_index_1_param = OpFunctionParameter %uint + %39 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %43 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_1_param_1 + %46 = OpFunctionCall %void %compute_main_inner_1 %47 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..54490e1c5f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicXor_75dc95() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_19 : i32 = arg_1; + let x_15 : i32 = atomicXor(&(arg_0), x_19); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicXor_75dc95(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm new file mode 100644 index 0000000000..ba98e8dc4e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_c8e6be "atomicXor_c8e6be" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_c8e6be = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicXor_c8e6be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..e7ceab2e56 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicXor_c8e6be() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedXor(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicXor_c8e6be(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..e7ceab2e56 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicXor_c8e6be() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedXor(arg_0, arg_1, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicXor_c8e6be(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..2c8878127b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicXor_c8e6be() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicXor(arg_0, arg_1); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicXor_c8e6be(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..3eb2509da5 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +void atomicXor_c8e6be(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_18 = arg_1; + uint const x_14 = atomic_fetch_xor_explicit(tint_symbol, x_18, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_c8e6be(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..83c9054512 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_c8e6be "atomicXor_c8e6be" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %22 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_c8e6be = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpLoad %uint %arg_1 + %18 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %17 + OpStore %res %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %30 = OpFunctionCall %void %atomicXor_c8e6be + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %32 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %22 +%local_invocation_index_1_param = OpFunctionParameter %uint + %37 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %41 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1_param_1 + %44 = OpFunctionCall %void %compute_main_inner_1 %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..c75d80815c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicXor_c8e6be() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_18 : u32 = arg_1; + let x_14 : u32 = atomicXor(&(arg_0), x_18); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicXor_c8e6be(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm new file mode 100644 index 0000000000..fb43e2cc3d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %13 = OpAtomicIDecrement %int %19 %uint_1 %uint_0 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..abf10b505d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicSub(sb_rw, 0u, 1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..abf10b505d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicSub(sb_rw, 0u, 1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..167e99cff9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAdd(sb_rw.arg_0, 1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAdd(sb_rw.arg_0, 1); + res = x_13; + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..8bbb60029d --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicAdd_d32fe4(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_13 = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_d32fe4(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_d32fe4(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..870704eaac --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %14 = OpAtomicISub %int %20 %uint_1 %uint_0 %int_1 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..1e011b06f3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,38 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_d32fe4() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_13 : i32 = atomicSub(&(sb_rw.arg_0), 1i); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm new file mode 100644 index 0000000000..9e693ca337 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %13 = OpAtomicIDecrement %uint %17 %uint_1 %uint_0 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..4e6bb866ec --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicSub(sb_rw, 0u, 1u); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4e6bb866ec --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicSub(sb_rw, 0u, 1u); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..d9e05156d9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAdd(sb_rw.arg_0, 1u); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAdd(sb_rw.arg_0, 1u); + res = x_13; + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..7fe160f01b --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicAdd_8a199a(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_13 = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_8a199a(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_8a199a(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..63b3eebfdb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %14 = OpAtomicISub %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..f12b29eafc --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,38 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_8a199a() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_13 : u32 = atomicSub(&(sb_rw.arg_0), 1u); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_8a199a(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm new file mode 100644 index 0000000000..9f14c537d0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %15 = OpAtomicIDecrement %int %arg_0 %uint_2 %uint_0 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..181873a5f6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, -1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..181873a5f6 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, -1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..ef3ffb1c16 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicAdd_794055() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicAdd(arg_0, 1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..9f11082f0e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_15 = atomic_fetch_sub_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_794055(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..843bd5ae40 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %23 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %23 +%local_invocation_index = OpFunctionParameter %uint + %26 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %31 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %33 = OpLabel + %34 = OpLoad %uint %local_invocation_index_1 + %35 = OpFunctionCall %void %compute_main_inner %34 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %23 +%local_invocation_index_1_param = OpFunctionParameter %uint + %38 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %42 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %44 = OpLabel + %46 = OpLoad %uint %local_invocation_index_1_param_1 + %45 = OpFunctionCall %void %compute_main_inner_1 %46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..540501adaf --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_794055() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_15 : i32 = atomicSub(&(arg_0), 1i); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicAdd_794055(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm new file mode 100644 index 0000000000..1d1b5bdfef --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %14 = OpAtomicIDecrement %uint %arg_0 %uint_2 %uint_0 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..16aaa1c4d7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -1u, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..16aaa1c4d7 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -1u, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..b9c2faf670 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicAdd_d5db1d() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicAdd(arg_0, 1u); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..74b7a0d727 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_14 = atomic_fetch_sub_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_d5db1d(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..77041b4aef --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %31 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %33 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %21 +%local_invocation_index_1_param = OpFunctionParameter %uint + %36 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %40 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %44 = OpLoad %uint %local_invocation_index_1_param_1 + %43 = OpFunctionCall %void %compute_main_inner_1 %44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..64dabf43d1 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_d5db1d() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_14 : u32 = atomicSub(&(arg_0), 1u); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicAdd_d5db1d(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm new file mode 100644 index 0000000000..9bacaec6ed --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %13 = OpAtomicIIncrement %int %19 %uint_1 %uint_0 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..9be7a9ef69 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicAdd(sb_rw, 0u, 1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..9be7a9ef69 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + const int x_13 = tint_atomicAdd(sb_rw, 0u, 1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..167e99cff9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAdd(sb_rw.arg_0, 1); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_13 = atomicAdd(sb_rw.arg_0, 1); + res = x_13; + return; +} + +void compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.msl new file mode 100644 index 0000000000..acfdf7fd8e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_int arg_0; +}; + +struct SB_RW { + int arg_0; +}; + +void atomicAdd_d32fe4(device SB_RW_atomic* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_13 = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), 1, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_d32fe4(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_d32fe4(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..f206f17221 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 +%SB_RW_atomic = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %9 + %res = OpVariable %_ptr_Function_int Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %int_1 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %14 = OpAtomicIAdd %int %20 %uint_1 %uint_0 %int_1 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..da3a03b950 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.wgsl @@ -0,0 +1,38 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : i32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_d32fe4() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_13 : i32 = atomicAdd(&(sb_rw.arg_0), 1i); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicAdd_d32fe4(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_d32fe4(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm new file mode 100644 index 0000000000..8aad806bab --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %13 = OpAtomicIIncrement %uint %17 %uint_1 %uint_0 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..442a1ffc24 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicAdd(sb_rw, 0u, 1u); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..442a1ffc24 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + const uint x_13 = tint_atomicAdd(sb_rw, 0u, 1u); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..d9e05156d9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.glsl @@ -0,0 +1,72 @@ +#version 310 es +precision mediump float; + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAdd(sb_rw.arg_0, 1u); + res = x_13; + return; +} + +void fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +void fragment_main() { + fragment_main_1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW_atomic { + uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_atomic_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_13 = atomicAdd(sb_rw.arg_0, 1u); + res = x_13; + return; +} + +void compute_main_1() { + atomicAdd_8a199a(); + return; +} + +void compute_main() { + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.msl new file mode 100644 index 0000000000..b3d0ecd75e --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct SB_RW_atomic { + /* 0x0000 */ atomic_uint arg_0; +}; + +struct SB_RW { + uint arg_0; +}; + +void atomicAdd_8a199a(device SB_RW_atomic* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_13 = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), 1u, memory_order_relaxed); + res = x_13; + return; +} + +void fragment_main_1(device SB_RW_atomic* const tint_symbol_1) { + atomicAdd_8a199a(tint_symbol_1); + return; +} + +fragment void fragment_main(device SB_RW_atomic* tint_symbol_2 [[buffer(0)]]) { + fragment_main_1(tint_symbol_2); + return; +} + +void compute_main_1(device SB_RW_atomic* const tint_symbol_3) { + atomicAdd_8a199a(tint_symbol_3); + return; +} + +kernel void compute_main(device SB_RW_atomic* tint_symbol_4 [[buffer(0)]]) { + compute_main_1(tint_symbol_4); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..17ebf7b797 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW_atomic "SB_RW_atomic" + OpMemberName %SB_RW_atomic 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main_1 "fragment_main_1" + OpName %fragment_main "fragment_main" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main "compute_main" + OpDecorate %SB_RW_atomic Block + OpMemberDecorate %SB_RW_atomic 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 +%SB_RW_atomic = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpConstantNull %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %9 + %res = OpVariable %_ptr_Function_uint Function %9 + OpStore %arg_1 %9 + OpStore %res %9 + OpStore %arg_1 %uint_1 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %14 = OpAtomicIAdd %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main_1 = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..61fbe492e0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.wgsl @@ -0,0 +1,38 @@ +struct SB_RW_atomic { + arg_0 : atomic, +} + +struct SB_RW { + arg_0 : u32, +} + +@group(0) @binding(0) var sb_rw : SB_RW_atomic; + +fn atomicAdd_8a199a() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_13 : u32 = atomicAdd(&(sb_rw.arg_0), 1u); + res = x_13; + return; +} + +fn fragment_main_1() { + atomicAdd_8a199a(); + return; +} + +@fragment +fn fragment_main() { + fragment_main_1(); +} + +fn compute_main_1() { + atomicAdd_8a199a(); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main() { + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm new file mode 100644 index 0000000000..2fb3e8ddeb --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %15 = OpAtomicIIncrement %int %arg_0 %uint_2 %uint_0 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..6270b9d3e3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, 1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..6270b9d3e3 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared int arg_0; + +void atomicAdd_794055() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, 1, atomic_result); + const int x_15 = atomic_result; + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + int atomic_result_2 = 0; + InterlockedExchange(arg_0, 0, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl new file mode 100644 index 0000000000..ef3ffb1c16 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared int arg_0; +void atomicAdd_794055() { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int x_15 = atomicAdd(arg_0, 1); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0); + barrier(); + atomicAdd_794055(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl new file mode 100644 index 0000000000..dc059dd0c0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 0; + int res = 0; + arg_1 = 1; + int const x_15 = atomic_fetch_add_explicit(tint_symbol, 1, memory_order_relaxed); + res = x_15; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_794055(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_int* const tint_symbol_3) { + uint const x_33 = *(tint_symbol_2); + compute_main_inner(x_33, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_int* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm new file mode 100644 index 0000000000..ed49501697 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %10 = OpTypeFunction %void + %14 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %23 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %10 + %13 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %14 + OpStore %res %14 + OpStore %arg_1 %int_1 + %19 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %23 +%local_invocation_index = OpFunctionParameter %uint + %26 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %31 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %10 + %33 = OpLabel + %34 = OpLoad %uint %local_invocation_index_1 + %35 = OpFunctionCall %void %compute_main_inner %34 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %23 +%local_invocation_index_1_param = OpFunctionParameter %uint + %38 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %42 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %10 + %44 = OpLabel + %46 = OpLoad %uint %local_invocation_index_1_param_1 + %45 = OpFunctionCall %void %compute_main_inner_1 %46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.wgsl new file mode 100644 index 0000000000..b5076c3852 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_794055() { + var arg_1 : i32 = 0i; + var res : i32 = 0i; + arg_1 = 1i; + let x_15 : i32 = atomicAdd(&(arg_0), 1i); + res = x_15; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0i); + workgroupBarrier(); + atomicAdd_794055(); + return; +} + +fn compute_main_1() { + let x_33 : u32 = local_invocation_index_1; + compute_main_inner(x_33); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm new file mode 100644 index 0000000000..48d906dae9 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %14 = OpAtomicIIncrement %uint %arg_0 %uint_2 %uint_0 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..d2a0213b3c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, 1u, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..d2a0213b3c --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,46 @@ +static uint local_invocation_index_1 = 0u; +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, 1u, atomic_result); + const uint x_14 = atomic_result; + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +struct tint_symbol_1 { + uint local_invocation_index_1_param : SV_GroupIndex; +}; + +void compute_main_inner_1(uint local_invocation_index_1_param) { + { + uint atomic_result_2 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_2); + } + GroupMemoryBarrierWithGroupSync(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner_1(tint_symbol.local_invocation_index_1_param); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl new file mode 100644 index 0000000000..b9c2faf670 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl @@ -0,0 +1,39 @@ +#version 310 es + +uint local_invocation_index_1 = 0u; +shared uint arg_0; +void atomicAdd_d5db1d() { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint x_14 = atomicAdd(arg_0, 1u); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index) { + atomicExchange(arg_0, 0u); + barrier(); + atomicAdd_d5db1d(); + return; +} + +void compute_main_1() { + compute_main_inner(local_invocation_index_1); + return; +} + +void compute_main(uint local_invocation_index_1_param) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl new file mode 100644 index 0000000000..1b33ab894f --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 0u; + uint res = 0u; + arg_1 = 1u; + uint const x_14 = atomic_fetch_add_explicit(tint_symbol, 1u, memory_order_relaxed); + res = x_14; + return; +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_d5db1d(tint_symbol_1); + return; +} + +void compute_main_1(thread uint* const tint_symbol_2, threadgroup atomic_uint* const tint_symbol_3) { + uint const x_32 = *(tint_symbol_2); + compute_main_inner(x_32, tint_symbol_3); + return; +} + +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup atomic_uint* const tint_symbol_4, thread uint* const tint_symbol_5) { + { + atomic_store_explicit(tint_symbol_4, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + *(tint_symbol_5) = local_invocation_index_1_param; + compute_main_1(tint_symbol_5, tint_symbol_4); +} + +kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_6; + thread uint tint_symbol_7 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_6), &(tint_symbol_7)); + return; +} + diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm new file mode 100644 index 0000000000..1388894da0 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1" + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main_1 "compute_main_1" + OpName %compute_main_inner_1 "compute_main_inner_1" + OpName %local_invocation_index_1_param "local_invocation_index_1_param" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Private_uint = OpTypePointer Private %uint + %6 = OpConstantNull %uint +%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6 +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %9 + %12 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %6 + %res = OpVariable %_ptr_Function_uint Function %6 + OpStore %arg_1 %6 + OpStore %res %6 + OpStore %arg_1 %uint_1 + %17 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main_1 = OpFunction %void None %9 + %31 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %33 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd +%compute_main_inner_1 = OpFunction %void None %21 +%local_invocation_index_1_param = OpFunctionParameter %uint + %36 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %6 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpStore %local_invocation_index_1 %local_invocation_index_1_param + %40 = OpFunctionCall %void %compute_main_1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %44 = OpLoad %uint %local_invocation_index_1_param_1 + %43 = OpFunctionCall %void %compute_main_inner_1 %44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.wgsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.wgsl new file mode 100644 index 0000000000..7faf057482 --- /dev/null +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +var local_invocation_index_1 : u32; + +var arg_0 : atomic; + +fn atomicAdd_d5db1d() { + var arg_1 : u32 = 0u; + var res : u32 = 0u; + arg_1 = 1u; + let x_14 : u32 = atomicAdd(&(arg_0), 1u); + res = x_14; + return; +} + +fn compute_main_inner(local_invocation_index : u32) { + atomicStore(&(arg_0), 0u); + workgroupBarrier(); + atomicAdd_d5db1d(); + return; +} + +fn compute_main_1() { + let x_32 : u32 = local_invocation_index_1; + compute_main_inner(x_32); + return; +} + +@compute @workgroup_size(1i, 1i, 1i) +fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) { + local_invocation_index_1 = local_invocation_index_1_param; + compute_main_1(); +} diff --git a/test/tint/builtins/builtins.wgsl.tmpl b/test/tint/builtins/builtins.wgsl.tmpl deleted file mode 100644 index 0edd48ebd8..0000000000 --- a/test/tint/builtins/builtins.wgsl.tmpl +++ /dev/null @@ -1,276 +0,0 @@ -{{- /* --------------------------------------------------------------------------------- -Template file for use with tools/builtin-gen to generate the wgsl files in the -./gen/... subdirectories - -See: -* tools/cmd/intrinsic-gen/gen for structures used by this template -* https://golang.org/pkg/text/template/ for documentation on the template syntax --------------------------------------------------------------------------------- -*/ -}} - -{{- /* For each permutation of each overload of each function... */ -}} -{{- range .Sem.Functions -}} -{{- /* TODO(crbug.com/tint/1483): Remove the bodge below after smoothStep is removed from builtins.def */}} -{{- if not (eq .Name "smoothStep") }} -{{- range .Overloads -}} -{{- range Permute . -}} -{{- /* Generate a ./gen//.wgsl file using - the Permutation macro defined below */ -}} -{{- $file := printf "./gen/%v/%v.wgsl" .Function.Name .Hash -}} -{{- $content := Eval "Permutation" . -}} -{{- WriteFile $file $content -}} -{{- end }} -{{- end }} -{{- end }} -{{- end }} - - -{{- /* ------------------------------------------------------------------ */ -}} -{{- define "Permutation" -}} -{{- /* Emits the body of the intrinsic permuation .wgsl file */ -}} -{{- /* ------------------------------------------------------------------ */ -}} -{{- $function := .Function.Name -}} -{{- $permutation := printf "%v_%v" $function .Hash -}} -{{- $args := Map -}} - -{{- /* Generate RW storage buffer parameters */ -}} -{{- $sb_rw_fields := Eval "EmitBufferFields" "overload" . - "var_name" "sb_rw" - "storage" "storage" - "access" "read_write" - "args" $args -}} -{{- if $sb_rw_fields -}} -struct SB_RW { -{{- $sb_rw_fields -}} -}; -@group(0) @binding(0) var sb_rw : SB_RW; -{{ end -}} - -{{- /* Generate RO storage buffer parameters */ -}} -{{- $sb_ro_fields := Eval "EmitBufferFields" "overload" . - "var_name" "sb_ro" - "storage" "storage" - "access" "read" - "args" $args -}} -{{- if $sb_ro_fields -}} -struct SB_RO { -{{- $sb_ro_fields -}} -}; -@group(0) @binding(1) var sb_ro : SB_RO; -{{ end -}} - -{{- /* Generate uniform buffer parameters */ -}} -{{- $ub_fields := Eval "EmitBufferFields" "overload" . - "var_name" "ub" - "storage" "uniform" - "access" "read" - "args" $args -}} -{{- if $ub_fields -}} -struct UB { -{{- $ub_fields -}} -}; -@group(0) @binding(1) var ub : UB; -{{ end -}} - -{{- /* Generate module-scoped handle variables */ -}} -{{- range $i, $p := .Parameters }} -{{- $class := Eval "StorageClass" $p.Type -}} -{{- if eq "ptr" $p.Type.Target.Name -}} -{{- $el_type := Eval "Type" (index $p.Type.TemplateArguments 1)}} -{{- if eq "handle" $class -}} - @group(1) @binding({{$i}}) var arg_{{$i}}: {{$el_type}}; -{{ $args.Put $i (printf "&arg_%v" $i) -}} -{{- else if eq "workgroup" $class -}} - var arg_{{$i}}: {{$el_type}}; -{{ $args.Put $i (printf "&arg_%v" $i) -}} -{{- else if eq "private" $class -}} - var arg_{{$i}}: {{$el_type}}; -{{ $args.Put $i (printf "&arg_%v" $i) -}} -{{- end -}} -{{- else -}} -{{- $type := Eval "Type" $p.Type}} -{{- if eq "handle" $class -}} - @group(1) @binding({{$i}}) var arg_{{$i}}: {{$type}}; -{{ $args.Put $i (printf "arg_%v" $i) -}} -{{- else if eq "workgroup" $class -}} - var arg_{{$i}}: {{$type}}; -{{ $args.Put $i (printf "arg_%v" $i) -}} -{{- else if eq "private" $class -}} - var arg_{{$i}}: {{$type}}; -{{ $args.Put $i (printf "arg_%v" $i) -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{- /* Generate the function that calls the intrinsic */ -}} -{{- /*newline*/}} -// {{$.Overload}} -fn {{$permutation}}() { -{{/* Build the parameters either as 'var' or inline values */ -}} -{{- range $i, $p := .Parameters -}} -{{- $class := Eval "StorageClass" $p.Type -}} -{{- if eq "function" $class -}} -{{- if eq "ptr" $p.Type.Target.Name -}} -{{- /*indent*/}} var arg_{{$i}}: {{template "Type" index $p.Type.TemplateArguments 1}}; -{{ $args.Put $i (printf "&arg_%v" $i) -}} -{{- else -}} -{{- $args.Put $i (Eval "ArgumentValue" $p) -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{- /* Make the call to the intrinsic */ -}} -{{- /*indent*/}} {{/*indent*/ -}} -{{- if .ReturnType -}} - var res{{if IsDeclarable .ReturnType}}: {{template "Type" .ReturnType}}{{end}} = {{/* preserve space after = */ -}} -{{- end -}} - {{$function}}( -{{- range $i, $p := .Parameters -}} -{{- if $i -}}, {{end}}{{$args.Get $i -}} -{{- end -}} - ); -} -{{/*new line*/ -}} - -{{- if .CanBeUsedInStage.Vertex }} -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - {{$permutation}}(); - return vec4(); -} -{{ end -}} - -{{- if .CanBeUsedInStage.Fragment }} -@stage(fragment) -fn fragment_main() { - {{$permutation}}(); -} -{{ end -}} - -{{- if .CanBeUsedInStage.Compute }} -@stage(compute) @workgroup_size(1) -fn compute_main() { - {{$permutation}}(); -} -{{ end -}} - -{{- end -}} - - -{{- /* ------------------------------------------------------------------ */ -}} -{{- define "EmitBufferFields" -}} -{{- /* Emits a struct with the fields that match the given storage class */ -}} -{{- /* and access. */ -}} -{{- /* Argument is a map with the following expected keys: */ -}} -{{- /* 'overload' - the current overload */ -}} -{{- /* 'var_name' - name of the variable of the structure type */ -}} -{{- /* 'storage' - filtered storage class */ -}} -{{- /* 'access' - filtered access */ -}} -{{- /* 'args' - argument map that's populated with the fields */ -}} -{{- /* ------------------------------------------------------------------ */ -}} -{{- $overload := .Get "overload" -}} -{{- $var_name := .Get "var_name" -}} -{{- $filter_storage := .Get "storage" -}} -{{- $filter_access := .Get "access" -}} -{{- $args := .Get "args" -}} -{{- range $i, $p := $overload.Parameters }} -{{- $storage := Eval "StorageClass" $p.Type -}} -{{- $access := Eval "Access" $p.Type -}} -{{- if and (eq $filter_storage $storage) (eq $filter_access $access) }} -{{- if eq "ptr" $p.Type.Target.Name }} - arg_{{$i}}: {{template "Type" (index $p.Type.TemplateArguments 1)}}, -{{ $args.Put $i (printf "&%v.arg_%v" $var_name $i) -}} -{{- else }} - arg_{{$i}}: {{template "Type" $p.Type}}, -{{ $args.Put $i (printf "%v.arg_%v" $var_name $i) -}} -{{- end -}} -{{- end -}} -{{- end -}} -{{ end -}} - -{{- /* ------------------------------------------------------------------ */ -}} -{{- define "StorageClass" -}} -{{- /* Returns the storage class for the given Fully Qualified Name */ -}} -{{- /* ------------------------------------------------------------------ */ -}} -{{- $name := .Target.Name -}} -{{- if eq $name "array" -}}storage -{{- else if HasPrefix $name "texture" -}}handle -{{- else if HasPrefix $name "sampler" -}}handle -{{- else if eq $name "ptr" -}}{{(index .TemplateArguments 0).Target.Name}} -{{- else -}}function -{{- end -}} -{{- end -}} - - -{{- /* ------------------------------------------------------------------ */ -}} -{{- define "Access" -}} -{{- /* Returns the access for the given Fully Qualified Name */ -}} -{{- /* ------------------------------------------------------------------ */ -}} -{{- $name := .Target.Name -}} -{{- if eq $name "ptr" -}}{{(index .TemplateArguments 2).Target.Name}} -{{- else -}} -{{- /* Emit the default for the storage class */ -}} -{{- /* https://gpuweb.github.io/gpuweb/wgsl/#storage-class */ -}} -{{- $storage := Eval "StorageClass" . -}} -{{- if eq $storage "function" -}}read_write -{{- else if eq $storage "private" -}}read_write -{{- else if eq $storage "workgroup" -}}read_write -{{- else if eq $storage "uniform" -}}read -{{- else if eq $storage "storage" -}}read -{{- else if eq $storage "handle" -}}read -{{- end -}} -{{- end -}} -{{- end -}} - - -{{- /* ------------------------------------------------------------------ */ -}} -{{- define "ArgumentValue" -}} -{{- /* Returns a value that can be used for the parameter argument */ -}} -{{- /* ------------------------------------------------------------------ */ -}} -{{- $ty := .Type -}} -{{- if eq $ty.Target.Name "i32" -}} -{{- /* If the parameter has the name 'level', then use '0' as the value. */ -}} -{{- /* Some texture arguments require the level parameter to be 0, and */ -}} -{{- /* constraint is not described in the definition file. */ -}} -{{- if eq .Name "level" -}}0 -{{- else -}}1 -{{- end -}} -{{- else if eq $ty.Target.Name "u32" -}}1u -{{- else if eq $ty.Target.Name "f32" -}}1.0 -{{- else -}}{{template "Type" $ty}}() -{{- end -}} -{{- end -}} - - -{{- /* ------------------------------------------------------------------ */ -}} -{{- define "Type" -}} -{{- /* Emits the WGSL for the Fully Qualified Name argument */ -}} -{{- /* ------------------------------------------------------------------ */ -}} -{{- if IsType .Target -}} -{{- if eq .Target.Name "vec" -}}vec{{index .TemplateArguments 0}}<{{template "Type" index .TemplateArguments 1}}> -{{- else if eq .Target.Name "mat" -}}mat{{index .TemplateArguments 0}}x{{index .TemplateArguments 1}}<{{template "Type" index .TemplateArguments 2}}> -{{- else -}}{{.Target.Name}}{{template "TemplateArguments" .TemplateArguments}} -{{- end -}} -{{- else if IsEnumEntry .Target -}}{{.Target.Name}} -{{- else if IsEnumMatcher .Target -}}{{(index .Target.Options 0).Name}} -{{- else -}} -{{- end -}} -{{- end -}} - - -{{- /* ------------------------------------------------------------------ */ -}} -{{- define "TemplateArguments" -}} -{{- /* Emits the WGSL for the template argument list */ -}} -{{- /* ------------------------------------------------------------------ */ -}} -{{- if . -}} -< -{{- range $i, $a := . -}} -{{- if $i -}}, {{ end -}} -{{- if IsInt $a -}}{{- . -}} -{{- else -}}{{- template "Type" $a -}} -{{- end -}} -{{- end -}} -> -{{- end -}} -{{- end -}} diff --git a/test/tint/builtins/degrees.spvasm.expected.hlsl b/test/tint/builtins/degrees.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/degrees.spvasm.expected.hlsl rename to test/tint/builtins/degrees.spvasm.expected.dxc.hlsl diff --git a/test/tint/builtins/degrees.spvasm.expected.fxc.hlsl b/test/tint/builtins/degrees.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..ef4fff85f6 --- /dev/null +++ b/test/tint/builtins/degrees.spvasm.expected.fxc.hlsl @@ -0,0 +1,17 @@ +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + +void main_1() { + float a = 0.0f; + float b = 0.0f; + a = 42.0f; + b = tint_degrees(a); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/builtins/degrees.spvasm.expected.glsl b/test/tint/builtins/degrees.spvasm.expected.glsl index 858230bdbd..6ec82b3bb7 100644 --- a/test/tint/builtins/degrees.spvasm.expected.glsl +++ b/test/tint/builtins/degrees.spvasm.expected.glsl @@ -1,7 +1,7 @@ #version 310 es float tint_degrees(float param_0) { - return param_0 * 57.295779513082322865; + return param_0 * 57.295779513082322865f; } diff --git a/test/tint/builtins/degrees.spvasm.expected.wgsl b/test/tint/builtins/degrees.spvasm.expected.wgsl index 823f9f4cd4..d5a3382ea2 100644 --- a/test/tint/builtins/degrees.spvasm.expected.wgsl +++ b/test/tint/builtins/degrees.spvasm.expected.wgsl @@ -1,13 +1,13 @@ fn main_1() { var a : f32; var b : f32; - a = 42.0; + a = 42.0f; let x_11 : f32 = a; b = degrees(x_11); return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.hlsl b/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/extractBits/scalar/i32.spvasm.expected.hlsl rename to test/tint/builtins/extractBits/scalar/i32.spvasm.expected.dxc.hlsl diff --git a/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..fa2d12f348 --- /dev/null +++ b/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,21 @@ +int tint_extract_bits(int v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void f_1() { + int v = 0; + uint offset_1 = 0u; + uint count = 0u; + const int x_14 = tint_extract_bits(v, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.spvasm b/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.spvasm index 9281c0e37e..42c93f6e10 100644 --- a/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.spvasm +++ b/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 34 ; Schema: 0 OpCapability Shader %10 = OpExtInstImport "GLSL.std.450" @@ -23,12 +23,10 @@ %uint_32 = OpConstant %uint 32 %void = OpTypeVoid %16 = OpTypeFunction %void - %int_0 = OpConstant %int 0 + %20 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %23 = OpConstantNull %int - %uint_0 = OpConstant %uint 0 + %23 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %27 = OpConstantNull %uint %tint_extract_bits = OpFunction %int None %1 %v = OpFunctionParameter %int %offset = OpFunctionParameter %uint @@ -43,20 +41,20 @@ OpFunctionEnd %f_1 = OpFunction %void None %16 %19 = OpLabel - %v_0 = OpVariable %_ptr_Function_int Function %23 - %offset_1 = OpVariable %_ptr_Function_uint Function %27 - %count_0 = OpVariable %_ptr_Function_uint Function %27 - OpStore %v_0 %int_0 - OpStore %offset_1 %uint_0 - OpStore %count_0 %uint_0 - %29 = OpLoad %int %v_0 - %30 = OpLoad %uint %offset_1 - %31 = OpLoad %uint %count_0 - %32 = OpFunctionCall %int %tint_extract_bits %29 %30 %31 + %v_0 = OpVariable %_ptr_Function_int Function %20 + %offset_1 = OpVariable %_ptr_Function_uint Function %23 + %count_0 = OpVariable %_ptr_Function_uint Function %23 + OpStore %v_0 %20 + OpStore %offset_1 %23 + OpStore %count_0 %23 + %27 = OpLoad %int %v_0 + %28 = OpLoad %uint %offset_1 + %29 = OpLoad %uint %count_0 + %30 = OpFunctionCall %int %tint_extract_bits %27 %28 %29 OpReturn OpFunctionEnd %f = OpFunction %void None %16 - %34 = OpLabel - %35 = OpFunctionCall %void %f_1 + %32 = OpLabel + %33 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.wgsl b/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.wgsl index 37c53142d5..c381fada48 100644 --- a/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.wgsl +++ b/test/tint/builtins/extractBits/scalar/i32.spvasm.expected.wgsl @@ -9,7 +9,7 @@ fn f_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.hlsl b/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/extractBits/scalar/u32.spvasm.expected.hlsl rename to test/tint/builtins/extractBits/scalar/u32.spvasm.expected.dxc.hlsl diff --git a/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..310ab2e068 --- /dev/null +++ b/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,21 @@ +uint tint_extract_bits(uint v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void f_1() { + uint v = 0u; + uint offset_1 = 0u; + uint count = 0u; + const uint x_11 = tint_extract_bits(v, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.spvasm b/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.spvasm index 67c95bdef4..93bb97c35e 100644 --- a/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.spvasm +++ b/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 31 ; Schema: 0 OpCapability Shader %9 = OpExtInstImport "GLSL.std.450" @@ -22,9 +22,8 @@ %uint_32 = OpConstant %uint 32 %void = OpTypeVoid %15 = OpTypeFunction %void - %uint_0 = OpConstant %uint 0 + %19 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %22 = OpConstantNull %uint %tint_extract_bits = OpFunction %uint None %1 %v = OpFunctionParameter %uint %offset = OpFunctionParameter %uint @@ -39,20 +38,20 @@ OpFunctionEnd %f_1 = OpFunction %void None %15 %18 = OpLabel - %v_0 = OpVariable %_ptr_Function_uint Function %22 - %offset_1 = OpVariable %_ptr_Function_uint Function %22 - %count_0 = OpVariable %_ptr_Function_uint Function %22 - OpStore %v_0 %uint_0 - OpStore %offset_1 %uint_0 - OpStore %count_0 %uint_0 - %25 = OpLoad %uint %v_0 - %26 = OpLoad %uint %offset_1 - %27 = OpLoad %uint %count_0 - %28 = OpFunctionCall %uint %tint_extract_bits %25 %26 %27 + %v_0 = OpVariable %_ptr_Function_uint Function %19 + %offset_1 = OpVariable %_ptr_Function_uint Function %19 + %count_0 = OpVariable %_ptr_Function_uint Function %19 + OpStore %v_0 %19 + OpStore %offset_1 %19 + OpStore %count_0 %19 + %24 = OpLoad %uint %v_0 + %25 = OpLoad %uint %offset_1 + %26 = OpLoad %uint %count_0 + %27 = OpFunctionCall %uint %tint_extract_bits %24 %25 %26 OpReturn OpFunctionEnd %f = OpFunction %void None %15 - %30 = OpLabel - %31 = OpFunctionCall %void %f_1 + %29 = OpLabel + %30 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.wgsl b/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.wgsl index cab6bcf4bf..c9987a9ac2 100644 --- a/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.wgsl +++ b/test/tint/builtins/extractBits/scalar/u32.spvasm.expected.wgsl @@ -9,7 +9,7 @@ fn f_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..99dbb8891b --- /dev/null +++ b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,21 @@ +int3 tint_extract_bits(int3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void f_1() { + int3 v = (0).xxx; + uint offset_1 = 0u; + uint count = 0u; + const int3 x_15 = tint_extract_bits(v, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..99dbb8891b --- /dev/null +++ b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,21 @@ +int3 tint_extract_bits(int3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void f_1() { + int3 v = (0).xxx; + uint offset_1 = 0u; + uint count = 0u; + const int3 x_15 = tint_extract_bits(v, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.glsl b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.glsl index e0f5e2bad7..960ed2f608 100644 --- a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.glsl +++ b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.glsl @@ -7,7 +7,7 @@ ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { } void f_1() { - ivec3 v = ivec3(0, 0, 0); + ivec3 v = ivec3(0); uint offset_1 = 0u; uint count = 0u; ivec3 x_15 = tint_extract_bits(v, offset_1, count); diff --git a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.hlsl b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.hlsl deleted file mode 100644 index ba7c0ad9b6..0000000000 --- a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -int3 tint_extract_bits(int3 v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); -} - -void f_1() { - int3 v = int3(0, 0, 0); - uint offset_1 = 0u; - uint count = 0u; - const int3 x_15 = tint_extract_bits(v, offset_1, count); - return; -} - -[numthreads(1, 1, 1)] -void f() { - f_1(); - return; -} diff --git a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.msl b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.msl index 38e5225470..9af5beba71 100644 --- a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.msl +++ b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.msl @@ -8,7 +8,7 @@ int3 tint_extract_bits(int3 v, uint offset, uint count) { } void f_1() { - int3 v = int3(); + int3 v = int3(0); uint offset_1 = 0u; uint count = 0u; int3 const x_17 = v; diff --git a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.spvasm b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.spvasm index 2ef08d08bf..3d34096e77 100644 --- a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.spvasm +++ b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 35 ; Schema: 0 OpCapability Shader %11 = OpExtInstImport "GLSL.std.450" @@ -26,9 +26,8 @@ %17 = OpTypeFunction %void %21 = OpConstantNull %v3int %_ptr_Function_v3int = OpTypePointer Function %v3int - %uint_0 = OpConstant %uint 0 + %24 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %27 = OpConstantNull %uint %tint_extract_bits = OpFunction %v3int None %1 %v = OpFunctionParameter %v3int %offset = OpFunctionParameter %uint @@ -44,19 +43,19 @@ %f_1 = OpFunction %void None %17 %20 = OpLabel %v_0 = OpVariable %_ptr_Function_v3int Function %21 - %offset_1 = OpVariable %_ptr_Function_uint Function %27 - %count_0 = OpVariable %_ptr_Function_uint Function %27 + %offset_1 = OpVariable %_ptr_Function_uint Function %24 + %count_0 = OpVariable %_ptr_Function_uint Function %24 OpStore %v_0 %21 - OpStore %offset_1 %uint_0 - OpStore %count_0 %uint_0 - %29 = OpLoad %v3int %v_0 - %30 = OpLoad %uint %offset_1 - %31 = OpLoad %uint %count_0 - %32 = OpFunctionCall %v3int %tint_extract_bits %29 %30 %31 + OpStore %offset_1 %24 + OpStore %count_0 %24 + %28 = OpLoad %v3int %v_0 + %29 = OpLoad %uint %offset_1 + %30 = OpLoad %uint %count_0 + %31 = OpFunctionCall %v3int %tint_extract_bits %28 %29 %30 OpReturn OpFunctionEnd %f = OpFunction %void None %17 - %34 = OpLabel - %35 = OpFunctionCall %void %f_1 + %33 = OpLabel + %34 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.wgsl b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.wgsl index 9497207708..2a9d713e15 100644 --- a/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.wgsl +++ b/test/tint/builtins/extractBits/vec3/i32.spvasm.expected.wgsl @@ -9,7 +9,7 @@ fn f_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..5c0b0cbca2 --- /dev/null +++ b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,21 @@ +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void f_1() { + uint3 v = (0u).xxx; + uint offset_1 = 0u; + uint count = 0u; + const uint3 x_14 = tint_extract_bits(v, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..5c0b0cbca2 --- /dev/null +++ b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,21 @@ +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void f_1() { + uint3 v = (0u).xxx; + uint offset_1 = 0u; + uint count = 0u; + const uint3 x_14 = tint_extract_bits(v, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.glsl b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.glsl index 457d137642..c5150f2ab3 100644 --- a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.glsl +++ b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.glsl @@ -7,7 +7,7 @@ uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { } void f_1() { - uvec3 v = uvec3(0u, 0u, 0u); + uvec3 v = uvec3(0u); uint offset_1 = 0u; uint count = 0u; uvec3 x_14 = tint_extract_bits(v, offset_1, count); diff --git a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.hlsl b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.hlsl deleted file mode 100644 index ed7936a708..0000000000 --- a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -uint3 tint_extract_bits(uint3 v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); -} - -void f_1() { - uint3 v = uint3(0u, 0u, 0u); - uint offset_1 = 0u; - uint count = 0u; - const uint3 x_14 = tint_extract_bits(v, offset_1, count); - return; -} - -[numthreads(1, 1, 1)] -void f() { - f_1(); - return; -} diff --git a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.msl b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.msl index 77b64509a1..a9227ee8ec 100644 --- a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.msl +++ b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.msl @@ -8,7 +8,7 @@ uint3 tint_extract_bits(uint3 v, uint offset, uint count) { } void f_1() { - uint3 v = uint3(); + uint3 v = uint3(0u); uint offset_1 = 0u; uint count = 0u; uint3 const x_16 = v; diff --git a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.spvasm b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.spvasm index d5800cc7be..61b4732061 100644 --- a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.spvasm +++ b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 35 +; Bound: 34 ; Schema: 0 OpCapability Shader %10 = OpExtInstImport "GLSL.std.450" @@ -25,9 +25,8 @@ %16 = OpTypeFunction %void %20 = OpConstantNull %v3uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %uint_0 = OpConstant %uint 0 + %23 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %26 = OpConstantNull %uint %tint_extract_bits = OpFunction %v3uint None %1 %v = OpFunctionParameter %v3uint %offset = OpFunctionParameter %uint @@ -43,19 +42,19 @@ %f_1 = OpFunction %void None %16 %19 = OpLabel %v_0 = OpVariable %_ptr_Function_v3uint Function %20 - %offset_1 = OpVariable %_ptr_Function_uint Function %26 - %count_0 = OpVariable %_ptr_Function_uint Function %26 + %offset_1 = OpVariable %_ptr_Function_uint Function %23 + %count_0 = OpVariable %_ptr_Function_uint Function %23 OpStore %v_0 %20 - OpStore %offset_1 %uint_0 - OpStore %count_0 %uint_0 - %28 = OpLoad %v3uint %v_0 - %29 = OpLoad %uint %offset_1 - %30 = OpLoad %uint %count_0 - %31 = OpFunctionCall %v3uint %tint_extract_bits %28 %29 %30 + OpStore %offset_1 %23 + OpStore %count_0 %23 + %27 = OpLoad %v3uint %v_0 + %28 = OpLoad %uint %offset_1 + %29 = OpLoad %uint %count_0 + %30 = OpFunctionCall %v3uint %tint_extract_bits %27 %28 %29 OpReturn OpFunctionEnd %f = OpFunction %void None %16 - %33 = OpLabel - %34 = OpFunctionCall %void %f_1 + %32 = OpLabel + %33 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.wgsl b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.wgsl index 7bb29a5cbe..5c48450743 100644 --- a/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.wgsl +++ b/test/tint/builtins/extractBits/vec3/u32.spvasm.expected.wgsl @@ -9,7 +9,7 @@ fn f_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/builtins/frexp.wgsl b/test/tint/builtins/frexp.wgsl index f4c30d4644..549c3c623a 100644 --- a/test/tint/builtins/frexp.wgsl +++ b/test/tint/builtins/frexp.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let res = frexp(1.23); let exp : i32 = res.exp; diff --git a/test/tint/builtins/frexp.wgsl.expected.hlsl b/test/tint/builtins/frexp.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/frexp.wgsl.expected.hlsl rename to test/tint/builtins/frexp.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/frexp.wgsl.expected.fxc.hlsl b/test/tint/builtins/frexp.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44299742b8 --- /dev/null +++ b/test/tint/builtins/frexp.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + float exp; + float sig = frexp(param_0, exp); + frexp_result result = {sig, int(exp)}; + return result; +} + +[numthreads(1, 1, 1)] +void main() { + const frexp_result res = tint_frexp(1.230000019f); + const int exp = res.exp; + const float sig = res.sig; + return; +} diff --git a/test/tint/builtins/frexp.wgsl.expected.msl b/test/tint/builtins/frexp.wgsl.expected.msl index d850760b4c..c9b0a6732e 100644 --- a/test/tint/builtins/frexp.wgsl.expected.msl +++ b/test/tint/builtins/frexp.wgsl.expected.msl @@ -7,9 +7,9 @@ struct frexp_result { int exp; }; frexp_result tint_frexp(float param_0) { - int exp; - float sig = frexp(param_0, exp); - return {sig, exp}; + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; } kernel void tint_symbol() { diff --git a/test/tint/builtins/frexp.wgsl.expected.wgsl b/test/tint/builtins/frexp.wgsl.expected.wgsl index 50cbd404e5..a36f01a466 100644 --- a/test/tint/builtins/frexp.wgsl.expected.wgsl +++ b/test/tint/builtins/frexp.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let res = frexp(1.230000019); let exp : i32 = res.exp; diff --git a/test/tint/builtins/gen/abs/002533.wgsl b/test/tint/builtins/gen/abs/002533.wgsl deleted file mode 100644 index 0ec97222bf..0000000000 --- a/test/tint/builtins/gen/abs/002533.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(vec<4, f32>) -> vec<4, f32> -fn abs_002533() { - var res: vec4 = abs(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_002533(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_002533(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_002533(); -} diff --git a/test/tint/builtins/gen/abs/002533.wgsl.expected.glsl b/test/tint/builtins/gen/abs/002533.wgsl.expected.glsl deleted file mode 100644 index cd42630199..0000000000 --- a/test/tint/builtins/gen/abs/002533.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_002533() { - vec4 res = abs(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - abs_002533(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_002533() { - vec4 res = abs(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - abs_002533(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_002533() { - vec4 res = abs(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - abs_002533(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/002533.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/002533.wgsl.expected.hlsl deleted file mode 100644 index f145efd5e1..0000000000 --- a/test/tint/builtins/gen/abs/002533.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_002533() { - float4 res = abs(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_002533(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_002533(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_002533(); - return; -} diff --git a/test/tint/builtins/gen/abs/002533.wgsl.expected.msl b/test/tint/builtins/gen/abs/002533.wgsl.expected.msl deleted file mode 100644 index e7c6e0cd7f..0000000000 --- a/test/tint/builtins/gen/abs/002533.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_002533() { - float4 res = fabs(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_002533(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_002533(); - return; -} - -kernel void compute_main() { - abs_002533(); - return; -} - diff --git a/test/tint/builtins/gen/abs/002533.wgsl.expected.spvasm b/test/tint/builtins/gen/abs/002533.wgsl.expected.spvasm deleted file mode 100644 index 7a113676d0..0000000000 --- a/test/tint/builtins/gen/abs/002533.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %abs_002533 "abs_002533" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %abs_002533 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 FAbs %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %abs_002533 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %abs_002533 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %abs_002533 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/abs/002533.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/002533.wgsl.expected.wgsl deleted file mode 100644 index 8edc059f0c..0000000000 --- a/test/tint/builtins/gen/abs/002533.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_002533() { - var res : vec4 = abs(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_002533(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_002533(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_002533(); -} diff --git a/test/tint/builtins/gen/abs/005174.wgsl b/test/tint/builtins/gen/abs/005174.wgsl deleted file mode 100644 index 1dff647955..0000000000 --- a/test/tint/builtins/gen/abs/005174.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(vec<3, f32>) -> vec<3, f32> -fn abs_005174() { - var res: vec3 = abs(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_005174(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_005174(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_005174(); -} diff --git a/test/tint/builtins/gen/abs/005174.wgsl.expected.glsl b/test/tint/builtins/gen/abs/005174.wgsl.expected.glsl deleted file mode 100644 index c2d735229a..0000000000 --- a/test/tint/builtins/gen/abs/005174.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_005174() { - vec3 res = abs(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - abs_005174(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_005174() { - vec3 res = abs(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - abs_005174(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_005174() { - vec3 res = abs(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - abs_005174(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/005174.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/005174.wgsl.expected.hlsl deleted file mode 100644 index 9dc600cef7..0000000000 --- a/test/tint/builtins/gen/abs/005174.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_005174() { - float3 res = abs(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_005174(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_005174(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_005174(); - return; -} diff --git a/test/tint/builtins/gen/abs/005174.wgsl.expected.msl b/test/tint/builtins/gen/abs/005174.wgsl.expected.msl deleted file mode 100644 index 7606da6715..0000000000 --- a/test/tint/builtins/gen/abs/005174.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_005174() { - float3 res = fabs(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_005174(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_005174(); - return; -} - -kernel void compute_main() { - abs_005174(); - return; -} - diff --git a/test/tint/builtins/gen/abs/005174.wgsl.expected.spvasm b/test/tint/builtins/gen/abs/005174.wgsl.expected.spvasm deleted file mode 100644 index a5282ba82c..0000000000 --- a/test/tint/builtins/gen/abs/005174.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %abs_005174 "abs_005174" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %abs_005174 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 FAbs %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %abs_005174 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %abs_005174 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %abs_005174 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/abs/005174.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/005174.wgsl.expected.wgsl deleted file mode 100644 index 0675fff80c..0000000000 --- a/test/tint/builtins/gen/abs/005174.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_005174() { - var res : vec3 = abs(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_005174(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_005174(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_005174(); -} diff --git a/test/tint/builtins/gen/abs/1ce782.wgsl b/test/tint/builtins/gen/abs/1ce782.wgsl deleted file mode 100644 index 9625dec919..0000000000 --- a/test/tint/builtins/gen/abs/1ce782.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(vec<4, u32>) -> vec<4, u32> -fn abs_1ce782() { - var res: vec4 = abs(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_1ce782(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_1ce782(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_1ce782(); -} diff --git a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.glsl b/test/tint/builtins/gen/abs/1ce782.wgsl.expected.glsl deleted file mode 100644 index 8667ab2cb5..0000000000 --- a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_1ce782() { - uvec4 res = uvec4(0u, 0u, 0u, 0u); -} - -vec4 vertex_main() { - abs_1ce782(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_1ce782() { - uvec4 res = uvec4(0u, 0u, 0u, 0u); -} - -void fragment_main() { - abs_1ce782(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_1ce782() { - uvec4 res = uvec4(0u, 0u, 0u, 0u); -} - -void compute_main() { - abs_1ce782(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/1ce782.wgsl.expected.hlsl deleted file mode 100644 index 76857d7af1..0000000000 --- a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_1ce782() { - uint4 res = abs(uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_1ce782(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_1ce782(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_1ce782(); - return; -} diff --git a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.msl b/test/tint/builtins/gen/abs/1ce782.wgsl.expected.msl deleted file mode 100644 index 73296533db..0000000000 --- a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_1ce782() { - uint4 res = abs(uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_1ce782(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_1ce782(); - return; -} - -kernel void compute_main() { - abs_1ce782(); - return; -} - diff --git a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.spvasm b/test/tint/builtins/gen/abs/1ce782.wgsl.expected.spvasm deleted file mode 100644 index f39c38cd8f..0000000000 --- a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.spvasm +++ /dev/null @@ -1,66 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %abs_1ce782 "abs_1ce782" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %16 = OpConstantNull %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %abs_1ce782 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %16 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %abs_1ce782 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %abs_1ce782 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %abs_1ce782 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/1ce782.wgsl.expected.wgsl deleted file mode 100644 index 02c1c23454..0000000000 --- a/test/tint/builtins/gen/abs/1ce782.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_1ce782() { - var res : vec4 = abs(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_1ce782(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_1ce782(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_1ce782(); -} diff --git a/test/tint/builtins/gen/abs/1e9d53.wgsl b/test/tint/builtins/gen/abs/1e9d53.wgsl deleted file mode 100644 index 9ad99cd24d..0000000000 --- a/test/tint/builtins/gen/abs/1e9d53.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(vec<2, f32>) -> vec<2, f32> -fn abs_1e9d53() { - var res: vec2 = abs(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_1e9d53(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_1e9d53(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_1e9d53(); -} diff --git a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.glsl b/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.glsl deleted file mode 100644 index 3f21129c76..0000000000 --- a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_1e9d53() { - vec2 res = abs(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - abs_1e9d53(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_1e9d53() { - vec2 res = abs(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - abs_1e9d53(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_1e9d53() { - vec2 res = abs(vec2(0.0f, 0.0f)); -} - -void compute_main() { - abs_1e9d53(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.hlsl deleted file mode 100644 index 7668024349..0000000000 --- a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_1e9d53() { - float2 res = abs(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_1e9d53(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_1e9d53(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_1e9d53(); - return; -} diff --git a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.msl b/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.msl deleted file mode 100644 index 7951049b1c..0000000000 --- a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_1e9d53() { - float2 res = fabs(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_1e9d53(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_1e9d53(); - return; -} - -kernel void compute_main() { - abs_1e9d53(); - return; -} - diff --git a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.spvasm b/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.spvasm deleted file mode 100644 index b6cba316b5..0000000000 --- a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %abs_1e9d53 "abs_1e9d53" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %abs_1e9d53 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 FAbs %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %abs_1e9d53 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %abs_1e9d53 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %abs_1e9d53 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.wgsl deleted file mode 100644 index ba2ae4b4be..0000000000 --- a/test/tint/builtins/gen/abs/1e9d53.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_1e9d53() { - var res : vec2 = abs(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_1e9d53(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_1e9d53(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_1e9d53(); -} diff --git a/test/tint/builtins/gen/abs/467cd1.wgsl b/test/tint/builtins/gen/abs/467cd1.wgsl deleted file mode 100644 index 888fbb10c9..0000000000 --- a/test/tint/builtins/gen/abs/467cd1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(u32) -> u32 -fn abs_467cd1() { - var res: u32 = abs(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_467cd1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_467cd1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_467cd1(); -} diff --git a/test/tint/builtins/gen/abs/467cd1.wgsl.expected.glsl b/test/tint/builtins/gen/abs/467cd1.wgsl.expected.glsl deleted file mode 100644 index aab9311c00..0000000000 --- a/test/tint/builtins/gen/abs/467cd1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_467cd1() { - uint res = 1u; -} - -vec4 vertex_main() { - abs_467cd1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_467cd1() { - uint res = 1u; -} - -void fragment_main() { - abs_467cd1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_467cd1() { - uint res = 1u; -} - -void compute_main() { - abs_467cd1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/467cd1.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/467cd1.wgsl.expected.hlsl deleted file mode 100644 index 8e2a89111b..0000000000 --- a/test/tint/builtins/gen/abs/467cd1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_467cd1() { - uint res = abs(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_467cd1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_467cd1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_467cd1(); - return; -} diff --git a/test/tint/builtins/gen/abs/467cd1.wgsl.expected.msl b/test/tint/builtins/gen/abs/467cd1.wgsl.expected.msl deleted file mode 100644 index 421b221d2f..0000000000 --- a/test/tint/builtins/gen/abs/467cd1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_467cd1() { - uint res = abs(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_467cd1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_467cd1(); - return; -} - -kernel void compute_main() { - abs_467cd1(); - return; -} - diff --git a/test/tint/builtins/gen/abs/467cd1.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/467cd1.wgsl.expected.wgsl deleted file mode 100644 index 0af41411e1..0000000000 --- a/test/tint/builtins/gen/abs/467cd1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_467cd1() { - var res : u32 = abs(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_467cd1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_467cd1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_467cd1(); -} diff --git a/test/tint/builtins/gen/abs/4ad288.wgsl b/test/tint/builtins/gen/abs/4ad288.wgsl deleted file mode 100644 index 62af62aa40..0000000000 --- a/test/tint/builtins/gen/abs/4ad288.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(i32) -> i32 -fn abs_4ad288() { - var res: i32 = abs(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_4ad288(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_4ad288(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_4ad288(); -} diff --git a/test/tint/builtins/gen/abs/4ad288.wgsl.expected.glsl b/test/tint/builtins/gen/abs/4ad288.wgsl.expected.glsl deleted file mode 100644 index 78aa43e6d1..0000000000 --- a/test/tint/builtins/gen/abs/4ad288.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_4ad288() { - int res = abs(1); -} - -vec4 vertex_main() { - abs_4ad288(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_4ad288() { - int res = abs(1); -} - -void fragment_main() { - abs_4ad288(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_4ad288() { - int res = abs(1); -} - -void compute_main() { - abs_4ad288(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/4ad288.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/4ad288.wgsl.expected.hlsl deleted file mode 100644 index 686c82c0b0..0000000000 --- a/test/tint/builtins/gen/abs/4ad288.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_4ad288() { - int res = abs(1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_4ad288(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_4ad288(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_4ad288(); - return; -} diff --git a/test/tint/builtins/gen/abs/4ad288.wgsl.expected.msl b/test/tint/builtins/gen/abs/4ad288.wgsl.expected.msl deleted file mode 100644 index dcea6480d9..0000000000 --- a/test/tint/builtins/gen/abs/4ad288.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_4ad288() { - int res = abs(1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_4ad288(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_4ad288(); - return; -} - -kernel void compute_main() { - abs_4ad288(); - return; -} - diff --git a/test/tint/builtins/gen/abs/4ad288.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/4ad288.wgsl.expected.wgsl deleted file mode 100644 index e96f64463a..0000000000 --- a/test/tint/builtins/gen/abs/4ad288.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_4ad288() { - var res : i32 = abs(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_4ad288(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_4ad288(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_4ad288(); -} diff --git a/test/tint/builtins/gen/abs/5ad50a.wgsl b/test/tint/builtins/gen/abs/5ad50a.wgsl deleted file mode 100644 index 5344a49451..0000000000 --- a/test/tint/builtins/gen/abs/5ad50a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(vec<3, i32>) -> vec<3, i32> -fn abs_5ad50a() { - var res: vec3 = abs(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_5ad50a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_5ad50a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_5ad50a(); -} diff --git a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.glsl b/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.glsl deleted file mode 100644 index 3b5f8bcfbb..0000000000 --- a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_5ad50a() { - ivec3 res = abs(ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - abs_5ad50a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_5ad50a() { - ivec3 res = abs(ivec3(0, 0, 0)); -} - -void fragment_main() { - abs_5ad50a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_5ad50a() { - ivec3 res = abs(ivec3(0, 0, 0)); -} - -void compute_main() { - abs_5ad50a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.hlsl deleted file mode 100644 index 0a43ef6026..0000000000 --- a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_5ad50a() { - int3 res = abs(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_5ad50a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_5ad50a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_5ad50a(); - return; -} diff --git a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.msl b/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.msl deleted file mode 100644 index b3da1a3dcb..0000000000 --- a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_5ad50a() { - int3 res = abs(int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_5ad50a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_5ad50a(); - return; -} - -kernel void compute_main() { - abs_5ad50a(); - return; -} - diff --git a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.spvasm b/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.spvasm deleted file mode 100644 index 7928d05c16..0000000000 --- a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %abs_5ad50a "abs_5ad50a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %17 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %abs_5ad50a = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %17 - %13 = OpExtInst %v3int %16 SAbs %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %abs_5ad50a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %abs_5ad50a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %abs_5ad50a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.wgsl deleted file mode 100644 index d1cf47f3cd..0000000000 --- a/test/tint/builtins/gen/abs/5ad50a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_5ad50a() { - var res : vec3 = abs(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_5ad50a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_5ad50a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_5ad50a(); -} diff --git a/test/tint/builtins/gen/abs/7326de.wgsl b/test/tint/builtins/gen/abs/7326de.wgsl deleted file mode 100644 index 860ec8adc5..0000000000 --- a/test/tint/builtins/gen/abs/7326de.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(vec<3, u32>) -> vec<3, u32> -fn abs_7326de() { - var res: vec3 = abs(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_7326de(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_7326de(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_7326de(); -} diff --git a/test/tint/builtins/gen/abs/7326de.wgsl.expected.glsl b/test/tint/builtins/gen/abs/7326de.wgsl.expected.glsl deleted file mode 100644 index f4cd3ae863..0000000000 --- a/test/tint/builtins/gen/abs/7326de.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_7326de() { - uvec3 res = uvec3(0u, 0u, 0u); -} - -vec4 vertex_main() { - abs_7326de(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_7326de() { - uvec3 res = uvec3(0u, 0u, 0u); -} - -void fragment_main() { - abs_7326de(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_7326de() { - uvec3 res = uvec3(0u, 0u, 0u); -} - -void compute_main() { - abs_7326de(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/7326de.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/7326de.wgsl.expected.hlsl deleted file mode 100644 index 4be3799fcd..0000000000 --- a/test/tint/builtins/gen/abs/7326de.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_7326de() { - uint3 res = abs(uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_7326de(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_7326de(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_7326de(); - return; -} diff --git a/test/tint/builtins/gen/abs/7326de.wgsl.expected.msl b/test/tint/builtins/gen/abs/7326de.wgsl.expected.msl deleted file mode 100644 index 146626d5ac..0000000000 --- a/test/tint/builtins/gen/abs/7326de.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_7326de() { - uint3 res = abs(uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_7326de(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_7326de(); - return; -} - -kernel void compute_main() { - abs_7326de(); - return; -} - diff --git a/test/tint/builtins/gen/abs/7326de.wgsl.expected.spvasm b/test/tint/builtins/gen/abs/7326de.wgsl.expected.spvasm deleted file mode 100644 index 3891964afc..0000000000 --- a/test/tint/builtins/gen/abs/7326de.wgsl.expected.spvasm +++ /dev/null @@ -1,66 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %abs_7326de "abs_7326de" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %16 = OpConstantNull %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %abs_7326de = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %16 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %abs_7326de - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %abs_7326de - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %abs_7326de - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/abs/7326de.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/7326de.wgsl.expected.wgsl deleted file mode 100644 index 4d07d263f1..0000000000 --- a/test/tint/builtins/gen/abs/7326de.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_7326de() { - var res : vec3 = abs(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_7326de(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_7326de(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_7326de(); -} diff --git a/test/tint/builtins/gen/abs/7f28e6.wgsl b/test/tint/builtins/gen/abs/7f28e6.wgsl deleted file mode 100644 index af3bf446d7..0000000000 --- a/test/tint/builtins/gen/abs/7f28e6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(vec<2, u32>) -> vec<2, u32> -fn abs_7f28e6() { - var res: vec2 = abs(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_7f28e6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_7f28e6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_7f28e6(); -} diff --git a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.glsl b/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.glsl deleted file mode 100644 index d3615c4a18..0000000000 --- a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_7f28e6() { - uvec2 res = uvec2(0u, 0u); -} - -vec4 vertex_main() { - abs_7f28e6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_7f28e6() { - uvec2 res = uvec2(0u, 0u); -} - -void fragment_main() { - abs_7f28e6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_7f28e6() { - uvec2 res = uvec2(0u, 0u); -} - -void compute_main() { - abs_7f28e6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.hlsl deleted file mode 100644 index a3c8098e9d..0000000000 --- a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_7f28e6() { - uint2 res = abs(uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_7f28e6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_7f28e6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_7f28e6(); - return; -} diff --git a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.msl b/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.msl deleted file mode 100644 index 97422d7325..0000000000 --- a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_7f28e6() { - uint2 res = abs(uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_7f28e6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_7f28e6(); - return; -} - -kernel void compute_main() { - abs_7f28e6(); - return; -} - diff --git a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.spvasm b/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.spvasm deleted file mode 100644 index caed8a0c52..0000000000 --- a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.spvasm +++ /dev/null @@ -1,66 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %abs_7f28e6 "abs_7f28e6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %16 = OpConstantNull %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %abs_7f28e6 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %16 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %abs_7f28e6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %abs_7f28e6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %abs_7f28e6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.wgsl deleted file mode 100644 index 8f83b406dc..0000000000 --- a/test/tint/builtins/gen/abs/7f28e6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_7f28e6() { - var res : vec2 = abs(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_7f28e6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_7f28e6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_7f28e6(); -} diff --git a/test/tint/builtins/gen/abs/7faa9e.wgsl b/test/tint/builtins/gen/abs/7faa9e.wgsl deleted file mode 100644 index b88f802b70..0000000000 --- a/test/tint/builtins/gen/abs/7faa9e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(vec<2, i32>) -> vec<2, i32> -fn abs_7faa9e() { - var res: vec2 = abs(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_7faa9e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_7faa9e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_7faa9e(); -} diff --git a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.glsl b/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.glsl deleted file mode 100644 index 8bbe6e9687..0000000000 --- a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_7faa9e() { - ivec2 res = abs(ivec2(0, 0)); -} - -vec4 vertex_main() { - abs_7faa9e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_7faa9e() { - ivec2 res = abs(ivec2(0, 0)); -} - -void fragment_main() { - abs_7faa9e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_7faa9e() { - ivec2 res = abs(ivec2(0, 0)); -} - -void compute_main() { - abs_7faa9e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.hlsl deleted file mode 100644 index 137d120fd5..0000000000 --- a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_7faa9e() { - int2 res = abs(int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_7faa9e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_7faa9e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_7faa9e(); - return; -} diff --git a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.msl b/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.msl deleted file mode 100644 index 278f9dbbc6..0000000000 --- a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_7faa9e() { - int2 res = abs(int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_7faa9e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_7faa9e(); - return; -} - -kernel void compute_main() { - abs_7faa9e(); - return; -} - diff --git a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.spvasm b/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.spvasm deleted file mode 100644 index 61f20548f1..0000000000 --- a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %abs_7faa9e "abs_7faa9e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %17 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %abs_7faa9e = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %17 - %13 = OpExtInst %v2int %16 SAbs %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %abs_7faa9e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %abs_7faa9e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %abs_7faa9e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.wgsl deleted file mode 100644 index c8e0001e08..0000000000 --- a/test/tint/builtins/gen/abs/7faa9e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_7faa9e() { - var res : vec2 = abs(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_7faa9e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_7faa9e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_7faa9e(); -} diff --git a/test/tint/builtins/gen/abs/9c80a6.wgsl b/test/tint/builtins/gen/abs/9c80a6.wgsl deleted file mode 100644 index 7a66ed0ed7..0000000000 --- a/test/tint/builtins/gen/abs/9c80a6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(vec<4, i32>) -> vec<4, i32> -fn abs_9c80a6() { - var res: vec4 = abs(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_9c80a6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_9c80a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_9c80a6(); -} diff --git a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.glsl b/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.glsl deleted file mode 100644 index 79e1928832..0000000000 --- a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_9c80a6() { - ivec4 res = abs(ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - abs_9c80a6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_9c80a6() { - ivec4 res = abs(ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - abs_9c80a6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_9c80a6() { - ivec4 res = abs(ivec4(0, 0, 0, 0)); -} - -void compute_main() { - abs_9c80a6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.hlsl deleted file mode 100644 index d53818e600..0000000000 --- a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_9c80a6() { - int4 res = abs(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_9c80a6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_9c80a6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_9c80a6(); - return; -} diff --git a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.msl b/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.msl deleted file mode 100644 index 11b838e837..0000000000 --- a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_9c80a6() { - int4 res = abs(int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_9c80a6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_9c80a6(); - return; -} - -kernel void compute_main() { - abs_9c80a6(); - return; -} - diff --git a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.spvasm b/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.spvasm deleted file mode 100644 index b880d604cb..0000000000 --- a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %abs_9c80a6 "abs_9c80a6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %17 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %abs_9c80a6 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %17 - %13 = OpExtInst %v4int %16 SAbs %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %abs_9c80a6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %abs_9c80a6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %abs_9c80a6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.wgsl deleted file mode 100644 index 6e3519d381..0000000000 --- a/test/tint/builtins/gen/abs/9c80a6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_9c80a6() { - var res : vec4 = abs(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_9c80a6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_9c80a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_9c80a6(); -} diff --git a/test/tint/builtins/gen/abs/b96037.wgsl b/test/tint/builtins/gen/abs/b96037.wgsl deleted file mode 100644 index 36b06a4482..0000000000 --- a/test/tint/builtins/gen/abs/b96037.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn abs(f32) -> f32 -fn abs_b96037() { - var res: f32 = abs(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_b96037(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_b96037(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_b96037(); -} diff --git a/test/tint/builtins/gen/abs/b96037.wgsl.expected.glsl b/test/tint/builtins/gen/abs/b96037.wgsl.expected.glsl deleted file mode 100644 index 317cc1e8ef..0000000000 --- a/test/tint/builtins/gen/abs/b96037.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void abs_b96037() { - float res = abs(1.0f); -} - -vec4 vertex_main() { - abs_b96037(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void abs_b96037() { - float res = abs(1.0f); -} - -void fragment_main() { - abs_b96037(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void abs_b96037() { - float res = abs(1.0f); -} - -void compute_main() { - abs_b96037(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/abs/b96037.wgsl.expected.hlsl b/test/tint/builtins/gen/abs/b96037.wgsl.expected.hlsl deleted file mode 100644 index 4d302e4751..0000000000 --- a/test/tint/builtins/gen/abs/b96037.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void abs_b96037() { - float res = abs(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - abs_b96037(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - abs_b96037(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - abs_b96037(); - return; -} diff --git a/test/tint/builtins/gen/abs/b96037.wgsl.expected.msl b/test/tint/builtins/gen/abs/b96037.wgsl.expected.msl deleted file mode 100644 index 92263420a3..0000000000 --- a/test/tint/builtins/gen/abs/b96037.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void abs_b96037() { - float res = fabs(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - abs_b96037(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - abs_b96037(); - return; -} - -kernel void compute_main() { - abs_b96037(); - return; -} - diff --git a/test/tint/builtins/gen/abs/b96037.wgsl.expected.wgsl b/test/tint/builtins/gen/abs/b96037.wgsl.expected.wgsl deleted file mode 100644 index 22c47c28e2..0000000000 --- a/test/tint/builtins/gen/abs/b96037.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn abs_b96037() { - var res : f32 = abs(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - abs_b96037(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - abs_b96037(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - abs_b96037(); -} diff --git a/test/tint/builtins/gen/acos/489247.wgsl b/test/tint/builtins/gen/acos/489247.wgsl deleted file mode 100644 index d43d0440a6..0000000000 --- a/test/tint/builtins/gen/acos/489247.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn acos(f32) -> f32 -fn acos_489247() { - var res: f32 = acos(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - acos_489247(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - acos_489247(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - acos_489247(); -} diff --git a/test/tint/builtins/gen/acos/489247.wgsl.expected.glsl b/test/tint/builtins/gen/acos/489247.wgsl.expected.glsl deleted file mode 100644 index a91f29c92d..0000000000 --- a/test/tint/builtins/gen/acos/489247.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void acos_489247() { - float res = acos(1.0f); -} - -vec4 vertex_main() { - acos_489247(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void acos_489247() { - float res = acos(1.0f); -} - -void fragment_main() { - acos_489247(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void acos_489247() { - float res = acos(1.0f); -} - -void compute_main() { - acos_489247(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/acos/489247.wgsl.expected.hlsl b/test/tint/builtins/gen/acos/489247.wgsl.expected.hlsl deleted file mode 100644 index c10f0ee457..0000000000 --- a/test/tint/builtins/gen/acos/489247.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void acos_489247() { - float res = acos(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - acos_489247(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - acos_489247(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - acos_489247(); - return; -} diff --git a/test/tint/builtins/gen/acos/489247.wgsl.expected.msl b/test/tint/builtins/gen/acos/489247.wgsl.expected.msl deleted file mode 100644 index b80a9c8515..0000000000 --- a/test/tint/builtins/gen/acos/489247.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void acos_489247() { - float res = acos(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - acos_489247(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - acos_489247(); - return; -} - -kernel void compute_main() { - acos_489247(); - return; -} - diff --git a/test/tint/builtins/gen/acos/489247.wgsl.expected.wgsl b/test/tint/builtins/gen/acos/489247.wgsl.expected.wgsl deleted file mode 100644 index d8570fb212..0000000000 --- a/test/tint/builtins/gen/acos/489247.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn acos_489247() { - var res : f32 = acos(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - acos_489247(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - acos_489247(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - acos_489247(); -} diff --git a/test/tint/builtins/gen/acos/8e2acf.wgsl b/test/tint/builtins/gen/acos/8e2acf.wgsl deleted file mode 100644 index d4f40c64ac..0000000000 --- a/test/tint/builtins/gen/acos/8e2acf.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn acos(vec<4, f32>) -> vec<4, f32> -fn acos_8e2acf() { - var res: vec4 = acos(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - acos_8e2acf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - acos_8e2acf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - acos_8e2acf(); -} diff --git a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.glsl b/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.glsl deleted file mode 100644 index 8680941397..0000000000 --- a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void acos_8e2acf() { - vec4 res = acos(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - acos_8e2acf(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void acos_8e2acf() { - vec4 res = acos(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - acos_8e2acf(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void acos_8e2acf() { - vec4 res = acos(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - acos_8e2acf(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.hlsl b/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.hlsl deleted file mode 100644 index eee957e4fb..0000000000 --- a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void acos_8e2acf() { - float4 res = acos(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - acos_8e2acf(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - acos_8e2acf(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - acos_8e2acf(); - return; -} diff --git a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.msl b/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.msl deleted file mode 100644 index 8595fceae2..0000000000 --- a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void acos_8e2acf() { - float4 res = acos(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - acos_8e2acf(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - acos_8e2acf(); - return; -} - -kernel void compute_main() { - acos_8e2acf(); - return; -} - diff --git a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.spvasm b/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.spvasm deleted file mode 100644 index 53fd784082..0000000000 --- a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %acos_8e2acf "acos_8e2acf" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%acos_8e2acf = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Acos %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %acos_8e2acf - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %acos_8e2acf - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %acos_8e2acf - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.wgsl b/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.wgsl deleted file mode 100644 index c03ab26213..0000000000 --- a/test/tint/builtins/gen/acos/8e2acf.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn acos_8e2acf() { - var res : vec4 = acos(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - acos_8e2acf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - acos_8e2acf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - acos_8e2acf(); -} diff --git a/test/tint/builtins/gen/acos/a610c4.wgsl b/test/tint/builtins/gen/acos/a610c4.wgsl deleted file mode 100644 index 32ec90b1ab..0000000000 --- a/test/tint/builtins/gen/acos/a610c4.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn acos(vec<3, f32>) -> vec<3, f32> -fn acos_a610c4() { - var res: vec3 = acos(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - acos_a610c4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - acos_a610c4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - acos_a610c4(); -} diff --git a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.glsl b/test/tint/builtins/gen/acos/a610c4.wgsl.expected.glsl deleted file mode 100644 index 886d13f72d..0000000000 --- a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void acos_a610c4() { - vec3 res = acos(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - acos_a610c4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void acos_a610c4() { - vec3 res = acos(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - acos_a610c4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void acos_a610c4() { - vec3 res = acos(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - acos_a610c4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.hlsl b/test/tint/builtins/gen/acos/a610c4.wgsl.expected.hlsl deleted file mode 100644 index 13d02ef20e..0000000000 --- a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void acos_a610c4() { - float3 res = acos(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - acos_a610c4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - acos_a610c4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - acos_a610c4(); - return; -} diff --git a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.msl b/test/tint/builtins/gen/acos/a610c4.wgsl.expected.msl deleted file mode 100644 index 435d150f23..0000000000 --- a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void acos_a610c4() { - float3 res = acos(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - acos_a610c4(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - acos_a610c4(); - return; -} - -kernel void compute_main() { - acos_a610c4(); - return; -} - diff --git a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.spvasm b/test/tint/builtins/gen/acos/a610c4.wgsl.expected.spvasm deleted file mode 100644 index eaf58ce686..0000000000 --- a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %acos_a610c4 "acos_a610c4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%acos_a610c4 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Acos %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %acos_a610c4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %acos_a610c4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %acos_a610c4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.wgsl b/test/tint/builtins/gen/acos/a610c4.wgsl.expected.wgsl deleted file mode 100644 index 24807be11d..0000000000 --- a/test/tint/builtins/gen/acos/a610c4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn acos_a610c4() { - var res : vec3 = acos(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - acos_a610c4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - acos_a610c4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - acos_a610c4(); -} diff --git a/test/tint/builtins/gen/acos/dfc915.wgsl b/test/tint/builtins/gen/acos/dfc915.wgsl deleted file mode 100644 index f1313be17e..0000000000 --- a/test/tint/builtins/gen/acos/dfc915.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn acos(vec<2, f32>) -> vec<2, f32> -fn acos_dfc915() { - var res: vec2 = acos(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - acos_dfc915(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - acos_dfc915(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - acos_dfc915(); -} diff --git a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.glsl b/test/tint/builtins/gen/acos/dfc915.wgsl.expected.glsl deleted file mode 100644 index 6c1ac64936..0000000000 --- a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void acos_dfc915() { - vec2 res = acos(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - acos_dfc915(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void acos_dfc915() { - vec2 res = acos(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - acos_dfc915(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void acos_dfc915() { - vec2 res = acos(vec2(0.0f, 0.0f)); -} - -void compute_main() { - acos_dfc915(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.hlsl b/test/tint/builtins/gen/acos/dfc915.wgsl.expected.hlsl deleted file mode 100644 index be3e380b16..0000000000 --- a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void acos_dfc915() { - float2 res = acos(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - acos_dfc915(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - acos_dfc915(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - acos_dfc915(); - return; -} diff --git a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.msl b/test/tint/builtins/gen/acos/dfc915.wgsl.expected.msl deleted file mode 100644 index 7668f36c1e..0000000000 --- a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void acos_dfc915() { - float2 res = acos(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - acos_dfc915(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - acos_dfc915(); - return; -} - -kernel void compute_main() { - acos_dfc915(); - return; -} - diff --git a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.spvasm b/test/tint/builtins/gen/acos/dfc915.wgsl.expected.spvasm deleted file mode 100644 index 346031df35..0000000000 --- a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %acos_dfc915 "acos_dfc915" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%acos_dfc915 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Acos %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %acos_dfc915 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %acos_dfc915 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %acos_dfc915 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.wgsl b/test/tint/builtins/gen/acos/dfc915.wgsl.expected.wgsl deleted file mode 100644 index e16d1eabe3..0000000000 --- a/test/tint/builtins/gen/acos/dfc915.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn acos_dfc915() { - var res : vec2 = acos(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - acos_dfc915(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - acos_dfc915(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - acos_dfc915(); -} diff --git a/test/tint/builtins/gen/all/353d6a.wgsl b/test/tint/builtins/gen/all/353d6a.wgsl deleted file mode 100644 index 11e9479382..0000000000 --- a/test/tint/builtins/gen/all/353d6a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn all(bool) -> bool -fn all_353d6a() { - var res: bool = all(bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - all_353d6a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - all_353d6a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - all_353d6a(); -} diff --git a/test/tint/builtins/gen/all/353d6a.wgsl.expected.glsl b/test/tint/builtins/gen/all/353d6a.wgsl.expected.glsl deleted file mode 100644 index 133f92352f..0000000000 --- a/test/tint/builtins/gen/all/353d6a.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void all_353d6a() { - bool res = false; -} - -vec4 vertex_main() { - all_353d6a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void all_353d6a() { - bool res = false; -} - -void fragment_main() { - all_353d6a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void all_353d6a() { - bool res = false; -} - -void compute_main() { - all_353d6a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/all/353d6a.wgsl.expected.hlsl b/test/tint/builtins/gen/all/353d6a.wgsl.expected.hlsl deleted file mode 100644 index f8143baff5..0000000000 --- a/test/tint/builtins/gen/all/353d6a.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void all_353d6a() { - bool res = all(false); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - all_353d6a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - all_353d6a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - all_353d6a(); - return; -} diff --git a/test/tint/builtins/gen/all/353d6a.wgsl.expected.msl b/test/tint/builtins/gen/all/353d6a.wgsl.expected.msl deleted file mode 100644 index 74aff96a63..0000000000 --- a/test/tint/builtins/gen/all/353d6a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void all_353d6a() { - bool res = all(bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - all_353d6a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - all_353d6a(); - return; -} - -kernel void compute_main() { - all_353d6a(); - return; -} - diff --git a/test/tint/builtins/gen/all/353d6a.wgsl.expected.spvasm b/test/tint/builtins/gen/all/353d6a.wgsl.expected.spvasm deleted file mode 100644 index c167a957e3..0000000000 --- a/test/tint/builtins/gen/all/353d6a.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %all_353d6a "all_353d6a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %15 = OpConstantNull %bool -%_ptr_Function_bool = OpTypePointer Function %bool - %18 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %all_353d6a = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_bool Function %15 - OpStore %res %15 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %all_353d6a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %all_353d6a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %all_353d6a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/all/353d6a.wgsl.expected.wgsl b/test/tint/builtins/gen/all/353d6a.wgsl.expected.wgsl deleted file mode 100644 index b1ae87d5d6..0000000000 --- a/test/tint/builtins/gen/all/353d6a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn all_353d6a() { - var res : bool = all(bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - all_353d6a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - all_353d6a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - all_353d6a(); -} diff --git a/test/tint/builtins/gen/all/986c7b.wgsl b/test/tint/builtins/gen/all/986c7b.wgsl deleted file mode 100644 index 5e3d3c42fd..0000000000 --- a/test/tint/builtins/gen/all/986c7b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn all(vec<4, bool>) -> bool -fn all_986c7b() { - var res: bool = all(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - all_986c7b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - all_986c7b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - all_986c7b(); -} diff --git a/test/tint/builtins/gen/all/986c7b.wgsl.expected.glsl b/test/tint/builtins/gen/all/986c7b.wgsl.expected.glsl deleted file mode 100644 index ad9ee039a5..0000000000 --- a/test/tint/builtins/gen/all/986c7b.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void all_986c7b() { - bool res = all(bvec4(false, false, false, false)); -} - -vec4 vertex_main() { - all_986c7b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void all_986c7b() { - bool res = all(bvec4(false, false, false, false)); -} - -void fragment_main() { - all_986c7b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void all_986c7b() { - bool res = all(bvec4(false, false, false, false)); -} - -void compute_main() { - all_986c7b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/all/986c7b.wgsl.expected.hlsl b/test/tint/builtins/gen/all/986c7b.wgsl.expected.hlsl deleted file mode 100644 index 9afde8c555..0000000000 --- a/test/tint/builtins/gen/all/986c7b.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void all_986c7b() { - bool res = all(bool4(false, false, false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - all_986c7b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - all_986c7b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - all_986c7b(); - return; -} diff --git a/test/tint/builtins/gen/all/986c7b.wgsl.expected.msl b/test/tint/builtins/gen/all/986c7b.wgsl.expected.msl deleted file mode 100644 index 041e28037c..0000000000 --- a/test/tint/builtins/gen/all/986c7b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void all_986c7b() { - bool res = all(bool4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - all_986c7b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - all_986c7b(); - return; -} - -kernel void compute_main() { - all_986c7b(); - return; -} - diff --git a/test/tint/builtins/gen/all/986c7b.wgsl.expected.spvasm b/test/tint/builtins/gen/all/986c7b.wgsl.expected.spvasm deleted file mode 100644 index 03f7f57395..0000000000 --- a/test/tint/builtins/gen/all/986c7b.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %all_986c7b "all_986c7b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %16 = OpConstantNull %v4bool -%_ptr_Function_bool = OpTypePointer Function %bool - %19 = OpConstantNull %bool - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %all_986c7b = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_bool Function %19 - %13 = OpAll %bool %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %all_986c7b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %all_986c7b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %all_986c7b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/all/986c7b.wgsl.expected.wgsl b/test/tint/builtins/gen/all/986c7b.wgsl.expected.wgsl deleted file mode 100644 index 919532111f..0000000000 --- a/test/tint/builtins/gen/all/986c7b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn all_986c7b() { - var res : bool = all(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - all_986c7b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - all_986c7b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - all_986c7b(); -} diff --git a/test/tint/builtins/gen/all/bd2dba.wgsl b/test/tint/builtins/gen/all/bd2dba.wgsl deleted file mode 100644 index 7b98f0de9f..0000000000 --- a/test/tint/builtins/gen/all/bd2dba.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn all(vec<3, bool>) -> bool -fn all_bd2dba() { - var res: bool = all(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - all_bd2dba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - all_bd2dba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - all_bd2dba(); -} diff --git a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.glsl b/test/tint/builtins/gen/all/bd2dba.wgsl.expected.glsl deleted file mode 100644 index 0aec2a7020..0000000000 --- a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void all_bd2dba() { - bool res = all(bvec3(false, false, false)); -} - -vec4 vertex_main() { - all_bd2dba(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void all_bd2dba() { - bool res = all(bvec3(false, false, false)); -} - -void fragment_main() { - all_bd2dba(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void all_bd2dba() { - bool res = all(bvec3(false, false, false)); -} - -void compute_main() { - all_bd2dba(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.hlsl b/test/tint/builtins/gen/all/bd2dba.wgsl.expected.hlsl deleted file mode 100644 index 0650c248e3..0000000000 --- a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void all_bd2dba() { - bool res = all(bool3(false, false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - all_bd2dba(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - all_bd2dba(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - all_bd2dba(); - return; -} diff --git a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.msl b/test/tint/builtins/gen/all/bd2dba.wgsl.expected.msl deleted file mode 100644 index d6d45cff04..0000000000 --- a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void all_bd2dba() { - bool res = all(bool3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - all_bd2dba(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - all_bd2dba(); - return; -} - -kernel void compute_main() { - all_bd2dba(); - return; -} - diff --git a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.spvasm b/test/tint/builtins/gen/all/bd2dba.wgsl.expected.spvasm deleted file mode 100644 index 14e2aee02a..0000000000 --- a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %all_bd2dba "all_bd2dba" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %16 = OpConstantNull %v3bool -%_ptr_Function_bool = OpTypePointer Function %bool - %19 = OpConstantNull %bool - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %all_bd2dba = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_bool Function %19 - %13 = OpAll %bool %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %all_bd2dba - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %all_bd2dba - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %all_bd2dba - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.wgsl b/test/tint/builtins/gen/all/bd2dba.wgsl.expected.wgsl deleted file mode 100644 index 9ec977d188..0000000000 --- a/test/tint/builtins/gen/all/bd2dba.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn all_bd2dba() { - var res : bool = all(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - all_bd2dba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - all_bd2dba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - all_bd2dba(); -} diff --git a/test/tint/builtins/gen/all/f46790.wgsl b/test/tint/builtins/gen/all/f46790.wgsl deleted file mode 100644 index 6e5b3eae97..0000000000 --- a/test/tint/builtins/gen/all/f46790.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn all(vec<2, bool>) -> bool -fn all_f46790() { - var res: bool = all(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - all_f46790(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - all_f46790(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - all_f46790(); -} diff --git a/test/tint/builtins/gen/all/f46790.wgsl.expected.glsl b/test/tint/builtins/gen/all/f46790.wgsl.expected.glsl deleted file mode 100644 index f3bd430d12..0000000000 --- a/test/tint/builtins/gen/all/f46790.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void all_f46790() { - bool res = all(bvec2(false, false)); -} - -vec4 vertex_main() { - all_f46790(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void all_f46790() { - bool res = all(bvec2(false, false)); -} - -void fragment_main() { - all_f46790(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void all_f46790() { - bool res = all(bvec2(false, false)); -} - -void compute_main() { - all_f46790(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/all/f46790.wgsl.expected.hlsl b/test/tint/builtins/gen/all/f46790.wgsl.expected.hlsl deleted file mode 100644 index 57120d6d7c..0000000000 --- a/test/tint/builtins/gen/all/f46790.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void all_f46790() { - bool res = all(bool2(false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - all_f46790(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - all_f46790(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - all_f46790(); - return; -} diff --git a/test/tint/builtins/gen/all/f46790.wgsl.expected.msl b/test/tint/builtins/gen/all/f46790.wgsl.expected.msl deleted file mode 100644 index 60c3c44d7b..0000000000 --- a/test/tint/builtins/gen/all/f46790.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void all_f46790() { - bool res = all(bool2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - all_f46790(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - all_f46790(); - return; -} - -kernel void compute_main() { - all_f46790(); - return; -} - diff --git a/test/tint/builtins/gen/all/f46790.wgsl.expected.spvasm b/test/tint/builtins/gen/all/f46790.wgsl.expected.spvasm deleted file mode 100644 index 915f2f5443..0000000000 --- a/test/tint/builtins/gen/all/f46790.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %all_f46790 "all_f46790" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %16 = OpConstantNull %v2bool -%_ptr_Function_bool = OpTypePointer Function %bool - %19 = OpConstantNull %bool - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %all_f46790 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_bool Function %19 - %13 = OpAll %bool %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %all_f46790 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %all_f46790 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %all_f46790 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/all/f46790.wgsl.expected.wgsl b/test/tint/builtins/gen/all/f46790.wgsl.expected.wgsl deleted file mode 100644 index a222bb5a2c..0000000000 --- a/test/tint/builtins/gen/all/f46790.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn all_f46790() { - var res : bool = all(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - all_f46790(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - all_f46790(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - all_f46790(); -} diff --git a/test/tint/builtins/gen/any/083428.wgsl b/test/tint/builtins/gen/any/083428.wgsl deleted file mode 100644 index d360268c95..0000000000 --- a/test/tint/builtins/gen/any/083428.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn any(vec<4, bool>) -> bool -fn any_083428() { - var res: bool = any(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - any_083428(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - any_083428(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - any_083428(); -} diff --git a/test/tint/builtins/gen/any/083428.wgsl.expected.glsl b/test/tint/builtins/gen/any/083428.wgsl.expected.glsl deleted file mode 100644 index 9c22156bd8..0000000000 --- a/test/tint/builtins/gen/any/083428.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void any_083428() { - bool res = any(bvec4(false, false, false, false)); -} - -vec4 vertex_main() { - any_083428(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void any_083428() { - bool res = any(bvec4(false, false, false, false)); -} - -void fragment_main() { - any_083428(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void any_083428() { - bool res = any(bvec4(false, false, false, false)); -} - -void compute_main() { - any_083428(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/any/083428.wgsl.expected.hlsl b/test/tint/builtins/gen/any/083428.wgsl.expected.hlsl deleted file mode 100644 index 5a6ed63fee..0000000000 --- a/test/tint/builtins/gen/any/083428.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void any_083428() { - bool res = any(bool4(false, false, false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - any_083428(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - any_083428(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - any_083428(); - return; -} diff --git a/test/tint/builtins/gen/any/083428.wgsl.expected.msl b/test/tint/builtins/gen/any/083428.wgsl.expected.msl deleted file mode 100644 index a11e292676..0000000000 --- a/test/tint/builtins/gen/any/083428.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void any_083428() { - bool res = any(bool4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - any_083428(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - any_083428(); - return; -} - -kernel void compute_main() { - any_083428(); - return; -} - diff --git a/test/tint/builtins/gen/any/083428.wgsl.expected.spvasm b/test/tint/builtins/gen/any/083428.wgsl.expected.spvasm deleted file mode 100644 index 52d4977d5f..0000000000 --- a/test/tint/builtins/gen/any/083428.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %any_083428 "any_083428" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %16 = OpConstantNull %v4bool -%_ptr_Function_bool = OpTypePointer Function %bool - %19 = OpConstantNull %bool - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %any_083428 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_bool Function %19 - %13 = OpAny %bool %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %any_083428 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %any_083428 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %any_083428 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/any/083428.wgsl.expected.wgsl b/test/tint/builtins/gen/any/083428.wgsl.expected.wgsl deleted file mode 100644 index acd23c8424..0000000000 --- a/test/tint/builtins/gen/any/083428.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn any_083428() { - var res : bool = any(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - any_083428(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - any_083428(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - any_083428(); -} diff --git a/test/tint/builtins/gen/any/0e3e58.wgsl b/test/tint/builtins/gen/any/0e3e58.wgsl deleted file mode 100644 index a2d13f58cf..0000000000 --- a/test/tint/builtins/gen/any/0e3e58.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn any(vec<2, bool>) -> bool -fn any_0e3e58() { - var res: bool = any(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - any_0e3e58(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - any_0e3e58(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - any_0e3e58(); -} diff --git a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.glsl b/test/tint/builtins/gen/any/0e3e58.wgsl.expected.glsl deleted file mode 100644 index 87a9a7b84c..0000000000 --- a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void any_0e3e58() { - bool res = any(bvec2(false, false)); -} - -vec4 vertex_main() { - any_0e3e58(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void any_0e3e58() { - bool res = any(bvec2(false, false)); -} - -void fragment_main() { - any_0e3e58(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void any_0e3e58() { - bool res = any(bvec2(false, false)); -} - -void compute_main() { - any_0e3e58(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.hlsl b/test/tint/builtins/gen/any/0e3e58.wgsl.expected.hlsl deleted file mode 100644 index ba726f0e15..0000000000 --- a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void any_0e3e58() { - bool res = any(bool2(false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - any_0e3e58(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - any_0e3e58(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - any_0e3e58(); - return; -} diff --git a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.msl b/test/tint/builtins/gen/any/0e3e58.wgsl.expected.msl deleted file mode 100644 index 1bf7505bd3..0000000000 --- a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void any_0e3e58() { - bool res = any(bool2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - any_0e3e58(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - any_0e3e58(); - return; -} - -kernel void compute_main() { - any_0e3e58(); - return; -} - diff --git a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.spvasm b/test/tint/builtins/gen/any/0e3e58.wgsl.expected.spvasm deleted file mode 100644 index 868dec0154..0000000000 --- a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %any_0e3e58 "any_0e3e58" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %16 = OpConstantNull %v2bool -%_ptr_Function_bool = OpTypePointer Function %bool - %19 = OpConstantNull %bool - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %any_0e3e58 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_bool Function %19 - %13 = OpAny %bool %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %any_0e3e58 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %any_0e3e58 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %any_0e3e58 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.wgsl b/test/tint/builtins/gen/any/0e3e58.wgsl.expected.wgsl deleted file mode 100644 index c94d9a1029..0000000000 --- a/test/tint/builtins/gen/any/0e3e58.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn any_0e3e58() { - var res : bool = any(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - any_0e3e58(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - any_0e3e58(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - any_0e3e58(); -} diff --git a/test/tint/builtins/gen/any/2ab91a.wgsl b/test/tint/builtins/gen/any/2ab91a.wgsl deleted file mode 100644 index c02781c3b8..0000000000 --- a/test/tint/builtins/gen/any/2ab91a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn any(bool) -> bool -fn any_2ab91a() { - var res: bool = any(bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - any_2ab91a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - any_2ab91a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - any_2ab91a(); -} diff --git a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.glsl b/test/tint/builtins/gen/any/2ab91a.wgsl.expected.glsl deleted file mode 100644 index 954385474d..0000000000 --- a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void any_2ab91a() { - bool res = false; -} - -vec4 vertex_main() { - any_2ab91a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void any_2ab91a() { - bool res = false; -} - -void fragment_main() { - any_2ab91a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void any_2ab91a() { - bool res = false; -} - -void compute_main() { - any_2ab91a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.hlsl b/test/tint/builtins/gen/any/2ab91a.wgsl.expected.hlsl deleted file mode 100644 index 5e7556e1b1..0000000000 --- a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void any_2ab91a() { - bool res = any(false); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - any_2ab91a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - any_2ab91a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - any_2ab91a(); - return; -} diff --git a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.msl b/test/tint/builtins/gen/any/2ab91a.wgsl.expected.msl deleted file mode 100644 index 15e82831fd..0000000000 --- a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void any_2ab91a() { - bool res = any(bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - any_2ab91a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - any_2ab91a(); - return; -} - -kernel void compute_main() { - any_2ab91a(); - return; -} - diff --git a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.spvasm b/test/tint/builtins/gen/any/2ab91a.wgsl.expected.spvasm deleted file mode 100644 index cd7afce764..0000000000 --- a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %any_2ab91a "any_2ab91a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %15 = OpConstantNull %bool -%_ptr_Function_bool = OpTypePointer Function %bool - %18 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %any_2ab91a = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_bool Function %15 - OpStore %res %15 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %any_2ab91a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %any_2ab91a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %any_2ab91a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.wgsl b/test/tint/builtins/gen/any/2ab91a.wgsl.expected.wgsl deleted file mode 100644 index 283ab5a7dc..0000000000 --- a/test/tint/builtins/gen/any/2ab91a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn any_2ab91a() { - var res : bool = any(bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - any_2ab91a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - any_2ab91a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - any_2ab91a(); -} diff --git a/test/tint/builtins/gen/any/e755c1.wgsl b/test/tint/builtins/gen/any/e755c1.wgsl deleted file mode 100644 index 342c9d2643..0000000000 --- a/test/tint/builtins/gen/any/e755c1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn any(vec<3, bool>) -> bool -fn any_e755c1() { - var res: bool = any(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - any_e755c1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - any_e755c1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - any_e755c1(); -} diff --git a/test/tint/builtins/gen/any/e755c1.wgsl.expected.glsl b/test/tint/builtins/gen/any/e755c1.wgsl.expected.glsl deleted file mode 100644 index 9c4ed8315d..0000000000 --- a/test/tint/builtins/gen/any/e755c1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void any_e755c1() { - bool res = any(bvec3(false, false, false)); -} - -vec4 vertex_main() { - any_e755c1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void any_e755c1() { - bool res = any(bvec3(false, false, false)); -} - -void fragment_main() { - any_e755c1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void any_e755c1() { - bool res = any(bvec3(false, false, false)); -} - -void compute_main() { - any_e755c1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/any/e755c1.wgsl.expected.hlsl b/test/tint/builtins/gen/any/e755c1.wgsl.expected.hlsl deleted file mode 100644 index ab1a57aec6..0000000000 --- a/test/tint/builtins/gen/any/e755c1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void any_e755c1() { - bool res = any(bool3(false, false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - any_e755c1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - any_e755c1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - any_e755c1(); - return; -} diff --git a/test/tint/builtins/gen/any/e755c1.wgsl.expected.msl b/test/tint/builtins/gen/any/e755c1.wgsl.expected.msl deleted file mode 100644 index fc6214bccb..0000000000 --- a/test/tint/builtins/gen/any/e755c1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void any_e755c1() { - bool res = any(bool3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - any_e755c1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - any_e755c1(); - return; -} - -kernel void compute_main() { - any_e755c1(); - return; -} - diff --git a/test/tint/builtins/gen/any/e755c1.wgsl.expected.spvasm b/test/tint/builtins/gen/any/e755c1.wgsl.expected.spvasm deleted file mode 100644 index 7e196b0819..0000000000 --- a/test/tint/builtins/gen/any/e755c1.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %any_e755c1 "any_e755c1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %16 = OpConstantNull %v3bool -%_ptr_Function_bool = OpTypePointer Function %bool - %19 = OpConstantNull %bool - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %any_e755c1 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_bool Function %19 - %13 = OpAny %bool %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %any_e755c1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %any_e755c1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %any_e755c1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/any/e755c1.wgsl.expected.wgsl b/test/tint/builtins/gen/any/e755c1.wgsl.expected.wgsl deleted file mode 100644 index bf47826409..0000000000 --- a/test/tint/builtins/gen/any/e755c1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn any_e755c1() { - var res : bool = any(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - any_e755c1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - any_e755c1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - any_e755c1(); -} diff --git a/test/tint/builtins/gen/arrayLength/1588cd.wgsl b/test/tint/builtins/gen/arrayLength/1588cd.wgsl deleted file mode 100644 index 02b63c6ffa..0000000000 --- a/test/tint/builtins/gen/arrayLength/1588cd.wgsl +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RO { - arg_0: array, -}; -@group(0) @binding(1) var sb_ro : SB_RO; - -// fn arrayLength(ptr, read>) -> u32 -fn arrayLength_1588cd() { - var res: u32 = arrayLength(&sb_ro.arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_1588cd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_1588cd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_1588cd(); -} diff --git a/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.glsl b/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.glsl deleted file mode 100644 index bd731f792a..0000000000 --- a/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.glsl +++ /dev/null @@ -1,58 +0,0 @@ -#version 310 es - -layout(binding = 1, std430) buffer SB_RO_1 { - int arg_0[]; -} sb_ro; -void arrayLength_1588cd() { - uint res = uint(sb_ro.arg_0.length()); -} - -vec4 vertex_main() { - arrayLength_1588cd(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(binding = 1, std430) buffer SB_RO_1 { - int arg_0[]; -} sb_ro; -void arrayLength_1588cd() { - uint res = uint(sb_ro.arg_0.length()); -} - -void fragment_main() { - arrayLength_1588cd(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(binding = 1, std430) buffer SB_RO_1 { - int arg_0[]; -} sb_ro; -void arrayLength_1588cd() { - uint res = uint(sb_ro.arg_0.length()); -} - -void compute_main() { - arrayLength_1588cd(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.hlsl b/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.hlsl deleted file mode 100644 index 5eb91da8a0..0000000000 --- a/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -ByteAddressBuffer sb_ro : register(t1, space0); - -void arrayLength_1588cd() { - uint tint_symbol_2 = 0u; - sb_ro.GetDimensions(tint_symbol_2); - const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); - uint res = tint_symbol_3; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - arrayLength_1588cd(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - arrayLength_1588cd(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - arrayLength_1588cd(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.msl b/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.msl deleted file mode 100644 index 1793477027..0000000000 --- a/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.msl +++ /dev/null @@ -1,41 +0,0 @@ -#include - -using namespace metal; -struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; -}; - -struct SB_RO { - int arg_0[1]; -}; - -void arrayLength_1588cd(const constant tint_symbol_1* const tint_symbol_3) { - uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { - arrayLength_1588cd(tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { - arrayLength_1588cd(tint_symbol_6); - return; -} - -kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { - arrayLength_1588cd(tint_symbol_7); - return; -} - diff --git a/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.wgsl b/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.wgsl deleted file mode 100644 index 2a2648d3e0..0000000000 --- a/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.wgsl +++ /dev/null @@ -1,25 +0,0 @@ -struct SB_RO { - arg_0 : array, -} - -@group(0) @binding(1) var sb_ro : SB_RO; - -fn arrayLength_1588cd() { - var res : u32 = arrayLength(&(sb_ro.arg_0)); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_1588cd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_1588cd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_1588cd(); -} diff --git a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl b/test/tint/builtins/gen/arrayLength/61b1c7.wgsl deleted file mode 100644 index 195f911845..0000000000 --- a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: array, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn arrayLength(ptr, read_write>) -> u32 -fn arrayLength_61b1c7() { - var res: u32 = arrayLength(&sb_rw.arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_61b1c7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_61b1c7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_61b1c7(); -} diff --git a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.glsl b/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.glsl deleted file mode 100644 index 3825f71123..0000000000 --- a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.glsl +++ /dev/null @@ -1,58 +0,0 @@ -#version 310 es - -layout(binding = 0, std430) buffer SB_RW_1 { - int arg_0[]; -} sb_rw; -void arrayLength_61b1c7() { - uint res = uint(sb_rw.arg_0.length()); -} - -vec4 vertex_main() { - arrayLength_61b1c7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(binding = 0, std430) buffer SB_RW_1 { - int arg_0[]; -} sb_rw; -void arrayLength_61b1c7() { - uint res = uint(sb_rw.arg_0.length()); -} - -void fragment_main() { - arrayLength_61b1c7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(binding = 0, std430) buffer SB_RW_1 { - int arg_0[]; -} sb_rw; -void arrayLength_61b1c7() { - uint res = uint(sb_rw.arg_0.length()); -} - -void compute_main() { - arrayLength_61b1c7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.hlsl b/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.hlsl deleted file mode 100644 index 77b4a1ea9a..0000000000 --- a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -RWByteAddressBuffer sb_rw : register(u0, space0); - -void arrayLength_61b1c7() { - uint tint_symbol_2 = 0u; - sb_rw.GetDimensions(tint_symbol_2); - const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); - uint res = tint_symbol_3; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - arrayLength_61b1c7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - arrayLength_61b1c7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - arrayLength_61b1c7(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.msl b/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.msl deleted file mode 100644 index cebf66b06a..0000000000 --- a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.msl +++ /dev/null @@ -1,41 +0,0 @@ -#include - -using namespace metal; -struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; -}; - -struct SB_RW { - int arg_0[1]; -}; - -void arrayLength_61b1c7(const constant tint_symbol_1* const tint_symbol_3) { - uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { - arrayLength_61b1c7(tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { - arrayLength_61b1c7(tint_symbol_6); - return; -} - -kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { - arrayLength_61b1c7(tint_symbol_7); - return; -} - diff --git a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.wgsl b/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.wgsl deleted file mode 100644 index 73dbbb7f3a..0000000000 --- a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.wgsl +++ /dev/null @@ -1,25 +0,0 @@ -struct SB_RW { - arg_0 : array, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn arrayLength_61b1c7() { - var res : u32 = arrayLength(&(sb_rw.arg_0)); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_61b1c7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_61b1c7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_61b1c7(); -} diff --git a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl b/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl deleted file mode 100644 index a9ae5dc509..0000000000 --- a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RO { - arg_0: array, -}; -@group(0) @binding(1) var sb_ro : SB_RO; - -// fn arrayLength(ptr, read>) -> u32 -fn arrayLength_a0f5ca() { - var res: u32 = arrayLength(&sb_ro.arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_a0f5ca(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_a0f5ca(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_a0f5ca(); -} diff --git a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.glsl b/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.glsl deleted file mode 100644 index da41f2295e..0000000000 --- a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.glsl +++ /dev/null @@ -1,58 +0,0 @@ -#version 310 es - -layout(binding = 1, std430) buffer SB_RO_1 { - float arg_0[]; -} sb_ro; -void arrayLength_a0f5ca() { - uint res = uint(sb_ro.arg_0.length()); -} - -vec4 vertex_main() { - arrayLength_a0f5ca(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(binding = 1, std430) buffer SB_RO_1 { - float arg_0[]; -} sb_ro; -void arrayLength_a0f5ca() { - uint res = uint(sb_ro.arg_0.length()); -} - -void fragment_main() { - arrayLength_a0f5ca(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(binding = 1, std430) buffer SB_RO_1 { - float arg_0[]; -} sb_ro; -void arrayLength_a0f5ca() { - uint res = uint(sb_ro.arg_0.length()); -} - -void compute_main() { - arrayLength_a0f5ca(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.hlsl b/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.hlsl deleted file mode 100644 index f5167fa5a7..0000000000 --- a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -ByteAddressBuffer sb_ro : register(t1, space0); - -void arrayLength_a0f5ca() { - uint tint_symbol_2 = 0u; - sb_ro.GetDimensions(tint_symbol_2); - const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); - uint res = tint_symbol_3; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - arrayLength_a0f5ca(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - arrayLength_a0f5ca(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - arrayLength_a0f5ca(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.msl b/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.msl deleted file mode 100644 index a04fc9c82c..0000000000 --- a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.msl +++ /dev/null @@ -1,41 +0,0 @@ -#include - -using namespace metal; -struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; -}; - -struct SB_RO { - float arg_0[1]; -}; - -void arrayLength_a0f5ca(const constant tint_symbol_1* const tint_symbol_3) { - uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { - arrayLength_a0f5ca(tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { - arrayLength_a0f5ca(tint_symbol_6); - return; -} - -kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { - arrayLength_a0f5ca(tint_symbol_7); - return; -} - diff --git a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.wgsl b/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.wgsl deleted file mode 100644 index a1eb324f96..0000000000 --- a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.wgsl +++ /dev/null @@ -1,25 +0,0 @@ -struct SB_RO { - arg_0 : array, -} - -@group(0) @binding(1) var sb_ro : SB_RO; - -fn arrayLength_a0f5ca() { - var res : u32 = arrayLength(&(sb_ro.arg_0)); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_a0f5ca(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_a0f5ca(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_a0f5ca(); -} diff --git a/test/tint/builtins/gen/arrayLength/cdd123.wgsl b/test/tint/builtins/gen/arrayLength/cdd123.wgsl deleted file mode 100644 index fae8c7f4cf..0000000000 --- a/test/tint/builtins/gen/arrayLength/cdd123.wgsl +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: array, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn arrayLength(ptr, read_write>) -> u32 -fn arrayLength_cdd123() { - var res: u32 = arrayLength(&sb_rw.arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_cdd123(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_cdd123(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_cdd123(); -} diff --git a/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.glsl b/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.glsl deleted file mode 100644 index d68cc4c264..0000000000 --- a/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.glsl +++ /dev/null @@ -1,58 +0,0 @@ -#version 310 es - -layout(binding = 0, std430) buffer SB_RW_1 { - float arg_0[]; -} sb_rw; -void arrayLength_cdd123() { - uint res = uint(sb_rw.arg_0.length()); -} - -vec4 vertex_main() { - arrayLength_cdd123(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(binding = 0, std430) buffer SB_RW_1 { - float arg_0[]; -} sb_rw; -void arrayLength_cdd123() { - uint res = uint(sb_rw.arg_0.length()); -} - -void fragment_main() { - arrayLength_cdd123(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(binding = 0, std430) buffer SB_RW_1 { - float arg_0[]; -} sb_rw; -void arrayLength_cdd123() { - uint res = uint(sb_rw.arg_0.length()); -} - -void compute_main() { - arrayLength_cdd123(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.hlsl b/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.hlsl deleted file mode 100644 index e20cd105e8..0000000000 --- a/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -RWByteAddressBuffer sb_rw : register(u0, space0); - -void arrayLength_cdd123() { - uint tint_symbol_2 = 0u; - sb_rw.GetDimensions(tint_symbol_2); - const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); - uint res = tint_symbol_3; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - arrayLength_cdd123(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - arrayLength_cdd123(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - arrayLength_cdd123(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.msl b/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.msl deleted file mode 100644 index 3ba8276df0..0000000000 --- a/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.msl +++ /dev/null @@ -1,41 +0,0 @@ -#include - -using namespace metal; -struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; -}; - -struct SB_RW { - float arg_0[1]; -}; - -void arrayLength_cdd123(const constant tint_symbol_1* const tint_symbol_3) { - uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { - arrayLength_cdd123(tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { - arrayLength_cdd123(tint_symbol_6); - return; -} - -kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { - arrayLength_cdd123(tint_symbol_7); - return; -} - diff --git a/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.wgsl b/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.wgsl deleted file mode 100644 index 1f2d17cb09..0000000000 --- a/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.wgsl +++ /dev/null @@ -1,25 +0,0 @@ -struct SB_RW { - arg_0 : array, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn arrayLength_cdd123() { - var res : u32 = arrayLength(&(sb_rw.arg_0)); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_cdd123(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_cdd123(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_cdd123(); -} diff --git a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl b/test/tint/builtins/gen/arrayLength/cfca0a.wgsl deleted file mode 100644 index afebc263e3..0000000000 --- a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RO { - arg_0: array, -}; -@group(0) @binding(1) var sb_ro : SB_RO; - -// fn arrayLength(ptr, read>) -> u32 -fn arrayLength_cfca0a() { - var res: u32 = arrayLength(&sb_ro.arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_cfca0a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_cfca0a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_cfca0a(); -} diff --git a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.glsl b/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.glsl deleted file mode 100644 index 4503a3441b..0000000000 --- a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.glsl +++ /dev/null @@ -1,58 +0,0 @@ -#version 310 es - -layout(binding = 1, std430) buffer SB_RO_1 { - uint arg_0[]; -} sb_ro; -void arrayLength_cfca0a() { - uint res = uint(sb_ro.arg_0.length()); -} - -vec4 vertex_main() { - arrayLength_cfca0a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(binding = 1, std430) buffer SB_RO_1 { - uint arg_0[]; -} sb_ro; -void arrayLength_cfca0a() { - uint res = uint(sb_ro.arg_0.length()); -} - -void fragment_main() { - arrayLength_cfca0a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(binding = 1, std430) buffer SB_RO_1 { - uint arg_0[]; -} sb_ro; -void arrayLength_cfca0a() { - uint res = uint(sb_ro.arg_0.length()); -} - -void compute_main() { - arrayLength_cfca0a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.hlsl b/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.hlsl deleted file mode 100644 index 78f5396ac1..0000000000 --- a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -ByteAddressBuffer sb_ro : register(t1, space0); - -void arrayLength_cfca0a() { - uint tint_symbol_2 = 0u; - sb_ro.GetDimensions(tint_symbol_2); - const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); - uint res = tint_symbol_3; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - arrayLength_cfca0a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - arrayLength_cfca0a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - arrayLength_cfca0a(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.msl b/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.msl deleted file mode 100644 index 5dd7ad6153..0000000000 --- a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.msl +++ /dev/null @@ -1,41 +0,0 @@ -#include - -using namespace metal; -struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; -}; - -struct SB_RO { - uint arg_0[1]; -}; - -void arrayLength_cfca0a(const constant tint_symbol_1* const tint_symbol_3) { - uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { - arrayLength_cfca0a(tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { - arrayLength_cfca0a(tint_symbol_6); - return; -} - -kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { - arrayLength_cfca0a(tint_symbol_7); - return; -} - diff --git a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.wgsl b/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.wgsl deleted file mode 100644 index 5778963880..0000000000 --- a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.wgsl +++ /dev/null @@ -1,25 +0,0 @@ -struct SB_RO { - arg_0 : array, -} - -@group(0) @binding(1) var sb_ro : SB_RO; - -fn arrayLength_cfca0a() { - var res : u32 = arrayLength(&(sb_ro.arg_0)); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_cfca0a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_cfca0a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_cfca0a(); -} diff --git a/test/tint/builtins/gen/arrayLength/eb510f.wgsl b/test/tint/builtins/gen/arrayLength/eb510f.wgsl deleted file mode 100644 index f9d0163437..0000000000 --- a/test/tint/builtins/gen/arrayLength/eb510f.wgsl +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: array, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn arrayLength(ptr, read_write>) -> u32 -fn arrayLength_eb510f() { - var res: u32 = arrayLength(&sb_rw.arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_eb510f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_eb510f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_eb510f(); -} diff --git a/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.glsl b/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.glsl deleted file mode 100644 index ac1b3b5cfd..0000000000 --- a/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.glsl +++ /dev/null @@ -1,58 +0,0 @@ -#version 310 es - -layout(binding = 0, std430) buffer SB_RW_1 { - uint arg_0[]; -} sb_rw; -void arrayLength_eb510f() { - uint res = uint(sb_rw.arg_0.length()); -} - -vec4 vertex_main() { - arrayLength_eb510f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(binding = 0, std430) buffer SB_RW_1 { - uint arg_0[]; -} sb_rw; -void arrayLength_eb510f() { - uint res = uint(sb_rw.arg_0.length()); -} - -void fragment_main() { - arrayLength_eb510f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(binding = 0, std430) buffer SB_RW_1 { - uint arg_0[]; -} sb_rw; -void arrayLength_eb510f() { - uint res = uint(sb_rw.arg_0.length()); -} - -void compute_main() { - arrayLength_eb510f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.hlsl b/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.hlsl deleted file mode 100644 index 1191d0cab7..0000000000 --- a/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -RWByteAddressBuffer sb_rw : register(u0, space0); - -void arrayLength_eb510f() { - uint tint_symbol_2 = 0u; - sb_rw.GetDimensions(tint_symbol_2); - const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); - uint res = tint_symbol_3; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - arrayLength_eb510f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - arrayLength_eb510f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - arrayLength_eb510f(); - return; -} diff --git a/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.msl b/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.msl deleted file mode 100644 index c66c4264e4..0000000000 --- a/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.msl +++ /dev/null @@ -1,41 +0,0 @@ -#include - -using namespace metal; -struct tint_symbol_1 { - /* 0x0000 */ uint4 buffer_size[1]; -}; - -struct SB_RW { - uint arg_0[1]; -}; - -void arrayLength_eb510f(const constant tint_symbol_1* const tint_symbol_3) { - uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { - arrayLength_eb510f(tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { - arrayLength_eb510f(tint_symbol_6); - return; -} - -kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { - arrayLength_eb510f(tint_symbol_7); - return; -} - diff --git a/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.wgsl b/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.wgsl deleted file mode 100644 index 805917c027..0000000000 --- a/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.wgsl +++ /dev/null @@ -1,25 +0,0 @@ -struct SB_RW { - arg_0 : array, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn arrayLength_eb510f() { - var res : u32 = arrayLength(&(sb_rw.arg_0)); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - arrayLength_eb510f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - arrayLength_eb510f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - arrayLength_eb510f(); -} diff --git a/test/tint/builtins/gen/asin/064953.wgsl b/test/tint/builtins/gen/asin/064953.wgsl deleted file mode 100644 index e26ebf28f1..0000000000 --- a/test/tint/builtins/gen/asin/064953.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn asin(vec<4, f32>) -> vec<4, f32> -fn asin_064953() { - var res: vec4 = asin(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - asin_064953(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - asin_064953(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - asin_064953(); -} diff --git a/test/tint/builtins/gen/asin/064953.wgsl.expected.glsl b/test/tint/builtins/gen/asin/064953.wgsl.expected.glsl deleted file mode 100644 index 55016345a4..0000000000 --- a/test/tint/builtins/gen/asin/064953.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void asin_064953() { - vec4 res = asin(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - asin_064953(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void asin_064953() { - vec4 res = asin(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - asin_064953(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void asin_064953() { - vec4 res = asin(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - asin_064953(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/asin/064953.wgsl.expected.hlsl b/test/tint/builtins/gen/asin/064953.wgsl.expected.hlsl deleted file mode 100644 index 41624bd112..0000000000 --- a/test/tint/builtins/gen/asin/064953.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void asin_064953() { - float4 res = asin(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - asin_064953(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - asin_064953(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - asin_064953(); - return; -} diff --git a/test/tint/builtins/gen/asin/064953.wgsl.expected.msl b/test/tint/builtins/gen/asin/064953.wgsl.expected.msl deleted file mode 100644 index efee548e4c..0000000000 --- a/test/tint/builtins/gen/asin/064953.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void asin_064953() { - float4 res = asin(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - asin_064953(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - asin_064953(); - return; -} - -kernel void compute_main() { - asin_064953(); - return; -} - diff --git a/test/tint/builtins/gen/asin/064953.wgsl.expected.spvasm b/test/tint/builtins/gen/asin/064953.wgsl.expected.spvasm deleted file mode 100644 index dec5ed964f..0000000000 --- a/test/tint/builtins/gen/asin/064953.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %asin_064953 "asin_064953" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%asin_064953 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Asin %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %asin_064953 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %asin_064953 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %asin_064953 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/asin/064953.wgsl.expected.wgsl b/test/tint/builtins/gen/asin/064953.wgsl.expected.wgsl deleted file mode 100644 index ed58d99dd3..0000000000 --- a/test/tint/builtins/gen/asin/064953.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn asin_064953() { - var res : vec4 = asin(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - asin_064953(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - asin_064953(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - asin_064953(); -} diff --git a/test/tint/builtins/gen/asin/7b6a44.wgsl b/test/tint/builtins/gen/asin/7b6a44.wgsl deleted file mode 100644 index 57b4c94d92..0000000000 --- a/test/tint/builtins/gen/asin/7b6a44.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn asin(vec<2, f32>) -> vec<2, f32> -fn asin_7b6a44() { - var res: vec2 = asin(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - asin_7b6a44(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - asin_7b6a44(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - asin_7b6a44(); -} diff --git a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.glsl b/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.glsl deleted file mode 100644 index 3d07aab695..0000000000 --- a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void asin_7b6a44() { - vec2 res = asin(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - asin_7b6a44(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void asin_7b6a44() { - vec2 res = asin(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - asin_7b6a44(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void asin_7b6a44() { - vec2 res = asin(vec2(0.0f, 0.0f)); -} - -void compute_main() { - asin_7b6a44(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.hlsl b/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.hlsl deleted file mode 100644 index c48dceaf48..0000000000 --- a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void asin_7b6a44() { - float2 res = asin(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - asin_7b6a44(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - asin_7b6a44(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - asin_7b6a44(); - return; -} diff --git a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.msl b/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.msl deleted file mode 100644 index 35238bb088..0000000000 --- a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void asin_7b6a44() { - float2 res = asin(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - asin_7b6a44(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - asin_7b6a44(); - return; -} - -kernel void compute_main() { - asin_7b6a44(); - return; -} - diff --git a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.spvasm b/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.spvasm deleted file mode 100644 index c52137efc9..0000000000 --- a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %asin_7b6a44 "asin_7b6a44" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%asin_7b6a44 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Asin %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %asin_7b6a44 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %asin_7b6a44 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %asin_7b6a44 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.wgsl b/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.wgsl deleted file mode 100644 index d70e952909..0000000000 --- a/test/tint/builtins/gen/asin/7b6a44.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn asin_7b6a44() { - var res : vec2 = asin(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - asin_7b6a44(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - asin_7b6a44(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - asin_7b6a44(); -} diff --git a/test/tint/builtins/gen/asin/8cd9c9.wgsl b/test/tint/builtins/gen/asin/8cd9c9.wgsl deleted file mode 100644 index 5406bd961d..0000000000 --- a/test/tint/builtins/gen/asin/8cd9c9.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn asin(vec<3, f32>) -> vec<3, f32> -fn asin_8cd9c9() { - var res: vec3 = asin(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - asin_8cd9c9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - asin_8cd9c9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - asin_8cd9c9(); -} diff --git a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.glsl b/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.glsl deleted file mode 100644 index ad0601061d..0000000000 --- a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void asin_8cd9c9() { - vec3 res = asin(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - asin_8cd9c9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void asin_8cd9c9() { - vec3 res = asin(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - asin_8cd9c9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void asin_8cd9c9() { - vec3 res = asin(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - asin_8cd9c9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.hlsl b/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.hlsl deleted file mode 100644 index f99b94a01e..0000000000 --- a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void asin_8cd9c9() { - float3 res = asin(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - asin_8cd9c9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - asin_8cd9c9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - asin_8cd9c9(); - return; -} diff --git a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.msl b/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.msl deleted file mode 100644 index bd995202c8..0000000000 --- a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void asin_8cd9c9() { - float3 res = asin(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - asin_8cd9c9(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - asin_8cd9c9(); - return; -} - -kernel void compute_main() { - asin_8cd9c9(); - return; -} - diff --git a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.spvasm b/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.spvasm deleted file mode 100644 index ca0dad6224..0000000000 --- a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %asin_8cd9c9 "asin_8cd9c9" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%asin_8cd9c9 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Asin %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %asin_8cd9c9 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %asin_8cd9c9 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %asin_8cd9c9 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.wgsl b/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.wgsl deleted file mode 100644 index 2f4ea23b0f..0000000000 --- a/test/tint/builtins/gen/asin/8cd9c9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn asin_8cd9c9() { - var res : vec3 = asin(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - asin_8cd9c9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - asin_8cd9c9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - asin_8cd9c9(); -} diff --git a/test/tint/builtins/gen/asin/c0c272.wgsl b/test/tint/builtins/gen/asin/c0c272.wgsl deleted file mode 100644 index 339c53fcd9..0000000000 --- a/test/tint/builtins/gen/asin/c0c272.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn asin(f32) -> f32 -fn asin_c0c272() { - var res: f32 = asin(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - asin_c0c272(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - asin_c0c272(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - asin_c0c272(); -} diff --git a/test/tint/builtins/gen/asin/c0c272.wgsl.expected.glsl b/test/tint/builtins/gen/asin/c0c272.wgsl.expected.glsl deleted file mode 100644 index fba3bee042..0000000000 --- a/test/tint/builtins/gen/asin/c0c272.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void asin_c0c272() { - float res = asin(1.0f); -} - -vec4 vertex_main() { - asin_c0c272(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void asin_c0c272() { - float res = asin(1.0f); -} - -void fragment_main() { - asin_c0c272(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void asin_c0c272() { - float res = asin(1.0f); -} - -void compute_main() { - asin_c0c272(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/asin/c0c272.wgsl.expected.hlsl b/test/tint/builtins/gen/asin/c0c272.wgsl.expected.hlsl deleted file mode 100644 index 94ae3b92e3..0000000000 --- a/test/tint/builtins/gen/asin/c0c272.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void asin_c0c272() { - float res = asin(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - asin_c0c272(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - asin_c0c272(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - asin_c0c272(); - return; -} diff --git a/test/tint/builtins/gen/asin/c0c272.wgsl.expected.msl b/test/tint/builtins/gen/asin/c0c272.wgsl.expected.msl deleted file mode 100644 index 4ada72f62a..0000000000 --- a/test/tint/builtins/gen/asin/c0c272.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void asin_c0c272() { - float res = asin(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - asin_c0c272(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - asin_c0c272(); - return; -} - -kernel void compute_main() { - asin_c0c272(); - return; -} - diff --git a/test/tint/builtins/gen/asin/c0c272.wgsl.expected.wgsl b/test/tint/builtins/gen/asin/c0c272.wgsl.expected.wgsl deleted file mode 100644 index d3a8d05e1d..0000000000 --- a/test/tint/builtins/gen/asin/c0c272.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn asin_c0c272() { - var res : f32 = asin(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - asin_c0c272(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - asin_c0c272(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - asin_c0c272(); -} diff --git a/test/tint/builtins/gen/atan/02979a.wgsl b/test/tint/builtins/gen/atan/02979a.wgsl deleted file mode 100644 index 99fc24b64f..0000000000 --- a/test/tint/builtins/gen/atan/02979a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn atan(f32) -> f32 -fn atan_02979a() { - var res: f32 = atan(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan_02979a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan_02979a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan_02979a(); -} diff --git a/test/tint/builtins/gen/atan/02979a.wgsl.expected.glsl b/test/tint/builtins/gen/atan/02979a.wgsl.expected.glsl deleted file mode 100644 index e409c45c2f..0000000000 --- a/test/tint/builtins/gen/atan/02979a.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void atan_02979a() { - float res = atan(1.0f); -} - -vec4 vertex_main() { - atan_02979a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void atan_02979a() { - float res = atan(1.0f); -} - -void fragment_main() { - atan_02979a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void atan_02979a() { - float res = atan(1.0f); -} - -void compute_main() { - atan_02979a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/atan/02979a.wgsl.expected.hlsl b/test/tint/builtins/gen/atan/02979a.wgsl.expected.hlsl deleted file mode 100644 index 4dce6ec284..0000000000 --- a/test/tint/builtins/gen/atan/02979a.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void atan_02979a() { - float res = atan(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - atan_02979a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - atan_02979a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atan_02979a(); - return; -} diff --git a/test/tint/builtins/gen/atan/02979a.wgsl.expected.msl b/test/tint/builtins/gen/atan/02979a.wgsl.expected.msl deleted file mode 100644 index bfe58be704..0000000000 --- a/test/tint/builtins/gen/atan/02979a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void atan_02979a() { - float res = atan(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - atan_02979a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - atan_02979a(); - return; -} - -kernel void compute_main() { - atan_02979a(); - return; -} - diff --git a/test/tint/builtins/gen/atan/02979a.wgsl.expected.wgsl b/test/tint/builtins/gen/atan/02979a.wgsl.expected.wgsl deleted file mode 100644 index 75af7436e8..0000000000 --- a/test/tint/builtins/gen/atan/02979a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn atan_02979a() { - var res : f32 = atan(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan_02979a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan_02979a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan_02979a(); -} diff --git a/test/tint/builtins/gen/atan/331e6d.wgsl b/test/tint/builtins/gen/atan/331e6d.wgsl deleted file mode 100644 index e3f4989b9a..0000000000 --- a/test/tint/builtins/gen/atan/331e6d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn atan(vec<3, f32>) -> vec<3, f32> -fn atan_331e6d() { - var res: vec3 = atan(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan_331e6d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan_331e6d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan_331e6d(); -} diff --git a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.glsl b/test/tint/builtins/gen/atan/331e6d.wgsl.expected.glsl deleted file mode 100644 index 029fbd813b..0000000000 --- a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void atan_331e6d() { - vec3 res = atan(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - atan_331e6d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void atan_331e6d() { - vec3 res = atan(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - atan_331e6d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void atan_331e6d() { - vec3 res = atan(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - atan_331e6d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.hlsl b/test/tint/builtins/gen/atan/331e6d.wgsl.expected.hlsl deleted file mode 100644 index 3dd8341c13..0000000000 --- a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void atan_331e6d() { - float3 res = atan(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - atan_331e6d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - atan_331e6d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atan_331e6d(); - return; -} diff --git a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.msl b/test/tint/builtins/gen/atan/331e6d.wgsl.expected.msl deleted file mode 100644 index 3c7f449c9f..0000000000 --- a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void atan_331e6d() { - float3 res = atan(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - atan_331e6d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - atan_331e6d(); - return; -} - -kernel void compute_main() { - atan_331e6d(); - return; -} - diff --git a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.spvasm b/test/tint/builtins/gen/atan/331e6d.wgsl.expected.spvasm deleted file mode 100644 index 1cf1035f86..0000000000 --- a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %atan_331e6d "atan_331e6d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%atan_331e6d = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Atan %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %atan_331e6d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %atan_331e6d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %atan_331e6d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.wgsl b/test/tint/builtins/gen/atan/331e6d.wgsl.expected.wgsl deleted file mode 100644 index 7bc7982749..0000000000 --- a/test/tint/builtins/gen/atan/331e6d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn atan_331e6d() { - var res : vec3 = atan(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan_331e6d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan_331e6d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan_331e6d(); -} diff --git a/test/tint/builtins/gen/atan/a8b696.wgsl b/test/tint/builtins/gen/atan/a8b696.wgsl deleted file mode 100644 index 2eea8423af..0000000000 --- a/test/tint/builtins/gen/atan/a8b696.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn atan(vec<4, f32>) -> vec<4, f32> -fn atan_a8b696() { - var res: vec4 = atan(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan_a8b696(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan_a8b696(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan_a8b696(); -} diff --git a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.glsl b/test/tint/builtins/gen/atan/a8b696.wgsl.expected.glsl deleted file mode 100644 index 8c441db254..0000000000 --- a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void atan_a8b696() { - vec4 res = atan(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - atan_a8b696(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void atan_a8b696() { - vec4 res = atan(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - atan_a8b696(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void atan_a8b696() { - vec4 res = atan(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - atan_a8b696(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.hlsl b/test/tint/builtins/gen/atan/a8b696.wgsl.expected.hlsl deleted file mode 100644 index b014aec5df..0000000000 --- a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void atan_a8b696() { - float4 res = atan(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - atan_a8b696(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - atan_a8b696(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atan_a8b696(); - return; -} diff --git a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.msl b/test/tint/builtins/gen/atan/a8b696.wgsl.expected.msl deleted file mode 100644 index a82a8f92e9..0000000000 --- a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void atan_a8b696() { - float4 res = atan(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - atan_a8b696(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - atan_a8b696(); - return; -} - -kernel void compute_main() { - atan_a8b696(); - return; -} - diff --git a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.spvasm b/test/tint/builtins/gen/atan/a8b696.wgsl.expected.spvasm deleted file mode 100644 index b60e13665f..0000000000 --- a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %atan_a8b696 "atan_a8b696" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%atan_a8b696 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Atan %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %atan_a8b696 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %atan_a8b696 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %atan_a8b696 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.wgsl b/test/tint/builtins/gen/atan/a8b696.wgsl.expected.wgsl deleted file mode 100644 index 70b4684e77..0000000000 --- a/test/tint/builtins/gen/atan/a8b696.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn atan_a8b696() { - var res : vec4 = atan(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan_a8b696(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan_a8b696(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan_a8b696(); -} diff --git a/test/tint/builtins/gen/atan/ad96e4.wgsl b/test/tint/builtins/gen/atan/ad96e4.wgsl deleted file mode 100644 index 170c7fc41a..0000000000 --- a/test/tint/builtins/gen/atan/ad96e4.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn atan(vec<2, f32>) -> vec<2, f32> -fn atan_ad96e4() { - var res: vec2 = atan(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan_ad96e4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan_ad96e4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan_ad96e4(); -} diff --git a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.glsl b/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.glsl deleted file mode 100644 index 9fff633f4a..0000000000 --- a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void atan_ad96e4() { - vec2 res = atan(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - atan_ad96e4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void atan_ad96e4() { - vec2 res = atan(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - atan_ad96e4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void atan_ad96e4() { - vec2 res = atan(vec2(0.0f, 0.0f)); -} - -void compute_main() { - atan_ad96e4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.hlsl b/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.hlsl deleted file mode 100644 index dd5218a341..0000000000 --- a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void atan_ad96e4() { - float2 res = atan(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - atan_ad96e4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - atan_ad96e4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atan_ad96e4(); - return; -} diff --git a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.msl b/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.msl deleted file mode 100644 index f5a21518b5..0000000000 --- a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void atan_ad96e4() { - float2 res = atan(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - atan_ad96e4(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - atan_ad96e4(); - return; -} - -kernel void compute_main() { - atan_ad96e4(); - return; -} - diff --git a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.spvasm b/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.spvasm deleted file mode 100644 index b8a56569e4..0000000000 --- a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %atan_ad96e4 "atan_ad96e4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%atan_ad96e4 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Atan %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %atan_ad96e4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %atan_ad96e4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %atan_ad96e4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.wgsl b/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.wgsl deleted file mode 100644 index dcf775a362..0000000000 --- a/test/tint/builtins/gen/atan/ad96e4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn atan_ad96e4() { - var res : vec2 = atan(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan_ad96e4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan_ad96e4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan_ad96e4(); -} diff --git a/test/tint/builtins/gen/atan2/57fb13.wgsl b/test/tint/builtins/gen/atan2/57fb13.wgsl deleted file mode 100644 index be99214c3e..0000000000 --- a/test/tint/builtins/gen/atan2/57fb13.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn atan2(vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn atan2_57fb13() { - var res: vec2 = atan2(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan2_57fb13(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan2_57fb13(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan2_57fb13(); -} diff --git a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.glsl b/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.glsl deleted file mode 100644 index e3a8ec44d3..0000000000 --- a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void atan2_57fb13() { - vec2 res = atan(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - atan2_57fb13(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void atan2_57fb13() { - vec2 res = atan(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - atan2_57fb13(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void atan2_57fb13() { - vec2 res = atan(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - atan2_57fb13(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.hlsl b/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.hlsl deleted file mode 100644 index ff961418cc..0000000000 --- a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void atan2_57fb13() { - float2 res = atan2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - atan2_57fb13(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - atan2_57fb13(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atan2_57fb13(); - return; -} diff --git a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.msl b/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.msl deleted file mode 100644 index f05e3c56b6..0000000000 --- a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void atan2_57fb13() { - float2 res = atan2(float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - atan2_57fb13(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - atan2_57fb13(); - return; -} - -kernel void compute_main() { - atan2_57fb13(); - return; -} - diff --git a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.spvasm b/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.spvasm deleted file mode 100644 index 5fea69d590..0000000000 --- a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %atan2_57fb13 "atan2_57fb13" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%atan2_57fb13 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Atan2 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %atan2_57fb13 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %atan2_57fb13 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %atan2_57fb13 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.wgsl b/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.wgsl deleted file mode 100644 index ec7ff3aef7..0000000000 --- a/test/tint/builtins/gen/atan2/57fb13.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn atan2_57fb13() { - var res : vec2 = atan2(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan2_57fb13(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan2_57fb13(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan2_57fb13(); -} diff --git a/test/tint/builtins/gen/atan2/96057c.wgsl b/test/tint/builtins/gen/atan2/96057c.wgsl deleted file mode 100644 index dad1ef2553..0000000000 --- a/test/tint/builtins/gen/atan2/96057c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn atan2(f32, f32) -> f32 -fn atan2_96057c() { - var res: f32 = atan2(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan2_96057c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan2_96057c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan2_96057c(); -} diff --git a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.glsl b/test/tint/builtins/gen/atan2/96057c.wgsl.expected.glsl deleted file mode 100644 index 0f96e8a342..0000000000 --- a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void atan2_96057c() { - float res = atan(1.0f, 1.0f); -} - -vec4 vertex_main() { - atan2_96057c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void atan2_96057c() { - float res = atan(1.0f, 1.0f); -} - -void fragment_main() { - atan2_96057c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void atan2_96057c() { - float res = atan(1.0f, 1.0f); -} - -void compute_main() { - atan2_96057c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.hlsl b/test/tint/builtins/gen/atan2/96057c.wgsl.expected.hlsl deleted file mode 100644 index 3794036205..0000000000 --- a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void atan2_96057c() { - float res = atan2(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - atan2_96057c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - atan2_96057c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atan2_96057c(); - return; -} diff --git a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.msl b/test/tint/builtins/gen/atan2/96057c.wgsl.expected.msl deleted file mode 100644 index 659a6225e1..0000000000 --- a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void atan2_96057c() { - float res = atan2(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - atan2_96057c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - atan2_96057c(); - return; -} - -kernel void compute_main() { - atan2_96057c(); - return; -} - diff --git a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.spvasm b/test/tint/builtins/gen/atan2/96057c.wgsl.expected.spvasm deleted file mode 100644 index 777b131acf..0000000000 --- a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %atan2_96057c "atan2_96057c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 -%_ptr_Function_float = OpTypePointer Function %float - %18 = OpTypeFunction %v4float -%atan2_96057c = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Atan2 %float_1 %float_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %atan2_96057c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %atan2_96057c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %atan2_96057c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.wgsl b/test/tint/builtins/gen/atan2/96057c.wgsl.expected.wgsl deleted file mode 100644 index 78abdd4438..0000000000 --- a/test/tint/builtins/gen/atan2/96057c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn atan2_96057c() { - var res : f32 = atan2(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan2_96057c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan2_96057c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan2_96057c(); -} diff --git a/test/tint/builtins/gen/atan2/a70d0d.wgsl b/test/tint/builtins/gen/atan2/a70d0d.wgsl deleted file mode 100644 index 26af2e66ee..0000000000 --- a/test/tint/builtins/gen/atan2/a70d0d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn atan2(vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn atan2_a70d0d() { - var res: vec3 = atan2(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan2_a70d0d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan2_a70d0d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan2_a70d0d(); -} diff --git a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.glsl b/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.glsl deleted file mode 100644 index dc776ae524..0000000000 --- a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void atan2_a70d0d() { - vec3 res = atan(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - atan2_a70d0d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void atan2_a70d0d() { - vec3 res = atan(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - atan2_a70d0d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void atan2_a70d0d() { - vec3 res = atan(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - atan2_a70d0d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.hlsl b/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.hlsl deleted file mode 100644 index 69320bdb65..0000000000 --- a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void atan2_a70d0d() { - float3 res = atan2(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - atan2_a70d0d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - atan2_a70d0d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atan2_a70d0d(); - return; -} diff --git a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.msl b/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.msl deleted file mode 100644 index 3281d2997f..0000000000 --- a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void atan2_a70d0d() { - float3 res = atan2(float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - atan2_a70d0d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - atan2_a70d0d(); - return; -} - -kernel void compute_main() { - atan2_a70d0d(); - return; -} - diff --git a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.spvasm b/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.spvasm deleted file mode 100644 index 7b9579a927..0000000000 --- a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %atan2_a70d0d "atan2_a70d0d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%atan2_a70d0d = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Atan2 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %atan2_a70d0d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %atan2_a70d0d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %atan2_a70d0d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.wgsl b/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.wgsl deleted file mode 100644 index 9b32967d19..0000000000 --- a/test/tint/builtins/gen/atan2/a70d0d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn atan2_a70d0d() { - var res : vec3 = atan2(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan2_a70d0d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan2_a70d0d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan2_a70d0d(); -} diff --git a/test/tint/builtins/gen/atan2/ae713e.wgsl b/test/tint/builtins/gen/atan2/ae713e.wgsl deleted file mode 100644 index 63a6442c9e..0000000000 --- a/test/tint/builtins/gen/atan2/ae713e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn atan2(vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn atan2_ae713e() { - var res: vec4 = atan2(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan2_ae713e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan2_ae713e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan2_ae713e(); -} diff --git a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.glsl b/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.glsl deleted file mode 100644 index 938d0257f6..0000000000 --- a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void atan2_ae713e() { - vec4 res = atan(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - atan2_ae713e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void atan2_ae713e() { - vec4 res = atan(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - atan2_ae713e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void atan2_ae713e() { - vec4 res = atan(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - atan2_ae713e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.hlsl b/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.hlsl deleted file mode 100644 index d91396df71..0000000000 --- a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void atan2_ae713e() { - float4 res = atan2(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - atan2_ae713e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - atan2_ae713e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atan2_ae713e(); - return; -} diff --git a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.msl b/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.msl deleted file mode 100644 index 58e28ab259..0000000000 --- a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void atan2_ae713e() { - float4 res = atan2(float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - atan2_ae713e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - atan2_ae713e(); - return; -} - -kernel void compute_main() { - atan2_ae713e(); - return; -} - diff --git a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.spvasm b/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.spvasm deleted file mode 100644 index 60b09d46f4..0000000000 --- a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %atan2_ae713e "atan2_ae713e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%atan2_ae713e = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Atan2 %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %atan2_ae713e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %atan2_ae713e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %atan2_ae713e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.wgsl b/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.wgsl deleted file mode 100644 index d765ab46d3..0000000000 --- a/test/tint/builtins/gen/atan2/ae713e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn atan2_ae713e() { - var res : vec4 = atan2(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - atan2_ae713e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - atan2_ae713e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atan2_ae713e(); -} diff --git a/test/tint/builtins/gen/atomicAdd/794055.wgsl b/test/tint/builtins/gen/atomicAdd/794055.wgsl deleted file mode 100644 index 6c60c665b9..0000000000 --- a/test/tint/builtins/gen/atomicAdd/794055.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicAdd(ptr, read_write>, i32) -> i32 -fn atomicAdd_794055() { - var res: i32 = atomicAdd(&arg_0, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAdd_794055(); -} diff --git a/test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.msl b/test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.msl deleted file mode 100644 index 5f8f64d87c..0000000000 --- a/test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { - int res = atomic_fetch_add_explicit(tint_symbol, 1, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicAdd_794055(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.wgsl deleted file mode 100644 index 57290be0b0..0000000000 --- a/test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicAdd_794055() { - var res : i32 = atomicAdd(&(arg_0), 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAdd_794055(); -} diff --git a/test/tint/builtins/gen/atomicAdd/8a199a.wgsl b/test/tint/builtins/gen/atomicAdd/8a199a.wgsl deleted file mode 100644 index af301b7e92..0000000000 --- a/test/tint/builtins/gen/atomicAdd/8a199a.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicAdd(ptr, read_write>, u32) -> u32 -fn atomicAdd_8a199a() { - var res: u32 = atomicAdd(&sb_rw.arg_0, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicAdd_8a199a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAdd_8a199a(); -} diff --git a/test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.hlsl deleted file mode 100644 index 35e6ef35c5..0000000000 --- a/test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicAdd_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedAdd(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicAdd_8a199a() { - uint res = atomicAdd_1(sb_rw, 0u, 1u); -} - -void fragment_main() { - atomicAdd_8a199a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicAdd_8a199a(); - return; -} diff --git a/test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.wgsl deleted file mode 100644 index c97cce1e6b..0000000000 --- a/test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicAdd_8a199a() { - var res : u32 = atomicAdd(&(sb_rw.arg_0), 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicAdd_8a199a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAdd_8a199a(); -} diff --git a/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl b/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl deleted file mode 100644 index 23fd6a4ede..0000000000 --- a/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicAdd(ptr, read_write>, i32) -> i32 -fn atomicAdd_d32fe4() { - var res: i32 = atomicAdd(&sb_rw.arg_0, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicAdd_d32fe4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAdd_d32fe4(); -} diff --git a/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.hlsl deleted file mode 100644 index f87e491c2c..0000000000 --- a/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -int atomicAdd_1(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedAdd(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicAdd_d32fe4() { - int res = atomicAdd_1(sb_rw, 0u, 1); -} - -void fragment_main() { - atomicAdd_d32fe4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicAdd_d32fe4(); - return; -} diff --git a/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.wgsl deleted file mode 100644 index 9eeac04890..0000000000 --- a/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicAdd_d32fe4() { - var res : i32 = atomicAdd(&(sb_rw.arg_0), 1); -} - -@stage(fragment) -fn fragment_main() { - atomicAdd_d32fe4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAdd_d32fe4(); -} diff --git a/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl b/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl deleted file mode 100644 index ba04b1a14a..0000000000 --- a/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicAdd(ptr, read_write>, u32) -> u32 -fn atomicAdd_d5db1d() { - var res: u32 = atomicAdd(&arg_0, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAdd_d5db1d(); -} diff --git a/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.msl b/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.msl deleted file mode 100644 index 5a9aaeee1a..0000000000 --- a/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { - uint res = atomic_fetch_add_explicit(tint_symbol, 1u, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicAdd_d5db1d(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.wgsl deleted file mode 100644 index e7381bbb38..0000000000 --- a/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicAdd_d5db1d() { - var res : u32 = atomicAdd(&(arg_0), 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAdd_d5db1d(); -} diff --git a/test/tint/builtins/gen/atomicAnd/152966.wgsl b/test/tint/builtins/gen/atomicAnd/152966.wgsl deleted file mode 100644 index fa2fee45cd..0000000000 --- a/test/tint/builtins/gen/atomicAnd/152966.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicAnd(ptr, read_write>, i32) -> i32 -fn atomicAnd_152966() { - var res: i32 = atomicAnd(&sb_rw.arg_0, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicAnd_152966(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAnd_152966(); -} diff --git a/test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.hlsl deleted file mode 100644 index fa6c15f837..0000000000 --- a/test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -int atomicAnd_1(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedAnd(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicAnd_152966() { - int res = atomicAnd_1(sb_rw, 0u, 1); -} - -void fragment_main() { - atomicAnd_152966(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicAnd_152966(); - return; -} diff --git a/test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.wgsl deleted file mode 100644 index ec13db7e31..0000000000 --- a/test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicAnd_152966() { - var res : i32 = atomicAnd(&(sb_rw.arg_0), 1); -} - -@stage(fragment) -fn fragment_main() { - atomicAnd_152966(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAnd_152966(); -} diff --git a/test/tint/builtins/gen/atomicAnd/34edd3.wgsl b/test/tint/builtins/gen/atomicAnd/34edd3.wgsl deleted file mode 100644 index 18f2a0cde3..0000000000 --- a/test/tint/builtins/gen/atomicAnd/34edd3.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicAnd(ptr, read_write>, u32) -> u32 -fn atomicAnd_34edd3() { - var res: u32 = atomicAnd(&arg_0, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAnd_34edd3(); -} diff --git a/test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.msl b/test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.msl deleted file mode 100644 index c866b0ef0f..0000000000 --- a/test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicAnd_34edd3(threadgroup atomic_uint* const tint_symbol) { - uint res = atomic_fetch_and_explicit(tint_symbol, 1u, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicAnd_34edd3(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.wgsl deleted file mode 100644 index 89cec48ae6..0000000000 --- a/test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicAnd_34edd3() { - var res : u32 = atomicAnd(&(arg_0), 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAnd_34edd3(); -} diff --git a/test/tint/builtins/gen/atomicAnd/45a819.wgsl b/test/tint/builtins/gen/atomicAnd/45a819.wgsl deleted file mode 100644 index 2eedbaf125..0000000000 --- a/test/tint/builtins/gen/atomicAnd/45a819.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicAnd(ptr, read_write>, i32) -> i32 -fn atomicAnd_45a819() { - var res: i32 = atomicAnd(&arg_0, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAnd_45a819(); -} diff --git a/test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.msl b/test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.msl deleted file mode 100644 index b9f92024de..0000000000 --- a/test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicAnd_45a819(threadgroup atomic_int* const tint_symbol) { - int res = atomic_fetch_and_explicit(tint_symbol, 1, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicAnd_45a819(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.wgsl deleted file mode 100644 index c022cee167..0000000000 --- a/test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicAnd_45a819() { - var res : i32 = atomicAnd(&(arg_0), 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAnd_45a819(); -} diff --git a/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl b/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl deleted file mode 100644 index b4027bd9bc..0000000000 --- a/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicAnd(ptr, read_write>, u32) -> u32 -fn atomicAnd_85a8d9() { - var res: u32 = atomicAnd(&sb_rw.arg_0, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicAnd_85a8d9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAnd_85a8d9(); -} diff --git a/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.hlsl deleted file mode 100644 index 9d4eb2f1a1..0000000000 --- a/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicAnd_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedAnd(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicAnd_85a8d9() { - uint res = atomicAnd_1(sb_rw, 0u, 1u); -} - -void fragment_main() { - atomicAnd_85a8d9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicAnd_85a8d9(); - return; -} diff --git a/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.wgsl deleted file mode 100644 index 3a32a764ef..0000000000 --- a/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicAnd_85a8d9() { - var res : u32 = atomicAnd(&(sb_rw.arg_0), 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicAnd_85a8d9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicAnd_85a8d9(); -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl deleted file mode 100644 index 1f1c2d1e47..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicCompareExchangeWeak(ptr, read_write>, i32, i32) -> vec2 -fn atomicCompareExchangeWeak_12871c() { - var res: vec2 = atomicCompareExchangeWeak(&sb_rw.arg_0, 1, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicCompareExchangeWeak_12871c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicCompareExchangeWeak_12871c(); -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.glsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.glsl deleted file mode 100644 index 6aa8f5a9f7..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.glsl +++ /dev/null @@ -1,76 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -ivec2 tint_atomicCompareExchangeWeak(inout int param_0, int param_1, int param_2) { - ivec2 result; - result.x = atomicCompSwap(param_0, param_1, param_2); - result.y = result.x == param_2 ? 1 : 0; - return result; -} - - -struct SB_RW { - int arg_0; -}; - -layout(binding = 0, std430) buffer SB_RW_1 { - int arg_0; -} sb_rw; -void atomicCompareExchangeWeak_12871c() { - ivec2 res = tint_atomicCompareExchangeWeak(sb_rw.arg_0, 1, 1); -} - -void fragment_main() { - atomicCompareExchangeWeak_12871c(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'atomicCompSwap' : Atomic memory function can only be used for shader storage block member or shared variable. -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -ivec2 tint_atomicCompareExchangeWeak(inout int param_0, int param_1, int param_2) { - ivec2 result; - result.x = atomicCompSwap(param_0, param_1, param_2); - result.y = result.x == param_2 ? 1 : 0; - return result; -} - - -struct SB_RW { - int arg_0; -}; - -layout(binding = 0, std430) buffer SB_RW_1 { - int arg_0; -} sb_rw; -void atomicCompareExchangeWeak_12871c() { - ivec2 res = tint_atomicCompareExchangeWeak(sb_rw.arg_0, 1, 1); -} - -void compute_main() { - atomicCompareExchangeWeak_12871c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'atomicCompSwap' : Atomic memory function can only be used for shader storage block member or shared variable. -ERROR: 0:5: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.hlsl deleted file mode 100644 index 9bd884cb28..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.hlsl +++ /dev/null @@ -1,23 +0,0 @@ -int2 atomicCompareExchangeWeak_1(RWByteAddressBuffer buffer, uint offset, int compare, int value) { - int2 result = {0, 0}; - buffer.InterlockedCompareExchange(offset, compare, value, result.x); - result.y = result.x == compare; - return result; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicCompareExchangeWeak_12871c() { - int2 res = atomicCompareExchangeWeak_1(sb_rw, 0u, 1, 1); -} - -void fragment_main() { - atomicCompareExchangeWeak_12871c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicCompareExchangeWeak_12871c(); - return; -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.msl b/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.msl deleted file mode 100644 index a7bb20c970..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.msl +++ /dev/null @@ -1,29 +0,0 @@ -#include - -using namespace metal; - -template -vec atomicCompareExchangeWeak_1(device A* atomic, T compare, T value) { - T prev_value = compare; - bool matched = atomic_compare_exchange_weak_explicit(atomic, &prev_value, value, memory_order_relaxed, memory_order_relaxed); - return {prev_value, matched}; -} - -struct SB_RW { - /* 0x0000 */ atomic_int arg_0; -}; - -void atomicCompareExchangeWeak_12871c(device SB_RW* const tint_symbol) { - int2 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), 1, 1); -} - -fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { - atomicCompareExchangeWeak_12871c(tint_symbol_1); - return; -} - -kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { - atomicCompareExchangeWeak_12871c(tint_symbol_2); - return; -} - diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.spvasm b/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.spvasm deleted file mode 100644 index f4b46af60c..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.spvasm +++ /dev/null @@ -1,59 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %SB_RW "SB_RW" - OpMemberName %SB_RW 0 "arg_0" - OpName %sb_rw "sb_rw" - OpName %atomicCompareExchangeWeak_12871c "atomicCompareExchangeWeak_12871c" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %SB_RW Block - OpMemberDecorate %SB_RW 0 Offset 0 - OpDecorate %sb_rw DescriptorSet 0 - OpDecorate %sb_rw Binding 0 - %int = OpTypeInt 32 1 - %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer - %void = OpTypeVoid - %5 = OpTypeFunction %void - %v2int = OpTypeVector %int 2 - %uint = OpTypeInt 32 0 - %uint_1 = OpConstant %uint 1 - %uint_0 = OpConstant %uint 0 -%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int - %int_1 = OpConstant %int 1 - %bool = OpTypeBool - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %25 = OpConstantNull %v2int -%atomicCompareExchangeWeak_12871c = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %25 - %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %19 = OpAtomicCompareExchange %int %16 %uint_1 %uint_0 %uint_0 %int_1 %int_1 - %20 = OpIEqual %bool %19 %int_1 - %22 = OpSelect %int %20 %int_1 %int_0 - %9 = OpCompositeConstruct %v2int %19 %22 - OpStore %res %9 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicCompareExchangeWeak_12871c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %atomicCompareExchangeWeak_12871c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.wgsl deleted file mode 100644 index ba2ab03c7e..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/12871c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicCompareExchangeWeak_12871c() { - var res : vec2 = atomicCompareExchangeWeak(&(sb_rw.arg_0), 1, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicCompareExchangeWeak_12871c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicCompareExchangeWeak_12871c(); -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl deleted file mode 100644 index d4473253e9..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicCompareExchangeWeak(ptr, read_write>, u32, u32) -> vec2 -fn atomicCompareExchangeWeak_6673da() { - var res: vec2 = atomicCompareExchangeWeak(&sb_rw.arg_0, 1u, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicCompareExchangeWeak_6673da(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicCompareExchangeWeak_6673da(); -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.glsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.glsl deleted file mode 100644 index 65d12ed736..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.glsl +++ /dev/null @@ -1,76 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uvec2 tint_atomicCompareExchangeWeak(inout uint param_0, uint param_1, uint param_2) { - uvec2 result; - result.x = atomicCompSwap(param_0, param_1, param_2); - result.y = result.x == param_2 ? 1u : 0u; - return result; -} - - -struct SB_RW { - uint arg_0; -}; - -layout(binding = 0, std430) buffer SB_RW_1 { - uint arg_0; -} sb_rw; -void atomicCompareExchangeWeak_6673da() { - uvec2 res = tint_atomicCompareExchangeWeak(sb_rw.arg_0, 1u, 1u); -} - -void fragment_main() { - atomicCompareExchangeWeak_6673da(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'atomicCompSwap' : Atomic memory function can only be used for shader storage block member or shared variable. -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uvec2 tint_atomicCompareExchangeWeak(inout uint param_0, uint param_1, uint param_2) { - uvec2 result; - result.x = atomicCompSwap(param_0, param_1, param_2); - result.y = result.x == param_2 ? 1u : 0u; - return result; -} - - -struct SB_RW { - uint arg_0; -}; - -layout(binding = 0, std430) buffer SB_RW_1 { - uint arg_0; -} sb_rw; -void atomicCompareExchangeWeak_6673da() { - uvec2 res = tint_atomicCompareExchangeWeak(sb_rw.arg_0, 1u, 1u); -} - -void compute_main() { - atomicCompareExchangeWeak_6673da(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'atomicCompSwap' : Atomic memory function can only be used for shader storage block member or shared variable. -ERROR: 0:5: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.hlsl deleted file mode 100644 index 430f1323cb..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.hlsl +++ /dev/null @@ -1,23 +0,0 @@ -uint2 atomicCompareExchangeWeak_1(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { - uint2 result = {0, 0}; - buffer.InterlockedCompareExchange(offset, compare, value, result.x); - result.y = result.x == compare; - return result; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicCompareExchangeWeak_6673da() { - uint2 res = atomicCompareExchangeWeak_1(sb_rw, 0u, 1u, 1u); -} - -void fragment_main() { - atomicCompareExchangeWeak_6673da(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicCompareExchangeWeak_6673da(); - return; -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.msl b/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.msl deleted file mode 100644 index b3a827f788..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.msl +++ /dev/null @@ -1,29 +0,0 @@ -#include - -using namespace metal; - -template -vec atomicCompareExchangeWeak_1(device A* atomic, T compare, T value) { - T prev_value = compare; - bool matched = atomic_compare_exchange_weak_explicit(atomic, &prev_value, value, memory_order_relaxed, memory_order_relaxed); - return {prev_value, matched}; -} - -struct SB_RW { - /* 0x0000 */ atomic_uint arg_0; -}; - -void atomicCompareExchangeWeak_6673da(device SB_RW* const tint_symbol) { - uint2 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), 1u, 1u); -} - -fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { - atomicCompareExchangeWeak_6673da(tint_symbol_1); - return; -} - -kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { - atomicCompareExchangeWeak_6673da(tint_symbol_2); - return; -} - diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.spvasm b/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.spvasm deleted file mode 100644 index 7edaed7b1f..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.spvasm +++ /dev/null @@ -1,56 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 29 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %SB_RW "SB_RW" - OpMemberName %SB_RW 0 "arg_0" - OpName %sb_rw "sb_rw" - OpName %atomicCompareExchangeWeak_6673da "atomicCompareExchangeWeak_6673da" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %SB_RW Block - OpMemberDecorate %SB_RW 0 Offset 0 - OpDecorate %sb_rw DescriptorSet 0 - OpDecorate %sb_rw Binding 0 - %uint = OpTypeInt 32 0 - %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer - %void = OpTypeVoid - %5 = OpTypeFunction %void - %v2uint = OpTypeVector %uint 2 - %uint_1 = OpConstant %uint 1 - %uint_0 = OpConstant %uint 0 -%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %bool = OpTypeBool -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %22 = OpConstantNull %v2uint -%atomicCompareExchangeWeak_6673da = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %22 - %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %17 = OpAtomicCompareExchange %uint %15 %uint_1 %uint_0 %uint_0 %uint_1 %uint_1 - %18 = OpIEqual %bool %17 %uint_1 - %19 = OpSelect %uint %18 %uint_1 %uint_0 - %9 = OpCompositeConstruct %v2uint %17 %19 - OpStore %res %9 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicCompareExchangeWeak_6673da - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicCompareExchangeWeak_6673da - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.wgsl deleted file mode 100644 index dff8dcad30..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/6673da.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicCompareExchangeWeak_6673da() { - var res : vec2 = atomicCompareExchangeWeak(&(sb_rw.arg_0), 1u, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicCompareExchangeWeak_6673da(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicCompareExchangeWeak_6673da(); -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl deleted file mode 100644 index c81fc384cd..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicCompareExchangeWeak(ptr, read_write>, i32, i32) -> vec2 -fn atomicCompareExchangeWeak_89ea3b() { - var res: vec2 = atomicCompareExchangeWeak(&arg_0, 1, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicCompareExchangeWeak_89ea3b(); -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.glsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.glsl deleted file mode 100644 index 2f649cd762..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.glsl +++ /dev/null @@ -1,37 +0,0 @@ -SKIP: FAILED - -#version 310 es - -ivec2 tint_atomicCompareExchangeWeak(inout int param_0, int param_1, int param_2) { - ivec2 result; - result.x = atomicCompSwap(param_0, param_1, param_2); - result.y = result.x == param_2 ? 1 : 0; - return result; -} - - -shared int arg_0; -void atomicCompareExchangeWeak_89ea3b() { - ivec2 res = tint_atomicCompareExchangeWeak(arg_0, 1, 1); -} - -void compute_main(uint local_invocation_index) { - { - atomicExchange(arg_0, 0); - } - barrier(); - atomicCompareExchangeWeak_89ea3b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(gl_LocalInvocationIndex); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'atomicCompSwap' : Atomic memory function can only be used for shader storage block member or shared variable. -ERROR: 0:5: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.hlsl deleted file mode 100644 index 97cc6c4c1e..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.hlsl +++ /dev/null @@ -1,28 +0,0 @@ -groupshared int arg_0; - -void atomicCompareExchangeWeak_89ea3b() { - int2 atomic_result = int2(0, 0); - int atomic_compare_value = 1; - InterlockedCompareExchange(arg_0, atomic_compare_value, 1, atomic_result.x); - atomic_result.y = atomic_result.x == atomic_compare_value; - int2 res = atomic_result; -} - -struct tint_symbol_1 { - uint local_invocation_index : SV_GroupIndex; -}; - -void compute_main_inner(uint local_invocation_index) { - { - int atomic_result_1 = 0; - InterlockedExchange(arg_0, 0, atomic_result_1); - } - GroupMemoryBarrierWithGroupSync(); - atomicCompareExchangeWeak_89ea3b(); -} - -[numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner(tint_symbol.local_invocation_index); - return; -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.msl b/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.msl deleted file mode 100644 index b002e501d4..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.msl +++ /dev/null @@ -1,29 +0,0 @@ -#include - -using namespace metal; - -template -vec atomicCompareExchangeWeak_1(threadgroup A* atomic, T compare, T value) { - T prev_value = compare; - bool matched = atomic_compare_exchange_weak_explicit(atomic, &prev_value, value, memory_order_relaxed, memory_order_relaxed); - return {prev_value, matched}; -} - -void atomicCompareExchangeWeak_89ea3b(threadgroup atomic_int* const tint_symbol) { - int2 res = atomicCompareExchangeWeak_1(tint_symbol, 1, 1); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicCompareExchangeWeak_89ea3b(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.spvasm b/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.spvasm deleted file mode 100644 index 40f727b99d..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.spvasm +++ /dev/null @@ -1,60 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 39 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %local_invocation_index_1 "local_invocation_index_1" - OpName %arg_0 "arg_0" - OpName %atomicCompareExchangeWeak_89ea3b "atomicCompareExchangeWeak_89ea3b" - OpName %res "res" - OpName %compute_main_inner "compute_main_inner" - OpName %local_invocation_index "local_invocation_index" - OpName %compute_main "compute_main" - OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex - %uint = OpTypeInt 32 0 -%_ptr_Input_uint = OpTypePointer Input %uint -%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input - %int = OpTypeInt 32 1 -%_ptr_Workgroup_int = OpTypePointer Workgroup %int - %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup - %void = OpTypeVoid - %7 = OpTypeFunction %void - %v2int = OpTypeVector %int 2 - %uint_2 = OpConstant %uint 2 - %uint_0 = OpConstant %uint 0 - %int_1 = OpConstant %int 1 - %bool = OpTypeBool - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %24 = OpConstantNull %v2int - %25 = OpTypeFunction %void %uint - %31 = OpConstantNull %int - %uint_264 = OpConstant %uint 264 -%atomicCompareExchangeWeak_89ea3b = OpFunction %void None %7 - %10 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %24 - %18 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %int_1 %int_1 - %19 = OpIEqual %bool %18 %int_1 - %21 = OpSelect %int %19 %int_1 %int_0 - %11 = OpCompositeConstruct %v2int %18 %21 - OpStore %res %11 - OpReturn - OpFunctionEnd -%compute_main_inner = OpFunction %void None %25 -%local_invocation_index = OpFunctionParameter %uint - %28 = OpLabel - OpAtomicStore %arg_0 %uint_2 %uint_0 %31 - OpControlBarrier %uint_2 %uint_2 %uint_264 - %34 = OpFunctionCall %void %atomicCompareExchangeWeak_89ea3b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %7 - %36 = OpLabel - %38 = OpLoad %uint %local_invocation_index_1 - %37 = OpFunctionCall %void %compute_main_inner %38 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.wgsl deleted file mode 100644 index 4357511711..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/89ea3b.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicCompareExchangeWeak_89ea3b() { - var res : vec2 = atomicCompareExchangeWeak(&(arg_0), 1, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicCompareExchangeWeak_89ea3b(); -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl deleted file mode 100644 index d75b725e85..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicCompareExchangeWeak(ptr, read_write>, u32, u32) -> vec2 -fn atomicCompareExchangeWeak_b2ab2c() { - var res: vec2 = atomicCompareExchangeWeak(&arg_0, 1u, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicCompareExchangeWeak_b2ab2c(); -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.glsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.glsl deleted file mode 100644 index cbb201a116..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.glsl +++ /dev/null @@ -1,37 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uvec2 tint_atomicCompareExchangeWeak(inout uint param_0, uint param_1, uint param_2) { - uvec2 result; - result.x = atomicCompSwap(param_0, param_1, param_2); - result.y = result.x == param_2 ? 1u : 0u; - return result; -} - - -shared uint arg_0; -void atomicCompareExchangeWeak_b2ab2c() { - uvec2 res = tint_atomicCompareExchangeWeak(arg_0, 1u, 1u); -} - -void compute_main(uint local_invocation_index) { - { - atomicExchange(arg_0, 0u); - } - barrier(); - atomicCompareExchangeWeak_b2ab2c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(gl_LocalInvocationIndex); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'atomicCompSwap' : Atomic memory function can only be used for shader storage block member or shared variable. -ERROR: 0:5: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.hlsl deleted file mode 100644 index 05cfbc2e74..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.hlsl +++ /dev/null @@ -1,28 +0,0 @@ -groupshared uint arg_0; - -void atomicCompareExchangeWeak_b2ab2c() { - uint2 atomic_result = uint2(0u, 0u); - uint atomic_compare_value = 1u; - InterlockedCompareExchange(arg_0, atomic_compare_value, 1u, atomic_result.x); - atomic_result.y = atomic_result.x == atomic_compare_value; - uint2 res = atomic_result; -} - -struct tint_symbol_1 { - uint local_invocation_index : SV_GroupIndex; -}; - -void compute_main_inner(uint local_invocation_index) { - { - uint atomic_result_1 = 0u; - InterlockedExchange(arg_0, 0u, atomic_result_1); - } - GroupMemoryBarrierWithGroupSync(); - atomicCompareExchangeWeak_b2ab2c(); -} - -[numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner(tint_symbol.local_invocation_index); - return; -} diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.msl b/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.msl deleted file mode 100644 index 6a9485892d..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.msl +++ /dev/null @@ -1,29 +0,0 @@ -#include - -using namespace metal; - -template -vec atomicCompareExchangeWeak_1(threadgroup A* atomic, T compare, T value) { - T prev_value = compare; - bool matched = atomic_compare_exchange_weak_explicit(atomic, &prev_value, value, memory_order_relaxed, memory_order_relaxed); - return {prev_value, matched}; -} - -void atomicCompareExchangeWeak_b2ab2c(threadgroup atomic_uint* const tint_symbol) { - uint2 res = atomicCompareExchangeWeak_1(tint_symbol, 1u, 1u); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicCompareExchangeWeak_b2ab2c(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.spvasm b/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.spvasm deleted file mode 100644 index 6098500d00..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.spvasm +++ /dev/null @@ -1,58 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 37 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %local_invocation_index_1 "local_invocation_index_1" - OpName %arg_0 "arg_0" - OpName %atomicCompareExchangeWeak_b2ab2c "atomicCompareExchangeWeak_b2ab2c" - OpName %res "res" - OpName %compute_main_inner "compute_main_inner" - OpName %local_invocation_index "local_invocation_index" - OpName %compute_main "compute_main" - OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex - %uint = OpTypeInt 32 0 -%_ptr_Input_uint = OpTypePointer Input %uint -%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input -%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint - %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup - %void = OpTypeVoid - %6 = OpTypeFunction %void - %v2uint = OpTypeVector %uint 2 - %uint_2 = OpConstant %uint 2 - %uint_0 = OpConstant %uint 0 - %uint_1 = OpConstant %uint 1 - %bool = OpTypeBool -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %22 = OpConstantNull %v2uint - %23 = OpTypeFunction %void %uint - %29 = OpConstantNull %uint - %uint_264 = OpConstant %uint 264 -%atomicCompareExchangeWeak_b2ab2c = OpFunction %void None %6 - %9 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %22 - %17 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %uint_1 %uint_1 - %18 = OpIEqual %bool %17 %uint_1 - %19 = OpSelect %uint %18 %uint_1 %uint_0 - %10 = OpCompositeConstruct %v2uint %17 %19 - OpStore %res %10 - OpReturn - OpFunctionEnd -%compute_main_inner = OpFunction %void None %23 -%local_invocation_index = OpFunctionParameter %uint - %26 = OpLabel - OpAtomicStore %arg_0 %uint_2 %uint_0 %29 - OpControlBarrier %uint_2 %uint_2 %uint_264 - %32 = OpFunctionCall %void %atomicCompareExchangeWeak_b2ab2c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %6 - %34 = OpLabel - %36 = OpLoad %uint %local_invocation_index_1 - %35 = OpFunctionCall %void %compute_main_inner %36 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.wgsl deleted file mode 100644 index d53e099785..0000000000 --- a/test/tint/builtins/gen/atomicCompareExchangeWeak/b2ab2c.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicCompareExchangeWeak_b2ab2c() { - var res : vec2 = atomicCompareExchangeWeak(&(arg_0), 1u, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicCompareExchangeWeak_b2ab2c(); -} diff --git a/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl b/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl deleted file mode 100644 index 092c5ac3b2..0000000000 --- a/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicExchange(ptr, read_write>, u32) -> u32 -fn atomicExchange_0a5dca() { - var res: u32 = atomicExchange(&arg_0, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicExchange_0a5dca(); -} diff --git a/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.msl b/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.msl deleted file mode 100644 index 23e312119c..0000000000 --- a/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicExchange_0a5dca(threadgroup atomic_uint* const tint_symbol) { - uint res = atomic_exchange_explicit(tint_symbol, 1u, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicExchange_0a5dca(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.wgsl deleted file mode 100644 index a7acabddb6..0000000000 --- a/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicExchange_0a5dca() { - var res : u32 = atomicExchange(&(arg_0), 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicExchange_0a5dca(); -} diff --git a/test/tint/builtins/gen/atomicExchange/d59712.wgsl b/test/tint/builtins/gen/atomicExchange/d59712.wgsl deleted file mode 100644 index 2aa8b8b58f..0000000000 --- a/test/tint/builtins/gen/atomicExchange/d59712.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicExchange(ptr, read_write>, u32) -> u32 -fn atomicExchange_d59712() { - var res: u32 = atomicExchange(&sb_rw.arg_0, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicExchange_d59712(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicExchange_d59712(); -} diff --git a/test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.hlsl deleted file mode 100644 index 506c6fee25..0000000000 --- a/test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicExchange_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedExchange(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicExchange_d59712() { - uint res = atomicExchange_1(sb_rw, 0u, 1u); -} - -void fragment_main() { - atomicExchange_d59712(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicExchange_d59712(); - return; -} diff --git a/test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.wgsl deleted file mode 100644 index 2e72015368..0000000000 --- a/test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicExchange_d59712() { - var res : u32 = atomicExchange(&(sb_rw.arg_0), 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicExchange_d59712(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicExchange_d59712(); -} diff --git a/test/tint/builtins/gen/atomicExchange/e114ba.wgsl b/test/tint/builtins/gen/atomicExchange/e114ba.wgsl deleted file mode 100644 index 3fc0b8f7a8..0000000000 --- a/test/tint/builtins/gen/atomicExchange/e114ba.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicExchange(ptr, read_write>, i32) -> i32 -fn atomicExchange_e114ba() { - var res: i32 = atomicExchange(&arg_0, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicExchange_e114ba(); -} diff --git a/test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.msl b/test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.msl deleted file mode 100644 index abcec161c3..0000000000 --- a/test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicExchange_e114ba(threadgroup atomic_int* const tint_symbol) { - int res = atomic_exchange_explicit(tint_symbol, 1, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicExchange_e114ba(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.wgsl deleted file mode 100644 index 9735838939..0000000000 --- a/test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicExchange_e114ba() { - var res : i32 = atomicExchange(&(arg_0), 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicExchange_e114ba(); -} diff --git a/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl b/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl deleted file mode 100644 index 566f56382b..0000000000 --- a/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicExchange(ptr, read_write>, i32) -> i32 -fn atomicExchange_f2e22f() { - var res: i32 = atomicExchange(&sb_rw.arg_0, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicExchange_f2e22f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicExchange_f2e22f(); -} diff --git a/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.hlsl deleted file mode 100644 index 1ab0d6cf4d..0000000000 --- a/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -int atomicExchange_1(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedExchange(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicExchange_f2e22f() { - int res = atomicExchange_1(sb_rw, 0u, 1); -} - -void fragment_main() { - atomicExchange_f2e22f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicExchange_f2e22f(); - return; -} diff --git a/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.wgsl deleted file mode 100644 index 5405f25dac..0000000000 --- a/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicExchange_f2e22f() { - var res : i32 = atomicExchange(&(sb_rw.arg_0), 1); -} - -@stage(fragment) -fn fragment_main() { - atomicExchange_f2e22f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicExchange_f2e22f(); -} diff --git a/test/tint/builtins/gen/atomicLoad/0806ad.wgsl b/test/tint/builtins/gen/atomicLoad/0806ad.wgsl deleted file mode 100644 index 9fc9f60996..0000000000 --- a/test/tint/builtins/gen/atomicLoad/0806ad.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicLoad(ptr, read_write>) -> i32 -fn atomicLoad_0806ad() { - var res: i32 = atomicLoad(&sb_rw.arg_0); -} - -@stage(fragment) -fn fragment_main() { - atomicLoad_0806ad(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicLoad_0806ad(); -} diff --git a/test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.hlsl deleted file mode 100644 index 8c58350d1c..0000000000 --- a/test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -int atomicLoad_1(RWByteAddressBuffer buffer, uint offset) { - int value = 0; - buffer.InterlockedOr(offset, 0, value); - return value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicLoad_0806ad() { - int res = atomicLoad_1(sb_rw, 0u); -} - -void fragment_main() { - atomicLoad_0806ad(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicLoad_0806ad(); - return; -} diff --git a/test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.wgsl deleted file mode 100644 index e761dd984f..0000000000 --- a/test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicLoad_0806ad() { - var res : i32 = atomicLoad(&(sb_rw.arg_0)); -} - -@stage(fragment) -fn fragment_main() { - atomicLoad_0806ad(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicLoad_0806ad(); -} diff --git a/test/tint/builtins/gen/atomicLoad/361bf1.wgsl b/test/tint/builtins/gen/atomicLoad/361bf1.wgsl deleted file mode 100644 index 99e9c04932..0000000000 --- a/test/tint/builtins/gen/atomicLoad/361bf1.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicLoad(ptr, read_write>) -> u32 -fn atomicLoad_361bf1() { - var res: u32 = atomicLoad(&arg_0); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicLoad_361bf1(); -} diff --git a/test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.msl b/test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.msl deleted file mode 100644 index 327dc2ad92..0000000000 --- a/test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicLoad_361bf1(threadgroup atomic_uint* const tint_symbol) { - uint res = atomic_load_explicit(tint_symbol, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicLoad_361bf1(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.wgsl deleted file mode 100644 index 1040bf29af..0000000000 --- a/test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicLoad_361bf1() { - var res : u32 = atomicLoad(&(arg_0)); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicLoad_361bf1(); -} diff --git a/test/tint/builtins/gen/atomicLoad/afcc03.wgsl b/test/tint/builtins/gen/atomicLoad/afcc03.wgsl deleted file mode 100644 index 935ab5fe45..0000000000 --- a/test/tint/builtins/gen/atomicLoad/afcc03.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicLoad(ptr, read_write>) -> i32 -fn atomicLoad_afcc03() { - var res: i32 = atomicLoad(&arg_0); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicLoad_afcc03(); -} diff --git a/test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.msl b/test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.msl deleted file mode 100644 index b3948d3f40..0000000000 --- a/test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicLoad_afcc03(threadgroup atomic_int* const tint_symbol) { - int res = atomic_load_explicit(tint_symbol, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicLoad_afcc03(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.wgsl deleted file mode 100644 index e39317dde8..0000000000 --- a/test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicLoad_afcc03() { - var res : i32 = atomicLoad(&(arg_0)); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicLoad_afcc03(); -} diff --git a/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl b/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl deleted file mode 100644 index e1e256a20d..0000000000 --- a/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicLoad(ptr, read_write>) -> u32 -fn atomicLoad_fe6cc3() { - var res: u32 = atomicLoad(&sb_rw.arg_0); -} - -@stage(fragment) -fn fragment_main() { - atomicLoad_fe6cc3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicLoad_fe6cc3(); -} diff --git a/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.hlsl deleted file mode 100644 index 967d4c0cad..0000000000 --- a/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicLoad_1(RWByteAddressBuffer buffer, uint offset) { - uint value = 0; - buffer.InterlockedOr(offset, 0, value); - return value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicLoad_fe6cc3() { - uint res = atomicLoad_1(sb_rw, 0u); -} - -void fragment_main() { - atomicLoad_fe6cc3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicLoad_fe6cc3(); - return; -} diff --git a/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.wgsl deleted file mode 100644 index f811ee370e..0000000000 --- a/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicLoad_fe6cc3() { - var res : u32 = atomicLoad(&(sb_rw.arg_0)); -} - -@stage(fragment) -fn fragment_main() { - atomicLoad_fe6cc3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicLoad_fe6cc3(); -} diff --git a/test/tint/builtins/gen/atomicMax/51b9be.wgsl b/test/tint/builtins/gen/atomicMax/51b9be.wgsl deleted file mode 100644 index 43a6f6cd99..0000000000 --- a/test/tint/builtins/gen/atomicMax/51b9be.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicMax(ptr, read_write>, u32) -> u32 -fn atomicMax_51b9be() { - var res: u32 = atomicMax(&sb_rw.arg_0, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicMax_51b9be(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMax_51b9be(); -} diff --git a/test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.hlsl deleted file mode 100644 index 621944f603..0000000000 --- a/test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicMax_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedMax(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicMax_51b9be() { - uint res = atomicMax_1(sb_rw, 0u, 1u); -} - -void fragment_main() { - atomicMax_51b9be(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicMax_51b9be(); - return; -} diff --git a/test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.wgsl deleted file mode 100644 index ec37f3998c..0000000000 --- a/test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicMax_51b9be() { - var res : u32 = atomicMax(&(sb_rw.arg_0), 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicMax_51b9be(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMax_51b9be(); -} diff --git a/test/tint/builtins/gen/atomicMax/92aa72.wgsl b/test/tint/builtins/gen/atomicMax/92aa72.wgsl deleted file mode 100644 index 7336d647fc..0000000000 --- a/test/tint/builtins/gen/atomicMax/92aa72.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicMax(ptr, read_write>, i32) -> i32 -fn atomicMax_92aa72() { - var res: i32 = atomicMax(&sb_rw.arg_0, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicMax_92aa72(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMax_92aa72(); -} diff --git a/test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.hlsl deleted file mode 100644 index 4ac6cd8f3c..0000000000 --- a/test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -int atomicMax_1(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedMax(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicMax_92aa72() { - int res = atomicMax_1(sb_rw, 0u, 1); -} - -void fragment_main() { - atomicMax_92aa72(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicMax_92aa72(); - return; -} diff --git a/test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.wgsl deleted file mode 100644 index 24dcfcca5e..0000000000 --- a/test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicMax_92aa72() { - var res : i32 = atomicMax(&(sb_rw.arg_0), 1); -} - -@stage(fragment) -fn fragment_main() { - atomicMax_92aa72(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMax_92aa72(); -} diff --git a/test/tint/builtins/gen/atomicMax/a89cc3.wgsl b/test/tint/builtins/gen/atomicMax/a89cc3.wgsl deleted file mode 100644 index beea1a7e35..0000000000 --- a/test/tint/builtins/gen/atomicMax/a89cc3.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicMax(ptr, read_write>, i32) -> i32 -fn atomicMax_a89cc3() { - var res: i32 = atomicMax(&arg_0, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMax_a89cc3(); -} diff --git a/test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.msl b/test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.msl deleted file mode 100644 index fbe1f22096..0000000000 --- a/test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicMax_a89cc3(threadgroup atomic_int* const tint_symbol) { - int res = atomic_fetch_max_explicit(tint_symbol, 1, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicMax_a89cc3(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.wgsl deleted file mode 100644 index d36703ef14..0000000000 --- a/test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicMax_a89cc3() { - var res : i32 = atomicMax(&(arg_0), 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMax_a89cc3(); -} diff --git a/test/tint/builtins/gen/atomicMax/beccfc.wgsl b/test/tint/builtins/gen/atomicMax/beccfc.wgsl deleted file mode 100644 index 452b30788c..0000000000 --- a/test/tint/builtins/gen/atomicMax/beccfc.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicMax(ptr, read_write>, u32) -> u32 -fn atomicMax_beccfc() { - var res: u32 = atomicMax(&arg_0, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMax_beccfc(); -} diff --git a/test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.msl b/test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.msl deleted file mode 100644 index 5edad1c6bf..0000000000 --- a/test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicMax_beccfc(threadgroup atomic_uint* const tint_symbol) { - uint res = atomic_fetch_max_explicit(tint_symbol, 1u, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicMax_beccfc(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.wgsl deleted file mode 100644 index f14f91a088..0000000000 --- a/test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicMax_beccfc() { - var res : u32 = atomicMax(&(arg_0), 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMax_beccfc(); -} diff --git a/test/tint/builtins/gen/atomicMin/278235.wgsl b/test/tint/builtins/gen/atomicMin/278235.wgsl deleted file mode 100644 index ff8a7cf72c..0000000000 --- a/test/tint/builtins/gen/atomicMin/278235.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicMin(ptr, read_write>, i32) -> i32 -fn atomicMin_278235() { - var res: i32 = atomicMin(&arg_0, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMin_278235(); -} diff --git a/test/tint/builtins/gen/atomicMin/278235.wgsl.expected.msl b/test/tint/builtins/gen/atomicMin/278235.wgsl.expected.msl deleted file mode 100644 index 3b359fca64..0000000000 --- a/test/tint/builtins/gen/atomicMin/278235.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicMin_278235(threadgroup atomic_int* const tint_symbol) { - int res = atomic_fetch_min_explicit(tint_symbol, 1, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicMin_278235(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicMin/278235.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicMin/278235.wgsl.expected.wgsl deleted file mode 100644 index 981a7b328d..0000000000 --- a/test/tint/builtins/gen/atomicMin/278235.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicMin_278235() { - var res : i32 = atomicMin(&(arg_0), 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMin_278235(); -} diff --git a/test/tint/builtins/gen/atomicMin/69d383.wgsl b/test/tint/builtins/gen/atomicMin/69d383.wgsl deleted file mode 100644 index f4f70b13b3..0000000000 --- a/test/tint/builtins/gen/atomicMin/69d383.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicMin(ptr, read_write>, u32) -> u32 -fn atomicMin_69d383() { - var res: u32 = atomicMin(&arg_0, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMin_69d383(); -} diff --git a/test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.msl b/test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.msl deleted file mode 100644 index 9c1e70e877..0000000000 --- a/test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicMin_69d383(threadgroup atomic_uint* const tint_symbol) { - uint res = atomic_fetch_min_explicit(tint_symbol, 1u, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicMin_69d383(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.wgsl deleted file mode 100644 index 034d1afc73..0000000000 --- a/test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicMin_69d383() { - var res : u32 = atomicMin(&(arg_0), 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMin_69d383(); -} diff --git a/test/tint/builtins/gen/atomicMin/8e38dc.wgsl b/test/tint/builtins/gen/atomicMin/8e38dc.wgsl deleted file mode 100644 index 484f709f43..0000000000 --- a/test/tint/builtins/gen/atomicMin/8e38dc.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicMin(ptr, read_write>, i32) -> i32 -fn atomicMin_8e38dc() { - var res: i32 = atomicMin(&sb_rw.arg_0, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicMin_8e38dc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMin_8e38dc(); -} diff --git a/test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.hlsl deleted file mode 100644 index 5c550171a3..0000000000 --- a/test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -int atomicMin_1(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedMin(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicMin_8e38dc() { - int res = atomicMin_1(sb_rw, 0u, 1); -} - -void fragment_main() { - atomicMin_8e38dc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicMin_8e38dc(); - return; -} diff --git a/test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.wgsl deleted file mode 100644 index bd66a39c2c..0000000000 --- a/test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicMin_8e38dc() { - var res : i32 = atomicMin(&(sb_rw.arg_0), 1); -} - -@stage(fragment) -fn fragment_main() { - atomicMin_8e38dc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMin_8e38dc(); -} diff --git a/test/tint/builtins/gen/atomicMin/c67a74.wgsl b/test/tint/builtins/gen/atomicMin/c67a74.wgsl deleted file mode 100644 index cf8986bdf7..0000000000 --- a/test/tint/builtins/gen/atomicMin/c67a74.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicMin(ptr, read_write>, u32) -> u32 -fn atomicMin_c67a74() { - var res: u32 = atomicMin(&sb_rw.arg_0, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicMin_c67a74(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMin_c67a74(); -} diff --git a/test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.hlsl deleted file mode 100644 index 4b350c308f..0000000000 --- a/test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicMin_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedMin(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicMin_c67a74() { - uint res = atomicMin_1(sb_rw, 0u, 1u); -} - -void fragment_main() { - atomicMin_c67a74(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicMin_c67a74(); - return; -} diff --git a/test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.wgsl deleted file mode 100644 index 96d7c2a19f..0000000000 --- a/test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicMin_c67a74() { - var res : u32 = atomicMin(&(sb_rw.arg_0), 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicMin_c67a74(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicMin_c67a74(); -} diff --git a/test/tint/builtins/gen/atomicOr/5e3d61.wgsl b/test/tint/builtins/gen/atomicOr/5e3d61.wgsl deleted file mode 100644 index 9520869ea0..0000000000 --- a/test/tint/builtins/gen/atomicOr/5e3d61.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicOr(ptr, read_write>, u32) -> u32 -fn atomicOr_5e3d61() { - var res: u32 = atomicOr(&arg_0, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicOr_5e3d61(); -} diff --git a/test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.msl b/test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.msl deleted file mode 100644 index 9aea6427bc..0000000000 --- a/test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicOr_5e3d61(threadgroup atomic_uint* const tint_symbol) { - uint res = atomic_fetch_or_explicit(tint_symbol, 1u, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicOr_5e3d61(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.wgsl deleted file mode 100644 index 00f3e66171..0000000000 --- a/test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicOr_5e3d61() { - var res : u32 = atomicOr(&(arg_0), 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicOr_5e3d61(); -} diff --git a/test/tint/builtins/gen/atomicOr/5e95d4.wgsl b/test/tint/builtins/gen/atomicOr/5e95d4.wgsl deleted file mode 100644 index d35f50242f..0000000000 --- a/test/tint/builtins/gen/atomicOr/5e95d4.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicOr(ptr, read_write>, u32) -> u32 -fn atomicOr_5e95d4() { - var res: u32 = atomicOr(&sb_rw.arg_0, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicOr_5e95d4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicOr_5e95d4(); -} diff --git a/test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.hlsl deleted file mode 100644 index 21059e60ee..0000000000 --- a/test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicOr_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedOr(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicOr_5e95d4() { - uint res = atomicOr_1(sb_rw, 0u, 1u); -} - -void fragment_main() { - atomicOr_5e95d4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicOr_5e95d4(); - return; -} diff --git a/test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.wgsl deleted file mode 100644 index 1d8867ecf4..0000000000 --- a/test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicOr_5e95d4() { - var res : u32 = atomicOr(&(sb_rw.arg_0), 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicOr_5e95d4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicOr_5e95d4(); -} diff --git a/test/tint/builtins/gen/atomicOr/8d96a0.wgsl b/test/tint/builtins/gen/atomicOr/8d96a0.wgsl deleted file mode 100644 index 901470f1b8..0000000000 --- a/test/tint/builtins/gen/atomicOr/8d96a0.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicOr(ptr, read_write>, i32) -> i32 -fn atomicOr_8d96a0() { - var res: i32 = atomicOr(&sb_rw.arg_0, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicOr_8d96a0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicOr_8d96a0(); -} diff --git a/test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.hlsl deleted file mode 100644 index 1504decac9..0000000000 --- a/test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -int atomicOr_1(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedOr(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicOr_8d96a0() { - int res = atomicOr_1(sb_rw, 0u, 1); -} - -void fragment_main() { - atomicOr_8d96a0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicOr_8d96a0(); - return; -} diff --git a/test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.wgsl deleted file mode 100644 index c9b16048d2..0000000000 --- a/test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicOr_8d96a0() { - var res : i32 = atomicOr(&(sb_rw.arg_0), 1); -} - -@stage(fragment) -fn fragment_main() { - atomicOr_8d96a0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicOr_8d96a0(); -} diff --git a/test/tint/builtins/gen/atomicOr/d09248.wgsl b/test/tint/builtins/gen/atomicOr/d09248.wgsl deleted file mode 100644 index da2bd7981e..0000000000 --- a/test/tint/builtins/gen/atomicOr/d09248.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicOr(ptr, read_write>, i32) -> i32 -fn atomicOr_d09248() { - var res: i32 = atomicOr(&arg_0, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicOr_d09248(); -} diff --git a/test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.msl b/test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.msl deleted file mode 100644 index 6a0d77dd80..0000000000 --- a/test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicOr_d09248(threadgroup atomic_int* const tint_symbol) { - int res = atomic_fetch_or_explicit(tint_symbol, 1, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicOr_d09248(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.wgsl deleted file mode 100644 index c28f1c7dbc..0000000000 --- a/test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicOr_d09248() { - var res : i32 = atomicOr(&(arg_0), 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicOr_d09248(); -} diff --git a/test/tint/builtins/gen/atomicStore/726882.wgsl b/test/tint/builtins/gen/atomicStore/726882.wgsl deleted file mode 100644 index 4ee9d6f2f8..0000000000 --- a/test/tint/builtins/gen/atomicStore/726882.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicStore(ptr, read_write>, u32) -fn atomicStore_726882() { - atomicStore(&arg_0, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicStore_726882(); -} diff --git a/test/tint/builtins/gen/atomicStore/726882.wgsl.expected.msl b/test/tint/builtins/gen/atomicStore/726882.wgsl.expected.msl deleted file mode 100644 index 665c40cdde..0000000000 --- a/test/tint/builtins/gen/atomicStore/726882.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicStore_726882(threadgroup atomic_uint* const tint_symbol) { - atomic_store_explicit(tint_symbol, 1u, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicStore_726882(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicStore/726882.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicStore/726882.wgsl.expected.wgsl deleted file mode 100644 index d81b71e4e6..0000000000 --- a/test/tint/builtins/gen/atomicStore/726882.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicStore_726882() { - atomicStore(&(arg_0), 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicStore_726882(); -} diff --git a/test/tint/builtins/gen/atomicStore/8bea94.wgsl b/test/tint/builtins/gen/atomicStore/8bea94.wgsl deleted file mode 100644 index c22ea05545..0000000000 --- a/test/tint/builtins/gen/atomicStore/8bea94.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicStore(ptr, read_write>, i32) -fn atomicStore_8bea94() { - atomicStore(&arg_0, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicStore_8bea94(); -} diff --git a/test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.msl b/test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.msl deleted file mode 100644 index c17b49ca48..0000000000 --- a/test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicStore_8bea94(threadgroup atomic_int* const tint_symbol) { - atomic_store_explicit(tint_symbol, 1, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicStore_8bea94(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.wgsl deleted file mode 100644 index 2616d87dec..0000000000 --- a/test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicStore_8bea94() { - atomicStore(&(arg_0), 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicStore_8bea94(); -} diff --git a/test/tint/builtins/gen/atomicStore/cdc29e.wgsl b/test/tint/builtins/gen/atomicStore/cdc29e.wgsl deleted file mode 100644 index ef3c49ca68..0000000000 --- a/test/tint/builtins/gen/atomicStore/cdc29e.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicStore(ptr, read_write>, u32) -fn atomicStore_cdc29e() { - atomicStore(&sb_rw.arg_0, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicStore_cdc29e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicStore_cdc29e(); -} diff --git a/test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.hlsl deleted file mode 100644 index d78cdbec5e..0000000000 --- a/test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -void atomicStore_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint ignored; - buffer.InterlockedExchange(offset, value, ignored); -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicStore_cdc29e() { - atomicStore_1(sb_rw, 0u, 1u); -} - -void fragment_main() { - atomicStore_cdc29e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicStore_cdc29e(); - return; -} diff --git a/test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.wgsl deleted file mode 100644 index 6da44d4e1c..0000000000 --- a/test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicStore_cdc29e() { - atomicStore(&(sb_rw.arg_0), 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicStore_cdc29e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicStore_cdc29e(); -} diff --git a/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl b/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl deleted file mode 100644 index ea7559df92..0000000000 --- a/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicStore(ptr, read_write>, i32) -fn atomicStore_d1e9a6() { - atomicStore(&sb_rw.arg_0, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicStore_d1e9a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicStore_d1e9a6(); -} diff --git a/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.hlsl deleted file mode 100644 index afac632ba9..0000000000 --- a/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -void atomicStore_1(RWByteAddressBuffer buffer, uint offset, int value) { - int ignored; - buffer.InterlockedExchange(offset, value, ignored); -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicStore_d1e9a6() { - atomicStore_1(sb_rw, 0u, 1); -} - -void fragment_main() { - atomicStore_d1e9a6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicStore_d1e9a6(); - return; -} diff --git a/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.wgsl deleted file mode 100644 index 5d509ce5f3..0000000000 --- a/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicStore_d1e9a6() { - atomicStore(&(sb_rw.arg_0), 1); -} - -@stage(fragment) -fn fragment_main() { - atomicStore_d1e9a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicStore_d1e9a6(); -} diff --git a/test/tint/builtins/gen/atomicSub/051100.wgsl b/test/tint/builtins/gen/atomicSub/051100.wgsl deleted file mode 100644 index 6b84ec19b1..0000000000 --- a/test/tint/builtins/gen/atomicSub/051100.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicSub(ptr, read_write>, i32) -> i32 -fn atomicSub_051100() { - var res: i32 = atomicSub(&sb_rw.arg_0, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicSub_051100(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicSub_051100(); -} diff --git a/test/tint/builtins/gen/atomicSub/051100.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicSub/051100.wgsl.expected.hlsl deleted file mode 100644 index 26ad745c6d..0000000000 --- a/test/tint/builtins/gen/atomicSub/051100.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -int atomicSub_1(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedAdd(offset, -value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicSub_051100() { - int res = atomicSub_1(sb_rw, 0u, 1); -} - -void fragment_main() { - atomicSub_051100(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicSub_051100(); - return; -} diff --git a/test/tint/builtins/gen/atomicSub/051100.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicSub/051100.wgsl.expected.wgsl deleted file mode 100644 index faf9784587..0000000000 --- a/test/tint/builtins/gen/atomicSub/051100.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicSub_051100() { - var res : i32 = atomicSub(&(sb_rw.arg_0), 1); -} - -@stage(fragment) -fn fragment_main() { - atomicSub_051100(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicSub_051100(); -} diff --git a/test/tint/builtins/gen/atomicSub/0d26c2.wgsl b/test/tint/builtins/gen/atomicSub/0d26c2.wgsl deleted file mode 100644 index 9617c0ae61..0000000000 --- a/test/tint/builtins/gen/atomicSub/0d26c2.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicSub(ptr, read_write>, u32) -> u32 -fn atomicSub_0d26c2() { - var res: u32 = atomicSub(&arg_0, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicSub_0d26c2(); -} diff --git a/test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.msl b/test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.msl deleted file mode 100644 index aea7fed773..0000000000 --- a/test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicSub_0d26c2(threadgroup atomic_uint* const tint_symbol) { - uint res = atomic_fetch_sub_explicit(tint_symbol, 1u, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicSub_0d26c2(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.wgsl deleted file mode 100644 index 6b75ecbcf2..0000000000 --- a/test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicSub_0d26c2() { - var res : u32 = atomicSub(&(arg_0), 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicSub_0d26c2(); -} diff --git a/test/tint/builtins/gen/atomicSub/15bfc9.wgsl b/test/tint/builtins/gen/atomicSub/15bfc9.wgsl deleted file mode 100644 index c7f190a830..0000000000 --- a/test/tint/builtins/gen/atomicSub/15bfc9.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicSub(ptr, read_write>, u32) -> u32 -fn atomicSub_15bfc9() { - var res: u32 = atomicSub(&sb_rw.arg_0, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicSub_15bfc9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicSub_15bfc9(); -} diff --git a/test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.hlsl deleted file mode 100644 index 21e149f65d..0000000000 --- a/test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicSub_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedAdd(offset, -value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicSub_15bfc9() { - uint res = atomicSub_1(sb_rw, 0u, 1u); -} - -void fragment_main() { - atomicSub_15bfc9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicSub_15bfc9(); - return; -} diff --git a/test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.wgsl deleted file mode 100644 index 74ec8cd385..0000000000 --- a/test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicSub_15bfc9() { - var res : u32 = atomicSub(&(sb_rw.arg_0), 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicSub_15bfc9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicSub_15bfc9(); -} diff --git a/test/tint/builtins/gen/atomicSub/77883a.wgsl b/test/tint/builtins/gen/atomicSub/77883a.wgsl deleted file mode 100644 index fbd20fc094..0000000000 --- a/test/tint/builtins/gen/atomicSub/77883a.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicSub(ptr, read_write>, i32) -> i32 -fn atomicSub_77883a() { - var res: i32 = atomicSub(&arg_0, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicSub_77883a(); -} diff --git a/test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.msl b/test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.msl deleted file mode 100644 index 603ac409c4..0000000000 --- a/test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicSub_77883a(threadgroup atomic_int* const tint_symbol) { - int res = atomic_fetch_sub_explicit(tint_symbol, 1, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicSub_77883a(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.wgsl deleted file mode 100644 index 4a49222bc9..0000000000 --- a/test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicSub_77883a() { - var res : i32 = atomicSub(&(arg_0), 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicSub_77883a(); -} diff --git a/test/tint/builtins/gen/atomicXor/54510e.wgsl b/test/tint/builtins/gen/atomicXor/54510e.wgsl deleted file mode 100644 index 86e9648009..0000000000 --- a/test/tint/builtins/gen/atomicXor/54510e.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicXor(ptr, read_write>, u32) -> u32 -fn atomicXor_54510e() { - var res: u32 = atomicXor(&sb_rw.arg_0, 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicXor_54510e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicXor_54510e(); -} diff --git a/test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.hlsl deleted file mode 100644 index 9cc11db1f3..0000000000 --- a/test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -uint atomicXor_1(RWByteAddressBuffer buffer, uint offset, uint value) { - uint original_value = 0; - buffer.InterlockedXor(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicXor_54510e() { - uint res = atomicXor_1(sb_rw, 0u, 1u); -} - -void fragment_main() { - atomicXor_54510e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicXor_54510e(); - return; -} diff --git a/test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.wgsl deleted file mode 100644 index 61a2419369..0000000000 --- a/test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicXor_54510e() { - var res : u32 = atomicXor(&(sb_rw.arg_0), 1u); -} - -@stage(fragment) -fn fragment_main() { - atomicXor_54510e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicXor_54510e(); -} diff --git a/test/tint/builtins/gen/atomicXor/75dc95.wgsl b/test/tint/builtins/gen/atomicXor/75dc95.wgsl deleted file mode 100644 index 3676e85bf5..0000000000 --- a/test/tint/builtins/gen/atomicXor/75dc95.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicXor(ptr, read_write>, i32) -> i32 -fn atomicXor_75dc95() { - var res: i32 = atomicXor(&arg_0, 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicXor_75dc95(); -} diff --git a/test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.msl b/test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.msl deleted file mode 100644 index a89935b70a..0000000000 --- a/test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicXor_75dc95(threadgroup atomic_int* const tint_symbol) { - int res = atomic_fetch_xor_explicit(tint_symbol, 1, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, int(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicXor_75dc95(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_int tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.wgsl deleted file mode 100644 index cae6c216f1..0000000000 --- a/test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicXor_75dc95() { - var res : i32 = atomicXor(&(arg_0), 1); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicXor_75dc95(); -} diff --git a/test/tint/builtins/gen/atomicXor/c1b78c.wgsl b/test/tint/builtins/gen/atomicXor/c1b78c.wgsl deleted file mode 100644 index 9842ed4daa..0000000000 --- a/test/tint/builtins/gen/atomicXor/c1b78c.wgsl +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -struct SB_RW { - arg_0: atomic, -}; -@group(0) @binding(0) var sb_rw : SB_RW; - -// fn atomicXor(ptr, read_write>, i32) -> i32 -fn atomicXor_c1b78c() { - var res: i32 = atomicXor(&sb_rw.arg_0, 1); -} - -@stage(fragment) -fn fragment_main() { - atomicXor_c1b78c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicXor_c1b78c(); -} diff --git a/test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.hlsl b/test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.hlsl deleted file mode 100644 index 7d483b70f8..0000000000 --- a/test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -int atomicXor_1(RWByteAddressBuffer buffer, uint offset, int value) { - int original_value = 0; - buffer.InterlockedXor(offset, value, original_value); - return original_value; -} - -RWByteAddressBuffer sb_rw : register(u0, space0); - -void atomicXor_c1b78c() { - int res = atomicXor_1(sb_rw, 0u, 1); -} - -void fragment_main() { - atomicXor_c1b78c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - atomicXor_c1b78c(); - return; -} diff --git a/test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.wgsl deleted file mode 100644 index 219e9d495c..0000000000 --- a/test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -struct SB_RW { - arg_0 : atomic, -} - -@group(0) @binding(0) var sb_rw : SB_RW; - -fn atomicXor_c1b78c() { - var res : i32 = atomicXor(&(sb_rw.arg_0), 1); -} - -@stage(fragment) -fn fragment_main() { - atomicXor_c1b78c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicXor_c1b78c(); -} diff --git a/test/tint/builtins/gen/atomicXor/c8e6be.wgsl b/test/tint/builtins/gen/atomicXor/c8e6be.wgsl deleted file mode 100644 index 3307d26add..0000000000 --- a/test/tint/builtins/gen/atomicXor/c8e6be.wgsl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -var arg_0: atomic; - -// fn atomicXor(ptr, read_write>, u32) -> u32 -fn atomicXor_c8e6be() { - var res: u32 = atomicXor(&arg_0, 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicXor_c8e6be(); -} diff --git a/test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.msl b/test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.msl deleted file mode 100644 index 097ce40f58..0000000000 --- a/test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -void atomicXor_c8e6be(threadgroup atomic_uint* const tint_symbol) { - uint res = atomic_fetch_xor_explicit(tint_symbol, 1u, memory_order_relaxed); -} - -void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { - { - atomic_store_explicit(tint_symbol_1, uint(), memory_order_relaxed); - } - threadgroup_barrier(mem_flags::mem_threadgroup); - atomicXor_c8e6be(tint_symbol_1); -} - -kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup atomic_uint tint_symbol_2; - compute_main_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.wgsl b/test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.wgsl deleted file mode 100644 index d422ea04d7..0000000000 --- a/test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.wgsl +++ /dev/null @@ -1,10 +0,0 @@ -var arg_0 : atomic; - -fn atomicXor_c8e6be() { - var res : u32 = atomicXor(&(arg_0), 1u); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - atomicXor_c8e6be(); -} diff --git a/test/tint/builtins/gen/ceil/34064b.wgsl b/test/tint/builtins/gen/ceil/34064b.wgsl deleted file mode 100644 index 1445063bb6..0000000000 --- a/test/tint/builtins/gen/ceil/34064b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn ceil(vec<3, f32>) -> vec<3, f32> -fn ceil_34064b() { - var res: vec3 = ceil(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ceil_34064b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ceil_34064b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ceil_34064b(); -} diff --git a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.glsl b/test/tint/builtins/gen/ceil/34064b.wgsl.expected.glsl deleted file mode 100644 index fd1f85fe69..0000000000 --- a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void ceil_34064b() { - vec3 res = ceil(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - ceil_34064b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void ceil_34064b() { - vec3 res = ceil(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - ceil_34064b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void ceil_34064b() { - vec3 res = ceil(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - ceil_34064b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.hlsl b/test/tint/builtins/gen/ceil/34064b.wgsl.expected.hlsl deleted file mode 100644 index 9a253c5dc9..0000000000 --- a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void ceil_34064b() { - float3 res = ceil(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - ceil_34064b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - ceil_34064b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - ceil_34064b(); - return; -} diff --git a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.msl b/test/tint/builtins/gen/ceil/34064b.wgsl.expected.msl deleted file mode 100644 index a8886eb293..0000000000 --- a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void ceil_34064b() { - float3 res = ceil(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - ceil_34064b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - ceil_34064b(); - return; -} - -kernel void compute_main() { - ceil_34064b(); - return; -} - diff --git a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.spvasm b/test/tint/builtins/gen/ceil/34064b.wgsl.expected.spvasm deleted file mode 100644 index 792920fba9..0000000000 --- a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %ceil_34064b "ceil_34064b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%ceil_34064b = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Ceil %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %ceil_34064b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %ceil_34064b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %ceil_34064b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.wgsl b/test/tint/builtins/gen/ceil/34064b.wgsl.expected.wgsl deleted file mode 100644 index a72e184657..0000000000 --- a/test/tint/builtins/gen/ceil/34064b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn ceil_34064b() { - var res : vec3 = ceil(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ceil_34064b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ceil_34064b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ceil_34064b(); -} diff --git a/test/tint/builtins/gen/ceil/678655.wgsl b/test/tint/builtins/gen/ceil/678655.wgsl deleted file mode 100644 index d749c91f69..0000000000 --- a/test/tint/builtins/gen/ceil/678655.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn ceil(f32) -> f32 -fn ceil_678655() { - var res: f32 = ceil(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ceil_678655(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ceil_678655(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ceil_678655(); -} diff --git a/test/tint/builtins/gen/ceil/678655.wgsl.expected.glsl b/test/tint/builtins/gen/ceil/678655.wgsl.expected.glsl deleted file mode 100644 index 882df5a9ff..0000000000 --- a/test/tint/builtins/gen/ceil/678655.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void ceil_678655() { - float res = ceil(1.0f); -} - -vec4 vertex_main() { - ceil_678655(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void ceil_678655() { - float res = ceil(1.0f); -} - -void fragment_main() { - ceil_678655(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void ceil_678655() { - float res = ceil(1.0f); -} - -void compute_main() { - ceil_678655(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/ceil/678655.wgsl.expected.hlsl b/test/tint/builtins/gen/ceil/678655.wgsl.expected.hlsl deleted file mode 100644 index 8d93979520..0000000000 --- a/test/tint/builtins/gen/ceil/678655.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void ceil_678655() { - float res = ceil(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - ceil_678655(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - ceil_678655(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - ceil_678655(); - return; -} diff --git a/test/tint/builtins/gen/ceil/678655.wgsl.expected.msl b/test/tint/builtins/gen/ceil/678655.wgsl.expected.msl deleted file mode 100644 index 6a52e99a31..0000000000 --- a/test/tint/builtins/gen/ceil/678655.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void ceil_678655() { - float res = ceil(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - ceil_678655(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - ceil_678655(); - return; -} - -kernel void compute_main() { - ceil_678655(); - return; -} - diff --git a/test/tint/builtins/gen/ceil/678655.wgsl.expected.wgsl b/test/tint/builtins/gen/ceil/678655.wgsl.expected.wgsl deleted file mode 100644 index bb57a0aae7..0000000000 --- a/test/tint/builtins/gen/ceil/678655.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn ceil_678655() { - var res : f32 = ceil(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ceil_678655(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ceil_678655(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ceil_678655(); -} diff --git a/test/tint/builtins/gen/ceil/96f597.wgsl b/test/tint/builtins/gen/ceil/96f597.wgsl deleted file mode 100644 index 9d9a2f08a6..0000000000 --- a/test/tint/builtins/gen/ceil/96f597.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn ceil(vec<2, f32>) -> vec<2, f32> -fn ceil_96f597() { - var res: vec2 = ceil(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ceil_96f597(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ceil_96f597(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ceil_96f597(); -} diff --git a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.glsl b/test/tint/builtins/gen/ceil/96f597.wgsl.expected.glsl deleted file mode 100644 index 11797bef73..0000000000 --- a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void ceil_96f597() { - vec2 res = ceil(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - ceil_96f597(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void ceil_96f597() { - vec2 res = ceil(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - ceil_96f597(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void ceil_96f597() { - vec2 res = ceil(vec2(0.0f, 0.0f)); -} - -void compute_main() { - ceil_96f597(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.hlsl b/test/tint/builtins/gen/ceil/96f597.wgsl.expected.hlsl deleted file mode 100644 index a95f5570fa..0000000000 --- a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void ceil_96f597() { - float2 res = ceil(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - ceil_96f597(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - ceil_96f597(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - ceil_96f597(); - return; -} diff --git a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.msl b/test/tint/builtins/gen/ceil/96f597.wgsl.expected.msl deleted file mode 100644 index ec019842f8..0000000000 --- a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void ceil_96f597() { - float2 res = ceil(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - ceil_96f597(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - ceil_96f597(); - return; -} - -kernel void compute_main() { - ceil_96f597(); - return; -} - diff --git a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.spvasm b/test/tint/builtins/gen/ceil/96f597.wgsl.expected.spvasm deleted file mode 100644 index 0552e49590..0000000000 --- a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %ceil_96f597 "ceil_96f597" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%ceil_96f597 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Ceil %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %ceil_96f597 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %ceil_96f597 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %ceil_96f597 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.wgsl b/test/tint/builtins/gen/ceil/96f597.wgsl.expected.wgsl deleted file mode 100644 index bf6d138fe9..0000000000 --- a/test/tint/builtins/gen/ceil/96f597.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn ceil_96f597() { - var res : vec2 = ceil(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ceil_96f597(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ceil_96f597(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ceil_96f597(); -} diff --git a/test/tint/builtins/gen/ceil/b74c16.wgsl b/test/tint/builtins/gen/ceil/b74c16.wgsl deleted file mode 100644 index ea41b22748..0000000000 --- a/test/tint/builtins/gen/ceil/b74c16.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn ceil(vec<4, f32>) -> vec<4, f32> -fn ceil_b74c16() { - var res: vec4 = ceil(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ceil_b74c16(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ceil_b74c16(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ceil_b74c16(); -} diff --git a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.glsl b/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.glsl deleted file mode 100644 index 0376e241e1..0000000000 --- a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void ceil_b74c16() { - vec4 res = ceil(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - ceil_b74c16(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void ceil_b74c16() { - vec4 res = ceil(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - ceil_b74c16(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void ceil_b74c16() { - vec4 res = ceil(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - ceil_b74c16(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.hlsl b/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.hlsl deleted file mode 100644 index b16ec0eff9..0000000000 --- a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void ceil_b74c16() { - float4 res = ceil(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - ceil_b74c16(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - ceil_b74c16(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - ceil_b74c16(); - return; -} diff --git a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.msl b/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.msl deleted file mode 100644 index 8aefc080f3..0000000000 --- a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void ceil_b74c16() { - float4 res = ceil(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - ceil_b74c16(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - ceil_b74c16(); - return; -} - -kernel void compute_main() { - ceil_b74c16(); - return; -} - diff --git a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.spvasm b/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.spvasm deleted file mode 100644 index 74407d3d0d..0000000000 --- a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %ceil_b74c16 "ceil_b74c16" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%ceil_b74c16 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Ceil %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %ceil_b74c16 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %ceil_b74c16 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %ceil_b74c16 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.wgsl b/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.wgsl deleted file mode 100644 index c019db42bb..0000000000 --- a/test/tint/builtins/gen/ceil/b74c16.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn ceil_b74c16() { - var res : vec4 = ceil(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ceil_b74c16(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ceil_b74c16(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ceil_b74c16(); -} diff --git a/test/tint/builtins/gen/clamp/0acf8f.wgsl b/test/tint/builtins/gen/clamp/0acf8f.wgsl deleted file mode 100644 index 0650d845cd..0000000000 --- a/test/tint/builtins/gen/clamp/0acf8f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn clamp_0acf8f() { - var res: vec2 = clamp(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_0acf8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_0acf8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_0acf8f(); -} diff --git a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.glsl deleted file mode 100644 index 4c72620de5..0000000000 --- a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_0acf8f() { - vec2 res = clamp(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - clamp_0acf8f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_0acf8f() { - vec2 res = clamp(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - clamp_0acf8f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_0acf8f() { - vec2 res = clamp(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - clamp_0acf8f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.hlsl deleted file mode 100644 index 03bdbec37b..0000000000 --- a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_0acf8f() { - float2 res = clamp(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_0acf8f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_0acf8f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_0acf8f(); - return; -} diff --git a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.msl b/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.msl deleted file mode 100644 index 916d8fdce9..0000000000 --- a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_0acf8f() { - float2 res = clamp(float2(), float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_0acf8f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_0acf8f(); - return; -} - -kernel void compute_main() { - clamp_0acf8f(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.spvasm deleted file mode 100644 index 45dd69b282..0000000000 --- a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_0acf8f "clamp_0acf8f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_0acf8f = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 NClamp %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %clamp_0acf8f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %clamp_0acf8f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %clamp_0acf8f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.wgsl deleted file mode 100644 index a6f58e586e..0000000000 --- a/test/tint/builtins/gen/clamp/0acf8f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_0acf8f() { - var res : vec2 = clamp(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_0acf8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_0acf8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_0acf8f(); -} diff --git a/test/tint/builtins/gen/clamp/1a32e3.wgsl b/test/tint/builtins/gen/clamp/1a32e3.wgsl deleted file mode 100644 index 491e906f67..0000000000 --- a/test/tint/builtins/gen/clamp/1a32e3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(vec<4, i32>, vec<4, i32>, vec<4, i32>) -> vec<4, i32> -fn clamp_1a32e3() { - var res: vec4 = clamp(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_1a32e3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_1a32e3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_1a32e3(); -} diff --git a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.glsl deleted file mode 100644 index 45c941d842..0000000000 --- a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_1a32e3() { - ivec4 res = clamp(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - clamp_1a32e3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_1a32e3() { - ivec4 res = clamp(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - clamp_1a32e3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_1a32e3() { - ivec4 res = clamp(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - clamp_1a32e3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.hlsl deleted file mode 100644 index 0d631481d9..0000000000 --- a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_1a32e3() { - int4 res = clamp(int4(0, 0, 0, 0), int4(0, 0, 0, 0), int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_1a32e3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_1a32e3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_1a32e3(); - return; -} diff --git a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.msl b/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.msl deleted file mode 100644 index 44f759a007..0000000000 --- a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_1a32e3() { - int4 res = clamp(int4(), int4(), int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_1a32e3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_1a32e3(); - return; -} - -kernel void compute_main() { - clamp_1a32e3(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.spvasm deleted file mode 100644 index cf5e3d9938..0000000000 --- a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_1a32e3 "clamp_1a32e3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %17 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_1a32e3 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %17 - %13 = OpExtInst %v4int %16 SClamp %17 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %clamp_1a32e3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_1a32e3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %clamp_1a32e3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.wgsl deleted file mode 100644 index 4ca8d1e3ec..0000000000 --- a/test/tint/builtins/gen/clamp/1a32e3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_1a32e3() { - var res : vec4 = clamp(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_1a32e3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_1a32e3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_1a32e3(); -} diff --git a/test/tint/builtins/gen/clamp/2bd567.wgsl b/test/tint/builtins/gen/clamp/2bd567.wgsl deleted file mode 100644 index 51804e2c29..0000000000 --- a/test/tint/builtins/gen/clamp/2bd567.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(f32, f32, f32) -> f32 -fn clamp_2bd567() { - var res: f32 = clamp(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_2bd567(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_2bd567(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_2bd567(); -} diff --git a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.glsl deleted file mode 100644 index 8e0dc56124..0000000000 --- a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_2bd567() { - float res = clamp(1.0f, 1.0f, 1.0f); -} - -vec4 vertex_main() { - clamp_2bd567(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_2bd567() { - float res = clamp(1.0f, 1.0f, 1.0f); -} - -void fragment_main() { - clamp_2bd567(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_2bd567() { - float res = clamp(1.0f, 1.0f, 1.0f); -} - -void compute_main() { - clamp_2bd567(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.hlsl deleted file mode 100644 index 3301ab9fc7..0000000000 --- a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_2bd567() { - float res = clamp(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_2bd567(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_2bd567(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_2bd567(); - return; -} diff --git a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.msl b/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.msl deleted file mode 100644 index dfcc293e4b..0000000000 --- a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_2bd567() { - float res = clamp(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_2bd567(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_2bd567(); - return; -} - -kernel void compute_main() { - clamp_2bd567(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.spvasm deleted file mode 100644 index df43e84e47..0000000000 --- a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_2bd567 "clamp_2bd567" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 -%_ptr_Function_float = OpTypePointer Function %float - %18 = OpTypeFunction %v4float -%clamp_2bd567 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 NClamp %float_1 %float_1 %float_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %clamp_2bd567 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %clamp_2bd567 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_2bd567 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.wgsl deleted file mode 100644 index fdd1c3c469..0000000000 --- a/test/tint/builtins/gen/clamp/2bd567.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_2bd567() { - var res : f32 = clamp(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_2bd567(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_2bd567(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_2bd567(); -} diff --git a/test/tint/builtins/gen/clamp/2bde41.wgsl b/test/tint/builtins/gen/clamp/2bde41.wgsl deleted file mode 100644 index 9c7f458750..0000000000 --- a/test/tint/builtins/gen/clamp/2bde41.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn clamp_2bde41() { - var res: vec4 = clamp(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_2bde41(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_2bde41(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_2bde41(); -} diff --git a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.glsl deleted file mode 100644 index df48145d68..0000000000 --- a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_2bde41() { - vec4 res = clamp(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - clamp_2bde41(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_2bde41() { - vec4 res = clamp(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - clamp_2bde41(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_2bde41() { - vec4 res = clamp(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - clamp_2bde41(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.hlsl deleted file mode 100644 index b30c1b8605..0000000000 --- a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_2bde41() { - float4 res = clamp(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_2bde41(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_2bde41(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_2bde41(); - return; -} diff --git a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.msl b/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.msl deleted file mode 100644 index dac7c95dc9..0000000000 --- a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_2bde41() { - float4 res = clamp(float4(), float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_2bde41(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_2bde41(); - return; -} - -kernel void compute_main() { - clamp_2bde41(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.spvasm deleted file mode 100644 index ec4cbb10aa..0000000000 --- a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_2bde41 "clamp_2bde41" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_2bde41 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 NClamp %5 %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %clamp_2bde41 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %clamp_2bde41 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_2bde41 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.wgsl deleted file mode 100644 index 21f3a2d216..0000000000 --- a/test/tint/builtins/gen/clamp/2bde41.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_2bde41() { - var res : vec4 = clamp(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_2bde41(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_2bde41(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_2bde41(); -} diff --git a/test/tint/builtins/gen/clamp/548fc7.wgsl b/test/tint/builtins/gen/clamp/548fc7.wgsl deleted file mode 100644 index 7465eaaef4..0000000000 --- a/test/tint/builtins/gen/clamp/548fc7.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(vec<3, u32>, vec<3, u32>, vec<3, u32>) -> vec<3, u32> -fn clamp_548fc7() { - var res: vec3 = clamp(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_548fc7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_548fc7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_548fc7(); -} diff --git a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.glsl deleted file mode 100644 index d85d1c50d3..0000000000 --- a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_548fc7() { - uvec3 res = clamp(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - clamp_548fc7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_548fc7() { - uvec3 res = clamp(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - clamp_548fc7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_548fc7() { - uvec3 res = clamp(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -void compute_main() { - clamp_548fc7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.hlsl deleted file mode 100644 index b5181d1717..0000000000 --- a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_548fc7() { - uint3 res = clamp(uint3(0u, 0u, 0u), uint3(0u, 0u, 0u), uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_548fc7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_548fc7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_548fc7(); - return; -} diff --git a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.msl b/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.msl deleted file mode 100644 index 0ca98d3866..0000000000 --- a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_548fc7() { - uint3 res = clamp(uint3(), uint3(), uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_548fc7(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_548fc7(); - return; -} - -kernel void compute_main() { - clamp_548fc7(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.spvasm deleted file mode 100644 index de8d5726c1..0000000000 --- a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_548fc7 "clamp_548fc7" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %17 = OpConstantNull %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_548fc7 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %17 - %13 = OpExtInst %v3uint %16 UClamp %17 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %clamp_548fc7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_548fc7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %clamp_548fc7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.wgsl deleted file mode 100644 index 05f4d9e365..0000000000 --- a/test/tint/builtins/gen/clamp/548fc7.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_548fc7() { - var res : vec3 = clamp(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_548fc7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_548fc7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_548fc7(); -} diff --git a/test/tint/builtins/gen/clamp/5f0819.wgsl b/test/tint/builtins/gen/clamp/5f0819.wgsl deleted file mode 100644 index 09a03f729c..0000000000 --- a/test/tint/builtins/gen/clamp/5f0819.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(vec<3, i32>, vec<3, i32>, vec<3, i32>) -> vec<3, i32> -fn clamp_5f0819() { - var res: vec3 = clamp(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_5f0819(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_5f0819(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_5f0819(); -} diff --git a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.glsl deleted file mode 100644 index 169075785e..0000000000 --- a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_5f0819() { - ivec3 res = clamp(ivec3(0, 0, 0), ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - clamp_5f0819(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_5f0819() { - ivec3 res = clamp(ivec3(0, 0, 0), ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -void fragment_main() { - clamp_5f0819(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_5f0819() { - ivec3 res = clamp(ivec3(0, 0, 0), ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -void compute_main() { - clamp_5f0819(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.hlsl deleted file mode 100644 index ec1b9e05db..0000000000 --- a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_5f0819() { - int3 res = clamp(int3(0, 0, 0), int3(0, 0, 0), int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_5f0819(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_5f0819(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_5f0819(); - return; -} diff --git a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.msl b/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.msl deleted file mode 100644 index b2da28a4fb..0000000000 --- a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_5f0819() { - int3 res = clamp(int3(), int3(), int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_5f0819(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_5f0819(); - return; -} - -kernel void compute_main() { - clamp_5f0819(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.spvasm deleted file mode 100644 index 93b61e959c..0000000000 --- a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_5f0819 "clamp_5f0819" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %17 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_5f0819 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %17 - %13 = OpExtInst %v3int %16 SClamp %17 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %clamp_5f0819 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_5f0819 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %clamp_5f0819 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.wgsl deleted file mode 100644 index 6265d723d1..0000000000 --- a/test/tint/builtins/gen/clamp/5f0819.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_5f0819() { - var res : vec3 = clamp(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_5f0819(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_5f0819(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_5f0819(); -} diff --git a/test/tint/builtins/gen/clamp/6c1749.wgsl b/test/tint/builtins/gen/clamp/6c1749.wgsl deleted file mode 100644 index 71a22c76e9..0000000000 --- a/test/tint/builtins/gen/clamp/6c1749.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(vec<2, i32>, vec<2, i32>, vec<2, i32>) -> vec<2, i32> -fn clamp_6c1749() { - var res: vec2 = clamp(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_6c1749(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_6c1749(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_6c1749(); -} diff --git a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.glsl deleted file mode 100644 index 7b02d809b4..0000000000 --- a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_6c1749() { - ivec2 res = clamp(ivec2(0, 0), ivec2(0, 0), ivec2(0, 0)); -} - -vec4 vertex_main() { - clamp_6c1749(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_6c1749() { - ivec2 res = clamp(ivec2(0, 0), ivec2(0, 0), ivec2(0, 0)); -} - -void fragment_main() { - clamp_6c1749(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_6c1749() { - ivec2 res = clamp(ivec2(0, 0), ivec2(0, 0), ivec2(0, 0)); -} - -void compute_main() { - clamp_6c1749(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.hlsl deleted file mode 100644 index f8c15941de..0000000000 --- a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_6c1749() { - int2 res = clamp(int2(0, 0), int2(0, 0), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_6c1749(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_6c1749(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_6c1749(); - return; -} diff --git a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.msl b/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.msl deleted file mode 100644 index 39c36afb36..0000000000 --- a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_6c1749() { - int2 res = clamp(int2(), int2(), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_6c1749(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_6c1749(); - return; -} - -kernel void compute_main() { - clamp_6c1749(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.spvasm deleted file mode 100644 index 01c1fd615b..0000000000 --- a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_6c1749 "clamp_6c1749" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %17 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_6c1749 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %17 - %13 = OpExtInst %v2int %16 SClamp %17 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %clamp_6c1749 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_6c1749 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %clamp_6c1749 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.wgsl deleted file mode 100644 index 58ea37011c..0000000000 --- a/test/tint/builtins/gen/clamp/6c1749.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_6c1749() { - var res : vec2 = clamp(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_6c1749(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_6c1749(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_6c1749(); -} diff --git a/test/tint/builtins/gen/clamp/7706d7.wgsl b/test/tint/builtins/gen/clamp/7706d7.wgsl deleted file mode 100644 index 04c333b4af..0000000000 --- a/test/tint/builtins/gen/clamp/7706d7.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(vec<2, u32>, vec<2, u32>, vec<2, u32>) -> vec<2, u32> -fn clamp_7706d7() { - var res: vec2 = clamp(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_7706d7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_7706d7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_7706d7(); -} diff --git a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.glsl deleted file mode 100644 index a53b3e79ac..0000000000 --- a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_7706d7() { - uvec2 res = clamp(uvec2(0u, 0u), uvec2(0u, 0u), uvec2(0u, 0u)); -} - -vec4 vertex_main() { - clamp_7706d7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_7706d7() { - uvec2 res = clamp(uvec2(0u, 0u), uvec2(0u, 0u), uvec2(0u, 0u)); -} - -void fragment_main() { - clamp_7706d7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_7706d7() { - uvec2 res = clamp(uvec2(0u, 0u), uvec2(0u, 0u), uvec2(0u, 0u)); -} - -void compute_main() { - clamp_7706d7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.hlsl deleted file mode 100644 index a074f8da84..0000000000 --- a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_7706d7() { - uint2 res = clamp(uint2(0u, 0u), uint2(0u, 0u), uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_7706d7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_7706d7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_7706d7(); - return; -} diff --git a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.msl b/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.msl deleted file mode 100644 index 840b4ad5c0..0000000000 --- a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_7706d7() { - uint2 res = clamp(uint2(), uint2(), uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_7706d7(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_7706d7(); - return; -} - -kernel void compute_main() { - clamp_7706d7(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.spvasm deleted file mode 100644 index 8c388c4542..0000000000 --- a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_7706d7 "clamp_7706d7" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %17 = OpConstantNull %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_7706d7 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %17 - %13 = OpExtInst %v2uint %16 UClamp %17 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %clamp_7706d7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_7706d7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %clamp_7706d7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.wgsl deleted file mode 100644 index b21343c67a..0000000000 --- a/test/tint/builtins/gen/clamp/7706d7.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_7706d7() { - var res : vec2 = clamp(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_7706d7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_7706d7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_7706d7(); -} diff --git a/test/tint/builtins/gen/clamp/867397.wgsl b/test/tint/builtins/gen/clamp/867397.wgsl deleted file mode 100644 index 328951dfba..0000000000 --- a/test/tint/builtins/gen/clamp/867397.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn clamp_867397() { - var res: vec3 = clamp(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_867397(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_867397(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_867397(); -} diff --git a/test/tint/builtins/gen/clamp/867397.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/867397.wgsl.expected.glsl deleted file mode 100644 index 1a12c34bf8..0000000000 --- a/test/tint/builtins/gen/clamp/867397.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_867397() { - vec3 res = clamp(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - clamp_867397(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_867397() { - vec3 res = clamp(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - clamp_867397(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_867397() { - vec3 res = clamp(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - clamp_867397(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/867397.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/867397.wgsl.expected.hlsl deleted file mode 100644 index 867c1570a3..0000000000 --- a/test/tint/builtins/gen/clamp/867397.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_867397() { - float3 res = clamp(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_867397(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_867397(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_867397(); - return; -} diff --git a/test/tint/builtins/gen/clamp/867397.wgsl.expected.msl b/test/tint/builtins/gen/clamp/867397.wgsl.expected.msl deleted file mode 100644 index 66e86469da..0000000000 --- a/test/tint/builtins/gen/clamp/867397.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_867397() { - float3 res = clamp(float3(), float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_867397(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_867397(); - return; -} - -kernel void compute_main() { - clamp_867397(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/867397.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/867397.wgsl.expected.spvasm deleted file mode 100644 index 0c0e7c3ce6..0000000000 --- a/test/tint/builtins/gen/clamp/867397.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_867397 "clamp_867397" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_867397 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 NClamp %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %clamp_867397 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %clamp_867397 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %clamp_867397 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/867397.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/867397.wgsl.expected.wgsl deleted file mode 100644 index 0c74877cb3..0000000000 --- a/test/tint/builtins/gen/clamp/867397.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_867397() { - var res : vec3 = clamp(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_867397(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_867397(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_867397(); -} diff --git a/test/tint/builtins/gen/clamp/a2de25.wgsl b/test/tint/builtins/gen/clamp/a2de25.wgsl deleted file mode 100644 index ffec765d92..0000000000 --- a/test/tint/builtins/gen/clamp/a2de25.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(u32, u32, u32) -> u32 -fn clamp_a2de25() { - var res: u32 = clamp(1u, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_a2de25(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_a2de25(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_a2de25(); -} diff --git a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.glsl deleted file mode 100644 index 37b98f13cb..0000000000 --- a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_a2de25() { - uint res = clamp(1u, 1u, 1u); -} - -vec4 vertex_main() { - clamp_a2de25(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_a2de25() { - uint res = clamp(1u, 1u, 1u); -} - -void fragment_main() { - clamp_a2de25(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_a2de25() { - uint res = clamp(1u, 1u, 1u); -} - -void compute_main() { - clamp_a2de25(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.hlsl deleted file mode 100644 index 34672d3c98..0000000000 --- a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_a2de25() { - uint res = clamp(1u, 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_a2de25(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_a2de25(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_a2de25(); - return; -} diff --git a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.msl b/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.msl deleted file mode 100644 index 8e4fdfb3d9..0000000000 --- a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_a2de25() { - uint res = clamp(1u, 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_a2de25(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_a2de25(); - return; -} - -kernel void compute_main() { - clamp_a2de25(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.spvasm deleted file mode 100644 index 3fc18abe29..0000000000 --- a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_a2de25 "clamp_a2de25" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %uint_1 = OpConstant %uint 1 -%_ptr_Function_uint = OpTypePointer Function %uint - %19 = OpConstantNull %uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_a2de25 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %19 - %13 = OpExtInst %uint %15 UClamp %uint_1 %uint_1 %uint_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %clamp_a2de25 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_a2de25 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %clamp_a2de25 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.wgsl deleted file mode 100644 index 28aa33039e..0000000000 --- a/test/tint/builtins/gen/clamp/a2de25.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_a2de25() { - var res : u32 = clamp(1u, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_a2de25(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_a2de25(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_a2de25(); -} diff --git a/test/tint/builtins/gen/clamp/b07c65.wgsl b/test/tint/builtins/gen/clamp/b07c65.wgsl deleted file mode 100644 index 057b56e17d..0000000000 --- a/test/tint/builtins/gen/clamp/b07c65.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(i32, i32, i32) -> i32 -fn clamp_b07c65() { - var res: i32 = clamp(1, 1, 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_b07c65(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_b07c65(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_b07c65(); -} diff --git a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.glsl deleted file mode 100644 index cca602a22b..0000000000 --- a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_b07c65() { - int res = clamp(1, 1, 1); -} - -vec4 vertex_main() { - clamp_b07c65(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_b07c65() { - int res = clamp(1, 1, 1); -} - -void fragment_main() { - clamp_b07c65(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_b07c65() { - int res = clamp(1, 1, 1); -} - -void compute_main() { - clamp_b07c65(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.hlsl deleted file mode 100644 index b04222ab2d..0000000000 --- a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_b07c65() { - int res = clamp(1, 1, 1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_b07c65(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_b07c65(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_b07c65(); - return; -} diff --git a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.msl b/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.msl deleted file mode 100644 index cfe6f26816..0000000000 --- a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_b07c65() { - int res = clamp(1, 1, 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_b07c65(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_b07c65(); - return; -} - -kernel void compute_main() { - clamp_b07c65(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.spvasm deleted file mode 100644 index bdd8cb8c9c..0000000000 --- a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_b07c65 "clamp_b07c65" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_int = OpTypePointer Function %int - %19 = OpConstantNull %int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_b07c65 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_int Function %19 - %13 = OpExtInst %int %15 SClamp %int_1 %int_1 %int_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %clamp_b07c65 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_b07c65 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %clamp_b07c65 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.wgsl deleted file mode 100644 index 3ed77bc898..0000000000 --- a/test/tint/builtins/gen/clamp/b07c65.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_b07c65() { - var res : i32 = clamp(1, 1, 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_b07c65(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_b07c65(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_b07c65(); -} diff --git a/test/tint/builtins/gen/clamp/bd43ce.wgsl b/test/tint/builtins/gen/clamp/bd43ce.wgsl deleted file mode 100644 index bf1e316d32..0000000000 --- a/test/tint/builtins/gen/clamp/bd43ce.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn clamp(vec<4, u32>, vec<4, u32>, vec<4, u32>) -> vec<4, u32> -fn clamp_bd43ce() { - var res: vec4 = clamp(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_bd43ce(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_bd43ce(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_bd43ce(); -} diff --git a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.glsl b/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.glsl deleted file mode 100644 index 16717867ba..0000000000 --- a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void clamp_bd43ce() { - uvec4 res = clamp(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - clamp_bd43ce(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void clamp_bd43ce() { - uvec4 res = clamp(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - clamp_bd43ce(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void clamp_bd43ce() { - uvec4 res = clamp(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - clamp_bd43ce(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.hlsl b/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.hlsl deleted file mode 100644 index 05addc7b23..0000000000 --- a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void clamp_bd43ce() { - uint4 res = clamp(uint4(0u, 0u, 0u, 0u), uint4(0u, 0u, 0u, 0u), uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - clamp_bd43ce(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - clamp_bd43ce(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - clamp_bd43ce(); - return; -} diff --git a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.msl b/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.msl deleted file mode 100644 index 45be006ead..0000000000 --- a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void clamp_bd43ce() { - uint4 res = clamp(uint4(), uint4(), uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - clamp_bd43ce(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - clamp_bd43ce(); - return; -} - -kernel void compute_main() { - clamp_bd43ce(); - return; -} - diff --git a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.spvasm b/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.spvasm deleted file mode 100644 index 9b84322972..0000000000 --- a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %clamp_bd43ce "clamp_bd43ce" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %17 = OpConstantNull %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%clamp_bd43ce = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %17 - %13 = OpExtInst %v4uint %16 UClamp %17 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %clamp_bd43ce - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %clamp_bd43ce - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %clamp_bd43ce - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.wgsl b/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.wgsl deleted file mode 100644 index 51f94ba5bd..0000000000 --- a/test/tint/builtins/gen/clamp/bd43ce.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn clamp_bd43ce() { - var res : vec4 = clamp(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - clamp_bd43ce(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - clamp_bd43ce(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - clamp_bd43ce(); -} diff --git a/test/tint/builtins/gen/cos/16dc15.wgsl b/test/tint/builtins/gen/cos/16dc15.wgsl deleted file mode 100644 index 021e5c440e..0000000000 --- a/test/tint/builtins/gen/cos/16dc15.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn cos(vec<3, f32>) -> vec<3, f32> -fn cos_16dc15() { - var res: vec3 = cos(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cos_16dc15(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cos_16dc15(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cos_16dc15(); -} diff --git a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.glsl b/test/tint/builtins/gen/cos/16dc15.wgsl.expected.glsl deleted file mode 100644 index f2a62395c0..0000000000 --- a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void cos_16dc15() { - vec3 res = cos(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - cos_16dc15(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void cos_16dc15() { - vec3 res = cos(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - cos_16dc15(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void cos_16dc15() { - vec3 res = cos(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - cos_16dc15(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.hlsl b/test/tint/builtins/gen/cos/16dc15.wgsl.expected.hlsl deleted file mode 100644 index e084a63752..0000000000 --- a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void cos_16dc15() { - float3 res = cos(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - cos_16dc15(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - cos_16dc15(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - cos_16dc15(); - return; -} diff --git a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.msl b/test/tint/builtins/gen/cos/16dc15.wgsl.expected.msl deleted file mode 100644 index 757514ed81..0000000000 --- a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void cos_16dc15() { - float3 res = cos(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - cos_16dc15(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - cos_16dc15(); - return; -} - -kernel void compute_main() { - cos_16dc15(); - return; -} - diff --git a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.spvasm b/test/tint/builtins/gen/cos/16dc15.wgsl.expected.spvasm deleted file mode 100644 index 713e8ee18b..0000000000 --- a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %cos_16dc15 "cos_16dc15" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %cos_16dc15 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Cos %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %cos_16dc15 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %cos_16dc15 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cos_16dc15 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.wgsl b/test/tint/builtins/gen/cos/16dc15.wgsl.expected.wgsl deleted file mode 100644 index fb24d34f37..0000000000 --- a/test/tint/builtins/gen/cos/16dc15.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn cos_16dc15() { - var res : vec3 = cos(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cos_16dc15(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cos_16dc15(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cos_16dc15(); -} diff --git a/test/tint/builtins/gen/cos/29d66d.wgsl b/test/tint/builtins/gen/cos/29d66d.wgsl deleted file mode 100644 index 0c13e978da..0000000000 --- a/test/tint/builtins/gen/cos/29d66d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn cos(vec<4, f32>) -> vec<4, f32> -fn cos_29d66d() { - var res: vec4 = cos(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cos_29d66d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cos_29d66d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cos_29d66d(); -} diff --git a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.glsl b/test/tint/builtins/gen/cos/29d66d.wgsl.expected.glsl deleted file mode 100644 index 82d20b8527..0000000000 --- a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void cos_29d66d() { - vec4 res = cos(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - cos_29d66d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void cos_29d66d() { - vec4 res = cos(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - cos_29d66d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void cos_29d66d() { - vec4 res = cos(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - cos_29d66d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.hlsl b/test/tint/builtins/gen/cos/29d66d.wgsl.expected.hlsl deleted file mode 100644 index 533d022aa0..0000000000 --- a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void cos_29d66d() { - float4 res = cos(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - cos_29d66d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - cos_29d66d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - cos_29d66d(); - return; -} diff --git a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.msl b/test/tint/builtins/gen/cos/29d66d.wgsl.expected.msl deleted file mode 100644 index c77bb9ee8b..0000000000 --- a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void cos_29d66d() { - float4 res = cos(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - cos_29d66d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - cos_29d66d(); - return; -} - -kernel void compute_main() { - cos_29d66d(); - return; -} - diff --git a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.spvasm b/test/tint/builtins/gen/cos/29d66d.wgsl.expected.spvasm deleted file mode 100644 index e6389c640e..0000000000 --- a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %cos_29d66d "cos_29d66d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %cos_29d66d = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Cos %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %cos_29d66d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %cos_29d66d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cos_29d66d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.wgsl b/test/tint/builtins/gen/cos/29d66d.wgsl.expected.wgsl deleted file mode 100644 index 7bd094716f..0000000000 --- a/test/tint/builtins/gen/cos/29d66d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn cos_29d66d() { - var res : vec4 = cos(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cos_29d66d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cos_29d66d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cos_29d66d(); -} diff --git a/test/tint/builtins/gen/cos/c3b486.wgsl b/test/tint/builtins/gen/cos/c3b486.wgsl deleted file mode 100644 index 47e96863ef..0000000000 --- a/test/tint/builtins/gen/cos/c3b486.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn cos(vec<2, f32>) -> vec<2, f32> -fn cos_c3b486() { - var res: vec2 = cos(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cos_c3b486(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cos_c3b486(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cos_c3b486(); -} diff --git a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.glsl b/test/tint/builtins/gen/cos/c3b486.wgsl.expected.glsl deleted file mode 100644 index 86e401c7e6..0000000000 --- a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void cos_c3b486() { - vec2 res = cos(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - cos_c3b486(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void cos_c3b486() { - vec2 res = cos(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - cos_c3b486(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void cos_c3b486() { - vec2 res = cos(vec2(0.0f, 0.0f)); -} - -void compute_main() { - cos_c3b486(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.hlsl b/test/tint/builtins/gen/cos/c3b486.wgsl.expected.hlsl deleted file mode 100644 index 9f1eb43a9b..0000000000 --- a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void cos_c3b486() { - float2 res = cos(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - cos_c3b486(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - cos_c3b486(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - cos_c3b486(); - return; -} diff --git a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.msl b/test/tint/builtins/gen/cos/c3b486.wgsl.expected.msl deleted file mode 100644 index 9118d2961c..0000000000 --- a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void cos_c3b486() { - float2 res = cos(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - cos_c3b486(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - cos_c3b486(); - return; -} - -kernel void compute_main() { - cos_c3b486(); - return; -} - diff --git a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.spvasm b/test/tint/builtins/gen/cos/c3b486.wgsl.expected.spvasm deleted file mode 100644 index 9de36a8ac4..0000000000 --- a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %cos_c3b486 "cos_c3b486" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %cos_c3b486 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Cos %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %cos_c3b486 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %cos_c3b486 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cos_c3b486 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.wgsl b/test/tint/builtins/gen/cos/c3b486.wgsl.expected.wgsl deleted file mode 100644 index 3dfb7da69a..0000000000 --- a/test/tint/builtins/gen/cos/c3b486.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn cos_c3b486() { - var res : vec2 = cos(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cos_c3b486(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cos_c3b486(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cos_c3b486(); -} diff --git a/test/tint/builtins/gen/cos/c5c28e.wgsl b/test/tint/builtins/gen/cos/c5c28e.wgsl deleted file mode 100644 index a23fe4d5ac..0000000000 --- a/test/tint/builtins/gen/cos/c5c28e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn cos(f32) -> f32 -fn cos_c5c28e() { - var res: f32 = cos(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cos_c5c28e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cos_c5c28e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cos_c5c28e(); -} diff --git a/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.glsl b/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.glsl deleted file mode 100644 index 054c1d263e..0000000000 --- a/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void cos_c5c28e() { - float res = cos(1.0f); -} - -vec4 vertex_main() { - cos_c5c28e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void cos_c5c28e() { - float res = cos(1.0f); -} - -void fragment_main() { - cos_c5c28e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void cos_c5c28e() { - float res = cos(1.0f); -} - -void compute_main() { - cos_c5c28e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.hlsl b/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.hlsl deleted file mode 100644 index 71a6612cb3..0000000000 --- a/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void cos_c5c28e() { - float res = cos(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - cos_c5c28e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - cos_c5c28e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - cos_c5c28e(); - return; -} diff --git a/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.msl b/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.msl deleted file mode 100644 index fb0fdd7a26..0000000000 --- a/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void cos_c5c28e() { - float res = cos(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - cos_c5c28e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - cos_c5c28e(); - return; -} - -kernel void compute_main() { - cos_c5c28e(); - return; -} - diff --git a/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.wgsl b/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.wgsl deleted file mode 100644 index e2986219e8..0000000000 --- a/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn cos_c5c28e() { - var res : f32 = cos(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cos_c5c28e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cos_c5c28e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cos_c5c28e(); -} diff --git a/test/tint/builtins/gen/cosh/377652.wgsl b/test/tint/builtins/gen/cosh/377652.wgsl deleted file mode 100644 index 0ad3390a3d..0000000000 --- a/test/tint/builtins/gen/cosh/377652.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn cosh(vec<3, f32>) -> vec<3, f32> -fn cosh_377652() { - var res: vec3 = cosh(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cosh_377652(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cosh_377652(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cosh_377652(); -} diff --git a/test/tint/builtins/gen/cosh/377652.wgsl.expected.glsl b/test/tint/builtins/gen/cosh/377652.wgsl.expected.glsl deleted file mode 100644 index 3a0895200e..0000000000 --- a/test/tint/builtins/gen/cosh/377652.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void cosh_377652() { - vec3 res = cosh(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - cosh_377652(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void cosh_377652() { - vec3 res = cosh(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - cosh_377652(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void cosh_377652() { - vec3 res = cosh(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - cosh_377652(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/cosh/377652.wgsl.expected.hlsl b/test/tint/builtins/gen/cosh/377652.wgsl.expected.hlsl deleted file mode 100644 index d9713757ba..0000000000 --- a/test/tint/builtins/gen/cosh/377652.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void cosh_377652() { - float3 res = cosh(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - cosh_377652(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - cosh_377652(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - cosh_377652(); - return; -} diff --git a/test/tint/builtins/gen/cosh/377652.wgsl.expected.msl b/test/tint/builtins/gen/cosh/377652.wgsl.expected.msl deleted file mode 100644 index 0edfd485f3..0000000000 --- a/test/tint/builtins/gen/cosh/377652.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void cosh_377652() { - float3 res = cosh(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - cosh_377652(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - cosh_377652(); - return; -} - -kernel void compute_main() { - cosh_377652(); - return; -} - diff --git a/test/tint/builtins/gen/cosh/377652.wgsl.expected.spvasm b/test/tint/builtins/gen/cosh/377652.wgsl.expected.spvasm deleted file mode 100644 index 6e940e5114..0000000000 --- a/test/tint/builtins/gen/cosh/377652.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %cosh_377652 "cosh_377652" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%cosh_377652 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Cosh %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %cosh_377652 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %cosh_377652 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cosh_377652 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/cosh/377652.wgsl.expected.wgsl b/test/tint/builtins/gen/cosh/377652.wgsl.expected.wgsl deleted file mode 100644 index bfcc51afaf..0000000000 --- a/test/tint/builtins/gen/cosh/377652.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn cosh_377652() { - var res : vec3 = cosh(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cosh_377652(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cosh_377652(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cosh_377652(); -} diff --git a/test/tint/builtins/gen/cosh/c13756.wgsl b/test/tint/builtins/gen/cosh/c13756.wgsl deleted file mode 100644 index 4f3a5f33e7..0000000000 --- a/test/tint/builtins/gen/cosh/c13756.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn cosh(vec<2, f32>) -> vec<2, f32> -fn cosh_c13756() { - var res: vec2 = cosh(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cosh_c13756(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cosh_c13756(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cosh_c13756(); -} diff --git a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.glsl b/test/tint/builtins/gen/cosh/c13756.wgsl.expected.glsl deleted file mode 100644 index b207eb9067..0000000000 --- a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void cosh_c13756() { - vec2 res = cosh(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - cosh_c13756(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void cosh_c13756() { - vec2 res = cosh(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - cosh_c13756(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void cosh_c13756() { - vec2 res = cosh(vec2(0.0f, 0.0f)); -} - -void compute_main() { - cosh_c13756(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.hlsl b/test/tint/builtins/gen/cosh/c13756.wgsl.expected.hlsl deleted file mode 100644 index 0274e95d9e..0000000000 --- a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void cosh_c13756() { - float2 res = cosh(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - cosh_c13756(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - cosh_c13756(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - cosh_c13756(); - return; -} diff --git a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.msl b/test/tint/builtins/gen/cosh/c13756.wgsl.expected.msl deleted file mode 100644 index 84f27d0074..0000000000 --- a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void cosh_c13756() { - float2 res = cosh(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - cosh_c13756(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - cosh_c13756(); - return; -} - -kernel void compute_main() { - cosh_c13756(); - return; -} - diff --git a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.spvasm b/test/tint/builtins/gen/cosh/c13756.wgsl.expected.spvasm deleted file mode 100644 index 2a7229c793..0000000000 --- a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %cosh_c13756 "cosh_c13756" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%cosh_c13756 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Cosh %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %cosh_c13756 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %cosh_c13756 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cosh_c13756 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.wgsl b/test/tint/builtins/gen/cosh/c13756.wgsl.expected.wgsl deleted file mode 100644 index 3940b8edde..0000000000 --- a/test/tint/builtins/gen/cosh/c13756.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn cosh_c13756() { - var res : vec2 = cosh(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cosh_c13756(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cosh_c13756(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cosh_c13756(); -} diff --git a/test/tint/builtins/gen/cosh/da92dd.wgsl b/test/tint/builtins/gen/cosh/da92dd.wgsl deleted file mode 100644 index a109d8db3d..0000000000 --- a/test/tint/builtins/gen/cosh/da92dd.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn cosh(f32) -> f32 -fn cosh_da92dd() { - var res: f32 = cosh(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cosh_da92dd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cosh_da92dd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cosh_da92dd(); -} diff --git a/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.glsl b/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.glsl deleted file mode 100644 index 14dfd009f9..0000000000 --- a/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void cosh_da92dd() { - float res = cosh(1.0f); -} - -vec4 vertex_main() { - cosh_da92dd(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void cosh_da92dd() { - float res = cosh(1.0f); -} - -void fragment_main() { - cosh_da92dd(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void cosh_da92dd() { - float res = cosh(1.0f); -} - -void compute_main() { - cosh_da92dd(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.hlsl b/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.hlsl deleted file mode 100644 index 3e1ede3a75..0000000000 --- a/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void cosh_da92dd() { - float res = cosh(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - cosh_da92dd(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - cosh_da92dd(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - cosh_da92dd(); - return; -} diff --git a/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.msl b/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.msl deleted file mode 100644 index 21bc8291d5..0000000000 --- a/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void cosh_da92dd() { - float res = cosh(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - cosh_da92dd(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - cosh_da92dd(); - return; -} - -kernel void compute_main() { - cosh_da92dd(); - return; -} - diff --git a/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.wgsl b/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.wgsl deleted file mode 100644 index e653a5c675..0000000000 --- a/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn cosh_da92dd() { - var res : f32 = cosh(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cosh_da92dd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cosh_da92dd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cosh_da92dd(); -} diff --git a/test/tint/builtins/gen/cosh/e0c1de.wgsl b/test/tint/builtins/gen/cosh/e0c1de.wgsl deleted file mode 100644 index 36fd554ebf..0000000000 --- a/test/tint/builtins/gen/cosh/e0c1de.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn cosh(vec<4, f32>) -> vec<4, f32> -fn cosh_e0c1de() { - var res: vec4 = cosh(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cosh_e0c1de(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cosh_e0c1de(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cosh_e0c1de(); -} diff --git a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.glsl b/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.glsl deleted file mode 100644 index 1c14215217..0000000000 --- a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void cosh_e0c1de() { - vec4 res = cosh(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - cosh_e0c1de(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void cosh_e0c1de() { - vec4 res = cosh(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - cosh_e0c1de(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void cosh_e0c1de() { - vec4 res = cosh(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - cosh_e0c1de(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.hlsl b/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.hlsl deleted file mode 100644 index 6701aa04b3..0000000000 --- a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void cosh_e0c1de() { - float4 res = cosh(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - cosh_e0c1de(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - cosh_e0c1de(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - cosh_e0c1de(); - return; -} diff --git a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.msl b/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.msl deleted file mode 100644 index 1bf2ee4ced..0000000000 --- a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void cosh_e0c1de() { - float4 res = cosh(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - cosh_e0c1de(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - cosh_e0c1de(); - return; -} - -kernel void compute_main() { - cosh_e0c1de(); - return; -} - diff --git a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.spvasm b/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.spvasm deleted file mode 100644 index b26a1cab19..0000000000 --- a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %cosh_e0c1de "cosh_e0c1de" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%cosh_e0c1de = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Cosh %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %cosh_e0c1de - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %cosh_e0c1de - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cosh_e0c1de - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.wgsl b/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.wgsl deleted file mode 100644 index 64b0a086ce..0000000000 --- a/test/tint/builtins/gen/cosh/e0c1de.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn cosh_e0c1de() { - var res : vec4 = cosh(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cosh_e0c1de(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cosh_e0c1de(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cosh_e0c1de(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl b/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl deleted file mode 100644 index fe5e75b1e0..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countLeadingZeros(u32) -> u32 -fn countLeadingZeros_208d46() { - var res: u32 = countLeadingZeros(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_208d46(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_208d46(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_208d46(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.glsl b/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.glsl deleted file mode 100644 index 1ea064e538..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uint tint_count_leading_zeros(uint v) { - uint x = uint(v); - uint b16 = ((x <= 65535u) ? 16u : 0u); - x = (x << b16); - uint b8 = ((x <= 16777215u) ? 8u : 0u); - x = (x << b8); - uint b4 = ((x <= 268435455u) ? 4u : 0u); - x = (x << b4); - uint b2 = ((x <= 1073741823u) ? 2u : 0u); - x = (x << b2); - uint b1 = ((x <= 2147483647u) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_208d46() { - uint res = tint_count_leading_zeros(1u); -} - -vec4 vertex_main() { - countLeadingZeros_208d46(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uint tint_count_leading_zeros(uint v) { - uint x = uint(v); - uint b16 = ((x <= 65535u) ? 16u : 0u); - x = (x << b16); - uint b8 = ((x <= 16777215u) ? 8u : 0u); - x = (x << b8); - uint b4 = ((x <= 268435455u) ? 4u : 0u); - x = (x << b4); - uint b2 = ((x <= 1073741823u) ? 2u : 0u); - x = (x << b2); - uint b1 = ((x <= 2147483647u) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_208d46() { - uint res = tint_count_leading_zeros(1u); -} - -void fragment_main() { - countLeadingZeros_208d46(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uint tint_count_leading_zeros(uint v) { - uint x = uint(v); - uint b16 = ((x <= 65535u) ? 16u : 0u); - x = (x << b16); - uint b8 = ((x <= 16777215u) ? 8u : 0u); - x = (x << b8); - uint b4 = ((x <= 268435455u) ? 4u : 0u); - x = (x << b4); - uint b2 = ((x <= 1073741823u) ? 2u : 0u); - x = (x << b2); - uint b1 = ((x <= 2147483647u) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_208d46() { - uint res = tint_count_leading_zeros(1u); -} - -void compute_main() { - countLeadingZeros_208d46(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.hlsl b/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.hlsl deleted file mode 100644 index 6d1cdd6e4e..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint tint_count_leading_zeros(uint v) { - uint x = uint(v); - const uint b16 = ((x <= 65535u) ? 16u : 0u); - x = (x << b16); - const uint b8 = ((x <= 16777215u) ? 8u : 0u); - x = (x << b8); - const uint b4 = ((x <= 268435455u) ? 4u : 0u); - x = (x << b4); - const uint b2 = ((x <= 1073741823u) ? 2u : 0u); - x = (x << b2); - const uint b1 = ((x <= 2147483647u) ? 1u : 0u); - const uint is_zero = ((x == 0u) ? 1u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_208d46() { - uint res = tint_count_leading_zeros(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countLeadingZeros_208d46(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countLeadingZeros_208d46(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countLeadingZeros_208d46(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.msl b/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.msl deleted file mode 100644 index f1368f91e9..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countLeadingZeros_208d46() { - uint res = clz(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countLeadingZeros_208d46(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countLeadingZeros_208d46(); - return; -} - -kernel void compute_main() { - countLeadingZeros_208d46(); - return; -} - diff --git a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.spvasm b/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.spvasm deleted file mode 100644 index 536612a98f..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.spvasm +++ /dev/null @@ -1,124 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 82 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_leading_zeros "tint_count_leading_zeros" - OpName %v "v" - OpName %x "x" - OpName %countLeadingZeros_208d46 "countLeadingZeros_208d46" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %uint %uint -%_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint - %uint_65535 = OpConstant %uint 65535 - %bool = OpTypeBool - %uint_16 = OpConstant %uint 16 - %uint_0 = OpConstant %uint 0 -%uint_16777215 = OpConstant %uint 16777215 - %uint_8 = OpConstant %uint 8 -%uint_268435455 = OpConstant %uint 268435455 - %uint_4 = OpConstant %uint 4 -%uint_1073741823 = OpConstant %uint 1073741823 - %uint_2 = OpConstant %uint 2 -%uint_2147483647 = OpConstant %uint 2147483647 - %uint_1 = OpConstant %uint 1 - %void = OpTypeVoid - %62 = OpTypeFunction %void - %68 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_leading_zeros = OpFunction %uint None %9 - %v = OpFunctionParameter %uint - %13 = OpLabel - %x = OpVariable %_ptr_Function_uint Function %17 - OpStore %x %v - %19 = OpLoad %uint %x - %21 = OpULessThanEqual %bool %19 %uint_65535 - %18 = OpSelect %uint %21 %uint_16 %uint_0 - %25 = OpLoad %uint %x - %26 = OpShiftLeftLogical %uint %25 %18 - OpStore %x %26 - %28 = OpLoad %uint %x - %30 = OpULessThanEqual %bool %28 %uint_16777215 - %27 = OpSelect %uint %30 %uint_8 %uint_0 - %32 = OpLoad %uint %x - %33 = OpShiftLeftLogical %uint %32 %27 - OpStore %x %33 - %35 = OpLoad %uint %x - %37 = OpULessThanEqual %bool %35 %uint_268435455 - %34 = OpSelect %uint %37 %uint_4 %uint_0 - %39 = OpLoad %uint %x - %40 = OpShiftLeftLogical %uint %39 %34 - OpStore %x %40 - %42 = OpLoad %uint %x - %44 = OpULessThanEqual %bool %42 %uint_1073741823 - %41 = OpSelect %uint %44 %uint_2 %uint_0 - %46 = OpLoad %uint %x - %47 = OpShiftLeftLogical %uint %46 %41 - OpStore %x %47 - %49 = OpLoad %uint %x - %51 = OpULessThanEqual %bool %49 %uint_2147483647 - %48 = OpSelect %uint %51 %uint_1 %uint_0 - %54 = OpLoad %uint %x - %55 = OpIEqual %bool %54 %uint_0 - %53 = OpSelect %uint %55 %uint_1 %uint_0 - %57 = OpBitwiseOr %uint %18 %27 - %58 = OpBitwiseOr %uint %57 %34 - %59 = OpBitwiseOr %uint %58 %41 - %60 = OpBitwiseOr %uint %59 %48 - %61 = OpIAdd %uint %60 %53 - OpReturnValue %61 - OpFunctionEnd -%countLeadingZeros_208d46 = OpFunction %void None %62 - %65 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %66 = OpFunctionCall %uint %tint_count_leading_zeros %uint_1 - OpStore %res %66 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %68 - %70 = OpLabel - %71 = OpFunctionCall %void %countLeadingZeros_208d46 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %62 - %73 = OpLabel - %74 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %74 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %62 - %77 = OpLabel - %78 = OpFunctionCall %void %countLeadingZeros_208d46 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %62 - %80 = OpLabel - %81 = OpFunctionCall %void %countLeadingZeros_208d46 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.wgsl b/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.wgsl deleted file mode 100644 index f2120c37f2..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/208d46.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countLeadingZeros_208d46() { - var res : u32 = countLeadingZeros(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_208d46(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_208d46(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_208d46(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl b/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl deleted file mode 100644 index 7eb079db8b..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countLeadingZeros(i32) -> i32 -fn countLeadingZeros_6d4656() { - var res: i32 = countLeadingZeros(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_6d4656(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_6d4656(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_6d4656(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.glsl b/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.glsl deleted file mode 100644 index caff692958..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -int tint_count_leading_zeros(int v) { - uint x = uint(v); - uint b16 = ((x <= 65535u) ? 16u : 0u); - x = (x << b16); - uint b8 = ((x <= 16777215u) ? 8u : 0u); - x = (x << b8); - uint b4 = ((x <= 268435455u) ? 4u : 0u); - x = (x << b4); - uint b2 = ((x <= 1073741823u) ? 2u : 0u); - x = (x << b2); - uint b1 = ((x <= 2147483647u) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_6d4656() { - int res = tint_count_leading_zeros(1); -} - -vec4 vertex_main() { - countLeadingZeros_6d4656(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -int tint_count_leading_zeros(int v) { - uint x = uint(v); - uint b16 = ((x <= 65535u) ? 16u : 0u); - x = (x << b16); - uint b8 = ((x <= 16777215u) ? 8u : 0u); - x = (x << b8); - uint b4 = ((x <= 268435455u) ? 4u : 0u); - x = (x << b4); - uint b2 = ((x <= 1073741823u) ? 2u : 0u); - x = (x << b2); - uint b1 = ((x <= 2147483647u) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_6d4656() { - int res = tint_count_leading_zeros(1); -} - -void fragment_main() { - countLeadingZeros_6d4656(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -int tint_count_leading_zeros(int v) { - uint x = uint(v); - uint b16 = ((x <= 65535u) ? 16u : 0u); - x = (x << b16); - uint b8 = ((x <= 16777215u) ? 8u : 0u); - x = (x << b8); - uint b4 = ((x <= 268435455u) ? 4u : 0u); - x = (x << b4); - uint b2 = ((x <= 1073741823u) ? 2u : 0u); - x = (x << b2); - uint b1 = ((x <= 2147483647u) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_6d4656() { - int res = tint_count_leading_zeros(1); -} - -void compute_main() { - countLeadingZeros_6d4656(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.hlsl b/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.hlsl deleted file mode 100644 index c34761655a..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int tint_count_leading_zeros(int v) { - uint x = uint(v); - const uint b16 = ((x <= 65535u) ? 16u : 0u); - x = (x << b16); - const uint b8 = ((x <= 16777215u) ? 8u : 0u); - x = (x << b8); - const uint b4 = ((x <= 268435455u) ? 4u : 0u); - x = (x << b4); - const uint b2 = ((x <= 1073741823u) ? 2u : 0u); - x = (x << b2); - const uint b1 = ((x <= 2147483647u) ? 1u : 0u); - const uint is_zero = ((x == 0u) ? 1u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_6d4656() { - int res = tint_count_leading_zeros(1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countLeadingZeros_6d4656(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countLeadingZeros_6d4656(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countLeadingZeros_6d4656(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.msl b/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.msl deleted file mode 100644 index 5a745169e1..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countLeadingZeros_6d4656() { - int res = clz(1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countLeadingZeros_6d4656(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countLeadingZeros_6d4656(); - return; -} - -kernel void compute_main() { - countLeadingZeros_6d4656(); - return; -} - diff --git a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.spvasm b/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.spvasm deleted file mode 100644 index 6990a3605b..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.spvasm +++ /dev/null @@ -1,130 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 86 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_leading_zeros "tint_count_leading_zeros" - OpName %v "v" - OpName %x "x" - OpName %countLeadingZeros_6d4656 "countLeadingZeros_6d4656" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %9 = OpTypeFunction %int %int - %uint = OpTypeInt 32 0 -%_ptr_Function_uint = OpTypePointer Function %uint - %18 = OpConstantNull %uint - %uint_65535 = OpConstant %uint 65535 - %bool = OpTypeBool - %uint_16 = OpConstant %uint 16 - %uint_0 = OpConstant %uint 0 -%uint_16777215 = OpConstant %uint 16777215 - %uint_8 = OpConstant %uint 8 -%uint_268435455 = OpConstant %uint 268435455 - %uint_4 = OpConstant %uint 4 -%uint_1073741823 = OpConstant %uint 1073741823 - %uint_2 = OpConstant %uint 2 -%uint_2147483647 = OpConstant %uint 2147483647 - %uint_1 = OpConstant %uint 1 - %void = OpTypeVoid - %63 = OpTypeFunction %void - %int_1 = OpConstant %int 1 -%_ptr_Function_int = OpTypePointer Function %int - %71 = OpConstantNull %int - %72 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_leading_zeros = OpFunction %int None %9 - %v = OpFunctionParameter %int - %13 = OpLabel - %x = OpVariable %_ptr_Function_uint Function %18 - %14 = OpBitcast %uint %v - OpStore %x %14 - %20 = OpLoad %uint %x - %22 = OpULessThanEqual %bool %20 %uint_65535 - %19 = OpSelect %uint %22 %uint_16 %uint_0 - %26 = OpLoad %uint %x - %27 = OpShiftLeftLogical %uint %26 %19 - OpStore %x %27 - %29 = OpLoad %uint %x - %31 = OpULessThanEqual %bool %29 %uint_16777215 - %28 = OpSelect %uint %31 %uint_8 %uint_0 - %33 = OpLoad %uint %x - %34 = OpShiftLeftLogical %uint %33 %28 - OpStore %x %34 - %36 = OpLoad %uint %x - %38 = OpULessThanEqual %bool %36 %uint_268435455 - %35 = OpSelect %uint %38 %uint_4 %uint_0 - %40 = OpLoad %uint %x - %41 = OpShiftLeftLogical %uint %40 %35 - OpStore %x %41 - %43 = OpLoad %uint %x - %45 = OpULessThanEqual %bool %43 %uint_1073741823 - %42 = OpSelect %uint %45 %uint_2 %uint_0 - %47 = OpLoad %uint %x - %48 = OpShiftLeftLogical %uint %47 %42 - OpStore %x %48 - %50 = OpLoad %uint %x - %52 = OpULessThanEqual %bool %50 %uint_2147483647 - %49 = OpSelect %uint %52 %uint_1 %uint_0 - %55 = OpLoad %uint %x - %56 = OpIEqual %bool %55 %uint_0 - %54 = OpSelect %uint %56 %uint_1 %uint_0 - %58 = OpBitwiseOr %uint %19 %28 - %59 = OpBitwiseOr %uint %58 %35 - %60 = OpBitwiseOr %uint %59 %42 - %61 = OpBitwiseOr %uint %60 %49 - %62 = OpIAdd %uint %61 %54 - %57 = OpBitcast %int %62 - OpReturnValue %57 - OpFunctionEnd -%countLeadingZeros_6d4656 = OpFunction %void None %63 - %66 = OpLabel - %res = OpVariable %_ptr_Function_int Function %71 - %67 = OpFunctionCall %int %tint_count_leading_zeros %int_1 - OpStore %res %67 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %72 - %74 = OpLabel - %75 = OpFunctionCall %void %countLeadingZeros_6d4656 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %63 - %77 = OpLabel - %78 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %78 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %63 - %81 = OpLabel - %82 = OpFunctionCall %void %countLeadingZeros_6d4656 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %63 - %84 = OpLabel - %85 = OpFunctionCall %void %countLeadingZeros_6d4656 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.wgsl b/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.wgsl deleted file mode 100644 index f8b28afd60..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/6d4656.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countLeadingZeros_6d4656() { - var res : i32 = countLeadingZeros(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_6d4656(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_6d4656(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_6d4656(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl b/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl deleted file mode 100644 index 548e9eb197..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countLeadingZeros(vec<2, u32>) -> vec<2, u32> -fn countLeadingZeros_70783f() { - var res: vec2 = countLeadingZeros(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_70783f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_70783f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_70783f(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.glsl b/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.glsl deleted file mode 100644 index 1518710b48..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec2 tint_count_leading_zeros(uvec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); - x = (x << b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); - x = (x << b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); - x = (x << b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); - x = (x << b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_70783f() { - uvec2 res = tint_count_leading_zeros(uvec2(0u, 0u)); -} - -vec4 vertex_main() { - countLeadingZeros_70783f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec2 tint_count_leading_zeros(uvec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); - x = (x << b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); - x = (x << b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); - x = (x << b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); - x = (x << b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_70783f() { - uvec2 res = tint_count_leading_zeros(uvec2(0u, 0u)); -} - -void fragment_main() { - countLeadingZeros_70783f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec2 tint_count_leading_zeros(uvec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); - x = (x << b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); - x = (x << b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); - x = (x << b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); - x = (x << b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_70783f() { - uvec2 res = tint_count_leading_zeros(uvec2(0u, 0u)); -} - -void compute_main() { - countLeadingZeros_70783f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.hlsl b/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.hlsl deleted file mode 100644 index a61241a042..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint2 tint_count_leading_zeros(uint2 v) { - uint2 x = uint2(v); - const uint2 b16 = ((x <= uint2((65535u).xx)) ? uint2((16u).xx) : uint2((0u).xx)); - x = (x << b16); - const uint2 b8 = ((x <= uint2((16777215u).xx)) ? uint2((8u).xx) : uint2((0u).xx)); - x = (x << b8); - const uint2 b4 = ((x <= uint2((268435455u).xx)) ? uint2((4u).xx) : uint2((0u).xx)); - x = (x << b4); - const uint2 b2 = ((x <= uint2((1073741823u).xx)) ? uint2((2u).xx) : uint2((0u).xx)); - x = (x << b2); - const uint2 b1 = ((x <= uint2((2147483647u).xx)) ? uint2((1u).xx) : uint2((0u).xx)); - const uint2 is_zero = ((x == uint2((0u).xx)) ? uint2((1u).xx) : uint2((0u).xx)); - return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_70783f() { - uint2 res = tint_count_leading_zeros(uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countLeadingZeros_70783f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countLeadingZeros_70783f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countLeadingZeros_70783f(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.msl b/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.msl deleted file mode 100644 index 0f272c2b43..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countLeadingZeros_70783f() { - uint2 res = clz(uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countLeadingZeros_70783f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countLeadingZeros_70783f(); - return; -} - -kernel void compute_main() { - countLeadingZeros_70783f(); - return; -} - diff --git a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.spvasm b/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.spvasm deleted file mode 100644 index df3cb9b4d7..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.spvasm +++ /dev/null @@ -1,137 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 95 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_leading_zeros "tint_count_leading_zeros" - OpName %v "v" - OpName %x "x" - OpName %countLeadingZeros_70783f "countLeadingZeros_70783f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %9 = OpTypeFunction %v2uint %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %18 = OpConstantNull %v2uint - %uint_65535 = OpConstant %uint 65535 - %22 = OpConstantComposite %v2uint %uint_65535 %uint_65535 - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %uint_16 = OpConstant %uint 16 - %27 = OpConstantComposite %v2uint %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %29 = OpConstantComposite %v2uint %uint_0 %uint_0 -%uint_16777215 = OpConstant %uint 16777215 - %35 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215 - %uint_8 = OpConstant %uint 8 - %38 = OpConstantComposite %v2uint %uint_8 %uint_8 -%uint_268435455 = OpConstant %uint 268435455 - %44 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455 - %uint_4 = OpConstant %uint 4 - %47 = OpConstantComposite %v2uint %uint_4 %uint_4 -%uint_1073741823 = OpConstant %uint 1073741823 - %53 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823 - %uint_2 = OpConstant %uint 2 - %56 = OpConstantComposite %v2uint %uint_2 %uint_2 -%uint_2147483647 = OpConstant %uint 2147483647 - %62 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647 - %uint_1 = OpConstant %uint 1 - %65 = OpConstantComposite %v2uint %uint_1 %uint_1 - %void = OpTypeVoid - %75 = OpTypeFunction %void - %81 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_leading_zeros = OpFunction %v2uint None %9 - %v = OpFunctionParameter %v2uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v2uint Function %18 - OpStore %x %v - %20 = OpLoad %v2uint %x - %23 = OpULessThanEqual %v2bool %20 %22 - %19 = OpSelect %v2uint %23 %27 %29 - %30 = OpLoad %v2uint %x - %31 = OpShiftLeftLogical %v2uint %30 %19 - OpStore %x %31 - %33 = OpLoad %v2uint %x - %36 = OpULessThanEqual %v2bool %33 %35 - %32 = OpSelect %v2uint %36 %38 %29 - %39 = OpLoad %v2uint %x - %40 = OpShiftLeftLogical %v2uint %39 %32 - OpStore %x %40 - %42 = OpLoad %v2uint %x - %45 = OpULessThanEqual %v2bool %42 %44 - %41 = OpSelect %v2uint %45 %47 %29 - %48 = OpLoad %v2uint %x - %49 = OpShiftLeftLogical %v2uint %48 %41 - OpStore %x %49 - %51 = OpLoad %v2uint %x - %54 = OpULessThanEqual %v2bool %51 %53 - %50 = OpSelect %v2uint %54 %56 %29 - %57 = OpLoad %v2uint %x - %58 = OpShiftLeftLogical %v2uint %57 %50 - OpStore %x %58 - %60 = OpLoad %v2uint %x - %63 = OpULessThanEqual %v2bool %60 %62 - %59 = OpSelect %v2uint %63 %65 %29 - %67 = OpLoad %v2uint %x - %68 = OpIEqual %v2bool %67 %29 - %66 = OpSelect %v2uint %68 %65 %29 - %70 = OpBitwiseOr %v2uint %19 %32 - %71 = OpBitwiseOr %v2uint %70 %41 - %72 = OpBitwiseOr %v2uint %71 %50 - %73 = OpBitwiseOr %v2uint %72 %59 - %74 = OpIAdd %v2uint %73 %66 - OpReturnValue %74 - OpFunctionEnd -%countLeadingZeros_70783f = OpFunction %void None %75 - %78 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %18 - %79 = OpFunctionCall %v2uint %tint_count_leading_zeros %18 - OpStore %res %79 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %81 - %83 = OpLabel - %84 = OpFunctionCall %void %countLeadingZeros_70783f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %75 - %86 = OpLabel - %87 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %87 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %75 - %90 = OpLabel - %91 = OpFunctionCall %void %countLeadingZeros_70783f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %75 - %93 = OpLabel - %94 = OpFunctionCall %void %countLeadingZeros_70783f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.wgsl b/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.wgsl deleted file mode 100644 index 340cac2e41..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/70783f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countLeadingZeros_70783f() { - var res : vec2 = countLeadingZeros(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_70783f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_70783f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_70783f(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl b/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl deleted file mode 100644 index 3b78cb8860..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countLeadingZeros(vec<3, i32>) -> vec<3, i32> -fn countLeadingZeros_7c38a6() { - var res: vec3 = countLeadingZeros(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_7c38a6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_7c38a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_7c38a6(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.glsl b/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.glsl deleted file mode 100644 index a8a6a3c2a6..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec3 tint_count_leading_zeros(ivec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); - x = (x << b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); - x = (x << b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); - x = (x << b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); - x = (x << b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_7c38a6() { - ivec3 res = tint_count_leading_zeros(ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - countLeadingZeros_7c38a6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec3 tint_count_leading_zeros(ivec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); - x = (x << b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); - x = (x << b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); - x = (x << b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); - x = (x << b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_7c38a6() { - ivec3 res = tint_count_leading_zeros(ivec3(0, 0, 0)); -} - -void fragment_main() { - countLeadingZeros_7c38a6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec3 tint_count_leading_zeros(ivec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); - x = (x << b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); - x = (x << b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); - x = (x << b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); - x = (x << b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_7c38a6() { - ivec3 res = tint_count_leading_zeros(ivec3(0, 0, 0)); -} - -void compute_main() { - countLeadingZeros_7c38a6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.hlsl b/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.hlsl deleted file mode 100644 index c1c241780e..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int3 tint_count_leading_zeros(int3 v) { - uint3 x = uint3(v); - const uint3 b16 = ((x <= uint3((65535u).xxx)) ? uint3((16u).xxx) : uint3((0u).xxx)); - x = (x << b16); - const uint3 b8 = ((x <= uint3((16777215u).xxx)) ? uint3((8u).xxx) : uint3((0u).xxx)); - x = (x << b8); - const uint3 b4 = ((x <= uint3((268435455u).xxx)) ? uint3((4u).xxx) : uint3((0u).xxx)); - x = (x << b4); - const uint3 b2 = ((x <= uint3((1073741823u).xxx)) ? uint3((2u).xxx) : uint3((0u).xxx)); - x = (x << b2); - const uint3 b1 = ((x <= uint3((2147483647u).xxx)) ? uint3((1u).xxx) : uint3((0u).xxx)); - const uint3 is_zero = ((x == uint3((0u).xxx)) ? uint3((1u).xxx) : uint3((0u).xxx)); - return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_7c38a6() { - int3 res = tint_count_leading_zeros(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countLeadingZeros_7c38a6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countLeadingZeros_7c38a6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countLeadingZeros_7c38a6(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.msl b/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.msl deleted file mode 100644 index e7a07c8c61..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countLeadingZeros_7c38a6() { - int3 res = clz(int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countLeadingZeros_7c38a6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countLeadingZeros_7c38a6(); - return; -} - -kernel void compute_main() { - countLeadingZeros_7c38a6(); - return; -} - diff --git a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.spvasm b/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.spvasm deleted file mode 100644 index 05320c5696..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.spvasm +++ /dev/null @@ -1,143 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 99 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_leading_zeros "tint_count_leading_zeros" - OpName %v "v" - OpName %x "x" - OpName %countLeadingZeros_7c38a6 "countLeadingZeros_7c38a6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %9 = OpTypeFunction %v3int %v3int - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %20 = OpConstantNull %v3uint - %uint_65535 = OpConstant %uint 65535 - %24 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %uint_16 = OpConstant %uint 16 - %29 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %31 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 -%uint_16777215 = OpConstant %uint 16777215 - %37 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215 - %uint_8 = OpConstant %uint 8 - %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 -%uint_268435455 = OpConstant %uint 268435455 - %46 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455 - %uint_4 = OpConstant %uint 4 - %49 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 -%uint_1073741823 = OpConstant %uint 1073741823 - %55 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823 - %uint_2 = OpConstant %uint 2 - %58 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 -%uint_2147483647 = OpConstant %uint 2147483647 - %64 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 - %void = OpTypeVoid - %77 = OpTypeFunction %void - %82 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %85 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_leading_zeros = OpFunction %v3int None %9 - %v = OpFunctionParameter %v3int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v3uint Function %20 - %15 = OpBitcast %v3uint %v - OpStore %x %15 - %22 = OpLoad %v3uint %x - %25 = OpULessThanEqual %v3bool %22 %24 - %21 = OpSelect %v3uint %25 %29 %31 - %32 = OpLoad %v3uint %x - %33 = OpShiftLeftLogical %v3uint %32 %21 - OpStore %x %33 - %35 = OpLoad %v3uint %x - %38 = OpULessThanEqual %v3bool %35 %37 - %34 = OpSelect %v3uint %38 %40 %31 - %41 = OpLoad %v3uint %x - %42 = OpShiftLeftLogical %v3uint %41 %34 - OpStore %x %42 - %44 = OpLoad %v3uint %x - %47 = OpULessThanEqual %v3bool %44 %46 - %43 = OpSelect %v3uint %47 %49 %31 - %50 = OpLoad %v3uint %x - %51 = OpShiftLeftLogical %v3uint %50 %43 - OpStore %x %51 - %53 = OpLoad %v3uint %x - %56 = OpULessThanEqual %v3bool %53 %55 - %52 = OpSelect %v3uint %56 %58 %31 - %59 = OpLoad %v3uint %x - %60 = OpShiftLeftLogical %v3uint %59 %52 - OpStore %x %60 - %62 = OpLoad %v3uint %x - %65 = OpULessThanEqual %v3bool %62 %64 - %61 = OpSelect %v3uint %65 %67 %31 - %69 = OpLoad %v3uint %x - %70 = OpIEqual %v3bool %69 %31 - %68 = OpSelect %v3uint %70 %67 %31 - %72 = OpBitwiseOr %v3uint %21 %34 - %73 = OpBitwiseOr %v3uint %72 %43 - %74 = OpBitwiseOr %v3uint %73 %52 - %75 = OpBitwiseOr %v3uint %74 %61 - %76 = OpIAdd %v3uint %75 %68 - %71 = OpBitcast %v3int %76 - OpReturnValue %71 - OpFunctionEnd -%countLeadingZeros_7c38a6 = OpFunction %void None %77 - %80 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %82 - %81 = OpFunctionCall %v3int %tint_count_leading_zeros %82 - OpStore %res %81 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %85 - %87 = OpLabel - %88 = OpFunctionCall %void %countLeadingZeros_7c38a6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %77 - %90 = OpLabel - %91 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %91 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %77 - %94 = OpLabel - %95 = OpFunctionCall %void %countLeadingZeros_7c38a6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %77 - %97 = OpLabel - %98 = OpFunctionCall %void %countLeadingZeros_7c38a6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.wgsl b/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.wgsl deleted file mode 100644 index 11cdbfa006..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/7c38a6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countLeadingZeros_7c38a6() { - var res : vec3 = countLeadingZeros(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_7c38a6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_7c38a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_7c38a6(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl b/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl deleted file mode 100644 index 572c079326..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countLeadingZeros(vec<2, i32>) -> vec<2, i32> -fn countLeadingZeros_858d40() { - var res: vec2 = countLeadingZeros(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_858d40(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_858d40(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_858d40(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.glsl b/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.glsl deleted file mode 100644 index 38387a6e7b..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec2 tint_count_leading_zeros(ivec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); - x = (x << b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); - x = (x << b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); - x = (x << b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); - x = (x << b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_858d40() { - ivec2 res = tint_count_leading_zeros(ivec2(0, 0)); -} - -vec4 vertex_main() { - countLeadingZeros_858d40(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec2 tint_count_leading_zeros(ivec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); - x = (x << b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); - x = (x << b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); - x = (x << b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); - x = (x << b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_858d40() { - ivec2 res = tint_count_leading_zeros(ivec2(0, 0)); -} - -void fragment_main() { - countLeadingZeros_858d40(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec2 tint_count_leading_zeros(ivec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); - x = (x << b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); - x = (x << b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); - x = (x << b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); - x = (x << b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_858d40() { - ivec2 res = tint_count_leading_zeros(ivec2(0, 0)); -} - -void compute_main() { - countLeadingZeros_858d40(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.hlsl b/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.hlsl deleted file mode 100644 index e04f6cfade..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int2 tint_count_leading_zeros(int2 v) { - uint2 x = uint2(v); - const uint2 b16 = ((x <= uint2((65535u).xx)) ? uint2((16u).xx) : uint2((0u).xx)); - x = (x << b16); - const uint2 b8 = ((x <= uint2((16777215u).xx)) ? uint2((8u).xx) : uint2((0u).xx)); - x = (x << b8); - const uint2 b4 = ((x <= uint2((268435455u).xx)) ? uint2((4u).xx) : uint2((0u).xx)); - x = (x << b4); - const uint2 b2 = ((x <= uint2((1073741823u).xx)) ? uint2((2u).xx) : uint2((0u).xx)); - x = (x << b2); - const uint2 b1 = ((x <= uint2((2147483647u).xx)) ? uint2((1u).xx) : uint2((0u).xx)); - const uint2 is_zero = ((x == uint2((0u).xx)) ? uint2((1u).xx) : uint2((0u).xx)); - return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_858d40() { - int2 res = tint_count_leading_zeros(int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countLeadingZeros_858d40(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countLeadingZeros_858d40(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countLeadingZeros_858d40(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.msl b/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.msl deleted file mode 100644 index e8773e3ba6..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countLeadingZeros_858d40() { - int2 res = clz(int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countLeadingZeros_858d40(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countLeadingZeros_858d40(); - return; -} - -kernel void compute_main() { - countLeadingZeros_858d40(); - return; -} - diff --git a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.spvasm b/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.spvasm deleted file mode 100644 index 48d5c97b37..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.spvasm +++ /dev/null @@ -1,143 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 99 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_leading_zeros "tint_count_leading_zeros" - OpName %v "v" - OpName %x "x" - OpName %countLeadingZeros_858d40 "countLeadingZeros_858d40" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %9 = OpTypeFunction %v2int %v2int - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %20 = OpConstantNull %v2uint - %uint_65535 = OpConstant %uint 65535 - %24 = OpConstantComposite %v2uint %uint_65535 %uint_65535 - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %uint_16 = OpConstant %uint 16 - %29 = OpConstantComposite %v2uint %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %31 = OpConstantComposite %v2uint %uint_0 %uint_0 -%uint_16777215 = OpConstant %uint 16777215 - %37 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215 - %uint_8 = OpConstant %uint 8 - %40 = OpConstantComposite %v2uint %uint_8 %uint_8 -%uint_268435455 = OpConstant %uint 268435455 - %46 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455 - %uint_4 = OpConstant %uint 4 - %49 = OpConstantComposite %v2uint %uint_4 %uint_4 -%uint_1073741823 = OpConstant %uint 1073741823 - %55 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823 - %uint_2 = OpConstant %uint 2 - %58 = OpConstantComposite %v2uint %uint_2 %uint_2 -%uint_2147483647 = OpConstant %uint 2147483647 - %64 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v2uint %uint_1 %uint_1 - %void = OpTypeVoid - %77 = OpTypeFunction %void - %82 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %85 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_leading_zeros = OpFunction %v2int None %9 - %v = OpFunctionParameter %v2int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v2uint Function %20 - %15 = OpBitcast %v2uint %v - OpStore %x %15 - %22 = OpLoad %v2uint %x - %25 = OpULessThanEqual %v2bool %22 %24 - %21 = OpSelect %v2uint %25 %29 %31 - %32 = OpLoad %v2uint %x - %33 = OpShiftLeftLogical %v2uint %32 %21 - OpStore %x %33 - %35 = OpLoad %v2uint %x - %38 = OpULessThanEqual %v2bool %35 %37 - %34 = OpSelect %v2uint %38 %40 %31 - %41 = OpLoad %v2uint %x - %42 = OpShiftLeftLogical %v2uint %41 %34 - OpStore %x %42 - %44 = OpLoad %v2uint %x - %47 = OpULessThanEqual %v2bool %44 %46 - %43 = OpSelect %v2uint %47 %49 %31 - %50 = OpLoad %v2uint %x - %51 = OpShiftLeftLogical %v2uint %50 %43 - OpStore %x %51 - %53 = OpLoad %v2uint %x - %56 = OpULessThanEqual %v2bool %53 %55 - %52 = OpSelect %v2uint %56 %58 %31 - %59 = OpLoad %v2uint %x - %60 = OpShiftLeftLogical %v2uint %59 %52 - OpStore %x %60 - %62 = OpLoad %v2uint %x - %65 = OpULessThanEqual %v2bool %62 %64 - %61 = OpSelect %v2uint %65 %67 %31 - %69 = OpLoad %v2uint %x - %70 = OpIEqual %v2bool %69 %31 - %68 = OpSelect %v2uint %70 %67 %31 - %72 = OpBitwiseOr %v2uint %21 %34 - %73 = OpBitwiseOr %v2uint %72 %43 - %74 = OpBitwiseOr %v2uint %73 %52 - %75 = OpBitwiseOr %v2uint %74 %61 - %76 = OpIAdd %v2uint %75 %68 - %71 = OpBitcast %v2int %76 - OpReturnValue %71 - OpFunctionEnd -%countLeadingZeros_858d40 = OpFunction %void None %77 - %80 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %82 - %81 = OpFunctionCall %v2int %tint_count_leading_zeros %82 - OpStore %res %81 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %85 - %87 = OpLabel - %88 = OpFunctionCall %void %countLeadingZeros_858d40 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %77 - %90 = OpLabel - %91 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %91 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %77 - %94 = OpLabel - %95 = OpFunctionCall %void %countLeadingZeros_858d40 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %77 - %97 = OpLabel - %98 = OpFunctionCall %void %countLeadingZeros_858d40 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.wgsl b/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.wgsl deleted file mode 100644 index d083be8fbe..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/858d40.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countLeadingZeros_858d40() { - var res : vec2 = countLeadingZeros(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_858d40(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_858d40(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_858d40(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl b/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl deleted file mode 100644 index e5563bde1b..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countLeadingZeros(vec<3, u32>) -> vec<3, u32> -fn countLeadingZeros_ab6345() { - var res: vec3 = countLeadingZeros(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_ab6345(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_ab6345(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_ab6345(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.glsl b/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.glsl deleted file mode 100644 index 244da5a069..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec3 tint_count_leading_zeros(uvec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); - x = (x << b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); - x = (x << b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); - x = (x << b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); - x = (x << b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_ab6345() { - uvec3 res = tint_count_leading_zeros(uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - countLeadingZeros_ab6345(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec3 tint_count_leading_zeros(uvec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); - x = (x << b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); - x = (x << b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); - x = (x << b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); - x = (x << b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_ab6345() { - uvec3 res = tint_count_leading_zeros(uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - countLeadingZeros_ab6345(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec3 tint_count_leading_zeros(uvec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); - x = (x << b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); - x = (x << b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); - x = (x << b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); - x = (x << b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_ab6345() { - uvec3 res = tint_count_leading_zeros(uvec3(0u, 0u, 0u)); -} - -void compute_main() { - countLeadingZeros_ab6345(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.hlsl b/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.hlsl deleted file mode 100644 index b33cc9a4a3..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint3 tint_count_leading_zeros(uint3 v) { - uint3 x = uint3(v); - const uint3 b16 = ((x <= uint3((65535u).xxx)) ? uint3((16u).xxx) : uint3((0u).xxx)); - x = (x << b16); - const uint3 b8 = ((x <= uint3((16777215u).xxx)) ? uint3((8u).xxx) : uint3((0u).xxx)); - x = (x << b8); - const uint3 b4 = ((x <= uint3((268435455u).xxx)) ? uint3((4u).xxx) : uint3((0u).xxx)); - x = (x << b4); - const uint3 b2 = ((x <= uint3((1073741823u).xxx)) ? uint3((2u).xxx) : uint3((0u).xxx)); - x = (x << b2); - const uint3 b1 = ((x <= uint3((2147483647u).xxx)) ? uint3((1u).xxx) : uint3((0u).xxx)); - const uint3 is_zero = ((x == uint3((0u).xxx)) ? uint3((1u).xxx) : uint3((0u).xxx)); - return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_ab6345() { - uint3 res = tint_count_leading_zeros(uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countLeadingZeros_ab6345(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countLeadingZeros_ab6345(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countLeadingZeros_ab6345(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.msl b/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.msl deleted file mode 100644 index 3dc764c9ec..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countLeadingZeros_ab6345() { - uint3 res = clz(uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countLeadingZeros_ab6345(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countLeadingZeros_ab6345(); - return; -} - -kernel void compute_main() { - countLeadingZeros_ab6345(); - return; -} - diff --git a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.spvasm b/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.spvasm deleted file mode 100644 index fab1ff6395..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.spvasm +++ /dev/null @@ -1,137 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 95 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_leading_zeros "tint_count_leading_zeros" - OpName %v "v" - OpName %x "x" - OpName %countLeadingZeros_ab6345 "countLeadingZeros_ab6345" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %9 = OpTypeFunction %v3uint %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %18 = OpConstantNull %v3uint - %uint_65535 = OpConstant %uint 65535 - %22 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %uint_16 = OpConstant %uint 16 - %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %29 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 -%uint_16777215 = OpConstant %uint 16777215 - %35 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215 - %uint_8 = OpConstant %uint 8 - %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 -%uint_268435455 = OpConstant %uint 268435455 - %44 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455 - %uint_4 = OpConstant %uint 4 - %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 -%uint_1073741823 = OpConstant %uint 1073741823 - %53 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823 - %uint_2 = OpConstant %uint 2 - %56 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 -%uint_2147483647 = OpConstant %uint 2147483647 - %62 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647 - %uint_1 = OpConstant %uint 1 - %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 - %void = OpTypeVoid - %75 = OpTypeFunction %void - %81 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_leading_zeros = OpFunction %v3uint None %9 - %v = OpFunctionParameter %v3uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v3uint Function %18 - OpStore %x %v - %20 = OpLoad %v3uint %x - %23 = OpULessThanEqual %v3bool %20 %22 - %19 = OpSelect %v3uint %23 %27 %29 - %30 = OpLoad %v3uint %x - %31 = OpShiftLeftLogical %v3uint %30 %19 - OpStore %x %31 - %33 = OpLoad %v3uint %x - %36 = OpULessThanEqual %v3bool %33 %35 - %32 = OpSelect %v3uint %36 %38 %29 - %39 = OpLoad %v3uint %x - %40 = OpShiftLeftLogical %v3uint %39 %32 - OpStore %x %40 - %42 = OpLoad %v3uint %x - %45 = OpULessThanEqual %v3bool %42 %44 - %41 = OpSelect %v3uint %45 %47 %29 - %48 = OpLoad %v3uint %x - %49 = OpShiftLeftLogical %v3uint %48 %41 - OpStore %x %49 - %51 = OpLoad %v3uint %x - %54 = OpULessThanEqual %v3bool %51 %53 - %50 = OpSelect %v3uint %54 %56 %29 - %57 = OpLoad %v3uint %x - %58 = OpShiftLeftLogical %v3uint %57 %50 - OpStore %x %58 - %60 = OpLoad %v3uint %x - %63 = OpULessThanEqual %v3bool %60 %62 - %59 = OpSelect %v3uint %63 %65 %29 - %67 = OpLoad %v3uint %x - %68 = OpIEqual %v3bool %67 %29 - %66 = OpSelect %v3uint %68 %65 %29 - %70 = OpBitwiseOr %v3uint %19 %32 - %71 = OpBitwiseOr %v3uint %70 %41 - %72 = OpBitwiseOr %v3uint %71 %50 - %73 = OpBitwiseOr %v3uint %72 %59 - %74 = OpIAdd %v3uint %73 %66 - OpReturnValue %74 - OpFunctionEnd -%countLeadingZeros_ab6345 = OpFunction %void None %75 - %78 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %18 - %79 = OpFunctionCall %v3uint %tint_count_leading_zeros %18 - OpStore %res %79 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %81 - %83 = OpLabel - %84 = OpFunctionCall %void %countLeadingZeros_ab6345 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %75 - %86 = OpLabel - %87 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %87 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %75 - %90 = OpLabel - %91 = OpFunctionCall %void %countLeadingZeros_ab6345 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %75 - %93 = OpLabel - %94 = OpFunctionCall %void %countLeadingZeros_ab6345 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.wgsl b/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.wgsl deleted file mode 100644 index d710174ef3..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/ab6345.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countLeadingZeros_ab6345() { - var res : vec3 = countLeadingZeros(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_ab6345(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_ab6345(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_ab6345(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl b/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl deleted file mode 100644 index 63d3fb100e..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countLeadingZeros(vec<4, i32>) -> vec<4, i32> -fn countLeadingZeros_eab32b() { - var res: vec4 = countLeadingZeros(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_eab32b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_eab32b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_eab32b(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.glsl b/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.glsl deleted file mode 100644 index 4fcb72235c..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec4 tint_count_leading_zeros(ivec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); - x = (x << b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); - x = (x << b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); - x = (x << b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); - x = (x << b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_eab32b() { - ivec4 res = tint_count_leading_zeros(ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - countLeadingZeros_eab32b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec4 tint_count_leading_zeros(ivec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); - x = (x << b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); - x = (x << b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); - x = (x << b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); - x = (x << b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_eab32b() { - ivec4 res = tint_count_leading_zeros(ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - countLeadingZeros_eab32b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec4 tint_count_leading_zeros(ivec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); - x = (x << b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); - x = (x << b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); - x = (x << b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); - x = (x << b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_eab32b() { - ivec4 res = tint_count_leading_zeros(ivec4(0, 0, 0, 0)); -} - -void compute_main() { - countLeadingZeros_eab32b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.hlsl b/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.hlsl deleted file mode 100644 index 6113bc8673..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int4 tint_count_leading_zeros(int4 v) { - uint4 x = uint4(v); - const uint4 b16 = ((x <= uint4((65535u).xxxx)) ? uint4((16u).xxxx) : uint4((0u).xxxx)); - x = (x << b16); - const uint4 b8 = ((x <= uint4((16777215u).xxxx)) ? uint4((8u).xxxx) : uint4((0u).xxxx)); - x = (x << b8); - const uint4 b4 = ((x <= uint4((268435455u).xxxx)) ? uint4((4u).xxxx) : uint4((0u).xxxx)); - x = (x << b4); - const uint4 b2 = ((x <= uint4((1073741823u).xxxx)) ? uint4((2u).xxxx) : uint4((0u).xxxx)); - x = (x << b2); - const uint4 b1 = ((x <= uint4((2147483647u).xxxx)) ? uint4((1u).xxxx) : uint4((0u).xxxx)); - const uint4 is_zero = ((x == uint4((0u).xxxx)) ? uint4((1u).xxxx) : uint4((0u).xxxx)); - return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_eab32b() { - int4 res = tint_count_leading_zeros(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countLeadingZeros_eab32b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countLeadingZeros_eab32b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countLeadingZeros_eab32b(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.msl b/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.msl deleted file mode 100644 index 53fc2bd00e..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countLeadingZeros_eab32b() { - int4 res = clz(int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countLeadingZeros_eab32b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countLeadingZeros_eab32b(); - return; -} - -kernel void compute_main() { - countLeadingZeros_eab32b(); - return; -} - diff --git a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.spvasm b/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.spvasm deleted file mode 100644 index 6353f3d391..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.spvasm +++ /dev/null @@ -1,143 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 99 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_leading_zeros "tint_count_leading_zeros" - OpName %v "v" - OpName %x "x" - OpName %countLeadingZeros_eab32b "countLeadingZeros_eab32b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %9 = OpTypeFunction %v4int %v4int - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %20 = OpConstantNull %v4uint - %uint_65535 = OpConstant %uint 65535 - %24 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %uint_16 = OpConstant %uint 16 - %29 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %31 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 -%uint_16777215 = OpConstant %uint 16777215 - %37 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215 - %uint_8 = OpConstant %uint 8 - %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 -%uint_268435455 = OpConstant %uint 268435455 - %46 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455 - %uint_4 = OpConstant %uint 4 - %49 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 -%uint_1073741823 = OpConstant %uint 1073741823 - %55 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823 - %uint_2 = OpConstant %uint 2 - %58 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 -%uint_2147483647 = OpConstant %uint 2147483647 - %64 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 - %void = OpTypeVoid - %77 = OpTypeFunction %void - %82 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %85 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_leading_zeros = OpFunction %v4int None %9 - %v = OpFunctionParameter %v4int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v4uint Function %20 - %15 = OpBitcast %v4uint %v - OpStore %x %15 - %22 = OpLoad %v4uint %x - %25 = OpULessThanEqual %v4bool %22 %24 - %21 = OpSelect %v4uint %25 %29 %31 - %32 = OpLoad %v4uint %x - %33 = OpShiftLeftLogical %v4uint %32 %21 - OpStore %x %33 - %35 = OpLoad %v4uint %x - %38 = OpULessThanEqual %v4bool %35 %37 - %34 = OpSelect %v4uint %38 %40 %31 - %41 = OpLoad %v4uint %x - %42 = OpShiftLeftLogical %v4uint %41 %34 - OpStore %x %42 - %44 = OpLoad %v4uint %x - %47 = OpULessThanEqual %v4bool %44 %46 - %43 = OpSelect %v4uint %47 %49 %31 - %50 = OpLoad %v4uint %x - %51 = OpShiftLeftLogical %v4uint %50 %43 - OpStore %x %51 - %53 = OpLoad %v4uint %x - %56 = OpULessThanEqual %v4bool %53 %55 - %52 = OpSelect %v4uint %56 %58 %31 - %59 = OpLoad %v4uint %x - %60 = OpShiftLeftLogical %v4uint %59 %52 - OpStore %x %60 - %62 = OpLoad %v4uint %x - %65 = OpULessThanEqual %v4bool %62 %64 - %61 = OpSelect %v4uint %65 %67 %31 - %69 = OpLoad %v4uint %x - %70 = OpIEqual %v4bool %69 %31 - %68 = OpSelect %v4uint %70 %67 %31 - %72 = OpBitwiseOr %v4uint %21 %34 - %73 = OpBitwiseOr %v4uint %72 %43 - %74 = OpBitwiseOr %v4uint %73 %52 - %75 = OpBitwiseOr %v4uint %74 %61 - %76 = OpIAdd %v4uint %75 %68 - %71 = OpBitcast %v4int %76 - OpReturnValue %71 - OpFunctionEnd -%countLeadingZeros_eab32b = OpFunction %void None %77 - %80 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %82 - %81 = OpFunctionCall %v4int %tint_count_leading_zeros %82 - OpStore %res %81 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %85 - %87 = OpLabel - %88 = OpFunctionCall %void %countLeadingZeros_eab32b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %77 - %90 = OpLabel - %91 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %91 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %77 - %94 = OpLabel - %95 = OpFunctionCall %void %countLeadingZeros_eab32b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %77 - %97 = OpLabel - %98 = OpFunctionCall %void %countLeadingZeros_eab32b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.wgsl b/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.wgsl deleted file mode 100644 index fe3546135e..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/eab32b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countLeadingZeros_eab32b() { - var res : vec4 = countLeadingZeros(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_eab32b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_eab32b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_eab32b(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl b/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl deleted file mode 100644 index 223906e77e..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countLeadingZeros(vec<4, u32>) -> vec<4, u32> -fn countLeadingZeros_f70103() { - var res: vec4 = countLeadingZeros(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_f70103(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_f70103(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_f70103(); -} diff --git a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.glsl b/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.glsl deleted file mode 100644 index 529e6c5659..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec4 tint_count_leading_zeros(uvec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); - x = (x << b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); - x = (x << b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); - x = (x << b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); - x = (x << b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_f70103() { - uvec4 res = tint_count_leading_zeros(uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - countLeadingZeros_f70103(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec4 tint_count_leading_zeros(uvec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); - x = (x << b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); - x = (x << b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); - x = (x << b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); - x = (x << b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_f70103() { - uvec4 res = tint_count_leading_zeros(uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - countLeadingZeros_f70103(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec4 tint_count_leading_zeros(uvec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); - x = (x << b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); - x = (x << b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); - x = (x << b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); - x = (x << b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_f70103() { - uvec4 res = tint_count_leading_zeros(uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - countLeadingZeros_f70103(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.hlsl b/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.hlsl deleted file mode 100644 index c9e88f3ae3..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint4 tint_count_leading_zeros(uint4 v) { - uint4 x = uint4(v); - const uint4 b16 = ((x <= uint4((65535u).xxxx)) ? uint4((16u).xxxx) : uint4((0u).xxxx)); - x = (x << b16); - const uint4 b8 = ((x <= uint4((16777215u).xxxx)) ? uint4((8u).xxxx) : uint4((0u).xxxx)); - x = (x << b8); - const uint4 b4 = ((x <= uint4((268435455u).xxxx)) ? uint4((4u).xxxx) : uint4((0u).xxxx)); - x = (x << b4); - const uint4 b2 = ((x <= uint4((1073741823u).xxxx)) ? uint4((2u).xxxx) : uint4((0u).xxxx)); - x = (x << b2); - const uint4 b1 = ((x <= uint4((2147483647u).xxxx)) ? uint4((1u).xxxx) : uint4((0u).xxxx)); - const uint4 is_zero = ((x == uint4((0u).xxxx)) ? uint4((1u).xxxx) : uint4((0u).xxxx)); - return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countLeadingZeros_f70103() { - uint4 res = tint_count_leading_zeros(uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countLeadingZeros_f70103(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countLeadingZeros_f70103(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countLeadingZeros_f70103(); - return; -} diff --git a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.msl b/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.msl deleted file mode 100644 index b29d8fbdad..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countLeadingZeros_f70103() { - uint4 res = clz(uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countLeadingZeros_f70103(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countLeadingZeros_f70103(); - return; -} - -kernel void compute_main() { - countLeadingZeros_f70103(); - return; -} - diff --git a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.spvasm b/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.spvasm deleted file mode 100644 index 34be5df063..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.spvasm +++ /dev/null @@ -1,137 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 95 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_leading_zeros "tint_count_leading_zeros" - OpName %v "v" - OpName %x "x" - OpName %countLeadingZeros_f70103 "countLeadingZeros_f70103" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %9 = OpTypeFunction %v4uint %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %18 = OpConstantNull %v4uint - %uint_65535 = OpConstant %uint 65535 - %22 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %uint_16 = OpConstant %uint 16 - %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %29 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 -%uint_16777215 = OpConstant %uint 16777215 - %35 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215 - %uint_8 = OpConstant %uint 8 - %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 -%uint_268435455 = OpConstant %uint 268435455 - %44 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455 - %uint_4 = OpConstant %uint 4 - %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 -%uint_1073741823 = OpConstant %uint 1073741823 - %53 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823 - %uint_2 = OpConstant %uint 2 - %56 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 -%uint_2147483647 = OpConstant %uint 2147483647 - %62 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647 - %uint_1 = OpConstant %uint 1 - %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 - %void = OpTypeVoid - %75 = OpTypeFunction %void - %81 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_leading_zeros = OpFunction %v4uint None %9 - %v = OpFunctionParameter %v4uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v4uint Function %18 - OpStore %x %v - %20 = OpLoad %v4uint %x - %23 = OpULessThanEqual %v4bool %20 %22 - %19 = OpSelect %v4uint %23 %27 %29 - %30 = OpLoad %v4uint %x - %31 = OpShiftLeftLogical %v4uint %30 %19 - OpStore %x %31 - %33 = OpLoad %v4uint %x - %36 = OpULessThanEqual %v4bool %33 %35 - %32 = OpSelect %v4uint %36 %38 %29 - %39 = OpLoad %v4uint %x - %40 = OpShiftLeftLogical %v4uint %39 %32 - OpStore %x %40 - %42 = OpLoad %v4uint %x - %45 = OpULessThanEqual %v4bool %42 %44 - %41 = OpSelect %v4uint %45 %47 %29 - %48 = OpLoad %v4uint %x - %49 = OpShiftLeftLogical %v4uint %48 %41 - OpStore %x %49 - %51 = OpLoad %v4uint %x - %54 = OpULessThanEqual %v4bool %51 %53 - %50 = OpSelect %v4uint %54 %56 %29 - %57 = OpLoad %v4uint %x - %58 = OpShiftLeftLogical %v4uint %57 %50 - OpStore %x %58 - %60 = OpLoad %v4uint %x - %63 = OpULessThanEqual %v4bool %60 %62 - %59 = OpSelect %v4uint %63 %65 %29 - %67 = OpLoad %v4uint %x - %68 = OpIEqual %v4bool %67 %29 - %66 = OpSelect %v4uint %68 %65 %29 - %70 = OpBitwiseOr %v4uint %19 %32 - %71 = OpBitwiseOr %v4uint %70 %41 - %72 = OpBitwiseOr %v4uint %71 %50 - %73 = OpBitwiseOr %v4uint %72 %59 - %74 = OpIAdd %v4uint %73 %66 - OpReturnValue %74 - OpFunctionEnd -%countLeadingZeros_f70103 = OpFunction %void None %75 - %78 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %18 - %79 = OpFunctionCall %v4uint %tint_count_leading_zeros %18 - OpStore %res %79 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %81 - %83 = OpLabel - %84 = OpFunctionCall %void %countLeadingZeros_f70103 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %75 - %86 = OpLabel - %87 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %87 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %75 - %90 = OpLabel - %91 = OpFunctionCall %void %countLeadingZeros_f70103 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %75 - %93 = OpLabel - %94 = OpFunctionCall %void %countLeadingZeros_f70103 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.wgsl b/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.wgsl deleted file mode 100644 index 6ce4b6cb29..0000000000 --- a/test/tint/builtins/gen/countLeadingZeros/f70103.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countLeadingZeros_f70103() { - var res : vec4 = countLeadingZeros(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countLeadingZeros_f70103(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countLeadingZeros_f70103(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countLeadingZeros_f70103(); -} diff --git a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl b/test/tint/builtins/gen/countOneBits/0d0e46.wgsl deleted file mode 100644 index 611d80f2a1..0000000000 --- a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countOneBits(vec<4, u32>) -> vec<4, u32> -fn countOneBits_0d0e46() { - var res: vec4 = countOneBits(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_0d0e46(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_0d0e46(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_0d0e46(); -} diff --git a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.glsl b/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.glsl deleted file mode 100644 index cbb7698f47..0000000000 --- a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void countOneBits_0d0e46() { - uvec4 res = uvec4(bitCount(uvec4(0u, 0u, 0u, 0u))); -} - -vec4 vertex_main() { - countOneBits_0d0e46(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void countOneBits_0d0e46() { - uvec4 res = uvec4(bitCount(uvec4(0u, 0u, 0u, 0u))); -} - -void fragment_main() { - countOneBits_0d0e46(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void countOneBits_0d0e46() { - uvec4 res = uvec4(bitCount(uvec4(0u, 0u, 0u, 0u))); -} - -void compute_main() { - countOneBits_0d0e46(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.hlsl b/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.hlsl deleted file mode 100644 index f51aa8f7e9..0000000000 --- a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void countOneBits_0d0e46() { - uint4 res = countbits(uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countOneBits_0d0e46(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countOneBits_0d0e46(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countOneBits_0d0e46(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.msl b/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.msl deleted file mode 100644 index 448eec5cdb..0000000000 --- a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countOneBits_0d0e46() { - uint4 res = popcount(uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countOneBits_0d0e46(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countOneBits_0d0e46(); - return; -} - -kernel void compute_main() { - countOneBits_0d0e46(); - return; -} - diff --git a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.spvasm b/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.spvasm deleted file mode 100644 index 12785a8bdd..0000000000 --- a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %countOneBits_0d0e46 "countOneBits_0d0e46" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %16 = OpConstantNull %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%countOneBits_0d0e46 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %16 - %13 = OpBitCount %v4uint %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %countOneBits_0d0e46 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %countOneBits_0d0e46 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %countOneBits_0d0e46 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.wgsl b/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.wgsl deleted file mode 100644 index 271af00678..0000000000 --- a/test/tint/builtins/gen/countOneBits/0d0e46.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countOneBits_0d0e46() { - var res : vec4 = countOneBits(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_0d0e46(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_0d0e46(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_0d0e46(); -} diff --git a/test/tint/builtins/gen/countOneBits/0f7980.wgsl b/test/tint/builtins/gen/countOneBits/0f7980.wgsl deleted file mode 100644 index 3073ef7281..0000000000 --- a/test/tint/builtins/gen/countOneBits/0f7980.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countOneBits(vec<4, i32>) -> vec<4, i32> -fn countOneBits_0f7980() { - var res: vec4 = countOneBits(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_0f7980(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_0f7980(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_0f7980(); -} diff --git a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.glsl b/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.glsl deleted file mode 100644 index 9f5e277132..0000000000 --- a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void countOneBits_0f7980() { - ivec4 res = ivec4(bitCount(ivec4(0, 0, 0, 0))); -} - -vec4 vertex_main() { - countOneBits_0f7980(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void countOneBits_0f7980() { - ivec4 res = ivec4(bitCount(ivec4(0, 0, 0, 0))); -} - -void fragment_main() { - countOneBits_0f7980(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void countOneBits_0f7980() { - ivec4 res = ivec4(bitCount(ivec4(0, 0, 0, 0))); -} - -void compute_main() { - countOneBits_0f7980(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.hlsl b/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.hlsl deleted file mode 100644 index 1093720ed6..0000000000 --- a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void countOneBits_0f7980() { - int4 res = countbits(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countOneBits_0f7980(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countOneBits_0f7980(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countOneBits_0f7980(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.msl b/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.msl deleted file mode 100644 index 196fe6abe1..0000000000 --- a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countOneBits_0f7980() { - int4 res = popcount(int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countOneBits_0f7980(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countOneBits_0f7980(); - return; -} - -kernel void compute_main() { - countOneBits_0f7980(); - return; -} - diff --git a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.spvasm b/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.spvasm deleted file mode 100644 index 77811f8682..0000000000 --- a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %countOneBits_0f7980 "countOneBits_0f7980" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %16 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%countOneBits_0f7980 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %16 - %13 = OpBitCount %v4int %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %countOneBits_0f7980 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %countOneBits_0f7980 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %countOneBits_0f7980 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.wgsl b/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.wgsl deleted file mode 100644 index 1291aa3f35..0000000000 --- a/test/tint/builtins/gen/countOneBits/0f7980.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countOneBits_0f7980() { - var res : vec4 = countOneBits(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_0f7980(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_0f7980(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_0f7980(); -} diff --git a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl b/test/tint/builtins/gen/countOneBits/65d2ae.wgsl deleted file mode 100644 index 1a5a546512..0000000000 --- a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countOneBits(vec<3, i32>) -> vec<3, i32> -fn countOneBits_65d2ae() { - var res: vec3 = countOneBits(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_65d2ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_65d2ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_65d2ae(); -} diff --git a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.glsl b/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.glsl deleted file mode 100644 index d7bd59f3ce..0000000000 --- a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void countOneBits_65d2ae() { - ivec3 res = ivec3(bitCount(ivec3(0, 0, 0))); -} - -vec4 vertex_main() { - countOneBits_65d2ae(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void countOneBits_65d2ae() { - ivec3 res = ivec3(bitCount(ivec3(0, 0, 0))); -} - -void fragment_main() { - countOneBits_65d2ae(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void countOneBits_65d2ae() { - ivec3 res = ivec3(bitCount(ivec3(0, 0, 0))); -} - -void compute_main() { - countOneBits_65d2ae(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.hlsl b/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.hlsl deleted file mode 100644 index cc8e8514b5..0000000000 --- a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void countOneBits_65d2ae() { - int3 res = countbits(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countOneBits_65d2ae(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countOneBits_65d2ae(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countOneBits_65d2ae(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.msl b/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.msl deleted file mode 100644 index a8ac3e8686..0000000000 --- a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countOneBits_65d2ae() { - int3 res = popcount(int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countOneBits_65d2ae(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countOneBits_65d2ae(); - return; -} - -kernel void compute_main() { - countOneBits_65d2ae(); - return; -} - diff --git a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.spvasm b/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.spvasm deleted file mode 100644 index 8ee1c7a8af..0000000000 --- a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %countOneBits_65d2ae "countOneBits_65d2ae" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %16 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%countOneBits_65d2ae = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %16 - %13 = OpBitCount %v3int %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %countOneBits_65d2ae - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %countOneBits_65d2ae - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %countOneBits_65d2ae - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.wgsl b/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.wgsl deleted file mode 100644 index e1428608ae..0000000000 --- a/test/tint/builtins/gen/countOneBits/65d2ae.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countOneBits_65d2ae() { - var res : vec3 = countOneBits(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_65d2ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_65d2ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_65d2ae(); -} diff --git a/test/tint/builtins/gen/countOneBits/690cfc.wgsl b/test/tint/builtins/gen/countOneBits/690cfc.wgsl deleted file mode 100644 index b867e47513..0000000000 --- a/test/tint/builtins/gen/countOneBits/690cfc.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countOneBits(vec<3, u32>) -> vec<3, u32> -fn countOneBits_690cfc() { - var res: vec3 = countOneBits(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_690cfc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_690cfc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_690cfc(); -} diff --git a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.glsl b/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.glsl deleted file mode 100644 index b7cf53112a..0000000000 --- a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void countOneBits_690cfc() { - uvec3 res = uvec3(bitCount(uvec3(0u, 0u, 0u))); -} - -vec4 vertex_main() { - countOneBits_690cfc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void countOneBits_690cfc() { - uvec3 res = uvec3(bitCount(uvec3(0u, 0u, 0u))); -} - -void fragment_main() { - countOneBits_690cfc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void countOneBits_690cfc() { - uvec3 res = uvec3(bitCount(uvec3(0u, 0u, 0u))); -} - -void compute_main() { - countOneBits_690cfc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.hlsl b/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.hlsl deleted file mode 100644 index 14904397a4..0000000000 --- a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void countOneBits_690cfc() { - uint3 res = countbits(uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countOneBits_690cfc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countOneBits_690cfc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countOneBits_690cfc(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.msl b/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.msl deleted file mode 100644 index 00274407f3..0000000000 --- a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countOneBits_690cfc() { - uint3 res = popcount(uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countOneBits_690cfc(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countOneBits_690cfc(); - return; -} - -kernel void compute_main() { - countOneBits_690cfc(); - return; -} - diff --git a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.spvasm b/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.spvasm deleted file mode 100644 index 258fc66f90..0000000000 --- a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %countOneBits_690cfc "countOneBits_690cfc" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %16 = OpConstantNull %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%countOneBits_690cfc = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %16 - %13 = OpBitCount %v3uint %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %countOneBits_690cfc - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %countOneBits_690cfc - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %countOneBits_690cfc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.wgsl b/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.wgsl deleted file mode 100644 index b74eb792c5..0000000000 --- a/test/tint/builtins/gen/countOneBits/690cfc.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countOneBits_690cfc() { - var res : vec3 = countOneBits(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_690cfc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_690cfc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_690cfc(); -} diff --git a/test/tint/builtins/gen/countOneBits/94fd81.wgsl b/test/tint/builtins/gen/countOneBits/94fd81.wgsl deleted file mode 100644 index e47075b133..0000000000 --- a/test/tint/builtins/gen/countOneBits/94fd81.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countOneBits(vec<2, u32>) -> vec<2, u32> -fn countOneBits_94fd81() { - var res: vec2 = countOneBits(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_94fd81(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_94fd81(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_94fd81(); -} diff --git a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.glsl b/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.glsl deleted file mode 100644 index 49931761e5..0000000000 --- a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void countOneBits_94fd81() { - uvec2 res = uvec2(bitCount(uvec2(0u, 0u))); -} - -vec4 vertex_main() { - countOneBits_94fd81(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void countOneBits_94fd81() { - uvec2 res = uvec2(bitCount(uvec2(0u, 0u))); -} - -void fragment_main() { - countOneBits_94fd81(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void countOneBits_94fd81() { - uvec2 res = uvec2(bitCount(uvec2(0u, 0u))); -} - -void compute_main() { - countOneBits_94fd81(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.hlsl b/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.hlsl deleted file mode 100644 index 9487612e2a..0000000000 --- a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void countOneBits_94fd81() { - uint2 res = countbits(uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countOneBits_94fd81(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countOneBits_94fd81(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countOneBits_94fd81(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.msl b/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.msl deleted file mode 100644 index e1f624821c..0000000000 --- a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countOneBits_94fd81() { - uint2 res = popcount(uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countOneBits_94fd81(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countOneBits_94fd81(); - return; -} - -kernel void compute_main() { - countOneBits_94fd81(); - return; -} - diff --git a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.spvasm b/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.spvasm deleted file mode 100644 index 2ac577e0f9..0000000000 --- a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %countOneBits_94fd81 "countOneBits_94fd81" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %16 = OpConstantNull %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%countOneBits_94fd81 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %16 - %13 = OpBitCount %v2uint %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %countOneBits_94fd81 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %countOneBits_94fd81 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %countOneBits_94fd81 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.wgsl b/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.wgsl deleted file mode 100644 index e713f92eff..0000000000 --- a/test/tint/builtins/gen/countOneBits/94fd81.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countOneBits_94fd81() { - var res : vec2 = countOneBits(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_94fd81(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_94fd81(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_94fd81(); -} diff --git a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl b/test/tint/builtins/gen/countOneBits/ae44f9.wgsl deleted file mode 100644 index 72fcca7a3b..0000000000 --- a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countOneBits(u32) -> u32 -fn countOneBits_ae44f9() { - var res: u32 = countOneBits(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_ae44f9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_ae44f9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_ae44f9(); -} diff --git a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.glsl b/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.glsl deleted file mode 100644 index a9346680e6..0000000000 --- a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void countOneBits_ae44f9() { - uint res = uint(bitCount(1u)); -} - -vec4 vertex_main() { - countOneBits_ae44f9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void countOneBits_ae44f9() { - uint res = uint(bitCount(1u)); -} - -void fragment_main() { - countOneBits_ae44f9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void countOneBits_ae44f9() { - uint res = uint(bitCount(1u)); -} - -void compute_main() { - countOneBits_ae44f9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.hlsl b/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.hlsl deleted file mode 100644 index cbd96415e0..0000000000 --- a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void countOneBits_ae44f9() { - uint res = countbits(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countOneBits_ae44f9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countOneBits_ae44f9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countOneBits_ae44f9(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.msl b/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.msl deleted file mode 100644 index 5a33d66585..0000000000 --- a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countOneBits_ae44f9() { - uint res = popcount(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countOneBits_ae44f9(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countOneBits_ae44f9(); - return; -} - -kernel void compute_main() { - countOneBits_ae44f9(); - return; -} - diff --git a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.wgsl b/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.wgsl deleted file mode 100644 index 3a549934ef..0000000000 --- a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countOneBits_ae44f9() { - var res : u32 = countOneBits(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_ae44f9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_ae44f9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_ae44f9(); -} diff --git a/test/tint/builtins/gen/countOneBits/af90e2.wgsl b/test/tint/builtins/gen/countOneBits/af90e2.wgsl deleted file mode 100644 index 29c605d7b1..0000000000 --- a/test/tint/builtins/gen/countOneBits/af90e2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countOneBits(vec<2, i32>) -> vec<2, i32> -fn countOneBits_af90e2() { - var res: vec2 = countOneBits(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_af90e2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_af90e2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_af90e2(); -} diff --git a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.glsl b/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.glsl deleted file mode 100644 index 3bd591ea0a..0000000000 --- a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void countOneBits_af90e2() { - ivec2 res = ivec2(bitCount(ivec2(0, 0))); -} - -vec4 vertex_main() { - countOneBits_af90e2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void countOneBits_af90e2() { - ivec2 res = ivec2(bitCount(ivec2(0, 0))); -} - -void fragment_main() { - countOneBits_af90e2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void countOneBits_af90e2() { - ivec2 res = ivec2(bitCount(ivec2(0, 0))); -} - -void compute_main() { - countOneBits_af90e2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.hlsl b/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.hlsl deleted file mode 100644 index faf8c7c733..0000000000 --- a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void countOneBits_af90e2() { - int2 res = countbits(int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countOneBits_af90e2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countOneBits_af90e2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countOneBits_af90e2(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.msl b/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.msl deleted file mode 100644 index f68cf94c5a..0000000000 --- a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countOneBits_af90e2() { - int2 res = popcount(int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countOneBits_af90e2(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countOneBits_af90e2(); - return; -} - -kernel void compute_main() { - countOneBits_af90e2(); - return; -} - diff --git a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.spvasm b/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.spvasm deleted file mode 100644 index 88f59920bc..0000000000 --- a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %countOneBits_af90e2 "countOneBits_af90e2" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %16 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%countOneBits_af90e2 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %16 - %13 = OpBitCount %v2int %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %countOneBits_af90e2 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %countOneBits_af90e2 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %countOneBits_af90e2 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.wgsl b/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.wgsl deleted file mode 100644 index c2d693a10c..0000000000 --- a/test/tint/builtins/gen/countOneBits/af90e2.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countOneBits_af90e2() { - var res : vec2 = countOneBits(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_af90e2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_af90e2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_af90e2(); -} diff --git a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl b/test/tint/builtins/gen/countOneBits/fd88b2.wgsl deleted file mode 100644 index 9e2785961a..0000000000 --- a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countOneBits(i32) -> i32 -fn countOneBits_fd88b2() { - var res: i32 = countOneBits(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_fd88b2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_fd88b2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_fd88b2(); -} diff --git a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.glsl b/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.glsl deleted file mode 100644 index d1d70b140d..0000000000 --- a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void countOneBits_fd88b2() { - int res = int(bitCount(1)); -} - -vec4 vertex_main() { - countOneBits_fd88b2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void countOneBits_fd88b2() { - int res = int(bitCount(1)); -} - -void fragment_main() { - countOneBits_fd88b2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void countOneBits_fd88b2() { - int res = int(bitCount(1)); -} - -void compute_main() { - countOneBits_fd88b2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.hlsl b/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.hlsl deleted file mode 100644 index bc4e67655a..0000000000 --- a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void countOneBits_fd88b2() { - int res = countbits(1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countOneBits_fd88b2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countOneBits_fd88b2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countOneBits_fd88b2(); - return; -} diff --git a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.msl b/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.msl deleted file mode 100644 index 998da7ae27..0000000000 --- a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countOneBits_fd88b2() { - int res = popcount(1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countOneBits_fd88b2(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countOneBits_fd88b2(); - return; -} - -kernel void compute_main() { - countOneBits_fd88b2(); - return; -} - diff --git a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.wgsl b/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.wgsl deleted file mode 100644 index c9e437bcf3..0000000000 --- a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countOneBits_fd88b2() { - var res : i32 = countOneBits(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countOneBits_fd88b2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countOneBits_fd88b2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countOneBits_fd88b2(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl b/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl deleted file mode 100644 index c5a085301f..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countTrailingZeros(vec<2, u32>) -> vec<2, u32> -fn countTrailingZeros_1ad138() { - var res: vec2 = countTrailingZeros(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_1ad138(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_1ad138(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_1ad138(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.glsl b/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.glsl deleted file mode 100644 index 4ccfc62038..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec2 tint_count_trailing_zeros(uvec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_1ad138() { - uvec2 res = tint_count_trailing_zeros(uvec2(0u, 0u)); -} - -vec4 vertex_main() { - countTrailingZeros_1ad138(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec2 tint_count_trailing_zeros(uvec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_1ad138() { - uvec2 res = tint_count_trailing_zeros(uvec2(0u, 0u)); -} - -void fragment_main() { - countTrailingZeros_1ad138(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec2 tint_count_trailing_zeros(uvec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_1ad138() { - uvec2 res = tint_count_trailing_zeros(uvec2(0u, 0u)); -} - -void compute_main() { - countTrailingZeros_1ad138(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.hlsl b/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.hlsl deleted file mode 100644 index 1363b0ca8b..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint2 tint_count_trailing_zeros(uint2 v) { - uint2 x = uint2(v); - const uint2 b16 = (bool2((x & uint2((65535u).xx))) ? uint2((0u).xx) : uint2((16u).xx)); - x = (x >> b16); - const uint2 b8 = (bool2((x & uint2((255u).xx))) ? uint2((0u).xx) : uint2((8u).xx)); - x = (x >> b8); - const uint2 b4 = (bool2((x & uint2((15u).xx))) ? uint2((0u).xx) : uint2((4u).xx)); - x = (x >> b4); - const uint2 b2 = (bool2((x & uint2((3u).xx))) ? uint2((0u).xx) : uint2((2u).xx)); - x = (x >> b2); - const uint2 b1 = (bool2((x & uint2((1u).xx))) ? uint2((0u).xx) : uint2((1u).xx)); - const uint2 is_zero = ((x == uint2((0u).xx)) ? uint2((1u).xx) : uint2((0u).xx)); - return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_1ad138() { - uint2 res = tint_count_trailing_zeros(uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countTrailingZeros_1ad138(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countTrailingZeros_1ad138(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countTrailingZeros_1ad138(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.msl b/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.msl deleted file mode 100644 index 1db16bf7eb..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countTrailingZeros_1ad138() { - uint2 res = ctz(uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countTrailingZeros_1ad138(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countTrailingZeros_1ad138(); - return; -} - -kernel void compute_main() { - countTrailingZeros_1ad138(); - return; -} - diff --git a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.spvasm b/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.spvasm deleted file mode 100644 index 96849eff1c..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.spvasm +++ /dev/null @@ -1,140 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 98 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" - OpName %v "v" - OpName %x "x" - OpName %countTrailingZeros_1ad138 "countTrailingZeros_1ad138" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %9 = OpTypeFunction %v2uint %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %18 = OpConstantNull %v2uint - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %uint_65535 = OpConstant %uint 65535 - %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %28 = OpConstantComposite %v2uint %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %30 = OpConstantComposite %v2uint %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %37 = OpConstantComposite %v2uint %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %40 = OpConstantComposite %v2uint %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %47 = OpConstantComposite %v2uint %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %50 = OpConstantComposite %v2uint %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %57 = OpConstantComposite %v2uint %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %60 = OpConstantComposite %v2uint %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v2uint %uint_1 %uint_1 - %void = OpTypeVoid - %78 = OpTypeFunction %void - %84 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_trailing_zeros = OpFunction %v2uint None %9 - %v = OpFunctionParameter %v2uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v2uint Function %18 - OpStore %x %v - %23 = OpLoad %v2uint %x - %26 = OpBitwiseAnd %v2uint %23 %25 - %20 = OpINotEqual %v2bool %26 %18 - %19 = OpSelect %v2uint %20 %28 %30 - %31 = OpLoad %v2uint %x - %32 = OpShiftRightLogical %v2uint %31 %19 - OpStore %x %32 - %35 = OpLoad %v2uint %x - %38 = OpBitwiseAnd %v2uint %35 %37 - %34 = OpINotEqual %v2bool %38 %18 - %33 = OpSelect %v2uint %34 %28 %40 - %41 = OpLoad %v2uint %x - %42 = OpShiftRightLogical %v2uint %41 %33 - OpStore %x %42 - %45 = OpLoad %v2uint %x - %48 = OpBitwiseAnd %v2uint %45 %47 - %44 = OpINotEqual %v2bool %48 %18 - %43 = OpSelect %v2uint %44 %28 %50 - %51 = OpLoad %v2uint %x - %52 = OpShiftRightLogical %v2uint %51 %43 - OpStore %x %52 - %55 = OpLoad %v2uint %x - %58 = OpBitwiseAnd %v2uint %55 %57 - %54 = OpINotEqual %v2bool %58 %18 - %53 = OpSelect %v2uint %54 %28 %60 - %61 = OpLoad %v2uint %x - %62 = OpShiftRightLogical %v2uint %61 %53 - OpStore %x %62 - %65 = OpLoad %v2uint %x - %68 = OpBitwiseAnd %v2uint %65 %67 - %64 = OpINotEqual %v2bool %68 %18 - %63 = OpSelect %v2uint %64 %28 %67 - %70 = OpLoad %v2uint %x - %71 = OpIEqual %v2bool %70 %28 - %69 = OpSelect %v2uint %71 %67 %28 - %73 = OpBitwiseOr %v2uint %19 %33 - %74 = OpBitwiseOr %v2uint %73 %43 - %75 = OpBitwiseOr %v2uint %74 %53 - %76 = OpBitwiseOr %v2uint %75 %63 - %77 = OpIAdd %v2uint %76 %69 - OpReturnValue %77 - OpFunctionEnd -%countTrailingZeros_1ad138 = OpFunction %void None %78 - %81 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %18 - %82 = OpFunctionCall %v2uint %tint_count_trailing_zeros %18 - OpStore %res %82 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %84 - %86 = OpLabel - %87 = OpFunctionCall %void %countTrailingZeros_1ad138 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %78 - %89 = OpLabel - %90 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %90 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %78 - %93 = OpLabel - %94 = OpFunctionCall %void %countTrailingZeros_1ad138 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %78 - %96 = OpLabel - %97 = OpFunctionCall %void %countTrailingZeros_1ad138 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.wgsl b/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.wgsl deleted file mode 100644 index 049f99f72c..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1ad138.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countTrailingZeros_1ad138() { - var res : vec2 = countTrailingZeros(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_1ad138(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_1ad138(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_1ad138(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl b/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl deleted file mode 100644 index 1d30317f5b..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countTrailingZeros(vec<4, i32>) -> vec<4, i32> -fn countTrailingZeros_1dc84a() { - var res: vec4 = countTrailingZeros(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_1dc84a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_1dc84a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_1dc84a(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.glsl b/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.glsl deleted file mode 100644 index ff17ff2f01..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec4 tint_count_trailing_zeros(ivec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_1dc84a() { - ivec4 res = tint_count_trailing_zeros(ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - countTrailingZeros_1dc84a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec4 tint_count_trailing_zeros(ivec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_1dc84a() { - ivec4 res = tint_count_trailing_zeros(ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - countTrailingZeros_1dc84a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec4 tint_count_trailing_zeros(ivec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_1dc84a() { - ivec4 res = tint_count_trailing_zeros(ivec4(0, 0, 0, 0)); -} - -void compute_main() { - countTrailingZeros_1dc84a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.hlsl b/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.hlsl deleted file mode 100644 index 6808031f08..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int4 tint_count_trailing_zeros(int4 v) { - uint4 x = uint4(v); - const uint4 b16 = (bool4((x & uint4((65535u).xxxx))) ? uint4((0u).xxxx) : uint4((16u).xxxx)); - x = (x >> b16); - const uint4 b8 = (bool4((x & uint4((255u).xxxx))) ? uint4((0u).xxxx) : uint4((8u).xxxx)); - x = (x >> b8); - const uint4 b4 = (bool4((x & uint4((15u).xxxx))) ? uint4((0u).xxxx) : uint4((4u).xxxx)); - x = (x >> b4); - const uint4 b2 = (bool4((x & uint4((3u).xxxx))) ? uint4((0u).xxxx) : uint4((2u).xxxx)); - x = (x >> b2); - const uint4 b1 = (bool4((x & uint4((1u).xxxx))) ? uint4((0u).xxxx) : uint4((1u).xxxx)); - const uint4 is_zero = ((x == uint4((0u).xxxx)) ? uint4((1u).xxxx) : uint4((0u).xxxx)); - return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_1dc84a() { - int4 res = tint_count_trailing_zeros(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countTrailingZeros_1dc84a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countTrailingZeros_1dc84a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countTrailingZeros_1dc84a(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.msl b/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.msl deleted file mode 100644 index 33863bf6f7..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countTrailingZeros_1dc84a() { - int4 res = ctz(int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countTrailingZeros_1dc84a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countTrailingZeros_1dc84a(); - return; -} - -kernel void compute_main() { - countTrailingZeros_1dc84a(); - return; -} - diff --git a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.spvasm b/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.spvasm deleted file mode 100644 index dfc1ee712f..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.spvasm +++ /dev/null @@ -1,146 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 102 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" - OpName %v "v" - OpName %x "x" - OpName %countTrailingZeros_1dc84a "countTrailingZeros_1dc84a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %9 = OpTypeFunction %v4int %v4int - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %20 = OpConstantNull %v4uint - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %uint_65535 = OpConstant %uint 65535 - %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %30 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %32 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %39 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %42 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %49 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %52 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %59 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %62 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %69 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 - %void = OpTypeVoid - %80 = OpTypeFunction %void - %85 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %88 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_trailing_zeros = OpFunction %v4int None %9 - %v = OpFunctionParameter %v4int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v4uint Function %20 - %15 = OpBitcast %v4uint %v - OpStore %x %15 - %25 = OpLoad %v4uint %x - %28 = OpBitwiseAnd %v4uint %25 %27 - %22 = OpINotEqual %v4bool %28 %20 - %21 = OpSelect %v4uint %22 %30 %32 - %33 = OpLoad %v4uint %x - %34 = OpShiftRightLogical %v4uint %33 %21 - OpStore %x %34 - %37 = OpLoad %v4uint %x - %40 = OpBitwiseAnd %v4uint %37 %39 - %36 = OpINotEqual %v4bool %40 %20 - %35 = OpSelect %v4uint %36 %30 %42 - %43 = OpLoad %v4uint %x - %44 = OpShiftRightLogical %v4uint %43 %35 - OpStore %x %44 - %47 = OpLoad %v4uint %x - %50 = OpBitwiseAnd %v4uint %47 %49 - %46 = OpINotEqual %v4bool %50 %20 - %45 = OpSelect %v4uint %46 %30 %52 - %53 = OpLoad %v4uint %x - %54 = OpShiftRightLogical %v4uint %53 %45 - OpStore %x %54 - %57 = OpLoad %v4uint %x - %60 = OpBitwiseAnd %v4uint %57 %59 - %56 = OpINotEqual %v4bool %60 %20 - %55 = OpSelect %v4uint %56 %30 %62 - %63 = OpLoad %v4uint %x - %64 = OpShiftRightLogical %v4uint %63 %55 - OpStore %x %64 - %67 = OpLoad %v4uint %x - %70 = OpBitwiseAnd %v4uint %67 %69 - %66 = OpINotEqual %v4bool %70 %20 - %65 = OpSelect %v4uint %66 %30 %69 - %72 = OpLoad %v4uint %x - %73 = OpIEqual %v4bool %72 %30 - %71 = OpSelect %v4uint %73 %69 %30 - %75 = OpBitwiseOr %v4uint %21 %35 - %76 = OpBitwiseOr %v4uint %75 %45 - %77 = OpBitwiseOr %v4uint %76 %55 - %78 = OpBitwiseOr %v4uint %77 %65 - %79 = OpIAdd %v4uint %78 %71 - %74 = OpBitcast %v4int %79 - OpReturnValue %74 - OpFunctionEnd -%countTrailingZeros_1dc84a = OpFunction %void None %80 - %83 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %85 - %84 = OpFunctionCall %v4int %tint_count_trailing_zeros %85 - OpStore %res %84 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %88 - %90 = OpLabel - %91 = OpFunctionCall %void %countTrailingZeros_1dc84a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %80 - %93 = OpLabel - %94 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %94 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %80 - %97 = OpLabel - %98 = OpFunctionCall %void %countTrailingZeros_1dc84a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %80 - %100 = OpLabel - %101 = OpFunctionCall %void %countTrailingZeros_1dc84a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.wgsl b/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.wgsl deleted file mode 100644 index de89ed5a51..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/1dc84a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countTrailingZeros_1dc84a() { - var res : vec4 = countTrailingZeros(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_1dc84a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_1dc84a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_1dc84a(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl b/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl deleted file mode 100644 index e2666714ca..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countTrailingZeros(u32) -> u32 -fn countTrailingZeros_21e394() { - var res: u32 = countTrailingZeros(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_21e394(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_21e394(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_21e394(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.glsl b/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.glsl deleted file mode 100644 index 1bbef2cdcf..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uint tint_count_trailing_zeros(uint v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_21e394() { - uint res = tint_count_trailing_zeros(1u); -} - -vec4 vertex_main() { - countTrailingZeros_21e394(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uint tint_count_trailing_zeros(uint v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_21e394() { - uint res = tint_count_trailing_zeros(1u); -} - -void fragment_main() { - countTrailingZeros_21e394(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uint tint_count_trailing_zeros(uint v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_21e394() { - uint res = tint_count_trailing_zeros(1u); -} - -void compute_main() { - countTrailingZeros_21e394(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.hlsl b/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.hlsl deleted file mode 100644 index ab5a62f133..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint tint_count_trailing_zeros(uint v) { - uint x = uint(v); - const uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - const uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - const uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - const uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - const uint b1 = (bool((x & 1u)) ? 0u : 1u); - const uint is_zero = ((x == 0u) ? 1u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_21e394() { - uint res = tint_count_trailing_zeros(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countTrailingZeros_21e394(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countTrailingZeros_21e394(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countTrailingZeros_21e394(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.msl b/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.msl deleted file mode 100644 index 224d4ce684..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countTrailingZeros_21e394() { - uint res = ctz(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countTrailingZeros_21e394(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countTrailingZeros_21e394(); - return; -} - -kernel void compute_main() { - countTrailingZeros_21e394(); - return; -} - diff --git a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.spvasm b/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.spvasm deleted file mode 100644 index 3d313b6858..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.spvasm +++ /dev/null @@ -1,128 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 86 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" - OpName %v "v" - OpName %x "x" - OpName %countTrailingZeros_21e394 "countTrailingZeros_21e394" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %uint %uint -%_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint - %bool = OpTypeBool - %uint_65535 = OpConstant %uint 65535 - %uint_0 = OpConstant %uint 0 - %uint_16 = OpConstant %uint 16 - %uint_255 = OpConstant %uint 255 - %uint_8 = OpConstant %uint 8 - %uint_15 = OpConstant %uint 15 - %uint_4 = OpConstant %uint 4 - %uint_3 = OpConstant %uint 3 - %uint_2 = OpConstant %uint 2 - %uint_1 = OpConstant %uint 1 - %void = OpTypeVoid - %66 = OpTypeFunction %void - %72 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_trailing_zeros = OpFunction %uint None %9 - %v = OpFunctionParameter %uint - %13 = OpLabel - %x = OpVariable %_ptr_Function_uint Function %17 - OpStore %x %v - %21 = OpLoad %uint %x - %23 = OpBitwiseAnd %uint %21 %uint_65535 - %19 = OpINotEqual %bool %23 %17 - %18 = OpSelect %uint %19 %uint_0 %uint_16 - %26 = OpLoad %uint %x - %27 = OpShiftRightLogical %uint %26 %18 - OpStore %x %27 - %30 = OpLoad %uint %x - %32 = OpBitwiseAnd %uint %30 %uint_255 - %29 = OpINotEqual %bool %32 %17 - %28 = OpSelect %uint %29 %uint_0 %uint_8 - %34 = OpLoad %uint %x - %35 = OpShiftRightLogical %uint %34 %28 - OpStore %x %35 - %38 = OpLoad %uint %x - %40 = OpBitwiseAnd %uint %38 %uint_15 - %37 = OpINotEqual %bool %40 %17 - %36 = OpSelect %uint %37 %uint_0 %uint_4 - %42 = OpLoad %uint %x - %43 = OpShiftRightLogical %uint %42 %36 - OpStore %x %43 - %46 = OpLoad %uint %x - %48 = OpBitwiseAnd %uint %46 %uint_3 - %45 = OpINotEqual %bool %48 %17 - %44 = OpSelect %uint %45 %uint_0 %uint_2 - %50 = OpLoad %uint %x - %51 = OpShiftRightLogical %uint %50 %44 - OpStore %x %51 - %54 = OpLoad %uint %x - %56 = OpBitwiseAnd %uint %54 %uint_1 - %53 = OpINotEqual %bool %56 %17 - %52 = OpSelect %uint %53 %uint_0 %uint_1 - %58 = OpLoad %uint %x - %59 = OpIEqual %bool %58 %uint_0 - %57 = OpSelect %uint %59 %uint_1 %uint_0 - %61 = OpBitwiseOr %uint %18 %28 - %62 = OpBitwiseOr %uint %61 %36 - %63 = OpBitwiseOr %uint %62 %44 - %64 = OpBitwiseOr %uint %63 %52 - %65 = OpIAdd %uint %64 %57 - OpReturnValue %65 - OpFunctionEnd -%countTrailingZeros_21e394 = OpFunction %void None %66 - %69 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %70 = OpFunctionCall %uint %tint_count_trailing_zeros %uint_1 - OpStore %res %70 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %72 - %74 = OpLabel - %75 = OpFunctionCall %void %countTrailingZeros_21e394 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %66 - %77 = OpLabel - %78 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %78 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %66 - %81 = OpLabel - %82 = OpFunctionCall %void %countTrailingZeros_21e394 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %66 - %84 = OpLabel - %85 = OpFunctionCall %void %countTrailingZeros_21e394 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.wgsl b/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.wgsl deleted file mode 100644 index a11d84963b..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/21e394.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countTrailingZeros_21e394() { - var res : u32 = countTrailingZeros(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_21e394(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_21e394(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_21e394(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl b/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl deleted file mode 100644 index 2aca57f61a..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countTrailingZeros(vec<2, i32>) -> vec<2, i32> -fn countTrailingZeros_327c37() { - var res: vec2 = countTrailingZeros(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_327c37(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_327c37(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_327c37(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.glsl b/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.glsl deleted file mode 100644 index a1fa87b5ba..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec2 tint_count_trailing_zeros(ivec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_327c37() { - ivec2 res = tint_count_trailing_zeros(ivec2(0, 0)); -} - -vec4 vertex_main() { - countTrailingZeros_327c37(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec2 tint_count_trailing_zeros(ivec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_327c37() { - ivec2 res = tint_count_trailing_zeros(ivec2(0, 0)); -} - -void fragment_main() { - countTrailingZeros_327c37(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec2 tint_count_trailing_zeros(ivec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_327c37() { - ivec2 res = tint_count_trailing_zeros(ivec2(0, 0)); -} - -void compute_main() { - countTrailingZeros_327c37(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.hlsl b/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.hlsl deleted file mode 100644 index c448cca713..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int2 tint_count_trailing_zeros(int2 v) { - uint2 x = uint2(v); - const uint2 b16 = (bool2((x & uint2((65535u).xx))) ? uint2((0u).xx) : uint2((16u).xx)); - x = (x >> b16); - const uint2 b8 = (bool2((x & uint2((255u).xx))) ? uint2((0u).xx) : uint2((8u).xx)); - x = (x >> b8); - const uint2 b4 = (bool2((x & uint2((15u).xx))) ? uint2((0u).xx) : uint2((4u).xx)); - x = (x >> b4); - const uint2 b2 = (bool2((x & uint2((3u).xx))) ? uint2((0u).xx) : uint2((2u).xx)); - x = (x >> b2); - const uint2 b1 = (bool2((x & uint2((1u).xx))) ? uint2((0u).xx) : uint2((1u).xx)); - const uint2 is_zero = ((x == uint2((0u).xx)) ? uint2((1u).xx) : uint2((0u).xx)); - return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_327c37() { - int2 res = tint_count_trailing_zeros(int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countTrailingZeros_327c37(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countTrailingZeros_327c37(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countTrailingZeros_327c37(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.msl b/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.msl deleted file mode 100644 index 3017464b97..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countTrailingZeros_327c37() { - int2 res = ctz(int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countTrailingZeros_327c37(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countTrailingZeros_327c37(); - return; -} - -kernel void compute_main() { - countTrailingZeros_327c37(); - return; -} - diff --git a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.spvasm b/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.spvasm deleted file mode 100644 index ddd198690a..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.spvasm +++ /dev/null @@ -1,146 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 102 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" - OpName %v "v" - OpName %x "x" - OpName %countTrailingZeros_327c37 "countTrailingZeros_327c37" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %9 = OpTypeFunction %v2int %v2int - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %20 = OpConstantNull %v2uint - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %uint_65535 = OpConstant %uint 65535 - %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %30 = OpConstantComposite %v2uint %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %32 = OpConstantComposite %v2uint %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %39 = OpConstantComposite %v2uint %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %42 = OpConstantComposite %v2uint %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %49 = OpConstantComposite %v2uint %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %52 = OpConstantComposite %v2uint %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %59 = OpConstantComposite %v2uint %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %62 = OpConstantComposite %v2uint %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %69 = OpConstantComposite %v2uint %uint_1 %uint_1 - %void = OpTypeVoid - %80 = OpTypeFunction %void - %85 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %88 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_trailing_zeros = OpFunction %v2int None %9 - %v = OpFunctionParameter %v2int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v2uint Function %20 - %15 = OpBitcast %v2uint %v - OpStore %x %15 - %25 = OpLoad %v2uint %x - %28 = OpBitwiseAnd %v2uint %25 %27 - %22 = OpINotEqual %v2bool %28 %20 - %21 = OpSelect %v2uint %22 %30 %32 - %33 = OpLoad %v2uint %x - %34 = OpShiftRightLogical %v2uint %33 %21 - OpStore %x %34 - %37 = OpLoad %v2uint %x - %40 = OpBitwiseAnd %v2uint %37 %39 - %36 = OpINotEqual %v2bool %40 %20 - %35 = OpSelect %v2uint %36 %30 %42 - %43 = OpLoad %v2uint %x - %44 = OpShiftRightLogical %v2uint %43 %35 - OpStore %x %44 - %47 = OpLoad %v2uint %x - %50 = OpBitwiseAnd %v2uint %47 %49 - %46 = OpINotEqual %v2bool %50 %20 - %45 = OpSelect %v2uint %46 %30 %52 - %53 = OpLoad %v2uint %x - %54 = OpShiftRightLogical %v2uint %53 %45 - OpStore %x %54 - %57 = OpLoad %v2uint %x - %60 = OpBitwiseAnd %v2uint %57 %59 - %56 = OpINotEqual %v2bool %60 %20 - %55 = OpSelect %v2uint %56 %30 %62 - %63 = OpLoad %v2uint %x - %64 = OpShiftRightLogical %v2uint %63 %55 - OpStore %x %64 - %67 = OpLoad %v2uint %x - %70 = OpBitwiseAnd %v2uint %67 %69 - %66 = OpINotEqual %v2bool %70 %20 - %65 = OpSelect %v2uint %66 %30 %69 - %72 = OpLoad %v2uint %x - %73 = OpIEqual %v2bool %72 %30 - %71 = OpSelect %v2uint %73 %69 %30 - %75 = OpBitwiseOr %v2uint %21 %35 - %76 = OpBitwiseOr %v2uint %75 %45 - %77 = OpBitwiseOr %v2uint %76 %55 - %78 = OpBitwiseOr %v2uint %77 %65 - %79 = OpIAdd %v2uint %78 %71 - %74 = OpBitcast %v2int %79 - OpReturnValue %74 - OpFunctionEnd -%countTrailingZeros_327c37 = OpFunction %void None %80 - %83 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %85 - %84 = OpFunctionCall %v2int %tint_count_trailing_zeros %85 - OpStore %res %84 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %88 - %90 = OpLabel - %91 = OpFunctionCall %void %countTrailingZeros_327c37 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %80 - %93 = OpLabel - %94 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %94 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %80 - %97 = OpLabel - %98 = OpFunctionCall %void %countTrailingZeros_327c37 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %80 - %100 = OpLabel - %101 = OpFunctionCall %void %countTrailingZeros_327c37 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.wgsl b/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.wgsl deleted file mode 100644 index b48dedfff8..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/327c37.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countTrailingZeros_327c37() { - var res : vec2 = countTrailingZeros(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_327c37(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_327c37(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_327c37(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl b/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl deleted file mode 100644 index 6006270964..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countTrailingZeros(i32) -> i32 -fn countTrailingZeros_42fed6() { - var res: i32 = countTrailingZeros(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_42fed6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_42fed6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_42fed6(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.glsl b/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.glsl deleted file mode 100644 index f1169c0d27..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -int tint_count_trailing_zeros(int v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_42fed6() { - int res = tint_count_trailing_zeros(1); -} - -vec4 vertex_main() { - countTrailingZeros_42fed6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -int tint_count_trailing_zeros(int v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_42fed6() { - int res = tint_count_trailing_zeros(1); -} - -void fragment_main() { - countTrailingZeros_42fed6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -int tint_count_trailing_zeros(int v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 1u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_42fed6() { - int res = tint_count_trailing_zeros(1); -} - -void compute_main() { - countTrailingZeros_42fed6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.hlsl b/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.hlsl deleted file mode 100644 index b885337265..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int tint_count_trailing_zeros(int v) { - uint x = uint(v); - const uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - const uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - const uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - const uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - const uint b1 = (bool((x & 1u)) ? 0u : 1u); - const uint is_zero = ((x == 0u) ? 1u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_42fed6() { - int res = tint_count_trailing_zeros(1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countTrailingZeros_42fed6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countTrailingZeros_42fed6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countTrailingZeros_42fed6(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.msl b/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.msl deleted file mode 100644 index 2d69179817..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countTrailingZeros_42fed6() { - int res = ctz(1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countTrailingZeros_42fed6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countTrailingZeros_42fed6(); - return; -} - -kernel void compute_main() { - countTrailingZeros_42fed6(); - return; -} - diff --git a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.spvasm b/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.spvasm deleted file mode 100644 index f5adcab446..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.spvasm +++ /dev/null @@ -1,134 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 90 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" - OpName %v "v" - OpName %x "x" - OpName %countTrailingZeros_42fed6 "countTrailingZeros_42fed6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %9 = OpTypeFunction %int %int - %uint = OpTypeInt 32 0 -%_ptr_Function_uint = OpTypePointer Function %uint - %18 = OpConstantNull %uint - %bool = OpTypeBool - %uint_65535 = OpConstant %uint 65535 - %uint_0 = OpConstant %uint 0 - %uint_16 = OpConstant %uint 16 - %uint_255 = OpConstant %uint 255 - %uint_8 = OpConstant %uint 8 - %uint_15 = OpConstant %uint 15 - %uint_4 = OpConstant %uint 4 - %uint_3 = OpConstant %uint 3 - %uint_2 = OpConstant %uint 2 - %uint_1 = OpConstant %uint 1 - %void = OpTypeVoid - %67 = OpTypeFunction %void - %int_1 = OpConstant %int 1 -%_ptr_Function_int = OpTypePointer Function %int - %75 = OpConstantNull %int - %76 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_trailing_zeros = OpFunction %int None %9 - %v = OpFunctionParameter %int - %13 = OpLabel - %x = OpVariable %_ptr_Function_uint Function %18 - %14 = OpBitcast %uint %v - OpStore %x %14 - %22 = OpLoad %uint %x - %24 = OpBitwiseAnd %uint %22 %uint_65535 - %20 = OpINotEqual %bool %24 %18 - %19 = OpSelect %uint %20 %uint_0 %uint_16 - %27 = OpLoad %uint %x - %28 = OpShiftRightLogical %uint %27 %19 - OpStore %x %28 - %31 = OpLoad %uint %x - %33 = OpBitwiseAnd %uint %31 %uint_255 - %30 = OpINotEqual %bool %33 %18 - %29 = OpSelect %uint %30 %uint_0 %uint_8 - %35 = OpLoad %uint %x - %36 = OpShiftRightLogical %uint %35 %29 - OpStore %x %36 - %39 = OpLoad %uint %x - %41 = OpBitwiseAnd %uint %39 %uint_15 - %38 = OpINotEqual %bool %41 %18 - %37 = OpSelect %uint %38 %uint_0 %uint_4 - %43 = OpLoad %uint %x - %44 = OpShiftRightLogical %uint %43 %37 - OpStore %x %44 - %47 = OpLoad %uint %x - %49 = OpBitwiseAnd %uint %47 %uint_3 - %46 = OpINotEqual %bool %49 %18 - %45 = OpSelect %uint %46 %uint_0 %uint_2 - %51 = OpLoad %uint %x - %52 = OpShiftRightLogical %uint %51 %45 - OpStore %x %52 - %55 = OpLoad %uint %x - %57 = OpBitwiseAnd %uint %55 %uint_1 - %54 = OpINotEqual %bool %57 %18 - %53 = OpSelect %uint %54 %uint_0 %uint_1 - %59 = OpLoad %uint %x - %60 = OpIEqual %bool %59 %uint_0 - %58 = OpSelect %uint %60 %uint_1 %uint_0 - %62 = OpBitwiseOr %uint %19 %29 - %63 = OpBitwiseOr %uint %62 %37 - %64 = OpBitwiseOr %uint %63 %45 - %65 = OpBitwiseOr %uint %64 %53 - %66 = OpIAdd %uint %65 %58 - %61 = OpBitcast %int %66 - OpReturnValue %61 - OpFunctionEnd -%countTrailingZeros_42fed6 = OpFunction %void None %67 - %70 = OpLabel - %res = OpVariable %_ptr_Function_int Function %75 - %71 = OpFunctionCall %int %tint_count_trailing_zeros %int_1 - OpStore %res %71 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %76 - %78 = OpLabel - %79 = OpFunctionCall %void %countTrailingZeros_42fed6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %67 - %81 = OpLabel - %82 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %82 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %67 - %85 = OpLabel - %86 = OpFunctionCall %void %countTrailingZeros_42fed6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %67 - %88 = OpLabel - %89 = OpFunctionCall %void %countTrailingZeros_42fed6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.wgsl b/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.wgsl deleted file mode 100644 index 6a560f3823..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/42fed6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countTrailingZeros_42fed6() { - var res : i32 = countTrailingZeros(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_42fed6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_42fed6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_42fed6(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl b/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl deleted file mode 100644 index 967f8007fa..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countTrailingZeros(vec<3, u32>) -> vec<3, u32> -fn countTrailingZeros_8ed26f() { - var res: vec3 = countTrailingZeros(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_8ed26f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_8ed26f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_8ed26f(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.glsl b/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.glsl deleted file mode 100644 index 8d1921a115..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec3 tint_count_trailing_zeros(uvec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_8ed26f() { - uvec3 res = tint_count_trailing_zeros(uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - countTrailingZeros_8ed26f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec3 tint_count_trailing_zeros(uvec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_8ed26f() { - uvec3 res = tint_count_trailing_zeros(uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - countTrailingZeros_8ed26f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec3 tint_count_trailing_zeros(uvec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_8ed26f() { - uvec3 res = tint_count_trailing_zeros(uvec3(0u, 0u, 0u)); -} - -void compute_main() { - countTrailingZeros_8ed26f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.hlsl b/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.hlsl deleted file mode 100644 index 5226a394c2..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint3 tint_count_trailing_zeros(uint3 v) { - uint3 x = uint3(v); - const uint3 b16 = (bool3((x & uint3((65535u).xxx))) ? uint3((0u).xxx) : uint3((16u).xxx)); - x = (x >> b16); - const uint3 b8 = (bool3((x & uint3((255u).xxx))) ? uint3((0u).xxx) : uint3((8u).xxx)); - x = (x >> b8); - const uint3 b4 = (bool3((x & uint3((15u).xxx))) ? uint3((0u).xxx) : uint3((4u).xxx)); - x = (x >> b4); - const uint3 b2 = (bool3((x & uint3((3u).xxx))) ? uint3((0u).xxx) : uint3((2u).xxx)); - x = (x >> b2); - const uint3 b1 = (bool3((x & uint3((1u).xxx))) ? uint3((0u).xxx) : uint3((1u).xxx)); - const uint3 is_zero = ((x == uint3((0u).xxx)) ? uint3((1u).xxx) : uint3((0u).xxx)); - return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_8ed26f() { - uint3 res = tint_count_trailing_zeros(uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countTrailingZeros_8ed26f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countTrailingZeros_8ed26f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countTrailingZeros_8ed26f(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.msl b/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.msl deleted file mode 100644 index 076a02d580..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countTrailingZeros_8ed26f() { - uint3 res = ctz(uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countTrailingZeros_8ed26f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countTrailingZeros_8ed26f(); - return; -} - -kernel void compute_main() { - countTrailingZeros_8ed26f(); - return; -} - diff --git a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.spvasm b/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.spvasm deleted file mode 100644 index 00db3764f5..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.spvasm +++ /dev/null @@ -1,140 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 98 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" - OpName %v "v" - OpName %x "x" - OpName %countTrailingZeros_8ed26f "countTrailingZeros_8ed26f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %9 = OpTypeFunction %v3uint %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %18 = OpConstantNull %v3uint - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %uint_65535 = OpConstant %uint 65535 - %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %28 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 - %void = OpTypeVoid - %78 = OpTypeFunction %void - %84 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_trailing_zeros = OpFunction %v3uint None %9 - %v = OpFunctionParameter %v3uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v3uint Function %18 - OpStore %x %v - %23 = OpLoad %v3uint %x - %26 = OpBitwiseAnd %v3uint %23 %25 - %20 = OpINotEqual %v3bool %26 %18 - %19 = OpSelect %v3uint %20 %28 %30 - %31 = OpLoad %v3uint %x - %32 = OpShiftRightLogical %v3uint %31 %19 - OpStore %x %32 - %35 = OpLoad %v3uint %x - %38 = OpBitwiseAnd %v3uint %35 %37 - %34 = OpINotEqual %v3bool %38 %18 - %33 = OpSelect %v3uint %34 %28 %40 - %41 = OpLoad %v3uint %x - %42 = OpShiftRightLogical %v3uint %41 %33 - OpStore %x %42 - %45 = OpLoad %v3uint %x - %48 = OpBitwiseAnd %v3uint %45 %47 - %44 = OpINotEqual %v3bool %48 %18 - %43 = OpSelect %v3uint %44 %28 %50 - %51 = OpLoad %v3uint %x - %52 = OpShiftRightLogical %v3uint %51 %43 - OpStore %x %52 - %55 = OpLoad %v3uint %x - %58 = OpBitwiseAnd %v3uint %55 %57 - %54 = OpINotEqual %v3bool %58 %18 - %53 = OpSelect %v3uint %54 %28 %60 - %61 = OpLoad %v3uint %x - %62 = OpShiftRightLogical %v3uint %61 %53 - OpStore %x %62 - %65 = OpLoad %v3uint %x - %68 = OpBitwiseAnd %v3uint %65 %67 - %64 = OpINotEqual %v3bool %68 %18 - %63 = OpSelect %v3uint %64 %28 %67 - %70 = OpLoad %v3uint %x - %71 = OpIEqual %v3bool %70 %28 - %69 = OpSelect %v3uint %71 %67 %28 - %73 = OpBitwiseOr %v3uint %19 %33 - %74 = OpBitwiseOr %v3uint %73 %43 - %75 = OpBitwiseOr %v3uint %74 %53 - %76 = OpBitwiseOr %v3uint %75 %63 - %77 = OpIAdd %v3uint %76 %69 - OpReturnValue %77 - OpFunctionEnd -%countTrailingZeros_8ed26f = OpFunction %void None %78 - %81 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %18 - %82 = OpFunctionCall %v3uint %tint_count_trailing_zeros %18 - OpStore %res %82 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %84 - %86 = OpLabel - %87 = OpFunctionCall %void %countTrailingZeros_8ed26f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %78 - %89 = OpLabel - %90 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %90 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %78 - %93 = OpLabel - %94 = OpFunctionCall %void %countTrailingZeros_8ed26f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %78 - %96 = OpLabel - %97 = OpFunctionCall %void %countTrailingZeros_8ed26f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.wgsl b/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.wgsl deleted file mode 100644 index 655674537c..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/8ed26f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countTrailingZeros_8ed26f() { - var res : vec3 = countTrailingZeros(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_8ed26f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_8ed26f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_8ed26f(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl b/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl deleted file mode 100644 index 3ba9cdeadb..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countTrailingZeros(vec<3, i32>) -> vec<3, i32> -fn countTrailingZeros_acfacb() { - var res: vec3 = countTrailingZeros(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_acfacb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_acfacb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_acfacb(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.glsl b/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.glsl deleted file mode 100644 index 70cded24ce..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec3 tint_count_trailing_zeros(ivec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_acfacb() { - ivec3 res = tint_count_trailing_zeros(ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - countTrailingZeros_acfacb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec3 tint_count_trailing_zeros(ivec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_acfacb() { - ivec3 res = tint_count_trailing_zeros(ivec3(0, 0, 0)); -} - -void fragment_main() { - countTrailingZeros_acfacb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec3 tint_count_trailing_zeros(ivec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_acfacb() { - ivec3 res = tint_count_trailing_zeros(ivec3(0, 0, 0)); -} - -void compute_main() { - countTrailingZeros_acfacb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.hlsl b/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.hlsl deleted file mode 100644 index 857896763b..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int3 tint_count_trailing_zeros(int3 v) { - uint3 x = uint3(v); - const uint3 b16 = (bool3((x & uint3((65535u).xxx))) ? uint3((0u).xxx) : uint3((16u).xxx)); - x = (x >> b16); - const uint3 b8 = (bool3((x & uint3((255u).xxx))) ? uint3((0u).xxx) : uint3((8u).xxx)); - x = (x >> b8); - const uint3 b4 = (bool3((x & uint3((15u).xxx))) ? uint3((0u).xxx) : uint3((4u).xxx)); - x = (x >> b4); - const uint3 b2 = (bool3((x & uint3((3u).xxx))) ? uint3((0u).xxx) : uint3((2u).xxx)); - x = (x >> b2); - const uint3 b1 = (bool3((x & uint3((1u).xxx))) ? uint3((0u).xxx) : uint3((1u).xxx)); - const uint3 is_zero = ((x == uint3((0u).xxx)) ? uint3((1u).xxx) : uint3((0u).xxx)); - return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_acfacb() { - int3 res = tint_count_trailing_zeros(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countTrailingZeros_acfacb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countTrailingZeros_acfacb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countTrailingZeros_acfacb(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.msl b/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.msl deleted file mode 100644 index 8fa6a02821..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countTrailingZeros_acfacb() { - int3 res = ctz(int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countTrailingZeros_acfacb(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countTrailingZeros_acfacb(); - return; -} - -kernel void compute_main() { - countTrailingZeros_acfacb(); - return; -} - diff --git a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.spvasm b/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.spvasm deleted file mode 100644 index 777e2ede10..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.spvasm +++ /dev/null @@ -1,146 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 102 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" - OpName %v "v" - OpName %x "x" - OpName %countTrailingZeros_acfacb "countTrailingZeros_acfacb" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %9 = OpTypeFunction %v3int %v3int - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %20 = OpConstantNull %v3uint - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %uint_65535 = OpConstant %uint 65535 - %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %30 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %32 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %39 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %42 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %49 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %52 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %59 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %62 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %69 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 - %void = OpTypeVoid - %80 = OpTypeFunction %void - %85 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %88 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_trailing_zeros = OpFunction %v3int None %9 - %v = OpFunctionParameter %v3int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v3uint Function %20 - %15 = OpBitcast %v3uint %v - OpStore %x %15 - %25 = OpLoad %v3uint %x - %28 = OpBitwiseAnd %v3uint %25 %27 - %22 = OpINotEqual %v3bool %28 %20 - %21 = OpSelect %v3uint %22 %30 %32 - %33 = OpLoad %v3uint %x - %34 = OpShiftRightLogical %v3uint %33 %21 - OpStore %x %34 - %37 = OpLoad %v3uint %x - %40 = OpBitwiseAnd %v3uint %37 %39 - %36 = OpINotEqual %v3bool %40 %20 - %35 = OpSelect %v3uint %36 %30 %42 - %43 = OpLoad %v3uint %x - %44 = OpShiftRightLogical %v3uint %43 %35 - OpStore %x %44 - %47 = OpLoad %v3uint %x - %50 = OpBitwiseAnd %v3uint %47 %49 - %46 = OpINotEqual %v3bool %50 %20 - %45 = OpSelect %v3uint %46 %30 %52 - %53 = OpLoad %v3uint %x - %54 = OpShiftRightLogical %v3uint %53 %45 - OpStore %x %54 - %57 = OpLoad %v3uint %x - %60 = OpBitwiseAnd %v3uint %57 %59 - %56 = OpINotEqual %v3bool %60 %20 - %55 = OpSelect %v3uint %56 %30 %62 - %63 = OpLoad %v3uint %x - %64 = OpShiftRightLogical %v3uint %63 %55 - OpStore %x %64 - %67 = OpLoad %v3uint %x - %70 = OpBitwiseAnd %v3uint %67 %69 - %66 = OpINotEqual %v3bool %70 %20 - %65 = OpSelect %v3uint %66 %30 %69 - %72 = OpLoad %v3uint %x - %73 = OpIEqual %v3bool %72 %30 - %71 = OpSelect %v3uint %73 %69 %30 - %75 = OpBitwiseOr %v3uint %21 %35 - %76 = OpBitwiseOr %v3uint %75 %45 - %77 = OpBitwiseOr %v3uint %76 %55 - %78 = OpBitwiseOr %v3uint %77 %65 - %79 = OpIAdd %v3uint %78 %71 - %74 = OpBitcast %v3int %79 - OpReturnValue %74 - OpFunctionEnd -%countTrailingZeros_acfacb = OpFunction %void None %80 - %83 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %85 - %84 = OpFunctionCall %v3int %tint_count_trailing_zeros %85 - OpStore %res %84 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %88 - %90 = OpLabel - %91 = OpFunctionCall %void %countTrailingZeros_acfacb - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %80 - %93 = OpLabel - %94 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %94 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %80 - %97 = OpLabel - %98 = OpFunctionCall %void %countTrailingZeros_acfacb - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %80 - %100 = OpLabel - %101 = OpFunctionCall %void %countTrailingZeros_acfacb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.wgsl b/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.wgsl deleted file mode 100644 index e375186519..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/acfacb.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countTrailingZeros_acfacb() { - var res : vec3 = countTrailingZeros(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_acfacb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_acfacb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_acfacb(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl b/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl deleted file mode 100644 index 71eb20dda5..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn countTrailingZeros(vec<4, u32>) -> vec<4, u32> -fn countTrailingZeros_d2b4a0() { - var res: vec4 = countTrailingZeros(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_d2b4a0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_d2b4a0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_d2b4a0(); -} diff --git a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.glsl b/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.glsl deleted file mode 100644 index ab8779549f..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec4 tint_count_trailing_zeros(uvec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_d2b4a0() { - uvec4 res = tint_count_trailing_zeros(uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - countTrailingZeros_d2b4a0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec4 tint_count_trailing_zeros(uvec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_d2b4a0() { - uvec4 res = tint_count_trailing_zeros(uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - countTrailingZeros_d2b4a0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec4 tint_count_trailing_zeros(uvec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_d2b4a0() { - uvec4 res = tint_count_trailing_zeros(uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - countTrailingZeros_d2b4a0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.hlsl b/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.hlsl deleted file mode 100644 index 5a2d9a965e..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint4 tint_count_trailing_zeros(uint4 v) { - uint4 x = uint4(v); - const uint4 b16 = (bool4((x & uint4((65535u).xxxx))) ? uint4((0u).xxxx) : uint4((16u).xxxx)); - x = (x >> b16); - const uint4 b8 = (bool4((x & uint4((255u).xxxx))) ? uint4((0u).xxxx) : uint4((8u).xxxx)); - x = (x >> b8); - const uint4 b4 = (bool4((x & uint4((15u).xxxx))) ? uint4((0u).xxxx) : uint4((4u).xxxx)); - x = (x >> b4); - const uint4 b2 = (bool4((x & uint4((3u).xxxx))) ? uint4((0u).xxxx) : uint4((2u).xxxx)); - x = (x >> b2); - const uint4 b1 = (bool4((x & uint4((1u).xxxx))) ? uint4((0u).xxxx) : uint4((1u).xxxx)); - const uint4 is_zero = ((x == uint4((0u).xxxx)) ? uint4((1u).xxxx) : uint4((0u).xxxx)); - return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); -} - -void countTrailingZeros_d2b4a0() { - uint4 res = tint_count_trailing_zeros(uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - countTrailingZeros_d2b4a0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - countTrailingZeros_d2b4a0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - countTrailingZeros_d2b4a0(); - return; -} diff --git a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.msl b/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.msl deleted file mode 100644 index 7954b94fa6..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void countTrailingZeros_d2b4a0() { - uint4 res = ctz(uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - countTrailingZeros_d2b4a0(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - countTrailingZeros_d2b4a0(); - return; -} - -kernel void compute_main() { - countTrailingZeros_d2b4a0(); - return; -} - diff --git a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.spvasm b/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.spvasm deleted file mode 100644 index 356c4169eb..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.spvasm +++ /dev/null @@ -1,140 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 98 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" - OpName %v "v" - OpName %x "x" - OpName %countTrailingZeros_d2b4a0 "countTrailingZeros_d2b4a0" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %9 = OpTypeFunction %v4uint %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %18 = OpConstantNull %v4uint - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %uint_65535 = OpConstant %uint 65535 - %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %28 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 - %void = OpTypeVoid - %78 = OpTypeFunction %void - %84 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_count_trailing_zeros = OpFunction %v4uint None %9 - %v = OpFunctionParameter %v4uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v4uint Function %18 - OpStore %x %v - %23 = OpLoad %v4uint %x - %26 = OpBitwiseAnd %v4uint %23 %25 - %20 = OpINotEqual %v4bool %26 %18 - %19 = OpSelect %v4uint %20 %28 %30 - %31 = OpLoad %v4uint %x - %32 = OpShiftRightLogical %v4uint %31 %19 - OpStore %x %32 - %35 = OpLoad %v4uint %x - %38 = OpBitwiseAnd %v4uint %35 %37 - %34 = OpINotEqual %v4bool %38 %18 - %33 = OpSelect %v4uint %34 %28 %40 - %41 = OpLoad %v4uint %x - %42 = OpShiftRightLogical %v4uint %41 %33 - OpStore %x %42 - %45 = OpLoad %v4uint %x - %48 = OpBitwiseAnd %v4uint %45 %47 - %44 = OpINotEqual %v4bool %48 %18 - %43 = OpSelect %v4uint %44 %28 %50 - %51 = OpLoad %v4uint %x - %52 = OpShiftRightLogical %v4uint %51 %43 - OpStore %x %52 - %55 = OpLoad %v4uint %x - %58 = OpBitwiseAnd %v4uint %55 %57 - %54 = OpINotEqual %v4bool %58 %18 - %53 = OpSelect %v4uint %54 %28 %60 - %61 = OpLoad %v4uint %x - %62 = OpShiftRightLogical %v4uint %61 %53 - OpStore %x %62 - %65 = OpLoad %v4uint %x - %68 = OpBitwiseAnd %v4uint %65 %67 - %64 = OpINotEqual %v4bool %68 %18 - %63 = OpSelect %v4uint %64 %28 %67 - %70 = OpLoad %v4uint %x - %71 = OpIEqual %v4bool %70 %28 - %69 = OpSelect %v4uint %71 %67 %28 - %73 = OpBitwiseOr %v4uint %19 %33 - %74 = OpBitwiseOr %v4uint %73 %43 - %75 = OpBitwiseOr %v4uint %74 %53 - %76 = OpBitwiseOr %v4uint %75 %63 - %77 = OpIAdd %v4uint %76 %69 - OpReturnValue %77 - OpFunctionEnd -%countTrailingZeros_d2b4a0 = OpFunction %void None %78 - %81 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %18 - %82 = OpFunctionCall %v4uint %tint_count_trailing_zeros %18 - OpStore %res %82 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %84 - %86 = OpLabel - %87 = OpFunctionCall %void %countTrailingZeros_d2b4a0 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %78 - %89 = OpLabel - %90 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %90 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %78 - %93 = OpLabel - %94 = OpFunctionCall %void %countTrailingZeros_d2b4a0 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %78 - %96 = OpLabel - %97 = OpFunctionCall %void %countTrailingZeros_d2b4a0 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.wgsl b/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.wgsl deleted file mode 100644 index d37e2a16c5..0000000000 --- a/test/tint/builtins/gen/countTrailingZeros/d2b4a0.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn countTrailingZeros_d2b4a0() { - var res : vec4 = countTrailingZeros(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - countTrailingZeros_d2b4a0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - countTrailingZeros_d2b4a0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - countTrailingZeros_d2b4a0(); -} diff --git a/test/tint/builtins/gen/cross/041cb0.wgsl b/test/tint/builtins/gen/cross/041cb0.wgsl deleted file mode 100644 index 91dc4dd1cd..0000000000 --- a/test/tint/builtins/gen/cross/041cb0.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn cross(vec3, vec3) -> vec3 -fn cross_041cb0() { - var res: vec3 = cross(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cross_041cb0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cross_041cb0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cross_041cb0(); -} diff --git a/test/tint/builtins/gen/cross/041cb0.wgsl.expected.glsl b/test/tint/builtins/gen/cross/041cb0.wgsl.expected.glsl deleted file mode 100644 index f1c9d98770..0000000000 --- a/test/tint/builtins/gen/cross/041cb0.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void cross_041cb0() { - vec3 res = cross(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - cross_041cb0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void cross_041cb0() { - vec3 res = cross(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - cross_041cb0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void cross_041cb0() { - vec3 res = cross(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - cross_041cb0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/cross/041cb0.wgsl.expected.hlsl b/test/tint/builtins/gen/cross/041cb0.wgsl.expected.hlsl deleted file mode 100644 index a4c63fbc99..0000000000 --- a/test/tint/builtins/gen/cross/041cb0.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void cross_041cb0() { - float3 res = cross(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - cross_041cb0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - cross_041cb0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - cross_041cb0(); - return; -} diff --git a/test/tint/builtins/gen/cross/041cb0.wgsl.expected.msl b/test/tint/builtins/gen/cross/041cb0.wgsl.expected.msl deleted file mode 100644 index 86e2546252..0000000000 --- a/test/tint/builtins/gen/cross/041cb0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void cross_041cb0() { - float3 res = cross(float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - cross_041cb0(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - cross_041cb0(); - return; -} - -kernel void compute_main() { - cross_041cb0(); - return; -} - diff --git a/test/tint/builtins/gen/cross/041cb0.wgsl.expected.wgsl b/test/tint/builtins/gen/cross/041cb0.wgsl.expected.wgsl deleted file mode 100644 index c3548ce7e4..0000000000 --- a/test/tint/builtins/gen/cross/041cb0.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn cross_041cb0() { - var res : vec3 = cross(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - cross_041cb0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - cross_041cb0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - cross_041cb0(); -} diff --git a/test/tint/builtins/gen/degrees/0d170c.wgsl b/test/tint/builtins/gen/degrees/0d170c.wgsl deleted file mode 100644 index ea8d9b0eac..0000000000 --- a/test/tint/builtins/gen/degrees/0d170c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn degrees(vec<4, f32>) -> vec<4, f32> -fn degrees_0d170c() { - var res: vec4 = degrees(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - degrees_0d170c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - degrees_0d170c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - degrees_0d170c(); -} diff --git a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.glsl b/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.glsl deleted file mode 100644 index 3c08ce8f48..0000000000 --- a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.glsl +++ /dev/null @@ -1,64 +0,0 @@ -#version 310 es - -vec4 tint_degrees(vec4 param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_0d170c() { - vec4 res = tint_degrees(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - degrees_0d170c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -vec4 tint_degrees(vec4 param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_0d170c() { - vec4 res = tint_degrees(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - degrees_0d170c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -vec4 tint_degrees(vec4 param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_0d170c() { - vec4 res = tint_degrees(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - degrees_0d170c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.hlsl b/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.hlsl deleted file mode 100644 index cc75fd7a6d..0000000000 --- a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -float4 tint_degrees(float4 param_0) { - return param_0 * 57.295779513082322865; -} - -void degrees_0d170c() { - float4 res = tint_degrees(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - degrees_0d170c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - degrees_0d170c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - degrees_0d170c(); - return; -} diff --git a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.msl b/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.msl deleted file mode 100644 index 2773179bd4..0000000000 --- a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -float4 tint_degrees(float4 param_0) { - return param_0 * 57.295779513082322865; -} - -void degrees_0d170c() { - float4 res = tint_degrees(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - degrees_0d170c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - degrees_0d170c(); - return; -} - -kernel void compute_main() { - degrees_0d170c(); - return; -} - diff --git a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.spvasm b/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.spvasm deleted file mode 100644 index f59e539322..0000000000 --- a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %degrees_0d170c "degrees_0d170c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%degrees_0d170c = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Degrees %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %degrees_0d170c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %degrees_0d170c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %degrees_0d170c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.wgsl b/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.wgsl deleted file mode 100644 index 6c62108eb1..0000000000 --- a/test/tint/builtins/gen/degrees/0d170c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn degrees_0d170c() { - var res : vec4 = degrees(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - degrees_0d170c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - degrees_0d170c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - degrees_0d170c(); -} diff --git a/test/tint/builtins/gen/degrees/1ad5df.wgsl b/test/tint/builtins/gen/degrees/1ad5df.wgsl deleted file mode 100644 index 5aefd49f09..0000000000 --- a/test/tint/builtins/gen/degrees/1ad5df.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn degrees(vec<2, f32>) -> vec<2, f32> -fn degrees_1ad5df() { - var res: vec2 = degrees(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - degrees_1ad5df(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - degrees_1ad5df(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - degrees_1ad5df(); -} diff --git a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.glsl b/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.glsl deleted file mode 100644 index b25e18042a..0000000000 --- a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.glsl +++ /dev/null @@ -1,64 +0,0 @@ -#version 310 es - -vec2 tint_degrees(vec2 param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_1ad5df() { - vec2 res = tint_degrees(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - degrees_1ad5df(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -vec2 tint_degrees(vec2 param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_1ad5df() { - vec2 res = tint_degrees(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - degrees_1ad5df(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -vec2 tint_degrees(vec2 param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_1ad5df() { - vec2 res = tint_degrees(vec2(0.0f, 0.0f)); -} - -void compute_main() { - degrees_1ad5df(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.hlsl b/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.hlsl deleted file mode 100644 index 577df5a708..0000000000 --- a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -float2 tint_degrees(float2 param_0) { - return param_0 * 57.295779513082322865; -} - -void degrees_1ad5df() { - float2 res = tint_degrees(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - degrees_1ad5df(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - degrees_1ad5df(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - degrees_1ad5df(); - return; -} diff --git a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.msl b/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.msl deleted file mode 100644 index 5305c0fb6f..0000000000 --- a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -float2 tint_degrees(float2 param_0) { - return param_0 * 57.295779513082322865; -} - -void degrees_1ad5df() { - float2 res = tint_degrees(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - degrees_1ad5df(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - degrees_1ad5df(); - return; -} - -kernel void compute_main() { - degrees_1ad5df(); - return; -} - diff --git a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.spvasm b/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.spvasm deleted file mode 100644 index 132b8ea59f..0000000000 --- a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %degrees_1ad5df "degrees_1ad5df" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%degrees_1ad5df = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Degrees %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %degrees_1ad5df - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %degrees_1ad5df - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %degrees_1ad5df - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.wgsl b/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.wgsl deleted file mode 100644 index db91a6528c..0000000000 --- a/test/tint/builtins/gen/degrees/1ad5df.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn degrees_1ad5df() { - var res : vec2 = degrees(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - degrees_1ad5df(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - degrees_1ad5df(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - degrees_1ad5df(); -} diff --git a/test/tint/builtins/gen/degrees/2af623.wgsl b/test/tint/builtins/gen/degrees/2af623.wgsl deleted file mode 100644 index a348fb1d59..0000000000 --- a/test/tint/builtins/gen/degrees/2af623.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn degrees(vec<3, f32>) -> vec<3, f32> -fn degrees_2af623() { - var res: vec3 = degrees(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - degrees_2af623(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - degrees_2af623(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - degrees_2af623(); -} diff --git a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.glsl b/test/tint/builtins/gen/degrees/2af623.wgsl.expected.glsl deleted file mode 100644 index 5fda564f31..0000000000 --- a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.glsl +++ /dev/null @@ -1,64 +0,0 @@ -#version 310 es - -vec3 tint_degrees(vec3 param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_2af623() { - vec3 res = tint_degrees(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - degrees_2af623(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -vec3 tint_degrees(vec3 param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_2af623() { - vec3 res = tint_degrees(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - degrees_2af623(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -vec3 tint_degrees(vec3 param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_2af623() { - vec3 res = tint_degrees(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - degrees_2af623(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.hlsl b/test/tint/builtins/gen/degrees/2af623.wgsl.expected.hlsl deleted file mode 100644 index 686a79e6e4..0000000000 --- a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -float3 tint_degrees(float3 param_0) { - return param_0 * 57.295779513082322865; -} - -void degrees_2af623() { - float3 res = tint_degrees(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - degrees_2af623(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - degrees_2af623(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - degrees_2af623(); - return; -} diff --git a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.msl b/test/tint/builtins/gen/degrees/2af623.wgsl.expected.msl deleted file mode 100644 index 46d0565e39..0000000000 --- a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -float3 tint_degrees(float3 param_0) { - return param_0 * 57.295779513082322865; -} - -void degrees_2af623() { - float3 res = tint_degrees(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - degrees_2af623(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - degrees_2af623(); - return; -} - -kernel void compute_main() { - degrees_2af623(); - return; -} - diff --git a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.spvasm b/test/tint/builtins/gen/degrees/2af623.wgsl.expected.spvasm deleted file mode 100644 index b9a9995af5..0000000000 --- a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %degrees_2af623 "degrees_2af623" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%degrees_2af623 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Degrees %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %degrees_2af623 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %degrees_2af623 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %degrees_2af623 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.wgsl b/test/tint/builtins/gen/degrees/2af623.wgsl.expected.wgsl deleted file mode 100644 index d3af418c96..0000000000 --- a/test/tint/builtins/gen/degrees/2af623.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn degrees_2af623() { - var res : vec3 = degrees(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - degrees_2af623(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - degrees_2af623(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - degrees_2af623(); -} diff --git a/test/tint/builtins/gen/degrees/51f705.wgsl b/test/tint/builtins/gen/degrees/51f705.wgsl deleted file mode 100644 index 54b7f32da7..0000000000 --- a/test/tint/builtins/gen/degrees/51f705.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn degrees(f32) -> f32 -fn degrees_51f705() { - var res: f32 = degrees(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - degrees_51f705(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - degrees_51f705(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - degrees_51f705(); -} diff --git a/test/tint/builtins/gen/degrees/51f705.wgsl.expected.glsl b/test/tint/builtins/gen/degrees/51f705.wgsl.expected.glsl deleted file mode 100644 index 1bfcfd1b6d..0000000000 --- a/test/tint/builtins/gen/degrees/51f705.wgsl.expected.glsl +++ /dev/null @@ -1,64 +0,0 @@ -#version 310 es - -float tint_degrees(float param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_51f705() { - float res = tint_degrees(1.0f); -} - -vec4 vertex_main() { - degrees_51f705(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -float tint_degrees(float param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_51f705() { - float res = tint_degrees(1.0f); -} - -void fragment_main() { - degrees_51f705(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -float tint_degrees(float param_0) { - return param_0 * 57.295779513082322865; -} - - -void degrees_51f705() { - float res = tint_degrees(1.0f); -} - -void compute_main() { - degrees_51f705(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/degrees/51f705.wgsl.expected.hlsl b/test/tint/builtins/gen/degrees/51f705.wgsl.expected.hlsl deleted file mode 100644 index 056d58f6ce..0000000000 --- a/test/tint/builtins/gen/degrees/51f705.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -float tint_degrees(float param_0) { - return param_0 * 57.295779513082322865; -} - -void degrees_51f705() { - float res = tint_degrees(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - degrees_51f705(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - degrees_51f705(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - degrees_51f705(); - return; -} diff --git a/test/tint/builtins/gen/degrees/51f705.wgsl.expected.msl b/test/tint/builtins/gen/degrees/51f705.wgsl.expected.msl deleted file mode 100644 index 2b6395dd67..0000000000 --- a/test/tint/builtins/gen/degrees/51f705.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -float tint_degrees(float param_0) { - return param_0 * 57.295779513082322865; -} - -void degrees_51f705() { - float res = tint_degrees(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - degrees_51f705(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - degrees_51f705(); - return; -} - -kernel void compute_main() { - degrees_51f705(); - return; -} - diff --git a/test/tint/builtins/gen/degrees/51f705.wgsl.expected.wgsl b/test/tint/builtins/gen/degrees/51f705.wgsl.expected.wgsl deleted file mode 100644 index 5ec8b91386..0000000000 --- a/test/tint/builtins/gen/degrees/51f705.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn degrees_51f705() { - var res : f32 = degrees(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - degrees_51f705(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - degrees_51f705(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - degrees_51f705(); -} diff --git a/test/tint/builtins/gen/determinant/2b62ba.wgsl b/test/tint/builtins/gen/determinant/2b62ba.wgsl deleted file mode 100644 index c409909e61..0000000000 --- a/test/tint/builtins/gen/determinant/2b62ba.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn determinant(mat<3, 3, f32>) -> f32 -fn determinant_2b62ba() { - var res: f32 = determinant(mat3x3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - determinant_2b62ba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - determinant_2b62ba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - determinant_2b62ba(); -} diff --git a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.glsl b/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.glsl deleted file mode 100644 index 0cbc139c4c..0000000000 --- a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void determinant_2b62ba() { - float res = determinant(mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - determinant_2b62ba(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void determinant_2b62ba() { - float res = determinant(mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - determinant_2b62ba(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void determinant_2b62ba() { - float res = determinant(mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - determinant_2b62ba(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.hlsl b/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.hlsl deleted file mode 100644 index 5f7441e152..0000000000 --- a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void determinant_2b62ba() { - float res = determinant(float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - determinant_2b62ba(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - determinant_2b62ba(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - determinant_2b62ba(); - return; -} diff --git a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.msl b/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.msl deleted file mode 100644 index 6953c6b38d..0000000000 --- a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void determinant_2b62ba() { - float res = determinant(float3x3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - determinant_2b62ba(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - determinant_2b62ba(); - return; -} - -kernel void compute_main() { - determinant_2b62ba(); - return; -} - diff --git a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.spvasm b/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.spvasm deleted file mode 100644 index 142bf18930..0000000000 --- a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %determinant_2b62ba "determinant_2b62ba" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 -%mat3v3float = OpTypeMatrix %v3float 3 - %17 = OpConstantNull %mat3v3float -%_ptr_Function_float = OpTypePointer Function %float - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%determinant_2b62ba = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Determinant %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %determinant_2b62ba - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %determinant_2b62ba - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %determinant_2b62ba - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.wgsl b/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.wgsl deleted file mode 100644 index b9c8bcd9c8..0000000000 --- a/test/tint/builtins/gen/determinant/2b62ba.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn determinant_2b62ba() { - var res : f32 = determinant(mat3x3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - determinant_2b62ba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - determinant_2b62ba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - determinant_2b62ba(); -} diff --git a/test/tint/builtins/gen/determinant/a0a87c.wgsl b/test/tint/builtins/gen/determinant/a0a87c.wgsl deleted file mode 100644 index e247511828..0000000000 --- a/test/tint/builtins/gen/determinant/a0a87c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn determinant(mat<4, 4, f32>) -> f32 -fn determinant_a0a87c() { - var res: f32 = determinant(mat4x4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - determinant_a0a87c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - determinant_a0a87c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - determinant_a0a87c(); -} diff --git a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.glsl b/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.glsl deleted file mode 100644 index 0fa9810ef7..0000000000 --- a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void determinant_a0a87c() { - float res = determinant(mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - determinant_a0a87c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void determinant_a0a87c() { - float res = determinant(mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - determinant_a0a87c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void determinant_a0a87c() { - float res = determinant(mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - determinant_a0a87c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.hlsl b/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.hlsl deleted file mode 100644 index a1c3513f07..0000000000 --- a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void determinant_a0a87c() { - float res = determinant(float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - determinant_a0a87c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - determinant_a0a87c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - determinant_a0a87c(); - return; -} diff --git a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.msl b/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.msl deleted file mode 100644 index 44820746f6..0000000000 --- a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void determinant_a0a87c() { - float res = determinant(float4x4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - determinant_a0a87c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - determinant_a0a87c(); - return; -} - -kernel void compute_main() { - determinant_a0a87c(); - return; -} - diff --git a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.spvasm b/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.spvasm deleted file mode 100644 index 8662898be0..0000000000 --- a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %determinant_a0a87c "determinant_a0a87c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%mat4v4float = OpTypeMatrix %v4float 4 - %16 = OpConstantNull %mat4v4float -%_ptr_Function_float = OpTypePointer Function %float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%determinant_a0a87c = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Determinant %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %determinant_a0a87c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %determinant_a0a87c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %determinant_a0a87c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.wgsl b/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.wgsl deleted file mode 100644 index 1352bafde8..0000000000 --- a/test/tint/builtins/gen/determinant/a0a87c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn determinant_a0a87c() { - var res : f32 = determinant(mat4x4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - determinant_a0a87c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - determinant_a0a87c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - determinant_a0a87c(); -} diff --git a/test/tint/builtins/gen/determinant/e19305.wgsl b/test/tint/builtins/gen/determinant/e19305.wgsl deleted file mode 100644 index 65866818ae..0000000000 --- a/test/tint/builtins/gen/determinant/e19305.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn determinant(mat<2, 2, f32>) -> f32 -fn determinant_e19305() { - var res: f32 = determinant(mat2x2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - determinant_e19305(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - determinant_e19305(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - determinant_e19305(); -} diff --git a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.glsl b/test/tint/builtins/gen/determinant/e19305.wgsl.expected.glsl deleted file mode 100644 index aa318d5bbc..0000000000 --- a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void determinant_e19305() { - float res = determinant(mat2(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - determinant_e19305(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void determinant_e19305() { - float res = determinant(mat2(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - determinant_e19305(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void determinant_e19305() { - float res = determinant(mat2(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - determinant_e19305(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.hlsl b/test/tint/builtins/gen/determinant/e19305.wgsl.expected.hlsl deleted file mode 100644 index ea91292cd1..0000000000 --- a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void determinant_e19305() { - float res = determinant(float2x2(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - determinant_e19305(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - determinant_e19305(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - determinant_e19305(); - return; -} diff --git a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.msl b/test/tint/builtins/gen/determinant/e19305.wgsl.expected.msl deleted file mode 100644 index ce236ae97e..0000000000 --- a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void determinant_e19305() { - float res = determinant(float2x2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - determinant_e19305(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - determinant_e19305(); - return; -} - -kernel void compute_main() { - determinant_e19305(); - return; -} - diff --git a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.spvasm b/test/tint/builtins/gen/determinant/e19305.wgsl.expected.spvasm deleted file mode 100644 index 5efdade524..0000000000 --- a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %determinant_e19305 "determinant_e19305" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 -%mat2v2float = OpTypeMatrix %v2float 2 - %17 = OpConstantNull %mat2v2float -%_ptr_Function_float = OpTypePointer Function %float - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%determinant_e19305 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Determinant %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %determinant_e19305 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %determinant_e19305 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %determinant_e19305 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.wgsl b/test/tint/builtins/gen/determinant/e19305.wgsl.expected.wgsl deleted file mode 100644 index 67724c6e24..0000000000 --- a/test/tint/builtins/gen/determinant/e19305.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn determinant_e19305() { - var res : f32 = determinant(mat2x2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - determinant_e19305(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - determinant_e19305(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - determinant_e19305(); -} diff --git a/test/tint/builtins/gen/distance/0657d4.wgsl b/test/tint/builtins/gen/distance/0657d4.wgsl deleted file mode 100644 index 760f0038f2..0000000000 --- a/test/tint/builtins/gen/distance/0657d4.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn distance(vec<3, f32>, vec<3, f32>) -> f32 -fn distance_0657d4() { - var res: f32 = distance(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - distance_0657d4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - distance_0657d4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - distance_0657d4(); -} diff --git a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.glsl b/test/tint/builtins/gen/distance/0657d4.wgsl.expected.glsl deleted file mode 100644 index 117bc7a118..0000000000 --- a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void distance_0657d4() { - float res = distance(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - distance_0657d4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void distance_0657d4() { - float res = distance(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - distance_0657d4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void distance_0657d4() { - float res = distance(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - distance_0657d4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.hlsl b/test/tint/builtins/gen/distance/0657d4.wgsl.expected.hlsl deleted file mode 100644 index 42d05491dd..0000000000 --- a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void distance_0657d4() { - float res = distance(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - distance_0657d4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - distance_0657d4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - distance_0657d4(); - return; -} diff --git a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.msl b/test/tint/builtins/gen/distance/0657d4.wgsl.expected.msl deleted file mode 100644 index 834ac1342f..0000000000 --- a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void distance_0657d4() { - float res = distance(float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - distance_0657d4(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - distance_0657d4(); - return; -} - -kernel void compute_main() { - distance_0657d4(); - return; -} - diff --git a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.spvasm b/test/tint/builtins/gen/distance/0657d4.wgsl.expected.spvasm deleted file mode 100644 index 433da6a460..0000000000 --- a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %distance_0657d4 "distance_0657d4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_float = OpTypePointer Function %float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%distance_0657d4 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Distance %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %distance_0657d4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %distance_0657d4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %distance_0657d4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.wgsl b/test/tint/builtins/gen/distance/0657d4.wgsl.expected.wgsl deleted file mode 100644 index 1945bbb160..0000000000 --- a/test/tint/builtins/gen/distance/0657d4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn distance_0657d4() { - var res : f32 = distance(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - distance_0657d4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - distance_0657d4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - distance_0657d4(); -} diff --git a/test/tint/builtins/gen/distance/9646ea.wgsl b/test/tint/builtins/gen/distance/9646ea.wgsl deleted file mode 100644 index d4ff160ee3..0000000000 --- a/test/tint/builtins/gen/distance/9646ea.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn distance(vec<4, f32>, vec<4, f32>) -> f32 -fn distance_9646ea() { - var res: f32 = distance(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - distance_9646ea(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - distance_9646ea(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - distance_9646ea(); -} diff --git a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.glsl b/test/tint/builtins/gen/distance/9646ea.wgsl.expected.glsl deleted file mode 100644 index 2f1166ef13..0000000000 --- a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void distance_9646ea() { - float res = distance(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - distance_9646ea(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void distance_9646ea() { - float res = distance(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - distance_9646ea(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void distance_9646ea() { - float res = distance(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - distance_9646ea(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.hlsl b/test/tint/builtins/gen/distance/9646ea.wgsl.expected.hlsl deleted file mode 100644 index 7ed7793758..0000000000 --- a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void distance_9646ea() { - float res = distance(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - distance_9646ea(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - distance_9646ea(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - distance_9646ea(); - return; -} diff --git a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.msl b/test/tint/builtins/gen/distance/9646ea.wgsl.expected.msl deleted file mode 100644 index 687568459b..0000000000 --- a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void distance_9646ea() { - float res = distance(float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - distance_9646ea(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - distance_9646ea(); - return; -} - -kernel void compute_main() { - distance_9646ea(); - return; -} - diff --git a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.spvasm b/test/tint/builtins/gen/distance/9646ea.wgsl.expected.spvasm deleted file mode 100644 index 18840fee80..0000000000 --- a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %distance_9646ea "distance_9646ea" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_float = OpTypePointer Function %float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%distance_9646ea = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Distance %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %distance_9646ea - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %distance_9646ea - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %distance_9646ea - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.wgsl b/test/tint/builtins/gen/distance/9646ea.wgsl.expected.wgsl deleted file mode 100644 index 0e02dff448..0000000000 --- a/test/tint/builtins/gen/distance/9646ea.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn distance_9646ea() { - var res : f32 = distance(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - distance_9646ea(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - distance_9646ea(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - distance_9646ea(); -} diff --git a/test/tint/builtins/gen/distance/aa4055.wgsl b/test/tint/builtins/gen/distance/aa4055.wgsl deleted file mode 100644 index 742f5766ba..0000000000 --- a/test/tint/builtins/gen/distance/aa4055.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn distance(vec<2, f32>, vec<2, f32>) -> f32 -fn distance_aa4055() { - var res: f32 = distance(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - distance_aa4055(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - distance_aa4055(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - distance_aa4055(); -} diff --git a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.glsl b/test/tint/builtins/gen/distance/aa4055.wgsl.expected.glsl deleted file mode 100644 index 80020a6ceb..0000000000 --- a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void distance_aa4055() { - float res = distance(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - distance_aa4055(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void distance_aa4055() { - float res = distance(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - distance_aa4055(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void distance_aa4055() { - float res = distance(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - distance_aa4055(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.hlsl b/test/tint/builtins/gen/distance/aa4055.wgsl.expected.hlsl deleted file mode 100644 index 2c2b43a8a7..0000000000 --- a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void distance_aa4055() { - float res = distance(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - distance_aa4055(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - distance_aa4055(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - distance_aa4055(); - return; -} diff --git a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.msl b/test/tint/builtins/gen/distance/aa4055.wgsl.expected.msl deleted file mode 100644 index b2d798b7b4..0000000000 --- a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void distance_aa4055() { - float res = distance(float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - distance_aa4055(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - distance_aa4055(); - return; -} - -kernel void compute_main() { - distance_aa4055(); - return; -} - diff --git a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.spvasm b/test/tint/builtins/gen/distance/aa4055.wgsl.expected.spvasm deleted file mode 100644 index c5976c6d04..0000000000 --- a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %distance_aa4055 "distance_aa4055" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_float = OpTypePointer Function %float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%distance_aa4055 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Distance %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %distance_aa4055 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %distance_aa4055 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %distance_aa4055 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.wgsl b/test/tint/builtins/gen/distance/aa4055.wgsl.expected.wgsl deleted file mode 100644 index 307399d742..0000000000 --- a/test/tint/builtins/gen/distance/aa4055.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn distance_aa4055() { - var res : f32 = distance(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - distance_aa4055(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - distance_aa4055(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - distance_aa4055(); -} diff --git a/test/tint/builtins/gen/distance/cfed73.wgsl b/test/tint/builtins/gen/distance/cfed73.wgsl deleted file mode 100644 index ab06206079..0000000000 --- a/test/tint/builtins/gen/distance/cfed73.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn distance(f32, f32) -> f32 -fn distance_cfed73() { - var res: f32 = distance(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - distance_cfed73(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - distance_cfed73(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - distance_cfed73(); -} diff --git a/test/tint/builtins/gen/distance/cfed73.wgsl.expected.glsl b/test/tint/builtins/gen/distance/cfed73.wgsl.expected.glsl deleted file mode 100644 index 672d01e3b5..0000000000 --- a/test/tint/builtins/gen/distance/cfed73.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void distance_cfed73() { - float res = distance(1.0f, 1.0f); -} - -vec4 vertex_main() { - distance_cfed73(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void distance_cfed73() { - float res = distance(1.0f, 1.0f); -} - -void fragment_main() { - distance_cfed73(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void distance_cfed73() { - float res = distance(1.0f, 1.0f); -} - -void compute_main() { - distance_cfed73(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/distance/cfed73.wgsl.expected.hlsl b/test/tint/builtins/gen/distance/cfed73.wgsl.expected.hlsl deleted file mode 100644 index 1d0c208408..0000000000 --- a/test/tint/builtins/gen/distance/cfed73.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void distance_cfed73() { - float res = distance(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - distance_cfed73(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - distance_cfed73(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - distance_cfed73(); - return; -} diff --git a/test/tint/builtins/gen/distance/cfed73.wgsl.expected.msl b/test/tint/builtins/gen/distance/cfed73.wgsl.expected.msl deleted file mode 100644 index 698ebb1b70..0000000000 --- a/test/tint/builtins/gen/distance/cfed73.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void distance_cfed73() { - float res = fabs(1.0f - 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - distance_cfed73(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - distance_cfed73(); - return; -} - -kernel void compute_main() { - distance_cfed73(); - return; -} - diff --git a/test/tint/builtins/gen/distance/cfed73.wgsl.expected.wgsl b/test/tint/builtins/gen/distance/cfed73.wgsl.expected.wgsl deleted file mode 100644 index db5bc7d901..0000000000 --- a/test/tint/builtins/gen/distance/cfed73.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn distance_cfed73() { - var res : f32 = distance(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - distance_cfed73(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - distance_cfed73(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - distance_cfed73(); -} diff --git a/test/tint/builtins/gen/dot/0c577b.wgsl b/test/tint/builtins/gen/dot/0c577b.wgsl deleted file mode 100644 index 4580e0ddf3..0000000000 --- a/test/tint/builtins/gen/dot/0c577b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dot(vec<4, f32>, vec<4, f32>) -> f32 -fn dot_0c577b() { - var res: f32 = dot(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_0c577b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_0c577b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_0c577b(); -} diff --git a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.glsl b/test/tint/builtins/gen/dot/0c577b.wgsl.expected.glsl deleted file mode 100644 index acf4859cfa..0000000000 --- a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void dot_0c577b() { - float res = dot(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - dot_0c577b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void dot_0c577b() { - float res = dot(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dot_0c577b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void dot_0c577b() { - float res = dot(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - dot_0c577b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.hlsl b/test/tint/builtins/gen/dot/0c577b.wgsl.expected.hlsl deleted file mode 100644 index a563beec04..0000000000 --- a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void dot_0c577b() { - float res = dot(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - dot_0c577b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - dot_0c577b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - dot_0c577b(); - return; -} diff --git a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.msl b/test/tint/builtins/gen/dot/0c577b.wgsl.expected.msl deleted file mode 100644 index 19de798eca..0000000000 --- a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void dot_0c577b() { - float res = dot(float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - dot_0c577b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - dot_0c577b(); - return; -} - -kernel void compute_main() { - dot_0c577b(); - return; -} - diff --git a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.spvasm b/test/tint/builtins/gen/dot/0c577b.wgsl.expected.spvasm deleted file mode 100644 index 9723182e8d..0000000000 --- a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.spvasm +++ /dev/null @@ -1,64 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 30 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %dot_0c577b "dot_0c577b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_float = OpTypePointer Function %float - %16 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %dot_0c577b = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpDot %float %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %16 - %18 = OpLabel - %19 = OpFunctionCall %void %dot_0c577b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %21 = OpLabel - %22 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %22 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %void %dot_0c577b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %dot_0c577b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.wgsl b/test/tint/builtins/gen/dot/0c577b.wgsl.expected.wgsl deleted file mode 100644 index 22411b9b57..0000000000 --- a/test/tint/builtins/gen/dot/0c577b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn dot_0c577b() { - var res : f32 = dot(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_0c577b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_0c577b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_0c577b(); -} diff --git a/test/tint/builtins/gen/dot/7548a0.wgsl b/test/tint/builtins/gen/dot/7548a0.wgsl deleted file mode 100644 index 2b0fccf76f..0000000000 --- a/test/tint/builtins/gen/dot/7548a0.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dot(vec<3, u32>, vec<3, u32>) -> u32 -fn dot_7548a0() { - var res: u32 = dot(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_7548a0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_7548a0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_7548a0(); -} diff --git a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.glsl b/test/tint/builtins/gen/dot/7548a0.wgsl.expected.glsl deleted file mode 100644 index c78810ea56..0000000000 --- a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.glsl +++ /dev/null @@ -1,61 +0,0 @@ -#version 310 es - -uint tint_int_dot(uvec3 a, uvec3 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; -} - -void dot_7548a0() { - uint res = tint_int_dot(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - dot_7548a0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uint tint_int_dot(uvec3 a, uvec3 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; -} - -void dot_7548a0() { - uint res = tint_int_dot(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - dot_7548a0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uint tint_int_dot(uvec3 a, uvec3 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; -} - -void dot_7548a0() { - uint res = tint_int_dot(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -void compute_main() { - dot_7548a0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.hlsl b/test/tint/builtins/gen/dot/7548a0.wgsl.expected.hlsl deleted file mode 100644 index 87fc5aeedf..0000000000 --- a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void dot_7548a0() { - uint res = dot(uint3(0u, 0u, 0u), uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - dot_7548a0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - dot_7548a0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - dot_7548a0(); - return; -} diff --git a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.msl b/test/tint/builtins/gen/dot/7548a0.wgsl.expected.msl deleted file mode 100644 index d0d876dcf8..0000000000 --- a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -template -T tint_dot3(vec a, vec b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; -} -void dot_7548a0() { - uint res = tint_dot3(uint3(), uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - dot_7548a0(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - dot_7548a0(); - return; -} - -kernel void compute_main() { - dot_7548a0(); - return; -} - diff --git a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.spvasm b/test/tint/builtins/gen/dot/7548a0.wgsl.expected.spvasm deleted file mode 100644 index 7d10efb8f1..0000000000 --- a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.spvasm +++ /dev/null @@ -1,78 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 44 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %dot_7548a0 "dot_7548a0" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %16 = OpConstantNull %v3uint -%_ptr_Function_uint = OpTypePointer Function %uint - %29 = OpConstantNull %uint - %30 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %dot_7548a0 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %29 - %17 = OpCompositeExtract %uint %16 0 - %18 = OpCompositeExtract %uint %16 0 - %19 = OpIMul %uint %17 %18 - %20 = OpCompositeExtract %uint %16 1 - %21 = OpCompositeExtract %uint %16 1 - %22 = OpIMul %uint %20 %21 - %23 = OpIAdd %uint %19 %22 - %24 = OpCompositeExtract %uint %16 2 - %25 = OpCompositeExtract %uint %16 2 - %26 = OpIMul %uint %24 %25 - %13 = OpIAdd %uint %23 %26 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %30 - %32 = OpLabel - %33 = OpFunctionCall %void %dot_7548a0 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %36 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %39 = OpLabel - %40 = OpFunctionCall %void %dot_7548a0 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %42 = OpLabel - %43 = OpFunctionCall %void %dot_7548a0 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.wgsl b/test/tint/builtins/gen/dot/7548a0.wgsl.expected.wgsl deleted file mode 100644 index c8b90177c6..0000000000 --- a/test/tint/builtins/gen/dot/7548a0.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn dot_7548a0() { - var res : u32 = dot(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_7548a0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_7548a0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_7548a0(); -} diff --git a/test/tint/builtins/gen/dot/883f0e.wgsl b/test/tint/builtins/gen/dot/883f0e.wgsl deleted file mode 100644 index 06618c1083..0000000000 --- a/test/tint/builtins/gen/dot/883f0e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dot(vec<2, f32>, vec<2, f32>) -> f32 -fn dot_883f0e() { - var res: f32 = dot(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_883f0e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_883f0e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_883f0e(); -} diff --git a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.glsl b/test/tint/builtins/gen/dot/883f0e.wgsl.expected.glsl deleted file mode 100644 index 2fe381833a..0000000000 --- a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void dot_883f0e() { - float res = dot(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - dot_883f0e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void dot_883f0e() { - float res = dot(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - dot_883f0e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void dot_883f0e() { - float res = dot(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - dot_883f0e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.hlsl b/test/tint/builtins/gen/dot/883f0e.wgsl.expected.hlsl deleted file mode 100644 index 23f4b8092e..0000000000 --- a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void dot_883f0e() { - float res = dot(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - dot_883f0e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - dot_883f0e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - dot_883f0e(); - return; -} diff --git a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.msl b/test/tint/builtins/gen/dot/883f0e.wgsl.expected.msl deleted file mode 100644 index 00dbb28578..0000000000 --- a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void dot_883f0e() { - float res = dot(float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - dot_883f0e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - dot_883f0e(); - return; -} - -kernel void compute_main() { - dot_883f0e(); - return; -} - diff --git a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.spvasm b/test/tint/builtins/gen/dot/883f0e.wgsl.expected.spvasm deleted file mode 100644 index 921e8919b3..0000000000 --- a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.spvasm +++ /dev/null @@ -1,66 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %dot_883f0e "dot_883f0e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %15 = OpConstantNull %v2float -%_ptr_Function_float = OpTypePointer Function %float - %18 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %dot_883f0e = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpDot %float %15 %15 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %dot_883f0e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %dot_883f0e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %dot_883f0e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.wgsl b/test/tint/builtins/gen/dot/883f0e.wgsl.expected.wgsl deleted file mode 100644 index 4be39c5e21..0000000000 --- a/test/tint/builtins/gen/dot/883f0e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn dot_883f0e() { - var res : f32 = dot(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_883f0e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_883f0e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_883f0e(); -} diff --git a/test/tint/builtins/gen/dot/97c7ee.wgsl b/test/tint/builtins/gen/dot/97c7ee.wgsl deleted file mode 100644 index d2dc8a4b7a..0000000000 --- a/test/tint/builtins/gen/dot/97c7ee.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dot(vec<2, u32>, vec<2, u32>) -> u32 -fn dot_97c7ee() { - var res: u32 = dot(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_97c7ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_97c7ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_97c7ee(); -} diff --git a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.glsl b/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.glsl deleted file mode 100644 index 573147370d..0000000000 --- a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.glsl +++ /dev/null @@ -1,61 +0,0 @@ -#version 310 es - -uint tint_int_dot(uvec2 a, uvec2 b) { - return a[0]*b[0] + a[1]*b[1]; -} - -void dot_97c7ee() { - uint res = tint_int_dot(uvec2(0u, 0u), uvec2(0u, 0u)); -} - -vec4 vertex_main() { - dot_97c7ee(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uint tint_int_dot(uvec2 a, uvec2 b) { - return a[0]*b[0] + a[1]*b[1]; -} - -void dot_97c7ee() { - uint res = tint_int_dot(uvec2(0u, 0u), uvec2(0u, 0u)); -} - -void fragment_main() { - dot_97c7ee(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uint tint_int_dot(uvec2 a, uvec2 b) { - return a[0]*b[0] + a[1]*b[1]; -} - -void dot_97c7ee() { - uint res = tint_int_dot(uvec2(0u, 0u), uvec2(0u, 0u)); -} - -void compute_main() { - dot_97c7ee(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.hlsl b/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.hlsl deleted file mode 100644 index b2623984bb..0000000000 --- a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void dot_97c7ee() { - uint res = dot(uint2(0u, 0u), uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - dot_97c7ee(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - dot_97c7ee(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - dot_97c7ee(); - return; -} diff --git a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.msl b/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.msl deleted file mode 100644 index ed799a17bf..0000000000 --- a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -template -T tint_dot2(vec a, vec b) { - return a[0]*b[0] + a[1]*b[1]; -} -void dot_97c7ee() { - uint res = tint_dot2(uint2(), uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - dot_97c7ee(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - dot_97c7ee(); - return; -} - -kernel void compute_main() { - dot_97c7ee(); - return; -} - diff --git a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.spvasm b/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.spvasm deleted file mode 100644 index 6cc49f91c2..0000000000 --- a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %dot_97c7ee "dot_97c7ee" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %16 = OpConstantNull %v2uint -%_ptr_Function_uint = OpTypePointer Function %uint - %25 = OpConstantNull %uint - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %dot_97c7ee = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %25 - %17 = OpCompositeExtract %uint %16 0 - %18 = OpCompositeExtract %uint %16 0 - %19 = OpIMul %uint %17 %18 - %20 = OpCompositeExtract %uint %16 1 - %21 = OpCompositeExtract %uint %16 1 - %22 = OpIMul %uint %20 %21 - %13 = OpIAdd %uint %19 %22 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %dot_97c7ee - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %dot_97c7ee - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %38 = OpLabel - %39 = OpFunctionCall %void %dot_97c7ee - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.wgsl b/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.wgsl deleted file mode 100644 index 488052d546..0000000000 --- a/test/tint/builtins/gen/dot/97c7ee.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn dot_97c7ee() { - var res : u32 = dot(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_97c7ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_97c7ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_97c7ee(); -} diff --git a/test/tint/builtins/gen/dot/ba4246.wgsl b/test/tint/builtins/gen/dot/ba4246.wgsl deleted file mode 100644 index 867556a357..0000000000 --- a/test/tint/builtins/gen/dot/ba4246.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dot(vec<3, f32>, vec<3, f32>) -> f32 -fn dot_ba4246() { - var res: f32 = dot(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_ba4246(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_ba4246(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_ba4246(); -} diff --git a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.glsl b/test/tint/builtins/gen/dot/ba4246.wgsl.expected.glsl deleted file mode 100644 index adbbc867b6..0000000000 --- a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void dot_ba4246() { - float res = dot(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - dot_ba4246(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void dot_ba4246() { - float res = dot(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dot_ba4246(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void dot_ba4246() { - float res = dot(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - dot_ba4246(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.hlsl b/test/tint/builtins/gen/dot/ba4246.wgsl.expected.hlsl deleted file mode 100644 index d34ad4d4fe..0000000000 --- a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void dot_ba4246() { - float res = dot(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - dot_ba4246(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - dot_ba4246(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - dot_ba4246(); - return; -} diff --git a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.msl b/test/tint/builtins/gen/dot/ba4246.wgsl.expected.msl deleted file mode 100644 index 9124e9475a..0000000000 --- a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void dot_ba4246() { - float res = dot(float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - dot_ba4246(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - dot_ba4246(); - return; -} - -kernel void compute_main() { - dot_ba4246(); - return; -} - diff --git a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.spvasm b/test/tint/builtins/gen/dot/ba4246.wgsl.expected.spvasm deleted file mode 100644 index 326501a658..0000000000 --- a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.spvasm +++ /dev/null @@ -1,66 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %dot_ba4246 "dot_ba4246" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %15 = OpConstantNull %v3float -%_ptr_Function_float = OpTypePointer Function %float - %18 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %dot_ba4246 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpDot %float %15 %15 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %dot_ba4246 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %dot_ba4246 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %dot_ba4246 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.wgsl b/test/tint/builtins/gen/dot/ba4246.wgsl.expected.wgsl deleted file mode 100644 index 7ddc8d16b1..0000000000 --- a/test/tint/builtins/gen/dot/ba4246.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn dot_ba4246() { - var res : f32 = dot(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_ba4246(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_ba4246(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_ba4246(); -} diff --git a/test/tint/builtins/gen/dot/e994c7.wgsl b/test/tint/builtins/gen/dot/e994c7.wgsl deleted file mode 100644 index 02ce1d0e98..0000000000 --- a/test/tint/builtins/gen/dot/e994c7.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dot(vec<4, u32>, vec<4, u32>) -> u32 -fn dot_e994c7() { - var res: u32 = dot(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_e994c7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_e994c7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_e994c7(); -} diff --git a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.glsl b/test/tint/builtins/gen/dot/e994c7.wgsl.expected.glsl deleted file mode 100644 index 4b6d0fc6c1..0000000000 --- a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.glsl +++ /dev/null @@ -1,61 +0,0 @@ -#version 310 es - -uint tint_int_dot(uvec4 a, uvec4 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; -} - -void dot_e994c7() { - uint res = tint_int_dot(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - dot_e994c7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uint tint_int_dot(uvec4 a, uvec4 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; -} - -void dot_e994c7() { - uint res = tint_int_dot(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - dot_e994c7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uint tint_int_dot(uvec4 a, uvec4 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; -} - -void dot_e994c7() { - uint res = tint_int_dot(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - dot_e994c7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.hlsl b/test/tint/builtins/gen/dot/e994c7.wgsl.expected.hlsl deleted file mode 100644 index 66f8a0dd59..0000000000 --- a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void dot_e994c7() { - uint res = dot(uint4(0u, 0u, 0u, 0u), uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - dot_e994c7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - dot_e994c7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - dot_e994c7(); - return; -} diff --git a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.msl b/test/tint/builtins/gen/dot/e994c7.wgsl.expected.msl deleted file mode 100644 index e2d1a32ffb..0000000000 --- a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -template -T tint_dot4(vec a, vec b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; -} -void dot_e994c7() { - uint res = tint_dot4(uint4(), uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - dot_e994c7(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - dot_e994c7(); - return; -} - -kernel void compute_main() { - dot_e994c7(); - return; -} - diff --git a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.spvasm b/test/tint/builtins/gen/dot/e994c7.wgsl.expected.spvasm deleted file mode 100644 index d852f9945f..0000000000 --- a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.spvasm +++ /dev/null @@ -1,82 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %dot_e994c7 "dot_e994c7" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %16 = OpConstantNull %v4uint -%_ptr_Function_uint = OpTypePointer Function %uint - %33 = OpConstantNull %uint - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %dot_e994c7 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %33 - %17 = OpCompositeExtract %uint %16 0 - %18 = OpCompositeExtract %uint %16 0 - %19 = OpIMul %uint %17 %18 - %20 = OpCompositeExtract %uint %16 1 - %21 = OpCompositeExtract %uint %16 1 - %22 = OpIMul %uint %20 %21 - %23 = OpIAdd %uint %19 %22 - %24 = OpCompositeExtract %uint %16 2 - %25 = OpCompositeExtract %uint %16 2 - %26 = OpIMul %uint %24 %25 - %27 = OpIAdd %uint %23 %26 - %28 = OpCompositeExtract %uint %16 3 - %29 = OpCompositeExtract %uint %16 3 - %30 = OpIMul %uint %28 %29 - %13 = OpIAdd %uint %27 %30 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %dot_e994c7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %43 = OpLabel - %44 = OpFunctionCall %void %dot_e994c7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %46 = OpLabel - %47 = OpFunctionCall %void %dot_e994c7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.wgsl b/test/tint/builtins/gen/dot/e994c7.wgsl.expected.wgsl deleted file mode 100644 index 2b549594de..0000000000 --- a/test/tint/builtins/gen/dot/e994c7.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn dot_e994c7() { - var res : u32 = dot(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_e994c7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_e994c7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_e994c7(); -} diff --git a/test/tint/builtins/gen/dot/ef6b1d.wgsl b/test/tint/builtins/gen/dot/ef6b1d.wgsl deleted file mode 100644 index be5a79e25f..0000000000 --- a/test/tint/builtins/gen/dot/ef6b1d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dot(vec<4, i32>, vec<4, i32>) -> i32 -fn dot_ef6b1d() { - var res: i32 = dot(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_ef6b1d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_ef6b1d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_ef6b1d(); -} diff --git a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.glsl b/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.glsl deleted file mode 100644 index ca3924265a..0000000000 --- a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.glsl +++ /dev/null @@ -1,61 +0,0 @@ -#version 310 es - -int tint_int_dot(ivec4 a, ivec4 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; -} - -void dot_ef6b1d() { - int res = tint_int_dot(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - dot_ef6b1d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -int tint_int_dot(ivec4 a, ivec4 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; -} - -void dot_ef6b1d() { - int res = tint_int_dot(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - dot_ef6b1d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -int tint_int_dot(ivec4 a, ivec4 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; -} - -void dot_ef6b1d() { - int res = tint_int_dot(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - dot_ef6b1d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.hlsl b/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.hlsl deleted file mode 100644 index 90b3adb876..0000000000 --- a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void dot_ef6b1d() { - int res = dot(int4(0, 0, 0, 0), int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - dot_ef6b1d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - dot_ef6b1d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - dot_ef6b1d(); - return; -} diff --git a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.msl b/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.msl deleted file mode 100644 index 47600314d4..0000000000 --- a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -template -T tint_dot4(vec a, vec b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; -} -void dot_ef6b1d() { - int res = tint_dot4(int4(), int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - dot_ef6b1d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - dot_ef6b1d(); - return; -} - -kernel void compute_main() { - dot_ef6b1d(); - return; -} - diff --git a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.spvasm b/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.spvasm deleted file mode 100644 index db22cad2df..0000000000 --- a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.spvasm +++ /dev/null @@ -1,82 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %dot_ef6b1d "dot_ef6b1d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %16 = OpConstantNull %v4int -%_ptr_Function_int = OpTypePointer Function %int - %33 = OpConstantNull %int - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %dot_ef6b1d = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_int Function %33 - %17 = OpCompositeExtract %int %16 0 - %18 = OpCompositeExtract %int %16 0 - %19 = OpIMul %int %17 %18 - %20 = OpCompositeExtract %int %16 1 - %21 = OpCompositeExtract %int %16 1 - %22 = OpIMul %int %20 %21 - %23 = OpIAdd %int %19 %22 - %24 = OpCompositeExtract %int %16 2 - %25 = OpCompositeExtract %int %16 2 - %26 = OpIMul %int %24 %25 - %27 = OpIAdd %int %23 %26 - %28 = OpCompositeExtract %int %16 3 - %29 = OpCompositeExtract %int %16 3 - %30 = OpIMul %int %28 %29 - %13 = OpIAdd %int %27 %30 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %dot_ef6b1d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %43 = OpLabel - %44 = OpFunctionCall %void %dot_ef6b1d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %46 = OpLabel - %47 = OpFunctionCall %void %dot_ef6b1d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.wgsl b/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.wgsl deleted file mode 100644 index 075cfcd34b..0000000000 --- a/test/tint/builtins/gen/dot/ef6b1d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn dot_ef6b1d() { - var res : i32 = dot(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_ef6b1d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_ef6b1d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_ef6b1d(); -} diff --git a/test/tint/builtins/gen/dot/f1312c.wgsl b/test/tint/builtins/gen/dot/f1312c.wgsl deleted file mode 100644 index 32e1075e0d..0000000000 --- a/test/tint/builtins/gen/dot/f1312c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dot(vec<3, i32>, vec<3, i32>) -> i32 -fn dot_f1312c() { - var res: i32 = dot(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_f1312c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_f1312c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_f1312c(); -} diff --git a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.glsl b/test/tint/builtins/gen/dot/f1312c.wgsl.expected.glsl deleted file mode 100644 index dc8c2e5fa4..0000000000 --- a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.glsl +++ /dev/null @@ -1,61 +0,0 @@ -#version 310 es - -int tint_int_dot(ivec3 a, ivec3 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; -} - -void dot_f1312c() { - int res = tint_int_dot(ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - dot_f1312c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -int tint_int_dot(ivec3 a, ivec3 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; -} - -void dot_f1312c() { - int res = tint_int_dot(ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -void fragment_main() { - dot_f1312c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -int tint_int_dot(ivec3 a, ivec3 b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; -} - -void dot_f1312c() { - int res = tint_int_dot(ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -void compute_main() { - dot_f1312c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.hlsl b/test/tint/builtins/gen/dot/f1312c.wgsl.expected.hlsl deleted file mode 100644 index 2c67fcce8a..0000000000 --- a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void dot_f1312c() { - int res = dot(int3(0, 0, 0), int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - dot_f1312c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - dot_f1312c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - dot_f1312c(); - return; -} diff --git a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.msl b/test/tint/builtins/gen/dot/f1312c.wgsl.expected.msl deleted file mode 100644 index ecf8b2d83e..0000000000 --- a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -template -T tint_dot3(vec a, vec b) { - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; -} -void dot_f1312c() { - int res = tint_dot3(int3(), int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - dot_f1312c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - dot_f1312c(); - return; -} - -kernel void compute_main() { - dot_f1312c(); - return; -} - diff --git a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.spvasm b/test/tint/builtins/gen/dot/f1312c.wgsl.expected.spvasm deleted file mode 100644 index 45222d1ff8..0000000000 --- a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.spvasm +++ /dev/null @@ -1,78 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 44 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %dot_f1312c "dot_f1312c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %16 = OpConstantNull %v3int -%_ptr_Function_int = OpTypePointer Function %int - %29 = OpConstantNull %int - %30 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %dot_f1312c = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_int Function %29 - %17 = OpCompositeExtract %int %16 0 - %18 = OpCompositeExtract %int %16 0 - %19 = OpIMul %int %17 %18 - %20 = OpCompositeExtract %int %16 1 - %21 = OpCompositeExtract %int %16 1 - %22 = OpIMul %int %20 %21 - %23 = OpIAdd %int %19 %22 - %24 = OpCompositeExtract %int %16 2 - %25 = OpCompositeExtract %int %16 2 - %26 = OpIMul %int %24 %25 - %13 = OpIAdd %int %23 %26 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %30 - %32 = OpLabel - %33 = OpFunctionCall %void %dot_f1312c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %36 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %39 = OpLabel - %40 = OpFunctionCall %void %dot_f1312c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %42 = OpLabel - %43 = OpFunctionCall %void %dot_f1312c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.wgsl b/test/tint/builtins/gen/dot/f1312c.wgsl.expected.wgsl deleted file mode 100644 index 7440cf96b9..0000000000 --- a/test/tint/builtins/gen/dot/f1312c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn dot_f1312c() { - var res : i32 = dot(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_f1312c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_f1312c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_f1312c(); -} diff --git a/test/tint/builtins/gen/dot/fc5f7c.wgsl b/test/tint/builtins/gen/dot/fc5f7c.wgsl deleted file mode 100644 index 5cd141daea..0000000000 --- a/test/tint/builtins/gen/dot/fc5f7c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dot(vec<2, i32>, vec<2, i32>) -> i32 -fn dot_fc5f7c() { - var res: i32 = dot(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_fc5f7c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_fc5f7c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_fc5f7c(); -} diff --git a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.glsl b/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.glsl deleted file mode 100644 index 73c8588565..0000000000 --- a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.glsl +++ /dev/null @@ -1,61 +0,0 @@ -#version 310 es - -int tint_int_dot(ivec2 a, ivec2 b) { - return a[0]*b[0] + a[1]*b[1]; -} - -void dot_fc5f7c() { - int res = tint_int_dot(ivec2(0, 0), ivec2(0, 0)); -} - -vec4 vertex_main() { - dot_fc5f7c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -int tint_int_dot(ivec2 a, ivec2 b) { - return a[0]*b[0] + a[1]*b[1]; -} - -void dot_fc5f7c() { - int res = tint_int_dot(ivec2(0, 0), ivec2(0, 0)); -} - -void fragment_main() { - dot_fc5f7c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -int tint_int_dot(ivec2 a, ivec2 b) { - return a[0]*b[0] + a[1]*b[1]; -} - -void dot_fc5f7c() { - int res = tint_int_dot(ivec2(0, 0), ivec2(0, 0)); -} - -void compute_main() { - dot_fc5f7c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.hlsl b/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.hlsl deleted file mode 100644 index 22ff835463..0000000000 --- a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void dot_fc5f7c() { - int res = dot(int2(0, 0), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - dot_fc5f7c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - dot_fc5f7c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - dot_fc5f7c(); - return; -} diff --git a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.msl b/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.msl deleted file mode 100644 index 199ff06af1..0000000000 --- a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -template -T tint_dot2(vec a, vec b) { - return a[0]*b[0] + a[1]*b[1]; -} -void dot_fc5f7c() { - int res = tint_dot2(int2(), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - dot_fc5f7c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - dot_fc5f7c(); - return; -} - -kernel void compute_main() { - dot_fc5f7c(); - return; -} - diff --git a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.spvasm b/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.spvasm deleted file mode 100644 index 6f05cef306..0000000000 --- a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %dot_fc5f7c "dot_fc5f7c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %16 = OpConstantNull %v2int -%_ptr_Function_int = OpTypePointer Function %int - %25 = OpConstantNull %int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %dot_fc5f7c = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_int Function %25 - %17 = OpCompositeExtract %int %16 0 - %18 = OpCompositeExtract %int %16 0 - %19 = OpIMul %int %17 %18 - %20 = OpCompositeExtract %int %16 1 - %21 = OpCompositeExtract %int %16 1 - %22 = OpIMul %int %20 %21 - %13 = OpIAdd %int %19 %22 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %dot_fc5f7c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %dot_fc5f7c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %38 = OpLabel - %39 = OpFunctionCall %void %dot_fc5f7c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.wgsl b/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.wgsl deleted file mode 100644 index 6d30122343..0000000000 --- a/test/tint/builtins/gen/dot/fc5f7c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn dot_fc5f7c() { - var res : i32 = dot(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - dot_fc5f7c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - dot_fc5f7c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - dot_fc5f7c(); -} diff --git a/test/tint/builtins/gen/dpdx/0763f7.wgsl b/test/tint/builtins/gen/dpdx/0763f7.wgsl deleted file mode 100644 index 8c44f2a8e9..0000000000 --- a/test/tint/builtins/gen/dpdx/0763f7.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdx(vec<3, f32>) -> vec<3, f32> -fn dpdx_0763f7() { - var res: vec3 = dpdx(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdx_0763f7(); -} diff --git a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.glsl b/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.glsl deleted file mode 100644 index afd86a644d..0000000000 --- a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdx_0763f7() { - vec3 res = dFdx(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdx_0763f7(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.hlsl deleted file mode 100644 index f9c5475b46..0000000000 --- a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdx_0763f7() { - float3 res = ddx(float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdx_0763f7(); - return; -} diff --git a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.msl b/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.msl deleted file mode 100644 index a7719d71bf..0000000000 --- a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdx_0763f7() { - float3 res = dfdx(float3()); -} - -fragment void fragment_main() { - dpdx_0763f7(); - return; -} - diff --git a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.spvasm deleted file mode 100644 index 4a1bd28b90..0000000000 --- a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.spvasm +++ /dev/null @@ -1,30 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdx_0763f7 "dpdx_0763f7" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %8 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float -%dpdx_0763f7 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %8 - %5 = OpDPdx %v3float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdx_0763f7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.wgsl deleted file mode 100644 index 15235d627f..0000000000 --- a/test/tint/builtins/gen/dpdx/0763f7.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdx_0763f7() { - var res : vec3 = dpdx(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdx_0763f7(); -} diff --git a/test/tint/builtins/gen/dpdx/99edb1.wgsl b/test/tint/builtins/gen/dpdx/99edb1.wgsl deleted file mode 100644 index 3231b03f96..0000000000 --- a/test/tint/builtins/gen/dpdx/99edb1.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdx(vec<2, f32>) -> vec<2, f32> -fn dpdx_99edb1() { - var res: vec2 = dpdx(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdx_99edb1(); -} diff --git a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.glsl b/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.glsl deleted file mode 100644 index 9e216a1ade..0000000000 --- a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdx_99edb1() { - vec2 res = dFdx(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdx_99edb1(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.hlsl deleted file mode 100644 index 98dd75142a..0000000000 --- a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdx_99edb1() { - float2 res = ddx(float2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdx_99edb1(); - return; -} diff --git a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.msl b/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.msl deleted file mode 100644 index c1583821c1..0000000000 --- a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdx_99edb1() { - float2 res = dfdx(float2()); -} - -fragment void fragment_main() { - dpdx_99edb1(); - return; -} - diff --git a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.spvasm deleted file mode 100644 index 7499b26422..0000000000 --- a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.spvasm +++ /dev/null @@ -1,30 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdx_99edb1 "dpdx_99edb1" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %8 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%dpdx_99edb1 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %8 - %5 = OpDPdx %v2float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdx_99edb1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.wgsl deleted file mode 100644 index 7405f0fe79..0000000000 --- a/test/tint/builtins/gen/dpdx/99edb1.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdx_99edb1() { - var res : vec2 = dpdx(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdx_99edb1(); -} diff --git a/test/tint/builtins/gen/dpdx/c487fa.wgsl b/test/tint/builtins/gen/dpdx/c487fa.wgsl deleted file mode 100644 index 857bad4ce8..0000000000 --- a/test/tint/builtins/gen/dpdx/c487fa.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdx(vec<4, f32>) -> vec<4, f32> -fn dpdx_c487fa() { - var res: vec4 = dpdx(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdx_c487fa(); -} diff --git a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.glsl b/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.glsl deleted file mode 100644 index c16518146a..0000000000 --- a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdx_c487fa() { - vec4 res = dFdx(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdx_c487fa(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.hlsl deleted file mode 100644 index 12185e9fde..0000000000 --- a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdx_c487fa() { - float4 res = ddx(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdx_c487fa(); - return; -} diff --git a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.msl b/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.msl deleted file mode 100644 index bb43c52cdf..0000000000 --- a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdx_c487fa() { - float4 res = dfdx(float4()); -} - -fragment void fragment_main() { - dpdx_c487fa(); - return; -} - diff --git a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.spvasm deleted file mode 100644 index 3065b31241..0000000000 --- a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.spvasm +++ /dev/null @@ -1,30 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdx_c487fa "dpdx_c487fa" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 - %8 = OpConstantNull %v4float -%_ptr_Function_v4float = OpTypePointer Function %v4float -%dpdx_c487fa = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %8 - %5 = OpDPdx %v4float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdx_c487fa - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.wgsl deleted file mode 100644 index f2ebe8e25a..0000000000 --- a/test/tint/builtins/gen/dpdx/c487fa.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdx_c487fa() { - var res : vec4 = dpdx(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdx_c487fa(); -} diff --git a/test/tint/builtins/gen/dpdx/e263de.wgsl b/test/tint/builtins/gen/dpdx/e263de.wgsl deleted file mode 100644 index a95caa7ff8..0000000000 --- a/test/tint/builtins/gen/dpdx/e263de.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdx(f32) -> f32 -fn dpdx_e263de() { - var res: f32 = dpdx(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdx_e263de(); -} diff --git a/test/tint/builtins/gen/dpdx/e263de.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdx/e263de.wgsl.expected.wgsl deleted file mode 100644 index ac653d8cba..0000000000 --- a/test/tint/builtins/gen/dpdx/e263de.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdx_e263de() { - var res : f32 = dpdx(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdx_e263de(); -} diff --git a/test/tint/builtins/gen/dpdxCoarse/029152.wgsl b/test/tint/builtins/gen/dpdxCoarse/029152.wgsl deleted file mode 100644 index 86d126d404..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/029152.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdxCoarse(f32) -> f32 -fn dpdxCoarse_029152() { - var res: f32 = dpdxCoarse(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdxCoarse_029152(); -} diff --git a/test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.wgsl deleted file mode 100644 index 38fe60cef1..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdxCoarse_029152() { - var res : f32 = dpdxCoarse(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdxCoarse_029152(); -} diff --git a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl b/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl deleted file mode 100644 index 54dd7e45e4..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdxCoarse(vec<2, f32>) -> vec<2, f32> -fn dpdxCoarse_9581cf() { - var res: vec2 = dpdxCoarse(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdxCoarse_9581cf(); -} diff --git a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.glsl b/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.glsl deleted file mode 100644 index 448520eea0..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdxCoarse_9581cf() { - vec2 res = dFdx(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdxCoarse_9581cf(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.hlsl deleted file mode 100644 index c716d0480a..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdxCoarse_9581cf() { - float2 res = ddx_coarse(float2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdxCoarse_9581cf(); - return; -} diff --git a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.msl b/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.msl deleted file mode 100644 index 8bbf1acde1..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdxCoarse_9581cf() { - float2 res = dfdx(float2()); -} - -fragment void fragment_main() { - dpdxCoarse_9581cf(); - return; -} - diff --git a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.spvasm deleted file mode 100644 index 8113530178..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdxCoarse_9581cf "dpdxCoarse_9581cf" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %8 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%dpdxCoarse_9581cf = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %8 - %5 = OpDPdxCoarse %v2float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdxCoarse_9581cf - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.wgsl deleted file mode 100644 index 51ac0a5a82..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/9581cf.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdxCoarse_9581cf() { - var res : vec2 = dpdxCoarse(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdxCoarse_9581cf(); -} diff --git a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl b/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl deleted file mode 100644 index 20ae7bfafe..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdxCoarse(vec<4, f32>) -> vec<4, f32> -fn dpdxCoarse_c28641() { - var res: vec4 = dpdxCoarse(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdxCoarse_c28641(); -} diff --git a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.glsl b/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.glsl deleted file mode 100644 index 06c1a26e53..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdxCoarse_c28641() { - vec4 res = dFdx(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdxCoarse_c28641(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.hlsl deleted file mode 100644 index a4a21b6165..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdxCoarse_c28641() { - float4 res = ddx_coarse(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdxCoarse_c28641(); - return; -} diff --git a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.msl b/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.msl deleted file mode 100644 index 62b43ef782..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdxCoarse_c28641() { - float4 res = dfdx(float4()); -} - -fragment void fragment_main() { - dpdxCoarse_c28641(); - return; -} - diff --git a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.spvasm deleted file mode 100644 index fbf633711a..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdxCoarse_c28641 "dpdxCoarse_c28641" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 - %8 = OpConstantNull %v4float -%_ptr_Function_v4float = OpTypePointer Function %v4float -%dpdxCoarse_c28641 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %8 - %5 = OpDPdxCoarse %v4float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdxCoarse_c28641 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.wgsl deleted file mode 100644 index 51fa7dc0e0..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/c28641.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdxCoarse_c28641() { - var res : vec4 = dpdxCoarse(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdxCoarse_c28641(); -} diff --git a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl b/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl deleted file mode 100644 index 81681e566c..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdxCoarse(vec<3, f32>) -> vec<3, f32> -fn dpdxCoarse_f64d7b() { - var res: vec3 = dpdxCoarse(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdxCoarse_f64d7b(); -} diff --git a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.glsl b/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.glsl deleted file mode 100644 index 549fd3c613..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdxCoarse_f64d7b() { - vec3 res = dFdx(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdxCoarse_f64d7b(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.hlsl deleted file mode 100644 index dd67ed0c2d..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdxCoarse_f64d7b() { - float3 res = ddx_coarse(float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdxCoarse_f64d7b(); - return; -} diff --git a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.msl b/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.msl deleted file mode 100644 index 8c4d03840c..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdxCoarse_f64d7b() { - float3 res = dfdx(float3()); -} - -fragment void fragment_main() { - dpdxCoarse_f64d7b(); - return; -} - diff --git a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.spvasm deleted file mode 100644 index 86b062848d..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdxCoarse_f64d7b "dpdxCoarse_f64d7b" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %8 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float -%dpdxCoarse_f64d7b = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %8 - %5 = OpDPdxCoarse %v3float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdxCoarse_f64d7b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.wgsl deleted file mode 100644 index f5a9d29ab0..0000000000 --- a/test/tint/builtins/gen/dpdxCoarse/f64d7b.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdxCoarse_f64d7b() { - var res : vec3 = dpdxCoarse(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdxCoarse_f64d7b(); -} diff --git a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl b/test/tint/builtins/gen/dpdxFine/8c5069.wgsl deleted file mode 100644 index 1b4274d8dc..0000000000 --- a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdxFine(vec<4, f32>) -> vec<4, f32> -fn dpdxFine_8c5069() { - var res: vec4 = dpdxFine(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdxFine_8c5069(); -} diff --git a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.glsl b/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.glsl deleted file mode 100644 index 22d75e5eba..0000000000 --- a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdxFine_8c5069() { - vec4 res = dFdx(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdxFine_8c5069(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.hlsl deleted file mode 100644 index 7092cb843a..0000000000 --- a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdxFine_8c5069() { - float4 res = ddx_fine(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdxFine_8c5069(); - return; -} diff --git a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.msl b/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.msl deleted file mode 100644 index 6b2bc94ac8..0000000000 --- a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdxFine_8c5069() { - float4 res = dfdx(float4()); -} - -fragment void fragment_main() { - dpdxFine_8c5069(); - return; -} - diff --git a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.spvasm deleted file mode 100644 index 318a5cef2a..0000000000 --- a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdxFine_8c5069 "dpdxFine_8c5069" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 - %8 = OpConstantNull %v4float -%_ptr_Function_v4float = OpTypePointer Function %v4float -%dpdxFine_8c5069 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %8 - %5 = OpDPdxFine %v4float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdxFine_8c5069 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.wgsl deleted file mode 100644 index 6de1a1c995..0000000000 --- a/test/tint/builtins/gen/dpdxFine/8c5069.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdxFine_8c5069() { - var res : vec4 = dpdxFine(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdxFine_8c5069(); -} diff --git a/test/tint/builtins/gen/dpdxFine/9631de.wgsl b/test/tint/builtins/gen/dpdxFine/9631de.wgsl deleted file mode 100644 index 847a81cf3b..0000000000 --- a/test/tint/builtins/gen/dpdxFine/9631de.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdxFine(vec<2, f32>) -> vec<2, f32> -fn dpdxFine_9631de() { - var res: vec2 = dpdxFine(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdxFine_9631de(); -} diff --git a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.glsl b/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.glsl deleted file mode 100644 index 3a4f31f903..0000000000 --- a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdxFine_9631de() { - vec2 res = dFdx(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdxFine_9631de(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.hlsl deleted file mode 100644 index 10efbb69ad..0000000000 --- a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdxFine_9631de() { - float2 res = ddx_fine(float2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdxFine_9631de(); - return; -} diff --git a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.msl b/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.msl deleted file mode 100644 index 60055fb30b..0000000000 --- a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdxFine_9631de() { - float2 res = dfdx(float2()); -} - -fragment void fragment_main() { - dpdxFine_9631de(); - return; -} - diff --git a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.spvasm deleted file mode 100644 index f015eb4e4c..0000000000 --- a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdxFine_9631de "dpdxFine_9631de" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %8 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%dpdxFine_9631de = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %8 - %5 = OpDPdxFine %v2float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdxFine_9631de - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.wgsl deleted file mode 100644 index a56d3c4767..0000000000 --- a/test/tint/builtins/gen/dpdxFine/9631de.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdxFine_9631de() { - var res : vec2 = dpdxFine(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdxFine_9631de(); -} diff --git a/test/tint/builtins/gen/dpdxFine/f401a2.wgsl b/test/tint/builtins/gen/dpdxFine/f401a2.wgsl deleted file mode 100644 index de0a8b28f5..0000000000 --- a/test/tint/builtins/gen/dpdxFine/f401a2.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdxFine(f32) -> f32 -fn dpdxFine_f401a2() { - var res: f32 = dpdxFine(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdxFine_f401a2(); -} diff --git a/test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.wgsl deleted file mode 100644 index 3f5c8360a3..0000000000 --- a/test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdxFine_f401a2() { - var res : f32 = dpdxFine(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdxFine_f401a2(); -} diff --git a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl b/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl deleted file mode 100644 index 85f9d43e62..0000000000 --- a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdxFine(vec<3, f32>) -> vec<3, f32> -fn dpdxFine_f92fb6() { - var res: vec3 = dpdxFine(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdxFine_f92fb6(); -} diff --git a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.glsl b/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.glsl deleted file mode 100644 index f538aa8828..0000000000 --- a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdxFine_f92fb6() { - vec3 res = dFdx(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdxFine_f92fb6(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.hlsl deleted file mode 100644 index cd55d245c5..0000000000 --- a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdxFine_f92fb6() { - float3 res = ddx_fine(float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdxFine_f92fb6(); - return; -} diff --git a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.msl b/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.msl deleted file mode 100644 index 8149873f7c..0000000000 --- a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdxFine_f92fb6() { - float3 res = dfdx(float3()); -} - -fragment void fragment_main() { - dpdxFine_f92fb6(); - return; -} - diff --git a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.spvasm deleted file mode 100644 index cdc8be2ac0..0000000000 --- a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdxFine_f92fb6 "dpdxFine_f92fb6" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %8 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float -%dpdxFine_f92fb6 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %8 - %5 = OpDPdxFine %v3float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdxFine_f92fb6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.wgsl deleted file mode 100644 index 5189c7ff54..0000000000 --- a/test/tint/builtins/gen/dpdxFine/f92fb6.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdxFine_f92fb6() { - var res : vec3 = dpdxFine(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdxFine_f92fb6(); -} diff --git a/test/tint/builtins/gen/dpdy/699a05.wgsl b/test/tint/builtins/gen/dpdy/699a05.wgsl deleted file mode 100644 index b2255a01e7..0000000000 --- a/test/tint/builtins/gen/dpdy/699a05.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdy(vec<4, f32>) -> vec<4, f32> -fn dpdy_699a05() { - var res: vec4 = dpdy(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdy_699a05(); -} diff --git a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.glsl b/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.glsl deleted file mode 100644 index be1c83ca57..0000000000 --- a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdy_699a05() { - vec4 res = dFdy(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdy_699a05(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.hlsl deleted file mode 100644 index 10f868cd5d..0000000000 --- a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdy_699a05() { - float4 res = ddy(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdy_699a05(); - return; -} diff --git a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.msl b/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.msl deleted file mode 100644 index f99636537f..0000000000 --- a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdy_699a05() { - float4 res = dfdy(float4()); -} - -fragment void fragment_main() { - dpdy_699a05(); - return; -} - diff --git a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.spvasm deleted file mode 100644 index b135d448e3..0000000000 --- a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.spvasm +++ /dev/null @@ -1,30 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdy_699a05 "dpdy_699a05" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 - %8 = OpConstantNull %v4float -%_ptr_Function_v4float = OpTypePointer Function %v4float -%dpdy_699a05 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %8 - %5 = OpDPdy %v4float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdy_699a05 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.wgsl deleted file mode 100644 index 9aa244c286..0000000000 --- a/test/tint/builtins/gen/dpdy/699a05.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdy_699a05() { - var res : vec4 = dpdy(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdy_699a05(); -} diff --git a/test/tint/builtins/gen/dpdy/7f8d84.wgsl b/test/tint/builtins/gen/dpdy/7f8d84.wgsl deleted file mode 100644 index 00fe00e435..0000000000 --- a/test/tint/builtins/gen/dpdy/7f8d84.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdy(f32) -> f32 -fn dpdy_7f8d84() { - var res: f32 = dpdy(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdy_7f8d84(); -} diff --git a/test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.wgsl deleted file mode 100644 index 732458e2a1..0000000000 --- a/test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdy_7f8d84() { - var res : f32 = dpdy(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdy_7f8d84(); -} diff --git a/test/tint/builtins/gen/dpdy/a8b56e.wgsl b/test/tint/builtins/gen/dpdy/a8b56e.wgsl deleted file mode 100644 index e9fe4e6166..0000000000 --- a/test/tint/builtins/gen/dpdy/a8b56e.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdy(vec<2, f32>) -> vec<2, f32> -fn dpdy_a8b56e() { - var res: vec2 = dpdy(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdy_a8b56e(); -} diff --git a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.glsl b/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.glsl deleted file mode 100644 index 157f26da04..0000000000 --- a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdy_a8b56e() { - vec2 res = dFdy(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdy_a8b56e(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.hlsl deleted file mode 100644 index 34b2d3083c..0000000000 --- a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdy_a8b56e() { - float2 res = ddy(float2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdy_a8b56e(); - return; -} diff --git a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.msl b/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.msl deleted file mode 100644 index 98a29ea033..0000000000 --- a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdy_a8b56e() { - float2 res = dfdy(float2()); -} - -fragment void fragment_main() { - dpdy_a8b56e(); - return; -} - diff --git a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.spvasm deleted file mode 100644 index 039cac5948..0000000000 --- a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.spvasm +++ /dev/null @@ -1,30 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdy_a8b56e "dpdy_a8b56e" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %8 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%dpdy_a8b56e = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %8 - %5 = OpDPdy %v2float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdy_a8b56e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.wgsl deleted file mode 100644 index 3493de8b8e..0000000000 --- a/test/tint/builtins/gen/dpdy/a8b56e.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdy_a8b56e() { - var res : vec2 = dpdy(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdy_a8b56e(); -} diff --git a/test/tint/builtins/gen/dpdy/feb40f.wgsl b/test/tint/builtins/gen/dpdy/feb40f.wgsl deleted file mode 100644 index 6e5626557d..0000000000 --- a/test/tint/builtins/gen/dpdy/feb40f.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdy(vec<3, f32>) -> vec<3, f32> -fn dpdy_feb40f() { - var res: vec3 = dpdy(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdy_feb40f(); -} diff --git a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.glsl b/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.glsl deleted file mode 100644 index a61a45ca3d..0000000000 --- a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdy_feb40f() { - vec3 res = dFdy(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdy_feb40f(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.hlsl deleted file mode 100644 index bf81fe921e..0000000000 --- a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdy_feb40f() { - float3 res = ddy(float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdy_feb40f(); - return; -} diff --git a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.msl b/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.msl deleted file mode 100644 index d0236bac27..0000000000 --- a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdy_feb40f() { - float3 res = dfdy(float3()); -} - -fragment void fragment_main() { - dpdy_feb40f(); - return; -} - diff --git a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.spvasm deleted file mode 100644 index 47765fed1a..0000000000 --- a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.spvasm +++ /dev/null @@ -1,30 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdy_feb40f "dpdy_feb40f" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %8 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float -%dpdy_feb40f = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %8 - %5 = OpDPdy %v3float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdy_feb40f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.wgsl deleted file mode 100644 index bdcb51d6ee..0000000000 --- a/test/tint/builtins/gen/dpdy/feb40f.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdy_feb40f() { - var res : vec3 = dpdy(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdy_feb40f(); -} diff --git a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl b/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl deleted file mode 100644 index e29e79462f..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdyCoarse(vec<2, f32>) -> vec<2, f32> -fn dpdyCoarse_3e1ab4() { - var res: vec2 = dpdyCoarse(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdyCoarse_3e1ab4(); -} diff --git a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.glsl b/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.glsl deleted file mode 100644 index 1b228fad3f..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdyCoarse_3e1ab4() { - vec2 res = dFdy(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdyCoarse_3e1ab4(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.hlsl deleted file mode 100644 index e8d6a21823..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdyCoarse_3e1ab4() { - float2 res = ddy_coarse(float2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdyCoarse_3e1ab4(); - return; -} diff --git a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.msl b/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.msl deleted file mode 100644 index 83cceec856..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdyCoarse_3e1ab4() { - float2 res = dfdy(float2()); -} - -fragment void fragment_main() { - dpdyCoarse_3e1ab4(); - return; -} - diff --git a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.spvasm deleted file mode 100644 index 8a004f95b7..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdyCoarse_3e1ab4 "dpdyCoarse_3e1ab4" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %8 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%dpdyCoarse_3e1ab4 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %8 - %5 = OpDPdyCoarse %v2float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdyCoarse_3e1ab4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.wgsl deleted file mode 100644 index 347ad7363e..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/3e1ab4.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdyCoarse_3e1ab4() { - var res : vec2 = dpdyCoarse(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdyCoarse_3e1ab4(); -} diff --git a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl b/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl deleted file mode 100644 index 8f4045d88d..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdyCoarse(vec<4, f32>) -> vec<4, f32> -fn dpdyCoarse_445d24() { - var res: vec4 = dpdyCoarse(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdyCoarse_445d24(); -} diff --git a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.glsl b/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.glsl deleted file mode 100644 index c8ca1903fa..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdyCoarse_445d24() { - vec4 res = dFdy(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdyCoarse_445d24(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.hlsl deleted file mode 100644 index 1b72a6ee74..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdyCoarse_445d24() { - float4 res = ddy_coarse(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdyCoarse_445d24(); - return; -} diff --git a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.msl b/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.msl deleted file mode 100644 index cbc5f5021e..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdyCoarse_445d24() { - float4 res = dfdy(float4()); -} - -fragment void fragment_main() { - dpdyCoarse_445d24(); - return; -} - diff --git a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.spvasm deleted file mode 100644 index 2a04611f17..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdyCoarse_445d24 "dpdyCoarse_445d24" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 - %8 = OpConstantNull %v4float -%_ptr_Function_v4float = OpTypePointer Function %v4float -%dpdyCoarse_445d24 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %8 - %5 = OpDPdyCoarse %v4float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdyCoarse_445d24 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.wgsl deleted file mode 100644 index db347c46d7..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/445d24.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdyCoarse_445d24() { - var res : vec4 = dpdyCoarse(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdyCoarse_445d24(); -} diff --git a/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl b/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl deleted file mode 100644 index ec41cef77c..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdyCoarse(f32) -> f32 -fn dpdyCoarse_870a7e() { - var res: f32 = dpdyCoarse(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdyCoarse_870a7e(); -} diff --git a/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.wgsl deleted file mode 100644 index b3d75866db..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdyCoarse_870a7e() { - var res : f32 = dpdyCoarse(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdyCoarse_870a7e(); -} diff --git a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl b/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl deleted file mode 100644 index ac3ea31393..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdyCoarse(vec<3, f32>) -> vec<3, f32> -fn dpdyCoarse_ae1873() { - var res: vec3 = dpdyCoarse(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdyCoarse_ae1873(); -} diff --git a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.glsl b/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.glsl deleted file mode 100644 index 8f92ba1fc2..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdyCoarse_ae1873() { - vec3 res = dFdy(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdyCoarse_ae1873(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.hlsl deleted file mode 100644 index f2d2f8fd87..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdyCoarse_ae1873() { - float3 res = ddy_coarse(float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdyCoarse_ae1873(); - return; -} diff --git a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.msl b/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.msl deleted file mode 100644 index 048ceeebf4..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdyCoarse_ae1873() { - float3 res = dfdy(float3()); -} - -fragment void fragment_main() { - dpdyCoarse_ae1873(); - return; -} - diff --git a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.spvasm deleted file mode 100644 index f6c84c2c72..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdyCoarse_ae1873 "dpdyCoarse_ae1873" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %8 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float -%dpdyCoarse_ae1873 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %8 - %5 = OpDPdyCoarse %v3float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdyCoarse_ae1873 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.wgsl deleted file mode 100644 index c116a9e18d..0000000000 --- a/test/tint/builtins/gen/dpdyCoarse/ae1873.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdyCoarse_ae1873() { - var res : vec3 = dpdyCoarse(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdyCoarse_ae1873(); -} diff --git a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl b/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl deleted file mode 100644 index fd7c18c267..0000000000 --- a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdyFine(vec<3, f32>) -> vec<3, f32> -fn dpdyFine_1fb7ab() { - var res: vec3 = dpdyFine(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdyFine_1fb7ab(); -} diff --git a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.glsl b/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.glsl deleted file mode 100644 index a6411fc09b..0000000000 --- a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdyFine_1fb7ab() { - vec3 res = dFdy(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdyFine_1fb7ab(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.hlsl deleted file mode 100644 index 8a6d616bf7..0000000000 --- a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdyFine_1fb7ab() { - float3 res = ddy_fine(float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdyFine_1fb7ab(); - return; -} diff --git a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.msl b/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.msl deleted file mode 100644 index cfbdf5daf1..0000000000 --- a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdyFine_1fb7ab() { - float3 res = dfdy(float3()); -} - -fragment void fragment_main() { - dpdyFine_1fb7ab(); - return; -} - diff --git a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.spvasm deleted file mode 100644 index 30c1c860fe..0000000000 --- a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdyFine_1fb7ab "dpdyFine_1fb7ab" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %8 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float -%dpdyFine_1fb7ab = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %8 - %5 = OpDPdyFine %v3float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdyFine_1fb7ab - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.wgsl deleted file mode 100644 index 96fd518203..0000000000 --- a/test/tint/builtins/gen/dpdyFine/1fb7ab.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdyFine_1fb7ab() { - var res : vec3 = dpdyFine(vec3()); -} - -@stage(fragment) -fn fragment_main() { - dpdyFine_1fb7ab(); -} diff --git a/test/tint/builtins/gen/dpdyFine/6eb673.wgsl b/test/tint/builtins/gen/dpdyFine/6eb673.wgsl deleted file mode 100644 index 2477a40ea3..0000000000 --- a/test/tint/builtins/gen/dpdyFine/6eb673.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdyFine(f32) -> f32 -fn dpdyFine_6eb673() { - var res: f32 = dpdyFine(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdyFine_6eb673(); -} diff --git a/test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.wgsl deleted file mode 100644 index 8fbc820a39..0000000000 --- a/test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdyFine_6eb673() { - var res : f32 = dpdyFine(1.0); -} - -@stage(fragment) -fn fragment_main() { - dpdyFine_6eb673(); -} diff --git a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl b/test/tint/builtins/gen/dpdyFine/d0a648.wgsl deleted file mode 100644 index 7bc1312364..0000000000 --- a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdyFine(vec<4, f32>) -> vec<4, f32> -fn dpdyFine_d0a648() { - var res: vec4 = dpdyFine(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdyFine_d0a648(); -} diff --git a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.glsl b/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.glsl deleted file mode 100644 index 149154badf..0000000000 --- a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdyFine_d0a648() { - vec4 res = dFdy(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdyFine_d0a648(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.hlsl deleted file mode 100644 index def00ad751..0000000000 --- a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdyFine_d0a648() { - float4 res = ddy_fine(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - dpdyFine_d0a648(); - return; -} diff --git a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.msl b/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.msl deleted file mode 100644 index b728bff555..0000000000 --- a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdyFine_d0a648() { - float4 res = dfdy(float4()); -} - -fragment void fragment_main() { - dpdyFine_d0a648(); - return; -} - diff --git a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.spvasm deleted file mode 100644 index 16a89278a8..0000000000 --- a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdyFine_d0a648 "dpdyFine_d0a648" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 - %8 = OpConstantNull %v4float -%_ptr_Function_v4float = OpTypePointer Function %v4float -%dpdyFine_d0a648 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %8 - %5 = OpDPdyFine %v4float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdyFine_d0a648 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.wgsl deleted file mode 100644 index 5d4fc7da4a..0000000000 --- a/test/tint/builtins/gen/dpdyFine/d0a648.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdyFine_d0a648() { - var res : vec4 = dpdyFine(vec4()); -} - -@stage(fragment) -fn fragment_main() { - dpdyFine_d0a648(); -} diff --git a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl b/test/tint/builtins/gen/dpdyFine/df33aa.wgsl deleted file mode 100644 index 0a10ff414e..0000000000 --- a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn dpdyFine(vec<2, f32>) -> vec<2, f32> -fn dpdyFine_df33aa() { - var res: vec2 = dpdyFine(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdyFine_df33aa(); -} diff --git a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.glsl b/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.glsl deleted file mode 100644 index c4192def50..0000000000 --- a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void dpdyFine_df33aa() { - vec2 res = dFdy(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdyFine_df33aa(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.hlsl b/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.hlsl deleted file mode 100644 index 9e6610668c..0000000000 --- a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void dpdyFine_df33aa() { - float2 res = ddy_fine(float2(0.0f, 0.0f)); -} - -void fragment_main() { - dpdyFine_df33aa(); - return; -} diff --git a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.msl b/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.msl deleted file mode 100644 index a2e88c9d9c..0000000000 --- a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void dpdyFine_df33aa() { - float2 res = dfdy(float2()); -} - -fragment void fragment_main() { - dpdyFine_df33aa(); - return; -} - diff --git a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.spvasm b/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.spvasm deleted file mode 100644 index 4d5346efaf..0000000000 --- a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %dpdyFine_df33aa "dpdyFine_df33aa" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %8 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%dpdyFine_df33aa = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %8 - %5 = OpDPdyFine %v2float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %dpdyFine_df33aa - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.wgsl b/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.wgsl deleted file mode 100644 index 876948a28b..0000000000 --- a/test/tint/builtins/gen/dpdyFine/df33aa.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn dpdyFine_df33aa() { - var res : vec2 = dpdyFine(vec2()); -} - -@stage(fragment) -fn fragment_main() { - dpdyFine_df33aa(); -} diff --git a/test/tint/builtins/gen/exp/0f70eb.wgsl b/test/tint/builtins/gen/exp/0f70eb.wgsl deleted file mode 100644 index c72f26dc52..0000000000 --- a/test/tint/builtins/gen/exp/0f70eb.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn exp(vec<4, f32>) -> vec<4, f32> -fn exp_0f70eb() { - var res: vec4 = exp(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp_0f70eb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp_0f70eb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp_0f70eb(); -} diff --git a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.glsl b/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.glsl deleted file mode 100644 index 97f8f76380..0000000000 --- a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void exp_0f70eb() { - vec4 res = exp(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - exp_0f70eb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void exp_0f70eb() { - vec4 res = exp(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - exp_0f70eb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void exp_0f70eb() { - vec4 res = exp(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - exp_0f70eb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.hlsl b/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.hlsl deleted file mode 100644 index 34e1937114..0000000000 --- a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void exp_0f70eb() { - float4 res = exp(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - exp_0f70eb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - exp_0f70eb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - exp_0f70eb(); - return; -} diff --git a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.msl b/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.msl deleted file mode 100644 index e9b3fdfd40..0000000000 --- a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void exp_0f70eb() { - float4 res = exp(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - exp_0f70eb(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - exp_0f70eb(); - return; -} - -kernel void compute_main() { - exp_0f70eb(); - return; -} - diff --git a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.spvasm b/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.spvasm deleted file mode 100644 index 0c249914c6..0000000000 --- a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %exp_0f70eb "exp_0f70eb" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %exp_0f70eb = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Exp %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %exp_0f70eb - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %exp_0f70eb - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %exp_0f70eb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.wgsl b/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.wgsl deleted file mode 100644 index bdcd32be2b..0000000000 --- a/test/tint/builtins/gen/exp/0f70eb.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn exp_0f70eb() { - var res : vec4 = exp(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp_0f70eb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp_0f70eb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp_0f70eb(); -} diff --git a/test/tint/builtins/gen/exp/1951e7.wgsl b/test/tint/builtins/gen/exp/1951e7.wgsl deleted file mode 100644 index a7de999485..0000000000 --- a/test/tint/builtins/gen/exp/1951e7.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn exp(vec<2, f32>) -> vec<2, f32> -fn exp_1951e7() { - var res: vec2 = exp(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp_1951e7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp_1951e7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp_1951e7(); -} diff --git a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.glsl b/test/tint/builtins/gen/exp/1951e7.wgsl.expected.glsl deleted file mode 100644 index e8e1d5a72b..0000000000 --- a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void exp_1951e7() { - vec2 res = exp(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - exp_1951e7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void exp_1951e7() { - vec2 res = exp(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - exp_1951e7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void exp_1951e7() { - vec2 res = exp(vec2(0.0f, 0.0f)); -} - -void compute_main() { - exp_1951e7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.hlsl b/test/tint/builtins/gen/exp/1951e7.wgsl.expected.hlsl deleted file mode 100644 index ec350a7e5e..0000000000 --- a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void exp_1951e7() { - float2 res = exp(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - exp_1951e7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - exp_1951e7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - exp_1951e7(); - return; -} diff --git a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.msl b/test/tint/builtins/gen/exp/1951e7.wgsl.expected.msl deleted file mode 100644 index b350d6861b..0000000000 --- a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void exp_1951e7() { - float2 res = exp(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - exp_1951e7(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - exp_1951e7(); - return; -} - -kernel void compute_main() { - exp_1951e7(); - return; -} - diff --git a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.spvasm b/test/tint/builtins/gen/exp/1951e7.wgsl.expected.spvasm deleted file mode 100644 index 013e9bbbaa..0000000000 --- a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %exp_1951e7 "exp_1951e7" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %exp_1951e7 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Exp %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %exp_1951e7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %exp_1951e7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %exp_1951e7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.wgsl b/test/tint/builtins/gen/exp/1951e7.wgsl.expected.wgsl deleted file mode 100644 index f3dd502f6a..0000000000 --- a/test/tint/builtins/gen/exp/1951e7.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn exp_1951e7() { - var res : vec2 = exp(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp_1951e7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp_1951e7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp_1951e7(); -} diff --git a/test/tint/builtins/gen/exp/771fd2.wgsl b/test/tint/builtins/gen/exp/771fd2.wgsl deleted file mode 100644 index 9361a219b5..0000000000 --- a/test/tint/builtins/gen/exp/771fd2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn exp(f32) -> f32 -fn exp_771fd2() { - var res: f32 = exp(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp_771fd2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp_771fd2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp_771fd2(); -} diff --git a/test/tint/builtins/gen/exp/771fd2.wgsl.expected.glsl b/test/tint/builtins/gen/exp/771fd2.wgsl.expected.glsl deleted file mode 100644 index 9824ceaa98..0000000000 --- a/test/tint/builtins/gen/exp/771fd2.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void exp_771fd2() { - float res = exp(1.0f); -} - -vec4 vertex_main() { - exp_771fd2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void exp_771fd2() { - float res = exp(1.0f); -} - -void fragment_main() { - exp_771fd2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void exp_771fd2() { - float res = exp(1.0f); -} - -void compute_main() { - exp_771fd2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/exp/771fd2.wgsl.expected.hlsl b/test/tint/builtins/gen/exp/771fd2.wgsl.expected.hlsl deleted file mode 100644 index f8298b4069..0000000000 --- a/test/tint/builtins/gen/exp/771fd2.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void exp_771fd2() { - float res = exp(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - exp_771fd2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - exp_771fd2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - exp_771fd2(); - return; -} diff --git a/test/tint/builtins/gen/exp/771fd2.wgsl.expected.msl b/test/tint/builtins/gen/exp/771fd2.wgsl.expected.msl deleted file mode 100644 index 86d93082ce..0000000000 --- a/test/tint/builtins/gen/exp/771fd2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void exp_771fd2() { - float res = exp(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - exp_771fd2(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - exp_771fd2(); - return; -} - -kernel void compute_main() { - exp_771fd2(); - return; -} - diff --git a/test/tint/builtins/gen/exp/771fd2.wgsl.expected.wgsl b/test/tint/builtins/gen/exp/771fd2.wgsl.expected.wgsl deleted file mode 100644 index 31bfd18e2a..0000000000 --- a/test/tint/builtins/gen/exp/771fd2.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn exp_771fd2() { - var res : f32 = exp(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp_771fd2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp_771fd2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp_771fd2(); -} diff --git a/test/tint/builtins/gen/exp/d98450.wgsl b/test/tint/builtins/gen/exp/d98450.wgsl deleted file mode 100644 index d3d666f9a4..0000000000 --- a/test/tint/builtins/gen/exp/d98450.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn exp(vec<3, f32>) -> vec<3, f32> -fn exp_d98450() { - var res: vec3 = exp(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp_d98450(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp_d98450(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp_d98450(); -} diff --git a/test/tint/builtins/gen/exp/d98450.wgsl.expected.glsl b/test/tint/builtins/gen/exp/d98450.wgsl.expected.glsl deleted file mode 100644 index 4e5ca747e6..0000000000 --- a/test/tint/builtins/gen/exp/d98450.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void exp_d98450() { - vec3 res = exp(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - exp_d98450(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void exp_d98450() { - vec3 res = exp(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - exp_d98450(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void exp_d98450() { - vec3 res = exp(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - exp_d98450(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/exp/d98450.wgsl.expected.hlsl b/test/tint/builtins/gen/exp/d98450.wgsl.expected.hlsl deleted file mode 100644 index 0da884942e..0000000000 --- a/test/tint/builtins/gen/exp/d98450.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void exp_d98450() { - float3 res = exp(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - exp_d98450(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - exp_d98450(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - exp_d98450(); - return; -} diff --git a/test/tint/builtins/gen/exp/d98450.wgsl.expected.msl b/test/tint/builtins/gen/exp/d98450.wgsl.expected.msl deleted file mode 100644 index 7af25631f0..0000000000 --- a/test/tint/builtins/gen/exp/d98450.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void exp_d98450() { - float3 res = exp(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - exp_d98450(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - exp_d98450(); - return; -} - -kernel void compute_main() { - exp_d98450(); - return; -} - diff --git a/test/tint/builtins/gen/exp/d98450.wgsl.expected.spvasm b/test/tint/builtins/gen/exp/d98450.wgsl.expected.spvasm deleted file mode 100644 index 27dc1ac9eb..0000000000 --- a/test/tint/builtins/gen/exp/d98450.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %exp_d98450 "exp_d98450" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %exp_d98450 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Exp %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %exp_d98450 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %exp_d98450 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %exp_d98450 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/exp/d98450.wgsl.expected.wgsl b/test/tint/builtins/gen/exp/d98450.wgsl.expected.wgsl deleted file mode 100644 index 168c3c2805..0000000000 --- a/test/tint/builtins/gen/exp/d98450.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn exp_d98450() { - var res : vec3 = exp(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp_d98450(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp_d98450(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp_d98450(); -} diff --git a/test/tint/builtins/gen/exp2/1f8680.wgsl b/test/tint/builtins/gen/exp2/1f8680.wgsl deleted file mode 100644 index 334932c578..0000000000 --- a/test/tint/builtins/gen/exp2/1f8680.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn exp2(vec<3, f32>) -> vec<3, f32> -fn exp2_1f8680() { - var res: vec3 = exp2(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp2_1f8680(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp2_1f8680(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp2_1f8680(); -} diff --git a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.glsl b/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.glsl deleted file mode 100644 index fe7269014c..0000000000 --- a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void exp2_1f8680() { - vec3 res = exp2(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - exp2_1f8680(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void exp2_1f8680() { - vec3 res = exp2(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - exp2_1f8680(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void exp2_1f8680() { - vec3 res = exp2(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - exp2_1f8680(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.hlsl b/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.hlsl deleted file mode 100644 index 4277495dac..0000000000 --- a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void exp2_1f8680() { - float3 res = exp2(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - exp2_1f8680(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - exp2_1f8680(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - exp2_1f8680(); - return; -} diff --git a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.msl b/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.msl deleted file mode 100644 index 4d07e6ba53..0000000000 --- a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void exp2_1f8680() { - float3 res = exp2(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - exp2_1f8680(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - exp2_1f8680(); - return; -} - -kernel void compute_main() { - exp2_1f8680(); - return; -} - diff --git a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.spvasm b/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.spvasm deleted file mode 100644 index 9d62f480ff..0000000000 --- a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %exp2_1f8680 "exp2_1f8680" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%exp2_1f8680 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Exp2 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %exp2_1f8680 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %exp2_1f8680 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %exp2_1f8680 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.wgsl b/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.wgsl deleted file mode 100644 index a4cba82f82..0000000000 --- a/test/tint/builtins/gen/exp2/1f8680.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn exp2_1f8680() { - var res : vec3 = exp2(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp2_1f8680(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp2_1f8680(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp2_1f8680(); -} diff --git a/test/tint/builtins/gen/exp2/a9d0a7.wgsl b/test/tint/builtins/gen/exp2/a9d0a7.wgsl deleted file mode 100644 index 31bfbbbc40..0000000000 --- a/test/tint/builtins/gen/exp2/a9d0a7.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn exp2(vec<4, f32>) -> vec<4, f32> -fn exp2_a9d0a7() { - var res: vec4 = exp2(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp2_a9d0a7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp2_a9d0a7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp2_a9d0a7(); -} diff --git a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.glsl b/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.glsl deleted file mode 100644 index b9fe1af407..0000000000 --- a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void exp2_a9d0a7() { - vec4 res = exp2(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - exp2_a9d0a7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void exp2_a9d0a7() { - vec4 res = exp2(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - exp2_a9d0a7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void exp2_a9d0a7() { - vec4 res = exp2(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - exp2_a9d0a7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.hlsl b/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.hlsl deleted file mode 100644 index f1964dea16..0000000000 --- a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void exp2_a9d0a7() { - float4 res = exp2(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - exp2_a9d0a7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - exp2_a9d0a7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - exp2_a9d0a7(); - return; -} diff --git a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.msl b/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.msl deleted file mode 100644 index 98447ae6d7..0000000000 --- a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void exp2_a9d0a7() { - float4 res = exp2(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - exp2_a9d0a7(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - exp2_a9d0a7(); - return; -} - -kernel void compute_main() { - exp2_a9d0a7(); - return; -} - diff --git a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.spvasm b/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.spvasm deleted file mode 100644 index f3ac039e0d..0000000000 --- a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %exp2_a9d0a7 "exp2_a9d0a7" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%exp2_a9d0a7 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Exp2 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %exp2_a9d0a7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %exp2_a9d0a7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %exp2_a9d0a7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.wgsl b/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.wgsl deleted file mode 100644 index 6a9160b5d0..0000000000 --- a/test/tint/builtins/gen/exp2/a9d0a7.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn exp2_a9d0a7() { - var res : vec4 = exp2(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp2_a9d0a7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp2_a9d0a7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp2_a9d0a7(); -} diff --git a/test/tint/builtins/gen/exp2/d6777c.wgsl b/test/tint/builtins/gen/exp2/d6777c.wgsl deleted file mode 100644 index ee1044e335..0000000000 --- a/test/tint/builtins/gen/exp2/d6777c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn exp2(vec<2, f32>) -> vec<2, f32> -fn exp2_d6777c() { - var res: vec2 = exp2(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp2_d6777c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp2_d6777c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp2_d6777c(); -} diff --git a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.glsl b/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.glsl deleted file mode 100644 index 7480b99c92..0000000000 --- a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void exp2_d6777c() { - vec2 res = exp2(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - exp2_d6777c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void exp2_d6777c() { - vec2 res = exp2(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - exp2_d6777c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void exp2_d6777c() { - vec2 res = exp2(vec2(0.0f, 0.0f)); -} - -void compute_main() { - exp2_d6777c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.hlsl b/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.hlsl deleted file mode 100644 index 77ec076618..0000000000 --- a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void exp2_d6777c() { - float2 res = exp2(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - exp2_d6777c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - exp2_d6777c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - exp2_d6777c(); - return; -} diff --git a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.msl b/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.msl deleted file mode 100644 index a94325e47d..0000000000 --- a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void exp2_d6777c() { - float2 res = exp2(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - exp2_d6777c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - exp2_d6777c(); - return; -} - -kernel void compute_main() { - exp2_d6777c(); - return; -} - diff --git a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.spvasm b/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.spvasm deleted file mode 100644 index e852866298..0000000000 --- a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %exp2_d6777c "exp2_d6777c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%exp2_d6777c = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Exp2 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %exp2_d6777c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %exp2_d6777c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %exp2_d6777c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.wgsl b/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.wgsl deleted file mode 100644 index 7c84e158e8..0000000000 --- a/test/tint/builtins/gen/exp2/d6777c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn exp2_d6777c() { - var res : vec2 = exp2(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp2_d6777c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp2_d6777c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp2_d6777c(); -} diff --git a/test/tint/builtins/gen/exp2/dea523.wgsl b/test/tint/builtins/gen/exp2/dea523.wgsl deleted file mode 100644 index 65a879ccea..0000000000 --- a/test/tint/builtins/gen/exp2/dea523.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn exp2(f32) -> f32 -fn exp2_dea523() { - var res: f32 = exp2(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp2_dea523(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp2_dea523(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp2_dea523(); -} diff --git a/test/tint/builtins/gen/exp2/dea523.wgsl.expected.glsl b/test/tint/builtins/gen/exp2/dea523.wgsl.expected.glsl deleted file mode 100644 index 10e50bd087..0000000000 --- a/test/tint/builtins/gen/exp2/dea523.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void exp2_dea523() { - float res = exp2(1.0f); -} - -vec4 vertex_main() { - exp2_dea523(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void exp2_dea523() { - float res = exp2(1.0f); -} - -void fragment_main() { - exp2_dea523(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void exp2_dea523() { - float res = exp2(1.0f); -} - -void compute_main() { - exp2_dea523(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/exp2/dea523.wgsl.expected.hlsl b/test/tint/builtins/gen/exp2/dea523.wgsl.expected.hlsl deleted file mode 100644 index 4c0dd533e1..0000000000 --- a/test/tint/builtins/gen/exp2/dea523.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void exp2_dea523() { - float res = exp2(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - exp2_dea523(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - exp2_dea523(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - exp2_dea523(); - return; -} diff --git a/test/tint/builtins/gen/exp2/dea523.wgsl.expected.msl b/test/tint/builtins/gen/exp2/dea523.wgsl.expected.msl deleted file mode 100644 index d331243ec2..0000000000 --- a/test/tint/builtins/gen/exp2/dea523.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void exp2_dea523() { - float res = exp2(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - exp2_dea523(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - exp2_dea523(); - return; -} - -kernel void compute_main() { - exp2_dea523(); - return; -} - diff --git a/test/tint/builtins/gen/exp2/dea523.wgsl.expected.wgsl b/test/tint/builtins/gen/exp2/dea523.wgsl.expected.wgsl deleted file mode 100644 index 92ea06dc38..0000000000 --- a/test/tint/builtins/gen/exp2/dea523.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn exp2_dea523() { - var res : f32 = exp2(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - exp2_dea523(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - exp2_dea523(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - exp2_dea523(); -} diff --git a/test/tint/builtins/gen/extractBits/12b197.wgsl b/test/tint/builtins/gen/extractBits/12b197.wgsl deleted file mode 100644 index 7777e581e7..0000000000 --- a/test/tint/builtins/gen/extractBits/12b197.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn extractBits(vec<3, u32>, u32, u32) -> vec<3, u32> -fn extractBits_12b197() { - var res: vec3 = extractBits(vec3(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_12b197(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_12b197(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_12b197(); -} diff --git a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.glsl b/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.glsl deleted file mode 100644 index cd4a93ed1e..0000000000 --- a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_12b197() { - uvec3 res = tint_extract_bits(uvec3(0u, 0u, 0u), 1u, 1u); -} - -vec4 vertex_main() { - extractBits_12b197(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_12b197() { - uvec3 res = tint_extract_bits(uvec3(0u, 0u, 0u), 1u, 1u); -} - -void fragment_main() { - extractBits_12b197(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_12b197() { - uvec3 res = tint_extract_bits(uvec3(0u, 0u, 0u), 1u, 1u); -} - -void compute_main() { - extractBits_12b197(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.hlsl b/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.hlsl deleted file mode 100644 index 68c7d9e9a2..0000000000 --- a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -uint3 tint_extract_bits(uint3 v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); -} - -void extractBits_12b197() { - uint3 res = tint_extract_bits(uint3(0u, 0u, 0u), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - extractBits_12b197(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - extractBits_12b197(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - extractBits_12b197(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.msl b/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.msl deleted file mode 100644 index ad92fcff9b..0000000000 --- a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -uint3 tint_extract_bits(uint3 v, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return extract_bits(v, s, (e - s)); -} - -void extractBits_12b197() { - uint3 res = tint_extract_bits(uint3(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - extractBits_12b197(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - extractBits_12b197(); - return; -} - -kernel void compute_main() { - extractBits_12b197(); - return; -} - diff --git a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.spvasm b/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.spvasm deleted file mode 100644 index 123c5e5c6e..0000000000 --- a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.spvasm +++ /dev/null @@ -1,87 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - %18 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_extract_bits "tint_extract_bits" - OpName %v "v" - OpName %offset "offset" - OpName %count "count" - OpName %extractBits_12b197 "extractBits_12b197" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %9 = OpTypeFunction %v3uint %v3uint %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %24 = OpTypeFunction %void - %29 = OpConstantNull %v3uint - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_extract_bits = OpFunction %v3uint None %9 - %v = OpFunctionParameter %v3uint - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %16 = OpLabel - %17 = OpExtInst %uint %18 UMin %offset %uint_32 - %21 = OpIAdd %uint %17 %count - %20 = OpExtInst %uint %18 UMin %uint_32 %21 - %23 = OpISub %uint %20 %17 - %22 = OpBitFieldUExtract %v3uint %v %17 %23 - OpReturnValue %22 - OpFunctionEnd -%extractBits_12b197 = OpFunction %void None %24 - %27 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %29 - %28 = OpFunctionCall %v3uint %tint_extract_bits %29 %uint_1 %uint_1 - OpStore %res %28 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %extractBits_12b197 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %24 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %24 - %42 = OpLabel - %43 = OpFunctionCall %void %extractBits_12b197 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %24 - %45 = OpLabel - %46 = OpFunctionCall %void %extractBits_12b197 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.wgsl b/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.wgsl deleted file mode 100644 index 26d197692e..0000000000 --- a/test/tint/builtins/gen/extractBits/12b197.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn extractBits_12b197() { - var res : vec3 = extractBits(vec3(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_12b197(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_12b197(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_12b197(); -} diff --git a/test/tint/builtins/gen/extractBits/249874.wgsl b/test/tint/builtins/gen/extractBits/249874.wgsl deleted file mode 100644 index 8f67de0771..0000000000 --- a/test/tint/builtins/gen/extractBits/249874.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn extractBits(i32, u32, u32) -> i32 -fn extractBits_249874() { - var res: i32 = extractBits(1, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_249874(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_249874(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_249874(); -} diff --git a/test/tint/builtins/gen/extractBits/249874.wgsl.expected.glsl b/test/tint/builtins/gen/extractBits/249874.wgsl.expected.glsl deleted file mode 100644 index cd0fc29fc5..0000000000 --- a/test/tint/builtins/gen/extractBits/249874.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -int tint_extract_bits(int v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_249874() { - int res = tint_extract_bits(1, 1u, 1u); -} - -vec4 vertex_main() { - extractBits_249874(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -int tint_extract_bits(int v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_249874() { - int res = tint_extract_bits(1, 1u, 1u); -} - -void fragment_main() { - extractBits_249874(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -int tint_extract_bits(int v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_249874() { - int res = tint_extract_bits(1, 1u, 1u); -} - -void compute_main() { - extractBits_249874(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/249874.wgsl.expected.hlsl b/test/tint/builtins/gen/extractBits/249874.wgsl.expected.hlsl deleted file mode 100644 index c43da1df03..0000000000 --- a/test/tint/builtins/gen/extractBits/249874.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -int tint_extract_bits(int v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << shl) >> shr); -} - -void extractBits_249874() { - int res = tint_extract_bits(1, 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - extractBits_249874(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - extractBits_249874(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - extractBits_249874(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/249874.wgsl.expected.msl b/test/tint/builtins/gen/extractBits/249874.wgsl.expected.msl deleted file mode 100644 index b9fff8e5f7..0000000000 --- a/test/tint/builtins/gen/extractBits/249874.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -int tint_extract_bits(int v, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return extract_bits(v, s, (e - s)); -} - -void extractBits_249874() { - int res = tint_extract_bits(1, 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - extractBits_249874(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - extractBits_249874(); - return; -} - -kernel void compute_main() { - extractBits_249874(); - return; -} - diff --git a/test/tint/builtins/gen/extractBits/249874.wgsl.expected.wgsl b/test/tint/builtins/gen/extractBits/249874.wgsl.expected.wgsl deleted file mode 100644 index 6c805149b3..0000000000 --- a/test/tint/builtins/gen/extractBits/249874.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn extractBits_249874() { - var res : i32 = extractBits(1, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_249874(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_249874(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_249874(); -} diff --git a/test/tint/builtins/gen/extractBits/631377.wgsl b/test/tint/builtins/gen/extractBits/631377.wgsl deleted file mode 100644 index 824f5a41f9..0000000000 --- a/test/tint/builtins/gen/extractBits/631377.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn extractBits(vec<4, u32>, u32, u32) -> vec<4, u32> -fn extractBits_631377() { - var res: vec4 = extractBits(vec4(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_631377(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_631377(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_631377(); -} diff --git a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.glsl b/test/tint/builtins/gen/extractBits/631377.wgsl.expected.glsl deleted file mode 100644 index 572e0ab322..0000000000 --- a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_631377() { - uvec4 res = tint_extract_bits(uvec4(0u, 0u, 0u, 0u), 1u, 1u); -} - -vec4 vertex_main() { - extractBits_631377(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_631377() { - uvec4 res = tint_extract_bits(uvec4(0u, 0u, 0u, 0u), 1u, 1u); -} - -void fragment_main() { - extractBits_631377(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_631377() { - uvec4 res = tint_extract_bits(uvec4(0u, 0u, 0u, 0u), 1u, 1u); -} - -void compute_main() { - extractBits_631377(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.hlsl b/test/tint/builtins/gen/extractBits/631377.wgsl.expected.hlsl deleted file mode 100644 index a78bfb42ea..0000000000 --- a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -uint4 tint_extract_bits(uint4 v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); -} - -void extractBits_631377() { - uint4 res = tint_extract_bits(uint4(0u, 0u, 0u, 0u), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - extractBits_631377(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - extractBits_631377(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - extractBits_631377(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.msl b/test/tint/builtins/gen/extractBits/631377.wgsl.expected.msl deleted file mode 100644 index 9bb51b666b..0000000000 --- a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -uint4 tint_extract_bits(uint4 v, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return extract_bits(v, s, (e - s)); -} - -void extractBits_631377() { - uint4 res = tint_extract_bits(uint4(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - extractBits_631377(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - extractBits_631377(); - return; -} - -kernel void compute_main() { - extractBits_631377(); - return; -} - diff --git a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.spvasm b/test/tint/builtins/gen/extractBits/631377.wgsl.expected.spvasm deleted file mode 100644 index ed3df80cd9..0000000000 --- a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.spvasm +++ /dev/null @@ -1,87 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - %18 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_extract_bits "tint_extract_bits" - OpName %v "v" - OpName %offset "offset" - OpName %count "count" - OpName %extractBits_631377 "extractBits_631377" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %9 = OpTypeFunction %v4uint %v4uint %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %24 = OpTypeFunction %void - %29 = OpConstantNull %v4uint - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_extract_bits = OpFunction %v4uint None %9 - %v = OpFunctionParameter %v4uint - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %16 = OpLabel - %17 = OpExtInst %uint %18 UMin %offset %uint_32 - %21 = OpIAdd %uint %17 %count - %20 = OpExtInst %uint %18 UMin %uint_32 %21 - %23 = OpISub %uint %20 %17 - %22 = OpBitFieldUExtract %v4uint %v %17 %23 - OpReturnValue %22 - OpFunctionEnd -%extractBits_631377 = OpFunction %void None %24 - %27 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %29 - %28 = OpFunctionCall %v4uint %tint_extract_bits %29 %uint_1 %uint_1 - OpStore %res %28 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %extractBits_631377 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %24 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %24 - %42 = OpLabel - %43 = OpFunctionCall %void %extractBits_631377 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %24 - %45 = OpLabel - %46 = OpFunctionCall %void %extractBits_631377 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.wgsl b/test/tint/builtins/gen/extractBits/631377.wgsl.expected.wgsl deleted file mode 100644 index dca168242c..0000000000 --- a/test/tint/builtins/gen/extractBits/631377.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn extractBits_631377() { - var res : vec4 = extractBits(vec4(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_631377(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_631377(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_631377(); -} diff --git a/test/tint/builtins/gen/extractBits/a99a8d.wgsl b/test/tint/builtins/gen/extractBits/a99a8d.wgsl deleted file mode 100644 index 7313723eb1..0000000000 --- a/test/tint/builtins/gen/extractBits/a99a8d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn extractBits(vec<2, i32>, u32, u32) -> vec<2, i32> -fn extractBits_a99a8d() { - var res: vec2 = extractBits(vec2(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_a99a8d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_a99a8d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_a99a8d(); -} diff --git a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.glsl b/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.glsl deleted file mode 100644 index 9691bda56c..0000000000 --- a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_a99a8d() { - ivec2 res = tint_extract_bits(ivec2(0, 0), 1u, 1u); -} - -vec4 vertex_main() { - extractBits_a99a8d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_a99a8d() { - ivec2 res = tint_extract_bits(ivec2(0, 0), 1u, 1u); -} - -void fragment_main() { - extractBits_a99a8d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_a99a8d() { - ivec2 res = tint_extract_bits(ivec2(0, 0), 1u, 1u); -} - -void compute_main() { - extractBits_a99a8d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.hlsl b/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.hlsl deleted file mode 100644 index 28166af258..0000000000 --- a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -int2 tint_extract_bits(int2 v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << uint2((shl).xx)) >> uint2((shr).xx)); -} - -void extractBits_a99a8d() { - int2 res = tint_extract_bits(int2(0, 0), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - extractBits_a99a8d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - extractBits_a99a8d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - extractBits_a99a8d(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.msl b/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.msl deleted file mode 100644 index a1a1b09770..0000000000 --- a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -int2 tint_extract_bits(int2 v, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return extract_bits(v, s, (e - s)); -} - -void extractBits_a99a8d() { - int2 res = tint_extract_bits(int2(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - extractBits_a99a8d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - extractBits_a99a8d(); - return; -} - -kernel void compute_main() { - extractBits_a99a8d(); - return; -} - diff --git a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.spvasm b/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.spvasm deleted file mode 100644 index 5dcee110aa..0000000000 --- a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - %19 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_extract_bits "tint_extract_bits" - OpName %v "v" - OpName %offset "offset" - OpName %count "count" - OpName %extractBits_a99a8d "extractBits_a99a8d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %v2int %v2int %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %25 = OpTypeFunction %void - %30 = OpConstantNull %v2int - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_extract_bits = OpFunction %v2int None %9 - %v = OpFunctionParameter %v2int - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %17 = OpLabel - %18 = OpExtInst %uint %19 UMin %offset %uint_32 - %22 = OpIAdd %uint %18 %count - %21 = OpExtInst %uint %19 UMin %uint_32 %22 - %24 = OpISub %uint %21 %18 - %23 = OpBitFieldSExtract %v2int %v %18 %24 - OpReturnValue %23 - OpFunctionEnd -%extractBits_a99a8d = OpFunction %void None %25 - %28 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %30 - %29 = OpFunctionCall %v2int %tint_extract_bits %30 %uint_1 %uint_1 - OpStore %res %29 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %extractBits_a99a8d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %25 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %25 - %43 = OpLabel - %44 = OpFunctionCall %void %extractBits_a99a8d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %25 - %46 = OpLabel - %47 = OpFunctionCall %void %extractBits_a99a8d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.wgsl b/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.wgsl deleted file mode 100644 index 4f6879db08..0000000000 --- a/test/tint/builtins/gen/extractBits/a99a8d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn extractBits_a99a8d() { - var res : vec2 = extractBits(vec2(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_a99a8d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_a99a8d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_a99a8d(); -} diff --git a/test/tint/builtins/gen/extractBits/ce81f8.wgsl b/test/tint/builtins/gen/extractBits/ce81f8.wgsl deleted file mode 100644 index c546e96b9f..0000000000 --- a/test/tint/builtins/gen/extractBits/ce81f8.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn extractBits(u32, u32, u32) -> u32 -fn extractBits_ce81f8() { - var res: u32 = extractBits(1u, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_ce81f8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_ce81f8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_ce81f8(); -} diff --git a/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.glsl b/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.glsl deleted file mode 100644 index 281e95abc5..0000000000 --- a/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -uint tint_extract_bits(uint v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_ce81f8() { - uint res = tint_extract_bits(1u, 1u, 1u); -} - -vec4 vertex_main() { - extractBits_ce81f8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uint tint_extract_bits(uint v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_ce81f8() { - uint res = tint_extract_bits(1u, 1u, 1u); -} - -void fragment_main() { - extractBits_ce81f8(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uint tint_extract_bits(uint v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_ce81f8() { - uint res = tint_extract_bits(1u, 1u, 1u); -} - -void compute_main() { - extractBits_ce81f8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.hlsl b/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.hlsl deleted file mode 100644 index 07f52bc451..0000000000 --- a/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -uint tint_extract_bits(uint v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << shl) >> shr); -} - -void extractBits_ce81f8() { - uint res = tint_extract_bits(1u, 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - extractBits_ce81f8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - extractBits_ce81f8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - extractBits_ce81f8(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.msl b/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.msl deleted file mode 100644 index bfb975924e..0000000000 --- a/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -uint tint_extract_bits(uint v, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return extract_bits(v, s, (e - s)); -} - -void extractBits_ce81f8() { - uint res = tint_extract_bits(1u, 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - extractBits_ce81f8(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - extractBits_ce81f8(); - return; -} - -kernel void compute_main() { - extractBits_ce81f8(); - return; -} - diff --git a/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.wgsl b/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.wgsl deleted file mode 100644 index 646fa964fc..0000000000 --- a/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn extractBits_ce81f8() { - var res : u32 = extractBits(1u, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_ce81f8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_ce81f8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_ce81f8(); -} diff --git a/test/tint/builtins/gen/extractBits/e04f5d.wgsl b/test/tint/builtins/gen/extractBits/e04f5d.wgsl deleted file mode 100644 index 783ae66ab6..0000000000 --- a/test/tint/builtins/gen/extractBits/e04f5d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn extractBits(vec<3, i32>, u32, u32) -> vec<3, i32> -fn extractBits_e04f5d() { - var res: vec3 = extractBits(vec3(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_e04f5d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_e04f5d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_e04f5d(); -} diff --git a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.glsl b/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.glsl deleted file mode 100644 index 9da789fafb..0000000000 --- a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_e04f5d() { - ivec3 res = tint_extract_bits(ivec3(0, 0, 0), 1u, 1u); -} - -vec4 vertex_main() { - extractBits_e04f5d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_e04f5d() { - ivec3 res = tint_extract_bits(ivec3(0, 0, 0), 1u, 1u); -} - -void fragment_main() { - extractBits_e04f5d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_e04f5d() { - ivec3 res = tint_extract_bits(ivec3(0, 0, 0), 1u, 1u); -} - -void compute_main() { - extractBits_e04f5d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.hlsl b/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.hlsl deleted file mode 100644 index b363dcd54d..0000000000 --- a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -int3 tint_extract_bits(int3 v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); -} - -void extractBits_e04f5d() { - int3 res = tint_extract_bits(int3(0, 0, 0), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - extractBits_e04f5d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - extractBits_e04f5d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - extractBits_e04f5d(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.msl b/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.msl deleted file mode 100644 index b94ad3e3a6..0000000000 --- a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -int3 tint_extract_bits(int3 v, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return extract_bits(v, s, (e - s)); -} - -void extractBits_e04f5d() { - int3 res = tint_extract_bits(int3(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - extractBits_e04f5d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - extractBits_e04f5d(); - return; -} - -kernel void compute_main() { - extractBits_e04f5d(); - return; -} - diff --git a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.spvasm b/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.spvasm deleted file mode 100644 index fedc92ebcb..0000000000 --- a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - %19 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_extract_bits "tint_extract_bits" - OpName %v "v" - OpName %offset "offset" - OpName %count "count" - OpName %extractBits_e04f5d "extractBits_e04f5d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %v3int %v3int %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %25 = OpTypeFunction %void - %30 = OpConstantNull %v3int - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v3int = OpTypePointer Function %v3int - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_extract_bits = OpFunction %v3int None %9 - %v = OpFunctionParameter %v3int - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %17 = OpLabel - %18 = OpExtInst %uint %19 UMin %offset %uint_32 - %22 = OpIAdd %uint %18 %count - %21 = OpExtInst %uint %19 UMin %uint_32 %22 - %24 = OpISub %uint %21 %18 - %23 = OpBitFieldSExtract %v3int %v %18 %24 - OpReturnValue %23 - OpFunctionEnd -%extractBits_e04f5d = OpFunction %void None %25 - %28 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %30 - %29 = OpFunctionCall %v3int %tint_extract_bits %30 %uint_1 %uint_1 - OpStore %res %29 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %extractBits_e04f5d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %25 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %25 - %43 = OpLabel - %44 = OpFunctionCall %void %extractBits_e04f5d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %25 - %46 = OpLabel - %47 = OpFunctionCall %void %extractBits_e04f5d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.wgsl b/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.wgsl deleted file mode 100644 index 49ebb9c89f..0000000000 --- a/test/tint/builtins/gen/extractBits/e04f5d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn extractBits_e04f5d() { - var res : vec3 = extractBits(vec3(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_e04f5d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_e04f5d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_e04f5d(); -} diff --git a/test/tint/builtins/gen/extractBits/f28f69.wgsl b/test/tint/builtins/gen/extractBits/f28f69.wgsl deleted file mode 100644 index e98dd9788c..0000000000 --- a/test/tint/builtins/gen/extractBits/f28f69.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn extractBits(vec<2, u32>, u32, u32) -> vec<2, u32> -fn extractBits_f28f69() { - var res: vec2 = extractBits(vec2(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_f28f69(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_f28f69(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_f28f69(); -} diff --git a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.glsl b/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.glsl deleted file mode 100644 index 0f8eaf51c5..0000000000 --- a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_f28f69() { - uvec2 res = tint_extract_bits(uvec2(0u, 0u), 1u, 1u); -} - -vec4 vertex_main() { - extractBits_f28f69(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_f28f69() { - uvec2 res = tint_extract_bits(uvec2(0u, 0u), 1u, 1u); -} - -void fragment_main() { - extractBits_f28f69(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_f28f69() { - uvec2 res = tint_extract_bits(uvec2(0u, 0u), 1u, 1u); -} - -void compute_main() { - extractBits_f28f69(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.hlsl b/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.hlsl deleted file mode 100644 index aa2cc010db..0000000000 --- a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -uint2 tint_extract_bits(uint2 v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << uint2((shl).xx)) >> uint2((shr).xx)); -} - -void extractBits_f28f69() { - uint2 res = tint_extract_bits(uint2(0u, 0u), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - extractBits_f28f69(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - extractBits_f28f69(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - extractBits_f28f69(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.msl b/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.msl deleted file mode 100644 index 4f3d529f87..0000000000 --- a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -uint2 tint_extract_bits(uint2 v, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return extract_bits(v, s, (e - s)); -} - -void extractBits_f28f69() { - uint2 res = tint_extract_bits(uint2(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - extractBits_f28f69(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - extractBits_f28f69(); - return; -} - -kernel void compute_main() { - extractBits_f28f69(); - return; -} - diff --git a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.spvasm b/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.spvasm deleted file mode 100644 index 060801b95a..0000000000 --- a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.spvasm +++ /dev/null @@ -1,87 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - %18 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_extract_bits "tint_extract_bits" - OpName %v "v" - OpName %offset "offset" - OpName %count "count" - OpName %extractBits_f28f69 "extractBits_f28f69" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %9 = OpTypeFunction %v2uint %v2uint %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %24 = OpTypeFunction %void - %29 = OpConstantNull %v2uint - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_extract_bits = OpFunction %v2uint None %9 - %v = OpFunctionParameter %v2uint - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %16 = OpLabel - %17 = OpExtInst %uint %18 UMin %offset %uint_32 - %21 = OpIAdd %uint %17 %count - %20 = OpExtInst %uint %18 UMin %uint_32 %21 - %23 = OpISub %uint %20 %17 - %22 = OpBitFieldUExtract %v2uint %v %17 %23 - OpReturnValue %22 - OpFunctionEnd -%extractBits_f28f69 = OpFunction %void None %24 - %27 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %29 - %28 = OpFunctionCall %v2uint %tint_extract_bits %29 %uint_1 %uint_1 - OpStore %res %28 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %extractBits_f28f69 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %24 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %24 - %42 = OpLabel - %43 = OpFunctionCall %void %extractBits_f28f69 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %24 - %45 = OpLabel - %46 = OpFunctionCall %void %extractBits_f28f69 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.wgsl b/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.wgsl deleted file mode 100644 index ad883f5417..0000000000 --- a/test/tint/builtins/gen/extractBits/f28f69.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn extractBits_f28f69() { - var res : vec2 = extractBits(vec2(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_f28f69(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_f28f69(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_f28f69(); -} diff --git a/test/tint/builtins/gen/extractBits/fb850f.wgsl b/test/tint/builtins/gen/extractBits/fb850f.wgsl deleted file mode 100644 index 73279336d2..0000000000 --- a/test/tint/builtins/gen/extractBits/fb850f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn extractBits(vec<4, i32>, u32, u32) -> vec<4, i32> -fn extractBits_fb850f() { - var res: vec4 = extractBits(vec4(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_fb850f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_fb850f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_fb850f(); -} diff --git a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.glsl b/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.glsl deleted file mode 100644 index 8be319ca9e..0000000000 --- a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_fb850f() { - ivec4 res = tint_extract_bits(ivec4(0, 0, 0, 0), 1u, 1u); -} - -vec4 vertex_main() { - extractBits_fb850f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_fb850f() { - ivec4 res = tint_extract_bits(ivec4(0, 0, 0, 0), 1u, 1u); -} - -void fragment_main() { - extractBits_fb850f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldExtract(v, int(s), int((e - s))); -} - -void extractBits_fb850f() { - ivec4 res = tint_extract_bits(ivec4(0, 0, 0, 0), 1u, 1u); -} - -void compute_main() { - extractBits_fb850f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.hlsl b/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.hlsl deleted file mode 100644 index bc152e4b78..0000000000 --- a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -int4 tint_extract_bits(int4 v, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint shl = (32u - e); - const uint shr = (shl + s); - return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); -} - -void extractBits_fb850f() { - int4 res = tint_extract_bits(int4(0, 0, 0, 0), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - extractBits_fb850f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - extractBits_fb850f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - extractBits_fb850f(); - return; -} diff --git a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.msl b/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.msl deleted file mode 100644 index 34a9f0ce84..0000000000 --- a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -int4 tint_extract_bits(int4 v, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return extract_bits(v, s, (e - s)); -} - -void extractBits_fb850f() { - int4 res = tint_extract_bits(int4(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - extractBits_fb850f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - extractBits_fb850f(); - return; -} - -kernel void compute_main() { - extractBits_fb850f(); - return; -} - diff --git a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.spvasm b/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.spvasm deleted file mode 100644 index f904fcbd2e..0000000000 --- a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - %19 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_extract_bits "tint_extract_bits" - OpName %v "v" - OpName %offset "offset" - OpName %count "count" - OpName %extractBits_fb850f "extractBits_fb850f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %v4int %v4int %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %25 = OpTypeFunction %void - %30 = OpConstantNull %v4int - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_extract_bits = OpFunction %v4int None %9 - %v = OpFunctionParameter %v4int - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %17 = OpLabel - %18 = OpExtInst %uint %19 UMin %offset %uint_32 - %22 = OpIAdd %uint %18 %count - %21 = OpExtInst %uint %19 UMin %uint_32 %22 - %24 = OpISub %uint %21 %18 - %23 = OpBitFieldSExtract %v4int %v %18 %24 - OpReturnValue %23 - OpFunctionEnd -%extractBits_fb850f = OpFunction %void None %25 - %28 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %30 - %29 = OpFunctionCall %v4int %tint_extract_bits %30 %uint_1 %uint_1 - OpStore %res %29 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %extractBits_fb850f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %25 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %25 - %43 = OpLabel - %44 = OpFunctionCall %void %extractBits_fb850f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %25 - %46 = OpLabel - %47 = OpFunctionCall %void %extractBits_fb850f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.wgsl b/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.wgsl deleted file mode 100644 index 2e3e8d125d..0000000000 --- a/test/tint/builtins/gen/extractBits/fb850f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn extractBits_fb850f() { - var res : vec4 = extractBits(vec4(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - extractBits_fb850f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - extractBits_fb850f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - extractBits_fb850f(); -} diff --git a/test/tint/builtins/gen/faceForward/5afbd5.wgsl b/test/tint/builtins/gen/faceForward/5afbd5.wgsl deleted file mode 100644 index 73c26b144b..0000000000 --- a/test/tint/builtins/gen/faceForward/5afbd5.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn faceForward(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn faceForward_5afbd5() { - var res: vec3 = faceForward(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - faceForward_5afbd5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - faceForward_5afbd5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - faceForward_5afbd5(); -} diff --git a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.glsl b/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.glsl deleted file mode 100644 index b030a260b8..0000000000 --- a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void faceForward_5afbd5() { - vec3 res = faceforward(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - faceForward_5afbd5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void faceForward_5afbd5() { - vec3 res = faceforward(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - faceForward_5afbd5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void faceForward_5afbd5() { - vec3 res = faceforward(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - faceForward_5afbd5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.hlsl b/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.hlsl deleted file mode 100644 index 219cd7e1e7..0000000000 --- a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void faceForward_5afbd5() { - float3 res = faceforward(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - faceForward_5afbd5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - faceForward_5afbd5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - faceForward_5afbd5(); - return; -} diff --git a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.msl b/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.msl deleted file mode 100644 index c539bc7a6b..0000000000 --- a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void faceForward_5afbd5() { - float3 res = faceforward(float3(), float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - faceForward_5afbd5(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - faceForward_5afbd5(); - return; -} - -kernel void compute_main() { - faceForward_5afbd5(); - return; -} - diff --git a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.spvasm b/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.spvasm deleted file mode 100644 index e9db2a5cdf..0000000000 --- a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %faceForward_5afbd5 "faceForward_5afbd5" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%faceForward_5afbd5 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 FaceForward %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %faceForward_5afbd5 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %faceForward_5afbd5 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %faceForward_5afbd5 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.wgsl b/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.wgsl deleted file mode 100644 index 65e8800732..0000000000 --- a/test/tint/builtins/gen/faceForward/5afbd5.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn faceForward_5afbd5() { - var res : vec3 = faceForward(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - faceForward_5afbd5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - faceForward_5afbd5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - faceForward_5afbd5(); -} diff --git a/test/tint/builtins/gen/faceForward/b316e5.wgsl b/test/tint/builtins/gen/faceForward/b316e5.wgsl deleted file mode 100644 index 67d10314a7..0000000000 --- a/test/tint/builtins/gen/faceForward/b316e5.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn faceForward(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn faceForward_b316e5() { - var res: vec4 = faceForward(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - faceForward_b316e5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - faceForward_b316e5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - faceForward_b316e5(); -} diff --git a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.glsl b/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.glsl deleted file mode 100644 index c0d11c8e56..0000000000 --- a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void faceForward_b316e5() { - vec4 res = faceforward(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - faceForward_b316e5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void faceForward_b316e5() { - vec4 res = faceforward(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - faceForward_b316e5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void faceForward_b316e5() { - vec4 res = faceforward(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - faceForward_b316e5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.hlsl b/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.hlsl deleted file mode 100644 index 4ffbf8f704..0000000000 --- a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void faceForward_b316e5() { - float4 res = faceforward(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - faceForward_b316e5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - faceForward_b316e5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - faceForward_b316e5(); - return; -} diff --git a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.msl b/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.msl deleted file mode 100644 index 2e32470d7a..0000000000 --- a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void faceForward_b316e5() { - float4 res = faceforward(float4(), float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - faceForward_b316e5(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - faceForward_b316e5(); - return; -} - -kernel void compute_main() { - faceForward_b316e5(); - return; -} - diff --git a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.spvasm b/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.spvasm deleted file mode 100644 index 9481d7860d..0000000000 --- a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %faceForward_b316e5 "faceForward_b316e5" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%faceForward_b316e5 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 FaceForward %5 %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %faceForward_b316e5 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %faceForward_b316e5 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %faceForward_b316e5 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.wgsl b/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.wgsl deleted file mode 100644 index e3cc002507..0000000000 --- a/test/tint/builtins/gen/faceForward/b316e5.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn faceForward_b316e5() { - var res : vec4 = faceForward(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - faceForward_b316e5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - faceForward_b316e5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - faceForward_b316e5(); -} diff --git a/test/tint/builtins/gen/faceForward/e6908b.wgsl b/test/tint/builtins/gen/faceForward/e6908b.wgsl deleted file mode 100644 index c10108198a..0000000000 --- a/test/tint/builtins/gen/faceForward/e6908b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn faceForward(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn faceForward_e6908b() { - var res: vec2 = faceForward(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - faceForward_e6908b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - faceForward_e6908b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - faceForward_e6908b(); -} diff --git a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.glsl b/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.glsl deleted file mode 100644 index 14e6ef2fe6..0000000000 --- a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void faceForward_e6908b() { - vec2 res = faceforward(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - faceForward_e6908b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void faceForward_e6908b() { - vec2 res = faceforward(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - faceForward_e6908b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void faceForward_e6908b() { - vec2 res = faceforward(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - faceForward_e6908b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.hlsl b/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.hlsl deleted file mode 100644 index 079aebec26..0000000000 --- a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void faceForward_e6908b() { - float2 res = faceforward(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - faceForward_e6908b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - faceForward_e6908b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - faceForward_e6908b(); - return; -} diff --git a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.msl b/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.msl deleted file mode 100644 index a335ef7df9..0000000000 --- a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void faceForward_e6908b() { - float2 res = faceforward(float2(), float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - faceForward_e6908b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - faceForward_e6908b(); - return; -} - -kernel void compute_main() { - faceForward_e6908b(); - return; -} - diff --git a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.spvasm b/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.spvasm deleted file mode 100644 index 6d239937cf..0000000000 --- a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %faceForward_e6908b "faceForward_e6908b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%faceForward_e6908b = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 FaceForward %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %faceForward_e6908b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %faceForward_e6908b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %faceForward_e6908b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.wgsl b/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.wgsl deleted file mode 100644 index 96c2c876de..0000000000 --- a/test/tint/builtins/gen/faceForward/e6908b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn faceForward_e6908b() { - var res : vec2 = faceForward(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - faceForward_e6908b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - faceForward_e6908b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - faceForward_e6908b(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl b/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl deleted file mode 100644 index 0a8a5da2d7..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstLeadingBit(vec<4, u32>) -> vec<4, u32> -fn firstLeadingBit_000ff3() { - var res: vec4 = firstLeadingBit(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_000ff3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_000ff3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_000ff3(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.glsl b/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.glsl deleted file mode 100644 index fcf4b3dd76..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec4 tint_first_leading_bit(uvec4 v) { - uvec4 x = v; - uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_000ff3() { - uvec4 res = tint_first_leading_bit(uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - firstLeadingBit_000ff3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec4 tint_first_leading_bit(uvec4 v) { - uvec4 x = v; - uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_000ff3() { - uvec4 res = tint_first_leading_bit(uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - firstLeadingBit_000ff3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec4 tint_first_leading_bit(uvec4 v) { - uvec4 x = v; - uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_000ff3() { - uvec4 res = tint_first_leading_bit(uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - firstLeadingBit_000ff3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.hlsl b/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.hlsl deleted file mode 100644 index 19e18a64a6..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint4 tint_first_leading_bit(uint4 v) { - uint4 x = v; - const uint4 b16 = (bool4((x & uint4((4294901760u).xxxx))) ? uint4((16u).xxxx) : uint4((0u).xxxx)); - x = (x >> b16); - const uint4 b8 = (bool4((x & uint4((65280u).xxxx))) ? uint4((8u).xxxx) : uint4((0u).xxxx)); - x = (x >> b8); - const uint4 b4 = (bool4((x & uint4((240u).xxxx))) ? uint4((4u).xxxx) : uint4((0u).xxxx)); - x = (x >> b4); - const uint4 b2 = (bool4((x & uint4((12u).xxxx))) ? uint4((2u).xxxx) : uint4((0u).xxxx)); - x = (x >> b2); - const uint4 b1 = (bool4((x & uint4((2u).xxxx))) ? uint4((1u).xxxx) : uint4((0u).xxxx)); - const uint4 is_zero = ((x == uint4((0u).xxxx)) ? uint4((4294967295u).xxxx) : uint4((0u).xxxx)); - return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_000ff3() { - uint4 res = tint_first_leading_bit(uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstLeadingBit_000ff3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstLeadingBit_000ff3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstLeadingBit_000ff3(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.msl b/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.msl deleted file mode 100644 index 93ad61bc7d..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -uint4 tint_first_leading_bit(uint4 v) { - uint4 x = v; - uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u)))); - x = (x >> b16); - uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u)))); - x = (x >> b8); - uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u)))); - x = (x >> b4); - uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u)))); - x = (x >> b2); - uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u)))); - uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); - return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_000ff3() { - uint4 res = tint_first_leading_bit(uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstLeadingBit_000ff3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstLeadingBit_000ff3(); - return; -} - -kernel void compute_main() { - firstLeadingBit_000ff3(); - return; -} - diff --git a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.spvasm b/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.spvasm deleted file mode 100644 index a7000b08af..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.spvasm +++ /dev/null @@ -1,142 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 99 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_leading_bit "tint_first_leading_bit" - OpName %v "v" - OpName %x "x" - OpName %firstLeadingBit_000ff3 "firstLeadingBit_000ff3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %9 = OpTypeFunction %v4uint %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %17 = OpConstantNull %v4uint - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 -%uint_4294901760 = OpConstant %uint 4294901760 - %24 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760 - %uint_16 = OpConstant %uint 16 - %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %29 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 - %uint_65280 = OpConstant %uint 65280 - %36 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280 - %uint_8 = OpConstant %uint 8 - %39 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 - %uint_240 = OpConstant %uint 240 - %46 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240 - %uint_4 = OpConstant %uint 4 - %49 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 - %uint_12 = OpConstant %uint 12 - %56 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12 - %uint_2 = OpConstant %uint 2 - %59 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %72 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %79 = OpTypeFunction %void - %85 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_leading_bit = OpFunction %v4uint None %9 - %v = OpFunctionParameter %v4uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v4uint Function %17 - OpStore %x %v - %22 = OpLoad %v4uint %x - %25 = OpBitwiseAnd %v4uint %22 %24 - %19 = OpINotEqual %v4bool %25 %17 - %18 = OpSelect %v4uint %19 %27 %29 - %30 = OpLoad %v4uint %x - %31 = OpShiftRightLogical %v4uint %30 %18 - OpStore %x %31 - %34 = OpLoad %v4uint %x - %37 = OpBitwiseAnd %v4uint %34 %36 - %33 = OpINotEqual %v4bool %37 %17 - %32 = OpSelect %v4uint %33 %39 %29 - %40 = OpLoad %v4uint %x - %41 = OpShiftRightLogical %v4uint %40 %32 - OpStore %x %41 - %44 = OpLoad %v4uint %x - %47 = OpBitwiseAnd %v4uint %44 %46 - %43 = OpINotEqual %v4bool %47 %17 - %42 = OpSelect %v4uint %43 %49 %29 - %50 = OpLoad %v4uint %x - %51 = OpShiftRightLogical %v4uint %50 %42 - OpStore %x %51 - %54 = OpLoad %v4uint %x - %57 = OpBitwiseAnd %v4uint %54 %56 - %53 = OpINotEqual %v4bool %57 %17 - %52 = OpSelect %v4uint %53 %59 %29 - %60 = OpLoad %v4uint %x - %61 = OpShiftRightLogical %v4uint %60 %52 - OpStore %x %61 - %64 = OpLoad %v4uint %x - %65 = OpBitwiseAnd %v4uint %64 %59 - %63 = OpINotEqual %v4bool %65 %17 - %62 = OpSelect %v4uint %63 %67 %29 - %69 = OpLoad %v4uint %x - %70 = OpIEqual %v4bool %69 %29 - %68 = OpSelect %v4uint %70 %72 %29 - %74 = OpBitwiseOr %v4uint %18 %32 - %75 = OpBitwiseOr %v4uint %74 %42 - %76 = OpBitwiseOr %v4uint %75 %52 - %77 = OpBitwiseOr %v4uint %76 %62 - %78 = OpBitwiseOr %v4uint %77 %68 - OpReturnValue %78 - OpFunctionEnd -%firstLeadingBit_000ff3 = OpFunction %void None %79 - %82 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %17 - %83 = OpFunctionCall %v4uint %tint_first_leading_bit %17 - OpStore %res %83 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %85 - %87 = OpLabel - %88 = OpFunctionCall %void %firstLeadingBit_000ff3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %79 - %90 = OpLabel - %91 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %91 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %79 - %94 = OpLabel - %95 = OpFunctionCall %void %firstLeadingBit_000ff3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %79 - %97 = OpLabel - %98 = OpFunctionCall %void %firstLeadingBit_000ff3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.wgsl b/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.wgsl deleted file mode 100644 index bf0529c5d0..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/000ff3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstLeadingBit_000ff3() { - var res : vec4 = firstLeadingBit(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_000ff3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_000ff3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_000ff3(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl b/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl deleted file mode 100644 index 6fd1880537..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstLeadingBit(vec<3, i32>) -> vec<3, i32> -fn firstLeadingBit_35053e() { - var res: vec3 = firstLeadingBit(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_35053e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_35053e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_35053e(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.glsl b/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.glsl deleted file mode 100644 index efe831f8a4..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec3 tint_first_leading_bit(ivec3 v) { - uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); - uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_35053e() { - ivec3 res = tint_first_leading_bit(ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - firstLeadingBit_35053e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec3 tint_first_leading_bit(ivec3 v) { - uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); - uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_35053e() { - ivec3 res = tint_first_leading_bit(ivec3(0, 0, 0)); -} - -void fragment_main() { - firstLeadingBit_35053e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec3 tint_first_leading_bit(ivec3 v) { - uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); - uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_35053e() { - ivec3 res = tint_first_leading_bit(ivec3(0, 0, 0)); -} - -void compute_main() { - firstLeadingBit_35053e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.hlsl b/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.hlsl deleted file mode 100644 index bf1d41d870..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int3 tint_first_leading_bit(int3 v) { - uint3 x = ((v < int3((0).xxx)) ? uint3(~(v)) : uint3(v)); - const uint3 b16 = (bool3((x & uint3((4294901760u).xxx))) ? uint3((16u).xxx) : uint3((0u).xxx)); - x = (x >> b16); - const uint3 b8 = (bool3((x & uint3((65280u).xxx))) ? uint3((8u).xxx) : uint3((0u).xxx)); - x = (x >> b8); - const uint3 b4 = (bool3((x & uint3((240u).xxx))) ? uint3((4u).xxx) : uint3((0u).xxx)); - x = (x >> b4); - const uint3 b2 = (bool3((x & uint3((12u).xxx))) ? uint3((2u).xxx) : uint3((0u).xxx)); - x = (x >> b2); - const uint3 b1 = (bool3((x & uint3((2u).xxx))) ? uint3((1u).xxx) : uint3((0u).xxx)); - const uint3 is_zero = ((x == uint3((0u).xxx)) ? uint3((4294967295u).xxx) : uint3((0u).xxx)); - return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_35053e() { - int3 res = tint_first_leading_bit(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstLeadingBit_35053e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstLeadingBit_35053e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstLeadingBit_35053e(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.msl b/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.msl deleted file mode 100644 index 820fea3d58..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -int3 tint_first_leading_bit(int3 v) { - uint3 x = select(uint3(v), uint3(~(v)), (v < int3(0))); - uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u)))); - x = (x >> b16); - uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u)))); - x = (x >> b8); - uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u)))); - x = (x >> b4); - uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u)))); - x = (x >> b2); - uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u)))); - uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); - return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_35053e() { - int3 res = tint_first_leading_bit(int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstLeadingBit_35053e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstLeadingBit_35053e(); - return; -} - -kernel void compute_main() { - firstLeadingBit_35053e(); - return; -} - diff --git a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.spvasm b/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.spvasm deleted file mode 100644 index f35960a9f5..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.spvasm +++ /dev/null @@ -1,154 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 110 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_leading_bit "tint_first_leading_bit" - OpName %v "v" - OpName %x "x" - OpName %firstLeadingBit_35053e "firstLeadingBit_35053e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %9 = OpTypeFunction %v3int %v3int - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %int_0 = OpConstant %int 0 - %19 = OpConstantComposite %v3int %int_0 %int_0 %int_0 - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %28 = OpConstantNull %v3uint -%uint_4294901760 = OpConstant %uint 4294901760 - %33 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760 - %uint_16 = OpConstant %uint 16 - %36 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %38 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 - %uint_65280 = OpConstant %uint 65280 - %45 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280 - %uint_8 = OpConstant %uint 8 - %48 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 - %uint_240 = OpConstant %uint 240 - %55 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240 - %uint_4 = OpConstant %uint 4 - %58 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 - %uint_12 = OpConstant %uint 12 - %65 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12 - %uint_2 = OpConstant %uint 2 - %68 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %76 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %81 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %88 = OpTypeFunction %void - %93 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %96 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_leading_bit = OpFunction %v3int None %9 - %v = OpFunctionParameter %v3int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v3uint Function %28 - %20 = OpSLessThan %v3bool %v %19 - %24 = OpNot %v3int %v - %23 = OpBitcast %v3uint %24 - %25 = OpBitcast %v3uint %v - %15 = OpSelect %v3uint %20 %23 %25 - OpStore %x %15 - %31 = OpLoad %v3uint %x - %34 = OpBitwiseAnd %v3uint %31 %33 - %30 = OpINotEqual %v3bool %34 %28 - %29 = OpSelect %v3uint %30 %36 %38 - %39 = OpLoad %v3uint %x - %40 = OpShiftRightLogical %v3uint %39 %29 - OpStore %x %40 - %43 = OpLoad %v3uint %x - %46 = OpBitwiseAnd %v3uint %43 %45 - %42 = OpINotEqual %v3bool %46 %28 - %41 = OpSelect %v3uint %42 %48 %38 - %49 = OpLoad %v3uint %x - %50 = OpShiftRightLogical %v3uint %49 %41 - OpStore %x %50 - %53 = OpLoad %v3uint %x - %56 = OpBitwiseAnd %v3uint %53 %55 - %52 = OpINotEqual %v3bool %56 %28 - %51 = OpSelect %v3uint %52 %58 %38 - %59 = OpLoad %v3uint %x - %60 = OpShiftRightLogical %v3uint %59 %51 - OpStore %x %60 - %63 = OpLoad %v3uint %x - %66 = OpBitwiseAnd %v3uint %63 %65 - %62 = OpINotEqual %v3bool %66 %28 - %61 = OpSelect %v3uint %62 %68 %38 - %69 = OpLoad %v3uint %x - %70 = OpShiftRightLogical %v3uint %69 %61 - OpStore %x %70 - %73 = OpLoad %v3uint %x - %74 = OpBitwiseAnd %v3uint %73 %68 - %72 = OpINotEqual %v3bool %74 %28 - %71 = OpSelect %v3uint %72 %76 %38 - %78 = OpLoad %v3uint %x - %79 = OpIEqual %v3bool %78 %38 - %77 = OpSelect %v3uint %79 %81 %38 - %83 = OpBitwiseOr %v3uint %29 %41 - %84 = OpBitwiseOr %v3uint %83 %51 - %85 = OpBitwiseOr %v3uint %84 %61 - %86 = OpBitwiseOr %v3uint %85 %71 - %87 = OpBitwiseOr %v3uint %86 %77 - %82 = OpBitcast %v3int %87 - OpReturnValue %82 - OpFunctionEnd -%firstLeadingBit_35053e = OpFunction %void None %88 - %91 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %93 - %92 = OpFunctionCall %v3int %tint_first_leading_bit %93 - OpStore %res %92 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %96 - %98 = OpLabel - %99 = OpFunctionCall %void %firstLeadingBit_35053e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %88 - %101 = OpLabel - %102 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %102 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %88 - %105 = OpLabel - %106 = OpFunctionCall %void %firstLeadingBit_35053e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %88 - %108 = OpLabel - %109 = OpFunctionCall %void %firstLeadingBit_35053e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.wgsl b/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.wgsl deleted file mode 100644 index cbf0a6b542..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/35053e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstLeadingBit_35053e() { - var res : vec3 = firstLeadingBit(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_35053e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_35053e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_35053e(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl b/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl deleted file mode 100644 index 3dcfca1659..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstLeadingBit(vec<3, u32>) -> vec<3, u32> -fn firstLeadingBit_3fd7d0() { - var res: vec3 = firstLeadingBit(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_3fd7d0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_3fd7d0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_3fd7d0(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.glsl b/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.glsl deleted file mode 100644 index 4fe9cb7ed0..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec3 tint_first_leading_bit(uvec3 v) { - uvec3 x = v; - uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_3fd7d0() { - uvec3 res = tint_first_leading_bit(uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - firstLeadingBit_3fd7d0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec3 tint_first_leading_bit(uvec3 v) { - uvec3 x = v; - uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_3fd7d0() { - uvec3 res = tint_first_leading_bit(uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - firstLeadingBit_3fd7d0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec3 tint_first_leading_bit(uvec3 v) { - uvec3 x = v; - uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_3fd7d0() { - uvec3 res = tint_first_leading_bit(uvec3(0u, 0u, 0u)); -} - -void compute_main() { - firstLeadingBit_3fd7d0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.hlsl b/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.hlsl deleted file mode 100644 index 0dff82ebd7..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint3 tint_first_leading_bit(uint3 v) { - uint3 x = v; - const uint3 b16 = (bool3((x & uint3((4294901760u).xxx))) ? uint3((16u).xxx) : uint3((0u).xxx)); - x = (x >> b16); - const uint3 b8 = (bool3((x & uint3((65280u).xxx))) ? uint3((8u).xxx) : uint3((0u).xxx)); - x = (x >> b8); - const uint3 b4 = (bool3((x & uint3((240u).xxx))) ? uint3((4u).xxx) : uint3((0u).xxx)); - x = (x >> b4); - const uint3 b2 = (bool3((x & uint3((12u).xxx))) ? uint3((2u).xxx) : uint3((0u).xxx)); - x = (x >> b2); - const uint3 b1 = (bool3((x & uint3((2u).xxx))) ? uint3((1u).xxx) : uint3((0u).xxx)); - const uint3 is_zero = ((x == uint3((0u).xxx)) ? uint3((4294967295u).xxx) : uint3((0u).xxx)); - return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_3fd7d0() { - uint3 res = tint_first_leading_bit(uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstLeadingBit_3fd7d0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstLeadingBit_3fd7d0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstLeadingBit_3fd7d0(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.msl b/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.msl deleted file mode 100644 index 2e4d23cd71..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -uint3 tint_first_leading_bit(uint3 v) { - uint3 x = v; - uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u)))); - x = (x >> b16); - uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u)))); - x = (x >> b8); - uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u)))); - x = (x >> b4); - uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u)))); - x = (x >> b2); - uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u)))); - uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); - return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_3fd7d0() { - uint3 res = tint_first_leading_bit(uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstLeadingBit_3fd7d0(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstLeadingBit_3fd7d0(); - return; -} - -kernel void compute_main() { - firstLeadingBit_3fd7d0(); - return; -} - diff --git a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.spvasm b/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.spvasm deleted file mode 100644 index 28097dd28b..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.spvasm +++ /dev/null @@ -1,142 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 99 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_leading_bit "tint_first_leading_bit" - OpName %v "v" - OpName %x "x" - OpName %firstLeadingBit_3fd7d0 "firstLeadingBit_3fd7d0" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %9 = OpTypeFunction %v3uint %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %17 = OpConstantNull %v3uint - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 -%uint_4294901760 = OpConstant %uint 4294901760 - %24 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760 - %uint_16 = OpConstant %uint 16 - %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %29 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 - %uint_65280 = OpConstant %uint 65280 - %36 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280 - %uint_8 = OpConstant %uint 8 - %39 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 - %uint_240 = OpConstant %uint 240 - %46 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240 - %uint_4 = OpConstant %uint 4 - %49 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 - %uint_12 = OpConstant %uint 12 - %56 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12 - %uint_2 = OpConstant %uint 2 - %59 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %72 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %79 = OpTypeFunction %void - %85 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_leading_bit = OpFunction %v3uint None %9 - %v = OpFunctionParameter %v3uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v3uint Function %17 - OpStore %x %v - %22 = OpLoad %v3uint %x - %25 = OpBitwiseAnd %v3uint %22 %24 - %19 = OpINotEqual %v3bool %25 %17 - %18 = OpSelect %v3uint %19 %27 %29 - %30 = OpLoad %v3uint %x - %31 = OpShiftRightLogical %v3uint %30 %18 - OpStore %x %31 - %34 = OpLoad %v3uint %x - %37 = OpBitwiseAnd %v3uint %34 %36 - %33 = OpINotEqual %v3bool %37 %17 - %32 = OpSelect %v3uint %33 %39 %29 - %40 = OpLoad %v3uint %x - %41 = OpShiftRightLogical %v3uint %40 %32 - OpStore %x %41 - %44 = OpLoad %v3uint %x - %47 = OpBitwiseAnd %v3uint %44 %46 - %43 = OpINotEqual %v3bool %47 %17 - %42 = OpSelect %v3uint %43 %49 %29 - %50 = OpLoad %v3uint %x - %51 = OpShiftRightLogical %v3uint %50 %42 - OpStore %x %51 - %54 = OpLoad %v3uint %x - %57 = OpBitwiseAnd %v3uint %54 %56 - %53 = OpINotEqual %v3bool %57 %17 - %52 = OpSelect %v3uint %53 %59 %29 - %60 = OpLoad %v3uint %x - %61 = OpShiftRightLogical %v3uint %60 %52 - OpStore %x %61 - %64 = OpLoad %v3uint %x - %65 = OpBitwiseAnd %v3uint %64 %59 - %63 = OpINotEqual %v3bool %65 %17 - %62 = OpSelect %v3uint %63 %67 %29 - %69 = OpLoad %v3uint %x - %70 = OpIEqual %v3bool %69 %29 - %68 = OpSelect %v3uint %70 %72 %29 - %74 = OpBitwiseOr %v3uint %18 %32 - %75 = OpBitwiseOr %v3uint %74 %42 - %76 = OpBitwiseOr %v3uint %75 %52 - %77 = OpBitwiseOr %v3uint %76 %62 - %78 = OpBitwiseOr %v3uint %77 %68 - OpReturnValue %78 - OpFunctionEnd -%firstLeadingBit_3fd7d0 = OpFunction %void None %79 - %82 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %17 - %83 = OpFunctionCall %v3uint %tint_first_leading_bit %17 - OpStore %res %83 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %85 - %87 = OpLabel - %88 = OpFunctionCall %void %firstLeadingBit_3fd7d0 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %79 - %90 = OpLabel - %91 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %91 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %79 - %94 = OpLabel - %95 = OpFunctionCall %void %firstLeadingBit_3fd7d0 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %79 - %97 = OpLabel - %98 = OpFunctionCall %void %firstLeadingBit_3fd7d0 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.wgsl b/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.wgsl deleted file mode 100644 index 4537a4a008..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/3fd7d0.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstLeadingBit_3fd7d0() { - var res : vec3 = firstLeadingBit(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_3fd7d0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_3fd7d0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_3fd7d0(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl b/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl deleted file mode 100644 index 7a77849eef..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstLeadingBit(i32) -> i32 -fn firstLeadingBit_57a1a3() { - var res: i32 = firstLeadingBit(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_57a1a3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_57a1a3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_57a1a3(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.glsl b/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.glsl deleted file mode 100644 index 1e85a2a24e..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -int tint_first_leading_bit(int v) { - uint x = ((v < 0) ? uint(~(v)) : uint(v)); - uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); - x = (x >> b16); - uint b8 = (bool((x & 65280u)) ? 8u : 0u); - x = (x >> b8); - uint b4 = (bool((x & 240u)) ? 4u : 0u); - x = (x >> b4); - uint b2 = (bool((x & 12u)) ? 2u : 0u); - x = (x >> b2); - uint b1 = (bool((x & 2u)) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_57a1a3() { - int res = tint_first_leading_bit(1); -} - -vec4 vertex_main() { - firstLeadingBit_57a1a3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -int tint_first_leading_bit(int v) { - uint x = ((v < 0) ? uint(~(v)) : uint(v)); - uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); - x = (x >> b16); - uint b8 = (bool((x & 65280u)) ? 8u : 0u); - x = (x >> b8); - uint b4 = (bool((x & 240u)) ? 4u : 0u); - x = (x >> b4); - uint b2 = (bool((x & 12u)) ? 2u : 0u); - x = (x >> b2); - uint b1 = (bool((x & 2u)) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_57a1a3() { - int res = tint_first_leading_bit(1); -} - -void fragment_main() { - firstLeadingBit_57a1a3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -int tint_first_leading_bit(int v) { - uint x = ((v < 0) ? uint(~(v)) : uint(v)); - uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); - x = (x >> b16); - uint b8 = (bool((x & 65280u)) ? 8u : 0u); - x = (x >> b8); - uint b4 = (bool((x & 240u)) ? 4u : 0u); - x = (x >> b4); - uint b2 = (bool((x & 12u)) ? 2u : 0u); - x = (x >> b2); - uint b1 = (bool((x & 2u)) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_57a1a3() { - int res = tint_first_leading_bit(1); -} - -void compute_main() { - firstLeadingBit_57a1a3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.hlsl b/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.hlsl deleted file mode 100644 index 59d3bb4991..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int tint_first_leading_bit(int v) { - uint x = ((v < 0) ? uint(~(v)) : uint(v)); - const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); - x = (x >> b16); - const uint b8 = (bool((x & 65280u)) ? 8u : 0u); - x = (x >> b8); - const uint b4 = (bool((x & 240u)) ? 4u : 0u); - x = (x >> b4); - const uint b2 = (bool((x & 12u)) ? 2u : 0u); - x = (x >> b2); - const uint b1 = (bool((x & 2u)) ? 1u : 0u); - const uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_57a1a3() { - int res = tint_first_leading_bit(1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstLeadingBit_57a1a3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstLeadingBit_57a1a3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstLeadingBit_57a1a3(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.msl b/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.msl deleted file mode 100644 index 0fe7af8d4a..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -int tint_first_leading_bit(int v) { - uint x = select(uint(v), uint(~(v)), (v < 0)); - uint const b16 = select(0u, 16u, bool((x & 4294901760u))); - x = (x >> b16); - uint const b8 = select(0u, 8u, bool((x & 65280u))); - x = (x >> b8); - uint const b4 = select(0u, 4u, bool((x & 240u))); - x = (x >> b4); - uint const b2 = select(0u, 2u, bool((x & 12u))); - x = (x >> b2); - uint const b1 = select(0u, 1u, bool((x & 2u))); - uint const is_zero = select(0u, 4294967295u, (x == 0u)); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_57a1a3() { - int res = tint_first_leading_bit(1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstLeadingBit_57a1a3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstLeadingBit_57a1a3(); - return; -} - -kernel void compute_main() { - firstLeadingBit_57a1a3(); - return; -} - diff --git a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.spvasm b/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.spvasm deleted file mode 100644 index bea47c79ed..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.spvasm +++ /dev/null @@ -1,140 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 96 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_leading_bit "tint_first_leading_bit" - OpName %v "v" - OpName %x "x" - OpName %firstLeadingBit_57a1a3 "firstLeadingBit_57a1a3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %9 = OpTypeFunction %int %int - %uint = OpTypeInt 32 0 - %int_0 = OpConstant %int 0 - %bool = OpTypeBool -%_ptr_Function_uint = OpTypePointer Function %uint - %24 = OpConstantNull %uint -%uint_4294901760 = OpConstant %uint 4294901760 - %uint_16 = OpConstant %uint 16 - %uint_0 = OpConstant %uint 0 - %uint_65280 = OpConstant %uint 65280 - %uint_8 = OpConstant %uint 8 - %uint_240 = OpConstant %uint 240 - %uint_4 = OpConstant %uint 4 - %uint_12 = OpConstant %uint 12 - %uint_2 = OpConstant %uint 2 - %uint_1 = OpConstant %uint 1 -%uint_4294967295 = OpConstant %uint 4294967295 - %void = OpTypeVoid - %73 = OpTypeFunction %void - %int_1 = OpConstant %int 1 -%_ptr_Function_int = OpTypePointer Function %int - %81 = OpConstantNull %int - %82 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_leading_bit = OpFunction %int None %9 - %v = OpFunctionParameter %int - %13 = OpLabel - %x = OpVariable %_ptr_Function_uint Function %24 - %17 = OpSLessThan %bool %v %int_0 - %20 = OpNot %int %v - %19 = OpBitcast %uint %20 - %21 = OpBitcast %uint %v - %14 = OpSelect %uint %17 %19 %21 - OpStore %x %14 - %27 = OpLoad %uint %x - %29 = OpBitwiseAnd %uint %27 %uint_4294901760 - %26 = OpINotEqual %bool %29 %24 - %25 = OpSelect %uint %26 %uint_16 %uint_0 - %32 = OpLoad %uint %x - %33 = OpShiftRightLogical %uint %32 %25 - OpStore %x %33 - %36 = OpLoad %uint %x - %38 = OpBitwiseAnd %uint %36 %uint_65280 - %35 = OpINotEqual %bool %38 %24 - %34 = OpSelect %uint %35 %uint_8 %uint_0 - %40 = OpLoad %uint %x - %41 = OpShiftRightLogical %uint %40 %34 - OpStore %x %41 - %44 = OpLoad %uint %x - %46 = OpBitwiseAnd %uint %44 %uint_240 - %43 = OpINotEqual %bool %46 %24 - %42 = OpSelect %uint %43 %uint_4 %uint_0 - %48 = OpLoad %uint %x - %49 = OpShiftRightLogical %uint %48 %42 - OpStore %x %49 - %52 = OpLoad %uint %x - %54 = OpBitwiseAnd %uint %52 %uint_12 - %51 = OpINotEqual %bool %54 %24 - %50 = OpSelect %uint %51 %uint_2 %uint_0 - %56 = OpLoad %uint %x - %57 = OpShiftRightLogical %uint %56 %50 - OpStore %x %57 - %60 = OpLoad %uint %x - %61 = OpBitwiseAnd %uint %60 %uint_2 - %59 = OpINotEqual %bool %61 %24 - %58 = OpSelect %uint %59 %uint_1 %uint_0 - %64 = OpLoad %uint %x - %65 = OpIEqual %bool %64 %uint_0 - %63 = OpSelect %uint %65 %uint_4294967295 %uint_0 - %68 = OpBitwiseOr %uint %25 %34 - %69 = OpBitwiseOr %uint %68 %42 - %70 = OpBitwiseOr %uint %69 %50 - %71 = OpBitwiseOr %uint %70 %58 - %72 = OpBitwiseOr %uint %71 %63 - %67 = OpBitcast %int %72 - OpReturnValue %67 - OpFunctionEnd -%firstLeadingBit_57a1a3 = OpFunction %void None %73 - %76 = OpLabel - %res = OpVariable %_ptr_Function_int Function %81 - %77 = OpFunctionCall %int %tint_first_leading_bit %int_1 - OpStore %res %77 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %82 - %84 = OpLabel - %85 = OpFunctionCall %void %firstLeadingBit_57a1a3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %73 - %87 = OpLabel - %88 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %88 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %73 - %91 = OpLabel - %92 = OpFunctionCall %void %firstLeadingBit_57a1a3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %73 - %94 = OpLabel - %95 = OpFunctionCall %void %firstLeadingBit_57a1a3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.wgsl b/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.wgsl deleted file mode 100644 index ff32238d1b..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/57a1a3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstLeadingBit_57a1a3() { - var res : i32 = firstLeadingBit(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_57a1a3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_57a1a3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_57a1a3(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl b/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl deleted file mode 100644 index 6f22f4c409..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstLeadingBit(vec<2, u32>) -> vec<2, u32> -fn firstLeadingBit_6fe804() { - var res: vec2 = firstLeadingBit(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_6fe804(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_6fe804(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_6fe804(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.glsl b/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.glsl deleted file mode 100644 index 9310a7c658..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec2 tint_first_leading_bit(uvec2 v) { - uvec2 x = v; - uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_6fe804() { - uvec2 res = tint_first_leading_bit(uvec2(0u, 0u)); -} - -vec4 vertex_main() { - firstLeadingBit_6fe804(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec2 tint_first_leading_bit(uvec2 v) { - uvec2 x = v; - uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_6fe804() { - uvec2 res = tint_first_leading_bit(uvec2(0u, 0u)); -} - -void fragment_main() { - firstLeadingBit_6fe804(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec2 tint_first_leading_bit(uvec2 v) { - uvec2 x = v; - uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_6fe804() { - uvec2 res = tint_first_leading_bit(uvec2(0u, 0u)); -} - -void compute_main() { - firstLeadingBit_6fe804(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.hlsl b/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.hlsl deleted file mode 100644 index 374977ab1c..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint2 tint_first_leading_bit(uint2 v) { - uint2 x = v; - const uint2 b16 = (bool2((x & uint2((4294901760u).xx))) ? uint2((16u).xx) : uint2((0u).xx)); - x = (x >> b16); - const uint2 b8 = (bool2((x & uint2((65280u).xx))) ? uint2((8u).xx) : uint2((0u).xx)); - x = (x >> b8); - const uint2 b4 = (bool2((x & uint2((240u).xx))) ? uint2((4u).xx) : uint2((0u).xx)); - x = (x >> b4); - const uint2 b2 = (bool2((x & uint2((12u).xx))) ? uint2((2u).xx) : uint2((0u).xx)); - x = (x >> b2); - const uint2 b1 = (bool2((x & uint2((2u).xx))) ? uint2((1u).xx) : uint2((0u).xx)); - const uint2 is_zero = ((x == uint2((0u).xx)) ? uint2((4294967295u).xx) : uint2((0u).xx)); - return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_6fe804() { - uint2 res = tint_first_leading_bit(uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstLeadingBit_6fe804(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstLeadingBit_6fe804(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstLeadingBit_6fe804(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.msl b/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.msl deleted file mode 100644 index 6a5203bf4c..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -uint2 tint_first_leading_bit(uint2 v) { - uint2 x = v; - uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u)))); - x = (x >> b16); - uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u)))); - x = (x >> b8); - uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u)))); - x = (x >> b4); - uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u)))); - x = (x >> b2); - uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u)))); - uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); - return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_6fe804() { - uint2 res = tint_first_leading_bit(uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstLeadingBit_6fe804(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstLeadingBit_6fe804(); - return; -} - -kernel void compute_main() { - firstLeadingBit_6fe804(); - return; -} - diff --git a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.spvasm b/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.spvasm deleted file mode 100644 index 399a3d1969..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.spvasm +++ /dev/null @@ -1,142 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 99 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_leading_bit "tint_first_leading_bit" - OpName %v "v" - OpName %x "x" - OpName %firstLeadingBit_6fe804 "firstLeadingBit_6fe804" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %9 = OpTypeFunction %v2uint %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %17 = OpConstantNull %v2uint - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 -%uint_4294901760 = OpConstant %uint 4294901760 - %24 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760 - %uint_16 = OpConstant %uint 16 - %27 = OpConstantComposite %v2uint %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %29 = OpConstantComposite %v2uint %uint_0 %uint_0 - %uint_65280 = OpConstant %uint 65280 - %36 = OpConstantComposite %v2uint %uint_65280 %uint_65280 - %uint_8 = OpConstant %uint 8 - %39 = OpConstantComposite %v2uint %uint_8 %uint_8 - %uint_240 = OpConstant %uint 240 - %46 = OpConstantComposite %v2uint %uint_240 %uint_240 - %uint_4 = OpConstant %uint 4 - %49 = OpConstantComposite %v2uint %uint_4 %uint_4 - %uint_12 = OpConstant %uint 12 - %56 = OpConstantComposite %v2uint %uint_12 %uint_12 - %uint_2 = OpConstant %uint 2 - %59 = OpConstantComposite %v2uint %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v2uint %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %72 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %79 = OpTypeFunction %void - %85 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_leading_bit = OpFunction %v2uint None %9 - %v = OpFunctionParameter %v2uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v2uint Function %17 - OpStore %x %v - %22 = OpLoad %v2uint %x - %25 = OpBitwiseAnd %v2uint %22 %24 - %19 = OpINotEqual %v2bool %25 %17 - %18 = OpSelect %v2uint %19 %27 %29 - %30 = OpLoad %v2uint %x - %31 = OpShiftRightLogical %v2uint %30 %18 - OpStore %x %31 - %34 = OpLoad %v2uint %x - %37 = OpBitwiseAnd %v2uint %34 %36 - %33 = OpINotEqual %v2bool %37 %17 - %32 = OpSelect %v2uint %33 %39 %29 - %40 = OpLoad %v2uint %x - %41 = OpShiftRightLogical %v2uint %40 %32 - OpStore %x %41 - %44 = OpLoad %v2uint %x - %47 = OpBitwiseAnd %v2uint %44 %46 - %43 = OpINotEqual %v2bool %47 %17 - %42 = OpSelect %v2uint %43 %49 %29 - %50 = OpLoad %v2uint %x - %51 = OpShiftRightLogical %v2uint %50 %42 - OpStore %x %51 - %54 = OpLoad %v2uint %x - %57 = OpBitwiseAnd %v2uint %54 %56 - %53 = OpINotEqual %v2bool %57 %17 - %52 = OpSelect %v2uint %53 %59 %29 - %60 = OpLoad %v2uint %x - %61 = OpShiftRightLogical %v2uint %60 %52 - OpStore %x %61 - %64 = OpLoad %v2uint %x - %65 = OpBitwiseAnd %v2uint %64 %59 - %63 = OpINotEqual %v2bool %65 %17 - %62 = OpSelect %v2uint %63 %67 %29 - %69 = OpLoad %v2uint %x - %70 = OpIEqual %v2bool %69 %29 - %68 = OpSelect %v2uint %70 %72 %29 - %74 = OpBitwiseOr %v2uint %18 %32 - %75 = OpBitwiseOr %v2uint %74 %42 - %76 = OpBitwiseOr %v2uint %75 %52 - %77 = OpBitwiseOr %v2uint %76 %62 - %78 = OpBitwiseOr %v2uint %77 %68 - OpReturnValue %78 - OpFunctionEnd -%firstLeadingBit_6fe804 = OpFunction %void None %79 - %82 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %17 - %83 = OpFunctionCall %v2uint %tint_first_leading_bit %17 - OpStore %res %83 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %85 - %87 = OpLabel - %88 = OpFunctionCall %void %firstLeadingBit_6fe804 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %79 - %90 = OpLabel - %91 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %91 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %79 - %94 = OpLabel - %95 = OpFunctionCall %void %firstLeadingBit_6fe804 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %79 - %97 = OpLabel - %98 = OpFunctionCall %void %firstLeadingBit_6fe804 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.wgsl b/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.wgsl deleted file mode 100644 index 8eefa88ebc..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/6fe804.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstLeadingBit_6fe804() { - var res : vec2 = firstLeadingBit(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_6fe804(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_6fe804(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_6fe804(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl b/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl deleted file mode 100644 index 984432418a..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstLeadingBit(vec<2, i32>) -> vec<2, i32> -fn firstLeadingBit_a622c2() { - var res: vec2 = firstLeadingBit(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_a622c2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_a622c2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_a622c2(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.glsl b/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.glsl deleted file mode 100644 index 1f91cc6c55..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec2 tint_first_leading_bit(ivec2 v) { - uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); - uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_a622c2() { - ivec2 res = tint_first_leading_bit(ivec2(0, 0)); -} - -vec4 vertex_main() { - firstLeadingBit_a622c2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec2 tint_first_leading_bit(ivec2 v) { - uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); - uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_a622c2() { - ivec2 res = tint_first_leading_bit(ivec2(0, 0)); -} - -void fragment_main() { - firstLeadingBit_a622c2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec2 tint_first_leading_bit(ivec2 v) { - uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); - uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_a622c2() { - ivec2 res = tint_first_leading_bit(ivec2(0, 0)); -} - -void compute_main() { - firstLeadingBit_a622c2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.hlsl b/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.hlsl deleted file mode 100644 index c660637cd5..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int2 tint_first_leading_bit(int2 v) { - uint2 x = ((v < int2((0).xx)) ? uint2(~(v)) : uint2(v)); - const uint2 b16 = (bool2((x & uint2((4294901760u).xx))) ? uint2((16u).xx) : uint2((0u).xx)); - x = (x >> b16); - const uint2 b8 = (bool2((x & uint2((65280u).xx))) ? uint2((8u).xx) : uint2((0u).xx)); - x = (x >> b8); - const uint2 b4 = (bool2((x & uint2((240u).xx))) ? uint2((4u).xx) : uint2((0u).xx)); - x = (x >> b4); - const uint2 b2 = (bool2((x & uint2((12u).xx))) ? uint2((2u).xx) : uint2((0u).xx)); - x = (x >> b2); - const uint2 b1 = (bool2((x & uint2((2u).xx))) ? uint2((1u).xx) : uint2((0u).xx)); - const uint2 is_zero = ((x == uint2((0u).xx)) ? uint2((4294967295u).xx) : uint2((0u).xx)); - return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_a622c2() { - int2 res = tint_first_leading_bit(int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstLeadingBit_a622c2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstLeadingBit_a622c2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstLeadingBit_a622c2(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.msl b/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.msl deleted file mode 100644 index c4bebbb450..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -int2 tint_first_leading_bit(int2 v) { - uint2 x = select(uint2(v), uint2(~(v)), (v < int2(0))); - uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u)))); - x = (x >> b16); - uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u)))); - x = (x >> b8); - uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u)))); - x = (x >> b4); - uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u)))); - x = (x >> b2); - uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u)))); - uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); - return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_a622c2() { - int2 res = tint_first_leading_bit(int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstLeadingBit_a622c2(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstLeadingBit_a622c2(); - return; -} - -kernel void compute_main() { - firstLeadingBit_a622c2(); - return; -} - diff --git a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.spvasm b/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.spvasm deleted file mode 100644 index 3f27c360ca..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.spvasm +++ /dev/null @@ -1,154 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 110 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_leading_bit "tint_first_leading_bit" - OpName %v "v" - OpName %x "x" - OpName %firstLeadingBit_a622c2 "firstLeadingBit_a622c2" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %9 = OpTypeFunction %v2int %v2int - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %int_0 = OpConstant %int 0 - %19 = OpConstantComposite %v2int %int_0 %int_0 - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %28 = OpConstantNull %v2uint -%uint_4294901760 = OpConstant %uint 4294901760 - %33 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760 - %uint_16 = OpConstant %uint 16 - %36 = OpConstantComposite %v2uint %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %38 = OpConstantComposite %v2uint %uint_0 %uint_0 - %uint_65280 = OpConstant %uint 65280 - %45 = OpConstantComposite %v2uint %uint_65280 %uint_65280 - %uint_8 = OpConstant %uint 8 - %48 = OpConstantComposite %v2uint %uint_8 %uint_8 - %uint_240 = OpConstant %uint 240 - %55 = OpConstantComposite %v2uint %uint_240 %uint_240 - %uint_4 = OpConstant %uint 4 - %58 = OpConstantComposite %v2uint %uint_4 %uint_4 - %uint_12 = OpConstant %uint 12 - %65 = OpConstantComposite %v2uint %uint_12 %uint_12 - %uint_2 = OpConstant %uint 2 - %68 = OpConstantComposite %v2uint %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %76 = OpConstantComposite %v2uint %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %81 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %88 = OpTypeFunction %void - %93 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %96 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_leading_bit = OpFunction %v2int None %9 - %v = OpFunctionParameter %v2int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v2uint Function %28 - %20 = OpSLessThan %v2bool %v %19 - %24 = OpNot %v2int %v - %23 = OpBitcast %v2uint %24 - %25 = OpBitcast %v2uint %v - %15 = OpSelect %v2uint %20 %23 %25 - OpStore %x %15 - %31 = OpLoad %v2uint %x - %34 = OpBitwiseAnd %v2uint %31 %33 - %30 = OpINotEqual %v2bool %34 %28 - %29 = OpSelect %v2uint %30 %36 %38 - %39 = OpLoad %v2uint %x - %40 = OpShiftRightLogical %v2uint %39 %29 - OpStore %x %40 - %43 = OpLoad %v2uint %x - %46 = OpBitwiseAnd %v2uint %43 %45 - %42 = OpINotEqual %v2bool %46 %28 - %41 = OpSelect %v2uint %42 %48 %38 - %49 = OpLoad %v2uint %x - %50 = OpShiftRightLogical %v2uint %49 %41 - OpStore %x %50 - %53 = OpLoad %v2uint %x - %56 = OpBitwiseAnd %v2uint %53 %55 - %52 = OpINotEqual %v2bool %56 %28 - %51 = OpSelect %v2uint %52 %58 %38 - %59 = OpLoad %v2uint %x - %60 = OpShiftRightLogical %v2uint %59 %51 - OpStore %x %60 - %63 = OpLoad %v2uint %x - %66 = OpBitwiseAnd %v2uint %63 %65 - %62 = OpINotEqual %v2bool %66 %28 - %61 = OpSelect %v2uint %62 %68 %38 - %69 = OpLoad %v2uint %x - %70 = OpShiftRightLogical %v2uint %69 %61 - OpStore %x %70 - %73 = OpLoad %v2uint %x - %74 = OpBitwiseAnd %v2uint %73 %68 - %72 = OpINotEqual %v2bool %74 %28 - %71 = OpSelect %v2uint %72 %76 %38 - %78 = OpLoad %v2uint %x - %79 = OpIEqual %v2bool %78 %38 - %77 = OpSelect %v2uint %79 %81 %38 - %83 = OpBitwiseOr %v2uint %29 %41 - %84 = OpBitwiseOr %v2uint %83 %51 - %85 = OpBitwiseOr %v2uint %84 %61 - %86 = OpBitwiseOr %v2uint %85 %71 - %87 = OpBitwiseOr %v2uint %86 %77 - %82 = OpBitcast %v2int %87 - OpReturnValue %82 - OpFunctionEnd -%firstLeadingBit_a622c2 = OpFunction %void None %88 - %91 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %93 - %92 = OpFunctionCall %v2int %tint_first_leading_bit %93 - OpStore %res %92 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %96 - %98 = OpLabel - %99 = OpFunctionCall %void %firstLeadingBit_a622c2 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %88 - %101 = OpLabel - %102 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %102 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %88 - %105 = OpLabel - %106 = OpFunctionCall %void %firstLeadingBit_a622c2 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %88 - %108 = OpLabel - %109 = OpFunctionCall %void %firstLeadingBit_a622c2 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.wgsl b/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.wgsl deleted file mode 100644 index e7fb9d12b4..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/a622c2.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstLeadingBit_a622c2() { - var res : vec2 = firstLeadingBit(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_a622c2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_a622c2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_a622c2(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl b/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl deleted file mode 100644 index 5b1610e155..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstLeadingBit(vec<4, i32>) -> vec<4, i32> -fn firstLeadingBit_c1f940() { - var res: vec4 = firstLeadingBit(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_c1f940(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_c1f940(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_c1f940(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.glsl b/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.glsl deleted file mode 100644 index b589e3b96a..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec4 tint_first_leading_bit(ivec4 v) { - uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); - uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_c1f940() { - ivec4 res = tint_first_leading_bit(ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - firstLeadingBit_c1f940(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec4 tint_first_leading_bit(ivec4 v) { - uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); - uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_c1f940() { - ivec4 res = tint_first_leading_bit(ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - firstLeadingBit_c1f940(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec4 tint_first_leading_bit(ivec4 v) { - uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); - uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_c1f940() { - ivec4 res = tint_first_leading_bit(ivec4(0, 0, 0, 0)); -} - -void compute_main() { - firstLeadingBit_c1f940(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.hlsl b/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.hlsl deleted file mode 100644 index bed5beda2c..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int4 tint_first_leading_bit(int4 v) { - uint4 x = ((v < int4((0).xxxx)) ? uint4(~(v)) : uint4(v)); - const uint4 b16 = (bool4((x & uint4((4294901760u).xxxx))) ? uint4((16u).xxxx) : uint4((0u).xxxx)); - x = (x >> b16); - const uint4 b8 = (bool4((x & uint4((65280u).xxxx))) ? uint4((8u).xxxx) : uint4((0u).xxxx)); - x = (x >> b8); - const uint4 b4 = (bool4((x & uint4((240u).xxxx))) ? uint4((4u).xxxx) : uint4((0u).xxxx)); - x = (x >> b4); - const uint4 b2 = (bool4((x & uint4((12u).xxxx))) ? uint4((2u).xxxx) : uint4((0u).xxxx)); - x = (x >> b2); - const uint4 b1 = (bool4((x & uint4((2u).xxxx))) ? uint4((1u).xxxx) : uint4((0u).xxxx)); - const uint4 is_zero = ((x == uint4((0u).xxxx)) ? uint4((4294967295u).xxxx) : uint4((0u).xxxx)); - return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_c1f940() { - int4 res = tint_first_leading_bit(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstLeadingBit_c1f940(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstLeadingBit_c1f940(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstLeadingBit_c1f940(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.msl b/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.msl deleted file mode 100644 index 24eeb0d4e3..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -int4 tint_first_leading_bit(int4 v) { - uint4 x = select(uint4(v), uint4(~(v)), (v < int4(0))); - uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u)))); - x = (x >> b16); - uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u)))); - x = (x >> b8); - uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u)))); - x = (x >> b4); - uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u)))); - x = (x >> b2); - uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u)))); - uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); - return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_c1f940() { - int4 res = tint_first_leading_bit(int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstLeadingBit_c1f940(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstLeadingBit_c1f940(); - return; -} - -kernel void compute_main() { - firstLeadingBit_c1f940(); - return; -} - diff --git a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.spvasm b/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.spvasm deleted file mode 100644 index 280467959c..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.spvasm +++ /dev/null @@ -1,154 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 110 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_leading_bit "tint_first_leading_bit" - OpName %v "v" - OpName %x "x" - OpName %firstLeadingBit_c1f940 "firstLeadingBit_c1f940" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %9 = OpTypeFunction %v4int %v4int - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %int_0 = OpConstant %int 0 - %19 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %28 = OpConstantNull %v4uint -%uint_4294901760 = OpConstant %uint 4294901760 - %33 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760 - %uint_16 = OpConstant %uint 16 - %36 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 - %uint_0 = OpConstant %uint 0 - %38 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 - %uint_65280 = OpConstant %uint 65280 - %45 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280 - %uint_8 = OpConstant %uint 8 - %48 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 - %uint_240 = OpConstant %uint 240 - %55 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240 - %uint_4 = OpConstant %uint 4 - %58 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 - %uint_12 = OpConstant %uint 12 - %65 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12 - %uint_2 = OpConstant %uint 2 - %68 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %76 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %81 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %88 = OpTypeFunction %void - %93 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %96 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_leading_bit = OpFunction %v4int None %9 - %v = OpFunctionParameter %v4int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v4uint Function %28 - %20 = OpSLessThan %v4bool %v %19 - %24 = OpNot %v4int %v - %23 = OpBitcast %v4uint %24 - %25 = OpBitcast %v4uint %v - %15 = OpSelect %v4uint %20 %23 %25 - OpStore %x %15 - %31 = OpLoad %v4uint %x - %34 = OpBitwiseAnd %v4uint %31 %33 - %30 = OpINotEqual %v4bool %34 %28 - %29 = OpSelect %v4uint %30 %36 %38 - %39 = OpLoad %v4uint %x - %40 = OpShiftRightLogical %v4uint %39 %29 - OpStore %x %40 - %43 = OpLoad %v4uint %x - %46 = OpBitwiseAnd %v4uint %43 %45 - %42 = OpINotEqual %v4bool %46 %28 - %41 = OpSelect %v4uint %42 %48 %38 - %49 = OpLoad %v4uint %x - %50 = OpShiftRightLogical %v4uint %49 %41 - OpStore %x %50 - %53 = OpLoad %v4uint %x - %56 = OpBitwiseAnd %v4uint %53 %55 - %52 = OpINotEqual %v4bool %56 %28 - %51 = OpSelect %v4uint %52 %58 %38 - %59 = OpLoad %v4uint %x - %60 = OpShiftRightLogical %v4uint %59 %51 - OpStore %x %60 - %63 = OpLoad %v4uint %x - %66 = OpBitwiseAnd %v4uint %63 %65 - %62 = OpINotEqual %v4bool %66 %28 - %61 = OpSelect %v4uint %62 %68 %38 - %69 = OpLoad %v4uint %x - %70 = OpShiftRightLogical %v4uint %69 %61 - OpStore %x %70 - %73 = OpLoad %v4uint %x - %74 = OpBitwiseAnd %v4uint %73 %68 - %72 = OpINotEqual %v4bool %74 %28 - %71 = OpSelect %v4uint %72 %76 %38 - %78 = OpLoad %v4uint %x - %79 = OpIEqual %v4bool %78 %38 - %77 = OpSelect %v4uint %79 %81 %38 - %83 = OpBitwiseOr %v4uint %29 %41 - %84 = OpBitwiseOr %v4uint %83 %51 - %85 = OpBitwiseOr %v4uint %84 %61 - %86 = OpBitwiseOr %v4uint %85 %71 - %87 = OpBitwiseOr %v4uint %86 %77 - %82 = OpBitcast %v4int %87 - OpReturnValue %82 - OpFunctionEnd -%firstLeadingBit_c1f940 = OpFunction %void None %88 - %91 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %93 - %92 = OpFunctionCall %v4int %tint_first_leading_bit %93 - OpStore %res %92 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %96 - %98 = OpLabel - %99 = OpFunctionCall %void %firstLeadingBit_c1f940 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %88 - %101 = OpLabel - %102 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %102 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %88 - %105 = OpLabel - %106 = OpFunctionCall %void %firstLeadingBit_c1f940 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %88 - %108 = OpLabel - %109 = OpFunctionCall %void %firstLeadingBit_c1f940 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.wgsl b/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.wgsl deleted file mode 100644 index b79dbd7973..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/c1f940.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstLeadingBit_c1f940() { - var res : vec4 = firstLeadingBit(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_c1f940(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_c1f940(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_c1f940(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl b/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl deleted file mode 100644 index 6d1365d326..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstLeadingBit(u32) -> u32 -fn firstLeadingBit_f0779d() { - var res: u32 = firstLeadingBit(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_f0779d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_f0779d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_f0779d(); -} diff --git a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.glsl b/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.glsl deleted file mode 100644 index 85f0190fa2..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uint tint_first_leading_bit(uint v) { - uint x = v; - uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); - x = (x >> b16); - uint b8 = (bool((x & 65280u)) ? 8u : 0u); - x = (x >> b8); - uint b4 = (bool((x & 240u)) ? 4u : 0u); - x = (x >> b4); - uint b2 = (bool((x & 12u)) ? 2u : 0u); - x = (x >> b2); - uint b1 = (bool((x & 2u)) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_f0779d() { - uint res = tint_first_leading_bit(1u); -} - -vec4 vertex_main() { - firstLeadingBit_f0779d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uint tint_first_leading_bit(uint v) { - uint x = v; - uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); - x = (x >> b16); - uint b8 = (bool((x & 65280u)) ? 8u : 0u); - x = (x >> b8); - uint b4 = (bool((x & 240u)) ? 4u : 0u); - x = (x >> b4); - uint b2 = (bool((x & 12u)) ? 2u : 0u); - x = (x >> b2); - uint b1 = (bool((x & 2u)) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_f0779d() { - uint res = tint_first_leading_bit(1u); -} - -void fragment_main() { - firstLeadingBit_f0779d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uint tint_first_leading_bit(uint v) { - uint x = v; - uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); - x = (x >> b16); - uint b8 = (bool((x & 65280u)) ? 8u : 0u); - x = (x >> b8); - uint b4 = (bool((x & 240u)) ? 4u : 0u); - x = (x >> b4); - uint b2 = (bool((x & 12u)) ? 2u : 0u); - x = (x >> b2); - uint b1 = (bool((x & 2u)) ? 1u : 0u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_f0779d() { - uint res = tint_first_leading_bit(1u); -} - -void compute_main() { - firstLeadingBit_f0779d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.hlsl b/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.hlsl deleted file mode 100644 index d89b4b3f9b..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint tint_first_leading_bit(uint v) { - uint x = v; - const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); - x = (x >> b16); - const uint b8 = (bool((x & 65280u)) ? 8u : 0u); - x = (x >> b8); - const uint b4 = (bool((x & 240u)) ? 4u : 0u); - x = (x >> b4); - const uint b2 = (bool((x & 12u)) ? 2u : 0u); - x = (x >> b2); - const uint b1 = (bool((x & 2u)) ? 1u : 0u); - const uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_f0779d() { - uint res = tint_first_leading_bit(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstLeadingBit_f0779d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstLeadingBit_f0779d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstLeadingBit_f0779d(); - return; -} diff --git a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.msl b/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.msl deleted file mode 100644 index 226d827efd..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -uint tint_first_leading_bit(uint v) { - uint x = v; - uint const b16 = select(0u, 16u, bool((x & 4294901760u))); - x = (x >> b16); - uint const b8 = select(0u, 8u, bool((x & 65280u))); - x = (x >> b8); - uint const b4 = select(0u, 4u, bool((x & 240u))); - x = (x >> b4); - uint const b2 = select(0u, 2u, bool((x & 12u))); - x = (x >> b2); - uint const b1 = select(0u, 1u, bool((x & 2u))); - uint const is_zero = select(0u, 4294967295u, (x == 0u)); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstLeadingBit_f0779d() { - uint res = tint_first_leading_bit(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstLeadingBit_f0779d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstLeadingBit_f0779d(); - return; -} - -kernel void compute_main() { - firstLeadingBit_f0779d(); - return; -} - diff --git a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.spvasm b/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.spvasm deleted file mode 100644 index 42c1b10c2a..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.spvasm +++ /dev/null @@ -1,129 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 86 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_leading_bit "tint_first_leading_bit" - OpName %v "v" - OpName %x "x" - OpName %firstLeadingBit_f0779d "firstLeadingBit_f0779d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %uint %uint -%_ptr_Function_uint = OpTypePointer Function %uint - %16 = OpConstantNull %uint - %bool = OpTypeBool -%uint_4294901760 = OpConstant %uint 4294901760 - %uint_16 = OpConstant %uint 16 - %uint_0 = OpConstant %uint 0 - %uint_65280 = OpConstant %uint 65280 - %uint_8 = OpConstant %uint 8 - %uint_240 = OpConstant %uint 240 - %uint_4 = OpConstant %uint 4 - %uint_12 = OpConstant %uint 12 - %uint_2 = OpConstant %uint 2 - %uint_1 = OpConstant %uint 1 -%uint_4294967295 = OpConstant %uint 4294967295 - %void = OpTypeVoid - %66 = OpTypeFunction %void - %72 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_leading_bit = OpFunction %uint None %9 - %v = OpFunctionParameter %uint - %13 = OpLabel - %x = OpVariable %_ptr_Function_uint Function %16 - OpStore %x %v - %20 = OpLoad %uint %x - %22 = OpBitwiseAnd %uint %20 %uint_4294901760 - %18 = OpINotEqual %bool %22 %16 - %17 = OpSelect %uint %18 %uint_16 %uint_0 - %25 = OpLoad %uint %x - %26 = OpShiftRightLogical %uint %25 %17 - OpStore %x %26 - %29 = OpLoad %uint %x - %31 = OpBitwiseAnd %uint %29 %uint_65280 - %28 = OpINotEqual %bool %31 %16 - %27 = OpSelect %uint %28 %uint_8 %uint_0 - %33 = OpLoad %uint %x - %34 = OpShiftRightLogical %uint %33 %27 - OpStore %x %34 - %37 = OpLoad %uint %x - %39 = OpBitwiseAnd %uint %37 %uint_240 - %36 = OpINotEqual %bool %39 %16 - %35 = OpSelect %uint %36 %uint_4 %uint_0 - %41 = OpLoad %uint %x - %42 = OpShiftRightLogical %uint %41 %35 - OpStore %x %42 - %45 = OpLoad %uint %x - %47 = OpBitwiseAnd %uint %45 %uint_12 - %44 = OpINotEqual %bool %47 %16 - %43 = OpSelect %uint %44 %uint_2 %uint_0 - %49 = OpLoad %uint %x - %50 = OpShiftRightLogical %uint %49 %43 - OpStore %x %50 - %53 = OpLoad %uint %x - %54 = OpBitwiseAnd %uint %53 %uint_2 - %52 = OpINotEqual %bool %54 %16 - %51 = OpSelect %uint %52 %uint_1 %uint_0 - %57 = OpLoad %uint %x - %58 = OpIEqual %bool %57 %uint_0 - %56 = OpSelect %uint %58 %uint_4294967295 %uint_0 - %61 = OpBitwiseOr %uint %17 %27 - %62 = OpBitwiseOr %uint %61 %35 - %63 = OpBitwiseOr %uint %62 %43 - %64 = OpBitwiseOr %uint %63 %51 - %65 = OpBitwiseOr %uint %64 %56 - OpReturnValue %65 - OpFunctionEnd -%firstLeadingBit_f0779d = OpFunction %void None %66 - %69 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %16 - %70 = OpFunctionCall %uint %tint_first_leading_bit %uint_1 - OpStore %res %70 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %72 - %74 = OpLabel - %75 = OpFunctionCall %void %firstLeadingBit_f0779d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %66 - %77 = OpLabel - %78 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %78 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %66 - %81 = OpLabel - %82 = OpFunctionCall %void %firstLeadingBit_f0779d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %66 - %84 = OpLabel - %85 = OpFunctionCall %void %firstLeadingBit_f0779d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.wgsl b/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.wgsl deleted file mode 100644 index 8f6430c3cb..0000000000 --- a/test/tint/builtins/gen/firstLeadingBit/f0779d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstLeadingBit_f0779d() { - var res : u32 = firstLeadingBit(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstLeadingBit_f0779d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstLeadingBit_f0779d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstLeadingBit_f0779d(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl b/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl deleted file mode 100644 index 9128ec42db..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstTrailingBit(vec<4, u32>) -> vec<4, u32> -fn firstTrailingBit_110f2c() { - var res: vec4 = firstTrailingBit(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_110f2c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_110f2c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_110f2c(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.glsl b/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.glsl deleted file mode 100644 index 02b11c1d8b..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec4 tint_first_trailing_bit(uvec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_110f2c() { - uvec4 res = tint_first_trailing_bit(uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - firstTrailingBit_110f2c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec4 tint_first_trailing_bit(uvec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_110f2c() { - uvec4 res = tint_first_trailing_bit(uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - firstTrailingBit_110f2c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec4 tint_first_trailing_bit(uvec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_110f2c() { - uvec4 res = tint_first_trailing_bit(uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - firstTrailingBit_110f2c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.hlsl b/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.hlsl deleted file mode 100644 index 34c1b662d7..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint4 tint_first_trailing_bit(uint4 v) { - uint4 x = uint4(v); - const uint4 b16 = (bool4((x & uint4((65535u).xxxx))) ? uint4((0u).xxxx) : uint4((16u).xxxx)); - x = (x >> b16); - const uint4 b8 = (bool4((x & uint4((255u).xxxx))) ? uint4((0u).xxxx) : uint4((8u).xxxx)); - x = (x >> b8); - const uint4 b4 = (bool4((x & uint4((15u).xxxx))) ? uint4((0u).xxxx) : uint4((4u).xxxx)); - x = (x >> b4); - const uint4 b2 = (bool4((x & uint4((3u).xxxx))) ? uint4((0u).xxxx) : uint4((2u).xxxx)); - x = (x >> b2); - const uint4 b1 = (bool4((x & uint4((1u).xxxx))) ? uint4((0u).xxxx) : uint4((1u).xxxx)); - const uint4 is_zero = ((x == uint4((0u).xxxx)) ? uint4((4294967295u).xxxx) : uint4((0u).xxxx)); - return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_110f2c() { - uint4 res = tint_first_trailing_bit(uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstTrailingBit_110f2c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstTrailingBit_110f2c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstTrailingBit_110f2c(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.msl b/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.msl deleted file mode 100644 index 076113fd33..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -uint4 tint_first_trailing_bit(uint4 v) { - uint4 x = uint4(v); - uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u)))); - x = (x >> b16); - uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u)))); - x = (x >> b8); - uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u)))); - x = (x >> b4); - uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u)))); - x = (x >> b2); - uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u)))); - uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); - return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_110f2c() { - uint4 res = tint_first_trailing_bit(uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstTrailingBit_110f2c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstTrailingBit_110f2c(); - return; -} - -kernel void compute_main() { - firstTrailingBit_110f2c(); - return; -} - diff --git a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.spvasm b/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.spvasm deleted file mode 100644 index 7d9b599993..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.spvasm +++ /dev/null @@ -1,142 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 100 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_trailing_bit "tint_first_trailing_bit" - OpName %v "v" - OpName %x "x" - OpName %firstTrailingBit_110f2c "firstTrailingBit_110f2c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %9 = OpTypeFunction %v4uint %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %18 = OpConstantNull %v4uint - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %uint_65535 = OpConstant %uint 65535 - %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %28 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %73 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %80 = OpTypeFunction %void - %86 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_trailing_bit = OpFunction %v4uint None %9 - %v = OpFunctionParameter %v4uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v4uint Function %18 - OpStore %x %v - %23 = OpLoad %v4uint %x - %26 = OpBitwiseAnd %v4uint %23 %25 - %20 = OpINotEqual %v4bool %26 %18 - %19 = OpSelect %v4uint %20 %28 %30 - %31 = OpLoad %v4uint %x - %32 = OpShiftRightLogical %v4uint %31 %19 - OpStore %x %32 - %35 = OpLoad %v4uint %x - %38 = OpBitwiseAnd %v4uint %35 %37 - %34 = OpINotEqual %v4bool %38 %18 - %33 = OpSelect %v4uint %34 %28 %40 - %41 = OpLoad %v4uint %x - %42 = OpShiftRightLogical %v4uint %41 %33 - OpStore %x %42 - %45 = OpLoad %v4uint %x - %48 = OpBitwiseAnd %v4uint %45 %47 - %44 = OpINotEqual %v4bool %48 %18 - %43 = OpSelect %v4uint %44 %28 %50 - %51 = OpLoad %v4uint %x - %52 = OpShiftRightLogical %v4uint %51 %43 - OpStore %x %52 - %55 = OpLoad %v4uint %x - %58 = OpBitwiseAnd %v4uint %55 %57 - %54 = OpINotEqual %v4bool %58 %18 - %53 = OpSelect %v4uint %54 %28 %60 - %61 = OpLoad %v4uint %x - %62 = OpShiftRightLogical %v4uint %61 %53 - OpStore %x %62 - %65 = OpLoad %v4uint %x - %68 = OpBitwiseAnd %v4uint %65 %67 - %64 = OpINotEqual %v4bool %68 %18 - %63 = OpSelect %v4uint %64 %28 %67 - %70 = OpLoad %v4uint %x - %71 = OpIEqual %v4bool %70 %28 - %69 = OpSelect %v4uint %71 %73 %28 - %75 = OpBitwiseOr %v4uint %19 %33 - %76 = OpBitwiseOr %v4uint %75 %43 - %77 = OpBitwiseOr %v4uint %76 %53 - %78 = OpBitwiseOr %v4uint %77 %63 - %79 = OpBitwiseOr %v4uint %78 %69 - OpReturnValue %79 - OpFunctionEnd -%firstTrailingBit_110f2c = OpFunction %void None %80 - %83 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %18 - %84 = OpFunctionCall %v4uint %tint_first_trailing_bit %18 - OpStore %res %84 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %86 - %88 = OpLabel - %89 = OpFunctionCall %void %firstTrailingBit_110f2c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %80 - %91 = OpLabel - %92 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %92 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %80 - %95 = OpLabel - %96 = OpFunctionCall %void %firstTrailingBit_110f2c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %80 - %98 = OpLabel - %99 = OpFunctionCall %void %firstTrailingBit_110f2c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.wgsl b/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.wgsl deleted file mode 100644 index d1387793d6..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/110f2c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstTrailingBit_110f2c() { - var res : vec4 = firstTrailingBit(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_110f2c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_110f2c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_110f2c(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl b/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl deleted file mode 100644 index 7ac0acf1fe..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstTrailingBit(i32) -> i32 -fn firstTrailingBit_3a2acc() { - var res: i32 = firstTrailingBit(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_3a2acc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_3a2acc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_3a2acc(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.glsl b/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.glsl deleted file mode 100644 index e24cdf8d51..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -int tint_first_trailing_bit(int v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_3a2acc() { - int res = tint_first_trailing_bit(1); -} - -vec4 vertex_main() { - firstTrailingBit_3a2acc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -int tint_first_trailing_bit(int v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_3a2acc() { - int res = tint_first_trailing_bit(1); -} - -void fragment_main() { - firstTrailingBit_3a2acc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -int tint_first_trailing_bit(int v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_3a2acc() { - int res = tint_first_trailing_bit(1); -} - -void compute_main() { - firstTrailingBit_3a2acc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.hlsl b/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.hlsl deleted file mode 100644 index 4301d3cb5e..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int tint_first_trailing_bit(int v) { - uint x = uint(v); - const uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - const uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - const uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - const uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - const uint b1 = (bool((x & 1u)) ? 0u : 1u); - const uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_3a2acc() { - int res = tint_first_trailing_bit(1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstTrailingBit_3a2acc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstTrailingBit_3a2acc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstTrailingBit_3a2acc(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.msl b/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.msl deleted file mode 100644 index 99f5439cc4..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -int tint_first_trailing_bit(int v) { - uint x = uint(v); - uint const b16 = select(16u, 0u, bool((x & 65535u))); - x = (x >> b16); - uint const b8 = select(8u, 0u, bool((x & 255u))); - x = (x >> b8); - uint const b4 = select(4u, 0u, bool((x & 15u))); - x = (x >> b4); - uint const b2 = select(2u, 0u, bool((x & 3u))); - x = (x >> b2); - uint const b1 = select(1u, 0u, bool((x & 1u))); - uint const is_zero = select(0u, 4294967295u, (x == 0u)); - return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_3a2acc() { - int res = tint_first_trailing_bit(1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstTrailingBit_3a2acc(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstTrailingBit_3a2acc(); - return; -} - -kernel void compute_main() { - firstTrailingBit_3a2acc(); - return; -} - diff --git a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.spvasm b/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.spvasm deleted file mode 100644 index 491f4a430d..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.spvasm +++ /dev/null @@ -1,135 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 91 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_trailing_bit "tint_first_trailing_bit" - OpName %v "v" - OpName %x "x" - OpName %firstTrailingBit_3a2acc "firstTrailingBit_3a2acc" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %9 = OpTypeFunction %int %int - %uint = OpTypeInt 32 0 -%_ptr_Function_uint = OpTypePointer Function %uint - %18 = OpConstantNull %uint - %bool = OpTypeBool - %uint_65535 = OpConstant %uint 65535 - %uint_0 = OpConstant %uint 0 - %uint_16 = OpConstant %uint 16 - %uint_255 = OpConstant %uint 255 - %uint_8 = OpConstant %uint 8 - %uint_15 = OpConstant %uint 15 - %uint_4 = OpConstant %uint 4 - %uint_3 = OpConstant %uint 3 - %uint_2 = OpConstant %uint 2 - %uint_1 = OpConstant %uint 1 -%uint_4294967295 = OpConstant %uint 4294967295 - %void = OpTypeVoid - %68 = OpTypeFunction %void - %int_1 = OpConstant %int 1 -%_ptr_Function_int = OpTypePointer Function %int - %76 = OpConstantNull %int - %77 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_trailing_bit = OpFunction %int None %9 - %v = OpFunctionParameter %int - %13 = OpLabel - %x = OpVariable %_ptr_Function_uint Function %18 - %14 = OpBitcast %uint %v - OpStore %x %14 - %22 = OpLoad %uint %x - %24 = OpBitwiseAnd %uint %22 %uint_65535 - %20 = OpINotEqual %bool %24 %18 - %19 = OpSelect %uint %20 %uint_0 %uint_16 - %27 = OpLoad %uint %x - %28 = OpShiftRightLogical %uint %27 %19 - OpStore %x %28 - %31 = OpLoad %uint %x - %33 = OpBitwiseAnd %uint %31 %uint_255 - %30 = OpINotEqual %bool %33 %18 - %29 = OpSelect %uint %30 %uint_0 %uint_8 - %35 = OpLoad %uint %x - %36 = OpShiftRightLogical %uint %35 %29 - OpStore %x %36 - %39 = OpLoad %uint %x - %41 = OpBitwiseAnd %uint %39 %uint_15 - %38 = OpINotEqual %bool %41 %18 - %37 = OpSelect %uint %38 %uint_0 %uint_4 - %43 = OpLoad %uint %x - %44 = OpShiftRightLogical %uint %43 %37 - OpStore %x %44 - %47 = OpLoad %uint %x - %49 = OpBitwiseAnd %uint %47 %uint_3 - %46 = OpINotEqual %bool %49 %18 - %45 = OpSelect %uint %46 %uint_0 %uint_2 - %51 = OpLoad %uint %x - %52 = OpShiftRightLogical %uint %51 %45 - OpStore %x %52 - %55 = OpLoad %uint %x - %57 = OpBitwiseAnd %uint %55 %uint_1 - %54 = OpINotEqual %bool %57 %18 - %53 = OpSelect %uint %54 %uint_0 %uint_1 - %59 = OpLoad %uint %x - %60 = OpIEqual %bool %59 %uint_0 - %58 = OpSelect %uint %60 %uint_4294967295 %uint_0 - %63 = OpBitwiseOr %uint %19 %29 - %64 = OpBitwiseOr %uint %63 %37 - %65 = OpBitwiseOr %uint %64 %45 - %66 = OpBitwiseOr %uint %65 %53 - %67 = OpBitwiseOr %uint %66 %58 - %62 = OpBitcast %int %67 - OpReturnValue %62 - OpFunctionEnd -%firstTrailingBit_3a2acc = OpFunction %void None %68 - %71 = OpLabel - %res = OpVariable %_ptr_Function_int Function %76 - %72 = OpFunctionCall %int %tint_first_trailing_bit %int_1 - OpStore %res %72 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %77 - %79 = OpLabel - %80 = OpFunctionCall %void %firstTrailingBit_3a2acc - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %68 - %82 = OpLabel - %83 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %83 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %68 - %86 = OpLabel - %87 = OpFunctionCall %void %firstTrailingBit_3a2acc - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %68 - %89 = OpLabel - %90 = OpFunctionCall %void %firstTrailingBit_3a2acc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.wgsl b/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.wgsl deleted file mode 100644 index 7d59d68246..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/3a2acc.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstTrailingBit_3a2acc() { - var res : i32 = firstTrailingBit(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_3a2acc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_3a2acc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_3a2acc(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl b/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl deleted file mode 100644 index 05678e5a7c..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstTrailingBit(vec<2, u32>) -> vec<2, u32> -fn firstTrailingBit_45eb10() { - var res: vec2 = firstTrailingBit(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_45eb10(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_45eb10(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_45eb10(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.glsl b/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.glsl deleted file mode 100644 index 90986cc66e..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec2 tint_first_trailing_bit(uvec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_45eb10() { - uvec2 res = tint_first_trailing_bit(uvec2(0u, 0u)); -} - -vec4 vertex_main() { - firstTrailingBit_45eb10(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec2 tint_first_trailing_bit(uvec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_45eb10() { - uvec2 res = tint_first_trailing_bit(uvec2(0u, 0u)); -} - -void fragment_main() { - firstTrailingBit_45eb10(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec2 tint_first_trailing_bit(uvec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_45eb10() { - uvec2 res = tint_first_trailing_bit(uvec2(0u, 0u)); -} - -void compute_main() { - firstTrailingBit_45eb10(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.hlsl b/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.hlsl deleted file mode 100644 index 3a4e74d700..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint2 tint_first_trailing_bit(uint2 v) { - uint2 x = uint2(v); - const uint2 b16 = (bool2((x & uint2((65535u).xx))) ? uint2((0u).xx) : uint2((16u).xx)); - x = (x >> b16); - const uint2 b8 = (bool2((x & uint2((255u).xx))) ? uint2((0u).xx) : uint2((8u).xx)); - x = (x >> b8); - const uint2 b4 = (bool2((x & uint2((15u).xx))) ? uint2((0u).xx) : uint2((4u).xx)); - x = (x >> b4); - const uint2 b2 = (bool2((x & uint2((3u).xx))) ? uint2((0u).xx) : uint2((2u).xx)); - x = (x >> b2); - const uint2 b1 = (bool2((x & uint2((1u).xx))) ? uint2((0u).xx) : uint2((1u).xx)); - const uint2 is_zero = ((x == uint2((0u).xx)) ? uint2((4294967295u).xx) : uint2((0u).xx)); - return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_45eb10() { - uint2 res = tint_first_trailing_bit(uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstTrailingBit_45eb10(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstTrailingBit_45eb10(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstTrailingBit_45eb10(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.msl b/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.msl deleted file mode 100644 index 309b5f713e..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -uint2 tint_first_trailing_bit(uint2 v) { - uint2 x = uint2(v); - uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u)))); - x = (x >> b16); - uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u)))); - x = (x >> b8); - uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u)))); - x = (x >> b4); - uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u)))); - x = (x >> b2); - uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u)))); - uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); - return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_45eb10() { - uint2 res = tint_first_trailing_bit(uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstTrailingBit_45eb10(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstTrailingBit_45eb10(); - return; -} - -kernel void compute_main() { - firstTrailingBit_45eb10(); - return; -} - diff --git a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.spvasm b/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.spvasm deleted file mode 100644 index ca8428cfc2..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.spvasm +++ /dev/null @@ -1,142 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 100 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_trailing_bit "tint_first_trailing_bit" - OpName %v "v" - OpName %x "x" - OpName %firstTrailingBit_45eb10 "firstTrailingBit_45eb10" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %9 = OpTypeFunction %v2uint %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %18 = OpConstantNull %v2uint - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %uint_65535 = OpConstant %uint 65535 - %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %28 = OpConstantComposite %v2uint %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %30 = OpConstantComposite %v2uint %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %37 = OpConstantComposite %v2uint %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %40 = OpConstantComposite %v2uint %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %47 = OpConstantComposite %v2uint %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %50 = OpConstantComposite %v2uint %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %57 = OpConstantComposite %v2uint %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %60 = OpConstantComposite %v2uint %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v2uint %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %73 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %80 = OpTypeFunction %void - %86 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_trailing_bit = OpFunction %v2uint None %9 - %v = OpFunctionParameter %v2uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v2uint Function %18 - OpStore %x %v - %23 = OpLoad %v2uint %x - %26 = OpBitwiseAnd %v2uint %23 %25 - %20 = OpINotEqual %v2bool %26 %18 - %19 = OpSelect %v2uint %20 %28 %30 - %31 = OpLoad %v2uint %x - %32 = OpShiftRightLogical %v2uint %31 %19 - OpStore %x %32 - %35 = OpLoad %v2uint %x - %38 = OpBitwiseAnd %v2uint %35 %37 - %34 = OpINotEqual %v2bool %38 %18 - %33 = OpSelect %v2uint %34 %28 %40 - %41 = OpLoad %v2uint %x - %42 = OpShiftRightLogical %v2uint %41 %33 - OpStore %x %42 - %45 = OpLoad %v2uint %x - %48 = OpBitwiseAnd %v2uint %45 %47 - %44 = OpINotEqual %v2bool %48 %18 - %43 = OpSelect %v2uint %44 %28 %50 - %51 = OpLoad %v2uint %x - %52 = OpShiftRightLogical %v2uint %51 %43 - OpStore %x %52 - %55 = OpLoad %v2uint %x - %58 = OpBitwiseAnd %v2uint %55 %57 - %54 = OpINotEqual %v2bool %58 %18 - %53 = OpSelect %v2uint %54 %28 %60 - %61 = OpLoad %v2uint %x - %62 = OpShiftRightLogical %v2uint %61 %53 - OpStore %x %62 - %65 = OpLoad %v2uint %x - %68 = OpBitwiseAnd %v2uint %65 %67 - %64 = OpINotEqual %v2bool %68 %18 - %63 = OpSelect %v2uint %64 %28 %67 - %70 = OpLoad %v2uint %x - %71 = OpIEqual %v2bool %70 %28 - %69 = OpSelect %v2uint %71 %73 %28 - %75 = OpBitwiseOr %v2uint %19 %33 - %76 = OpBitwiseOr %v2uint %75 %43 - %77 = OpBitwiseOr %v2uint %76 %53 - %78 = OpBitwiseOr %v2uint %77 %63 - %79 = OpBitwiseOr %v2uint %78 %69 - OpReturnValue %79 - OpFunctionEnd -%firstTrailingBit_45eb10 = OpFunction %void None %80 - %83 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %18 - %84 = OpFunctionCall %v2uint %tint_first_trailing_bit %18 - OpStore %res %84 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %86 - %88 = OpLabel - %89 = OpFunctionCall %void %firstTrailingBit_45eb10 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %80 - %91 = OpLabel - %92 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %92 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %80 - %95 = OpLabel - %96 = OpFunctionCall %void %firstTrailingBit_45eb10 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %80 - %98 = OpLabel - %99 = OpFunctionCall %void %firstTrailingBit_45eb10 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.wgsl b/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.wgsl deleted file mode 100644 index fc7dd14cfb..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/45eb10.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstTrailingBit_45eb10() { - var res : vec2 = firstTrailingBit(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_45eb10(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_45eb10(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_45eb10(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl b/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl deleted file mode 100644 index 43f7a728c2..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstTrailingBit(u32) -> u32 -fn firstTrailingBit_47d475() { - var res: u32 = firstTrailingBit(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_47d475(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_47d475(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_47d475(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.glsl b/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.glsl deleted file mode 100644 index 8f0225a790..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uint tint_first_trailing_bit(uint v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_47d475() { - uint res = tint_first_trailing_bit(1u); -} - -vec4 vertex_main() { - firstTrailingBit_47d475(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uint tint_first_trailing_bit(uint v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_47d475() { - uint res = tint_first_trailing_bit(1u); -} - -void fragment_main() { - firstTrailingBit_47d475(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uint tint_first_trailing_bit(uint v) { - uint x = uint(v); - uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - uint b1 = (bool((x & 1u)) ? 0u : 1u); - uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_47d475() { - uint res = tint_first_trailing_bit(1u); -} - -void compute_main() { - firstTrailingBit_47d475(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.hlsl b/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.hlsl deleted file mode 100644 index 95376f6354..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint tint_first_trailing_bit(uint v) { - uint x = uint(v); - const uint b16 = (bool((x & 65535u)) ? 0u : 16u); - x = (x >> b16); - const uint b8 = (bool((x & 255u)) ? 0u : 8u); - x = (x >> b8); - const uint b4 = (bool((x & 15u)) ? 0u : 4u); - x = (x >> b4); - const uint b2 = (bool((x & 3u)) ? 0u : 2u); - x = (x >> b2); - const uint b1 = (bool((x & 1u)) ? 0u : 1u); - const uint is_zero = ((x == 0u) ? 4294967295u : 0u); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_47d475() { - uint res = tint_first_trailing_bit(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstTrailingBit_47d475(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstTrailingBit_47d475(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstTrailingBit_47d475(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.msl b/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.msl deleted file mode 100644 index 9000618bd8..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -uint tint_first_trailing_bit(uint v) { - uint x = uint(v); - uint const b16 = select(16u, 0u, bool((x & 65535u))); - x = (x >> b16); - uint const b8 = select(8u, 0u, bool((x & 255u))); - x = (x >> b8); - uint const b4 = select(4u, 0u, bool((x & 15u))); - x = (x >> b4); - uint const b2 = select(2u, 0u, bool((x & 3u))); - x = (x >> b2); - uint const b1 = select(1u, 0u, bool((x & 1u))); - uint const is_zero = select(0u, 4294967295u, (x == 0u)); - return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_47d475() { - uint res = tint_first_trailing_bit(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstTrailingBit_47d475(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstTrailingBit_47d475(); - return; -} - -kernel void compute_main() { - firstTrailingBit_47d475(); - return; -} - diff --git a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.spvasm b/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.spvasm deleted file mode 100644 index 2c9f7a3b58..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.spvasm +++ /dev/null @@ -1,129 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 87 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_trailing_bit "tint_first_trailing_bit" - OpName %v "v" - OpName %x "x" - OpName %firstTrailingBit_47d475 "firstTrailingBit_47d475" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %uint %uint -%_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint - %bool = OpTypeBool - %uint_65535 = OpConstant %uint 65535 - %uint_0 = OpConstant %uint 0 - %uint_16 = OpConstant %uint 16 - %uint_255 = OpConstant %uint 255 - %uint_8 = OpConstant %uint 8 - %uint_15 = OpConstant %uint 15 - %uint_4 = OpConstant %uint 4 - %uint_3 = OpConstant %uint 3 - %uint_2 = OpConstant %uint 2 - %uint_1 = OpConstant %uint 1 -%uint_4294967295 = OpConstant %uint 4294967295 - %void = OpTypeVoid - %67 = OpTypeFunction %void - %73 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_trailing_bit = OpFunction %uint None %9 - %v = OpFunctionParameter %uint - %13 = OpLabel - %x = OpVariable %_ptr_Function_uint Function %17 - OpStore %x %v - %21 = OpLoad %uint %x - %23 = OpBitwiseAnd %uint %21 %uint_65535 - %19 = OpINotEqual %bool %23 %17 - %18 = OpSelect %uint %19 %uint_0 %uint_16 - %26 = OpLoad %uint %x - %27 = OpShiftRightLogical %uint %26 %18 - OpStore %x %27 - %30 = OpLoad %uint %x - %32 = OpBitwiseAnd %uint %30 %uint_255 - %29 = OpINotEqual %bool %32 %17 - %28 = OpSelect %uint %29 %uint_0 %uint_8 - %34 = OpLoad %uint %x - %35 = OpShiftRightLogical %uint %34 %28 - OpStore %x %35 - %38 = OpLoad %uint %x - %40 = OpBitwiseAnd %uint %38 %uint_15 - %37 = OpINotEqual %bool %40 %17 - %36 = OpSelect %uint %37 %uint_0 %uint_4 - %42 = OpLoad %uint %x - %43 = OpShiftRightLogical %uint %42 %36 - OpStore %x %43 - %46 = OpLoad %uint %x - %48 = OpBitwiseAnd %uint %46 %uint_3 - %45 = OpINotEqual %bool %48 %17 - %44 = OpSelect %uint %45 %uint_0 %uint_2 - %50 = OpLoad %uint %x - %51 = OpShiftRightLogical %uint %50 %44 - OpStore %x %51 - %54 = OpLoad %uint %x - %56 = OpBitwiseAnd %uint %54 %uint_1 - %53 = OpINotEqual %bool %56 %17 - %52 = OpSelect %uint %53 %uint_0 %uint_1 - %58 = OpLoad %uint %x - %59 = OpIEqual %bool %58 %uint_0 - %57 = OpSelect %uint %59 %uint_4294967295 %uint_0 - %62 = OpBitwiseOr %uint %18 %28 - %63 = OpBitwiseOr %uint %62 %36 - %64 = OpBitwiseOr %uint %63 %44 - %65 = OpBitwiseOr %uint %64 %52 - %66 = OpBitwiseOr %uint %65 %57 - OpReturnValue %66 - OpFunctionEnd -%firstTrailingBit_47d475 = OpFunction %void None %67 - %70 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %71 = OpFunctionCall %uint %tint_first_trailing_bit %uint_1 - OpStore %res %71 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %73 - %75 = OpLabel - %76 = OpFunctionCall %void %firstTrailingBit_47d475 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %67 - %78 = OpLabel - %79 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %79 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %67 - %82 = OpLabel - %83 = OpFunctionCall %void %firstTrailingBit_47d475 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %67 - %85 = OpLabel - %86 = OpFunctionCall %void %firstTrailingBit_47d475 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.wgsl b/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.wgsl deleted file mode 100644 index 8373e036fd..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/47d475.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstTrailingBit_47d475() { - var res : u32 = firstTrailingBit(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_47d475(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_47d475(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_47d475(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl b/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl deleted file mode 100644 index faab74f189..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstTrailingBit(vec<2, i32>) -> vec<2, i32> -fn firstTrailingBit_50c072() { - var res: vec2 = firstTrailingBit(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_50c072(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_50c072(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_50c072(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.glsl b/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.glsl deleted file mode 100644 index 1c7cb15c4a..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec2 tint_first_trailing_bit(ivec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_50c072() { - ivec2 res = tint_first_trailing_bit(ivec2(0, 0)); -} - -vec4 vertex_main() { - firstTrailingBit_50c072(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec2 tint_first_trailing_bit(ivec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_50c072() { - ivec2 res = tint_first_trailing_bit(ivec2(0, 0)); -} - -void fragment_main() { - firstTrailingBit_50c072(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec2 tint_first_trailing_bit(ivec2 v) { - uvec2 x = uvec2(v); - uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); - x = (x >> b16); - uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); - x = (x >> b8); - uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); - x = (x >> b4); - uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); - x = (x >> b2); - uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); - uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); - return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_50c072() { - ivec2 res = tint_first_trailing_bit(ivec2(0, 0)); -} - -void compute_main() { - firstTrailingBit_50c072(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.hlsl b/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.hlsl deleted file mode 100644 index b0268d558b..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int2 tint_first_trailing_bit(int2 v) { - uint2 x = uint2(v); - const uint2 b16 = (bool2((x & uint2((65535u).xx))) ? uint2((0u).xx) : uint2((16u).xx)); - x = (x >> b16); - const uint2 b8 = (bool2((x & uint2((255u).xx))) ? uint2((0u).xx) : uint2((8u).xx)); - x = (x >> b8); - const uint2 b4 = (bool2((x & uint2((15u).xx))) ? uint2((0u).xx) : uint2((4u).xx)); - x = (x >> b4); - const uint2 b2 = (bool2((x & uint2((3u).xx))) ? uint2((0u).xx) : uint2((2u).xx)); - x = (x >> b2); - const uint2 b1 = (bool2((x & uint2((1u).xx))) ? uint2((0u).xx) : uint2((1u).xx)); - const uint2 is_zero = ((x == uint2((0u).xx)) ? uint2((4294967295u).xx) : uint2((0u).xx)); - return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_50c072() { - int2 res = tint_first_trailing_bit(int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstTrailingBit_50c072(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstTrailingBit_50c072(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstTrailingBit_50c072(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.msl b/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.msl deleted file mode 100644 index f681cbf2f4..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -int2 tint_first_trailing_bit(int2 v) { - uint2 x = uint2(v); - uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u)))); - x = (x >> b16); - uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u)))); - x = (x >> b8); - uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u)))); - x = (x >> b4); - uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u)))); - x = (x >> b2); - uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u)))); - uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); - return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_50c072() { - int2 res = tint_first_trailing_bit(int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstTrailingBit_50c072(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstTrailingBit_50c072(); - return; -} - -kernel void compute_main() { - firstTrailingBit_50c072(); - return; -} - diff --git a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.spvasm b/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.spvasm deleted file mode 100644 index 8b5d1d84e2..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.spvasm +++ /dev/null @@ -1,148 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 104 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_trailing_bit "tint_first_trailing_bit" - OpName %v "v" - OpName %x "x" - OpName %firstTrailingBit_50c072 "firstTrailingBit_50c072" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %9 = OpTypeFunction %v2int %v2int - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %20 = OpConstantNull %v2uint - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %uint_65535 = OpConstant %uint 65535 - %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %30 = OpConstantComposite %v2uint %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %32 = OpConstantComposite %v2uint %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %39 = OpConstantComposite %v2uint %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %42 = OpConstantComposite %v2uint %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %49 = OpConstantComposite %v2uint %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %52 = OpConstantComposite %v2uint %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %59 = OpConstantComposite %v2uint %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %62 = OpConstantComposite %v2uint %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %69 = OpConstantComposite %v2uint %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %75 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %82 = OpTypeFunction %void - %87 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %90 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_trailing_bit = OpFunction %v2int None %9 - %v = OpFunctionParameter %v2int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v2uint Function %20 - %15 = OpBitcast %v2uint %v - OpStore %x %15 - %25 = OpLoad %v2uint %x - %28 = OpBitwiseAnd %v2uint %25 %27 - %22 = OpINotEqual %v2bool %28 %20 - %21 = OpSelect %v2uint %22 %30 %32 - %33 = OpLoad %v2uint %x - %34 = OpShiftRightLogical %v2uint %33 %21 - OpStore %x %34 - %37 = OpLoad %v2uint %x - %40 = OpBitwiseAnd %v2uint %37 %39 - %36 = OpINotEqual %v2bool %40 %20 - %35 = OpSelect %v2uint %36 %30 %42 - %43 = OpLoad %v2uint %x - %44 = OpShiftRightLogical %v2uint %43 %35 - OpStore %x %44 - %47 = OpLoad %v2uint %x - %50 = OpBitwiseAnd %v2uint %47 %49 - %46 = OpINotEqual %v2bool %50 %20 - %45 = OpSelect %v2uint %46 %30 %52 - %53 = OpLoad %v2uint %x - %54 = OpShiftRightLogical %v2uint %53 %45 - OpStore %x %54 - %57 = OpLoad %v2uint %x - %60 = OpBitwiseAnd %v2uint %57 %59 - %56 = OpINotEqual %v2bool %60 %20 - %55 = OpSelect %v2uint %56 %30 %62 - %63 = OpLoad %v2uint %x - %64 = OpShiftRightLogical %v2uint %63 %55 - OpStore %x %64 - %67 = OpLoad %v2uint %x - %70 = OpBitwiseAnd %v2uint %67 %69 - %66 = OpINotEqual %v2bool %70 %20 - %65 = OpSelect %v2uint %66 %30 %69 - %72 = OpLoad %v2uint %x - %73 = OpIEqual %v2bool %72 %30 - %71 = OpSelect %v2uint %73 %75 %30 - %77 = OpBitwiseOr %v2uint %21 %35 - %78 = OpBitwiseOr %v2uint %77 %45 - %79 = OpBitwiseOr %v2uint %78 %55 - %80 = OpBitwiseOr %v2uint %79 %65 - %81 = OpBitwiseOr %v2uint %80 %71 - %76 = OpBitcast %v2int %81 - OpReturnValue %76 - OpFunctionEnd -%firstTrailingBit_50c072 = OpFunction %void None %82 - %85 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %87 - %86 = OpFunctionCall %v2int %tint_first_trailing_bit %87 - OpStore %res %86 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %90 - %92 = OpLabel - %93 = OpFunctionCall %void %firstTrailingBit_50c072 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %82 - %95 = OpLabel - %96 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %96 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %82 - %99 = OpLabel - %100 = OpFunctionCall %void %firstTrailingBit_50c072 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %82 - %102 = OpLabel - %103 = OpFunctionCall %void %firstTrailingBit_50c072 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.wgsl b/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.wgsl deleted file mode 100644 index 550bd94501..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/50c072.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstTrailingBit_50c072() { - var res : vec2 = firstTrailingBit(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_50c072(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_50c072(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_50c072(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl b/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl deleted file mode 100644 index 5d106be138..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstTrailingBit(vec<3, i32>) -> vec<3, i32> -fn firstTrailingBit_7496d6() { - var res: vec3 = firstTrailingBit(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_7496d6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_7496d6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_7496d6(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.glsl b/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.glsl deleted file mode 100644 index ce695bb7d5..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec3 tint_first_trailing_bit(ivec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_7496d6() { - ivec3 res = tint_first_trailing_bit(ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - firstTrailingBit_7496d6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec3 tint_first_trailing_bit(ivec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_7496d6() { - ivec3 res = tint_first_trailing_bit(ivec3(0, 0, 0)); -} - -void fragment_main() { - firstTrailingBit_7496d6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec3 tint_first_trailing_bit(ivec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_7496d6() { - ivec3 res = tint_first_trailing_bit(ivec3(0, 0, 0)); -} - -void compute_main() { - firstTrailingBit_7496d6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.hlsl b/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.hlsl deleted file mode 100644 index 137b82a858..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int3 tint_first_trailing_bit(int3 v) { - uint3 x = uint3(v); - const uint3 b16 = (bool3((x & uint3((65535u).xxx))) ? uint3((0u).xxx) : uint3((16u).xxx)); - x = (x >> b16); - const uint3 b8 = (bool3((x & uint3((255u).xxx))) ? uint3((0u).xxx) : uint3((8u).xxx)); - x = (x >> b8); - const uint3 b4 = (bool3((x & uint3((15u).xxx))) ? uint3((0u).xxx) : uint3((4u).xxx)); - x = (x >> b4); - const uint3 b2 = (bool3((x & uint3((3u).xxx))) ? uint3((0u).xxx) : uint3((2u).xxx)); - x = (x >> b2); - const uint3 b1 = (bool3((x & uint3((1u).xxx))) ? uint3((0u).xxx) : uint3((1u).xxx)); - const uint3 is_zero = ((x == uint3((0u).xxx)) ? uint3((4294967295u).xxx) : uint3((0u).xxx)); - return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_7496d6() { - int3 res = tint_first_trailing_bit(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstTrailingBit_7496d6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstTrailingBit_7496d6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstTrailingBit_7496d6(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.msl b/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.msl deleted file mode 100644 index 846a9e91a7..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -int3 tint_first_trailing_bit(int3 v) { - uint3 x = uint3(v); - uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u)))); - x = (x >> b16); - uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u)))); - x = (x >> b8); - uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u)))); - x = (x >> b4); - uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u)))); - x = (x >> b2); - uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u)))); - uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); - return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_7496d6() { - int3 res = tint_first_trailing_bit(int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstTrailingBit_7496d6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstTrailingBit_7496d6(); - return; -} - -kernel void compute_main() { - firstTrailingBit_7496d6(); - return; -} - diff --git a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.spvasm b/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.spvasm deleted file mode 100644 index edbc24ca60..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.spvasm +++ /dev/null @@ -1,148 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 104 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_trailing_bit "tint_first_trailing_bit" - OpName %v "v" - OpName %x "x" - OpName %firstTrailingBit_7496d6 "firstTrailingBit_7496d6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %9 = OpTypeFunction %v3int %v3int - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %20 = OpConstantNull %v3uint - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %uint_65535 = OpConstant %uint 65535 - %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %30 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %32 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %39 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %42 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %49 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %52 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %59 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %62 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %69 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %75 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %82 = OpTypeFunction %void - %87 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %90 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_trailing_bit = OpFunction %v3int None %9 - %v = OpFunctionParameter %v3int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v3uint Function %20 - %15 = OpBitcast %v3uint %v - OpStore %x %15 - %25 = OpLoad %v3uint %x - %28 = OpBitwiseAnd %v3uint %25 %27 - %22 = OpINotEqual %v3bool %28 %20 - %21 = OpSelect %v3uint %22 %30 %32 - %33 = OpLoad %v3uint %x - %34 = OpShiftRightLogical %v3uint %33 %21 - OpStore %x %34 - %37 = OpLoad %v3uint %x - %40 = OpBitwiseAnd %v3uint %37 %39 - %36 = OpINotEqual %v3bool %40 %20 - %35 = OpSelect %v3uint %36 %30 %42 - %43 = OpLoad %v3uint %x - %44 = OpShiftRightLogical %v3uint %43 %35 - OpStore %x %44 - %47 = OpLoad %v3uint %x - %50 = OpBitwiseAnd %v3uint %47 %49 - %46 = OpINotEqual %v3bool %50 %20 - %45 = OpSelect %v3uint %46 %30 %52 - %53 = OpLoad %v3uint %x - %54 = OpShiftRightLogical %v3uint %53 %45 - OpStore %x %54 - %57 = OpLoad %v3uint %x - %60 = OpBitwiseAnd %v3uint %57 %59 - %56 = OpINotEqual %v3bool %60 %20 - %55 = OpSelect %v3uint %56 %30 %62 - %63 = OpLoad %v3uint %x - %64 = OpShiftRightLogical %v3uint %63 %55 - OpStore %x %64 - %67 = OpLoad %v3uint %x - %70 = OpBitwiseAnd %v3uint %67 %69 - %66 = OpINotEqual %v3bool %70 %20 - %65 = OpSelect %v3uint %66 %30 %69 - %72 = OpLoad %v3uint %x - %73 = OpIEqual %v3bool %72 %30 - %71 = OpSelect %v3uint %73 %75 %30 - %77 = OpBitwiseOr %v3uint %21 %35 - %78 = OpBitwiseOr %v3uint %77 %45 - %79 = OpBitwiseOr %v3uint %78 %55 - %80 = OpBitwiseOr %v3uint %79 %65 - %81 = OpBitwiseOr %v3uint %80 %71 - %76 = OpBitcast %v3int %81 - OpReturnValue %76 - OpFunctionEnd -%firstTrailingBit_7496d6 = OpFunction %void None %82 - %85 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %87 - %86 = OpFunctionCall %v3int %tint_first_trailing_bit %87 - OpStore %res %86 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %90 - %92 = OpLabel - %93 = OpFunctionCall %void %firstTrailingBit_7496d6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %82 - %95 = OpLabel - %96 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %96 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %82 - %99 = OpLabel - %100 = OpFunctionCall %void %firstTrailingBit_7496d6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %82 - %102 = OpLabel - %103 = OpFunctionCall %void %firstTrailingBit_7496d6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.wgsl b/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.wgsl deleted file mode 100644 index 85120e3875..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/7496d6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstTrailingBit_7496d6() { - var res : vec3 = firstTrailingBit(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_7496d6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_7496d6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_7496d6(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl b/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl deleted file mode 100644 index 5bf7d26b4f..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstTrailingBit(vec<4, i32>) -> vec<4, i32> -fn firstTrailingBit_86551b() { - var res: vec4 = firstTrailingBit(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_86551b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_86551b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_86551b(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.glsl b/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.glsl deleted file mode 100644 index f99612609b..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -ivec4 tint_first_trailing_bit(ivec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_86551b() { - ivec4 res = tint_first_trailing_bit(ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - firstTrailingBit_86551b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec4 tint_first_trailing_bit(ivec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_86551b() { - ivec4 res = tint_first_trailing_bit(ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - firstTrailingBit_86551b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec4 tint_first_trailing_bit(ivec4 v) { - uvec4 x = uvec4(v); - uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); - x = (x >> b16); - uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); - x = (x >> b8); - uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); - x = (x >> b4); - uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); - x = (x >> b2); - uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); - uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); - return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_86551b() { - ivec4 res = tint_first_trailing_bit(ivec4(0, 0, 0, 0)); -} - -void compute_main() { - firstTrailingBit_86551b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.hlsl b/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.hlsl deleted file mode 100644 index 16fc616643..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -int4 tint_first_trailing_bit(int4 v) { - uint4 x = uint4(v); - const uint4 b16 = (bool4((x & uint4((65535u).xxxx))) ? uint4((0u).xxxx) : uint4((16u).xxxx)); - x = (x >> b16); - const uint4 b8 = (bool4((x & uint4((255u).xxxx))) ? uint4((0u).xxxx) : uint4((8u).xxxx)); - x = (x >> b8); - const uint4 b4 = (bool4((x & uint4((15u).xxxx))) ? uint4((0u).xxxx) : uint4((4u).xxxx)); - x = (x >> b4); - const uint4 b2 = (bool4((x & uint4((3u).xxxx))) ? uint4((0u).xxxx) : uint4((2u).xxxx)); - x = (x >> b2); - const uint4 b1 = (bool4((x & uint4((1u).xxxx))) ? uint4((0u).xxxx) : uint4((1u).xxxx)); - const uint4 is_zero = ((x == uint4((0u).xxxx)) ? uint4((4294967295u).xxxx) : uint4((0u).xxxx)); - return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_86551b() { - int4 res = tint_first_trailing_bit(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstTrailingBit_86551b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstTrailingBit_86551b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstTrailingBit_86551b(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.msl b/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.msl deleted file mode 100644 index 1f3c4e8fd4..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -int4 tint_first_trailing_bit(int4 v) { - uint4 x = uint4(v); - uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u)))); - x = (x >> b16); - uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u)))); - x = (x >> b8); - uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u)))); - x = (x >> b4); - uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u)))); - x = (x >> b2); - uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u)))); - uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); - return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_86551b() { - int4 res = tint_first_trailing_bit(int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstTrailingBit_86551b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstTrailingBit_86551b(); - return; -} - -kernel void compute_main() { - firstTrailingBit_86551b(); - return; -} - diff --git a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.spvasm b/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.spvasm deleted file mode 100644 index 7e4e821058..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.spvasm +++ /dev/null @@ -1,148 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 104 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_trailing_bit "tint_first_trailing_bit" - OpName %v "v" - OpName %x "x" - OpName %firstTrailingBit_86551b "firstTrailingBit_86551b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %9 = OpTypeFunction %v4int %v4int - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %20 = OpConstantNull %v4uint - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %uint_65535 = OpConstant %uint 65535 - %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %30 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %32 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %39 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %42 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %49 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %52 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %59 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %62 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %69 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %75 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %82 = OpTypeFunction %void - %87 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %90 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_trailing_bit = OpFunction %v4int None %9 - %v = OpFunctionParameter %v4int - %14 = OpLabel - %x = OpVariable %_ptr_Function_v4uint Function %20 - %15 = OpBitcast %v4uint %v - OpStore %x %15 - %25 = OpLoad %v4uint %x - %28 = OpBitwiseAnd %v4uint %25 %27 - %22 = OpINotEqual %v4bool %28 %20 - %21 = OpSelect %v4uint %22 %30 %32 - %33 = OpLoad %v4uint %x - %34 = OpShiftRightLogical %v4uint %33 %21 - OpStore %x %34 - %37 = OpLoad %v4uint %x - %40 = OpBitwiseAnd %v4uint %37 %39 - %36 = OpINotEqual %v4bool %40 %20 - %35 = OpSelect %v4uint %36 %30 %42 - %43 = OpLoad %v4uint %x - %44 = OpShiftRightLogical %v4uint %43 %35 - OpStore %x %44 - %47 = OpLoad %v4uint %x - %50 = OpBitwiseAnd %v4uint %47 %49 - %46 = OpINotEqual %v4bool %50 %20 - %45 = OpSelect %v4uint %46 %30 %52 - %53 = OpLoad %v4uint %x - %54 = OpShiftRightLogical %v4uint %53 %45 - OpStore %x %54 - %57 = OpLoad %v4uint %x - %60 = OpBitwiseAnd %v4uint %57 %59 - %56 = OpINotEqual %v4bool %60 %20 - %55 = OpSelect %v4uint %56 %30 %62 - %63 = OpLoad %v4uint %x - %64 = OpShiftRightLogical %v4uint %63 %55 - OpStore %x %64 - %67 = OpLoad %v4uint %x - %70 = OpBitwiseAnd %v4uint %67 %69 - %66 = OpINotEqual %v4bool %70 %20 - %65 = OpSelect %v4uint %66 %30 %69 - %72 = OpLoad %v4uint %x - %73 = OpIEqual %v4bool %72 %30 - %71 = OpSelect %v4uint %73 %75 %30 - %77 = OpBitwiseOr %v4uint %21 %35 - %78 = OpBitwiseOr %v4uint %77 %45 - %79 = OpBitwiseOr %v4uint %78 %55 - %80 = OpBitwiseOr %v4uint %79 %65 - %81 = OpBitwiseOr %v4uint %80 %71 - %76 = OpBitcast %v4int %81 - OpReturnValue %76 - OpFunctionEnd -%firstTrailingBit_86551b = OpFunction %void None %82 - %85 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %87 - %86 = OpFunctionCall %v4int %tint_first_trailing_bit %87 - OpStore %res %86 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %90 - %92 = OpLabel - %93 = OpFunctionCall %void %firstTrailingBit_86551b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %82 - %95 = OpLabel - %96 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %96 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %82 - %99 = OpLabel - %100 = OpFunctionCall %void %firstTrailingBit_86551b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %82 - %102 = OpLabel - %103 = OpFunctionCall %void %firstTrailingBit_86551b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.wgsl b/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.wgsl deleted file mode 100644 index efa728bc97..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/86551b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstTrailingBit_86551b() { - var res : vec4 = firstTrailingBit(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_86551b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_86551b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_86551b(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl b/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl deleted file mode 100644 index 62ed98ef72..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn firstTrailingBit(vec<3, u32>) -> vec<3, u32> -fn firstTrailingBit_cb51ce() { - var res: vec3 = firstTrailingBit(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_cb51ce(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_cb51ce(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_cb51ce(); -} diff --git a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.glsl b/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.glsl deleted file mode 100644 index f4a773d64a..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.glsl +++ /dev/null @@ -1,94 +0,0 @@ -#version 310 es - -uvec3 tint_first_trailing_bit(uvec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_cb51ce() { - uvec3 res = tint_first_trailing_bit(uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - firstTrailingBit_cb51ce(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec3 tint_first_trailing_bit(uvec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_cb51ce() { - uvec3 res = tint_first_trailing_bit(uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - firstTrailingBit_cb51ce(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec3 tint_first_trailing_bit(uvec3 v) { - uvec3 x = uvec3(v); - uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); - x = (x >> b16); - uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); - x = (x >> b8); - uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); - x = (x >> b4); - uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); - x = (x >> b2); - uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); - uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); - return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_cb51ce() { - uvec3 res = tint_first_trailing_bit(uvec3(0u, 0u, 0u)); -} - -void compute_main() { - firstTrailingBit_cb51ce(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.hlsl b/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.hlsl deleted file mode 100644 index a5ad7f53e6..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -uint3 tint_first_trailing_bit(uint3 v) { - uint3 x = uint3(v); - const uint3 b16 = (bool3((x & uint3((65535u).xxx))) ? uint3((0u).xxx) : uint3((16u).xxx)); - x = (x >> b16); - const uint3 b8 = (bool3((x & uint3((255u).xxx))) ? uint3((0u).xxx) : uint3((8u).xxx)); - x = (x >> b8); - const uint3 b4 = (bool3((x & uint3((15u).xxx))) ? uint3((0u).xxx) : uint3((4u).xxx)); - x = (x >> b4); - const uint3 b2 = (bool3((x & uint3((3u).xxx))) ? uint3((0u).xxx) : uint3((2u).xxx)); - x = (x >> b2); - const uint3 b1 = (bool3((x & uint3((1u).xxx))) ? uint3((0u).xxx) : uint3((1u).xxx)); - const uint3 is_zero = ((x == uint3((0u).xxx)) ? uint3((4294967295u).xxx) : uint3((0u).xxx)); - return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_cb51ce() { - uint3 res = tint_first_trailing_bit(uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - firstTrailingBit_cb51ce(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - firstTrailingBit_cb51ce(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - firstTrailingBit_cb51ce(); - return; -} diff --git a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.msl b/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.msl deleted file mode 100644 index 43d50057d2..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.msl +++ /dev/null @@ -1,48 +0,0 @@ -#include - -using namespace metal; -uint3 tint_first_trailing_bit(uint3 v) { - uint3 x = uint3(v); - uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u)))); - x = (x >> b16); - uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u)))); - x = (x >> b8); - uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u)))); - x = (x >> b4); - uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u)))); - x = (x >> b2); - uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u)))); - uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); - return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); -} - -void firstTrailingBit_cb51ce() { - uint3 res = tint_first_trailing_bit(uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - firstTrailingBit_cb51ce(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - firstTrailingBit_cb51ce(); - return; -} - -kernel void compute_main() { - firstTrailingBit_cb51ce(); - return; -} - diff --git a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.spvasm b/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.spvasm deleted file mode 100644 index 4bcc0c73bc..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.spvasm +++ /dev/null @@ -1,142 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 100 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_first_trailing_bit "tint_first_trailing_bit" - OpName %v "v" - OpName %x "x" - OpName %firstTrailingBit_cb51ce "firstTrailingBit_cb51ce" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %9 = OpTypeFunction %v3uint %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %18 = OpConstantNull %v3uint - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %uint_65535 = OpConstant %uint 65535 - %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 - %uint_0 = OpConstant %uint 0 - %28 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 - %uint_16 = OpConstant %uint 16 - %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 - %uint_255 = OpConstant %uint 255 - %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 - %uint_8 = OpConstant %uint 8 - %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 - %uint_15 = OpConstant %uint 15 - %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 - %uint_4 = OpConstant %uint 4 - %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 - %uint_3 = OpConstant %uint 3 - %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 - %uint_2 = OpConstant %uint 2 - %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 - %uint_1 = OpConstant %uint 1 - %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 -%uint_4294967295 = OpConstant %uint 4294967295 - %73 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 - %void = OpTypeVoid - %80 = OpTypeFunction %void - %86 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_first_trailing_bit = OpFunction %v3uint None %9 - %v = OpFunctionParameter %v3uint - %14 = OpLabel - %x = OpVariable %_ptr_Function_v3uint Function %18 - OpStore %x %v - %23 = OpLoad %v3uint %x - %26 = OpBitwiseAnd %v3uint %23 %25 - %20 = OpINotEqual %v3bool %26 %18 - %19 = OpSelect %v3uint %20 %28 %30 - %31 = OpLoad %v3uint %x - %32 = OpShiftRightLogical %v3uint %31 %19 - OpStore %x %32 - %35 = OpLoad %v3uint %x - %38 = OpBitwiseAnd %v3uint %35 %37 - %34 = OpINotEqual %v3bool %38 %18 - %33 = OpSelect %v3uint %34 %28 %40 - %41 = OpLoad %v3uint %x - %42 = OpShiftRightLogical %v3uint %41 %33 - OpStore %x %42 - %45 = OpLoad %v3uint %x - %48 = OpBitwiseAnd %v3uint %45 %47 - %44 = OpINotEqual %v3bool %48 %18 - %43 = OpSelect %v3uint %44 %28 %50 - %51 = OpLoad %v3uint %x - %52 = OpShiftRightLogical %v3uint %51 %43 - OpStore %x %52 - %55 = OpLoad %v3uint %x - %58 = OpBitwiseAnd %v3uint %55 %57 - %54 = OpINotEqual %v3bool %58 %18 - %53 = OpSelect %v3uint %54 %28 %60 - %61 = OpLoad %v3uint %x - %62 = OpShiftRightLogical %v3uint %61 %53 - OpStore %x %62 - %65 = OpLoad %v3uint %x - %68 = OpBitwiseAnd %v3uint %65 %67 - %64 = OpINotEqual %v3bool %68 %18 - %63 = OpSelect %v3uint %64 %28 %67 - %70 = OpLoad %v3uint %x - %71 = OpIEqual %v3bool %70 %28 - %69 = OpSelect %v3uint %71 %73 %28 - %75 = OpBitwiseOr %v3uint %19 %33 - %76 = OpBitwiseOr %v3uint %75 %43 - %77 = OpBitwiseOr %v3uint %76 %53 - %78 = OpBitwiseOr %v3uint %77 %63 - %79 = OpBitwiseOr %v3uint %78 %69 - OpReturnValue %79 - OpFunctionEnd -%firstTrailingBit_cb51ce = OpFunction %void None %80 - %83 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %18 - %84 = OpFunctionCall %v3uint %tint_first_trailing_bit %18 - OpStore %res %84 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %86 - %88 = OpLabel - %89 = OpFunctionCall %void %firstTrailingBit_cb51ce - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %80 - %91 = OpLabel - %92 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %92 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %80 - %95 = OpLabel - %96 = OpFunctionCall %void %firstTrailingBit_cb51ce - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %80 - %98 = OpLabel - %99 = OpFunctionCall %void %firstTrailingBit_cb51ce - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.wgsl b/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.wgsl deleted file mode 100644 index cee5c391b7..0000000000 --- a/test/tint/builtins/gen/firstTrailingBit/cb51ce.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn firstTrailingBit_cb51ce() { - var res : vec3 = firstTrailingBit(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - firstTrailingBit_cb51ce(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - firstTrailingBit_cb51ce(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - firstTrailingBit_cb51ce(); -} diff --git a/test/tint/builtins/gen/floor/3bccc4.wgsl b/test/tint/builtins/gen/floor/3bccc4.wgsl deleted file mode 100644 index ac8b3d4694..0000000000 --- a/test/tint/builtins/gen/floor/3bccc4.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn floor(vec<4, f32>) -> vec<4, f32> -fn floor_3bccc4() { - var res: vec4 = floor(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - floor_3bccc4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - floor_3bccc4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - floor_3bccc4(); -} diff --git a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.glsl b/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.glsl deleted file mode 100644 index f62960f2e8..0000000000 --- a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void floor_3bccc4() { - vec4 res = floor(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - floor_3bccc4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void floor_3bccc4() { - vec4 res = floor(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - floor_3bccc4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void floor_3bccc4() { - vec4 res = floor(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - floor_3bccc4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.hlsl b/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.hlsl deleted file mode 100644 index b3646e4385..0000000000 --- a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void floor_3bccc4() { - float4 res = floor(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - floor_3bccc4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - floor_3bccc4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - floor_3bccc4(); - return; -} diff --git a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.msl b/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.msl deleted file mode 100644 index 74bffe2f0a..0000000000 --- a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void floor_3bccc4() { - float4 res = floor(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - floor_3bccc4(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - floor_3bccc4(); - return; -} - -kernel void compute_main() { - floor_3bccc4(); - return; -} - diff --git a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.spvasm b/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.spvasm deleted file mode 100644 index acc6532a71..0000000000 --- a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %floor_3bccc4 "floor_3bccc4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%floor_3bccc4 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Floor %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %floor_3bccc4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %floor_3bccc4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %floor_3bccc4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.wgsl b/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.wgsl deleted file mode 100644 index 878e104f59..0000000000 --- a/test/tint/builtins/gen/floor/3bccc4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn floor_3bccc4() { - var res : vec4 = floor(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - floor_3bccc4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - floor_3bccc4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - floor_3bccc4(); -} diff --git a/test/tint/builtins/gen/floor/5fc9ac.wgsl b/test/tint/builtins/gen/floor/5fc9ac.wgsl deleted file mode 100644 index cdc9c45a1b..0000000000 --- a/test/tint/builtins/gen/floor/5fc9ac.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn floor(vec<2, f32>) -> vec<2, f32> -fn floor_5fc9ac() { - var res: vec2 = floor(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - floor_5fc9ac(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - floor_5fc9ac(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - floor_5fc9ac(); -} diff --git a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.glsl b/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.glsl deleted file mode 100644 index 422a1a77d3..0000000000 --- a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void floor_5fc9ac() { - vec2 res = floor(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - floor_5fc9ac(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void floor_5fc9ac() { - vec2 res = floor(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - floor_5fc9ac(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void floor_5fc9ac() { - vec2 res = floor(vec2(0.0f, 0.0f)); -} - -void compute_main() { - floor_5fc9ac(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.hlsl b/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.hlsl deleted file mode 100644 index 8a10c2dbeb..0000000000 --- a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void floor_5fc9ac() { - float2 res = floor(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - floor_5fc9ac(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - floor_5fc9ac(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - floor_5fc9ac(); - return; -} diff --git a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.msl b/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.msl deleted file mode 100644 index 6f7234b28a..0000000000 --- a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void floor_5fc9ac() { - float2 res = floor(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - floor_5fc9ac(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - floor_5fc9ac(); - return; -} - -kernel void compute_main() { - floor_5fc9ac(); - return; -} - diff --git a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.spvasm b/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.spvasm deleted file mode 100644 index 49b872cfef..0000000000 --- a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %floor_5fc9ac "floor_5fc9ac" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%floor_5fc9ac = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Floor %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %floor_5fc9ac - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %floor_5fc9ac - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %floor_5fc9ac - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.wgsl b/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.wgsl deleted file mode 100644 index 1b6fadd5e8..0000000000 --- a/test/tint/builtins/gen/floor/5fc9ac.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn floor_5fc9ac() { - var res : vec2 = floor(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - floor_5fc9ac(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - floor_5fc9ac(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - floor_5fc9ac(); -} diff --git a/test/tint/builtins/gen/floor/60d7ea.wgsl b/test/tint/builtins/gen/floor/60d7ea.wgsl deleted file mode 100644 index a8bf8b6807..0000000000 --- a/test/tint/builtins/gen/floor/60d7ea.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn floor(vec<3, f32>) -> vec<3, f32> -fn floor_60d7ea() { - var res: vec3 = floor(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - floor_60d7ea(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - floor_60d7ea(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - floor_60d7ea(); -} diff --git a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.glsl b/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.glsl deleted file mode 100644 index 941e510bb8..0000000000 --- a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void floor_60d7ea() { - vec3 res = floor(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - floor_60d7ea(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void floor_60d7ea() { - vec3 res = floor(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - floor_60d7ea(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void floor_60d7ea() { - vec3 res = floor(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - floor_60d7ea(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.hlsl b/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.hlsl deleted file mode 100644 index fd7578a820..0000000000 --- a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void floor_60d7ea() { - float3 res = floor(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - floor_60d7ea(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - floor_60d7ea(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - floor_60d7ea(); - return; -} diff --git a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.msl b/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.msl deleted file mode 100644 index fbca5d9f19..0000000000 --- a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void floor_60d7ea() { - float3 res = floor(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - floor_60d7ea(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - floor_60d7ea(); - return; -} - -kernel void compute_main() { - floor_60d7ea(); - return; -} - diff --git a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.spvasm b/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.spvasm deleted file mode 100644 index c0fa003a5f..0000000000 --- a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %floor_60d7ea "floor_60d7ea" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%floor_60d7ea = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Floor %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %floor_60d7ea - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %floor_60d7ea - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %floor_60d7ea - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.wgsl b/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.wgsl deleted file mode 100644 index bfc5a83dba..0000000000 --- a/test/tint/builtins/gen/floor/60d7ea.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn floor_60d7ea() { - var res : vec3 = floor(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - floor_60d7ea(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - floor_60d7ea(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - floor_60d7ea(); -} diff --git a/test/tint/builtins/gen/floor/66f154.wgsl b/test/tint/builtins/gen/floor/66f154.wgsl deleted file mode 100644 index 1f0c1f8a94..0000000000 --- a/test/tint/builtins/gen/floor/66f154.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn floor(f32) -> f32 -fn floor_66f154() { - var res: f32 = floor(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - floor_66f154(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - floor_66f154(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - floor_66f154(); -} diff --git a/test/tint/builtins/gen/floor/66f154.wgsl.expected.glsl b/test/tint/builtins/gen/floor/66f154.wgsl.expected.glsl deleted file mode 100644 index 29898d8b3e..0000000000 --- a/test/tint/builtins/gen/floor/66f154.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void floor_66f154() { - float res = floor(1.0f); -} - -vec4 vertex_main() { - floor_66f154(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void floor_66f154() { - float res = floor(1.0f); -} - -void fragment_main() { - floor_66f154(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void floor_66f154() { - float res = floor(1.0f); -} - -void compute_main() { - floor_66f154(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/floor/66f154.wgsl.expected.hlsl b/test/tint/builtins/gen/floor/66f154.wgsl.expected.hlsl deleted file mode 100644 index 2809aff397..0000000000 --- a/test/tint/builtins/gen/floor/66f154.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void floor_66f154() { - float res = floor(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - floor_66f154(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - floor_66f154(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - floor_66f154(); - return; -} diff --git a/test/tint/builtins/gen/floor/66f154.wgsl.expected.msl b/test/tint/builtins/gen/floor/66f154.wgsl.expected.msl deleted file mode 100644 index 1988089e2c..0000000000 --- a/test/tint/builtins/gen/floor/66f154.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void floor_66f154() { - float res = floor(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - floor_66f154(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - floor_66f154(); - return; -} - -kernel void compute_main() { - floor_66f154(); - return; -} - diff --git a/test/tint/builtins/gen/floor/66f154.wgsl.expected.wgsl b/test/tint/builtins/gen/floor/66f154.wgsl.expected.wgsl deleted file mode 100644 index 11de386ff3..0000000000 --- a/test/tint/builtins/gen/floor/66f154.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn floor_66f154() { - var res : f32 = floor(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - floor_66f154(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - floor_66f154(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - floor_66f154(); -} diff --git a/test/tint/builtins/gen/fma/26a7a9.wgsl b/test/tint/builtins/gen/fma/26a7a9.wgsl deleted file mode 100644 index 8d1b31ae93..0000000000 --- a/test/tint/builtins/gen/fma/26a7a9.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fma(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn fma_26a7a9() { - var res: vec2 = fma(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fma_26a7a9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fma_26a7a9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fma_26a7a9(); -} diff --git a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.glsl b/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.glsl deleted file mode 100644 index 037641e883..0000000000 --- a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void fma_26a7a9() { - vec2 res = ((vec2(0.0f, 0.0f)) * (vec2(0.0f, 0.0f)) + (vec2(0.0f, 0.0f))); -} - -vec4 vertex_main() { - fma_26a7a9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void fma_26a7a9() { - vec2 res = ((vec2(0.0f, 0.0f)) * (vec2(0.0f, 0.0f)) + (vec2(0.0f, 0.0f))); -} - -void fragment_main() { - fma_26a7a9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void fma_26a7a9() { - vec2 res = ((vec2(0.0f, 0.0f)) * (vec2(0.0f, 0.0f)) + (vec2(0.0f, 0.0f))); -} - -void compute_main() { - fma_26a7a9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.hlsl b/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.hlsl deleted file mode 100644 index 534f1fbd77..0000000000 --- a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void fma_26a7a9() { - float2 res = mad(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - fma_26a7a9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - fma_26a7a9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - fma_26a7a9(); - return; -} diff --git a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.msl b/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.msl deleted file mode 100644 index b87b6fe09b..0000000000 --- a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void fma_26a7a9() { - float2 res = fma(float2(), float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - fma_26a7a9(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - fma_26a7a9(); - return; -} - -kernel void compute_main() { - fma_26a7a9(); - return; -} - diff --git a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.spvasm b/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.spvasm deleted file mode 100644 index 5df98bd256..0000000000 --- a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %fma_26a7a9 "fma_26a7a9" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %fma_26a7a9 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Fma %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %fma_26a7a9 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %fma_26a7a9 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %fma_26a7a9 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.wgsl b/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.wgsl deleted file mode 100644 index f1edf4ec43..0000000000 --- a/test/tint/builtins/gen/fma/26a7a9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn fma_26a7a9() { - var res : vec2 = fma(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fma_26a7a9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fma_26a7a9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fma_26a7a9(); -} diff --git a/test/tint/builtins/gen/fma/6a3283.wgsl b/test/tint/builtins/gen/fma/6a3283.wgsl deleted file mode 100644 index 7304803533..0000000000 --- a/test/tint/builtins/gen/fma/6a3283.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fma(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn fma_6a3283() { - var res: vec4 = fma(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fma_6a3283(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fma_6a3283(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fma_6a3283(); -} diff --git a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.glsl b/test/tint/builtins/gen/fma/6a3283.wgsl.expected.glsl deleted file mode 100644 index 80fbecaf49..0000000000 --- a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void fma_6a3283() { - vec4 res = ((vec4(0.0f, 0.0f, 0.0f, 0.0f)) * (vec4(0.0f, 0.0f, 0.0f, 0.0f)) + (vec4(0.0f, 0.0f, 0.0f, 0.0f))); -} - -vec4 vertex_main() { - fma_6a3283(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void fma_6a3283() { - vec4 res = ((vec4(0.0f, 0.0f, 0.0f, 0.0f)) * (vec4(0.0f, 0.0f, 0.0f, 0.0f)) + (vec4(0.0f, 0.0f, 0.0f, 0.0f))); -} - -void fragment_main() { - fma_6a3283(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void fma_6a3283() { - vec4 res = ((vec4(0.0f, 0.0f, 0.0f, 0.0f)) * (vec4(0.0f, 0.0f, 0.0f, 0.0f)) + (vec4(0.0f, 0.0f, 0.0f, 0.0f))); -} - -void compute_main() { - fma_6a3283(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.hlsl b/test/tint/builtins/gen/fma/6a3283.wgsl.expected.hlsl deleted file mode 100644 index c550df4f22..0000000000 --- a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void fma_6a3283() { - float4 res = mad(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - fma_6a3283(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - fma_6a3283(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - fma_6a3283(); - return; -} diff --git a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.msl b/test/tint/builtins/gen/fma/6a3283.wgsl.expected.msl deleted file mode 100644 index a75b54f709..0000000000 --- a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void fma_6a3283() { - float4 res = fma(float4(), float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - fma_6a3283(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - fma_6a3283(); - return; -} - -kernel void compute_main() { - fma_6a3283(); - return; -} - diff --git a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.spvasm b/test/tint/builtins/gen/fma/6a3283.wgsl.expected.spvasm deleted file mode 100644 index cf266852c7..0000000000 --- a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %fma_6a3283 "fma_6a3283" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %fma_6a3283 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Fma %5 %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %fma_6a3283 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %fma_6a3283 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %fma_6a3283 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.wgsl b/test/tint/builtins/gen/fma/6a3283.wgsl.expected.wgsl deleted file mode 100644 index 267c2b107e..0000000000 --- a/test/tint/builtins/gen/fma/6a3283.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn fma_6a3283() { - var res : vec4 = fma(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fma_6a3283(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fma_6a3283(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fma_6a3283(); -} diff --git a/test/tint/builtins/gen/fma/c10ba3.wgsl b/test/tint/builtins/gen/fma/c10ba3.wgsl deleted file mode 100644 index b7099cc291..0000000000 --- a/test/tint/builtins/gen/fma/c10ba3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fma(f32, f32, f32) -> f32 -fn fma_c10ba3() { - var res: f32 = fma(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fma_c10ba3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fma_c10ba3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fma_c10ba3(); -} diff --git a/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.glsl b/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.glsl deleted file mode 100644 index 1b5dc88010..0000000000 --- a/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void fma_c10ba3() { - float res = ((1.0f) * (1.0f) + (1.0f)); -} - -vec4 vertex_main() { - fma_c10ba3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void fma_c10ba3() { - float res = ((1.0f) * (1.0f) + (1.0f)); -} - -void fragment_main() { - fma_c10ba3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void fma_c10ba3() { - float res = ((1.0f) * (1.0f) + (1.0f)); -} - -void compute_main() { - fma_c10ba3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.hlsl b/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.hlsl deleted file mode 100644 index d4eb7cf6f3..0000000000 --- a/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void fma_c10ba3() { - float res = mad(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - fma_c10ba3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - fma_c10ba3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - fma_c10ba3(); - return; -} diff --git a/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.msl b/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.msl deleted file mode 100644 index 886ff735da..0000000000 --- a/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void fma_c10ba3() { - float res = fma(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - fma_c10ba3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - fma_c10ba3(); - return; -} - -kernel void compute_main() { - fma_c10ba3(); - return; -} - diff --git a/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.wgsl b/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.wgsl deleted file mode 100644 index baec69d68c..0000000000 --- a/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn fma_c10ba3() { - var res : f32 = fma(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fma_c10ba3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fma_c10ba3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fma_c10ba3(); -} diff --git a/test/tint/builtins/gen/fma/e17c5c.wgsl b/test/tint/builtins/gen/fma/e17c5c.wgsl deleted file mode 100644 index 1729e62895..0000000000 --- a/test/tint/builtins/gen/fma/e17c5c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fma(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn fma_e17c5c() { - var res: vec3 = fma(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fma_e17c5c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fma_e17c5c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fma_e17c5c(); -} diff --git a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.glsl b/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.glsl deleted file mode 100644 index efd6b76012..0000000000 --- a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void fma_e17c5c() { - vec3 res = ((vec3(0.0f, 0.0f, 0.0f)) * (vec3(0.0f, 0.0f, 0.0f)) + (vec3(0.0f, 0.0f, 0.0f))); -} - -vec4 vertex_main() { - fma_e17c5c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void fma_e17c5c() { - vec3 res = ((vec3(0.0f, 0.0f, 0.0f)) * (vec3(0.0f, 0.0f, 0.0f)) + (vec3(0.0f, 0.0f, 0.0f))); -} - -void fragment_main() { - fma_e17c5c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void fma_e17c5c() { - vec3 res = ((vec3(0.0f, 0.0f, 0.0f)) * (vec3(0.0f, 0.0f, 0.0f)) + (vec3(0.0f, 0.0f, 0.0f))); -} - -void compute_main() { - fma_e17c5c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.hlsl b/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.hlsl deleted file mode 100644 index 486a595f5b..0000000000 --- a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void fma_e17c5c() { - float3 res = mad(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - fma_e17c5c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - fma_e17c5c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - fma_e17c5c(); - return; -} diff --git a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.msl b/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.msl deleted file mode 100644 index 8c680e11c1..0000000000 --- a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void fma_e17c5c() { - float3 res = fma(float3(), float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - fma_e17c5c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - fma_e17c5c(); - return; -} - -kernel void compute_main() { - fma_e17c5c(); - return; -} - diff --git a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.spvasm b/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.spvasm deleted file mode 100644 index de2025e442..0000000000 --- a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %fma_e17c5c "fma_e17c5c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %fma_e17c5c = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Fma %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %fma_e17c5c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %fma_e17c5c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %fma_e17c5c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.wgsl b/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.wgsl deleted file mode 100644 index adc6a88802..0000000000 --- a/test/tint/builtins/gen/fma/e17c5c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn fma_e17c5c() { - var res : vec3 = fma(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fma_e17c5c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fma_e17c5c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fma_e17c5c(); -} diff --git a/test/tint/builtins/gen/fract/8bc1e9.wgsl b/test/tint/builtins/gen/fract/8bc1e9.wgsl deleted file mode 100644 index 2e3663bc3a..0000000000 --- a/test/tint/builtins/gen/fract/8bc1e9.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fract(vec<4, f32>) -> vec<4, f32> -fn fract_8bc1e9() { - var res: vec4 = fract(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fract_8bc1e9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fract_8bc1e9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fract_8bc1e9(); -} diff --git a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.glsl b/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.glsl deleted file mode 100644 index e906dbae52..0000000000 --- a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void fract_8bc1e9() { - vec4 res = fract(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - fract_8bc1e9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void fract_8bc1e9() { - vec4 res = fract(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fract_8bc1e9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void fract_8bc1e9() { - vec4 res = fract(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - fract_8bc1e9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.hlsl b/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.hlsl deleted file mode 100644 index f77b849473..0000000000 --- a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void fract_8bc1e9() { - float4 res = frac(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - fract_8bc1e9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - fract_8bc1e9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - fract_8bc1e9(); - return; -} diff --git a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.msl b/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.msl deleted file mode 100644 index 0d01c219fa..0000000000 --- a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void fract_8bc1e9() { - float4 res = fract(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - fract_8bc1e9(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - fract_8bc1e9(); - return; -} - -kernel void compute_main() { - fract_8bc1e9(); - return; -} - diff --git a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.spvasm b/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.spvasm deleted file mode 100644 index e6d041881d..0000000000 --- a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %fract_8bc1e9 "fract_8bc1e9" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%fract_8bc1e9 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Fract %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %fract_8bc1e9 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %fract_8bc1e9 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %fract_8bc1e9 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.wgsl b/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.wgsl deleted file mode 100644 index 6476408983..0000000000 --- a/test/tint/builtins/gen/fract/8bc1e9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn fract_8bc1e9() { - var res : vec4 = fract(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fract_8bc1e9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fract_8bc1e9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fract_8bc1e9(); -} diff --git a/test/tint/builtins/gen/fract/943cb1.wgsl b/test/tint/builtins/gen/fract/943cb1.wgsl deleted file mode 100644 index 940f4692e1..0000000000 --- a/test/tint/builtins/gen/fract/943cb1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fract(vec<2, f32>) -> vec<2, f32> -fn fract_943cb1() { - var res: vec2 = fract(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fract_943cb1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fract_943cb1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fract_943cb1(); -} diff --git a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.glsl b/test/tint/builtins/gen/fract/943cb1.wgsl.expected.glsl deleted file mode 100644 index 72b0a1ba27..0000000000 --- a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void fract_943cb1() { - vec2 res = fract(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - fract_943cb1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void fract_943cb1() { - vec2 res = fract(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - fract_943cb1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void fract_943cb1() { - vec2 res = fract(vec2(0.0f, 0.0f)); -} - -void compute_main() { - fract_943cb1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.hlsl b/test/tint/builtins/gen/fract/943cb1.wgsl.expected.hlsl deleted file mode 100644 index a5c4e2a6c3..0000000000 --- a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void fract_943cb1() { - float2 res = frac(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - fract_943cb1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - fract_943cb1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - fract_943cb1(); - return; -} diff --git a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.msl b/test/tint/builtins/gen/fract/943cb1.wgsl.expected.msl deleted file mode 100644 index f288f7905f..0000000000 --- a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void fract_943cb1() { - float2 res = fract(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - fract_943cb1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - fract_943cb1(); - return; -} - -kernel void compute_main() { - fract_943cb1(); - return; -} - diff --git a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.spvasm b/test/tint/builtins/gen/fract/943cb1.wgsl.expected.spvasm deleted file mode 100644 index afe8e9841f..0000000000 --- a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %fract_943cb1 "fract_943cb1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%fract_943cb1 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Fract %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %fract_943cb1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %fract_943cb1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %fract_943cb1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.wgsl b/test/tint/builtins/gen/fract/943cb1.wgsl.expected.wgsl deleted file mode 100644 index 977e3f95a6..0000000000 --- a/test/tint/builtins/gen/fract/943cb1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn fract_943cb1() { - var res : vec2 = fract(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fract_943cb1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fract_943cb1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fract_943cb1(); -} diff --git a/test/tint/builtins/gen/fract/a49758.wgsl b/test/tint/builtins/gen/fract/a49758.wgsl deleted file mode 100644 index e8d73a0428..0000000000 --- a/test/tint/builtins/gen/fract/a49758.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fract(vec<3, f32>) -> vec<3, f32> -fn fract_a49758() { - var res: vec3 = fract(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fract_a49758(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fract_a49758(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fract_a49758(); -} diff --git a/test/tint/builtins/gen/fract/a49758.wgsl.expected.glsl b/test/tint/builtins/gen/fract/a49758.wgsl.expected.glsl deleted file mode 100644 index bcb4432ce8..0000000000 --- a/test/tint/builtins/gen/fract/a49758.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void fract_a49758() { - vec3 res = fract(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - fract_a49758(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void fract_a49758() { - vec3 res = fract(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fract_a49758(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void fract_a49758() { - vec3 res = fract(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - fract_a49758(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/fract/a49758.wgsl.expected.hlsl b/test/tint/builtins/gen/fract/a49758.wgsl.expected.hlsl deleted file mode 100644 index 37f641a3b3..0000000000 --- a/test/tint/builtins/gen/fract/a49758.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void fract_a49758() { - float3 res = frac(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - fract_a49758(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - fract_a49758(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - fract_a49758(); - return; -} diff --git a/test/tint/builtins/gen/fract/a49758.wgsl.expected.msl b/test/tint/builtins/gen/fract/a49758.wgsl.expected.msl deleted file mode 100644 index 0d14e6ad63..0000000000 --- a/test/tint/builtins/gen/fract/a49758.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void fract_a49758() { - float3 res = fract(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - fract_a49758(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - fract_a49758(); - return; -} - -kernel void compute_main() { - fract_a49758(); - return; -} - diff --git a/test/tint/builtins/gen/fract/a49758.wgsl.expected.spvasm b/test/tint/builtins/gen/fract/a49758.wgsl.expected.spvasm deleted file mode 100644 index 284b664512..0000000000 --- a/test/tint/builtins/gen/fract/a49758.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %fract_a49758 "fract_a49758" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%fract_a49758 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Fract %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %fract_a49758 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %fract_a49758 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %fract_a49758 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fract/a49758.wgsl.expected.wgsl b/test/tint/builtins/gen/fract/a49758.wgsl.expected.wgsl deleted file mode 100644 index 7ab47df0dc..0000000000 --- a/test/tint/builtins/gen/fract/a49758.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn fract_a49758() { - var res : vec3 = fract(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fract_a49758(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fract_a49758(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fract_a49758(); -} diff --git a/test/tint/builtins/gen/fract/fa5c71.wgsl b/test/tint/builtins/gen/fract/fa5c71.wgsl deleted file mode 100644 index ec0fed4f0b..0000000000 --- a/test/tint/builtins/gen/fract/fa5c71.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fract(f32) -> f32 -fn fract_fa5c71() { - var res: f32 = fract(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fract_fa5c71(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fract_fa5c71(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fract_fa5c71(); -} diff --git a/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.glsl b/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.glsl deleted file mode 100644 index 7fd676a73a..0000000000 --- a/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void fract_fa5c71() { - float res = fract(1.0f); -} - -vec4 vertex_main() { - fract_fa5c71(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void fract_fa5c71() { - float res = fract(1.0f); -} - -void fragment_main() { - fract_fa5c71(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void fract_fa5c71() { - float res = fract(1.0f); -} - -void compute_main() { - fract_fa5c71(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.hlsl b/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.hlsl deleted file mode 100644 index f8d423da9d..0000000000 --- a/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void fract_fa5c71() { - float res = frac(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - fract_fa5c71(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - fract_fa5c71(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - fract_fa5c71(); - return; -} diff --git a/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.msl b/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.msl deleted file mode 100644 index 0660148b39..0000000000 --- a/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void fract_fa5c71() { - float res = fract(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - fract_fa5c71(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - fract_fa5c71(); - return; -} - -kernel void compute_main() { - fract_fa5c71(); - return; -} - diff --git a/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.wgsl b/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.wgsl deleted file mode 100644 index 3599c793b1..0000000000 --- a/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn fract_fa5c71() { - var res : f32 = fract(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - fract_fa5c71(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - fract_fa5c71(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - fract_fa5c71(); -} diff --git a/test/tint/builtins/gen/frexp/368997.wgsl b/test/tint/builtins/gen/frexp/368997.wgsl deleted file mode 100644 index 57930edfe0..0000000000 --- a/test/tint/builtins/gen/frexp/368997.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn frexp(vec<3, f32>) -> __frexp_result_vec<3> -fn frexp_368997() { - var res = frexp(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - frexp_368997(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - frexp_368997(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - frexp_368997(); -} diff --git a/test/tint/builtins/gen/frexp/368997.wgsl.expected.glsl b/test/tint/builtins/gen/frexp/368997.wgsl.expected.glsl deleted file mode 100644 index 3e4bc1fecf..0000000000 --- a/test/tint/builtins/gen/frexp/368997.wgsl.expected.glsl +++ /dev/null @@ -1,85 +0,0 @@ -#version 310 es - -struct frexp_result_vec3 { - vec3 sig; - ivec3 exp; -}; - -frexp_result_vec3 tint_frexp(vec3 param_0) { - frexp_result_vec3 result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_368997() { - frexp_result_vec3 res = tint_frexp(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - frexp_368997(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -struct frexp_result_vec3 { - vec3 sig; - ivec3 exp; -}; - -frexp_result_vec3 tint_frexp(vec3 param_0) { - frexp_result_vec3 result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_368997() { - frexp_result_vec3 res = tint_frexp(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - frexp_368997(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -struct frexp_result_vec3 { - vec3 sig; - ivec3 exp; -}; - -frexp_result_vec3 tint_frexp(vec3 param_0) { - frexp_result_vec3 result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_368997() { - frexp_result_vec3 res = tint_frexp(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - frexp_368997(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/frexp/368997.wgsl.expected.hlsl b/test/tint/builtins/gen/frexp/368997.wgsl.expected.hlsl deleted file mode 100644 index aaf44a24e9..0000000000 --- a/test/tint/builtins/gen/frexp/368997.wgsl.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -struct frexp_result_vec3 { - float3 sig; - int3 exp; -}; -frexp_result_vec3 tint_frexp(float3 param_0) { - float3 exp; - float3 sig = frexp(param_0, exp); - frexp_result_vec3 result = {sig, int3(exp)}; - return result; -} - -void frexp_368997() { - frexp_result_vec3 res = tint_frexp(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - frexp_368997(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - frexp_368997(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - frexp_368997(); - return; -} diff --git a/test/tint/builtins/gen/frexp/368997.wgsl.expected.msl b/test/tint/builtins/gen/frexp/368997.wgsl.expected.msl deleted file mode 100644 index 852c7f398a..0000000000 --- a/test/tint/builtins/gen/frexp/368997.wgsl.expected.msl +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace metal; - -struct frexp_result_vec3 { - float3 sig; - int3 exp; -}; -frexp_result_vec3 tint_frexp(float3 param_0) { - int3 exp; - float3 sig = frexp(param_0, exp); - return {sig, exp}; -} - -void frexp_368997() { - frexp_result_vec3 res = tint_frexp(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - frexp_368997(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - frexp_368997(); - return; -} - -kernel void compute_main() { - frexp_368997(); - return; -} - diff --git a/test/tint/builtins/gen/frexp/368997.wgsl.expected.spvasm b/test/tint/builtins/gen/frexp/368997.wgsl.expected.spvasm deleted file mode 100644 index 1aba2f8fde..0000000000 --- a/test/tint/builtins/gen/frexp/368997.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 37 -; Schema: 0 - OpCapability Shader - %18 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %frexp_368997 "frexp_368997" - OpName %__frexp_result_vec3 "__frexp_result_vec3" - OpMemberName %__frexp_result_vec3 0 "sig" - OpMemberName %__frexp_result_vec3 1 "exp" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpMemberDecorate %__frexp_result_vec3 0 Offset 0 - OpMemberDecorate %__frexp_result_vec3 1 Offset 16 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 -%__frexp_result_vec3 = OpTypeStruct %v3float %v3int - %19 = OpConstantNull %v3float -%_ptr_Function___frexp_result_vec3 = OpTypePointer Function %__frexp_result_vec3 - %22 = OpConstantNull %__frexp_result_vec3 - %23 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%frexp_368997 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function___frexp_result_vec3 Function %22 - %13 = OpExtInst %__frexp_result_vec3 %18 FrexpStruct %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %frexp_368997 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %frexp_368997 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %frexp_368997 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/frexp/368997.wgsl.expected.wgsl b/test/tint/builtins/gen/frexp/368997.wgsl.expected.wgsl deleted file mode 100644 index 914f1d5e48..0000000000 --- a/test/tint/builtins/gen/frexp/368997.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn frexp_368997() { - var res = frexp(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - frexp_368997(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - frexp_368997(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - frexp_368997(); -} diff --git a/test/tint/builtins/gen/frexp/3c4f48.wgsl b/test/tint/builtins/gen/frexp/3c4f48.wgsl deleted file mode 100644 index 74a8ef1582..0000000000 --- a/test/tint/builtins/gen/frexp/3c4f48.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn frexp(vec<4, f32>) -> __frexp_result_vec<4> -fn frexp_3c4f48() { - var res = frexp(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - frexp_3c4f48(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - frexp_3c4f48(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - frexp_3c4f48(); -} diff --git a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.glsl b/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.glsl deleted file mode 100644 index 1149013882..0000000000 --- a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.glsl +++ /dev/null @@ -1,85 +0,0 @@ -#version 310 es - -struct frexp_result_vec4 { - vec4 sig; - ivec4 exp; -}; - -frexp_result_vec4 tint_frexp(vec4 param_0) { - frexp_result_vec4 result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_3c4f48() { - frexp_result_vec4 res = tint_frexp(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - frexp_3c4f48(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -struct frexp_result_vec4 { - vec4 sig; - ivec4 exp; -}; - -frexp_result_vec4 tint_frexp(vec4 param_0) { - frexp_result_vec4 result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_3c4f48() { - frexp_result_vec4 res = tint_frexp(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - frexp_3c4f48(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -struct frexp_result_vec4 { - vec4 sig; - ivec4 exp; -}; - -frexp_result_vec4 tint_frexp(vec4 param_0) { - frexp_result_vec4 result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_3c4f48() { - frexp_result_vec4 res = tint_frexp(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - frexp_3c4f48(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.hlsl b/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.hlsl deleted file mode 100644 index a97e7b54d3..0000000000 --- a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -struct frexp_result_vec4 { - float4 sig; - int4 exp; -}; -frexp_result_vec4 tint_frexp(float4 param_0) { - float4 exp; - float4 sig = frexp(param_0, exp); - frexp_result_vec4 result = {sig, int4(exp)}; - return result; -} - -void frexp_3c4f48() { - frexp_result_vec4 res = tint_frexp(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - frexp_3c4f48(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - frexp_3c4f48(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - frexp_3c4f48(); - return; -} diff --git a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.msl b/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.msl deleted file mode 100644 index 11314ca39f..0000000000 --- a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.msl +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace metal; - -struct frexp_result_vec4 { - float4 sig; - int4 exp; -}; -frexp_result_vec4 tint_frexp(float4 param_0) { - int4 exp; - float4 sig = frexp(param_0, exp); - return {sig, exp}; -} - -void frexp_3c4f48() { - frexp_result_vec4 res = tint_frexp(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - frexp_3c4f48(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - frexp_3c4f48(); - return; -} - -kernel void compute_main() { - frexp_3c4f48(); - return; -} - diff --git a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.spvasm b/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.spvasm deleted file mode 100644 index 82a388ccec..0000000000 --- a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - %17 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %frexp_3c4f48 "frexp_3c4f48" - OpName %__frexp_result_vec4 "__frexp_result_vec4" - OpMemberName %__frexp_result_vec4 0 "sig" - OpMemberName %__frexp_result_vec4 1 "exp" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpMemberDecorate %__frexp_result_vec4 0 Offset 0 - OpMemberDecorate %__frexp_result_vec4 1 Offset 16 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 -%__frexp_result_vec4 = OpTypeStruct %v4float %v4int -%_ptr_Function___frexp_result_vec4 = OpTypePointer Function %__frexp_result_vec4 - %20 = OpConstantNull %__frexp_result_vec4 - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%frexp_3c4f48 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function___frexp_result_vec4 Function %20 - %13 = OpExtInst %__frexp_result_vec4 %17 FrexpStruct %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %frexp_3c4f48 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %frexp_3c4f48 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %frexp_3c4f48 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.wgsl b/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.wgsl deleted file mode 100644 index 2129fb60e0..0000000000 --- a/test/tint/builtins/gen/frexp/3c4f48.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn frexp_3c4f48() { - var res = frexp(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - frexp_3c4f48(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - frexp_3c4f48(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - frexp_3c4f48(); -} diff --git a/test/tint/builtins/gen/frexp/4bdfc7.wgsl b/test/tint/builtins/gen/frexp/4bdfc7.wgsl deleted file mode 100644 index c9471780e3..0000000000 --- a/test/tint/builtins/gen/frexp/4bdfc7.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn frexp(vec<2, f32>) -> __frexp_result_vec<2> -fn frexp_4bdfc7() { - var res = frexp(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - frexp_4bdfc7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - frexp_4bdfc7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - frexp_4bdfc7(); -} diff --git a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.glsl b/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.glsl deleted file mode 100644 index 76052caf92..0000000000 --- a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.glsl +++ /dev/null @@ -1,85 +0,0 @@ -#version 310 es - -struct frexp_result_vec2 { - vec2 sig; - ivec2 exp; -}; - -frexp_result_vec2 tint_frexp(vec2 param_0) { - frexp_result_vec2 result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_4bdfc7() { - frexp_result_vec2 res = tint_frexp(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - frexp_4bdfc7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -struct frexp_result_vec2 { - vec2 sig; - ivec2 exp; -}; - -frexp_result_vec2 tint_frexp(vec2 param_0) { - frexp_result_vec2 result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_4bdfc7() { - frexp_result_vec2 res = tint_frexp(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - frexp_4bdfc7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -struct frexp_result_vec2 { - vec2 sig; - ivec2 exp; -}; - -frexp_result_vec2 tint_frexp(vec2 param_0) { - frexp_result_vec2 result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_4bdfc7() { - frexp_result_vec2 res = tint_frexp(vec2(0.0f, 0.0f)); -} - -void compute_main() { - frexp_4bdfc7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.hlsl b/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.hlsl deleted file mode 100644 index 8a62da45d9..0000000000 --- a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -struct frexp_result_vec2 { - float2 sig; - int2 exp; -}; -frexp_result_vec2 tint_frexp(float2 param_0) { - float2 exp; - float2 sig = frexp(param_0, exp); - frexp_result_vec2 result = {sig, int2(exp)}; - return result; -} - -void frexp_4bdfc7() { - frexp_result_vec2 res = tint_frexp(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - frexp_4bdfc7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - frexp_4bdfc7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - frexp_4bdfc7(); - return; -} diff --git a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.msl b/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.msl deleted file mode 100644 index f207cc6b6c..0000000000 --- a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.msl +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace metal; - -struct frexp_result_vec2 { - float2 sig; - int2 exp; -}; -frexp_result_vec2 tint_frexp(float2 param_0) { - int2 exp; - float2 sig = frexp(param_0, exp); - return {sig, exp}; -} - -void frexp_4bdfc7() { - frexp_result_vec2 res = tint_frexp(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - frexp_4bdfc7(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - frexp_4bdfc7(); - return; -} - -kernel void compute_main() { - frexp_4bdfc7(); - return; -} - diff --git a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.spvasm b/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.spvasm deleted file mode 100644 index 3a47390c0a..0000000000 --- a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 37 -; Schema: 0 - OpCapability Shader - %18 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %frexp_4bdfc7 "frexp_4bdfc7" - OpName %__frexp_result_vec2 "__frexp_result_vec2" - OpMemberName %__frexp_result_vec2 0 "sig" - OpMemberName %__frexp_result_vec2 1 "exp" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpMemberDecorate %__frexp_result_vec2 0 Offset 0 - OpMemberDecorate %__frexp_result_vec2 1 Offset 8 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 -%__frexp_result_vec2 = OpTypeStruct %v2float %v2int - %19 = OpConstantNull %v2float -%_ptr_Function___frexp_result_vec2 = OpTypePointer Function %__frexp_result_vec2 - %22 = OpConstantNull %__frexp_result_vec2 - %23 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%frexp_4bdfc7 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function___frexp_result_vec2 Function %22 - %13 = OpExtInst %__frexp_result_vec2 %18 FrexpStruct %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %frexp_4bdfc7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %frexp_4bdfc7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %frexp_4bdfc7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.wgsl b/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.wgsl deleted file mode 100644 index 8dfe70c32e..0000000000 --- a/test/tint/builtins/gen/frexp/4bdfc7.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn frexp_4bdfc7() { - var res = frexp(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - frexp_4bdfc7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - frexp_4bdfc7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - frexp_4bdfc7(); -} diff --git a/test/tint/builtins/gen/frexp/eabd40.wgsl b/test/tint/builtins/gen/frexp/eabd40.wgsl deleted file mode 100644 index 9eeab1d8da..0000000000 --- a/test/tint/builtins/gen/frexp/eabd40.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn frexp(f32) -> __frexp_result -fn frexp_eabd40() { - var res = frexp(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - frexp_eabd40(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - frexp_eabd40(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - frexp_eabd40(); -} diff --git a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.glsl b/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.glsl deleted file mode 100644 index 4d5a4e89bc..0000000000 --- a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.glsl +++ /dev/null @@ -1,85 +0,0 @@ -#version 310 es - -struct frexp_result { - float sig; - int exp; -}; - -frexp_result tint_frexp(float param_0) { - frexp_result result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_eabd40() { - frexp_result res = tint_frexp(1.0f); -} - -vec4 vertex_main() { - frexp_eabd40(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -struct frexp_result { - float sig; - int exp; -}; - -frexp_result tint_frexp(float param_0) { - frexp_result result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_eabd40() { - frexp_result res = tint_frexp(1.0f); -} - -void fragment_main() { - frexp_eabd40(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -struct frexp_result { - float sig; - int exp; -}; - -frexp_result tint_frexp(float param_0) { - frexp_result result; - result.sig = frexp(param_0, result.exp); - return result; -} - - -void frexp_eabd40() { - frexp_result res = tint_frexp(1.0f); -} - -void compute_main() { - frexp_eabd40(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.hlsl b/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.hlsl deleted file mode 100644 index 36b7826ef3..0000000000 --- a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -struct frexp_result { - float sig; - int exp; -}; -frexp_result tint_frexp(float param_0) { - float exp; - float sig = frexp(param_0, exp); - frexp_result result = {sig, int(exp)}; - return result; -} - -void frexp_eabd40() { - frexp_result res = tint_frexp(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - frexp_eabd40(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - frexp_eabd40(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - frexp_eabd40(); - return; -} diff --git a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.msl b/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.msl deleted file mode 100644 index 2b5431ac21..0000000000 --- a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.msl +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace metal; - -struct frexp_result { - float sig; - int exp; -}; -frexp_result tint_frexp(float param_0) { - int exp; - float sig = frexp(param_0, exp); - return {sig, exp}; -} - -void frexp_eabd40() { - frexp_result res = tint_frexp(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - frexp_eabd40(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - frexp_eabd40(); - return; -} - -kernel void compute_main() { - frexp_eabd40(); - return; -} - diff --git a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.spvasm b/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.spvasm deleted file mode 100644 index ef220f57c3..0000000000 --- a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.spvasm +++ /dev/null @@ -1,73 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %frexp_eabd40 "frexp_eabd40" - OpName %__frexp_result "__frexp_result" - OpMemberName %__frexp_result 0 "sig" - OpMemberName %__frexp_result 1 "exp" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpMemberDecorate %__frexp_result 0 Offset 0 - OpMemberDecorate %__frexp_result 1 Offset 4 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 -%__frexp_result = OpTypeStruct %float %int - %float_1 = OpConstant %float 1 -%_ptr_Function___frexp_result = OpTypePointer Function %__frexp_result - %20 = OpConstantNull %__frexp_result - %21 = OpTypeFunction %v4float -%frexp_eabd40 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function___frexp_result Function %20 - %13 = OpExtInst %__frexp_result %16 FrexpStruct %float_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %frexp_eabd40 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %frexp_eabd40 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %frexp_eabd40 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.wgsl b/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.wgsl deleted file mode 100644 index 3bcd2b665b..0000000000 --- a/test/tint/builtins/gen/frexp/eabd40.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn frexp_eabd40() { - var res = frexp(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - frexp_eabd40(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - frexp_eabd40(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - frexp_eabd40(); -} diff --git a/test/tint/builtins/gen/fwidth/5d1b39.wgsl b/test/tint/builtins/gen/fwidth/5d1b39.wgsl deleted file mode 100644 index b0f3e21a43..0000000000 --- a/test/tint/builtins/gen/fwidth/5d1b39.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidth(vec<3, f32>) -> vec<3, f32> -fn fwidth_5d1b39() { - var res: vec3 = fwidth(vec3()); -} - -@stage(fragment) -fn fragment_main() { - fwidth_5d1b39(); -} diff --git a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.glsl b/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.glsl deleted file mode 100644 index c804d0bc43..0000000000 --- a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void fwidth_5d1b39() { - vec3 res = fwidth(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidth_5d1b39(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.hlsl b/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.hlsl deleted file mode 100644 index 3d8020609d..0000000000 --- a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void fwidth_5d1b39() { - float3 res = fwidth(float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidth_5d1b39(); - return; -} diff --git a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.msl b/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.msl deleted file mode 100644 index 671ca4878d..0000000000 --- a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void fwidth_5d1b39() { - float3 res = fwidth(float3()); -} - -fragment void fragment_main() { - fwidth_5d1b39(); - return; -} - diff --git a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.spvasm b/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.spvasm deleted file mode 100644 index 5dc5ef3250..0000000000 --- a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.spvasm +++ /dev/null @@ -1,30 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %fwidth_5d1b39 "fwidth_5d1b39" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %8 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float -%fwidth_5d1b39 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %8 - %5 = OpFwidth %v3float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %fwidth_5d1b39 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.wgsl deleted file mode 100644 index f3c53fa70e..0000000000 --- a/test/tint/builtins/gen/fwidth/5d1b39.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidth_5d1b39() { - var res : vec3 = fwidth(vec3()); -} - -@stage(fragment) -fn fragment_main() { - fwidth_5d1b39(); -} diff --git a/test/tint/builtins/gen/fwidth/b83ebb.wgsl b/test/tint/builtins/gen/fwidth/b83ebb.wgsl deleted file mode 100644 index d4d9fd7b49..0000000000 --- a/test/tint/builtins/gen/fwidth/b83ebb.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidth(vec<2, f32>) -> vec<2, f32> -fn fwidth_b83ebb() { - var res: vec2 = fwidth(vec2()); -} - -@stage(fragment) -fn fragment_main() { - fwidth_b83ebb(); -} diff --git a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.glsl b/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.glsl deleted file mode 100644 index 29d50bc444..0000000000 --- a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void fwidth_b83ebb() { - vec2 res = fwidth(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - fwidth_b83ebb(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.hlsl b/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.hlsl deleted file mode 100644 index f1855264e7..0000000000 --- a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void fwidth_b83ebb() { - float2 res = fwidth(float2(0.0f, 0.0f)); -} - -void fragment_main() { - fwidth_b83ebb(); - return; -} diff --git a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.msl b/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.msl deleted file mode 100644 index 2dce76c754..0000000000 --- a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void fwidth_b83ebb() { - float2 res = fwidth(float2()); -} - -fragment void fragment_main() { - fwidth_b83ebb(); - return; -} - diff --git a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.spvasm b/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.spvasm deleted file mode 100644 index 033004d9ce..0000000000 --- a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.spvasm +++ /dev/null @@ -1,30 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %fwidth_b83ebb "fwidth_b83ebb" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %8 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%fwidth_b83ebb = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %8 - %5 = OpFwidth %v2float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %fwidth_b83ebb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.wgsl deleted file mode 100644 index aa9e984c55..0000000000 --- a/test/tint/builtins/gen/fwidth/b83ebb.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidth_b83ebb() { - var res : vec2 = fwidth(vec2()); -} - -@stage(fragment) -fn fragment_main() { - fwidth_b83ebb(); -} diff --git a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl b/test/tint/builtins/gen/fwidth/d2ab9a.wgsl deleted file mode 100644 index 81dbd35078..0000000000 --- a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidth(vec<4, f32>) -> vec<4, f32> -fn fwidth_d2ab9a() { - var res: vec4 = fwidth(vec4()); -} - -@stage(fragment) -fn fragment_main() { - fwidth_d2ab9a(); -} diff --git a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.glsl b/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.glsl deleted file mode 100644 index db40ca0726..0000000000 --- a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void fwidth_d2ab9a() { - vec4 res = fwidth(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidth_d2ab9a(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.hlsl b/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.hlsl deleted file mode 100644 index 2de2b2b3aa..0000000000 --- a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void fwidth_d2ab9a() { - float4 res = fwidth(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidth_d2ab9a(); - return; -} diff --git a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.msl b/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.msl deleted file mode 100644 index 076783c53b..0000000000 --- a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void fwidth_d2ab9a() { - float4 res = fwidth(float4()); -} - -fragment void fragment_main() { - fwidth_d2ab9a(); - return; -} - diff --git a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.spvasm b/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.spvasm deleted file mode 100644 index 779ba1f84b..0000000000 --- a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.spvasm +++ /dev/null @@ -1,30 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %fwidth_d2ab9a "fwidth_d2ab9a" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 - %8 = OpConstantNull %v4float -%_ptr_Function_v4float = OpTypePointer Function %v4float -%fwidth_d2ab9a = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %8 - %5 = OpFwidth %v4float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %fwidth_d2ab9a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.wgsl deleted file mode 100644 index d5ba206bd5..0000000000 --- a/test/tint/builtins/gen/fwidth/d2ab9a.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidth_d2ab9a() { - var res : vec4 = fwidth(vec4()); -} - -@stage(fragment) -fn fragment_main() { - fwidth_d2ab9a(); -} diff --git a/test/tint/builtins/gen/fwidth/df38ef.wgsl b/test/tint/builtins/gen/fwidth/df38ef.wgsl deleted file mode 100644 index 3392f905ea..0000000000 --- a/test/tint/builtins/gen/fwidth/df38ef.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidth(f32) -> f32 -fn fwidth_df38ef() { - var res: f32 = fwidth(1.0); -} - -@stage(fragment) -fn fragment_main() { - fwidth_df38ef(); -} diff --git a/test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.wgsl deleted file mode 100644 index b98137eccf..0000000000 --- a/test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidth_df38ef() { - var res : f32 = fwidth(1.0); -} - -@stage(fragment) -fn fragment_main() { - fwidth_df38ef(); -} diff --git a/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl b/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl deleted file mode 100644 index bada6df2c3..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidthCoarse(f32) -> f32 -fn fwidthCoarse_159c8a() { - var res: f32 = fwidthCoarse(1.0); -} - -@stage(fragment) -fn fragment_main() { - fwidthCoarse_159c8a(); -} diff --git a/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.wgsl deleted file mode 100644 index 1e592efacf..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidthCoarse_159c8a() { - var res : f32 = fwidthCoarse(1.0); -} - -@stage(fragment) -fn fragment_main() { - fwidthCoarse_159c8a(); -} diff --git a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl b/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl deleted file mode 100644 index 54a33245c2..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidthCoarse(vec<3, f32>) -> vec<3, f32> -fn fwidthCoarse_1e59d9() { - var res: vec3 = fwidthCoarse(vec3()); -} - -@stage(fragment) -fn fragment_main() { - fwidthCoarse_1e59d9(); -} diff --git a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.glsl b/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.glsl deleted file mode 100644 index 6ec03b5281..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void fwidthCoarse_1e59d9() { - vec3 res = fwidth(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidthCoarse_1e59d9(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.hlsl b/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.hlsl deleted file mode 100644 index 41cef2e018..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void fwidthCoarse_1e59d9() { - float3 res = fwidth(float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidthCoarse_1e59d9(); - return; -} diff --git a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.msl b/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.msl deleted file mode 100644 index b2f9f1e3e2..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void fwidthCoarse_1e59d9() { - float3 res = fwidth(float3()); -} - -fragment void fragment_main() { - fwidthCoarse_1e59d9(); - return; -} - diff --git a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.spvasm b/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.spvasm deleted file mode 100644 index c0f4e31149..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %fwidthCoarse_1e59d9 "fwidthCoarse_1e59d9" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %8 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float -%fwidthCoarse_1e59d9 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %8 - %5 = OpFwidthCoarse %v3float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %fwidthCoarse_1e59d9 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.wgsl deleted file mode 100644 index 1352bf609d..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/1e59d9.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidthCoarse_1e59d9() { - var res : vec3 = fwidthCoarse(vec3()); -} - -@stage(fragment) -fn fragment_main() { - fwidthCoarse_1e59d9(); -} diff --git a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl b/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl deleted file mode 100644 index 236b9edaa2..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidthCoarse(vec<4, f32>) -> vec<4, f32> -fn fwidthCoarse_4e4fc4() { - var res: vec4 = fwidthCoarse(vec4()); -} - -@stage(fragment) -fn fragment_main() { - fwidthCoarse_4e4fc4(); -} diff --git a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.glsl b/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.glsl deleted file mode 100644 index 1c54caa8e8..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void fwidthCoarse_4e4fc4() { - vec4 res = fwidth(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidthCoarse_4e4fc4(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.hlsl b/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.hlsl deleted file mode 100644 index 950401fe60..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void fwidthCoarse_4e4fc4() { - float4 res = fwidth(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidthCoarse_4e4fc4(); - return; -} diff --git a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.msl b/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.msl deleted file mode 100644 index 88298ddaa4..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void fwidthCoarse_4e4fc4() { - float4 res = fwidth(float4()); -} - -fragment void fragment_main() { - fwidthCoarse_4e4fc4(); - return; -} - diff --git a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.spvasm b/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.spvasm deleted file mode 100644 index 36c64b516e..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %fwidthCoarse_4e4fc4 "fwidthCoarse_4e4fc4" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 - %8 = OpConstantNull %v4float -%_ptr_Function_v4float = OpTypePointer Function %v4float -%fwidthCoarse_4e4fc4 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %8 - %5 = OpFwidthCoarse %v4float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %fwidthCoarse_4e4fc4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.wgsl deleted file mode 100644 index 3fea38af1a..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/4e4fc4.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidthCoarse_4e4fc4() { - var res : vec4 = fwidthCoarse(vec4()); -} - -@stage(fragment) -fn fragment_main() { - fwidthCoarse_4e4fc4(); -} diff --git a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl b/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl deleted file mode 100644 index 7bc209ded2..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidthCoarse(vec<2, f32>) -> vec<2, f32> -fn fwidthCoarse_e653f7() { - var res: vec2 = fwidthCoarse(vec2()); -} - -@stage(fragment) -fn fragment_main() { - fwidthCoarse_e653f7(); -} diff --git a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.glsl b/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.glsl deleted file mode 100644 index 8676a07d8c..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void fwidthCoarse_e653f7() { - vec2 res = fwidth(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - fwidthCoarse_e653f7(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.hlsl b/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.hlsl deleted file mode 100644 index 08814d0875..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void fwidthCoarse_e653f7() { - float2 res = fwidth(float2(0.0f, 0.0f)); -} - -void fragment_main() { - fwidthCoarse_e653f7(); - return; -} diff --git a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.msl b/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.msl deleted file mode 100644 index 63409de801..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void fwidthCoarse_e653f7() { - float2 res = fwidth(float2()); -} - -fragment void fragment_main() { - fwidthCoarse_e653f7(); - return; -} - diff --git a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.spvasm b/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.spvasm deleted file mode 100644 index 8aa64246b4..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %fwidthCoarse_e653f7 "fwidthCoarse_e653f7" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %8 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%fwidthCoarse_e653f7 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %8 - %5 = OpFwidthCoarse %v2float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %fwidthCoarse_e653f7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.wgsl deleted file mode 100644 index 9e5a1dae57..0000000000 --- a/test/tint/builtins/gen/fwidthCoarse/e653f7.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidthCoarse_e653f7() { - var res : vec2 = fwidthCoarse(vec2()); -} - -@stage(fragment) -fn fragment_main() { - fwidthCoarse_e653f7(); -} diff --git a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl b/test/tint/builtins/gen/fwidthFine/523fdc.wgsl deleted file mode 100644 index 7c95dd0076..0000000000 --- a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidthFine(vec<3, f32>) -> vec<3, f32> -fn fwidthFine_523fdc() { - var res: vec3 = fwidthFine(vec3()); -} - -@stage(fragment) -fn fragment_main() { - fwidthFine_523fdc(); -} diff --git a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.glsl b/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.glsl deleted file mode 100644 index bd41be7d72..0000000000 --- a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void fwidthFine_523fdc() { - vec3 res = fwidth(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidthFine_523fdc(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.hlsl b/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.hlsl deleted file mode 100644 index 39a541e07f..0000000000 --- a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void fwidthFine_523fdc() { - float3 res = fwidth(float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidthFine_523fdc(); - return; -} diff --git a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.msl b/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.msl deleted file mode 100644 index ba43d3cd2a..0000000000 --- a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void fwidthFine_523fdc() { - float3 res = fwidth(float3()); -} - -fragment void fragment_main() { - fwidthFine_523fdc(); - return; -} - diff --git a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.spvasm b/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.spvasm deleted file mode 100644 index 70148cca17..0000000000 --- a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %fwidthFine_523fdc "fwidthFine_523fdc" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v3float = OpTypeVector %float 3 - %8 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float -%fwidthFine_523fdc = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %8 - %5 = OpFwidthFine %v3float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %fwidthFine_523fdc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.wgsl deleted file mode 100644 index 41cb66cfa6..0000000000 --- a/test/tint/builtins/gen/fwidthFine/523fdc.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidthFine_523fdc() { - var res : vec3 = fwidthFine(vec3()); -} - -@stage(fragment) -fn fragment_main() { - fwidthFine_523fdc(); -} diff --git a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl b/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl deleted file mode 100644 index 20fef192fe..0000000000 --- a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidthFine(vec<4, f32>) -> vec<4, f32> -fn fwidthFine_68f4ef() { - var res: vec4 = fwidthFine(vec4()); -} - -@stage(fragment) -fn fragment_main() { - fwidthFine_68f4ef(); -} diff --git a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.glsl b/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.glsl deleted file mode 100644 index c300adb383..0000000000 --- a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void fwidthFine_68f4ef() { - vec4 res = fwidth(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidthFine_68f4ef(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.hlsl b/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.hlsl deleted file mode 100644 index baa86f5700..0000000000 --- a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void fwidthFine_68f4ef() { - float4 res = fwidth(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - fwidthFine_68f4ef(); - return; -} diff --git a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.msl b/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.msl deleted file mode 100644 index 7d756f8139..0000000000 --- a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void fwidthFine_68f4ef() { - float4 res = fwidth(float4()); -} - -fragment void fragment_main() { - fwidthFine_68f4ef(); - return; -} - diff --git a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.spvasm deleted file mode 100644 index 7258785d76..0000000000 --- a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %fwidthFine_68f4ef "fwidthFine_68f4ef" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 - %8 = OpConstantNull %v4float -%_ptr_Function_v4float = OpTypePointer Function %v4float -%fwidthFine_68f4ef = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %8 - %5 = OpFwidthFine %v4float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %fwidthFine_68f4ef - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.wgsl deleted file mode 100644 index 97f10330e9..0000000000 --- a/test/tint/builtins/gen/fwidthFine/68f4ef.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidthFine_68f4ef() { - var res : vec4 = fwidthFine(vec4()); -} - -@stage(fragment) -fn fragment_main() { - fwidthFine_68f4ef(); -} diff --git a/test/tint/builtins/gen/fwidthFine/f1742d.wgsl b/test/tint/builtins/gen/fwidthFine/f1742d.wgsl deleted file mode 100644 index d24600cfae..0000000000 --- a/test/tint/builtins/gen/fwidthFine/f1742d.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidthFine(f32) -> f32 -fn fwidthFine_f1742d() { - var res: f32 = fwidthFine(1.0); -} - -@stage(fragment) -fn fragment_main() { - fwidthFine_f1742d(); -} diff --git a/test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.wgsl deleted file mode 100644 index 4a764a517f..0000000000 --- a/test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidthFine_f1742d() { - var res : f32 = fwidthFine(1.0); -} - -@stage(fragment) -fn fragment_main() { - fwidthFine_f1742d(); -} diff --git a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl b/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl deleted file mode 100644 index 0002542937..0000000000 --- a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn fwidthFine(vec<2, f32>) -> vec<2, f32> -fn fwidthFine_ff6aa0() { - var res: vec2 = fwidthFine(vec2()); -} - -@stage(fragment) -fn fragment_main() { - fwidthFine_ff6aa0(); -} diff --git a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.glsl b/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.glsl deleted file mode 100644 index 024943b072..0000000000 --- a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.glsl +++ /dev/null @@ -1,15 +0,0 @@ -#version 310 es -precision mediump float; - -void fwidthFine_ff6aa0() { - vec2 res = fwidth(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - fwidthFine_ff6aa0(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.hlsl b/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.hlsl deleted file mode 100644 index bb6d7cfffe..0000000000 --- a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -void fwidthFine_ff6aa0() { - float2 res = fwidth(float2(0.0f, 0.0f)); -} - -void fragment_main() { - fwidthFine_ff6aa0(); - return; -} diff --git a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.msl b/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.msl deleted file mode 100644 index b7225af28a..0000000000 --- a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void fwidthFine_ff6aa0() { - float2 res = fwidth(float2()); -} - -fragment void fragment_main() { - fwidthFine_ff6aa0(); - return; -} - diff --git a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.spvasm b/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.spvasm deleted file mode 100644 index 591d6e083a..0000000000 --- a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.spvasm +++ /dev/null @@ -1,31 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 14 -; Schema: 0 - OpCapability Shader - OpCapability DerivativeControl - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %fwidthFine_ff6aa0 "fwidthFine_ff6aa0" - OpName %res "res" - OpName %fragment_main "fragment_main" - %void = OpTypeVoid - %1 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 - %8 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%fwidthFine_ff6aa0 = OpFunction %void None %1 - %4 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %8 - %5 = OpFwidthFine %v2float %8 - OpStore %res %5 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %1 - %12 = OpLabel - %13 = OpFunctionCall %void %fwidthFine_ff6aa0 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.wgsl b/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.wgsl deleted file mode 100644 index 7ca7637da9..0000000000 --- a/test/tint/builtins/gen/fwidthFine/ff6aa0.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn fwidthFine_ff6aa0() { - var res : vec2 = fwidthFine(vec2()); -} - -@stage(fragment) -fn fragment_main() { - fwidthFine_ff6aa0(); -} diff --git a/test/tint/builtins/gen/gen.wgsl.tmpl b/test/tint/builtins/gen/gen.wgsl.tmpl new file mode 100644 index 0000000000..25e174e06d --- /dev/null +++ b/test/tint/builtins/gen/gen.wgsl.tmpl @@ -0,0 +1,328 @@ +{{- /* +-------------------------------------------------------------------------------- +Template file for use with tools/src/cmd/gen to generate the wgsl files in the +./literal/... and ./var/... subdirectories + +See: +* tools/src/cmd/gen for structures used by this template +* https://golang.org/pkg/text/template/ for documentation on the template syntax +-------------------------------------------------------------------------------- +*/ -}} + +{{- /* For each permutation of each overload of each function... */ -}} +{{- range Sem.Builtins -}} +{{- range .Overloads -}} +{{- range Permute . -}} +{{- /* Generate a ./literal//.wgsl file using + the Permutation macro defined below */ -}} +{{- $file := printf "./literal/%v/%v.wgsl" .Intrinsic.Name .Hash -}} +{{- $content := Eval "Permutation" "Overload" . "Mode" "literal" -}} +{{- WriteFile $file $content -}} +{{- /* Generate a ./var//.wgsl file using + the Permutation macro defined below */ -}} +{{- $file := printf "./var/%v/%v.wgsl" .Intrinsic.Name .Hash -}} +{{- $content := Eval "Permutation" "Overload" . "Mode" "var" -}} +{{- WriteFile $file $content -}} +{{- end }} +{{- end }} +{{- end }} + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "Permutation" -}} +{{- /* Emits the body of the intrinsic permuation .wgsl file */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $overload := .Overload -}} +{{- $mode := .Mode -}} +{{- $builtin := $overload.Intrinsic.Name -}} +{{- $permutation := printf "%v_%v" $builtin $overload.Hash -}} +{{- $args := Map -}} + +{{- /* Generate enable directives */ -}} +{{- template "EnableDirectives" $overload -}} + +{{- /* Generate RW storage buffer parameters */ -}} +{{- $sb_rw_fields := Eval "EmitBufferFields" "overload" $overload + "var_name" "sb_rw" + "storage" "storage" + "access" "read_write" + "args" $args -}} +{{- if $sb_rw_fields -}} +struct SB_RW { +{{- $sb_rw_fields -}} +}; +@group(0) @binding(0) var sb_rw : SB_RW; +{{ end -}} + +{{- /* Generate RO storage buffer parameters */ -}} +{{- $sb_ro_fields := Eval "EmitBufferFields" "overload" $overload + "var_name" "sb_ro" + "storage" "storage" + "access" "read" + "args" $args -}} +{{- if $sb_ro_fields -}} +struct SB_RO { +{{- $sb_ro_fields -}} +}; +@group(0) @binding(1) var sb_ro : SB_RO; +{{ end -}} + +{{- /* Generate uniform buffer parameters */ -}} +{{- $ub_fields := Eval "EmitBufferFields" "overload" $overload + "var_name" "ub" + "storage" "uniform" + "access" "read" + "args" $args -}} +{{- if $ub_fields -}} +struct UB { +{{- $ub_fields -}} +}; +@group(0) @binding(1) var ub : UB; +{{ end -}} + +{{- /* Generate module-scoped handle variables */ -}} +{{- range $i, $p := $overload.Parameters }} +{{- $class := Eval "StorageClass" $p.Type -}} +{{- if eq "ptr" $p.Type.Target.Name -}} +{{- $el_type := Eval "Type" (index $p.Type.TemplateArguments 1)}} +{{- if eq "handle" $class -}} + @group(1) @binding({{$i}}) var arg_{{$i}}: {{$el_type}}; +{{ $args.Put $i (printf "&arg_%v" $i) -}} +{{- else if eq "workgroup" $class -}} + var arg_{{$i}}: {{$el_type}}; +{{ $args.Put $i (printf "&arg_%v" $i) -}} +{{- else if eq "private" $class -}} + var arg_{{$i}}: {{$el_type}}; +{{ $args.Put $i (printf "&arg_%v" $i) -}} +{{- end -}} +{{- else -}} +{{- $type := Eval "Type" $p.Type}} +{{- if eq "handle" $class -}} + @group(1) @binding({{$i}}) var arg_{{$i}}: {{$type}}; +{{ $args.Put $i (printf "arg_%v" $i) -}} +{{- else if eq "workgroup" $class -}} + var arg_{{$i}}: {{$type}}; +{{ $args.Put $i (printf "arg_%v" $i) -}} +{{- else if eq "private" $class -}} + var arg_{{$i}}: {{$type}}; +{{ $args.Put $i (printf "arg_%v" $i) -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- /* Generate the function that calls the intrinsic */ -}} +{{- /*newline*/}} +// {{$.Overload}} +fn {{$permutation}}() { +{{/* Build the parameters either as 'var' or inline values */ -}} +{{- range $i, $p := $overload.Parameters -}} +{{- $class := Eval "StorageClass" $p.Type -}} +{{- $is_abstract := DeepestElementType $p.Type | IsAbstract -}} +{{- if eq "function" $class -}} +{{- if eq "ptr" $p.Type.Target.Name -}} +{{template "Type" index $p.Type.TemplateArguments 1}}; +{{- /*indent*/}} var arg_{{$i}}: {{template "Type" index $p.Type.TemplateArguments 1}}; +{{ $args.Put $i (printf "&arg_%v" $i) -}} +{{- else if and (not $p.IsConst) (eq "var" $mode) -}} +{{- if $is_abstract }} const arg_{{$i}} = {{Eval "ArgumentValue" $p}}; +{{ else }} var arg_{{$i}} = {{Eval "ArgumentValue" $p}}; +{{ end }} +{{- $args.Put $i (printf "arg_%v" $i) -}} +{{- else -}} +{{- $args.Put $i (Eval "ArgumentValue" $p) -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- /* Make the call to the intrinsic */ -}} +{{- /*indent*/}} {{/*indent*/ -}} +{{- if $overload.ReturnType -}} + var res{{if IsDeclarable $overload.ReturnType}}: {{template "Type" $overload.ReturnType}}{{end}} = {{/* preserve space after = */ -}} +{{- end -}} + {{$builtin}}( +{{- range $i, $p := $overload.Parameters -}} +{{- if $i -}}, {{end}}{{$args.Get $i -}} +{{- end -}} + ); +} +{{/*new line*/ -}} + +{{- if $overload.CanBeUsedInStage.Vertex }} +@vertex +fn vertex_main() -> @builtin(position) vec4 { + {{$permutation}}(); + return vec4(); +} +{{ end -}} + +{{- if $overload.CanBeUsedInStage.Fragment }} +@fragment +fn fragment_main() { + {{$permutation}}(); +} +{{ end -}} + +{{- if $overload.CanBeUsedInStage.Compute }} +@compute @workgroup_size(1) +fn compute_main() { + {{$permutation}}(); +} +{{ end -}} + +{{- end -}} + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "EnableDirectives" -}} +{{- /* Emits the required enable directives for a given overload */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $permutation := . -}} +{{- $overload := $permutation.Overload -}} +{{- $builtin_name := $permutation.Intrinsic.Name -}} + +{{- /* Check and emit chromium_experimental_dp4a */ -}} +{{- if or (eq "dot4I8Packed" $builtin_name) (eq "dot4U8Packed" $builtin_name)}} +enable chromium_experimental_dp4a; +{{ end -}} + +{{- /* Check and emit f16 */ -}} +{{- if OverloadUsesF16 $overload}} +enable f16; +{{ end -}} + +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "EmitBufferFields" -}} +{{- /* Emits a struct with the fields that match the given storage class */ -}} +{{- /* and access. */ -}} +{{- /* Argument is a map with the following expected keys: */ -}} +{{- /* 'overload' - the current overload */ -}} +{{- /* 'var_name' - name of the variable of the structure type */ -}} +{{- /* 'storage' - filtered storage class */ -}} +{{- /* 'access' - filtered access */ -}} +{{- /* 'args' - argument map that's populated with the fields */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $overload := .Get "overload" -}} +{{- $var_name := .Get "var_name" -}} +{{- $filter_storage := .Get "storage" -}} +{{- $filter_access := .Get "access" -}} +{{- $args := .Get "args" -}} +{{- range $i, $p := $overload.Parameters }} +{{- $storage := Eval "StorageClass" $p.Type -}} +{{- $access := Eval "Access" $p.Type -}} +{{- if and (eq $filter_storage $storage) (eq $filter_access $access) }} +{{- if eq "ptr" $p.Type.Target.Name }} + arg_{{$i}}: {{template "Type" (index $p.Type.TemplateArguments 1)}}, +{{ $args.Put $i (printf "&%v.arg_%v" $var_name $i) -}} +{{- else }} + arg_{{$i}}: {{template "Type" $p.Type}}, +{{ $args.Put $i (printf "%v.arg_%v" $var_name $i) -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{ end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "StorageClass" -}} +{{- /* Returns the storage class for the given Fully Qualified Name */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $name := .Target.Name -}} +{{- if eq $name "array" -}}storage +{{- else if HasPrefix $name "texture" -}}handle +{{- else if HasPrefix $name "sampler" -}}handle +{{- else if eq $name "ptr" -}}{{(index .TemplateArguments 0).Target.Name}} +{{- else -}}function +{{- end -}} +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "Access" -}} +{{- /* Returns the access for the given Fully Qualified Name */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $name := .Target.Name -}} +{{- if eq $name "ptr" -}}{{(index .TemplateArguments 2).Target.Name}} +{{- else -}} +{{- /* Emit the default for the storage class */ -}} +{{- /* https://gpuweb.github.io/gpuweb/wgsl/#storage-class */ -}} +{{- $storage := Eval "StorageClass" . -}} +{{- if eq $storage "function" -}}read_write +{{- else if eq $storage "private" -}}read_write +{{- else if eq $storage "workgroup" -}}read_write +{{- else if eq $storage "uniform" -}}read +{{- else if eq $storage "storage" -}}read +{{- else if eq $storage "handle" -}}read +{{- end -}} +{{- end -}} +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "ArgumentValue" -}} +{{- /* Returns a value that can be used for the parameter argument */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- $ty := .Type -}} +{{- if eq $ty.Target.Name "i32" -}} +{{- /* If the parameter has the name 'level', then use '0' as the value. */ -}} +{{- /* Some texture arguments require the level parameter to be 0, and */ -}} +{{- /* constraint is not described in the definition file. */ -}} +{{- if eq .Name "level" -}}0 +{{- else -}}1 +{{- end -}} +{{- else if eq $ty.Target.Name "u32" -}}1u +{{- else if eq $ty.Target.Name "f32" -}}1.f +{{- else if eq $ty.Target.Name "fa" -}}1 +{{- else if eq $ty.Target.Name "ia" -}}1.0 +{{- else if eq $ty.Target.Name "bool" -}}true +{{- else if eq $ty.Target.Name "vec" -}} +{{- $el := Eval "ArgumentValue" "Type" (ElementType .Type) "Name" ""}} +{{- template "Type" $ty}}({{$el}}) +{{- else if eq $ty.Target.Name "mat" -}}{{template "Type" $ty}}( +{{- $el := Eval "ArgumentValue" "Type" (ElementType .Type) "Name" ""}} +{{- range $col := Iterate (index $ty.TemplateArguments 0) }} +{{- range $row := Iterate (index $ty.TemplateArguments 1) }} +{{- if or $col $row -}}, {{end}}{{$el}} +{{- end -}} +{{- end -}}) +{{- else -}}{{template "Type" $ty}}() +{{- end -}} +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "Type" -}} +{{- /* Emits the WGSL for the Fully Qualified Name argument */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- if IsType .Target -}} +{{- if DeepestElementType . | IsAbstract -}} +{{- if eq .Target.Name "vec" -}}vec{{index .TemplateArguments 0}} +{{- else if eq .Target.Name "mat" -}}mat{{index .TemplateArguments 0}}x{{index .TemplateArguments 1}} +{{- else -}} +{{- end -}} +{{- else if eq .Target.Name "vec" -}}vec{{index .TemplateArguments 0}}<{{template "Type" (ElementType .)}}> +{{- else if eq .Target.Name "mat" -}}mat{{index .TemplateArguments 0}}x{{index .TemplateArguments 1}}<{{template "Type" (ElementType .)}}> +{{- else -}}{{.Target.Name}}{{template "TemplateArguments" .TemplateArguments}} +{{- end -}} +{{- else if IsEnumEntry .Target -}}{{.Target.Name}} +{{- else if IsEnumMatcher .Target -}}{{(index .Target.Options 0).Name}} +{{- else -}} +{{- end -}} +{{- end -}} + + +{{- /* ------------------------------------------------------------------ */ -}} +{{- define "TemplateArguments" -}} +{{- /* Emits the WGSL for the template argument list */ -}} +{{- /* ------------------------------------------------------------------ */ -}} +{{- if . -}} +< +{{- range $i, $a := . -}} +{{- if $i -}}, {{ end -}} +{{- if IsInt $a -}}{{- . -}} +{{- else -}}{{- template "Type" $a -}} +{{- end -}} +{{- end -}} +> +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl b/test/tint/builtins/gen/insertBits/3c7ba5.wgsl deleted file mode 100644 index 8816fa477b..0000000000 --- a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn insertBits(vec<2, u32>, vec<2, u32>, u32, u32) -> vec<2, u32> -fn insertBits_3c7ba5() { - var res: vec2 = insertBits(vec2(), vec2(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_3c7ba5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_3c7ba5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_3c7ba5(); -} diff --git a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.glsl b/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.glsl deleted file mode 100644 index 4047940f33..0000000000 --- a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_3c7ba5() { - uvec2 res = tint_insert_bits(uvec2(0u, 0u), uvec2(0u, 0u), 1u, 1u); -} - -vec4 vertex_main() { - insertBits_3c7ba5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_3c7ba5() { - uvec2 res = tint_insert_bits(uvec2(0u, 0u), uvec2(0u, 0u), 1u, 1u); -} - -void fragment_main() { - insertBits_3c7ba5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_3c7ba5() { - uvec2 res = tint_insert_bits(uvec2(0u, 0u), uvec2(0u, 0u), 1u, 1u); -} - -void compute_main() { - insertBits_3c7ba5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.hlsl b/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.hlsl deleted file mode 100644 index 8cf5a7ccf3..0000000000 --- a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << uint2((s).xx)) & uint2((mask).xx)) | (v & uint2((~(mask)).xx))); -} - -void insertBits_3c7ba5() { - uint2 res = tint_insert_bits(uint2(0u, 0u), uint2(0u, 0u), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - insertBits_3c7ba5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - insertBits_3c7ba5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - insertBits_3c7ba5(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.msl b/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.msl deleted file mode 100644 index 7f7805a314..0000000000 --- a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return insert_bits(v, n, s, (e - s)); -} - -void insertBits_3c7ba5() { - uint2 res = tint_insert_bits(uint2(), uint2(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - insertBits_3c7ba5(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - insertBits_3c7ba5(); - return; -} - -kernel void compute_main() { - insertBits_3c7ba5(); - return; -} - diff --git a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.spvasm b/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.spvasm deleted file mode 100644 index bd5c7b97dc..0000000000 --- a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - %19 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_insert_bits "tint_insert_bits" - OpName %v "v" - OpName %n "n" - OpName %offset "offset" - OpName %count "count" - OpName %insertBits_3c7ba5 "insertBits_3c7ba5" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %9 = OpTypeFunction %v2uint %v2uint %v2uint %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %25 = OpTypeFunction %void - %30 = OpConstantNull %v2uint - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_insert_bits = OpFunction %v2uint None %9 - %v = OpFunctionParameter %v2uint - %n = OpFunctionParameter %v2uint - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %17 = OpLabel - %18 = OpExtInst %uint %19 UMin %offset %uint_32 - %22 = OpIAdd %uint %18 %count - %21 = OpExtInst %uint %19 UMin %uint_32 %22 - %24 = OpISub %uint %21 %18 - %23 = OpBitFieldInsert %v2uint %v %n %18 %24 - OpReturnValue %23 - OpFunctionEnd -%insertBits_3c7ba5 = OpFunction %void None %25 - %28 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %30 - %29 = OpFunctionCall %v2uint %tint_insert_bits %30 %30 %uint_1 %uint_1 - OpStore %res %29 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %insertBits_3c7ba5 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %25 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %25 - %43 = OpLabel - %44 = OpFunctionCall %void %insertBits_3c7ba5 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %25 - %46 = OpLabel - %47 = OpFunctionCall %void %insertBits_3c7ba5 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.wgsl b/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.wgsl deleted file mode 100644 index eee06b5622..0000000000 --- a/test/tint/builtins/gen/insertBits/3c7ba5.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn insertBits_3c7ba5() { - var res : vec2 = insertBits(vec2(), vec2(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_3c7ba5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_3c7ba5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_3c7ba5(); -} diff --git a/test/tint/builtins/gen/insertBits/428b0b.wgsl b/test/tint/builtins/gen/insertBits/428b0b.wgsl deleted file mode 100644 index 8fafe77d17..0000000000 --- a/test/tint/builtins/gen/insertBits/428b0b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn insertBits(vec<3, i32>, vec<3, i32>, u32, u32) -> vec<3, i32> -fn insertBits_428b0b() { - var res: vec3 = insertBits(vec3(), vec3(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_428b0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_428b0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_428b0b(); -} diff --git a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.glsl b/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.glsl deleted file mode 100644 index 8f557931ae..0000000000 --- a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_428b0b() { - ivec3 res = tint_insert_bits(ivec3(0, 0, 0), ivec3(0, 0, 0), 1u, 1u); -} - -vec4 vertex_main() { - insertBits_428b0b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_428b0b() { - ivec3 res = tint_insert_bits(ivec3(0, 0, 0), ivec3(0, 0, 0), 1u, 1u); -} - -void fragment_main() { - insertBits_428b0b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_428b0b() { - ivec3 res = tint_insert_bits(ivec3(0, 0, 0), ivec3(0, 0, 0), 1u, 1u); -} - -void compute_main() { - insertBits_428b0b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.hlsl b/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.hlsl deleted file mode 100644 index 5d92f4b69f..0000000000 --- a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx))); -} - -void insertBits_428b0b() { - int3 res = tint_insert_bits(int3(0, 0, 0), int3(0, 0, 0), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - insertBits_428b0b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - insertBits_428b0b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - insertBits_428b0b(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.msl b/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.msl deleted file mode 100644 index 41ff9984ee..0000000000 --- a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return insert_bits(v, n, s, (e - s)); -} - -void insertBits_428b0b() { - int3 res = tint_insert_bits(int3(), int3(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - insertBits_428b0b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - insertBits_428b0b(); - return; -} - -kernel void compute_main() { - insertBits_428b0b(); - return; -} - diff --git a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.spvasm b/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.spvasm deleted file mode 100644 index 14ffcb4373..0000000000 --- a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.spvasm +++ /dev/null @@ -1,90 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - %20 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_insert_bits "tint_insert_bits" - OpName %v "v" - OpName %n "n" - OpName %offset "offset" - OpName %count "count" - OpName %insertBits_428b0b "insertBits_428b0b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %v3int %v3int %v3int %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %26 = OpTypeFunction %void - %31 = OpConstantNull %v3int - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v3int = OpTypePointer Function %v3int - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_insert_bits = OpFunction %v3int None %9 - %v = OpFunctionParameter %v3int - %n = OpFunctionParameter %v3int - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %18 = OpLabel - %19 = OpExtInst %uint %20 UMin %offset %uint_32 - %23 = OpIAdd %uint %19 %count - %22 = OpExtInst %uint %20 UMin %uint_32 %23 - %25 = OpISub %uint %22 %19 - %24 = OpBitFieldInsert %v3int %v %n %19 %25 - OpReturnValue %24 - OpFunctionEnd -%insertBits_428b0b = OpFunction %void None %26 - %29 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %31 - %30 = OpFunctionCall %v3int %tint_insert_bits %31 %31 %uint_1 %uint_1 - OpStore %res %30 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %insertBits_428b0b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %26 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %26 - %44 = OpLabel - %45 = OpFunctionCall %void %insertBits_428b0b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %26 - %47 = OpLabel - %48 = OpFunctionCall %void %insertBits_428b0b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.wgsl b/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.wgsl deleted file mode 100644 index 58e0a5ac2f..0000000000 --- a/test/tint/builtins/gen/insertBits/428b0b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn insertBits_428b0b() { - var res : vec3 = insertBits(vec3(), vec3(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_428b0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_428b0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_428b0b(); -} diff --git a/test/tint/builtins/gen/insertBits/51ede1.wgsl b/test/tint/builtins/gen/insertBits/51ede1.wgsl deleted file mode 100644 index e21ce9b1da..0000000000 --- a/test/tint/builtins/gen/insertBits/51ede1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn insertBits(vec<4, u32>, vec<4, u32>, u32, u32) -> vec<4, u32> -fn insertBits_51ede1() { - var res: vec4 = insertBits(vec4(), vec4(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_51ede1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_51ede1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_51ede1(); -} diff --git a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.glsl b/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.glsl deleted file mode 100644 index c74d63d4f0..0000000000 --- a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_51ede1() { - uvec4 res = tint_insert_bits(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u), 1u, 1u); -} - -vec4 vertex_main() { - insertBits_51ede1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_51ede1() { - uvec4 res = tint_insert_bits(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u), 1u, 1u); -} - -void fragment_main() { - insertBits_51ede1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_51ede1() { - uvec4 res = tint_insert_bits(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u), 1u, 1u); -} - -void compute_main() { - insertBits_51ede1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.hlsl b/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.hlsl deleted file mode 100644 index b6c6bec78c..0000000000 --- a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << uint4((s).xxxx)) & uint4((mask).xxxx)) | (v & uint4((~(mask)).xxxx))); -} - -void insertBits_51ede1() { - uint4 res = tint_insert_bits(uint4(0u, 0u, 0u, 0u), uint4(0u, 0u, 0u, 0u), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - insertBits_51ede1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - insertBits_51ede1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - insertBits_51ede1(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.msl b/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.msl deleted file mode 100644 index 6aebbe577c..0000000000 --- a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return insert_bits(v, n, s, (e - s)); -} - -void insertBits_51ede1() { - uint4 res = tint_insert_bits(uint4(), uint4(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - insertBits_51ede1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - insertBits_51ede1(); - return; -} - -kernel void compute_main() { - insertBits_51ede1(); - return; -} - diff --git a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.spvasm b/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.spvasm deleted file mode 100644 index b5e9f62afa..0000000000 --- a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - %19 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_insert_bits "tint_insert_bits" - OpName %v "v" - OpName %n "n" - OpName %offset "offset" - OpName %count "count" - OpName %insertBits_51ede1 "insertBits_51ede1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %9 = OpTypeFunction %v4uint %v4uint %v4uint %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %25 = OpTypeFunction %void - %30 = OpConstantNull %v4uint - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_insert_bits = OpFunction %v4uint None %9 - %v = OpFunctionParameter %v4uint - %n = OpFunctionParameter %v4uint - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %17 = OpLabel - %18 = OpExtInst %uint %19 UMin %offset %uint_32 - %22 = OpIAdd %uint %18 %count - %21 = OpExtInst %uint %19 UMin %uint_32 %22 - %24 = OpISub %uint %21 %18 - %23 = OpBitFieldInsert %v4uint %v %n %18 %24 - OpReturnValue %23 - OpFunctionEnd -%insertBits_51ede1 = OpFunction %void None %25 - %28 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %30 - %29 = OpFunctionCall %v4uint %tint_insert_bits %30 %30 %uint_1 %uint_1 - OpStore %res %29 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %insertBits_51ede1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %25 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %25 - %43 = OpLabel - %44 = OpFunctionCall %void %insertBits_51ede1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %25 - %46 = OpLabel - %47 = OpFunctionCall %void %insertBits_51ede1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.wgsl b/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.wgsl deleted file mode 100644 index 0b7461b842..0000000000 --- a/test/tint/builtins/gen/insertBits/51ede1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn insertBits_51ede1() { - var res : vec4 = insertBits(vec4(), vec4(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_51ede1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_51ede1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_51ede1(); -} diff --git a/test/tint/builtins/gen/insertBits/65468b.wgsl b/test/tint/builtins/gen/insertBits/65468b.wgsl deleted file mode 100644 index 45fe4f9480..0000000000 --- a/test/tint/builtins/gen/insertBits/65468b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn insertBits(i32, i32, u32, u32) -> i32 -fn insertBits_65468b() { - var res: i32 = insertBits(1, 1, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_65468b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_65468b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_65468b(); -} diff --git a/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.glsl b/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.glsl deleted file mode 100644 index 833aab6d4b..0000000000 --- a/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -int tint_insert_bits(int v, int n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_65468b() { - int res = tint_insert_bits(1, 1, 1u, 1u); -} - -vec4 vertex_main() { - insertBits_65468b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -int tint_insert_bits(int v, int n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_65468b() { - int res = tint_insert_bits(1, 1, 1u, 1u); -} - -void fragment_main() { - insertBits_65468b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -int tint_insert_bits(int v, int n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_65468b() { - int res = tint_insert_bits(1, 1, 1u, 1u); -} - -void compute_main() { - insertBits_65468b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.hlsl b/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.hlsl deleted file mode 100644 index c285500641..0000000000 --- a/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -int tint_insert_bits(int v, int n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << s) & int(mask)) | (v & int(~(mask)))); -} - -void insertBits_65468b() { - int res = tint_insert_bits(1, 1, 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - insertBits_65468b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - insertBits_65468b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - insertBits_65468b(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.msl b/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.msl deleted file mode 100644 index d27a671f57..0000000000 --- a/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -int tint_insert_bits(int v, int n, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return insert_bits(v, n, s, (e - s)); -} - -void insertBits_65468b() { - int res = tint_insert_bits(1, 1, 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - insertBits_65468b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - insertBits_65468b(); - return; -} - -kernel void compute_main() { - insertBits_65468b(); - return; -} - diff --git a/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.wgsl b/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.wgsl deleted file mode 100644 index 18c5ff8c7b..0000000000 --- a/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn insertBits_65468b() { - var res : i32 = insertBits(1, 1, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_65468b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_65468b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_65468b(); -} diff --git a/test/tint/builtins/gen/insertBits/87826b.wgsl b/test/tint/builtins/gen/insertBits/87826b.wgsl deleted file mode 100644 index 66bbaebf56..0000000000 --- a/test/tint/builtins/gen/insertBits/87826b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn insertBits(vec<3, u32>, vec<3, u32>, u32, u32) -> vec<3, u32> -fn insertBits_87826b() { - var res: vec3 = insertBits(vec3(), vec3(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_87826b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_87826b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_87826b(); -} diff --git a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.glsl b/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.glsl deleted file mode 100644 index b5e125a399..0000000000 --- a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_87826b() { - uvec3 res = tint_insert_bits(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u), 1u, 1u); -} - -vec4 vertex_main() { - insertBits_87826b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_87826b() { - uvec3 res = tint_insert_bits(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u), 1u, 1u); -} - -void fragment_main() { - insertBits_87826b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_87826b() { - uvec3 res = tint_insert_bits(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u), 1u, 1u); -} - -void compute_main() { - insertBits_87826b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.hlsl b/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.hlsl deleted file mode 100644 index e43ffecdfa..0000000000 --- a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx))); -} - -void insertBits_87826b() { - uint3 res = tint_insert_bits(uint3(0u, 0u, 0u), uint3(0u, 0u, 0u), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - insertBits_87826b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - insertBits_87826b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - insertBits_87826b(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.msl b/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.msl deleted file mode 100644 index f2533b0c17..0000000000 --- a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return insert_bits(v, n, s, (e - s)); -} - -void insertBits_87826b() { - uint3 res = tint_insert_bits(uint3(), uint3(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - insertBits_87826b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - insertBits_87826b(); - return; -} - -kernel void compute_main() { - insertBits_87826b(); - return; -} - diff --git a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.spvasm b/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.spvasm deleted file mode 100644 index cf3a5cb9fd..0000000000 --- a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - %19 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_insert_bits "tint_insert_bits" - OpName %v "v" - OpName %n "n" - OpName %offset "offset" - OpName %count "count" - OpName %insertBits_87826b "insertBits_87826b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %9 = OpTypeFunction %v3uint %v3uint %v3uint %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %25 = OpTypeFunction %void - %30 = OpConstantNull %v3uint - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_insert_bits = OpFunction %v3uint None %9 - %v = OpFunctionParameter %v3uint - %n = OpFunctionParameter %v3uint - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %17 = OpLabel - %18 = OpExtInst %uint %19 UMin %offset %uint_32 - %22 = OpIAdd %uint %18 %count - %21 = OpExtInst %uint %19 UMin %uint_32 %22 - %24 = OpISub %uint %21 %18 - %23 = OpBitFieldInsert %v3uint %v %n %18 %24 - OpReturnValue %23 - OpFunctionEnd -%insertBits_87826b = OpFunction %void None %25 - %28 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %30 - %29 = OpFunctionCall %v3uint %tint_insert_bits %30 %30 %uint_1 %uint_1 - OpStore %res %29 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %insertBits_87826b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %25 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %25 - %43 = OpLabel - %44 = OpFunctionCall %void %insertBits_87826b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %25 - %46 = OpLabel - %47 = OpFunctionCall %void %insertBits_87826b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.wgsl b/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.wgsl deleted file mode 100644 index e71306f5ab..0000000000 --- a/test/tint/builtins/gen/insertBits/87826b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn insertBits_87826b() { - var res : vec3 = insertBits(vec3(), vec3(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_87826b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_87826b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_87826b(); -} diff --git a/test/tint/builtins/gen/insertBits/d86978.wgsl b/test/tint/builtins/gen/insertBits/d86978.wgsl deleted file mode 100644 index 3de726399d..0000000000 --- a/test/tint/builtins/gen/insertBits/d86978.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn insertBits(vec<4, i32>, vec<4, i32>, u32, u32) -> vec<4, i32> -fn insertBits_d86978() { - var res: vec4 = insertBits(vec4(), vec4(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_d86978(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_d86978(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_d86978(); -} diff --git a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.glsl b/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.glsl deleted file mode 100644 index bb4350597b..0000000000 --- a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_d86978() { - ivec4 res = tint_insert_bits(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), 1u, 1u); -} - -vec4 vertex_main() { - insertBits_d86978(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_d86978() { - ivec4 res = tint_insert_bits(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), 1u, 1u); -} - -void fragment_main() { - insertBits_d86978(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_d86978() { - ivec4 res = tint_insert_bits(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), 1u, 1u); -} - -void compute_main() { - insertBits_d86978(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.hlsl b/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.hlsl deleted file mode 100644 index 8f2349062f..0000000000 --- a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << uint4((s).xxxx)) & int4((int(mask)).xxxx)) | (v & int4((int(~(mask))).xxxx))); -} - -void insertBits_d86978() { - int4 res = tint_insert_bits(int4(0, 0, 0, 0), int4(0, 0, 0, 0), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - insertBits_d86978(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - insertBits_d86978(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - insertBits_d86978(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.msl b/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.msl deleted file mode 100644 index fd4942789f..0000000000 --- a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return insert_bits(v, n, s, (e - s)); -} - -void insertBits_d86978() { - int4 res = tint_insert_bits(int4(), int4(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - insertBits_d86978(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - insertBits_d86978(); - return; -} - -kernel void compute_main() { - insertBits_d86978(); - return; -} - diff --git a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.spvasm b/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.spvasm deleted file mode 100644 index e7cf5074d1..0000000000 --- a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.spvasm +++ /dev/null @@ -1,90 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - %20 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_insert_bits "tint_insert_bits" - OpName %v "v" - OpName %n "n" - OpName %offset "offset" - OpName %count "count" - OpName %insertBits_d86978 "insertBits_d86978" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %v4int %v4int %v4int %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %26 = OpTypeFunction %void - %31 = OpConstantNull %v4int - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_insert_bits = OpFunction %v4int None %9 - %v = OpFunctionParameter %v4int - %n = OpFunctionParameter %v4int - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %18 = OpLabel - %19 = OpExtInst %uint %20 UMin %offset %uint_32 - %23 = OpIAdd %uint %19 %count - %22 = OpExtInst %uint %20 UMin %uint_32 %23 - %25 = OpISub %uint %22 %19 - %24 = OpBitFieldInsert %v4int %v %n %19 %25 - OpReturnValue %24 - OpFunctionEnd -%insertBits_d86978 = OpFunction %void None %26 - %29 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %31 - %30 = OpFunctionCall %v4int %tint_insert_bits %31 %31 %uint_1 %uint_1 - OpStore %res %30 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %insertBits_d86978 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %26 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %26 - %44 = OpLabel - %45 = OpFunctionCall %void %insertBits_d86978 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %26 - %47 = OpLabel - %48 = OpFunctionCall %void %insertBits_d86978 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.wgsl b/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.wgsl deleted file mode 100644 index 531dc5ff58..0000000000 --- a/test/tint/builtins/gen/insertBits/d86978.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn insertBits_d86978() { - var res : vec4 = insertBits(vec4(), vec4(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_d86978(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_d86978(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_d86978(); -} diff --git a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl b/test/tint/builtins/gen/insertBits/e3e3a2.wgsl deleted file mode 100644 index 2a43d7e314..0000000000 --- a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn insertBits(u32, u32, u32, u32) -> u32 -fn insertBits_e3e3a2() { - var res: u32 = insertBits(1u, 1u, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_e3e3a2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_e3e3a2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_e3e3a2(); -} diff --git a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.glsl b/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.glsl deleted file mode 100644 index b1b88ed2b0..0000000000 --- a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -uint tint_insert_bits(uint v, uint n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_e3e3a2() { - uint res = tint_insert_bits(1u, 1u, 1u, 1u); -} - -vec4 vertex_main() { - insertBits_e3e3a2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uint tint_insert_bits(uint v, uint n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_e3e3a2() { - uint res = tint_insert_bits(1u, 1u, 1u, 1u); -} - -void fragment_main() { - insertBits_e3e3a2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uint tint_insert_bits(uint v, uint n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_e3e3a2() { - uint res = tint_insert_bits(1u, 1u, 1u, 1u); -} - -void compute_main() { - insertBits_e3e3a2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.hlsl b/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.hlsl deleted file mode 100644 index 4f226ff6f6..0000000000 --- a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -uint tint_insert_bits(uint v, uint n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << s) & mask) | (v & ~(mask))); -} - -void insertBits_e3e3a2() { - uint res = tint_insert_bits(1u, 1u, 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - insertBits_e3e3a2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - insertBits_e3e3a2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - insertBits_e3e3a2(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.msl b/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.msl deleted file mode 100644 index ebe78e840a..0000000000 --- a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -uint tint_insert_bits(uint v, uint n, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return insert_bits(v, n, s, (e - s)); -} - -void insertBits_e3e3a2() { - uint res = tint_insert_bits(1u, 1u, 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - insertBits_e3e3a2(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - insertBits_e3e3a2(); - return; -} - -kernel void compute_main() { - insertBits_e3e3a2(); - return; -} - diff --git a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.wgsl deleted file mode 100644 index b6abcbcf30..0000000000 --- a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn insertBits_e3e3a2() { - var res : u32 = insertBits(1u, 1u, 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_e3e3a2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_e3e3a2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_e3e3a2(); -} diff --git a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl b/test/tint/builtins/gen/insertBits/fe6ba6.wgsl deleted file mode 100644 index 550a23997c..0000000000 --- a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn insertBits(vec<2, i32>, vec<2, i32>, u32, u32) -> vec<2, i32> -fn insertBits_fe6ba6() { - var res: vec2 = insertBits(vec2(), vec2(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_fe6ba6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_fe6ba6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_fe6ba6(); -} diff --git a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.glsl b/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.glsl deleted file mode 100644 index 16e01a51b0..0000000000 --- a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.glsl +++ /dev/null @@ -1,67 +0,0 @@ -#version 310 es - -ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_fe6ba6() { - ivec2 res = tint_insert_bits(ivec2(0, 0), ivec2(0, 0), 1u, 1u); -} - -vec4 vertex_main() { - insertBits_fe6ba6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_fe6ba6() { - ivec2 res = tint_insert_bits(ivec2(0, 0), ivec2(0, 0), 1u, 1u); -} - -void fragment_main() { - insertBits_fe6ba6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { - uint s = min(offset, 32u); - uint e = min(32u, (s + count)); - return bitfieldInsert(v, n, int(s), int((e - s))); -} - -void insertBits_fe6ba6() { - ivec2 res = tint_insert_bits(ivec2(0, 0), ivec2(0, 0), 1u, 1u); -} - -void compute_main() { - insertBits_fe6ba6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.hlsl b/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.hlsl deleted file mode 100644 index 20235d64ae..0000000000 --- a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << uint2((s).xx)) & int2((int(mask)).xx)) | (v & int2((int(~(mask))).xx))); -} - -void insertBits_fe6ba6() { - int2 res = tint_insert_bits(int2(0, 0), int2(0, 0), 1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - insertBits_fe6ba6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - insertBits_fe6ba6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - insertBits_fe6ba6(); - return; -} diff --git a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.msl b/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.msl deleted file mode 100644 index ced3cb3c8a..0000000000 --- a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.msl +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace metal; -int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { - uint const s = min(offset, 32u); - uint const e = min(32u, (s + count)); - return insert_bits(v, n, s, (e - s)); -} - -void insertBits_fe6ba6() { - int2 res = tint_insert_bits(int2(), int2(), 1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - insertBits_fe6ba6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - insertBits_fe6ba6(); - return; -} - -kernel void compute_main() { - insertBits_fe6ba6(); - return; -} - diff --git a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.spvasm b/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.spvasm deleted file mode 100644 index b5e72718b3..0000000000 --- a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.spvasm +++ /dev/null @@ -1,90 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - %20 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tint_insert_bits "tint_insert_bits" - OpName %v "v" - OpName %n "n" - OpName %offset "offset" - OpName %count "count" - OpName %insertBits_fe6ba6 "insertBits_fe6ba6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %uint = OpTypeInt 32 0 - %9 = OpTypeFunction %v2int %v2int %v2int %uint %uint - %uint_32 = OpConstant %uint 32 - %void = OpTypeVoid - %26 = OpTypeFunction %void - %31 = OpConstantNull %v2int - %uint_1 = OpConstant %uint 1 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tint_insert_bits = OpFunction %v2int None %9 - %v = OpFunctionParameter %v2int - %n = OpFunctionParameter %v2int - %offset = OpFunctionParameter %uint - %count = OpFunctionParameter %uint - %18 = OpLabel - %19 = OpExtInst %uint %20 UMin %offset %uint_32 - %23 = OpIAdd %uint %19 %count - %22 = OpExtInst %uint %20 UMin %uint_32 %23 - %25 = OpISub %uint %22 %19 - %24 = OpBitFieldInsert %v2int %v %n %19 %25 - OpReturnValue %24 - OpFunctionEnd -%insertBits_fe6ba6 = OpFunction %void None %26 - %29 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %31 - %30 = OpFunctionCall %v2int %tint_insert_bits %31 %31 %uint_1 %uint_1 - OpStore %res %30 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %insertBits_fe6ba6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %26 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %26 - %44 = OpLabel - %45 = OpFunctionCall %void %insertBits_fe6ba6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %26 - %47 = OpLabel - %48 = OpFunctionCall %void %insertBits_fe6ba6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.wgsl b/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.wgsl deleted file mode 100644 index 3e8848626f..0000000000 --- a/test/tint/builtins/gen/insertBits/fe6ba6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn insertBits_fe6ba6() { - var res : vec2 = insertBits(vec2(), vec2(), 1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - insertBits_fe6ba6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - insertBits_fe6ba6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - insertBits_fe6ba6(); -} diff --git a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl b/test/tint/builtins/gen/inverseSqrt/84407e.wgsl deleted file mode 100644 index 42711dffa3..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn inverseSqrt(f32) -> f32 -fn inverseSqrt_84407e() { - var res: f32 = inverseSqrt(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - inverseSqrt_84407e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - inverseSqrt_84407e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - inverseSqrt_84407e(); -} diff --git a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.glsl b/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.glsl deleted file mode 100644 index a6e5da6a20..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void inverseSqrt_84407e() { - float res = inversesqrt(1.0f); -} - -vec4 vertex_main() { - inverseSqrt_84407e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void inverseSqrt_84407e() { - float res = inversesqrt(1.0f); -} - -void fragment_main() { - inverseSqrt_84407e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void inverseSqrt_84407e() { - float res = inversesqrt(1.0f); -} - -void compute_main() { - inverseSqrt_84407e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.hlsl b/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.hlsl deleted file mode 100644 index 7f8b61e339..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void inverseSqrt_84407e() { - float res = rsqrt(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - inverseSqrt_84407e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - inverseSqrt_84407e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - inverseSqrt_84407e(); - return; -} diff --git a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.msl b/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.msl deleted file mode 100644 index a24f6b2ce9..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void inverseSqrt_84407e() { - float res = rsqrt(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - inverseSqrt_84407e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - inverseSqrt_84407e(); - return; -} - -kernel void compute_main() { - inverseSqrt_84407e(); - return; -} - diff --git a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.wgsl b/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.wgsl deleted file mode 100644 index 707e3174cc..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn inverseSqrt_84407e() { - var res : f32 = inverseSqrt(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - inverseSqrt_84407e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - inverseSqrt_84407e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - inverseSqrt_84407e(); -} diff --git a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl b/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl deleted file mode 100644 index 3e2c581199..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn inverseSqrt(vec<2, f32>) -> vec<2, f32> -fn inverseSqrt_8f2bd2() { - var res: vec2 = inverseSqrt(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - inverseSqrt_8f2bd2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - inverseSqrt_8f2bd2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - inverseSqrt_8f2bd2(); -} diff --git a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.glsl b/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.glsl deleted file mode 100644 index 52951abfa9..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void inverseSqrt_8f2bd2() { - vec2 res = inversesqrt(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - inverseSqrt_8f2bd2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void inverseSqrt_8f2bd2() { - vec2 res = inversesqrt(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - inverseSqrt_8f2bd2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void inverseSqrt_8f2bd2() { - vec2 res = inversesqrt(vec2(0.0f, 0.0f)); -} - -void compute_main() { - inverseSqrt_8f2bd2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.hlsl b/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.hlsl deleted file mode 100644 index 35554d4c18..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void inverseSqrt_8f2bd2() { - float2 res = rsqrt(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - inverseSqrt_8f2bd2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - inverseSqrt_8f2bd2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - inverseSqrt_8f2bd2(); - return; -} diff --git a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.msl b/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.msl deleted file mode 100644 index 1bbeb3a2c4..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void inverseSqrt_8f2bd2() { - float2 res = rsqrt(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - inverseSqrt_8f2bd2(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - inverseSqrt_8f2bd2(); - return; -} - -kernel void compute_main() { - inverseSqrt_8f2bd2(); - return; -} - diff --git a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.spvasm b/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.spvasm deleted file mode 100644 index d8b74167f5..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %inverseSqrt_8f2bd2 "inverseSqrt_8f2bd2" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%inverseSqrt_8f2bd2 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 InverseSqrt %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %inverseSqrt_8f2bd2 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %inverseSqrt_8f2bd2 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %inverseSqrt_8f2bd2 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.wgsl b/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.wgsl deleted file mode 100644 index 55540308f7..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/8f2bd2.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn inverseSqrt_8f2bd2() { - var res : vec2 = inverseSqrt(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - inverseSqrt_8f2bd2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - inverseSqrt_8f2bd2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - inverseSqrt_8f2bd2(); -} diff --git a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl b/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl deleted file mode 100644 index 9edad1ba7c..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn inverseSqrt(vec<3, f32>) -> vec<3, f32> -fn inverseSqrt_b197b1() { - var res: vec3 = inverseSqrt(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - inverseSqrt_b197b1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - inverseSqrt_b197b1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - inverseSqrt_b197b1(); -} diff --git a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.glsl b/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.glsl deleted file mode 100644 index c54c5a72a6..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void inverseSqrt_b197b1() { - vec3 res = inversesqrt(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - inverseSqrt_b197b1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void inverseSqrt_b197b1() { - vec3 res = inversesqrt(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - inverseSqrt_b197b1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void inverseSqrt_b197b1() { - vec3 res = inversesqrt(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - inverseSqrt_b197b1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.hlsl b/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.hlsl deleted file mode 100644 index 67c0a2f229..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void inverseSqrt_b197b1() { - float3 res = rsqrt(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - inverseSqrt_b197b1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - inverseSqrt_b197b1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - inverseSqrt_b197b1(); - return; -} diff --git a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.msl b/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.msl deleted file mode 100644 index 5d49c09bcb..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void inverseSqrt_b197b1() { - float3 res = rsqrt(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - inverseSqrt_b197b1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - inverseSqrt_b197b1(); - return; -} - -kernel void compute_main() { - inverseSqrt_b197b1(); - return; -} - diff --git a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.spvasm b/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.spvasm deleted file mode 100644 index c70dc36a70..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %inverseSqrt_b197b1 "inverseSqrt_b197b1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%inverseSqrt_b197b1 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 InverseSqrt %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %inverseSqrt_b197b1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %inverseSqrt_b197b1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %inverseSqrt_b197b1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.wgsl b/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.wgsl deleted file mode 100644 index dd8bd7161f..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/b197b1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn inverseSqrt_b197b1() { - var res : vec3 = inverseSqrt(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - inverseSqrt_b197b1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - inverseSqrt_b197b1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - inverseSqrt_b197b1(); -} diff --git a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl b/test/tint/builtins/gen/inverseSqrt/c22347.wgsl deleted file mode 100644 index a0394fb90d..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn inverseSqrt(vec<4, f32>) -> vec<4, f32> -fn inverseSqrt_c22347() { - var res: vec4 = inverseSqrt(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - inverseSqrt_c22347(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - inverseSqrt_c22347(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - inverseSqrt_c22347(); -} diff --git a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.glsl b/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.glsl deleted file mode 100644 index 20add607be..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void inverseSqrt_c22347() { - vec4 res = inversesqrt(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - inverseSqrt_c22347(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void inverseSqrt_c22347() { - vec4 res = inversesqrt(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - inverseSqrt_c22347(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void inverseSqrt_c22347() { - vec4 res = inversesqrt(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - inverseSqrt_c22347(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.hlsl b/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.hlsl deleted file mode 100644 index ee22cf1a5b..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void inverseSqrt_c22347() { - float4 res = rsqrt(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - inverseSqrt_c22347(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - inverseSqrt_c22347(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - inverseSqrt_c22347(); - return; -} diff --git a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.msl b/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.msl deleted file mode 100644 index 340215277e..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void inverseSqrt_c22347() { - float4 res = rsqrt(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - inverseSqrt_c22347(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - inverseSqrt_c22347(); - return; -} - -kernel void compute_main() { - inverseSqrt_c22347(); - return; -} - diff --git a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.spvasm b/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.spvasm deleted file mode 100644 index 9dcf62392a..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %inverseSqrt_c22347 "inverseSqrt_c22347" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%inverseSqrt_c22347 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 InverseSqrt %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %inverseSqrt_c22347 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %inverseSqrt_c22347 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %inverseSqrt_c22347 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.wgsl b/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.wgsl deleted file mode 100644 index cc9c1a9fb2..0000000000 --- a/test/tint/builtins/gen/inverseSqrt/c22347.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn inverseSqrt_c22347() { - var res : vec4 = inverseSqrt(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - inverseSqrt_c22347(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - inverseSqrt_c22347(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - inverseSqrt_c22347(); -} diff --git a/test/tint/builtins/gen/ldexp/a31cdc.wgsl b/test/tint/builtins/gen/ldexp/a31cdc.wgsl deleted file mode 100644 index 1a0c392210..0000000000 --- a/test/tint/builtins/gen/ldexp/a31cdc.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn ldexp(vec<3, f32>, vec<3, i32>) -> vec<3, f32> -fn ldexp_a31cdc() { - var res: vec3 = ldexp(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ldexp_a31cdc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ldexp_a31cdc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ldexp_a31cdc(); -} diff --git a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.glsl b/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.glsl deleted file mode 100644 index 46a38486da..0000000000 --- a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void ldexp_a31cdc() { - vec3 res = ldexp(vec3(0.0f, 0.0f, 0.0f), ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - ldexp_a31cdc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void ldexp_a31cdc() { - vec3 res = ldexp(vec3(0.0f, 0.0f, 0.0f), ivec3(0, 0, 0)); -} - -void fragment_main() { - ldexp_a31cdc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void ldexp_a31cdc() { - vec3 res = ldexp(vec3(0.0f, 0.0f, 0.0f), ivec3(0, 0, 0)); -} - -void compute_main() { - ldexp_a31cdc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.hlsl b/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.hlsl deleted file mode 100644 index 6d596f830c..0000000000 --- a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void ldexp_a31cdc() { - float3 res = ldexp(float3(0.0f, 0.0f, 0.0f), int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - ldexp_a31cdc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - ldexp_a31cdc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - ldexp_a31cdc(); - return; -} diff --git a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.msl b/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.msl deleted file mode 100644 index da7d8a9c38..0000000000 --- a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void ldexp_a31cdc() { - float3 res = ldexp(float3(), int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - ldexp_a31cdc(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - ldexp_a31cdc(); - return; -} - -kernel void compute_main() { - ldexp_a31cdc(); - return; -} - diff --git a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.spvasm b/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.spvasm deleted file mode 100644 index 8c131c60d4..0000000000 --- a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %ldexp_a31cdc "ldexp_a31cdc" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %19 = OpConstantNull %v3int -%_ptr_Function_v3float = OpTypePointer Function %v3float - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%ldexp_a31cdc = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Ldexp %16 %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %ldexp_a31cdc - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %ldexp_a31cdc - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %ldexp_a31cdc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.wgsl b/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.wgsl deleted file mode 100644 index 357faa1b9a..0000000000 --- a/test/tint/builtins/gen/ldexp/a31cdc.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn ldexp_a31cdc() { - var res : vec3 = ldexp(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ldexp_a31cdc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ldexp_a31cdc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ldexp_a31cdc(); -} diff --git a/test/tint/builtins/gen/ldexp/abd718.wgsl b/test/tint/builtins/gen/ldexp/abd718.wgsl deleted file mode 100644 index ffa468a9dd..0000000000 --- a/test/tint/builtins/gen/ldexp/abd718.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn ldexp(vec<2, f32>, vec<2, i32>) -> vec<2, f32> -fn ldexp_abd718() { - var res: vec2 = ldexp(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ldexp_abd718(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ldexp_abd718(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ldexp_abd718(); -} diff --git a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.glsl b/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.glsl deleted file mode 100644 index 47e382bcc6..0000000000 --- a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void ldexp_abd718() { - vec2 res = ldexp(vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -vec4 vertex_main() { - ldexp_abd718(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void ldexp_abd718() { - vec2 res = ldexp(vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -void fragment_main() { - ldexp_abd718(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void ldexp_abd718() { - vec2 res = ldexp(vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -void compute_main() { - ldexp_abd718(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.hlsl b/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.hlsl deleted file mode 100644 index 57d331e9fc..0000000000 --- a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void ldexp_abd718() { - float2 res = ldexp(float2(0.0f, 0.0f), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - ldexp_abd718(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - ldexp_abd718(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - ldexp_abd718(); - return; -} diff --git a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.msl b/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.msl deleted file mode 100644 index b46988bf8a..0000000000 --- a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void ldexp_abd718() { - float2 res = ldexp(float2(), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - ldexp_abd718(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - ldexp_abd718(); - return; -} - -kernel void compute_main() { - ldexp_abd718(); - return; -} - diff --git a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.spvasm b/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.spvasm deleted file mode 100644 index 7da0d18d45..0000000000 --- a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %ldexp_abd718 "ldexp_abd718" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %19 = OpConstantNull %v2int -%_ptr_Function_v2float = OpTypePointer Function %v2float - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%ldexp_abd718 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Ldexp %16 %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %ldexp_abd718 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %ldexp_abd718 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %ldexp_abd718 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.wgsl b/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.wgsl deleted file mode 100644 index 87314bfa6e..0000000000 --- a/test/tint/builtins/gen/ldexp/abd718.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn ldexp_abd718() { - var res : vec2 = ldexp(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ldexp_abd718(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ldexp_abd718(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ldexp_abd718(); -} diff --git a/test/tint/builtins/gen/ldexp/cc9cde.wgsl b/test/tint/builtins/gen/ldexp/cc9cde.wgsl deleted file mode 100644 index f2774fde35..0000000000 --- a/test/tint/builtins/gen/ldexp/cc9cde.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn ldexp(vec<4, f32>, vec<4, i32>) -> vec<4, f32> -fn ldexp_cc9cde() { - var res: vec4 = ldexp(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ldexp_cc9cde(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ldexp_cc9cde(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ldexp_cc9cde(); -} diff --git a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.glsl b/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.glsl deleted file mode 100644 index f7b40ae4f8..0000000000 --- a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void ldexp_cc9cde() { - vec4 res = ldexp(vec4(0.0f, 0.0f, 0.0f, 0.0f), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - ldexp_cc9cde(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void ldexp_cc9cde() { - vec4 res = ldexp(vec4(0.0f, 0.0f, 0.0f, 0.0f), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - ldexp_cc9cde(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void ldexp_cc9cde() { - vec4 res = ldexp(vec4(0.0f, 0.0f, 0.0f, 0.0f), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - ldexp_cc9cde(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.hlsl b/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.hlsl deleted file mode 100644 index 6e44999c4a..0000000000 --- a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void ldexp_cc9cde() { - float4 res = ldexp(float4(0.0f, 0.0f, 0.0f, 0.0f), int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - ldexp_cc9cde(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - ldexp_cc9cde(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - ldexp_cc9cde(); - return; -} diff --git a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.msl b/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.msl deleted file mode 100644 index 4d7d64abcf..0000000000 --- a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void ldexp_cc9cde() { - float4 res = ldexp(float4(), int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - ldexp_cc9cde(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - ldexp_cc9cde(); - return; -} - -kernel void compute_main() { - ldexp_cc9cde(); - return; -} - diff --git a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.spvasm b/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.spvasm deleted file mode 100644 index 4f75b897ae..0000000000 --- a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %ldexp_cc9cde "ldexp_cc9cde" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %17 = OpConstantNull %v4int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%ldexp_cc9cde = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Ldexp %5 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %ldexp_cc9cde - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %ldexp_cc9cde - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %ldexp_cc9cde - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.wgsl b/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.wgsl deleted file mode 100644 index c2fc1ae7f9..0000000000 --- a/test/tint/builtins/gen/ldexp/cc9cde.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn ldexp_cc9cde() { - var res : vec4 = ldexp(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ldexp_cc9cde(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ldexp_cc9cde(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ldexp_cc9cde(); -} diff --git a/test/tint/builtins/gen/ldexp/db8b49.wgsl b/test/tint/builtins/gen/ldexp/db8b49.wgsl deleted file mode 100644 index aad5fdcae7..0000000000 --- a/test/tint/builtins/gen/ldexp/db8b49.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn ldexp(f32, i32) -> f32 -fn ldexp_db8b49() { - var res: f32 = ldexp(1.0, 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ldexp_db8b49(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ldexp_db8b49(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ldexp_db8b49(); -} diff --git a/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.glsl b/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.glsl deleted file mode 100644 index 07b656a470..0000000000 --- a/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void ldexp_db8b49() { - float res = ldexp(1.0f, 1); -} - -vec4 vertex_main() { - ldexp_db8b49(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void ldexp_db8b49() { - float res = ldexp(1.0f, 1); -} - -void fragment_main() { - ldexp_db8b49(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void ldexp_db8b49() { - float res = ldexp(1.0f, 1); -} - -void compute_main() { - ldexp_db8b49(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.hlsl b/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.hlsl deleted file mode 100644 index 7592faa503..0000000000 --- a/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void ldexp_db8b49() { - float res = ldexp(1.0f, 1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - ldexp_db8b49(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - ldexp_db8b49(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - ldexp_db8b49(); - return; -} diff --git a/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.msl b/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.msl deleted file mode 100644 index e0e7607665..0000000000 --- a/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void ldexp_db8b49() { - float res = ldexp(1.0f, 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - ldexp_db8b49(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - ldexp_db8b49(); - return; -} - -kernel void compute_main() { - ldexp_db8b49(); - return; -} - diff --git a/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.wgsl b/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.wgsl deleted file mode 100644 index 41f84f9800..0000000000 --- a/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn ldexp_db8b49() { - var res : f32 = ldexp(1.0, 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - ldexp_db8b49(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - ldexp_db8b49(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - ldexp_db8b49(); -} diff --git a/test/tint/builtins/gen/length/056071.wgsl b/test/tint/builtins/gen/length/056071.wgsl deleted file mode 100644 index 34bc10d70b..0000000000 --- a/test/tint/builtins/gen/length/056071.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn length(vec<3, f32>) -> f32 -fn length_056071() { - var res: f32 = length(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - length_056071(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - length_056071(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - length_056071(); -} diff --git a/test/tint/builtins/gen/length/056071.wgsl.expected.glsl b/test/tint/builtins/gen/length/056071.wgsl.expected.glsl deleted file mode 100644 index 485c9b197b..0000000000 --- a/test/tint/builtins/gen/length/056071.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void length_056071() { - float res = length(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - length_056071(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void length_056071() { - float res = length(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - length_056071(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void length_056071() { - float res = length(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - length_056071(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/length/056071.wgsl.expected.hlsl b/test/tint/builtins/gen/length/056071.wgsl.expected.hlsl deleted file mode 100644 index a3309a9a7d..0000000000 --- a/test/tint/builtins/gen/length/056071.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void length_056071() { - float res = length(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - length_056071(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - length_056071(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - length_056071(); - return; -} diff --git a/test/tint/builtins/gen/length/056071.wgsl.expected.msl b/test/tint/builtins/gen/length/056071.wgsl.expected.msl deleted file mode 100644 index 689f9dfa06..0000000000 --- a/test/tint/builtins/gen/length/056071.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void length_056071() { - float res = length(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - length_056071(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - length_056071(); - return; -} - -kernel void compute_main() { - length_056071(); - return; -} - diff --git a/test/tint/builtins/gen/length/056071.wgsl.expected.spvasm b/test/tint/builtins/gen/length/056071.wgsl.expected.spvasm deleted file mode 100644 index 47e4a5d741..0000000000 --- a/test/tint/builtins/gen/length/056071.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %length_056071 "length_056071" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_float = OpTypePointer Function %float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%length_056071 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Length %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %length_056071 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %length_056071 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %length_056071 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/length/056071.wgsl.expected.wgsl b/test/tint/builtins/gen/length/056071.wgsl.expected.wgsl deleted file mode 100644 index a7dddf99b0..0000000000 --- a/test/tint/builtins/gen/length/056071.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn length_056071() { - var res : f32 = length(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - length_056071(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - length_056071(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - length_056071(); -} diff --git a/test/tint/builtins/gen/length/602a17.wgsl b/test/tint/builtins/gen/length/602a17.wgsl deleted file mode 100644 index a2f82a6e26..0000000000 --- a/test/tint/builtins/gen/length/602a17.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn length(f32) -> f32 -fn length_602a17() { - var res: f32 = length(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - length_602a17(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - length_602a17(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - length_602a17(); -} diff --git a/test/tint/builtins/gen/length/602a17.wgsl.expected.glsl b/test/tint/builtins/gen/length/602a17.wgsl.expected.glsl deleted file mode 100644 index 1f603ba50d..0000000000 --- a/test/tint/builtins/gen/length/602a17.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void length_602a17() { - float res = length(1.0f); -} - -vec4 vertex_main() { - length_602a17(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void length_602a17() { - float res = length(1.0f); -} - -void fragment_main() { - length_602a17(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void length_602a17() { - float res = length(1.0f); -} - -void compute_main() { - length_602a17(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/length/602a17.wgsl.expected.hlsl b/test/tint/builtins/gen/length/602a17.wgsl.expected.hlsl deleted file mode 100644 index bee0d8849f..0000000000 --- a/test/tint/builtins/gen/length/602a17.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void length_602a17() { - float res = length(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - length_602a17(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - length_602a17(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - length_602a17(); - return; -} diff --git a/test/tint/builtins/gen/length/602a17.wgsl.expected.msl b/test/tint/builtins/gen/length/602a17.wgsl.expected.msl deleted file mode 100644 index ad3b7df824..0000000000 --- a/test/tint/builtins/gen/length/602a17.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void length_602a17() { - float res = fabs(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - length_602a17(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - length_602a17(); - return; -} - -kernel void compute_main() { - length_602a17(); - return; -} - diff --git a/test/tint/builtins/gen/length/602a17.wgsl.expected.wgsl b/test/tint/builtins/gen/length/602a17.wgsl.expected.wgsl deleted file mode 100644 index dbf073b7ea..0000000000 --- a/test/tint/builtins/gen/length/602a17.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn length_602a17() { - var res : f32 = length(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - length_602a17(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - length_602a17(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - length_602a17(); -} diff --git a/test/tint/builtins/gen/length/afde8b.wgsl b/test/tint/builtins/gen/length/afde8b.wgsl deleted file mode 100644 index 4f4ec0b84e..0000000000 --- a/test/tint/builtins/gen/length/afde8b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn length(vec<2, f32>) -> f32 -fn length_afde8b() { - var res: f32 = length(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - length_afde8b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - length_afde8b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - length_afde8b(); -} diff --git a/test/tint/builtins/gen/length/afde8b.wgsl.expected.glsl b/test/tint/builtins/gen/length/afde8b.wgsl.expected.glsl deleted file mode 100644 index 45a5ce23d9..0000000000 --- a/test/tint/builtins/gen/length/afde8b.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void length_afde8b() { - float res = length(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - length_afde8b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void length_afde8b() { - float res = length(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - length_afde8b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void length_afde8b() { - float res = length(vec2(0.0f, 0.0f)); -} - -void compute_main() { - length_afde8b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/length/afde8b.wgsl.expected.hlsl b/test/tint/builtins/gen/length/afde8b.wgsl.expected.hlsl deleted file mode 100644 index 21ac4edfe1..0000000000 --- a/test/tint/builtins/gen/length/afde8b.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void length_afde8b() { - float res = length(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - length_afde8b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - length_afde8b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - length_afde8b(); - return; -} diff --git a/test/tint/builtins/gen/length/afde8b.wgsl.expected.msl b/test/tint/builtins/gen/length/afde8b.wgsl.expected.msl deleted file mode 100644 index 4e2db8db78..0000000000 --- a/test/tint/builtins/gen/length/afde8b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void length_afde8b() { - float res = length(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - length_afde8b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - length_afde8b(); - return; -} - -kernel void compute_main() { - length_afde8b(); - return; -} - diff --git a/test/tint/builtins/gen/length/afde8b.wgsl.expected.spvasm b/test/tint/builtins/gen/length/afde8b.wgsl.expected.spvasm deleted file mode 100644 index 9dc866555c..0000000000 --- a/test/tint/builtins/gen/length/afde8b.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %length_afde8b "length_afde8b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_float = OpTypePointer Function %float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%length_afde8b = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Length %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %length_afde8b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %length_afde8b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %length_afde8b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/length/afde8b.wgsl.expected.wgsl b/test/tint/builtins/gen/length/afde8b.wgsl.expected.wgsl deleted file mode 100644 index 04d7497f02..0000000000 --- a/test/tint/builtins/gen/length/afde8b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn length_afde8b() { - var res : f32 = length(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - length_afde8b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - length_afde8b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - length_afde8b(); -} diff --git a/test/tint/builtins/gen/length/becebf.wgsl b/test/tint/builtins/gen/length/becebf.wgsl deleted file mode 100644 index ea489454b2..0000000000 --- a/test/tint/builtins/gen/length/becebf.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn length(vec<4, f32>) -> f32 -fn length_becebf() { - var res: f32 = length(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - length_becebf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - length_becebf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - length_becebf(); -} diff --git a/test/tint/builtins/gen/length/becebf.wgsl.expected.glsl b/test/tint/builtins/gen/length/becebf.wgsl.expected.glsl deleted file mode 100644 index f980d7a2dd..0000000000 --- a/test/tint/builtins/gen/length/becebf.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void length_becebf() { - float res = length(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - length_becebf(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void length_becebf() { - float res = length(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - length_becebf(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void length_becebf() { - float res = length(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - length_becebf(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/length/becebf.wgsl.expected.hlsl b/test/tint/builtins/gen/length/becebf.wgsl.expected.hlsl deleted file mode 100644 index 825e99cc66..0000000000 --- a/test/tint/builtins/gen/length/becebf.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void length_becebf() { - float res = length(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - length_becebf(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - length_becebf(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - length_becebf(); - return; -} diff --git a/test/tint/builtins/gen/length/becebf.wgsl.expected.msl b/test/tint/builtins/gen/length/becebf.wgsl.expected.msl deleted file mode 100644 index 080f45e256..0000000000 --- a/test/tint/builtins/gen/length/becebf.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void length_becebf() { - float res = length(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - length_becebf(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - length_becebf(); - return; -} - -kernel void compute_main() { - length_becebf(); - return; -} - diff --git a/test/tint/builtins/gen/length/becebf.wgsl.expected.spvasm b/test/tint/builtins/gen/length/becebf.wgsl.expected.spvasm deleted file mode 100644 index aebf0ae632..0000000000 --- a/test/tint/builtins/gen/length/becebf.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %length_becebf "length_becebf" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_float = OpTypePointer Function %float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%length_becebf = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Length %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %length_becebf - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %length_becebf - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %length_becebf - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/length/becebf.wgsl.expected.wgsl b/test/tint/builtins/gen/length/becebf.wgsl.expected.wgsl deleted file mode 100644 index 2a90f076c0..0000000000 --- a/test/tint/builtins/gen/length/becebf.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn length_becebf() { - var res : f32 = length(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - length_becebf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - length_becebf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - length_becebf(); -} diff --git a/test/tint/builtins/gen/literal/abs/002533.wgsl b/test/tint/builtins/gen/literal/abs/002533.wgsl new file mode 100644 index 0000000000..de43c99cd0 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/002533.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<4, f32>) -> vec<4, f32> +fn abs_002533() { + var res: vec4 = abs(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_002533(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_002533(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_002533(); +} diff --git a/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..478b532ca1 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_002533() { + float4 res = abs((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_002533(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_002533(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_002533(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..478b532ca1 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_002533() { + float4 res = abs((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_002533(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_002533(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_002533(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.glsl new file mode 100644 index 0000000000..2e7bac5003 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_002533() { + vec4 res = abs(vec4(1.0f)); +} + +vec4 vertex_main() { + abs_002533(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_002533() { + vec4 res = abs(vec4(1.0f)); +} + +void fragment_main() { + abs_002533(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_002533() { + vec4 res = abs(vec4(1.0f)); +} + +void compute_main() { + abs_002533(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.msl new file mode 100644 index 0000000000..f9acb2de71 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_002533() { + float4 res = fabs(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_002533(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_002533(); + return; +} + +kernel void compute_main() { + abs_002533(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.spvasm new file mode 100644 index 0000000000..432dad0c24 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_002533 "abs_002533" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %abs_002533 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 FAbs %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %abs_002533 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %abs_002533 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_002533 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.wgsl new file mode 100644 index 0000000000..f459d547df --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/002533.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_002533() { + var res : vec4 = abs(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_002533(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_002533(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_002533(); +} diff --git a/test/tint/builtins/gen/literal/abs/005174.wgsl b/test/tint/builtins/gen/literal/abs/005174.wgsl new file mode 100644 index 0000000000..b80809eb54 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/005174.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<3, f32>) -> vec<3, f32> +fn abs_005174() { + var res: vec3 = abs(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_005174(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_005174(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_005174(); +} diff --git a/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..083f7d1e7d --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_005174() { + float3 res = abs((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_005174(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_005174(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_005174(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..083f7d1e7d --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_005174() { + float3 res = abs((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_005174(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_005174(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_005174(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.glsl new file mode 100644 index 0000000000..e1c3952dfe --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_005174() { + vec3 res = abs(vec3(1.0f)); +} + +vec4 vertex_main() { + abs_005174(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_005174() { + vec3 res = abs(vec3(1.0f)); +} + +void fragment_main() { + abs_005174(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_005174() { + vec3 res = abs(vec3(1.0f)); +} + +void compute_main() { + abs_005174(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.msl new file mode 100644 index 0000000000..91163ee7de --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_005174() { + float3 res = fabs(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_005174(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_005174(); + return; +} + +kernel void compute_main() { + abs_005174(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1fc03a280 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_005174 "abs_005174" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %abs_005174 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 FAbs %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_005174 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %abs_005174 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_005174 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.wgsl new file mode 100644 index 0000000000..eab83d2446 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/005174.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_005174() { + var res : vec3 = abs(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_005174(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_005174(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_005174(); +} diff --git a/test/tint/builtins/gen/literal/abs/1ce782.wgsl b/test/tint/builtins/gen/literal/abs/1ce782.wgsl new file mode 100644 index 0000000000..09d89f886b --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1ce782.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<4, u32>) -> vec<4, u32> +fn abs_1ce782() { + var res: vec4 = abs(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_1ce782(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_1ce782(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_1ce782(); +} diff --git a/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b8b5acc39 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_1ce782() { + uint4 res = abs((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1ce782(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1ce782(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1ce782(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b8b5acc39 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_1ce782() { + uint4 res = abs((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1ce782(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1ce782(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1ce782(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.glsl new file mode 100644 index 0000000000..44f37c70eb --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_1ce782() { + uvec4 res = uvec4(1u); +} + +vec4 vertex_main() { + abs_1ce782(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_1ce782() { + uvec4 res = uvec4(1u); +} + +void fragment_main() { + abs_1ce782(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_1ce782() { + uvec4 res = uvec4(1u); +} + +void compute_main() { + abs_1ce782(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.msl new file mode 100644 index 0000000000..007f7099e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_1ce782() { + uint4 res = abs(uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_1ce782(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_1ce782(); + return; +} + +kernel void compute_main() { + abs_1ce782(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ae24ba9e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_1ce782 "abs_1ce782" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_1ce782 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_1ce782 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_1ce782 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_1ce782 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.wgsl new file mode 100644 index 0000000000..54fc56ab9e --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1ce782.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_1ce782() { + var res : vec4 = abs(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_1ce782(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_1ce782(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_1ce782(); +} diff --git a/test/tint/builtins/gen/literal/abs/1e9d53.wgsl b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl new file mode 100644 index 0000000000..d2e6dbdfc8 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<2, f32>) -> vec<2, f32> +fn abs_1e9d53() { + var res: vec2 = abs(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_1e9d53(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_1e9d53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_1e9d53(); +} diff --git a/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f0c45a3bc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_1e9d53() { + float2 res = abs((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1e9d53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1e9d53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1e9d53(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0c45a3bc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_1e9d53() { + float2 res = abs((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1e9d53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1e9d53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1e9d53(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.glsl new file mode 100644 index 0000000000..1f6f521a76 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_1e9d53() { + vec2 res = abs(vec2(1.0f)); +} + +vec4 vertex_main() { + abs_1e9d53(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_1e9d53() { + vec2 res = abs(vec2(1.0f)); +} + +void fragment_main() { + abs_1e9d53(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_1e9d53() { + vec2 res = abs(vec2(1.0f)); +} + +void compute_main() { + abs_1e9d53(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.msl new file mode 100644 index 0000000000..b05e09313c --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_1e9d53() { + float2 res = fabs(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_1e9d53(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_1e9d53(); + return; +} + +kernel void compute_main() { + abs_1e9d53(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.spvasm new file mode 100644 index 0000000000..237652fb6f --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_1e9d53 "abs_1e9d53" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %abs_1e9d53 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 FAbs %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_1e9d53 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %abs_1e9d53 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_1e9d53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.wgsl new file mode 100644 index 0000000000..b197e4e57a --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/1e9d53.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_1e9d53() { + var res : vec2 = abs(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_1e9d53(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_1e9d53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_1e9d53(); +} diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl new file mode 100644 index 0000000000..9319b46317 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<3, f16>) -> vec<3, f16> +fn abs_421ca3() { + var res: vec3 = abs(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_421ca3(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_421ca3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_421ca3(); +} diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21a367b1b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_421ca3() { + vector res = abs((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_421ca3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_421ca3(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ca0d4665c --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void abs_421ca3() { + vector res = abs((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_421ca3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_421ca3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D461B57CF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.glsl new file mode 100644 index 0000000000..7a0603d8ac --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_421ca3() { + f16vec3 res = abs(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + abs_421ca3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_421ca3() { + f16vec3 res = abs(f16vec3(0.0hf)); +} + +void fragment_main() { + abs_421ca3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_421ca3() { + f16vec3 res = abs(f16vec3(0.0hf)); +} + +void compute_main() { + abs_421ca3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.msl new file mode 100644 index 0000000000..24f22ad609 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_421ca3() { + half3 res = fabs(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_421ca3(); + return; +} + +kernel void compute_main() { + abs_421ca3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.spvasm new file mode 100644 index 0000000000..4dc29a21f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_421ca3 "abs_421ca3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_421ca3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 FAbs %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %abs_421ca3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %abs_421ca3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_421ca3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.wgsl new file mode 100644 index 0000000000..e3f2507d78 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/421ca3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn abs_421ca3() { + var res : vec3 = abs(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_421ca3(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_421ca3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_421ca3(); +} diff --git a/test/tint/builtins/gen/literal/abs/467cd1.wgsl b/test/tint/builtins/gen/literal/abs/467cd1.wgsl new file mode 100644 index 0000000000..abddb6df3b --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/467cd1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(u32) -> u32 +fn abs_467cd1() { + var res: u32 = abs(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_467cd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_467cd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_467cd1(); +} diff --git a/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2deec6710 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_467cd1() { + uint res = abs(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_467cd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_467cd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_467cd1(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b2deec6710 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_467cd1() { + uint res = abs(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_467cd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_467cd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_467cd1(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.glsl new file mode 100644 index 0000000000..6f63e08981 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_467cd1() { + uint res = 1u; +} + +vec4 vertex_main() { + abs_467cd1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_467cd1() { + uint res = 1u; +} + +void fragment_main() { + abs_467cd1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_467cd1() { + uint res = 1u; +} + +void compute_main() { + abs_467cd1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.msl new file mode 100644 index 0000000000..22849cd1ea --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_467cd1() { + uint res = abs(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_467cd1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_467cd1(); + return; +} + +kernel void compute_main() { + abs_467cd1(); + return; +} + diff --git a/test/tint/builtins/gen/abs/467cd1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/abs/467cd1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.wgsl new file mode 100644 index 0000000000..a69414d474 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/467cd1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_467cd1() { + var res : u32 = abs(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_467cd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_467cd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_467cd1(); +} diff --git a/test/tint/builtins/gen/literal/abs/4ad288.wgsl b/test/tint/builtins/gen/literal/abs/4ad288.wgsl new file mode 100644 index 0000000000..80f4e9e99a --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/4ad288.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(i32) -> i32 +fn abs_4ad288() { + var res: i32 = abs(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_4ad288(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_4ad288(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_4ad288(); +} diff --git a/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..44825b3f56 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_4ad288() { + int res = abs(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_4ad288(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_4ad288(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_4ad288(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44825b3f56 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_4ad288() { + int res = abs(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_4ad288(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_4ad288(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_4ad288(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.glsl new file mode 100644 index 0000000000..57f766de3d --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_4ad288() { + int res = abs(1); +} + +vec4 vertex_main() { + abs_4ad288(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_4ad288() { + int res = abs(1); +} + +void fragment_main() { + abs_4ad288(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_4ad288() { + int res = abs(1); +} + +void compute_main() { + abs_4ad288(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.msl new file mode 100644 index 0000000000..60fb737263 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_4ad288() { + int res = abs(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_4ad288(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_4ad288(); + return; +} + +kernel void compute_main() { + abs_4ad288(); + return; +} + diff --git a/test/tint/builtins/gen/abs/4ad288.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/abs/4ad288.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c47bf87a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/4ad288.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_4ad288() { + var res : i32 = abs(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_4ad288(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_4ad288(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_4ad288(); +} diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl new file mode 100644 index 0000000000..eaefc985b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<4, f16>) -> vec<4, f16> +fn abs_538d29() { + var res: vec4 = abs(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_538d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_538d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_538d29(); +} diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1ce3e01196 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_538d29() { + vector res = abs((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_538d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_538d29(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d6ca9dfd5 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void abs_538d29() { + vector res = abs((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_538d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_538d29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C4B2837D80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.glsl new file mode 100644 index 0000000000..64b283b930 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_538d29() { + f16vec4 res = abs(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + abs_538d29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_538d29() { + f16vec4 res = abs(f16vec4(0.0hf)); +} + +void fragment_main() { + abs_538d29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_538d29() { + f16vec4 res = abs(f16vec4(0.0hf)); +} + +void compute_main() { + abs_538d29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.msl new file mode 100644 index 0000000000..867e989f68 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_538d29() { + half4 res = fabs(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_538d29(); + return; +} + +kernel void compute_main() { + abs_538d29(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.spvasm new file mode 100644 index 0000000000..d34467689f --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_538d29 "abs_538d29" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_538d29 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 FAbs %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %abs_538d29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %abs_538d29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_538d29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.wgsl new file mode 100644 index 0000000000..5501b2326c --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/538d29.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn abs_538d29() { + var res : vec4 = abs(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_538d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_538d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_538d29(); +} diff --git a/test/tint/builtins/gen/literal/abs/5ad50a.wgsl b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl new file mode 100644 index 0000000000..42f58a81ff --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<3, i32>) -> vec<3, i32> +fn abs_5ad50a() { + var res: vec3 = abs(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ad50a(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ad50a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ad50a(); +} diff --git a/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1741eca72d --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_5ad50a() { + int3 res = abs((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ad50a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ad50a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ad50a(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1741eca72d --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_5ad50a() { + int3 res = abs((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ad50a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ad50a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ad50a(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.glsl new file mode 100644 index 0000000000..d0e6e5f88a --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_5ad50a() { + ivec3 res = abs(ivec3(1)); +} + +vec4 vertex_main() { + abs_5ad50a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_5ad50a() { + ivec3 res = abs(ivec3(1)); +} + +void fragment_main() { + abs_5ad50a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_5ad50a() { + ivec3 res = abs(ivec3(1)); +} + +void compute_main() { + abs_5ad50a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.msl new file mode 100644 index 0000000000..d9c31fc3f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_5ad50a() { + int3 res = abs(int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_5ad50a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_5ad50a(); + return; +} + +kernel void compute_main() { + abs_5ad50a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.spvasm new file mode 100644 index 0000000000..e9d0147023 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_5ad50a "abs_5ad50a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %18 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpConstantNull %v3int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_5ad50a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %21 + %13 = OpExtInst %v3int %16 SAbs %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_5ad50a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_5ad50a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_5ad50a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.wgsl new file mode 100644 index 0000000000..e76207127f --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ad50a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_5ad50a() { + var res : vec3 = abs(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ad50a(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ad50a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ad50a(); +} diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl new file mode 100644 index 0000000000..d6c5261e63 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<2, f16>) -> vec<2, f16> +fn abs_5ae4fe() { + var res: vec2 = abs(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ae4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ae4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ae4fe(); +} diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8ecbd1dccd --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_5ae4fe() { + vector res = abs((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ae4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ae4fe(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..427ca6c3ad --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void abs_5ae4fe() { + vector res = abs((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ae4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ae4fe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FB61B87E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.glsl new file mode 100644 index 0000000000..e38ffb0fe9 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_5ae4fe() { + f16vec2 res = abs(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + abs_5ae4fe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_5ae4fe() { + f16vec2 res = abs(f16vec2(0.0hf)); +} + +void fragment_main() { + abs_5ae4fe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_5ae4fe() { + f16vec2 res = abs(f16vec2(0.0hf)); +} + +void compute_main() { + abs_5ae4fe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.msl new file mode 100644 index 0000000000..3048925f87 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_5ae4fe() { + half2 res = fabs(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_5ae4fe(); + return; +} + +kernel void compute_main() { + abs_5ae4fe(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.spvasm new file mode 100644 index 0000000000..0827248748 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_5ae4fe "abs_5ae4fe" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_5ae4fe = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 FAbs %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %abs_5ae4fe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %abs_5ae4fe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_5ae4fe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.wgsl new file mode 100644 index 0000000000..c1e8f2453f --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/5ae4fe.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn abs_5ae4fe() { + var res : vec2 = abs(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ae4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ae4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ae4fe(); +} diff --git a/test/tint/builtins/gen/literal/abs/7326de.wgsl b/test/tint/builtins/gen/literal/abs/7326de.wgsl new file mode 100644 index 0000000000..ca8574da88 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7326de.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<3, u32>) -> vec<3, u32> +fn abs_7326de() { + var res: vec3 = abs(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7326de(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7326de(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7326de(); +} diff --git a/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9eeb70b6cb --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_7326de() { + uint3 res = abs((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7326de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7326de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7326de(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9eeb70b6cb --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_7326de() { + uint3 res = abs((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7326de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7326de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7326de(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.glsl new file mode 100644 index 0000000000..412720d8a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_7326de() { + uvec3 res = uvec3(1u); +} + +vec4 vertex_main() { + abs_7326de(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_7326de() { + uvec3 res = uvec3(1u); +} + +void fragment_main() { + abs_7326de(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_7326de() { + uvec3 res = uvec3(1u); +} + +void compute_main() { + abs_7326de(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.msl new file mode 100644 index 0000000000..4d75de9c25 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_7326de() { + uint3 res = abs(uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_7326de(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_7326de(); + return; +} + +kernel void compute_main() { + abs_7326de(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.spvasm new file mode 100644 index 0000000000..455a8969ee --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_7326de "abs_7326de" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_7326de = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_7326de + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_7326de + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_7326de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.wgsl new file mode 100644 index 0000000000..26962e2968 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7326de.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_7326de() { + var res : vec3 = abs(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7326de(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7326de(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7326de(); +} diff --git a/test/tint/builtins/gen/literal/abs/7f28e6.wgsl b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl new file mode 100644 index 0000000000..529759ed46 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<2, u32>) -> vec<2, u32> +fn abs_7f28e6() { + var res: vec2 = abs(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7f28e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7f28e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7f28e6(); +} diff --git a/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ede7f1ed39 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_7f28e6() { + uint2 res = abs((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7f28e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7f28e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7f28e6(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ede7f1ed39 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_7f28e6() { + uint2 res = abs((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7f28e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7f28e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7f28e6(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.glsl new file mode 100644 index 0000000000..fe70a48043 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_7f28e6() { + uvec2 res = uvec2(1u); +} + +vec4 vertex_main() { + abs_7f28e6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_7f28e6() { + uvec2 res = uvec2(1u); +} + +void fragment_main() { + abs_7f28e6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_7f28e6() { + uvec2 res = uvec2(1u); +} + +void compute_main() { + abs_7f28e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.msl new file mode 100644 index 0000000000..9e46018c92 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_7f28e6() { + uint2 res = abs(uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_7f28e6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_7f28e6(); + return; +} + +kernel void compute_main() { + abs_7f28e6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..659eeb56fb --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_7f28e6 "abs_7f28e6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_7f28e6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_7f28e6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_7f28e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_7f28e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..f66e54e94f --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7f28e6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_7f28e6() { + var res : vec2 = abs(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7f28e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7f28e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7f28e6(); +} diff --git a/test/tint/builtins/gen/literal/abs/7faa9e.wgsl b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl new file mode 100644 index 0000000000..8dcf3102ec --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<2, i32>) -> vec<2, i32> +fn abs_7faa9e() { + var res: vec2 = abs(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7faa9e(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7faa9e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7faa9e(); +} diff --git a/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..86d86427a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_7faa9e() { + int2 res = abs((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7faa9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7faa9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7faa9e(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..86d86427a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_7faa9e() { + int2 res = abs((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7faa9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7faa9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7faa9e(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.glsl new file mode 100644 index 0000000000..600cc7885d --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_7faa9e() { + ivec2 res = abs(ivec2(1)); +} + +vec4 vertex_main() { + abs_7faa9e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_7faa9e() { + ivec2 res = abs(ivec2(1)); +} + +void fragment_main() { + abs_7faa9e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_7faa9e() { + ivec2 res = abs(ivec2(1)); +} + +void compute_main() { + abs_7faa9e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.msl new file mode 100644 index 0000000000..c46f48db88 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_7faa9e() { + int2 res = abs(int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_7faa9e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_7faa9e(); + return; +} + +kernel void compute_main() { + abs_7faa9e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.spvasm new file mode 100644 index 0000000000..1fbfa3a38d --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_7faa9e "abs_7faa9e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %18 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpConstantNull %v2int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_7faa9e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %21 + %13 = OpExtInst %v2int %16 SAbs %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_7faa9e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_7faa9e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_7faa9e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c3f4b4776 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/7faa9e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_7faa9e() { + var res : vec2 = abs(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7faa9e(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7faa9e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7faa9e(); +} diff --git a/test/tint/builtins/gen/literal/abs/9c80a6.wgsl b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl new file mode 100644 index 0000000000..05f1094c43 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<4, i32>) -> vec<4, i32> +fn abs_9c80a6() { + var res: vec4 = abs(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_9c80a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_9c80a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_9c80a6(); +} diff --git a/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bce474dddf --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_9c80a6() { + int4 res = abs((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_9c80a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_9c80a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_9c80a6(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bce474dddf --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_9c80a6() { + int4 res = abs((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_9c80a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_9c80a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_9c80a6(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.glsl new file mode 100644 index 0000000000..aefe8c8eb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_9c80a6() { + ivec4 res = abs(ivec4(1)); +} + +vec4 vertex_main() { + abs_9c80a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_9c80a6() { + ivec4 res = abs(ivec4(1)); +} + +void fragment_main() { + abs_9c80a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_9c80a6() { + ivec4 res = abs(ivec4(1)); +} + +void compute_main() { + abs_9c80a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.msl new file mode 100644 index 0000000000..833671a204 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_9c80a6() { + int4 res = abs(int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_9c80a6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_9c80a6(); + return; +} + +kernel void compute_main() { + abs_9c80a6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..50b4cec728 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_9c80a6 "abs_9c80a6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %18 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %21 = OpConstantNull %v4int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_9c80a6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %21 + %13 = OpExtInst %v4int %16 SAbs %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_9c80a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_9c80a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_9c80a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..029f98e152 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/9c80a6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_9c80a6() { + var res : vec4 = abs(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_9c80a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_9c80a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_9c80a6(); +} diff --git a/test/tint/builtins/gen/literal/abs/b96037.wgsl b/test/tint/builtins/gen/literal/abs/b96037.wgsl new file mode 100644 index 0000000000..2ba0cdbc08 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/b96037.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(f32) -> f32 +fn abs_b96037() { + var res: f32 = abs(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_b96037(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_b96037(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_b96037(); +} diff --git a/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a4c7c03d4d --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_b96037() { + float res = abs(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_b96037(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_b96037(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_b96037(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a4c7c03d4d --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void abs_b96037() { + float res = abs(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_b96037(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_b96037(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_b96037(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.glsl new file mode 100644 index 0000000000..53edae5993 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void abs_b96037() { + float res = abs(1.0f); +} + +vec4 vertex_main() { + abs_b96037(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_b96037() { + float res = abs(1.0f); +} + +void fragment_main() { + abs_b96037(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_b96037() { + float res = abs(1.0f); +} + +void compute_main() { + abs_b96037(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.msl new file mode 100644 index 0000000000..38e2f9b030 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_b96037() { + float res = fabs(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_b96037(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_b96037(); + return; +} + +kernel void compute_main() { + abs_b96037(); + return; +} + diff --git a/test/tint/builtins/gen/abs/b96037.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/abs/b96037.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.wgsl new file mode 100644 index 0000000000..be38612056 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/b96037.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn abs_b96037() { + var res : f32 = abs(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_b96037(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_b96037(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_b96037(); +} diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl new file mode 100644 index 0000000000..63cc56db81 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(f16) -> f16 +fn abs_fd247f() { + var res: f16 = abs(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_fd247f(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_fd247f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_fd247f(); +} diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f68c08c4e --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void abs_fd247f() { + float16_t res = abs(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_fd247f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_fd247f(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a341373578 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void abs_fd247f() { + float16_t res = abs(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_fd247f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_fd247f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C7205F8830(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C7205F8830(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.glsl new file mode 100644 index 0000000000..2c864eb25b --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_fd247f() { + float16_t res = abs(0.0hf); +} + +vec4 vertex_main() { + abs_fd247f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_fd247f() { + float16_t res = abs(0.0hf); +} + +void fragment_main() { + abs_fd247f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_fd247f() { + float16_t res = abs(0.0hf); +} + +void compute_main() { + abs_fd247f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.msl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.msl new file mode 100644 index 0000000000..6c6c738a26 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void abs_fd247f() { + half res = fabs(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_fd247f(); + return; +} + +kernel void compute_main() { + abs_fd247f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.spvasm new file mode 100644 index 0000000000..3472743c09 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_fd247f "abs_fd247f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_fd247f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 FAbs %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %abs_fd247f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %abs_fd247f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_fd247f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.wgsl new file mode 100644 index 0000000000..28cbd46ad1 --- /dev/null +++ b/test/tint/builtins/gen/literal/abs/fd247f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn abs_fd247f() { + var res : f16 = abs(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_fd247f(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_fd247f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_fd247f(); +} diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl new file mode 100644 index 0000000000..35e62ea158 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<2, f16>) -> vec<2, f16> +fn acos_004aff() { + var res: vec2 = acos(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_004aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_004aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_004aff(); +} diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..92b5765986 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_004aff() { + vector res = acos((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_004aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_004aff(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e66364b4cd --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void acos_004aff() { + vector res = acos((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_004aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_004aff(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B9F5C6E5B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl new file mode 100644 index 0000000000..c4dd0577a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_004aff() { + f16vec2 res = acos(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + acos_004aff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_004aff() { + f16vec2 res = acos(f16vec2(0.0hf)); +} + +void fragment_main() { + acos_004aff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_004aff() { + f16vec2 res = acos(f16vec2(0.0hf)); +} + +void compute_main() { + acos_004aff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl new file mode 100644 index 0000000000..4d9f5a2c58 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_004aff() { + half2 res = acos(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_004aff(); + return; +} + +kernel void compute_main() { + acos_004aff(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbde032bd0 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_004aff "acos_004aff" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_004aff = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Acos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %acos_004aff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_004aff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_004aff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.wgsl new file mode 100644 index 0000000000..57a6cb012a --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acos_004aff() { + var res : vec2 = acos(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_004aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_004aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_004aff(); +} diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl b/test/tint/builtins/gen/literal/acos/203628.wgsl new file mode 100644 index 0000000000..e5f2df8673 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<4, f16>) -> vec<4, f16> +fn acos_203628() { + var res: vec4 = acos(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_203628(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_203628(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_203628(); +} diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..886ea9556e --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_203628() { + vector res = acos((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_203628(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_203628(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_203628(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ee115e66b --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void acos_203628() { + vector res = acos((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_203628(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_203628(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_203628(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019D14DE1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl new file mode 100644 index 0000000000..0dbc198f0f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_203628() { + f16vec4 res = acos(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + acos_203628(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_203628() { + f16vec4 res = acos(f16vec4(0.0hf)); +} + +void fragment_main() { + acos_203628(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_203628() { + f16vec4 res = acos(f16vec4(0.0hf)); +} + +void compute_main() { + acos_203628(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl new file mode 100644 index 0000000000..4aeebba90f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_203628() { + half4 res = acos(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_203628(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_203628(); + return; +} + +kernel void compute_main() { + acos_203628(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm new file mode 100644 index 0000000000..7807c72d21 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_203628 "acos_203628" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_203628 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Acos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %acos_203628 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_203628 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_203628 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.wgsl new file mode 100644 index 0000000000..ebbc42e95a --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acos_203628() { + var res : vec4 = acos(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_203628(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_203628(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_203628(); +} diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl new file mode 100644 index 0000000000..959d12936d --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(f16) -> f16 +fn acos_303e3d() { + var res: f16 = acos(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_303e3d(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_303e3d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_303e3d(); +} diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..87a3b3ab7f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_303e3d() { + float16_t res = acos(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_303e3d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_303e3d(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa8c37196c --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void acos_303e3d() { + float16_t res = acos(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_303e3d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_303e3d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021AE9120540(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021AE9120540(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl new file mode 100644 index 0000000000..757f182315 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_303e3d() { + float16_t res = acos(0.0hf); +} + +vec4 vertex_main() { + acos_303e3d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_303e3d() { + float16_t res = acos(0.0hf); +} + +void fragment_main() { + acos_303e3d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_303e3d() { + float16_t res = acos(0.0hf); +} + +void compute_main() { + acos_303e3d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl new file mode 100644 index 0000000000..913e3fdaec --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_303e3d() { + half res = acos(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_303e3d(); + return; +} + +kernel void compute_main() { + acos_303e3d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm new file mode 100644 index 0000000000..9df9a98206 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_303e3d "acos_303e3d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_303e3d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Acos %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %acos_303e3d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_303e3d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_303e3d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.wgsl new file mode 100644 index 0000000000..d9f5be3855 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acos_303e3d() { + var res : f16 = acos(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_303e3d(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_303e3d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_303e3d(); +} diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl b/test/tint/builtins/gen/literal/acos/489247.wgsl new file mode 100644 index 0000000000..cc3e74b998 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(f32) -> f32 +fn acos_489247() { + var res: f32 = acos(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_489247(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_489247(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_489247(); +} diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d370fc469a --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_489247() { + float res = acos(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_489247(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_489247(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_489247(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d370fc469a --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_489247() { + float res = acos(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_489247(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_489247(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_489247(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.glsl new file mode 100644 index 0000000000..92c7481dda --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_489247() { + float res = acos(1.0f); +} + +vec4 vertex_main() { + acos_489247(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_489247() { + float res = acos(1.0f); +} + +void fragment_main() { + acos_489247(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_489247() { + float res = acos(1.0f); +} + +void compute_main() { + acos_489247(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.msl new file mode 100644 index 0000000000..a7bb168303 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_489247() { + float res = acos(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_489247(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_489247(); + return; +} + +kernel void compute_main() { + acos_489247(); + return; +} + diff --git a/test/tint/builtins/gen/acos/489247.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/acos/489247.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/acos/489247.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.wgsl new file mode 100644 index 0000000000..3a8d40042f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acos_489247() { + var res : f32 = acos(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_489247(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_489247(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_489247(); +} diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl new file mode 100644 index 0000000000..b820523df8 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<4, f32>) -> vec<4, f32> +fn acos_8e2acf() { + var res: vec4 = acos(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_8e2acf(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_8e2acf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_8e2acf(); +} diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7877019c8c --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_8e2acf() { + float4 res = acos((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_8e2acf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_8e2acf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_8e2acf(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7877019c8c --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_8e2acf() { + float4 res = acos((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_8e2acf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_8e2acf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_8e2acf(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.glsl new file mode 100644 index 0000000000..d411a319c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_8e2acf() { + vec4 res = acos(vec4(1.0f)); +} + +vec4 vertex_main() { + acos_8e2acf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_8e2acf() { + vec4 res = acos(vec4(1.0f)); +} + +void fragment_main() { + acos_8e2acf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_8e2acf() { + vec4 res = acos(vec4(1.0f)); +} + +void compute_main() { + acos_8e2acf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.msl new file mode 100644 index 0000000000..4dfc1a7b36 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_8e2acf() { + float4 res = acos(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_8e2acf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_8e2acf(); + return; +} + +kernel void compute_main() { + acos_8e2acf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.spvasm new file mode 100644 index 0000000000..d0c94e013d --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_8e2acf "acos_8e2acf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%acos_8e2acf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Acos %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %acos_8e2acf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %acos_8e2acf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %acos_8e2acf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f38b086d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acos_8e2acf() { + var res : vec4 = acos(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_8e2acf(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_8e2acf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_8e2acf(); +} diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl new file mode 100644 index 0000000000..2d80fb3f0c --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<3, f32>) -> vec<3, f32> +fn acos_a610c4() { + var res: vec3 = acos(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_a610c4(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_a610c4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_a610c4(); +} diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ff28d8324f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_a610c4() { + float3 res = acos((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_a610c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_a610c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_a610c4(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ff28d8324f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_a610c4() { + float3 res = acos((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_a610c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_a610c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_a610c4(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.glsl new file mode 100644 index 0000000000..4b34d3826b --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_a610c4() { + vec3 res = acos(vec3(1.0f)); +} + +vec4 vertex_main() { + acos_a610c4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_a610c4() { + vec3 res = acos(vec3(1.0f)); +} + +void fragment_main() { + acos_a610c4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_a610c4() { + vec3 res = acos(vec3(1.0f)); +} + +void compute_main() { + acos_a610c4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.msl new file mode 100644 index 0000000000..4af410f6ef --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_a610c4() { + float3 res = acos(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_a610c4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_a610c4(); + return; +} + +kernel void compute_main() { + acos_a610c4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.spvasm new file mode 100644 index 0000000000..6ddef0d0c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_a610c4 "acos_a610c4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%acos_a610c4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Acos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %acos_a610c4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_a610c4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_a610c4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.wgsl new file mode 100644 index 0000000000..14105fe989 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acos_a610c4() { + var res : vec3 = acos(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_a610c4(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_a610c4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_a610c4(); +} diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl new file mode 100644 index 0000000000..929653a92c --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<2, f32>) -> vec<2, f32> +fn acos_dfc915() { + var res: vec2 = acos(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_dfc915(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_dfc915(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_dfc915(); +} diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe14cb41d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_dfc915() { + float2 res = acos((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_dfc915(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_dfc915(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_dfc915(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe14cb41d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_dfc915() { + float2 res = acos((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_dfc915(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_dfc915(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_dfc915(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.glsl new file mode 100644 index 0000000000..a2119fcca3 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_dfc915() { + vec2 res = acos(vec2(1.0f)); +} + +vec4 vertex_main() { + acos_dfc915(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_dfc915() { + vec2 res = acos(vec2(1.0f)); +} + +void fragment_main() { + acos_dfc915(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_dfc915() { + vec2 res = acos(vec2(1.0f)); +} + +void compute_main() { + acos_dfc915(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.msl new file mode 100644 index 0000000000..7673132bc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_dfc915() { + float2 res = acos(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_dfc915(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_dfc915(); + return; +} + +kernel void compute_main() { + acos_dfc915(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.spvasm new file mode 100644 index 0000000000..983a055d50 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_dfc915 "acos_dfc915" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%acos_dfc915 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Acos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %acos_dfc915 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_dfc915 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_dfc915 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.wgsl new file mode 100644 index 0000000000..fcc29cfcf9 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acos_dfc915() { + var res : vec2 = acos(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_dfc915(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_dfc915(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_dfc915(); +} diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl new file mode 100644 index 0000000000..9195ffb146 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<3, f16>) -> vec<3, f16> +fn acos_f47057() { + var res: vec3 = acos(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_f47057(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_f47057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_f47057(); +} diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7cf8ba2158 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_f47057() { + vector res = acos((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_f47057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_f47057(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38dd9cd254 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void acos_f47057() { + vector res = acos((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_f47057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_f47057(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020584057560(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl new file mode 100644 index 0000000000..4e2cbd06e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_f47057() { + f16vec3 res = acos(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + acos_f47057(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_f47057() { + f16vec3 res = acos(f16vec3(0.0hf)); +} + +void fragment_main() { + acos_f47057(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_f47057() { + f16vec3 res = acos(f16vec3(0.0hf)); +} + +void compute_main() { + acos_f47057(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl new file mode 100644 index 0000000000..e74d29b2cb --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_f47057() { + half3 res = acos(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_f47057(); + return; +} + +kernel void compute_main() { + acos_f47057(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm new file mode 100644 index 0000000000..00895bf2d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_f47057 "acos_f47057" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_f47057 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Acos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %acos_f47057 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_f47057 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_f47057 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe4125dcee --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acos_f47057() { + var res : vec3 = acos(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_f47057(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_f47057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_f47057(); +} diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl new file mode 100644 index 0000000000..a4b0dab48b --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<2, f16>) -> vec<2, f16> +fn acosh_5f49d8() { + var res: vec2 = acosh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_5f49d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_5f49d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_5f49d8(); +} diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9ba3054eb2 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_5f49d8() { + vector res = tint_acosh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_5f49d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_5f49d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44e42cc89c --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_5f49d8() { + vector res = tint_acosh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_5f49d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_5f49d8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001641C7488B0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.glsl new file mode 100644 index 0000000000..1297122b13 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 res = tint_acosh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + acosh_5f49d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 res = tint_acosh(f16vec2(0.0hf)); +} + +void fragment_main() { + acosh_5f49d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 res = tint_acosh(f16vec2(0.0hf)); +} + +void compute_main() { + acosh_5f49d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.msl new file mode 100644 index 0000000000..9245c572e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half2 tint_acosh(half2 x) { + return select(acosh(x), half2(0.0h), (x < half2(1.0h))); +} + +void acosh_5f49d8() { + half2 res = tint_acosh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_5f49d8(); + return; +} + +kernel void compute_main() { + acosh_5f49d8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..79bf1ae20c --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_5f49d8 "acosh_5f49d8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v2half = OpTypePointer Function %v2half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v2half None %9 + %x = OpFunctionParameter %v2half + %14 = OpLabel + %18 = OpFOrdLessThan %v2bool %x %17 + %22 = OpExtInst %v2half %23 Acosh %x + %15 = OpSelect %v2half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_5f49d8 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %21 + %28 = OpFunctionCall %v2half %tint_acosh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %acosh_5f49d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_5f49d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %acosh_5f49d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..54e3b93493 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/5f49d8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acosh_5f49d8() { + var res : vec2 = acosh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_5f49d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_5f49d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_5f49d8(); +} diff --git a/test/tint/builtins/gen/literal/acosh/640883.wgsl b/test/tint/builtins/gen/literal/acosh/640883.wgsl new file mode 100644 index 0000000000..b6656a7a0e --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/640883.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acosh(vec<2, f32>) -> vec<2, f32> +fn acosh_640883() { + var res: vec2 = acosh(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_640883(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_640883(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_640883(); +} diff --git a/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..182337e895 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_acosh(float2 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_640883() { + float2 res = tint_acosh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_640883(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_640883(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_640883(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..182337e895 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_acosh(float2 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_640883() { + float2 res = tint_acosh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_640883(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_640883(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_640883(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.glsl new file mode 100644 index 0000000000..723cdd9b9b --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +vec2 tint_acosh(vec2 x) { + return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f))); +} + +void acosh_640883() { + vec2 res = tint_acosh(vec2(1.0f)); +} + +vec4 vertex_main() { + acosh_640883(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_acosh(vec2 x) { + return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f))); +} + +void acosh_640883() { + vec2 res = tint_acosh(vec2(1.0f)); +} + +void fragment_main() { + acosh_640883(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_acosh(vec2 x) { + return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f))); +} + +void acosh_640883() { + vec2 res = tint_acosh(vec2(1.0f)); +} + +void compute_main() { + acosh_640883(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.msl new file mode 100644 index 0000000000..9cb8bee76f --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +float2 tint_acosh(float2 x) { + return select(acosh(x), float2(0.0f), (x < float2(1.0f))); +} + +void acosh_640883() { + float2 res = tint_acosh(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_640883(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_640883(); + return; +} + +kernel void compute_main() { + acosh_640883(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f4c1b0f7c --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_640883 "acosh_640883" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %v2float = OpTypeVector %float 2 + %9 = OpTypeFunction %v2float %v2float + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v2float %float_1 %float_1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %20 = OpConstantNull %v2float + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %30 = OpTypeFunction %v4float + %tint_acosh = OpFunction %v2float None %9 + %x = OpFunctionParameter %v2float + %13 = OpLabel + %17 = OpFOrdLessThan %v2bool %x %16 + %21 = OpExtInst %v2float %22 Acosh %x + %14 = OpSelect %v2float %17 %20 %21 + OpReturnValue %14 + OpFunctionEnd +%acosh_640883 = OpFunction %void None %23 + %26 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %27 = OpFunctionCall %v2float %tint_acosh %16 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %acosh_640883 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %38 = OpLabel + %39 = OpFunctionCall %void %acosh_640883 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %41 = OpLabel + %42 = OpFunctionCall %void %acosh_640883 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.wgsl new file mode 100644 index 0000000000..fdec9ee1e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/640883.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acosh_640883() { + var res : vec2 = acosh(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_640883(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_640883(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_640883(); +} diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl new file mode 100644 index 0000000000..9b93d25c77 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(f16) -> f16 +fn acosh_a37dfe() { + var res: f16 = acosh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_a37dfe(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_a37dfe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_a37dfe(); +} diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0a48295874 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_acosh(float16_t x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_a37dfe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_a37dfe(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..89d2293e31 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_acosh(float16_t x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_a37dfe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_a37dfe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000285D7A33130(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.glsl new file mode 100644 index 0000000000..e7752e3799 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(0.0hf); +} + +vec4 vertex_main() { + acosh_a37dfe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(0.0hf); +} + +void fragment_main() { + acosh_a37dfe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t res = tint_acosh(0.0hf); +} + +void compute_main() { + acosh_a37dfe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.msl new file mode 100644 index 0000000000..09a8e2d967 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half tint_acosh(half x) { + return select(acosh(x), 0.0h, (x < 1.0h)); +} + +void acosh_a37dfe() { + half res = tint_acosh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_a37dfe(); + return; +} + +kernel void compute_main() { + acosh_a37dfe(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5071ef92a --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_a37dfe "acosh_a37dfe" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %9 = OpTypeFunction %half %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %18 = OpConstantNull %half + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %half None %9 + %x = OpFunctionParameter %half + %13 = OpLabel + %16 = OpFOrdLessThan %bool %x %half_0x1p_0 + %19 = OpExtInst %half %20 Acosh %x + %14 = OpSelect %half %16 %18 %19 + OpReturnValue %14 + OpFunctionEnd +%acosh_a37dfe = OpFunction %void None %21 + %24 = OpLabel + %res = OpVariable %_ptr_Function_half Function %18 + %25 = OpFunctionCall %half %tint_acosh %18 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %acosh_a37dfe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %37 = OpLabel + %38 = OpFunctionCall %void %acosh_a37dfe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_a37dfe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.wgsl new file mode 100644 index 0000000000..983b91cdb3 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/a37dfe.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acosh_a37dfe() { + var res : f16 = acosh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_a37dfe(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_a37dfe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_a37dfe(); +} diff --git a/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl new file mode 100644 index 0000000000..9bd4c11a95 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acosh(vec<4, f32>) -> vec<4, f32> +fn acosh_d51ccb() { + var res: vec4 = acosh(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_d51ccb(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_d51ccb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_d51ccb(); +} diff --git a/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8e57d580fa --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_acosh(float4 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_d51ccb() { + float4 res = tint_acosh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_d51ccb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_d51ccb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_d51ccb(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e57d580fa --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_acosh(float4 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_d51ccb() { + float4 res = tint_acosh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_d51ccb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_d51ccb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_d51ccb(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.glsl new file mode 100644 index 0000000000..ade7867f0c --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +vec4 tint_acosh(vec4 x) { + return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f))); +} + +void acosh_d51ccb() { + vec4 res = tint_acosh(vec4(1.0f)); +} + +vec4 vertex_main() { + acosh_d51ccb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_acosh(vec4 x) { + return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f))); +} + +void acosh_d51ccb() { + vec4 res = tint_acosh(vec4(1.0f)); +} + +void fragment_main() { + acosh_d51ccb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_acosh(vec4 x) { + return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f))); +} + +void acosh_d51ccb() { + vec4 res = tint_acosh(vec4(1.0f)); +} + +void compute_main() { + acosh_d51ccb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.msl new file mode 100644 index 0000000000..2848580bf3 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +float4 tint_acosh(float4 x) { + return select(acosh(x), float4(0.0f), (x < float4(1.0f))); +} + +void acosh_d51ccb() { + float4 res = tint_acosh(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_d51ccb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_d51ccb(); + return; +} + +kernel void compute_main() { + acosh_d51ccb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.spvasm new file mode 100644 index 0000000000..dc1f0bf8f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_d51ccb "acosh_d51ccb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %9 = OpTypeFunction %v4float %v4float + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpTypeFunction %v4float + %tint_acosh = OpFunction %v4float None %9 + %x = OpFunctionParameter %v4float + %12 = OpLabel + %16 = OpFOrdLessThan %v4bool %x %15 + %19 = OpExtInst %v4float %20 Acosh %x + %13 = OpSelect %v4float %16 %5 %19 + OpReturnValue %13 + OpFunctionEnd +%acosh_d51ccb = OpFunction %void None %21 + %24 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %25 = OpFunctionCall %v4float %tint_acosh %15 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %acosh_d51ccb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %36 = OpLabel + %37 = OpFunctionCall %void %acosh_d51ccb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %39 = OpLabel + %40 = OpFunctionCall %void %acosh_d51ccb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.wgsl new file mode 100644 index 0000000000..012cbb7453 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/d51ccb.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acosh_d51ccb() { + var res : vec4 = acosh(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_d51ccb(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_d51ccb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_d51ccb(); +} diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl new file mode 100644 index 0000000000..4f64c073c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<4, f16>) -> vec<4, f16> +fn acosh_de60d8() { + var res: vec4 = acosh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_de60d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_de60d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_de60d8(); +} diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5de3f3b567 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_de60d8() { + vector res = tint_acosh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_de60d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_de60d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c8ea4182c --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_de60d8() { + vector res = tint_acosh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_de60d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_de60d8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027AF4D645C0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.glsl new file mode 100644 index 0000000000..439999ffd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 res = tint_acosh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + acosh_de60d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 res = tint_acosh(f16vec4(0.0hf)); +} + +void fragment_main() { + acosh_de60d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 res = tint_acosh(f16vec4(0.0hf)); +} + +void compute_main() { + acosh_de60d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.msl new file mode 100644 index 0000000000..39b26d79dc --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half4 tint_acosh(half4 x) { + return select(acosh(x), half4(0.0h), (x < half4(1.0h))); +} + +void acosh_de60d8() { + half4 res = tint_acosh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_de60d8(); + return; +} + +kernel void compute_main() { + acosh_de60d8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..220c72ab1b --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_de60d8 "acosh_de60d8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v4half = OpTypePointer Function %v4half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v4half None %9 + %x = OpFunctionParameter %v4half + %14 = OpLabel + %18 = OpFOrdLessThan %v4bool %x %17 + %22 = OpExtInst %v4half %23 Acosh %x + %15 = OpSelect %v4half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_de60d8 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %21 + %28 = OpFunctionCall %v4half %tint_acosh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %acosh_de60d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_de60d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %acosh_de60d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fdbcb0902 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/de60d8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acosh_de60d8() { + var res : vec4 = acosh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_de60d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_de60d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_de60d8(); +} diff --git a/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl new file mode 100644 index 0000000000..8e388fb266 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acosh(vec<3, f32>) -> vec<3, f32> +fn acosh_e38f5c() { + var res: vec3 = acosh(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_e38f5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_e38f5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_e38f5c(); +} diff --git a/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..13aeed61a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_acosh(float3 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_e38f5c() { + float3 res = tint_acosh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_e38f5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_e38f5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_e38f5c(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13aeed61a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_acosh(float3 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_e38f5c() { + float3 res = tint_acosh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_e38f5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_e38f5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_e38f5c(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.glsl new file mode 100644 index 0000000000..f66323199f --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +vec3 tint_acosh(vec3 x) { + return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f))); +} + +void acosh_e38f5c() { + vec3 res = tint_acosh(vec3(1.0f)); +} + +vec4 vertex_main() { + acosh_e38f5c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_acosh(vec3 x) { + return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f))); +} + +void acosh_e38f5c() { + vec3 res = tint_acosh(vec3(1.0f)); +} + +void fragment_main() { + acosh_e38f5c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_acosh(vec3 x) { + return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f))); +} + +void acosh_e38f5c() { + vec3 res = tint_acosh(vec3(1.0f)); +} + +void compute_main() { + acosh_e38f5c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.msl new file mode 100644 index 0000000000..950549f74a --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +float3 tint_acosh(float3 x) { + return select(acosh(x), float3(0.0f), (x < float3(1.0f))); +} + +void acosh_e38f5c() { + float3 res = tint_acosh(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_e38f5c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_e38f5c(); + return; +} + +kernel void compute_main() { + acosh_e38f5c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.spvasm new file mode 100644 index 0000000000..1063f49c3f --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_e38f5c "acosh_e38f5c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float %v3float + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %20 = OpConstantNull %v3float + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_v3float = OpTypePointer Function %v3float + %30 = OpTypeFunction %v4float + %tint_acosh = OpFunction %v3float None %9 + %x = OpFunctionParameter %v3float + %13 = OpLabel + %17 = OpFOrdLessThan %v3bool %x %16 + %21 = OpExtInst %v3float %22 Acosh %x + %14 = OpSelect %v3float %17 %20 %21 + OpReturnValue %14 + OpFunctionEnd +%acosh_e38f5c = OpFunction %void None %23 + %26 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %27 = OpFunctionCall %v3float %tint_acosh %16 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %acosh_e38f5c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %38 = OpLabel + %39 = OpFunctionCall %void %acosh_e38f5c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %41 = OpLabel + %42 = OpFunctionCall %void %acosh_e38f5c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.wgsl new file mode 100644 index 0000000000..e902873f07 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/e38f5c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acosh_e38f5c() { + var res : vec3 = acosh(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_e38f5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_e38f5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_e38f5c(); +} diff --git a/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl new file mode 100644 index 0000000000..0e296a9f65 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acosh(f32) -> f32 +fn acosh_ecf2d1() { + var res: f32 = acosh(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_ecf2d1(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_ecf2d1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_ecf2d1(); +} diff --git a/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1eafaf7755 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float tint_acosh(float x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_ecf2d1() { + float res = tint_acosh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_ecf2d1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_ecf2d1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_ecf2d1(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1eafaf7755 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float tint_acosh(float x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_ecf2d1() { + float res = tint_acosh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_ecf2d1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_ecf2d1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_ecf2d1(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.glsl new file mode 100644 index 0000000000..41cffe78b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +float tint_acosh(float x) { + return ((x < 1.0f) ? 0.0f : acosh(x)); +} + +void acosh_ecf2d1() { + float res = tint_acosh(1.0f); +} + +vec4 vertex_main() { + acosh_ecf2d1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_acosh(float x) { + return ((x < 1.0f) ? 0.0f : acosh(x)); +} + +void acosh_ecf2d1() { + float res = tint_acosh(1.0f); +} + +void fragment_main() { + acosh_ecf2d1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_acosh(float x) { + return ((x < 1.0f) ? 0.0f : acosh(x)); +} + +void acosh_ecf2d1() { + float res = tint_acosh(1.0f); +} + +void compute_main() { + acosh_ecf2d1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.msl new file mode 100644 index 0000000000..b8f2aa8fe2 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +float tint_acosh(float x) { + return select(acosh(x), 0.0f, (x < 1.0f)); +} + +void acosh_ecf2d1() { + float res = tint_acosh(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_ecf2d1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_ecf2d1(); + return; +} + +kernel void compute_main() { + acosh_ecf2d1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.spvasm new file mode 100644 index 0000000000..b27fe30862 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_ecf2d1 "acosh_ecf2d1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %9 = OpTypeFunction %float %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpTypeFunction %v4float + %tint_acosh = OpFunction %float None %9 + %x = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFOrdLessThan %bool %x %float_1 + %17 = OpExtInst %float %18 Acosh %x + %13 = OpSelect %float %15 %8 %17 + OpReturnValue %13 + OpFunctionEnd +%acosh_ecf2d1 = OpFunction %void None %19 + %22 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %23 = OpFunctionCall %float %tint_acosh %float_1 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %acosh_ecf2d1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %19 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %19 + %34 = OpLabel + %35 = OpFunctionCall %void %acosh_ecf2d1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %19 + %37 = OpLabel + %38 = OpFunctionCall %void %acosh_ecf2d1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b4d017ebf --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/ecf2d1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acosh_ecf2d1() { + var res : f32 = acosh(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_ecf2d1(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_ecf2d1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_ecf2d1(); +} diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl new file mode 100644 index 0000000000..40db5d303f --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<3, f16>) -> vec<3, f16> +fn acosh_f56574() { + var res: vec3 = acosh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_f56574(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_f56574(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_f56574(); +} diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..72b7eb7fa0 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_f56574() { + vector res = tint_acosh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_f56574(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_f56574(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a35e840bc9 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_f56574() { + vector res = tint_acosh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_f56574(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_f56574(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000221246484D0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.glsl new file mode 100644 index 0000000000..20527af655 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 res = tint_acosh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + acosh_f56574(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 res = tint_acosh(f16vec3(0.0hf)); +} + +void fragment_main() { + acosh_f56574(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 res = tint_acosh(f16vec3(0.0hf)); +} + +void compute_main() { + acosh_f56574(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.msl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.msl new file mode 100644 index 0000000000..df354ba738 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half3 tint_acosh(half3 x) { + return select(acosh(x), half3(0.0h), (x < half3(1.0h))); +} + +void acosh_f56574() { + half3 res = tint_acosh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_f56574(); + return; +} + +kernel void compute_main() { + acosh_f56574(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.spvasm new file mode 100644 index 0000000000..c1bec972c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_f56574 "acosh_f56574" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v3half = OpTypePointer Function %v3half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v3half None %9 + %x = OpFunctionParameter %v3half + %14 = OpLabel + %18 = OpFOrdLessThan %v3bool %x %17 + %22 = OpExtInst %v3half %23 Acosh %x + %15 = OpSelect %v3half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_f56574 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %21 + %28 = OpFunctionCall %v3half %tint_acosh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %acosh_f56574 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_f56574 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %acosh_f56574 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.wgsl new file mode 100644 index 0000000000..2eff0f0d56 --- /dev/null +++ b/test/tint/builtins/gen/literal/acosh/f56574.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn acosh_f56574() { + var res : vec3 = acosh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_f56574(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_f56574(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_f56574(); +} diff --git a/test/tint/builtins/gen/literal/all/353d6a.wgsl b/test/tint/builtins/gen/literal/all/353d6a.wgsl new file mode 100644 index 0000000000..410d63d852 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/353d6a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(bool) -> bool +fn all_353d6a() { + var res: bool = all(true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_353d6a(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_353d6a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_353d6a(); +} diff --git a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47ffe9f5e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void all_353d6a() { + bool res = all(true); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_353d6a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_353d6a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_353d6a(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..47ffe9f5e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void all_353d6a() { + bool res = all(true); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_353d6a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_353d6a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_353d6a(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.glsl new file mode 100644 index 0000000000..72817235cc --- /dev/null +++ b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void all_353d6a() { + bool res = true; +} + +vec4 vertex_main() { + all_353d6a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_353d6a() { + bool res = true; +} + +void fragment_main() { + all_353d6a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_353d6a() { + bool res = true; +} + +void compute_main() { + all_353d6a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.msl b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.msl new file mode 100644 index 0000000000..d661e0c530 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void all_353d6a() { + bool res = all(true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_353d6a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_353d6a(); + return; +} + +kernel void compute_main() { + all_353d6a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.spvasm new file mode 100644 index 0000000000..ce7b6fe9d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_353d6a "all_353d6a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_353d6a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_bool Function %18 + OpStore %res %true + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %all_353d6a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %all_353d6a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %all_353d6a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3632e24aa --- /dev/null +++ b/test/tint/builtins/gen/literal/all/353d6a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn all_353d6a() { + var res : bool = all(true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_353d6a(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_353d6a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_353d6a(); +} diff --git a/test/tint/builtins/gen/literal/all/986c7b.wgsl b/test/tint/builtins/gen/literal/all/986c7b.wgsl new file mode 100644 index 0000000000..ba12253efa --- /dev/null +++ b/test/tint/builtins/gen/literal/all/986c7b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(vec<4, bool>) -> bool +fn all_986c7b() { + var res: bool = all(vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_986c7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_986c7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_986c7b(); +} diff --git a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d426a74362 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void all_986c7b() { + bool res = all((true).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_986c7b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_986c7b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_986c7b(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d426a74362 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void all_986c7b() { + bool res = all((true).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_986c7b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_986c7b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_986c7b(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.glsl new file mode 100644 index 0000000000..e8bd17d04b --- /dev/null +++ b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void all_986c7b() { + bool res = all(bvec4(true)); +} + +vec4 vertex_main() { + all_986c7b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_986c7b() { + bool res = all(bvec4(true)); +} + +void fragment_main() { + all_986c7b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_986c7b() { + bool res = all(bvec4(true)); +} + +void compute_main() { + all_986c7b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.msl b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.msl new file mode 100644 index 0000000000..6465c14724 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void all_986c7b() { + bool res = all(bool4(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_986c7b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_986c7b(); + return; +} + +kernel void compute_main() { + all_986c7b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.spvasm new file mode 100644 index 0000000000..1a1b1c594c --- /dev/null +++ b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_986c7b "all_986c7b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_986c7b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_bool Function %20 + %13 = OpAll %bool %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %all_986c7b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %all_986c7b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %all_986c7b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f9b0cbec19 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/986c7b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn all_986c7b() { + var res : bool = all(vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_986c7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_986c7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_986c7b(); +} diff --git a/test/tint/builtins/gen/literal/all/bd2dba.wgsl b/test/tint/builtins/gen/literal/all/bd2dba.wgsl new file mode 100644 index 0000000000..bcd6e05ec2 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/bd2dba.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(vec<3, bool>) -> bool +fn all_bd2dba() { + var res: bool = all(vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_bd2dba(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_bd2dba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_bd2dba(); +} diff --git a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3b9e55e2ab --- /dev/null +++ b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void all_bd2dba() { + bool res = all((true).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_bd2dba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_bd2dba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_bd2dba(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3b9e55e2ab --- /dev/null +++ b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void all_bd2dba() { + bool res = all((true).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_bd2dba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_bd2dba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_bd2dba(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.glsl new file mode 100644 index 0000000000..d37d4a8c6f --- /dev/null +++ b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void all_bd2dba() { + bool res = all(bvec3(true)); +} + +vec4 vertex_main() { + all_bd2dba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_bd2dba() { + bool res = all(bvec3(true)); +} + +void fragment_main() { + all_bd2dba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_bd2dba() { + bool res = all(bvec3(true)); +} + +void compute_main() { + all_bd2dba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.msl b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.msl new file mode 100644 index 0000000000..49413efbdc --- /dev/null +++ b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void all_bd2dba() { + bool res = all(bool3(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_bd2dba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_bd2dba(); + return; +} + +kernel void compute_main() { + all_bd2dba(); + return; +} + diff --git a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d82b87f56 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_bd2dba "all_bd2dba" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_bd2dba = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_bool Function %20 + %13 = OpAll %bool %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %all_bd2dba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %all_bd2dba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %all_bd2dba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.wgsl new file mode 100644 index 0000000000..8a12e5123e --- /dev/null +++ b/test/tint/builtins/gen/literal/all/bd2dba.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn all_bd2dba() { + var res : bool = all(vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_bd2dba(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_bd2dba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_bd2dba(); +} diff --git a/test/tint/builtins/gen/literal/all/f46790.wgsl b/test/tint/builtins/gen/literal/all/f46790.wgsl new file mode 100644 index 0000000000..0dbdd3c1e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/f46790.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(vec<2, bool>) -> bool +fn all_f46790() { + var res: bool = all(vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_f46790(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_f46790(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_f46790(); +} diff --git a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..edc68272aa --- /dev/null +++ b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void all_f46790() { + bool res = all((true).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_f46790(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_f46790(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_f46790(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..edc68272aa --- /dev/null +++ b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void all_f46790() { + bool res = all((true).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_f46790(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_f46790(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_f46790(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.glsl b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.glsl new file mode 100644 index 0000000000..2a50d2b25c --- /dev/null +++ b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void all_f46790() { + bool res = all(bvec2(true)); +} + +vec4 vertex_main() { + all_f46790(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_f46790() { + bool res = all(bvec2(true)); +} + +void fragment_main() { + all_f46790(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_f46790() { + bool res = all(bvec2(true)); +} + +void compute_main() { + all_f46790(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.msl b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.msl new file mode 100644 index 0000000000..71d9104c41 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void all_f46790() { + bool res = all(bool2(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_f46790(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_f46790(); + return; +} + +kernel void compute_main() { + all_f46790(); + return; +} + diff --git a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.spvasm new file mode 100644 index 0000000000..e9e5bbdd78 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_f46790 "all_f46790" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v2bool %true %true +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_f46790 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_bool Function %20 + %13 = OpAll %bool %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %all_f46790 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %all_f46790 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %all_f46790 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.wgsl new file mode 100644 index 0000000000..71a4a0bd73 --- /dev/null +++ b/test/tint/builtins/gen/literal/all/f46790.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn all_f46790() { + var res : bool = all(vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_f46790(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_f46790(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_f46790(); +} diff --git a/test/tint/builtins/gen/literal/any/083428.wgsl b/test/tint/builtins/gen/literal/any/083428.wgsl new file mode 100644 index 0000000000..bd2a46d8a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/083428.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(vec<4, bool>) -> bool +fn any_083428() { + var res: bool = any(vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_083428(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_083428(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_083428(); +} diff --git a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..48b53a0e8f --- /dev/null +++ b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void any_083428() { + bool res = any((true).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_083428(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_083428(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_083428(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..48b53a0e8f --- /dev/null +++ b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void any_083428() { + bool res = any((true).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_083428(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_083428(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_083428(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.glsl b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.glsl new file mode 100644 index 0000000000..d18e34ebe5 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void any_083428() { + bool res = any(bvec4(true)); +} + +vec4 vertex_main() { + any_083428(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_083428() { + bool res = any(bvec4(true)); +} + +void fragment_main() { + any_083428(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_083428() { + bool res = any(bvec4(true)); +} + +void compute_main() { + any_083428(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.msl b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.msl new file mode 100644 index 0000000000..cd3b74ad4f --- /dev/null +++ b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void any_083428() { + bool res = any(bool4(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_083428(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_083428(); + return; +} + +kernel void compute_main() { + any_083428(); + return; +} + diff --git a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.spvasm new file mode 100644 index 0000000000..f098cb3aaf --- /dev/null +++ b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_083428 "any_083428" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_083428 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_bool Function %20 + %13 = OpAny %bool %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %any_083428 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %any_083428 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %any_083428 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/any/083428.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.wgsl new file mode 100644 index 0000000000..c569341f3c --- /dev/null +++ b/test/tint/builtins/gen/literal/any/083428.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn any_083428() { + var res : bool = any(vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_083428(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_083428(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_083428(); +} diff --git a/test/tint/builtins/gen/literal/any/0e3e58.wgsl b/test/tint/builtins/gen/literal/any/0e3e58.wgsl new file mode 100644 index 0000000000..056bd212fd --- /dev/null +++ b/test/tint/builtins/gen/literal/any/0e3e58.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(vec<2, bool>) -> bool +fn any_0e3e58() { + var res: bool = any(vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_0e3e58(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_0e3e58(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_0e3e58(); +} diff --git a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..87779eb50f --- /dev/null +++ b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void any_0e3e58() { + bool res = any((true).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_0e3e58(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_0e3e58(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_0e3e58(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87779eb50f --- /dev/null +++ b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void any_0e3e58() { + bool res = any((true).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_0e3e58(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_0e3e58(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_0e3e58(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.glsl b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.glsl new file mode 100644 index 0000000000..c7d2258c14 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void any_0e3e58() { + bool res = any(bvec2(true)); +} + +vec4 vertex_main() { + any_0e3e58(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_0e3e58() { + bool res = any(bvec2(true)); +} + +void fragment_main() { + any_0e3e58(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_0e3e58() { + bool res = any(bvec2(true)); +} + +void compute_main() { + any_0e3e58(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.msl b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.msl new file mode 100644 index 0000000000..6a25f46119 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void any_0e3e58() { + bool res = any(bool2(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_0e3e58(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_0e3e58(); + return; +} + +kernel void compute_main() { + any_0e3e58(); + return; +} + diff --git a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.spvasm new file mode 100644 index 0000000000..13d694bf06 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_0e3e58 "any_0e3e58" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v2bool %true %true +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_0e3e58 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_bool Function %20 + %13 = OpAny %bool %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %any_0e3e58 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %any_0e3e58 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %any_0e3e58 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.wgsl new file mode 100644 index 0000000000..79a3155deb --- /dev/null +++ b/test/tint/builtins/gen/literal/any/0e3e58.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn any_0e3e58() { + var res : bool = any(vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_0e3e58(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_0e3e58(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_0e3e58(); +} diff --git a/test/tint/builtins/gen/literal/any/2ab91a.wgsl b/test/tint/builtins/gen/literal/any/2ab91a.wgsl new file mode 100644 index 0000000000..52d82a95ef --- /dev/null +++ b/test/tint/builtins/gen/literal/any/2ab91a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(bool) -> bool +fn any_2ab91a() { + var res: bool = any(true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_2ab91a(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_2ab91a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_2ab91a(); +} diff --git a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f2427bd15 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void any_2ab91a() { + bool res = any(true); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_2ab91a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_2ab91a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_2ab91a(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f2427bd15 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void any_2ab91a() { + bool res = any(true); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_2ab91a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_2ab91a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_2ab91a(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.glsl new file mode 100644 index 0000000000..cdd5b69b0e --- /dev/null +++ b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void any_2ab91a() { + bool res = true; +} + +vec4 vertex_main() { + any_2ab91a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_2ab91a() { + bool res = true; +} + +void fragment_main() { + any_2ab91a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_2ab91a() { + bool res = true; +} + +void compute_main() { + any_2ab91a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.msl b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.msl new file mode 100644 index 0000000000..5eaba911ac --- /dev/null +++ b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void any_2ab91a() { + bool res = any(true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_2ab91a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_2ab91a(); + return; +} + +kernel void compute_main() { + any_2ab91a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.spvasm new file mode 100644 index 0000000000..29c1dbc9fa --- /dev/null +++ b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_2ab91a "any_2ab91a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_2ab91a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_bool Function %18 + OpStore %res %true + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %any_2ab91a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %any_2ab91a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %any_2ab91a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b27b89969 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/2ab91a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn any_2ab91a() { + var res : bool = any(true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_2ab91a(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_2ab91a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_2ab91a(); +} diff --git a/test/tint/builtins/gen/literal/any/e755c1.wgsl b/test/tint/builtins/gen/literal/any/e755c1.wgsl new file mode 100644 index 0000000000..189ee8bede --- /dev/null +++ b/test/tint/builtins/gen/literal/any/e755c1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(vec<3, bool>) -> bool +fn any_e755c1() { + var res: bool = any(vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_e755c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_e755c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_e755c1(); +} diff --git a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4a502e9852 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void any_e755c1() { + bool res = any((true).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_e755c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_e755c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_e755c1(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4a502e9852 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void any_e755c1() { + bool res = any((true).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_e755c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_e755c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_e755c1(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.glsl new file mode 100644 index 0000000000..2ac492b97c --- /dev/null +++ b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void any_e755c1() { + bool res = any(bvec3(true)); +} + +vec4 vertex_main() { + any_e755c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_e755c1() { + bool res = any(bvec3(true)); +} + +void fragment_main() { + any_e755c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_e755c1() { + bool res = any(bvec3(true)); +} + +void compute_main() { + any_e755c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.msl b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.msl new file mode 100644 index 0000000000..5f3737326b --- /dev/null +++ b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void any_e755c1() { + bool res = any(bool3(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_e755c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_e755c1(); + return; +} + +kernel void compute_main() { + any_e755c1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..8322df97e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_e755c1 "any_e755c1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_e755c1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_bool Function %20 + %13 = OpAny %bool %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %any_e755c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %any_e755c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %any_e755c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..228cc320cc --- /dev/null +++ b/test/tint/builtins/gen/literal/any/e755c1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn any_e755c1() { + var res : bool = any(vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_e755c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_e755c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_e755c1(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl new file mode 100644 index 0000000000..66f7357ede --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_1588cd() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_1588cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_1588cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_1588cd(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fabbad5078 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_1588cd() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_1588cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_1588cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_1588cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fabbad5078 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_1588cd() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_1588cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_1588cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_1588cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.glsl new file mode 100644 index 0000000000..a143e1835e --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + int arg_0[]; +} sb_ro; +void arrayLength_1588cd() { + uint res = uint(sb_ro.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_1588cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 1, std430) buffer SB_RO_1 { + int arg_0[]; +} sb_ro; +void arrayLength_1588cd() { + uint res = uint(sb_ro.arg_0.length()); +} + +void fragment_main() { + arrayLength_1588cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + int arg_0[]; +} sb_ro; +void arrayLength_1588cd() { + uint res = uint(sb_ro.arg_0.length()); +} + +void compute_main() { + arrayLength_1588cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.msl new file mode 100644 index 0000000000..8f9b20980c --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RO { + tint_array arg_0; +}; + +void arrayLength_1588cd(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_1588cd(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_1588cd(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_1588cd(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/arrayLength/1588cd.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..8b3b166c5c --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/1588cd.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RO { + arg_0 : array, +} + +@group(0) @binding(1) var sb_ro : SB_RO; + +fn arrayLength_1588cd() { + var res : u32 = arrayLength(&(sb_ro.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_1588cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_1588cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_1588cd(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl new file mode 100644 index 0000000000..1c2902abc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_61b1c7() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_61b1c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_61b1c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_61b1c7(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ba47339e36 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_61b1c7() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_61b1c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_61b1c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_61b1c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba47339e36 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_61b1c7() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_61b1c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_61b1c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_61b1c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.glsl new file mode 100644 index 0000000000..46667de5c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0[]; +} sb_rw; +void arrayLength_61b1c7() { + uint res = uint(sb_rw.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_61b1c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0[]; +} sb_rw; +void arrayLength_61b1c7() { + uint res = uint(sb_rw.arg_0.length()); +} + +void fragment_main() { + arrayLength_61b1c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0[]; +} sb_rw; +void arrayLength_61b1c7() { + uint res = uint(sb_rw.arg_0.length()); +} + +void compute_main() { + arrayLength_61b1c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.msl new file mode 100644 index 0000000000..a0b71875e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RW { + tint_array arg_0; +}; + +void arrayLength_61b1c7(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_61b1c7(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_61b1c7(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_61b1c7(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/arrayLength/61b1c7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9b63ee4ad --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/61b1c7.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RW { + arg_0 : array, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn arrayLength_61b1c7() { + var res : u32 = arrayLength(&(sb_rw.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_61b1c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_61b1c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_61b1c7(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl new file mode 100644 index 0000000000..0a049481b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl @@ -0,0 +1,49 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_8421b9() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_8421b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_8421b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_8421b9(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.glsl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.glsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.msl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.msl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.spvasm @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..233c92b7db --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/8421b9.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/literal/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl new file mode 100644 index 0000000000..e6d4863d57 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_a0f5ca() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_a0f5ca(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_a0f5ca(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_a0f5ca(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cee7ff20e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_a0f5ca() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_a0f5ca(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_a0f5ca(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_a0f5ca(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cee7ff20e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_a0f5ca() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_a0f5ca(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_a0f5ca(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_a0f5ca(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.glsl new file mode 100644 index 0000000000..44aaf23ebf --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + float arg_0[]; +} sb_ro; +void arrayLength_a0f5ca() { + uint res = uint(sb_ro.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_a0f5ca(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 1, std430) buffer SB_RO_1 { + float arg_0[]; +} sb_ro; +void arrayLength_a0f5ca() { + uint res = uint(sb_ro.arg_0.length()); +} + +void fragment_main() { + arrayLength_a0f5ca(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + float arg_0[]; +} sb_ro; +void arrayLength_a0f5ca() { + uint res = uint(sb_ro.arg_0.length()); +} + +void compute_main() { + arrayLength_a0f5ca(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.msl new file mode 100644 index 0000000000..b0aba71531 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RO { + tint_array arg_0; +}; + +void arrayLength_a0f5ca(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_a0f5ca(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_a0f5ca(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_a0f5ca(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/arrayLength/a0f5ca.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa60a15aab --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/a0f5ca.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RO { + arg_0 : array, +} + +@group(0) @binding(1) var sb_ro : SB_RO; + +fn arrayLength_a0f5ca() { + var res : u32 = arrayLength(&(sb_ro.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_a0f5ca(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_a0f5ca(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_a0f5ca(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl new file mode 100644 index 0000000000..e457a8a489 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl @@ -0,0 +1,49 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_cbd6b5() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cbd6b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cbd6b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cbd6b5(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.glsl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.glsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.msl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.msl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.spvasm @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0a52531af --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cbd6b5.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/literal/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/literal/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl new file mode 100644 index 0000000000..c524ff6b4a --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_cdd123() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cdd123(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cdd123(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cdd123(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2156844065 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_cdd123() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cdd123(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cdd123(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cdd123(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2156844065 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_cdd123() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cdd123(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cdd123(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cdd123(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.glsl new file mode 100644 index 0000000000..dac4336dee --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + float arg_0[]; +} sb_rw; +void arrayLength_cdd123() { + uint res = uint(sb_rw.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_cdd123(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 0, std430) buffer SB_RW_1 { + float arg_0[]; +} sb_rw; +void arrayLength_cdd123() { + uint res = uint(sb_rw.arg_0.length()); +} + +void fragment_main() { + arrayLength_cdd123(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + float arg_0[]; +} sb_rw; +void arrayLength_cdd123() { + uint res = uint(sb_rw.arg_0.length()); +} + +void compute_main() { + arrayLength_cdd123(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.msl new file mode 100644 index 0000000000..b7fe50be17 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RW { + tint_array arg_0; +}; + +void arrayLength_cdd123(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_cdd123(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_cdd123(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_cdd123(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/arrayLength/cdd123.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.wgsl new file mode 100644 index 0000000000..d792619112 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cdd123.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RW { + arg_0 : array, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn arrayLength_cdd123() { + var res : u32 = arrayLength(&(sb_rw.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cdd123(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cdd123(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cdd123(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl new file mode 100644 index 0000000000..9581e2e47c --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_cfca0a() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cfca0a(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cfca0a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cfca0a(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6cf72ccdb --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_cfca0a() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cfca0a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cfca0a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cfca0a(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6cf72ccdb --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_cfca0a() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cfca0a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cfca0a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cfca0a(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.glsl new file mode 100644 index 0000000000..e159befc7e --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + uint arg_0[]; +} sb_ro; +void arrayLength_cfca0a() { + uint res = uint(sb_ro.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_cfca0a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 1, std430) buffer SB_RO_1 { + uint arg_0[]; +} sb_ro; +void arrayLength_cfca0a() { + uint res = uint(sb_ro.arg_0.length()); +} + +void fragment_main() { + arrayLength_cfca0a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + uint arg_0[]; +} sb_ro; +void arrayLength_cfca0a() { + uint res = uint(sb_ro.arg_0.length()); +} + +void compute_main() { + arrayLength_cfca0a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.msl new file mode 100644 index 0000000000..f62106e376 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RO { + tint_array arg_0; +}; + +void arrayLength_cfca0a(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_cfca0a(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_cfca0a(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_cfca0a(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/arrayLength/cfca0a.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.wgsl new file mode 100644 index 0000000000..d741ef0924 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/cfca0a.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RO { + arg_0 : array, +} + +@group(0) @binding(1) var sb_ro : SB_RO; + +fn arrayLength_cfca0a() { + var res : u32 = arrayLength(&(sb_ro.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cfca0a(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cfca0a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cfca0a(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl new file mode 100644 index 0000000000..5c2eca0aa4 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_eb510f() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_eb510f(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_eb510f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_eb510f(); +} diff --git a/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b05a0fc83 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_eb510f() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_eb510f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_eb510f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_eb510f(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b05a0fc83 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_eb510f() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_eb510f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_eb510f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_eb510f(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.glsl new file mode 100644 index 0000000000..a11f1aa674 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0[]; +} sb_rw; +void arrayLength_eb510f() { + uint res = uint(sb_rw.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_eb510f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0[]; +} sb_rw; +void arrayLength_eb510f() { + uint res = uint(sb_rw.arg_0.length()); +} + +void fragment_main() { + arrayLength_eb510f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0[]; +} sb_rw; +void arrayLength_eb510f() { + uint res = uint(sb_rw.arg_0.length()); +} + +void compute_main() { + arrayLength_eb510f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.msl b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.msl new file mode 100644 index 0000000000..05c3bc9710 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RW { + tint_array arg_0; +}; + +void arrayLength_eb510f(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_eb510f(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_eb510f(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_eb510f(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/arrayLength/eb510f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.wgsl new file mode 100644 index 0000000000..a048944656 --- /dev/null +++ b/test/tint/builtins/gen/literal/arrayLength/eb510f.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RW { + arg_0 : array, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn arrayLength_eb510f() { + var res : u32 = arrayLength(&(sb_rw.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_eb510f(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_eb510f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_eb510f(); +} diff --git a/test/tint/builtins/gen/literal/asin/064953.wgsl b/test/tint/builtins/gen/literal/asin/064953.wgsl new file mode 100644 index 0000000000..46e87dd277 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/064953.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(vec<4, f32>) -> vec<4, f32> +fn asin_064953() { + var res: vec4 = asin(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_064953(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_064953(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_064953(); +} diff --git a/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f0e625ef4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_064953() { + float4 res = asin((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_064953(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_064953(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_064953(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2f0e625ef4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void asin_064953() { + float4 res = asin((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_064953(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_064953(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_064953(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.glsl new file mode 100644 index 0000000000..6e901b78b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void asin_064953() { + vec4 res = asin(vec4(1.0f)); +} + +vec4 vertex_main() { + asin_064953(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_064953() { + vec4 res = asin(vec4(1.0f)); +} + +void fragment_main() { + asin_064953(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_064953() { + vec4 res = asin(vec4(1.0f)); +} + +void compute_main() { + asin_064953(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.msl new file mode 100644 index 0000000000..6d44ff4bdc --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_064953() { + float4 res = asin(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_064953(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_064953(); + return; +} + +kernel void compute_main() { + asin_064953(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.spvasm new file mode 100644 index 0000000000..22d29e1046 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_064953 "asin_064953" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%asin_064953 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Asin %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %asin_064953 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %asin_064953 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %asin_064953 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.wgsl new file mode 100644 index 0000000000..319b1fca53 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/064953.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn asin_064953() { + var res : vec4 = asin(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_064953(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_064953(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_064953(); +} diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl new file mode 100644 index 0000000000..83b5763b66 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(f16) -> f16 +fn asin_11dfda() { + var res: f16 = asin(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_11dfda(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_11dfda(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_11dfda(); +} diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9ae29ab07 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_11dfda() { + float16_t res = asin(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_11dfda(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_11dfda(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6aa1fc839 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void asin_11dfda() { + float16_t res = asin(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_11dfda(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_11dfda(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA9E277D20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA9E277D20(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.glsl new file mode 100644 index 0000000000..798e3f8695 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_11dfda() { + float16_t res = asin(0.0hf); +} + +vec4 vertex_main() { + asin_11dfda(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_11dfda() { + float16_t res = asin(0.0hf); +} + +void fragment_main() { + asin_11dfda(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_11dfda() { + float16_t res = asin(0.0hf); +} + +void compute_main() { + asin_11dfda(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.msl new file mode 100644 index 0000000000..6db79bec8a --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_11dfda() { + half res = asin(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_11dfda(); + return; +} + +kernel void compute_main() { + asin_11dfda(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.spvasm new file mode 100644 index 0000000000..27644d34c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_11dfda "asin_11dfda" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_11dfda = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Asin %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %asin_11dfda + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %asin_11dfda + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_11dfda + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1b597675e --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/11dfda.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asin_11dfda() { + var res : f16 = asin(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_11dfda(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_11dfda(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_11dfda(); +} diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl new file mode 100644 index 0000000000..d21bfd5e28 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<3, f16>) -> vec<3, f16> +fn asin_2d8e29() { + var res: vec3 = asin(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_2d8e29(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_2d8e29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_2d8e29(); +} diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52b2e05043 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_2d8e29() { + vector res = asin((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_2d8e29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_2d8e29(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..30780229de --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void asin_2d8e29() { + vector res = asin((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_2d8e29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_2d8e29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000140BC7EE140(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.glsl new file mode 100644 index 0000000000..fb569f6e5a --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_2d8e29() { + f16vec3 res = asin(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + asin_2d8e29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_2d8e29() { + f16vec3 res = asin(f16vec3(0.0hf)); +} + +void fragment_main() { + asin_2d8e29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_2d8e29() { + f16vec3 res = asin(f16vec3(0.0hf)); +} + +void compute_main() { + asin_2d8e29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.msl new file mode 100644 index 0000000000..708107ed23 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_2d8e29() { + half3 res = asin(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_2d8e29(); + return; +} + +kernel void compute_main() { + asin_2d8e29(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.spvasm new file mode 100644 index 0000000000..1f23d53ff6 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_2d8e29 "asin_2d8e29" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_2d8e29 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Asin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asin_2d8e29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asin_2d8e29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asin_2d8e29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.wgsl new file mode 100644 index 0000000000..2f97bd2eba --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/2d8e29.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asin_2d8e29() { + var res : vec3 = asin(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_2d8e29(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_2d8e29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_2d8e29(); +} diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl new file mode 100644 index 0000000000..44991ef243 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<4, f16>) -> vec<4, f16> +fn asin_3cfbd4() { + var res: vec4 = asin(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_3cfbd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_3cfbd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_3cfbd4(); +} diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..361aec897e --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_3cfbd4() { + vector res = asin((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_3cfbd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_3cfbd4(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d868fa128 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void asin_3cfbd4() { + vector res = asin((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_3cfbd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_3cfbd4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022B4BDC88B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.glsl new file mode 100644 index 0000000000..1ce2ff2932 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_3cfbd4() { + f16vec4 res = asin(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + asin_3cfbd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_3cfbd4() { + f16vec4 res = asin(f16vec4(0.0hf)); +} + +void fragment_main() { + asin_3cfbd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_3cfbd4() { + f16vec4 res = asin(f16vec4(0.0hf)); +} + +void compute_main() { + asin_3cfbd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.msl new file mode 100644 index 0000000000..d06d2eeb96 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_3cfbd4() { + half4 res = asin(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_3cfbd4(); + return; +} + +kernel void compute_main() { + asin_3cfbd4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..bdbb112bff --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_3cfbd4 "asin_3cfbd4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_3cfbd4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Asin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asin_3cfbd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asin_3cfbd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asin_3cfbd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..63c66a16f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/3cfbd4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asin_3cfbd4() { + var res : vec4 = asin(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_3cfbd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_3cfbd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_3cfbd4(); +} diff --git a/test/tint/builtins/gen/literal/asin/7b6a44.wgsl b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl new file mode 100644 index 0000000000..95988bb1bb --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(vec<2, f32>) -> vec<2, f32> +fn asin_7b6a44() { + var res: vec2 = asin(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_7b6a44(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_7b6a44(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_7b6a44(); +} diff --git a/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1320016593 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_7b6a44() { + float2 res = asin((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_7b6a44(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_7b6a44(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_7b6a44(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1320016593 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void asin_7b6a44() { + float2 res = asin((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_7b6a44(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_7b6a44(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_7b6a44(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.glsl new file mode 100644 index 0000000000..6502a341ae --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void asin_7b6a44() { + vec2 res = asin(vec2(1.0f)); +} + +vec4 vertex_main() { + asin_7b6a44(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_7b6a44() { + vec2 res = asin(vec2(1.0f)); +} + +void fragment_main() { + asin_7b6a44(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_7b6a44() { + vec2 res = asin(vec2(1.0f)); +} + +void compute_main() { + asin_7b6a44(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.msl new file mode 100644 index 0000000000..97216e5224 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_7b6a44() { + float2 res = asin(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_7b6a44(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_7b6a44(); + return; +} + +kernel void compute_main() { + asin_7b6a44(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.spvasm new file mode 100644 index 0000000000..20c033200a --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_7b6a44 "asin_7b6a44" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%asin_7b6a44 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Asin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asin_7b6a44 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asin_7b6a44 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asin_7b6a44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.wgsl new file mode 100644 index 0000000000..c1c0a65868 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/7b6a44.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn asin_7b6a44() { + var res : vec2 = asin(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_7b6a44(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_7b6a44(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_7b6a44(); +} diff --git a/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl new file mode 100644 index 0000000000..2ddafc176f --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(vec<3, f32>) -> vec<3, f32> +fn asin_8cd9c9() { + var res: vec3 = asin(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_8cd9c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_8cd9c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_8cd9c9(); +} diff --git a/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4527a339c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_8cd9c9() { + float3 res = asin((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_8cd9c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_8cd9c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_8cd9c9(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4527a339c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void asin_8cd9c9() { + float3 res = asin((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_8cd9c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_8cd9c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_8cd9c9(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.glsl new file mode 100644 index 0000000000..7b3565cfd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void asin_8cd9c9() { + vec3 res = asin(vec3(1.0f)); +} + +vec4 vertex_main() { + asin_8cd9c9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_8cd9c9() { + vec3 res = asin(vec3(1.0f)); +} + +void fragment_main() { + asin_8cd9c9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_8cd9c9() { + vec3 res = asin(vec3(1.0f)); +} + +void compute_main() { + asin_8cd9c9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.msl new file mode 100644 index 0000000000..9d5a38440b --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_8cd9c9() { + float3 res = asin(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_8cd9c9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_8cd9c9(); + return; +} + +kernel void compute_main() { + asin_8cd9c9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.spvasm new file mode 100644 index 0000000000..92319f2235 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_8cd9c9 "asin_8cd9c9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%asin_8cd9c9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Asin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asin_8cd9c9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asin_8cd9c9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asin_8cd9c9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.wgsl new file mode 100644 index 0000000000..5000fc053a --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/8cd9c9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn asin_8cd9c9() { + var res : vec3 = asin(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_8cd9c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_8cd9c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_8cd9c9(); +} diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl new file mode 100644 index 0000000000..591bac3948 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<2, f16>) -> vec<2, f16> +fn asin_b4aced() { + var res: vec2 = asin(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_b4aced(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_b4aced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_b4aced(); +} diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab5d6089ec --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_b4aced() { + vector res = asin((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_b4aced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_b4aced(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c17039a672 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void asin_b4aced() { + vector res = asin((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_b4aced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_b4aced(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000138E6B7E9E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.glsl new file mode 100644 index 0000000000..29e01f946c --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_b4aced() { + f16vec2 res = asin(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + asin_b4aced(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_b4aced() { + f16vec2 res = asin(f16vec2(0.0hf)); +} + +void fragment_main() { + asin_b4aced(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_b4aced() { + f16vec2 res = asin(f16vec2(0.0hf)); +} + +void compute_main() { + asin_b4aced(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.msl new file mode 100644 index 0000000000..81e1965701 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_b4aced() { + half2 res = asin(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_b4aced(); + return; +} + +kernel void compute_main() { + asin_b4aced(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.spvasm new file mode 100644 index 0000000000..2515d21823 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_b4aced "asin_b4aced" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_b4aced = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Asin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asin_b4aced + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asin_b4aced + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asin_b4aced + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.wgsl new file mode 100644 index 0000000000..545e7c403a --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/b4aced.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asin_b4aced() { + var res : vec2 = asin(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_b4aced(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_b4aced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_b4aced(); +} diff --git a/test/tint/builtins/gen/literal/asin/c0c272.wgsl b/test/tint/builtins/gen/literal/asin/c0c272.wgsl new file mode 100644 index 0000000000..c97c13f183 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/c0c272.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(f32) -> f32 +fn asin_c0c272() { + var res: f32 = asin(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_c0c272(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_c0c272(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_c0c272(); +} diff --git a/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b5d3eb53d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void asin_c0c272() { + float res = asin(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_c0c272(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_c0c272(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_c0c272(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b5d3eb53d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void asin_c0c272() { + float res = asin(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_c0c272(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_c0c272(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_c0c272(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.glsl new file mode 100644 index 0000000000..97564dcf18 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void asin_c0c272() { + float res = asin(1.0f); +} + +vec4 vertex_main() { + asin_c0c272(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_c0c272() { + float res = asin(1.0f); +} + +void fragment_main() { + asin_c0c272(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_c0c272() { + float res = asin(1.0f); +} + +void compute_main() { + asin_c0c272(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.msl b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.msl new file mode 100644 index 0000000000..df7148b2af --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asin_c0c272() { + float res = asin(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_c0c272(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_c0c272(); + return; +} + +kernel void compute_main() { + asin_c0c272(); + return; +} + diff --git a/test/tint/builtins/gen/asin/c0c272.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/asin/c0c272.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.wgsl new file mode 100644 index 0000000000..d7dc41ef17 --- /dev/null +++ b/test/tint/builtins/gen/literal/asin/c0c272.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn asin_c0c272() { + var res : f32 = asin(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_c0c272(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_c0c272(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_c0c272(); +} diff --git a/test/tint/builtins/gen/literal/asinh/157447.wgsl b/test/tint/builtins/gen/literal/asinh/157447.wgsl new file mode 100644 index 0000000000..c184295c6a --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/157447.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asinh(f32) -> f32 +fn asinh_157447() { + var res: f32 = asinh(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_157447(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_157447(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_157447(); +} diff --git a/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..597974753f --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float tint_sinh(float x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_157447() { + float res = tint_sinh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_157447(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_157447(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_157447(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..597974753f --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float tint_sinh(float x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_157447() { + float res = tint_sinh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_157447(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_157447(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_157447(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.glsl new file mode 100644 index 0000000000..1f8667dd48 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void asinh_157447() { + float res = asinh(1.0f); +} + +vec4 vertex_main() { + asinh_157447(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asinh_157447() { + float res = asinh(1.0f); +} + +void fragment_main() { + asinh_157447(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asinh_157447() { + float res = asinh(1.0f); +} + +void compute_main() { + asinh_157447(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.msl new file mode 100644 index 0000000000..0ce8a33de3 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_157447() { + float res = asinh(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_157447(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_157447(); + return; +} + +kernel void compute_main() { + asinh_157447(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.spvasm new file mode 100644 index 0000000000..e82d19aca3 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_157447 "asinh_157447" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %v4float +%asinh_157447 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Asinh %float_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %asinh_157447 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %void %asinh_157447 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_157447 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.wgsl new file mode 100644 index 0000000000..eef4f77eec --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/157447.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn asinh_157447() { + var res : f32 = asinh(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_157447(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_157447(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_157447(); +} diff --git a/test/tint/builtins/gen/literal/asinh/2265ee.wgsl b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl new file mode 100644 index 0000000000..ccf03d383b --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asinh(vec<3, f32>) -> vec<3, f32> +fn asinh_2265ee() { + var res: vec3 = asinh(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_2265ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_2265ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_2265ee(); +} diff --git a/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e5eaaee309 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_sinh(float3 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_2265ee() { + float3 res = tint_sinh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_2265ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_2265ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_2265ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5eaaee309 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_sinh(float3 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_2265ee() { + float3 res = tint_sinh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_2265ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_2265ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_2265ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.glsl new file mode 100644 index 0000000000..0ba85e1a27 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void asinh_2265ee() { + vec3 res = asinh(vec3(1.0f)); +} + +vec4 vertex_main() { + asinh_2265ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asinh_2265ee() { + vec3 res = asinh(vec3(1.0f)); +} + +void fragment_main() { + asinh_2265ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asinh_2265ee() { + vec3 res = asinh(vec3(1.0f)); +} + +void compute_main() { + asinh_2265ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.msl new file mode 100644 index 0000000000..22d9cb58a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_2265ee() { + float3 res = asinh(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_2265ee(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_2265ee(); + return; +} + +kernel void compute_main() { + asinh_2265ee(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..febe7eb638 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_2265ee "asinh_2265ee" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%asinh_2265ee = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Asinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asinh_2265ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_2265ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asinh_2265ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..a0961afb56 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/2265ee.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn asinh_2265ee() { + var res : vec3 = asinh(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_2265ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_2265ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_2265ee(); +} diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl new file mode 100644 index 0000000000..884a6b2ca0 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(f16) -> f16 +fn asinh_468a48() { + var res: f16 = asinh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_468a48(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_468a48(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_468a48(); +} diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..70800417b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_sinh(float16_t x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_468a48() { + float16_t res = tint_sinh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_468a48(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_468a48(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c76be3c900 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_sinh(float16_t x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_468a48() { + float16_t res = tint_sinh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_468a48(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_468a48(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024C0A8E8450(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.glsl new file mode 100644 index 0000000000..f688b6efc2 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_468a48() { + float16_t res = asinh(0.0hf); +} + +vec4 vertex_main() { + asinh_468a48(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_468a48() { + float16_t res = asinh(0.0hf); +} + +void fragment_main() { + asinh_468a48(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_468a48() { + float16_t res = asinh(0.0hf); +} + +void compute_main() { + asinh_468a48(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.msl new file mode 100644 index 0000000000..dab52827ee --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_468a48() { + half res = asinh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_468a48(); + return; +} + +kernel void compute_main() { + asinh_468a48(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b2056f062 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_468a48 "asinh_468a48" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_468a48 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Asinh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %asinh_468a48 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %asinh_468a48 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_468a48 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.wgsl new file mode 100644 index 0000000000..a546ede0fb --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/468a48.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asinh_468a48() { + var res : f16 = asinh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_468a48(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_468a48(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_468a48(); +} diff --git a/test/tint/builtins/gen/literal/asinh/4a2226.wgsl b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl new file mode 100644 index 0000000000..8ac4653d96 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asinh(vec<2, f32>) -> vec<2, f32> +fn asinh_4a2226() { + var res: vec2 = asinh(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_4a2226(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_4a2226(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_4a2226(); +} diff --git a/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..09e6588add --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_sinh(float2 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_4a2226() { + float2 res = tint_sinh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_4a2226(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_4a2226(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_4a2226(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..09e6588add --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_sinh(float2 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_4a2226() { + float2 res = tint_sinh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_4a2226(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_4a2226(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_4a2226(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.glsl new file mode 100644 index 0000000000..5e90c211e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void asinh_4a2226() { + vec2 res = asinh(vec2(1.0f)); +} + +vec4 vertex_main() { + asinh_4a2226(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asinh_4a2226() { + vec2 res = asinh(vec2(1.0f)); +} + +void fragment_main() { + asinh_4a2226(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asinh_4a2226() { + vec2 res = asinh(vec2(1.0f)); +} + +void compute_main() { + asinh_4a2226(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.msl new file mode 100644 index 0000000000..db1110d5e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_4a2226() { + float2 res = asinh(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_4a2226(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_4a2226(); + return; +} + +kernel void compute_main() { + asinh_4a2226(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5d74ca9bb --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_4a2226 "asinh_4a2226" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%asinh_4a2226 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Asinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asinh_4a2226 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_4a2226 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asinh_4a2226 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.wgsl new file mode 100644 index 0000000000..d4a07c101f --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/4a2226.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn asinh_4a2226() { + var res : vec2 = asinh(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_4a2226(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_4a2226(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_4a2226(); +} diff --git a/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl new file mode 100644 index 0000000000..6efc56a038 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asinh(vec<4, f32>) -> vec<4, f32> +fn asinh_8d2e51() { + var res: vec4 = asinh(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_8d2e51(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_8d2e51(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_8d2e51(); +} diff --git a/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b7a3794fa5 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_sinh(float4 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_8d2e51() { + float4 res = tint_sinh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_8d2e51(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_8d2e51(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_8d2e51(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b7a3794fa5 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_sinh(float4 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_8d2e51() { + float4 res = tint_sinh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_8d2e51(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_8d2e51(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_8d2e51(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.glsl new file mode 100644 index 0000000000..8e4482dd79 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void asinh_8d2e51() { + vec4 res = asinh(vec4(1.0f)); +} + +vec4 vertex_main() { + asinh_8d2e51(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asinh_8d2e51() { + vec4 res = asinh(vec4(1.0f)); +} + +void fragment_main() { + asinh_8d2e51(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asinh_8d2e51() { + vec4 res = asinh(vec4(1.0f)); +} + +void compute_main() { + asinh_8d2e51(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.msl new file mode 100644 index 0000000000..f0796b90c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_8d2e51() { + float4 res = asinh(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_8d2e51(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_8d2e51(); + return; +} + +kernel void compute_main() { + asinh_8d2e51(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.spvasm new file mode 100644 index 0000000000..4295aba050 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_8d2e51 "asinh_8d2e51" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%asinh_8d2e51 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Asinh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %asinh_8d2e51 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %asinh_8d2e51 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %asinh_8d2e51 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.wgsl new file mode 100644 index 0000000000..feeb8f5a89 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/8d2e51.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn asinh_8d2e51() { + var res : vec4 = asinh(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_8d2e51(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_8d2e51(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_8d2e51(); +} diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl new file mode 100644 index 0000000000..dfa3c2903c --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<4, f16>) -> vec<4, f16> +fn asinh_95ab2b() { + var res: vec4 = asinh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_95ab2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_95ab2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_95ab2b(); +} diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..05818ab377 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_95ab2b() { + vector res = tint_sinh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_95ab2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_95ab2b(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5bda99e05 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_95ab2b() { + vector res = tint_sinh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_95ab2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_95ab2b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017880279490(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.glsl new file mode 100644 index 0000000000..363fcf6dd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_95ab2b() { + f16vec4 res = asinh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + asinh_95ab2b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_95ab2b() { + f16vec4 res = asinh(f16vec4(0.0hf)); +} + +void fragment_main() { + asinh_95ab2b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_95ab2b() { + f16vec4 res = asinh(f16vec4(0.0hf)); +} + +void compute_main() { + asinh_95ab2b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.msl new file mode 100644 index 0000000000..cd7195cbf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_95ab2b() { + half4 res = asinh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_95ab2b(); + return; +} + +kernel void compute_main() { + asinh_95ab2b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.spvasm new file mode 100644 index 0000000000..53d1b94500 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_95ab2b "asinh_95ab2b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_95ab2b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Asinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asinh_95ab2b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_95ab2b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asinh_95ab2b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca02f94158 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/95ab2b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asinh_95ab2b() { + var res : vec4 = asinh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_95ab2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_95ab2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_95ab2b(); +} diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl new file mode 100644 index 0000000000..fa045bb3a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<2, f16>) -> vec<2, f16> +fn asinh_ad8f8b() { + var res: vec2 = asinh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_ad8f8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_ad8f8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_ad8f8b(); +} diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3a87d2d7e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_ad8f8b() { + vector res = tint_sinh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_ad8f8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_ad8f8b(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d46056e98c --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_ad8f8b() { + vector res = tint_sinh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_ad8f8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_ad8f8b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AC790D84D0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.glsl new file mode 100644 index 0000000000..1b02aa753e --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_ad8f8b() { + f16vec2 res = asinh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + asinh_ad8f8b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_ad8f8b() { + f16vec2 res = asinh(f16vec2(0.0hf)); +} + +void fragment_main() { + asinh_ad8f8b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_ad8f8b() { + f16vec2 res = asinh(f16vec2(0.0hf)); +} + +void compute_main() { + asinh_ad8f8b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.msl new file mode 100644 index 0000000000..257acf5209 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_ad8f8b() { + half2 res = asinh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_ad8f8b(); + return; +} + +kernel void compute_main() { + asinh_ad8f8b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.spvasm new file mode 100644 index 0000000000..af0d7e18eb --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_ad8f8b "asinh_ad8f8b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_ad8f8b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Asinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asinh_ad8f8b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_ad8f8b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asinh_ad8f8b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.wgsl new file mode 100644 index 0000000000..3bd274ef3b --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/ad8f8b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asinh_ad8f8b() { + var res : vec2 = asinh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_ad8f8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_ad8f8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_ad8f8b(); +} diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl new file mode 100644 index 0000000000..67d2c9d3d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<3, f16>) -> vec<3, f16> +fn asinh_fb5e8c() { + var res: vec3 = asinh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_fb5e8c(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_fb5e8c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_fb5e8c(); +} diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..920c90e861 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_fb5e8c() { + vector res = tint_sinh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_fb5e8c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_fb5e8c(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d67e924e3f --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_fb5e8c() { + vector res = tint_sinh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_fb5e8c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_fb5e8c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E444F93560(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.glsl new file mode 100644 index 0000000000..d489bf4822 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_fb5e8c() { + f16vec3 res = asinh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + asinh_fb5e8c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_fb5e8c() { + f16vec3 res = asinh(f16vec3(0.0hf)); +} + +void fragment_main() { + asinh_fb5e8c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_fb5e8c() { + f16vec3 res = asinh(f16vec3(0.0hf)); +} + +void compute_main() { + asinh_fb5e8c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.msl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.msl new file mode 100644 index 0000000000..3ff85f763e --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void asinh_fb5e8c() { + half3 res = asinh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_fb5e8c(); + return; +} + +kernel void compute_main() { + asinh_fb5e8c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.spvasm new file mode 100644 index 0000000000..99ab3bac51 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_fb5e8c "asinh_fb5e8c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_fb5e8c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Asinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asinh_fb5e8c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_fb5e8c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asinh_fb5e8c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.wgsl new file mode 100644 index 0000000000..953a9d1238 --- /dev/null +++ b/test/tint/builtins/gen/literal/asinh/fb5e8c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn asinh_fb5e8c() { + var res : vec3 = asinh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_fb5e8c(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_fb5e8c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_fb5e8c(); +} diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl b/test/tint/builtins/gen/literal/atan/02979a.wgsl new file mode 100644 index 0000000000..b0d5c0f126 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(f32) -> f32 +fn atan_02979a() { + var res: f32 = atan(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_02979a(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_02979a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_02979a(); +} diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ef60d4a98 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_02979a() { + float res = atan(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_02979a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_02979a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_02979a(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ef60d4a98 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan_02979a() { + float res = atan(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_02979a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_02979a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_02979a(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.glsl new file mode 100644 index 0000000000..ba9c6a0142 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan_02979a() { + float res = atan(1.0f); +} + +vec4 vertex_main() { + atan_02979a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_02979a() { + float res = atan(1.0f); +} + +void fragment_main() { + atan_02979a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_02979a() { + float res = atan(1.0f); +} + +void compute_main() { + atan_02979a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.msl new file mode 100644 index 0000000000..a4b9181605 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_02979a() { + float res = atan(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_02979a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_02979a(); + return; +} + +kernel void compute_main() { + atan_02979a(); + return; +} + diff --git a/test/tint/builtins/gen/atan/02979a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/atan/02979a.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.wgsl new file mode 100644 index 0000000000..b96a3dac8a --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan_02979a() { + var res : f32 = atan(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_02979a(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_02979a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_02979a(); +} diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl new file mode 100644 index 0000000000..250ddc50d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<4, f16>) -> vec<4, f16> +fn atan_19faea() { + var res: vec4 = atan(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_19faea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_19faea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_19faea(); +} diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32017a8891 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_19faea() { + vector res = atan((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_19faea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_19faea(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32fb21e254 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan_19faea() { + vector res = atan((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_19faea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_19faea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002329F308C50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl new file mode 100644 index 0000000000..13299d81e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_19faea() { + f16vec4 res = atan(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + atan_19faea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_19faea() { + f16vec4 res = atan(f16vec4(0.0hf)); +} + +void fragment_main() { + atan_19faea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_19faea() { + f16vec4 res = atan(f16vec4(0.0hf)); +} + +void compute_main() { + atan_19faea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl new file mode 100644 index 0000000000..a52ea2c590 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_19faea() { + half4 res = atan(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_19faea(); + return; +} + +kernel void compute_main() { + atan_19faea(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm new file mode 100644 index 0000000000..38b784b345 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_19faea "atan_19faea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_19faea = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Atan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %atan_19faea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan_19faea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan_19faea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.wgsl new file mode 100644 index 0000000000..ecac9552a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan_19faea() { + var res : vec4 = atan(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_19faea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_19faea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_19faea(); +} diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl new file mode 100644 index 0000000000..013ab6e285 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<2, f16>) -> vec<2, f16> +fn atan_1e1764() { + var res: vec2 = atan(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_1e1764(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_1e1764(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_1e1764(); +} diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a1e7df0083 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_1e1764() { + vector res = atan((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_1e1764(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_1e1764(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..98c9ee9499 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan_1e1764() { + vector res = atan((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_1e1764(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_1e1764(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C856E61160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl new file mode 100644 index 0000000000..5e93d9ab63 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_1e1764() { + f16vec2 res = atan(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + atan_1e1764(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_1e1764() { + f16vec2 res = atan(f16vec2(0.0hf)); +} + +void fragment_main() { + atan_1e1764(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_1e1764() { + f16vec2 res = atan(f16vec2(0.0hf)); +} + +void compute_main() { + atan_1e1764(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl new file mode 100644 index 0000000000..e16428d9ed --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_1e1764() { + half2 res = atan(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_1e1764(); + return; +} + +kernel void compute_main() { + atan_1e1764(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7715a72a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_1e1764 "atan_1e1764" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_1e1764 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Atan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %atan_1e1764 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan_1e1764 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan_1e1764 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.wgsl new file mode 100644 index 0000000000..8278671c33 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan_1e1764() { + var res : vec2 = atan(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_1e1764(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_1e1764(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_1e1764(); +} diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl new file mode 100644 index 0000000000..1d3b8a3c87 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(vec<3, f32>) -> vec<3, f32> +fn atan_331e6d() { + var res: vec3 = atan(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_331e6d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_331e6d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_331e6d(); +} diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..14fc1787ec --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_331e6d() { + float3 res = atan((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_331e6d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_331e6d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_331e6d(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..14fc1787ec --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan_331e6d() { + float3 res = atan((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_331e6d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_331e6d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_331e6d(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.glsl new file mode 100644 index 0000000000..373702b54d --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan_331e6d() { + vec3 res = atan(vec3(1.0f)); +} + +vec4 vertex_main() { + atan_331e6d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_331e6d() { + vec3 res = atan(vec3(1.0f)); +} + +void fragment_main() { + atan_331e6d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_331e6d() { + vec3 res = atan(vec3(1.0f)); +} + +void compute_main() { + atan_331e6d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.msl new file mode 100644 index 0000000000..a05319cac1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_331e6d() { + float3 res = atan(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_331e6d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_331e6d(); + return; +} + +kernel void compute_main() { + atan_331e6d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.spvasm new file mode 100644 index 0000000000..186619cfbc --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_331e6d "atan_331e6d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%atan_331e6d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Atan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %atan_331e6d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan_331e6d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan_331e6d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed2fba12a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan_331e6d() { + var res : vec3 = atan(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_331e6d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_331e6d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_331e6d(); +} diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl new file mode 100644 index 0000000000..766fcb3958 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<3, f16>) -> vec<3, f16> +fn atan_a5f421() { + var res: vec3 = atan(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a5f421(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a5f421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a5f421(); +} diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3e5b84f7f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_a5f421() { + vector res = atan((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a5f421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a5f421(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..338d894442 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan_a5f421() { + vector res = atan((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a5f421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a5f421(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000186B9618C70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl new file mode 100644 index 0000000000..6d93eef6a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a5f421() { + f16vec3 res = atan(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + atan_a5f421(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_a5f421() { + f16vec3 res = atan(f16vec3(0.0hf)); +} + +void fragment_main() { + atan_a5f421(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a5f421() { + f16vec3 res = atan(f16vec3(0.0hf)); +} + +void compute_main() { + atan_a5f421(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl new file mode 100644 index 0000000000..66c582a3fb --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_a5f421() { + half3 res = atan(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a5f421(); + return; +} + +kernel void compute_main() { + atan_a5f421(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm new file mode 100644 index 0000000000..fa62fa23f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a5f421 "atan_a5f421" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_a5f421 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Atan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %atan_a5f421 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan_a5f421 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan_a5f421 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.wgsl new file mode 100644 index 0000000000..356793ca07 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan_a5f421() { + var res : vec3 = atan(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a5f421(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a5f421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a5f421(); +} diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl new file mode 100644 index 0000000000..9467660bb8 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(f16) -> f16 +fn atan_a7ba61() { + var res: f16 = atan(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a7ba61(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a7ba61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a7ba61(); +} diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b97a99c8ef --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_a7ba61() { + float16_t res = atan(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a7ba61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a7ba61(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5a9a51494 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void atan_a7ba61() { + float16_t res = atan(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a7ba61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a7ba61(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000211ADB21160(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000211ADB21160(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl new file mode 100644 index 0000000000..d2732b2208 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a7ba61() { + float16_t res = atan(0.0hf); +} + +vec4 vertex_main() { + atan_a7ba61(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_a7ba61() { + float16_t res = atan(0.0hf); +} + +void fragment_main() { + atan_a7ba61(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a7ba61() { + float16_t res = atan(0.0hf); +} + +void compute_main() { + atan_a7ba61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl new file mode 100644 index 0000000000..b225ca002e --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_a7ba61() { + half res = atan(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a7ba61(); + return; +} + +kernel void compute_main() { + atan_a7ba61(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm new file mode 100644 index 0000000000..45a9b3dd68 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a7ba61 "atan_a7ba61" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_a7ba61 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Atan %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan_a7ba61 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan_a7ba61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_a7ba61 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.wgsl new file mode 100644 index 0000000000..891c5e3e7a --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan_a7ba61() { + var res : f16 = atan(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a7ba61(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a7ba61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a7ba61(); +} diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl new file mode 100644 index 0000000000..0a910aabaa --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(vec<4, f32>) -> vec<4, f32> +fn atan_a8b696() { + var res: vec4 = atan(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a8b696(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a8b696(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a8b696(); +} diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3d5dd23514 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_a8b696() { + float4 res = atan((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a8b696(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a8b696(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a8b696(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3d5dd23514 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan_a8b696() { + float4 res = atan((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a8b696(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a8b696(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a8b696(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.glsl new file mode 100644 index 0000000000..a0d75a18ee --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan_a8b696() { + vec4 res = atan(vec4(1.0f)); +} + +vec4 vertex_main() { + atan_a8b696(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_a8b696() { + vec4 res = atan(vec4(1.0f)); +} + +void fragment_main() { + atan_a8b696(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_a8b696() { + vec4 res = atan(vec4(1.0f)); +} + +void compute_main() { + atan_a8b696(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.msl new file mode 100644 index 0000000000..35885ed3e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_a8b696() { + float4 res = atan(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a8b696(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a8b696(); + return; +} + +kernel void compute_main() { + atan_a8b696(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.spvasm new file mode 100644 index 0000000000..10cdf7b9c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a8b696 "atan_a8b696" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%atan_a8b696 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Atan %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan_a8b696 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %atan_a8b696 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan_a8b696 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.wgsl new file mode 100644 index 0000000000..63e2ff4f87 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan_a8b696() { + var res : vec4 = atan(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a8b696(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a8b696(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a8b696(); +} diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl new file mode 100644 index 0000000000..821c5cba50 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(vec<2, f32>) -> vec<2, f32> +fn atan_ad96e4() { + var res: vec2 = atan(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_ad96e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_ad96e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_ad96e4(); +} diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b94859fa4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan_ad96e4() { + float2 res = atan((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_ad96e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_ad96e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_ad96e4(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b94859fa4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan_ad96e4() { + float2 res = atan((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_ad96e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_ad96e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_ad96e4(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.glsl new file mode 100644 index 0000000000..640b7a3daa --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan_ad96e4() { + vec2 res = atan(vec2(1.0f)); +} + +vec4 vertex_main() { + atan_ad96e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_ad96e4() { + vec2 res = atan(vec2(1.0f)); +} + +void fragment_main() { + atan_ad96e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_ad96e4() { + vec2 res = atan(vec2(1.0f)); +} + +void compute_main() { + atan_ad96e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.msl new file mode 100644 index 0000000000..d3f11d5205 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan_ad96e4() { + float2 res = atan(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_ad96e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_ad96e4(); + return; +} + +kernel void compute_main() { + atan_ad96e4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.spvasm new file mode 100644 index 0000000000..3bc1779963 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_ad96e4 "atan_ad96e4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%atan_ad96e4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Atan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %atan_ad96e4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan_ad96e4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan_ad96e4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..68ad03adc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan_ad96e4() { + var res : vec2 = atan(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_ad96e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_ad96e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_ad96e4(); +} diff --git a/test/tint/builtins/gen/literal/atan2/034ace.wgsl b/test/tint/builtins/gen/literal/atan2/034ace.wgsl new file mode 100644 index 0000000000..2e7ead5212 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/034ace.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(fa, fa) -> fa +fn atan2_034ace() { + var res = atan2(1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_034ace(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_034ace(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_034ace(); +} diff --git a/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dce0209f87 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_034ace() { + float res = 0.785398185f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_034ace(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_034ace(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_034ace(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dce0209f87 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_034ace() { + float res = 0.785398185f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_034ace(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_034ace(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_034ace(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.glsl new file mode 100644 index 0000000000..4919787a0b --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_034ace() { + float res = 0.785398185f; +} + +vec4 vertex_main() { + atan2_034ace(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_034ace() { + float res = 0.785398185f; +} + +void fragment_main() { + atan2_034ace(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_034ace() { + float res = 0.785398185f; +} + +void compute_main() { + atan2_034ace(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.msl new file mode 100644 index 0000000000..fb91e8d5e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_034ace() { + float res = 0.785398185f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_034ace(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_034ace(); + return; +} + +kernel void compute_main() { + atan2_034ace(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.spvasm new file mode 100644 index 0000000000..abac9b451f --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_034ace "atan2_034ace" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%float_0_785398185 = OpConstant %float 0.785398185 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_034ace = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_0_785398185 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %atan2_034ace + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %atan2_034ace + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan2_034ace + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e22efa7fc --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/034ace.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan2_034ace() { + var res = atan2(1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_034ace(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_034ace(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_034ace(); +} diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl new file mode 100644 index 0000000000..5a1889f2b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn atan2_21dfea() { + var res: vec3 = atan2(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_21dfea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_21dfea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_21dfea(); +} diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f40c95d00a --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_21dfea() { + vector res = (float16_t(0.0h)).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_21dfea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_21dfea(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c389fb49a --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan2_21dfea() { + vector res = (float16_t(0.0h)).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_21dfea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_21dfea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020C31CCD060(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.glsl new file mode 100644 index 0000000000..489c3b5683 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_21dfea() { + f16vec3 res = f16vec3(0.0hf); +} + +vec4 vertex_main() { + atan2_21dfea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_21dfea() { + f16vec3 res = f16vec3(0.0hf); +} + +void fragment_main() { + atan2_21dfea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_21dfea() { + f16vec3 res = f16vec3(0.0hf); +} + +void compute_main() { + atan2_21dfea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.msl new file mode 100644 index 0000000000..871202c34e --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_21dfea() { + half3 res = half3(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_21dfea(); + return; +} + +kernel void compute_main() { + atan2_21dfea(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.spvasm new file mode 100644 index 0000000000..25707d7867 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_21dfea "atan2_21dfea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_21dfea = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %atan2_21dfea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %atan2_21dfea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan2_21dfea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5251d4e57 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/21dfea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan2_21dfea() { + var res : vec3 = atan2(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_21dfea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_21dfea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_21dfea(); +} diff --git a/test/tint/builtins/gen/literal/atan2/3c2865.wgsl b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl new file mode 100644 index 0000000000..e0da8cf611 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<3, fa>, vec<3, fa>) -> vec<3, fa> +fn atan2_3c2865() { + var res = atan2(vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_3c2865(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_3c2865(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_3c2865(); +} diff --git a/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..71f64a4057 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_3c2865() { + float3 res = (0.785398185f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_3c2865(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_3c2865(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_3c2865(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..71f64a4057 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_3c2865() { + float3 res = (0.785398185f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_3c2865(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_3c2865(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_3c2865(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.glsl new file mode 100644 index 0000000000..b2ebe380a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_3c2865() { + vec3 res = vec3(0.785398185f); +} + +vec4 vertex_main() { + atan2_3c2865(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_3c2865() { + vec3 res = vec3(0.785398185f); +} + +void fragment_main() { + atan2_3c2865(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_3c2865() { + vec3 res = vec3(0.785398185f); +} + +void compute_main() { + atan2_3c2865(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.msl new file mode 100644 index 0000000000..867108a468 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_3c2865() { + float3 res = float3(0.785398185f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_3c2865(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_3c2865(); + return; +} + +kernel void compute_main() { + atan2_3c2865(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.spvasm new file mode 100644 index 0000000000..56fba1d2ac --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_3c2865 "atan2_3c2865" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%float_0_785398185 = OpConstant %float 0.785398185 + %15 = OpConstantComposite %v3float %float_0_785398185 %float_0_785398185 %float_0_785398185 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_3c2865 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan2_3c2865 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan2_3c2865 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan2_3c2865 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee5ee3df0b --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/3c2865.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan2_3c2865() { + var res = atan2(vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_3c2865(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_3c2865(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_3c2865(); +} diff --git a/test/tint/builtins/gen/literal/atan2/57fb13.wgsl b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl new file mode 100644 index 0000000000..2c96e0f26f --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn atan2_57fb13() { + var res: vec2 = atan2(vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_57fb13(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_57fb13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_57fb13(); +} diff --git a/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f3d2565163 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_57fb13() { + float2 res = (0.785398185f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_57fb13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_57fb13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_57fb13(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f3d2565163 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_57fb13() { + float2 res = (0.785398185f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_57fb13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_57fb13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_57fb13(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.glsl new file mode 100644 index 0000000000..e4ffcbac49 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_57fb13() { + vec2 res = vec2(0.785398185f); +} + +vec4 vertex_main() { + atan2_57fb13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_57fb13() { + vec2 res = vec2(0.785398185f); +} + +void fragment_main() { + atan2_57fb13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_57fb13() { + vec2 res = vec2(0.785398185f); +} + +void compute_main() { + atan2_57fb13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.msl new file mode 100644 index 0000000000..bdc31a4597 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_57fb13() { + float2 res = float2(0.785398185f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_57fb13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_57fb13(); + return; +} + +kernel void compute_main() { + atan2_57fb13(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.spvasm new file mode 100644 index 0000000000..8aed6450cd --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_57fb13 "atan2_57fb13" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_785398185 = OpConstant %float 0.785398185 + %15 = OpConstantComposite %v2float %float_0_785398185 %float_0_785398185 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_57fb13 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan2_57fb13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan2_57fb13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan2_57fb13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.wgsl new file mode 100644 index 0000000000..027f5780a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/57fb13.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan2_57fb13() { + var res : vec2 = atan2(vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_57fb13(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_57fb13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_57fb13(); +} diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl new file mode 100644 index 0000000000..6a5abcb1c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn atan2_93febc() { + var res: vec2 = atan2(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_93febc(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_93febc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_93febc(); +} diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..29acbb210f --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_93febc() { + vector res = (float16_t(0.0h)).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_93febc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_93febc(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..251cb38b59 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan2_93febc() { + vector res = (float16_t(0.0h)).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_93febc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_93febc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029435E06D30(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.glsl new file mode 100644 index 0000000000..1de833b62c --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_93febc() { + f16vec2 res = f16vec2(0.0hf); +} + +vec4 vertex_main() { + atan2_93febc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_93febc() { + f16vec2 res = f16vec2(0.0hf); +} + +void fragment_main() { + atan2_93febc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_93febc() { + f16vec2 res = f16vec2(0.0hf); +} + +void compute_main() { + atan2_93febc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.msl new file mode 100644 index 0000000000..7f6e188aef --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_93febc() { + half2 res = half2(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_93febc(); + return; +} + +kernel void compute_main() { + atan2_93febc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.spvasm new file mode 100644 index 0000000000..4404d85411 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_93febc "atan2_93febc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_93febc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %atan2_93febc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %atan2_93febc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan2_93febc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.wgsl new file mode 100644 index 0000000000..23d923aec6 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/93febc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan2_93febc() { + var res : vec2 = atan2(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_93febc(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_93febc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_93febc(); +} diff --git a/test/tint/builtins/gen/literal/atan2/96057c.wgsl b/test/tint/builtins/gen/literal/atan2/96057c.wgsl new file mode 100644 index 0000000000..462ff08d44 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/96057c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(f32, f32) -> f32 +fn atan2_96057c() { + var res: f32 = atan2(1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_96057c(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_96057c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_96057c(); +} diff --git a/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d1f91727ce --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_96057c() { + float res = 0.785398185f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_96057c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_96057c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_96057c(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d1f91727ce --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_96057c() { + float res = 0.785398185f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_96057c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_96057c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_96057c(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.glsl new file mode 100644 index 0000000000..84a2072b29 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_96057c() { + float res = 0.785398185f; +} + +vec4 vertex_main() { + atan2_96057c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_96057c() { + float res = 0.785398185f; +} + +void fragment_main() { + atan2_96057c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_96057c() { + float res = 0.785398185f; +} + +void compute_main() { + atan2_96057c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.msl new file mode 100644 index 0000000000..8a2998eccd --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_96057c() { + float res = 0.785398185f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_96057c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_96057c(); + return; +} + +kernel void compute_main() { + atan2_96057c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.spvasm new file mode 100644 index 0000000000..63149393e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_96057c "atan2_96057c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%float_0_785398185 = OpConstant %float 0.785398185 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_96057c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_0_785398185 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %atan2_96057c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %atan2_96057c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan2_96057c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab7825e44d --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/96057c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan2_96057c() { + var res : f32 = atan2(1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_96057c(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_96057c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_96057c(); +} diff --git a/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl new file mode 100644 index 0000000000..7d3418fcff --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn atan2_a70d0d() { + var res: vec3 = atan2(vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_a70d0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_a70d0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_a70d0d(); +} diff --git a/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a025539a96 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_a70d0d() { + float3 res = (0.785398185f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_a70d0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_a70d0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_a70d0d(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a025539a96 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_a70d0d() { + float3 res = (0.785398185f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_a70d0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_a70d0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_a70d0d(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.glsl new file mode 100644 index 0000000000..a63fa44de1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_a70d0d() { + vec3 res = vec3(0.785398185f); +} + +vec4 vertex_main() { + atan2_a70d0d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_a70d0d() { + vec3 res = vec3(0.785398185f); +} + +void fragment_main() { + atan2_a70d0d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_a70d0d() { + vec3 res = vec3(0.785398185f); +} + +void compute_main() { + atan2_a70d0d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.msl new file mode 100644 index 0000000000..c34104b703 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_a70d0d() { + float3 res = float3(0.785398185f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_a70d0d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_a70d0d(); + return; +} + +kernel void compute_main() { + atan2_a70d0d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5d3081808 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_a70d0d "atan2_a70d0d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%float_0_785398185 = OpConstant %float 0.785398185 + %15 = OpConstantComposite %v3float %float_0_785398185 %float_0_785398185 %float_0_785398185 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_a70d0d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan2_a70d0d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan2_a70d0d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan2_a70d0d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.wgsl new file mode 100644 index 0000000000..2195128c60 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/a70d0d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan2_a70d0d() { + var res : vec3 = atan2(vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_a70d0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_a70d0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_a70d0d(); +} diff --git a/test/tint/builtins/gen/literal/atan2/ae713e.wgsl b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl new file mode 100644 index 0000000000..6dce175f7a --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn atan2_ae713e() { + var res: vec4 = atan2(vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ae713e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ae713e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ae713e(); +} diff --git a/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5620691506 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_ae713e() { + float4 res = (0.785398185f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ae713e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ae713e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ae713e(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5620691506 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_ae713e() { + float4 res = (0.785398185f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ae713e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ae713e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ae713e(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.glsl new file mode 100644 index 0000000000..46798f9609 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_ae713e() { + vec4 res = vec4(0.785398185f); +} + +vec4 vertex_main() { + atan2_ae713e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_ae713e() { + vec4 res = vec4(0.785398185f); +} + +void fragment_main() { + atan2_ae713e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_ae713e() { + vec4 res = vec4(0.785398185f); +} + +void compute_main() { + atan2_ae713e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.msl new file mode 100644 index 0000000000..ec369ef07c --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_ae713e() { + float4 res = float4(0.785398185f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_ae713e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_ae713e(); + return; +} + +kernel void compute_main() { + atan2_ae713e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.spvasm new file mode 100644 index 0000000000..cb43b9df1f --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_ae713e "atan2_ae713e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%float_0_785398185 = OpConstant %float 0.785398185 + %14 = OpConstantComposite %v4float %float_0_785398185 %float_0_785398185 %float_0_785398185 %float_0_785398185 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_ae713e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %atan2_ae713e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_ae713e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan2_ae713e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.wgsl new file mode 100644 index 0000000000..9565523614 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ae713e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan2_ae713e() { + var res : vec4 = atan2(vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ae713e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ae713e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ae713e(); +} diff --git a/test/tint/builtins/gen/literal/atan2/c19683.wgsl b/test/tint/builtins/gen/literal/atan2/c19683.wgsl new file mode 100644 index 0000000000..7ea03438bb --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c19683.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<2, fa>, vec<2, fa>) -> vec<2, fa> +fn atan2_c19683() { + var res = atan2(vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_c19683(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_c19683(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_c19683(); +} diff --git a/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..93f2273a4d --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_c19683() { + float2 res = (0.785398185f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_c19683(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_c19683(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_c19683(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..93f2273a4d --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_c19683() { + float2 res = (0.785398185f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_c19683(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_c19683(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_c19683(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.glsl new file mode 100644 index 0000000000..d823d61220 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_c19683() { + vec2 res = vec2(0.785398185f); +} + +vec4 vertex_main() { + atan2_c19683(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_c19683() { + vec2 res = vec2(0.785398185f); +} + +void fragment_main() { + atan2_c19683(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_c19683() { + vec2 res = vec2(0.785398185f); +} + +void compute_main() { + atan2_c19683(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.msl new file mode 100644 index 0000000000..3af76c71ab --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_c19683() { + float2 res = float2(0.785398185f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_c19683(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_c19683(); + return; +} + +kernel void compute_main() { + atan2_c19683(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.spvasm new file mode 100644 index 0000000000..66dfdb29f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_c19683 "atan2_c19683" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_785398185 = OpConstant %float 0.785398185 + %15 = OpConstantComposite %v2float %float_0_785398185 %float_0_785398185 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_c19683 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan2_c19683 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan2_c19683 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan2_c19683 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.wgsl new file mode 100644 index 0000000000..efb9bada31 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c19683.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan2_c19683() { + var res = atan2(vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_c19683(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_c19683(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_c19683(); +} diff --git a/test/tint/builtins/gen/literal/atan2/c4be45.wgsl b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl new file mode 100644 index 0000000000..a80cebe427 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<4, fa>, vec<4, fa>) -> vec<4, fa> +fn atan2_c4be45() { + var res = atan2(vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_c4be45(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_c4be45(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_c4be45(); +} diff --git a/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c666d69302 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_c4be45() { + float4 res = (0.785398185f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_c4be45(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_c4be45(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_c4be45(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c666d69302 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_c4be45() { + float4 res = (0.785398185f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_c4be45(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_c4be45(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_c4be45(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.glsl new file mode 100644 index 0000000000..2d65f8235f --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_c4be45() { + vec4 res = vec4(0.785398185f); +} + +vec4 vertex_main() { + atan2_c4be45(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_c4be45() { + vec4 res = vec4(0.785398185f); +} + +void fragment_main() { + atan2_c4be45(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_c4be45() { + vec4 res = vec4(0.785398185f); +} + +void compute_main() { + atan2_c4be45(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.msl new file mode 100644 index 0000000000..89fe4fad5d --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_c4be45() { + float4 res = float4(0.785398185f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_c4be45(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_c4be45(); + return; +} + +kernel void compute_main() { + atan2_c4be45(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f8d2b6337 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_c4be45 "atan2_c4be45" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%float_0_785398185 = OpConstant %float 0.785398185 + %14 = OpConstantComposite %v4float %float_0_785398185 %float_0_785398185 %float_0_785398185 %float_0_785398185 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_c4be45 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %atan2_c4be45 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_c4be45 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan2_c4be45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.wgsl new file mode 100644 index 0000000000..f5c94ecd8e --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/c4be45.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atan2_c4be45() { + var res = atan2(vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_c4be45(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_c4be45(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_c4be45(); +} diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl new file mode 100644 index 0000000000..c22ba397cb --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(f16, f16) -> f16 +fn atan2_ca698e() { + var res: f16 = atan2(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ca698e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ca698e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ca698e(); +} diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..68471d9206 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_ca698e() { + float16_t res = float16_t(0.0h); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ca698e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ca698e(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c13f773433 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void atan2_ca698e() { + float16_t res = float16_t(0.0h); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ca698e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ca698e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000221D39B1200(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000221D39B1200(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.glsl new file mode 100644 index 0000000000..d310b708f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_ca698e() { + float16_t res = 0.0hf; +} + +vec4 vertex_main() { + atan2_ca698e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_ca698e() { + float16_t res = 0.0hf; +} + +void fragment_main() { + atan2_ca698e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_ca698e() { + float16_t res = 0.0hf; +} + +void compute_main() { + atan2_ca698e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.msl new file mode 100644 index 0000000000..f4e7539422 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_ca698e() { + half res = 0.0h; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_ca698e(); + return; +} + +kernel void compute_main() { + atan2_ca698e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.spvasm new file mode 100644 index 0000000000..63ae0e46a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_ca698e "atan2_ca698e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_ca698e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %atan2_ca698e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_ca698e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan2_ca698e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe62d18d96 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/ca698e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan2_ca698e() { + var res : f16 = atan2(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ca698e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ca698e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ca698e(); +} diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl new file mode 100644 index 0000000000..bc8410c862 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn atan2_d983ab() { + var res: vec4 = atan2(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_d983ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_d983ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_d983ab(); +} diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b7ee7943bb --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_d983ab() { + vector res = (float16_t(0.0h)).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_d983ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_d983ab(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c24da1d10d --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void atan2_d983ab() { + vector res = (float16_t(0.0h)).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_d983ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_d983ab(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000259F9C66DF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.glsl new file mode 100644 index 0000000000..6f6529db5b --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_d983ab() { + f16vec4 res = f16vec4(0.0hf); +} + +vec4 vertex_main() { + atan2_d983ab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_d983ab() { + f16vec4 res = f16vec4(0.0hf); +} + +void fragment_main() { + atan2_d983ab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_d983ab() { + f16vec4 res = f16vec4(0.0hf); +} + +void compute_main() { + atan2_d983ab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.msl new file mode 100644 index 0000000000..227ba1f722 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_d983ab() { + half4 res = half4(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_d983ab(); + return; +} + +kernel void compute_main() { + atan2_d983ab(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.spvasm new file mode 100644 index 0000000000..d6c52b97a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_d983ab "atan2_d983ab" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_d983ab = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %atan2_d983ab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %atan2_d983ab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan2_d983ab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..50719cb68f --- /dev/null +++ b/test/tint/builtins/gen/literal/atan2/d983ab.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atan2_d983ab() { + var res : vec4 = atan2(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_d983ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_d983ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_d983ab(); +} diff --git a/test/tint/builtins/gen/literal/atanh/440cca.wgsl b/test/tint/builtins/gen/literal/atanh/440cca.wgsl new file mode 100644 index 0000000000..508c4d8ba6 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/440cca.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atanh(vec<3, f32>) -> vec<3, f32> +fn atanh_440cca() { + var res: vec3 = atanh(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_440cca(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_440cca(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_440cca(); +} diff --git a/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..62b4e58561 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_atanh(float3 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_440cca() { + float3 res = tint_atanh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_440cca(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_440cca(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_440cca(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..62b4e58561 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_atanh(float3 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_440cca() { + float3 res = tint_atanh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_440cca(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_440cca(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_440cca(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.glsl new file mode 100644 index 0000000000..b94d529143 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +vec3 tint_atanh(vec3 x) { + return mix(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f))); +} + +void atanh_440cca() { + vec3 res = tint_atanh(vec3(1.0f)); +} + +vec4 vertex_main() { + atanh_440cca(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_atanh(vec3 x) { + return mix(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f))); +} + +void atanh_440cca() { + vec3 res = tint_atanh(vec3(1.0f)); +} + +void fragment_main() { + atanh_440cca(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_atanh(vec3 x) { + return mix(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f))); +} + +void atanh_440cca() { + vec3 res = tint_atanh(vec3(1.0f)); +} + +void compute_main() { + atanh_440cca(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.msl new file mode 100644 index 0000000000..3d3664918a --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +float3 tint_atanh(float3 x) { + return select(atanh(x), float3(0.0f), (x >= float3(1.0f))); +} + +void atanh_440cca() { + float3 res = tint_atanh(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_440cca(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_440cca(); + return; +} + +kernel void compute_main() { + atanh_440cca(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.spvasm new file mode 100644 index 0000000000..c2c163db22 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_440cca "atanh_440cca" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float %v3float + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %20 = OpConstantNull %v3float + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_v3float = OpTypePointer Function %v3float + %30 = OpTypeFunction %v4float + %tint_atanh = OpFunction %v3float None %9 + %x = OpFunctionParameter %v3float + %13 = OpLabel + %17 = OpFOrdGreaterThanEqual %v3bool %x %16 + %21 = OpExtInst %v3float %22 Atanh %x + %14 = OpSelect %v3float %17 %20 %21 + OpReturnValue %14 + OpFunctionEnd +%atanh_440cca = OpFunction %void None %23 + %26 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %27 = OpFunctionCall %v3float %tint_atanh %16 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %atanh_440cca + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %38 = OpLabel + %39 = OpFunctionCall %void %atanh_440cca + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %41 = OpLabel + %42 = OpFunctionCall %void %atanh_440cca + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.wgsl new file mode 100644 index 0000000000..44260807bc --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/440cca.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atanh_440cca() { + var res : vec3 = atanh(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_440cca(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_440cca(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_440cca(); +} diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl new file mode 100644 index 0000000000..f82815681b --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<2, f16>) -> vec<2, f16> +fn atanh_5bf88d() { + var res: vec2 = atanh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_5bf88d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_5bf88d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_5bf88d(); +} diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38fb4b66c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_5bf88d() { + vector res = tint_atanh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_5bf88d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_5bf88d(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..73c6586a2d --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_5bf88d() { + vector res = tint_atanh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_5bf88d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_5bf88d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F6B2FD2F70(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.glsl new file mode 100644 index 0000000000..76ddf5731d --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 res = tint_atanh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + atanh_5bf88d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 res = tint_atanh(f16vec2(0.0hf)); +} + +void fragment_main() { + atanh_5bf88d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 res = tint_atanh(f16vec2(0.0hf)); +} + +void compute_main() { + atanh_5bf88d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.msl new file mode 100644 index 0000000000..3b4f0b34bd --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half2 tint_atanh(half2 x) { + return select(atanh(x), half2(0.0h), (x >= half2(1.0h))); +} + +void atanh_5bf88d() { + half2 res = tint_atanh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_5bf88d(); + return; +} + +kernel void compute_main() { + atanh_5bf88d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d87c6402fa --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_5bf88d "atanh_5bf88d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v2half = OpTypePointer Function %v2half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v2half None %9 + %x = OpFunctionParameter %v2half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v2bool %x %17 + %22 = OpExtInst %v2half %23 Atanh %x + %15 = OpSelect %v2half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_5bf88d = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %21 + %28 = OpFunctionCall %v2half %tint_atanh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %atanh_5bf88d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_5bf88d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %atanh_5bf88d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.wgsl new file mode 100644 index 0000000000..b399e07dc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/5bf88d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atanh_5bf88d() { + var res : vec2 = atanh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_5bf88d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_5bf88d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_5bf88d(); +} diff --git a/test/tint/builtins/gen/literal/atanh/7997d8.wgsl b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl new file mode 100644 index 0000000000..1fc4412d0a --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atanh(f32) -> f32 +fn atanh_7997d8() { + var res: f32 = atanh(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_7997d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_7997d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_7997d8(); +} diff --git a/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..76a5352a17 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float tint_atanh(float x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_7997d8() { + float res = tint_atanh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_7997d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_7997d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_7997d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..76a5352a17 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float tint_atanh(float x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_7997d8() { + float res = tint_atanh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_7997d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_7997d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_7997d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.glsl new file mode 100644 index 0000000000..f73d0d791e --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +float tint_atanh(float x) { + return ((x >= 1.0f) ? 0.0f : atanh(x)); +} + +void atanh_7997d8() { + float res = tint_atanh(1.0f); +} + +vec4 vertex_main() { + atanh_7997d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_atanh(float x) { + return ((x >= 1.0f) ? 0.0f : atanh(x)); +} + +void atanh_7997d8() { + float res = tint_atanh(1.0f); +} + +void fragment_main() { + atanh_7997d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_atanh(float x) { + return ((x >= 1.0f) ? 0.0f : atanh(x)); +} + +void atanh_7997d8() { + float res = tint_atanh(1.0f); +} + +void compute_main() { + atanh_7997d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.msl new file mode 100644 index 0000000000..ec298cf5e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +float tint_atanh(float x) { + return select(atanh(x), 0.0f, (x >= 1.0f)); +} + +void atanh_7997d8() { + float res = tint_atanh(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_7997d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_7997d8(); + return; +} + +kernel void compute_main() { + atanh_7997d8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..9910eed56b --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_7997d8 "atanh_7997d8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %9 = OpTypeFunction %float %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpTypeFunction %v4float + %tint_atanh = OpFunction %float None %9 + %x = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFOrdGreaterThanEqual %bool %x %float_1 + %17 = OpExtInst %float %18 Atanh %x + %13 = OpSelect %float %15 %8 %17 + OpReturnValue %13 + OpFunctionEnd +%atanh_7997d8 = OpFunction %void None %19 + %22 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %23 = OpFunctionCall %float %tint_atanh %float_1 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %atanh_7997d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %19 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %19 + %34 = OpLabel + %35 = OpFunctionCall %void %atanh_7997d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %19 + %37 = OpLabel + %38 = OpFunctionCall %void %atanh_7997d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..dcf31c2a9e --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/7997d8.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atanh_7997d8() { + var res : f32 = atanh(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_7997d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_7997d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_7997d8(); +} diff --git a/test/tint/builtins/gen/literal/atanh/c0e634.wgsl b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl new file mode 100644 index 0000000000..9a9eb9d6fd --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atanh(vec<2, f32>) -> vec<2, f32> +fn atanh_c0e634() { + var res: vec2 = atanh(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_c0e634(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_c0e634(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_c0e634(); +} diff --git a/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..961f86a870 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_atanh(float2 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_c0e634() { + float2 res = tint_atanh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_c0e634(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_c0e634(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_c0e634(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..961f86a870 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_atanh(float2 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_c0e634() { + float2 res = tint_atanh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_c0e634(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_c0e634(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_c0e634(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.glsl new file mode 100644 index 0000000000..af242ca8a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +vec2 tint_atanh(vec2 x) { + return mix(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f))); +} + +void atanh_c0e634() { + vec2 res = tint_atanh(vec2(1.0f)); +} + +vec4 vertex_main() { + atanh_c0e634(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_atanh(vec2 x) { + return mix(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f))); +} + +void atanh_c0e634() { + vec2 res = tint_atanh(vec2(1.0f)); +} + +void fragment_main() { + atanh_c0e634(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_atanh(vec2 x) { + return mix(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f))); +} + +void atanh_c0e634() { + vec2 res = tint_atanh(vec2(1.0f)); +} + +void compute_main() { + atanh_c0e634(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.msl new file mode 100644 index 0000000000..d5c6b49b1f --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +float2 tint_atanh(float2 x) { + return select(atanh(x), float2(0.0f), (x >= float2(1.0f))); +} + +void atanh_c0e634() { + float2 res = tint_atanh(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_c0e634(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_c0e634(); + return; +} + +kernel void compute_main() { + atanh_c0e634(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.spvasm new file mode 100644 index 0000000000..4cc3fa4871 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_c0e634 "atanh_c0e634" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %v2float = OpTypeVector %float 2 + %9 = OpTypeFunction %v2float %v2float + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v2float %float_1 %float_1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %20 = OpConstantNull %v2float + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %30 = OpTypeFunction %v4float + %tint_atanh = OpFunction %v2float None %9 + %x = OpFunctionParameter %v2float + %13 = OpLabel + %17 = OpFOrdGreaterThanEqual %v2bool %x %16 + %21 = OpExtInst %v2float %22 Atanh %x + %14 = OpSelect %v2float %17 %20 %21 + OpReturnValue %14 + OpFunctionEnd +%atanh_c0e634 = OpFunction %void None %23 + %26 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %27 = OpFunctionCall %v2float %tint_atanh %16 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %atanh_c0e634 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %38 = OpLabel + %39 = OpFunctionCall %void %atanh_c0e634 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %41 = OpLabel + %42 = OpFunctionCall %void %atanh_c0e634 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.wgsl new file mode 100644 index 0000000000..c36353610a --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/c0e634.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atanh_c0e634() { + var res : vec2 = atanh(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_c0e634(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_c0e634(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_c0e634(); +} diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl new file mode 100644 index 0000000000..2fa4e3c9fd --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(f16) -> f16 +fn atanh_d2d8cd() { + var res: f16 = atanh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_d2d8cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_d2d8cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_d2d8cd(); +} diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1b3c054c9b --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_atanh(float16_t x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_d2d8cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_d2d8cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0a2f1e426 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_atanh(float16_t x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_d2d8cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_d2d8cd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001760B391820(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.glsl new file mode 100644 index 0000000000..3077ea81d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(0.0hf); +} + +vec4 vertex_main() { + atanh_d2d8cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(0.0hf); +} + +void fragment_main() { + atanh_d2d8cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t res = tint_atanh(0.0hf); +} + +void compute_main() { + atanh_d2d8cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.msl new file mode 100644 index 0000000000..80f097f257 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half tint_atanh(half x) { + return select(atanh(x), 0.0h, (x >= 1.0h)); +} + +void atanh_d2d8cd() { + half res = tint_atanh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_d2d8cd(); + return; +} + +kernel void compute_main() { + atanh_d2d8cd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..82b8e8bc4b --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_d2d8cd "atanh_d2d8cd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %9 = OpTypeFunction %half %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %18 = OpConstantNull %half + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %half None %9 + %x = OpFunctionParameter %half + %13 = OpLabel + %16 = OpFOrdGreaterThanEqual %bool %x %half_0x1p_0 + %19 = OpExtInst %half %20 Atanh %x + %14 = OpSelect %half %16 %18 %19 + OpReturnValue %14 + OpFunctionEnd +%atanh_d2d8cd = OpFunction %void None %21 + %24 = OpLabel + %res = OpVariable %_ptr_Function_half Function %18 + %25 = OpFunctionCall %half %tint_atanh %18 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %atanh_d2d8cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %37 = OpLabel + %38 = OpFunctionCall %void %atanh_d2d8cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_d2d8cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..7f127435af --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/d2d8cd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atanh_d2d8cd() { + var res : f16 = atanh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_d2d8cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_d2d8cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_d2d8cd(); +} diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl new file mode 100644 index 0000000000..23c6e104ea --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<4, f16>) -> vec<4, f16> +fn atanh_e3b450() { + var res: vec4 = atanh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_e3b450(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_e3b450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_e3b450(); +} diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ecec215946 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_e3b450() { + vector res = tint_atanh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_e3b450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_e3b450(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..96b829b9ff --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_e3b450() { + vector res = tint_atanh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_e3b450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_e3b450(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000176443384D0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.glsl new file mode 100644 index 0000000000..32a26fcce4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 res = tint_atanh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + atanh_e3b450(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 res = tint_atanh(f16vec4(0.0hf)); +} + +void fragment_main() { + atanh_e3b450(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 res = tint_atanh(f16vec4(0.0hf)); +} + +void compute_main() { + atanh_e3b450(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.msl new file mode 100644 index 0000000000..8528cf7e4b --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half4 tint_atanh(half4 x) { + return select(atanh(x), half4(0.0h), (x >= half4(1.0h))); +} + +void atanh_e3b450() { + half4 res = tint_atanh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_e3b450(); + return; +} + +kernel void compute_main() { + atanh_e3b450(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.spvasm new file mode 100644 index 0000000000..7aba5f8cbf --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_e3b450 "atanh_e3b450" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v4half = OpTypePointer Function %v4half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v4half None %9 + %x = OpFunctionParameter %v4half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v4bool %x %17 + %22 = OpExtInst %v4half %23 Atanh %x + %15 = OpSelect %v4half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_e3b450 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %21 + %28 = OpFunctionCall %v4half %tint_atanh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %atanh_e3b450 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_e3b450 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %atanh_e3b450 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0a85777af --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/e3b450.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atanh_e3b450() { + var res : vec4 = atanh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_e3b450(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_e3b450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_e3b450(); +} diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl new file mode 100644 index 0000000000..708c3b3732 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<3, f16>) -> vec<3, f16> +fn atanh_ec4b06() { + var res: vec3 = atanh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_ec4b06(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_ec4b06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_ec4b06(); +} diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0b739c0f20 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_ec4b06() { + vector res = tint_atanh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_ec4b06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_ec4b06(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..46881a0ccb --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_ec4b06() { + vector res = tint_atanh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_ec4b06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_ec4b06(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001899EE63220(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.glsl new file mode 100644 index 0000000000..6c8e11bd52 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 res = tint_atanh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + atanh_ec4b06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 res = tint_atanh(f16vec3(0.0hf)); +} + +void fragment_main() { + atanh_ec4b06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 res = tint_atanh(f16vec3(0.0hf)); +} + +void compute_main() { + atanh_ec4b06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.msl new file mode 100644 index 0000000000..e42af54c7e --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +half3 tint_atanh(half3 x) { + return select(atanh(x), half3(0.0h), (x >= half3(1.0h))); +} + +void atanh_ec4b06() { + half3 res = tint_atanh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_ec4b06(); + return; +} + +kernel void compute_main() { + atanh_ec4b06(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8bdc5c7bf --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_ec4b06 "atanh_ec4b06" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v3half = OpTypePointer Function %v3half + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v3half None %9 + %x = OpFunctionParameter %v3half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v3bool %x %17 + %22 = OpExtInst %v3half %23 Atanh %x + %15 = OpSelect %v3half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_ec4b06 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %21 + %28 = OpFunctionCall %v3half %tint_atanh %21 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %atanh_ec4b06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_ec4b06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %atanh_ec4b06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.wgsl new file mode 100644 index 0000000000..4570d2ba66 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/ec4b06.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn atanh_ec4b06() { + var res : vec3 = atanh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_ec4b06(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_ec4b06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_ec4b06(); +} diff --git a/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl new file mode 100644 index 0000000000..038b9475f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atanh(vec<4, f32>) -> vec<4, f32> +fn atanh_f3e01b() { + var res: vec4 = atanh(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_f3e01b(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_f3e01b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_f3e01b(); +} diff --git a/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fcae34abcf --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_atanh(float4 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_f3e01b() { + float4 res = tint_atanh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_f3e01b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_f3e01b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_f3e01b(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fcae34abcf --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_atanh(float4 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_f3e01b() { + float4 res = tint_atanh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_f3e01b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_f3e01b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_f3e01b(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.glsl new file mode 100644 index 0000000000..a2cda73ae4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +vec4 tint_atanh(vec4 x) { + return mix(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f))); +} + +void atanh_f3e01b() { + vec4 res = tint_atanh(vec4(1.0f)); +} + +vec4 vertex_main() { + atanh_f3e01b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_atanh(vec4 x) { + return mix(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f))); +} + +void atanh_f3e01b() { + vec4 res = tint_atanh(vec4(1.0f)); +} + +void fragment_main() { + atanh_f3e01b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_atanh(vec4 x) { + return mix(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f))); +} + +void atanh_f3e01b() { + vec4 res = tint_atanh(vec4(1.0f)); +} + +void compute_main() { + atanh_f3e01b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.msl new file mode 100644 index 0000000000..9bf9bd81f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +float4 tint_atanh(float4 x) { + return select(atanh(x), float4(0.0f), (x >= float4(1.0f))); +} + +void atanh_f3e01b() { + float4 res = tint_atanh(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_f3e01b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_f3e01b(); + return; +} + +kernel void compute_main() { + atanh_f3e01b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.spvasm new file mode 100644 index 0000000000..6086ee2c12 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_f3e01b "atanh_f3e01b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %9 = OpTypeFunction %v4float %v4float + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpTypeFunction %v4float + %tint_atanh = OpFunction %v4float None %9 + %x = OpFunctionParameter %v4float + %12 = OpLabel + %16 = OpFOrdGreaterThanEqual %v4bool %x %15 + %19 = OpExtInst %v4float %20 Atanh %x + %13 = OpSelect %v4float %16 %5 %19 + OpReturnValue %13 + OpFunctionEnd +%atanh_f3e01b = OpFunction %void None %21 + %24 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %25 = OpFunctionCall %v4float %tint_atanh %15 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %atanh_f3e01b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %36 = OpLabel + %37 = OpFunctionCall %void %atanh_f3e01b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %39 = OpLabel + %40 = OpFunctionCall %void %atanh_f3e01b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3ad468495 --- /dev/null +++ b/test/tint/builtins/gen/literal/atanh/f3e01b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn atanh_f3e01b() { + var res : vec4 = atanh(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_f3e01b(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_f3e01b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_f3e01b(); +} diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl new file mode 100644 index 0000000000..71d03bd076 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAdd(ptr, read_write>, i32) -> i32 +fn atomicAdd_794055() { + var res: i32 = atomicAdd(&arg_0, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_794055(); +} diff --git a/test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16632807ec --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicAdd_794055() { + int atomic_result = 0; + InterlockedAdd(arg_0, 1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicAdd/794055.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.msl new file mode 100644 index 0000000000..dca123cd13 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { + int res = atomic_fetch_add_explicit(tint_symbol, 1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_794055(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.spvasm new file mode 100644 index 0000000000..d8903dcfc7 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce52b8fc2d --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicAdd_794055() { + var res : i32 = atomicAdd(&(arg_0), 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_794055(); +} diff --git a/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl new file mode 100644 index 0000000000..dbf0d3226e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAdd(ptr, read_write>, u32) -> u32 +fn atomicAdd_8a199a() { + var res: u32 = atomicAdd(&sb_rw.arg_0, 1u); +} + +@fragment +fn fragment_main() { + atomicAdd_8a199a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_8a199a(); +} diff --git a/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f31fb5cf7f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint res = tint_atomicAdd(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_8a199a(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f31fb5cf7f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint res = tint_atomicAdd(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_8a199a(); + return; +} diff --git a/test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicAdd/8a199a.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.spvasm new file mode 100644 index 0000000000..399663595f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicIAdd %uint %14 %uint_1 %uint_0 %uint_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.wgsl new file mode 100644 index 0000000000..973ffe2d46 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAdd_8a199a() { + var res : u32 = atomicAdd(&(sb_rw.arg_0), 1u); +} + +@fragment +fn fragment_main() { + atomicAdd_8a199a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_8a199a(); +} diff --git a/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl new file mode 100644 index 0000000000..9fecf87f45 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAdd(ptr, read_write>, i32) -> i32 +fn atomicAdd_d32fe4() { + var res: i32 = atomicAdd(&sb_rw.arg_0, 1); +} + +@fragment +fn fragment_main() { + atomicAdd_d32fe4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_d32fe4(); +} diff --git a/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..62ae701abd --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int res = tint_atomicAdd(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_d32fe4(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..62ae701abd --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int res = tint_atomicAdd(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_d32fe4(); + return; +} diff --git a/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicAdd/d32fe4.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.spvasm new file mode 100644 index 0000000000..11672382dd --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicIAdd %int %15 %uint_1 %uint_0 %int_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.wgsl new file mode 100644 index 0000000000..4303284003 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAdd_d32fe4() { + var res : i32 = atomicAdd(&(sb_rw.arg_0), 1); +} + +@fragment +fn fragment_main() { + atomicAdd_d32fe4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_d32fe4(); +} diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl new file mode 100644 index 0000000000..93a8c2694c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAdd(ptr, read_write>, u32) -> u32 +fn atomicAdd_d5db1d() { + var res: u32 = atomicAdd(&arg_0, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_d5db1d(); +} diff --git a/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9429101fd4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint atomic_result = 0u; + InterlockedAdd(arg_0, 1u, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicAdd/d5db1d.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.msl new file mode 100644 index 0000000000..3d80f24eae --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_fetch_add_explicit(tint_symbol, 1u, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_d5db1d(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..110fb42f3d --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..22b1fbbc55 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicAdd_d5db1d() { + var res : u32 = atomicAdd(&(arg_0), 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_d5db1d(); +} diff --git a/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl new file mode 100644 index 0000000000..765df97a21 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAnd(ptr, read_write>, i32) -> i32 +fn atomicAnd_152966() { + var res: i32 = atomicAnd(&sb_rw.arg_0, 1); +} + +@fragment +fn fragment_main() { + atomicAnd_152966(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_152966(); +} diff --git a/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..281ec13b3d --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_152966() { + int res = tint_atomicAnd(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicAnd_152966(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_152966(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..281ec13b3d --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_152966() { + int res = tint_atomicAnd(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicAnd_152966(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_152966(); + return; +} diff --git a/test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicAnd/152966.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.spvasm new file mode 100644 index 0000000000..ee4f5dc18f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_152966 "atomicAnd_152966" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicAnd_152966 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicAnd %int %15 %uint_1 %uint_0 %int_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.wgsl new file mode 100644 index 0000000000..38d19dde53 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAnd_152966() { + var res : i32 = atomicAnd(&(sb_rw.arg_0), 1); +} + +@fragment +fn fragment_main() { + atomicAnd_152966(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_152966(); +} diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl new file mode 100644 index 0000000000..68d9027fa9 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAnd(ptr, read_write>, u32) -> u32 +fn atomicAnd_34edd3() { + var res: u32 = atomicAnd(&arg_0, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_34edd3(); +} diff --git a/test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1a459d0831 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicAnd_34edd3() { + uint atomic_result = 0u; + InterlockedAnd(arg_0, 1u, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAnd_34edd3(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicAnd/34edd3.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.msl new file mode 100644 index 0000000000..adc4916cd5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicAnd_34edd3(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_fetch_and_explicit(tint_symbol, 1u, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_34edd3(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d205d2f64 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_34edd3 "atomicAnd_34edd3" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_34edd3 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicAnd_34edd3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.wgsl new file mode 100644 index 0000000000..7cae2d8d5e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicAnd_34edd3() { + var res : u32 = atomicAnd(&(arg_0), 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_34edd3(); +} diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl new file mode 100644 index 0000000000..392a22e6ea --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAnd(ptr, read_write>, i32) -> i32 +fn atomicAnd_45a819() { + var res: i32 = atomicAnd(&arg_0, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_45a819(); +} diff --git a/test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43929b85f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicAnd_45a819() { + int atomic_result = 0; + InterlockedAnd(arg_0, 1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAnd_45a819(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicAnd/45a819.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.msl new file mode 100644 index 0000000000..4fff67198e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicAnd_45a819(threadgroup atomic_int* const tint_symbol) { + int res = atomic_fetch_and_explicit(tint_symbol, 1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_45a819(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.spvasm new file mode 100644 index 0000000000..696d2a3a41 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_45a819 "atomicAnd_45a819" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_45a819 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicAnd_45a819 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.wgsl new file mode 100644 index 0000000000..a93b45a050 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicAnd_45a819() { + var res : i32 = atomicAnd(&(arg_0), 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_45a819(); +} diff --git a/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl new file mode 100644 index 0000000000..9016047ccd --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAnd(ptr, read_write>, u32) -> u32 +fn atomicAnd_85a8d9() { + var res: u32 = atomicAnd(&sb_rw.arg_0, 1u); +} + +@fragment +fn fragment_main() { + atomicAnd_85a8d9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_85a8d9(); +} diff --git a/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1c89d149e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_85a8d9() { + uint res = tint_atomicAnd(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicAnd_85a8d9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_85a8d9(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c89d149e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_85a8d9() { + uint res = tint_atomicAnd(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicAnd_85a8d9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_85a8d9(); + return; +} diff --git a/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicAnd/85a8d9.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.spvasm new file mode 100644 index 0000000000..e45402c051 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_85a8d9 "atomicAnd_85a8d9" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicAnd_85a8d9 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicAnd %uint %14 %uint_1 %uint_0 %uint_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.wgsl new file mode 100644 index 0000000000..f570c70047 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAnd_85a8d9() { + var res : u32 = atomicAnd(&(sb_rw.arg_0), 1u); +} + +@fragment +fn fragment_main() { + atomicAnd_85a8d9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_85a8d9(); +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl new file mode 100644 index 0000000000..8a738d42dd --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicCompareExchangeWeak(ptr, read_write>, i32, i32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_1bd40a() { + var res = atomicCompareExchangeWeak(&sb_rw.arg_0, 1, 1); +} + +@fragment +fn fragment_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_1bd40a(); +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b1e30e0e79 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.dxc.hlsl @@ -0,0 +1,29 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_1bd40a() { + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, 1, 1); +} + +void fragment_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1e30e0e79 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.fxc.hlsl @@ -0,0 +1,29 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_1bd40a() { + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, 1, 1); +} + +void fragment_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl new file mode 100644 index 0000000000..001110fd65 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl @@ -0,0 +1,62 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; + atomic_compare_exchange_resulti32 res = atomic_compare_result; +} + +void fragment_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; + atomic_compare_exchange_resulti32 res = atomic_compare_result; +} + +void compute_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl new file mode 100644 index 0000000000..9f0ca2d9ad --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(device atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicCompareExchangeWeak_1bd40a(device SB_RW* const tint_symbol) { + atomic_compare_exchange_resulti32 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), 1, 1); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm new file mode 100644 index 0000000000..454abb1a57 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_1bd40a "atomicCompareExchangeWeak_1bd40a" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %23 = OpConstantNull %__atomic_compare_exchange_resulti32 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %23 + %17 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %19 = OpAtomicCompareExchange %int %17 %uint_1 %uint_0 %uint_0 %int_1 %int_1 + %20 = OpIEqual %bool %19 %int_1 + %9 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %19 %20 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl new file mode 100644 index 0000000000..d52ac19ec4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicCompareExchangeWeak_1bd40a() { + var res = atomicCompareExchangeWeak(&(sb_rw.arg_0), 1, 1); +} + +@fragment +fn fragment_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_1bd40a(); +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl new file mode 100644 index 0000000000..02ddbc3eb3 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicCompareExchangeWeak(ptr, read_write>, u32, u32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_63d8e6() { + var res = atomicCompareExchangeWeak(&sb_rw.arg_0, 1u, 1u); +} + +@fragment +fn fragment_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_63d8e6(); +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9dc72b3c46 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.dxc.hlsl @@ -0,0 +1,29 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_63d8e6() { + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, 1u, 1u); +} + +void fragment_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9dc72b3c46 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.fxc.hlsl @@ -0,0 +1,29 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_63d8e6() { + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, 1u, 1u); +} + +void fragment_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl new file mode 100644 index 0000000000..e5738b7cb4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl @@ -0,0 +1,62 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1u, 1u); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; + atomic_compare_exchange_resultu32 res = atomic_compare_result; +} + +void fragment_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1u, 1u); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; + atomic_compare_exchange_resultu32 res = atomic_compare_result; +} + +void compute_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl new file mode 100644 index 0000000000..9437613622 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(device atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicCompareExchangeWeak_63d8e6(device SB_RW* const tint_symbol) { + atomic_compare_exchange_resultu32 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), 1u, 1u); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..09e83a0ae1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_63d8e6 "atomicCompareExchangeWeak_63d8e6" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %21 = OpConstantNull %__atomic_compare_exchange_resultu32 +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %21 + %16 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %17 = OpAtomicCompareExchange %uint %16 %uint_1 %uint_0 %uint_0 %uint_1 %uint_1 + %18 = OpIEqual %bool %17 %uint_1 + %9 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %17 %18 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..af3d89f92c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicCompareExchangeWeak_63d8e6() { + var res = atomicCompareExchangeWeak(&(sb_rw.arg_0), 1u, 1u); +} + +@fragment +fn fragment_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_63d8e6(); +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl new file mode 100644 index 0000000000..0863571563 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicCompareExchangeWeak(ptr, read_write>, u32, u32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_83580d() { + var res = atomicCompareExchangeWeak(&arg_0, 1u, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_83580d(); +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3f46597640 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +groupshared uint arg_0; + +void atomicCompareExchangeWeak_83580d() { + atomic_compare_exchange_resultu32 atomic_result = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = 1u; + InterlockedCompareExchange(arg_0, atomic_compare_value, 1u, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + atomic_compare_exchange_resultu32 res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_83580d(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3f46597640 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +groupshared uint arg_0; + +void atomicCompareExchangeWeak_83580d() { + atomic_compare_exchange_resultu32 atomic_result = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = 1u; + InterlockedCompareExchange(arg_0, atomic_compare_value, 1u, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + atomic_compare_exchange_resultu32 res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_83580d(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl new file mode 100644 index 0000000000..589a98f416 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl @@ -0,0 +1,29 @@ +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +shared uint arg_0; +void atomicCompareExchangeWeak_83580d() { + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, 1u, 1u); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; + atomic_compare_exchange_resultu32 res = atomic_compare_result; +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicCompareExchangeWeak_83580d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.msl new file mode 100644 index 0000000000..effc1417eb --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(threadgroup atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol) { + atomic_compare_exchange_resultu32 res = atomicCompareExchangeWeak_1(tint_symbol, 1u, 1u); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_83580d(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm new file mode 100644 index 0000000000..826498596a --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_83580d "atomicCompareExchangeWeak_83580d" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %21 = OpConstantNull %__atomic_compare_exchange_resultu32 + %22 = OpTypeFunction %void %uint + %28 = OpConstantNull %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_83580d = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %21 + %17 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %uint_1 %uint_1 + %18 = OpIEqual %bool %17 %uint_1 + %10 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %17 %18 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %22 +%local_invocation_index = OpFunctionParameter %uint + %25 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %28 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %31 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %35 = OpLoad %uint %local_invocation_index_1 + %34 = OpFunctionCall %void %compute_main_inner %35 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl new file mode 100644 index 0000000000..aec8cabe46 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_83580d() { + var res = atomicCompareExchangeWeak(&(arg_0), 1u, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_83580d(); +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl new file mode 100644 index 0000000000..dd6cf84e9d --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicCompareExchangeWeak(ptr, read_write>, i32, i32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_e88938() { + var res = atomicCompareExchangeWeak(&arg_0, 1, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_e88938(); +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d201c49d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +groupshared int arg_0; + +void atomicCompareExchangeWeak_e88938() { + atomic_compare_exchange_resulti32 atomic_result = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value = 1; + InterlockedCompareExchange(arg_0, atomic_compare_value, 1, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + atomic_compare_exchange_resulti32 res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_e88938(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d201c49d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +groupshared int arg_0; + +void atomicCompareExchangeWeak_e88938() { + atomic_compare_exchange_resulti32 atomic_result = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value = 1; + InterlockedCompareExchange(arg_0, atomic_compare_value, 1, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + atomic_compare_exchange_resulti32 res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_e88938(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl new file mode 100644 index 0000000000..ff5e7a1b5e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl @@ -0,0 +1,29 @@ +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +shared int arg_0; +void atomicCompareExchangeWeak_e88938() { + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, 1, 1); + atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; + atomic_compare_exchange_resulti32 res = atomic_compare_result; +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicCompareExchangeWeak_e88938(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.msl new file mode 100644 index 0000000000..2843d71cf2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(threadgroup atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol) { + atomic_compare_exchange_resulti32 res = atomicCompareExchangeWeak_1(tint_symbol, 1, 1); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_e88938(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0f338c664 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_e88938 "atomicCompareExchangeWeak_e88938" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %22 = OpConstantNull %__atomic_compare_exchange_resulti32 + %23 = OpTypeFunction %void %uint + %29 = OpConstantNull %int + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_e88938 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %22 + %18 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %int_1 %int_1 + %19 = OpIEqual %bool %18 %int_1 + %11 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %18 %19 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %23 +%local_invocation_index = OpFunctionParameter %uint + %26 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %29 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %32 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %34 = OpLabel + %36 = OpLoad %uint %local_invocation_index_1 + %35 = OpFunctionCall %void %compute_main_inner %36 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl new file mode 100644 index 0000000000..d79317dd77 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_e88938() { + var res = atomicCompareExchangeWeak(&(arg_0), 1, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_e88938(); +} diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl new file mode 100644 index 0000000000..ba54de623a --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicExchange(ptr, read_write>, u32) -> u32 +fn atomicExchange_0a5dca() { + var res: u32 = atomicExchange(&arg_0, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_0a5dca(); +} diff --git a/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..86bcffa267 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicExchange_0a5dca() { + uint atomic_result = 0u; + InterlockedExchange(arg_0, 1u, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicExchange_0a5dca(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicExchange/0a5dca.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.msl new file mode 100644 index 0000000000..392a929458 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicExchange_0a5dca(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_exchange_explicit(tint_symbol, 1u, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_0a5dca(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.spvasm new file mode 100644 index 0000000000..23dbf0273e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_0a5dca "atomicExchange_0a5dca" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_0a5dca = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicExchange_0a5dca + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.wgsl new file mode 100644 index 0000000000..cf1786b157 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicExchange_0a5dca() { + var res : u32 = atomicExchange(&(arg_0), 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_0a5dca(); +} diff --git a/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl new file mode 100644 index 0000000000..de7a46809e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicExchange(ptr, read_write>, u32) -> u32 +fn atomicExchange_d59712() { + var res: u32 = atomicExchange(&sb_rw.arg_0, 1u); +} + +@fragment +fn fragment_main() { + atomicExchange_d59712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_d59712(); +} diff --git a/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b40e1463d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_d59712() { + uint res = tint_atomicExchange(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicExchange_d59712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_d59712(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b40e1463d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_d59712() { + uint res = tint_atomicExchange(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicExchange_d59712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_d59712(); + return; +} diff --git a/test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicExchange/d59712.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.spvasm new file mode 100644 index 0000000000..bdd9e1de57 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_d59712 "atomicExchange_d59712" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicExchange_d59712 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicExchange %uint %14 %uint_1 %uint_0 %uint_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fda8048c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicExchange_d59712() { + var res : u32 = atomicExchange(&(sb_rw.arg_0), 1u); +} + +@fragment +fn fragment_main() { + atomicExchange_d59712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_d59712(); +} diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl new file mode 100644 index 0000000000..d43ce44bf1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicExchange(ptr, read_write>, i32) -> i32 +fn atomicExchange_e114ba() { + var res: i32 = atomicExchange(&arg_0, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_e114ba(); +} diff --git a/test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3efb49280e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicExchange_e114ba() { + int atomic_result = 0; + InterlockedExchange(arg_0, 1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicExchange_e114ba(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicExchange/e114ba.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.msl new file mode 100644 index 0000000000..d213dff104 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicExchange_e114ba(threadgroup atomic_int* const tint_symbol) { + int res = atomic_exchange_explicit(tint_symbol, 1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_e114ba(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..b541d6b05e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_e114ba "atomicExchange_e114ba" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_e114ba = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicExchange_e114ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..785a006c64 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicExchange_e114ba() { + var res : i32 = atomicExchange(&(arg_0), 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_e114ba(); +} diff --git a/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl new file mode 100644 index 0000000000..0aa2f620ba --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicExchange(ptr, read_write>, i32) -> i32 +fn atomicExchange_f2e22f() { + var res: i32 = atomicExchange(&sb_rw.arg_0, 1); +} + +@fragment +fn fragment_main() { + atomicExchange_f2e22f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_f2e22f(); +} diff --git a/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ea1abc5d03 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_f2e22f() { + int res = tint_atomicExchange(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicExchange_f2e22f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_f2e22f(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ea1abc5d03 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_f2e22f() { + int res = tint_atomicExchange(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicExchange_f2e22f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_f2e22f(); + return; +} diff --git a/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicExchange/f2e22f.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4f71e9285 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_f2e22f "atomicExchange_f2e22f" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicExchange_f2e22f = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicExchange %int %15 %uint_1 %uint_0 %int_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b473d29d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicExchange_f2e22f() { + var res : i32 = atomicExchange(&(sb_rw.arg_0), 1); +} + +@fragment +fn fragment_main() { + atomicExchange_f2e22f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_f2e22f(); +} diff --git a/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl new file mode 100644 index 0000000000..488d6641ba --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicLoad(ptr, read_write>) -> i32 +fn atomicLoad_0806ad() { + var res: i32 = atomicLoad(&sb_rw.arg_0); +} + +@fragment +fn fragment_main() { + atomicLoad_0806ad(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_0806ad(); +} diff --git a/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a278b2c16c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_0806ad() { + int res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_0806ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_0806ad(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a278b2c16c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_0806ad() { + int res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_0806ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_0806ad(); + return; +} diff --git a/test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicLoad/0806ad.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.spvasm new file mode 100644 index 0000000000..d961ea5c86 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_0806ad "atomicLoad_0806ad" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int +%atomicLoad_0806ad = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicLoad %int %15 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.wgsl new file mode 100644 index 0000000000..06c2703d56 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicLoad_0806ad() { + var res : i32 = atomicLoad(&(sb_rw.arg_0)); +} + +@fragment +fn fragment_main() { + atomicLoad_0806ad(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_0806ad(); +} diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl new file mode 100644 index 0000000000..162c19f577 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicLoad(ptr, read_write>) -> u32 +fn atomicLoad_361bf1() { + var res: u32 = atomicLoad(&arg_0); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_361bf1(); +} diff --git a/test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0f031f320 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicLoad_361bf1() { + uint atomic_result = 0u; + InterlockedOr(arg_0, 0, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicLoad_361bf1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicLoad/361bf1.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.msl new file mode 100644 index 0000000000..eedf946e10 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicLoad_361bf1(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_load_explicit(tint_symbol, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_361bf1(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.spvasm new file mode 100644 index 0000000000..20eeca7ef5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_361bf1 "atomicLoad_361bf1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %17 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_361bf1 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %16 + %10 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %17 +%local_invocation_index = OpFunctionParameter %uint + %20 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %16 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %25 = OpFunctionCall %void %atomicLoad_361bf1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %29 = OpLoad %uint %local_invocation_index_1 + %28 = OpFunctionCall %void %compute_main_inner %29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.wgsl new file mode 100644 index 0000000000..2fb4caaf45 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicLoad_361bf1() { + var res : u32 = atomicLoad(&(arg_0)); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_361bf1(); +} diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl new file mode 100644 index 0000000000..5b2faf20ff --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicLoad(ptr, read_write>) -> i32 +fn atomicLoad_afcc03() { + var res: i32 = atomicLoad(&arg_0); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_afcc03(); +} diff --git a/test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..adf265f6aa --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicLoad_afcc03() { + int atomic_result = 0; + InterlockedOr(arg_0, 0, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicLoad_afcc03(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicLoad/afcc03.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.msl new file mode 100644 index 0000000000..90d483da2f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicLoad_afcc03(threadgroup atomic_int* const tint_symbol) { + int res = atomic_load_explicit(tint_symbol, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_afcc03(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.spvasm new file mode 100644 index 0000000000..b996359601 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_afcc03 "atomicLoad_afcc03" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_afcc03 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %17 + %11 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicLoad_afcc03 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.wgsl new file mode 100644 index 0000000000..37509cad76 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicLoad_afcc03() { + var res : i32 = atomicLoad(&(arg_0)); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_afcc03(); +} diff --git a/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl new file mode 100644 index 0000000000..47b80d7084 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicLoad(ptr, read_write>) -> u32 +fn atomicLoad_fe6cc3() { + var res: u32 = atomicLoad(&sb_rw.arg_0); +} + +@fragment +fn fragment_main() { + atomicLoad_fe6cc3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_fe6cc3(); +} diff --git a/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..77edab3db2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_fe6cc3() { + uint res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_fe6cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_fe6cc3(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77edab3db2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_fe6cc3() { + uint res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_fe6cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_fe6cc3(); + return; +} diff --git a/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicLoad/fe6cc3.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.spvasm new file mode 100644 index 0000000000..776c62c09f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_fe6cc3 "atomicLoad_fe6cc3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicLoad_fe6cc3 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicLoad %uint %14 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.wgsl new file mode 100644 index 0000000000..8691467386 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicLoad_fe6cc3() { + var res : u32 = atomicLoad(&(sb_rw.arg_0)); +} + +@fragment +fn fragment_main() { + atomicLoad_fe6cc3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_fe6cc3(); +} diff --git a/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl new file mode 100644 index 0000000000..343151e98d --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMax(ptr, read_write>, u32) -> u32 +fn atomicMax_51b9be() { + var res: u32 = atomicMax(&sb_rw.arg_0, 1u); +} + +@fragment +fn fragment_main() { + atomicMax_51b9be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_51b9be(); +} diff --git a/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c8f0893154 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_51b9be() { + uint res = tint_atomicMax(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicMax_51b9be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_51b9be(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c8f0893154 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_51b9be() { + uint res = tint_atomicMax(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicMax_51b9be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_51b9be(); + return; +} diff --git a/test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicMax/51b9be.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fb135e806 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_51b9be "atomicMax_51b9be" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicMax_51b9be = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicUMax %uint %14 %uint_1 %uint_0 %uint_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.wgsl new file mode 100644 index 0000000000..f59ae6d2c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMax_51b9be() { + var res : u32 = atomicMax(&(sb_rw.arg_0), 1u); +} + +@fragment +fn fragment_main() { + atomicMax_51b9be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_51b9be(); +} diff --git a/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl new file mode 100644 index 0000000000..14c6da0694 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMax(ptr, read_write>, i32) -> i32 +fn atomicMax_92aa72() { + var res: i32 = atomicMax(&sb_rw.arg_0, 1); +} + +@fragment +fn fragment_main() { + atomicMax_92aa72(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_92aa72(); +} diff --git a/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f3d398cc33 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_92aa72() { + int res = tint_atomicMax(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicMax_92aa72(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_92aa72(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f3d398cc33 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_92aa72() { + int res = tint_atomicMax(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicMax_92aa72(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_92aa72(); + return; +} diff --git a/test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicMax/92aa72.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.spvasm new file mode 100644 index 0000000000..82be997072 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_92aa72 "atomicMax_92aa72" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicMax_92aa72 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicSMax %int %15 %uint_1 %uint_0 %int_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.wgsl new file mode 100644 index 0000000000..ead8895279 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMax_92aa72() { + var res : i32 = atomicMax(&(sb_rw.arg_0), 1); +} + +@fragment +fn fragment_main() { + atomicMax_92aa72(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_92aa72(); +} diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl new file mode 100644 index 0000000000..54d1a7d4c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMax(ptr, read_write>, i32) -> i32 +fn atomicMax_a89cc3() { + var res: i32 = atomicMax(&arg_0, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_a89cc3(); +} diff --git a/test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c5602f1156 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicMax_a89cc3() { + int atomic_result = 0; + InterlockedMax(arg_0, 1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMax_a89cc3(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicMax/a89cc3.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.msl new file mode 100644 index 0000000000..bf92158a05 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicMax_a89cc3(threadgroup atomic_int* const tint_symbol) { + int res = atomic_fetch_max_explicit(tint_symbol, 1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_a89cc3(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.spvasm new file mode 100644 index 0000000000..62355e0b45 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_a89cc3 "atomicMax_a89cc3" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_a89cc3 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicMax_a89cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.wgsl new file mode 100644 index 0000000000..80c0ae1dc7 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicMax_a89cc3() { + var res : i32 = atomicMax(&(arg_0), 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_a89cc3(); +} diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl new file mode 100644 index 0000000000..d259922e58 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMax(ptr, read_write>, u32) -> u32 +fn atomicMax_beccfc() { + var res: u32 = atomicMax(&arg_0, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_beccfc(); +} diff --git a/test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0b3f279602 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicMax_beccfc() { + uint atomic_result = 0u; + InterlockedMax(arg_0, 1u, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMax_beccfc(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicMax/beccfc.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.msl new file mode 100644 index 0000000000..a0d53b910f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicMax_beccfc(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_fetch_max_explicit(tint_symbol, 1u, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_beccfc(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.spvasm new file mode 100644 index 0000000000..2636c66b27 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_beccfc "atomicMax_beccfc" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_beccfc = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicMax_beccfc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b1f90af57 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicMax_beccfc() { + var res : u32 = atomicMax(&(arg_0), 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_beccfc(); +} diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl new file mode 100644 index 0000000000..7d658b5776 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMin(ptr, read_write>, i32) -> i32 +fn atomicMin_278235() { + var res: i32 = atomicMin(&arg_0, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_278235(); +} diff --git a/test/tint/builtins/gen/atomicMin/278235.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicMin/278235.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c719099fb --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicMin_278235() { + int atomic_result = 0; + InterlockedMin(arg_0, 1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMin_278235(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicMin/278235.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicMin/278235.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.msl new file mode 100644 index 0000000000..afc4fe065a --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicMin_278235(threadgroup atomic_int* const tint_symbol) { + int res = atomic_fetch_min_explicit(tint_symbol, 1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_278235(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.spvasm new file mode 100644 index 0000000000..dfe5a35d90 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_278235 "atomicMin_278235" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_278235 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicMin_278235 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.wgsl new file mode 100644 index 0000000000..9619e26b15 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicMin_278235() { + var res : i32 = atomicMin(&(arg_0), 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_278235(); +} diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl new file mode 100644 index 0000000000..7953d53ce9 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMin(ptr, read_write>, u32) -> u32 +fn atomicMin_69d383() { + var res: u32 = atomicMin(&arg_0, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_69d383(); +} diff --git a/test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..61d7265882 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicMin_69d383() { + uint atomic_result = 0u; + InterlockedMin(arg_0, 1u, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMin_69d383(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicMin/69d383.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.msl new file mode 100644 index 0000000000..166a4c200c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicMin_69d383(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_fetch_min_explicit(tint_symbol, 1u, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_69d383(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.spvasm new file mode 100644 index 0000000000..de92bee074 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_69d383 "atomicMin_69d383" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_69d383 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicMin_69d383 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fba69fce8 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicMin_69d383() { + var res : u32 = atomicMin(&(arg_0), 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_69d383(); +} diff --git a/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl new file mode 100644 index 0000000000..51a59ced37 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMin(ptr, read_write>, i32) -> i32 +fn atomicMin_8e38dc() { + var res: i32 = atomicMin(&sb_rw.arg_0, 1); +} + +@fragment +fn fragment_main() { + atomicMin_8e38dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_8e38dc(); +} diff --git a/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b8d48b8247 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_8e38dc() { + int res = tint_atomicMin(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicMin_8e38dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_8e38dc(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b8d48b8247 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_8e38dc() { + int res = tint_atomicMin(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicMin_8e38dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_8e38dc(); + return; +} diff --git a/test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicMin/8e38dc.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.spvasm new file mode 100644 index 0000000000..660547b5d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_8e38dc "atomicMin_8e38dc" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicMin_8e38dc = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicSMin %int %15 %uint_1 %uint_0 %int_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b649669ed --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMin_8e38dc() { + var res : i32 = atomicMin(&(sb_rw.arg_0), 1); +} + +@fragment +fn fragment_main() { + atomicMin_8e38dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_8e38dc(); +} diff --git a/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl new file mode 100644 index 0000000000..84d26bc5f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMin(ptr, read_write>, u32) -> u32 +fn atomicMin_c67a74() { + var res: u32 = atomicMin(&sb_rw.arg_0, 1u); +} + +@fragment +fn fragment_main() { + atomicMin_c67a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_c67a74(); +} diff --git a/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3ae5176288 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_c67a74() { + uint res = tint_atomicMin(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicMin_c67a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_c67a74(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ae5176288 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_c67a74() { + uint res = tint_atomicMin(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicMin_c67a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_c67a74(); + return; +} diff --git a/test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicMin/c67a74.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.spvasm new file mode 100644 index 0000000000..0ed9315fd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_c67a74 "atomicMin_c67a74" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicMin_c67a74 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicUMin %uint %14 %uint_1 %uint_0 %uint_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd9b000264 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMin_c67a74() { + var res : u32 = atomicMin(&(sb_rw.arg_0), 1u); +} + +@fragment +fn fragment_main() { + atomicMin_c67a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_c67a74(); +} diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl new file mode 100644 index 0000000000..4595126e55 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicOr(ptr, read_write>, u32) -> u32 +fn atomicOr_5e3d61() { + var res: u32 = atomicOr(&arg_0, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_5e3d61(); +} diff --git a/test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..da41f0c373 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicOr_5e3d61() { + uint atomic_result = 0u; + InterlockedOr(arg_0, 1u, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicOr_5e3d61(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicOr/5e3d61.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.msl new file mode 100644 index 0000000000..9527616f33 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicOr_5e3d61(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_fetch_or_explicit(tint_symbol, 1u, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_5e3d61(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b9dc279ab --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_5e3d61 "atomicOr_5e3d61" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_5e3d61 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicOr_5e3d61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.wgsl new file mode 100644 index 0000000000..9de0d3fd98 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicOr_5e3d61() { + var res : u32 = atomicOr(&(arg_0), 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_5e3d61(); +} diff --git a/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl new file mode 100644 index 0000000000..cc7dcec350 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicOr(ptr, read_write>, u32) -> u32 +fn atomicOr_5e95d4() { + var res: u32 = atomicOr(&sb_rw.arg_0, 1u); +} + +@fragment +fn fragment_main() { + atomicOr_5e95d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_5e95d4(); +} diff --git a/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..97883cbd8c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_5e95d4() { + uint res = tint_atomicOr(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicOr_5e95d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_5e95d4(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..97883cbd8c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_5e95d4() { + uint res = tint_atomicOr(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicOr_5e95d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_5e95d4(); + return; +} diff --git a/test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicOr/5e95d4.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..4778bc871a --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_5e95d4 "atomicOr_5e95d4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicOr_5e95d4 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicOr %uint %14 %uint_1 %uint_0 %uint_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..839af64eec --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicOr_5e95d4() { + var res : u32 = atomicOr(&(sb_rw.arg_0), 1u); +} + +@fragment +fn fragment_main() { + atomicOr_5e95d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_5e95d4(); +} diff --git a/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl new file mode 100644 index 0000000000..eb3bce7ee4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicOr(ptr, read_write>, i32) -> i32 +fn atomicOr_8d96a0() { + var res: i32 = atomicOr(&sb_rw.arg_0, 1); +} + +@fragment +fn fragment_main() { + atomicOr_8d96a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_8d96a0(); +} diff --git a/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..04be9d7304 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_8d96a0() { + int res = tint_atomicOr(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicOr_8d96a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_8d96a0(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04be9d7304 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_8d96a0() { + int res = tint_atomicOr(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicOr_8d96a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_8d96a0(); + return; +} diff --git a/test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicOr/8d96a0.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..1bf00f2122 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_8d96a0 "atomicOr_8d96a0" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicOr_8d96a0 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicOr %int %15 %uint_1 %uint_0 %int_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..9cae8d3563 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicOr_8d96a0() { + var res : i32 = atomicOr(&(sb_rw.arg_0), 1); +} + +@fragment +fn fragment_main() { + atomicOr_8d96a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_8d96a0(); +} diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl new file mode 100644 index 0000000000..c5734d8efd --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicOr(ptr, read_write>, i32) -> i32 +fn atomicOr_d09248() { + var res: i32 = atomicOr(&arg_0, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_d09248(); +} diff --git a/test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2831e1b12d --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicOr_d09248() { + int atomic_result = 0; + InterlockedOr(arg_0, 1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicOr_d09248(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicOr/d09248.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.msl new file mode 100644 index 0000000000..0d50df3409 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicOr_d09248(threadgroup atomic_int* const tint_symbol) { + int res = atomic_fetch_or_explicit(tint_symbol, 1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_d09248(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd14aa9656 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_d09248 "atomicOr_d09248" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_d09248 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicOr_d09248 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.wgsl new file mode 100644 index 0000000000..38bb4627ce --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicOr_d09248() { + var res : i32 = atomicOr(&(arg_0), 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_d09248(); +} diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl new file mode 100644 index 0000000000..be7c8ea190 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicStore(ptr, read_write>, u32) +fn atomicStore_726882() { + atomicStore(&arg_0, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_726882(); +} diff --git a/test/tint/builtins/gen/atomicStore/726882.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicStore/726882.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..45393224fb --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +groupshared uint arg_0; + +void atomicStore_726882() { + uint atomic_result = 0u; + InterlockedExchange(arg_0, 1u, atomic_result); +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicStore_726882(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicStore/726882.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicStore/726882.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.msl new file mode 100644 index 0000000000..67f1592889 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicStore_726882(threadgroup atomic_uint* const tint_symbol) { + atomic_store_explicit(tint_symbol, 1u, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_726882(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.spvasm new file mode 100644 index 0000000000..59738ef83f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.spvasm @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_726882 "atomicStore_726882" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %15 = OpTypeFunction %void %uint + %21 = OpConstantNull %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_726882 = OpFunction %void None %6 + %9 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %15 +%local_invocation_index = OpFunctionParameter %uint + %18 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %21 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %24 = OpFunctionCall %void %atomicStore_726882 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %26 = OpLabel + %28 = OpLoad %uint %local_invocation_index_1 + %27 = OpFunctionCall %void %compute_main_inner %28 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.wgsl new file mode 100644 index 0000000000..e50c9e2844 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicStore_726882() { + atomicStore(&(arg_0), 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_726882(); +} diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl new file mode 100644 index 0000000000..bed87929f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicStore(ptr, read_write>, i32) +fn atomicStore_8bea94() { + atomicStore(&arg_0, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_8bea94(); +} diff --git a/test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d6dbcdcbf1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +groupshared int arg_0; + +void atomicStore_8bea94() { + int atomic_result = 0; + InterlockedExchange(arg_0, 1, atomic_result); +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicStore_8bea94(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicStore/8bea94.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.msl new file mode 100644 index 0000000000..b549a08e96 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicStore_8bea94(threadgroup atomic_int* const tint_symbol) { + atomic_store_explicit(tint_symbol, 1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_8bea94(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.spvasm new file mode 100644 index 0000000000..a08c2e8563 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.spvasm @@ -0,0 +1,49 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_8bea94 "atomicStore_8bea94" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %16 = OpTypeFunction %void %uint + %22 = OpConstantNull %int + %uint_264 = OpConstant %uint 264 +%atomicStore_8bea94 = OpFunction %void None %7 + %10 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %int_1 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %16 +%local_invocation_index = OpFunctionParameter %uint + %19 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %22 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %25 = OpFunctionCall %void %atomicStore_8bea94 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %27 = OpLabel + %29 = OpLoad %uint %local_invocation_index_1 + %28 = OpFunctionCall %void %compute_main_inner %29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2394c20ea --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicStore_8bea94() { + atomicStore(&(arg_0), 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_8bea94(); +} diff --git a/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl new file mode 100644 index 0000000000..734c66c4e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicStore(ptr, read_write>, u32) +fn atomicStore_cdc29e() { + atomicStore(&sb_rw.arg_0, 1u); +} + +@fragment +fn fragment_main() { + atomicStore_cdc29e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_cdc29e(); +} diff --git a/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cb8cfddaab --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.dxc.hlsl @@ -0,0 +1,22 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) { + uint ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_cdc29e() { + tint_atomicStore(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicStore_cdc29e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_cdc29e(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cb8cfddaab --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) { + uint ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_cdc29e() { + tint_atomicStore(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicStore_cdc29e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_cdc29e(); + return; +} diff --git a/test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicStore/cdc29e.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.spvasm new file mode 100644 index 0000000000..97adea0c19 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_cdc29e "atomicStore_cdc29e" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicStore_cdc29e = OpFunction %void None %5 + %8 = OpLabel + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + OpAtomicStore %14 %uint_1 %uint_0 %uint_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %16 = OpLabel + %17 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.wgsl new file mode 100644 index 0000000000..61aa944e65 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicStore_cdc29e() { + atomicStore(&(sb_rw.arg_0), 1u); +} + +@fragment +fn fragment_main() { + atomicStore_cdc29e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_cdc29e(); +} diff --git a/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl new file mode 100644 index 0000000000..72876763da --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicStore(ptr, read_write>, i32) +fn atomicStore_d1e9a6() { + atomicStore(&sb_rw.arg_0, 1); +} + +@fragment +fn fragment_main() { + atomicStore_d1e9a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_d1e9a6(); +} diff --git a/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..599f575c7f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,22 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_d1e9a6() { + tint_atomicStore(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicStore_d1e9a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_d1e9a6(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..599f575c7f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_d1e9a6() { + tint_atomicStore(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicStore_d1e9a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_d1e9a6(); + return; +} diff --git a/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicStore/d1e9a6.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..a4714333c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.spvasm @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_d1e9a6 "atomicStore_d1e9a6" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%atomicStore_d1e9a6 = OpFunction %void None %5 + %8 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + OpAtomicStore %15 %uint_1 %uint_0 %int_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %18 = OpLabel + %19 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7c02a6cd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicStore_d1e9a6() { + atomicStore(&(sb_rw.arg_0), 1); +} + +@fragment +fn fragment_main() { + atomicStore_d1e9a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_d1e9a6(); +} diff --git a/test/tint/builtins/gen/literal/atomicSub/051100.wgsl b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl new file mode 100644 index 0000000000..a5584b3bf2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicSub(ptr, read_write>, i32) -> i32 +fn atomicSub_051100() { + var res: i32 = atomicSub(&sb_rw.arg_0, 1); +} + +@fragment +fn fragment_main() { + atomicSub_051100(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_051100(); +} diff --git a/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..29d8e0413c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_051100() { + int res = tint_atomicSub(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicSub_051100(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_051100(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..29d8e0413c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_051100() { + int res = tint_atomicSub(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicSub_051100(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_051100(); + return; +} diff --git a/test/tint/builtins/gen/atomicSub/051100.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicSub/051100.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicSub/051100.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicSub/051100.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.spvasm new file mode 100644 index 0000000000..f4b9264241 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_051100 "atomicSub_051100" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicSub_051100 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicISub %int %15 %uint_1 %uint_0 %int_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.wgsl new file mode 100644 index 0000000000..539fd24935 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicSub_051100() { + var res : i32 = atomicSub(&(sb_rw.arg_0), 1); +} + +@fragment +fn fragment_main() { + atomicSub_051100(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_051100(); +} diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl new file mode 100644 index 0000000000..ba6fd50c86 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicSub(ptr, read_write>, u32) -> u32 +fn atomicSub_0d26c2() { + var res: u32 = atomicSub(&arg_0, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_0d26c2(); +} diff --git a/test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..caddb67159 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicSub_0d26c2() { + uint atomic_result = 0u; + InterlockedAdd(arg_0, -1u, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicSub_0d26c2(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicSub/0d26c2.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.msl new file mode 100644 index 0000000000..9ea6c9775c --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicSub_0d26c2(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_fetch_sub_explicit(tint_symbol, 1u, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_0d26c2(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.spvasm new file mode 100644 index 0000000000..0412631633 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_0d26c2 "atomicSub_0d26c2" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_0d26c2 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicSub_0d26c2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.wgsl new file mode 100644 index 0000000000..fcbe53cf4f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicSub_0d26c2() { + var res : u32 = atomicSub(&(arg_0), 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_0d26c2(); +} diff --git a/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl new file mode 100644 index 0000000000..eb42db4ff5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicSub(ptr, read_write>, u32) -> u32 +fn atomicSub_15bfc9() { + var res: u32 = atomicSub(&sb_rw.arg_0, 1u); +} + +@fragment +fn fragment_main() { + atomicSub_15bfc9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_15bfc9(); +} diff --git a/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e5d0027b60 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_15bfc9() { + uint res = tint_atomicSub(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicSub_15bfc9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_15bfc9(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5d0027b60 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_15bfc9() { + uint res = tint_atomicSub(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicSub_15bfc9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_15bfc9(); + return; +} diff --git a/test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicSub/15bfc9.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.spvasm new file mode 100644 index 0000000000..b7cd92d87a --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_15bfc9 "atomicSub_15bfc9" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicSub_15bfc9 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicISub %uint %14 %uint_1 %uint_0 %uint_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d1ad29659 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicSub_15bfc9() { + var res : u32 = atomicSub(&(sb_rw.arg_0), 1u); +} + +@fragment +fn fragment_main() { + atomicSub_15bfc9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_15bfc9(); +} diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl new file mode 100644 index 0000000000..93a1ced577 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicSub(ptr, read_write>, i32) -> i32 +fn atomicSub_77883a() { + var res: i32 = atomicSub(&arg_0, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_77883a(); +} diff --git a/test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7ba0481586 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicSub_77883a() { + int atomic_result = 0; + InterlockedAdd(arg_0, -1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicSub_77883a(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicSub/77883a.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.msl new file mode 100644 index 0000000000..af2c77b2d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicSub_77883a(threadgroup atomic_int* const tint_symbol) { + int res = atomic_fetch_sub_explicit(tint_symbol, 1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_77883a(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.spvasm new file mode 100644 index 0000000000..f0471bef79 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_77883a "atomicSub_77883a" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_77883a = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicSub_77883a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.wgsl new file mode 100644 index 0000000000..3443f94c5f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicSub_77883a() { + var res : i32 = atomicSub(&(arg_0), 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_77883a(); +} diff --git a/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl new file mode 100644 index 0000000000..d94df352d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicXor(ptr, read_write>, u32) -> u32 +fn atomicXor_54510e() { + var res: u32 = atomicXor(&sb_rw.arg_0, 1u); +} + +@fragment +fn fragment_main() { + atomicXor_54510e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_54510e(); +} diff --git a/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9ed582e64e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_54510e() { + uint res = tint_atomicXor(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicXor_54510e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_54510e(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9ed582e64e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_54510e() { + uint res = tint_atomicXor(sb_rw, 0u, 1u); +} + +void fragment_main() { + atomicXor_54510e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_54510e(); + return; +} diff --git a/test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicXor/54510e.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.spvasm new file mode 100644 index 0000000000..8b4ef2178f --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_54510e "atomicXor_54510e" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicXor_54510e = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicXor %uint %14 %uint_1 %uint_0 %uint_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.wgsl new file mode 100644 index 0000000000..b77110249e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicXor_54510e() { + var res : u32 = atomicXor(&(sb_rw.arg_0), 1u); +} + +@fragment +fn fragment_main() { + atomicXor_54510e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_54510e(); +} diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl new file mode 100644 index 0000000000..6e384a03f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicXor(ptr, read_write>, i32) -> i32 +fn atomicXor_75dc95() { + var res: i32 = atomicXor(&arg_0, 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_75dc95(); +} diff --git a/test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f9cc3d2e9a --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicXor_75dc95() { + int atomic_result = 0; + InterlockedXor(arg_0, 1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicXor_75dc95(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicXor/75dc95.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.msl new file mode 100644 index 0000000000..83e290b8d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicXor_75dc95(threadgroup atomic_int* const tint_symbol) { + int res = atomic_fetch_xor_explicit(tint_symbol, 1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_75dc95(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.spvasm new file mode 100644 index 0000000000..4e729e26a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_75dc95 "atomicXor_75dc95" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_75dc95 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %11 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %int_1 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicXor_75dc95 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.wgsl new file mode 100644 index 0000000000..30add298d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicXor_75dc95() { + var res : i32 = atomicXor(&(arg_0), 1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_75dc95(); +} diff --git a/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl new file mode 100644 index 0000000000..1e2e4dbc52 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicXor(ptr, read_write>, i32) -> i32 +fn atomicXor_c1b78c() { + var res: i32 = atomicXor(&sb_rw.arg_0, 1); +} + +@fragment +fn fragment_main() { + atomicXor_c1b78c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_c1b78c(); +} diff --git a/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bb38f4211e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_c1b78c() { + int res = tint_atomicXor(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicXor_c1b78c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_c1b78c(); + return; +} diff --git a/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bb38f4211e --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_c1b78c() { + int res = tint_atomicXor(sb_rw, 0u, 1); +} + +void fragment_main() { + atomicXor_c1b78c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_c1b78c(); + return; +} diff --git a/test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/atomicXor/c1b78c.wgsl.expected.msl rename to test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.msl diff --git a/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.spvasm new file mode 100644 index 0000000000..98ac9c2b98 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_c1b78c "atomicXor_c1b78c" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%atomicXor_c1b78c = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicXor %int %15 %uint_1 %uint_0 %int_1 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.wgsl new file mode 100644 index 0000000000..c63962c52a --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicXor_c1b78c() { + var res : i32 = atomicXor(&(sb_rw.arg_0), 1); +} + +@fragment +fn fragment_main() { + atomicXor_c1b78c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_c1b78c(); +} diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl new file mode 100644 index 0000000000..15fa813da7 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicXor(ptr, read_write>, u32) -> u32 +fn atomicXor_c8e6be() { + var res: u32 = atomicXor(&arg_0, 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_c8e6be(); +} diff --git a/test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..404268dc92 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicXor_c8e6be() { + uint atomic_result = 0u; + InterlockedXor(arg_0, 1u, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicXor_c8e6be(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/atomicXor/c8e6be.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.msl new file mode 100644 index 0000000000..41b94a05eb --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicXor_c8e6be(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_fetch_xor_explicit(tint_symbol, 1u, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_c8e6be(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.spvasm new file mode 100644 index 0000000000..a683557b8d --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_c8e6be "atomicXor_c8e6be" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_c8e6be = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %10 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %uint_1 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicXor_c8e6be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6bb2b9bb2 --- /dev/null +++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicXor_c8e6be() { + var res : u32 = atomicXor(&(arg_0), 1u); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_c8e6be(); +} diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl new file mode 100644 index 0000000000..6705f27d4b --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<3, f16>) -> vec<3, f16> +fn ceil_09bf52() { + var res: vec3 = ceil(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_09bf52(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_09bf52(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_09bf52(); +} diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a2d17ace87 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_09bf52() { + vector res = ceil((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_09bf52(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_09bf52(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21a195eba5 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ceil_09bf52() { + vector res = ceil((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_09bf52(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_09bf52(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013DAD2D1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.glsl new file mode 100644 index 0000000000..5a83910aa3 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_09bf52() { + f16vec3 res = ceil(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + ceil_09bf52(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_09bf52() { + f16vec3 res = ceil(f16vec3(0.0hf)); +} + +void fragment_main() { + ceil_09bf52(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_09bf52() { + f16vec3 res = ceil(f16vec3(0.0hf)); +} + +void compute_main() { + ceil_09bf52(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.msl new file mode 100644 index 0000000000..7d0d6886a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_09bf52() { + half3 res = ceil(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_09bf52(); + return; +} + +kernel void compute_main() { + ceil_09bf52(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b871057ac --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_09bf52 "ceil_09bf52" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_09bf52 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Ceil %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %ceil_09bf52 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %ceil_09bf52 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %ceil_09bf52 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d5fc84e33 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/09bf52.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ceil_09bf52() { + var res : vec3 = ceil(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_09bf52(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_09bf52(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_09bf52(); +} diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl new file mode 100644 index 0000000000..002bcdc5fc --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<2, f16>) -> vec<2, f16> +fn ceil_18c240() { + var res: vec2 = ceil(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_18c240(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_18c240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_18c240(); +} diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0397f161d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_18c240() { + vector res = ceil((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_18c240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_18c240(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..59bf2e8e13 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ceil_18c240() { + vector res = ceil((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_18c240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_18c240(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024369541160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.glsl new file mode 100644 index 0000000000..b4375a2a31 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_18c240() { + f16vec2 res = ceil(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + ceil_18c240(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_18c240() { + f16vec2 res = ceil(f16vec2(0.0hf)); +} + +void fragment_main() { + ceil_18c240(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_18c240() { + f16vec2 res = ceil(f16vec2(0.0hf)); +} + +void compute_main() { + ceil_18c240(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.msl new file mode 100644 index 0000000000..b656d4c41e --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_18c240() { + half2 res = ceil(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_18c240(); + return; +} + +kernel void compute_main() { + ceil_18c240(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.spvasm new file mode 100644 index 0000000000..757b0b4fc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_18c240 "ceil_18c240" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_18c240 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Ceil %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %ceil_18c240 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %ceil_18c240 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %ceil_18c240 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.wgsl new file mode 100644 index 0000000000..dad05fe866 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/18c240.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ceil_18c240() { + var res : vec2 = ceil(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_18c240(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_18c240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_18c240(); +} diff --git a/test/tint/builtins/gen/literal/ceil/34064b.wgsl b/test/tint/builtins/gen/literal/ceil/34064b.wgsl new file mode 100644 index 0000000000..33e3a508e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/34064b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(vec<3, f32>) -> vec<3, f32> +fn ceil_34064b() { + var res: vec3 = ceil(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_34064b(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_34064b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_34064b(); +} diff --git a/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2e8c4cef2f --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_34064b() { + float3 res = ceil((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_34064b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_34064b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_34064b(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e8c4cef2f --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void ceil_34064b() { + float3 res = ceil((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_34064b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_34064b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_34064b(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.glsl new file mode 100644 index 0000000000..35f80ffc0b --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void ceil_34064b() { + vec3 res = ceil(vec3(1.0f)); +} + +vec4 vertex_main() { + ceil_34064b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_34064b() { + vec3 res = ceil(vec3(1.0f)); +} + +void fragment_main() { + ceil_34064b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_34064b() { + vec3 res = ceil(vec3(1.0f)); +} + +void compute_main() { + ceil_34064b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.msl new file mode 100644 index 0000000000..0840f0273d --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_34064b() { + float3 res = ceil(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_34064b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_34064b(); + return; +} + +kernel void compute_main() { + ceil_34064b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.spvasm new file mode 100644 index 0000000000..018e998ec3 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_34064b "ceil_34064b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%ceil_34064b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Ceil %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %ceil_34064b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %ceil_34064b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %ceil_34064b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c572bc84b --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/34064b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn ceil_34064b() { + var res : vec3 = ceil(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_34064b(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_34064b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_34064b(); +} diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl new file mode 100644 index 0000000000..0e7ce3cbf9 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<4, f16>) -> vec<4, f16> +fn ceil_4bca2a() { + var res: vec4 = ceil(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_4bca2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_4bca2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_4bca2a(); +} diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..10c1d29622 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_4bca2a() { + vector res = ceil((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_4bca2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_4bca2a(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b9adc420c --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ceil_4bca2a() { + vector res = ceil((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_4bca2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_4bca2a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016D987AB790(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.glsl new file mode 100644 index 0000000000..4792e790cf --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_4bca2a() { + f16vec4 res = ceil(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + ceil_4bca2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_4bca2a() { + f16vec4 res = ceil(f16vec4(0.0hf)); +} + +void fragment_main() { + ceil_4bca2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_4bca2a() { + f16vec4 res = ceil(f16vec4(0.0hf)); +} + +void compute_main() { + ceil_4bca2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.msl new file mode 100644 index 0000000000..63fa1e16cf --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_4bca2a() { + half4 res = ceil(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_4bca2a(); + return; +} + +kernel void compute_main() { + ceil_4bca2a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..65f288bc2d --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_4bca2a "ceil_4bca2a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_4bca2a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Ceil %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %ceil_4bca2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %ceil_4bca2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %ceil_4bca2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..881715fa57 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/4bca2a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ceil_4bca2a() { + var res : vec4 = ceil(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_4bca2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_4bca2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_4bca2a(); +} diff --git a/test/tint/builtins/gen/literal/ceil/678655.wgsl b/test/tint/builtins/gen/literal/ceil/678655.wgsl new file mode 100644 index 0000000000..a4d3256c90 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/678655.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(f32) -> f32 +fn ceil_678655() { + var res: f32 = ceil(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_678655(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_678655(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_678655(); +} diff --git a/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..27adeb94b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_678655() { + float res = ceil(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_678655(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_678655(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_678655(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..27adeb94b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void ceil_678655() { + float res = ceil(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_678655(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_678655(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_678655(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.glsl new file mode 100644 index 0000000000..08ca9016e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void ceil_678655() { + float res = ceil(1.0f); +} + +vec4 vertex_main() { + ceil_678655(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_678655() { + float res = ceil(1.0f); +} + +void fragment_main() { + ceil_678655(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_678655() { + float res = ceil(1.0f); +} + +void compute_main() { + ceil_678655(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.msl new file mode 100644 index 0000000000..37d1aeca45 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_678655() { + float res = ceil(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_678655(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_678655(); + return; +} + +kernel void compute_main() { + ceil_678655(); + return; +} + diff --git a/test/tint/builtins/gen/ceil/678655.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/ceil/678655.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.wgsl new file mode 100644 index 0000000000..db1c9bbbeb --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/678655.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn ceil_678655() { + var res : f32 = ceil(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_678655(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_678655(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_678655(); +} diff --git a/test/tint/builtins/gen/literal/ceil/96f597.wgsl b/test/tint/builtins/gen/literal/ceil/96f597.wgsl new file mode 100644 index 0000000000..ee01d1b1eb --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/96f597.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(vec<2, f32>) -> vec<2, f32> +fn ceil_96f597() { + var res: vec2 = ceil(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_96f597(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_96f597(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_96f597(); +} diff --git a/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..01138db7e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_96f597() { + float2 res = ceil((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_96f597(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_96f597(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_96f597(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01138db7e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void ceil_96f597() { + float2 res = ceil((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_96f597(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_96f597(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_96f597(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.glsl new file mode 100644 index 0000000000..c38418dd27 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void ceil_96f597() { + vec2 res = ceil(vec2(1.0f)); +} + +vec4 vertex_main() { + ceil_96f597(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_96f597() { + vec2 res = ceil(vec2(1.0f)); +} + +void fragment_main() { + ceil_96f597(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_96f597() { + vec2 res = ceil(vec2(1.0f)); +} + +void compute_main() { + ceil_96f597(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.msl new file mode 100644 index 0000000000..d0a6c92adc --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_96f597() { + float2 res = ceil(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_96f597(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_96f597(); + return; +} + +kernel void compute_main() { + ceil_96f597(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.spvasm new file mode 100644 index 0000000000..2eab970379 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_96f597 "ceil_96f597" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%ceil_96f597 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Ceil %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %ceil_96f597 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %ceil_96f597 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %ceil_96f597 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd58dc153f --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/96f597.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn ceil_96f597() { + var res : vec2 = ceil(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_96f597(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_96f597(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_96f597(); +} diff --git a/test/tint/builtins/gen/literal/ceil/b74c16.wgsl b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl new file mode 100644 index 0000000000..90280c0038 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(vec<4, f32>) -> vec<4, f32> +fn ceil_b74c16() { + var res: vec4 = ceil(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_b74c16(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_b74c16(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_b74c16(); +} diff --git a/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94df849e8d --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_b74c16() { + float4 res = ceil((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_b74c16(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_b74c16(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_b74c16(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..94df849e8d --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void ceil_b74c16() { + float4 res = ceil((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_b74c16(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_b74c16(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_b74c16(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.glsl new file mode 100644 index 0000000000..d64a7371a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void ceil_b74c16() { + vec4 res = ceil(vec4(1.0f)); +} + +vec4 vertex_main() { + ceil_b74c16(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_b74c16() { + vec4 res = ceil(vec4(1.0f)); +} + +void fragment_main() { + ceil_b74c16(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_b74c16() { + vec4 res = ceil(vec4(1.0f)); +} + +void compute_main() { + ceil_b74c16(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.msl new file mode 100644 index 0000000000..71679e6f4d --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_b74c16() { + float4 res = ceil(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_b74c16(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_b74c16(); + return; +} + +kernel void compute_main() { + ceil_b74c16(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.spvasm new file mode 100644 index 0000000000..c673475331 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_b74c16 "ceil_b74c16" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%ceil_b74c16 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Ceil %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %ceil_b74c16 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %ceil_b74c16 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %ceil_b74c16 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.wgsl new file mode 100644 index 0000000000..d3785332e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/b74c16.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn ceil_b74c16() { + var res : vec4 = ceil(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_b74c16(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_b74c16(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_b74c16(); +} diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl new file mode 100644 index 0000000000..439e88e183 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(f16) -> f16 +fn ceil_f3f889() { + var res: f16 = ceil(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_f3f889(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_f3f889(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_f3f889(); +} diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b9cee87649 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ceil_f3f889() { + float16_t res = ceil(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_f3f889(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_f3f889(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b743e2f75e --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void ceil_f3f889() { + float16_t res = ceil(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_f3f889(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_f3f889(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000190A1B47CF0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000190A1B47CF0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.glsl new file mode 100644 index 0000000000..c34111a354 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_f3f889() { + float16_t res = ceil(0.0hf); +} + +vec4 vertex_main() { + ceil_f3f889(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_f3f889() { + float16_t res = ceil(0.0hf); +} + +void fragment_main() { + ceil_f3f889(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_f3f889() { + float16_t res = ceil(0.0hf); +} + +void compute_main() { + ceil_f3f889(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.msl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.msl new file mode 100644 index 0000000000..2bfecc6ad6 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ceil_f3f889() { + half res = ceil(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_f3f889(); + return; +} + +kernel void compute_main() { + ceil_f3f889(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.spvasm new file mode 100644 index 0000000000..b50e1adcb8 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_f3f889 "ceil_f3f889" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_f3f889 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Ceil %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %ceil_f3f889 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %ceil_f3f889 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_f3f889 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.wgsl new file mode 100644 index 0000000000..288d3c2882 --- /dev/null +++ b/test/tint/builtins/gen/literal/ceil/f3f889.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ceil_f3f889() { + var res : f16 = ceil(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_f3f889(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_f3f889(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_f3f889(); +} diff --git a/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl new file mode 100644 index 0000000000..047e915d2d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn clamp_0acf8f() { + var res: vec2 = clamp(vec2(1.f), vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_0acf8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_0acf8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_0acf8f(); +} diff --git a/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b80215545d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_0acf8f() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_0acf8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_0acf8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_0acf8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b80215545d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_0acf8f() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_0acf8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_0acf8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_0acf8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.glsl new file mode 100644 index 0000000000..0a8ea6fec5 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_0acf8f() { + vec2 res = vec2(1.0f); +} + +vec4 vertex_main() { + clamp_0acf8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_0acf8f() { + vec2 res = vec2(1.0f); +} + +void fragment_main() { + clamp_0acf8f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_0acf8f() { + vec2 res = vec2(1.0f); +} + +void compute_main() { + clamp_0acf8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.msl new file mode 100644 index 0000000000..3479eea015 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_0acf8f() { + float2 res = float2(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_0acf8f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_0acf8f(); + return; +} + +kernel void compute_main() { + clamp_0acf8f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b0dd312ce --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_0acf8f "clamp_0acf8f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float +%clamp_0acf8f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %clamp_0acf8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_0acf8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_0acf8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..a555d79c1c --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/0acf8f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_0acf8f() { + var res : vec2 = clamp(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_0acf8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_0acf8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_0acf8f(); +} diff --git a/test/tint/builtins/gen/literal/clamp/177548.wgsl b/test/tint/builtins/gen/literal/clamp/177548.wgsl new file mode 100644 index 0000000000..b1020b41ae --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/177548.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, ia>, vec<2, ia>, vec<2, ia>) -> vec<2, ia> +fn clamp_177548() { + var res = clamp(vec2(1.0), vec2(1.0), vec2(1.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_177548(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_177548(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_177548(); +} diff --git a/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6db476c70 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_177548() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_177548(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_177548(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_177548(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6db476c70 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_177548() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_177548(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_177548(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_177548(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.glsl new file mode 100644 index 0000000000..aef0c70f7c --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_177548() { + vec2 res = vec2(1.0f); +} + +vec4 vertex_main() { + clamp_177548(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_177548() { + vec2 res = vec2(1.0f); +} + +void fragment_main() { + clamp_177548(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_177548() { + vec2 res = vec2(1.0f); +} + +void compute_main() { + clamp_177548(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.msl new file mode 100644 index 0000000000..7c91b67871 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_177548() { + float2 res = float2(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_177548(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_177548(); + return; +} + +kernel void compute_main() { + clamp_177548(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b2e5dc76e --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_177548 "clamp_177548" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float +%clamp_177548 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %clamp_177548 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_177548 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_177548 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.wgsl new file mode 100644 index 0000000000..43342f9116 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/177548.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_177548() { + var res = clamp(vec2(1.0), vec2(1.0), vec2(1.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_177548(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_177548(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_177548(); +} diff --git a/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl new file mode 100644 index 0000000000..38d9b0052f --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, i32>, vec<4, i32>, vec<4, i32>) -> vec<4, i32> +fn clamp_1a32e3() { + var res: vec4 = clamp(vec4(1), vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_1a32e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_1a32e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_1a32e3(); +} diff --git a/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8acdd229a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_1a32e3() { + int4 res = (1).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_1a32e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_1a32e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_1a32e3(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8acdd229a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_1a32e3() { + int4 res = (1).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_1a32e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_1a32e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_1a32e3(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.glsl new file mode 100644 index 0000000000..764d647638 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_1a32e3() { + ivec4 res = ivec4(1); +} + +vec4 vertex_main() { + clamp_1a32e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_1a32e3() { + ivec4 res = ivec4(1); +} + +void fragment_main() { + clamp_1a32e3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_1a32e3() { + ivec4 res = ivec4(1); +} + +void compute_main() { + clamp_1a32e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.msl new file mode 100644 index 0000000000..e82fbd0bbe --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_1a32e3() { + int4 res = int4(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_1a32e3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_1a32e3(); + return; +} + +kernel void compute_main() { + clamp_1a32e3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..65ad15f413 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_1a32e3 "clamp_1a32e3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_1a32e3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_1a32e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_1a32e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_1a32e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..cfd0a482f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/1a32e3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_1a32e3() { + var res : vec4 = clamp(vec4(1), vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_1a32e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_1a32e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_1a32e3(); +} diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl new file mode 100644 index 0000000000..fcb634e934 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn clamp_235b29() { + var res: vec2 = clamp(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_235b29(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_235b29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_235b29(); +} diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..02fc88275c --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_235b29() { + vector res = (float16_t(0.0h)).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_235b29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_235b29(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d8e438289d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void clamp_235b29() { + vector res = (float16_t(0.0h)).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_235b29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_235b29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017FE0738160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.glsl new file mode 100644 index 0000000000..3a90e739c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_235b29() { + f16vec2 res = f16vec2(0.0hf); +} + +vec4 vertex_main() { + clamp_235b29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_235b29() { + f16vec2 res = f16vec2(0.0hf); +} + +void fragment_main() { + clamp_235b29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_235b29() { + f16vec2 res = f16vec2(0.0hf); +} + +void compute_main() { + clamp_235b29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.msl new file mode 100644 index 0000000000..cd5723f4c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_235b29() { + half2 res = half2(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_235b29(); + return; +} + +kernel void compute_main() { + clamp_235b29(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.spvasm new file mode 100644 index 0000000000..70a6d4920f --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_235b29 "clamp_235b29" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_235b29 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_235b29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_235b29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_235b29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba5303c1c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/235b29.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn clamp_235b29() { + var res : vec2 = clamp(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_235b29(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_235b29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_235b29(); +} diff --git a/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl new file mode 100644 index 0000000000..b02caee49d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(fa, fa, fa) -> fa +fn clamp_23aa4f() { + var res = clamp(1, 1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_23aa4f(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_23aa4f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_23aa4f(); +} diff --git a/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95967c6565 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_23aa4f() { + int res = 1; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_23aa4f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_23aa4f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_23aa4f(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95967c6565 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_23aa4f() { + int res = 1; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_23aa4f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_23aa4f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_23aa4f(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.glsl new file mode 100644 index 0000000000..745c8d9039 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_23aa4f() { + int res = 1; +} + +vec4 vertex_main() { + clamp_23aa4f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_23aa4f() { + int res = 1; +} + +void fragment_main() { + clamp_23aa4f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_23aa4f() { + int res = 1; +} + +void compute_main() { + clamp_23aa4f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.msl new file mode 100644 index 0000000000..e6b476f7e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_23aa4f() { + int res = 1; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_23aa4f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_23aa4f(); + return; +} + +kernel void compute_main() { + clamp_23aa4f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e7f69b6f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_23aa4f "clamp_23aa4f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_23aa4f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %res %int_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_23aa4f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_23aa4f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_23aa4f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.wgsl new file mode 100644 index 0000000000..8750791981 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/23aa4f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_23aa4f() { + var res = clamp(1, 1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_23aa4f(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_23aa4f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_23aa4f(); +} diff --git a/test/tint/builtins/gen/literal/clamp/2bd567.wgsl b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl new file mode 100644 index 0000000000..746fadf822 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(f32, f32, f32) -> f32 +fn clamp_2bd567() { + var res: f32 = clamp(1.f, 1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bd567(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2bd567(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2bd567(); +} diff --git a/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b0b0c6609 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_2bd567() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bd567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bd567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bd567(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b0b0c6609 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_2bd567() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bd567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bd567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bd567(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.glsl new file mode 100644 index 0000000000..406dade6b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_2bd567() { + float res = 1.0f; +} + +vec4 vertex_main() { + clamp_2bd567(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_2bd567() { + float res = 1.0f; +} + +void fragment_main() { + clamp_2bd567(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_2bd567() { + float res = 1.0f; +} + +void compute_main() { + clamp_2bd567(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.msl new file mode 100644 index 0000000000..0fae76a6c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_2bd567() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2bd567(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2bd567(); + return; +} + +kernel void compute_main() { + clamp_2bd567(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe56eaa122 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2bd567 "clamp_2bd567" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float +%clamp_2bd567 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %clamp_2bd567 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %void %clamp_2bd567 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_2bd567 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.wgsl new file mode 100644 index 0000000000..146e458531 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bd567.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_2bd567() { + var res : f32 = clamp(1.0f, 1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bd567(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2bd567(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2bd567(); +} diff --git a/test/tint/builtins/gen/literal/clamp/2bde41.wgsl b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl new file mode 100644 index 0000000000..26fa1c2878 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn clamp_2bde41() { + var res: vec4 = clamp(vec4(1.f), vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bde41(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2bde41(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2bde41(); +} diff --git a/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9379a36452 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_2bde41() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bde41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bde41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bde41(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9379a36452 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_2bde41() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bde41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bde41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bde41(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.glsl new file mode 100644 index 0000000000..eb8354b962 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_2bde41() { + vec4 res = vec4(1.0f); +} + +vec4 vertex_main() { + clamp_2bde41(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_2bde41() { + vec4 res = vec4(1.0f); +} + +void fragment_main() { + clamp_2bde41(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_2bde41() { + vec4 res = vec4(1.0f); +} + +void compute_main() { + clamp_2bde41(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.msl new file mode 100644 index 0000000000..adf4ea4039 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_2bde41() { + float4 res = float4(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2bde41(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2bde41(); + return; +} + +kernel void compute_main() { + clamp_2bde41(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b1234a43e --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2bde41 "clamp_2bde41" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float +%clamp_2bde41 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %clamp_2bde41 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %clamp_2bde41 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_2bde41 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.wgsl new file mode 100644 index 0000000000..370e66b1fd --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2bde41.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_2bde41() { + var res : vec4 = clamp(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bde41(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2bde41(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2bde41(); +} diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl new file mode 100644 index 0000000000..9c5f382a57 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn clamp_2c251b() { + var res: vec4 = clamp(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2c251b(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2c251b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2c251b(); +} diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..79e81c9619 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_2c251b() { + vector res = (float16_t(0.0h)).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2c251b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2c251b(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20423bbd1e --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void clamp_2c251b() { + vector res = (float16_t(0.0h)).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2c251b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2c251b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000225C8376D90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.glsl new file mode 100644 index 0000000000..e1cfbbe948 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_2c251b() { + f16vec4 res = f16vec4(0.0hf); +} + +vec4 vertex_main() { + clamp_2c251b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_2c251b() { + f16vec4 res = f16vec4(0.0hf); +} + +void fragment_main() { + clamp_2c251b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_2c251b() { + f16vec4 res = f16vec4(0.0hf); +} + +void compute_main() { + clamp_2c251b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.msl new file mode 100644 index 0000000000..5168d3d93d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_2c251b() { + half4 res = half4(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2c251b(); + return; +} + +kernel void compute_main() { + clamp_2c251b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c74f7d3cb --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2c251b "clamp_2c251b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_2c251b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_2c251b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_2c251b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_2c251b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.wgsl new file mode 100644 index 0000000000..15be6c8080 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/2c251b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn clamp_2c251b() { + var res : vec4 = clamp(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2c251b(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2c251b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2c251b(); +} diff --git a/test/tint/builtins/gen/literal/clamp/548fc7.wgsl b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl new file mode 100644 index 0000000000..59d930ea15 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, u32>, vec<3, u32>, vec<3, u32>) -> vec<3, u32> +fn clamp_548fc7() { + var res: vec3 = clamp(vec3(1u), vec3(1u), vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_548fc7(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_548fc7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_548fc7(); +} diff --git a/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..158ed1cf98 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_548fc7() { + uint3 res = (1u).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_548fc7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_548fc7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_548fc7(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..158ed1cf98 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_548fc7() { + uint3 res = (1u).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_548fc7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_548fc7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_548fc7(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.glsl new file mode 100644 index 0000000000..30f8c4af91 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_548fc7() { + uvec3 res = uvec3(1u); +} + +vec4 vertex_main() { + clamp_548fc7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_548fc7() { + uvec3 res = uvec3(1u); +} + +void fragment_main() { + clamp_548fc7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_548fc7() { + uvec3 res = uvec3(1u); +} + +void compute_main() { + clamp_548fc7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.msl new file mode 100644 index 0000000000..ccea18c030 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_548fc7() { + uint3 res = uint3(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_548fc7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_548fc7(); + return; +} + +kernel void compute_main() { + clamp_548fc7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e160d3168 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_548fc7 "clamp_548fc7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_548fc7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_548fc7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_548fc7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_548fc7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.wgsl new file mode 100644 index 0000000000..27abecacc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/548fc7.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_548fc7() { + var res : vec3 = clamp(vec3(1u), vec3(1u), vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_548fc7(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_548fc7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_548fc7(); +} diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl new file mode 100644 index 0000000000..b6f3eb9257 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(f16, f16, f16) -> f16 +fn clamp_553ffb() { + var res: f16 = clamp(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_553ffb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_553ffb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_553ffb(); +} diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0343bfd45b --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_553ffb() { + float16_t res = float16_t(0.0h); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_553ffb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_553ffb(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b397e5f17f --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void clamp_553ffb() { + float16_t res = float16_t(0.0h); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_553ffb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_553ffb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002581C620540(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002581C620540(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.glsl new file mode 100644 index 0000000000..060c13f3c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_553ffb() { + float16_t res = 0.0hf; +} + +vec4 vertex_main() { + clamp_553ffb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_553ffb() { + float16_t res = 0.0hf; +} + +void fragment_main() { + clamp_553ffb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_553ffb() { + float16_t res = 0.0hf; +} + +void compute_main() { + clamp_553ffb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.msl new file mode 100644 index 0000000000..34e8f69f00 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_553ffb() { + half res = 0.0h; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_553ffb(); + return; +} + +kernel void compute_main() { + clamp_553ffb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4abe0dd4a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_553ffb "clamp_553ffb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_553ffb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %clamp_553ffb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %void %clamp_553ffb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_553ffb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.wgsl new file mode 100644 index 0000000000..48f3ab3692 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/553ffb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn clamp_553ffb() { + var res : f16 = clamp(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_553ffb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_553ffb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_553ffb(); +} diff --git a/test/tint/builtins/gen/literal/clamp/5cf700.wgsl b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl new file mode 100644 index 0000000000..4127bb8129 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, fa>, vec<3, fa>, vec<3, fa>) -> vec<3, fa> +fn clamp_5cf700() { + var res = clamp(vec3(1), vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_5cf700(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_5cf700(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_5cf700(); +} diff --git a/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..06d6121193 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_5cf700() { + int3 res = (1).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_5cf700(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_5cf700(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_5cf700(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..06d6121193 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_5cf700() { + int3 res = (1).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_5cf700(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_5cf700(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_5cf700(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.glsl new file mode 100644 index 0000000000..a1ce57531a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_5cf700() { + ivec3 res = ivec3(1); +} + +vec4 vertex_main() { + clamp_5cf700(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_5cf700() { + ivec3 res = ivec3(1); +} + +void fragment_main() { + clamp_5cf700(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_5cf700() { + ivec3 res = ivec3(1); +} + +void compute_main() { + clamp_5cf700(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.msl new file mode 100644 index 0000000000..55c384c198 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_5cf700() { + int3 res = int3(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_5cf700(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_5cf700(); + return; +} + +kernel void compute_main() { + clamp_5cf700(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b26acae61 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_5cf700 "clamp_5cf700" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_5cf700 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_5cf700 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_5cf700 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_5cf700 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.wgsl new file mode 100644 index 0000000000..c7f5c1e3a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5cf700.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_5cf700() { + var res = clamp(vec3(1), vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_5cf700(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_5cf700(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_5cf700(); +} diff --git a/test/tint/builtins/gen/literal/clamp/5f0819.wgsl b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl new file mode 100644 index 0000000000..8ce5387f7b --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, i32>, vec<3, i32>, vec<3, i32>) -> vec<3, i32> +fn clamp_5f0819() { + var res: vec3 = clamp(vec3(1), vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_5f0819(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_5f0819(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_5f0819(); +} diff --git a/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f1d83d574c --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_5f0819() { + int3 res = (1).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_5f0819(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_5f0819(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_5f0819(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f1d83d574c --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_5f0819() { + int3 res = (1).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_5f0819(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_5f0819(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_5f0819(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.glsl new file mode 100644 index 0000000000..1f50eddcb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_5f0819() { + ivec3 res = ivec3(1); +} + +vec4 vertex_main() { + clamp_5f0819(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_5f0819() { + ivec3 res = ivec3(1); +} + +void fragment_main() { + clamp_5f0819(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_5f0819() { + ivec3 res = ivec3(1); +} + +void compute_main() { + clamp_5f0819(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.msl new file mode 100644 index 0000000000..724945fda2 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_5f0819() { + int3 res = int3(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_5f0819(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_5f0819(); + return; +} + +kernel void compute_main() { + clamp_5f0819(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.spvasm new file mode 100644 index 0000000000..e57ec12a36 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_5f0819 "clamp_5f0819" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_5f0819 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_5f0819 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_5f0819 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_5f0819 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.wgsl new file mode 100644 index 0000000000..84b9e1df0a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/5f0819.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_5f0819() { + var res : vec3 = clamp(vec3(1), vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_5f0819(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_5f0819(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_5f0819(); +} diff --git a/test/tint/builtins/gen/literal/clamp/6c1749.wgsl b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl new file mode 100644 index 0000000000..aa4c2cced7 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, i32>, vec<2, i32>, vec<2, i32>) -> vec<2, i32> +fn clamp_6c1749() { + var res: vec2 = clamp(vec2(1), vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_6c1749(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_6c1749(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_6c1749(); +} diff --git a/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7178ef5f93 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_6c1749() { + int2 res = (1).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_6c1749(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_6c1749(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_6c1749(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7178ef5f93 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_6c1749() { + int2 res = (1).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_6c1749(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_6c1749(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_6c1749(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.glsl new file mode 100644 index 0000000000..3d0bb2561b --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_6c1749() { + ivec2 res = ivec2(1); +} + +vec4 vertex_main() { + clamp_6c1749(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_6c1749() { + ivec2 res = ivec2(1); +} + +void fragment_main() { + clamp_6c1749(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_6c1749() { + ivec2 res = ivec2(1); +} + +void compute_main() { + clamp_6c1749(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.msl new file mode 100644 index 0000000000..37c4764599 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_6c1749() { + int2 res = int2(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_6c1749(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_6c1749(); + return; +} + +kernel void compute_main() { + clamp_6c1749(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.spvasm new file mode 100644 index 0000000000..bbcb3c313e --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_6c1749 "clamp_6c1749" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_6c1749 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_6c1749 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_6c1749 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_6c1749 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e5ebf5edf --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/6c1749.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_6c1749() { + var res : vec2 = clamp(vec2(1), vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_6c1749(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_6c1749(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_6c1749(); +} diff --git a/test/tint/builtins/gen/literal/clamp/7706d7.wgsl b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl new file mode 100644 index 0000000000..ae8377df22 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, u32>, vec<2, u32>, vec<2, u32>) -> vec<2, u32> +fn clamp_7706d7() { + var res: vec2 = clamp(vec2(1u), vec2(1u), vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_7706d7(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_7706d7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_7706d7(); +} diff --git a/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..039fbeae65 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_7706d7() { + uint2 res = (1u).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_7706d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_7706d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_7706d7(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..039fbeae65 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_7706d7() { + uint2 res = (1u).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_7706d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_7706d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_7706d7(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.glsl new file mode 100644 index 0000000000..170b7d0b42 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_7706d7() { + uvec2 res = uvec2(1u); +} + +vec4 vertex_main() { + clamp_7706d7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_7706d7() { + uvec2 res = uvec2(1u); +} + +void fragment_main() { + clamp_7706d7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_7706d7() { + uvec2 res = uvec2(1u); +} + +void compute_main() { + clamp_7706d7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.msl new file mode 100644 index 0000000000..33e531ede9 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_7706d7() { + uint2 res = uint2(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_7706d7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_7706d7(); + return; +} + +kernel void compute_main() { + clamp_7706d7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d73e0afac --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_7706d7 "clamp_7706d7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_7706d7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_7706d7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_7706d7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_7706d7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.wgsl new file mode 100644 index 0000000000..a614443fff --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/7706d7.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_7706d7() { + var res : vec2 = clamp(vec2(1u), vec2(1u), vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_7706d7(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_7706d7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_7706d7(); +} diff --git a/test/tint/builtins/gen/literal/clamp/867397.wgsl b/test/tint/builtins/gen/literal/clamp/867397.wgsl new file mode 100644 index 0000000000..bf27902cc3 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/867397.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn clamp_867397() { + var res: vec3 = clamp(vec3(1.f), vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_867397(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_867397(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_867397(); +} diff --git a/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..80c2bd0a33 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_867397() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_867397(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_867397(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_867397(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80c2bd0a33 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_867397() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_867397(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_867397(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_867397(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.glsl new file mode 100644 index 0000000000..63fb7a8b35 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_867397() { + vec3 res = vec3(1.0f); +} + +vec4 vertex_main() { + clamp_867397(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_867397() { + vec3 res = vec3(1.0f); +} + +void fragment_main() { + clamp_867397(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_867397() { + vec3 res = vec3(1.0f); +} + +void compute_main() { + clamp_867397(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.msl new file mode 100644 index 0000000000..a3567726f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_867397() { + float3 res = float3(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_867397(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_867397(); + return; +} + +kernel void compute_main() { + clamp_867397(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.spvasm new file mode 100644 index 0000000000..cadd95452c --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_867397 "clamp_867397" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float +%clamp_867397 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %clamp_867397 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_867397 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_867397 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1dcadf4b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/867397.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_867397() { + var res : vec3 = clamp(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_867397(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_867397(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_867397(); +} diff --git a/test/tint/builtins/gen/literal/clamp/87df46.wgsl b/test/tint/builtins/gen/literal/clamp/87df46.wgsl new file mode 100644 index 0000000000..e24da63eee --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/87df46.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, fa>, vec<4, fa>, vec<4, fa>) -> vec<4, fa> +fn clamp_87df46() { + var res = clamp(vec4(1), vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_87df46(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_87df46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_87df46(); +} diff --git a/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8af196a973 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_87df46() { + int4 res = (1).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_87df46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_87df46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_87df46(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8af196a973 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_87df46() { + int4 res = (1).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_87df46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_87df46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_87df46(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.glsl new file mode 100644 index 0000000000..b3db98f4e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_87df46() { + ivec4 res = ivec4(1); +} + +vec4 vertex_main() { + clamp_87df46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_87df46() { + ivec4 res = ivec4(1); +} + +void fragment_main() { + clamp_87df46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_87df46() { + ivec4 res = ivec4(1); +} + +void compute_main() { + clamp_87df46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.msl new file mode 100644 index 0000000000..62aa4bb0a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_87df46() { + int4 res = int4(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_87df46(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_87df46(); + return; +} + +kernel void compute_main() { + clamp_87df46(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e036506bf --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_87df46 "clamp_87df46" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_87df46 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_87df46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_87df46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_87df46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.wgsl new file mode 100644 index 0000000000..eeb22ce017 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/87df46.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_87df46() { + var res = clamp(vec4(1), vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_87df46(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_87df46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_87df46(); +} diff --git a/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl new file mode 100644 index 0000000000..e849cc843e --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, ia>, vec<3, ia>, vec<3, ia>) -> vec<3, ia> +fn clamp_8b1eaa() { + var res = clamp(vec3(1.0), vec3(1.0), vec3(1.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_8b1eaa(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_8b1eaa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_8b1eaa(); +} diff --git a/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8270dd1e8a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_8b1eaa() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_8b1eaa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_8b1eaa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_8b1eaa(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8270dd1e8a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_8b1eaa() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_8b1eaa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_8b1eaa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_8b1eaa(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.glsl new file mode 100644 index 0000000000..6729165a11 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_8b1eaa() { + vec3 res = vec3(1.0f); +} + +vec4 vertex_main() { + clamp_8b1eaa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_8b1eaa() { + vec3 res = vec3(1.0f); +} + +void fragment_main() { + clamp_8b1eaa(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_8b1eaa() { + vec3 res = vec3(1.0f); +} + +void compute_main() { + clamp_8b1eaa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.msl new file mode 100644 index 0000000000..786aaaa128 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_8b1eaa() { + float3 res = float3(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_8b1eaa(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_8b1eaa(); + return; +} + +kernel void compute_main() { + clamp_8b1eaa(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.spvasm new file mode 100644 index 0000000000..faa36f5c9e --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_8b1eaa "clamp_8b1eaa" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float +%clamp_8b1eaa = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %clamp_8b1eaa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_8b1eaa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_8b1eaa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.wgsl new file mode 100644 index 0000000000..bda46e9db4 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/8b1eaa.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_8b1eaa() { + var res = clamp(vec3(1.0), vec3(1.0), vec3(1.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_8b1eaa(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_8b1eaa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_8b1eaa(); +} diff --git a/test/tint/builtins/gen/literal/clamp/96e56a.wgsl b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl new file mode 100644 index 0000000000..1babcf7a30 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(ia, ia, ia) -> ia +fn clamp_96e56a() { + var res = clamp(1.0, 1.0, 1.0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_96e56a(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_96e56a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_96e56a(); +} diff --git a/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6231928d78 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_96e56a() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_96e56a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_96e56a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_96e56a(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6231928d78 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_96e56a() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_96e56a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_96e56a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_96e56a(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.glsl new file mode 100644 index 0000000000..c7dbb9bdc3 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_96e56a() { + float res = 1.0f; +} + +vec4 vertex_main() { + clamp_96e56a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_96e56a() { + float res = 1.0f; +} + +void fragment_main() { + clamp_96e56a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_96e56a() { + float res = 1.0f; +} + +void compute_main() { + clamp_96e56a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.msl new file mode 100644 index 0000000000..a28781ca2c --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_96e56a() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_96e56a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_96e56a(); + return; +} + +kernel void compute_main() { + clamp_96e56a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.spvasm new file mode 100644 index 0000000000..07544da303 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_96e56a "clamp_96e56a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float +%clamp_96e56a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %clamp_96e56a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %void %clamp_96e56a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_96e56a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.wgsl new file mode 100644 index 0000000000..20f3055098 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/96e56a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_96e56a() { + var res = clamp(1.0, 1.0, 1.0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_96e56a(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_96e56a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_96e56a(); +} diff --git a/test/tint/builtins/gen/literal/clamp/9d731c.wgsl b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl new file mode 100644 index 0000000000..b766bbfa3a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, fa>, vec<2, fa>, vec<2, fa>) -> vec<2, fa> +fn clamp_9d731c() { + var res = clamp(vec2(1), vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_9d731c(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_9d731c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_9d731c(); +} diff --git a/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..25efa1a8e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_9d731c() { + int2 res = (1).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_9d731c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_9d731c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_9d731c(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..25efa1a8e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_9d731c() { + int2 res = (1).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_9d731c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_9d731c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_9d731c(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.glsl new file mode 100644 index 0000000000..8f283b5ee4 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_9d731c() { + ivec2 res = ivec2(1); +} + +vec4 vertex_main() { + clamp_9d731c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_9d731c() { + ivec2 res = ivec2(1); +} + +void fragment_main() { + clamp_9d731c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_9d731c() { + ivec2 res = ivec2(1); +} + +void compute_main() { + clamp_9d731c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.msl new file mode 100644 index 0000000000..5a78c71ece --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_9d731c() { + int2 res = int2(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_9d731c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_9d731c(); + return; +} + +kernel void compute_main() { + clamp_9d731c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.spvasm new file mode 100644 index 0000000000..533a9b057d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_9d731c "clamp_9d731c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_9d731c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_9d731c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_9d731c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_9d731c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.wgsl new file mode 100644 index 0000000000..d4da0fb4b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/9d731c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_9d731c() { + var res = clamp(vec2(1), vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_9d731c(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_9d731c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_9d731c(); +} diff --git a/test/tint/builtins/gen/literal/clamp/a2de25.wgsl b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl new file mode 100644 index 0000000000..ac3f67c62c --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(u32, u32, u32) -> u32 +fn clamp_a2de25() { + var res: u32 = clamp(1u, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_a2de25(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_a2de25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_a2de25(); +} diff --git a/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f28586f638 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_a2de25() { + uint res = 1u; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_a2de25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_a2de25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_a2de25(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f28586f638 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_a2de25() { + uint res = 1u; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_a2de25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_a2de25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_a2de25(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.glsl new file mode 100644 index 0000000000..bcd4b44d45 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_a2de25() { + uint res = 1u; +} + +vec4 vertex_main() { + clamp_a2de25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_a2de25() { + uint res = 1u; +} + +void fragment_main() { + clamp_a2de25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_a2de25() { + uint res = 1u; +} + +void compute_main() { + clamp_a2de25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.msl new file mode 100644 index 0000000000..49c396ad88 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_a2de25() { + uint res = 1u; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_a2de25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_a2de25(); + return; +} + +kernel void compute_main() { + clamp_a2de25(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b4ab71ab8 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_a2de25 "clamp_a2de25" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_a2de25 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %res %uint_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_a2de25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_a2de25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_a2de25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.wgsl new file mode 100644 index 0000000000..5aee4d3a31 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/a2de25.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_a2de25() { + var res : u32 = clamp(1u, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_a2de25(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_a2de25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_a2de25(); +} diff --git a/test/tint/builtins/gen/literal/clamp/b07c65.wgsl b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl new file mode 100644 index 0000000000..dd386b8f16 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(i32, i32, i32) -> i32 +fn clamp_b07c65() { + var res: i32 = clamp(1, 1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b07c65(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b07c65(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b07c65(); +} diff --git a/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bcf06731b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_b07c65() { + int res = 1; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b07c65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b07c65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b07c65(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bcf06731b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_b07c65() { + int res = 1; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b07c65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b07c65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b07c65(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.glsl new file mode 100644 index 0000000000..a6dba0376e --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_b07c65() { + int res = 1; +} + +vec4 vertex_main() { + clamp_b07c65(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_b07c65() { + int res = 1; +} + +void fragment_main() { + clamp_b07c65(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_b07c65() { + int res = 1; +} + +void compute_main() { + clamp_b07c65(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.msl new file mode 100644 index 0000000000..ad20dc67eb --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_b07c65() { + int res = 1; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_b07c65(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_b07c65(); + return; +} + +kernel void compute_main() { + clamp_b07c65(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.spvasm new file mode 100644 index 0000000000..6e55cb9b76 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_b07c65 "clamp_b07c65" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_b07c65 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %res %int_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_b07c65 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_b07c65 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_b07c65 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ad022bfd4 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b07c65.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_b07c65() { + var res : i32 = clamp(1, 1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b07c65(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b07c65(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b07c65(); +} diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl new file mode 100644 index 0000000000..f03c28a98b --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn clamp_b195eb() { + var res: vec3 = clamp(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b195eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b195eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b195eb(); +} diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c94442f095 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_b195eb() { + vector res = (float16_t(0.0h)).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b195eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b195eb(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..823e2b2f01 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void clamp_b195eb() { + vector res = (float16_t(0.0h)).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b195eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b195eb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F44BFDB000(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.glsl new file mode 100644 index 0000000000..500588f1fb --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_b195eb() { + f16vec3 res = f16vec3(0.0hf); +} + +vec4 vertex_main() { + clamp_b195eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_b195eb() { + f16vec3 res = f16vec3(0.0hf); +} + +void fragment_main() { + clamp_b195eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_b195eb() { + f16vec3 res = f16vec3(0.0hf); +} + +void compute_main() { + clamp_b195eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.msl new file mode 100644 index 0000000000..58d111aa08 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_b195eb() { + half3 res = half3(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_b195eb(); + return; +} + +kernel void compute_main() { + clamp_b195eb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..4beb74d53a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_b195eb "clamp_b195eb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_b195eb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_b195eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_b195eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_b195eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd88ab4fed --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/b195eb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn clamp_b195eb() { + var res : vec3 = clamp(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b195eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b195eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b195eb(); +} diff --git a/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl new file mode 100644 index 0000000000..d4cbe89aec --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, u32>, vec<4, u32>, vec<4, u32>) -> vec<4, u32> +fn clamp_bd43ce() { + var res: vec4 = clamp(vec4(1u), vec4(1u), vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_bd43ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_bd43ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_bd43ce(); +} diff --git a/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..948d108cc9 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_bd43ce() { + uint4 res = (1u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_bd43ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_bd43ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_bd43ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..948d108cc9 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_bd43ce() { + uint4 res = (1u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_bd43ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_bd43ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_bd43ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.glsl new file mode 100644 index 0000000000..863d7125be --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_bd43ce() { + uvec4 res = uvec4(1u); +} + +vec4 vertex_main() { + clamp_bd43ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_bd43ce() { + uvec4 res = uvec4(1u); +} + +void fragment_main() { + clamp_bd43ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_bd43ce() { + uvec4 res = uvec4(1u); +} + +void compute_main() { + clamp_bd43ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.msl new file mode 100644 index 0000000000..de1f5a6588 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_bd43ce() { + uint4 res = uint4(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_bd43ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_bd43ce(); + return; +} + +kernel void compute_main() { + clamp_bd43ce(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..f08dc7b719 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_bd43ce "clamp_bd43ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_bd43ce = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_bd43ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_bd43ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_bd43ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..2b4ad4233a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/bd43ce.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_bd43ce() { + var res : vec4 = clamp(vec4(1u), vec4(1u), vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_bd43ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_bd43ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_bd43ce(); +} diff --git a/test/tint/builtins/gen/literal/clamp/d396af.wgsl b/test/tint/builtins/gen/literal/clamp/d396af.wgsl new file mode 100644 index 0000000000..de2b9e51bf --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/d396af.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, ia>, vec<4, ia>, vec<4, ia>) -> vec<4, ia> +fn clamp_d396af() { + var res = clamp(vec4(1.0), vec4(1.0), vec4(1.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_d396af(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_d396af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_d396af(); +} diff --git a/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f04061838 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_d396af() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_d396af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_d396af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_d396af(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1f04061838 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_d396af() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_d396af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_d396af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_d396af(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.glsl b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.glsl new file mode 100644 index 0000000000..57aa0178bd --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_d396af() { + vec4 res = vec4(1.0f); +} + +vec4 vertex_main() { + clamp_d396af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_d396af() { + vec4 res = vec4(1.0f); +} + +void fragment_main() { + clamp_d396af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_d396af() { + vec4 res = vec4(1.0f); +} + +void compute_main() { + clamp_d396af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.msl b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.msl new file mode 100644 index 0000000000..3a1316e8a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_d396af() { + float4 res = float4(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_d396af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_d396af(); + return; +} + +kernel void compute_main() { + clamp_d396af(); + return; +} + diff --git a/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.spvasm new file mode 100644 index 0000000000..4403ee445a --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_d396af "clamp_d396af" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float +%clamp_d396af = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %clamp_d396af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %clamp_d396af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_d396af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.wgsl new file mode 100644 index 0000000000..973eb90b3d --- /dev/null +++ b/test/tint/builtins/gen/literal/clamp/d396af.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn clamp_d396af() { + var res = clamp(vec4(1.0), vec4(1.0), vec4(1.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_d396af(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_d396af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_d396af(); +} diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl new file mode 100644 index 0000000000..07bd88811a --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<3, f16>) -> vec<3, f16> +fn cos_0835a8() { + var res: vec3 = cos(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0835a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0835a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0835a8(); +} diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef1328a2f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_0835a8() { + vector res = cos((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0835a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0835a8(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..966a5e3f4f --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cos_0835a8() { + vector res = cos((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0835a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0835a8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000012E9639AC20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl new file mode 100644 index 0000000000..f8f69c4a1d --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0835a8() { + f16vec3 res = cos(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + cos_0835a8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_0835a8() { + f16vec3 res = cos(f16vec3(0.0hf)); +} + +void fragment_main() { + cos_0835a8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0835a8() { + f16vec3 res = cos(f16vec3(0.0hf)); +} + +void compute_main() { + cos_0835a8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl new file mode 100644 index 0000000000..790a32d15d --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_0835a8() { + half3 res = cos(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_0835a8(); + return; +} + +kernel void compute_main() { + cos_0835a8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm new file mode 100644 index 0000000000..d151e5cefd --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_0835a8 "cos_0835a8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_0835a8 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Cos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_0835a8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_0835a8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_0835a8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl new file mode 100644 index 0000000000..94f028ab80 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cos_0835a8() { + var res : vec3 = cos(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0835a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0835a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0835a8(); +} diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl new file mode 100644 index 0000000000..6bcbb878a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<4, f16>) -> vec<4, f16> +fn cos_0a89f7() { + var res: vec4 = cos(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0a89f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0a89f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0a89f7(); +} diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2a00fd01fa --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_0a89f7() { + vector res = cos((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0a89f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0a89f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83264945f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cos_0a89f7() { + vector res = cos((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0a89f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0a89f7(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016E7F3887E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl new file mode 100644 index 0000000000..9daaaff23e --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0a89f7() { + f16vec4 res = cos(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + cos_0a89f7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_0a89f7() { + f16vec4 res = cos(f16vec4(0.0hf)); +} + +void fragment_main() { + cos_0a89f7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0a89f7() { + f16vec4 res = cos(f16vec4(0.0hf)); +} + +void compute_main() { + cos_0a89f7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl new file mode 100644 index 0000000000..fe465acd64 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_0a89f7() { + half4 res = cos(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_0a89f7(); + return; +} + +kernel void compute_main() { + cos_0a89f7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..5f966233f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_0a89f7 "cos_0a89f7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_0a89f7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Cos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_0a89f7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_0a89f7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_0a89f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..536f85f268 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cos_0a89f7() { + var res : vec4 = cos(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0a89f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0a89f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0a89f7(); +} diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl new file mode 100644 index 0000000000..10964b4ef3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<3, f32>) -> vec<3, f32> +fn cos_16dc15() { + var res: vec3 = cos(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_16dc15(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_16dc15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_16dc15(); +} diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1a92b74610 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_16dc15() { + float3 res = cos((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_16dc15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_16dc15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_16dc15(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1a92b74610 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_16dc15() { + float3 res = cos((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_16dc15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_16dc15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_16dc15(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.glsl new file mode 100644 index 0000000000..9d03c9ebb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_16dc15() { + vec3 res = cos(vec3(1.0f)); +} + +vec4 vertex_main() { + cos_16dc15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_16dc15() { + vec3 res = cos(vec3(1.0f)); +} + +void fragment_main() { + cos_16dc15(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_16dc15() { + vec3 res = cos(vec3(1.0f)); +} + +void compute_main() { + cos_16dc15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.msl new file mode 100644 index 0000000000..e93c8db520 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_16dc15() { + float3 res = cos(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_16dc15(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_16dc15(); + return; +} + +kernel void compute_main() { + cos_16dc15(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.spvasm new file mode 100644 index 0000000000..6909542830 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_16dc15 "cos_16dc15" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %cos_16dc15 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Cos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_16dc15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_16dc15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_16dc15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef3e9a25e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cos_16dc15() { + var res : vec3 = cos(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_16dc15(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_16dc15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_16dc15(); +} diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl new file mode 100644 index 0000000000..cb0bcf592e --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<4, f32>) -> vec<4, f32> +fn cos_29d66d() { + var res: vec4 = cos(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_29d66d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_29d66d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_29d66d(); +} diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0cdea9312 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_29d66d() { + float4 res = cos((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_29d66d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_29d66d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_29d66d(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c0cdea9312 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_29d66d() { + float4 res = cos((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_29d66d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_29d66d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_29d66d(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.glsl new file mode 100644 index 0000000000..9dfa5c949f --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_29d66d() { + vec4 res = cos(vec4(1.0f)); +} + +vec4 vertex_main() { + cos_29d66d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_29d66d() { + vec4 res = cos(vec4(1.0f)); +} + +void fragment_main() { + cos_29d66d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_29d66d() { + vec4 res = cos(vec4(1.0f)); +} + +void compute_main() { + cos_29d66d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.msl new file mode 100644 index 0000000000..055aad554a --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_29d66d() { + float4 res = cos(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_29d66d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_29d66d(); + return; +} + +kernel void compute_main() { + cos_29d66d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b5cebc1a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_29d66d "cos_29d66d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %cos_29d66d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Cos %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_29d66d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cos_29d66d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_29d66d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe681bef56 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cos_29d66d() { + var res : vec4 = cos(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_29d66d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_29d66d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_29d66d(); +} diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl new file mode 100644 index 0000000000..c233d3c67d --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<2, f16>) -> vec<2, f16> +fn cos_5bc2c6() { + var res: vec2 = cos(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_5bc2c6(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_5bc2c6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_5bc2c6(); +} diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a27a2293f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_5bc2c6() { + vector res = cos((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_5bc2c6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_5bc2c6(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f3677eee25 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cos_5bc2c6() { + vector res = cos((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_5bc2c6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_5bc2c6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024E8E5A87E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl new file mode 100644 index 0000000000..6da1c94dd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_5bc2c6() { + f16vec2 res = cos(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + cos_5bc2c6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_5bc2c6() { + f16vec2 res = cos(f16vec2(0.0hf)); +} + +void fragment_main() { + cos_5bc2c6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_5bc2c6() { + f16vec2 res = cos(f16vec2(0.0hf)); +} + +void compute_main() { + cos_5bc2c6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl new file mode 100644 index 0000000000..91434e1496 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_5bc2c6() { + half2 res = cos(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_5bc2c6(); + return; +} + +kernel void compute_main() { + cos_5bc2c6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm new file mode 100644 index 0000000000..278c3e1150 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_5bc2c6 "cos_5bc2c6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_5bc2c6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Cos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_5bc2c6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_5bc2c6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_5bc2c6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl new file mode 100644 index 0000000000..2010e95cbd --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cos_5bc2c6() { + var res : vec2 = cos(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_5bc2c6(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_5bc2c6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_5bc2c6(); +} diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl new file mode 100644 index 0000000000..b1bf2ab65a --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<2, f32>) -> vec<2, f32> +fn cos_c3b486() { + var res: vec2 = cos(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_c3b486(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_c3b486(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_c3b486(); +} diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c6ad101ccc --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_c3b486() { + float2 res = cos((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c3b486(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c3b486(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c3b486(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6ad101ccc --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_c3b486() { + float2 res = cos((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c3b486(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c3b486(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c3b486(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.glsl new file mode 100644 index 0000000000..c55e085334 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_c3b486() { + vec2 res = cos(vec2(1.0f)); +} + +vec4 vertex_main() { + cos_c3b486(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_c3b486() { + vec2 res = cos(vec2(1.0f)); +} + +void fragment_main() { + cos_c3b486(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_c3b486() { + vec2 res = cos(vec2(1.0f)); +} + +void compute_main() { + cos_c3b486(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.msl new file mode 100644 index 0000000000..1bf56af6f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_c3b486() { + float2 res = cos(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_c3b486(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_c3b486(); + return; +} + +kernel void compute_main() { + cos_c3b486(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ab12d312c --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_c3b486 "cos_c3b486" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %cos_c3b486 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Cos %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_c3b486 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_c3b486 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_c3b486 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.wgsl new file mode 100644 index 0000000000..57052ea7ce --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cos_c3b486() { + var res : vec2 = cos(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_c3b486(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_c3b486(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_c3b486(); +} diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl new file mode 100644 index 0000000000..b13516c23d --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(f32) -> f32 +fn cos_c5c28e() { + var res: f32 = cos(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_c5c28e(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_c5c28e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_c5c28e(); +} diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46c1272145 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_c5c28e() { + float res = cos(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c5c28e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c5c28e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c5c28e(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..46c1272145 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_c5c28e() { + float res = cos(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c5c28e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c5c28e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c5c28e(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.glsl new file mode 100644 index 0000000000..44893f8e8d --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_c5c28e() { + float res = cos(1.0f); +} + +vec4 vertex_main() { + cos_c5c28e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_c5c28e() { + float res = cos(1.0f); +} + +void fragment_main() { + cos_c5c28e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_c5c28e() { + float res = cos(1.0f); +} + +void compute_main() { + cos_c5c28e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.msl new file mode 100644 index 0000000000..2fc7d06480 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_c5c28e() { + float res = cos(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_c5c28e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_c5c28e(); + return; +} + +kernel void compute_main() { + cos_c5c28e(); + return; +} + diff --git a/test/tint/builtins/gen/cos/c5c28e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/cos/c5c28e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b9b508d85 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cos_c5c28e() { + var res : f32 = cos(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_c5c28e(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_c5c28e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_c5c28e(); +} diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl new file mode 100644 index 0000000000..630e2fd3a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(f16) -> f16 +fn cos_fc047d() { + var res: f16 = cos(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_fc047d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_fc047d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_fc047d(); +} diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f240327915 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_fc047d() { + float16_t res = cos(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_fc047d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_fc047d(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e33a4d6b72 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void cos_fc047d() { + float16_t res = cos(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_fc047d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_fc047d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015329BF7D10(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015329BF7D10(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl new file mode 100644 index 0000000000..01af81ddf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_fc047d() { + float16_t res = cos(0.0hf); +} + +vec4 vertex_main() { + cos_fc047d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_fc047d() { + float16_t res = cos(0.0hf); +} + +void fragment_main() { + cos_fc047d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_fc047d() { + float16_t res = cos(0.0hf); +} + +void compute_main() { + cos_fc047d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl new file mode 100644 index 0000000000..e38b8e955a --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_fc047d() { + half res = cos(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_fc047d(); + return; +} + +kernel void compute_main() { + cos_fc047d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4c73fe0c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_fc047d "cos_fc047d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_fc047d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Cos %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_fc047d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cos_fc047d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_fc047d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl new file mode 100644 index 0000000000..5671f4cc1e --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cos_fc047d() { + var res : f16 = cos(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_fc047d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_fc047d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_fc047d(); +} diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl new file mode 100644 index 0000000000..a8fcdf8a37 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(f16) -> f16 +fn cosh_2ed778() { + var res: f16 = cosh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_2ed778(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_2ed778(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_2ed778(); +} diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f032f20dea --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_2ed778() { + float16_t res = cosh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_2ed778(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_2ed778(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..423dd17d62 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void cosh_2ed778() { + float16_t res = cosh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_2ed778(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_2ed778(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021F3BD88850(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021F3BD88850(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl new file mode 100644 index 0000000000..798c9bcb64 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_2ed778() { + float16_t res = cosh(0.0hf); +} + +vec4 vertex_main() { + cosh_2ed778(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_2ed778() { + float16_t res = cosh(0.0hf); +} + +void fragment_main() { + cosh_2ed778(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_2ed778() { + float16_t res = cosh(0.0hf); +} + +void compute_main() { + cosh_2ed778(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl new file mode 100644 index 0000000000..5fa15c3821 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_2ed778() { + half res = cosh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_2ed778(); + return; +} + +kernel void compute_main() { + cosh_2ed778(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm new file mode 100644 index 0000000000..bba06a4533 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_2ed778 "cosh_2ed778" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_2ed778 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Cosh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_2ed778 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cosh_2ed778 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_2ed778 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl new file mode 100644 index 0000000000..00b8f277c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cosh_2ed778() { + var res : f16 = cosh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_2ed778(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_2ed778(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_2ed778(); +} diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl new file mode 100644 index 0000000000..03659adab1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<3, f32>) -> vec<3, f32> +fn cosh_377652() { + var res: vec3 = cosh(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_377652(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_377652(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_377652(); +} diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d707c4b5cf --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_377652() { + float3 res = cosh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_377652(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_377652(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_377652(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d707c4b5cf --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_377652() { + float3 res = cosh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_377652(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_377652(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_377652(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.glsl new file mode 100644 index 0000000000..838edd05fa --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_377652() { + vec3 res = cosh(vec3(1.0f)); +} + +vec4 vertex_main() { + cosh_377652(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_377652() { + vec3 res = cosh(vec3(1.0f)); +} + +void fragment_main() { + cosh_377652(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_377652() { + vec3 res = cosh(vec3(1.0f)); +} + +void compute_main() { + cosh_377652(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.msl new file mode 100644 index 0000000000..22932f1ef7 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_377652() { + float3 res = cosh(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_377652(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_377652(); + return; +} + +kernel void compute_main() { + cosh_377652(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.spvasm new file mode 100644 index 0000000000..33b3840e7d --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_377652 "cosh_377652" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%cosh_377652 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Cosh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_377652 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_377652 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_377652 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.wgsl new file mode 100644 index 0000000000..250df0b12d --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cosh_377652() { + var res : vec3 = cosh(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_377652(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_377652(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_377652(); +} diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl new file mode 100644 index 0000000000..d1e959aef0 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<4, f16>) -> vec<4, f16> +fn cosh_3b7bbf() { + var res: vec4 = cosh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_3b7bbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_3b7bbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_3b7bbf(); +} diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ede2f1a20e --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_3b7bbf() { + vector res = cosh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_3b7bbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_3b7bbf(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e19b88c81 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cosh_3b7bbf() { + vector res = cosh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_3b7bbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_3b7bbf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020A6F400DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl new file mode 100644 index 0000000000..73e0dc9272 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_3b7bbf() { + f16vec4 res = cosh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + cosh_3b7bbf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_3b7bbf() { + f16vec4 res = cosh(f16vec4(0.0hf)); +} + +void fragment_main() { + cosh_3b7bbf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_3b7bbf() { + f16vec4 res = cosh(f16vec4(0.0hf)); +} + +void compute_main() { + cosh_3b7bbf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl new file mode 100644 index 0000000000..c0d6580131 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_3b7bbf() { + half4 res = cosh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_3b7bbf(); + return; +} + +kernel void compute_main() { + cosh_3b7bbf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm new file mode 100644 index 0000000000..da245fd39a --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_3b7bbf "cosh_3b7bbf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_3b7bbf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Cosh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_3b7bbf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_3b7bbf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_3b7bbf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl new file mode 100644 index 0000000000..09eaedea4c --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cosh_3b7bbf() { + var res : vec4 = cosh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_3b7bbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_3b7bbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_3b7bbf(); +} diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl new file mode 100644 index 0000000000..a3d55056a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<2, f16>) -> vec<2, f16> +fn cosh_43b672() { + var res: vec2 = cosh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_43b672(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_43b672(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_43b672(); +} diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b54430cc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_43b672() { + vector res = cosh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_43b672(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_43b672(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1f7f46df6 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cosh_43b672() { + vector res = cosh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_43b672(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_43b672(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002ACB9EB1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl new file mode 100644 index 0000000000..8b04b98826 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_43b672() { + f16vec2 res = cosh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + cosh_43b672(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_43b672() { + f16vec2 res = cosh(f16vec2(0.0hf)); +} + +void fragment_main() { + cosh_43b672(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_43b672() { + f16vec2 res = cosh(f16vec2(0.0hf)); +} + +void compute_main() { + cosh_43b672(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl new file mode 100644 index 0000000000..697c07981c --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_43b672() { + half2 res = cosh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_43b672(); + return; +} + +kernel void compute_main() { + cosh_43b672(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm new file mode 100644 index 0000000000..76983acbc7 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_43b672 "cosh_43b672" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_43b672 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Cosh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_43b672 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_43b672 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_43b672 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl new file mode 100644 index 0000000000..6646f2d1dc --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cosh_43b672() { + var res : vec2 = cosh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_43b672(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_43b672(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_43b672(); +} diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl new file mode 100644 index 0000000000..99a4004f2a --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<3, f16>) -> vec<3, f16> +fn cosh_b1b8a0() { + var res: vec3 = cosh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_b1b8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_b1b8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_b1b8a0(); +} diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5be4cfe6e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_b1b8a0() { + vector res = cosh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_b1b8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_b1b8a0(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6e2ac145c --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cosh_b1b8a0() { + vector res = cosh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_b1b8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_b1b8a0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D169B6EAF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl new file mode 100644 index 0000000000..995b0d7a09 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_b1b8a0() { + f16vec3 res = cosh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + cosh_b1b8a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_b1b8a0() { + f16vec3 res = cosh(f16vec3(0.0hf)); +} + +void fragment_main() { + cosh_b1b8a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_b1b8a0() { + f16vec3 res = cosh(f16vec3(0.0hf)); +} + +void compute_main() { + cosh_b1b8a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl new file mode 100644 index 0000000000..b426dbb310 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_b1b8a0() { + half3 res = cosh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_b1b8a0(); + return; +} + +kernel void compute_main() { + cosh_b1b8a0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a5a56621c --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_b1b8a0 "cosh_b1b8a0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_b1b8a0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Cosh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_b1b8a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_b1b8a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_b1b8a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf06df51a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cosh_b1b8a0() { + var res : vec3 = cosh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_b1b8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_b1b8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_b1b8a0(); +} diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl new file mode 100644 index 0000000000..fd951c04e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<2, f32>) -> vec<2, f32> +fn cosh_c13756() { + var res: vec2 = cosh(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_c13756(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_c13756(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_c13756(); +} diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..61f7c95da9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_c13756() { + float2 res = cosh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_c13756(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_c13756(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_c13756(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..61f7c95da9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_c13756() { + float2 res = cosh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_c13756(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_c13756(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_c13756(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.glsl new file mode 100644 index 0000000000..76e33c1d16 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_c13756() { + vec2 res = cosh(vec2(1.0f)); +} + +vec4 vertex_main() { + cosh_c13756(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_c13756() { + vec2 res = cosh(vec2(1.0f)); +} + +void fragment_main() { + cosh_c13756(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_c13756() { + vec2 res = cosh(vec2(1.0f)); +} + +void compute_main() { + cosh_c13756(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.msl new file mode 100644 index 0000000000..95449a54b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_c13756() { + float2 res = cosh(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_c13756(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_c13756(); + return; +} + +kernel void compute_main() { + cosh_c13756(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.spvasm new file mode 100644 index 0000000000..a250a0f184 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_c13756 "cosh_c13756" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%cosh_c13756 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Cosh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_c13756 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_c13756 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_c13756 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.wgsl new file mode 100644 index 0000000000..497dbbd4ef --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cosh_c13756() { + var res : vec2 = cosh(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_c13756(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_c13756(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_c13756(); +} diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl new file mode 100644 index 0000000000..6a495f236f --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(f32) -> f32 +fn cosh_da92dd() { + var res: f32 = cosh(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_da92dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_da92dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_da92dd(); +} diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1b4f6c8d25 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_da92dd() { + float res = cosh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_da92dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_da92dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_da92dd(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1b4f6c8d25 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_da92dd() { + float res = cosh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_da92dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_da92dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_da92dd(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.glsl new file mode 100644 index 0000000000..0d980ed6bb --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_da92dd() { + float res = cosh(1.0f); +} + +vec4 vertex_main() { + cosh_da92dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_da92dd() { + float res = cosh(1.0f); +} + +void fragment_main() { + cosh_da92dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_da92dd() { + float res = cosh(1.0f); +} + +void compute_main() { + cosh_da92dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.msl new file mode 100644 index 0000000000..9cc36ccc46 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_da92dd() { + float res = cosh(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_da92dd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_da92dd(); + return; +} + +kernel void compute_main() { + cosh_da92dd(); + return; +} + diff --git a/test/tint/builtins/gen/cosh/da92dd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/cosh/da92dd.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..fb310c1aee --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cosh_da92dd() { + var res : f32 = cosh(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_da92dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_da92dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_da92dd(); +} diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl new file mode 100644 index 0000000000..8c398d92b0 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<4, f32>) -> vec<4, f32> +fn cosh_e0c1de() { + var res: vec4 = cosh(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_e0c1de(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_e0c1de(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_e0c1de(); +} diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..713b746cc1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_e0c1de() { + float4 res = cosh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_e0c1de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_e0c1de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_e0c1de(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..713b746cc1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_e0c1de() { + float4 res = cosh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_e0c1de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_e0c1de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_e0c1de(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.glsl new file mode 100644 index 0000000000..a7038c289d --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_e0c1de() { + vec4 res = cosh(vec4(1.0f)); +} + +vec4 vertex_main() { + cosh_e0c1de(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_e0c1de() { + vec4 res = cosh(vec4(1.0f)); +} + +void fragment_main() { + cosh_e0c1de(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_e0c1de() { + vec4 res = cosh(vec4(1.0f)); +} + +void compute_main() { + cosh_e0c1de(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.msl new file mode 100644 index 0000000000..8879f54425 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_e0c1de() { + float4 res = cosh(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_e0c1de(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_e0c1de(); + return; +} + +kernel void compute_main() { + cosh_e0c1de(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.spvasm new file mode 100644 index 0000000000..67b1b4c55e --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_e0c1de "cosh_e0c1de" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%cosh_e0c1de = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Cosh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_e0c1de + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_e0c1de + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_e0c1de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2a273b4fd --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cosh_e0c1de() { + var res : vec4 = cosh(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_e0c1de(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_e0c1de(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_e0c1de(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl new file mode 100644 index 0000000000..fd1e1a91b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(u32) -> u32 +fn countLeadingZeros_208d46() { + var res: u32 = countLeadingZeros(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_208d46(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_208d46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_208d46(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..297947f9c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint res = tint_count_leading_zeros(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_208d46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_208d46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_208d46(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..297947f9c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint res = tint_count_leading_zeros(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_208d46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_208d46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_208d46(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.glsl new file mode 100644 index 0000000000..4282edf614 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint res = tint_count_leading_zeros(1u); +} + +vec4 vertex_main() { + countLeadingZeros_208d46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint res = tint_count_leading_zeros(1u); +} + +void fragment_main() { + countLeadingZeros_208d46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint res = tint_count_leading_zeros(1u); +} + +void compute_main() { + countLeadingZeros_208d46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.msl b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.msl new file mode 100644 index 0000000000..da0f3aec1b --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countLeadingZeros_208d46() { + uint res = clz(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_208d46(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_208d46(); + return; +} + +kernel void compute_main() { + countLeadingZeros_208d46(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.spvasm new file mode 100644 index 0000000000..472bf589bf --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.spvasm @@ -0,0 +1,123 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_208d46 "countLeadingZeros_208d46" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %uint_65535 = OpConstant %uint 65535 + %bool = OpTypeBool + %uint_16 = OpConstant %uint 16 +%uint_16777215 = OpConstant %uint 16777215 + %uint_8 = OpConstant %uint 8 +%uint_268435455 = OpConstant %uint 268435455 + %uint_4 = OpConstant %uint 4 +%uint_1073741823 = OpConstant %uint 1073741823 + %uint_2 = OpConstant %uint 2 +%uint_2147483647 = OpConstant %uint 2147483647 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %61 = OpTypeFunction %void + %67 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %17 + OpStore %x %v + %19 = OpLoad %uint %x + %21 = OpULessThanEqual %bool %19 %uint_65535 + %18 = OpSelect %uint %21 %uint_16 %17 + %24 = OpLoad %uint %x + %25 = OpShiftLeftLogical %uint %24 %18 + OpStore %x %25 + %27 = OpLoad %uint %x + %29 = OpULessThanEqual %bool %27 %uint_16777215 + %26 = OpSelect %uint %29 %uint_8 %17 + %31 = OpLoad %uint %x + %32 = OpShiftLeftLogical %uint %31 %26 + OpStore %x %32 + %34 = OpLoad %uint %x + %36 = OpULessThanEqual %bool %34 %uint_268435455 + %33 = OpSelect %uint %36 %uint_4 %17 + %38 = OpLoad %uint %x + %39 = OpShiftLeftLogical %uint %38 %33 + OpStore %x %39 + %41 = OpLoad %uint %x + %43 = OpULessThanEqual %bool %41 %uint_1073741823 + %40 = OpSelect %uint %43 %uint_2 %17 + %45 = OpLoad %uint %x + %46 = OpShiftLeftLogical %uint %45 %40 + OpStore %x %46 + %48 = OpLoad %uint %x + %50 = OpULessThanEqual %bool %48 %uint_2147483647 + %47 = OpSelect %uint %50 %uint_1 %17 + %53 = OpLoad %uint %x + %54 = OpIEqual %bool %53 %17 + %52 = OpSelect %uint %54 %uint_1 %17 + %56 = OpBitwiseOr %uint %18 %26 + %57 = OpBitwiseOr %uint %56 %33 + %58 = OpBitwiseOr %uint %57 %40 + %59 = OpBitwiseOr %uint %58 %47 + %60 = OpIAdd %uint %59 %52 + OpReturnValue %60 + OpFunctionEnd +%countLeadingZeros_208d46 = OpFunction %void None %61 + %64 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %65 = OpFunctionCall %uint %tint_count_leading_zeros %uint_1 + OpStore %res %65 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %67 + %69 = OpLabel + %70 = OpFunctionCall %void %countLeadingZeros_208d46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %61 + %72 = OpLabel + %73 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %73 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %61 + %76 = OpLabel + %77 = OpFunctionCall %void %countLeadingZeros_208d46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %61 + %79 = OpLabel + %80 = OpFunctionCall %void %countLeadingZeros_208d46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.wgsl new file mode 100644 index 0000000000..ccf686a47d --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/208d46.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countLeadingZeros_208d46() { + var res : u32 = countLeadingZeros(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_208d46(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_208d46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_208d46(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl new file mode 100644 index 0000000000..d14ab0d28d --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(i32) -> i32 +fn countLeadingZeros_6d4656() { + var res: i32 = countLeadingZeros(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_6d4656(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_6d4656(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_6d4656(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c31a77cf2e --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int tint_count_leading_zeros(int v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int res = tint_count_leading_zeros(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_6d4656(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_6d4656(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_6d4656(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c31a77cf2e --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int tint_count_leading_zeros(int v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int res = tint_count_leading_zeros(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_6d4656(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_6d4656(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_6d4656(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.glsl new file mode 100644 index 0000000000..d9b4f1d9e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +int tint_count_leading_zeros(int v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int res = tint_count_leading_zeros(1); +} + +vec4 vertex_main() { + countLeadingZeros_6d4656(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_count_leading_zeros(int v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int res = tint_count_leading_zeros(1); +} + +void fragment_main() { + countLeadingZeros_6d4656(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_count_leading_zeros(int v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int res = tint_count_leading_zeros(1); +} + +void compute_main() { + countLeadingZeros_6d4656(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.msl b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.msl new file mode 100644 index 0000000000..3a085a5dbf --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countLeadingZeros_6d4656() { + int res = clz(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_6d4656(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_6d4656(); + return; +} + +kernel void compute_main() { + countLeadingZeros_6d4656(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.spvasm new file mode 100644 index 0000000000..4e73e3f0a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_6d4656 "countLeadingZeros_6d4656" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %uint_65535 = OpConstant %uint 65535 + %bool = OpTypeBool + %uint_16 = OpConstant %uint 16 +%uint_16777215 = OpConstant %uint 16777215 + %uint_8 = OpConstant %uint 8 +%uint_268435455 = OpConstant %uint 268435455 + %uint_4 = OpConstant %uint 4 +%uint_1073741823 = OpConstant %uint 1073741823 + %uint_2 = OpConstant %uint 2 +%uint_2147483647 = OpConstant %uint 2147483647 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %62 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %70 = OpConstantNull %int + %71 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %18 + %14 = OpBitcast %uint %v + OpStore %x %14 + %20 = OpLoad %uint %x + %22 = OpULessThanEqual %bool %20 %uint_65535 + %19 = OpSelect %uint %22 %uint_16 %18 + %25 = OpLoad %uint %x + %26 = OpShiftLeftLogical %uint %25 %19 + OpStore %x %26 + %28 = OpLoad %uint %x + %30 = OpULessThanEqual %bool %28 %uint_16777215 + %27 = OpSelect %uint %30 %uint_8 %18 + %32 = OpLoad %uint %x + %33 = OpShiftLeftLogical %uint %32 %27 + OpStore %x %33 + %35 = OpLoad %uint %x + %37 = OpULessThanEqual %bool %35 %uint_268435455 + %34 = OpSelect %uint %37 %uint_4 %18 + %39 = OpLoad %uint %x + %40 = OpShiftLeftLogical %uint %39 %34 + OpStore %x %40 + %42 = OpLoad %uint %x + %44 = OpULessThanEqual %bool %42 %uint_1073741823 + %41 = OpSelect %uint %44 %uint_2 %18 + %46 = OpLoad %uint %x + %47 = OpShiftLeftLogical %uint %46 %41 + OpStore %x %47 + %49 = OpLoad %uint %x + %51 = OpULessThanEqual %bool %49 %uint_2147483647 + %48 = OpSelect %uint %51 %uint_1 %18 + %54 = OpLoad %uint %x + %55 = OpIEqual %bool %54 %18 + %53 = OpSelect %uint %55 %uint_1 %18 + %57 = OpBitwiseOr %uint %19 %27 + %58 = OpBitwiseOr %uint %57 %34 + %59 = OpBitwiseOr %uint %58 %41 + %60 = OpBitwiseOr %uint %59 %48 + %61 = OpIAdd %uint %60 %53 + %56 = OpBitcast %int %61 + OpReturnValue %56 + OpFunctionEnd +%countLeadingZeros_6d4656 = OpFunction %void None %62 + %65 = OpLabel + %res = OpVariable %_ptr_Function_int Function %70 + %66 = OpFunctionCall %int %tint_count_leading_zeros %int_1 + OpStore %res %66 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %71 + %73 = OpLabel + %74 = OpFunctionCall %void %countLeadingZeros_6d4656 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %62 + %76 = OpLabel + %77 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %77 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %62 + %80 = OpLabel + %81 = OpFunctionCall %void %countLeadingZeros_6d4656 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %62 + %83 = OpLabel + %84 = OpFunctionCall %void %countLeadingZeros_6d4656 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc35ad5d80 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/6d4656.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countLeadingZeros_6d4656() { + var res : i32 = countLeadingZeros(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_6d4656(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_6d4656(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_6d4656(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl new file mode 100644 index 0000000000..2c9868bcb2 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<2, u32>) -> vec<2, u32> +fn countLeadingZeros_70783f() { + var res: vec2 = countLeadingZeros(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_70783f(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_70783f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_70783f(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..60ae7159e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint2 tint_count_leading_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uint2 res = tint_count_leading_zeros((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_70783f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_70783f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_70783f(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60ae7159e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint2 tint_count_leading_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uint2 res = tint_count_leading_zeros((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_70783f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_70783f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_70783f(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.glsl new file mode 100644 index 0000000000..09b8cfe3d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec2 tint_count_leading_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uvec2 res = tint_count_leading_zeros(uvec2(1u)); +} + +vec4 vertex_main() { + countLeadingZeros_70783f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_count_leading_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uvec2 res = tint_count_leading_zeros(uvec2(1u)); +} + +void fragment_main() { + countLeadingZeros_70783f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_count_leading_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uvec2 res = tint_count_leading_zeros(uvec2(1u)); +} + +void compute_main() { + countLeadingZeros_70783f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.msl b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.msl new file mode 100644 index 0000000000..9758cd3383 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countLeadingZeros_70783f() { + uint2 res = clz(uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_70783f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_70783f(); + return; +} + +kernel void compute_main() { + countLeadingZeros_70783f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa1288499b --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_70783f "countLeadingZeros_70783f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %18 = OpConstantNull %v2uint + %uint_65535 = OpConstant %uint 65535 + %22 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v2uint %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %33 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %36 = OpConstantComposite %v2uint %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %42 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %45 = OpConstantComposite %v2uint %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %51 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %54 = OpConstantComposite %v2uint %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %60 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %63 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %73 = OpTypeFunction %void + %79 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %x %v + %20 = OpLoad %v2uint %x + %23 = OpULessThanEqual %v2bool %20 %22 + %19 = OpSelect %v2uint %23 %27 %18 + %28 = OpLoad %v2uint %x + %29 = OpShiftLeftLogical %v2uint %28 %19 + OpStore %x %29 + %31 = OpLoad %v2uint %x + %34 = OpULessThanEqual %v2bool %31 %33 + %30 = OpSelect %v2uint %34 %36 %18 + %37 = OpLoad %v2uint %x + %38 = OpShiftLeftLogical %v2uint %37 %30 + OpStore %x %38 + %40 = OpLoad %v2uint %x + %43 = OpULessThanEqual %v2bool %40 %42 + %39 = OpSelect %v2uint %43 %45 %18 + %46 = OpLoad %v2uint %x + %47 = OpShiftLeftLogical %v2uint %46 %39 + OpStore %x %47 + %49 = OpLoad %v2uint %x + %52 = OpULessThanEqual %v2bool %49 %51 + %48 = OpSelect %v2uint %52 %54 %18 + %55 = OpLoad %v2uint %x + %56 = OpShiftLeftLogical %v2uint %55 %48 + OpStore %x %56 + %58 = OpLoad %v2uint %x + %61 = OpULessThanEqual %v2bool %58 %60 + %57 = OpSelect %v2uint %61 %63 %18 + %65 = OpLoad %v2uint %x + %66 = OpIEqual %v2bool %65 %18 + %64 = OpSelect %v2uint %66 %63 %18 + %68 = OpBitwiseOr %v2uint %19 %30 + %69 = OpBitwiseOr %v2uint %68 %39 + %70 = OpBitwiseOr %v2uint %69 %48 + %71 = OpBitwiseOr %v2uint %70 %57 + %72 = OpIAdd %v2uint %71 %64 + OpReturnValue %72 + OpFunctionEnd +%countLeadingZeros_70783f = OpFunction %void None %73 + %76 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %18 + %77 = OpFunctionCall %v2uint %tint_count_leading_zeros %63 + OpStore %res %77 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %79 + %81 = OpLabel + %82 = OpFunctionCall %void %countLeadingZeros_70783f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %73 + %84 = OpLabel + %85 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %85 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %73 + %88 = OpLabel + %89 = OpFunctionCall %void %countLeadingZeros_70783f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %73 + %91 = OpLabel + %92 = OpFunctionCall %void %countLeadingZeros_70783f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.wgsl new file mode 100644 index 0000000000..6d34dec9e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/70783f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countLeadingZeros_70783f() { + var res : vec2 = countLeadingZeros(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_70783f(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_70783f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_70783f(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl new file mode 100644 index 0000000000..184970a0c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<3, i32>) -> vec<3, i32> +fn countLeadingZeros_7c38a6() { + var res: vec3 = countLeadingZeros(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_7c38a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_7c38a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_7c38a6(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fbc0183ce7 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int3 tint_count_leading_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + int3 res = tint_count_leading_zeros((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_7c38a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_7c38a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_7c38a6(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fbc0183ce7 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int3 tint_count_leading_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + int3 res = tint_count_leading_zeros((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_7c38a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_7c38a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_7c38a6(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.glsl new file mode 100644 index 0000000000..daf451ff67 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec3 tint_count_leading_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + ivec3 res = tint_count_leading_zeros(ivec3(1)); +} + +vec4 vertex_main() { + countLeadingZeros_7c38a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_count_leading_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + ivec3 res = tint_count_leading_zeros(ivec3(1)); +} + +void fragment_main() { + countLeadingZeros_7c38a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_count_leading_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + ivec3 res = tint_count_leading_zeros(ivec3(1)); +} + +void compute_main() { + countLeadingZeros_7c38a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.msl b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.msl new file mode 100644 index 0000000000..dcab0ad5dd --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countLeadingZeros_7c38a6() { + int3 res = clz(int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_7c38a6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_7c38a6(); + return; +} + +kernel void compute_main() { + countLeadingZeros_7c38a6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..b68f4a6f97 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.spvasm @@ -0,0 +1,143 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_7c38a6 "countLeadingZeros_7c38a6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %uint_65535 = OpConstant %uint 65535 + %24 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_16 = OpConstant %uint 16 + %29 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %35 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %44 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %53 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %56 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %62 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %75 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %81 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %84 = OpConstantNull %v3int + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %20 + %15 = OpBitcast %v3uint %v + OpStore %x %15 + %22 = OpLoad %v3uint %x + %25 = OpULessThanEqual %v3bool %22 %24 + %21 = OpSelect %v3uint %25 %29 %20 + %30 = OpLoad %v3uint %x + %31 = OpShiftLeftLogical %v3uint %30 %21 + OpStore %x %31 + %33 = OpLoad %v3uint %x + %36 = OpULessThanEqual %v3bool %33 %35 + %32 = OpSelect %v3uint %36 %38 %20 + %39 = OpLoad %v3uint %x + %40 = OpShiftLeftLogical %v3uint %39 %32 + OpStore %x %40 + %42 = OpLoad %v3uint %x + %45 = OpULessThanEqual %v3bool %42 %44 + %41 = OpSelect %v3uint %45 %47 %20 + %48 = OpLoad %v3uint %x + %49 = OpShiftLeftLogical %v3uint %48 %41 + OpStore %x %49 + %51 = OpLoad %v3uint %x + %54 = OpULessThanEqual %v3bool %51 %53 + %50 = OpSelect %v3uint %54 %56 %20 + %57 = OpLoad %v3uint %x + %58 = OpShiftLeftLogical %v3uint %57 %50 + OpStore %x %58 + %60 = OpLoad %v3uint %x + %63 = OpULessThanEqual %v3bool %60 %62 + %59 = OpSelect %v3uint %63 %65 %20 + %67 = OpLoad %v3uint %x + %68 = OpIEqual %v3bool %67 %20 + %66 = OpSelect %v3uint %68 %65 %20 + %70 = OpBitwiseOr %v3uint %21 %32 + %71 = OpBitwiseOr %v3uint %70 %41 + %72 = OpBitwiseOr %v3uint %71 %50 + %73 = OpBitwiseOr %v3uint %72 %59 + %74 = OpIAdd %v3uint %73 %66 + %69 = OpBitcast %v3int %74 + OpReturnValue %69 + OpFunctionEnd +%countLeadingZeros_7c38a6 = OpFunction %void None %75 + %78 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %84 + %79 = OpFunctionCall %v3int %tint_count_leading_zeros %81 + OpStore %res %79 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %countLeadingZeros_7c38a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %75 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %75 + %94 = OpLabel + %95 = OpFunctionCall %void %countLeadingZeros_7c38a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %75 + %97 = OpLabel + %98 = OpFunctionCall %void %countLeadingZeros_7c38a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..59dff9117b --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/7c38a6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countLeadingZeros_7c38a6() { + var res : vec3 = countLeadingZeros(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_7c38a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_7c38a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_7c38a6(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl new file mode 100644 index 0000000000..8713edef30 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<2, i32>) -> vec<2, i32> +fn countLeadingZeros_858d40() { + var res: vec2 = countLeadingZeros(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_858d40(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_858d40(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_858d40(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0dbc22b034 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int2 tint_count_leading_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + int2 res = tint_count_leading_zeros((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_858d40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_858d40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_858d40(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0dbc22b034 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int2 tint_count_leading_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + int2 res = tint_count_leading_zeros((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_858d40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_858d40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_858d40(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.glsl new file mode 100644 index 0000000000..875e499f4f --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec2 tint_count_leading_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + ivec2 res = tint_count_leading_zeros(ivec2(1)); +} + +vec4 vertex_main() { + countLeadingZeros_858d40(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_count_leading_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + ivec2 res = tint_count_leading_zeros(ivec2(1)); +} + +void fragment_main() { + countLeadingZeros_858d40(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_count_leading_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + ivec2 res = tint_count_leading_zeros(ivec2(1)); +} + +void compute_main() { + countLeadingZeros_858d40(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.msl b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.msl new file mode 100644 index 0000000000..aad89f72be --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countLeadingZeros_858d40() { + int2 res = clz(int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_858d40(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_858d40(); + return; +} + +kernel void compute_main() { + countLeadingZeros_858d40(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.spvasm new file mode 100644 index 0000000000..ab5c154fbb --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.spvasm @@ -0,0 +1,143 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_858d40 "countLeadingZeros_858d40" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %uint_65535 = OpConstant %uint 65535 + %24 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_16 = OpConstant %uint 16 + %29 = OpConstantComposite %v2uint %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %35 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v2uint %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %44 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v2uint %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %53 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %56 = OpConstantComposite %v2uint %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %62 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %75 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %81 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %84 = OpConstantNull %v2int + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %20 + %15 = OpBitcast %v2uint %v + OpStore %x %15 + %22 = OpLoad %v2uint %x + %25 = OpULessThanEqual %v2bool %22 %24 + %21 = OpSelect %v2uint %25 %29 %20 + %30 = OpLoad %v2uint %x + %31 = OpShiftLeftLogical %v2uint %30 %21 + OpStore %x %31 + %33 = OpLoad %v2uint %x + %36 = OpULessThanEqual %v2bool %33 %35 + %32 = OpSelect %v2uint %36 %38 %20 + %39 = OpLoad %v2uint %x + %40 = OpShiftLeftLogical %v2uint %39 %32 + OpStore %x %40 + %42 = OpLoad %v2uint %x + %45 = OpULessThanEqual %v2bool %42 %44 + %41 = OpSelect %v2uint %45 %47 %20 + %48 = OpLoad %v2uint %x + %49 = OpShiftLeftLogical %v2uint %48 %41 + OpStore %x %49 + %51 = OpLoad %v2uint %x + %54 = OpULessThanEqual %v2bool %51 %53 + %50 = OpSelect %v2uint %54 %56 %20 + %57 = OpLoad %v2uint %x + %58 = OpShiftLeftLogical %v2uint %57 %50 + OpStore %x %58 + %60 = OpLoad %v2uint %x + %63 = OpULessThanEqual %v2bool %60 %62 + %59 = OpSelect %v2uint %63 %65 %20 + %67 = OpLoad %v2uint %x + %68 = OpIEqual %v2bool %67 %20 + %66 = OpSelect %v2uint %68 %65 %20 + %70 = OpBitwiseOr %v2uint %21 %32 + %71 = OpBitwiseOr %v2uint %70 %41 + %72 = OpBitwiseOr %v2uint %71 %50 + %73 = OpBitwiseOr %v2uint %72 %59 + %74 = OpIAdd %v2uint %73 %66 + %69 = OpBitcast %v2int %74 + OpReturnValue %69 + OpFunctionEnd +%countLeadingZeros_858d40 = OpFunction %void None %75 + %78 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %84 + %79 = OpFunctionCall %v2int %tint_count_leading_zeros %81 + OpStore %res %79 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %countLeadingZeros_858d40 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %75 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %75 + %94 = OpLabel + %95 = OpFunctionCall %void %countLeadingZeros_858d40 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %75 + %97 = OpLabel + %98 = OpFunctionCall %void %countLeadingZeros_858d40 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.wgsl new file mode 100644 index 0000000000..632c168826 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/858d40.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countLeadingZeros_858d40() { + var res : vec2 = countLeadingZeros(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_858d40(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_858d40(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_858d40(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl new file mode 100644 index 0000000000..f48875c010 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<3, u32>) -> vec<3, u32> +fn countLeadingZeros_ab6345() { + var res: vec3 = countLeadingZeros(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_ab6345(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_ab6345(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_ab6345(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..56e471a049 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint3 tint_count_leading_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uint3 res = tint_count_leading_zeros((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_ab6345(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_ab6345(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_ab6345(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56e471a049 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint3 tint_count_leading_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uint3 res = tint_count_leading_zeros((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_ab6345(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_ab6345(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_ab6345(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.glsl new file mode 100644 index 0000000000..bc8be9cdb9 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec3 tint_count_leading_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uvec3 res = tint_count_leading_zeros(uvec3(1u)); +} + +vec4 vertex_main() { + countLeadingZeros_ab6345(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_count_leading_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uvec3 res = tint_count_leading_zeros(uvec3(1u)); +} + +void fragment_main() { + countLeadingZeros_ab6345(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_count_leading_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uvec3 res = tint_count_leading_zeros(uvec3(1u)); +} + +void compute_main() { + countLeadingZeros_ab6345(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.msl b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.msl new file mode 100644 index 0000000000..85d4ca8c52 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countLeadingZeros_ab6345() { + uint3 res = clz(uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_ab6345(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_ab6345(); + return; +} + +kernel void compute_main() { + countLeadingZeros_ab6345(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.spvasm new file mode 100644 index 0000000000..94f2f81e93 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_ab6345 "countLeadingZeros_ab6345" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %uint_65535 = OpConstant %uint 65535 + %22 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %33 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %36 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %42 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %45 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %51 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %54 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %60 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %63 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %73 = OpTypeFunction %void + %79 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %x %v + %20 = OpLoad %v3uint %x + %23 = OpULessThanEqual %v3bool %20 %22 + %19 = OpSelect %v3uint %23 %27 %18 + %28 = OpLoad %v3uint %x + %29 = OpShiftLeftLogical %v3uint %28 %19 + OpStore %x %29 + %31 = OpLoad %v3uint %x + %34 = OpULessThanEqual %v3bool %31 %33 + %30 = OpSelect %v3uint %34 %36 %18 + %37 = OpLoad %v3uint %x + %38 = OpShiftLeftLogical %v3uint %37 %30 + OpStore %x %38 + %40 = OpLoad %v3uint %x + %43 = OpULessThanEqual %v3bool %40 %42 + %39 = OpSelect %v3uint %43 %45 %18 + %46 = OpLoad %v3uint %x + %47 = OpShiftLeftLogical %v3uint %46 %39 + OpStore %x %47 + %49 = OpLoad %v3uint %x + %52 = OpULessThanEqual %v3bool %49 %51 + %48 = OpSelect %v3uint %52 %54 %18 + %55 = OpLoad %v3uint %x + %56 = OpShiftLeftLogical %v3uint %55 %48 + OpStore %x %56 + %58 = OpLoad %v3uint %x + %61 = OpULessThanEqual %v3bool %58 %60 + %57 = OpSelect %v3uint %61 %63 %18 + %65 = OpLoad %v3uint %x + %66 = OpIEqual %v3bool %65 %18 + %64 = OpSelect %v3uint %66 %63 %18 + %68 = OpBitwiseOr %v3uint %19 %30 + %69 = OpBitwiseOr %v3uint %68 %39 + %70 = OpBitwiseOr %v3uint %69 %48 + %71 = OpBitwiseOr %v3uint %70 %57 + %72 = OpIAdd %v3uint %71 %64 + OpReturnValue %72 + OpFunctionEnd +%countLeadingZeros_ab6345 = OpFunction %void None %73 + %76 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %18 + %77 = OpFunctionCall %v3uint %tint_count_leading_zeros %63 + OpStore %res %77 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %79 + %81 = OpLabel + %82 = OpFunctionCall %void %countLeadingZeros_ab6345 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %73 + %84 = OpLabel + %85 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %85 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %73 + %88 = OpLabel + %89 = OpFunctionCall %void %countLeadingZeros_ab6345 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %73 + %91 = OpLabel + %92 = OpFunctionCall %void %countLeadingZeros_ab6345 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.wgsl new file mode 100644 index 0000000000..c7bc319ed0 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/ab6345.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countLeadingZeros_ab6345() { + var res : vec3 = countLeadingZeros(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_ab6345(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_ab6345(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_ab6345(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl new file mode 100644 index 0000000000..0e381d1cba --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<4, i32>) -> vec<4, i32> +fn countLeadingZeros_eab32b() { + var res: vec4 = countLeadingZeros(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_eab32b(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_eab32b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_eab32b(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fdbeffdd05 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int4 tint_count_leading_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + int4 res = tint_count_leading_zeros((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_eab32b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_eab32b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_eab32b(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fdbeffdd05 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int4 tint_count_leading_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + int4 res = tint_count_leading_zeros((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_eab32b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_eab32b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_eab32b(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.glsl new file mode 100644 index 0000000000..ce67a9ecf7 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec4 tint_count_leading_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + ivec4 res = tint_count_leading_zeros(ivec4(1)); +} + +vec4 vertex_main() { + countLeadingZeros_eab32b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_count_leading_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + ivec4 res = tint_count_leading_zeros(ivec4(1)); +} + +void fragment_main() { + countLeadingZeros_eab32b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_count_leading_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + ivec4 res = tint_count_leading_zeros(ivec4(1)); +} + +void compute_main() { + countLeadingZeros_eab32b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.msl b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.msl new file mode 100644 index 0000000000..2e2f4b629e --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countLeadingZeros_eab32b() { + int4 res = clz(int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_eab32b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_eab32b(); + return; +} + +kernel void compute_main() { + countLeadingZeros_eab32b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.spvasm new file mode 100644 index 0000000000..c7f146d529 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.spvasm @@ -0,0 +1,143 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_eab32b "countLeadingZeros_eab32b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %uint_65535 = OpConstant %uint 65535 + %24 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_16 = OpConstant %uint 16 + %29 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %35 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %44 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %53 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %56 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %62 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %75 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %81 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %84 = OpConstantNull %v4int + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %20 + %15 = OpBitcast %v4uint %v + OpStore %x %15 + %22 = OpLoad %v4uint %x + %25 = OpULessThanEqual %v4bool %22 %24 + %21 = OpSelect %v4uint %25 %29 %20 + %30 = OpLoad %v4uint %x + %31 = OpShiftLeftLogical %v4uint %30 %21 + OpStore %x %31 + %33 = OpLoad %v4uint %x + %36 = OpULessThanEqual %v4bool %33 %35 + %32 = OpSelect %v4uint %36 %38 %20 + %39 = OpLoad %v4uint %x + %40 = OpShiftLeftLogical %v4uint %39 %32 + OpStore %x %40 + %42 = OpLoad %v4uint %x + %45 = OpULessThanEqual %v4bool %42 %44 + %41 = OpSelect %v4uint %45 %47 %20 + %48 = OpLoad %v4uint %x + %49 = OpShiftLeftLogical %v4uint %48 %41 + OpStore %x %49 + %51 = OpLoad %v4uint %x + %54 = OpULessThanEqual %v4bool %51 %53 + %50 = OpSelect %v4uint %54 %56 %20 + %57 = OpLoad %v4uint %x + %58 = OpShiftLeftLogical %v4uint %57 %50 + OpStore %x %58 + %60 = OpLoad %v4uint %x + %63 = OpULessThanEqual %v4bool %60 %62 + %59 = OpSelect %v4uint %63 %65 %20 + %67 = OpLoad %v4uint %x + %68 = OpIEqual %v4bool %67 %20 + %66 = OpSelect %v4uint %68 %65 %20 + %70 = OpBitwiseOr %v4uint %21 %32 + %71 = OpBitwiseOr %v4uint %70 %41 + %72 = OpBitwiseOr %v4uint %71 %50 + %73 = OpBitwiseOr %v4uint %72 %59 + %74 = OpIAdd %v4uint %73 %66 + %69 = OpBitcast %v4int %74 + OpReturnValue %69 + OpFunctionEnd +%countLeadingZeros_eab32b = OpFunction %void None %75 + %78 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %84 + %79 = OpFunctionCall %v4int %tint_count_leading_zeros %81 + OpStore %res %79 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %countLeadingZeros_eab32b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %75 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %75 + %94 = OpLabel + %95 = OpFunctionCall %void %countLeadingZeros_eab32b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %75 + %97 = OpLabel + %98 = OpFunctionCall %void %countLeadingZeros_eab32b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.wgsl new file mode 100644 index 0000000000..08ee7ea057 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/eab32b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countLeadingZeros_eab32b() { + var res : vec4 = countLeadingZeros(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_eab32b(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_eab32b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_eab32b(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl new file mode 100644 index 0000000000..5e006a208d --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<4, u32>) -> vec<4, u32> +fn countLeadingZeros_f70103() { + var res: vec4 = countLeadingZeros(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_f70103(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_f70103(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_f70103(); +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8c9cbad028 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint4 tint_count_leading_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uint4 res = tint_count_leading_zeros((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_f70103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_f70103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_f70103(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c9cbad028 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint4 tint_count_leading_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uint4 res = tint_count_leading_zeros((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_f70103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_f70103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_f70103(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.glsl new file mode 100644 index 0000000000..b7e35486dc --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec4 tint_count_leading_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uvec4 res = tint_count_leading_zeros(uvec4(1u)); +} + +vec4 vertex_main() { + countLeadingZeros_f70103(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_count_leading_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uvec4 res = tint_count_leading_zeros(uvec4(1u)); +} + +void fragment_main() { + countLeadingZeros_f70103(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_count_leading_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uvec4 res = tint_count_leading_zeros(uvec4(1u)); +} + +void compute_main() { + countLeadingZeros_f70103(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.msl b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.msl new file mode 100644 index 0000000000..04f050440b --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countLeadingZeros_f70103() { + uint4 res = clz(uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_f70103(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_f70103(); + return; +} + +kernel void compute_main() { + countLeadingZeros_f70103(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.spvasm new file mode 100644 index 0000000000..86d8a21f96 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_f70103 "countLeadingZeros_f70103" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %18 = OpConstantNull %v4uint + %uint_65535 = OpConstant %uint 65535 + %22 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %33 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %36 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %42 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %45 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %51 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %54 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %60 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %63 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %73 = OpTypeFunction %void + %79 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %x %v + %20 = OpLoad %v4uint %x + %23 = OpULessThanEqual %v4bool %20 %22 + %19 = OpSelect %v4uint %23 %27 %18 + %28 = OpLoad %v4uint %x + %29 = OpShiftLeftLogical %v4uint %28 %19 + OpStore %x %29 + %31 = OpLoad %v4uint %x + %34 = OpULessThanEqual %v4bool %31 %33 + %30 = OpSelect %v4uint %34 %36 %18 + %37 = OpLoad %v4uint %x + %38 = OpShiftLeftLogical %v4uint %37 %30 + OpStore %x %38 + %40 = OpLoad %v4uint %x + %43 = OpULessThanEqual %v4bool %40 %42 + %39 = OpSelect %v4uint %43 %45 %18 + %46 = OpLoad %v4uint %x + %47 = OpShiftLeftLogical %v4uint %46 %39 + OpStore %x %47 + %49 = OpLoad %v4uint %x + %52 = OpULessThanEqual %v4bool %49 %51 + %48 = OpSelect %v4uint %52 %54 %18 + %55 = OpLoad %v4uint %x + %56 = OpShiftLeftLogical %v4uint %55 %48 + OpStore %x %56 + %58 = OpLoad %v4uint %x + %61 = OpULessThanEqual %v4bool %58 %60 + %57 = OpSelect %v4uint %61 %63 %18 + %65 = OpLoad %v4uint %x + %66 = OpIEqual %v4bool %65 %18 + %64 = OpSelect %v4uint %66 %63 %18 + %68 = OpBitwiseOr %v4uint %19 %30 + %69 = OpBitwiseOr %v4uint %68 %39 + %70 = OpBitwiseOr %v4uint %69 %48 + %71 = OpBitwiseOr %v4uint %70 %57 + %72 = OpIAdd %v4uint %71 %64 + OpReturnValue %72 + OpFunctionEnd +%countLeadingZeros_f70103 = OpFunction %void None %73 + %76 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %18 + %77 = OpFunctionCall %v4uint %tint_count_leading_zeros %63 + OpStore %res %77 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %79 + %81 = OpLabel + %82 = OpFunctionCall %void %countLeadingZeros_f70103 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %73 + %84 = OpLabel + %85 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %85 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %73 + %88 = OpLabel + %89 = OpFunctionCall %void %countLeadingZeros_f70103 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %73 + %91 = OpLabel + %92 = OpFunctionCall %void %countLeadingZeros_f70103 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.wgsl new file mode 100644 index 0000000000..2877eb6893 --- /dev/null +++ b/test/tint/builtins/gen/literal/countLeadingZeros/f70103.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countLeadingZeros_f70103() { + var res : vec4 = countLeadingZeros(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_f70103(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_f70103(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_f70103(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl new file mode 100644 index 0000000000..87a07fac38 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<4, u32>) -> vec<4, u32> +fn countOneBits_0d0e46() { + var res: vec4 = countOneBits(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0d0e46(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_0d0e46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_0d0e46(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..800331e426 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_0d0e46() { + uint4 res = countbits((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0d0e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0d0e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0d0e46(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..800331e426 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_0d0e46() { + uint4 res = countbits((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0d0e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0d0e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0d0e46(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.glsl new file mode 100644 index 0000000000..85f302a948 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void countOneBits_0d0e46() { + uvec4 res = uvec4(bitCount(uvec4(1u))); +} + +vec4 vertex_main() { + countOneBits_0d0e46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_0d0e46() { + uvec4 res = uvec4(bitCount(uvec4(1u))); +} + +void fragment_main() { + countOneBits_0d0e46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_0d0e46() { + uvec4 res = uvec4(bitCount(uvec4(1u))); +} + +void compute_main() { + countOneBits_0d0e46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.msl b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.msl new file mode 100644 index 0000000000..05f5254685 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countOneBits_0d0e46() { + uint4 res = popcount(uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_0d0e46(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_0d0e46(); + return; +} + +kernel void compute_main() { + countOneBits_0d0e46(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.spvasm new file mode 100644 index 0000000000..09bb571913 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_0d0e46 "countOneBits_0d0e46" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_0d0e46 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %20 + %13 = OpBitCount %v4uint %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_0d0e46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_0d0e46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_0d0e46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce4168b207 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0d0e46.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countOneBits_0d0e46() { + var res : vec4 = countOneBits(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0d0e46(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_0d0e46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_0d0e46(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl new file mode 100644 index 0000000000..ce85eab9ea --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<4, i32>) -> vec<4, i32> +fn countOneBits_0f7980() { + var res: vec4 = countOneBits(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0f7980(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_0f7980(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_0f7980(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e66db7a2c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_0f7980() { + int4 res = asint(countbits(asuint((1).xxxx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0f7980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0f7980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0f7980(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e66db7a2c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_0f7980() { + int4 res = asint(countbits(asuint((1).xxxx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0f7980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0f7980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0f7980(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.glsl new file mode 100644 index 0000000000..52a742ed1c --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void countOneBits_0f7980() { + ivec4 res = ivec4(bitCount(ivec4(1))); +} + +vec4 vertex_main() { + countOneBits_0f7980(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_0f7980() { + ivec4 res = ivec4(bitCount(ivec4(1))); +} + +void fragment_main() { + countOneBits_0f7980(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_0f7980() { + ivec4 res = ivec4(bitCount(ivec4(1))); +} + +void compute_main() { + countOneBits_0f7980(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.msl b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.msl new file mode 100644 index 0000000000..aedf298941 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countOneBits_0f7980() { + int4 res = popcount(int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_0f7980(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_0f7980(); + return; +} + +kernel void compute_main() { + countOneBits_0f7980(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.spvasm new file mode 100644 index 0000000000..a4617719a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_0f7980 "countOneBits_0f7980" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %20 = OpConstantNull %v4int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_0f7980 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %20 + %13 = OpBitCount %v4int %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_0f7980 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_0f7980 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_0f7980 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e2cb7a782 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/0f7980.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countOneBits_0f7980() { + var res : vec4 = countOneBits(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0f7980(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_0f7980(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_0f7980(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl new file mode 100644 index 0000000000..5fcbe0412f --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<3, i32>) -> vec<3, i32> +fn countOneBits_65d2ae() { + var res: vec3 = countOneBits(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_65d2ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_65d2ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_65d2ae(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..790ebc70bc --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_65d2ae() { + int3 res = asint(countbits(asuint((1).xxx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_65d2ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_65d2ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_65d2ae(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..790ebc70bc --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_65d2ae() { + int3 res = asint(countbits(asuint((1).xxx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_65d2ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_65d2ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_65d2ae(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.glsl new file mode 100644 index 0000000000..811ee03298 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void countOneBits_65d2ae() { + ivec3 res = ivec3(bitCount(ivec3(1))); +} + +vec4 vertex_main() { + countOneBits_65d2ae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_65d2ae() { + ivec3 res = ivec3(bitCount(ivec3(1))); +} + +void fragment_main() { + countOneBits_65d2ae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_65d2ae() { + ivec3 res = ivec3(bitCount(ivec3(1))); +} + +void compute_main() { + countOneBits_65d2ae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.msl b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.msl new file mode 100644 index 0000000000..c092cfc627 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countOneBits_65d2ae() { + int3 res = popcount(int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_65d2ae(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_65d2ae(); + return; +} + +kernel void compute_main() { + countOneBits_65d2ae(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.spvasm new file mode 100644 index 0000000000..0ff478ecae --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_65d2ae "countOneBits_65d2ae" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %20 = OpConstantNull %v3int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_65d2ae = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %20 + %13 = OpBitCount %v3int %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_65d2ae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_65d2ae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_65d2ae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.wgsl new file mode 100644 index 0000000000..5de2da7d29 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/65d2ae.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countOneBits_65d2ae() { + var res : vec3 = countOneBits(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_65d2ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_65d2ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_65d2ae(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl new file mode 100644 index 0000000000..504e2d4e62 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<3, u32>) -> vec<3, u32> +fn countOneBits_690cfc() { + var res: vec3 = countOneBits(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_690cfc(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_690cfc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_690cfc(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2b15a93cab --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_690cfc() { + uint3 res = countbits((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_690cfc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_690cfc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_690cfc(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2b15a93cab --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_690cfc() { + uint3 res = countbits((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_690cfc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_690cfc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_690cfc(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.glsl new file mode 100644 index 0000000000..c3309dafa4 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void countOneBits_690cfc() { + uvec3 res = uvec3(bitCount(uvec3(1u))); +} + +vec4 vertex_main() { + countOneBits_690cfc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_690cfc() { + uvec3 res = uvec3(bitCount(uvec3(1u))); +} + +void fragment_main() { + countOneBits_690cfc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_690cfc() { + uvec3 res = uvec3(bitCount(uvec3(1u))); +} + +void compute_main() { + countOneBits_690cfc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.msl b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.msl new file mode 100644 index 0000000000..32a6ebba7e --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countOneBits_690cfc() { + uint3 res = popcount(uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_690cfc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_690cfc(); + return; +} + +kernel void compute_main() { + countOneBits_690cfc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fd3033ebb --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_690cfc "countOneBits_690cfc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_690cfc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %20 + %13 = OpBitCount %v3uint %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_690cfc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_690cfc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_690cfc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.wgsl new file mode 100644 index 0000000000..79967b1e33 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/690cfc.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countOneBits_690cfc() { + var res : vec3 = countOneBits(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_690cfc(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_690cfc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_690cfc(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl new file mode 100644 index 0000000000..1a341bb224 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<2, u32>) -> vec<2, u32> +fn countOneBits_94fd81() { + var res: vec2 = countOneBits(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_94fd81(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_94fd81(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_94fd81(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..218f0f8295 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_94fd81() { + uint2 res = countbits((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_94fd81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_94fd81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_94fd81(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..218f0f8295 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_94fd81() { + uint2 res = countbits((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_94fd81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_94fd81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_94fd81(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.glsl new file mode 100644 index 0000000000..ed00b85e42 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void countOneBits_94fd81() { + uvec2 res = uvec2(bitCount(uvec2(1u))); +} + +vec4 vertex_main() { + countOneBits_94fd81(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_94fd81() { + uvec2 res = uvec2(bitCount(uvec2(1u))); +} + +void fragment_main() { + countOneBits_94fd81(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_94fd81() { + uvec2 res = uvec2(bitCount(uvec2(1u))); +} + +void compute_main() { + countOneBits_94fd81(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.msl b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.msl new file mode 100644 index 0000000000..15740da01f --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countOneBits_94fd81() { + uint2 res = popcount(uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_94fd81(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_94fd81(); + return; +} + +kernel void compute_main() { + countOneBits_94fd81(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.spvasm new file mode 100644 index 0000000000..7504893158 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_94fd81 "countOneBits_94fd81" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_94fd81 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %20 + %13 = OpBitCount %v2uint %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_94fd81 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_94fd81 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_94fd81 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.wgsl new file mode 100644 index 0000000000..d82e957b89 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/94fd81.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countOneBits_94fd81() { + var res : vec2 = countOneBits(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_94fd81(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_94fd81(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_94fd81(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl new file mode 100644 index 0000000000..fb89218f47 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(u32) -> u32 +fn countOneBits_ae44f9() { + var res: u32 = countOneBits(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_ae44f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_ae44f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_ae44f9(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b51b87d6d --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_ae44f9() { + uint res = countbits(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_ae44f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_ae44f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_ae44f9(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b51b87d6d --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_ae44f9() { + uint res = countbits(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_ae44f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_ae44f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_ae44f9(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.glsl new file mode 100644 index 0000000000..73089c988b --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void countOneBits_ae44f9() { + uint res = uint(bitCount(1u)); +} + +vec4 vertex_main() { + countOneBits_ae44f9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_ae44f9() { + uint res = uint(bitCount(1u)); +} + +void fragment_main() { + countOneBits_ae44f9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_ae44f9() { + uint res = uint(bitCount(1u)); +} + +void compute_main() { + countOneBits_ae44f9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.msl b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.msl new file mode 100644 index 0000000000..70e2b9f6f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countOneBits_ae44f9() { + uint res = popcount(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_ae44f9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_ae44f9(); + return; +} + +kernel void compute_main() { + countOneBits_ae44f9(); + return; +} + diff --git a/test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/countOneBits/ae44f9.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.wgsl new file mode 100644 index 0000000000..880bb56d2f --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/ae44f9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countOneBits_ae44f9() { + var res : u32 = countOneBits(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_ae44f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_ae44f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_ae44f9(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl new file mode 100644 index 0000000000..c1c6e88dab --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<2, i32>) -> vec<2, i32> +fn countOneBits_af90e2() { + var res: vec2 = countOneBits(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_af90e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_af90e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_af90e2(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..31d15d4e56 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_af90e2() { + int2 res = asint(countbits(asuint((1).xx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_af90e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_af90e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_af90e2(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31d15d4e56 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_af90e2() { + int2 res = asint(countbits(asuint((1).xx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_af90e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_af90e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_af90e2(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.glsl new file mode 100644 index 0000000000..c1509a80a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void countOneBits_af90e2() { + ivec2 res = ivec2(bitCount(ivec2(1))); +} + +vec4 vertex_main() { + countOneBits_af90e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_af90e2() { + ivec2 res = ivec2(bitCount(ivec2(1))); +} + +void fragment_main() { + countOneBits_af90e2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_af90e2() { + ivec2 res = ivec2(bitCount(ivec2(1))); +} + +void compute_main() { + countOneBits_af90e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.msl b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.msl new file mode 100644 index 0000000000..d4f525d3fc --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countOneBits_af90e2() { + int2 res = popcount(int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_af90e2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_af90e2(); + return; +} + +kernel void compute_main() { + countOneBits_af90e2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.spvasm new file mode 100644 index 0000000000..50566337db --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_af90e2 "countOneBits_af90e2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %20 = OpConstantNull %v2int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_af90e2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %20 + %13 = OpBitCount %v2int %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_af90e2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_af90e2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_af90e2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..6caee65d06 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/af90e2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countOneBits_af90e2() { + var res : vec2 = countOneBits(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_af90e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_af90e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_af90e2(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl new file mode 100644 index 0000000000..41efb7e59f --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(i32) -> i32 +fn countOneBits_fd88b2() { + var res: i32 = countOneBits(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_fd88b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_fd88b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_fd88b2(); +} diff --git a/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cc56ef3deb --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_fd88b2() { + int res = asint(countbits(asuint(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_fd88b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_fd88b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_fd88b2(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc56ef3deb --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void countOneBits_fd88b2() { + int res = asint(countbits(asuint(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_fd88b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_fd88b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_fd88b2(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.glsl new file mode 100644 index 0000000000..6f0d56cc38 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void countOneBits_fd88b2() { + int res = int(bitCount(1)); +} + +vec4 vertex_main() { + countOneBits_fd88b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_fd88b2() { + int res = int(bitCount(1)); +} + +void fragment_main() { + countOneBits_fd88b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_fd88b2() { + int res = int(bitCount(1)); +} + +void compute_main() { + countOneBits_fd88b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.msl b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.msl new file mode 100644 index 0000000000..91cd762778 --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countOneBits_fd88b2() { + int res = popcount(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_fd88b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_fd88b2(); + return; +} + +kernel void compute_main() { + countOneBits_fd88b2(); + return; +} + diff --git a/test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/countOneBits/fd88b2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f8ef5f33d --- /dev/null +++ b/test/tint/builtins/gen/literal/countOneBits/fd88b2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countOneBits_fd88b2() { + var res : i32 = countOneBits(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_fd88b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_fd88b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_fd88b2(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl new file mode 100644 index 0000000000..cafda4db89 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<2, u32>) -> vec<2, u32> +fn countTrailingZeros_1ad138() { + var res: vec2 = countTrailingZeros(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1ad138(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_1ad138(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1ad138(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a61337c9c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint2 tint_count_trailing_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uint2 res = tint_count_trailing_zeros((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1ad138(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1ad138(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1ad138(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a61337c9c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint2 tint_count_trailing_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uint2 res = tint_count_trailing_zeros((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1ad138(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1ad138(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1ad138(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.glsl new file mode 100644 index 0000000000..c6bd3d4719 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec2 tint_count_trailing_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uvec2 res = tint_count_trailing_zeros(uvec2(1u)); +} + +vec4 vertex_main() { + countTrailingZeros_1ad138(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_count_trailing_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uvec2 res = tint_count_trailing_zeros(uvec2(1u)); +} + +void fragment_main() { + countTrailingZeros_1ad138(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_count_trailing_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uvec2 res = tint_count_trailing_zeros(uvec2(1u)); +} + +void compute_main() { + countTrailingZeros_1ad138(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.msl b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.msl new file mode 100644 index 0000000000..527fe903a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countTrailingZeros_1ad138() { + uint2 res = ctz(uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1ad138(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_1ad138(); + return; +} + +kernel void compute_main() { + countTrailingZeros_1ad138(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.spvasm new file mode 100644 index 0000000000..d2ea81d5a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_1ad138 "countTrailingZeros_1ad138" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %18 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %82 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %x %v + %23 = OpLoad %v2uint %x + %26 = OpBitwiseAnd %v2uint %23 %25 + %20 = OpINotEqual %v2bool %26 %18 + %19 = OpSelect %v2uint %20 %18 %28 + %29 = OpLoad %v2uint %x + %30 = OpShiftRightLogical %v2uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v2uint %x + %36 = OpBitwiseAnd %v2uint %33 %35 + %32 = OpINotEqual %v2bool %36 %18 + %31 = OpSelect %v2uint %32 %18 %38 + %39 = OpLoad %v2uint %x + %40 = OpShiftRightLogical %v2uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v2uint %x + %46 = OpBitwiseAnd %v2uint %43 %45 + %42 = OpINotEqual %v2bool %46 %18 + %41 = OpSelect %v2uint %42 %18 %48 + %49 = OpLoad %v2uint %x + %50 = OpShiftRightLogical %v2uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v2uint %x + %56 = OpBitwiseAnd %v2uint %53 %55 + %52 = OpINotEqual %v2bool %56 %18 + %51 = OpSelect %v2uint %52 %18 %58 + %59 = OpLoad %v2uint %x + %60 = OpShiftRightLogical %v2uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v2uint %x + %66 = OpBitwiseAnd %v2uint %63 %65 + %62 = OpINotEqual %v2bool %66 %18 + %61 = OpSelect %v2uint %62 %18 %65 + %68 = OpLoad %v2uint %x + %69 = OpIEqual %v2bool %68 %18 + %67 = OpSelect %v2uint %69 %65 %18 + %71 = OpBitwiseOr %v2uint %19 %31 + %72 = OpBitwiseOr %v2uint %71 %41 + %73 = OpBitwiseOr %v2uint %72 %51 + %74 = OpBitwiseOr %v2uint %73 %61 + %75 = OpIAdd %v2uint %74 %67 + OpReturnValue %75 + OpFunctionEnd +%countTrailingZeros_1ad138 = OpFunction %void None %76 + %79 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %18 + %80 = OpFunctionCall %v2uint %tint_count_trailing_zeros %65 + OpStore %res %80 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %82 + %84 = OpLabel + %85 = OpFunctionCall %void %countTrailingZeros_1ad138 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %76 + %87 = OpLabel + %88 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %88 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %76 + %91 = OpLabel + %92 = OpFunctionCall %void %countTrailingZeros_1ad138 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %76 + %94 = OpLabel + %95 = OpFunctionCall %void %countTrailingZeros_1ad138 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f6d2b9310 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1ad138.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countTrailingZeros_1ad138() { + var res : vec2 = countTrailingZeros(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1ad138(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_1ad138(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1ad138(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl new file mode 100644 index 0000000000..9a342c3296 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<4, i32>) -> vec<4, i32> +fn countTrailingZeros_1dc84a() { + var res: vec4 = countTrailingZeros(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1dc84a(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_1dc84a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1dc84a(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2855d6d847 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int4 tint_count_trailing_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + int4 res = tint_count_trailing_zeros((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1dc84a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1dc84a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1dc84a(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2855d6d847 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int4 tint_count_trailing_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + int4 res = tint_count_trailing_zeros((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1dc84a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1dc84a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1dc84a(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.glsl new file mode 100644 index 0000000000..004dfe3cea --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec4 tint_count_trailing_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + ivec4 res = tint_count_trailing_zeros(ivec4(1)); +} + +vec4 vertex_main() { + countTrailingZeros_1dc84a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_count_trailing_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + ivec4 res = tint_count_trailing_zeros(ivec4(1)); +} + +void fragment_main() { + countTrailingZeros_1dc84a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_count_trailing_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + ivec4 res = tint_count_trailing_zeros(ivec4(1)); +} + +void compute_main() { + countTrailingZeros_1dc84a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.msl b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.msl new file mode 100644 index 0000000000..216718b46b --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countTrailingZeros_1dc84a() { + int4 res = ctz(int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1dc84a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_1dc84a(); + return; +} + +kernel void compute_main() { + countTrailingZeros_1dc84a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.spvasm new file mode 100644 index 0000000000..85d0c58bb9 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.spvasm @@ -0,0 +1,146 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_1dc84a "countTrailingZeros_1dc84a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %84 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %87 = OpConstantNull %v4int + %88 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %20 + %15 = OpBitcast %v4uint %v + OpStore %x %15 + %25 = OpLoad %v4uint %x + %28 = OpBitwiseAnd %v4uint %25 %27 + %22 = OpINotEqual %v4bool %28 %20 + %21 = OpSelect %v4uint %22 %20 %30 + %31 = OpLoad %v4uint %x + %32 = OpShiftRightLogical %v4uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v4uint %x + %38 = OpBitwiseAnd %v4uint %35 %37 + %34 = OpINotEqual %v4bool %38 %20 + %33 = OpSelect %v4uint %34 %20 %40 + %41 = OpLoad %v4uint %x + %42 = OpShiftRightLogical %v4uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v4uint %x + %48 = OpBitwiseAnd %v4uint %45 %47 + %44 = OpINotEqual %v4bool %48 %20 + %43 = OpSelect %v4uint %44 %20 %50 + %51 = OpLoad %v4uint %x + %52 = OpShiftRightLogical %v4uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v4uint %x + %58 = OpBitwiseAnd %v4uint %55 %57 + %54 = OpINotEqual %v4bool %58 %20 + %53 = OpSelect %v4uint %54 %20 %60 + %61 = OpLoad %v4uint %x + %62 = OpShiftRightLogical %v4uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v4uint %x + %68 = OpBitwiseAnd %v4uint %65 %67 + %64 = OpINotEqual %v4bool %68 %20 + %63 = OpSelect %v4uint %64 %20 %67 + %70 = OpLoad %v4uint %x + %71 = OpIEqual %v4bool %70 %20 + %69 = OpSelect %v4uint %71 %67 %20 + %73 = OpBitwiseOr %v4uint %21 %33 + %74 = OpBitwiseOr %v4uint %73 %43 + %75 = OpBitwiseOr %v4uint %74 %53 + %76 = OpBitwiseOr %v4uint %75 %63 + %77 = OpIAdd %v4uint %76 %69 + %72 = OpBitcast %v4int %77 + OpReturnValue %72 + OpFunctionEnd +%countTrailingZeros_1dc84a = OpFunction %void None %78 + %81 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %87 + %82 = OpFunctionCall %v4int %tint_count_trailing_zeros %84 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %88 + %90 = OpLabel + %91 = OpFunctionCall %void %countTrailingZeros_1dc84a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %93 = OpLabel + %94 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %94 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %97 = OpLabel + %98 = OpFunctionCall %void %countTrailingZeros_1dc84a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %100 = OpLabel + %101 = OpFunctionCall %void %countTrailingZeros_1dc84a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.wgsl new file mode 100644 index 0000000000..2beaa556ab --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/1dc84a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countTrailingZeros_1dc84a() { + var res : vec4 = countTrailingZeros(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1dc84a(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_1dc84a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1dc84a(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl new file mode 100644 index 0000000000..dfd48ad730 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(u32) -> u32 +fn countTrailingZeros_21e394() { + var res: u32 = countTrailingZeros(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_21e394(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_21e394(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_21e394(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..edace4972c --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint res = tint_count_trailing_zeros(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_21e394(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_21e394(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_21e394(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..edace4972c --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint res = tint_count_trailing_zeros(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_21e394(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_21e394(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_21e394(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.glsl new file mode 100644 index 0000000000..48ead3ca94 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint res = tint_count_trailing_zeros(1u); +} + +vec4 vertex_main() { + countTrailingZeros_21e394(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint res = tint_count_trailing_zeros(1u); +} + +void fragment_main() { + countTrailingZeros_21e394(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint res = tint_count_trailing_zeros(1u); +} + +void compute_main() { + countTrailingZeros_21e394(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.msl b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.msl new file mode 100644 index 0000000000..e403208976 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countTrailingZeros_21e394() { + uint res = ctz(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_21e394(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_21e394(); + return; +} + +kernel void compute_main() { + countTrailingZeros_21e394(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d07aef584 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_21e394 "countTrailingZeros_21e394" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %65 = OpTypeFunction %void + %71 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %17 + OpStore %x %v + %21 = OpLoad %uint %x + %23 = OpBitwiseAnd %uint %21 %uint_65535 + %19 = OpINotEqual %bool %23 %17 + %18 = OpSelect %uint %19 %17 %uint_16 + %25 = OpLoad %uint %x + %26 = OpShiftRightLogical %uint %25 %18 + OpStore %x %26 + %29 = OpLoad %uint %x + %31 = OpBitwiseAnd %uint %29 %uint_255 + %28 = OpINotEqual %bool %31 %17 + %27 = OpSelect %uint %28 %17 %uint_8 + %33 = OpLoad %uint %x + %34 = OpShiftRightLogical %uint %33 %27 + OpStore %x %34 + %37 = OpLoad %uint %x + %39 = OpBitwiseAnd %uint %37 %uint_15 + %36 = OpINotEqual %bool %39 %17 + %35 = OpSelect %uint %36 %17 %uint_4 + %41 = OpLoad %uint %x + %42 = OpShiftRightLogical %uint %41 %35 + OpStore %x %42 + %45 = OpLoad %uint %x + %47 = OpBitwiseAnd %uint %45 %uint_3 + %44 = OpINotEqual %bool %47 %17 + %43 = OpSelect %uint %44 %17 %uint_2 + %49 = OpLoad %uint %x + %50 = OpShiftRightLogical %uint %49 %43 + OpStore %x %50 + %53 = OpLoad %uint %x + %55 = OpBitwiseAnd %uint %53 %uint_1 + %52 = OpINotEqual %bool %55 %17 + %51 = OpSelect %uint %52 %17 %uint_1 + %57 = OpLoad %uint %x + %58 = OpIEqual %bool %57 %17 + %56 = OpSelect %uint %58 %uint_1 %17 + %60 = OpBitwiseOr %uint %18 %27 + %61 = OpBitwiseOr %uint %60 %35 + %62 = OpBitwiseOr %uint %61 %43 + %63 = OpBitwiseOr %uint %62 %51 + %64 = OpIAdd %uint %63 %56 + OpReturnValue %64 + OpFunctionEnd +%countTrailingZeros_21e394 = OpFunction %void None %65 + %68 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %69 = OpFunctionCall %uint %tint_count_trailing_zeros %uint_1 + OpStore %res %69 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %71 + %73 = OpLabel + %74 = OpFunctionCall %void %countTrailingZeros_21e394 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %65 + %76 = OpLabel + %77 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %77 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %65 + %80 = OpLabel + %81 = OpFunctionCall %void %countTrailingZeros_21e394 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %65 + %83 = OpLabel + %84 = OpFunctionCall %void %countTrailingZeros_21e394 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.wgsl new file mode 100644 index 0000000000..c04b853957 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/21e394.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countTrailingZeros_21e394() { + var res : u32 = countTrailingZeros(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_21e394(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_21e394(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_21e394(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl new file mode 100644 index 0000000000..2c4afa2972 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<2, i32>) -> vec<2, i32> +fn countTrailingZeros_327c37() { + var res: vec2 = countTrailingZeros(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_327c37(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_327c37(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_327c37(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a63a8463e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int2 tint_count_trailing_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + int2 res = tint_count_trailing_zeros((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_327c37(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_327c37(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_327c37(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a63a8463e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int2 tint_count_trailing_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + int2 res = tint_count_trailing_zeros((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_327c37(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_327c37(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_327c37(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.glsl new file mode 100644 index 0000000000..b321de88c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec2 tint_count_trailing_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + ivec2 res = tint_count_trailing_zeros(ivec2(1)); +} + +vec4 vertex_main() { + countTrailingZeros_327c37(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_count_trailing_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + ivec2 res = tint_count_trailing_zeros(ivec2(1)); +} + +void fragment_main() { + countTrailingZeros_327c37(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_count_trailing_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + ivec2 res = tint_count_trailing_zeros(ivec2(1)); +} + +void compute_main() { + countTrailingZeros_327c37(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.msl b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.msl new file mode 100644 index 0000000000..c0e1ed6d75 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countTrailingZeros_327c37() { + int2 res = ctz(int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_327c37(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_327c37(); + return; +} + +kernel void compute_main() { + countTrailingZeros_327c37(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.spvasm new file mode 100644 index 0000000000..456ba27494 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.spvasm @@ -0,0 +1,146 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_327c37 "countTrailingZeros_327c37" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %84 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %87 = OpConstantNull %v2int + %88 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %20 + %15 = OpBitcast %v2uint %v + OpStore %x %15 + %25 = OpLoad %v2uint %x + %28 = OpBitwiseAnd %v2uint %25 %27 + %22 = OpINotEqual %v2bool %28 %20 + %21 = OpSelect %v2uint %22 %20 %30 + %31 = OpLoad %v2uint %x + %32 = OpShiftRightLogical %v2uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v2uint %x + %38 = OpBitwiseAnd %v2uint %35 %37 + %34 = OpINotEqual %v2bool %38 %20 + %33 = OpSelect %v2uint %34 %20 %40 + %41 = OpLoad %v2uint %x + %42 = OpShiftRightLogical %v2uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v2uint %x + %48 = OpBitwiseAnd %v2uint %45 %47 + %44 = OpINotEqual %v2bool %48 %20 + %43 = OpSelect %v2uint %44 %20 %50 + %51 = OpLoad %v2uint %x + %52 = OpShiftRightLogical %v2uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v2uint %x + %58 = OpBitwiseAnd %v2uint %55 %57 + %54 = OpINotEqual %v2bool %58 %20 + %53 = OpSelect %v2uint %54 %20 %60 + %61 = OpLoad %v2uint %x + %62 = OpShiftRightLogical %v2uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v2uint %x + %68 = OpBitwiseAnd %v2uint %65 %67 + %64 = OpINotEqual %v2bool %68 %20 + %63 = OpSelect %v2uint %64 %20 %67 + %70 = OpLoad %v2uint %x + %71 = OpIEqual %v2bool %70 %20 + %69 = OpSelect %v2uint %71 %67 %20 + %73 = OpBitwiseOr %v2uint %21 %33 + %74 = OpBitwiseOr %v2uint %73 %43 + %75 = OpBitwiseOr %v2uint %74 %53 + %76 = OpBitwiseOr %v2uint %75 %63 + %77 = OpIAdd %v2uint %76 %69 + %72 = OpBitcast %v2int %77 + OpReturnValue %72 + OpFunctionEnd +%countTrailingZeros_327c37 = OpFunction %void None %78 + %81 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %87 + %82 = OpFunctionCall %v2int %tint_count_trailing_zeros %84 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %88 + %90 = OpLabel + %91 = OpFunctionCall %void %countTrailingZeros_327c37 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %93 = OpLabel + %94 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %94 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %97 = OpLabel + %98 = OpFunctionCall %void %countTrailingZeros_327c37 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %100 = OpLabel + %101 = OpFunctionCall %void %countTrailingZeros_327c37 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.wgsl new file mode 100644 index 0000000000..4ae6604c86 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/327c37.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countTrailingZeros_327c37() { + var res : vec2 = countTrailingZeros(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_327c37(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_327c37(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_327c37(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl new file mode 100644 index 0000000000..4753eb9936 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(i32) -> i32 +fn countTrailingZeros_42fed6() { + var res: i32 = countTrailingZeros(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_42fed6(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_42fed6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_42fed6(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b5eacaaf90 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int res = tint_count_trailing_zeros(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_42fed6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_42fed6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_42fed6(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b5eacaaf90 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int res = tint_count_trailing_zeros(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_42fed6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_42fed6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_42fed6(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.glsl new file mode 100644 index 0000000000..79ef865026 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int res = tint_count_trailing_zeros(1); +} + +vec4 vertex_main() { + countTrailingZeros_42fed6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int res = tint_count_trailing_zeros(1); +} + +void fragment_main() { + countTrailingZeros_42fed6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int res = tint_count_trailing_zeros(1); +} + +void compute_main() { + countTrailingZeros_42fed6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.msl b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.msl new file mode 100644 index 0000000000..7d73b007a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countTrailingZeros_42fed6() { + int res = ctz(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_42fed6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_42fed6(); + return; +} + +kernel void compute_main() { + countTrailingZeros_42fed6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.spvasm new file mode 100644 index 0000000000..5603d88b97 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.spvasm @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_42fed6 "countTrailingZeros_42fed6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %66 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %74 = OpConstantNull %int + %75 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %18 + %14 = OpBitcast %uint %v + OpStore %x %14 + %22 = OpLoad %uint %x + %24 = OpBitwiseAnd %uint %22 %uint_65535 + %20 = OpINotEqual %bool %24 %18 + %19 = OpSelect %uint %20 %18 %uint_16 + %26 = OpLoad %uint %x + %27 = OpShiftRightLogical %uint %26 %19 + OpStore %x %27 + %30 = OpLoad %uint %x + %32 = OpBitwiseAnd %uint %30 %uint_255 + %29 = OpINotEqual %bool %32 %18 + %28 = OpSelect %uint %29 %18 %uint_8 + %34 = OpLoad %uint %x + %35 = OpShiftRightLogical %uint %34 %28 + OpStore %x %35 + %38 = OpLoad %uint %x + %40 = OpBitwiseAnd %uint %38 %uint_15 + %37 = OpINotEqual %bool %40 %18 + %36 = OpSelect %uint %37 %18 %uint_4 + %42 = OpLoad %uint %x + %43 = OpShiftRightLogical %uint %42 %36 + OpStore %x %43 + %46 = OpLoad %uint %x + %48 = OpBitwiseAnd %uint %46 %uint_3 + %45 = OpINotEqual %bool %48 %18 + %44 = OpSelect %uint %45 %18 %uint_2 + %50 = OpLoad %uint %x + %51 = OpShiftRightLogical %uint %50 %44 + OpStore %x %51 + %54 = OpLoad %uint %x + %56 = OpBitwiseAnd %uint %54 %uint_1 + %53 = OpINotEqual %bool %56 %18 + %52 = OpSelect %uint %53 %18 %uint_1 + %58 = OpLoad %uint %x + %59 = OpIEqual %bool %58 %18 + %57 = OpSelect %uint %59 %uint_1 %18 + %61 = OpBitwiseOr %uint %19 %28 + %62 = OpBitwiseOr %uint %61 %36 + %63 = OpBitwiseOr %uint %62 %44 + %64 = OpBitwiseOr %uint %63 %52 + %65 = OpIAdd %uint %64 %57 + %60 = OpBitcast %int %65 + OpReturnValue %60 + OpFunctionEnd +%countTrailingZeros_42fed6 = OpFunction %void None %66 + %69 = OpLabel + %res = OpVariable %_ptr_Function_int Function %74 + %70 = OpFunctionCall %int %tint_count_trailing_zeros %int_1 + OpStore %res %70 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %75 + %77 = OpLabel + %78 = OpFunctionCall %void %countTrailingZeros_42fed6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %66 + %80 = OpLabel + %81 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %81 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %66 + %84 = OpLabel + %85 = OpFunctionCall %void %countTrailingZeros_42fed6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %66 + %87 = OpLabel + %88 = OpFunctionCall %void %countTrailingZeros_42fed6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.wgsl new file mode 100644 index 0000000000..e277113671 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/42fed6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countTrailingZeros_42fed6() { + var res : i32 = countTrailingZeros(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_42fed6(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_42fed6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_42fed6(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl new file mode 100644 index 0000000000..d00f3083b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<3, u32>) -> vec<3, u32> +fn countTrailingZeros_8ed26f() { + var res: vec3 = countTrailingZeros(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_8ed26f(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_8ed26f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_8ed26f(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39dbf0af8c --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint3 tint_count_trailing_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uint3 res = tint_count_trailing_zeros((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_8ed26f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_8ed26f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_8ed26f(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..39dbf0af8c --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint3 tint_count_trailing_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uint3 res = tint_count_trailing_zeros((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_8ed26f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_8ed26f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_8ed26f(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.glsl new file mode 100644 index 0000000000..083c857d11 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec3 tint_count_trailing_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uvec3 res = tint_count_trailing_zeros(uvec3(1u)); +} + +vec4 vertex_main() { + countTrailingZeros_8ed26f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_count_trailing_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uvec3 res = tint_count_trailing_zeros(uvec3(1u)); +} + +void fragment_main() { + countTrailingZeros_8ed26f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_count_trailing_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uvec3 res = tint_count_trailing_zeros(uvec3(1u)); +} + +void compute_main() { + countTrailingZeros_8ed26f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.msl b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.msl new file mode 100644 index 0000000000..4b8e6a8e16 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countTrailingZeros_8ed26f() { + uint3 res = ctz(uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_8ed26f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_8ed26f(); + return; +} + +kernel void compute_main() { + countTrailingZeros_8ed26f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.spvasm new file mode 100644 index 0000000000..55a38aa329 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_8ed26f "countTrailingZeros_8ed26f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %82 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %x %v + %23 = OpLoad %v3uint %x + %26 = OpBitwiseAnd %v3uint %23 %25 + %20 = OpINotEqual %v3bool %26 %18 + %19 = OpSelect %v3uint %20 %18 %28 + %29 = OpLoad %v3uint %x + %30 = OpShiftRightLogical %v3uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v3uint %x + %36 = OpBitwiseAnd %v3uint %33 %35 + %32 = OpINotEqual %v3bool %36 %18 + %31 = OpSelect %v3uint %32 %18 %38 + %39 = OpLoad %v3uint %x + %40 = OpShiftRightLogical %v3uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v3uint %x + %46 = OpBitwiseAnd %v3uint %43 %45 + %42 = OpINotEqual %v3bool %46 %18 + %41 = OpSelect %v3uint %42 %18 %48 + %49 = OpLoad %v3uint %x + %50 = OpShiftRightLogical %v3uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v3uint %x + %56 = OpBitwiseAnd %v3uint %53 %55 + %52 = OpINotEqual %v3bool %56 %18 + %51 = OpSelect %v3uint %52 %18 %58 + %59 = OpLoad %v3uint %x + %60 = OpShiftRightLogical %v3uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v3uint %x + %66 = OpBitwiseAnd %v3uint %63 %65 + %62 = OpINotEqual %v3bool %66 %18 + %61 = OpSelect %v3uint %62 %18 %65 + %68 = OpLoad %v3uint %x + %69 = OpIEqual %v3bool %68 %18 + %67 = OpSelect %v3uint %69 %65 %18 + %71 = OpBitwiseOr %v3uint %19 %31 + %72 = OpBitwiseOr %v3uint %71 %41 + %73 = OpBitwiseOr %v3uint %72 %51 + %74 = OpBitwiseOr %v3uint %73 %61 + %75 = OpIAdd %v3uint %74 %67 + OpReturnValue %75 + OpFunctionEnd +%countTrailingZeros_8ed26f = OpFunction %void None %76 + %79 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %18 + %80 = OpFunctionCall %v3uint %tint_count_trailing_zeros %65 + OpStore %res %80 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %82 + %84 = OpLabel + %85 = OpFunctionCall %void %countTrailingZeros_8ed26f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %76 + %87 = OpLabel + %88 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %88 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %76 + %91 = OpLabel + %92 = OpFunctionCall %void %countTrailingZeros_8ed26f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %76 + %94 = OpLabel + %95 = OpFunctionCall %void %countTrailingZeros_8ed26f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.wgsl new file mode 100644 index 0000000000..dbb40bbaa1 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/8ed26f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countTrailingZeros_8ed26f() { + var res : vec3 = countTrailingZeros(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_8ed26f(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_8ed26f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_8ed26f(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl new file mode 100644 index 0000000000..8b2994b215 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<3, i32>) -> vec<3, i32> +fn countTrailingZeros_acfacb() { + var res: vec3 = countTrailingZeros(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_acfacb(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_acfacb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_acfacb(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6cf84fef8f --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int3 tint_count_trailing_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + int3 res = tint_count_trailing_zeros((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_acfacb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_acfacb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_acfacb(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6cf84fef8f --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int3 tint_count_trailing_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + int3 res = tint_count_trailing_zeros((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_acfacb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_acfacb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_acfacb(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.glsl new file mode 100644 index 0000000000..6a7019880e --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec3 tint_count_trailing_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + ivec3 res = tint_count_trailing_zeros(ivec3(1)); +} + +vec4 vertex_main() { + countTrailingZeros_acfacb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_count_trailing_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + ivec3 res = tint_count_trailing_zeros(ivec3(1)); +} + +void fragment_main() { + countTrailingZeros_acfacb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_count_trailing_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + ivec3 res = tint_count_trailing_zeros(ivec3(1)); +} + +void compute_main() { + countTrailingZeros_acfacb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.msl b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.msl new file mode 100644 index 0000000000..9b8028bca9 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countTrailingZeros_acfacb() { + int3 res = ctz(int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_acfacb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_acfacb(); + return; +} + +kernel void compute_main() { + countTrailingZeros_acfacb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.spvasm new file mode 100644 index 0000000000..32f7b958a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.spvasm @@ -0,0 +1,146 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_acfacb "countTrailingZeros_acfacb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %84 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %87 = OpConstantNull %v3int + %88 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %20 + %15 = OpBitcast %v3uint %v + OpStore %x %15 + %25 = OpLoad %v3uint %x + %28 = OpBitwiseAnd %v3uint %25 %27 + %22 = OpINotEqual %v3bool %28 %20 + %21 = OpSelect %v3uint %22 %20 %30 + %31 = OpLoad %v3uint %x + %32 = OpShiftRightLogical %v3uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v3uint %x + %38 = OpBitwiseAnd %v3uint %35 %37 + %34 = OpINotEqual %v3bool %38 %20 + %33 = OpSelect %v3uint %34 %20 %40 + %41 = OpLoad %v3uint %x + %42 = OpShiftRightLogical %v3uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v3uint %x + %48 = OpBitwiseAnd %v3uint %45 %47 + %44 = OpINotEqual %v3bool %48 %20 + %43 = OpSelect %v3uint %44 %20 %50 + %51 = OpLoad %v3uint %x + %52 = OpShiftRightLogical %v3uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v3uint %x + %58 = OpBitwiseAnd %v3uint %55 %57 + %54 = OpINotEqual %v3bool %58 %20 + %53 = OpSelect %v3uint %54 %20 %60 + %61 = OpLoad %v3uint %x + %62 = OpShiftRightLogical %v3uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v3uint %x + %68 = OpBitwiseAnd %v3uint %65 %67 + %64 = OpINotEqual %v3bool %68 %20 + %63 = OpSelect %v3uint %64 %20 %67 + %70 = OpLoad %v3uint %x + %71 = OpIEqual %v3bool %70 %20 + %69 = OpSelect %v3uint %71 %67 %20 + %73 = OpBitwiseOr %v3uint %21 %33 + %74 = OpBitwiseOr %v3uint %73 %43 + %75 = OpBitwiseOr %v3uint %74 %53 + %76 = OpBitwiseOr %v3uint %75 %63 + %77 = OpIAdd %v3uint %76 %69 + %72 = OpBitcast %v3int %77 + OpReturnValue %72 + OpFunctionEnd +%countTrailingZeros_acfacb = OpFunction %void None %78 + %81 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %87 + %82 = OpFunctionCall %v3int %tint_count_trailing_zeros %84 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %88 + %90 = OpLabel + %91 = OpFunctionCall %void %countTrailingZeros_acfacb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %93 = OpLabel + %94 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %94 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %97 = OpLabel + %98 = OpFunctionCall %void %countTrailingZeros_acfacb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %100 = OpLabel + %101 = OpFunctionCall %void %countTrailingZeros_acfacb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.wgsl new file mode 100644 index 0000000000..147489f895 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/acfacb.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countTrailingZeros_acfacb() { + var res : vec3 = countTrailingZeros(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_acfacb(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_acfacb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_acfacb(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl new file mode 100644 index 0000000000..42c66bc007 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<4, u32>) -> vec<4, u32> +fn countTrailingZeros_d2b4a0() { + var res: vec4 = countTrailingZeros(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_d2b4a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_d2b4a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_d2b4a0(); +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8504bb8fe8 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint4 tint_count_trailing_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uint4 res = tint_count_trailing_zeros((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_d2b4a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_d2b4a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_d2b4a0(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8504bb8fe8 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint4 tint_count_trailing_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uint4 res = tint_count_trailing_zeros((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_d2b4a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_d2b4a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_d2b4a0(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.glsl new file mode 100644 index 0000000000..12fcaa31cf --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec4 tint_count_trailing_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uvec4 res = tint_count_trailing_zeros(uvec4(1u)); +} + +vec4 vertex_main() { + countTrailingZeros_d2b4a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_count_trailing_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uvec4 res = tint_count_trailing_zeros(uvec4(1u)); +} + +void fragment_main() { + countTrailingZeros_d2b4a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_count_trailing_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uvec4 res = tint_count_trailing_zeros(uvec4(1u)); +} + +void compute_main() { + countTrailingZeros_d2b4a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.msl b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.msl new file mode 100644 index 0000000000..79d1f25e29 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void countTrailingZeros_d2b4a0() { + uint4 res = ctz(uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_d2b4a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_d2b4a0(); + return; +} + +kernel void compute_main() { + countTrailingZeros_d2b4a0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..74bcb410fd --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_d2b4a0 "countTrailingZeros_d2b4a0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %18 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %82 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %x %v + %23 = OpLoad %v4uint %x + %26 = OpBitwiseAnd %v4uint %23 %25 + %20 = OpINotEqual %v4bool %26 %18 + %19 = OpSelect %v4uint %20 %18 %28 + %29 = OpLoad %v4uint %x + %30 = OpShiftRightLogical %v4uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v4uint %x + %36 = OpBitwiseAnd %v4uint %33 %35 + %32 = OpINotEqual %v4bool %36 %18 + %31 = OpSelect %v4uint %32 %18 %38 + %39 = OpLoad %v4uint %x + %40 = OpShiftRightLogical %v4uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v4uint %x + %46 = OpBitwiseAnd %v4uint %43 %45 + %42 = OpINotEqual %v4bool %46 %18 + %41 = OpSelect %v4uint %42 %18 %48 + %49 = OpLoad %v4uint %x + %50 = OpShiftRightLogical %v4uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v4uint %x + %56 = OpBitwiseAnd %v4uint %53 %55 + %52 = OpINotEqual %v4bool %56 %18 + %51 = OpSelect %v4uint %52 %18 %58 + %59 = OpLoad %v4uint %x + %60 = OpShiftRightLogical %v4uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v4uint %x + %66 = OpBitwiseAnd %v4uint %63 %65 + %62 = OpINotEqual %v4bool %66 %18 + %61 = OpSelect %v4uint %62 %18 %65 + %68 = OpLoad %v4uint %x + %69 = OpIEqual %v4bool %68 %18 + %67 = OpSelect %v4uint %69 %65 %18 + %71 = OpBitwiseOr %v4uint %19 %31 + %72 = OpBitwiseOr %v4uint %71 %41 + %73 = OpBitwiseOr %v4uint %72 %51 + %74 = OpBitwiseOr %v4uint %73 %61 + %75 = OpIAdd %v4uint %74 %67 + OpReturnValue %75 + OpFunctionEnd +%countTrailingZeros_d2b4a0 = OpFunction %void None %76 + %79 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %18 + %80 = OpFunctionCall %v4uint %tint_count_trailing_zeros %65 + OpStore %res %80 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %82 + %84 = OpLabel + %85 = OpFunctionCall %void %countTrailingZeros_d2b4a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %76 + %87 = OpLabel + %88 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %88 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %76 + %91 = OpLabel + %92 = OpFunctionCall %void %countTrailingZeros_d2b4a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %76 + %94 = OpLabel + %95 = OpFunctionCall %void %countTrailingZeros_d2b4a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..7f6c8d0801 --- /dev/null +++ b/test/tint/builtins/gen/literal/countTrailingZeros/d2b4a0.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn countTrailingZeros_d2b4a0() { + var res : vec4 = countTrailingZeros(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_d2b4a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_d2b4a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_d2b4a0(); +} diff --git a/test/tint/builtins/gen/literal/cross/041cb0.wgsl b/test/tint/builtins/gen/literal/cross/041cb0.wgsl new file mode 100644 index 0000000000..d99f749d64 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/041cb0.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cross(vec3, vec3) -> vec3 +fn cross_041cb0() { + var res: vec3 = cross(vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_041cb0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_041cb0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_041cb0(); +} diff --git a/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..36e4194fb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cross_041cb0() { + float3 res = cross((0.0f).xxx, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_041cb0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_041cb0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_041cb0(); + return; +} diff --git a/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..36e4194fb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cross_041cb0() { + float3 res = cross((0.0f).xxx, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_041cb0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_041cb0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_041cb0(); + return; +} diff --git a/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.glsl new file mode 100644 index 0000000000..b0e727f68d --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cross_041cb0() { + vec3 res = cross(vec3(0.0f), vec3(0.0f)); +} + +vec4 vertex_main() { + cross_041cb0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cross_041cb0() { + vec3 res = cross(vec3(0.0f), vec3(0.0f)); +} + +void fragment_main() { + cross_041cb0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cross_041cb0() { + vec3 res = cross(vec3(0.0f), vec3(0.0f)); +} + +void compute_main() { + cross_041cb0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.msl b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.msl new file mode 100644 index 0000000000..01500bb8d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cross_041cb0() { + float3 res = cross(float3(0.0f), float3(0.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cross_041cb0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cross_041cb0(); + return; +} + +kernel void compute_main() { + cross_041cb0(); + return; +} + diff --git a/test/tint/builtins/gen/cross/041cb0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/cross/041cb0.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4f3b74361 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/041cb0.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cross_041cb0() { + var res : vec3 = cross(vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_041cb0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_041cb0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_041cb0(); +} diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl new file mode 100644 index 0000000000..ba13074fbd --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cross(vec3, vec3) -> vec3 +fn cross_9857cb() { + var res: vec3 = cross(vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_9857cb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_9857cb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_9857cb(); +} diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32fcd70771 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cross_9857cb() { + vector res = cross((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_9857cb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_9857cb(); + return; +} diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6d21a306f --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void cross_9857cb() { + vector res = cross((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_9857cb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_9857cb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001ABE1B9A830(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.glsl new file mode 100644 index 0000000000..dd0311f0e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cross_9857cb() { + f16vec3 res = cross(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + cross_9857cb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cross_9857cb() { + f16vec3 res = cross(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + cross_9857cb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cross_9857cb() { + f16vec3 res = cross(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + cross_9857cb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.msl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.msl new file mode 100644 index 0000000000..3591ad2801 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cross_9857cb() { + half3 res = cross(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cross_9857cb(); + return; +} + +kernel void compute_main() { + cross_9857cb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.spvasm new file mode 100644 index 0000000000..4552d8ef2e --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cross_9857cb "cross_9857cb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cross_9857cb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Cross %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cross_9857cb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cross_9857cb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cross_9857cb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d151e84c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cross/9857cb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn cross_9857cb() { + var res : vec3 = cross(vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_9857cb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_9857cb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_9857cb(); +} diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl new file mode 100644 index 0000000000..e2fee81c05 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(vec<4, f32>) -> vec<4, f32> +fn degrees_0d170c() { + var res: vec4 = degrees(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_0d170c(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_0d170c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_0d170c(); +} diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2cd2296e5c --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_0d170c() { + float4 res = tint_degrees((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_0d170c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_0d170c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_0d170c(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2cd2296e5c --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_0d170c() { + float4 res = tint_degrees((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_0d170c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_0d170c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_0d170c(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.glsl new file mode 100644 index 0000000000..542dec0b01 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec4 tint_degrees(vec4 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_0d170c() { + vec4 res = tint_degrees(vec4(1.0f)); +} + +vec4 vertex_main() { + degrees_0d170c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_degrees(vec4 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_0d170c() { + vec4 res = tint_degrees(vec4(1.0f)); +} + +void fragment_main() { + degrees_0d170c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_degrees(vec4 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_0d170c() { + vec4 res = tint_degrees(vec4(1.0f)); +} + +void compute_main() { + degrees_0d170c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.msl new file mode 100644 index 0000000000..8dc825c600 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_0d170c() { + float4 res = tint_degrees(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_0d170c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_0d170c(); + return; +} + +kernel void compute_main() { + degrees_0d170c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.spvasm new file mode 100644 index 0000000000..738ca27315 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_0d170c "degrees_0d170c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%degrees_0d170c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Degrees %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %degrees_0d170c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %degrees_0d170c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %degrees_0d170c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.wgsl new file mode 100644 index 0000000000..c387999a30 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn degrees_0d170c() { + var res : vec4 = degrees(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_0d170c(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_0d170c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_0d170c(); +} diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl new file mode 100644 index 0000000000..653b687c3c --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(vec<2, f32>) -> vec<2, f32> +fn degrees_1ad5df() { + var res: vec2 = degrees(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_1ad5df(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_1ad5df(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_1ad5df(); +} diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f8315be982 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_degrees(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_1ad5df() { + float2 res = tint_degrees((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_1ad5df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_1ad5df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_1ad5df(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f8315be982 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_degrees(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_1ad5df() { + float2 res = tint_degrees((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_1ad5df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_1ad5df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_1ad5df(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.glsl new file mode 100644 index 0000000000..b3dfe33c21 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec2 tint_degrees(vec2 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_1ad5df() { + vec2 res = tint_degrees(vec2(1.0f)); +} + +vec4 vertex_main() { + degrees_1ad5df(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_degrees(vec2 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_1ad5df() { + vec2 res = tint_degrees(vec2(1.0f)); +} + +void fragment_main() { + degrees_1ad5df(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_degrees(vec2 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_1ad5df() { + vec2 res = tint_degrees(vec2(1.0f)); +} + +void compute_main() { + degrees_1ad5df(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.msl new file mode 100644 index 0000000000..e46d2ff6e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +float2 tint_degrees(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_1ad5df() { + float2 res = tint_degrees(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_1ad5df(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_1ad5df(); + return; +} + +kernel void compute_main() { + degrees_1ad5df(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.spvasm new file mode 100644 index 0000000000..573f04d66c --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_1ad5df "degrees_1ad5df" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%degrees_1ad5df = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Degrees %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %degrees_1ad5df + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %degrees_1ad5df + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %degrees_1ad5df + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.wgsl new file mode 100644 index 0000000000..518eca43f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn degrees_1ad5df() { + var res : vec2 = degrees(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_1ad5df(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_1ad5df(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_1ad5df(); +} diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl new file mode 100644 index 0000000000..a524ec74c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(vec<3, f32>) -> vec<3, f32> +fn degrees_2af623() { + var res: vec3 = degrees(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_2af623(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_2af623(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_2af623(); +} diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..292fa3a209 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_degrees(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_2af623() { + float3 res = tint_degrees((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_2af623(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_2af623(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_2af623(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..292fa3a209 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_degrees(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_2af623() { + float3 res = tint_degrees((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_2af623(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_2af623(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_2af623(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.glsl new file mode 100644 index 0000000000..fa064b924f --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec3 tint_degrees(vec3 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_2af623() { + vec3 res = tint_degrees(vec3(1.0f)); +} + +vec4 vertex_main() { + degrees_2af623(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_degrees(vec3 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_2af623() { + vec3 res = tint_degrees(vec3(1.0f)); +} + +void fragment_main() { + degrees_2af623(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_degrees(vec3 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_2af623() { + vec3 res = tint_degrees(vec3(1.0f)); +} + +void compute_main() { + degrees_2af623(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.msl new file mode 100644 index 0000000000..4874bbb432 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +float3 tint_degrees(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_2af623() { + float3 res = tint_degrees(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_2af623(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_2af623(); + return; +} + +kernel void compute_main() { + degrees_2af623(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.spvasm new file mode 100644 index 0000000000..160a383197 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_2af623 "degrees_2af623" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%degrees_2af623 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Degrees %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %degrees_2af623 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %degrees_2af623 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %degrees_2af623 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.wgsl new file mode 100644 index 0000000000..b26cdbfcd1 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn degrees_2af623() { + var res : vec3 = degrees(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_2af623(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_2af623(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_2af623(); +} diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl new file mode 100644 index 0000000000..f749565726 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<4, f16>) -> vec<4, f16> +fn degrees_3055d3() { + var res: vec4 = degrees(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_3055d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_3055d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_3055d3(); +} diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..196bdf52ed --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + vector res = tint_degrees((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_3055d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_3055d3(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..825ef73d00 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + vector res = tint_degrees((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_3055d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_3055d3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020615990520(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl new file mode 100644 index 0000000000..a9e5f5dfdc --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 res = tint_degrees(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + degrees_3055d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 res = tint_degrees(f16vec4(0.0hf)); +} + +void fragment_main() { + degrees_3055d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 res = tint_degrees(f16vec4(0.0hf)); +} + +void compute_main() { + degrees_3055d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl new file mode 100644 index 0000000000..2075cbd3c7 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half4 tint_degrees(half4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + half4 res = tint_degrees(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_3055d3(); + return; +} + +kernel void compute_main() { + degrees_3055d3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d68e4ea46 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_3055d3 "degrees_3055d3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_3055d3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Degrees %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %degrees_3055d3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %degrees_3055d3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %degrees_3055d3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..58d6ef5441 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn degrees_3055d3() { + var res : vec4 = degrees(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_3055d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_3055d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_3055d3(); +} diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl new file mode 100644 index 0000000000..c853557e6d --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(f32) -> f32 +fn degrees_51f705() { + var res: f32 = degrees(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_51f705(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_51f705(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_51f705(); +} diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..feab0fbc91 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_51f705() { + float res = tint_degrees(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_51f705(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_51f705(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_51f705(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..feab0fbc91 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_51f705() { + float res = tint_degrees(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_51f705(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_51f705(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_51f705(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.glsl new file mode 100644 index 0000000000..3357c9e108 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_51f705() { + float res = tint_degrees(1.0f); +} + +vec4 vertex_main() { + degrees_51f705(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_51f705() { + float res = tint_degrees(1.0f); +} + +void fragment_main() { + degrees_51f705(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_51f705() { + float res = tint_degrees(1.0f); +} + +void compute_main() { + degrees_51f705(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.msl new file mode 100644 index 0000000000..6c29fa0a17 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_51f705() { + float res = tint_degrees(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_51f705(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_51f705(); + return; +} + +kernel void compute_main() { + degrees_51f705(); + return; +} + diff --git a/test/tint/builtins/gen/degrees/51f705.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/degrees/51f705.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.wgsl new file mode 100644 index 0000000000..a1f9f7f2b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn degrees_51f705() { + var res : f32 = degrees(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_51f705(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_51f705(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_51f705(); +} diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl new file mode 100644 index 0000000000..cdd9a50ac1 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(f16) -> f16 +fn degrees_5e9805() { + var res: f16 = degrees(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_5e9805(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_5e9805(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_5e9805(); +} diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..209c5b44bf --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + float16_t res = tint_degrees(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_5e9805(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_5e9805(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7647535ea7 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + float16_t res = tint_degrees(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_5e9805(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_5e9805(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021D8DD40440(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl new file mode 100644 index 0000000000..1a87241032 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t res = tint_degrees(0.0hf); +} + +vec4 vertex_main() { + degrees_5e9805(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t res = tint_degrees(0.0hf); +} + +void fragment_main() { + degrees_5e9805(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t res = tint_degrees(0.0hf); +} + +void compute_main() { + degrees_5e9805(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl new file mode 100644 index 0000000000..1aacda2ef3 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half tint_degrees(half param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + half res = tint_degrees(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_5e9805(); + return; +} + +kernel void compute_main() { + degrees_5e9805(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm new file mode 100644 index 0000000000..028d4a8910 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_5e9805 "degrees_5e9805" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_5e9805 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Degrees %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %degrees_5e9805 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %degrees_5e9805 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_5e9805 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.wgsl new file mode 100644 index 0000000000..647c580f09 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn degrees_5e9805() { + var res : f16 = degrees(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_5e9805(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_5e9805(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_5e9805(); +} diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl new file mode 100644 index 0000000000..c30a280190 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<3, f16>) -> vec<3, f16> +fn degrees_dfe8f4() { + var res: vec3 = degrees(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_dfe8f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_dfe8f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_dfe8f4(); +} diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0dd63bf276 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + vector res = tint_degrees((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_dfe8f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_dfe8f4(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e49c90f53 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + vector res = tint_degrees((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_dfe8f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_dfe8f4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BA47346FD0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl new file mode 100644 index 0000000000..59962ab016 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 res = tint_degrees(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + degrees_dfe8f4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 res = tint_degrees(f16vec3(0.0hf)); +} + +void fragment_main() { + degrees_dfe8f4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 res = tint_degrees(f16vec3(0.0hf)); +} + +void compute_main() { + degrees_dfe8f4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl new file mode 100644 index 0000000000..f6ef443fa1 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half3 tint_degrees(half3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + half3 res = tint_degrees(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_dfe8f4(); + return; +} + +kernel void compute_main() { + degrees_dfe8f4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb059e81a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_dfe8f4 "degrees_dfe8f4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_dfe8f4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Degrees %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %degrees_dfe8f4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %degrees_dfe8f4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %degrees_dfe8f4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d2cd7ab4e --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn degrees_dfe8f4() { + var res : vec3 = degrees(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_dfe8f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_dfe8f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_dfe8f4(); +} diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl new file mode 100644 index 0000000000..7cfc4a234f --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<2, f16>) -> vec<2, f16> +fn degrees_f59715() { + var res: vec2 = degrees(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_f59715(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_f59715(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_f59715(); +} diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8aac00fc98 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + vector res = tint_degrees((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_f59715(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_f59715(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ada3122e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + vector res = tint_degrees((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_f59715(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_f59715(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025AB33F0650(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl new file mode 100644 index 0000000000..99ed077df0 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 res = tint_degrees(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + degrees_f59715(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 res = tint_degrees(f16vec2(0.0hf)); +} + +void fragment_main() { + degrees_f59715(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 res = tint_degrees(f16vec2(0.0hf)); +} + +void compute_main() { + degrees_f59715(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl new file mode 100644 index 0000000000..2c0932577b --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half2 tint_degrees(half2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + half2 res = tint_degrees(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_f59715(); + return; +} + +kernel void compute_main() { + degrees_f59715(); + return; +} + diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9b7fb5716 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_f59715 "degrees_f59715" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_f59715 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Degrees %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %degrees_f59715 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %degrees_f59715 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %degrees_f59715 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3b6057a07 --- /dev/null +++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn degrees_f59715() { + var res : vec2 = degrees(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_f59715(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_f59715(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_f59715(); +} diff --git a/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl new file mode 100644 index 0000000000..aa2e813ac4 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn determinant(mat<3, 3, f32>) -> f32 +fn determinant_2b62ba() { + var res: f32 = determinant(mat3x3(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_2b62ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_2b62ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_2b62ba(); +} diff --git a/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c9482d7f19 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void determinant_2b62ba() { + float res = determinant(float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_2b62ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_2b62ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_2b62ba(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9482d7f19 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void determinant_2b62ba() { + float res = determinant(float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_2b62ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_2b62ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_2b62ba(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.glsl new file mode 100644 index 0000000000..d801fb8be7 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void determinant_2b62ba() { + float res = determinant(mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f))); +} + +vec4 vertex_main() { + determinant_2b62ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void determinant_2b62ba() { + float res = determinant(mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f))); +} + +void fragment_main() { + determinant_2b62ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void determinant_2b62ba() { + float res = determinant(mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f))); +} + +void compute_main() { + determinant_2b62ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.msl b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.msl new file mode 100644 index 0000000000..725abfc8cc --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void determinant_2b62ba() { + float res = determinant(float3x3(float3(1.0f), float3(1.0f), float3(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_2b62ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_2b62ba(); + return; +} + +kernel void compute_main() { + determinant_2b62ba(); + return; +} + diff --git a/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..9673dd3c0d --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_2b62ba "determinant_2b62ba" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %19 = OpConstantComposite %mat3v3float %18 %18 %18 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float +%determinant_2b62ba = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Determinant %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %determinant_2b62ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %determinant_2b62ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %determinant_2b62ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc1d5c688a --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/2b62ba.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn determinant_2b62ba() { + var res : f32 = determinant(mat3x3(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_2b62ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_2b62ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_2b62ba(); +} diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl new file mode 100644 index 0000000000..9ff80ceb9b --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<4, 4, f16>) -> f16 +fn determinant_32bfde() { + var res: f16 = determinant(mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_32bfde(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_32bfde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_32bfde(); +} diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..123af604e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void determinant_32bfde() { + float16_t res = determinant(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_32bfde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_32bfde(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..919bf99ec9 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void determinant_32bfde() { + float16_t res = determinant(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_32bfde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_32bfde(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028760CE9820(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028760CE9820(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.glsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.glsl new file mode 100644 index 0000000000..32fc171cf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_32bfde() { + float16_t res = determinant(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +vec4 vertex_main() { + determinant_32bfde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_32bfde() { + float16_t res = determinant(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void fragment_main() { + determinant_32bfde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_32bfde() { + float16_t res = determinant(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void compute_main() { + determinant_32bfde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.msl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.msl new file mode 100644 index 0000000000..0f0a75d7db --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void determinant_32bfde() { + half res = determinant(half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_32bfde(); + return; +} + +kernel void compute_main() { + determinant_32bfde(); + return; +} + diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.spvasm new file mode 100644 index 0000000000..c3e9627c6b --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_32bfde "determinant_32bfde" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %18 = OpConstantNull %mat4v4half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpConstantNull %half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_32bfde = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %21 + %13 = OpExtInst %half %15 Determinant %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %determinant_32bfde + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %determinant_32bfde + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_32bfde + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.wgsl new file mode 100644 index 0000000000..5d3cce92f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/32bfde.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn determinant_32bfde() { + var res : f16 = determinant(mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_32bfde(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_32bfde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_32bfde(); +} diff --git a/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl new file mode 100644 index 0000000000..089c341721 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn determinant(mat<4, 4, f32>) -> f32 +fn determinant_a0a87c() { + var res: f32 = determinant(mat4x4(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_a0a87c(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_a0a87c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_a0a87c(); +} diff --git a/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0857fc602e --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void determinant_a0a87c() { + float res = determinant(float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_a0a87c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_a0a87c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_a0a87c(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0857fc602e --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void determinant_a0a87c() { + float res = determinant(float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_a0a87c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_a0a87c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_a0a87c(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.glsl new file mode 100644 index 0000000000..3d93e51b2c --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void determinant_a0a87c() { + float res = determinant(mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f))); +} + +vec4 vertex_main() { + determinant_a0a87c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void determinant_a0a87c() { + float res = determinant(mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f))); +} + +void fragment_main() { + determinant_a0a87c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void determinant_a0a87c() { + float res = determinant(mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f))); +} + +void compute_main() { + determinant_a0a87c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.msl b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.msl new file mode 100644 index 0000000000..9ee1b47ef2 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void determinant_a0a87c() { + float res = determinant(float4x4(float4(1.0f), float4(1.0f), float4(1.0f), float4(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_a0a87c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_a0a87c(); + return; +} + +kernel void compute_main() { + determinant_a0a87c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.spvasm new file mode 100644 index 0000000000..57d1c71295 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_a0a87c "determinant_a0a87c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %18 = OpConstantComposite %mat4v4float %17 %17 %17 %17 +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpTypeFunction %v4float +%determinant_a0a87c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Determinant %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %determinant_a0a87c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %determinant_a0a87c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %determinant_a0a87c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.wgsl new file mode 100644 index 0000000000..ddd8ee9c58 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/a0a87c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn determinant_a0a87c() { + var res : f32 = determinant(mat4x4(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_a0a87c(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_a0a87c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_a0a87c(); +} diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl new file mode 100644 index 0000000000..bb81d5be13 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<3, 3, f16>) -> f16 +fn determinant_d7c86f() { + var res: f16 = determinant(mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_d7c86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_d7c86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_d7c86f(); +} diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4971b2eb09 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void determinant_d7c86f() { + float16_t res = determinant(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_d7c86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_d7c86f(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0b82260ebc --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void determinant_d7c86f() { + float16_t res = determinant(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_d7c86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_d7c86f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017F01F7E050(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017F01F7E050(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.glsl new file mode 100644 index 0000000000..13f877ca77 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_d7c86f() { + float16_t res = determinant(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +vec4 vertex_main() { + determinant_d7c86f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_d7c86f() { + float16_t res = determinant(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void fragment_main() { + determinant_d7c86f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_d7c86f() { + float16_t res = determinant(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void compute_main() { + determinant_d7c86f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.msl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.msl new file mode 100644 index 0000000000..cfb43b5e41 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void determinant_d7c86f() { + half res = determinant(half3x3(half3(0.0h), half3(0.0h), half3(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_d7c86f(); + return; +} + +kernel void compute_main() { + determinant_d7c86f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3ed5ccb94 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_d7c86f "determinant_d7c86f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %18 = OpConstantNull %mat3v3half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpConstantNull %half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_d7c86f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %21 + %13 = OpExtInst %half %15 Determinant %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %determinant_d7c86f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %determinant_d7c86f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_d7c86f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.wgsl new file mode 100644 index 0000000000..2623778210 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/d7c86f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn determinant_d7c86f() { + var res : f16 = determinant(mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_d7c86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_d7c86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_d7c86f(); +} diff --git a/test/tint/builtins/gen/literal/determinant/e19305.wgsl b/test/tint/builtins/gen/literal/determinant/e19305.wgsl new file mode 100644 index 0000000000..c025b314ea --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/e19305.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn determinant(mat<2, 2, f32>) -> f32 +fn determinant_e19305() { + var res: f32 = determinant(mat2x2(1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_e19305(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_e19305(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_e19305(); +} diff --git a/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c372a3a13 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void determinant_e19305() { + float res = determinant(float2x2((1.0f).xx, (1.0f).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_e19305(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_e19305(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_e19305(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c372a3a13 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void determinant_e19305() { + float res = determinant(float2x2((1.0f).xx, (1.0f).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_e19305(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_e19305(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_e19305(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.glsl b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.glsl new file mode 100644 index 0000000000..cccb7b6faf --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void determinant_e19305() { + float res = determinant(mat2(vec2(1.0f), vec2(1.0f))); +} + +vec4 vertex_main() { + determinant_e19305(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void determinant_e19305() { + float res = determinant(mat2(vec2(1.0f), vec2(1.0f))); +} + +void fragment_main() { + determinant_e19305(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void determinant_e19305() { + float res = determinant(mat2(vec2(1.0f), vec2(1.0f))); +} + +void compute_main() { + determinant_e19305(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.msl b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.msl new file mode 100644 index 0000000000..47b8bed88e --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void determinant_e19305() { + float res = determinant(float2x2(float2(1.0f), float2(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_e19305(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_e19305(); + return; +} + +kernel void compute_main() { + determinant_e19305(); + return; +} + diff --git a/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.spvasm new file mode 100644 index 0000000000..441f89e453 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_e19305 "determinant_e19305" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v2float %float_1 %float_1 + %19 = OpConstantComposite %mat2v2float %18 %18 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float +%determinant_e19305 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Determinant %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %determinant_e19305 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %determinant_e19305 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %determinant_e19305 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.wgsl new file mode 100644 index 0000000000..ae1eead09b --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/e19305.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn determinant_e19305() { + var res : f32 = determinant(mat2x2(1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_e19305(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_e19305(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_e19305(); +} diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl new file mode 100644 index 0000000000..2b22f37372 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<2, 2, f16>) -> f16 +fn determinant_fc12a5() { + var res: f16 = determinant(mat2x2(f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_fc12a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_fc12a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_fc12a5(); +} diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f1f2a237ab --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void determinant_fc12a5() { + float16_t res = determinant(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_fc12a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_fc12a5(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c7ad5c5a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void determinant_fc12a5() { + float16_t res = determinant(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_fc12a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_fc12a5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002949F67AAF0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002949F67AAF0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.glsl new file mode 100644 index 0000000000..5239eec2ab --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_fc12a5() { + float16_t res = determinant(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +vec4 vertex_main() { + determinant_fc12a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_fc12a5() { + float16_t res = determinant(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void fragment_main() { + determinant_fc12a5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_fc12a5() { + float16_t res = determinant(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void compute_main() { + determinant_fc12a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.msl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.msl new file mode 100644 index 0000000000..ef6ccaf3f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void determinant_fc12a5() { + half res = determinant(half2x2(half2(0.0h), half2(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_fc12a5(); + return; +} + +kernel void compute_main() { + determinant_fc12a5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.spvasm new file mode 100644 index 0000000000..77251639e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_fc12a5 "determinant_fc12a5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %18 = OpConstantNull %mat2v2half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpConstantNull %half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_fc12a5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %21 + %13 = OpExtInst %half %15 Determinant %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %determinant_fc12a5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %determinant_fc12a5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_fc12a5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a10d8ebcd --- /dev/null +++ b/test/tint/builtins/gen/literal/determinant/fc12a5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn determinant_fc12a5() { + var res : f16 = determinant(mat2x2(f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_fc12a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_fc12a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_fc12a5(); +} diff --git a/test/tint/builtins/gen/literal/distance/0657d4.wgsl b/test/tint/builtins/gen/literal/distance/0657d4.wgsl new file mode 100644 index 0000000000..92790279f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/0657d4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(vec<3, f32>, vec<3, f32>) -> f32 +fn distance_0657d4() { + var res: f32 = distance(vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_0657d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_0657d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_0657d4(); +} diff --git a/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..192c04661d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_0657d4() { + float res = distance((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_0657d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_0657d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_0657d4(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..192c04661d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void distance_0657d4() { + float res = distance((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_0657d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_0657d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_0657d4(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.glsl new file mode 100644 index 0000000000..4792eb818c --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void distance_0657d4() { + float res = distance(vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + distance_0657d4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_0657d4() { + float res = distance(vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + distance_0657d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_0657d4() { + float res = distance(vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + distance_0657d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.msl new file mode 100644 index 0000000000..b61c9fbed5 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_0657d4() { + float res = distance(float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_0657d4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_0657d4(); + return; +} + +kernel void compute_main() { + distance_0657d4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b0a28ae20 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_0657d4 "distance_0657d4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%distance_0657d4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Distance %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %distance_0657d4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_0657d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %distance_0657d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..2cec35098f --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/0657d4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn distance_0657d4() { + var res : f32 = distance(vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_0657d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_0657d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_0657d4(); +} diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl new file mode 100644 index 0000000000..1752332b22 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<4, f16>, vec<4, f16>) -> f16 +fn distance_7272f3() { + var res: f16 = distance(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7272f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7272f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7272f3(); +} diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e34e085df --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_7272f3() { + float16_t res = distance((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7272f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7272f3(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66ce4f31de --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void distance_7272f3() { + float16_t res = distance((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7272f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7272f3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AF01F7D600(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AF01F7D600(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.glsl new file mode 100644 index 0000000000..3ecf59a4f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7272f3() { + float16_t res = distance(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + distance_7272f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_7272f3() { + float16_t res = distance(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + distance_7272f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7272f3() { + float16_t res = distance(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + distance_7272f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.msl new file mode 100644 index 0000000000..87c9be80e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_7272f3() { + half res = distance(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_7272f3(); + return; +} + +kernel void compute_main() { + distance_7272f3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..491038ea6d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_7272f3 "distance_7272f3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_7272f3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Distance %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %distance_7272f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %distance_7272f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_7272f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..5472c32ceb --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7272f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn distance_7272f3() { + var res : f16 = distance(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7272f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7272f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7272f3(); +} diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl new file mode 100644 index 0000000000..a03bad71aa --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(f16, f16) -> f16 +fn distance_7d201f() { + var res: f16 = distance(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7d201f(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7d201f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7d201f(); +} diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..10efc6d0bf --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_7d201f() { + float16_t res = distance(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7d201f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7d201f(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..653ef2c07d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void distance_7d201f() { + float16_t res = distance(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7d201f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7d201f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D5BC336FD0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D5BC336FD0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.glsl new file mode 100644 index 0000000000..30aee9f2c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7d201f() { + float16_t res = distance(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + distance_7d201f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_7d201f() { + float16_t res = distance(0.0hf, 0.0hf); +} + +void fragment_main() { + distance_7d201f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7d201f() { + float16_t res = distance(0.0hf, 0.0hf); +} + +void compute_main() { + distance_7d201f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.msl new file mode 100644 index 0000000000..e7baa97561 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_7d201f() { + half res = fabs(0.0h - 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_7d201f(); + return; +} + +kernel void compute_main() { + distance_7d201f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.spvasm new file mode 100644 index 0000000000..8a0a548a2f --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_7d201f "distance_7d201f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_7d201f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Distance %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %distance_7d201f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_7d201f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %distance_7d201f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.wgsl new file mode 100644 index 0000000000..8de385102d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/7d201f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn distance_7d201f() { + var res : f16 = distance(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7d201f(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7d201f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7d201f(); +} diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl new file mode 100644 index 0000000000..affa3a3990 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<2, f16>, vec<2, f16>) -> f16 +fn distance_892a5d() { + var res: f16 = distance(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_892a5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_892a5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_892a5d(); +} diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d35b1478a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_892a5d() { + float16_t res = distance((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_892a5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_892a5d(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..198576cf6e --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void distance_892a5d() { + float16_t res = distance((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_892a5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_892a5d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026F67541620(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026F67541620(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.glsl new file mode 100644 index 0000000000..6c6b7523d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_892a5d() { + float16_t res = distance(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + distance_892a5d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_892a5d() { + float16_t res = distance(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + distance_892a5d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_892a5d() { + float16_t res = distance(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + distance_892a5d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.msl new file mode 100644 index 0000000000..8977f6729d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_892a5d() { + half res = distance(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_892a5d(); + return; +} + +kernel void compute_main() { + distance_892a5d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f00450255 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_892a5d "distance_892a5d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_892a5d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Distance %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %distance_892a5d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %distance_892a5d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_892a5d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.wgsl new file mode 100644 index 0000000000..71ed2d0177 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/892a5d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn distance_892a5d() { + var res : f16 = distance(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_892a5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_892a5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_892a5d(); +} diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl new file mode 100644 index 0000000000..80353c820a --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<3, f16>, vec<3, f16>) -> f16 +fn distance_928fa0() { + var res: f16 = distance(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_928fa0(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_928fa0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_928fa0(); +} diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c21d1447db --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_928fa0() { + float16_t res = distance((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_928fa0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_928fa0(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd6b130263 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void distance_928fa0() { + float16_t res = distance((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_928fa0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_928fa0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001ECED3C83A0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001ECED3C83A0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.glsl new file mode 100644 index 0000000000..c68cb1079d --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_928fa0() { + float16_t res = distance(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + distance_928fa0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_928fa0() { + float16_t res = distance(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + distance_928fa0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_928fa0() { + float16_t res = distance(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + distance_928fa0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.msl new file mode 100644 index 0000000000..0e034abc4b --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_928fa0() { + half res = distance(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_928fa0(); + return; +} + +kernel void compute_main() { + distance_928fa0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.spvasm new file mode 100644 index 0000000000..63605caa7a --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_928fa0 "distance_928fa0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_928fa0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Distance %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %distance_928fa0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %distance_928fa0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_928fa0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.wgsl new file mode 100644 index 0000000000..81c645190a --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/928fa0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn distance_928fa0() { + var res : f16 = distance(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_928fa0(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_928fa0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_928fa0(); +} diff --git a/test/tint/builtins/gen/literal/distance/9646ea.wgsl b/test/tint/builtins/gen/literal/distance/9646ea.wgsl new file mode 100644 index 0000000000..7eaaa6db15 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/9646ea.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(vec<4, f32>, vec<4, f32>) -> f32 +fn distance_9646ea() { + var res: f32 = distance(vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_9646ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_9646ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_9646ea(); +} diff --git a/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..629f3ab707 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_9646ea() { + float res = distance((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_9646ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_9646ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_9646ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..629f3ab707 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void distance_9646ea() { + float res = distance((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_9646ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_9646ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_9646ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.glsl new file mode 100644 index 0000000000..ee04153ea0 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void distance_9646ea() { + float res = distance(vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + distance_9646ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_9646ea() { + float res = distance(vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + distance_9646ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_9646ea() { + float res = distance(vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + distance_9646ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.msl new file mode 100644 index 0000000000..0d90ab3102 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_9646ea() { + float res = distance(float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_9646ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_9646ea(); + return; +} + +kernel void compute_main() { + distance_9646ea(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..2956c308af --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_9646ea "distance_9646ea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpTypeFunction %v4float +%distance_9646ea = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Distance %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %distance_9646ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %distance_9646ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %distance_9646ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..4a3d9dae03 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/9646ea.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn distance_9646ea() { + var res : f32 = distance(vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_9646ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_9646ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_9646ea(); +} diff --git a/test/tint/builtins/gen/literal/distance/aa4055.wgsl b/test/tint/builtins/gen/literal/distance/aa4055.wgsl new file mode 100644 index 0000000000..16ab33b93e --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/aa4055.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(vec<2, f32>, vec<2, f32>) -> f32 +fn distance_aa4055() { + var res: f32 = distance(vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_aa4055(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_aa4055(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_aa4055(); +} diff --git a/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..948efd08f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_aa4055() { + float res = distance((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_aa4055(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_aa4055(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_aa4055(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..948efd08f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void distance_aa4055() { + float res = distance((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_aa4055(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_aa4055(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_aa4055(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.glsl new file mode 100644 index 0000000000..9a2c485c2b --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void distance_aa4055() { + float res = distance(vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + distance_aa4055(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_aa4055() { + float res = distance(vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + distance_aa4055(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_aa4055() { + float res = distance(vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + distance_aa4055(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.msl new file mode 100644 index 0000000000..990edc41cd --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_aa4055() { + float res = distance(float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_aa4055(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_aa4055(); + return; +} + +kernel void compute_main() { + distance_aa4055(); + return; +} + diff --git a/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1cda7e177 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_aa4055 "distance_aa4055" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%distance_aa4055 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Distance %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %distance_aa4055 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_aa4055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %distance_aa4055 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.wgsl new file mode 100644 index 0000000000..bfec354da3 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/aa4055.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn distance_aa4055() { + var res : f32 = distance(vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_aa4055(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_aa4055(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_aa4055(); +} diff --git a/test/tint/builtins/gen/literal/distance/cfed73.wgsl b/test/tint/builtins/gen/literal/distance/cfed73.wgsl new file mode 100644 index 0000000000..7455071bd2 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/cfed73.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(f32, f32) -> f32 +fn distance_cfed73() { + var res: f32 = distance(1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_cfed73(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_cfed73(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_cfed73(); +} diff --git a/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..277968e1b0 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void distance_cfed73() { + float res = distance(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_cfed73(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_cfed73(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_cfed73(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..277968e1b0 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void distance_cfed73() { + float res = distance(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_cfed73(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_cfed73(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_cfed73(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.glsl b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.glsl new file mode 100644 index 0000000000..1bdaa15599 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void distance_cfed73() { + float res = distance(1.0f, 1.0f); +} + +vec4 vertex_main() { + distance_cfed73(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_cfed73() { + float res = distance(1.0f, 1.0f); +} + +void fragment_main() { + distance_cfed73(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_cfed73() { + float res = distance(1.0f, 1.0f); +} + +void compute_main() { + distance_cfed73(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.msl b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.msl new file mode 100644 index 0000000000..a149206f88 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void distance_cfed73() { + float res = fabs(1.0f - 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_cfed73(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_cfed73(); + return; +} + +kernel void compute_main() { + distance_cfed73(); + return; +} + diff --git a/test/tint/builtins/gen/distance/cfed73.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/distance/cfed73.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cf21ef495 --- /dev/null +++ b/test/tint/builtins/gen/literal/distance/cfed73.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn distance_cfed73() { + var res : f32 = distance(1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_cfed73(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_cfed73(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_cfed73(); +} diff --git a/test/tint/builtins/gen/literal/dot/0c577b.wgsl b/test/tint/builtins/gen/literal/dot/0c577b.wgsl new file mode 100644 index 0000000000..68a6963259 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/0c577b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<4, f32>, vec<4, f32>) -> f32 +fn dot_0c577b() { + var res: f32 = dot(vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_0c577b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_0c577b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_0c577b(); +} diff --git a/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ddbdbd46ec --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_0c577b() { + float res = dot((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_0c577b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_0c577b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_0c577b(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ddbdbd46ec --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void dot_0c577b() { + float res = dot((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_0c577b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_0c577b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_0c577b(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.glsl new file mode 100644 index 0000000000..bc4518f455 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void dot_0c577b() { + float res = dot(vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + dot_0c577b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void dot_0c577b() { + float res = dot(vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + dot_0c577b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void dot_0c577b() { + float res = dot(vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + dot_0c577b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.msl new file mode 100644 index 0000000000..f4501c00b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void dot_0c577b() { + float res = dot(float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_0c577b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_0c577b(); + return; +} + +kernel void compute_main() { + dot_0c577b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.spvasm new file mode 100644 index 0000000000..b64095ef36 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_0c577b "dot_0c577b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %v4float + %dot_0c577b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpDot %float %15 %15 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %dot_0c577b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %void %dot_0c577b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %dot_0c577b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3729326e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/0c577b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn dot_0c577b() { + var res : f32 = dot(vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_0c577b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_0c577b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_0c577b(); +} diff --git a/test/tint/builtins/gen/literal/dot/7548a0.wgsl b/test/tint/builtins/gen/literal/dot/7548a0.wgsl new file mode 100644 index 0000000000..c4137acaed --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/7548a0.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<3, u32>, vec<3, u32>) -> u32 +fn dot_7548a0() { + var res: u32 = dot(vec3(1u), vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_7548a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_7548a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_7548a0(); +} diff --git a/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd0f853b12 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_7548a0() { + uint res = dot((1u).xxx, (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_7548a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_7548a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_7548a0(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd0f853b12 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void dot_7548a0() { + uint res = dot((1u).xxx, (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_7548a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_7548a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_7548a0(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.glsl new file mode 100644 index 0000000000..6b184f8f5d --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uint tint_int_dot(uvec3 a, uvec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_7548a0() { + uint res = tint_int_dot(uvec3(1u), uvec3(1u)); +} + +vec4 vertex_main() { + dot_7548a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_int_dot(uvec3 a, uvec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_7548a0() { + uint res = tint_int_dot(uvec3(1u), uvec3(1u)); +} + +void fragment_main() { + dot_7548a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_int_dot(uvec3 a, uvec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_7548a0() { + uint res = tint_int_dot(uvec3(1u), uvec3(1u)); +} + +void compute_main() { + dot_7548a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.msl new file mode 100644 index 0000000000..47aee0ff3c --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +template +T tint_dot3(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} +void dot_7548a0() { + uint res = tint_dot3(uint3(1u), uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_7548a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_7548a0(); + return; +} + +kernel void compute_main() { + dot_7548a0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..2043848f40 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_7548a0 "dot_7548a0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_uint = OpTypePointer Function %uint + %30 = OpConstantNull %uint + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_7548a0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %30 + %18 = OpCompositeExtract %uint %17 0 + %19 = OpCompositeExtract %uint %17 0 + %20 = OpIMul %uint %18 %19 + %21 = OpCompositeExtract %uint %17 1 + %22 = OpCompositeExtract %uint %17 1 + %23 = OpIMul %uint %21 %22 + %24 = OpIAdd %uint %20 %23 + %25 = OpCompositeExtract %uint %17 2 + %26 = OpCompositeExtract %uint %17 2 + %27 = OpIMul %uint %25 %26 + %13 = OpIAdd %uint %24 %27 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %dot_7548a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %dot_7548a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %dot_7548a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..61d149656b --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/7548a0.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn dot_7548a0() { + var res : u32 = dot(vec3(1u), vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_7548a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_7548a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_7548a0(); +} diff --git a/test/tint/builtins/gen/literal/dot/883f0e.wgsl b/test/tint/builtins/gen/literal/dot/883f0e.wgsl new file mode 100644 index 0000000000..9e4fb03d89 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/883f0e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<2, f32>, vec<2, f32>) -> f32 +fn dot_883f0e() { + var res: f32 = dot(vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_883f0e(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_883f0e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_883f0e(); +} diff --git a/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e4cbb5ed8 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_883f0e() { + float res = dot((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_883f0e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_883f0e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_883f0e(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4e4cbb5ed8 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void dot_883f0e() { + float res = dot((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_883f0e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_883f0e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_883f0e(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.glsl new file mode 100644 index 0000000000..6ab33ae703 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void dot_883f0e() { + float res = dot(vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + dot_883f0e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void dot_883f0e() { + float res = dot(vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + dot_883f0e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void dot_883f0e() { + float res = dot(vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + dot_883f0e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.msl new file mode 100644 index 0000000000..44510c4a7c --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void dot_883f0e() { + float res = dot(float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_883f0e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_883f0e(); + return; +} + +kernel void compute_main() { + dot_883f0e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1cf73c227 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_883f0e "dot_883f0e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpTypeFunction %v4float + %dot_883f0e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpDot %float %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %dot_883f0e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_883f0e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %dot_883f0e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.wgsl new file mode 100644 index 0000000000..4d6a4bd1ca --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/883f0e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn dot_883f0e() { + var res : f32 = dot(vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_883f0e(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_883f0e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_883f0e(); +} diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl new file mode 100644 index 0000000000..84f71c0aa6 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<3, f16>, vec<3, f16>) -> f16 +fn dot_8e40f1() { + var res: f16 = dot(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_8e40f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_8e40f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_8e40f1(); +} diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e108ce8a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_8e40f1() { + float16_t res = dot((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_8e40f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_8e40f1(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6a02e9473 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void dot_8e40f1() { + float16_t res = dot((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_8e40f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_8e40f1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E9C49996F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E9C49996F0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.glsl new file mode 100644 index 0000000000..434219455a --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_8e40f1() { + float16_t res = dot(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + dot_8e40f1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_8e40f1() { + float16_t res = dot(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + dot_8e40f1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_8e40f1() { + float16_t res = dot(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + dot_8e40f1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.msl new file mode 100644 index 0000000000..1c34dc5296 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void dot_8e40f1() { + half res = dot(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_8e40f1(); + return; +} + +kernel void compute_main() { + dot_8e40f1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fc21ecc72 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_8e40f1 "dot_8e40f1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %16 = OpConstantNull %v3half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpConstantNull %half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_8e40f1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %19 + %13 = OpDot %half %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %dot_8e40f1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %dot_8e40f1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot_8e40f1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b8c1a658d --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/8e40f1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn dot_8e40f1() { + var res : f16 = dot(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_8e40f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_8e40f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_8e40f1(); +} diff --git a/test/tint/builtins/gen/literal/dot/97c7ee.wgsl b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl new file mode 100644 index 0000000000..8b72eece29 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<2, u32>, vec<2, u32>) -> u32 +fn dot_97c7ee() { + var res: u32 = dot(vec2(1u), vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_97c7ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_97c7ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_97c7ee(); +} diff --git a/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9237756a2e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_97c7ee() { + uint res = dot((1u).xx, (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_97c7ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_97c7ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_97c7ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9237756a2e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void dot_97c7ee() { + uint res = dot((1u).xx, (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_97c7ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_97c7ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_97c7ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.glsl new file mode 100644 index 0000000000..c61da39599 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uint tint_int_dot(uvec2 a, uvec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_97c7ee() { + uint res = tint_int_dot(uvec2(1u), uvec2(1u)); +} + +vec4 vertex_main() { + dot_97c7ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_int_dot(uvec2 a, uvec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_97c7ee() { + uint res = tint_int_dot(uvec2(1u), uvec2(1u)); +} + +void fragment_main() { + dot_97c7ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_int_dot(uvec2 a, uvec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_97c7ee() { + uint res = tint_int_dot(uvec2(1u), uvec2(1u)); +} + +void compute_main() { + dot_97c7ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.msl new file mode 100644 index 0000000000..6565bb85a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +template +T tint_dot2(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1]; +} +void dot_97c7ee() { + uint res = tint_dot2(uint2(1u), uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_97c7ee(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_97c7ee(); + return; +} + +kernel void compute_main() { + dot_97c7ee(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..079b868089 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_97c7ee "dot_97c7ee" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_uint = OpTypePointer Function %uint + %26 = OpConstantNull %uint + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_97c7ee = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %26 + %18 = OpCompositeExtract %uint %17 0 + %19 = OpCompositeExtract %uint %17 0 + %20 = OpIMul %uint %18 %19 + %21 = OpCompositeExtract %uint %17 1 + %22 = OpCompositeExtract %uint %17 1 + %23 = OpIMul %uint %21 %22 + %13 = OpIAdd %uint %20 %23 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %dot_97c7ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %dot_97c7ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %dot_97c7ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c2729b35e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/97c7ee.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn dot_97c7ee() { + var res : u32 = dot(vec2(1u), vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_97c7ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_97c7ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_97c7ee(); +} diff --git a/test/tint/builtins/gen/literal/dot/ba4246.wgsl b/test/tint/builtins/gen/literal/dot/ba4246.wgsl new file mode 100644 index 0000000000..55ebdb6f8f --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ba4246.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<3, f32>, vec<3, f32>) -> f32 +fn dot_ba4246() { + var res: f32 = dot(vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_ba4246(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_ba4246(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_ba4246(); +} diff --git a/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a9325cd1b --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_ba4246() { + float res = dot((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ba4246(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ba4246(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ba4246(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a9325cd1b --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void dot_ba4246() { + float res = dot((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ba4246(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ba4246(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ba4246(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.glsl new file mode 100644 index 0000000000..101b193471 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void dot_ba4246() { + float res = dot(vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + dot_ba4246(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void dot_ba4246() { + float res = dot(vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + dot_ba4246(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void dot_ba4246() { + float res = dot(vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + dot_ba4246(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.msl new file mode 100644 index 0000000000..be8c5ad201 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void dot_ba4246() { + float res = dot(float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_ba4246(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_ba4246(); + return; +} + +kernel void compute_main() { + dot_ba4246(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ab148083f --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_ba4246 "dot_ba4246" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpTypeFunction %v4float + %dot_ba4246 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpDot %float %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %dot_ba4246 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_ba4246 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %dot_ba4246 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e8e00f0ae --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ba4246.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn dot_ba4246() { + var res : f32 = dot(vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_ba4246(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_ba4246(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_ba4246(); +} diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl new file mode 100644 index 0000000000..e300f3179e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<2, f16>, vec<2, f16>) -> f16 +fn dot_cd5a04() { + var res: f16 = dot(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_cd5a04(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_cd5a04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_cd5a04(); +} diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..04adad0292 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_cd5a04() { + float16_t res = dot((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_cd5a04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_cd5a04(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d48d74ed05 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void dot_cd5a04() { + float16_t res = dot((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_cd5a04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_cd5a04(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B52BF97850(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B52BF97850(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.glsl new file mode 100644 index 0000000000..c14d0ae8f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_cd5a04() { + float16_t res = dot(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + dot_cd5a04(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_cd5a04() { + float16_t res = dot(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + dot_cd5a04(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_cd5a04() { + float16_t res = dot(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + dot_cd5a04(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.msl new file mode 100644 index 0000000000..243b15aef2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void dot_cd5a04() { + half res = dot(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_cd5a04(); + return; +} + +kernel void compute_main() { + dot_cd5a04(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fbae9809a --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_cd5a04 "dot_cd5a04" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %16 = OpConstantNull %v2half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpConstantNull %half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_cd5a04 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %19 + %13 = OpDot %half %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %dot_cd5a04 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %dot_cd5a04 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot_cd5a04 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.wgsl new file mode 100644 index 0000000000..25778c7de4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/cd5a04.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn dot_cd5a04() { + var res : f16 = dot(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_cd5a04(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_cd5a04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_cd5a04(); +} diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl new file mode 100644 index 0000000000..39d1e51fc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<4, f16>, vec<4, f16>) -> f16 +fn dot_d0d179() { + var res: f16 = dot(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_d0d179(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_d0d179(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_d0d179(); +} diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f05dcec1ce --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_d0d179() { + float16_t res = dot((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_d0d179(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_d0d179(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c95a5e6d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void dot_d0d179() { + float16_t res = dot((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_d0d179(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_d0d179(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E77FD80D40(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E77FD80D40(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.glsl new file mode 100644 index 0000000000..90dbe8ae34 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_d0d179() { + float16_t res = dot(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + dot_d0d179(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_d0d179() { + float16_t res = dot(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + dot_d0d179(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_d0d179() { + float16_t res = dot(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + dot_d0d179(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.msl new file mode 100644 index 0000000000..becad5b54d --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void dot_d0d179() { + half res = dot(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_d0d179(); + return; +} + +kernel void compute_main() { + dot_d0d179(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.spvasm new file mode 100644 index 0000000000..379f0238a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_d0d179 "dot_d0d179" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %16 = OpConstantNull %v4half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpConstantNull %half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_d0d179 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %19 + %13 = OpDot %half %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %dot_d0d179 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %dot_d0d179 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot_d0d179 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e94f8b831 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/d0d179.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn dot_d0d179() { + var res : f16 = dot(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_d0d179(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_d0d179(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_d0d179(); +} diff --git a/test/tint/builtins/gen/literal/dot/e994c7.wgsl b/test/tint/builtins/gen/literal/dot/e994c7.wgsl new file mode 100644 index 0000000000..05a469022e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/e994c7.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<4, u32>, vec<4, u32>) -> u32 +fn dot_e994c7() { + var res: u32 = dot(vec4(1u), vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_e994c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_e994c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_e994c7(); +} diff --git a/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..65c2053d80 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_e994c7() { + uint res = dot((1u).xxxx, (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_e994c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_e994c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_e994c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65c2053d80 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void dot_e994c7() { + uint res = dot((1u).xxxx, (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_e994c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_e994c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_e994c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.glsl new file mode 100644 index 0000000000..c430e32a7e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uint tint_int_dot(uvec4 a, uvec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_e994c7() { + uint res = tint_int_dot(uvec4(1u), uvec4(1u)); +} + +vec4 vertex_main() { + dot_e994c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_int_dot(uvec4 a, uvec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_e994c7() { + uint res = tint_int_dot(uvec4(1u), uvec4(1u)); +} + +void fragment_main() { + dot_e994c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_int_dot(uvec4 a, uvec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_e994c7() { + uint res = tint_int_dot(uvec4(1u), uvec4(1u)); +} + +void compute_main() { + dot_e994c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.msl new file mode 100644 index 0000000000..1939acd798 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +template +T tint_dot4(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} +void dot_e994c7() { + uint res = tint_dot4(uint4(1u), uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_e994c7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_e994c7(); + return; +} + +kernel void compute_main() { + dot_e994c7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..8a993d8681 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_e994c7 "dot_e994c7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_uint = OpTypePointer Function %uint + %34 = OpConstantNull %uint + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_e994c7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %34 + %18 = OpCompositeExtract %uint %17 0 + %19 = OpCompositeExtract %uint %17 0 + %20 = OpIMul %uint %18 %19 + %21 = OpCompositeExtract %uint %17 1 + %22 = OpCompositeExtract %uint %17 1 + %23 = OpIMul %uint %21 %22 + %24 = OpIAdd %uint %20 %23 + %25 = OpCompositeExtract %uint %17 2 + %26 = OpCompositeExtract %uint %17 2 + %27 = OpIMul %uint %25 %26 + %28 = OpIAdd %uint %24 %27 + %29 = OpCompositeExtract %uint %17 3 + %30 = OpCompositeExtract %uint %17 3 + %31 = OpIMul %uint %29 %30 + %13 = OpIAdd %uint %28 %31 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_e994c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %44 = OpLabel + %45 = OpFunctionCall %void %dot_e994c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %47 = OpLabel + %48 = OpFunctionCall %void %dot_e994c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..f1a91b6185 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/e994c7.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn dot_e994c7() { + var res : u32 = dot(vec4(1u), vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_e994c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_e994c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_e994c7(); +} diff --git a/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl new file mode 100644 index 0000000000..d480c0836e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<4, i32>, vec<4, i32>) -> i32 +fn dot_ef6b1d() { + var res: i32 = dot(vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_ef6b1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_ef6b1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_ef6b1d(); +} diff --git a/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..570b419f4a --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_ef6b1d() { + int res = dot((1).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ef6b1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ef6b1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ef6b1d(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..570b419f4a --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void dot_ef6b1d() { + int res = dot((1).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ef6b1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ef6b1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ef6b1d(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.glsl new file mode 100644 index 0000000000..a6ec4b0080 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +int tint_int_dot(ivec4 a, ivec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_ef6b1d() { + int res = tint_int_dot(ivec4(1), ivec4(1)); +} + +vec4 vertex_main() { + dot_ef6b1d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_int_dot(ivec4 a, ivec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_ef6b1d() { + int res = tint_int_dot(ivec4(1), ivec4(1)); +} + +void fragment_main() { + dot_ef6b1d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_int_dot(ivec4 a, ivec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_ef6b1d() { + int res = tint_int_dot(ivec4(1), ivec4(1)); +} + +void compute_main() { + dot_ef6b1d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.msl new file mode 100644 index 0000000000..e5e2f0777c --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +template +T tint_dot4(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} +void dot_ef6b1d() { + int res = tint_dot4(int4(1), int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_ef6b1d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_ef6b1d(); + return; +} + +kernel void compute_main() { + dot_ef6b1d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d8c3fb78c --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_ef6b1d "dot_ef6b1d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_ef6b1d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_int Function %34 + %18 = OpCompositeExtract %int %17 0 + %19 = OpCompositeExtract %int %17 0 + %20 = OpIMul %int %18 %19 + %21 = OpCompositeExtract %int %17 1 + %22 = OpCompositeExtract %int %17 1 + %23 = OpIMul %int %21 %22 + %24 = OpIAdd %int %20 %23 + %25 = OpCompositeExtract %int %17 2 + %26 = OpCompositeExtract %int %17 2 + %27 = OpIMul %int %25 %26 + %28 = OpIAdd %int %24 %27 + %29 = OpCompositeExtract %int %17 3 + %30 = OpCompositeExtract %int %17 3 + %31 = OpIMul %int %29 %30 + %13 = OpIAdd %int %28 %31 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_ef6b1d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %44 = OpLabel + %45 = OpFunctionCall %void %dot_ef6b1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %47 = OpLabel + %48 = OpFunctionCall %void %dot_ef6b1d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..6f8f382031 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/ef6b1d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn dot_ef6b1d() { + var res : i32 = dot(vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_ef6b1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_ef6b1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_ef6b1d(); +} diff --git a/test/tint/builtins/gen/literal/dot/f1312c.wgsl b/test/tint/builtins/gen/literal/dot/f1312c.wgsl new file mode 100644 index 0000000000..9d185e8186 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/f1312c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<3, i32>, vec<3, i32>) -> i32 +fn dot_f1312c() { + var res: i32 = dot(vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_f1312c(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_f1312c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_f1312c(); +} diff --git a/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b3fde1321e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_f1312c() { + int res = dot((1).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_f1312c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_f1312c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_f1312c(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b3fde1321e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void dot_f1312c() { + int res = dot((1).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_f1312c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_f1312c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_f1312c(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.glsl new file mode 100644 index 0000000000..907adba6f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +int tint_int_dot(ivec3 a, ivec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_f1312c() { + int res = tint_int_dot(ivec3(1), ivec3(1)); +} + +vec4 vertex_main() { + dot_f1312c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_int_dot(ivec3 a, ivec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_f1312c() { + int res = tint_int_dot(ivec3(1), ivec3(1)); +} + +void fragment_main() { + dot_f1312c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_int_dot(ivec3 a, ivec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_f1312c() { + int res = tint_int_dot(ivec3(1), ivec3(1)); +} + +void compute_main() { + dot_f1312c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.msl new file mode 100644 index 0000000000..5de6c94d43 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +template +T tint_dot3(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} +void dot_f1312c() { + int res = tint_dot3(int3(1), int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_f1312c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_f1312c(); + return; +} + +kernel void compute_main() { + dot_f1312c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.spvasm new file mode 100644 index 0000000000..121718d184 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_f1312c "dot_f1312c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_f1312c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_int Function %30 + %18 = OpCompositeExtract %int %17 0 + %19 = OpCompositeExtract %int %17 0 + %20 = OpIMul %int %18 %19 + %21 = OpCompositeExtract %int %17 1 + %22 = OpCompositeExtract %int %17 1 + %23 = OpIMul %int %21 %22 + %24 = OpIAdd %int %20 %23 + %25 = OpCompositeExtract %int %17 2 + %26 = OpCompositeExtract %int %17 2 + %27 = OpIMul %int %25 %26 + %13 = OpIAdd %int %24 %27 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %dot_f1312c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %dot_f1312c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %dot_f1312c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.wgsl new file mode 100644 index 0000000000..0550c5503c --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/f1312c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn dot_f1312c() { + var res : i32 = dot(vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_f1312c(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_f1312c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_f1312c(); +} diff --git a/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl new file mode 100644 index 0000000000..90006c0866 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<2, i32>, vec<2, i32>) -> i32 +fn dot_fc5f7c() { + var res: i32 = dot(vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_fc5f7c(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_fc5f7c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_fc5f7c(); +} diff --git a/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8df1600626 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void dot_fc5f7c() { + int res = dot((1).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_fc5f7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_fc5f7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_fc5f7c(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8df1600626 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void dot_fc5f7c() { + int res = dot((1).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_fc5f7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_fc5f7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_fc5f7c(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.glsl new file mode 100644 index 0000000000..9801dc592c --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +int tint_int_dot(ivec2 a, ivec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_fc5f7c() { + int res = tint_int_dot(ivec2(1), ivec2(1)); +} + +vec4 vertex_main() { + dot_fc5f7c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_int_dot(ivec2 a, ivec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_fc5f7c() { + int res = tint_int_dot(ivec2(1), ivec2(1)); +} + +void fragment_main() { + dot_fc5f7c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_int_dot(ivec2 a, ivec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_fc5f7c() { + int res = tint_int_dot(ivec2(1), ivec2(1)); +} + +void compute_main() { + dot_fc5f7c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.msl new file mode 100644 index 0000000000..6fbcb2ba11 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +template +T tint_dot2(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1]; +} +void dot_fc5f7c() { + int res = tint_dot2(int2(1), int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_fc5f7c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_fc5f7c(); + return; +} + +kernel void compute_main() { + dot_fc5f7c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.spvasm new file mode 100644 index 0000000000..ea9acb45f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_fc5f7c "dot_fc5f7c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_fc5f7c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_int Function %26 + %18 = OpCompositeExtract %int %17 0 + %19 = OpCompositeExtract %int %17 0 + %20 = OpIMul %int %18 %19 + %21 = OpCompositeExtract %int %17 1 + %22 = OpCompositeExtract %int %17 1 + %23 = OpIMul %int %21 %22 + %13 = OpIAdd %int %20 %23 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %dot_fc5f7c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %dot_fc5f7c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %dot_fc5f7c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1dd491ff6 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot/fc5f7c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn dot_fc5f7c() { + var res : i32 = dot(vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_fc5f7c(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_fc5f7c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_fc5f7c(); +} diff --git a/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl new file mode 100644 index 0000000000..dafb8b6fc9 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable chromium_experimental_dp4a; + +// fn dot4I8Packed(u32, u32) -> i32 +fn dot4I8Packed_881e62() { + var res: i32 = dot4I8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} diff --git a/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3ba498587a --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +int tint_dot4I8Packed(uint param_0, uint param_1) { + int accumulator = 0; + return dot4add_i8packed(param_0, param_1, accumulator); +} + +void dot4I8Packed_881e62() { + int res = tint_dot4I8Packed(1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot4I8Packed_881e62(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot4I8Packed_881e62(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot4I8Packed_881e62(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8ccdb8da56 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +int tint_dot4I8Packed(uint param_0, uint param_1) { + int accumulator = 0; + return dot4add_i8packed(param_0, param_1, accumulator); +} + +void dot4I8Packed_881e62() { + int res = tint_dot4I8Packed(1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot4I8Packed_881e62(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot4I8Packed_881e62(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot4I8Packed_881e62(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000239A33210B0(3,10-56): error X3004: undeclared identifier 'dot4add_i8packed' + diff --git a/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.glsl new file mode 100644 index 0000000000..e677648aa5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.glsl @@ -0,0 +1,74 @@ +SKIP: FAILED + + +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var res : i32 = dot4I8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} + +Failed to generate: error: Unknown builtin method: dot4I8Packed + +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var res : i32 = dot4I8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} + +Failed to generate: error: Unknown builtin method: dot4I8Packed + +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var res : i32 = dot4I8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} + +Failed to generate: error: Unknown builtin method: dot4I8Packed diff --git a/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.msl new file mode 100644 index 0000000000..e88d3858f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.msl @@ -0,0 +1,26 @@ +SKIP: FAILED + + +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var res : i32 = dot4I8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} + +Failed to generate: error: Unknown import method: dot4I8Packed diff --git a/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.spvasm new file mode 100644 index 0000000000..d71f31ef3d --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability DotProduct + OpCapability DotProductInput4x8BitPacked + OpExtension "SPV_KHR_integer_dot_product" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot4I8Packed_881e62 "dot4I8Packed_881e62" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%dot4I8Packed_881e62 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %13 = OpSDot %int %uint_1 %uint_1 PackedVectorFormat4x8Bit + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %dot4I8Packed_881e62 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %dot4I8Packed_881e62 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot4I8Packed_881e62 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.wgsl new file mode 100644 index 0000000000..8057884b8e --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4I8Packed/881e62.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var res : i32 = dot4I8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} diff --git a/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl new file mode 100644 index 0000000000..da99ad289f --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable chromium_experimental_dp4a; + +// fn dot4U8Packed(u32, u32) -> u32 +fn dot4U8Packed_fbed7b() { + var res: u32 = dot4U8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} diff --git a/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ffd98789e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +uint tint_dot4U8Packed(uint param_0, uint param_1) { + uint accumulator = 0u; + return dot4add_u8packed(param_0, param_1, accumulator); +} + +void dot4U8Packed_fbed7b() { + uint res = tint_dot4U8Packed(1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot4U8Packed_fbed7b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot4U8Packed_fbed7b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot4U8Packed_fbed7b(); + return; +} diff --git a/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e84c3daa48 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +uint tint_dot4U8Packed(uint param_0, uint param_1) { + uint accumulator = 0u; + return dot4add_u8packed(param_0, param_1, accumulator); +} + +void dot4U8Packed_fbed7b() { + uint res = tint_dot4U8Packed(1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot4U8Packed_fbed7b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot4U8Packed_fbed7b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot4U8Packed_fbed7b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D2469D6CD0(3,10-56): error X3004: undeclared identifier 'dot4add_u8packed' + diff --git a/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.glsl new file mode 100644 index 0000000000..acf55b6ca2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.glsl @@ -0,0 +1,74 @@ +SKIP: FAILED + + +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var res : u32 = dot4U8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} + +Failed to generate: error: Unknown builtin method: dot4U8Packed + +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var res : u32 = dot4U8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} + +Failed to generate: error: Unknown builtin method: dot4U8Packed + +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var res : u32 = dot4U8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} + +Failed to generate: error: Unknown builtin method: dot4U8Packed diff --git a/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.msl b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.msl new file mode 100644 index 0000000000..10a682f045 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.msl @@ -0,0 +1,26 @@ +SKIP: FAILED + + +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var res : u32 = dot4U8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} + +Failed to generate: error: Unknown import method: dot4U8Packed diff --git a/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.spvasm new file mode 100644 index 0000000000..855730c0d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability DotProduct + OpCapability DotProductInput4x8BitPacked + OpExtension "SPV_KHR_integer_dot_product" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot4U8Packed_fbed7b "dot4U8Packed_fbed7b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%dot4U8Packed_fbed7b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %13 = OpUDot %uint %uint_1 %uint_1 PackedVectorFormat4x8Bit + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %dot4U8Packed_fbed7b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %dot4U8Packed_fbed7b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %dot4U8Packed_fbed7b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f261301ee1 --- /dev/null +++ b/test/tint/builtins/gen/literal/dot4U8Packed/fbed7b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var res : u32 = dot4U8Packed(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} diff --git a/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl new file mode 100644 index 0000000000..be35d4c1f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(vec<3, f32>) -> vec<3, f32> +fn dpdx_0763f7() { + var res: vec3 = dpdx(vec3(1.f)); +} + +@fragment +fn fragment_main() { + dpdx_0763f7(); +} diff --git a/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..006f0ad5c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdx_0763f7() { + float3 res = ddx((1.0f).xxx); +} + +void fragment_main() { + dpdx_0763f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..006f0ad5c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdx_0763f7() { + float3 res = ddx((1.0f).xxx); +} + +void fragment_main() { + dpdx_0763f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.glsl new file mode 100644 index 0000000000..13b51c3068 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdx_0763f7() { + vec3 res = dFdx(vec3(1.0f)); +} + +void fragment_main() { + dpdx_0763f7(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.msl new file mode 100644 index 0000000000..bb7c03a82a --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdx_0763f7() { + float3 res = dfdx(float3(1.0f)); +} + +fragment void fragment_main() { + dpdx_0763f7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..4aa28b4e4c --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_0763f7 "dpdx_0763f7" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %12 = OpConstantNull %v3float +%dpdx_0763f7 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %12 + %5 = OpDPdx %v3float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdx_0763f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..01ce49fed2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/0763f7.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdx_0763f7() { + var res : vec3 = dpdx(vec3(1.0f)); +} + +@fragment +fn fragment_main() { + dpdx_0763f7(); +} diff --git a/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl new file mode 100644 index 0000000000..987877da25 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(vec<2, f32>) -> vec<2, f32> +fn dpdx_99edb1() { + var res: vec2 = dpdx(vec2(1.f)); +} + +@fragment +fn fragment_main() { + dpdx_99edb1(); +} diff --git a/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..329f5be609 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdx_99edb1() { + float2 res = ddx((1.0f).xx); +} + +void fragment_main() { + dpdx_99edb1(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..329f5be609 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdx_99edb1() { + float2 res = ddx((1.0f).xx); +} + +void fragment_main() { + dpdx_99edb1(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.glsl new file mode 100644 index 0000000000..54f5625d32 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdx_99edb1() { + vec2 res = dFdx(vec2(1.0f)); +} + +void fragment_main() { + dpdx_99edb1(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.msl new file mode 100644 index 0000000000..a7fe265145 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdx_99edb1() { + float2 res = dfdx(float2(1.0f)); +} + +fragment void fragment_main() { + dpdx_99edb1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.spvasm new file mode 100644 index 0000000000..0925757029 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_99edb1 "dpdx_99edb1" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %12 = OpConstantNull %v2float +%dpdx_99edb1 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %12 + %5 = OpDPdx %v2float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdx_99edb1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c04b9d5d63 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/99edb1.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdx_99edb1() { + var res : vec2 = dpdx(vec2(1.0f)); +} + +@fragment +fn fragment_main() { + dpdx_99edb1(); +} diff --git a/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl new file mode 100644 index 0000000000..fa5212e576 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(vec<4, f32>) -> vec<4, f32> +fn dpdx_c487fa() { + var res: vec4 = dpdx(vec4(1.f)); +} + +@fragment +fn fragment_main() { + dpdx_c487fa(); +} diff --git a/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5fe5a49560 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdx_c487fa() { + float4 res = ddx((1.0f).xxxx); +} + +void fragment_main() { + dpdx_c487fa(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5fe5a49560 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdx_c487fa() { + float4 res = ddx((1.0f).xxxx); +} + +void fragment_main() { + dpdx_c487fa(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.glsl new file mode 100644 index 0000000000..2f904628f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdx_c487fa() { + vec4 res = dFdx(vec4(1.0f)); +} + +void fragment_main() { + dpdx_c487fa(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.msl new file mode 100644 index 0000000000..3b79c397e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdx_c487fa() { + float4 res = dfdx(float4(1.0f)); +} + +fragment void fragment_main() { + dpdx_c487fa(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.spvasm new file mode 100644 index 0000000000..e13bd9ebab --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_c487fa "dpdx_c487fa" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %12 = OpConstantNull %v4float +%dpdx_c487fa = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %12 + %5 = OpDPdx %v4float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdx_c487fa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.wgsl new file mode 100644 index 0000000000..535c9f9b95 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/c487fa.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdx_c487fa() { + var res : vec4 = dpdx(vec4(1.0f)); +} + +@fragment +fn fragment_main() { + dpdx_c487fa(); +} diff --git a/test/tint/builtins/gen/literal/dpdx/e263de.wgsl b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl new file mode 100644 index 0000000000..d38f6c7c61 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(f32) -> f32 +fn dpdx_e263de() { + var res: f32 = dpdx(1.f); +} + +@fragment +fn fragment_main() { + dpdx_e263de(); +} diff --git a/test/tint/builtins/gen/dpdx/e263de.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/dpdx/e263de.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e9ef3f4fd6 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdx_e263de() { + float res = ddx(1.0f); +} + +void fragment_main() { + dpdx_e263de(); + return; +} diff --git a/test/tint/builtins/gen/dpdx/e263de.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/dpdx/e263de.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/dpdx/e263de.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/dpdx/e263de.wgsl.expected.msl rename to test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.msl diff --git a/test/tint/builtins/gen/dpdx/e263de.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/dpdx/e263de.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.wgsl new file mode 100644 index 0000000000..50afb2d1fa --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdx/e263de.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdx_e263de() { + var res : f32 = dpdx(1.0f); +} + +@fragment +fn fragment_main() { + dpdx_e263de(); +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl new file mode 100644 index 0000000000..eeb549011c --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(f32) -> f32 +fn dpdxCoarse_029152() { + var res: f32 = dpdxCoarse(1.f); +} + +@fragment +fn fragment_main() { + dpdxCoarse_029152(); +} diff --git a/test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..940572b041 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdxCoarse_029152() { + float res = ddx_coarse(1.0f); +} + +void fragment_main() { + dpdxCoarse_029152(); + return; +} diff --git a/test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.msl rename to test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.msl diff --git a/test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/dpdxCoarse/029152.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9c3d00971 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/029152.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdxCoarse_029152() { + var res : f32 = dpdxCoarse(1.0f); +} + +@fragment +fn fragment_main() { + dpdxCoarse_029152(); +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl new file mode 100644 index 0000000000..7c28974420 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(vec<2, f32>) -> vec<2, f32> +fn dpdxCoarse_9581cf() { + var res: vec2 = dpdxCoarse(vec2(1.f)); +} + +@fragment +fn fragment_main() { + dpdxCoarse_9581cf(); +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..90068fd1a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdxCoarse_9581cf() { + float2 res = ddx_coarse((1.0f).xx); +} + +void fragment_main() { + dpdxCoarse_9581cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..90068fd1a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdxCoarse_9581cf() { + float2 res = ddx_coarse((1.0f).xx); +} + +void fragment_main() { + dpdxCoarse_9581cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.glsl new file mode 100644 index 0000000000..3edfdc459a --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_9581cf() { + vec2 res = dFdx(vec2(1.0f)); +} + +void fragment_main() { + dpdxCoarse_9581cf(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.msl new file mode 100644 index 0000000000..ee68af836b --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdxCoarse_9581cf() { + float2 res = dfdx(float2(1.0f)); +} + +fragment void fragment_main() { + dpdxCoarse_9581cf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..e04bfea6d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_9581cf "dpdxCoarse_9581cf" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %12 = OpConstantNull %v2float +%dpdxCoarse_9581cf = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %12 + %5 = OpDPdxCoarse %v2float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxCoarse_9581cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab423ce21d --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/9581cf.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdxCoarse_9581cf() { + var res : vec2 = dpdxCoarse(vec2(1.0f)); +} + +@fragment +fn fragment_main() { + dpdxCoarse_9581cf(); +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl new file mode 100644 index 0000000000..25de663226 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(vec<4, f32>) -> vec<4, f32> +fn dpdxCoarse_c28641() { + var res: vec4 = dpdxCoarse(vec4(1.f)); +} + +@fragment +fn fragment_main() { + dpdxCoarse_c28641(); +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b58e7504e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdxCoarse_c28641() { + float4 res = ddx_coarse((1.0f).xxxx); +} + +void fragment_main() { + dpdxCoarse_c28641(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b58e7504e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdxCoarse_c28641() { + float4 res = ddx_coarse((1.0f).xxxx); +} + +void fragment_main() { + dpdxCoarse_c28641(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.glsl new file mode 100644 index 0000000000..d872d9ce2c --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_c28641() { + vec4 res = dFdx(vec4(1.0f)); +} + +void fragment_main() { + dpdxCoarse_c28641(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.msl new file mode 100644 index 0000000000..06a682558a --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdxCoarse_c28641() { + float4 res = dfdx(float4(1.0f)); +} + +fragment void fragment_main() { + dpdxCoarse_c28641(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.spvasm new file mode 100644 index 0000000000..9881a3302b --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_c28641 "dpdxCoarse_c28641" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %12 = OpConstantNull %v4float +%dpdxCoarse_c28641 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %12 + %5 = OpDPdxCoarse %v4float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxCoarse_c28641 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.wgsl new file mode 100644 index 0000000000..73c918ef3d --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/c28641.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdxCoarse_c28641() { + var res : vec4 = dpdxCoarse(vec4(1.0f)); +} + +@fragment +fn fragment_main() { + dpdxCoarse_c28641(); +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl new file mode 100644 index 0000000000..6d19694ae8 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(vec<3, f32>) -> vec<3, f32> +fn dpdxCoarse_f64d7b() { + var res: vec3 = dpdxCoarse(vec3(1.f)); +} + +@fragment +fn fragment_main() { + dpdxCoarse_f64d7b(); +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ac7bdfa276 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdxCoarse_f64d7b() { + float3 res = ddx_coarse((1.0f).xxx); +} + +void fragment_main() { + dpdxCoarse_f64d7b(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac7bdfa276 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdxCoarse_f64d7b() { + float3 res = ddx_coarse((1.0f).xxx); +} + +void fragment_main() { + dpdxCoarse_f64d7b(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.glsl new file mode 100644 index 0000000000..7226ff36fa --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_f64d7b() { + vec3 res = dFdx(vec3(1.0f)); +} + +void fragment_main() { + dpdxCoarse_f64d7b(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.msl new file mode 100644 index 0000000000..873a04fe55 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdxCoarse_f64d7b() { + float3 res = dfdx(float3(1.0f)); +} + +fragment void fragment_main() { + dpdxCoarse_f64d7b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.spvasm new file mode 100644 index 0000000000..9929a2d0c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_f64d7b "dpdxCoarse_f64d7b" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %12 = OpConstantNull %v3float +%dpdxCoarse_f64d7b = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %12 + %5 = OpDPdxCoarse %v3float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxCoarse_f64d7b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd55954234 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxCoarse/f64d7b.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdxCoarse_f64d7b() { + var res : vec3 = dpdxCoarse(vec3(1.0f)); +} + +@fragment +fn fragment_main() { + dpdxCoarse_f64d7b(); +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl new file mode 100644 index 0000000000..882541d4d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(vec<4, f32>) -> vec<4, f32> +fn dpdxFine_8c5069() { + var res: vec4 = dpdxFine(vec4(1.f)); +} + +@fragment +fn fragment_main() { + dpdxFine_8c5069(); +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0fd9cbd2b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdxFine_8c5069() { + float4 res = ddx_fine((1.0f).xxxx); +} + +void fragment_main() { + dpdxFine_8c5069(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0fd9cbd2b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdxFine_8c5069() { + float4 res = ddx_fine((1.0f).xxxx); +} + +void fragment_main() { + dpdxFine_8c5069(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.glsl new file mode 100644 index 0000000000..642c5c9a6f --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdxFine_8c5069() { + vec4 res = dFdx(vec4(1.0f)); +} + +void fragment_main() { + dpdxFine_8c5069(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.msl new file mode 100644 index 0000000000..8976e5a309 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdxFine_8c5069() { + float4 res = dfdx(float4(1.0f)); +} + +fragment void fragment_main() { + dpdxFine_8c5069(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.spvasm new file mode 100644 index 0000000000..0539ee96a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_8c5069 "dpdxFine_8c5069" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %12 = OpConstantNull %v4float +%dpdxFine_8c5069 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %12 + %5 = OpDPdxFine %v4float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxFine_8c5069 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.wgsl new file mode 100644 index 0000000000..68ac49bbc2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/8c5069.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdxFine_8c5069() { + var res : vec4 = dpdxFine(vec4(1.0f)); +} + +@fragment +fn fragment_main() { + dpdxFine_8c5069(); +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl new file mode 100644 index 0000000000..a658a70fd0 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(vec<2, f32>) -> vec<2, f32> +fn dpdxFine_9631de() { + var res: vec2 = dpdxFine(vec2(1.f)); +} + +@fragment +fn fragment_main() { + dpdxFine_9631de(); +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0cbd83cd10 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdxFine_9631de() { + float2 res = ddx_fine((1.0f).xx); +} + +void fragment_main() { + dpdxFine_9631de(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0cbd83cd10 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdxFine_9631de() { + float2 res = ddx_fine((1.0f).xx); +} + +void fragment_main() { + dpdxFine_9631de(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.glsl new file mode 100644 index 0000000000..6e00045800 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdxFine_9631de() { + vec2 res = dFdx(vec2(1.0f)); +} + +void fragment_main() { + dpdxFine_9631de(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.msl new file mode 100644 index 0000000000..c2c63db5f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdxFine_9631de() { + float2 res = dfdx(float2(1.0f)); +} + +fragment void fragment_main() { + dpdxFine_9631de(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe6f1cd736 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_9631de "dpdxFine_9631de" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %12 = OpConstantNull %v2float +%dpdxFine_9631de = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %12 + %5 = OpDPdxFine %v2float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxFine_9631de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.wgsl new file mode 100644 index 0000000000..cafb38223d --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/9631de.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdxFine_9631de() { + var res : vec2 = dpdxFine(vec2(1.0f)); +} + +@fragment +fn fragment_main() { + dpdxFine_9631de(); +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl new file mode 100644 index 0000000000..638fee0fc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(f32) -> f32 +fn dpdxFine_f401a2() { + var res: f32 = dpdxFine(1.f); +} + +@fragment +fn fragment_main() { + dpdxFine_f401a2(); +} diff --git a/test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf4ada458e --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdxFine_f401a2() { + float res = ddx_fine(1.0f); +} + +void fragment_main() { + dpdxFine_f401a2(); + return; +} diff --git a/test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.msl rename to test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.msl diff --git a/test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/dpdxFine/f401a2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.wgsl new file mode 100644 index 0000000000..03e57e92a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f401a2.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdxFine_f401a2() { + var res : f32 = dpdxFine(1.0f); +} + +@fragment +fn fragment_main() { + dpdxFine_f401a2(); +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl new file mode 100644 index 0000000000..57488d2eef --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(vec<3, f32>) -> vec<3, f32> +fn dpdxFine_f92fb6() { + var res: vec3 = dpdxFine(vec3(1.f)); +} + +@fragment +fn fragment_main() { + dpdxFine_f92fb6(); +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8629bb24b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdxFine_f92fb6() { + float3 res = ddx_fine((1.0f).xxx); +} + +void fragment_main() { + dpdxFine_f92fb6(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8629bb24b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdxFine_f92fb6() { + float3 res = ddx_fine((1.0f).xxx); +} + +void fragment_main() { + dpdxFine_f92fb6(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.glsl new file mode 100644 index 0000000000..a3783792e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdxFine_f92fb6() { + vec3 res = dFdx(vec3(1.0f)); +} + +void fragment_main() { + dpdxFine_f92fb6(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.msl new file mode 100644 index 0000000000..c5c18447fb --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdxFine_f92fb6() { + float3 res = dfdx(float3(1.0f)); +} + +fragment void fragment_main() { + dpdxFine_f92fb6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9b670f665 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_f92fb6 "dpdxFine_f92fb6" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %12 = OpConstantNull %v3float +%dpdxFine_f92fb6 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %12 + %5 = OpDPdxFine %v3float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxFine_f92fb6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.wgsl new file mode 100644 index 0000000000..aebeb3d477 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdxFine/f92fb6.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdxFine_f92fb6() { + var res : vec3 = dpdxFine(vec3(1.0f)); +} + +@fragment +fn fragment_main() { + dpdxFine_f92fb6(); +} diff --git a/test/tint/builtins/gen/literal/dpdy/699a05.wgsl b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl new file mode 100644 index 0000000000..36be8770ca --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(vec<4, f32>) -> vec<4, f32> +fn dpdy_699a05() { + var res: vec4 = dpdy(vec4(1.f)); +} + +@fragment +fn fragment_main() { + dpdy_699a05(); +} diff --git a/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..178cd503b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdy_699a05() { + float4 res = ddy((1.0f).xxxx); +} + +void fragment_main() { + dpdy_699a05(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..178cd503b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdy_699a05() { + float4 res = ddy((1.0f).xxxx); +} + +void fragment_main() { + dpdy_699a05(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.glsl new file mode 100644 index 0000000000..9baa62c6d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdy_699a05() { + vec4 res = dFdy(vec4(1.0f)); +} + +void fragment_main() { + dpdy_699a05(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.msl new file mode 100644 index 0000000000..d912666826 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdy_699a05() { + float4 res = dfdy(float4(1.0f)); +} + +fragment void fragment_main() { + dpdy_699a05(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.spvasm new file mode 100644 index 0000000000..82a555a08a --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_699a05 "dpdy_699a05" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %12 = OpConstantNull %v4float +%dpdy_699a05 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %12 + %5 = OpDPdy %v4float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdy_699a05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec7c3a829e --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/699a05.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdy_699a05() { + var res : vec4 = dpdy(vec4(1.0f)); +} + +@fragment +fn fragment_main() { + dpdy_699a05(); +} diff --git a/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl new file mode 100644 index 0000000000..a567c950c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(f32) -> f32 +fn dpdy_7f8d84() { + var res: f32 = dpdy(1.f); +} + +@fragment +fn fragment_main() { + dpdy_7f8d84(); +} diff --git a/test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b930062b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdy_7f8d84() { + float res = ddy(1.0f); +} + +void fragment_main() { + dpdy_7f8d84(); + return; +} diff --git a/test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.msl rename to test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.msl diff --git a/test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/dpdy/7f8d84.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.wgsl new file mode 100644 index 0000000000..6106dc9c8b --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/7f8d84.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdy_7f8d84() { + var res : f32 = dpdy(1.0f); +} + +@fragment +fn fragment_main() { + dpdy_7f8d84(); +} diff --git a/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl new file mode 100644 index 0000000000..df3d138492 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(vec<2, f32>) -> vec<2, f32> +fn dpdy_a8b56e() { + var res: vec2 = dpdy(vec2(1.f)); +} + +@fragment +fn fragment_main() { + dpdy_a8b56e(); +} diff --git a/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..917ee276ee --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdy_a8b56e() { + float2 res = ddy((1.0f).xx); +} + +void fragment_main() { + dpdy_a8b56e(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..917ee276ee --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdy_a8b56e() { + float2 res = ddy((1.0f).xx); +} + +void fragment_main() { + dpdy_a8b56e(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.glsl new file mode 100644 index 0000000000..3c34a29e58 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdy_a8b56e() { + vec2 res = dFdy(vec2(1.0f)); +} + +void fragment_main() { + dpdy_a8b56e(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.msl new file mode 100644 index 0000000000..410597a181 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdy_a8b56e() { + float2 res = dfdy(float2(1.0f)); +} + +fragment void fragment_main() { + dpdy_a8b56e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.spvasm new file mode 100644 index 0000000000..5b618affb6 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_a8b56e "dpdy_a8b56e" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %12 = OpConstantNull %v2float +%dpdy_a8b56e = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %12 + %5 = OpDPdy %v2float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdy_a8b56e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.wgsl new file mode 100644 index 0000000000..704c407ade --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/a8b56e.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdy_a8b56e() { + var res : vec2 = dpdy(vec2(1.0f)); +} + +@fragment +fn fragment_main() { + dpdy_a8b56e(); +} diff --git a/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl new file mode 100644 index 0000000000..8448462815 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(vec<3, f32>) -> vec<3, f32> +fn dpdy_feb40f() { + var res: vec3 = dpdy(vec3(1.f)); +} + +@fragment +fn fragment_main() { + dpdy_feb40f(); +} diff --git a/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a468ceeead --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdy_feb40f() { + float3 res = ddy((1.0f).xxx); +} + +void fragment_main() { + dpdy_feb40f(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a468ceeead --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdy_feb40f() { + float3 res = ddy((1.0f).xxx); +} + +void fragment_main() { + dpdy_feb40f(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.glsl new file mode 100644 index 0000000000..9a429dc483 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdy_feb40f() { + vec3 res = dFdy(vec3(1.0f)); +} + +void fragment_main() { + dpdy_feb40f(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.msl new file mode 100644 index 0000000000..c3249a9c8f --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdy_feb40f() { + float3 res = dfdy(float3(1.0f)); +} + +fragment void fragment_main() { + dpdy_feb40f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.spvasm new file mode 100644 index 0000000000..4fc2920e9c --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_feb40f "dpdy_feb40f" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %12 = OpConstantNull %v3float +%dpdy_feb40f = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %12 + %5 = OpDPdy %v3float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdy_feb40f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.wgsl new file mode 100644 index 0000000000..26ca0a7edf --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdy/feb40f.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdy_feb40f() { + var res : vec3 = dpdy(vec3(1.0f)); +} + +@fragment +fn fragment_main() { + dpdy_feb40f(); +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl new file mode 100644 index 0000000000..9348ea8ffc --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(vec<2, f32>) -> vec<2, f32> +fn dpdyCoarse_3e1ab4() { + var res: vec2 = dpdyCoarse(vec2(1.f)); +} + +@fragment +fn fragment_main() { + dpdyCoarse_3e1ab4(); +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..57028761f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdyCoarse_3e1ab4() { + float2 res = ddy_coarse((1.0f).xx); +} + +void fragment_main() { + dpdyCoarse_3e1ab4(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..57028761f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdyCoarse_3e1ab4() { + float2 res = ddy_coarse((1.0f).xx); +} + +void fragment_main() { + dpdyCoarse_3e1ab4(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.glsl new file mode 100644 index 0000000000..2838f06972 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_3e1ab4() { + vec2 res = dFdy(vec2(1.0f)); +} + +void fragment_main() { + dpdyCoarse_3e1ab4(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.msl new file mode 100644 index 0000000000..95dfcc8536 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdyCoarse_3e1ab4() { + float2 res = dfdy(float2(1.0f)); +} + +fragment void fragment_main() { + dpdyCoarse_3e1ab4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.spvasm new file mode 100644 index 0000000000..92025882ee --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_3e1ab4 "dpdyCoarse_3e1ab4" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %12 = OpConstantNull %v2float +%dpdyCoarse_3e1ab4 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %12 + %5 = OpDPdyCoarse %v2float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyCoarse_3e1ab4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.wgsl new file mode 100644 index 0000000000..5312afc019 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/3e1ab4.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdyCoarse_3e1ab4() { + var res : vec2 = dpdyCoarse(vec2(1.0f)); +} + +@fragment +fn fragment_main() { + dpdyCoarse_3e1ab4(); +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl new file mode 100644 index 0000000000..6ccb919b50 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(vec<4, f32>) -> vec<4, f32> +fn dpdyCoarse_445d24() { + var res: vec4 = dpdyCoarse(vec4(1.f)); +} + +@fragment +fn fragment_main() { + dpdyCoarse_445d24(); +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..032fe5b0ed --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdyCoarse_445d24() { + float4 res = ddy_coarse((1.0f).xxxx); +} + +void fragment_main() { + dpdyCoarse_445d24(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..032fe5b0ed --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdyCoarse_445d24() { + float4 res = ddy_coarse((1.0f).xxxx); +} + +void fragment_main() { + dpdyCoarse_445d24(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.glsl new file mode 100644 index 0000000000..7975166ae2 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_445d24() { + vec4 res = dFdy(vec4(1.0f)); +} + +void fragment_main() { + dpdyCoarse_445d24(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.msl new file mode 100644 index 0000000000..8625cff1b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdyCoarse_445d24() { + float4 res = dfdy(float4(1.0f)); +} + +fragment void fragment_main() { + dpdyCoarse_445d24(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.spvasm new file mode 100644 index 0000000000..7a552f160d --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_445d24 "dpdyCoarse_445d24" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %12 = OpConstantNull %v4float +%dpdyCoarse_445d24 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %12 + %5 = OpDPdyCoarse %v4float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyCoarse_445d24 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.wgsl new file mode 100644 index 0000000000..f96c8abe19 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/445d24.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdyCoarse_445d24() { + var res : vec4 = dpdyCoarse(vec4(1.0f)); +} + +@fragment +fn fragment_main() { + dpdyCoarse_445d24(); +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl new file mode 100644 index 0000000000..6834d5dbaf --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(f32) -> f32 +fn dpdyCoarse_870a7e() { + var res: f32 = dpdyCoarse(1.f); +} + +@fragment +fn fragment_main() { + dpdyCoarse_870a7e(); +} diff --git a/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43081240be --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdyCoarse_870a7e() { + float res = ddy_coarse(1.0f); +} + +void fragment_main() { + dpdyCoarse_870a7e(); + return; +} diff --git a/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.msl rename to test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.msl diff --git a/test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/dpdyCoarse/870a7e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.wgsl new file mode 100644 index 0000000000..cb6ebd4b3b --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/870a7e.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdyCoarse_870a7e() { + var res : f32 = dpdyCoarse(1.0f); +} + +@fragment +fn fragment_main() { + dpdyCoarse_870a7e(); +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl new file mode 100644 index 0000000000..75d07fe013 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(vec<3, f32>) -> vec<3, f32> +fn dpdyCoarse_ae1873() { + var res: vec3 = dpdyCoarse(vec3(1.f)); +} + +@fragment +fn fragment_main() { + dpdyCoarse_ae1873(); +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c41f57fd92 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdyCoarse_ae1873() { + float3 res = ddy_coarse((1.0f).xxx); +} + +void fragment_main() { + dpdyCoarse_ae1873(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c41f57fd92 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdyCoarse_ae1873() { + float3 res = ddy_coarse((1.0f).xxx); +} + +void fragment_main() { + dpdyCoarse_ae1873(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.glsl new file mode 100644 index 0000000000..71426cdc29 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_ae1873() { + vec3 res = dFdy(vec3(1.0f)); +} + +void fragment_main() { + dpdyCoarse_ae1873(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.msl new file mode 100644 index 0000000000..2cb000fc10 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdyCoarse_ae1873() { + float3 res = dfdy(float3(1.0f)); +} + +fragment void fragment_main() { + dpdyCoarse_ae1873(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.spvasm new file mode 100644 index 0000000000..518e4e2730 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_ae1873 "dpdyCoarse_ae1873" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %12 = OpConstantNull %v3float +%dpdyCoarse_ae1873 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %12 + %5 = OpDPdyCoarse %v3float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyCoarse_ae1873 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.wgsl new file mode 100644 index 0000000000..a27742cb00 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyCoarse/ae1873.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdyCoarse_ae1873() { + var res : vec3 = dpdyCoarse(vec3(1.0f)); +} + +@fragment +fn fragment_main() { + dpdyCoarse_ae1873(); +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl new file mode 100644 index 0000000000..08bb289d0d --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(vec<3, f32>) -> vec<3, f32> +fn dpdyFine_1fb7ab() { + var res: vec3 = dpdyFine(vec3(1.f)); +} + +@fragment +fn fragment_main() { + dpdyFine_1fb7ab(); +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4bf3c52bc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdyFine_1fb7ab() { + float3 res = ddy_fine((1.0f).xxx); +} + +void fragment_main() { + dpdyFine_1fb7ab(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bf3c52bc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdyFine_1fb7ab() { + float3 res = ddy_fine((1.0f).xxx); +} + +void fragment_main() { + dpdyFine_1fb7ab(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.glsl new file mode 100644 index 0000000000..5e56f781b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdyFine_1fb7ab() { + vec3 res = dFdy(vec3(1.0f)); +} + +void fragment_main() { + dpdyFine_1fb7ab(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.msl new file mode 100644 index 0000000000..6152568263 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdyFine_1fb7ab() { + float3 res = dfdy(float3(1.0f)); +} + +fragment void fragment_main() { + dpdyFine_1fb7ab(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.spvasm new file mode 100644 index 0000000000..e417bb6882 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_1fb7ab "dpdyFine_1fb7ab" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %12 = OpConstantNull %v3float +%dpdyFine_1fb7ab = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %12 + %5 = OpDPdyFine %v3float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyFine_1fb7ab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8072552cc --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/1fb7ab.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdyFine_1fb7ab() { + var res : vec3 = dpdyFine(vec3(1.0f)); +} + +@fragment +fn fragment_main() { + dpdyFine_1fb7ab(); +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl new file mode 100644 index 0000000000..5441354cf5 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(f32) -> f32 +fn dpdyFine_6eb673() { + var res: f32 = dpdyFine(1.f); +} + +@fragment +fn fragment_main() { + dpdyFine_6eb673(); +} diff --git a/test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b16f5d19b --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdyFine_6eb673() { + float res = ddy_fine(1.0f); +} + +void fragment_main() { + dpdyFine_6eb673(); + return; +} diff --git a/test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.msl rename to test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.msl diff --git a/test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/dpdyFine/6eb673.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.wgsl new file mode 100644 index 0000000000..4580d6a9a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/6eb673.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdyFine_6eb673() { + var res : f32 = dpdyFine(1.0f); +} + +@fragment +fn fragment_main() { + dpdyFine_6eb673(); +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl new file mode 100644 index 0000000000..ba1bd55c29 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(vec<4, f32>) -> vec<4, f32> +fn dpdyFine_d0a648() { + var res: vec4 = dpdyFine(vec4(1.f)); +} + +@fragment +fn fragment_main() { + dpdyFine_d0a648(); +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b1ec8cdf94 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdyFine_d0a648() { + float4 res = ddy_fine((1.0f).xxxx); +} + +void fragment_main() { + dpdyFine_d0a648(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1ec8cdf94 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdyFine_d0a648() { + float4 res = ddy_fine((1.0f).xxxx); +} + +void fragment_main() { + dpdyFine_d0a648(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.glsl new file mode 100644 index 0000000000..f074753250 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdyFine_d0a648() { + vec4 res = dFdy(vec4(1.0f)); +} + +void fragment_main() { + dpdyFine_d0a648(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.msl new file mode 100644 index 0000000000..ac690075a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdyFine_d0a648() { + float4 res = dfdy(float4(1.0f)); +} + +fragment void fragment_main() { + dpdyFine_d0a648(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.spvasm new file mode 100644 index 0000000000..44751d0558 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_d0a648 "dpdyFine_d0a648" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %12 = OpConstantNull %v4float +%dpdyFine_d0a648 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %12 + %5 = OpDPdyFine %v4float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyFine_d0a648 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.wgsl new file mode 100644 index 0000000000..4c8796f402 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/d0a648.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdyFine_d0a648() { + var res : vec4 = dpdyFine(vec4(1.0f)); +} + +@fragment +fn fragment_main() { + dpdyFine_d0a648(); +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl new file mode 100644 index 0000000000..fdf2d98e6b --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(vec<2, f32>) -> vec<2, f32> +fn dpdyFine_df33aa() { + var res: vec2 = dpdyFine(vec2(1.f)); +} + +@fragment +fn fragment_main() { + dpdyFine_df33aa(); +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7ad2997f17 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void dpdyFine_df33aa() { + float2 res = ddy_fine((1.0f).xx); +} + +void fragment_main() { + dpdyFine_df33aa(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7ad2997f17 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void dpdyFine_df33aa() { + float2 res = ddy_fine((1.0f).xx); +} + +void fragment_main() { + dpdyFine_df33aa(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.glsl b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.glsl new file mode 100644 index 0000000000..502d6aac69 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void dpdyFine_df33aa() { + vec2 res = dFdy(vec2(1.0f)); +} + +void fragment_main() { + dpdyFine_df33aa(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.msl b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.msl new file mode 100644 index 0000000000..2685b93499 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void dpdyFine_df33aa() { + float2 res = dfdy(float2(1.0f)); +} + +fragment void fragment_main() { + dpdyFine_df33aa(); + return; +} + diff --git a/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.spvasm new file mode 100644 index 0000000000..ad9cdf7b3e --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_df33aa "dpdyFine_df33aa" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %12 = OpConstantNull %v2float +%dpdyFine_df33aa = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %12 + %5 = OpDPdyFine %v2float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyFine_df33aa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.wgsl new file mode 100644 index 0000000000..77d8aaabf1 --- /dev/null +++ b/test/tint/builtins/gen/literal/dpdyFine/df33aa.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn dpdyFine_df33aa() { + var res : vec2 = dpdyFine(vec2(1.0f)); +} + +@fragment +fn fragment_main() { + dpdyFine_df33aa(); +} diff --git a/test/tint/builtins/gen/literal/exp/0f70eb.wgsl b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl new file mode 100644 index 0000000000..7eea3bd2bc --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(vec<4, f32>) -> vec<4, f32> +fn exp_0f70eb() { + var res: vec4 = exp(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_0f70eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_0f70eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_0f70eb(); +} diff --git a/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bfdf17dd23 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_0f70eb() { + float4 res = exp((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_0f70eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_0f70eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_0f70eb(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bfdf17dd23 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void exp_0f70eb() { + float4 res = exp((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_0f70eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_0f70eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_0f70eb(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.glsl new file mode 100644 index 0000000000..aa694a1abc --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void exp_0f70eb() { + vec4 res = exp(vec4(1.0f)); +} + +vec4 vertex_main() { + exp_0f70eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_0f70eb() { + vec4 res = exp(vec4(1.0f)); +} + +void fragment_main() { + exp_0f70eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_0f70eb() { + vec4 res = exp(vec4(1.0f)); +} + +void compute_main() { + exp_0f70eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.msl new file mode 100644 index 0000000000..51985ab520 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_0f70eb() { + float4 res = exp(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_0f70eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_0f70eb(); + return; +} + +kernel void compute_main() { + exp_0f70eb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..25e78f858e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_0f70eb "exp_0f70eb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %exp_0f70eb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Exp %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %exp_0f70eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %exp_0f70eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp_0f70eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..81aac1f24f --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/0f70eb.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn exp_0f70eb() { + var res : vec4 = exp(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_0f70eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_0f70eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_0f70eb(); +} diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl new file mode 100644 index 0000000000..04d8cc6223 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<3, f16>) -> vec<3, f16> +fn exp_13806d() { + var res: vec3 = exp(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_13806d(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_13806d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_13806d(); +} diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6d8ae98452 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_13806d() { + vector res = exp((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_13806d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_13806d(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5442169fe0 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp_13806d() { + vector res = exp((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_13806d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_13806d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F8343687E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.glsl new file mode 100644 index 0000000000..e2a7b73d87 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_13806d() { + f16vec3 res = exp(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + exp_13806d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_13806d() { + f16vec3 res = exp(f16vec3(0.0hf)); +} + +void fragment_main() { + exp_13806d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_13806d() { + f16vec3 res = exp(f16vec3(0.0hf)); +} + +void compute_main() { + exp_13806d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.msl new file mode 100644 index 0000000000..1f4af8c67b --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_13806d() { + half3 res = exp(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_13806d(); + return; +} + +kernel void compute_main() { + exp_13806d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.spvasm new file mode 100644 index 0000000000..a3679ff7f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_13806d "exp_13806d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_13806d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Exp %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp_13806d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp_13806d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp_13806d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ccb13f5f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/13806d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp_13806d() { + var res : vec3 = exp(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_13806d(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_13806d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_13806d(); +} diff --git a/test/tint/builtins/gen/literal/exp/1951e7.wgsl b/test/tint/builtins/gen/literal/exp/1951e7.wgsl new file mode 100644 index 0000000000..26c7215980 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/1951e7.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(vec<2, f32>) -> vec<2, f32> +fn exp_1951e7() { + var res: vec2 = exp(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_1951e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_1951e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_1951e7(); +} diff --git a/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..776ab24ed4 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_1951e7() { + float2 res = exp((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_1951e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_1951e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_1951e7(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..776ab24ed4 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void exp_1951e7() { + float2 res = exp((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_1951e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_1951e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_1951e7(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.glsl new file mode 100644 index 0000000000..f2bbd7cea3 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void exp_1951e7() { + vec2 res = exp(vec2(1.0f)); +} + +vec4 vertex_main() { + exp_1951e7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_1951e7() { + vec2 res = exp(vec2(1.0f)); +} + +void fragment_main() { + exp_1951e7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_1951e7() { + vec2 res = exp(vec2(1.0f)); +} + +void compute_main() { + exp_1951e7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.msl new file mode 100644 index 0000000000..f498a3e599 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_1951e7() { + float2 res = exp(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_1951e7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_1951e7(); + return; +} + +kernel void compute_main() { + exp_1951e7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.spvasm new file mode 100644 index 0000000000..adca51eb6f --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_1951e7 "exp_1951e7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %exp_1951e7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Exp %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp_1951e7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp_1951e7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp_1951e7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.wgsl new file mode 100644 index 0000000000..92784cad3e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/1951e7.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn exp_1951e7() { + var res : vec2 = exp(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_1951e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_1951e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_1951e7(); +} diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl new file mode 100644 index 0000000000..d2d1bb2579 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<2, f16>) -> vec<2, f16> +fn exp_2e08e2() { + var res: vec2 = exp(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_2e08e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_2e08e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_2e08e2(); +} diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52dca1d7a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_2e08e2() { + vector res = exp((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_2e08e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_2e08e2(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..408ebd58d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp_2e08e2() { + vector res = exp((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_2e08e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_2e08e2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E5CBC9ECC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.glsl new file mode 100644 index 0000000000..04a9c64e66 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_2e08e2() { + f16vec2 res = exp(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + exp_2e08e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_2e08e2() { + f16vec2 res = exp(f16vec2(0.0hf)); +} + +void fragment_main() { + exp_2e08e2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_2e08e2() { + f16vec2 res = exp(f16vec2(0.0hf)); +} + +void compute_main() { + exp_2e08e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.msl new file mode 100644 index 0000000000..fd0c319607 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_2e08e2() { + half2 res = exp(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_2e08e2(); + return; +} + +kernel void compute_main() { + exp_2e08e2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d11ae312d --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_2e08e2 "exp_2e08e2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_2e08e2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Exp %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp_2e08e2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp_2e08e2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp_2e08e2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..9962f0eea7 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/2e08e2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp_2e08e2() { + var res : vec2 = exp(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_2e08e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_2e08e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_2e08e2(); +} diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl new file mode 100644 index 0000000000..53ee480b1c --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<4, f16>) -> vec<4, f16> +fn exp_611a87() { + var res: vec4 = exp(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_611a87(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_611a87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_611a87(); +} diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47b6a044b0 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_611a87() { + vector res = exp((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_611a87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_611a87(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c0949d2d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp_611a87() { + vector res = exp((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_611a87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_611a87(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001865DDB0AC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.glsl new file mode 100644 index 0000000000..f5b6a25e79 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_611a87() { + f16vec4 res = exp(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + exp_611a87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_611a87() { + f16vec4 res = exp(f16vec4(0.0hf)); +} + +void fragment_main() { + exp_611a87(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_611a87() { + f16vec4 res = exp(f16vec4(0.0hf)); +} + +void compute_main() { + exp_611a87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.msl new file mode 100644 index 0000000000..32163a817c --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_611a87() { + half4 res = exp(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_611a87(); + return; +} + +kernel void compute_main() { + exp_611a87(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.spvasm new file mode 100644 index 0000000000..749740ee16 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_611a87 "exp_611a87" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_611a87 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Exp %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp_611a87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp_611a87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp_611a87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.wgsl new file mode 100644 index 0000000000..63f247c126 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/611a87.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp_611a87() { + var res : vec4 = exp(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_611a87(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_611a87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_611a87(); +} diff --git a/test/tint/builtins/gen/literal/exp/771fd2.wgsl b/test/tint/builtins/gen/literal/exp/771fd2.wgsl new file mode 100644 index 0000000000..ed6c4a08cd --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/771fd2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(f32) -> f32 +fn exp_771fd2() { + var res: f32 = exp(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_771fd2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_771fd2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_771fd2(); +} diff --git a/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..06b4392850 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_771fd2() { + float res = exp(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_771fd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_771fd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_771fd2(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..06b4392850 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void exp_771fd2() { + float res = exp(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_771fd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_771fd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_771fd2(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.glsl new file mode 100644 index 0000000000..f5c1b664d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void exp_771fd2() { + float res = exp(1.0f); +} + +vec4 vertex_main() { + exp_771fd2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_771fd2() { + float res = exp(1.0f); +} + +void fragment_main() { + exp_771fd2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_771fd2() { + float res = exp(1.0f); +} + +void compute_main() { + exp_771fd2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.msl new file mode 100644 index 0000000000..a2910064e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_771fd2() { + float res = exp(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_771fd2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_771fd2(); + return; +} + +kernel void compute_main() { + exp_771fd2(); + return; +} + diff --git a/test/tint/builtins/gen/exp/771fd2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/exp/771fd2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ce7fdd9c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/771fd2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn exp_771fd2() { + var res : f32 = exp(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_771fd2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_771fd2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_771fd2(); +} diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl new file mode 100644 index 0000000000..6572643472 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(f16) -> f16 +fn exp_c18fe9() { + var res: f16 = exp(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_c18fe9(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_c18fe9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_c18fe9(); +} diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..03ed79f373 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_c18fe9() { + float16_t res = exp(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_c18fe9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_c18fe9(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..58c57376b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void exp_c18fe9() { + float16_t res = exp(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_c18fe9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_c18fe9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000189289FB7F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000189289FB7F0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.glsl new file mode 100644 index 0000000000..a937a441ba --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_c18fe9() { + float16_t res = exp(0.0hf); +} + +vec4 vertex_main() { + exp_c18fe9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_c18fe9() { + float16_t res = exp(0.0hf); +} + +void fragment_main() { + exp_c18fe9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_c18fe9() { + float16_t res = exp(0.0hf); +} + +void compute_main() { + exp_c18fe9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.msl new file mode 100644 index 0000000000..d933e7b2c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_c18fe9() { + half res = exp(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_c18fe9(); + return; +} + +kernel void compute_main() { + exp_c18fe9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.spvasm new file mode 100644 index 0000000000..050b62d463 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_c18fe9 "exp_c18fe9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_c18fe9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Exp %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %exp_c18fe9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp_c18fe9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_c18fe9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2dec578bf --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/c18fe9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp_c18fe9() { + var res : f16 = exp(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_c18fe9(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_c18fe9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_c18fe9(); +} diff --git a/test/tint/builtins/gen/literal/exp/d98450.wgsl b/test/tint/builtins/gen/literal/exp/d98450.wgsl new file mode 100644 index 0000000000..fa459220a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/d98450.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(vec<3, f32>) -> vec<3, f32> +fn exp_d98450() { + var res: vec3 = exp(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_d98450(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_d98450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_d98450(); +} diff --git a/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a95aa4adb0 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp_d98450() { + float3 res = exp((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_d98450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_d98450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_d98450(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a95aa4adb0 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void exp_d98450() { + float3 res = exp((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_d98450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_d98450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_d98450(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.glsl new file mode 100644 index 0000000000..ded17bf9ed --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void exp_d98450() { + vec3 res = exp(vec3(1.0f)); +} + +vec4 vertex_main() { + exp_d98450(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_d98450() { + vec3 res = exp(vec3(1.0f)); +} + +void fragment_main() { + exp_d98450(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_d98450() { + vec3 res = exp(vec3(1.0f)); +} + +void compute_main() { + exp_d98450(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.msl new file mode 100644 index 0000000000..7671076f92 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp_d98450() { + float3 res = exp(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_d98450(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_d98450(); + return; +} + +kernel void compute_main() { + exp_d98450(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.spvasm new file mode 100644 index 0000000000..0cbf6acde7 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_d98450 "exp_d98450" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %exp_d98450 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Exp %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp_d98450 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp_d98450 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp_d98450 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec3ce916b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp/d98450.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn exp_d98450() { + var res : vec3 = exp(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_d98450(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_d98450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_d98450(); +} diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl new file mode 100644 index 0000000000..104c4bbce7 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<2, f16>) -> vec<2, f16> +fn exp2_151a4c() { + var res: vec2 = exp2(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_151a4c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_151a4c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_151a4c(); +} diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a205613449 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_151a4c() { + vector res = exp2((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_151a4c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_151a4c(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..88d2e16be4 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp2_151a4c() { + vector res = exp2((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_151a4c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_151a4c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D4AAF5DCB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.glsl new file mode 100644 index 0000000000..78394dc70e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_151a4c() { + f16vec2 res = exp2(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + exp2_151a4c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_151a4c() { + f16vec2 res = exp2(f16vec2(0.0hf)); +} + +void fragment_main() { + exp2_151a4c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_151a4c() { + f16vec2 res = exp2(f16vec2(0.0hf)); +} + +void compute_main() { + exp2_151a4c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.msl new file mode 100644 index 0000000000..e8e65eaf8e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_151a4c() { + half2 res = exp2(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_151a4c(); + return; +} + +kernel void compute_main() { + exp2_151a4c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b271fa5ca --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_151a4c "exp2_151a4c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_151a4c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Exp2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp2_151a4c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp2_151a4c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp2_151a4c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.wgsl new file mode 100644 index 0000000000..698ac46724 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/151a4c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp2_151a4c() { + var res : vec2 = exp2(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_151a4c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_151a4c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_151a4c(); +} diff --git a/test/tint/builtins/gen/literal/exp2/1f8680.wgsl b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl new file mode 100644 index 0000000000..b345fada33 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(vec<3, f32>) -> vec<3, f32> +fn exp2_1f8680() { + var res: vec3 = exp2(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_1f8680(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_1f8680(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_1f8680(); +} diff --git a/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..398883207e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_1f8680() { + float3 res = exp2((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_1f8680(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_1f8680(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_1f8680(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..398883207e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void exp2_1f8680() { + float3 res = exp2((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_1f8680(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_1f8680(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_1f8680(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.glsl new file mode 100644 index 0000000000..a92cdd81cc --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void exp2_1f8680() { + vec3 res = exp2(vec3(1.0f)); +} + +vec4 vertex_main() { + exp2_1f8680(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_1f8680() { + vec3 res = exp2(vec3(1.0f)); +} + +void fragment_main() { + exp2_1f8680(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_1f8680() { + vec3 res = exp2(vec3(1.0f)); +} + +void compute_main() { + exp2_1f8680(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.msl new file mode 100644 index 0000000000..04fd287379 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_1f8680() { + float3 res = exp2(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_1f8680(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_1f8680(); + return; +} + +kernel void compute_main() { + exp2_1f8680(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.spvasm new file mode 100644 index 0000000000..87378ba895 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_1f8680 "exp2_1f8680" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%exp2_1f8680 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Exp2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp2_1f8680 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp2_1f8680 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp2_1f8680 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.wgsl new file mode 100644 index 0000000000..d2e3c7471b --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/1f8680.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn exp2_1f8680() { + var res : vec3 = exp2(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_1f8680(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_1f8680(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_1f8680(); +} diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl new file mode 100644 index 0000000000..790a5b1cac --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<3, f16>) -> vec<3, f16> +fn exp2_751377() { + var res: vec3 = exp2(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_751377(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_751377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_751377(); +} diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46be6259bb --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_751377() { + vector res = exp2((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_751377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_751377(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b4aa1cdce8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp2_751377() { + vector res = exp2((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_751377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_751377(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023A7CDE1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.glsl new file mode 100644 index 0000000000..af02e20882 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_751377() { + f16vec3 res = exp2(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + exp2_751377(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_751377() { + f16vec3 res = exp2(f16vec3(0.0hf)); +} + +void fragment_main() { + exp2_751377(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_751377() { + f16vec3 res = exp2(f16vec3(0.0hf)); +} + +void compute_main() { + exp2_751377(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.msl new file mode 100644 index 0000000000..201f1e2cdb --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_751377() { + half3 res = exp2(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_751377(); + return; +} + +kernel void compute_main() { + exp2_751377(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.spvasm new file mode 100644 index 0000000000..b255fb10de --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_751377 "exp2_751377" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_751377 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Exp2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp2_751377 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp2_751377 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp2_751377 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.wgsl new file mode 100644 index 0000000000..5730ea28b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/751377.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp2_751377() { + var res : vec3 = exp2(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_751377(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_751377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_751377(); +} diff --git a/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl new file mode 100644 index 0000000000..3e117bbaf1 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(vec<4, f32>) -> vec<4, f32> +fn exp2_a9d0a7() { + var res: vec4 = exp2(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_a9d0a7(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_a9d0a7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_a9d0a7(); +} diff --git a/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e11264258e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_a9d0a7() { + float4 res = exp2((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_a9d0a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_a9d0a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_a9d0a7(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e11264258e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void exp2_a9d0a7() { + float4 res = exp2((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_a9d0a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_a9d0a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_a9d0a7(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.glsl new file mode 100644 index 0000000000..64e9bfa914 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void exp2_a9d0a7() { + vec4 res = exp2(vec4(1.0f)); +} + +vec4 vertex_main() { + exp2_a9d0a7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_a9d0a7() { + vec4 res = exp2(vec4(1.0f)); +} + +void fragment_main() { + exp2_a9d0a7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_a9d0a7() { + vec4 res = exp2(vec4(1.0f)); +} + +void compute_main() { + exp2_a9d0a7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.msl new file mode 100644 index 0000000000..7c35eb7618 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_a9d0a7() { + float4 res = exp2(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_a9d0a7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_a9d0a7(); + return; +} + +kernel void compute_main() { + exp2_a9d0a7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.spvasm new file mode 100644 index 0000000000..21d06efdd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_a9d0a7 "exp2_a9d0a7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%exp2_a9d0a7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Exp2 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %exp2_a9d0a7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %exp2_a9d0a7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp2_a9d0a7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.wgsl new file mode 100644 index 0000000000..7224b0c27e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/a9d0a7.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn exp2_a9d0a7() { + var res : vec4 = exp2(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_a9d0a7(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_a9d0a7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_a9d0a7(); +} diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl new file mode 100644 index 0000000000..74f45c4469 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(f16) -> f16 +fn exp2_b408e4() { + var res: f16 = exp2(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_b408e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_b408e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_b408e4(); +} diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1161b51086 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_b408e4() { + float16_t res = exp2(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_b408e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_b408e4(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ed6bb8d815 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void exp2_b408e4() { + float16_t res = exp2(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_b408e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_b408e4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029A9E5D1160(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029A9E5D1160(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.glsl new file mode 100644 index 0000000000..5c041fccfc --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_b408e4() { + float16_t res = exp2(0.0hf); +} + +vec4 vertex_main() { + exp2_b408e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_b408e4() { + float16_t res = exp2(0.0hf); +} + +void fragment_main() { + exp2_b408e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_b408e4() { + float16_t res = exp2(0.0hf); +} + +void compute_main() { + exp2_b408e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.msl new file mode 100644 index 0000000000..144f5ad812 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_b408e4() { + half res = exp2(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_b408e4(); + return; +} + +kernel void compute_main() { + exp2_b408e4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.spvasm new file mode 100644 index 0000000000..00de130b01 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_b408e4 "exp2_b408e4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_b408e4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Exp2 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %exp2_b408e4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp2_b408e4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_b408e4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..65c1649034 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/b408e4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp2_b408e4() { + var res : f16 = exp2(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_b408e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_b408e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_b408e4(); +} diff --git a/test/tint/builtins/gen/literal/exp2/d6777c.wgsl b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl new file mode 100644 index 0000000000..dbf165fa71 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(vec<2, f32>) -> vec<2, f32> +fn exp2_d6777c() { + var res: vec2 = exp2(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_d6777c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_d6777c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_d6777c(); +} diff --git a/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6bec5e2446 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_d6777c() { + float2 res = exp2((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_d6777c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_d6777c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_d6777c(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6bec5e2446 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void exp2_d6777c() { + float2 res = exp2((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_d6777c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_d6777c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_d6777c(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.glsl new file mode 100644 index 0000000000..9ab3430a47 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void exp2_d6777c() { + vec2 res = exp2(vec2(1.0f)); +} + +vec4 vertex_main() { + exp2_d6777c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_d6777c() { + vec2 res = exp2(vec2(1.0f)); +} + +void fragment_main() { + exp2_d6777c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_d6777c() { + vec2 res = exp2(vec2(1.0f)); +} + +void compute_main() { + exp2_d6777c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.msl new file mode 100644 index 0000000000..befa16a257 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_d6777c() { + float2 res = exp2(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_d6777c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_d6777c(); + return; +} + +kernel void compute_main() { + exp2_d6777c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7d33f8440 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_d6777c "exp2_d6777c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%exp2_d6777c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Exp2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp2_d6777c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp2_d6777c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp2_d6777c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.wgsl new file mode 100644 index 0000000000..636bec54db --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/d6777c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn exp2_d6777c() { + var res : vec2 = exp2(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_d6777c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_d6777c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_d6777c(); +} diff --git a/test/tint/builtins/gen/literal/exp2/dea523.wgsl b/test/tint/builtins/gen/literal/exp2/dea523.wgsl new file mode 100644 index 0000000000..a6ade8f0b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/dea523.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(f32) -> f32 +fn exp2_dea523() { + var res: f32 = exp2(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_dea523(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_dea523(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_dea523(); +} diff --git a/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0a9e48bd4e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_dea523() { + float res = exp2(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_dea523(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_dea523(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_dea523(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0a9e48bd4e --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void exp2_dea523() { + float res = exp2(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_dea523(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_dea523(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_dea523(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.glsl new file mode 100644 index 0000000000..d209b719d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void exp2_dea523() { + float res = exp2(1.0f); +} + +vec4 vertex_main() { + exp2_dea523(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_dea523() { + float res = exp2(1.0f); +} + +void fragment_main() { + exp2_dea523(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_dea523() { + float res = exp2(1.0f); +} + +void compute_main() { + exp2_dea523(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.msl new file mode 100644 index 0000000000..7c86c2ab5c --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_dea523() { + float res = exp2(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_dea523(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_dea523(); + return; +} + +kernel void compute_main() { + exp2_dea523(); + return; +} + diff --git a/test/tint/builtins/gen/exp2/dea523.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/exp2/dea523.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.wgsl new file mode 100644 index 0000000000..c54cfc6f0c --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/dea523.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn exp2_dea523() { + var res : f32 = exp2(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_dea523(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_dea523(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_dea523(); +} diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl new file mode 100644 index 0000000000..4bbdb03d17 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<4, f16>) -> vec<4, f16> +fn exp2_ffa827() { + var res: vec4 = exp2(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_ffa827(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_ffa827(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_ffa827(); +} diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..744ae477b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void exp2_ffa827() { + vector res = exp2((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_ffa827(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_ffa827(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0806afcb1c --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void exp2_ffa827() { + vector res = exp2((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_ffa827(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_ffa827(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D88F07E620(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.glsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.glsl new file mode 100644 index 0000000000..960c753ecd --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_ffa827() { + f16vec4 res = exp2(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + exp2_ffa827(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_ffa827() { + f16vec4 res = exp2(f16vec4(0.0hf)); +} + +void fragment_main() { + exp2_ffa827(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_ffa827() { + f16vec4 res = exp2(f16vec4(0.0hf)); +} + +void compute_main() { + exp2_ffa827(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.msl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.msl new file mode 100644 index 0000000000..add3f5e0d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void exp2_ffa827() { + half4 res = exp2(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_ffa827(); + return; +} + +kernel void compute_main() { + exp2_ffa827(); + return; +} + diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.spvasm new file mode 100644 index 0000000000..9520e91090 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_ffa827 "exp2_ffa827" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_ffa827 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Exp2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp2_ffa827 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp2_ffa827 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp2_ffa827 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.wgsl new file mode 100644 index 0000000000..230ad07811 --- /dev/null +++ b/test/tint/builtins/gen/literal/exp2/ffa827.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn exp2_ffa827() { + var res : vec4 = exp2(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_ffa827(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_ffa827(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_ffa827(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/12b197.wgsl b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl new file mode 100644 index 0000000000..69f21acdd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<3, u32>, u32, u32) -> vec<3, u32> +fn extractBits_12b197() { + var res: vec3 = extractBits(vec3(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_12b197(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_12b197(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_12b197(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a151040739 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_12b197() { + uint3 res = tint_extract_bits((1u).xxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_12b197(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_12b197(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_12b197(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a151040739 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_12b197() { + uint3 res = tint_extract_bits((1u).xxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_12b197(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_12b197(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_12b197(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.glsl b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.glsl new file mode 100644 index 0000000000..c40ed7d31a --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_12b197() { + uvec3 res = tint_extract_bits(uvec3(1u), 1u, 1u); +} + +vec4 vertex_main() { + extractBits_12b197(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_12b197() { + uvec3 res = tint_extract_bits(uvec3(1u), 1u, 1u); +} + +void fragment_main() { + extractBits_12b197(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_12b197() { + uvec3 res = tint_extract_bits(uvec3(1u), 1u, 1u); +} + +void compute_main() { + extractBits_12b197(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.msl b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.msl new file mode 100644 index 0000000000..9a65f194c7 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_12b197() { + uint3 res = tint_extract_bits(uint3(1u), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_12b197(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_12b197(); + return; +} + +kernel void compute_main() { + extractBits_12b197(); + return; +} + diff --git a/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.spvasm new file mode 100644 index 0000000000..6edac5a59d --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_12b197 "extractBits_12b197" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %30 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %33 = OpConstantNull %v3uint + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldUExtract %v3uint %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_12b197 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %33 + %28 = OpFunctionCall %v3uint %tint_extract_bits %30 %uint_1 %uint_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %extractBits_12b197 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %extractBits_12b197 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %46 = OpLabel + %47 = OpFunctionCall %void %extractBits_12b197 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec9c1ab10b --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/12b197.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn extractBits_12b197() { + var res : vec3 = extractBits(vec3(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_12b197(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_12b197(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_12b197(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/249874.wgsl b/test/tint/builtins/gen/literal/extractBits/249874.wgsl new file mode 100644 index 0000000000..bf8c4cdbba --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/249874.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(i32, u32, u32) -> i32 +fn extractBits_249874() { + var res: i32 = extractBits(1, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_249874(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_249874(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_249874(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..870063d1cf --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +int tint_extract_bits(int v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_249874() { + int res = tint_extract_bits(1, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_249874(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_249874(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_249874(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..870063d1cf --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +int tint_extract_bits(int v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_249874() { + int res = tint_extract_bits(1, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_249874(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_249874(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_249874(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.glsl b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.glsl new file mode 100644 index 0000000000..e0523f2f4c --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +int tint_extract_bits(int v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_249874() { + int res = tint_extract_bits(1, 1u, 1u); +} + +vec4 vertex_main() { + extractBits_249874(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_extract_bits(int v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_249874() { + int res = tint_extract_bits(1, 1u, 1u); +} + +void fragment_main() { + extractBits_249874(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_extract_bits(int v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_249874() { + int res = tint_extract_bits(1, 1u, 1u); +} + +void compute_main() { + extractBits_249874(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.msl b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.msl new file mode 100644 index 0000000000..7b3e4889ce --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +int tint_extract_bits(int v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_249874() { + int res = tint_extract_bits(1, 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_249874(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_249874(); + return; +} + +kernel void compute_main() { + extractBits_249874(); + return; +} + diff --git a/test/tint/builtins/gen/extractBits/249874.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/extractBits/249874.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.wgsl new file mode 100644 index 0000000000..7abbd3635a --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/249874.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn extractBits_249874() { + var res : i32 = extractBits(1, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_249874(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_249874(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_249874(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/631377.wgsl b/test/tint/builtins/gen/literal/extractBits/631377.wgsl new file mode 100644 index 0000000000..8143f76bc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/631377.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<4, u32>, u32, u32) -> vec<4, u32> +fn extractBits_631377() { + var res: vec4 = extractBits(vec4(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_631377(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_631377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_631377(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2b42e6a2dc --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +uint4 tint_extract_bits(uint4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_631377() { + uint4 res = tint_extract_bits((1u).xxxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_631377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_631377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_631377(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2b42e6a2dc --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +uint4 tint_extract_bits(uint4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_631377() { + uint4 res = tint_extract_bits((1u).xxxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_631377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_631377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_631377(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.glsl b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.glsl new file mode 100644 index 0000000000..b88b73bec0 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_631377() { + uvec4 res = tint_extract_bits(uvec4(1u), 1u, 1u); +} + +vec4 vertex_main() { + extractBits_631377(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_631377() { + uvec4 res = tint_extract_bits(uvec4(1u), 1u, 1u); +} + +void fragment_main() { + extractBits_631377(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_631377() { + uvec4 res = tint_extract_bits(uvec4(1u), 1u, 1u); +} + +void compute_main() { + extractBits_631377(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.msl b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.msl new file mode 100644 index 0000000000..2190ecdb82 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +uint4 tint_extract_bits(uint4 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_631377() { + uint4 res = tint_extract_bits(uint4(1u), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_631377(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_631377(); + return; +} + +kernel void compute_main() { + extractBits_631377(); + return; +} + diff --git a/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.spvasm new file mode 100644 index 0000000000..6f34fb5f22 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_631377 "extractBits_631377" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %30 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %33 = OpConstantNull %v4uint + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldUExtract %v4uint %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_631377 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %33 + %28 = OpFunctionCall %v4uint %tint_extract_bits %30 %uint_1 %uint_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %extractBits_631377 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %extractBits_631377 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %46 = OpLabel + %47 = OpFunctionCall %void %extractBits_631377 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.wgsl new file mode 100644 index 0000000000..24d0a72514 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/631377.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn extractBits_631377() { + var res : vec4 = extractBits(vec4(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_631377(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_631377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_631377(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl new file mode 100644 index 0000000000..244ece18a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<2, i32>, u32, u32) -> vec<2, i32> +fn extractBits_a99a8d() { + var res: vec2 = extractBits(vec2(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_a99a8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_a99a8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_a99a8d(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..301bcf66d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +int2 tint_extract_bits(int2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_a99a8d() { + int2 res = tint_extract_bits((1).xx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_a99a8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_a99a8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_a99a8d(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..301bcf66d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +int2 tint_extract_bits(int2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_a99a8d() { + int2 res = tint_extract_bits((1).xx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_a99a8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_a99a8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_a99a8d(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.glsl new file mode 100644 index 0000000000..fa42616ae8 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_a99a8d() { + ivec2 res = tint_extract_bits(ivec2(1), 1u, 1u); +} + +vec4 vertex_main() { + extractBits_a99a8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_a99a8d() { + ivec2 res = tint_extract_bits(ivec2(1), 1u, 1u); +} + +void fragment_main() { + extractBits_a99a8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_a99a8d() { + ivec2 res = tint_extract_bits(ivec2(1), 1u, 1u); +} + +void compute_main() { + extractBits_a99a8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.msl b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.msl new file mode 100644 index 0000000000..915b684e7c --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +int2 tint_extract_bits(int2 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_a99a8d() { + int2 res = tint_extract_bits(int2(1), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_a99a8d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_a99a8d(); + return; +} + +kernel void compute_main() { + extractBits_a99a8d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f66972aac --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_a99a8d "extractBits_a99a8d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v2int %v2int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %31 = OpConstantComposite %v2int %int_1 %int_1 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %35 = OpConstantNull %v2int + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldSExtract %v2int %v %18 %24 + OpReturnValue %23 + OpFunctionEnd +%extractBits_a99a8d = OpFunction %void None %25 + %28 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %35 + %29 = OpFunctionCall %v2int %tint_extract_bits %31 %uint_1 %uint_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %extractBits_a99a8d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %45 = OpLabel + %46 = OpFunctionCall %void %extractBits_a99a8d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %48 = OpLabel + %49 = OpFunctionCall %void %extractBits_a99a8d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..17c6f49300 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/a99a8d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn extractBits_a99a8d() { + var res : vec2 = extractBits(vec2(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_a99a8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_a99a8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_a99a8d(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl new file mode 100644 index 0000000000..7bed3b96e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(u32, u32, u32) -> u32 +fn extractBits_ce81f8() { + var res: u32 = extractBits(1u, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_ce81f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_ce81f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_ce81f8(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95e631eb7e --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +uint tint_extract_bits(uint v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_ce81f8() { + uint res = tint_extract_bits(1u, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_ce81f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_ce81f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_ce81f8(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95e631eb7e --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +uint tint_extract_bits(uint v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_ce81f8() { + uint res = tint_extract_bits(1u, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_ce81f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_ce81f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_ce81f8(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.glsl new file mode 100644 index 0000000000..814cdc18dd --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uint tint_extract_bits(uint v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_ce81f8() { + uint res = tint_extract_bits(1u, 1u, 1u); +} + +vec4 vertex_main() { + extractBits_ce81f8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_extract_bits(uint v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_ce81f8() { + uint res = tint_extract_bits(1u, 1u, 1u); +} + +void fragment_main() { + extractBits_ce81f8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_extract_bits(uint v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_ce81f8() { + uint res = tint_extract_bits(1u, 1u, 1u); +} + +void compute_main() { + extractBits_ce81f8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.msl b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.msl new file mode 100644 index 0000000000..dfa4102c13 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +uint tint_extract_bits(uint v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_ce81f8() { + uint res = tint_extract_bits(1u, 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_ce81f8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_ce81f8(); + return; +} + +kernel void compute_main() { + extractBits_ce81f8(); + return; +} + diff --git a/test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/extractBits/ce81f8.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.wgsl new file mode 100644 index 0000000000..69137f286a --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/ce81f8.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn extractBits_ce81f8() { + var res : u32 = extractBits(1u, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_ce81f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_ce81f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_ce81f8(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl new file mode 100644 index 0000000000..2cc23a3af7 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<3, i32>, u32, u32) -> vec<3, i32> +fn extractBits_e04f5d() { + var res: vec3 = extractBits(vec3(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_e04f5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_e04f5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_e04f5d(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d140d24b36 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +int3 tint_extract_bits(int3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_e04f5d() { + int3 res = tint_extract_bits((1).xxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_e04f5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_e04f5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_e04f5d(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d140d24b36 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +int3 tint_extract_bits(int3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_e04f5d() { + int3 res = tint_extract_bits((1).xxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_e04f5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_e04f5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_e04f5d(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.glsl new file mode 100644 index 0000000000..de21ca0092 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_e04f5d() { + ivec3 res = tint_extract_bits(ivec3(1), 1u, 1u); +} + +vec4 vertex_main() { + extractBits_e04f5d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_e04f5d() { + ivec3 res = tint_extract_bits(ivec3(1), 1u, 1u); +} + +void fragment_main() { + extractBits_e04f5d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_e04f5d() { + ivec3 res = tint_extract_bits(ivec3(1), 1u, 1u); +} + +void compute_main() { + extractBits_e04f5d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.msl b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.msl new file mode 100644 index 0000000000..c3a46730e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +int3 tint_extract_bits(int3 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_e04f5d() { + int3 res = tint_extract_bits(int3(1), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_e04f5d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_e04f5d(); + return; +} + +kernel void compute_main() { + extractBits_e04f5d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.spvasm new file mode 100644 index 0000000000..043e515032 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_e04f5d "extractBits_e04f5d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v3int %v3int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %31 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %35 = OpConstantNull %v3int + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldSExtract %v3int %v %18 %24 + OpReturnValue %23 + OpFunctionEnd +%extractBits_e04f5d = OpFunction %void None %25 + %28 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %35 + %29 = OpFunctionCall %v3int %tint_extract_bits %31 %uint_1 %uint_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %extractBits_e04f5d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %45 = OpLabel + %46 = OpFunctionCall %void %extractBits_e04f5d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %48 = OpLabel + %49 = OpFunctionCall %void %extractBits_e04f5d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.wgsl new file mode 100644 index 0000000000..73a0526b23 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/e04f5d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn extractBits_e04f5d() { + var res : vec3 = extractBits(vec3(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_e04f5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_e04f5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_e04f5d(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl new file mode 100644 index 0000000000..db73c01c1a --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<2, u32>, u32, u32) -> vec<2, u32> +fn extractBits_f28f69() { + var res: vec2 = extractBits(vec2(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_f28f69(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_f28f69(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_f28f69(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2b1ac94265 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +uint2 tint_extract_bits(uint2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_f28f69() { + uint2 res = tint_extract_bits((1u).xx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_f28f69(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_f28f69(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_f28f69(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2b1ac94265 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +uint2 tint_extract_bits(uint2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_f28f69() { + uint2 res = tint_extract_bits((1u).xx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_f28f69(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_f28f69(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_f28f69(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.glsl b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.glsl new file mode 100644 index 0000000000..79a6a6cf07 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_f28f69() { + uvec2 res = tint_extract_bits(uvec2(1u), 1u, 1u); +} + +vec4 vertex_main() { + extractBits_f28f69(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_f28f69() { + uvec2 res = tint_extract_bits(uvec2(1u), 1u, 1u); +} + +void fragment_main() { + extractBits_f28f69(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_f28f69() { + uvec2 res = tint_extract_bits(uvec2(1u), 1u, 1u); +} + +void compute_main() { + extractBits_f28f69(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.msl b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.msl new file mode 100644 index 0000000000..f16211a3c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +uint2 tint_extract_bits(uint2 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_f28f69() { + uint2 res = tint_extract_bits(uint2(1u), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_f28f69(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_f28f69(); + return; +} + +kernel void compute_main() { + extractBits_f28f69(); + return; +} + diff --git a/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.spvasm new file mode 100644 index 0000000000..c1279b113d --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_f28f69 "extractBits_f28f69" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %30 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %33 = OpConstantNull %v2uint + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldUExtract %v2uint %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_f28f69 = OpFunction %void None %24 + %27 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %33 + %28 = OpFunctionCall %v2uint %tint_extract_bits %30 %uint_1 %uint_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %extractBits_f28f69 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %43 = OpLabel + %44 = OpFunctionCall %void %extractBits_f28f69 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %46 = OpLabel + %47 = OpFunctionCall %void %extractBits_f28f69 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2e8d7205b --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/f28f69.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn extractBits_f28f69() { + var res : vec2 = extractBits(vec2(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_f28f69(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_f28f69(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_f28f69(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl new file mode 100644 index 0000000000..ab7ac0faaa --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<4, i32>, u32, u32) -> vec<4, i32> +fn extractBits_fb850f() { + var res: vec4 = extractBits(vec4(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_fb850f(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_fb850f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_fb850f(); +} diff --git a/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..249b9aaeb6 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +int4 tint_extract_bits(int4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_fb850f() { + int4 res = tint_extract_bits((1).xxxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_fb850f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_fb850f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_fb850f(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..249b9aaeb6 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +int4 tint_extract_bits(int4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_fb850f() { + int4 res = tint_extract_bits((1).xxxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_fb850f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_fb850f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_fb850f(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.glsl new file mode 100644 index 0000000000..e075fcd326 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_fb850f() { + ivec4 res = tint_extract_bits(ivec4(1), 1u, 1u); +} + +vec4 vertex_main() { + extractBits_fb850f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_fb850f() { + ivec4 res = tint_extract_bits(ivec4(1), 1u, 1u); +} + +void fragment_main() { + extractBits_fb850f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_fb850f() { + ivec4 res = tint_extract_bits(ivec4(1), 1u, 1u); +} + +void compute_main() { + extractBits_fb850f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.msl b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.msl new file mode 100644 index 0000000000..db0c9065df --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +int4 tint_extract_bits(int4 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_fb850f() { + int4 res = tint_extract_bits(int4(1), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_fb850f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_fb850f(); + return; +} + +kernel void compute_main() { + extractBits_fb850f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.spvasm new file mode 100644 index 0000000000..99cc4e4ea1 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_fb850f "extractBits_fb850f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v4int %v4int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %31 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %35 = OpConstantNull %v4int + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldSExtract %v4int %v %18 %24 + OpReturnValue %23 + OpFunctionEnd +%extractBits_fb850f = OpFunction %void None %25 + %28 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %35 + %29 = OpFunctionCall %v4int %tint_extract_bits %31 %uint_1 %uint_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %extractBits_fb850f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %45 = OpLabel + %46 = OpFunctionCall %void %extractBits_fb850f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %48 = OpLabel + %49 = OpFunctionCall %void %extractBits_fb850f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.wgsl new file mode 100644 index 0000000000..33f8b70d97 --- /dev/null +++ b/test/tint/builtins/gen/literal/extractBits/fb850f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn extractBits_fb850f() { + var res : vec4 = extractBits(vec4(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_fb850f(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_fb850f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_fb850f(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl new file mode 100644 index 0000000000..b790070087 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn faceForward_524986() { + var res: vec3 = faceForward(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_524986(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_524986(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_524986(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9ff2727b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_524986() { + vector res = faceforward((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_524986(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_524986(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d7c9b48080 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void faceForward_524986() { + vector res = faceforward((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_524986(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_524986(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E4AB906E90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.glsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.glsl new file mode 100644 index 0000000000..7f2224323f --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_524986() { + f16vec3 res = faceforward(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + faceForward_524986(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_524986() { + f16vec3 res = faceforward(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + faceForward_524986(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_524986() { + f16vec3 res = faceforward(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + faceForward_524986(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.msl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.msl new file mode 100644 index 0000000000..39be077b6e --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void faceForward_524986() { + half3 res = faceforward(half3(0.0h), half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_524986(); + return; +} + +kernel void compute_main() { + faceForward_524986(); + return; +} + diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.spvasm new file mode 100644 index 0000000000..e9ff4a62c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_524986 "faceForward_524986" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_524986 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 FaceForward %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %faceForward_524986 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_524986 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %faceForward_524986 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c4ec2bcb4 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/524986.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn faceForward_524986() { + var res : vec3 = faceForward(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_524986(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_524986(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_524986(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl new file mode 100644 index 0000000000..d106529f79 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn faceForward(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn faceForward_5afbd5() { + var res: vec3 = faceForward(vec3(1.f), vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_5afbd5(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_5afbd5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_5afbd5(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c5d01ddccc --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_5afbd5() { + float3 res = faceforward((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_5afbd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_5afbd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_5afbd5(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c5d01ddccc --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_5afbd5() { + float3 res = faceforward((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_5afbd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_5afbd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_5afbd5(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.glsl new file mode 100644 index 0000000000..ffec67141c --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void faceForward_5afbd5() { + vec3 res = faceforward(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + faceForward_5afbd5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void faceForward_5afbd5() { + vec3 res = faceforward(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + faceForward_5afbd5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void faceForward_5afbd5() { + vec3 res = faceforward(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + faceForward_5afbd5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.msl b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.msl new file mode 100644 index 0000000000..baddc993f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void faceForward_5afbd5() { + float3 res = faceforward(float3(1.0f), float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_5afbd5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_5afbd5(); + return; +} + +kernel void compute_main() { + faceForward_5afbd5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.spvasm new file mode 100644 index 0000000000..de3affd3c7 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_5afbd5 "faceForward_5afbd5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%faceForward_5afbd5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 FaceForward %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %faceForward_5afbd5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_5afbd5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %faceForward_5afbd5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e3a582cf5 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/5afbd5.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn faceForward_5afbd5() { + var res : vec3 = faceForward(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_5afbd5(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_5afbd5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_5afbd5(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl new file mode 100644 index 0000000000..51136ce7c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn faceForward(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn faceForward_b316e5() { + var res: vec4 = faceForward(vec4(1.f), vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_b316e5(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_b316e5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_b316e5(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ffe25eebf2 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_b316e5() { + float4 res = faceforward((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_b316e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_b316e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_b316e5(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ffe25eebf2 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_b316e5() { + float4 res = faceforward((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_b316e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_b316e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_b316e5(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.glsl new file mode 100644 index 0000000000..1055f4788f --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void faceForward_b316e5() { + vec4 res = faceforward(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + faceForward_b316e5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void faceForward_b316e5() { + vec4 res = faceforward(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + faceForward_b316e5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void faceForward_b316e5() { + vec4 res = faceforward(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + faceForward_b316e5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.msl b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.msl new file mode 100644 index 0000000000..cc1e74c8bb --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void faceForward_b316e5() { + float4 res = faceforward(float4(1.0f), float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_b316e5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_b316e5(); + return; +} + +kernel void compute_main() { + faceForward_b316e5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.spvasm new file mode 100644 index 0000000000..ffd46e2249 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_b316e5 "faceForward_b316e5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%faceForward_b316e5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 FaceForward %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %faceForward_b316e5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %faceForward_b316e5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %faceForward_b316e5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6efdfc463 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/b316e5.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn faceForward_b316e5() { + var res : vec4 = faceForward(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_b316e5(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_b316e5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_b316e5(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl new file mode 100644 index 0000000000..fb1dcfb4a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn faceForward_cc63dc() { + var res: vec4 = faceForward(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_cc63dc(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_cc63dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_cc63dc(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b59f3b0d92 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_cc63dc() { + vector res = faceforward((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_cc63dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_cc63dc(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b33b557d7a --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void faceForward_cc63dc() { + vector res = faceforward((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_cc63dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_cc63dc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029C52499560(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.glsl new file mode 100644 index 0000000000..ab00ae17f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_cc63dc() { + f16vec4 res = faceforward(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + faceForward_cc63dc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_cc63dc() { + f16vec4 res = faceforward(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + faceForward_cc63dc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_cc63dc() { + f16vec4 res = faceforward(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + faceForward_cc63dc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.msl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.msl new file mode 100644 index 0000000000..982ab0a85e --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void faceForward_cc63dc() { + half4 res = faceforward(half4(0.0h), half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_cc63dc(); + return; +} + +kernel void compute_main() { + faceForward_cc63dc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.spvasm new file mode 100644 index 0000000000..bfa79fb729 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_cc63dc "faceForward_cc63dc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_cc63dc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 FaceForward %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %faceForward_cc63dc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_cc63dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %faceForward_cc63dc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fca87128c --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/cc63dc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn faceForward_cc63dc() { + var res : vec4 = faceForward(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_cc63dc(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_cc63dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_cc63dc(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl new file mode 100644 index 0000000000..cb3b447cb8 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn faceForward(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn faceForward_e6908b() { + var res: vec2 = faceForward(vec2(1.f), vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_e6908b(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_e6908b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_e6908b(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..82a14e79f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_e6908b() { + float2 res = faceforward((1.0f).xx, (1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_e6908b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_e6908b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_e6908b(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..82a14e79f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_e6908b() { + float2 res = faceforward((1.0f).xx, (1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_e6908b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_e6908b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_e6908b(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.glsl new file mode 100644 index 0000000000..78a59cca7b --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void faceForward_e6908b() { + vec2 res = faceforward(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + faceForward_e6908b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void faceForward_e6908b() { + vec2 res = faceforward(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + faceForward_e6908b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void faceForward_e6908b() { + vec2 res = faceforward(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + faceForward_e6908b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.msl b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.msl new file mode 100644 index 0000000000..db005d9004 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void faceForward_e6908b() { + float2 res = faceforward(float2(1.0f), float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_e6908b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_e6908b(); + return; +} + +kernel void compute_main() { + faceForward_e6908b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e1293d69d --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_e6908b "faceForward_e6908b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%faceForward_e6908b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 FaceForward %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %faceForward_e6908b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_e6908b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %faceForward_e6908b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee21409bcd --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/e6908b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn faceForward_e6908b() { + var res : vec2 = faceForward(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_e6908b(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_e6908b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_e6908b(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl new file mode 100644 index 0000000000..bf8db4f6d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn faceForward_fb0f2e() { + var res: vec2 = faceForward(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_fb0f2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_fb0f2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_fb0f2e(); +} diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a4205ab370 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void faceForward_fb0f2e() { + vector res = faceforward((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_fb0f2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_fb0f2e(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b647bd257 --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void faceForward_fb0f2e() { + vector res = faceforward((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_fb0f2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_fb0f2e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000153714C6E90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.glsl new file mode 100644 index 0000000000..6682c02cda --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_fb0f2e() { + f16vec2 res = faceforward(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + faceForward_fb0f2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_fb0f2e() { + f16vec2 res = faceforward(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + faceForward_fb0f2e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_fb0f2e() { + f16vec2 res = faceforward(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + faceForward_fb0f2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.msl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.msl new file mode 100644 index 0000000000..9c07359dab --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void faceForward_fb0f2e() { + half2 res = faceforward(half2(0.0h), half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_fb0f2e(); + return; +} + +kernel void compute_main() { + faceForward_fb0f2e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.spvasm new file mode 100644 index 0000000000..20da05411e --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_fb0f2e "faceForward_fb0f2e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_fb0f2e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 FaceForward %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %faceForward_fb0f2e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_fb0f2e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %faceForward_fb0f2e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..96b39add4a --- /dev/null +++ b/test/tint/builtins/gen/literal/faceForward/fb0f2e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn faceForward_fb0f2e() { + var res : vec2 = faceForward(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_fb0f2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_fb0f2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_fb0f2e(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl new file mode 100644 index 0000000000..3890e8e44c --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<4, u32>) -> vec<4, u32> +fn firstLeadingBit_000ff3() { + var res: vec4 = firstLeadingBit(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_000ff3(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_000ff3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_000ff3(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2dceabafc --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint4 tint_first_leading_bit(uint4 v) { + uint4 x = v; + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uint4 res = tint_first_leading_bit((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_000ff3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_000ff3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_000ff3(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2dceabafc --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint4 tint_first_leading_bit(uint4 v) { + uint4 x = v; + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uint4 res = tint_first_leading_bit((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_000ff3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_000ff3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_000ff3(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.glsl new file mode 100644 index 0000000000..6ba5463099 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec4 tint_first_leading_bit(uvec4 v) { + uvec4 x = v; + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uvec4 res = tint_first_leading_bit(uvec4(1u)); +} + +vec4 vertex_main() { + firstLeadingBit_000ff3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_first_leading_bit(uvec4 v) { + uvec4 x = v; + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uvec4 res = tint_first_leading_bit(uvec4(1u)); +} + +void fragment_main() { + firstLeadingBit_000ff3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_first_leading_bit(uvec4 v) { + uvec4 x = v; + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uvec4 res = tint_first_leading_bit(uvec4(1u)); +} + +void compute_main() { + firstLeadingBit_000ff3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.msl new file mode 100644 index 0000000000..45a5d2bde7 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +uint4 tint_first_leading_bit(uint4 v) { + uint4 x = v; + uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uint4 res = tint_first_leading_bit(uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_000ff3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_000ff3(); + return; +} + +kernel void compute_main() { + firstLeadingBit_000ff3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.spvasm new file mode 100644 index 0000000000..8b00728127 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_000ff3 "firstLeadingBit_000ff3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %17 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%uint_4294901760 = OpConstant %uint 4294901760 + %24 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %34 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %37 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %44 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %54 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %57 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %70 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %77 = OpTypeFunction %void + %83 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %17 + OpStore %x %v + %22 = OpLoad %v4uint %x + %25 = OpBitwiseAnd %v4uint %22 %24 + %19 = OpINotEqual %v4bool %25 %17 + %18 = OpSelect %v4uint %19 %27 %17 + %28 = OpLoad %v4uint %x + %29 = OpShiftRightLogical %v4uint %28 %18 + OpStore %x %29 + %32 = OpLoad %v4uint %x + %35 = OpBitwiseAnd %v4uint %32 %34 + %31 = OpINotEqual %v4bool %35 %17 + %30 = OpSelect %v4uint %31 %37 %17 + %38 = OpLoad %v4uint %x + %39 = OpShiftRightLogical %v4uint %38 %30 + OpStore %x %39 + %42 = OpLoad %v4uint %x + %45 = OpBitwiseAnd %v4uint %42 %44 + %41 = OpINotEqual %v4bool %45 %17 + %40 = OpSelect %v4uint %41 %47 %17 + %48 = OpLoad %v4uint %x + %49 = OpShiftRightLogical %v4uint %48 %40 + OpStore %x %49 + %52 = OpLoad %v4uint %x + %55 = OpBitwiseAnd %v4uint %52 %54 + %51 = OpINotEqual %v4bool %55 %17 + %50 = OpSelect %v4uint %51 %57 %17 + %58 = OpLoad %v4uint %x + %59 = OpShiftRightLogical %v4uint %58 %50 + OpStore %x %59 + %62 = OpLoad %v4uint %x + %63 = OpBitwiseAnd %v4uint %62 %57 + %61 = OpINotEqual %v4bool %63 %17 + %60 = OpSelect %v4uint %61 %65 %17 + %67 = OpLoad %v4uint %x + %68 = OpIEqual %v4bool %67 %17 + %66 = OpSelect %v4uint %68 %70 %17 + %72 = OpBitwiseOr %v4uint %18 %30 + %73 = OpBitwiseOr %v4uint %72 %40 + %74 = OpBitwiseOr %v4uint %73 %50 + %75 = OpBitwiseOr %v4uint %74 %60 + %76 = OpBitwiseOr %v4uint %75 %66 + OpReturnValue %76 + OpFunctionEnd +%firstLeadingBit_000ff3 = OpFunction %void None %77 + %80 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %17 + %81 = OpFunctionCall %v4uint %tint_first_leading_bit %65 + OpStore %res %81 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %83 + %85 = OpLabel + %86 = OpFunctionCall %void %firstLeadingBit_000ff3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %77 + %88 = OpLabel + %89 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %89 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %77 + %92 = OpLabel + %93 = OpFunctionCall %void %firstLeadingBit_000ff3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %77 + %95 = OpLabel + %96 = OpFunctionCall %void %firstLeadingBit_000ff3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.wgsl new file mode 100644 index 0000000000..01ed7cd5a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstLeadingBit_000ff3() { + var res : vec4 = firstLeadingBit(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_000ff3(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_000ff3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_000ff3(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl new file mode 100644 index 0000000000..f8524b99a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<3, i32>) -> vec<3, i32> +fn firstLeadingBit_35053e() { + var res: vec3 = firstLeadingBit(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_35053e(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_35053e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_35053e(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..24d1789b60 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int3 tint_first_leading_bit(int3 v) { + uint3 x = ((v < (0).xxx) ? uint3(~(v)) : uint3(v)); + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + int3 res = tint_first_leading_bit((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_35053e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_35053e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_35053e(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..24d1789b60 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int3 tint_first_leading_bit(int3 v) { + uint3 x = ((v < (0).xxx) ? uint3(~(v)) : uint3(v)); + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + int3 res = tint_first_leading_bit((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_35053e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_35053e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_35053e(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.glsl new file mode 100644 index 0000000000..d5eaa276c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec3 tint_first_leading_bit(ivec3 v) { + uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + ivec3 res = tint_first_leading_bit(ivec3(1)); +} + +vec4 vertex_main() { + firstLeadingBit_35053e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_first_leading_bit(ivec3 v) { + uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + ivec3 res = tint_first_leading_bit(ivec3(1)); +} + +void fragment_main() { + firstLeadingBit_35053e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_first_leading_bit(ivec3 v) { + uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + ivec3 res = tint_first_leading_bit(ivec3(1)); +} + +void compute_main() { + firstLeadingBit_35053e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.msl new file mode 100644 index 0000000000..ffaef381a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +int3 tint_first_leading_bit(int3 v) { + uint3 x = select(uint3(v), uint3(~(v)), (v < int3(0))); + uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + int3 res = tint_first_leading_bit(int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_35053e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_35053e(); + return; +} + +kernel void compute_main() { + firstLeadingBit_35053e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.spvasm new file mode 100644 index 0000000000..3fc5befb9a --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.spvasm @@ -0,0 +1,152 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 108 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_35053e "firstLeadingBit_35053e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %18 = OpConstantNull %v3int + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %27 = OpConstantNull %v3uint +%uint_4294901760 = OpConstant %uint 4294901760 + %32 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %35 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %42 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %45 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %52 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %55 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %62 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %65 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %73 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %78 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %85 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %91 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %94 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %27 + %19 = OpSLessThan %v3bool %v %18 + %23 = OpNot %v3int %v + %22 = OpBitcast %v3uint %23 + %24 = OpBitcast %v3uint %v + %15 = OpSelect %v3uint %19 %22 %24 + OpStore %x %15 + %30 = OpLoad %v3uint %x + %33 = OpBitwiseAnd %v3uint %30 %32 + %29 = OpINotEqual %v3bool %33 %27 + %28 = OpSelect %v3uint %29 %35 %27 + %36 = OpLoad %v3uint %x + %37 = OpShiftRightLogical %v3uint %36 %28 + OpStore %x %37 + %40 = OpLoad %v3uint %x + %43 = OpBitwiseAnd %v3uint %40 %42 + %39 = OpINotEqual %v3bool %43 %27 + %38 = OpSelect %v3uint %39 %45 %27 + %46 = OpLoad %v3uint %x + %47 = OpShiftRightLogical %v3uint %46 %38 + OpStore %x %47 + %50 = OpLoad %v3uint %x + %53 = OpBitwiseAnd %v3uint %50 %52 + %49 = OpINotEqual %v3bool %53 %27 + %48 = OpSelect %v3uint %49 %55 %27 + %56 = OpLoad %v3uint %x + %57 = OpShiftRightLogical %v3uint %56 %48 + OpStore %x %57 + %60 = OpLoad %v3uint %x + %63 = OpBitwiseAnd %v3uint %60 %62 + %59 = OpINotEqual %v3bool %63 %27 + %58 = OpSelect %v3uint %59 %65 %27 + %66 = OpLoad %v3uint %x + %67 = OpShiftRightLogical %v3uint %66 %58 + OpStore %x %67 + %70 = OpLoad %v3uint %x + %71 = OpBitwiseAnd %v3uint %70 %65 + %69 = OpINotEqual %v3bool %71 %27 + %68 = OpSelect %v3uint %69 %73 %27 + %75 = OpLoad %v3uint %x + %76 = OpIEqual %v3bool %75 %27 + %74 = OpSelect %v3uint %76 %78 %27 + %80 = OpBitwiseOr %v3uint %28 %38 + %81 = OpBitwiseOr %v3uint %80 %48 + %82 = OpBitwiseOr %v3uint %81 %58 + %83 = OpBitwiseOr %v3uint %82 %68 + %84 = OpBitwiseOr %v3uint %83 %74 + %79 = OpBitcast %v3int %84 + OpReturnValue %79 + OpFunctionEnd +%firstLeadingBit_35053e = OpFunction %void None %85 + %88 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %18 + %89 = OpFunctionCall %v3int %tint_first_leading_bit %91 + OpStore %res %89 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %94 + %96 = OpLabel + %97 = OpFunctionCall %void %firstLeadingBit_35053e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %85 + %99 = OpLabel + %100 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %100 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %85 + %103 = OpLabel + %104 = OpFunctionCall %void %firstLeadingBit_35053e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %85 + %106 = OpLabel + %107 = OpFunctionCall %void %firstLeadingBit_35053e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e32586741 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstLeadingBit_35053e() { + var res : vec3 = firstLeadingBit(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_35053e(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_35053e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_35053e(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl new file mode 100644 index 0000000000..54137f97c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<3, u32>) -> vec<3, u32> +fn firstLeadingBit_3fd7d0() { + var res: vec3 = firstLeadingBit(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_3fd7d0(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_3fd7d0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_3fd7d0(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9da9693375 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint3 tint_first_leading_bit(uint3 v) { + uint3 x = v; + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uint3 res = tint_first_leading_bit((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_3fd7d0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_3fd7d0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_3fd7d0(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9da9693375 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint3 tint_first_leading_bit(uint3 v) { + uint3 x = v; + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uint3 res = tint_first_leading_bit((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_3fd7d0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_3fd7d0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_3fd7d0(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.glsl new file mode 100644 index 0000000000..0924cb174a --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec3 tint_first_leading_bit(uvec3 v) { + uvec3 x = v; + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uvec3 res = tint_first_leading_bit(uvec3(1u)); +} + +vec4 vertex_main() { + firstLeadingBit_3fd7d0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_first_leading_bit(uvec3 v) { + uvec3 x = v; + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uvec3 res = tint_first_leading_bit(uvec3(1u)); +} + +void fragment_main() { + firstLeadingBit_3fd7d0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_first_leading_bit(uvec3 v) { + uvec3 x = v; + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uvec3 res = tint_first_leading_bit(uvec3(1u)); +} + +void compute_main() { + firstLeadingBit_3fd7d0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.msl new file mode 100644 index 0000000000..9ed14ecba1 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +uint3 tint_first_leading_bit(uint3 v) { + uint3 x = v; + uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uint3 res = tint_first_leading_bit(uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_3fd7d0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_3fd7d0(); + return; +} + +kernel void compute_main() { + firstLeadingBit_3fd7d0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.spvasm new file mode 100644 index 0000000000..651285ff46 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_3fd7d0 "firstLeadingBit_3fd7d0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %17 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%uint_4294901760 = OpConstant %uint 4294901760 + %24 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %34 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %37 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %44 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %54 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %57 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %70 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %77 = OpTypeFunction %void + %83 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %17 + OpStore %x %v + %22 = OpLoad %v3uint %x + %25 = OpBitwiseAnd %v3uint %22 %24 + %19 = OpINotEqual %v3bool %25 %17 + %18 = OpSelect %v3uint %19 %27 %17 + %28 = OpLoad %v3uint %x + %29 = OpShiftRightLogical %v3uint %28 %18 + OpStore %x %29 + %32 = OpLoad %v3uint %x + %35 = OpBitwiseAnd %v3uint %32 %34 + %31 = OpINotEqual %v3bool %35 %17 + %30 = OpSelect %v3uint %31 %37 %17 + %38 = OpLoad %v3uint %x + %39 = OpShiftRightLogical %v3uint %38 %30 + OpStore %x %39 + %42 = OpLoad %v3uint %x + %45 = OpBitwiseAnd %v3uint %42 %44 + %41 = OpINotEqual %v3bool %45 %17 + %40 = OpSelect %v3uint %41 %47 %17 + %48 = OpLoad %v3uint %x + %49 = OpShiftRightLogical %v3uint %48 %40 + OpStore %x %49 + %52 = OpLoad %v3uint %x + %55 = OpBitwiseAnd %v3uint %52 %54 + %51 = OpINotEqual %v3bool %55 %17 + %50 = OpSelect %v3uint %51 %57 %17 + %58 = OpLoad %v3uint %x + %59 = OpShiftRightLogical %v3uint %58 %50 + OpStore %x %59 + %62 = OpLoad %v3uint %x + %63 = OpBitwiseAnd %v3uint %62 %57 + %61 = OpINotEqual %v3bool %63 %17 + %60 = OpSelect %v3uint %61 %65 %17 + %67 = OpLoad %v3uint %x + %68 = OpIEqual %v3bool %67 %17 + %66 = OpSelect %v3uint %68 %70 %17 + %72 = OpBitwiseOr %v3uint %18 %30 + %73 = OpBitwiseOr %v3uint %72 %40 + %74 = OpBitwiseOr %v3uint %73 %50 + %75 = OpBitwiseOr %v3uint %74 %60 + %76 = OpBitwiseOr %v3uint %75 %66 + OpReturnValue %76 + OpFunctionEnd +%firstLeadingBit_3fd7d0 = OpFunction %void None %77 + %80 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %17 + %81 = OpFunctionCall %v3uint %tint_first_leading_bit %65 + OpStore %res %81 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %83 + %85 = OpLabel + %86 = OpFunctionCall %void %firstLeadingBit_3fd7d0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %77 + %88 = OpLabel + %89 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %89 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %77 + %92 = OpLabel + %93 = OpFunctionCall %void %firstLeadingBit_3fd7d0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %77 + %95 = OpLabel + %96 = OpFunctionCall %void %firstLeadingBit_3fd7d0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.wgsl new file mode 100644 index 0000000000..70d440eab1 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstLeadingBit_3fd7d0() { + var res : vec3 = firstLeadingBit(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_3fd7d0(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_3fd7d0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_3fd7d0(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl new file mode 100644 index 0000000000..afcf879bc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(i32) -> i32 +fn firstLeadingBit_57a1a3() { + var res: i32 = firstLeadingBit(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_57a1a3(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_57a1a3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_57a1a3(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..01ee3e98c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int res = tint_first_leading_bit(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_57a1a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_57a1a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_57a1a3(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01ee3e98c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int res = tint_first_leading_bit(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_57a1a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_57a1a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_57a1a3(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.glsl new file mode 100644 index 0000000000..27ce842291 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int res = tint_first_leading_bit(1); +} + +vec4 vertex_main() { + firstLeadingBit_57a1a3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int res = tint_first_leading_bit(1); +} + +void fragment_main() { + firstLeadingBit_57a1a3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int res = tint_first_leading_bit(1); +} + +void compute_main() { + firstLeadingBit_57a1a3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.msl new file mode 100644 index 0000000000..ec9b53998e --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +int tint_first_leading_bit(int v) { + uint x = select(uint(v), uint(~(v)), (v < 0)); + uint const b16 = select(0u, 16u, bool((x & 4294901760u))); + x = (x >> b16); + uint const b8 = select(0u, 8u, bool((x & 65280u))); + x = (x >> b8); + uint const b4 = select(0u, 4u, bool((x & 240u))); + x = (x >> b4); + uint const b2 = select(0u, 2u, bool((x & 12u))); + x = (x >> b2); + uint const b1 = select(0u, 1u, bool((x & 2u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int res = tint_first_leading_bit(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_57a1a3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_57a1a3(); + return; +} + +kernel void compute_main() { + firstLeadingBit_57a1a3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.spvasm new file mode 100644 index 0000000000..fea9df7622 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 94 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_57a1a3 "firstLeadingBit_57a1a3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 + %16 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpConstantNull %uint +%uint_4294901760 = OpConstant %uint 4294901760 + %uint_16 = OpConstant %uint 16 + %uint_65280 = OpConstant %uint 65280 + %uint_8 = OpConstant %uint 8 + %uint_240 = OpConstant %uint 240 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %72 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %80 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %24 + %17 = OpSLessThan %bool %v %16 + %20 = OpNot %int %v + %19 = OpBitcast %uint %20 + %21 = OpBitcast %uint %v + %14 = OpSelect %uint %17 %19 %21 + OpStore %x %14 + %27 = OpLoad %uint %x + %29 = OpBitwiseAnd %uint %27 %uint_4294901760 + %26 = OpINotEqual %bool %29 %24 + %25 = OpSelect %uint %26 %uint_16 %24 + %31 = OpLoad %uint %x + %32 = OpShiftRightLogical %uint %31 %25 + OpStore %x %32 + %35 = OpLoad %uint %x + %37 = OpBitwiseAnd %uint %35 %uint_65280 + %34 = OpINotEqual %bool %37 %24 + %33 = OpSelect %uint %34 %uint_8 %24 + %39 = OpLoad %uint %x + %40 = OpShiftRightLogical %uint %39 %33 + OpStore %x %40 + %43 = OpLoad %uint %x + %45 = OpBitwiseAnd %uint %43 %uint_240 + %42 = OpINotEqual %bool %45 %24 + %41 = OpSelect %uint %42 %uint_4 %24 + %47 = OpLoad %uint %x + %48 = OpShiftRightLogical %uint %47 %41 + OpStore %x %48 + %51 = OpLoad %uint %x + %53 = OpBitwiseAnd %uint %51 %uint_12 + %50 = OpINotEqual %bool %53 %24 + %49 = OpSelect %uint %50 %uint_2 %24 + %55 = OpLoad %uint %x + %56 = OpShiftRightLogical %uint %55 %49 + OpStore %x %56 + %59 = OpLoad %uint %x + %60 = OpBitwiseAnd %uint %59 %uint_2 + %58 = OpINotEqual %bool %60 %24 + %57 = OpSelect %uint %58 %uint_1 %24 + %63 = OpLoad %uint %x + %64 = OpIEqual %bool %63 %24 + %62 = OpSelect %uint %64 %uint_4294967295 %24 + %67 = OpBitwiseOr %uint %25 %33 + %68 = OpBitwiseOr %uint %67 %41 + %69 = OpBitwiseOr %uint %68 %49 + %70 = OpBitwiseOr %uint %69 %57 + %71 = OpBitwiseOr %uint %70 %62 + %66 = OpBitcast %int %71 + OpReturnValue %66 + OpFunctionEnd +%firstLeadingBit_57a1a3 = OpFunction %void None %72 + %75 = OpLabel + %res = OpVariable %_ptr_Function_int Function %16 + %76 = OpFunctionCall %int %tint_first_leading_bit %int_1 + OpStore %res %76 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %80 + %82 = OpLabel + %83 = OpFunctionCall %void %firstLeadingBit_57a1a3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %72 + %85 = OpLabel + %86 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %86 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %72 + %89 = OpLabel + %90 = OpFunctionCall %void %firstLeadingBit_57a1a3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %72 + %92 = OpLabel + %93 = OpFunctionCall %void %firstLeadingBit_57a1a3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.wgsl new file mode 100644 index 0000000000..e26678f779 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstLeadingBit_57a1a3() { + var res : i32 = firstLeadingBit(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_57a1a3(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_57a1a3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_57a1a3(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl new file mode 100644 index 0000000000..ca5ba6e997 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<2, u32>) -> vec<2, u32> +fn firstLeadingBit_6fe804() { + var res: vec2 = firstLeadingBit(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_6fe804(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_6fe804(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_6fe804(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc68e7617c --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint2 tint_first_leading_bit(uint2 v) { + uint2 x = v; + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uint2 res = tint_first_leading_bit((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_6fe804(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_6fe804(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_6fe804(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fc68e7617c --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint2 tint_first_leading_bit(uint2 v) { + uint2 x = v; + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uint2 res = tint_first_leading_bit((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_6fe804(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_6fe804(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_6fe804(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.glsl new file mode 100644 index 0000000000..e5c3839363 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec2 tint_first_leading_bit(uvec2 v) { + uvec2 x = v; + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uvec2 res = tint_first_leading_bit(uvec2(1u)); +} + +vec4 vertex_main() { + firstLeadingBit_6fe804(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_first_leading_bit(uvec2 v) { + uvec2 x = v; + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uvec2 res = tint_first_leading_bit(uvec2(1u)); +} + +void fragment_main() { + firstLeadingBit_6fe804(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_first_leading_bit(uvec2 v) { + uvec2 x = v; + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uvec2 res = tint_first_leading_bit(uvec2(1u)); +} + +void compute_main() { + firstLeadingBit_6fe804(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.msl new file mode 100644 index 0000000000..05d40cd87b --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +uint2 tint_first_leading_bit(uint2 v) { + uint2 x = v; + uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uint2 res = tint_first_leading_bit(uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_6fe804(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_6fe804(); + return; +} + +kernel void compute_main() { + firstLeadingBit_6fe804(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.spvasm new file mode 100644 index 0000000000..c21901191b --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_6fe804 "firstLeadingBit_6fe804" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %17 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%uint_4294901760 = OpConstant %uint 4294901760 + %24 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %34 = OpConstantComposite %v2uint %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %37 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %44 = OpConstantComposite %v2uint %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %54 = OpConstantComposite %v2uint %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %57 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %70 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %77 = OpTypeFunction %void + %83 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %17 + OpStore %x %v + %22 = OpLoad %v2uint %x + %25 = OpBitwiseAnd %v2uint %22 %24 + %19 = OpINotEqual %v2bool %25 %17 + %18 = OpSelect %v2uint %19 %27 %17 + %28 = OpLoad %v2uint %x + %29 = OpShiftRightLogical %v2uint %28 %18 + OpStore %x %29 + %32 = OpLoad %v2uint %x + %35 = OpBitwiseAnd %v2uint %32 %34 + %31 = OpINotEqual %v2bool %35 %17 + %30 = OpSelect %v2uint %31 %37 %17 + %38 = OpLoad %v2uint %x + %39 = OpShiftRightLogical %v2uint %38 %30 + OpStore %x %39 + %42 = OpLoad %v2uint %x + %45 = OpBitwiseAnd %v2uint %42 %44 + %41 = OpINotEqual %v2bool %45 %17 + %40 = OpSelect %v2uint %41 %47 %17 + %48 = OpLoad %v2uint %x + %49 = OpShiftRightLogical %v2uint %48 %40 + OpStore %x %49 + %52 = OpLoad %v2uint %x + %55 = OpBitwiseAnd %v2uint %52 %54 + %51 = OpINotEqual %v2bool %55 %17 + %50 = OpSelect %v2uint %51 %57 %17 + %58 = OpLoad %v2uint %x + %59 = OpShiftRightLogical %v2uint %58 %50 + OpStore %x %59 + %62 = OpLoad %v2uint %x + %63 = OpBitwiseAnd %v2uint %62 %57 + %61 = OpINotEqual %v2bool %63 %17 + %60 = OpSelect %v2uint %61 %65 %17 + %67 = OpLoad %v2uint %x + %68 = OpIEqual %v2bool %67 %17 + %66 = OpSelect %v2uint %68 %70 %17 + %72 = OpBitwiseOr %v2uint %18 %30 + %73 = OpBitwiseOr %v2uint %72 %40 + %74 = OpBitwiseOr %v2uint %73 %50 + %75 = OpBitwiseOr %v2uint %74 %60 + %76 = OpBitwiseOr %v2uint %75 %66 + OpReturnValue %76 + OpFunctionEnd +%firstLeadingBit_6fe804 = OpFunction %void None %77 + %80 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %17 + %81 = OpFunctionCall %v2uint %tint_first_leading_bit %65 + OpStore %res %81 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %83 + %85 = OpLabel + %86 = OpFunctionCall %void %firstLeadingBit_6fe804 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %77 + %88 = OpLabel + %89 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %89 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %77 + %92 = OpLabel + %93 = OpFunctionCall %void %firstLeadingBit_6fe804 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %77 + %95 = OpLabel + %96 = OpFunctionCall %void %firstLeadingBit_6fe804 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b5ed08634 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstLeadingBit_6fe804() { + var res : vec2 = firstLeadingBit(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_6fe804(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_6fe804(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_6fe804(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl new file mode 100644 index 0000000000..90a49df0e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<2, i32>) -> vec<2, i32> +fn firstLeadingBit_a622c2() { + var res: vec2 = firstLeadingBit(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_a622c2(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_a622c2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_a622c2(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0d14118bba --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int2 tint_first_leading_bit(int2 v) { + uint2 x = ((v < (0).xx) ? uint2(~(v)) : uint2(v)); + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + int2 res = tint_first_leading_bit((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_a622c2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_a622c2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_a622c2(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0d14118bba --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int2 tint_first_leading_bit(int2 v) { + uint2 x = ((v < (0).xx) ? uint2(~(v)) : uint2(v)); + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + int2 res = tint_first_leading_bit((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_a622c2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_a622c2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_a622c2(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.glsl new file mode 100644 index 0000000000..d08c21d37f --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec2 tint_first_leading_bit(ivec2 v) { + uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + ivec2 res = tint_first_leading_bit(ivec2(1)); +} + +vec4 vertex_main() { + firstLeadingBit_a622c2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_first_leading_bit(ivec2 v) { + uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + ivec2 res = tint_first_leading_bit(ivec2(1)); +} + +void fragment_main() { + firstLeadingBit_a622c2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_first_leading_bit(ivec2 v) { + uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + ivec2 res = tint_first_leading_bit(ivec2(1)); +} + +void compute_main() { + firstLeadingBit_a622c2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.msl new file mode 100644 index 0000000000..f037236821 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +int2 tint_first_leading_bit(int2 v) { + uint2 x = select(uint2(v), uint2(~(v)), (v < int2(0))); + uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + int2 res = tint_first_leading_bit(int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_a622c2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_a622c2(); + return; +} + +kernel void compute_main() { + firstLeadingBit_a622c2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.spvasm new file mode 100644 index 0000000000..30f881164b --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.spvasm @@ -0,0 +1,152 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 108 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_a622c2 "firstLeadingBit_a622c2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %18 = OpConstantNull %v2int + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %27 = OpConstantNull %v2uint +%uint_4294901760 = OpConstant %uint 4294901760 + %32 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %35 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %42 = OpConstantComposite %v2uint %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %45 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %52 = OpConstantComposite %v2uint %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %55 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %62 = OpConstantComposite %v2uint %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %65 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %73 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %78 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %85 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %91 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %94 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %27 + %19 = OpSLessThan %v2bool %v %18 + %23 = OpNot %v2int %v + %22 = OpBitcast %v2uint %23 + %24 = OpBitcast %v2uint %v + %15 = OpSelect %v2uint %19 %22 %24 + OpStore %x %15 + %30 = OpLoad %v2uint %x + %33 = OpBitwiseAnd %v2uint %30 %32 + %29 = OpINotEqual %v2bool %33 %27 + %28 = OpSelect %v2uint %29 %35 %27 + %36 = OpLoad %v2uint %x + %37 = OpShiftRightLogical %v2uint %36 %28 + OpStore %x %37 + %40 = OpLoad %v2uint %x + %43 = OpBitwiseAnd %v2uint %40 %42 + %39 = OpINotEqual %v2bool %43 %27 + %38 = OpSelect %v2uint %39 %45 %27 + %46 = OpLoad %v2uint %x + %47 = OpShiftRightLogical %v2uint %46 %38 + OpStore %x %47 + %50 = OpLoad %v2uint %x + %53 = OpBitwiseAnd %v2uint %50 %52 + %49 = OpINotEqual %v2bool %53 %27 + %48 = OpSelect %v2uint %49 %55 %27 + %56 = OpLoad %v2uint %x + %57 = OpShiftRightLogical %v2uint %56 %48 + OpStore %x %57 + %60 = OpLoad %v2uint %x + %63 = OpBitwiseAnd %v2uint %60 %62 + %59 = OpINotEqual %v2bool %63 %27 + %58 = OpSelect %v2uint %59 %65 %27 + %66 = OpLoad %v2uint %x + %67 = OpShiftRightLogical %v2uint %66 %58 + OpStore %x %67 + %70 = OpLoad %v2uint %x + %71 = OpBitwiseAnd %v2uint %70 %65 + %69 = OpINotEqual %v2bool %71 %27 + %68 = OpSelect %v2uint %69 %73 %27 + %75 = OpLoad %v2uint %x + %76 = OpIEqual %v2bool %75 %27 + %74 = OpSelect %v2uint %76 %78 %27 + %80 = OpBitwiseOr %v2uint %28 %38 + %81 = OpBitwiseOr %v2uint %80 %48 + %82 = OpBitwiseOr %v2uint %81 %58 + %83 = OpBitwiseOr %v2uint %82 %68 + %84 = OpBitwiseOr %v2uint %83 %74 + %79 = OpBitcast %v2int %84 + OpReturnValue %79 + OpFunctionEnd +%firstLeadingBit_a622c2 = OpFunction %void None %85 + %88 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %18 + %89 = OpFunctionCall %v2int %tint_first_leading_bit %91 + OpStore %res %89 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %94 + %96 = OpLabel + %97 = OpFunctionCall %void %firstLeadingBit_a622c2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %85 + %99 = OpLabel + %100 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %100 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %85 + %103 = OpLabel + %104 = OpFunctionCall %void %firstLeadingBit_a622c2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %85 + %106 = OpLabel + %107 = OpFunctionCall %void %firstLeadingBit_a622c2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.wgsl new file mode 100644 index 0000000000..469ca78410 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstLeadingBit_a622c2() { + var res : vec2 = firstLeadingBit(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_a622c2(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_a622c2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_a622c2(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl new file mode 100644 index 0000000000..f52b0059a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<4, i32>) -> vec<4, i32> +fn firstLeadingBit_c1f940() { + var res: vec4 = firstLeadingBit(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_c1f940(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_c1f940(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_c1f940(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0141012cbc --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int4 tint_first_leading_bit(int4 v) { + uint4 x = ((v < (0).xxxx) ? uint4(~(v)) : uint4(v)); + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + int4 res = tint_first_leading_bit((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_c1f940(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_c1f940(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_c1f940(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0141012cbc --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int4 tint_first_leading_bit(int4 v) { + uint4 x = ((v < (0).xxxx) ? uint4(~(v)) : uint4(v)); + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + int4 res = tint_first_leading_bit((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_c1f940(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_c1f940(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_c1f940(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.glsl new file mode 100644 index 0000000000..54a22fe40e --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec4 tint_first_leading_bit(ivec4 v) { + uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + ivec4 res = tint_first_leading_bit(ivec4(1)); +} + +vec4 vertex_main() { + firstLeadingBit_c1f940(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_first_leading_bit(ivec4 v) { + uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + ivec4 res = tint_first_leading_bit(ivec4(1)); +} + +void fragment_main() { + firstLeadingBit_c1f940(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_first_leading_bit(ivec4 v) { + uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + ivec4 res = tint_first_leading_bit(ivec4(1)); +} + +void compute_main() { + firstLeadingBit_c1f940(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.msl new file mode 100644 index 0000000000..dd07d58dd3 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +int4 tint_first_leading_bit(int4 v) { + uint4 x = select(uint4(v), uint4(~(v)), (v < int4(0))); + uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + int4 res = tint_first_leading_bit(int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_c1f940(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_c1f940(); + return; +} + +kernel void compute_main() { + firstLeadingBit_c1f940(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.spvasm new file mode 100644 index 0000000000..2840b3b55e --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.spvasm @@ -0,0 +1,152 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 108 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_c1f940 "firstLeadingBit_c1f940" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %18 = OpConstantNull %v4int + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %27 = OpConstantNull %v4uint +%uint_4294901760 = OpConstant %uint 4294901760 + %32 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %35 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %42 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %45 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %52 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %55 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %62 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %65 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %73 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %78 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %85 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %91 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %94 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %27 + %19 = OpSLessThan %v4bool %v %18 + %23 = OpNot %v4int %v + %22 = OpBitcast %v4uint %23 + %24 = OpBitcast %v4uint %v + %15 = OpSelect %v4uint %19 %22 %24 + OpStore %x %15 + %30 = OpLoad %v4uint %x + %33 = OpBitwiseAnd %v4uint %30 %32 + %29 = OpINotEqual %v4bool %33 %27 + %28 = OpSelect %v4uint %29 %35 %27 + %36 = OpLoad %v4uint %x + %37 = OpShiftRightLogical %v4uint %36 %28 + OpStore %x %37 + %40 = OpLoad %v4uint %x + %43 = OpBitwiseAnd %v4uint %40 %42 + %39 = OpINotEqual %v4bool %43 %27 + %38 = OpSelect %v4uint %39 %45 %27 + %46 = OpLoad %v4uint %x + %47 = OpShiftRightLogical %v4uint %46 %38 + OpStore %x %47 + %50 = OpLoad %v4uint %x + %53 = OpBitwiseAnd %v4uint %50 %52 + %49 = OpINotEqual %v4bool %53 %27 + %48 = OpSelect %v4uint %49 %55 %27 + %56 = OpLoad %v4uint %x + %57 = OpShiftRightLogical %v4uint %56 %48 + OpStore %x %57 + %60 = OpLoad %v4uint %x + %63 = OpBitwiseAnd %v4uint %60 %62 + %59 = OpINotEqual %v4bool %63 %27 + %58 = OpSelect %v4uint %59 %65 %27 + %66 = OpLoad %v4uint %x + %67 = OpShiftRightLogical %v4uint %66 %58 + OpStore %x %67 + %70 = OpLoad %v4uint %x + %71 = OpBitwiseAnd %v4uint %70 %65 + %69 = OpINotEqual %v4bool %71 %27 + %68 = OpSelect %v4uint %69 %73 %27 + %75 = OpLoad %v4uint %x + %76 = OpIEqual %v4bool %75 %27 + %74 = OpSelect %v4uint %76 %78 %27 + %80 = OpBitwiseOr %v4uint %28 %38 + %81 = OpBitwiseOr %v4uint %80 %48 + %82 = OpBitwiseOr %v4uint %81 %58 + %83 = OpBitwiseOr %v4uint %82 %68 + %84 = OpBitwiseOr %v4uint %83 %74 + %79 = OpBitcast %v4int %84 + OpReturnValue %79 + OpFunctionEnd +%firstLeadingBit_c1f940 = OpFunction %void None %85 + %88 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %18 + %89 = OpFunctionCall %v4int %tint_first_leading_bit %91 + OpStore %res %89 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %94 + %96 = OpLabel + %97 = OpFunctionCall %void %firstLeadingBit_c1f940 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %85 + %99 = OpLabel + %100 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %100 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %85 + %103 = OpLabel + %104 = OpFunctionCall %void %firstLeadingBit_c1f940 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %85 + %106 = OpLabel + %107 = OpFunctionCall %void %firstLeadingBit_c1f940 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.wgsl new file mode 100644 index 0000000000..f9e47414d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstLeadingBit_c1f940() { + var res : vec4 = firstLeadingBit(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_c1f940(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_c1f940(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_c1f940(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl new file mode 100644 index 0000000000..3534dcbd8d --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(u32) -> u32 +fn firstLeadingBit_f0779d() { + var res: u32 = firstLeadingBit(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_f0779d(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_f0779d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_f0779d(); +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e289038037 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint tint_first_leading_bit(uint v) { + uint x = v; + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint res = tint_first_leading_bit(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_f0779d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_f0779d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_f0779d(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e289038037 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint tint_first_leading_bit(uint v) { + uint x = v; + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint res = tint_first_leading_bit(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_f0779d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_f0779d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_f0779d(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.glsl new file mode 100644 index 0000000000..76aee67647 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uint tint_first_leading_bit(uint v) { + uint x = v; + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint res = tint_first_leading_bit(1u); +} + +vec4 vertex_main() { + firstLeadingBit_f0779d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_first_leading_bit(uint v) { + uint x = v; + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint res = tint_first_leading_bit(1u); +} + +void fragment_main() { + firstLeadingBit_f0779d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_first_leading_bit(uint v) { + uint x = v; + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint res = tint_first_leading_bit(1u); +} + +void compute_main() { + firstLeadingBit_f0779d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.msl new file mode 100644 index 0000000000..09b520d803 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +uint tint_first_leading_bit(uint v) { + uint x = v; + uint const b16 = select(0u, 16u, bool((x & 4294901760u))); + x = (x >> b16); + uint const b8 = select(0u, 8u, bool((x & 65280u))); + x = (x >> b8); + uint const b4 = select(0u, 4u, bool((x & 240u))); + x = (x >> b4); + uint const b2 = select(0u, 2u, bool((x & 12u))); + x = (x >> b2); + uint const b1 = select(0u, 1u, bool((x & 2u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint res = tint_first_leading_bit(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_f0779d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_f0779d(); + return; +} + +kernel void compute_main() { + firstLeadingBit_f0779d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.spvasm new file mode 100644 index 0000000000..c51a21b227 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_f0779d "firstLeadingBit_f0779d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %bool = OpTypeBool +%uint_4294901760 = OpConstant %uint 4294901760 + %uint_16 = OpConstant %uint 16 + %uint_65280 = OpConstant %uint 65280 + %uint_8 = OpConstant %uint 8 + %uint_240 = OpConstant %uint 240 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %65 = OpTypeFunction %void + %71 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %16 + OpStore %x %v + %20 = OpLoad %uint %x + %22 = OpBitwiseAnd %uint %20 %uint_4294901760 + %18 = OpINotEqual %bool %22 %16 + %17 = OpSelect %uint %18 %uint_16 %16 + %24 = OpLoad %uint %x + %25 = OpShiftRightLogical %uint %24 %17 + OpStore %x %25 + %28 = OpLoad %uint %x + %30 = OpBitwiseAnd %uint %28 %uint_65280 + %27 = OpINotEqual %bool %30 %16 + %26 = OpSelect %uint %27 %uint_8 %16 + %32 = OpLoad %uint %x + %33 = OpShiftRightLogical %uint %32 %26 + OpStore %x %33 + %36 = OpLoad %uint %x + %38 = OpBitwiseAnd %uint %36 %uint_240 + %35 = OpINotEqual %bool %38 %16 + %34 = OpSelect %uint %35 %uint_4 %16 + %40 = OpLoad %uint %x + %41 = OpShiftRightLogical %uint %40 %34 + OpStore %x %41 + %44 = OpLoad %uint %x + %46 = OpBitwiseAnd %uint %44 %uint_12 + %43 = OpINotEqual %bool %46 %16 + %42 = OpSelect %uint %43 %uint_2 %16 + %48 = OpLoad %uint %x + %49 = OpShiftRightLogical %uint %48 %42 + OpStore %x %49 + %52 = OpLoad %uint %x + %53 = OpBitwiseAnd %uint %52 %uint_2 + %51 = OpINotEqual %bool %53 %16 + %50 = OpSelect %uint %51 %uint_1 %16 + %56 = OpLoad %uint %x + %57 = OpIEqual %bool %56 %16 + %55 = OpSelect %uint %57 %uint_4294967295 %16 + %60 = OpBitwiseOr %uint %17 %26 + %61 = OpBitwiseOr %uint %60 %34 + %62 = OpBitwiseOr %uint %61 %42 + %63 = OpBitwiseOr %uint %62 %50 + %64 = OpBitwiseOr %uint %63 %55 + OpReturnValue %64 + OpFunctionEnd +%firstLeadingBit_f0779d = OpFunction %void None %65 + %68 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %16 + %69 = OpFunctionCall %uint %tint_first_leading_bit %uint_1 + OpStore %res %69 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %71 + %73 = OpLabel + %74 = OpFunctionCall %void %firstLeadingBit_f0779d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %65 + %76 = OpLabel + %77 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %77 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %65 + %80 = OpLabel + %81 = OpFunctionCall %void %firstLeadingBit_f0779d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %65 + %83 = OpLabel + %84 = OpFunctionCall %void %firstLeadingBit_f0779d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a3d1054f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstLeadingBit_f0779d() { + var res : u32 = firstLeadingBit(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_f0779d(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_f0779d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_f0779d(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl new file mode 100644 index 0000000000..b6b03394b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<4, u32>) -> vec<4, u32> +fn firstTrailingBit_110f2c() { + var res: vec4 = firstTrailingBit(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_110f2c(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_110f2c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_110f2c(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b15e1f6f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint4 tint_first_trailing_bit(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uint4 res = tint_first_trailing_bit((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_110f2c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_110f2c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_110f2c(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b15e1f6f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint4 tint_first_trailing_bit(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uint4 res = tint_first_trailing_bit((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_110f2c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_110f2c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_110f2c(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.glsl new file mode 100644 index 0000000000..b9d3ec1a27 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec4 tint_first_trailing_bit(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uvec4 res = tint_first_trailing_bit(uvec4(1u)); +} + +vec4 vertex_main() { + firstTrailingBit_110f2c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_first_trailing_bit(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uvec4 res = tint_first_trailing_bit(uvec4(1u)); +} + +void fragment_main() { + firstTrailingBit_110f2c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_first_trailing_bit(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uvec4 res = tint_first_trailing_bit(uvec4(1u)); +} + +void compute_main() { + firstTrailingBit_110f2c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.msl new file mode 100644 index 0000000000..df5194c488 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +uint4 tint_first_trailing_bit(uint4 v) { + uint4 x = uint4(v); + uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uint4 res = tint_first_trailing_bit(uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_110f2c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_110f2c(); + return; +} + +kernel void compute_main() { + firstTrailingBit_110f2c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.spvasm new file mode 100644 index 0000000000..36c66d9aa3 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_110f2c "firstTrailingBit_110f2c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %18 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %71 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %84 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %x %v + %23 = OpLoad %v4uint %x + %26 = OpBitwiseAnd %v4uint %23 %25 + %20 = OpINotEqual %v4bool %26 %18 + %19 = OpSelect %v4uint %20 %18 %28 + %29 = OpLoad %v4uint %x + %30 = OpShiftRightLogical %v4uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v4uint %x + %36 = OpBitwiseAnd %v4uint %33 %35 + %32 = OpINotEqual %v4bool %36 %18 + %31 = OpSelect %v4uint %32 %18 %38 + %39 = OpLoad %v4uint %x + %40 = OpShiftRightLogical %v4uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v4uint %x + %46 = OpBitwiseAnd %v4uint %43 %45 + %42 = OpINotEqual %v4bool %46 %18 + %41 = OpSelect %v4uint %42 %18 %48 + %49 = OpLoad %v4uint %x + %50 = OpShiftRightLogical %v4uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v4uint %x + %56 = OpBitwiseAnd %v4uint %53 %55 + %52 = OpINotEqual %v4bool %56 %18 + %51 = OpSelect %v4uint %52 %18 %58 + %59 = OpLoad %v4uint %x + %60 = OpShiftRightLogical %v4uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v4uint %x + %66 = OpBitwiseAnd %v4uint %63 %65 + %62 = OpINotEqual %v4bool %66 %18 + %61 = OpSelect %v4uint %62 %18 %65 + %68 = OpLoad %v4uint %x + %69 = OpIEqual %v4bool %68 %18 + %67 = OpSelect %v4uint %69 %71 %18 + %73 = OpBitwiseOr %v4uint %19 %31 + %74 = OpBitwiseOr %v4uint %73 %41 + %75 = OpBitwiseOr %v4uint %74 %51 + %76 = OpBitwiseOr %v4uint %75 %61 + %77 = OpBitwiseOr %v4uint %76 %67 + OpReturnValue %77 + OpFunctionEnd +%firstTrailingBit_110f2c = OpFunction %void None %78 + %81 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %18 + %82 = OpFunctionCall %v4uint %tint_first_trailing_bit %65 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %84 + %86 = OpLabel + %87 = OpFunctionCall %void %firstTrailingBit_110f2c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %89 = OpLabel + %90 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %90 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %93 = OpLabel + %94 = OpFunctionCall %void %firstTrailingBit_110f2c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %96 = OpLabel + %97 = OpFunctionCall %void %firstTrailingBit_110f2c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.wgsl new file mode 100644 index 0000000000..3bf52331ee --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/110f2c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstTrailingBit_110f2c() { + var res : vec4 = firstTrailingBit(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_110f2c(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_110f2c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_110f2c(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl new file mode 100644 index 0000000000..f595902828 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(i32) -> i32 +fn firstTrailingBit_3a2acc() { + var res: i32 = firstTrailingBit(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_3a2acc(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_3a2acc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_3a2acc(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1e0c06eb4d --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int tint_first_trailing_bit(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int res = tint_first_trailing_bit(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_3a2acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_3a2acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_3a2acc(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1e0c06eb4d --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int tint_first_trailing_bit(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int res = tint_first_trailing_bit(1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_3a2acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_3a2acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_3a2acc(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.glsl new file mode 100644 index 0000000000..61aa479684 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int res = tint_first_trailing_bit(1); +} + +vec4 vertex_main() { + firstTrailingBit_3a2acc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int res = tint_first_trailing_bit(1); +} + +void fragment_main() { + firstTrailingBit_3a2acc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int res = tint_first_trailing_bit(1); +} + +void compute_main() { + firstTrailingBit_3a2acc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.msl new file mode 100644 index 0000000000..fcef721243 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint const b16 = select(16u, 0u, bool((x & 65535u))); + x = (x >> b16); + uint const b8 = select(8u, 0u, bool((x & 255u))); + x = (x >> b8); + uint const b4 = select(4u, 0u, bool((x & 15u))); + x = (x >> b4); + uint const b2 = select(2u, 0u, bool((x & 3u))); + x = (x >> b2); + uint const b1 = select(1u, 0u, bool((x & 1u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int res = tint_first_trailing_bit(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_3a2acc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_3a2acc(); + return; +} + +kernel void compute_main() { + firstTrailingBit_3a2acc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.spvasm new file mode 100644 index 0000000000..353d5ddc11 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.spvasm @@ -0,0 +1,134 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_3a2acc "firstTrailingBit_3a2acc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %67 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %75 = OpConstantNull %int + %76 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %18 + %14 = OpBitcast %uint %v + OpStore %x %14 + %22 = OpLoad %uint %x + %24 = OpBitwiseAnd %uint %22 %uint_65535 + %20 = OpINotEqual %bool %24 %18 + %19 = OpSelect %uint %20 %18 %uint_16 + %26 = OpLoad %uint %x + %27 = OpShiftRightLogical %uint %26 %19 + OpStore %x %27 + %30 = OpLoad %uint %x + %32 = OpBitwiseAnd %uint %30 %uint_255 + %29 = OpINotEqual %bool %32 %18 + %28 = OpSelect %uint %29 %18 %uint_8 + %34 = OpLoad %uint %x + %35 = OpShiftRightLogical %uint %34 %28 + OpStore %x %35 + %38 = OpLoad %uint %x + %40 = OpBitwiseAnd %uint %38 %uint_15 + %37 = OpINotEqual %bool %40 %18 + %36 = OpSelect %uint %37 %18 %uint_4 + %42 = OpLoad %uint %x + %43 = OpShiftRightLogical %uint %42 %36 + OpStore %x %43 + %46 = OpLoad %uint %x + %48 = OpBitwiseAnd %uint %46 %uint_3 + %45 = OpINotEqual %bool %48 %18 + %44 = OpSelect %uint %45 %18 %uint_2 + %50 = OpLoad %uint %x + %51 = OpShiftRightLogical %uint %50 %44 + OpStore %x %51 + %54 = OpLoad %uint %x + %56 = OpBitwiseAnd %uint %54 %uint_1 + %53 = OpINotEqual %bool %56 %18 + %52 = OpSelect %uint %53 %18 %uint_1 + %58 = OpLoad %uint %x + %59 = OpIEqual %bool %58 %18 + %57 = OpSelect %uint %59 %uint_4294967295 %18 + %62 = OpBitwiseOr %uint %19 %28 + %63 = OpBitwiseOr %uint %62 %36 + %64 = OpBitwiseOr %uint %63 %44 + %65 = OpBitwiseOr %uint %64 %52 + %66 = OpBitwiseOr %uint %65 %57 + %61 = OpBitcast %int %66 + OpReturnValue %61 + OpFunctionEnd +%firstTrailingBit_3a2acc = OpFunction %void None %67 + %70 = OpLabel + %res = OpVariable %_ptr_Function_int Function %75 + %71 = OpFunctionCall %int %tint_first_trailing_bit %int_1 + OpStore %res %71 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %76 + %78 = OpLabel + %79 = OpFunctionCall %void %firstTrailingBit_3a2acc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %67 + %81 = OpLabel + %82 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %82 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %67 + %85 = OpLabel + %86 = OpFunctionCall %void %firstTrailingBit_3a2acc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %67 + %88 = OpLabel + %89 = OpFunctionCall %void %firstTrailingBit_3a2acc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6b7e95dd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/3a2acc.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstTrailingBit_3a2acc() { + var res : i32 = firstTrailingBit(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_3a2acc(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_3a2acc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_3a2acc(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl new file mode 100644 index 0000000000..70e6f4050b --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<2, u32>) -> vec<2, u32> +fn firstTrailingBit_45eb10() { + var res: vec2 = firstTrailingBit(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_45eb10(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_45eb10(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_45eb10(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..93af66bfe2 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint2 tint_first_trailing_bit(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uint2 res = tint_first_trailing_bit((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_45eb10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_45eb10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_45eb10(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..93af66bfe2 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint2 tint_first_trailing_bit(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uint2 res = tint_first_trailing_bit((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_45eb10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_45eb10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_45eb10(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.glsl new file mode 100644 index 0000000000..d9b84b2bc8 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec2 tint_first_trailing_bit(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uvec2 res = tint_first_trailing_bit(uvec2(1u)); +} + +vec4 vertex_main() { + firstTrailingBit_45eb10(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_first_trailing_bit(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uvec2 res = tint_first_trailing_bit(uvec2(1u)); +} + +void fragment_main() { + firstTrailingBit_45eb10(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_first_trailing_bit(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uvec2 res = tint_first_trailing_bit(uvec2(1u)); +} + +void compute_main() { + firstTrailingBit_45eb10(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.msl new file mode 100644 index 0000000000..744afadfa6 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +uint2 tint_first_trailing_bit(uint2 v) { + uint2 x = uint2(v); + uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uint2 res = tint_first_trailing_bit(uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_45eb10(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_45eb10(); + return; +} + +kernel void compute_main() { + firstTrailingBit_45eb10(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.spvasm new file mode 100644 index 0000000000..5aac2e5421 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_45eb10 "firstTrailingBit_45eb10" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %18 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %71 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %84 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %x %v + %23 = OpLoad %v2uint %x + %26 = OpBitwiseAnd %v2uint %23 %25 + %20 = OpINotEqual %v2bool %26 %18 + %19 = OpSelect %v2uint %20 %18 %28 + %29 = OpLoad %v2uint %x + %30 = OpShiftRightLogical %v2uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v2uint %x + %36 = OpBitwiseAnd %v2uint %33 %35 + %32 = OpINotEqual %v2bool %36 %18 + %31 = OpSelect %v2uint %32 %18 %38 + %39 = OpLoad %v2uint %x + %40 = OpShiftRightLogical %v2uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v2uint %x + %46 = OpBitwiseAnd %v2uint %43 %45 + %42 = OpINotEqual %v2bool %46 %18 + %41 = OpSelect %v2uint %42 %18 %48 + %49 = OpLoad %v2uint %x + %50 = OpShiftRightLogical %v2uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v2uint %x + %56 = OpBitwiseAnd %v2uint %53 %55 + %52 = OpINotEqual %v2bool %56 %18 + %51 = OpSelect %v2uint %52 %18 %58 + %59 = OpLoad %v2uint %x + %60 = OpShiftRightLogical %v2uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v2uint %x + %66 = OpBitwiseAnd %v2uint %63 %65 + %62 = OpINotEqual %v2bool %66 %18 + %61 = OpSelect %v2uint %62 %18 %65 + %68 = OpLoad %v2uint %x + %69 = OpIEqual %v2bool %68 %18 + %67 = OpSelect %v2uint %69 %71 %18 + %73 = OpBitwiseOr %v2uint %19 %31 + %74 = OpBitwiseOr %v2uint %73 %41 + %75 = OpBitwiseOr %v2uint %74 %51 + %76 = OpBitwiseOr %v2uint %75 %61 + %77 = OpBitwiseOr %v2uint %76 %67 + OpReturnValue %77 + OpFunctionEnd +%firstTrailingBit_45eb10 = OpFunction %void None %78 + %81 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %18 + %82 = OpFunctionCall %v2uint %tint_first_trailing_bit %65 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %84 + %86 = OpLabel + %87 = OpFunctionCall %void %firstTrailingBit_45eb10 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %89 = OpLabel + %90 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %90 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %93 = OpLabel + %94 = OpFunctionCall %void %firstTrailingBit_45eb10 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %96 = OpLabel + %97 = OpFunctionCall %void %firstTrailingBit_45eb10 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.wgsl new file mode 100644 index 0000000000..0db7af4fbc --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/45eb10.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstTrailingBit_45eb10() { + var res : vec2 = firstTrailingBit(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_45eb10(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_45eb10(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_45eb10(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl new file mode 100644 index 0000000000..1646d223e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(u32) -> u32 +fn firstTrailingBit_47d475() { + var res: u32 = firstTrailingBit(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_47d475(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_47d475(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_47d475(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3b50087bc9 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint res = tint_first_trailing_bit(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_47d475(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_47d475(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_47d475(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3b50087bc9 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint res = tint_first_trailing_bit(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_47d475(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_47d475(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_47d475(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.glsl new file mode 100644 index 0000000000..5fdedcd855 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint res = tint_first_trailing_bit(1u); +} + +vec4 vertex_main() { + firstTrailingBit_47d475(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint res = tint_first_trailing_bit(1u); +} + +void fragment_main() { + firstTrailingBit_47d475(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint res = tint_first_trailing_bit(1u); +} + +void compute_main() { + firstTrailingBit_47d475(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.msl new file mode 100644 index 0000000000..fba301cc40 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint const b16 = select(16u, 0u, bool((x & 65535u))); + x = (x >> b16); + uint const b8 = select(8u, 0u, bool((x & 255u))); + x = (x >> b8); + uint const b4 = select(4u, 0u, bool((x & 15u))); + x = (x >> b4); + uint const b2 = select(2u, 0u, bool((x & 3u))); + x = (x >> b2); + uint const b1 = select(1u, 0u, bool((x & 1u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint res = tint_first_trailing_bit(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_47d475(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_47d475(); + return; +} + +kernel void compute_main() { + firstTrailingBit_47d475(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f60ef1b61 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_47d475 "firstTrailingBit_47d475" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %66 = OpTypeFunction %void + %72 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %17 + OpStore %x %v + %21 = OpLoad %uint %x + %23 = OpBitwiseAnd %uint %21 %uint_65535 + %19 = OpINotEqual %bool %23 %17 + %18 = OpSelect %uint %19 %17 %uint_16 + %25 = OpLoad %uint %x + %26 = OpShiftRightLogical %uint %25 %18 + OpStore %x %26 + %29 = OpLoad %uint %x + %31 = OpBitwiseAnd %uint %29 %uint_255 + %28 = OpINotEqual %bool %31 %17 + %27 = OpSelect %uint %28 %17 %uint_8 + %33 = OpLoad %uint %x + %34 = OpShiftRightLogical %uint %33 %27 + OpStore %x %34 + %37 = OpLoad %uint %x + %39 = OpBitwiseAnd %uint %37 %uint_15 + %36 = OpINotEqual %bool %39 %17 + %35 = OpSelect %uint %36 %17 %uint_4 + %41 = OpLoad %uint %x + %42 = OpShiftRightLogical %uint %41 %35 + OpStore %x %42 + %45 = OpLoad %uint %x + %47 = OpBitwiseAnd %uint %45 %uint_3 + %44 = OpINotEqual %bool %47 %17 + %43 = OpSelect %uint %44 %17 %uint_2 + %49 = OpLoad %uint %x + %50 = OpShiftRightLogical %uint %49 %43 + OpStore %x %50 + %53 = OpLoad %uint %x + %55 = OpBitwiseAnd %uint %53 %uint_1 + %52 = OpINotEqual %bool %55 %17 + %51 = OpSelect %uint %52 %17 %uint_1 + %57 = OpLoad %uint %x + %58 = OpIEqual %bool %57 %17 + %56 = OpSelect %uint %58 %uint_4294967295 %17 + %61 = OpBitwiseOr %uint %18 %27 + %62 = OpBitwiseOr %uint %61 %35 + %63 = OpBitwiseOr %uint %62 %43 + %64 = OpBitwiseOr %uint %63 %51 + %65 = OpBitwiseOr %uint %64 %56 + OpReturnValue %65 + OpFunctionEnd +%firstTrailingBit_47d475 = OpFunction %void None %66 + %69 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %70 = OpFunctionCall %uint %tint_first_trailing_bit %uint_1 + OpStore %res %70 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %72 + %74 = OpLabel + %75 = OpFunctionCall %void %firstTrailingBit_47d475 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %66 + %77 = OpLabel + %78 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %78 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %66 + %81 = OpLabel + %82 = OpFunctionCall %void %firstTrailingBit_47d475 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %66 + %84 = OpLabel + %85 = OpFunctionCall %void %firstTrailingBit_47d475 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.wgsl new file mode 100644 index 0000000000..1673bcd114 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/47d475.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstTrailingBit_47d475() { + var res : u32 = firstTrailingBit(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_47d475(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_47d475(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_47d475(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl new file mode 100644 index 0000000000..e6f819cb84 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<2, i32>) -> vec<2, i32> +fn firstTrailingBit_50c072() { + var res: vec2 = firstTrailingBit(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_50c072(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_50c072(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_50c072(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6831c5b781 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int2 tint_first_trailing_bit(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + int2 res = tint_first_trailing_bit((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_50c072(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_50c072(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_50c072(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6831c5b781 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int2 tint_first_trailing_bit(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + int2 res = tint_first_trailing_bit((1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_50c072(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_50c072(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_50c072(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.glsl new file mode 100644 index 0000000000..f59914622d --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec2 tint_first_trailing_bit(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + ivec2 res = tint_first_trailing_bit(ivec2(1)); +} + +vec4 vertex_main() { + firstTrailingBit_50c072(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_first_trailing_bit(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + ivec2 res = tint_first_trailing_bit(ivec2(1)); +} + +void fragment_main() { + firstTrailingBit_50c072(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_first_trailing_bit(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + ivec2 res = tint_first_trailing_bit(ivec2(1)); +} + +void compute_main() { + firstTrailingBit_50c072(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.msl new file mode 100644 index 0000000000..77d08a2f77 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +int2 tint_first_trailing_bit(int2 v) { + uint2 x = uint2(v); + uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + int2 res = tint_first_trailing_bit(int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_50c072(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_50c072(); + return; +} + +kernel void compute_main() { + firstTrailingBit_50c072(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b8a036a99 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.spvasm @@ -0,0 +1,148 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_50c072 "firstTrailingBit_50c072" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %73 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %86 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %89 = OpConstantNull %v2int + %90 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %20 + %15 = OpBitcast %v2uint %v + OpStore %x %15 + %25 = OpLoad %v2uint %x + %28 = OpBitwiseAnd %v2uint %25 %27 + %22 = OpINotEqual %v2bool %28 %20 + %21 = OpSelect %v2uint %22 %20 %30 + %31 = OpLoad %v2uint %x + %32 = OpShiftRightLogical %v2uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v2uint %x + %38 = OpBitwiseAnd %v2uint %35 %37 + %34 = OpINotEqual %v2bool %38 %20 + %33 = OpSelect %v2uint %34 %20 %40 + %41 = OpLoad %v2uint %x + %42 = OpShiftRightLogical %v2uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v2uint %x + %48 = OpBitwiseAnd %v2uint %45 %47 + %44 = OpINotEqual %v2bool %48 %20 + %43 = OpSelect %v2uint %44 %20 %50 + %51 = OpLoad %v2uint %x + %52 = OpShiftRightLogical %v2uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v2uint %x + %58 = OpBitwiseAnd %v2uint %55 %57 + %54 = OpINotEqual %v2bool %58 %20 + %53 = OpSelect %v2uint %54 %20 %60 + %61 = OpLoad %v2uint %x + %62 = OpShiftRightLogical %v2uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v2uint %x + %68 = OpBitwiseAnd %v2uint %65 %67 + %64 = OpINotEqual %v2bool %68 %20 + %63 = OpSelect %v2uint %64 %20 %67 + %70 = OpLoad %v2uint %x + %71 = OpIEqual %v2bool %70 %20 + %69 = OpSelect %v2uint %71 %73 %20 + %75 = OpBitwiseOr %v2uint %21 %33 + %76 = OpBitwiseOr %v2uint %75 %43 + %77 = OpBitwiseOr %v2uint %76 %53 + %78 = OpBitwiseOr %v2uint %77 %63 + %79 = OpBitwiseOr %v2uint %78 %69 + %74 = OpBitcast %v2int %79 + OpReturnValue %74 + OpFunctionEnd +%firstTrailingBit_50c072 = OpFunction %void None %80 + %83 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %89 + %84 = OpFunctionCall %v2int %tint_first_trailing_bit %86 + OpStore %res %84 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %90 + %92 = OpLabel + %93 = OpFunctionCall %void %firstTrailingBit_50c072 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %80 + %95 = OpLabel + %96 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %96 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %80 + %99 = OpLabel + %100 = OpFunctionCall %void %firstTrailingBit_50c072 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %80 + %102 = OpLabel + %103 = OpFunctionCall %void %firstTrailingBit_50c072 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f1b31245e --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/50c072.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstTrailingBit_50c072() { + var res : vec2 = firstTrailingBit(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_50c072(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_50c072(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_50c072(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl new file mode 100644 index 0000000000..283f9c3915 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<3, i32>) -> vec<3, i32> +fn firstTrailingBit_7496d6() { + var res: vec3 = firstTrailingBit(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_7496d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_7496d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_7496d6(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b6a770e919 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int3 tint_first_trailing_bit(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + int3 res = tint_first_trailing_bit((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_7496d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_7496d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_7496d6(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b6a770e919 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int3 tint_first_trailing_bit(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + int3 res = tint_first_trailing_bit((1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_7496d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_7496d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_7496d6(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.glsl new file mode 100644 index 0000000000..f32c11889d --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec3 tint_first_trailing_bit(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + ivec3 res = tint_first_trailing_bit(ivec3(1)); +} + +vec4 vertex_main() { + firstTrailingBit_7496d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_first_trailing_bit(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + ivec3 res = tint_first_trailing_bit(ivec3(1)); +} + +void fragment_main() { + firstTrailingBit_7496d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_first_trailing_bit(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + ivec3 res = tint_first_trailing_bit(ivec3(1)); +} + +void compute_main() { + firstTrailingBit_7496d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.msl new file mode 100644 index 0000000000..ebbd9e5d47 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +int3 tint_first_trailing_bit(int3 v) { + uint3 x = uint3(v); + uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + int3 res = tint_first_trailing_bit(int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_7496d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_7496d6(); + return; +} + +kernel void compute_main() { + firstTrailingBit_7496d6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..19085fc050 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.spvasm @@ -0,0 +1,148 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_7496d6 "firstTrailingBit_7496d6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %73 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %86 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %89 = OpConstantNull %v3int + %90 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %20 + %15 = OpBitcast %v3uint %v + OpStore %x %15 + %25 = OpLoad %v3uint %x + %28 = OpBitwiseAnd %v3uint %25 %27 + %22 = OpINotEqual %v3bool %28 %20 + %21 = OpSelect %v3uint %22 %20 %30 + %31 = OpLoad %v3uint %x + %32 = OpShiftRightLogical %v3uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v3uint %x + %38 = OpBitwiseAnd %v3uint %35 %37 + %34 = OpINotEqual %v3bool %38 %20 + %33 = OpSelect %v3uint %34 %20 %40 + %41 = OpLoad %v3uint %x + %42 = OpShiftRightLogical %v3uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v3uint %x + %48 = OpBitwiseAnd %v3uint %45 %47 + %44 = OpINotEqual %v3bool %48 %20 + %43 = OpSelect %v3uint %44 %20 %50 + %51 = OpLoad %v3uint %x + %52 = OpShiftRightLogical %v3uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v3uint %x + %58 = OpBitwiseAnd %v3uint %55 %57 + %54 = OpINotEqual %v3bool %58 %20 + %53 = OpSelect %v3uint %54 %20 %60 + %61 = OpLoad %v3uint %x + %62 = OpShiftRightLogical %v3uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v3uint %x + %68 = OpBitwiseAnd %v3uint %65 %67 + %64 = OpINotEqual %v3bool %68 %20 + %63 = OpSelect %v3uint %64 %20 %67 + %70 = OpLoad %v3uint %x + %71 = OpIEqual %v3bool %70 %20 + %69 = OpSelect %v3uint %71 %73 %20 + %75 = OpBitwiseOr %v3uint %21 %33 + %76 = OpBitwiseOr %v3uint %75 %43 + %77 = OpBitwiseOr %v3uint %76 %53 + %78 = OpBitwiseOr %v3uint %77 %63 + %79 = OpBitwiseOr %v3uint %78 %69 + %74 = OpBitcast %v3int %79 + OpReturnValue %74 + OpFunctionEnd +%firstTrailingBit_7496d6 = OpFunction %void None %80 + %83 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %89 + %84 = OpFunctionCall %v3int %tint_first_trailing_bit %86 + OpStore %res %84 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %90 + %92 = OpLabel + %93 = OpFunctionCall %void %firstTrailingBit_7496d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %80 + %95 = OpLabel + %96 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %96 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %80 + %99 = OpLabel + %100 = OpFunctionCall %void %firstTrailingBit_7496d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %80 + %102 = OpLabel + %103 = OpFunctionCall %void %firstTrailingBit_7496d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..0786fc72a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/7496d6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstTrailingBit_7496d6() { + var res : vec3 = firstTrailingBit(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_7496d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_7496d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_7496d6(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl new file mode 100644 index 0000000000..dc00072e0a --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<4, i32>) -> vec<4, i32> +fn firstTrailingBit_86551b() { + var res: vec4 = firstTrailingBit(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_86551b(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_86551b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_86551b(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83b0e6c5c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +int4 tint_first_trailing_bit(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + int4 res = tint_first_trailing_bit((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_86551b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_86551b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_86551b(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83b0e6c5c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +int4 tint_first_trailing_bit(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + int4 res = tint_first_trailing_bit((1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_86551b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_86551b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_86551b(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.glsl new file mode 100644 index 0000000000..5965aea01d --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +ivec4 tint_first_trailing_bit(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + ivec4 res = tint_first_trailing_bit(ivec4(1)); +} + +vec4 vertex_main() { + firstTrailingBit_86551b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_first_trailing_bit(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + ivec4 res = tint_first_trailing_bit(ivec4(1)); +} + +void fragment_main() { + firstTrailingBit_86551b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_first_trailing_bit(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + ivec4 res = tint_first_trailing_bit(ivec4(1)); +} + +void compute_main() { + firstTrailingBit_86551b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.msl new file mode 100644 index 0000000000..1f2e6b2eb5 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +int4 tint_first_trailing_bit(int4 v) { + uint4 x = uint4(v); + uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + int4 res = tint_first_trailing_bit(int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_86551b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_86551b(); + return; +} + +kernel void compute_main() { + firstTrailingBit_86551b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb88fcd4ab --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.spvasm @@ -0,0 +1,148 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_86551b "firstTrailingBit_86551b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %73 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %86 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %89 = OpConstantNull %v4int + %90 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %20 + %15 = OpBitcast %v4uint %v + OpStore %x %15 + %25 = OpLoad %v4uint %x + %28 = OpBitwiseAnd %v4uint %25 %27 + %22 = OpINotEqual %v4bool %28 %20 + %21 = OpSelect %v4uint %22 %20 %30 + %31 = OpLoad %v4uint %x + %32 = OpShiftRightLogical %v4uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v4uint %x + %38 = OpBitwiseAnd %v4uint %35 %37 + %34 = OpINotEqual %v4bool %38 %20 + %33 = OpSelect %v4uint %34 %20 %40 + %41 = OpLoad %v4uint %x + %42 = OpShiftRightLogical %v4uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v4uint %x + %48 = OpBitwiseAnd %v4uint %45 %47 + %44 = OpINotEqual %v4bool %48 %20 + %43 = OpSelect %v4uint %44 %20 %50 + %51 = OpLoad %v4uint %x + %52 = OpShiftRightLogical %v4uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v4uint %x + %58 = OpBitwiseAnd %v4uint %55 %57 + %54 = OpINotEqual %v4bool %58 %20 + %53 = OpSelect %v4uint %54 %20 %60 + %61 = OpLoad %v4uint %x + %62 = OpShiftRightLogical %v4uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v4uint %x + %68 = OpBitwiseAnd %v4uint %65 %67 + %64 = OpINotEqual %v4bool %68 %20 + %63 = OpSelect %v4uint %64 %20 %67 + %70 = OpLoad %v4uint %x + %71 = OpIEqual %v4bool %70 %20 + %69 = OpSelect %v4uint %71 %73 %20 + %75 = OpBitwiseOr %v4uint %21 %33 + %76 = OpBitwiseOr %v4uint %75 %43 + %77 = OpBitwiseOr %v4uint %76 %53 + %78 = OpBitwiseOr %v4uint %77 %63 + %79 = OpBitwiseOr %v4uint %78 %69 + %74 = OpBitcast %v4int %79 + OpReturnValue %74 + OpFunctionEnd +%firstTrailingBit_86551b = OpFunction %void None %80 + %83 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %89 + %84 = OpFunctionCall %v4int %tint_first_trailing_bit %86 + OpStore %res %84 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %90 + %92 = OpLabel + %93 = OpFunctionCall %void %firstTrailingBit_86551b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %80 + %95 = OpLabel + %96 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %96 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %80 + %99 = OpLabel + %100 = OpFunctionCall %void %firstTrailingBit_86551b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %80 + %102 = OpLabel + %103 = OpFunctionCall %void %firstTrailingBit_86551b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.wgsl new file mode 100644 index 0000000000..9bfaaf71f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/86551b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstTrailingBit_86551b() { + var res : vec4 = firstTrailingBit(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_86551b(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_86551b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_86551b(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl new file mode 100644 index 0000000000..b096cd1543 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<3, u32>) -> vec<3, u32> +fn firstTrailingBit_cb51ce() { + var res: vec3 = firstTrailingBit(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_cb51ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_cb51ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_cb51ce(); +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18d192c25b --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +uint3 tint_first_trailing_bit(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uint3 res = tint_first_trailing_bit((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_cb51ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_cb51ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_cb51ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..18d192c25b --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +uint3 tint_first_trailing_bit(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uint3 res = tint_first_trailing_bit((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_cb51ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_cb51ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_cb51ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.glsl new file mode 100644 index 0000000000..c7568164df --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.glsl @@ -0,0 +1,94 @@ +#version 310 es + +uvec3 tint_first_trailing_bit(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uvec3 res = tint_first_trailing_bit(uvec3(1u)); +} + +vec4 vertex_main() { + firstTrailingBit_cb51ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_first_trailing_bit(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uvec3 res = tint_first_trailing_bit(uvec3(1u)); +} + +void fragment_main() { + firstTrailingBit_cb51ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_first_trailing_bit(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uvec3 res = tint_first_trailing_bit(uvec3(1u)); +} + +void compute_main() { + firstTrailingBit_cb51ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.msl new file mode 100644 index 0000000000..9acc871fce --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +uint3 tint_first_trailing_bit(uint3 v) { + uint3 x = uint3(v); + uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uint3 res = tint_first_trailing_bit(uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_cb51ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_cb51ce(); + return; +} + +kernel void compute_main() { + firstTrailingBit_cb51ce(); + return; +} + diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..06c2e92d04 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_cb51ce "firstTrailingBit_cb51ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %71 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %84 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %x %v + %23 = OpLoad %v3uint %x + %26 = OpBitwiseAnd %v3uint %23 %25 + %20 = OpINotEqual %v3bool %26 %18 + %19 = OpSelect %v3uint %20 %18 %28 + %29 = OpLoad %v3uint %x + %30 = OpShiftRightLogical %v3uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v3uint %x + %36 = OpBitwiseAnd %v3uint %33 %35 + %32 = OpINotEqual %v3bool %36 %18 + %31 = OpSelect %v3uint %32 %18 %38 + %39 = OpLoad %v3uint %x + %40 = OpShiftRightLogical %v3uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v3uint %x + %46 = OpBitwiseAnd %v3uint %43 %45 + %42 = OpINotEqual %v3bool %46 %18 + %41 = OpSelect %v3uint %42 %18 %48 + %49 = OpLoad %v3uint %x + %50 = OpShiftRightLogical %v3uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v3uint %x + %56 = OpBitwiseAnd %v3uint %53 %55 + %52 = OpINotEqual %v3bool %56 %18 + %51 = OpSelect %v3uint %52 %18 %58 + %59 = OpLoad %v3uint %x + %60 = OpShiftRightLogical %v3uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v3uint %x + %66 = OpBitwiseAnd %v3uint %63 %65 + %62 = OpINotEqual %v3bool %66 %18 + %61 = OpSelect %v3uint %62 %18 %65 + %68 = OpLoad %v3uint %x + %69 = OpIEqual %v3bool %68 %18 + %67 = OpSelect %v3uint %69 %71 %18 + %73 = OpBitwiseOr %v3uint %19 %31 + %74 = OpBitwiseOr %v3uint %73 %41 + %75 = OpBitwiseOr %v3uint %74 %51 + %76 = OpBitwiseOr %v3uint %75 %61 + %77 = OpBitwiseOr %v3uint %76 %67 + OpReturnValue %77 + OpFunctionEnd +%firstTrailingBit_cb51ce = OpFunction %void None %78 + %81 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %18 + %82 = OpFunctionCall %v3uint %tint_first_trailing_bit %65 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %84 + %86 = OpLabel + %87 = OpFunctionCall %void %firstTrailingBit_cb51ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %89 = OpLabel + %90 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %90 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %93 = OpLabel + %94 = OpFunctionCall %void %firstTrailingBit_cb51ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %96 = OpLabel + %97 = OpFunctionCall %void %firstTrailingBit_cb51ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..e18b54e3c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/firstTrailingBit/cb51ce.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn firstTrailingBit_cb51ce() { + var res : vec3 = firstTrailingBit(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_cb51ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_cb51ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_cb51ce(); +} diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl new file mode 100644 index 0000000000..bbe70eeaef --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<3, f16>) -> vec<3, f16> +fn floor_3802c0() { + var res: vec3 = floor(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3802c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3802c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3802c0(); +} diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abaa1f39e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_3802c0() { + vector res = floor((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3802c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3802c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2257a33697 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void floor_3802c0() { + vector res = floor((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3802c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3802c0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024B0BC4CD50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl new file mode 100644 index 0000000000..0ffee0a5f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_3802c0() { + f16vec3 res = floor(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + floor_3802c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_3802c0() { + f16vec3 res = floor(f16vec3(0.0hf)); +} + +void fragment_main() { + floor_3802c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_3802c0() { + f16vec3 res = floor(f16vec3(0.0hf)); +} + +void compute_main() { + floor_3802c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl new file mode 100644 index 0000000000..b74bfc8bf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_3802c0() { + half3 res = floor(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_3802c0(); + return; +} + +kernel void compute_main() { + floor_3802c0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..840d0b0efc --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_3802c0 "floor_3802c0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_3802c0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Floor %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %floor_3802c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %floor_3802c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %floor_3802c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..454c66907c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn floor_3802c0() { + var res : vec3 = floor(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3802c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3802c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3802c0(); +} diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl new file mode 100644 index 0000000000..2f2e73c5c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(vec<4, f32>) -> vec<4, f32> +fn floor_3bccc4() { + var res: vec4 = floor(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3bccc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3bccc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3bccc4(); +} diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4f77c085bf --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_3bccc4() { + float4 res = floor((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3bccc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3bccc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3bccc4(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f77c085bf --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void floor_3bccc4() { + float4 res = floor((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3bccc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3bccc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3bccc4(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl new file mode 100644 index 0000000000..a37a4dc5c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void floor_3bccc4() { + vec4 res = floor(vec4(1.0f)); +} + +vec4 vertex_main() { + floor_3bccc4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_3bccc4() { + vec4 res = floor(vec4(1.0f)); +} + +void fragment_main() { + floor_3bccc4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_3bccc4() { + vec4 res = floor(vec4(1.0f)); +} + +void compute_main() { + floor_3bccc4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl new file mode 100644 index 0000000000..a5d5b84763 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_3bccc4() { + float4 res = floor(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_3bccc4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_3bccc4(); + return; +} + +kernel void compute_main() { + floor_3bccc4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9dd56bd14 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_3bccc4 "floor_3bccc4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%floor_3bccc4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Floor %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %floor_3bccc4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %floor_3bccc4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %floor_3bccc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ad4e281ac --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn floor_3bccc4() { + var res : vec4 = floor(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3bccc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3bccc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3bccc4(); +} diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl new file mode 100644 index 0000000000..9f138ce5b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(vec<2, f32>) -> vec<2, f32> +fn floor_5fc9ac() { + var res: vec2 = floor(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_5fc9ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_5fc9ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_5fc9ac(); +} diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..80235f73c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_5fc9ac() { + float2 res = floor((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_5fc9ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_5fc9ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_5fc9ac(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80235f73c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void floor_5fc9ac() { + float2 res = floor((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_5fc9ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_5fc9ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_5fc9ac(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl new file mode 100644 index 0000000000..61482410a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void floor_5fc9ac() { + vec2 res = floor(vec2(1.0f)); +} + +vec4 vertex_main() { + floor_5fc9ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_5fc9ac() { + vec2 res = floor(vec2(1.0f)); +} + +void fragment_main() { + floor_5fc9ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_5fc9ac() { + vec2 res = floor(vec2(1.0f)); +} + +void compute_main() { + floor_5fc9ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl new file mode 100644 index 0000000000..ccc2e384ff --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_5fc9ac() { + float2 res = floor(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_5fc9ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_5fc9ac(); + return; +} + +kernel void compute_main() { + floor_5fc9ac(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..6396eb712f --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_5fc9ac "floor_5fc9ac" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%floor_5fc9ac = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Floor %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %floor_5fc9ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %floor_5fc9ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %floor_5fc9ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..caa758186b --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn floor_5fc9ac() { + var res : vec2 = floor(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_5fc9ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_5fc9ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_5fc9ac(); +} diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl new file mode 100644 index 0000000000..764a472387 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(vec<3, f32>) -> vec<3, f32> +fn floor_60d7ea() { + var res: vec3 = floor(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_60d7ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_60d7ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_60d7ea(); +} diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..726fd06288 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_60d7ea() { + float3 res = floor((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_60d7ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_60d7ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_60d7ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..726fd06288 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void floor_60d7ea() { + float3 res = floor((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_60d7ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_60d7ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_60d7ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl new file mode 100644 index 0000000000..38ae3c168c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void floor_60d7ea() { + vec3 res = floor(vec3(1.0f)); +} + +vec4 vertex_main() { + floor_60d7ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_60d7ea() { + vec3 res = floor(vec3(1.0f)); +} + +void fragment_main() { + floor_60d7ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_60d7ea() { + vec3 res = floor(vec3(1.0f)); +} + +void compute_main() { + floor_60d7ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl new file mode 100644 index 0000000000..cc96d6f915 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_60d7ea() { + float3 res = floor(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_60d7ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_60d7ea(); + return; +} + +kernel void compute_main() { + floor_60d7ea(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..77f35170ee --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_60d7ea "floor_60d7ea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%floor_60d7ea = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Floor %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %floor_60d7ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %floor_60d7ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %floor_60d7ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..1403c179e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn floor_60d7ea() { + var res : vec3 = floor(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_60d7ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_60d7ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_60d7ea(); +} diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl new file mode 100644 index 0000000000..520664bf3c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(f32) -> f32 +fn floor_66f154() { + var res: f32 = floor(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_66f154(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_66f154(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_66f154(); +} diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..89b5a35bc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_66f154() { + float res = floor(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_66f154(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_66f154(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_66f154(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..89b5a35bc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void floor_66f154() { + float res = floor(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_66f154(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_66f154(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_66f154(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl new file mode 100644 index 0000000000..26dcf94cc8 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void floor_66f154() { + float res = floor(1.0f); +} + +vec4 vertex_main() { + floor_66f154(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_66f154() { + float res = floor(1.0f); +} + +void fragment_main() { + floor_66f154(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_66f154() { + float res = floor(1.0f); +} + +void compute_main() { + floor_66f154(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl new file mode 100644 index 0000000000..ca6f3e8d96 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_66f154() { + float res = floor(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_66f154(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_66f154(); + return; +} + +kernel void compute_main() { + floor_66f154(); + return; +} + diff --git a/test/tint/builtins/gen/floor/66f154.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/floor/66f154.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl new file mode 100644 index 0000000000..2451e66b9a --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn floor_66f154() { + var res : f32 = floor(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_66f154(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_66f154(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_66f154(); +} diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl new file mode 100644 index 0000000000..77a94d5e7c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<2, f16>) -> vec<2, f16> +fn floor_84658c() { + var res: vec2 = floor(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_84658c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_84658c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_84658c(); +} diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9d9b33b406 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_84658c() { + vector res = floor((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_84658c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_84658c(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a7f1d0452d --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void floor_84658c() { + vector res = floor((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_84658c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_84658c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F339C96B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl new file mode 100644 index 0000000000..5ce59ffcb5 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_84658c() { + f16vec2 res = floor(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + floor_84658c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_84658c() { + f16vec2 res = floor(f16vec2(0.0hf)); +} + +void fragment_main() { + floor_84658c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_84658c() { + f16vec2 res = floor(f16vec2(0.0hf)); +} + +void compute_main() { + floor_84658c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl new file mode 100644 index 0000000000..8167d864e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_84658c() { + half2 res = floor(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_84658c(); + return; +} + +kernel void compute_main() { + floor_84658c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm new file mode 100644 index 0000000000..2ba5308c85 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_84658c "floor_84658c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_84658c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Floor %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %floor_84658c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %floor_84658c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %floor_84658c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl new file mode 100644 index 0000000000..bbf2ee4968 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn floor_84658c() { + var res : vec2 = floor(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_84658c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_84658c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_84658c(); +} diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl new file mode 100644 index 0000000000..f64f4ec30c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<4, f16>) -> vec<4, f16> +fn floor_a2d31b() { + var res: vec4 = floor(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_a2d31b(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_a2d31b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_a2d31b(); +} diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8df627e0d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_a2d31b() { + vector res = floor((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_a2d31b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_a2d31b(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2503575088 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void floor_a2d31b() { + vector res = floor((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_a2d31b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_a2d31b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A78E20C3E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl new file mode 100644 index 0000000000..fa86b13918 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_a2d31b() { + f16vec4 res = floor(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + floor_a2d31b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_a2d31b() { + f16vec4 res = floor(f16vec4(0.0hf)); +} + +void fragment_main() { + floor_a2d31b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_a2d31b() { + f16vec4 res = floor(f16vec4(0.0hf)); +} + +void compute_main() { + floor_a2d31b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl new file mode 100644 index 0000000000..11dab7e86c --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_a2d31b() { + half4 res = floor(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_a2d31b(); + return; +} + +kernel void compute_main() { + floor_a2d31b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm new file mode 100644 index 0000000000..f54987e285 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_a2d31b "floor_a2d31b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_a2d31b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Floor %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %floor_a2d31b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %floor_a2d31b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %floor_a2d31b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl new file mode 100644 index 0000000000..54977de3dc --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn floor_a2d31b() { + var res : vec4 = floor(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_a2d31b(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_a2d31b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_a2d31b(); +} diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl new file mode 100644 index 0000000000..5defc3121b --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(f16) -> f16 +fn floor_b6e09c() { + var res: f16 = floor(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_b6e09c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_b6e09c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_b6e09c(); +} diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e9023c6f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void floor_b6e09c() { + float16_t res = floor(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_b6e09c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_b6e09c(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b56d8ce344 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void floor_b6e09c() { + float16_t res = floor(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_b6e09c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_b6e09c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002DCF5190520(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002DCF5190520(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl new file mode 100644 index 0000000000..9e3b55de60 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_b6e09c() { + float16_t res = floor(0.0hf); +} + +vec4 vertex_main() { + floor_b6e09c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_b6e09c() { + float16_t res = floor(0.0hf); +} + +void fragment_main() { + floor_b6e09c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_b6e09c() { + float16_t res = floor(0.0hf); +} + +void compute_main() { + floor_b6e09c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl new file mode 100644 index 0000000000..5123ed2bb5 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void floor_b6e09c() { + half res = floor(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_b6e09c(); + return; +} + +kernel void compute_main() { + floor_b6e09c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d351dd750 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_b6e09c "floor_b6e09c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_b6e09c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Floor %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %floor_b6e09c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %floor_b6e09c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_b6e09c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl new file mode 100644 index 0000000000..59a04ccd30 --- /dev/null +++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn floor_b6e09c() { + var res : f16 = floor(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_b6e09c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_b6e09c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_b6e09c(); +} diff --git a/test/tint/builtins/gen/literal/fma/26a7a9.wgsl b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl new file mode 100644 index 0000000000..3f3b6c7850 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn fma_26a7a9() { + var res: vec2 = fma(vec2(1.f), vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_26a7a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_26a7a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_26a7a9(); +} diff --git a/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d58d1dbb11 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_26a7a9() { + float2 res = mad((1.0f).xx, (1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_26a7a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_26a7a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_26a7a9(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d58d1dbb11 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void fma_26a7a9() { + float2 res = mad((1.0f).xx, (1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_26a7a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_26a7a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_26a7a9(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.glsl new file mode 100644 index 0000000000..1905d1615b --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void fma_26a7a9() { + vec2 res = ((vec2(1.0f)) * (vec2(1.0f)) + (vec2(1.0f))); +} + +vec4 vertex_main() { + fma_26a7a9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_26a7a9() { + vec2 res = ((vec2(1.0f)) * (vec2(1.0f)) + (vec2(1.0f))); +} + +void fragment_main() { + fma_26a7a9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_26a7a9() { + vec2 res = ((vec2(1.0f)) * (vec2(1.0f)) + (vec2(1.0f))); +} + +void compute_main() { + fma_26a7a9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.msl new file mode 100644 index 0000000000..98fe6440fe --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_26a7a9() { + float2 res = fma(float2(1.0f), float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_26a7a9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_26a7a9(); + return; +} + +kernel void compute_main() { + fma_26a7a9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e2385e2b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_26a7a9 "fma_26a7a9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %fma_26a7a9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Fma %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %fma_26a7a9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_26a7a9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_26a7a9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.wgsl new file mode 100644 index 0000000000..b58dda7480 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/26a7a9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn fma_26a7a9() { + var res : vec2 = fma(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_26a7a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_26a7a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_26a7a9(); +} diff --git a/test/tint/builtins/gen/literal/fma/6a3283.wgsl b/test/tint/builtins/gen/literal/fma/6a3283.wgsl new file mode 100644 index 0000000000..e38f85705a --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/6a3283.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn fma_6a3283() { + var res: vec4 = fma(vec4(1.f), vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_6a3283(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_6a3283(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_6a3283(); +} diff --git a/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8959dfa17a --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_6a3283() { + float4 res = mad((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_6a3283(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_6a3283(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_6a3283(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8959dfa17a --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void fma_6a3283() { + float4 res = mad((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_6a3283(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_6a3283(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_6a3283(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.glsl new file mode 100644 index 0000000000..96bc9f232b --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void fma_6a3283() { + vec4 res = ((vec4(1.0f)) * (vec4(1.0f)) + (vec4(1.0f))); +} + +vec4 vertex_main() { + fma_6a3283(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_6a3283() { + vec4 res = ((vec4(1.0f)) * (vec4(1.0f)) + (vec4(1.0f))); +} + +void fragment_main() { + fma_6a3283(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_6a3283() { + vec4 res = ((vec4(1.0f)) * (vec4(1.0f)) + (vec4(1.0f))); +} + +void compute_main() { + fma_6a3283(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.msl new file mode 100644 index 0000000000..6c675c1166 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_6a3283() { + float4 res = fma(float4(1.0f), float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_6a3283(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_6a3283(); + return; +} + +kernel void compute_main() { + fma_6a3283(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.spvasm new file mode 100644 index 0000000000..197b06b98a --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_6a3283 "fma_6a3283" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %fma_6a3283 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Fma %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %fma_6a3283 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %fma_6a3283 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %fma_6a3283 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.wgsl new file mode 100644 index 0000000000..4a60892f3d --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/6a3283.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn fma_6a3283() { + var res : vec4 = fma(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_6a3283(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_6a3283(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_6a3283(); +} diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl new file mode 100644 index 0000000000..025402375f --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn fma_ab7818() { + var res: vec4 = fma(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_ab7818(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_ab7818(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_ab7818(); +} diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0621f2a731 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_ab7818() { + vector res = mad((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_ab7818(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_ab7818(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4aee5aeb13 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fma_ab7818() { + vector res = mad((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_ab7818(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_ab7818(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000130923E6FF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.glsl new file mode 100644 index 0000000000..ea533429c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_ab7818() { + f16vec4 res = ((f16vec4(0.0hf)) * (f16vec4(0.0hf)) + (f16vec4(0.0hf))); +} + +vec4 vertex_main() { + fma_ab7818(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_ab7818() { + f16vec4 res = ((f16vec4(0.0hf)) * (f16vec4(0.0hf)) + (f16vec4(0.0hf))); +} + +void fragment_main() { + fma_ab7818(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_ab7818() { + f16vec4 res = ((f16vec4(0.0hf)) * (f16vec4(0.0hf)) + (f16vec4(0.0hf))); +} + +void compute_main() { + fma_ab7818(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.msl new file mode 100644 index 0000000000..1e222235cf --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_ab7818() { + half4 res = fma(half4(0.0h), half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_ab7818(); + return; +} + +kernel void compute_main() { + fma_ab7818(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5bc45f0a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_ab7818 "fma_ab7818" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_ab7818 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Fma %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fma_ab7818 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_ab7818 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_ab7818 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.wgsl new file mode 100644 index 0000000000..0732ab88bc --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/ab7818.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fma_ab7818() { + var res : vec4 = fma(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_ab7818(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_ab7818(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_ab7818(); +} diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl new file mode 100644 index 0000000000..332799fe60 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn fma_bf21b6() { + var res: vec2 = fma(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_bf21b6(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_bf21b6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_bf21b6(); +} diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..85963f933f --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_bf21b6() { + vector res = mad((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_bf21b6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_bf21b6(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cad7d14572 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fma_bf21b6() { + vector res = mad((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_bf21b6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_bf21b6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018F50BF5D50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.glsl new file mode 100644 index 0000000000..576c850f0d --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_bf21b6() { + f16vec2 res = ((f16vec2(0.0hf)) * (f16vec2(0.0hf)) + (f16vec2(0.0hf))); +} + +vec4 vertex_main() { + fma_bf21b6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_bf21b6() { + f16vec2 res = ((f16vec2(0.0hf)) * (f16vec2(0.0hf)) + (f16vec2(0.0hf))); +} + +void fragment_main() { + fma_bf21b6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_bf21b6() { + f16vec2 res = ((f16vec2(0.0hf)) * (f16vec2(0.0hf)) + (f16vec2(0.0hf))); +} + +void compute_main() { + fma_bf21b6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.msl new file mode 100644 index 0000000000..7d0d9dfe47 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_bf21b6() { + half2 res = fma(half2(0.0h), half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_bf21b6(); + return; +} + +kernel void compute_main() { + fma_bf21b6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.spvasm new file mode 100644 index 0000000000..4759d350cd --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_bf21b6 "fma_bf21b6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_bf21b6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Fma %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fma_bf21b6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_bf21b6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_bf21b6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.wgsl new file mode 100644 index 0000000000..dcd733b4e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/bf21b6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fma_bf21b6() { + var res : vec2 = fma(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_bf21b6(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_bf21b6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_bf21b6(); +} diff --git a/test/tint/builtins/gen/literal/fma/c10ba3.wgsl b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl new file mode 100644 index 0000000000..8d5b6163b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(f32, f32, f32) -> f32 +fn fma_c10ba3() { + var res: f32 = fma(1.f, 1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c10ba3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c10ba3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c10ba3(); +} diff --git a/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..88e5bb2cff --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_c10ba3() { + float res = mad(1.0f, 1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c10ba3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c10ba3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c10ba3(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..88e5bb2cff --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void fma_c10ba3() { + float res = mad(1.0f, 1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c10ba3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c10ba3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c10ba3(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.glsl new file mode 100644 index 0000000000..611c0b660c --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void fma_c10ba3() { + float res = ((1.0f) * (1.0f) + (1.0f)); +} + +vec4 vertex_main() { + fma_c10ba3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_c10ba3() { + float res = ((1.0f) * (1.0f) + (1.0f)); +} + +void fragment_main() { + fma_c10ba3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_c10ba3() { + float res = ((1.0f) * (1.0f) + (1.0f)); +} + +void compute_main() { + fma_c10ba3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.msl new file mode 100644 index 0000000000..9f6001806b --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_c10ba3() { + float res = fma(1.0f, 1.0f, 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_c10ba3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_c10ba3(); + return; +} + +kernel void compute_main() { + fma_c10ba3(); + return; +} + diff --git a/test/tint/builtins/gen/fma/c10ba3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/fma/c10ba3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.wgsl new file mode 100644 index 0000000000..178dcd2dc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c10ba3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn fma_c10ba3() { + var res : f32 = fma(1.0f, 1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c10ba3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c10ba3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c10ba3(); +} diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl new file mode 100644 index 0000000000..5e605cc7a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(f16, f16, f16) -> f16 +fn fma_c8abb3() { + var res: f16 = fma(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c8abb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c8abb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c8abb3(); +} diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..02d0e31166 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_c8abb3() { + float16_t res = mad(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c8abb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c8abb3(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ce74e5a5c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void fma_c8abb3() { + float16_t res = mad(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c8abb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c8abb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A4E652BA80(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A4E652BA80(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.glsl new file mode 100644 index 0000000000..86e6a49ed2 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_c8abb3() { + float16_t res = ((0.0hf) * (0.0hf) + (0.0hf)); +} + +vec4 vertex_main() { + fma_c8abb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_c8abb3() { + float16_t res = ((0.0hf) * (0.0hf) + (0.0hf)); +} + +void fragment_main() { + fma_c8abb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_c8abb3() { + float16_t res = ((0.0hf) * (0.0hf) + (0.0hf)); +} + +void compute_main() { + fma_c8abb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.msl new file mode 100644 index 0000000000..9222c9b236 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_c8abb3() { + half res = fma(0.0h, 0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_c8abb3(); + return; +} + +kernel void compute_main() { + fma_c8abb3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc7d248451 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_c8abb3 "fma_c8abb3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_c8abb3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Fma %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %fma_c8abb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %fma_c8abb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fma_c8abb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..44eba4373c --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/c8abb3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fma_c8abb3() { + var res : f16 = fma(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c8abb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c8abb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c8abb3(); +} diff --git a/test/tint/builtins/gen/literal/fma/e17c5c.wgsl b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl new file mode 100644 index 0000000000..b167e37b5e --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn fma_e17c5c() { + var res: vec3 = fma(vec3(1.f), vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e17c5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e17c5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e17c5c(); +} diff --git a/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..89cd7e83db --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_e17c5c() { + float3 res = mad((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e17c5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e17c5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e17c5c(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..89cd7e83db --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void fma_e17c5c() { + float3 res = mad((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e17c5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e17c5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e17c5c(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.glsl new file mode 100644 index 0000000000..d1b1d2ee1f --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void fma_e17c5c() { + vec3 res = ((vec3(1.0f)) * (vec3(1.0f)) + (vec3(1.0f))); +} + +vec4 vertex_main() { + fma_e17c5c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_e17c5c() { + vec3 res = ((vec3(1.0f)) * (vec3(1.0f)) + (vec3(1.0f))); +} + +void fragment_main() { + fma_e17c5c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_e17c5c() { + vec3 res = ((vec3(1.0f)) * (vec3(1.0f)) + (vec3(1.0f))); +} + +void compute_main() { + fma_e17c5c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.msl new file mode 100644 index 0000000000..469605fc25 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_e17c5c() { + float3 res = fma(float3(1.0f), float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_e17c5c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_e17c5c(); + return; +} + +kernel void compute_main() { + fma_e17c5c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1d385b819 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_e17c5c "fma_e17c5c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %fma_e17c5c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Fma %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %fma_e17c5c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_e17c5c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_e17c5c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ddabbe7a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e17c5c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn fma_e17c5c() { + var res : vec3 = fma(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e17c5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e17c5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e17c5c(); +} diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl new file mode 100644 index 0000000000..765d3e6349 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn fma_e7abdc() { + var res: vec3 = fma(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e7abdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e7abdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e7abdc(); +} diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ab1666763 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fma_e7abdc() { + vector res = mad((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e7abdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e7abdc(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d0f609c60 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fma_e7abdc() { + vector res = mad((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e7abdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e7abdc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A860253980(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.glsl new file mode 100644 index 0000000000..c4e4c74171 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_e7abdc() { + f16vec3 res = ((f16vec3(0.0hf)) * (f16vec3(0.0hf)) + (f16vec3(0.0hf))); +} + +vec4 vertex_main() { + fma_e7abdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_e7abdc() { + f16vec3 res = ((f16vec3(0.0hf)) * (f16vec3(0.0hf)) + (f16vec3(0.0hf))); +} + +void fragment_main() { + fma_e7abdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_e7abdc() { + f16vec3 res = ((f16vec3(0.0hf)) * (f16vec3(0.0hf)) + (f16vec3(0.0hf))); +} + +void compute_main() { + fma_e7abdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.msl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.msl new file mode 100644 index 0000000000..3622508c6c --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fma_e7abdc() { + half3 res = fma(half3(0.0h), half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_e7abdc(); + return; +} + +kernel void compute_main() { + fma_e7abdc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..daa3de58c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_e7abdc "fma_e7abdc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_e7abdc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Fma %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fma_e7abdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_e7abdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_e7abdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..45afac175a --- /dev/null +++ b/test/tint/builtins/gen/literal/fma/e7abdc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fma_e7abdc() { + var res : vec3 = fma(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e7abdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e7abdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e7abdc(); +} diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl new file mode 100644 index 0000000000..df799a0bec --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<2, f16>) -> vec<2, f16> +fn fract_181aa9() { + var res: vec2 = fract(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_181aa9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_181aa9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_181aa9(); +} diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ff11d3850a --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_181aa9() { + vector res = frac((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_181aa9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_181aa9(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6bb42ea23 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fract_181aa9() { + vector res = frac((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_181aa9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_181aa9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021E70B80AC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.glsl new file mode 100644 index 0000000000..1e4d6bf48b --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_181aa9() { + f16vec2 res = fract(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + fract_181aa9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_181aa9() { + f16vec2 res = fract(f16vec2(0.0hf)); +} + +void fragment_main() { + fract_181aa9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_181aa9() { + f16vec2 res = fract(f16vec2(0.0hf)); +} + +void compute_main() { + fract_181aa9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.msl new file mode 100644 index 0000000000..b807118476 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_181aa9() { + half2 res = fract(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_181aa9(); + return; +} + +kernel void compute_main() { + fract_181aa9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.spvasm new file mode 100644 index 0000000000..1bd3c4f73b --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_181aa9 "fract_181aa9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_181aa9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Fract %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fract_181aa9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fract_181aa9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fract_181aa9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.wgsl new file mode 100644 index 0000000000..fbad3966ae --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/181aa9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fract_181aa9() { + var res : vec2 = fract(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_181aa9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_181aa9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_181aa9(); +} diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl new file mode 100644 index 0000000000..5f4dd0e9f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<4, f16>) -> vec<4, f16> +fn fract_498c77() { + var res: vec4 = fract(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_498c77(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_498c77(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_498c77(); +} diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b6fe7b1074 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_498c77() { + vector res = frac((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_498c77(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_498c77(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..579a05a4bf --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fract_498c77() { + vector res = frac((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_498c77(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_498c77(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000293E8528810(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.glsl new file mode 100644 index 0000000000..352a8ee81f --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_498c77() { + f16vec4 res = fract(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + fract_498c77(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_498c77() { + f16vec4 res = fract(f16vec4(0.0hf)); +} + +void fragment_main() { + fract_498c77(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_498c77() { + f16vec4 res = fract(f16vec4(0.0hf)); +} + +void compute_main() { + fract_498c77(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.msl new file mode 100644 index 0000000000..02f42f436c --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_498c77() { + half4 res = fract(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_498c77(); + return; +} + +kernel void compute_main() { + fract_498c77(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ab3fda8d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_498c77 "fract_498c77" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_498c77 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Fract %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fract_498c77 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fract_498c77 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fract_498c77 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.wgsl new file mode 100644 index 0000000000..33a0794881 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/498c77.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fract_498c77() { + var res : vec4 = fract(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_498c77(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_498c77(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_498c77(); +} diff --git a/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl new file mode 100644 index 0000000000..46d97416eb --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(vec<4, f32>) -> vec<4, f32> +fn fract_8bc1e9() { + var res: vec4 = fract(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_8bc1e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_8bc1e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_8bc1e9(); +} diff --git a/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f6a454cc2a --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_8bc1e9() { + float4 res = frac((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_8bc1e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_8bc1e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_8bc1e9(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6a454cc2a --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void fract_8bc1e9() { + float4 res = frac((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_8bc1e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_8bc1e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_8bc1e9(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.glsl new file mode 100644 index 0000000000..e89b9d8eb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void fract_8bc1e9() { + vec4 res = fract(vec4(1.0f)); +} + +vec4 vertex_main() { + fract_8bc1e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_8bc1e9() { + vec4 res = fract(vec4(1.0f)); +} + +void fragment_main() { + fract_8bc1e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_8bc1e9() { + vec4 res = fract(vec4(1.0f)); +} + +void compute_main() { + fract_8bc1e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.msl new file mode 100644 index 0000000000..97bbceff93 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_8bc1e9() { + float4 res = fract(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_8bc1e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_8bc1e9(); + return; +} + +kernel void compute_main() { + fract_8bc1e9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f9bdc348c --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_8bc1e9 "fract_8bc1e9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%fract_8bc1e9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Fract %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %fract_8bc1e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %fract_8bc1e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %fract_8bc1e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c9911588a --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/8bc1e9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn fract_8bc1e9() { + var res : vec4 = fract(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_8bc1e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_8bc1e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_8bc1e9(); +} diff --git a/test/tint/builtins/gen/literal/fract/943cb1.wgsl b/test/tint/builtins/gen/literal/fract/943cb1.wgsl new file mode 100644 index 0000000000..2ccd8f1d0f --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/943cb1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(vec<2, f32>) -> vec<2, f32> +fn fract_943cb1() { + var res: vec2 = fract(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_943cb1(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_943cb1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_943cb1(); +} diff --git a/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..60f7ce1dd2 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_943cb1() { + float2 res = frac((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_943cb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_943cb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_943cb1(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60f7ce1dd2 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void fract_943cb1() { + float2 res = frac((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_943cb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_943cb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_943cb1(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.glsl new file mode 100644 index 0000000000..c463977b85 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void fract_943cb1() { + vec2 res = fract(vec2(1.0f)); +} + +vec4 vertex_main() { + fract_943cb1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_943cb1() { + vec2 res = fract(vec2(1.0f)); +} + +void fragment_main() { + fract_943cb1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_943cb1() { + vec2 res = fract(vec2(1.0f)); +} + +void compute_main() { + fract_943cb1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.msl new file mode 100644 index 0000000000..ea16cd92b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_943cb1() { + float2 res = fract(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_943cb1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_943cb1(); + return; +} + +kernel void compute_main() { + fract_943cb1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.spvasm new file mode 100644 index 0000000000..debfe32032 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_943cb1 "fract_943cb1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%fract_943cb1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Fract %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %fract_943cb1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fract_943cb1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fract_943cb1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.wgsl new file mode 100644 index 0000000000..21a6738bf6 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/943cb1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn fract_943cb1() { + var res : vec2 = fract(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_943cb1(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_943cb1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_943cb1(); +} diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl new file mode 100644 index 0000000000..a2c98fd09f --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<3, f16>) -> vec<3, f16> +fn fract_958a1d() { + var res: vec3 = fract(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_958a1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_958a1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_958a1d(); +} diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c8e9a6ccc --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_958a1d() { + vector res = frac((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_958a1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_958a1d(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f2fcd481b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void fract_958a1d() { + vector res = frac((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_958a1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_958a1d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001490DA5B940(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.glsl new file mode 100644 index 0000000000..19520f77f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_958a1d() { + f16vec3 res = fract(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + fract_958a1d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_958a1d() { + f16vec3 res = fract(f16vec3(0.0hf)); +} + +void fragment_main() { + fract_958a1d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_958a1d() { + f16vec3 res = fract(f16vec3(0.0hf)); +} + +void compute_main() { + fract_958a1d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.msl new file mode 100644 index 0000000000..fb0e54ae3e --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_958a1d() { + half3 res = fract(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_958a1d(); + return; +} + +kernel void compute_main() { + fract_958a1d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..ea074c7a12 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_958a1d "fract_958a1d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_958a1d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Fract %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fract_958a1d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fract_958a1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fract_958a1d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5cafe6b0e --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/958a1d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fract_958a1d() { + var res : vec3 = fract(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_958a1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_958a1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_958a1d(); +} diff --git a/test/tint/builtins/gen/literal/fract/a49758.wgsl b/test/tint/builtins/gen/literal/fract/a49758.wgsl new file mode 100644 index 0000000000..3b4ea3086f --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/a49758.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(vec<3, f32>) -> vec<3, f32> +fn fract_a49758() { + var res: vec3 = fract(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_a49758(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_a49758(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_a49758(); +} diff --git a/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad679713ef --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_a49758() { + float3 res = frac((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_a49758(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_a49758(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_a49758(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad679713ef --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void fract_a49758() { + float3 res = frac((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_a49758(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_a49758(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_a49758(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.glsl new file mode 100644 index 0000000000..d6c541506b --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void fract_a49758() { + vec3 res = fract(vec3(1.0f)); +} + +vec4 vertex_main() { + fract_a49758(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_a49758() { + vec3 res = fract(vec3(1.0f)); +} + +void fragment_main() { + fract_a49758(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_a49758() { + vec3 res = fract(vec3(1.0f)); +} + +void compute_main() { + fract_a49758(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.msl new file mode 100644 index 0000000000..c59b0defe6 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_a49758() { + float3 res = fract(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_a49758(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_a49758(); + return; +} + +kernel void compute_main() { + fract_a49758(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.spvasm new file mode 100644 index 0000000000..e132589760 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_a49758 "fract_a49758" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%fract_a49758 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Fract %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %fract_a49758 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fract_a49758 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fract_a49758 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.wgsl new file mode 100644 index 0000000000..70c82507aa --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/a49758.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn fract_a49758() { + var res : vec3 = fract(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_a49758(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_a49758(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_a49758(); +} diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl new file mode 100644 index 0000000000..e502ba9884 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(f16) -> f16 +fn fract_eb38ce() { + var res: f16 = fract(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_eb38ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_eb38ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_eb38ce(); +} diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ffebafe253 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_eb38ce() { + float16_t res = frac(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_eb38ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_eb38ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bccb6efce --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void fract_eb38ce() { + float16_t res = frac(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_eb38ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_eb38ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000230E569A8C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000230E569A8C0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.glsl new file mode 100644 index 0000000000..ba80d87081 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_eb38ce() { + float16_t res = fract(0.0hf); +} + +vec4 vertex_main() { + fract_eb38ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_eb38ce() { + float16_t res = fract(0.0hf); +} + +void fragment_main() { + fract_eb38ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_eb38ce() { + float16_t res = fract(0.0hf); +} + +void compute_main() { + fract_eb38ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.msl new file mode 100644 index 0000000000..7b6600f5bd --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_eb38ce() { + half res = fract(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_eb38ce(); + return; +} + +kernel void compute_main() { + fract_eb38ce(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..0cb23c02dc --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_eb38ce "fract_eb38ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_eb38ce = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Fract %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %fract_eb38ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %fract_eb38ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_eb38ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..11a5545e7b --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/eb38ce.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn fract_eb38ce() { + var res : f16 = fract(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_eb38ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_eb38ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_eb38ce(); +} diff --git a/test/tint/builtins/gen/literal/fract/fa5c71.wgsl b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl new file mode 100644 index 0000000000..1fb7db0bc9 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(f32) -> f32 +fn fract_fa5c71() { + var res: f32 = fract(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_fa5c71(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_fa5c71(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_fa5c71(); +} diff --git a/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dcf44fde3b --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void fract_fa5c71() { + float res = frac(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_fa5c71(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_fa5c71(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_fa5c71(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dcf44fde3b --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void fract_fa5c71() { + float res = frac(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_fa5c71(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_fa5c71(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_fa5c71(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.glsl new file mode 100644 index 0000000000..6bc91bfbc1 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void fract_fa5c71() { + float res = fract(1.0f); +} + +vec4 vertex_main() { + fract_fa5c71(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_fa5c71() { + float res = fract(1.0f); +} + +void fragment_main() { + fract_fa5c71(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_fa5c71() { + float res = fract(1.0f); +} + +void compute_main() { + fract_fa5c71(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.msl b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.msl new file mode 100644 index 0000000000..50baf320af --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void fract_fa5c71() { + float res = fract(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_fa5c71(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_fa5c71(); + return; +} + +kernel void compute_main() { + fract_fa5c71(); + return; +} + diff --git a/test/tint/builtins/gen/fract/fa5c71.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/fract/fa5c71.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.wgsl new file mode 100644 index 0000000000..431666aec2 --- /dev/null +++ b/test/tint/builtins/gen/literal/fract/fa5c71.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn fract_fa5c71() { + var res : f32 = fract(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_fa5c71(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_fa5c71(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_fa5c71(); +} diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl new file mode 100644 index 0000000000..12ecb47908 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<4, f16>) -> __frexp_result_vec<4, f16> +fn frexp_3dd21e() { + var res = frexp(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_3dd21e(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_3dd21e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_3dd21e(); +} diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a2155f1540 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec4_f16 { + vector sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec4_f16 result = {sig, int4(exp)}; + return result; +} + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_3dd21e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_3dd21e(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..45fbb59dc1 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct frexp_result_vec4_f16 { + vector sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec4_f16 result = {sig, int4(exp)}; + return result; +} + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_3dd21e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_3dd21e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D4F5EB9720(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.glsl new file mode 100644 index 0000000000..ba7ca1fd8a --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + frexp_3dd21e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp(f16vec4(0.0hf)); +} + +void fragment_main() { + frexp_3dd21e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp(f16vec4(0.0hf)); +} + +void compute_main() { + frexp_3dd21e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.msl new file mode 100644 index 0000000000..91c87e7a29 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_vec4_f16 { + half4 sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(half4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_3dd21e() { + frexp_result_vec4_f16 res = tint_frexp(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_3dd21e(); + return; +} + +kernel void compute_main() { + frexp_3dd21e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.spvasm new file mode 100644 index 0000000000..6585dc03fd --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_3dd21e "frexp_3dd21e" + OpName %__frexp_result_vec4_f16 "__frexp_result_vec4_f16" + OpMemberName %__frexp_result_vec4_f16 0 "sig" + OpMemberName %__frexp_result_vec4_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec4_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec4_f16 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%__frexp_result_vec4_f16 = OpTypeStruct %v4half %v4int + %20 = OpConstantNull %v4half +%_ptr_Function___frexp_result_vec4_f16 = OpTypePointer Function %__frexp_result_vec4_f16 + %23 = OpConstantNull %__frexp_result_vec4_f16 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_3dd21e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_vec4_f16 Function %23 + %13 = OpExtInst %__frexp_result_vec4_f16 %19 FrexpStruct %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_3dd21e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %frexp_3dd21e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_3dd21e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.wgsl new file mode 100644 index 0000000000..a33fbd09cc --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/3dd21e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn frexp_3dd21e() { + var res = frexp(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_3dd21e(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_3dd21e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_3dd21e(); +} diff --git a/test/tint/builtins/gen/literal/frexp/4b2200.wgsl b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl new file mode 100644 index 0000000000..271abc51e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(f32) -> __frexp_result +fn frexp_4b2200() { + var res = frexp(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_4b2200(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_4b2200(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_4b2200(); +} diff --git a/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..15ae2ad0ba --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + float exp; + float sig = frexp(param_0, exp); + frexp_result result = {sig, int(exp)}; + return result; +} + +void frexp_4b2200() { + frexp_result res = tint_frexp(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_4b2200(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_4b2200(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_4b2200(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15ae2ad0ba --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + float exp; + float sig = frexp(param_0, exp); + frexp_result result = {sig, int(exp)}; + return result; +} + +void frexp_4b2200() { + frexp_result res = tint_frexp(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_4b2200(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_4b2200(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_4b2200(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.glsl new file mode 100644 index 0000000000..b9a00adb36 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.glsl @@ -0,0 +1,85 @@ +#version 310 es + +struct frexp_result { + float sig; + int exp; +}; + +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_4b2200() { + frexp_result res = tint_frexp(1.0f); +} + +vec4 vertex_main() { + frexp_4b2200(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result { + float sig; + int exp; +}; + +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_4b2200() { + frexp_result res = tint_frexp(1.0f); +} + +void fragment_main() { + frexp_4b2200(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result { + float sig; + int exp; +}; + +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_4b2200() { + frexp_result res = tint_frexp(1.0f); +} + +void compute_main() { + frexp_4b2200(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.msl new file mode 100644 index 0000000000..175e4510d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_4b2200() { + frexp_result res = tint_frexp(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_4b2200(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_4b2200(); + return; +} + +kernel void compute_main() { + frexp_4b2200(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.spvasm new file mode 100644 index 0000000000..f6d258caec --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_4b2200 "frexp_4b2200" + OpName %__frexp_result "__frexp_result" + OpMemberName %__frexp_result 0 "sig" + OpMemberName %__frexp_result 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result 0 Offset 0 + OpMemberDecorate %__frexp_result 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%__frexp_result = OpTypeStruct %float %int + %float_1 = OpConstant %float 1 +%_ptr_Function___frexp_result = OpTypePointer Function %__frexp_result + %20 = OpConstantNull %__frexp_result + %21 = OpTypeFunction %v4float +%frexp_4b2200 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result Function %20 + %13 = OpExtInst %__frexp_result %16 FrexpStruct %float_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %frexp_4b2200 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %frexp_4b2200 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %frexp_4b2200 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.wgsl new file mode 100644 index 0000000000..92b00df694 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/4b2200.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn frexp_4b2200() { + var res = frexp(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_4b2200(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_4b2200(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_4b2200(); +} diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl new file mode 100644 index 0000000000..6f4f993fda --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(f16) -> __frexp_result +fn frexp_5257dd() { + var res = frexp(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5257dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5257dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5257dd(); +} diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9e34fba082 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_f16 { + float16_t sig; + int exp; +}; +frexp_result_f16 tint_frexp(float16_t param_0) { + float16_t exp; + float16_t sig = frexp(param_0, exp); + frexp_result_f16 result = {sig, int(exp)}; + return result; +} + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5257dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5257dd(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..05c7d5faf9 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; +frexp_result_f16 tint_frexp(float16_t param_0) { + float16_t exp; + float16_t sig = frexp(param_0, exp); + frexp_result_f16 result = {sig, int(exp)}; + return result; +} + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5257dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5257dd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017322E51900(2,3-11): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.glsl new file mode 100644 index 0000000000..f08939ec99 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(0.0hf); +} + +vec4 vertex_main() { + frexp_5257dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(0.0hf); +} + +void fragment_main() { + frexp_5257dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(0.0hf); +} + +void compute_main() { + frexp_5257dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.msl new file mode 100644 index 0000000000..1920b166b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_f16 { + half sig; + int exp; +}; +frexp_result_f16 tint_frexp(half param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_5257dd() { + frexp_result_f16 res = tint_frexp(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_5257dd(); + return; +} + +kernel void compute_main() { + frexp_5257dd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..6c20d394ff --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_5257dd "frexp_5257dd" + OpName %__frexp_result_f16 "__frexp_result_f16" + OpMemberName %__frexp_result_f16 0 "sig" + OpMemberName %__frexp_result_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_f16 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %int = OpTypeInt 32 1 +%__frexp_result_f16 = OpTypeStruct %half %int + %18 = OpConstantNull %half +%_ptr_Function___frexp_result_f16 = OpTypePointer Function %__frexp_result_f16 + %21 = OpConstantNull %__frexp_result_f16 + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_5257dd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_f16 Function %21 + %13 = OpExtInst %__frexp_result_f16 %17 FrexpStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %frexp_5257dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %frexp_5257dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %frexp_5257dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca55834307 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5257dd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn frexp_5257dd() { + var res = frexp(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5257dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5257dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5257dd(); +} diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl new file mode 100644 index 0000000000..7d784db8d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<2, f16>) -> __frexp_result_vec<2, f16> +fn frexp_5f47bf() { + var res = frexp(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5f47bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5f47bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5f47bf(); +} diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b39e0d6b62 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec2_f16 { + vector sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec2_f16 result = {sig, int2(exp)}; + return result; +} + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5f47bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5f47bf(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..acfc0caffc --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct frexp_result_vec2_f16 { + vector sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec2_f16 result = {sig, int2(exp)}; + return result; +} + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5f47bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5f47bf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D35F6E9740(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.glsl new file mode 100644 index 0000000000..4a75e6c260 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + frexp_5f47bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp(f16vec2(0.0hf)); +} + +void fragment_main() { + frexp_5f47bf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp(f16vec2(0.0hf)); +} + +void compute_main() { + frexp_5f47bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.msl new file mode 100644 index 0000000000..a2290a81fb --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_vec2_f16 { + half2 sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(half2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_5f47bf() { + frexp_result_vec2_f16 res = tint_frexp(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_5f47bf(); + return; +} + +kernel void compute_main() { + frexp_5f47bf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1c51b934d --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_5f47bf "frexp_5f47bf" + OpName %__frexp_result_vec2_f16 "__frexp_result_vec2_f16" + OpMemberName %__frexp_result_vec2_f16 0 "sig" + OpMemberName %__frexp_result_vec2_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec2_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec2_f16 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%__frexp_result_vec2_f16 = OpTypeStruct %v2half %v2int + %20 = OpConstantNull %v2half +%_ptr_Function___frexp_result_vec2_f16 = OpTypePointer Function %__frexp_result_vec2_f16 + %23 = OpConstantNull %__frexp_result_vec2_f16 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_5f47bf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_vec2_f16 Function %23 + %13 = OpExtInst %__frexp_result_vec2_f16 %19 FrexpStruct %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_5f47bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %frexp_5f47bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_5f47bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..5dd980e8ed --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/5f47bf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn frexp_5f47bf() { + var res = frexp(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5f47bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5f47bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5f47bf(); +} diff --git a/test/tint/builtins/gen/literal/frexp/77af93.wgsl b/test/tint/builtins/gen/literal/frexp/77af93.wgsl new file mode 100644 index 0000000000..489f812645 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/77af93.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(vec<4, f32>) -> __frexp_result_vec<4, f32> +fn frexp_77af93() { + var res = frexp(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_77af93(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_77af93(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_77af93(); +} diff --git a/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7ef05cb6ac --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec4 { + float4 sig; + int4 exp; +}; +frexp_result_vec4 tint_frexp(float4 param_0) { + float4 exp; + float4 sig = frexp(param_0, exp); + frexp_result_vec4 result = {sig, int4(exp)}; + return result; +} + +void frexp_77af93() { + frexp_result_vec4 res = tint_frexp((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_77af93(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_77af93(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_77af93(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7ef05cb6ac --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec4 { + float4 sig; + int4 exp; +}; +frexp_result_vec4 tint_frexp(float4 param_0) { + float4 exp; + float4 sig = frexp(param_0, exp); + frexp_result_vec4 result = {sig, int4(exp)}; + return result; +} + +void frexp_77af93() { + frexp_result_vec4 res = tint_frexp((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_77af93(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_77af93(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_77af93(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.glsl new file mode 100644 index 0000000000..052733493f --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.glsl @@ -0,0 +1,85 @@ +#version 310 es + +struct frexp_result_vec4 { + vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4 tint_frexp(vec4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_77af93() { + frexp_result_vec4 res = tint_frexp(vec4(1.0f)); +} + +vec4 vertex_main() { + frexp_77af93(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result_vec4 { + vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4 tint_frexp(vec4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_77af93() { + frexp_result_vec4 res = tint_frexp(vec4(1.0f)); +} + +void fragment_main() { + frexp_77af93(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result_vec4 { + vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4 tint_frexp(vec4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_77af93() { + frexp_result_vec4 res = tint_frexp(vec4(1.0f)); +} + +void compute_main() { + frexp_77af93(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.msl new file mode 100644 index 0000000000..2b6c155b63 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_vec4 { + float4 sig; + int4 exp; +}; +frexp_result_vec4 tint_frexp(float4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_77af93() { + frexp_result_vec4 res = tint_frexp(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_77af93(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_77af93(); + return; +} + +kernel void compute_main() { + frexp_77af93(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb7597887c --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_77af93 "frexp_77af93" + OpName %__frexp_result_vec4 "__frexp_result_vec4" + OpMemberName %__frexp_result_vec4 0 "sig" + OpMemberName %__frexp_result_vec4 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec4 0 Offset 0 + OpMemberDecorate %__frexp_result_vec4 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%__frexp_result_vec4 = OpTypeStruct %v4float %v4int + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function___frexp_result_vec4 = OpTypePointer Function %__frexp_result_vec4 + %22 = OpConstantNull %__frexp_result_vec4 + %23 = OpTypeFunction %v4float +%frexp_77af93 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_vec4 Function %22 + %13 = OpExtInst %__frexp_result_vec4 %17 FrexpStruct %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %frexp_77af93 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %frexp_77af93 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %frexp_77af93 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e057ceccf --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/77af93.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn frexp_77af93() { + var res = frexp(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_77af93(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_77af93(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_77af93(); +} diff --git a/test/tint/builtins/gen/literal/frexp/979800.wgsl b/test/tint/builtins/gen/literal/frexp/979800.wgsl new file mode 100644 index 0000000000..24f121781b --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/979800.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(vec<3, f32>) -> __frexp_result_vec<3, f32> +fn frexp_979800() { + var res = frexp(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_979800(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_979800(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_979800(); +} diff --git a/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1152ca2026 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec3 { + float3 sig; + int3 exp; +}; +frexp_result_vec3 tint_frexp(float3 param_0) { + float3 exp; + float3 sig = frexp(param_0, exp); + frexp_result_vec3 result = {sig, int3(exp)}; + return result; +} + +void frexp_979800() { + frexp_result_vec3 res = tint_frexp((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_979800(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_979800(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_979800(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1152ca2026 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec3 { + float3 sig; + int3 exp; +}; +frexp_result_vec3 tint_frexp(float3 param_0) { + float3 exp; + float3 sig = frexp(param_0, exp); + frexp_result_vec3 result = {sig, int3(exp)}; + return result; +} + +void frexp_979800() { + frexp_result_vec3 res = tint_frexp((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_979800(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_979800(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_979800(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.glsl new file mode 100644 index 0000000000..b102854cc0 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.glsl @@ -0,0 +1,85 @@ +#version 310 es + +struct frexp_result_vec3 { + vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3 tint_frexp(vec3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_979800() { + frexp_result_vec3 res = tint_frexp(vec3(1.0f)); +} + +vec4 vertex_main() { + frexp_979800(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result_vec3 { + vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3 tint_frexp(vec3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_979800() { + frexp_result_vec3 res = tint_frexp(vec3(1.0f)); +} + +void fragment_main() { + frexp_979800(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result_vec3 { + vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3 tint_frexp(vec3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_979800() { + frexp_result_vec3 res = tint_frexp(vec3(1.0f)); +} + +void compute_main() { + frexp_979800(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.msl new file mode 100644 index 0000000000..ee55ebfe6c --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_vec3 { + float3 sig; + int3 exp; +}; +frexp_result_vec3 tint_frexp(float3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_979800() { + frexp_result_vec3 res = tint_frexp(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_979800(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_979800(); + return; +} + +kernel void compute_main() { + frexp_979800(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.spvasm new file mode 100644 index 0000000000..299cabc232 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_979800 "frexp_979800" + OpName %__frexp_result_vec3 "__frexp_result_vec3" + OpMemberName %__frexp_result_vec3 0 "sig" + OpMemberName %__frexp_result_vec3 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec3 0 Offset 0 + OpMemberDecorate %__frexp_result_vec3 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%__frexp_result_vec3 = OpTypeStruct %v3float %v3int + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function___frexp_result_vec3 = OpTypePointer Function %__frexp_result_vec3 + %23 = OpConstantNull %__frexp_result_vec3 + %24 = OpTypeFunction %v4float +%frexp_979800 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_vec3 Function %23 + %13 = OpExtInst %__frexp_result_vec3 %18 FrexpStruct %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_979800 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %frexp_979800 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %frexp_979800 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.wgsl new file mode 100644 index 0000000000..d3dd2f817a --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/979800.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn frexp_979800() { + var res = frexp(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_979800(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_979800(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_979800(); +} diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl new file mode 100644 index 0000000000..9b89a6b716 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<3, f16>) -> __frexp_result_vec<3, f16> +fn frexp_ae4a66() { + var res = frexp(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_ae4a66(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_ae4a66(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_ae4a66(); +} diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..35d6455af6 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec3_f16 { + vector sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec3_f16 result = {sig, int3(exp)}; + return result; +} + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_ae4a66(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_ae4a66(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b25e403a68 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct frexp_result_vec3_f16 { + vector sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec3_f16 result = {sig, int3(exp)}; + return result; +} + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_ae4a66(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_ae4a66(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D8ABEFAB20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.glsl new file mode 100644 index 0000000000..e1b82e8579 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + frexp_ae4a66(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp(f16vec3(0.0hf)); +} + +void fragment_main() { + frexp_ae4a66(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp(f16vec3(0.0hf)); +} + +void compute_main() { + frexp_ae4a66(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.msl new file mode 100644 index 0000000000..b58cc1025a --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_vec3_f16 { + half3 sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(half3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_ae4a66() { + frexp_result_vec3_f16 res = tint_frexp(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_ae4a66(); + return; +} + +kernel void compute_main() { + frexp_ae4a66(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.spvasm new file mode 100644 index 0000000000..5bf4a21be8 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_ae4a66 "frexp_ae4a66" + OpName %__frexp_result_vec3_f16 "__frexp_result_vec3_f16" + OpMemberName %__frexp_result_vec3_f16 0 "sig" + OpMemberName %__frexp_result_vec3_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec3_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec3_f16 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%__frexp_result_vec3_f16 = OpTypeStruct %v3half %v3int + %20 = OpConstantNull %v3half +%_ptr_Function___frexp_result_vec3_f16 = OpTypePointer Function %__frexp_result_vec3_f16 + %23 = OpConstantNull %__frexp_result_vec3_f16 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_ae4a66 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_vec3_f16 Function %23 + %13 = OpExtInst %__frexp_result_vec3_f16 %19 FrexpStruct %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_ae4a66 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %frexp_ae4a66 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_ae4a66 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.wgsl new file mode 100644 index 0000000000..fcec0ebcd0 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/ae4a66.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn frexp_ae4a66() { + var res = frexp(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_ae4a66(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_ae4a66(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_ae4a66(); +} diff --git a/test/tint/builtins/gen/literal/frexp/eb2421.wgsl b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl new file mode 100644 index 0000000000..2f5b30b338 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(vec<2, f32>) -> __frexp_result_vec<2, f32> +fn frexp_eb2421() { + var res = frexp(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_eb2421(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_eb2421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_eb2421(); +} diff --git a/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b45f18e198 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec2 { + float2 sig; + int2 exp; +}; +frexp_result_vec2 tint_frexp(float2 param_0) { + float2 exp; + float2 sig = frexp(param_0, exp); + frexp_result_vec2 result = {sig, int2(exp)}; + return result; +} + +void frexp_eb2421() { + frexp_result_vec2 res = tint_frexp((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_eb2421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_eb2421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_eb2421(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b45f18e198 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct frexp_result_vec2 { + float2 sig; + int2 exp; +}; +frexp_result_vec2 tint_frexp(float2 param_0) { + float2 exp; + float2 sig = frexp(param_0, exp); + frexp_result_vec2 result = {sig, int2(exp)}; + return result; +} + +void frexp_eb2421() { + frexp_result_vec2 res = tint_frexp((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_eb2421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_eb2421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_eb2421(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.glsl b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.glsl new file mode 100644 index 0000000000..0528f5e193 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.glsl @@ -0,0 +1,85 @@ +#version 310 es + +struct frexp_result_vec2 { + vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2 tint_frexp(vec2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_eb2421() { + frexp_result_vec2 res = tint_frexp(vec2(1.0f)); +} + +vec4 vertex_main() { + frexp_eb2421(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result_vec2 { + vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2 tint_frexp(vec2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_eb2421() { + frexp_result_vec2 res = tint_frexp(vec2(1.0f)); +} + +void fragment_main() { + frexp_eb2421(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result_vec2 { + vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2 tint_frexp(vec2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_eb2421() { + frexp_result_vec2 res = tint_frexp(vec2(1.0f)); +} + +void compute_main() { + frexp_eb2421(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.msl b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.msl new file mode 100644 index 0000000000..8a7cb11689 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct frexp_result_vec2 { + float2 sig; + int2 exp; +}; +frexp_result_vec2 tint_frexp(float2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_eb2421() { + frexp_result_vec2 res = tint_frexp(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_eb2421(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_eb2421(); + return; +} + +kernel void compute_main() { + frexp_eb2421(); + return; +} + diff --git a/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4eb572d45 --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_eb2421 "frexp_eb2421" + OpName %__frexp_result_vec2 "__frexp_result_vec2" + OpMemberName %__frexp_result_vec2 0 "sig" + OpMemberName %__frexp_result_vec2 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec2 0 Offset 0 + OpMemberDecorate %__frexp_result_vec2 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%__frexp_result_vec2 = OpTypeStruct %v2float %v2int + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function___frexp_result_vec2 = OpTypePointer Function %__frexp_result_vec2 + %23 = OpConstantNull %__frexp_result_vec2 + %24 = OpTypeFunction %v4float +%frexp_eb2421 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___frexp_result_vec2 Function %23 + %13 = OpExtInst %__frexp_result_vec2 %18 FrexpStruct %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_eb2421 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %frexp_eb2421 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %frexp_eb2421 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4877a129c --- /dev/null +++ b/test/tint/builtins/gen/literal/frexp/eb2421.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn frexp_eb2421() { + var res = frexp(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_eb2421(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_eb2421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_eb2421(); +} diff --git a/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl new file mode 100644 index 0000000000..3a7ffe13c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(vec<3, f32>) -> vec<3, f32> +fn fwidth_5d1b39() { + var res: vec3 = fwidth(vec3(1.f)); +} + +@fragment +fn fragment_main() { + fwidth_5d1b39(); +} diff --git a/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f93dd5c2d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void fwidth_5d1b39() { + float3 res = fwidth((1.0f).xxx); +} + +void fragment_main() { + fwidth_5d1b39(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f93dd5c2d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidth_5d1b39() { + float3 res = fwidth((1.0f).xxx); +} + +void fragment_main() { + fwidth_5d1b39(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.glsl new file mode 100644 index 0000000000..197e3fe2bf --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void fwidth_5d1b39() { + vec3 res = fwidth(vec3(1.0f)); +} + +void fragment_main() { + fwidth_5d1b39(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.msl new file mode 100644 index 0000000000..94e9749021 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void fwidth_5d1b39() { + float3 res = fwidth(float3(1.0f)); +} + +fragment void fragment_main() { + fwidth_5d1b39(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.spvasm new file mode 100644 index 0000000000..65a1aacec1 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_5d1b39 "fwidth_5d1b39" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %12 = OpConstantNull %v3float +%fwidth_5d1b39 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %12 + %5 = OpFwidth %v3float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidth_5d1b39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.wgsl new file mode 100644 index 0000000000..d85e56e5e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/5d1b39.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidth_5d1b39() { + var res : vec3 = fwidth(vec3(1.0f)); +} + +@fragment +fn fragment_main() { + fwidth_5d1b39(); +} diff --git a/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl new file mode 100644 index 0000000000..a476130ba0 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(vec<2, f32>) -> vec<2, f32> +fn fwidth_b83ebb() { + var res: vec2 = fwidth(vec2(1.f)); +} + +@fragment +fn fragment_main() { + fwidth_b83ebb(); +} diff --git a/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..498cad2e32 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void fwidth_b83ebb() { + float2 res = fwidth((1.0f).xx); +} + +void fragment_main() { + fwidth_b83ebb(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..498cad2e32 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidth_b83ebb() { + float2 res = fwidth((1.0f).xx); +} + +void fragment_main() { + fwidth_b83ebb(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.glsl new file mode 100644 index 0000000000..b6d81ce010 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void fwidth_b83ebb() { + vec2 res = fwidth(vec2(1.0f)); +} + +void fragment_main() { + fwidth_b83ebb(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.msl new file mode 100644 index 0000000000..ee894ebbdd --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void fwidth_b83ebb() { + float2 res = fwidth(float2(1.0f)); +} + +fragment void fragment_main() { + fwidth_b83ebb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.spvasm new file mode 100644 index 0000000000..929683f3e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_b83ebb "fwidth_b83ebb" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %12 = OpConstantNull %v2float +%fwidth_b83ebb = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %12 + %5 = OpFwidth %v2float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidth_b83ebb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e23172513 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/b83ebb.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidth_b83ebb() { + var res : vec2 = fwidth(vec2(1.0f)); +} + +@fragment +fn fragment_main() { + fwidth_b83ebb(); +} diff --git a/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl new file mode 100644 index 0000000000..91c85c770e --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(vec<4, f32>) -> vec<4, f32> +fn fwidth_d2ab9a() { + var res: vec4 = fwidth(vec4(1.f)); +} + +@fragment +fn fragment_main() { + fwidth_d2ab9a(); +} diff --git a/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0da023754a --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void fwidth_d2ab9a() { + float4 res = fwidth((1.0f).xxxx); +} + +void fragment_main() { + fwidth_d2ab9a(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0da023754a --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidth_d2ab9a() { + float4 res = fwidth((1.0f).xxxx); +} + +void fragment_main() { + fwidth_d2ab9a(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.glsl new file mode 100644 index 0000000000..b4f2144d03 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void fwidth_d2ab9a() { + vec4 res = fwidth(vec4(1.0f)); +} + +void fragment_main() { + fwidth_d2ab9a(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.msl new file mode 100644 index 0000000000..d2969e15ad --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void fwidth_d2ab9a() { + float4 res = fwidth(float4(1.0f)); +} + +fragment void fragment_main() { + fwidth_d2ab9a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.spvasm new file mode 100644 index 0000000000..1f46a285f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_d2ab9a "fwidth_d2ab9a" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %12 = OpConstantNull %v4float +%fwidth_d2ab9a = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %12 + %5 = OpFwidth %v4float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidth_d2ab9a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..50d3dd7444 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/d2ab9a.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidth_d2ab9a() { + var res : vec4 = fwidth(vec4(1.0f)); +} + +@fragment +fn fragment_main() { + fwidth_d2ab9a(); +} diff --git a/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl new file mode 100644 index 0000000000..3a5861ade3 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(f32) -> f32 +fn fwidth_df38ef() { + var res: f32 = fwidth(1.f); +} + +@fragment +fn fragment_main() { + fwidth_df38ef(); +} diff --git a/test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..35d42bf52f --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidth_df38ef() { + float res = fwidth(1.0f); +} + +void fragment_main() { + fwidth_df38ef(); + return; +} diff --git a/test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.msl rename to test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.msl diff --git a/test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/fwidth/df38ef.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d20601112 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidth/df38ef.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidth_df38ef() { + var res : f32 = fwidth(1.0f); +} + +@fragment +fn fragment_main() { + fwidth_df38ef(); +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl new file mode 100644 index 0000000000..a1b554133c --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(f32) -> f32 +fn fwidthCoarse_159c8a() { + var res: f32 = fwidthCoarse(1.f); +} + +@fragment +fn fragment_main() { + fwidthCoarse_159c8a(); +} diff --git a/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c2d09bb42 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidthCoarse_159c8a() { + float res = fwidth(1.0f); +} + +void fragment_main() { + fwidthCoarse_159c8a(); + return; +} diff --git a/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.msl rename to test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.msl diff --git a/test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/fwidthCoarse/159c8a.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.wgsl new file mode 100644 index 0000000000..37c5011b73 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/159c8a.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidthCoarse_159c8a() { + var res : f32 = fwidthCoarse(1.0f); +} + +@fragment +fn fragment_main() { + fwidthCoarse_159c8a(); +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl new file mode 100644 index 0000000000..027f9b4f80 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(vec<3, f32>) -> vec<3, f32> +fn fwidthCoarse_1e59d9() { + var res: vec3 = fwidthCoarse(vec3(1.f)); +} + +@fragment +fn fragment_main() { + fwidthCoarse_1e59d9(); +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b73859ce7 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void fwidthCoarse_1e59d9() { + float3 res = fwidth((1.0f).xxx); +} + +void fragment_main() { + fwidthCoarse_1e59d9(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b73859ce7 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidthCoarse_1e59d9() { + float3 res = fwidth((1.0f).xxx); +} + +void fragment_main() { + fwidthCoarse_1e59d9(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.glsl new file mode 100644 index 0000000000..a614e22b93 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_1e59d9() { + vec3 res = fwidth(vec3(1.0f)); +} + +void fragment_main() { + fwidthCoarse_1e59d9(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.msl new file mode 100644 index 0000000000..15a129d387 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void fwidthCoarse_1e59d9() { + float3 res = fwidth(float3(1.0f)); +} + +fragment void fragment_main() { + fwidthCoarse_1e59d9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.spvasm new file mode 100644 index 0000000000..5e0ce8f0cd --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_1e59d9 "fwidthCoarse_1e59d9" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %12 = OpConstantNull %v3float +%fwidthCoarse_1e59d9 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %12 + %5 = OpFwidthCoarse %v3float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthCoarse_1e59d9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6c705364d --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/1e59d9.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidthCoarse_1e59d9() { + var res : vec3 = fwidthCoarse(vec3(1.0f)); +} + +@fragment +fn fragment_main() { + fwidthCoarse_1e59d9(); +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl new file mode 100644 index 0000000000..bb61f99fc2 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(vec<4, f32>) -> vec<4, f32> +fn fwidthCoarse_4e4fc4() { + var res: vec4 = fwidthCoarse(vec4(1.f)); +} + +@fragment +fn fragment_main() { + fwidthCoarse_4e4fc4(); +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7a1a11cc8a --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void fwidthCoarse_4e4fc4() { + float4 res = fwidth((1.0f).xxxx); +} + +void fragment_main() { + fwidthCoarse_4e4fc4(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7a1a11cc8a --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidthCoarse_4e4fc4() { + float4 res = fwidth((1.0f).xxxx); +} + +void fragment_main() { + fwidthCoarse_4e4fc4(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.glsl new file mode 100644 index 0000000000..12433786f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_4e4fc4() { + vec4 res = fwidth(vec4(1.0f)); +} + +void fragment_main() { + fwidthCoarse_4e4fc4(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.msl new file mode 100644 index 0000000000..259259df3e --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void fwidthCoarse_4e4fc4() { + float4 res = fwidth(float4(1.0f)); +} + +fragment void fragment_main() { + fwidthCoarse_4e4fc4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..36cdd1962f --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_4e4fc4 "fwidthCoarse_4e4fc4" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %12 = OpConstantNull %v4float +%fwidthCoarse_4e4fc4 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %12 + %5 = OpFwidthCoarse %v4float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthCoarse_4e4fc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..e401616453 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/4e4fc4.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidthCoarse_4e4fc4() { + var res : vec4 = fwidthCoarse(vec4(1.0f)); +} + +@fragment +fn fragment_main() { + fwidthCoarse_4e4fc4(); +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl new file mode 100644 index 0000000000..91b88e29b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(vec<2, f32>) -> vec<2, f32> +fn fwidthCoarse_e653f7() { + var res: vec2 = fwidthCoarse(vec2(1.f)); +} + +@fragment +fn fragment_main() { + fwidthCoarse_e653f7(); +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..934ddfa261 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void fwidthCoarse_e653f7() { + float2 res = fwidth((1.0f).xx); +} + +void fragment_main() { + fwidthCoarse_e653f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..934ddfa261 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidthCoarse_e653f7() { + float2 res = fwidth((1.0f).xx); +} + +void fragment_main() { + fwidthCoarse_e653f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.glsl new file mode 100644 index 0000000000..8c4eecbd5c --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_e653f7() { + vec2 res = fwidth(vec2(1.0f)); +} + +void fragment_main() { + fwidthCoarse_e653f7(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.msl new file mode 100644 index 0000000000..64fcbfd756 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void fwidthCoarse_e653f7() { + float2 res = fwidth(float2(1.0f)); +} + +fragment void fragment_main() { + fwidthCoarse_e653f7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..dda4c3c063 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_e653f7 "fwidthCoarse_e653f7" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %12 = OpConstantNull %v2float +%fwidthCoarse_e653f7 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %12 + %5 = OpFwidthCoarse %v2float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthCoarse_e653f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..31805c94e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthCoarse/e653f7.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidthCoarse_e653f7() { + var res : vec2 = fwidthCoarse(vec2(1.0f)); +} + +@fragment +fn fragment_main() { + fwidthCoarse_e653f7(); +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl new file mode 100644 index 0000000000..780f8df82d --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(vec<3, f32>) -> vec<3, f32> +fn fwidthFine_523fdc() { + var res: vec3 = fwidthFine(vec3(1.f)); +} + +@fragment +fn fragment_main() { + fwidthFine_523fdc(); +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..88b4f91eef --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void fwidthFine_523fdc() { + float3 res = fwidth((1.0f).xxx); +} + +void fragment_main() { + fwidthFine_523fdc(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..88b4f91eef --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidthFine_523fdc() { + float3 res = fwidth((1.0f).xxx); +} + +void fragment_main() { + fwidthFine_523fdc(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.glsl new file mode 100644 index 0000000000..b0341a54ba --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void fwidthFine_523fdc() { + vec3 res = fwidth(vec3(1.0f)); +} + +void fragment_main() { + fwidthFine_523fdc(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.msl new file mode 100644 index 0000000000..578816b63e --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void fwidthFine_523fdc() { + float3 res = fwidth(float3(1.0f)); +} + +fragment void fragment_main() { + fwidthFine_523fdc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..7bc84fc559 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_523fdc "fwidthFine_523fdc" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %12 = OpConstantNull %v3float +%fwidthFine_523fdc = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %12 + %5 = OpFwidthFine %v3float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthFine_523fdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..ccccfeba15 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/523fdc.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidthFine_523fdc() { + var res : vec3 = fwidthFine(vec3(1.0f)); +} + +@fragment +fn fragment_main() { + fwidthFine_523fdc(); +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl new file mode 100644 index 0000000000..73cb7e4cf8 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(vec<4, f32>) -> vec<4, f32> +fn fwidthFine_68f4ef() { + var res: vec4 = fwidthFine(vec4(1.f)); +} + +@fragment +fn fragment_main() { + fwidthFine_68f4ef(); +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6ba6fa950 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void fwidthFine_68f4ef() { + float4 res = fwidth((1.0f).xxxx); +} + +void fragment_main() { + fwidthFine_68f4ef(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6ba6fa950 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidthFine_68f4ef() { + float4 res = fwidth((1.0f).xxxx); +} + +void fragment_main() { + fwidthFine_68f4ef(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.glsl new file mode 100644 index 0000000000..bb48166c36 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void fwidthFine_68f4ef() { + vec4 res = fwidth(vec4(1.0f)); +} + +void fragment_main() { + fwidthFine_68f4ef(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.msl new file mode 100644 index 0000000000..9a32402e6a --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void fwidthFine_68f4ef() { + float4 res = fwidth(float4(1.0f)); +} + +fragment void fragment_main() { + fwidthFine_68f4ef(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e87a7cdbc --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_68f4ef "fwidthFine_68f4ef" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %12 = OpConstantNull %v4float +%fwidthFine_68f4ef = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %12 + %5 = OpFwidthFine %v4float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthFine_68f4ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..4914826ec7 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/68f4ef.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidthFine_68f4ef() { + var res : vec4 = fwidthFine(vec4(1.0f)); +} + +@fragment +fn fragment_main() { + fwidthFine_68f4ef(); +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl new file mode 100644 index 0000000000..a56271797c --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(f32) -> f32 +fn fwidthFine_f1742d() { + var res: f32 = fwidthFine(1.f); +} + +@fragment +fn fragment_main() { + fwidthFine_f1742d(); +} diff --git a/test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ca2184f67c --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidthFine_f1742d() { + float res = fwidth(1.0f); +} + +void fragment_main() { + fwidthFine_f1742d(); + return; +} diff --git a/test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.msl rename to test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.msl diff --git a/test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/fwidthFine/f1742d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f0f6ebbff --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/f1742d.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidthFine_f1742d() { + var res : f32 = fwidthFine(1.0f); +} + +@fragment +fn fragment_main() { + fwidthFine_f1742d(); +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl new file mode 100644 index 0000000000..d1c8eb9058 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(vec<2, f32>) -> vec<2, f32> +fn fwidthFine_ff6aa0() { + var res: vec2 = fwidthFine(vec2(1.f)); +} + +@fragment +fn fragment_main() { + fwidthFine_ff6aa0(); +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ec674cc458 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +void fwidthFine_ff6aa0() { + float2 res = fwidth((1.0f).xx); +} + +void fragment_main() { + fwidthFine_ff6aa0(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec674cc458 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +void fwidthFine_ff6aa0() { + float2 res = fwidth((1.0f).xx); +} + +void fragment_main() { + fwidthFine_ff6aa0(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.glsl new file mode 100644 index 0000000000..95868ae7ed --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +void fwidthFine_ff6aa0() { + vec2 res = fwidth(vec2(1.0f)); +} + +void fragment_main() { + fwidthFine_ff6aa0(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.msl b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.msl new file mode 100644 index 0000000000..ea88962bcc --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void fwidthFine_ff6aa0() { + float2 res = fwidth(float2(1.0f)); +} + +fragment void fragment_main() { + fwidthFine_ff6aa0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.spvasm new file mode 100644 index 0000000000..7e793258a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_ff6aa0 "fwidthFine_ff6aa0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %9 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %12 = OpConstantNull %v2float +%fwidthFine_ff6aa0 = OpFunction %void None %1 + %4 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %12 + %5 = OpFwidthFine %v2float %9 + OpStore %res %5 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthFine_ff6aa0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.wgsl new file mode 100644 index 0000000000..69a64643fd --- /dev/null +++ b/test/tint/builtins/gen/literal/fwidthFine/ff6aa0.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn fwidthFine_ff6aa0() { + var res : vec2 = fwidthFine(vec2(1.0f)); +} + +@fragment +fn fragment_main() { + fwidthFine_ff6aa0(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl new file mode 100644 index 0000000000..185b4819ec --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<2, u32>, vec<2, u32>, u32, u32) -> vec<2, u32> +fn insertBits_3c7ba5() { + var res: vec2 = insertBits(vec2(1u), vec2(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_3c7ba5(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_3c7ba5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_3c7ba5(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..01e391d28a --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & uint2((mask).xx)) | (v & uint2((~(mask)).xx))); +} + +void insertBits_3c7ba5() { + uint2 res = tint_insert_bits((1u).xx, (1u).xx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_3c7ba5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_3c7ba5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_3c7ba5(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01e391d28a --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & uint2((mask).xx)) | (v & uint2((~(mask)).xx))); +} + +void insertBits_3c7ba5() { + uint2 res = tint_insert_bits((1u).xx, (1u).xx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_3c7ba5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_3c7ba5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_3c7ba5(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.glsl new file mode 100644 index 0000000000..3cbe76e707 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_3c7ba5() { + uvec2 res = tint_insert_bits(uvec2(1u), uvec2(1u), 1u, 1u); +} + +vec4 vertex_main() { + insertBits_3c7ba5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_3c7ba5() { + uvec2 res = tint_insert_bits(uvec2(1u), uvec2(1u), 1u, 1u); +} + +void fragment_main() { + insertBits_3c7ba5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_3c7ba5() { + uvec2 res = tint_insert_bits(uvec2(1u), uvec2(1u), 1u, 1u); +} + +void compute_main() { + insertBits_3c7ba5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.msl b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.msl new file mode 100644 index 0000000000..eea8550311 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_3c7ba5() { + uint2 res = tint_insert_bits(uint2(1u), uint2(1u), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_3c7ba5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_3c7ba5(); + return; +} + +kernel void compute_main() { + insertBits_3c7ba5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.spvasm new file mode 100644 index 0000000000..96b9209461 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_3c7ba5 "insertBits_3c7ba5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint %v2uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %31 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %34 = OpConstantNull %v2uint + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %n = OpFunctionParameter %v2uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %v2uint %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_3c7ba5 = OpFunction %void None %25 + %28 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %34 + %29 = OpFunctionCall %v2uint %tint_insert_bits %31 %31 %uint_1 %uint_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %insertBits_3c7ba5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %44 = OpLabel + %45 = OpFunctionCall %void %insertBits_3c7ba5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_3c7ba5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d296c61fb --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/3c7ba5.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn insertBits_3c7ba5() { + var res : vec2 = insertBits(vec2(1u), vec2(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_3c7ba5(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_3c7ba5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_3c7ba5(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl new file mode 100644 index 0000000000..af4256ee83 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<3, i32>, vec<3, i32>, u32, u32) -> vec<3, i32> +fn insertBits_428b0b() { + var res: vec3 = insertBits(vec3(1), vec3(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_428b0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_428b0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_428b0b(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fcc8e1274e --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx))); +} + +void insertBits_428b0b() { + int3 res = tint_insert_bits((1).xxx, (1).xxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_428b0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_428b0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_428b0b(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fcc8e1274e --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx))); +} + +void insertBits_428b0b() { + int3 res = tint_insert_bits((1).xxx, (1).xxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_428b0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_428b0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_428b0b(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.glsl new file mode 100644 index 0000000000..38eb5cba8c --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_428b0b() { + ivec3 res = tint_insert_bits(ivec3(1), ivec3(1), 1u, 1u); +} + +vec4 vertex_main() { + insertBits_428b0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_428b0b() { + ivec3 res = tint_insert_bits(ivec3(1), ivec3(1), 1u, 1u); +} + +void fragment_main() { + insertBits_428b0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_428b0b() { + ivec3 res = tint_insert_bits(ivec3(1), ivec3(1), 1u, 1u); +} + +void compute_main() { + insertBits_428b0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.msl b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.msl new file mode 100644 index 0000000000..026c7a4b0d --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_428b0b() { + int3 res = tint_insert_bits(int3(1), int3(1), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_428b0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_428b0b(); + return; +} + +kernel void compute_main() { + insertBits_428b0b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..923dcfd94d --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_428b0b "insertBits_428b0b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v3int %v3int %v3int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %32 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %36 = OpConstantNull %v3int + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %n = OpFunctionParameter %v3int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %18 = OpLabel + %19 = OpExtInst %uint %20 UMin %offset %uint_32 + %23 = OpIAdd %uint %19 %count + %22 = OpExtInst %uint %20 UMin %uint_32 %23 + %25 = OpISub %uint %22 %19 + %24 = OpBitFieldInsert %v3int %v %n %19 %25 + OpReturnValue %24 + OpFunctionEnd +%insertBits_428b0b = OpFunction %void None %26 + %29 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %36 + %30 = OpFunctionCall %v3int %tint_insert_bits %32 %32 %uint_1 %uint_1 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %insertBits_428b0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %26 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %26 + %46 = OpLabel + %47 = OpFunctionCall %void %insertBits_428b0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %26 + %49 = OpLabel + %50 = OpFunctionCall %void %insertBits_428b0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..56e7e062cb --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/428b0b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn insertBits_428b0b() { + var res : vec3 = insertBits(vec3(1), vec3(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_428b0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_428b0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_428b0b(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl new file mode 100644 index 0000000000..1a518a0977 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<4, u32>, vec<4, u32>, u32, u32) -> vec<4, u32> +fn insertBits_51ede1() { + var res: vec4 = insertBits(vec4(1u), vec4(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_51ede1(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_51ede1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_51ede1(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..25671aa9c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & uint4((mask).xxxx)) | (v & uint4((~(mask)).xxxx))); +} + +void insertBits_51ede1() { + uint4 res = tint_insert_bits((1u).xxxx, (1u).xxxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_51ede1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_51ede1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_51ede1(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..25671aa9c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & uint4((mask).xxxx)) | (v & uint4((~(mask)).xxxx))); +} + +void insertBits_51ede1() { + uint4 res = tint_insert_bits((1u).xxxx, (1u).xxxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_51ede1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_51ede1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_51ede1(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.glsl new file mode 100644 index 0000000000..4996ffbb6c --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_51ede1() { + uvec4 res = tint_insert_bits(uvec4(1u), uvec4(1u), 1u, 1u); +} + +vec4 vertex_main() { + insertBits_51ede1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_51ede1() { + uvec4 res = tint_insert_bits(uvec4(1u), uvec4(1u), 1u, 1u); +} + +void fragment_main() { + insertBits_51ede1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_51ede1() { + uvec4 res = tint_insert_bits(uvec4(1u), uvec4(1u), 1u, 1u); +} + +void compute_main() { + insertBits_51ede1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.msl b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.msl new file mode 100644 index 0000000000..bd1ebb39c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_51ede1() { + uint4 res = tint_insert_bits(uint4(1u), uint4(1u), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_51ede1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_51ede1(); + return; +} + +kernel void compute_main() { + insertBits_51ede1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.spvasm new file mode 100644 index 0000000000..0aa617842d --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_51ede1 "insertBits_51ede1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint %v4uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %31 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %34 = OpConstantNull %v4uint + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %n = OpFunctionParameter %v4uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %v4uint %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_51ede1 = OpFunction %void None %25 + %28 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %34 + %29 = OpFunctionCall %v4uint %tint_insert_bits %31 %31 %uint_1 %uint_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %insertBits_51ede1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %44 = OpLabel + %45 = OpFunctionCall %void %insertBits_51ede1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_51ede1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.wgsl new file mode 100644 index 0000000000..facb770f6c --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/51ede1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn insertBits_51ede1() { + var res : vec4 = insertBits(vec4(1u), vec4(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_51ede1(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_51ede1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_51ede1(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/65468b.wgsl b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl new file mode 100644 index 0000000000..9b659d8c29 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(i32, i32, u32, u32) -> i32 +fn insertBits_65468b() { + var res: i32 = insertBits(1, 1, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_65468b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_65468b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_65468b(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..57a24ad06d --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +int tint_insert_bits(int v, int n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & int(mask)) | (v & int(~(mask)))); +} + +void insertBits_65468b() { + int res = tint_insert_bits(1, 1, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_65468b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_65468b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_65468b(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..57a24ad06d --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +int tint_insert_bits(int v, int n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & int(mask)) | (v & int(~(mask)))); +} + +void insertBits_65468b() { + int res = tint_insert_bits(1, 1, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_65468b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_65468b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_65468b(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.glsl new file mode 100644 index 0000000000..88dfff2f3a --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_65468b() { + int res = tint_insert_bits(1, 1, 1u, 1u); +} + +vec4 vertex_main() { + insertBits_65468b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_65468b() { + int res = tint_insert_bits(1, 1, 1u, 1u); +} + +void fragment_main() { + insertBits_65468b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_65468b() { + int res = tint_insert_bits(1, 1, 1u, 1u); +} + +void compute_main() { + insertBits_65468b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.msl b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.msl new file mode 100644 index 0000000000..dcee0635dc --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_65468b() { + int res = tint_insert_bits(1, 1, 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_65468b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_65468b(); + return; +} + +kernel void compute_main() { + insertBits_65468b(); + return; +} + diff --git a/test/tint/builtins/gen/insertBits/65468b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/insertBits/65468b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef26bedf8b --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/65468b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn insertBits_65468b() { + var res : i32 = insertBits(1, 1, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_65468b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_65468b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_65468b(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/87826b.wgsl b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl new file mode 100644 index 0000000000..b3b8115f7a --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<3, u32>, vec<3, u32>, u32, u32) -> vec<3, u32> +fn insertBits_87826b() { + var res: vec3 = insertBits(vec3(1u), vec3(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_87826b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_87826b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_87826b(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e0c514762b --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx))); +} + +void insertBits_87826b() { + uint3 res = tint_insert_bits((1u).xxx, (1u).xxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_87826b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_87826b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_87826b(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e0c514762b --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx))); +} + +void insertBits_87826b() { + uint3 res = tint_insert_bits((1u).xxx, (1u).xxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_87826b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_87826b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_87826b(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.glsl new file mode 100644 index 0000000000..e0e8d8e520 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_87826b() { + uvec3 res = tint_insert_bits(uvec3(1u), uvec3(1u), 1u, 1u); +} + +vec4 vertex_main() { + insertBits_87826b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_87826b() { + uvec3 res = tint_insert_bits(uvec3(1u), uvec3(1u), 1u, 1u); +} + +void fragment_main() { + insertBits_87826b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_87826b() { + uvec3 res = tint_insert_bits(uvec3(1u), uvec3(1u), 1u, 1u); +} + +void compute_main() { + insertBits_87826b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.msl b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.msl new file mode 100644 index 0000000000..c8ea86520e --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_87826b() { + uint3 res = tint_insert_bits(uint3(1u), uint3(1u), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_87826b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_87826b(); + return; +} + +kernel void compute_main() { + insertBits_87826b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.spvasm new file mode 100644 index 0000000000..e36125032b --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_87826b "insertBits_87826b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint %v3uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %31 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %34 = OpConstantNull %v3uint + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %n = OpFunctionParameter %v3uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %v3uint %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_87826b = OpFunction %void None %25 + %28 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %34 + %29 = OpFunctionCall %v3uint %tint_insert_bits %31 %31 %uint_1 %uint_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %insertBits_87826b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %44 = OpLabel + %45 = OpFunctionCall %void %insertBits_87826b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_87826b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c88061e9e --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/87826b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn insertBits_87826b() { + var res : vec3 = insertBits(vec3(1u), vec3(1u), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_87826b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_87826b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_87826b(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/d86978.wgsl b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl new file mode 100644 index 0000000000..5657dd88dc --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<4, i32>, vec<4, i32>, u32, u32) -> vec<4, i32> +fn insertBits_d86978() { + var res: vec4 = insertBits(vec4(1), vec4(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_d86978(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_d86978(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_d86978(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..11333bab22 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & int4((int(mask)).xxxx)) | (v & int4((int(~(mask))).xxxx))); +} + +void insertBits_d86978() { + int4 res = tint_insert_bits((1).xxxx, (1).xxxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_d86978(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_d86978(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_d86978(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11333bab22 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & int4((int(mask)).xxxx)) | (v & int4((int(~(mask))).xxxx))); +} + +void insertBits_d86978() { + int4 res = tint_insert_bits((1).xxxx, (1).xxxx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_d86978(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_d86978(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_d86978(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.glsl b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.glsl new file mode 100644 index 0000000000..fc0aa6f0bd --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_d86978() { + ivec4 res = tint_insert_bits(ivec4(1), ivec4(1), 1u, 1u); +} + +vec4 vertex_main() { + insertBits_d86978(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_d86978() { + ivec4 res = tint_insert_bits(ivec4(1), ivec4(1), 1u, 1u); +} + +void fragment_main() { + insertBits_d86978(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_d86978() { + ivec4 res = tint_insert_bits(ivec4(1), ivec4(1), 1u, 1u); +} + +void compute_main() { + insertBits_d86978(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.msl b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.msl new file mode 100644 index 0000000000..b7929fe151 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_d86978() { + int4 res = tint_insert_bits(int4(1), int4(1), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_d86978(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_d86978(); + return; +} + +kernel void compute_main() { + insertBits_d86978(); + return; +} + diff --git a/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.spvasm new file mode 100644 index 0000000000..639baf30a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_d86978 "insertBits_d86978" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v4int %v4int %v4int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %32 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %36 = OpConstantNull %v4int + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %n = OpFunctionParameter %v4int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %18 = OpLabel + %19 = OpExtInst %uint %20 UMin %offset %uint_32 + %23 = OpIAdd %uint %19 %count + %22 = OpExtInst %uint %20 UMin %uint_32 %23 + %25 = OpISub %uint %22 %19 + %24 = OpBitFieldInsert %v4int %v %n %19 %25 + OpReturnValue %24 + OpFunctionEnd +%insertBits_d86978 = OpFunction %void None %26 + %29 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %36 + %30 = OpFunctionCall %v4int %tint_insert_bits %32 %32 %uint_1 %uint_1 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %insertBits_d86978 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %26 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %26 + %46 = OpLabel + %47 = OpFunctionCall %void %insertBits_d86978 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %26 + %49 = OpLabel + %50 = OpFunctionCall %void %insertBits_d86978 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.wgsl new file mode 100644 index 0000000000..92b7cfec48 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/d86978.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn insertBits_d86978() { + var res : vec4 = insertBits(vec4(1), vec4(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_d86978(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_d86978(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_d86978(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl new file mode 100644 index 0000000000..08349de007 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(u32, u32, u32, u32) -> u32 +fn insertBits_e3e3a2() { + var res: u32 = insertBits(1u, 1u, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_e3e3a2(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_e3e3a2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_e3e3a2(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..014ba4a9b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & mask) | (v & ~(mask))); +} + +void insertBits_e3e3a2() { + uint res = tint_insert_bits(1u, 1u, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_e3e3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_e3e3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_e3e3a2(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..014ba4a9b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & mask) | (v & ~(mask))); +} + +void insertBits_e3e3a2() { + uint res = tint_insert_bits(1u, 1u, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_e3e3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_e3e3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_e3e3a2(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.glsl new file mode 100644 index 0000000000..2da5c2a60a --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_e3e3a2() { + uint res = tint_insert_bits(1u, 1u, 1u, 1u); +} + +vec4 vertex_main() { + insertBits_e3e3a2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_e3e3a2() { + uint res = tint_insert_bits(1u, 1u, 1u, 1u); +} + +void fragment_main() { + insertBits_e3e3a2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_e3e3a2() { + uint res = tint_insert_bits(1u, 1u, 1u, 1u); +} + +void compute_main() { + insertBits_e3e3a2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.msl b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.msl new file mode 100644 index 0000000000..7edeb0ccb3 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_e3e3a2() { + uint res = tint_insert_bits(1u, 1u, 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_e3e3a2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_e3e3a2(); + return; +} + +kernel void compute_main() { + insertBits_e3e3a2(); + return; +} + diff --git a/test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/insertBits/e3e3a2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ea1692879 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/e3e3a2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn insertBits_e3e3a2() { + var res : u32 = insertBits(1u, 1u, 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_e3e3a2(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_e3e3a2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_e3e3a2(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl new file mode 100644 index 0000000000..d8967307a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<2, i32>, vec<2, i32>, u32, u32) -> vec<2, i32> +fn insertBits_fe6ba6() { + var res: vec2 = insertBits(vec2(1), vec2(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_fe6ba6(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_fe6ba6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_fe6ba6(); +} diff --git a/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6861d6e581 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & int2((int(mask)).xx)) | (v & int2((int(~(mask))).xx))); +} + +void insertBits_fe6ba6() { + int2 res = tint_insert_bits((1).xx, (1).xx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_fe6ba6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_fe6ba6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_fe6ba6(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6861d6e581 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & int2((int(mask)).xx)) | (v & int2((int(~(mask))).xx))); +} + +void insertBits_fe6ba6() { + int2 res = tint_insert_bits((1).xx, (1).xx, 1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_fe6ba6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_fe6ba6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_fe6ba6(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.glsl new file mode 100644 index 0000000000..3a65590f1a --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_fe6ba6() { + ivec2 res = tint_insert_bits(ivec2(1), ivec2(1), 1u, 1u); +} + +vec4 vertex_main() { + insertBits_fe6ba6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_fe6ba6() { + ivec2 res = tint_insert_bits(ivec2(1), ivec2(1), 1u, 1u); +} + +void fragment_main() { + insertBits_fe6ba6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_fe6ba6() { + ivec2 res = tint_insert_bits(ivec2(1), ivec2(1), 1u, 1u); +} + +void compute_main() { + insertBits_fe6ba6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.msl b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.msl new file mode 100644 index 0000000000..8b053adb61 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_fe6ba6() { + int2 res = tint_insert_bits(int2(1), int2(1), 1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_fe6ba6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_fe6ba6(); + return; +} + +kernel void compute_main() { + insertBits_fe6ba6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.spvasm new file mode 100644 index 0000000000..18cbaafb62 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_fe6ba6 "insertBits_fe6ba6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v2int %v2int %v2int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %32 = OpConstantComposite %v2int %int_1 %int_1 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %36 = OpConstantNull %v2int + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %n = OpFunctionParameter %v2int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %18 = OpLabel + %19 = OpExtInst %uint %20 UMin %offset %uint_32 + %23 = OpIAdd %uint %19 %count + %22 = OpExtInst %uint %20 UMin %uint_32 %23 + %25 = OpISub %uint %22 %19 + %24 = OpBitFieldInsert %v2int %v %n %19 %25 + OpReturnValue %24 + OpFunctionEnd +%insertBits_fe6ba6 = OpFunction %void None %26 + %29 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %36 + %30 = OpFunctionCall %v2int %tint_insert_bits %32 %32 %uint_1 %uint_1 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %insertBits_fe6ba6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %26 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %26 + %46 = OpLabel + %47 = OpFunctionCall %void %insertBits_fe6ba6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %26 + %49 = OpLabel + %50 = OpFunctionCall %void %insertBits_fe6ba6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.wgsl new file mode 100644 index 0000000000..04bee6f7e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/insertBits/fe6ba6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn insertBits_fe6ba6() { + var res : vec2 = insertBits(vec2(1), vec2(1), 1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_fe6ba6(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_fe6ba6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_fe6ba6(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl new file mode 100644 index 0000000000..fba79b258c --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(f16) -> f16 +fn inverseSqrt_440300() { + var res: f16 = inverseSqrt(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_440300(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_440300(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_440300(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39bea641d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_440300() { + float16_t res = rsqrt(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_440300(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_440300(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..81427b04b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void inverseSqrt_440300() { + float16_t res = rsqrt(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_440300(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_440300(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000237636FBD30(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000237636FBD30(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.glsl new file mode 100644 index 0000000000..8cc52838ab --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_440300() { + float16_t res = inversesqrt(0.0hf); +} + +vec4 vertex_main() { + inverseSqrt_440300(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_440300() { + float16_t res = inversesqrt(0.0hf); +} + +void fragment_main() { + inverseSqrt_440300(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_440300() { + float16_t res = inversesqrt(0.0hf); +} + +void compute_main() { + inverseSqrt_440300(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.msl new file mode 100644 index 0000000000..0cab7aca0c --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_440300() { + half res = rsqrt(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_440300(); + return; +} + +kernel void compute_main() { + inverseSqrt_440300(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.spvasm new file mode 100644 index 0000000000..49ae296817 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_440300 "inverseSqrt_440300" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_440300 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 InverseSqrt %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %inverseSqrt_440300 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %inverseSqrt_440300 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_440300 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2b635a20d --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/440300.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn inverseSqrt_440300() { + var res : f16 = inverseSqrt(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_440300(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_440300(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_440300(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl new file mode 100644 index 0000000000..af9bc17eb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<2, f16>) -> vec<2, f16> +fn inverseSqrt_5f51f8() { + var res: vec2 = inverseSqrt(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_5f51f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_5f51f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_5f51f8(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f58be189c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_5f51f8() { + vector res = rsqrt((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_5f51f8(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80d1b6782e --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void inverseSqrt_5f51f8() { + vector res = rsqrt((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_5f51f8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000288A2227E00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.glsl new file mode 100644 index 0000000000..4e73df641b --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_5f51f8() { + f16vec2 res = inversesqrt(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + inverseSqrt_5f51f8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_5f51f8() { + f16vec2 res = inversesqrt(f16vec2(0.0hf)); +} + +void fragment_main() { + inverseSqrt_5f51f8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_5f51f8() { + f16vec2 res = inversesqrt(f16vec2(0.0hf)); +} + +void compute_main() { + inverseSqrt_5f51f8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.msl new file mode 100644 index 0000000000..2e7d4bd952 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_5f51f8() { + half2 res = rsqrt(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +kernel void compute_main() { + inverseSqrt_5f51f8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd5caca4d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_5f51f8 "inverseSqrt_5f51f8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_5f51f8 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 InverseSqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.wgsl new file mode 100644 index 0000000000..672f0e39f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/5f51f8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn inverseSqrt_5f51f8() { + var res : vec2 = inverseSqrt(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_5f51f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_5f51f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_5f51f8(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl new file mode 100644 index 0000000000..8d819ef721 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(f32) -> f32 +fn inverseSqrt_84407e() { + var res: f32 = inverseSqrt(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_84407e(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_84407e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_84407e(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4a3e57ec00 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_84407e() { + float res = rsqrt(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_84407e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_84407e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_84407e(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4a3e57ec00 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_84407e() { + float res = rsqrt(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_84407e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_84407e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_84407e(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.glsl new file mode 100644 index 0000000000..eef230ff66 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void inverseSqrt_84407e() { + float res = inversesqrt(1.0f); +} + +vec4 vertex_main() { + inverseSqrt_84407e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_84407e() { + float res = inversesqrt(1.0f); +} + +void fragment_main() { + inverseSqrt_84407e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_84407e() { + float res = inversesqrt(1.0f); +} + +void compute_main() { + inverseSqrt_84407e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.msl new file mode 100644 index 0000000000..35b0239331 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_84407e() { + float res = rsqrt(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_84407e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_84407e(); + return; +} + +kernel void compute_main() { + inverseSqrt_84407e(); + return; +} + diff --git a/test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/inverseSqrt/84407e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.wgsl new file mode 100644 index 0000000000..1afdfc4c7a --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/84407e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn inverseSqrt_84407e() { + var res : f32 = inverseSqrt(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_84407e(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_84407e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_84407e(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl new file mode 100644 index 0000000000..24b8f51b15 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(vec<2, f32>) -> vec<2, f32> +fn inverseSqrt_8f2bd2() { + var res: vec2 = inverseSqrt(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_8f2bd2(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_8f2bd2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_8f2bd2(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0487c4cc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_8f2bd2() { + float2 res = rsqrt((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_8f2bd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_8f2bd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_8f2bd2(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c0487c4cc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_8f2bd2() { + float2 res = rsqrt((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_8f2bd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_8f2bd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_8f2bd2(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.glsl new file mode 100644 index 0000000000..7a9a429777 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void inverseSqrt_8f2bd2() { + vec2 res = inversesqrt(vec2(1.0f)); +} + +vec4 vertex_main() { + inverseSqrt_8f2bd2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_8f2bd2() { + vec2 res = inversesqrt(vec2(1.0f)); +} + +void fragment_main() { + inverseSqrt_8f2bd2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_8f2bd2() { + vec2 res = inversesqrt(vec2(1.0f)); +} + +void compute_main() { + inverseSqrt_8f2bd2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.msl new file mode 100644 index 0000000000..c4436e3ecd --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_8f2bd2() { + float2 res = rsqrt(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_8f2bd2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_8f2bd2(); + return; +} + +kernel void compute_main() { + inverseSqrt_8f2bd2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.spvasm new file mode 100644 index 0000000000..5e60aeafd1 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_8f2bd2 "inverseSqrt_8f2bd2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%inverseSqrt_8f2bd2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 InverseSqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %inverseSqrt_8f2bd2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %inverseSqrt_8f2bd2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %inverseSqrt_8f2bd2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fe7a7ca52 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/8f2bd2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn inverseSqrt_8f2bd2() { + var res : vec2 = inverseSqrt(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_8f2bd2(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_8f2bd2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_8f2bd2(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl new file mode 100644 index 0000000000..c1144e4dff --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(vec<3, f32>) -> vec<3, f32> +fn inverseSqrt_b197b1() { + var res: vec3 = inverseSqrt(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b197b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b197b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b197b1(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e9b409019f --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_b197b1() { + float3 res = rsqrt((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b197b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b197b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b197b1(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e9b409019f --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_b197b1() { + float3 res = rsqrt((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b197b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b197b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b197b1(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.glsl new file mode 100644 index 0000000000..266b109a44 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void inverseSqrt_b197b1() { + vec3 res = inversesqrt(vec3(1.0f)); +} + +vec4 vertex_main() { + inverseSqrt_b197b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_b197b1() { + vec3 res = inversesqrt(vec3(1.0f)); +} + +void fragment_main() { + inverseSqrt_b197b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_b197b1() { + vec3 res = inversesqrt(vec3(1.0f)); +} + +void compute_main() { + inverseSqrt_b197b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.msl new file mode 100644 index 0000000000..e8f6fa126d --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_b197b1() { + float3 res = rsqrt(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_b197b1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_b197b1(); + return; +} + +kernel void compute_main() { + inverseSqrt_b197b1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.spvasm new file mode 100644 index 0000000000..88ee7d3072 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_b197b1 "inverseSqrt_b197b1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%inverseSqrt_b197b1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 InverseSqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %inverseSqrt_b197b1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %inverseSqrt_b197b1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %inverseSqrt_b197b1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8920cdcdf --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b197b1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn inverseSqrt_b197b1() { + var res : vec3 = inverseSqrt(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b197b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b197b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b197b1(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl new file mode 100644 index 0000000000..2a389e21ac --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<3, f16>) -> vec<3, f16> +fn inverseSqrt_b85ebd() { + var res: vec3 = inverseSqrt(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b85ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b85ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b85ebd(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef654c9c6d --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_b85ebd() { + vector res = rsqrt((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b85ebd(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6e08e83084 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void inverseSqrt_b85ebd() { + vector res = rsqrt((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b85ebd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FEA9110080(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.glsl new file mode 100644 index 0000000000..12e5cabfa7 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_b85ebd() { + f16vec3 res = inversesqrt(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + inverseSqrt_b85ebd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_b85ebd() { + f16vec3 res = inversesqrt(f16vec3(0.0hf)); +} + +void fragment_main() { + inverseSqrt_b85ebd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_b85ebd() { + f16vec3 res = inversesqrt(f16vec3(0.0hf)); +} + +void compute_main() { + inverseSqrt_b85ebd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.msl new file mode 100644 index 0000000000..351560a86a --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_b85ebd() { + half3 res = rsqrt(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +kernel void compute_main() { + inverseSqrt_b85ebd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.spvasm new file mode 100644 index 0000000000..05243bc21e --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_b85ebd "inverseSqrt_b85ebd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_b85ebd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 InverseSqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.wgsl new file mode 100644 index 0000000000..e9c1e7e79c --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/b85ebd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn inverseSqrt_b85ebd() { + var res : vec3 = inverseSqrt(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b85ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b85ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b85ebd(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl new file mode 100644 index 0000000000..368317b185 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(vec<4, f32>) -> vec<4, f32> +fn inverseSqrt_c22347() { + var res: vec4 = inverseSqrt(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_c22347(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_c22347(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_c22347(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3cddf65cc0 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_c22347() { + float4 res = rsqrt((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_c22347(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_c22347(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_c22347(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3cddf65cc0 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_c22347() { + float4 res = rsqrt((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_c22347(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_c22347(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_c22347(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.glsl new file mode 100644 index 0000000000..a788f74f9e --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void inverseSqrt_c22347() { + vec4 res = inversesqrt(vec4(1.0f)); +} + +vec4 vertex_main() { + inverseSqrt_c22347(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_c22347() { + vec4 res = inversesqrt(vec4(1.0f)); +} + +void fragment_main() { + inverseSqrt_c22347(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_c22347() { + vec4 res = inversesqrt(vec4(1.0f)); +} + +void compute_main() { + inverseSqrt_c22347(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.msl new file mode 100644 index 0000000000..afad412c00 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_c22347() { + float4 res = rsqrt(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_c22347(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_c22347(); + return; +} + +kernel void compute_main() { + inverseSqrt_c22347(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.spvasm new file mode 100644 index 0000000000..f487a3be6d --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_c22347 "inverseSqrt_c22347" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%inverseSqrt_c22347 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 InverseSqrt %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %inverseSqrt_c22347 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %inverseSqrt_c22347 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %inverseSqrt_c22347 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.wgsl new file mode 100644 index 0000000000..cbcfd78ac9 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/c22347.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn inverseSqrt_c22347() { + var res : vec4 = inverseSqrt(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_c22347(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_c22347(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_c22347(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl new file mode 100644 index 0000000000..8657926b77 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<4, f16>) -> vec<4, f16> +fn inverseSqrt_cbdc70() { + var res: vec4 = inverseSqrt(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_cbdc70(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_cbdc70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_cbdc70(); +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ed1f192d8e --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void inverseSqrt_cbdc70() { + vector res = rsqrt((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_cbdc70(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6880c60d75 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void inverseSqrt_cbdc70() { + vector res = rsqrt((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_cbdc70(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E1CCE37DA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.glsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.glsl new file mode 100644 index 0000000000..43f1edabed --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_cbdc70() { + f16vec4 res = inversesqrt(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + inverseSqrt_cbdc70(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_cbdc70() { + f16vec4 res = inversesqrt(f16vec4(0.0hf)); +} + +void fragment_main() { + inverseSqrt_cbdc70(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_cbdc70() { + f16vec4 res = inversesqrt(f16vec4(0.0hf)); +} + +void compute_main() { + inverseSqrt_cbdc70(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.msl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.msl new file mode 100644 index 0000000000..f1610f83d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void inverseSqrt_cbdc70() { + half4 res = rsqrt(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +kernel void compute_main() { + inverseSqrt_cbdc70(); + return; +} + diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.spvasm new file mode 100644 index 0000000000..43367c1689 --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_cbdc70 "inverseSqrt_cbdc70" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_cbdc70 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 InverseSqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.wgsl new file mode 100644 index 0000000000..2290320a6f --- /dev/null +++ b/test/tint/builtins/gen/literal/inverseSqrt/cbdc70.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn inverseSqrt_cbdc70() { + var res : vec4 = inverseSqrt(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_cbdc70(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_cbdc70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_cbdc70(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl new file mode 100644 index 0000000000..bed22e2812 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<2, f16>, vec<2, i32>) -> vec<2, f16> +fn ldexp_3d90b4() { + var res: vec2 = ldexp(vec2(f16()), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_3d90b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_3d90b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_3d90b4(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae0933efb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_3d90b4() { + vector res = ldexp((float16_t(0.0h)).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_3d90b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_3d90b4(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0608e1f9d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ldexp_3d90b4() { + vector res = ldexp((float16_t(0.0h)).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_3d90b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_3d90b4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001808B7D81C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.glsl new file mode 100644 index 0000000000..74ee06a091 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_3d90b4() { + f16vec2 res = ldexp(f16vec2(0.0hf), ivec2(1)); +} + +vec4 vertex_main() { + ldexp_3d90b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_3d90b4() { + f16vec2 res = ldexp(f16vec2(0.0hf), ivec2(1)); +} + +void fragment_main() { + ldexp_3d90b4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_3d90b4() { + f16vec2 res = ldexp(f16vec2(0.0hf), ivec2(1)); +} + +void compute_main() { + ldexp_3d90b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.msl new file mode 100644 index 0000000000..9d9e2ac28e --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_3d90b4() { + half2 res = ldexp(half2(0.0h), int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_3d90b4(); + return; +} + +kernel void compute_main() { + ldexp_3d90b4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.spvasm new file mode 100644 index 0000000000..0847908d63 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_3d90b4 "ldexp_3d90b4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_3d90b4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Ldexp %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %ldexp_3d90b4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_3d90b4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_3d90b4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..cacab9eb7a --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/3d90b4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ldexp_3d90b4() { + var res : vec2 = ldexp(vec2(f16()), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_3d90b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_3d90b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_3d90b4(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl new file mode 100644 index 0000000000..24f8054a57 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(f16, i32) -> f16 +fn ldexp_624e0c() { + var res: f16 = ldexp(f16(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_624e0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_624e0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_624e0c(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c978bcfbd4 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_624e0c() { + float16_t res = ldexp(float16_t(0.0h), 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_624e0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_624e0c(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d3e207e56c --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void ldexp_624e0c() { + float16_t res = ldexp(float16_t(0.0h), 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_624e0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_624e0c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F949F984D0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F949F984D0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.glsl new file mode 100644 index 0000000000..f856c620e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_624e0c() { + float16_t res = ldexp(0.0hf, 1); +} + +vec4 vertex_main() { + ldexp_624e0c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_624e0c() { + float16_t res = ldexp(0.0hf, 1); +} + +void fragment_main() { + ldexp_624e0c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_624e0c() { + float16_t res = ldexp(0.0hf, 1); +} + +void compute_main() { + ldexp_624e0c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.msl new file mode 100644 index 0000000000..e63d73662c --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_624e0c() { + half res = ldexp(0.0h, 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_624e0c(); + return; +} + +kernel void compute_main() { + ldexp_624e0c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.spvasm new file mode 100644 index 0000000000..13ce90811b --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_624e0c "ldexp_624e0c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_624e0c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Ldexp %16 %int_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %ldexp_624e0c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %ldexp_624e0c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_624e0c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d6ebc8418 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/624e0c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ldexp_624e0c() { + var res : f16 = ldexp(f16(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_624e0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_624e0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_624e0c(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl new file mode 100644 index 0000000000..01a4e811c7 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<3, f16>, vec<3, i32>) -> vec<3, f16> +fn ldexp_7485ce() { + var res: vec3 = ldexp(vec3(f16()), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7485ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7485ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7485ce(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..731bb5d30a --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_7485ce() { + vector res = ldexp((float16_t(0.0h)).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7485ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7485ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac6b68f630 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ldexp_7485ce() { + vector res = ldexp((float16_t(0.0h)).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7485ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7485ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001698F7B0100(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.glsl new file mode 100644 index 0000000000..4a19e3c227 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7485ce() { + f16vec3 res = ldexp(f16vec3(0.0hf), ivec3(1)); +} + +vec4 vertex_main() { + ldexp_7485ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_7485ce() { + f16vec3 res = ldexp(f16vec3(0.0hf), ivec3(1)); +} + +void fragment_main() { + ldexp_7485ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7485ce() { + f16vec3 res = ldexp(f16vec3(0.0hf), ivec3(1)); +} + +void compute_main() { + ldexp_7485ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.msl new file mode 100644 index 0000000000..b5d93bfe7e --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_7485ce() { + half3 res = ldexp(half3(0.0h), int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_7485ce(); + return; +} + +kernel void compute_main() { + ldexp_7485ce(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..985d48996e --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_7485ce "ldexp_7485ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_7485ce = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Ldexp %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %ldexp_7485ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_7485ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_7485ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..99f6df264a --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7485ce.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ldexp_7485ce() { + var res : vec3 = ldexp(vec3(f16()), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7485ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7485ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7485ce(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl new file mode 100644 index 0000000000..a79176797c --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<4, f16>, vec<4, i32>) -> vec<4, f16> +fn ldexp_7fa13c() { + var res: vec4 = ldexp(vec4(f16()), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7fa13c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7fa13c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7fa13c(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..774c31e308 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_7fa13c() { + vector res = ldexp((float16_t(0.0h)).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7fa13c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7fa13c(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a53fa359dc --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void ldexp_7fa13c() { + vector res = ldexp((float16_t(0.0h)).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7fa13c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7fa13c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018D79877AB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.glsl new file mode 100644 index 0000000000..30b6c1d9fa --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7fa13c() { + f16vec4 res = ldexp(f16vec4(0.0hf), ivec4(1)); +} + +vec4 vertex_main() { + ldexp_7fa13c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_7fa13c() { + f16vec4 res = ldexp(f16vec4(0.0hf), ivec4(1)); +} + +void fragment_main() { + ldexp_7fa13c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7fa13c() { + f16vec4 res = ldexp(f16vec4(0.0hf), ivec4(1)); +} + +void compute_main() { + ldexp_7fa13c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.msl new file mode 100644 index 0000000000..b348e4a8e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_7fa13c() { + half4 res = ldexp(half4(0.0h), int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_7fa13c(); + return; +} + +kernel void compute_main() { + ldexp_7fa13c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.spvasm new file mode 100644 index 0000000000..f389bc34e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_7fa13c "ldexp_7fa13c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_7fa13c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Ldexp %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %ldexp_7fa13c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_7fa13c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_7fa13c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.wgsl new file mode 100644 index 0000000000..a42ea96349 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/7fa13c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn ldexp_7fa13c() { + var res : vec4 = ldexp(vec4(f16()), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7fa13c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7fa13c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7fa13c(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl new file mode 100644 index 0000000000..0460f2399a --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(vec<3, f32>, vec<3, i32>) -> vec<3, f32> +fn ldexp_a31cdc() { + var res: vec3 = ldexp(vec3(1.f), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_a31cdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_a31cdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_a31cdc(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2ec51db34 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_a31cdc() { + float3 res = ldexp((1.0f).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_a31cdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_a31cdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_a31cdc(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b2ec51db34 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_a31cdc() { + float3 res = ldexp((1.0f).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_a31cdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_a31cdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_a31cdc(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.glsl new file mode 100644 index 0000000000..6183994b60 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void ldexp_a31cdc() { + vec3 res = ldexp(vec3(1.0f), ivec3(1)); +} + +vec4 vertex_main() { + ldexp_a31cdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_a31cdc() { + vec3 res = ldexp(vec3(1.0f), ivec3(1)); +} + +void fragment_main() { + ldexp_a31cdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_a31cdc() { + vec3 res = ldexp(vec3(1.0f), ivec3(1)); +} + +void compute_main() { + ldexp_a31cdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.msl new file mode 100644 index 0000000000..14c9d99921 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_a31cdc() { + float3 res = ldexp(float3(1.0f), int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_a31cdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_a31cdc(); + return; +} + +kernel void compute_main() { + ldexp_a31cdc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..ea305234c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_a31cdc "ldexp_a31cdc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %24 = OpConstantNull %v3float + %25 = OpTypeFunction %v4float +%ldexp_a31cdc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %24 + %13 = OpExtInst %v3float %15 Ldexp %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %ldexp_a31cdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_a31cdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_a31cdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..920f1c584d --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/a31cdc.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn ldexp_a31cdc() { + var res : vec3 = ldexp(vec3(1.0f), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_a31cdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_a31cdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_a31cdc(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/abd718.wgsl b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl new file mode 100644 index 0000000000..1461de3e05 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(vec<2, f32>, vec<2, i32>) -> vec<2, f32> +fn ldexp_abd718() { + var res: vec2 = ldexp(vec2(1.f), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_abd718(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_abd718(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_abd718(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e630230fe4 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_abd718() { + float2 res = ldexp((1.0f).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_abd718(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_abd718(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_abd718(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e630230fe4 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_abd718() { + float2 res = ldexp((1.0f).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_abd718(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_abd718(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_abd718(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.glsl new file mode 100644 index 0000000000..c529027948 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void ldexp_abd718() { + vec2 res = ldexp(vec2(1.0f), ivec2(1)); +} + +vec4 vertex_main() { + ldexp_abd718(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_abd718() { + vec2 res = ldexp(vec2(1.0f), ivec2(1)); +} + +void fragment_main() { + ldexp_abd718(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_abd718() { + vec2 res = ldexp(vec2(1.0f), ivec2(1)); +} + +void compute_main() { + ldexp_abd718(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.msl new file mode 100644 index 0000000000..2e6ab5c61d --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_abd718() { + float2 res = ldexp(float2(1.0f), int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_abd718(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_abd718(); + return; +} + +kernel void compute_main() { + ldexp_abd718(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.spvasm new file mode 100644 index 0000000000..c00bbce1e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_abd718 "ldexp_abd718" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float +%ldexp_abd718 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %24 + %13 = OpExtInst %v2float %15 Ldexp %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %ldexp_abd718 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_abd718 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_abd718 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.wgsl new file mode 100644 index 0000000000..884585bb7b --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/abd718.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn ldexp_abd718() { + var res : vec2 = ldexp(vec2(1.0f), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_abd718(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_abd718(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_abd718(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl new file mode 100644 index 0000000000..eb958562ae --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(vec<4, f32>, vec<4, i32>) -> vec<4, f32> +fn ldexp_cc9cde() { + var res: vec4 = ldexp(vec4(1.f), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_cc9cde(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_cc9cde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_cc9cde(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9769500139 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_cc9cde() { + float4 res = ldexp((1.0f).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_cc9cde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_cc9cde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_cc9cde(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9769500139 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_cc9cde() { + float4 res = ldexp((1.0f).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_cc9cde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_cc9cde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_cc9cde(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.glsl new file mode 100644 index 0000000000..99f1ba3866 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void ldexp_cc9cde() { + vec4 res = ldexp(vec4(1.0f), ivec4(1)); +} + +vec4 vertex_main() { + ldexp_cc9cde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_cc9cde() { + vec4 res = ldexp(vec4(1.0f), ivec4(1)); +} + +void fragment_main() { + ldexp_cc9cde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_cc9cde() { + vec4 res = ldexp(vec4(1.0f), ivec4(1)); +} + +void compute_main() { + ldexp_cc9cde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.msl new file mode 100644 index 0000000000..cdaeabfb28 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_cc9cde() { + float4 res = ldexp(float4(1.0f), int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_cc9cde(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_cc9cde(); + return; +} + +kernel void compute_main() { + ldexp_cc9cde(); + return; +} + diff --git a/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.spvasm new file mode 100644 index 0000000000..da8bfed14d --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_cc9cde "ldexp_cc9cde" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %20 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float +%ldexp_cc9cde = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Ldexp %16 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %ldexp_cc9cde + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ldexp_cc9cde + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ldexp_cc9cde + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d104b6a31 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/cc9cde.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn ldexp_cc9cde() { + var res : vec4 = ldexp(vec4(1.0f), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_cc9cde(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_cc9cde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_cc9cde(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl new file mode 100644 index 0000000000..d85c1b4801 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(f32, i32) -> f32 +fn ldexp_db8b49() { + var res: f32 = ldexp(1.f, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_db8b49(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_db8b49(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_db8b49(); +} diff --git a/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..43091d15b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_db8b49() { + float res = ldexp(1.0f, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_db8b49(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_db8b49(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_db8b49(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43091d15b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void ldexp_db8b49() { + float res = ldexp(1.0f, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_db8b49(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_db8b49(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_db8b49(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.glsl b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.glsl new file mode 100644 index 0000000000..00cc0c840f --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void ldexp_db8b49() { + float res = ldexp(1.0f, 1); +} + +vec4 vertex_main() { + ldexp_db8b49(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_db8b49() { + float res = ldexp(1.0f, 1); +} + +void fragment_main() { + ldexp_db8b49(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_db8b49() { + float res = ldexp(1.0f, 1); +} + +void compute_main() { + ldexp_db8b49(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.msl b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.msl new file mode 100644 index 0000000000..e9ca7818af --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void ldexp_db8b49() { + float res = ldexp(1.0f, 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_db8b49(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_db8b49(); + return; +} + +kernel void compute_main() { + ldexp_db8b49(); + return; +} + diff --git a/test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/ldexp/db8b49.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.wgsl new file mode 100644 index 0000000000..374a55f47a --- /dev/null +++ b/test/tint/builtins/gen/literal/ldexp/db8b49.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn ldexp_db8b49() { + var res : f32 = ldexp(1.0f, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_db8b49(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_db8b49(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_db8b49(); +} diff --git a/test/tint/builtins/gen/literal/length/056071.wgsl b/test/tint/builtins/gen/literal/length/056071.wgsl new file mode 100644 index 0000000000..8fc39ba92d --- /dev/null +++ b/test/tint/builtins/gen/literal/length/056071.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(vec<3, f32>) -> f32 +fn length_056071() { + var res: f32 = length(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_056071(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_056071(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_056071(); +} diff --git a/test/tint/builtins/gen/literal/length/056071.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..059bd52fb0 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_056071() { + float res = length((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_056071(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_056071(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_056071(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/056071.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..059bd52fb0 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void length_056071() { + float res = length((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_056071(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_056071(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_056071(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/056071.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.glsl new file mode 100644 index 0000000000..13c4890b46 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void length_056071() { + float res = length(vec3(1.0f)); +} + +vec4 vertex_main() { + length_056071(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_056071() { + float res = length(vec3(1.0f)); +} + +void fragment_main() { + length_056071(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_056071() { + float res = length(vec3(1.0f)); +} + +void compute_main() { + length_056071(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/056071.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.msl new file mode 100644 index 0000000000..387e06d238 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_056071() { + float res = length(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_056071(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_056071(); + return; +} + +kernel void compute_main() { + length_056071(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/056071.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f13f37e35 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_056071 "length_056071" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%length_056071 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Length %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %length_056071 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %length_056071 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %length_056071 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/056071.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.wgsl new file mode 100644 index 0000000000..d83825d83f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/056071.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn length_056071() { + var res : f32 = length(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_056071(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_056071(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_056071(); +} diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl new file mode 100644 index 0000000000..4306efe403 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<2, f16>) -> f16 +fn length_3f0e13() { + var res: f16 = length(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_3f0e13(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_3f0e13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_3f0e13(); +} diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..08660e8d15 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_3f0e13() { + float16_t res = length((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_3f0e13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_3f0e13(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aaa0dceb8f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void length_3f0e13() { + float16_t res = length((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_3f0e13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_3f0e13(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025534170870(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025534170870(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.glsl new file mode 100644 index 0000000000..ff3bb99e81 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_3f0e13() { + float16_t res = length(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + length_3f0e13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_3f0e13() { + float16_t res = length(f16vec2(0.0hf)); +} + +void fragment_main() { + length_3f0e13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_3f0e13() { + float16_t res = length(f16vec2(0.0hf)); +} + +void compute_main() { + length_3f0e13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.msl new file mode 100644 index 0000000000..2aadef91af --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_3f0e13() { + half res = length(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_3f0e13(); + return; +} + +kernel void compute_main() { + length_3f0e13(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.spvasm new file mode 100644 index 0000000000..580976223c --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_3f0e13 "length_3f0e13" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_3f0e13 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Length %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %length_3f0e13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_3f0e13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_3f0e13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.wgsl new file mode 100644 index 0000000000..d97f9c87e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/3f0e13.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn length_3f0e13() { + var res : f16 = length(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_3f0e13(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_3f0e13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_3f0e13(); +} diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl new file mode 100644 index 0000000000..be2dbf195f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<4, f16>) -> f16 +fn length_5b1a9b() { + var res: f16 = length(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_5b1a9b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_5b1a9b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_5b1a9b(); +} diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..efaee527ed --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_5b1a9b() { + float16_t res = length((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_5b1a9b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_5b1a9b(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..736654a6f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void length_5b1a9b() { + float16_t res = length((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_5b1a9b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_5b1a9b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000206B010D5C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000206B010D5C0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.glsl new file mode 100644 index 0000000000..0fc543333b --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_5b1a9b() { + float16_t res = length(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + length_5b1a9b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_5b1a9b() { + float16_t res = length(f16vec4(0.0hf)); +} + +void fragment_main() { + length_5b1a9b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_5b1a9b() { + float16_t res = length(f16vec4(0.0hf)); +} + +void compute_main() { + length_5b1a9b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.msl new file mode 100644 index 0000000000..c1013ee8a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_5b1a9b() { + half res = length(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_5b1a9b(); + return; +} + +kernel void compute_main() { + length_5b1a9b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.spvasm new file mode 100644 index 0000000000..c112767a08 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_5b1a9b "length_5b1a9b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_5b1a9b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Length %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %length_5b1a9b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_5b1a9b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_5b1a9b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.wgsl new file mode 100644 index 0000000000..526971a68e --- /dev/null +++ b/test/tint/builtins/gen/literal/length/5b1a9b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn length_5b1a9b() { + var res : f16 = length(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_5b1a9b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_5b1a9b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_5b1a9b(); +} diff --git a/test/tint/builtins/gen/literal/length/602a17.wgsl b/test/tint/builtins/gen/literal/length/602a17.wgsl new file mode 100644 index 0000000000..a9d46240d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/602a17.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(f32) -> f32 +fn length_602a17() { + var res: f32 = length(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_602a17(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_602a17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_602a17(); +} diff --git a/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c0ce3943d --- /dev/null +++ b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_602a17() { + float res = length(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_602a17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_602a17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_602a17(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c0ce3943d --- /dev/null +++ b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void length_602a17() { + float res = length(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_602a17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_602a17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_602a17(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.glsl new file mode 100644 index 0000000000..d6cce45ca8 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void length_602a17() { + float res = length(1.0f); +} + +vec4 vertex_main() { + length_602a17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_602a17() { + float res = length(1.0f); +} + +void fragment_main() { + length_602a17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_602a17() { + float res = length(1.0f); +} + +void compute_main() { + length_602a17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.msl new file mode 100644 index 0000000000..86bfa31fc7 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_602a17() { + float res = fabs(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_602a17(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_602a17(); + return; +} + +kernel void compute_main() { + length_602a17(); + return; +} + diff --git a/test/tint/builtins/gen/length/602a17.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/length/602a17.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/length/602a17.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.wgsl new file mode 100644 index 0000000000..9209e3fc2f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/602a17.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn length_602a17() { + var res : f32 = length(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_602a17(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_602a17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_602a17(); +} diff --git a/test/tint/builtins/gen/literal/length/afde8b.wgsl b/test/tint/builtins/gen/literal/length/afde8b.wgsl new file mode 100644 index 0000000000..4d0092bf06 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/afde8b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(vec<2, f32>) -> f32 +fn length_afde8b() { + var res: f32 = length(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_afde8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_afde8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_afde8b(); +} diff --git a/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fedf5b1a0f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_afde8b() { + float res = length((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_afde8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_afde8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_afde8b(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fedf5b1a0f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void length_afde8b() { + float res = length((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_afde8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_afde8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_afde8b(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.glsl new file mode 100644 index 0000000000..c81bf7b56e --- /dev/null +++ b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void length_afde8b() { + float res = length(vec2(1.0f)); +} + +vec4 vertex_main() { + length_afde8b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_afde8b() { + float res = length(vec2(1.0f)); +} + +void fragment_main() { + length_afde8b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_afde8b() { + float res = length(vec2(1.0f)); +} + +void compute_main() { + length_afde8b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.msl new file mode 100644 index 0000000000..74668c52da --- /dev/null +++ b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_afde8b() { + float res = length(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_afde8b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_afde8b(); + return; +} + +kernel void compute_main() { + length_afde8b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.spvasm new file mode 100644 index 0000000000..d82d662150 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_afde8b "length_afde8b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%length_afde8b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Length %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %length_afde8b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %length_afde8b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %length_afde8b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.wgsl new file mode 100644 index 0000000000..77a600c723 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/afde8b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn length_afde8b() { + var res : f32 = length(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_afde8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_afde8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_afde8b(); +} diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl new file mode 100644 index 0000000000..a51f78a62f --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<3, f16>) -> f16 +fn length_ba16d6() { + var res: f16 = length(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_ba16d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_ba16d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_ba16d6(); +} diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0c7954274 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_ba16d6() { + float16_t res = length((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_ba16d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_ba16d6(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..99ff3bb2c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void length_ba16d6() { + float16_t res = length((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_ba16d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_ba16d6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE9E8E87F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE9E8E87F0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.glsl new file mode 100644 index 0000000000..57c51de74c --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_ba16d6() { + float16_t res = length(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + length_ba16d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_ba16d6() { + float16_t res = length(f16vec3(0.0hf)); +} + +void fragment_main() { + length_ba16d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_ba16d6() { + float16_t res = length(f16vec3(0.0hf)); +} + +void compute_main() { + length_ba16d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.msl new file mode 100644 index 0000000000..c5e50591a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_ba16d6() { + half res = length(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_ba16d6(); + return; +} + +kernel void compute_main() { + length_ba16d6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..9cb2b45ee8 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_ba16d6 "length_ba16d6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpConstantNull %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_ba16d6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %20 + %13 = OpExtInst %half %15 Length %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %length_ba16d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_ba16d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_ba16d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef23cb8166 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/ba16d6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn length_ba16d6() { + var res : f16 = length(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_ba16d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_ba16d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_ba16d6(); +} diff --git a/test/tint/builtins/gen/literal/length/becebf.wgsl b/test/tint/builtins/gen/literal/length/becebf.wgsl new file mode 100644 index 0000000000..7429e61874 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/becebf.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(vec<4, f32>) -> f32 +fn length_becebf() { + var res: f32 = length(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_becebf(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_becebf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_becebf(); +} diff --git a/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2d55ef8491 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_becebf() { + float res = length((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_becebf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_becebf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_becebf(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d55ef8491 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void length_becebf() { + float res = length((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_becebf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_becebf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_becebf(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.glsl new file mode 100644 index 0000000000..b83674639d --- /dev/null +++ b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void length_becebf() { + float res = length(vec4(1.0f)); +} + +vec4 vertex_main() { + length_becebf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_becebf() { + float res = length(vec4(1.0f)); +} + +void fragment_main() { + length_becebf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_becebf() { + float res = length(vec4(1.0f)); +} + +void compute_main() { + length_becebf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.msl new file mode 100644 index 0000000000..fdc96aa434 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_becebf() { + float res = length(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_becebf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_becebf(); + return; +} + +kernel void compute_main() { + length_becebf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ca602ff81 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_becebf "length_becebf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpTypeFunction %v4float +%length_becebf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpExtInst %float %14 Length %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %length_becebf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %length_becebf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_becebf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6e3b713b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/becebf.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn length_becebf() { + var res : f32 = length(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_becebf(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_becebf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_becebf(); +} diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl b/test/tint/builtins/gen/literal/length/c158da.wgsl new file mode 100644 index 0000000000..70b692f5b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(f16) -> f16 +fn length_c158da() { + var res: f16 = length(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_c158da(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_c158da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_c158da(); +} diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5b0e775764 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void length_c158da() { + float16_t res = length(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_c158da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_c158da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_c158da(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2a73153d64 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void length_c158da() { + float16_t res = length(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_c158da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_c158da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_c158da(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B0C50014C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B0C50014C0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.glsl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.glsl new file mode 100644 index 0000000000..afc15b3d13 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_c158da() { + float16_t res = length(0.0hf); +} + +vec4 vertex_main() { + length_c158da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_c158da() { + float16_t res = length(0.0hf); +} + +void fragment_main() { + length_c158da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_c158da() { + float16_t res = length(0.0hf); +} + +void compute_main() { + length_c158da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.msl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.msl new file mode 100644 index 0000000000..f9f3a70c57 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void length_c158da() { + half res = fabs(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_c158da(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_c158da(); + return; +} + +kernel void compute_main() { + length_c158da(); + return; +} + diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.spvasm new file mode 100644 index 0000000000..8199018c86 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_c158da "length_c158da" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_c158da = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Length %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %length_c158da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %length_c158da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %length_c158da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cbfcfe859 --- /dev/null +++ b/test/tint/builtins/gen/literal/length/c158da.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn length_c158da() { + var res : f16 = length(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_c158da(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_c158da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_c158da(); +} diff --git a/test/tint/builtins/gen/literal/log/3da25a.wgsl b/test/tint/builtins/gen/literal/log/3da25a.wgsl new file mode 100644 index 0000000000..7cb7b97dd4 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/3da25a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(vec<4, f32>) -> vec<4, f32> +fn log_3da25a() { + var res: vec4 = log(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_3da25a(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_3da25a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_3da25a(); +} diff --git a/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0c3c6d1a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_3da25a() { + float4 res = log((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_3da25a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_3da25a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_3da25a(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c0c3c6d1a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void log_3da25a() { + float4 res = log((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_3da25a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_3da25a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_3da25a(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.glsl new file mode 100644 index 0000000000..df5ca13d23 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void log_3da25a() { + vec4 res = log(vec4(1.0f)); +} + +vec4 vertex_main() { + log_3da25a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_3da25a() { + vec4 res = log(vec4(1.0f)); +} + +void fragment_main() { + log_3da25a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_3da25a() { + vec4 res = log(vec4(1.0f)); +} + +void compute_main() { + log_3da25a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.msl new file mode 100644 index 0000000000..dc18bb99d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_3da25a() { + float4 res = log(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_3da25a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_3da25a(); + return; +} + +kernel void compute_main() { + log_3da25a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.spvasm new file mode 100644 index 0000000000..65cc0302d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_3da25a "log_3da25a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %log_3da25a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Log %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %log_3da25a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %log_3da25a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log_3da25a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b52a980e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn log_3da25a() { + var res : vec4 = log(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_3da25a(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_3da25a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_3da25a(); +} diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl new file mode 100644 index 0000000000..761a154d1f --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<3, f16>) -> vec<3, f16> +fn log_6ff86f() { + var res: vec3 = log(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_6ff86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_6ff86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_6ff86f(); +} diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b141371603 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_6ff86f() { + vector res = log((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_6ff86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_6ff86f(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f4b2ef8b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log_6ff86f() { + vector res = log((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_6ff86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_6ff86f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000269CEF087E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.glsl new file mode 100644 index 0000000000..2d6e06dd6a --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_6ff86f() { + f16vec3 res = log(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + log_6ff86f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_6ff86f() { + f16vec3 res = log(f16vec3(0.0hf)); +} + +void fragment_main() { + log_6ff86f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_6ff86f() { + f16vec3 res = log(f16vec3(0.0hf)); +} + +void compute_main() { + log_6ff86f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.msl new file mode 100644 index 0000000000..ae294140ea --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_6ff86f() { + half3 res = log(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_6ff86f(); + return; +} + +kernel void compute_main() { + log_6ff86f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.spvasm new file mode 100644 index 0000000000..51676f2424 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_6ff86f "log_6ff86f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_6ff86f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Log %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log_6ff86f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log_6ff86f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log_6ff86f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.wgsl new file mode 100644 index 0000000000..9fbbe3ec2d --- /dev/null +++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log_6ff86f() { + var res : vec3 = log(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_6ff86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_6ff86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_6ff86f(); +} diff --git a/test/tint/builtins/gen/literal/log/7114a6.wgsl b/test/tint/builtins/gen/literal/log/7114a6.wgsl new file mode 100644 index 0000000000..6363655ddf --- /dev/null +++ b/test/tint/builtins/gen/literal/log/7114a6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(f32) -> f32 +fn log_7114a6() { + var res: f32 = log(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_7114a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_7114a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_7114a6(); +} diff --git a/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b9a62b68d --- /dev/null +++ b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_7114a6() { + float res = log(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_7114a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_7114a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_7114a6(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b9a62b68d --- /dev/null +++ b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void log_7114a6() { + float res = log(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_7114a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_7114a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_7114a6(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.glsl new file mode 100644 index 0000000000..0c5e7ea612 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void log_7114a6() { + float res = log(1.0f); +} + +vec4 vertex_main() { + log_7114a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_7114a6() { + float res = log(1.0f); +} + +void fragment_main() { + log_7114a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_7114a6() { + float res = log(1.0f); +} + +void compute_main() { + log_7114a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.msl new file mode 100644 index 0000000000..72da25e697 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_7114a6() { + float res = log(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_7114a6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_7114a6(); + return; +} + +kernel void compute_main() { + log_7114a6(); + return; +} + diff --git a/test/tint/builtins/gen/log/7114a6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/log/7114a6.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..176e330c61 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn log_7114a6() { + var res : f32 = log(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_7114a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_7114a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_7114a6(); +} diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl new file mode 100644 index 0000000000..0f6db81cd3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<2, f16>) -> vec<2, f16> +fn log_8f0e32() { + var res: vec2 = log(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_8f0e32(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_8f0e32(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_8f0e32(); +} diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c73463a00d --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_8f0e32() { + vector res = log((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_8f0e32(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_8f0e32(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c8ce6df0b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log_8f0e32() { + vector res = log((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_8f0e32(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_8f0e32(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000262B0B30AC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.glsl new file mode 100644 index 0000000000..923ec6a90e --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_8f0e32() { + f16vec2 res = log(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + log_8f0e32(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_8f0e32() { + f16vec2 res = log(f16vec2(0.0hf)); +} + +void fragment_main() { + log_8f0e32(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_8f0e32() { + f16vec2 res = log(f16vec2(0.0hf)); +} + +void compute_main() { + log_8f0e32(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.msl new file mode 100644 index 0000000000..ecced226fb --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_8f0e32() { + half2 res = log(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_8f0e32(); + return; +} + +kernel void compute_main() { + log_8f0e32(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.spvasm new file mode 100644 index 0000000000..7ff10aa72f --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_8f0e32 "log_8f0e32" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_8f0e32 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Log %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log_8f0e32 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log_8f0e32 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log_8f0e32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e2a7276a45 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log_8f0e32() { + var res : vec2 = log(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_8f0e32(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_8f0e32(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_8f0e32(); +} diff --git a/test/tint/builtins/gen/literal/log/b2ce28.wgsl b/test/tint/builtins/gen/literal/log/b2ce28.wgsl new file mode 100644 index 0000000000..9cd5b41a97 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/b2ce28.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(vec<2, f32>) -> vec<2, f32> +fn log_b2ce28() { + var res: vec2 = log(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_b2ce28(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_b2ce28(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_b2ce28(); +} diff --git a/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3eff95a367 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_b2ce28() { + float2 res = log((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_b2ce28(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_b2ce28(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_b2ce28(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3eff95a367 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void log_b2ce28() { + float2 res = log((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_b2ce28(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_b2ce28(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_b2ce28(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.glsl new file mode 100644 index 0000000000..cc98643daa --- /dev/null +++ b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void log_b2ce28() { + vec2 res = log(vec2(1.0f)); +} + +vec4 vertex_main() { + log_b2ce28(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_b2ce28() { + vec2 res = log(vec2(1.0f)); +} + +void fragment_main() { + log_b2ce28(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_b2ce28() { + vec2 res = log(vec2(1.0f)); +} + +void compute_main() { + log_b2ce28(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.msl new file mode 100644 index 0000000000..f9c13bd73f --- /dev/null +++ b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_b2ce28() { + float2 res = log(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_b2ce28(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_b2ce28(); + return; +} + +kernel void compute_main() { + log_b2ce28(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ea25fd7c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_b2ce28 "log_b2ce28" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %log_b2ce28 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Log %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log_b2ce28 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log_b2ce28 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log_b2ce28 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.wgsl new file mode 100644 index 0000000000..3fafdad3c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn log_b2ce28() { + var res : vec2 = log(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_b2ce28(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_b2ce28(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_b2ce28(); +} diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl new file mode 100644 index 0000000000..659b08c475 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(f16) -> f16 +fn log_c9f489() { + var res: f16 = log(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_c9f489(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_c9f489(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_c9f489(); +} diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eb5150b0a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_c9f489() { + float16_t res = log(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_c9f489(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_c9f489(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9510d92bf2 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void log_c9f489() { + float16_t res = log(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_c9f489(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_c9f489(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000200F08314A0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000200F08314A0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.glsl new file mode 100644 index 0000000000..62eeaa9507 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_c9f489() { + float16_t res = log(0.0hf); +} + +vec4 vertex_main() { + log_c9f489(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_c9f489() { + float16_t res = log(0.0hf); +} + +void fragment_main() { + log_c9f489(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_c9f489() { + float16_t res = log(0.0hf); +} + +void compute_main() { + log_c9f489(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.msl new file mode 100644 index 0000000000..65bd95a721 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_c9f489() { + half res = log(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_c9f489(); + return; +} + +kernel void compute_main() { + log_c9f489(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.spvasm new file mode 100644 index 0000000000..304b6ec93d --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_c9f489 "log_c9f489" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_c9f489 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Log %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %log_c9f489 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log_c9f489 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_c9f489 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.wgsl new file mode 100644 index 0000000000..6279a42ab8 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log_c9f489() { + var res : f16 = log(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_c9f489(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_c9f489(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_c9f489(); +} diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl new file mode 100644 index 0000000000..448267561c --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<4, f16>) -> vec<4, f16> +fn log_cdbdc1() { + var res: vec4 = log(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_cdbdc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_cdbdc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_cdbdc1(); +} diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..754e2906d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_cdbdc1() { + vector res = log((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_cdbdc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_cdbdc1(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..46491bc179 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log_cdbdc1() { + vector res = log((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_cdbdc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_cdbdc1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EBFCF31A60(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.glsl new file mode 100644 index 0000000000..41e6eab215 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_cdbdc1() { + f16vec4 res = log(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + log_cdbdc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_cdbdc1() { + f16vec4 res = log(f16vec4(0.0hf)); +} + +void fragment_main() { + log_cdbdc1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_cdbdc1() { + f16vec4 res = log(f16vec4(0.0hf)); +} + +void compute_main() { + log_cdbdc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.msl new file mode 100644 index 0000000000..77806e8fb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_cdbdc1() { + half4 res = log(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_cdbdc1(); + return; +} + +kernel void compute_main() { + log_cdbdc1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.spvasm new file mode 100644 index 0000000000..6eea354d8e --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_cdbdc1 "log_cdbdc1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_cdbdc1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Log %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log_cdbdc1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log_cdbdc1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log_cdbdc1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..645ccf90b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log_cdbdc1() { + var res : vec4 = log(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_cdbdc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_cdbdc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_cdbdc1(); +} diff --git a/test/tint/builtins/gen/literal/log/f4c570.wgsl b/test/tint/builtins/gen/literal/log/f4c570.wgsl new file mode 100644 index 0000000000..fad4f65fdf --- /dev/null +++ b/test/tint/builtins/gen/literal/log/f4c570.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(vec<3, f32>) -> vec<3, f32> +fn log_f4c570() { + var res: vec3 = log(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_f4c570(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_f4c570(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_f4c570(); +} diff --git a/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..28d545b076 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log_f4c570() { + float3 res = log((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_f4c570(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_f4c570(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_f4c570(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..28d545b076 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void log_f4c570() { + float3 res = log((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_f4c570(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_f4c570(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_f4c570(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.glsl new file mode 100644 index 0000000000..6a8af4433b --- /dev/null +++ b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void log_f4c570() { + vec3 res = log(vec3(1.0f)); +} + +vec4 vertex_main() { + log_f4c570(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_f4c570() { + vec3 res = log(vec3(1.0f)); +} + +void fragment_main() { + log_f4c570(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_f4c570() { + vec3 res = log(vec3(1.0f)); +} + +void compute_main() { + log_f4c570(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.msl b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.msl new file mode 100644 index 0000000000..7f61e97137 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log_f4c570() { + float3 res = log(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_f4c570(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_f4c570(); + return; +} + +kernel void compute_main() { + log_f4c570(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.spvasm new file mode 100644 index 0000000000..c0d6533d6a --- /dev/null +++ b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_f4c570 "log_f4c570" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %log_f4c570 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Log %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log_f4c570 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log_f4c570 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log_f4c570 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e7dd27bc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn log_f4c570() { + var res : vec3 = log(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_f4c570(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_f4c570(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_f4c570(); +} diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl new file mode 100644 index 0000000000..493fbb21c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<3, f16>) -> vec<3, f16> +fn log2_38b478() { + var res: vec3 = log2(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_38b478(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_38b478(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_38b478(); +} diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..029b567536 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_38b478() { + vector res = log2((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_38b478(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_38b478(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..76ffd386c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log2_38b478() { + vector res = log2((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_38b478(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_38b478(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D9884A1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.glsl new file mode 100644 index 0000000000..e0f07c61a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_38b478() { + f16vec3 res = log2(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + log2_38b478(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_38b478() { + f16vec3 res = log2(f16vec3(0.0hf)); +} + +void fragment_main() { + log2_38b478(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_38b478() { + f16vec3 res = log2(f16vec3(0.0hf)); +} + +void compute_main() { + log2_38b478(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.msl new file mode 100644 index 0000000000..a36b81fd14 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_38b478() { + half3 res = log2(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_38b478(); + return; +} + +kernel void compute_main() { + log2_38b478(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.spvasm new file mode 100644 index 0000000000..de97fedcd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_38b478 "log2_38b478" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_38b478 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Log2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log2_38b478 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log2_38b478 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log2_38b478 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.wgsl new file mode 100644 index 0000000000..9dee10e9d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/38b478.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log2_38b478() { + var res : vec3 = log2(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_38b478(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_38b478(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_38b478(); +} diff --git a/test/tint/builtins/gen/literal/log2/4036ed.wgsl b/test/tint/builtins/gen/literal/log2/4036ed.wgsl new file mode 100644 index 0000000000..8766b243d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/4036ed.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(f32) -> f32 +fn log2_4036ed() { + var res: f32 = log2(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_4036ed(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_4036ed(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_4036ed(); +} diff --git a/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1bea97c647 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_4036ed() { + float res = log2(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_4036ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_4036ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_4036ed(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1bea97c647 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void log2_4036ed() { + float res = log2(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_4036ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_4036ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_4036ed(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.glsl new file mode 100644 index 0000000000..842c021751 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void log2_4036ed() { + float res = log2(1.0f); +} + +vec4 vertex_main() { + log2_4036ed(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_4036ed() { + float res = log2(1.0f); +} + +void fragment_main() { + log2_4036ed(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_4036ed() { + float res = log2(1.0f); +} + +void compute_main() { + log2_4036ed(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.msl new file mode 100644 index 0000000000..e88769f8e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_4036ed() { + float res = log2(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_4036ed(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_4036ed(); + return; +} + +kernel void compute_main() { + log2_4036ed(); + return; +} + diff --git a/test/tint/builtins/gen/log2/4036ed.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/log2/4036ed.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.wgsl new file mode 100644 index 0000000000..316b9cd1d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/4036ed.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn log2_4036ed() { + var res : f32 = log2(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_4036ed(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_4036ed(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_4036ed(); +} diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl b/test/tint/builtins/gen/literal/log2/776088.wgsl new file mode 100644 index 0000000000..3843754756 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<4, f16>) -> vec<4, f16> +fn log2_776088() { + var res: vec4 = log2(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_776088(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_776088(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_776088(); +} diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2a3af8f868 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_776088() { + vector res = log2((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_776088(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_776088(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_776088(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc463e0fe9 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log2_776088() { + vector res = log2((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_776088(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_776088(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_776088(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000254F7CB1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.glsl new file mode 100644 index 0000000000..ebf4aa1ead --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_776088() { + f16vec4 res = log2(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + log2_776088(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_776088() { + f16vec4 res = log2(f16vec4(0.0hf)); +} + +void fragment_main() { + log2_776088(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_776088() { + f16vec4 res = log2(f16vec4(0.0hf)); +} + +void compute_main() { + log2_776088(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.msl new file mode 100644 index 0000000000..eae4b4dd56 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_776088() { + half4 res = log2(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_776088(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_776088(); + return; +} + +kernel void compute_main() { + log2_776088(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.spvasm new file mode 100644 index 0000000000..47d547b781 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_776088 "log2_776088" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_776088 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Log2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log2_776088 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log2_776088 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log2_776088 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.wgsl new file mode 100644 index 0000000000..87971b4c10 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/776088.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log2_776088() { + var res : vec4 = log2(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_776088(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_776088(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_776088(); +} diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl new file mode 100644 index 0000000000..669e8ca108 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(f16) -> f16 +fn log2_8c10b3() { + var res: f16 = log2(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_8c10b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_8c10b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_8c10b3(); +} diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9edb6afaca --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_8c10b3() { + float16_t res = log2(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_8c10b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_8c10b3(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1f50c0568 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void log2_8c10b3() { + float16_t res = log2(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_8c10b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_8c10b3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DFAAFB990(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DFAAFB990(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.glsl new file mode 100644 index 0000000000..7b9deb9413 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_8c10b3() { + float16_t res = log2(0.0hf); +} + +vec4 vertex_main() { + log2_8c10b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_8c10b3() { + float16_t res = log2(0.0hf); +} + +void fragment_main() { + log2_8c10b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_8c10b3() { + float16_t res = log2(0.0hf); +} + +void compute_main() { + log2_8c10b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.msl new file mode 100644 index 0000000000..0ea021a45d --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_8c10b3() { + half res = log2(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_8c10b3(); + return; +} + +kernel void compute_main() { + log2_8c10b3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..f269f689eb --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_8c10b3 "log2_8c10b3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_8c10b3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Log2 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %log2_8c10b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log2_8c10b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_8c10b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..6de59eced0 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/8c10b3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log2_8c10b3() { + var res : f16 = log2(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_8c10b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_8c10b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_8c10b3(); +} diff --git a/test/tint/builtins/gen/literal/log2/902988.wgsl b/test/tint/builtins/gen/literal/log2/902988.wgsl new file mode 100644 index 0000000000..630c20def3 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/902988.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(vec<4, f32>) -> vec<4, f32> +fn log2_902988() { + var res: vec4 = log2(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_902988(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_902988(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_902988(); +} diff --git a/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..500098ebb5 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_902988() { + float4 res = log2((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_902988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_902988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_902988(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..500098ebb5 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void log2_902988() { + float4 res = log2((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_902988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_902988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_902988(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.glsl new file mode 100644 index 0000000000..117b10c28d --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void log2_902988() { + vec4 res = log2(vec4(1.0f)); +} + +vec4 vertex_main() { + log2_902988(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_902988() { + vec4 res = log2(vec4(1.0f)); +} + +void fragment_main() { + log2_902988(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_902988() { + vec4 res = log2(vec4(1.0f)); +} + +void compute_main() { + log2_902988(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.msl new file mode 100644 index 0000000000..354f7615a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_902988() { + float4 res = log2(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_902988(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_902988(); + return; +} + +kernel void compute_main() { + log2_902988(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a493b9d81 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_902988 "log2_902988" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%log2_902988 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Log2 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %log2_902988 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %log2_902988 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log2_902988 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.wgsl new file mode 100644 index 0000000000..a0a76d1aff --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/902988.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn log2_902988() { + var res : vec4 = log2(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_902988(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_902988(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_902988(); +} diff --git a/test/tint/builtins/gen/literal/log2/adb233.wgsl b/test/tint/builtins/gen/literal/log2/adb233.wgsl new file mode 100644 index 0000000000..b7914e43e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/adb233.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(vec<3, f32>) -> vec<3, f32> +fn log2_adb233() { + var res: vec3 = log2(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_adb233(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_adb233(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_adb233(); +} diff --git a/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..73bd8d58a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_adb233() { + float3 res = log2((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_adb233(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_adb233(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_adb233(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..73bd8d58a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void log2_adb233() { + float3 res = log2((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_adb233(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_adb233(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_adb233(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.glsl new file mode 100644 index 0000000000..82d0d605de --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void log2_adb233() { + vec3 res = log2(vec3(1.0f)); +} + +vec4 vertex_main() { + log2_adb233(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_adb233() { + vec3 res = log2(vec3(1.0f)); +} + +void fragment_main() { + log2_adb233(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_adb233() { + vec3 res = log2(vec3(1.0f)); +} + +void compute_main() { + log2_adb233(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.msl new file mode 100644 index 0000000000..6d394dce9d --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_adb233() { + float3 res = log2(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_adb233(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_adb233(); + return; +} + +kernel void compute_main() { + log2_adb233(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.spvasm new file mode 100644 index 0000000000..ac19e978e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_adb233 "log2_adb233" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%log2_adb233 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Log2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log2_adb233 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log2_adb233 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log2_adb233 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.wgsl new file mode 100644 index 0000000000..326a8e1932 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/adb233.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn log2_adb233() { + var res : vec3 = log2(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_adb233(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_adb233(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_adb233(); +} diff --git a/test/tint/builtins/gen/literal/log2/aea659.wgsl b/test/tint/builtins/gen/literal/log2/aea659.wgsl new file mode 100644 index 0000000000..d9f6a9f8b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/aea659.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(vec<2, f32>) -> vec<2, f32> +fn log2_aea659() { + var res: vec2 = log2(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_aea659(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_aea659(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_aea659(); +} diff --git a/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8c58800014 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_aea659() { + float2 res = log2((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_aea659(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_aea659(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_aea659(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c58800014 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void log2_aea659() { + float2 res = log2((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_aea659(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_aea659(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_aea659(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.glsl new file mode 100644 index 0000000000..6b1412f393 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void log2_aea659() { + vec2 res = log2(vec2(1.0f)); +} + +vec4 vertex_main() { + log2_aea659(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_aea659() { + vec2 res = log2(vec2(1.0f)); +} + +void fragment_main() { + log2_aea659(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_aea659() { + vec2 res = log2(vec2(1.0f)); +} + +void compute_main() { + log2_aea659(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.msl new file mode 100644 index 0000000000..83e3e7d1d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_aea659() { + float2 res = log2(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_aea659(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_aea659(); + return; +} + +kernel void compute_main() { + log2_aea659(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f381bc419 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_aea659 "log2_aea659" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%log2_aea659 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Log2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log2_aea659 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log2_aea659 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log2_aea659 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.wgsl new file mode 100644 index 0000000000..039526e2b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/aea659.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn log2_aea659() { + var res : vec2 = log2(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_aea659(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_aea659(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_aea659(); +} diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl new file mode 100644 index 0000000000..9f7c93aff1 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<2, f16>) -> vec<2, f16> +fn log2_fb9f0b() { + var res: vec2 = log2(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_fb9f0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_fb9f0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_fb9f0b(); +} diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1614719747 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void log2_fb9f0b() { + vector res = log2((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_fb9f0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_fb9f0b(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13779ea4b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void log2_fb9f0b() { + vector res = log2((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_fb9f0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_fb9f0b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D63F9088D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.glsl new file mode 100644 index 0000000000..73abe1d60c --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_fb9f0b() { + f16vec2 res = log2(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + log2_fb9f0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_fb9f0b() { + f16vec2 res = log2(f16vec2(0.0hf)); +} + +void fragment_main() { + log2_fb9f0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_fb9f0b() { + f16vec2 res = log2(f16vec2(0.0hf)); +} + +void compute_main() { + log2_fb9f0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.msl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.msl new file mode 100644 index 0000000000..0532f4db98 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void log2_fb9f0b() { + half2 res = log2(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_fb9f0b(); + return; +} + +kernel void compute_main() { + log2_fb9f0b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..2dfd8bd4ef --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_fb9f0b "log2_fb9f0b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_fb9f0b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Log2 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log2_fb9f0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log2_fb9f0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log2_fb9f0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fdced8d39 --- /dev/null +++ b/test/tint/builtins/gen/literal/log2/fb9f0b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn log2_fb9f0b() { + var res : vec2 = log2(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_fb9f0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_fb9f0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_fb9f0b(); +} diff --git a/test/tint/builtins/gen/literal/max/0c0aae.wgsl b/test/tint/builtins/gen/literal/max/0c0aae.wgsl new file mode 100644 index 0000000000..d1208ffbce --- /dev/null +++ b/test/tint/builtins/gen/literal/max/0c0aae.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(u32, u32) -> u32 +fn max_0c0aae() { + var res: u32 = max(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_0c0aae(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_0c0aae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_0c0aae(); +} diff --git a/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3a5add7290 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_0c0aae() { + uint res = max(1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_0c0aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_0c0aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_0c0aae(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3a5add7290 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_0c0aae() { + uint res = max(1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_0c0aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_0c0aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_0c0aae(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.glsl new file mode 100644 index 0000000000..af1220e821 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_0c0aae() { + uint res = max(1u, 1u); +} + +vec4 vertex_main() { + max_0c0aae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_0c0aae() { + uint res = max(1u, 1u); +} + +void fragment_main() { + max_0c0aae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_0c0aae() { + uint res = max(1u, 1u); +} + +void compute_main() { + max_0c0aae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.msl new file mode 100644 index 0000000000..55bf47d1e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_0c0aae() { + uint res = max(1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_0c0aae(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_0c0aae(); + return; +} + +kernel void compute_main() { + max_0c0aae(); + return; +} + diff --git a/test/tint/builtins/gen/max/0c0aae.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/max/0c0aae.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.wgsl new file mode 100644 index 0000000000..33e2de9ae5 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/0c0aae.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_0c0aae() { + var res : u32 = max(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_0c0aae(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_0c0aae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_0c0aae(); +} diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl new file mode 100644 index 0000000000..1a46cb56e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(f16, f16) -> f16 +fn max_111ac0() { + var res: f16 = max(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_111ac0(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_111ac0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_111ac0(); +} diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..972d568803 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_111ac0() { + float16_t res = max(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_111ac0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_111ac0(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e031d96c8e --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void max_111ac0() { + float16_t res = max(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_111ac0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_111ac0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000215BA37C140(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000215BA37C140(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.glsl new file mode 100644 index 0000000000..b0864de5d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_111ac0() { + float16_t res = max(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + max_111ac0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_111ac0() { + float16_t res = max(0.0hf, 0.0hf); +} + +void fragment_main() { + max_111ac0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_111ac0() { + float16_t res = max(0.0hf, 0.0hf); +} + +void compute_main() { + max_111ac0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.msl new file mode 100644 index 0000000000..ccbcac5c21 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_111ac0() { + half res = fmax(0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_111ac0(); + return; +} + +kernel void compute_main() { + max_111ac0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.spvasm new file mode 100644 index 0000000000..b3c080526c --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_111ac0 "max_111ac0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_111ac0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 NMax %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %max_111ac0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %max_111ac0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %max_111ac0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.wgsl new file mode 100644 index 0000000000..86e79dd6bd --- /dev/null +++ b/test/tint/builtins/gen/literal/max/111ac0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn max_111ac0() { + var res : f16 = max(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_111ac0(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_111ac0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_111ac0(); +} diff --git a/test/tint/builtins/gen/literal/max/25eafe.wgsl b/test/tint/builtins/gen/literal/max/25eafe.wgsl new file mode 100644 index 0000000000..8a1fe27212 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/25eafe.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<3, i32>, vec<3, i32>) -> vec<3, i32> +fn max_25eafe() { + var res: vec3 = max(vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_25eafe(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_25eafe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_25eafe(); +} diff --git a/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5909d39be1 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_25eafe() { + int3 res = max((1).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_25eafe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_25eafe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_25eafe(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5909d39be1 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_25eafe() { + int3 res = max((1).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_25eafe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_25eafe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_25eafe(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.glsl new file mode 100644 index 0000000000..a002bc2e3c --- /dev/null +++ b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_25eafe() { + ivec3 res = max(ivec3(1), ivec3(1)); +} + +vec4 vertex_main() { + max_25eafe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_25eafe() { + ivec3 res = max(ivec3(1), ivec3(1)); +} + +void fragment_main() { + max_25eafe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_25eafe() { + ivec3 res = max(ivec3(1), ivec3(1)); +} + +void compute_main() { + max_25eafe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.msl new file mode 100644 index 0000000000..25f0106007 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_25eafe() { + int3 res = max(int3(1), int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_25eafe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_25eafe(); + return; +} + +kernel void compute_main() { + max_25eafe(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.spvasm new file mode 100644 index 0000000000..cb413c8e52 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_25eafe "max_25eafe" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %18 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpConstantNull %v3int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_25eafe = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %21 + %13 = OpExtInst %v3int %16 SMax %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %max_25eafe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %max_25eafe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %max_25eafe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.wgsl new file mode 100644 index 0000000000..37dfc6438c --- /dev/null +++ b/test/tint/builtins/gen/literal/max/25eafe.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_25eafe() { + var res : vec3 = max(vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_25eafe(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_25eafe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_25eafe(); +} diff --git a/test/tint/builtins/gen/literal/max/320815.wgsl b/test/tint/builtins/gen/literal/max/320815.wgsl new file mode 100644 index 0000000000..73169ef214 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/320815.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<2, u32>, vec<2, u32>) -> vec<2, u32> +fn max_320815() { + var res: vec2 = max(vec2(1u), vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_320815(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_320815(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_320815(); +} diff --git a/test/tint/builtins/gen/literal/max/320815.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d0c591e528 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_320815() { + uint2 res = max((1u).xx, (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_320815(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_320815(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_320815(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/320815.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d0c591e528 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_320815() { + uint2 res = max((1u).xx, (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_320815(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_320815(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_320815(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/320815.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.glsl new file mode 100644 index 0000000000..571c2490f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_320815() { + uvec2 res = max(uvec2(1u), uvec2(1u)); +} + +vec4 vertex_main() { + max_320815(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_320815() { + uvec2 res = max(uvec2(1u), uvec2(1u)); +} + +void fragment_main() { + max_320815(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_320815() { + uvec2 res = max(uvec2(1u), uvec2(1u)); +} + +void compute_main() { + max_320815(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/320815.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.msl new file mode 100644 index 0000000000..1cae0b39c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_320815() { + uint2 res = max(uint2(1u), uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_320815(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_320815(); + return; +} + +kernel void compute_main() { + max_320815(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/320815.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.spvasm new file mode 100644 index 0000000000..0be807e205 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_320815 "max_320815" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %18 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %21 = OpConstantNull %v2uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_320815 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %21 + %13 = OpExtInst %v2uint %16 UMax %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %max_320815 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %max_320815 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %max_320815 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/320815.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.wgsl new file mode 100644 index 0000000000..d47c2e14f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/320815.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_320815() { + var res : vec2 = max(vec2(1u), vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_320815(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_320815(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_320815(); +} diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl b/test/tint/builtins/gen/literal/max/34956e.wgsl new file mode 100644 index 0000000000..2b22a891df --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn max_34956e() { + var res: vec2 = max(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_34956e(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_34956e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_34956e(); +} diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ecb9bd768 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_34956e() { + vector res = max((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_34956e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_34956e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_34956e(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54be2a8d9c --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void max_34956e() { + vector res = max((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_34956e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_34956e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_34956e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016DDE0B63C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.glsl new file mode 100644 index 0000000000..c9fb73cc88 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_34956e() { + f16vec2 res = max(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + max_34956e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_34956e() { + f16vec2 res = max(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + max_34956e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_34956e() { + f16vec2 res = max(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + max_34956e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.msl new file mode 100644 index 0000000000..4f655400f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_34956e() { + half2 res = fmax(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_34956e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_34956e(); + return; +} + +kernel void compute_main() { + max_34956e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e8003c296e --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_34956e "max_34956e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_34956e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 NMax %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %max_34956e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %max_34956e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_34956e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.wgsl new file mode 100644 index 0000000000..45ee0302f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/34956e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn max_34956e() { + var res : vec2 = max(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_34956e(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_34956e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_34956e(); +} diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl b/test/tint/builtins/gen/literal/max/445169.wgsl new file mode 100644 index 0000000000..8752c1ed49 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn max_445169() { + var res: vec3 = max(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_445169(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_445169(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_445169(); +} diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a291c4c2ba --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_445169() { + vector res = max((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_445169(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_445169(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_445169(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bed53ac19f --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void max_445169() { + vector res = max((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_445169(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_445169(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_445169(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000280F3D6A940(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.glsl new file mode 100644 index 0000000000..dd8ccdf5f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_445169() { + f16vec3 res = max(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + max_445169(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_445169() { + f16vec3 res = max(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + max_445169(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_445169() { + f16vec3 res = max(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + max_445169(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.msl new file mode 100644 index 0000000000..5bd10e91db --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_445169() { + half3 res = fmax(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_445169(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_445169(); + return; +} + +kernel void compute_main() { + max_445169(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e1a6af228 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_445169 "max_445169" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_445169 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 NMax %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %max_445169 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %max_445169 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_445169 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/445169.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e1c567026 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/445169.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn max_445169() { + var res : vec3 = max(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_445169(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_445169(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_445169(); +} diff --git a/test/tint/builtins/gen/literal/max/44a39d.wgsl b/test/tint/builtins/gen/literal/max/44a39d.wgsl new file mode 100644 index 0000000000..0cce3589da --- /dev/null +++ b/test/tint/builtins/gen/literal/max/44a39d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(f32, f32) -> f32 +fn max_44a39d() { + var res: f32 = max(1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_44a39d(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_44a39d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_44a39d(); +} diff --git a/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f1024064d --- /dev/null +++ b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_44a39d() { + float res = max(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_44a39d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_44a39d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_44a39d(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6f1024064d --- /dev/null +++ b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_44a39d() { + float res = max(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_44a39d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_44a39d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_44a39d(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.glsl new file mode 100644 index 0000000000..cde0334349 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_44a39d() { + float res = max(1.0f, 1.0f); +} + +vec4 vertex_main() { + max_44a39d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_44a39d() { + float res = max(1.0f, 1.0f); +} + +void fragment_main() { + max_44a39d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_44a39d() { + float res = max(1.0f, 1.0f); +} + +void compute_main() { + max_44a39d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.msl new file mode 100644 index 0000000000..80ff77c0fa --- /dev/null +++ b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_44a39d() { + float res = fmax(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_44a39d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_44a39d(); + return; +} + +kernel void compute_main() { + max_44a39d(); + return; +} + diff --git a/test/tint/builtins/gen/max/44a39d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/max/44a39d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.wgsl new file mode 100644 index 0000000000..e485a0478a --- /dev/null +++ b/test/tint/builtins/gen/literal/max/44a39d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_44a39d() { + var res : f32 = max(1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_44a39d(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_44a39d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_44a39d(); +} diff --git a/test/tint/builtins/gen/literal/max/453e04.wgsl b/test/tint/builtins/gen/literal/max/453e04.wgsl new file mode 100644 index 0000000000..07bb04c911 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/453e04.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<4, u32>, vec<4, u32>) -> vec<4, u32> +fn max_453e04() { + var res: vec4 = max(vec4(1u), vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_453e04(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_453e04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_453e04(); +} diff --git a/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52efcc4952 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_453e04() { + uint4 res = max((1u).xxxx, (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_453e04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_453e04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_453e04(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52efcc4952 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_453e04() { + uint4 res = max((1u).xxxx, (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_453e04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_453e04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_453e04(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.glsl new file mode 100644 index 0000000000..d2e1aff2ac --- /dev/null +++ b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_453e04() { + uvec4 res = max(uvec4(1u), uvec4(1u)); +} + +vec4 vertex_main() { + max_453e04(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_453e04() { + uvec4 res = max(uvec4(1u), uvec4(1u)); +} + +void fragment_main() { + max_453e04(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_453e04() { + uvec4 res = max(uvec4(1u), uvec4(1u)); +} + +void compute_main() { + max_453e04(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.msl new file mode 100644 index 0000000000..ea82e5cb07 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_453e04() { + uint4 res = max(uint4(1u), uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_453e04(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_453e04(); + return; +} + +kernel void compute_main() { + max_453e04(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.spvasm new file mode 100644 index 0000000000..5f0ed0a5d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_453e04 "max_453e04" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %18 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %21 = OpConstantNull %v4uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_453e04 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %21 + %13 = OpExtInst %v4uint %16 UMax %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %max_453e04 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %max_453e04 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %max_453e04 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.wgsl new file mode 100644 index 0000000000..49573f56e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/453e04.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_453e04() { + var res : vec4 = max(vec4(1u), vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_453e04(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_453e04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_453e04(); +} diff --git a/test/tint/builtins/gen/literal/max/462050.wgsl b/test/tint/builtins/gen/literal/max/462050.wgsl new file mode 100644 index 0000000000..f7eac587ea --- /dev/null +++ b/test/tint/builtins/gen/literal/max/462050.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn max_462050() { + var res: vec2 = max(vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_462050(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_462050(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_462050(); +} diff --git a/test/tint/builtins/gen/literal/max/462050.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6ce078134 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_462050() { + float2 res = max((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_462050(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_462050(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_462050(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/462050.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6ce078134 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_462050() { + float2 res = max((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_462050(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_462050(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_462050(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/462050.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.glsl new file mode 100644 index 0000000000..1bdbe243f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_462050() { + vec2 res = max(vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + max_462050(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_462050() { + vec2 res = max(vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + max_462050(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_462050() { + vec2 res = max(vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + max_462050(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/462050.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.msl new file mode 100644 index 0000000000..7689ad5b1d --- /dev/null +++ b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_462050() { + float2 res = fmax(float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_462050(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_462050(); + return; +} + +kernel void compute_main() { + max_462050(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/462050.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0de9d85f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_462050 "max_462050" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %max_462050 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 NMax %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %max_462050 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %max_462050 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_462050 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/462050.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.wgsl new file mode 100644 index 0000000000..f28ca59c8d --- /dev/null +++ b/test/tint/builtins/gen/literal/max/462050.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_462050() { + var res : vec2 = max(vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_462050(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_462050(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_462050(); +} diff --git a/test/tint/builtins/gen/literal/max/4883ac.wgsl b/test/tint/builtins/gen/literal/max/4883ac.wgsl new file mode 100644 index 0000000000..cef3a73cd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/4883ac.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn max_4883ac() { + var res: vec3 = max(vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_4883ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_4883ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_4883ac(); +} diff --git a/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a4a8b129ff --- /dev/null +++ b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_4883ac() { + float3 res = max((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_4883ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_4883ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_4883ac(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a4a8b129ff --- /dev/null +++ b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_4883ac() { + float3 res = max((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_4883ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_4883ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_4883ac(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.glsl new file mode 100644 index 0000000000..1a0e25ee57 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_4883ac() { + vec3 res = max(vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + max_4883ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_4883ac() { + vec3 res = max(vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + max_4883ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_4883ac() { + vec3 res = max(vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + max_4883ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.msl new file mode 100644 index 0000000000..740e3cd645 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_4883ac() { + float3 res = fmax(float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_4883ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_4883ac(); + return; +} + +kernel void compute_main() { + max_4883ac(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d847003f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_4883ac "max_4883ac" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %max_4883ac = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 NMax %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %max_4883ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %max_4883ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_4883ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..2178c7604b --- /dev/null +++ b/test/tint/builtins/gen/literal/max/4883ac.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_4883ac() { + var res : vec3 = max(vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_4883ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_4883ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_4883ac(); +} diff --git a/test/tint/builtins/gen/literal/max/85e6bc.wgsl b/test/tint/builtins/gen/literal/max/85e6bc.wgsl new file mode 100644 index 0000000000..6c7703d440 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/85e6bc.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<4, i32>, vec<4, i32>) -> vec<4, i32> +fn max_85e6bc() { + var res: vec4 = max(vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_85e6bc(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_85e6bc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_85e6bc(); +} diff --git a/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4bcdaeea78 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_85e6bc() { + int4 res = max((1).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_85e6bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_85e6bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_85e6bc(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bcdaeea78 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_85e6bc() { + int4 res = max((1).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_85e6bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_85e6bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_85e6bc(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.glsl new file mode 100644 index 0000000000..60ae5923a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_85e6bc() { + ivec4 res = max(ivec4(1), ivec4(1)); +} + +vec4 vertex_main() { + max_85e6bc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_85e6bc() { + ivec4 res = max(ivec4(1), ivec4(1)); +} + +void fragment_main() { + max_85e6bc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_85e6bc() { + ivec4 res = max(ivec4(1), ivec4(1)); +} + +void compute_main() { + max_85e6bc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.msl new file mode 100644 index 0000000000..4195ba58ef --- /dev/null +++ b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_85e6bc() { + int4 res = max(int4(1), int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_85e6bc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_85e6bc(); + return; +} + +kernel void compute_main() { + max_85e6bc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.spvasm new file mode 100644 index 0000000000..457ec87064 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_85e6bc "max_85e6bc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %18 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %21 = OpConstantNull %v4int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_85e6bc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %21 + %13 = OpExtInst %v4int %16 SMax %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %max_85e6bc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %max_85e6bc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %max_85e6bc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.wgsl new file mode 100644 index 0000000000..4043b8c612 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/85e6bc.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_85e6bc() { + var res : vec4 = max(vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_85e6bc(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_85e6bc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_85e6bc(); +} diff --git a/test/tint/builtins/gen/literal/max/a93419.wgsl b/test/tint/builtins/gen/literal/max/a93419.wgsl new file mode 100644 index 0000000000..8616a739f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/a93419.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn max_a93419() { + var res: vec4 = max(vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_a93419(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_a93419(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_a93419(); +} diff --git a/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0e5c51a32b --- /dev/null +++ b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_a93419() { + float4 res = max((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_a93419(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_a93419(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_a93419(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0e5c51a32b --- /dev/null +++ b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_a93419() { + float4 res = max((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_a93419(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_a93419(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_a93419(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.glsl new file mode 100644 index 0000000000..d14adc1d5b --- /dev/null +++ b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_a93419() { + vec4 res = max(vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + max_a93419(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_a93419() { + vec4 res = max(vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + max_a93419(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_a93419() { + vec4 res = max(vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + max_a93419(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.msl new file mode 100644 index 0000000000..2aceaf5f04 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_a93419() { + float4 res = fmax(float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_a93419(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_a93419(); + return; +} + +kernel void compute_main() { + max_a93419(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.spvasm new file mode 100644 index 0000000000..d99b4183dc --- /dev/null +++ b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_a93419 "max_a93419" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %max_a93419 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 NMax %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %max_a93419 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %max_a93419 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %max_a93419 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.wgsl new file mode 100644 index 0000000000..3bf5ae72fb --- /dev/null +++ b/test/tint/builtins/gen/literal/max/a93419.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_a93419() { + var res : vec4 = max(vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_a93419(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_a93419(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_a93419(); +} diff --git a/test/tint/builtins/gen/literal/max/b1b73a.wgsl b/test/tint/builtins/gen/literal/max/b1b73a.wgsl new file mode 100644 index 0000000000..059fa7c0e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/b1b73a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<3, u32>, vec<3, u32>) -> vec<3, u32> +fn max_b1b73a() { + var res: vec3 = max(vec3(1u), vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_b1b73a(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_b1b73a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_b1b73a(); +} diff --git a/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c7981d5022 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_b1b73a() { + uint3 res = max((1u).xxx, (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_b1b73a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_b1b73a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_b1b73a(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c7981d5022 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_b1b73a() { + uint3 res = max((1u).xxx, (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_b1b73a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_b1b73a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_b1b73a(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.glsl new file mode 100644 index 0000000000..73f1f880b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_b1b73a() { + uvec3 res = max(uvec3(1u), uvec3(1u)); +} + +vec4 vertex_main() { + max_b1b73a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_b1b73a() { + uvec3 res = max(uvec3(1u), uvec3(1u)); +} + +void fragment_main() { + max_b1b73a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_b1b73a() { + uvec3 res = max(uvec3(1u), uvec3(1u)); +} + +void compute_main() { + max_b1b73a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.msl new file mode 100644 index 0000000000..c87f2b2049 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_b1b73a() { + uint3 res = max(uint3(1u), uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_b1b73a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_b1b73a(); + return; +} + +kernel void compute_main() { + max_b1b73a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.spvasm new file mode 100644 index 0000000000..c85b90037a --- /dev/null +++ b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_b1b73a "max_b1b73a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %18 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %21 = OpConstantNull %v3uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_b1b73a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %21 + %13 = OpExtInst %v3uint %16 UMax %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %max_b1b73a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %max_b1b73a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %max_b1b73a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.wgsl new file mode 100644 index 0000000000..545f4ef0c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/b1b73a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_b1b73a() { + var res : vec3 = max(vec3(1u), vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_b1b73a(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_b1b73a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_b1b73a(); +} diff --git a/test/tint/builtins/gen/literal/max/ce7c30.wgsl b/test/tint/builtins/gen/literal/max/ce7c30.wgsl new file mode 100644 index 0000000000..6698ae05e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/ce7c30.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(i32, i32) -> i32 +fn max_ce7c30() { + var res: i32 = max(1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_ce7c30(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_ce7c30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_ce7c30(); +} diff --git a/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..59fdfa020f --- /dev/null +++ b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_ce7c30() { + int res = max(1, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_ce7c30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_ce7c30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_ce7c30(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..59fdfa020f --- /dev/null +++ b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_ce7c30() { + int res = max(1, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_ce7c30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_ce7c30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_ce7c30(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.glsl new file mode 100644 index 0000000000..133dc81072 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_ce7c30() { + int res = max(1, 1); +} + +vec4 vertex_main() { + max_ce7c30(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_ce7c30() { + int res = max(1, 1); +} + +void fragment_main() { + max_ce7c30(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_ce7c30() { + int res = max(1, 1); +} + +void compute_main() { + max_ce7c30(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.msl new file mode 100644 index 0000000000..3781d03203 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_ce7c30() { + int res = max(1, 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_ce7c30(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_ce7c30(); + return; +} + +kernel void compute_main() { + max_ce7c30(); + return; +} + diff --git a/test/tint/builtins/gen/max/ce7c30.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/max/ce7c30.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.wgsl new file mode 100644 index 0000000000..68d5a6ecc1 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/ce7c30.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_ce7c30() { + var res : i32 = max(1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_ce7c30(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_ce7c30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_ce7c30(); +} diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl new file mode 100644 index 0000000000..fd8638a5b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn max_e14f2b() { + var res: vec4 = max(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e14f2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e14f2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e14f2b(); +} diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f790278b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_e14f2b() { + vector res = max((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e14f2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e14f2b(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cff4cc60fd --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void max_e14f2b() { + vector res = max((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e14f2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e14f2b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002878BF192B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.glsl new file mode 100644 index 0000000000..f4f78bb501 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_e14f2b() { + f16vec4 res = max(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + max_e14f2b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_e14f2b() { + f16vec4 res = max(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + max_e14f2b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_e14f2b() { + f16vec4 res = max(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + max_e14f2b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.msl new file mode 100644 index 0000000000..3620c0511d --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_e14f2b() { + half4 res = fmax(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_e14f2b(); + return; +} + +kernel void compute_main() { + max_e14f2b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.spvasm new file mode 100644 index 0000000000..61981040cf --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_e14f2b "max_e14f2b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_e14f2b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 NMax %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %max_e14f2b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %max_e14f2b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_e14f2b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0d214cfc3 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e14f2b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn max_e14f2b() { + var res : vec4 = max(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e14f2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e14f2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e14f2b(); +} diff --git a/test/tint/builtins/gen/literal/max/e8192f.wgsl b/test/tint/builtins/gen/literal/max/e8192f.wgsl new file mode 100644 index 0000000000..04d8dcd17b --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e8192f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<2, i32>, vec<2, i32>) -> vec<2, i32> +fn max_e8192f() { + var res: vec2 = max(vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e8192f(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e8192f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e8192f(); +} diff --git a/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..31d3fe3d4e --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void max_e8192f() { + int2 res = max((1).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e8192f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e8192f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e8192f(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31d3fe3d4e --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void max_e8192f() { + int2 res = max((1).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e8192f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e8192f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e8192f(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.glsl new file mode 100644 index 0000000000..5ae6d7d4b0 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void max_e8192f() { + ivec2 res = max(ivec2(1), ivec2(1)); +} + +vec4 vertex_main() { + max_e8192f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_e8192f() { + ivec2 res = max(ivec2(1), ivec2(1)); +} + +void fragment_main() { + max_e8192f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_e8192f() { + ivec2 res = max(ivec2(1), ivec2(1)); +} + +void compute_main() { + max_e8192f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.msl b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.msl new file mode 100644 index 0000000000..71b545b95e --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void max_e8192f() { + int2 res = max(int2(1), int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_e8192f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_e8192f(); + return; +} + +kernel void compute_main() { + max_e8192f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.spvasm new file mode 100644 index 0000000000..9dae5f47c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_e8192f "max_e8192f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %18 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpConstantNull %v2int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_e8192f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %21 + %13 = OpExtInst %v2int %16 SMax %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %max_e8192f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %max_e8192f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %max_e8192f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a9dcfecd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/max/e8192f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn max_e8192f() { + var res : vec2 = max(vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e8192f(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e8192f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e8192f(); +} diff --git a/test/tint/builtins/gen/literal/min/03c7e3.wgsl b/test/tint/builtins/gen/literal/min/03c7e3.wgsl new file mode 100644 index 0000000000..cda624942b --- /dev/null +++ b/test/tint/builtins/gen/literal/min/03c7e3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<2, i32>, vec<2, i32>) -> vec<2, i32> +fn min_03c7e3() { + var res: vec2 = min(vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_03c7e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_03c7e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_03c7e3(); +} diff --git a/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a1f6b1dcbf --- /dev/null +++ b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_03c7e3() { + int2 res = min((1).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_03c7e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_03c7e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_03c7e3(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1f6b1dcbf --- /dev/null +++ b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_03c7e3() { + int2 res = min((1).xx, (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_03c7e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_03c7e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_03c7e3(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.glsl new file mode 100644 index 0000000000..b321320ff5 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_03c7e3() { + ivec2 res = min(ivec2(1), ivec2(1)); +} + +vec4 vertex_main() { + min_03c7e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_03c7e3() { + ivec2 res = min(ivec2(1), ivec2(1)); +} + +void fragment_main() { + min_03c7e3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_03c7e3() { + ivec2 res = min(ivec2(1), ivec2(1)); +} + +void compute_main() { + min_03c7e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.msl new file mode 100644 index 0000000000..7460946135 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_03c7e3() { + int2 res = min(int2(1), int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_03c7e3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_03c7e3(); + return; +} + +kernel void compute_main() { + min_03c7e3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc5420a58f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_03c7e3 "min_03c7e3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %18 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpConstantNull %v2int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_03c7e3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %21 + %13 = OpExtInst %v2int %16 SMin %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %min_03c7e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %min_03c7e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %min_03c7e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6dc684075 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/03c7e3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_03c7e3() { + var res : vec2 = min(vec2(1), vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_03c7e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_03c7e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_03c7e3(); +} diff --git a/test/tint/builtins/gen/literal/min/0dc614.wgsl b/test/tint/builtins/gen/literal/min/0dc614.wgsl new file mode 100644 index 0000000000..8696fa2b48 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/0dc614.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<4, u32>, vec<4, u32>) -> vec<4, u32> +fn min_0dc614() { + var res: vec4 = min(vec4(1u), vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_0dc614(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_0dc614(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_0dc614(); +} diff --git a/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..426d3980e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_0dc614() { + uint4 res = min((1u).xxxx, (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_0dc614(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_0dc614(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_0dc614(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..426d3980e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_0dc614() { + uint4 res = min((1u).xxxx, (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_0dc614(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_0dc614(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_0dc614(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.glsl new file mode 100644 index 0000000000..3d60c02dbd --- /dev/null +++ b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_0dc614() { + uvec4 res = min(uvec4(1u), uvec4(1u)); +} + +vec4 vertex_main() { + min_0dc614(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_0dc614() { + uvec4 res = min(uvec4(1u), uvec4(1u)); +} + +void fragment_main() { + min_0dc614(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_0dc614() { + uvec4 res = min(uvec4(1u), uvec4(1u)); +} + +void compute_main() { + min_0dc614(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.msl new file mode 100644 index 0000000000..7b898b5277 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_0dc614() { + uint4 res = min(uint4(1u), uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_0dc614(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_0dc614(); + return; +} + +kernel void compute_main() { + min_0dc614(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.spvasm new file mode 100644 index 0000000000..53a931e5d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_0dc614 "min_0dc614" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %18 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %21 = OpConstantNull %v4uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_0dc614 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %21 + %13 = OpExtInst %v4uint %16 UMin %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %min_0dc614 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %min_0dc614 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %min_0dc614 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.wgsl new file mode 100644 index 0000000000..a9491e2921 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/0dc614.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_0dc614() { + var res : vec4 = min(vec4(1u), vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_0dc614(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_0dc614(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_0dc614(); +} diff --git a/test/tint/builtins/gen/literal/min/3941e1.wgsl b/test/tint/builtins/gen/literal/min/3941e1.wgsl new file mode 100644 index 0000000000..fc605ddaf1 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/3941e1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<4, i32>, vec<4, i32>) -> vec<4, i32> +fn min_3941e1() { + var res: vec4 = min(vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_3941e1(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_3941e1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_3941e1(); +} diff --git a/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bffbd4a789 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_3941e1() { + int4 res = min((1).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_3941e1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_3941e1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_3941e1(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bffbd4a789 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_3941e1() { + int4 res = min((1).xxxx, (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_3941e1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_3941e1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_3941e1(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.glsl new file mode 100644 index 0000000000..5ed44c0b68 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_3941e1() { + ivec4 res = min(ivec4(1), ivec4(1)); +} + +vec4 vertex_main() { + min_3941e1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_3941e1() { + ivec4 res = min(ivec4(1), ivec4(1)); +} + +void fragment_main() { + min_3941e1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_3941e1() { + ivec4 res = min(ivec4(1), ivec4(1)); +} + +void compute_main() { + min_3941e1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.msl new file mode 100644 index 0000000000..fe3409cf8e --- /dev/null +++ b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_3941e1() { + int4 res = min(int4(1), int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_3941e1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_3941e1(); + return; +} + +kernel void compute_main() { + min_3941e1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.spvasm new file mode 100644 index 0000000000..7d3fc67683 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_3941e1 "min_3941e1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %18 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %21 = OpConstantNull %v4int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_3941e1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %21 + %13 = OpExtInst %v4int %16 SMin %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %min_3941e1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %min_3941e1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %min_3941e1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.wgsl new file mode 100644 index 0000000000..cf74c05e5e --- /dev/null +++ b/test/tint/builtins/gen/literal/min/3941e1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_3941e1() { + var res : vec4 = min(vec4(1), vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_3941e1(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_3941e1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_3941e1(); +} diff --git a/test/tint/builtins/gen/literal/min/46c5d3.wgsl b/test/tint/builtins/gen/literal/min/46c5d3.wgsl new file mode 100644 index 0000000000..d84608585e --- /dev/null +++ b/test/tint/builtins/gen/literal/min/46c5d3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(u32, u32) -> u32 +fn min_46c5d3() { + var res: u32 = min(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_46c5d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_46c5d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_46c5d3(); +} diff --git a/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c351f188d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_46c5d3() { + uint res = min(1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_46c5d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_46c5d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_46c5d3(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c351f188d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_46c5d3() { + uint res = min(1u, 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_46c5d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_46c5d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_46c5d3(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.glsl new file mode 100644 index 0000000000..ffb0f0dee7 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_46c5d3() { + uint res = min(1u, 1u); +} + +vec4 vertex_main() { + min_46c5d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_46c5d3() { + uint res = min(1u, 1u); +} + +void fragment_main() { + min_46c5d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_46c5d3() { + uint res = min(1u, 1u); +} + +void compute_main() { + min_46c5d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.msl new file mode 100644 index 0000000000..25b2e3b270 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_46c5d3() { + uint res = min(1u, 1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_46c5d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_46c5d3(); + return; +} + +kernel void compute_main() { + min_46c5d3(); + return; +} + diff --git a/test/tint/builtins/gen/min/46c5d3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/min/46c5d3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4d2300ade --- /dev/null +++ b/test/tint/builtins/gen/literal/min/46c5d3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_46c5d3() { + var res : u32 = min(1u, 1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_46c5d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_46c5d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_46c5d3(); +} diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl new file mode 100644 index 0000000000..f8cf0d3bcf --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn min_7c710a() { + var res: vec4 = min(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_7c710a(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_7c710a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_7c710a(); +} diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b065ca877e --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_7c710a() { + vector res = min((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_7c710a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_7c710a(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8a7bcbdf7f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void min_7c710a() { + vector res = min((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_7c710a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_7c710a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000236F63CBD50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.glsl new file mode 100644 index 0000000000..f794845684 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_7c710a() { + f16vec4 res = min(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + min_7c710a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_7c710a() { + f16vec4 res = min(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + min_7c710a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_7c710a() { + f16vec4 res = min(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + min_7c710a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.msl new file mode 100644 index 0000000000..7805826d56 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_7c710a() { + half4 res = fmin(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_7c710a(); + return; +} + +kernel void compute_main() { + min_7c710a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.spvasm new file mode 100644 index 0000000000..60cd2d2bae --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_7c710a "min_7c710a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_7c710a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 NMin %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %min_7c710a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %min_7c710a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_7c710a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee18161098 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/7c710a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn min_7c710a() { + var res : vec4 = min(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_7c710a(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_7c710a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_7c710a(); +} diff --git a/test/tint/builtins/gen/literal/min/82b28f.wgsl b/test/tint/builtins/gen/literal/min/82b28f.wgsl new file mode 100644 index 0000000000..bc98a8031e --- /dev/null +++ b/test/tint/builtins/gen/literal/min/82b28f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<2, u32>, vec<2, u32>) -> vec<2, u32> +fn min_82b28f() { + var res: vec2 = min(vec2(1u), vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_82b28f(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_82b28f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_82b28f(); +} diff --git a/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..09b33835ca --- /dev/null +++ b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_82b28f() { + uint2 res = min((1u).xx, (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_82b28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_82b28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_82b28f(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..09b33835ca --- /dev/null +++ b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_82b28f() { + uint2 res = min((1u).xx, (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_82b28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_82b28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_82b28f(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.glsl new file mode 100644 index 0000000000..74d6493279 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_82b28f() { + uvec2 res = min(uvec2(1u), uvec2(1u)); +} + +vec4 vertex_main() { + min_82b28f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_82b28f() { + uvec2 res = min(uvec2(1u), uvec2(1u)); +} + +void fragment_main() { + min_82b28f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_82b28f() { + uvec2 res = min(uvec2(1u), uvec2(1u)); +} + +void compute_main() { + min_82b28f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.msl new file mode 100644 index 0000000000..6fb614d8c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_82b28f() { + uint2 res = min(uint2(1u), uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_82b28f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_82b28f(); + return; +} + +kernel void compute_main() { + min_82b28f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b2e64a802 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_82b28f "min_82b28f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %18 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %21 = OpConstantNull %v2uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_82b28f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %21 + %13 = OpExtInst %v2uint %16 UMin %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %min_82b28f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %min_82b28f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %min_82b28f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.wgsl new file mode 100644 index 0000000000..cfd2297283 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/82b28f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_82b28f() { + var res : vec2 = min(vec2(1u), vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_82b28f(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_82b28f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_82b28f(); +} diff --git a/test/tint/builtins/gen/literal/min/93cfc4.wgsl b/test/tint/builtins/gen/literal/min/93cfc4.wgsl new file mode 100644 index 0000000000..70218a300a --- /dev/null +++ b/test/tint/builtins/gen/literal/min/93cfc4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn min_93cfc4() { + var res: vec3 = min(vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_93cfc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_93cfc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_93cfc4(); +} diff --git a/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e026a3823b --- /dev/null +++ b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_93cfc4() { + float3 res = min((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_93cfc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_93cfc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_93cfc4(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e026a3823b --- /dev/null +++ b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_93cfc4() { + float3 res = min((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_93cfc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_93cfc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_93cfc4(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.glsl new file mode 100644 index 0000000000..4803ddb4be --- /dev/null +++ b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_93cfc4() { + vec3 res = min(vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + min_93cfc4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_93cfc4() { + vec3 res = min(vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + min_93cfc4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_93cfc4() { + vec3 res = min(vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + min_93cfc4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.msl new file mode 100644 index 0000000000..93dcaf5d64 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_93cfc4() { + float3 res = fmin(float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_93cfc4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_93cfc4(); + return; +} + +kernel void compute_main() { + min_93cfc4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..0ee1982822 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_93cfc4 "min_93cfc4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %min_93cfc4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 NMin %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %min_93cfc4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %min_93cfc4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_93cfc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..a9b796d7c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/93cfc4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_93cfc4() { + var res : vec3 = min(vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_93cfc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_93cfc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_93cfc4(); +} diff --git a/test/tint/builtins/gen/literal/min/a45171.wgsl b/test/tint/builtins/gen/literal/min/a45171.wgsl new file mode 100644 index 0000000000..38a489a40e --- /dev/null +++ b/test/tint/builtins/gen/literal/min/a45171.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<3, i32>, vec<3, i32>) -> vec<3, i32> +fn min_a45171() { + var res: vec3 = min(vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_a45171(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_a45171(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_a45171(); +} diff --git a/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f727fee6b --- /dev/null +++ b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_a45171() { + int3 res = min((1).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_a45171(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_a45171(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_a45171(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6f727fee6b --- /dev/null +++ b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_a45171() { + int3 res = min((1).xxx, (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_a45171(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_a45171(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_a45171(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.glsl new file mode 100644 index 0000000000..b80a9d4a40 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_a45171() { + ivec3 res = min(ivec3(1), ivec3(1)); +} + +vec4 vertex_main() { + min_a45171(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_a45171() { + ivec3 res = min(ivec3(1), ivec3(1)); +} + +void fragment_main() { + min_a45171(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_a45171() { + ivec3 res = min(ivec3(1), ivec3(1)); +} + +void compute_main() { + min_a45171(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.msl new file mode 100644 index 0000000000..58e69d5034 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_a45171() { + int3 res = min(int3(1), int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_a45171(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_a45171(); + return; +} + +kernel void compute_main() { + min_a45171(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ecf53481a --- /dev/null +++ b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_a45171 "min_a45171" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %18 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpConstantNull %v3int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_a45171 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %21 + %13 = OpExtInst %v3int %16 SMin %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %min_a45171 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %min_a45171 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %min_a45171 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.wgsl new file mode 100644 index 0000000000..7f1ce9421d --- /dev/null +++ b/test/tint/builtins/gen/literal/min/a45171.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_a45171() { + var res : vec3 = min(vec3(1), vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_a45171(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_a45171(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_a45171(); +} diff --git a/test/tint/builtins/gen/literal/min/aa28ad.wgsl b/test/tint/builtins/gen/literal/min/aa28ad.wgsl new file mode 100644 index 0000000000..97ac59d068 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/aa28ad.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn min_aa28ad() { + var res: vec2 = min(vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_aa28ad(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_aa28ad(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_aa28ad(); +} diff --git a/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd3621d775 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_aa28ad() { + float2 res = min((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_aa28ad(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_aa28ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_aa28ad(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd3621d775 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_aa28ad() { + float2 res = min((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_aa28ad(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_aa28ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_aa28ad(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.glsl new file mode 100644 index 0000000000..5adc832265 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_aa28ad() { + vec2 res = min(vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + min_aa28ad(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_aa28ad() { + vec2 res = min(vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + min_aa28ad(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_aa28ad() { + vec2 res = min(vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + min_aa28ad(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.msl new file mode 100644 index 0000000000..2b8e88470d --- /dev/null +++ b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_aa28ad() { + float2 res = fmin(float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_aa28ad(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_aa28ad(); + return; +} + +kernel void compute_main() { + min_aa28ad(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.spvasm new file mode 100644 index 0000000000..b48e17801d --- /dev/null +++ b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_aa28ad "min_aa28ad" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %min_aa28ad = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 NMin %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %min_aa28ad + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %min_aa28ad + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_aa28ad + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.wgsl new file mode 100644 index 0000000000..7be6f81f1e --- /dev/null +++ b/test/tint/builtins/gen/literal/min/aa28ad.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_aa28ad() { + var res : vec2 = min(vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_aa28ad(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_aa28ad(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_aa28ad(); +} diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl new file mode 100644 index 0000000000..568017c8c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn min_ab0acd() { + var res: vec3 = min(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ab0acd(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ab0acd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ab0acd(); +} diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..839e6b794f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_ab0acd() { + vector res = min((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ab0acd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ab0acd(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9a20bd5133 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void min_ab0acd() { + vector res = min((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ab0acd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ab0acd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CE0B337DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.glsl new file mode 100644 index 0000000000..bc985d79d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ab0acd() { + f16vec3 res = min(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + min_ab0acd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_ab0acd() { + f16vec3 res = min(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + min_ab0acd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ab0acd() { + f16vec3 res = min(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + min_ab0acd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.msl new file mode 100644 index 0000000000..cbac2a3425 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_ab0acd() { + half3 res = fmin(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_ab0acd(); + return; +} + +kernel void compute_main() { + min_ab0acd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.spvasm new file mode 100644 index 0000000000..42feca5959 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_ab0acd "min_ab0acd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_ab0acd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 NMin %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %min_ab0acd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %min_ab0acd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_ab0acd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.wgsl new file mode 100644 index 0000000000..01c09ea37f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ab0acd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn min_ab0acd() { + var res : vec3 = min(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ab0acd(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ab0acd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ab0acd(); +} diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl new file mode 100644 index 0000000000..4222ad4319 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(f16, f16) -> f16 +fn min_ac84d6() { + var res: f16 = min(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ac84d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ac84d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ac84d6(); +} diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3d05db9a83 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_ac84d6() { + float16_t res = min(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ac84d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ac84d6(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b61aaa109 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void min_ac84d6() { + float16_t res = min(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ac84d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ac84d6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024815ABE8C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024815ABE8C0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.glsl new file mode 100644 index 0000000000..b79ac60a36 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ac84d6() { + float16_t res = min(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + min_ac84d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_ac84d6() { + float16_t res = min(0.0hf, 0.0hf); +} + +void fragment_main() { + min_ac84d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ac84d6() { + float16_t res = min(0.0hf, 0.0hf); +} + +void compute_main() { + min_ac84d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.msl new file mode 100644 index 0000000000..d2674176d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_ac84d6() { + half res = fmin(0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_ac84d6(); + return; +} + +kernel void compute_main() { + min_ac84d6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e76e5c3bf4 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_ac84d6 "min_ac84d6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_ac84d6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 NMin %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %min_ac84d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %min_ac84d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %min_ac84d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..9e33bab3ec --- /dev/null +++ b/test/tint/builtins/gen/literal/min/ac84d6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn min_ac84d6() { + var res : f16 = min(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ac84d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ac84d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ac84d6(); +} diff --git a/test/tint/builtins/gen/literal/min/af326d.wgsl b/test/tint/builtins/gen/literal/min/af326d.wgsl new file mode 100644 index 0000000000..83ed240d0c --- /dev/null +++ b/test/tint/builtins/gen/literal/min/af326d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(f32, f32) -> f32 +fn min_af326d() { + var res: f32 = min(1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_af326d(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_af326d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_af326d(); +} diff --git a/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c73080f9c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_af326d() { + float res = min(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_af326d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_af326d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_af326d(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c73080f9c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_af326d() { + float res = min(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_af326d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_af326d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_af326d(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.glsl new file mode 100644 index 0000000000..c6e6a09003 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_af326d() { + float res = min(1.0f, 1.0f); +} + +vec4 vertex_main() { + min_af326d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_af326d() { + float res = min(1.0f, 1.0f); +} + +void fragment_main() { + min_af326d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_af326d() { + float res = min(1.0f, 1.0f); +} + +void compute_main() { + min_af326d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.msl new file mode 100644 index 0000000000..6412c653ce --- /dev/null +++ b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_af326d() { + float res = fmin(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_af326d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_af326d(); + return; +} + +kernel void compute_main() { + min_af326d(); + return; +} + diff --git a/test/tint/builtins/gen/min/af326d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/min/af326d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/min/af326d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.wgsl new file mode 100644 index 0000000000..237752f8ff --- /dev/null +++ b/test/tint/builtins/gen/literal/min/af326d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_af326d() { + var res : f32 = min(1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_af326d(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_af326d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_af326d(); +} diff --git a/test/tint/builtins/gen/literal/min/c70bb7.wgsl b/test/tint/builtins/gen/literal/min/c70bb7.wgsl new file mode 100644 index 0000000000..3c290817ed --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c70bb7.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<3, u32>, vec<3, u32>) -> vec<3, u32> +fn min_c70bb7() { + var res: vec3 = min(vec3(1u), vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c70bb7(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c70bb7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c70bb7(); +} diff --git a/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d260b4c443 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_c70bb7() { + uint3 res = min((1u).xxx, (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c70bb7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c70bb7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c70bb7(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d260b4c443 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_c70bb7() { + uint3 res = min((1u).xxx, (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c70bb7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c70bb7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c70bb7(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.glsl new file mode 100644 index 0000000000..672a3e4e7d --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_c70bb7() { + uvec3 res = min(uvec3(1u), uvec3(1u)); +} + +vec4 vertex_main() { + min_c70bb7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_c70bb7() { + uvec3 res = min(uvec3(1u), uvec3(1u)); +} + +void fragment_main() { + min_c70bb7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_c70bb7() { + uvec3 res = min(uvec3(1u), uvec3(1u)); +} + +void compute_main() { + min_c70bb7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.msl new file mode 100644 index 0000000000..3b0730470e --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_c70bb7() { + uint3 res = min(uint3(1u), uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_c70bb7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_c70bb7(); + return; +} + +kernel void compute_main() { + min_c70bb7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.spvasm new file mode 100644 index 0000000000..c40895cb31 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_c70bb7 "min_c70bb7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %18 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %21 = OpConstantNull %v3uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_c70bb7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %21 + %13 = OpExtInst %v3uint %16 UMin %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %min_c70bb7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %min_c70bb7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %min_c70bb7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.wgsl new file mode 100644 index 0000000000..827caf5891 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c70bb7.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_c70bb7() { + var res : vec3 = min(vec3(1u), vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c70bb7(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c70bb7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c70bb7(); +} diff --git a/test/tint/builtins/gen/literal/min/c73147.wgsl b/test/tint/builtins/gen/literal/min/c73147.wgsl new file mode 100644 index 0000000000..5f1bdee49f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c73147.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(i32, i32) -> i32 +fn min_c73147() { + var res: i32 = min(1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c73147(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c73147(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c73147(); +} diff --git a/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cb8ca07100 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_c73147() { + int res = min(1, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c73147(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c73147(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c73147(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cb8ca07100 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_c73147() { + int res = min(1, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c73147(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c73147(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c73147(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.glsl new file mode 100644 index 0000000000..2af01da8e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_c73147() { + int res = min(1, 1); +} + +vec4 vertex_main() { + min_c73147(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_c73147() { + int res = min(1, 1); +} + +void fragment_main() { + min_c73147(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_c73147() { + int res = min(1, 1); +} + +void compute_main() { + min_c73147(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.msl new file mode 100644 index 0000000000..fdc7a83c31 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_c73147() { + int res = min(1, 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_c73147(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_c73147(); + return; +} + +kernel void compute_main() { + min_c73147(); + return; +} + diff --git a/test/tint/builtins/gen/min/c73147.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/min/c73147.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/min/c73147.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa6bec9ca0 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c73147.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_c73147() { + var res : i32 = min(1, 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c73147(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c73147(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c73147(); +} diff --git a/test/tint/builtins/gen/literal/min/c76fa6.wgsl b/test/tint/builtins/gen/literal/min/c76fa6.wgsl new file mode 100644 index 0000000000..a936998f8c --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c76fa6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn min_c76fa6() { + var res: vec4 = min(vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c76fa6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c76fa6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c76fa6(); +} diff --git a/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee24fbbd0f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_c76fa6() { + float4 res = min((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c76fa6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c76fa6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c76fa6(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ee24fbbd0f --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void min_c76fa6() { + float4 res = min((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c76fa6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c76fa6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c76fa6(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.glsl new file mode 100644 index 0000000000..be35c1d8fd --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void min_c76fa6() { + vec4 res = min(vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + min_c76fa6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_c76fa6() { + vec4 res = min(vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + min_c76fa6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_c76fa6() { + vec4 res = min(vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + min_c76fa6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.msl new file mode 100644 index 0000000000..2ae53d189b --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_c76fa6() { + float4 res = fmin(float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_c76fa6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_c76fa6(); + return; +} + +kernel void compute_main() { + min_c76fa6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.spvasm new file mode 100644 index 0000000000..1a3b883ae7 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_c76fa6 "min_c76fa6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %min_c76fa6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 NMin %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %min_c76fa6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %min_c76fa6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %min_c76fa6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c3f82edf3 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/c76fa6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn min_c76fa6() { + var res : vec4 = min(vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c76fa6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c76fa6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c76fa6(); +} diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl new file mode 100644 index 0000000000..b769097a61 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn min_e780f9() { + var res: vec2 = min(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_e780f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_e780f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_e780f9(); +} diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9c75ce654 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void min_e780f9() { + vector res = min((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_e780f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_e780f9(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a176ab3c84 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void min_e780f9() { + vector res = min((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_e780f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_e780f9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FEDC6E7DE0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.glsl new file mode 100644 index 0000000000..85e7175282 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_e780f9() { + f16vec2 res = min(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + min_e780f9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_e780f9() { + f16vec2 res = min(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + min_e780f9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_e780f9() { + f16vec2 res = min(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + min_e780f9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.msl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.msl new file mode 100644 index 0000000000..675ed30e88 --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void min_e780f9() { + half2 res = fmin(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_e780f9(); + return; +} + +kernel void compute_main() { + min_e780f9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.spvasm new file mode 100644 index 0000000000..45dd579ffd --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_e780f9 "min_e780f9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_e780f9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 NMin %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %min_e780f9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %min_e780f9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_e780f9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.wgsl new file mode 100644 index 0000000000..6da42f234a --- /dev/null +++ b/test/tint/builtins/gen/literal/min/e780f9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn min_e780f9() { + var res : vec2 = min(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_e780f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_e780f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_e780f9(); +} diff --git a/test/tint/builtins/gen/literal/mix/0c8c33.wgsl b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl new file mode 100644 index 0000000000..32ff6cfe84 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn mix_0c8c33() { + var res: vec3 = mix(vec3(1.f), vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_0c8c33(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_0c8c33(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_0c8c33(); +} diff --git a/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e29efdd252 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_0c8c33() { + float3 res = lerp((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_0c8c33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_0c8c33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_0c8c33(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e29efdd252 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void mix_0c8c33() { + float3 res = lerp((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_0c8c33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_0c8c33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_0c8c33(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.glsl new file mode 100644 index 0000000000..801fcbe747 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void mix_0c8c33() { + vec3 res = mix(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + mix_0c8c33(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_0c8c33() { + vec3 res = mix(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + mix_0c8c33(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_0c8c33() { + vec3 res = mix(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + mix_0c8c33(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.msl new file mode 100644 index 0000000000..70041812d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_0c8c33() { + float3 res = mix(float3(1.0f), float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_0c8c33(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_0c8c33(); + return; +} + +kernel void compute_main() { + mix_0c8c33(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa1735d9f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_0c8c33 "mix_0c8c33" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %mix_0c8c33 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 FMix %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %mix_0c8c33 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_0c8c33 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_0c8c33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad663457a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/0c8c33.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn mix_0c8c33() { + var res : vec3 = mix(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_0c8c33(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_0c8c33(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_0c8c33(); +} diff --git a/test/tint/builtins/gen/literal/mix/1faeb1.wgsl b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl new file mode 100644 index 0000000000..d562597eeb --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32> +fn mix_1faeb1() { + var res: vec4 = mix(vec4(1.f), vec4(1.f), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_1faeb1(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_1faeb1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_1faeb1(); +} diff --git a/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..86f86ad130 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_1faeb1() { + float4 res = lerp((1.0f).xxxx, (1.0f).xxxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_1faeb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_1faeb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_1faeb1(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..86f86ad130 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void mix_1faeb1() { + float4 res = lerp((1.0f).xxxx, (1.0f).xxxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_1faeb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_1faeb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_1faeb1(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.glsl new file mode 100644 index 0000000000..365e81e799 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void mix_1faeb1() { + vec4 res = mix(vec4(1.0f), vec4(1.0f), 1.0f); +} + +vec4 vertex_main() { + mix_1faeb1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_1faeb1() { + vec4 res = mix(vec4(1.0f), vec4(1.0f), 1.0f); +} + +void fragment_main() { + mix_1faeb1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_1faeb1() { + vec4 res = mix(vec4(1.0f), vec4(1.0f), 1.0f); +} + +void compute_main() { + mix_1faeb1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.msl new file mode 100644 index 0000000000..404c7cd31f --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_1faeb1() { + float4 res = mix(float4(1.0f), float4(1.0f), 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_1faeb1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_1faeb1(); + return; +} + +kernel void compute_main() { + mix_1faeb1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.spvasm new file mode 100644 index 0000000000..c252ef7bca --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_1faeb1 "mix_1faeb1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %mix_1faeb1 = OpFunction %void None %9 + %12 = OpLabel + %17 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + %19 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 + %13 = OpExtInst %v4float %14 FMix %16 %16 %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %mix_1faeb1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_1faeb1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_1faeb1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.wgsl new file mode 100644 index 0000000000..6743370969 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/1faeb1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn mix_1faeb1() { + var res : vec4 = mix(vec4(1.0f), vec4(1.0f), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_1faeb1(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_1faeb1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_1faeb1(); +} diff --git a/test/tint/builtins/gen/literal/mix/2fadab.wgsl b/test/tint/builtins/gen/literal/mix/2fadab.wgsl new file mode 100644 index 0000000000..98a69d1406 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/2fadab.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32> +fn mix_2fadab() { + var res: vec2 = mix(vec2(1.f), vec2(1.f), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_2fadab(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_2fadab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_2fadab(); +} diff --git a/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8e87ed26df --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_2fadab() { + float2 res = lerp((1.0f).xx, (1.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_2fadab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_2fadab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_2fadab(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e87ed26df --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void mix_2fadab() { + float2 res = lerp((1.0f).xx, (1.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_2fadab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_2fadab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_2fadab(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.glsl new file mode 100644 index 0000000000..adcb16b93c --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void mix_2fadab() { + vec2 res = mix(vec2(1.0f), vec2(1.0f), 1.0f); +} + +vec4 vertex_main() { + mix_2fadab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_2fadab() { + vec2 res = mix(vec2(1.0f), vec2(1.0f), 1.0f); +} + +void fragment_main() { + mix_2fadab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_2fadab() { + vec2 res = mix(vec2(1.0f), vec2(1.0f), 1.0f); +} + +void compute_main() { + mix_2fadab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.msl new file mode 100644 index 0000000000..b40e2661bd --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_2fadab() { + float2 res = mix(float2(1.0f), float2(1.0f), 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_2fadab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_2fadab(); + return; +} + +kernel void compute_main() { + mix_2fadab(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.spvasm new file mode 100644 index 0000000000..201dff7d27 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_2fadab "mix_2fadab" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float + %mix_2fadab = OpFunction %void None %9 + %12 = OpLabel + %18 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v2float Function %20 + %21 = OpCompositeConstruct %v2float %float_1 %float_1 + %13 = OpExtInst %v2float %15 FMix %17 %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %mix_2fadab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %mix_2fadab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %mix_2fadab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.wgsl new file mode 100644 index 0000000000..15843688f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/2fadab.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn mix_2fadab() { + var res : vec2 = mix(vec2(1.0f), vec2(1.0f), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_2fadab(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_2fadab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_2fadab(); +} diff --git a/test/tint/builtins/gen/literal/mix/315264.wgsl b/test/tint/builtins/gen/literal/mix/315264.wgsl new file mode 100644 index 0000000000..2f59044b2e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/315264.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32> +fn mix_315264() { + var res: vec3 = mix(vec3(1.f), vec3(1.f), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_315264(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_315264(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_315264(); +} diff --git a/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d2180b769e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_315264() { + float3 res = lerp((1.0f).xxx, (1.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_315264(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_315264(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_315264(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d2180b769e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void mix_315264() { + float3 res = lerp((1.0f).xxx, (1.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_315264(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_315264(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_315264(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.glsl new file mode 100644 index 0000000000..e746050d5e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void mix_315264() { + vec3 res = mix(vec3(1.0f), vec3(1.0f), 1.0f); +} + +vec4 vertex_main() { + mix_315264(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_315264() { + vec3 res = mix(vec3(1.0f), vec3(1.0f), 1.0f); +} + +void fragment_main() { + mix_315264(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_315264() { + vec3 res = mix(vec3(1.0f), vec3(1.0f), 1.0f); +} + +void compute_main() { + mix_315264(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.msl new file mode 100644 index 0000000000..f3b9575688 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_315264() { + float3 res = mix(float3(1.0f), float3(1.0f), 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_315264(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_315264(); + return; +} + +kernel void compute_main() { + mix_315264(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.spvasm new file mode 100644 index 0000000000..f6b4234ea0 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_315264 "mix_315264" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float + %mix_315264 = OpFunction %void None %9 + %12 = OpLabel + %18 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v3float Function %20 + %21 = OpCompositeConstruct %v3float %float_1 %float_1 %float_1 + %13 = OpExtInst %v3float %15 FMix %17 %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %mix_315264 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %mix_315264 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %mix_315264 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.wgsl new file mode 100644 index 0000000000..4596da5e8b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/315264.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn mix_315264() { + var res : vec3 = mix(vec3(1.0f), vec3(1.0f), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_315264(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_315264(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_315264(); +} diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl new file mode 100644 index 0000000000..66ba78691a --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(f16, f16, f16) -> f16 +fn mix_38cbbb() { + var res: f16 = mix(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_38cbbb(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_38cbbb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_38cbbb(); +} diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f658161ce3 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_38cbbb() { + float16_t res = lerp(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_38cbbb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_38cbbb(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d8b981bed6 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void mix_38cbbb() { + float16_t res = lerp(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_38cbbb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_38cbbb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E08ADE7D50(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E08ADE7D50(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.glsl new file mode 100644 index 0000000000..51e98af0cb --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_38cbbb() { + float16_t res = mix(0.0hf, 0.0hf, 0.0hf); +} + +vec4 vertex_main() { + mix_38cbbb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_38cbbb() { + float16_t res = mix(0.0hf, 0.0hf, 0.0hf); +} + +void fragment_main() { + mix_38cbbb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_38cbbb() { + float16_t res = mix(0.0hf, 0.0hf, 0.0hf); +} + +void compute_main() { + mix_38cbbb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.msl new file mode 100644 index 0000000000..57e66f3c8e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_38cbbb() { + half res = mix(0.0h, 0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_38cbbb(); + return; +} + +kernel void compute_main() { + mix_38cbbb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbd032d6dd --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_38cbbb "mix_38cbbb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_38cbbb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 FMix %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %mix_38cbbb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %mix_38cbbb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %mix_38cbbb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.wgsl new file mode 100644 index 0000000000..383a567c5b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/38cbbb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_38cbbb() { + var res : f16 = mix(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_38cbbb(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_38cbbb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_38cbbb(); +} diff --git a/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl new file mode 100644 index 0000000000..51cefc7636 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(f32, f32, f32) -> f32 +fn mix_4f0b5e() { + var res: f32 = mix(1.f, 1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_4f0b5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_4f0b5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_4f0b5e(); +} diff --git a/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2c04d6b557 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_4f0b5e() { + float res = lerp(1.0f, 1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_4f0b5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_4f0b5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_4f0b5e(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2c04d6b557 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void mix_4f0b5e() { + float res = lerp(1.0f, 1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_4f0b5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_4f0b5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_4f0b5e(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.glsl new file mode 100644 index 0000000000..58fac89643 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void mix_4f0b5e() { + float res = mix(1.0f, 1.0f, 1.0f); +} + +vec4 vertex_main() { + mix_4f0b5e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_4f0b5e() { + float res = mix(1.0f, 1.0f, 1.0f); +} + +void fragment_main() { + mix_4f0b5e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_4f0b5e() { + float res = mix(1.0f, 1.0f, 1.0f); +} + +void compute_main() { + mix_4f0b5e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.msl new file mode 100644 index 0000000000..3859b69a57 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_4f0b5e() { + float res = mix(1.0f, 1.0f, 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_4f0b5e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_4f0b5e(); + return; +} + +kernel void compute_main() { + mix_4f0b5e(); + return; +} + diff --git a/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8a790a9b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/4f0b5e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn mix_4f0b5e() { + var res : f32 = mix(1.0f, 1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_4f0b5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_4f0b5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_4f0b5e(); +} diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl new file mode 100644 index 0000000000..73b7505822 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn mix_63f2fd() { + var res: vec3 = mix(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_63f2fd(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_63f2fd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_63f2fd(); +} diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3729fefdbe --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_63f2fd() { + vector res = lerp((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_63f2fd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_63f2fd(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..92c760882e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_63f2fd() { + vector res = lerp((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_63f2fd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_63f2fd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B9F0AF6FF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.glsl new file mode 100644 index 0000000000..e51235ba70 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_63f2fd() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + mix_63f2fd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_63f2fd() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + mix_63f2fd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_63f2fd() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + mix_63f2fd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.msl new file mode 100644 index 0000000000..8a9ca6f273 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_63f2fd() { + half3 res = mix(half3(0.0h), half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_63f2fd(); + return; +} + +kernel void compute_main() { + mix_63f2fd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.spvasm new file mode 100644 index 0000000000..85d9a38d46 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_63f2fd "mix_63f2fd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_63f2fd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 FMix %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %mix_63f2fd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_63f2fd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_63f2fd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.wgsl new file mode 100644 index 0000000000..8aa39e8347 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/63f2fd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_63f2fd() { + var res : vec3 = mix(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_63f2fd(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_63f2fd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_63f2fd(); +} diff --git a/test/tint/builtins/gen/literal/mix/6f8adc.wgsl b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl new file mode 100644 index 0000000000..7674096288 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn mix_6f8adc() { + var res: vec2 = mix(vec2(1.f), vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_6f8adc(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_6f8adc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_6f8adc(); +} diff --git a/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c18f49bd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_6f8adc() { + float2 res = lerp((1.0f).xx, (1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_6f8adc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_6f8adc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_6f8adc(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4c18f49bd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void mix_6f8adc() { + float2 res = lerp((1.0f).xx, (1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_6f8adc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_6f8adc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_6f8adc(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.glsl new file mode 100644 index 0000000000..8742f945ca --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void mix_6f8adc() { + vec2 res = mix(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + mix_6f8adc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_6f8adc() { + vec2 res = mix(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + mix_6f8adc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_6f8adc() { + vec2 res = mix(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + mix_6f8adc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.msl new file mode 100644 index 0000000000..fe9ab8846e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_6f8adc() { + float2 res = mix(float2(1.0f), float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_6f8adc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_6f8adc(); + return; +} + +kernel void compute_main() { + mix_6f8adc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.spvasm new file mode 100644 index 0000000000..e97dfb3e07 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_6f8adc "mix_6f8adc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %mix_6f8adc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 FMix %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %mix_6f8adc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_6f8adc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_6f8adc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fbda72cef --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/6f8adc.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn mix_6f8adc() { + var res : vec2 = mix(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_6f8adc(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_6f8adc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_6f8adc(); +} diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl new file mode 100644 index 0000000000..3c89b0386b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn mix_98ee3e() { + var res: vec2 = mix(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_98ee3e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_98ee3e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_98ee3e(); +} diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2cc67bace9 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_98ee3e() { + vector res = lerp((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_98ee3e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_98ee3e(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..784bfa3174 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_98ee3e() { + vector res = lerp((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_98ee3e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_98ee3e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019DF5529870(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.glsl new file mode 100644 index 0000000000..977312c5e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_98ee3e() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + mix_98ee3e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_98ee3e() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + mix_98ee3e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_98ee3e() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + mix_98ee3e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.msl new file mode 100644 index 0000000000..4f98b7ad1e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_98ee3e() { + half2 res = mix(half2(0.0h), half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_98ee3e(); + return; +} + +kernel void compute_main() { + mix_98ee3e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.spvasm new file mode 100644 index 0000000000..47c734a523 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_98ee3e "mix_98ee3e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_98ee3e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 FMix %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %mix_98ee3e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_98ee3e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_98ee3e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb4929d442 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/98ee3e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_98ee3e() { + var res : vec2 = mix(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_98ee3e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_98ee3e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_98ee3e(); +} diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl new file mode 100644 index 0000000000..21231efd79 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<3, f16>, vec<3, f16>, f16) -> vec<3, f16> +fn mix_c1aec6() { + var res: vec3 = mix(vec3(f16()), vec3(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c1aec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c1aec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c1aec6(); +} diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3463407e3e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_c1aec6() { + vector res = lerp((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c1aec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c1aec6(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..90e3fb0baf --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_c1aec6() { + vector res = lerp((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c1aec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c1aec6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000197E6FB4A90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.glsl new file mode 100644 index 0000000000..8411e258e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_c1aec6() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + mix_c1aec6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_c1aec6() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +void fragment_main() { + mix_c1aec6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_c1aec6() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +void compute_main() { + mix_c1aec6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.msl new file mode 100644 index 0000000000..a8285baea8 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_c1aec6() { + half3 res = mix(half3(0.0h), half3(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_c1aec6(); + return; +} + +kernel void compute_main() { + mix_c1aec6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b6a048a10 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_c1aec6 "mix_c1aec6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half + %18 = OpConstantNull %half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_c1aec6 = OpFunction %void None %9 + %12 = OpLabel + %19 = OpVariable %_ptr_Function_v3half Function %17 + %res = OpVariable %_ptr_Function_v3half Function %17 + %21 = OpCompositeConstruct %v3half %18 %18 %18 + %13 = OpExtInst %v3half %16 FMix %17 %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %mix_c1aec6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_c1aec6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_c1aec6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.wgsl new file mode 100644 index 0000000000..6665965b40 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c1aec6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_c1aec6() { + var res : vec3 = mix(vec3(f16()), vec3(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c1aec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c1aec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c1aec6(); +} diff --git a/test/tint/builtins/gen/literal/mix/c37ede.wgsl b/test/tint/builtins/gen/literal/mix/c37ede.wgsl new file mode 100644 index 0000000000..06e032645b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c37ede.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn mix_c37ede() { + var res: vec4 = mix(vec4(1.f), vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c37ede(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c37ede(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c37ede(); +} diff --git a/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..04a92f0e29 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_c37ede() { + float4 res = lerp((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c37ede(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c37ede(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c37ede(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04a92f0e29 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void mix_c37ede() { + float4 res = lerp((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c37ede(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c37ede(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c37ede(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.glsl new file mode 100644 index 0000000000..aafa134f22 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void mix_c37ede() { + vec4 res = mix(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + mix_c37ede(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_c37ede() { + vec4 res = mix(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + mix_c37ede(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_c37ede() { + vec4 res = mix(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + mix_c37ede(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.msl new file mode 100644 index 0000000000..3c839264dc --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_c37ede() { + float4 res = mix(float4(1.0f), float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_c37ede(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_c37ede(); + return; +} + +kernel void compute_main() { + mix_c37ede(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.spvasm new file mode 100644 index 0000000000..95427bd2a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_c37ede "mix_c37ede" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %mix_c37ede = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 FMix %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %mix_c37ede + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %mix_c37ede + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %mix_c37ede + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.wgsl new file mode 100644 index 0000000000..71abfdf1f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/c37ede.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn mix_c37ede() { + var res : vec4 = mix(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c37ede(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c37ede(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c37ede(); +} diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl new file mode 100644 index 0000000000..6adeecb725 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<2, f16>, vec<2, f16>, f16) -> vec<2, f16> +fn mix_e46a83() { + var res: vec2 = mix(vec2(f16()), vec2(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_e46a83(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_e46a83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_e46a83(); +} diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fa0f9c2e1d --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_e46a83() { + vector res = lerp((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_e46a83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_e46a83(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ce6313eff --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_e46a83() { + vector res = lerp((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_e46a83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_e46a83(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F8B7BA68A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.glsl new file mode 100644 index 0000000000..bae9e6d35a --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_e46a83() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + mix_e46a83(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_e46a83() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +void fragment_main() { + mix_e46a83(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_e46a83() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +void compute_main() { + mix_e46a83(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.msl new file mode 100644 index 0000000000..15babbee22 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_e46a83() { + half2 res = mix(half2(0.0h), half2(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_e46a83(); + return; +} + +kernel void compute_main() { + mix_e46a83(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.spvasm new file mode 100644 index 0000000000..8dfbb2c974 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_e46a83 "mix_e46a83" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half + %18 = OpConstantNull %half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_e46a83 = OpFunction %void None %9 + %12 = OpLabel + %19 = OpVariable %_ptr_Function_v2half Function %17 + %res = OpVariable %_ptr_Function_v2half Function %17 + %21 = OpCompositeConstruct %v2half %18 %18 + %13 = OpExtInst %v2half %16 FMix %17 %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %mix_e46a83 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_e46a83 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_e46a83 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.wgsl new file mode 100644 index 0000000000..44b19f2a56 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/e46a83.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_e46a83() { + var res : vec2 = mix(vec2(f16()), vec2(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_e46a83(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_e46a83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_e46a83(); +} diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl new file mode 100644 index 0000000000..7bf17b5730 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn mix_ee2468() { + var res: vec4 = mix(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_ee2468(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_ee2468(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_ee2468(); +} diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..daaa4163eb --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_ee2468() { + vector res = lerp((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_ee2468(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_ee2468(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..012c44190b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_ee2468() { + vector res = lerp((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_ee2468(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_ee2468(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B8684C57F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.glsl new file mode 100644 index 0000000000..16c94d2738 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_ee2468() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + mix_ee2468(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_ee2468() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + mix_ee2468(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_ee2468() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + mix_ee2468(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.msl new file mode 100644 index 0000000000..2eabc8960b --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_ee2468() { + half4 res = mix(half4(0.0h), half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_ee2468(); + return; +} + +kernel void compute_main() { + mix_ee2468(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ff66bb838 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_ee2468 "mix_ee2468" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_ee2468 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 FMix %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %mix_ee2468 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_ee2468 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_ee2468 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.wgsl new file mode 100644 index 0000000000..15e853163a --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/ee2468.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_ee2468() { + var res : vec4 = mix(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_ee2468(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_ee2468(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_ee2468(); +} diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl new file mode 100644 index 0000000000..5ff2c85e7d --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<4, f16>, vec<4, f16>, f16) -> vec<4, f16> +fn mix_f1a543() { + var res: vec4 = mix(vec4(f16()), vec4(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_f1a543(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_f1a543(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_f1a543(); +} diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0701d56694 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void mix_f1a543() { + vector res = lerp((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_f1a543(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_f1a543(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26ebdc4e47 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void mix_f1a543() { + vector res = lerp((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_f1a543(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_f1a543(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020D39006FD0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.glsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.glsl new file mode 100644 index 0000000000..730990d4cc --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_f1a543() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + mix_f1a543(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_f1a543() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +void fragment_main() { + mix_f1a543(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_f1a543() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +void compute_main() { + mix_f1a543(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.msl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.msl new file mode 100644 index 0000000000..823de59c88 --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void mix_f1a543() { + half4 res = mix(half4(0.0h), half4(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_f1a543(); + return; +} + +kernel void compute_main() { + mix_f1a543(); + return; +} + diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f1efc566e --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_f1a543 "mix_f1a543" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half + %18 = OpConstantNull %half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_f1a543 = OpFunction %void None %9 + %12 = OpLabel + %19 = OpVariable %_ptr_Function_v4half Function %17 + %res = OpVariable %_ptr_Function_v4half Function %17 + %21 = OpCompositeConstruct %v4half %18 %18 %18 %18 + %13 = OpExtInst %v4half %16 FMix %17 %17 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %mix_f1a543 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_f1a543 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_f1a543 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.wgsl new file mode 100644 index 0000000000..c42b7dae8d --- /dev/null +++ b/test/tint/builtins/gen/literal/mix/f1a543.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn mix_f1a543() { + var res : vec4 = mix(vec4(f16()), vec4(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_f1a543(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_f1a543(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_f1a543(); +} diff --git a/test/tint/builtins/gen/literal/modf/2d50da.wgsl b/test/tint/builtins/gen/literal/modf/2d50da.wgsl new file mode 100644 index 0000000000..8d3d0ddfd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/2d50da.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(vec<2, f32>) -> __modf_result_vec<2, f32> +fn modf_2d50da() { + var res = modf(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_2d50da(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_2d50da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_2d50da(); +} diff --git a/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2aba1e7707 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec2 { + float2 fract; + float2 whole; +}; +modf_result_vec2 tint_modf(float2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_2d50da() { + modf_result_vec2 res = tint_modf((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_2d50da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_2d50da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_2d50da(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2aba1e7707 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec2 { + float2 fract; + float2 whole; +}; +modf_result_vec2 tint_modf(float2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_2d50da() { + modf_result_vec2 res = tint_modf((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_2d50da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_2d50da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_2d50da(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.glsl new file mode 100644 index 0000000000..540a580081 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.glsl @@ -0,0 +1,85 @@ +#version 310 es + +struct modf_result_vec2 { + vec2 fract; + vec2 whole; +}; + +modf_result_vec2 tint_modf(vec2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_2d50da() { + modf_result_vec2 res = tint_modf(vec2(1.0f)); +} + +vec4 vertex_main() { + modf_2d50da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result_vec2 { + vec2 fract; + vec2 whole; +}; + +modf_result_vec2 tint_modf(vec2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_2d50da() { + modf_result_vec2 res = tint_modf(vec2(1.0f)); +} + +void fragment_main() { + modf_2d50da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result_vec2 { + vec2 fract; + vec2 whole; +}; + +modf_result_vec2 tint_modf(vec2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_2d50da() { + modf_result_vec2 res = tint_modf(vec2(1.0f)); +} + +void compute_main() { + modf_2d50da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.msl new file mode 100644 index 0000000000..edccc81725 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_vec2 { + float2 fract; + float2 whole; +}; +modf_result_vec2 tint_modf(float2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_2d50da() { + modf_result_vec2 res = tint_modf(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_2d50da(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_2d50da(); + return; +} + +kernel void compute_main() { + modf_2d50da(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc7576901c --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_2d50da "modf_2d50da" + OpName %__modf_result_vec2 "__modf_result_vec2" + OpMemberName %__modf_result_vec2 0 "fract" + OpMemberName %__modf_result_vec2 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec2 0 Offset 0 + OpMemberDecorate %__modf_result_vec2 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%__modf_result_vec2 = OpTypeStruct %v2float %v2float + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function___modf_result_vec2 = OpTypePointer Function %__modf_result_vec2 + %21 = OpConstantNull %__modf_result_vec2 + %22 = OpTypeFunction %v4float +%modf_2d50da = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_vec2 Function %21 + %13 = OpExtInst %__modf_result_vec2 %16 ModfStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %modf_2d50da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %modf_2d50da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %modf_2d50da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.wgsl new file mode 100644 index 0000000000..d893b25e80 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/2d50da.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn modf_2d50da() { + var res = modf(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_2d50da(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_2d50da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_2d50da(); +} diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl new file mode 100644 index 0000000000..236e165b2a --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<3, f16>) -> __modf_result_vec<3, f16> +fn modf_45005f() { + var res = modf(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_45005f(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_45005f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_45005f(); +} diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..30ed6b2046 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec3_f16 { + vector fract; + vector whole; +}; +modf_result_vec3_f16 tint_modf(vector param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_45005f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_45005f(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f164dad2f --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +SKIP: FAILED + +struct modf_result_vec3_f16 { + vector fract; + vector whole; +}; +modf_result_vec3_f16 tint_modf(vector param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_45005f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_45005f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B818324B80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.glsl new file mode 100644 index 0000000000..c2ef9d1bd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + modf_45005f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf(f16vec3(0.0hf)); +} + +void fragment_main() { + modf_45005f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf(f16vec3(0.0hf)); +} + +void compute_main() { + modf_45005f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.msl new file mode 100644 index 0000000000..b07ab06c66 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_vec3_f16 { + half3 fract; + half3 whole; +}; +modf_result_vec3_f16 tint_modf(half3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + modf_result_vec3_f16 res = tint_modf(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_45005f(); + return; +} + +kernel void compute_main() { + modf_45005f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.spvasm new file mode 100644 index 0000000000..1e06f7ac0c --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_45005f "modf_45005f" + OpName %__modf_result_vec3_f16 "__modf_result_vec3_f16" + OpMemberName %__modf_result_vec3_f16 0 "fract" + OpMemberName %__modf_result_vec3_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec3_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec3_f16 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%__modf_result_vec3_f16 = OpTypeStruct %v3half %v3half + %18 = OpConstantNull %v3half +%_ptr_Function___modf_result_vec3_f16 = OpTypePointer Function %__modf_result_vec3_f16 + %21 = OpConstantNull %__modf_result_vec3_f16 + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_45005f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_vec3_f16 Function %21 + %13 = OpExtInst %__modf_result_vec3_f16 %17 ModfStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %modf_45005f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_45005f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_45005f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.wgsl new file mode 100644 index 0000000000..57f4b3b0a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/45005f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn modf_45005f() { + var res = modf(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_45005f(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_45005f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_45005f(); +} diff --git a/test/tint/builtins/gen/literal/modf/4bfced.wgsl b/test/tint/builtins/gen/literal/modf/4bfced.wgsl new file mode 100644 index 0000000000..1a3fd9a1b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/4bfced.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(vec<4, f32>) -> __modf_result_vec<4, f32> +fn modf_4bfced() { + var res = modf(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_4bfced(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_4bfced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_4bfced(); +} diff --git a/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..043bbab60d --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec4 { + float4 fract; + float4 whole; +}; +modf_result_vec4 tint_modf(float4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_4bfced() { + modf_result_vec4 res = tint_modf((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_4bfced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_4bfced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_4bfced(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..043bbab60d --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec4 { + float4 fract; + float4 whole; +}; +modf_result_vec4 tint_modf(float4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_4bfced() { + modf_result_vec4 res = tint_modf((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_4bfced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_4bfced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_4bfced(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.glsl new file mode 100644 index 0000000000..7c7e682147 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.glsl @@ -0,0 +1,85 @@ +#version 310 es + +struct modf_result_vec4 { + vec4 fract; + vec4 whole; +}; + +modf_result_vec4 tint_modf(vec4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_4bfced() { + modf_result_vec4 res = tint_modf(vec4(1.0f)); +} + +vec4 vertex_main() { + modf_4bfced(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result_vec4 { + vec4 fract; + vec4 whole; +}; + +modf_result_vec4 tint_modf(vec4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_4bfced() { + modf_result_vec4 res = tint_modf(vec4(1.0f)); +} + +void fragment_main() { + modf_4bfced(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result_vec4 { + vec4 fract; + vec4 whole; +}; + +modf_result_vec4 tint_modf(vec4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_4bfced() { + modf_result_vec4 res = tint_modf(vec4(1.0f)); +} + +void compute_main() { + modf_4bfced(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.msl new file mode 100644 index 0000000000..3b5da9c052 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_vec4 { + float4 fract; + float4 whole; +}; +modf_result_vec4 tint_modf(float4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_4bfced() { + modf_result_vec4 res = tint_modf(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_4bfced(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_4bfced(); + return; +} + +kernel void compute_main() { + modf_4bfced(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.spvasm new file mode 100644 index 0000000000..2a58dd4174 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_4bfced "modf_4bfced" + OpName %__modf_result_vec4 "__modf_result_vec4" + OpMemberName %__modf_result_vec4 0 "fract" + OpMemberName %__modf_result_vec4 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec4 0 Offset 0 + OpMemberDecorate %__modf_result_vec4 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%__modf_result_vec4 = OpTypeStruct %v4float %v4float + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function___modf_result_vec4 = OpTypePointer Function %__modf_result_vec4 + %20 = OpConstantNull %__modf_result_vec4 + %21 = OpTypeFunction %v4float +%modf_4bfced = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_vec4 Function %20 + %13 = OpExtInst %__modf_result_vec4 %15 ModfStruct %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %modf_4bfced + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %modf_4bfced + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %modf_4bfced + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.wgsl new file mode 100644 index 0000000000..0b04b87797 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/4bfced.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn modf_4bfced() { + var res = modf(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_4bfced(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_4bfced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_4bfced(); +} diff --git a/test/tint/builtins/gen/literal/modf/5ea256.wgsl b/test/tint/builtins/gen/literal/modf/5ea256.wgsl new file mode 100644 index 0000000000..673bb2517e --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/5ea256.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(vec<3, f32>) -> __modf_result_vec<3, f32> +fn modf_5ea256() { + var res = modf(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_5ea256(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_5ea256(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_5ea256(); +} diff --git a/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a2c46f5a60 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec3 { + float3 fract; + float3 whole; +}; +modf_result_vec3 tint_modf(float3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_5ea256() { + modf_result_vec3 res = tint_modf((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_5ea256(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_5ea256(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_5ea256(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a2c46f5a60 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec3 { + float3 fract; + float3 whole; +}; +modf_result_vec3 tint_modf(float3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_5ea256() { + modf_result_vec3 res = tint_modf((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_5ea256(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_5ea256(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_5ea256(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.glsl new file mode 100644 index 0000000000..7a727ecf19 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.glsl @@ -0,0 +1,85 @@ +#version 310 es + +struct modf_result_vec3 { + vec3 fract; + vec3 whole; +}; + +modf_result_vec3 tint_modf(vec3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_5ea256() { + modf_result_vec3 res = tint_modf(vec3(1.0f)); +} + +vec4 vertex_main() { + modf_5ea256(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result_vec3 { + vec3 fract; + vec3 whole; +}; + +modf_result_vec3 tint_modf(vec3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_5ea256() { + modf_result_vec3 res = tint_modf(vec3(1.0f)); +} + +void fragment_main() { + modf_5ea256(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result_vec3 { + vec3 fract; + vec3 whole; +}; + +modf_result_vec3 tint_modf(vec3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_5ea256() { + modf_result_vec3 res = tint_modf(vec3(1.0f)); +} + +void compute_main() { + modf_5ea256(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.msl new file mode 100644 index 0000000000..33e7fa36e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_vec3 { + float3 fract; + float3 whole; +}; +modf_result_vec3 tint_modf(float3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_5ea256() { + modf_result_vec3 res = tint_modf(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_5ea256(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_5ea256(); + return; +} + +kernel void compute_main() { + modf_5ea256(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.spvasm new file mode 100644 index 0000000000..6762d611b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_5ea256 "modf_5ea256" + OpName %__modf_result_vec3 "__modf_result_vec3" + OpMemberName %__modf_result_vec3 0 "fract" + OpMemberName %__modf_result_vec3 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec3 0 Offset 0 + OpMemberDecorate %__modf_result_vec3 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%__modf_result_vec3 = OpTypeStruct %v3float %v3float + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function___modf_result_vec3 = OpTypePointer Function %__modf_result_vec3 + %21 = OpConstantNull %__modf_result_vec3 + %22 = OpTypeFunction %v4float +%modf_5ea256 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_vec3 Function %21 + %13 = OpExtInst %__modf_result_vec3 %16 ModfStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %modf_5ea256 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %modf_5ea256 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %modf_5ea256 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.wgsl new file mode 100644 index 0000000000..ea4142d8c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/5ea256.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn modf_5ea256() { + var res = modf(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_5ea256(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_5ea256(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_5ea256(); +} diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl new file mode 100644 index 0000000000..71e26385e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(f16) -> __modf_result +fn modf_8dbbbf() { + var res = modf(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_8dbbbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_8dbbbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_8dbbbf(); +} diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..802fe2a87d --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_8dbbbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_8dbbbf(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ce161cd1f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +SKIP: FAILED + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_8dbbbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_8dbbbf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024604C24BA0(2,3-11): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.glsl new file mode 100644 index 0000000000..f949198626 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(0.0hf); +} + +vec4 vertex_main() { + modf_8dbbbf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(0.0hf); +} + +void fragment_main() { + modf_8dbbbf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(0.0hf); +} + +void compute_main() { + modf_8dbbbf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.msl new file mode 100644 index 0000000000..f0a8d58991 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_f16 { + half fract; + half whole; +}; +modf_result_f16 tint_modf(half param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + modf_result_f16 res = tint_modf(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_8dbbbf(); + return; +} + +kernel void compute_main() { + modf_8dbbbf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.spvasm new file mode 100644 index 0000000000..53162e3865 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_8dbbbf "modf_8dbbbf" + OpName %__modf_result_f16 "__modf_result_f16" + OpMemberName %__modf_result_f16 0 "fract" + OpMemberName %__modf_result_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_f16 0 Offset 0 + OpMemberDecorate %__modf_result_f16 1 Offset 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 +%__modf_result_f16 = OpTypeStruct %half %half + %17 = OpConstantNull %half +%_ptr_Function___modf_result_f16 = OpTypePointer Function %__modf_result_f16 + %20 = OpConstantNull %__modf_result_f16 + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_8dbbbf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_f16 Function %20 + %13 = OpExtInst %__modf_result_f16 %16 ModfStruct %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %modf_8dbbbf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %modf_8dbbbf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %modf_8dbbbf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ab39a6f3c --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/8dbbbf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn modf_8dbbbf() { + var res = modf(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_8dbbbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_8dbbbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_8dbbbf(); +} diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl b/test/tint/builtins/gen/literal/modf/995934.wgsl new file mode 100644 index 0000000000..ef2c6aec4f --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<4, f16>) -> __modf_result_vec<4, f16> +fn modf_995934() { + var res = modf(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_995934(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_995934(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_995934(); +} diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d1b1051608 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec4_f16 { + vector fract; + vector whole; +}; +modf_result_vec4_f16 tint_modf(vector param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_995934(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_995934(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_995934(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7a708c7ca0 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +SKIP: FAILED + +struct modf_result_vec4_f16 { + vector fract; + vector whole; +}; +modf_result_vec4_f16 tint_modf(vector param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_995934(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_995934(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_995934(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016E71A92D00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.glsl new file mode 100644 index 0000000000..f3e71cb8be --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + modf_995934(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf(f16vec4(0.0hf)); +} + +void fragment_main() { + modf_995934(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf(f16vec4(0.0hf)); +} + +void compute_main() { + modf_995934(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.msl new file mode 100644 index 0000000000..93df00a5b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_vec4_f16 { + half4 fract; + half4 whole; +}; +modf_result_vec4_f16 tint_modf(half4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + modf_result_vec4_f16 res = tint_modf(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_995934(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_995934(); + return; +} + +kernel void compute_main() { + modf_995934(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.spvasm new file mode 100644 index 0000000000..6fa7c2f351 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_995934 "modf_995934" + OpName %__modf_result_vec4_f16 "__modf_result_vec4_f16" + OpMemberName %__modf_result_vec4_f16 0 "fract" + OpMemberName %__modf_result_vec4_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec4_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec4_f16 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%__modf_result_vec4_f16 = OpTypeStruct %v4half %v4half + %18 = OpConstantNull %v4half +%_ptr_Function___modf_result_vec4_f16 = OpTypePointer Function %__modf_result_vec4_f16 + %21 = OpConstantNull %__modf_result_vec4_f16 + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_995934 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_vec4_f16 Function %21 + %13 = OpExtInst %__modf_result_vec4_f16 %17 ModfStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %modf_995934 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_995934 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_995934 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.wgsl new file mode 100644 index 0000000000..1568993174 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/995934.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn modf_995934() { + var res = modf(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_995934(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_995934(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_995934(); +} diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl new file mode 100644 index 0000000000..5b3d8b5137 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<2, f16>) -> __modf_result_vec<2, f16> +fn modf_a545b9() { + var res = modf(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_a545b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_a545b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_a545b9(); +} diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d14629192a --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result_vec2_f16 { + vector fract; + vector whole; +}; +modf_result_vec2_f16 tint_modf(vector param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_a545b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_a545b9(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63d6da7271 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +SKIP: FAILED + +struct modf_result_vec2_f16 { + vector fract; + vector whole; +}; +modf_result_vec2_f16 tint_modf(vector param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_a545b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_a545b9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002393F2A4B80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.glsl new file mode 100644 index 0000000000..9a4b37ae4b --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + modf_a545b9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf(f16vec2(0.0hf)); +} + +void fragment_main() { + modf_a545b9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf(f16vec2(0.0hf)); +} + +void compute_main() { + modf_a545b9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.msl new file mode 100644 index 0000000000..a9f218aeee --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result_vec2_f16 { + half2 fract; + half2 whole; +}; +modf_result_vec2_f16 tint_modf(half2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + modf_result_vec2_f16 res = tint_modf(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_a545b9(); + return; +} + +kernel void compute_main() { + modf_a545b9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..a47a13827b --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_a545b9 "modf_a545b9" + OpName %__modf_result_vec2_f16 "__modf_result_vec2_f16" + OpMemberName %__modf_result_vec2_f16 0 "fract" + OpMemberName %__modf_result_vec2_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec2_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec2_f16 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%__modf_result_vec2_f16 = OpTypeStruct %v2half %v2half + %18 = OpConstantNull %v2half +%_ptr_Function___modf_result_vec2_f16 = OpTypePointer Function %__modf_result_vec2_f16 + %21 = OpConstantNull %__modf_result_vec2_f16 + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_a545b9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result_vec2_f16 Function %21 + %13 = OpExtInst %__modf_result_vec2_f16 %17 ModfStruct %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %modf_a545b9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_a545b9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_a545b9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..177b0e97da --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/a545b9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn modf_a545b9() { + var res = modf(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_a545b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_a545b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_a545b9(); +} diff --git a/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl new file mode 100644 index 0000000000..d0ffdaa96d --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(f32) -> __modf_result +fn modf_bbf7f7() { + var res = modf(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_bbf7f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_bbf7f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_bbf7f7(); +} diff --git a/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..020478a8f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_bbf7f7() { + modf_result res = tint_modf(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_bbf7f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_bbf7f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_bbf7f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..020478a8f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_bbf7f7() { + modf_result res = tint_modf(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_bbf7f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_bbf7f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_bbf7f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.glsl new file mode 100644 index 0000000000..30917acac3 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.glsl @@ -0,0 +1,85 @@ +#version 310 es + +struct modf_result { + float fract; + float whole; +}; + +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_bbf7f7() { + modf_result res = tint_modf(1.0f); +} + +vec4 vertex_main() { + modf_bbf7f7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result { + float fract; + float whole; +}; + +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_bbf7f7() { + modf_result res = tint_modf(1.0f); +} + +void fragment_main() { + modf_bbf7f7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result { + float fract; + float whole; +}; + +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_bbf7f7() { + modf_result res = tint_modf(1.0f); +} + +void compute_main() { + modf_bbf7f7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.msl b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.msl new file mode 100644 index 0000000000..250e830d22 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; + +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_bbf7f7() { + modf_result res = tint_modf(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_bbf7f7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_bbf7f7(); + return; +} + +kernel void compute_main() { + modf_bbf7f7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..21a235880f --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_bbf7f7 "modf_bbf7f7" + OpName %__modf_result "__modf_result" + OpMemberName %__modf_result 0 "fract" + OpMemberName %__modf_result 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result 0 Offset 0 + OpMemberDecorate %__modf_result 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%__modf_result = OpTypeStruct %float %float + %float_1 = OpConstant %float 1 +%_ptr_Function___modf_result = OpTypePointer Function %__modf_result + %19 = OpConstantNull %__modf_result + %20 = OpTypeFunction %v4float +%modf_bbf7f7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function___modf_result Function %19 + %13 = OpExtInst %__modf_result %15 ModfStruct %float_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %modf_bbf7f7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %modf_bbf7f7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_bbf7f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..31c86d6146 --- /dev/null +++ b/test/tint/builtins/gen/literal/modf/bbf7f7.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn modf_bbf7f7() { + var res = modf(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_bbf7f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_bbf7f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_bbf7f7(); +} diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl new file mode 100644 index 0000000000..3c612c65b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<3, f16>) -> vec<3, f16> +fn normalize_39d5ec() { + var res: vec3 = normalize(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_39d5ec(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_39d5ec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_39d5ec(); +} diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ad650fbbc --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void normalize_39d5ec() { + vector res = normalize((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_39d5ec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_39d5ec(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2533db5094 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void normalize_39d5ec() { + vector res = normalize((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_39d5ec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_39d5ec(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002467316DBB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.glsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.glsl new file mode 100644 index 0000000000..e129ddcbd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_39d5ec() { + f16vec3 res = normalize(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + normalize_39d5ec(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_39d5ec() { + f16vec3 res = normalize(f16vec3(0.0hf)); +} + +void fragment_main() { + normalize_39d5ec(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_39d5ec() { + f16vec3 res = normalize(f16vec3(0.0hf)); +} + +void compute_main() { + normalize_39d5ec(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.msl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.msl new file mode 100644 index 0000000000..683a2ad492 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void normalize_39d5ec() { + half3 res = normalize(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_39d5ec(); + return; +} + +kernel void compute_main() { + normalize_39d5ec(); + return; +} + diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f5230775e --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_39d5ec "normalize_39d5ec" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_39d5ec = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Normalize %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %normalize_39d5ec + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %normalize_39d5ec + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %normalize_39d5ec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8f2e8fa2b --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/39d5ec.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn normalize_39d5ec() { + var res : vec3 = normalize(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_39d5ec(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_39d5ec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_39d5ec(); +} diff --git a/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl new file mode 100644 index 0000000000..7b6fcda2e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn normalize(vec<3, f32>) -> vec<3, f32> +fn normalize_64d8c0() { + var res: vec3 = normalize(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_64d8c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_64d8c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_64d8c0(); +} diff --git a/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..435c77f3bd --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void normalize_64d8c0() { + float3 res = normalize((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_64d8c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_64d8c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_64d8c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..435c77f3bd --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void normalize_64d8c0() { + float3 res = normalize((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_64d8c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_64d8c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_64d8c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.glsl new file mode 100644 index 0000000000..ee47fc768b --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void normalize_64d8c0() { + vec3 res = normalize(vec3(1.0f)); +} + +vec4 vertex_main() { + normalize_64d8c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void normalize_64d8c0() { + vec3 res = normalize(vec3(1.0f)); +} + +void fragment_main() { + normalize_64d8c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void normalize_64d8c0() { + vec3 res = normalize(vec3(1.0f)); +} + +void compute_main() { + normalize_64d8c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.msl b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.msl new file mode 100644 index 0000000000..a821d6ddf2 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void normalize_64d8c0() { + float3 res = normalize(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_64d8c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_64d8c0(); + return; +} + +kernel void compute_main() { + normalize_64d8c0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..e8caa640f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_64d8c0 "normalize_64d8c0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%normalize_64d8c0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Normalize %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %normalize_64d8c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %normalize_64d8c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %normalize_64d8c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e73ed0275 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/64d8c0.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn normalize_64d8c0() { + var res : vec3 = normalize(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_64d8c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_64d8c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_64d8c0(); +} diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl new file mode 100644 index 0000000000..8b3c478526 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<2, f16>) -> vec<2, f16> +fn normalize_7990f3() { + var res: vec2 = normalize(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_7990f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_7990f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_7990f3(); +} diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b0e04e189a --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void normalize_7990f3() { + vector res = normalize((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_7990f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_7990f3(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52cbb8babf --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void normalize_7990f3() { + vector res = normalize((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_7990f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_7990f3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E10FCEEA50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.glsl new file mode 100644 index 0000000000..f59eb6dbb2 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_7990f3() { + f16vec2 res = normalize(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + normalize_7990f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_7990f3() { + f16vec2 res = normalize(f16vec2(0.0hf)); +} + +void fragment_main() { + normalize_7990f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_7990f3() { + f16vec2 res = normalize(f16vec2(0.0hf)); +} + +void compute_main() { + normalize_7990f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.msl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.msl new file mode 100644 index 0000000000..bea065fc45 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void normalize_7990f3() { + half2 res = normalize(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_7990f3(); + return; +} + +kernel void compute_main() { + normalize_7990f3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..d00d9f3f26 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_7990f3 "normalize_7990f3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_7990f3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Normalize %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %normalize_7990f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %normalize_7990f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %normalize_7990f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce0b29f2ef --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/7990f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn normalize_7990f3() { + var res : vec2 = normalize(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_7990f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_7990f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_7990f3(); +} diff --git a/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl new file mode 100644 index 0000000000..7c6d61ffcb --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn normalize(vec<4, f32>) -> vec<4, f32> +fn normalize_9a0aab() { + var res: vec4 = normalize(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_9a0aab(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_9a0aab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_9a0aab(); +} diff --git a/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c50afa0bc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void normalize_9a0aab() { + float4 res = normalize((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_9a0aab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_9a0aab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_9a0aab(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c50afa0bc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void normalize_9a0aab() { + float4 res = normalize((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_9a0aab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_9a0aab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_9a0aab(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.glsl b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.glsl new file mode 100644 index 0000000000..2e9a75d3eb --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void normalize_9a0aab() { + vec4 res = normalize(vec4(1.0f)); +} + +vec4 vertex_main() { + normalize_9a0aab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void normalize_9a0aab() { + vec4 res = normalize(vec4(1.0f)); +} + +void fragment_main() { + normalize_9a0aab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void normalize_9a0aab() { + vec4 res = normalize(vec4(1.0f)); +} + +void compute_main() { + normalize_9a0aab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.msl b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.msl new file mode 100644 index 0000000000..c30ba2846f --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void normalize_9a0aab() { + float4 res = normalize(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_9a0aab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_9a0aab(); + return; +} + +kernel void compute_main() { + normalize_9a0aab(); + return; +} + diff --git a/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.spvasm new file mode 100644 index 0000000000..65d4b55273 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_9a0aab "normalize_9a0aab" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%normalize_9a0aab = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Normalize %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %normalize_9a0aab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %normalize_9a0aab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %normalize_9a0aab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.wgsl new file mode 100644 index 0000000000..336e47dd51 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/9a0aab.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn normalize_9a0aab() { + var res : vec4 = normalize(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_9a0aab(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_9a0aab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_9a0aab(); +} diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl new file mode 100644 index 0000000000..81f49c1d66 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<4, f16>) -> vec<4, f16> +fn normalize_b8cb8d() { + var res: vec4 = normalize(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_b8cb8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_b8cb8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_b8cb8d(); +} diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..24ac211c15 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void normalize_b8cb8d() { + vector res = normalize((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_b8cb8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_b8cb8d(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3eafadc5b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void normalize_b8cb8d() { + vector res = normalize((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_b8cb8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_b8cb8d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027C766AD380(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.glsl new file mode 100644 index 0000000000..897b4f936c --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_b8cb8d() { + f16vec4 res = normalize(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + normalize_b8cb8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_b8cb8d() { + f16vec4 res = normalize(f16vec4(0.0hf)); +} + +void fragment_main() { + normalize_b8cb8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_b8cb8d() { + f16vec4 res = normalize(f16vec4(0.0hf)); +} + +void compute_main() { + normalize_b8cb8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.msl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.msl new file mode 100644 index 0000000000..4481b97c17 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void normalize_b8cb8d() { + half4 res = normalize(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_b8cb8d(); + return; +} + +kernel void compute_main() { + normalize_b8cb8d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.spvasm new file mode 100644 index 0000000000..ce722dba27 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_b8cb8d "normalize_b8cb8d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_b8cb8d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Normalize %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %normalize_b8cb8d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %normalize_b8cb8d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %normalize_b8cb8d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..07214277df --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/b8cb8d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn normalize_b8cb8d() { + var res : vec4 = normalize(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_b8cb8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_b8cb8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_b8cb8d(); +} diff --git a/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl new file mode 100644 index 0000000000..acc47cae02 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn normalize(vec<2, f32>) -> vec<2, f32> +fn normalize_fc2ef1() { + var res: vec2 = normalize(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_fc2ef1(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_fc2ef1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_fc2ef1(); +} diff --git a/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5eadc79796 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void normalize_fc2ef1() { + float2 res = normalize((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_fc2ef1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_fc2ef1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_fc2ef1(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5eadc79796 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void normalize_fc2ef1() { + float2 res = normalize((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_fc2ef1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_fc2ef1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_fc2ef1(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.glsl new file mode 100644 index 0000000000..a3ae11e9a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void normalize_fc2ef1() { + vec2 res = normalize(vec2(1.0f)); +} + +vec4 vertex_main() { + normalize_fc2ef1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void normalize_fc2ef1() { + vec2 res = normalize(vec2(1.0f)); +} + +void fragment_main() { + normalize_fc2ef1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void normalize_fc2ef1() { + vec2 res = normalize(vec2(1.0f)); +} + +void compute_main() { + normalize_fc2ef1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.msl b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.msl new file mode 100644 index 0000000000..1c9820ba69 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void normalize_fc2ef1() { + float2 res = normalize(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_fc2ef1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_fc2ef1(); + return; +} + +kernel void compute_main() { + normalize_fc2ef1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.spvasm new file mode 100644 index 0000000000..1eb6f881f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_fc2ef1 "normalize_fc2ef1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%normalize_fc2ef1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Normalize %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %normalize_fc2ef1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %normalize_fc2ef1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %normalize_fc2ef1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef05b2590c --- /dev/null +++ b/test/tint/builtins/gen/literal/normalize/fc2ef1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn normalize_fc2ef1() { + var res : vec2 = normalize(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_fc2ef1(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_fc2ef1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_fc2ef1(); +} diff --git a/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl new file mode 100644 index 0000000000..2b0e8d9a02 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack2x16float(vec2) -> u32 +fn pack2x16float_0e97b3() { + var res: u32 = pack2x16float(vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16float_0e97b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16float_0e97b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16float_0e97b3(); +} diff --git a/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f142fb8a90 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack2x16float(float2 param_0) { + uint2 i = f32tof16(param_0); + return i.x | (i.y << 16); +} + +void pack2x16float_0e97b3() { + uint res = tint_pack2x16float((0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16float_0e97b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16float_0e97b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16float_0e97b3(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f142fb8a90 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack2x16float(float2 param_0) { + uint2 i = f32tof16(param_0); + return i.x | (i.y << 16); +} + +void pack2x16float_0e97b3() { + uint res = tint_pack2x16float((0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16float_0e97b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16float_0e97b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16float_0e97b3(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.glsl new file mode 100644 index 0000000000..bedec1581a --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void pack2x16float_0e97b3() { + uint res = packHalf2x16(vec2(0.0f)); +} + +vec4 vertex_main() { + pack2x16float_0e97b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack2x16float_0e97b3() { + uint res = packHalf2x16(vec2(0.0f)); +} + +void fragment_main() { + pack2x16float_0e97b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack2x16float_0e97b3() { + uint res = packHalf2x16(vec2(0.0f)); +} + +void compute_main() { + pack2x16float_0e97b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.msl b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.msl new file mode 100644 index 0000000000..d3c14f8965 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pack2x16float_0e97b3() { + uint res = as_type(half2(float2(0.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack2x16float_0e97b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack2x16float_0e97b3(); + return; +} + +kernel void compute_main() { + pack2x16float_0e97b3(); + return; +} + diff --git a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..fca0987f93 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16float/0e97b3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn pack2x16float_0e97b3() { + var res : u32 = pack2x16float(vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16float_0e97b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16float_0e97b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16float_0e97b3(); +} diff --git a/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl new file mode 100644 index 0000000000..ba71668dc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack2x16snorm(vec2) -> u32 +fn pack2x16snorm_6c169b() { + var res: u32 = pack2x16snorm(vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16snorm_6c169b(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16snorm_6c169b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16snorm_6c169b(); +} diff --git a/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cb5ec976da --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack2x16snorm(float2 param_0) { + int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff; + return asuint(i.x | i.y << 16); +} + +void pack2x16snorm_6c169b() { + uint res = tint_pack2x16snorm((0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16snorm_6c169b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16snorm_6c169b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16snorm_6c169b(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cb5ec976da --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack2x16snorm(float2 param_0) { + int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff; + return asuint(i.x | i.y << 16); +} + +void pack2x16snorm_6c169b() { + uint res = tint_pack2x16snorm((0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16snorm_6c169b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16snorm_6c169b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16snorm_6c169b(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.glsl new file mode 100644 index 0000000000..489de9709c --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void pack2x16snorm_6c169b() { + uint res = packSnorm2x16(vec2(0.0f)); +} + +vec4 vertex_main() { + pack2x16snorm_6c169b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack2x16snorm_6c169b() { + uint res = packSnorm2x16(vec2(0.0f)); +} + +void fragment_main() { + pack2x16snorm_6c169b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack2x16snorm_6c169b() { + uint res = packSnorm2x16(vec2(0.0f)); +} + +void compute_main() { + pack2x16snorm_6c169b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.msl b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.msl new file mode 100644 index 0000000000..7c11475f4b --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pack2x16snorm_6c169b() { + uint res = pack_float_to_snorm2x16(float2(0.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack2x16snorm_6c169b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack2x16snorm_6c169b(); + return; +} + +kernel void compute_main() { + pack2x16snorm_6c169b(); + return; +} + diff --git a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d9fafc4e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16snorm/6c169b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn pack2x16snorm_6c169b() { + var res : u32 = pack2x16snorm(vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16snorm_6c169b(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16snorm_6c169b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16snorm_6c169b(); +} diff --git a/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl new file mode 100644 index 0000000000..6a1bb6ae77 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack2x16unorm(vec2) -> u32 +fn pack2x16unorm_0f08e4() { + var res: u32 = pack2x16unorm(vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16unorm_0f08e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16unorm_0f08e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16unorm_0f08e4(); +} diff --git a/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..69b0a5f1d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack2x16unorm(float2 param_0) { + uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0)); + return (i.x | i.y << 16); +} + +void pack2x16unorm_0f08e4() { + uint res = tint_pack2x16unorm((0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16unorm_0f08e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16unorm_0f08e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16unorm_0f08e4(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..69b0a5f1d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack2x16unorm(float2 param_0) { + uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0)); + return (i.x | i.y << 16); +} + +void pack2x16unorm_0f08e4() { + uint res = tint_pack2x16unorm((0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16unorm_0f08e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16unorm_0f08e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16unorm_0f08e4(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.glsl new file mode 100644 index 0000000000..ee5df00c16 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void pack2x16unorm_0f08e4() { + uint res = packUnorm2x16(vec2(0.0f)); +} + +vec4 vertex_main() { + pack2x16unorm_0f08e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack2x16unorm_0f08e4() { + uint res = packUnorm2x16(vec2(0.0f)); +} + +void fragment_main() { + pack2x16unorm_0f08e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack2x16unorm_0f08e4() { + uint res = packUnorm2x16(vec2(0.0f)); +} + +void compute_main() { + pack2x16unorm_0f08e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.msl b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.msl new file mode 100644 index 0000000000..5661b9829f --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pack2x16unorm_0f08e4() { + uint res = pack_float_to_unorm2x16(float2(0.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack2x16unorm_0f08e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack2x16unorm_0f08e4(); + return; +} + +kernel void compute_main() { + pack2x16unorm_0f08e4(); + return; +} + diff --git a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ddd089276 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack2x16unorm/0f08e4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn pack2x16unorm_0f08e4() { + var res : u32 = pack2x16unorm(vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16unorm_0f08e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16unorm_0f08e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16unorm_0f08e4(); +} diff --git a/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl new file mode 100644 index 0000000000..11e2e1fc08 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack4x8snorm(vec4) -> u32 +fn pack4x8snorm_4d22e7() { + var res: u32 = pack4x8snorm(vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack4x8snorm_4d22e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack4x8snorm_4d22e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack4x8snorm_4d22e7(); +} diff --git a/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..073431c94a --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack4x8snorm(float4 param_0) { + int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff; + return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8snorm_4d22e7() { + uint res = tint_pack4x8snorm((0.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8snorm_4d22e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8snorm_4d22e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8snorm_4d22e7(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..073431c94a --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack4x8snorm(float4 param_0) { + int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff; + return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8snorm_4d22e7() { + uint res = tint_pack4x8snorm((0.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8snorm_4d22e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8snorm_4d22e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8snorm_4d22e7(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.glsl new file mode 100644 index 0000000000..a61b9cbed1 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void pack4x8snorm_4d22e7() { + uint res = packSnorm4x8(vec4(0.0f)); +} + +vec4 vertex_main() { + pack4x8snorm_4d22e7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack4x8snorm_4d22e7() { + uint res = packSnorm4x8(vec4(0.0f)); +} + +void fragment_main() { + pack4x8snorm_4d22e7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack4x8snorm_4d22e7() { + uint res = packSnorm4x8(vec4(0.0f)); +} + +void compute_main() { + pack4x8snorm_4d22e7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.msl b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.msl new file mode 100644 index 0000000000..5af9d4b544 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pack4x8snorm_4d22e7() { + uint res = pack_float_to_snorm4x8(float4(0.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack4x8snorm_4d22e7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack4x8snorm_4d22e7(); + return; +} + +kernel void compute_main() { + pack4x8snorm_4d22e7(); + return; +} + diff --git a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb4d5a2e8f --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8snorm/4d22e7.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn pack4x8snorm_4d22e7() { + var res : u32 = pack4x8snorm(vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack4x8snorm_4d22e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack4x8snorm_4d22e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack4x8snorm_4d22e7(); +} diff --git a/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl new file mode 100644 index 0000000000..ed9074ab3d --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack4x8unorm(vec4) -> u32 +fn pack4x8unorm_95c456() { + var res: u32 = pack4x8unorm(vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack4x8unorm_95c456(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack4x8unorm_95c456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack4x8unorm_95c456(); +} diff --git a/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a4e6e76756 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack4x8unorm(float4 param_0) { + uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); + return (i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8unorm_95c456() { + uint res = tint_pack4x8unorm((0.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8unorm_95c456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8unorm_95c456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8unorm_95c456(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a4e6e76756 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +uint tint_pack4x8unorm(float4 param_0) { + uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); + return (i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8unorm_95c456() { + uint res = tint_pack4x8unorm((0.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8unorm_95c456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8unorm_95c456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8unorm_95c456(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.glsl new file mode 100644 index 0000000000..29d5585a43 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void pack4x8unorm_95c456() { + uint res = packUnorm4x8(vec4(0.0f)); +} + +vec4 vertex_main() { + pack4x8unorm_95c456(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack4x8unorm_95c456() { + uint res = packUnorm4x8(vec4(0.0f)); +} + +void fragment_main() { + pack4x8unorm_95c456(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack4x8unorm_95c456() { + uint res = packUnorm4x8(vec4(0.0f)); +} + +void compute_main() { + pack4x8unorm_95c456(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.msl b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.msl new file mode 100644 index 0000000000..be93a802ed --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pack4x8unorm_95c456() { + uint res = pack_float_to_unorm4x8(float4(0.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack4x8unorm_95c456(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack4x8unorm_95c456(); + return; +} + +kernel void compute_main() { + pack4x8unorm_95c456(); + return; +} + diff --git a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.wgsl new file mode 100644 index 0000000000..1aca6f3027 --- /dev/null +++ b/test/tint/builtins/gen/literal/pack4x8unorm/95c456.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn pack4x8unorm_95c456() { + var res : u32 = pack4x8unorm(vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack4x8unorm_95c456(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack4x8unorm_95c456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack4x8unorm_95c456(); +} diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl b/test/tint/builtins/gen/literal/pow/04a908.wgsl new file mode 100644 index 0000000000..a1e91aabc0 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn pow_04a908() { + var res: vec4 = pow(vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_04a908(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_04a908(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_04a908(); +} diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7006eef600 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_04a908() { + float4 res = pow((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_04a908(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_04a908(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_04a908(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7006eef600 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void pow_04a908() { + float4 res = pow((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_04a908(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_04a908(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_04a908(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.glsl new file mode 100644 index 0000000000..dc7e2f6e84 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void pow_04a908() { + vec4 res = pow(vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + pow_04a908(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_04a908() { + vec4 res = pow(vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + pow_04a908(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_04a908() { + vec4 res = pow(vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + pow_04a908(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.msl new file mode 100644 index 0000000000..647e665fca --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_04a908() { + float4 res = pow(float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_04a908(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_04a908(); + return; +} + +kernel void compute_main() { + pow_04a908(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.spvasm new file mode 100644 index 0000000000..614ed9b1c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_04a908 "pow_04a908" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %pow_04a908 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Pow %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %pow_04a908 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %pow_04a908 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %pow_04a908 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.wgsl new file mode 100644 index 0000000000..a89bbf4cb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn pow_04a908() { + var res : vec4 = pow(vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_04a908(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_04a908(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_04a908(); +} diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl b/test/tint/builtins/gen/literal/pow/46e029.wgsl new file mode 100644 index 0000000000..c87906aadf --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(f32, f32) -> f32 +fn pow_46e029() { + var res: f32 = pow(1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_46e029(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_46e029(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_46e029(); +} diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e7864f33c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_46e029() { + float res = pow(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_46e029(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_46e029(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_46e029(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e7864f33c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void pow_46e029() { + float res = pow(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_46e029(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_46e029(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_46e029(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.glsl new file mode 100644 index 0000000000..4e3a1e9f82 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void pow_46e029() { + float res = pow(1.0f, 1.0f); +} + +vec4 vertex_main() { + pow_46e029(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_46e029() { + float res = pow(1.0f, 1.0f); +} + +void fragment_main() { + pow_46e029(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_46e029() { + float res = pow(1.0f, 1.0f); +} + +void compute_main() { + pow_46e029(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.msl new file mode 100644 index 0000000000..bd126032d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_46e029() { + float res = pow(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_46e029(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_46e029(); + return; +} + +kernel void compute_main() { + pow_46e029(); + return; +} + diff --git a/test/tint/builtins/gen/pow/46e029.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/pow/46e029.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.wgsl new file mode 100644 index 0000000000..892a9aedce --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn pow_46e029() { + var res : f32 = pow(1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_46e029(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_46e029(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_46e029(); +} diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl new file mode 100644 index 0000000000..8320290d23 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn pow_4a46c9() { + var res: vec3 = pow(vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4a46c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4a46c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4a46c9(); +} diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..282199079e --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_4a46c9() { + float3 res = pow((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4a46c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4a46c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4a46c9(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..282199079e --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void pow_4a46c9() { + float3 res = pow((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4a46c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4a46c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4a46c9(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.glsl new file mode 100644 index 0000000000..36ad96855b --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void pow_4a46c9() { + vec3 res = pow(vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + pow_4a46c9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_4a46c9() { + vec3 res = pow(vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + pow_4a46c9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_4a46c9() { + vec3 res = pow(vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + pow_4a46c9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.msl new file mode 100644 index 0000000000..e0fa00c674 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_4a46c9() { + float3 res = pow(float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_4a46c9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_4a46c9(); + return; +} + +kernel void compute_main() { + pow_4a46c9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.spvasm new file mode 100644 index 0000000000..01a3076e98 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_4a46c9 "pow_4a46c9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %pow_4a46c9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Pow %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %pow_4a46c9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %pow_4a46c9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_4a46c9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.wgsl new file mode 100644 index 0000000000..c28a6115b0 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn pow_4a46c9() { + var res : vec3 = pow(vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4a46c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4a46c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4a46c9(); +} diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl new file mode 100644 index 0000000000..58ab00c606 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn pow_4f33b2() { + var res: vec4 = pow(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4f33b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4f33b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4f33b2(); +} diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..28040580a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_4f33b2() { + vector res = pow((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4f33b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4f33b2(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bca42d2356 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void pow_4f33b2() { + vector res = pow((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4f33b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4f33b2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027797C56270(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl new file mode 100644 index 0000000000..cec05e4dc2 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_4f33b2() { + f16vec4 res = pow(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + pow_4f33b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_4f33b2() { + f16vec4 res = pow(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + pow_4f33b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_4f33b2() { + f16vec4 res = pow(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + pow_4f33b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl new file mode 100644 index 0000000000..abc7e9e73c --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_4f33b2() { + half4 res = pow(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_4f33b2(); + return; +} + +kernel void compute_main() { + pow_4f33b2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..669759df1f --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_4f33b2 "pow_4f33b2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_4f33b2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Pow %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %pow_4f33b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %pow_4f33b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_4f33b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb9db59bfc --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn pow_4f33b2() { + var res : vec4 = pow(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4f33b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4f33b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4f33b2(); +} diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl new file mode 100644 index 0000000000..c9a6522cdf --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(f16, f16) -> f16 +fn pow_ce9ef5() { + var res: f16 = pow(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_ce9ef5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_ce9ef5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_ce9ef5(); +} diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f9e7123a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_ce9ef5() { + float16_t res = pow(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_ce9ef5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_ce9ef5(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a10ed77984 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void pow_ce9ef5() { + float16_t res = pow(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_ce9ef5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_ce9ef5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022B8A05C140(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022B8A05C140(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl new file mode 100644 index 0000000000..23f08dbe3d --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_ce9ef5() { + float16_t res = pow(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + pow_ce9ef5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_ce9ef5() { + float16_t res = pow(0.0hf, 0.0hf); +} + +void fragment_main() { + pow_ce9ef5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_ce9ef5() { + float16_t res = pow(0.0hf, 0.0hf); +} + +void compute_main() { + pow_ce9ef5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl new file mode 100644 index 0000000000..9346414b9a --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_ce9ef5() { + half res = pow(0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_ce9ef5(); + return; +} + +kernel void compute_main() { + pow_ce9ef5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.spvasm new file mode 100644 index 0000000000..219cfcfeed --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_ce9ef5 "pow_ce9ef5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_ce9ef5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Pow %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %pow_ce9ef5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %pow_ce9ef5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %pow_ce9ef5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc2c9c4e13 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn pow_ce9ef5() { + var res : f16 = pow(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_ce9ef5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_ce9ef5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_ce9ef5(); +} diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl new file mode 100644 index 0000000000..1b880fbe40 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn pow_e60ea5() { + var res: vec2 = pow(vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_e60ea5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_e60ea5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_e60ea5(); +} diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1a7b88c2cd --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_e60ea5() { + float2 res = pow((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_e60ea5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_e60ea5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_e60ea5(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1a7b88c2cd --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void pow_e60ea5() { + float2 res = pow((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_e60ea5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_e60ea5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_e60ea5(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.glsl new file mode 100644 index 0000000000..ede9a15093 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void pow_e60ea5() { + vec2 res = pow(vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + pow_e60ea5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_e60ea5() { + vec2 res = pow(vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + pow_e60ea5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_e60ea5() { + vec2 res = pow(vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + pow_e60ea5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.msl new file mode 100644 index 0000000000..5a964bad28 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_e60ea5() { + float2 res = pow(float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_e60ea5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_e60ea5(); + return; +} + +kernel void compute_main() { + pow_e60ea5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.spvasm new file mode 100644 index 0000000000..17d1989a1e --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_e60ea5 "pow_e60ea5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %pow_e60ea5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Pow %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %pow_e60ea5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %pow_e60ea5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_e60ea5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.wgsl new file mode 100644 index 0000000000..f1d54b0356 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn pow_e60ea5() { + var res : vec2 = pow(vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_e60ea5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_e60ea5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_e60ea5(); +} diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl new file mode 100644 index 0000000000..b63e93e75e --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn pow_f37b25() { + var res: vec2 = pow(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_f37b25(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_f37b25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_f37b25(); +} diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8efda2bd3a --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_f37b25() { + vector res = pow((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_f37b25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_f37b25(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa7eaa6255 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void pow_f37b25() { + vector res = pow((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_f37b25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_f37b25(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE95DF6780(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl new file mode 100644 index 0000000000..ac933cbbcc --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_f37b25() { + f16vec2 res = pow(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + pow_f37b25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_f37b25() { + f16vec2 res = pow(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + pow_f37b25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_f37b25() { + f16vec2 res = pow(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + pow_f37b25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl new file mode 100644 index 0000000000..3962dd1e78 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_f37b25() { + half2 res = pow(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_f37b25(); + return; +} + +kernel void compute_main() { + pow_f37b25(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.spvasm new file mode 100644 index 0000000000..53e3689a54 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_f37b25 "pow_f37b25" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_f37b25 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Pow %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %pow_f37b25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %pow_f37b25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_f37b25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.wgsl new file mode 100644 index 0000000000..96ff2a23ff --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn pow_f37b25() { + var res : vec2 = pow(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_f37b25(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_f37b25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_f37b25(); +} diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl new file mode 100644 index 0000000000..51ecff311c --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn pow_fa5429() { + var res: vec3 = pow(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_fa5429(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_fa5429(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_fa5429(); +} diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc999c6261 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void pow_fa5429() { + vector res = pow((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_fa5429(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_fa5429(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cae49c55fe --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void pow_fa5429() { + vector res = pow((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_fa5429(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_fa5429(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028F07286290(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl new file mode 100644 index 0000000000..113b3ab6c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_fa5429() { + f16vec3 res = pow(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + pow_fa5429(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_fa5429() { + f16vec3 res = pow(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + pow_fa5429(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_fa5429() { + f16vec3 res = pow(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + pow_fa5429(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl new file mode 100644 index 0000000000..249c3f3f42 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void pow_fa5429() { + half3 res = pow(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_fa5429(); + return; +} + +kernel void compute_main() { + pow_fa5429(); + return; +} + diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc20475f25 --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_fa5429 "pow_fa5429" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_fa5429 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Pow %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %pow_fa5429 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %pow_fa5429 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_fa5429 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.wgsl new file mode 100644 index 0000000000..46002ea14b --- /dev/null +++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn pow_fa5429() { + var res : vec3 = pow(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_fa5429(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_fa5429(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_fa5429(); +} diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl new file mode 100644 index 0000000000..4b214c14b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(vec<4, f32>) -> vec<4, f32> +fn radians_09b7fc() { + var res: vec4 = radians(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_09b7fc(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_09b7fc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_09b7fc(); +} diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d1adfed065 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_radians(float4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_09b7fc() { + float4 res = tint_radians((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_09b7fc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_09b7fc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_09b7fc(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d1adfed065 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float4 tint_radians(float4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_09b7fc() { + float4 res = tint_radians((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_09b7fc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_09b7fc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_09b7fc(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.glsl new file mode 100644 index 0000000000..a0c4475a17 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec4 tint_radians(vec4 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_09b7fc() { + vec4 res = tint_radians(vec4(1.0f)); +} + +vec4 vertex_main() { + radians_09b7fc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_radians(vec4 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_09b7fc() { + vec4 res = tint_radians(vec4(1.0f)); +} + +void fragment_main() { + radians_09b7fc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_radians(vec4 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_09b7fc() { + vec4 res = tint_radians(vec4(1.0f)); +} + +void compute_main() { + radians_09b7fc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.msl new file mode 100644 index 0000000000..59ac3a3080 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +float4 tint_radians(float4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_09b7fc() { + float4 res = tint_radians(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_09b7fc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_09b7fc(); + return; +} + +kernel void compute_main() { + radians_09b7fc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.spvasm new file mode 100644 index 0000000000..ddeea5d5e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_09b7fc "radians_09b7fc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%radians_09b7fc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Radians %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %radians_09b7fc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %radians_09b7fc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %radians_09b7fc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.wgsl new file mode 100644 index 0000000000..76a6cc838e --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn radians_09b7fc() { + var res : vec4 = radians(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_09b7fc(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_09b7fc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_09b7fc(); +} diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl new file mode 100644 index 0000000000..c60793b14d --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(f16) -> f16 +fn radians_208fd9() { + var res: f16 = radians(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_208fd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_208fd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_208fd9(); +} diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b7b76cd22a --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + float16_t res = tint_radians(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_208fd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_208fd9(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d1aeacee8c --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + float16_t res = tint_radians(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_208fd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_208fd9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B5647B0440(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl new file mode 100644 index 0000000000..cf4c962810 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t res = tint_radians(0.0hf); +} + +vec4 vertex_main() { + radians_208fd9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t res = tint_radians(0.0hf); +} + +void fragment_main() { + radians_208fd9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t res = tint_radians(0.0hf); +} + +void compute_main() { + radians_208fd9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl new file mode 100644 index 0000000000..d12b406a14 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half tint_radians(half param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + half res = tint_radians(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_208fd9(); + return; +} + +kernel void compute_main() { + radians_208fd9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fc9e39929 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_208fd9 "radians_208fd9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_208fd9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Radians %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %radians_208fd9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %radians_208fd9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_208fd9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.wgsl new file mode 100644 index 0000000000..1febb6ea6f --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn radians_208fd9() { + var res : f16 = radians(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_208fd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_208fd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_208fd9(); +} diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl new file mode 100644 index 0000000000..a7887fb257 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<4, f16>) -> vec<4, f16> +fn radians_44f20b() { + var res: vec4 = radians(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_44f20b(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_44f20b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_44f20b(); +} diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6c3cce992b --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + vector res = tint_radians((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_44f20b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_44f20b(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac64196fd4 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + vector res = tint_radians((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_44f20b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_44f20b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024C9C3BC350(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl new file mode 100644 index 0000000000..2b3d4c7660 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 res = tint_radians(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + radians_44f20b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 res = tint_radians(f16vec4(0.0hf)); +} + +void fragment_main() { + radians_44f20b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 res = tint_radians(f16vec4(0.0hf)); +} + +void compute_main() { + radians_44f20b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl new file mode 100644 index 0000000000..1e20066dfe --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half4 tint_radians(half4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + half4 res = tint_radians(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_44f20b(); + return; +} + +kernel void compute_main() { + radians_44f20b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm new file mode 100644 index 0000000000..6321aaa71e --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_44f20b "radians_44f20b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_44f20b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Radians %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %radians_44f20b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %radians_44f20b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %radians_44f20b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.wgsl new file mode 100644 index 0000000000..35170cc4fc --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn radians_44f20b() { + var res : vec4 = radians(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_44f20b(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_44f20b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_44f20b(); +} diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl b/test/tint/builtins/gen/literal/radians/61687a.wgsl new file mode 100644 index 0000000000..5491a0db4a --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(vec<2, f32>) -> vec<2, f32> +fn radians_61687a() { + var res: vec2 = radians(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_61687a(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_61687a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_61687a(); +} diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66fd0bb9c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_radians(float2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_61687a() { + float2 res = tint_radians((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_61687a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_61687a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_61687a(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66fd0bb9c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float2 tint_radians(float2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_61687a() { + float2 res = tint_radians((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_61687a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_61687a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_61687a(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.glsl new file mode 100644 index 0000000000..0810866c4b --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec2 tint_radians(vec2 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_61687a() { + vec2 res = tint_radians(vec2(1.0f)); +} + +vec4 vertex_main() { + radians_61687a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_radians(vec2 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_61687a() { + vec2 res = tint_radians(vec2(1.0f)); +} + +void fragment_main() { + radians_61687a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_radians(vec2 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_61687a() { + vec2 res = tint_radians(vec2(1.0f)); +} + +void compute_main() { + radians_61687a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.msl new file mode 100644 index 0000000000..2ce18610d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +float2 tint_radians(float2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_61687a() { + float2 res = tint_radians(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_61687a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_61687a(); + return; +} + +kernel void compute_main() { + radians_61687a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9e7307a66 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_61687a "radians_61687a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%radians_61687a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Radians %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %radians_61687a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %radians_61687a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %radians_61687a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5fe5018f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn radians_61687a() { + var res : vec2 = radians(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_61687a(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_61687a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_61687a(); +} diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl new file mode 100644 index 0000000000..1d0d7c8ee6 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(f32) -> f32 +fn radians_6b0ff2() { + var res: f32 = radians(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_6b0ff2(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_6b0ff2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_6b0ff2(); +} diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9d7e818182 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_6b0ff2() { + float res = tint_radians(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_6b0ff2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_6b0ff2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_6b0ff2(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9d7e818182 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_6b0ff2() { + float res = tint_radians(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_6b0ff2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_6b0ff2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_6b0ff2(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.glsl new file mode 100644 index 0000000000..b279215589 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_6b0ff2() { + float res = tint_radians(1.0f); +} + +vec4 vertex_main() { + radians_6b0ff2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_6b0ff2() { + float res = tint_radians(1.0f); +} + +void fragment_main() { + radians_6b0ff2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_6b0ff2() { + float res = tint_radians(1.0f); +} + +void compute_main() { + radians_6b0ff2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.msl new file mode 100644 index 0000000000..074b46d1ae --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_6b0ff2() { + float res = tint_radians(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_6b0ff2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_6b0ff2(); + return; +} + +kernel void compute_main() { + radians_6b0ff2(); + return; +} + diff --git a/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e5f986a25 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn radians_6b0ff2() { + var res : f32 = radians(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_6b0ff2(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_6b0ff2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_6b0ff2(); +} diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl new file mode 100644 index 0000000000..4e2a23c574 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<3, f16>) -> vec<3, f16> +fn radians_7ea4c7() { + var res: vec3 = radians(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_7ea4c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_7ea4c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_7ea4c7(); +} diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a9f6f96235 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + vector res = tint_radians((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_7ea4c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_7ea4c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a13fc22ca --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + vector res = tint_radians((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_7ea4c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_7ea4c7(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C0F82EE760(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl new file mode 100644 index 0000000000..a8cc9ab526 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 res = tint_radians(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + radians_7ea4c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 res = tint_radians(f16vec3(0.0hf)); +} + +void fragment_main() { + radians_7ea4c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 res = tint_radians(f16vec3(0.0hf)); +} + +void compute_main() { + radians_7ea4c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl new file mode 100644 index 0000000000..34ca856153 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half3 tint_radians(half3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + half3 res = tint_radians(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_7ea4c7(); + return; +} + +kernel void compute_main() { + radians_7ea4c7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..9ef7401389 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_7ea4c7 "radians_7ea4c7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_7ea4c7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Radians %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %radians_7ea4c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %radians_7ea4c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %radians_7ea4c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..56b01aa764 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn radians_7ea4c7() { + var res : vec3 = radians(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_7ea4c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_7ea4c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_7ea4c7(); +} diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl b/test/tint/builtins/gen/literal/radians/f96258.wgsl new file mode 100644 index 0000000000..bb65233072 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(vec<3, f32>) -> vec<3, f32> +fn radians_f96258() { + var res: vec3 = radians(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_f96258(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_f96258(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_f96258(); +} diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3ca2a8046e --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_radians(float3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_f96258() { + float3 res = tint_radians((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_f96258(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_f96258(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_f96258(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ca2a8046e --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +float3 tint_radians(float3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_f96258() { + float3 res = tint_radians((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_f96258(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_f96258(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_f96258(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.glsl new file mode 100644 index 0000000000..aaab3fee08 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec3 tint_radians(vec3 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_f96258() { + vec3 res = tint_radians(vec3(1.0f)); +} + +vec4 vertex_main() { + radians_f96258(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_radians(vec3 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_f96258() { + vec3 res = tint_radians(vec3(1.0f)); +} + +void fragment_main() { + radians_f96258(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_radians(vec3 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_f96258() { + vec3 res = tint_radians(vec3(1.0f)); +} + +void compute_main() { + radians_f96258(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.msl new file mode 100644 index 0000000000..cae23f490b --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +float3 tint_radians(float3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_f96258() { + float3 res = tint_radians(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_f96258(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_f96258(); + return; +} + +kernel void compute_main() { + radians_f96258(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef337f4f81 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_f96258 "radians_f96258" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%radians_f96258 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Radians %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %radians_f96258 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %radians_f96258 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %radians_f96258 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0ea14efb9 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn radians_f96258() { + var res : vec3 = radians(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_f96258(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_f96258(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_f96258(); +} diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl new file mode 100644 index 0000000000..f3d4acbdfe --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<2, f16>) -> vec<2, f16> +fn radians_fbacf0() { + var res: vec2 = radians(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_fbacf0(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_fbacf0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_fbacf0(); +} diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8d3e076240 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + vector res = tint_radians((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_fbacf0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_fbacf0(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..880018add9 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + vector res = tint_radians((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_fbacf0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_fbacf0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028D5138C350(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl new file mode 100644 index 0000000000..ce24c39b8e --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 res = tint_radians(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + radians_fbacf0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 res = tint_radians(f16vec2(0.0hf)); +} + +void fragment_main() { + radians_fbacf0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 res = tint_radians(f16vec2(0.0hf)); +} + +void compute_main() { + radians_fbacf0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl new file mode 100644 index 0000000000..9359855280 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; + +half2 tint_radians(half2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + half2 res = tint_radians(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_fbacf0(); + return; +} + +kernel void compute_main() { + radians_fbacf0(); + return; +} + diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm new file mode 100644 index 0000000000..f798f519b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_fbacf0 "radians_fbacf0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_fbacf0 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Radians %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %radians_fbacf0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %radians_fbacf0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %radians_fbacf0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.wgsl new file mode 100644 index 0000000000..0aba9cc1af --- /dev/null +++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn radians_fbacf0() { + var res : vec2 = radians(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_fbacf0(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_fbacf0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_fbacf0(); +} diff --git a/test/tint/builtins/gen/literal/reflect/05357e.wgsl b/test/tint/builtins/gen/literal/reflect/05357e.wgsl new file mode 100644 index 0000000000..3cd54f1729 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/05357e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reflect(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn reflect_05357e() { + var res: vec4 = reflect(vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_05357e(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_05357e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_05357e(); +} diff --git a/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fd73a286ea --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reflect_05357e() { + float4 res = reflect((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_05357e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_05357e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_05357e(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fd73a286ea --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reflect_05357e() { + float4 res = reflect((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_05357e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_05357e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_05357e(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.glsl new file mode 100644 index 0000000000..3921ef5650 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reflect_05357e() { + vec4 res = reflect(vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + reflect_05357e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reflect_05357e() { + vec4 res = reflect(vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + reflect_05357e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reflect_05357e() { + vec4 res = reflect(vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + reflect_05357e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.msl b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.msl new file mode 100644 index 0000000000..6a895d1b03 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reflect_05357e() { + float4 res = reflect(float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_05357e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_05357e(); + return; +} + +kernel void compute_main() { + reflect_05357e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e975508d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_05357e "reflect_05357e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%reflect_05357e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Reflect %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %reflect_05357e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %reflect_05357e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reflect_05357e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.wgsl new file mode 100644 index 0000000000..d9da648e22 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/05357e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reflect_05357e() { + var res : vec4 = reflect(vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_05357e(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_05357e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_05357e(); +} diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl new file mode 100644 index 0000000000..9d8a01b5b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn reflect_310de5() { + var res: vec4 = reflect(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_310de5(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_310de5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_310de5(); +} diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4a7f8f4139 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reflect_310de5() { + vector res = reflect((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_310de5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_310de5(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4fb2cc9e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void reflect_310de5() { + vector res = reflect((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_310de5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_310de5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EFC20B7D70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.glsl new file mode 100644 index 0000000000..92a222f6e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_310de5() { + f16vec4 res = reflect(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + reflect_310de5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_310de5() { + f16vec4 res = reflect(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + reflect_310de5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_310de5() { + f16vec4 res = reflect(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + reflect_310de5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.msl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.msl new file mode 100644 index 0000000000..774dfb7f58 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reflect_310de5() { + half4 res = reflect(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_310de5(); + return; +} + +kernel void compute_main() { + reflect_310de5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.spvasm new file mode 100644 index 0000000000..e77a355b51 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_310de5 "reflect_310de5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_310de5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Reflect %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %reflect_310de5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %reflect_310de5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_310de5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.wgsl new file mode 100644 index 0000000000..61a2100238 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/310de5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn reflect_310de5() { + var res : vec4 = reflect(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_310de5(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_310de5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_310de5(); +} diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl new file mode 100644 index 0000000000..85df287a0e --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn reflect_61ca21() { + var res: vec3 = reflect(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_61ca21(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_61ca21(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_61ca21(); +} diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5a2f305300 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reflect_61ca21() { + vector res = reflect((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_61ca21(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_61ca21(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3e8b18048d --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void reflect_61ca21() { + vector res = reflect((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_61ca21(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_61ca21(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E16EDB83B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.glsl new file mode 100644 index 0000000000..c3b3b78b6a --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_61ca21() { + f16vec3 res = reflect(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + reflect_61ca21(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_61ca21() { + f16vec3 res = reflect(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + reflect_61ca21(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_61ca21() { + f16vec3 res = reflect(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + reflect_61ca21(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.msl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.msl new file mode 100644 index 0000000000..2bd9b84054 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reflect_61ca21() { + half3 res = reflect(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_61ca21(); + return; +} + +kernel void compute_main() { + reflect_61ca21(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.spvasm new file mode 100644 index 0000000000..10d9a3559e --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_61ca21 "reflect_61ca21" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_61ca21 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Reflect %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %reflect_61ca21 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %reflect_61ca21 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_61ca21 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.wgsl new file mode 100644 index 0000000000..a30006a585 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/61ca21.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn reflect_61ca21() { + var res : vec3 = reflect(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_61ca21(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_61ca21(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_61ca21(); +} diff --git a/test/tint/builtins/gen/literal/reflect/b61e10.wgsl b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl new file mode 100644 index 0000000000..e3840c027a --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reflect(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn reflect_b61e10() { + var res: vec2 = reflect(vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_b61e10(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_b61e10(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_b61e10(); +} diff --git a/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5762d11c15 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reflect_b61e10() { + float2 res = reflect((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_b61e10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_b61e10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_b61e10(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5762d11c15 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reflect_b61e10() { + float2 res = reflect((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_b61e10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_b61e10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_b61e10(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.glsl new file mode 100644 index 0000000000..83fb3a6988 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reflect_b61e10() { + vec2 res = reflect(vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + reflect_b61e10(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reflect_b61e10() { + vec2 res = reflect(vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + reflect_b61e10(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reflect_b61e10() { + vec2 res = reflect(vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + reflect_b61e10(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.msl b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.msl new file mode 100644 index 0000000000..2df9be572f --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reflect_b61e10() { + float2 res = reflect(float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_b61e10(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_b61e10(); + return; +} + +kernel void compute_main() { + reflect_b61e10(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.spvasm new file mode 100644 index 0000000000..6155906487 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_b61e10 "reflect_b61e10" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%reflect_b61e10 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Reflect %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reflect_b61e10 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %reflect_b61e10 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_b61e10 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.wgsl new file mode 100644 index 0000000000..c717a382d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/b61e10.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reflect_b61e10() { + var res : vec2 = reflect(vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_b61e10(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_b61e10(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_b61e10(); +} diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl new file mode 100644 index 0000000000..854ac7e391 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn reflect_bb15ac() { + var res: vec2 = reflect(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_bb15ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_bb15ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_bb15ac(); +} diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ec357faabd --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reflect_bb15ac() { + vector res = reflect((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_bb15ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_bb15ac(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..983ff2ab01 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void reflect_bb15ac() { + vector res = reflect((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_bb15ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_bb15ac(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E110B86630(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.glsl new file mode 100644 index 0000000000..6ea875d9b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_bb15ac() { + f16vec2 res = reflect(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + reflect_bb15ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_bb15ac() { + f16vec2 res = reflect(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + reflect_bb15ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_bb15ac() { + f16vec2 res = reflect(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + reflect_bb15ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.msl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.msl new file mode 100644 index 0000000000..5ade63c4ab --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reflect_bb15ac() { + half2 res = reflect(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_bb15ac(); + return; +} + +kernel void compute_main() { + reflect_bb15ac(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9e584e56f --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_bb15ac "reflect_bb15ac" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_bb15ac = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Reflect %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %reflect_bb15ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %reflect_bb15ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_bb15ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e50cf379e --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/bb15ac.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn reflect_bb15ac() { + var res : vec2 = reflect(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_bb15ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_bb15ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_bb15ac(); +} diff --git a/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl new file mode 100644 index 0000000000..ed6f558e52 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reflect(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn reflect_f47fdb() { + var res: vec3 = reflect(vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_f47fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_f47fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_f47fdb(); +} diff --git a/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a98a1fef23 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reflect_f47fdb() { + float3 res = reflect((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_f47fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_f47fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_f47fdb(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a98a1fef23 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reflect_f47fdb() { + float3 res = reflect((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_f47fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_f47fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_f47fdb(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.glsl new file mode 100644 index 0000000000..cdddcc02dc --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reflect_f47fdb() { + vec3 res = reflect(vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + reflect_f47fdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reflect_f47fdb() { + vec3 res = reflect(vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + reflect_f47fdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reflect_f47fdb() { + vec3 res = reflect(vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + reflect_f47fdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.msl b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.msl new file mode 100644 index 0000000000..36e3c60dde --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reflect_f47fdb() { + float3 res = reflect(float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_f47fdb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_f47fdb(); + return; +} + +kernel void compute_main() { + reflect_f47fdb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.spvasm new file mode 100644 index 0000000000..69731e22a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_f47fdb "reflect_f47fdb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%reflect_f47fdb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Reflect %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reflect_f47fdb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %reflect_f47fdb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reflect_f47fdb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..c9a13ea1a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/reflect/f47fdb.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reflect_f47fdb() { + var res : vec3 = reflect(vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_f47fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_f47fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_f47fdb(); +} diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl new file mode 100644 index 0000000000..5614a4ec2b --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<4, f16>, vec<4, f16>, f16) -> vec<4, f16> +fn refract_0594ba() { + var res: vec4 = refract(vec4(f16()), vec4(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_0594ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_0594ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_0594ba(); +} diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cdb4a1c5d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void refract_0594ba() { + vector res = refract((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_0594ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_0594ba(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..776bfd5cdf --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void refract_0594ba() { + vector res = refract((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_0594ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_0594ba(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B24EF980B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.glsl new file mode 100644 index 0000000000..dd0c411e87 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_0594ba() { + f16vec4 res = refract(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + refract_0594ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_0594ba() { + f16vec4 res = refract(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +void fragment_main() { + refract_0594ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_0594ba() { + f16vec4 res = refract(f16vec4(0.0hf), f16vec4(0.0hf), 0.0hf); +} + +void compute_main() { + refract_0594ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.msl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.msl new file mode 100644 index 0000000000..5bb163e2ba --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void refract_0594ba() { + half4 res = refract(half4(0.0h), half4(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_0594ba(); + return; +} + +kernel void compute_main() { + refract_0594ba(); + return; +} + diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d0cc45742 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_0594ba "refract_0594ba" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half + %18 = OpConstantNull %half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_0594ba = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Refract %17 %17 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %refract_0594ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_0594ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %refract_0594ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab78c7e94d --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/0594ba.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn refract_0594ba() { + var res : vec4 = refract(vec4(f16()), vec4(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_0594ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_0594ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_0594ba(); +} diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl new file mode 100644 index 0000000000..130e4492ad --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<2, f16>, vec<2, f16>, f16) -> vec<2, f16> +fn refract_570cb3() { + var res: vec2 = refract(vec2(f16()), vec2(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_570cb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_570cb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_570cb3(); +} diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f7f29d341 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void refract_570cb3() { + vector res = refract((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_570cb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_570cb3(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..10ae4be2c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void refract_570cb3() { + vector res = refract((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_570cb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_570cb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F32B087F20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.glsl new file mode 100644 index 0000000000..14fad7d88d --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_570cb3() { + f16vec2 res = refract(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + refract_570cb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_570cb3() { + f16vec2 res = refract(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +void fragment_main() { + refract_570cb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_570cb3() { + f16vec2 res = refract(f16vec2(0.0hf), f16vec2(0.0hf), 0.0hf); +} + +void compute_main() { + refract_570cb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.msl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.msl new file mode 100644 index 0000000000..da86c8c659 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void refract_570cb3() { + half2 res = refract(half2(0.0h), half2(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_570cb3(); + return; +} + +kernel void compute_main() { + refract_570cb3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..238e6f1e3a --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_570cb3 "refract_570cb3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half + %18 = OpConstantNull %half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_570cb3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Refract %17 %17 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %refract_570cb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_570cb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %refract_570cb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..45a3472273 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/570cb3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn refract_570cb3() { + var res : vec2 = refract(vec2(f16()), vec2(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_570cb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_570cb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_570cb3(); +} diff --git a/test/tint/builtins/gen/literal/refract/7e02e6.wgsl b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl new file mode 100644 index 0000000000..ddb5fb9f83 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn refract(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32> +fn refract_7e02e6() { + var res: vec4 = refract(vec4(1.f), vec4(1.f), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_7e02e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_7e02e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_7e02e6(); +} diff --git a/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d8c3de86a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void refract_7e02e6() { + float4 res = refract((1.0f).xxxx, (1.0f).xxxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_7e02e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_7e02e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_7e02e6(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d8c3de86a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void refract_7e02e6() { + float4 res = refract((1.0f).xxxx, (1.0f).xxxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_7e02e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_7e02e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_7e02e6(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.glsl new file mode 100644 index 0000000000..5c8bd1e747 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void refract_7e02e6() { + vec4 res = refract(vec4(1.0f), vec4(1.0f), 1.0f); +} + +vec4 vertex_main() { + refract_7e02e6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void refract_7e02e6() { + vec4 res = refract(vec4(1.0f), vec4(1.0f), 1.0f); +} + +void fragment_main() { + refract_7e02e6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void refract_7e02e6() { + vec4 res = refract(vec4(1.0f), vec4(1.0f), 1.0f); +} + +void compute_main() { + refract_7e02e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.msl b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.msl new file mode 100644 index 0000000000..a44d158caa --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void refract_7e02e6() { + float4 res = refract(float4(1.0f), float4(1.0f), 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_7e02e6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_7e02e6(); + return; +} + +kernel void compute_main() { + refract_7e02e6(); + return; +} + diff --git a/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..6cfa75a5d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_7e02e6 "refract_7e02e6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%refract_7e02e6 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Refract %16 %16 %float_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %refract_7e02e6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %refract_7e02e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_7e02e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..75f3851951 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/7e02e6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn refract_7e02e6() { + var res : vec4 = refract(vec4(1.0f), vec4(1.0f), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_7e02e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_7e02e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_7e02e6(); +} diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl new file mode 100644 index 0000000000..ccc6f61488 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<3, f16>, vec<3, f16>, f16) -> vec<3, f16> +fn refract_8984af() { + var res: vec3 = refract(vec3(f16()), vec3(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_8984af(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_8984af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_8984af(); +} diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..82aa4adaab --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void refract_8984af() { + vector res = refract((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_8984af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_8984af(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fd30a49b55 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void refract_8984af() { + vector res = refract((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_8984af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_8984af(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019FDBAB9D00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.glsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.glsl new file mode 100644 index 0000000000..cd538f62d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_8984af() { + f16vec3 res = refract(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +vec4 vertex_main() { + refract_8984af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_8984af() { + f16vec3 res = refract(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +void fragment_main() { + refract_8984af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_8984af() { + f16vec3 res = refract(f16vec3(0.0hf), f16vec3(0.0hf), 0.0hf); +} + +void compute_main() { + refract_8984af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.msl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.msl new file mode 100644 index 0000000000..54ca61d49b --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void refract_8984af() { + half3 res = refract(half3(0.0h), half3(0.0h), 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_8984af(); + return; +} + +kernel void compute_main() { + refract_8984af(); + return; +} + diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.spvasm new file mode 100644 index 0000000000..28804a8632 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_8984af "refract_8984af" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half + %18 = OpConstantNull %half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_8984af = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Refract %17 %17 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %refract_8984af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_8984af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %refract_8984af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ce7e19cbc --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/8984af.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn refract_8984af() { + var res : vec3 = refract(vec3(f16()), vec3(f16()), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_8984af(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_8984af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_8984af(); +} diff --git a/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl new file mode 100644 index 0000000000..452568be31 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn refract(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32> +fn refract_cbc1d2() { + var res: vec3 = refract(vec3(1.f), vec3(1.f), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_cbc1d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_cbc1d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_cbc1d2(); +} diff --git a/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0fa2f162aa --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void refract_cbc1d2() { + float3 res = refract((1.0f).xxx, (1.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cbc1d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cbc1d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cbc1d2(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0fa2f162aa --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void refract_cbc1d2() { + float3 res = refract((1.0f).xxx, (1.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cbc1d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cbc1d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cbc1d2(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.glsl new file mode 100644 index 0000000000..45dc14b8f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void refract_cbc1d2() { + vec3 res = refract(vec3(1.0f), vec3(1.0f), 1.0f); +} + +vec4 vertex_main() { + refract_cbc1d2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void refract_cbc1d2() { + vec3 res = refract(vec3(1.0f), vec3(1.0f), 1.0f); +} + +void fragment_main() { + refract_cbc1d2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void refract_cbc1d2() { + vec3 res = refract(vec3(1.0f), vec3(1.0f), 1.0f); +} + +void compute_main() { + refract_cbc1d2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.msl b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.msl new file mode 100644 index 0000000000..dbec949089 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void refract_cbc1d2() { + float3 res = refract(float3(1.0f), float3(1.0f), 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_cbc1d2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_cbc1d2(); + return; +} + +kernel void compute_main() { + refract_cbc1d2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.spvasm new file mode 100644 index 0000000000..5591003742 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_cbc1d2 "refract_cbc1d2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%refract_cbc1d2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Refract %17 %17 %float_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %refract_cbc1d2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %refract_cbc1d2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %refract_cbc1d2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c031e8921 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cbc1d2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn refract_cbc1d2() { + var res : vec3 = refract(vec3(1.0f), vec3(1.0f), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_cbc1d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_cbc1d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_cbc1d2(); +} diff --git a/test/tint/builtins/gen/literal/refract/cd905f.wgsl b/test/tint/builtins/gen/literal/refract/cd905f.wgsl new file mode 100644 index 0000000000..120223dbc7 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cd905f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn refract(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32> +fn refract_cd905f() { + var res: vec2 = refract(vec2(1.f), vec2(1.f), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_cd905f(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_cd905f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_cd905f(); +} diff --git a/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef5d9451dc --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void refract_cd905f() { + float2 res = refract((1.0f).xx, (1.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cd905f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cd905f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cd905f(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ef5d9451dc --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void refract_cd905f() { + float2 res = refract((1.0f).xx, (1.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cd905f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cd905f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cd905f(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.glsl new file mode 100644 index 0000000000..d0928e7590 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void refract_cd905f() { + vec2 res = refract(vec2(1.0f), vec2(1.0f), 1.0f); +} + +vec4 vertex_main() { + refract_cd905f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void refract_cd905f() { + vec2 res = refract(vec2(1.0f), vec2(1.0f), 1.0f); +} + +void fragment_main() { + refract_cd905f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void refract_cd905f() { + vec2 res = refract(vec2(1.0f), vec2(1.0f), 1.0f); +} + +void compute_main() { + refract_cd905f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.msl b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.msl new file mode 100644 index 0000000000..1ba00a8ddb --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void refract_cd905f() { + float2 res = refract(float2(1.0f), float2(1.0f), 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_cd905f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_cd905f(); + return; +} + +kernel void compute_main() { + refract_cd905f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a6516e697 --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_cd905f "refract_cd905f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%refract_cd905f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Refract %17 %17 %float_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %refract_cd905f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %refract_cd905f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %refract_cd905f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c7532befb --- /dev/null +++ b/test/tint/builtins/gen/literal/refract/cd905f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn refract_cd905f() { + var res : vec2 = refract(vec2(1.0f), vec2(1.0f), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_cd905f(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_cd905f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_cd905f(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl new file mode 100644 index 0000000000..96fa44594a --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<2, i32>) -> vec<2, i32> +fn reverseBits_222177() { + var res: vec2 = reverseBits(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_222177(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_222177(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_222177(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2ea66b6d08 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_222177() { + int2 res = asint(reversebits(asuint((1).xx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_222177(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_222177(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_222177(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ea66b6d08 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_222177() { + int2 res = asint(reversebits(asuint((1).xx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_222177(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_222177(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_222177(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.glsl new file mode 100644 index 0000000000..599d35ac8e --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reverseBits_222177() { + ivec2 res = bitfieldReverse(ivec2(1)); +} + +vec4 vertex_main() { + reverseBits_222177(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_222177() { + ivec2 res = bitfieldReverse(ivec2(1)); +} + +void fragment_main() { + reverseBits_222177(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_222177() { + ivec2 res = bitfieldReverse(ivec2(1)); +} + +void compute_main() { + reverseBits_222177(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.msl new file mode 100644 index 0000000000..a9283f6c7b --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reverseBits_222177() { + int2 res = reverse_bits(int2(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_222177(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_222177(); + return; +} + +kernel void compute_main() { + reverseBits_222177(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fe7741e33 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_222177 "reverseBits_222177" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %20 = OpConstantNull %v2int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_222177 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %20 + %13 = OpBitReverse %v2int %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_222177 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_222177 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_222177 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.wgsl new file mode 100644 index 0000000000..a42f490e04 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/222177.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reverseBits_222177() { + var res : vec2 = reverseBits(vec2(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_222177(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_222177(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_222177(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl new file mode 100644 index 0000000000..1fdd8451b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<4, u32>) -> vec<4, u32> +fn reverseBits_35fea9() { + var res: vec4 = reverseBits(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_35fea9(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_35fea9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_35fea9(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dab85fe998 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_35fea9() { + uint4 res = reversebits((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_35fea9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_35fea9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_35fea9(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dab85fe998 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_35fea9() { + uint4 res = reversebits((1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_35fea9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_35fea9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_35fea9(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.glsl new file mode 100644 index 0000000000..cf80319482 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reverseBits_35fea9() { + uvec4 res = bitfieldReverse(uvec4(1u)); +} + +vec4 vertex_main() { + reverseBits_35fea9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_35fea9() { + uvec4 res = bitfieldReverse(uvec4(1u)); +} + +void fragment_main() { + reverseBits_35fea9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_35fea9() { + uvec4 res = bitfieldReverse(uvec4(1u)); +} + +void compute_main() { + reverseBits_35fea9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.msl new file mode 100644 index 0000000000..af6ec6cef2 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reverseBits_35fea9() { + uint4 res = reverse_bits(uint4(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_35fea9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_35fea9(); + return; +} + +kernel void compute_main() { + reverseBits_35fea9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.spvasm new file mode 100644 index 0000000000..64647f436b --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_35fea9 "reverseBits_35fea9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_35fea9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %20 + %13 = OpBitReverse %v4uint %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_35fea9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_35fea9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_35fea9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.wgsl new file mode 100644 index 0000000000..8b094470ba --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/35fea9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reverseBits_35fea9() { + var res : vec4 = reverseBits(vec4(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_35fea9(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_35fea9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_35fea9(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl new file mode 100644 index 0000000000..b238d37d4c --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<4, i32>) -> vec<4, i32> +fn reverseBits_4dbd6f() { + var res: vec4 = reverseBits(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_4dbd6f(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_4dbd6f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_4dbd6f(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..73a433ba7a --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_4dbd6f() { + int4 res = asint(reversebits(asuint((1).xxxx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_4dbd6f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_4dbd6f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_4dbd6f(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..73a433ba7a --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_4dbd6f() { + int4 res = asint(reversebits(asuint((1).xxxx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_4dbd6f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_4dbd6f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_4dbd6f(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.glsl new file mode 100644 index 0000000000..0d096c5138 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reverseBits_4dbd6f() { + ivec4 res = bitfieldReverse(ivec4(1)); +} + +vec4 vertex_main() { + reverseBits_4dbd6f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_4dbd6f() { + ivec4 res = bitfieldReverse(ivec4(1)); +} + +void fragment_main() { + reverseBits_4dbd6f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_4dbd6f() { + ivec4 res = bitfieldReverse(ivec4(1)); +} + +void compute_main() { + reverseBits_4dbd6f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.msl new file mode 100644 index 0000000000..f148edcccf --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reverseBits_4dbd6f() { + int4 res = reverse_bits(int4(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_4dbd6f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_4dbd6f(); + return; +} + +kernel void compute_main() { + reverseBits_4dbd6f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8dfbb65ef --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_4dbd6f "reverseBits_4dbd6f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %20 = OpConstantNull %v4int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_4dbd6f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %20 + %13 = OpBitReverse %v4int %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_4dbd6f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_4dbd6f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_4dbd6f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.wgsl new file mode 100644 index 0000000000..c9b184068f --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/4dbd6f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reverseBits_4dbd6f() { + var res : vec4 = reverseBits(vec4(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_4dbd6f(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_4dbd6f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_4dbd6f(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl new file mode 100644 index 0000000000..1efeee02f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(i32) -> i32 +fn reverseBits_7c4269() { + var res: i32 = reverseBits(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_7c4269(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_7c4269(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_7c4269(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2796a2562 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_7c4269() { + int res = asint(reversebits(asuint(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_7c4269(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_7c4269(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_7c4269(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b2796a2562 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_7c4269() { + int res = asint(reversebits(asuint(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_7c4269(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_7c4269(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_7c4269(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.glsl new file mode 100644 index 0000000000..390dad5a32 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reverseBits_7c4269() { + int res = bitfieldReverse(1); +} + +vec4 vertex_main() { + reverseBits_7c4269(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_7c4269() { + int res = bitfieldReverse(1); +} + +void fragment_main() { + reverseBits_7c4269(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_7c4269() { + int res = bitfieldReverse(1); +} + +void compute_main() { + reverseBits_7c4269(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.msl new file mode 100644 index 0000000000..90d843c897 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reverseBits_7c4269() { + int res = reverse_bits(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_7c4269(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_7c4269(); + return; +} + +kernel void compute_main() { + reverseBits_7c4269(); + return; +} + diff --git a/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ce5525aa9 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/7c4269.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reverseBits_7c4269() { + var res : i32 = reverseBits(1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_7c4269(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_7c4269(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_7c4269(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl new file mode 100644 index 0000000000..7dc1ea1d5b --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<3, u32>) -> vec<3, u32> +fn reverseBits_a6ccd4() { + var res: vec3 = reverseBits(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_a6ccd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_a6ccd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_a6ccd4(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..99e125afff --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_a6ccd4() { + uint3 res = reversebits((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_a6ccd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_a6ccd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_a6ccd4(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..99e125afff --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_a6ccd4() { + uint3 res = reversebits((1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_a6ccd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_a6ccd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_a6ccd4(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.glsl new file mode 100644 index 0000000000..ae14fb671d --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reverseBits_a6ccd4() { + uvec3 res = bitfieldReverse(uvec3(1u)); +} + +vec4 vertex_main() { + reverseBits_a6ccd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_a6ccd4() { + uvec3 res = bitfieldReverse(uvec3(1u)); +} + +void fragment_main() { + reverseBits_a6ccd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_a6ccd4() { + uvec3 res = bitfieldReverse(uvec3(1u)); +} + +void compute_main() { + reverseBits_a6ccd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.msl new file mode 100644 index 0000000000..1c8cfe712e --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reverseBits_a6ccd4() { + uint3 res = reverse_bits(uint3(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_a6ccd4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_a6ccd4(); + return; +} + +kernel void compute_main() { + reverseBits_a6ccd4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..cb42d67869 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_a6ccd4 "reverseBits_a6ccd4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_a6ccd4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %20 + %13 = OpBitReverse %v3uint %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_a6ccd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_a6ccd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_a6ccd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5425dedb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/a6ccd4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reverseBits_a6ccd4() { + var res : vec3 = reverseBits(vec3(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_a6ccd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_a6ccd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_a6ccd4(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl new file mode 100644 index 0000000000..e525d7412c --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<3, i32>) -> vec<3, i32> +fn reverseBits_c21bc1() { + var res: vec3 = reverseBits(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_c21bc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_c21bc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_c21bc1(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5c31987567 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_c21bc1() { + int3 res = asint(reversebits(asuint((1).xxx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_c21bc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_c21bc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_c21bc1(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5c31987567 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_c21bc1() { + int3 res = asint(reversebits(asuint((1).xxx))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_c21bc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_c21bc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_c21bc1(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.glsl new file mode 100644 index 0000000000..f71833dd88 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reverseBits_c21bc1() { + ivec3 res = bitfieldReverse(ivec3(1)); +} + +vec4 vertex_main() { + reverseBits_c21bc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_c21bc1() { + ivec3 res = bitfieldReverse(ivec3(1)); +} + +void fragment_main() { + reverseBits_c21bc1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_c21bc1() { + ivec3 res = bitfieldReverse(ivec3(1)); +} + +void compute_main() { + reverseBits_c21bc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.msl new file mode 100644 index 0000000000..fb2b4aacc7 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reverseBits_c21bc1() { + int3 res = reverse_bits(int3(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_c21bc1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_c21bc1(); + return; +} + +kernel void compute_main() { + reverseBits_c21bc1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.spvasm new file mode 100644 index 0000000000..74cbb29bb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_c21bc1 "reverseBits_c21bc1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %20 = OpConstantNull %v3int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_c21bc1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %20 + %13 = OpBitReverse %v3int %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_c21bc1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_c21bc1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_c21bc1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..1446d033dc --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/c21bc1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reverseBits_c21bc1() { + var res : vec3 = reverseBits(vec3(1)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_c21bc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_c21bc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_c21bc1(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl new file mode 100644 index 0000000000..10abd26aca --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<2, u32>) -> vec<2, u32> +fn reverseBits_e1f4c1() { + var res: vec2 = reverseBits(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e1f4c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_e1f4c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_e1f4c1(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d159b1dc84 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_e1f4c1() { + uint2 res = reversebits((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e1f4c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e1f4c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e1f4c1(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d159b1dc84 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_e1f4c1() { + uint2 res = reversebits((1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e1f4c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e1f4c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e1f4c1(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.glsl new file mode 100644 index 0000000000..123f32c429 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reverseBits_e1f4c1() { + uvec2 res = bitfieldReverse(uvec2(1u)); +} + +vec4 vertex_main() { + reverseBits_e1f4c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_e1f4c1() { + uvec2 res = bitfieldReverse(uvec2(1u)); +} + +void fragment_main() { + reverseBits_e1f4c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_e1f4c1() { + uvec2 res = bitfieldReverse(uvec2(1u)); +} + +void compute_main() { + reverseBits_e1f4c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.msl new file mode 100644 index 0000000000..0394724b98 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reverseBits_e1f4c1() { + uint2 res = reverse_bits(uint2(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_e1f4c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_e1f4c1(); + return; +} + +kernel void compute_main() { + reverseBits_e1f4c1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..9643cf026a --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_e1f4c1 "reverseBits_e1f4c1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %17 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_e1f4c1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %20 + %13 = OpBitReverse %v2uint %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_e1f4c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_e1f4c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_e1f4c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..d932106103 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e1f4c1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reverseBits_e1f4c1() { + var res : vec2 = reverseBits(vec2(1u)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e1f4c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_e1f4c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_e1f4c1(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl new file mode 100644 index 0000000000..b7113030fd --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(u32) -> u32 +fn reverseBits_e31adf() { + var res: u32 = reverseBits(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e31adf(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_e31adf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_e31adf(); +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..823b7110cd --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_e31adf() { + uint res = reversebits(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e31adf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e31adf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e31adf(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..823b7110cd --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void reverseBits_e31adf() { + uint res = reversebits(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e31adf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e31adf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e31adf(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.glsl new file mode 100644 index 0000000000..3ea30666ec --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void reverseBits_e31adf() { + uint res = bitfieldReverse(1u); +} + +vec4 vertex_main() { + reverseBits_e31adf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_e31adf() { + uint res = bitfieldReverse(1u); +} + +void fragment_main() { + reverseBits_e31adf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_e31adf() { + uint res = bitfieldReverse(1u); +} + +void compute_main() { + reverseBits_e31adf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.msl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.msl new file mode 100644 index 0000000000..c850796c2e --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void reverseBits_e31adf() { + uint res = reverse_bits(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_e31adf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_e31adf(); + return; +} + +kernel void compute_main() { + reverseBits_e31adf(); + return; +} + diff --git a/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe271eb381 --- /dev/null +++ b/test/tint/builtins/gen/literal/reverseBits/e31adf.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn reverseBits_e31adf() { + var res : u32 = reverseBits(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e31adf(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_e31adf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_e31adf(); +} diff --git a/test/tint/builtins/gen/literal/round/106c0b.wgsl b/test/tint/builtins/gen/literal/round/106c0b.wgsl new file mode 100644 index 0000000000..bb4b1318f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/106c0b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(vec<4, f32>) -> vec<4, f32> +fn round_106c0b() { + var res: vec4 = round(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_106c0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_106c0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_106c0b(); +} diff --git a/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cbcc5cfb3b --- /dev/null +++ b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_106c0b() { + float4 res = round((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_106c0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_106c0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_106c0b(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cbcc5cfb3b --- /dev/null +++ b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void round_106c0b() { + float4 res = round((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_106c0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_106c0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_106c0b(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.glsl new file mode 100644 index 0000000000..476bb4ca3f --- /dev/null +++ b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void round_106c0b() { + vec4 res = round(vec4(1.0f)); +} + +vec4 vertex_main() { + round_106c0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_106c0b() { + vec4 res = round(vec4(1.0f)); +} + +void fragment_main() { + round_106c0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_106c0b() { + vec4 res = round(vec4(1.0f)); +} + +void compute_main() { + round_106c0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.msl new file mode 100644 index 0000000000..89a1522d5b --- /dev/null +++ b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_106c0b() { + float4 res = rint(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_106c0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_106c0b(); + return; +} + +kernel void compute_main() { + round_106c0b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c44d7c21c --- /dev/null +++ b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_106c0b "round_106c0b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%round_106c0b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 RoundEven %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %round_106c0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %round_106c0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %round_106c0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..4bf6403d00 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/106c0b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn round_106c0b() { + var res : vec4 = round(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_106c0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_106c0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_106c0b(); +} diff --git a/test/tint/builtins/gen/literal/round/1c7897.wgsl b/test/tint/builtins/gen/literal/round/1c7897.wgsl new file mode 100644 index 0000000000..47901ac505 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/1c7897.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(vec<3, f32>) -> vec<3, f32> +fn round_1c7897() { + var res: vec3 = round(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_1c7897(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_1c7897(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_1c7897(); +} diff --git a/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..654f791410 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_1c7897() { + float3 res = round((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_1c7897(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_1c7897(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_1c7897(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..654f791410 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void round_1c7897() { + float3 res = round((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_1c7897(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_1c7897(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_1c7897(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.glsl new file mode 100644 index 0000000000..4ab3d34706 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void round_1c7897() { + vec3 res = round(vec3(1.0f)); +} + +vec4 vertex_main() { + round_1c7897(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_1c7897() { + vec3 res = round(vec3(1.0f)); +} + +void fragment_main() { + round_1c7897(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_1c7897() { + vec3 res = round(vec3(1.0f)); +} + +void compute_main() { + round_1c7897(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.msl new file mode 100644 index 0000000000..af57b2fc52 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_1c7897() { + float3 res = rint(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_1c7897(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_1c7897(); + return; +} + +kernel void compute_main() { + round_1c7897(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9cd1e0f7c --- /dev/null +++ b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_1c7897 "round_1c7897" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%round_1c7897 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 RoundEven %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %round_1c7897 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %round_1c7897 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %round_1c7897 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.wgsl new file mode 100644 index 0000000000..4767a89182 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/1c7897.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn round_1c7897() { + var res : vec3 = round(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_1c7897(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_1c7897(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_1c7897(); +} diff --git a/test/tint/builtins/gen/literal/round/52c84d.wgsl b/test/tint/builtins/gen/literal/round/52c84d.wgsl new file mode 100644 index 0000000000..3a416c2bf7 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/52c84d.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(vec<2, f32>) -> vec<2, f32> +fn round_52c84d() { + var res: vec2 = round(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_52c84d(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_52c84d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_52c84d(); +} diff --git a/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f8c0830232 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_52c84d() { + float2 res = round((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_52c84d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_52c84d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_52c84d(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f8c0830232 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void round_52c84d() { + float2 res = round((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_52c84d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_52c84d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_52c84d(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.glsl new file mode 100644 index 0000000000..494a03b93e --- /dev/null +++ b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void round_52c84d() { + vec2 res = round(vec2(1.0f)); +} + +vec4 vertex_main() { + round_52c84d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_52c84d() { + vec2 res = round(vec2(1.0f)); +} + +void fragment_main() { + round_52c84d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_52c84d() { + vec2 res = round(vec2(1.0f)); +} + +void compute_main() { + round_52c84d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.msl new file mode 100644 index 0000000000..803ee34063 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_52c84d() { + float2 res = rint(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_52c84d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_52c84d(); + return; +} + +kernel void compute_main() { + round_52c84d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.spvasm new file mode 100644 index 0000000000..861f456910 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_52c84d "round_52c84d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%round_52c84d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 RoundEven %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %round_52c84d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %round_52c84d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %round_52c84d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce712819d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/52c84d.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn round_52c84d() { + var res : vec2 = round(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_52c84d(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_52c84d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_52c84d(); +} diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl new file mode 100644 index 0000000000..d5223dcf61 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(f16) -> f16 +fn round_9078ef() { + var res: f16 = round(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9078ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9078ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9078ef(); +} diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e695f9b52f --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_9078ef() { + float16_t res = round(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9078ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9078ef(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba25fa1fcc --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void round_9078ef() { + float16_t res = round(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9078ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9078ef(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001AFF97C0AC0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001AFF97C0AC0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.glsl new file mode 100644 index 0000000000..34f4fd1fdf --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_9078ef() { + float16_t res = round(0.0hf); +} + +vec4 vertex_main() { + round_9078ef(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_9078ef() { + float16_t res = round(0.0hf); +} + +void fragment_main() { + round_9078ef(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_9078ef() { + float16_t res = round(0.0hf); +} + +void compute_main() { + round_9078ef(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.msl new file mode 100644 index 0000000000..c400dc4cbb --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_9078ef() { + half res = rint(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_9078ef(); + return; +} + +kernel void compute_main() { + round_9078ef(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..80c9f07b49 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_9078ef "round_9078ef" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_9078ef = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 RoundEven %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %round_9078ef + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %round_9078ef + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_9078ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..f918a9048d --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9078ef.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn round_9078ef() { + var res : f16 = round(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9078ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9078ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9078ef(); +} diff --git a/test/tint/builtins/gen/literal/round/9edc38.wgsl b/test/tint/builtins/gen/literal/round/9edc38.wgsl new file mode 100644 index 0000000000..7a3670f9c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9edc38.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(f32) -> f32 +fn round_9edc38() { + var res: f32 = round(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9edc38(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9edc38(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9edc38(); +} diff --git a/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd35aabad4 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_9edc38() { + float res = round(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9edc38(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9edc38(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9edc38(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd35aabad4 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void round_9edc38() { + float res = round(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9edc38(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9edc38(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9edc38(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.glsl new file mode 100644 index 0000000000..b7f45f130d --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void round_9edc38() { + float res = round(1.0f); +} + +vec4 vertex_main() { + round_9edc38(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_9edc38() { + float res = round(1.0f); +} + +void fragment_main() { + round_9edc38(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_9edc38() { + float res = round(1.0f); +} + +void compute_main() { + round_9edc38(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.msl new file mode 100644 index 0000000000..b6406d5ed7 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_9edc38() { + float res = rint(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_9edc38(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_9edc38(); + return; +} + +kernel void compute_main() { + round_9edc38(); + return; +} + diff --git a/test/tint/builtins/gen/round/9edc38.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/round/9edc38.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4672411da --- /dev/null +++ b/test/tint/builtins/gen/literal/round/9edc38.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn round_9edc38() { + var res : f32 = round(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9edc38(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9edc38(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9edc38(); +} diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl new file mode 100644 index 0000000000..3ca7f698eb --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<2, f16>) -> vec<2, f16> +fn round_d87e84() { + var res: vec2 = round(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_d87e84(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_d87e84(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_d87e84(); +} diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dc48afa9c7 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_d87e84() { + vector res = round((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_d87e84(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_d87e84(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b025eb8bf8 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void round_d87e84() { + vector res = round((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_d87e84(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_d87e84(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D031328810(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.glsl new file mode 100644 index 0000000000..e2e82c9dd1 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_d87e84() { + f16vec2 res = round(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + round_d87e84(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_d87e84() { + f16vec2 res = round(f16vec2(0.0hf)); +} + +void fragment_main() { + round_d87e84(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_d87e84() { + f16vec2 res = round(f16vec2(0.0hf)); +} + +void compute_main() { + round_d87e84(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.msl new file mode 100644 index 0000000000..af2b9b241e --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_d87e84() { + half2 res = rint(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_d87e84(); + return; +} + +kernel void compute_main() { + round_d87e84(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6698b4cae --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_d87e84 "round_d87e84" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_d87e84 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 RoundEven %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %round_d87e84 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %round_d87e84 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %round_d87e84 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.wgsl new file mode 100644 index 0000000000..d3a6cc463c --- /dev/null +++ b/test/tint/builtins/gen/literal/round/d87e84.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn round_d87e84() { + var res : vec2 = round(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_d87e84(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_d87e84(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_d87e84(); +} diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl new file mode 100644 index 0000000000..dfa126475a --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<3, f16>) -> vec<3, f16> +fn round_e1bba2() { + var res: vec3 = round(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_e1bba2(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_e1bba2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_e1bba2(); +} diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4941302523 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_e1bba2() { + vector res = round((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_e1bba2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_e1bba2(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..899f28dd9e --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void round_e1bba2() { + vector res = round((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_e1bba2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_e1bba2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021F98A3E5C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.glsl new file mode 100644 index 0000000000..873d32a4aa --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_e1bba2() { + f16vec3 res = round(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + round_e1bba2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_e1bba2() { + f16vec3 res = round(f16vec3(0.0hf)); +} + +void fragment_main() { + round_e1bba2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_e1bba2() { + f16vec3 res = round(f16vec3(0.0hf)); +} + +void compute_main() { + round_e1bba2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.msl new file mode 100644 index 0000000000..c4670c64cf --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_e1bba2() { + half3 res = rint(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_e1bba2(); + return; +} + +kernel void compute_main() { + round_e1bba2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.spvasm new file mode 100644 index 0000000000..122df56e4b --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_e1bba2 "round_e1bba2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_e1bba2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 RoundEven %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %round_e1bba2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %round_e1bba2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %round_e1bba2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.wgsl new file mode 100644 index 0000000000..6da51860cc --- /dev/null +++ b/test/tint/builtins/gen/literal/round/e1bba2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn round_e1bba2() { + var res : vec3 = round(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_e1bba2(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_e1bba2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_e1bba2(); +} diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl new file mode 100644 index 0000000000..62932390ff --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<4, f16>) -> vec<4, f16> +fn round_f665b5() { + var res: vec4 = round(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_f665b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_f665b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_f665b5(); +} diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..287b5e1d4b --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void round_f665b5() { + vector res = round((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_f665b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_f665b5(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c73645a7a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void round_f665b5() { + vector res = round((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_f665b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_f665b5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017F6B0D8810(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.glsl new file mode 100644 index 0000000000..bc044ed5b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_f665b5() { + f16vec4 res = round(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + round_f665b5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_f665b5() { + f16vec4 res = round(f16vec4(0.0hf)); +} + +void fragment_main() { + round_f665b5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_f665b5() { + f16vec4 res = round(f16vec4(0.0hf)); +} + +void compute_main() { + round_f665b5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.msl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.msl new file mode 100644 index 0000000000..db3fa98c66 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void round_f665b5() { + half4 res = rint(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_f665b5(); + return; +} + +kernel void compute_main() { + round_f665b5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..9600ad74d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_f665b5 "round_f665b5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_f665b5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 RoundEven %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %round_f665b5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %round_f665b5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %round_f665b5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..9338453976 --- /dev/null +++ b/test/tint/builtins/gen/literal/round/f665b5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn round_f665b5() { + var res : vec4 = round(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_f665b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_f665b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_f665b5(); +} diff --git a/test/tint/builtins/gen/literal/select/00b848.wgsl b/test/tint/builtins/gen/literal/select/00b848.wgsl new file mode 100644 index 0000000000..9a51adb022 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/00b848.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, i32>, vec<2, i32>, vec<2, bool>) -> vec<2, i32> +fn select_00b848() { + var res: vec2 = select(vec2(1), vec2(1), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_00b848(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_00b848(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_00b848(); +} diff --git a/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..85382631a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_00b848() { + int2 res = ((true).xx ? (1).xx : (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_00b848(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_00b848(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_00b848(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..85382631a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_00b848() { + int2 res = ((true).xx ? (1).xx : (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_00b848(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_00b848(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_00b848(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.glsl new file mode 100644 index 0000000000..3e03e16745 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_00b848() { + ivec2 res = mix(ivec2(1), ivec2(1), bvec2(true)); +} + +vec4 vertex_main() { + select_00b848(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_00b848() { + ivec2 res = mix(ivec2(1), ivec2(1), bvec2(true)); +} + +void fragment_main() { + select_00b848(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_00b848() { + ivec2 res = mix(ivec2(1), ivec2(1), bvec2(true)); +} + +void compute_main() { + select_00b848(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.msl new file mode 100644 index 0000000000..a3915c9a08 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_00b848() { + int2 res = select(int2(1), int2(1), bool2(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_00b848(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_00b848(); + return; +} + +kernel void compute_main() { + select_00b848(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.spvasm new file mode 100644 index 0000000000..b2604cc4fa --- /dev/null +++ b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_00b848 "select_00b848" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v2bool %true %true + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_00b848 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %13 = OpSelect %v2int %19 %21 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_00b848 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_00b848 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_00b848 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.wgsl new file mode 100644 index 0000000000..4dc5e7f86c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/00b848.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_00b848() { + var res : vec2 = select(vec2(1), vec2(1), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_00b848(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_00b848(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_00b848(); +} diff --git a/test/tint/builtins/gen/literal/select/01e2cd.wgsl b/test/tint/builtins/gen/literal/select/01e2cd.wgsl new file mode 100644 index 0000000000..f40ada0a51 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/01e2cd.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, i32>, vec<3, i32>, vec<3, bool>) -> vec<3, i32> +fn select_01e2cd() { + var res: vec3 = select(vec3(1), vec3(1), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_01e2cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_01e2cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_01e2cd(); +} diff --git a/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..274eac64c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_01e2cd() { + int3 res = ((true).xxx ? (1).xxx : (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_01e2cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_01e2cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_01e2cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..274eac64c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_01e2cd() { + int3 res = ((true).xxx ? (1).xxx : (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_01e2cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_01e2cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_01e2cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.glsl new file mode 100644 index 0000000000..71c57911b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_01e2cd() { + ivec3 res = mix(ivec3(1), ivec3(1), bvec3(true)); +} + +vec4 vertex_main() { + select_01e2cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_01e2cd() { + ivec3 res = mix(ivec3(1), ivec3(1), bvec3(true)); +} + +void fragment_main() { + select_01e2cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_01e2cd() { + ivec3 res = mix(ivec3(1), ivec3(1), bvec3(true)); +} + +void compute_main() { + select_01e2cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.msl new file mode 100644 index 0000000000..7ad0b714a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_01e2cd() { + int3 res = select(int3(1), int3(1), bool3(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_01e2cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_01e2cd(); + return; +} + +kernel void compute_main() { + select_01e2cd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..465b4c837d --- /dev/null +++ b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_01e2cd "select_01e2cd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v3bool %true %true %true + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpConstantNull %v3int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_01e2cd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %24 + %13 = OpSelect %v3int %19 %21 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_01e2cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_01e2cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_01e2cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..07187575d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/01e2cd.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_01e2cd() { + var res : vec3 = select(vec3(1), vec3(1), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_01e2cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_01e2cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_01e2cd(); +} diff --git a/test/tint/builtins/gen/literal/select/087ea4.wgsl b/test/tint/builtins/gen/literal/select/087ea4.wgsl new file mode 100644 index 0000000000..c58a6ae543 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/087ea4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, u32>, vec<4, u32>, bool) -> vec<4, u32> +fn select_087ea4() { + var res: vec4 = select(vec4(1u), vec4(1u), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_087ea4(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_087ea4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_087ea4(); +} diff --git a/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d82275174 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_087ea4() { + uint4 res = (true ? (1u).xxxx : (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_087ea4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_087ea4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_087ea4(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d82275174 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_087ea4() { + uint4 res = (true ? (1u).xxxx : (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_087ea4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_087ea4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_087ea4(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.glsl new file mode 100644 index 0000000000..ef874e6525 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_087ea4() { + uvec4 res = (true ? uvec4(1u) : uvec4(1u)); +} + +vec4 vertex_main() { + select_087ea4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_087ea4() { + uvec4 res = (true ? uvec4(1u) : uvec4(1u)); +} + +void fragment_main() { + select_087ea4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_087ea4() { + uvec4 res = (true ? uvec4(1u) : uvec4(1u)); +} + +void compute_main() { + select_087ea4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.msl new file mode 100644 index 0000000000..4b90e29b47 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_087ea4() { + uint4 res = select(uint4(1u), uint4(1u), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_087ea4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_087ea4(); + return; +} + +kernel void compute_main() { + select_087ea4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.spvasm new file mode 100644 index 0000000000..4494fd2ac5 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_087ea4 "select_087ea4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %19 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %23 = OpConstantNull %v4bool +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %27 = OpConstantNull %v4uint + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_087ea4 = OpFunction %void None %9 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v4bool Function %23 + %res = OpVariable %_ptr_Function_v4uint Function %27 + %24 = OpCompositeConstruct %v4bool %true %true %true %true + %13 = OpSelect %v4uint %24 %19 %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_087ea4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_087ea4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_087ea4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c28feb2de --- /dev/null +++ b/test/tint/builtins/gen/literal/select/087ea4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_087ea4() { + var res : vec4 = select(vec4(1u), vec4(1u), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_087ea4(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_087ea4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_087ea4(); +} diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl new file mode 100644 index 0000000000..96320641af --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(f16, f16, bool) -> f16 +fn select_10e73b() { + var res: f16 = select(f16(), f16(), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_10e73b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_10e73b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_10e73b(); +} diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1aaa5caac9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_10e73b() { + float16_t res = (true ? float16_t(0.0h) : float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_10e73b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_10e73b(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9d0c5f2281 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void select_10e73b() { + float16_t res = (true ? float16_t(0.0h) : float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_10e73b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_10e73b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A45741F510(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A45741F510(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.glsl new file mode 100644 index 0000000000..bab4323c43 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_10e73b() { + float16_t res = (true ? 0.0hf : 0.0hf); +} + +vec4 vertex_main() { + select_10e73b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_10e73b() { + float16_t res = (true ? 0.0hf : 0.0hf); +} + +void fragment_main() { + select_10e73b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_10e73b() { + float16_t res = (true ? 0.0hf : 0.0hf); +} + +void compute_main() { + select_10e73b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.msl new file mode 100644 index 0000000000..b7c4cd594f --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_10e73b() { + half res = select(0.0h, 0.0h, true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_10e73b(); + return; +} + +kernel void compute_main() { + select_10e73b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.spvasm new file mode 100644 index 0000000000..af36e83608 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_10e73b "select_10e73b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %17 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_10e73b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %17 + %13 = OpSelect %half %true %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %select_10e73b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %select_10e73b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_10e73b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.wgsl new file mode 100644 index 0000000000..4aa334d0a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/10e73b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_10e73b() { + var res : f16 = select(f16(), f16(), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_10e73b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_10e73b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_10e73b(); +} diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl new file mode 100644 index 0000000000..2278b71f56 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<3, f16>, vec<3, f16>, bool) -> vec<3, f16> +fn select_1ada2a() { + var res: vec3 = select(vec3(f16()), vec3(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1ada2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1ada2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1ada2a(); +} diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..87d78068f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_1ada2a() { + vector res = (true ? (float16_t(0.0h)).xxx : (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1ada2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1ada2a(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2165304d45 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_1ada2a() { + vector res = (true ? (float16_t(0.0h)).xxx : (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1ada2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1ada2a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FD85D20100(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.glsl new file mode 100644 index 0000000000..63526f1b59 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_1ada2a() { + f16vec3 res = (true ? f16vec3(0.0hf) : f16vec3(0.0hf)); +} + +vec4 vertex_main() { + select_1ada2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_1ada2a() { + f16vec3 res = (true ? f16vec3(0.0hf) : f16vec3(0.0hf)); +} + +void fragment_main() { + select_1ada2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_1ada2a() { + f16vec3 res = (true ? f16vec3(0.0hf) : f16vec3(0.0hf)); +} + +void compute_main() { + select_1ada2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.msl new file mode 100644 index 0000000000..bc21eda6ab --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_1ada2a() { + half3 res = select(half3(0.0h), half3(0.0h), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_1ada2a(); + return; +} + +kernel void compute_main() { + select_1ada2a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..23393570b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_1ada2a "select_1ada2a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %18 = OpConstantNull %v3half + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %22 = OpConstantNull %v3bool +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_1ada2a = OpFunction %void None %9 + %12 = OpLabel + %20 = OpVariable %_ptr_Function_v3bool Function %22 + %res = OpVariable %_ptr_Function_v3half Function %18 + %23 = OpCompositeConstruct %v3bool %true %true %true + %13 = OpSelect %v3half %23 %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %select_1ada2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_1ada2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_1ada2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..64fb37129f --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1ada2a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_1ada2a() { + var res : vec3 = select(vec3(f16()), vec3(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1ada2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1ada2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1ada2a(); +} diff --git a/test/tint/builtins/gen/literal/select/1e960b.wgsl b/test/tint/builtins/gen/literal/select/1e960b.wgsl new file mode 100644 index 0000000000..3f9d483b19 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1e960b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, u32>, vec<2, u32>, vec<2, bool>) -> vec<2, u32> +fn select_1e960b() { + var res: vec2 = select(vec2(1u), vec2(1u), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1e960b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1e960b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1e960b(); +} diff --git a/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..19b70cc884 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_1e960b() { + uint2 res = ((true).xx ? (1u).xx : (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1e960b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1e960b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1e960b(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..19b70cc884 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_1e960b() { + uint2 res = ((true).xx ? (1u).xx : (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1e960b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1e960b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1e960b(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.glsl new file mode 100644 index 0000000000..54ed91da7a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_1e960b() { + uvec2 res = mix(uvec2(1u), uvec2(1u), bvec2(true)); +} + +vec4 vertex_main() { + select_1e960b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_1e960b() { + uvec2 res = mix(uvec2(1u), uvec2(1u), bvec2(true)); +} + +void fragment_main() { + select_1e960b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_1e960b() { + uvec2 res = mix(uvec2(1u), uvec2(1u), bvec2(true)); +} + +void compute_main() { + select_1e960b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.msl new file mode 100644 index 0000000000..b540a011aa --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_1e960b() { + uint2 res = select(uint2(1u), uint2(1u), bool2(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_1e960b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_1e960b(); + return; +} + +kernel void compute_main() { + select_1e960b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.spvasm new file mode 100644 index 0000000000..a564f3192e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_1e960b "select_1e960b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v2bool %true %true + %uint_1 = OpConstant %uint 1 + %21 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %24 = OpConstantNull %v2uint + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_1e960b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %24 + %13 = OpSelect %v2uint %19 %21 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_1e960b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_1e960b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_1e960b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.wgsl new file mode 100644 index 0000000000..c978f2d57a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/1e960b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_1e960b() { + var res : vec2 = select(vec2(1u), vec2(1u), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1e960b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1e960b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1e960b(); +} diff --git a/test/tint/builtins/gen/literal/select/266aff.wgsl b/test/tint/builtins/gen/literal/select/266aff.wgsl new file mode 100644 index 0000000000..618ec774d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/266aff.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, f32>, vec<2, f32>, vec<2, bool>) -> vec<2, f32> +fn select_266aff() { + var res: vec2 = select(vec2(1.f), vec2(1.f), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_266aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_266aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_266aff(); +} diff --git a/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2dc967e483 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_266aff() { + float2 res = ((true).xx ? (1.0f).xx : (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_266aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_266aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_266aff(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2dc967e483 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_266aff() { + float2 res = ((true).xx ? (1.0f).xx : (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_266aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_266aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_266aff(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.glsl new file mode 100644 index 0000000000..8eb8ecfb4c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_266aff() { + vec2 res = mix(vec2(1.0f), vec2(1.0f), bvec2(true)); +} + +vec4 vertex_main() { + select_266aff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_266aff() { + vec2 res = mix(vec2(1.0f), vec2(1.0f), bvec2(true)); +} + +void fragment_main() { + select_266aff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_266aff() { + vec2 res = mix(vec2(1.0f), vec2(1.0f), bvec2(true)); +} + +void compute_main() { + select_266aff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.msl new file mode 100644 index 0000000000..fb2037e2d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_266aff() { + float2 res = select(float2(1.0f), float2(1.0f), bool2(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_266aff(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_266aff(); + return; +} + +kernel void compute_main() { + select_266aff(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.spvasm new file mode 100644 index 0000000000..131a743713 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_266aff "select_266aff" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %18 = OpConstantComposite %v2bool %true %true + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %23 = OpConstantNull %v2float + %24 = OpTypeFunction %v4float +%select_266aff = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %23 + %13 = OpSelect %v2float %18 %20 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %select_266aff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_266aff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_266aff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.wgsl new file mode 100644 index 0000000000..5633491763 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/266aff.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_266aff() { + var res : vec2 = select(vec2(1.0f), vec2(1.0f), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_266aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_266aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_266aff(); +} diff --git a/test/tint/builtins/gen/literal/select/28a27e.wgsl b/test/tint/builtins/gen/literal/select/28a27e.wgsl new file mode 100644 index 0000000000..083b8cafa1 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/28a27e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, u32>, vec<3, u32>, vec<3, bool>) -> vec<3, u32> +fn select_28a27e() { + var res: vec3 = select(vec3(1u), vec3(1u), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_28a27e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_28a27e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_28a27e(); +} diff --git a/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..839a95c951 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_28a27e() { + uint3 res = ((true).xxx ? (1u).xxx : (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_28a27e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_28a27e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_28a27e(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..839a95c951 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_28a27e() { + uint3 res = ((true).xxx ? (1u).xxx : (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_28a27e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_28a27e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_28a27e(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.glsl new file mode 100644 index 0000000000..6085586885 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_28a27e() { + uvec3 res = mix(uvec3(1u), uvec3(1u), bvec3(true)); +} + +vec4 vertex_main() { + select_28a27e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_28a27e() { + uvec3 res = mix(uvec3(1u), uvec3(1u), bvec3(true)); +} + +void fragment_main() { + select_28a27e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_28a27e() { + uvec3 res = mix(uvec3(1u), uvec3(1u), bvec3(true)); +} + +void compute_main() { + select_28a27e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.msl new file mode 100644 index 0000000000..af33466ffd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_28a27e() { + uint3 res = select(uint3(1u), uint3(1u), bool3(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_28a27e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_28a27e(); + return; +} + +kernel void compute_main() { + select_28a27e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.spvasm new file mode 100644 index 0000000000..33269e9871 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_28a27e "select_28a27e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v3bool %true %true %true + %uint_1 = OpConstant %uint 1 + %21 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %24 = OpConstantNull %v3uint + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_28a27e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3uint Function %24 + %13 = OpSelect %v3uint %19 %21 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_28a27e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_28a27e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_28a27e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d859241cc --- /dev/null +++ b/test/tint/builtins/gen/literal/select/28a27e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_28a27e() { + var res : vec3 = select(vec3(1u), vec3(1u), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_28a27e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_28a27e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_28a27e(); +} diff --git a/test/tint/builtins/gen/literal/select/3c25ce.wgsl b/test/tint/builtins/gen/literal/select/3c25ce.wgsl new file mode 100644 index 0000000000..d5ed3a20ee --- /dev/null +++ b/test/tint/builtins/gen/literal/select/3c25ce.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, bool>, vec<3, bool>, bool) -> vec<3, bool> +fn select_3c25ce() { + var res: vec3 = select(vec3(true), vec3(true), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_3c25ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_3c25ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_3c25ce(); +} diff --git a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fdfa6e6df9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_3c25ce() { + bool3 res = (true ? (true).xxx : (true).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_3c25ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_3c25ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_3c25ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fdfa6e6df9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_3c25ce() { + bool3 res = (true ? (true).xxx : (true).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_3c25ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_3c25ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_3c25ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.glsl new file mode 100644 index 0000000000..bac0f4e03e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_3c25ce() { + bvec3 res = (true ? bvec3(true) : bvec3(true)); +} + +vec4 vertex_main() { + select_3c25ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_3c25ce() { + bvec3 res = (true ? bvec3(true) : bvec3(true)); +} + +void fragment_main() { + select_3c25ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_3c25ce() { + bvec3 res = (true ? bvec3(true) : bvec3(true)); +} + +void compute_main() { + select_3c25ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.msl new file mode 100644 index 0000000000..2db2e7d2ba --- /dev/null +++ b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_3c25ce() { + bool3 res = select(bool3(true), bool3(true), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_3c25ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_3c25ce(); + return; +} + +kernel void compute_main() { + select_3c25ce(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..ad81aedeb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_3c25ce "select_3c25ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %20 = OpConstantNull %v3bool + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_3c25ce = OpFunction %void None %9 + %12 = OpLabel + %18 = OpVariable %_ptr_Function_v3bool Function %20 + %res = OpVariable %_ptr_Function_v3bool Function %20 + %21 = OpCompositeConstruct %v3bool %true %true %true + %13 = OpSelect %v3bool %21 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %select_3c25ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_3c25ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_3c25ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..7363bb617d --- /dev/null +++ b/test/tint/builtins/gen/literal/select/3c25ce.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_3c25ce() { + var res : vec3 = select(vec3(true), vec3(true), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_3c25ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_3c25ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_3c25ce(); +} diff --git a/test/tint/builtins/gen/literal/select/416e14.wgsl b/test/tint/builtins/gen/literal/select/416e14.wgsl new file mode 100644 index 0000000000..41a1f1a114 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/416e14.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(f32, f32, bool) -> f32 +fn select_416e14() { + var res: f32 = select(1.f, 1.f, true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_416e14(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_416e14(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_416e14(); +} diff --git a/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3ed856de2c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_416e14() { + float res = (true ? 1.0f : 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_416e14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_416e14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_416e14(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ed856de2c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_416e14() { + float res = (true ? 1.0f : 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_416e14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_416e14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_416e14(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.glsl new file mode 100644 index 0000000000..fd8341b0a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_416e14() { + float res = (true ? 1.0f : 1.0f); +} + +vec4 vertex_main() { + select_416e14(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_416e14() { + float res = (true ? 1.0f : 1.0f); +} + +void fragment_main() { + select_416e14(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_416e14() { + float res = (true ? 1.0f : 1.0f); +} + +void compute_main() { + select_416e14(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.msl new file mode 100644 index 0000000000..78cbe35012 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_416e14() { + float res = select(1.0f, 1.0f, true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_416e14(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_416e14(); + return; +} + +kernel void compute_main() { + select_416e14(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.spvasm new file mode 100644 index 0000000000..1a8250f095 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_416e14 "select_416e14" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpTypeFunction %v4float +%select_416e14 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %13 = OpSelect %float %true %float_1 %float_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %select_416e14 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %select_416e14 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %select_416e14 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad0a0917a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/416e14.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_416e14() { + var res : f32 = select(1.0f, 1.0f, true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_416e14(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_416e14(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_416e14(); +} diff --git a/test/tint/builtins/gen/literal/select/51b047.wgsl b/test/tint/builtins/gen/literal/select/51b047.wgsl new file mode 100644 index 0000000000..cffe72a5cc --- /dev/null +++ b/test/tint/builtins/gen/literal/select/51b047.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, u32>, vec<2, u32>, bool) -> vec<2, u32> +fn select_51b047() { + var res: vec2 = select(vec2(1u), vec2(1u), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_51b047(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_51b047(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_51b047(); +} diff --git a/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..04067a8a6f --- /dev/null +++ b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_51b047() { + uint2 res = (true ? (1u).xx : (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_51b047(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_51b047(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_51b047(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04067a8a6f --- /dev/null +++ b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_51b047() { + uint2 res = (true ? (1u).xx : (1u).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_51b047(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_51b047(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_51b047(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.glsl new file mode 100644 index 0000000000..cc8df231c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_51b047() { + uvec2 res = (true ? uvec2(1u) : uvec2(1u)); +} + +vec4 vertex_main() { + select_51b047(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_51b047() { + uvec2 res = (true ? uvec2(1u) : uvec2(1u)); +} + +void fragment_main() { + select_51b047(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_51b047() { + uvec2 res = (true ? uvec2(1u) : uvec2(1u)); +} + +void compute_main() { + select_51b047(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.msl new file mode 100644 index 0000000000..ecc3ac7d3a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_51b047() { + uint2 res = select(uint2(1u), uint2(1u), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_51b047(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_51b047(); + return; +} + +kernel void compute_main() { + select_51b047(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ee6bdc6aa --- /dev/null +++ b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_51b047 "select_51b047" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %19 = OpConstantComposite %v2uint %uint_1 %uint_1 + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %23 = OpConstantNull %v2bool +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %27 = OpConstantNull %v2uint + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_51b047 = OpFunction %void None %9 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v2bool Function %23 + %res = OpVariable %_ptr_Function_v2uint Function %27 + %24 = OpCompositeConstruct %v2bool %true %true + %13 = OpSelect %v2uint %24 %19 %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_51b047 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_51b047 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_51b047 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.wgsl new file mode 100644 index 0000000000..03cd3886c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/51b047.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_51b047() { + var res : vec2 = select(vec2(1u), vec2(1u), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_51b047(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_51b047(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_51b047(); +} diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl b/test/tint/builtins/gen/literal/select/53d518.wgsl new file mode 100644 index 0000000000..a511c17c43 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<3, f16>, vec<3, f16>, vec<3, bool>) -> vec<3, f16> +fn select_53d518() { + var res: vec3 = select(vec3(f16()), vec3(f16()), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_53d518(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_53d518(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_53d518(); +} diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95ed17f271 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_53d518() { + vector res = ((true).xxx ? (float16_t(0.0h)).xxx : (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_53d518(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_53d518(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_53d518(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3117c7bb35 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_53d518() { + vector res = ((true).xxx ? (float16_t(0.0h)).xxx : (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_53d518(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_53d518(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_53d518(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025E61DB8680(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.glsl new file mode 100644 index 0000000000..1ecee212e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_53d518() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), bvec3(true)); +} + +vec4 vertex_main() { + select_53d518(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_53d518() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), bvec3(true)); +} + +void fragment_main() { + select_53d518(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_53d518() { + f16vec3 res = mix(f16vec3(0.0hf), f16vec3(0.0hf), bvec3(true)); +} + +void compute_main() { + select_53d518(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.msl new file mode 100644 index 0000000000..9338705490 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_53d518() { + half3 res = select(half3(0.0h), half3(0.0h), bool3(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_53d518(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_53d518(); + return; +} + +kernel void compute_main() { + select_53d518(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.spvasm new file mode 100644 index 0000000000..f76cbacd9e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_53d518 "select_53d518" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v3bool %true %true %true + %20 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_53d518 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %20 + %13 = OpSelect %v3half %19 %20 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %select_53d518 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_53d518 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_53d518 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.wgsl new file mode 100644 index 0000000000..425a44b087 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/53d518.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_53d518() { + var res : vec3 = select(vec3(f16()), vec3(f16()), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_53d518(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_53d518(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_53d518(); +} diff --git a/test/tint/builtins/gen/literal/select/713567.wgsl b/test/tint/builtins/gen/literal/select/713567.wgsl new file mode 100644 index 0000000000..2fcc16149a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/713567.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, f32>, vec<4, f32>, bool) -> vec<4, f32> +fn select_713567() { + var res: vec4 = select(vec4(1.f), vec4(1.f), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_713567(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_713567(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_713567(); +} diff --git a/test/tint/builtins/gen/literal/select/713567.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2c69a8563 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_713567() { + float4 res = (true ? (1.0f).xxxx : (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_713567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_713567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_713567(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/713567.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2c69a8563 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_713567() { + float4 res = (true ? (1.0f).xxxx : (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_713567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_713567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_713567(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/713567.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.glsl new file mode 100644 index 0000000000..9246c39463 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_713567() { + vec4 res = (true ? vec4(1.0f) : vec4(1.0f)); +} + +vec4 vertex_main() { + select_713567(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_713567() { + vec4 res = (true ? vec4(1.0f) : vec4(1.0f)); +} + +void fragment_main() { + select_713567(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_713567() { + vec4 res = (true ? vec4(1.0f) : vec4(1.0f)); +} + +void compute_main() { + select_713567(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/713567.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.msl new file mode 100644 index 0000000000..ea28af2c24 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_713567() { + float4 res = select(float4(1.0f), float4(1.0f), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_713567(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_713567(); + return; +} + +kernel void compute_main() { + select_713567(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/713567.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.spvasm new file mode 100644 index 0000000000..6c41ce14ef --- /dev/null +++ b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_713567 "select_713567" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %21 = OpConstantNull %v4bool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %v4float +%select_713567 = OpFunction %void None %9 + %12 = OpLabel + %19 = OpVariable %_ptr_Function_v4bool Function %21 + %res = OpVariable %_ptr_Function_v4float Function %5 + %22 = OpCompositeConstruct %v4bool %true %true %true %true + %13 = OpSelect %v4float %22 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_713567 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %select_713567 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %select_713567 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/713567.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.wgsl new file mode 100644 index 0000000000..d5f975b41c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/713567.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_713567() { + var res : vec4 = select(vec4(1.0f), vec4(1.0f), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_713567(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_713567(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_713567(); +} diff --git a/test/tint/builtins/gen/literal/select/78be5f.wgsl b/test/tint/builtins/gen/literal/select/78be5f.wgsl new file mode 100644 index 0000000000..30364d3504 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/78be5f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, f32>, vec<3, f32>, bool) -> vec<3, f32> +fn select_78be5f() { + var res: vec3 = select(vec3(1.f), vec3(1.f), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_78be5f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_78be5f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_78be5f(); +} diff --git a/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a49ff2fb42 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_78be5f() { + float3 res = (true ? (1.0f).xxx : (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_78be5f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_78be5f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_78be5f(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a49ff2fb42 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_78be5f() { + float3 res = (true ? (1.0f).xxx : (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_78be5f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_78be5f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_78be5f(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.glsl new file mode 100644 index 0000000000..139ca165c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_78be5f() { + vec3 res = (true ? vec3(1.0f) : vec3(1.0f)); +} + +vec4 vertex_main() { + select_78be5f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_78be5f() { + vec3 res = (true ? vec3(1.0f) : vec3(1.0f)); +} + +void fragment_main() { + select_78be5f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_78be5f() { + vec3 res = (true ? vec3(1.0f) : vec3(1.0f)); +} + +void compute_main() { + select_78be5f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.msl new file mode 100644 index 0000000000..e01f02712b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_78be5f() { + float3 res = select(float3(1.0f), float3(1.0f), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_78be5f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_78be5f(); + return; +} + +kernel void compute_main() { + select_78be5f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.spvasm new file mode 100644 index 0000000000..ce23c7b024 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_78be5f "select_78be5f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %22 = OpConstantNull %v3bool +%_ptr_Function_v3float = OpTypePointer Function %v3float + %26 = OpConstantNull %v3float + %27 = OpTypeFunction %v4float +%select_78be5f = OpFunction %void None %9 + %12 = OpLabel + %20 = OpVariable %_ptr_Function_v3bool Function %22 + %res = OpVariable %_ptr_Function_v3float Function %26 + %23 = OpCompositeConstruct %v3bool %true %true %true + %13 = OpSelect %v3float %23 %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %select_78be5f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_78be5f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_78be5f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.wgsl new file mode 100644 index 0000000000..958852770e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/78be5f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_78be5f() { + var res : vec3 = select(vec3(1.0f), vec3(1.0f), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_78be5f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_78be5f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_78be5f(); +} diff --git a/test/tint/builtins/gen/literal/select/80a9a9.wgsl b/test/tint/builtins/gen/literal/select/80a9a9.wgsl new file mode 100644 index 0000000000..a0f134c9e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/80a9a9.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, bool>, vec<3, bool>, vec<3, bool>) -> vec<3, bool> +fn select_80a9a9() { + var res: vec3 = select(vec3(true), vec3(true), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_80a9a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_80a9a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_80a9a9(); +} diff --git a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b319508739 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_80a9a9() { + bool3 res = ((true).xxx ? (true).xxx : (true).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_80a9a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_80a9a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_80a9a9(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b319508739 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_80a9a9() { + bool3 res = ((true).xxx ? (true).xxx : (true).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_80a9a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_80a9a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_80a9a9(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.glsl new file mode 100644 index 0000000000..e2195563cd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_80a9a9() { + bvec3 res = mix(bvec3(true), bvec3(true), bvec3(true)); +} + +vec4 vertex_main() { + select_80a9a9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_80a9a9() { + bvec3 res = mix(bvec3(true), bvec3(true), bvec3(true)); +} + +void fragment_main() { + select_80a9a9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_80a9a9() { + bvec3 res = mix(bvec3(true), bvec3(true), bvec3(true)); +} + +void compute_main() { + select_80a9a9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.msl new file mode 100644 index 0000000000..f6cc3e5649 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_80a9a9() { + bool3 res = select(bool3(true), bool3(true), bool3(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_80a9a9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_80a9a9(); + return; +} + +kernel void compute_main() { + select_80a9a9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.spvasm new file mode 100644 index 0000000000..0fbf2a154f --- /dev/null +++ b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_80a9a9 "select_80a9a9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %20 = OpConstantNull %v3bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_80a9a9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3bool Function %20 + %13 = OpSelect %v3bool %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %select_80a9a9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %select_80a9a9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %select_80a9a9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.wgsl new file mode 100644 index 0000000000..465edf2fcd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/80a9a9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_80a9a9() { + var res : vec3 = select(vec3(true), vec3(true), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_80a9a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_80a9a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_80a9a9(); +} diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl new file mode 100644 index 0000000000..f1fda9e5a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<4, f16>, vec<4, f16>, bool) -> vec<4, f16> +fn select_830dd9() { + var res: vec4 = select(vec4(f16()), vec4(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_830dd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_830dd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_830dd9(); +} diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3bf576f1cb --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_830dd9() { + vector res = (true ? (float16_t(0.0h)).xxxx : (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_830dd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_830dd9(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..522a9e3ebd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_830dd9() { + vector res = (true ? (float16_t(0.0h)).xxxx : (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_830dd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_830dd9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E721C969A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.glsl new file mode 100644 index 0000000000..69a2b653d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_830dd9() { + f16vec4 res = (true ? f16vec4(0.0hf) : f16vec4(0.0hf)); +} + +vec4 vertex_main() { + select_830dd9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_830dd9() { + f16vec4 res = (true ? f16vec4(0.0hf) : f16vec4(0.0hf)); +} + +void fragment_main() { + select_830dd9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_830dd9() { + f16vec4 res = (true ? f16vec4(0.0hf) : f16vec4(0.0hf)); +} + +void compute_main() { + select_830dd9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.msl new file mode 100644 index 0000000000..f779aebce2 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_830dd9() { + half4 res = select(half4(0.0h), half4(0.0h), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_830dd9(); + return; +} + +kernel void compute_main() { + select_830dd9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.spvasm new file mode 100644 index 0000000000..5dfcbe6249 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_830dd9 "select_830dd9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %18 = OpConstantNull %v4half + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %22 = OpConstantNull %v4bool +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_830dd9 = OpFunction %void None %9 + %12 = OpLabel + %20 = OpVariable %_ptr_Function_v4bool Function %22 + %res = OpVariable %_ptr_Function_v4half Function %18 + %23 = OpCompositeConstruct %v4bool %true %true %true %true + %13 = OpSelect %v4half %23 %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %select_830dd9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_830dd9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_830dd9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.wgsl new file mode 100644 index 0000000000..cb99917b9a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/830dd9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_830dd9() { + var res : vec4 = select(vec4(f16()), vec4(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_830dd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_830dd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_830dd9(); +} diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl new file mode 100644 index 0000000000..0cb4dc050b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<2, f16>, vec<2, f16>, bool) -> vec<2, f16> +fn select_86f9bd() { + var res: vec2 = select(vec2(f16()), vec2(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_86f9bd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_86f9bd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_86f9bd(); +} diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..528ebaf882 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_86f9bd() { + vector res = (true ? (float16_t(0.0h)).xx : (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_86f9bd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_86f9bd(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d789a21fd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_86f9bd() { + vector res = (true ? (float16_t(0.0h)).xx : (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_86f9bd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_86f9bd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021328920540(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.glsl new file mode 100644 index 0000000000..1ee2a35bf4 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_86f9bd() { + f16vec2 res = (true ? f16vec2(0.0hf) : f16vec2(0.0hf)); +} + +vec4 vertex_main() { + select_86f9bd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_86f9bd() { + f16vec2 res = (true ? f16vec2(0.0hf) : f16vec2(0.0hf)); +} + +void fragment_main() { + select_86f9bd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_86f9bd() { + f16vec2 res = (true ? f16vec2(0.0hf) : f16vec2(0.0hf)); +} + +void compute_main() { + select_86f9bd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.msl new file mode 100644 index 0000000000..7b01210106 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_86f9bd() { + half2 res = select(half2(0.0h), half2(0.0h), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_86f9bd(); + return; +} + +kernel void compute_main() { + select_86f9bd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.spvasm new file mode 100644 index 0000000000..410963b624 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_86f9bd "select_86f9bd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %18 = OpConstantNull %v2half + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %22 = OpConstantNull %v2bool +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_86f9bd = OpFunction %void None %9 + %12 = OpLabel + %20 = OpVariable %_ptr_Function_v2bool Function %22 + %res = OpVariable %_ptr_Function_v2half Function %18 + %23 = OpCompositeConstruct %v2bool %true %true + %13 = OpSelect %v2half %23 %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %select_86f9bd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_86f9bd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_86f9bd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.wgsl new file mode 100644 index 0000000000..0454417a50 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/86f9bd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_86f9bd() { + var res : vec2 = select(vec2(f16()), vec2(f16()), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_86f9bd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_86f9bd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_86f9bd(); +} diff --git a/test/tint/builtins/gen/literal/select/8fa62c.wgsl b/test/tint/builtins/gen/literal/select/8fa62c.wgsl new file mode 100644 index 0000000000..28be629942 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/8fa62c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, i32>, vec<3, i32>, bool) -> vec<3, i32> +fn select_8fa62c() { + var res: vec3 = select(vec3(1), vec3(1), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_8fa62c(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_8fa62c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_8fa62c(); +} diff --git a/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..57f210d3bd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_8fa62c() { + int3 res = (true ? (1).xxx : (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_8fa62c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_8fa62c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_8fa62c(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..57f210d3bd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_8fa62c() { + int3 res = (true ? (1).xxx : (1).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_8fa62c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_8fa62c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_8fa62c(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.glsl new file mode 100644 index 0000000000..4b70835140 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_8fa62c() { + ivec3 res = (true ? ivec3(1) : ivec3(1)); +} + +vec4 vertex_main() { + select_8fa62c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_8fa62c() { + ivec3 res = (true ? ivec3(1) : ivec3(1)); +} + +void fragment_main() { + select_8fa62c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_8fa62c() { + ivec3 res = (true ? ivec3(1) : ivec3(1)); +} + +void compute_main() { + select_8fa62c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.msl new file mode 100644 index 0000000000..7e4ed08e8c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_8fa62c() { + int3 res = select(int3(1), int3(1), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_8fa62c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_8fa62c(); + return; +} + +kernel void compute_main() { + select_8fa62c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.spvasm new file mode 100644 index 0000000000..16dfeac426 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_8fa62c "select_8fa62c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %19 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %23 = OpConstantNull %v3bool +%_ptr_Function_v3int = OpTypePointer Function %v3int + %27 = OpConstantNull %v3int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_8fa62c = OpFunction %void None %9 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v3bool Function %23 + %res = OpVariable %_ptr_Function_v3int Function %27 + %24 = OpCompositeConstruct %v3bool %true %true %true + %13 = OpSelect %v3int %24 %19 %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_8fa62c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_8fa62c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_8fa62c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.wgsl new file mode 100644 index 0000000000..eac241852b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/8fa62c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_8fa62c() { + var res : vec3 = select(vec3(1), vec3(1), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_8fa62c(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_8fa62c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_8fa62c(); +} diff --git a/test/tint/builtins/gen/literal/select/99f883.wgsl b/test/tint/builtins/gen/literal/select/99f883.wgsl new file mode 100644 index 0000000000..ff05e237af --- /dev/null +++ b/test/tint/builtins/gen/literal/select/99f883.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(u32, u32, bool) -> u32 +fn select_99f883() { + var res: u32 = select(1u, 1u, true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_99f883(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_99f883(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_99f883(); +} diff --git a/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..75093f5bd0 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_99f883() { + uint res = (true ? 1u : 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_99f883(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_99f883(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_99f883(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..75093f5bd0 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_99f883() { + uint res = (true ? 1u : 1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_99f883(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_99f883(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_99f883(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.glsl new file mode 100644 index 0000000000..868fe4dbdd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_99f883() { + uint res = (true ? 1u : 1u); +} + +vec4 vertex_main() { + select_99f883(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_99f883() { + uint res = (true ? 1u : 1u); +} + +void fragment_main() { + select_99f883(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_99f883() { + uint res = (true ? 1u : 1u); +} + +void compute_main() { + select_99f883(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.msl new file mode 100644 index 0000000000..2d5afcb05c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_99f883() { + uint res = select(1u, 1u, true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_99f883(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_99f883(); + return; +} + +kernel void compute_main() { + select_99f883(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.spvasm new file mode 100644 index 0000000000..f05c98730b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_99f883 "select_99f883" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %20 = OpConstantNull %uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_99f883 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %20 + %13 = OpSelect %uint %true %uint_1 %uint_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %select_99f883 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %select_99f883 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %select_99f883 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.wgsl new file mode 100644 index 0000000000..03d93941d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/99f883.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_99f883() { + var res : u32 = select(1u, 1u, true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_99f883(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_99f883(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_99f883(); +} diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl new file mode 100644 index 0000000000..9f4e789a0a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<4, f16>, vec<4, f16>, vec<4, bool>) -> vec<4, f16> +fn select_a081f1() { + var res: vec4 = select(vec4(f16()), vec4(f16()), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a081f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a081f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a081f1(); +} diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3eb1517459 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_a081f1() { + vector res = ((true).xxxx ? (float16_t(0.0h)).xxxx : (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a081f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a081f1(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..651eaf722a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_a081f1() { + vector res = ((true).xxxx ? (float16_t(0.0h)).xxxx : (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a081f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a081f1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000202B4A94A10(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.glsl new file mode 100644 index 0000000000..a486535d5c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_a081f1() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), bvec4(true)); +} + +vec4 vertex_main() { + select_a081f1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_a081f1() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), bvec4(true)); +} + +void fragment_main() { + select_a081f1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_a081f1() { + f16vec4 res = mix(f16vec4(0.0hf), f16vec4(0.0hf), bvec4(true)); +} + +void compute_main() { + select_a081f1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.msl new file mode 100644 index 0000000000..fddeb4d432 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_a081f1() { + half4 res = select(half4(0.0h), half4(0.0h), bool4(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_a081f1(); + return; +} + +kernel void compute_main() { + select_a081f1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.spvasm new file mode 100644 index 0000000000..37e70c6c25 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_a081f1 "select_a081f1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v4bool %true %true %true %true + %20 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_a081f1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %20 + %13 = OpSelect %v4half %19 %20 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %select_a081f1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_a081f1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_a081f1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.wgsl new file mode 100644 index 0000000000..feefad7fcf --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a081f1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_a081f1() { + var res : vec4 = select(vec4(f16()), vec4(f16()), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a081f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a081f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a081f1(); +} diff --git a/test/tint/builtins/gen/literal/select/a2860e.wgsl b/test/tint/builtins/gen/literal/select/a2860e.wgsl new file mode 100644 index 0000000000..254e001129 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a2860e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, i32>, vec<4, i32>, vec<4, bool>) -> vec<4, i32> +fn select_a2860e() { + var res: vec4 = select(vec4(1), vec4(1), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a2860e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a2860e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a2860e(); +} diff --git a/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e87fb0a1a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_a2860e() { + int4 res = ((true).xxxx ? (1).xxxx : (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a2860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a2860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a2860e(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e87fb0a1a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_a2860e() { + int4 res = ((true).xxxx ? (1).xxxx : (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a2860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a2860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a2860e(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.glsl new file mode 100644 index 0000000000..c323c86db8 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_a2860e() { + ivec4 res = mix(ivec4(1), ivec4(1), bvec4(true)); +} + +vec4 vertex_main() { + select_a2860e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_a2860e() { + ivec4 res = mix(ivec4(1), ivec4(1), bvec4(true)); +} + +void fragment_main() { + select_a2860e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_a2860e() { + ivec4 res = mix(ivec4(1), ivec4(1), bvec4(true)); +} + +void compute_main() { + select_a2860e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.msl new file mode 100644 index 0000000000..b81f26a13c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_a2860e() { + int4 res = select(int4(1), int4(1), bool4(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_a2860e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_a2860e(); + return; +} + +kernel void compute_main() { + select_a2860e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.spvasm new file mode 100644 index 0000000000..be8a0ca84a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_a2860e "select_a2860e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v4bool %true %true %true %true + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %24 = OpConstantNull %v4int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_a2860e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %24 + %13 = OpSelect %v4int %19 %21 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_a2860e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_a2860e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_a2860e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.wgsl new file mode 100644 index 0000000000..b489567c13 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/a2860e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_a2860e() { + var res : vec4 = select(vec4(1), vec4(1), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a2860e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a2860e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a2860e(); +} diff --git a/test/tint/builtins/gen/literal/select/ab069f.wgsl b/test/tint/builtins/gen/literal/select/ab069f.wgsl new file mode 100644 index 0000000000..d75ba257ea --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ab069f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, i32>, vec<4, i32>, bool) -> vec<4, i32> +fn select_ab069f() { + var res: vec4 = select(vec4(1), vec4(1), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ab069f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ab069f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ab069f(); +} diff --git a/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7436b53f24 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_ab069f() { + int4 res = (true ? (1).xxxx : (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ab069f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ab069f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ab069f(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7436b53f24 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_ab069f() { + int4 res = (true ? (1).xxxx : (1).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ab069f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ab069f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ab069f(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.glsl new file mode 100644 index 0000000000..5de0446c6c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_ab069f() { + ivec4 res = (true ? ivec4(1) : ivec4(1)); +} + +vec4 vertex_main() { + select_ab069f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_ab069f() { + ivec4 res = (true ? ivec4(1) : ivec4(1)); +} + +void fragment_main() { + select_ab069f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_ab069f() { + ivec4 res = (true ? ivec4(1) : ivec4(1)); +} + +void compute_main() { + select_ab069f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.msl new file mode 100644 index 0000000000..fe40e00cd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_ab069f() { + int4 res = select(int4(1), int4(1), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ab069f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ab069f(); + return; +} + +kernel void compute_main() { + select_ab069f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.spvasm new file mode 100644 index 0000000000..5714961423 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ab069f "select_ab069f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %19 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %23 = OpConstantNull %v4bool +%_ptr_Function_v4int = OpTypePointer Function %v4int + %27 = OpConstantNull %v4int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ab069f = OpFunction %void None %9 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v4bool Function %23 + %res = OpVariable %_ptr_Function_v4int Function %27 + %24 = OpCompositeConstruct %v4bool %true %true %true %true + %13 = OpSelect %v4int %24 %19 %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_ab069f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_ab069f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_ab069f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.wgsl new file mode 100644 index 0000000000..a07860c1fe --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ab069f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_ab069f() { + var res : vec4 = select(vec4(1), vec4(1), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ab069f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ab069f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ab069f(); +} diff --git a/test/tint/builtins/gen/literal/select/b04721.wgsl b/test/tint/builtins/gen/literal/select/b04721.wgsl new file mode 100644 index 0000000000..d4668a5139 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/b04721.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, u32>, vec<3, u32>, bool) -> vec<3, u32> +fn select_b04721() { + var res: vec3 = select(vec3(1u), vec3(1u), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_b04721(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_b04721(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_b04721(); +} diff --git a/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d48819734b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_b04721() { + uint3 res = (true ? (1u).xxx : (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_b04721(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_b04721(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_b04721(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d48819734b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_b04721() { + uint3 res = (true ? (1u).xxx : (1u).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_b04721(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_b04721(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_b04721(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.glsl new file mode 100644 index 0000000000..bfc7dcf0d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_b04721() { + uvec3 res = (true ? uvec3(1u) : uvec3(1u)); +} + +vec4 vertex_main() { + select_b04721(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_b04721() { + uvec3 res = (true ? uvec3(1u) : uvec3(1u)); +} + +void fragment_main() { + select_b04721(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_b04721() { + uvec3 res = (true ? uvec3(1u) : uvec3(1u)); +} + +void compute_main() { + select_b04721(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.msl new file mode 100644 index 0000000000..03c0349c5a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_b04721() { + uint3 res = select(uint3(1u), uint3(1u), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_b04721(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_b04721(); + return; +} + +kernel void compute_main() { + select_b04721(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.spvasm new file mode 100644 index 0000000000..5508f4d8ee --- /dev/null +++ b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_b04721 "select_b04721" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %19 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %23 = OpConstantNull %v3bool +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %27 = OpConstantNull %v3uint + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_b04721 = OpFunction %void None %9 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v3bool Function %23 + %res = OpVariable %_ptr_Function_v3uint Function %27 + %24 = OpCompositeConstruct %v3bool %true %true %true + %13 = OpSelect %v3uint %24 %19 %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_b04721 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_b04721 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_b04721 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.wgsl new file mode 100644 index 0000000000..f44d059c2c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/b04721.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_b04721() { + var res : vec3 = select(vec3(1u), vec3(1u), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_b04721(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_b04721(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_b04721(); +} diff --git a/test/tint/builtins/gen/literal/select/bb447f.wgsl b/test/tint/builtins/gen/literal/select/bb447f.wgsl new file mode 100644 index 0000000000..0e12aac4ed --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb447f.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, i32>, vec<2, i32>, bool) -> vec<2, i32> +fn select_bb447f() { + var res: vec2 = select(vec2(1), vec2(1), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bb447f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bb447f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bb447f(); +} diff --git a/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0b807d377b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_bb447f() { + int2 res = (true ? (1).xx : (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb447f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb447f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb447f(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0b807d377b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_bb447f() { + int2 res = (true ? (1).xx : (1).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb447f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb447f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb447f(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.glsl new file mode 100644 index 0000000000..e0e4446deb --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_bb447f() { + ivec2 res = (true ? ivec2(1) : ivec2(1)); +} + +vec4 vertex_main() { + select_bb447f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_bb447f() { + ivec2 res = (true ? ivec2(1) : ivec2(1)); +} + +void fragment_main() { + select_bb447f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_bb447f() { + ivec2 res = (true ? ivec2(1) : ivec2(1)); +} + +void compute_main() { + select_bb447f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.msl new file mode 100644 index 0000000000..a1349a485b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_bb447f() { + int2 res = select(int2(1), int2(1), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_bb447f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_bb447f(); + return; +} + +kernel void compute_main() { + select_bb447f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.spvasm new file mode 100644 index 0000000000..a45e966c98 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_bb447f "select_bb447f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %19 = OpConstantComposite %v2int %int_1 %int_1 + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %23 = OpConstantNull %v2bool +%_ptr_Function_v2int = OpTypePointer Function %v2int + %27 = OpConstantNull %v2int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_bb447f = OpFunction %void None %9 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v2bool Function %23 + %res = OpVariable %_ptr_Function_v2int Function %27 + %24 = OpCompositeConstruct %v2bool %true %true + %13 = OpSelect %v2int %24 %19 %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_bb447f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_bb447f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_bb447f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.wgsl new file mode 100644 index 0000000000..7bbbcf6dba --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb447f.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_bb447f() { + var res : vec2 = select(vec2(1), vec2(1), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bb447f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bb447f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bb447f(); +} diff --git a/test/tint/builtins/gen/literal/select/bb8aae.wgsl b/test/tint/builtins/gen/literal/select/bb8aae.wgsl new file mode 100644 index 0000000000..29082c5782 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb8aae.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, f32>, vec<4, f32>, vec<4, bool>) -> vec<4, f32> +fn select_bb8aae() { + var res: vec4 = select(vec4(1.f), vec4(1.f), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bb8aae(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bb8aae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bb8aae(); +} diff --git a/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9d696b5e13 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_bb8aae() { + float4 res = ((true).xxxx ? (1.0f).xxxx : (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb8aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb8aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb8aae(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9d696b5e13 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_bb8aae() { + float4 res = ((true).xxxx ? (1.0f).xxxx : (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb8aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb8aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb8aae(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.glsl new file mode 100644 index 0000000000..5509024aa3 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_bb8aae() { + vec4 res = mix(vec4(1.0f), vec4(1.0f), bvec4(true)); +} + +vec4 vertex_main() { + select_bb8aae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_bb8aae() { + vec4 res = mix(vec4(1.0f), vec4(1.0f), bvec4(true)); +} + +void fragment_main() { + select_bb8aae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_bb8aae() { + vec4 res = mix(vec4(1.0f), vec4(1.0f), bvec4(true)); +} + +void compute_main() { + select_bb8aae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.msl new file mode 100644 index 0000000000..b165f0ca81 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_bb8aae() { + float4 res = select(float4(1.0f), float4(1.0f), bool4(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_bb8aae(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_bb8aae(); + return; +} + +kernel void compute_main() { + select_bb8aae(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.spvasm new file mode 100644 index 0000000000..32b22cd8e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_bb8aae "select_bb8aae" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v4bool %true %true %true %true + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %22 = OpTypeFunction %v4float +%select_bb8aae = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpSelect %v4float %17 %19 %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %select_bb8aae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %select_bb8aae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %select_bb8aae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.wgsl new file mode 100644 index 0000000000..b2f2620748 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bb8aae.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_bb8aae() { + var res : vec4 = select(vec4(1.0f), vec4(1.0f), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bb8aae(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bb8aae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bb8aae(); +} diff --git a/test/tint/builtins/gen/literal/select/bf3d29.wgsl b/test/tint/builtins/gen/literal/select/bf3d29.wgsl new file mode 100644 index 0000000000..10f2bf0148 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bf3d29.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, f32>, vec<2, f32>, bool) -> vec<2, f32> +fn select_bf3d29() { + var res: vec2 = select(vec2(1.f), vec2(1.f), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bf3d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bf3d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bf3d29(); +} diff --git a/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee028a12bd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_bf3d29() { + float2 res = (true ? (1.0f).xx : (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bf3d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bf3d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bf3d29(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ee028a12bd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_bf3d29() { + float2 res = (true ? (1.0f).xx : (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bf3d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bf3d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bf3d29(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.glsl new file mode 100644 index 0000000000..a51f6f3e46 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_bf3d29() { + vec2 res = (true ? vec2(1.0f) : vec2(1.0f)); +} + +vec4 vertex_main() { + select_bf3d29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_bf3d29() { + vec2 res = (true ? vec2(1.0f) : vec2(1.0f)); +} + +void fragment_main() { + select_bf3d29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_bf3d29() { + vec2 res = (true ? vec2(1.0f) : vec2(1.0f)); +} + +void compute_main() { + select_bf3d29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.msl new file mode 100644 index 0000000000..6989bc14fe --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_bf3d29() { + float2 res = select(float2(1.0f), float2(1.0f), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_bf3d29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_bf3d29(); + return; +} + +kernel void compute_main() { + select_bf3d29(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.spvasm new file mode 100644 index 0000000000..6c9333f5d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_bf3d29 "select_bf3d29" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v2float %float_1 %float_1 + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %22 = OpConstantNull %v2bool +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %27 = OpTypeFunction %v4float +%select_bf3d29 = OpFunction %void None %9 + %12 = OpLabel + %20 = OpVariable %_ptr_Function_v2bool Function %22 + %res = OpVariable %_ptr_Function_v2float Function %26 + %23 = OpCompositeConstruct %v2bool %true %true + %13 = OpSelect %v2float %23 %18 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %select_bf3d29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_bf3d29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_bf3d29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.wgsl new file mode 100644 index 0000000000..d6877c8650 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/bf3d29.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_bf3d29() { + var res : vec2 = select(vec2(1.0f), vec2(1.0f), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bf3d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bf3d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bf3d29(); +} diff --git a/test/tint/builtins/gen/literal/select/c31f9e.wgsl b/test/tint/builtins/gen/literal/select/c31f9e.wgsl new file mode 100644 index 0000000000..d875f11324 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c31f9e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(bool, bool, bool) -> bool +fn select_c31f9e() { + var res: bool = select(true, true, true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c31f9e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c31f9e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c31f9e(); +} diff --git a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..69c808e426 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_c31f9e() { + bool res = (true ? true : true); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c31f9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c31f9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c31f9e(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..69c808e426 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_c31f9e() { + bool res = (true ? true : true); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c31f9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c31f9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c31f9e(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.glsl new file mode 100644 index 0000000000..0ef947ba23 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_c31f9e() { + bool res = (true ? true : true); +} + +vec4 vertex_main() { + select_c31f9e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_c31f9e() { + bool res = (true ? true : true); +} + +void fragment_main() { + select_c31f9e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_c31f9e() { + bool res = (true ? true : true); +} + +void compute_main() { + select_c31f9e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.msl new file mode 100644 index 0000000000..bb2e033e6a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_c31f9e() { + bool res = select(true, true, true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_c31f9e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_c31f9e(); + return; +} + +kernel void compute_main() { + select_c31f9e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb10e96c32 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_c31f9e "select_c31f9e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_c31f9e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_bool Function %18 + %13 = OpSelect %bool %true %true %true + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %select_c31f9e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %select_c31f9e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %select_c31f9e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.wgsl new file mode 100644 index 0000000000..2632b11712 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c31f9e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_c31f9e() { + var res : bool = select(true, true, true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c31f9e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c31f9e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c31f9e(); +} diff --git a/test/tint/builtins/gen/literal/select/c41bd1.wgsl b/test/tint/builtins/gen/literal/select/c41bd1.wgsl new file mode 100644 index 0000000000..5ca5e1d782 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c41bd1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, bool>, vec<4, bool>, bool) -> vec<4, bool> +fn select_c41bd1() { + var res: vec4 = select(vec4(true), vec4(true), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c41bd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c41bd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c41bd1(); +} diff --git a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ccdd95864a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_c41bd1() { + bool4 res = (true ? (true).xxxx : (true).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c41bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c41bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c41bd1(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ccdd95864a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_c41bd1() { + bool4 res = (true ? (true).xxxx : (true).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c41bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c41bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c41bd1(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.glsl new file mode 100644 index 0000000000..c31ed7a184 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_c41bd1() { + bvec4 res = (true ? bvec4(true) : bvec4(true)); +} + +vec4 vertex_main() { + select_c41bd1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_c41bd1() { + bvec4 res = (true ? bvec4(true) : bvec4(true)); +} + +void fragment_main() { + select_c41bd1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_c41bd1() { + bvec4 res = (true ? bvec4(true) : bvec4(true)); +} + +void compute_main() { + select_c41bd1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.msl new file mode 100644 index 0000000000..dc9b3b9d77 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_c41bd1() { + bool4 res = select(bool4(true), bool4(true), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_c41bd1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_c41bd1(); + return; +} + +kernel void compute_main() { + select_c41bd1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.spvasm new file mode 100644 index 0000000000..b81194c8d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_c41bd1 "select_c41bd1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %20 = OpConstantNull %v4bool + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_c41bd1 = OpFunction %void None %9 + %12 = OpLabel + %18 = OpVariable %_ptr_Function_v4bool Function %20 + %res = OpVariable %_ptr_Function_v4bool Function %20 + %21 = OpCompositeConstruct %v4bool %true %true %true %true + %13 = OpSelect %v4bool %21 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %select_c41bd1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_c41bd1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_c41bd1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.wgsl new file mode 100644 index 0000000000..48cb1c9244 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c41bd1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_c41bd1() { + var res : vec4 = select(vec4(true), vec4(true), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c41bd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c41bd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c41bd1(); +} diff --git a/test/tint/builtins/gen/literal/select/c4a4ef.wgsl b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl new file mode 100644 index 0000000000..212d1654a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, u32>, vec<4, u32>, vec<4, bool>) -> vec<4, u32> +fn select_c4a4ef() { + var res: vec4 = select(vec4(1u), vec4(1u), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c4a4ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c4a4ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c4a4ef(); +} diff --git a/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c309f05b9a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_c4a4ef() { + uint4 res = ((true).xxxx ? (1u).xxxx : (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c4a4ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c4a4ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c4a4ef(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c309f05b9a --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_c4a4ef() { + uint4 res = ((true).xxxx ? (1u).xxxx : (1u).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c4a4ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c4a4ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c4a4ef(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.glsl new file mode 100644 index 0000000000..bb831d6141 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_c4a4ef() { + uvec4 res = mix(uvec4(1u), uvec4(1u), bvec4(true)); +} + +vec4 vertex_main() { + select_c4a4ef(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_c4a4ef() { + uvec4 res = mix(uvec4(1u), uvec4(1u), bvec4(true)); +} + +void fragment_main() { + select_c4a4ef(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_c4a4ef() { + uvec4 res = mix(uvec4(1u), uvec4(1u), bvec4(true)); +} + +void compute_main() { + select_c4a4ef(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.msl new file mode 100644 index 0000000000..0a7ea61a66 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_c4a4ef() { + uint4 res = select(uint4(1u), uint4(1u), bool4(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_c4a4ef(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_c4a4ef(); + return; +} + +kernel void compute_main() { + select_c4a4ef(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..83779278aa --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_c4a4ef "select_c4a4ef" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v4bool %true %true %true %true + %uint_1 = OpConstant %uint 1 + %21 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %24 = OpConstantNull %v4uint + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_c4a4ef = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %24 + %13 = OpSelect %v4uint %19 %21 %21 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_c4a4ef + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_c4a4ef + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_c4a4ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..6ffda61721 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/c4a4ef.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_c4a4ef() { + var res : vec4 = select(vec4(1u), vec4(1u), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c4a4ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c4a4ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c4a4ef(); +} diff --git a/test/tint/builtins/gen/literal/select/cb9301.wgsl b/test/tint/builtins/gen/literal/select/cb9301.wgsl new file mode 100644 index 0000000000..af1dfa9d3f --- /dev/null +++ b/test/tint/builtins/gen/literal/select/cb9301.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, bool>, vec<2, bool>, vec<2, bool>) -> vec<2, bool> +fn select_cb9301() { + var res: vec2 = select(vec2(true), vec2(true), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_cb9301(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_cb9301(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_cb9301(); +} diff --git a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..93fbebcd58 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_cb9301() { + bool2 res = ((true).xx ? (true).xx : (true).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_cb9301(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_cb9301(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_cb9301(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..93fbebcd58 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_cb9301() { + bool2 res = ((true).xx ? (true).xx : (true).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_cb9301(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_cb9301(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_cb9301(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.glsl new file mode 100644 index 0000000000..5737cf4959 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_cb9301() { + bvec2 res = mix(bvec2(true), bvec2(true), bvec2(true)); +} + +vec4 vertex_main() { + select_cb9301(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_cb9301() { + bvec2 res = mix(bvec2(true), bvec2(true), bvec2(true)); +} + +void fragment_main() { + select_cb9301(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_cb9301() { + bvec2 res = mix(bvec2(true), bvec2(true), bvec2(true)); +} + +void compute_main() { + select_cb9301(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.msl new file mode 100644 index 0000000000..b3a7fb1a3e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_cb9301() { + bool2 res = select(bool2(true), bool2(true), bool2(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_cb9301(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_cb9301(); + return; +} + +kernel void compute_main() { + select_cb9301(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.spvasm new file mode 100644 index 0000000000..7e893d3669 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_cb9301 "select_cb9301" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %20 = OpConstantNull %v2bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_cb9301 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2bool Function %20 + %13 = OpSelect %v2bool %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %select_cb9301 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %select_cb9301 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %select_cb9301 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.wgsl new file mode 100644 index 0000000000..57a01d2e0c --- /dev/null +++ b/test/tint/builtins/gen/literal/select/cb9301.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_cb9301() { + var res : vec2 = select(vec2(true), vec2(true), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_cb9301(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_cb9301(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_cb9301(); +} diff --git a/test/tint/builtins/gen/literal/select/e3e028.wgsl b/test/tint/builtins/gen/literal/select/e3e028.wgsl new file mode 100644 index 0000000000..9d6f92d967 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/e3e028.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, bool>, vec<4, bool>, vec<4, bool>) -> vec<4, bool> +fn select_e3e028() { + var res: vec4 = select(vec4(true), vec4(true), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_e3e028(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_e3e028(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_e3e028(); +} diff --git a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0876d282d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_e3e028() { + bool4 res = ((true).xxxx ? (true).xxxx : (true).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_e3e028(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_e3e028(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_e3e028(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0876d282d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_e3e028() { + bool4 res = ((true).xxxx ? (true).xxxx : (true).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_e3e028(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_e3e028(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_e3e028(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.glsl new file mode 100644 index 0000000000..a28a0395e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_e3e028() { + bvec4 res = mix(bvec4(true), bvec4(true), bvec4(true)); +} + +vec4 vertex_main() { + select_e3e028(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_e3e028() { + bvec4 res = mix(bvec4(true), bvec4(true), bvec4(true)); +} + +void fragment_main() { + select_e3e028(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_e3e028() { + bvec4 res = mix(bvec4(true), bvec4(true), bvec4(true)); +} + +void compute_main() { + select_e3e028(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.msl new file mode 100644 index 0000000000..d25a5ae2d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_e3e028() { + bool4 res = select(bool4(true), bool4(true), bool4(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_e3e028(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_e3e028(); + return; +} + +kernel void compute_main() { + select_e3e028(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.spvasm new file mode 100644 index 0000000000..bbfa5e16a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_e3e028 "select_e3e028" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %20 = OpConstantNull %v4bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_e3e028 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4bool Function %20 + %13 = OpSelect %v4bool %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %select_e3e028 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %select_e3e028 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %select_e3e028 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.wgsl new file mode 100644 index 0000000000..1794fd6117 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/e3e028.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_e3e028() { + var res : vec4 = select(vec4(true), vec4(true), vec4(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_e3e028(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_e3e028(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_e3e028(); +} diff --git a/test/tint/builtins/gen/literal/select/ebfea2.wgsl b/test/tint/builtins/gen/literal/select/ebfea2.wgsl new file mode 100644 index 0000000000..4424017fc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ebfea2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, f32>, vec<3, f32>, vec<3, bool>) -> vec<3, f32> +fn select_ebfea2() { + var res: vec3 = select(vec3(1.f), vec3(1.f), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ebfea2(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ebfea2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ebfea2(); +} diff --git a/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2bb8831ed0 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_ebfea2() { + float3 res = ((true).xxx ? (1.0f).xxx : (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ebfea2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ebfea2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ebfea2(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2bb8831ed0 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_ebfea2() { + float3 res = ((true).xxx ? (1.0f).xxx : (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ebfea2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ebfea2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ebfea2(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.glsl new file mode 100644 index 0000000000..1fa1c53faa --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_ebfea2() { + vec3 res = mix(vec3(1.0f), vec3(1.0f), bvec3(true)); +} + +vec4 vertex_main() { + select_ebfea2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_ebfea2() { + vec3 res = mix(vec3(1.0f), vec3(1.0f), bvec3(true)); +} + +void fragment_main() { + select_ebfea2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_ebfea2() { + vec3 res = mix(vec3(1.0f), vec3(1.0f), bvec3(true)); +} + +void compute_main() { + select_ebfea2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.msl new file mode 100644 index 0000000000..5d62fd1734 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_ebfea2() { + float3 res = select(float3(1.0f), float3(1.0f), bool3(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ebfea2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ebfea2(); + return; +} + +kernel void compute_main() { + select_ebfea2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6e0c0316b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ebfea2 "select_ebfea2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %18 = OpConstantComposite %v3bool %true %true %true + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpConstantNull %v3float + %24 = OpTypeFunction %v4float +%select_ebfea2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %23 + %13 = OpSelect %v3float %18 %20 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %select_ebfea2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_ebfea2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_ebfea2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.wgsl new file mode 100644 index 0000000000..7586aab56e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ebfea2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_ebfea2() { + var res : vec3 = select(vec3(1.0f), vec3(1.0f), vec3(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ebfea2(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ebfea2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ebfea2(); +} diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl new file mode 100644 index 0000000000..1d862f657b --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<2, f16>, vec<2, f16>, vec<2, bool>) -> vec<2, f16> +fn select_ed7c13() { + var res: vec2 = select(vec2(f16()), vec2(f16()), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed7c13(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed7c13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed7c13(); +} diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1db2ca48d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_ed7c13() { + vector res = ((true).xx ? (float16_t(0.0h)).xx : (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed7c13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed7c13(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0006a34c2e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void select_ed7c13() { + vector res = ((true).xx ? (float16_t(0.0h)).xx : (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed7c13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed7c13(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024686E0D4B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.glsl new file mode 100644 index 0000000000..3e0564b2f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_ed7c13() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), bvec2(true)); +} + +vec4 vertex_main() { + select_ed7c13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_ed7c13() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), bvec2(true)); +} + +void fragment_main() { + select_ed7c13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_ed7c13() { + f16vec2 res = mix(f16vec2(0.0hf), f16vec2(0.0hf), bvec2(true)); +} + +void compute_main() { + select_ed7c13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.msl new file mode 100644 index 0000000000..172c6dd67d --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_ed7c13() { + half2 res = select(half2(0.0h), half2(0.0h), bool2(true)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ed7c13(); + return; +} + +kernel void compute_main() { + select_ed7c13(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.spvasm new file mode 100644 index 0000000000..3112c00a14 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ed7c13 "select_ed7c13" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %19 = OpConstantComposite %v2bool %true %true + %20 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ed7c13 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %20 + %13 = OpSelect %v2half %19 %20 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %select_ed7c13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_ed7c13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_ed7c13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.wgsl new file mode 100644 index 0000000000..427fba2d5e --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed7c13.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn select_ed7c13() { + var res : vec2 = select(vec2(f16()), vec2(f16()), vec2(true)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed7c13(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed7c13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed7c13(); +} diff --git a/test/tint/builtins/gen/literal/select/ed8a15.wgsl b/test/tint/builtins/gen/literal/select/ed8a15.wgsl new file mode 100644 index 0000000000..df63996cbd --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed8a15.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(i32, i32, bool) -> i32 +fn select_ed8a15() { + var res: i32 = select(1, 1, true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed8a15(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed8a15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed8a15(); +} diff --git a/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..204bba2277 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_ed8a15() { + int res = (true ? 1 : 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed8a15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed8a15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed8a15(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..204bba2277 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_ed8a15() { + int res = (true ? 1 : 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed8a15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed8a15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed8a15(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.glsl new file mode 100644 index 0000000000..b89c5848c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_ed8a15() { + int res = (true ? 1 : 1); +} + +vec4 vertex_main() { + select_ed8a15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_ed8a15() { + int res = (true ? 1 : 1); +} + +void fragment_main() { + select_ed8a15(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_ed8a15() { + int res = (true ? 1 : 1); +} + +void compute_main() { + select_ed8a15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.msl new file mode 100644 index 0000000000..159410ebc1 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_ed8a15() { + int res = select(1, 1, true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ed8a15(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ed8a15(); + return; +} + +kernel void compute_main() { + select_ed8a15(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.spvasm new file mode 100644 index 0000000000..5dc45bf82d --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ed8a15 "select_ed8a15" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ed8a15 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %13 = OpSelect %int %true %int_1 %int_1 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %select_ed8a15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %select_ed8a15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %select_ed8a15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.wgsl new file mode 100644 index 0000000000..2db78b319d --- /dev/null +++ b/test/tint/builtins/gen/literal/select/ed8a15.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_ed8a15() { + var res : i32 = select(1, 1, true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed8a15(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed8a15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed8a15(); +} diff --git a/test/tint/builtins/gen/literal/select/fb7e53.wgsl b/test/tint/builtins/gen/literal/select/fb7e53.wgsl new file mode 100644 index 0000000000..cf44f0aae1 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/fb7e53.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, bool>, vec<2, bool>, bool) -> vec<2, bool> +fn select_fb7e53() { + var res: vec2 = select(vec2(true), vec2(true), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_fb7e53(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_fb7e53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_fb7e53(); +} diff --git a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..09a9f42430 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void select_fb7e53() { + bool2 res = (true ? (true).xx : (true).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_fb7e53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_fb7e53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_fb7e53(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..09a9f42430 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void select_fb7e53() { + bool2 res = (true ? (true).xx : (true).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_fb7e53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_fb7e53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_fb7e53(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.glsl b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.glsl new file mode 100644 index 0000000000..4f655b8916 --- /dev/null +++ b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void select_fb7e53() { + bvec2 res = (true ? bvec2(true) : bvec2(true)); +} + +vec4 vertex_main() { + select_fb7e53(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_fb7e53() { + bvec2 res = (true ? bvec2(true) : bvec2(true)); +} + +void fragment_main() { + select_fb7e53(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_fb7e53() { + bvec2 res = (true ? bvec2(true) : bvec2(true)); +} + +void compute_main() { + select_fb7e53(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.msl b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.msl new file mode 100644 index 0000000000..f1ba6f0fda --- /dev/null +++ b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void select_fb7e53() { + bool2 res = select(bool2(true), bool2(true), true); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_fb7e53(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_fb7e53(); + return; +} + +kernel void compute_main() { + select_fb7e53(); + return; +} + diff --git a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b6deab35f --- /dev/null +++ b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_fb7e53 "select_fb7e53" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %17 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %20 = OpConstantNull %v2bool + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_fb7e53 = OpFunction %void None %9 + %12 = OpLabel + %18 = OpVariable %_ptr_Function_v2bool Function %20 + %res = OpVariable %_ptr_Function_v2bool Function %20 + %21 = OpCompositeConstruct %v2bool %true %true + %13 = OpSelect %v2bool %21 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %select_fb7e53 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %select_fb7e53 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_fb7e53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.wgsl new file mode 100644 index 0000000000..d5061488bb --- /dev/null +++ b/test/tint/builtins/gen/literal/select/fb7e53.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn select_fb7e53() { + var res : vec2 = select(vec2(true), vec2(true), true); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_fb7e53(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_fb7e53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_fb7e53(); +} diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl b/test/tint/builtins/gen/literal/sign/159665.wgsl new file mode 100644 index 0000000000..6beef49e2e --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/159665.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(vec<3, f32>) -> vec<3, f32> +fn sign_159665() { + var res: vec3 = sign(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_159665(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_159665(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_159665(); +} diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0ab4fc738b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_159665() { + float3 res = sign((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_159665(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_159665(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_159665(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0ab4fc738b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sign_159665() { + float3 res = sign((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_159665(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_159665(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_159665(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.glsl new file mode 100644 index 0000000000..821e964379 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sign_159665() { + vec3 res = sign(vec3(1.0f)); +} + +vec4 vertex_main() { + sign_159665(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_159665() { + vec3 res = sign(vec3(1.0f)); +} + +void fragment_main() { + sign_159665(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_159665() { + vec3 res = sign(vec3(1.0f)); +} + +void compute_main() { + sign_159665(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.msl new file mode 100644 index 0000000000..d8f87fe5e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_159665() { + float3 res = sign(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_159665(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_159665(); + return; +} + +kernel void compute_main() { + sign_159665(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.spvasm new file mode 100644 index 0000000000..360dc6f7a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_159665 "sign_159665" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%sign_159665 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 FSign %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sign_159665 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sign_159665 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sign_159665 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.wgsl new file mode 100644 index 0000000000..d11f696558 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sign_159665() { + var res : vec3 = sign(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_159665(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_159665(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_159665(); +} diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl b/test/tint/builtins/gen/literal/sign/160933.wgsl new file mode 100644 index 0000000000..13a6c3b97c --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<4, f16>) -> vec<4, f16> +fn sign_160933() { + var res: vec4 = sign(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_160933(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_160933(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_160933(); +} diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b8e2784506 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_160933() { + vector res = sign((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_160933(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_160933(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_160933(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b111818e94 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sign_160933() { + vector res = sign((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_160933(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_160933(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_160933(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A1A601ACD0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.glsl new file mode 100644 index 0000000000..23eade5d6f --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_160933() { + f16vec4 res = sign(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + sign_160933(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_160933() { + f16vec4 res = sign(f16vec4(0.0hf)); +} + +void fragment_main() { + sign_160933(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_160933() { + f16vec4 res = sign(f16vec4(0.0hf)); +} + +void compute_main() { + sign_160933(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl new file mode 100644 index 0000000000..faf94eda01 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_160933() { + half4 res = sign(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_160933(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_160933(); + return; +} + +kernel void compute_main() { + sign_160933(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a1664ca13 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_160933 "sign_160933" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_160933 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 FSign %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sign_160933 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sign_160933 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sign_160933 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.wgsl new file mode 100644 index 0000000000..5633954c2c --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sign_160933() { + var res : vec4 = sign(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_160933(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_160933(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_160933(); +} diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl new file mode 100644 index 0000000000..dc23259a5e --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<3, f16>) -> vec<3, f16> +fn sign_5d283a() { + var res: vec3 = sign(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_5d283a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_5d283a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_5d283a(); +} diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0331539bb5 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_5d283a() { + vector res = sign((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_5d283a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_5d283a(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7493bb0e29 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sign_5d283a() { + vector res = sign((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_5d283a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_5d283a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002BE5E5FBCB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.glsl new file mode 100644 index 0000000000..4cda792691 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_5d283a() { + f16vec3 res = sign(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + sign_5d283a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_5d283a() { + f16vec3 res = sign(f16vec3(0.0hf)); +} + +void fragment_main() { + sign_5d283a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_5d283a() { + f16vec3 res = sign(f16vec3(0.0hf)); +} + +void compute_main() { + sign_5d283a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl new file mode 100644 index 0000000000..3ffb6b8b5b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_5d283a() { + half3 res = sign(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_5d283a(); + return; +} + +kernel void compute_main() { + sign_5d283a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.spvasm new file mode 100644 index 0000000000..487c9682f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_5d283a "sign_5d283a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_5d283a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 FSign %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sign_5d283a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sign_5d283a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sign_5d283a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.wgsl new file mode 100644 index 0000000000..754ba8baa0 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sign_5d283a() { + var res : vec3 = sign(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_5d283a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_5d283a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_5d283a(); +} diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl new file mode 100644 index 0000000000..b8d85dca5b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(f16) -> f16 +fn sign_7c85ea() { + var res: f16 = sign(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_7c85ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_7c85ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_7c85ea(); +} diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fa81821bcb --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_7c85ea() { + float16_t res = sign(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_7c85ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_7c85ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6690d62726 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void sign_7c85ea() { + float16_t res = sign(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_7c85ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_7c85ea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A85B767D00(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A85B767D00(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl new file mode 100644 index 0000000000..c49bc28c17 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_7c85ea() { + float16_t res = sign(0.0hf); +} + +vec4 vertex_main() { + sign_7c85ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_7c85ea() { + float16_t res = sign(0.0hf); +} + +void fragment_main() { + sign_7c85ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_7c85ea() { + float16_t res = sign(0.0hf); +} + +void compute_main() { + sign_7c85ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl new file mode 100644 index 0000000000..9f39434dd5 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_7c85ea() { + half res = sign(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_7c85ea(); + return; +} + +kernel void compute_main() { + sign_7c85ea(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..f3a19c03d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_7c85ea "sign_7c85ea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_7c85ea = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 FSign %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sign_7c85ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sign_7c85ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_7c85ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..5080143825 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sign_7c85ea() { + var res : f16 = sign(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_7c85ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_7c85ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_7c85ea(); +} diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl new file mode 100644 index 0000000000..db2d348bd2 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(vec<4, f32>) -> vec<4, f32> +fn sign_b8f634() { + var res: vec4 = sign(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_b8f634(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_b8f634(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_b8f634(); +} diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dfad227d6a --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_b8f634() { + float4 res = sign((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_b8f634(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_b8f634(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_b8f634(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dfad227d6a --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sign_b8f634() { + float4 res = sign((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_b8f634(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_b8f634(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_b8f634(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.glsl new file mode 100644 index 0000000000..85db73f324 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sign_b8f634() { + vec4 res = sign(vec4(1.0f)); +} + +vec4 vertex_main() { + sign_b8f634(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_b8f634() { + vec4 res = sign(vec4(1.0f)); +} + +void fragment_main() { + sign_b8f634(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_b8f634() { + vec4 res = sign(vec4(1.0f)); +} + +void compute_main() { + sign_b8f634(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.msl new file mode 100644 index 0000000000..44f67fba46 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_b8f634() { + float4 res = sign(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_b8f634(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_b8f634(); + return; +} + +kernel void compute_main() { + sign_b8f634(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f785b5ecf --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_b8f634 "sign_b8f634" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%sign_b8f634 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 FSign %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sign_b8f634 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %sign_b8f634 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sign_b8f634 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.wgsl new file mode 100644 index 0000000000..99450856b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sign_b8f634() { + var res : vec4 = sign(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_b8f634(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_b8f634(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_b8f634(); +} diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl new file mode 100644 index 0000000000..169814e40b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<2, f16>) -> vec<2, f16> +fn sign_ccdb3c() { + var res: vec2 = sign(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_ccdb3c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_ccdb3c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_ccdb3c(); +} diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e0c820cec0 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_ccdb3c() { + vector res = sign((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_ccdb3c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_ccdb3c(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a77b50bc6e --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sign_ccdb3c() { + vector res = sign((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_ccdb3c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_ccdb3c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FE218EE9E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.glsl new file mode 100644 index 0000000000..fae505304b --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_ccdb3c() { + f16vec2 res = sign(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + sign_ccdb3c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_ccdb3c() { + f16vec2 res = sign(f16vec2(0.0hf)); +} + +void fragment_main() { + sign_ccdb3c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_ccdb3c() { + f16vec2 res = sign(f16vec2(0.0hf)); +} + +void compute_main() { + sign_ccdb3c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl new file mode 100644 index 0000000000..8df474b1de --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_ccdb3c() { + half2 res = sign(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_ccdb3c(); + return; +} + +kernel void compute_main() { + sign_ccdb3c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.spvasm new file mode 100644 index 0000000000..8366c62671 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_ccdb3c "sign_ccdb3c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_ccdb3c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 FSign %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sign_ccdb3c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sign_ccdb3c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sign_ccdb3c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a5f0ec369 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sign_ccdb3c() { + var res : vec2 = sign(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_ccdb3c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_ccdb3c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_ccdb3c(); +} diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl new file mode 100644 index 0000000000..fa7e535d46 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(vec<2, f32>) -> vec<2, f32> +fn sign_d065d8() { + var res: vec2 = sign(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_d065d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_d065d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_d065d8(); +} diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b7571a84e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_d065d8() { + float2 res = sign((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_d065d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_d065d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_d065d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b7571a84e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sign_d065d8() { + float2 res = sign((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_d065d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_d065d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_d065d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.glsl new file mode 100644 index 0000000000..80e261f924 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sign_d065d8() { + vec2 res = sign(vec2(1.0f)); +} + +vec4 vertex_main() { + sign_d065d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_d065d8() { + vec2 res = sign(vec2(1.0f)); +} + +void fragment_main() { + sign_d065d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_d065d8() { + vec2 res = sign(vec2(1.0f)); +} + +void compute_main() { + sign_d065d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.msl new file mode 100644 index 0000000000..b810a3d023 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_d065d8() { + float2 res = sign(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_d065d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_d065d8(); + return; +} + +kernel void compute_main() { + sign_d065d8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..ff49cd3013 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_d065d8 "sign_d065d8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%sign_d065d8 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 FSign %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sign_d065d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sign_d065d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sign_d065d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd5bb83a70 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sign_d065d8() { + var res : vec2 = sign(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_d065d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_d065d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_d065d8(); +} diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl new file mode 100644 index 0000000000..3de097a02a --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(f32) -> f32 +fn sign_dd790e() { + var res: f32 = sign(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_dd790e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_dd790e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_dd790e(); +} diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a2aaa71581 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sign_dd790e() { + float res = sign(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_dd790e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_dd790e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_dd790e(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a2aaa71581 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sign_dd790e() { + float res = sign(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_dd790e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_dd790e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_dd790e(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.glsl new file mode 100644 index 0000000000..129fd0ea56 --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sign_dd790e() { + float res = sign(1.0f); +} + +vec4 vertex_main() { + sign_dd790e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_dd790e() { + float res = sign(1.0f); +} + +void fragment_main() { + sign_dd790e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_dd790e() { + float res = sign(1.0f); +} + +void compute_main() { + sign_dd790e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.msl new file mode 100644 index 0000000000..a5f99f63cf --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sign_dd790e() { + float res = sign(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_dd790e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_dd790e(); + return; +} + +kernel void compute_main() { + sign_dd790e(); + return; +} + diff --git a/test/tint/builtins/gen/sign/dd790e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/sign/dd790e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.wgsl new file mode 100644 index 0000000000..8a2bc6b52c --- /dev/null +++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sign_dd790e() { + var res : f32 = sign(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_dd790e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_dd790e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_dd790e(); +} diff --git a/test/tint/builtins/gen/literal/sin/01f241.wgsl b/test/tint/builtins/gen/literal/sin/01f241.wgsl new file mode 100644 index 0000000000..3c1c150a42 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/01f241.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(vec<3, f32>) -> vec<3, f32> +fn sin_01f241() { + var res: vec3 = sin(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_01f241(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_01f241(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_01f241(); +} diff --git a/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7593cd8998 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_01f241() { + float3 res = sin((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_01f241(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_01f241(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_01f241(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7593cd8998 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sin_01f241() { + float3 res = sin((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_01f241(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_01f241(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_01f241(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.glsl new file mode 100644 index 0000000000..5fe78bf6f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sin_01f241() { + vec3 res = sin(vec3(1.0f)); +} + +vec4 vertex_main() { + sin_01f241(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_01f241() { + vec3 res = sin(vec3(1.0f)); +} + +void fragment_main() { + sin_01f241(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_01f241() { + vec3 res = sin(vec3(1.0f)); +} + +void compute_main() { + sin_01f241(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.msl new file mode 100644 index 0000000000..197815bf8f --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_01f241() { + float3 res = sin(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_01f241(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_01f241(); + return; +} + +kernel void compute_main() { + sin_01f241(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.spvasm new file mode 100644 index 0000000000..284f417718 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_01f241 "sin_01f241" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %sin_01f241 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Sin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sin_01f241 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sin_01f241 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sin_01f241 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.wgsl new file mode 100644 index 0000000000..cbbca228ac --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/01f241.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sin_01f241() { + var res : vec3 = sin(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_01f241(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_01f241(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_01f241(); +} diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl new file mode 100644 index 0000000000..abe172c90e --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<3, f16>) -> vec<3, f16> +fn sin_2c903b() { + var res: vec3 = sin(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_2c903b(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_2c903b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_2c903b(); +} diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8da2e1c888 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_2c903b() { + vector res = sin((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_2c903b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_2c903b(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b22e7085dc --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sin_2c903b() { + vector res = sin((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_2c903b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_2c903b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000153299087E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.glsl new file mode 100644 index 0000000000..21de9a7b39 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_2c903b() { + f16vec3 res = sin(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + sin_2c903b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_2c903b() { + f16vec3 res = sin(f16vec3(0.0hf)); +} + +void fragment_main() { + sin_2c903b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_2c903b() { + f16vec3 res = sin(f16vec3(0.0hf)); +} + +void compute_main() { + sin_2c903b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.msl new file mode 100644 index 0000000000..85bf223af8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_2c903b() { + half3 res = sin(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_2c903b(); + return; +} + +kernel void compute_main() { + sin_2c903b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.spvasm new file mode 100644 index 0000000000..ad41fb308f --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_2c903b "sin_2c903b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_2c903b = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Sin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sin_2c903b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sin_2c903b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sin_2c903b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd038f5ccb --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/2c903b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sin_2c903b() { + var res : vec3 = sin(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_2c903b(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_2c903b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_2c903b(); +} diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl new file mode 100644 index 0000000000..527f92b51d --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<2, f16>) -> vec<2, f16> +fn sin_3cca11() { + var res: vec2 = sin(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_3cca11(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_3cca11(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_3cca11(); +} diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f44faab03 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_3cca11() { + vector res = sin((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_3cca11(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_3cca11(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38960b621f --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sin_3cca11() { + vector res = sin((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_3cca11(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_3cca11(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025136111160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.glsl new file mode 100644 index 0000000000..3d2c148fdd --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_3cca11() { + f16vec2 res = sin(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + sin_3cca11(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_3cca11() { + f16vec2 res = sin(f16vec2(0.0hf)); +} + +void fragment_main() { + sin_3cca11(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_3cca11() { + f16vec2 res = sin(f16vec2(0.0hf)); +} + +void compute_main() { + sin_3cca11(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.msl new file mode 100644 index 0000000000..0e631c7a6e --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_3cca11() { + half2 res = sin(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_3cca11(); + return; +} + +kernel void compute_main() { + sin_3cca11(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.spvasm new file mode 100644 index 0000000000..f80895e250 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_3cca11 "sin_3cca11" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_3cca11 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Sin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sin_3cca11 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sin_3cca11 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sin_3cca11 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.wgsl new file mode 100644 index 0000000000..31f967aeb6 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/3cca11.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sin_3cca11() { + var res : vec2 = sin(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_3cca11(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_3cca11(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_3cca11(); +} diff --git a/test/tint/builtins/gen/literal/sin/4e3979.wgsl b/test/tint/builtins/gen/literal/sin/4e3979.wgsl new file mode 100644 index 0000000000..aa9d887aad --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/4e3979.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(vec<4, f32>) -> vec<4, f32> +fn sin_4e3979() { + var res: vec4 = sin(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_4e3979(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_4e3979(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_4e3979(); +} diff --git a/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..016064bed6 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_4e3979() { + float4 res = sin((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_4e3979(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_4e3979(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_4e3979(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..016064bed6 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sin_4e3979() { + float4 res = sin((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_4e3979(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_4e3979(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_4e3979(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.glsl new file mode 100644 index 0000000000..f5f794651f --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sin_4e3979() { + vec4 res = sin(vec4(1.0f)); +} + +vec4 vertex_main() { + sin_4e3979(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_4e3979() { + vec4 res = sin(vec4(1.0f)); +} + +void fragment_main() { + sin_4e3979(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_4e3979() { + vec4 res = sin(vec4(1.0f)); +} + +void compute_main() { + sin_4e3979(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.msl new file mode 100644 index 0000000000..08239ea918 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_4e3979() { + float4 res = sin(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_4e3979(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_4e3979(); + return; +} + +kernel void compute_main() { + sin_4e3979(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6eb84eb0e --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_4e3979 "sin_4e3979" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %sin_4e3979 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Sin %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sin_4e3979 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %sin_4e3979 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sin_4e3979 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.wgsl new file mode 100644 index 0000000000..de883118e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/4e3979.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sin_4e3979() { + var res : vec4 = sin(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_4e3979(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_4e3979(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_4e3979(); +} diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl new file mode 100644 index 0000000000..8a165443a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<4, f16>) -> vec<4, f16> +fn sin_5c0712() { + var res: vec4 = sin(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_5c0712(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_5c0712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_5c0712(); +} diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ffc0c91d1a --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_5c0712() { + vector res = sin((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_5c0712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_5c0712(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26e763ad5f --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sin_5c0712() { + vector res = sin((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_5c0712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_5c0712(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FE3DAE1580(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.glsl new file mode 100644 index 0000000000..c16ccdff21 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_5c0712() { + f16vec4 res = sin(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + sin_5c0712(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_5c0712() { + f16vec4 res = sin(f16vec4(0.0hf)); +} + +void fragment_main() { + sin_5c0712(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_5c0712() { + f16vec4 res = sin(f16vec4(0.0hf)); +} + +void compute_main() { + sin_5c0712(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.msl new file mode 100644 index 0000000000..93932368b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_5c0712() { + half4 res = sin(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_5c0712(); + return; +} + +kernel void compute_main() { + sin_5c0712(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.spvasm new file mode 100644 index 0000000000..5060ea847d --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_5c0712 "sin_5c0712" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_5c0712 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Sin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sin_5c0712 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sin_5c0712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sin_5c0712 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.wgsl new file mode 100644 index 0000000000..451cac035d --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/5c0712.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sin_5c0712() { + var res : vec4 = sin(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_5c0712(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_5c0712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_5c0712(); +} diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl new file mode 100644 index 0000000000..9f69a70f52 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(f16) -> f16 +fn sin_66a59f() { + var res: f16 = sin(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_66a59f(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_66a59f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_66a59f(); +} diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dbb0994a40 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_66a59f() { + float16_t res = sin(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_66a59f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_66a59f(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6b54ff13a --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void sin_66a59f() { + float16_t res = sin(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_66a59f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_66a59f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CA5CAC0100(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CA5CAC0100(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.glsl new file mode 100644 index 0000000000..dc6b376a82 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_66a59f() { + float16_t res = sin(0.0hf); +} + +vec4 vertex_main() { + sin_66a59f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_66a59f() { + float16_t res = sin(0.0hf); +} + +void fragment_main() { + sin_66a59f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_66a59f() { + float16_t res = sin(0.0hf); +} + +void compute_main() { + sin_66a59f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.msl new file mode 100644 index 0000000000..8204eec080 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_66a59f() { + half res = sin(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_66a59f(); + return; +} + +kernel void compute_main() { + sin_66a59f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.spvasm new file mode 100644 index 0000000000..19a2e294c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_66a59f "sin_66a59f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_66a59f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Sin %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sin_66a59f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sin_66a59f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_66a59f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.wgsl new file mode 100644 index 0000000000..afb239be2c --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/66a59f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sin_66a59f() { + var res : f16 = sin(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_66a59f(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_66a59f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_66a59f(); +} diff --git a/test/tint/builtins/gen/literal/sin/b78c91.wgsl b/test/tint/builtins/gen/literal/sin/b78c91.wgsl new file mode 100644 index 0000000000..590c6dacd5 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/b78c91.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(f32) -> f32 +fn sin_b78c91() { + var res: f32 = sin(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_b78c91(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_b78c91(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_b78c91(); +} diff --git a/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..830387c69a --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_b78c91() { + float res = sin(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_b78c91(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_b78c91(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_b78c91(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..830387c69a --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sin_b78c91() { + float res = sin(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_b78c91(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_b78c91(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_b78c91(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.glsl new file mode 100644 index 0000000000..e28e8877dc --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sin_b78c91() { + float res = sin(1.0f); +} + +vec4 vertex_main() { + sin_b78c91(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_b78c91() { + float res = sin(1.0f); +} + +void fragment_main() { + sin_b78c91(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_b78c91() { + float res = sin(1.0f); +} + +void compute_main() { + sin_b78c91(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.msl new file mode 100644 index 0000000000..7acd0e6308 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_b78c91() { + float res = sin(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_b78c91(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_b78c91(); + return; +} + +kernel void compute_main() { + sin_b78c91(); + return; +} + diff --git a/test/tint/builtins/gen/sin/b78c91.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/sin/b78c91.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed5914c907 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/b78c91.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sin_b78c91() { + var res : f32 = sin(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_b78c91(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_b78c91(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_b78c91(); +} diff --git a/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl new file mode 100644 index 0000000000..8c14832fa0 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(vec<2, f32>) -> vec<2, f32> +fn sin_fc8bc4() { + var res: vec2 = sin(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_fc8bc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_fc8bc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_fc8bc4(); +} diff --git a/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6334dafc19 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sin_fc8bc4() { + float2 res = sin((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_fc8bc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_fc8bc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_fc8bc4(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6334dafc19 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sin_fc8bc4() { + float2 res = sin((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_fc8bc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_fc8bc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_fc8bc4(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.glsl new file mode 100644 index 0000000000..58c95b8287 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sin_fc8bc4() { + vec2 res = sin(vec2(1.0f)); +} + +vec4 vertex_main() { + sin_fc8bc4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_fc8bc4() { + vec2 res = sin(vec2(1.0f)); +} + +void fragment_main() { + sin_fc8bc4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_fc8bc4() { + vec2 res = sin(vec2(1.0f)); +} + +void compute_main() { + sin_fc8bc4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.msl b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.msl new file mode 100644 index 0000000000..82021b4de6 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sin_fc8bc4() { + float2 res = sin(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_fc8bc4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_fc8bc4(); + return; +} + +kernel void compute_main() { + sin_fc8bc4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..fbed393fc4 --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_fc8bc4 "sin_fc8bc4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %sin_fc8bc4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Sin %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sin_fc8bc4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sin_fc8bc4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sin_fc8bc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..62f5f13f3a --- /dev/null +++ b/test/tint/builtins/gen/literal/sin/fc8bc4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sin_fc8bc4() { + var res : vec2 = sin(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_fc8bc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_fc8bc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_fc8bc4(); +} diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl new file mode 100644 index 0000000000..dc47091224 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<3, f16>) -> vec<3, f16> +fn sinh_0908c1() { + var res: vec3 = sinh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_0908c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_0908c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_0908c1(); +} diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..797d893b31 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_0908c1() { + vector res = sinh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_0908c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_0908c1(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cac1c4b7b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sinh_0908c1() { + vector res = sinh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_0908c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_0908c1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E72E75B6A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.glsl new file mode 100644 index 0000000000..6130c64bdf --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_0908c1() { + f16vec3 res = sinh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + sinh_0908c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_0908c1() { + f16vec3 res = sinh(f16vec3(0.0hf)); +} + +void fragment_main() { + sinh_0908c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_0908c1() { + f16vec3 res = sinh(f16vec3(0.0hf)); +} + +void compute_main() { + sinh_0908c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.msl new file mode 100644 index 0000000000..5da508a32b --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_0908c1() { + half3 res = sinh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_0908c1(); + return; +} + +kernel void compute_main() { + sinh_0908c1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..62c27636c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_0908c1 "sinh_0908c1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_0908c1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Sinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sinh_0908c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sinh_0908c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sinh_0908c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..f583b1084f --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/0908c1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sinh_0908c1() { + var res : vec3 = sinh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_0908c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_0908c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_0908c1(); +} diff --git a/test/tint/builtins/gen/literal/sinh/445e33.wgsl b/test/tint/builtins/gen/literal/sinh/445e33.wgsl new file mode 100644 index 0000000000..0157aabc8d --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/445e33.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(vec<4, f32>) -> vec<4, f32> +fn sinh_445e33() { + var res: vec4 = sinh(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_445e33(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_445e33(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_445e33(); +} diff --git a/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..678cef4da9 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_445e33() { + float4 res = sinh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_445e33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_445e33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_445e33(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..678cef4da9 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sinh_445e33() { + float4 res = sinh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_445e33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_445e33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_445e33(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.glsl new file mode 100644 index 0000000000..2d90f5019f --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sinh_445e33() { + vec4 res = sinh(vec4(1.0f)); +} + +vec4 vertex_main() { + sinh_445e33(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_445e33() { + vec4 res = sinh(vec4(1.0f)); +} + +void fragment_main() { + sinh_445e33(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_445e33() { + vec4 res = sinh(vec4(1.0f)); +} + +void compute_main() { + sinh_445e33(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.msl new file mode 100644 index 0000000000..4f0fdbce53 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_445e33() { + float4 res = sinh(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_445e33(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_445e33(); + return; +} + +kernel void compute_main() { + sinh_445e33(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.spvasm new file mode 100644 index 0000000000..1d1c9f6aa3 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_445e33 "sinh_445e33" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%sinh_445e33 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Sinh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sinh_445e33 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %sinh_445e33 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sinh_445e33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cc352736a --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/445e33.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sinh_445e33() { + var res : vec4 = sinh(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_445e33(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_445e33(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_445e33(); +} diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl new file mode 100644 index 0000000000..ad511365a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(f16) -> f16 +fn sinh_69cce2() { + var res: f16 = sinh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_69cce2(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_69cce2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_69cce2(); +} diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..277210691e --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_69cce2() { + float16_t res = sinh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_69cce2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_69cce2(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4dca58e241 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void sinh_69cce2() { + float16_t res = sinh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_69cce2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_69cce2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EB249D0520(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EB249D0520(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.glsl new file mode 100644 index 0000000000..4b0c3e4301 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_69cce2() { + float16_t res = sinh(0.0hf); +} + +vec4 vertex_main() { + sinh_69cce2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_69cce2() { + float16_t res = sinh(0.0hf); +} + +void fragment_main() { + sinh_69cce2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_69cce2() { + float16_t res = sinh(0.0hf); +} + +void compute_main() { + sinh_69cce2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.msl new file mode 100644 index 0000000000..5fada226f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_69cce2() { + half res = sinh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_69cce2(); + return; +} + +kernel void compute_main() { + sinh_69cce2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.spvasm new file mode 100644 index 0000000000..994f5e4ddb --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_69cce2 "sinh_69cce2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_69cce2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Sinh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sinh_69cce2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sinh_69cce2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_69cce2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.wgsl new file mode 100644 index 0000000000..8defcbd6d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/69cce2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sinh_69cce2() { + var res : f16 = sinh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_69cce2(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_69cce2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_69cce2(); +} diff --git a/test/tint/builtins/gen/literal/sinh/7bb598.wgsl b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl new file mode 100644 index 0000000000..8bf7fa8809 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(f32) -> f32 +fn sinh_7bb598() { + var res: f32 = sinh(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_7bb598(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_7bb598(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_7bb598(); +} diff --git a/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ead48271e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_7bb598() { + float res = sinh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_7bb598(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_7bb598(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_7bb598(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ead48271e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sinh_7bb598() { + float res = sinh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_7bb598(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_7bb598(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_7bb598(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.glsl new file mode 100644 index 0000000000..a30194b910 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sinh_7bb598() { + float res = sinh(1.0f); +} + +vec4 vertex_main() { + sinh_7bb598(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_7bb598() { + float res = sinh(1.0f); +} + +void fragment_main() { + sinh_7bb598(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_7bb598() { + float res = sinh(1.0f); +} + +void compute_main() { + sinh_7bb598(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.msl new file mode 100644 index 0000000000..208c381869 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_7bb598() { + float res = sinh(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_7bb598(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_7bb598(); + return; +} + +kernel void compute_main() { + sinh_7bb598(); + return; +} + diff --git a/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/sinh/7bb598.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.wgsl new file mode 100644 index 0000000000..8b00cfb727 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/7bb598.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sinh_7bb598() { + var res : f32 = sinh(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_7bb598(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_7bb598(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_7bb598(); +} diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl new file mode 100644 index 0000000000..09ce2eefea --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<2, f16>) -> vec<2, f16> +fn sinh_924f19() { + var res: vec2 = sinh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_924f19(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_924f19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_924f19(); +} diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e79ca20fb6 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_924f19() { + vector res = sinh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_924f19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_924f19(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..357854dd3e --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sinh_924f19() { + vector res = sinh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_924f19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_924f19(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019A6900E9E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.glsl new file mode 100644 index 0000000000..844c7ecb17 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_924f19() { + f16vec2 res = sinh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + sinh_924f19(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_924f19() { + f16vec2 res = sinh(f16vec2(0.0hf)); +} + +void fragment_main() { + sinh_924f19(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_924f19() { + f16vec2 res = sinh(f16vec2(0.0hf)); +} + +void compute_main() { + sinh_924f19(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.msl new file mode 100644 index 0000000000..48d04aefd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_924f19() { + half2 res = sinh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_924f19(); + return; +} + +kernel void compute_main() { + sinh_924f19(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.spvasm new file mode 100644 index 0000000000..5f2db5eca2 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_924f19 "sinh_924f19" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_924f19 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Sinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sinh_924f19 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sinh_924f19 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sinh_924f19 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.wgsl new file mode 100644 index 0000000000..d384cab96e --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/924f19.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sinh_924f19() { + var res : vec2 = sinh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_924f19(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_924f19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_924f19(); +} diff --git a/test/tint/builtins/gen/literal/sinh/b9860e.wgsl b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl new file mode 100644 index 0000000000..c9422a8f4f --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(vec<2, f32>) -> vec<2, f32> +fn sinh_b9860e() { + var res: vec2 = sinh(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_b9860e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_b9860e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_b9860e(); +} diff --git a/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9961a6af41 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_b9860e() { + float2 res = sinh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_b9860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_b9860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_b9860e(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9961a6af41 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sinh_b9860e() { + float2 res = sinh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_b9860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_b9860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_b9860e(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.glsl new file mode 100644 index 0000000000..83d01b7f6f --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sinh_b9860e() { + vec2 res = sinh(vec2(1.0f)); +} + +vec4 vertex_main() { + sinh_b9860e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_b9860e() { + vec2 res = sinh(vec2(1.0f)); +} + +void fragment_main() { + sinh_b9860e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_b9860e() { + vec2 res = sinh(vec2(1.0f)); +} + +void compute_main() { + sinh_b9860e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.msl new file mode 100644 index 0000000000..0b99457355 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_b9860e() { + float2 res = sinh(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_b9860e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_b9860e(); + return; +} + +kernel void compute_main() { + sinh_b9860e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.spvasm new file mode 100644 index 0000000000..f09ce359eb --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_b9860e "sinh_b9860e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%sinh_b9860e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Sinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sinh_b9860e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sinh_b9860e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sinh_b9860e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a6454f505 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/b9860e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sinh_b9860e() { + var res : vec2 = sinh(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_b9860e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_b9860e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_b9860e(); +} diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl new file mode 100644 index 0000000000..878d0b6855 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<4, f16>) -> vec<4, f16> +fn sinh_ba7e25() { + var res: vec4 = sinh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_ba7e25(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_ba7e25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_ba7e25(); +} diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..87cbff08d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_ba7e25() { + vector res = sinh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_ba7e25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_ba7e25(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1100cab8f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sinh_ba7e25() { + vector res = sinh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_ba7e25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_ba7e25(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024997A21160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.glsl new file mode 100644 index 0000000000..61015c09a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_ba7e25() { + f16vec4 res = sinh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + sinh_ba7e25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_ba7e25() { + f16vec4 res = sinh(f16vec4(0.0hf)); +} + +void fragment_main() { + sinh_ba7e25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_ba7e25() { + f16vec4 res = sinh(f16vec4(0.0hf)); +} + +void compute_main() { + sinh_ba7e25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.msl new file mode 100644 index 0000000000..9aef6b3f81 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_ba7e25() { + half4 res = sinh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_ba7e25(); + return; +} + +kernel void compute_main() { + sinh_ba7e25(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e9f2c01a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_ba7e25 "sinh_ba7e25" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_ba7e25 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Sinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sinh_ba7e25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sinh_ba7e25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sinh_ba7e25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.wgsl new file mode 100644 index 0000000000..9587e3ea32 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/ba7e25.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sinh_ba7e25() { + var res : vec4 = sinh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_ba7e25(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_ba7e25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_ba7e25(); +} diff --git a/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl new file mode 100644 index 0000000000..1a42a2b7c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(vec<3, f32>) -> vec<3, f32> +fn sinh_c9a5eb() { + var res: vec3 = sinh(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_c9a5eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_c9a5eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_c9a5eb(); +} diff --git a/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..201111f25a --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sinh_c9a5eb() { + float3 res = sinh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_c9a5eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_c9a5eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_c9a5eb(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..201111f25a --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sinh_c9a5eb() { + float3 res = sinh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_c9a5eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_c9a5eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_c9a5eb(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.glsl new file mode 100644 index 0000000000..36f42dcfdd --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sinh_c9a5eb() { + vec3 res = sinh(vec3(1.0f)); +} + +vec4 vertex_main() { + sinh_c9a5eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_c9a5eb() { + vec3 res = sinh(vec3(1.0f)); +} + +void fragment_main() { + sinh_c9a5eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_c9a5eb() { + vec3 res = sinh(vec3(1.0f)); +} + +void compute_main() { + sinh_c9a5eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.msl b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.msl new file mode 100644 index 0000000000..de40db2062 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sinh_c9a5eb() { + float3 res = sinh(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_c9a5eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_c9a5eb(); + return; +} + +kernel void compute_main() { + sinh_c9a5eb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e1041a975 --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_c9a5eb "sinh_c9a5eb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%sinh_c9a5eb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Sinh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sinh_c9a5eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sinh_c9a5eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sinh_c9a5eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..67df10e22e --- /dev/null +++ b/test/tint/builtins/gen/literal/sinh/c9a5eb.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sinh_c9a5eb() { + var res : vec3 = sinh(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_c9a5eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_c9a5eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_c9a5eb(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl new file mode 100644 index 0000000000..a6bdd56d88 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn smoothstep_12c031() { + var res: vec2 = smoothstep(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_12c031(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_12c031(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_12c031(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..836c5b9cfd --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_12c031() { + vector res = smoothstep((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_12c031(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_12c031(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ab2bc4c6d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void smoothstep_12c031() { + vector res = smoothstep((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_12c031(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_12c031(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000298CE8896B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.glsl new file mode 100644 index 0000000000..64a110fb30 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_12c031() { + f16vec2 res = smoothstep(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + smoothstep_12c031(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_12c031() { + f16vec2 res = smoothstep(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + smoothstep_12c031(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_12c031() { + f16vec2 res = smoothstep(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + smoothstep_12c031(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.msl new file mode 100644 index 0000000000..1f30e7c3fd --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_12c031() { + half2 res = smoothstep(half2(0.0h), half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_12c031(); + return; +} + +kernel void compute_main() { + smoothstep_12c031(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.spvasm new file mode 100644 index 0000000000..aaaee6ec8d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_12c031 "smoothstep_12c031" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_12c031 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 SmoothStep %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %smoothstep_12c031 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_12c031 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_12c031 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.wgsl new file mode 100644 index 0000000000..62ad2a7faa --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/12c031.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn smoothstep_12c031() { + var res : vec2 = smoothstep(vec2(f16()), vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_12c031(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_12c031(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_12c031(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl new file mode 100644 index 0000000000..6dfea2b63c --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn smoothstep_392c19() { + var res: vec2 = smoothstep(vec2(1.f), vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_392c19(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_392c19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_392c19(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e1a3d850ab --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_392c19() { + float2 res = smoothstep((1.0f).xx, (1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_392c19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_392c19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_392c19(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e1a3d850ab --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_392c19() { + float2 res = smoothstep((1.0f).xx, (1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_392c19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_392c19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_392c19(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.glsl new file mode 100644 index 0000000000..4b897f4a17 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void smoothstep_392c19() { + vec2 res = smoothstep(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + smoothstep_392c19(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_392c19() { + vec2 res = smoothstep(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + smoothstep_392c19(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_392c19() { + vec2 res = smoothstep(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + smoothstep_392c19(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.msl new file mode 100644 index 0000000000..6a6423153f --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_392c19() { + float2 res = smoothstep(float2(1.0f), float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_392c19(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_392c19(); + return; +} + +kernel void compute_main() { + smoothstep_392c19(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.spvasm new file mode 100644 index 0000000000..cce9e9a6af --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_392c19 "smoothstep_392c19" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%smoothstep_392c19 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 SmoothStep %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %smoothstep_392c19 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_392c19 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_392c19 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.wgsl new file mode 100644 index 0000000000..a645970fe4 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/392c19.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn smoothstep_392c19() { + var res : vec2 = smoothstep(vec2(1.0f), vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_392c19(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_392c19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_392c19(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl new file mode 100644 index 0000000000..6293a5bb2c --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn smoothstep_40864c() { + var res: vec4 = smoothstep(vec4(1.f), vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_40864c(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_40864c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_40864c(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a19b74d03d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_40864c() { + float4 res = smoothstep((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_40864c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_40864c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_40864c(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a19b74d03d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_40864c() { + float4 res = smoothstep((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_40864c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_40864c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_40864c(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.glsl new file mode 100644 index 0000000000..47e97b6e74 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void smoothstep_40864c() { + vec4 res = smoothstep(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + smoothstep_40864c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_40864c() { + vec4 res = smoothstep(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + smoothstep_40864c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_40864c() { + vec4 res = smoothstep(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + smoothstep_40864c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.msl new file mode 100644 index 0000000000..9e47f9386b --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_40864c() { + float4 res = smoothstep(float4(1.0f), float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_40864c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_40864c(); + return; +} + +kernel void compute_main() { + smoothstep_40864c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.spvasm new file mode 100644 index 0000000000..ce5479e1ae --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_40864c "smoothstep_40864c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%smoothstep_40864c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 SmoothStep %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %smoothstep_40864c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %smoothstep_40864c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %smoothstep_40864c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.wgsl new file mode 100644 index 0000000000..d53f10c2ff --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/40864c.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn smoothstep_40864c() { + var res : vec4 = smoothstep(vec4(1.0f), vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_40864c(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_40864c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_40864c(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl new file mode 100644 index 0000000000..d9e1447032 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(f16, f16, f16) -> f16 +fn smoothstep_586e12() { + var res: f16 = smoothstep(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_586e12(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_586e12(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_586e12(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0a0bb8a122 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_586e12() { + float16_t res = smoothstep(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_586e12(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_586e12(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac1f9151ef --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void smoothstep_586e12() { + float16_t res = smoothstep(float16_t(0.0h), float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_586e12(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_586e12(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000272E8A60100(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000272E8A60100(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.glsl new file mode 100644 index 0000000000..26afc28c2e --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_586e12() { + float16_t res = smoothstep(0.0hf, 0.0hf, 0.0hf); +} + +vec4 vertex_main() { + smoothstep_586e12(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_586e12() { + float16_t res = smoothstep(0.0hf, 0.0hf, 0.0hf); +} + +void fragment_main() { + smoothstep_586e12(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_586e12() { + float16_t res = smoothstep(0.0hf, 0.0hf, 0.0hf); +} + +void compute_main() { + smoothstep_586e12(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.msl new file mode 100644 index 0000000000..a6a9fb3edb --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_586e12() { + half res = smoothstep(0.0h, 0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_586e12(); + return; +} + +kernel void compute_main() { + smoothstep_586e12(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.spvasm new file mode 100644 index 0000000000..38ef86f565 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_586e12 "smoothstep_586e12" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_586e12 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 SmoothStep %16 %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %smoothstep_586e12 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %smoothstep_586e12 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %smoothstep_586e12 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6600ae495 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/586e12.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn smoothstep_586e12() { + var res : f16 = smoothstep(f16(), f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_586e12(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_586e12(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_586e12(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl new file mode 100644 index 0000000000..417fa716f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(f32, f32, f32) -> f32 +fn smoothstep_6c4975() { + var res: f32 = smoothstep(1.f, 1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6c4975(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6c4975(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6c4975(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..02da7ceb9b --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_6c4975() { + float res = smoothstep(1.0f, 1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6c4975(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6c4975(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6c4975(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..02da7ceb9b --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_6c4975() { + float res = smoothstep(1.0f, 1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6c4975(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6c4975(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6c4975(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.glsl new file mode 100644 index 0000000000..74f7dd40b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void smoothstep_6c4975() { + float res = smoothstep(1.0f, 1.0f, 1.0f); +} + +vec4 vertex_main() { + smoothstep_6c4975(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_6c4975() { + float res = smoothstep(1.0f, 1.0f, 1.0f); +} + +void fragment_main() { + smoothstep_6c4975(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_6c4975() { + float res = smoothstep(1.0f, 1.0f, 1.0f); +} + +void compute_main() { + smoothstep_6c4975(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.msl new file mode 100644 index 0000000000..f265e143e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_6c4975() { + float res = smoothstep(1.0f, 1.0f, 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_6c4975(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_6c4975(); + return; +} + +kernel void compute_main() { + smoothstep_6c4975(); + return; +} + diff --git a/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.wgsl new file mode 100644 index 0000000000..596b0a098b --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6c4975.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn smoothstep_6c4975() { + var res : f32 = smoothstep(1.0f, 1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6c4975(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6c4975(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6c4975(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl new file mode 100644 index 0000000000..4fdbd51a17 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn smoothstep_6e7a74() { + var res: vec3 = smoothstep(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6e7a74(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6e7a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6e7a74(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f1869c2f0a --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_6e7a74() { + vector res = smoothstep((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6e7a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6e7a74(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9837ccc3d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void smoothstep_6e7a74() { + vector res = smoothstep((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6e7a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6e7a74(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023CD6C4BC30(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.glsl new file mode 100644 index 0000000000..12129b7acb --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_6e7a74() { + f16vec3 res = smoothstep(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + smoothstep_6e7a74(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_6e7a74() { + f16vec3 res = smoothstep(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + smoothstep_6e7a74(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_6e7a74() { + f16vec3 res = smoothstep(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + smoothstep_6e7a74(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.msl new file mode 100644 index 0000000000..d90125c05d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_6e7a74() { + half3 res = smoothstep(half3(0.0h), half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_6e7a74(); + return; +} + +kernel void compute_main() { + smoothstep_6e7a74(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.spvasm new file mode 100644 index 0000000000..21d9c28463 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_6e7a74 "smoothstep_6e7a74" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_6e7a74 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 SmoothStep %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.wgsl new file mode 100644 index 0000000000..1a7ea0defd --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/6e7a74.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn smoothstep_6e7a74() { + var res : vec3 = smoothstep(vec3(f16()), vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6e7a74(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6e7a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6e7a74(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl new file mode 100644 index 0000000000..ded0ed3db8 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn smoothstep_aad1db() { + var res: vec3 = smoothstep(vec3(1.f), vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_aad1db(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_aad1db(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_aad1db(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cb88afb86c --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_aad1db() { + float3 res = smoothstep((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_aad1db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_aad1db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_aad1db(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cb88afb86c --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_aad1db() { + float3 res = smoothstep((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_aad1db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_aad1db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_aad1db(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.glsl new file mode 100644 index 0000000000..3f8d9b2da8 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void smoothstep_aad1db() { + vec3 res = smoothstep(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + smoothstep_aad1db(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_aad1db() { + vec3 res = smoothstep(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + smoothstep_aad1db(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_aad1db() { + vec3 res = smoothstep(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + smoothstep_aad1db(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.msl new file mode 100644 index 0000000000..48037d1bf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_aad1db() { + float3 res = smoothstep(float3(1.0f), float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_aad1db(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_aad1db(); + return; +} + +kernel void compute_main() { + smoothstep_aad1db(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.spvasm new file mode 100644 index 0000000000..845c531f86 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_aad1db "smoothstep_aad1db" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%smoothstep_aad1db = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 SmoothStep %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %smoothstep_aad1db + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_aad1db + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_aad1db + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.wgsl new file mode 100644 index 0000000000..38f7f8d0d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/aad1db.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn smoothstep_aad1db() { + var res : vec3 = smoothstep(vec3(1.0f), vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_aad1db(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_aad1db(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_aad1db(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl new file mode 100644 index 0000000000..e1de207f74 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn smoothstep_c43ebd() { + var res: vec4 = smoothstep(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_c43ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_c43ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_c43ebd(); +} diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e25a8cd277 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void smoothstep_c43ebd() { + vector res = smoothstep((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_c43ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_c43ebd(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..92388b8c9d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void smoothstep_c43ebd() { + vector res = smoothstep((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_c43ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_c43ebd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023328C496C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.glsl new file mode 100644 index 0000000000..b67a5c869d --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_c43ebd() { + f16vec4 res = smoothstep(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + smoothstep_c43ebd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_c43ebd() { + f16vec4 res = smoothstep(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + smoothstep_c43ebd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_c43ebd() { + f16vec4 res = smoothstep(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + smoothstep_c43ebd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.msl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.msl new file mode 100644 index 0000000000..c7743d734e --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void smoothstep_c43ebd() { + half4 res = smoothstep(half4(0.0h), half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_c43ebd(); + return; +} + +kernel void compute_main() { + smoothstep_c43ebd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.spvasm new file mode 100644 index 0000000000..9230951f9e --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_c43ebd "smoothstep_c43ebd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_c43ebd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 SmoothStep %17 %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %smoothstep_c43ebd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_c43ebd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_c43ebd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b6b725f47 --- /dev/null +++ b/test/tint/builtins/gen/literal/smoothstep/c43ebd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn smoothstep_c43ebd() { + var res : vec4 = smoothstep(vec4(f16()), vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_c43ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_c43ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_c43ebd(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl new file mode 100644 index 0000000000..9e6d6e1902 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(f32) -> f32 +fn sqrt_20c74e() { + var res: f32 = sqrt(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_20c74e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_20c74e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_20c74e(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a1f4acbe7a --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_20c74e() { + float res = sqrt(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_20c74e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_20c74e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_20c74e(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1f4acbe7a --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_20c74e() { + float res = sqrt(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_20c74e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_20c74e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_20c74e(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.glsl new file mode 100644 index 0000000000..08f5000be0 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sqrt_20c74e() { + float res = sqrt(1.0f); +} + +vec4 vertex_main() { + sqrt_20c74e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_20c74e() { + float res = sqrt(1.0f); +} + +void fragment_main() { + sqrt_20c74e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_20c74e() { + float res = sqrt(1.0f); +} + +void compute_main() { + sqrt_20c74e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.msl new file mode 100644 index 0000000000..7f933af5e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_20c74e() { + float res = sqrt(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_20c74e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_20c74e(); + return; +} + +kernel void compute_main() { + sqrt_20c74e(); + return; +} + diff --git a/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.wgsl new file mode 100644 index 0000000000..cde62ac7a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/20c74e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sqrt_20c74e() { + var res : f32 = sqrt(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_20c74e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_20c74e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_20c74e(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl new file mode 100644 index 0000000000..019539d0a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<4, f16>) -> vec<4, f16> +fn sqrt_803d1c() { + var res: vec4 = sqrt(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_803d1c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_803d1c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_803d1c(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0b44b8957d --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_803d1c() { + vector res = sqrt((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_803d1c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_803d1c(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56a24535bb --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sqrt_803d1c() { + vector res = sqrt((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_803d1c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_803d1c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002342D12DCF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.glsl new file mode 100644 index 0000000000..2b0c4f5f72 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_803d1c() { + f16vec4 res = sqrt(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + sqrt_803d1c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_803d1c() { + f16vec4 res = sqrt(f16vec4(0.0hf)); +} + +void fragment_main() { + sqrt_803d1c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_803d1c() { + f16vec4 res = sqrt(f16vec4(0.0hf)); +} + +void compute_main() { + sqrt_803d1c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.msl new file mode 100644 index 0000000000..c85c1aed5b --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_803d1c() { + half4 res = sqrt(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_803d1c(); + return; +} + +kernel void compute_main() { + sqrt_803d1c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.spvasm new file mode 100644 index 0000000000..3204761691 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_803d1c "sqrt_803d1c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_803d1c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Sqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sqrt_803d1c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sqrt_803d1c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sqrt_803d1c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.wgsl new file mode 100644 index 0000000000..3361e6057e --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/803d1c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sqrt_803d1c() { + var res : vec4 = sqrt(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_803d1c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_803d1c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_803d1c(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl new file mode 100644 index 0000000000..7bdb02fc19 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<3, f16>) -> vec<3, f16> +fn sqrt_895a0c() { + var res: vec3 = sqrt(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_895a0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_895a0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_895a0c(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3ce6e95780 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_895a0c() { + vector res = sqrt((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_895a0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_895a0c(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8d0d057b08 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sqrt_895a0c() { + vector res = sqrt((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_895a0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_895a0c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FD1487D710(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.glsl new file mode 100644 index 0000000000..d0cedab89a --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_895a0c() { + f16vec3 res = sqrt(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + sqrt_895a0c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_895a0c() { + f16vec3 res = sqrt(f16vec3(0.0hf)); +} + +void fragment_main() { + sqrt_895a0c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_895a0c() { + f16vec3 res = sqrt(f16vec3(0.0hf)); +} + +void compute_main() { + sqrt_895a0c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.msl new file mode 100644 index 0000000000..72be3e1f96 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_895a0c() { + half3 res = sqrt(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_895a0c(); + return; +} + +kernel void compute_main() { + sqrt_895a0c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.spvasm new file mode 100644 index 0000000000..bcc0768f43 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_895a0c "sqrt_895a0c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_895a0c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Sqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sqrt_895a0c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sqrt_895a0c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sqrt_895a0c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.wgsl new file mode 100644 index 0000000000..44c3686023 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/895a0c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sqrt_895a0c() { + var res : vec3 = sqrt(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_895a0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_895a0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_895a0c(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl new file mode 100644 index 0000000000..3e1ee74dba --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(vec<2, f32>) -> vec<2, f32> +fn sqrt_8c7024() { + var res: vec2 = sqrt(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_8c7024(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_8c7024(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_8c7024(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0191d7565d --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_8c7024() { + float2 res = sqrt((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_8c7024(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_8c7024(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_8c7024(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0191d7565d --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_8c7024() { + float2 res = sqrt((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_8c7024(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_8c7024(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_8c7024(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.glsl new file mode 100644 index 0000000000..baa407b6b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sqrt_8c7024() { + vec2 res = sqrt(vec2(1.0f)); +} + +vec4 vertex_main() { + sqrt_8c7024(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_8c7024() { + vec2 res = sqrt(vec2(1.0f)); +} + +void fragment_main() { + sqrt_8c7024(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_8c7024() { + vec2 res = sqrt(vec2(1.0f)); +} + +void compute_main() { + sqrt_8c7024(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.msl new file mode 100644 index 0000000000..b9dfbc409e --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_8c7024() { + float2 res = sqrt(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_8c7024(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_8c7024(); + return; +} + +kernel void compute_main() { + sqrt_8c7024(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba7cdf4ab4 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_8c7024 "sqrt_8c7024" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%sqrt_8c7024 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Sqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sqrt_8c7024 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sqrt_8c7024 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sqrt_8c7024 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.wgsl new file mode 100644 index 0000000000..4f32c711a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/8c7024.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sqrt_8c7024() { + var res : vec2 = sqrt(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_8c7024(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_8c7024(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_8c7024(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl new file mode 100644 index 0000000000..78f1401f74 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(vec<4, f32>) -> vec<4, f32> +fn sqrt_aa0d7a() { + var res: vec4 = sqrt(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_aa0d7a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_aa0d7a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_aa0d7a(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..776d0d4788 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_aa0d7a() { + float4 res = sqrt((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_aa0d7a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_aa0d7a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_aa0d7a(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..776d0d4788 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_aa0d7a() { + float4 res = sqrt((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_aa0d7a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_aa0d7a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_aa0d7a(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.glsl new file mode 100644 index 0000000000..d96dc6c8a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sqrt_aa0d7a() { + vec4 res = sqrt(vec4(1.0f)); +} + +vec4 vertex_main() { + sqrt_aa0d7a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_aa0d7a() { + vec4 res = sqrt(vec4(1.0f)); +} + +void fragment_main() { + sqrt_aa0d7a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_aa0d7a() { + vec4 res = sqrt(vec4(1.0f)); +} + +void compute_main() { + sqrt_aa0d7a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.msl new file mode 100644 index 0000000000..13a62e1ed4 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_aa0d7a() { + float4 res = sqrt(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_aa0d7a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_aa0d7a(); + return; +} + +kernel void compute_main() { + sqrt_aa0d7a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.spvasm new file mode 100644 index 0000000000..da8c047038 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_aa0d7a "sqrt_aa0d7a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%sqrt_aa0d7a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Sqrt %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sqrt_aa0d7a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %sqrt_aa0d7a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sqrt_aa0d7a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a2f114d03 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/aa0d7a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sqrt_aa0d7a() { + var res : vec4 = sqrt(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_aa0d7a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_aa0d7a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_aa0d7a(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl new file mode 100644 index 0000000000..4158a6f7f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<2, f16>) -> vec<2, f16> +fn sqrt_d9ab4d() { + var res: vec2 = sqrt(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_d9ab4d(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_d9ab4d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_d9ab4d(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dc9426f224 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_d9ab4d() { + vector res = sqrt((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_d9ab4d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_d9ab4d(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a2088d6477 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void sqrt_d9ab4d() { + vector res = sqrt((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_d9ab4d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_d9ab4d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000256F2C5EAF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.glsl new file mode 100644 index 0000000000..8a12e8fd13 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_d9ab4d() { + f16vec2 res = sqrt(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + sqrt_d9ab4d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_d9ab4d() { + f16vec2 res = sqrt(f16vec2(0.0hf)); +} + +void fragment_main() { + sqrt_d9ab4d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_d9ab4d() { + f16vec2 res = sqrt(f16vec2(0.0hf)); +} + +void compute_main() { + sqrt_d9ab4d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.msl new file mode 100644 index 0000000000..d64d5a1e45 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_d9ab4d() { + half2 res = sqrt(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_d9ab4d(); + return; +} + +kernel void compute_main() { + sqrt_d9ab4d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d18a25136a --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_d9ab4d "sqrt_d9ab4d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_d9ab4d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Sqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sqrt_d9ab4d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sqrt_d9ab4d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sqrt_d9ab4d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.wgsl new file mode 100644 index 0000000000..ccda9f1474 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/d9ab4d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sqrt_d9ab4d() { + var res : vec2 = sqrt(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_d9ab4d(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_d9ab4d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_d9ab4d(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl new file mode 100644 index 0000000000..4dc19b0efa --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(f16) -> f16 +fn sqrt_ec33e9() { + var res: f16 = sqrt(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_ec33e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_ec33e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_ec33e9(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c76014e52a --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_ec33e9() { + float16_t res = sqrt(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_ec33e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_ec33e9(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..71be999b61 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void sqrt_ec33e9() { + float16_t res = sqrt(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_ec33e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_ec33e9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C2CF8D7D20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C2CF8D7D20(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.glsl new file mode 100644 index 0000000000..89b0d09846 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_ec33e9() { + float16_t res = sqrt(0.0hf); +} + +vec4 vertex_main() { + sqrt_ec33e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_ec33e9() { + float16_t res = sqrt(0.0hf); +} + +void fragment_main() { + sqrt_ec33e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_ec33e9() { + float16_t res = sqrt(0.0hf); +} + +void compute_main() { + sqrt_ec33e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.msl new file mode 100644 index 0000000000..bfd3d49f8c --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_ec33e9() { + half res = sqrt(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_ec33e9(); + return; +} + +kernel void compute_main() { + sqrt_ec33e9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..a39a404a73 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_ec33e9 "sqrt_ec33e9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_ec33e9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Sqrt %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %sqrt_ec33e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sqrt_ec33e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_ec33e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..5145314430 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/ec33e9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn sqrt_ec33e9() { + var res : f16 = sqrt(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_ec33e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_ec33e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_ec33e9(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl new file mode 100644 index 0000000000..9ce3b686ef --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(vec<3, f32>) -> vec<3, f32> +fn sqrt_f8c59a() { + var res: vec3 = sqrt(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_f8c59a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_f8c59a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_f8c59a(); +} diff --git a/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e0c1921d59 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_f8c59a() { + float3 res = sqrt((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_f8c59a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_f8c59a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_f8c59a(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e0c1921d59 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void sqrt_f8c59a() { + float3 res = sqrt((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_f8c59a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_f8c59a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_f8c59a(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.glsl new file mode 100644 index 0000000000..9d05843ffd --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void sqrt_f8c59a() { + vec3 res = sqrt(vec3(1.0f)); +} + +vec4 vertex_main() { + sqrt_f8c59a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_f8c59a() { + vec3 res = sqrt(vec3(1.0f)); +} + +void fragment_main() { + sqrt_f8c59a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_f8c59a() { + vec3 res = sqrt(vec3(1.0f)); +} + +void compute_main() { + sqrt_f8c59a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.msl b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.msl new file mode 100644 index 0000000000..d79e601a8a --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void sqrt_f8c59a() { + float3 res = sqrt(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_f8c59a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_f8c59a(); + return; +} + +kernel void compute_main() { + sqrt_f8c59a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.spvasm new file mode 100644 index 0000000000..fdc4f9aaab --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_f8c59a "sqrt_f8c59a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%sqrt_f8c59a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Sqrt %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sqrt_f8c59a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sqrt_f8c59a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sqrt_f8c59a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.wgsl new file mode 100644 index 0000000000..119dca4df9 --- /dev/null +++ b/test/tint/builtins/gen/literal/sqrt/f8c59a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn sqrt_f8c59a() { + var res : vec3 = sqrt(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_f8c59a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_f8c59a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_f8c59a(); +} diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl new file mode 100644 index 0000000000..2baa12b0e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn step_07cb06() { + var res: vec2 = step(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_07cb06(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_07cb06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_07cb06(); +} diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae74c4e438 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_07cb06() { + vector res = step((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_07cb06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_07cb06(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9be89573dd --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void step_07cb06() { + vector res = step((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_07cb06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_07cb06(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000190D7A566C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.glsl new file mode 100644 index 0000000000..fd5c470e6d --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_07cb06() { + f16vec2 res = step(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +vec4 vertex_main() { + step_07cb06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_07cb06() { + f16vec2 res = step(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void fragment_main() { + step_07cb06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_07cb06() { + f16vec2 res = step(f16vec2(0.0hf), f16vec2(0.0hf)); +} + +void compute_main() { + step_07cb06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.msl new file mode 100644 index 0000000000..aa04803561 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_07cb06() { + half2 res = step(half2(0.0h), half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_07cb06(); + return; +} + +kernel void compute_main() { + step_07cb06(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.spvasm new file mode 100644 index 0000000000..d73eed8b2d --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_07cb06 "step_07cb06" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_07cb06 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Step %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %step_07cb06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %step_07cb06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_07cb06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.wgsl new file mode 100644 index 0000000000..4ebf853307 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/07cb06.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn step_07cb06() { + var res : vec2 = step(vec2(f16()), vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_07cb06(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_07cb06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_07cb06(); +} diff --git a/test/tint/builtins/gen/literal/step/0b073b.wgsl b/test/tint/builtins/gen/literal/step/0b073b.wgsl new file mode 100644 index 0000000000..589e5e7487 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/0b073b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(f32, f32) -> f32 +fn step_0b073b() { + var res: f32 = step(1.f, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_0b073b(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_0b073b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_0b073b(); +} diff --git a/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f899788e98 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_0b073b() { + float res = step(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_0b073b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_0b073b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_0b073b(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f899788e98 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void step_0b073b() { + float res = step(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_0b073b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_0b073b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_0b073b(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.glsl new file mode 100644 index 0000000000..9e4ee8e07e --- /dev/null +++ b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void step_0b073b() { + float res = step(1.0f, 1.0f); +} + +vec4 vertex_main() { + step_0b073b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_0b073b() { + float res = step(1.0f, 1.0f); +} + +void fragment_main() { + step_0b073b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_0b073b() { + float res = step(1.0f, 1.0f); +} + +void compute_main() { + step_0b073b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.msl new file mode 100644 index 0000000000..7ab4a8ef56 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_0b073b() { + float res = step(1.0f, 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_0b073b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_0b073b(); + return; +} + +kernel void compute_main() { + step_0b073b(); + return; +} + diff --git a/test/tint/builtins/gen/step/0b073b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/step/0b073b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.wgsl new file mode 100644 index 0000000000..4564309840 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/0b073b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn step_0b073b() { + var res : f32 = step(1.0f, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_0b073b(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_0b073b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_0b073b(); +} diff --git a/test/tint/builtins/gen/literal/step/19accd.wgsl b/test/tint/builtins/gen/literal/step/19accd.wgsl new file mode 100644 index 0000000000..ebae56794b --- /dev/null +++ b/test/tint/builtins/gen/literal/step/19accd.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn step_19accd() { + var res: vec2 = step(vec2(1.f), vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_19accd(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_19accd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_19accd(); +} diff --git a/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e4d7e03e3c --- /dev/null +++ b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_19accd() { + float2 res = step((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_19accd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_19accd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_19accd(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4d7e03e3c --- /dev/null +++ b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void step_19accd() { + float2 res = step((1.0f).xx, (1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_19accd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_19accd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_19accd(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.glsl new file mode 100644 index 0000000000..282608b526 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void step_19accd() { + vec2 res = step(vec2(1.0f), vec2(1.0f)); +} + +vec4 vertex_main() { + step_19accd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_19accd() { + vec2 res = step(vec2(1.0f), vec2(1.0f)); +} + +void fragment_main() { + step_19accd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_19accd() { + vec2 res = step(vec2(1.0f), vec2(1.0f)); +} + +void compute_main() { + step_19accd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.msl new file mode 100644 index 0000000000..e77bffc01b --- /dev/null +++ b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_19accd() { + float2 res = step(float2(1.0f), float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_19accd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_19accd(); + return; +} + +kernel void compute_main() { + step_19accd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.spvasm new file mode 100644 index 0000000000..05790d4852 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_19accd "step_19accd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%step_19accd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Step %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %step_19accd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %step_19accd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_19accd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.wgsl new file mode 100644 index 0000000000..53a37af3ce --- /dev/null +++ b/test/tint/builtins/gen/literal/step/19accd.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn step_19accd() { + var res : vec2 = step(vec2(1.0f), vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_19accd(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_19accd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_19accd(); +} diff --git a/test/tint/builtins/gen/literal/step/334303.wgsl b/test/tint/builtins/gen/literal/step/334303.wgsl new file mode 100644 index 0000000000..9aa6605c7a --- /dev/null +++ b/test/tint/builtins/gen/literal/step/334303.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn step_334303() { + var res: vec3 = step(vec3(1.f), vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_334303(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_334303(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_334303(); +} diff --git a/test/tint/builtins/gen/literal/step/334303.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..72b7a547d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_334303() { + float3 res = step((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_334303(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_334303(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_334303(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/334303.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..72b7a547d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void step_334303() { + float3 res = step((1.0f).xxx, (1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_334303(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_334303(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_334303(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/334303.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.glsl new file mode 100644 index 0000000000..c5508ff9e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void step_334303() { + vec3 res = step(vec3(1.0f), vec3(1.0f)); +} + +vec4 vertex_main() { + step_334303(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_334303() { + vec3 res = step(vec3(1.0f), vec3(1.0f)); +} + +void fragment_main() { + step_334303(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_334303() { + vec3 res = step(vec3(1.0f), vec3(1.0f)); +} + +void compute_main() { + step_334303(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/334303.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.msl new file mode 100644 index 0000000000..7da6a2a6f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_334303() { + float3 res = step(float3(1.0f), float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_334303(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_334303(); + return; +} + +kernel void compute_main() { + step_334303(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/334303.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.spvasm new file mode 100644 index 0000000000..e9513d661a --- /dev/null +++ b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_334303 "step_334303" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%step_334303 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Step %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %step_334303 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %step_334303 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_334303 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/334303.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.wgsl new file mode 100644 index 0000000000..ded0d81106 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/334303.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn step_334303() { + var res : vec3 = step(vec3(1.0f), vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_334303(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_334303(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_334303(); +} diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl b/test/tint/builtins/gen/literal/step/630d07.wgsl new file mode 100644 index 0000000000..b789a99094 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(f16, f16) -> f16 +fn step_630d07() { + var res: f16 = step(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_630d07(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_630d07(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_630d07(); +} diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0839e00644 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_630d07() { + float16_t res = step(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_630d07(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_630d07(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_630d07(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..634d34b334 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void step_630d07() { + float16_t res = step(float16_t(0.0h), float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_630d07(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_630d07(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_630d07(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EFB6F7D2D0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EFB6F7D2D0(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.glsl new file mode 100644 index 0000000000..7ddbf1350e --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_630d07() { + float16_t res = step(0.0hf, 0.0hf); +} + +vec4 vertex_main() { + step_630d07(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_630d07() { + float16_t res = step(0.0hf, 0.0hf); +} + +void fragment_main() { + step_630d07(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_630d07() { + float16_t res = step(0.0hf, 0.0hf); +} + +void compute_main() { + step_630d07(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.msl new file mode 100644 index 0000000000..ef616cf0da --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_630d07() { + half res = step(0.0h, 0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_630d07(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_630d07(); + return; +} + +kernel void compute_main() { + step_630d07(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.spvasm new file mode 100644 index 0000000000..5783a90f2e --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_630d07 "step_630d07" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_630d07 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Step %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %step_630d07 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %step_630d07 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %step_630d07 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a0527d1a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/630d07.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn step_630d07() { + var res : f16 = step(f16(), f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_630d07(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_630d07(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_630d07(); +} diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl b/test/tint/builtins/gen/literal/step/baa320.wgsl new file mode 100644 index 0000000000..b2e66b0a5b --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn step_baa320() { + var res: vec4 = step(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_baa320(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_baa320(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_baa320(); +} diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4f5992e80d --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_baa320() { + vector res = step((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_baa320(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_baa320(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_baa320(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a394391587 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void step_baa320() { + vector res = step((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_baa320(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_baa320(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_baa320(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023DD42966C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.glsl new file mode 100644 index 0000000000..37f82127e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_baa320() { + f16vec4 res = step(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +vec4 vertex_main() { + step_baa320(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_baa320() { + f16vec4 res = step(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void fragment_main() { + step_baa320(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_baa320() { + f16vec4 res = step(f16vec4(0.0hf), f16vec4(0.0hf)); +} + +void compute_main() { + step_baa320(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.msl new file mode 100644 index 0000000000..ea8bc33af8 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_baa320() { + half4 res = step(half4(0.0h), half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_baa320(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_baa320(); + return; +} + +kernel void compute_main() { + step_baa320(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.spvasm new file mode 100644 index 0000000000..492cd3f7f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_baa320 "step_baa320" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_baa320 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Step %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %step_baa320 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %step_baa320 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_baa320 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.wgsl new file mode 100644 index 0000000000..c500a65836 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/baa320.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn step_baa320() { + var res : vec4 = step(vec4(f16()), vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_baa320(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_baa320(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_baa320(); +} diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl new file mode 100644 index 0000000000..77da1c965b --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn step_cc6b61() { + var res: vec3 = step(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_cc6b61(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_cc6b61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_cc6b61(); +} diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d4a6c36c61 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_cc6b61() { + vector res = step((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_cc6b61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_cc6b61(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..00514c519a --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void step_cc6b61() { + vector res = step((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_cc6b61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_cc6b61(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015E30CB9FC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.glsl new file mode 100644 index 0000000000..0cb5d43ab8 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_cc6b61() { + f16vec3 res = step(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +vec4 vertex_main() { + step_cc6b61(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_cc6b61() { + f16vec3 res = step(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void fragment_main() { + step_cc6b61(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_cc6b61() { + f16vec3 res = step(f16vec3(0.0hf), f16vec3(0.0hf)); +} + +void compute_main() { + step_cc6b61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.msl new file mode 100644 index 0000000000..4e657120d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_cc6b61() { + half3 res = step(half3(0.0h), half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_cc6b61(); + return; +} + +kernel void compute_main() { + step_cc6b61(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e2e6b99ff --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_cc6b61 "step_cc6b61" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_cc6b61 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Step %17 %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %step_cc6b61 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %step_cc6b61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_cc6b61 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1d9624c44 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/cc6b61.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn step_cc6b61() { + var res : vec3 = step(vec3(f16()), vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_cc6b61(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_cc6b61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_cc6b61(); +} diff --git a/test/tint/builtins/gen/literal/step/e2b337.wgsl b/test/tint/builtins/gen/literal/step/e2b337.wgsl new file mode 100644 index 0000000000..c0c962488a --- /dev/null +++ b/test/tint/builtins/gen/literal/step/e2b337.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn step_e2b337() { + var res: vec4 = step(vec4(1.f), vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_e2b337(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_e2b337(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_e2b337(); +} diff --git a/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e9b4b3a916 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void step_e2b337() { + float4 res = step((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_e2b337(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_e2b337(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_e2b337(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e9b4b3a916 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void step_e2b337() { + float4 res = step((1.0f).xxxx, (1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_e2b337(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_e2b337(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_e2b337(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.glsl b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.glsl new file mode 100644 index 0000000000..30481fce20 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void step_e2b337() { + vec4 res = step(vec4(1.0f), vec4(1.0f)); +} + +vec4 vertex_main() { + step_e2b337(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_e2b337() { + vec4 res = step(vec4(1.0f), vec4(1.0f)); +} + +void fragment_main() { + step_e2b337(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_e2b337() { + vec4 res = step(vec4(1.0f), vec4(1.0f)); +} + +void compute_main() { + step_e2b337(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.msl b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.msl new file mode 100644 index 0000000000..8d56ad45a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void step_e2b337() { + float4 res = step(float4(1.0f), float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_e2b337(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_e2b337(); + return; +} + +kernel void compute_main() { + step_e2b337(); + return; +} + diff --git a/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.spvasm new file mode 100644 index 0000000000..debffef444 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_e2b337 "step_e2b337" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%step_e2b337 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Step %16 %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %step_e2b337 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %step_e2b337 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %step_e2b337 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca00e44be6 --- /dev/null +++ b/test/tint/builtins/gen/literal/step/e2b337.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn step_e2b337() { + var res : vec4 = step(vec4(1.0f), vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_e2b337(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_e2b337(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_e2b337(); +} diff --git a/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl new file mode 100644 index 0000000000..19f89822e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn storageBarrier() +fn storageBarrier_d87211() { + storageBarrier(); +} + +@compute @workgroup_size(1) +fn compute_main() { + storageBarrier_d87211(); +} diff --git a/test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8fb7cf9462 --- /dev/null +++ b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void storageBarrier_d87211() { + DeviceMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void compute_main() { + storageBarrier_d87211(); + return; +} diff --git a/test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.glsl b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.msl b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.msl rename to test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.msl diff --git a/test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.wgsl new file mode 100644 index 0000000000..b92968109a --- /dev/null +++ b/test/tint/builtins/gen/literal/storageBarrier/d87211.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn storageBarrier_d87211() { + storageBarrier(); +} + +@compute @workgroup_size(1) +fn compute_main() { + storageBarrier_d87211(); +} diff --git a/test/tint/builtins/gen/literal/tan/244e2a.wgsl b/test/tint/builtins/gen/literal/tan/244e2a.wgsl new file mode 100644 index 0000000000..da82991536 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/244e2a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(vec<4, f32>) -> vec<4, f32> +fn tan_244e2a() { + var res: vec4 = tan(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_244e2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_244e2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_244e2a(); +} diff --git a/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c3a9ade754 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_244e2a() { + float4 res = tan((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_244e2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_244e2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_244e2a(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c3a9ade754 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void tan_244e2a() { + float4 res = tan((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_244e2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_244e2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_244e2a(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.glsl new file mode 100644 index 0000000000..42276a14ab --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void tan_244e2a() { + vec4 res = tan(vec4(1.0f)); +} + +vec4 vertex_main() { + tan_244e2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_244e2a() { + vec4 res = tan(vec4(1.0f)); +} + +void fragment_main() { + tan_244e2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_244e2a() { + vec4 res = tan(vec4(1.0f)); +} + +void compute_main() { + tan_244e2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.msl new file mode 100644 index 0000000000..e405aaa9df --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_244e2a() { + float4 res = tan(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_244e2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_244e2a(); + return; +} + +kernel void compute_main() { + tan_244e2a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..13ef83a2d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_244e2a "tan_244e2a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float + %tan_244e2a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Tan %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %tan_244e2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %tan_244e2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tan_244e2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..afbf82d556 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/244e2a.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn tan_244e2a() { + var res : vec4 = tan(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_244e2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_244e2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_244e2a(); +} diff --git a/test/tint/builtins/gen/literal/tan/2f030e.wgsl b/test/tint/builtins/gen/literal/tan/2f030e.wgsl new file mode 100644 index 0000000000..c419bfe58a --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/2f030e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(f32) -> f32 +fn tan_2f030e() { + var res: f32 = tan(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_2f030e(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_2f030e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_2f030e(); +} diff --git a/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0ad9e4f702 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_2f030e() { + float res = tan(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_2f030e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_2f030e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_2f030e(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0ad9e4f702 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void tan_2f030e() { + float res = tan(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_2f030e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_2f030e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_2f030e(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.glsl new file mode 100644 index 0000000000..3ce88ec1e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void tan_2f030e() { + float res = tan(1.0f); +} + +vec4 vertex_main() { + tan_2f030e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_2f030e() { + float res = tan(1.0f); +} + +void fragment_main() { + tan_2f030e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_2f030e() { + float res = tan(1.0f); +} + +void compute_main() { + tan_2f030e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.msl new file mode 100644 index 0000000000..71d071f975 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_2f030e() { + float res = tan(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_2f030e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_2f030e(); + return; +} + +kernel void compute_main() { + tan_2f030e(); + return; +} + diff --git a/test/tint/builtins/gen/tan/2f030e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/tan/2f030e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.wgsl new file mode 100644 index 0000000000..dddd6dffb8 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/2f030e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn tan_2f030e() { + var res : f32 = tan(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_2f030e(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_2f030e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_2f030e(); +} diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl new file mode 100644 index 0000000000..912e7b9e94 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<4, f16>) -> vec<4, f16> +fn tan_539e54() { + var res: vec4 = tan(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_539e54(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_539e54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_539e54(); +} diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aa87efc428 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_539e54() { + vector res = tan((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_539e54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_539e54(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec31619c3a --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tan_539e54() { + vector res = tan((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_539e54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_539e54(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A069448210(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.glsl new file mode 100644 index 0000000000..8c9412796b --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_539e54() { + f16vec4 res = tan(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + tan_539e54(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_539e54() { + f16vec4 res = tan(f16vec4(0.0hf)); +} + +void fragment_main() { + tan_539e54(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_539e54() { + f16vec4 res = tan(f16vec4(0.0hf)); +} + +void compute_main() { + tan_539e54(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.msl new file mode 100644 index 0000000000..268bfda431 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_539e54() { + half4 res = tan(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_539e54(); + return; +} + +kernel void compute_main() { + tan_539e54(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.spvasm new file mode 100644 index 0000000000..12de658e73 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_539e54 "tan_539e54" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_539e54 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Tan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tan_539e54 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tan_539e54 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tan_539e54 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.wgsl new file mode 100644 index 0000000000..91e3dfd85e --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/539e54.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tan_539e54() { + var res : vec4 = tan(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_539e54(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_539e54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_539e54(); +} diff --git a/test/tint/builtins/gen/literal/tan/7ea104.wgsl b/test/tint/builtins/gen/literal/tan/7ea104.wgsl new file mode 100644 index 0000000000..33512ca73b --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/7ea104.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(vec<3, f32>) -> vec<3, f32> +fn tan_7ea104() { + var res: vec3 = tan(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_7ea104(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_7ea104(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_7ea104(); +} diff --git a/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3bfa5d96e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_7ea104() { + float3 res = tan((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_7ea104(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_7ea104(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_7ea104(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3bfa5d96e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void tan_7ea104() { + float3 res = tan((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_7ea104(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_7ea104(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_7ea104(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.glsl new file mode 100644 index 0000000000..2efb95c1eb --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void tan_7ea104() { + vec3 res = tan(vec3(1.0f)); +} + +vec4 vertex_main() { + tan_7ea104(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_7ea104() { + vec3 res = tan(vec3(1.0f)); +} + +void fragment_main() { + tan_7ea104(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_7ea104() { + vec3 res = tan(vec3(1.0f)); +} + +void compute_main() { + tan_7ea104(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.msl new file mode 100644 index 0000000000..bd468e30e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_7ea104() { + float3 res = tan(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_7ea104(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_7ea104(); + return; +} + +kernel void compute_main() { + tan_7ea104(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.spvasm new file mode 100644 index 0000000000..89ebac125e --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_7ea104 "tan_7ea104" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float + %tan_7ea104 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Tan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tan_7ea104 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tan_7ea104 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tan_7ea104 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0628434eb --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/7ea104.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn tan_7ea104() { + var res : vec3 = tan(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_7ea104(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_7ea104(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_7ea104(); +} diff --git a/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl new file mode 100644 index 0000000000..6ee152211f --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(vec<2, f32>) -> vec<2, f32> +fn tan_8ce3e9() { + var res: vec2 = tan(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_8ce3e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_8ce3e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_8ce3e9(); +} diff --git a/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..72b2654940 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_8ce3e9() { + float2 res = tan((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_8ce3e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_8ce3e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_8ce3e9(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..72b2654940 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void tan_8ce3e9() { + float2 res = tan((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_8ce3e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_8ce3e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_8ce3e9(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.glsl new file mode 100644 index 0000000000..801605f315 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void tan_8ce3e9() { + vec2 res = tan(vec2(1.0f)); +} + +vec4 vertex_main() { + tan_8ce3e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_8ce3e9() { + vec2 res = tan(vec2(1.0f)); +} + +void fragment_main() { + tan_8ce3e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_8ce3e9() { + vec2 res = tan(vec2(1.0f)); +} + +void compute_main() { + tan_8ce3e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.msl new file mode 100644 index 0000000000..53ffb9a889 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_8ce3e9() { + float2 res = tan(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_8ce3e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_8ce3e9(); + return; +} + +kernel void compute_main() { + tan_8ce3e9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..8cbcd32f51 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_8ce3e9 "tan_8ce3e9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float + %tan_8ce3e9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Tan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tan_8ce3e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tan_8ce3e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tan_8ce3e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..b0d2159c71 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/8ce3e9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn tan_8ce3e9() { + var res : vec2 = tan(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_8ce3e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_8ce3e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_8ce3e9(); +} diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl new file mode 100644 index 0000000000..1ff61569cc --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<2, f16>) -> vec<2, f16> +fn tan_9f7c9c() { + var res: vec2 = tan(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_9f7c9c(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_9f7c9c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_9f7c9c(); +} diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bac155593e --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_9f7c9c() { + vector res = tan((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_9f7c9c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_9f7c9c(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63c3d76f80 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tan_9f7c9c() { + vector res = tan((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_9f7c9c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_9f7c9c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000211853A84A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.glsl new file mode 100644 index 0000000000..2b07fc4c5a --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_9f7c9c() { + f16vec2 res = tan(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + tan_9f7c9c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_9f7c9c() { + f16vec2 res = tan(f16vec2(0.0hf)); +} + +void fragment_main() { + tan_9f7c9c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_9f7c9c() { + f16vec2 res = tan(f16vec2(0.0hf)); +} + +void compute_main() { + tan_9f7c9c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.msl new file mode 100644 index 0000000000..ff408adf59 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_9f7c9c() { + half2 res = tan(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_9f7c9c(); + return; +} + +kernel void compute_main() { + tan_9f7c9c(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.spvasm new file mode 100644 index 0000000000..658d6a6ba2 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_9f7c9c "tan_9f7c9c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_9f7c9c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Tan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tan_9f7c9c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tan_9f7c9c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tan_9f7c9c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.wgsl new file mode 100644 index 0000000000..1287e05b87 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/9f7c9c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tan_9f7c9c() { + var res : vec2 = tan(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_9f7c9c(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_9f7c9c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_9f7c9c(); +} diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl new file mode 100644 index 0000000000..c76db2db78 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(f16) -> f16 +fn tan_d4d491() { + var res: f16 = tan(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_d4d491(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_d4d491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_d4d491(); +} diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a4be323480 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_d4d491() { + float16_t res = tan(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_d4d491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_d4d491(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20570212c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void tan_d4d491() { + float16_t res = tan(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_d4d491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_d4d491(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FE0D3A0520(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FE0D3A0520(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.glsl new file mode 100644 index 0000000000..e6a73c88b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_d4d491() { + float16_t res = tan(0.0hf); +} + +vec4 vertex_main() { + tan_d4d491(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_d4d491() { + float16_t res = tan(0.0hf); +} + +void fragment_main() { + tan_d4d491(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_d4d491() { + float16_t res = tan(0.0hf); +} + +void compute_main() { + tan_d4d491(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.msl new file mode 100644 index 0000000000..3dc2e149eb --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_d4d491() { + half res = tan(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_d4d491(); + return; +} + +kernel void compute_main() { + tan_d4d491(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.spvasm new file mode 100644 index 0000000000..661dd9a146 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_d4d491 "tan_d4d491" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_d4d491 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Tan %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %tan_d4d491 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tan_d4d491 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_d4d491 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.wgsl new file mode 100644 index 0000000000..da8f919202 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/d4d491.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tan_d4d491() { + var res : f16 = tan(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_d4d491(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_d4d491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_d4d491(); +} diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl new file mode 100644 index 0000000000..9d70504d61 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<3, f16>) -> vec<3, f16> +fn tan_db0456() { + var res: vec3 = tan(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_db0456(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_db0456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_db0456(); +} diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2253d7178d --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tan_db0456() { + vector res = tan((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_db0456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_db0456(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d84a308668 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tan_db0456() { + vector res = tan((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_db0456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_db0456(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B50B7A7080(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.glsl new file mode 100644 index 0000000000..4812d1bcea --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_db0456() { + f16vec3 res = tan(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + tan_db0456(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_db0456() { + f16vec3 res = tan(f16vec3(0.0hf)); +} + +void fragment_main() { + tan_db0456(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_db0456() { + f16vec3 res = tan(f16vec3(0.0hf)); +} + +void compute_main() { + tan_db0456(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.msl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.msl new file mode 100644 index 0000000000..3d87665b6e --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tan_db0456() { + half3 res = tan(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_db0456(); + return; +} + +kernel void compute_main() { + tan_db0456(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f1c402d56 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_db0456 "tan_db0456" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_db0456 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Tan %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tan_db0456 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tan_db0456 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tan_db0456 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc68ad2922 --- /dev/null +++ b/test/tint/builtins/gen/literal/tan/db0456.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tan_db0456() { + var res : vec3 = tan(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_db0456(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_db0456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_db0456(); +} diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl new file mode 100644 index 0000000000..a02fef4c6c --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<3, f16>) -> vec<3, f16> +fn tanh_06a4fe() { + var res: vec3 = tanh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_06a4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_06a4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_06a4fe(); +} diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fb193b2da9 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_06a4fe() { + vector res = tanh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_06a4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_06a4fe(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..34fa18b40f --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tanh_06a4fe() { + vector res = tanh((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_06a4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_06a4fe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025833A77D70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.glsl new file mode 100644 index 0000000000..0840a2cd06 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_06a4fe() { + f16vec3 res = tanh(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + tanh_06a4fe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_06a4fe() { + f16vec3 res = tanh(f16vec3(0.0hf)); +} + +void fragment_main() { + tanh_06a4fe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_06a4fe() { + f16vec3 res = tanh(f16vec3(0.0hf)); +} + +void compute_main() { + tanh_06a4fe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.msl new file mode 100644 index 0000000000..ae1bf02628 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_06a4fe() { + half3 res = tanh(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_06a4fe(); + return; +} + +kernel void compute_main() { + tanh_06a4fe(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.spvasm new file mode 100644 index 0000000000..b06c654726 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_06a4fe "tanh_06a4fe" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_06a4fe = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Tanh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tanh_06a4fe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tanh_06a4fe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tanh_06a4fe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.wgsl new file mode 100644 index 0000000000..fde59a5219 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/06a4fe.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tanh_06a4fe() { + var res : vec3 = tanh(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_06a4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_06a4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_06a4fe(); +} diff --git a/test/tint/builtins/gen/literal/tanh/5663c5.wgsl b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl new file mode 100644 index 0000000000..4bbd36a69a --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(vec<4, f32>) -> vec<4, f32> +fn tanh_5663c5() { + var res: vec4 = tanh(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5663c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5663c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5663c5(); +} diff --git a/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..44023e02dc --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_5663c5() { + float4 res = tanh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5663c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5663c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5663c5(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44023e02dc --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void tanh_5663c5() { + float4 res = tanh((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5663c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5663c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5663c5(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.glsl new file mode 100644 index 0000000000..cfff79f682 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void tanh_5663c5() { + vec4 res = tanh(vec4(1.0f)); +} + +vec4 vertex_main() { + tanh_5663c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_5663c5() { + vec4 res = tanh(vec4(1.0f)); +} + +void fragment_main() { + tanh_5663c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_5663c5() { + vec4 res = tanh(vec4(1.0f)); +} + +void compute_main() { + tanh_5663c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.msl new file mode 100644 index 0000000000..3c9c45bed3 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_5663c5() { + float4 res = tanh(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5663c5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5663c5(); + return; +} + +kernel void compute_main() { + tanh_5663c5(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.spvasm new file mode 100644 index 0000000000..ccad998b63 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5663c5 "tanh_5663c5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%tanh_5663c5 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Tanh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %tanh_5663c5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %tanh_5663c5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tanh_5663c5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..aff1207620 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5663c5.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn tanh_5663c5() { + var res : vec4 = tanh(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5663c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5663c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5663c5(); +} diff --git a/test/tint/builtins/gen/literal/tanh/5724b3.wgsl b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl new file mode 100644 index 0000000000..a937558257 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(vec<2, f32>) -> vec<2, f32> +fn tanh_5724b3() { + var res: vec2 = tanh(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5724b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5724b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5724b3(); +} diff --git a/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2cfae5151 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_5724b3() { + float2 res = tanh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5724b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5724b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5724b3(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b2cfae5151 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void tanh_5724b3() { + float2 res = tanh((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5724b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5724b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5724b3(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.glsl new file mode 100644 index 0000000000..1bd2acfc90 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void tanh_5724b3() { + vec2 res = tanh(vec2(1.0f)); +} + +vec4 vertex_main() { + tanh_5724b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_5724b3() { + vec2 res = tanh(vec2(1.0f)); +} + +void fragment_main() { + tanh_5724b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_5724b3() { + vec2 res = tanh(vec2(1.0f)); +} + +void compute_main() { + tanh_5724b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.msl new file mode 100644 index 0000000000..d2b6b1b3f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_5724b3() { + float2 res = tanh(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5724b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5724b3(); + return; +} + +kernel void compute_main() { + tanh_5724b3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..7adc88a301 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5724b3 "tanh_5724b3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%tanh_5724b3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Tanh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tanh_5724b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tanh_5724b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tanh_5724b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..98669652e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5724b3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn tanh_5724b3() { + var res : vec2 = tanh(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5724b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5724b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5724b3(); +} diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl new file mode 100644 index 0000000000..b83daaed7a --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(f16) -> f16 +fn tanh_5b19af() { + var res: f16 = tanh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5b19af(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5b19af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5b19af(); +} diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9d2dee63f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_5b19af() { + float16_t res = tanh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5b19af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5b19af(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..de2732f3a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void tanh_5b19af() { + float16_t res = tanh(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5b19af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5b19af(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016C55EB1160(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000016C55EB1160(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.glsl new file mode 100644 index 0000000000..b909cb973e --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_5b19af() { + float16_t res = tanh(0.0hf); +} + +vec4 vertex_main() { + tanh_5b19af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_5b19af() { + float16_t res = tanh(0.0hf); +} + +void fragment_main() { + tanh_5b19af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_5b19af() { + float16_t res = tanh(0.0hf); +} + +void compute_main() { + tanh_5b19af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.msl new file mode 100644 index 0000000000..a0122945d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_5b19af() { + half res = tanh(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5b19af(); + return; +} + +kernel void compute_main() { + tanh_5b19af(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.spvasm new file mode 100644 index 0000000000..db2580f69f --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5b19af "tanh_5b19af" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_5b19af = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Tanh %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %tanh_5b19af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tanh_5b19af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_5b19af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2e42178b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/5b19af.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tanh_5b19af() { + var res : f16 = tanh(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5b19af(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5b19af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5b19af(); +} diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl new file mode 100644 index 0000000000..acd3e21433 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<2, f16>) -> vec<2, f16> +fn tanh_6d105a() { + var res: vec2 = tanh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_6d105a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_6d105a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_6d105a(); +} diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9a1b417fed --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_6d105a() { + vector res = tanh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_6d105a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_6d105a(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fce0b8088c --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tanh_6d105a() { + vector res = tanh((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_6d105a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_6d105a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015291DA1160(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.glsl new file mode 100644 index 0000000000..f5aa9d4254 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_6d105a() { + f16vec2 res = tanh(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + tanh_6d105a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_6d105a() { + f16vec2 res = tanh(f16vec2(0.0hf)); +} + +void fragment_main() { + tanh_6d105a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_6d105a() { + f16vec2 res = tanh(f16vec2(0.0hf)); +} + +void compute_main() { + tanh_6d105a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.msl new file mode 100644 index 0000000000..b9795af0a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_6d105a() { + half2 res = tanh(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_6d105a(); + return; +} + +kernel void compute_main() { + tanh_6d105a(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.spvasm new file mode 100644 index 0000000000..101dbc6ab6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_6d105a "tanh_6d105a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_6d105a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Tanh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tanh_6d105a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tanh_6d105a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tanh_6d105a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b0b089628 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/6d105a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tanh_6d105a() { + var res : vec2 = tanh(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_6d105a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_6d105a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_6d105a(); +} diff --git a/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl new file mode 100644 index 0000000000..f4712f426a --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(vec<3, f32>) -> vec<3, f32> +fn tanh_9f9fb9() { + var res: vec3 = tanh(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_9f9fb9(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_9f9fb9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_9f9fb9(); +} diff --git a/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21cc8d3743 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_9f9fb9() { + float3 res = tanh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_9f9fb9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_9f9fb9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_9f9fb9(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21cc8d3743 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void tanh_9f9fb9() { + float3 res = tanh((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_9f9fb9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_9f9fb9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_9f9fb9(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.glsl new file mode 100644 index 0000000000..d065337103 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void tanh_9f9fb9() { + vec3 res = tanh(vec3(1.0f)); +} + +vec4 vertex_main() { + tanh_9f9fb9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_9f9fb9() { + vec3 res = tanh(vec3(1.0f)); +} + +void fragment_main() { + tanh_9f9fb9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_9f9fb9() { + vec3 res = tanh(vec3(1.0f)); +} + +void compute_main() { + tanh_9f9fb9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.msl new file mode 100644 index 0000000000..326f3c41aa --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_9f9fb9() { + float3 res = tanh(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_9f9fb9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_9f9fb9(); + return; +} + +kernel void compute_main() { + tanh_9f9fb9(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.spvasm new file mode 100644 index 0000000000..63ec832c44 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_9f9fb9 "tanh_9f9fb9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%tanh_9f9fb9 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Tanh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tanh_9f9fb9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tanh_9f9fb9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tanh_9f9fb9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.wgsl new file mode 100644 index 0000000000..29041ab524 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/9f9fb9.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn tanh_9f9fb9() { + var res : vec3 = tanh(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_9f9fb9(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_9f9fb9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_9f9fb9(); +} diff --git a/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl new file mode 100644 index 0000000000..679797faf9 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(f32) -> f32 +fn tanh_c15fdb() { + var res: f32 = tanh(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_c15fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_c15fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_c15fdb(); +} diff --git a/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab6b249ef0 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_c15fdb() { + float res = tanh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_c15fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_c15fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_c15fdb(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ab6b249ef0 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void tanh_c15fdb() { + float res = tanh(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_c15fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_c15fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_c15fdb(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.glsl new file mode 100644 index 0000000000..a76821c452 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void tanh_c15fdb() { + float res = tanh(1.0f); +} + +vec4 vertex_main() { + tanh_c15fdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_c15fdb() { + float res = tanh(1.0f); +} + +void fragment_main() { + tanh_c15fdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_c15fdb() { + float res = tanh(1.0f); +} + +void compute_main() { + tanh_c15fdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.msl new file mode 100644 index 0000000000..c71c1f6bb6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_c15fdb() { + float res = tanh(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_c15fdb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_c15fdb(); + return; +} + +kernel void compute_main() { + tanh_c15fdb(); + return; +} + diff --git a/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..799e1772fe --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/c15fdb.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn tanh_c15fdb() { + var res : f32 = tanh(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_c15fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_c15fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_c15fdb(); +} diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl new file mode 100644 index 0000000000..c0579ccae6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<4, f16>) -> vec<4, f16> +fn tanh_e8efb3() { + var res: vec4 = tanh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_e8efb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_e8efb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_e8efb3(); +} diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..547e3c1fd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void tanh_e8efb3() { + vector res = tanh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_e8efb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_e8efb3(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc5d017601 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void tanh_e8efb3() { + vector res = tanh((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_e8efb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_e8efb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E87C8DF490(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.glsl new file mode 100644 index 0000000000..7d9bf9195d --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_e8efb3() { + f16vec4 res = tanh(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + tanh_e8efb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_e8efb3() { + f16vec4 res = tanh(f16vec4(0.0hf)); +} + +void fragment_main() { + tanh_e8efb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_e8efb3() { + f16vec4 res = tanh(f16vec4(0.0hf)); +} + +void compute_main() { + tanh_e8efb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.msl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.msl new file mode 100644 index 0000000000..7da14aace6 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void tanh_e8efb3() { + half4 res = tanh(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_e8efb3(); + return; +} + +kernel void compute_main() { + tanh_e8efb3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b18be4610 --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_e8efb3 "tanh_e8efb3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_e8efb3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Tanh %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tanh_e8efb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tanh_e8efb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tanh_e8efb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..5cde1f82de --- /dev/null +++ b/test/tint/builtins/gen/literal/tanh/e8efb3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn tanh_e8efb3() { + var res : vec4 = tanh(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_e8efb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_e8efb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_e8efb3(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl new file mode 100644 index 0000000000..8ca4261cbd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d) -> i32 +fn textureDimensions_002b2a() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_002b2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_002b2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_002b2a(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..29d0c12d90 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_002b2a() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_002b2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_002b2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_002b2a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..29d0c12d90 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_002b2a() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_002b2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_002b2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_002b2a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.glsl new file mode 100644 index 0000000000..9ee3490e43 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_002b2a() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_002b2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureDimensions_002b2a() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_002b2a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_002b2a() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_002b2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.msl new file mode 100644 index 0000000000..b5b212146d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_002b2a(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_002b2a(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_002b2a(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_002b2a(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..5f09068124 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/002b2a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_002b2a() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_002b2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_002b2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_002b2a(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl new file mode 100644 index 0000000000..3fd6388d25 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_012b82() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_012b82(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_012b82(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_012b82(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..56fb818a4f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_012b82() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_012b82(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_012b82(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_012b82(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56fb818a4f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_012b82() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_012b82(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_012b82(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_012b82(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.glsl new file mode 100644 index 0000000000..9ae3c1ba4a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_012b82() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_012b82(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_012b82() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_012b82(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_012b82() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_012b82(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.msl new file mode 100644 index 0000000000..f53807b875 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_012b82(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_012b82(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_012b82(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_012b82(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.wgsl new file mode 100644 index 0000000000..216df4f29f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/012b82.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_012b82() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_012b82(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_012b82(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_012b82(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl new file mode 100644 index 0000000000..2b1e057b00 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_08753d() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_08753d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_08753d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_08753d(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83011fff55 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_08753d() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_08753d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_08753d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_08753d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83011fff55 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_08753d() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_08753d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_08753d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_08753d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.glsl new file mode 100644 index 0000000000..0b0f9e39c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_08753d() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_08753d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_08753d() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_08753d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_08753d() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_08753d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.msl new file mode 100644 index 0000000000..a1fa2f3981 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_08753d(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_08753d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_08753d(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_08753d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.wgsl new file mode 100644 index 0000000000..443a678ed3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/08753d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_08753d() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_08753d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_08753d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_08753d(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl new file mode 100644 index 0000000000..6341954156 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_0c4772() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0c4772(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0c4772(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0c4772(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3de620cf2c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0c4772() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0c4772(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0c4772(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0c4772(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3de620cf2c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0c4772() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0c4772(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0c4772(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0c4772(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.glsl new file mode 100644 index 0000000000..f58182c691 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureDimensions_0c4772() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0c4772(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureDimensions_0c4772() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0c4772(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureDimensions_0c4772() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0c4772(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.msl new file mode 100644 index 0000000000..cc675e6c22 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0c4772(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_0c4772(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0c4772(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0c4772(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc2907df4a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0c4772.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_0c4772() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0c4772(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0c4772(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0c4772(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl new file mode 100644 index 0000000000..9b72fc3321 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_0cce40() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cce40(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0cce40(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0cce40(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e10fdf6f36 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_0cce40() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cce40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cce40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cce40(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e10fdf6f36 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_0cce40() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cce40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cce40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cce40(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.glsl new file mode 100644 index 0000000000..a0df901a1e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_0cce40() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0cce40(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_0cce40() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0cce40(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_0cce40() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0cce40(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.msl new file mode 100644 index 0000000000..e95504846d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0cce40(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_0cce40(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0cce40(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0cce40(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.wgsl new file mode 100644 index 0000000000..5193665715 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cce40.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_0cce40() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cce40(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0cce40(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0cce40(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl new file mode 100644 index 0000000000..82980ef15c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_0cf2ff() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cf2ff(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0cf2ff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0cf2ff(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3b9fd521cc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_0cf2ff() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cf2ff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cf2ff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cf2ff(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3b9fd521cc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_0cf2ff() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cf2ff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cf2ff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cf2ff(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.glsl new file mode 100644 index 0000000000..d91c9dbce7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_0cf2ff() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0cf2ff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_0cf2ff() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0cf2ff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_0cf2ff() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0cf2ff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.msl new file mode 100644 index 0000000000..875a38898b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0cf2ff(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_0cf2ff(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0cf2ff(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0cf2ff(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.wgsl new file mode 100644 index 0000000000..a13b916c8a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0cf2ff.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_0cf2ff() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cf2ff(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0cf2ff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0cf2ff(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl new file mode 100644 index 0000000000..1a88f862ca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_0d8b7e() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0d8b7e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0d8b7e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0d8b7e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..848d8b7dae --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_0d8b7e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0d8b7e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0d8b7e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0d8b7e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..848d8b7dae --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_0d8b7e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0d8b7e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0d8b7e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0d8b7e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.glsl new file mode 100644 index 0000000000..19bb91aa0d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_0d8b7e() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_0d8b7e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_0d8b7e() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_0d8b7e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_0d8b7e() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_0d8b7e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.msl new file mode 100644 index 0000000000..d07d72a409 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0d8b7e(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_0d8b7e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_0d8b7e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_0d8b7e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ce14eadae --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0d8b7e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_0d8b7e() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0d8b7e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0d8b7e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0d8b7e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl new file mode 100644 index 0000000000..cad4daed9f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_0e32ee() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0e32ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0e32ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0e32ee(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f338cc3fc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0e32ee() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0e32ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0e32ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0e32ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f338cc3fc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0e32ee() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0e32ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0e32ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0e32ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.glsl new file mode 100644 index 0000000000..3b004866e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_0e32ee() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0e32ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_0e32ee() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0e32ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_0e32ee() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0e32ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.msl new file mode 100644 index 0000000000..376e7b1473 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0e32ee(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_0e32ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0e32ee(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0e32ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..c037616b43 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0e32ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_0e32ee() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0e32ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0e32ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0e32ee(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl new file mode 100644 index 0000000000..ed32924912 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array) -> vec2 +fn textureDimensions_0f3c50() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0f3c50(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0f3c50(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0f3c50(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5bef2982da --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_0f3c50() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0f3c50(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0f3c50(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0f3c50(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5bef2982da --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_0f3c50() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0f3c50(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0f3c50(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0f3c50(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.glsl new file mode 100644 index 0000000000..da53ee88db --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_0f3c50() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_0f3c50(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_0f3c50() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_0f3c50(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_0f3c50() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_0f3c50(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.msl new file mode 100644 index 0000000000..9e6f6ab279 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0f3c50(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_0f3c50(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_0f3c50(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_0f3c50(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.wgsl new file mode 100644 index 0000000000..45eee36977 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/0f3c50.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_0f3c50() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0f3c50(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0f3c50(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0f3c50(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl new file mode 100644 index 0000000000..d035ecdb6f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d) -> vec2 +fn textureDimensions_1191a5() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1191a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1191a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1191a5(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cedbfad032 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_1191a5() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1191a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1191a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1191a5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cedbfad032 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_1191a5() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1191a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1191a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1191a5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.glsl new file mode 100644 index 0000000000..0514b2e300 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_1191a5() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_1191a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureDimensions_1191a5() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_1191a5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_1191a5() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_1191a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.msl new file mode 100644 index 0000000000..c08c723d33 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1191a5(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_1191a5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_1191a5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_1191a5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0e1745f76 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1191a5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_1191a5() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1191a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1191a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1191a5(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl new file mode 100644 index 0000000000..1d3c89af0a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureDimensions(texture: texture_depth_2d, level: i32) -> vec2 +fn textureDimensions_12c9bb() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_12c9bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_12c9bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_12c9bb(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..632362bcdc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_12c9bb() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_12c9bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_12c9bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_12c9bb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..632362bcdc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_12c9bb() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_12c9bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_12c9bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_12c9bb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.glsl new file mode 100644 index 0000000000..6c58bd4647 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_12c9bb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_12c9bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_12c9bb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_12c9bb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_12c9bb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_12c9bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.msl new file mode 100644 index 0000000000..83f261505e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_12c9bb(depth2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureDimensions_12c9bb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_12c9bb(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_12c9bb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.spvasm new file mode 100644 index 0000000000..18c8dbe6c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_12c9bb "textureDimensions_12c9bb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %20 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_12c9bb = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %20 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_12c9bb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_12c9bb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_12c9bb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..857ce06480 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/12c9bb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureDimensions_12c9bb() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_12c9bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_12c9bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_12c9bb(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl new file mode 100644 index 0000000000..8a884251bb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_147998() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_147998(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_147998(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_147998(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af1e9bd856 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_147998() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_147998(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_147998(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_147998(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af1e9bd856 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_147998() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_147998(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_147998(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_147998(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.glsl new file mode 100644 index 0000000000..90d19e81e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureDimensions_147998() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_147998(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureDimensions_147998() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_147998(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureDimensions_147998() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_147998(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.msl new file mode 100644 index 0000000000..25431038ea --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_147998(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_147998(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_147998(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_147998(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.wgsl new file mode 100644 index 0000000000..8379507811 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/147998.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_147998() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_147998(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_147998(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_147998(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl new file mode 100644 index 0000000000..a1baa9600b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_16036c() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_16036c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_16036c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_16036c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..02565baa5f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_16036c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_16036c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_16036c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_16036c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..02565baa5f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_16036c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_16036c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_16036c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_16036c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.glsl new file mode 100644 index 0000000000..5e4d6923f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_16036c() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_16036c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_16036c() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_16036c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_16036c() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_16036c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.msl new file mode 100644 index 0000000000..4872c899f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_16036c(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_16036c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_16036c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_16036c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a9c5f30b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/16036c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_16036c() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_16036c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_16036c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_16036c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl new file mode 100644 index 0000000000..d77491e2f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_1b71f0() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1b71f0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1b71f0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1b71f0(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1ffa3d3b90 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_1b71f0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1b71f0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1b71f0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1b71f0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1ffa3d3b90 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_1b71f0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1b71f0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1b71f0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1b71f0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.glsl new file mode 100644 index 0000000000..16bd5b604e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_1b71f0() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_1b71f0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_1b71f0() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_1b71f0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_1b71f0() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_1b71f0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.msl new file mode 100644 index 0000000000..9ef7f55bb6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1b71f0(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_1b71f0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_1b71f0(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_1b71f0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee928e222f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1b71f0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_1b71f0() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1b71f0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1b71f0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1b71f0(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl new file mode 100644 index 0000000000..b5cb5d958d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_1d6c26() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1d6c26(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1d6c26(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1d6c26(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..26140a05d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_1d6c26() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1d6c26(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1d6c26(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1d6c26(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26140a05d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_1d6c26() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1d6c26(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1d6c26(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1d6c26(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.glsl new file mode 100644 index 0000000000..bea79ae702 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureDimensions_1d6c26() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_1d6c26(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureDimensions_1d6c26() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_1d6c26(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureDimensions_1d6c26() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_1d6c26(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.msl new file mode 100644 index 0000000000..65d506dd62 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1d6c26(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_1d6c26(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_1d6c26(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_1d6c26(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.wgsl new file mode 100644 index 0000000000..8bb5c22cd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1d6c26.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_1d6c26() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1d6c26(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1d6c26(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1d6c26(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl new file mode 100644 index 0000000000..8e3eb59b29 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_1e9e39() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1e9e39(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1e9e39(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1e9e39(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..16444c0f2a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_1e9e39() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1e9e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1e9e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1e9e39(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16444c0f2a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_1e9e39() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1e9e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1e9e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1e9e39(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.glsl new file mode 100644 index 0000000000..067bc8bce7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureDimensions_1e9e39() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_1e9e39(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureDimensions_1e9e39() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_1e9e39(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureDimensions_1e9e39() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_1e9e39(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.msl new file mode 100644 index 0000000000..352d58df65 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1e9e39(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_1e9e39(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_1e9e39(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_1e9e39(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.wgsl new file mode 100644 index 0000000000..efd42acd26 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1e9e39.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_1e9e39() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1e9e39(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1e9e39(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1e9e39(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl new file mode 100644 index 0000000000..4be52a4fdb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array) -> vec2 +fn textureDimensions_1f20c5() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1f20c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1f20c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1f20c5(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e453d42df6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_1f20c5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1f20c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1f20c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1f20c5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e453d42df6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_1f20c5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1f20c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1f20c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1f20c5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.glsl new file mode 100644 index 0000000000..ac742c2d81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_1f20c5() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_1f20c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_1f20c5() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_1f20c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_1f20c5() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_1f20c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.msl new file mode 100644 index 0000000000..d35a456705 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1f20c5(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_1f20c5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_1f20c5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_1f20c5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..4800bad9b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/1f20c5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_1f20c5() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1f20c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1f20c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1f20c5(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl new file mode 100644 index 0000000000..070bb0bb2c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_214dd4() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_214dd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_214dd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_214dd4(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c91423eba6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_214dd4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_214dd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_214dd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_214dd4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c91423eba6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_214dd4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_214dd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_214dd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_214dd4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.glsl new file mode 100644 index 0000000000..d7f534f801 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_214dd4() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_214dd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_214dd4() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_214dd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_214dd4() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_214dd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.msl new file mode 100644 index 0000000000..169ee329ac --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_214dd4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_214dd4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_214dd4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_214dd4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..8fdb8a387e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/214dd4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_214dd4() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_214dd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_214dd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_214dd4(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl new file mode 100644 index 0000000000..d0dfbbe318 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 +fn textureDimensions_221f22() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_221f22(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_221f22(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_221f22(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..59cb5bb483 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_221f22() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_221f22(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_221f22(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_221f22(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..59cb5bb483 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_221f22() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_221f22(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_221f22(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_221f22(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.glsl new file mode 100644 index 0000000000..2e53eb0ae1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_221f22() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_221f22(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_221f22() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_221f22(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_221f22() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_221f22(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.msl new file mode 100644 index 0000000000..d20f6575b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_221f22(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_221f22(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_221f22(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_221f22(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.spvasm new file mode 100644 index 0000000000..4485240604 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_221f22 "textureDimensions_221f22" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %22 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_221f22 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %22 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_221f22 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_221f22 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_221f22 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.wgsl new file mode 100644 index 0000000000..6956187ea6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/221f22.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_221f22() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_221f22(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_221f22(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_221f22(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl new file mode 100644 index 0000000000..7915de394d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 +fn textureDimensions_267788() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_267788(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_267788(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_267788(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3597aaed8e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_267788() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_267788(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_267788(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_267788(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3597aaed8e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_267788() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_267788(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_267788(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_267788(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.glsl new file mode 100644 index 0000000000..d3423eae5d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_267788() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_267788(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_267788() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_267788(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_267788() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_267788(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.msl new file mode 100644 index 0000000000..09590894e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_267788(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_267788(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_267788(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_267788(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.spvasm new file mode 100644 index 0000000000..f9410bc89a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_267788 "textureDimensions_267788" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %23 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_267788 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %26 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySizeLod %v3int %22 %23 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_267788 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_267788 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_267788 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.wgsl new file mode 100644 index 0000000000..c52fe144ab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/267788.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_267788() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_267788(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_267788(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_267788(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl new file mode 100644 index 0000000000..43d1a6fce5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 +fn textureDimensions_26bdfa() { + var res: vec3 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26bdfa(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_26bdfa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_26bdfa(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c15bc9aa6e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_26bdfa() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26bdfa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26bdfa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26bdfa(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c15bc9aa6e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_26bdfa() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26bdfa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26bdfa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26bdfa(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.glsl new file mode 100644 index 0000000000..2d44944969 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_26bdfa() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_26bdfa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureDimensions_26bdfa() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_26bdfa(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_26bdfa() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_26bdfa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.msl new file mode 100644 index 0000000000..0827592b25 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_26bdfa(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0), tint_symbol_1.get_depth(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_26bdfa(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_26bdfa(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_26bdfa(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c48480271 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_26bdfa "textureDimensions_26bdfa" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %20 = OpConstantNull %int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_26bdfa = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v3int %19 %20 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_26bdfa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_26bdfa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_26bdfa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.wgsl new file mode 100644 index 0000000000..29982f72ba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26bdfa.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_26bdfa() { + var res : vec3 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26bdfa(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_26bdfa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_26bdfa(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl new file mode 100644 index 0000000000..4cde4c95e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_26ef6c() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26ef6c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_26ef6c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_26ef6c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7ccf32f5db --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_26ef6c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26ef6c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26ef6c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26ef6c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7ccf32f5db --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_26ef6c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26ef6c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26ef6c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26ef6c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.glsl new file mode 100644 index 0000000000..dbdb178ec8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_26ef6c() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_26ef6c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_26ef6c() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_26ef6c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_26ef6c() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_26ef6c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.msl new file mode 100644 index 0000000000..ba9013a8ad --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_26ef6c(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_26ef6c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_26ef6c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_26ef6c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0b495c846 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/26ef6c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_26ef6c() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26ef6c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_26ef6c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_26ef6c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl new file mode 100644 index 0000000000..593565bdc8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_2ad087() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2ad087(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2ad087(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2ad087(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..33dee501da --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_2ad087() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2ad087(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2ad087(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2ad087(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..33dee501da --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_2ad087() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2ad087(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2ad087(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2ad087(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.glsl new file mode 100644 index 0000000000..90289b322c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_2ad087() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_2ad087(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_2ad087() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_2ad087(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_2ad087() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_2ad087(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.msl new file mode 100644 index 0000000000..011b3cb465 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_2ad087(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_2ad087(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2ad087(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2ad087(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.wgsl new file mode 100644 index 0000000000..e965a18e09 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2ad087.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_2ad087() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2ad087(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2ad087(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2ad087(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl new file mode 100644 index 0000000000..74f92a09e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 +fn textureDimensions_2efa05() { + var res: vec3 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2efa05(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2efa05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2efa05(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1ad01c0e4d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_2efa05() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2efa05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2efa05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2efa05(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1ad01c0e4d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_2efa05() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2efa05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2efa05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2efa05(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.glsl new file mode 100644 index 0000000000..13c367afde --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_2efa05() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_2efa05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureDimensions_2efa05() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_2efa05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_2efa05() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_2efa05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.msl new file mode 100644 index 0000000000..4f373e5006 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_2efa05(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0), tint_symbol_1.get_depth(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_2efa05(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2efa05(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2efa05(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a22b83296 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2efa05 "textureDimensions_2efa05" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %21 = OpConstantNull %int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpConstantNull %v3int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2efa05 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %24 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v3int %20 %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_2efa05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_2efa05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_2efa05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.wgsl new file mode 100644 index 0000000000..f68fe06566 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2efa05.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_2efa05() { + var res : vec3 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2efa05(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2efa05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2efa05(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl new file mode 100644 index 0000000000..d5bbd8606b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_2f289f() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2f289f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2f289f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2f289f(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b84004a0c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_2f289f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2f289f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2f289f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2f289f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b84004a0c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_2f289f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2f289f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2f289f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2f289f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.glsl new file mode 100644 index 0000000000..ecf5ce00b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_2f289f() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_2f289f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_2f289f() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_2f289f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_2f289f() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_2f289f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.msl new file mode 100644 index 0000000000..a61bafeb5d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_2f289f(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_2f289f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2f289f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2f289f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.wgsl new file mode 100644 index 0000000000..6895807816 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2f289f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_2f289f() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2f289f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2f289f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2f289f(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl new file mode 100644 index 0000000000..09fc3aa81d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 +fn textureDimensions_2fe1cc() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2fe1cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2fe1cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2fe1cc(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9cc8388b87 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_2fe1cc() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2fe1cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2fe1cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2fe1cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9cc8388b87 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_2fe1cc() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2fe1cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2fe1cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2fe1cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.glsl new file mode 100644 index 0000000000..95caf65d0b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_2fe1cc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_2fe1cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_2fe1cc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_2fe1cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_2fe1cc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_2fe1cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.msl new file mode 100644 index 0000000000..2dc5042f58 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_2fe1cc(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_2fe1cc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2fe1cc(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2fe1cc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..1d4dd98f5d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2fe1cc "textureDimensions_2fe1cc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %20 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2fe1cc = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %20 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_2fe1cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_2fe1cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_2fe1cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..acc6e45796 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/2fe1cc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_2fe1cc() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2fe1cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2fe1cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2fe1cc(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl new file mode 100644 index 0000000000..dd4bfd14cb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_318ecc() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_318ecc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_318ecc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_318ecc(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bc9b732479 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_318ecc() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_318ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_318ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_318ecc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bc9b732479 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_318ecc() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_318ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_318ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_318ecc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.glsl new file mode 100644 index 0000000000..078e8b3968 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_318ecc() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_318ecc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_318ecc() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_318ecc(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_318ecc() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_318ecc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.msl new file mode 100644 index 0000000000..a9655f52bf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_318ecc(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_318ecc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_318ecc(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_318ecc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a7028c4a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/318ecc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_318ecc() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_318ecc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_318ecc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_318ecc(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl new file mode 100644 index 0000000000..df9309bf7e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_340d06() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_340d06(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_340d06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_340d06(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db01f68004 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_340d06() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_340d06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_340d06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_340d06(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..db01f68004 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_340d06() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_340d06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_340d06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_340d06(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.glsl new file mode 100644 index 0000000000..78d4994be5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_340d06() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_340d06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_340d06() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_340d06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_340d06() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_340d06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.msl new file mode 100644 index 0000000000..eb04eb88e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_340d06(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_340d06(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_340d06(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_340d06(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.wgsl new file mode 100644 index 0000000000..99bca2d762 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/340d06.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_340d06() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_340d06(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_340d06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_340d06(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl new file mode 100644 index 0000000000..f4c09755b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_398e30() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_398e30(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_398e30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_398e30(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee95c58978 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_398e30() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_398e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_398e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_398e30(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ee95c58978 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_398e30() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_398e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_398e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_398e30(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.glsl new file mode 100644 index 0000000000..6db635123c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_398e30() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_398e30(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_398e30() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_398e30(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_398e30() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_398e30(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.msl new file mode 100644 index 0000000000..8de5617137 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_398e30(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_398e30(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_398e30(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_398e30(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.wgsl new file mode 100644 index 0000000000..5deab7d0d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/398e30.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_398e30() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_398e30(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_398e30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_398e30(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl new file mode 100644 index 0000000000..db77b57707 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_3a94ea() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3a94ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3a94ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3a94ea(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..347c92e0ac --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3a94ea() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3a94ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3a94ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3a94ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..347c92e0ac --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3a94ea() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3a94ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3a94ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3a94ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.glsl new file mode 100644 index 0000000000..4e7d2639ab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_3a94ea() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_3a94ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_3a94ea() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_3a94ea(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_3a94ea() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_3a94ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.msl new file mode 100644 index 0000000000..7dd2f6b70b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_3a94ea(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_3a94ea(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_3a94ea(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_3a94ea(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..c1cebafe60 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3a94ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_3a94ea() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3a94ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3a94ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3a94ea(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl new file mode 100644 index 0000000000..673d8c24ae --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_3aca08() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3aca08(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3aca08(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3aca08(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..05eedf3b92 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_3aca08() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3aca08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3aca08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3aca08(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..05eedf3b92 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_3aca08() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3aca08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3aca08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3aca08(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.glsl new file mode 100644 index 0000000000..e9c16564df --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureDimensions_3aca08() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_3aca08(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureDimensions_3aca08() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_3aca08(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureDimensions_3aca08() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_3aca08(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.msl new file mode 100644 index 0000000000..765771f8f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_3aca08(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_3aca08(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_3aca08(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_3aca08(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.wgsl new file mode 100644 index 0000000000..1a72665839 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3aca08.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_3aca08() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3aca08(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3aca08(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3aca08(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl new file mode 100644 index 0000000000..3fe2fb6818 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_3c5ad8() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3c5ad8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3c5ad8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3c5ad8(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..78cd91bd88 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3c5ad8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3c5ad8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3c5ad8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3c5ad8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..78cd91bd88 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3c5ad8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3c5ad8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3c5ad8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3c5ad8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.glsl new file mode 100644 index 0000000000..b27ab3b6af --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_3c5ad8() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_3c5ad8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_3c5ad8() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_3c5ad8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_3c5ad8() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_3c5ad8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.msl new file mode 100644 index 0000000000..ba7e47a6a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_3c5ad8(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_3c5ad8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_3c5ad8(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_3c5ad8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.wgsl new file mode 100644 index 0000000000..a73139d844 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/3c5ad8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_3c5ad8() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3c5ad8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3c5ad8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3c5ad8(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl new file mode 100644 index 0000000000..2e88d1b469 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array) -> vec2 +fn textureDimensions_4152a6() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4152a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4152a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4152a6(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae5eb3529e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_4152a6() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4152a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4152a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4152a6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ae5eb3529e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_4152a6() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4152a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4152a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4152a6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.glsl new file mode 100644 index 0000000000..d3120a3cc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_4152a6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_4152a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_4152a6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_4152a6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_4152a6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_4152a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.msl new file mode 100644 index 0000000000..ac8d43dac9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_4152a6(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_4152a6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_4152a6(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_4152a6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..67521abbcd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4152a6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_4152a6() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4152a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4152a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4152a6(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl new file mode 100644 index 0000000000..f358b83d33 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d) -> i32 +fn textureDimensions_423f99() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_423f99(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_423f99(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_423f99(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d6a4e4bc97 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_423f99() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_423f99(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_423f99(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_423f99(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d6a4e4bc97 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_423f99() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_423f99(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_423f99(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_423f99(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.glsl new file mode 100644 index 0000000000..08f2e2498f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_423f99() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_423f99(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureDimensions_423f99() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_423f99(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_423f99() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_423f99(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.msl new file mode 100644 index 0000000000..77b610faab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_423f99(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_423f99(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_423f99(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_423f99(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ef4f77e1a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/423f99.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_423f99() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_423f99(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_423f99(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_423f99(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl new file mode 100644 index 0000000000..cbe8ae3074 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_4267ee() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4267ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4267ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4267ee(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aab581e07d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_4267ee() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4267ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4267ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4267ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aab581e07d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_4267ee() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4267ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4267ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4267ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.glsl new file mode 100644 index 0000000000..c1f09faf0d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureDimensions_4267ee() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_4267ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureDimensions_4267ee() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_4267ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureDimensions_4267ee() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_4267ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.msl new file mode 100644 index 0000000000..177015d0ad --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_4267ee(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_4267ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_4267ee(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_4267ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..a63426875e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4267ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_4267ee() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4267ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4267ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4267ee(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl new file mode 100644 index 0000000000..1cb86137bf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_42d4e6() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_42d4e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_42d4e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_42d4e6(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7c818175b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_42d4e6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_42d4e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_42d4e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_42d4e6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c818175b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_42d4e6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_42d4e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_42d4e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_42d4e6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.glsl new file mode 100644 index 0000000000..f59d1757c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureDimensions_42d4e6() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_42d4e6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureDimensions_42d4e6() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_42d4e6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureDimensions_42d4e6() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_42d4e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.msl new file mode 100644 index 0000000000..cc3fa542ff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_42d4e6(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_42d4e6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_42d4e6(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_42d4e6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab0376bd4b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/42d4e6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_42d4e6() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_42d4e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_42d4e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_42d4e6(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl new file mode 100644 index 0000000000..95910e9264 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_48cb89() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_48cb89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_48cb89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_48cb89(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9ec64be6c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_48cb89() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_48cb89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_48cb89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_48cb89(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9ec64be6c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_48cb89() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_48cb89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_48cb89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_48cb89(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.glsl new file mode 100644 index 0000000000..026fcaef19 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureDimensions_48cb89() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_48cb89(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureDimensions_48cb89() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_48cb89(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureDimensions_48cb89() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_48cb89(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.msl new file mode 100644 index 0000000000..5f475e25fe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_48cb89(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_48cb89(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_48cb89(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_48cb89(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e4ee35c96 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/48cb89.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_48cb89() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_48cb89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_48cb89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_48cb89(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl new file mode 100644 index 0000000000..ee9101fc47 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_49d274() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_49d274(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_49d274(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_49d274(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9ceff5070d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_49d274() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_49d274(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_49d274(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_49d274(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9ceff5070d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_49d274() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_49d274(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_49d274(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_49d274(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.glsl new file mode 100644 index 0000000000..70347a6ef3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_49d274() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_49d274(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_49d274() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_49d274(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_49d274() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_49d274(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.msl new file mode 100644 index 0000000000..4ca4453d84 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_49d274(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_49d274(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_49d274(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_49d274(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.wgsl new file mode 100644 index 0000000000..060af23164 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/49d274.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_49d274() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_49d274(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_49d274(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_49d274(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl new file mode 100644 index 0000000000..fc79c53ce6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_4df9a8() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4df9a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4df9a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4df9a8(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8541c75d63 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_4df9a8() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4df9a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4df9a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4df9a8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8541c75d63 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_4df9a8() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4df9a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4df9a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4df9a8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.glsl new file mode 100644 index 0000000000..7871ed7d01 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_4df9a8() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_4df9a8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_4df9a8() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_4df9a8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_4df9a8() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_4df9a8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.msl new file mode 100644 index 0000000000..54723cb4de --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_4df9a8(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_4df9a8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_4df9a8(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_4df9a8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.wgsl new file mode 100644 index 0000000000..b771310fa5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/4df9a8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_4df9a8() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4df9a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4df9a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4df9a8(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl new file mode 100644 index 0000000000..10f0e6c142 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 +fn textureDimensions_50a9ee() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_50a9ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_50a9ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_50a9ee(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..df671c728c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_50a9ee() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_50a9ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_50a9ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_50a9ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..df671c728c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_50a9ee() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_50a9ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_50a9ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_50a9ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.glsl new file mode 100644 index 0000000000..a02b6e603f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_50a9ee() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_50a9ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_50a9ee() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_50a9ee(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_50a9ee() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_50a9ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.msl new file mode 100644 index 0000000000..45035cca3c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_50a9ee(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_50a9ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_50a9ee(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_50a9ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..e94074d2b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_50a9ee "textureDimensions_50a9ee" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %22 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_50a9ee = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %22 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_50a9ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_50a9ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_50a9ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..271c37829e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/50a9ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_50a9ee() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_50a9ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_50a9ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_50a9ee(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl new file mode 100644 index 0000000000..854a5bb378 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d, level: i32) -> i32 +fn textureDimensions_52045c() { + var res: i32 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_52045c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_52045c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_52045c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b3da42f89 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_52045c() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_52045c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_52045c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_52045c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b3da42f89 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_52045c() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_52045c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_52045c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_52045c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.glsl new file mode 100644 index 0000000000..f4c5ca9d2c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_52045c() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_52045c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureDimensions_52045c() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_52045c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_52045c() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_52045c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.msl new file mode 100644 index 0000000000..ec08120b76 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_52045c(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_52045c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_52045c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_52045c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8f51b1501 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_52045c "textureDimensions_52045c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %19 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_52045c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %int %18 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_52045c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_52045c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_52045c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.wgsl new file mode 100644 index 0000000000..9966536310 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/52045c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_52045c() { + var res : i32 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_52045c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_52045c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_52045c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl new file mode 100644 index 0000000000..a7efa73ac3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_55b23e() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_55b23e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_55b23e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_55b23e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c3634a3b40 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_55b23e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_55b23e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_55b23e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_55b23e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c3634a3b40 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_55b23e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_55b23e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_55b23e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_55b23e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.glsl new file mode 100644 index 0000000000..a9465b8a2c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureDimensions_55b23e() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_55b23e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureDimensions_55b23e() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_55b23e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureDimensions_55b23e() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_55b23e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.msl new file mode 100644 index 0000000000..0778752ea7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_55b23e(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_55b23e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_55b23e(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_55b23e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.wgsl new file mode 100644 index 0000000000..430da3cdaf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/55b23e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_55b23e() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_55b23e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_55b23e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_55b23e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl new file mode 100644 index 0000000000..111e70b9ba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 +fn textureDimensions_579629() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_579629(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_579629(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_579629(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..297d5dd29a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_579629() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_579629(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_579629(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_579629(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..297d5dd29a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_579629() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_579629(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_579629(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_579629(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.glsl new file mode 100644 index 0000000000..d1ca2e719e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureDimensions_579629() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_579629(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DMS arg_0_1; +void textureDimensions_579629() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_579629(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureDimensions_579629() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_579629(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.msl new file mode 100644 index 0000000000..d6c497bc4b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_579629(texture2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureDimensions_579629(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_579629(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_579629(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.wgsl new file mode 100644 index 0000000000..1e1d6d7a44 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/579629.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureDimensions_579629() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_579629(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_579629(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_579629(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl new file mode 100644 index 0000000000..f56dbbdf3b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_57da0b() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57da0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_57da0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_57da0b(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9df5efbd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_57da0b() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57da0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57da0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57da0b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f9df5efbd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_57da0b() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57da0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57da0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57da0b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.glsl new file mode 100644 index 0000000000..c45ed2f613 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_57da0b() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_57da0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_57da0b() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_57da0b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_57da0b() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_57da0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.msl new file mode 100644 index 0000000000..fb1c232486 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_57da0b(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_57da0b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_57da0b(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_57da0b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..b599184810 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57da0b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_57da0b() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57da0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_57da0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_57da0b(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl new file mode 100644 index 0000000000..9da6a8afe4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; + +// fn textureDimensions(texture: texture_depth_cube) -> vec2 +fn textureDimensions_57e28f() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57e28f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_57e28f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_57e28f(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8da8d7d569 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_57e28f() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57e28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57e28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57e28f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8da8d7d569 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_57e28f() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57e28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57e28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57e28f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.glsl new file mode 100644 index 0000000000..c8713a2ded --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_57e28f() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_57e28f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_57e28f() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_57e28f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_57e28f() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_57e28f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.msl new file mode 100644 index 0000000000..c089020df3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_57e28f(depthcube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_2) { + textureDimensions_57e28f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { + textureDimensions_57e28f(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { + textureDimensions_57e28f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0b854e393 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/57e28f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +fn textureDimensions_57e28f() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57e28f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_57e28f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_57e28f(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl new file mode 100644 index 0000000000..ac97548fff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_58a515() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_58a515(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_58a515(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_58a515(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e8a7b4b3f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_58a515() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_58a515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_58a515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_58a515(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8a7b4b3f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_58a515() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_58a515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_58a515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_58a515(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.glsl new file mode 100644 index 0000000000..b67bb0f017 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_58a515() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_58a515(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_58a515() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_58a515(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_58a515() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_58a515(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.msl new file mode 100644 index 0000000000..c8d90cdade --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_58a515(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_58a515(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_58a515(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_58a515(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.wgsl new file mode 100644 index 0000000000..21bad72927 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/58a515.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_58a515() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_58a515(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_58a515(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_58a515(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl new file mode 100644 index 0000000000..52d9859616 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_5985f3() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5985f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5985f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5985f3(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..488cb1754f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5985f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5985f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5985f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5985f3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..488cb1754f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5985f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5985f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5985f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5985f3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.glsl new file mode 100644 index 0000000000..4c33a17f6a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_5985f3() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_5985f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_5985f3() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_5985f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_5985f3() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_5985f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.msl new file mode 100644 index 0000000000..90f407d362 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_5985f3(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_5985f3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_5985f3(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_5985f3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..84495171ac --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5985f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_5985f3() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5985f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5985f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5985f3(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl new file mode 100644 index 0000000000..8de30ac23c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_5caa5e() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5caa5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5caa5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5caa5e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..066fbdfdcc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_5caa5e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5caa5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5caa5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5caa5e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..066fbdfdcc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_5caa5e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5caa5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5caa5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5caa5e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.glsl new file mode 100644 index 0000000000..d02caf1a45 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_5caa5e() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_5caa5e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_5caa5e() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_5caa5e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_5caa5e() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_5caa5e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.msl new file mode 100644 index 0000000000..56e5f71c22 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_5caa5e(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_5caa5e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_5caa5e(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_5caa5e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac87720adb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5caa5e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_5caa5e() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5caa5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5caa5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5caa5e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl new file mode 100644 index 0000000000..6e8e71eca6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_5e295d() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5e295d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5e295d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5e295d(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a88725c97e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5e295d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5e295d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5e295d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5e295d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a88725c97e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5e295d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5e295d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5e295d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5e295d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.glsl new file mode 100644 index 0000000000..f079eb8801 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_5e295d() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_5e295d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_5e295d() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_5e295d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_5e295d() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_5e295d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.msl new file mode 100644 index 0000000000..50d3988eba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_5e295d(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_5e295d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_5e295d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_5e295d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.wgsl new file mode 100644 index 0000000000..ae8f76333d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/5e295d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_5e295d() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5e295d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5e295d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5e295d(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl new file mode 100644 index 0000000000..36982d84d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_60bf54() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_60bf54(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_60bf54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_60bf54(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d7ac1d3d72 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_60bf54() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_60bf54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_60bf54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_60bf54(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d7ac1d3d72 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_60bf54() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_60bf54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_60bf54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_60bf54(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.glsl new file mode 100644 index 0000000000..91d08156b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_60bf54() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_60bf54(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_60bf54() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_60bf54(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_60bf54() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_60bf54(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.msl new file mode 100644 index 0000000000..bf597c3afd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_60bf54(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_60bf54(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_60bf54(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_60bf54(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.wgsl new file mode 100644 index 0000000000..fbc7cd74a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/60bf54.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_60bf54() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_60bf54(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_60bf54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_60bf54(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl new file mode 100644 index 0000000000..deb112547e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_63f3cf() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_63f3cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_63f3cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_63f3cf(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f03906db15 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_63f3cf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_63f3cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_63f3cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_63f3cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f03906db15 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_63f3cf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_63f3cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_63f3cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_63f3cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.glsl new file mode 100644 index 0000000000..6a77ea9751 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureDimensions_63f3cf() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_63f3cf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureDimensions_63f3cf() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_63f3cf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureDimensions_63f3cf() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_63f3cf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.msl new file mode 100644 index 0000000000..931b457149 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_63f3cf(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_63f3cf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_63f3cf(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_63f3cf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e0ebfd2bf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/63f3cf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_63f3cf() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_63f3cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_63f3cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_63f3cf(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl new file mode 100644 index 0000000000..6a41cfe496 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_68105c() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_68105c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_68105c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_68105c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c3723286d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_68105c() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_68105c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_68105c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_68105c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c3723286d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_68105c() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_68105c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_68105c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_68105c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.glsl new file mode 100644 index 0000000000..d366071c30 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_68105c() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_68105c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_68105c() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_68105c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_68105c() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_68105c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.msl new file mode 100644 index 0000000000..a1fdb63b94 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_68105c(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_68105c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_68105c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_68105c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.wgsl new file mode 100644 index 0000000000..19c49290b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/68105c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_68105c() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_68105c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_68105c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_68105c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl new file mode 100644 index 0000000000..406718a356 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 +fn textureDimensions_686ef2() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_686ef2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_686ef2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_686ef2(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8706a9ee6e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_686ef2() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_686ef2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_686ef2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_686ef2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8706a9ee6e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_686ef2() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_686ef2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_686ef2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_686ef2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.glsl new file mode 100644 index 0000000000..a30259fd18 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_686ef2() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_686ef2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_0_1; +void textureDimensions_686ef2() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_686ef2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_686ef2() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_686ef2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.msl new file mode 100644 index 0000000000..4c5bb66d0b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_686ef2(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_686ef2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_686ef2(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_686ef2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.spvasm new file mode 100644 index 0000000000..d18fd5a4b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_686ef2 "textureDimensions_686ef2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %20 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_686ef2 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_686ef2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_686ef2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_686ef2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ae50651fb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/686ef2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_686ef2() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_686ef2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_686ef2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_686ef2(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl new file mode 100644 index 0000000000..d2d4a11e34 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_6adac6() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6adac6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6adac6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6adac6(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52b2080c05 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_6adac6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6adac6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6adac6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6adac6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52b2080c05 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_6adac6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6adac6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6adac6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6adac6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.glsl new file mode 100644 index 0000000000..acaaa5adf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_6adac6() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_6adac6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_6adac6() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_6adac6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_6adac6() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_6adac6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.msl new file mode 100644 index 0000000000..7087625943 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_6adac6(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_6adac6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_6adac6(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_6adac6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ab67f07a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6adac6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_6adac6() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6adac6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6adac6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6adac6(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl new file mode 100644 index 0000000000..ef7fe5d3f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d) -> vec3 +fn textureDimensions_6ec1b4() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6ec1b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6ec1b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6ec1b4(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e9cb1f014 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_6ec1b4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6ec1b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6ec1b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6ec1b4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6e9cb1f014 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_6ec1b4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6ec1b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6ec1b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6ec1b4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.glsl new file mode 100644 index 0000000000..482455da81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_6ec1b4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_6ec1b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureDimensions_6ec1b4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_6ec1b4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_6ec1b4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_6ec1b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.msl new file mode 100644 index 0000000000..52a3369bb2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_6ec1b4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_6ec1b4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_6ec1b4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_6ec1b4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..7573c55260 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6ec1b4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_6ec1b4() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6ec1b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6ec1b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6ec1b4(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl new file mode 100644 index 0000000000..2e0eb57363 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_6f0d79() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6f0d79(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6f0d79(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6f0d79(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd1a3a48fd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_6f0d79() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6f0d79(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6f0d79(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6f0d79(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd1a3a48fd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_6f0d79() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6f0d79(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6f0d79(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6f0d79(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.glsl new file mode 100644 index 0000000000..71893cbbf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureDimensions_6f0d79() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_6f0d79(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureDimensions_6f0d79() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_6f0d79(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureDimensions_6f0d79() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_6f0d79(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.msl new file mode 100644 index 0000000000..5154f6cfbf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_6f0d79(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_6f0d79(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_6f0d79(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_6f0d79(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.wgsl new file mode 100644 index 0000000000..b055eea1db --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/6f0d79.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_6f0d79() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6f0d79(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6f0d79(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6f0d79(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl new file mode 100644 index 0000000000..99afe619b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_702c53() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_702c53(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_702c53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_702c53(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..40c27c8f76 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_702c53() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_702c53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_702c53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_702c53(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..40c27c8f76 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_702c53() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_702c53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_702c53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_702c53(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.glsl new file mode 100644 index 0000000000..e4f0c34dd6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureDimensions_702c53() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_702c53(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureDimensions_702c53() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_702c53(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureDimensions_702c53() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_702c53(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.msl new file mode 100644 index 0000000000..d202631130 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_702c53(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_702c53(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_702c53(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_702c53(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.wgsl new file mode 100644 index 0000000000..093625d570 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/702c53.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_702c53() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_702c53(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_702c53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_702c53(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl new file mode 100644 index 0000000000..7cf0048b71 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureDimensions(texture: texture_depth_2d_array, level: i32) -> vec2 +fn textureDimensions_72e5d6() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_72e5d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_72e5d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_72e5d6(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7e2f59d88f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_72e5d6() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_72e5d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_72e5d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_72e5d6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7e2f59d88f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_72e5d6() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_72e5d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_72e5d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_72e5d6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.glsl new file mode 100644 index 0000000000..12fad02875 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_72e5d6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_72e5d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_72e5d6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_72e5d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_72e5d6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_72e5d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.msl new file mode 100644 index 0000000000..50c3c1628d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_72e5d6(depth2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureDimensions_72e5d6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_72e5d6(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_72e5d6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..41744eed41 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_72e5d6 "textureDimensions_72e5d6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %22 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_72e5d6 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %22 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_72e5d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_72e5d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_72e5d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd4b217221 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/72e5d6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureDimensions_72e5d6() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_72e5d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_72e5d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_72e5d6(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl new file mode 100644 index 0000000000..cff496e3c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d, level: i32) -> i32 +fn textureDimensions_79df87() { + var res: i32 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_79df87(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_79df87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_79df87(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bba9fd9d0f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_79df87() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_79df87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_79df87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_79df87(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bba9fd9d0f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_79df87() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_79df87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_79df87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_79df87(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.glsl new file mode 100644 index 0000000000..b7ee7fd681 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_79df87() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_79df87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureDimensions_79df87() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_79df87(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_79df87() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_79df87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.msl new file mode 100644 index 0000000000..92eebe2753 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_79df87(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_79df87(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_79df87(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_79df87(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f51e098c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_79df87 "textureDimensions_79df87" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %20 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_79df87 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %int %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_79df87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_79df87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_79df87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.wgsl new file mode 100644 index 0000000000..e45225d7ba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/79df87.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_79df87() { + var res : i32 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_79df87(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_79df87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_79df87(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl new file mode 100644 index 0000000000..8245cc2846 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureDimensions(texture: texture_depth_2d_array) -> vec2 +fn textureDimensions_7bf826() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7bf826(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_7bf826(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_7bf826(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9c0e675218 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_7bf826() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7bf826(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7bf826(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7bf826(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c0e675218 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_7bf826() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7bf826(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7bf826(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7bf826(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.glsl new file mode 100644 index 0000000000..9859cdd941 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_7bf826() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_7bf826(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_7bf826() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_7bf826(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_7bf826() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_7bf826(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.msl new file mode 100644 index 0000000000..59cd3739f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_7bf826(depth2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureDimensions_7bf826(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_7bf826(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_7bf826(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.wgsl new file mode 100644 index 0000000000..4953ba3b69 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7bf826.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureDimensions_7bf826() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7bf826(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_7bf826(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_7bf826(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl new file mode 100644 index 0000000000..87caa4402e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_7f5c2e() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7f5c2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_7f5c2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_7f5c2e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9c6abe3894 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_7f5c2e() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7f5c2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7f5c2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7f5c2e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c6abe3894 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_7f5c2e() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7f5c2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7f5c2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7f5c2e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.glsl new file mode 100644 index 0000000000..ed85e7deb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_7f5c2e() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_7f5c2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_7f5c2e() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_7f5c2e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_7f5c2e() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_7f5c2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.msl new file mode 100644 index 0000000000..f853ebcebf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_7f5c2e(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_7f5c2e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_7f5c2e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_7f5c2e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..85bbc4b745 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/7f5c2e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_7f5c2e() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7f5c2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_7f5c2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_7f5c2e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl new file mode 100644 index 0000000000..99c4483de1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_8028f3() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8028f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8028f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8028f3(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f18db34932 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8028f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8028f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8028f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8028f3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f18db34932 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8028f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8028f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8028f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8028f3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.glsl new file mode 100644 index 0000000000..4ac9ac9786 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8028f3() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_8028f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8028f3() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_8028f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8028f3() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_8028f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.msl new file mode 100644 index 0000000000..efc7793dda --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8028f3(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8028f3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8028f3(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8028f3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..fbc19794de --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8028f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_8028f3() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8028f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8028f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8028f3(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl new file mode 100644 index 0000000000..630debefca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_811679() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_811679(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_811679(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_811679(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a474cba784 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_811679() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_811679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_811679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_811679(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a474cba784 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_811679() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_811679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_811679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_811679(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.glsl new file mode 100644 index 0000000000..152d367823 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_811679() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_811679(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_811679() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_811679(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_811679() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_811679(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.msl new file mode 100644 index 0000000000..825c3ade50 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_811679(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_811679(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_811679(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_811679(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.wgsl new file mode 100644 index 0000000000..494c1da936 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/811679.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_811679() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_811679(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_811679(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_811679(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl new file mode 100644 index 0000000000..793ab470a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_820596() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_820596(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_820596(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_820596(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af2f262f81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_820596() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_820596(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_820596(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_820596(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af2f262f81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_820596() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_820596(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_820596(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_820596(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.glsl new file mode 100644 index 0000000000..12ee4ecbbe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_820596() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_820596(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_820596() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_820596(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_820596() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_820596(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.msl new file mode 100644 index 0000000000..1ecf8c985c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_820596(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_820596(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_820596(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_820596(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc1379f8f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/820596.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_820596() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_820596(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_820596(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_820596(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl new file mode 100644 index 0000000000..d0a3eabe53 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_83ee5a() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_83ee5a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_83ee5a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_83ee5a(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..efa903aa81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_83ee5a() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_83ee5a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_83ee5a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_83ee5a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..efa903aa81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_83ee5a() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_83ee5a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_83ee5a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_83ee5a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.glsl new file mode 100644 index 0000000000..1f6ce583e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_83ee5a() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_83ee5a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_83ee5a() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_83ee5a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_83ee5a() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_83ee5a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.msl new file mode 100644 index 0000000000..29cff8f6c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_83ee5a(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_83ee5a(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_83ee5a(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_83ee5a(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d0d5ea87c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/83ee5a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_83ee5a() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_83ee5a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_83ee5a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_83ee5a(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl new file mode 100644 index 0000000000..df9ae71b7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 +fn textureDimensions_85d556() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_85d556(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_85d556(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_85d556(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4a6cbca9a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_85d556() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_85d556(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_85d556(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_85d556(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4a6cbca9a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_85d556() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_85d556(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_85d556(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_85d556(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.glsl new file mode 100644 index 0000000000..c51bf8a27e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_85d556() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_85d556(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_85d556() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_85d556(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_85d556() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_85d556(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.msl new file mode 100644 index 0000000000..2b9b1911c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_85d556(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_85d556(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_85d556(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_85d556(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e1e2f3017 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_85d556 "textureDimensions_85d556" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %22 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_85d556 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %22 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_85d556 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_85d556 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_85d556 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.wgsl new file mode 100644 index 0000000000..63647723db --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/85d556.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_85d556() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_85d556(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_85d556(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_85d556(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl new file mode 100644 index 0000000000..5bb87875ef --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 +fn textureDimensions_88ad17() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_88ad17(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_88ad17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_88ad17(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6da2ab8199 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_88ad17() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_88ad17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_88ad17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_88ad17(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6da2ab8199 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_88ad17() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_88ad17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_88ad17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_88ad17(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.glsl new file mode 100644 index 0000000000..e5a8afc8bb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_88ad17() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_88ad17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_0_1; +void textureDimensions_88ad17() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_88ad17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_88ad17() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_88ad17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.msl new file mode 100644 index 0000000000..f46a99d8dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_88ad17(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_88ad17(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_88ad17(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_88ad17(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c53fccb78 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_88ad17 "textureDimensions_88ad17" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %21 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_88ad17 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %20 %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_88ad17 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_88ad17 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_88ad17 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.wgsl new file mode 100644 index 0000000000..d2873d730c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/88ad17.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_88ad17() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_88ad17(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_88ad17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_88ad17(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl new file mode 100644 index 0000000000..4a9ac37dd3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d) -> vec3 +fn textureDimensions_8aa4c4() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8aa4c4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8aa4c4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8aa4c4(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e8a2fa1d4b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8aa4c4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8aa4c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8aa4c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8aa4c4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8a2fa1d4b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8aa4c4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8aa4c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8aa4c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8aa4c4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.glsl new file mode 100644 index 0000000000..45495e95e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_8aa4c4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_8aa4c4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureDimensions_8aa4c4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_8aa4c4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_8aa4c4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_8aa4c4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.msl new file mode 100644 index 0000000000..77f5715a6d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8aa4c4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8aa4c4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8aa4c4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8aa4c4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.wgsl new file mode 100644 index 0000000000..840105bae9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8aa4c4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_8aa4c4() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8aa4c4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8aa4c4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8aa4c4(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl new file mode 100644 index 0000000000..9ecc26fefe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d) -> vec3 +fn textureDimensions_8deb5e() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8deb5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8deb5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8deb5e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..398823e556 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8deb5e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8deb5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8deb5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8deb5e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..398823e556 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8deb5e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8deb5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8deb5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8deb5e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.glsl new file mode 100644 index 0000000000..8869c19303 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_8deb5e() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_8deb5e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureDimensions_8deb5e() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_8deb5e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_8deb5e() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_8deb5e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.msl new file mode 100644 index 0000000000..7899845cb3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8deb5e(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8deb5e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8deb5e(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8deb5e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.wgsl new file mode 100644 index 0000000000..c3e10c786b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8deb5e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_8deb5e() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8deb5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8deb5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8deb5e(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl new file mode 100644 index 0000000000..f5e7f3af7d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array) -> vec2 +fn textureDimensions_8f20bf() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8f20bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8f20bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8f20bf(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..58462cf470 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_8f20bf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8f20bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8f20bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8f20bf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..58462cf470 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_8f20bf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8f20bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8f20bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8f20bf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.glsl new file mode 100644 index 0000000000..a01eead6eb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_8f20bf() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_8f20bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_8f20bf() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_8f20bf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_8f20bf() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_8f20bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.msl new file mode 100644 index 0000000000..431a4549c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8f20bf(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_8f20bf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_8f20bf(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_8f20bf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d3dcb0619 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8f20bf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_8f20bf() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8f20bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8f20bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8f20bf(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl new file mode 100644 index 0000000000..9492de6cff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_8fca0f() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8fca0f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8fca0f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8fca0f(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ace86e03bd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8fca0f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8fca0f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8fca0f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8fca0f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ace86e03bd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8fca0f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8fca0f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8fca0f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8fca0f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.glsl new file mode 100644 index 0000000000..255924ad16 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8fca0f() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_8fca0f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8fca0f() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_8fca0f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8fca0f() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_8fca0f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.msl new file mode 100644 index 0000000000..f104902483 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8fca0f(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8fca0f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8fca0f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8fca0f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.wgsl new file mode 100644 index 0000000000..6ef7d1ba5c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/8fca0f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_8fca0f() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8fca0f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8fca0f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8fca0f(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl new file mode 100644 index 0000000000..86f40eda63 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureDimensions(texture: texture_depth_cube_array) -> vec2 +fn textureDimensions_90340b() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_90340b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_90340b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_90340b(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..26df72fa72 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_90340b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_90340b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_90340b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_90340b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26df72fa72 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_90340b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_90340b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_90340b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_90340b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.glsl new file mode 100644 index 0000000000..09d10eb7bb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_90340b() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_90340b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_90340b() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_90340b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_90340b() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_90340b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.msl new file mode 100644 index 0000000000..f585531ed1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_90340b(depthcube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureDimensions_90340b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_90340b(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_90340b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.wgsl new file mode 100644 index 0000000000..c70e0d392e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/90340b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureDimensions_90340b() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_90340b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_90340b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_90340b(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl new file mode 100644 index 0000000000..1f6eb1c761 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_9042ab() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9042ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9042ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9042ab(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95dc10539c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9042ab() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9042ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9042ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9042ab(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95dc10539c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9042ab() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9042ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9042ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9042ab(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.glsl new file mode 100644 index 0000000000..1fb6520aad --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_9042ab() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_9042ab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_9042ab() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_9042ab(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_9042ab() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_9042ab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.msl new file mode 100644 index 0000000000..5f29287b31 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9042ab(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_9042ab(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_9042ab(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_9042ab(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..1602fd8232 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9042ab.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_9042ab() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9042ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9042ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9042ab(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl new file mode 100644 index 0000000000..4fb614d22e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; + +// fn textureDimensions(texture: texture_depth_cube, level: i32) -> vec2 +fn textureDimensions_9393b0() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9393b0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9393b0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9393b0(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1e45411862 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_9393b0() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9393b0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9393b0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9393b0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1e45411862 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_9393b0() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9393b0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9393b0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9393b0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.glsl new file mode 100644 index 0000000000..951da7cc7d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_9393b0() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_9393b0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_9393b0() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_9393b0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_9393b0() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_9393b0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.msl new file mode 100644 index 0000000000..0670fb3ae9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9393b0(depthcube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_2) { + textureDimensions_9393b0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { + textureDimensions_9393b0(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { + textureDimensions_9393b0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.spvasm new file mode 100644 index 0000000000..55a246581b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9393b0 "textureDimensions_9393b0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %20 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9393b0 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %20 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_9393b0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_9393b0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_9393b0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd3f78e61a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9393b0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +fn textureDimensions_9393b0() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9393b0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9393b0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9393b0(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl new file mode 100644 index 0000000000..6914338469 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureDimensions(texture: texture_depth_2d) -> vec2 +fn textureDimensions_939fdb() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_939fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_939fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_939fdb(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1edab80e0e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_939fdb() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_939fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_939fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_939fdb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1edab80e0e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_939fdb() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_939fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_939fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_939fdb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.glsl new file mode 100644 index 0000000000..380941ea5f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_939fdb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_939fdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_939fdb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_939fdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_939fdb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_939fdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.msl new file mode 100644 index 0000000000..a6283fbd15 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_939fdb(depth2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureDimensions_939fdb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_939fdb(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_939fdb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..eda2bcb884 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/939fdb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureDimensions_939fdb() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_939fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_939fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_939fdb(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl new file mode 100644 index 0000000000..af253df8de --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube) -> vec2 +fn textureDimensions_962dcd() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_962dcd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_962dcd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_962dcd(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f1c1eb2a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_962dcd() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_962dcd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_962dcd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_962dcd(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f1c1eb2a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_962dcd() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_962dcd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_962dcd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_962dcd(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.glsl new file mode 100644 index 0000000000..ded4e4210b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_962dcd() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_962dcd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_0_1; +void textureDimensions_962dcd() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_962dcd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_962dcd() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_962dcd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.msl new file mode 100644 index 0000000000..052154fa52 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_962dcd(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_962dcd(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_962dcd(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_962dcd(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd3ca7aa54 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/962dcd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_962dcd() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_962dcd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_962dcd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_962dcd(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl new file mode 100644 index 0000000000..de9022219c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_9abfe5() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9abfe5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9abfe5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9abfe5(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d97dcf7f31 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9abfe5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9abfe5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9abfe5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9abfe5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d97dcf7f31 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9abfe5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9abfe5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9abfe5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9abfe5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.glsl new file mode 100644 index 0000000000..0de8c91026 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_9abfe5() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_9abfe5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_9abfe5() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_9abfe5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_9abfe5() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_9abfe5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.msl new file mode 100644 index 0000000000..cc19962ad6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9abfe5(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_9abfe5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_9abfe5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_9abfe5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.wgsl new file mode 100644 index 0000000000..5845daaf79 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9abfe5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_9abfe5() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9abfe5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9abfe5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9abfe5(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl new file mode 100644 index 0000000000..f92e0ea589 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 +fn textureDimensions_9c9c57() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9c9c57(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9c9c57(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9c9c57(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9048832d74 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_9c9c57() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9c9c57(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9c9c57(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9c9c57(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9048832d74 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_9c9c57() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9c9c57(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9c9c57(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9c9c57(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.glsl new file mode 100644 index 0000000000..0bdaf7e587 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_9c9c57() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_9c9c57(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_9c9c57() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_9c9c57(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_9c9c57() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_9c9c57(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.msl new file mode 100644 index 0000000000..cbffa18cfd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9c9c57(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_9c9c57(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_9c9c57(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_9c9c57(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.spvasm new file mode 100644 index 0000000000..4dfce52afe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9c9c57 "textureDimensions_9c9c57" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %22 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9c9c57 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %22 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_9c9c57 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_9c9c57 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_9c9c57 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.wgsl new file mode 100644 index 0000000000..89d6463ea5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9c9c57.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_9c9c57() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9c9c57(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9c9c57(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9c9c57(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl new file mode 100644 index 0000000000..bd2527eaeb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_9da9e2() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9da9e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9da9e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9da9e2(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f500491b95 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_9da9e2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9da9e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9da9e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9da9e2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f500491b95 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_9da9e2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9da9e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9da9e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9da9e2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.glsl new file mode 100644 index 0000000000..5773b40625 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_9da9e2() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_9da9e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_9da9e2() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_9da9e2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_9da9e2() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_9da9e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.msl new file mode 100644 index 0000000000..ea085fa528 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9da9e2(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_9da9e2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_9da9e2(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_9da9e2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..73cfaf1b3d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9da9e2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_9da9e2() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9da9e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9da9e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9da9e2(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl new file mode 100644 index 0000000000..c1f41d3bde --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_9eb8d8() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9eb8d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9eb8d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9eb8d8(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cf18843418 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_9eb8d8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9eb8d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9eb8d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9eb8d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cf18843418 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_9eb8d8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9eb8d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9eb8d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9eb8d8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.glsl new file mode 100644 index 0000000000..6185ef1959 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_9eb8d8() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_9eb8d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_9eb8d8() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_9eb8d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_9eb8d8() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_9eb8d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.msl new file mode 100644 index 0000000000..140c2af898 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9eb8d8(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_9eb8d8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_9eb8d8(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_9eb8d8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc40eab388 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9eb8d8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_9eb8d8() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9eb8d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9eb8d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9eb8d8(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl new file mode 100644 index 0000000000..2234617163 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d) -> vec2 +fn textureDimensions_9f8e46() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9f8e46(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9f8e46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9f8e46(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..384fdc350c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_9f8e46() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9f8e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9f8e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9f8e46(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..384fdc350c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_9f8e46() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9f8e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9f8e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9f8e46(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.glsl new file mode 100644 index 0000000000..a292ec4b7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_9f8e46() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_9f8e46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_9f8e46() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_9f8e46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_9f8e46() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_9f8e46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.msl new file mode 100644 index 0000000000..b7097a21b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9f8e46(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_9f8e46(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_9f8e46(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_9f8e46(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d3ef8378f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/9f8e46.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_9f8e46() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9f8e46(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9f8e46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9f8e46(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl new file mode 100644 index 0000000000..484ac3704d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureDimensions(texture: texture_depth_cube_array, level: i32) -> vec2 +fn textureDimensions_a01845() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a01845(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a01845(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a01845(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d2a845a1af --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_a01845() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a01845(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a01845(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a01845(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d2a845a1af --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_a01845() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a01845(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a01845(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a01845(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.glsl new file mode 100644 index 0000000000..5be0e3e1bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_a01845() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_a01845(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_a01845() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_a01845(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_a01845() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_a01845(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.msl new file mode 100644 index 0000000000..ceb6e124aa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_a01845(depthcube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureDimensions_a01845(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_a01845(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_a01845(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.spvasm new file mode 100644 index 0000000000..93cf0664d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a01845 "textureDimensions_a01845" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %22 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a01845 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %22 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_a01845 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_a01845 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_a01845 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf501d9257 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a01845.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureDimensions_a01845() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a01845(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a01845(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a01845(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl new file mode 100644 index 0000000000..c2d14098e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d) -> i32 +fn textureDimensions_a7d565() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a7d565(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a7d565(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a7d565(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..949e8b1a10 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_a7d565() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a7d565(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a7d565(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a7d565(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..949e8b1a10 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_a7d565() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a7d565(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a7d565(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a7d565(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.glsl new file mode 100644 index 0000000000..24152c71b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_a7d565() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_a7d565(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureDimensions_a7d565() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_a7d565(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_a7d565() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_a7d565(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.msl new file mode 100644 index 0000000000..aef867087f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_a7d565(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_a7d565(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_a7d565(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_a7d565(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.wgsl new file mode 100644 index 0000000000..76183ec117 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a7d565.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_a7d565() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a7d565(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a7d565(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a7d565(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl new file mode 100644 index 0000000000..4dbf2ed60f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_a863f2() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a863f2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a863f2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a863f2(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..212bbcaf5b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_a863f2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a863f2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a863f2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a863f2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..212bbcaf5b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_a863f2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a863f2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a863f2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a863f2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.glsl new file mode 100644 index 0000000000..b157dd9015 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureDimensions_a863f2() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_a863f2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureDimensions_a863f2() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_a863f2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureDimensions_a863f2() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_a863f2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.msl new file mode 100644 index 0000000000..583342b5f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_a863f2(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_a863f2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_a863f2(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_a863f2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.wgsl new file mode 100644 index 0000000000..d3e7e38700 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a863f2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_a863f2() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a863f2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a863f2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a863f2(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl new file mode 100644 index 0000000000..9c74dfa18e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 +fn textureDimensions_a9c9c1() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a9c9c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a9c9c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a9c9c1(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3290331fc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_a9c9c1() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a9c9c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a9c9c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a9c9c1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3290331fc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_a9c9c1() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a9c9c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a9c9c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a9c9c1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.glsl new file mode 100644 index 0000000000..0d4fd672ea --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_a9c9c1() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_a9c9c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_a9c9c1() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_a9c9c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_a9c9c1() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_a9c9c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.msl new file mode 100644 index 0000000000..7cfab5e280 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_a9c9c1(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_a9c9c1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_a9c9c1(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_a9c9c1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc8c579afe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a9c9c1 "textureDimensions_a9c9c1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %20 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a9c9c1 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %20 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_a9c9c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_a9c9c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_a9c9c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..376cdbd51d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/a9c9c1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_a9c9c1() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a9c9c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a9c9c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a9c9c1(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl new file mode 100644 index 0000000000..4be6a15698 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 +fn textureDimensions_b0e16d() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b0e16d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b0e16d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b0e16d(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b8dd338af --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_b0e16d() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b0e16d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b0e16d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b0e16d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b8dd338af --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_b0e16d() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b0e16d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b0e16d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b0e16d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.glsl new file mode 100644 index 0000000000..cc6769385c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_b0e16d() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_b0e16d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureDimensions_b0e16d() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_b0e16d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_b0e16d() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_b0e16d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.msl new file mode 100644 index 0000000000..60c470e875 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_b0e16d(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_b0e16d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_b0e16d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_b0e16d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.spvasm new file mode 100644 index 0000000000..5f4af76d81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b0e16d "textureDimensions_b0e16d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %20 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b0e16d = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_b0e16d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_b0e16d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_b0e16d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.wgsl new file mode 100644 index 0000000000..5808c31942 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b0e16d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_b0e16d() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b0e16d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b0e16d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b0e16d(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl new file mode 100644 index 0000000000..36a593aef9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube) -> vec2 +fn textureDimensions_b3c954() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3c954(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b3c954(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b3c954(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f0d031de32 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_b3c954() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3c954(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3c954(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3c954(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0d031de32 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_b3c954() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3c954(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3c954(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3c954(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.glsl new file mode 100644 index 0000000000..855349fba4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_b3c954() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_b3c954(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_0_1; +void textureDimensions_b3c954() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_b3c954(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_b3c954() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_b3c954(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.msl new file mode 100644 index 0000000000..33fc09aae0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_b3c954(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_b3c954(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_b3c954(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_b3c954(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c364077df --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3c954.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_b3c954() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3c954(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b3c954(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b3c954(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl new file mode 100644 index 0000000000..3bcd260d1c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d, level: i32) -> i32 +fn textureDimensions_b3e407() { + var res: i32 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3e407(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b3e407(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b3e407(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f917b5475 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_b3e407() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3e407(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3e407(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3e407(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f917b5475 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_b3e407() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3e407(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3e407(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3e407(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.glsl new file mode 100644 index 0000000000..438d8fb195 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_b3e407() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_b3e407(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureDimensions_b3e407() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_b3e407(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_b3e407() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_b3e407(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.msl new file mode 100644 index 0000000000..86bd509d77 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_b3e407(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_b3e407(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_b3e407(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_b3e407(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.spvasm new file mode 100644 index 0000000000..15a6f7ca6f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b3e407 "textureDimensions_b3e407" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %19 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b3e407 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %int %18 %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_b3e407 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_b3e407 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_b3e407 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.wgsl new file mode 100644 index 0000000000..19da4477f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b3e407.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_b3e407() { + var res : i32 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3e407(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b3e407(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b3e407(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl new file mode 100644 index 0000000000..65a63e4035 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_b91240() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b91240(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b91240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b91240(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f3c930964 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_b91240() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b91240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b91240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b91240(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f3c930964 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_b91240() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b91240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b91240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b91240(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.glsl new file mode 100644 index 0000000000..3976de3f5b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureDimensions_b91240() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_b91240(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureDimensions_b91240() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_b91240(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureDimensions_b91240() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_b91240(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.msl new file mode 100644 index 0000000000..ee84ff1eb9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_b91240(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_b91240(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_b91240(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_b91240(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c88173764 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/b91240.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_b91240() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b91240(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b91240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b91240(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl new file mode 100644 index 0000000000..e48c478e19 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_external; + +// fn textureDimensions(texture: texture_external) -> vec2 +fn textureDimensions_ba1481() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ba1481(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_ba1481(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_ba1481(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1761c01751 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_ba1481() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ba1481(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ba1481(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ba1481(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1761c01751 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_ba1481() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ba1481(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ba1481(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ba1481(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.glsl new file mode 100644 index 0000000000..47564aef5d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.glsl @@ -0,0 +1,139 @@ +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +uniform highp sampler2D arg_0_1; +void textureDimensions_ba1481() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_ba1481(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +uniform highp sampler2D arg_0_1; +void textureDimensions_ba1481() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_ba1481(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +uniform highp sampler2D arg_0_1; +void textureDimensions_ba1481() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_ba1481(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.msl new file mode 100644 index 0000000000..f659868fe8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +void textureDimensions_ba1481(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_ba1481(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_ba1481(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_ba1481(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.spvasm new file mode 100644 index 0000000000..a7eb76b8dc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ExternalTextureParams "ExternalTextureParams" + OpMemberName %ExternalTextureParams 0 "numPlanes" + OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly" + OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 3 "gammaDecodeParams" + OpName %GammaTransferParams "GammaTransferParams" + OpMemberName %GammaTransferParams 0 "G" + OpMemberName %GammaTransferParams 1 "A" + OpMemberName %GammaTransferParams 2 "B" + OpMemberName %GammaTransferParams 3 "C" + OpMemberName %GammaTransferParams 4 "D" + OpMemberName %GammaTransferParams 5 "E" + OpMemberName %GammaTransferParams 6 "F" + OpMemberName %GammaTransferParams 7 "padding" + OpMemberName %ExternalTextureParams 4 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix" + OpName %ext_tex_params "ext_tex_params" + OpName %arg_0 "arg_0" + OpName %textureDimensions_ba1481 "textureDimensions_ba1481" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %ext_tex_plane_1 DescriptorSet 1 + OpDecorate %ext_tex_plane_1 Binding 1 + OpDecorate %ExternalTextureParams Block + OpMemberDecorate %ExternalTextureParams 0 Offset 0 + OpMemberDecorate %ExternalTextureParams 1 Offset 4 + OpMemberDecorate %ExternalTextureParams 2 Offset 16 + OpMemberDecorate %ExternalTextureParams 2 ColMajor + OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 3 Offset 64 + OpMemberDecorate %GammaTransferParams 0 Offset 0 + OpMemberDecorate %GammaTransferParams 1 Offset 4 + OpMemberDecorate %GammaTransferParams 2 Offset 8 + OpMemberDecorate %GammaTransferParams 3 Offset 12 + OpMemberDecorate %GammaTransferParams 4 Offset 16 + OpMemberDecorate %GammaTransferParams 5 Offset 20 + OpMemberDecorate %GammaTransferParams 6 Offset 24 + OpMemberDecorate %GammaTransferParams 7 Offset 28 + OpMemberDecorate %ExternalTextureParams 4 Offset 96 + OpMemberDecorate %ExternalTextureParams 5 Offset 128 + OpMemberDecorate %ExternalTextureParams 5 ColMajor + OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16 + OpDecorate %ext_tex_params NonWritable + OpDecorate %ext_tex_params DescriptorSet 1 + OpDecorate %ext_tex_params Binding 2 + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 +%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 +%mat3v4float = OpTypeMatrix %v4float 3 +%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams +%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %21 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %32 = OpConstantNull %v2int + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_ba1481 = OpFunction %void None %21 + %24 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %32 + %28 = OpLoad %11 %arg_0 + %25 = OpImageQuerySizeLod %v2int %28 %int_0 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_ba1481 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %42 = OpLabel + %43 = OpFunctionCall %void %textureDimensions_ba1481 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %45 = OpLabel + %46 = OpFunctionCall %void %textureDimensions_ba1481 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.wgsl new file mode 100644 index 0000000000..cbc883776d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_external; + +fn textureDimensions_ba1481() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ba1481(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_ba1481(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_ba1481(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl new file mode 100644 index 0000000000..c251ab66a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_bb3dde() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_bb3dde(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_bb3dde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_bb3dde(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..48b980a2d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_bb3dde() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_bb3dde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_bb3dde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_bb3dde(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..48b980a2d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_bb3dde() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_bb3dde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_bb3dde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_bb3dde(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.glsl new file mode 100644 index 0000000000..8c5f7400b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_bb3dde() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_bb3dde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_bb3dde() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_bb3dde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_bb3dde() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_bb3dde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.msl new file mode 100644 index 0000000000..0f837421b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_bb3dde(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_bb3dde(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_bb3dde(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_bb3dde(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd224fb852 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/bb3dde.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_bb3dde() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_bb3dde(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_bb3dde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_bb3dde(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl new file mode 100644 index 0000000000..6465afc994 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_c30e75() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c30e75(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_c30e75(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_c30e75(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e4ae3823e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c30e75() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c30e75(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c30e75(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c30e75(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4ae3823e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c30e75() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c30e75(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c30e75(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c30e75(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.glsl new file mode 100644 index 0000000000..06b6108b8c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_c30e75() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_c30e75(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_c30e75() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_c30e75(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_c30e75() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_c30e75(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.msl new file mode 100644 index 0000000000..711f4aace3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_c30e75(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_c30e75(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_c30e75(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_c30e75(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.wgsl new file mode 100644 index 0000000000..121b2c32dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c30e75.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_c30e75() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c30e75(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_c30e75(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_c30e75(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl new file mode 100644 index 0000000000..53293aa003 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_c7943d() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c7943d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_c7943d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_c7943d(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b69252d51 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c7943d() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c7943d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c7943d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c7943d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b69252d51 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c7943d() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c7943d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c7943d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c7943d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.glsl new file mode 100644 index 0000000000..ec88d6e813 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_c7943d() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_c7943d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_c7943d() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_c7943d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_c7943d() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_c7943d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.msl new file mode 100644 index 0000000000..39c32d13d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_c7943d(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_c7943d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_c7943d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_c7943d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d589b588d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/c7943d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_c7943d() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c7943d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_c7943d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_c7943d(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl new file mode 100644 index 0000000000..db888ed4a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_cc968c() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cc968c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cc968c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cc968c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e20e81bcef --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cc968c() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cc968c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cc968c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cc968c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e20e81bcef --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cc968c() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cc968c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cc968c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cc968c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.glsl new file mode 100644 index 0000000000..d7f3becc89 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_cc968c() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cc968c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_cc968c() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cc968c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_cc968c() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cc968c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.msl new file mode 100644 index 0000000000..2a4db09c42 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cc968c(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_cc968c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cc968c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cc968c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.wgsl new file mode 100644 index 0000000000..8caceedc84 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cc968c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_cc968c() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cc968c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cc968c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cc968c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl new file mode 100644 index 0000000000..ac049143ff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_cccc8f() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cccc8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cccc8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cccc8f(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8030a26359 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cccc8f() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cccc8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cccc8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cccc8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8030a26359 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cccc8f() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cccc8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cccc8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cccc8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.glsl new file mode 100644 index 0000000000..8ea9b9ed23 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureDimensions_cccc8f() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cccc8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureDimensions_cccc8f() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cccc8f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureDimensions_cccc8f() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cccc8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.msl new file mode 100644 index 0000000000..f03ce0c682 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cccc8f(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_cccc8f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cccc8f(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cccc8f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..19570add23 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cccc8f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_cccc8f() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cccc8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cccc8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cccc8f(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl new file mode 100644 index 0000000000..1bca07eb21 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_cd76a7() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cd76a7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cd76a7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cd76a7(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..107e7e6b32 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cd76a7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cd76a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cd76a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cd76a7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..107e7e6b32 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cd76a7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cd76a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cd76a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cd76a7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.glsl new file mode 100644 index 0000000000..92b0daea4b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureDimensions_cd76a7() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cd76a7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureDimensions_cd76a7() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cd76a7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureDimensions_cd76a7() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cd76a7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.msl new file mode 100644 index 0000000000..14b141addd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cd76a7(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_cd76a7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cd76a7(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cd76a7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa3b1a9c68 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cd76a7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_cd76a7() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cd76a7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cd76a7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cd76a7(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl new file mode 100644 index 0000000000..f4348817b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_cdf473() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cdf473(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cdf473(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cdf473(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..895f7d05b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_cdf473() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cdf473(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cdf473(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cdf473(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..895f7d05b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_cdf473() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cdf473(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cdf473(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cdf473(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.glsl new file mode 100644 index 0000000000..ea5fe7d9f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_cdf473() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_cdf473(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_cdf473() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_cdf473(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_cdf473() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_cdf473(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.msl new file mode 100644 index 0000000000..fa50285dcc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cdf473(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_cdf473(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_cdf473(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_cdf473(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.wgsl new file mode 100644 index 0000000000..a675dad97e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cdf473.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_cdf473() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cdf473(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cdf473(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cdf473(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl new file mode 100644 index 0000000000..dfdf7598e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array) -> vec2 +fn textureDimensions_cec841() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cec841(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cec841(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cec841(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b892fb9f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_cec841() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cec841(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cec841(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cec841(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b892fb9f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_cec841() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cec841(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cec841(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cec841(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.glsl new file mode 100644 index 0000000000..6c4ff13a80 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_cec841() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_cec841(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_cec841() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_cec841(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_cec841() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_cec841(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.msl new file mode 100644 index 0000000000..7c0b4ee3e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cec841(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_cec841(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_cec841(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_cec841(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.wgsl new file mode 100644 index 0000000000..7a92b371d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cec841.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_cec841() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cec841(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cec841(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cec841(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl new file mode 100644 index 0000000000..0d4830e4ce --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_cf7e43() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cf7e43(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cf7e43(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cf7e43(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f8b6211340 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cf7e43() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cf7e43(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cf7e43(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cf7e43(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f8b6211340 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cf7e43() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cf7e43(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cf7e43(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cf7e43(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.glsl new file mode 100644 index 0000000000..8b491fba70 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureDimensions_cf7e43() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cf7e43(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureDimensions_cf7e43() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cf7e43(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureDimensions_cf7e43() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cf7e43(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.msl new file mode 100644 index 0000000000..210364294b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cf7e43(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_cf7e43(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cf7e43(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cf7e43(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.wgsl new file mode 100644 index 0000000000..38c9845f8b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/cf7e43.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_cf7e43() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cf7e43(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cf7e43(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cf7e43(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl new file mode 100644 index 0000000000..1dbf0740ef --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube) -> vec2 +fn textureDimensions_d125bc() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d125bc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_d125bc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_d125bc(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bf2c107f3a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_d125bc() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d125bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d125bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d125bc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf2c107f3a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_d125bc() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d125bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d125bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d125bc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.glsl new file mode 100644 index 0000000000..0debada7db --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_d125bc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_d125bc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_d125bc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_d125bc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_d125bc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_d125bc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.msl new file mode 100644 index 0000000000..67f0abcb41 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_d125bc(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_d125bc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_d125bc(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_d125bc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.wgsl new file mode 100644 index 0000000000..21f8b055f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d125bc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_d125bc() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d125bc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_d125bc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_d125bc(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl new file mode 100644 index 0000000000..619b69ba01 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 +fn textureDimensions_d83c45() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d83c45(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_d83c45(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_d83c45(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6ac869bca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_d83c45() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d83c45(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d83c45(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d83c45(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6ac869bca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_d83c45() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d83c45(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d83c45(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d83c45(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.glsl new file mode 100644 index 0000000000..94aef0c3af --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_d83c45() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_d83c45(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_d83c45() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_d83c45(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_d83c45() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_d83c45(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.msl new file mode 100644 index 0000000000..663d3c6385 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_d83c45(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_d83c45(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_d83c45(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_d83c45(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.spvasm new file mode 100644 index 0000000000..d715d3cb99 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_d83c45 "textureDimensions_d83c45" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %23 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_d83c45 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %26 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySizeLod %v3int %22 %23 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_d83c45 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_d83c45 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_d83c45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.wgsl new file mode 100644 index 0000000000..2de7e46247 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/d83c45.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_d83c45() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d83c45(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_d83c45(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_d83c45(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl new file mode 100644 index 0000000000..5eb5422f98 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 +fn textureDimensions_daf7c0() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_daf7c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_daf7c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_daf7c0(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b44a6b8646 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_daf7c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_daf7c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_daf7c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_daf7c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b44a6b8646 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_daf7c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_daf7c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_daf7c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_daf7c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.glsl new file mode 100644 index 0000000000..5cfbb47de9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureDimensions_daf7c0() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_daf7c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DMS arg_0_1; +void textureDimensions_daf7c0() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_daf7c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureDimensions_daf7c0() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_daf7c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.msl new file mode 100644 index 0000000000..9f811af45e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_daf7c0(texture2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureDimensions_daf7c0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_daf7c0(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_daf7c0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..cf8158373d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/daf7c0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureDimensions_daf7c0() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_daf7c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_daf7c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_daf7c0(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl new file mode 100644 index 0000000000..ff016ebdab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_dc2dd0() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_dc2dd0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_dc2dd0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_dc2dd0(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..20e9146625 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_dc2dd0() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_dc2dd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_dc2dd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_dc2dd0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20e9146625 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_dc2dd0() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_dc2dd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_dc2dd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_dc2dd0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.glsl new file mode 100644 index 0000000000..3d7ac148af --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_dc2dd0() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_dc2dd0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_dc2dd0() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_dc2dd0(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_dc2dd0() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_dc2dd0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.msl new file mode 100644 index 0000000000..9e5082a93f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_dc2dd0(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_dc2dd0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_dc2dd0(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_dc2dd0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.wgsl new file mode 100644 index 0000000000..53eaf8fad7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/dc2dd0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_dc2dd0() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_dc2dd0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_dc2dd0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_dc2dd0(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl new file mode 100644 index 0000000000..5650d3596c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array) -> vec2 +fn textureDimensions_e927be() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e927be(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_e927be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_e927be(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3be868f09c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_e927be() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e927be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e927be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e927be(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3be868f09c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_e927be() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e927be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e927be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e927be(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.glsl new file mode 100644 index 0000000000..a476da2758 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_e927be() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_e927be(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_e927be() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_e927be(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_e927be() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_e927be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.msl new file mode 100644 index 0000000000..709257fa98 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_e927be(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_e927be(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_e927be(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_e927be(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.wgsl new file mode 100644 index 0000000000..1c420a19d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e927be.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_e927be() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e927be(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_e927be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_e927be(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl new file mode 100644 index 0000000000..4399a364f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_e9e96c() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e9e96c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_e9e96c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_e9e96c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..510eef86c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_e9e96c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e9e96c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e9e96c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e9e96c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..510eef86c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_e9e96c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e9e96c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e9e96c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e9e96c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.glsl new file mode 100644 index 0000000000..c167c243cb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_e9e96c() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_e9e96c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_e9e96c() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_e9e96c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_e9e96c() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_e9e96c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.msl new file mode 100644 index 0000000000..d512809aa0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_e9e96c(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_e9e96c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_e9e96c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_e9e96c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.wgsl new file mode 100644 index 0000000000..4c37479f96 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/e9e96c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_e9e96c() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e9e96c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_e9e96c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_e9e96c(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl new file mode 100644 index 0000000000..40048ce136 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 +fn textureDimensions_ef5b89() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ef5b89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_ef5b89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_ef5b89(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4bc53da64e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_ef5b89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ef5b89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ef5b89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ef5b89(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bc53da64e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_ef5b89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ef5b89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ef5b89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ef5b89(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.glsl new file mode 100644 index 0000000000..c0c1d74400 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_ef5b89() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_ef5b89(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_ef5b89() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_ef5b89(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_ef5b89() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_ef5b89(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.msl new file mode 100644 index 0000000000..a0d18a7526 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_ef5b89(texture2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureDimensions_ef5b89(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_ef5b89(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_ef5b89(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.wgsl new file mode 100644 index 0000000000..32a0325cfd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/ef5b89.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureDimensions_ef5b89() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ef5b89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_ef5b89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_ef5b89(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl new file mode 100644 index 0000000000..98d14cb4e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 +fn textureDimensions_efc8a4() { + var res: vec3 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_efc8a4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_efc8a4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_efc8a4(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c43705946e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_efc8a4() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_efc8a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_efc8a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_efc8a4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c43705946e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_efc8a4() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_efc8a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_efc8a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_efc8a4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.glsl new file mode 100644 index 0000000000..7e46277604 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_efc8a4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_efc8a4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureDimensions_efc8a4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_efc8a4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_efc8a4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_efc8a4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.msl new file mode 100644 index 0000000000..f1908ffb5c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_efc8a4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0), tint_symbol_1.get_depth(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_efc8a4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_efc8a4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_efc8a4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe0d9a6f03 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_efc8a4 "textureDimensions_efc8a4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %20 = OpConstantNull %int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_efc8a4 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v3int %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_efc8a4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_efc8a4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_efc8a4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.wgsl new file mode 100644 index 0000000000..c19268b49b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/efc8a4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_efc8a4() { + var res : vec3 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_efc8a4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_efc8a4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_efc8a4(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl new file mode 100644 index 0000000000..836def2a9e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; + +// fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2 +fn textureDimensions_f60bdb() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f60bdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f60bdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f60bdb(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1609032503 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_f60bdb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f60bdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f60bdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f60bdb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1609032503 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_f60bdb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f60bdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f60bdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f60bdb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.glsl new file mode 100644 index 0000000000..943195634d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_f60bdb() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_f60bdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_f60bdb() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_f60bdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_f60bdb() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_f60bdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.msl new file mode 100644 index 0000000000..1ec0626ad9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_f60bdb(depth2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_ms tint_symbol_2) { + textureDimensions_f60bdb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_f60bdb(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_f60bdb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..f22008da03 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f60bdb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; + +fn textureDimensions_f60bdb() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f60bdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f60bdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f60bdb(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl new file mode 100644 index 0000000000..93088a4eaa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 +fn textureDimensions_f7145b() { + var res: vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f7145b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f7145b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f7145b(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d93ba5cdb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_f7145b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f7145b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f7145b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f7145b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d93ba5cdb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_f7145b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f7145b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f7145b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f7145b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.glsl new file mode 100644 index 0000000000..2a5861cfb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_f7145b() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_f7145b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureDimensions_f7145b() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_f7145b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_f7145b() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_f7145b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.msl new file mode 100644 index 0000000000..ca07490508 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_f7145b(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_f7145b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_f7145b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_f7145b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed352accb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_f7145b "textureDimensions_f7145b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %21 = OpConstantNull %int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_f7145b = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %20 %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_f7145b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_f7145b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_f7145b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.wgsl new file mode 100644 index 0000000000..8066448c30 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f7145b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_f7145b() { + var res : vec2 = textureDimensions(arg_0, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f7145b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f7145b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f7145b(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl new file mode 100644 index 0000000000..e7304f57e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_f931c7() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f931c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f931c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f931c7(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9e231e6b57 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_f931c7() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f931c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f931c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f931c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9e231e6b57 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_f931c7() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f931c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f931c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f931c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.glsl new file mode 100644 index 0000000000..016f679a07 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureDimensions_f931c7() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_f931c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureDimensions_f931c7() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_f931c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureDimensions_f931c7() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_f931c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.msl new file mode 100644 index 0000000000..7b39e0fb9e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_f931c7(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_f931c7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_f931c7(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_f931c7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..041ed4c1b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/f931c7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_f931c7() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f931c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f931c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f931c7(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl new file mode 100644 index 0000000000..0f438d3405 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d) -> vec2 +fn textureDimensions_fa9859() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fa9859(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fa9859(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fa9859(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4bfdddf6b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_fa9859() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fa9859(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fa9859(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fa9859(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bfdddf6b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_fa9859() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fa9859(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fa9859(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fa9859(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.glsl new file mode 100644 index 0000000000..d8e8370ef5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_fa9859() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_fa9859(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureDimensions_fa9859() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_fa9859(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_fa9859() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_fa9859(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.msl new file mode 100644 index 0000000000..5fca056387 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_fa9859(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_fa9859(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_fa9859(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_fa9859(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.wgsl new file mode 100644 index 0000000000..3acbf7dd2f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fa9859.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_fa9859() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fa9859(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fa9859(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fa9859(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl new file mode 100644 index 0000000000..da81f0dd75 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_fb5670() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fb5670(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fb5670(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fb5670(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3f6c71f974 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_fb5670() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fb5670(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fb5670(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fb5670(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3f6c71f974 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_fb5670() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fb5670(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fb5670(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fb5670(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.glsl new file mode 100644 index 0000000000..5c3bd40cfc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_fb5670() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_fb5670(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_fb5670() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_fb5670(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_fb5670() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_fb5670(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.msl new file mode 100644 index 0000000000..fed740f414 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_fb5670(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_fb5670(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_fb5670(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_fb5670(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.wgsl new file mode 100644 index 0000000000..199f3559ca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fb5670.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_fb5670() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fb5670(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fb5670(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fb5670(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl new file mode 100644 index 0000000000..f99ff3f10c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_fcac78() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fcac78(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fcac78(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fcac78(); +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f02946b4e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_fcac78() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fcac78(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fcac78(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fcac78(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f02946b4e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_fcac78() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fcac78(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fcac78(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fcac78(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.glsl new file mode 100644 index 0000000000..9226dcd02c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_fcac78() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_fcac78(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_fcac78() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_fcac78(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_fcac78() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_fcac78(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.msl new file mode 100644 index 0000000000..3c6340c1e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_fcac78(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_fcac78(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_fcac78(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_fcac78(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e13671d20 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureDimensions/fcac78.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_fcac78() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fcac78(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fcac78(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fcac78(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/10c554.wgsl b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl new file mode 100644 index 0000000000..7cc77680ad --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_10c554() { + var res: vec4 = textureGather(arg_0, arg_1, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_10c554(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_10c554(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_10c554(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2507fcee71 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_10c554() { + float4 res = arg_0.Gather(arg_1, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_10c554(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_10c554(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_10c554(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2507fcee71 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_10c554() { + float4 res = arg_0.Gather(arg_1, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_10c554(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_10c554(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_10c554(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.glsl new file mode 100644 index 0000000000..47d056baca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGather_10c554() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f), 0.0); +} + +vec4 vertex_main() { + textureGather_10c554(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGather_10c554() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f), 0.0); +} + +void fragment_main() { + textureGather_10c554(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGather_10c554() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f), 0.0); +} + +void compute_main() { + textureGather_10c554(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.msl new file mode 100644 index 0000000000..c3f13c1ea4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_10c554(depthcube tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureGather_10c554(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_10c554(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_10c554(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureGather/10c554.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4a17cb0fd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/10c554.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_10c554() { + var res : vec4 = textureGather(arg_0, arg_1, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_10c554(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_10c554(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_10c554(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl new file mode 100644 index 0000000000..2ef4ce5f47 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_1f7f6b() { + var res: vec4 = textureGather(arg_0, arg_1, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_1f7f6b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_1f7f6b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_1f7f6b(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..287fd65c39 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_1f7f6b() { + float4 res = arg_0.Gather(arg_1, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_1f7f6b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_1f7f6b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_1f7f6b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..287fd65c39 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_1f7f6b() { + float4 res = arg_0.Gather(arg_1, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_1f7f6b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_1f7f6b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_1f7f6b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.glsl new file mode 100644 index 0000000000..e76e72816a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 0.0, ivec2(0)); +} + +vec4 vertex_main() { + textureGather_1f7f6b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 0.0, ivec2(0)); +} + +void fragment_main() { + textureGather_1f7f6b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 0.0, ivec2(0)); +} + +void compute_main() { + textureGather_1f7f6b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.msl new file mode 100644 index 0000000000..a861581165 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_1f7f6b(depth2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_1f7f6b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_1f7f6b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_1f7f6b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.spvasm new file mode 100644 index 0000000000..e4a034cce6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_1f7f6b "textureGather_1f7f6b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_1f7f6b = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageGather %v4float %23 %25 %int_0 ConstOffset %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_1f7f6b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_1f7f6b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_1f7f6b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c466e9c20 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/1f7f6b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_1f7f6b() { + var res : vec4 = textureGather(arg_0, arg_1, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_1f7f6b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_1f7f6b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_1f7f6b(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl new file mode 100644 index 0000000000..1313b5d43a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_22e930() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_22e930(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_22e930(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_22e930(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad228813d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_22e930() { + float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_22e930(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_22e930(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_22e930(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad228813d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_22e930() { + float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_22e930(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_22e930(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_22e930(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.glsl new file mode 100644 index 0000000000..79022b758b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_22e930(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_22e930(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_22e930(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.msl new file mode 100644 index 0000000000..b432609d49 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_22e930(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_22e930(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_22e930(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_22e930(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.spvasm new file mode 100644 index 0000000000..327eac55d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_22e930 "textureGather_22e930" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_22e930 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageGather %v4float %23 %29 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_22e930 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_22e930 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_22e930 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.wgsl new file mode 100644 index 0000000000..c06ac6121e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/22e930.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_22e930() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_22e930(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_22e930(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_22e930(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl new file mode 100644 index 0000000000..cb6bb808f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_2cc066() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2cc066(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_2cc066(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_2cc066(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..222acf566e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_2cc066() { + uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2cc066(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2cc066(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2cc066(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..222acf566e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_2cc066() { + uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2cc066(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2cc066(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2cc066(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.glsl new file mode 100644 index 0000000000..7c6c1331a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_2cc066(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_2cc066(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_2cc066(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.msl new file mode 100644 index 0000000000..fa0531a389 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_2cc066(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_2cc066(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_2cc066(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_2cc066(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.spvasm new file mode 100644 index 0000000000..a931db1de4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_2cc066 "textureGather_2cc066" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %34 = OpConstantNull %v4uint + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_2cc066 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %34 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %28 = OpConvertSToF %float %int_1 + %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28 + %20 = OpImageGather %v4uint %25 %31 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_2cc066 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_2cc066 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_2cc066 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.wgsl new file mode 100644 index 0000000000..277e487e2e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2cc066.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_2cc066() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2cc066(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_2cc066(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_2cc066(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl new file mode 100644 index 0000000000..dd85da6167 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_2e0ed5() { + var res: vec4 = textureGather(arg_0, arg_1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2e0ed5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_2e0ed5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_2e0ed5(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e1a5741735 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_2e0ed5() { + float4 res = arg_0.Gather(arg_1, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2e0ed5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2e0ed5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2e0ed5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e1a5741735 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_2e0ed5() { + float4 res = arg_0.Gather(arg_1, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2e0ed5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2e0ed5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2e0ed5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.glsl new file mode 100644 index 0000000000..8eca46c7b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_2e0ed5() { + vec4 res = textureGather(arg_0_arg_1, vec2(0.0f), 0.0); +} + +vec4 vertex_main() { + textureGather_2e0ed5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_2e0ed5() { + vec4 res = textureGather(arg_0_arg_1, vec2(0.0f), 0.0); +} + +void fragment_main() { + textureGather_2e0ed5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_2e0ed5() { + vec4 res = textureGather(arg_0_arg_1, vec2(0.0f), 0.0); +} + +void compute_main() { + textureGather_2e0ed5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.msl new file mode 100644 index 0000000000..9ae7410e33 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_2e0ed5(depth2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_2e0ed5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_2e0ed5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_2e0ed5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b2a82c681 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/2e0ed5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_2e0ed5() { + var res : vec4 = textureGather(arg_0, arg_1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2e0ed5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_2e0ed5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_2e0ed5(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl new file mode 100644 index 0000000000..f805569817 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_32c4e8() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_32c4e8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_32c4e8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_32c4e8(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ce7b157547 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_32c4e8() { + float4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_32c4e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_32c4e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_32c4e8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ce7b157547 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_32c4e8() { + float4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_32c4e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_32c4e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_32c4e8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.glsl new file mode 100644 index 0000000000..3b5504b9c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_32c4e8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void fragment_main() { + textureGather_32c4e8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void compute_main() { + textureGather_32c4e8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.msl new file mode 100644 index 0000000000..4553861a55 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_32c4e8(texturecube tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_32c4e8(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_32c4e8(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_32c4e8(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.spvasm new file mode 100644 index 0000000000..f2cc29704e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_32c4e8 "textureGather_32c4e8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %25 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_32c4e8 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageGather %v4float %23 %25 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureGather_32c4e8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %void %textureGather_32c4e8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_32c4e8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..5ad9ed8398 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/32c4e8.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_32c4e8() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_32c4e8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_32c4e8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_32c4e8(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl new file mode 100644 index 0000000000..553a45f767 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_3b32cc() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_3b32cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_3b32cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_3b32cc(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4fe9dd1470 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_3b32cc() { + uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_3b32cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_3b32cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_3b32cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4fe9dd1470 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_3b32cc() { + uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_3b32cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_3b32cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_3b32cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.glsl new file mode 100644 index 0000000000..38d117622e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_3b32cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void fragment_main() { + textureGather_3b32cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void compute_main() { + textureGather_3b32cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.msl new file mode 100644 index 0000000000..864d36cf9f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_3b32cc(texturecube tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_3b32cc(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_3b32cc(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_3b32cc(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..829beb2df2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_3b32cc "textureGather_3b32cc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %27 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %32 = OpConstantNull %v4uint + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_3b32cc = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %32 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4uint %25 %27 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_3b32cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_3b32cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_3b32cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd49b2b9bd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/3b32cc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_3b32cc() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_3b32cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_3b32cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_3b32cc(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/43025d.wgsl b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl new file mode 100644 index 0000000000..8ed5ffc2ab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_43025d() { + var res: vec4 = textureGather(arg_0, arg_1, vec3(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_43025d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_43025d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_43025d(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..703fd77ec7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_43025d() { + float4 res = arg_0.Gather(arg_1, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_43025d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_43025d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_43025d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..703fd77ec7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_43025d() { + float4 res = arg_0.Gather(arg_1, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_43025d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_43025d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_43025d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.glsl new file mode 100644 index 0000000000..bccd8f9506 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGather_43025d() { + vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 0.0); +} + +vec4 vertex_main() { + textureGather_43025d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGather_43025d() { + vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 0.0); +} + +void fragment_main() { + textureGather_43025d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGather_43025d() { + vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 0.0); +} + +void compute_main() { + textureGather_43025d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.msl new file mode 100644 index 0000000000..0867050d11 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_43025d(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_43025d(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_43025d(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_43025d(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureGather/43025d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.wgsl new file mode 100644 index 0000000000..d5ef2d4118 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/43025d.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_43025d() { + var res : vec4 = textureGather(arg_0, arg_1, vec3(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_43025d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_43025d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_43025d(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl new file mode 100644 index 0000000000..113115e409 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_49b07f() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_49b07f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_49b07f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_49b07f(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b70c4827dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_49b07f() { + uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_49b07f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_49b07f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_49b07f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b70c4827dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_49b07f() { + uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_49b07f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_49b07f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_49b07f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.glsl new file mode 100644 index 0000000000..fbcc858c58 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_49b07f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void fragment_main() { + textureGather_49b07f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void compute_main() { + textureGather_49b07f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.msl new file mode 100644 index 0000000000..3f485b49d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_49b07f(texture2d tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_49b07f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_49b07f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_49b07f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.spvasm new file mode 100644 index 0000000000..74778200f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_49b07f "textureGather_49b07f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %27 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %31 = OpConstantNull %v2int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %34 = OpConstantNull %v4uint + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_49b07f = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %34 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4uint %25 %27 %int_1 ConstOffset %31 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_49b07f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_49b07f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_49b07f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.wgsl new file mode 100644 index 0000000000..5d5523fc07 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/49b07f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_49b07f() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_49b07f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_49b07f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_49b07f(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl new file mode 100644 index 0000000000..b50219134f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_4b8103() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_4b8103(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_4b8103(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_4b8103(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3a7dca0279 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_4b8103() { + float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_4b8103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_4b8103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_4b8103(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3a7dca0279 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_4b8103() { + float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_4b8103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_4b8103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_4b8103(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.glsl new file mode 100644 index 0000000000..2eeca6e86e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_4b8103(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_4b8103(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void compute_main() { + textureGather_4b8103(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.msl new file mode 100644 index 0000000000..f1604b9054 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_4b8103(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_4b8103(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_4b8103(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_4b8103(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.spvasm new file mode 100644 index 0000000000..d995343f5a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_4b8103 "textureGather_4b8103" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %31 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_4b8103 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageGather %v4float %23 %29 %int_1 ConstOffset %31 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureGather_4b8103 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_4b8103 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_4b8103 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.wgsl new file mode 100644 index 0000000000..40817019c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/4b8103.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_4b8103() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_4b8103(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_4b8103(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_4b8103(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl new file mode 100644 index 0000000000..23c426bdd5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_5266da() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5266da(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5266da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5266da(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a616ea774a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5266da() { + float4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5266da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5266da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5266da(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a616ea774a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5266da() { + float4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5266da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5266da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5266da(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.glsl new file mode 100644 index 0000000000..9bc3a2832d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_5266da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void fragment_main() { + textureGather_5266da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void compute_main() { + textureGather_5266da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.msl new file mode 100644 index 0000000000..2082f6a54b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_5266da(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_5266da(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5266da(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5266da(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.spvasm new file mode 100644 index 0000000000..51c672ed6b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5266da "textureGather_5266da" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5266da = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageGather %v4float %23 %25 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureGather_5266da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %void %textureGather_5266da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_5266da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0657360eb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5266da.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5266da() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5266da(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5266da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5266da(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl new file mode 100644 index 0000000000..9521e83097 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_5ba85f() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5ba85f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5ba85f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5ba85f(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4a550ea27a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5ba85f() { + int4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5ba85f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5ba85f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5ba85f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4a550ea27a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5ba85f() { + int4 res = arg_1.GatherGreen(arg_2, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5ba85f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5ba85f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5ba85f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.glsl new file mode 100644 index 0000000000..fcb3cf832b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_5ba85f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void fragment_main() { + textureGather_5ba85f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f), 1); +} + +void compute_main() { + textureGather_5ba85f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.msl new file mode 100644 index 0000000000..d0ae48190b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_5ba85f(texturecube tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_5ba85f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5ba85f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5ba85f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.spvasm new file mode 100644 index 0000000000..29ef2a4c28 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5ba85f "textureGather_5ba85f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %27 = OpConstantNull %v3float + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %31 = OpConstantNull %v4int + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5ba85f = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %31 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4int %25 %27 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_5ba85f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_5ba85f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_5ba85f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.wgsl new file mode 100644 index 0000000000..97174e674a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5ba85f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5ba85f() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5ba85f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5ba85f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5ba85f(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl new file mode 100644 index 0000000000..ebaad123a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_5bd491() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5bd491(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5bd491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5bd491(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6c830b8246 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5bd491() { + uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5bd491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5bd491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5bd491(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6c830b8246 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5bd491() { + uint4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5bd491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5bd491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5bd491(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.glsl new file mode 100644 index 0000000000..d96776aaf6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_5bd491(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void fragment_main() { + textureGather_5bd491(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void compute_main() { + textureGather_5bd491(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.msl new file mode 100644 index 0000000000..2b48ea550b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_5bd491(texture2d tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_5bd491(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5bd491(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5bd491(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.spvasm new file mode 100644 index 0000000000..b22abf0ef8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5bd491 "textureGather_5bd491" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %27 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %32 = OpConstantNull %v4uint + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5bd491 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %32 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4uint %25 %27 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_5bd491 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_5bd491 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_5bd491 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1c71cd8fe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/5bd491.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5bd491() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5bd491(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5bd491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5bd491(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl new file mode 100644 index 0000000000..b7fa5ff7d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_751f8a() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_751f8a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_751f8a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_751f8a(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3f07457516 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_751f8a() { + float4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_751f8a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_751f8a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_751f8a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3f07457516 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_751f8a() { + float4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_751f8a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_751f8a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_751f8a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.glsl new file mode 100644 index 0000000000..032fe349e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_751f8a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_751f8a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_751f8a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.msl new file mode 100644 index 0000000000..2fbbc1a5b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_751f8a(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_751f8a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_751f8a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_751f8a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.spvasm new file mode 100644 index 0000000000..39748135db --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_751f8a "textureGather_751f8a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_751f8a = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %25 = OpConvertSToF %float %int_1 + %28 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %25 + %19 = OpImageGather %v4float %23 %28 %int_1 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureGather_751f8a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureGather_751f8a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_751f8a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd5081f31d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/751f8a.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_751f8a() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_751f8a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_751f8a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_751f8a(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl new file mode 100644 index 0000000000..7fac2aae86 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_7c3828() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_7c3828(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_7c3828(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_7c3828(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5efb022606 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_7c3828() { + int4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_7c3828(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_7c3828(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_7c3828(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5efb022606 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_7c3828() { + int4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_7c3828(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_7c3828(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_7c3828(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.glsl new file mode 100644 index 0000000000..6fcedbf362 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_7c3828(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void fragment_main() { + textureGather_7c3828(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void compute_main() { + textureGather_7c3828(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.msl new file mode 100644 index 0000000000..a8134ee6fc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_7c3828(texture2d tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_7c3828(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_7c3828(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_7c3828(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.spvasm new file mode 100644 index 0000000000..1e1f646e94 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_7c3828 "textureGather_7c3828" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %27 = OpConstantNull %v2float + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %30 = OpConstantNull %v2int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %33 = OpConstantNull %v4int + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_7c3828 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %33 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4int %25 %27 %int_1 ConstOffset %30 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureGather_7c3828 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_7c3828 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_7c3828 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d624d2627 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/7c3828.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_7c3828() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_7c3828(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_7c3828(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_7c3828(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl new file mode 100644 index 0000000000..8f95c077f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_8b754c() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_8b754c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_8b754c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_8b754c(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f8ffc7c726 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_8b754c() { + int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_8b754c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_8b754c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_8b754c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f8ffc7c726 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_8b754c() { + int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_8b754c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_8b754c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_8b754c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.glsl new file mode 100644 index 0000000000..deec62c53b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_8b754c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_8b754c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_8b754c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.msl new file mode 100644 index 0000000000..2bd2f19a7c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_8b754c(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_8b754c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_8b754c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_8b754c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.spvasm new file mode 100644 index 0000000000..97669769ec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_8b754c "textureGather_8b754c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %33 = OpConstantNull %v4int + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_8b754c = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %33 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %28 = OpConvertSToF %float %int_1 + %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28 + %20 = OpImageGather %v4int %25 %30 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureGather_8b754c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_8b754c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_8b754c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2e4ee383c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/8b754c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_8b754c() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_8b754c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_8b754c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_8b754c(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl new file mode 100644 index 0000000000..be5ea9ea7b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_9a6358() { + var res: vec4 = textureGather(arg_0, arg_1, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_9a6358(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_9a6358(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_9a6358(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..57f3d15ce6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_9a6358() { + float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_9a6358(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_9a6358(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_9a6358(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..57f3d15ce6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_9a6358() { + float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_9a6358(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_9a6358(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_9a6358(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.glsl new file mode 100644 index 0000000000..ba47d8f7b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_9a6358() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0); +} + +vec4 vertex_main() { + textureGather_9a6358(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_9a6358() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0); +} + +void fragment_main() { + textureGather_9a6358(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_9a6358() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0); +} + +void compute_main() { + textureGather_9a6358(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.msl new file mode 100644 index 0000000000..b6f9f6857f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_9a6358(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_9a6358(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_9a6358(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_9a6358(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.wgsl new file mode 100644 index 0000000000..415aa2c524 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/9a6358.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_9a6358() { + var res : vec4 = textureGather(arg_0, arg_1, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_9a6358(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_9a6358(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_9a6358(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl new file mode 100644 index 0000000000..f2aba4a1a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_af55b3() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_af55b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_af55b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_af55b3(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..11eeb8b23f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_af55b3() { + float4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_af55b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_af55b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_af55b3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11eeb8b23f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_af55b3() { + float4 res = arg_1.GatherGreen(arg_2, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_af55b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_af55b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_af55b3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.glsl new file mode 100644 index 0000000000..b9e44ef1ad --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_af55b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void fragment_main() { + textureGather_af55b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f), ivec2(0), 1); +} + +void compute_main() { + textureGather_af55b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.msl new file mode 100644 index 0000000000..292679bd37 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_af55b3(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_af55b3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_af55b3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_af55b3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..ec4850a13e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_af55b3 "textureGather_af55b3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_af55b3 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_2 + %21 = OpLoad %11 %arg_1 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageGather %v4float %23 %25 %int_1 ConstOffset %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_af55b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_af55b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_af55b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..c45f294bc7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/af55b3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_af55b3() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_af55b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_af55b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_af55b3(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl new file mode 100644 index 0000000000..54a1771eca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_bb3ac5() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_bb3ac5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_bb3ac5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_bb3ac5(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e893100e0a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_bb3ac5() { + int4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_bb3ac5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_bb3ac5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_bb3ac5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e893100e0a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_bb3ac5() { + int4 res = arg_1.GatherGreen(arg_2, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_bb3ac5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_bb3ac5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_bb3ac5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.glsl new file mode 100644 index 0000000000..a1b2221f64 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +vec4 vertex_main() { + textureGather_bb3ac5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void fragment_main() { + textureGather_bb3ac5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f), 1); +} + +void compute_main() { + textureGather_bb3ac5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.msl new file mode 100644 index 0000000000..9be015a16f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_bb3ac5(texture2d tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_bb3ac5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_bb3ac5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_bb3ac5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d5ffe4dbf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_bb3ac5 "textureGather_bb3ac5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %27 = OpConstantNull %v2float + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %31 = OpConstantNull %v4int + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_bb3ac5 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %31 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %20 = OpImageGather %v4int %25 %27 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0ad8437dc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/bb3ac5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_bb3ac5() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_bb3ac5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_bb3ac5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_bb3ac5(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl new file mode 100644 index 0000000000..5aaf7b378c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_c0640c() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_c0640c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_c0640c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_c0640c(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d86b7f2a2e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_c0640c() { + int4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_c0640c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_c0640c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_c0640c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d86b7f2a2e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_c0640c() { + int4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_c0640c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_c0640c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_c0640c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.glsl new file mode 100644 index 0000000000..b4697afe2d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_c0640c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_c0640c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_c0640c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.msl new file mode 100644 index 0000000000..2af36677fe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_c0640c(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_c0640c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_c0640c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_c0640c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f1c64918f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_c0640c "textureGather_c0640c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %32 = OpConstantNull %v4int + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_c0640c = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %32 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %27 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 + %20 = OpImageGather %v4int %25 %29 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_c0640c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_c0640c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_c0640c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.wgsl new file mode 100644 index 0000000000..df93f13f61 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/c0640c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_c0640c() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_c0640c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_c0640c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_c0640c(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl new file mode 100644 index 0000000000..4ae5d191df --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_d1f187() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d1f187(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_d1f187(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_d1f187(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad1a98fa20 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_d1f187() { + uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d1f187(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d1f187(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d1f187(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad1a98fa20 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_d1f187() { + uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d1f187(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d1f187(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d1f187(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.glsl new file mode 100644 index 0000000000..442d77ae01 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_d1f187(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_d1f187(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void compute_main() { + textureGather_d1f187(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.msl new file mode 100644 index 0000000000..1f50d685e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_d1f187(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_d1f187(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_d1f187(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_d1f187(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.spvasm new file mode 100644 index 0000000000..369e2a3d72 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_d1f187 "textureGather_d1f187" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %33 = OpConstantNull %v2int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %36 = OpConstantNull %v4uint + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_d1f187 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %36 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %28 = OpConvertSToF %float %int_1 + %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28 + %20 = OpImageGather %v4uint %25 %31 %int_1 ConstOffset %33 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %textureGather_d1f187 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_d1f187 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %49 = OpLabel + %50 = OpFunctionCall %void %textureGather_d1f187 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c906a65f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d1f187.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_d1f187() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d1f187(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_d1f187(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_d1f187(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl new file mode 100644 index 0000000000..6a6fcb52e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_d90605() { + var res: vec4 = textureGather(arg_0, arg_1, vec2(), 1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d90605(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_d90605(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_d90605(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8a54bc6267 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_d90605() { + float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d90605(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d90605(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d90605(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8a54bc6267 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_d90605() { + float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d90605(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d90605(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d90605(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.glsl new file mode 100644 index 0000000000..5028f86173 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0)); +} + +vec4 vertex_main() { + textureGather_d90605(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0)); +} + +void fragment_main() { + textureGather_d90605(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0)); +} + +void compute_main() { + textureGather_d90605(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.msl new file mode 100644 index 0000000000..90be232ac8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_d90605(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_d90605(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_d90605(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_d90605(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.spvasm new file mode 100644 index 0000000000..38cffa3654 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_d90605 "textureGather_d90605" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_d90605 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageGather %v4float %23 %29 %int_0 ConstOffset %32 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_d90605 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_d90605 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_d90605 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.wgsl new file mode 100644 index 0000000000..f61c0dc0c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/d90605.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_d90605() { + var res : vec4 = textureGather(arg_0, arg_1, vec2(), 1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d90605(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_d90605(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_d90605(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl new file mode 100644 index 0000000000..14c0857c7e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_e9d390() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_e9d390(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_e9d390(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_e9d390(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2d2893d773 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_e9d390() { + int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_e9d390(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_e9d390(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_e9d390(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d2893d773 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_e9d390() { + int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_e9d390(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_e9d390(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_e9d390(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.glsl new file mode 100644 index 0000000000..fc9b73f561 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_e9d390(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_e9d390(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1); +} + +void compute_main() { + textureGather_e9d390(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.msl new file mode 100644 index 0000000000..2449d25a52 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_e9d390(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_e9d390(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_e9d390(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_e9d390(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa462bc923 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_e9d390 "textureGather_e9d390" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %24 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %35 = OpConstantNull %v4int + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_e9d390 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %35 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %28 = OpConvertSToF %float %int_1 + %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28 + %20 = OpImageGather %v4int %25 %30 %int_1 ConstOffset %32 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureGather_e9d390 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_e9d390 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGather_e9d390 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.wgsl new file mode 100644 index 0000000000..72ada2ebaa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/e9d390.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_e9d390() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_e9d390(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_e9d390(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_e9d390(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl new file mode 100644 index 0000000000..97a402ad7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_f2c6e3() { + var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_f2c6e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_f2c6e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_f2c6e3(); +} diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6114a7f6f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_f2c6e3() { + uint4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_f2c6e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_f2c6e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_f2c6e3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6114a7f6f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_f2c6e3() { + uint4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_f2c6e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_f2c6e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_f2c6e3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.glsl new file mode 100644 index 0000000000..f8eed5e615 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +vec4 vertex_main() { + textureGather_f2c6e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void fragment_main() { + textureGather_f2c6e3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); +} + +void compute_main() { + textureGather_f2c6e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.msl new file mode 100644 index 0000000000..3d5fb84107 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGather_f2c6e3(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_f2c6e3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_f2c6e3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_f2c6e3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..43cb212c2e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_f2c6e3 "textureGather_f2c6e3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %33 = OpConstantNull %v4uint + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_f2c6e3 = OpFunction %void None %16 + %19 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %33 + %22 = OpLoad %15 %arg_2 + %23 = OpLoad %11 %arg_1 + %25 = OpSampledImage %24 %23 %22 + %27 = OpConvertSToF %float %int_1 + %30 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 + %20 = OpImageGather %v4uint %25 %30 %int_1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b13511b10 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGather/f2c6e3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_f2c6e3() { + var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_f2c6e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_f2c6e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_f2c6e3(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl new file mode 100644 index 0000000000..c90295e914 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> vec4 +fn textureGatherCompare_182fd4() { + var res: vec4 = textureGatherCompare(arg_0, arg_1, vec3(), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_182fd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_182fd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_182fd4(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4f6161c935 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_182fd4() { + float4 res = arg_0.GatherCmp(arg_1, (0.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_182fd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_182fd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_182fd4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f6161c935 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_182fd4() { + float4 res = arg_0.GatherCmp(arg_1, (0.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_182fd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_182fd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_182fd4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.glsl new file mode 100644 index 0000000000..29117676ac --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGatherCompare_182fd4() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +vec4 vertex_main() { + textureGatherCompare_182fd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGatherCompare_182fd4() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +void fragment_main() { + textureGatherCompare_182fd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGatherCompare_182fd4() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +void compute_main() { + textureGatherCompare_182fd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.msl new file mode 100644 index 0000000000..5c3e528957 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGatherCompare_182fd4(depthcube tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float3(0.0f), 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_182fd4(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_182fd4(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_182fd4(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1f2612e41 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/182fd4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_182fd4() { + var res : vec4 = textureGatherCompare(arg_0, arg_1, vec3(), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_182fd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_182fd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_182fd4(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl new file mode 100644 index 0000000000..7c49d09e87 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> vec4 +fn textureGatherCompare_313add() { + var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_313add(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_313add(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_313add(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3512f9a768 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_313add() { + float4 res = arg_0.GatherCmp(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_313add(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_313add(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_313add(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3512f9a768 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_313add() { + float4 res = arg_0.GatherCmp(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_313add(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_313add(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_313add(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.glsl new file mode 100644 index 0000000000..7416e88749 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +vec4 vertex_main() { + textureGatherCompare_313add(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +void fragment_main() { + textureGatherCompare_313add(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +void compute_main() { + textureGatherCompare_313add(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.msl new file mode 100644 index 0000000000..2b15285c32 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGatherCompare_313add(depth2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(0.0f), 1.0f, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_313add(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_313add(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_313add(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.spvasm new file mode 100644 index 0000000000..1875a0a776 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_313add "textureGatherCompare_313add" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float +%textureGatherCompare_313add = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageDrefGather %v4float %23 %25 %float_1 ConstOffset %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureGatherCompare_313add + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureGatherCompare_313add + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGatherCompare_313add + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab31a89c24 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/313add.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_313add() { + var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_313add(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_313add(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_313add(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl new file mode 100644 index 0000000000..6b753a9945 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> vec4 +fn textureGatherCompare_60d2d1() { + var res: vec4 = textureGatherCompare(arg_0, arg_1, vec3(), 1, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_60d2d1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_60d2d1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_60d2d1(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3cc753f8e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_60d2d1() { + float4 res = arg_0.GatherCmp(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_60d2d1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_60d2d1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_60d2d1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3cc753f8e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_60d2d1() { + float4 res = arg_0.GatherCmp(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_60d2d1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_60d2d1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_60d2d1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.glsl new file mode 100644 index 0000000000..be729a04fa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGatherCompare_60d2d1() { + vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +vec4 vertex_main() { + textureGatherCompare_60d2d1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGatherCompare_60d2d1() { + vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +void fragment_main() { + textureGatherCompare_60d2d1(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGatherCompare_60d2d1() { + vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +void compute_main() { + textureGatherCompare_60d2d1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.msl new file mode 100644 index 0000000000..b0505731a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGatherCompare_60d2d1(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float3(0.0f), 1, 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_60d2d1(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_60d2d1(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_60d2d1(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb51bf9975 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/60d2d1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_60d2d1() { + var res : vec4 = textureGatherCompare(arg_0, arg_1, vec3(), 1, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_60d2d1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_60d2d1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_60d2d1(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl new file mode 100644 index 0000000000..f5aab74fa3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> vec4 +fn textureGatherCompare_6d9352() { + var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_6d9352(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_6d9352(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_6d9352(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38bce11c53 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_6d9352() { + float4 res = arg_0.GatherCmp(arg_1, (0.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_6d9352(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_6d9352(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_6d9352(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38bce11c53 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_6d9352() { + float4 res = arg_0.GatherCmp(arg_1, (0.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_6d9352(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_6d9352(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_6d9352(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.glsl new file mode 100644 index 0000000000..e1ec03252d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_6d9352() { + vec4 res = textureGather(arg_0_arg_1, vec2(0.0f), 1.0f); +} + +vec4 vertex_main() { + textureGatherCompare_6d9352(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_6d9352() { + vec4 res = textureGather(arg_0_arg_1, vec2(0.0f), 1.0f); +} + +void fragment_main() { + textureGatherCompare_6d9352(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_6d9352() { + vec4 res = textureGather(arg_0_arg_1, vec2(0.0f), 1.0f); +} + +void compute_main() { + textureGatherCompare_6d9352(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.msl new file mode 100644 index 0000000000..a5b7ececb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGatherCompare_6d9352(depth2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(0.0f), 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_6d9352(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_6d9352(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_6d9352(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6898c2ecc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/6d9352.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_6d9352() { + var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_6d9352(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_6d9352(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_6d9352(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl new file mode 100644 index 0000000000..0ac189578a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> vec4 +fn textureGatherCompare_783e65() { + var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_783e65(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_783e65(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_783e65(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..702933d86a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_783e65() { + float4 res = arg_0.GatherCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_783e65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_783e65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_783e65(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..702933d86a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_783e65() { + float4 res = arg_0.GatherCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_783e65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_783e65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_783e65(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.glsl new file mode 100644 index 0000000000..bfc941fa8d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_783e65() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); +} + +vec4 vertex_main() { + textureGatherCompare_783e65(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_783e65() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); +} + +void fragment_main() { + textureGatherCompare_783e65(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_783e65() { + vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); +} + +void compute_main() { + textureGatherCompare_783e65(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.msl new file mode 100644 index 0000000000..5c8eb746b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGatherCompare_783e65(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(0.0f), 1, 1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_783e65(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_783e65(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_783e65(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac4201677b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/783e65.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_783e65() { + var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_783e65(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_783e65(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_783e65(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl new file mode 100644 index 0000000000..257fd865df --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> vec4 +fn textureGatherCompare_f585cc() { + var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_f585cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_f585cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_f585cc(); +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ba3d6fdb54 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_f585cc() { + float4 res = arg_0.GatherCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_f585cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_f585cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_f585cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba3d6fdb54 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_f585cc() { + float4 res = arg_0.GatherCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_f585cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_f585cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_f585cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.glsl new file mode 100644 index 0000000000..be0c7bf89d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +vec4 vertex_main() { + textureGatherCompare_f585cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +void fragment_main() { + textureGatherCompare_f585cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +void compute_main() { + textureGatherCompare_f585cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.msl new file mode 100644 index 0000000000..e6c687e19d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureGatherCompare_f585cc(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(0.0f), 1, 1.0f, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_f585cc(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_f585cc(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_f585cc(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..d52aee2043 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_f585cc "textureGatherCompare_f585cc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureGatherCompare_f585cc = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageDrefGather %v4float %23 %29 %float_1 ConstOffset %32 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..a3870ffe5d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureGatherCompare/f585cc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_f585cc() { + var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_f585cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_f585cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_f585cc(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl new file mode 100644 index 0000000000..b2c82b13a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureLoad(texture: texture_depth_2d, coords: vec2, level: i32) -> f32 +fn textureLoad_19cf87() { + var res: f32 = textureLoad(arg_0, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_19cf87(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_19cf87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_19cf87(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54f4e7e1bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_19cf87() { + float res = arg_0.Load(int3(0, 0, 0)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_19cf87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_19cf87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_19cf87(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54f4e7e1bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_19cf87() { + float res = arg_0.Load(int3(0, 0, 0)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_19cf87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_19cf87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_19cf87(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.glsl new file mode 100644 index 0000000000..49878f8083 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_19cf87() { + float res = texelFetch(arg_0_1, ivec2(0), 0).x; +} + +vec4 vertex_main() { + textureLoad_19cf87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureLoad_19cf87() { + float res = texelFetch(arg_0_1, ivec2(0), 0).x; +} + +void fragment_main() { + textureLoad_19cf87(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_19cf87() { + float res = texelFetch(arg_0_1, ivec2(0), 0).x; +} + +void compute_main() { + textureLoad_19cf87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.msl new file mode 100644 index 0000000000..452e06878c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_19cf87(depth2d tint_symbol_1) { + float res = tint_symbol_1.read(uint2(int2(0)), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureLoad_19cf87(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureLoad_19cf87(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureLoad_19cf87(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2f37597f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_19cf87 "textureLoad_19cf87" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %21 = OpConstantNull %v2int + %22 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_19cf87 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %18 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4float %18 %21 Lod %22 + %16 = OpCompositeExtract %float %17 0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureLoad_19cf87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureLoad_19cf87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureLoad_19cf87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.wgsl new file mode 100644 index 0000000000..06ee45ec18 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/19cf87.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureLoad_19cf87() { + var res : f32 = textureLoad(arg_0, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_19cf87(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_19cf87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_19cf87(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl new file mode 100644 index 0000000000..76c6121d39 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 +fn textureLoad_1b8588() { + var res: vec4 = textureLoad(arg_0, 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1b8588(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_1b8588(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_1b8588(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..12509febb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_1b8588() { + uint4 res = arg_0.Load(int2(1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1b8588(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1b8588(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1b8588(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..12509febb1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_1b8588() { + uint4 res = arg_0.Load(int2(1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1b8588(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1b8588(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1b8588(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.glsl new file mode 100644 index 0000000000..3645132e8e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureLoad_1b8588() { + uvec4 res = texelFetch(arg_0_1, 1, 0); +} + +vec4 vertex_main() { + textureLoad_1b8588(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureLoad_1b8588() { + uvec4 res = texelFetch(arg_0_1, 1, 0); +} + +void fragment_main() { + textureLoad_1b8588(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureLoad_1b8588() { + uvec4 res = texelFetch(arg_0_1, 1, 0); +} + +void compute_main() { + textureLoad_1b8588(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.msl new file mode 100644 index 0000000000..a71b52b813 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_1b8588(texture1d tint_symbol_1) { + uint4 res = tint_symbol_1.read(uint(1), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureLoad_1b8588(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureLoad_1b8588(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureLoad_1b8588(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd22bbac76 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_1b8588 "textureLoad_1b8588" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %22 = OpConstantNull %int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %25 = OpConstantNull %v4uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_1b8588 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %25 + %19 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4uint %19 %int_1 Lod %22 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureLoad_1b8588 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_1b8588 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureLoad_1b8588 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.wgsl new file mode 100644 index 0000000000..3201267a38 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1b8588.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureLoad_1b8588() { + var res : vec4 = textureLoad(arg_0, 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1b8588(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_1b8588(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_1b8588(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl new file mode 100644 index 0000000000..42ccce41c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 +fn textureLoad_1f2016() { + var res: vec4 = textureLoad(arg_0, vec3(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1f2016(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_1f2016(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_1f2016(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18a466dca2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_1f2016() { + float4 res = arg_0.Load(int4(0, 0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1f2016(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1f2016(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1f2016(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..18a466dca2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_1f2016() { + float4 res = arg_0.Load(int4(0, 0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1f2016(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1f2016(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1f2016(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.glsl new file mode 100644 index 0000000000..63e002a8e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureLoad_1f2016() { + vec4 res = texelFetch(arg_0_1, ivec3(0), 0); +} + +vec4 vertex_main() { + textureLoad_1f2016(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureLoad_1f2016() { + vec4 res = texelFetch(arg_0_1, ivec3(0), 0); +} + +void fragment_main() { + textureLoad_1f2016(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureLoad_1f2016() { + vec4 res = texelFetch(arg_0_1, ivec3(0), 0); +} + +void compute_main() { + textureLoad_1f2016(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.msl new file mode 100644 index 0000000000..194cdbfd53 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_1f2016(texture3d tint_symbol_1) { + float4 res = tint_symbol_1.read(uint3(int3(0)), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureLoad_1f2016(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureLoad_1f2016(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureLoad_1f2016(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.spvasm new file mode 100644 index 0000000000..13f8d2ac67 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_1f2016 "textureLoad_1f2016" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %20 = OpConstantNull %v3int + %21 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_1f2016 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %17 = OpLoad %11 %arg_0 + %16 = OpImageFetch %v4float %17 %20 Lod %21 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureLoad_1f2016 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureLoad_1f2016 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureLoad_1f2016 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0f6e74835 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/1f2016.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureLoad_1f2016() { + var res : vec4 = textureLoad(arg_0, vec3(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1f2016(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_1f2016(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_1f2016(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/484344.wgsl b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl new file mode 100644 index 0000000000..f374d1aa1f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 +fn textureLoad_484344() { + var res: vec4 = textureLoad(arg_0, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_484344(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_484344(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_484344(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bf85eb0bba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_484344() { + float4 res = arg_0.Load(int3(0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_484344(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_484344(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_484344(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf85eb0bba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_484344() { + float4 res = arg_0.Load(int3(0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_484344(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_484344(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_484344(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.glsl new file mode 100644 index 0000000000..ad32896d71 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_484344() { + vec4 res = texelFetch(arg_0_1, ivec2(0), 0); +} + +vec4 vertex_main() { + textureLoad_484344(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureLoad_484344() { + vec4 res = texelFetch(arg_0_1, ivec2(0), 0); +} + +void fragment_main() { + textureLoad_484344(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_484344() { + vec4 res = texelFetch(arg_0_1, ivec2(0), 0); +} + +void compute_main() { + textureLoad_484344(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.msl new file mode 100644 index 0000000000..bddd029ec5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_484344(texture2d tint_symbol_1) { + float4 res = tint_symbol_1.read(uint2(int2(0)), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureLoad_484344(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureLoad_484344(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureLoad_484344(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.spvasm new file mode 100644 index 0000000000..46e1f0855d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_484344 "textureLoad_484344" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %20 = OpConstantNull %v2int + %21 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_484344 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %17 = OpLoad %11 %arg_0 + %16 = OpImageFetch %v4float %17 %20 Lod %21 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureLoad_484344 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureLoad_484344 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureLoad_484344 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.wgsl new file mode 100644 index 0000000000..af4014192e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/484344.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureLoad_484344() { + var res : vec4 = textureLoad(arg_0, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_484344(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_484344(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_484344(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl new file mode 100644 index 0000000000..0b1bff68da --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 +fn textureLoad_4fd803() { + var res: vec4 = textureLoad(arg_0, vec3(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_4fd803(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_4fd803(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_4fd803(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8ee1bd1282 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_4fd803() { + int4 res = arg_0.Load(int4(0, 0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_4fd803(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_4fd803(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_4fd803(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8ee1bd1282 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_4fd803() { + int4 res = arg_0.Load(int4(0, 0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_4fd803(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_4fd803(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_4fd803(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.glsl new file mode 100644 index 0000000000..445e01f7cd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureLoad_4fd803() { + ivec4 res = texelFetch(arg_0_1, ivec3(0), 0); +} + +vec4 vertex_main() { + textureLoad_4fd803(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureLoad_4fd803() { + ivec4 res = texelFetch(arg_0_1, ivec3(0), 0); +} + +void fragment_main() { + textureLoad_4fd803(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureLoad_4fd803() { + ivec4 res = texelFetch(arg_0_1, ivec3(0), 0); +} + +void compute_main() { + textureLoad_4fd803(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.msl new file mode 100644 index 0000000000..3a19c301a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_4fd803(texture3d tint_symbol_1) { + int4 res = tint_symbol_1.read(uint3(int3(0)), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureLoad_4fd803(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureLoad_4fd803(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureLoad_4fd803(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.spvasm new file mode 100644 index 0000000000..b830446b38 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_4fd803 "textureLoad_4fd803" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %v3int = OpTypeVector %int 3 + %21 = OpConstantNull %v3int + %22 = OpConstantNull %int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %25 = OpConstantNull %v4int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_4fd803 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %25 + %19 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4int %19 %21 Lod %22 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureLoad_4fd803 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_4fd803 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureLoad_4fd803 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.wgsl new file mode 100644 index 0000000000..36d495ac92 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/4fd803.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureLoad_4fd803() { + var res : vec4 = textureLoad(arg_0, vec3(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_4fd803(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_4fd803(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_4fd803(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl new file mode 100644 index 0000000000..6171bd1a73 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 +fn textureLoad_5a2f9d() { + var res: vec4 = textureLoad(arg_0, 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_5a2f9d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_5a2f9d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_5a2f9d(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8e5301e4ec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_5a2f9d() { + int4 res = arg_0.Load(int2(1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_5a2f9d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_5a2f9d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_5a2f9d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e5301e4ec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_5a2f9d() { + int4 res = arg_0.Load(int2(1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_5a2f9d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_5a2f9d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_5a2f9d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.glsl new file mode 100644 index 0000000000..e934bb10f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureLoad_5a2f9d() { + ivec4 res = texelFetch(arg_0_1, 1, 0); +} + +vec4 vertex_main() { + textureLoad_5a2f9d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureLoad_5a2f9d() { + ivec4 res = texelFetch(arg_0_1, 1, 0); +} + +void fragment_main() { + textureLoad_5a2f9d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureLoad_5a2f9d() { + ivec4 res = texelFetch(arg_0_1, 1, 0); +} + +void compute_main() { + textureLoad_5a2f9d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.msl new file mode 100644 index 0000000000..be59bdf8a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_5a2f9d(texture1d tint_symbol_1) { + int4 res = tint_symbol_1.read(uint(1), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureLoad_5a2f9d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureLoad_5a2f9d(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureLoad_5a2f9d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d51595f19 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_5a2f9d "textureLoad_5a2f9d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %21 = OpConstantNull %int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %24 = OpConstantNull %v4int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_5a2f9d = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %24 + %19 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4int %19 %int_1 Lod %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureLoad_5a2f9d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureLoad_5a2f9d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureLoad_5a2f9d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.wgsl new file mode 100644 index 0000000000..13f88e8325 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/5a2f9d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureLoad_5a2f9d() { + var res : vec4 = textureLoad(arg_0, 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_5a2f9d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_5a2f9d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_5a2f9d(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl new file mode 100644 index 0000000000..8d5dd746c4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 +fn textureLoad_6154d4() { + var res: vec4 = textureLoad(arg_0, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6154d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_6154d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_6154d4(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cf6519414d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_6154d4() { + uint4 res = arg_0.Load(int3(0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6154d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6154d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6154d4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cf6519414d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_6154d4() { + uint4 res = arg_0.Load(int3(0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6154d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6154d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6154d4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.glsl new file mode 100644 index 0000000000..14dcb22a4b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureLoad_6154d4() { + uvec4 res = texelFetch(arg_0_1, ivec2(0), 0); +} + +vec4 vertex_main() { + textureLoad_6154d4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureLoad_6154d4() { + uvec4 res = texelFetch(arg_0_1, ivec2(0), 0); +} + +void fragment_main() { + textureLoad_6154d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureLoad_6154d4() { + uvec4 res = texelFetch(arg_0_1, ivec2(0), 0); +} + +void compute_main() { + textureLoad_6154d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.msl new file mode 100644 index 0000000000..91c75ba039 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_6154d4(texture2d tint_symbol_1) { + uint4 res = tint_symbol_1.read(uint2(int2(0)), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureLoad_6154d4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureLoad_6154d4(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureLoad_6154d4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..ad0a77ad54 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_6154d4 "textureLoad_6154d4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %22 = OpConstantNull %v2int + %23 = OpConstantNull %int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %26 = OpConstantNull %v4uint + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_6154d4 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %26 + %19 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4uint %19 %22 Lod %23 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureLoad_6154d4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureLoad_6154d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_6154d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..9119dcb4c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6154d4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureLoad_6154d4() { + var res : vec4 = textureLoad(arg_0, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6154d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_6154d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_6154d4(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl new file mode 100644 index 0000000000..ccf016c78d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; + +// fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2, sample_index: i32) -> f32 +fn textureLoad_6273b1() { + var res: f32 = textureLoad(arg_0, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6273b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_6273b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_6273b1(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fafcd354be --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_6273b1() { + float res = arg_0.Load(int3(0, 0, 0), 1).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6273b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6273b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6273b1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fafcd354be --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_6273b1() { + float res = arg_0.Load(int3(0, 0, 0), 1).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6273b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6273b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6273b1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.glsl new file mode 100644 index 0000000000..3cfe2778a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_6273b1() { + float res = texelFetch(arg_0_1, ivec2(0), 1).x; +} + +vec4 vertex_main() { + textureLoad_6273b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureLoad_6273b1() { + float res = texelFetch(arg_0_1, ivec2(0), 1).x; +} + +void fragment_main() { + textureLoad_6273b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_6273b1() { + float res = texelFetch(arg_0_1, ivec2(0), 1).x; +} + +void compute_main() { + textureLoad_6273b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.msl new file mode 100644 index 0000000000..e39caca53d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_6273b1(depth2d_ms tint_symbol_1) { + float res = tint_symbol_1.read(uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_ms tint_symbol_2) { + textureLoad_6273b1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_6273b1(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_6273b1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..349248bc9f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/6273b1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; + +fn textureLoad_6273b1() { + var res : f32 = textureLoad(arg_0, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6273b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_6273b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_6273b1(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl new file mode 100644 index 0000000000..82233849ec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 +fn textureLoad_79e697() { + var res: vec4 = textureLoad(arg_0, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_79e697(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_79e697(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_79e697(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b6c192ad72 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_79e697() { + int4 res = arg_0.Load(int4(0, 0, 1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_79e697(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_79e697(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_79e697(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b6c192ad72 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_79e697() { + int4 res = arg_0.Load(int4(0, 0, 1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_79e697(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_79e697(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_79e697(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.glsl new file mode 100644 index 0000000000..df42b60d87 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureLoad_79e697() { + ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); +} + +vec4 vertex_main() { + textureLoad_79e697(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureLoad_79e697() { + ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); +} + +void fragment_main() { + textureLoad_79e697(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureLoad_79e697() { + ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); +} + +void compute_main() { + textureLoad_79e697(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.msl new file mode 100644 index 0000000000..e47beeabf3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_79e697(texture2d_array tint_symbol_1) { + int4 res = tint_symbol_1.read(uint2(int2(0)), 1, 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureLoad_79e697(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_79e697(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_79e697(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.spvasm new file mode 100644 index 0000000000..a49c40cb50 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_79e697 "textureLoad_79e697" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %23 = OpConstantComposite %v3int %int_0 %int_0 %int_1 + %24 = OpConstantNull %int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %27 = OpConstantNull %v4int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_79e697 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %27 + %19 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4int %19 %23 Lod %24 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %textureLoad_79e697 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureLoad_79e697 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_79e697 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.wgsl new file mode 100644 index 0000000000..6274eda85f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/79e697.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureLoad_79e697() { + var res : vec4 = textureLoad(arg_0, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_79e697(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_79e697(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_79e697(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl new file mode 100644 index 0000000000..0e15b564bb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 +fn textureLoad_7c90e5() { + var res: vec4 = textureLoad(arg_0, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_7c90e5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_7c90e5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_7c90e5(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7918f4a98a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_7c90e5() { + uint4 res = arg_0.Load(int4(0, 0, 1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_7c90e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_7c90e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_7c90e5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7918f4a98a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_7c90e5() { + uint4 res = arg_0.Load(int4(0, 0, 1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_7c90e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_7c90e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_7c90e5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.glsl new file mode 100644 index 0000000000..8d765dbc25 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureLoad_7c90e5() { + uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); +} + +vec4 vertex_main() { + textureLoad_7c90e5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureLoad_7c90e5() { + uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); +} + +void fragment_main() { + textureLoad_7c90e5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureLoad_7c90e5() { + uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); +} + +void compute_main() { + textureLoad_7c90e5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.msl new file mode 100644 index 0000000000..ffdc317fb8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_7c90e5(texture2d_array tint_symbol_1) { + uint4 res = tint_symbol_1.read(uint2(int2(0)), 1, 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureLoad_7c90e5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_7c90e5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_7c90e5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c03bfbce6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_7c90e5 "textureLoad_7c90e5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %24 = OpConstantComposite %v3int %int_0 %int_0 %int_1 + %25 = OpConstantNull %int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %28 = OpConstantNull %v4uint + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_7c90e5 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %28 + %19 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4uint %19 %24 Lod %25 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureLoad_7c90e5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureLoad_7c90e5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureLoad_7c90e5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.wgsl new file mode 100644 index 0000000000..e400b6ff27 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/7c90e5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureLoad_7c90e5() { + var res : vec4 = textureLoad(arg_0, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_7c90e5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_7c90e5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_7c90e5(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl new file mode 100644 index 0000000000..cf887f4768 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 +fn textureLoad_81c381() { + var res: vec4 = textureLoad(arg_0, 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_81c381(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_81c381(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_81c381(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b1fecfe99d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_81c381() { + float4 res = arg_0.Load(int2(1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_81c381(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_81c381(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_81c381(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1fecfe99d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_81c381() { + float4 res = arg_0.Load(int2(1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_81c381(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_81c381(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_81c381(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.glsl new file mode 100644 index 0000000000..306366945a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureLoad_81c381() { + vec4 res = texelFetch(arg_0_1, 1, 0); +} + +vec4 vertex_main() { + textureLoad_81c381(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureLoad_81c381() { + vec4 res = texelFetch(arg_0_1, 1, 0); +} + +void fragment_main() { + textureLoad_81c381(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureLoad_81c381() { + vec4 res = texelFetch(arg_0_1, 1, 0); +} + +void compute_main() { + textureLoad_81c381(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.msl new file mode 100644 index 0000000000..29a6d1b32d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_81c381(texture1d tint_symbol_1) { + float4 res = tint_symbol_1.read(uint(1), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureLoad_81c381(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureLoad_81c381(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureLoad_81c381(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.spvasm new file mode 100644 index 0000000000..fc25c50c00 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_81c381 "textureLoad_81c381" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_81c381 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %17 = OpLoad %11 %arg_0 + %16 = OpImageFetch %v4float %17 %int_1 Lod %20 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureLoad_81c381 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureLoad_81c381 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_81c381 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.wgsl new file mode 100644 index 0000000000..34d306b88d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/81c381.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureLoad_81c381() { + var res : vec4 = textureLoad(arg_0, 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_81c381(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_81c381(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_81c381(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl new file mode 100644 index 0000000000..04962090d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 +fn textureLoad_87be85() { + var res: vec4 = textureLoad(arg_0, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_87be85(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_87be85(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_87be85(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..80a5a3550a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_87be85() { + float4 res = arg_0.Load(int4(0, 0, 1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_87be85(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_87be85(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_87be85(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80a5a3550a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_87be85() { + float4 res = arg_0.Load(int4(0, 0, 1, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_87be85(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_87be85(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_87be85(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.glsl new file mode 100644 index 0000000000..336dc27787 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_87be85() { + vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); +} + +vec4 vertex_main() { + textureLoad_87be85(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureLoad_87be85() { + vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); +} + +void fragment_main() { + textureLoad_87be85(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_87be85() { + vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); +} + +void compute_main() { + textureLoad_87be85(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.msl new file mode 100644 index 0000000000..c78f9e92ea --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_87be85(texture2d_array tint_symbol_1) { + float4 res = tint_symbol_1.read(uint2(int2(0)), 1, 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureLoad_87be85(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_87be85(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_87be85(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed87e170fe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_87be85 "textureLoad_87be85" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %22 = OpConstantComposite %v3int %int_0 %int_0 %int_1 + %23 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_87be85 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %17 = OpLoad %11 %arg_0 + %16 = OpImageFetch %v4float %17 %22 Lod %23 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureLoad_87be85 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_87be85 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureLoad_87be85 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5a1096713 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/87be85.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureLoad_87be85() { + var res : vec4 = textureLoad(arg_0, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_87be85(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_87be85(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_87be85(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl new file mode 100644 index 0000000000..f30b2832ab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_external; + +// fn textureLoad(texture: texture_external, coords: vec2) -> vec4 +fn textureLoad_8acf41() { + var res: vec4 = textureLoad(arg_0, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_8acf41(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_8acf41(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_8acf41(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..33ee4979cd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.dxc.hlsl @@ -0,0 +1,111 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, int2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.Load(int3(coord, 0)).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureLoad_8acf41() { + float4 res = textureLoadExternal(arg_0, ext_tex_plane_1, (0).xx, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_8acf41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_8acf41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_8acf41(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..33ee4979cd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.fxc.hlsl @@ -0,0 +1,111 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, int2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.Load(int3(coord, 0)).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureLoad_8acf41() { + float4 res = textureLoadExternal(arg_0, ext_tex_plane_1, (0).xx, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_8acf41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_8acf41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_8acf41(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl new file mode 100644 index 0000000000..4305443d10 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl @@ -0,0 +1,234 @@ +SKIP: FAILED + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + +vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_1; +uniform highp sampler2D ext_tex_plane_1_1; +void textureLoad_8acf41() { + vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, ivec2(0), ext_tex_params); +} + +vec4 vertex_main() { + textureLoad_8acf41(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:57: 'textureLoadExternal' : no matching overloaded function found +ERROR: 0:57: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:57: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + +vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_1; +uniform highp sampler2D ext_tex_plane_1_1; +void textureLoad_8acf41() { + vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, ivec2(0), ext_tex_params); +} + +void fragment_main() { + textureLoad_8acf41(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:58: 'textureLoadExternal' : no matching overloaded function found +ERROR: 0:58: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' +ERROR: 0:58: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + +vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_1; +uniform highp sampler2D ext_tex_plane_1_1; +void textureLoad_8acf41() { + vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, ivec2(0), ext_tex_params); +} + +void compute_main() { + textureLoad_8acf41(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:57: 'textureLoadExternal' : no matching overloaded function found +ERROR: 0:57: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:57: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.msl new file mode 100644 index 0000000000..617b8dfe53 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct GammaTransferParams { + /* 0x0000 */ float G; + /* 0x0004 */ float A; + /* 0x0008 */ float B; + /* 0x000c */ float C; + /* 0x0010 */ float D; + /* 0x0014 */ float E; + /* 0x0018 */ float F; + /* 0x001c */ uint padding; +}; + +struct ExternalTextureParams { + /* 0x0000 */ uint numPlanes; + /* 0x0004 */ uint doYuvToRgbConversionOnly; + /* 0x0008 */ tint_array tint_pad; + /* 0x0010 */ float3x4 yuvToRgbConversionMatrix; + /* 0x0040 */ GammaTransferParams gammaDecodeParams; + /* 0x0060 */ GammaTransferParams gammaEncodeParams; + /* 0x0080 */ float3x3 gamutConversionMatrix; +}; + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + bool3 const cond = (fabs(v) < float3(params.D)); + float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F)); + float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E)); + return select(f, t, cond); +} + +float4 textureLoadExternal(texture2d plane0, texture2d plane1, int2 coord, ExternalTextureParams params) { + float3 color = 0.0f; + if ((params.numPlanes == 1u)) { + color = float4(plane0.read(uint2(coord), 0)).rgb; + } else { + color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +void textureLoad_8acf41(texture2d tint_symbol_1, texture2d tint_symbol_2, const constant ExternalTextureParams* const tint_symbol_3) { + float4 res = textureLoadExternal(tint_symbol_1, tint_symbol_2, int2(0), *(tint_symbol_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_4, texture2d tint_symbol_5, const constant ExternalTextureParams* const tint_symbol_6) { + textureLoad_8acf41(tint_symbol_4, tint_symbol_5, tint_symbol_6); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_7 [[texture(0)]], texture2d tint_symbol_8 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_9 [[buffer(2)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_7, tint_symbol_8, tint_symbol_9); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_10 [[texture(0)]], texture2d tint_symbol_11 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) { + textureLoad_8acf41(tint_symbol_10, tint_symbol_11, tint_symbol_12); + return; +} + +kernel void compute_main(texture2d tint_symbol_13 [[texture(0)]], texture2d tint_symbol_14 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_15 [[buffer(2)]]) { + textureLoad_8acf41(tint_symbol_13, tint_symbol_14, tint_symbol_15); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.spvasm new file mode 100644 index 0000000000..01d87629f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.spvasm @@ -0,0 +1,238 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ExternalTextureParams "ExternalTextureParams" + OpMemberName %ExternalTextureParams 0 "numPlanes" + OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly" + OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 3 "gammaDecodeParams" + OpName %GammaTransferParams "GammaTransferParams" + OpMemberName %GammaTransferParams 0 "G" + OpMemberName %GammaTransferParams 1 "A" + OpMemberName %GammaTransferParams 2 "B" + OpMemberName %GammaTransferParams 3 "C" + OpMemberName %GammaTransferParams 4 "D" + OpMemberName %GammaTransferParams 5 "E" + OpMemberName %GammaTransferParams 6 "F" + OpMemberName %GammaTransferParams 7 "padding" + OpMemberName %ExternalTextureParams 4 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix" + OpName %ext_tex_params "ext_tex_params" + OpName %arg_0 "arg_0" + OpName %gammaCorrection "gammaCorrection" + OpName %v "v" + OpName %params "params" + OpName %textureLoadExternal "textureLoadExternal" + OpName %plane0 "plane0" + OpName %plane1 "plane1" + OpName %coord "coord" + OpName %params_0 "params" + OpName %color "color" + OpName %textureLoad_8acf41 "textureLoad_8acf41" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %ext_tex_plane_1 DescriptorSet 1 + OpDecorate %ext_tex_plane_1 Binding 1 + OpDecorate %ExternalTextureParams Block + OpMemberDecorate %ExternalTextureParams 0 Offset 0 + OpMemberDecorate %ExternalTextureParams 1 Offset 4 + OpMemberDecorate %ExternalTextureParams 2 Offset 16 + OpMemberDecorate %ExternalTextureParams 2 ColMajor + OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 3 Offset 64 + OpMemberDecorate %GammaTransferParams 0 Offset 0 + OpMemberDecorate %GammaTransferParams 1 Offset 4 + OpMemberDecorate %GammaTransferParams 2 Offset 8 + OpMemberDecorate %GammaTransferParams 3 Offset 12 + OpMemberDecorate %GammaTransferParams 4 Offset 16 + OpMemberDecorate %GammaTransferParams 5 Offset 20 + OpMemberDecorate %GammaTransferParams 6 Offset 24 + OpMemberDecorate %GammaTransferParams 7 Offset 28 + OpMemberDecorate %ExternalTextureParams 4 Offset 96 + OpMemberDecorate %ExternalTextureParams 5 Offset 128 + OpMemberDecorate %ExternalTextureParams 5 ColMajor + OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16 + OpDecorate %ext_tex_params NonWritable + OpDecorate %ext_tex_params DescriptorSet 1 + OpDecorate %ext_tex_params Binding 2 + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 +%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 +%mat3v4float = OpTypeMatrix %v4float 3 +%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams +%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %21 = OpTypeFunction %v3float %v3float %GammaTransferParams + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %41 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %61 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams + %uint_1 = OpConstant %uint 1 + %78 = OpConstantNull %int + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %92 = OpConstantNull %uint + %void = OpTypeVoid + %110 = OpTypeFunction %void + %117 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %121 = OpTypeFunction %v4float +%gammaCorrection = OpFunction %v3float None %21 + %v = OpFunctionParameter %v3float + %params = OpFunctionParameter %GammaTransferParams + %25 = OpLabel + %39 = OpVariable %_ptr_Function_v3float Function %41 + %51 = OpVariable %_ptr_Function_v3float Function %41 + %57 = OpVariable %_ptr_Function_v3float Function %41 + %26 = OpExtInst %v3float %27 FAbs %v + %28 = OpCompositeExtract %float %params 4 + %29 = OpCompositeConstruct %v3float %28 %28 %28 + %30 = OpFOrdLessThan %v3bool %26 %29 + %33 = OpExtInst %v3float %27 FSign %v + %34 = OpCompositeExtract %float %params 3 + %35 = OpExtInst %v3float %27 FAbs %v + %36 = OpVectorTimesScalar %v3float %35 %34 + %37 = OpCompositeExtract %float %params 6 + %42 = OpCompositeConstruct %v3float %37 %37 %37 + %38 = OpFAdd %v3float %36 %42 + %43 = OpFMul %v3float %33 %38 + %44 = OpExtInst %v3float %27 FSign %v + %46 = OpCompositeExtract %float %params 1 + %47 = OpExtInst %v3float %27 FAbs %v + %48 = OpVectorTimesScalar %v3float %47 %46 + %49 = OpCompositeExtract %float %params 2 + %52 = OpCompositeConstruct %v3float %49 %49 %49 + %50 = OpFAdd %v3float %48 %52 + %53 = OpCompositeExtract %float %params 0 + %54 = OpCompositeConstruct %v3float %53 %53 %53 + %45 = OpExtInst %v3float %27 Pow %50 %54 + %55 = OpCompositeExtract %float %params 5 + %58 = OpCompositeConstruct %v3float %55 %55 %55 + %56 = OpFAdd %v3float %45 %58 + %59 = OpFMul %v3float %44 %56 + %60 = OpSelect %v3float %30 %43 %59 + OpReturnValue %60 + OpFunctionEnd +%textureLoadExternal = OpFunction %v4float None %61 + %plane0 = OpFunctionParameter %11 + %plane1 = OpFunctionParameter %11 + %coord = OpFunctionParameter %v2int + %params_0 = OpFunctionParameter %ExternalTextureParams + %69 = OpLabel + %color = OpVariable %_ptr_Function_v3float Function %41 + %71 = OpCompositeExtract %uint %params_0 0 + %73 = OpIEqual %bool %71 %uint_1 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpImageFetch %v4float %plane0 %coord Lod %78 + %79 = OpVectorShuffle %v3float %77 %77 0 1 2 + OpStore %color %79 + OpBranch %74 + %76 = OpLabel + %80 = OpImageFetch %v4float %plane0 %coord Lod %78 + %81 = OpCompositeExtract %float %80 0 + %82 = OpImageFetch %v4float %plane1 %coord Lod %78 + %84 = OpVectorShuffle %v2float %82 %82 0 1 + %85 = OpCompositeExtract %float %84 0 + %86 = OpCompositeExtract %float %84 1 + %88 = OpCompositeConstruct %v4float %81 %85 %86 %float_1 + %89 = OpCompositeExtract %mat3v4float %params_0 2 + %90 = OpVectorTimesMatrix %v3float %88 %89 + OpStore %color %90 + OpBranch %74 + %74 = OpLabel + %91 = OpCompositeExtract %uint %params_0 1 + %93 = OpIEqual %bool %91 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + %97 = OpLoad %v3float %color + %98 = OpCompositeExtract %GammaTransferParams %params_0 3 + %96 = OpFunctionCall %v3float %gammaCorrection %97 %98 + OpStore %color %96 + %99 = OpCompositeExtract %mat3v3float %params_0 5 + %100 = OpLoad %v3float %color + %101 = OpMatrixTimesVector %v3float %99 %100 + OpStore %color %101 + %103 = OpLoad %v3float %color + %104 = OpCompositeExtract %GammaTransferParams %params_0 4 + %102 = OpFunctionCall %v3float %gammaCorrection %103 %104 + OpStore %color %102 + OpBranch %94 + %94 = OpLabel + %105 = OpLoad %v3float %color + %106 = OpCompositeExtract %float %105 0 + %107 = OpCompositeExtract %float %105 1 + %108 = OpCompositeExtract %float %105 2 + %109 = OpCompositeConstruct %v4float %106 %107 %108 %float_1 + OpReturnValue %109 + OpFunctionEnd +%textureLoad_8acf41 = OpFunction %void None %110 + %113 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %115 = OpLoad %11 %arg_0 + %116 = OpLoad %11 %ext_tex_plane_1 + %118 = OpLoad %ExternalTextureParams %ext_tex_params + %114 = OpFunctionCall %v4float %textureLoadExternal %115 %116 %117 %118 + OpStore %res %114 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %121 + %123 = OpLabel + %124 = OpFunctionCall %void %textureLoad_8acf41 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %110 + %126 = OpLabel + %127 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %127 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %110 + %129 = OpLabel + %130 = OpFunctionCall %void %textureLoad_8acf41 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %110 + %132 = OpLabel + %133 = OpFunctionCall %void %textureLoad_8acf41 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.wgsl new file mode 100644 index 0000000000..9539b700e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_external; + +fn textureLoad_8acf41() { + var res : vec4 = textureLoad(arg_0, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_8acf41(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_8acf41(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_8acf41(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl new file mode 100644 index 0000000000..f796ea7d0f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureLoad(texture: texture_depth_2d_array, coords: vec2, array_index: i32, level: i32) -> f32 +fn textureLoad_9b2667() { + var res: f32 = textureLoad(arg_0, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_9b2667(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_9b2667(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_9b2667(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9403dcc97 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_9b2667() { + float res = arg_0.Load(int4(0, 0, 1, 0)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_9b2667(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_9b2667(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_9b2667(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f9403dcc97 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_9b2667() { + float res = arg_0.Load(int4(0, 0, 1, 0)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_9b2667(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_9b2667(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_9b2667(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.glsl new file mode 100644 index 0000000000..9b04e7bd78 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_9b2667() { + float res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0).x; +} + +vec4 vertex_main() { + textureLoad_9b2667(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureLoad_9b2667() { + float res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0).x; +} + +void fragment_main() { + textureLoad_9b2667(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_9b2667() { + float res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0).x; +} + +void compute_main() { + textureLoad_9b2667(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.msl new file mode 100644 index 0000000000..98b0410f6d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_9b2667(depth2d_array tint_symbol_1) { + float res = tint_symbol_1.read(uint2(int2(0)), 1, 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureLoad_9b2667(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_9b2667(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_9b2667(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.spvasm new file mode 100644 index 0000000000..50cf52d3a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_9b2667 "textureLoad_9b2667" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %23 = OpConstantComposite %v3int %int_0 %int_0 %int_1 + %24 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_9b2667 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %18 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4float %18 %23 Lod %24 + %16 = OpCompositeExtract %float %17 0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureLoad_9b2667 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureLoad_9b2667 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_9b2667 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cf30ade8f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/9b2667.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureLoad_9b2667() { + var res : f32 = textureLoad(arg_0, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_9b2667(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_9b2667(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_9b2667(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl new file mode 100644 index 0000000000..72149aaf8b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 +fn textureLoad_a583c9() { + var res: vec4 = textureLoad(arg_0, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a583c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_a583c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_a583c9(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e7bcc429b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_a583c9() { + float4 res = arg_0.Load((0).xx, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a583c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a583c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a583c9(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e7bcc429b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_a583c9() { + float4 res = arg_0.Load((0).xx, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a583c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a583c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a583c9(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.glsl new file mode 100644 index 0000000000..af89b5f293 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_a583c9() { + vec4 res = texelFetch(arg_0_1, ivec2(0), 1); +} + +vec4 vertex_main() { + textureLoad_a583c9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureLoad_a583c9() { + vec4 res = texelFetch(arg_0_1, ivec2(0), 1); +} + +void fragment_main() { + textureLoad_a583c9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_a583c9() { + vec4 res = texelFetch(arg_0_1, ivec2(0), 1); +} + +void compute_main() { + textureLoad_a583c9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.msl new file mode 100644 index 0000000000..7bcc2d6b2a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_a583c9(texture2d_ms tint_symbol_1) { + float4 res = tint_symbol_1.read(uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureLoad_a583c9(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_a583c9(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_a583c9(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0a3f71fa7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a583c9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureLoad_a583c9() { + var res : vec4 = textureLoad(arg_0, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a583c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_a583c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_a583c9(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl new file mode 100644 index 0000000000..9d2051aa95 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 +fn textureLoad_a9a9f5() { + var res: vec4 = textureLoad(arg_0, vec3(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a9a9f5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_a9a9f5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_a9a9f5(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..98f0d55943 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_a9a9f5() { + uint4 res = arg_0.Load(int4(0, 0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a9a9f5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a9a9f5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a9a9f5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..98f0d55943 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_a9a9f5() { + uint4 res = arg_0.Load(int4(0, 0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a9a9f5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a9a9f5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a9a9f5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.glsl new file mode 100644 index 0000000000..e01c452f45 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureLoad_a9a9f5() { + uvec4 res = texelFetch(arg_0_1, ivec3(0), 0); +} + +vec4 vertex_main() { + textureLoad_a9a9f5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureLoad_a9a9f5() { + uvec4 res = texelFetch(arg_0_1, ivec3(0), 0); +} + +void fragment_main() { + textureLoad_a9a9f5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureLoad_a9a9f5() { + uvec4 res = texelFetch(arg_0_1, ivec3(0), 0); +} + +void compute_main() { + textureLoad_a9a9f5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.msl new file mode 100644 index 0000000000..8610f77ef7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_a9a9f5(texture3d tint_symbol_1) { + uint4 res = tint_symbol_1.read(uint3(int3(0)), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureLoad_a9a9f5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureLoad_a9a9f5(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureLoad_a9a9f5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.spvasm new file mode 100644 index 0000000000..525affc692 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_a9a9f5 "textureLoad_a9a9f5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %22 = OpConstantNull %v3int + %23 = OpConstantNull %int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %26 = OpConstantNull %v4uint + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_a9a9f5 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v4uint Function %26 + %19 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4uint %19 %22 Lod %23 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureLoad_a9a9f5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureLoad_a9a9f5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_a9a9f5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fd66d1d1a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/a9a9f5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureLoad_a9a9f5() { + var res : vec4 = textureLoad(arg_0, vec3(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a9a9f5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_a9a9f5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_a9a9f5(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl new file mode 100644 index 0000000000..89f926f0fd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 +fn textureLoad_c2a480() { + var res: vec4 = textureLoad(arg_0, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c2a480(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_c2a480(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_c2a480(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64fa5c2d26 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_c2a480() { + int4 res = arg_0.Load(int3(0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c2a480(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c2a480(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c2a480(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64fa5c2d26 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_c2a480() { + int4 res = arg_0.Load(int3(0, 0, 0)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c2a480(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c2a480(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c2a480(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.glsl new file mode 100644 index 0000000000..a7b5264faf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureLoad_c2a480() { + ivec4 res = texelFetch(arg_0_1, ivec2(0), 0); +} + +vec4 vertex_main() { + textureLoad_c2a480(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureLoad_c2a480() { + ivec4 res = texelFetch(arg_0_1, ivec2(0), 0); +} + +void fragment_main() { + textureLoad_c2a480(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureLoad_c2a480() { + ivec4 res = texelFetch(arg_0_1, ivec2(0), 0); +} + +void compute_main() { + textureLoad_c2a480(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.msl new file mode 100644 index 0000000000..d566ce6e7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_c2a480(texture2d tint_symbol_1) { + int4 res = tint_symbol_1.read(uint2(int2(0)), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureLoad_c2a480(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureLoad_c2a480(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureLoad_c2a480(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f506a5367 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_c2a480 "textureLoad_c2a480" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %v2int = OpTypeVector %int 2 + %21 = OpConstantNull %v2int + %22 = OpConstantNull %int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %25 = OpConstantNull %v4int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_c2a480 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %25 + %19 = OpLoad %11 %arg_0 + %17 = OpImageFetch %v4int %19 %21 Lod %22 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureLoad_c2a480 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_c2a480 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureLoad_c2a480 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.wgsl new file mode 100644 index 0000000000..21cd36783a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c2a480.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureLoad_c2a480() { + var res : vec4 = textureLoad(arg_0, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c2a480(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_c2a480(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_c2a480(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl new file mode 100644 index 0000000000..a7911def41 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 +fn textureLoad_c378ee() { + var res: vec4 = textureLoad(arg_0, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c378ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_c378ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_c378ee(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc7d1b6b7b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_c378ee() { + uint4 res = arg_0.Load((0).xx, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c378ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c378ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c378ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fc7d1b6b7b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_c378ee() { + uint4 res = arg_0.Load((0).xx, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c378ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c378ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c378ee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.glsl new file mode 100644 index 0000000000..cdb2ca09bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureLoad_c378ee() { + uvec4 res = texelFetch(arg_0_1, ivec2(0), 1); +} + +vec4 vertex_main() { + textureLoad_c378ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DMS arg_0_1; +void textureLoad_c378ee() { + uvec4 res = texelFetch(arg_0_1, ivec2(0), 1); +} + +void fragment_main() { + textureLoad_c378ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureLoad_c378ee() { + uvec4 res = texelFetch(arg_0_1, ivec2(0), 1); +} + +void compute_main() { + textureLoad_c378ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.msl new file mode 100644 index 0000000000..efdc2c2b22 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_c378ee(texture2d_ms tint_symbol_1) { + uint4 res = tint_symbol_1.read(uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureLoad_c378ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_c378ee(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_c378ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..1620def4ae --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/c378ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureLoad_c378ee() { + var res : vec4 = textureLoad(arg_0, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c378ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_c378ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_c378ee(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl new file mode 100644 index 0000000000..e7dc36cafc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 +fn textureLoad_e3d2cc() { + var res: vec4 = textureLoad(arg_0, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_e3d2cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_e3d2cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_e3d2cc(); +} diff --git a/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6d097d4597 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_e3d2cc() { + int4 res = arg_0.Load((0).xx, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_e3d2cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_e3d2cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_e3d2cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6d097d4597 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_e3d2cc() { + int4 res = arg_0.Load((0).xx, 1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_e3d2cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_e3d2cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_e3d2cc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.glsl new file mode 100644 index 0000000000..7dc1ade680 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureLoad_e3d2cc() { + ivec4 res = texelFetch(arg_0_1, ivec2(0), 1); +} + +vec4 vertex_main() { + textureLoad_e3d2cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DMS arg_0_1; +void textureLoad_e3d2cc() { + ivec4 res = texelFetch(arg_0_1, ivec2(0), 1); +} + +void fragment_main() { + textureLoad_e3d2cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureLoad_e3d2cc() { + ivec4 res = texelFetch(arg_0_1, ivec2(0), 1); +} + +void compute_main() { + textureLoad_e3d2cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.msl new file mode 100644 index 0000000000..024057e13d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureLoad_e3d2cc(texture2d_ms tint_symbol_1) { + int4 res = tint_symbol_1.read(uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureLoad_e3d2cc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_e3d2cc(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_e3d2cc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..8355ef2dcb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureLoad/e3d2cc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureLoad_e3d2cc() { + var res : vec4 = textureLoad(arg_0, vec2(), 1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_e3d2cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_e3d2cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_e3d2cc(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl new file mode 100644 index 0000000000..2abd10d2c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLayers(texture: texture_2d_array) -> i32 +fn textureNumLayers_024820() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_024820(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_024820(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_024820(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c54de32f98 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_024820() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_024820(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_024820(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_024820(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c54de32f98 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_024820() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_024820(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_024820(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_024820(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.glsl new file mode 100644 index 0000000000..9e3639f215 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_024820() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_024820(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_024820() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_024820(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_024820() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_024820(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.msl new file mode 100644 index 0000000000..62c3cdabae --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_024820(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_024820(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_024820(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_024820(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.wgsl new file mode 100644 index 0000000000..eaa9cc7883 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/024820.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLayers_024820() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_024820(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_024820(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_024820(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl new file mode 100644 index 0000000000..e4ee7aa5ff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLayers(texture: texture_cube_array) -> i32 +fn textureNumLayers_053df7() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_053df7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_053df7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_053df7(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ec0865280f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_053df7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_053df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_053df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_053df7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec0865280f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_053df7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_053df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_053df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_053df7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.glsl new file mode 100644 index 0000000000..e995abb9b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLayers_053df7() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_053df7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLayers_053df7() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_053df7(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLayers_053df7() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_053df7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.msl new file mode 100644 index 0000000000..68ceeb46a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_053df7(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLayers_053df7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_053df7(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_053df7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.wgsl new file mode 100644 index 0000000000..06592acc08 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/053df7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLayers_053df7() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_053df7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_053df7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_053df7(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl new file mode 100644 index 0000000000..205475f818 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_058cc3() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_058cc3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_058cc3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_058cc3(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f9f61ae48 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_058cc3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_058cc3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_058cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_058cc3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f9f61ae48 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_058cc3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_058cc3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_058cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_058cc3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.glsl new file mode 100644 index 0000000000..0730d3a356 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_058cc3() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_058cc3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_058cc3() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_058cc3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_058cc3() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_058cc3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.msl new file mode 100644 index 0000000000..f89aa0051f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_058cc3(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_058cc3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_058cc3(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_058cc3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.wgsl new file mode 100644 index 0000000000..a39583bf6a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/058cc3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_058cc3() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_058cc3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_058cc3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_058cc3(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl new file mode 100644 index 0000000000..58e1dba6dc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_09d05d() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_09d05d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_09d05d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_09d05d(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c52cd47ecc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_09d05d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_09d05d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_09d05d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_09d05d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c52cd47ecc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_09d05d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_09d05d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_09d05d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_09d05d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.glsl new file mode 100644 index 0000000000..25b7ded5ea --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_09d05d() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_09d05d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_09d05d() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_09d05d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_09d05d() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_09d05d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.msl new file mode 100644 index 0000000000..6666c52d32 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_09d05d(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_09d05d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_09d05d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_09d05d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.wgsl new file mode 100644 index 0000000000..cede280a55 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/09d05d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_09d05d() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_09d05d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_09d05d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_09d05d(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl new file mode 100644 index 0000000000..c67abfb40a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_13b4ce() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_13b4ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_13b4ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_13b4ce(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d9ac8afb4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_13b4ce() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_13b4ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_13b4ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_13b4ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d9ac8afb4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_13b4ce() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_13b4ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_13b4ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_13b4ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.glsl new file mode 100644 index 0000000000..f09006795c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_13b4ce() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_13b4ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_13b4ce() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_13b4ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_13b4ce() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_13b4ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.msl new file mode 100644 index 0000000000..bb33ae6c61 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_13b4ce(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_13b4ce(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_13b4ce(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_13b4ce(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..15c0d550e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/13b4ce.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_13b4ce() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_13b4ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_13b4ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_13b4ce(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl new file mode 100644 index 0000000000..97c27dffa5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_22e53b() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_22e53b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_22e53b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_22e53b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8611a5211c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_22e53b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_22e53b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_22e53b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_22e53b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8611a5211c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_22e53b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_22e53b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_22e53b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_22e53b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.glsl new file mode 100644 index 0000000000..3902bb39d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_22e53b() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_22e53b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_22e53b() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_22e53b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_22e53b() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_22e53b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.msl new file mode 100644 index 0000000000..5c5fa33da1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_22e53b(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_22e53b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_22e53b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_22e53b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ac305721e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/22e53b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_22e53b() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_22e53b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_22e53b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_22e53b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl new file mode 100644 index 0000000000..740fc823f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_562013() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_562013(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_562013(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_562013(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..59664cc21b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_562013() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_562013(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_562013(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_562013(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..59664cc21b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_562013() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_562013(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_562013(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_562013(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.glsl new file mode 100644 index 0000000000..713a325a69 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_562013() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_562013(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_562013() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_562013(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_562013() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_562013(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.msl new file mode 100644 index 0000000000..97a5498d1b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_562013(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_562013(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_562013(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_562013(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.wgsl new file mode 100644 index 0000000000..c82f593d00 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/562013.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_562013() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_562013(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_562013(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_562013(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl new file mode 100644 index 0000000000..538aee466f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLayers(texture: texture_cube_array) -> i32 +fn textureNumLayers_5d59cd() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_5d59cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_5d59cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_5d59cd(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..063ac3bee8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_5d59cd() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_5d59cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_5d59cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_5d59cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..063ac3bee8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_5d59cd() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_5d59cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_5d59cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_5d59cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.glsl new file mode 100644 index 0000000000..c469183479 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_5d59cd() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_5d59cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_5d59cd() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_5d59cd(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_5d59cd() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_5d59cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.msl new file mode 100644 index 0000000000..aa7890e4f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_5d59cd(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLayers_5d59cd(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_5d59cd(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_5d59cd(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..28bcd65030 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/5d59cd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLayers_5d59cd() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_5d59cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_5d59cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_5d59cd(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl new file mode 100644 index 0000000000..e7c4f20427 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_68a65b() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_68a65b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_68a65b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_68a65b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cefd82036d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_68a65b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_68a65b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_68a65b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_68a65b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cefd82036d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_68a65b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_68a65b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_68a65b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_68a65b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.glsl new file mode 100644 index 0000000000..38cd9e7208 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_68a65b() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_68a65b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_68a65b() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_68a65b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_68a65b() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_68a65b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.msl new file mode 100644 index 0000000000..906ffc528e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_68a65b(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_68a65b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_68a65b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_68a65b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7cfa50e58 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/68a65b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_68a65b() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_68a65b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_68a65b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_68a65b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl new file mode 100644 index 0000000000..06508d7b2a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureNumLayers(texture: texture_depth_cube_array) -> i32 +fn textureNumLayers_778bd1() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_778bd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_778bd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_778bd1(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..198c36ba40 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_778bd1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_778bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_778bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_778bd1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..198c36ba40 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_778bd1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_778bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_778bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_778bd1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.glsl new file mode 100644 index 0000000000..40debcc79c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_778bd1() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_778bd1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_778bd1() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_778bd1(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_778bd1() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_778bd1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.msl new file mode 100644 index 0000000000..fc13fba684 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_778bd1(depthcube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureNumLayers_778bd1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_778bd1(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_778bd1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.wgsl new file mode 100644 index 0000000000..8274e1e0dc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/778bd1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureNumLayers_778bd1() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_778bd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_778bd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_778bd1(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl new file mode 100644 index 0000000000..cf29588b21 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_7f1937() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_7f1937(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_7f1937(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_7f1937(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..edd423aea6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_7f1937() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_7f1937(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_7f1937(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_7f1937(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..edd423aea6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_7f1937() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_7f1937(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_7f1937(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_7f1937(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.glsl new file mode 100644 index 0000000000..f6fdbf0fce --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_7f1937() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_7f1937(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_7f1937() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_7f1937(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_7f1937() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_7f1937(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.msl new file mode 100644 index 0000000000..05239dae46 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_7f1937(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_7f1937(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_7f1937(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_7f1937(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.wgsl new file mode 100644 index 0000000000..27ba4129d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/7f1937.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_7f1937() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_7f1937(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_7f1937(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_7f1937(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl new file mode 100644 index 0000000000..38bb36ed9b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLayers(texture: texture_cube_array) -> i32 +fn textureNumLayers_85f980() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_85f980(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_85f980(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_85f980(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bd6cdc4517 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_85f980() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_85f980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_85f980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_85f980(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bd6cdc4517 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_85f980() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_85f980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_85f980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_85f980(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.glsl new file mode 100644 index 0000000000..529bfb372b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLayers_85f980() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_85f980(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLayers_85f980() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_85f980(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLayers_85f980() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_85f980(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.msl new file mode 100644 index 0000000000..e1b10ebfdc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_85f980(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLayers_85f980(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_85f980(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_85f980(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.wgsl new file mode 100644 index 0000000000..5206f514f2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/85f980.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLayers_85f980() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_85f980(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_85f980(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_85f980(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl new file mode 100644 index 0000000000..b982487d6f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLayers(texture: texture_2d_array) -> i32 +fn textureNumLayers_87953e() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_87953e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_87953e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_87953e(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5c563c486d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_87953e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_87953e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_87953e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_87953e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5c563c486d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_87953e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_87953e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_87953e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_87953e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.glsl new file mode 100644 index 0000000000..83bae633ce --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLayers_87953e() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_87953e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureNumLayers_87953e() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_87953e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLayers_87953e() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_87953e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.msl new file mode 100644 index 0000000000..971482f10b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_87953e(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_87953e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_87953e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_87953e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.wgsl new file mode 100644 index 0000000000..55d0f9de7c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/87953e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLayers_87953e() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_87953e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_87953e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_87953e(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl new file mode 100644 index 0000000000..533a86f261 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLayers(texture: texture_2d_array) -> i32 +fn textureNumLayers_893e7c() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_893e7c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_893e7c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_893e7c(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0991385af2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_893e7c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_893e7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_893e7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_893e7c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0991385af2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_893e7c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_893e7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_893e7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_893e7c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.glsl new file mode 100644 index 0000000000..e2d0eb6a5d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLayers_893e7c() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_893e7c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureNumLayers_893e7c() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_893e7c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLayers_893e7c() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_893e7c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.msl new file mode 100644 index 0000000000..66d329d6ed --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_893e7c(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_893e7c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_893e7c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_893e7c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ef46100e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/893e7c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLayers_893e7c() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_893e7c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_893e7c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_893e7c(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl new file mode 100644 index 0000000000..442d50bad3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_9700fb() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_9700fb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_9700fb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_9700fb(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..63205b7d81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_9700fb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_9700fb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_9700fb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_9700fb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63205b7d81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_9700fb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_9700fb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_9700fb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_9700fb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.glsl new file mode 100644 index 0000000000..24b2d5dcdf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_9700fb() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_9700fb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_9700fb() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_9700fb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_9700fb() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_9700fb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.msl new file mode 100644 index 0000000000..1b296c7c8d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_9700fb(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_9700fb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_9700fb(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_9700fb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.wgsl new file mode 100644 index 0000000000..d260e369f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/9700fb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_9700fb() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_9700fb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_9700fb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_9700fb(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl new file mode 100644 index 0000000000..634b16def7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_a216d2() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_a216d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_a216d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_a216d2(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d9cf5006ba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_a216d2() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_a216d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_a216d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_a216d2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d9cf5006ba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_a216d2() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_a216d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_a216d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_a216d2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.glsl new file mode 100644 index 0000000000..a6deec3075 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_a216d2() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_a216d2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_a216d2() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_a216d2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_a216d2() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_a216d2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.msl new file mode 100644 index 0000000000..427fe4f144 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_a216d2(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_a216d2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_a216d2(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_a216d2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef09e0ba34 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/a216d2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_a216d2() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_a216d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_a216d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_a216d2(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl new file mode 100644 index 0000000000..b58bc746a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_cd5dc8() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_cd5dc8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_cd5dc8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_cd5dc8(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ca5a80c50a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_cd5dc8() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_cd5dc8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_cd5dc8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_cd5dc8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ca5a80c50a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_cd5dc8() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_cd5dc8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_cd5dc8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_cd5dc8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.glsl new file mode 100644 index 0000000000..95fdcf49d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_cd5dc8() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_cd5dc8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_cd5dc8() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_cd5dc8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_cd5dc8() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_cd5dc8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.msl new file mode 100644 index 0000000000..bff98ca56c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_cd5dc8(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_cd5dc8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_cd5dc8(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_cd5dc8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.wgsl new file mode 100644 index 0000000000..7fa1228ac1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/cd5dc8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_cd5dc8() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_cd5dc8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_cd5dc8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_cd5dc8(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl new file mode 100644 index 0000000000..91ac33b9b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_d5b228() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_d5b228(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_d5b228(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_d5b228(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a8c82b0521 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_d5b228() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_d5b228(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_d5b228(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_d5b228(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a8c82b0521 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_d5b228() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_d5b228(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_d5b228(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_d5b228(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.glsl new file mode 100644 index 0000000000..0daa0a3ab4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_d5b228() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_d5b228(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_d5b228() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_d5b228(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_d5b228() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_d5b228(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.msl new file mode 100644 index 0000000000..d2a101171b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_d5b228(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_d5b228(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_d5b228(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_d5b228(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.wgsl new file mode 100644 index 0000000000..9cf3683b7b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/d5b228.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_d5b228() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_d5b228(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_d5b228(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_d5b228(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl new file mode 100644 index 0000000000..5de9836309 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_e31be1() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e31be1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_e31be1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_e31be1(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6aca3c5454 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_e31be1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e31be1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e31be1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e31be1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6aca3c5454 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_e31be1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e31be1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e31be1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e31be1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.glsl new file mode 100644 index 0000000000..e5e4797207 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_e31be1() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_e31be1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_e31be1() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_e31be1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_e31be1() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_e31be1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.msl new file mode 100644 index 0000000000..3b5b47f31f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_e31be1(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_e31be1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_e31be1(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_e31be1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c93038431e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e31be1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_e31be1() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e31be1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_e31be1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_e31be1(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl new file mode 100644 index 0000000000..c4a290d932 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureNumLayers(texture: texture_depth_2d_array) -> i32 +fn textureNumLayers_e653c0() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e653c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_e653c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_e653c0(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..07d21c43e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_e653c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e653c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e653c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e653c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..07d21c43e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_e653c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e653c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e653c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e653c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.glsl new file mode 100644 index 0000000000..c622a34e56 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_e653c0() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_e653c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_e653c0() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_e653c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_e653c0() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_e653c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.msl new file mode 100644 index 0000000000..ade75dde6a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_e653c0(depth2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureNumLayers_e653c0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_e653c0(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_e653c0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..601ce1f3f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/e653c0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureNumLayers_e653c0() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e653c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_e653c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_e653c0(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl new file mode 100644 index 0000000000..f47b3a231d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_ee942f() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ee942f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_ee942f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_ee942f(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b49235b30 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ee942f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ee942f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ee942f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ee942f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b49235b30 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ee942f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ee942f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ee942f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ee942f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.glsl new file mode 100644 index 0000000000..f5996d30a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ee942f() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_ee942f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ee942f() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_ee942f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ee942f() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_ee942f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.msl new file mode 100644 index 0000000000..d8f0821835 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_ee942f(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_ee942f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_ee942f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_ee942f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6d26dd47e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ee942f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_ee942f() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ee942f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_ee942f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_ee942f(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl new file mode 100644 index 0000000000..97533d2198 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_f33005() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_f33005(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_f33005(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_f33005(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4f341b1db5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_f33005() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_f33005(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_f33005(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_f33005(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f341b1db5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_f33005() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_f33005(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_f33005(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_f33005(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.glsl new file mode 100644 index 0000000000..541d0295a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_f33005() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_f33005(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_f33005() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_f33005(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_f33005() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_f33005(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.msl new file mode 100644 index 0000000000..d4153049f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_f33005(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_f33005(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_f33005(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_f33005(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d7eee496d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/f33005.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_f33005() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_f33005(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_f33005(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_f33005(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl new file mode 100644 index 0000000000..eafec6dea5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_fcec98() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_fcec98(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_fcec98(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_fcec98(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ded29d872 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_fcec98() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_fcec98(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_fcec98(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_fcec98(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ded29d872 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_fcec98() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_fcec98(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_fcec98(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_fcec98(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.glsl new file mode 100644 index 0000000000..bfaa76f926 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_fcec98() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_fcec98(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_fcec98() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_fcec98(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_fcec98() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_fcec98(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.msl new file mode 100644 index 0000000000..62335743da --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_fcec98(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_fcec98(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_fcec98(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_fcec98(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.wgsl new file mode 100644 index 0000000000..1c1e1794f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/fcec98.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_fcec98() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_fcec98(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_fcec98(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_fcec98(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl new file mode 100644 index 0000000000..1c1466569e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_ff5e89() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ff5e89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_ff5e89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_ff5e89(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ff6d2cbd5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ff5e89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ff5e89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ff5e89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ff5e89(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ff6d2cbd5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ff5e89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ff5e89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ff5e89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ff5e89(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.glsl new file mode 100644 index 0000000000..76ca5cc24c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ff5e89() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_ff5e89(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ff5e89() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_ff5e89(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ff5e89() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_ff5e89(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.msl new file mode 100644 index 0000000000..2fb050961d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_ff5e89(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_ff5e89(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_ff5e89(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_ff5e89(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7b51b4b46 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLayers/ff5e89.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_ff5e89() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ff5e89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_ff5e89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_ff5e89(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl new file mode 100644 index 0000000000..adec74f718 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; + +// fn textureNumLevels(texture: texture_depth_cube) -> i32 +fn textureNumLevels_076cb5() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_076cb5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_076cb5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_076cb5(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7688db98ff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_076cb5() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_076cb5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_076cb5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_076cb5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7688db98ff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_076cb5() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_076cb5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_076cb5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_076cb5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.glsl new file mode 100644 index 0000000000..6b93674f9d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_076cb5() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_076cb5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureNumLevels_076cb5() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_076cb5(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_076cb5() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_076cb5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.msl new file mode 100644 index 0000000000..db09bf4245 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_076cb5(depthcube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_2) { + textureNumLevels_076cb5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_076cb5(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_076cb5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.wgsl new file mode 100644 index 0000000000..0470c75a13 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/076cb5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +fn textureNumLevels_076cb5() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_076cb5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_076cb5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_076cb5(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl new file mode 100644 index 0000000000..8ef73a7441 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureNumLevels(texture: texture_cube) -> i32 +fn textureNumLevels_080d95() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_080d95(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_080d95(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_080d95(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..633e7beb77 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_080d95() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_080d95(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_080d95(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_080d95(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..633e7beb77 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_080d95() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_080d95(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_080d95(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_080d95(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.glsl new file mode 100644 index 0000000000..367bb7a01b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureNumLevels_080d95() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_080d95(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_0_1; +void textureNumLevels_080d95() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_080d95(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureNumLevels_080d95() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_080d95(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.msl new file mode 100644 index 0000000000..c592ea2124 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_080d95(texturecube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureNumLevels_080d95(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_080d95(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_080d95(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6f058f938 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/080d95.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureNumLevels_080d95() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_080d95(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_080d95(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_080d95(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl new file mode 100644 index 0000000000..f9f4d80135 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureNumLevels(texture: texture_2d) -> i32 +fn textureNumLevels_09ddd0() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_09ddd0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_09ddd0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_09ddd0(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fa2c6733dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_09ddd0() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_09ddd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_09ddd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_09ddd0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa2c6733dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_09ddd0() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_09ddd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_09ddd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_09ddd0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.glsl new file mode 100644 index 0000000000..0691d9b2ee --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureNumLevels_09ddd0() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_09ddd0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureNumLevels_09ddd0() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_09ddd0(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureNumLevels_09ddd0() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_09ddd0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.msl new file mode 100644 index 0000000000..43e490484c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_09ddd0(texture2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureNumLevels_09ddd0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_09ddd0(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_09ddd0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cebcabb0a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/09ddd0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureNumLevels_09ddd0() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_09ddd0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_09ddd0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_09ddd0(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl new file mode 100644 index 0000000000..61e6a3fa83 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLevels(texture: texture_2d_array) -> i32 +fn textureNumLevels_105988() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_105988(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_105988(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_105988(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..608355f226 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_105988() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_105988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_105988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_105988(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..608355f226 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_105988() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_105988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_105988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_105988(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.glsl new file mode 100644 index 0000000000..90e28da994 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_105988() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_105988(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_105988() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_105988(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_105988() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_105988(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.msl new file mode 100644 index 0000000000..c27305e4e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_105988(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLevels_105988(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_105988(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_105988(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.wgsl new file mode 100644 index 0000000000..8eb140d658 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/105988.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLevels_105988() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_105988(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_105988(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_105988(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl new file mode 100644 index 0000000000..ae28bc695b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureNumLevels(texture: texture_1d) -> i32 +fn textureNumLevels_1e6f3b() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_1e6f3b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_1e6f3b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_1e6f3b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..938309a8d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_1e6f3b() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_1e6f3b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_1e6f3b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_1e6f3b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..938309a8d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_1e6f3b() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_1e6f3b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_1e6f3b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_1e6f3b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.glsl new file mode 100644 index 0000000000..50f6f13cbd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureNumLevels_1e6f3b() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_1e6f3b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureNumLevels_1e6f3b() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_1e6f3b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureNumLevels_1e6f3b() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_1e6f3b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.msl new file mode 100644 index 0000000000..00356f0669 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_1e6f3b(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureNumLevels_1e6f3b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_1e6f3b(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_1e6f3b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.wgsl new file mode 100644 index 0000000000..58a28d75d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/1e6f3b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureNumLevels_1e6f3b() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_1e6f3b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_1e6f3b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_1e6f3b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl new file mode 100644 index 0000000000..046b0a8fd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureNumLevels(texture: texture_2d) -> i32 +fn textureNumLevels_23f750() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_23f750(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_23f750(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_23f750(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..230c77c842 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_23f750() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_23f750(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_23f750(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_23f750(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..230c77c842 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_23f750() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_23f750(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_23f750(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_23f750(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.glsl new file mode 100644 index 0000000000..8b964989fe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureNumLevels_23f750() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_23f750(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureNumLevels_23f750() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_23f750(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureNumLevels_23f750() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_23f750(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.msl new file mode 100644 index 0000000000..571d0a45f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_23f750(texture2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureNumLevels_23f750(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_23f750(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_23f750(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ce13f7362 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/23f750.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureNumLevels_23f750() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_23f750(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_23f750(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_23f750(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl new file mode 100644 index 0000000000..98cf2c6b58 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureNumLevels(texture: texture_depth_cube_array) -> i32 +fn textureNumLevels_2c3575() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_2c3575(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_2c3575(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_2c3575(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..969b67aee9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_2c3575() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_2c3575(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_2c3575(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_2c3575(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..969b67aee9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_2c3575() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_2c3575(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_2c3575(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_2c3575(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.glsl new file mode 100644 index 0000000000..2de59fc0b0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_2c3575() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_2c3575(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_2c3575() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_2c3575(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_2c3575() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_2c3575(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.msl new file mode 100644 index 0000000000..8f7ed02625 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_2c3575(depthcube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureNumLevels_2c3575(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_2c3575(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_2c3575(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e019602ec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/2c3575.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureNumLevels_2c3575() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_2c3575(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_2c3575(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_2c3575(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl new file mode 100644 index 0000000000..9773aa4069 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureNumLevels(texture: texture_1d) -> i32 +fn textureNumLevels_32a0ae() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_32a0ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_32a0ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_32a0ae(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8caa7566e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_32a0ae() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_32a0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_32a0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_32a0ae(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8caa7566e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_32a0ae() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_32a0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_32a0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_32a0ae(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.glsl new file mode 100644 index 0000000000..b0cdc31466 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureNumLevels_32a0ae() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_32a0ae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureNumLevels_32a0ae() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_32a0ae(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureNumLevels_32a0ae() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_32a0ae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.msl new file mode 100644 index 0000000000..11c0362e19 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_32a0ae(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureNumLevels_32a0ae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_32a0ae(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_32a0ae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.wgsl new file mode 100644 index 0000000000..13377ce7a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/32a0ae.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureNumLevels_32a0ae() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_32a0ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_32a0ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_32a0ae(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl new file mode 100644 index 0000000000..d92d07fe01 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLevels(texture: texture_2d_array) -> i32 +fn textureNumLevels_5101cf() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_5101cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_5101cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_5101cf(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f6385792ca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_5101cf() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_5101cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_5101cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_5101cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6385792ca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_5101cf() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_5101cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_5101cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_5101cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.glsl new file mode 100644 index 0000000000..e372765680 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLevels_5101cf() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_5101cf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureNumLevels_5101cf() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_5101cf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLevels_5101cf() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_5101cf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.msl new file mode 100644 index 0000000000..4a17faabec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_5101cf(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLevels_5101cf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_5101cf(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_5101cf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..3425bb26c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/5101cf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLevels_5101cf() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_5101cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_5101cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_5101cf(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl new file mode 100644 index 0000000000..ec4aa990fe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureNumLevels(texture: texture_1d) -> i32 +fn textureNumLevels_51b5bb() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_51b5bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_51b5bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_51b5bb(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e41c4df7b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_51b5bb() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_51b5bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_51b5bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_51b5bb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e41c4df7b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_51b5bb() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_51b5bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_51b5bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_51b5bb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.glsl new file mode 100644 index 0000000000..8969352a69 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureNumLevels_51b5bb() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_51b5bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureNumLevels_51b5bb() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_51b5bb(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureNumLevels_51b5bb() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_51b5bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.msl new file mode 100644 index 0000000000..7acc809df7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_51b5bb(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureNumLevels_51b5bb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_51b5bb(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_51b5bb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..71883b0571 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/51b5bb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureNumLevels_51b5bb() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_51b5bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_51b5bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_51b5bb(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl new file mode 100644 index 0000000000..5c1e1a3145 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureNumLevels(texture: texture_cube) -> i32 +fn textureNumLevels_897aaf() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_897aaf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_897aaf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_897aaf(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1dc79b11bb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_897aaf() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_897aaf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_897aaf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_897aaf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1dc79b11bb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_897aaf() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_897aaf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_897aaf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_897aaf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.glsl new file mode 100644 index 0000000000..f7d707ee4d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_897aaf() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_897aaf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureNumLevels_897aaf() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_897aaf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_897aaf() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_897aaf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.msl new file mode 100644 index 0000000000..5f6ffc4d3b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_897aaf(texturecube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureNumLevels_897aaf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_897aaf(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_897aaf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.wgsl new file mode 100644 index 0000000000..473da66aa6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/897aaf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureNumLevels_897aaf() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_897aaf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_897aaf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_897aaf(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl new file mode 100644 index 0000000000..a297fa01a4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureNumLevels(texture: texture_3d) -> i32 +fn textureNumLevels_9da7a5() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_9da7a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_9da7a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_9da7a5(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..621c54766b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_9da7a5() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_9da7a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_9da7a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_9da7a5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..621c54766b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_9da7a5() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_9da7a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_9da7a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_9da7a5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.glsl new file mode 100644 index 0000000000..83706c6e71 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureNumLevels_9da7a5() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_9da7a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureNumLevels_9da7a5() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_9da7a5(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureNumLevels_9da7a5() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_9da7a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.msl new file mode 100644 index 0000000000..f813901183 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_9da7a5(texture3d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureNumLevels_9da7a5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_9da7a5(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_9da7a5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..13135d5d47 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/9da7a5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureNumLevels_9da7a5() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_9da7a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_9da7a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_9da7a5(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl new file mode 100644 index 0000000000..2d2b3e911c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLevels(texture: texture_cube_array) -> i32 +fn textureNumLevels_a91c03() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_a91c03(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_a91c03(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_a91c03(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..97c379dd7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_a91c03() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_a91c03(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_a91c03(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_a91c03(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..97c379dd7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_a91c03() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_a91c03(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_a91c03(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_a91c03(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.glsl new file mode 100644 index 0000000000..684bc1b610 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLevels_a91c03() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_a91c03(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLevels_a91c03() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_a91c03(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLevels_a91c03() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_a91c03(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.msl new file mode 100644 index 0000000000..4a151f0637 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_a91c03(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLevels_a91c03(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_a91c03(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_a91c03(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.wgsl new file mode 100644 index 0000000000..69e569b387 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/a91c03.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLevels_a91c03() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_a91c03(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_a91c03(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_a91c03(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl new file mode 100644 index 0000000000..3f14e55f41 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLevels(texture: texture_cube_array) -> i32 +fn textureNumLevels_aee7c8() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_aee7c8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_aee7c8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_aee7c8(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6511a2d27a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_aee7c8() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_aee7c8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_aee7c8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_aee7c8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6511a2d27a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_aee7c8() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_aee7c8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_aee7c8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_aee7c8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.glsl new file mode 100644 index 0000000000..6fbe7623ba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_aee7c8() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_aee7c8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_aee7c8() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_aee7c8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_aee7c8() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_aee7c8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.msl new file mode 100644 index 0000000000..a4627cd1b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_aee7c8(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLevels_aee7c8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_aee7c8(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_aee7c8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.wgsl new file mode 100644 index 0000000000..a9336a0aa8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/aee7c8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLevels_aee7c8() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_aee7c8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_aee7c8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_aee7c8(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl new file mode 100644 index 0000000000..9f8cbc5956 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureNumLevels(texture: texture_depth_2d) -> i32 +fn textureNumLevels_b1b12b() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b1b12b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_b1b12b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_b1b12b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd908dca1e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_b1b12b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b1b12b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b1b12b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b1b12b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd908dca1e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_b1b12b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b1b12b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b1b12b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b1b12b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.glsl new file mode 100644 index 0000000000..2a2119a2ae --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_b1b12b() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_b1b12b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureNumLevels_b1b12b() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_b1b12b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_b1b12b() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_b1b12b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.msl new file mode 100644 index 0000000000..cdda66a9a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_b1b12b(depth2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureNumLevels_b1b12b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_b1b12b(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_b1b12b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.wgsl new file mode 100644 index 0000000000..cfb7e4b78d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b1b12b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureNumLevels_b1b12b() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b1b12b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_b1b12b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_b1b12b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl new file mode 100644 index 0000000000..978bbde2c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureNumLevels(texture: texture_3d) -> i32 +fn textureNumLevels_b4f5ea() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b4f5ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_b4f5ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_b4f5ea(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..92162ad12d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_b4f5ea() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b4f5ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b4f5ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b4f5ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..92162ad12d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_b4f5ea() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b4f5ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b4f5ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b4f5ea(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.glsl new file mode 100644 index 0000000000..a857a8aa29 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureNumLevels_b4f5ea() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_b4f5ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureNumLevels_b4f5ea() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_b4f5ea(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureNumLevels_b4f5ea() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_b4f5ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.msl new file mode 100644 index 0000000000..8c251ea96b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_b4f5ea(texture3d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureNumLevels_b4f5ea(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_b4f5ea(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_b4f5ea(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1f829abd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/b4f5ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureNumLevels_b4f5ea() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b4f5ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_b4f5ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_b4f5ea(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl new file mode 100644 index 0000000000..17c58e11bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLevels(texture: texture_2d_array) -> i32 +fn textureNumLevels_d004a9() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_d004a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_d004a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_d004a9(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..34731d5b4e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_d004a9() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_d004a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_d004a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_d004a9(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..34731d5b4e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_d004a9() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_d004a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_d004a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_d004a9(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.glsl new file mode 100644 index 0000000000..926ded3ccb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLevels_d004a9() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_d004a9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureNumLevels_d004a9() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_d004a9(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLevels_d004a9() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_d004a9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.msl new file mode 100644 index 0000000000..d0d19fe935 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_d004a9(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLevels_d004a9(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_d004a9(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_d004a9(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce8d24dc31 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/d004a9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLevels_d004a9() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_d004a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_d004a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_d004a9(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl new file mode 100644 index 0000000000..e7b032c171 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureNumLevels(texture: texture_3d) -> i32 +fn textureNumLevels_dca09e() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_dca09e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_dca09e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_dca09e(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..01307a423f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_dca09e() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_dca09e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_dca09e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_dca09e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01307a423f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_dca09e() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_dca09e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_dca09e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_dca09e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.glsl new file mode 100644 index 0000000000..ba0c815048 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureNumLevels_dca09e() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_dca09e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureNumLevels_dca09e() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_dca09e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureNumLevels_dca09e() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_dca09e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.msl new file mode 100644 index 0000000000..e7813c56e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_dca09e(texture3d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureNumLevels_dca09e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_dca09e(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_dca09e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.wgsl new file mode 100644 index 0000000000..d5e1e54ad9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/dca09e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureNumLevels_dca09e() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_dca09e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_dca09e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_dca09e(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl new file mode 100644 index 0000000000..bfec4352b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureNumLevels(texture: texture_2d) -> i32 +fn textureNumLevels_e67231() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_e67231(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_e67231(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_e67231(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6f8a6f769 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_e67231() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_e67231(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_e67231(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_e67231(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6f8a6f769 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_e67231() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_e67231(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_e67231(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_e67231(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.glsl new file mode 100644 index 0000000000..5345038ff9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_e67231() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_e67231(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureNumLevels_e67231() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_e67231(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_e67231() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_e67231(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.msl new file mode 100644 index 0000000000..0a9f1ef9b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_e67231(texture2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureNumLevels_e67231(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_e67231(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_e67231(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.wgsl new file mode 100644 index 0000000000..a42349da60 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/e67231.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureNumLevels_e67231() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_e67231(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_e67231(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_e67231(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl new file mode 100644 index 0000000000..9ad4dca600 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureNumLevels(texture: texture_cube) -> i32 +fn textureNumLevels_ed078b() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_ed078b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_ed078b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_ed078b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..75d40ead62 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_ed078b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_ed078b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_ed078b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_ed078b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..75d40ead62 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_ed078b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_ed078b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_ed078b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_ed078b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.glsl new file mode 100644 index 0000000000..3293d1e204 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureNumLevels_ed078b() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_ed078b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_0_1; +void textureNumLevels_ed078b() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_ed078b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureNumLevels_ed078b() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_ed078b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.msl new file mode 100644 index 0000000000..74d65639d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_ed078b(texturecube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureNumLevels_ed078b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_ed078b(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_ed078b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.wgsl new file mode 100644 index 0000000000..3a951308d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/ed078b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureNumLevels_ed078b() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_ed078b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_ed078b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_ed078b(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl new file mode 100644 index 0000000000..f32f53fc1f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLevels(texture: texture_cube_array) -> i32 +fn textureNumLevels_f46ec6() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f46ec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_f46ec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_f46ec6(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3a16309ca7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_f46ec6() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f46ec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f46ec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f46ec6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3a16309ca7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_f46ec6() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f46ec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f46ec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f46ec6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.glsl new file mode 100644 index 0000000000..1da3a81ad4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLevels_f46ec6() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_f46ec6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLevels_f46ec6() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_f46ec6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLevels_f46ec6() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_f46ec6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.msl new file mode 100644 index 0000000000..83873b6123 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_f46ec6(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLevels_f46ec6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_f46ec6(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_f46ec6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1621389be --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f46ec6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLevels_f46ec6() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f46ec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_f46ec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_f46ec6(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl new file mode 100644 index 0000000000..009134e59b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureNumLevels(texture: texture_depth_2d_array) -> i32 +fn textureNumLevels_f5828d() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f5828d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_f5828d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_f5828d(); +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..05d604d60a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_f5828d() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f5828d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f5828d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f5828d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..05d604d60a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_f5828d() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f5828d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f5828d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f5828d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.glsl new file mode 100644 index 0000000000..e810a1a552 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_f5828d() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_f5828d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_f5828d() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_f5828d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_f5828d() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_f5828d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.msl new file mode 100644 index 0000000000..0a150257cc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_f5828d(depth2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureNumLevels_f5828d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_f5828d(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_f5828d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.wgsl new file mode 100644 index 0000000000..02fdd80212 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumLevels/f5828d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureNumLevels_f5828d() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f5828d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_f5828d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_f5828d(); +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl new file mode 100644 index 0000000000..208dec8ee9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 +fn textureNumSamples_2c6f14() { + var res: i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_2c6f14(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_2c6f14(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_2c6f14(); +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6c3feafdaa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_2c6f14() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_2c6f14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_2c6f14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_2c6f14(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6c3feafdaa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_2c6f14() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_2c6f14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_2c6f14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_2c6f14(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.glsl new file mode 100644 index 0000000000..5abe128e4b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_2c6f14() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_2c6f14(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_2c6f14() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_2c6f14(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_2c6f14() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_2c6f14(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.msl new file mode 100644 index 0000000000..b062129875 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_2c6f14(texture2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureNumSamples_2c6f14(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_2c6f14(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_2c6f14(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.wgsl new file mode 100644 index 0000000000..460b4e22b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/2c6f14.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureNumSamples_2c6f14() { + var res : i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_2c6f14(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_2c6f14(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_2c6f14(); +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl new file mode 100644 index 0000000000..a308412674 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 +fn textureNumSamples_42f8bb() { + var res: i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_42f8bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_42f8bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_42f8bb(); +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..415abda1e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_42f8bb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_42f8bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_42f8bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_42f8bb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..415abda1e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_42f8bb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_42f8bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_42f8bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_42f8bb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.glsl new file mode 100644 index 0000000000..8a06334bf4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureNumSamples_42f8bb() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_42f8bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler2DMS arg_0_1; +void textureNumSamples_42f8bb() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_42f8bb(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureNumSamples_42f8bb() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_42f8bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.msl new file mode 100644 index 0000000000..d951a7eee8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_42f8bb(texture2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureNumSamples_42f8bb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_42f8bb(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_42f8bb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..e62f047750 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/42f8bb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureNumSamples_42f8bb() { + var res : i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_42f8bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_42f8bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_42f8bb(); +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl new file mode 100644 index 0000000000..9680606acf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 +fn textureNumSamples_449d23() { + var res: i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_449d23(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_449d23(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_449d23(); +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4dbf2f0a56 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_449d23() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_449d23(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_449d23(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_449d23(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4dbf2f0a56 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_449d23() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_449d23(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_449d23(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_449d23(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.glsl new file mode 100644 index 0000000000..2b60dd51be --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureNumSamples_449d23() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_449d23(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler2DMS arg_0_1; +void textureNumSamples_449d23() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_449d23(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureNumSamples_449d23() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_449d23(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.msl new file mode 100644 index 0000000000..18e0ad7500 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_449d23(texture2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureNumSamples_449d23(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_449d23(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_449d23(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c9fd1f110 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/449d23.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureNumSamples_449d23() { + var res : i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_449d23(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_449d23(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_449d23(); +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl new file mode 100644 index 0000000000..bddc529888 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; + +// fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32 +fn textureNumSamples_a3c8a0() { + var res: i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_a3c8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_a3c8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_a3c8a0(); +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0eb375a965 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_a3c8a0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_a3c8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_a3c8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_a3c8a0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0eb375a965 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_a3c8a0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_a3c8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_a3c8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_a3c8a0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.glsl new file mode 100644 index 0000000000..826c680985 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_a3c8a0() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_a3c8a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_a3c8a0() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_a3c8a0(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_a3c8a0() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_a3c8a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.msl new file mode 100644 index 0000000000..c3db04e5e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_a3c8a0(depth2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_ms tint_symbol_2) { + textureNumSamples_a3c8a0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_a3c8a0(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_a3c8a0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..c78e10135f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureNumSamples/a3c8a0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; + +fn textureNumSamples_a3c8a0() { + var res : i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_a3c8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_a3c8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_a3c8a0(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl new file mode 100644 index 0000000000..90fce8674c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> f32 +fn textureSample_0dff6c() { + var res: f32 = textureSample(arg_0, arg_1, vec2(), vec2()); +} + +@fragment +fn fragment_main() { + textureSample_0dff6c(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5e03f88519 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_0dff6c() { + float res = arg_0.Sample(arg_1, (0.0f).xx, (0).xx).x; +} + +void fragment_main() { + textureSample_0dff6c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5e03f88519 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_0dff6c() { + float res = arg_0.Sample(arg_1, (0.0f).xx, (0).xx).x; +} + +void fragment_main() { + textureSample_0dff6c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.glsl new file mode 100644 index 0000000000..f0907928f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSample_0dff6c() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_0dff6c(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.msl new file mode 100644 index 0000000000..ea808aeebb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_0dff6c(depth2d tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample(tint_symbol_1, float2(0.0f), int2(0)); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_0dff6c(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5558437d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_0dff6c "textureSample_0dff6c" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %17 = OpTypeSampledImage %3 + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %23 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%textureSample_0dff6c = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_float Function %26 + %15 = OpLoad %7 %arg_1 + %16 = OpLoad %3 %arg_0 + %18 = OpSampledImage %17 %16 %15 + %13 = OpImageSampleImplicitLod %v4float %18 %20 ConstOffset %23 + %12 = OpCompositeExtract %float %13 0 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSample_0dff6c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.wgsl new file mode 100644 index 0000000000..5dff612013 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/0dff6c.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_0dff6c() { + var res : f32 = textureSample(arg_0, arg_1, vec2(), vec2()); +} + +@fragment +fn fragment_main() { + textureSample_0dff6c(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl new file mode 100644 index 0000000000..fb2f2464b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureSample_17e988() { + var res: vec4 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_17e988(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc8a980c3c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_17e988() { + float4 res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +void fragment_main() { + textureSample_17e988(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fc8a980c3c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_17e988() { + float4 res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx); +} + +void fragment_main() { + textureSample_17e988(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.glsl new file mode 100644 index 0000000000..fdfe3c0022 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSample_17e988() { + vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), ivec2(0)); +} + +void fragment_main() { + textureSample_17e988(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.msl new file mode 100644 index 0000000000..167ac7b683 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_17e988(texture2d_array tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, int2(0)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_17e988(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.spvasm new file mode 100644 index 0000000000..576ac755e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_17e988 "textureSample_17e988" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %25 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpConstantNull %v4float +%textureSample_17e988 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %28 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %20 = OpConvertSToF %float %int_1 + %23 = OpCompositeConstruct %v3float %float_0 %float_0 %20 + %12 = OpImageSampleImplicitLod %v4float %17 %23 ConstOffset %25 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %30 = OpLabel + %31 = OpFunctionCall %void %textureSample_17e988 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.wgsl new file mode 100644 index 0000000000..3bb1fd77fc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/17e988.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_17e988() { + var res : vec4 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_17e988(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl new file mode 100644 index 0000000000..71df6c568e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, @const offset: vec3) -> vec4 +fn textureSample_2149ec() { + var res: vec4 = textureSample(arg_0, arg_1, vec3(), vec3()); +} + +@fragment +fn fragment_main() { + textureSample_2149ec(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..137a2ffde4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_2149ec() { + float4 res = arg_0.Sample(arg_1, (0.0f).xxx, (0).xxx); +} + +void fragment_main() { + textureSample_2149ec(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..137a2ffde4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_2149ec() { + float4 res = arg_0.Sample(arg_1, (0.0f).xxx, (0).xxx); +} + +void fragment_main() { + textureSample_2149ec(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.glsl new file mode 100644 index 0000000000..2592c4f486 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSample_2149ec() { + vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f), ivec3(0)); +} + +void fragment_main() { + textureSample_2149ec(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.msl new file mode 100644 index 0000000000..b6ec3094f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_2149ec(texture3d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), int3(0)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_2149ec(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.spvasm new file mode 100644 index 0000000000..21ae9c0754 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_2149ec "textureSample_2149ec" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %19 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %22 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_2149ec = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %25 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %12 = OpImageSampleImplicitLod %v4float %17 %19 ConstOffset %22 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_2149ec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.wgsl new file mode 100644 index 0000000000..0b47e89f5e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/2149ec.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_2149ec() { + var res : vec4 = textureSample(arg_0, arg_1, vec3(), vec3()); +} + +@fragment +fn fragment_main() { + textureSample_2149ec(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl new file mode 100644 index 0000000000..03480aa672 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> f32 +fn textureSample_38bbb9() { + var res: f32 = textureSample(arg_0, arg_1, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_38bbb9(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aeb2754c08 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_38bbb9() { + float res = arg_0.Sample(arg_1, (0.0f).xx).x; +} + +void fragment_main() { + textureSample_38bbb9(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aeb2754c08 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_38bbb9() { + float res = arg_0.Sample(arg_1, (0.0f).xx).x; +} + +void fragment_main() { + textureSample_38bbb9(); + return; +} diff --git a/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.msl new file mode 100644 index 0000000000..7884b3124b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_38bbb9(depth2d tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample(tint_symbol_1, float2(0.0f)); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_38bbb9(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.wgsl new file mode 100644 index 0000000000..6edb215124 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/38bbb9.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_38bbb9() { + var res : f32 = textureSample(arg_0, arg_1, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_38bbb9(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl new file mode 100644 index 0000000000..897a54c718 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3) -> vec4 +fn textureSample_3b50bd() { + var res: vec4 = textureSample(arg_0, arg_1, vec3()); +} + +@fragment +fn fragment_main() { + textureSample_3b50bd(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b99e2a794 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_3b50bd() { + float4 res = arg_0.Sample(arg_1, (0.0f).xxx); +} + +void fragment_main() { + textureSample_3b50bd(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b99e2a794 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_3b50bd() { + float4 res = arg_0.Sample(arg_1, (0.0f).xxx); +} + +void fragment_main() { + textureSample_3b50bd(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.glsl new file mode 100644 index 0000000000..8d1d18d519 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSample_3b50bd() { + vec4 res = texture(arg_0_arg_1, vec3(0.0f)); +} + +void fragment_main() { + textureSample_3b50bd(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.msl new file mode 100644 index 0000000000..a63d38d491 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_3b50bd(texture3d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_3b50bd(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.wgsl new file mode 100644 index 0000000000..43bc582115 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/3b50bd.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_3b50bd() { + var res : vec4 = textureSample(arg_0, arg_1, vec3()); +} + +@fragment +fn fragment_main() { + textureSample_3b50bd(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl new file mode 100644 index 0000000000..7d80fd0544 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureSample_4dd1bf() { + var res: vec4 = textureSample(arg_0, arg_1, vec3(), 1); +} + +@fragment +fn fragment_main() { + textureSample_4dd1bf(); +} diff --git a/test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..47013d29e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_4dd1bf() { + float4 res = arg_0.Sample(arg_1, float4(0.0f, 0.0f, 0.0f, float(1))); +} + +void fragment_main() { + textureSample_4dd1bf(); + return; +} diff --git a/test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.msl new file mode 100644 index 0000000000..f392da9c96 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_4dd1bf(texturecube_array tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), 1); +} + +fragment void fragment_main(texturecube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_4dd1bf(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..5c29b5a578 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/4dd1bf.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_4dd1bf() { + var res : vec4 = textureSample(arg_0, arg_1, vec3(), 1); +} + +@fragment +fn fragment_main() { + textureSample_4dd1bf(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/51b514.wgsl b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl new file mode 100644 index 0000000000..cd0e902d12 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureSample_51b514() { + var res: vec4 = textureSample(arg_0, arg_1, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_51b514(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..68aa5c7a80 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_51b514() { + float4 res = arg_0.Sample(arg_1, (0.0f).xx); +} + +void fragment_main() { + textureSample_51b514(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68aa5c7a80 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_51b514() { + float4 res = arg_0.Sample(arg_1, (0.0f).xx); +} + +void fragment_main() { + textureSample_51b514(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.glsl new file mode 100644 index 0000000000..b04d68133f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSample_51b514() { + vec4 res = texture(arg_0_arg_1, vec2(0.0f)); +} + +void fragment_main() { + textureSample_51b514(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.msl new file mode 100644 index 0000000000..a8e99fb996 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_51b514(texture2d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_51b514(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/51b514.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.wgsl new file mode 100644 index 0000000000..7a5e264075 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/51b514.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_51b514() { + var res : vec4 = textureSample(arg_0, arg_1, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_51b514(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl new file mode 100644 index 0000000000..f7111280cc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> f32 +fn textureSample_60bf45() { + var res: f32 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_60bf45(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0575d77871 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_60bf45() { + float res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx).x; +} + +void fragment_main() { + textureSample_60bf45(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0575d77871 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_60bf45() { + float res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), (0).xx).x; +} + +void fragment_main() { + textureSample_60bf45(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.glsl new file mode 100644 index 0000000000..ea3660f788 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.glsl @@ -0,0 +1,26 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSample_60bf45() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_60bf45(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.msl new file mode 100644 index 0000000000..20593cef53 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_60bf45(depth2d_array tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, int2(0)); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_60bf45(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.spvasm new file mode 100644 index 0000000000..966d12da82 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_60bf45 "textureSample_60bf45" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %17 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %26 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%textureSample_60bf45 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_float Function %29 + %15 = OpLoad %7 %arg_1 + %16 = OpLoad %3 %arg_0 + %18 = OpSampledImage %17 %16 %15 + %21 = OpConvertSToF %float %int_1 + %24 = OpCompositeConstruct %v3float %float_0 %float_0 %21 + %13 = OpImageSampleImplicitLod %v4float %18 %24 ConstOffset %26 + %12 = OpCompositeExtract %float %13 0 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %31 = OpLabel + %32 = OpFunctionCall %void %textureSample_60bf45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.wgsl new file mode 100644 index 0000000000..01301b396a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/60bf45.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_60bf45() { + var res : f32 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_60bf45(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl new file mode 100644 index 0000000000..e9c30950a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureSample_6717ca() { + var res: vec4 = textureSample(arg_0, arg_1, vec2(), 1); +} + +@fragment +fn fragment_main() { + textureSample_6717ca(); +} diff --git a/test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b1e6e4161 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_6717ca() { + float4 res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1))); +} + +void fragment_main() { + textureSample_6717ca(); + return; +} diff --git a/test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.msl new file mode 100644 index 0000000000..aa18356a8e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_6717ca(texture2d_array tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_6717ca(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.wgsl new file mode 100644 index 0000000000..4f6d04834a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/6717ca.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_6717ca() { + var res : vec4 = textureSample(arg_0, arg_1, vec2(), 1); +} + +@fragment +fn fragment_main() { + textureSample_6717ca(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl new file mode 100644 index 0000000000..3fb970567b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_1d, sampler: sampler, coords: f32) -> vec4 +fn textureSample_6e64fb() { + var res: vec4 = textureSample(arg_0, arg_1, 1.f); +} + +@fragment +fn fragment_main() { + textureSample_6e64fb(); +} diff --git a/test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..40f4e00b0e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture1D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_6e64fb() { + float4 res = arg_0.Sample(arg_1, 1.0f); +} + +void fragment_main() { + textureSample_6e64fb(); + return; +} diff --git a/test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.msl rename to test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.msl diff --git a/test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.wgsl new file mode 100644 index 0000000000..9109eb4aad --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/6e64fb.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_6e64fb() { + var res : vec4 = textureSample(arg_0, arg_1, 1.0f); +} + +@fragment +fn fragment_main() { + textureSample_6e64fb(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl new file mode 100644 index 0000000000..3fd7483acf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> f32 +fn textureSample_7e9ffd() { + var res: f32 = textureSample(arg_0, arg_1, vec2(), 1); +} + +@fragment +fn fragment_main() { + textureSample_7e9ffd(); +} diff --git a/test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b3167130ed --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_7e9ffd() { + float res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1))).x; +} + +void fragment_main() { + textureSample_7e9ffd(); + return; +} diff --git a/test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.msl new file mode 100644 index 0000000000..7ed4a39b83 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_7e9ffd(depth2d_array tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_7e9ffd(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.wgsl new file mode 100644 index 0000000000..0381c1a7e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/7e9ffd.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_7e9ffd() { + var res : f32 = textureSample(arg_0, arg_1, vec2(), 1); +} + +@fragment +fn fragment_main() { + textureSample_7e9ffd(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl new file mode 100644 index 0000000000..a4fb732ebc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureSample_85c4ba() { + var res: vec4 = textureSample(arg_0, arg_1, vec2(), vec2()); +} + +@fragment +fn fragment_main() { + textureSample_85c4ba(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f43541cd7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_85c4ba() { + float4 res = arg_0.Sample(arg_1, (0.0f).xx, (0).xx); +} + +void fragment_main() { + textureSample_85c4ba(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f43541cd7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_85c4ba() { + float4 res = arg_0.Sample(arg_1, (0.0f).xx, (0).xx); +} + +void fragment_main() { + textureSample_85c4ba(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.glsl new file mode 100644 index 0000000000..9c7c7b3e46 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSample_85c4ba() { + vec4 res = textureOffset(arg_0_arg_1, vec2(0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_85c4ba(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.msl new file mode 100644 index 0000000000..50844e38bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_85c4ba(texture2d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), int2(0)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_85c4ba(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..17a25fce30 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_85c4ba "textureSample_85c4ba" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v2float = OpTypeVector %float 2 + %19 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %22 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_85c4ba = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %25 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %12 = OpImageSampleImplicitLod %v4float %17 %19 ConstOffset %22 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_85c4ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d23c1512f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/85c4ba.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_85c4ba() { + var res : vec4 = textureSample(arg_0, arg_1, vec2(), vec2()); +} + +@fragment +fn fragment_main() { + textureSample_85c4ba(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl new file mode 100644 index 0000000000..11c008a862 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> f32 +fn textureSample_c2f4e8() { + var res: f32 = textureSample(arg_0, arg_1, vec3(), 1); +} + +@fragment +fn fragment_main() { + textureSample_c2f4e8(); +} diff --git a/test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2eee5aed8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_c2f4e8() { + float res = arg_0.Sample(arg_1, float4(0.0f, 0.0f, 0.0f, float(1))).x; +} + +void fragment_main() { + textureSample_c2f4e8(); + return; +} diff --git a/test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.msl new file mode 100644 index 0000000000..812a3e0a2c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_c2f4e8(depthcube_array tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample(tint_symbol_1, float3(0.0f), 1); +} + +fragment void fragment_main(depthcube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_c2f4e8(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e1f087212 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/c2f4e8.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_c2f4e8() { + var res : f32 = textureSample(arg_0, arg_1, vec3(), 1); +} + +@fragment +fn fragment_main() { + textureSample_c2f4e8(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/e53267.wgsl b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl new file mode 100644 index 0000000000..dafb3ae08f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureSample_e53267() { + var res: vec4 = textureSample(arg_0, arg_1, vec3()); +} + +@fragment +fn fragment_main() { + textureSample_e53267(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18cffd4082 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_e53267() { + float4 res = arg_0.Sample(arg_1, (0.0f).xxx); +} + +void fragment_main() { + textureSample_e53267(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..18cffd4082 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_e53267() { + float4 res = arg_0.Sample(arg_1, (0.0f).xxx); +} + +void fragment_main() { + textureSample_e53267(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.glsl new file mode 100644 index 0000000000..8abd834d27 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSample_e53267() { + vec4 res = texture(arg_0_arg_1, vec3(0.0f)); +} + +void fragment_main() { + textureSample_e53267(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.msl new file mode 100644 index 0000000000..6953ad27ee --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_e53267(texturecube tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f)); +} + +fragment void fragment_main(texturecube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_e53267(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/e53267.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.wgsl new file mode 100644 index 0000000000..d4d1c1097d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/e53267.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_e53267() { + var res : vec4 = textureSample(arg_0, arg_1, vec3()); +} + +@fragment +fn fragment_main() { + textureSample_e53267(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl new file mode 100644 index 0000000000..0a0eadc687 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> f32 +fn textureSample_ea7030() { + var res: f32 = textureSample(arg_0, arg_1, vec3()); +} + +@fragment +fn fragment_main() { + textureSample_ea7030(); +} diff --git a/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4f82f08ede --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_ea7030() { + float res = arg_0.Sample(arg_1, (0.0f).xxx).x; +} + +void fragment_main() { + textureSample_ea7030(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f82f08ede --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_ea7030() { + float res = arg_0.Sample(arg_1, (0.0f).xxx).x; +} + +void fragment_main() { + textureSample_ea7030(); + return; +} diff --git a/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.msl new file mode 100644 index 0000000000..295b3acf19 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSample_ea7030(depthcube tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample(tint_symbol_1, float3(0.0f)); +} + +fragment void fragment_main(depthcube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_ea7030(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.wgsl new file mode 100644 index 0000000000..de2934ba44 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSample/ea7030.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_ea7030() { + var res : f32 = textureSample(arg_0, arg_1, vec3()); +} + +@fragment +fn fragment_main() { + textureSample_ea7030(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl new file mode 100644 index 0000000000..6de9215d5e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_cube, sampler: sampler, coords: vec3, bias: f32) -> vec4 +fn textureSampleBias_53b9f7() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.f); +} + +@fragment +fn fragment_main() { + textureSampleBias_53b9f7(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ec467db1b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_53b9f7() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xxx, 1.0f); +} + +void fragment_main() { + textureSampleBias_53b9f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec467db1b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_53b9f7() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xxx, 1.0f); +} + +void fragment_main() { + textureSampleBias_53b9f7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.glsl new file mode 100644 index 0000000000..c40abb62e7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleBias_53b9f7() { + vec4 res = texture(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +void fragment_main() { + textureSampleBias_53b9f7(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.msl new file mode 100644 index 0000000000..dde5bfe38d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_53b9f7(texturecube tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), bias(1.0f)); +} + +fragment void fragment_main(texturecube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_53b9f7(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..d4680e6c98 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_53b9f7() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0f); +} + +@fragment +fn fragment_main() { + textureSampleBias_53b9f7(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl new file mode 100644 index 0000000000..ca0f3a167f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, @const offset: vec3) -> vec4 +fn textureSampleBias_594824() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.f, vec3()); +} + +@fragment +fn fragment_main() { + textureSampleBias_594824(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8ebc0016bd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_594824() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xxx, 1.0f, (0).xxx); +} + +void fragment_main() { + textureSampleBias_594824(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8ebc0016bd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_594824() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xxx, 1.0f, (0).xxx); +} + +void fragment_main() { + textureSampleBias_594824(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.glsl new file mode 100644 index 0000000000..e524a8d191 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleBias_594824() { + vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f), ivec3(0), 1.0f); +} + +void fragment_main() { + textureSampleBias_594824(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.msl new file mode 100644 index 0000000000..193009e0a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_594824(texture3d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), bias(1.0f), int3(0)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_594824(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm new file mode 100644 index 0000000000..4cc39b2a05 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_594824 "textureSampleBias_594824" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %19 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %23 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %26 = OpConstantNull %v4float +%textureSampleBias_594824 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %26 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %12 = OpImageSampleImplicitLod %v4float %17 %19 Bias|ConstOffset %float_1 %23 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSampleBias_594824 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.wgsl new file mode 100644 index 0000000000..3fe9740768 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_594824() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0f, vec3()); +} + +@fragment +fn fragment_main() { + textureSampleBias_594824(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl new file mode 100644 index 0000000000..089c1c9c07 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32) -> vec4 +fn textureSampleBias_6a9113() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.f); +} + +@fragment +fn fragment_main() { + textureSampleBias_6a9113(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a3e3379d3d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_6a9113() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xx, 1.0f); +} + +void fragment_main() { + textureSampleBias_6a9113(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a3e3379d3d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_6a9113() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xx, 1.0f); +} + +void fragment_main() { + textureSampleBias_6a9113(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.glsl new file mode 100644 index 0000000000..ca84e9dad8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleBias_6a9113() { + vec4 res = texture(arg_0_arg_1, vec2(0.0f), 1.0f); +} + +void fragment_main() { + textureSampleBias_6a9113(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.msl new file mode 100644 index 0000000000..ac41f09b68 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_6a9113(texture2d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), bias(1.0f)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_6a9113(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.wgsl new file mode 100644 index 0000000000..f864438f46 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_6a9113() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0f); +} + +@fragment +fn fragment_main() { + textureSampleBias_6a9113(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl new file mode 100644 index 0000000000..8accc8b272 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32) -> vec4 +fn textureSampleBias_80e579() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.f); +} + +@fragment +fn fragment_main() { + textureSampleBias_80e579(); +} diff --git a/test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5e8a9d2d5d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_80e579() { + float4 res = arg_0.SampleBias(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); +} + +void fragment_main() { + textureSampleBias_80e579(); + return; +} diff --git a/test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.msl new file mode 100644 index 0000000000..0a6cba8e3b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_80e579(texture2d_array tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, bias(1.0f)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_80e579(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.wgsl new file mode 100644 index 0000000000..8616fdc083 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_80e579() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0f); +} + +@fragment +fn fragment_main() { + textureSampleBias_80e579(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl new file mode 100644 index 0000000000..cca84dc73b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, @const offset: vec2) -> vec4 +fn textureSampleBias_9dbb51() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.f, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleBias_9dbb51(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bc8a5cd3d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_9dbb51() { + float4 res = arg_0.SampleBias(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleBias_9dbb51(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bc8a5cd3d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_9dbb51() { + float4 res = arg_0.SampleBias(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleBias_9dbb51(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.glsl new file mode 100644 index 0000000000..9f316abb23 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleBias_9dbb51() { + vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), ivec2(0), 1.0f); +} + +void fragment_main() { + textureSampleBias_9dbb51(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.msl new file mode 100644 index 0000000000..9958fb10b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_9dbb51(texture2d_array tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), 1, bias(1.0f), int2(0)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_9dbb51(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7bcac5432 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_9dbb51 "textureSampleBias_9dbb51" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %26 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %29 = OpConstantNull %v4float +%textureSampleBias_9dbb51 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %29 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %20 = OpConvertSToF %float %int_1 + %23 = OpCompositeConstruct %v3float %float_0 %float_0 %20 + %12 = OpImageSampleImplicitLod %v4float %17 %23 Bias|ConstOffset %float_1 %26 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %31 = OpLabel + %32 = OpFunctionCall %void %textureSampleBias_9dbb51 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.wgsl new file mode 100644 index 0000000000..0315b849fd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_9dbb51() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0f, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleBias_9dbb51(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl new file mode 100644 index 0000000000..f179d0b810 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, @const offset: vec2) -> vec4 +fn textureSampleBias_a161cf() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.f, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleBias_a161cf(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3d63e8ac7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_a161cf() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleBias_a161cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3d63e8ac7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_a161cf() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleBias_a161cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.glsl new file mode 100644 index 0000000000..e819fcd78c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleBias_a161cf() { + vec4 res = textureOffset(arg_0_arg_1, vec2(0.0f), ivec2(0), 1.0f); +} + +void fragment_main() { + textureSampleBias_a161cf(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.msl new file mode 100644 index 0000000000..87dac440f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_a161cf(texture2d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float2(0.0f), bias(1.0f), int2(0)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_a161cf(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b14f26539 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_a161cf "textureSampleBias_a161cf" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %16 = OpTypeSampledImage %3 + %v2float = OpTypeVector %float 2 + %19 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %23 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %26 = OpConstantNull %v4float +%textureSampleBias_a161cf = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %26 + %14 = OpLoad %7 %arg_1 + %15 = OpLoad %3 %arg_0 + %17 = OpSampledImage %16 %15 %14 + %12 = OpImageSampleImplicitLod %v4float %17 %19 Bias|ConstOffset %float_1 %23 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSampleBias_a161cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..a9dd4dd2a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_a161cf() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0f, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleBias_a161cf(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl new file mode 100644 index 0000000000..194d8bd189 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32) -> vec4 +fn textureSampleBias_d3fa1b() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.f); +} + +@fragment +fn fragment_main() { + textureSampleBias_d3fa1b(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cfb6394b5f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_d3fa1b() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xxx, 1.0f); +} + +void fragment_main() { + textureSampleBias_d3fa1b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cfb6394b5f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_d3fa1b() { + float4 res = arg_0.SampleBias(arg_1, (0.0f).xxx, 1.0f); +} + +void fragment_main() { + textureSampleBias_d3fa1b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.glsl new file mode 100644 index 0000000000..ae1ce59630 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleBias_d3fa1b() { + vec4 res = texture(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +void fragment_main() { + textureSampleBias_d3fa1b(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.msl new file mode 100644 index 0000000000..07cd37c50e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_d3fa1b(texture3d tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), bias(1.0f)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_d3fa1b(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.wgsl new file mode 100644 index 0000000000..88a08857cd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_d3fa1b() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0f); +} + +@fragment +fn fragment_main() { + textureSampleBias_d3fa1b(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl new file mode 100644 index 0000000000..9926e17485 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, bias: f32) -> vec4 +fn textureSampleBias_eed7c4() { + var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1, 1.f); +} + +@fragment +fn fragment_main() { + textureSampleBias_eed7c4(); +} diff --git a/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9c75d992e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_eed7c4() { + float4 res = arg_0.SampleBias(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +void fragment_main() { + textureSampleBias_eed7c4(); + return; +} diff --git a/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.msl new file mode 100644 index 0000000000..de4a66326a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleBias_eed7c4(texturecube_array tint_symbol, sampler tint_symbol_1) { + float4 res = tint_symbol.sample(tint_symbol_1, float3(0.0f), 1, bias(1.0f)); +} + +fragment void fragment_main(texturecube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_eed7c4(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.wgsl new file mode 100644 index 0000000000..879359ce2d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_eed7c4() { + var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1, 1.0f); +} + +@fragment +fn fragment_main() { + textureSampleBias_eed7c4(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl new file mode 100644 index 0000000000..cee7034446 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 +fn textureSampleCompare_3a5923() { + var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.f); +} + +@fragment +fn fragment_main() { + textureSampleCompare_3a5923(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..948b7a7afd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_3a5923() { + float res = arg_0.SampleCmp(arg_1, (0.0f).xx, 1.0f); +} + +void fragment_main() { + textureSampleCompare_3a5923(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..948b7a7afd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_3a5923() { + float res = arg_0.SampleCmp(arg_1, (0.0f).xx, 1.0f); +} + +void fragment_main() { + textureSampleCompare_3a5923(); + return; +} diff --git a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.msl new file mode 100644 index 0000000000..6b5e76d826 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleCompare_3a5923(depth2d tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample_compare(tint_symbol_1, float2(0.0f), 1.0f); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_3a5923(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.wgsl new file mode 100644 index 0000000000..58dbd58481 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/3a5923.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_3a5923() { + var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0f); +} + +@fragment +fn fragment_main() { + textureSampleCompare_3a5923(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl new file mode 100644 index 0000000000..c8641e3275 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 +fn textureSampleCompare_63fb83() { + var res: f32 = textureSampleCompare(arg_0, arg_1, vec3(), 1.f); +} + +@fragment +fn fragment_main() { + textureSampleCompare_63fb83(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..33b00bcdcc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_63fb83() { + float res = arg_0.SampleCmp(arg_1, (0.0f).xxx, 1.0f); +} + +void fragment_main() { + textureSampleCompare_63fb83(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..33b00bcdcc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_63fb83() { + float res = arg_0.SampleCmp(arg_1, (0.0f).xxx, 1.0f); +} + +void fragment_main() { + textureSampleCompare_63fb83(); + return; +} diff --git a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.msl new file mode 100644 index 0000000000..bdcf85c11b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleCompare_63fb83(depthcube tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample_compare(tint_symbol_1, float3(0.0f), 1.0f); +} + +fragment void fragment_main(depthcube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_63fb83(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.wgsl new file mode 100644 index 0000000000..0012b5fa4c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/63fb83.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_63fb83() { + var res : f32 = textureSampleCompare(arg_0, arg_1, vec3(), 1.0f); +} + +@fragment +fn fragment_main() { + textureSampleCompare_63fb83(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl new file mode 100644 index 0000000000..71511d2256 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompare_a3ca7e() { + var res: f32 = textureSampleCompare(arg_0, arg_1, vec3(), 1, 1.f); +} + +@fragment +fn fragment_main() { + textureSampleCompare_a3ca7e(); +} diff --git a/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0eaad4f49f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_a3ca7e() { + float res = arg_0.SampleCmp(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +void fragment_main() { + textureSampleCompare_a3ca7e(); + return; +} diff --git a/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.msl new file mode 100644 index 0000000000..46e23e1e87 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleCompare_a3ca7e(depthcube_array tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample_compare(tint_symbol_1, float3(0.0f), 1, 1.0f); +} + +fragment void fragment_main(depthcube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_a3ca7e(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8ddb882a6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/a3ca7e.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_a3ca7e() { + var res : f32 = textureSampleCompare(arg_0, arg_1, vec3(), 1, 1.0f); +} + +@fragment +fn fragment_main() { + textureSampleCompare_a3ca7e(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl new file mode 100644 index 0000000000..18a4eaafcd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompare_af1051() { + var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.f, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleCompare_af1051(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..60ff0955b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_af1051() { + float res = arg_0.SampleCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleCompare_af1051(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60ff0955b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_af1051() { + float res = arg_0.SampleCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleCompare_af1051(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.glsl new file mode 100644 index 0000000000..e20d8bfe24 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.glsl @@ -0,0 +1,26 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompare_af1051() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleCompare_af1051(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.msl new file mode 100644 index 0000000000..beb211766d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleCompare_af1051(depth2d_array tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample_compare(tint_symbol_1, float2(0.0f), 1, 1.0f, int2(0)); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_af1051(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.spvasm new file mode 100644 index 0000000000..4e66ca9c71 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_af1051 "textureSampleCompare_af1051" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %15 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %25 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float +%textureSampleCompare_af1051 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_float Function %28 + %13 = OpLoad %7 %arg_1 + %14 = OpLoad %3 %arg_0 + %16 = OpSampledImage %15 %14 %13 + %19 = OpConvertSToF %float %int_1 + %22 = OpCompositeConstruct %v3float %float_0 %float_0 %19 + %12 = OpImageSampleDrefImplicitLod %float %16 %22 %float_1 ConstOffset %25 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %30 = OpLabel + %31 = OpFunctionCall %void %textureSampleCompare_af1051 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9f6fdea05 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/af1051.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_af1051() { + var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0f, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleCompare_af1051(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl new file mode 100644 index 0000000000..be3202524f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompare_dd431d() { + var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.f); +} + +@fragment +fn fragment_main() { + textureSampleCompare_dd431d(); +} diff --git a/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c8a7fb928 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dd431d() { + float res = arg_0.SampleCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); +} + +void fragment_main() { + textureSampleCompare_dd431d(); + return; +} diff --git a/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.msl new file mode 100644 index 0000000000..50d2af1fd0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleCompare_dd431d(depth2d_array tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample_compare(tint_symbol_1, float2(0.0f), 1, 1.0f); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_dd431d(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.wgsl new file mode 100644 index 0000000000..9737d12dd9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dd431d.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_dd431d() { + var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0f); +} + +@fragment +fn fragment_main() { + textureSampleCompare_dd431d(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl new file mode 100644 index 0000000000..58482d557f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompare_dec064() { + var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.f, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleCompare_dec064(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..04d19157eb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dec064() { + float res = arg_0.SampleCmp(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleCompare_dec064(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04d19157eb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dec064() { + float res = arg_0.SampleCmp(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +void fragment_main() { + textureSampleCompare_dec064(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.glsl new file mode 100644 index 0000000000..04d0da828e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompare_dec064() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleCompare_dec064(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.msl new file mode 100644 index 0000000000..87c9f9b0c5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void textureSampleCompare_dec064(depth2d tint_symbol, sampler tint_symbol_1) { + float res = tint_symbol.sample_compare(tint_symbol_1, float2(0.0f), 1.0f, int2(0)); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_dec064(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.spvasm new file mode 100644 index 0000000000..574e9c1d4d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_dec064 "textureSampleCompare_dec064" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %15 = OpTypeSampledImage %3 + %v2float = OpTypeVector %float 2 + %18 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %22 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float +%textureSampleCompare_dec064 = OpFunction %void None %8 + %11 = OpLabel + %res = OpVariable %_ptr_Function_float Function %25 + %13 = OpLoad %7 %arg_1 + %14 = OpLoad %3 %arg_0 + %16 = OpSampledImage %15 %14 %13 + %12 = OpImageSampleDrefImplicitLod %float %16 %18 %float_1 ConstOffset %22 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSampleCompare_dec064 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.wgsl new file mode 100644 index 0000000000..35620f4914 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompare/dec064.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_dec064() { + var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0f, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleCompare_dec064(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl new file mode 100644 index 0000000000..307b84fc15 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_1116ed() { + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1116ed(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_1116ed(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1116ed(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e84193e394 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1116ed() { + float res = arg_0.SampleCmpLevelZero(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1116ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1116ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1116ed(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e84193e394 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1116ed() { + float res = arg_0.SampleCmpLevelZero(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1116ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1116ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1116ed(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.glsl new file mode 100644 index 0000000000..573c22cf39 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_1116ed() { + float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_1116ed(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_1116ed() { + float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f)); +} + +void fragment_main() { + textureSampleCompareLevel_1116ed(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_1116ed() { + float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f)); +} + +void compute_main() { + textureSampleCompareLevel_1116ed(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.msl new file mode 100644 index 0000000000..822c2353bd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_1116ed(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(0.0f), 1, 1.0f, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_1116ed(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_1116ed(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_1116ed(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl new file mode 100644 index 0000000000..f41a8ab195 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_1116ed() { + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1116ed(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_1116ed(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1116ed(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl new file mode 100644 index 0000000000..285b9a3a6d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_1568e3() { + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec3(), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1568e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_1568e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1568e3(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2a79a0f099 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1568e3() { + float res = arg_0.SampleCmpLevelZero(arg_1, (0.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1568e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1568e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1568e3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2a79a0f099 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1568e3() { + float res = arg_0.SampleCmpLevelZero(arg_1, (0.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1568e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1568e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1568e3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.glsl new file mode 100644 index 0000000000..f805d0d6c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompareLevel_1568e3() { + float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 1.0f)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_1568e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompareLevel_1568e3() { + float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 1.0f)); +} + +void fragment_main() { + textureSampleCompareLevel_1568e3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompareLevel_1568e3() { + float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 1.0f)); +} + +void compute_main() { + textureSampleCompareLevel_1568e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.msl new file mode 100644 index 0000000000..7dffcdd0f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_1568e3(depthcube tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample_compare(tint_symbol_2, float3(0.0f), 1.0f, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_1568e3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_1568e3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_1568e3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7d7d34d7d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_1568e3() { + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec3(), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1568e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_1568e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1568e3(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl new file mode 100644 index 0000000000..2dda0ce6d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_2ad2b1() { + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_2ad2b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_2ad2b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_2ad2b1(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..999c761e1b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_2ad2b1() { + float res = arg_0.SampleCmpLevelZero(arg_1, (0.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_2ad2b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..999c761e1b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_2ad2b1() { + float res = arg_0.SampleCmpLevelZero(arg_1, (0.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_2ad2b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl new file mode 100644 index 0000000000..1bdaf881e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_2ad2b1() { + float res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_2ad2b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_2ad2b1() { + float res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f)); +} + +void fragment_main() { + textureSampleCompareLevel_2ad2b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_2ad2b1() { + float res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f)); +} + +void compute_main() { + textureSampleCompareLevel_2ad2b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl new file mode 100644 index 0000000000..cc8b9a7815 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_2ad2b1(depth2d tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(0.0f), 1.0f, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_2ad2b1(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_2ad2b1(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_2ad2b1(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..4eafbe218f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_2ad2b1() { + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_2ad2b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_2ad2b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_2ad2b1(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl new file mode 100644 index 0000000000..c5f07003d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_4cf3a2() { + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec3(), 1, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_4cf3a2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_4cf3a2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_4cf3a2(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..03160c2dbb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_4cf3a2() { + float res = arg_0.SampleCmpLevelZero(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_4cf3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..03160c2dbb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_4cf3a2() { + float res = arg_0.SampleCmpLevelZero(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_4cf3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl new file mode 100644 index 0000000000..50371428ae --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_4cf3a2() { + float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +vec4 vertex_main() { + textureSampleCompareLevel_4cf3a2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_4cf3a2() { + float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +void fragment_main() { + textureSampleCompareLevel_4cf3a2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_4cf3a2() { + float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +void compute_main() { + textureSampleCompareLevel_4cf3a2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl new file mode 100644 index 0000000000..8f6c17ea46 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_4cf3a2(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample_compare(tint_symbol_2, float3(0.0f), 1, 1.0f, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_4cf3a2(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_4cf3a2(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_4cf3a2(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl new file mode 100644 index 0000000000..04a1d79e81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_4cf3a2() { + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec3(), 1, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_4cf3a2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_4cf3a2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_4cf3a2(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl new file mode 100644 index 0000000000..e8e100be81 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompareLevel_7f2b9a() { + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_7f2b9a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_7f2b9a(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..772accae57 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_7f2b9a() { + float res = arg_0.SampleCmpLevelZero(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_7f2b9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..772accae57 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_7f2b9a() { + float res = arg_0.SampleCmpLevelZero(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_7f2b9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl new file mode 100644 index 0000000000..cec13f16cc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_7f2b9a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0)); +} + +void compute_main() { + textureSampleCompareLevel_7f2b9a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl new file mode 100644 index 0000000000..dbd5a686d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_7f2b9a(depth2d tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(0.0f), 1.0f, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_7f2b9a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_7f2b9a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_7f2b9a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm new file mode 100644 index 0000000000..98e9d4708b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_7f2b9a "textureSampleCompareLevel_7f2b9a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %30 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpTypeFunction %v4float +%textureSampleCompareLevel_7f2b9a = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleDrefExplicitLod %float %23 %25 %float_1 Lod|ConstOffset %float_0 %30 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..360df23c2d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_7f2b9a() { + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_7f2b9a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_7f2b9a(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl new file mode 100644 index 0000000000..80a3e8fddb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompareLevel_b6e47c() { + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_b6e47c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_b6e47c(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..536d764095 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_b6e47c() { + float res = arg_0.SampleCmpLevelZero(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_b6e47c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_b6e47c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..536d764095 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_b6e47c() { + float res = arg_0.SampleCmpLevelZero(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_b6e47c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_b6e47c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl new file mode 100644 index 0000000000..04915fc22b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_b6e47c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0)); +} + +void compute_main() { + textureSampleCompareLevel_b6e47c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.msl new file mode 100644 index 0000000000..44343c716b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_b6e47c(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(0.0f), 1, 1.0f, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_b6e47c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_b6e47c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_b6e47c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm new file mode 100644 index 0000000000..4194b1aa10 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_b6e47c "textureSampleCompareLevel_b6e47c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %35 = OpTypeFunction %v4float +%textureSampleCompareLevel_b6e47c = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageSampleDrefExplicitLod %float %23 %29 %float_1 Lod|ConstOffset %float_0 %32 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl new file mode 100644 index 0000000000..250717e572 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_b6e47c() { + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_b6e47c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_b6e47c(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl new file mode 100644 index 0000000000..2ed1691b85 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 +fn textureSampleGrad_21402b() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_21402b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_21402b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_21402b(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6012626387 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_21402b() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_21402b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_21402b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_21402b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6012626387 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_21402b() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_21402b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_21402b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_21402b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.glsl new file mode 100644 index 0000000000..4810d976d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_21402b() { + vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f)); +} + +vec4 vertex_main() { + textureSampleGrad_21402b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_21402b() { + vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f)); +} + +void fragment_main() { + textureSampleGrad_21402b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_21402b() { + vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f)); +} + +void compute_main() { + textureSampleGrad_21402b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.msl new file mode 100644 index 0000000000..e441de51be --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_21402b(texture3d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), gradient3d(float3(0.0f), float3(0.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_21402b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_21402b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_21402b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.wgsl new file mode 100644 index 0000000000..d51d0951b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/21402b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_21402b() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_21402b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_21402b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_21402b(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl new file mode 100644 index 0000000000..97d1c119fc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2) -> vec4 +fn textureSampleGrad_2ecd8f() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_2ecd8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_2ecd8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_2ecd8f(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3d01c5add9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_2ecd8f() { + float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, float(1)), (0.0f).xx, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_2ecd8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_2ecd8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_2ecd8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3d01c5add9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_2ecd8f() { + float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, float(1)), (0.0f).xx, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_2ecd8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_2ecd8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_2ecd8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.glsl new file mode 100644 index 0000000000..93bb758d13 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_2ecd8f() { + vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f)); +} + +vec4 vertex_main() { + textureSampleGrad_2ecd8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_2ecd8f() { + vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f)); +} + +void fragment_main() { + textureSampleGrad_2ecd8f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_2ecd8f() { + vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f)); +} + +void compute_main() { + textureSampleGrad_2ecd8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.msl new file mode 100644 index 0000000000..8b790203e9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_2ecd8f(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, gradient2d(float2(0.0f), float2(0.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_2ecd8f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_2ecd8f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_2ecd8f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..1319a44088 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/2ecd8f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_2ecd8f() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_2ecd8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_2ecd8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_2ecd8f(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl new file mode 100644 index 0000000000..37562f0c8c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2) -> vec4 +fn textureSampleGrad_521263() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_521263(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_521263(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_521263(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f581e3013e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_521263() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xx, (0.0f).xx, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_521263(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_521263(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_521263(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f581e3013e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_521263() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xx, (0.0f).xx, (0.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_521263(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_521263(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_521263(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.glsl new file mode 100644 index 0000000000..88da1c0f37 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_521263() { + vec4 res = textureGrad(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f)); +} + +vec4 vertex_main() { + textureSampleGrad_521263(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_521263() { + vec4 res = textureGrad(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f)); +} + +void fragment_main() { + textureSampleGrad_521263(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_521263() { + vec4 res = textureGrad(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f)); +} + +void compute_main() { + textureSampleGrad_521263(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.msl new file mode 100644 index 0000000000..902ba71b6b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_521263(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), gradient2d(float2(0.0f), float2(0.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_521263(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_521263(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_521263(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.wgsl new file mode 100644 index 0000000000..d8ade17810 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/521263.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_521263() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_521263(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_521263(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_521263(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl new file mode 100644 index 0000000000..6c17ac982f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_cube, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 +fn textureSampleGrad_5312f4() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5312f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_5312f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5312f4(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..180ee4f81f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5312f4() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5312f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5312f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5312f4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..180ee4f81f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5312f4() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5312f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5312f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5312f4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.glsl new file mode 100644 index 0000000000..5f7c389b6e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleGrad_5312f4() { + vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f)); +} + +vec4 vertex_main() { + textureSampleGrad_5312f4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleGrad_5312f4() { + vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f)); +} + +void fragment_main() { + textureSampleGrad_5312f4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleGrad_5312f4() { + vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f)); +} + +void compute_main() { + textureSampleGrad_5312f4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.msl new file mode 100644 index 0000000000..397cc5f3c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_5312f4(texturecube tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), gradientcube(float3(0.0f), float3(0.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_5312f4(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_5312f4(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_5312f4(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.wgsl new file mode 100644 index 0000000000..53ed7ccab8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5312f4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_5312f4() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5312f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_5312f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5312f4(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl new file mode 100644 index 0000000000..0dd5898390 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, @const offset: vec3) -> vec4 +fn textureSampleGrad_5884dd() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5884dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_5884dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5884dd(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..56c120b251 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5884dd() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5884dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5884dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5884dd(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56c120b251 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5884dd() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5884dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5884dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5884dd(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.glsl new file mode 100644 index 0000000000..f5d0ae8afa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f), ivec3(0)); +} + +vec4 vertex_main() { + textureSampleGrad_5884dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f), ivec3(0)); +} + +void fragment_main() { + textureSampleGrad_5884dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f), vec3(0.0f), vec3(0.0f), ivec3(0)); +} + +void compute_main() { + textureSampleGrad_5884dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.msl new file mode 100644 index 0000000000..7a7fc53aa5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_5884dd(texture3d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), gradient3d(float3(0.0f), float3(0.0f)), int3(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_5884dd(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_5884dd(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_5884dd(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..2ca064c4fd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_5884dd "textureSampleGrad_5884dd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %25 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %28 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_5884dd = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleExplicitLod %v4float %23 %25 Grad|ConstOffset %25 %25 %28 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..88315962b0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/5884dd.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_5884dd() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5884dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_5884dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5884dd(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl new file mode 100644 index 0000000000..3618f2c538 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 +fn textureSampleGrad_d4e3c5() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d4e3c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_d4e3c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d4e3c5(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6ec5b46654 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d4e3c5() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xx, (0.0f).xx, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d4e3c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d4e3c5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ec5b46654 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d4e3c5() { + float4 res = arg_0.SampleGrad(arg_1, (0.0f).xx, (0.0f).xx, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d4e3c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d4e3c5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.glsl new file mode 100644 index 0000000000..21f3947b20 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleGrad_d4e3c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +void compute_main() { + textureSampleGrad_d4e3c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.msl new file mode 100644 index 0000000000..7b6d2955df --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_d4e3c5(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), gradient2d(float2(0.0f), float2(0.0f)), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_d4e3c5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_d4e3c5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_d4e3c5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.spvasm new file mode 100644 index 0000000000..cdcaae1234 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_d4e3c5 "textureSampleGrad_d4e3c5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %28 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_d4e3c5 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleExplicitLod %v4float %23 %25 Grad|ConstOffset %25 %25 %28 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..af2f0c48c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d4e3c5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_d4e3c5() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d4e3c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_d4e3c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d4e3c5(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl new file mode 100644 index 0000000000..c3e0fe82f8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 +fn textureSampleGrad_d65515() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d65515(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_d65515(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d65515(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a31475ce9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d65515() { + float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, float(1)), (0.0f).xx, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d65515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d65515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d65515(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a31475ce9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d65515() { + float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, float(1)), (0.0f).xx, (0.0f).xx, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d65515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d65515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d65515(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.glsl new file mode 100644 index 0000000000..3857b5751a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleGrad_d65515(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +void fragment_main() { + textureSampleGrad_d65515(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f), vec2(0.0f), ivec2(0)); +} + +void compute_main() { + textureSampleGrad_d65515(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.msl new file mode 100644 index 0000000000..84f4c0c7b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_d65515(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, gradient2d(float2(0.0f), float2(0.0f)), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_d65515(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_d65515(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_d65515(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.spvasm new file mode 100644 index 0000000000..70acbbc0f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_d65515 "textureSampleGrad_d65515" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2float = OpTypeVector %float 2 + %31 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 + %33 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_d65515 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageSampleExplicitLod %v4float %23 %29 Grad|ConstOffset %31 %31 %33 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.wgsl new file mode 100644 index 0000000000..e62ecef990 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/d65515.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_d65515() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2(), vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d65515(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_d65515(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d65515(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl new file mode 100644 index 0000000000..103bb190cd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, ddx: vec3, ddy: vec3) -> vec4 +fn textureSampleGrad_e383db() { + var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), 1, vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_e383db(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_e383db(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_e383db(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..990fc90b9e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_e383db() { + float4 res = arg_0.SampleGrad(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), (0.0f).xxx, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_e383db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_e383db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_e383db(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..990fc90b9e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_e383db() { + float4 res = arg_0.SampleGrad(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), (0.0f).xxx, (0.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_e383db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_e383db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_e383db(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.glsl new file mode 100644 index 0000000000..43f6aad626 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleGrad_e383db() { + vec4 res = textureGrad(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), vec3(0.0f), vec3(0.0f)); +} + +vec4 vertex_main() { + textureSampleGrad_e383db(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleGrad_e383db() { + vec4 res = textureGrad(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), vec3(0.0f), vec3(0.0f)); +} + +void fragment_main() { + textureSampleGrad_e383db(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleGrad_e383db() { + vec4 res = textureGrad(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), vec3(0.0f), vec3(0.0f)); +} + +void compute_main() { + textureSampleGrad_e383db(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.msl new file mode 100644 index 0000000000..fcee1d0eb3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleGrad_e383db(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), 1, gradientcube(float3(0.0f), float3(0.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_e383db(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_e383db(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_e383db(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb414626f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleGrad/e383db.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_e383db() { + var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), 1, vec3(), vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_e383db(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_e383db(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_e383db(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl new file mode 100644 index 0000000000..f2f822a745 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32) -> f32 +fn textureSampleLevel_02be59() { + var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_02be59(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_02be59(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_02be59(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..90c561b2b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_02be59() { + float res = arg_0.SampleLevel(arg_1, (0.0f).xx, 0).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_02be59(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_02be59(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_02be59(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..90c561b2b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_02be59() { + float res = arg_0.SampleLevel(arg_1, (0.0f).xx, 0).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_02be59(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_02be59(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_02be59(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.glsl new file mode 100644 index 0000000000..ce57e3a186 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_02be59() { + float res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0)); +} + +vec4 vertex_main() { + textureSampleLevel_02be59(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_02be59() { + float res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0)); +} + +void fragment_main() { + textureSampleLevel_02be59(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_02be59() { + float res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0)); +} + +void compute_main() { + textureSampleLevel_02be59(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.msl new file mode 100644 index 0000000000..a414d5244c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_02be59(depth2d tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_02be59(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_02be59(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_02be59(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b46a822bb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_02be59 "textureSampleLevel_02be59" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %23 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %26 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %29 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_02be59 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %21 = OpLoad %14 %arg_1 + %22 = OpLoad %11 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %27 = OpConvertSToF %float %29 + %20 = OpImageSampleExplicitLod %v4float %24 %26 Lod %27 + %19 = OpCompositeExtract %float %20 0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureSampleLevel_02be59 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureSampleLevel_02be59 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleLevel_02be59 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.wgsl new file mode 100644 index 0000000000..14b220ad7c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/02be59.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_02be59() { + var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_02be59(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_02be59(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_02be59(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl new file mode 100644 index 0000000000..0d7681a13b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, @const offset: vec2) -> vec4 +fn textureSampleLevel_0b0a1b() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0b0a1b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_0b0a1b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0b0a1b(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aee4c233d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0b0a1b() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0b0a1b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0b0a1b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aee4c233d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0b0a1b() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xx, 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0b0a1b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0b0a1b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.glsl new file mode 100644 index 0000000000..ef80252f31 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_0b0a1b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f), 1.0f, ivec2(0)); +} + +void compute_main() { + textureSampleLevel_0b0a1b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.msl new file mode 100644 index 0000000000..506a971caa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_0b0a1b(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), level(1.0f), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_0b0a1b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_0b0a1b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_0b0a1b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd46b38f9f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_0b0a1b "textureSampleLevel_0b0a1b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %25 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float +%textureSampleLevel_0b0a1b = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleExplicitLod %v4float %23 %25 Lod|ConstOffset %float_1 %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.wgsl new file mode 100644 index 0000000000..6ae1c9ed36 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0b0a1b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_0b0a1b() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0b0a1b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_0b0a1b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0b0a1b(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl new file mode 100644 index 0000000000..b0220c66cb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: f32) -> vec4 +fn textureSampleLevel_0bdd9a() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0bdd9a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_0bdd9a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0bdd9a(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ac5b0c514 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0bdd9a() { + float4 res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0bdd9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0bdd9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0bdd9a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ac5b0c514 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0bdd9a() { + float4 res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0bdd9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0bdd9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0bdd9a(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.glsl new file mode 100644 index 0000000000..22a75bfba9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleLevel_0bdd9a() { + vec4 res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +vec4 vertex_main() { + textureSampleLevel_0bdd9a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleLevel_0bdd9a() { + vec4 res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +void fragment_main() { + textureSampleLevel_0bdd9a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleLevel_0bdd9a() { + vec4 res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); +} + +void compute_main() { + textureSampleLevel_0bdd9a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.msl new file mode 100644 index 0000000000..8d56eb601b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_0bdd9a(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), 1, level(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_0bdd9a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_0bdd9a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_0bdd9a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..8cf28599d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/0bdd9a.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_0bdd9a() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0bdd9a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_0bdd9a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0bdd9a(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl new file mode 100644 index 0000000000..4a9a9f863d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3, level: i32) -> f32 +fn textureSampleLevel_1b0291() { + var res: f32 = textureSampleLevel(arg_0, arg_1, vec3(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1b0291(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_1b0291(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1b0291(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f73ebcfcbc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1b0291() { + float res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 0).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1b0291(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1b0291(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1b0291(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f73ebcfcbc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1b0291() { + float res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 0).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1b0291(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1b0291(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1b0291(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.glsl new file mode 100644 index 0000000000..5fddb81da2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleLevel_1b0291() { + float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 0.0f), float(0)); +} + +vec4 vertex_main() { + textureSampleLevel_1b0291(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureLod' : no matching overloaded function found +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleLevel_1b0291() { + float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 0.0f), float(0)); +} + +void fragment_main() { + textureSampleLevel_1b0291(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'textureLod' : no matching overloaded function found +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleLevel_1b0291() { + float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 0.0f), float(0)); +} + +void compute_main() { + textureSampleLevel_1b0291(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureLod' : no matching overloaded function found +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.msl new file mode 100644 index 0000000000..3ea7400f2b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_1b0291(depthcube tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_1b0291(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_1b0291(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_1b0291(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd488f86f3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_1b0291 "textureSampleLevel_1b0291" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %23 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %26 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %29 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_1b0291 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %21 = OpLoad %14 %arg_1 + %22 = OpLoad %11 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %27 = OpConvertSToF %float %29 + %20 = OpImageSampleExplicitLod %v4float %24 %26 Lod %27 + %19 = OpCompositeExtract %float %20 0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureSampleLevel_1b0291 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %textureSampleLevel_1b0291 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleLevel_1b0291 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.wgsl new file mode 100644 index 0000000000..52151bc571 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1b0291.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_1b0291() { + var res : f32 = textureSampleLevel(arg_0, arg_1, vec3(), 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1b0291(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_1b0291(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1b0291(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl new file mode 100644 index 0000000000..253050ab47 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32) -> f32 +fn textureSampleLevel_1bf73e() { + var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1bf73e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_1bf73e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1bf73e(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9628d6da53 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1bf73e() { + float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1bf73e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1bf73e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1bf73e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9628d6da53 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1bf73e() { + float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1bf73e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1bf73e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1bf73e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.glsl new file mode 100644 index 0000000000..b3a3c229b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_1bf73e() { + float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0)); +} + +vec4 vertex_main() { + textureSampleLevel_1bf73e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureLod' : no matching overloaded function found +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_1bf73e() { + float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0)); +} + +void fragment_main() { + textureSampleLevel_1bf73e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'textureLod' : no matching overloaded function found +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_1bf73e() { + float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0)); +} + +void compute_main() { + textureSampleLevel_1bf73e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureLod' : no matching overloaded function found +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.msl new file mode 100644 index 0000000000..9f8510d59a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_1bf73e(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_1bf73e(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_1bf73e(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_1bf73e(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.spvasm new file mode 100644 index 0000000000..00355c9d57 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_1bf73e "textureSampleLevel_1bf73e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %23 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %32 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_1bf73e = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %21 = OpLoad %14 %arg_1 + %22 = OpLoad %11 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %27 = OpConvertSToF %float %int_1 + %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27 + %31 = OpConvertSToF %float %32 + %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod %31 + %19 = OpCompositeExtract %float %20 0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleLevel_1bf73e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleLevel_1bf73e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleLevel_1bf73e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.wgsl new file mode 100644 index 0000000000..8771b3abcb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/1bf73e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_1bf73e() { + var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1bf73e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_1bf73e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1bf73e(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl new file mode 100644 index 0000000000..a25558579e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32) -> vec4 +fn textureSampleLevel_302be4() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_302be4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_302be4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_302be4(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..90cdd653d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_302be4() { + float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_302be4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_302be4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_302be4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..90cdd653d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_302be4() { + float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_302be4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_302be4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_302be4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.glsl new file mode 100644 index 0000000000..31ba66c04d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_302be4() { + vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); +} + +vec4 vertex_main() { + textureSampleLevel_302be4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_302be4() { + vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); +} + +void fragment_main() { + textureSampleLevel_302be4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_302be4() { + vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); +} + +void compute_main() { + textureSampleLevel_302be4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.msl new file mode 100644 index 0000000000..92ace1e5ec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_302be4(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_302be4(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_302be4(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_302be4(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.wgsl new file mode 100644 index 0000000000..d77eb70230 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/302be4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_302be4() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_302be4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_302be4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_302be4(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl new file mode 100644 index 0000000000..a23684aca7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, @const offset: vec2) -> f32 +fn textureSampleLevel_36780e() { + var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_36780e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_36780e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_36780e(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..960a0a4fcb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_36780e() { + float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_36780e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_36780e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_36780e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..960a0a4fcb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_36780e() { + float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_36780e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_36780e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_36780e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.glsl new file mode 100644 index 0000000000..39c836fa62 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_36780e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_36780e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:7: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:7: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0)); +} + +void compute_main() { + textureSampleLevel_36780e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:6: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.msl new file mode 100644 index 0000000000..cac62ab95b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_36780e(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_36780e(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_36780e(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_36780e(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f3edb6735 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_36780e "textureSampleLevel_36780e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %23 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %32 = OpConstantNull %int + %v2int = OpTypeVector %int 2 + %34 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_36780e = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %21 = OpLoad %14 %arg_1 + %22 = OpLoad %11 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %27 = OpConvertSToF %float %int_1 + %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27 + %31 = OpConvertSToF %float %32 + %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod|ConstOffset %31 %34 + %19 = OpCompositeExtract %float %20 0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.wgsl new file mode 100644 index 0000000000..caff931b22 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/36780e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_36780e() { + var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_36780e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_36780e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_36780e(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl new file mode 100644 index 0000000000..0b57ed2383 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, @const offset: vec2) -> f32 +fn textureSampleLevel_749baf() { + var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_749baf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_749baf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_749baf(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a05a17b724 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_749baf() { + float res = arg_0.SampleLevel(arg_1, (0.0f).xx, 0, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_749baf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_749baf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_749baf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a05a17b724 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_749baf() { + float res = arg_0.SampleLevel(arg_1, (0.0f).xx, 0, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_749baf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_749baf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_749baf(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.glsl new file mode 100644 index 0000000000..6d73eaaf5a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_749baf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_749baf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0)); +} + +void compute_main() { + textureSampleLevel_749baf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.msl new file mode 100644 index 0000000000..360b8569c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_749baf(depth2d tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_749baf(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_749baf(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_749baf(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2b0e1f79a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_749baf "textureSampleLevel_749baf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %23 = OpTypeSampledImage %11 + %v2float = OpTypeVector %float 2 + %26 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %29 = OpConstantNull %int + %v2int = OpTypeVector %int 2 + %31 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_749baf = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %21 = OpLoad %14 %arg_1 + %22 = OpLoad %11 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %27 = OpConvertSToF %float %29 + %20 = OpImageSampleExplicitLod %v4float %24 %26 Lod|ConstOffset %27 %31 + %19 = OpCompositeExtract %float %20 0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.wgsl new file mode 100644 index 0000000000..73109bbc38 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/749baf.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_749baf() { + var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_749baf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_749baf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_749baf(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl new file mode 100644 index 0000000000..34367ee0d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_external; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2) -> vec4 +fn textureSampleLevel_979816() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_979816(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_979816(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_979816(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..914a3c9c56 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.dxc.hlsl @@ -0,0 +1,112 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t2, space1); +cbuffer cbuffer_ext_tex_params : register(b3, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureSampleExternal(Texture2D plane0, Texture2D plane1, SamplerState smp, float2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.SampleLevel(smp, coord, 0.0f).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureSampleLevel_979816() { + float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, (0.0f).xx, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_979816(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_979816(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_979816(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..914a3c9c56 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.fxc.hlsl @@ -0,0 +1,112 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t2, space1); +cbuffer cbuffer_ext_tex_params : register(b3, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureSampleExternal(Texture2D plane0, Texture2D plane1, SamplerState smp, float2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.SampleLevel(smp, coord, 0.0f).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureSampleLevel_979816() { + float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, (0.0f).xx, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_979816(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_979816(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_979816(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.glsl new file mode 100644 index 0000000000..68b71f1fb9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.glsl @@ -0,0 +1,237 @@ +SKIP: FAILED + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 3) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + + +vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = textureLod(plane0_smp, coord, 0.0f).rgb; + } else { + color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_arg_1; +uniform highp sampler2D ext_tex_plane_1_arg_1; +void textureSampleLevel_979816() { + vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, vec2(0.0f), ext_tex_params); +} + +vec4 vertex_main() { + textureSampleLevel_979816(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:58: 'textureSampleExternal' : no matching overloaded function found +ERROR: 0:58: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:58: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 3) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + + +vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = textureLod(plane0_smp, coord, 0.0f).rgb; + } else { + color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_arg_1; +uniform highp sampler2D ext_tex_plane_1_arg_1; +void textureSampleLevel_979816() { + vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, vec2(0.0f), ext_tex_params); +} + +void fragment_main() { + textureSampleLevel_979816(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:59: 'textureSampleExternal' : no matching overloaded function found +ERROR: 0:59: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' +ERROR: 0:59: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 3) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + + +vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = textureLod(plane0_smp, coord, 0.0f).rgb; + } else { + color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_arg_1; +uniform highp sampler2D ext_tex_plane_1_arg_1; +void textureSampleLevel_979816() { + vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, vec2(0.0f), ext_tex_params); +} + +void compute_main() { + textureSampleLevel_979816(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:58: 'textureSampleExternal' : no matching overloaded function found +ERROR: 0:58: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:58: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.msl new file mode 100644 index 0000000000..5b65152baf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct GammaTransferParams { + /* 0x0000 */ float G; + /* 0x0004 */ float A; + /* 0x0008 */ float B; + /* 0x000c */ float C; + /* 0x0010 */ float D; + /* 0x0014 */ float E; + /* 0x0018 */ float F; + /* 0x001c */ uint padding; +}; + +struct ExternalTextureParams { + /* 0x0000 */ uint numPlanes; + /* 0x0004 */ uint doYuvToRgbConversionOnly; + /* 0x0008 */ tint_array tint_pad; + /* 0x0010 */ float3x4 yuvToRgbConversionMatrix; + /* 0x0040 */ GammaTransferParams gammaDecodeParams; + /* 0x0060 */ GammaTransferParams gammaEncodeParams; + /* 0x0080 */ float3x3 gamutConversionMatrix; +}; + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + bool3 const cond = (fabs(v) < float3(params.D)); + float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F)); + float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E)); + return select(f, t, cond); +} + +float4 textureSampleExternal(texture2d plane0, texture2d plane1, sampler smp, float2 coord, ExternalTextureParams params) { + float3 color = 0.0f; + if ((params.numPlanes == 1u)) { + color = float4(plane0.sample(smp, coord, level(0.0f))).rgb; + } else { + color = (float4(plane0.sample(smp, coord, level(0.0f))[0], float4(plane1.sample(smp, coord, level(0.0f))).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +void textureSampleLevel_979816(texture2d tint_symbol_1, texture2d tint_symbol_2, sampler tint_symbol_3, const constant ExternalTextureParams* const tint_symbol_4) { + float4 res = textureSampleExternal(tint_symbol_1, tint_symbol_2, tint_symbol_3, float2(0.0f), *(tint_symbol_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_5, texture2d tint_symbol_6, sampler tint_symbol_7, const constant ExternalTextureParams* const tint_symbol_8) { + textureSampleLevel_979816(tint_symbol_5, tint_symbol_6, tint_symbol_7, tint_symbol_8); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_9 [[texture(0)]], texture2d tint_symbol_10 [[texture(1)]], sampler tint_symbol_11 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_13 [[texture(0)]], texture2d tint_symbol_14 [[texture(1)]], sampler tint_symbol_15 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_16 [[buffer(2)]]) { + textureSampleLevel_979816(tint_symbol_13, tint_symbol_14, tint_symbol_15, tint_symbol_16); + return; +} + +kernel void compute_main(texture2d tint_symbol_17 [[texture(0)]], texture2d tint_symbol_18 [[texture(1)]], sampler tint_symbol_19 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_20 [[buffer(2)]]) { + textureSampleLevel_979816(tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.spvasm new file mode 100644 index 0000000000..444e4c2c9e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.spvasm @@ -0,0 +1,248 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 140 +; Schema: 0 + OpCapability Shader + %30 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ExternalTextureParams "ExternalTextureParams" + OpMemberName %ExternalTextureParams 0 "numPlanes" + OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly" + OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 3 "gammaDecodeParams" + OpName %GammaTransferParams "GammaTransferParams" + OpMemberName %GammaTransferParams 0 "G" + OpMemberName %GammaTransferParams 1 "A" + OpMemberName %GammaTransferParams 2 "B" + OpMemberName %GammaTransferParams 3 "C" + OpMemberName %GammaTransferParams 4 "D" + OpMemberName %GammaTransferParams 5 "E" + OpMemberName %GammaTransferParams 6 "F" + OpMemberName %GammaTransferParams 7 "padding" + OpMemberName %ExternalTextureParams 4 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix" + OpName %ext_tex_params "ext_tex_params" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %gammaCorrection "gammaCorrection" + OpName %v "v" + OpName %params "params" + OpName %textureSampleExternal "textureSampleExternal" + OpName %plane0 "plane0" + OpName %plane1 "plane1" + OpName %smp "smp" + OpName %coord "coord" + OpName %params_0 "params" + OpName %color "color" + OpName %textureSampleLevel_979816 "textureSampleLevel_979816" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %ext_tex_plane_1 DescriptorSet 1 + OpDecorate %ext_tex_plane_1 Binding 2 + OpDecorate %ExternalTextureParams Block + OpMemberDecorate %ExternalTextureParams 0 Offset 0 + OpMemberDecorate %ExternalTextureParams 1 Offset 4 + OpMemberDecorate %ExternalTextureParams 2 Offset 16 + OpMemberDecorate %ExternalTextureParams 2 ColMajor + OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 3 Offset 64 + OpMemberDecorate %GammaTransferParams 0 Offset 0 + OpMemberDecorate %GammaTransferParams 1 Offset 4 + OpMemberDecorate %GammaTransferParams 2 Offset 8 + OpMemberDecorate %GammaTransferParams 3 Offset 12 + OpMemberDecorate %GammaTransferParams 4 Offset 16 + OpMemberDecorate %GammaTransferParams 5 Offset 20 + OpMemberDecorate %GammaTransferParams 6 Offset 24 + OpMemberDecorate %GammaTransferParams 7 Offset 28 + OpMemberDecorate %ExternalTextureParams 4 Offset 96 + OpMemberDecorate %ExternalTextureParams 5 Offset 128 + OpMemberDecorate %ExternalTextureParams 5 ColMajor + OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16 + OpDecorate %ext_tex_params NonWritable + OpDecorate %ext_tex_params DescriptorSet 1 + OpDecorate %ext_tex_params Binding 3 + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 +%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 +%mat3v4float = OpTypeMatrix %v4float 3 +%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams +%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %23 = OpTypeSampler +%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 + %arg_1 = OpVariable %_ptr_UniformConstant_23 UniformConstant + %24 = OpTypeFunction %v3float %v3float %GammaTransferParams + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %44 = OpConstantNull %v3float + %v2float = OpTypeVector %float 2 + %64 = OpTypeFunction %v4float %11 %11 %23 %v2float %ExternalTextureParams + %uint_1 = OpConstant %uint 1 + %81 = OpTypeSampledImage %11 + %float_1 = OpConstant %float 1 + %97 = OpConstantNull %uint + %void = OpTypeVoid + %115 = OpTypeFunction %void + %123 = OpConstantNull %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %127 = OpTypeFunction %v4float +%gammaCorrection = OpFunction %v3float None %24 + %v = OpFunctionParameter %v3float + %params = OpFunctionParameter %GammaTransferParams + %28 = OpLabel + %42 = OpVariable %_ptr_Function_v3float Function %44 + %54 = OpVariable %_ptr_Function_v3float Function %44 + %60 = OpVariable %_ptr_Function_v3float Function %44 + %29 = OpExtInst %v3float %30 FAbs %v + %31 = OpCompositeExtract %float %params 4 + %32 = OpCompositeConstruct %v3float %31 %31 %31 + %33 = OpFOrdLessThan %v3bool %29 %32 + %36 = OpExtInst %v3float %30 FSign %v + %37 = OpCompositeExtract %float %params 3 + %38 = OpExtInst %v3float %30 FAbs %v + %39 = OpVectorTimesScalar %v3float %38 %37 + %40 = OpCompositeExtract %float %params 6 + %45 = OpCompositeConstruct %v3float %40 %40 %40 + %41 = OpFAdd %v3float %39 %45 + %46 = OpFMul %v3float %36 %41 + %47 = OpExtInst %v3float %30 FSign %v + %49 = OpCompositeExtract %float %params 1 + %50 = OpExtInst %v3float %30 FAbs %v + %51 = OpVectorTimesScalar %v3float %50 %49 + %52 = OpCompositeExtract %float %params 2 + %55 = OpCompositeConstruct %v3float %52 %52 %52 + %53 = OpFAdd %v3float %51 %55 + %56 = OpCompositeExtract %float %params 0 + %57 = OpCompositeConstruct %v3float %56 %56 %56 + %48 = OpExtInst %v3float %30 Pow %53 %57 + %58 = OpCompositeExtract %float %params 5 + %61 = OpCompositeConstruct %v3float %58 %58 %58 + %59 = OpFAdd %v3float %48 %61 + %62 = OpFMul %v3float %47 %59 + %63 = OpSelect %v3float %33 %46 %62 + OpReturnValue %63 + OpFunctionEnd +%textureSampleExternal = OpFunction %v4float None %64 + %plane0 = OpFunctionParameter %11 + %plane1 = OpFunctionParameter %11 + %smp = OpFunctionParameter %23 + %coord = OpFunctionParameter %v2float + %params_0 = OpFunctionParameter %ExternalTextureParams + %72 = OpLabel + %color = OpVariable %_ptr_Function_v3float Function %44 + %74 = OpCompositeExtract %uint %params_0 0 + %76 = OpIEqual %bool %74 %uint_1 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %82 = OpSampledImage %81 %plane0 %smp + %80 = OpImageSampleExplicitLod %v4float %82 %coord Lod %8 + %83 = OpVectorShuffle %v3float %80 %80 0 1 2 + OpStore %color %83 + OpBranch %77 + %79 = OpLabel + %85 = OpSampledImage %81 %plane0 %smp + %84 = OpImageSampleExplicitLod %v4float %85 %coord Lod %8 + %86 = OpCompositeExtract %float %84 0 + %88 = OpSampledImage %81 %plane1 %smp + %87 = OpImageSampleExplicitLod %v4float %88 %coord Lod %8 + %89 = OpVectorShuffle %v2float %87 %87 0 1 + %90 = OpCompositeExtract %float %89 0 + %91 = OpCompositeExtract %float %89 1 + %93 = OpCompositeConstruct %v4float %86 %90 %91 %float_1 + %94 = OpCompositeExtract %mat3v4float %params_0 2 + %95 = OpVectorTimesMatrix %v3float %93 %94 + OpStore %color %95 + OpBranch %77 + %77 = OpLabel + %96 = OpCompositeExtract %uint %params_0 1 + %98 = OpIEqual %bool %96 %97 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %99 + %100 = OpLabel + %102 = OpLoad %v3float %color + %103 = OpCompositeExtract %GammaTransferParams %params_0 3 + %101 = OpFunctionCall %v3float %gammaCorrection %102 %103 + OpStore %color %101 + %104 = OpCompositeExtract %mat3v3float %params_0 5 + %105 = OpLoad %v3float %color + %106 = OpMatrixTimesVector %v3float %104 %105 + OpStore %color %106 + %108 = OpLoad %v3float %color + %109 = OpCompositeExtract %GammaTransferParams %params_0 4 + %107 = OpFunctionCall %v3float %gammaCorrection %108 %109 + OpStore %color %107 + OpBranch %99 + %99 = OpLabel + %110 = OpLoad %v3float %color + %111 = OpCompositeExtract %float %110 0 + %112 = OpCompositeExtract %float %110 1 + %113 = OpCompositeExtract %float %110 2 + %114 = OpCompositeConstruct %v4float %111 %112 %113 %float_1 + OpReturnValue %114 + OpFunctionEnd +%textureSampleLevel_979816 = OpFunction %void None %115 + %118 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %120 = OpLoad %11 %arg_0 + %121 = OpLoad %11 %ext_tex_plane_1 + %122 = OpLoad %23 %arg_1 + %124 = OpLoad %ExternalTextureParams %ext_tex_params + %119 = OpFunctionCall %v4float %textureSampleExternal %120 %121 %122 %123 %124 + OpStore %res %119 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %127 + %129 = OpLabel + %130 = OpFunctionCall %void %textureSampleLevel_979816 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %115 + %132 = OpLabel + %133 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %133 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %115 + %135 = OpLabel + %136 = OpFunctionCall %void %textureSampleLevel_979816 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %115 + %138 = OpLabel + %139 = OpFunctionCall %void %textureSampleLevel_979816 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.wgsl new file mode 100644 index 0000000000..2583d0f8f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_external; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_979816() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_979816(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_979816(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_979816(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl new file mode 100644 index 0000000000..9a44eac1e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32) -> vec4 +fn textureSampleLevel_abfcc0() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_abfcc0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_abfcc0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_abfcc0(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5986acede1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_abfcc0() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_abfcc0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_abfcc0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_abfcc0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5986acede1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_abfcc0() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_abfcc0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_abfcc0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_abfcc0(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.glsl new file mode 100644 index 0000000000..866afa3b4d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_abfcc0() { + vec4 res = textureLod(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +vec4 vertex_main() { + textureSampleLevel_abfcc0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_abfcc0() { + vec4 res = textureLod(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +void fragment_main() { + textureSampleLevel_abfcc0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_abfcc0() { + vec4 res = textureLod(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +void compute_main() { + textureSampleLevel_abfcc0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.msl new file mode 100644 index 0000000000..26f2cb2781 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_abfcc0(texture3d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), level(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_abfcc0(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_abfcc0(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_abfcc0(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.wgsl new file mode 100644 index 0000000000..b7ef5ae6d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/abfcc0.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_abfcc0() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_abfcc0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_abfcc0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_abfcc0(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl new file mode 100644 index 0000000000..08a0c3cb56 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: i32) -> f32 +fn textureSampleLevel_ae5e39() { + var res: f32 = textureSampleLevel(arg_0, arg_1, vec3(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_ae5e39(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_ae5e39(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_ae5e39(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7c2d3abf2a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_ae5e39() { + float res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 0).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_ae5e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_ae5e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_ae5e39(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c2d3abf2a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_ae5e39() { + float res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 0).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_ae5e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_ae5e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_ae5e39(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.glsl new file mode 100644 index 0000000000..d619a9b8b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleLevel_ae5e39() { + float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), float(0)); +} + +vec4 vertex_main() { + textureSampleLevel_ae5e39(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleLevel_ae5e39() { + float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), float(0)); +} + +void fragment_main() { + textureSampleLevel_ae5e39(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleLevel_ae5e39() { + float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), float(0)); +} + +void compute_main() { + textureSampleLevel_ae5e39(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.msl new file mode 100644 index 0000000000..483402a34e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_ae5e39(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), 1, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_ae5e39(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_ae5e39(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_ae5e39(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.spvasm new file mode 100644 index 0000000000..460f8a25ec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_ae5e39 "textureSampleLevel_ae5e39" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %23 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %31 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_ae5e39 = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + %21 = OpLoad %14 %arg_1 + %22 = OpLoad %11 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %26 + %30 = OpConvertSToF %float %31 + %20 = OpImageSampleExplicitLod %v4float %24 %29 Lod %30 + %19 = OpCompositeExtract %float %20 0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureSampleLevel_ae5e39 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_ae5e39 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_ae5e39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.wgsl new file mode 100644 index 0000000000..707f48a83c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/ae5e39.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_ae5e39() { + var res : f32 = textureSampleLevel(arg_0, arg_1, vec3(), 1, 0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_ae5e39(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_ae5e39(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_ae5e39(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl new file mode 100644 index 0000000000..f9d9d701fc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, @const offset: vec2) -> vec4 +fn textureSampleLevel_b7c55c() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_b7c55c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_b7c55c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_b7c55c(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f3441f975 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_b7c55c() { + float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_b7c55c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_b7c55c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_b7c55c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2f3441f975 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_b7c55c() { + float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_b7c55c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_b7c55c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_b7c55c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.glsl new file mode 100644 index 0000000000..31e57047bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_b7c55c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_b7c55c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0)); +} + +void compute_main() { + textureSampleLevel_b7c55c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.msl new file mode 100644 index 0000000000..8847f18bb0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_b7c55c(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(1.0f), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_b7c55c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_b7c55c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_b7c55c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f007230a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_b7c55c "textureSampleLevel_b7c55c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureSampleLevel_b7c55c = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %26 = OpConvertSToF %float %int_1 + %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 + %19 = OpImageSampleExplicitLod %v4float %23 %29 Lod|ConstOffset %float_1 %32 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.wgsl new file mode 100644 index 0000000000..62ef601942 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/b7c55c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_b7c55c() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0f, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_b7c55c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_b7c55c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_b7c55c(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl new file mode 100644 index 0000000000..271fcc284f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_cube, sampler: sampler, coords: vec3, level: f32) -> vec4 +fn textureSampleLevel_c32df7() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c32df7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_c32df7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c32df7(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d48cf54ade --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c32df7() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c32df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c32df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c32df7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d48cf54ade --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c32df7() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c32df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c32df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c32df7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.glsl new file mode 100644 index 0000000000..af5177b85c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleLevel_c32df7() { + vec4 res = textureLod(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +vec4 vertex_main() { + textureSampleLevel_c32df7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleLevel_c32df7() { + vec4 res = textureLod(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +void fragment_main() { + textureSampleLevel_c32df7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleLevel_c32df7() { + vec4 res = textureLod(arg_0_arg_1, vec3(0.0f), 1.0f); +} + +void compute_main() { + textureSampleLevel_c32df7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.msl new file mode 100644 index 0000000000..d6a2800256 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_c32df7(texturecube tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), level(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_c32df7(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_c32df7(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_c32df7(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.wgsl new file mode 100644 index 0000000000..3aaea11c55 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c32df7.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_c32df7() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c32df7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_c32df7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c32df7(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl new file mode 100644 index 0000000000..32f687a87b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32) -> vec4 +fn textureSampleLevel_c6aca6() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c6aca6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_c6aca6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c6aca6(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4455778471 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c6aca6() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c6aca6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c6aca6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c6aca6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4455778471 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c6aca6() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xx, 1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c6aca6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c6aca6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c6aca6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.glsl new file mode 100644 index 0000000000..b2e3dd0840 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_c6aca6() { + vec4 res = textureLod(arg_0_arg_1, vec2(0.0f), 1.0f); +} + +vec4 vertex_main() { + textureSampleLevel_c6aca6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_c6aca6() { + vec4 res = textureLod(arg_0_arg_1, vec2(0.0f), 1.0f); +} + +void fragment_main() { + textureSampleLevel_c6aca6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_c6aca6() { + vec4 res = textureLod(arg_0_arg_1, vec2(0.0f), 1.0f); +} + +void compute_main() { + textureSampleLevel_c6aca6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.msl new file mode 100644 index 0000000000..a24cb0f08f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_c6aca6(texture2d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), level(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_c6aca6(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_c6aca6(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_c6aca6(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.wgsl new file mode 100644 index 0000000000..535b735b8f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/c6aca6.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_c6aca6() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c6aca6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_c6aca6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c6aca6(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl new file mode 100644 index 0000000000..f4852ba9ab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, @const offset: vec3) -> vec4 +fn textureSampleLevel_dcbecb() { + var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.f, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_dcbecb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_dcbecb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_dcbecb(); +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..806a05fd03 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_dcbecb() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 1.0f, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_dcbecb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_dcbecb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_dcbecb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..806a05fd03 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_dcbecb() { + float4 res = arg_0.SampleLevel(arg_1, (0.0f).xxx, 1.0f, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_dcbecb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_dcbecb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_dcbecb(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.glsl new file mode 100644 index 0000000000..6b2a1816de --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f), 1.0f, ivec3(0)); +} + +vec4 vertex_main() { + textureSampleLevel_dcbecb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f), 1.0f, ivec3(0)); +} + +void fragment_main() { + textureSampleLevel_dcbecb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f), 1.0f, ivec3(0)); +} + +void compute_main() { + textureSampleLevel_dcbecb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.msl new file mode 100644 index 0000000000..2eaac72baf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureSampleLevel_dcbecb(texture3d tint_symbol_1, sampler tint_symbol_2) { + float4 res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), level(1.0f), int3(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_dcbecb(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_dcbecb(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_dcbecb(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b3a57e311 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_dcbecb "textureSampleLevel_dcbecb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %22 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %25 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %29 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %32 = OpTypeFunction %v4float +%textureSampleLevel_dcbecb = OpFunction %void None %15 + %18 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %20 = OpLoad %14 %arg_1 + %21 = OpLoad %11 %arg_0 + %23 = OpSampledImage %22 %21 %20 + %19 = OpImageSampleExplicitLod %v4float %23 %25 Lod|ConstOffset %float_1 %29 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.wgsl new file mode 100644 index 0000000000..bdcaff8d2d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureSampleLevel/dcbecb.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_dcbecb() { + var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0f, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_dcbecb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_dcbecb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_dcbecb(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl new file mode 100644 index 0000000000..d7c656b411 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_05ce15() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_05ce15(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_05ce15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_05ce15(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..27477b0e4d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_05ce15() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_05ce15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_05ce15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_05ce15(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..27477b0e4d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_05ce15() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_05ce15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_05ce15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_05ce15(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.glsl new file mode 100644 index 0000000000..38abe73938 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureStore_05ce15() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_05ce15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureStore_05ce15() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_05ce15(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureStore_05ce15() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_05ce15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.msl new file mode 100644 index 0000000000..3a48638c93 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_05ce15(texture2d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_05ce15(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_05ce15(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_05ce15(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.wgsl new file mode 100644 index 0000000000..caefa60386 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/05ce15.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_05ce15() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_05ce15(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_05ce15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_05ce15(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl new file mode 100644 index 0000000000..43766a5449 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_064c7f() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_064c7f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_064c7f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_064c7f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c9130d7495 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_064c7f() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_064c7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_064c7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_064c7f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9130d7495 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_064c7f() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_064c7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_064c7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_064c7f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.glsl new file mode 100644 index 0000000000..855df0f55e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureStore_064c7f() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_064c7f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureStore_064c7f() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_064c7f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureStore_064c7f() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_064c7f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.msl new file mode 100644 index 0000000000..06feb27cf8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_064c7f(texture2d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_064c7f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_064c7f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_064c7f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.wgsl new file mode 100644 index 0000000000..9d552595b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/064c7f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_064c7f() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_064c7f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_064c7f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_064c7f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/068641.wgsl b/test/tint/builtins/gen/literal/textureStore/068641.wgsl new file mode 100644 index 0000000000..58871d9016 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/068641.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_068641() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_068641(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_068641(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_068641(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cbcf84d5eb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_068641() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_068641(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_068641(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_068641(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cbcf84d5eb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_068641() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_068641(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_068641(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_068641(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.glsl new file mode 100644 index 0000000000..453b7beee9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureStore_068641() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_068641(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureStore_068641() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_068641(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureStore_068641() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void compute_main() { + textureStore_068641(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.msl new file mode 100644 index 0000000000..1d3f94f71e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_068641(texture3d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_068641(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_068641(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_068641(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/068641.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/068641.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.wgsl new file mode 100644 index 0000000000..1e3ae926fc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/068641.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_068641() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_068641(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_068641(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_068641(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl new file mode 100644 index 0000000000..c53f356eb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_0af6b5() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0af6b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_0af6b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_0af6b5(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..388ae73302 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0af6b5() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0af6b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0af6b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0af6b5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..388ae73302 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0af6b5() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0af6b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0af6b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0af6b5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.glsl new file mode 100644 index 0000000000..dc7474e882 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureStore_0af6b5() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_0af6b5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureStore_0af6b5() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_0af6b5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureStore_0af6b5() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_0af6b5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.msl new file mode 100644 index 0000000000..dfe2b65849 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_0af6b5(texture2d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_0af6b5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_0af6b5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_0af6b5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..d6371ca9d8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0af6b5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_0af6b5() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0af6b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_0af6b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_0af6b5(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl new file mode 100644 index 0000000000..d3f825a3b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_0c3dff() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0c3dff(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_0c3dff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_0c3dff(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dcdd179da8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0c3dff() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0c3dff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0c3dff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0c3dff(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dcdd179da8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0c3dff() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0c3dff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0c3dff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0c3dff(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.glsl new file mode 100644 index 0000000000..4366f60a18 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureStore_0c3dff() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_0c3dff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureStore_0c3dff() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_0c3dff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureStore_0c3dff() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void compute_main() { + textureStore_0c3dff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.msl new file mode 100644 index 0000000000..64d849e1c7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_0c3dff(texture2d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_0c3dff(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_0c3dff(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_0c3dff(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.wgsl new file mode 100644 index 0000000000..14d2872b65 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/0c3dff.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_0c3dff() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0c3dff(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_0c3dff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_0c3dff(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/102722.wgsl b/test/tint/builtins/gen/literal/textureStore/102722.wgsl new file mode 100644 index 0000000000..39f21e5759 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/102722.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_102722() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_102722(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_102722(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_102722(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cf95c7c78a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_102722() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_102722(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_102722(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_102722(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cf95c7c78a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_102722() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_102722(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_102722(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_102722(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.glsl new file mode 100644 index 0000000000..0951b51ae2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_102722() { + imageStore(arg_0, 1, uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_102722(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_102722() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void fragment_main() { + textureStore_102722(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_102722() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void compute_main() { + textureStore_102722(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.msl new file mode 100644 index 0000000000..c4a5d5a5e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_102722(texture1d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_102722(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_102722(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_102722(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/102722.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/102722.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d6fc38b13 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/102722.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_102722() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_102722(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_102722(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_102722(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl new file mode 100644 index 0000000000..4f3ca4db77 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_1bbd08() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1bbd08(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_1bbd08(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_1bbd08(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21d658ecd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_1bbd08() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1bbd08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1bbd08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1bbd08(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21d658ecd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_1bbd08() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1bbd08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1bbd08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1bbd08(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.glsl new file mode 100644 index 0000000000..a26b65d8f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureStore_1bbd08() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_1bbd08(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureStore_1bbd08() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_1bbd08(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureStore_1bbd08() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_1bbd08(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.msl new file mode 100644 index 0000000000..c05a7e5254 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_1bbd08(texture3d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_1bbd08(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_1bbd08(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_1bbd08(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.wgsl new file mode 100644 index 0000000000..b6aa3ff4c9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1bbd08.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_1bbd08() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1bbd08(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_1bbd08(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_1bbd08(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl new file mode 100644 index 0000000000..8f065958cd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_1c02e7() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1c02e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_1c02e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_1c02e7(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f4ad1a0ebc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_1c02e7() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1c02e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1c02e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1c02e7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f4ad1a0ebc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_1c02e7() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1c02e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1c02e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1c02e7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.glsl new file mode 100644 index 0000000000..8e9601c049 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_1c02e7() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_1c02e7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_1c02e7() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void fragment_main() { + textureStore_1c02e7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_1c02e7() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void compute_main() { + textureStore_1c02e7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.msl new file mode 100644 index 0000000000..a17b971cc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_1c02e7(texture2d_array tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_1c02e7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_1c02e7(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_1c02e7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.wgsl new file mode 100644 index 0000000000..556621ddf0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/1c02e7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_1c02e7() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1c02e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_1c02e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_1c02e7(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/22d955.wgsl b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl new file mode 100644 index 0000000000..27e6ead97d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_22d955() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_22d955(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_22d955(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_22d955(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c998bd87fe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_22d955() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_22d955(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_22d955(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_22d955(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c998bd87fe --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_22d955() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_22d955(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_22d955(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_22d955(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.glsl new file mode 100644 index 0000000000..b904bcdfe5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_22d955() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_22d955(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_22d955() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void fragment_main() { + textureStore_22d955(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_22d955() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void compute_main() { + textureStore_22d955(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.msl new file mode 100644 index 0000000000..4bf37e188a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_22d955(texture2d_array tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_22d955(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_22d955(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_22d955(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/22d955.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.wgsl new file mode 100644 index 0000000000..cfb291c80e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/22d955.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_22d955() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_22d955(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_22d955(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_22d955(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl new file mode 100644 index 0000000000..1f5b0326ff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_26bf70() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_26bf70(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_26bf70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_26bf70(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7c666e2767 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_26bf70() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_26bf70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_26bf70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_26bf70(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c666e2767 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_26bf70() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_26bf70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_26bf70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_26bf70(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.glsl new file mode 100644 index 0000000000..b3fe0dd686 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_26bf70() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_26bf70(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_26bf70() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_26bf70(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_26bf70() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void compute_main() { + textureStore_26bf70(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.msl new file mode 100644 index 0000000000..9b32850462 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_26bf70(texture2d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_26bf70(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_26bf70(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_26bf70(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.wgsl new file mode 100644 index 0000000000..10aa757911 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/26bf70.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_26bf70() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_26bf70(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_26bf70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_26bf70(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl new file mode 100644 index 0000000000..faeb4ce74e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_2796b4() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2796b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2796b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2796b4(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95522d93a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_2796b4() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2796b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2796b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2796b4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95522d93a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_2796b4() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2796b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2796b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2796b4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.glsl new file mode 100644 index 0000000000..7c2a380ada --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureStore_2796b4() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_2796b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureStore_2796b4() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void fragment_main() { + textureStore_2796b4(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureStore_2796b4() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void compute_main() { + textureStore_2796b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.msl new file mode 100644 index 0000000000..0fc2e68278 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_2796b4(texture3d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_2796b4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_2796b4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_2796b4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..60ac36f593 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2796b4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_2796b4() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2796b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2796b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2796b4(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl new file mode 100644 index 0000000000..7e2a022e63 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_2ac6c7() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ac6c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2ac6c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2ac6c7(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a3e5a4c56c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ac6c7() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ac6c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ac6c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ac6c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a3e5a4c56c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ac6c7() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ac6c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ac6c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ac6c7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.glsl new file mode 100644 index 0000000000..f2680141cc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureStore_2ac6c7() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_2ac6c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureStore_2ac6c7() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void fragment_main() { + textureStore_2ac6c7(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureStore_2ac6c7() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void compute_main() { + textureStore_2ac6c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.msl new file mode 100644 index 0000000000..dc2cb995d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_2ac6c7(texture1d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_2ac6c7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_2ac6c7(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_2ac6c7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca7cc4f150 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ac6c7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_2ac6c7() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ac6c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2ac6c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2ac6c7(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl new file mode 100644 index 0000000000..f0319e1967 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_2eb2a4() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2eb2a4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2eb2a4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2eb2a4(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94f6628a51 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2eb2a4() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2eb2a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2eb2a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2eb2a4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..94f6628a51 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2eb2a4() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2eb2a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2eb2a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2eb2a4(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.glsl new file mode 100644 index 0000000000..2564492430 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureStore_2eb2a4() { + imageStore(arg_0, 1, uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_2eb2a4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureStore_2eb2a4() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void fragment_main() { + textureStore_2eb2a4(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureStore_2eb2a4() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void compute_main() { + textureStore_2eb2a4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.msl new file mode 100644 index 0000000000..015e052c30 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_2eb2a4(texture1d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_2eb2a4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_2eb2a4(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_2eb2a4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.wgsl new file mode 100644 index 0000000000..5399668be0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2eb2a4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_2eb2a4() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2eb2a4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2eb2a4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2eb2a4(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl new file mode 100644 index 0000000000..9e80a1af58 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_2ed2a3() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ed2a3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2ed2a3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2ed2a3(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38a94e741b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ed2a3() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ed2a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ed2a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ed2a3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38a94e741b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ed2a3() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ed2a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ed2a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ed2a3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.glsl new file mode 100644 index 0000000000..2500adfc3b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureStore_2ed2a3() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_2ed2a3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureStore_2ed2a3() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void fragment_main() { + textureStore_2ed2a3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureStore_2ed2a3() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void compute_main() { + textureStore_2ed2a3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.msl new file mode 100644 index 0000000000..e49cb9323f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_2ed2a3(texture1d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_2ed2a3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_2ed2a3(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_2ed2a3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.wgsl new file mode 100644 index 0000000000..daad961756 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/2ed2a3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_2ed2a3() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ed2a3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2ed2a3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2ed2a3(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/31745b.wgsl b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl new file mode 100644 index 0000000000..c05fab439a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_31745b() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_31745b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_31745b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_31745b(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a31872a0c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_31745b() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_31745b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_31745b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_31745b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a31872a0c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_31745b() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_31745b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_31745b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_31745b(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.glsl new file mode 100644 index 0000000000..a475f2221c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureStore_31745b() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_31745b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureStore_31745b() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void fragment_main() { + textureStore_31745b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureStore_31745b() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void compute_main() { + textureStore_31745b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.msl new file mode 100644 index 0000000000..fab9cdc9ef --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_31745b(texture2d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_31745b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_31745b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_31745b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/31745b.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.wgsl new file mode 100644 index 0000000000..028068121b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/31745b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_31745b() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_31745b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_31745b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_31745b(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/32f368.wgsl b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl new file mode 100644 index 0000000000..46c055db21 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_32f368() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_32f368(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_32f368(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_32f368(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a94d6b85f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_32f368() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_32f368(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_32f368(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_32f368(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a94d6b85f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_32f368() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_32f368(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_32f368(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_32f368(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.glsl new file mode 100644 index 0000000000..c2bf03813e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureStore_32f368() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_32f368(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureStore_32f368() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void fragment_main() { + textureStore_32f368(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureStore_32f368() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void compute_main() { + textureStore_32f368(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.msl new file mode 100644 index 0000000000..f60e099139 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_32f368(texture2d_array tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_32f368(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_32f368(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_32f368(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/32f368.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0d3f8bf97 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/32f368.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_32f368() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_32f368(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_32f368(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_32f368(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/331aee.wgsl b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl new file mode 100644 index 0000000000..bc098796bc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_331aee() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_331aee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_331aee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_331aee(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53f938c151 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_331aee() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_331aee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_331aee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_331aee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..53f938c151 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_331aee() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_331aee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_331aee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_331aee(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.glsl new file mode 100644 index 0000000000..150214d2ff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureStore_331aee() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_331aee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureStore_331aee() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_331aee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureStore_331aee() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_331aee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.msl new file mode 100644 index 0000000000..b79b25e9a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_331aee(texture3d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_331aee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_331aee(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_331aee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/331aee.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.wgsl new file mode 100644 index 0000000000..c56aa25c45 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/331aee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_331aee() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_331aee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_331aee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_331aee(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl new file mode 100644 index 0000000000..37e1c57f64 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_38e8d7() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_38e8d7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_38e8d7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_38e8d7(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8c2dd24718 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_38e8d7() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_38e8d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_38e8d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_38e8d7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c2dd24718 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_38e8d7() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_38e8d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_38e8d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_38e8d7(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.glsl new file mode 100644 index 0000000000..d898f5edab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_38e8d7() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_38e8d7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_38e8d7() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void fragment_main() { + textureStore_38e8d7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_38e8d7() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void compute_main() { + textureStore_38e8d7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.msl new file mode 100644 index 0000000000..ac1cd5a628 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_38e8d7(texture2d_array tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_38e8d7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_38e8d7(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_38e8d7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.wgsl new file mode 100644 index 0000000000..e586ff1e07 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/38e8d7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_38e8d7() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_38e8d7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_38e8d7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_38e8d7(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl new file mode 100644 index 0000000000..8422dd4c9a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_3a52ac() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3a52ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3a52ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3a52ac(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b0fd8b1572 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3a52ac() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3a52ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3a52ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3a52ac(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b0fd8b1572 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3a52ac() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3a52ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3a52ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3a52ac(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.glsl new file mode 100644 index 0000000000..604ece29f6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_3a52ac() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_3a52ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_3a52ac() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void fragment_main() { + textureStore_3a52ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_3a52ac() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void compute_main() { + textureStore_3a52ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.msl new file mode 100644 index 0000000000..b40ea4b89b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_3a52ac(texture2d_array tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_3a52ac(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_3a52ac(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_3a52ac(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..a3aa110123 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3a52ac.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_3a52ac() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3a52ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3a52ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3a52ac(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl new file mode 100644 index 0000000000..5d9dcff914 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_3bb7a1() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bb7a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3bb7a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3bb7a1(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..879dea5d93 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3bb7a1() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bb7a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bb7a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bb7a1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..879dea5d93 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3bb7a1() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bb7a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bb7a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bb7a1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.glsl new file mode 100644 index 0000000000..52c2ee4f1e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureStore_3bb7a1() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_3bb7a1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureStore_3bb7a1() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void fragment_main() { + textureStore_3bb7a1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureStore_3bb7a1() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void compute_main() { + textureStore_3bb7a1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.msl new file mode 100644 index 0000000000..8cd1fce5b1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_3bb7a1(texture2d_array tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_3bb7a1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_3bb7a1(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_3bb7a1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1b1b8dcdd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bb7a1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_3bb7a1() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bb7a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3bb7a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3bb7a1(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl new file mode 100644 index 0000000000..5eca58954c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_3bec15() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bec15(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3bec15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3bec15(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cc77637731 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_3bec15() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bec15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bec15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bec15(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc77637731 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_3bec15() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bec15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bec15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bec15(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.glsl new file mode 100644 index 0000000000..8f0f990785 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureStore_3bec15() { + imageStore(arg_0, 1, uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_3bec15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureStore_3bec15() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void fragment_main() { + textureStore_3bec15(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureStore_3bec15() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void compute_main() { + textureStore_3bec15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.msl new file mode 100644 index 0000000000..b08f7bbec9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_3bec15(texture1d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_3bec15(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_3bec15(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_3bec15(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.wgsl new file mode 100644 index 0000000000..96e2996ef8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/3bec15.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_3bec15() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bec15(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3bec15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3bec15(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl new file mode 100644 index 0000000000..41a440c7d6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_441ba8() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_441ba8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_441ba8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_441ba8(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2c79ae4d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_441ba8() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_441ba8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_441ba8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_441ba8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2c79ae4d9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_441ba8() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_441ba8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_441ba8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_441ba8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.glsl new file mode 100644 index 0000000000..5dfe9b5149 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_441ba8() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_441ba8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_441ba8() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_441ba8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_441ba8() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void compute_main() { + textureStore_441ba8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.msl new file mode 100644 index 0000000000..4d5772e40f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_441ba8(texture3d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_441ba8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_441ba8(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_441ba8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.wgsl new file mode 100644 index 0000000000..6014c40901 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/441ba8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_441ba8() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_441ba8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_441ba8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_441ba8(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl new file mode 100644 index 0000000000..a1f4e4df8d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_4fc057() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_4fc057(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_4fc057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_4fc057(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d485fcca1d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_4fc057() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_4fc057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_4fc057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_4fc057(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d485fcca1d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_4fc057() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_4fc057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_4fc057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_4fc057(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.glsl new file mode 100644 index 0000000000..4853b57771 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureStore_4fc057() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_4fc057(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureStore_4fc057() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void fragment_main() { + textureStore_4fc057(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureStore_4fc057() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void compute_main() { + textureStore_4fc057(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.msl new file mode 100644 index 0000000000..f3c66c8e2a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_4fc057(texture2d_array tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_4fc057(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_4fc057(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_4fc057(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.wgsl new file mode 100644 index 0000000000..a599ff7aa4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/4fc057.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_4fc057() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_4fc057(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_4fc057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_4fc057(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl new file mode 100644 index 0000000000..16e418494c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_5a2f8f() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_5a2f8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_5a2f8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_5a2f8f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7d0eb61fde --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_5a2f8f() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_5a2f8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_5a2f8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_5a2f8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7d0eb61fde --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_5a2f8f() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_5a2f8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_5a2f8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_5a2f8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.glsl new file mode 100644 index 0000000000..188004640a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureStore_5a2f8f() { + imageStore(arg_0, 1, ivec4(0)); +} + +vec4 vertex_main() { + textureStore_5a2f8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureStore_5a2f8f() { + imageStore(arg_0, 1, ivec4(0)); +} + +void fragment_main() { + textureStore_5a2f8f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureStore_5a2f8f() { + imageStore(arg_0, 1, ivec4(0)); +} + +void compute_main() { + textureStore_5a2f8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.msl new file mode 100644 index 0000000000..dde59b81dc --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_5a2f8f(texture1d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_5a2f8f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_5a2f8f(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_5a2f8f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..9e4b11f69d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/5a2f8f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_5a2f8f() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_5a2f8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_5a2f8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_5a2f8f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/60975f.wgsl b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl new file mode 100644 index 0000000000..6c5834baa5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_60975f() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_60975f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_60975f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_60975f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab19974898 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_60975f() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_60975f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_60975f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_60975f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ab19974898 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_60975f() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_60975f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_60975f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_60975f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.glsl new file mode 100644 index 0000000000..acc1ecebde --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureStore_60975f() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_60975f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureStore_60975f() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void fragment_main() { + textureStore_60975f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureStore_60975f() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void compute_main() { + textureStore_60975f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.msl new file mode 100644 index 0000000000..bc1e09a691 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_60975f(texture2d_array tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_60975f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_60975f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_60975f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/60975f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.wgsl new file mode 100644 index 0000000000..c723d57dcd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/60975f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_60975f() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_60975f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_60975f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_60975f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl new file mode 100644 index 0000000000..0328dbfff4 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_682fd6() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_682fd6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_682fd6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_682fd6(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b8d65ccc25 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_682fd6() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_682fd6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_682fd6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_682fd6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b8d65ccc25 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_682fd6() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_682fd6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_682fd6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_682fd6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.glsl new file mode 100644 index 0000000000..8b99c50a31 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_682fd6() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_682fd6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_682fd6() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_682fd6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_682fd6() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void compute_main() { + textureStore_682fd6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.msl new file mode 100644 index 0000000000..9fddf06672 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_682fd6(texture2d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_682fd6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_682fd6(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_682fd6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.wgsl new file mode 100644 index 0000000000..15cae1d748 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/682fd6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_682fd6() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_682fd6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_682fd6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_682fd6(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl new file mode 100644 index 0000000000..8c17e5cf9f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_6b75c3() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b75c3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6b75c3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6b75c3(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..df1c070909 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b75c3() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b75c3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b75c3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b75c3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..df1c070909 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b75c3() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b75c3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b75c3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b75c3(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.glsl new file mode 100644 index 0000000000..8d8e53ffea --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureStore_6b75c3() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_6b75c3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureStore_6b75c3() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void fragment_main() { + textureStore_6b75c3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureStore_6b75c3() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void compute_main() { + textureStore_6b75c3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.msl new file mode 100644 index 0000000000..a92d69acdd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_6b75c3(texture1d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_6b75c3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_6b75c3(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_6b75c3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.wgsl new file mode 100644 index 0000000000..da091c3ab6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b75c3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_6b75c3() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b75c3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6b75c3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6b75c3(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl new file mode 100644 index 0000000000..4d83993484 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_6b80d2() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b80d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6b80d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6b80d2(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a2e5c731dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b80d2() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b80d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b80d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b80d2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a2e5c731dd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b80d2() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b80d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b80d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b80d2(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.glsl new file mode 100644 index 0000000000..74eaa9fe1e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureStore_6b80d2() { + imageStore(arg_0, 1, ivec4(0)); +} + +vec4 vertex_main() { + textureStore_6b80d2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureStore_6b80d2() { + imageStore(arg_0, 1, ivec4(0)); +} + +void fragment_main() { + textureStore_6b80d2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureStore_6b80d2() { + imageStore(arg_0, 1, ivec4(0)); +} + +void compute_main() { + textureStore_6b80d2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.msl new file mode 100644 index 0000000000..b73343e5d3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_6b80d2(texture1d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_6b80d2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_6b80d2(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_6b80d2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.wgsl new file mode 100644 index 0000000000..85e0231b1a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6b80d2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_6b80d2() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b80d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6b80d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6b80d2(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl new file mode 100644 index 0000000000..47766aee94 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_6cff2e() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6cff2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6cff2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6cff2e(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a9f96b4e79 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_6cff2e() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6cff2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6cff2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6cff2e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a9f96b4e79 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_6cff2e() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6cff2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6cff2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6cff2e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.glsl new file mode 100644 index 0000000000..f4458c4cd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_6cff2e() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_6cff2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_6cff2e() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_6cff2e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_6cff2e() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void compute_main() { + textureStore_6cff2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.msl new file mode 100644 index 0000000000..8a1d6102a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_6cff2e(texture2d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_6cff2e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_6cff2e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_6cff2e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc09df811f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6cff2e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_6cff2e() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6cff2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6cff2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6cff2e(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/6da692.wgsl b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl new file mode 100644 index 0000000000..60957e3ad0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_6da692() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6da692(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6da692(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6da692(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..69e93a9006 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_6da692() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6da692(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6da692(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6da692(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..69e93a9006 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_6da692() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6da692(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6da692(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6da692(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.glsl new file mode 100644 index 0000000000..81dc6f56a7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_6da692() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_6da692(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_6da692() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void fragment_main() { + textureStore_6da692(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_6da692() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void compute_main() { + textureStore_6da692(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.msl new file mode 100644 index 0000000000..49e92c6810 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_6da692(texture2d_array tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_6da692(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_6da692(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_6da692(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/6da692.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba262d3bf6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/6da692.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_6da692() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6da692(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6da692(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6da692(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/731349.wgsl b/test/tint/builtins/gen/literal/textureStore/731349.wgsl new file mode 100644 index 0000000000..0a020bec2d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/731349.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_731349() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_731349(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_731349(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_731349(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c6837defba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_731349() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_731349(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_731349(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_731349(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6837defba --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_731349() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_731349(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_731349(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_731349(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.glsl new file mode 100644 index 0000000000..4d2e294a42 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureStore_731349() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_731349(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureStore_731349() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_731349(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureStore_731349() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_731349(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.msl new file mode 100644 index 0000000000..7d335e8646 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_731349(texture2d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_731349(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_731349(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_731349(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/731349.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/731349.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.wgsl new file mode 100644 index 0000000000..b659a87da6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/731349.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_731349() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_731349(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_731349(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_731349(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/752da6.wgsl b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl new file mode 100644 index 0000000000..1bd23fb815 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_752da6() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_752da6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_752da6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_752da6(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f65a408b89 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_752da6() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_752da6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_752da6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_752da6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f65a408b89 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_752da6() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_752da6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_752da6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_752da6(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.glsl new file mode 100644 index 0000000000..03ea3bb613 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureStore_752da6() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_752da6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureStore_752da6() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void fragment_main() { + textureStore_752da6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureStore_752da6() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void compute_main() { + textureStore_752da6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.msl new file mode 100644 index 0000000000..74e6cb2e5b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_752da6(texture2d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_752da6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_752da6(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_752da6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/752da6.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f4e06d7cd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/752da6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_752da6() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_752da6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_752da6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_752da6(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl new file mode 100644 index 0000000000..089ccf0bde --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_77c0ae() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_77c0ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_77c0ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_77c0ae(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..31d53b3d1a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_77c0ae() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_77c0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_77c0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_77c0ae(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31d53b3d1a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_77c0ae() { + arg_0[(0).xx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_77c0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_77c0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_77c0ae(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.glsl new file mode 100644 index 0000000000..34d7601173 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureStore_77c0ae() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_77c0ae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureStore_77c0ae() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_77c0ae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureStore_77c0ae() { + imageStore(arg_0, ivec2(0), uvec4(0u)); +} + +void compute_main() { + textureStore_77c0ae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.msl new file mode 100644 index 0000000000..b5866746b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_77c0ae(texture2d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_77c0ae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_77c0ae(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_77c0ae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.wgsl new file mode 100644 index 0000000000..ddc73be612 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/77c0ae.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_77c0ae() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_77c0ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_77c0ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_77c0ae(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl new file mode 100644 index 0000000000..973881dc96 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_7cec8d() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7cec8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_7cec8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_7cec8d(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a1a4198cf9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_7cec8d() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7cec8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7cec8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7cec8d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1a4198cf9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_7cec8d() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7cec8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7cec8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7cec8d(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.glsl new file mode 100644 index 0000000000..0de30607a0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_7cec8d() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_7cec8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_7cec8d() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void fragment_main() { + textureStore_7cec8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_7cec8d() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void compute_main() { + textureStore_7cec8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.msl new file mode 100644 index 0000000000..912d7c6124 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_7cec8d(texture2d_array tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_7cec8d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_7cec8d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_7cec8d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..5218558358 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7cec8d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_7cec8d() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7cec8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_7cec8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_7cec8d(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl new file mode 100644 index 0000000000..a84a68366a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_7f7fae() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7f7fae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_7f7fae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_7f7fae(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..35b13ff28b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_7f7fae() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7f7fae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7f7fae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7f7fae(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..35b13ff28b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_7f7fae() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7f7fae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7f7fae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7f7fae(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.glsl new file mode 100644 index 0000000000..33a010e985 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureStore_7f7fae() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_7f7fae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureStore_7f7fae() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void fragment_main() { + textureStore_7f7fae(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureStore_7f7fae() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void compute_main() { + textureStore_7f7fae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.msl new file mode 100644 index 0000000000..979f11c0bf --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_7f7fae(texture1d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_7f7fae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_7f7fae(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_7f7fae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.wgsl new file mode 100644 index 0000000000..eba8d52748 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/7f7fae.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_7f7fae() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7f7fae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_7f7fae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_7f7fae(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/804942.wgsl b/test/tint/builtins/gen/literal/textureStore/804942.wgsl new file mode 100644 index 0000000000..4ca2ffc526 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/804942.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_804942() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_804942(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_804942(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_804942(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..00b02cb6ca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_804942() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_804942(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_804942(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_804942(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..00b02cb6ca --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_804942() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_804942(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_804942(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_804942(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.glsl new file mode 100644 index 0000000000..7dc0f6d951 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureStore_804942() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_804942(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureStore_804942() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void fragment_main() { + textureStore_804942(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureStore_804942() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void compute_main() { + textureStore_804942(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.msl new file mode 100644 index 0000000000..f96343905c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_804942(texture2d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_804942(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_804942(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_804942(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/804942.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/804942.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.wgsl new file mode 100644 index 0000000000..06f7057e20 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/804942.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_804942() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_804942(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_804942(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_804942(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/805dae.wgsl b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl new file mode 100644 index 0000000000..9a73354106 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_805dae() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_805dae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_805dae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_805dae(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8abb6a896d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_805dae() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_805dae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_805dae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_805dae(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8abb6a896d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_805dae() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_805dae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_805dae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_805dae(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.glsl new file mode 100644 index 0000000000..2265a73449 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureStore_805dae() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_805dae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureStore_805dae() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_805dae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureStore_805dae() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_805dae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.msl new file mode 100644 index 0000000000..2dfb818f79 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_805dae(texture2d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_805dae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_805dae(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_805dae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/805dae.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.wgsl new file mode 100644 index 0000000000..7bc50679a5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/805dae.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_805dae() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_805dae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_805dae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_805dae(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl new file mode 100644 index 0000000000..29333f0cec --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_83bcc1() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_83bcc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_83bcc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_83bcc1(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ca45eca05 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_83bcc1() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_83bcc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_83bcc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_83bcc1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ca45eca05 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_83bcc1() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_83bcc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_83bcc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_83bcc1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.glsl new file mode 100644 index 0000000000..b3342f8bda --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_83bcc1() { + imageStore(arg_0, 1, uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_83bcc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_83bcc1() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void fragment_main() { + textureStore_83bcc1(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_83bcc1() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void compute_main() { + textureStore_83bcc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.msl new file mode 100644 index 0000000000..da45ded04d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_83bcc1(texture1d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_83bcc1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_83bcc1(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_83bcc1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7e464edf7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/83bcc1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_83bcc1() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_83bcc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_83bcc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_83bcc1(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/872747.wgsl b/test/tint/builtins/gen/literal/textureStore/872747.wgsl new file mode 100644 index 0000000000..d6f4ce1236 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/872747.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_872747() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_872747(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_872747(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_872747(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abc0d22cfd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_872747() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_872747(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_872747(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_872747(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..abc0d22cfd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_872747() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_872747(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_872747(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_872747(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.glsl new file mode 100644 index 0000000000..3feee78575 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureStore_872747() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_872747(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureStore_872747() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void fragment_main() { + textureStore_872747(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureStore_872747() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void compute_main() { + textureStore_872747(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.msl new file mode 100644 index 0000000000..2c0461e1d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_872747(texture1d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_872747(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_872747(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_872747(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/872747.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/872747.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.wgsl new file mode 100644 index 0000000000..50b71065a2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/872747.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_872747() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_872747(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_872747(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_872747(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl new file mode 100644 index 0000000000..37ba1a3ee3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_8e0479() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8e0479(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_8e0479(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_8e0479(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e0b8d209ab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_8e0479() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8e0479(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8e0479(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8e0479(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e0b8d209ab --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_8e0479() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8e0479(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8e0479(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8e0479(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.glsl new file mode 100644 index 0000000000..e0ceb95f04 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_8e0479() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_8e0479(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_8e0479() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void fragment_main() { + textureStore_8e0479(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_8e0479() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void compute_main() { + textureStore_8e0479(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.msl new file mode 100644 index 0000000000..3dcab98640 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_8e0479(texture2d_array tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_8e0479(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_8e0479(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_8e0479(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.wgsl new file mode 100644 index 0000000000..c831783a19 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8e0479.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_8e0479() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8e0479(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_8e0479(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_8e0479(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl new file mode 100644 index 0000000000..36d6ecd952 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_8f71a1() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8f71a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_8f71a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_8f71a1(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..be336b8353 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_8f71a1() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8f71a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8f71a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8f71a1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..be336b8353 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_8f71a1() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8f71a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8f71a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8f71a1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.glsl new file mode 100644 index 0000000000..42ace3de7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureStore_8f71a1() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_8f71a1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureStore_8f71a1() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void fragment_main() { + textureStore_8f71a1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureStore_8f71a1() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void compute_main() { + textureStore_8f71a1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.msl new file mode 100644 index 0000000000..0e8dc88b67 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_8f71a1(texture3d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_8f71a1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_8f71a1(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_8f71a1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5ce5918b48 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/8f71a1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_8f71a1() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8f71a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_8f71a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_8f71a1(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/969534.wgsl b/test/tint/builtins/gen/literal/textureStore/969534.wgsl new file mode 100644 index 0000000000..92a4a59d69 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/969534.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_969534() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_969534(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_969534(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_969534(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5d1107b86a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_969534() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_969534(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_969534(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_969534(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5d1107b86a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_969534() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_969534(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_969534(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_969534(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.glsl new file mode 100644 index 0000000000..793221f829 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureStore_969534() { + imageStore(arg_0, 1, ivec4(0)); +} + +vec4 vertex_main() { + textureStore_969534(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureStore_969534() { + imageStore(arg_0, 1, ivec4(0)); +} + +void fragment_main() { + textureStore_969534(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureStore_969534() { + imageStore(arg_0, 1, ivec4(0)); +} + +void compute_main() { + textureStore_969534(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.msl new file mode 100644 index 0000000000..c994c241da --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_969534(texture1d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_969534(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_969534(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_969534(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/969534.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/969534.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.wgsl new file mode 100644 index 0000000000..41ae9063d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/969534.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_969534() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_969534(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_969534(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_969534(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl new file mode 100644 index 0000000000..40a665404e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_9a3ecc() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9a3ecc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9a3ecc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9a3ecc(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bf19cfeb5d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_9a3ecc() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9a3ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9a3ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9a3ecc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf19cfeb5d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_9a3ecc() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9a3ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9a3ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9a3ecc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.glsl new file mode 100644 index 0000000000..3867d2a20a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureStore_9a3ecc() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_9a3ecc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureStore_9a3ecc() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void fragment_main() { + textureStore_9a3ecc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureStore_9a3ecc() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void compute_main() { + textureStore_9a3ecc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.msl new file mode 100644 index 0000000000..e91a11afd8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_9a3ecc(texture3d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_9a3ecc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_9a3ecc(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_9a3ecc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.wgsl new file mode 100644 index 0000000000..072ae7012d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9a3ecc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_9a3ecc() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9a3ecc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9a3ecc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9a3ecc(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl new file mode 100644 index 0000000000..e8c9753521 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_9d9cd5() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9d9cd5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9d9cd5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9d9cd5(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f43b6b845 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_9d9cd5() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9d9cd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9d9cd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9d9cd5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f43b6b845 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_9d9cd5() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9d9cd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9d9cd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9d9cd5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.glsl new file mode 100644 index 0000000000..9c483a053c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureStore_9d9cd5() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_9d9cd5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureStore_9d9cd5() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void fragment_main() { + textureStore_9d9cd5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureStore_9d9cd5() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void compute_main() { + textureStore_9d9cd5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.msl new file mode 100644 index 0000000000..946884618b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_9d9cd5(texture2d_array tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_9d9cd5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_9d9cd5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_9d9cd5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.wgsl new file mode 100644 index 0000000000..f321044a7e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9d9cd5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_9d9cd5() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9d9cd5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9d9cd5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9d9cd5(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl new file mode 100644 index 0000000000..0fd320efdd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_9e3ec5() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9e3ec5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9e3ec5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9e3ec5(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a1dff9c5d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_9e3ec5() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9e3ec5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9e3ec5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9e3ec5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1dff9c5d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_9e3ec5() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9e3ec5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9e3ec5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9e3ec5(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.glsl new file mode 100644 index 0000000000..292c9f6941 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureStore_9e3ec5() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_9e3ec5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureStore_9e3ec5() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void fragment_main() { + textureStore_9e3ec5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureStore_9e3ec5() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void compute_main() { + textureStore_9e3ec5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.msl new file mode 100644 index 0000000000..96998a48e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_9e3ec5(texture2d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_9e3ec5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_9e3ec5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_9e3ec5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.wgsl new file mode 100644 index 0000000000..b2822b3906 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/9e3ec5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_9e3ec5() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9e3ec5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9e3ec5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9e3ec5(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl new file mode 100644 index 0000000000..d703f125c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_ac67aa() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ac67aa(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ac67aa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ac67aa(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94cd654873 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ac67aa() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ac67aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ac67aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ac67aa(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..94cd654873 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ac67aa() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ac67aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ac67aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ac67aa(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.glsl new file mode 100644 index 0000000000..5662bc9e17 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ac67aa() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_ac67aa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ac67aa() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_ac67aa(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ac67aa() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void compute_main() { + textureStore_ac67aa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.msl new file mode 100644 index 0000000000..a72b97ca2a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_ac67aa(texture3d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_ac67aa(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_ac67aa(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_ac67aa(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.wgsl new file mode 100644 index 0000000000..c3095f6ba5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ac67aa.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_ac67aa() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ac67aa(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ac67aa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ac67aa(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl new file mode 100644 index 0000000000..6004410557 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_b706b1() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_b706b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_b706b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_b706b1(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c479e1c702 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_b706b1() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_b706b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_b706b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_b706b1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c479e1c702 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_b706b1() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_b706b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_b706b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_b706b1(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.glsl new file mode 100644 index 0000000000..6e27e12b9a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureStore_b706b1() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_b706b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureStore_b706b1() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void fragment_main() { + textureStore_b706b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureStore_b706b1() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void compute_main() { + textureStore_b706b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.msl new file mode 100644 index 0000000000..270213d33f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_b706b1(texture3d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_b706b1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_b706b1(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_b706b1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..3c379e9ccb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/b706b1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_b706b1() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_b706b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_b706b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_b706b1(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl new file mode 100644 index 0000000000..6c102b484b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_bbcb7f() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bbcb7f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_bbcb7f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_bbcb7f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0278d0e7aa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_bbcb7f() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bbcb7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bbcb7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bbcb7f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0278d0e7aa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_bbcb7f() { + arg_0[(0).xx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bbcb7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bbcb7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bbcb7f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.glsl new file mode 100644 index 0000000000..fbe98a8042 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureStore_bbcb7f() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_bbcb7f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureStore_bbcb7f() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void fragment_main() { + textureStore_bbcb7f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureStore_bbcb7f() { + imageStore(arg_0, ivec2(0), ivec4(0)); +} + +void compute_main() { + textureStore_bbcb7f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.msl new file mode 100644 index 0000000000..1d091aba00 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_bbcb7f(texture2d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_bbcb7f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_bbcb7f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_bbcb7f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f241474b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bbcb7f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_bbcb7f() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bbcb7f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_bbcb7f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_bbcb7f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl new file mode 100644 index 0000000000..92f15fe86f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_be6e30() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_be6e30(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_be6e30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_be6e30(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..43f6c7e9de --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_be6e30() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_be6e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_be6e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_be6e30(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43f6c7e9de --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_be6e30() { + arg_0[(0).xx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_be6e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_be6e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_be6e30(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.glsl new file mode 100644 index 0000000000..9df8efde49 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureStore_be6e30() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_be6e30(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureStore_be6e30() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_be6e30(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureStore_be6e30() { + imageStore(arg_0, ivec2(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_be6e30(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.msl new file mode 100644 index 0000000000..acb6216e9f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_be6e30(texture2d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_be6e30(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_be6e30(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_be6e30(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.wgsl new file mode 100644 index 0000000000..cf77394b7f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/be6e30.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_be6e30() { + textureStore(arg_0, vec2(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_be6e30(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_be6e30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_be6e30(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl new file mode 100644 index 0000000000..110b5ee83d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_bf775c() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bf775c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_bf775c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_bf775c(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..592886825b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_bf775c() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bf775c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bf775c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bf775c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..592886825b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_bf775c() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bf775c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bf775c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bf775c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.glsl new file mode 100644 index 0000000000..892ebeab4c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureStore_bf775c() { + imageStore(arg_0, 1, ivec4(0)); +} + +vec4 vertex_main() { + textureStore_bf775c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureStore_bf775c() { + imageStore(arg_0, 1, ivec4(0)); +} + +void fragment_main() { + textureStore_bf775c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureStore_bf775c() { + imageStore(arg_0, 1, ivec4(0)); +} + +void compute_main() { + textureStore_bf775c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.msl new file mode 100644 index 0000000000..3d8210b9e0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_bf775c(texture1d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_bf775c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_bf775c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_bf775c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.wgsl new file mode 100644 index 0000000000..47b4f23cd7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/bf775c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_bf775c() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bf775c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_bf775c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_bf775c(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl new file mode 100644 index 0000000000..f8bcd69524 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_c5af1e() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c5af1e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_c5af1e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_c5af1e(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ba59f437ed --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_c5af1e() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c5af1e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c5af1e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c5af1e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba59f437ed --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_c5af1e() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c5af1e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c5af1e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c5af1e(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.glsl new file mode 100644 index 0000000000..7e8006da67 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureStore_c5af1e() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_c5af1e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureStore_c5af1e() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_c5af1e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureStore_c5af1e() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_c5af1e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.msl new file mode 100644 index 0000000000..5421957218 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_c5af1e(texture3d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_c5af1e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_c5af1e(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_c5af1e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.wgsl new file mode 100644 index 0000000000..003aee25c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c5af1e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_c5af1e() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c5af1e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_c5af1e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_c5af1e(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/c863be.wgsl b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl new file mode 100644 index 0000000000..35f6aa2f45 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_c863be() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c863be(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_c863be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_c863be(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6948caad6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_c863be() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c863be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c863be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c863be(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6948caad6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_c863be() { + arg_0[int3(0, 0, 1)] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c863be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c863be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c863be(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.glsl new file mode 100644 index 0000000000..fb070a68bb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureStore_c863be() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_c863be(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureStore_c863be() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void fragment_main() { + textureStore_c863be(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureStore_c863be() { + imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f)); +} + +void compute_main() { + textureStore_c863be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.msl new file mode 100644 index 0000000000..bbe2282da9 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_c863be(texture2d_array tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_c863be(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_c863be(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_c863be(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/c863be.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c6f8acccd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/c863be.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_c863be() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c863be(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_c863be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_c863be(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl new file mode 100644 index 0000000000..64408f9e10 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_d73b5c() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_d73b5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_d73b5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_d73b5c(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..85e4777a84 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_d73b5c() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_d73b5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_d73b5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_d73b5c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..85e4777a84 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_d73b5c() { + arg_0[1] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_d73b5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_d73b5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_d73b5c(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.glsl new file mode 100644 index 0000000000..494b6a21d7 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureStore_d73b5c() { + imageStore(arg_0, 1, ivec4(0)); +} + +vec4 vertex_main() { + textureStore_d73b5c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureStore_d73b5c() { + imageStore(arg_0, 1, ivec4(0)); +} + +void fragment_main() { + textureStore_d73b5c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureStore_d73b5c() { + imageStore(arg_0, 1, ivec4(0)); +} + +void compute_main() { + textureStore_d73b5c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.msl new file mode 100644 index 0000000000..c564d6d96b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_d73b5c(texture1d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_d73b5c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_d73b5c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_d73b5c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.wgsl new file mode 100644 index 0000000000..bed8187fad --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/d73b5c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_d73b5c() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_d73b5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_d73b5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_d73b5c(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl new file mode 100644 index 0000000000..11b2a3d03d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_dd7d81() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dd7d81(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_dd7d81(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_dd7d81(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..598b8116c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_dd7d81() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dd7d81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dd7d81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dd7d81(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..598b8116c3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_dd7d81() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dd7d81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dd7d81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dd7d81(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.glsl new file mode 100644 index 0000000000..8106b7744a --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureStore_dd7d81() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_dd7d81(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureStore_dd7d81() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_dd7d81(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureStore_dd7d81() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_dd7d81(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.msl new file mode 100644 index 0000000000..15ec0e76af --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_dd7d81(texture3d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_dd7d81(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_dd7d81(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_dd7d81(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.wgsl new file mode 100644 index 0000000000..4c1f5293ad --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dd7d81.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_dd7d81() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dd7d81(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_dd7d81(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_dd7d81(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/dde364.wgsl b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl new file mode 100644 index 0000000000..055a43a496 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_dde364() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dde364(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_dde364(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_dde364(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c35dda32b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_dde364() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dde364(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dde364(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dde364(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c35dda32b2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_dde364() { + arg_0[int3(0, 0, 1)] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dde364(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dde364(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dde364(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.glsl new file mode 100644 index 0000000000..cff2439450 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_dde364() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_dde364(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_dde364() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void fragment_main() { + textureStore_dde364(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_dde364() { + imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u)); +} + +void compute_main() { + textureStore_dde364(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.msl new file mode 100644 index 0000000000..45be7606f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_dde364(texture2d_array tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_dde364(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_dde364(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_dde364(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/dde364.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7dc0c1d2d --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/dde364.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_dde364() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dde364(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_dde364(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_dde364(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl new file mode 100644 index 0000000000..8ac51d3331 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_e885e8() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_e885e8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_e885e8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_e885e8(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0faa237daa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_e885e8() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_e885e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_e885e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_e885e8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0faa237daa --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_e885e8() { + arg_0[1] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_e885e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_e885e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_e885e8(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.glsl new file mode 100644 index 0000000000..b537ea34ff --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureStore_e885e8() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_e885e8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureStore_e885e8() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void fragment_main() { + textureStore_e885e8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureStore_e885e8() { + imageStore(arg_0, 1, vec4(0.0f)); +} + +void compute_main() { + textureStore_e885e8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.msl new file mode 100644 index 0000000000..3bea09b6ed --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_e885e8(texture1d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_e885e8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_e885e8(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_e885e8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7b3caad6c --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/e885e8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_e885e8() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_e885e8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_e885e8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_e885e8(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl new file mode 100644 index 0000000000..ac35f5bc09 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_eb702f() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb702f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_eb702f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_eb702f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5bc0b80030 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb702f() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb702f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb702f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb702f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5bc0b80030 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb702f() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb702f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb702f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb702f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.glsl new file mode 100644 index 0000000000..dbf804546e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureStore_eb702f() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_eb702f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureStore_eb702f() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_eb702f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureStore_eb702f() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_eb702f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.msl new file mode 100644 index 0000000000..bac111e1e3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_eb702f(texture3d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_eb702f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_eb702f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_eb702f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.wgsl new file mode 100644 index 0000000000..0e86ad2615 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb702f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_eb702f() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb702f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_eb702f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_eb702f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl new file mode 100644 index 0000000000..5e22edf8fd --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_eb78b9() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb78b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_eb78b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_eb78b9(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..67a03a226b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb78b9() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb78b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb78b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb78b9(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67a03a226b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb78b9() { + arg_0[(0).xxx] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb78b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb78b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb78b9(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.glsl new file mode 100644 index 0000000000..ff3eaea9c1 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureStore_eb78b9() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_eb78b9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureStore_eb78b9() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void fragment_main() { + textureStore_eb78b9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureStore_eb78b9() { + imageStore(arg_0, ivec3(0), ivec4(0)); +} + +void compute_main() { + textureStore_eb78b9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.msl new file mode 100644 index 0000000000..038f1f45e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_eb78b9(texture3d tint_symbol_1) { + tint_symbol_1.write(int4(0), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_eb78b9(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_eb78b9(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_eb78b9(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..c200bb2954 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/eb78b9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_eb78b9() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb78b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_eb78b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_eb78b9(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl new file mode 100644 index 0000000000..3335d0e42f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_ee6acc() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ee6acc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ee6acc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ee6acc(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8193759670 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ee6acc() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ee6acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ee6acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ee6acc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8193759670 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ee6acc() { + arg_0[(0).xxx] = (0.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ee6acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ee6acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ee6acc(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.glsl new file mode 100644 index 0000000000..b22d59687e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureStore_ee6acc() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +vec4 vertex_main() { + textureStore_ee6acc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureStore_ee6acc() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void fragment_main() { + textureStore_ee6acc(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureStore_ee6acc() { + imageStore(arg_0, ivec3(0), vec4(0.0f)); +} + +void compute_main() { + textureStore_ee6acc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.msl new file mode 100644 index 0000000000..46568a969f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_ee6acc(texture3d tint_symbol_1) { + tint_symbol_1.write(float4(0.0f), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_ee6acc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_ee6acc(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_ee6acc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.wgsl new file mode 100644 index 0000000000..377310e4b5 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ee6acc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_ee6acc() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ee6acc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ee6acc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ee6acc(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl new file mode 100644 index 0000000000..ace68ced34 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_ef9f2f() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ef9f2f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ef9f2f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ef9f2f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fb51122e9e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ef9f2f() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ef9f2f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ef9f2f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ef9f2f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fb51122e9e --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ef9f2f() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ef9f2f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ef9f2f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ef9f2f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.glsl new file mode 100644 index 0000000000..5a8142a037 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ef9f2f() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_ef9f2f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ef9f2f() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_ef9f2f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ef9f2f() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void compute_main() { + textureStore_ef9f2f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.msl new file mode 100644 index 0000000000..a9ba91d14b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_ef9f2f(texture3d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_ef9f2f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_ef9f2f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_ef9f2f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a0b5cb95b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/ef9f2f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_ef9f2f() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ef9f2f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ef9f2f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ef9f2f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl new file mode 100644 index 0000000000..be2f0642c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_f8dead() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f8dead(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_f8dead(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_f8dead(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..660c7b48c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_f8dead() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f8dead(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f8dead(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f8dead(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..660c7b48c8 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_f8dead() { + arg_0[(0).xxx] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f8dead(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f8dead(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f8dead(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.glsl new file mode 100644 index 0000000000..a71f30414b --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureStore_f8dead() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_f8dead(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureStore_f8dead() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void fragment_main() { + textureStore_f8dead(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureStore_f8dead() { + imageStore(arg_0, ivec3(0), uvec4(0u)); +} + +void compute_main() { + textureStore_f8dead(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.msl new file mode 100644 index 0000000000..7e0be797cb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_f8dead(texture3d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint3(int3(0))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_f8dead(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_f8dead(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_f8dead(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.wgsl new file mode 100644 index 0000000000..450fd25478 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f8dead.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_f8dead() { + textureStore(arg_0, vec3(), vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f8dead(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_f8dead(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_f8dead(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl new file mode 100644 index 0000000000..def2f9b384 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_f9be83() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f9be83(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_f9be83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_f9be83(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a323f52245 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_f9be83() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f9be83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f9be83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f9be83(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a323f52245 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_f9be83() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f9be83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f9be83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f9be83(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.glsl new file mode 100644 index 0000000000..da09edea21 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_f9be83() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_f9be83(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_f9be83() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void fragment_main() { + textureStore_f9be83(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_f9be83() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void compute_main() { + textureStore_f9be83(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.msl new file mode 100644 index 0000000000..8eb8d23ef6 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_f9be83(texture2d_array tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_f9be83(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_f9be83(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_f9be83(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.wgsl new file mode 100644 index 0000000000..0b0ece1beb --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/f9be83.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_f9be83() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f9be83(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_f9be83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_f9be83(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl new file mode 100644 index 0000000000..0f65cc5dd3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_fb9a8f() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fb9a8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_fb9a8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_fb9a8f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6af6c919d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_fb9a8f() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fb9a8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fb9a8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fb9a8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6af6c919d0 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_fb9a8f() { + arg_0[1] = (0u).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fb9a8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fb9a8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fb9a8f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.glsl new file mode 100644 index 0000000000..958307856f --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_fb9a8f() { + imageStore(arg_0, 1, uvec4(0u)); +} + +vec4 vertex_main() { + textureStore_fb9a8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_fb9a8f() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void fragment_main() { + textureStore_fb9a8f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_fb9a8f() { + imageStore(arg_0, 1, uvec4(0u)); +} + +void compute_main() { + textureStore_fb9a8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.msl new file mode 100644 index 0000000000..f2e593c171 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_fb9a8f(texture1d tint_symbol_1) { + tint_symbol_1.write(uint4(0u), uint(1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_fb9a8f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_fb9a8f(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_fb9a8f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1b6643388 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fb9a8f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_fb9a8f() { + textureStore(arg_0, 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fb9a8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_fb9a8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_fb9a8f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl new file mode 100644 index 0000000000..b730c25be3 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_fbf53f() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fbf53f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_fbf53f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_fbf53f(); +} diff --git a/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e274d9ed22 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_fbf53f() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fbf53f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fbf53f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fbf53f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e274d9ed22 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_fbf53f() { + arg_0[int3(0, 0, 1)] = (0).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fbf53f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fbf53f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fbf53f(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.glsl new file mode 100644 index 0000000000..de6cafacc2 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_fbf53f() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +vec4 vertex_main() { + textureStore_fbf53f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_fbf53f() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void fragment_main() { + textureStore_fbf53f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_fbf53f() { + imageStore(arg_0, ivec3(0, 0, 1), ivec4(0)); +} + +void compute_main() { + textureStore_fbf53f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.msl new file mode 100644 index 0000000000..4d94d4fd30 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureStore_fbf53f(texture2d_array tint_symbol_1) { + tint_symbol_1.write(int4(0), uint2(int2(0)), 1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_fbf53f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_fbf53f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_fbf53f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd790f2c13 --- /dev/null +++ b/test/tint/builtins/gen/literal/textureStore/fbf53f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_fbf53f() { + textureStore(arg_0, vec2(), 1, vec4()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fbf53f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_fbf53f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_fbf53f(); +} diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl new file mode 100644 index 0000000000..a413e2b6a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 3, f16>) -> mat<3, 3, f16> +fn transpose_06794e() { + var res: mat3x3 = transpose(mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_06794e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_06794e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_06794e(); +} diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..134ef42e1b --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_06794e() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_06794e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_06794e(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e4508d412 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_06794e() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_06794e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_06794e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000204EECC7200(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl new file mode 100644 index 0000000000..045b7372d5 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_06794e() { + f16mat3 res = transpose(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +vec4 vertex_main() { + transpose_06794e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_06794e() { + f16mat3 res = transpose(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void fragment_main() { + transpose_06794e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_06794e() { + f16mat3 res = transpose(f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void compute_main() { + transpose_06794e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.msl new file mode 100644 index 0000000000..e698039053 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_06794e() { + half3x3 res = transpose(half3x3(half3(0.0h), half3(0.0h), half3(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_06794e(); + return; +} + +kernel void compute_main() { + transpose_06794e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.spvasm new file mode 100644 index 0000000000..26c14aa0ed --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_06794e "transpose_06794e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %17 = OpConstantNull %mat3v3half +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_06794e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat3v3half Function %17 + %13 = OpTranspose %mat3v3half %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %transpose_06794e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_06794e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_06794e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac99ba20ee --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/06794e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_06794e() { + var res : mat3x3 = transpose(mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_06794e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_06794e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_06794e(); +} diff --git a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl new file mode 100644 index 0000000000..944e58d3c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<4, 3, f32>) -> mat<3, 4, f32> +fn transpose_2585cd() { + var res: mat3x4 = transpose(mat4x3(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_2585cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_2585cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_2585cd(); +} diff --git a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c766c61eb --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_2585cd() { + float3x4 res = transpose(float4x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx, (1.0f).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_2585cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_2585cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_2585cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c766c61eb --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void transpose_2585cd() { + float3x4 res = transpose(float4x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx, (1.0f).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_2585cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_2585cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_2585cd(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.glsl new file mode 100644 index 0000000000..f44eac23da --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void transpose_2585cd() { + mat3x4 res = transpose(mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f))); +} + +vec4 vertex_main() { + transpose_2585cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_2585cd() { + mat3x4 res = transpose(mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f))); +} + +void fragment_main() { + transpose_2585cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_2585cd() { + mat3x4 res = transpose(mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f))); +} + +void compute_main() { + transpose_2585cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.msl new file mode 100644 index 0000000000..eb93f4986e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_2585cd() { + float3x4 res = transpose(float4x3(float3(1.0f), float3(1.0f), float3(1.0f), float3(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_2585cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_2585cd(); + return; +} + +kernel void compute_main() { + transpose_2585cd(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..09bb202d43 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_2585cd "transpose_2585cd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat3v4float = OpTypeMatrix %v4float 3 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %19 = OpConstantComposite %mat4v3float %18 %18 %18 %18 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %22 = OpConstantNull %mat3v4float + %23 = OpTypeFunction %v4float +%transpose_2585cd = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat3v4float Function %22 + %13 = OpTranspose %mat3v4float %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_2585cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_2585cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_2585cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca39b02ef7 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/2585cd.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn transpose_2585cd() { + var res : mat3x4 = transpose(mat4x3(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_2585cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_2585cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_2585cd(); +} diff --git a/test/tint/builtins/gen/literal/transpose/31d679.wgsl b/test/tint/builtins/gen/literal/transpose/31d679.wgsl new file mode 100644 index 0000000000..3f15b9db6b --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31d679.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<2, 2, f32>) -> mat<2, 2, f32> +fn transpose_31d679() { + var res: mat2x2 = transpose(mat2x2(1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_31d679(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_31d679(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_31d679(); +} diff --git a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8e9cca2d81 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_31d679() { + float2x2 res = transpose(float2x2((1.0f).xx, (1.0f).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31d679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31d679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31d679(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e9cca2d81 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void transpose_31d679() { + float2x2 res = transpose(float2x2((1.0f).xx, (1.0f).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31d679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31d679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31d679(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.glsl new file mode 100644 index 0000000000..efcfb50a45 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void transpose_31d679() { + mat2 res = transpose(mat2(vec2(1.0f), vec2(1.0f))); +} + +vec4 vertex_main() { + transpose_31d679(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_31d679() { + mat2 res = transpose(mat2(vec2(1.0f), vec2(1.0f))); +} + +void fragment_main() { + transpose_31d679(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_31d679() { + mat2 res = transpose(mat2(vec2(1.0f), vec2(1.0f))); +} + +void compute_main() { + transpose_31d679(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.msl new file mode 100644 index 0000000000..d1894004cc --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_31d679() { + float2x2 res = transpose(float2x2(float2(1.0f), float2(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_31d679(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_31d679(); + return; +} + +kernel void compute_main() { + transpose_31d679(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.spvasm new file mode 100644 index 0000000000..71a0a6859c --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_31d679 "transpose_31d679" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 + %18 = OpConstantComposite %mat2v2float %17 %17 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %21 = OpConstantNull %mat2v2float + %22 = OpTypeFunction %v4float +%transpose_31d679 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat2v2float Function %21 + %13 = OpTranspose %mat2v2float %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %transpose_31d679 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %transpose_31d679 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %transpose_31d679 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.wgsl new file mode 100644 index 0000000000..32267a1597 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31d679.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn transpose_31d679() { + var res : mat2x2 = transpose(mat2x2(1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_31d679(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_31d679(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_31d679(); +} diff --git a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl new file mode 100644 index 0000000000..ec41dcbc1e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<4, 2, f32>) -> mat<2, 4, f32> +fn transpose_31e37e() { + var res: mat2x4 = transpose(mat4x2(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_31e37e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_31e37e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_31e37e(); +} diff --git a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f6023f7e0c --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_31e37e() { + float2x4 res = transpose(float4x2((1.0f).xx, (1.0f).xx, (1.0f).xx, (1.0f).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31e37e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31e37e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31e37e(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6023f7e0c --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void transpose_31e37e() { + float2x4 res = transpose(float4x2((1.0f).xx, (1.0f).xx, (1.0f).xx, (1.0f).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31e37e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31e37e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31e37e(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.glsl new file mode 100644 index 0000000000..b6aa71bda9 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void transpose_31e37e() { + mat2x4 res = transpose(mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f))); +} + +vec4 vertex_main() { + transpose_31e37e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_31e37e() { + mat2x4 res = transpose(mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f))); +} + +void fragment_main() { + transpose_31e37e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_31e37e() { + mat2x4 res = transpose(mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f))); +} + +void compute_main() { + transpose_31e37e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.msl new file mode 100644 index 0000000000..b724f69dc8 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_31e37e() { + float2x4 res = transpose(float4x2(float2(1.0f), float2(1.0f), float2(1.0f), float2(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_31e37e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_31e37e(); + return; +} + +kernel void compute_main() { + transpose_31e37e(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.spvasm new file mode 100644 index 0000000000..95213d8fdb --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_31e37e "transpose_31e37e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat2v4float = OpTypeMatrix %v4float 2 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v2float %float_1 %float_1 + %19 = OpConstantComposite %mat4v2float %18 %18 %18 %18 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %22 = OpConstantNull %mat2v4float + %23 = OpTypeFunction %v4float +%transpose_31e37e = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat2v4float Function %22 + %13 = OpTranspose %mat2v4float %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_31e37e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_31e37e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_31e37e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.wgsl new file mode 100644 index 0000000000..31e0e1c938 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/31e37e.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn transpose_31e37e() { + var res : mat2x4 = transpose(mat4x2(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_31e37e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_31e37e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_31e37e(); +} diff --git a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl new file mode 100644 index 0000000000..40502b7e38 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<2, 4, f32>) -> mat<4, 2, f32> +fn transpose_4ce359() { + var res: mat4x2 = transpose(mat2x4(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_4ce359(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_4ce359(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_4ce359(); +} diff --git a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b941117476 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_4ce359() { + float4x2 res = transpose(float2x4((1.0f).xxxx, (1.0f).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4ce359(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4ce359(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4ce359(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b941117476 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void transpose_4ce359() { + float4x2 res = transpose(float2x4((1.0f).xxxx, (1.0f).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4ce359(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4ce359(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4ce359(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.glsl new file mode 100644 index 0000000000..03e01ec785 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void transpose_4ce359() { + mat4x2 res = transpose(mat2x4(vec4(1.0f), vec4(1.0f))); +} + +vec4 vertex_main() { + transpose_4ce359(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_4ce359() { + mat4x2 res = transpose(mat2x4(vec4(1.0f), vec4(1.0f))); +} + +void fragment_main() { + transpose_4ce359(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_4ce359() { + mat4x2 res = transpose(mat2x4(vec4(1.0f), vec4(1.0f))); +} + +void compute_main() { + transpose_4ce359(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.msl new file mode 100644 index 0000000000..42cafcae57 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_4ce359() { + float4x2 res = transpose(float2x4(float4(1.0f), float4(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_4ce359(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_4ce359(); + return; +} + +kernel void compute_main() { + transpose_4ce359(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.spvasm new file mode 100644 index 0000000000..e36521cf9d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_4ce359 "transpose_4ce359" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %19 = OpConstantComposite %mat2v4float %18 %18 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %22 = OpConstantNull %mat4v2float + %23 = OpTypeFunction %v4float +%transpose_4ce359 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat4v2float Function %22 + %13 = OpTranspose %mat4v2float %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_4ce359 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_4ce359 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_4ce359 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.wgsl new file mode 100644 index 0000000000..47e4a28f88 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4ce359.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn transpose_4ce359() { + var res : mat4x2 = transpose(mat2x4(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_4ce359(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_4ce359(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_4ce359(); +} diff --git a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl new file mode 100644 index 0000000000..d9e4eedbab --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<2, 3, f32>) -> mat<3, 2, f32> +fn transpose_4dc9a1() { + var res: mat3x2 = transpose(mat2x3(1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_4dc9a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_4dc9a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_4dc9a1(); +} diff --git a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..401f940565 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_4dc9a1() { + float3x2 res = transpose(float2x3((1.0f).xxx, (1.0f).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4dc9a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4dc9a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4dc9a1(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..401f940565 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void transpose_4dc9a1() { + float3x2 res = transpose(float2x3((1.0f).xxx, (1.0f).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4dc9a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4dc9a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4dc9a1(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.glsl new file mode 100644 index 0000000000..e9e8cdf78e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void transpose_4dc9a1() { + mat3x2 res = transpose(mat2x3(vec3(1.0f), vec3(1.0f))); +} + +vec4 vertex_main() { + transpose_4dc9a1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_4dc9a1() { + mat3x2 res = transpose(mat2x3(vec3(1.0f), vec3(1.0f))); +} + +void fragment_main() { + transpose_4dc9a1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_4dc9a1() { + mat3x2 res = transpose(mat2x3(vec3(1.0f), vec3(1.0f))); +} + +void compute_main() { + transpose_4dc9a1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.msl new file mode 100644 index 0000000000..33321236cb --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_4dc9a1() { + float3x2 res = transpose(float2x3(float3(1.0f), float3(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_4dc9a1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_4dc9a1(); + return; +} + +kernel void compute_main() { + transpose_4dc9a1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed047642c2 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_4dc9a1 "transpose_4dc9a1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %20 = OpConstantComposite %mat2v3float %19 %19 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %23 = OpConstantNull %mat3v2float + %24 = OpTypeFunction %v4float +%transpose_4dc9a1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat3v2float Function %23 + %13 = OpTranspose %mat3v2float %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %transpose_4dc9a1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_4dc9a1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_4dc9a1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5db00a50fc --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/4dc9a1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn transpose_4dc9a1() { + var res : mat3x2 = transpose(mat2x3(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_4dc9a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_4dc9a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_4dc9a1(); +} diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl new file mode 100644 index 0000000000..dd1c459332 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 2, f16>) -> mat<2, 4, f16> +fn transpose_5edd96() { + var res: mat2x4 = transpose(mat4x2(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5edd96(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5edd96(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5edd96(); +} diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f253b9e80 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_5edd96() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5edd96(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5edd96(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f8832fffe --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_5edd96() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5edd96(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5edd96(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000292A0E96D40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl new file mode 100644 index 0000000000..48b8ac197f --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5edd96() { + f16mat2x4 res = transpose(f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +vec4 vertex_main() { + transpose_5edd96(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_5edd96() { + f16mat2x4 res = transpose(f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void fragment_main() { + transpose_5edd96(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5edd96() { + f16mat2x4 res = transpose(f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void compute_main() { + transpose_5edd96(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.msl new file mode 100644 index 0000000000..09cffcbd1f --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_5edd96() { + half2x4 res = transpose(half4x2(half2(0.0h), half2(0.0h), half2(0.0h), half2(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_5edd96(); + return; +} + +kernel void compute_main() { + transpose_5edd96(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.spvasm new file mode 100644 index 0000000000..07e8594864 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_5edd96 "transpose_5edd96" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %19 = OpConstantNull %mat4v2half +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half + %22 = OpConstantNull %mat2v4half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_5edd96 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat2v4half Function %22 + %13 = OpTranspose %mat2v4half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_5edd96 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_5edd96 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_5edd96 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.wgsl new file mode 100644 index 0000000000..aaf9fbf236 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5edd96.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_5edd96() { + var res : mat2x4 = transpose(mat4x2(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5edd96(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5edd96(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5edd96(); +} diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl new file mode 100644 index 0000000000..47e4c776bf --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 3, f16>) -> mat<3, 4, f16> +fn transpose_5f36bf() { + var res: mat3x4 = transpose(mat4x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5f36bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5f36bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5f36bf(); +} diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b5189243fd --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_5f36bf() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5f36bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5f36bf(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc78b8f286 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_5f36bf() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5f36bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5f36bf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000237E1607910(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl new file mode 100644 index 0000000000..bc4a794651 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5f36bf() { + f16mat3x4 res = transpose(f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +vec4 vertex_main() { + transpose_5f36bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_5f36bf() { + f16mat3x4 res = transpose(f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void fragment_main() { + transpose_5f36bf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5f36bf() { + f16mat3x4 res = transpose(f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void compute_main() { + transpose_5f36bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.msl new file mode 100644 index 0000000000..d931f016ab --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_5f36bf() { + half3x4 res = transpose(half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_5f36bf(); + return; +} + +kernel void compute_main() { + transpose_5f36bf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9e6ffa30f --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_5f36bf "transpose_5f36bf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %19 = OpConstantNull %mat4v3half +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half + %22 = OpConstantNull %mat3v4half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_5f36bf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat3v4half Function %22 + %13 = OpTranspose %mat3v4half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_5f36bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_5f36bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_5f36bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..878b15af9e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/5f36bf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_5f36bf() { + var res : mat3x4 = transpose(mat4x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5f36bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5f36bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5f36bf(); +} diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl new file mode 100644 index 0000000000..5a59b3bb4d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 2, f16>) -> mat<2, 2, f16> +fn transpose_7be8b2() { + var res: mat2x2 = transpose(mat2x2(f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_7be8b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_7be8b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_7be8b2(); +} diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e72e2d0fe8 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_7be8b2() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_7be8b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_7be8b2(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a45d63b85d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_7be8b2() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_7be8b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_7be8b2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EDDB33C1F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl new file mode 100644 index 0000000000..44cafb6a5e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_7be8b2() { + f16mat2 res = transpose(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +vec4 vertex_main() { + transpose_7be8b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_7be8b2() { + f16mat2 res = transpose(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void fragment_main() { + transpose_7be8b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_7be8b2() { + f16mat2 res = transpose(f16mat2(f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void compute_main() { + transpose_7be8b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.msl new file mode 100644 index 0000000000..435d12f6e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_7be8b2() { + half2x2 res = transpose(half2x2(half2(0.0h), half2(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_7be8b2(); + return; +} + +kernel void compute_main() { + transpose_7be8b2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..7575dcadbc --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_7be8b2 "transpose_7be8b2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %17 = OpConstantNull %mat2v2half +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_7be8b2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat2v2half Function %17 + %13 = OpTranspose %mat2v2half %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %transpose_7be8b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_7be8b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_7be8b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..437f1cea53 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/7be8b2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_7be8b2() { + var res : mat2x2 = transpose(mat2x2(f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_7be8b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_7be8b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_7be8b2(); +} diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl new file mode 100644 index 0000000000..870582ba6d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 4, f16>) -> mat<4, 4, f16> +fn transpose_844869() { + var res: mat4x4 = transpose(mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_844869(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_844869(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_844869(); +} diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0ad869b997 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_844869() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_844869(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_844869(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec91e0b30e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_844869() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_844869(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_844869(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F000A07970(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl new file mode 100644 index 0000000000..a244d661b7 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_844869() { + f16mat4 res = transpose(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +vec4 vertex_main() { + transpose_844869(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_844869() { + f16mat4 res = transpose(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void fragment_main() { + transpose_844869(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_844869() { + f16mat4 res = transpose(f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void compute_main() { + transpose_844869(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.msl new file mode 100644 index 0000000000..b02ce13d83 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_844869() { + half4x4 res = transpose(half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_844869(); + return; +} + +kernel void compute_main() { + transpose_844869(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.spvasm new file mode 100644 index 0000000000..830841978c --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_844869 "transpose_844869" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %17 = OpConstantNull %mat4v4half +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_844869 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat4v4half Function %17 + %13 = OpTranspose %mat4v4half %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %transpose_844869 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_844869 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_844869 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.wgsl new file mode 100644 index 0000000000..b917ed4147 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/844869.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_844869() { + var res : mat4x4 = transpose(mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_844869(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_844869(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_844869(); +} diff --git a/test/tint/builtins/gen/literal/transpose/854336.wgsl b/test/tint/builtins/gen/literal/transpose/854336.wgsl new file mode 100644 index 0000000000..68d93069df --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/854336.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<3, 3, f32>) -> mat<3, 3, f32> +fn transpose_854336() { + var res: mat3x3 = transpose(mat3x3(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_854336(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_854336(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_854336(); +} diff --git a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f625b2e624 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_854336() { + float3x3 res = transpose(float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_854336(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_854336(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_854336(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f625b2e624 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void transpose_854336() { + float3x3 res = transpose(float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_854336(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_854336(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_854336(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.glsl new file mode 100644 index 0000000000..3673f90ba0 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void transpose_854336() { + mat3 res = transpose(mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f))); +} + +vec4 vertex_main() { + transpose_854336(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_854336() { + mat3 res = transpose(mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f))); +} + +void fragment_main() { + transpose_854336(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_854336() { + mat3 res = transpose(mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f))); +} + +void compute_main() { + transpose_854336(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.msl new file mode 100644 index 0000000000..2f76c107b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_854336() { + float3x3 res = transpose(float3x3(float3(1.0f), float3(1.0f), float3(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_854336(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_854336(); + return; +} + +kernel void compute_main() { + transpose_854336(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.spvasm new file mode 100644 index 0000000000..557e008585 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_854336 "transpose_854336" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %18 = OpConstantComposite %mat3v3float %17 %17 %17 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %21 = OpConstantNull %mat3v3float + %22 = OpTypeFunction %v4float +%transpose_854336 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat3v3float Function %21 + %13 = OpTranspose %mat3v3float %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %transpose_854336 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %transpose_854336 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %transpose_854336 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.wgsl new file mode 100644 index 0000000000..f5aaa29c13 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/854336.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn transpose_854336() { + var res : mat3x3 = transpose(mat3x3(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_854336(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_854336(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_854336(); +} diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl new file mode 100644 index 0000000000..e7925471d1 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 4, f16>) -> mat<4, 3, f16> +fn transpose_8c06ce() { + var res: mat4x3 = transpose(mat3x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_8c06ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_8c06ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_8c06ce(); +} diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..796214243a --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_8c06ce() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_8c06ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_8c06ce(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7a4521b139 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_8c06ce() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_8c06ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_8c06ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028A648373A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl new file mode 100644 index 0000000000..77ffe386f4 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_8c06ce() { + f16mat4x3 res = transpose(f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +vec4 vertex_main() { + transpose_8c06ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_8c06ce() { + f16mat4x3 res = transpose(f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void fragment_main() { + transpose_8c06ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_8c06ce() { + f16mat4x3 res = transpose(f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void compute_main() { + transpose_8c06ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.msl new file mode 100644 index 0000000000..dd48f0306d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_8c06ce() { + half4x3 res = transpose(half3x4(half4(0.0h), half4(0.0h), half4(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_8c06ce(); + return; +} + +kernel void compute_main() { + transpose_8c06ce(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..04c004eb28 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_8c06ce "transpose_8c06ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %19 = OpConstantNull %mat3v4half +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half + %22 = OpConstantNull %mat4v3half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_8c06ce = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat4v3half Function %22 + %13 = OpTranspose %mat4v3half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_8c06ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_8c06ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_8c06ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..09d0c25f34 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/8c06ce.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_8c06ce() { + var res : mat4x3 = transpose(mat3x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_8c06ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_8c06ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_8c06ce(); +} diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl new file mode 100644 index 0000000000..7be77d2682 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 2, f16>) -> mat<2, 3, f16> +fn transpose_b9ad1f() { + var res: mat2x3 = transpose(mat3x2(f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_b9ad1f(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_b9ad1f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_b9ad1f(); +} diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..97e3dcb1bb --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_b9ad1f() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_b9ad1f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_b9ad1f(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd484fcc03 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_b9ad1f() { + matrix res = transpose(matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_b9ad1f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_b9ad1f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E12EBEEBC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl new file mode 100644 index 0000000000..f549a0dadd --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_b9ad1f() { + f16mat2x3 res = transpose(f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +vec4 vertex_main() { + transpose_b9ad1f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_b9ad1f() { + f16mat2x3 res = transpose(f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void fragment_main() { + transpose_b9ad1f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_b9ad1f() { + f16mat2x3 res = transpose(f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf))); +} + +void compute_main() { + transpose_b9ad1f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.msl new file mode 100644 index 0000000000..6fc6f1d751 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_b9ad1f() { + half2x3 res = transpose(half3x2(half2(0.0h), half2(0.0h), half2(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_b9ad1f(); + return; +} + +kernel void compute_main() { + transpose_b9ad1f(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.spvasm new file mode 100644 index 0000000000..c3ed30e12b --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_b9ad1f "transpose_b9ad1f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %19 = OpConstantNull %mat3v2half +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half + %22 = OpConstantNull %mat2v3half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_b9ad1f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat2v3half Function %22 + %13 = OpTranspose %mat2v3half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_b9ad1f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_b9ad1f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_b9ad1f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.wgsl new file mode 100644 index 0000000000..49ee3fa258 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/b9ad1f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_b9ad1f() { + var res : mat2x3 = transpose(mat3x2(f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_b9ad1f(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_b9ad1f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_b9ad1f(); +} diff --git a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl new file mode 100644 index 0000000000..888b2f474d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<4, 4, f32>) -> mat<4, 4, f32> +fn transpose_c1b600() { + var res: mat4x4 = transpose(mat4x4(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_c1b600(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_c1b600(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_c1b600(); +} diff --git a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7d9120122f --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_c1b600() { + float4x4 res = transpose(float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_c1b600(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_c1b600(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_c1b600(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7d9120122f --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void transpose_c1b600() { + float4x4 res = transpose(float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_c1b600(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_c1b600(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_c1b600(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.glsl new file mode 100644 index 0000000000..3b7dd439ed --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void transpose_c1b600() { + mat4 res = transpose(mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f))); +} + +vec4 vertex_main() { + transpose_c1b600(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_c1b600() { + mat4 res = transpose(mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f))); +} + +void fragment_main() { + transpose_c1b600(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_c1b600() { + mat4 res = transpose(mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f))); +} + +void compute_main() { + transpose_c1b600(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.msl new file mode 100644 index 0000000000..b759ef4c0e --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_c1b600() { + float4x4 res = transpose(float4x4(float4(1.0f), float4(1.0f), float4(1.0f), float4(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_c1b600(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_c1b600(); + return; +} + +kernel void compute_main() { + transpose_c1b600(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.spvasm new file mode 100644 index 0000000000..966363c11d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_c1b600 "transpose_c1b600" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %17 = OpConstantComposite %mat4v4float %16 %16 %16 %16 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %20 = OpConstantNull %mat4v4float + %21 = OpTypeFunction %v4float +%transpose_c1b600 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat4v4float Function %20 + %13 = OpTranspose %mat4v4float %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %transpose_c1b600 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_c1b600 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_c1b600 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf9bbeaff4 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/c1b600.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn transpose_c1b600() { + var res : mat4x4 = transpose(mat4x4(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_c1b600(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_c1b600(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_c1b600(); +} diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl new file mode 100644 index 0000000000..4375de3909 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 3, f16>) -> mat<3, 2, f16> +fn transpose_d6faec() { + var res: mat3x2 = transpose(mat2x3(f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d6faec(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d6faec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d6faec(); +} diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ab9a4aac9 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_d6faec() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d6faec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d6faec(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0fdbfb1fad --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_d6faec() { + matrix res = transpose(matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d6faec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d6faec(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002356649E890(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl new file mode 100644 index 0000000000..c7f7f4ba39 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_d6faec() { + f16mat3x2 res = transpose(f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))); +} + +vec4 vertex_main() { + transpose_d6faec(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_d6faec() { + f16mat3x2 res = transpose(f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void fragment_main() { + transpose_d6faec(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_d6faec() { + f16mat3x2 res = transpose(f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))); +} + +void compute_main() { + transpose_d6faec(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.msl new file mode 100644 index 0000000000..b4629d50e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_d6faec() { + half3x2 res = transpose(half2x3(half3(0.0h), half3(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_d6faec(); + return; +} + +kernel void compute_main() { + transpose_d6faec(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.spvasm new file mode 100644 index 0000000000..a9f192ca01 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_d6faec "transpose_d6faec" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %19 = OpConstantNull %mat2v3half +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half + %22 = OpConstantNull %mat3v2half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_d6faec = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat3v2half Function %22 + %13 = OpTranspose %mat3v2half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_d6faec + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_d6faec + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_d6faec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e269447d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d6faec.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_d6faec() { + var res : mat3x2 = transpose(mat2x3(f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d6faec(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d6faec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d6faec(); +} diff --git a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl new file mode 100644 index 0000000000..2d38478b53 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<3, 4, f32>) -> mat<4, 3, f32> +fn transpose_d8f8ba() { + var res: mat4x3 = transpose(mat3x4(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d8f8ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d8f8ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d8f8ba(); +} diff --git a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0a03a8d9d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_d8f8ba() { + float4x3 res = transpose(float3x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d8f8ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d8f8ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d8f8ba(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0a03a8d9d4 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void transpose_d8f8ba() { + float4x3 res = transpose(float3x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d8f8ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d8f8ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d8f8ba(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.glsl new file mode 100644 index 0000000000..46f6c33785 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void transpose_d8f8ba() { + mat4x3 res = transpose(mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f))); +} + +vec4 vertex_main() { + transpose_d8f8ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_d8f8ba() { + mat4x3 res = transpose(mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f))); +} + +void fragment_main() { + transpose_d8f8ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_d8f8ba() { + mat4x3 res = transpose(mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f))); +} + +void compute_main() { + transpose_d8f8ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.msl new file mode 100644 index 0000000000..4250fcf0e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_d8f8ba() { + float4x3 res = transpose(float3x4(float4(1.0f), float4(1.0f), float4(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_d8f8ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_d8f8ba(); + return; +} + +kernel void compute_main() { + transpose_d8f8ba(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc5b2cb642 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_d8f8ba "transpose_d8f8ba" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %19 = OpConstantComposite %mat3v4float %18 %18 %18 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %22 = OpConstantNull %mat4v3float + %23 = OpTypeFunction %v4float +%transpose_d8f8ba = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat4v3float Function %22 + %13 = OpTranspose %mat4v3float %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_d8f8ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_d8f8ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_d8f8ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..c08b152caa --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/d8f8ba.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn transpose_d8f8ba() { + var res : mat4x3 = transpose(mat3x4(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d8f8ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d8f8ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d8f8ba(); +} diff --git a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl new file mode 100644 index 0000000000..101c03d9e6 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<3, 2, f32>) -> mat<2, 3, f32> +fn transpose_ed4bdc() { + var res: mat2x3 = transpose(mat3x2(1.f, 1.f, 1.f, 1.f, 1.f, 1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_ed4bdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_ed4bdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_ed4bdc(); +} diff --git a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..042c3b7691 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_ed4bdc() { + float2x3 res = transpose(float3x2((1.0f).xx, (1.0f).xx, (1.0f).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_ed4bdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_ed4bdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_ed4bdc(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..042c3b7691 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void transpose_ed4bdc() { + float2x3 res = transpose(float3x2((1.0f).xx, (1.0f).xx, (1.0f).xx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_ed4bdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_ed4bdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_ed4bdc(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.glsl new file mode 100644 index 0000000000..79cd1c3dc5 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void transpose_ed4bdc() { + mat2x3 res = transpose(mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f))); +} + +vec4 vertex_main() { + transpose_ed4bdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_ed4bdc() { + mat2x3 res = transpose(mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f))); +} + +void fragment_main() { + transpose_ed4bdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_ed4bdc() { + mat2x3 res = transpose(mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f))); +} + +void compute_main() { + transpose_ed4bdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.msl new file mode 100644 index 0000000000..3f1013ddc9 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_ed4bdc() { + float2x3 res = transpose(float3x2(float2(1.0f), float2(1.0f), float2(1.0f))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_ed4bdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_ed4bdc(); + return; +} + +kernel void compute_main() { + transpose_ed4bdc(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..1812c0cb04 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_ed4bdc "transpose_ed4bdc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v2float %float_1 %float_1 + %20 = OpConstantComposite %mat3v2float %19 %19 %19 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %23 = OpConstantNull %mat2v3float + %24 = OpTypeFunction %v4float +%transpose_ed4bdc = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat2v3float Function %23 + %13 = OpTranspose %mat2v3float %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %transpose_ed4bdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_ed4bdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_ed4bdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8d73e8798 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/ed4bdc.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn transpose_ed4bdc() { + var res : mat2x3 = transpose(mat3x2(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_ed4bdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_ed4bdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_ed4bdc(); +} diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl new file mode 100644 index 0000000000..706d3bd2d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 4, f16>) -> mat<4, 2, f16> +fn transpose_faeb05() { + var res: mat4x2 = transpose(mat2x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_faeb05(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_faeb05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_faeb05(); +} diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2a44dc6b17 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void transpose_faeb05() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_faeb05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_faeb05(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16ac417e6b --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void transpose_faeb05() { + matrix res = transpose(matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_faeb05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_faeb05(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019548DF3C90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl new file mode 100644 index 0000000000..720b3fdd3d --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_faeb05() { + f16mat4x2 res = transpose(f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf))); +} + +vec4 vertex_main() { + transpose_faeb05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_faeb05() { + f16mat4x2 res = transpose(f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void fragment_main() { + transpose_faeb05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_faeb05() { + f16mat4x2 res = transpose(f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf))); +} + +void compute_main() { + transpose_faeb05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.msl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.msl new file mode 100644 index 0000000000..ec6e27d6b4 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void transpose_faeb05() { + half4x2 res = transpose(half2x4(half4(0.0h), half4(0.0h))); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_faeb05(); + return; +} + +kernel void compute_main() { + transpose_faeb05(); + return; +} + diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.spvasm new file mode 100644 index 0000000000..eff9828ad1 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_faeb05 "transpose_faeb05" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %19 = OpConstantNull %mat2v4half +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half + %22 = OpConstantNull %mat4v2half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_faeb05 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_mat4v2half Function %22 + %13 = OpTranspose %mat4v2half %19 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_faeb05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_faeb05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_faeb05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.wgsl new file mode 100644 index 0000000000..795686f1d2 --- /dev/null +++ b/test/tint/builtins/gen/literal/transpose/faeb05.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn transpose_faeb05() { + var res : mat4x2 = transpose(mat2x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_faeb05(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_faeb05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_faeb05(); +} diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl new file mode 100644 index 0000000000..687471966b --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<3, f16>) -> vec<3, f16> +fn trunc_103ab8() { + var res: vec3 = trunc(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_103ab8(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_103ab8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_103ab8(); +} diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd3ebec191 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_103ab8() { + vector res = trunc((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_103ab8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_103ab8(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e27ff8b79a --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void trunc_103ab8() { + vector res = trunc((float16_t(0.0h)).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_103ab8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_103ab8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022CEF83F530(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl new file mode 100644 index 0000000000..da7798a5dd --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_103ab8() { + f16vec3 res = trunc(f16vec3(0.0hf)); +} + +vec4 vertex_main() { + trunc_103ab8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_103ab8() { + f16vec3 res = trunc(f16vec3(0.0hf)); +} + +void fragment_main() { + trunc_103ab8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_103ab8() { + f16vec3 res = trunc(f16vec3(0.0hf)); +} + +void compute_main() { + trunc_103ab8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl new file mode 100644 index 0000000000..11217431f5 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_103ab8() { + half3 res = trunc(half3(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_103ab8(); + return; +} + +kernel void compute_main() { + trunc_103ab8(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1a21cf9b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_103ab8 "trunc_103ab8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %17 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_103ab8 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3half Function %17 + %13 = OpExtInst %v3half %16 Trunc %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %trunc_103ab8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %trunc_103ab8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %trunc_103ab8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl new file mode 100644 index 0000000000..9422358d36 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn trunc_103ab8() { + var res : vec3 = trunc(vec3(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_103ab8(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_103ab8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_103ab8(); +} diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl new file mode 100644 index 0000000000..8b5dd3f7a9 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(vec<3, f32>) -> vec<3, f32> +fn trunc_562d05() { + var res: vec3 = trunc(vec3(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_562d05(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_562d05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_562d05(); +} diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..070bd71358 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_562d05() { + float3 res = trunc((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_562d05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_562d05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_562d05(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..070bd71358 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void trunc_562d05() { + float3 res = trunc((1.0f).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_562d05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_562d05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_562d05(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.glsl new file mode 100644 index 0000000000..ef1026e378 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void trunc_562d05() { + vec3 res = trunc(vec3(1.0f)); +} + +vec4 vertex_main() { + trunc_562d05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_562d05() { + vec3 res = trunc(vec3(1.0f)); +} + +void fragment_main() { + trunc_562d05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_562d05() { + vec3 res = trunc(vec3(1.0f)); +} + +void compute_main() { + trunc_562d05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.msl new file mode 100644 index 0000000000..28d2dbccb7 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_562d05() { + float3 res = trunc(float3(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_562d05(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_562d05(); + return; +} + +kernel void compute_main() { + trunc_562d05(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.spvasm new file mode 100644 index 0000000000..33af82417f --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_562d05 "trunc_562d05" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %21 = OpTypeFunction %v4float +%trunc_562d05 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %20 + %13 = OpExtInst %v3float %15 Trunc %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %trunc_562d05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %trunc_562d05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %trunc_562d05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6d3bb0ad3 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn trunc_562d05() { + var res : vec3 = trunc(vec3(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_562d05(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_562d05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_562d05(); +} diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl new file mode 100644 index 0000000000..ef8b02ba12 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<2, f16>) -> vec<2, f16> +fn trunc_a56109() { + var res: vec2 = trunc(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_a56109(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_a56109(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_a56109(); +} diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0cc0eb22df --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_a56109() { + vector res = trunc((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_a56109(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_a56109(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..003cc1e2ae --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void trunc_a56109() { + vector res = trunc((float16_t(0.0h)).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_a56109(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_a56109(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C5ED1620(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl new file mode 100644 index 0000000000..d403886e8e --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_a56109() { + f16vec2 res = trunc(f16vec2(0.0hf)); +} + +vec4 vertex_main() { + trunc_a56109(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_a56109() { + f16vec2 res = trunc(f16vec2(0.0hf)); +} + +void fragment_main() { + trunc_a56109(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_a56109() { + f16vec2 res = trunc(f16vec2(0.0hf)); +} + +void compute_main() { + trunc_a56109(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl new file mode 100644 index 0000000000..19d67d9bcf --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_a56109() { + half2 res = trunc(half2(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_a56109(); + return; +} + +kernel void compute_main() { + trunc_a56109(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm new file mode 100644 index 0000000000..5899e0ff86 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_a56109 "trunc_a56109" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %17 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_a56109 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2half Function %17 + %13 = OpExtInst %v2half %16 Trunc %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %trunc_a56109 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %trunc_a56109 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %trunc_a56109 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl new file mode 100644 index 0000000000..174127ef63 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn trunc_a56109() { + var res : vec2 = trunc(vec2(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_a56109(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_a56109(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_a56109(); +} diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl new file mode 100644 index 0000000000..0dccaa6c0b --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(f16) -> f16 +fn trunc_cc2b0d() { + var res: f16 = trunc(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_cc2b0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_cc2b0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_cc2b0d(); +} diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b268816347 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_cc2b0d() { + float16_t res = trunc(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_cc2b0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_cc2b0d(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..afe8dc6b72 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +SKIP: FAILED + +void trunc_cc2b0d() { + float16_t res = trunc(float16_t(0.0h)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_cc2b0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_cc2b0d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000176C0197D30(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000176C0197D30(2,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl new file mode 100644 index 0000000000..257a5710b3 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_cc2b0d() { + float16_t res = trunc(0.0hf); +} + +vec4 vertex_main() { + trunc_cc2b0d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_cc2b0d() { + float16_t res = trunc(0.0hf); +} + +void fragment_main() { + trunc_cc2b0d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_cc2b0d() { + float16_t res = trunc(0.0hf); +} + +void compute_main() { + trunc_cc2b0d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl new file mode 100644 index 0000000000..b2c50aaa8e --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_cc2b0d() { + half res = trunc(0.0h); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_cc2b0d(); + return; +} + +kernel void compute_main() { + trunc_cc2b0d(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.spvasm new file mode 100644 index 0000000000..49a49a2092 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_cc2b0d "trunc_cc2b0d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %16 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_cc2b0d = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_half Function %16 + %13 = OpExtInst %half %15 Trunc %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %trunc_cc2b0d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %trunc_cc2b0d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_cc2b0d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl new file mode 100644 index 0000000000..a20cd36e1c --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn trunc_cc2b0d() { + var res : f16 = trunc(f16()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_cc2b0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_cc2b0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_cc2b0d(); +} diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl new file mode 100644 index 0000000000..bae66bee52 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<4, f16>) -> vec<4, f16> +fn trunc_ce7c17() { + var res: vec4 = trunc(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_ce7c17(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_ce7c17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_ce7c17(); +} diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83e63a116f --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_ce7c17() { + vector res = trunc((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_ce7c17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_ce7c17(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..08aa6d3b94 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + +void trunc_ce7c17() { + vector res = trunc((float16_t(0.0h)).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_ce7c17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_ce7c17(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000235C1E68810(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl new file mode 100644 index 0000000000..1ab86a51ad --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_ce7c17() { + f16vec4 res = trunc(f16vec4(0.0hf)); +} + +vec4 vertex_main() { + trunc_ce7c17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_ce7c17() { + f16vec4 res = trunc(f16vec4(0.0hf)); +} + +void fragment_main() { + trunc_ce7c17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_ce7c17() { + f16vec4 res = trunc(f16vec4(0.0hf)); +} + +void compute_main() { + trunc_ce7c17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl new file mode 100644 index 0000000000..bbb5f1e3e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_ce7c17() { + half4 res = trunc(half4(0.0h)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_ce7c17(); + return; +} + +kernel void compute_main() { + trunc_ce7c17(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm new file mode 100644 index 0000000000..2eecaa2e26 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_ce7c17 "trunc_ce7c17" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %17 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_ce7c17 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4half Function %17 + %13 = OpExtInst %v4half %16 Trunc %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %trunc_ce7c17 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %trunc_ce7c17 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %trunc_ce7c17 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl new file mode 100644 index 0000000000..0004a8c4a3 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +enable f16; + +fn trunc_ce7c17() { + var res : vec4 = trunc(vec4(f16())); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_ce7c17(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_ce7c17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_ce7c17(); +} diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl new file mode 100644 index 0000000000..5894d363b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(vec<4, f32>) -> vec<4, f32> +fn trunc_e183aa() { + var res: vec4 = trunc(vec4(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_e183aa(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_e183aa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_e183aa(); +} diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a60a1323f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_e183aa() { + float4 res = trunc((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_e183aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_e183aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_e183aa(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a60a1323f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void trunc_e183aa() { + float4 res = trunc((1.0f).xxxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_e183aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_e183aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_e183aa(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.glsl new file mode 100644 index 0000000000..fe0ba3bed7 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void trunc_e183aa() { + vec4 res = trunc(vec4(1.0f)); +} + +vec4 vertex_main() { + trunc_e183aa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_e183aa() { + vec4 res = trunc(vec4(1.0f)); +} + +void fragment_main() { + trunc_e183aa(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_e183aa() { + vec4 res = trunc(vec4(1.0f)); +} + +void compute_main() { + trunc_e183aa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.msl new file mode 100644 index 0000000000..960dffdb99 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_e183aa() { + float4 res = trunc(float4(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_e183aa(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_e183aa(); + return; +} + +kernel void compute_main() { + trunc_e183aa(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.spvasm new file mode 100644 index 0000000000..715c2a5863 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %14 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_e183aa "trunc_e183aa" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %19 = OpTypeFunction %v4float +%trunc_e183aa = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %13 = OpExtInst %v4float %14 Trunc %16 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %trunc_e183aa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %trunc_e183aa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %trunc_e183aa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.wgsl new file mode 100644 index 0000000000..00a29916f9 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn trunc_e183aa() { + var res : vec4 = trunc(vec4(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_e183aa(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_e183aa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_e183aa(); +} diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl new file mode 100644 index 0000000000..6634dda54e --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(f32) -> f32 +fn trunc_eb83df() { + var res: f32 = trunc(1.f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_eb83df(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_eb83df(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_eb83df(); +} diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..082acc562d --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_eb83df() { + float res = trunc(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_eb83df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_eb83df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_eb83df(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..082acc562d --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void trunc_eb83df() { + float res = trunc(1.0f); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_eb83df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_eb83df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_eb83df(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.glsl new file mode 100644 index 0000000000..d4b264e129 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void trunc_eb83df() { + float res = trunc(1.0f); +} + +vec4 vertex_main() { + trunc_eb83df(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_eb83df() { + float res = trunc(1.0f); +} + +void fragment_main() { + trunc_eb83df(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_eb83df() { + float res = trunc(1.0f); +} + +void compute_main() { + trunc_eb83df(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.msl new file mode 100644 index 0000000000..3498d6e681 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_eb83df() { + float res = trunc(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_eb83df(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_eb83df(); + return; +} + +kernel void compute_main() { + trunc_eb83df(); + return; +} + diff --git a/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/trunc/eb83df.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1207fb551 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn trunc_eb83df() { + var res : f32 = trunc(1.0f); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_eb83df(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_eb83df(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_eb83df(); +} diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl new file mode 100644 index 0000000000..a936cdf201 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(vec<2, f32>) -> vec<2, f32> +fn trunc_f370d3() { + var res: vec2 = trunc(vec2(1.f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_f370d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_f370d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_f370d3(); +} diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8e7b9d733b --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void trunc_f370d3() { + float2 res = trunc((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_f370d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_f370d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_f370d3(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e7b9d733b --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void trunc_f370d3() { + float2 res = trunc((1.0f).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_f370d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_f370d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_f370d3(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.glsl new file mode 100644 index 0000000000..ff8b53fc62 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void trunc_f370d3() { + vec2 res = trunc(vec2(1.0f)); +} + +vec4 vertex_main() { + trunc_f370d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_f370d3() { + vec2 res = trunc(vec2(1.0f)); +} + +void fragment_main() { + trunc_f370d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_f370d3() { + vec2 res = trunc(vec2(1.0f)); +} + +void compute_main() { + trunc_f370d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.msl new file mode 100644 index 0000000000..ae71a0aaf3 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void trunc_f370d3() { + float2 res = trunc(float2(1.0f)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_f370d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_f370d3(); + return; +} + +kernel void compute_main() { + trunc_f370d3(); + return; +} + diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.spvasm new file mode 100644 index 0000000000..07e4e38729 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %15 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_f370d3 "trunc_f370d3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpConstantNull %v2float + %21 = OpTypeFunction %v4float +%trunc_f370d3 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %20 + %13 = OpExtInst %v2float %15 Trunc %17 + OpStore %res %13 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %trunc_f370d3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %trunc_f370d3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %trunc_f370d3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..75b84d8e41 --- /dev/null +++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn trunc_f370d3() { + var res : vec2 = trunc(vec2(1.0f)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_f370d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_f370d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_f370d3(); +} diff --git a/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl new file mode 100644 index 0000000000..cd44527f2a --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack2x16float(u32) -> vec2 +fn unpack2x16float_32a5cf() { + var res: vec2 = unpack2x16float(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16float_32a5cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16float_32a5cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16float_32a5cf(); +} diff --git a/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..42e474940e --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_unpack2x16float(uint param_0) { + uint i = param_0; + return f16tof32(uint2(i & 0xffff, i >> 16)); +} + +void unpack2x16float_32a5cf() { + float2 res = tint_unpack2x16float(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16float_32a5cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16float_32a5cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16float_32a5cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..42e474940e --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_unpack2x16float(uint param_0) { + uint i = param_0; + return f16tof32(uint2(i & 0xffff, i >> 16)); +} + +void unpack2x16float_32a5cf() { + float2 res = tint_unpack2x16float(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16float_32a5cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16float_32a5cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16float_32a5cf(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.glsl new file mode 100644 index 0000000000..8a9c3429e5 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void unpack2x16float_32a5cf() { + vec2 res = unpackHalf2x16(1u); +} + +vec4 vertex_main() { + unpack2x16float_32a5cf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack2x16float_32a5cf() { + vec2 res = unpackHalf2x16(1u); +} + +void fragment_main() { + unpack2x16float_32a5cf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack2x16float_32a5cf() { + vec2 res = unpackHalf2x16(1u); +} + +void compute_main() { + unpack2x16float_32a5cf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.msl b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.msl new file mode 100644 index 0000000000..0a2dcfc9f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void unpack2x16float_32a5cf() { + float2 res = float2(as_type(1u)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack2x16float_32a5cf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack2x16float_32a5cf(); + return; +} + +kernel void compute_main() { + unpack2x16float_32a5cf(); + return; +} + diff --git a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..76d821a686 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16float/32a5cf.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn unpack2x16float_32a5cf() { + var res : vec2 = unpack2x16float(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16float_32a5cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16float_32a5cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16float_32a5cf(); +} diff --git a/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl new file mode 100644 index 0000000000..12006bed6a --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack2x16snorm(u32) -> vec2 +fn unpack2x16snorm_b4aea6() { + var res: vec2 = unpack2x16snorm(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16snorm_b4aea6(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16snorm_b4aea6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16snorm_b4aea6(); +} diff --git a/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..24b536c97c --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +float2 tint_unpack2x16snorm(uint param_0) { + int j = int(param_0); + int2 i = int2(j << 16, j) >> 16; + return clamp(float2(i) / 32767.0, -1.0, 1.0); +} + +void unpack2x16snorm_b4aea6() { + float2 res = tint_unpack2x16snorm(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16snorm_b4aea6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16snorm_b4aea6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16snorm_b4aea6(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..24b536c97c --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +float2 tint_unpack2x16snorm(uint param_0) { + int j = int(param_0); + int2 i = int2(j << 16, j) >> 16; + return clamp(float2(i) / 32767.0, -1.0, 1.0); +} + +void unpack2x16snorm_b4aea6() { + float2 res = tint_unpack2x16snorm(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16snorm_b4aea6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16snorm_b4aea6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16snorm_b4aea6(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.glsl new file mode 100644 index 0000000000..7c89bcd396 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void unpack2x16snorm_b4aea6() { + vec2 res = unpackSnorm2x16(1u); +} + +vec4 vertex_main() { + unpack2x16snorm_b4aea6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack2x16snorm_b4aea6() { + vec2 res = unpackSnorm2x16(1u); +} + +void fragment_main() { + unpack2x16snorm_b4aea6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack2x16snorm_b4aea6() { + vec2 res = unpackSnorm2x16(1u); +} + +void compute_main() { + unpack2x16snorm_b4aea6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.msl b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.msl new file mode 100644 index 0000000000..d9eb4d493f --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void unpack2x16snorm_b4aea6() { + float2 res = unpack_snorm2x16_to_float(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack2x16snorm_b4aea6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack2x16snorm_b4aea6(); + return; +} + +kernel void compute_main() { + unpack2x16snorm_b4aea6(); + return; +} + diff --git a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.wgsl new file mode 100644 index 0000000000..24d8b1d174 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16snorm/b4aea6.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn unpack2x16snorm_b4aea6() { + var res : vec2 = unpack2x16snorm(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16snorm_b4aea6(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16snorm_b4aea6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16snorm_b4aea6(); +} diff --git a/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl new file mode 100644 index 0000000000..88b5c59516 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack2x16unorm(u32) -> vec2 +fn unpack2x16unorm_7699c0() { + var res: vec2 = unpack2x16unorm(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16unorm_7699c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16unorm_7699c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16unorm_7699c0(); +} diff --git a/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a3f1ab811f --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +float2 tint_unpack2x16unorm(uint param_0) { + uint j = param_0; + uint2 i = uint2(j & 0xffff, j >> 16); + return float2(i) / 65535.0; +} + +void unpack2x16unorm_7699c0() { + float2 res = tint_unpack2x16unorm(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16unorm_7699c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16unorm_7699c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16unorm_7699c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a3f1ab811f --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +float2 tint_unpack2x16unorm(uint param_0) { + uint j = param_0; + uint2 i = uint2(j & 0xffff, j >> 16); + return float2(i) / 65535.0; +} + +void unpack2x16unorm_7699c0() { + float2 res = tint_unpack2x16unorm(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16unorm_7699c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16unorm_7699c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16unorm_7699c0(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.glsl new file mode 100644 index 0000000000..08d6519e4e --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void unpack2x16unorm_7699c0() { + vec2 res = unpackUnorm2x16(1u); +} + +vec4 vertex_main() { + unpack2x16unorm_7699c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack2x16unorm_7699c0() { + vec2 res = unpackUnorm2x16(1u); +} + +void fragment_main() { + unpack2x16unorm_7699c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack2x16unorm_7699c0() { + vec2 res = unpackUnorm2x16(1u); +} + +void compute_main() { + unpack2x16unorm_7699c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.msl b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.msl new file mode 100644 index 0000000000..352921c7ef --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void unpack2x16unorm_7699c0() { + float2 res = unpack_unorm2x16_to_float(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack2x16unorm_7699c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack2x16unorm_7699c0(); + return; +} + +kernel void compute_main() { + unpack2x16unorm_7699c0(); + return; +} + diff --git a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..46b5d0290a --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack2x16unorm/7699c0.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn unpack2x16unorm_7699c0() { + var res : vec2 = unpack2x16unorm(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16unorm_7699c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16unorm_7699c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16unorm_7699c0(); +} diff --git a/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl new file mode 100644 index 0000000000..55d0df3b92 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack4x8snorm(u32) -> vec4 +fn unpack4x8snorm_523fb3() { + var res: vec4 = unpack4x8snorm(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8snorm_523fb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack4x8snorm_523fb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack4x8snorm_523fb3(); +} diff --git a/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..20f0953dfe --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +void unpack4x8snorm_523fb3() { + float4 res = tint_unpack4x8snorm(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8snorm_523fb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8snorm_523fb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8snorm_523fb3(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20f0953dfe --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +void unpack4x8snorm_523fb3() { + float4 res = tint_unpack4x8snorm(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8snorm_523fb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8snorm_523fb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8snorm_523fb3(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.glsl new file mode 100644 index 0000000000..21c913aa84 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void unpack4x8snorm_523fb3() { + vec4 res = unpackSnorm4x8(1u); +} + +vec4 vertex_main() { + unpack4x8snorm_523fb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack4x8snorm_523fb3() { + vec4 res = unpackSnorm4x8(1u); +} + +void fragment_main() { + unpack4x8snorm_523fb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack4x8snorm_523fb3() { + vec4 res = unpackSnorm4x8(1u); +} + +void compute_main() { + unpack4x8snorm_523fb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.msl b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.msl new file mode 100644 index 0000000000..35b8035e07 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void unpack4x8snorm_523fb3() { + float4 res = unpack_snorm4x8_to_float(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack4x8snorm_523fb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack4x8snorm_523fb3(); + return; +} + +kernel void compute_main() { + unpack4x8snorm_523fb3(); + return; +} + diff --git a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc1452d052 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8snorm/523fb3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn unpack4x8snorm_523fb3() { + var res : vec4 = unpack4x8snorm(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8snorm_523fb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack4x8snorm_523fb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack4x8snorm_523fb3(); +} diff --git a/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl new file mode 100644 index 0000000000..d41eb9c9e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack4x8unorm(u32) -> vec4 +fn unpack4x8unorm_750c74() { + var res: vec4 = unpack4x8unorm(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8unorm_750c74(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack4x8unorm_750c74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack4x8unorm_750c74(); +} diff --git a/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6ce7cb7da9 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +void unpack4x8unorm_750c74() { + float4 res = tint_unpack4x8unorm(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8unorm_750c74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8unorm_750c74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8unorm_750c74(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ce7cb7da9 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +void unpack4x8unorm_750c74() { + float4 res = tint_unpack4x8unorm(1u); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8unorm_750c74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8unorm_750c74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8unorm_750c74(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.glsl b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.glsl new file mode 100644 index 0000000000..6517ae7bb2 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void unpack4x8unorm_750c74() { + vec4 res = unpackUnorm4x8(1u); +} + +vec4 vertex_main() { + unpack4x8unorm_750c74(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack4x8unorm_750c74() { + vec4 res = unpackUnorm4x8(1u); +} + +void fragment_main() { + unpack4x8unorm_750c74(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack4x8unorm_750c74() { + vec4 res = unpackUnorm4x8(1u); +} + +void compute_main() { + unpack4x8unorm_750c74(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.msl b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.msl new file mode 100644 index 0000000000..0fccbcf433 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void unpack4x8unorm_750c74() { + float4 res = unpack_unorm4x8_to_float(1u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack4x8unorm_750c74(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack4x8unorm_750c74(); + return; +} + +kernel void compute_main() { + unpack4x8unorm_750c74(); + return; +} + diff --git a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.wgsl new file mode 100644 index 0000000000..eeb5aa8c85 --- /dev/null +++ b/test/tint/builtins/gen/literal/unpack4x8unorm/750c74.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn unpack4x8unorm_750c74() { + var res : vec4 = unpack4x8unorm(1u); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8unorm_750c74(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack4x8unorm_750c74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack4x8unorm_750c74(); +} diff --git a/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl new file mode 100644 index 0000000000..e4933373e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn workgroupBarrier() +fn workgroupBarrier_a17f7f() { + workgroupBarrier(); +} + +@compute @workgroup_size(1) +fn compute_main() { + workgroupBarrier_a17f7f(); +} diff --git a/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.hlsl b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.hlsl rename to test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.dxc.hlsl diff --git a/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8879f79963 --- /dev/null +++ b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void workgroupBarrier_a17f7f() { + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void compute_main() { + workgroupBarrier_a17f7f(); + return; +} diff --git a/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.glsl similarity index 100% rename from test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.glsl rename to test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.glsl diff --git a/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.msl b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.msl similarity index 100% rename from test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.msl rename to test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.msl diff --git a/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.spvasm similarity index 100% rename from test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.spvasm rename to test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.spvasm diff --git a/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.wgsl new file mode 100644 index 0000000000..377a35e3e8 --- /dev/null +++ b/test/tint/builtins/gen/literal/workgroupBarrier/a17f7f.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn workgroupBarrier_a17f7f() { + workgroupBarrier(); +} + +@compute @workgroup_size(1) +fn compute_main() { + workgroupBarrier_a17f7f(); +} diff --git a/test/tint/builtins/gen/log/3da25a.wgsl b/test/tint/builtins/gen/log/3da25a.wgsl deleted file mode 100644 index c487a2028b..0000000000 --- a/test/tint/builtins/gen/log/3da25a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn log(vec<4, f32>) -> vec<4, f32> -fn log_3da25a() { - var res: vec4 = log(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log_3da25a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log_3da25a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log_3da25a(); -} diff --git a/test/tint/builtins/gen/log/3da25a.wgsl.expected.glsl b/test/tint/builtins/gen/log/3da25a.wgsl.expected.glsl deleted file mode 100644 index 5d2879e932..0000000000 --- a/test/tint/builtins/gen/log/3da25a.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void log_3da25a() { - vec4 res = log(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - log_3da25a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void log_3da25a() { - vec4 res = log(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - log_3da25a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void log_3da25a() { - vec4 res = log(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - log_3da25a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/log/3da25a.wgsl.expected.hlsl b/test/tint/builtins/gen/log/3da25a.wgsl.expected.hlsl deleted file mode 100644 index d406a40f65..0000000000 --- a/test/tint/builtins/gen/log/3da25a.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void log_3da25a() { - float4 res = log(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - log_3da25a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - log_3da25a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - log_3da25a(); - return; -} diff --git a/test/tint/builtins/gen/log/3da25a.wgsl.expected.msl b/test/tint/builtins/gen/log/3da25a.wgsl.expected.msl deleted file mode 100644 index d87aca8e36..0000000000 --- a/test/tint/builtins/gen/log/3da25a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void log_3da25a() { - float4 res = log(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - log_3da25a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - log_3da25a(); - return; -} - -kernel void compute_main() { - log_3da25a(); - return; -} - diff --git a/test/tint/builtins/gen/log/3da25a.wgsl.expected.spvasm b/test/tint/builtins/gen/log/3da25a.wgsl.expected.spvasm deleted file mode 100644 index 2546b7f529..0000000000 --- a/test/tint/builtins/gen/log/3da25a.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %log_3da25a "log_3da25a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %log_3da25a = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Log %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %log_3da25a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %log_3da25a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %log_3da25a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/log/3da25a.wgsl.expected.wgsl b/test/tint/builtins/gen/log/3da25a.wgsl.expected.wgsl deleted file mode 100644 index 2265445957..0000000000 --- a/test/tint/builtins/gen/log/3da25a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn log_3da25a() { - var res : vec4 = log(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log_3da25a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log_3da25a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log_3da25a(); -} diff --git a/test/tint/builtins/gen/log/7114a6.wgsl b/test/tint/builtins/gen/log/7114a6.wgsl deleted file mode 100644 index b3c4b747c8..0000000000 --- a/test/tint/builtins/gen/log/7114a6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn log(f32) -> f32 -fn log_7114a6() { - var res: f32 = log(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log_7114a6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log_7114a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log_7114a6(); -} diff --git a/test/tint/builtins/gen/log/7114a6.wgsl.expected.glsl b/test/tint/builtins/gen/log/7114a6.wgsl.expected.glsl deleted file mode 100644 index 8998eaf41e..0000000000 --- a/test/tint/builtins/gen/log/7114a6.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void log_7114a6() { - float res = log(1.0f); -} - -vec4 vertex_main() { - log_7114a6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void log_7114a6() { - float res = log(1.0f); -} - -void fragment_main() { - log_7114a6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void log_7114a6() { - float res = log(1.0f); -} - -void compute_main() { - log_7114a6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/log/7114a6.wgsl.expected.hlsl b/test/tint/builtins/gen/log/7114a6.wgsl.expected.hlsl deleted file mode 100644 index 3b786d27d2..0000000000 --- a/test/tint/builtins/gen/log/7114a6.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void log_7114a6() { - float res = log(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - log_7114a6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - log_7114a6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - log_7114a6(); - return; -} diff --git a/test/tint/builtins/gen/log/7114a6.wgsl.expected.msl b/test/tint/builtins/gen/log/7114a6.wgsl.expected.msl deleted file mode 100644 index 5ec0b4da3c..0000000000 --- a/test/tint/builtins/gen/log/7114a6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void log_7114a6() { - float res = log(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - log_7114a6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - log_7114a6(); - return; -} - -kernel void compute_main() { - log_7114a6(); - return; -} - diff --git a/test/tint/builtins/gen/log/7114a6.wgsl.expected.wgsl b/test/tint/builtins/gen/log/7114a6.wgsl.expected.wgsl deleted file mode 100644 index 6a688f0dcd..0000000000 --- a/test/tint/builtins/gen/log/7114a6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn log_7114a6() { - var res : f32 = log(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log_7114a6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log_7114a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log_7114a6(); -} diff --git a/test/tint/builtins/gen/log/b2ce28.wgsl b/test/tint/builtins/gen/log/b2ce28.wgsl deleted file mode 100644 index 1a52cf45c0..0000000000 --- a/test/tint/builtins/gen/log/b2ce28.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn log(vec<2, f32>) -> vec<2, f32> -fn log_b2ce28() { - var res: vec2 = log(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log_b2ce28(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log_b2ce28(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log_b2ce28(); -} diff --git a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.glsl b/test/tint/builtins/gen/log/b2ce28.wgsl.expected.glsl deleted file mode 100644 index 18981b039a..0000000000 --- a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void log_b2ce28() { - vec2 res = log(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - log_b2ce28(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void log_b2ce28() { - vec2 res = log(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - log_b2ce28(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void log_b2ce28() { - vec2 res = log(vec2(0.0f, 0.0f)); -} - -void compute_main() { - log_b2ce28(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.hlsl b/test/tint/builtins/gen/log/b2ce28.wgsl.expected.hlsl deleted file mode 100644 index dc14337e5d..0000000000 --- a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void log_b2ce28() { - float2 res = log(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - log_b2ce28(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - log_b2ce28(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - log_b2ce28(); - return; -} diff --git a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.msl b/test/tint/builtins/gen/log/b2ce28.wgsl.expected.msl deleted file mode 100644 index a99ad96cce..0000000000 --- a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void log_b2ce28() { - float2 res = log(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - log_b2ce28(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - log_b2ce28(); - return; -} - -kernel void compute_main() { - log_b2ce28(); - return; -} - diff --git a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.spvasm b/test/tint/builtins/gen/log/b2ce28.wgsl.expected.spvasm deleted file mode 100644 index d64f498cef..0000000000 --- a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %log_b2ce28 "log_b2ce28" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %log_b2ce28 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Log %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %log_b2ce28 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %log_b2ce28 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %log_b2ce28 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.wgsl b/test/tint/builtins/gen/log/b2ce28.wgsl.expected.wgsl deleted file mode 100644 index 023eb1b45b..0000000000 --- a/test/tint/builtins/gen/log/b2ce28.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn log_b2ce28() { - var res : vec2 = log(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log_b2ce28(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log_b2ce28(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log_b2ce28(); -} diff --git a/test/tint/builtins/gen/log/f4c570.wgsl b/test/tint/builtins/gen/log/f4c570.wgsl deleted file mode 100644 index f6a1a388aa..0000000000 --- a/test/tint/builtins/gen/log/f4c570.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn log(vec<3, f32>) -> vec<3, f32> -fn log_f4c570() { - var res: vec3 = log(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log_f4c570(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log_f4c570(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log_f4c570(); -} diff --git a/test/tint/builtins/gen/log/f4c570.wgsl.expected.glsl b/test/tint/builtins/gen/log/f4c570.wgsl.expected.glsl deleted file mode 100644 index 8ddbdbb3d0..0000000000 --- a/test/tint/builtins/gen/log/f4c570.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void log_f4c570() { - vec3 res = log(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - log_f4c570(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void log_f4c570() { - vec3 res = log(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - log_f4c570(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void log_f4c570() { - vec3 res = log(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - log_f4c570(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/log/f4c570.wgsl.expected.hlsl b/test/tint/builtins/gen/log/f4c570.wgsl.expected.hlsl deleted file mode 100644 index 5e8332f96f..0000000000 --- a/test/tint/builtins/gen/log/f4c570.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void log_f4c570() { - float3 res = log(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - log_f4c570(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - log_f4c570(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - log_f4c570(); - return; -} diff --git a/test/tint/builtins/gen/log/f4c570.wgsl.expected.msl b/test/tint/builtins/gen/log/f4c570.wgsl.expected.msl deleted file mode 100644 index 2b95150d04..0000000000 --- a/test/tint/builtins/gen/log/f4c570.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void log_f4c570() { - float3 res = log(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - log_f4c570(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - log_f4c570(); - return; -} - -kernel void compute_main() { - log_f4c570(); - return; -} - diff --git a/test/tint/builtins/gen/log/f4c570.wgsl.expected.spvasm b/test/tint/builtins/gen/log/f4c570.wgsl.expected.spvasm deleted file mode 100644 index 32ce39c22d..0000000000 --- a/test/tint/builtins/gen/log/f4c570.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %log_f4c570 "log_f4c570" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %log_f4c570 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Log %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %log_f4c570 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %log_f4c570 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %log_f4c570 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/log/f4c570.wgsl.expected.wgsl b/test/tint/builtins/gen/log/f4c570.wgsl.expected.wgsl deleted file mode 100644 index 9317aad7c3..0000000000 --- a/test/tint/builtins/gen/log/f4c570.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn log_f4c570() { - var res : vec3 = log(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log_f4c570(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log_f4c570(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log_f4c570(); -} diff --git a/test/tint/builtins/gen/log2/4036ed.wgsl b/test/tint/builtins/gen/log2/4036ed.wgsl deleted file mode 100644 index bd4b0f34a9..0000000000 --- a/test/tint/builtins/gen/log2/4036ed.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn log2(f32) -> f32 -fn log2_4036ed() { - var res: f32 = log2(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log2_4036ed(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log2_4036ed(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log2_4036ed(); -} diff --git a/test/tint/builtins/gen/log2/4036ed.wgsl.expected.glsl b/test/tint/builtins/gen/log2/4036ed.wgsl.expected.glsl deleted file mode 100644 index f62213d01b..0000000000 --- a/test/tint/builtins/gen/log2/4036ed.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void log2_4036ed() { - float res = log2(1.0f); -} - -vec4 vertex_main() { - log2_4036ed(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void log2_4036ed() { - float res = log2(1.0f); -} - -void fragment_main() { - log2_4036ed(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void log2_4036ed() { - float res = log2(1.0f); -} - -void compute_main() { - log2_4036ed(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/log2/4036ed.wgsl.expected.hlsl b/test/tint/builtins/gen/log2/4036ed.wgsl.expected.hlsl deleted file mode 100644 index 2428a28406..0000000000 --- a/test/tint/builtins/gen/log2/4036ed.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void log2_4036ed() { - float res = log2(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - log2_4036ed(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - log2_4036ed(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - log2_4036ed(); - return; -} diff --git a/test/tint/builtins/gen/log2/4036ed.wgsl.expected.msl b/test/tint/builtins/gen/log2/4036ed.wgsl.expected.msl deleted file mode 100644 index a0e25293c2..0000000000 --- a/test/tint/builtins/gen/log2/4036ed.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void log2_4036ed() { - float res = log2(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - log2_4036ed(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - log2_4036ed(); - return; -} - -kernel void compute_main() { - log2_4036ed(); - return; -} - diff --git a/test/tint/builtins/gen/log2/4036ed.wgsl.expected.wgsl b/test/tint/builtins/gen/log2/4036ed.wgsl.expected.wgsl deleted file mode 100644 index e64775f525..0000000000 --- a/test/tint/builtins/gen/log2/4036ed.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn log2_4036ed() { - var res : f32 = log2(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log2_4036ed(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log2_4036ed(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log2_4036ed(); -} diff --git a/test/tint/builtins/gen/log2/902988.wgsl b/test/tint/builtins/gen/log2/902988.wgsl deleted file mode 100644 index 19328feb7c..0000000000 --- a/test/tint/builtins/gen/log2/902988.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn log2(vec<4, f32>) -> vec<4, f32> -fn log2_902988() { - var res: vec4 = log2(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log2_902988(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log2_902988(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log2_902988(); -} diff --git a/test/tint/builtins/gen/log2/902988.wgsl.expected.glsl b/test/tint/builtins/gen/log2/902988.wgsl.expected.glsl deleted file mode 100644 index bc0717b5c1..0000000000 --- a/test/tint/builtins/gen/log2/902988.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void log2_902988() { - vec4 res = log2(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - log2_902988(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void log2_902988() { - vec4 res = log2(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - log2_902988(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void log2_902988() { - vec4 res = log2(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - log2_902988(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/log2/902988.wgsl.expected.hlsl b/test/tint/builtins/gen/log2/902988.wgsl.expected.hlsl deleted file mode 100644 index ad66bdb1ae..0000000000 --- a/test/tint/builtins/gen/log2/902988.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void log2_902988() { - float4 res = log2(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - log2_902988(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - log2_902988(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - log2_902988(); - return; -} diff --git a/test/tint/builtins/gen/log2/902988.wgsl.expected.msl b/test/tint/builtins/gen/log2/902988.wgsl.expected.msl deleted file mode 100644 index e3aa073569..0000000000 --- a/test/tint/builtins/gen/log2/902988.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void log2_902988() { - float4 res = log2(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - log2_902988(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - log2_902988(); - return; -} - -kernel void compute_main() { - log2_902988(); - return; -} - diff --git a/test/tint/builtins/gen/log2/902988.wgsl.expected.spvasm b/test/tint/builtins/gen/log2/902988.wgsl.expected.spvasm deleted file mode 100644 index 81e911869e..0000000000 --- a/test/tint/builtins/gen/log2/902988.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %log2_902988 "log2_902988" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%log2_902988 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Log2 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %log2_902988 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %log2_902988 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %log2_902988 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/log2/902988.wgsl.expected.wgsl b/test/tint/builtins/gen/log2/902988.wgsl.expected.wgsl deleted file mode 100644 index 345da9e439..0000000000 --- a/test/tint/builtins/gen/log2/902988.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn log2_902988() { - var res : vec4 = log2(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log2_902988(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log2_902988(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log2_902988(); -} diff --git a/test/tint/builtins/gen/log2/adb233.wgsl b/test/tint/builtins/gen/log2/adb233.wgsl deleted file mode 100644 index dfd796f073..0000000000 --- a/test/tint/builtins/gen/log2/adb233.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn log2(vec<3, f32>) -> vec<3, f32> -fn log2_adb233() { - var res: vec3 = log2(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log2_adb233(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log2_adb233(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log2_adb233(); -} diff --git a/test/tint/builtins/gen/log2/adb233.wgsl.expected.glsl b/test/tint/builtins/gen/log2/adb233.wgsl.expected.glsl deleted file mode 100644 index f05f951401..0000000000 --- a/test/tint/builtins/gen/log2/adb233.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void log2_adb233() { - vec3 res = log2(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - log2_adb233(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void log2_adb233() { - vec3 res = log2(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - log2_adb233(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void log2_adb233() { - vec3 res = log2(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - log2_adb233(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/log2/adb233.wgsl.expected.hlsl b/test/tint/builtins/gen/log2/adb233.wgsl.expected.hlsl deleted file mode 100644 index 4d6cbf2da7..0000000000 --- a/test/tint/builtins/gen/log2/adb233.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void log2_adb233() { - float3 res = log2(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - log2_adb233(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - log2_adb233(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - log2_adb233(); - return; -} diff --git a/test/tint/builtins/gen/log2/adb233.wgsl.expected.msl b/test/tint/builtins/gen/log2/adb233.wgsl.expected.msl deleted file mode 100644 index 44c818c43e..0000000000 --- a/test/tint/builtins/gen/log2/adb233.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void log2_adb233() { - float3 res = log2(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - log2_adb233(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - log2_adb233(); - return; -} - -kernel void compute_main() { - log2_adb233(); - return; -} - diff --git a/test/tint/builtins/gen/log2/adb233.wgsl.expected.spvasm b/test/tint/builtins/gen/log2/adb233.wgsl.expected.spvasm deleted file mode 100644 index 5218f913ba..0000000000 --- a/test/tint/builtins/gen/log2/adb233.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %log2_adb233 "log2_adb233" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%log2_adb233 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Log2 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %log2_adb233 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %log2_adb233 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %log2_adb233 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/log2/adb233.wgsl.expected.wgsl b/test/tint/builtins/gen/log2/adb233.wgsl.expected.wgsl deleted file mode 100644 index 89634c272c..0000000000 --- a/test/tint/builtins/gen/log2/adb233.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn log2_adb233() { - var res : vec3 = log2(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log2_adb233(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log2_adb233(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log2_adb233(); -} diff --git a/test/tint/builtins/gen/log2/aea659.wgsl b/test/tint/builtins/gen/log2/aea659.wgsl deleted file mode 100644 index 1cc02c6271..0000000000 --- a/test/tint/builtins/gen/log2/aea659.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn log2(vec<2, f32>) -> vec<2, f32> -fn log2_aea659() { - var res: vec2 = log2(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log2_aea659(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log2_aea659(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log2_aea659(); -} diff --git a/test/tint/builtins/gen/log2/aea659.wgsl.expected.glsl b/test/tint/builtins/gen/log2/aea659.wgsl.expected.glsl deleted file mode 100644 index a0c80be6fd..0000000000 --- a/test/tint/builtins/gen/log2/aea659.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void log2_aea659() { - vec2 res = log2(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - log2_aea659(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void log2_aea659() { - vec2 res = log2(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - log2_aea659(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void log2_aea659() { - vec2 res = log2(vec2(0.0f, 0.0f)); -} - -void compute_main() { - log2_aea659(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/log2/aea659.wgsl.expected.hlsl b/test/tint/builtins/gen/log2/aea659.wgsl.expected.hlsl deleted file mode 100644 index ebc6208870..0000000000 --- a/test/tint/builtins/gen/log2/aea659.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void log2_aea659() { - float2 res = log2(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - log2_aea659(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - log2_aea659(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - log2_aea659(); - return; -} diff --git a/test/tint/builtins/gen/log2/aea659.wgsl.expected.msl b/test/tint/builtins/gen/log2/aea659.wgsl.expected.msl deleted file mode 100644 index 52b6a1a03a..0000000000 --- a/test/tint/builtins/gen/log2/aea659.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void log2_aea659() { - float2 res = log2(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - log2_aea659(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - log2_aea659(); - return; -} - -kernel void compute_main() { - log2_aea659(); - return; -} - diff --git a/test/tint/builtins/gen/log2/aea659.wgsl.expected.spvasm b/test/tint/builtins/gen/log2/aea659.wgsl.expected.spvasm deleted file mode 100644 index 708bf37692..0000000000 --- a/test/tint/builtins/gen/log2/aea659.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %log2_aea659 "log2_aea659" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%log2_aea659 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Log2 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %log2_aea659 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %log2_aea659 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %log2_aea659 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/log2/aea659.wgsl.expected.wgsl b/test/tint/builtins/gen/log2/aea659.wgsl.expected.wgsl deleted file mode 100644 index a77648e8ed..0000000000 --- a/test/tint/builtins/gen/log2/aea659.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn log2_aea659() { - var res : vec2 = log2(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - log2_aea659(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - log2_aea659(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - log2_aea659(); -} diff --git a/test/tint/builtins/gen/max/0c0aae.wgsl b/test/tint/builtins/gen/max/0c0aae.wgsl deleted file mode 100644 index 0df86118f6..0000000000 --- a/test/tint/builtins/gen/max/0c0aae.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(u32, u32) -> u32 -fn max_0c0aae() { - var res: u32 = max(1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_0c0aae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_0c0aae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_0c0aae(); -} diff --git a/test/tint/builtins/gen/max/0c0aae.wgsl.expected.glsl b/test/tint/builtins/gen/max/0c0aae.wgsl.expected.glsl deleted file mode 100644 index 399664f4f5..0000000000 --- a/test/tint/builtins/gen/max/0c0aae.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_0c0aae() { - uint res = max(1u, 1u); -} - -vec4 vertex_main() { - max_0c0aae(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_0c0aae() { - uint res = max(1u, 1u); -} - -void fragment_main() { - max_0c0aae(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_0c0aae() { - uint res = max(1u, 1u); -} - -void compute_main() { - max_0c0aae(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/0c0aae.wgsl.expected.hlsl b/test/tint/builtins/gen/max/0c0aae.wgsl.expected.hlsl deleted file mode 100644 index 4e9b6d2bca..0000000000 --- a/test/tint/builtins/gen/max/0c0aae.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_0c0aae() { - uint res = max(1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_0c0aae(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_0c0aae(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_0c0aae(); - return; -} diff --git a/test/tint/builtins/gen/max/0c0aae.wgsl.expected.msl b/test/tint/builtins/gen/max/0c0aae.wgsl.expected.msl deleted file mode 100644 index 5f95e211f1..0000000000 --- a/test/tint/builtins/gen/max/0c0aae.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_0c0aae() { - uint res = max(1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_0c0aae(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_0c0aae(); - return; -} - -kernel void compute_main() { - max_0c0aae(); - return; -} - diff --git a/test/tint/builtins/gen/max/0c0aae.wgsl.expected.wgsl b/test/tint/builtins/gen/max/0c0aae.wgsl.expected.wgsl deleted file mode 100644 index a34b9ff497..0000000000 --- a/test/tint/builtins/gen/max/0c0aae.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_0c0aae() { - var res : u32 = max(1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_0c0aae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_0c0aae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_0c0aae(); -} diff --git a/test/tint/builtins/gen/max/25eafe.wgsl b/test/tint/builtins/gen/max/25eafe.wgsl deleted file mode 100644 index b86d13796a..0000000000 --- a/test/tint/builtins/gen/max/25eafe.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(vec<3, i32>, vec<3, i32>) -> vec<3, i32> -fn max_25eafe() { - var res: vec3 = max(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_25eafe(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_25eafe(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_25eafe(); -} diff --git a/test/tint/builtins/gen/max/25eafe.wgsl.expected.glsl b/test/tint/builtins/gen/max/25eafe.wgsl.expected.glsl deleted file mode 100644 index fa2b845bf9..0000000000 --- a/test/tint/builtins/gen/max/25eafe.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_25eafe() { - ivec3 res = max(ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - max_25eafe(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_25eafe() { - ivec3 res = max(ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -void fragment_main() { - max_25eafe(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_25eafe() { - ivec3 res = max(ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -void compute_main() { - max_25eafe(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/25eafe.wgsl.expected.hlsl b/test/tint/builtins/gen/max/25eafe.wgsl.expected.hlsl deleted file mode 100644 index 69cb46623b..0000000000 --- a/test/tint/builtins/gen/max/25eafe.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_25eafe() { - int3 res = max(int3(0, 0, 0), int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_25eafe(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_25eafe(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_25eafe(); - return; -} diff --git a/test/tint/builtins/gen/max/25eafe.wgsl.expected.msl b/test/tint/builtins/gen/max/25eafe.wgsl.expected.msl deleted file mode 100644 index 31bd611868..0000000000 --- a/test/tint/builtins/gen/max/25eafe.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_25eafe() { - int3 res = max(int3(), int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_25eafe(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_25eafe(); - return; -} - -kernel void compute_main() { - max_25eafe(); - return; -} - diff --git a/test/tint/builtins/gen/max/25eafe.wgsl.expected.spvasm b/test/tint/builtins/gen/max/25eafe.wgsl.expected.spvasm deleted file mode 100644 index ee1697461e..0000000000 --- a/test/tint/builtins/gen/max/25eafe.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %max_25eafe "max_25eafe" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %17 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %max_25eafe = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %17 - %13 = OpExtInst %v3int %16 SMax %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %max_25eafe - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %max_25eafe - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %max_25eafe - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/max/25eafe.wgsl.expected.wgsl b/test/tint/builtins/gen/max/25eafe.wgsl.expected.wgsl deleted file mode 100644 index 7b9f06a8c2..0000000000 --- a/test/tint/builtins/gen/max/25eafe.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_25eafe() { - var res : vec3 = max(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_25eafe(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_25eafe(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_25eafe(); -} diff --git a/test/tint/builtins/gen/max/320815.wgsl b/test/tint/builtins/gen/max/320815.wgsl deleted file mode 100644 index c931f35972..0000000000 --- a/test/tint/builtins/gen/max/320815.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(vec<2, u32>, vec<2, u32>) -> vec<2, u32> -fn max_320815() { - var res: vec2 = max(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_320815(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_320815(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_320815(); -} diff --git a/test/tint/builtins/gen/max/320815.wgsl.expected.glsl b/test/tint/builtins/gen/max/320815.wgsl.expected.glsl deleted file mode 100644 index b82aacda44..0000000000 --- a/test/tint/builtins/gen/max/320815.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_320815() { - uvec2 res = max(uvec2(0u, 0u), uvec2(0u, 0u)); -} - -vec4 vertex_main() { - max_320815(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_320815() { - uvec2 res = max(uvec2(0u, 0u), uvec2(0u, 0u)); -} - -void fragment_main() { - max_320815(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_320815() { - uvec2 res = max(uvec2(0u, 0u), uvec2(0u, 0u)); -} - -void compute_main() { - max_320815(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/320815.wgsl.expected.hlsl b/test/tint/builtins/gen/max/320815.wgsl.expected.hlsl deleted file mode 100644 index 5c38cdf1ea..0000000000 --- a/test/tint/builtins/gen/max/320815.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_320815() { - uint2 res = max(uint2(0u, 0u), uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_320815(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_320815(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_320815(); - return; -} diff --git a/test/tint/builtins/gen/max/320815.wgsl.expected.msl b/test/tint/builtins/gen/max/320815.wgsl.expected.msl deleted file mode 100644 index a135a3c845..0000000000 --- a/test/tint/builtins/gen/max/320815.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_320815() { - uint2 res = max(uint2(), uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_320815(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_320815(); - return; -} - -kernel void compute_main() { - max_320815(); - return; -} - diff --git a/test/tint/builtins/gen/max/320815.wgsl.expected.spvasm b/test/tint/builtins/gen/max/320815.wgsl.expected.spvasm deleted file mode 100644 index 649e397439..0000000000 --- a/test/tint/builtins/gen/max/320815.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %max_320815 "max_320815" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %17 = OpConstantNull %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %max_320815 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %17 - %13 = OpExtInst %v2uint %16 UMax %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %max_320815 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %max_320815 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %max_320815 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/max/320815.wgsl.expected.wgsl b/test/tint/builtins/gen/max/320815.wgsl.expected.wgsl deleted file mode 100644 index 04e54a0fa5..0000000000 --- a/test/tint/builtins/gen/max/320815.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_320815() { - var res : vec2 = max(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_320815(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_320815(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_320815(); -} diff --git a/test/tint/builtins/gen/max/44a39d.wgsl b/test/tint/builtins/gen/max/44a39d.wgsl deleted file mode 100644 index 02154637c9..0000000000 --- a/test/tint/builtins/gen/max/44a39d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(f32, f32) -> f32 -fn max_44a39d() { - var res: f32 = max(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_44a39d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_44a39d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_44a39d(); -} diff --git a/test/tint/builtins/gen/max/44a39d.wgsl.expected.glsl b/test/tint/builtins/gen/max/44a39d.wgsl.expected.glsl deleted file mode 100644 index 5df5fddd0b..0000000000 --- a/test/tint/builtins/gen/max/44a39d.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_44a39d() { - float res = max(1.0f, 1.0f); -} - -vec4 vertex_main() { - max_44a39d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_44a39d() { - float res = max(1.0f, 1.0f); -} - -void fragment_main() { - max_44a39d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_44a39d() { - float res = max(1.0f, 1.0f); -} - -void compute_main() { - max_44a39d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/44a39d.wgsl.expected.hlsl b/test/tint/builtins/gen/max/44a39d.wgsl.expected.hlsl deleted file mode 100644 index 4dd34671a4..0000000000 --- a/test/tint/builtins/gen/max/44a39d.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_44a39d() { - float res = max(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_44a39d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_44a39d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_44a39d(); - return; -} diff --git a/test/tint/builtins/gen/max/44a39d.wgsl.expected.msl b/test/tint/builtins/gen/max/44a39d.wgsl.expected.msl deleted file mode 100644 index 11575ec42d..0000000000 --- a/test/tint/builtins/gen/max/44a39d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_44a39d() { - float res = fmax(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_44a39d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_44a39d(); - return; -} - -kernel void compute_main() { - max_44a39d(); - return; -} - diff --git a/test/tint/builtins/gen/max/44a39d.wgsl.expected.wgsl b/test/tint/builtins/gen/max/44a39d.wgsl.expected.wgsl deleted file mode 100644 index 1913b8fd03..0000000000 --- a/test/tint/builtins/gen/max/44a39d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_44a39d() { - var res : f32 = max(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_44a39d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_44a39d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_44a39d(); -} diff --git a/test/tint/builtins/gen/max/453e04.wgsl b/test/tint/builtins/gen/max/453e04.wgsl deleted file mode 100644 index 9d55ca87e2..0000000000 --- a/test/tint/builtins/gen/max/453e04.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(vec<4, u32>, vec<4, u32>) -> vec<4, u32> -fn max_453e04() { - var res: vec4 = max(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_453e04(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_453e04(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_453e04(); -} diff --git a/test/tint/builtins/gen/max/453e04.wgsl.expected.glsl b/test/tint/builtins/gen/max/453e04.wgsl.expected.glsl deleted file mode 100644 index 2f227bd866..0000000000 --- a/test/tint/builtins/gen/max/453e04.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_453e04() { - uvec4 res = max(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - max_453e04(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_453e04() { - uvec4 res = max(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - max_453e04(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_453e04() { - uvec4 res = max(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - max_453e04(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/453e04.wgsl.expected.hlsl b/test/tint/builtins/gen/max/453e04.wgsl.expected.hlsl deleted file mode 100644 index 6e0f3544c0..0000000000 --- a/test/tint/builtins/gen/max/453e04.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_453e04() { - uint4 res = max(uint4(0u, 0u, 0u, 0u), uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_453e04(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_453e04(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_453e04(); - return; -} diff --git a/test/tint/builtins/gen/max/453e04.wgsl.expected.msl b/test/tint/builtins/gen/max/453e04.wgsl.expected.msl deleted file mode 100644 index 86de3a08fe..0000000000 --- a/test/tint/builtins/gen/max/453e04.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_453e04() { - uint4 res = max(uint4(), uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_453e04(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_453e04(); - return; -} - -kernel void compute_main() { - max_453e04(); - return; -} - diff --git a/test/tint/builtins/gen/max/453e04.wgsl.expected.spvasm b/test/tint/builtins/gen/max/453e04.wgsl.expected.spvasm deleted file mode 100644 index 25e7047bb0..0000000000 --- a/test/tint/builtins/gen/max/453e04.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %max_453e04 "max_453e04" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %17 = OpConstantNull %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %max_453e04 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %17 - %13 = OpExtInst %v4uint %16 UMax %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %max_453e04 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %max_453e04 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %max_453e04 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/max/453e04.wgsl.expected.wgsl b/test/tint/builtins/gen/max/453e04.wgsl.expected.wgsl deleted file mode 100644 index 39e7e48679..0000000000 --- a/test/tint/builtins/gen/max/453e04.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_453e04() { - var res : vec4 = max(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_453e04(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_453e04(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_453e04(); -} diff --git a/test/tint/builtins/gen/max/462050.wgsl b/test/tint/builtins/gen/max/462050.wgsl deleted file mode 100644 index bbff876d5f..0000000000 --- a/test/tint/builtins/gen/max/462050.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn max_462050() { - var res: vec2 = max(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_462050(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_462050(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_462050(); -} diff --git a/test/tint/builtins/gen/max/462050.wgsl.expected.glsl b/test/tint/builtins/gen/max/462050.wgsl.expected.glsl deleted file mode 100644 index 3c5eb4b7f0..0000000000 --- a/test/tint/builtins/gen/max/462050.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_462050() { - vec2 res = max(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - max_462050(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_462050() { - vec2 res = max(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - max_462050(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_462050() { - vec2 res = max(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - max_462050(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/462050.wgsl.expected.hlsl b/test/tint/builtins/gen/max/462050.wgsl.expected.hlsl deleted file mode 100644 index 4aa4f131ce..0000000000 --- a/test/tint/builtins/gen/max/462050.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_462050() { - float2 res = max(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_462050(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_462050(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_462050(); - return; -} diff --git a/test/tint/builtins/gen/max/462050.wgsl.expected.msl b/test/tint/builtins/gen/max/462050.wgsl.expected.msl deleted file mode 100644 index 825b974e5b..0000000000 --- a/test/tint/builtins/gen/max/462050.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_462050() { - float2 res = fmax(float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_462050(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_462050(); - return; -} - -kernel void compute_main() { - max_462050(); - return; -} - diff --git a/test/tint/builtins/gen/max/462050.wgsl.expected.spvasm b/test/tint/builtins/gen/max/462050.wgsl.expected.spvasm deleted file mode 100644 index f513309c8e..0000000000 --- a/test/tint/builtins/gen/max/462050.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %max_462050 "max_462050" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %max_462050 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 NMax %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %max_462050 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %max_462050 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %max_462050 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/max/462050.wgsl.expected.wgsl b/test/tint/builtins/gen/max/462050.wgsl.expected.wgsl deleted file mode 100644 index eec4107b03..0000000000 --- a/test/tint/builtins/gen/max/462050.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_462050() { - var res : vec2 = max(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_462050(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_462050(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_462050(); -} diff --git a/test/tint/builtins/gen/max/4883ac.wgsl b/test/tint/builtins/gen/max/4883ac.wgsl deleted file mode 100644 index 5656824b33..0000000000 --- a/test/tint/builtins/gen/max/4883ac.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn max_4883ac() { - var res: vec3 = max(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_4883ac(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_4883ac(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_4883ac(); -} diff --git a/test/tint/builtins/gen/max/4883ac.wgsl.expected.glsl b/test/tint/builtins/gen/max/4883ac.wgsl.expected.glsl deleted file mode 100644 index 74ba78f24d..0000000000 --- a/test/tint/builtins/gen/max/4883ac.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_4883ac() { - vec3 res = max(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - max_4883ac(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_4883ac() { - vec3 res = max(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - max_4883ac(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_4883ac() { - vec3 res = max(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - max_4883ac(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/4883ac.wgsl.expected.hlsl b/test/tint/builtins/gen/max/4883ac.wgsl.expected.hlsl deleted file mode 100644 index 1d7ec78b44..0000000000 --- a/test/tint/builtins/gen/max/4883ac.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_4883ac() { - float3 res = max(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_4883ac(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_4883ac(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_4883ac(); - return; -} diff --git a/test/tint/builtins/gen/max/4883ac.wgsl.expected.msl b/test/tint/builtins/gen/max/4883ac.wgsl.expected.msl deleted file mode 100644 index 199fa39682..0000000000 --- a/test/tint/builtins/gen/max/4883ac.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_4883ac() { - float3 res = fmax(float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_4883ac(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_4883ac(); - return; -} - -kernel void compute_main() { - max_4883ac(); - return; -} - diff --git a/test/tint/builtins/gen/max/4883ac.wgsl.expected.spvasm b/test/tint/builtins/gen/max/4883ac.wgsl.expected.spvasm deleted file mode 100644 index f3a038b1db..0000000000 --- a/test/tint/builtins/gen/max/4883ac.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %max_4883ac "max_4883ac" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %max_4883ac = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 NMax %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %max_4883ac - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %max_4883ac - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %max_4883ac - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/max/4883ac.wgsl.expected.wgsl b/test/tint/builtins/gen/max/4883ac.wgsl.expected.wgsl deleted file mode 100644 index cc37098330..0000000000 --- a/test/tint/builtins/gen/max/4883ac.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_4883ac() { - var res : vec3 = max(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_4883ac(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_4883ac(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_4883ac(); -} diff --git a/test/tint/builtins/gen/max/85e6bc.wgsl b/test/tint/builtins/gen/max/85e6bc.wgsl deleted file mode 100644 index 478a4059ce..0000000000 --- a/test/tint/builtins/gen/max/85e6bc.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(vec<4, i32>, vec<4, i32>) -> vec<4, i32> -fn max_85e6bc() { - var res: vec4 = max(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_85e6bc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_85e6bc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_85e6bc(); -} diff --git a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.glsl b/test/tint/builtins/gen/max/85e6bc.wgsl.expected.glsl deleted file mode 100644 index 5bd101f034..0000000000 --- a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_85e6bc() { - ivec4 res = max(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - max_85e6bc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_85e6bc() { - ivec4 res = max(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - max_85e6bc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_85e6bc() { - ivec4 res = max(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - max_85e6bc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.hlsl b/test/tint/builtins/gen/max/85e6bc.wgsl.expected.hlsl deleted file mode 100644 index e2189eb4d8..0000000000 --- a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_85e6bc() { - int4 res = max(int4(0, 0, 0, 0), int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_85e6bc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_85e6bc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_85e6bc(); - return; -} diff --git a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.msl b/test/tint/builtins/gen/max/85e6bc.wgsl.expected.msl deleted file mode 100644 index 48d92f69a3..0000000000 --- a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_85e6bc() { - int4 res = max(int4(), int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_85e6bc(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_85e6bc(); - return; -} - -kernel void compute_main() { - max_85e6bc(); - return; -} - diff --git a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.spvasm b/test/tint/builtins/gen/max/85e6bc.wgsl.expected.spvasm deleted file mode 100644 index 4274291dce..0000000000 --- a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %max_85e6bc "max_85e6bc" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %17 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %max_85e6bc = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %17 - %13 = OpExtInst %v4int %16 SMax %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %max_85e6bc - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %max_85e6bc - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %max_85e6bc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.wgsl b/test/tint/builtins/gen/max/85e6bc.wgsl.expected.wgsl deleted file mode 100644 index 6f6b39f35a..0000000000 --- a/test/tint/builtins/gen/max/85e6bc.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_85e6bc() { - var res : vec4 = max(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_85e6bc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_85e6bc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_85e6bc(); -} diff --git a/test/tint/builtins/gen/max/a93419.wgsl b/test/tint/builtins/gen/max/a93419.wgsl deleted file mode 100644 index 1779143aa3..0000000000 --- a/test/tint/builtins/gen/max/a93419.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn max_a93419() { - var res: vec4 = max(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_a93419(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_a93419(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_a93419(); -} diff --git a/test/tint/builtins/gen/max/a93419.wgsl.expected.glsl b/test/tint/builtins/gen/max/a93419.wgsl.expected.glsl deleted file mode 100644 index 4e2228061a..0000000000 --- a/test/tint/builtins/gen/max/a93419.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_a93419() { - vec4 res = max(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - max_a93419(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_a93419() { - vec4 res = max(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - max_a93419(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_a93419() { - vec4 res = max(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - max_a93419(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/a93419.wgsl.expected.hlsl b/test/tint/builtins/gen/max/a93419.wgsl.expected.hlsl deleted file mode 100644 index 8d9526520d..0000000000 --- a/test/tint/builtins/gen/max/a93419.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_a93419() { - float4 res = max(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_a93419(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_a93419(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_a93419(); - return; -} diff --git a/test/tint/builtins/gen/max/a93419.wgsl.expected.msl b/test/tint/builtins/gen/max/a93419.wgsl.expected.msl deleted file mode 100644 index c5d8364e92..0000000000 --- a/test/tint/builtins/gen/max/a93419.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_a93419() { - float4 res = fmax(float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_a93419(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_a93419(); - return; -} - -kernel void compute_main() { - max_a93419(); - return; -} - diff --git a/test/tint/builtins/gen/max/a93419.wgsl.expected.spvasm b/test/tint/builtins/gen/max/a93419.wgsl.expected.spvasm deleted file mode 100644 index 7a4efd7aa9..0000000000 --- a/test/tint/builtins/gen/max/a93419.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %max_a93419 "max_a93419" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %max_a93419 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 NMax %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %max_a93419 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %max_a93419 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %max_a93419 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/max/a93419.wgsl.expected.wgsl b/test/tint/builtins/gen/max/a93419.wgsl.expected.wgsl deleted file mode 100644 index 8c1c938493..0000000000 --- a/test/tint/builtins/gen/max/a93419.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_a93419() { - var res : vec4 = max(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_a93419(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_a93419(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_a93419(); -} diff --git a/test/tint/builtins/gen/max/b1b73a.wgsl b/test/tint/builtins/gen/max/b1b73a.wgsl deleted file mode 100644 index 07dd4a2e83..0000000000 --- a/test/tint/builtins/gen/max/b1b73a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(vec<3, u32>, vec<3, u32>) -> vec<3, u32> -fn max_b1b73a() { - var res: vec3 = max(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_b1b73a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_b1b73a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_b1b73a(); -} diff --git a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.glsl b/test/tint/builtins/gen/max/b1b73a.wgsl.expected.glsl deleted file mode 100644 index c9011af8c3..0000000000 --- a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_b1b73a() { - uvec3 res = max(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - max_b1b73a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_b1b73a() { - uvec3 res = max(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - max_b1b73a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_b1b73a() { - uvec3 res = max(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -void compute_main() { - max_b1b73a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.hlsl b/test/tint/builtins/gen/max/b1b73a.wgsl.expected.hlsl deleted file mode 100644 index 5cc620a7fd..0000000000 --- a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_b1b73a() { - uint3 res = max(uint3(0u, 0u, 0u), uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_b1b73a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_b1b73a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_b1b73a(); - return; -} diff --git a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.msl b/test/tint/builtins/gen/max/b1b73a.wgsl.expected.msl deleted file mode 100644 index 410e0f5b1d..0000000000 --- a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_b1b73a() { - uint3 res = max(uint3(), uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_b1b73a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_b1b73a(); - return; -} - -kernel void compute_main() { - max_b1b73a(); - return; -} - diff --git a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.spvasm b/test/tint/builtins/gen/max/b1b73a.wgsl.expected.spvasm deleted file mode 100644 index 1daf5703a9..0000000000 --- a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %max_b1b73a "max_b1b73a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %17 = OpConstantNull %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %max_b1b73a = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %17 - %13 = OpExtInst %v3uint %16 UMax %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %max_b1b73a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %max_b1b73a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %max_b1b73a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.wgsl b/test/tint/builtins/gen/max/b1b73a.wgsl.expected.wgsl deleted file mode 100644 index ffe0dc5d69..0000000000 --- a/test/tint/builtins/gen/max/b1b73a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_b1b73a() { - var res : vec3 = max(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_b1b73a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_b1b73a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_b1b73a(); -} diff --git a/test/tint/builtins/gen/max/ce7c30.wgsl b/test/tint/builtins/gen/max/ce7c30.wgsl deleted file mode 100644 index c119aaec29..0000000000 --- a/test/tint/builtins/gen/max/ce7c30.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(i32, i32) -> i32 -fn max_ce7c30() { - var res: i32 = max(1, 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_ce7c30(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_ce7c30(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_ce7c30(); -} diff --git a/test/tint/builtins/gen/max/ce7c30.wgsl.expected.glsl b/test/tint/builtins/gen/max/ce7c30.wgsl.expected.glsl deleted file mode 100644 index 965fe698e2..0000000000 --- a/test/tint/builtins/gen/max/ce7c30.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_ce7c30() { - int res = max(1, 1); -} - -vec4 vertex_main() { - max_ce7c30(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_ce7c30() { - int res = max(1, 1); -} - -void fragment_main() { - max_ce7c30(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_ce7c30() { - int res = max(1, 1); -} - -void compute_main() { - max_ce7c30(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/ce7c30.wgsl.expected.hlsl b/test/tint/builtins/gen/max/ce7c30.wgsl.expected.hlsl deleted file mode 100644 index f348871aac..0000000000 --- a/test/tint/builtins/gen/max/ce7c30.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_ce7c30() { - int res = max(1, 1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_ce7c30(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_ce7c30(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_ce7c30(); - return; -} diff --git a/test/tint/builtins/gen/max/ce7c30.wgsl.expected.msl b/test/tint/builtins/gen/max/ce7c30.wgsl.expected.msl deleted file mode 100644 index 50b1952118..0000000000 --- a/test/tint/builtins/gen/max/ce7c30.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_ce7c30() { - int res = max(1, 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_ce7c30(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_ce7c30(); - return; -} - -kernel void compute_main() { - max_ce7c30(); - return; -} - diff --git a/test/tint/builtins/gen/max/ce7c30.wgsl.expected.wgsl b/test/tint/builtins/gen/max/ce7c30.wgsl.expected.wgsl deleted file mode 100644 index a9c3618a5a..0000000000 --- a/test/tint/builtins/gen/max/ce7c30.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_ce7c30() { - var res : i32 = max(1, 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_ce7c30(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_ce7c30(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_ce7c30(); -} diff --git a/test/tint/builtins/gen/max/e8192f.wgsl b/test/tint/builtins/gen/max/e8192f.wgsl deleted file mode 100644 index aa0ebb30c6..0000000000 --- a/test/tint/builtins/gen/max/e8192f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn max(vec<2, i32>, vec<2, i32>) -> vec<2, i32> -fn max_e8192f() { - var res: vec2 = max(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_e8192f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_e8192f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_e8192f(); -} diff --git a/test/tint/builtins/gen/max/e8192f.wgsl.expected.glsl b/test/tint/builtins/gen/max/e8192f.wgsl.expected.glsl deleted file mode 100644 index ff1a1d65ae..0000000000 --- a/test/tint/builtins/gen/max/e8192f.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void max_e8192f() { - ivec2 res = max(ivec2(0, 0), ivec2(0, 0)); -} - -vec4 vertex_main() { - max_e8192f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void max_e8192f() { - ivec2 res = max(ivec2(0, 0), ivec2(0, 0)); -} - -void fragment_main() { - max_e8192f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void max_e8192f() { - ivec2 res = max(ivec2(0, 0), ivec2(0, 0)); -} - -void compute_main() { - max_e8192f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/max/e8192f.wgsl.expected.hlsl b/test/tint/builtins/gen/max/e8192f.wgsl.expected.hlsl deleted file mode 100644 index 9dd5a2215e..0000000000 --- a/test/tint/builtins/gen/max/e8192f.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void max_e8192f() { - int2 res = max(int2(0, 0), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - max_e8192f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - max_e8192f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - max_e8192f(); - return; -} diff --git a/test/tint/builtins/gen/max/e8192f.wgsl.expected.msl b/test/tint/builtins/gen/max/e8192f.wgsl.expected.msl deleted file mode 100644 index 7c7f9ac091..0000000000 --- a/test/tint/builtins/gen/max/e8192f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void max_e8192f() { - int2 res = max(int2(), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - max_e8192f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - max_e8192f(); - return; -} - -kernel void compute_main() { - max_e8192f(); - return; -} - diff --git a/test/tint/builtins/gen/max/e8192f.wgsl.expected.spvasm b/test/tint/builtins/gen/max/e8192f.wgsl.expected.spvasm deleted file mode 100644 index 1c310adeb1..0000000000 --- a/test/tint/builtins/gen/max/e8192f.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %max_e8192f "max_e8192f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %17 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %max_e8192f = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %17 - %13 = OpExtInst %v2int %16 SMax %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %max_e8192f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %max_e8192f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %max_e8192f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/max/e8192f.wgsl.expected.wgsl b/test/tint/builtins/gen/max/e8192f.wgsl.expected.wgsl deleted file mode 100644 index 08d02f6b9f..0000000000 --- a/test/tint/builtins/gen/max/e8192f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn max_e8192f() { - var res : vec2 = max(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - max_e8192f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - max_e8192f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - max_e8192f(); -} diff --git a/test/tint/builtins/gen/min/03c7e3.wgsl b/test/tint/builtins/gen/min/03c7e3.wgsl deleted file mode 100644 index e237394855..0000000000 --- a/test/tint/builtins/gen/min/03c7e3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(vec<2, i32>, vec<2, i32>) -> vec<2, i32> -fn min_03c7e3() { - var res: vec2 = min(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_03c7e3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_03c7e3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_03c7e3(); -} diff --git a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.glsl b/test/tint/builtins/gen/min/03c7e3.wgsl.expected.glsl deleted file mode 100644 index 254b1e1881..0000000000 --- a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_03c7e3() { - ivec2 res = min(ivec2(0, 0), ivec2(0, 0)); -} - -vec4 vertex_main() { - min_03c7e3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_03c7e3() { - ivec2 res = min(ivec2(0, 0), ivec2(0, 0)); -} - -void fragment_main() { - min_03c7e3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_03c7e3() { - ivec2 res = min(ivec2(0, 0), ivec2(0, 0)); -} - -void compute_main() { - min_03c7e3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.hlsl b/test/tint/builtins/gen/min/03c7e3.wgsl.expected.hlsl deleted file mode 100644 index 94f9c4be10..0000000000 --- a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_03c7e3() { - int2 res = min(int2(0, 0), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_03c7e3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_03c7e3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_03c7e3(); - return; -} diff --git a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.msl b/test/tint/builtins/gen/min/03c7e3.wgsl.expected.msl deleted file mode 100644 index f01b97e7fb..0000000000 --- a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_03c7e3() { - int2 res = min(int2(), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_03c7e3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_03c7e3(); - return; -} - -kernel void compute_main() { - min_03c7e3(); - return; -} - diff --git a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.spvasm b/test/tint/builtins/gen/min/03c7e3.wgsl.expected.spvasm deleted file mode 100644 index 8aad2ecc47..0000000000 --- a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %min_03c7e3 "min_03c7e3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %17 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %min_03c7e3 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %17 - %13 = OpExtInst %v2int %16 SMin %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %min_03c7e3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %min_03c7e3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %min_03c7e3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.wgsl b/test/tint/builtins/gen/min/03c7e3.wgsl.expected.wgsl deleted file mode 100644 index 8c0cc9355a..0000000000 --- a/test/tint/builtins/gen/min/03c7e3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_03c7e3() { - var res : vec2 = min(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_03c7e3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_03c7e3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_03c7e3(); -} diff --git a/test/tint/builtins/gen/min/0dc614.wgsl b/test/tint/builtins/gen/min/0dc614.wgsl deleted file mode 100644 index 8c896eed08..0000000000 --- a/test/tint/builtins/gen/min/0dc614.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(vec<4, u32>, vec<4, u32>) -> vec<4, u32> -fn min_0dc614() { - var res: vec4 = min(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_0dc614(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_0dc614(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_0dc614(); -} diff --git a/test/tint/builtins/gen/min/0dc614.wgsl.expected.glsl b/test/tint/builtins/gen/min/0dc614.wgsl.expected.glsl deleted file mode 100644 index 879c063269..0000000000 --- a/test/tint/builtins/gen/min/0dc614.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_0dc614() { - uvec4 res = min(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - min_0dc614(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_0dc614() { - uvec4 res = min(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - min_0dc614(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_0dc614() { - uvec4 res = min(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - min_0dc614(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/0dc614.wgsl.expected.hlsl b/test/tint/builtins/gen/min/0dc614.wgsl.expected.hlsl deleted file mode 100644 index 3515079a79..0000000000 --- a/test/tint/builtins/gen/min/0dc614.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_0dc614() { - uint4 res = min(uint4(0u, 0u, 0u, 0u), uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_0dc614(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_0dc614(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_0dc614(); - return; -} diff --git a/test/tint/builtins/gen/min/0dc614.wgsl.expected.msl b/test/tint/builtins/gen/min/0dc614.wgsl.expected.msl deleted file mode 100644 index f5f7920d3c..0000000000 --- a/test/tint/builtins/gen/min/0dc614.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_0dc614() { - uint4 res = min(uint4(), uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_0dc614(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_0dc614(); - return; -} - -kernel void compute_main() { - min_0dc614(); - return; -} - diff --git a/test/tint/builtins/gen/min/0dc614.wgsl.expected.spvasm b/test/tint/builtins/gen/min/0dc614.wgsl.expected.spvasm deleted file mode 100644 index 772b7d0857..0000000000 --- a/test/tint/builtins/gen/min/0dc614.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %min_0dc614 "min_0dc614" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %17 = OpConstantNull %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %min_0dc614 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %17 - %13 = OpExtInst %v4uint %16 UMin %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %min_0dc614 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %min_0dc614 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %min_0dc614 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/min/0dc614.wgsl.expected.wgsl b/test/tint/builtins/gen/min/0dc614.wgsl.expected.wgsl deleted file mode 100644 index 983327093a..0000000000 --- a/test/tint/builtins/gen/min/0dc614.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_0dc614() { - var res : vec4 = min(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_0dc614(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_0dc614(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_0dc614(); -} diff --git a/test/tint/builtins/gen/min/3941e1.wgsl b/test/tint/builtins/gen/min/3941e1.wgsl deleted file mode 100644 index 350d70f347..0000000000 --- a/test/tint/builtins/gen/min/3941e1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(vec<4, i32>, vec<4, i32>) -> vec<4, i32> -fn min_3941e1() { - var res: vec4 = min(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_3941e1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_3941e1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_3941e1(); -} diff --git a/test/tint/builtins/gen/min/3941e1.wgsl.expected.glsl b/test/tint/builtins/gen/min/3941e1.wgsl.expected.glsl deleted file mode 100644 index 1ef7294ef0..0000000000 --- a/test/tint/builtins/gen/min/3941e1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_3941e1() { - ivec4 res = min(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - min_3941e1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_3941e1() { - ivec4 res = min(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - min_3941e1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_3941e1() { - ivec4 res = min(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - min_3941e1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/3941e1.wgsl.expected.hlsl b/test/tint/builtins/gen/min/3941e1.wgsl.expected.hlsl deleted file mode 100644 index a629597084..0000000000 --- a/test/tint/builtins/gen/min/3941e1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_3941e1() { - int4 res = min(int4(0, 0, 0, 0), int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_3941e1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_3941e1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_3941e1(); - return; -} diff --git a/test/tint/builtins/gen/min/3941e1.wgsl.expected.msl b/test/tint/builtins/gen/min/3941e1.wgsl.expected.msl deleted file mode 100644 index ec36ed869a..0000000000 --- a/test/tint/builtins/gen/min/3941e1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_3941e1() { - int4 res = min(int4(), int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_3941e1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_3941e1(); - return; -} - -kernel void compute_main() { - min_3941e1(); - return; -} - diff --git a/test/tint/builtins/gen/min/3941e1.wgsl.expected.spvasm b/test/tint/builtins/gen/min/3941e1.wgsl.expected.spvasm deleted file mode 100644 index 03e4ed8df6..0000000000 --- a/test/tint/builtins/gen/min/3941e1.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %min_3941e1 "min_3941e1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %17 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %min_3941e1 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %17 - %13 = OpExtInst %v4int %16 SMin %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %min_3941e1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %min_3941e1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %min_3941e1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/min/3941e1.wgsl.expected.wgsl b/test/tint/builtins/gen/min/3941e1.wgsl.expected.wgsl deleted file mode 100644 index 19dd5ee653..0000000000 --- a/test/tint/builtins/gen/min/3941e1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_3941e1() { - var res : vec4 = min(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_3941e1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_3941e1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_3941e1(); -} diff --git a/test/tint/builtins/gen/min/46c5d3.wgsl b/test/tint/builtins/gen/min/46c5d3.wgsl deleted file mode 100644 index 9d6e7018ae..0000000000 --- a/test/tint/builtins/gen/min/46c5d3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(u32, u32) -> u32 -fn min_46c5d3() { - var res: u32 = min(1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_46c5d3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_46c5d3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_46c5d3(); -} diff --git a/test/tint/builtins/gen/min/46c5d3.wgsl.expected.glsl b/test/tint/builtins/gen/min/46c5d3.wgsl.expected.glsl deleted file mode 100644 index 9b54f7f693..0000000000 --- a/test/tint/builtins/gen/min/46c5d3.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_46c5d3() { - uint res = min(1u, 1u); -} - -vec4 vertex_main() { - min_46c5d3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_46c5d3() { - uint res = min(1u, 1u); -} - -void fragment_main() { - min_46c5d3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_46c5d3() { - uint res = min(1u, 1u); -} - -void compute_main() { - min_46c5d3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/46c5d3.wgsl.expected.hlsl b/test/tint/builtins/gen/min/46c5d3.wgsl.expected.hlsl deleted file mode 100644 index 53ca8c0200..0000000000 --- a/test/tint/builtins/gen/min/46c5d3.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_46c5d3() { - uint res = min(1u, 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_46c5d3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_46c5d3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_46c5d3(); - return; -} diff --git a/test/tint/builtins/gen/min/46c5d3.wgsl.expected.msl b/test/tint/builtins/gen/min/46c5d3.wgsl.expected.msl deleted file mode 100644 index 3c8a19e0a8..0000000000 --- a/test/tint/builtins/gen/min/46c5d3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_46c5d3() { - uint res = min(1u, 1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_46c5d3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_46c5d3(); - return; -} - -kernel void compute_main() { - min_46c5d3(); - return; -} - diff --git a/test/tint/builtins/gen/min/46c5d3.wgsl.expected.wgsl b/test/tint/builtins/gen/min/46c5d3.wgsl.expected.wgsl deleted file mode 100644 index 2beab9a8bf..0000000000 --- a/test/tint/builtins/gen/min/46c5d3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_46c5d3() { - var res : u32 = min(1u, 1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_46c5d3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_46c5d3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_46c5d3(); -} diff --git a/test/tint/builtins/gen/min/82b28f.wgsl b/test/tint/builtins/gen/min/82b28f.wgsl deleted file mode 100644 index b6e12bc186..0000000000 --- a/test/tint/builtins/gen/min/82b28f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(vec<2, u32>, vec<2, u32>) -> vec<2, u32> -fn min_82b28f() { - var res: vec2 = min(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_82b28f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_82b28f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_82b28f(); -} diff --git a/test/tint/builtins/gen/min/82b28f.wgsl.expected.glsl b/test/tint/builtins/gen/min/82b28f.wgsl.expected.glsl deleted file mode 100644 index 50d2caf96b..0000000000 --- a/test/tint/builtins/gen/min/82b28f.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_82b28f() { - uvec2 res = min(uvec2(0u, 0u), uvec2(0u, 0u)); -} - -vec4 vertex_main() { - min_82b28f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_82b28f() { - uvec2 res = min(uvec2(0u, 0u), uvec2(0u, 0u)); -} - -void fragment_main() { - min_82b28f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_82b28f() { - uvec2 res = min(uvec2(0u, 0u), uvec2(0u, 0u)); -} - -void compute_main() { - min_82b28f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/82b28f.wgsl.expected.hlsl b/test/tint/builtins/gen/min/82b28f.wgsl.expected.hlsl deleted file mode 100644 index 70d28cbe54..0000000000 --- a/test/tint/builtins/gen/min/82b28f.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_82b28f() { - uint2 res = min(uint2(0u, 0u), uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_82b28f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_82b28f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_82b28f(); - return; -} diff --git a/test/tint/builtins/gen/min/82b28f.wgsl.expected.msl b/test/tint/builtins/gen/min/82b28f.wgsl.expected.msl deleted file mode 100644 index 65bbe6b140..0000000000 --- a/test/tint/builtins/gen/min/82b28f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_82b28f() { - uint2 res = min(uint2(), uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_82b28f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_82b28f(); - return; -} - -kernel void compute_main() { - min_82b28f(); - return; -} - diff --git a/test/tint/builtins/gen/min/82b28f.wgsl.expected.spvasm b/test/tint/builtins/gen/min/82b28f.wgsl.expected.spvasm deleted file mode 100644 index dfee21a1c7..0000000000 --- a/test/tint/builtins/gen/min/82b28f.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %min_82b28f "min_82b28f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %17 = OpConstantNull %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %min_82b28f = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %17 - %13 = OpExtInst %v2uint %16 UMin %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %min_82b28f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %min_82b28f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %min_82b28f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/min/82b28f.wgsl.expected.wgsl b/test/tint/builtins/gen/min/82b28f.wgsl.expected.wgsl deleted file mode 100644 index a942532bc2..0000000000 --- a/test/tint/builtins/gen/min/82b28f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_82b28f() { - var res : vec2 = min(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_82b28f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_82b28f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_82b28f(); -} diff --git a/test/tint/builtins/gen/min/93cfc4.wgsl b/test/tint/builtins/gen/min/93cfc4.wgsl deleted file mode 100644 index bb98a54774..0000000000 --- a/test/tint/builtins/gen/min/93cfc4.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn min_93cfc4() { - var res: vec3 = min(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_93cfc4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_93cfc4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_93cfc4(); -} diff --git a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.glsl b/test/tint/builtins/gen/min/93cfc4.wgsl.expected.glsl deleted file mode 100644 index 53154f91b2..0000000000 --- a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_93cfc4() { - vec3 res = min(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - min_93cfc4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_93cfc4() { - vec3 res = min(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - min_93cfc4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_93cfc4() { - vec3 res = min(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - min_93cfc4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.hlsl b/test/tint/builtins/gen/min/93cfc4.wgsl.expected.hlsl deleted file mode 100644 index b6200c154e..0000000000 --- a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_93cfc4() { - float3 res = min(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_93cfc4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_93cfc4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_93cfc4(); - return; -} diff --git a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.msl b/test/tint/builtins/gen/min/93cfc4.wgsl.expected.msl deleted file mode 100644 index bf29c67104..0000000000 --- a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_93cfc4() { - float3 res = fmin(float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_93cfc4(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_93cfc4(); - return; -} - -kernel void compute_main() { - min_93cfc4(); - return; -} - diff --git a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.spvasm b/test/tint/builtins/gen/min/93cfc4.wgsl.expected.spvasm deleted file mode 100644 index 4ec86a3742..0000000000 --- a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %min_93cfc4 "min_93cfc4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %min_93cfc4 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 NMin %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %min_93cfc4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %min_93cfc4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %min_93cfc4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.wgsl b/test/tint/builtins/gen/min/93cfc4.wgsl.expected.wgsl deleted file mode 100644 index c66aae09fc..0000000000 --- a/test/tint/builtins/gen/min/93cfc4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_93cfc4() { - var res : vec3 = min(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_93cfc4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_93cfc4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_93cfc4(); -} diff --git a/test/tint/builtins/gen/min/a45171.wgsl b/test/tint/builtins/gen/min/a45171.wgsl deleted file mode 100644 index 4504a1a3c2..0000000000 --- a/test/tint/builtins/gen/min/a45171.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(vec<3, i32>, vec<3, i32>) -> vec<3, i32> -fn min_a45171() { - var res: vec3 = min(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_a45171(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_a45171(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_a45171(); -} diff --git a/test/tint/builtins/gen/min/a45171.wgsl.expected.glsl b/test/tint/builtins/gen/min/a45171.wgsl.expected.glsl deleted file mode 100644 index e5141b569e..0000000000 --- a/test/tint/builtins/gen/min/a45171.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_a45171() { - ivec3 res = min(ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - min_a45171(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_a45171() { - ivec3 res = min(ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -void fragment_main() { - min_a45171(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_a45171() { - ivec3 res = min(ivec3(0, 0, 0), ivec3(0, 0, 0)); -} - -void compute_main() { - min_a45171(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/a45171.wgsl.expected.hlsl b/test/tint/builtins/gen/min/a45171.wgsl.expected.hlsl deleted file mode 100644 index 7e5e1592c3..0000000000 --- a/test/tint/builtins/gen/min/a45171.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_a45171() { - int3 res = min(int3(0, 0, 0), int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_a45171(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_a45171(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_a45171(); - return; -} diff --git a/test/tint/builtins/gen/min/a45171.wgsl.expected.msl b/test/tint/builtins/gen/min/a45171.wgsl.expected.msl deleted file mode 100644 index 1a4e902370..0000000000 --- a/test/tint/builtins/gen/min/a45171.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_a45171() { - int3 res = min(int3(), int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_a45171(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_a45171(); - return; -} - -kernel void compute_main() { - min_a45171(); - return; -} - diff --git a/test/tint/builtins/gen/min/a45171.wgsl.expected.spvasm b/test/tint/builtins/gen/min/a45171.wgsl.expected.spvasm deleted file mode 100644 index 267b83e50c..0000000000 --- a/test/tint/builtins/gen/min/a45171.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %min_a45171 "min_a45171" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %17 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %min_a45171 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %17 - %13 = OpExtInst %v3int %16 SMin %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %min_a45171 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %min_a45171 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %min_a45171 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/min/a45171.wgsl.expected.wgsl b/test/tint/builtins/gen/min/a45171.wgsl.expected.wgsl deleted file mode 100644 index ade6f575c5..0000000000 --- a/test/tint/builtins/gen/min/a45171.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_a45171() { - var res : vec3 = min(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_a45171(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_a45171(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_a45171(); -} diff --git a/test/tint/builtins/gen/min/aa28ad.wgsl b/test/tint/builtins/gen/min/aa28ad.wgsl deleted file mode 100644 index 741e3cb72d..0000000000 --- a/test/tint/builtins/gen/min/aa28ad.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn min_aa28ad() { - var res: vec2 = min(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_aa28ad(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_aa28ad(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_aa28ad(); -} diff --git a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.glsl b/test/tint/builtins/gen/min/aa28ad.wgsl.expected.glsl deleted file mode 100644 index d767779a2a..0000000000 --- a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_aa28ad() { - vec2 res = min(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - min_aa28ad(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_aa28ad() { - vec2 res = min(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - min_aa28ad(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_aa28ad() { - vec2 res = min(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - min_aa28ad(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.hlsl b/test/tint/builtins/gen/min/aa28ad.wgsl.expected.hlsl deleted file mode 100644 index cb437e2f20..0000000000 --- a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_aa28ad() { - float2 res = min(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_aa28ad(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_aa28ad(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_aa28ad(); - return; -} diff --git a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.msl b/test/tint/builtins/gen/min/aa28ad.wgsl.expected.msl deleted file mode 100644 index 8a5d68dea2..0000000000 --- a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_aa28ad() { - float2 res = fmin(float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_aa28ad(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_aa28ad(); - return; -} - -kernel void compute_main() { - min_aa28ad(); - return; -} - diff --git a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.spvasm b/test/tint/builtins/gen/min/aa28ad.wgsl.expected.spvasm deleted file mode 100644 index 7c1cb4d679..0000000000 --- a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %min_aa28ad "min_aa28ad" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %min_aa28ad = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 NMin %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %min_aa28ad - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %min_aa28ad - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %min_aa28ad - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.wgsl b/test/tint/builtins/gen/min/aa28ad.wgsl.expected.wgsl deleted file mode 100644 index 0830734705..0000000000 --- a/test/tint/builtins/gen/min/aa28ad.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_aa28ad() { - var res : vec2 = min(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_aa28ad(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_aa28ad(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_aa28ad(); -} diff --git a/test/tint/builtins/gen/min/af326d.wgsl b/test/tint/builtins/gen/min/af326d.wgsl deleted file mode 100644 index aa0b6dabce..0000000000 --- a/test/tint/builtins/gen/min/af326d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(f32, f32) -> f32 -fn min_af326d() { - var res: f32 = min(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_af326d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_af326d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_af326d(); -} diff --git a/test/tint/builtins/gen/min/af326d.wgsl.expected.glsl b/test/tint/builtins/gen/min/af326d.wgsl.expected.glsl deleted file mode 100644 index 9b7752ac61..0000000000 --- a/test/tint/builtins/gen/min/af326d.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_af326d() { - float res = min(1.0f, 1.0f); -} - -vec4 vertex_main() { - min_af326d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_af326d() { - float res = min(1.0f, 1.0f); -} - -void fragment_main() { - min_af326d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_af326d() { - float res = min(1.0f, 1.0f); -} - -void compute_main() { - min_af326d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/af326d.wgsl.expected.hlsl b/test/tint/builtins/gen/min/af326d.wgsl.expected.hlsl deleted file mode 100644 index 2ec6e9f821..0000000000 --- a/test/tint/builtins/gen/min/af326d.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_af326d() { - float res = min(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_af326d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_af326d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_af326d(); - return; -} diff --git a/test/tint/builtins/gen/min/af326d.wgsl.expected.msl b/test/tint/builtins/gen/min/af326d.wgsl.expected.msl deleted file mode 100644 index a374198a94..0000000000 --- a/test/tint/builtins/gen/min/af326d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_af326d() { - float res = fmin(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_af326d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_af326d(); - return; -} - -kernel void compute_main() { - min_af326d(); - return; -} - diff --git a/test/tint/builtins/gen/min/af326d.wgsl.expected.wgsl b/test/tint/builtins/gen/min/af326d.wgsl.expected.wgsl deleted file mode 100644 index c0500c38b6..0000000000 --- a/test/tint/builtins/gen/min/af326d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_af326d() { - var res : f32 = min(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_af326d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_af326d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_af326d(); -} diff --git a/test/tint/builtins/gen/min/c70bb7.wgsl b/test/tint/builtins/gen/min/c70bb7.wgsl deleted file mode 100644 index 3be96121a5..0000000000 --- a/test/tint/builtins/gen/min/c70bb7.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(vec<3, u32>, vec<3, u32>) -> vec<3, u32> -fn min_c70bb7() { - var res: vec3 = min(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_c70bb7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_c70bb7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_c70bb7(); -} diff --git a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.glsl b/test/tint/builtins/gen/min/c70bb7.wgsl.expected.glsl deleted file mode 100644 index abd1842a9b..0000000000 --- a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_c70bb7() { - uvec3 res = min(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - min_c70bb7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_c70bb7() { - uvec3 res = min(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - min_c70bb7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_c70bb7() { - uvec3 res = min(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u)); -} - -void compute_main() { - min_c70bb7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.hlsl b/test/tint/builtins/gen/min/c70bb7.wgsl.expected.hlsl deleted file mode 100644 index 5dbaff7575..0000000000 --- a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_c70bb7() { - uint3 res = min(uint3(0u, 0u, 0u), uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_c70bb7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_c70bb7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_c70bb7(); - return; -} diff --git a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.msl b/test/tint/builtins/gen/min/c70bb7.wgsl.expected.msl deleted file mode 100644 index 75707f7a44..0000000000 --- a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_c70bb7() { - uint3 res = min(uint3(), uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_c70bb7(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_c70bb7(); - return; -} - -kernel void compute_main() { - min_c70bb7(); - return; -} - diff --git a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.spvasm b/test/tint/builtins/gen/min/c70bb7.wgsl.expected.spvasm deleted file mode 100644 index ed15a516fe..0000000000 --- a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.spvasm +++ /dev/null @@ -1,68 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %min_c70bb7 "min_c70bb7" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %17 = OpConstantNull %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %20 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %min_c70bb7 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %17 - %13 = OpExtInst %v3uint %16 UMin %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %min_c70bb7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %min_c70bb7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %min_c70bb7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.wgsl b/test/tint/builtins/gen/min/c70bb7.wgsl.expected.wgsl deleted file mode 100644 index d113cdb1d7..0000000000 --- a/test/tint/builtins/gen/min/c70bb7.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_c70bb7() { - var res : vec3 = min(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_c70bb7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_c70bb7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_c70bb7(); -} diff --git a/test/tint/builtins/gen/min/c73147.wgsl b/test/tint/builtins/gen/min/c73147.wgsl deleted file mode 100644 index 80b0a21024..0000000000 --- a/test/tint/builtins/gen/min/c73147.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(i32, i32) -> i32 -fn min_c73147() { - var res: i32 = min(1, 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_c73147(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_c73147(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_c73147(); -} diff --git a/test/tint/builtins/gen/min/c73147.wgsl.expected.glsl b/test/tint/builtins/gen/min/c73147.wgsl.expected.glsl deleted file mode 100644 index 4cc4826745..0000000000 --- a/test/tint/builtins/gen/min/c73147.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_c73147() { - int res = min(1, 1); -} - -vec4 vertex_main() { - min_c73147(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_c73147() { - int res = min(1, 1); -} - -void fragment_main() { - min_c73147(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_c73147() { - int res = min(1, 1); -} - -void compute_main() { - min_c73147(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/c73147.wgsl.expected.hlsl b/test/tint/builtins/gen/min/c73147.wgsl.expected.hlsl deleted file mode 100644 index f58afc812c..0000000000 --- a/test/tint/builtins/gen/min/c73147.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_c73147() { - int res = min(1, 1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_c73147(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_c73147(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_c73147(); - return; -} diff --git a/test/tint/builtins/gen/min/c73147.wgsl.expected.msl b/test/tint/builtins/gen/min/c73147.wgsl.expected.msl deleted file mode 100644 index 94a8da2f08..0000000000 --- a/test/tint/builtins/gen/min/c73147.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_c73147() { - int res = min(1, 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_c73147(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_c73147(); - return; -} - -kernel void compute_main() { - min_c73147(); - return; -} - diff --git a/test/tint/builtins/gen/min/c73147.wgsl.expected.wgsl b/test/tint/builtins/gen/min/c73147.wgsl.expected.wgsl deleted file mode 100644 index 3221e2ea57..0000000000 --- a/test/tint/builtins/gen/min/c73147.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_c73147() { - var res : i32 = min(1, 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_c73147(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_c73147(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_c73147(); -} diff --git a/test/tint/builtins/gen/min/c76fa6.wgsl b/test/tint/builtins/gen/min/c76fa6.wgsl deleted file mode 100644 index 1de3701499..0000000000 --- a/test/tint/builtins/gen/min/c76fa6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn min(vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn min_c76fa6() { - var res: vec4 = min(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_c76fa6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_c76fa6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_c76fa6(); -} diff --git a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.glsl b/test/tint/builtins/gen/min/c76fa6.wgsl.expected.glsl deleted file mode 100644 index 5448710bef..0000000000 --- a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void min_c76fa6() { - vec4 res = min(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - min_c76fa6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void min_c76fa6() { - vec4 res = min(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - min_c76fa6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void min_c76fa6() { - vec4 res = min(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - min_c76fa6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.hlsl b/test/tint/builtins/gen/min/c76fa6.wgsl.expected.hlsl deleted file mode 100644 index de0b7ca6ac..0000000000 --- a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void min_c76fa6() { - float4 res = min(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - min_c76fa6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - min_c76fa6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - min_c76fa6(); - return; -} diff --git a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.msl b/test/tint/builtins/gen/min/c76fa6.wgsl.expected.msl deleted file mode 100644 index 7af41b68e6..0000000000 --- a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void min_c76fa6() { - float4 res = fmin(float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - min_c76fa6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - min_c76fa6(); - return; -} - -kernel void compute_main() { - min_c76fa6(); - return; -} - diff --git a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.spvasm b/test/tint/builtins/gen/min/c76fa6.wgsl.expected.spvasm deleted file mode 100644 index 6d8fad9f65..0000000000 --- a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %min_c76fa6 "min_c76fa6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %min_c76fa6 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 NMin %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %min_c76fa6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %min_c76fa6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %min_c76fa6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.wgsl b/test/tint/builtins/gen/min/c76fa6.wgsl.expected.wgsl deleted file mode 100644 index 3a01a8886a..0000000000 --- a/test/tint/builtins/gen/min/c76fa6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn min_c76fa6() { - var res : vec4 = min(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - min_c76fa6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - min_c76fa6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - min_c76fa6(); -} diff --git a/test/tint/builtins/gen/mix/0c8c33.wgsl b/test/tint/builtins/gen/mix/0c8c33.wgsl deleted file mode 100644 index a78946ce20..0000000000 --- a/test/tint/builtins/gen/mix/0c8c33.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn mix(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn mix_0c8c33() { - var res: vec3 = mix(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_0c8c33(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_0c8c33(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_0c8c33(); -} diff --git a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.glsl b/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.glsl deleted file mode 100644 index 4b64e92071..0000000000 --- a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void mix_0c8c33() { - vec3 res = mix(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - mix_0c8c33(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void mix_0c8c33() { - vec3 res = mix(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - mix_0c8c33(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void mix_0c8c33() { - vec3 res = mix(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - mix_0c8c33(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.hlsl b/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.hlsl deleted file mode 100644 index 941e165416..0000000000 --- a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void mix_0c8c33() { - float3 res = lerp(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - mix_0c8c33(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - mix_0c8c33(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - mix_0c8c33(); - return; -} diff --git a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.msl b/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.msl deleted file mode 100644 index 8f33abfbb1..0000000000 --- a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void mix_0c8c33() { - float3 res = mix(float3(), float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - mix_0c8c33(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - mix_0c8c33(); - return; -} - -kernel void compute_main() { - mix_0c8c33(); - return; -} - diff --git a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.spvasm b/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.spvasm deleted file mode 100644 index ec2334d165..0000000000 --- a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %mix_0c8c33 "mix_0c8c33" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %mix_0c8c33 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 FMix %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %mix_0c8c33 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %mix_0c8c33 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %mix_0c8c33 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.wgsl b/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.wgsl deleted file mode 100644 index d76f3e3d29..0000000000 --- a/test/tint/builtins/gen/mix/0c8c33.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn mix_0c8c33() { - var res : vec3 = mix(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_0c8c33(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_0c8c33(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_0c8c33(); -} diff --git a/test/tint/builtins/gen/mix/1faeb1.wgsl b/test/tint/builtins/gen/mix/1faeb1.wgsl deleted file mode 100644 index d453ef65fc..0000000000 --- a/test/tint/builtins/gen/mix/1faeb1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn mix(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32> -fn mix_1faeb1() { - var res: vec4 = mix(vec4(), vec4(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_1faeb1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_1faeb1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_1faeb1(); -} diff --git a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.glsl b/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.glsl deleted file mode 100644 index 2a9d61ed1c..0000000000 --- a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void mix_1faeb1() { - vec4 res = mix(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - mix_1faeb1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void mix_1faeb1() { - vec4 res = mix(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - mix_1faeb1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void mix_1faeb1() { - vec4 res = mix(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), 1.0f); -} - -void compute_main() { - mix_1faeb1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.hlsl b/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.hlsl deleted file mode 100644 index b3c35364ba..0000000000 --- a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void mix_1faeb1() { - float4 res = lerp(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - mix_1faeb1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - mix_1faeb1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - mix_1faeb1(); - return; -} diff --git a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.msl b/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.msl deleted file mode 100644 index 89175cf9ff..0000000000 --- a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void mix_1faeb1() { - float4 res = mix(float4(), float4(), 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - mix_1faeb1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - mix_1faeb1(); - return; -} - -kernel void compute_main() { - mix_1faeb1(); - return; -} - diff --git a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.spvasm b/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.spvasm deleted file mode 100644 index 57731fbab3..0000000000 --- a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %mix_1faeb1 "mix_1faeb1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %20 = OpTypeFunction %v4float - %mix_1faeb1 = OpFunction %void None %9 - %12 = OpLabel - %16 = OpVariable %_ptr_Function_v4float Function %5 - %res = OpVariable %_ptr_Function_v4float Function %5 - %18 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 - %13 = OpExtInst %v4float %14 FMix %5 %5 %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %mix_1faeb1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %mix_1faeb1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %mix_1faeb1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.wgsl b/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.wgsl deleted file mode 100644 index ffeab6ad15..0000000000 --- a/test/tint/builtins/gen/mix/1faeb1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn mix_1faeb1() { - var res : vec4 = mix(vec4(), vec4(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_1faeb1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_1faeb1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_1faeb1(); -} diff --git a/test/tint/builtins/gen/mix/2fadab.wgsl b/test/tint/builtins/gen/mix/2fadab.wgsl deleted file mode 100644 index a360975402..0000000000 --- a/test/tint/builtins/gen/mix/2fadab.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn mix(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32> -fn mix_2fadab() { - var res: vec2 = mix(vec2(), vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_2fadab(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_2fadab(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_2fadab(); -} diff --git a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.glsl b/test/tint/builtins/gen/mix/2fadab.wgsl.expected.glsl deleted file mode 100644 index b52112ecc0..0000000000 --- a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void mix_2fadab() { - vec2 res = mix(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - mix_2fadab(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void mix_2fadab() { - vec2 res = mix(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - mix_2fadab(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void mix_2fadab() { - vec2 res = mix(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), 1.0f); -} - -void compute_main() { - mix_2fadab(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.hlsl b/test/tint/builtins/gen/mix/2fadab.wgsl.expected.hlsl deleted file mode 100644 index 2aa89fb18d..0000000000 --- a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void mix_2fadab() { - float2 res = lerp(float2(0.0f, 0.0f), float2(0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - mix_2fadab(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - mix_2fadab(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - mix_2fadab(); - return; -} diff --git a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.msl b/test/tint/builtins/gen/mix/2fadab.wgsl.expected.msl deleted file mode 100644 index e6ce43a894..0000000000 --- a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void mix_2fadab() { - float2 res = mix(float2(), float2(), 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - mix_2fadab(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - mix_2fadab(); - return; -} - -kernel void compute_main() { - mix_2fadab(); - return; -} - diff --git a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.spvasm b/test/tint/builtins/gen/mix/2fadab.wgsl.expected.spvasm deleted file mode 100644 index 3eb2f5d72c..0000000000 --- a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %mix_2fadab "mix_2fadab" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 -%_ptr_Function_v2float = OpTypePointer Function %v2float - %22 = OpTypeFunction %v4float - %mix_2fadab = OpFunction %void None %9 - %12 = OpLabel - %18 = OpVariable %_ptr_Function_v2float Function %16 - %res = OpVariable %_ptr_Function_v2float Function %16 - %20 = OpCompositeConstruct %v2float %float_1 %float_1 - %13 = OpExtInst %v2float %15 FMix %16 %16 %20 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %mix_2fadab - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %mix_2fadab - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %mix_2fadab - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.wgsl b/test/tint/builtins/gen/mix/2fadab.wgsl.expected.wgsl deleted file mode 100644 index d084ab68bf..0000000000 --- a/test/tint/builtins/gen/mix/2fadab.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn mix_2fadab() { - var res : vec2 = mix(vec2(), vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_2fadab(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_2fadab(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_2fadab(); -} diff --git a/test/tint/builtins/gen/mix/315264.wgsl b/test/tint/builtins/gen/mix/315264.wgsl deleted file mode 100644 index c70834f31e..0000000000 --- a/test/tint/builtins/gen/mix/315264.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn mix(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32> -fn mix_315264() { - var res: vec3 = mix(vec3(), vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_315264(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_315264(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_315264(); -} diff --git a/test/tint/builtins/gen/mix/315264.wgsl.expected.glsl b/test/tint/builtins/gen/mix/315264.wgsl.expected.glsl deleted file mode 100644 index d450ea1bd7..0000000000 --- a/test/tint/builtins/gen/mix/315264.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void mix_315264() { - vec3 res = mix(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - mix_315264(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void mix_315264() { - vec3 res = mix(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - mix_315264(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void mix_315264() { - vec3 res = mix(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void compute_main() { - mix_315264(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/mix/315264.wgsl.expected.hlsl b/test/tint/builtins/gen/mix/315264.wgsl.expected.hlsl deleted file mode 100644 index a389a34951..0000000000 --- a/test/tint/builtins/gen/mix/315264.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void mix_315264() { - float3 res = lerp(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - mix_315264(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - mix_315264(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - mix_315264(); - return; -} diff --git a/test/tint/builtins/gen/mix/315264.wgsl.expected.msl b/test/tint/builtins/gen/mix/315264.wgsl.expected.msl deleted file mode 100644 index a9110a3e42..0000000000 --- a/test/tint/builtins/gen/mix/315264.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void mix_315264() { - float3 res = mix(float3(), float3(), 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - mix_315264(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - mix_315264(); - return; -} - -kernel void compute_main() { - mix_315264(); - return; -} - diff --git a/test/tint/builtins/gen/mix/315264.wgsl.expected.spvasm b/test/tint/builtins/gen/mix/315264.wgsl.expected.spvasm deleted file mode 100644 index edd5730b98..0000000000 --- a/test/tint/builtins/gen/mix/315264.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %mix_315264 "mix_315264" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float - %float_1 = OpConstant %float 1 -%_ptr_Function_v3float = OpTypePointer Function %v3float - %22 = OpTypeFunction %v4float - %mix_315264 = OpFunction %void None %9 - %12 = OpLabel - %18 = OpVariable %_ptr_Function_v3float Function %16 - %res = OpVariable %_ptr_Function_v3float Function %16 - %20 = OpCompositeConstruct %v3float %float_1 %float_1 %float_1 - %13 = OpExtInst %v3float %15 FMix %16 %16 %20 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %mix_315264 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %mix_315264 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %mix_315264 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/mix/315264.wgsl.expected.wgsl b/test/tint/builtins/gen/mix/315264.wgsl.expected.wgsl deleted file mode 100644 index 40fae02cce..0000000000 --- a/test/tint/builtins/gen/mix/315264.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn mix_315264() { - var res : vec3 = mix(vec3(), vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_315264(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_315264(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_315264(); -} diff --git a/test/tint/builtins/gen/mix/4f0b5e.wgsl b/test/tint/builtins/gen/mix/4f0b5e.wgsl deleted file mode 100644 index 0b075862b5..0000000000 --- a/test/tint/builtins/gen/mix/4f0b5e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn mix(f32, f32, f32) -> f32 -fn mix_4f0b5e() { - var res: f32 = mix(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_4f0b5e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_4f0b5e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_4f0b5e(); -} diff --git a/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.glsl b/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.glsl deleted file mode 100644 index 549cc7daad..0000000000 --- a/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void mix_4f0b5e() { - float res = mix(1.0f, 1.0f, 1.0f); -} - -vec4 vertex_main() { - mix_4f0b5e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void mix_4f0b5e() { - float res = mix(1.0f, 1.0f, 1.0f); -} - -void fragment_main() { - mix_4f0b5e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void mix_4f0b5e() { - float res = mix(1.0f, 1.0f, 1.0f); -} - -void compute_main() { - mix_4f0b5e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.hlsl b/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.hlsl deleted file mode 100644 index f30ed99270..0000000000 --- a/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void mix_4f0b5e() { - float res = lerp(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - mix_4f0b5e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - mix_4f0b5e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - mix_4f0b5e(); - return; -} diff --git a/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.msl b/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.msl deleted file mode 100644 index 1f7906dd44..0000000000 --- a/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void mix_4f0b5e() { - float res = mix(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - mix_4f0b5e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - mix_4f0b5e(); - return; -} - -kernel void compute_main() { - mix_4f0b5e(); - return; -} - diff --git a/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.wgsl b/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.wgsl deleted file mode 100644 index 67679c4963..0000000000 --- a/test/tint/builtins/gen/mix/4f0b5e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn mix_4f0b5e() { - var res : f32 = mix(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_4f0b5e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_4f0b5e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_4f0b5e(); -} diff --git a/test/tint/builtins/gen/mix/6f8adc.wgsl b/test/tint/builtins/gen/mix/6f8adc.wgsl deleted file mode 100644 index ad177e2840..0000000000 --- a/test/tint/builtins/gen/mix/6f8adc.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn mix(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn mix_6f8adc() { - var res: vec2 = mix(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_6f8adc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_6f8adc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_6f8adc(); -} diff --git a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.glsl b/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.glsl deleted file mode 100644 index afcfb45234..0000000000 --- a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void mix_6f8adc() { - vec2 res = mix(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - mix_6f8adc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void mix_6f8adc() { - vec2 res = mix(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - mix_6f8adc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void mix_6f8adc() { - vec2 res = mix(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - mix_6f8adc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.hlsl b/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.hlsl deleted file mode 100644 index 811687075a..0000000000 --- a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void mix_6f8adc() { - float2 res = lerp(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - mix_6f8adc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - mix_6f8adc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - mix_6f8adc(); - return; -} diff --git a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.msl b/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.msl deleted file mode 100644 index 699f297ed7..0000000000 --- a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void mix_6f8adc() { - float2 res = mix(float2(), float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - mix_6f8adc(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - mix_6f8adc(); - return; -} - -kernel void compute_main() { - mix_6f8adc(); - return; -} - diff --git a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.spvasm b/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.spvasm deleted file mode 100644 index 86fda1765a..0000000000 --- a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %mix_6f8adc "mix_6f8adc" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %mix_6f8adc = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 FMix %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %mix_6f8adc - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %mix_6f8adc - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %mix_6f8adc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.wgsl b/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.wgsl deleted file mode 100644 index 2bd55cc18e..0000000000 --- a/test/tint/builtins/gen/mix/6f8adc.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn mix_6f8adc() { - var res : vec2 = mix(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_6f8adc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_6f8adc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_6f8adc(); -} diff --git a/test/tint/builtins/gen/mix/c37ede.wgsl b/test/tint/builtins/gen/mix/c37ede.wgsl deleted file mode 100644 index d72f984be8..0000000000 --- a/test/tint/builtins/gen/mix/c37ede.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn mix(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn mix_c37ede() { - var res: vec4 = mix(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_c37ede(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_c37ede(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_c37ede(); -} diff --git a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.glsl b/test/tint/builtins/gen/mix/c37ede.wgsl.expected.glsl deleted file mode 100644 index 5e3c24fb3b..0000000000 --- a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void mix_c37ede() { - vec4 res = mix(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - mix_c37ede(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void mix_c37ede() { - vec4 res = mix(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - mix_c37ede(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void mix_c37ede() { - vec4 res = mix(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - mix_c37ede(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.hlsl b/test/tint/builtins/gen/mix/c37ede.wgsl.expected.hlsl deleted file mode 100644 index 622c3da3df..0000000000 --- a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void mix_c37ede() { - float4 res = lerp(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - mix_c37ede(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - mix_c37ede(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - mix_c37ede(); - return; -} diff --git a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.msl b/test/tint/builtins/gen/mix/c37ede.wgsl.expected.msl deleted file mode 100644 index abe0dc7d29..0000000000 --- a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void mix_c37ede() { - float4 res = mix(float4(), float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - mix_c37ede(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - mix_c37ede(); - return; -} - -kernel void compute_main() { - mix_c37ede(); - return; -} - diff --git a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.spvasm b/test/tint/builtins/gen/mix/c37ede.wgsl.expected.spvasm deleted file mode 100644 index dfac6facb6..0000000000 --- a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %mix_c37ede "mix_c37ede" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %mix_c37ede = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 FMix %5 %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %mix_c37ede - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %mix_c37ede - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %mix_c37ede - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.wgsl b/test/tint/builtins/gen/mix/c37ede.wgsl.expected.wgsl deleted file mode 100644 index 4d3d087cf6..0000000000 --- a/test/tint/builtins/gen/mix/c37ede.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn mix_c37ede() { - var res : vec4 = mix(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - mix_c37ede(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - mix_c37ede(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - mix_c37ede(); -} diff --git a/test/tint/builtins/gen/modf/180fed.wgsl b/test/tint/builtins/gen/modf/180fed.wgsl deleted file mode 100644 index 962e3f3264..0000000000 --- a/test/tint/builtins/gen/modf/180fed.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn modf(f32) -> __modf_result -fn modf_180fed() { - var res = modf(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - modf_180fed(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - modf_180fed(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - modf_180fed(); -} diff --git a/test/tint/builtins/gen/modf/180fed.wgsl.expected.glsl b/test/tint/builtins/gen/modf/180fed.wgsl.expected.glsl deleted file mode 100644 index 6e3bf1f38f..0000000000 --- a/test/tint/builtins/gen/modf/180fed.wgsl.expected.glsl +++ /dev/null @@ -1,85 +0,0 @@ -#version 310 es - -struct modf_result { - float fract; - float whole; -}; - -modf_result tint_modf(float param_0) { - modf_result result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_180fed() { - modf_result res = tint_modf(1.0f); -} - -vec4 vertex_main() { - modf_180fed(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -struct modf_result { - float fract; - float whole; -}; - -modf_result tint_modf(float param_0) { - modf_result result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_180fed() { - modf_result res = tint_modf(1.0f); -} - -void fragment_main() { - modf_180fed(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -struct modf_result { - float fract; - float whole; -}; - -modf_result tint_modf(float param_0) { - modf_result result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_180fed() { - modf_result res = tint_modf(1.0f); -} - -void compute_main() { - modf_180fed(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/modf/180fed.wgsl.expected.hlsl b/test/tint/builtins/gen/modf/180fed.wgsl.expected.hlsl deleted file mode 100644 index b9a186cba4..0000000000 --- a/test/tint/builtins/gen/modf/180fed.wgsl.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -struct modf_result { - float fract; - float whole; -}; -modf_result tint_modf(float param_0) { - float whole; - float fract = modf(param_0, whole); - modf_result result = {fract, whole}; - return result; -} - -void modf_180fed() { - modf_result res = tint_modf(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - modf_180fed(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - modf_180fed(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - modf_180fed(); - return; -} diff --git a/test/tint/builtins/gen/modf/180fed.wgsl.expected.msl b/test/tint/builtins/gen/modf/180fed.wgsl.expected.msl deleted file mode 100644 index d1f6d8bf6a..0000000000 --- a/test/tint/builtins/gen/modf/180fed.wgsl.expected.msl +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace metal; - -struct modf_result { - float fract; - float whole; -}; -modf_result tint_modf(float param_0) { - float whole; - float fract = modf(param_0, whole); - return {fract, whole}; -} - -void modf_180fed() { - modf_result res = tint_modf(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - modf_180fed(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - modf_180fed(); - return; -} - -kernel void compute_main() { - modf_180fed(); - return; -} - diff --git a/test/tint/builtins/gen/modf/180fed.wgsl.expected.spvasm b/test/tint/builtins/gen/modf/180fed.wgsl.expected.spvasm deleted file mode 100644 index b90be4c58f..0000000000 --- a/test/tint/builtins/gen/modf/180fed.wgsl.expected.spvasm +++ /dev/null @@ -1,72 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %modf_180fed "modf_180fed" - OpName %__modf_result "__modf_result" - OpMemberName %__modf_result 0 "fract" - OpMemberName %__modf_result 1 "whole" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpMemberDecorate %__modf_result 0 Offset 0 - OpMemberDecorate %__modf_result 1 Offset 4 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%__modf_result = OpTypeStruct %float %float - %float_1 = OpConstant %float 1 -%_ptr_Function___modf_result = OpTypePointer Function %__modf_result - %19 = OpConstantNull %__modf_result - %20 = OpTypeFunction %v4float -%modf_180fed = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function___modf_result Function %19 - %13 = OpExtInst %__modf_result %15 ModfStruct %float_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %modf_180fed - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %modf_180fed - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %modf_180fed - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/modf/180fed.wgsl.expected.wgsl b/test/tint/builtins/gen/modf/180fed.wgsl.expected.wgsl deleted file mode 100644 index 3865c224a5..0000000000 --- a/test/tint/builtins/gen/modf/180fed.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn modf_180fed() { - var res = modf(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - modf_180fed(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - modf_180fed(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - modf_180fed(); -} diff --git a/test/tint/builtins/gen/modf/9b75f7.wgsl b/test/tint/builtins/gen/modf/9b75f7.wgsl deleted file mode 100644 index aff6139558..0000000000 --- a/test/tint/builtins/gen/modf/9b75f7.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn modf(vec<3, f32>) -> __modf_result_vec<3> -fn modf_9b75f7() { - var res = modf(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - modf_9b75f7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - modf_9b75f7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - modf_9b75f7(); -} diff --git a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.glsl b/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.glsl deleted file mode 100644 index 1b3dc2ad37..0000000000 --- a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.glsl +++ /dev/null @@ -1,85 +0,0 @@ -#version 310 es - -struct modf_result_vec3 { - vec3 fract; - vec3 whole; -}; - -modf_result_vec3 tint_modf(vec3 param_0) { - modf_result_vec3 result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_9b75f7() { - modf_result_vec3 res = tint_modf(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - modf_9b75f7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -struct modf_result_vec3 { - vec3 fract; - vec3 whole; -}; - -modf_result_vec3 tint_modf(vec3 param_0) { - modf_result_vec3 result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_9b75f7() { - modf_result_vec3 res = tint_modf(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - modf_9b75f7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -struct modf_result_vec3 { - vec3 fract; - vec3 whole; -}; - -modf_result_vec3 tint_modf(vec3 param_0) { - modf_result_vec3 result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_9b75f7() { - modf_result_vec3 res = tint_modf(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - modf_9b75f7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.hlsl b/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.hlsl deleted file mode 100644 index a6a0f25961..0000000000 --- a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -struct modf_result_vec3 { - float3 fract; - float3 whole; -}; -modf_result_vec3 tint_modf(float3 param_0) { - float3 whole; - float3 fract = modf(param_0, whole); - modf_result_vec3 result = {fract, whole}; - return result; -} - -void modf_9b75f7() { - modf_result_vec3 res = tint_modf(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - modf_9b75f7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - modf_9b75f7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - modf_9b75f7(); - return; -} diff --git a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.msl b/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.msl deleted file mode 100644 index fcf035d315..0000000000 --- a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.msl +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace metal; - -struct modf_result_vec3 { - float3 fract; - float3 whole; -}; -modf_result_vec3 tint_modf(float3 param_0) { - float3 whole; - float3 fract = modf(param_0, whole); - return {fract, whole}; -} - -void modf_9b75f7() { - modf_result_vec3 res = tint_modf(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - modf_9b75f7(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - modf_9b75f7(); - return; -} - -kernel void compute_main() { - modf_9b75f7(); - return; -} - diff --git a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.spvasm b/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.spvasm deleted file mode 100644 index 358ed18223..0000000000 --- a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %modf_9b75f7 "modf_9b75f7" - OpName %__modf_result_vec3 "__modf_result_vec3" - OpMemberName %__modf_result_vec3 0 "fract" - OpMemberName %__modf_result_vec3 1 "whole" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpMemberDecorate %__modf_result_vec3 0 Offset 0 - OpMemberDecorate %__modf_result_vec3 1 Offset 16 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 -%__modf_result_vec3 = OpTypeStruct %v3float %v3float - %17 = OpConstantNull %v3float -%_ptr_Function___modf_result_vec3 = OpTypePointer Function %__modf_result_vec3 - %20 = OpConstantNull %__modf_result_vec3 - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%modf_9b75f7 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function___modf_result_vec3 Function %20 - %13 = OpExtInst %__modf_result_vec3 %16 ModfStruct %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %modf_9b75f7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %modf_9b75f7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %modf_9b75f7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.wgsl b/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.wgsl deleted file mode 100644 index 90eaf3a104..0000000000 --- a/test/tint/builtins/gen/modf/9b75f7.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn modf_9b75f7() { - var res = modf(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - modf_9b75f7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - modf_9b75f7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - modf_9b75f7(); -} diff --git a/test/tint/builtins/gen/modf/ec2dbc.wgsl b/test/tint/builtins/gen/modf/ec2dbc.wgsl deleted file mode 100644 index 3bf8cb7d68..0000000000 --- a/test/tint/builtins/gen/modf/ec2dbc.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn modf(vec<4, f32>) -> __modf_result_vec<4> -fn modf_ec2dbc() { - var res = modf(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - modf_ec2dbc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - modf_ec2dbc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - modf_ec2dbc(); -} diff --git a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.glsl b/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.glsl deleted file mode 100644 index efdda2e193..0000000000 --- a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.glsl +++ /dev/null @@ -1,85 +0,0 @@ -#version 310 es - -struct modf_result_vec4 { - vec4 fract; - vec4 whole; -}; - -modf_result_vec4 tint_modf(vec4 param_0) { - modf_result_vec4 result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_ec2dbc() { - modf_result_vec4 res = tint_modf(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - modf_ec2dbc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -struct modf_result_vec4 { - vec4 fract; - vec4 whole; -}; - -modf_result_vec4 tint_modf(vec4 param_0) { - modf_result_vec4 result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_ec2dbc() { - modf_result_vec4 res = tint_modf(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - modf_ec2dbc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -struct modf_result_vec4 { - vec4 fract; - vec4 whole; -}; - -modf_result_vec4 tint_modf(vec4 param_0) { - modf_result_vec4 result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_ec2dbc() { - modf_result_vec4 res = tint_modf(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - modf_ec2dbc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.hlsl b/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.hlsl deleted file mode 100644 index b83f48140c..0000000000 --- a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -struct modf_result_vec4 { - float4 fract; - float4 whole; -}; -modf_result_vec4 tint_modf(float4 param_0) { - float4 whole; - float4 fract = modf(param_0, whole); - modf_result_vec4 result = {fract, whole}; - return result; -} - -void modf_ec2dbc() { - modf_result_vec4 res = tint_modf(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - modf_ec2dbc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - modf_ec2dbc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - modf_ec2dbc(); - return; -} diff --git a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.msl b/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.msl deleted file mode 100644 index a62a85c5fc..0000000000 --- a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.msl +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace metal; - -struct modf_result_vec4 { - float4 fract; - float4 whole; -}; -modf_result_vec4 tint_modf(float4 param_0) { - float4 whole; - float4 fract = modf(param_0, whole); - return {fract, whole}; -} - -void modf_ec2dbc() { - modf_result_vec4 res = tint_modf(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - modf_ec2dbc(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - modf_ec2dbc(); - return; -} - -kernel void compute_main() { - modf_ec2dbc(); - return; -} - diff --git a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.spvasm b/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.spvasm deleted file mode 100644 index 3b63387564..0000000000 --- a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.spvasm +++ /dev/null @@ -1,72 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %modf_ec2dbc "modf_ec2dbc" - OpName %__modf_result_vec4 "__modf_result_vec4" - OpMemberName %__modf_result_vec4 0 "fract" - OpMemberName %__modf_result_vec4 1 "whole" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpMemberDecorate %__modf_result_vec4 0 Offset 0 - OpMemberDecorate %__modf_result_vec4 1 Offset 16 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%__modf_result_vec4 = OpTypeStruct %v4float %v4float -%_ptr_Function___modf_result_vec4 = OpTypePointer Function %__modf_result_vec4 - %18 = OpConstantNull %__modf_result_vec4 - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%modf_ec2dbc = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function___modf_result_vec4 Function %18 - %13 = OpExtInst %__modf_result_vec4 %15 ModfStruct %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %modf_ec2dbc - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %modf_ec2dbc - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %modf_ec2dbc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.wgsl b/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.wgsl deleted file mode 100644 index 6c3380d286..0000000000 --- a/test/tint/builtins/gen/modf/ec2dbc.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn modf_ec2dbc() { - var res = modf(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - modf_ec2dbc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - modf_ec2dbc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - modf_ec2dbc(); -} diff --git a/test/tint/builtins/gen/modf/f5f20d.wgsl b/test/tint/builtins/gen/modf/f5f20d.wgsl deleted file mode 100644 index c251d46b3c..0000000000 --- a/test/tint/builtins/gen/modf/f5f20d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn modf(vec<2, f32>) -> __modf_result_vec<2> -fn modf_f5f20d() { - var res = modf(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - modf_f5f20d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - modf_f5f20d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - modf_f5f20d(); -} diff --git a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.glsl b/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.glsl deleted file mode 100644 index ca6dddd1c9..0000000000 --- a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.glsl +++ /dev/null @@ -1,85 +0,0 @@ -#version 310 es - -struct modf_result_vec2 { - vec2 fract; - vec2 whole; -}; - -modf_result_vec2 tint_modf(vec2 param_0) { - modf_result_vec2 result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_f5f20d() { - modf_result_vec2 res = tint_modf(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - modf_f5f20d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -struct modf_result_vec2 { - vec2 fract; - vec2 whole; -}; - -modf_result_vec2 tint_modf(vec2 param_0) { - modf_result_vec2 result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_f5f20d() { - modf_result_vec2 res = tint_modf(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - modf_f5f20d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -struct modf_result_vec2 { - vec2 fract; - vec2 whole; -}; - -modf_result_vec2 tint_modf(vec2 param_0) { - modf_result_vec2 result; - result.fract = modf(param_0, result.whole); - return result; -} - - -void modf_f5f20d() { - modf_result_vec2 res = tint_modf(vec2(0.0f, 0.0f)); -} - -void compute_main() { - modf_f5f20d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.hlsl b/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.hlsl deleted file mode 100644 index 88013fd34f..0000000000 --- a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -struct modf_result_vec2 { - float2 fract; - float2 whole; -}; -modf_result_vec2 tint_modf(float2 param_0) { - float2 whole; - float2 fract = modf(param_0, whole); - modf_result_vec2 result = {fract, whole}; - return result; -} - -void modf_f5f20d() { - modf_result_vec2 res = tint_modf(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - modf_f5f20d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - modf_f5f20d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - modf_f5f20d(); - return; -} diff --git a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.msl b/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.msl deleted file mode 100644 index f02e88b4d4..0000000000 --- a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.msl +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace metal; - -struct modf_result_vec2 { - float2 fract; - float2 whole; -}; -modf_result_vec2 tint_modf(float2 param_0) { - float2 whole; - float2 fract = modf(param_0, whole); - return {fract, whole}; -} - -void modf_f5f20d() { - modf_result_vec2 res = tint_modf(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - modf_f5f20d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - modf_f5f20d(); - return; -} - -kernel void compute_main() { - modf_f5f20d(); - return; -} - diff --git a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.spvasm b/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.spvasm deleted file mode 100644 index fce65bf884..0000000000 --- a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - %16 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %modf_f5f20d "modf_f5f20d" - OpName %__modf_result_vec2 "__modf_result_vec2" - OpMemberName %__modf_result_vec2 0 "fract" - OpMemberName %__modf_result_vec2 1 "whole" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpMemberDecorate %__modf_result_vec2 0 Offset 0 - OpMemberDecorate %__modf_result_vec2 1 Offset 8 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 -%__modf_result_vec2 = OpTypeStruct %v2float %v2float - %17 = OpConstantNull %v2float -%_ptr_Function___modf_result_vec2 = OpTypePointer Function %__modf_result_vec2 - %20 = OpConstantNull %__modf_result_vec2 - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%modf_f5f20d = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function___modf_result_vec2 Function %20 - %13 = OpExtInst %__modf_result_vec2 %16 ModfStruct %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %modf_f5f20d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %modf_f5f20d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %modf_f5f20d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.wgsl b/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.wgsl deleted file mode 100644 index 8dea55c304..0000000000 --- a/test/tint/builtins/gen/modf/f5f20d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn modf_f5f20d() { - var res = modf(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - modf_f5f20d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - modf_f5f20d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - modf_f5f20d(); -} diff --git a/test/tint/builtins/gen/normalize/64d8c0.wgsl b/test/tint/builtins/gen/normalize/64d8c0.wgsl deleted file mode 100644 index 4843a9e59c..0000000000 --- a/test/tint/builtins/gen/normalize/64d8c0.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn normalize(vec<3, f32>) -> vec<3, f32> -fn normalize_64d8c0() { - var res: vec3 = normalize(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - normalize_64d8c0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - normalize_64d8c0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - normalize_64d8c0(); -} diff --git a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.glsl b/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.glsl deleted file mode 100644 index 3b236881e9..0000000000 --- a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void normalize_64d8c0() { - vec3 res = normalize(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - normalize_64d8c0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void normalize_64d8c0() { - vec3 res = normalize(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - normalize_64d8c0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void normalize_64d8c0() { - vec3 res = normalize(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - normalize_64d8c0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.hlsl b/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.hlsl deleted file mode 100644 index b639e63460..0000000000 --- a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void normalize_64d8c0() { - float3 res = normalize(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - normalize_64d8c0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - normalize_64d8c0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - normalize_64d8c0(); - return; -} diff --git a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.msl b/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.msl deleted file mode 100644 index 844c52a795..0000000000 --- a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void normalize_64d8c0() { - float3 res = normalize(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - normalize_64d8c0(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - normalize_64d8c0(); - return; -} - -kernel void compute_main() { - normalize_64d8c0(); - return; -} - diff --git a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.spvasm b/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.spvasm deleted file mode 100644 index 914973a33a..0000000000 --- a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %normalize_64d8c0 "normalize_64d8c0" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%normalize_64d8c0 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Normalize %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %normalize_64d8c0 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %normalize_64d8c0 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %normalize_64d8c0 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.wgsl b/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.wgsl deleted file mode 100644 index 57444c8fc6..0000000000 --- a/test/tint/builtins/gen/normalize/64d8c0.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn normalize_64d8c0() { - var res : vec3 = normalize(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - normalize_64d8c0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - normalize_64d8c0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - normalize_64d8c0(); -} diff --git a/test/tint/builtins/gen/normalize/9a0aab.wgsl b/test/tint/builtins/gen/normalize/9a0aab.wgsl deleted file mode 100644 index 4bb13a2e03..0000000000 --- a/test/tint/builtins/gen/normalize/9a0aab.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn normalize(vec<4, f32>) -> vec<4, f32> -fn normalize_9a0aab() { - var res: vec4 = normalize(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - normalize_9a0aab(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - normalize_9a0aab(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - normalize_9a0aab(); -} diff --git a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.glsl b/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.glsl deleted file mode 100644 index ef0164eea8..0000000000 --- a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void normalize_9a0aab() { - vec4 res = normalize(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - normalize_9a0aab(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void normalize_9a0aab() { - vec4 res = normalize(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - normalize_9a0aab(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void normalize_9a0aab() { - vec4 res = normalize(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - normalize_9a0aab(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.hlsl b/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.hlsl deleted file mode 100644 index ae9ef5fa07..0000000000 --- a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void normalize_9a0aab() { - float4 res = normalize(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - normalize_9a0aab(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - normalize_9a0aab(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - normalize_9a0aab(); - return; -} diff --git a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.msl b/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.msl deleted file mode 100644 index 7dd5c0a8da..0000000000 --- a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void normalize_9a0aab() { - float4 res = normalize(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - normalize_9a0aab(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - normalize_9a0aab(); - return; -} - -kernel void compute_main() { - normalize_9a0aab(); - return; -} - diff --git a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.spvasm b/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.spvasm deleted file mode 100644 index 7b18b6f7d5..0000000000 --- a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %normalize_9a0aab "normalize_9a0aab" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%normalize_9a0aab = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Normalize %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %normalize_9a0aab - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %normalize_9a0aab - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %normalize_9a0aab - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.wgsl b/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.wgsl deleted file mode 100644 index 1b3e0195dd..0000000000 --- a/test/tint/builtins/gen/normalize/9a0aab.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn normalize_9a0aab() { - var res : vec4 = normalize(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - normalize_9a0aab(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - normalize_9a0aab(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - normalize_9a0aab(); -} diff --git a/test/tint/builtins/gen/normalize/fc2ef1.wgsl b/test/tint/builtins/gen/normalize/fc2ef1.wgsl deleted file mode 100644 index f56eb0eb0b..0000000000 --- a/test/tint/builtins/gen/normalize/fc2ef1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn normalize(vec<2, f32>) -> vec<2, f32> -fn normalize_fc2ef1() { - var res: vec2 = normalize(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - normalize_fc2ef1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - normalize_fc2ef1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - normalize_fc2ef1(); -} diff --git a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.glsl b/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.glsl deleted file mode 100644 index 1b2a7fd677..0000000000 --- a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void normalize_fc2ef1() { - vec2 res = normalize(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - normalize_fc2ef1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void normalize_fc2ef1() { - vec2 res = normalize(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - normalize_fc2ef1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void normalize_fc2ef1() { - vec2 res = normalize(vec2(0.0f, 0.0f)); -} - -void compute_main() { - normalize_fc2ef1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.hlsl b/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.hlsl deleted file mode 100644 index 8657268a8e..0000000000 --- a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void normalize_fc2ef1() { - float2 res = normalize(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - normalize_fc2ef1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - normalize_fc2ef1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - normalize_fc2ef1(); - return; -} diff --git a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.msl b/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.msl deleted file mode 100644 index 1464466ca2..0000000000 --- a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void normalize_fc2ef1() { - float2 res = normalize(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - normalize_fc2ef1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - normalize_fc2ef1(); - return; -} - -kernel void compute_main() { - normalize_fc2ef1(); - return; -} - diff --git a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.spvasm b/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.spvasm deleted file mode 100644 index ed6aec3a0e..0000000000 --- a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %normalize_fc2ef1 "normalize_fc2ef1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%normalize_fc2ef1 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Normalize %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %normalize_fc2ef1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %normalize_fc2ef1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %normalize_fc2ef1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.wgsl b/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.wgsl deleted file mode 100644 index b92ea5f711..0000000000 --- a/test/tint/builtins/gen/normalize/fc2ef1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn normalize_fc2ef1() { - var res : vec2 = normalize(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - normalize_fc2ef1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - normalize_fc2ef1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - normalize_fc2ef1(); -} diff --git a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl b/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl deleted file mode 100644 index 978bf65bf9..0000000000 --- a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn pack2x16float(vec2) -> u32 -fn pack2x16float_0e97b3() { - var res: u32 = pack2x16float(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack2x16float_0e97b3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack2x16float_0e97b3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack2x16float_0e97b3(); -} diff --git a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.glsl b/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.glsl deleted file mode 100644 index 176fa68625..0000000000 --- a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void pack2x16float_0e97b3() { - uint res = packHalf2x16(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - pack2x16float_0e97b3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void pack2x16float_0e97b3() { - uint res = packHalf2x16(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - pack2x16float_0e97b3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void pack2x16float_0e97b3() { - uint res = packHalf2x16(vec2(0.0f, 0.0f)); -} - -void compute_main() { - pack2x16float_0e97b3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.hlsl b/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.hlsl deleted file mode 100644 index 7ab94b6a04..0000000000 --- a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -uint tint_pack2x16float(float2 param_0) { - uint2 i = f32tof16(param_0); - return i.x | (i.y << 16); -} - -void pack2x16float_0e97b3() { - uint res = tint_pack2x16float(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - pack2x16float_0e97b3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - pack2x16float_0e97b3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - pack2x16float_0e97b3(); - return; -} diff --git a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.msl b/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.msl deleted file mode 100644 index 026b652428..0000000000 --- a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void pack2x16float_0e97b3() { - uint res = as_type(half2(float2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - pack2x16float_0e97b3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - pack2x16float_0e97b3(); - return; -} - -kernel void compute_main() { - pack2x16float_0e97b3(); - return; -} - diff --git a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.wgsl b/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.wgsl deleted file mode 100644 index 714304fa1e..0000000000 --- a/test/tint/builtins/gen/pack2x16float/0e97b3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn pack2x16float_0e97b3() { - var res : u32 = pack2x16float(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack2x16float_0e97b3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack2x16float_0e97b3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack2x16float_0e97b3(); -} diff --git a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl b/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl deleted file mode 100644 index 24346b79e2..0000000000 --- a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn pack2x16snorm(vec2) -> u32 -fn pack2x16snorm_6c169b() { - var res: u32 = pack2x16snorm(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack2x16snorm_6c169b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack2x16snorm_6c169b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack2x16snorm_6c169b(); -} diff --git a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.glsl b/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.glsl deleted file mode 100644 index 5d698a87de..0000000000 --- a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void pack2x16snorm_6c169b() { - uint res = packSnorm2x16(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - pack2x16snorm_6c169b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void pack2x16snorm_6c169b() { - uint res = packSnorm2x16(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - pack2x16snorm_6c169b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void pack2x16snorm_6c169b() { - uint res = packSnorm2x16(vec2(0.0f, 0.0f)); -} - -void compute_main() { - pack2x16snorm_6c169b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.hlsl b/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.hlsl deleted file mode 100644 index 9a8348f251..0000000000 --- a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -uint tint_pack2x16snorm(float2 param_0) { - int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff; - return asuint(i.x | i.y << 16); -} - -void pack2x16snorm_6c169b() { - uint res = tint_pack2x16snorm(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - pack2x16snorm_6c169b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - pack2x16snorm_6c169b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - pack2x16snorm_6c169b(); - return; -} diff --git a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.msl b/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.msl deleted file mode 100644 index 21fed1a521..0000000000 --- a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void pack2x16snorm_6c169b() { - uint res = pack_float_to_snorm2x16(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - pack2x16snorm_6c169b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - pack2x16snorm_6c169b(); - return; -} - -kernel void compute_main() { - pack2x16snorm_6c169b(); - return; -} - diff --git a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.wgsl b/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.wgsl deleted file mode 100644 index 9ccbc2f29f..0000000000 --- a/test/tint/builtins/gen/pack2x16snorm/6c169b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn pack2x16snorm_6c169b() { - var res : u32 = pack2x16snorm(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack2x16snorm_6c169b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack2x16snorm_6c169b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack2x16snorm_6c169b(); -} diff --git a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl b/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl deleted file mode 100644 index 037c11b5fb..0000000000 --- a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn pack2x16unorm(vec2) -> u32 -fn pack2x16unorm_0f08e4() { - var res: u32 = pack2x16unorm(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack2x16unorm_0f08e4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack2x16unorm_0f08e4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack2x16unorm_0f08e4(); -} diff --git a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.glsl b/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.glsl deleted file mode 100644 index 3abc72e984..0000000000 --- a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void pack2x16unorm_0f08e4() { - uint res = packUnorm2x16(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - pack2x16unorm_0f08e4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void pack2x16unorm_0f08e4() { - uint res = packUnorm2x16(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - pack2x16unorm_0f08e4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void pack2x16unorm_0f08e4() { - uint res = packUnorm2x16(vec2(0.0f, 0.0f)); -} - -void compute_main() { - pack2x16unorm_0f08e4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.hlsl b/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.hlsl deleted file mode 100644 index 51432db04e..0000000000 --- a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -uint tint_pack2x16unorm(float2 param_0) { - uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0)); - return (i.x | i.y << 16); -} - -void pack2x16unorm_0f08e4() { - uint res = tint_pack2x16unorm(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - pack2x16unorm_0f08e4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - pack2x16unorm_0f08e4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - pack2x16unorm_0f08e4(); - return; -} diff --git a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.msl b/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.msl deleted file mode 100644 index f095a39852..0000000000 --- a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void pack2x16unorm_0f08e4() { - uint res = pack_float_to_unorm2x16(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - pack2x16unorm_0f08e4(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - pack2x16unorm_0f08e4(); - return; -} - -kernel void compute_main() { - pack2x16unorm_0f08e4(); - return; -} - diff --git a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.wgsl b/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.wgsl deleted file mode 100644 index d523070e3a..0000000000 --- a/test/tint/builtins/gen/pack2x16unorm/0f08e4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn pack2x16unorm_0f08e4() { - var res : u32 = pack2x16unorm(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack2x16unorm_0f08e4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack2x16unorm_0f08e4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack2x16unorm_0f08e4(); -} diff --git a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl b/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl deleted file mode 100644 index 681af1d4f4..0000000000 --- a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn pack4x8snorm(vec4) -> u32 -fn pack4x8snorm_4d22e7() { - var res: u32 = pack4x8snorm(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack4x8snorm_4d22e7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack4x8snorm_4d22e7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack4x8snorm_4d22e7(); -} diff --git a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.glsl b/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.glsl deleted file mode 100644 index 8b73e70bd8..0000000000 --- a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void pack4x8snorm_4d22e7() { - uint res = packSnorm4x8(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - pack4x8snorm_4d22e7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void pack4x8snorm_4d22e7() { - uint res = packSnorm4x8(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - pack4x8snorm_4d22e7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void pack4x8snorm_4d22e7() { - uint res = packSnorm4x8(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - pack4x8snorm_4d22e7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.hlsl b/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.hlsl deleted file mode 100644 index b543993dbc..0000000000 --- a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -uint tint_pack4x8snorm(float4 param_0) { - int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff; - return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24); -} - -void pack4x8snorm_4d22e7() { - uint res = tint_pack4x8snorm(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - pack4x8snorm_4d22e7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - pack4x8snorm_4d22e7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - pack4x8snorm_4d22e7(); - return; -} diff --git a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.msl b/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.msl deleted file mode 100644 index a38de4d286..0000000000 --- a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void pack4x8snorm_4d22e7() { - uint res = pack_float_to_snorm4x8(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - pack4x8snorm_4d22e7(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - pack4x8snorm_4d22e7(); - return; -} - -kernel void compute_main() { - pack4x8snorm_4d22e7(); - return; -} - diff --git a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.wgsl b/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.wgsl deleted file mode 100644 index 53657e09d3..0000000000 --- a/test/tint/builtins/gen/pack4x8snorm/4d22e7.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn pack4x8snorm_4d22e7() { - var res : u32 = pack4x8snorm(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack4x8snorm_4d22e7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack4x8snorm_4d22e7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack4x8snorm_4d22e7(); -} diff --git a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl b/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl deleted file mode 100644 index ae25428f67..0000000000 --- a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn pack4x8unorm(vec4) -> u32 -fn pack4x8unorm_95c456() { - var res: u32 = pack4x8unorm(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack4x8unorm_95c456(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack4x8unorm_95c456(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack4x8unorm_95c456(); -} diff --git a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.glsl b/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.glsl deleted file mode 100644 index 59490d93c1..0000000000 --- a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void pack4x8unorm_95c456() { - uint res = packUnorm4x8(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - pack4x8unorm_95c456(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void pack4x8unorm_95c456() { - uint res = packUnorm4x8(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - pack4x8unorm_95c456(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void pack4x8unorm_95c456() { - uint res = packUnorm4x8(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - pack4x8unorm_95c456(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.hlsl b/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.hlsl deleted file mode 100644 index f36575744a..0000000000 --- a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -uint tint_pack4x8unorm(float4 param_0) { - uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); - return (i.x | i.y << 8 | i.z << 16 | i.w << 24); -} - -void pack4x8unorm_95c456() { - uint res = tint_pack4x8unorm(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - pack4x8unorm_95c456(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - pack4x8unorm_95c456(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - pack4x8unorm_95c456(); - return; -} diff --git a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.msl b/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.msl deleted file mode 100644 index 55732e1f8d..0000000000 --- a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void pack4x8unorm_95c456() { - uint res = pack_float_to_unorm4x8(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - pack4x8unorm_95c456(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - pack4x8unorm_95c456(); - return; -} - -kernel void compute_main() { - pack4x8unorm_95c456(); - return; -} - diff --git a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.wgsl b/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.wgsl deleted file mode 100644 index 55aedf3f62..0000000000 --- a/test/tint/builtins/gen/pack4x8unorm/95c456.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn pack4x8unorm_95c456() { - var res : u32 = pack4x8unorm(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pack4x8unorm_95c456(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pack4x8unorm_95c456(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pack4x8unorm_95c456(); -} diff --git a/test/tint/builtins/gen/pow/04a908.wgsl b/test/tint/builtins/gen/pow/04a908.wgsl deleted file mode 100644 index b195279684..0000000000 --- a/test/tint/builtins/gen/pow/04a908.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn pow(vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn pow_04a908() { - var res: vec4 = pow(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pow_04a908(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pow_04a908(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pow_04a908(); -} diff --git a/test/tint/builtins/gen/pow/04a908.wgsl.expected.glsl b/test/tint/builtins/gen/pow/04a908.wgsl.expected.glsl deleted file mode 100644 index 9132761e0d..0000000000 --- a/test/tint/builtins/gen/pow/04a908.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void pow_04a908() { - vec4 res = pow(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - pow_04a908(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void pow_04a908() { - vec4 res = pow(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - pow_04a908(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void pow_04a908() { - vec4 res = pow(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - pow_04a908(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/pow/04a908.wgsl.expected.hlsl b/test/tint/builtins/gen/pow/04a908.wgsl.expected.hlsl deleted file mode 100644 index bd4e176bbf..0000000000 --- a/test/tint/builtins/gen/pow/04a908.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void pow_04a908() { - float4 res = pow(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - pow_04a908(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - pow_04a908(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - pow_04a908(); - return; -} diff --git a/test/tint/builtins/gen/pow/04a908.wgsl.expected.msl b/test/tint/builtins/gen/pow/04a908.wgsl.expected.msl deleted file mode 100644 index e1f2e81684..0000000000 --- a/test/tint/builtins/gen/pow/04a908.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void pow_04a908() { - float4 res = pow(float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - pow_04a908(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - pow_04a908(); - return; -} - -kernel void compute_main() { - pow_04a908(); - return; -} - diff --git a/test/tint/builtins/gen/pow/04a908.wgsl.expected.spvasm b/test/tint/builtins/gen/pow/04a908.wgsl.expected.spvasm deleted file mode 100644 index 200e5e4b2d..0000000000 --- a/test/tint/builtins/gen/pow/04a908.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %pow_04a908 "pow_04a908" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %pow_04a908 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Pow %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %pow_04a908 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %pow_04a908 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %pow_04a908 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/pow/04a908.wgsl.expected.wgsl b/test/tint/builtins/gen/pow/04a908.wgsl.expected.wgsl deleted file mode 100644 index 395fe26772..0000000000 --- a/test/tint/builtins/gen/pow/04a908.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn pow_04a908() { - var res : vec4 = pow(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pow_04a908(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pow_04a908(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pow_04a908(); -} diff --git a/test/tint/builtins/gen/pow/46e029.wgsl b/test/tint/builtins/gen/pow/46e029.wgsl deleted file mode 100644 index fbe76121be..0000000000 --- a/test/tint/builtins/gen/pow/46e029.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn pow(f32, f32) -> f32 -fn pow_46e029() { - var res: f32 = pow(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pow_46e029(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pow_46e029(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pow_46e029(); -} diff --git a/test/tint/builtins/gen/pow/46e029.wgsl.expected.glsl b/test/tint/builtins/gen/pow/46e029.wgsl.expected.glsl deleted file mode 100644 index 591211647b..0000000000 --- a/test/tint/builtins/gen/pow/46e029.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void pow_46e029() { - float res = pow(1.0f, 1.0f); -} - -vec4 vertex_main() { - pow_46e029(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void pow_46e029() { - float res = pow(1.0f, 1.0f); -} - -void fragment_main() { - pow_46e029(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void pow_46e029() { - float res = pow(1.0f, 1.0f); -} - -void compute_main() { - pow_46e029(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/pow/46e029.wgsl.expected.hlsl b/test/tint/builtins/gen/pow/46e029.wgsl.expected.hlsl deleted file mode 100644 index 85b5ee06af..0000000000 --- a/test/tint/builtins/gen/pow/46e029.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void pow_46e029() { - float res = pow(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - pow_46e029(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - pow_46e029(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - pow_46e029(); - return; -} diff --git a/test/tint/builtins/gen/pow/46e029.wgsl.expected.msl b/test/tint/builtins/gen/pow/46e029.wgsl.expected.msl deleted file mode 100644 index c2d8df388b..0000000000 --- a/test/tint/builtins/gen/pow/46e029.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void pow_46e029() { - float res = pow(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - pow_46e029(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - pow_46e029(); - return; -} - -kernel void compute_main() { - pow_46e029(); - return; -} - diff --git a/test/tint/builtins/gen/pow/46e029.wgsl.expected.wgsl b/test/tint/builtins/gen/pow/46e029.wgsl.expected.wgsl deleted file mode 100644 index 167072001a..0000000000 --- a/test/tint/builtins/gen/pow/46e029.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn pow_46e029() { - var res : f32 = pow(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pow_46e029(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pow_46e029(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pow_46e029(); -} diff --git a/test/tint/builtins/gen/pow/4a46c9.wgsl b/test/tint/builtins/gen/pow/4a46c9.wgsl deleted file mode 100644 index c8293dfd2c..0000000000 --- a/test/tint/builtins/gen/pow/4a46c9.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn pow(vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn pow_4a46c9() { - var res: vec3 = pow(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pow_4a46c9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pow_4a46c9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pow_4a46c9(); -} diff --git a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.glsl b/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.glsl deleted file mode 100644 index a283236d83..0000000000 --- a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void pow_4a46c9() { - vec3 res = pow(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - pow_4a46c9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void pow_4a46c9() { - vec3 res = pow(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - pow_4a46c9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void pow_4a46c9() { - vec3 res = pow(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - pow_4a46c9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.hlsl b/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.hlsl deleted file mode 100644 index 2136c74395..0000000000 --- a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void pow_4a46c9() { - float3 res = pow(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - pow_4a46c9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - pow_4a46c9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - pow_4a46c9(); - return; -} diff --git a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.msl b/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.msl deleted file mode 100644 index 69a27253c5..0000000000 --- a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void pow_4a46c9() { - float3 res = pow(float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - pow_4a46c9(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - pow_4a46c9(); - return; -} - -kernel void compute_main() { - pow_4a46c9(); - return; -} - diff --git a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.spvasm b/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.spvasm deleted file mode 100644 index e6adbfe194..0000000000 --- a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %pow_4a46c9 "pow_4a46c9" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %pow_4a46c9 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Pow %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %pow_4a46c9 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %pow_4a46c9 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %pow_4a46c9 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.wgsl b/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.wgsl deleted file mode 100644 index 4a6f3f9e92..0000000000 --- a/test/tint/builtins/gen/pow/4a46c9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn pow_4a46c9() { - var res : vec3 = pow(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pow_4a46c9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pow_4a46c9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pow_4a46c9(); -} diff --git a/test/tint/builtins/gen/pow/e60ea5.wgsl b/test/tint/builtins/gen/pow/e60ea5.wgsl deleted file mode 100644 index f718b1e96b..0000000000 --- a/test/tint/builtins/gen/pow/e60ea5.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn pow(vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn pow_e60ea5() { - var res: vec2 = pow(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pow_e60ea5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pow_e60ea5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pow_e60ea5(); -} diff --git a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.glsl b/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.glsl deleted file mode 100644 index 449f99b6c6..0000000000 --- a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void pow_e60ea5() { - vec2 res = pow(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - pow_e60ea5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void pow_e60ea5() { - vec2 res = pow(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - pow_e60ea5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void pow_e60ea5() { - vec2 res = pow(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - pow_e60ea5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.hlsl b/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.hlsl deleted file mode 100644 index 467efc393f..0000000000 --- a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void pow_e60ea5() { - float2 res = pow(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - pow_e60ea5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - pow_e60ea5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - pow_e60ea5(); - return; -} diff --git a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.msl b/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.msl deleted file mode 100644 index 4326466f97..0000000000 --- a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void pow_e60ea5() { - float2 res = pow(float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - pow_e60ea5(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - pow_e60ea5(); - return; -} - -kernel void compute_main() { - pow_e60ea5(); - return; -} - diff --git a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.spvasm b/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.spvasm deleted file mode 100644 index 52c3db126b..0000000000 --- a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %pow_e60ea5 "pow_e60ea5" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %pow_e60ea5 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Pow %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %pow_e60ea5 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %pow_e60ea5 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %pow_e60ea5 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.wgsl b/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.wgsl deleted file mode 100644 index 0c6432ec58..0000000000 --- a/test/tint/builtins/gen/pow/e60ea5.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn pow_e60ea5() { - var res : vec2 = pow(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - pow_e60ea5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - pow_e60ea5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - pow_e60ea5(); -} diff --git a/test/tint/builtins/gen/radians/09b7fc.wgsl b/test/tint/builtins/gen/radians/09b7fc.wgsl deleted file mode 100644 index 96d745ebbe..0000000000 --- a/test/tint/builtins/gen/radians/09b7fc.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn radians(vec<4, f32>) -> vec<4, f32> -fn radians_09b7fc() { - var res: vec4 = radians(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - radians_09b7fc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - radians_09b7fc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - radians_09b7fc(); -} diff --git a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.glsl b/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.glsl deleted file mode 100644 index 5f7274d28d..0000000000 --- a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.glsl +++ /dev/null @@ -1,64 +0,0 @@ -#version 310 es - -vec4 tint_radians(vec4 param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_09b7fc() { - vec4 res = tint_radians(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - radians_09b7fc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -vec4 tint_radians(vec4 param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_09b7fc() { - vec4 res = tint_radians(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - radians_09b7fc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -vec4 tint_radians(vec4 param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_09b7fc() { - vec4 res = tint_radians(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - radians_09b7fc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.hlsl b/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.hlsl deleted file mode 100644 index 5aa2661f43..0000000000 --- a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -float4 tint_radians(float4 param_0) { - return param_0 * 0.017453292519943295474; -} - -void radians_09b7fc() { - float4 res = tint_radians(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - radians_09b7fc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - radians_09b7fc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - radians_09b7fc(); - return; -} diff --git a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.msl b/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.msl deleted file mode 100644 index 00e73d18f5..0000000000 --- a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -float4 tint_radians(float4 param_0) { - return param_0 * 0.017453292519943295474; -} - -void radians_09b7fc() { - float4 res = tint_radians(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - radians_09b7fc(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - radians_09b7fc(); - return; -} - -kernel void compute_main() { - radians_09b7fc(); - return; -} - diff --git a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.spvasm b/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.spvasm deleted file mode 100644 index e2f2f99fc9..0000000000 --- a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %radians_09b7fc "radians_09b7fc" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%radians_09b7fc = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Radians %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %radians_09b7fc - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %radians_09b7fc - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %radians_09b7fc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.wgsl b/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.wgsl deleted file mode 100644 index e8efa0ef7b..0000000000 --- a/test/tint/builtins/gen/radians/09b7fc.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn radians_09b7fc() { - var res : vec4 = radians(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - radians_09b7fc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - radians_09b7fc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - radians_09b7fc(); -} diff --git a/test/tint/builtins/gen/radians/61687a.wgsl b/test/tint/builtins/gen/radians/61687a.wgsl deleted file mode 100644 index f5f8a32977..0000000000 --- a/test/tint/builtins/gen/radians/61687a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn radians(vec<2, f32>) -> vec<2, f32> -fn radians_61687a() { - var res: vec2 = radians(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - radians_61687a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - radians_61687a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - radians_61687a(); -} diff --git a/test/tint/builtins/gen/radians/61687a.wgsl.expected.glsl b/test/tint/builtins/gen/radians/61687a.wgsl.expected.glsl deleted file mode 100644 index 48455ad9fe..0000000000 --- a/test/tint/builtins/gen/radians/61687a.wgsl.expected.glsl +++ /dev/null @@ -1,64 +0,0 @@ -#version 310 es - -vec2 tint_radians(vec2 param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_61687a() { - vec2 res = tint_radians(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - radians_61687a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -vec2 tint_radians(vec2 param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_61687a() { - vec2 res = tint_radians(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - radians_61687a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -vec2 tint_radians(vec2 param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_61687a() { - vec2 res = tint_radians(vec2(0.0f, 0.0f)); -} - -void compute_main() { - radians_61687a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/radians/61687a.wgsl.expected.hlsl b/test/tint/builtins/gen/radians/61687a.wgsl.expected.hlsl deleted file mode 100644 index 6ff5488c19..0000000000 --- a/test/tint/builtins/gen/radians/61687a.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -float2 tint_radians(float2 param_0) { - return param_0 * 0.017453292519943295474; -} - -void radians_61687a() { - float2 res = tint_radians(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - radians_61687a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - radians_61687a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - radians_61687a(); - return; -} diff --git a/test/tint/builtins/gen/radians/61687a.wgsl.expected.msl b/test/tint/builtins/gen/radians/61687a.wgsl.expected.msl deleted file mode 100644 index 7a7e7e4f7a..0000000000 --- a/test/tint/builtins/gen/radians/61687a.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -float2 tint_radians(float2 param_0) { - return param_0 * 0.017453292519943295474; -} - -void radians_61687a() { - float2 res = tint_radians(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - radians_61687a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - radians_61687a(); - return; -} - -kernel void compute_main() { - radians_61687a(); - return; -} - diff --git a/test/tint/builtins/gen/radians/61687a.wgsl.expected.spvasm b/test/tint/builtins/gen/radians/61687a.wgsl.expected.spvasm deleted file mode 100644 index b5dc84d32a..0000000000 --- a/test/tint/builtins/gen/radians/61687a.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %radians_61687a "radians_61687a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%radians_61687a = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Radians %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %radians_61687a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %radians_61687a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %radians_61687a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/radians/61687a.wgsl.expected.wgsl b/test/tint/builtins/gen/radians/61687a.wgsl.expected.wgsl deleted file mode 100644 index 310425f1b1..0000000000 --- a/test/tint/builtins/gen/radians/61687a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn radians_61687a() { - var res : vec2 = radians(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - radians_61687a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - radians_61687a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - radians_61687a(); -} diff --git a/test/tint/builtins/gen/radians/6b0ff2.wgsl b/test/tint/builtins/gen/radians/6b0ff2.wgsl deleted file mode 100644 index 859ff69687..0000000000 --- a/test/tint/builtins/gen/radians/6b0ff2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn radians(f32) -> f32 -fn radians_6b0ff2() { - var res: f32 = radians(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - radians_6b0ff2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - radians_6b0ff2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - radians_6b0ff2(); -} diff --git a/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.glsl b/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.glsl deleted file mode 100644 index 5cef3b76fd..0000000000 --- a/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.glsl +++ /dev/null @@ -1,64 +0,0 @@ -#version 310 es - -float tint_radians(float param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_6b0ff2() { - float res = tint_radians(1.0f); -} - -vec4 vertex_main() { - radians_6b0ff2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -float tint_radians(float param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_6b0ff2() { - float res = tint_radians(1.0f); -} - -void fragment_main() { - radians_6b0ff2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -float tint_radians(float param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_6b0ff2() { - float res = tint_radians(1.0f); -} - -void compute_main() { - radians_6b0ff2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.hlsl b/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.hlsl deleted file mode 100644 index 561548982e..0000000000 --- a/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -float tint_radians(float param_0) { - return param_0 * 0.017453292519943295474; -} - -void radians_6b0ff2() { - float res = tint_radians(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - radians_6b0ff2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - radians_6b0ff2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - radians_6b0ff2(); - return; -} diff --git a/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.msl b/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.msl deleted file mode 100644 index e99ae97e94..0000000000 --- a/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -float tint_radians(float param_0) { - return param_0 * 0.017453292519943295474; -} - -void radians_6b0ff2() { - float res = tint_radians(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - radians_6b0ff2(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - radians_6b0ff2(); - return; -} - -kernel void compute_main() { - radians_6b0ff2(); - return; -} - diff --git a/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.wgsl b/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.wgsl deleted file mode 100644 index 05a6fb5bdd..0000000000 --- a/test/tint/builtins/gen/radians/6b0ff2.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn radians_6b0ff2() { - var res : f32 = radians(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - radians_6b0ff2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - radians_6b0ff2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - radians_6b0ff2(); -} diff --git a/test/tint/builtins/gen/radians/f96258.wgsl b/test/tint/builtins/gen/radians/f96258.wgsl deleted file mode 100644 index 0e86d0e856..0000000000 --- a/test/tint/builtins/gen/radians/f96258.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn radians(vec<3, f32>) -> vec<3, f32> -fn radians_f96258() { - var res: vec3 = radians(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - radians_f96258(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - radians_f96258(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - radians_f96258(); -} diff --git a/test/tint/builtins/gen/radians/f96258.wgsl.expected.glsl b/test/tint/builtins/gen/radians/f96258.wgsl.expected.glsl deleted file mode 100644 index 244f6e0b8a..0000000000 --- a/test/tint/builtins/gen/radians/f96258.wgsl.expected.glsl +++ /dev/null @@ -1,64 +0,0 @@ -#version 310 es - -vec3 tint_radians(vec3 param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_f96258() { - vec3 res = tint_radians(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - radians_f96258(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -vec3 tint_radians(vec3 param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_f96258() { - vec3 res = tint_radians(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - radians_f96258(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -vec3 tint_radians(vec3 param_0) { - return param_0 * 0.017453292519943295474; -} - - -void radians_f96258() { - vec3 res = tint_radians(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - radians_f96258(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/radians/f96258.wgsl.expected.hlsl b/test/tint/builtins/gen/radians/f96258.wgsl.expected.hlsl deleted file mode 100644 index 21df423140..0000000000 --- a/test/tint/builtins/gen/radians/f96258.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -float3 tint_radians(float3 param_0) { - return param_0 * 0.017453292519943295474; -} - -void radians_f96258() { - float3 res = tint_radians(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - radians_f96258(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - radians_f96258(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - radians_f96258(); - return; -} diff --git a/test/tint/builtins/gen/radians/f96258.wgsl.expected.msl b/test/tint/builtins/gen/radians/f96258.wgsl.expected.msl deleted file mode 100644 index 1667cdb901..0000000000 --- a/test/tint/builtins/gen/radians/f96258.wgsl.expected.msl +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace metal; - -float3 tint_radians(float3 param_0) { - return param_0 * 0.017453292519943295474; -} - -void radians_f96258() { - float3 res = tint_radians(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - radians_f96258(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - radians_f96258(); - return; -} - -kernel void compute_main() { - radians_f96258(); - return; -} - diff --git a/test/tint/builtins/gen/radians/f96258.wgsl.expected.spvasm b/test/tint/builtins/gen/radians/f96258.wgsl.expected.spvasm deleted file mode 100644 index 277f09e387..0000000000 --- a/test/tint/builtins/gen/radians/f96258.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %radians_f96258 "radians_f96258" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%radians_f96258 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Radians %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %radians_f96258 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %radians_f96258 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %radians_f96258 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/radians/f96258.wgsl.expected.wgsl b/test/tint/builtins/gen/radians/f96258.wgsl.expected.wgsl deleted file mode 100644 index c38fe31106..0000000000 --- a/test/tint/builtins/gen/radians/f96258.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn radians_f96258() { - var res : vec3 = radians(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - radians_f96258(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - radians_f96258(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - radians_f96258(); -} diff --git a/test/tint/builtins/gen/reflect/05357e.wgsl b/test/tint/builtins/gen/reflect/05357e.wgsl deleted file mode 100644 index ef948954e0..0000000000 --- a/test/tint/builtins/gen/reflect/05357e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reflect(vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn reflect_05357e() { - var res: vec4 = reflect(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reflect_05357e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reflect_05357e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reflect_05357e(); -} diff --git a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.glsl b/test/tint/builtins/gen/reflect/05357e.wgsl.expected.glsl deleted file mode 100644 index ca0f0f56f2..0000000000 --- a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reflect_05357e() { - vec4 res = reflect(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - reflect_05357e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reflect_05357e() { - vec4 res = reflect(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - reflect_05357e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reflect_05357e() { - vec4 res = reflect(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - reflect_05357e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.hlsl b/test/tint/builtins/gen/reflect/05357e.wgsl.expected.hlsl deleted file mode 100644 index ffa296cacf..0000000000 --- a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reflect_05357e() { - float4 res = reflect(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reflect_05357e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reflect_05357e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reflect_05357e(); - return; -} diff --git a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.msl b/test/tint/builtins/gen/reflect/05357e.wgsl.expected.msl deleted file mode 100644 index 83ddfd9a4a..0000000000 --- a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reflect_05357e() { - float4 res = reflect(float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reflect_05357e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reflect_05357e(); - return; -} - -kernel void compute_main() { - reflect_05357e(); - return; -} - diff --git a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.spvasm b/test/tint/builtins/gen/reflect/05357e.wgsl.expected.spvasm deleted file mode 100644 index e3fc18da98..0000000000 --- a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %reflect_05357e "reflect_05357e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%reflect_05357e = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Reflect %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %reflect_05357e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %reflect_05357e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %reflect_05357e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.wgsl b/test/tint/builtins/gen/reflect/05357e.wgsl.expected.wgsl deleted file mode 100644 index ba4f95a1d5..0000000000 --- a/test/tint/builtins/gen/reflect/05357e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reflect_05357e() { - var res : vec4 = reflect(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reflect_05357e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reflect_05357e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reflect_05357e(); -} diff --git a/test/tint/builtins/gen/reflect/b61e10.wgsl b/test/tint/builtins/gen/reflect/b61e10.wgsl deleted file mode 100644 index 47cd039a3b..0000000000 --- a/test/tint/builtins/gen/reflect/b61e10.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reflect(vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn reflect_b61e10() { - var res: vec2 = reflect(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reflect_b61e10(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reflect_b61e10(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reflect_b61e10(); -} diff --git a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.glsl b/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.glsl deleted file mode 100644 index 1dd1985927..0000000000 --- a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reflect_b61e10() { - vec2 res = reflect(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - reflect_b61e10(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reflect_b61e10() { - vec2 res = reflect(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - reflect_b61e10(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reflect_b61e10() { - vec2 res = reflect(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - reflect_b61e10(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.hlsl b/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.hlsl deleted file mode 100644 index 0fae655845..0000000000 --- a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reflect_b61e10() { - float2 res = reflect(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reflect_b61e10(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reflect_b61e10(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reflect_b61e10(); - return; -} diff --git a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.msl b/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.msl deleted file mode 100644 index 8f70c6d5f0..0000000000 --- a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reflect_b61e10() { - float2 res = reflect(float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reflect_b61e10(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reflect_b61e10(); - return; -} - -kernel void compute_main() { - reflect_b61e10(); - return; -} - diff --git a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.spvasm b/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.spvasm deleted file mode 100644 index 24a2c10fb5..0000000000 --- a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %reflect_b61e10 "reflect_b61e10" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%reflect_b61e10 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Reflect %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %reflect_b61e10 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %reflect_b61e10 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %reflect_b61e10 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.wgsl b/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.wgsl deleted file mode 100644 index 330eead42a..0000000000 --- a/test/tint/builtins/gen/reflect/b61e10.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reflect_b61e10() { - var res : vec2 = reflect(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reflect_b61e10(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reflect_b61e10(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reflect_b61e10(); -} diff --git a/test/tint/builtins/gen/reflect/f47fdb.wgsl b/test/tint/builtins/gen/reflect/f47fdb.wgsl deleted file mode 100644 index 5bbf74c0e8..0000000000 --- a/test/tint/builtins/gen/reflect/f47fdb.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reflect(vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn reflect_f47fdb() { - var res: vec3 = reflect(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reflect_f47fdb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reflect_f47fdb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reflect_f47fdb(); -} diff --git a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.glsl b/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.glsl deleted file mode 100644 index e507fe8df8..0000000000 --- a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reflect_f47fdb() { - vec3 res = reflect(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - reflect_f47fdb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reflect_f47fdb() { - vec3 res = reflect(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - reflect_f47fdb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reflect_f47fdb() { - vec3 res = reflect(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - reflect_f47fdb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.hlsl b/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.hlsl deleted file mode 100644 index 6cb1cea08a..0000000000 --- a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reflect_f47fdb() { - float3 res = reflect(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reflect_f47fdb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reflect_f47fdb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reflect_f47fdb(); - return; -} diff --git a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.msl b/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.msl deleted file mode 100644 index c3d161418b..0000000000 --- a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reflect_f47fdb() { - float3 res = reflect(float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reflect_f47fdb(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reflect_f47fdb(); - return; -} - -kernel void compute_main() { - reflect_f47fdb(); - return; -} - diff --git a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.spvasm deleted file mode 100644 index b8ce4f78ec..0000000000 --- a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %reflect_f47fdb "reflect_f47fdb" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%reflect_f47fdb = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Reflect %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %reflect_f47fdb - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %reflect_f47fdb - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %reflect_f47fdb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.wgsl deleted file mode 100644 index d66212f725..0000000000 --- a/test/tint/builtins/gen/reflect/f47fdb.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reflect_f47fdb() { - var res : vec3 = reflect(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reflect_f47fdb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reflect_f47fdb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reflect_f47fdb(); -} diff --git a/test/tint/builtins/gen/refract/7e02e6.wgsl b/test/tint/builtins/gen/refract/7e02e6.wgsl deleted file mode 100644 index 1a2e7e4df4..0000000000 --- a/test/tint/builtins/gen/refract/7e02e6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn refract(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32> -fn refract_7e02e6() { - var res: vec4 = refract(vec4(), vec4(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - refract_7e02e6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - refract_7e02e6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - refract_7e02e6(); -} diff --git a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.glsl b/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.glsl deleted file mode 100644 index 725490e702..0000000000 --- a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void refract_7e02e6() { - vec4 res = refract(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - refract_7e02e6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void refract_7e02e6() { - vec4 res = refract(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - refract_7e02e6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void refract_7e02e6() { - vec4 res = refract(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), 1.0f); -} - -void compute_main() { - refract_7e02e6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.hlsl b/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.hlsl deleted file mode 100644 index 98105d423e..0000000000 --- a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void refract_7e02e6() { - float4 res = refract(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - refract_7e02e6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - refract_7e02e6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - refract_7e02e6(); - return; -} diff --git a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.msl b/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.msl deleted file mode 100644 index 9fedc200aa..0000000000 --- a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void refract_7e02e6() { - float4 res = refract(float4(), float4(), 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - refract_7e02e6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - refract_7e02e6(); - return; -} - -kernel void compute_main() { - refract_7e02e6(); - return; -} - diff --git a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.spvasm b/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.spvasm deleted file mode 100644 index d3a15d72c4..0000000000 --- a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %refract_7e02e6 "refract_7e02e6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %18 = OpTypeFunction %v4float -%refract_7e02e6 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Refract %5 %5 %float_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %refract_7e02e6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %refract_7e02e6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %refract_7e02e6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.wgsl b/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.wgsl deleted file mode 100644 index 3950912616..0000000000 --- a/test/tint/builtins/gen/refract/7e02e6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn refract_7e02e6() { - var res : vec4 = refract(vec4(), vec4(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - refract_7e02e6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - refract_7e02e6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - refract_7e02e6(); -} diff --git a/test/tint/builtins/gen/refract/cbc1d2.wgsl b/test/tint/builtins/gen/refract/cbc1d2.wgsl deleted file mode 100644 index f34e7cd82c..0000000000 --- a/test/tint/builtins/gen/refract/cbc1d2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn refract(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32> -fn refract_cbc1d2() { - var res: vec3 = refract(vec3(), vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - refract_cbc1d2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - refract_cbc1d2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - refract_cbc1d2(); -} diff --git a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.glsl b/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.glsl deleted file mode 100644 index 41b9ad9e86..0000000000 --- a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void refract_cbc1d2() { - vec3 res = refract(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - refract_cbc1d2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void refract_cbc1d2() { - vec3 res = refract(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - refract_cbc1d2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void refract_cbc1d2() { - vec3 res = refract(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void compute_main() { - refract_cbc1d2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.hlsl b/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.hlsl deleted file mode 100644 index a3ef1642fb..0000000000 --- a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void refract_cbc1d2() { - float3 res = refract(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - refract_cbc1d2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - refract_cbc1d2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - refract_cbc1d2(); - return; -} diff --git a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.msl b/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.msl deleted file mode 100644 index ceb3738cba..0000000000 --- a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void refract_cbc1d2() { - float3 res = refract(float3(), float3(), 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - refract_cbc1d2(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - refract_cbc1d2(); - return; -} - -kernel void compute_main() { - refract_cbc1d2(); - return; -} - diff --git a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.spvasm b/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.spvasm deleted file mode 100644 index de16a55649..0000000000 --- a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %refract_cbc1d2 "refract_cbc1d2" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float - %float_1 = OpConstant %float 1 -%_ptr_Function_v3float = OpTypePointer Function %v3float - %20 = OpTypeFunction %v4float -%refract_cbc1d2 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Refract %16 %16 %float_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %refract_cbc1d2 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %refract_cbc1d2 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %refract_cbc1d2 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.wgsl b/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.wgsl deleted file mode 100644 index 535c2791e5..0000000000 --- a/test/tint/builtins/gen/refract/cbc1d2.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn refract_cbc1d2() { - var res : vec3 = refract(vec3(), vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - refract_cbc1d2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - refract_cbc1d2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - refract_cbc1d2(); -} diff --git a/test/tint/builtins/gen/refract/cd905f.wgsl b/test/tint/builtins/gen/refract/cd905f.wgsl deleted file mode 100644 index d5338347be..0000000000 --- a/test/tint/builtins/gen/refract/cd905f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn refract(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32> -fn refract_cd905f() { - var res: vec2 = refract(vec2(), vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - refract_cd905f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - refract_cd905f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - refract_cd905f(); -} diff --git a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.glsl b/test/tint/builtins/gen/refract/cd905f.wgsl.expected.glsl deleted file mode 100644 index b614853776..0000000000 --- a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void refract_cd905f() { - vec2 res = refract(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - refract_cd905f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void refract_cd905f() { - vec2 res = refract(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - refract_cd905f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void refract_cd905f() { - vec2 res = refract(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), 1.0f); -} - -void compute_main() { - refract_cd905f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.hlsl b/test/tint/builtins/gen/refract/cd905f.wgsl.expected.hlsl deleted file mode 100644 index 075d4c6dc4..0000000000 --- a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void refract_cd905f() { - float2 res = refract(float2(0.0f, 0.0f), float2(0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - refract_cd905f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - refract_cd905f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - refract_cd905f(); - return; -} diff --git a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.msl b/test/tint/builtins/gen/refract/cd905f.wgsl.expected.msl deleted file mode 100644 index 878c80c078..0000000000 --- a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void refract_cd905f() { - float2 res = refract(float2(), float2(), 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - refract_cd905f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - refract_cd905f(); - return; -} - -kernel void compute_main() { - refract_cd905f(); - return; -} - diff --git a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.spvasm b/test/tint/builtins/gen/refract/cd905f.wgsl.expected.spvasm deleted file mode 100644 index 76d7a59fd8..0000000000 --- a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %refract_cd905f "refract_cd905f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 -%_ptr_Function_v2float = OpTypePointer Function %v2float - %20 = OpTypeFunction %v4float -%refract_cd905f = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Refract %16 %16 %float_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %refract_cd905f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %refract_cd905f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %refract_cd905f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.wgsl b/test/tint/builtins/gen/refract/cd905f.wgsl.expected.wgsl deleted file mode 100644 index 485ab60302..0000000000 --- a/test/tint/builtins/gen/refract/cd905f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn refract_cd905f() { - var res : vec2 = refract(vec2(), vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - refract_cd905f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - refract_cd905f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - refract_cd905f(); -} diff --git a/test/tint/builtins/gen/reverseBits/222177.wgsl b/test/tint/builtins/gen/reverseBits/222177.wgsl deleted file mode 100644 index 1224dd9195..0000000000 --- a/test/tint/builtins/gen/reverseBits/222177.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reverseBits(vec<2, i32>) -> vec<2, i32> -fn reverseBits_222177() { - var res: vec2 = reverseBits(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_222177(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_222177(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_222177(); -} diff --git a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.glsl b/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.glsl deleted file mode 100644 index f4e41b6e7c..0000000000 --- a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reverseBits_222177() { - ivec2 res = bitfieldReverse(ivec2(0, 0)); -} - -vec4 vertex_main() { - reverseBits_222177(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reverseBits_222177() { - ivec2 res = bitfieldReverse(ivec2(0, 0)); -} - -void fragment_main() { - reverseBits_222177(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reverseBits_222177() { - ivec2 res = bitfieldReverse(ivec2(0, 0)); -} - -void compute_main() { - reverseBits_222177(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.hlsl b/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.hlsl deleted file mode 100644 index 6ee1cc4cb4..0000000000 --- a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reverseBits_222177() { - int2 res = reversebits(int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reverseBits_222177(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reverseBits_222177(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reverseBits_222177(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.msl b/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.msl deleted file mode 100644 index 410b12017f..0000000000 --- a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reverseBits_222177() { - int2 res = reverse_bits(int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reverseBits_222177(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reverseBits_222177(); - return; -} - -kernel void compute_main() { - reverseBits_222177(); - return; -} - diff --git a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.spvasm b/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.spvasm deleted file mode 100644 index 5f046b0a3b..0000000000 --- a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %reverseBits_222177 "reverseBits_222177" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %16 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%reverseBits_222177 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %16 - %13 = OpBitReverse %v2int %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %reverseBits_222177 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %reverseBits_222177 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %reverseBits_222177 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.wgsl b/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.wgsl deleted file mode 100644 index cd377693db..0000000000 --- a/test/tint/builtins/gen/reverseBits/222177.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reverseBits_222177() { - var res : vec2 = reverseBits(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_222177(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_222177(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_222177(); -} diff --git a/test/tint/builtins/gen/reverseBits/35fea9.wgsl b/test/tint/builtins/gen/reverseBits/35fea9.wgsl deleted file mode 100644 index f62e494bc8..0000000000 --- a/test/tint/builtins/gen/reverseBits/35fea9.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reverseBits(vec<4, u32>) -> vec<4, u32> -fn reverseBits_35fea9() { - var res: vec4 = reverseBits(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_35fea9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_35fea9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_35fea9(); -} diff --git a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.glsl b/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.glsl deleted file mode 100644 index 5d9272ea03..0000000000 --- a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reverseBits_35fea9() { - uvec4 res = bitfieldReverse(uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - reverseBits_35fea9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reverseBits_35fea9() { - uvec4 res = bitfieldReverse(uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - reverseBits_35fea9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reverseBits_35fea9() { - uvec4 res = bitfieldReverse(uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - reverseBits_35fea9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.hlsl b/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.hlsl deleted file mode 100644 index 4923fa2480..0000000000 --- a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reverseBits_35fea9() { - uint4 res = reversebits(uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reverseBits_35fea9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reverseBits_35fea9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reverseBits_35fea9(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.msl b/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.msl deleted file mode 100644 index 7cca1fe44d..0000000000 --- a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reverseBits_35fea9() { - uint4 res = reverse_bits(uint4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reverseBits_35fea9(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reverseBits_35fea9(); - return; -} - -kernel void compute_main() { - reverseBits_35fea9(); - return; -} - diff --git a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.spvasm b/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.spvasm deleted file mode 100644 index 4db3d73fda..0000000000 --- a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %reverseBits_35fea9 "reverseBits_35fea9" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %16 = OpConstantNull %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%reverseBits_35fea9 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %16 - %13 = OpBitReverse %v4uint %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %reverseBits_35fea9 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %reverseBits_35fea9 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %reverseBits_35fea9 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.wgsl b/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.wgsl deleted file mode 100644 index 6fea80dd69..0000000000 --- a/test/tint/builtins/gen/reverseBits/35fea9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reverseBits_35fea9() { - var res : vec4 = reverseBits(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_35fea9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_35fea9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_35fea9(); -} diff --git a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl b/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl deleted file mode 100644 index b48ae4dcfa..0000000000 --- a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reverseBits(vec<4, i32>) -> vec<4, i32> -fn reverseBits_4dbd6f() { - var res: vec4 = reverseBits(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_4dbd6f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_4dbd6f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_4dbd6f(); -} diff --git a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.glsl b/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.glsl deleted file mode 100644 index 8bc94f8862..0000000000 --- a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reverseBits_4dbd6f() { - ivec4 res = bitfieldReverse(ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - reverseBits_4dbd6f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reverseBits_4dbd6f() { - ivec4 res = bitfieldReverse(ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - reverseBits_4dbd6f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reverseBits_4dbd6f() { - ivec4 res = bitfieldReverse(ivec4(0, 0, 0, 0)); -} - -void compute_main() { - reverseBits_4dbd6f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.hlsl b/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.hlsl deleted file mode 100644 index b3c0a73195..0000000000 --- a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reverseBits_4dbd6f() { - int4 res = reversebits(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reverseBits_4dbd6f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reverseBits_4dbd6f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reverseBits_4dbd6f(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.msl b/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.msl deleted file mode 100644 index 918b5e0390..0000000000 --- a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reverseBits_4dbd6f() { - int4 res = reverse_bits(int4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reverseBits_4dbd6f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reverseBits_4dbd6f(); - return; -} - -kernel void compute_main() { - reverseBits_4dbd6f(); - return; -} - diff --git a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.spvasm b/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.spvasm deleted file mode 100644 index 316876d3bb..0000000000 --- a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %reverseBits_4dbd6f "reverseBits_4dbd6f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %16 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%reverseBits_4dbd6f = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %16 - %13 = OpBitReverse %v4int %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %reverseBits_4dbd6f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %reverseBits_4dbd6f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %reverseBits_4dbd6f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.wgsl b/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.wgsl deleted file mode 100644 index 2e6d0b2b3a..0000000000 --- a/test/tint/builtins/gen/reverseBits/4dbd6f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reverseBits_4dbd6f() { - var res : vec4 = reverseBits(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_4dbd6f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_4dbd6f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_4dbd6f(); -} diff --git a/test/tint/builtins/gen/reverseBits/7c4269.wgsl b/test/tint/builtins/gen/reverseBits/7c4269.wgsl deleted file mode 100644 index e0b5fe82ab..0000000000 --- a/test/tint/builtins/gen/reverseBits/7c4269.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reverseBits(i32) -> i32 -fn reverseBits_7c4269() { - var res: i32 = reverseBits(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_7c4269(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_7c4269(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_7c4269(); -} diff --git a/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.glsl b/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.glsl deleted file mode 100644 index f903f1b21c..0000000000 --- a/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reverseBits_7c4269() { - int res = bitfieldReverse(1); -} - -vec4 vertex_main() { - reverseBits_7c4269(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reverseBits_7c4269() { - int res = bitfieldReverse(1); -} - -void fragment_main() { - reverseBits_7c4269(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reverseBits_7c4269() { - int res = bitfieldReverse(1); -} - -void compute_main() { - reverseBits_7c4269(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.hlsl b/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.hlsl deleted file mode 100644 index 03edd621ad..0000000000 --- a/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reverseBits_7c4269() { - int res = reversebits(1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reverseBits_7c4269(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reverseBits_7c4269(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reverseBits_7c4269(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.msl b/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.msl deleted file mode 100644 index 0d2865498a..0000000000 --- a/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reverseBits_7c4269() { - int res = reverse_bits(1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reverseBits_7c4269(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reverseBits_7c4269(); - return; -} - -kernel void compute_main() { - reverseBits_7c4269(); - return; -} - diff --git a/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.wgsl b/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.wgsl deleted file mode 100644 index 17f99508d8..0000000000 --- a/test/tint/builtins/gen/reverseBits/7c4269.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reverseBits_7c4269() { - var res : i32 = reverseBits(1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_7c4269(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_7c4269(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_7c4269(); -} diff --git a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl b/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl deleted file mode 100644 index 6a104db301..0000000000 --- a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reverseBits(vec<3, u32>) -> vec<3, u32> -fn reverseBits_a6ccd4() { - var res: vec3 = reverseBits(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_a6ccd4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_a6ccd4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_a6ccd4(); -} diff --git a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.glsl b/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.glsl deleted file mode 100644 index 80effe9e02..0000000000 --- a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reverseBits_a6ccd4() { - uvec3 res = bitfieldReverse(uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - reverseBits_a6ccd4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reverseBits_a6ccd4() { - uvec3 res = bitfieldReverse(uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - reverseBits_a6ccd4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reverseBits_a6ccd4() { - uvec3 res = bitfieldReverse(uvec3(0u, 0u, 0u)); -} - -void compute_main() { - reverseBits_a6ccd4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.hlsl b/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.hlsl deleted file mode 100644 index c2c6fca5aa..0000000000 --- a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reverseBits_a6ccd4() { - uint3 res = reversebits(uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reverseBits_a6ccd4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reverseBits_a6ccd4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reverseBits_a6ccd4(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.msl b/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.msl deleted file mode 100644 index 5c7819ea91..0000000000 --- a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reverseBits_a6ccd4() { - uint3 res = reverse_bits(uint3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reverseBits_a6ccd4(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reverseBits_a6ccd4(); - return; -} - -kernel void compute_main() { - reverseBits_a6ccd4(); - return; -} - diff --git a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.spvasm b/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.spvasm deleted file mode 100644 index 6b44df5e9f..0000000000 --- a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %reverseBits_a6ccd4 "reverseBits_a6ccd4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %16 = OpConstantNull %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%reverseBits_a6ccd4 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %16 - %13 = OpBitReverse %v3uint %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %reverseBits_a6ccd4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %reverseBits_a6ccd4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %reverseBits_a6ccd4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.wgsl b/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.wgsl deleted file mode 100644 index 713d9c764d..0000000000 --- a/test/tint/builtins/gen/reverseBits/a6ccd4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reverseBits_a6ccd4() { - var res : vec3 = reverseBits(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_a6ccd4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_a6ccd4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_a6ccd4(); -} diff --git a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl b/test/tint/builtins/gen/reverseBits/c21bc1.wgsl deleted file mode 100644 index 62e66a1839..0000000000 --- a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reverseBits(vec<3, i32>) -> vec<3, i32> -fn reverseBits_c21bc1() { - var res: vec3 = reverseBits(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_c21bc1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_c21bc1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_c21bc1(); -} diff --git a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.glsl b/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.glsl deleted file mode 100644 index ad28b9cd94..0000000000 --- a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reverseBits_c21bc1() { - ivec3 res = bitfieldReverse(ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - reverseBits_c21bc1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reverseBits_c21bc1() { - ivec3 res = bitfieldReverse(ivec3(0, 0, 0)); -} - -void fragment_main() { - reverseBits_c21bc1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reverseBits_c21bc1() { - ivec3 res = bitfieldReverse(ivec3(0, 0, 0)); -} - -void compute_main() { - reverseBits_c21bc1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.hlsl b/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.hlsl deleted file mode 100644 index c7f6c4897c..0000000000 --- a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reverseBits_c21bc1() { - int3 res = reversebits(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reverseBits_c21bc1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reverseBits_c21bc1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reverseBits_c21bc1(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.msl b/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.msl deleted file mode 100644 index b960eec3a0..0000000000 --- a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reverseBits_c21bc1() { - int3 res = reverse_bits(int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reverseBits_c21bc1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reverseBits_c21bc1(); - return; -} - -kernel void compute_main() { - reverseBits_c21bc1(); - return; -} - diff --git a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.spvasm b/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.spvasm deleted file mode 100644 index 9fcc4deeba..0000000000 --- a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %reverseBits_c21bc1 "reverseBits_c21bc1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %16 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%reverseBits_c21bc1 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %16 - %13 = OpBitReverse %v3int %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %reverseBits_c21bc1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %reverseBits_c21bc1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %reverseBits_c21bc1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.wgsl b/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.wgsl deleted file mode 100644 index 6ad70ae5ea..0000000000 --- a/test/tint/builtins/gen/reverseBits/c21bc1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reverseBits_c21bc1() { - var res : vec3 = reverseBits(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_c21bc1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_c21bc1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_c21bc1(); -} diff --git a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl b/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl deleted file mode 100644 index 9bed87a3f2..0000000000 --- a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reverseBits(vec<2, u32>) -> vec<2, u32> -fn reverseBits_e1f4c1() { - var res: vec2 = reverseBits(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_e1f4c1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_e1f4c1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_e1f4c1(); -} diff --git a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.glsl b/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.glsl deleted file mode 100644 index f94fd530d8..0000000000 --- a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reverseBits_e1f4c1() { - uvec2 res = bitfieldReverse(uvec2(0u, 0u)); -} - -vec4 vertex_main() { - reverseBits_e1f4c1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reverseBits_e1f4c1() { - uvec2 res = bitfieldReverse(uvec2(0u, 0u)); -} - -void fragment_main() { - reverseBits_e1f4c1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reverseBits_e1f4c1() { - uvec2 res = bitfieldReverse(uvec2(0u, 0u)); -} - -void compute_main() { - reverseBits_e1f4c1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.hlsl b/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.hlsl deleted file mode 100644 index b8948c55c6..0000000000 --- a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reverseBits_e1f4c1() { - uint2 res = reversebits(uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reverseBits_e1f4c1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reverseBits_e1f4c1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reverseBits_e1f4c1(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.msl b/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.msl deleted file mode 100644 index fc9ebd295f..0000000000 --- a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reverseBits_e1f4c1() { - uint2 res = reverse_bits(uint2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reverseBits_e1f4c1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reverseBits_e1f4c1(); - return; -} - -kernel void compute_main() { - reverseBits_e1f4c1(); - return; -} - diff --git a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.spvasm b/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.spvasm deleted file mode 100644 index 261fa99b81..0000000000 --- a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %reverseBits_e1f4c1 "reverseBits_e1f4c1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %16 = OpConstantNull %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%reverseBits_e1f4c1 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %16 - %13 = OpBitReverse %v2uint %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %reverseBits_e1f4c1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %reverseBits_e1f4c1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %reverseBits_e1f4c1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.wgsl b/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.wgsl deleted file mode 100644 index dc01269bec..0000000000 --- a/test/tint/builtins/gen/reverseBits/e1f4c1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reverseBits_e1f4c1() { - var res : vec2 = reverseBits(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_e1f4c1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_e1f4c1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_e1f4c1(); -} diff --git a/test/tint/builtins/gen/reverseBits/e31adf.wgsl b/test/tint/builtins/gen/reverseBits/e31adf.wgsl deleted file mode 100644 index 2a599eb0aa..0000000000 --- a/test/tint/builtins/gen/reverseBits/e31adf.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn reverseBits(u32) -> u32 -fn reverseBits_e31adf() { - var res: u32 = reverseBits(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_e31adf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_e31adf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_e31adf(); -} diff --git a/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.glsl b/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.glsl deleted file mode 100644 index 4048e3b4ed..0000000000 --- a/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void reverseBits_e31adf() { - uint res = bitfieldReverse(1u); -} - -vec4 vertex_main() { - reverseBits_e31adf(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void reverseBits_e31adf() { - uint res = bitfieldReverse(1u); -} - -void fragment_main() { - reverseBits_e31adf(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void reverseBits_e31adf() { - uint res = bitfieldReverse(1u); -} - -void compute_main() { - reverseBits_e31adf(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.hlsl b/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.hlsl deleted file mode 100644 index cb3c52b9ef..0000000000 --- a/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void reverseBits_e31adf() { - uint res = reversebits(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - reverseBits_e31adf(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - reverseBits_e31adf(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - reverseBits_e31adf(); - return; -} diff --git a/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.msl b/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.msl deleted file mode 100644 index fb3d3f2a1f..0000000000 --- a/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void reverseBits_e31adf() { - uint res = reverse_bits(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - reverseBits_e31adf(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - reverseBits_e31adf(); - return; -} - -kernel void compute_main() { - reverseBits_e31adf(); - return; -} - diff --git a/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.wgsl b/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.wgsl deleted file mode 100644 index d99e7a57cf..0000000000 --- a/test/tint/builtins/gen/reverseBits/e31adf.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn reverseBits_e31adf() { - var res : u32 = reverseBits(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - reverseBits_e31adf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - reverseBits_e31adf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - reverseBits_e31adf(); -} diff --git a/test/tint/builtins/gen/round/106c0b.wgsl b/test/tint/builtins/gen/round/106c0b.wgsl deleted file mode 100644 index ab45faa67c..0000000000 --- a/test/tint/builtins/gen/round/106c0b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn round(vec<4, f32>) -> vec<4, f32> -fn round_106c0b() { - var res: vec4 = round(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - round_106c0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - round_106c0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - round_106c0b(); -} diff --git a/test/tint/builtins/gen/round/106c0b.wgsl.expected.glsl b/test/tint/builtins/gen/round/106c0b.wgsl.expected.glsl deleted file mode 100644 index e85606c533..0000000000 --- a/test/tint/builtins/gen/round/106c0b.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void round_106c0b() { - vec4 res = round(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - round_106c0b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void round_106c0b() { - vec4 res = round(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - round_106c0b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void round_106c0b() { - vec4 res = round(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - round_106c0b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/round/106c0b.wgsl.expected.hlsl b/test/tint/builtins/gen/round/106c0b.wgsl.expected.hlsl deleted file mode 100644 index 5645e986f6..0000000000 --- a/test/tint/builtins/gen/round/106c0b.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void round_106c0b() { - float4 res = round(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - round_106c0b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - round_106c0b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - round_106c0b(); - return; -} diff --git a/test/tint/builtins/gen/round/106c0b.wgsl.expected.msl b/test/tint/builtins/gen/round/106c0b.wgsl.expected.msl deleted file mode 100644 index be166bff69..0000000000 --- a/test/tint/builtins/gen/round/106c0b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void round_106c0b() { - float4 res = rint(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - round_106c0b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - round_106c0b(); - return; -} - -kernel void compute_main() { - round_106c0b(); - return; -} - diff --git a/test/tint/builtins/gen/round/106c0b.wgsl.expected.spvasm b/test/tint/builtins/gen/round/106c0b.wgsl.expected.spvasm deleted file mode 100644 index b0204e70c5..0000000000 --- a/test/tint/builtins/gen/round/106c0b.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %round_106c0b "round_106c0b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%round_106c0b = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 RoundEven %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %round_106c0b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %round_106c0b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %round_106c0b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/round/106c0b.wgsl.expected.wgsl b/test/tint/builtins/gen/round/106c0b.wgsl.expected.wgsl deleted file mode 100644 index 338cddf2d9..0000000000 --- a/test/tint/builtins/gen/round/106c0b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn round_106c0b() { - var res : vec4 = round(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - round_106c0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - round_106c0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - round_106c0b(); -} diff --git a/test/tint/builtins/gen/round/1c7897.wgsl b/test/tint/builtins/gen/round/1c7897.wgsl deleted file mode 100644 index cf9399677d..0000000000 --- a/test/tint/builtins/gen/round/1c7897.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn round(vec<3, f32>) -> vec<3, f32> -fn round_1c7897() { - var res: vec3 = round(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - round_1c7897(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - round_1c7897(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - round_1c7897(); -} diff --git a/test/tint/builtins/gen/round/1c7897.wgsl.expected.glsl b/test/tint/builtins/gen/round/1c7897.wgsl.expected.glsl deleted file mode 100644 index ae7708e3a3..0000000000 --- a/test/tint/builtins/gen/round/1c7897.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void round_1c7897() { - vec3 res = round(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - round_1c7897(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void round_1c7897() { - vec3 res = round(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - round_1c7897(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void round_1c7897() { - vec3 res = round(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - round_1c7897(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/round/1c7897.wgsl.expected.hlsl b/test/tint/builtins/gen/round/1c7897.wgsl.expected.hlsl deleted file mode 100644 index d03c4a43a5..0000000000 --- a/test/tint/builtins/gen/round/1c7897.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void round_1c7897() { - float3 res = round(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - round_1c7897(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - round_1c7897(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - round_1c7897(); - return; -} diff --git a/test/tint/builtins/gen/round/1c7897.wgsl.expected.msl b/test/tint/builtins/gen/round/1c7897.wgsl.expected.msl deleted file mode 100644 index 85dda287ed..0000000000 --- a/test/tint/builtins/gen/round/1c7897.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void round_1c7897() { - float3 res = rint(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - round_1c7897(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - round_1c7897(); - return; -} - -kernel void compute_main() { - round_1c7897(); - return; -} - diff --git a/test/tint/builtins/gen/round/1c7897.wgsl.expected.spvasm b/test/tint/builtins/gen/round/1c7897.wgsl.expected.spvasm deleted file mode 100644 index 925cea42e2..0000000000 --- a/test/tint/builtins/gen/round/1c7897.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %round_1c7897 "round_1c7897" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%round_1c7897 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 RoundEven %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %round_1c7897 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %round_1c7897 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %round_1c7897 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/round/1c7897.wgsl.expected.wgsl b/test/tint/builtins/gen/round/1c7897.wgsl.expected.wgsl deleted file mode 100644 index ac2350eb42..0000000000 --- a/test/tint/builtins/gen/round/1c7897.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn round_1c7897() { - var res : vec3 = round(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - round_1c7897(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - round_1c7897(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - round_1c7897(); -} diff --git a/test/tint/builtins/gen/round/52c84d.wgsl b/test/tint/builtins/gen/round/52c84d.wgsl deleted file mode 100644 index 94dff00cde..0000000000 --- a/test/tint/builtins/gen/round/52c84d.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn round(vec<2, f32>) -> vec<2, f32> -fn round_52c84d() { - var res: vec2 = round(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - round_52c84d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - round_52c84d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - round_52c84d(); -} diff --git a/test/tint/builtins/gen/round/52c84d.wgsl.expected.glsl b/test/tint/builtins/gen/round/52c84d.wgsl.expected.glsl deleted file mode 100644 index 870e59029e..0000000000 --- a/test/tint/builtins/gen/round/52c84d.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void round_52c84d() { - vec2 res = round(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - round_52c84d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void round_52c84d() { - vec2 res = round(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - round_52c84d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void round_52c84d() { - vec2 res = round(vec2(0.0f, 0.0f)); -} - -void compute_main() { - round_52c84d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/round/52c84d.wgsl.expected.hlsl b/test/tint/builtins/gen/round/52c84d.wgsl.expected.hlsl deleted file mode 100644 index 684c4c7165..0000000000 --- a/test/tint/builtins/gen/round/52c84d.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void round_52c84d() { - float2 res = round(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - round_52c84d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - round_52c84d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - round_52c84d(); - return; -} diff --git a/test/tint/builtins/gen/round/52c84d.wgsl.expected.msl b/test/tint/builtins/gen/round/52c84d.wgsl.expected.msl deleted file mode 100644 index 87e2b215f8..0000000000 --- a/test/tint/builtins/gen/round/52c84d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void round_52c84d() { - float2 res = rint(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - round_52c84d(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - round_52c84d(); - return; -} - -kernel void compute_main() { - round_52c84d(); - return; -} - diff --git a/test/tint/builtins/gen/round/52c84d.wgsl.expected.spvasm b/test/tint/builtins/gen/round/52c84d.wgsl.expected.spvasm deleted file mode 100644 index 78f53964f1..0000000000 --- a/test/tint/builtins/gen/round/52c84d.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %round_52c84d "round_52c84d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%round_52c84d = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 RoundEven %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %round_52c84d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %round_52c84d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %round_52c84d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/round/52c84d.wgsl.expected.wgsl b/test/tint/builtins/gen/round/52c84d.wgsl.expected.wgsl deleted file mode 100644 index 9877c2dc65..0000000000 --- a/test/tint/builtins/gen/round/52c84d.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn round_52c84d() { - var res : vec2 = round(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - round_52c84d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - round_52c84d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - round_52c84d(); -} diff --git a/test/tint/builtins/gen/round/9edc38.wgsl b/test/tint/builtins/gen/round/9edc38.wgsl deleted file mode 100644 index f0d74685e4..0000000000 --- a/test/tint/builtins/gen/round/9edc38.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn round(f32) -> f32 -fn round_9edc38() { - var res: f32 = round(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - round_9edc38(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - round_9edc38(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - round_9edc38(); -} diff --git a/test/tint/builtins/gen/round/9edc38.wgsl.expected.glsl b/test/tint/builtins/gen/round/9edc38.wgsl.expected.glsl deleted file mode 100644 index d4e3f0d514..0000000000 --- a/test/tint/builtins/gen/round/9edc38.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void round_9edc38() { - float res = round(1.0f); -} - -vec4 vertex_main() { - round_9edc38(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void round_9edc38() { - float res = round(1.0f); -} - -void fragment_main() { - round_9edc38(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void round_9edc38() { - float res = round(1.0f); -} - -void compute_main() { - round_9edc38(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/round/9edc38.wgsl.expected.hlsl b/test/tint/builtins/gen/round/9edc38.wgsl.expected.hlsl deleted file mode 100644 index 451fc1c2a9..0000000000 --- a/test/tint/builtins/gen/round/9edc38.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void round_9edc38() { - float res = round(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - round_9edc38(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - round_9edc38(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - round_9edc38(); - return; -} diff --git a/test/tint/builtins/gen/round/9edc38.wgsl.expected.msl b/test/tint/builtins/gen/round/9edc38.wgsl.expected.msl deleted file mode 100644 index a3f14ae5ba..0000000000 --- a/test/tint/builtins/gen/round/9edc38.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void round_9edc38() { - float res = rint(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - round_9edc38(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - round_9edc38(); - return; -} - -kernel void compute_main() { - round_9edc38(); - return; -} - diff --git a/test/tint/builtins/gen/round/9edc38.wgsl.expected.wgsl b/test/tint/builtins/gen/round/9edc38.wgsl.expected.wgsl deleted file mode 100644 index 9753e04491..0000000000 --- a/test/tint/builtins/gen/round/9edc38.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn round_9edc38() { - var res : f32 = round(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - round_9edc38(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - round_9edc38(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - round_9edc38(); -} diff --git a/test/tint/builtins/gen/select/00b848.wgsl b/test/tint/builtins/gen/select/00b848.wgsl deleted file mode 100644 index cfe6e06565..0000000000 --- a/test/tint/builtins/gen/select/00b848.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<2, i32>, vec<2, i32>, vec<2, bool>) -> vec<2, i32> -fn select_00b848() { - var res: vec2 = select(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_00b848(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_00b848(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_00b848(); -} diff --git a/test/tint/builtins/gen/select/00b848.wgsl.expected.glsl b/test/tint/builtins/gen/select/00b848.wgsl.expected.glsl deleted file mode 100644 index 2805a6b349..0000000000 --- a/test/tint/builtins/gen/select/00b848.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_00b848() { - ivec2 res = mix(ivec2(0, 0), ivec2(0, 0), bvec2(false, false)); -} - -vec4 vertex_main() { - select_00b848(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_00b848() { - ivec2 res = mix(ivec2(0, 0), ivec2(0, 0), bvec2(false, false)); -} - -void fragment_main() { - select_00b848(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_00b848() { - ivec2 res = mix(ivec2(0, 0), ivec2(0, 0), bvec2(false, false)); -} - -void compute_main() { - select_00b848(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/00b848.wgsl.expected.hlsl b/test/tint/builtins/gen/select/00b848.wgsl.expected.hlsl deleted file mode 100644 index b410bbf949..0000000000 --- a/test/tint/builtins/gen/select/00b848.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_00b848() { - int2 res = (bool2(false, false) ? int2(0, 0) : int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_00b848(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_00b848(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_00b848(); - return; -} diff --git a/test/tint/builtins/gen/select/00b848.wgsl.expected.msl b/test/tint/builtins/gen/select/00b848.wgsl.expected.msl deleted file mode 100644 index 79cd7058dd..0000000000 --- a/test/tint/builtins/gen/select/00b848.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_00b848() { - int2 res = select(int2(), int2(), bool2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_00b848(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_00b848(); - return; -} - -kernel void compute_main() { - select_00b848(); - return; -} - diff --git a/test/tint/builtins/gen/select/00b848.wgsl.expected.spvasm b/test/tint/builtins/gen/select/00b848.wgsl.expected.spvasm deleted file mode 100644 index b4ab55c534..0000000000 --- a/test/tint/builtins/gen/select/00b848.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_00b848 "select_00b848" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %18 = OpConstantNull %v2bool - %19 = OpConstantNull %v2int -%_ptr_Function_v2int = OpTypePointer Function %v2int - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_00b848 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %19 - %13 = OpSelect %v2int %18 %19 %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %select_00b848 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_00b848 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_00b848 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/00b848.wgsl.expected.wgsl b/test/tint/builtins/gen/select/00b848.wgsl.expected.wgsl deleted file mode 100644 index bf45b9026d..0000000000 --- a/test/tint/builtins/gen/select/00b848.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_00b848() { - var res : vec2 = select(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_00b848(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_00b848(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_00b848(); -} diff --git a/test/tint/builtins/gen/select/01e2cd.wgsl b/test/tint/builtins/gen/select/01e2cd.wgsl deleted file mode 100644 index 8e2a17b736..0000000000 --- a/test/tint/builtins/gen/select/01e2cd.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<3, i32>, vec<3, i32>, vec<3, bool>) -> vec<3, i32> -fn select_01e2cd() { - var res: vec3 = select(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_01e2cd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_01e2cd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_01e2cd(); -} diff --git a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.glsl b/test/tint/builtins/gen/select/01e2cd.wgsl.expected.glsl deleted file mode 100644 index 2a9909cbcb..0000000000 --- a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_01e2cd() { - ivec3 res = mix(ivec3(0, 0, 0), ivec3(0, 0, 0), bvec3(false, false, false)); -} - -vec4 vertex_main() { - select_01e2cd(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_01e2cd() { - ivec3 res = mix(ivec3(0, 0, 0), ivec3(0, 0, 0), bvec3(false, false, false)); -} - -void fragment_main() { - select_01e2cd(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_01e2cd() { - ivec3 res = mix(ivec3(0, 0, 0), ivec3(0, 0, 0), bvec3(false, false, false)); -} - -void compute_main() { - select_01e2cd(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.hlsl b/test/tint/builtins/gen/select/01e2cd.wgsl.expected.hlsl deleted file mode 100644 index 5708773084..0000000000 --- a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_01e2cd() { - int3 res = (bool3(false, false, false) ? int3(0, 0, 0) : int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_01e2cd(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_01e2cd(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_01e2cd(); - return; -} diff --git a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.msl b/test/tint/builtins/gen/select/01e2cd.wgsl.expected.msl deleted file mode 100644 index f7618aec63..0000000000 --- a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_01e2cd() { - int3 res = select(int3(), int3(), bool3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_01e2cd(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_01e2cd(); - return; -} - -kernel void compute_main() { - select_01e2cd(); - return; -} - diff --git a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.spvasm b/test/tint/builtins/gen/select/01e2cd.wgsl.expected.spvasm deleted file mode 100644 index f2bc1f9efc..0000000000 --- a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_01e2cd "select_01e2cd" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %18 = OpConstantNull %v3bool - %19 = OpConstantNull %v3int -%_ptr_Function_v3int = OpTypePointer Function %v3int - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_01e2cd = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %19 - %13 = OpSelect %v3int %18 %19 %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %select_01e2cd - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_01e2cd - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_01e2cd - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.wgsl b/test/tint/builtins/gen/select/01e2cd.wgsl.expected.wgsl deleted file mode 100644 index 7e9d06fa39..0000000000 --- a/test/tint/builtins/gen/select/01e2cd.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_01e2cd() { - var res : vec3 = select(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_01e2cd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_01e2cd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_01e2cd(); -} diff --git a/test/tint/builtins/gen/select/087ea4.wgsl b/test/tint/builtins/gen/select/087ea4.wgsl deleted file mode 100644 index 17021a126e..0000000000 --- a/test/tint/builtins/gen/select/087ea4.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<4, u32>, vec<4, u32>, bool) -> vec<4, u32> -fn select_087ea4() { - var res: vec4 = select(vec4(), vec4(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_087ea4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_087ea4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_087ea4(); -} diff --git a/test/tint/builtins/gen/select/087ea4.wgsl.expected.glsl b/test/tint/builtins/gen/select/087ea4.wgsl.expected.glsl deleted file mode 100644 index 75d5c9a63a..0000000000 --- a/test/tint/builtins/gen/select/087ea4.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_087ea4() { - uvec4 res = (false ? uvec4(0u, 0u, 0u, 0u) : uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - select_087ea4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_087ea4() { - uvec4 res = (false ? uvec4(0u, 0u, 0u, 0u) : uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - select_087ea4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_087ea4() { - uvec4 res = (false ? uvec4(0u, 0u, 0u, 0u) : uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - select_087ea4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/087ea4.wgsl.expected.hlsl b/test/tint/builtins/gen/select/087ea4.wgsl.expected.hlsl deleted file mode 100644 index b7aa28406c..0000000000 --- a/test/tint/builtins/gen/select/087ea4.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_087ea4() { - uint4 res = (false ? uint4(0u, 0u, 0u, 0u) : uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_087ea4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_087ea4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_087ea4(); - return; -} diff --git a/test/tint/builtins/gen/select/087ea4.wgsl.expected.msl b/test/tint/builtins/gen/select/087ea4.wgsl.expected.msl deleted file mode 100644 index 4838d99ab8..0000000000 --- a/test/tint/builtins/gen/select/087ea4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_087ea4() { - uint4 res = select(uint4(), uint4(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_087ea4(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_087ea4(); - return; -} - -kernel void compute_main() { - select_087ea4(); - return; -} - diff --git a/test/tint/builtins/gen/select/087ea4.wgsl.expected.spvasm b/test/tint/builtins/gen/select/087ea4.wgsl.expected.spvasm deleted file mode 100644 index c1ea2cd51d..0000000000 --- a/test/tint/builtins/gen/select/087ea4.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_087ea4 "select_087ea4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %bool = OpTypeBool - %17 = OpConstantNull %bool - %18 = OpConstantNull %v4uint - %v4bool = OpTypeVector %bool 4 -%_ptr_Function_v4bool = OpTypePointer Function %v4bool - %22 = OpConstantNull %v4bool -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_087ea4 = OpFunction %void None %9 - %12 = OpLabel - %20 = OpVariable %_ptr_Function_v4bool Function %22 - %res = OpVariable %_ptr_Function_v4uint Function %18 - %23 = OpCompositeConstruct %v4bool %17 %17 %17 %17 - %13 = OpSelect %v4uint %23 %18 %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %select_087ea4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %select_087ea4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %38 = OpLabel - %39 = OpFunctionCall %void %select_087ea4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/087ea4.wgsl.expected.wgsl b/test/tint/builtins/gen/select/087ea4.wgsl.expected.wgsl deleted file mode 100644 index 6258a15d0b..0000000000 --- a/test/tint/builtins/gen/select/087ea4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_087ea4() { - var res : vec4 = select(vec4(), vec4(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_087ea4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_087ea4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_087ea4(); -} diff --git a/test/tint/builtins/gen/select/1e960b.wgsl b/test/tint/builtins/gen/select/1e960b.wgsl deleted file mode 100644 index 7ccf1112dc..0000000000 --- a/test/tint/builtins/gen/select/1e960b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<2, u32>, vec<2, u32>, vec<2, bool>) -> vec<2, u32> -fn select_1e960b() { - var res: vec2 = select(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_1e960b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_1e960b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_1e960b(); -} diff --git a/test/tint/builtins/gen/select/1e960b.wgsl.expected.glsl b/test/tint/builtins/gen/select/1e960b.wgsl.expected.glsl deleted file mode 100644 index e1778f02cf..0000000000 --- a/test/tint/builtins/gen/select/1e960b.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_1e960b() { - uvec2 res = mix(uvec2(0u, 0u), uvec2(0u, 0u), bvec2(false, false)); -} - -vec4 vertex_main() { - select_1e960b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_1e960b() { - uvec2 res = mix(uvec2(0u, 0u), uvec2(0u, 0u), bvec2(false, false)); -} - -void fragment_main() { - select_1e960b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_1e960b() { - uvec2 res = mix(uvec2(0u, 0u), uvec2(0u, 0u), bvec2(false, false)); -} - -void compute_main() { - select_1e960b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/1e960b.wgsl.expected.hlsl b/test/tint/builtins/gen/select/1e960b.wgsl.expected.hlsl deleted file mode 100644 index 89f728db65..0000000000 --- a/test/tint/builtins/gen/select/1e960b.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_1e960b() { - uint2 res = (bool2(false, false) ? uint2(0u, 0u) : uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_1e960b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_1e960b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_1e960b(); - return; -} diff --git a/test/tint/builtins/gen/select/1e960b.wgsl.expected.msl b/test/tint/builtins/gen/select/1e960b.wgsl.expected.msl deleted file mode 100644 index 87b11508d2..0000000000 --- a/test/tint/builtins/gen/select/1e960b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_1e960b() { - uint2 res = select(uint2(), uint2(), bool2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_1e960b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_1e960b(); - return; -} - -kernel void compute_main() { - select_1e960b(); - return; -} - diff --git a/test/tint/builtins/gen/select/1e960b.wgsl.expected.spvasm b/test/tint/builtins/gen/select/1e960b.wgsl.expected.spvasm deleted file mode 100644 index 62b963c28f..0000000000 --- a/test/tint/builtins/gen/select/1e960b.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_1e960b "select_1e960b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %18 = OpConstantNull %v2bool - %19 = OpConstantNull %v2uint -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_1e960b = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %19 - %13 = OpSelect %v2uint %18 %19 %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %select_1e960b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_1e960b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_1e960b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/1e960b.wgsl.expected.wgsl b/test/tint/builtins/gen/select/1e960b.wgsl.expected.wgsl deleted file mode 100644 index 4f78e59e25..0000000000 --- a/test/tint/builtins/gen/select/1e960b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_1e960b() { - var res : vec2 = select(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_1e960b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_1e960b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_1e960b(); -} diff --git a/test/tint/builtins/gen/select/266aff.wgsl b/test/tint/builtins/gen/select/266aff.wgsl deleted file mode 100644 index d475b4a130..0000000000 --- a/test/tint/builtins/gen/select/266aff.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<2, f32>, vec<2, f32>, vec<2, bool>) -> vec<2, f32> -fn select_266aff() { - var res: vec2 = select(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_266aff(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_266aff(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_266aff(); -} diff --git a/test/tint/builtins/gen/select/266aff.wgsl.expected.glsl b/test/tint/builtins/gen/select/266aff.wgsl.expected.glsl deleted file mode 100644 index 9d98174d8c..0000000000 --- a/test/tint/builtins/gen/select/266aff.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_266aff() { - vec2 res = mix(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), bvec2(false, false)); -} - -vec4 vertex_main() { - select_266aff(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_266aff() { - vec2 res = mix(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), bvec2(false, false)); -} - -void fragment_main() { - select_266aff(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_266aff() { - vec2 res = mix(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), bvec2(false, false)); -} - -void compute_main() { - select_266aff(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/266aff.wgsl.expected.hlsl b/test/tint/builtins/gen/select/266aff.wgsl.expected.hlsl deleted file mode 100644 index 2c945706ba..0000000000 --- a/test/tint/builtins/gen/select/266aff.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_266aff() { - float2 res = (bool2(false, false) ? float2(0.0f, 0.0f) : float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_266aff(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_266aff(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_266aff(); - return; -} diff --git a/test/tint/builtins/gen/select/266aff.wgsl.expected.msl b/test/tint/builtins/gen/select/266aff.wgsl.expected.msl deleted file mode 100644 index 56688e6b0e..0000000000 --- a/test/tint/builtins/gen/select/266aff.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_266aff() { - float2 res = select(float2(), float2(), bool2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_266aff(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_266aff(); - return; -} - -kernel void compute_main() { - select_266aff(); - return; -} - diff --git a/test/tint/builtins/gen/select/266aff.wgsl.expected.spvasm b/test/tint/builtins/gen/select/266aff.wgsl.expected.spvasm deleted file mode 100644 index 4dad59d2a5..0000000000 --- a/test/tint/builtins/gen/select/266aff.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_266aff "select_266aff" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %17 = OpConstantNull %v2bool - %18 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_266aff = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %18 - %13 = OpSelect %v2float %17 %18 %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %select_266aff - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %select_266aff - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %select_266aff - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/266aff.wgsl.expected.wgsl b/test/tint/builtins/gen/select/266aff.wgsl.expected.wgsl deleted file mode 100644 index 522a10f656..0000000000 --- a/test/tint/builtins/gen/select/266aff.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_266aff() { - var res : vec2 = select(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_266aff(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_266aff(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_266aff(); -} diff --git a/test/tint/builtins/gen/select/28a27e.wgsl b/test/tint/builtins/gen/select/28a27e.wgsl deleted file mode 100644 index 149379ef14..0000000000 --- a/test/tint/builtins/gen/select/28a27e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<3, u32>, vec<3, u32>, vec<3, bool>) -> vec<3, u32> -fn select_28a27e() { - var res: vec3 = select(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_28a27e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_28a27e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_28a27e(); -} diff --git a/test/tint/builtins/gen/select/28a27e.wgsl.expected.glsl b/test/tint/builtins/gen/select/28a27e.wgsl.expected.glsl deleted file mode 100644 index 66a3b69e6a..0000000000 --- a/test/tint/builtins/gen/select/28a27e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_28a27e() { - uvec3 res = mix(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u), bvec3(false, false, false)); -} - -vec4 vertex_main() { - select_28a27e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_28a27e() { - uvec3 res = mix(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u), bvec3(false, false, false)); -} - -void fragment_main() { - select_28a27e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_28a27e() { - uvec3 res = mix(uvec3(0u, 0u, 0u), uvec3(0u, 0u, 0u), bvec3(false, false, false)); -} - -void compute_main() { - select_28a27e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/28a27e.wgsl.expected.hlsl b/test/tint/builtins/gen/select/28a27e.wgsl.expected.hlsl deleted file mode 100644 index 16a5d8c2ce..0000000000 --- a/test/tint/builtins/gen/select/28a27e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_28a27e() { - uint3 res = (bool3(false, false, false) ? uint3(0u, 0u, 0u) : uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_28a27e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_28a27e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_28a27e(); - return; -} diff --git a/test/tint/builtins/gen/select/28a27e.wgsl.expected.msl b/test/tint/builtins/gen/select/28a27e.wgsl.expected.msl deleted file mode 100644 index 2e21e18b98..0000000000 --- a/test/tint/builtins/gen/select/28a27e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_28a27e() { - uint3 res = select(uint3(), uint3(), bool3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_28a27e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_28a27e(); - return; -} - -kernel void compute_main() { - select_28a27e(); - return; -} - diff --git a/test/tint/builtins/gen/select/28a27e.wgsl.expected.spvasm b/test/tint/builtins/gen/select/28a27e.wgsl.expected.spvasm deleted file mode 100644 index 31dbbacbf4..0000000000 --- a/test/tint/builtins/gen/select/28a27e.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_28a27e "select_28a27e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %18 = OpConstantNull %v3bool - %19 = OpConstantNull %v3uint -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_28a27e = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3uint Function %19 - %13 = OpSelect %v3uint %18 %19 %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %select_28a27e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_28a27e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_28a27e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/28a27e.wgsl.expected.wgsl b/test/tint/builtins/gen/select/28a27e.wgsl.expected.wgsl deleted file mode 100644 index cbc4bcfa1f..0000000000 --- a/test/tint/builtins/gen/select/28a27e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_28a27e() { - var res : vec3 = select(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_28a27e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_28a27e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_28a27e(); -} diff --git a/test/tint/builtins/gen/select/3c25ce.wgsl b/test/tint/builtins/gen/select/3c25ce.wgsl deleted file mode 100644 index a855d398f5..0000000000 --- a/test/tint/builtins/gen/select/3c25ce.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<3, bool>, vec<3, bool>, bool) -> vec<3, bool> -fn select_3c25ce() { - var res: vec3 = select(vec3(), vec3(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_3c25ce(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_3c25ce(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_3c25ce(); -} diff --git a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.glsl b/test/tint/builtins/gen/select/3c25ce.wgsl.expected.glsl deleted file mode 100644 index 1989167b6f..0000000000 --- a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_3c25ce() { - bvec3 res = (false ? bvec3(false, false, false) : bvec3(false, false, false)); -} - -vec4 vertex_main() { - select_3c25ce(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_3c25ce() { - bvec3 res = (false ? bvec3(false, false, false) : bvec3(false, false, false)); -} - -void fragment_main() { - select_3c25ce(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_3c25ce() { - bvec3 res = (false ? bvec3(false, false, false) : bvec3(false, false, false)); -} - -void compute_main() { - select_3c25ce(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.hlsl b/test/tint/builtins/gen/select/3c25ce.wgsl.expected.hlsl deleted file mode 100644 index 913c1b9403..0000000000 --- a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_3c25ce() { - bool3 res = (false ? bool3(false, false, false) : bool3(false, false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_3c25ce(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_3c25ce(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_3c25ce(); - return; -} diff --git a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.msl b/test/tint/builtins/gen/select/3c25ce.wgsl.expected.msl deleted file mode 100644 index 8a73c3639b..0000000000 --- a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_3c25ce() { - bool3 res = select(bool3(), bool3(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_3c25ce(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_3c25ce(); - return; -} - -kernel void compute_main() { - select_3c25ce(); - return; -} - diff --git a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.spvasm b/test/tint/builtins/gen/select/3c25ce.wgsl.expected.spvasm deleted file mode 100644 index f4b03d4ddd..0000000000 --- a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_3c25ce "select_3c25ce" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %16 = OpConstantNull %bool - %17 = OpConstantNull %v3bool -%_ptr_Function_v3bool = OpTypePointer Function %v3bool - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_3c25ce = OpFunction %void None %9 - %12 = OpLabel - %18 = OpVariable %_ptr_Function_v3bool Function %17 - %res = OpVariable %_ptr_Function_v3bool Function %17 - %20 = OpCompositeConstruct %v3bool %16 %16 %16 - %13 = OpSelect %v3bool %20 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %select_3c25ce - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_3c25ce - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_3c25ce - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.wgsl b/test/tint/builtins/gen/select/3c25ce.wgsl.expected.wgsl deleted file mode 100644 index 48963b4c96..0000000000 --- a/test/tint/builtins/gen/select/3c25ce.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_3c25ce() { - var res : vec3 = select(vec3(), vec3(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_3c25ce(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_3c25ce(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_3c25ce(); -} diff --git a/test/tint/builtins/gen/select/416e14.wgsl b/test/tint/builtins/gen/select/416e14.wgsl deleted file mode 100644 index b953b5ad29..0000000000 --- a/test/tint/builtins/gen/select/416e14.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(f32, f32, bool) -> f32 -fn select_416e14() { - var res: f32 = select(1.0, 1.0, bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_416e14(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_416e14(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_416e14(); -} diff --git a/test/tint/builtins/gen/select/416e14.wgsl.expected.glsl b/test/tint/builtins/gen/select/416e14.wgsl.expected.glsl deleted file mode 100644 index 56cd4d9e82..0000000000 --- a/test/tint/builtins/gen/select/416e14.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_416e14() { - float res = (false ? 1.0f : 1.0f); -} - -vec4 vertex_main() { - select_416e14(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_416e14() { - float res = (false ? 1.0f : 1.0f); -} - -void fragment_main() { - select_416e14(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_416e14() { - float res = (false ? 1.0f : 1.0f); -} - -void compute_main() { - select_416e14(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/416e14.wgsl.expected.hlsl b/test/tint/builtins/gen/select/416e14.wgsl.expected.hlsl deleted file mode 100644 index 1f21685004..0000000000 --- a/test/tint/builtins/gen/select/416e14.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_416e14() { - float res = (false ? 1.0f : 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_416e14(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_416e14(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_416e14(); - return; -} diff --git a/test/tint/builtins/gen/select/416e14.wgsl.expected.msl b/test/tint/builtins/gen/select/416e14.wgsl.expected.msl deleted file mode 100644 index 1e57158875..0000000000 --- a/test/tint/builtins/gen/select/416e14.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_416e14() { - float res = select(1.0f, 1.0f, bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_416e14(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_416e14(); - return; -} - -kernel void compute_main() { - select_416e14(); - return; -} - diff --git a/test/tint/builtins/gen/select/416e14.wgsl.expected.spvasm b/test/tint/builtins/gen/select/416e14.wgsl.expected.spvasm deleted file mode 100644 index 0ab293153d..0000000000 --- a/test/tint/builtins/gen/select/416e14.wgsl.expected.spvasm +++ /dev/null @@ -1,66 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_416e14 "select_416e14" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %15 = OpConstantNull %bool - %float_1 = OpConstant %float 1 -%_ptr_Function_float = OpTypePointer Function %float - %19 = OpTypeFunction %v4float -%select_416e14 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpSelect %float %15 %float_1 %float_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %select_416e14 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %select_416e14 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %select_416e14 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/416e14.wgsl.expected.wgsl b/test/tint/builtins/gen/select/416e14.wgsl.expected.wgsl deleted file mode 100644 index bfa5d2e711..0000000000 --- a/test/tint/builtins/gen/select/416e14.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_416e14() { - var res : f32 = select(1.0, 1.0, bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_416e14(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_416e14(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_416e14(); -} diff --git a/test/tint/builtins/gen/select/51b047.wgsl b/test/tint/builtins/gen/select/51b047.wgsl deleted file mode 100644 index 702cdedde9..0000000000 --- a/test/tint/builtins/gen/select/51b047.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<2, u32>, vec<2, u32>, bool) -> vec<2, u32> -fn select_51b047() { - var res: vec2 = select(vec2(), vec2(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_51b047(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_51b047(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_51b047(); -} diff --git a/test/tint/builtins/gen/select/51b047.wgsl.expected.glsl b/test/tint/builtins/gen/select/51b047.wgsl.expected.glsl deleted file mode 100644 index a3c3ff9c78..0000000000 --- a/test/tint/builtins/gen/select/51b047.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_51b047() { - uvec2 res = (false ? uvec2(0u, 0u) : uvec2(0u, 0u)); -} - -vec4 vertex_main() { - select_51b047(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_51b047() { - uvec2 res = (false ? uvec2(0u, 0u) : uvec2(0u, 0u)); -} - -void fragment_main() { - select_51b047(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_51b047() { - uvec2 res = (false ? uvec2(0u, 0u) : uvec2(0u, 0u)); -} - -void compute_main() { - select_51b047(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/51b047.wgsl.expected.hlsl b/test/tint/builtins/gen/select/51b047.wgsl.expected.hlsl deleted file mode 100644 index 716ee85dcf..0000000000 --- a/test/tint/builtins/gen/select/51b047.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_51b047() { - uint2 res = (false ? uint2(0u, 0u) : uint2(0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_51b047(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_51b047(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_51b047(); - return; -} diff --git a/test/tint/builtins/gen/select/51b047.wgsl.expected.msl b/test/tint/builtins/gen/select/51b047.wgsl.expected.msl deleted file mode 100644 index 42e6e3af88..0000000000 --- a/test/tint/builtins/gen/select/51b047.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_51b047() { - uint2 res = select(uint2(), uint2(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_51b047(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_51b047(); - return; -} - -kernel void compute_main() { - select_51b047(); - return; -} - diff --git a/test/tint/builtins/gen/select/51b047.wgsl.expected.spvasm b/test/tint/builtins/gen/select/51b047.wgsl.expected.spvasm deleted file mode 100644 index 617dea6b53..0000000000 --- a/test/tint/builtins/gen/select/51b047.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_51b047 "select_51b047" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v2uint = OpTypeVector %uint 2 - %bool = OpTypeBool - %17 = OpConstantNull %bool - %18 = OpConstantNull %v2uint - %v2bool = OpTypeVector %bool 2 -%_ptr_Function_v2bool = OpTypePointer Function %v2bool - %22 = OpConstantNull %v2bool -%_ptr_Function_v2uint = OpTypePointer Function %v2uint - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_51b047 = OpFunction %void None %9 - %12 = OpLabel - %20 = OpVariable %_ptr_Function_v2bool Function %22 - %res = OpVariable %_ptr_Function_v2uint Function %18 - %23 = OpCompositeConstruct %v2bool %17 %17 - %13 = OpSelect %v2uint %23 %18 %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %select_51b047 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %select_51b047 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %38 = OpLabel - %39 = OpFunctionCall %void %select_51b047 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/51b047.wgsl.expected.wgsl b/test/tint/builtins/gen/select/51b047.wgsl.expected.wgsl deleted file mode 100644 index 93097d9a78..0000000000 --- a/test/tint/builtins/gen/select/51b047.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_51b047() { - var res : vec2 = select(vec2(), vec2(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_51b047(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_51b047(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_51b047(); -} diff --git a/test/tint/builtins/gen/select/713567.wgsl b/test/tint/builtins/gen/select/713567.wgsl deleted file mode 100644 index 3473d9f0c5..0000000000 --- a/test/tint/builtins/gen/select/713567.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<4, f32>, vec<4, f32>, bool) -> vec<4, f32> -fn select_713567() { - var res: vec4 = select(vec4(), vec4(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_713567(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_713567(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_713567(); -} diff --git a/test/tint/builtins/gen/select/713567.wgsl.expected.glsl b/test/tint/builtins/gen/select/713567.wgsl.expected.glsl deleted file mode 100644 index dacba9f26c..0000000000 --- a/test/tint/builtins/gen/select/713567.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_713567() { - vec4 res = (false ? vec4(0.0f, 0.0f, 0.0f, 0.0f) : vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - select_713567(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_713567() { - vec4 res = (false ? vec4(0.0f, 0.0f, 0.0f, 0.0f) : vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - select_713567(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_713567() { - vec4 res = (false ? vec4(0.0f, 0.0f, 0.0f, 0.0f) : vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - select_713567(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/713567.wgsl.expected.hlsl b/test/tint/builtins/gen/select/713567.wgsl.expected.hlsl deleted file mode 100644 index ee5426d729..0000000000 --- a/test/tint/builtins/gen/select/713567.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_713567() { - float4 res = (false ? float4(0.0f, 0.0f, 0.0f, 0.0f) : float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_713567(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_713567(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_713567(); - return; -} diff --git a/test/tint/builtins/gen/select/713567.wgsl.expected.msl b/test/tint/builtins/gen/select/713567.wgsl.expected.msl deleted file mode 100644 index 6767e85a83..0000000000 --- a/test/tint/builtins/gen/select/713567.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_713567() { - float4 res = select(float4(), float4(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_713567(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_713567(); - return; -} - -kernel void compute_main() { - select_713567(); - return; -} - diff --git a/test/tint/builtins/gen/select/713567.wgsl.expected.spvasm b/test/tint/builtins/gen/select/713567.wgsl.expected.spvasm deleted file mode 100644 index e4c5aca3c0..0000000000 --- a/test/tint/builtins/gen/select/713567.wgsl.expected.spvasm +++ /dev/null @@ -1,71 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 37 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_713567 "select_713567" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %15 = OpConstantNull %bool - %v4bool = OpTypeVector %bool 4 -%_ptr_Function_v4bool = OpTypePointer Function %v4bool - %19 = OpConstantNull %v4bool -%_ptr_Function_v4float = OpTypePointer Function %v4float - %23 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_713567 = OpFunction %void None %9 - %12 = OpLabel - %17 = OpVariable %_ptr_Function_v4bool Function %19 - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpCompositeConstruct %v4bool %15 %15 %15 %15 - %13 = OpSelect %v4float %20 %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %select_713567 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %select_713567 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %select_713567 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/713567.wgsl.expected.wgsl b/test/tint/builtins/gen/select/713567.wgsl.expected.wgsl deleted file mode 100644 index d885a74d64..0000000000 --- a/test/tint/builtins/gen/select/713567.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_713567() { - var res : vec4 = select(vec4(), vec4(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_713567(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_713567(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_713567(); -} diff --git a/test/tint/builtins/gen/select/78be5f.wgsl b/test/tint/builtins/gen/select/78be5f.wgsl deleted file mode 100644 index 3b95703cde..0000000000 --- a/test/tint/builtins/gen/select/78be5f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<3, f32>, vec<3, f32>, bool) -> vec<3, f32> -fn select_78be5f() { - var res: vec3 = select(vec3(), vec3(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_78be5f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_78be5f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_78be5f(); -} diff --git a/test/tint/builtins/gen/select/78be5f.wgsl.expected.glsl b/test/tint/builtins/gen/select/78be5f.wgsl.expected.glsl deleted file mode 100644 index cd0929d4fe..0000000000 --- a/test/tint/builtins/gen/select/78be5f.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_78be5f() { - vec3 res = (false ? vec3(0.0f, 0.0f, 0.0f) : vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - select_78be5f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_78be5f() { - vec3 res = (false ? vec3(0.0f, 0.0f, 0.0f) : vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - select_78be5f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_78be5f() { - vec3 res = (false ? vec3(0.0f, 0.0f, 0.0f) : vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - select_78be5f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/78be5f.wgsl.expected.hlsl b/test/tint/builtins/gen/select/78be5f.wgsl.expected.hlsl deleted file mode 100644 index bc48941f01..0000000000 --- a/test/tint/builtins/gen/select/78be5f.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_78be5f() { - float3 res = (false ? float3(0.0f, 0.0f, 0.0f) : float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_78be5f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_78be5f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_78be5f(); - return; -} diff --git a/test/tint/builtins/gen/select/78be5f.wgsl.expected.msl b/test/tint/builtins/gen/select/78be5f.wgsl.expected.msl deleted file mode 100644 index 8c39ad3b71..0000000000 --- a/test/tint/builtins/gen/select/78be5f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_78be5f() { - float3 res = select(float3(), float3(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_78be5f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_78be5f(); - return; -} - -kernel void compute_main() { - select_78be5f(); - return; -} - diff --git a/test/tint/builtins/gen/select/78be5f.wgsl.expected.spvasm b/test/tint/builtins/gen/select/78be5f.wgsl.expected.spvasm deleted file mode 100644 index 71a76039c5..0000000000 --- a/test/tint/builtins/gen/select/78be5f.wgsl.expected.spvasm +++ /dev/null @@ -1,73 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 39 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_78be5f "select_78be5f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %bool = OpTypeBool - %16 = OpConstantNull %bool - %17 = OpConstantNull %v3float - %v3bool = OpTypeVector %bool 3 -%_ptr_Function_v3bool = OpTypePointer Function %v3bool - %21 = OpConstantNull %v3bool -%_ptr_Function_v3float = OpTypePointer Function %v3float - %25 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_78be5f = OpFunction %void None %9 - %12 = OpLabel - %19 = OpVariable %_ptr_Function_v3bool Function %21 - %res = OpVariable %_ptr_Function_v3float Function %17 - %22 = OpCompositeConstruct %v3bool %16 %16 %16 - %13 = OpSelect %v3float %22 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %25 - %27 = OpLabel - %28 = OpFunctionCall %void %select_78be5f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %31 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_78be5f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %37 = OpLabel - %38 = OpFunctionCall %void %select_78be5f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/78be5f.wgsl.expected.wgsl b/test/tint/builtins/gen/select/78be5f.wgsl.expected.wgsl deleted file mode 100644 index 7c77d66daf..0000000000 --- a/test/tint/builtins/gen/select/78be5f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_78be5f() { - var res : vec3 = select(vec3(), vec3(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_78be5f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_78be5f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_78be5f(); -} diff --git a/test/tint/builtins/gen/select/80a9a9.wgsl b/test/tint/builtins/gen/select/80a9a9.wgsl deleted file mode 100644 index f24b7f63ee..0000000000 --- a/test/tint/builtins/gen/select/80a9a9.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<3, bool>, vec<3, bool>, vec<3, bool>) -> vec<3, bool> -fn select_80a9a9() { - var res: vec3 = select(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_80a9a9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_80a9a9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_80a9a9(); -} diff --git a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.glsl b/test/tint/builtins/gen/select/80a9a9.wgsl.expected.glsl deleted file mode 100644 index 24c5d96436..0000000000 --- a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_80a9a9() { - bvec3 res = mix(bvec3(false, false, false), bvec3(false, false, false), bvec3(false, false, false)); -} - -vec4 vertex_main() { - select_80a9a9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_80a9a9() { - bvec3 res = mix(bvec3(false, false, false), bvec3(false, false, false), bvec3(false, false, false)); -} - -void fragment_main() { - select_80a9a9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_80a9a9() { - bvec3 res = mix(bvec3(false, false, false), bvec3(false, false, false), bvec3(false, false, false)); -} - -void compute_main() { - select_80a9a9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.hlsl b/test/tint/builtins/gen/select/80a9a9.wgsl.expected.hlsl deleted file mode 100644 index c3071bb69c..0000000000 --- a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_80a9a9() { - bool3 res = (bool3(false, false, false) ? bool3(false, false, false) : bool3(false, false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_80a9a9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_80a9a9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_80a9a9(); - return; -} diff --git a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.msl b/test/tint/builtins/gen/select/80a9a9.wgsl.expected.msl deleted file mode 100644 index 37b2e99851..0000000000 --- a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_80a9a9() { - bool3 res = select(bool3(), bool3(), bool3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_80a9a9(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_80a9a9(); - return; -} - -kernel void compute_main() { - select_80a9a9(); - return; -} - diff --git a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.spvasm b/test/tint/builtins/gen/select/80a9a9.wgsl.expected.spvasm deleted file mode 100644 index bf4c72e7b2..0000000000 --- a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_80a9a9 "select_80a9a9" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %16 = OpConstantNull %v3bool -%_ptr_Function_v3bool = OpTypePointer Function %v3bool - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_80a9a9 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3bool Function %16 - %13 = OpSelect %v3bool %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %select_80a9a9 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %select_80a9a9 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_80a9a9 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.wgsl b/test/tint/builtins/gen/select/80a9a9.wgsl.expected.wgsl deleted file mode 100644 index 1f2b1fd8db..0000000000 --- a/test/tint/builtins/gen/select/80a9a9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_80a9a9() { - var res : vec3 = select(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_80a9a9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_80a9a9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_80a9a9(); -} diff --git a/test/tint/builtins/gen/select/8fa62c.wgsl b/test/tint/builtins/gen/select/8fa62c.wgsl deleted file mode 100644 index c5f67f32cd..0000000000 --- a/test/tint/builtins/gen/select/8fa62c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<3, i32>, vec<3, i32>, bool) -> vec<3, i32> -fn select_8fa62c() { - var res: vec3 = select(vec3(), vec3(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_8fa62c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_8fa62c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_8fa62c(); -} diff --git a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.glsl b/test/tint/builtins/gen/select/8fa62c.wgsl.expected.glsl deleted file mode 100644 index 90c713b864..0000000000 --- a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_8fa62c() { - ivec3 res = (false ? ivec3(0, 0, 0) : ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - select_8fa62c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_8fa62c() { - ivec3 res = (false ? ivec3(0, 0, 0) : ivec3(0, 0, 0)); -} - -void fragment_main() { - select_8fa62c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_8fa62c() { - ivec3 res = (false ? ivec3(0, 0, 0) : ivec3(0, 0, 0)); -} - -void compute_main() { - select_8fa62c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.hlsl b/test/tint/builtins/gen/select/8fa62c.wgsl.expected.hlsl deleted file mode 100644 index 2ec6462fd6..0000000000 --- a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_8fa62c() { - int3 res = (false ? int3(0, 0, 0) : int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_8fa62c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_8fa62c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_8fa62c(); - return; -} diff --git a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.msl b/test/tint/builtins/gen/select/8fa62c.wgsl.expected.msl deleted file mode 100644 index 4c9e887dc1..0000000000 --- a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_8fa62c() { - int3 res = select(int3(), int3(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_8fa62c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_8fa62c(); - return; -} - -kernel void compute_main() { - select_8fa62c(); - return; -} - diff --git a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.spvasm b/test/tint/builtins/gen/select/8fa62c.wgsl.expected.spvasm deleted file mode 100644 index a2ada450ed..0000000000 --- a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_8fa62c "select_8fa62c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %bool = OpTypeBool - %17 = OpConstantNull %bool - %18 = OpConstantNull %v3int - %v3bool = OpTypeVector %bool 3 -%_ptr_Function_v3bool = OpTypePointer Function %v3bool - %22 = OpConstantNull %v3bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_8fa62c = OpFunction %void None %9 - %12 = OpLabel - %20 = OpVariable %_ptr_Function_v3bool Function %22 - %res = OpVariable %_ptr_Function_v3int Function %18 - %23 = OpCompositeConstruct %v3bool %17 %17 %17 - %13 = OpSelect %v3int %23 %18 %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %select_8fa62c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %select_8fa62c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %38 = OpLabel - %39 = OpFunctionCall %void %select_8fa62c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.wgsl b/test/tint/builtins/gen/select/8fa62c.wgsl.expected.wgsl deleted file mode 100644 index 431824e250..0000000000 --- a/test/tint/builtins/gen/select/8fa62c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_8fa62c() { - var res : vec3 = select(vec3(), vec3(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_8fa62c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_8fa62c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_8fa62c(); -} diff --git a/test/tint/builtins/gen/select/99f883.wgsl b/test/tint/builtins/gen/select/99f883.wgsl deleted file mode 100644 index a292314c40..0000000000 --- a/test/tint/builtins/gen/select/99f883.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(u32, u32, bool) -> u32 -fn select_99f883() { - var res: u32 = select(1u, 1u, bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_99f883(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_99f883(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_99f883(); -} diff --git a/test/tint/builtins/gen/select/99f883.wgsl.expected.glsl b/test/tint/builtins/gen/select/99f883.wgsl.expected.glsl deleted file mode 100644 index d350453adb..0000000000 --- a/test/tint/builtins/gen/select/99f883.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_99f883() { - uint res = (false ? 1u : 1u); -} - -vec4 vertex_main() { - select_99f883(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_99f883() { - uint res = (false ? 1u : 1u); -} - -void fragment_main() { - select_99f883(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_99f883() { - uint res = (false ? 1u : 1u); -} - -void compute_main() { - select_99f883(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/99f883.wgsl.expected.hlsl b/test/tint/builtins/gen/select/99f883.wgsl.expected.hlsl deleted file mode 100644 index 603d18a30e..0000000000 --- a/test/tint/builtins/gen/select/99f883.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_99f883() { - uint res = (false ? 1u : 1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_99f883(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_99f883(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_99f883(); - return; -} diff --git a/test/tint/builtins/gen/select/99f883.wgsl.expected.msl b/test/tint/builtins/gen/select/99f883.wgsl.expected.msl deleted file mode 100644 index 4234994b3d..0000000000 --- a/test/tint/builtins/gen/select/99f883.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_99f883() { - uint res = select(1u, 1u, bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_99f883(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_99f883(); - return; -} - -kernel void compute_main() { - select_99f883(); - return; -} - diff --git a/test/tint/builtins/gen/select/99f883.wgsl.expected.spvasm b/test/tint/builtins/gen/select/99f883.wgsl.expected.spvasm deleted file mode 100644 index 9ef43b9bde..0000000000 --- a/test/tint/builtins/gen/select/99f883.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_99f883 "select_99f883" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %bool = OpTypeBool - %16 = OpConstantNull %bool - %uint_1 = OpConstant %uint 1 -%_ptr_Function_uint = OpTypePointer Function %uint - %20 = OpConstantNull %uint - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_99f883 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %20 - %13 = OpSelect %uint %16 %uint_1 %uint_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %select_99f883 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %select_99f883 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %select_99f883 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/99f883.wgsl.expected.wgsl b/test/tint/builtins/gen/select/99f883.wgsl.expected.wgsl deleted file mode 100644 index 0ceacc22c1..0000000000 --- a/test/tint/builtins/gen/select/99f883.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_99f883() { - var res : u32 = select(1u, 1u, bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_99f883(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_99f883(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_99f883(); -} diff --git a/test/tint/builtins/gen/select/a2860e.wgsl b/test/tint/builtins/gen/select/a2860e.wgsl deleted file mode 100644 index 0f8a6354cd..0000000000 --- a/test/tint/builtins/gen/select/a2860e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<4, i32>, vec<4, i32>, vec<4, bool>) -> vec<4, i32> -fn select_a2860e() { - var res: vec4 = select(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_a2860e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_a2860e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_a2860e(); -} diff --git a/test/tint/builtins/gen/select/a2860e.wgsl.expected.glsl b/test/tint/builtins/gen/select/a2860e.wgsl.expected.glsl deleted file mode 100644 index ff3793006f..0000000000 --- a/test/tint/builtins/gen/select/a2860e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_a2860e() { - ivec4 res = mix(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), bvec4(false, false, false, false)); -} - -vec4 vertex_main() { - select_a2860e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_a2860e() { - ivec4 res = mix(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), bvec4(false, false, false, false)); -} - -void fragment_main() { - select_a2860e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_a2860e() { - ivec4 res = mix(ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), bvec4(false, false, false, false)); -} - -void compute_main() { - select_a2860e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/a2860e.wgsl.expected.hlsl b/test/tint/builtins/gen/select/a2860e.wgsl.expected.hlsl deleted file mode 100644 index be8b47a10a..0000000000 --- a/test/tint/builtins/gen/select/a2860e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_a2860e() { - int4 res = (bool4(false, false, false, false) ? int4(0, 0, 0, 0) : int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_a2860e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_a2860e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_a2860e(); - return; -} diff --git a/test/tint/builtins/gen/select/a2860e.wgsl.expected.msl b/test/tint/builtins/gen/select/a2860e.wgsl.expected.msl deleted file mode 100644 index c3b3db641a..0000000000 --- a/test/tint/builtins/gen/select/a2860e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_a2860e() { - int4 res = select(int4(), int4(), bool4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_a2860e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_a2860e(); - return; -} - -kernel void compute_main() { - select_a2860e(); - return; -} - diff --git a/test/tint/builtins/gen/select/a2860e.wgsl.expected.spvasm b/test/tint/builtins/gen/select/a2860e.wgsl.expected.spvasm deleted file mode 100644 index 9dd2601bfd..0000000000 --- a/test/tint/builtins/gen/select/a2860e.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_a2860e "select_a2860e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %18 = OpConstantNull %v4bool - %19 = OpConstantNull %v4int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_a2860e = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %19 - %13 = OpSelect %v4int %18 %19 %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %select_a2860e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_a2860e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_a2860e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/a2860e.wgsl.expected.wgsl b/test/tint/builtins/gen/select/a2860e.wgsl.expected.wgsl deleted file mode 100644 index 0fd2eb4582..0000000000 --- a/test/tint/builtins/gen/select/a2860e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_a2860e() { - var res : vec4 = select(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_a2860e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_a2860e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_a2860e(); -} diff --git a/test/tint/builtins/gen/select/ab069f.wgsl b/test/tint/builtins/gen/select/ab069f.wgsl deleted file mode 100644 index d138d9e34e..0000000000 --- a/test/tint/builtins/gen/select/ab069f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<4, i32>, vec<4, i32>, bool) -> vec<4, i32> -fn select_ab069f() { - var res: vec4 = select(vec4(), vec4(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_ab069f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_ab069f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_ab069f(); -} diff --git a/test/tint/builtins/gen/select/ab069f.wgsl.expected.glsl b/test/tint/builtins/gen/select/ab069f.wgsl.expected.glsl deleted file mode 100644 index cc74ce9116..0000000000 --- a/test/tint/builtins/gen/select/ab069f.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_ab069f() { - ivec4 res = (false ? ivec4(0, 0, 0, 0) : ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - select_ab069f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_ab069f() { - ivec4 res = (false ? ivec4(0, 0, 0, 0) : ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - select_ab069f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_ab069f() { - ivec4 res = (false ? ivec4(0, 0, 0, 0) : ivec4(0, 0, 0, 0)); -} - -void compute_main() { - select_ab069f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/ab069f.wgsl.expected.hlsl b/test/tint/builtins/gen/select/ab069f.wgsl.expected.hlsl deleted file mode 100644 index 800300cd04..0000000000 --- a/test/tint/builtins/gen/select/ab069f.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_ab069f() { - int4 res = (false ? int4(0, 0, 0, 0) : int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_ab069f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_ab069f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_ab069f(); - return; -} diff --git a/test/tint/builtins/gen/select/ab069f.wgsl.expected.msl b/test/tint/builtins/gen/select/ab069f.wgsl.expected.msl deleted file mode 100644 index dd19206f24..0000000000 --- a/test/tint/builtins/gen/select/ab069f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_ab069f() { - int4 res = select(int4(), int4(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_ab069f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_ab069f(); - return; -} - -kernel void compute_main() { - select_ab069f(); - return; -} - diff --git a/test/tint/builtins/gen/select/ab069f.wgsl.expected.spvasm b/test/tint/builtins/gen/select/ab069f.wgsl.expected.spvasm deleted file mode 100644 index 76d001f2cb..0000000000 --- a/test/tint/builtins/gen/select/ab069f.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_ab069f "select_ab069f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v4int = OpTypeVector %int 4 - %bool = OpTypeBool - %17 = OpConstantNull %bool - %18 = OpConstantNull %v4int - %v4bool = OpTypeVector %bool 4 -%_ptr_Function_v4bool = OpTypePointer Function %v4bool - %22 = OpConstantNull %v4bool -%_ptr_Function_v4int = OpTypePointer Function %v4int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_ab069f = OpFunction %void None %9 - %12 = OpLabel - %20 = OpVariable %_ptr_Function_v4bool Function %22 - %res = OpVariable %_ptr_Function_v4int Function %18 - %23 = OpCompositeConstruct %v4bool %17 %17 %17 %17 - %13 = OpSelect %v4int %23 %18 %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %select_ab069f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %select_ab069f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %38 = OpLabel - %39 = OpFunctionCall %void %select_ab069f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/ab069f.wgsl.expected.wgsl b/test/tint/builtins/gen/select/ab069f.wgsl.expected.wgsl deleted file mode 100644 index ea18846058..0000000000 --- a/test/tint/builtins/gen/select/ab069f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_ab069f() { - var res : vec4 = select(vec4(), vec4(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_ab069f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_ab069f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_ab069f(); -} diff --git a/test/tint/builtins/gen/select/b04721.wgsl b/test/tint/builtins/gen/select/b04721.wgsl deleted file mode 100644 index 7f084562de..0000000000 --- a/test/tint/builtins/gen/select/b04721.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<3, u32>, vec<3, u32>, bool) -> vec<3, u32> -fn select_b04721() { - var res: vec3 = select(vec3(), vec3(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_b04721(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_b04721(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_b04721(); -} diff --git a/test/tint/builtins/gen/select/b04721.wgsl.expected.glsl b/test/tint/builtins/gen/select/b04721.wgsl.expected.glsl deleted file mode 100644 index e298fb7b19..0000000000 --- a/test/tint/builtins/gen/select/b04721.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_b04721() { - uvec3 res = (false ? uvec3(0u, 0u, 0u) : uvec3(0u, 0u, 0u)); -} - -vec4 vertex_main() { - select_b04721(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_b04721() { - uvec3 res = (false ? uvec3(0u, 0u, 0u) : uvec3(0u, 0u, 0u)); -} - -void fragment_main() { - select_b04721(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_b04721() { - uvec3 res = (false ? uvec3(0u, 0u, 0u) : uvec3(0u, 0u, 0u)); -} - -void compute_main() { - select_b04721(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/b04721.wgsl.expected.hlsl b/test/tint/builtins/gen/select/b04721.wgsl.expected.hlsl deleted file mode 100644 index 030d20546c..0000000000 --- a/test/tint/builtins/gen/select/b04721.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_b04721() { - uint3 res = (false ? uint3(0u, 0u, 0u) : uint3(0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_b04721(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_b04721(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_b04721(); - return; -} diff --git a/test/tint/builtins/gen/select/b04721.wgsl.expected.msl b/test/tint/builtins/gen/select/b04721.wgsl.expected.msl deleted file mode 100644 index 2b88455ccc..0000000000 --- a/test/tint/builtins/gen/select/b04721.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_b04721() { - uint3 res = select(uint3(), uint3(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_b04721(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_b04721(); - return; -} - -kernel void compute_main() { - select_b04721(); - return; -} - diff --git a/test/tint/builtins/gen/select/b04721.wgsl.expected.spvasm b/test/tint/builtins/gen/select/b04721.wgsl.expected.spvasm deleted file mode 100644 index 7324fa3943..0000000000 --- a/test/tint/builtins/gen/select/b04721.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_b04721 "select_b04721" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 - %bool = OpTypeBool - %17 = OpConstantNull %bool - %18 = OpConstantNull %v3uint - %v3bool = OpTypeVector %bool 3 -%_ptr_Function_v3bool = OpTypePointer Function %v3bool - %22 = OpConstantNull %v3bool -%_ptr_Function_v3uint = OpTypePointer Function %v3uint - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_b04721 = OpFunction %void None %9 - %12 = OpLabel - %20 = OpVariable %_ptr_Function_v3bool Function %22 - %res = OpVariable %_ptr_Function_v3uint Function %18 - %23 = OpCompositeConstruct %v3bool %17 %17 %17 - %13 = OpSelect %v3uint %23 %18 %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %select_b04721 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %select_b04721 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %38 = OpLabel - %39 = OpFunctionCall %void %select_b04721 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/b04721.wgsl.expected.wgsl b/test/tint/builtins/gen/select/b04721.wgsl.expected.wgsl deleted file mode 100644 index 86befd9f05..0000000000 --- a/test/tint/builtins/gen/select/b04721.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_b04721() { - var res : vec3 = select(vec3(), vec3(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_b04721(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_b04721(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_b04721(); -} diff --git a/test/tint/builtins/gen/select/bb447f.wgsl b/test/tint/builtins/gen/select/bb447f.wgsl deleted file mode 100644 index 4ad509c0c9..0000000000 --- a/test/tint/builtins/gen/select/bb447f.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<2, i32>, vec<2, i32>, bool) -> vec<2, i32> -fn select_bb447f() { - var res: vec2 = select(vec2(), vec2(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_bb447f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_bb447f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_bb447f(); -} diff --git a/test/tint/builtins/gen/select/bb447f.wgsl.expected.glsl b/test/tint/builtins/gen/select/bb447f.wgsl.expected.glsl deleted file mode 100644 index 2f55379f70..0000000000 --- a/test/tint/builtins/gen/select/bb447f.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_bb447f() { - ivec2 res = (false ? ivec2(0, 0) : ivec2(0, 0)); -} - -vec4 vertex_main() { - select_bb447f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_bb447f() { - ivec2 res = (false ? ivec2(0, 0) : ivec2(0, 0)); -} - -void fragment_main() { - select_bb447f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_bb447f() { - ivec2 res = (false ? ivec2(0, 0) : ivec2(0, 0)); -} - -void compute_main() { - select_bb447f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/bb447f.wgsl.expected.hlsl b/test/tint/builtins/gen/select/bb447f.wgsl.expected.hlsl deleted file mode 100644 index 079cec6b21..0000000000 --- a/test/tint/builtins/gen/select/bb447f.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_bb447f() { - int2 res = (false ? int2(0, 0) : int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_bb447f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_bb447f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_bb447f(); - return; -} diff --git a/test/tint/builtins/gen/select/bb447f.wgsl.expected.msl b/test/tint/builtins/gen/select/bb447f.wgsl.expected.msl deleted file mode 100644 index d1517c9e9a..0000000000 --- a/test/tint/builtins/gen/select/bb447f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_bb447f() { - int2 res = select(int2(), int2(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_bb447f(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_bb447f(); - return; -} - -kernel void compute_main() { - select_bb447f(); - return; -} - diff --git a/test/tint/builtins/gen/select/bb447f.wgsl.expected.spvasm b/test/tint/builtins/gen/select/bb447f.wgsl.expected.spvasm deleted file mode 100644 index 95805066ea..0000000000 --- a/test/tint/builtins/gen/select/bb447f.wgsl.expected.spvasm +++ /dev/null @@ -1,74 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_bb447f "select_bb447f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %bool = OpTypeBool - %17 = OpConstantNull %bool - %18 = OpConstantNull %v2int - %v2bool = OpTypeVector %bool 2 -%_ptr_Function_v2bool = OpTypePointer Function %v2bool - %22 = OpConstantNull %v2bool -%_ptr_Function_v2int = OpTypePointer Function %v2int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_bb447f = OpFunction %void None %9 - %12 = OpLabel - %20 = OpVariable %_ptr_Function_v2bool Function %22 - %res = OpVariable %_ptr_Function_v2int Function %18 - %23 = OpCompositeConstruct %v2bool %17 %17 - %13 = OpSelect %v2int %23 %18 %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %select_bb447f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %35 = OpLabel - %36 = OpFunctionCall %void %select_bb447f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %38 = OpLabel - %39 = OpFunctionCall %void %select_bb447f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/bb447f.wgsl.expected.wgsl b/test/tint/builtins/gen/select/bb447f.wgsl.expected.wgsl deleted file mode 100644 index 2ea72e7132..0000000000 --- a/test/tint/builtins/gen/select/bb447f.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_bb447f() { - var res : vec2 = select(vec2(), vec2(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_bb447f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_bb447f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_bb447f(); -} diff --git a/test/tint/builtins/gen/select/bb8aae.wgsl b/test/tint/builtins/gen/select/bb8aae.wgsl deleted file mode 100644 index f8ea5558b9..0000000000 --- a/test/tint/builtins/gen/select/bb8aae.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<4, f32>, vec<4, f32>, vec<4, bool>) -> vec<4, f32> -fn select_bb8aae() { - var res: vec4 = select(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_bb8aae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_bb8aae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_bb8aae(); -} diff --git a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.glsl b/test/tint/builtins/gen/select/bb8aae.wgsl.expected.glsl deleted file mode 100644 index 37dcbd4d88..0000000000 --- a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_bb8aae() { - vec4 res = mix(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), bvec4(false, false, false, false)); -} - -vec4 vertex_main() { - select_bb8aae(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_bb8aae() { - vec4 res = mix(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), bvec4(false, false, false, false)); -} - -void fragment_main() { - select_bb8aae(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_bb8aae() { - vec4 res = mix(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), bvec4(false, false, false, false)); -} - -void compute_main() { - select_bb8aae(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.hlsl b/test/tint/builtins/gen/select/bb8aae.wgsl.expected.hlsl deleted file mode 100644 index 3c84b8fee7..0000000000 --- a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_bb8aae() { - float4 res = (bool4(false, false, false, false) ? float4(0.0f, 0.0f, 0.0f, 0.0f) : float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_bb8aae(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_bb8aae(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_bb8aae(); - return; -} diff --git a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.msl b/test/tint/builtins/gen/select/bb8aae.wgsl.expected.msl deleted file mode 100644 index 67c11796dd..0000000000 --- a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_bb8aae() { - float4 res = select(float4(), float4(), bool4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_bb8aae(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_bb8aae(); - return; -} - -kernel void compute_main() { - select_bb8aae(); - return; -} - diff --git a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.spvasm b/test/tint/builtins/gen/select/bb8aae.wgsl.expected.spvasm deleted file mode 100644 index 29dc265f8c..0000000000 --- a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_bb8aae "select_bb8aae" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %16 = OpConstantNull %v4bool -%_ptr_Function_v4float = OpTypePointer Function %v4float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_bb8aae = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpSelect %v4float %16 %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %select_bb8aae - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %select_bb8aae - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_bb8aae - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.wgsl b/test/tint/builtins/gen/select/bb8aae.wgsl.expected.wgsl deleted file mode 100644 index f64a61b7dc..0000000000 --- a/test/tint/builtins/gen/select/bb8aae.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_bb8aae() { - var res : vec4 = select(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_bb8aae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_bb8aae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_bb8aae(); -} diff --git a/test/tint/builtins/gen/select/bf3d29.wgsl b/test/tint/builtins/gen/select/bf3d29.wgsl deleted file mode 100644 index 411feeb1d7..0000000000 --- a/test/tint/builtins/gen/select/bf3d29.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<2, f32>, vec<2, f32>, bool) -> vec<2, f32> -fn select_bf3d29() { - var res: vec2 = select(vec2(), vec2(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_bf3d29(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_bf3d29(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_bf3d29(); -} diff --git a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.glsl b/test/tint/builtins/gen/select/bf3d29.wgsl.expected.glsl deleted file mode 100644 index 044786b710..0000000000 --- a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_bf3d29() { - vec2 res = (false ? vec2(0.0f, 0.0f) : vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - select_bf3d29(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_bf3d29() { - vec2 res = (false ? vec2(0.0f, 0.0f) : vec2(0.0f, 0.0f)); -} - -void fragment_main() { - select_bf3d29(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_bf3d29() { - vec2 res = (false ? vec2(0.0f, 0.0f) : vec2(0.0f, 0.0f)); -} - -void compute_main() { - select_bf3d29(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.hlsl b/test/tint/builtins/gen/select/bf3d29.wgsl.expected.hlsl deleted file mode 100644 index fcfca7deaf..0000000000 --- a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_bf3d29() { - float2 res = (false ? float2(0.0f, 0.0f) : float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_bf3d29(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_bf3d29(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_bf3d29(); - return; -} diff --git a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.msl b/test/tint/builtins/gen/select/bf3d29.wgsl.expected.msl deleted file mode 100644 index af8a59e521..0000000000 --- a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_bf3d29() { - float2 res = select(float2(), float2(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_bf3d29(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_bf3d29(); - return; -} - -kernel void compute_main() { - select_bf3d29(); - return; -} - diff --git a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.spvasm b/test/tint/builtins/gen/select/bf3d29.wgsl.expected.spvasm deleted file mode 100644 index accad0cf26..0000000000 --- a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.spvasm +++ /dev/null @@ -1,73 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 39 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_bf3d29 "select_bf3d29" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %bool = OpTypeBool - %16 = OpConstantNull %bool - %17 = OpConstantNull %v2float - %v2bool = OpTypeVector %bool 2 -%_ptr_Function_v2bool = OpTypePointer Function %v2bool - %21 = OpConstantNull %v2bool -%_ptr_Function_v2float = OpTypePointer Function %v2float - %25 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_bf3d29 = OpFunction %void None %9 - %12 = OpLabel - %19 = OpVariable %_ptr_Function_v2bool Function %21 - %res = OpVariable %_ptr_Function_v2float Function %17 - %22 = OpCompositeConstruct %v2bool %16 %16 - %13 = OpSelect %v2float %22 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %25 - %27 = OpLabel - %28 = OpFunctionCall %void %select_bf3d29 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %31 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_bf3d29 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %37 = OpLabel - %38 = OpFunctionCall %void %select_bf3d29 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.wgsl b/test/tint/builtins/gen/select/bf3d29.wgsl.expected.wgsl deleted file mode 100644 index 87b2f80aab..0000000000 --- a/test/tint/builtins/gen/select/bf3d29.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_bf3d29() { - var res : vec2 = select(vec2(), vec2(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_bf3d29(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_bf3d29(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_bf3d29(); -} diff --git a/test/tint/builtins/gen/select/c31f9e.wgsl b/test/tint/builtins/gen/select/c31f9e.wgsl deleted file mode 100644 index 90cd213202..0000000000 --- a/test/tint/builtins/gen/select/c31f9e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(bool, bool, bool) -> bool -fn select_c31f9e() { - var res: bool = select(bool(), bool(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_c31f9e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_c31f9e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_c31f9e(); -} diff --git a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.glsl b/test/tint/builtins/gen/select/c31f9e.wgsl.expected.glsl deleted file mode 100644 index fdea060259..0000000000 --- a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_c31f9e() { - bool res = (false ? false : false); -} - -vec4 vertex_main() { - select_c31f9e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_c31f9e() { - bool res = (false ? false : false); -} - -void fragment_main() { - select_c31f9e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_c31f9e() { - bool res = (false ? false : false); -} - -void compute_main() { - select_c31f9e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.hlsl b/test/tint/builtins/gen/select/c31f9e.wgsl.expected.hlsl deleted file mode 100644 index 9cf520f914..0000000000 --- a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_c31f9e() { - bool res = (false ? false : false); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_c31f9e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_c31f9e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_c31f9e(); - return; -} diff --git a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.msl b/test/tint/builtins/gen/select/c31f9e.wgsl.expected.msl deleted file mode 100644 index 8e2a3b42e2..0000000000 --- a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_c31f9e() { - bool res = select(bool(), bool(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_c31f9e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_c31f9e(); - return; -} - -kernel void compute_main() { - select_c31f9e(); - return; -} - diff --git a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.spvasm b/test/tint/builtins/gen/select/c31f9e.wgsl.expected.spvasm deleted file mode 100644 index 5091beb663..0000000000 --- a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.spvasm +++ /dev/null @@ -1,66 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_c31f9e "select_c31f9e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %15 = OpConstantNull %bool -%_ptr_Function_bool = OpTypePointer Function %bool - %18 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_c31f9e = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_bool Function %15 - %13 = OpSelect %bool %15 %15 %15 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %select_c31f9e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %select_c31f9e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %select_c31f9e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.wgsl b/test/tint/builtins/gen/select/c31f9e.wgsl.expected.wgsl deleted file mode 100644 index 21acae64ef..0000000000 --- a/test/tint/builtins/gen/select/c31f9e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_c31f9e() { - var res : bool = select(bool(), bool(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_c31f9e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_c31f9e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_c31f9e(); -} diff --git a/test/tint/builtins/gen/select/c41bd1.wgsl b/test/tint/builtins/gen/select/c41bd1.wgsl deleted file mode 100644 index fe6b19c428..0000000000 --- a/test/tint/builtins/gen/select/c41bd1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<4, bool>, vec<4, bool>, bool) -> vec<4, bool> -fn select_c41bd1() { - var res: vec4 = select(vec4(), vec4(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_c41bd1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_c41bd1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_c41bd1(); -} diff --git a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.glsl b/test/tint/builtins/gen/select/c41bd1.wgsl.expected.glsl deleted file mode 100644 index a774905de0..0000000000 --- a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_c41bd1() { - bvec4 res = (false ? bvec4(false, false, false, false) : bvec4(false, false, false, false)); -} - -vec4 vertex_main() { - select_c41bd1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_c41bd1() { - bvec4 res = (false ? bvec4(false, false, false, false) : bvec4(false, false, false, false)); -} - -void fragment_main() { - select_c41bd1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_c41bd1() { - bvec4 res = (false ? bvec4(false, false, false, false) : bvec4(false, false, false, false)); -} - -void compute_main() { - select_c41bd1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.hlsl b/test/tint/builtins/gen/select/c41bd1.wgsl.expected.hlsl deleted file mode 100644 index d5e8edc350..0000000000 --- a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_c41bd1() { - bool4 res = (false ? bool4(false, false, false, false) : bool4(false, false, false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_c41bd1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_c41bd1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_c41bd1(); - return; -} diff --git a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.msl b/test/tint/builtins/gen/select/c41bd1.wgsl.expected.msl deleted file mode 100644 index a344539080..0000000000 --- a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_c41bd1() { - bool4 res = select(bool4(), bool4(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_c41bd1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_c41bd1(); - return; -} - -kernel void compute_main() { - select_c41bd1(); - return; -} - diff --git a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.spvasm b/test/tint/builtins/gen/select/c41bd1.wgsl.expected.spvasm deleted file mode 100644 index 8c3b9ef3b3..0000000000 --- a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_c41bd1 "select_c41bd1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %16 = OpConstantNull %bool - %17 = OpConstantNull %v4bool -%_ptr_Function_v4bool = OpTypePointer Function %v4bool - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_c41bd1 = OpFunction %void None %9 - %12 = OpLabel - %18 = OpVariable %_ptr_Function_v4bool Function %17 - %res = OpVariable %_ptr_Function_v4bool Function %17 - %20 = OpCompositeConstruct %v4bool %16 %16 %16 %16 - %13 = OpSelect %v4bool %20 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %select_c41bd1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_c41bd1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_c41bd1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/select/c41bd1.wgsl.expected.wgsl deleted file mode 100644 index a314f0c2b4..0000000000 --- a/test/tint/builtins/gen/select/c41bd1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_c41bd1() { - var res : vec4 = select(vec4(), vec4(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_c41bd1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_c41bd1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_c41bd1(); -} diff --git a/test/tint/builtins/gen/select/c4a4ef.wgsl b/test/tint/builtins/gen/select/c4a4ef.wgsl deleted file mode 100644 index 36d6fe1885..0000000000 --- a/test/tint/builtins/gen/select/c4a4ef.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<4, u32>, vec<4, u32>, vec<4, bool>) -> vec<4, u32> -fn select_c4a4ef() { - var res: vec4 = select(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_c4a4ef(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_c4a4ef(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_c4a4ef(); -} diff --git a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.glsl b/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.glsl deleted file mode 100644 index 5fe820ec81..0000000000 --- a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_c4a4ef() { - uvec4 res = mix(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u), bvec4(false, false, false, false)); -} - -vec4 vertex_main() { - select_c4a4ef(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_c4a4ef() { - uvec4 res = mix(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u), bvec4(false, false, false, false)); -} - -void fragment_main() { - select_c4a4ef(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_c4a4ef() { - uvec4 res = mix(uvec4(0u, 0u, 0u, 0u), uvec4(0u, 0u, 0u, 0u), bvec4(false, false, false, false)); -} - -void compute_main() { - select_c4a4ef(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.hlsl b/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.hlsl deleted file mode 100644 index ef96f44463..0000000000 --- a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_c4a4ef() { - uint4 res = (bool4(false, false, false, false) ? uint4(0u, 0u, 0u, 0u) : uint4(0u, 0u, 0u, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_c4a4ef(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_c4a4ef(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_c4a4ef(); - return; -} diff --git a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.msl b/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.msl deleted file mode 100644 index 69830334c2..0000000000 --- a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_c4a4ef() { - uint4 res = select(uint4(), uint4(), bool4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_c4a4ef(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_c4a4ef(); - return; -} - -kernel void compute_main() { - select_c4a4ef(); - return; -} - diff --git a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.spvasm deleted file mode 100644 index c4eff67b69..0000000000 --- a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_c4a4ef "select_c4a4ef" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %v4uint = OpTypeVector %uint 4 - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %18 = OpConstantNull %v4bool - %19 = OpConstantNull %v4uint -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_c4a4ef = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %19 - %13 = OpSelect %v4uint %18 %19 %19 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %select_c4a4ef - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_c4a4ef - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_c4a4ef - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.wgsl deleted file mode 100644 index adbcc5ddff..0000000000 --- a/test/tint/builtins/gen/select/c4a4ef.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_c4a4ef() { - var res : vec4 = select(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_c4a4ef(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_c4a4ef(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_c4a4ef(); -} diff --git a/test/tint/builtins/gen/select/cb9301.wgsl b/test/tint/builtins/gen/select/cb9301.wgsl deleted file mode 100644 index 90deaf256b..0000000000 --- a/test/tint/builtins/gen/select/cb9301.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<2, bool>, vec<2, bool>, vec<2, bool>) -> vec<2, bool> -fn select_cb9301() { - var res: vec2 = select(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_cb9301(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_cb9301(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_cb9301(); -} diff --git a/test/tint/builtins/gen/select/cb9301.wgsl.expected.glsl b/test/tint/builtins/gen/select/cb9301.wgsl.expected.glsl deleted file mode 100644 index 8c3c713f55..0000000000 --- a/test/tint/builtins/gen/select/cb9301.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_cb9301() { - bvec2 res = mix(bvec2(false, false), bvec2(false, false), bvec2(false, false)); -} - -vec4 vertex_main() { - select_cb9301(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_cb9301() { - bvec2 res = mix(bvec2(false, false), bvec2(false, false), bvec2(false, false)); -} - -void fragment_main() { - select_cb9301(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_cb9301() { - bvec2 res = mix(bvec2(false, false), bvec2(false, false), bvec2(false, false)); -} - -void compute_main() { - select_cb9301(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/cb9301.wgsl.expected.hlsl b/test/tint/builtins/gen/select/cb9301.wgsl.expected.hlsl deleted file mode 100644 index 27eeed4527..0000000000 --- a/test/tint/builtins/gen/select/cb9301.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_cb9301() { - bool2 res = (bool2(false, false) ? bool2(false, false) : bool2(false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_cb9301(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_cb9301(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_cb9301(); - return; -} diff --git a/test/tint/builtins/gen/select/cb9301.wgsl.expected.msl b/test/tint/builtins/gen/select/cb9301.wgsl.expected.msl deleted file mode 100644 index 3854184a2f..0000000000 --- a/test/tint/builtins/gen/select/cb9301.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_cb9301() { - bool2 res = select(bool2(), bool2(), bool2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_cb9301(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_cb9301(); - return; -} - -kernel void compute_main() { - select_cb9301(); - return; -} - diff --git a/test/tint/builtins/gen/select/cb9301.wgsl.expected.spvasm b/test/tint/builtins/gen/select/cb9301.wgsl.expected.spvasm deleted file mode 100644 index 8a86fc95ff..0000000000 --- a/test/tint/builtins/gen/select/cb9301.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_cb9301 "select_cb9301" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %16 = OpConstantNull %v2bool -%_ptr_Function_v2bool = OpTypePointer Function %v2bool - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_cb9301 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2bool Function %16 - %13 = OpSelect %v2bool %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %select_cb9301 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %select_cb9301 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_cb9301 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/cb9301.wgsl.expected.wgsl b/test/tint/builtins/gen/select/cb9301.wgsl.expected.wgsl deleted file mode 100644 index 7c85dad3e3..0000000000 --- a/test/tint/builtins/gen/select/cb9301.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_cb9301() { - var res : vec2 = select(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_cb9301(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_cb9301(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_cb9301(); -} diff --git a/test/tint/builtins/gen/select/e3e028.wgsl b/test/tint/builtins/gen/select/e3e028.wgsl deleted file mode 100644 index d1fc18e461..0000000000 --- a/test/tint/builtins/gen/select/e3e028.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<4, bool>, vec<4, bool>, vec<4, bool>) -> vec<4, bool> -fn select_e3e028() { - var res: vec4 = select(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_e3e028(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_e3e028(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_e3e028(); -} diff --git a/test/tint/builtins/gen/select/e3e028.wgsl.expected.glsl b/test/tint/builtins/gen/select/e3e028.wgsl.expected.glsl deleted file mode 100644 index 05672dfb20..0000000000 --- a/test/tint/builtins/gen/select/e3e028.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_e3e028() { - bvec4 res = mix(bvec4(false, false, false, false), bvec4(false, false, false, false), bvec4(false, false, false, false)); -} - -vec4 vertex_main() { - select_e3e028(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_e3e028() { - bvec4 res = mix(bvec4(false, false, false, false), bvec4(false, false, false, false), bvec4(false, false, false, false)); -} - -void fragment_main() { - select_e3e028(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_e3e028() { - bvec4 res = mix(bvec4(false, false, false, false), bvec4(false, false, false, false), bvec4(false, false, false, false)); -} - -void compute_main() { - select_e3e028(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/e3e028.wgsl.expected.hlsl b/test/tint/builtins/gen/select/e3e028.wgsl.expected.hlsl deleted file mode 100644 index 20e3edf10f..0000000000 --- a/test/tint/builtins/gen/select/e3e028.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_e3e028() { - bool4 res = (bool4(false, false, false, false) ? bool4(false, false, false, false) : bool4(false, false, false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_e3e028(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_e3e028(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_e3e028(); - return; -} diff --git a/test/tint/builtins/gen/select/e3e028.wgsl.expected.msl b/test/tint/builtins/gen/select/e3e028.wgsl.expected.msl deleted file mode 100644 index 6ea09b4777..0000000000 --- a/test/tint/builtins/gen/select/e3e028.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_e3e028() { - bool4 res = select(bool4(), bool4(), bool4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_e3e028(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_e3e028(); - return; -} - -kernel void compute_main() { - select_e3e028(); - return; -} - diff --git a/test/tint/builtins/gen/select/e3e028.wgsl.expected.spvasm b/test/tint/builtins/gen/select/e3e028.wgsl.expected.spvasm deleted file mode 100644 index 259f9c0cec..0000000000 --- a/test/tint/builtins/gen/select/e3e028.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_e3e028 "select_e3e028" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v4bool = OpTypeVector %bool 4 - %16 = OpConstantNull %v4bool -%_ptr_Function_v4bool = OpTypePointer Function %v4bool - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_e3e028 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4bool Function %16 - %13 = OpSelect %v4bool %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %select_e3e028 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %select_e3e028 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_e3e028 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/e3e028.wgsl.expected.wgsl b/test/tint/builtins/gen/select/e3e028.wgsl.expected.wgsl deleted file mode 100644 index 2794266003..0000000000 --- a/test/tint/builtins/gen/select/e3e028.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_e3e028() { - var res : vec4 = select(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_e3e028(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_e3e028(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_e3e028(); -} diff --git a/test/tint/builtins/gen/select/ebfea2.wgsl b/test/tint/builtins/gen/select/ebfea2.wgsl deleted file mode 100644 index 24056f3182..0000000000 --- a/test/tint/builtins/gen/select/ebfea2.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<3, f32>, vec<3, f32>, vec<3, bool>) -> vec<3, f32> -fn select_ebfea2() { - var res: vec3 = select(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_ebfea2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_ebfea2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_ebfea2(); -} diff --git a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.glsl b/test/tint/builtins/gen/select/ebfea2.wgsl.expected.glsl deleted file mode 100644 index d0ed643e0b..0000000000 --- a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_ebfea2() { - vec3 res = mix(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), bvec3(false, false, false)); -} - -vec4 vertex_main() { - select_ebfea2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_ebfea2() { - vec3 res = mix(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), bvec3(false, false, false)); -} - -void fragment_main() { - select_ebfea2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_ebfea2() { - vec3 res = mix(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), bvec3(false, false, false)); -} - -void compute_main() { - select_ebfea2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.hlsl b/test/tint/builtins/gen/select/ebfea2.wgsl.expected.hlsl deleted file mode 100644 index 8dd54f2bab..0000000000 --- a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_ebfea2() { - float3 res = (bool3(false, false, false) ? float3(0.0f, 0.0f, 0.0f) : float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_ebfea2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_ebfea2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_ebfea2(); - return; -} diff --git a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.msl b/test/tint/builtins/gen/select/ebfea2.wgsl.expected.msl deleted file mode 100644 index ad19ed3f8d..0000000000 --- a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_ebfea2() { - float3 res = select(float3(), float3(), bool3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_ebfea2(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_ebfea2(); - return; -} - -kernel void compute_main() { - select_ebfea2(); - return; -} - diff --git a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.spvasm b/test/tint/builtins/gen/select/ebfea2.wgsl.expected.spvasm deleted file mode 100644 index 60a799fd61..0000000000 --- a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_ebfea2 "select_ebfea2" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 - %17 = OpConstantNull %v3bool - %18 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_ebfea2 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %18 - %13 = OpSelect %v3float %17 %18 %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %select_ebfea2 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %select_ebfea2 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %select_ebfea2 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.wgsl b/test/tint/builtins/gen/select/ebfea2.wgsl.expected.wgsl deleted file mode 100644 index c1815851cb..0000000000 --- a/test/tint/builtins/gen/select/ebfea2.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_ebfea2() { - var res : vec3 = select(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_ebfea2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_ebfea2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_ebfea2(); -} diff --git a/test/tint/builtins/gen/select/ed8a15.wgsl b/test/tint/builtins/gen/select/ed8a15.wgsl deleted file mode 100644 index 10986bf66c..0000000000 --- a/test/tint/builtins/gen/select/ed8a15.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(i32, i32, bool) -> i32 -fn select_ed8a15() { - var res: i32 = select(1, 1, bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_ed8a15(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_ed8a15(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_ed8a15(); -} diff --git a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.glsl b/test/tint/builtins/gen/select/ed8a15.wgsl.expected.glsl deleted file mode 100644 index 1bb14855c0..0000000000 --- a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_ed8a15() { - int res = (false ? 1 : 1); -} - -vec4 vertex_main() { - select_ed8a15(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_ed8a15() { - int res = (false ? 1 : 1); -} - -void fragment_main() { - select_ed8a15(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_ed8a15() { - int res = (false ? 1 : 1); -} - -void compute_main() { - select_ed8a15(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.hlsl b/test/tint/builtins/gen/select/ed8a15.wgsl.expected.hlsl deleted file mode 100644 index e550b588c6..0000000000 --- a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_ed8a15() { - int res = (false ? 1 : 1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_ed8a15(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_ed8a15(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_ed8a15(); - return; -} diff --git a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.msl b/test/tint/builtins/gen/select/ed8a15.wgsl.expected.msl deleted file mode 100644 index 86b86d5262..0000000000 --- a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_ed8a15() { - int res = select(1, 1, bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_ed8a15(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_ed8a15(); - return; -} - -kernel void compute_main() { - select_ed8a15(); - return; -} - diff --git a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.spvasm b/test/tint/builtins/gen/select/ed8a15.wgsl.expected.spvasm deleted file mode 100644 index 259b51d11d..0000000000 --- a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_ed8a15 "select_ed8a15" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %bool = OpTypeBool - %16 = OpConstantNull %bool - %int_1 = OpConstant %int 1 -%_ptr_Function_int = OpTypePointer Function %int - %20 = OpConstantNull %int - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_ed8a15 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_int Function %20 - %13 = OpSelect %int %16 %int_1 %int_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %select_ed8a15 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %select_ed8a15 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %select_ed8a15 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.wgsl b/test/tint/builtins/gen/select/ed8a15.wgsl.expected.wgsl deleted file mode 100644 index ca4b96e16f..0000000000 --- a/test/tint/builtins/gen/select/ed8a15.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_ed8a15() { - var res : i32 = select(1, 1, bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_ed8a15(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_ed8a15(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_ed8a15(); -} diff --git a/test/tint/builtins/gen/select/fb7e53.wgsl b/test/tint/builtins/gen/select/fb7e53.wgsl deleted file mode 100644 index f81d8df49d..0000000000 --- a/test/tint/builtins/gen/select/fb7e53.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn select(vec<2, bool>, vec<2, bool>, bool) -> vec<2, bool> -fn select_fb7e53() { - var res: vec2 = select(vec2(), vec2(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_fb7e53(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_fb7e53(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_fb7e53(); -} diff --git a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.glsl b/test/tint/builtins/gen/select/fb7e53.wgsl.expected.glsl deleted file mode 100644 index 8bcca303a0..0000000000 --- a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void select_fb7e53() { - bvec2 res = (false ? bvec2(false, false) : bvec2(false, false)); -} - -vec4 vertex_main() { - select_fb7e53(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void select_fb7e53() { - bvec2 res = (false ? bvec2(false, false) : bvec2(false, false)); -} - -void fragment_main() { - select_fb7e53(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void select_fb7e53() { - bvec2 res = (false ? bvec2(false, false) : bvec2(false, false)); -} - -void compute_main() { - select_fb7e53(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.hlsl b/test/tint/builtins/gen/select/fb7e53.wgsl.expected.hlsl deleted file mode 100644 index 05fa3bc1ac..0000000000 --- a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void select_fb7e53() { - bool2 res = (false ? bool2(false, false) : bool2(false, false)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - select_fb7e53(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - select_fb7e53(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - select_fb7e53(); - return; -} diff --git a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.msl b/test/tint/builtins/gen/select/fb7e53.wgsl.expected.msl deleted file mode 100644 index 7bd77e5ef3..0000000000 --- a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void select_fb7e53() { - bool2 res = select(bool2(), bool2(), bool()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - select_fb7e53(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - select_fb7e53(); - return; -} - -kernel void compute_main() { - select_fb7e53(); - return; -} - diff --git a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.spvasm b/test/tint/builtins/gen/select/fb7e53.wgsl.expected.spvasm deleted file mode 100644 index 2465e39fa4..0000000000 --- a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %select_fb7e53 "select_fb7e53" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %bool = OpTypeBool - %v2bool = OpTypeVector %bool 2 - %16 = OpConstantNull %bool - %17 = OpConstantNull %v2bool -%_ptr_Function_v2bool = OpTypePointer Function %v2bool - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%select_fb7e53 = OpFunction %void None %9 - %12 = OpLabel - %18 = OpVariable %_ptr_Function_v2bool Function %17 - %res = OpVariable %_ptr_Function_v2bool Function %17 - %20 = OpCompositeConstruct %v2bool %16 %16 - %13 = OpSelect %v2bool %20 %17 %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %select_fb7e53 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %select_fb7e53 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %select_fb7e53 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.wgsl b/test/tint/builtins/gen/select/fb7e53.wgsl.expected.wgsl deleted file mode 100644 index 6c6a2873f0..0000000000 --- a/test/tint/builtins/gen/select/fb7e53.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn select_fb7e53() { - var res : vec2 = select(vec2(), vec2(), bool()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - select_fb7e53(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - select_fb7e53(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - select_fb7e53(); -} diff --git a/test/tint/builtins/gen/sign/159665.wgsl b/test/tint/builtins/gen/sign/159665.wgsl deleted file mode 100644 index 2cfae2efa3..0000000000 --- a/test/tint/builtins/gen/sign/159665.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sign(vec<3, f32>) -> vec<3, f32> -fn sign_159665() { - var res: vec3 = sign(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sign_159665(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sign_159665(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sign_159665(); -} diff --git a/test/tint/builtins/gen/sign/159665.wgsl.expected.glsl b/test/tint/builtins/gen/sign/159665.wgsl.expected.glsl deleted file mode 100644 index adacd869b4..0000000000 --- a/test/tint/builtins/gen/sign/159665.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sign_159665() { - vec3 res = sign(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - sign_159665(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sign_159665() { - vec3 res = sign(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - sign_159665(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sign_159665() { - vec3 res = sign(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - sign_159665(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sign/159665.wgsl.expected.hlsl b/test/tint/builtins/gen/sign/159665.wgsl.expected.hlsl deleted file mode 100644 index 64d4d764bb..0000000000 --- a/test/tint/builtins/gen/sign/159665.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sign_159665() { - float3 res = sign(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sign_159665(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sign_159665(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sign_159665(); - return; -} diff --git a/test/tint/builtins/gen/sign/159665.wgsl.expected.msl b/test/tint/builtins/gen/sign/159665.wgsl.expected.msl deleted file mode 100644 index 2ab6b4f438..0000000000 --- a/test/tint/builtins/gen/sign/159665.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sign_159665() { - float3 res = sign(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sign_159665(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sign_159665(); - return; -} - -kernel void compute_main() { - sign_159665(); - return; -} - diff --git a/test/tint/builtins/gen/sign/159665.wgsl.expected.spvasm b/test/tint/builtins/gen/sign/159665.wgsl.expected.spvasm deleted file mode 100644 index 5e734b0b4c..0000000000 --- a/test/tint/builtins/gen/sign/159665.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sign_159665 "sign_159665" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%sign_159665 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 FSign %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %sign_159665 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %sign_159665 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %sign_159665 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sign/159665.wgsl.expected.wgsl b/test/tint/builtins/gen/sign/159665.wgsl.expected.wgsl deleted file mode 100644 index b66072bece..0000000000 --- a/test/tint/builtins/gen/sign/159665.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sign_159665() { - var res : vec3 = sign(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sign_159665(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sign_159665(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sign_159665(); -} diff --git a/test/tint/builtins/gen/sign/b8f634.wgsl b/test/tint/builtins/gen/sign/b8f634.wgsl deleted file mode 100644 index 7b936e3ba9..0000000000 --- a/test/tint/builtins/gen/sign/b8f634.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sign(vec<4, f32>) -> vec<4, f32> -fn sign_b8f634() { - var res: vec4 = sign(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sign_b8f634(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sign_b8f634(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sign_b8f634(); -} diff --git a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.glsl b/test/tint/builtins/gen/sign/b8f634.wgsl.expected.glsl deleted file mode 100644 index 18f418a2be..0000000000 --- a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sign_b8f634() { - vec4 res = sign(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - sign_b8f634(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sign_b8f634() { - vec4 res = sign(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - sign_b8f634(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sign_b8f634() { - vec4 res = sign(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - sign_b8f634(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.hlsl b/test/tint/builtins/gen/sign/b8f634.wgsl.expected.hlsl deleted file mode 100644 index 129de07c56..0000000000 --- a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sign_b8f634() { - float4 res = sign(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sign_b8f634(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sign_b8f634(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sign_b8f634(); - return; -} diff --git a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.msl b/test/tint/builtins/gen/sign/b8f634.wgsl.expected.msl deleted file mode 100644 index 70a13b58eb..0000000000 --- a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sign_b8f634() { - float4 res = sign(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sign_b8f634(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sign_b8f634(); - return; -} - -kernel void compute_main() { - sign_b8f634(); - return; -} - diff --git a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.spvasm b/test/tint/builtins/gen/sign/b8f634.wgsl.expected.spvasm deleted file mode 100644 index 88d6d0fbf9..0000000000 --- a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sign_b8f634 "sign_b8f634" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%sign_b8f634 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 FSign %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %sign_b8f634 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %sign_b8f634 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %sign_b8f634 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.wgsl b/test/tint/builtins/gen/sign/b8f634.wgsl.expected.wgsl deleted file mode 100644 index c9238d2587..0000000000 --- a/test/tint/builtins/gen/sign/b8f634.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sign_b8f634() { - var res : vec4 = sign(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sign_b8f634(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sign_b8f634(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sign_b8f634(); -} diff --git a/test/tint/builtins/gen/sign/d065d8.wgsl b/test/tint/builtins/gen/sign/d065d8.wgsl deleted file mode 100644 index 1dadd5c76f..0000000000 --- a/test/tint/builtins/gen/sign/d065d8.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sign(vec<2, f32>) -> vec<2, f32> -fn sign_d065d8() { - var res: vec2 = sign(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sign_d065d8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sign_d065d8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sign_d065d8(); -} diff --git a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.glsl b/test/tint/builtins/gen/sign/d065d8.wgsl.expected.glsl deleted file mode 100644 index 484ae07b00..0000000000 --- a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sign_d065d8() { - vec2 res = sign(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - sign_d065d8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sign_d065d8() { - vec2 res = sign(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - sign_d065d8(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sign_d065d8() { - vec2 res = sign(vec2(0.0f, 0.0f)); -} - -void compute_main() { - sign_d065d8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.hlsl b/test/tint/builtins/gen/sign/d065d8.wgsl.expected.hlsl deleted file mode 100644 index e6a06fab3c..0000000000 --- a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sign_d065d8() { - float2 res = sign(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sign_d065d8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sign_d065d8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sign_d065d8(); - return; -} diff --git a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.msl b/test/tint/builtins/gen/sign/d065d8.wgsl.expected.msl deleted file mode 100644 index 2fd18968f8..0000000000 --- a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sign_d065d8() { - float2 res = sign(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sign_d065d8(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sign_d065d8(); - return; -} - -kernel void compute_main() { - sign_d065d8(); - return; -} - diff --git a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.spvasm b/test/tint/builtins/gen/sign/d065d8.wgsl.expected.spvasm deleted file mode 100644 index 585a70e25c..0000000000 --- a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sign_d065d8 "sign_d065d8" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%sign_d065d8 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 FSign %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %sign_d065d8 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %sign_d065d8 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %sign_d065d8 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.wgsl b/test/tint/builtins/gen/sign/d065d8.wgsl.expected.wgsl deleted file mode 100644 index 870041f3db..0000000000 --- a/test/tint/builtins/gen/sign/d065d8.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sign_d065d8() { - var res : vec2 = sign(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sign_d065d8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sign_d065d8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sign_d065d8(); -} diff --git a/test/tint/builtins/gen/sign/dd790e.wgsl b/test/tint/builtins/gen/sign/dd790e.wgsl deleted file mode 100644 index 0124aa81b0..0000000000 --- a/test/tint/builtins/gen/sign/dd790e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sign(f32) -> f32 -fn sign_dd790e() { - var res: f32 = sign(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sign_dd790e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sign_dd790e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sign_dd790e(); -} diff --git a/test/tint/builtins/gen/sign/dd790e.wgsl.expected.glsl b/test/tint/builtins/gen/sign/dd790e.wgsl.expected.glsl deleted file mode 100644 index 5d1fa4ef9a..0000000000 --- a/test/tint/builtins/gen/sign/dd790e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sign_dd790e() { - float res = sign(1.0f); -} - -vec4 vertex_main() { - sign_dd790e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sign_dd790e() { - float res = sign(1.0f); -} - -void fragment_main() { - sign_dd790e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sign_dd790e() { - float res = sign(1.0f); -} - -void compute_main() { - sign_dd790e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sign/dd790e.wgsl.expected.hlsl b/test/tint/builtins/gen/sign/dd790e.wgsl.expected.hlsl deleted file mode 100644 index e55a8ac516..0000000000 --- a/test/tint/builtins/gen/sign/dd790e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sign_dd790e() { - float res = sign(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sign_dd790e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sign_dd790e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sign_dd790e(); - return; -} diff --git a/test/tint/builtins/gen/sign/dd790e.wgsl.expected.msl b/test/tint/builtins/gen/sign/dd790e.wgsl.expected.msl deleted file mode 100644 index 655bb10e42..0000000000 --- a/test/tint/builtins/gen/sign/dd790e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sign_dd790e() { - float res = sign(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sign_dd790e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sign_dd790e(); - return; -} - -kernel void compute_main() { - sign_dd790e(); - return; -} - diff --git a/test/tint/builtins/gen/sign/dd790e.wgsl.expected.wgsl b/test/tint/builtins/gen/sign/dd790e.wgsl.expected.wgsl deleted file mode 100644 index d987517179..0000000000 --- a/test/tint/builtins/gen/sign/dd790e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sign_dd790e() { - var res : f32 = sign(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sign_dd790e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sign_dd790e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sign_dd790e(); -} diff --git a/test/tint/builtins/gen/sin/01f241.wgsl b/test/tint/builtins/gen/sin/01f241.wgsl deleted file mode 100644 index 951c1b9f35..0000000000 --- a/test/tint/builtins/gen/sin/01f241.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sin(vec<3, f32>) -> vec<3, f32> -fn sin_01f241() { - var res: vec3 = sin(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sin_01f241(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sin_01f241(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sin_01f241(); -} diff --git a/test/tint/builtins/gen/sin/01f241.wgsl.expected.glsl b/test/tint/builtins/gen/sin/01f241.wgsl.expected.glsl deleted file mode 100644 index febf7320e4..0000000000 --- a/test/tint/builtins/gen/sin/01f241.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sin_01f241() { - vec3 res = sin(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - sin_01f241(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sin_01f241() { - vec3 res = sin(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - sin_01f241(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sin_01f241() { - vec3 res = sin(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - sin_01f241(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sin/01f241.wgsl.expected.hlsl b/test/tint/builtins/gen/sin/01f241.wgsl.expected.hlsl deleted file mode 100644 index 5fc47fa8a5..0000000000 --- a/test/tint/builtins/gen/sin/01f241.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sin_01f241() { - float3 res = sin(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sin_01f241(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sin_01f241(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sin_01f241(); - return; -} diff --git a/test/tint/builtins/gen/sin/01f241.wgsl.expected.msl b/test/tint/builtins/gen/sin/01f241.wgsl.expected.msl deleted file mode 100644 index af988a628c..0000000000 --- a/test/tint/builtins/gen/sin/01f241.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sin_01f241() { - float3 res = sin(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sin_01f241(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sin_01f241(); - return; -} - -kernel void compute_main() { - sin_01f241(); - return; -} - diff --git a/test/tint/builtins/gen/sin/01f241.wgsl.expected.spvasm b/test/tint/builtins/gen/sin/01f241.wgsl.expected.spvasm deleted file mode 100644 index 6a709ff96e..0000000000 --- a/test/tint/builtins/gen/sin/01f241.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sin_01f241 "sin_01f241" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %sin_01f241 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Sin %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %sin_01f241 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %sin_01f241 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %sin_01f241 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sin/01f241.wgsl.expected.wgsl b/test/tint/builtins/gen/sin/01f241.wgsl.expected.wgsl deleted file mode 100644 index 8188006663..0000000000 --- a/test/tint/builtins/gen/sin/01f241.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sin_01f241() { - var res : vec3 = sin(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sin_01f241(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sin_01f241(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sin_01f241(); -} diff --git a/test/tint/builtins/gen/sin/4e3979.wgsl b/test/tint/builtins/gen/sin/4e3979.wgsl deleted file mode 100644 index 5932c6f246..0000000000 --- a/test/tint/builtins/gen/sin/4e3979.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sin(vec<4, f32>) -> vec<4, f32> -fn sin_4e3979() { - var res: vec4 = sin(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sin_4e3979(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sin_4e3979(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sin_4e3979(); -} diff --git a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.glsl b/test/tint/builtins/gen/sin/4e3979.wgsl.expected.glsl deleted file mode 100644 index 4bbed8d300..0000000000 --- a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sin_4e3979() { - vec4 res = sin(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - sin_4e3979(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sin_4e3979() { - vec4 res = sin(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - sin_4e3979(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sin_4e3979() { - vec4 res = sin(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - sin_4e3979(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.hlsl b/test/tint/builtins/gen/sin/4e3979.wgsl.expected.hlsl deleted file mode 100644 index d9ccc2ef1f..0000000000 --- a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sin_4e3979() { - float4 res = sin(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sin_4e3979(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sin_4e3979(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sin_4e3979(); - return; -} diff --git a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.msl b/test/tint/builtins/gen/sin/4e3979.wgsl.expected.msl deleted file mode 100644 index 90f5a93970..0000000000 --- a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sin_4e3979() { - float4 res = sin(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sin_4e3979(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sin_4e3979(); - return; -} - -kernel void compute_main() { - sin_4e3979(); - return; -} - diff --git a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.spvasm b/test/tint/builtins/gen/sin/4e3979.wgsl.expected.spvasm deleted file mode 100644 index c83fd92de3..0000000000 --- a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sin_4e3979 "sin_4e3979" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %sin_4e3979 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Sin %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %sin_4e3979 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %sin_4e3979 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %sin_4e3979 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.wgsl b/test/tint/builtins/gen/sin/4e3979.wgsl.expected.wgsl deleted file mode 100644 index 6d037783ed..0000000000 --- a/test/tint/builtins/gen/sin/4e3979.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sin_4e3979() { - var res : vec4 = sin(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sin_4e3979(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sin_4e3979(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sin_4e3979(); -} diff --git a/test/tint/builtins/gen/sin/b78c91.wgsl b/test/tint/builtins/gen/sin/b78c91.wgsl deleted file mode 100644 index 234b758799..0000000000 --- a/test/tint/builtins/gen/sin/b78c91.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sin(f32) -> f32 -fn sin_b78c91() { - var res: f32 = sin(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sin_b78c91(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sin_b78c91(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sin_b78c91(); -} diff --git a/test/tint/builtins/gen/sin/b78c91.wgsl.expected.glsl b/test/tint/builtins/gen/sin/b78c91.wgsl.expected.glsl deleted file mode 100644 index d5f43beecb..0000000000 --- a/test/tint/builtins/gen/sin/b78c91.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sin_b78c91() { - float res = sin(1.0f); -} - -vec4 vertex_main() { - sin_b78c91(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sin_b78c91() { - float res = sin(1.0f); -} - -void fragment_main() { - sin_b78c91(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sin_b78c91() { - float res = sin(1.0f); -} - -void compute_main() { - sin_b78c91(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sin/b78c91.wgsl.expected.hlsl b/test/tint/builtins/gen/sin/b78c91.wgsl.expected.hlsl deleted file mode 100644 index 05a839bd40..0000000000 --- a/test/tint/builtins/gen/sin/b78c91.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sin_b78c91() { - float res = sin(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sin_b78c91(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sin_b78c91(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sin_b78c91(); - return; -} diff --git a/test/tint/builtins/gen/sin/b78c91.wgsl.expected.msl b/test/tint/builtins/gen/sin/b78c91.wgsl.expected.msl deleted file mode 100644 index b54d4fb8dd..0000000000 --- a/test/tint/builtins/gen/sin/b78c91.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sin_b78c91() { - float res = sin(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sin_b78c91(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sin_b78c91(); - return; -} - -kernel void compute_main() { - sin_b78c91(); - return; -} - diff --git a/test/tint/builtins/gen/sin/b78c91.wgsl.expected.wgsl b/test/tint/builtins/gen/sin/b78c91.wgsl.expected.wgsl deleted file mode 100644 index e4a2d42162..0000000000 --- a/test/tint/builtins/gen/sin/b78c91.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sin_b78c91() { - var res : f32 = sin(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sin_b78c91(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sin_b78c91(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sin_b78c91(); -} diff --git a/test/tint/builtins/gen/sin/fc8bc4.wgsl b/test/tint/builtins/gen/sin/fc8bc4.wgsl deleted file mode 100644 index a035f8c1c1..0000000000 --- a/test/tint/builtins/gen/sin/fc8bc4.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sin(vec<2, f32>) -> vec<2, f32> -fn sin_fc8bc4() { - var res: vec2 = sin(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sin_fc8bc4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sin_fc8bc4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sin_fc8bc4(); -} diff --git a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.glsl b/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.glsl deleted file mode 100644 index ea878eb2de..0000000000 --- a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sin_fc8bc4() { - vec2 res = sin(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - sin_fc8bc4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sin_fc8bc4() { - vec2 res = sin(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - sin_fc8bc4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sin_fc8bc4() { - vec2 res = sin(vec2(0.0f, 0.0f)); -} - -void compute_main() { - sin_fc8bc4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.hlsl b/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.hlsl deleted file mode 100644 index 934d5c62ce..0000000000 --- a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sin_fc8bc4() { - float2 res = sin(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sin_fc8bc4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sin_fc8bc4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sin_fc8bc4(); - return; -} diff --git a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.msl b/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.msl deleted file mode 100644 index 78417e907b..0000000000 --- a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sin_fc8bc4() { - float2 res = sin(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sin_fc8bc4(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sin_fc8bc4(); - return; -} - -kernel void compute_main() { - sin_fc8bc4(); - return; -} - diff --git a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.spvasm b/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.spvasm deleted file mode 100644 index ff7c146ff9..0000000000 --- a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sin_fc8bc4 "sin_fc8bc4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %sin_fc8bc4 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Sin %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %sin_fc8bc4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %sin_fc8bc4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %sin_fc8bc4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.wgsl b/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.wgsl deleted file mode 100644 index 30e0918779..0000000000 --- a/test/tint/builtins/gen/sin/fc8bc4.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sin_fc8bc4() { - var res : vec2 = sin(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sin_fc8bc4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sin_fc8bc4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sin_fc8bc4(); -} diff --git a/test/tint/builtins/gen/sinh/445e33.wgsl b/test/tint/builtins/gen/sinh/445e33.wgsl deleted file mode 100644 index bd3aff2e30..0000000000 --- a/test/tint/builtins/gen/sinh/445e33.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sinh(vec<4, f32>) -> vec<4, f32> -fn sinh_445e33() { - var res: vec4 = sinh(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sinh_445e33(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sinh_445e33(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sinh_445e33(); -} diff --git a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.glsl b/test/tint/builtins/gen/sinh/445e33.wgsl.expected.glsl deleted file mode 100644 index d528a8b44d..0000000000 --- a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sinh_445e33() { - vec4 res = sinh(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - sinh_445e33(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sinh_445e33() { - vec4 res = sinh(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - sinh_445e33(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sinh_445e33() { - vec4 res = sinh(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - sinh_445e33(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.hlsl b/test/tint/builtins/gen/sinh/445e33.wgsl.expected.hlsl deleted file mode 100644 index de0568102c..0000000000 --- a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sinh_445e33() { - float4 res = sinh(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sinh_445e33(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sinh_445e33(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sinh_445e33(); - return; -} diff --git a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.msl b/test/tint/builtins/gen/sinh/445e33.wgsl.expected.msl deleted file mode 100644 index 3361ddda53..0000000000 --- a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sinh_445e33() { - float4 res = sinh(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sinh_445e33(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sinh_445e33(); - return; -} - -kernel void compute_main() { - sinh_445e33(); - return; -} - diff --git a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.spvasm b/test/tint/builtins/gen/sinh/445e33.wgsl.expected.spvasm deleted file mode 100644 index a3e2fb6871..0000000000 --- a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sinh_445e33 "sinh_445e33" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%sinh_445e33 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Sinh %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %sinh_445e33 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %sinh_445e33 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %sinh_445e33 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.wgsl b/test/tint/builtins/gen/sinh/445e33.wgsl.expected.wgsl deleted file mode 100644 index 4eac92e7cf..0000000000 --- a/test/tint/builtins/gen/sinh/445e33.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sinh_445e33() { - var res : vec4 = sinh(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sinh_445e33(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sinh_445e33(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sinh_445e33(); -} diff --git a/test/tint/builtins/gen/sinh/7bb598.wgsl b/test/tint/builtins/gen/sinh/7bb598.wgsl deleted file mode 100644 index df3be7998e..0000000000 --- a/test/tint/builtins/gen/sinh/7bb598.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sinh(f32) -> f32 -fn sinh_7bb598() { - var res: f32 = sinh(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sinh_7bb598(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sinh_7bb598(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sinh_7bb598(); -} diff --git a/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.glsl b/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.glsl deleted file mode 100644 index e8ee6fd047..0000000000 --- a/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sinh_7bb598() { - float res = sinh(1.0f); -} - -vec4 vertex_main() { - sinh_7bb598(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sinh_7bb598() { - float res = sinh(1.0f); -} - -void fragment_main() { - sinh_7bb598(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sinh_7bb598() { - float res = sinh(1.0f); -} - -void compute_main() { - sinh_7bb598(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.hlsl b/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.hlsl deleted file mode 100644 index 4fadd51af0..0000000000 --- a/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sinh_7bb598() { - float res = sinh(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sinh_7bb598(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sinh_7bb598(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sinh_7bb598(); - return; -} diff --git a/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.msl b/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.msl deleted file mode 100644 index 52830a8c4d..0000000000 --- a/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sinh_7bb598() { - float res = sinh(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sinh_7bb598(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sinh_7bb598(); - return; -} - -kernel void compute_main() { - sinh_7bb598(); - return; -} - diff --git a/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.wgsl b/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.wgsl deleted file mode 100644 index 8df3fa0831..0000000000 --- a/test/tint/builtins/gen/sinh/7bb598.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sinh_7bb598() { - var res : f32 = sinh(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sinh_7bb598(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sinh_7bb598(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sinh_7bb598(); -} diff --git a/test/tint/builtins/gen/sinh/b9860e.wgsl b/test/tint/builtins/gen/sinh/b9860e.wgsl deleted file mode 100644 index 7f4fa1d3b2..0000000000 --- a/test/tint/builtins/gen/sinh/b9860e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sinh(vec<2, f32>) -> vec<2, f32> -fn sinh_b9860e() { - var res: vec2 = sinh(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sinh_b9860e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sinh_b9860e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sinh_b9860e(); -} diff --git a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.glsl b/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.glsl deleted file mode 100644 index 5c2ab68737..0000000000 --- a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sinh_b9860e() { - vec2 res = sinh(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - sinh_b9860e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sinh_b9860e() { - vec2 res = sinh(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - sinh_b9860e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sinh_b9860e() { - vec2 res = sinh(vec2(0.0f, 0.0f)); -} - -void compute_main() { - sinh_b9860e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.hlsl b/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.hlsl deleted file mode 100644 index 9bb27317be..0000000000 --- a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sinh_b9860e() { - float2 res = sinh(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sinh_b9860e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sinh_b9860e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sinh_b9860e(); - return; -} diff --git a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.msl b/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.msl deleted file mode 100644 index ca6289a0e9..0000000000 --- a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sinh_b9860e() { - float2 res = sinh(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sinh_b9860e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sinh_b9860e(); - return; -} - -kernel void compute_main() { - sinh_b9860e(); - return; -} - diff --git a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.spvasm b/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.spvasm deleted file mode 100644 index 8225ffdf26..0000000000 --- a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sinh_b9860e "sinh_b9860e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%sinh_b9860e = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Sinh %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %sinh_b9860e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %sinh_b9860e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %sinh_b9860e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.wgsl b/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.wgsl deleted file mode 100644 index b0698d04f3..0000000000 --- a/test/tint/builtins/gen/sinh/b9860e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sinh_b9860e() { - var res : vec2 = sinh(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sinh_b9860e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sinh_b9860e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sinh_b9860e(); -} diff --git a/test/tint/builtins/gen/sinh/c9a5eb.wgsl b/test/tint/builtins/gen/sinh/c9a5eb.wgsl deleted file mode 100644 index 699d4a8c0d..0000000000 --- a/test/tint/builtins/gen/sinh/c9a5eb.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sinh(vec<3, f32>) -> vec<3, f32> -fn sinh_c9a5eb() { - var res: vec3 = sinh(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sinh_c9a5eb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sinh_c9a5eb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sinh_c9a5eb(); -} diff --git a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.glsl b/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.glsl deleted file mode 100644 index 3d96ecc357..0000000000 --- a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sinh_c9a5eb() { - vec3 res = sinh(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - sinh_c9a5eb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sinh_c9a5eb() { - vec3 res = sinh(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - sinh_c9a5eb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sinh_c9a5eb() { - vec3 res = sinh(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - sinh_c9a5eb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.hlsl b/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.hlsl deleted file mode 100644 index 7aeaa6540e..0000000000 --- a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sinh_c9a5eb() { - float3 res = sinh(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sinh_c9a5eb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sinh_c9a5eb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sinh_c9a5eb(); - return; -} diff --git a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.msl b/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.msl deleted file mode 100644 index c9d2bb5b81..0000000000 --- a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sinh_c9a5eb() { - float3 res = sinh(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sinh_c9a5eb(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sinh_c9a5eb(); - return; -} - -kernel void compute_main() { - sinh_c9a5eb(); - return; -} - diff --git a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.spvasm b/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.spvasm deleted file mode 100644 index a84374631a..0000000000 --- a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sinh_c9a5eb "sinh_c9a5eb" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%sinh_c9a5eb = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Sinh %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %sinh_c9a5eb - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %sinh_c9a5eb - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %sinh_c9a5eb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.wgsl b/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.wgsl deleted file mode 100644 index 642d72c8c4..0000000000 --- a/test/tint/builtins/gen/sinh/c9a5eb.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sinh_c9a5eb() { - var res : vec3 = sinh(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sinh_c9a5eb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sinh_c9a5eb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sinh_c9a5eb(); -} diff --git a/test/tint/builtins/gen/smoothstep/392c19.wgsl b/test/tint/builtins/gen/smoothstep/392c19.wgsl deleted file mode 100644 index 018e920ed3..0000000000 --- a/test/tint/builtins/gen/smoothstep/392c19.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn smoothstep(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn smoothstep_392c19() { - var res: vec2 = smoothstep(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothstep_392c19(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothstep_392c19(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothstep_392c19(); -} diff --git a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.glsl b/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.glsl deleted file mode 100644 index ea982b9157..0000000000 --- a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void smoothstep_392c19() { - vec2 res = smoothstep(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - smoothstep_392c19(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void smoothstep_392c19() { - vec2 res = smoothstep(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - smoothstep_392c19(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void smoothstep_392c19() { - vec2 res = smoothstep(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - smoothstep_392c19(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.hlsl b/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.hlsl deleted file mode 100644 index 97fec4e86c..0000000000 --- a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void smoothstep_392c19() { - float2 res = smoothstep(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - smoothstep_392c19(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - smoothstep_392c19(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - smoothstep_392c19(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.msl b/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.msl deleted file mode 100644 index 0c556987ff..0000000000 --- a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void smoothstep_392c19() { - float2 res = smoothstep(float2(), float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - smoothstep_392c19(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - smoothstep_392c19(); - return; -} - -kernel void compute_main() { - smoothstep_392c19(); - return; -} - diff --git a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.spvasm b/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.spvasm deleted file mode 100644 index 14299d9e95..0000000000 --- a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %smoothstep_392c19 "smoothstep_392c19" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%smoothstep_392c19 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 SmoothStep %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %smoothstep_392c19 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %smoothstep_392c19 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %smoothstep_392c19 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.wgsl b/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.wgsl deleted file mode 100644 index 7d1d3ffc21..0000000000 --- a/test/tint/builtins/gen/smoothstep/392c19.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn smoothstep_392c19() { - var res : vec2 = smoothstep(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothstep_392c19(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothstep_392c19(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothstep_392c19(); -} diff --git a/test/tint/builtins/gen/smoothstep/40864c.wgsl b/test/tint/builtins/gen/smoothstep/40864c.wgsl deleted file mode 100644 index 403e8bff4e..0000000000 --- a/test/tint/builtins/gen/smoothstep/40864c.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn smoothstep(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn smoothstep_40864c() { - var res: vec4 = smoothstep(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothstep_40864c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothstep_40864c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothstep_40864c(); -} diff --git a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.glsl b/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.glsl deleted file mode 100644 index 53d6a2e200..0000000000 --- a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void smoothstep_40864c() { - vec4 res = smoothstep(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - smoothstep_40864c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void smoothstep_40864c() { - vec4 res = smoothstep(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - smoothstep_40864c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void smoothstep_40864c() { - vec4 res = smoothstep(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - smoothstep_40864c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.hlsl b/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.hlsl deleted file mode 100644 index e85c39408b..0000000000 --- a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void smoothstep_40864c() { - float4 res = smoothstep(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - smoothstep_40864c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - smoothstep_40864c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - smoothstep_40864c(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.msl b/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.msl deleted file mode 100644 index 55fb975bdc..0000000000 --- a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void smoothstep_40864c() { - float4 res = smoothstep(float4(), float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - smoothstep_40864c(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - smoothstep_40864c(); - return; -} - -kernel void compute_main() { - smoothstep_40864c(); - return; -} - diff --git a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.spvasm b/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.spvasm deleted file mode 100644 index 8a1dda2c3d..0000000000 --- a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %smoothstep_40864c "smoothstep_40864c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%smoothstep_40864c = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 SmoothStep %5 %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %smoothstep_40864c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %smoothstep_40864c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %smoothstep_40864c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.wgsl b/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.wgsl deleted file mode 100644 index 0d4cd269b2..0000000000 --- a/test/tint/builtins/gen/smoothstep/40864c.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn smoothstep_40864c() { - var res : vec4 = smoothstep(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothstep_40864c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothstep_40864c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothstep_40864c(); -} diff --git a/test/tint/builtins/gen/smoothstep/5f615b.wgsl b/test/tint/builtins/gen/smoothstep/5f615b.wgsl deleted file mode 100644 index 565e625229..0000000000 --- a/test/tint/builtins/gen/smoothstep/5f615b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/builtin-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the builtin defintion file: -// src/tint/builtins.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn smoothStep(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn smoothStep_5f615b() { - var res: vec4 = smoothStep(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothStep_5f615b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothStep_5f615b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothStep_5f615b(); -} diff --git a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.glsl b/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.glsl deleted file mode 100644 index 5c6176ba24..0000000000 --- a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.glsl +++ /dev/null @@ -1,53 +0,0 @@ -builtins/gen/smoothstep/5f615b.wgsl:28:24 warning: use of deprecated builtin - var res: vec4 = smoothStep(vec4(), vec4(), vec4()); - ^^^^^^^^^^ - -#version 310 es - -void smoothStep_5f615b() { - vec4 res = smoothstep(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - smoothStep_5f615b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void smoothStep_5f615b() { - vec4 res = smoothstep(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - smoothStep_5f615b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void smoothStep_5f615b() { - vec4 res = smoothstep(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - smoothStep_5f615b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.hlsl b/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.hlsl deleted file mode 100644 index ca36423df1..0000000000 --- a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -builtins/gen/smoothstep/5f615b.wgsl:28:24 warning: use of deprecated builtin - var res: vec4 = smoothStep(vec4(), vec4(), vec4()); - ^^^^^^^^^^ - -void smoothStep_5f615b() { - float4 res = smoothstep(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - smoothStep_5f615b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - smoothStep_5f615b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - smoothStep_5f615b(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.msl b/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.msl deleted file mode 100644 index 27f5ab6cda..0000000000 --- a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.msl +++ /dev/null @@ -1,37 +0,0 @@ -builtins/gen/smoothstep/5f615b.wgsl:28:24 warning: use of deprecated builtin - var res: vec4 = smoothStep(vec4(), vec4(), vec4()); - ^^^^^^^^^^ - -#include - -using namespace metal; -void smoothStep_5f615b() { - float4 res = smoothstep(float4(), float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - smoothStep_5f615b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - smoothStep_5f615b(); - return; -} - -kernel void compute_main() { - smoothStep_5f615b(); - return; -} - diff --git a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.spvasm b/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.spvasm deleted file mode 100644 index 3e78282248..0000000000 --- a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -builtins/gen/smoothstep/5f615b.wgsl:28:24 warning: use of deprecated builtin - var res: vec4 = smoothStep(vec4(), vec4(), vec4()); - ^^^^^^^^^^ - -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %smoothStep_5f615b "smoothStep_5f615b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%smoothStep_5f615b = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 SmoothStep %5 %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %smoothStep_5f615b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %smoothStep_5f615b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %smoothStep_5f615b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.wgsl b/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.wgsl deleted file mode 100644 index 89cc7bfeaf..0000000000 --- a/test/tint/builtins/gen/smoothstep/5f615b.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -builtins/gen/smoothstep/5f615b.wgsl:28:24 warning: use of deprecated builtin - var res: vec4 = smoothStep(vec4(), vec4(), vec4()); - ^^^^^^^^^^ - -fn smoothStep_5f615b() { - var res : vec4 = smoothStep(vec4(), vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothStep_5f615b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothStep_5f615b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothStep_5f615b(); -} diff --git a/test/tint/builtins/gen/smoothstep/658be3.wgsl b/test/tint/builtins/gen/smoothstep/658be3.wgsl deleted file mode 100644 index bd29528240..0000000000 --- a/test/tint/builtins/gen/smoothstep/658be3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/builtin-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the builtin defintion file: -// src/tint/builtins.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn smoothStep(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn smoothStep_658be3() { - var res: vec3 = smoothStep(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothStep_658be3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothStep_658be3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothStep_658be3(); -} diff --git a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.glsl b/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.glsl deleted file mode 100644 index 35723fceec..0000000000 --- a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.glsl +++ /dev/null @@ -1,53 +0,0 @@ -builtins/gen/smoothstep/658be3.wgsl:28:24 warning: use of deprecated builtin - var res: vec3 = smoothStep(vec3(), vec3(), vec3()); - ^^^^^^^^^^ - -#version 310 es - -void smoothStep_658be3() { - vec3 res = smoothstep(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - smoothStep_658be3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void smoothStep_658be3() { - vec3 res = smoothstep(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - smoothStep_658be3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void smoothStep_658be3() { - vec3 res = smoothstep(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - smoothStep_658be3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.hlsl b/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.hlsl deleted file mode 100644 index 89a8c38dd6..0000000000 --- a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -builtins/gen/smoothstep/658be3.wgsl:28:24 warning: use of deprecated builtin - var res: vec3 = smoothStep(vec3(), vec3(), vec3()); - ^^^^^^^^^^ - -void smoothStep_658be3() { - float3 res = smoothstep(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - smoothStep_658be3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - smoothStep_658be3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - smoothStep_658be3(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.msl b/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.msl deleted file mode 100644 index 4d8342eaae..0000000000 --- a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.msl +++ /dev/null @@ -1,37 +0,0 @@ -builtins/gen/smoothstep/658be3.wgsl:28:24 warning: use of deprecated builtin - var res: vec3 = smoothStep(vec3(), vec3(), vec3()); - ^^^^^^^^^^ - -#include - -using namespace metal; -void smoothStep_658be3() { - float3 res = smoothstep(float3(), float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - smoothStep_658be3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - smoothStep_658be3(); - return; -} - -kernel void compute_main() { - smoothStep_658be3(); - return; -} - diff --git a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.spvasm b/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.spvasm deleted file mode 100644 index 032e30d42e..0000000000 --- a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.spvasm +++ /dev/null @@ -1,71 +0,0 @@ -builtins/gen/smoothstep/658be3.wgsl:28:24 warning: use of deprecated builtin - var res: vec3 = smoothStep(vec3(), vec3(), vec3()); - ^^^^^^^^^^ - -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %smoothStep_658be3 "smoothStep_658be3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%smoothStep_658be3 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 SmoothStep %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %smoothStep_658be3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %smoothStep_658be3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %smoothStep_658be3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.wgsl b/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.wgsl deleted file mode 100644 index 7e3aa5c005..0000000000 --- a/test/tint/builtins/gen/smoothstep/658be3.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -builtins/gen/smoothstep/658be3.wgsl:28:24 warning: use of deprecated builtin - var res: vec3 = smoothStep(vec3(), vec3(), vec3()); - ^^^^^^^^^^ - -fn smoothStep_658be3() { - var res : vec3 = smoothStep(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothStep_658be3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothStep_658be3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothStep_658be3(); -} diff --git a/test/tint/builtins/gen/smoothstep/6c4975.wgsl b/test/tint/builtins/gen/smoothstep/6c4975.wgsl deleted file mode 100644 index aa22a453e5..0000000000 --- a/test/tint/builtins/gen/smoothstep/6c4975.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn smoothstep(f32, f32, f32) -> f32 -fn smoothstep_6c4975() { - var res: f32 = smoothstep(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothstep_6c4975(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothstep_6c4975(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothstep_6c4975(); -} diff --git a/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.glsl b/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.glsl deleted file mode 100644 index 6c3afe9774..0000000000 --- a/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void smoothstep_6c4975() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -vec4 vertex_main() { - smoothstep_6c4975(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void smoothstep_6c4975() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -void fragment_main() { - smoothstep_6c4975(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void smoothstep_6c4975() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -void compute_main() { - smoothstep_6c4975(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.hlsl b/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.hlsl deleted file mode 100644 index a2411cd200..0000000000 --- a/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void smoothstep_6c4975() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - smoothstep_6c4975(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - smoothstep_6c4975(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - smoothstep_6c4975(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.msl b/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.msl deleted file mode 100644 index 5fbf3436cf..0000000000 --- a/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void smoothstep_6c4975() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - smoothstep_6c4975(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - smoothstep_6c4975(); - return; -} - -kernel void compute_main() { - smoothstep_6c4975(); - return; -} - diff --git a/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.wgsl b/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.wgsl deleted file mode 100644 index 30982a379e..0000000000 --- a/test/tint/builtins/gen/smoothstep/6c4975.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn smoothstep_6c4975() { - var res : f32 = smoothstep(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothstep_6c4975(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothstep_6c4975(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothstep_6c4975(); -} diff --git a/test/tint/builtins/gen/smoothstep/aad1db.wgsl b/test/tint/builtins/gen/smoothstep/aad1db.wgsl deleted file mode 100644 index a3960d6d26..0000000000 --- a/test/tint/builtins/gen/smoothstep/aad1db.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn smoothstep(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn smoothstep_aad1db() { - var res: vec3 = smoothstep(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothstep_aad1db(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothstep_aad1db(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothstep_aad1db(); -} diff --git a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.glsl b/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.glsl deleted file mode 100644 index 32c8e8a250..0000000000 --- a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void smoothstep_aad1db() { - vec3 res = smoothstep(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - smoothstep_aad1db(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void smoothstep_aad1db() { - vec3 res = smoothstep(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - smoothstep_aad1db(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void smoothstep_aad1db() { - vec3 res = smoothstep(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - smoothstep_aad1db(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.hlsl b/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.hlsl deleted file mode 100644 index 641ca58110..0000000000 --- a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void smoothstep_aad1db() { - float3 res = smoothstep(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - smoothstep_aad1db(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - smoothstep_aad1db(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - smoothstep_aad1db(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.msl b/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.msl deleted file mode 100644 index 19ef68fcd6..0000000000 --- a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void smoothstep_aad1db() { - float3 res = smoothstep(float3(), float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - smoothstep_aad1db(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - smoothstep_aad1db(); - return; -} - -kernel void compute_main() { - smoothstep_aad1db(); - return; -} - diff --git a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.spvasm b/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.spvasm deleted file mode 100644 index c5b2f08a06..0000000000 --- a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %smoothstep_aad1db "smoothstep_aad1db" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%smoothstep_aad1db = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 SmoothStep %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %smoothstep_aad1db - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %smoothstep_aad1db - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %smoothstep_aad1db - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.wgsl b/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.wgsl deleted file mode 100644 index 0c834395e9..0000000000 --- a/test/tint/builtins/gen/smoothstep/aad1db.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn smoothstep_aad1db() { - var res : vec3 = smoothstep(vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothstep_aad1db(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothstep_aad1db(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothstep_aad1db(); -} diff --git a/test/tint/builtins/gen/smoothstep/c11eef.wgsl b/test/tint/builtins/gen/smoothstep/c11eef.wgsl deleted file mode 100644 index 518847a454..0000000000 --- a/test/tint/builtins/gen/smoothstep/c11eef.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/builtin-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the builtin defintion file: -// src/tint/builtins.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn smoothStep(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn smoothStep_c11eef() { - var res: vec2 = smoothStep(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothStep_c11eef(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothStep_c11eef(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothStep_c11eef(); -} diff --git a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.glsl b/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.glsl deleted file mode 100644 index 59c7014204..0000000000 --- a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.glsl +++ /dev/null @@ -1,53 +0,0 @@ -builtins/gen/smoothstep/c11eef.wgsl:28:24 warning: use of deprecated builtin - var res: vec2 = smoothStep(vec2(), vec2(), vec2()); - ^^^^^^^^^^ - -#version 310 es - -void smoothStep_c11eef() { - vec2 res = smoothstep(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - smoothStep_c11eef(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void smoothStep_c11eef() { - vec2 res = smoothstep(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - smoothStep_c11eef(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void smoothStep_c11eef() { - vec2 res = smoothstep(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - smoothStep_c11eef(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.hlsl b/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.hlsl deleted file mode 100644 index 93dfd41924..0000000000 --- a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -builtins/gen/smoothstep/c11eef.wgsl:28:24 warning: use of deprecated builtin - var res: vec2 = smoothStep(vec2(), vec2(), vec2()); - ^^^^^^^^^^ - -void smoothStep_c11eef() { - float2 res = smoothstep(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - smoothStep_c11eef(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - smoothStep_c11eef(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - smoothStep_c11eef(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.msl b/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.msl deleted file mode 100644 index 1ba59040ac..0000000000 --- a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.msl +++ /dev/null @@ -1,37 +0,0 @@ -builtins/gen/smoothstep/c11eef.wgsl:28:24 warning: use of deprecated builtin - var res: vec2 = smoothStep(vec2(), vec2(), vec2()); - ^^^^^^^^^^ - -#include - -using namespace metal; -void smoothStep_c11eef() { - float2 res = smoothstep(float2(), float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - smoothStep_c11eef(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - smoothStep_c11eef(); - return; -} - -kernel void compute_main() { - smoothStep_c11eef(); - return; -} - diff --git a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.spvasm b/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.spvasm deleted file mode 100644 index 3bdb215c80..0000000000 --- a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.spvasm +++ /dev/null @@ -1,71 +0,0 @@ -builtins/gen/smoothstep/c11eef.wgsl:28:24 warning: use of deprecated builtin - var res: vec2 = smoothStep(vec2(), vec2(), vec2()); - ^^^^^^^^^^ - -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %smoothStep_c11eef "smoothStep_c11eef" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%smoothStep_c11eef = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 SmoothStep %16 %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %smoothStep_c11eef - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %smoothStep_c11eef - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %smoothStep_c11eef - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.wgsl b/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.wgsl deleted file mode 100644 index c390acb4f5..0000000000 --- a/test/tint/builtins/gen/smoothstep/c11eef.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -builtins/gen/smoothstep/c11eef.wgsl:28:24 warning: use of deprecated builtin - var res: vec2 = smoothStep(vec2(), vec2(), vec2()); - ^^^^^^^^^^ - -fn smoothStep_c11eef() { - var res : vec2 = smoothStep(vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothStep_c11eef(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothStep_c11eef(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothStep_c11eef(); -} diff --git a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl b/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl deleted file mode 100644 index a30a3048d9..0000000000 --- a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/builtin-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the builtin defintion file: -// src/tint/builtins.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn smoothStep(f32, f32, f32) -> f32 -fn smoothStep_cb0bfb() { - var res: f32 = smoothStep(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothStep_cb0bfb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothStep_cb0bfb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothStep_cb0bfb(); -} diff --git a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.glsl b/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.glsl deleted file mode 100644 index 82d1901b49..0000000000 --- a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.glsl +++ /dev/null @@ -1,53 +0,0 @@ -builtins/gen/smoothstep/cb0bfb.wgsl:28:18 warning: use of deprecated builtin - var res: f32 = smoothStep(1.0, 1.0, 1.0); - ^^^^^^^^^^ - -#version 310 es - -void smoothStep_cb0bfb() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -vec4 vertex_main() { - smoothStep_cb0bfb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void smoothStep_cb0bfb() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -void fragment_main() { - smoothStep_cb0bfb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void smoothStep_cb0bfb() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -void compute_main() { - smoothStep_cb0bfb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.hlsl b/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.hlsl deleted file mode 100644 index 9f3389445d..0000000000 --- a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -builtins/gen/smoothstep/cb0bfb.wgsl:28:18 warning: use of deprecated builtin - var res: f32 = smoothStep(1.0, 1.0, 1.0); - ^^^^^^^^^^ - -void smoothStep_cb0bfb() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - smoothStep_cb0bfb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - smoothStep_cb0bfb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - smoothStep_cb0bfb(); - return; -} diff --git a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.msl b/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.msl deleted file mode 100644 index 34e5b3aecf..0000000000 --- a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.msl +++ /dev/null @@ -1,37 +0,0 @@ -builtins/gen/smoothstep/cb0bfb.wgsl:28:18 warning: use of deprecated builtin - var res: f32 = smoothStep(1.0, 1.0, 1.0); - ^^^^^^^^^^ - -#include - -using namespace metal; -void smoothStep_cb0bfb() { - float res = smoothstep(1.0f, 1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - smoothStep_cb0bfb(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - smoothStep_cb0bfb(); - return; -} - -kernel void compute_main() { - smoothStep_cb0bfb(); - return; -} - diff --git a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.spvasm b/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.spvasm deleted file mode 100644 index 6286bc5a7a..0000000000 --- a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -builtins/gen/smoothstep/cb0bfb.wgsl:28:18 warning: use of deprecated builtin - var res: f32 = smoothStep(1.0, 1.0, 1.0); - ^^^^^^^^^^ - -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %smoothStep_cb0bfb "smoothStep_cb0bfb" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 -%_ptr_Function_float = OpTypePointer Function %float - %18 = OpTypeFunction %v4float -%smoothStep_cb0bfb = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 SmoothStep %float_1 %float_1 %float_1 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %smoothStep_cb0bfb - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %smoothStep_cb0bfb - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %smoothStep_cb0bfb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.wgsl b/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.wgsl deleted file mode 100644 index d75d5f3801..0000000000 --- a/test/tint/builtins/gen/smoothstep/cb0bfb.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -builtins/gen/smoothstep/cb0bfb.wgsl:28:18 warning: use of deprecated builtin - var res: f32 = smoothStep(1.0, 1.0, 1.0); - ^^^^^^^^^^ - -fn smoothStep_cb0bfb() { - var res : f32 = smoothStep(1.0, 1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - smoothStep_cb0bfb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - smoothStep_cb0bfb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - smoothStep_cb0bfb(); -} diff --git a/test/tint/builtins/gen/sqrt/20c74e.wgsl b/test/tint/builtins/gen/sqrt/20c74e.wgsl deleted file mode 100644 index 50d97173bb..0000000000 --- a/test/tint/builtins/gen/sqrt/20c74e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sqrt(f32) -> f32 -fn sqrt_20c74e() { - var res: f32 = sqrt(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sqrt_20c74e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sqrt_20c74e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sqrt_20c74e(); -} diff --git a/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.glsl b/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.glsl deleted file mode 100644 index 8101f4ca3a..0000000000 --- a/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sqrt_20c74e() { - float res = sqrt(1.0f); -} - -vec4 vertex_main() { - sqrt_20c74e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sqrt_20c74e() { - float res = sqrt(1.0f); -} - -void fragment_main() { - sqrt_20c74e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sqrt_20c74e() { - float res = sqrt(1.0f); -} - -void compute_main() { - sqrt_20c74e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.hlsl b/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.hlsl deleted file mode 100644 index ff521bb3f4..0000000000 --- a/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sqrt_20c74e() { - float res = sqrt(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sqrt_20c74e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sqrt_20c74e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sqrt_20c74e(); - return; -} diff --git a/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.msl b/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.msl deleted file mode 100644 index 3a8c9e7c6a..0000000000 --- a/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sqrt_20c74e() { - float res = sqrt(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sqrt_20c74e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sqrt_20c74e(); - return; -} - -kernel void compute_main() { - sqrt_20c74e(); - return; -} - diff --git a/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.wgsl b/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.wgsl deleted file mode 100644 index 3b9fe0a266..0000000000 --- a/test/tint/builtins/gen/sqrt/20c74e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sqrt_20c74e() { - var res : f32 = sqrt(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sqrt_20c74e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sqrt_20c74e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sqrt_20c74e(); -} diff --git a/test/tint/builtins/gen/sqrt/8c7024.wgsl b/test/tint/builtins/gen/sqrt/8c7024.wgsl deleted file mode 100644 index d2d31e7f35..0000000000 --- a/test/tint/builtins/gen/sqrt/8c7024.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sqrt(vec<2, f32>) -> vec<2, f32> -fn sqrt_8c7024() { - var res: vec2 = sqrt(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sqrt_8c7024(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sqrt_8c7024(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sqrt_8c7024(); -} diff --git a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.glsl b/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.glsl deleted file mode 100644 index 0a6b551a9f..0000000000 --- a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sqrt_8c7024() { - vec2 res = sqrt(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - sqrt_8c7024(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sqrt_8c7024() { - vec2 res = sqrt(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - sqrt_8c7024(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sqrt_8c7024() { - vec2 res = sqrt(vec2(0.0f, 0.0f)); -} - -void compute_main() { - sqrt_8c7024(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.hlsl b/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.hlsl deleted file mode 100644 index 077c121002..0000000000 --- a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sqrt_8c7024() { - float2 res = sqrt(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sqrt_8c7024(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sqrt_8c7024(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sqrt_8c7024(); - return; -} diff --git a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.msl b/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.msl deleted file mode 100644 index ae85d89233..0000000000 --- a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sqrt_8c7024() { - float2 res = sqrt(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sqrt_8c7024(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sqrt_8c7024(); - return; -} - -kernel void compute_main() { - sqrt_8c7024(); - return; -} - diff --git a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.spvasm b/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.spvasm deleted file mode 100644 index 89f3e4b663..0000000000 --- a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sqrt_8c7024 "sqrt_8c7024" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%sqrt_8c7024 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Sqrt %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %sqrt_8c7024 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %sqrt_8c7024 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %sqrt_8c7024 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.wgsl b/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.wgsl deleted file mode 100644 index 36b4a8b6cc..0000000000 --- a/test/tint/builtins/gen/sqrt/8c7024.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sqrt_8c7024() { - var res : vec2 = sqrt(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sqrt_8c7024(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sqrt_8c7024(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sqrt_8c7024(); -} diff --git a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl b/test/tint/builtins/gen/sqrt/aa0d7a.wgsl deleted file mode 100644 index 5cbb2c32e5..0000000000 --- a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sqrt(vec<4, f32>) -> vec<4, f32> -fn sqrt_aa0d7a() { - var res: vec4 = sqrt(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sqrt_aa0d7a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sqrt_aa0d7a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sqrt_aa0d7a(); -} diff --git a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.glsl b/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.glsl deleted file mode 100644 index 80f236cdce..0000000000 --- a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sqrt_aa0d7a() { - vec4 res = sqrt(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - sqrt_aa0d7a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sqrt_aa0d7a() { - vec4 res = sqrt(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - sqrt_aa0d7a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sqrt_aa0d7a() { - vec4 res = sqrt(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - sqrt_aa0d7a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.hlsl b/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.hlsl deleted file mode 100644 index 58f339ee1a..0000000000 --- a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sqrt_aa0d7a() { - float4 res = sqrt(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sqrt_aa0d7a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sqrt_aa0d7a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sqrt_aa0d7a(); - return; -} diff --git a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.msl b/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.msl deleted file mode 100644 index 08b1222327..0000000000 --- a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sqrt_aa0d7a() { - float4 res = sqrt(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sqrt_aa0d7a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sqrt_aa0d7a(); - return; -} - -kernel void compute_main() { - sqrt_aa0d7a(); - return; -} - diff --git a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.spvasm b/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.spvasm deleted file mode 100644 index 7566b8276a..0000000000 --- a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sqrt_aa0d7a "sqrt_aa0d7a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%sqrt_aa0d7a = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Sqrt %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %sqrt_aa0d7a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %sqrt_aa0d7a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %sqrt_aa0d7a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.wgsl b/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.wgsl deleted file mode 100644 index 47ab81a39d..0000000000 --- a/test/tint/builtins/gen/sqrt/aa0d7a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sqrt_aa0d7a() { - var res : vec4 = sqrt(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sqrt_aa0d7a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sqrt_aa0d7a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sqrt_aa0d7a(); -} diff --git a/test/tint/builtins/gen/sqrt/f8c59a.wgsl b/test/tint/builtins/gen/sqrt/f8c59a.wgsl deleted file mode 100644 index 82edecb7a0..0000000000 --- a/test/tint/builtins/gen/sqrt/f8c59a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn sqrt(vec<3, f32>) -> vec<3, f32> -fn sqrt_f8c59a() { - var res: vec3 = sqrt(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sqrt_f8c59a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sqrt_f8c59a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sqrt_f8c59a(); -} diff --git a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.glsl b/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.glsl deleted file mode 100644 index 364e0afdbe..0000000000 --- a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void sqrt_f8c59a() { - vec3 res = sqrt(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - sqrt_f8c59a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void sqrt_f8c59a() { - vec3 res = sqrt(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - sqrt_f8c59a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void sqrt_f8c59a() { - vec3 res = sqrt(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - sqrt_f8c59a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.hlsl b/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.hlsl deleted file mode 100644 index 5bbd79731b..0000000000 --- a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void sqrt_f8c59a() { - float3 res = sqrt(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - sqrt_f8c59a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - sqrt_f8c59a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - sqrt_f8c59a(); - return; -} diff --git a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.msl b/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.msl deleted file mode 100644 index d93e68d0e7..0000000000 --- a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void sqrt_f8c59a() { - float3 res = sqrt(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - sqrt_f8c59a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - sqrt_f8c59a(); - return; -} - -kernel void compute_main() { - sqrt_f8c59a(); - return; -} - diff --git a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.spvasm b/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.spvasm deleted file mode 100644 index 15225e1efc..0000000000 --- a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %sqrt_f8c59a "sqrt_f8c59a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%sqrt_f8c59a = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Sqrt %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %sqrt_f8c59a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %sqrt_f8c59a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %sqrt_f8c59a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.wgsl b/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.wgsl deleted file mode 100644 index e12b65861c..0000000000 --- a/test/tint/builtins/gen/sqrt/f8c59a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn sqrt_f8c59a() { - var res : vec3 = sqrt(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - sqrt_f8c59a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - sqrt_f8c59a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - sqrt_f8c59a(); -} diff --git a/test/tint/builtins/gen/step/0b073b.wgsl b/test/tint/builtins/gen/step/0b073b.wgsl deleted file mode 100644 index e90d956e3b..0000000000 --- a/test/tint/builtins/gen/step/0b073b.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn step(f32, f32) -> f32 -fn step_0b073b() { - var res: f32 = step(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - step_0b073b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - step_0b073b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - step_0b073b(); -} diff --git a/test/tint/builtins/gen/step/0b073b.wgsl.expected.glsl b/test/tint/builtins/gen/step/0b073b.wgsl.expected.glsl deleted file mode 100644 index fc47ab04ea..0000000000 --- a/test/tint/builtins/gen/step/0b073b.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void step_0b073b() { - float res = step(1.0f, 1.0f); -} - -vec4 vertex_main() { - step_0b073b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void step_0b073b() { - float res = step(1.0f, 1.0f); -} - -void fragment_main() { - step_0b073b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void step_0b073b() { - float res = step(1.0f, 1.0f); -} - -void compute_main() { - step_0b073b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/step/0b073b.wgsl.expected.hlsl b/test/tint/builtins/gen/step/0b073b.wgsl.expected.hlsl deleted file mode 100644 index baff28171d..0000000000 --- a/test/tint/builtins/gen/step/0b073b.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void step_0b073b() { - float res = step(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - step_0b073b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - step_0b073b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - step_0b073b(); - return; -} diff --git a/test/tint/builtins/gen/step/0b073b.wgsl.expected.msl b/test/tint/builtins/gen/step/0b073b.wgsl.expected.msl deleted file mode 100644 index 60774de513..0000000000 --- a/test/tint/builtins/gen/step/0b073b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void step_0b073b() { - float res = step(1.0f, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - step_0b073b(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - step_0b073b(); - return; -} - -kernel void compute_main() { - step_0b073b(); - return; -} - diff --git a/test/tint/builtins/gen/step/0b073b.wgsl.expected.wgsl b/test/tint/builtins/gen/step/0b073b.wgsl.expected.wgsl deleted file mode 100644 index 36e47ddeaa..0000000000 --- a/test/tint/builtins/gen/step/0b073b.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn step_0b073b() { - var res : f32 = step(1.0, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - step_0b073b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - step_0b073b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - step_0b073b(); -} diff --git a/test/tint/builtins/gen/step/19accd.wgsl b/test/tint/builtins/gen/step/19accd.wgsl deleted file mode 100644 index 9f54581a1e..0000000000 --- a/test/tint/builtins/gen/step/19accd.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn step(vec<2, f32>, vec<2, f32>) -> vec<2, f32> -fn step_19accd() { - var res: vec2 = step(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - step_19accd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - step_19accd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - step_19accd(); -} diff --git a/test/tint/builtins/gen/step/19accd.wgsl.expected.glsl b/test/tint/builtins/gen/step/19accd.wgsl.expected.glsl deleted file mode 100644 index 88dee68295..0000000000 --- a/test/tint/builtins/gen/step/19accd.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void step_19accd() { - vec2 res = step(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - step_19accd(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void step_19accd() { - vec2 res = step(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - step_19accd(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void step_19accd() { - vec2 res = step(vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - step_19accd(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/step/19accd.wgsl.expected.hlsl b/test/tint/builtins/gen/step/19accd.wgsl.expected.hlsl deleted file mode 100644 index d9d8c6c1a3..0000000000 --- a/test/tint/builtins/gen/step/19accd.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void step_19accd() { - float2 res = step(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - step_19accd(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - step_19accd(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - step_19accd(); - return; -} diff --git a/test/tint/builtins/gen/step/19accd.wgsl.expected.msl b/test/tint/builtins/gen/step/19accd.wgsl.expected.msl deleted file mode 100644 index 44dd9ebe5c..0000000000 --- a/test/tint/builtins/gen/step/19accd.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void step_19accd() { - float2 res = step(float2(), float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - step_19accd(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - step_19accd(); - return; -} - -kernel void compute_main() { - step_19accd(); - return; -} - diff --git a/test/tint/builtins/gen/step/19accd.wgsl.expected.spvasm b/test/tint/builtins/gen/step/19accd.wgsl.expected.spvasm deleted file mode 100644 index b56876abbb..0000000000 --- a/test/tint/builtins/gen/step/19accd.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %step_19accd "step_19accd" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%step_19accd = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Step %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %step_19accd - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %step_19accd - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %step_19accd - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/step/19accd.wgsl.expected.wgsl b/test/tint/builtins/gen/step/19accd.wgsl.expected.wgsl deleted file mode 100644 index ce2b50bada..0000000000 --- a/test/tint/builtins/gen/step/19accd.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn step_19accd() { - var res : vec2 = step(vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - step_19accd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - step_19accd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - step_19accd(); -} diff --git a/test/tint/builtins/gen/step/334303.wgsl b/test/tint/builtins/gen/step/334303.wgsl deleted file mode 100644 index 922ffb19fa..0000000000 --- a/test/tint/builtins/gen/step/334303.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn step(vec<3, f32>, vec<3, f32>) -> vec<3, f32> -fn step_334303() { - var res: vec3 = step(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - step_334303(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - step_334303(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - step_334303(); -} diff --git a/test/tint/builtins/gen/step/334303.wgsl.expected.glsl b/test/tint/builtins/gen/step/334303.wgsl.expected.glsl deleted file mode 100644 index 78b9c98840..0000000000 --- a/test/tint/builtins/gen/step/334303.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void step_334303() { - vec3 res = step(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - step_334303(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void step_334303() { - vec3 res = step(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - step_334303(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void step_334303() { - vec3 res = step(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - step_334303(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/step/334303.wgsl.expected.hlsl b/test/tint/builtins/gen/step/334303.wgsl.expected.hlsl deleted file mode 100644 index e407c78c80..0000000000 --- a/test/tint/builtins/gen/step/334303.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void step_334303() { - float3 res = step(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - step_334303(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - step_334303(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - step_334303(); - return; -} diff --git a/test/tint/builtins/gen/step/334303.wgsl.expected.msl b/test/tint/builtins/gen/step/334303.wgsl.expected.msl deleted file mode 100644 index 2df2377cf0..0000000000 --- a/test/tint/builtins/gen/step/334303.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void step_334303() { - float3 res = step(float3(), float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - step_334303(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - step_334303(); - return; -} - -kernel void compute_main() { - step_334303(); - return; -} - diff --git a/test/tint/builtins/gen/step/334303.wgsl.expected.spvasm b/test/tint/builtins/gen/step/334303.wgsl.expected.spvasm deleted file mode 100644 index 7cc186abc9..0000000000 --- a/test/tint/builtins/gen/step/334303.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %step_334303 "step_334303" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%step_334303 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Step %16 %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %step_334303 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %step_334303 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %step_334303 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/step/334303.wgsl.expected.wgsl b/test/tint/builtins/gen/step/334303.wgsl.expected.wgsl deleted file mode 100644 index e1cb6317b3..0000000000 --- a/test/tint/builtins/gen/step/334303.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn step_334303() { - var res : vec3 = step(vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - step_334303(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - step_334303(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - step_334303(); -} diff --git a/test/tint/builtins/gen/step/e2b337.wgsl b/test/tint/builtins/gen/step/e2b337.wgsl deleted file mode 100644 index 218fde588e..0000000000 --- a/test/tint/builtins/gen/step/e2b337.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn step(vec<4, f32>, vec<4, f32>) -> vec<4, f32> -fn step_e2b337() { - var res: vec4 = step(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - step_e2b337(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - step_e2b337(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - step_e2b337(); -} diff --git a/test/tint/builtins/gen/step/e2b337.wgsl.expected.glsl b/test/tint/builtins/gen/step/e2b337.wgsl.expected.glsl deleted file mode 100644 index cb4e684a0f..0000000000 --- a/test/tint/builtins/gen/step/e2b337.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void step_e2b337() { - vec4 res = step(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - step_e2b337(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void step_e2b337() { - vec4 res = step(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - step_e2b337(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void step_e2b337() { - vec4 res = step(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - step_e2b337(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/step/e2b337.wgsl.expected.hlsl b/test/tint/builtins/gen/step/e2b337.wgsl.expected.hlsl deleted file mode 100644 index 17e2f9dea7..0000000000 --- a/test/tint/builtins/gen/step/e2b337.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void step_e2b337() { - float4 res = step(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - step_e2b337(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - step_e2b337(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - step_e2b337(); - return; -} diff --git a/test/tint/builtins/gen/step/e2b337.wgsl.expected.msl b/test/tint/builtins/gen/step/e2b337.wgsl.expected.msl deleted file mode 100644 index 7babb88532..0000000000 --- a/test/tint/builtins/gen/step/e2b337.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void step_e2b337() { - float4 res = step(float4(), float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - step_e2b337(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - step_e2b337(); - return; -} - -kernel void compute_main() { - step_e2b337(); - return; -} - diff --git a/test/tint/builtins/gen/step/e2b337.wgsl.expected.spvasm b/test/tint/builtins/gen/step/e2b337.wgsl.expected.spvasm deleted file mode 100644 index d1fcc535bd..0000000000 --- a/test/tint/builtins/gen/step/e2b337.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %step_e2b337 "step_e2b337" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%step_e2b337 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Step %5 %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %step_e2b337 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %step_e2b337 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %step_e2b337 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/step/e2b337.wgsl.expected.wgsl b/test/tint/builtins/gen/step/e2b337.wgsl.expected.wgsl deleted file mode 100644 index a6efd8626f..0000000000 --- a/test/tint/builtins/gen/step/e2b337.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn step_e2b337() { - var res : vec4 = step(vec4(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - step_e2b337(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - step_e2b337(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - step_e2b337(); -} diff --git a/test/tint/builtins/gen/storageBarrier/d87211.wgsl b/test/tint/builtins/gen/storageBarrier/d87211.wgsl deleted file mode 100644 index b98fa8c06c..0000000000 --- a/test/tint/builtins/gen/storageBarrier/d87211.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn storageBarrier() -fn storageBarrier_d87211() { - storageBarrier(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - storageBarrier_d87211(); -} diff --git a/test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.wgsl b/test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.wgsl deleted file mode 100644 index 4c87708134..0000000000 --- a/test/tint/builtins/gen/storageBarrier/d87211.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn storageBarrier_d87211() { - storageBarrier(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - storageBarrier_d87211(); -} diff --git a/test/tint/builtins/gen/tan/244e2a.wgsl b/test/tint/builtins/gen/tan/244e2a.wgsl deleted file mode 100644 index 2d61b0e142..0000000000 --- a/test/tint/builtins/gen/tan/244e2a.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn tan(vec<4, f32>) -> vec<4, f32> -fn tan_244e2a() { - var res: vec4 = tan(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tan_244e2a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tan_244e2a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tan_244e2a(); -} diff --git a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.glsl b/test/tint/builtins/gen/tan/244e2a.wgsl.expected.glsl deleted file mode 100644 index 70f5792a80..0000000000 --- a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void tan_244e2a() { - vec4 res = tan(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - tan_244e2a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void tan_244e2a() { - vec4 res = tan(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - tan_244e2a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void tan_244e2a() { - vec4 res = tan(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - tan_244e2a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.hlsl b/test/tint/builtins/gen/tan/244e2a.wgsl.expected.hlsl deleted file mode 100644 index 11e40a2c60..0000000000 --- a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void tan_244e2a() { - float4 res = tan(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - tan_244e2a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - tan_244e2a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - tan_244e2a(); - return; -} diff --git a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.msl b/test/tint/builtins/gen/tan/244e2a.wgsl.expected.msl deleted file mode 100644 index 64ec9bcf1f..0000000000 --- a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void tan_244e2a() { - float4 res = tan(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - tan_244e2a(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - tan_244e2a(); - return; -} - -kernel void compute_main() { - tan_244e2a(); - return; -} - diff --git a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.spvasm b/test/tint/builtins/gen/tan/244e2a.wgsl.expected.spvasm deleted file mode 100644 index 6c6aa2fb34..0000000000 --- a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tan_244e2a "tan_244e2a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %tan_244e2a = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Tan %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %tan_244e2a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %tan_244e2a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %tan_244e2a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.wgsl b/test/tint/builtins/gen/tan/244e2a.wgsl.expected.wgsl deleted file mode 100644 index 77ac6d8afb..0000000000 --- a/test/tint/builtins/gen/tan/244e2a.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn tan_244e2a() { - var res : vec4 = tan(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tan_244e2a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tan_244e2a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tan_244e2a(); -} diff --git a/test/tint/builtins/gen/tan/2f030e.wgsl b/test/tint/builtins/gen/tan/2f030e.wgsl deleted file mode 100644 index b5b038ad4d..0000000000 --- a/test/tint/builtins/gen/tan/2f030e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn tan(f32) -> f32 -fn tan_2f030e() { - var res: f32 = tan(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tan_2f030e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tan_2f030e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tan_2f030e(); -} diff --git a/test/tint/builtins/gen/tan/2f030e.wgsl.expected.glsl b/test/tint/builtins/gen/tan/2f030e.wgsl.expected.glsl deleted file mode 100644 index 0c40e1a46e..0000000000 --- a/test/tint/builtins/gen/tan/2f030e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void tan_2f030e() { - float res = tan(1.0f); -} - -vec4 vertex_main() { - tan_2f030e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void tan_2f030e() { - float res = tan(1.0f); -} - -void fragment_main() { - tan_2f030e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void tan_2f030e() { - float res = tan(1.0f); -} - -void compute_main() { - tan_2f030e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/tan/2f030e.wgsl.expected.hlsl b/test/tint/builtins/gen/tan/2f030e.wgsl.expected.hlsl deleted file mode 100644 index b7cf9e171a..0000000000 --- a/test/tint/builtins/gen/tan/2f030e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void tan_2f030e() { - float res = tan(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - tan_2f030e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - tan_2f030e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - tan_2f030e(); - return; -} diff --git a/test/tint/builtins/gen/tan/2f030e.wgsl.expected.msl b/test/tint/builtins/gen/tan/2f030e.wgsl.expected.msl deleted file mode 100644 index 63bec4593f..0000000000 --- a/test/tint/builtins/gen/tan/2f030e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void tan_2f030e() { - float res = tan(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - tan_2f030e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - tan_2f030e(); - return; -} - -kernel void compute_main() { - tan_2f030e(); - return; -} - diff --git a/test/tint/builtins/gen/tan/2f030e.wgsl.expected.wgsl b/test/tint/builtins/gen/tan/2f030e.wgsl.expected.wgsl deleted file mode 100644 index 3c12969c53..0000000000 --- a/test/tint/builtins/gen/tan/2f030e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn tan_2f030e() { - var res : f32 = tan(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tan_2f030e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tan_2f030e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tan_2f030e(); -} diff --git a/test/tint/builtins/gen/tan/7ea104.wgsl b/test/tint/builtins/gen/tan/7ea104.wgsl deleted file mode 100644 index 1a2554758f..0000000000 --- a/test/tint/builtins/gen/tan/7ea104.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn tan(vec<3, f32>) -> vec<3, f32> -fn tan_7ea104() { - var res: vec3 = tan(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tan_7ea104(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tan_7ea104(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tan_7ea104(); -} diff --git a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.glsl b/test/tint/builtins/gen/tan/7ea104.wgsl.expected.glsl deleted file mode 100644 index f69ac67a88..0000000000 --- a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void tan_7ea104() { - vec3 res = tan(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - tan_7ea104(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void tan_7ea104() { - vec3 res = tan(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - tan_7ea104(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void tan_7ea104() { - vec3 res = tan(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - tan_7ea104(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.hlsl b/test/tint/builtins/gen/tan/7ea104.wgsl.expected.hlsl deleted file mode 100644 index 20c8c76b46..0000000000 --- a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void tan_7ea104() { - float3 res = tan(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - tan_7ea104(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - tan_7ea104(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - tan_7ea104(); - return; -} diff --git a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.msl b/test/tint/builtins/gen/tan/7ea104.wgsl.expected.msl deleted file mode 100644 index 3be2db34ac..0000000000 --- a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void tan_7ea104() { - float3 res = tan(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - tan_7ea104(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - tan_7ea104(); - return; -} - -kernel void compute_main() { - tan_7ea104(); - return; -} - diff --git a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.spvasm b/test/tint/builtins/gen/tan/7ea104.wgsl.expected.spvasm deleted file mode 100644 index 591213795f..0000000000 --- a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tan_7ea104 "tan_7ea104" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %tan_7ea104 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Tan %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %tan_7ea104 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %tan_7ea104 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %tan_7ea104 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.wgsl b/test/tint/builtins/gen/tan/7ea104.wgsl.expected.wgsl deleted file mode 100644 index f859e5063e..0000000000 --- a/test/tint/builtins/gen/tan/7ea104.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn tan_7ea104() { - var res : vec3 = tan(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tan_7ea104(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tan_7ea104(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tan_7ea104(); -} diff --git a/test/tint/builtins/gen/tan/8ce3e9.wgsl b/test/tint/builtins/gen/tan/8ce3e9.wgsl deleted file mode 100644 index ec2ff093b3..0000000000 --- a/test/tint/builtins/gen/tan/8ce3e9.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn tan(vec<2, f32>) -> vec<2, f32> -fn tan_8ce3e9() { - var res: vec2 = tan(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tan_8ce3e9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tan_8ce3e9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tan_8ce3e9(); -} diff --git a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.glsl b/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.glsl deleted file mode 100644 index 98bd7ff120..0000000000 --- a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void tan_8ce3e9() { - vec2 res = tan(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - tan_8ce3e9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void tan_8ce3e9() { - vec2 res = tan(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - tan_8ce3e9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void tan_8ce3e9() { - vec2 res = tan(vec2(0.0f, 0.0f)); -} - -void compute_main() { - tan_8ce3e9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.hlsl b/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.hlsl deleted file mode 100644 index 2fce0cdf40..0000000000 --- a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void tan_8ce3e9() { - float2 res = tan(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - tan_8ce3e9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - tan_8ce3e9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - tan_8ce3e9(); - return; -} diff --git a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.msl b/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.msl deleted file mode 100644 index 92e515caa9..0000000000 --- a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void tan_8ce3e9() { - float2 res = tan(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - tan_8ce3e9(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - tan_8ce3e9(); - return; -} - -kernel void compute_main() { - tan_8ce3e9(); - return; -} - diff --git a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.spvasm b/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.spvasm deleted file mode 100644 index a649a5373c..0000000000 --- a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tan_8ce3e9 "tan_8ce3e9" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 - %tan_8ce3e9 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Tan %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %tan_8ce3e9 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %tan_8ce3e9 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %tan_8ce3e9 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.wgsl b/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.wgsl deleted file mode 100644 index a43d8095c5..0000000000 --- a/test/tint/builtins/gen/tan/8ce3e9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn tan_8ce3e9() { - var res : vec2 = tan(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tan_8ce3e9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tan_8ce3e9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tan_8ce3e9(); -} diff --git a/test/tint/builtins/gen/tanh/5663c5.wgsl b/test/tint/builtins/gen/tanh/5663c5.wgsl deleted file mode 100644 index d8b3708273..0000000000 --- a/test/tint/builtins/gen/tanh/5663c5.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn tanh(vec<4, f32>) -> vec<4, f32> -fn tanh_5663c5() { - var res: vec4 = tanh(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tanh_5663c5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tanh_5663c5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tanh_5663c5(); -} diff --git a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.glsl b/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.glsl deleted file mode 100644 index bf62f646f1..0000000000 --- a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void tanh_5663c5() { - vec4 res = tanh(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - tanh_5663c5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void tanh_5663c5() { - vec4 res = tanh(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - tanh_5663c5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void tanh_5663c5() { - vec4 res = tanh(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - tanh_5663c5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.hlsl b/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.hlsl deleted file mode 100644 index f74f2ad3e7..0000000000 --- a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void tanh_5663c5() { - float4 res = tanh(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - tanh_5663c5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - tanh_5663c5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - tanh_5663c5(); - return; -} diff --git a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.msl b/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.msl deleted file mode 100644 index 4272f820a6..0000000000 --- a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void tanh_5663c5() { - float4 res = tanh(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - tanh_5663c5(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - tanh_5663c5(); - return; -} - -kernel void compute_main() { - tanh_5663c5(); - return; -} - diff --git a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.spvasm b/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.spvasm deleted file mode 100644 index 0c9049a0aa..0000000000 --- a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tanh_5663c5 "tanh_5663c5" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tanh_5663c5 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Tanh %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %tanh_5663c5 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %tanh_5663c5 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %tanh_5663c5 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.wgsl b/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.wgsl deleted file mode 100644 index 717091bf70..0000000000 --- a/test/tint/builtins/gen/tanh/5663c5.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn tanh_5663c5() { - var res : vec4 = tanh(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tanh_5663c5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tanh_5663c5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tanh_5663c5(); -} diff --git a/test/tint/builtins/gen/tanh/5724b3.wgsl b/test/tint/builtins/gen/tanh/5724b3.wgsl deleted file mode 100644 index 0a184d2360..0000000000 --- a/test/tint/builtins/gen/tanh/5724b3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn tanh(vec<2, f32>) -> vec<2, f32> -fn tanh_5724b3() { - var res: vec2 = tanh(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tanh_5724b3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tanh_5724b3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tanh_5724b3(); -} diff --git a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.glsl b/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.glsl deleted file mode 100644 index 3c4f928541..0000000000 --- a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void tanh_5724b3() { - vec2 res = tanh(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - tanh_5724b3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void tanh_5724b3() { - vec2 res = tanh(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - tanh_5724b3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void tanh_5724b3() { - vec2 res = tanh(vec2(0.0f, 0.0f)); -} - -void compute_main() { - tanh_5724b3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.hlsl b/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.hlsl deleted file mode 100644 index be84750211..0000000000 --- a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void tanh_5724b3() { - float2 res = tanh(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - tanh_5724b3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - tanh_5724b3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - tanh_5724b3(); - return; -} diff --git a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.msl b/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.msl deleted file mode 100644 index bee133bf8f..0000000000 --- a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void tanh_5724b3() { - float2 res = tanh(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - tanh_5724b3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - tanh_5724b3(); - return; -} - -kernel void compute_main() { - tanh_5724b3(); - return; -} - diff --git a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.spvasm b/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.spvasm deleted file mode 100644 index ec85587d15..0000000000 --- a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tanh_5724b3 "tanh_5724b3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tanh_5724b3 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Tanh %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %tanh_5724b3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %tanh_5724b3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %tanh_5724b3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.wgsl b/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.wgsl deleted file mode 100644 index 7fbd481e1b..0000000000 --- a/test/tint/builtins/gen/tanh/5724b3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn tanh_5724b3() { - var res : vec2 = tanh(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tanh_5724b3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tanh_5724b3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tanh_5724b3(); -} diff --git a/test/tint/builtins/gen/tanh/9f9fb9.wgsl b/test/tint/builtins/gen/tanh/9f9fb9.wgsl deleted file mode 100644 index 861bf41388..0000000000 --- a/test/tint/builtins/gen/tanh/9f9fb9.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn tanh(vec<3, f32>) -> vec<3, f32> -fn tanh_9f9fb9() { - var res: vec3 = tanh(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tanh_9f9fb9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tanh_9f9fb9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tanh_9f9fb9(); -} diff --git a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.glsl b/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.glsl deleted file mode 100644 index f47a5f0fe6..0000000000 --- a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void tanh_9f9fb9() { - vec3 res = tanh(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - tanh_9f9fb9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void tanh_9f9fb9() { - vec3 res = tanh(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - tanh_9f9fb9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void tanh_9f9fb9() { - vec3 res = tanh(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - tanh_9f9fb9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.hlsl b/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.hlsl deleted file mode 100644 index 7470a05d5f..0000000000 --- a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void tanh_9f9fb9() { - float3 res = tanh(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - tanh_9f9fb9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - tanh_9f9fb9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - tanh_9f9fb9(); - return; -} diff --git a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.msl b/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.msl deleted file mode 100644 index 47a61a0adf..0000000000 --- a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void tanh_9f9fb9() { - float3 res = tanh(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - tanh_9f9fb9(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - tanh_9f9fb9(); - return; -} - -kernel void compute_main() { - tanh_9f9fb9(); - return; -} - diff --git a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.spvasm b/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.spvasm deleted file mode 100644 index 3afa2634fb..0000000000 --- a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %tanh_9f9fb9 "tanh_9f9fb9" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%tanh_9f9fb9 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Tanh %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %tanh_9f9fb9 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %tanh_9f9fb9 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %tanh_9f9fb9 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.wgsl b/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.wgsl deleted file mode 100644 index 20184fd0f8..0000000000 --- a/test/tint/builtins/gen/tanh/9f9fb9.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn tanh_9f9fb9() { - var res : vec3 = tanh(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tanh_9f9fb9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tanh_9f9fb9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tanh_9f9fb9(); -} diff --git a/test/tint/builtins/gen/tanh/c15fdb.wgsl b/test/tint/builtins/gen/tanh/c15fdb.wgsl deleted file mode 100644 index 35b0597a79..0000000000 --- a/test/tint/builtins/gen/tanh/c15fdb.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn tanh(f32) -> f32 -fn tanh_c15fdb() { - var res: f32 = tanh(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tanh_c15fdb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tanh_c15fdb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tanh_c15fdb(); -} diff --git a/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.glsl b/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.glsl deleted file mode 100644 index b40fb216f2..0000000000 --- a/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void tanh_c15fdb() { - float res = tanh(1.0f); -} - -vec4 vertex_main() { - tanh_c15fdb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void tanh_c15fdb() { - float res = tanh(1.0f); -} - -void fragment_main() { - tanh_c15fdb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void tanh_c15fdb() { - float res = tanh(1.0f); -} - -void compute_main() { - tanh_c15fdb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.hlsl b/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.hlsl deleted file mode 100644 index 27b68c0ff8..0000000000 --- a/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void tanh_c15fdb() { - float res = tanh(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - tanh_c15fdb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - tanh_c15fdb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - tanh_c15fdb(); - return; -} diff --git a/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.msl b/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.msl deleted file mode 100644 index b9400e8ea4..0000000000 --- a/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void tanh_c15fdb() { - float res = tanh(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - tanh_c15fdb(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - tanh_c15fdb(); - return; -} - -kernel void compute_main() { - tanh_c15fdb(); - return; -} - diff --git a/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.wgsl deleted file mode 100644 index fb6e8e7cf4..0000000000 --- a/test/tint/builtins/gen/tanh/c15fdb.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn tanh_c15fdb() { - var res : f32 = tanh(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - tanh_c15fdb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - tanh_c15fdb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - tanh_c15fdb(); -} diff --git a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl b/test/tint/builtins/gen/textureDimensions/002b2a.wgsl deleted file mode 100644 index 3edc18bd1b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureDimensions(texture: texture_1d) -> i32 -fn textureDimensions_002b2a() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_002b2a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_002b2a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_002b2a(); -} diff --git a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.glsl deleted file mode 100644 index d2663c5d59..0000000000 --- a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler1D arg_0_1; -void textureDimensions_002b2a() { - int res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_002b2a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'sampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler1D arg_0_1; -void textureDimensions_002b2a() { - int res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_002b2a(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'sampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler1D arg_0_1; -void textureDimensions_002b2a() { - int res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_002b2a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'sampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.hlsl deleted file mode 100644 index bf45f40955..0000000000 --- a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureDimensions_002b2a() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_002b2a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_002b2a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_002b2a(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.msl deleted file mode 100644 index 7e980a0945..0000000000 --- a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_002b2a(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_002b2a(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_002b2a(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_002b2a(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.wgsl deleted file mode 100644 index a21a8c0b16..0000000000 --- a/test/tint/builtins/gen/textureDimensions/002b2a.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureDimensions_002b2a() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_002b2a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_002b2a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_002b2a(); -} diff --git a/test/tint/builtins/gen/textureDimensions/012b82.wgsl b/test/tint/builtins/gen/textureDimensions/012b82.wgsl deleted file mode 100644 index af04cf494a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/012b82.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_012b82() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_012b82(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_012b82(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_012b82(); -} diff --git a/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.glsl deleted file mode 100644 index 7746614254..0000000000 --- a/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_012b82() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_012b82(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_012b82() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_012b82(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_012b82() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_012b82(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.hlsl deleted file mode 100644 index 60766e2871..0000000000 --- a/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_012b82() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_012b82(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_012b82(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_012b82(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.msl deleted file mode 100644 index 2eedc2fca9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_012b82(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_012b82(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_012b82(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_012b82(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.wgsl deleted file mode 100644 index 7ebcab6b4e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/012b82.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_012b82() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_012b82(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_012b82(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_012b82(); -} diff --git a/test/tint/builtins/gen/textureDimensions/08753d.wgsl b/test/tint/builtins/gen/textureDimensions/08753d.wgsl deleted file mode 100644 index e012e2c50f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/08753d.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_08753d() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_08753d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_08753d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_08753d(); -} diff --git a/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.glsl deleted file mode 100644 index 9f92f84227..0000000000 --- a/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_08753d() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_08753d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba16i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_08753d() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_08753d(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'iimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_08753d() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_08753d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.hlsl deleted file mode 100644 index 7bfb2760d4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_08753d() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_08753d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_08753d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_08753d(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.msl deleted file mode 100644 index b17a320d5b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_08753d(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_08753d(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_08753d(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_08753d(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.wgsl deleted file mode 100644 index 45dce4b559..0000000000 --- a/test/tint/builtins/gen/textureDimensions/08753d.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_08753d() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_08753d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_08753d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_08753d(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl b/test/tint/builtins/gen/textureDimensions/0c4772.wgsl deleted file mode 100644 index 42af723c53..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_0c4772() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0c4772(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0c4772(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0c4772(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.glsl deleted file mode 100644 index b0d5c9680f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16f) uniform highp writeonly image3D arg_0; -void textureDimensions_0c4772() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_0c4772(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16f) uniform highp writeonly image3D arg_0; -void textureDimensions_0c4772() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_0c4772(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16f) uniform highp writeonly image3D arg_0; -void textureDimensions_0c4772() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_0c4772(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.hlsl deleted file mode 100644 index 573849ad14..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_0c4772() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_0c4772(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_0c4772(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_0c4772(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.msl deleted file mode 100644 index f44d72ecc6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_0c4772(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_0c4772(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_0c4772(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_0c4772(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.wgsl deleted file mode 100644 index dc5fc35cb9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0c4772.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_0c4772() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0c4772(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0c4772(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0c4772(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl b/test/tint/builtins/gen/textureDimensions/0cce40.wgsl deleted file mode 100644 index cb527a915c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_0cce40() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0cce40(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0cce40(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0cce40(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.glsl deleted file mode 100644 index 3e1b29face..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(r32i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_0cce40() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_0cce40(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(r32i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_0cce40() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_0cce40(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'iimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(r32i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_0cce40() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_0cce40(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.hlsl deleted file mode 100644 index 8c733a250c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_0cce40() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_0cce40(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_0cce40(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_0cce40(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.msl deleted file mode 100644 index c2d4cceed6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_0cce40(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_0cce40(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_0cce40(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_0cce40(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.wgsl deleted file mode 100644 index 04b0e24fd1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cce40.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_0cce40() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0cce40(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0cce40(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0cce40(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl b/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl deleted file mode 100644 index 738123f22b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_0cf2ff() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0cf2ff(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0cf2ff(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0cf2ff(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.glsl deleted file mode 100644 index dba3da35a2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_0cf2ff() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_0cf2ff(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_0cf2ff() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_0cf2ff(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_0cf2ff() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_0cf2ff(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.hlsl deleted file mode 100644 index 301fb17eea..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_0cf2ff() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_0cf2ff(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_0cf2ff(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_0cf2ff(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.msl deleted file mode 100644 index f1bd381b91..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_0cf2ff(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_0cf2ff(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_0cf2ff(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_0cf2ff(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.wgsl deleted file mode 100644 index 36e3e6109f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0cf2ff.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_0cf2ff() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0cf2ff(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0cf2ff(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0cf2ff(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl b/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl deleted file mode 100644 index 19b92f6a77..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_0d8b7e() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0d8b7e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0d8b7e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0d8b7e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.glsl deleted file mode 100644 index bdfde77bf0..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_0d8b7e() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_0d8b7e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_0d8b7e() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_0d8b7e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_0d8b7e() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_0d8b7e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.hlsl deleted file mode 100644 index 787e81ad3f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_0d8b7e() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_0d8b7e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_0d8b7e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_0d8b7e(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.msl deleted file mode 100644 index 3470bd7e14..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_0d8b7e(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_0d8b7e(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_0d8b7e(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_0d8b7e(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.wgsl deleted file mode 100644 index b4a1350a3b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0d8b7e.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_0d8b7e() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0d8b7e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0d8b7e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0d8b7e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl b/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl deleted file mode 100644 index 8a368163fa..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_0e32ee() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0e32ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0e32ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0e32ee(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.glsl deleted file mode 100644 index 3ffd97cb58..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_0e32ee() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_0e32ee(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_0e32ee() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_0e32ee(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_0e32ee() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_0e32ee(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.hlsl deleted file mode 100644 index ab26ea3779..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_0e32ee() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_0e32ee(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_0e32ee(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_0e32ee(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.msl deleted file mode 100644 index 1b58235cbf..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_0e32ee(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_0e32ee(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_0e32ee(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_0e32ee(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.wgsl deleted file mode 100644 index 9f0e1d1347..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0e32ee.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_0e32ee() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0e32ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0e32ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0e32ee(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl b/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl deleted file mode 100644 index 17a8ef1599..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureDimensions(texture: texture_2d_array) -> vec2 -fn textureDimensions_0f3c50() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0f3c50(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0f3c50(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0f3c50(); -} diff --git a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.glsl deleted file mode 100644 index 9435cc45f9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureDimensions_0f3c50() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_0f3c50(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DArray arg_0_1; -void textureDimensions_0f3c50() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_0f3c50(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureDimensions_0f3c50() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_0f3c50(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.hlsl deleted file mode 100644 index 6a15db4f21..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureDimensions_0f3c50() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_0f3c50(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_0f3c50(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_0f3c50(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.msl deleted file mode 100644 index 86e7f0d8a6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_0f3c50(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_0f3c50(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_0f3c50(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_0f3c50(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.wgsl deleted file mode 100644 index 553f57ea88..0000000000 --- a/test/tint/builtins/gen/textureDimensions/0f3c50.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureDimensions_0f3c50() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_0f3c50(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_0f3c50(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_0f3c50(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl b/test/tint/builtins/gen/textureDimensions/1191a5.wgsl deleted file mode 100644 index ad3dab85c4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureDimensions(texture: texture_2d) -> vec2 -fn textureDimensions_1191a5() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1191a5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1191a5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1191a5(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.glsl deleted file mode 100644 index cde99f1ab1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler2D arg_0_1; -void textureDimensions_1191a5() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_1191a5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2D arg_0_1; -void textureDimensions_1191a5() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_1191a5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2D arg_0_1; -void textureDimensions_1191a5() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_1191a5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.hlsl deleted file mode 100644 index 0700fb09b1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureDimensions_1191a5() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_1191a5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_1191a5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_1191a5(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.msl deleted file mode 100644 index 931111f502..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_1191a5(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_1191a5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_1191a5(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_1191a5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.wgsl deleted file mode 100644 index 2131304dac..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1191a5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureDimensions_1191a5() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1191a5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1191a5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1191a5(); -} diff --git a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl b/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl deleted file mode 100644 index f292f6dc55..0000000000 --- a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; - -// fn textureDimensions(texture: texture_depth_2d, level: i32) -> vec2 -fn textureDimensions_12c9bb() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_12c9bb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_12c9bb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_12c9bb(); -} diff --git a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.glsl deleted file mode 100644 index 635de52f01..0000000000 --- a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureDimensions_12c9bb() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_12c9bb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_1; -void textureDimensions_12c9bb() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_12c9bb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureDimensions_12c9bb() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_12c9bb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.hlsl deleted file mode 100644 index 2076c844af..0000000000 --- a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureDimensions_12c9bb() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_12c9bb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_12c9bb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_12c9bb(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.msl deleted file mode 100644 index d70293b962..0000000000 --- a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_12c9bb(depth2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_2) { - textureDimensions_12c9bb(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_12c9bb(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_12c9bb(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.spvasm deleted file mode 100644 index 82f66a740b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_12c9bb "textureDimensions_12c9bb" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %23 = OpConstantNull %v2int - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_12c9bb = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %23 - %19 = OpLoad %11 %arg_0 - %16 = OpImageQuerySizeLod %v2int %19 %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureDimensions_12c9bb - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %33 = OpLabel - %34 = OpFunctionCall %void %textureDimensions_12c9bb - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_12c9bb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.wgsl deleted file mode 100644 index 14d7f89b88..0000000000 --- a/test/tint/builtins/gen/textureDimensions/12c9bb.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -fn textureDimensions_12c9bb() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_12c9bb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_12c9bb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_12c9bb(); -} diff --git a/test/tint/builtins/gen/textureDimensions/147998.wgsl b/test/tint/builtins/gen/textureDimensions/147998.wgsl deleted file mode 100644 index 5acc4c1536..0000000000 --- a/test/tint/builtins/gen/textureDimensions/147998.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_147998() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_147998(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_147998(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_147998(); -} diff --git a/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.glsl deleted file mode 100644 index 077635f9a8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32f) uniform highp writeonly image2D arg_0; -void textureDimensions_147998() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_147998(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32f) uniform highp writeonly image2D arg_0; -void textureDimensions_147998() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_147998(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32f) uniform highp writeonly image2D arg_0; -void textureDimensions_147998() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_147998(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.hlsl deleted file mode 100644 index bbda25c536..0000000000 --- a/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_147998() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_147998(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_147998(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_147998(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.msl deleted file mode 100644 index 442985e860..0000000000 --- a/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_147998(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_147998(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_147998(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_147998(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.wgsl deleted file mode 100644 index 3cd6855640..0000000000 --- a/test/tint/builtins/gen/textureDimensions/147998.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_147998() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_147998(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_147998(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_147998(); -} diff --git a/test/tint/builtins/gen/textureDimensions/16036c.wgsl b/test/tint/builtins/gen/textureDimensions/16036c.wgsl deleted file mode 100644 index dbaa1deb61..0000000000 --- a/test/tint/builtins/gen/textureDimensions/16036c.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_16036c() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_16036c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_16036c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_16036c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.glsl deleted file mode 100644 index 3960245543..0000000000 --- a/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_16036c() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_16036c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_16036c() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_16036c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_16036c() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_16036c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.hlsl deleted file mode 100644 index 8478f6a1be..0000000000 --- a/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_16036c() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_16036c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_16036c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_16036c(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.msl deleted file mode 100644 index f8656f6dd6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_16036c(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_16036c(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_16036c(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_16036c(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.wgsl deleted file mode 100644 index 072b71e684..0000000000 --- a/test/tint/builtins/gen/textureDimensions/16036c.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_16036c() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_16036c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_16036c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_16036c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl b/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl deleted file mode 100644 index daa39542b5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_1b71f0() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1b71f0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1b71f0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1b71f0(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.glsl deleted file mode 100644 index 1b67e32986..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_1b71f0() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_1b71f0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_1b71f0() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_1b71f0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_1b71f0() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_1b71f0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.hlsl deleted file mode 100644 index 3807015dfb..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_1b71f0() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_1b71f0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_1b71f0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_1b71f0(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.msl deleted file mode 100644 index 54e8e1256d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_1b71f0(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_1b71f0(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_1b71f0(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_1b71f0(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.wgsl deleted file mode 100644 index 8fedb781ff..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1b71f0.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_1b71f0() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1b71f0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1b71f0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1b71f0(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl b/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl deleted file mode 100644 index 428f5ed009..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_1d6c26() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1d6c26(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1d6c26(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1d6c26(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.glsl deleted file mode 100644 index 46c5bc9e1b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8) uniform highp writeonly image2DArray arg_0; -void textureDimensions_1d6c26() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_1d6c26(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8) uniform highp writeonly image2DArray arg_0; -void textureDimensions_1d6c26() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_1d6c26(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8) uniform highp writeonly image2DArray arg_0; -void textureDimensions_1d6c26() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_1d6c26(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.hlsl deleted file mode 100644 index f6a80bf7ad..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_1d6c26() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_1d6c26(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_1d6c26(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_1d6c26(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.msl deleted file mode 100644 index ba2b6292db..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_1d6c26(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_1d6c26(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_1d6c26(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_1d6c26(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.wgsl deleted file mode 100644 index 1ca754c28d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1d6c26.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_1d6c26() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1d6c26(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1d6c26(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1d6c26(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl b/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl deleted file mode 100644 index 17be4e0120..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_1e9e39() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1e9e39(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1e9e39(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1e9e39(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.glsl deleted file mode 100644 index 8a9a8c804b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba16f) uniform highp writeonly image1D arg_0; -void textureDimensions_1e9e39() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_1e9e39(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba16f) uniform highp writeonly image1D arg_0; -void textureDimensions_1e9e39() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_1e9e39(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba16f) uniform highp writeonly image1D arg_0; -void textureDimensions_1e9e39() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_1e9e39(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.hlsl deleted file mode 100644 index 4fc4886e7a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_1e9e39() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_1e9e39(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_1e9e39(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_1e9e39(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.msl deleted file mode 100644 index c6219c278b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_1e9e39(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_1e9e39(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_1e9e39(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_1e9e39(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.wgsl deleted file mode 100644 index 938b1048a4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1e9e39.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_1e9e39() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1e9e39(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1e9e39(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1e9e39(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl b/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl deleted file mode 100644 index 6598efbe51..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureDimensions(texture: texture_2d_array) -> vec2 -fn textureDimensions_1f20c5() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1f20c5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1f20c5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1f20c5(); -} diff --git a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.glsl deleted file mode 100644 index 1e4931627c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureDimensions_1f20c5() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_1f20c5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DArray arg_0_1; -void textureDimensions_1f20c5() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_1f20c5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureDimensions_1f20c5() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_1f20c5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.hlsl deleted file mode 100644 index 482f78b636..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureDimensions_1f20c5() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_1f20c5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_1f20c5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_1f20c5(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.msl deleted file mode 100644 index 8d7cbc489b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_1f20c5(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_1f20c5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_1f20c5(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_1f20c5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.wgsl deleted file mode 100644 index 2cbde3e854..0000000000 --- a/test/tint/builtins/gen/textureDimensions/1f20c5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureDimensions_1f20c5() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_1f20c5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_1f20c5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_1f20c5(); -} diff --git a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl b/test/tint/builtins/gen/textureDimensions/214dd4.wgsl deleted file mode 100644 index b462c702c0..0000000000 --- a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_214dd4() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_214dd4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_214dd4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_214dd4(); -} diff --git a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.glsl deleted file mode 100644 index 302ea4b0b4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_214dd4() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_214dd4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_214dd4() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_214dd4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_214dd4() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_214dd4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.hlsl deleted file mode 100644 index 3266f6fa3a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_214dd4() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_214dd4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_214dd4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_214dd4(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.msl deleted file mode 100644 index dcda00a789..0000000000 --- a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_214dd4(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_214dd4(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_214dd4(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_214dd4(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.wgsl deleted file mode 100644 index a6e1919e1b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/214dd4.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_214dd4() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_214dd4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_214dd4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_214dd4(); -} diff --git a/test/tint/builtins/gen/textureDimensions/221f22.wgsl b/test/tint/builtins/gen/textureDimensions/221f22.wgsl deleted file mode 100644 index 8b3835af27..0000000000 --- a/test/tint/builtins/gen/textureDimensions/221f22.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 -fn textureDimensions_221f22() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_221f22(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_221f22(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_221f22(); -} diff --git a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.glsl deleted file mode 100644 index a66bf2c7cb..0000000000 --- a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isamplerCubeArray arg_0_1; -void textureDimensions_221f22() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_221f22(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isamplerCubeArray arg_0_1; -void textureDimensions_221f22() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_221f22(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isamplerCubeArray arg_0_1; -void textureDimensions_221f22() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_221f22(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.hlsl deleted file mode 100644 index 3d9c9f5948..0000000000 --- a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureDimensions_221f22() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_221f22(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_221f22(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_221f22(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.msl deleted file mode 100644 index b482e8d65c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_221f22(texturecube_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureDimensions_221f22(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_221f22(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_221f22(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.spvasm deleted file mode 100644 index 527024f3f5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.spvasm +++ /dev/null @@ -1,79 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_221f22 "textureDimensions_221f22" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v2int = OpTypeVector %int 2 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %25 = OpConstantNull %v2int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_221f22 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %25 - %21 = OpLoad %11 %arg_0 - %19 = OpImageQuerySizeLod %v3int %21 %int_0 - %17 = OpVectorShuffle %v2int %19 %19 0 1 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureDimensions_221f22 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_221f22 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %38 = OpLabel - %39 = OpFunctionCall %void %textureDimensions_221f22 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.wgsl deleted file mode 100644 index e05c6f5a2e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/221f22.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureDimensions_221f22() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_221f22(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_221f22(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_221f22(); -} diff --git a/test/tint/builtins/gen/textureDimensions/267788.wgsl b/test/tint/builtins/gen/textureDimensions/267788.wgsl deleted file mode 100644 index a90cd8148e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/267788.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 -fn textureDimensions_267788() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_267788(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_267788(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_267788(); -} diff --git a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.glsl deleted file mode 100644 index aad7d0d65b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureDimensions_267788() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_267788(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DArray arg_0_1; -void textureDimensions_267788() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_267788(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureDimensions_267788() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_267788(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.hlsl deleted file mode 100644 index e17bbeb753..0000000000 --- a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureDimensions_267788() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_267788(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_267788(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_267788(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.msl deleted file mode 100644 index 3590ad73a2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_267788(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_267788(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_267788(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_267788(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.spvasm deleted file mode 100644 index 7c1f7de6c9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.spvasm +++ /dev/null @@ -1,79 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 41 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_267788 "textureDimensions_267788" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %26 = OpConstantNull %v2int - %27 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_267788 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %26 - %22 = OpLoad %11 %arg_0 - %20 = OpImageQuerySizeLod %v3int %22 %int_0 - %17 = OpVectorShuffle %v2int %20 %20 0 1 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %27 - %29 = OpLabel - %30 = OpFunctionCall %void %textureDimensions_267788 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %32 = OpLabel - %33 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %33 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_267788 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %39 = OpLabel - %40 = OpFunctionCall %void %textureDimensions_267788 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.wgsl deleted file mode 100644 index 99d3c54fe9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/267788.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureDimensions_267788() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_267788(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_267788(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_267788(); -} diff --git a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl b/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl deleted file mode 100644 index 6f4278baf6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 -fn textureDimensions_26bdfa() { - var res: vec3 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_26bdfa(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_26bdfa(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_26bdfa(); -} diff --git a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.glsl deleted file mode 100644 index 8d9a5d1ded..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler3D arg_0_1; -void textureDimensions_26bdfa() { - ivec3 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_26bdfa(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_1; -void textureDimensions_26bdfa() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_26bdfa(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler3D arg_0_1; -void textureDimensions_26bdfa() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_26bdfa(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.hlsl deleted file mode 100644 index f7b5e00803..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureDimensions_26bdfa() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int3 res = tint_tmp.xyz; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_26bdfa(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_26bdfa(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_26bdfa(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.msl deleted file mode 100644 index 862a81e715..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_26bdfa(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0), tint_symbol_1.get_depth(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_26bdfa(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_26bdfa(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_26bdfa(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.spvasm deleted file mode 100644 index dda3b4f083..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_26bdfa "textureDimensions_26bdfa" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v3int = OpTypePointer Function %v3int - %23 = OpConstantNull %v3int - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_26bdfa = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %23 - %19 = OpLoad %11 %arg_0 - %16 = OpImageQuerySizeLod %v3int %19 %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureDimensions_26bdfa - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %33 = OpLabel - %34 = OpFunctionCall %void %textureDimensions_26bdfa - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_26bdfa - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.wgsl deleted file mode 100644 index 5f9267e000..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26bdfa.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureDimensions_26bdfa() { - var res : vec3 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_26bdfa(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_26bdfa(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_26bdfa(); -} diff --git a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl b/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl deleted file mode 100644 index 45a5004ed9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_26ef6c() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_26ef6c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_26ef6c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_26ef6c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.glsl deleted file mode 100644 index 97a168b67d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_26ef6c() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_26ef6c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_26ef6c() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_26ef6c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_26ef6c() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_26ef6c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.hlsl deleted file mode 100644 index 4044c0efc0..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_26ef6c() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_26ef6c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_26ef6c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_26ef6c(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.msl deleted file mode 100644 index 14cfc8ca13..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_26ef6c(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_26ef6c(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_26ef6c(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_26ef6c(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.wgsl deleted file mode 100644 index 960c66d5b8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/26ef6c.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_26ef6c() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_26ef6c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_26ef6c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_26ef6c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl b/test/tint/builtins/gen/textureDimensions/2ad087.wgsl deleted file mode 100644 index b26368dc73..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_2ad087() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_2ad087(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_2ad087(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_2ad087(); -} diff --git a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.glsl deleted file mode 100644 index d5eec9227a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_2ad087() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_2ad087(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_2ad087() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_2ad087(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_2ad087() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_2ad087(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.hlsl deleted file mode 100644 index fed6aa30df..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_2ad087() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_2ad087(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_2ad087(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_2ad087(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.msl deleted file mode 100644 index 848bc3b8d8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_2ad087(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_2ad087(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_2ad087(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_2ad087(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.wgsl deleted file mode 100644 index c2b8327fa5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2ad087.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_2ad087() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_2ad087(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_2ad087(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_2ad087(); -} diff --git a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl b/test/tint/builtins/gen/textureDimensions/2efa05.wgsl deleted file mode 100644 index 8989190b51..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 -fn textureDimensions_2efa05() { - var res: vec3 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_2efa05(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_2efa05(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_2efa05(); -} diff --git a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.glsl deleted file mode 100644 index 952b37db0c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler3D arg_0_1; -void textureDimensions_2efa05() { - ivec3 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_2efa05(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler3D arg_0_1; -void textureDimensions_2efa05() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_2efa05(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler3D arg_0_1; -void textureDimensions_2efa05() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_2efa05(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.hlsl deleted file mode 100644 index 5ea5c3e367..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureDimensions_2efa05() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int3 res = tint_tmp.xyz; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_2efa05(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_2efa05(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_2efa05(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.msl deleted file mode 100644 index 85bf657323..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_2efa05(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0), tint_symbol_1.get_depth(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_2efa05(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_2efa05(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_2efa05(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.spvasm deleted file mode 100644 index 3293c2788e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.spvasm +++ /dev/null @@ -1,77 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 39 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_2efa05 "textureDimensions_2efa05" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v3int = OpTypePointer Function %v3int - %24 = OpConstantNull %v3int - %25 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_2efa05 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %24 - %20 = OpLoad %11 %arg_0 - %17 = OpImageQuerySizeLod %v3int %20 %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %25 - %27 = OpLabel - %28 = OpFunctionCall %void %textureDimensions_2efa05 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %30 = OpLabel - %31 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %31 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %34 = OpLabel - %35 = OpFunctionCall %void %textureDimensions_2efa05 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %37 = OpLabel - %38 = OpFunctionCall %void %textureDimensions_2efa05 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.wgsl deleted file mode 100644 index 0b9afd8376..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2efa05.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureDimensions_2efa05() { - var res : vec3 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_2efa05(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_2efa05(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_2efa05(); -} diff --git a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl b/test/tint/builtins/gen/textureDimensions/2f289f.wgsl deleted file mode 100644 index bb5a07f3f3..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_2f289f() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_2f289f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_2f289f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_2f289f(); -} diff --git a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.glsl deleted file mode 100644 index 54c28ed7f5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_2f289f() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_2f289f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_2f289f() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_2f289f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_2f289f() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_2f289f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.hlsl deleted file mode 100644 index 4adc44e099..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_2f289f() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_2f289f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_2f289f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_2f289f(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.msl deleted file mode 100644 index cd44b36b9f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_2f289f(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_2f289f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_2f289f(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_2f289f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.wgsl deleted file mode 100644 index 7ffc030342..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2f289f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_2f289f() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_2f289f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_2f289f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_2f289f(); -} diff --git a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl b/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl deleted file mode 100644 index 4b3ebb548d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 -fn textureDimensions_2fe1cc() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_2fe1cc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_2fe1cc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_2fe1cc(); -} diff --git a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.glsl deleted file mode 100644 index a2e9484ef8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureDimensions_2fe1cc() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_2fe1cc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_1; -void textureDimensions_2fe1cc() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_2fe1cc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureDimensions_2fe1cc() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_2fe1cc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.hlsl deleted file mode 100644 index 83bb4588a8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureDimensions_2fe1cc() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_2fe1cc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_2fe1cc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_2fe1cc(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.msl deleted file mode 100644 index 28214cb859..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_2fe1cc(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_2fe1cc(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_2fe1cc(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_2fe1cc(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.spvasm deleted file mode 100644 index a95be9ef19..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_2fe1cc "textureDimensions_2fe1cc" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %23 = OpConstantNull %v2int - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_2fe1cc = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %23 - %19 = OpLoad %11 %arg_0 - %16 = OpImageQuerySizeLod %v2int %19 %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureDimensions_2fe1cc - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %33 = OpLabel - %34 = OpFunctionCall %void %textureDimensions_2fe1cc - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_2fe1cc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.wgsl deleted file mode 100644 index 4b03276e15..0000000000 --- a/test/tint/builtins/gen/textureDimensions/2fe1cc.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureDimensions_2fe1cc() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_2fe1cc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_2fe1cc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_2fe1cc(); -} diff --git a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl b/test/tint/builtins/gen/textureDimensions/318ecc.wgsl deleted file mode 100644 index 88f0459124..0000000000 --- a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_318ecc() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_318ecc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_318ecc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_318ecc(); -} diff --git a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.glsl deleted file mode 100644 index 1e789b983b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_318ecc() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_318ecc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba16ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_318ecc() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_318ecc(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'uimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_318ecc() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_318ecc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.hlsl deleted file mode 100644 index 75080a7adc..0000000000 --- a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_318ecc() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_318ecc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_318ecc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_318ecc(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.msl deleted file mode 100644 index d98992ed86..0000000000 --- a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_318ecc(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_318ecc(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_318ecc(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_318ecc(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.wgsl deleted file mode 100644 index d1c53d49be..0000000000 --- a/test/tint/builtins/gen/textureDimensions/318ecc.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_318ecc() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_318ecc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_318ecc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_318ecc(); -} diff --git a/test/tint/builtins/gen/textureDimensions/340d06.wgsl b/test/tint/builtins/gen/textureDimensions/340d06.wgsl deleted file mode 100644 index aa5d78eba8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/340d06.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_340d06() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_340d06(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_340d06(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_340d06(); -} diff --git a/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.glsl deleted file mode 100644 index fbb57839c9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_340d06() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_340d06(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_340d06() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_340d06(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_340d06() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_340d06(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.hlsl deleted file mode 100644 index 93b038d447..0000000000 --- a/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_340d06() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_340d06(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_340d06(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_340d06(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.msl deleted file mode 100644 index bb2348a3ef..0000000000 --- a/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_340d06(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_340d06(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_340d06(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_340d06(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.wgsl deleted file mode 100644 index 7ae21b4ce9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/340d06.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_340d06() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_340d06(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_340d06(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_340d06(); -} diff --git a/test/tint/builtins/gen/textureDimensions/398e30.wgsl b/test/tint/builtins/gen/textureDimensions/398e30.wgsl deleted file mode 100644 index ba00534176..0000000000 --- a/test/tint/builtins/gen/textureDimensions/398e30.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_398e30() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_398e30(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_398e30(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_398e30(); -} diff --git a/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.glsl deleted file mode 100644 index 05514e27b7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_398e30() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_398e30(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_398e30() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_398e30(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_398e30() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_398e30(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.hlsl deleted file mode 100644 index fe14ce7623..0000000000 --- a/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_398e30() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_398e30(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_398e30(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_398e30(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.msl deleted file mode 100644 index a2bff50d18..0000000000 --- a/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_398e30(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_398e30(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_398e30(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_398e30(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.wgsl deleted file mode 100644 index 457ff70cff..0000000000 --- a/test/tint/builtins/gen/textureDimensions/398e30.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_398e30() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_398e30(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_398e30(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_398e30(); -} diff --git a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl b/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl deleted file mode 100644 index b0083331be..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_3a94ea() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_3a94ea(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_3a94ea(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_3a94ea(); -} diff --git a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.glsl deleted file mode 100644 index 8ea82bfcfb..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_3a94ea() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_3a94ea(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_3a94ea() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_3a94ea(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_3a94ea() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_3a94ea(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.hlsl deleted file mode 100644 index f3fb0f0360..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_3a94ea() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_3a94ea(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_3a94ea(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_3a94ea(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.msl deleted file mode 100644 index 512103551a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_3a94ea(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_3a94ea(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_3a94ea(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_3a94ea(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.wgsl deleted file mode 100644 index 29d95790f2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3a94ea.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_3a94ea() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_3a94ea(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_3a94ea(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_3a94ea(); -} diff --git a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl b/test/tint/builtins/gen/textureDimensions/3aca08.wgsl deleted file mode 100644 index de36f08505..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_3aca08() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_3aca08(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_3aca08(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_3aca08(); -} diff --git a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.glsl deleted file mode 100644 index eb335ead36..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba32f) uniform highp writeonly image1D arg_0; -void textureDimensions_3aca08() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_3aca08(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba32f) uniform highp writeonly image1D arg_0; -void textureDimensions_3aca08() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_3aca08(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba32f) uniform highp writeonly image1D arg_0; -void textureDimensions_3aca08() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_3aca08(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.hlsl deleted file mode 100644 index 210915d16f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_3aca08() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_3aca08(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_3aca08(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_3aca08(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.msl deleted file mode 100644 index f5e4b1b481..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_3aca08(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_3aca08(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_3aca08(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_3aca08(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.wgsl deleted file mode 100644 index ba8e34f7ca..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3aca08.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_3aca08() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_3aca08(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_3aca08(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_3aca08(); -} diff --git a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl b/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl deleted file mode 100644 index 63398de6fe..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_3c5ad8() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_3c5ad8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_3c5ad8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_3c5ad8(); -} diff --git a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.glsl deleted file mode 100644 index d29a9775e9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_3c5ad8() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_3c5ad8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_3c5ad8() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_3c5ad8(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_3c5ad8() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_3c5ad8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.hlsl deleted file mode 100644 index 2523598c6c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_3c5ad8() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_3c5ad8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_3c5ad8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_3c5ad8(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.msl deleted file mode 100644 index 1366cdf52d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_3c5ad8(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_3c5ad8(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_3c5ad8(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_3c5ad8(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.wgsl deleted file mode 100644 index dc42b19d97..0000000000 --- a/test/tint/builtins/gen/textureDimensions/3c5ad8.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_3c5ad8() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_3c5ad8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_3c5ad8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_3c5ad8(); -} diff --git a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl b/test/tint/builtins/gen/textureDimensions/4152a6.wgsl deleted file mode 100644 index a8ee80ce67..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureDimensions(texture: texture_cube_array) -> vec2 -fn textureDimensions_4152a6() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_4152a6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_4152a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_4152a6(); -} diff --git a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.glsl deleted file mode 100644 index 8517e62616..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usamplerCubeArray arg_0_1; -void textureDimensions_4152a6() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_4152a6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usamplerCubeArray arg_0_1; -void textureDimensions_4152a6() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_4152a6(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usamplerCubeArray arg_0_1; -void textureDimensions_4152a6() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_4152a6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.hlsl deleted file mode 100644 index f83e35d933..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureDimensions_4152a6() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_4152a6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_4152a6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_4152a6(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.msl deleted file mode 100644 index afa8c0f219..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_4152a6(texturecube_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureDimensions_4152a6(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_4152a6(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_4152a6(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.wgsl deleted file mode 100644 index f9ec8d52a2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4152a6.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureDimensions_4152a6() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_4152a6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_4152a6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_4152a6(); -} diff --git a/test/tint/builtins/gen/textureDimensions/423f99.wgsl b/test/tint/builtins/gen/textureDimensions/423f99.wgsl deleted file mode 100644 index 8029171004..0000000000 --- a/test/tint/builtins/gen/textureDimensions/423f99.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureDimensions(texture: texture_1d) -> i32 -fn textureDimensions_423f99() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_423f99(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_423f99(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_423f99(); -} diff --git a/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.glsl deleted file mode 100644 index 7602271e2f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isampler1D arg_0_1; -void textureDimensions_423f99() { - int res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_423f99(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isampler1D arg_0_1; -void textureDimensions_423f99() { - int res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_423f99(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isampler1D arg_0_1; -void textureDimensions_423f99() { - int res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_423f99(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.hlsl deleted file mode 100644 index 48d6c9ac66..0000000000 --- a/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureDimensions_423f99() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_423f99(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_423f99(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_423f99(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.msl deleted file mode 100644 index f6d8c32bd1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_423f99(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_423f99(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_423f99(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_423f99(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.wgsl deleted file mode 100644 index b84b03300c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/423f99.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureDimensions_423f99() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_423f99(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_423f99(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_423f99(); -} diff --git a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl b/test/tint/builtins/gen/textureDimensions/4267ee.wgsl deleted file mode 100644 index 1596f1c809..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_4267ee() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_4267ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_4267ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_4267ee(); -} diff --git a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.glsl deleted file mode 100644 index 1708919934..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32f) uniform highp writeonly image2D arg_0; -void textureDimensions_4267ee() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_4267ee(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32f) uniform highp writeonly image2D arg_0; -void textureDimensions_4267ee() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_4267ee(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32f) uniform highp writeonly image2D arg_0; -void textureDimensions_4267ee() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_4267ee(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.hlsl deleted file mode 100644 index 3e1886f43d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_4267ee() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_4267ee(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_4267ee(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_4267ee(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.msl deleted file mode 100644 index e6579cdc3c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_4267ee(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_4267ee(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_4267ee(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_4267ee(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.wgsl deleted file mode 100644 index 909269f2bc..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4267ee.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_4267ee() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_4267ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_4267ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_4267ee(); -} diff --git a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl b/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl deleted file mode 100644 index 06b887ad06..0000000000 --- a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_42d4e6() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_42d4e6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_42d4e6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_42d4e6(); -} diff --git a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.glsl deleted file mode 100644 index a7bb3d2066..0000000000 --- a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba8) uniform highp writeonly image1D arg_0; -void textureDimensions_42d4e6() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_42d4e6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba8) uniform highp writeonly image1D arg_0; -void textureDimensions_42d4e6() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_42d4e6(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba8) uniform highp writeonly image1D arg_0; -void textureDimensions_42d4e6() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_42d4e6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.hlsl deleted file mode 100644 index 23b4adcbf7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_42d4e6() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_42d4e6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_42d4e6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_42d4e6(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.msl deleted file mode 100644 index 5d05c3e452..0000000000 --- a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_42d4e6(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_42d4e6(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_42d4e6(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_42d4e6(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.wgsl deleted file mode 100644 index bc98490a9e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/42d4e6.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_42d4e6() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_42d4e6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_42d4e6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_42d4e6(); -} diff --git a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl b/test/tint/builtins/gen/textureDimensions/48cb89.wgsl deleted file mode 100644 index 25deb1bb0c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_48cb89() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_48cb89(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_48cb89(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_48cb89(); -} diff --git a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.glsl deleted file mode 100644 index 1872cda451..0000000000 --- a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16f) uniform highp writeonly image2D arg_0; -void textureDimensions_48cb89() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_48cb89(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16f) uniform highp writeonly image2D arg_0; -void textureDimensions_48cb89() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_48cb89(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16f) uniform highp writeonly image2D arg_0; -void textureDimensions_48cb89() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_48cb89(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.hlsl deleted file mode 100644 index c6168e4a1a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_48cb89() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_48cb89(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_48cb89(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_48cb89(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.msl deleted file mode 100644 index 14a1875b39..0000000000 --- a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_48cb89(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_48cb89(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_48cb89(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_48cb89(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.wgsl deleted file mode 100644 index cdc0578bd2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/48cb89.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_48cb89() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_48cb89(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_48cb89(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_48cb89(); -} diff --git a/test/tint/builtins/gen/textureDimensions/49d274.wgsl b/test/tint/builtins/gen/textureDimensions/49d274.wgsl deleted file mode 100644 index 37783cf96a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/49d274.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_49d274() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_49d274(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_49d274(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_49d274(); -} diff --git a/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.glsl deleted file mode 100644 index e441a6156f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_49d274() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_49d274(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_49d274() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_49d274(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_49d274() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_49d274(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.hlsl deleted file mode 100644 index a87072ee97..0000000000 --- a/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_49d274() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_49d274(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_49d274(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_49d274(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.msl deleted file mode 100644 index 69112a1d96..0000000000 --- a/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_49d274(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_49d274(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_49d274(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_49d274(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.wgsl deleted file mode 100644 index 00ebf3628e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/49d274.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_49d274() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_49d274(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_49d274(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_49d274(); -} diff --git a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl b/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl deleted file mode 100644 index c5ea5dd0eb..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_4df9a8() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_4df9a8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_4df9a8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_4df9a8(); -} diff --git a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.glsl deleted file mode 100644 index 7eed976490..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_4df9a8() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_4df9a8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_4df9a8() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_4df9a8(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_4df9a8() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_4df9a8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.hlsl deleted file mode 100644 index cbc70876da..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_4df9a8() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_4df9a8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_4df9a8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_4df9a8(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.msl deleted file mode 100644 index 36c25c4b56..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_4df9a8(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_4df9a8(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_4df9a8(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_4df9a8(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.wgsl deleted file mode 100644 index 4078aa2b55..0000000000 --- a/test/tint/builtins/gen/textureDimensions/4df9a8.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_4df9a8() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_4df9a8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_4df9a8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_4df9a8(); -} diff --git a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl b/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl deleted file mode 100644 index eefaaf8539..0000000000 --- a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 -fn textureDimensions_50a9ee() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_50a9ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_50a9ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_50a9ee(); -} diff --git a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.glsl deleted file mode 100644 index c74de1bf6f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_50a9ee() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_50a9ee(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_50a9ee() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_50a9ee(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_50a9ee() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_50a9ee(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.hlsl deleted file mode 100644 index 73140c6b34..0000000000 --- a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureDimensions_50a9ee() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_50a9ee(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_50a9ee(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_50a9ee(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.msl deleted file mode 100644 index 0924964a8b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_50a9ee(texturecube_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureDimensions_50a9ee(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_50a9ee(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_50a9ee(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.spvasm deleted file mode 100644 index e0dd9de76f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.spvasm +++ /dev/null @@ -1,79 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_50a9ee "textureDimensions_50a9ee" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %25 = OpConstantNull %v2int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_50a9ee = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %25 - %21 = OpLoad %11 %arg_0 - %19 = OpImageQuerySizeLod %v3int %21 %int_0 - %16 = OpVectorShuffle %v2int %19 %19 0 1 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureDimensions_50a9ee - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_50a9ee - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %38 = OpLabel - %39 = OpFunctionCall %void %textureDimensions_50a9ee - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.wgsl deleted file mode 100644 index f6e1440830..0000000000 --- a/test/tint/builtins/gen/textureDimensions/50a9ee.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureDimensions_50a9ee() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_50a9ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_50a9ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_50a9ee(); -} diff --git a/test/tint/builtins/gen/textureDimensions/52045c.wgsl b/test/tint/builtins/gen/textureDimensions/52045c.wgsl deleted file mode 100644 index e31d6be353..0000000000 --- a/test/tint/builtins/gen/textureDimensions/52045c.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureDimensions(texture: texture_1d, level: i32) -> i32 -fn textureDimensions_52045c() { - var res: i32 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_52045c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_52045c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_52045c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.glsl deleted file mode 100644 index 29cd75f6ea..0000000000 --- a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isampler1D arg_0_1; -void textureDimensions_52045c() { - int res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_52045c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isampler1D arg_0_1; -void textureDimensions_52045c() { - int res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_52045c(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isampler1D arg_0_1; -void textureDimensions_52045c() { - int res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_52045c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.hlsl deleted file mode 100644 index 00174241ec..0000000000 --- a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureDimensions_52045c() { - int2 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); - int res = tint_tmp.x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_52045c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_52045c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_52045c(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.msl deleted file mode 100644 index 81fc60c5cd..0000000000 --- a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_52045c(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_52045c(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_52045c(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_52045c(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.spvasm deleted file mode 100644 index 2d27a40254..0000000000 --- a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 37 -; Schema: 0 - OpCapability Shader - OpCapability Sampled1D - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_52045c "textureDimensions_52045c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 1D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %int_0 = OpConstant %int 0 -%_ptr_Function_int = OpTypePointer Function %int - %22 = OpConstantNull %int - %23 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_52045c = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_int Function %22 - %18 = OpLoad %11 %arg_0 - %17 = OpImageQuerySizeLod %int %18 %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %textureDimensions_52045c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %32 = OpLabel - %33 = OpFunctionCall %void %textureDimensions_52045c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_52045c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.wgsl deleted file mode 100644 index 9df7fc20d2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/52045c.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureDimensions_52045c() { - var res : i32 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_52045c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_52045c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_52045c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl b/test/tint/builtins/gen/textureDimensions/55b23e.wgsl deleted file mode 100644 index 82cc5664aa..0000000000 --- a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_55b23e() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_55b23e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_55b23e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_55b23e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.glsl deleted file mode 100644 index 5941a905aa..0000000000 --- a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32f) uniform highp writeonly image1D arg_0; -void textureDimensions_55b23e() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_55b23e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32f) uniform highp writeonly image1D arg_0; -void textureDimensions_55b23e() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_55b23e(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32f) uniform highp writeonly image1D arg_0; -void textureDimensions_55b23e() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_55b23e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.hlsl deleted file mode 100644 index 43d1ca2762..0000000000 --- a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_55b23e() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_55b23e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_55b23e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_55b23e(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.msl deleted file mode 100644 index 40ee9ecf0e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_55b23e(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_55b23e(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_55b23e(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_55b23e(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.wgsl deleted file mode 100644 index 32b929ccf5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/55b23e.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_55b23e() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_55b23e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_55b23e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_55b23e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/579629.wgsl b/test/tint/builtins/gen/textureDimensions/579629.wgsl deleted file mode 100644 index 49e35e3ffa..0000000000 --- a/test/tint/builtins/gen/textureDimensions/579629.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_multisampled_2d; - -// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 -fn textureDimensions_579629() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_579629(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_579629(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_579629(); -} diff --git a/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.glsl deleted file mode 100644 index 74a3b7a7a6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler2DMS arg_0_1; -void textureDimensions_579629() { - ivec2 res = textureSize(arg_0_1); -} - -vec4 vertex_main() { - textureDimensions_579629(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DMS arg_0_1; -void textureDimensions_579629() { - ivec2 res = textureSize(arg_0_1); -} - -void fragment_main() { - textureDimensions_579629(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DMS arg_0_1; -void textureDimensions_579629() { - ivec2 res = textureSize(arg_0_1); -} - -void compute_main() { - textureDimensions_579629(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.hlsl deleted file mode 100644 index 111f8dc6ac..0000000000 --- a/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureDimensions_579629() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_579629(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_579629(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_579629(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.msl deleted file mode 100644 index f1af5282ce..0000000000 --- a/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_579629(texture2d_ms tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_ms tint_symbol_2) { - textureDimensions_579629(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { - textureDimensions_579629(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { - textureDimensions_579629(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.wgsl deleted file mode 100644 index e157439e3d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/579629.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_multisampled_2d; - -fn textureDimensions_579629() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_579629(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_579629(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_579629(); -} diff --git a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl b/test/tint/builtins/gen/textureDimensions/57da0b.wgsl deleted file mode 100644 index bf57595617..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_57da0b() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_57da0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_57da0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_57da0b(); -} diff --git a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.glsl deleted file mode 100644 index b9922a5257..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(r32ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_57da0b() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_57da0b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(r32ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_57da0b() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_57da0b(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'uimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(r32ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_57da0b() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_57da0b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.hlsl deleted file mode 100644 index fca05c462d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_57da0b() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_57da0b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_57da0b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_57da0b(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.msl deleted file mode 100644 index c71837ffb9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_57da0b(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_57da0b(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_57da0b(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_57da0b(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.wgsl deleted file mode 100644 index f05ee1cf65..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57da0b.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_57da0b() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_57da0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_57da0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_57da0b(); -} diff --git a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl b/test/tint/builtins/gen/textureDimensions/57e28f.wgsl deleted file mode 100644 index d782714f4d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube; - -// fn textureDimensions(texture: texture_depth_cube) -> vec2 -fn textureDimensions_57e28f() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_57e28f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_57e28f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_57e28f(); -} diff --git a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.glsl deleted file mode 100644 index e3b5d7d0c9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureDimensions_57e28f() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_57e28f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_1; -void textureDimensions_57e28f() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_57e28f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureDimensions_57e28f() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_57e28f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.hlsl deleted file mode 100644 index 8c0a56f7d5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureDimensions_57e28f() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_57e28f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_57e28f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_57e28f(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.msl deleted file mode 100644 index fb1f889a99..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_57e28f(depthcube tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube tint_symbol_2) { - textureDimensions_57e28f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { - textureDimensions_57e28f(tint_symbol_4); - return; -} - -kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { - textureDimensions_57e28f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.wgsl deleted file mode 100644 index 3d257471e3..0000000000 --- a/test/tint/builtins/gen/textureDimensions/57e28f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube; - -fn textureDimensions_57e28f() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_57e28f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_57e28f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_57e28f(); -} diff --git a/test/tint/builtins/gen/textureDimensions/58a515.wgsl b/test/tint/builtins/gen/textureDimensions/58a515.wgsl deleted file mode 100644 index 1f024d4a8f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/58a515.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_58a515() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_58a515(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_58a515(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_58a515(); -} diff --git a/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.glsl deleted file mode 100644 index dc9f2f7a52..0000000000 --- a/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_58a515() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_58a515(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_58a515() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_58a515(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_58a515() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_58a515(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.hlsl deleted file mode 100644 index 878a448910..0000000000 --- a/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_58a515() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_58a515(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_58a515(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_58a515(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.msl deleted file mode 100644 index 2cc6f1a315..0000000000 --- a/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_58a515(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_58a515(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_58a515(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_58a515(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.wgsl deleted file mode 100644 index c395b923f7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/58a515.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_58a515() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_58a515(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_58a515(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_58a515(); -} diff --git a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl b/test/tint/builtins/gen/textureDimensions/5985f3.wgsl deleted file mode 100644 index ba79f20a83..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_5985f3() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_5985f3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_5985f3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_5985f3(); -} diff --git a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.glsl deleted file mode 100644 index 71cb39977e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_5985f3() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_5985f3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_5985f3() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_5985f3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_5985f3() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_5985f3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.hlsl deleted file mode 100644 index bedc7637df..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_5985f3() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_5985f3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_5985f3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_5985f3(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.msl deleted file mode 100644 index 9d911c8671..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_5985f3(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_5985f3(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_5985f3(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_5985f3(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.wgsl deleted file mode 100644 index cc73d08dc7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5985f3.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_5985f3() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_5985f3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_5985f3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_5985f3(); -} diff --git a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl b/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl deleted file mode 100644 index bc26c57c7c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_5caa5e() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_5caa5e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_5caa5e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_5caa5e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.glsl deleted file mode 100644 index ea9f7ed86a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_5caa5e() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_5caa5e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba32ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_5caa5e() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_5caa5e(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'uimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_5caa5e() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_5caa5e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.hlsl deleted file mode 100644 index 229e558943..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_5caa5e() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_5caa5e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_5caa5e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_5caa5e(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.msl deleted file mode 100644 index a23d4ab6e2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_5caa5e(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_5caa5e(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_5caa5e(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_5caa5e(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.wgsl deleted file mode 100644 index 3f834431a1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5caa5e.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_5caa5e() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_5caa5e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_5caa5e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_5caa5e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl b/test/tint/builtins/gen/textureDimensions/5e295d.wgsl deleted file mode 100644 index ed4854d3f7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_5e295d() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_5e295d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_5e295d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_5e295d(); -} diff --git a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.glsl deleted file mode 100644 index 362fb6c2af..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_5e295d() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_5e295d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_5e295d() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_5e295d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_5e295d() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_5e295d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.hlsl deleted file mode 100644 index 417d81794e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_5e295d() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_5e295d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_5e295d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_5e295d(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.msl deleted file mode 100644 index 4da0c3b6db..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_5e295d(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_5e295d(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_5e295d(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_5e295d(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.wgsl deleted file mode 100644 index d8bceb6fec..0000000000 --- a/test/tint/builtins/gen/textureDimensions/5e295d.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_5e295d() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_5e295d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_5e295d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_5e295d(); -} diff --git a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl b/test/tint/builtins/gen/textureDimensions/60bf54.wgsl deleted file mode 100644 index 1838e87158..0000000000 --- a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_60bf54() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_60bf54(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_60bf54(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_60bf54(); -} diff --git a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.glsl deleted file mode 100644 index 3b56047632..0000000000 --- a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_60bf54() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_60bf54(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_60bf54() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_60bf54(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_60bf54() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_60bf54(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.hlsl deleted file mode 100644 index 32730fd87e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_60bf54() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_60bf54(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_60bf54(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_60bf54(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.msl deleted file mode 100644 index 1f35ec2649..0000000000 --- a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_60bf54(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_60bf54(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_60bf54(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_60bf54(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.wgsl deleted file mode 100644 index f9347deb41..0000000000 --- a/test/tint/builtins/gen/textureDimensions/60bf54.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_60bf54() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_60bf54(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_60bf54(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_60bf54(); -} diff --git a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl b/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl deleted file mode 100644 index b997655052..0000000000 --- a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_63f3cf() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_63f3cf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_63f3cf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_63f3cf(); -} diff --git a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.glsl deleted file mode 100644 index c209b7730d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32f) uniform highp writeonly image3D arg_0; -void textureDimensions_63f3cf() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_63f3cf(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32f) uniform highp writeonly image3D arg_0; -void textureDimensions_63f3cf() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_63f3cf(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32f) uniform highp writeonly image3D arg_0; -void textureDimensions_63f3cf() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_63f3cf(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.hlsl deleted file mode 100644 index 68da62d6af..0000000000 --- a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_63f3cf() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_63f3cf(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_63f3cf(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_63f3cf(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.msl deleted file mode 100644 index 44388bc227..0000000000 --- a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_63f3cf(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_63f3cf(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_63f3cf(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_63f3cf(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.wgsl deleted file mode 100644 index 43e5f1573d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/63f3cf.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_63f3cf() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_63f3cf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_63f3cf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_63f3cf(); -} diff --git a/test/tint/builtins/gen/textureDimensions/68105c.wgsl b/test/tint/builtins/gen/textureDimensions/68105c.wgsl deleted file mode 100644 index c3ab22330f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/68105c.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_68105c() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_68105c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_68105c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_68105c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.glsl deleted file mode 100644 index d50c6d7b8c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_68105c() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_68105c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_68105c() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_68105c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_68105c() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_68105c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.hlsl deleted file mode 100644 index 362af75be5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_68105c() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_68105c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_68105c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_68105c(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.msl deleted file mode 100644 index ebafaa5dde..0000000000 --- a/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_68105c(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_68105c(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_68105c(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_68105c(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.wgsl deleted file mode 100644 index 853c631dc4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/68105c.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_68105c() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_68105c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_68105c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_68105c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl b/test/tint/builtins/gen/textureDimensions/686ef2.wgsl deleted file mode 100644 index 36f10f4fa0..0000000000 --- a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; - -// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 -fn textureDimensions_686ef2() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_686ef2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_686ef2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_686ef2(); -} diff --git a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.glsl deleted file mode 100644 index 1229becbef..0000000000 --- a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isamplerCube arg_0_1; -void textureDimensions_686ef2() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_686ef2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isamplerCube arg_0_1; -void textureDimensions_686ef2() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_686ef2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isamplerCube arg_0_1; -void textureDimensions_686ef2() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_686ef2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.hlsl deleted file mode 100644 index f96c776077..0000000000 --- a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureDimensions_686ef2() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_686ef2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_686ef2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_686ef2(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.msl deleted file mode 100644 index 6facf32607..0000000000 --- a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_686ef2(texturecube tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_2) { - textureDimensions_686ef2(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { - textureDimensions_686ef2(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { - textureDimensions_686ef2(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.spvasm deleted file mode 100644 index 90a2379cec..0000000000 --- a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_686ef2 "textureDimensions_686ef2" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %23 = OpConstantNull %v2int - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_686ef2 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %23 - %19 = OpLoad %11 %arg_0 - %17 = OpImageQuerySizeLod %v2int %19 %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureDimensions_686ef2 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %33 = OpLabel - %34 = OpFunctionCall %void %textureDimensions_686ef2 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_686ef2 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.wgsl deleted file mode 100644 index ba69786d40..0000000000 --- a/test/tint/builtins/gen/textureDimensions/686ef2.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -fn textureDimensions_686ef2() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_686ef2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_686ef2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_686ef2(); -} diff --git a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl b/test/tint/builtins/gen/textureDimensions/6adac6.wgsl deleted file mode 100644 index 4d454d13f0..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_6adac6() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_6adac6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_6adac6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_6adac6(); -} diff --git a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.glsl deleted file mode 100644 index 6ebb1cef6e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_6adac6() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_6adac6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba32i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_6adac6() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_6adac6(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'iimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_6adac6() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_6adac6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.hlsl deleted file mode 100644 index b000f3eed7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_6adac6() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_6adac6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_6adac6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_6adac6(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.msl deleted file mode 100644 index de1f67b2e8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_6adac6(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_6adac6(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_6adac6(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_6adac6(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.wgsl deleted file mode 100644 index c48c479c52..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6adac6.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_6adac6() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_6adac6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_6adac6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_6adac6(); -} diff --git a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl b/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl deleted file mode 100644 index 71ea69ea1b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureDimensions(texture: texture_3d) -> vec3 -fn textureDimensions_6ec1b4() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_6ec1b4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_6ec1b4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_6ec1b4(); -} diff --git a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.glsl deleted file mode 100644 index d07fb650c8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler3D arg_0_1; -void textureDimensions_6ec1b4() { - ivec3 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_6ec1b4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler3D arg_0_1; -void textureDimensions_6ec1b4() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_6ec1b4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler3D arg_0_1; -void textureDimensions_6ec1b4() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_6ec1b4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.hlsl deleted file mode 100644 index 148ca9a471..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureDimensions_6ec1b4() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_6ec1b4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_6ec1b4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_6ec1b4(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.msl deleted file mode 100644 index 379a6398fa..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_6ec1b4(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_6ec1b4(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_6ec1b4(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_6ec1b4(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.wgsl deleted file mode 100644 index 6cc7cc1946..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6ec1b4.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureDimensions_6ec1b4() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_6ec1b4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_6ec1b4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_6ec1b4(); -} diff --git a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl b/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl deleted file mode 100644 index 0be50aa52f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_6f0d79() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_6f0d79(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_6f0d79(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_6f0d79(); -} diff --git a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.glsl deleted file mode 100644 index c7a57bc2ec..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; -void textureDimensions_6f0d79() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_6f0d79(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; -void textureDimensions_6f0d79() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_6f0d79(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; -void textureDimensions_6f0d79() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_6f0d79(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.hlsl deleted file mode 100644 index eef51f44ea..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_6f0d79() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_6f0d79(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_6f0d79(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_6f0d79(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.msl deleted file mode 100644 index 0de9feabf4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_6f0d79(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_6f0d79(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_6f0d79(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_6f0d79(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.wgsl deleted file mode 100644 index 7b1f32c816..0000000000 --- a/test/tint/builtins/gen/textureDimensions/6f0d79.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_6f0d79() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_6f0d79(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_6f0d79(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_6f0d79(); -} diff --git a/test/tint/builtins/gen/textureDimensions/702c53.wgsl b/test/tint/builtins/gen/textureDimensions/702c53.wgsl deleted file mode 100644 index 7b217b35bf..0000000000 --- a/test/tint/builtins/gen/textureDimensions/702c53.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_702c53() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_702c53(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_702c53(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_702c53(); -} diff --git a/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.glsl deleted file mode 100644 index 33223e5da6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8) uniform highp writeonly image2D arg_0; -void textureDimensions_702c53() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_702c53(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8) uniform highp writeonly image2D arg_0; -void textureDimensions_702c53() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_702c53(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8) uniform highp writeonly image2D arg_0; -void textureDimensions_702c53() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_702c53(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.hlsl deleted file mode 100644 index 8ce443ae8f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_702c53() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_702c53(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_702c53(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_702c53(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.msl deleted file mode 100644 index 3dc0263bc3..0000000000 --- a/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_702c53(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_702c53(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_702c53(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_702c53(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.wgsl deleted file mode 100644 index 27d3074777..0000000000 --- a/test/tint/builtins/gen/textureDimensions/702c53.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_702c53() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_702c53(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_702c53(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_702c53(); -} diff --git a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl b/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl deleted file mode 100644 index ba2e7b00d1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; - -// fn textureDimensions(texture: texture_depth_2d_array, level: i32) -> vec2 -fn textureDimensions_72e5d6() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_72e5d6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_72e5d6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_72e5d6(); -} diff --git a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.glsl deleted file mode 100644 index fe92f44b94..0000000000 --- a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_72e5d6() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_72e5d6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_72e5d6() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_72e5d6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_72e5d6() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_72e5d6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.hlsl deleted file mode 100644 index 62bf752864..0000000000 --- a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureDimensions_72e5d6() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_72e5d6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_72e5d6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_72e5d6(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.msl deleted file mode 100644 index 5e835e305c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_72e5d6(depth2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_2) { - textureDimensions_72e5d6(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_72e5d6(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_72e5d6(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.spvasm deleted file mode 100644 index 7d2a40cd63..0000000000 --- a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.spvasm +++ /dev/null @@ -1,78 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_72e5d6 "textureDimensions_72e5d6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %25 = OpConstantNull %v2int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_72e5d6 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %25 - %21 = OpLoad %11 %arg_0 - %19 = OpImageQuerySizeLod %v3int %21 %int_0 - %16 = OpVectorShuffle %v2int %19 %19 0 1 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureDimensions_72e5d6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_72e5d6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %38 = OpLabel - %39 = OpFunctionCall %void %textureDimensions_72e5d6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.wgsl deleted file mode 100644 index b00bd04ce6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/72e5d6.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -fn textureDimensions_72e5d6() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_72e5d6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_72e5d6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_72e5d6(); -} diff --git a/test/tint/builtins/gen/textureDimensions/79df87.wgsl b/test/tint/builtins/gen/textureDimensions/79df87.wgsl deleted file mode 100644 index 2c05574653..0000000000 --- a/test/tint/builtins/gen/textureDimensions/79df87.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureDimensions(texture: texture_1d, level: i32) -> i32 -fn textureDimensions_79df87() { - var res: i32 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_79df87(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_79df87(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_79df87(); -} diff --git a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.glsl deleted file mode 100644 index b8ee4b2a7c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usampler1D arg_0_1; -void textureDimensions_79df87() { - int res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_79df87(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usampler1D arg_0_1; -void textureDimensions_79df87() { - int res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_79df87(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usampler1D arg_0_1; -void textureDimensions_79df87() { - int res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_79df87(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.hlsl deleted file mode 100644 index 604dffae73..0000000000 --- a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureDimensions_79df87() { - int2 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); - int res = tint_tmp.x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_79df87(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_79df87(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_79df87(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.msl deleted file mode 100644 index 01adb4d3dc..0000000000 --- a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_79df87(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_79df87(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_79df87(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_79df87(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.spvasm deleted file mode 100644 index eaeb505522..0000000000 --- a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.spvasm +++ /dev/null @@ -1,77 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpCapability Sampled1D - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_79df87 "textureDimensions_79df87" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 -%_ptr_Function_int = OpTypePointer Function %int - %23 = OpConstantNull %int - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_79df87 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_int Function %23 - %19 = OpLoad %11 %arg_0 - %17 = OpImageQuerySizeLod %int %19 %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureDimensions_79df87 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %33 = OpLabel - %34 = OpFunctionCall %void %textureDimensions_79df87 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_79df87 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.wgsl deleted file mode 100644 index 63b16bfca0..0000000000 --- a/test/tint/builtins/gen/textureDimensions/79df87.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureDimensions_79df87() { - var res : i32 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_79df87(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_79df87(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_79df87(); -} diff --git a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl b/test/tint/builtins/gen/textureDimensions/7bf826.wgsl deleted file mode 100644 index 6a2f24a8ee..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; - -// fn textureDimensions(texture: texture_depth_2d_array) -> vec2 -fn textureDimensions_7bf826() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_7bf826(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_7bf826(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_7bf826(); -} diff --git a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.glsl deleted file mode 100644 index b3d3327ade..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_7bf826() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_7bf826(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_7bf826() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_7bf826(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_7bf826() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_7bf826(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.hlsl deleted file mode 100644 index 729140ba82..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureDimensions_7bf826() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_7bf826(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_7bf826(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_7bf826(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.msl deleted file mode 100644 index 4964ca048b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_7bf826(depth2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_2) { - textureDimensions_7bf826(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_7bf826(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_7bf826(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.wgsl deleted file mode 100644 index 50ddae7146..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7bf826.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -fn textureDimensions_7bf826() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_7bf826(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_7bf826(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_7bf826(); -} diff --git a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl b/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl deleted file mode 100644 index 18bce03db4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_7f5c2e() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_7f5c2e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_7f5c2e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_7f5c2e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.glsl deleted file mode 100644 index 4e93c77924..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_7f5c2e() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_7f5c2e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_7f5c2e() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_7f5c2e(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_7f5c2e() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_7f5c2e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.hlsl deleted file mode 100644 index 7b7c994bb4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_7f5c2e() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_7f5c2e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_7f5c2e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_7f5c2e(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.msl deleted file mode 100644 index 6cae60437a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_7f5c2e(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_7f5c2e(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_7f5c2e(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_7f5c2e(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.wgsl deleted file mode 100644 index 0eecf68fd2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/7f5c2e.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_7f5c2e() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_7f5c2e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_7f5c2e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_7f5c2e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl b/test/tint/builtins/gen/textureDimensions/8028f3.wgsl deleted file mode 100644 index b67521333e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_8028f3() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8028f3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8028f3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8028f3(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.glsl deleted file mode 100644 index 079cc6ca1d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32f) uniform highp writeonly image3D arg_0; -void textureDimensions_8028f3() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_8028f3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32f) uniform highp writeonly image3D arg_0; -void textureDimensions_8028f3() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_8028f3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32f) uniform highp writeonly image3D arg_0; -void textureDimensions_8028f3() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_8028f3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.hlsl deleted file mode 100644 index 0db3091914..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_8028f3() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_8028f3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_8028f3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_8028f3(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.msl deleted file mode 100644 index 50d4cee541..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_8028f3(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_8028f3(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_8028f3(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_8028f3(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.wgsl deleted file mode 100644 index 7ad57279ae..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8028f3.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_8028f3() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8028f3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8028f3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8028f3(); -} diff --git a/test/tint/builtins/gen/textureDimensions/811679.wgsl b/test/tint/builtins/gen/textureDimensions/811679.wgsl deleted file mode 100644 index 9223f56065..0000000000 --- a/test/tint/builtins/gen/textureDimensions/811679.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_811679() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_811679(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_811679(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_811679(); -} diff --git a/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.glsl deleted file mode 100644 index b9859b67b4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_811679() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_811679(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_811679() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_811679(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_811679() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_811679(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.hlsl deleted file mode 100644 index 25f021715d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_811679() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_811679(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_811679(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_811679(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.msl deleted file mode 100644 index 98b2a954cc..0000000000 --- a/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_811679(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_811679(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_811679(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_811679(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.wgsl deleted file mode 100644 index 154cddebb4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/811679.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_811679() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_811679(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_811679(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_811679(); -} diff --git a/test/tint/builtins/gen/textureDimensions/820596.wgsl b/test/tint/builtins/gen/textureDimensions/820596.wgsl deleted file mode 100644 index a6ff78299e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/820596.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_820596() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_820596(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_820596(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_820596(); -} diff --git a/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.glsl deleted file mode 100644 index 7dc7763c22..0000000000 --- a/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_820596() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_820596(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_820596() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_820596(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_820596() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_820596(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.hlsl deleted file mode 100644 index 2c7c64635a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_820596() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_820596(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_820596(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_820596(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.msl deleted file mode 100644 index 303771c5c9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_820596(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_820596(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_820596(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_820596(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.wgsl deleted file mode 100644 index 93106d5a90..0000000000 --- a/test/tint/builtins/gen/textureDimensions/820596.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_820596() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_820596(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_820596(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_820596(); -} diff --git a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl b/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl deleted file mode 100644 index 3ac74e8222..0000000000 --- a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_83ee5a() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_83ee5a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_83ee5a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_83ee5a(); -} diff --git a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.glsl deleted file mode 100644 index d418c589d4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_83ee5a() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_83ee5a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_83ee5a() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_83ee5a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_83ee5a() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_83ee5a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.hlsl deleted file mode 100644 index c705d5c894..0000000000 --- a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_83ee5a() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_83ee5a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_83ee5a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_83ee5a(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.msl deleted file mode 100644 index f92d24aacd..0000000000 --- a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_83ee5a(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_83ee5a(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_83ee5a(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_83ee5a(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.wgsl deleted file mode 100644 index 3481e3c102..0000000000 --- a/test/tint/builtins/gen/textureDimensions/83ee5a.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_83ee5a() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_83ee5a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_83ee5a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_83ee5a(); -} diff --git a/test/tint/builtins/gen/textureDimensions/85d556.wgsl b/test/tint/builtins/gen/textureDimensions/85d556.wgsl deleted file mode 100644 index 628e35c92b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/85d556.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 -fn textureDimensions_85d556() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_85d556(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_85d556(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_85d556(); -} diff --git a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.glsl deleted file mode 100644 index 1d0848b5c2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_85d556() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_85d556(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_85d556() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_85d556(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_85d556() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_85d556(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.hlsl deleted file mode 100644 index 2b030c6890..0000000000 --- a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureDimensions_85d556() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_85d556(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_85d556(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_85d556(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.msl deleted file mode 100644 index 05c997d474..0000000000 --- a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_85d556(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_85d556(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_85d556(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_85d556(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.spvasm deleted file mode 100644 index c0284956dc..0000000000 --- a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.spvasm +++ /dev/null @@ -1,78 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_85d556 "textureDimensions_85d556" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %25 = OpConstantNull %v2int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_85d556 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %25 - %21 = OpLoad %11 %arg_0 - %19 = OpImageQuerySizeLod %v3int %21 %int_0 - %16 = OpVectorShuffle %v2int %19 %19 0 1 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureDimensions_85d556 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_85d556 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %38 = OpLabel - %39 = OpFunctionCall %void %textureDimensions_85d556 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.wgsl deleted file mode 100644 index 504544199b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/85d556.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureDimensions_85d556() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_85d556(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_85d556(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_85d556(); -} diff --git a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl b/test/tint/builtins/gen/textureDimensions/88ad17.wgsl deleted file mode 100644 index 79eef6f98e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; - -// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 -fn textureDimensions_88ad17() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_88ad17(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_88ad17(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_88ad17(); -} diff --git a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.glsl deleted file mode 100644 index 0dc03d03dc..0000000000 --- a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usamplerCube arg_0_1; -void textureDimensions_88ad17() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_88ad17(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usamplerCube arg_0_1; -void textureDimensions_88ad17() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_88ad17(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usamplerCube arg_0_1; -void textureDimensions_88ad17() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_88ad17(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.hlsl deleted file mode 100644 index 9d37232ea1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureDimensions_88ad17() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_88ad17(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_88ad17(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_88ad17(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.msl deleted file mode 100644 index cbd3f88db3..0000000000 --- a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_88ad17(texturecube tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_2) { - textureDimensions_88ad17(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { - textureDimensions_88ad17(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { - textureDimensions_88ad17(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.spvasm deleted file mode 100644 index a16d7641ab..0000000000 --- a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.spvasm +++ /dev/null @@ -1,77 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 39 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_88ad17 "textureDimensions_88ad17" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %24 = OpConstantNull %v2int - %25 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_88ad17 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %24 - %20 = OpLoad %11 %arg_0 - %17 = OpImageQuerySizeLod %v2int %20 %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %25 - %27 = OpLabel - %28 = OpFunctionCall %void %textureDimensions_88ad17 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %30 = OpLabel - %31 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %31 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %34 = OpLabel - %35 = OpFunctionCall %void %textureDimensions_88ad17 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %37 = OpLabel - %38 = OpFunctionCall %void %textureDimensions_88ad17 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.wgsl deleted file mode 100644 index 85f6381583..0000000000 --- a/test/tint/builtins/gen/textureDimensions/88ad17.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -fn textureDimensions_88ad17() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_88ad17(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_88ad17(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_88ad17(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl b/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl deleted file mode 100644 index 4dd29cf257..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureDimensions(texture: texture_3d) -> vec3 -fn textureDimensions_8aa4c4() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8aa4c4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8aa4c4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8aa4c4(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.glsl deleted file mode 100644 index a578eea942..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler3D arg_0_1; -void textureDimensions_8aa4c4() { - ivec3 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_8aa4c4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_1; -void textureDimensions_8aa4c4() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_8aa4c4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler3D arg_0_1; -void textureDimensions_8aa4c4() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_8aa4c4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.hlsl deleted file mode 100644 index da113508c5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureDimensions_8aa4c4() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_8aa4c4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_8aa4c4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_8aa4c4(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.msl deleted file mode 100644 index 4272060876..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_8aa4c4(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_8aa4c4(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_8aa4c4(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_8aa4c4(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.wgsl deleted file mode 100644 index 3a59eb68df..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8aa4c4.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureDimensions_8aa4c4() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8aa4c4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8aa4c4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8aa4c4(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl b/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl deleted file mode 100644 index d885845bb8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureDimensions(texture: texture_3d) -> vec3 -fn textureDimensions_8deb5e() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8deb5e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8deb5e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8deb5e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.glsl deleted file mode 100644 index 30c0a69f35..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler3D arg_0_1; -void textureDimensions_8deb5e() { - ivec3 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_8deb5e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler3D arg_0_1; -void textureDimensions_8deb5e() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_8deb5e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler3D arg_0_1; -void textureDimensions_8deb5e() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_8deb5e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.hlsl deleted file mode 100644 index 4655fdc4ed..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureDimensions_8deb5e() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_8deb5e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_8deb5e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_8deb5e(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.msl deleted file mode 100644 index 1b165dfe81..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_8deb5e(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_8deb5e(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_8deb5e(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_8deb5e(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.wgsl deleted file mode 100644 index 1f088c3858..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8deb5e.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureDimensions_8deb5e() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8deb5e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8deb5e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8deb5e(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl b/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl deleted file mode 100644 index 1af7247a8d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureDimensions(texture: texture_cube_array) -> vec2 -fn textureDimensions_8f20bf() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8f20bf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8f20bf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8f20bf(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.glsl deleted file mode 100644 index 5c2fdc6d08..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_8f20bf() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_8f20bf(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_8f20bf() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_8f20bf(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_8f20bf() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_8f20bf(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.hlsl deleted file mode 100644 index ae67075223..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureDimensions_8f20bf() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_8f20bf(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_8f20bf(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_8f20bf(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.msl deleted file mode 100644 index fe8a216299..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_8f20bf(texturecube_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureDimensions_8f20bf(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_8f20bf(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_8f20bf(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.wgsl deleted file mode 100644 index e299daf159..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8f20bf.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureDimensions_8f20bf() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8f20bf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8f20bf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8f20bf(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl b/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl deleted file mode 100644 index a7cd8cf791..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_8fca0f() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8fca0f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8fca0f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8fca0f(); -} diff --git a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.glsl deleted file mode 100644 index 60bc61d7c6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32f) uniform highp writeonly image3D arg_0; -void textureDimensions_8fca0f() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_8fca0f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32f) uniform highp writeonly image3D arg_0; -void textureDimensions_8fca0f() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_8fca0f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32f) uniform highp writeonly image3D arg_0; -void textureDimensions_8fca0f() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_8fca0f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.hlsl deleted file mode 100644 index 61af3df2c7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_8fca0f() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_8fca0f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_8fca0f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_8fca0f(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.msl deleted file mode 100644 index b80ae46bc8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_8fca0f(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_8fca0f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_8fca0f(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_8fca0f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.wgsl deleted file mode 100644 index 4599b2e29a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/8fca0f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_8fca0f() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_8fca0f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_8fca0f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_8fca0f(); -} diff --git a/test/tint/builtins/gen/textureDimensions/90340b.wgsl b/test/tint/builtins/gen/textureDimensions/90340b.wgsl deleted file mode 100644 index 842621eb48..0000000000 --- a/test/tint/builtins/gen/textureDimensions/90340b.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; - -// fn textureDimensions(texture: texture_depth_cube_array) -> vec2 -fn textureDimensions_90340b() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_90340b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_90340b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_90340b(); -} diff --git a/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.glsl deleted file mode 100644 index 142ad6144c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_90340b() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_90340b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_90340b() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_90340b(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_90340b() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_90340b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.hlsl deleted file mode 100644 index 29df48b0d4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureDimensions_90340b() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_90340b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_90340b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_90340b(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.msl deleted file mode 100644 index 0fa625c602..0000000000 --- a/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_90340b(depthcube_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube_array tint_symbol_2) { - textureDimensions_90340b(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_90340b(tint_symbol_4); - return; -} - -kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_90340b(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.wgsl deleted file mode 100644 index 2addbf1322..0000000000 --- a/test/tint/builtins/gen/textureDimensions/90340b.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -fn textureDimensions_90340b() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_90340b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_90340b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_90340b(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl b/test/tint/builtins/gen/textureDimensions/9042ab.wgsl deleted file mode 100644 index fbdaabe363..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_9042ab() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9042ab(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9042ab(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9042ab(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.glsl deleted file mode 100644 index b0f3eac068..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_9042ab() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_9042ab(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_9042ab() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_9042ab(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; -void textureDimensions_9042ab() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_9042ab(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.hlsl deleted file mode 100644 index 50741eaa47..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_9042ab() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_9042ab(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_9042ab(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_9042ab(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.msl deleted file mode 100644 index 1e47848252..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_9042ab(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_9042ab(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_9042ab(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_9042ab(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.wgsl deleted file mode 100644 index a2d866661b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9042ab.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_9042ab() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9042ab(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9042ab(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9042ab(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl b/test/tint/builtins/gen/textureDimensions/9393b0.wgsl deleted file mode 100644 index 0f6af45b3c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube; - -// fn textureDimensions(texture: texture_depth_cube, level: i32) -> vec2 -fn textureDimensions_9393b0() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9393b0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9393b0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9393b0(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.glsl deleted file mode 100644 index 71a8b7cfb5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureDimensions_9393b0() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_9393b0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_1; -void textureDimensions_9393b0() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_9393b0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureDimensions_9393b0() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_9393b0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.hlsl deleted file mode 100644 index 1a2117b536..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureDimensions_9393b0() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_9393b0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_9393b0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_9393b0(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.msl deleted file mode 100644 index 9f2122c712..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_9393b0(depthcube tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube tint_symbol_2) { - textureDimensions_9393b0(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { - textureDimensions_9393b0(tint_symbol_4); - return; -} - -kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { - textureDimensions_9393b0(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.spvasm deleted file mode 100644 index 4ce2ce17ea..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_9393b0 "textureDimensions_9393b0" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %23 = OpConstantNull %v2int - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_9393b0 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %23 - %19 = OpLoad %11 %arg_0 - %16 = OpImageQuerySizeLod %v2int %19 %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureDimensions_9393b0 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %33 = OpLabel - %34 = OpFunctionCall %void %textureDimensions_9393b0 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_9393b0 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.wgsl deleted file mode 100644 index caacfdc0e9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9393b0.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube; - -fn textureDimensions_9393b0() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9393b0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9393b0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9393b0(); -} diff --git a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl b/test/tint/builtins/gen/textureDimensions/939fdb.wgsl deleted file mode 100644 index 591453207a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; - -// fn textureDimensions(texture: texture_depth_2d) -> vec2 -fn textureDimensions_939fdb() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_939fdb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_939fdb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_939fdb(); -} diff --git a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.glsl deleted file mode 100644 index 06b6e5fdb9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureDimensions_939fdb() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_939fdb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_1; -void textureDimensions_939fdb() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_939fdb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureDimensions_939fdb() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_939fdb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.hlsl deleted file mode 100644 index aeee2724b4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureDimensions_939fdb() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_939fdb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_939fdb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_939fdb(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.msl deleted file mode 100644 index e825ea3231..0000000000 --- a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_939fdb(depth2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_2) { - textureDimensions_939fdb(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_939fdb(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_939fdb(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.wgsl deleted file mode 100644 index 12cc53592c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/939fdb.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -fn textureDimensions_939fdb() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_939fdb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_939fdb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_939fdb(); -} diff --git a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl b/test/tint/builtins/gen/textureDimensions/962dcd.wgsl deleted file mode 100644 index 5f248250c6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; - -// fn textureDimensions(texture: texture_cube) -> vec2 -fn textureDimensions_962dcd() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_962dcd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_962dcd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_962dcd(); -} diff --git a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.glsl deleted file mode 100644 index b35445bb7a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isamplerCube arg_0_1; -void textureDimensions_962dcd() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_962dcd(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isamplerCube arg_0_1; -void textureDimensions_962dcd() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_962dcd(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isamplerCube arg_0_1; -void textureDimensions_962dcd() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_962dcd(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.hlsl deleted file mode 100644 index 520382039b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureDimensions_962dcd() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_962dcd(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_962dcd(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_962dcd(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.msl deleted file mode 100644 index 8f66f9d7e8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_962dcd(texturecube tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_2) { - textureDimensions_962dcd(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { - textureDimensions_962dcd(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { - textureDimensions_962dcd(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.wgsl deleted file mode 100644 index 8c1d2563a5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/962dcd.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -fn textureDimensions_962dcd() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_962dcd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_962dcd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_962dcd(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl b/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl deleted file mode 100644 index 08c18fd6e8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_9abfe5() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9abfe5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9abfe5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9abfe5(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.glsl deleted file mode 100644 index 053ca2d73c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_9abfe5() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_9abfe5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_9abfe5() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_9abfe5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_9abfe5() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_9abfe5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.hlsl deleted file mode 100644 index eadba40c3d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_9abfe5() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_9abfe5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_9abfe5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_9abfe5(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.msl deleted file mode 100644 index 4b2bcddf04..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_9abfe5(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_9abfe5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_9abfe5(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_9abfe5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.wgsl deleted file mode 100644 index fd979941fa..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9abfe5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_9abfe5() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9abfe5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9abfe5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9abfe5(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl b/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl deleted file mode 100644 index 1ea3761b12..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 -fn textureDimensions_9c9c57() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9c9c57(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9c9c57(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9c9c57(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.glsl deleted file mode 100644 index de334e3164..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureDimensions_9c9c57() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_9c9c57(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DArray arg_0_1; -void textureDimensions_9c9c57() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_9c9c57(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureDimensions_9c9c57() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_9c9c57(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.hlsl deleted file mode 100644 index 91fe9a1ee7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureDimensions_9c9c57() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_9c9c57(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_9c9c57(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_9c9c57(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.msl deleted file mode 100644 index e457997bfd..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_9c9c57(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_9c9c57(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_9c9c57(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_9c9c57(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.spvasm deleted file mode 100644 index 6d34f924d3..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.spvasm +++ /dev/null @@ -1,78 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_9c9c57 "textureDimensions_9c9c57" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v2int = OpTypeVector %int 2 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %25 = OpConstantNull %v2int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_9c9c57 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %25 - %21 = OpLoad %11 %arg_0 - %19 = OpImageQuerySizeLod %v3int %21 %int_0 - %17 = OpVectorShuffle %v2int %19 %19 0 1 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureDimensions_9c9c57 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_9c9c57 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %38 = OpLabel - %39 = OpFunctionCall %void %textureDimensions_9c9c57 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.wgsl deleted file mode 100644 index ff8d3211e8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9c9c57.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureDimensions_9c9c57() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9c9c57(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9c9c57(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9c9c57(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl b/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl deleted file mode 100644 index 96b2672b66..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_9da9e2() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9da9e2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9da9e2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9da9e2(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.glsl deleted file mode 100644 index 52e2d90767..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_9da9e2() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_9da9e2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba8i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_9da9e2() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_9da9e2(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'iimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_9da9e2() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_9da9e2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.hlsl deleted file mode 100644 index 2c467927af..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_9da9e2() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_9da9e2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_9da9e2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_9da9e2(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.msl deleted file mode 100644 index 98178fc971..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_9da9e2(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_9da9e2(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_9da9e2(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_9da9e2(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.wgsl deleted file mode 100644 index 3e1f941fcb..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9da9e2.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_9da9e2() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9da9e2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9da9e2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9da9e2(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl b/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl deleted file mode 100644 index c2805cfbcf..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_9eb8d8() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9eb8d8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9eb8d8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9eb8d8(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.glsl deleted file mode 100644 index 4c9151bf4e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_9eb8d8() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_9eb8d8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_9eb8d8() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_9eb8d8(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_9eb8d8() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_9eb8d8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.hlsl deleted file mode 100644 index 7416438e30..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_9eb8d8() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_9eb8d8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_9eb8d8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_9eb8d8(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.msl deleted file mode 100644 index 8d1ec05550..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_9eb8d8(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_9eb8d8(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_9eb8d8(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_9eb8d8(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.wgsl deleted file mode 100644 index 58bc54ffae..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9eb8d8.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_9eb8d8() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9eb8d8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9eb8d8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9eb8d8(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl b/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl deleted file mode 100644 index 810ecd5349..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureDimensions(texture: texture_2d) -> vec2 -fn textureDimensions_9f8e46() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9f8e46(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9f8e46(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9f8e46(); -} diff --git a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.glsl deleted file mode 100644 index 1110a5064a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureDimensions_9f8e46() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_9f8e46(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_1; -void textureDimensions_9f8e46() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_9f8e46(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureDimensions_9f8e46() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_9f8e46(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.hlsl deleted file mode 100644 index eef30d0bcc..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureDimensions_9f8e46() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_9f8e46(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_9f8e46(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_9f8e46(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.msl deleted file mode 100644 index 23edfc2885..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_9f8e46(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_9f8e46(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_9f8e46(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_9f8e46(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.wgsl deleted file mode 100644 index df7b1a7e59..0000000000 --- a/test/tint/builtins/gen/textureDimensions/9f8e46.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureDimensions_9f8e46() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_9f8e46(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_9f8e46(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_9f8e46(); -} diff --git a/test/tint/builtins/gen/textureDimensions/a01845.wgsl b/test/tint/builtins/gen/textureDimensions/a01845.wgsl deleted file mode 100644 index a3e1c14f09..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a01845.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; - -// fn textureDimensions(texture: texture_depth_cube_array, level: i32) -> vec2 -fn textureDimensions_a01845() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_a01845(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_a01845(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_a01845(); -} diff --git a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.glsl deleted file mode 100644 index 691b98c65c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_a01845() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_a01845(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_a01845() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_a01845(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureDimensions_a01845() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_a01845(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.hlsl deleted file mode 100644 index b4253db6c4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureDimensions_a01845() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_a01845(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_a01845(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_a01845(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.msl deleted file mode 100644 index 02fc57141d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_a01845(depthcube_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube_array tint_symbol_2) { - textureDimensions_a01845(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_a01845(tint_symbol_4); - return; -} - -kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_a01845(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.spvasm deleted file mode 100644 index 1cf408faa5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.spvasm +++ /dev/null @@ -1,79 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_a01845 "textureDimensions_a01845" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %25 = OpConstantNull %v2int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_a01845 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %25 - %21 = OpLoad %11 %arg_0 - %19 = OpImageQuerySizeLod %v3int %21 %int_0 - %16 = OpVectorShuffle %v2int %19 %19 0 1 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureDimensions_a01845 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_a01845 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %38 = OpLabel - %39 = OpFunctionCall %void %textureDimensions_a01845 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.wgsl deleted file mode 100644 index 9f7a0da832..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a01845.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -fn textureDimensions_a01845() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_a01845(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_a01845(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_a01845(); -} diff --git a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl b/test/tint/builtins/gen/textureDimensions/a7d565.wgsl deleted file mode 100644 index 904dbce36e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureDimensions(texture: texture_1d) -> i32 -fn textureDimensions_a7d565() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_a7d565(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_a7d565(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_a7d565(); -} diff --git a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.glsl deleted file mode 100644 index e92841e967..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usampler1D arg_0_1; -void textureDimensions_a7d565() { - int res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_a7d565(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usampler1D arg_0_1; -void textureDimensions_a7d565() { - int res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_a7d565(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usampler1D arg_0_1; -void textureDimensions_a7d565() { - int res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_a7d565(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.hlsl deleted file mode 100644 index fa1f8f0033..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureDimensions_a7d565() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_a7d565(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_a7d565(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_a7d565(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.msl deleted file mode 100644 index 22d4338ad1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_a7d565(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_a7d565(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_a7d565(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_a7d565(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.wgsl deleted file mode 100644 index 4cd2c97081..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a7d565.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureDimensions_a7d565() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_a7d565(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_a7d565(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_a7d565(); -} diff --git a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl b/test/tint/builtins/gen/textureDimensions/a863f2.wgsl deleted file mode 100644 index 6b5fdac25e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_a863f2() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_a863f2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_a863f2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_a863f2(); -} diff --git a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.glsl deleted file mode 100644 index b14d6439ea..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(r32f) uniform highp writeonly image1D arg_0; -void textureDimensions_a863f2() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_a863f2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(r32f) uniform highp writeonly image1D arg_0; -void textureDimensions_a863f2() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_a863f2(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(r32f) uniform highp writeonly image1D arg_0; -void textureDimensions_a863f2() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_a863f2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.hlsl deleted file mode 100644 index 5827d94180..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_a863f2() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_a863f2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_a863f2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_a863f2(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.msl deleted file mode 100644 index 3bbebf328a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_a863f2(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_a863f2(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_a863f2(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_a863f2(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.wgsl deleted file mode 100644 index 257be4e0f7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a863f2.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_a863f2() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_a863f2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_a863f2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_a863f2(); -} diff --git a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl b/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl deleted file mode 100644 index 19cd6e114a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; - -// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 -fn textureDimensions_a9c9c1() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_a9c9c1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_a9c9c1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_a9c9c1(); -} diff --git a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.glsl deleted file mode 100644 index acf9ace231..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureDimensions_a9c9c1() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_a9c9c1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_1; -void textureDimensions_a9c9c1() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_a9c9c1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureDimensions_a9c9c1() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_a9c9c1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.hlsl deleted file mode 100644 index cfe96f1bc1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureDimensions_a9c9c1() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_a9c9c1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_a9c9c1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_a9c9c1(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.msl deleted file mode 100644 index 539d007136..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_a9c9c1(texturecube tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_2) { - textureDimensions_a9c9c1(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { - textureDimensions_a9c9c1(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { - textureDimensions_a9c9c1(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.spvasm deleted file mode 100644 index a075354ade..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_a9c9c1 "textureDimensions_a9c9c1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %23 = OpConstantNull %v2int - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_a9c9c1 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %23 - %19 = OpLoad %11 %arg_0 - %16 = OpImageQuerySizeLod %v2int %19 %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureDimensions_a9c9c1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %33 = OpLabel - %34 = OpFunctionCall %void %textureDimensions_a9c9c1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_a9c9c1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.wgsl deleted file mode 100644 index e4125c9e17..0000000000 --- a/test/tint/builtins/gen/textureDimensions/a9c9c1.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -fn textureDimensions_a9c9c1() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_a9c9c1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_a9c9c1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_a9c9c1(); -} diff --git a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl b/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl deleted file mode 100644 index 4b25df8e85..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 -fn textureDimensions_b0e16d() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_b0e16d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_b0e16d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_b0e16d(); -} diff --git a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.glsl deleted file mode 100644 index 2047fb1ee8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler2D arg_0_1; -void textureDimensions_b0e16d() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_b0e16d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2D arg_0_1; -void textureDimensions_b0e16d() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_b0e16d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2D arg_0_1; -void textureDimensions_b0e16d() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_b0e16d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.hlsl deleted file mode 100644 index 70279dbdc4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureDimensions_b0e16d() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_b0e16d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_b0e16d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_b0e16d(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.msl deleted file mode 100644 index ee971ff9ae..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_b0e16d(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_b0e16d(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_b0e16d(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_b0e16d(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.spvasm deleted file mode 100644 index ce5229ce6f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_b0e16d "textureDimensions_b0e16d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %23 = OpConstantNull %v2int - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_b0e16d = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %23 - %19 = OpLoad %11 %arg_0 - %17 = OpImageQuerySizeLod %v2int %19 %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureDimensions_b0e16d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %33 = OpLabel - %34 = OpFunctionCall %void %textureDimensions_b0e16d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_b0e16d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.wgsl deleted file mode 100644 index 1bd9327c65..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b0e16d.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureDimensions_b0e16d() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_b0e16d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_b0e16d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_b0e16d(); -} diff --git a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl b/test/tint/builtins/gen/textureDimensions/b3c954.wgsl deleted file mode 100644 index 588af6c824..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; - -// fn textureDimensions(texture: texture_cube) -> vec2 -fn textureDimensions_b3c954() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_b3c954(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_b3c954(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_b3c954(); -} diff --git a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.glsl deleted file mode 100644 index 42e669a67f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usamplerCube arg_0_1; -void textureDimensions_b3c954() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_b3c954(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usamplerCube arg_0_1; -void textureDimensions_b3c954() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_b3c954(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usamplerCube arg_0_1; -void textureDimensions_b3c954() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_b3c954(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.hlsl deleted file mode 100644 index db28c37d81..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureDimensions_b3c954() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_b3c954(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_b3c954(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_b3c954(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.msl deleted file mode 100644 index a7daabd25d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_b3c954(texturecube tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_2) { - textureDimensions_b3c954(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { - textureDimensions_b3c954(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { - textureDimensions_b3c954(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.wgsl deleted file mode 100644 index de3b872866..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3c954.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -fn textureDimensions_b3c954() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_b3c954(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_b3c954(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_b3c954(); -} diff --git a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl b/test/tint/builtins/gen/textureDimensions/b3e407.wgsl deleted file mode 100644 index 1c04110216..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureDimensions(texture: texture_1d, level: i32) -> i32 -fn textureDimensions_b3e407() { - var res: i32 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_b3e407(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_b3e407(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_b3e407(); -} diff --git a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.glsl deleted file mode 100644 index 199507417a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler1D arg_0_1; -void textureDimensions_b3e407() { - int res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_b3e407(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'sampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler1D arg_0_1; -void textureDimensions_b3e407() { - int res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_b3e407(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'sampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler1D arg_0_1; -void textureDimensions_b3e407() { - int res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_b3e407(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'sampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.hlsl deleted file mode 100644 index 0407213603..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureDimensions_b3e407() { - int2 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); - int res = tint_tmp.x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_b3e407(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_b3e407(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_b3e407(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.msl deleted file mode 100644 index 6b96a63469..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_b3e407(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_b3e407(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_b3e407(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_b3e407(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.spvasm deleted file mode 100644 index b700841b9f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 37 -; Schema: 0 - OpCapability Shader - OpCapability Sampled1D - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_b3e407 "textureDimensions_b3e407" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 1D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 -%_ptr_Function_int = OpTypePointer Function %int - %22 = OpConstantNull %int - %23 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_b3e407 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_int Function %22 - %18 = OpLoad %11 %arg_0 - %16 = OpImageQuerySizeLod %int %18 %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %textureDimensions_b3e407 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %32 = OpLabel - %33 = OpFunctionCall %void %textureDimensions_b3e407 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_b3e407 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.wgsl deleted file mode 100644 index 8ebb58e84a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b3e407.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureDimensions_b3e407() { - var res : i32 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_b3e407(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_b3e407(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_b3e407(); -} diff --git a/test/tint/builtins/gen/textureDimensions/b91240.wgsl b/test/tint/builtins/gen/textureDimensions/b91240.wgsl deleted file mode 100644 index 4c8707c1fa..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b91240.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_b91240() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_b91240(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_b91240(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_b91240(); -} diff --git a/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.glsl deleted file mode 100644 index f223563e74..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2D arg_0; -void textureDimensions_b91240() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_b91240(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8_snorm) uniform highp writeonly image2D arg_0; -void textureDimensions_b91240() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_b91240(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2D arg_0; -void textureDimensions_b91240() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_b91240(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.hlsl deleted file mode 100644 index 228c0455e5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_b91240() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_b91240(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_b91240(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_b91240(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.msl deleted file mode 100644 index 84375cac62..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_b91240(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_b91240(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_b91240(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_b91240(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.wgsl deleted file mode 100644 index 105338f1c8..0000000000 --- a/test/tint/builtins/gen/textureDimensions/b91240.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_b91240() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_b91240(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_b91240(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_b91240(); -} diff --git a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl b/test/tint/builtins/gen/textureDimensions/ba1481.wgsl deleted file mode 100644 index 521e1cecb7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_external; - -// fn textureDimensions(texture: texture_external) -> vec2 -fn textureDimensions_ba1481() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_ba1481(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_ba1481(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_ba1481(); -} diff --git a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.glsl deleted file mode 100644 index a1cf7d7a3d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.glsl +++ /dev/null @@ -1,133 +0,0 @@ -#version 310 es - -struct GammaTransferParams { - float G; - float A; - float B; - float C; - float D; - float E; - float F; - uint padding; -}; - -struct ExternalTextureParams { - uint numPlanes; - mat3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - mat3 gamutConversionMatrix; -}; - -layout(binding = 2) uniform ExternalTextureParams_1 { - uint numPlanes; - mat3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - mat3 gamutConversionMatrix; -} ext_tex_params; - -uniform highp sampler2D arg_0_1; -void textureDimensions_ba1481() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_ba1481(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -struct GammaTransferParams { - float G; - float A; - float B; - float C; - float D; - float E; - float F; - uint padding; -}; - -struct ExternalTextureParams { - uint numPlanes; - mat3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - mat3 gamutConversionMatrix; -}; - -layout(binding = 2) uniform ExternalTextureParams_1 { - uint numPlanes; - mat3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - mat3 gamutConversionMatrix; -} ext_tex_params; - -uniform highp sampler2D arg_0_1; -void textureDimensions_ba1481() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_ba1481(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -struct GammaTransferParams { - float G; - float A; - float B; - float C; - float D; - float E; - float F; - uint padding; -}; - -struct ExternalTextureParams { - uint numPlanes; - mat3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - mat3 gamutConversionMatrix; -}; - -layout(binding = 2) uniform ExternalTextureParams_1 { - uint numPlanes; - mat3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - mat3 gamutConversionMatrix; -} ext_tex_params; - -uniform highp sampler2D arg_0_1; -void textureDimensions_ba1481() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_ba1481(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.hlsl deleted file mode 100644 index 108fe85c73..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.hlsl +++ /dev/null @@ -1,38 +0,0 @@ -Texture2D ext_tex_plane_1 : register(t1, space1); -cbuffer cbuffer_ext_tex_params : register(b2, space1) { - uint4 ext_tex_params[11]; -}; -Texture2D arg_0 : register(t0, space1); - -void textureDimensions_ba1481() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_ba1481(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_ba1481(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_ba1481(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.msl deleted file mode 100644 index 1d4eb711ca..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.msl +++ /dev/null @@ -1,52 +0,0 @@ -#include - -using namespace metal; -struct GammaTransferParams { - float G; - float A; - float B; - float C; - float D; - float E; - float F; - uint padding; -}; - -struct ExternalTextureParams { - uint numPlanes; - float3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - float3x3 gamutConversionMatrix; -}; - -void textureDimensions_ba1481(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_ba1481(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_ba1481(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_ba1481(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.spvasm deleted file mode 100644 index c0f550a47f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.spvasm +++ /dev/null @@ -1,125 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %ext_tex_plane_1 "ext_tex_plane_1" - OpName %ExternalTextureParams "ExternalTextureParams" - OpMemberName %ExternalTextureParams 0 "numPlanes" - OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix" - OpMemberName %ExternalTextureParams 2 "gammaDecodeParams" - OpName %GammaTransferParams "GammaTransferParams" - OpMemberName %GammaTransferParams 0 "G" - OpMemberName %GammaTransferParams 1 "A" - OpMemberName %GammaTransferParams 2 "B" - OpMemberName %GammaTransferParams 3 "C" - OpMemberName %GammaTransferParams 4 "D" - OpMemberName %GammaTransferParams 5 "E" - OpMemberName %GammaTransferParams 6 "F" - OpMemberName %GammaTransferParams 7 "padding" - OpMemberName %ExternalTextureParams 3 "gammaEncodeParams" - OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix" - OpName %ext_tex_params "ext_tex_params" - OpName %arg_0 "arg_0" - OpName %textureDimensions_ba1481 "textureDimensions_ba1481" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %ext_tex_plane_1 DescriptorSet 1 - OpDecorate %ext_tex_plane_1 Binding 1 - OpDecorate %ExternalTextureParams Block - OpMemberDecorate %ExternalTextureParams 0 Offset 0 - OpMemberDecorate %ExternalTextureParams 1 Offset 16 - OpMemberDecorate %ExternalTextureParams 1 ColMajor - OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16 - OpMemberDecorate %ExternalTextureParams 2 Offset 64 - OpMemberDecorate %GammaTransferParams 0 Offset 0 - OpMemberDecorate %GammaTransferParams 1 Offset 4 - OpMemberDecorate %GammaTransferParams 2 Offset 8 - OpMemberDecorate %GammaTransferParams 3 Offset 12 - OpMemberDecorate %GammaTransferParams 4 Offset 16 - OpMemberDecorate %GammaTransferParams 5 Offset 20 - OpMemberDecorate %GammaTransferParams 6 Offset 24 - OpMemberDecorate %GammaTransferParams 7 Offset 28 - OpMemberDecorate %ExternalTextureParams 3 Offset 96 - OpMemberDecorate %ExternalTextureParams 4 Offset 128 - OpMemberDecorate %ExternalTextureParams 4 ColMajor - OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16 - OpDecorate %ext_tex_params NonWritable - OpDecorate %ext_tex_params DescriptorSet 1 - OpDecorate %ext_tex_params Binding 2 - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 -%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %uint = OpTypeInt 32 0 -%mat3v4float = OpTypeMatrix %v4float 3 -%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint - %v3float = OpTypeVector %float 3 -%mat3v3float = OpTypeMatrix %v3float 3 -%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float -%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams -%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %21 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %32 = OpConstantNull %v2int - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_ba1481 = OpFunction %void None %21 - %24 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %32 - %28 = OpLoad %11 %arg_0 - %25 = OpImageQuerySizeLod %v2int %28 %int_0 - OpStore %res %25 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_ba1481 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %21 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %21 - %42 = OpLabel - %43 = OpFunctionCall %void %textureDimensions_ba1481 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %21 - %45 = OpLabel - %46 = OpFunctionCall %void %textureDimensions_ba1481 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.wgsl deleted file mode 100644 index 0bcf4af3de..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ba1481.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_external; - -fn textureDimensions_ba1481() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_ba1481(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_ba1481(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_ba1481(); -} diff --git a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl b/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl deleted file mode 100644 index b37b33e029..0000000000 --- a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_bb3dde() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_bb3dde(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_bb3dde(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_bb3dde(); -} diff --git a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.glsl deleted file mode 100644 index 92444e8d92..0000000000 --- a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_bb3dde() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_bb3dde(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_bb3dde() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_bb3dde(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage3D arg_0; -void textureDimensions_bb3dde() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_bb3dde(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.hlsl deleted file mode 100644 index 51eb32f25a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_bb3dde() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_bb3dde(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_bb3dde(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_bb3dde(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.msl deleted file mode 100644 index 89c1d8458c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_bb3dde(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_bb3dde(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_bb3dde(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_bb3dde(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.wgsl deleted file mode 100644 index 005cae6f32..0000000000 --- a/test/tint/builtins/gen/textureDimensions/bb3dde.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_bb3dde() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_bb3dde(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_bb3dde(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_bb3dde(); -} diff --git a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl b/test/tint/builtins/gen/textureDimensions/c30e75.wgsl deleted file mode 100644 index d16d53858a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_c30e75() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_c30e75(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_c30e75(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_c30e75(); -} diff --git a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.glsl deleted file mode 100644 index 9ecbb57346..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_c30e75() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_c30e75(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_c30e75() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_c30e75(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32i) uniform highp writeonly iimage2D arg_0; -void textureDimensions_c30e75() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_c30e75(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.hlsl deleted file mode 100644 index 4e7575480f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_c30e75() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_c30e75(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_c30e75(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_c30e75(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.msl deleted file mode 100644 index 815d44cdbb..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_c30e75(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_c30e75(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_c30e75(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_c30e75(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.wgsl deleted file mode 100644 index ecf60b5c6b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c30e75.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_c30e75() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_c30e75(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_c30e75(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_c30e75(); -} diff --git a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl b/test/tint/builtins/gen/textureDimensions/c7943d.wgsl deleted file mode 100644 index 73cb2ca487..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_c7943d() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_c7943d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_c7943d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_c7943d(); -} diff --git a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.glsl deleted file mode 100644 index 7644b5b08c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_c7943d() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_c7943d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_c7943d() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_c7943d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2D arg_0; -void textureDimensions_c7943d() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_c7943d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.hlsl deleted file mode 100644 index cf6de5aa03..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_c7943d() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_c7943d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_c7943d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_c7943d(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.msl deleted file mode 100644 index ff4d805db4..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_c7943d(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_c7943d(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_c7943d(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_c7943d(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.wgsl deleted file mode 100644 index d664f33756..0000000000 --- a/test/tint/builtins/gen/textureDimensions/c7943d.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_c7943d() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_c7943d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_c7943d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_c7943d(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl b/test/tint/builtins/gen/textureDimensions/cc968c.wgsl deleted file mode 100644 index 89e96200e1..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_cc968c() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cc968c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cc968c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cc968c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.glsl deleted file mode 100644 index efc15a9c4a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_cc968c() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_cc968c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_cc968c() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_cc968c(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage1D arg_0; -void textureDimensions_cc968c() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_cc968c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.hlsl deleted file mode 100644 index b123be2e3e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_cc968c() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_cc968c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_cc968c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_cc968c(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.msl deleted file mode 100644 index 93357b83d6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_cc968c(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_cc968c(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_cc968c(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_cc968c(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.wgsl deleted file mode 100644 index 8198585683..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cc968c.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_cc968c() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cc968c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cc968c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cc968c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl b/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl deleted file mode 100644 index a0738bccd5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_cccc8f() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cccc8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cccc8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cccc8f(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.glsl deleted file mode 100644 index eefeffa95a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image1D arg_0; -void textureDimensions_cccc8f() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_cccc8f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba8_snorm) uniform highp writeonly image1D arg_0; -void textureDimensions_cccc8f() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_cccc8f(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image1D arg_0; -void textureDimensions_cccc8f() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_cccc8f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.hlsl deleted file mode 100644 index d33b7c7b2f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_cccc8f() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_cccc8f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_cccc8f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_cccc8f(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.msl deleted file mode 100644 index 7e988b4262..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_cccc8f(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_cccc8f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_cccc8f(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_cccc8f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.wgsl deleted file mode 100644 index a4d44f0df9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cccc8f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_cccc8f() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cccc8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cccc8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cccc8f(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl b/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl deleted file mode 100644 index 3bce5a61d3..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_cd76a7() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cd76a7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cd76a7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cd76a7(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.glsl deleted file mode 100644 index 995268471f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8) uniform highp writeonly image3D arg_0; -void textureDimensions_cd76a7() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_cd76a7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8) uniform highp writeonly image3D arg_0; -void textureDimensions_cd76a7() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_cd76a7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8) uniform highp writeonly image3D arg_0; -void textureDimensions_cd76a7() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_cd76a7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.hlsl deleted file mode 100644 index 910792e30a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_cd76a7() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_cd76a7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_cd76a7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_cd76a7(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.msl deleted file mode 100644 index 5013514518..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_cd76a7(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_cd76a7(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_cd76a7(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_cd76a7(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.wgsl deleted file mode 100644 index 139070fb82..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cd76a7.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_cd76a7() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cd76a7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cd76a7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cd76a7(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl b/test/tint/builtins/gen/textureDimensions/cdf473.wgsl deleted file mode 100644 index db67b124ee..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_cdf473() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cdf473(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cdf473(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cdf473(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.glsl deleted file mode 100644 index 0ff0acb4fb..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_cdf473() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_cdf473(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_cdf473() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_cdf473(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; -void textureDimensions_cdf473() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_cdf473(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.hlsl deleted file mode 100644 index 5b02297338..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_cdf473() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_cdf473(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_cdf473(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_cdf473(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.msl deleted file mode 100644 index 8cd521d7fd..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_cdf473(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_cdf473(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_cdf473(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_cdf473(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.wgsl deleted file mode 100644 index 31373c0050..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cdf473.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_cdf473() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cdf473(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cdf473(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cdf473(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cec841.wgsl b/test/tint/builtins/gen/textureDimensions/cec841.wgsl deleted file mode 100644 index 29e5903f71..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cec841.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureDimensions(texture: texture_2d_array) -> vec2 -fn textureDimensions_cec841() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cec841(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cec841(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cec841(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.glsl deleted file mode 100644 index e638a7e1ba..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_cec841() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_cec841(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_cec841() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_cec841(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureDimensions_cec841() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_cec841(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.hlsl deleted file mode 100644 index f46ffb6337..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureDimensions_cec841() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_cec841(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_cec841(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_cec841(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.msl deleted file mode 100644 index 689a796e25..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_cec841(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_cec841(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_cec841(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_cec841(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.wgsl deleted file mode 100644 index d1667a0f6d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cec841.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureDimensions_cec841() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cec841(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cec841(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cec841(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl b/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl deleted file mode 100644 index bd8e0bb856..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_cf7e43() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cf7e43(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cf7e43(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cf7e43(); -} diff --git a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.glsl deleted file mode 100644 index 6cab8c5e21..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image3D arg_0; -void textureDimensions_cf7e43() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_cf7e43(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8_snorm) uniform highp writeonly image3D arg_0; -void textureDimensions_cf7e43() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_cf7e43(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image3D arg_0; -void textureDimensions_cf7e43() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_cf7e43(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.hlsl deleted file mode 100644 index 0d72ab74bf..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_cf7e43() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_cf7e43(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_cf7e43(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_cf7e43(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.msl deleted file mode 100644 index d9b49986bc..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_cf7e43(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_cf7e43(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_cf7e43(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_cf7e43(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.wgsl deleted file mode 100644 index fd5550b6bb..0000000000 --- a/test/tint/builtins/gen/textureDimensions/cf7e43.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_cf7e43() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_cf7e43(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_cf7e43(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_cf7e43(); -} diff --git a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl b/test/tint/builtins/gen/textureDimensions/d125bc.wgsl deleted file mode 100644 index d01cb3593b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; - -// fn textureDimensions(texture: texture_cube) -> vec2 -fn textureDimensions_d125bc() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_d125bc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_d125bc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_d125bc(); -} diff --git a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.glsl deleted file mode 100644 index 5edecc7d1a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureDimensions_d125bc() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_d125bc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_1; -void textureDimensions_d125bc() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_d125bc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureDimensions_d125bc() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_d125bc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.hlsl deleted file mode 100644 index 9ce515f73e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureDimensions_d125bc() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_d125bc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_d125bc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_d125bc(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.msl deleted file mode 100644 index d36c63f9b0..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_d125bc(texturecube tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_2) { - textureDimensions_d125bc(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { - textureDimensions_d125bc(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { - textureDimensions_d125bc(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.wgsl deleted file mode 100644 index e8b2c56e33..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d125bc.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -fn textureDimensions_d125bc() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_d125bc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_d125bc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_d125bc(); -} diff --git a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl b/test/tint/builtins/gen/textureDimensions/d83c45.wgsl deleted file mode 100644 index 0cf89206f2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 -fn textureDimensions_d83c45() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_d83c45(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_d83c45(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_d83c45(); -} diff --git a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.glsl deleted file mode 100644 index eb69da3cef..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usamplerCubeArray arg_0_1; -void textureDimensions_d83c45() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_d83c45(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usamplerCubeArray arg_0_1; -void textureDimensions_d83c45() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_d83c45(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usamplerCubeArray arg_0_1; -void textureDimensions_d83c45() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_d83c45(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.hlsl deleted file mode 100644 index fe401bcdea..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureDimensions_d83c45() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_d83c45(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_d83c45(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_d83c45(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.msl deleted file mode 100644 index c33e6dfcfe..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_d83c45(texturecube_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureDimensions_d83c45(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_d83c45(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_d83c45(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.spvasm deleted file mode 100644 index 8f98426621..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.spvasm +++ /dev/null @@ -1,80 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 41 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_d83c45 "textureDimensions_d83c45" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %26 = OpConstantNull %v2int - %27 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_d83c45 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %26 - %22 = OpLoad %11 %arg_0 - %20 = OpImageQuerySizeLod %v3int %22 %int_0 - %17 = OpVectorShuffle %v2int %20 %20 0 1 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %27 - %29 = OpLabel - %30 = OpFunctionCall %void %textureDimensions_d83c45 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %32 = OpLabel - %33 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %33 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_d83c45 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %39 = OpLabel - %40 = OpFunctionCall %void %textureDimensions_d83c45 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.wgsl deleted file mode 100644 index 4134f65c33..0000000000 --- a/test/tint/builtins/gen/textureDimensions/d83c45.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureDimensions_d83c45() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_d83c45(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_d83c45(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_d83c45(); -} diff --git a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl b/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl deleted file mode 100644 index b7207bd29f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_multisampled_2d; - -// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 -fn textureDimensions_daf7c0() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_daf7c0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_daf7c0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_daf7c0(); -} diff --git a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.glsl deleted file mode 100644 index 75abb34574..0000000000 --- a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler2DMS arg_0_1; -void textureDimensions_daf7c0() { - ivec2 res = textureSize(arg_0_1); -} - -vec4 vertex_main() { - textureDimensions_daf7c0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DMS arg_0_1; -void textureDimensions_daf7c0() { - ivec2 res = textureSize(arg_0_1); -} - -void fragment_main() { - textureDimensions_daf7c0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DMS arg_0_1; -void textureDimensions_daf7c0() { - ivec2 res = textureSize(arg_0_1); -} - -void compute_main() { - textureDimensions_daf7c0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.hlsl deleted file mode 100644 index a99beb7df6..0000000000 --- a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureDimensions_daf7c0() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_daf7c0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_daf7c0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_daf7c0(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.msl deleted file mode 100644 index 086ae36ae5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_daf7c0(texture2d_ms tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_ms tint_symbol_2) { - textureDimensions_daf7c0(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { - textureDimensions_daf7c0(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { - textureDimensions_daf7c0(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.wgsl deleted file mode 100644 index 6d2fbebf54..0000000000 --- a/test/tint/builtins/gen/textureDimensions/daf7c0.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_multisampled_2d; - -fn textureDimensions_daf7c0() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_daf7c0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_daf7c0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_daf7c0(); -} diff --git a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl b/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl deleted file mode 100644 index bd87d0c39a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureDimensions(texture: texture_storage_1d) -> i32 -fn textureDimensions_dc2dd0() { - var res: i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_dc2dd0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_dc2dd0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_dc2dd0(); -} diff --git a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.glsl deleted file mode 100644 index 312215024d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_dc2dd0() { - int res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_dc2dd0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba8ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_dc2dd0() { - int res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_dc2dd0(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'uimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage1D arg_0; -void textureDimensions_dc2dd0() { - int res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_dc2dd0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.hlsl deleted file mode 100644 index ab404314b2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureDimensions_dc2dd0() { - int tint_tmp; - arg_0.GetDimensions(tint_tmp); - int res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_dc2dd0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_dc2dd0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_dc2dd0(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.msl deleted file mode 100644 index be8620cb32..0000000000 --- a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_dc2dd0(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_width(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureDimensions_dc2dd0(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureDimensions_dc2dd0(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureDimensions_dc2dd0(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.wgsl deleted file mode 100644 index 5151ae90a7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/dc2dd0.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureDimensions_dc2dd0() { - var res : i32 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_dc2dd0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_dc2dd0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_dc2dd0(); -} diff --git a/test/tint/builtins/gen/textureDimensions/e927be.wgsl b/test/tint/builtins/gen/textureDimensions/e927be.wgsl deleted file mode 100644 index 1deab90e96..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e927be.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureDimensions(texture: texture_cube_array) -> vec2 -fn textureDimensions_e927be() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_e927be(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_e927be(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_e927be(); -} diff --git a/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.glsl deleted file mode 100644 index 9acd8d5b03..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isamplerCubeArray arg_0_1; -void textureDimensions_e927be() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -vec4 vertex_main() { - textureDimensions_e927be(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isamplerCubeArray arg_0_1; -void textureDimensions_e927be() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void fragment_main() { - textureDimensions_e927be(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isamplerCubeArray arg_0_1; -void textureDimensions_e927be() { - ivec2 res = textureSize(arg_0_1, 0).xy; -} - -void compute_main() { - textureDimensions_e927be(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.hlsl deleted file mode 100644 index 9dea807a40..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureDimensions_e927be() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_e927be(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_e927be(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_e927be(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.msl deleted file mode 100644 index 40d1010494..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_e927be(texturecube_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureDimensions_e927be(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_e927be(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_e927be(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.wgsl deleted file mode 100644 index 637bad6a3b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e927be.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureDimensions_e927be() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_e927be(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_e927be(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_e927be(); -} diff --git a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl b/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl deleted file mode 100644 index f0967abc72..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_e9e96c() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_e9e96c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_e9e96c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_e9e96c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.glsl deleted file mode 100644 index d31fbf8084..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_e9e96c() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_e9e96c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_e9e96c() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_e9e96c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_e9e96c() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_e9e96c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.hlsl deleted file mode 100644 index 14a43e0d20..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_e9e96c() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_e9e96c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_e9e96c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_e9e96c(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.msl deleted file mode 100644 index 71d8e46118..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_e9e96c(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_e9e96c(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_e9e96c(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_e9e96c(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.wgsl deleted file mode 100644 index 0f84facc76..0000000000 --- a/test/tint/builtins/gen/textureDimensions/e9e96c.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_e9e96c() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_e9e96c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_e9e96c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_e9e96c(); -} diff --git a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl b/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl deleted file mode 100644 index 5526818bf9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_multisampled_2d; - -// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 -fn textureDimensions_ef5b89() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_ef5b89(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_ef5b89(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_ef5b89(); -} diff --git a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.glsl deleted file mode 100644 index b51f1e6fa0..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureDimensions_ef5b89() { - ivec2 res = textureSize(arg_0_1); -} - -vec4 vertex_main() { - textureDimensions_ef5b89(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DMS arg_0_1; -void textureDimensions_ef5b89() { - ivec2 res = textureSize(arg_0_1); -} - -void fragment_main() { - textureDimensions_ef5b89(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureDimensions_ef5b89() { - ivec2 res = textureSize(arg_0_1); -} - -void compute_main() { - textureDimensions_ef5b89(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.hlsl deleted file mode 100644 index 754db5b90e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureDimensions_ef5b89() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_ef5b89(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_ef5b89(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_ef5b89(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.msl deleted file mode 100644 index c6c771a4c9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_ef5b89(texture2d_ms tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_ms tint_symbol_2) { - textureDimensions_ef5b89(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { - textureDimensions_ef5b89(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { - textureDimensions_ef5b89(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.wgsl deleted file mode 100644 index f7589624bb..0000000000 --- a/test/tint/builtins/gen/textureDimensions/ef5b89.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_multisampled_2d; - -fn textureDimensions_ef5b89() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_ef5b89(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_ef5b89(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_ef5b89(); -} diff --git a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl b/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl deleted file mode 100644 index 382191f596..0000000000 --- a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 -fn textureDimensions_efc8a4() { - var res: vec3 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_efc8a4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_efc8a4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_efc8a4(); -} diff --git a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.glsl deleted file mode 100644 index 6c4c83f903..0000000000 --- a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler3D arg_0_1; -void textureDimensions_efc8a4() { - ivec3 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_efc8a4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler3D arg_0_1; -void textureDimensions_efc8a4() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_efc8a4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler3D arg_0_1; -void textureDimensions_efc8a4() { - ivec3 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_efc8a4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.hlsl deleted file mode 100644 index 4b98a0ae10..0000000000 --- a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureDimensions_efc8a4() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int3 res = tint_tmp.xyz; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_efc8a4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_efc8a4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_efc8a4(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.msl deleted file mode 100644 index 5f79ff38a9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_efc8a4(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0), tint_symbol_1.get_depth(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_efc8a4(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_efc8a4(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_efc8a4(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.spvasm deleted file mode 100644 index c249a248dc..0000000000 --- a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_efc8a4 "textureDimensions_efc8a4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 -%_ptr_Function_v3int = OpTypePointer Function %v3int - %23 = OpConstantNull %v3int - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_efc8a4 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v3int Function %23 - %19 = OpLoad %11 %arg_0 - %17 = OpImageQuerySizeLod %v3int %19 %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureDimensions_efc8a4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %33 = OpLabel - %34 = OpFunctionCall %void %textureDimensions_efc8a4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %36 = OpLabel - %37 = OpFunctionCall %void %textureDimensions_efc8a4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.wgsl deleted file mode 100644 index ba6f1dbf9d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/efc8a4.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureDimensions_efc8a4() { - var res : vec3 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_efc8a4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_efc8a4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_efc8a4(); -} diff --git a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl b/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl deleted file mode 100644 index 496b024840..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; - -// fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2 -fn textureDimensions_f60bdb() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_f60bdb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_f60bdb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_f60bdb(); -} diff --git a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.glsl deleted file mode 100644 index d5bb6fe226..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureDimensions_f60bdb() { - ivec2 res = textureSize(arg_0_1); -} - -vec4 vertex_main() { - textureDimensions_f60bdb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DMS arg_0_1; -void textureDimensions_f60bdb() { - ivec2 res = textureSize(arg_0_1); -} - -void fragment_main() { - textureDimensions_f60bdb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureDimensions_f60bdb() { - ivec2 res = textureSize(arg_0_1); -} - -void compute_main() { - textureDimensions_f60bdb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.hlsl deleted file mode 100644 index 4af1093668..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureDimensions_f60bdb() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_f60bdb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_f60bdb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_f60bdb(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.msl deleted file mode 100644 index 13b604c42c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_f60bdb(depth2d_ms tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_ms tint_symbol_2) { - textureDimensions_f60bdb(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { - textureDimensions_f60bdb(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { - textureDimensions_f60bdb(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.wgsl deleted file mode 100644 index 04d24555c7..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f60bdb.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; - -fn textureDimensions_f60bdb() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_f60bdb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_f60bdb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_f60bdb(); -} diff --git a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl b/test/tint/builtins/gen/textureDimensions/f7145b.wgsl deleted file mode 100644 index 0c2834eee2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 -fn textureDimensions_f7145b() { - var res: vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_f7145b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_f7145b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_f7145b(); -} diff --git a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.glsl deleted file mode 100644 index b7951df3d0..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler2D arg_0_1; -void textureDimensions_f7145b() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_f7145b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2D arg_0_1; -void textureDimensions_f7145b() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_f7145b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2D arg_0_1; -void textureDimensions_f7145b() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_f7145b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.hlsl deleted file mode 100644 index 6b1164024b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureDimensions_f7145b() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_f7145b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_f7145b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_f7145b(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.msl deleted file mode 100644 index 6dbf9e9c75..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_f7145b(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(0), tint_symbol_1.get_height(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_f7145b(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_f7145b(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_f7145b(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.spvasm b/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.spvasm deleted file mode 100644 index 7a5a016454..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.spvasm +++ /dev/null @@ -1,77 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 39 -; Schema: 0 - OpCapability Shader - OpCapability ImageQuery - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureDimensions_f7145b "textureDimensions_f7145b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 -%_ptr_Function_v2int = OpTypePointer Function %v2int - %24 = OpConstantNull %v2int - %25 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureDimensions_f7145b = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v2int Function %24 - %20 = OpLoad %11 %arg_0 - %17 = OpImageQuerySizeLod %v2int %20 %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %25 - %27 = OpLabel - %28 = OpFunctionCall %void %textureDimensions_f7145b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %30 = OpLabel - %31 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %31 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %34 = OpLabel - %35 = OpFunctionCall %void %textureDimensions_f7145b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %37 = OpLabel - %38 = OpFunctionCall %void %textureDimensions_f7145b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.wgsl deleted file mode 100644 index dd3335d8b2..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f7145b.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureDimensions_f7145b() { - var res : vec2 = textureDimensions(arg_0, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_f7145b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_f7145b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_f7145b(); -} diff --git a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl b/test/tint/builtins/gen/textureDimensions/f931c7.wgsl deleted file mode 100644 index 6dcbc80cf5..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureDimensions(texture: texture_storage_2d) -> vec2 -fn textureDimensions_f931c7() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_f931c7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_f931c7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_f931c7(); -} diff --git a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.glsl deleted file mode 100644 index 61ceed0904..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32f) uniform highp writeonly image2D arg_0; -void textureDimensions_f931c7() { - ivec2 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_f931c7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32f) uniform highp writeonly image2D arg_0; -void textureDimensions_f931c7() { - ivec2 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_f931c7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32f) uniform highp writeonly image2D arg_0; -void textureDimensions_f931c7() { - ivec2 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_f931c7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.hlsl deleted file mode 100644 index 6237cac672..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureDimensions_f931c7() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_f931c7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_f931c7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_f931c7(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.msl deleted file mode 100644 index 8167596ae9..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_f931c7(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_f931c7(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_f931c7(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_f931c7(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.wgsl deleted file mode 100644 index 14de15ab0c..0000000000 --- a/test/tint/builtins/gen/textureDimensions/f931c7.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureDimensions_f931c7() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_f931c7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_f931c7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_f931c7(); -} diff --git a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl b/test/tint/builtins/gen/textureDimensions/fa9859.wgsl deleted file mode 100644 index 7c3d137d3f..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureDimensions(texture: texture_2d) -> vec2 -fn textureDimensions_fa9859() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_fa9859(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_fa9859(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_fa9859(); -} diff --git a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.glsl deleted file mode 100644 index 98e8e475aa..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler2D arg_0_1; -void textureDimensions_fa9859() { - ivec2 res = textureSize(arg_0_1, 0); -} - -vec4 vertex_main() { - textureDimensions_fa9859(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2D arg_0_1; -void textureDimensions_fa9859() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void fragment_main() { - textureDimensions_fa9859(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2D arg_0_1; -void textureDimensions_fa9859() { - ivec2 res = textureSize(arg_0_1, 0); -} - -void compute_main() { - textureDimensions_fa9859(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.hlsl deleted file mode 100644 index 20ec180b0d..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureDimensions_fa9859() { - int2 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); - int2 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_fa9859(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_fa9859(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_fa9859(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.msl deleted file mode 100644 index 193d7d995a..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_fa9859(texture2d tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureDimensions_fa9859(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureDimensions_fa9859(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureDimensions_fa9859(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.wgsl deleted file mode 100644 index 58b2bd0e55..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fa9859.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureDimensions_fa9859() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_fa9859(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_fa9859(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_fa9859(); -} diff --git a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl b/test/tint/builtins/gen/textureDimensions/fb5670.wgsl deleted file mode 100644 index 73aa7aa875..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 -fn textureDimensions_fb5670() { - var res: vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_fb5670(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_fb5670(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_fb5670(); -} diff --git a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.glsl deleted file mode 100644 index 515efe6e7b..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_fb5670() { - ivec2 res = imageSize(arg_0).xy; -} - -vec4 vertex_main() { - textureDimensions_fb5670(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_fb5670() { - ivec2 res = imageSize(arg_0).xy; -} - -void fragment_main() { - textureDimensions_fb5670(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32f) uniform highp writeonly image2DArray arg_0; -void textureDimensions_fb5670() { - ivec2 res = imageSize(arg_0).xy; -} - -void compute_main() { - textureDimensions_fb5670(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.hlsl deleted file mode 100644 index 858a187f53..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureDimensions_fb5670() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int2 res = tint_tmp.xy; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_fb5670(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_fb5670(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_fb5670(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.msl deleted file mode 100644 index bf7f8df262..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_fb5670(texture2d_array tint_symbol_1) { - int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureDimensions_fb5670(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureDimensions_fb5670(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureDimensions_fb5670(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.wgsl deleted file mode 100644 index 79fcdb8375..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fb5670.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureDimensions_fb5670() { - var res : vec2 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_fb5670(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_fb5670(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_fb5670(); -} diff --git a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl b/test/tint/builtins/gen/textureDimensions/fcac78.wgsl deleted file mode 100644 index 8f5c0f0c9e..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureDimensions(texture: texture_storage_3d) -> vec3 -fn textureDimensions_fcac78() { - var res: vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_fcac78(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_fcac78(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_fcac78(); -} diff --git a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.glsl b/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.glsl deleted file mode 100644 index ea6779c230..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_fcac78() { - ivec3 res = imageSize(arg_0); -} - -vec4 vertex_main() { - textureDimensions_fcac78(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_fcac78() { - ivec3 res = imageSize(arg_0); -} - -void fragment_main() { - textureDimensions_fcac78(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage3D arg_0; -void textureDimensions_fcac78() { - ivec3 res = imageSize(arg_0); -} - -void compute_main() { - textureDimensions_fcac78(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.hlsl b/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.hlsl deleted file mode 100644 index e1bacc9188..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureDimensions_fcac78() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int3 res = tint_tmp; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureDimensions_fcac78(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureDimensions_fcac78(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureDimensions_fcac78(); - return; -} diff --git a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.msl b/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.msl deleted file mode 100644 index 6049ea8763..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureDimensions_fcac78(texture3d tint_symbol_1) { - int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureDimensions_fcac78(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureDimensions_fcac78(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureDimensions_fcac78(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.wgsl b/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.wgsl deleted file mode 100644 index bd243ab9de..0000000000 --- a/test/tint/builtins/gen/textureDimensions/fcac78.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureDimensions_fcac78() { - var res : vec3 = textureDimensions(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureDimensions_fcac78(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureDimensions_fcac78(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureDimensions_fcac78(); -} diff --git a/test/tint/builtins/gen/textureGather/01305f.wgsl b/test/tint/builtins/gen/textureGather/01305f.wgsl deleted file mode 100644 index fdb193f480..0000000000 --- a/test/tint/builtins/gen/textureGather/01305f.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather_01305f() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_01305f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_01305f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_01305f(); -} diff --git a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.glsl deleted file mode 100644 index f8679336d2..0000000000 --- a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_01305f() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_01305f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_01305f() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_01305f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_01305f() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_01305f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.hlsl deleted file mode 100644 index 180ad62847..0000000000 --- a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_01305f() { - uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_01305f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_01305f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_01305f(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.msl deleted file mode 100644 index 684d655fdd..0000000000 --- a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_01305f(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_01305f(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_01305f(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_01305f(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.spvasm deleted file mode 100644 index b8ac4eb07d..0000000000 --- a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_01305f "textureGather_01305f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %34 = OpConstantNull %v4uint - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_01305f = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %34 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %28 = OpConvertSToF %float %int_1 - %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28 - %20 = OpImageGather %v4uint %25 %31 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureGather_01305f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_01305f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %47 = OpLabel - %48 = OpFunctionCall %void %textureGather_01305f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.wgsl deleted file mode 100644 index b683348097..0000000000 --- a/test/tint/builtins/gen/textureGather/01305f.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_01305f() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_01305f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_01305f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_01305f(); -} diff --git a/test/tint/builtins/gen/textureGather/06030a.wgsl b/test/tint/builtins/gen/textureGather/06030a.wgsl deleted file mode 100644 index b2caaed434..0000000000 --- a/test/tint/builtins/gen/textureGather/06030a.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather_06030a() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_06030a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_06030a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_06030a(); -} diff --git a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.glsl deleted file mode 100644 index 0985e08413..0000000000 --- a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_06030a() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1); -} - -vec4 vertex_main() { - textureGather_06030a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_06030a() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1); -} - -void fragment_main() { - textureGather_06030a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_06030a() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1); -} - -void compute_main() { - textureGather_06030a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.hlsl deleted file mode 100644 index a8ca184648..0000000000 --- a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_06030a() { - float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_06030a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_06030a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_06030a(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.msl deleted file mode 100644 index 58cfec266d..0000000000 --- a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_06030a(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_06030a(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_06030a(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_06030a(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.spvasm deleted file mode 100644 index a46bcd0705..0000000000 --- a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_06030a "textureGather_06030a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %31 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_06030a = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageGather %v4float %23 %29 %int_1 ConstOffset %31 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureGather_06030a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_06030a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_06030a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.wgsl deleted file mode 100644 index 6709ed63bc..0000000000 --- a/test/tint/builtins/gen/textureGather/06030a.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_06030a() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_06030a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_06030a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_06030a(); -} diff --git a/test/tint/builtins/gen/textureGather/10c554.wgsl b/test/tint/builtins/gen/textureGather/10c554.wgsl deleted file mode 100644 index 28e958b3b8..0000000000 --- a/test/tint/builtins/gen/textureGather/10c554.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureGather_10c554() { - var res: vec4 = textureGather(arg_0, arg_1, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_10c554(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_10c554(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_10c554(); -} diff --git a/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.glsl deleted file mode 100644 index a038836c68..0000000000 --- a/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureGather_10c554() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 0.0); -} - -vec4 vertex_main() { - textureGather_10c554(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureGather_10c554() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 0.0); -} - -void fragment_main() { - textureGather_10c554(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureGather_10c554() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 0.0); -} - -void compute_main() { - textureGather_10c554(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.hlsl deleted file mode 100644 index 77c4aab887..0000000000 --- a/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureGather_10c554() { - float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_10c554(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_10c554(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_10c554(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.msl deleted file mode 100644 index 9fe4166823..0000000000 --- a/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_10c554(depthcube tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { - textureGather_10c554(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_10c554(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_10c554(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.wgsl deleted file mode 100644 index 71d449e971..0000000000 --- a/test/tint/builtins/gen/textureGather/10c554.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureGather_10c554() { - var res : vec4 = textureGather(arg_0, arg_1, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_10c554(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_10c554(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_10c554(); -} diff --git a/test/tint/builtins/gen/textureGather/15d79c.wgsl b/test/tint/builtins/gen/textureGather/15d79c.wgsl deleted file mode 100644 index 37b88a0f3e..0000000000 --- a/test/tint/builtins/gen/textureGather/15d79c.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather_15d79c() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_15d79c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_15d79c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_15d79c(); -} diff --git a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.glsl deleted file mode 100644 index 483b2d4bda..0000000000 --- a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_15d79c() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f, 0.0f), ivec2(0, 0), 1); -} - -vec4 vertex_main() { - textureGather_15d79c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_15d79c() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f, 0.0f), ivec2(0, 0), 1); -} - -void fragment_main() { - textureGather_15d79c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_15d79c() { - vec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f, 0.0f), ivec2(0, 0), 1); -} - -void compute_main() { - textureGather_15d79c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.hlsl deleted file mode 100644 index b45f71b211..0000000000 --- a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_15d79c() { - float4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_15d79c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_15d79c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_15d79c(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.msl deleted file mode 100644 index 37a9753650..0000000000 --- a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_15d79c(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_15d79c(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_15d79c(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_15d79c(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.spvasm deleted file mode 100644 index 376685950a..0000000000 --- a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_15d79c "textureGather_15d79c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %29 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_15d79c = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageGather %v4float %23 %25 %int_1 ConstOffset %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_15d79c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_15d79c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_15d79c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.wgsl deleted file mode 100644 index 14d9203b1a..0000000000 --- a/test/tint/builtins/gen/textureGather/15d79c.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_15d79c() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_15d79c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_15d79c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_15d79c(); -} diff --git a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl b/test/tint/builtins/gen/textureGather/2e0ed5.wgsl deleted file mode 100644 index 4b4d5bc297..0000000000 --- a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather_2e0ed5() { - var res: vec4 = textureGather(arg_0, arg_1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_2e0ed5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_2e0ed5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_2e0ed5(); -} diff --git a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.glsl deleted file mode 100644 index 8ba1ac1eea..0000000000 --- a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGather_2e0ed5() { - vec4 res = textureGather(arg_0_arg_1, vec2(0.0f, 0.0f), 0.0); -} - -vec4 vertex_main() { - textureGather_2e0ed5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGather_2e0ed5() { - vec4 res = textureGather(arg_0_arg_1, vec2(0.0f, 0.0f), 0.0); -} - -void fragment_main() { - textureGather_2e0ed5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGather_2e0ed5() { - vec4 res = textureGather(arg_0_arg_1, vec2(0.0f, 0.0f), 0.0); -} - -void compute_main() { - textureGather_2e0ed5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.hlsl deleted file mode 100644 index cba329f1ef..0000000000 --- a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureGather_2e0ed5() { - float4 res = arg_0.Gather(arg_1, float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_2e0ed5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_2e0ed5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_2e0ed5(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.msl deleted file mode 100644 index dfe89418b5..0000000000 --- a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_2e0ed5(depth2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_2e0ed5(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_2e0ed5(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_2e0ed5(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.wgsl deleted file mode 100644 index f3b60b86e5..0000000000 --- a/test/tint/builtins/gen/textureGather/2e0ed5.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureGather_2e0ed5() { - var res : vec4 = textureGather(arg_0, arg_1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_2e0ed5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_2e0ed5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_2e0ed5(); -} diff --git a/test/tint/builtins/gen/textureGather/3112e8.wgsl b/test/tint/builtins/gen/textureGather/3112e8.wgsl deleted file mode 100644 index cde5dd48cd..0000000000 --- a/test/tint/builtins/gen/textureGather/3112e8.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 -fn textureGather_3112e8() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_3112e8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_3112e8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_3112e8(); -} diff --git a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.glsl deleted file mode 100644 index f4c4935f70..0000000000 --- a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_1_arg_2; - -void textureGather_3112e8() { - vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_3112e8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_1_arg_2; - -void textureGather_3112e8() { - vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_3112e8(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_1_arg_2; - -void textureGather_3112e8() { - vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_3112e8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.hlsl deleted file mode 100644 index d538b4f7e1..0000000000 --- a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_3112e8() { - float4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_3112e8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_3112e8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_3112e8(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.msl deleted file mode 100644 index 69f2b13bb5..0000000000 --- a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_3112e8(texturecube_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float3(), 1, component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_3112e8(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_3112e8(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_3112e8(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.spvasm deleted file mode 100644 index 267adbca78..0000000000 --- a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_3112e8 "textureGather_3112e8" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %31 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_3112e8 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %25 = OpConvertSToF %float %int_1 - %28 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %25 - %19 = OpImageGather %v4float %23 %28 %int_1 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %31 - %33 = OpLabel - %34 = OpFunctionCall %void %textureGather_3112e8 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %36 = OpLabel - %37 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %37 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureGather_3112e8 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_3112e8 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.wgsl deleted file mode 100644 index 3f7ac9ee8a..0000000000 --- a/test/tint/builtins/gen/textureGather/3112e8.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_3112e8() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_3112e8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_3112e8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_3112e8(); -} diff --git a/test/tint/builtins/gen/textureGather/3c527e.wgsl b/test/tint/builtins/gen/textureGather/3c527e.wgsl deleted file mode 100644 index 533374898e..0000000000 --- a/test/tint/builtins/gen/textureGather/3c527e.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 -fn textureGather_3c527e() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_3c527e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_3c527e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_3c527e(); -} diff --git a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.glsl deleted file mode 100644 index 9f28e838ef..0000000000 --- a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usamplerCubeArray arg_1_arg_2; - -void textureGather_3c527e() { - uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_3c527e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usamplerCubeArray arg_1_arg_2; - -void textureGather_3c527e() { - uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_3c527e(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usamplerCubeArray arg_1_arg_2; - -void textureGather_3c527e() { - uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_3c527e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.hlsl deleted file mode 100644 index 9f1913cee8..0000000000 --- a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_3c527e() { - uint4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_3c527e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_3c527e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_3c527e(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.msl deleted file mode 100644 index c5458cf275..0000000000 --- a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_3c527e(texturecube_array tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(), 1, component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_3c527e(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_3c527e(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_3c527e(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.spvasm deleted file mode 100644 index 4ee0085682..0000000000 --- a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_3c527e "textureGather_3c527e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %33 = OpConstantNull %v4uint - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_3c527e = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %33 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %27 = OpConvertSToF %float %int_1 - %30 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 - %20 = OpImageGather %v4uint %25 %30 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureGather_3c527e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_3c527e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_3c527e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.wgsl deleted file mode 100644 index 9753db49b7..0000000000 --- a/test/tint/builtins/gen/textureGather/3c527e.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_3c527e() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_3c527e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_3c527e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_3c527e(); -} diff --git a/test/tint/builtins/gen/textureGather/43025d.wgsl b/test/tint/builtins/gen/textureGather/43025d.wgsl deleted file mode 100644 index 39681aa8a3..0000000000 --- a/test/tint/builtins/gen/textureGather/43025d.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 -fn textureGather_43025d() { - var res: vec4 = textureGather(arg_0, arg_1, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_43025d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_43025d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_43025d(); -} diff --git a/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.glsl deleted file mode 100644 index 70b226f721..0000000000 --- a/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureGather_43025d() { - vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 0.0); -} - -vec4 vertex_main() { - textureGather_43025d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureGather_43025d() { - vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 0.0); -} - -void fragment_main() { - textureGather_43025d(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureGather_43025d() { - vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 0.0); -} - -void compute_main() { - textureGather_43025d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.hlsl deleted file mode 100644 index 6d752ec6b8..0000000000 --- a/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureGather_43025d() { - float4 res = arg_0.Gather(arg_1, float4(0.0f, 0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_43025d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_43025d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_43025d(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.msl deleted file mode 100644 index a2c6d259fe..0000000000 --- a/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_43025d(depthcube_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float3(), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_43025d(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_43025d(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_43025d(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.wgsl deleted file mode 100644 index f94fa457a6..0000000000 --- a/test/tint/builtins/gen/textureGather/43025d.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureGather_43025d() { - var res : vec4 = textureGather(arg_0, arg_1, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_43025d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_43025d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_43025d(); -} diff --git a/test/tint/builtins/gen/textureGather/4f2350.wgsl b/test/tint/builtins/gen/textureGather/4f2350.wgsl deleted file mode 100644 index 27cb542892..0000000000 --- a/test/tint/builtins/gen/textureGather/4f2350.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather_4f2350() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_4f2350(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_4f2350(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_4f2350(); -} diff --git a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.glsl deleted file mode 100644 index 8289057eda..0000000000 --- a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_4f2350() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1); -} - -vec4 vertex_main() { - textureGather_4f2350(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_4f2350() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1); -} - -void fragment_main() { - textureGather_4f2350(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_4f2350() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1); -} - -void compute_main() { - textureGather_4f2350(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.hlsl deleted file mode 100644 index 02a56e2eba..0000000000 --- a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_4f2350() { - int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_4f2350(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_4f2350(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_4f2350(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.msl deleted file mode 100644 index 947743ea44..0000000000 --- a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_4f2350(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_4f2350(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_4f2350(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_4f2350(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.spvasm deleted file mode 100644 index c6ff85cb1f..0000000000 --- a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.spvasm +++ /dev/null @@ -1,90 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 50 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_4f2350 "textureGather_4f2350" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %35 = OpConstantNull %v4int - %36 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_4f2350 = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %35 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %28 = OpConvertSToF %float %int_1 - %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28 - %20 = OpImageGather %v4int %25 %30 %int_1 ConstOffset %32 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %36 - %38 = OpLabel - %39 = OpFunctionCall %void %textureGather_4f2350 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %41 = OpLabel - %42 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %42 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %45 = OpLabel - %46 = OpFunctionCall %void %textureGather_4f2350 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %48 = OpLabel - %49 = OpFunctionCall %void %textureGather_4f2350 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.wgsl deleted file mode 100644 index 75a6912f6a..0000000000 --- a/test/tint/builtins/gen/textureGather/4f2350.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_4f2350() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_4f2350(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_4f2350(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_4f2350(); -} diff --git a/test/tint/builtins/gen/textureGather/51cf0b.wgsl b/test/tint/builtins/gen/textureGather/51cf0b.wgsl deleted file mode 100644 index 3b42e5d682..0000000000 --- a/test/tint/builtins/gen/textureGather/51cf0b.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather_51cf0b() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_51cf0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_51cf0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_51cf0b(); -} diff --git a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.glsl deleted file mode 100644 index 6cf152525a..0000000000 --- a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_51cf0b() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_51cf0b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_51cf0b() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_51cf0b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DArray arg_1_arg_2; - -void textureGather_51cf0b() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_51cf0b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.hlsl deleted file mode 100644 index da88cb1cd2..0000000000 --- a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_51cf0b() { - int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_51cf0b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_51cf0b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_51cf0b(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.msl deleted file mode 100644 index a082138171..0000000000 --- a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_51cf0b(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_51cf0b(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_51cf0b(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_51cf0b(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.spvasm deleted file mode 100644 index 4bc14404e9..0000000000 --- a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_51cf0b "textureGather_51cf0b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %33 = OpConstantNull %v4int - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_51cf0b = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %33 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %28 = OpConvertSToF %float %int_1 - %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28 - %20 = OpImageGather %v4int %25 %30 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureGather_51cf0b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_51cf0b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_51cf0b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.wgsl deleted file mode 100644 index e326e20388..0000000000 --- a/test/tint/builtins/gen/textureGather/51cf0b.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_51cf0b() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_51cf0b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_51cf0b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_51cf0b(); -} diff --git a/test/tint/builtins/gen/textureGather/53ece6.wgsl b/test/tint/builtins/gen/textureGather/53ece6.wgsl deleted file mode 100644 index fff75b65b0..0000000000 --- a/test/tint/builtins/gen/textureGather/53ece6.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather_53ece6() { - var res: vec4 = textureGather(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_53ece6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_53ece6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_53ece6(); -} diff --git a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.glsl deleted file mode 100644 index d8b6a73b2b..0000000000 --- a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGather_53ece6() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0, 0)); -} - -vec4 vertex_main() { - textureGather_53ece6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGather_53ece6() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0, 0)); -} - -void fragment_main() { - textureGather_53ece6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGather_53ece6() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0, ivec2(0, 0)); -} - -void compute_main() { - textureGather_53ece6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.hlsl deleted file mode 100644 index 0962b39a78..0000000000 --- a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureGather_53ece6() { - float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1)), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_53ece6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_53ece6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_53ece6(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.msl deleted file mode 100644 index 2a5dbf0e87..0000000000 --- a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_53ece6(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_53ece6(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_53ece6(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_53ece6(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.spvasm deleted file mode 100644 index ab53c1f530..0000000000 --- a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureGather_53ece6 "textureGather_53ece6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_53ece6 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageGather %v4float %23 %29 %int_0 ConstOffset %32 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureGather_53ece6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_53ece6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %47 = OpLabel - %48 = OpFunctionCall %void %textureGather_53ece6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.wgsl deleted file mode 100644 index 27c47cfc4d..0000000000 --- a/test/tint/builtins/gen/textureGather/53ece6.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureGather_53ece6() { - var res : vec4 = textureGather(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_53ece6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_53ece6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_53ece6(); -} diff --git a/test/tint/builtins/gen/textureGather/57bfc6.wgsl b/test/tint/builtins/gen/textureGather/57bfc6.wgsl deleted file mode 100644 index 66ab90855f..0000000000 --- a/test/tint/builtins/gen/textureGather/57bfc6.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureGather_57bfc6() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_57bfc6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_57bfc6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_57bfc6(); -} diff --git a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.glsl deleted file mode 100644 index 0b091b6d50..0000000000 --- a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp samplerCube arg_1_arg_2; - -void textureGather_57bfc6() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, 0.0f), 1); -} - -vec4 vertex_main() { - textureGather_57bfc6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_1_arg_2; - -void textureGather_57bfc6() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, 0.0f), 1); -} - -void fragment_main() { - textureGather_57bfc6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCube arg_1_arg_2; - -void textureGather_57bfc6() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, 0.0f), 1); -} - -void compute_main() { - textureGather_57bfc6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.hlsl deleted file mode 100644 index eb276f71d7..0000000000 --- a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_57bfc6() { - float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_57bfc6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_57bfc6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_57bfc6(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.msl deleted file mode 100644 index 426ea2006a..0000000000 --- a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_57bfc6(texturecube tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float3(), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { - textureGather_57bfc6(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_57bfc6(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_57bfc6(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.spvasm deleted file mode 100644 index 531f1964a4..0000000000 --- a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.spvasm +++ /dev/null @@ -1,84 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 44 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_57bfc6 "textureGather_57bfc6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %25 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %30 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_57bfc6 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageGather %v4float %23 %25 %int_1 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %30 - %32 = OpLabel - %33 = OpFunctionCall %void %textureGather_57bfc6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %35 = OpLabel - %36 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %36 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %39 = OpLabel - %40 = OpFunctionCall %void %textureGather_57bfc6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_57bfc6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.wgsl deleted file mode 100644 index 8273199c8e..0000000000 --- a/test/tint/builtins/gen/textureGather/57bfc6.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_57bfc6() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_57bfc6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_57bfc6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_57bfc6(); -} diff --git a/test/tint/builtins/gen/textureGather/587ba3.wgsl b/test/tint/builtins/gen/textureGather/587ba3.wgsl deleted file mode 100644 index 36138e250d..0000000000 --- a/test/tint/builtins/gen/textureGather/587ba3.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather_587ba3() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_587ba3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_587ba3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_587ba3(); -} diff --git a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.glsl deleted file mode 100644 index f7a2dd213d..0000000000 --- a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_587ba3() { - ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f, 0.0f), 1); -} - -vec4 vertex_main() { - textureGather_587ba3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_587ba3() { - ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f, 0.0f), 1); -} - -void fragment_main() { - textureGather_587ba3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_587ba3() { - ivec4 res = textureGather(arg_1_arg_2, vec2(0.0f, 0.0f), 1); -} - -void compute_main() { - textureGather_587ba3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.hlsl deleted file mode 100644 index db0fc6f6f0..0000000000 --- a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_587ba3() { - int4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_587ba3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_587ba3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_587ba3(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.msl deleted file mode 100644 index 0ce1455606..0000000000 --- a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_587ba3(texture2d tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_587ba3(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_587ba3(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_587ba3(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.spvasm deleted file mode 100644 index 512819dbc2..0000000000 --- a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_587ba3 "textureGather_587ba3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %27 = OpConstantNull %v2float - %int_1 = OpConstant %int 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %31 = OpConstantNull %v4int - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_587ba3 = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %31 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4int %25 %27 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_587ba3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_587ba3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_587ba3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.wgsl deleted file mode 100644 index d906b0b34b..0000000000 --- a/test/tint/builtins/gen/textureGather/587ba3.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_587ba3() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_587ba3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_587ba3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_587ba3(); -} diff --git a/test/tint/builtins/gen/textureGather/69e0fb.wgsl b/test/tint/builtins/gen/textureGather/69e0fb.wgsl deleted file mode 100644 index eefd1764b8..0000000000 --- a/test/tint/builtins/gen/textureGather/69e0fb.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather_69e0fb() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_69e0fb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_69e0fb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_69e0fb(); -} diff --git a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.glsl deleted file mode 100644 index 89af7c0d4f..0000000000 --- a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_69e0fb() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f, 0.0f), ivec2(0, 0), 1); -} - -vec4 vertex_main() { - textureGather_69e0fb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_69e0fb() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f, 0.0f), ivec2(0, 0), 1); -} - -void fragment_main() { - textureGather_69e0fb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2D arg_1_arg_2; - -void textureGather_69e0fb() { - ivec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f, 0.0f), ivec2(0, 0), 1); -} - -void compute_main() { - textureGather_69e0fb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.hlsl deleted file mode 100644 index dcf9228016..0000000000 --- a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_69e0fb() { - int4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_69e0fb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_69e0fb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_69e0fb(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.msl deleted file mode 100644 index 43be4dfa0f..0000000000 --- a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_69e0fb(texture2d tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_69e0fb(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_69e0fb(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_69e0fb(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.spvasm deleted file mode 100644 index 977638a52f..0000000000 --- a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_69e0fb "textureGather_69e0fb" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %27 = OpConstantNull %v2float - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %30 = OpConstantNull %v2int -%_ptr_Function_v4int = OpTypePointer Function %v4int - %33 = OpConstantNull %v4int - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_69e0fb = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %33 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4int %25 %27 %int_1 ConstOffset %30 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureGather_69e0fb - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGather_69e0fb - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_69e0fb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.wgsl deleted file mode 100644 index a23c38fa43..0000000000 --- a/test/tint/builtins/gen/textureGather/69e0fb.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_69e0fb() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_69e0fb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_69e0fb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_69e0fb(); -} diff --git a/test/tint/builtins/gen/textureGather/93003d.wgsl b/test/tint/builtins/gen/textureGather/93003d.wgsl deleted file mode 100644 index 2d1a14fda0..0000000000 --- a/test/tint/builtins/gen/textureGather/93003d.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather_93003d() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_93003d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_93003d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_93003d(); -} diff --git a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.glsl deleted file mode 100644 index bb80ea7f1d..0000000000 --- a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_93003d() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f, 0.0f), ivec2(0, 0), 1); -} - -vec4 vertex_main() { - textureGather_93003d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_93003d() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f, 0.0f), ivec2(0, 0), 1); -} - -void fragment_main() { - textureGather_93003d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_93003d() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec2(0.0f, 0.0f), ivec2(0, 0), 1); -} - -void compute_main() { - textureGather_93003d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.hlsl deleted file mode 100644 index f9162f082a..0000000000 --- a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_93003d() { - uint4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_93003d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_93003d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_93003d(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.msl deleted file mode 100644 index b7c2ba3547..0000000000 --- a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_93003d(texture2d tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_93003d(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_93003d(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_93003d(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.spvasm deleted file mode 100644 index e31ea804ce..0000000000 --- a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_93003d "textureGather_93003d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %27 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %31 = OpConstantNull %v2int -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %34 = OpConstantNull %v4uint - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_93003d = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %34 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4uint %25 %27 %int_1 ConstOffset %31 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureGather_93003d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_93003d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %47 = OpLabel - %48 = OpFunctionCall %void %textureGather_93003d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.wgsl deleted file mode 100644 index c4adea5eea..0000000000 --- a/test/tint/builtins/gen/textureGather/93003d.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_93003d() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_93003d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_93003d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_93003d(); -} diff --git a/test/tint/builtins/gen/textureGather/9a6358.wgsl b/test/tint/builtins/gen/textureGather/9a6358.wgsl deleted file mode 100644 index fe03e14b0d..0000000000 --- a/test/tint/builtins/gen/textureGather/9a6358.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather_9a6358() { - var res: vec4 = textureGather(arg_0, arg_1, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_9a6358(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_9a6358(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_9a6358(); -} diff --git a/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.glsl deleted file mode 100644 index 9c3dba0b6e..0000000000 --- a/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGather_9a6358() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0); -} - -vec4 vertex_main() { - textureGather_9a6358(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGather_9a6358() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0); -} - -void fragment_main() { - textureGather_9a6358(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGather_9a6358() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 0.0); -} - -void compute_main() { - textureGather_9a6358(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.hlsl deleted file mode 100644 index 31f64d3a0f..0000000000 --- a/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureGather_9a6358() { - float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_9a6358(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_9a6358(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_9a6358(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.msl deleted file mode 100644 index 8588a79fab..0000000000 --- a/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_9a6358(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_9a6358(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_9a6358(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_9a6358(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.wgsl deleted file mode 100644 index 984ff98743..0000000000 --- a/test/tint/builtins/gen/textureGather/9a6358.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureGather_9a6358() { - var res : vec4 = textureGather(arg_0, arg_1, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_9a6358(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_9a6358(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_9a6358(); -} diff --git a/test/tint/builtins/gen/textureGather/9efca2.wgsl b/test/tint/builtins/gen/textureGather/9efca2.wgsl deleted file mode 100644 index 01173de9db..0000000000 --- a/test/tint/builtins/gen/textureGather/9efca2.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureGather_9efca2() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_9efca2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_9efca2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_9efca2(); -} diff --git a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.glsl deleted file mode 100644 index 09dc67245b..0000000000 --- a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_9efca2() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_9efca2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_9efca2() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_9efca2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_1_arg_2; - -void textureGather_9efca2() { - vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_9efca2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.hlsl deleted file mode 100644 index 280024d0f7..0000000000 --- a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_9efca2() { - float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_9efca2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_9efca2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_9efca2(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.msl deleted file mode 100644 index 4705de2128..0000000000 --- a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_9efca2(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_9efca2(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_9efca2(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_9efca2(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.spvasm deleted file mode 100644 index 55026388d7..0000000000 --- a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_9efca2 "textureGather_9efca2" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_9efca2 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageGather %v4float %23 %29 %int_1 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_9efca2 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_9efca2 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_9efca2 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.wgsl deleted file mode 100644 index c9774286eb..0000000000 --- a/test/tint/builtins/gen/textureGather/9efca2.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_9efca2() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_9efca2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_9efca2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_9efca2(); -} diff --git a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl b/test/tint/builtins/gen/textureGather/bd0b1e.wgsl deleted file mode 100644 index eff100dad2..0000000000 --- a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather_bd0b1e() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_bd0b1e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_bd0b1e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_bd0b1e(); -} diff --git a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.glsl deleted file mode 100644 index cbd285e68f..0000000000 --- a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_bd0b1e() { - vec4 res = textureGather(arg_1_arg_2, vec2(0.0f, 0.0f), 1); -} - -vec4 vertex_main() { - textureGather_bd0b1e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_bd0b1e() { - vec4 res = textureGather(arg_1_arg_2, vec2(0.0f, 0.0f), 1); -} - -void fragment_main() { - textureGather_bd0b1e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_1_arg_2; - -void textureGather_bd0b1e() { - vec4 res = textureGather(arg_1_arg_2, vec2(0.0f, 0.0f), 1); -} - -void compute_main() { - textureGather_bd0b1e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.hlsl deleted file mode 100644 index aca181e73f..0000000000 --- a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_bd0b1e() { - float4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_bd0b1e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_bd0b1e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_bd0b1e(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.msl deleted file mode 100644 index d8311b3f20..0000000000 --- a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_bd0b1e(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_bd0b1e(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_bd0b1e(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_bd0b1e(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.spvasm deleted file mode 100644 index aeeccf160f..0000000000 --- a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.spvasm +++ /dev/null @@ -1,84 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 44 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_bd0b1e "textureGather_bd0b1e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %30 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_bd0b1e = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_2 - %21 = OpLoad %11 %arg_1 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageGather %v4float %23 %25 %int_1 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %30 - %32 = OpLabel - %33 = OpFunctionCall %void %textureGather_bd0b1e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %35 = OpLabel - %36 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %36 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %39 = OpLabel - %40 = OpFunctionCall %void %textureGather_bd0b1e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_bd0b1e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.wgsl deleted file mode 100644 index c4f05ce89f..0000000000 --- a/test/tint/builtins/gen/textureGather/bd0b1e.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_bd0b1e() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_bd0b1e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_bd0b1e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_bd0b1e(); -} diff --git a/test/tint/builtins/gen/textureGather/c409ae.wgsl b/test/tint/builtins/gen/textureGather/c409ae.wgsl deleted file mode 100644 index 5ce164326c..0000000000 --- a/test/tint/builtins/gen/textureGather/c409ae.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureGather_c409ae() { - var res: vec4 = textureGather(arg_0, arg_1, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_c409ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_c409ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_c409ae(); -} diff --git a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.glsl deleted file mode 100644 index fff470ed8e..0000000000 --- a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGather_c409ae() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f, 0.0f), 0.0, ivec2(0, 0)); -} - -vec4 vertex_main() { - textureGather_c409ae(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGather_c409ae() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f, 0.0f), 0.0, ivec2(0, 0)); -} - -void fragment_main() { - textureGather_c409ae(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGather_c409ae() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f, 0.0f), 0.0, ivec2(0, 0)); -} - -void compute_main() { - textureGather_c409ae(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.hlsl deleted file mode 100644 index 3360bac610..0000000000 --- a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureGather_c409ae() { - float4 res = arg_0.Gather(arg_1, float2(0.0f, 0.0f), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_c409ae(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_c409ae(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_c409ae(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.msl deleted file mode 100644 index c917900704..0000000000 --- a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_c409ae(depth2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_c409ae(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_c409ae(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_c409ae(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.spvasm deleted file mode 100644 index d5f4ba6770..0000000000 --- a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureGather_c409ae "textureGather_c409ae" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %v2int = OpTypeVector %int 2 - %29 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_c409ae = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageGather %v4float %23 %25 %int_0 ConstOffset %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_c409ae - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_c409ae - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_c409ae - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.wgsl deleted file mode 100644 index 3610a5df80..0000000000 --- a/test/tint/builtins/gen/textureGather/c409ae.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureGather_c409ae() { - var res : vec4 = textureGather(arg_0, arg_1, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_c409ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_c409ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_c409ae(); -} diff --git a/test/tint/builtins/gen/textureGather/c55822.wgsl b/test/tint/builtins/gen/textureGather/c55822.wgsl deleted file mode 100644 index 7c60b3ea51..0000000000 --- a/test/tint/builtins/gen/textureGather/c55822.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 -fn textureGather_c55822() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_c55822(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_c55822(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_c55822(); -} diff --git a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.glsl deleted file mode 100644 index ff259fb120..0000000000 --- a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isamplerCubeArray arg_1_arg_2; - -void textureGather_c55822() { - ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -vec4 vertex_main() { - textureGather_c55822(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isamplerCubeArray arg_1_arg_2; - -void textureGather_c55822() { - ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void fragment_main() { - textureGather_c55822(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isamplerCubeArray arg_1_arg_2; - -void textureGather_c55822() { - ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), 1); -} - -void compute_main() { - textureGather_c55822(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.hlsl deleted file mode 100644 index e01de9ffd4..0000000000 --- a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_c55822() { - int4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1))); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_c55822(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_c55822(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_c55822(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.msl deleted file mode 100644 index 9f34359fcb..0000000000 --- a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_c55822(texturecube_array tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float3(), 1, component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_c55822(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_c55822(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_c55822(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.spvasm deleted file mode 100644 index 3b73a1cf66..0000000000 --- a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_c55822 "textureGather_c55822" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %float_0 = OpConstant %float 0 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %32 = OpConstantNull %v4int - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_c55822 = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %32 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %27 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 - %20 = OpImageGather %v4int %25 %29 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureGather_c55822 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_c55822 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %45 = OpLabel - %46 = OpFunctionCall %void %textureGather_c55822 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.wgsl deleted file mode 100644 index 261b01b039..0000000000 --- a/test/tint/builtins/gen/textureGather/c55822.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_c55822() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_c55822(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_c55822(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_c55822(); -} diff --git a/test/tint/builtins/gen/textureGather/e1b67d.wgsl b/test/tint/builtins/gen/textureGather/e1b67d.wgsl deleted file mode 100644 index 1745a44e20..0000000000 --- a/test/tint/builtins/gen/textureGather/e1b67d.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureGather_e1b67d() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_e1b67d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_e1b67d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_e1b67d(); -} diff --git a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.glsl deleted file mode 100644 index d7d445cff2..0000000000 --- a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usamplerCube arg_1_arg_2; - -void textureGather_e1b67d() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, 0.0f), 1); -} - -vec4 vertex_main() { - textureGather_e1b67d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usamplerCube arg_1_arg_2; - -void textureGather_e1b67d() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, 0.0f), 1); -} - -void fragment_main() { - textureGather_e1b67d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usamplerCube arg_1_arg_2; - -void textureGather_e1b67d() { - uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, 0.0f), 1); -} - -void compute_main() { - textureGather_e1b67d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.hlsl deleted file mode 100644 index 4d46a7e583..0000000000 --- a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_e1b67d() { - uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_e1b67d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_e1b67d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_e1b67d(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.msl deleted file mode 100644 index 8d806f937a..0000000000 --- a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_e1b67d(texturecube tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { - textureGather_e1b67d(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_e1b67d(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_e1b67d(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.spvasm deleted file mode 100644 index e7664cb340..0000000000 --- a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.spvasm +++ /dev/null @@ -1,87 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_e1b67d "textureGather_e1b67d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %27 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %32 = OpConstantNull %v4uint - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_e1b67d = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %32 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4uint %25 %27 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureGather_e1b67d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_e1b67d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %45 = OpLabel - %46 = OpFunctionCall %void %textureGather_e1b67d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.wgsl deleted file mode 100644 index 4f60ac795e..0000000000 --- a/test/tint/builtins/gen/textureGather/e1b67d.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_e1b67d() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_e1b67d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_e1b67d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_e1b67d(); -} diff --git a/test/tint/builtins/gen/textureGather/e9eff6.wgsl b/test/tint/builtins/gen/textureGather/e9eff6.wgsl deleted file mode 100644 index cc3356e5c1..0000000000 --- a/test/tint/builtins/gen/textureGather/e9eff6.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureGather_e9eff6() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_e9eff6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_e9eff6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_e9eff6(); -} diff --git a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.glsl deleted file mode 100644 index 622ba9a7e8..0000000000 --- a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_e9eff6() { - uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f, 0.0f), 1); -} - -vec4 vertex_main() { - textureGather_e9eff6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_e9eff6() { - uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f, 0.0f), 1); -} - -void fragment_main() { - textureGather_e9eff6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2D arg_1_arg_2; - -void textureGather_e9eff6() { - uvec4 res = textureGather(arg_1_arg_2, vec2(0.0f, 0.0f), 1); -} - -void compute_main() { - textureGather_e9eff6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.hlsl deleted file mode 100644 index 46ac6a1227..0000000000 --- a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_e9eff6() { - uint4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_e9eff6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_e9eff6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_e9eff6(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.msl deleted file mode 100644 index 81c960d082..0000000000 --- a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_e9eff6(texture2d tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureGather_e9eff6(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_e9eff6(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_e9eff6(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.spvasm deleted file mode 100644 index 621964021f..0000000000 --- a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.spvasm +++ /dev/null @@ -1,87 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_e9eff6 "textureGather_e9eff6" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %27 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %32 = OpConstantNull %v4uint - %33 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_e9eff6 = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %32 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4uint %25 %27 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureGather_e9eff6 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %42 = OpLabel - %43 = OpFunctionCall %void %textureGather_e9eff6 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %45 = OpLabel - %46 = OpFunctionCall %void %textureGather_e9eff6 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.wgsl deleted file mode 100644 index 708a011d5c..0000000000 --- a/test/tint/builtins/gen/textureGather/e9eff6.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_e9eff6() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_e9eff6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_e9eff6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_e9eff6(); -} diff --git a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl b/test/tint/builtins/gen/textureGather/f5f3ba.wgsl deleted file mode 100644 index 739a99be02..0000000000 --- a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_2d_array; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureGather_f5f3ba() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_f5f3ba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_f5f3ba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_f5f3ba(); -} diff --git a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.glsl deleted file mode 100644 index c99eb2365a..0000000000 --- a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_f5f3ba() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1); -} - -vec4 vertex_main() { - textureGather_f5f3ba(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_f5f3ba() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1); -} - -void fragment_main() { - textureGather_f5f3ba(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DArray arg_1_arg_2; - -void textureGather_f5f3ba() { - uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1); -} - -void compute_main() { - textureGather_f5f3ba(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.hlsl deleted file mode 100644 index f6e6c95354..0000000000 --- a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_f5f3ba() { - uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_f5f3ba(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_f5f3ba(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_f5f3ba(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.msl deleted file mode 100644 index 674927c5f1..0000000000 --- a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_f5f3ba(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGather_f5f3ba(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_f5f3ba(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_f5f3ba(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.spvasm deleted file mode 100644 index 893c80af07..0000000000 --- a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.spvasm +++ /dev/null @@ -1,91 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 51 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_f5f3ba "textureGather_f5f3ba" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %33 = OpConstantNull %v2int -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %36 = OpConstantNull %v4uint - %37 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_f5f3ba = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %36 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %28 = OpConvertSToF %float %int_1 - %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28 - %20 = OpImageGather %v4uint %25 %31 %int_1 ConstOffset %33 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %37 - %39 = OpLabel - %40 = OpFunctionCall %void %textureGather_f5f3ba - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %42 = OpLabel - %43 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %43 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGather_f5f3ba - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %49 = OpLabel - %50 = OpFunctionCall %void %textureGather_f5f3ba - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.wgsl deleted file mode 100644 index b5ddcdc14f..0000000000 --- a/test/tint/builtins/gen/textureGather/f5f3ba.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_2d_array; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_f5f3ba() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec2(), 1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_f5f3ba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_f5f3ba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_f5f3ba(); -} diff --git a/test/tint/builtins/gen/textureGather/f7995a.wgsl b/test/tint/builtins/gen/textureGather/f7995a.wgsl deleted file mode 100644 index ef2624f428..0000000000 --- a/test/tint/builtins/gen/textureGather/f7995a.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(1) var arg_1: texture_cube; -@group(1) @binding(2) var arg_2: sampler; - -// fn textureGather(component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureGather_f7995a() { - var res: vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_f7995a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_f7995a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_f7995a(); -} diff --git a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.glsl b/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.glsl deleted file mode 100644 index 2df8a3bdff..0000000000 --- a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp isamplerCube arg_1_arg_2; - -void textureGather_f7995a() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, 0.0f), 1); -} - -vec4 vertex_main() { - textureGather_f7995a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isamplerCube arg_1_arg_2; - -void textureGather_f7995a() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, 0.0f), 1); -} - -void fragment_main() { - textureGather_f7995a(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isamplerCube arg_1_arg_2; - -void textureGather_f7995a() { - ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, 0.0f), 1); -} - -void compute_main() { - textureGather_f7995a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.hlsl deleted file mode 100644 index 6d0ca689c9..0000000000 --- a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_1 : register(t1, space1); -SamplerState arg_2 : register(s2, space1); - -void textureGather_f7995a() { - int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGather_f7995a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGather_f7995a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGather_f7995a(); - return; -} diff --git a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.msl b/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.msl deleted file mode 100644 index daf9ec7c0e..0000000000 --- a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGather_f7995a(texturecube tint_symbol_1, sampler tint_symbol_2) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float3(), component::y); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { - textureGather_f7995a(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGather_f7995a(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGather_f7995a(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.spvasm deleted file mode 100644 index 08fb6fc339..0000000000 --- a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_1 "arg_1" - OpName %arg_2 "arg_2" - OpName %textureGather_f7995a "textureGather_f7995a" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - OpDecorate %arg_2 DescriptorSet 1 - OpDecorate %arg_2 Binding 2 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %15 = OpTypeSampler -%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 - %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant - %void = OpTypeVoid - %16 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %24 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %27 = OpConstantNull %v3float - %int_1 = OpConstant %int 1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %31 = OpConstantNull %v4int - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureGather_f7995a = OpFunction %void None %16 - %19 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %31 - %22 = OpLoad %15 %arg_2 - %23 = OpLoad %11 %arg_1 - %25 = OpSampledImage %24 %23 %22 - %20 = OpImageGather %v4int %25 %27 %int_1 - OpStore %res %20 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGather_f7995a - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %16 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %16 - %41 = OpLabel - %42 = OpFunctionCall %void %textureGather_f7995a - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %16 - %44 = OpLabel - %45 = OpFunctionCall %void %textureGather_f7995a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.wgsl deleted file mode 100644 index 59c890e172..0000000000 --- a/test/tint/builtins/gen/textureGather/f7995a.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(1) var arg_1 : texture_cube; - -@group(1) @binding(2) var arg_2 : sampler; - -fn textureGather_f7995a() { - var res : vec4 = textureGather(1, arg_1, arg_2, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGather_f7995a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGather_f7995a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGather_f7995a(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl b/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl deleted file mode 100644 index 90ba7db910..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> vec4 -fn textureGatherCompare_182fd4() { - var res: vec4 = textureGatherCompare(arg_0, arg_1, vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_182fd4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_182fd4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_182fd4(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.glsl b/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.glsl deleted file mode 100644 index d79d45ad58..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureGatherCompare_182fd4() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - textureGatherCompare_182fd4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureGatherCompare_182fd4() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureGatherCompare_182fd4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureGatherCompare_182fd4() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void compute_main() { - textureGatherCompare_182fd4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.hlsl deleted file mode 100644 index 09f24d3c7c..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureGatherCompare_182fd4() { - float4 res = arg_0.GatherCmp(arg_1, float3(0.0f, 0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGatherCompare_182fd4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGatherCompare_182fd4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGatherCompare_182fd4(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.msl b/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.msl deleted file mode 100644 index 87e666155b..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGatherCompare_182fd4(depthcube tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float3(), 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { - textureGatherCompare_182fd4(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGatherCompare_182fd4(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGatherCompare_182fd4(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.wgsl deleted file mode 100644 index 3a4d029793..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/182fd4.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureGatherCompare_182fd4() { - var res : vec4 = textureGatherCompare(arg_0, arg_1, vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_182fd4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_182fd4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_182fd4(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl b/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl deleted file mode 100644 index 4fe0fc719a..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> vec4 -fn textureGatherCompare_60d2d1() { - var res: vec4 = textureGatherCompare(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_60d2d1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_60d2d1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_60d2d1(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.glsl b/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.glsl deleted file mode 100644 index d2fdd93aa9..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureGatherCompare_60d2d1() { - vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -vec4 vertex_main() { - textureGatherCompare_60d2d1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureGatherCompare_60d2d1() { - vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -void fragment_main() { - textureGatherCompare_60d2d1(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureGatherCompare_60d2d1() { - vec4 res = textureGather(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -void compute_main() { - textureGatherCompare_60d2d1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.hlsl deleted file mode 100644 index 2a7c8fd152..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureGatherCompare_60d2d1() { - float4 res = arg_0.GatherCmp(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGatherCompare_60d2d1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGatherCompare_60d2d1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGatherCompare_60d2d1(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.msl b/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.msl deleted file mode 100644 index 3fb5c132bb..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGatherCompare_60d2d1(depthcube_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float3(), 1, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { - textureGatherCompare_60d2d1(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGatherCompare_60d2d1(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGatherCompare_60d2d1(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.wgsl deleted file mode 100644 index e22b1fc91a..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/60d2d1.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureGatherCompare_60d2d1() { - var res : vec4 = textureGatherCompare(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_60d2d1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_60d2d1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_60d2d1(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl b/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl deleted file mode 100644 index e58b3776fb..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> vec4 -fn textureGatherCompare_6d9352() { - var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_6d9352(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_6d9352(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_6d9352(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.glsl b/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.glsl deleted file mode 100644 index 66f02bb133..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGatherCompare_6d9352() { - vec4 res = textureGather(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - textureGatherCompare_6d9352(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGatherCompare_6d9352() { - vec4 res = textureGather(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureGatherCompare_6d9352(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGatherCompare_6d9352() { - vec4 res = textureGather(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f); -} - -void compute_main() { - textureGatherCompare_6d9352(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.hlsl deleted file mode 100644 index 4689a0286e..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureGatherCompare_6d9352() { - float4 res = arg_0.GatherCmp(arg_1, float2(0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGatherCompare_6d9352(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGatherCompare_6d9352(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGatherCompare_6d9352(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.msl b/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.msl deleted file mode 100644 index cacdd370f1..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGatherCompare_6d9352(depth2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(), 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureGatherCompare_6d9352(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGatherCompare_6d9352(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGatherCompare_6d9352(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.wgsl deleted file mode 100644 index 6fc40cef35..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6d9352.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureGatherCompare_6d9352() { - var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_6d9352(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_6d9352(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_6d9352(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl b/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl deleted file mode 100644 index b3b015d91e..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> vec4 -fn textureGatherCompare_6f1267() { - var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_6f1267(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_6f1267(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_6f1267(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.glsl b/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.glsl deleted file mode 100644 index 5afdbe3530..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGatherCompare_6f1267() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0, 0)); -} - -vec4 vertex_main() { - textureGatherCompare_6f1267(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGatherCompare_6f1267() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0, 0)); -} - -void fragment_main() { - textureGatherCompare_6f1267(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGatherCompare_6f1267() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0, 0)); -} - -void compute_main() { - textureGatherCompare_6f1267(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.hlsl deleted file mode 100644 index f1bcdbed96..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureGatherCompare_6f1267() { - float4 res = arg_0.GatherCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGatherCompare_6f1267(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGatherCompare_6f1267(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGatherCompare_6f1267(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.msl b/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.msl deleted file mode 100644 index 1e3a96faec..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGatherCompare_6f1267(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(), 1, 1.0f, int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGatherCompare_6f1267(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGatherCompare_6f1267(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGatherCompare_6f1267(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.spvasm deleted file mode 100644 index af1a777aed..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureGatherCompare_6f1267 "textureGatherCompare_6f1267" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %35 = OpTypeFunction %v4float -%textureGatherCompare_6f1267 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageDrefGather %v4float %23 %29 %float_1 ConstOffset %32 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureGatherCompare_6f1267 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGatherCompare_6f1267 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureGatherCompare_6f1267 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.wgsl deleted file mode 100644 index 19e782d584..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/6f1267.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureGatherCompare_6f1267() { - var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_6f1267(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_6f1267(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_6f1267(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl b/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl deleted file mode 100644 index cb6fb6d343..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> vec4 -fn textureGatherCompare_783e65() { - var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_783e65(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_783e65(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_783e65(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.glsl b/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.glsl deleted file mode 100644 index 14d0b73dc0..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGatherCompare_783e65() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); -} - -vec4 vertex_main() { - textureGatherCompare_783e65(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGatherCompare_783e65() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); -} - -void fragment_main() { - textureGatherCompare_783e65(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureGatherCompare_783e65() { - vec4 res = textureGather(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); -} - -void compute_main() { - textureGatherCompare_783e65(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.hlsl deleted file mode 100644 index 025a0e68c0..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureGatherCompare_783e65() { - float4 res = arg_0.GatherCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGatherCompare_783e65(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGatherCompare_783e65(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGatherCompare_783e65(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.msl b/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.msl deleted file mode 100644 index 5520d910be..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGatherCompare_783e65(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(), 1, 1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureGatherCompare_783e65(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGatherCompare_783e65(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGatherCompare_783e65(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.wgsl deleted file mode 100644 index 9800261052..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/783e65.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureGatherCompare_783e65() { - var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_783e65(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_783e65(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_783e65(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl b/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl deleted file mode 100644 index 3a2d011291..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> vec4 -fn textureGatherCompare_a5f587() { - var res: vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_a5f587(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_a5f587(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_a5f587(); -} diff --git a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.glsl b/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.glsl deleted file mode 100644 index 393b68ed20..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGatherCompare_a5f587() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f, ivec2(0, 0)); -} - -vec4 vertex_main() { - textureGatherCompare_a5f587(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGatherCompare_a5f587() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f, ivec2(0, 0)); -} - -void fragment_main() { - textureGatherCompare_a5f587(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureGatherCompare_a5f587() { - vec4 res = textureGatherOffset(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f, ivec2(0, 0)); -} - -void compute_main() { - textureGatherCompare_a5f587(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.hlsl b/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.hlsl deleted file mode 100644 index e074554ec5..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureGatherCompare_a5f587() { - float4 res = arg_0.GatherCmp(arg_1, float2(0.0f, 0.0f), 1.0f, int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureGatherCompare_a5f587(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureGatherCompare_a5f587(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureGatherCompare_a5f587(); - return; -} diff --git a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.msl b/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.msl deleted file mode 100644 index 94edcaded9..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureGatherCompare_a5f587(depth2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.gather_compare(tint_symbol_2, float2(), 1.0f, int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureGatherCompare_a5f587(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureGatherCompare_a5f587(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureGatherCompare_a5f587(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.spvasm b/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.spvasm deleted file mode 100644 index 1cace3a92b..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureGatherCompare_a5f587 "textureGatherCompare_a5f587" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %29 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float -%textureGatherCompare_a5f587 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageDrefGather %v4float %23 %25 %float_1 ConstOffset %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureGatherCompare_a5f587 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureGatherCompare_a5f587 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureGatherCompare_a5f587 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.wgsl b/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.wgsl deleted file mode 100644 index 44b3cf1515..0000000000 --- a/test/tint/builtins/gen/textureGatherCompare/a5f587.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureGatherCompare_a5f587() { - var res : vec4 = textureGatherCompare(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureGatherCompare_a5f587(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureGatherCompare_a5f587(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureGatherCompare_a5f587(); -} diff --git a/test/tint/builtins/gen/textureLoad/19cf87.wgsl b/test/tint/builtins/gen/textureLoad/19cf87.wgsl deleted file mode 100644 index be3267a268..0000000000 --- a/test/tint/builtins/gen/textureLoad/19cf87.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; - -// fn textureLoad(texture: texture_depth_2d, coords: vec2, level: i32) -> f32 -fn textureLoad_19cf87() { - var res: f32 = textureLoad(arg_0, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_19cf87(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_19cf87(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_19cf87(); -} diff --git a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.glsl deleted file mode 100644 index 45c5fed006..0000000000 --- a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureLoad_19cf87() { - float res = texelFetch(arg_0_1, ivec2(0, 0), 0).x; -} - -vec4 vertex_main() { - textureLoad_19cf87(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_1; -void textureLoad_19cf87() { - float res = texelFetch(arg_0_1, ivec2(0, 0), 0).x; -} - -void fragment_main() { - textureLoad_19cf87(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureLoad_19cf87() { - float res = texelFetch(arg_0_1, ivec2(0, 0), 0).x; -} - -void compute_main() { - textureLoad_19cf87(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.hlsl deleted file mode 100644 index 745c99c5b1..0000000000 --- a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureLoad_19cf87() { - float res = arg_0.Load(int3(0, 0, 0)).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_19cf87(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_19cf87(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_19cf87(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.msl deleted file mode 100644 index c9b2c1d39a..0000000000 --- a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_19cf87(depth2d tint_symbol_1) { - float res = tint_symbol_1.read(uint2(int2()), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_2) { - textureLoad_19cf87(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { - textureLoad_19cf87(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { - textureLoad_19cf87(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.spvasm deleted file mode 100644 index eca642dfbb..0000000000 --- a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 39 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_19cf87 "textureLoad_19cf87" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %21 = OpConstantNull %v2int - %int_0 = OpConstant %int 0 -%_ptr_Function_float = OpTypePointer Function %float - %25 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_19cf87 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %18 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4float %18 %21 Lod %int_0 - %16 = OpCompositeExtract %float %17 0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %25 - %27 = OpLabel - %28 = OpFunctionCall %void %textureLoad_19cf87 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %30 = OpLabel - %31 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %31 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %34 = OpLabel - %35 = OpFunctionCall %void %textureLoad_19cf87 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %37 = OpLabel - %38 = OpFunctionCall %void %textureLoad_19cf87 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.wgsl deleted file mode 100644 index 886136a295..0000000000 --- a/test/tint/builtins/gen/textureLoad/19cf87.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -fn textureLoad_19cf87() { - var res : f32 = textureLoad(arg_0, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_19cf87(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_19cf87(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_19cf87(); -} diff --git a/test/tint/builtins/gen/textureLoad/1b8588.wgsl b/test/tint/builtins/gen/textureLoad/1b8588.wgsl deleted file mode 100644 index f83d3bc541..0000000000 --- a/test/tint/builtins/gen/textureLoad/1b8588.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 -fn textureLoad_1b8588() { - var res: vec4 = textureLoad(arg_0, 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_1b8588(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_1b8588(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_1b8588(); -} diff --git a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.glsl deleted file mode 100644 index 147694e534..0000000000 --- a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usampler1D arg_0_1; -void textureLoad_1b8588() { - uvec4 res = texelFetch(arg_0_1, 1, 0); -} - -vec4 vertex_main() { - textureLoad_1b8588(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usampler1D arg_0_1; -void textureLoad_1b8588() { - uvec4 res = texelFetch(arg_0_1, 1, 0); -} - -void fragment_main() { - textureLoad_1b8588(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usampler1D arg_0_1; -void textureLoad_1b8588() { - uvec4 res = texelFetch(arg_0_1, 1, 0); -} - -void compute_main() { - textureLoad_1b8588(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.hlsl deleted file mode 100644 index 9e928acc7a..0000000000 --- a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureLoad_1b8588() { - uint4 res = arg_0.Load(int2(1, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_1b8588(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_1b8588(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_1b8588(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.msl deleted file mode 100644 index 2dd4d15ac0..0000000000 --- a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_1b8588(texture1d tint_symbol_1) { - uint4 res = tint_symbol_1.read(uint(1), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureLoad_1b8588(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureLoad_1b8588(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureLoad_1b8588(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.spvasm deleted file mode 100644 index 21b4c1eeb9..0000000000 --- a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.spvasm +++ /dev/null @@ -1,78 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpCapability Sampled1D - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_1b8588 "textureLoad_1b8588" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %25 = OpConstantNull %v4uint - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_1b8588 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %25 - %19 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4uint %19 %int_1 Lod %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureLoad_1b8588 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %35 = OpLabel - %36 = OpFunctionCall %void %textureLoad_1b8588 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %38 = OpLabel - %39 = OpFunctionCall %void %textureLoad_1b8588 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.wgsl deleted file mode 100644 index 07481f8864..0000000000 --- a/test/tint/builtins/gen/textureLoad/1b8588.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureLoad_1b8588() { - var res : vec4 = textureLoad(arg_0, 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_1b8588(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_1b8588(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_1b8588(); -} diff --git a/test/tint/builtins/gen/textureLoad/1f2016.wgsl b/test/tint/builtins/gen/textureLoad/1f2016.wgsl deleted file mode 100644 index 078f87b97d..0000000000 --- a/test/tint/builtins/gen/textureLoad/1f2016.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 -fn textureLoad_1f2016() { - var res: vec4 = textureLoad(arg_0, vec3(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_1f2016(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_1f2016(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_1f2016(); -} diff --git a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.glsl deleted file mode 100644 index 02d98faa63..0000000000 --- a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler3D arg_0_1; -void textureLoad_1f2016() { - vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 0), 0); -} - -vec4 vertex_main() { - textureLoad_1f2016(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_1; -void textureLoad_1f2016() { - vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 0), 0); -} - -void fragment_main() { - textureLoad_1f2016(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler3D arg_0_1; -void textureLoad_1f2016() { - vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 0), 0); -} - -void compute_main() { - textureLoad_1f2016(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.hlsl deleted file mode 100644 index d4daa46044..0000000000 --- a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureLoad_1f2016() { - float4 res = arg_0.Load(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_1f2016(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_1f2016(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_1f2016(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.msl deleted file mode 100644 index 296e7bbbc9..0000000000 --- a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_1f2016(texture3d tint_symbol_1) { - float4 res = tint_symbol_1.read(uint3(int3()), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureLoad_1f2016(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureLoad_1f2016(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureLoad_1f2016(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.spvasm deleted file mode 100644 index 15ceefac3b..0000000000 --- a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.spvasm +++ /dev/null @@ -1,75 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_1f2016 "textureLoad_1f2016" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %20 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_1f2016 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %17 = OpLoad %11 %arg_0 - %16 = OpImageFetch %v4float %17 %20 Lod %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureLoad_1f2016 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %33 = OpLabel - %34 = OpFunctionCall %void %textureLoad_1f2016 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %36 = OpLabel - %37 = OpFunctionCall %void %textureLoad_1f2016 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.wgsl deleted file mode 100644 index 910f641da9..0000000000 --- a/test/tint/builtins/gen/textureLoad/1f2016.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureLoad_1f2016() { - var res : vec4 = textureLoad(arg_0, vec3(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_1f2016(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_1f2016(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_1f2016(); -} diff --git a/test/tint/builtins/gen/textureLoad/484344.wgsl b/test/tint/builtins/gen/textureLoad/484344.wgsl deleted file mode 100644 index 498efdae0a..0000000000 --- a/test/tint/builtins/gen/textureLoad/484344.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 -fn textureLoad_484344() { - var res: vec4 = textureLoad(arg_0, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_484344(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_484344(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_484344(); -} diff --git a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.glsl deleted file mode 100644 index e1520a5a8a..0000000000 --- a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureLoad_484344() { - vec4 res = texelFetch(arg_0_1, ivec2(0, 0), 0); -} - -vec4 vertex_main() { - textureLoad_484344(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_1; -void textureLoad_484344() { - vec4 res = texelFetch(arg_0_1, ivec2(0, 0), 0); -} - -void fragment_main() { - textureLoad_484344(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureLoad_484344() { - vec4 res = texelFetch(arg_0_1, ivec2(0, 0), 0); -} - -void compute_main() { - textureLoad_484344(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.hlsl deleted file mode 100644 index 58e8d61403..0000000000 --- a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureLoad_484344() { - float4 res = arg_0.Load(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_484344(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_484344(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_484344(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.msl deleted file mode 100644 index b1ffb1da8a..0000000000 --- a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_484344(texture2d tint_symbol_1) { - float4 res = tint_symbol_1.read(uint2(int2()), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureLoad_484344(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureLoad_484344(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureLoad_484344(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.spvasm deleted file mode 100644 index 5bf420135e..0000000000 --- a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.spvasm +++ /dev/null @@ -1,75 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_484344 "textureLoad_484344" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %20 = OpConstantNull %v2int - %int_0 = OpConstant %int 0 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %24 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_484344 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %17 = OpLoad %11 %arg_0 - %16 = OpImageFetch %v4float %17 %20 Lod %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %textureLoad_484344 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %33 = OpLabel - %34 = OpFunctionCall %void %textureLoad_484344 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %36 = OpLabel - %37 = OpFunctionCall %void %textureLoad_484344 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.wgsl deleted file mode 100644 index e87d195f49..0000000000 --- a/test/tint/builtins/gen/textureLoad/484344.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureLoad_484344() { - var res : vec4 = textureLoad(arg_0, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_484344(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_484344(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_484344(); -} diff --git a/test/tint/builtins/gen/textureLoad/4fd803.wgsl b/test/tint/builtins/gen/textureLoad/4fd803.wgsl deleted file mode 100644 index 9d60c2526e..0000000000 --- a/test/tint/builtins/gen/textureLoad/4fd803.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 -fn textureLoad_4fd803() { - var res: vec4 = textureLoad(arg_0, vec3(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_4fd803(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_4fd803(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_4fd803(); -} diff --git a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.glsl deleted file mode 100644 index eb3f98fe5f..0000000000 --- a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler3D arg_0_1; -void textureLoad_4fd803() { - ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 0), 0); -} - -vec4 vertex_main() { - textureLoad_4fd803(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler3D arg_0_1; -void textureLoad_4fd803() { - ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 0), 0); -} - -void fragment_main() { - textureLoad_4fd803(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler3D arg_0_1; -void textureLoad_4fd803() { - ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 0), 0); -} - -void compute_main() { - textureLoad_4fd803(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.hlsl deleted file mode 100644 index 02e3104efb..0000000000 --- a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureLoad_4fd803() { - int4 res = arg_0.Load(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_4fd803(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_4fd803(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_4fd803(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.msl deleted file mode 100644 index ccfeb6a46b..0000000000 --- a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_4fd803(texture3d tint_symbol_1) { - int4 res = tint_symbol_1.read(uint3(int3()), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureLoad_4fd803(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureLoad_4fd803(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureLoad_4fd803(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.spvasm deleted file mode 100644 index dae2d0c5fc..0000000000 --- a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.spvasm +++ /dev/null @@ -1,77 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_4fd803 "textureLoad_4fd803" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %v3int = OpTypeVector %int 3 - %21 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %25 = OpConstantNull %v4int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_4fd803 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %25 - %19 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4int %19 %21 Lod %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureLoad_4fd803 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %35 = OpLabel - %36 = OpFunctionCall %void %textureLoad_4fd803 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %38 = OpLabel - %39 = OpFunctionCall %void %textureLoad_4fd803 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.wgsl deleted file mode 100644 index c4f10d680a..0000000000 --- a/test/tint/builtins/gen/textureLoad/4fd803.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureLoad_4fd803() { - var res : vec4 = textureLoad(arg_0, vec3(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_4fd803(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_4fd803(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_4fd803(); -} diff --git a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl b/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl deleted file mode 100644 index 1f1e1e1f12..0000000000 --- a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 -fn textureLoad_5a2f9d() { - var res: vec4 = textureLoad(arg_0, 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_5a2f9d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_5a2f9d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_5a2f9d(); -} diff --git a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.glsl deleted file mode 100644 index 457ddc9b6f..0000000000 --- a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isampler1D arg_0_1; -void textureLoad_5a2f9d() { - ivec4 res = texelFetch(arg_0_1, 1, 0); -} - -vec4 vertex_main() { - textureLoad_5a2f9d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isampler1D arg_0_1; -void textureLoad_5a2f9d() { - ivec4 res = texelFetch(arg_0_1, 1, 0); -} - -void fragment_main() { - textureLoad_5a2f9d(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isampler1D arg_0_1; -void textureLoad_5a2f9d() { - ivec4 res = texelFetch(arg_0_1, 1, 0); -} - -void compute_main() { - textureLoad_5a2f9d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.hlsl deleted file mode 100644 index a35e83e86c..0000000000 --- a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureLoad_5a2f9d() { - int4 res = arg_0.Load(int2(1, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_5a2f9d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_5a2f9d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_5a2f9d(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.msl deleted file mode 100644 index 54f52cfb82..0000000000 --- a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_5a2f9d(texture1d tint_symbol_1) { - int4 res = tint_symbol_1.read(uint(1), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureLoad_5a2f9d(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureLoad_5a2f9d(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureLoad_5a2f9d(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.spvasm deleted file mode 100644 index 3388593931..0000000000 --- a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.spvasm +++ /dev/null @@ -1,77 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 39 -; Schema: 0 - OpCapability Shader - OpCapability Sampled1D - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_5a2f9d "textureLoad_5a2f9d" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 1D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %24 = OpConstantNull %v4int - %25 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_5a2f9d = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %24 - %19 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4int %19 %int_1 Lod %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %25 - %27 = OpLabel - %28 = OpFunctionCall %void %textureLoad_5a2f9d - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %30 = OpLabel - %31 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %31 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %34 = OpLabel - %35 = OpFunctionCall %void %textureLoad_5a2f9d - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %37 = OpLabel - %38 = OpFunctionCall %void %textureLoad_5a2f9d - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.wgsl deleted file mode 100644 index 3e020592bf..0000000000 --- a/test/tint/builtins/gen/textureLoad/5a2f9d.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureLoad_5a2f9d() { - var res : vec4 = textureLoad(arg_0, 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_5a2f9d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_5a2f9d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_5a2f9d(); -} diff --git a/test/tint/builtins/gen/textureLoad/6154d4.wgsl b/test/tint/builtins/gen/textureLoad/6154d4.wgsl deleted file mode 100644 index 6078b2d2ad..0000000000 --- a/test/tint/builtins/gen/textureLoad/6154d4.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 -fn textureLoad_6154d4() { - var res: vec4 = textureLoad(arg_0, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_6154d4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_6154d4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_6154d4(); -} diff --git a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.glsl deleted file mode 100644 index 82a8da9315..0000000000 --- a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler2D arg_0_1; -void textureLoad_6154d4() { - uvec4 res = texelFetch(arg_0_1, ivec2(0, 0), 0); -} - -vec4 vertex_main() { - textureLoad_6154d4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2D arg_0_1; -void textureLoad_6154d4() { - uvec4 res = texelFetch(arg_0_1, ivec2(0, 0), 0); -} - -void fragment_main() { - textureLoad_6154d4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2D arg_0_1; -void textureLoad_6154d4() { - uvec4 res = texelFetch(arg_0_1, ivec2(0, 0), 0); -} - -void compute_main() { - textureLoad_6154d4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.hlsl deleted file mode 100644 index 1230e783ee..0000000000 --- a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureLoad_6154d4() { - uint4 res = arg_0.Load(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_6154d4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_6154d4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_6154d4(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.msl deleted file mode 100644 index a542c124a6..0000000000 --- a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_6154d4(texture2d tint_symbol_1) { - uint4 res = tint_symbol_1.read(uint2(int2()), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureLoad_6154d4(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureLoad_6154d4(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureLoad_6154d4(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.spvasm deleted file mode 100644 index 579e1d96cd..0000000000 --- a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.spvasm +++ /dev/null @@ -1,78 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 41 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_6154d4 "textureLoad_6154d4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %22 = OpConstantNull %v2int - %int_0 = OpConstant %int 0 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %26 = OpConstantNull %v4uint - %27 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_6154d4 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %26 - %19 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4uint %19 %22 Lod %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %27 - %29 = OpLabel - %30 = OpFunctionCall %void %textureLoad_6154d4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %32 = OpLabel - %33 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %33 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %36 = OpLabel - %37 = OpFunctionCall %void %textureLoad_6154d4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %39 = OpLabel - %40 = OpFunctionCall %void %textureLoad_6154d4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.wgsl deleted file mode 100644 index 811bfc69ca..0000000000 --- a/test/tint/builtins/gen/textureLoad/6154d4.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureLoad_6154d4() { - var res : vec4 = textureLoad(arg_0, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_6154d4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_6154d4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_6154d4(); -} diff --git a/test/tint/builtins/gen/textureLoad/6273b1.wgsl b/test/tint/builtins/gen/textureLoad/6273b1.wgsl deleted file mode 100644 index 0bc163feb2..0000000000 --- a/test/tint/builtins/gen/textureLoad/6273b1.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; - -// fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2, sample_index: i32) -> f32 -fn textureLoad_6273b1() { - var res: f32 = textureLoad(arg_0, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_6273b1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_6273b1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_6273b1(); -} diff --git a/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.glsl deleted file mode 100644 index e987373d38..0000000000 --- a/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureLoad_6273b1() { - float res = texelFetch(arg_0_1, ivec2(0, 0), 1).x; -} - -vec4 vertex_main() { - textureLoad_6273b1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DMS arg_0_1; -void textureLoad_6273b1() { - float res = texelFetch(arg_0_1, ivec2(0, 0), 1).x; -} - -void fragment_main() { - textureLoad_6273b1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureLoad_6273b1() { - float res = texelFetch(arg_0_1, ivec2(0, 0), 1).x; -} - -void compute_main() { - textureLoad_6273b1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.hlsl deleted file mode 100644 index 61d263e8c1..0000000000 --- a/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureLoad_6273b1() { - float res = arg_0.Load(int3(0, 0, 0), 1).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_6273b1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_6273b1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_6273b1(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.msl deleted file mode 100644 index 8dfd72b2d6..0000000000 --- a/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_6273b1(depth2d_ms tint_symbol_1) { - float res = tint_symbol_1.read(uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_ms tint_symbol_2) { - textureLoad_6273b1(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { - textureLoad_6273b1(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { - textureLoad_6273b1(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.wgsl deleted file mode 100644 index ec3f25bde9..0000000000 --- a/test/tint/builtins/gen/textureLoad/6273b1.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; - -fn textureLoad_6273b1() { - var res : f32 = textureLoad(arg_0, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_6273b1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_6273b1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_6273b1(); -} diff --git a/test/tint/builtins/gen/textureLoad/79e697.wgsl b/test/tint/builtins/gen/textureLoad/79e697.wgsl deleted file mode 100644 index 195a489083..0000000000 --- a/test/tint/builtins/gen/textureLoad/79e697.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 -fn textureLoad_79e697() { - var res: vec4 = textureLoad(arg_0, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_79e697(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_79e697(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_79e697(); -} diff --git a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.glsl deleted file mode 100644 index 328bef181f..0000000000 --- a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureLoad_79e697() { - ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); -} - -vec4 vertex_main() { - textureLoad_79e697(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DArray arg_0_1; -void textureLoad_79e697() { - ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); -} - -void fragment_main() { - textureLoad_79e697(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureLoad_79e697() { - ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); -} - -void compute_main() { - textureLoad_79e697(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.hlsl deleted file mode 100644 index 9995b1e727..0000000000 --- a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureLoad_79e697() { - int4 res = arg_0.Load(int4(0, 0, 1, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_79e697(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_79e697(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_79e697(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.msl deleted file mode 100644 index 4e4cacf963..0000000000 --- a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_79e697(texture2d_array tint_symbol_1) { - int4 res = tint_symbol_1.read(uint2(int2()), 1, 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureLoad_79e697(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureLoad_79e697(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureLoad_79e697(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.spvasm deleted file mode 100644 index 9ea6971c4e..0000000000 --- a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.spvasm +++ /dev/null @@ -1,78 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 41 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_79e697 "textureLoad_79e697" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 - %int_1 = OpConstant %int 1 - %23 = OpConstantComposite %v3int %int_0 %int_0 %int_1 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %26 = OpConstantNull %v4int - %27 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_79e697 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %26 - %19 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4int %19 %23 Lod %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %27 - %29 = OpLabel - %30 = OpFunctionCall %void %textureLoad_79e697 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %32 = OpLabel - %33 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %33 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %36 = OpLabel - %37 = OpFunctionCall %void %textureLoad_79e697 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %39 = OpLabel - %40 = OpFunctionCall %void %textureLoad_79e697 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.wgsl deleted file mode 100644 index 3e269171cd..0000000000 --- a/test/tint/builtins/gen/textureLoad/79e697.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureLoad_79e697() { - var res : vec4 = textureLoad(arg_0, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_79e697(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_79e697(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_79e697(); -} diff --git a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl b/test/tint/builtins/gen/textureLoad/7c90e5.wgsl deleted file mode 100644 index 231d9c5791..0000000000 --- a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 -fn textureLoad_7c90e5() { - var res: vec4 = textureLoad(arg_0, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_7c90e5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_7c90e5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_7c90e5(); -} diff --git a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.glsl deleted file mode 100644 index a2eda0cbb7..0000000000 --- a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureLoad_7c90e5() { - uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); -} - -vec4 vertex_main() { - textureLoad_7c90e5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DArray arg_0_1; -void textureLoad_7c90e5() { - uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); -} - -void fragment_main() { - textureLoad_7c90e5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureLoad_7c90e5() { - uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); -} - -void compute_main() { - textureLoad_7c90e5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.hlsl deleted file mode 100644 index eeb32ec9ec..0000000000 --- a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureLoad_7c90e5() { - uint4 res = arg_0.Load(int4(0, 0, 1, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_7c90e5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_7c90e5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_7c90e5(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.msl deleted file mode 100644 index a2b782a088..0000000000 --- a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_7c90e5(texture2d_array tint_symbol_1) { - uint4 res = tint_symbol_1.read(uint2(int2()), 1, 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureLoad_7c90e5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureLoad_7c90e5(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureLoad_7c90e5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.spvasm deleted file mode 100644 index 72245acf47..0000000000 --- a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.spvasm +++ /dev/null @@ -1,79 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 42 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_7c90e5 "textureLoad_7c90e5" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 - %int_1 = OpConstant %int 1 - %24 = OpConstantComposite %v3int %int_0 %int_0 %int_1 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %27 = OpConstantNull %v4uint - %28 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_7c90e5 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %27 - %19 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4uint %19 %24 Lod %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %28 - %30 = OpLabel - %31 = OpFunctionCall %void %textureLoad_7c90e5 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %33 = OpLabel - %34 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %34 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %37 = OpLabel - %38 = OpFunctionCall %void %textureLoad_7c90e5 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %40 = OpLabel - %41 = OpFunctionCall %void %textureLoad_7c90e5 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.wgsl deleted file mode 100644 index 3308f0f6c1..0000000000 --- a/test/tint/builtins/gen/textureLoad/7c90e5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureLoad_7c90e5() { - var res : vec4 = textureLoad(arg_0, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_7c90e5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_7c90e5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_7c90e5(); -} diff --git a/test/tint/builtins/gen/textureLoad/81c381.wgsl b/test/tint/builtins/gen/textureLoad/81c381.wgsl deleted file mode 100644 index b68c0ded8e..0000000000 --- a/test/tint/builtins/gen/textureLoad/81c381.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 -fn textureLoad_81c381() { - var res: vec4 = textureLoad(arg_0, 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_81c381(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_81c381(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_81c381(); -} diff --git a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.glsl deleted file mode 100644 index e18d7c3608..0000000000 --- a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler1D arg_0_1; -void textureLoad_81c381() { - vec4 res = texelFetch(arg_0_1, 1, 0); -} - -vec4 vertex_main() { - textureLoad_81c381(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'sampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler1D arg_0_1; -void textureLoad_81c381() { - vec4 res = texelFetch(arg_0_1, 1, 0); -} - -void fragment_main() { - textureLoad_81c381(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'sampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler1D arg_0_1; -void textureLoad_81c381() { - vec4 res = texelFetch(arg_0_1, 1, 0); -} - -void compute_main() { - textureLoad_81c381(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'sampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.hlsl deleted file mode 100644 index 7d692a0821..0000000000 --- a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureLoad_81c381() { - float4 res = arg_0.Load(int2(1, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_81c381(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_81c381(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_81c381(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.msl deleted file mode 100644 index d2fd8d08f0..0000000000 --- a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_81c381(texture1d tint_symbol_1) { - float4 res = tint_symbol_1.read(uint(1), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureLoad_81c381(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureLoad_81c381(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureLoad_81c381(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.spvasm deleted file mode 100644 index 87aa1c5ce9..0000000000 --- a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.spvasm +++ /dev/null @@ -1,75 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 37 -; Schema: 0 - OpCapability Shader - OpCapability Sampled1D - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_81c381 "textureLoad_81c381" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 1D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %23 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_81c381 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %17 = OpLoad %11 %arg_0 - %16 = OpImageFetch %v4float %17 %int_1 Lod %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %textureLoad_81c381 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %32 = OpLabel - %33 = OpFunctionCall %void %textureLoad_81c381 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %35 = OpLabel - %36 = OpFunctionCall %void %textureLoad_81c381 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.wgsl deleted file mode 100644 index 7671a385e0..0000000000 --- a/test/tint/builtins/gen/textureLoad/81c381.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureLoad_81c381() { - var res : vec4 = textureLoad(arg_0, 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_81c381(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_81c381(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_81c381(); -} diff --git a/test/tint/builtins/gen/textureLoad/87be85.wgsl b/test/tint/builtins/gen/textureLoad/87be85.wgsl deleted file mode 100644 index 1440343b4a..0000000000 --- a/test/tint/builtins/gen/textureLoad/87be85.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 -fn textureLoad_87be85() { - var res: vec4 = textureLoad(arg_0, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_87be85(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_87be85(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_87be85(); -} diff --git a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.glsl deleted file mode 100644 index 1670fc9282..0000000000 --- a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureLoad_87be85() { - vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); -} - -vec4 vertex_main() { - textureLoad_87be85(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureLoad_87be85() { - vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); -} - -void fragment_main() { - textureLoad_87be85(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureLoad_87be85() { - vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0); -} - -void compute_main() { - textureLoad_87be85(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.hlsl deleted file mode 100644 index 51b24d44e4..0000000000 --- a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureLoad_87be85() { - float4 res = arg_0.Load(int4(0, 0, 1, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_87be85(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_87be85(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_87be85(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.msl deleted file mode 100644 index c8337af61e..0000000000 --- a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_87be85(texture2d_array tint_symbol_1) { - float4 res = tint_symbol_1.read(uint2(int2()), 1, 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureLoad_87be85(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureLoad_87be85(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureLoad_87be85(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.spvasm deleted file mode 100644 index c8c2895822..0000000000 --- a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.spvasm +++ /dev/null @@ -1,76 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 39 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_87be85 "textureLoad_87be85" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 - %int_1 = OpConstant %int 1 - %22 = OpConstantComposite %v3int %int_0 %int_0 %int_1 -%_ptr_Function_v4float = OpTypePointer Function %v4float - %25 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_87be85 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %17 = OpLoad %11 %arg_0 - %16 = OpImageFetch %v4float %17 %22 Lod %int_0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %25 - %27 = OpLabel - %28 = OpFunctionCall %void %textureLoad_87be85 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %30 = OpLabel - %31 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %31 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %34 = OpLabel - %35 = OpFunctionCall %void %textureLoad_87be85 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %37 = OpLabel - %38 = OpFunctionCall %void %textureLoad_87be85 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.wgsl deleted file mode 100644 index febe014343..0000000000 --- a/test/tint/builtins/gen/textureLoad/87be85.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureLoad_87be85() { - var res : vec4 = textureLoad(arg_0, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_87be85(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_87be85(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_87be85(); -} diff --git a/test/tint/builtins/gen/textureLoad/8acf41.wgsl b/test/tint/builtins/gen/textureLoad/8acf41.wgsl deleted file mode 100644 index 25aff6cce5..0000000000 --- a/test/tint/builtins/gen/textureLoad/8acf41.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_external; - -// fn textureLoad(texture: texture_external, coords: vec2) -> vec4 -fn textureLoad_8acf41() { - var res: vec4 = textureLoad(arg_0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_8acf41(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_8acf41(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_8acf41(); -} diff --git a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.glsl deleted file mode 100644 index db3cd70a3f..0000000000 --- a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.glsl +++ /dev/null @@ -1,171 +0,0 @@ -SKIP: FAILED - -#version 310 es - -struct ExternalTextureParams { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -}; - -layout(binding = 2) uniform ExternalTextureParams_1 { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -} ext_tex_params; - -vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { - if ((params.numPlanes == 1u)) { - return texelFetch(plane0_1, coord, 0); - } - float y = (texelFetch(plane0_1, coord, 0).r - 0.0625f); - vec2 uv = (texelFetch(plane1_1, coord, 0).rg - 0.5f); - float u = uv.x; - float v = uv.y; - float r = ((1.164000034f * y) + (params.vr * v)); - float g = (((1.164000034f * y) - (params.ug * u)) - (params.vg * v)); - float b = ((1.164000034f * y) + (params.ub * u)); - return vec4(r, g, b, 1.0f); -} - -uniform highp sampler2D arg_0_1; -uniform highp sampler2D ext_tex_plane_1_1; -void textureLoad_8acf41() { - vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, ivec2(0, 0), ext_tex_params); -} - -vec4 vertex_main() { - textureLoad_8acf41(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:36: 'textureLoadExternal' : no matching overloaded function found -ERROR: 0:36: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' -ERROR: 0:36: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -struct ExternalTextureParams { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -}; - -layout(binding = 2) uniform ExternalTextureParams_1 { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -} ext_tex_params; - -vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { - if ((params.numPlanes == 1u)) { - return texelFetch(plane0_1, coord, 0); - } - float y = (texelFetch(plane0_1, coord, 0).r - 0.0625f); - vec2 uv = (texelFetch(plane1_1, coord, 0).rg - 0.5f); - float u = uv.x; - float v = uv.y; - float r = ((1.164000034f * y) + (params.vr * v)); - float g = (((1.164000034f * y) - (params.ug * u)) - (params.vg * v)); - float b = ((1.164000034f * y) + (params.ub * u)); - return vec4(r, g, b, 1.0f); -} - -uniform highp sampler2D arg_0_1; -uniform highp sampler2D ext_tex_plane_1_1; -void textureLoad_8acf41() { - vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, ivec2(0, 0), ext_tex_params); -} - -void fragment_main() { - textureLoad_8acf41(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:37: 'textureLoadExternal' : no matching overloaded function found -ERROR: 0:37: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' -ERROR: 0:37: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -struct ExternalTextureParams { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -}; - -layout(binding = 2) uniform ExternalTextureParams_1 { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -} ext_tex_params; - -vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { - if ((params.numPlanes == 1u)) { - return texelFetch(plane0_1, coord, 0); - } - float y = (texelFetch(plane0_1, coord, 0).r - 0.0625f); - vec2 uv = (texelFetch(plane1_1, coord, 0).rg - 0.5f); - float u = uv.x; - float v = uv.y; - float r = ((1.164000034f * y) + (params.vr * v)); - float g = (((1.164000034f * y) - (params.ug * u)) - (params.vg * v)); - float b = ((1.164000034f * y) + (params.ub * u)); - return vec4(r, g, b, 1.0f); -} - -uniform highp sampler2D arg_0_1; -uniform highp sampler2D ext_tex_plane_1_1; -void textureLoad_8acf41() { - vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, ivec2(0, 0), ext_tex_params); -} - -void compute_main() { - textureLoad_8acf41(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:36: 'textureLoadExternal' : no matching overloaded function found -ERROR: 0:36: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' -ERROR: 0:36: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.hlsl deleted file mode 100644 index d48102670c..0000000000 --- a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.hlsl +++ /dev/null @@ -1,107 +0,0 @@ -struct GammaTransferParams { - float G; - float A; - float B; - float C; - float D; - float E; - float F; - uint padding; -}; -struct ExternalTextureParams { - uint numPlanes; - float3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - float3x3 gamutConversionMatrix; -}; - -Texture2D ext_tex_plane_1 : register(t1, space1); -cbuffer cbuffer_ext_tex_params : register(b2, space1) { - uint4 ext_tex_params[11]; -}; -Texture2D arg_0 : register(t0, space1); - -float3 gammaCorrection(float3 v, GammaTransferParams params) { - const bool3 cond = (abs(v) < float3((params.D).xxx)); - const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); - const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); - return (cond ? t : f); -} - -float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, int2 coord, ExternalTextureParams params) { - float3 color = float3(0.0f, 0.0f, 0.0f); - if ((params.numPlanes == 1u)) { - color = plane0.Load(int3(coord, 0)).rgb; - } else { - color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); - } - color = gammaCorrection(color, params.gammaDecodeParams); - color = mul(color, params.gamutConversionMatrix); - color = gammaCorrection(color, params.gammaEncodeParams); - return float4(color, 1.0f); -} - -float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { - const uint scalar_offset = ((offset + 0u)) / 4; - const uint scalar_offset_1 = ((offset + 16u)) / 4; - const uint scalar_offset_2 = ((offset + 32u)) / 4; - return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); -} - -GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { - const uint scalar_offset_3 = ((offset + 0u)) / 4; - const uint scalar_offset_4 = ((offset + 4u)) / 4; - const uint scalar_offset_5 = ((offset + 8u)) / 4; - const uint scalar_offset_6 = ((offset + 12u)) / 4; - const uint scalar_offset_7 = ((offset + 16u)) / 4; - const uint scalar_offset_8 = ((offset + 20u)) / 4; - const uint scalar_offset_9 = ((offset + 24u)) / 4; - const uint scalar_offset_10 = ((offset + 28u)) / 4; - const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; - return tint_symbol_9; -} - -float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { - const uint scalar_offset_11 = ((offset + 0u)) / 4; - const uint scalar_offset_12 = ((offset + 16u)) / 4; - const uint scalar_offset_13 = ((offset + 32u)) / 4; - return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); -} - -ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { - const uint scalar_offset_14 = ((offset + 0u)) / 4; - const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; - return tint_symbol_10; -} - -void textureLoad_8acf41() { - float4 res = textureLoadExternal(arg_0, ext_tex_plane_1, int2(0, 0), tint_symbol_1(ext_tex_params, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_8acf41(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_8acf41(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_8acf41(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.msl deleted file mode 100644 index d7ae7960ef..0000000000 --- a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.msl +++ /dev/null @@ -1,73 +0,0 @@ -#include - -using namespace metal; -struct GammaTransferParams { - /* 0x0000 */ float G; - /* 0x0004 */ float A; - /* 0x0008 */ float B; - /* 0x000c */ float C; - /* 0x0010 */ float D; - /* 0x0014 */ float E; - /* 0x0018 */ float F; - /* 0x001c */ uint padding; -}; - -struct ExternalTextureParams { - /* 0x0000 */ uint numPlanes; - /* 0x0004 */ int8_t tint_pad[12]; - /* 0x0010 */ float3x4 yuvToRgbConversionMatrix; - /* 0x0040 */ GammaTransferParams gammaDecodeParams; - /* 0x0060 */ GammaTransferParams gammaEncodeParams; - /* 0x0080 */ float3x3 gamutConversionMatrix; -}; - -float3 gammaCorrection(float3 v, GammaTransferParams params) { - bool3 const cond = (fabs(v) < float3(params.D)); - float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F)); - float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E)); - return select(f, t, cond); -} - -float4 textureLoadExternal(texture2d plane0, texture2d plane1, int2 coord, ExternalTextureParams params) { - float3 color = 0.0f; - if ((params.numPlanes == 1u)) { - color = float4(plane0.read(uint2(coord), 0)).rgb; - } else { - color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); - } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return float4(color, 1.0f); -} - -void textureLoad_8acf41(texture2d tint_symbol_1, texture2d tint_symbol_2, const constant ExternalTextureParams* const tint_symbol_3) { - float4 res = textureLoadExternal(tint_symbol_1, tint_symbol_2, int2(), *(tint_symbol_3)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_4, texture2d tint_symbol_5, const constant ExternalTextureParams* const tint_symbol_6) { - textureLoad_8acf41(tint_symbol_4, tint_symbol_5, tint_symbol_6); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_7 [[texture(0)]], texture2d tint_symbol_8 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_9 [[buffer(2)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_7, tint_symbol_8, tint_symbol_9); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_10 [[texture(0)]], texture2d tint_symbol_11 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) { - textureLoad_8acf41(tint_symbol_10, tint_symbol_11, tint_symbol_12); - return; -} - -kernel void compute_main(texture2d tint_symbol_13 [[texture(0)]], texture2d tint_symbol_14 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_15 [[buffer(2)]]) { - textureLoad_8acf41(tint_symbol_13, tint_symbol_14, tint_symbol_15); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.spvasm deleted file mode 100644 index 950b97350a..0000000000 --- a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.spvasm +++ /dev/null @@ -1,228 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 129 -; Schema: 0 - OpCapability Shader - %27 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %ext_tex_plane_1 "ext_tex_plane_1" - OpName %ExternalTextureParams "ExternalTextureParams" - OpMemberName %ExternalTextureParams 0 "numPlanes" - OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix" - OpMemberName %ExternalTextureParams 2 "gammaDecodeParams" - OpName %GammaTransferParams "GammaTransferParams" - OpMemberName %GammaTransferParams 0 "G" - OpMemberName %GammaTransferParams 1 "A" - OpMemberName %GammaTransferParams 2 "B" - OpMemberName %GammaTransferParams 3 "C" - OpMemberName %GammaTransferParams 4 "D" - OpMemberName %GammaTransferParams 5 "E" - OpMemberName %GammaTransferParams 6 "F" - OpMemberName %GammaTransferParams 7 "padding" - OpMemberName %ExternalTextureParams 3 "gammaEncodeParams" - OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix" - OpName %ext_tex_params "ext_tex_params" - OpName %arg_0 "arg_0" - OpName %gammaCorrection "gammaCorrection" - OpName %v "v" - OpName %params "params" - OpName %textureLoadExternal "textureLoadExternal" - OpName %plane0 "plane0" - OpName %plane1 "plane1" - OpName %coord "coord" - OpName %params_0 "params" - OpName %color "color" - OpName %textureLoad_8acf41 "textureLoad_8acf41" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %ext_tex_plane_1 DescriptorSet 1 - OpDecorate %ext_tex_plane_1 Binding 1 - OpDecorate %ExternalTextureParams Block - OpMemberDecorate %ExternalTextureParams 0 Offset 0 - OpMemberDecorate %ExternalTextureParams 1 Offset 16 - OpMemberDecorate %ExternalTextureParams 1 ColMajor - OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16 - OpMemberDecorate %ExternalTextureParams 2 Offset 64 - OpMemberDecorate %GammaTransferParams 0 Offset 0 - OpMemberDecorate %GammaTransferParams 1 Offset 4 - OpMemberDecorate %GammaTransferParams 2 Offset 8 - OpMemberDecorate %GammaTransferParams 3 Offset 12 - OpMemberDecorate %GammaTransferParams 4 Offset 16 - OpMemberDecorate %GammaTransferParams 5 Offset 20 - OpMemberDecorate %GammaTransferParams 6 Offset 24 - OpMemberDecorate %GammaTransferParams 7 Offset 28 - OpMemberDecorate %ExternalTextureParams 3 Offset 96 - OpMemberDecorate %ExternalTextureParams 4 Offset 128 - OpMemberDecorate %ExternalTextureParams 4 ColMajor - OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16 - OpDecorate %ext_tex_params NonWritable - OpDecorate %ext_tex_params DescriptorSet 1 - OpDecorate %ext_tex_params Binding 2 - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 -%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %uint = OpTypeInt 32 0 -%mat3v4float = OpTypeMatrix %v4float 3 -%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint - %v3float = OpTypeVector %float 3 -%mat3v3float = OpTypeMatrix %v3float 3 -%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float -%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams -%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %21 = OpTypeFunction %v3float %v3float %GammaTransferParams - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 -%_ptr_Function_v3float = OpTypePointer Function %v3float - %41 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %61 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams - %uint_1 = OpConstant %uint 1 - %int_0 = OpConstant %int 0 - %v2float = OpTypeVector %float 2 - %float_1 = OpConstant %float 1 - %void = OpTypeVoid - %105 = OpTypeFunction %void - %112 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %116 = OpTypeFunction %v4float -%gammaCorrection = OpFunction %v3float None %21 - %v = OpFunctionParameter %v3float - %params = OpFunctionParameter %GammaTransferParams - %25 = OpLabel - %39 = OpVariable %_ptr_Function_v3float Function %41 - %51 = OpVariable %_ptr_Function_v3float Function %41 - %57 = OpVariable %_ptr_Function_v3float Function %41 - %26 = OpExtInst %v3float %27 FAbs %v - %28 = OpCompositeExtract %float %params 4 - %29 = OpCompositeConstruct %v3float %28 %28 %28 - %30 = OpFOrdLessThan %v3bool %26 %29 - %33 = OpExtInst %v3float %27 FSign %v - %34 = OpCompositeExtract %float %params 3 - %35 = OpExtInst %v3float %27 FAbs %v - %36 = OpVectorTimesScalar %v3float %35 %34 - %37 = OpCompositeExtract %float %params 6 - %42 = OpCompositeConstruct %v3float %37 %37 %37 - %38 = OpFAdd %v3float %36 %42 - %43 = OpFMul %v3float %33 %38 - %44 = OpExtInst %v3float %27 FSign %v - %46 = OpCompositeExtract %float %params 1 - %47 = OpExtInst %v3float %27 FAbs %v - %48 = OpVectorTimesScalar %v3float %47 %46 - %49 = OpCompositeExtract %float %params 2 - %52 = OpCompositeConstruct %v3float %49 %49 %49 - %50 = OpFAdd %v3float %48 %52 - %53 = OpCompositeExtract %float %params 0 - %54 = OpCompositeConstruct %v3float %53 %53 %53 - %45 = OpExtInst %v3float %27 Pow %50 %54 - %55 = OpCompositeExtract %float %params 5 - %58 = OpCompositeConstruct %v3float %55 %55 %55 - %56 = OpFAdd %v3float %45 %58 - %59 = OpFMul %v3float %44 %56 - %60 = OpSelect %v3float %30 %43 %59 - OpReturnValue %60 - OpFunctionEnd -%textureLoadExternal = OpFunction %v4float None %61 - %plane0 = OpFunctionParameter %11 - %plane1 = OpFunctionParameter %11 - %coord = OpFunctionParameter %v2int - %params_0 = OpFunctionParameter %ExternalTextureParams - %69 = OpLabel - %color = OpVariable %_ptr_Function_v3float Function %41 - %71 = OpCompositeExtract %uint %params_0 0 - %73 = OpIEqual %bool %71 %uint_1 - OpSelectionMerge %74 None - OpBranchConditional %73 %75 %76 - %75 = OpLabel - %77 = OpImageFetch %v4float %plane0 %coord Lod %int_0 - %79 = OpVectorShuffle %v3float %77 %77 0 1 2 - OpStore %color %79 - OpBranch %74 - %76 = OpLabel - %80 = OpImageFetch %v4float %plane0 %coord Lod %int_0 - %81 = OpCompositeExtract %float %80 0 - %82 = OpImageFetch %v4float %plane1 %coord Lod %int_0 - %84 = OpVectorShuffle %v2float %82 %82 0 1 - %85 = OpCompositeExtract %float %84 0 - %86 = OpCompositeExtract %float %84 1 - %88 = OpCompositeConstruct %v4float %81 %85 %86 %float_1 - %89 = OpCompositeExtract %mat3v4float %params_0 1 - %90 = OpVectorTimesMatrix %v3float %88 %89 - OpStore %color %90 - OpBranch %74 - %74 = OpLabel - %92 = OpLoad %v3float %color - %93 = OpCompositeExtract %GammaTransferParams %params_0 2 - %91 = OpFunctionCall %v3float %gammaCorrection %92 %93 - OpStore %color %91 - %94 = OpCompositeExtract %mat3v3float %params_0 4 - %95 = OpLoad %v3float %color - %96 = OpMatrixTimesVector %v3float %94 %95 - OpStore %color %96 - %98 = OpLoad %v3float %color - %99 = OpCompositeExtract %GammaTransferParams %params_0 3 - %97 = OpFunctionCall %v3float %gammaCorrection %98 %99 - OpStore %color %97 - %100 = OpLoad %v3float %color - %101 = OpCompositeExtract %float %100 0 - %102 = OpCompositeExtract %float %100 1 - %103 = OpCompositeExtract %float %100 2 - %104 = OpCompositeConstruct %v4float %101 %102 %103 %float_1 - OpReturnValue %104 - OpFunctionEnd -%textureLoad_8acf41 = OpFunction %void None %105 - %108 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %110 = OpLoad %11 %arg_0 - %111 = OpLoad %11 %ext_tex_plane_1 - %113 = OpLoad %ExternalTextureParams %ext_tex_params - %109 = OpFunctionCall %v4float %textureLoadExternal %110 %111 %112 %113 - OpStore %res %109 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %116 - %118 = OpLabel - %119 = OpFunctionCall %void %textureLoad_8acf41 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %105 - %121 = OpLabel - %122 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %122 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %105 - %124 = OpLabel - %125 = OpFunctionCall %void %textureLoad_8acf41 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %105 - %127 = OpLabel - %128 = OpFunctionCall %void %textureLoad_8acf41 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.wgsl deleted file mode 100644 index a25ef5f1a1..0000000000 --- a/test/tint/builtins/gen/textureLoad/8acf41.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_external; - -fn textureLoad_8acf41() { - var res : vec4 = textureLoad(arg_0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_8acf41(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_8acf41(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_8acf41(); -} diff --git a/test/tint/builtins/gen/textureLoad/9b2667.wgsl b/test/tint/builtins/gen/textureLoad/9b2667.wgsl deleted file mode 100644 index 73c2c3177c..0000000000 --- a/test/tint/builtins/gen/textureLoad/9b2667.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; - -// fn textureLoad(texture: texture_depth_2d_array, coords: vec2, array_index: i32, level: i32) -> f32 -fn textureLoad_9b2667() { - var res: f32 = textureLoad(arg_0, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_9b2667(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_9b2667(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_9b2667(); -} diff --git a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.glsl deleted file mode 100644 index 748aa2f8f1..0000000000 --- a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureLoad_9b2667() { - float res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0).x; -} - -vec4 vertex_main() { - textureLoad_9b2667(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureLoad_9b2667() { - float res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0).x; -} - -void fragment_main() { - textureLoad_9b2667(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureLoad_9b2667() { - float res = texelFetch(arg_0_1, ivec3(0, 0, 1), 0).x; -} - -void compute_main() { - textureLoad_9b2667(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.hlsl deleted file mode 100644 index ad15913b27..0000000000 --- a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureLoad_9b2667() { - float res = arg_0.Load(int4(0, 0, 1, 0)).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_9b2667(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_9b2667(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_9b2667(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.msl deleted file mode 100644 index 9faf689498..0000000000 --- a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_9b2667(depth2d_array tint_symbol_1) { - float res = tint_symbol_1.read(uint2(int2()), 1, 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_2) { - textureLoad_9b2667(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { - textureLoad_9b2667(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { - textureLoad_9b2667(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.spvasm deleted file mode 100644 index 891f9a441f..0000000000 --- a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.spvasm +++ /dev/null @@ -1,77 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_9b2667 "textureLoad_9b2667" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %12 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 - %int_1 = OpConstant %int 1 - %23 = OpConstantComposite %v3int %int_0 %int_0 %int_1 -%_ptr_Function_float = OpTypePointer Function %float - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_9b2667 = OpFunction %void None %12 - %15 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %18 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4float %18 %23 Lod %int_0 - %16 = OpCompositeExtract %float %17 0 - OpStore %res %16 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureLoad_9b2667 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %12 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %12 - %35 = OpLabel - %36 = OpFunctionCall %void %textureLoad_9b2667 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %12 - %38 = OpLabel - %39 = OpFunctionCall %void %textureLoad_9b2667 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.wgsl deleted file mode 100644 index 5d857d05c0..0000000000 --- a/test/tint/builtins/gen/textureLoad/9b2667.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -fn textureLoad_9b2667() { - var res : f32 = textureLoad(arg_0, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_9b2667(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_9b2667(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_9b2667(); -} diff --git a/test/tint/builtins/gen/textureLoad/a583c9.wgsl b/test/tint/builtins/gen/textureLoad/a583c9.wgsl deleted file mode 100644 index 9ed4ae7e07..0000000000 --- a/test/tint/builtins/gen/textureLoad/a583c9.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_multisampled_2d; - -// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 -fn textureLoad_a583c9() { - var res: vec4 = textureLoad(arg_0, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_a583c9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_a583c9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_a583c9(); -} diff --git a/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.glsl deleted file mode 100644 index d5d9ee01a4..0000000000 --- a/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureLoad_a583c9() { - vec4 res = texelFetch(arg_0_1, ivec2(0, 0), 1); -} - -vec4 vertex_main() { - textureLoad_a583c9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DMS arg_0_1; -void textureLoad_a583c9() { - vec4 res = texelFetch(arg_0_1, ivec2(0, 0), 1); -} - -void fragment_main() { - textureLoad_a583c9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureLoad_a583c9() { - vec4 res = texelFetch(arg_0_1, ivec2(0, 0), 1); -} - -void compute_main() { - textureLoad_a583c9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.hlsl deleted file mode 100644 index 41f3f98054..0000000000 --- a/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureLoad_a583c9() { - float4 res = arg_0.Load(int2(0, 0), 1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_a583c9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_a583c9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_a583c9(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.msl deleted file mode 100644 index 553f45eed8..0000000000 --- a/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_a583c9(texture2d_ms tint_symbol_1) { - float4 res = tint_symbol_1.read(uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_ms tint_symbol_2) { - textureLoad_a583c9(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { - textureLoad_a583c9(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { - textureLoad_a583c9(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.wgsl deleted file mode 100644 index 1b4fb0f27b..0000000000 --- a/test/tint/builtins/gen/textureLoad/a583c9.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_multisampled_2d; - -fn textureLoad_a583c9() { - var res : vec4 = textureLoad(arg_0, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_a583c9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_a583c9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_a583c9(); -} diff --git a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl b/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl deleted file mode 100644 index 095314d15d..0000000000 --- a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 -fn textureLoad_a9a9f5() { - var res: vec4 = textureLoad(arg_0, vec3(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_a9a9f5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_a9a9f5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_a9a9f5(); -} diff --git a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.glsl deleted file mode 100644 index 38e5cc8243..0000000000 --- a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler3D arg_0_1; -void textureLoad_a9a9f5() { - uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 0), 0); -} - -vec4 vertex_main() { - textureLoad_a9a9f5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler3D arg_0_1; -void textureLoad_a9a9f5() { - uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 0), 0); -} - -void fragment_main() { - textureLoad_a9a9f5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler3D arg_0_1; -void textureLoad_a9a9f5() { - uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 0), 0); -} - -void compute_main() { - textureLoad_a9a9f5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.hlsl deleted file mode 100644 index d5eb2c8d17..0000000000 --- a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureLoad_a9a9f5() { - uint4 res = arg_0.Load(int4(0, 0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_a9a9f5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_a9a9f5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_a9a9f5(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.msl deleted file mode 100644 index 1d87c99657..0000000000 --- a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_a9a9f5(texture3d tint_symbol_1) { - uint4 res = tint_symbol_1.read(uint3(int3()), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureLoad_a9a9f5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureLoad_a9a9f5(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureLoad_a9a9f5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.spvasm deleted file mode 100644 index f9c5c1f7e7..0000000000 --- a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.spvasm +++ /dev/null @@ -1,78 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 41 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_a9a9f5 "textureLoad_a9a9f5" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %uint = OpTypeInt 32 0 - %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v4uint = OpTypeVector %uint 4 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %22 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 -%_ptr_Function_v4uint = OpTypePointer Function %v4uint - %26 = OpConstantNull %v4uint - %27 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_a9a9f5 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v4uint Function %26 - %19 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4uint %19 %22 Lod %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %27 - %29 = OpLabel - %30 = OpFunctionCall %void %textureLoad_a9a9f5 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %32 = OpLabel - %33 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %33 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %36 = OpLabel - %37 = OpFunctionCall %void %textureLoad_a9a9f5 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %39 = OpLabel - %40 = OpFunctionCall %void %textureLoad_a9a9f5 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.wgsl deleted file mode 100644 index ac36fdc9d3..0000000000 --- a/test/tint/builtins/gen/textureLoad/a9a9f5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureLoad_a9a9f5() { - var res : vec4 = textureLoad(arg_0, vec3(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_a9a9f5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_a9a9f5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_a9a9f5(); -} diff --git a/test/tint/builtins/gen/textureLoad/c2a480.wgsl b/test/tint/builtins/gen/textureLoad/c2a480.wgsl deleted file mode 100644 index b3ebdccef4..0000000000 --- a/test/tint/builtins/gen/textureLoad/c2a480.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 -fn textureLoad_c2a480() { - var res: vec4 = textureLoad(arg_0, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_c2a480(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_c2a480(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_c2a480(); -} diff --git a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.glsl deleted file mode 100644 index 25909ecc0e..0000000000 --- a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler2D arg_0_1; -void textureLoad_c2a480() { - ivec4 res = texelFetch(arg_0_1, ivec2(0, 0), 0); -} - -vec4 vertex_main() { - textureLoad_c2a480(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2D arg_0_1; -void textureLoad_c2a480() { - ivec4 res = texelFetch(arg_0_1, ivec2(0, 0), 0); -} - -void fragment_main() { - textureLoad_c2a480(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2D arg_0_1; -void textureLoad_c2a480() { - ivec4 res = texelFetch(arg_0_1, ivec2(0, 0), 0); -} - -void compute_main() { - textureLoad_c2a480(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.hlsl deleted file mode 100644 index 7144884c7d..0000000000 --- a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureLoad_c2a480() { - int4 res = arg_0.Load(int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_c2a480(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_c2a480(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_c2a480(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.msl deleted file mode 100644 index 01badd3190..0000000000 --- a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_c2a480(texture2d tint_symbol_1) { - int4 res = tint_symbol_1.read(uint2(int2()), 0); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureLoad_c2a480(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureLoad_c2a480(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureLoad_c2a480(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.spvasm b/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.spvasm deleted file mode 100644 index 2a12e214cf..0000000000 --- a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.spvasm +++ /dev/null @@ -1,77 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %textureLoad_c2a480 "textureLoad_c2a480" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %int = OpTypeInt 32 1 - %11 = OpTypeImage %int 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %void = OpTypeVoid - %13 = OpTypeFunction %void - %v4int = OpTypeVector %int 4 - %v2int = OpTypeVector %int 2 - %21 = OpConstantNull %v2int - %int_0 = OpConstant %int 0 -%_ptr_Function_v4int = OpTypePointer Function %v4int - %25 = OpConstantNull %v4int - %26 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureLoad_c2a480 = OpFunction %void None %13 - %16 = OpLabel - %res = OpVariable %_ptr_Function_v4int Function %25 - %19 = OpLoad %11 %arg_0 - %17 = OpImageFetch %v4int %19 %21 Lod %int_0 - OpStore %res %17 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %26 - %28 = OpLabel - %29 = OpFunctionCall %void %textureLoad_c2a480 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %13 - %31 = OpLabel - %32 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %32 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %13 - %35 = OpLabel - %36 = OpFunctionCall %void %textureLoad_c2a480 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %13 - %38 = OpLabel - %39 = OpFunctionCall %void %textureLoad_c2a480 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.wgsl deleted file mode 100644 index ce9e2c7c7f..0000000000 --- a/test/tint/builtins/gen/textureLoad/c2a480.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureLoad_c2a480() { - var res : vec4 = textureLoad(arg_0, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_c2a480(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_c2a480(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_c2a480(); -} diff --git a/test/tint/builtins/gen/textureLoad/c378ee.wgsl b/test/tint/builtins/gen/textureLoad/c378ee.wgsl deleted file mode 100644 index 4d56e20dae..0000000000 --- a/test/tint/builtins/gen/textureLoad/c378ee.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_multisampled_2d; - -// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 -fn textureLoad_c378ee() { - var res: vec4 = textureLoad(arg_0, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_c378ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_c378ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_c378ee(); -} diff --git a/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.glsl deleted file mode 100644 index 882811476f..0000000000 --- a/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler2DMS arg_0_1; -void textureLoad_c378ee() { - uvec4 res = texelFetch(arg_0_1, ivec2(0, 0), 1); -} - -vec4 vertex_main() { - textureLoad_c378ee(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DMS arg_0_1; -void textureLoad_c378ee() { - uvec4 res = texelFetch(arg_0_1, ivec2(0, 0), 1); -} - -void fragment_main() { - textureLoad_c378ee(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DMS arg_0_1; -void textureLoad_c378ee() { - uvec4 res = texelFetch(arg_0_1, ivec2(0, 0), 1); -} - -void compute_main() { - textureLoad_c378ee(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.hlsl deleted file mode 100644 index f8a1b424fe..0000000000 --- a/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureLoad_c378ee() { - uint4 res = arg_0.Load(int2(0, 0), 1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_c378ee(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_c378ee(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_c378ee(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.msl deleted file mode 100644 index 60085e0404..0000000000 --- a/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_c378ee(texture2d_ms tint_symbol_1) { - uint4 res = tint_symbol_1.read(uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_ms tint_symbol_2) { - textureLoad_c378ee(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { - textureLoad_c378ee(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { - textureLoad_c378ee(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.wgsl deleted file mode 100644 index d47f7562f0..0000000000 --- a/test/tint/builtins/gen/textureLoad/c378ee.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_multisampled_2d; - -fn textureLoad_c378ee() { - var res : vec4 = textureLoad(arg_0, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_c378ee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_c378ee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_c378ee(); -} diff --git a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl b/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl deleted file mode 100644 index 1a097e7b25..0000000000 --- a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_multisampled_2d; - -// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 -fn textureLoad_e3d2cc() { - var res: vec4 = textureLoad(arg_0, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_e3d2cc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_e3d2cc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_e3d2cc(); -} diff --git a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.glsl b/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.glsl deleted file mode 100644 index 35da65be61..0000000000 --- a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler2DMS arg_0_1; -void textureLoad_e3d2cc() { - ivec4 res = texelFetch(arg_0_1, ivec2(0, 0), 1); -} - -vec4 vertex_main() { - textureLoad_e3d2cc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DMS arg_0_1; -void textureLoad_e3d2cc() { - ivec4 res = texelFetch(arg_0_1, ivec2(0, 0), 1); -} - -void fragment_main() { - textureLoad_e3d2cc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DMS arg_0_1; -void textureLoad_e3d2cc() { - ivec4 res = texelFetch(arg_0_1, ivec2(0, 0), 1); -} - -void compute_main() { - textureLoad_e3d2cc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.hlsl b/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.hlsl deleted file mode 100644 index eb0cd78a73..0000000000 --- a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureLoad_e3d2cc() { - int4 res = arg_0.Load(int2(0, 0), 1); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureLoad_e3d2cc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureLoad_e3d2cc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureLoad_e3d2cc(); - return; -} diff --git a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.msl b/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.msl deleted file mode 100644 index 1674c168e3..0000000000 --- a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureLoad_e3d2cc(texture2d_ms tint_symbol_1) { - int4 res = tint_symbol_1.read(uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_ms tint_symbol_2) { - textureLoad_e3d2cc(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { - textureLoad_e3d2cc(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { - textureLoad_e3d2cc(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.wgsl b/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.wgsl deleted file mode 100644 index f8a1af7a91..0000000000 --- a/test/tint/builtins/gen/textureLoad/e3d2cc.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_multisampled_2d; - -fn textureLoad_e3d2cc() { - var res : vec4 = textureLoad(arg_0, vec2(), 1); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureLoad_e3d2cc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureLoad_e3d2cc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureLoad_e3d2cc(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/024820.wgsl b/test/tint/builtins/gen/textureNumLayers/024820.wgsl deleted file mode 100644 index 99a5031fa2..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/024820.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureNumLayers(texture: texture_2d_array) -> i32 -fn textureNumLayers_024820() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_024820(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_024820(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_024820(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.glsl deleted file mode 100644 index 7d0d613cf9..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureNumLayers_024820() { - int res = textureSize(arg_0_1, 0).z; -} - -vec4 vertex_main() { - textureNumLayers_024820(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureNumLayers_024820() { - int res = textureSize(arg_0_1, 0).z; -} - -void fragment_main() { - textureNumLayers_024820(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureNumLayers_024820() { - int res = textureSize(arg_0_1, 0).z; -} - -void compute_main() { - textureNumLayers_024820(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.hlsl deleted file mode 100644 index 7ccc1894af..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureNumLayers_024820() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_024820(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_024820(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_024820(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.msl deleted file mode 100644 index cecc24da8d..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_024820(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_024820(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_024820(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_024820(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.wgsl deleted file mode 100644 index f58c93cef4..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/024820.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureNumLayers_024820() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_024820(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_024820(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_024820(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl b/test/tint/builtins/gen/textureNumLayers/053df7.wgsl deleted file mode 100644 index 9595a93f38..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureNumLayers(texture: texture_cube_array) -> i32 -fn textureNumLayers_053df7() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_053df7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_053df7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_053df7(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.glsl deleted file mode 100644 index 89d39c3fa0..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usamplerCubeArray arg_0_1; -void textureNumLayers_053df7() { - int res = textureSize(arg_0_1, 0).z; -} - -vec4 vertex_main() { - textureNumLayers_053df7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usamplerCubeArray arg_0_1; -void textureNumLayers_053df7() { - int res = textureSize(arg_0_1, 0).z; -} - -void fragment_main() { - textureNumLayers_053df7(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usamplerCubeArray arg_0_1; -void textureNumLayers_053df7() { - int res = textureSize(arg_0_1, 0).z; -} - -void compute_main() { - textureNumLayers_053df7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.hlsl deleted file mode 100644 index 97689f6f57..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureNumLayers_053df7() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_053df7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_053df7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_053df7(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.msl deleted file mode 100644 index 4c77a41b31..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_053df7(texturecube_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureNumLayers_053df7(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_053df7(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_053df7(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.wgsl deleted file mode 100644 index fae44b9a2b..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/053df7.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureNumLayers_053df7() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_053df7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_053df7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_053df7(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl b/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl deleted file mode 100644 index fe750568ee..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_058cc3() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_058cc3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_058cc3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_058cc3(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.glsl deleted file mode 100644 index 21eb267df5..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_058cc3() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_058cc3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_058cc3() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_058cc3(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_058cc3() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_058cc3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.hlsl deleted file mode 100644 index 725e642c8d..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_058cc3() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_058cc3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_058cc3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_058cc3(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.msl deleted file mode 100644 index 6ba3aecf54..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_058cc3(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_058cc3(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_058cc3(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_058cc3(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.wgsl deleted file mode 100644 index ee5d2e0686..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/058cc3.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_058cc3() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_058cc3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_058cc3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_058cc3(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl b/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl deleted file mode 100644 index 9e8fd7c1a5..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_09d05d() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_09d05d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_09d05d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_09d05d(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.glsl deleted file mode 100644 index 49177ec639..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_09d05d() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_09d05d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_09d05d() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_09d05d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_09d05d() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_09d05d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.hlsl deleted file mode 100644 index 75cf60c504..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_09d05d() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_09d05d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_09d05d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_09d05d(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.msl deleted file mode 100644 index 32372b9dab..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_09d05d(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_09d05d(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_09d05d(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_09d05d(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.wgsl deleted file mode 100644 index 2034fa4019..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/09d05d.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_09d05d() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_09d05d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_09d05d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_09d05d(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl b/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl deleted file mode 100644 index 941d8f6aa6..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_13b4ce() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_13b4ce(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_13b4ce(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_13b4ce(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.glsl deleted file mode 100644 index 5204b71b91..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_13b4ce() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_13b4ce(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_13b4ce() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_13b4ce(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_13b4ce() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_13b4ce(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.hlsl deleted file mode 100644 index 1bfb035832..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_13b4ce() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_13b4ce(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_13b4ce(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_13b4ce(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.msl deleted file mode 100644 index e48920fa60..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_13b4ce(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_13b4ce(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_13b4ce(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_13b4ce(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.wgsl deleted file mode 100644 index 5061e7e950..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/13b4ce.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_13b4ce() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_13b4ce(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_13b4ce(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_13b4ce(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl b/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl deleted file mode 100644 index e2c96d742a..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_22e53b() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_22e53b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_22e53b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_22e53b(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.glsl deleted file mode 100644 index 80433135b4..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_22e53b() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_22e53b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_22e53b() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_22e53b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_22e53b() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_22e53b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.hlsl deleted file mode 100644 index 46a495a5e3..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_22e53b() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_22e53b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_22e53b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_22e53b(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.msl deleted file mode 100644 index 7bfd96a3bf..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_22e53b(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_22e53b(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_22e53b(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_22e53b(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.wgsl deleted file mode 100644 index 6d9957b55d..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/22e53b.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_22e53b() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_22e53b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_22e53b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_22e53b(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/562013.wgsl b/test/tint/builtins/gen/textureNumLayers/562013.wgsl deleted file mode 100644 index aac18a1c47..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/562013.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_562013() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_562013(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_562013(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_562013(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.glsl deleted file mode 100644 index f71e528b86..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_562013() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_562013(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_562013() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_562013(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_562013() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_562013(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.hlsl deleted file mode 100644 index 5fcd67785a..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_562013() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_562013(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_562013(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_562013(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.msl deleted file mode 100644 index 29e697e304..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_562013(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_562013(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_562013(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_562013(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.wgsl deleted file mode 100644 index 72231707de..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/562013.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_562013() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_562013(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_562013(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_562013(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl b/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl deleted file mode 100644 index edf197ff17..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureNumLayers(texture: texture_cube_array) -> i32 -fn textureNumLayers_5d59cd() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_5d59cd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_5d59cd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_5d59cd(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.glsl deleted file mode 100644 index 8d21f6d0d8..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureNumLayers_5d59cd() { - int res = textureSize(arg_0_1, 0).z; -} - -vec4 vertex_main() { - textureNumLayers_5d59cd(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_1; -void textureNumLayers_5d59cd() { - int res = textureSize(arg_0_1, 0).z; -} - -void fragment_main() { - textureNumLayers_5d59cd(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureNumLayers_5d59cd() { - int res = textureSize(arg_0_1, 0).z; -} - -void compute_main() { - textureNumLayers_5d59cd(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.hlsl deleted file mode 100644 index 9a46da2570..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureNumLayers_5d59cd() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_5d59cd(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_5d59cd(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_5d59cd(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.msl deleted file mode 100644 index ecbee5958c..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_5d59cd(texturecube_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureNumLayers_5d59cd(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_5d59cd(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_5d59cd(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.wgsl deleted file mode 100644 index 170c76310d..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/5d59cd.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureNumLayers_5d59cd() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_5d59cd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_5d59cd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_5d59cd(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl b/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl deleted file mode 100644 index 6743ff5fe3..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_68a65b() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_68a65b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_68a65b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_68a65b(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.glsl deleted file mode 100644 index 9cc265a4b2..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_68a65b() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_68a65b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_68a65b() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_68a65b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_68a65b() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_68a65b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.hlsl deleted file mode 100644 index 3b3e7c5e4d..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_68a65b() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_68a65b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_68a65b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_68a65b(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.msl deleted file mode 100644 index a71e53d3b4..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_68a65b(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_68a65b(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_68a65b(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_68a65b(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.wgsl deleted file mode 100644 index f358993084..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/68a65b.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_68a65b() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_68a65b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_68a65b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_68a65b(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl b/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl deleted file mode 100644 index 2574c2af03..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; - -// fn textureNumLayers(texture: texture_depth_cube_array) -> i32 -fn textureNumLayers_778bd1() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_778bd1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_778bd1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_778bd1(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.glsl deleted file mode 100644 index b4b76bf538..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureNumLayers_778bd1() { - int res = textureSize(arg_0_1, 0).z; -} - -vec4 vertex_main() { - textureNumLayers_778bd1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_1; -void textureNumLayers_778bd1() { - int res = textureSize(arg_0_1, 0).z; -} - -void fragment_main() { - textureNumLayers_778bd1(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureNumLayers_778bd1() { - int res = textureSize(arg_0_1, 0).z; -} - -void compute_main() { - textureNumLayers_778bd1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.hlsl deleted file mode 100644 index fd57842021..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureNumLayers_778bd1() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_778bd1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_778bd1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_778bd1(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.msl deleted file mode 100644 index 7d8fb0f57a..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_778bd1(depthcube_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube_array tint_symbol_2) { - textureNumLayers_778bd1(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_778bd1(tint_symbol_4); - return; -} - -kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_778bd1(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.wgsl deleted file mode 100644 index c13e994169..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/778bd1.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -fn textureNumLayers_778bd1() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_778bd1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_778bd1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_778bd1(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl b/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl deleted file mode 100644 index ed7014f4d1..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_7f1937() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_7f1937(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_7f1937(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_7f1937(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.glsl deleted file mode 100644 index 33bd39840d..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_7f1937() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_7f1937(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_7f1937() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_7f1937(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_7f1937() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_7f1937(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.hlsl deleted file mode 100644 index a352bf5a28..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_7f1937() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_7f1937(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_7f1937(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_7f1937(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.msl deleted file mode 100644 index e7027f1374..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_7f1937(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_7f1937(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_7f1937(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_7f1937(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.wgsl deleted file mode 100644 index 4450cebde7..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/7f1937.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_7f1937() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_7f1937(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_7f1937(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_7f1937(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl b/test/tint/builtins/gen/textureNumLayers/85f980.wgsl deleted file mode 100644 index e01f5769de..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureNumLayers(texture: texture_cube_array) -> i32 -fn textureNumLayers_85f980() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_85f980(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_85f980(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_85f980(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.glsl deleted file mode 100644 index 22a9c53273..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isamplerCubeArray arg_0_1; -void textureNumLayers_85f980() { - int res = textureSize(arg_0_1, 0).z; -} - -vec4 vertex_main() { - textureNumLayers_85f980(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isamplerCubeArray arg_0_1; -void textureNumLayers_85f980() { - int res = textureSize(arg_0_1, 0).z; -} - -void fragment_main() { - textureNumLayers_85f980(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isamplerCubeArray arg_0_1; -void textureNumLayers_85f980() { - int res = textureSize(arg_0_1, 0).z; -} - -void compute_main() { - textureNumLayers_85f980(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.hlsl deleted file mode 100644 index 383ad274a4..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureNumLayers_85f980() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_85f980(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_85f980(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_85f980(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.msl deleted file mode 100644 index ce07ab5e96..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_85f980(texturecube_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureNumLayers_85f980(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_85f980(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_85f980(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.wgsl deleted file mode 100644 index 4dc70c7371..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/85f980.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureNumLayers_85f980() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_85f980(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_85f980(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_85f980(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl b/test/tint/builtins/gen/textureNumLayers/87953e.wgsl deleted file mode 100644 index 00db05ea76..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureNumLayers(texture: texture_2d_array) -> i32 -fn textureNumLayers_87953e() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_87953e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_87953e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_87953e(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.glsl deleted file mode 100644 index 9c47222448..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureNumLayers_87953e() { - int res = textureSize(arg_0_1, 0).z; -} - -vec4 vertex_main() { - textureNumLayers_87953e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp usampler2DArray arg_0_1; -void textureNumLayers_87953e() { - int res = textureSize(arg_0_1, 0).z; -} - -void fragment_main() { - textureNumLayers_87953e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureNumLayers_87953e() { - int res = textureSize(arg_0_1, 0).z; -} - -void compute_main() { - textureNumLayers_87953e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.hlsl deleted file mode 100644 index 383343871e..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureNumLayers_87953e() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_87953e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_87953e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_87953e(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.msl deleted file mode 100644 index 344a256724..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_87953e(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_87953e(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_87953e(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_87953e(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.wgsl deleted file mode 100644 index 26f73eaa53..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/87953e.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureNumLayers_87953e() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_87953e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_87953e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_87953e(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl b/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl deleted file mode 100644 index 3b58ba3dc1..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureNumLayers(texture: texture_2d_array) -> i32 -fn textureNumLayers_893e7c() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_893e7c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_893e7c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_893e7c(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.glsl deleted file mode 100644 index 68e65380cb..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureNumLayers_893e7c() { - int res = textureSize(arg_0_1, 0).z; -} - -vec4 vertex_main() { - textureNumLayers_893e7c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp isampler2DArray arg_0_1; -void textureNumLayers_893e7c() { - int res = textureSize(arg_0_1, 0).z; -} - -void fragment_main() { - textureNumLayers_893e7c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureNumLayers_893e7c() { - int res = textureSize(arg_0_1, 0).z; -} - -void compute_main() { - textureNumLayers_893e7c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.hlsl deleted file mode 100644 index 5326a55c29..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureNumLayers_893e7c() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_893e7c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_893e7c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_893e7c(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.msl deleted file mode 100644 index 9282aa8ff0..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_893e7c(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_893e7c(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_893e7c(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_893e7c(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.wgsl deleted file mode 100644 index 3cda54612f..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/893e7c.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureNumLayers_893e7c() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_893e7c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_893e7c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_893e7c(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl b/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl deleted file mode 100644 index d02558bbeb..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_9700fb() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_9700fb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_9700fb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_9700fb(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.glsl deleted file mode 100644 index 6761d3af17..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_9700fb() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_9700fb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_9700fb() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_9700fb(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_9700fb() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_9700fb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.hlsl deleted file mode 100644 index 463ebe26c2..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_9700fb() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_9700fb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_9700fb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_9700fb(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.msl deleted file mode 100644 index 9cd8aad10d..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_9700fb(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_9700fb(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_9700fb(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_9700fb(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.wgsl deleted file mode 100644 index ce6acab433..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/9700fb.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_9700fb() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_9700fb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_9700fb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_9700fb(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl b/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl deleted file mode 100644 index 1bf60ba39f..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_a216d2() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_a216d2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_a216d2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_a216d2(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.glsl deleted file mode 100644 index fb764f0010..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_a216d2() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_a216d2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_a216d2() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_a216d2(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_a216d2() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_a216d2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.hlsl deleted file mode 100644 index dab107c44b..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_a216d2() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_a216d2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_a216d2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_a216d2(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.msl deleted file mode 100644 index 67624d6bbd..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_a216d2(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_a216d2(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_a216d2(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_a216d2(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.wgsl deleted file mode 100644 index 38fbc8960b..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/a216d2.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_a216d2() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_a216d2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_a216d2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_a216d2(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl b/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl deleted file mode 100644 index af6c708665..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_cd5dc8() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_cd5dc8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_cd5dc8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_cd5dc8(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.glsl deleted file mode 100644 index 9fb8891732..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_cd5dc8() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_cd5dc8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_cd5dc8() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_cd5dc8(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_cd5dc8() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_cd5dc8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.hlsl deleted file mode 100644 index fbcb1238df..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_cd5dc8() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_cd5dc8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_cd5dc8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_cd5dc8(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.msl deleted file mode 100644 index d783a2d845..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_cd5dc8(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_cd5dc8(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_cd5dc8(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_cd5dc8(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.wgsl deleted file mode 100644 index 870778b6dd..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/cd5dc8.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_cd5dc8() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_cd5dc8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_cd5dc8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_cd5dc8(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl b/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl deleted file mode 100644 index df5ccbd2c3..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_d5b228() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_d5b228(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_d5b228(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_d5b228(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.glsl deleted file mode 100644 index c5b0351289..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_d5b228() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_d5b228(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_d5b228() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_d5b228(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32f) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_d5b228() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_d5b228(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.hlsl deleted file mode 100644 index d8bc0a4f21..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_d5b228() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_d5b228(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_d5b228(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_d5b228(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.msl deleted file mode 100644 index d8f24b2eae..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_d5b228(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_d5b228(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_d5b228(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_d5b228(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.wgsl deleted file mode 100644 index 798b0a815f..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/d5b228.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_d5b228() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_d5b228(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_d5b228(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_d5b228(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl b/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl deleted file mode 100644 index a7f2c8ca09..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_e31be1() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_e31be1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_e31be1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_e31be1(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.glsl deleted file mode 100644 index b5a41f8fbb..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_e31be1() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_e31be1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_e31be1() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_e31be1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; -void textureNumLayers_e31be1() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_e31be1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.hlsl deleted file mode 100644 index d41a82144f..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_e31be1() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_e31be1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_e31be1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_e31be1(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.msl deleted file mode 100644 index 8935085d84..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_e31be1(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_e31be1(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_e31be1(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_e31be1(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.wgsl deleted file mode 100644 index e47d202e0d..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e31be1.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_e31be1() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_e31be1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_e31be1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_e31be1(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl b/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl deleted file mode 100644 index cb9d362880..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; - -// fn textureNumLayers(texture: texture_depth_2d_array) -> i32 -fn textureNumLayers_e653c0() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_e653c0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_e653c0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_e653c0(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.glsl deleted file mode 100644 index f078048881..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureNumLayers_e653c0() { - int res = textureSize(arg_0_1, 0).z; -} - -vec4 vertex_main() { - textureNumLayers_e653c0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureNumLayers_e653c0() { - int res = textureSize(arg_0_1, 0).z; -} - -void fragment_main() { - textureNumLayers_e653c0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureNumLayers_e653c0() { - int res = textureSize(arg_0_1, 0).z; -} - -void compute_main() { - textureNumLayers_e653c0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.hlsl deleted file mode 100644 index a15c460a07..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureNumLayers_e653c0() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_e653c0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_e653c0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_e653c0(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.msl deleted file mode 100644 index d37e9d9b69..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_e653c0(depth2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_2) { - textureNumLayers_e653c0(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_e653c0(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_e653c0(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.wgsl deleted file mode 100644 index 4adddfbea7..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/e653c0.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -fn textureNumLayers_e653c0() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_e653c0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_e653c0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_e653c0(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl b/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl deleted file mode 100644 index 5ebae3d73e..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_ee942f() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_ee942f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_ee942f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_ee942f(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.glsl deleted file mode 100644 index e2c2fb137f..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_ee942f() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_ee942f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_ee942f() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_ee942f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_ee942f() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_ee942f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.hlsl deleted file mode 100644 index 110c6c9e01..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_ee942f() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_ee942f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_ee942f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_ee942f(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.msl deleted file mode 100644 index 399e5bd7d9..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_ee942f(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_ee942f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_ee942f(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_ee942f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.wgsl deleted file mode 100644 index 4d48facccd..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ee942f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_ee942f() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_ee942f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_ee942f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_ee942f(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl b/test/tint/builtins/gen/textureNumLayers/f33005.wgsl deleted file mode 100644 index d12cb268ea..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_f33005() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_f33005(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_f33005(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_f33005(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.glsl deleted file mode 100644 index 0318eddbb4..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_f33005() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_f33005(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_f33005() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_f33005(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; -void textureNumLayers_f33005() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_f33005(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.hlsl deleted file mode 100644 index d6b9fa8bd4..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_f33005() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_f33005(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_f33005(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_f33005(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.msl deleted file mode 100644 index 78959f67b9..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_f33005(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_f33005(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_f33005(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_f33005(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.wgsl deleted file mode 100644 index 35bd8cab44..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/f33005.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_f33005() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_f33005(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_f33005(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_f33005(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl b/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl deleted file mode 100644 index e99f0753a3..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_fcec98() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_fcec98(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_fcec98(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_fcec98(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.glsl deleted file mode 100644 index 0befb0d791..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_fcec98() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_fcec98(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_fcec98() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_fcec98(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_fcec98() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_fcec98(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.hlsl deleted file mode 100644 index 288d736c39..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_fcec98() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_fcec98(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_fcec98(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_fcec98(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.msl deleted file mode 100644 index ffcba511ab..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_fcec98(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_fcec98(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_fcec98(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_fcec98(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.wgsl deleted file mode 100644 index 6a1723e7cf..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/fcec98.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_fcec98() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_fcec98(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_fcec98(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_fcec98(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl b/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl deleted file mode 100644 index 3d50b4fced..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 -fn textureNumLayers_ff5e89() { - var res: i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_ff5e89(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_ff5e89(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_ff5e89(); -} diff --git a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.glsl deleted file mode 100644 index fee6d33572..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_ff5e89() { - int res = imageSize(arg_0).z; -} - -vec4 vertex_main() { - textureNumLayers_ff5e89(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_ff5e89() { - int res = imageSize(arg_0).z; -} - -void fragment_main() { - textureNumLayers_ff5e89(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; -void textureNumLayers_ff5e89() { - int res = imageSize(arg_0).z; -} - -void compute_main() { - textureNumLayers_ff5e89(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.hlsl deleted file mode 100644 index 0b420c2eeb..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureNumLayers_ff5e89() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLayers_ff5e89(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLayers_ff5e89(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLayers_ff5e89(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.msl deleted file mode 100644 index 2a83087bfb..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLayers_ff5e89(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_array_size()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLayers_ff5e89(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLayers_ff5e89(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLayers_ff5e89(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.wgsl deleted file mode 100644 index cd8cb2d9c7..0000000000 --- a/test/tint/builtins/gen/textureNumLayers/ff5e89.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureNumLayers_ff5e89() { - var res : i32 = textureNumLayers(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLayers_ff5e89(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLayers_ff5e89(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLayers_ff5e89(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl b/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl deleted file mode 100644 index 63b7ea4cea..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube; - -// fn textureNumLevels(texture: texture_depth_cube) -> i32 -fn textureNumLevels_076cb5() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_076cb5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_076cb5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_076cb5(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.glsl deleted file mode 100644 index 492973acac..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureNumLevels_076cb5() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_076cb5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_1; -void textureNumLevels_076cb5() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_076cb5(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureNumLevels_076cb5() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_076cb5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.hlsl deleted file mode 100644 index 404709c33c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureNumLevels_076cb5() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_076cb5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_076cb5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_076cb5(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.msl deleted file mode 100644 index e60a683f7d..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_076cb5(depthcube tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube tint_symbol_2) { - textureNumLevels_076cb5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { - textureNumLevels_076cb5(tint_symbol_4); - return; -} - -kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { - textureNumLevels_076cb5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.wgsl deleted file mode 100644 index c04d6e6144..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/076cb5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube; - -fn textureNumLevels_076cb5() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_076cb5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_076cb5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_076cb5(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl b/test/tint/builtins/gen/textureNumLevels/080d95.wgsl deleted file mode 100644 index ded52c9a96..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; - -// fn textureNumLevels(texture: texture_cube) -> i32 -fn textureNumLevels_080d95() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_080d95(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_080d95(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_080d95(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.glsl deleted file mode 100644 index 39d54d2658..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isamplerCube arg_0_1; -void textureNumLevels_080d95() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_080d95(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isamplerCube arg_0_1; -void textureNumLevels_080d95() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_080d95(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isamplerCube arg_0_1; -void textureNumLevels_080d95() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_080d95(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.hlsl deleted file mode 100644 index 039799da6b..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureNumLevels_080d95() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_080d95(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_080d95(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_080d95(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.msl deleted file mode 100644 index c8fb39c2f1..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_080d95(texturecube tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_2) { - textureNumLevels_080d95(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { - textureNumLevels_080d95(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { - textureNumLevels_080d95(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.wgsl deleted file mode 100644 index 686c90849d..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/080d95.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -fn textureNumLevels_080d95() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_080d95(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_080d95(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_080d95(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl b/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl deleted file mode 100644 index e843a19449..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureNumLevels(texture: texture_2d) -> i32 -fn textureNumLevels_09ddd0() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_09ddd0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_09ddd0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_09ddd0(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.glsl deleted file mode 100644 index 642d73853a..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usampler2D arg_0_1; -void textureNumLevels_09ddd0() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_09ddd0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usampler2D arg_0_1; -void textureNumLevels_09ddd0() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_09ddd0(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usampler2D arg_0_1; -void textureNumLevels_09ddd0() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_09ddd0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.hlsl deleted file mode 100644 index a903d8102d..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureNumLevels_09ddd0() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_09ddd0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_09ddd0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_09ddd0(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.msl deleted file mode 100644 index be2500ac8e..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_09ddd0(texture2d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureNumLevels_09ddd0(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_09ddd0(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_09ddd0(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.wgsl deleted file mode 100644 index 7a4d344a1a..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/09ddd0.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureNumLevels_09ddd0() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_09ddd0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_09ddd0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_09ddd0(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/105988.wgsl b/test/tint/builtins/gen/textureNumLevels/105988.wgsl deleted file mode 100644 index 0014fa3efd..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/105988.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureNumLevels(texture: texture_2d_array) -> i32 -fn textureNumLevels_105988() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_105988(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_105988(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_105988(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.glsl deleted file mode 100644 index 162f265051..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureNumLevels_105988() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_105988(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureNumLevels_105988() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_105988(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureNumLevels_105988() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_105988(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.hlsl deleted file mode 100644 index 71be44d9cd..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureNumLevels_105988() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_105988(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_105988(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_105988(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.msl deleted file mode 100644 index 096d48d290..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_105988(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLevels_105988(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLevels_105988(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLevels_105988(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.wgsl deleted file mode 100644 index 1466976b06..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/105988.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureNumLevels_105988() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_105988(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_105988(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_105988(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl b/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl deleted file mode 100644 index 2dc92a3a30..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureNumLevels(texture: texture_1d) -> i32 -fn textureNumLevels_1e6f3b() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_1e6f3b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_1e6f3b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_1e6f3b(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.glsl deleted file mode 100644 index 2b5dbe7100..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usampler1D arg_0_1; -void textureNumLevels_1e6f3b() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_1e6f3b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usampler1D arg_0_1; -void textureNumLevels_1e6f3b() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_1e6f3b(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usampler1D arg_0_1; -void textureNumLevels_1e6f3b() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_1e6f3b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.hlsl deleted file mode 100644 index 4ef4ca87cf..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureNumLevels_1e6f3b() { - int2 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); - int res = tint_tmp.y; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_1e6f3b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_1e6f3b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_1e6f3b(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.msl deleted file mode 100644 index fb21aa7064..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_1e6f3b(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureNumLevels_1e6f3b(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_1e6f3b(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_1e6f3b(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.wgsl deleted file mode 100644 index 3643d3efef..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/1e6f3b.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureNumLevels_1e6f3b() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_1e6f3b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_1e6f3b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_1e6f3b(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl b/test/tint/builtins/gen/textureNumLevels/23f750.wgsl deleted file mode 100644 index 20719fc925..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureNumLevels(texture: texture_2d) -> i32 -fn textureNumLevels_23f750() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_23f750(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_23f750(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_23f750(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.glsl deleted file mode 100644 index ce7bf96e13..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isampler2D arg_0_1; -void textureNumLevels_23f750() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_23f750(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isampler2D arg_0_1; -void textureNumLevels_23f750() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_23f750(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isampler2D arg_0_1; -void textureNumLevels_23f750() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_23f750(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.hlsl deleted file mode 100644 index 958afdcd24..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureNumLevels_23f750() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_23f750(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_23f750(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_23f750(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.msl deleted file mode 100644 index dc6fd0a9c5..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_23f750(texture2d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureNumLevels_23f750(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_23f750(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_23f750(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.wgsl deleted file mode 100644 index 86bf58889a..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/23f750.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureNumLevels_23f750() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_23f750(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_23f750(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_23f750(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl b/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl deleted file mode 100644 index c0db1ad608..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; - -// fn textureNumLevels(texture: texture_depth_cube_array) -> i32 -fn textureNumLevels_2c3575() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_2c3575(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_2c3575(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_2c3575(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.glsl deleted file mode 100644 index 0a82078f5b..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureNumLevels_2c3575() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_2c3575(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_1; -void textureNumLevels_2c3575() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_2c3575(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureNumLevels_2c3575() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_2c3575(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.hlsl deleted file mode 100644 index 7aa8570e0f..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureNumLevels_2c3575() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_2c3575(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_2c3575(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_2c3575(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.msl deleted file mode 100644 index 1492f86a7d..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_2c3575(depthcube_array tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube_array tint_symbol_2) { - textureNumLevels_2c3575(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { - textureNumLevels_2c3575(tint_symbol_4); - return; -} - -kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { - textureNumLevels_2c3575(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.wgsl deleted file mode 100644 index 6f2f54dcfc..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/2c3575.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -fn textureNumLevels_2c3575() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_2c3575(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_2c3575(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_2c3575(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl b/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl deleted file mode 100644 index d83db338d5..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureNumLevels(texture: texture_1d) -> i32 -fn textureNumLevels_32a0ae() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_32a0ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_32a0ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_32a0ae(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.glsl deleted file mode 100644 index bf2838f77b..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isampler1D arg_0_1; -void textureNumLevels_32a0ae() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_32a0ae(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isampler1D arg_0_1; -void textureNumLevels_32a0ae() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_32a0ae(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isampler1D arg_0_1; -void textureNumLevels_32a0ae() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_32a0ae(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.hlsl deleted file mode 100644 index f22518ce79..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureNumLevels_32a0ae() { - int2 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); - int res = tint_tmp.y; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_32a0ae(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_32a0ae(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_32a0ae(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.msl deleted file mode 100644 index 9f66634525..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_32a0ae(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureNumLevels_32a0ae(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_32a0ae(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_32a0ae(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.wgsl deleted file mode 100644 index e5016ebb3f..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/32a0ae.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureNumLevels_32a0ae() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_32a0ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_32a0ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_32a0ae(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl b/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl deleted file mode 100644 index e9cb59fa91..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureNumLevels(texture: texture_2d_array) -> i32 -fn textureNumLevels_5101cf() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_5101cf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_5101cf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_5101cf(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.glsl deleted file mode 100644 index 764fd83ec5..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureNumLevels_5101cf() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_5101cf(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usampler2DArray arg_0_1; -void textureNumLevels_5101cf() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_5101cf(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usampler2DArray arg_0_1; -void textureNumLevels_5101cf() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_5101cf(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.hlsl deleted file mode 100644 index 7091b8e737..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureNumLevels_5101cf() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_5101cf(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_5101cf(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_5101cf(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.msl deleted file mode 100644 index 9f5a2eb7bd..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_5101cf(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLevels_5101cf(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLevels_5101cf(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLevels_5101cf(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.wgsl deleted file mode 100644 index 694397b7ed..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/5101cf.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureNumLevels_5101cf() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_5101cf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_5101cf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_5101cf(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl b/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl deleted file mode 100644 index cad28463af..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; - -// fn textureNumLevels(texture: texture_1d) -> i32 -fn textureNumLevels_51b5bb() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_51b5bb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_51b5bb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_51b5bb(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.glsl deleted file mode 100644 index eb8b6ebeb2..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler1D arg_0_1; -void textureNumLevels_51b5bb() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_51b5bb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'sampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler1D arg_0_1; -void textureNumLevels_51b5bb() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_51b5bb(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'sampler1D' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler1D arg_0_1; -void textureNumLevels_51b5bb() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_51b5bb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'sampler1D' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.hlsl deleted file mode 100644 index 40f25f21fc..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture1D arg_0 : register(t0, space1); - -void textureNumLevels_51b5bb() { - int2 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); - int res = tint_tmp.y; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_51b5bb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_51b5bb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_51b5bb(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.msl deleted file mode 100644 index eac33e922c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_51b5bb(texture1d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureNumLevels_51b5bb(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_51b5bb(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_51b5bb(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.wgsl deleted file mode 100644 index 2ee7aa9d7d..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/51b5bb.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -fn textureNumLevels_51b5bb() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_51b5bb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_51b5bb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_51b5bb(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl b/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl deleted file mode 100644 index edf861312c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; - -// fn textureNumLevels(texture: texture_cube) -> i32 -fn textureNumLevels_897aaf() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_897aaf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_897aaf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_897aaf(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.glsl deleted file mode 100644 index a88ee828e8..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureNumLevels_897aaf() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_897aaf(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_1; -void textureNumLevels_897aaf() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_897aaf(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCube arg_0_1; -void textureNumLevels_897aaf() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_897aaf(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.hlsl deleted file mode 100644 index acaeff7432..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureNumLevels_897aaf() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_897aaf(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_897aaf(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_897aaf(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.msl deleted file mode 100644 index 90a35ee14d..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_897aaf(texturecube tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_2) { - textureNumLevels_897aaf(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { - textureNumLevels_897aaf(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { - textureNumLevels_897aaf(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.wgsl deleted file mode 100644 index 97e927523f..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/897aaf.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -fn textureNumLevels_897aaf() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_897aaf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_897aaf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_897aaf(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl b/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl deleted file mode 100644 index 3e3a657794..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureNumLevels(texture: texture_3d) -> i32 -fn textureNumLevels_9da7a5() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_9da7a5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_9da7a5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_9da7a5(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.glsl deleted file mode 100644 index 8f3d357b97..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isampler3D arg_0_1; -void textureNumLevels_9da7a5() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_9da7a5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isampler3D arg_0_1; -void textureNumLevels_9da7a5() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_9da7a5(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isampler3D arg_0_1; -void textureNumLevels_9da7a5() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_9da7a5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.hlsl deleted file mode 100644 index 4e34c92448..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureNumLevels_9da7a5() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_9da7a5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_9da7a5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_9da7a5(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.msl deleted file mode 100644 index 7e8f856dc7..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_9da7a5(texture3d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureNumLevels_9da7a5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_9da7a5(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_9da7a5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.wgsl deleted file mode 100644 index 5980b48cae..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/9da7a5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureNumLevels_9da7a5() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_9da7a5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_9da7a5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_9da7a5(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl b/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl deleted file mode 100644 index 212372cdd6..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureNumLevels(texture: texture_cube_array) -> i32 -fn textureNumLevels_a91c03() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_a91c03(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_a91c03(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_a91c03(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.glsl deleted file mode 100644 index c2ba89b86c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isamplerCubeArray arg_0_1; -void textureNumLevels_a91c03() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_a91c03(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isamplerCubeArray arg_0_1; -void textureNumLevels_a91c03() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_a91c03(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'isamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isamplerCubeArray arg_0_1; -void textureNumLevels_a91c03() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_a91c03(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'isamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.hlsl deleted file mode 100644 index b93c10e7ad..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureNumLevels_a91c03() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_a91c03(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_a91c03(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_a91c03(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.msl deleted file mode 100644 index 2a9faacb95..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_a91c03(texturecube_array tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureNumLevels_a91c03(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureNumLevels_a91c03(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureNumLevels_a91c03(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.wgsl deleted file mode 100644 index 72128538a7..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/a91c03.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureNumLevels_a91c03() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_a91c03(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_a91c03(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_a91c03(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl b/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl deleted file mode 100644 index a1ec36dafb..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureNumLevels(texture: texture_cube_array) -> i32 -fn textureNumLevels_aee7c8() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_aee7c8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_aee7c8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_aee7c8(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.glsl deleted file mode 100644 index eeabadcb6e..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureNumLevels_aee7c8() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_aee7c8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_1; -void textureNumLevels_aee7c8() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_aee7c8(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_1; -void textureNumLevels_aee7c8() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_aee7c8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.hlsl deleted file mode 100644 index 8408bc84c2..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureNumLevels_aee7c8() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_aee7c8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_aee7c8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_aee7c8(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.msl deleted file mode 100644 index 0b5172c631..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_aee7c8(texturecube_array tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureNumLevels_aee7c8(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureNumLevels_aee7c8(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureNumLevels_aee7c8(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.wgsl deleted file mode 100644 index 32c8b5a215..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/aee7c8.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureNumLevels_aee7c8() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_aee7c8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_aee7c8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_aee7c8(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl b/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl deleted file mode 100644 index afc20a1773..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; - -// fn textureNumLevels(texture: texture_depth_2d) -> i32 -fn textureNumLevels_b1b12b() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_b1b12b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_b1b12b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_b1b12b(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.glsl deleted file mode 100644 index 8768e27eea..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureNumLevels_b1b12b() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_b1b12b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_1; -void textureNumLevels_b1b12b() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_b1b12b(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureNumLevels_b1b12b() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_b1b12b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.hlsl deleted file mode 100644 index f69cf8c990..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureNumLevels_b1b12b() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_b1b12b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_b1b12b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_b1b12b(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.msl deleted file mode 100644 index 992a0acc27..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_b1b12b(depth2d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_2) { - textureNumLevels_b1b12b(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_b1b12b(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_b1b12b(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.wgsl deleted file mode 100644 index 97fd9a280c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b1b12b.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -fn textureNumLevels_b1b12b() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_b1b12b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_b1b12b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_b1b12b(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl b/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl deleted file mode 100644 index 3b2ecf56ab..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureNumLevels(texture: texture_3d) -> i32 -fn textureNumLevels_b4f5ea() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_b4f5ea(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_b4f5ea(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_b4f5ea(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.glsl deleted file mode 100644 index 605253e13c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usampler3D arg_0_1; -void textureNumLevels_b4f5ea() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_b4f5ea(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usampler3D arg_0_1; -void textureNumLevels_b4f5ea() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_b4f5ea(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usampler3D arg_0_1; -void textureNumLevels_b4f5ea() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_b4f5ea(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.hlsl deleted file mode 100644 index b7ae80c4cb..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureNumLevels_b4f5ea() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_b4f5ea(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_b4f5ea(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_b4f5ea(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.msl deleted file mode 100644 index f355a6d3e9..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_b4f5ea(texture3d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureNumLevels_b4f5ea(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_b4f5ea(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_b4f5ea(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.wgsl deleted file mode 100644 index ff1823d064..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/b4f5ea.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureNumLevels_b4f5ea() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_b4f5ea(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_b4f5ea(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_b4f5ea(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl b/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl deleted file mode 100644 index 8386de5a5c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; - -// fn textureNumLevels(texture: texture_2d_array) -> i32 -fn textureNumLevels_d004a9() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_d004a9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_d004a9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_d004a9(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.glsl deleted file mode 100644 index c111772022..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureNumLevels_d004a9() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_d004a9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isampler2DArray arg_0_1; -void textureNumLevels_d004a9() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_d004a9(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isampler2DArray arg_0_1; -void textureNumLevels_d004a9() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_d004a9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.hlsl deleted file mode 100644 index c97a707b31..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureNumLevels_d004a9() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_d004a9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_d004a9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_d004a9(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.msl deleted file mode 100644 index f3a4601862..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_d004a9(texture2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureNumLevels_d004a9(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLevels_d004a9(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLevels_d004a9(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.wgsl deleted file mode 100644 index e6efa4a6b1..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/d004a9.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -fn textureNumLevels_d004a9() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_d004a9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_d004a9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_d004a9(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl b/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl deleted file mode 100644 index 2b52ef0bcf..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; - -// fn textureNumLevels(texture: texture_3d) -> i32 -fn textureNumLevels_dca09e() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_dca09e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_dca09e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_dca09e(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.glsl deleted file mode 100644 index c8d1ce0f68..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler3D arg_0_1; -void textureNumLevels_dca09e() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_dca09e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_1; -void textureNumLevels_dca09e() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_dca09e(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler3D arg_0_1; -void textureNumLevels_dca09e() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_dca09e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.hlsl deleted file mode 100644 index 5c8af176e6..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture3D arg_0 : register(t0, space1); - -void textureNumLevels_dca09e() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_dca09e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_dca09e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_dca09e(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.msl deleted file mode 100644 index 2b06e6b75d..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_dca09e(texture3d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureNumLevels_dca09e(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_dca09e(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_dca09e(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.wgsl deleted file mode 100644 index 81c2ed177f..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/dca09e.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -fn textureNumLevels_dca09e() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_dca09e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_dca09e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_dca09e(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl b/test/tint/builtins/gen/textureNumLevels/e67231.wgsl deleted file mode 100644 index f718b8ef6c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; - -// fn textureNumLevels(texture: texture_2d) -> i32 -fn textureNumLevels_e67231() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_e67231(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_e67231(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_e67231(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.glsl deleted file mode 100644 index 0e6c2e9ae2..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureNumLevels_e67231() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_e67231(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_1; -void textureNumLevels_e67231() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_e67231(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2D arg_0_1; -void textureNumLevels_e67231() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_e67231(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.hlsl deleted file mode 100644 index f0b07cc963..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -void textureNumLevels_e67231() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_e67231(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_e67231(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_e67231(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.msl deleted file mode 100644 index f4f23bc00c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_e67231(texture2d tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureNumLevels_e67231(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureNumLevels_e67231(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureNumLevels_e67231(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.wgsl deleted file mode 100644 index b9b5a95d56..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/e67231.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -fn textureNumLevels_e67231() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_e67231(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_e67231(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_e67231(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl b/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl deleted file mode 100644 index 7bd2ff2dea..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; - -// fn textureNumLevels(texture: texture_cube) -> i32 -fn textureNumLevels_ed078b() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_ed078b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_ed078b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_ed078b(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.glsl deleted file mode 100644 index 952eeaceb5..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usamplerCube arg_0_1; -void textureNumLevels_ed078b() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_ed078b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usamplerCube arg_0_1; -void textureNumLevels_ed078b() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_ed078b(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usamplerCube arg_0_1; -void textureNumLevels_ed078b() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_ed078b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.hlsl deleted file mode 100644 index 60a817de0c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCube arg_0 : register(t0, space1); - -void textureNumLevels_ed078b() { - int3 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_ed078b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_ed078b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_ed078b(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.msl deleted file mode 100644 index 65e9dac98c..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_ed078b(texturecube tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_2) { - textureNumLevels_ed078b(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { - textureNumLevels_ed078b(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { - textureNumLevels_ed078b(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.wgsl deleted file mode 100644 index 1eb3d87ad7..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/ed078b.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -fn textureNumLevels_ed078b() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_ed078b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_ed078b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_ed078b(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl b/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl deleted file mode 100644 index 05d8294a93..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; - -// fn textureNumLevels(texture: texture_cube_array) -> i32 -fn textureNumLevels_f46ec6() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_f46ec6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_f46ec6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_f46ec6(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.glsl deleted file mode 100644 index 634bfe0254..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usamplerCubeArray arg_0_1; -void textureNumLevels_f46ec6() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_f46ec6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usamplerCubeArray arg_0_1; -void textureNumLevels_f46ec6() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_f46ec6(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'usamplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usamplerCubeArray arg_0_1; -void textureNumLevels_f46ec6() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_f46ec6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'usamplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.hlsl deleted file mode 100644 index c6079db1c6..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); - -void textureNumLevels_f46ec6() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_f46ec6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_f46ec6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_f46ec6(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.msl deleted file mode 100644 index 64bd4855da..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_f46ec6(texturecube_array tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_2) { - textureNumLevels_f46ec6(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { - textureNumLevels_f46ec6(tint_symbol_4); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { - textureNumLevels_f46ec6(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.wgsl deleted file mode 100644 index d380d9b72a..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f46ec6.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -fn textureNumLevels_f46ec6() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_f46ec6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_f46ec6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_f46ec6(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl b/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl deleted file mode 100644 index b608fff061..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; - -// fn textureNumLevels(texture: texture_depth_2d_array) -> i32 -fn textureNumLevels_f5828d() { - var res: i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_f5828d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_f5828d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_f5828d(); -} diff --git a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.glsl deleted file mode 100644 index bc9ef2b589..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureNumLevels_f5828d() { - int res = textureQueryLevels(arg_0_1); -} - -vec4 vertex_main() { - textureNumLevels_f5828d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_1; -void textureNumLevels_f5828d() { - int res = textureQueryLevels(arg_0_1); -} - -void fragment_main() { - textureNumLevels_f5828d(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2DArray arg_0_1; -void textureNumLevels_f5828d() { - int res = textureQueryLevels(arg_0_1); -} - -void compute_main() { - textureNumLevels_f5828d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.hlsl deleted file mode 100644 index 3885eb10e2..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); - -void textureNumLevels_f5828d() { - int4 tint_tmp; - arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); - int res = tint_tmp.w; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumLevels_f5828d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumLevels_f5828d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumLevels_f5828d(); - return; -} diff --git a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.msl b/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.msl deleted file mode 100644 index 6c562b82b3..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumLevels_f5828d(depth2d_array tint_symbol_1) { - int res = int(tint_symbol_1.get_num_mip_levels()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_2) { - textureNumLevels_f5828d(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { - textureNumLevels_f5828d(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { - textureNumLevels_f5828d(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.wgsl deleted file mode 100644 index 501fe61734..0000000000 --- a/test/tint/builtins/gen/textureNumLevels/f5828d.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -fn textureNumLevels_f5828d() { - var res : i32 = textureNumLevels(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumLevels_f5828d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumLevels_f5828d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumLevels_f5828d(); -} diff --git a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl b/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl deleted file mode 100644 index 3be8ac4387..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_multisampled_2d; - -// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 -fn textureNumSamples_2c6f14() { - var res: i32 = textureNumSamples(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumSamples_2c6f14(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumSamples_2c6f14(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumSamples_2c6f14(); -} diff --git a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.glsl deleted file mode 100644 index 78affad34f..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureNumSamples_2c6f14() { - int res = textureSamples(arg_0_1); -} - -vec4 vertex_main() { - textureNumSamples_2c6f14(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureSamples' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2DMS arg_0_1; -void textureNumSamples_2c6f14() { - int res = textureSamples(arg_0_1); -} - -void fragment_main() { - textureNumSamples_2c6f14(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureSamples' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureNumSamples_2c6f14() { - int res = textureSamples(arg_0_1); -} - -void compute_main() { - textureNumSamples_2c6f14(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureSamples' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.hlsl deleted file mode 100644 index 0e8148bc0d..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureNumSamples_2c6f14() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumSamples_2c6f14(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumSamples_2c6f14(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumSamples_2c6f14(); - return; -} diff --git a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.msl b/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.msl deleted file mode 100644 index 465294cca7..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumSamples_2c6f14(texture2d_ms tint_symbol_1) { - int res = int(tint_symbol_1.get_num_samples()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_ms tint_symbol_2) { - textureNumSamples_2c6f14(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { - textureNumSamples_2c6f14(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { - textureNumSamples_2c6f14(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.wgsl deleted file mode 100644 index be4993462f..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/2c6f14.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_multisampled_2d; - -fn textureNumSamples_2c6f14() { - var res : i32 = textureNumSamples(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumSamples_2c6f14(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumSamples_2c6f14(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumSamples_2c6f14(); -} diff --git a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl b/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl deleted file mode 100644 index 05af08671a..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_multisampled_2d; - -// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 -fn textureNumSamples_42f8bb() { - var res: i32 = textureNumSamples(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumSamples_42f8bb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumSamples_42f8bb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumSamples_42f8bb(); -} diff --git a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.glsl deleted file mode 100644 index 586000638a..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp usampler2DMS arg_0_1; -void textureNumSamples_42f8bb() { - int res = textureSamples(arg_0_1); -} - -vec4 vertex_main() { - textureNumSamples_42f8bb(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureSamples' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp usampler2DMS arg_0_1; -void textureNumSamples_42f8bb() { - int res = textureSamples(arg_0_1); -} - -void fragment_main() { - textureNumSamples_42f8bb(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureSamples' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp usampler2DMS arg_0_1; -void textureNumSamples_42f8bb() { - int res = textureSamples(arg_0_1); -} - -void compute_main() { - textureNumSamples_42f8bb(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureSamples' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.hlsl deleted file mode 100644 index 4d7256ea96..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureNumSamples_42f8bb() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumSamples_42f8bb(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumSamples_42f8bb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumSamples_42f8bb(); - return; -} diff --git a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.msl b/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.msl deleted file mode 100644 index 77c2cc9578..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumSamples_42f8bb(texture2d_ms tint_symbol_1) { - int res = int(tint_symbol_1.get_num_samples()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_ms tint_symbol_2) { - textureNumSamples_42f8bb(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { - textureNumSamples_42f8bb(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { - textureNumSamples_42f8bb(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.wgsl deleted file mode 100644 index ef11b63656..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/42f8bb.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_multisampled_2d; - -fn textureNumSamples_42f8bb() { - var res : i32 = textureNumSamples(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumSamples_42f8bb(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumSamples_42f8bb(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumSamples_42f8bb(); -} diff --git a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl b/test/tint/builtins/gen/textureNumSamples/449d23.wgsl deleted file mode 100644 index d0f5b5c1cb..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_multisampled_2d; - -// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 -fn textureNumSamples_449d23() { - var res: i32 = textureNumSamples(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumSamples_449d23(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumSamples_449d23(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumSamples_449d23(); -} diff --git a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.glsl deleted file mode 100644 index 84bf1dcccd..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp isampler2DMS arg_0_1; -void textureNumSamples_449d23() { - int res = textureSamples(arg_0_1); -} - -vec4 vertex_main() { - textureNumSamples_449d23(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureSamples' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp isampler2DMS arg_0_1; -void textureNumSamples_449d23() { - int res = textureSamples(arg_0_1); -} - -void fragment_main() { - textureNumSamples_449d23(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureSamples' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp isampler2DMS arg_0_1; -void textureNumSamples_449d23() { - int res = textureSamples(arg_0_1); -} - -void compute_main() { - textureNumSamples_449d23(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureSamples' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.hlsl deleted file mode 100644 index 4cbc214060..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureNumSamples_449d23() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumSamples_449d23(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumSamples_449d23(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumSamples_449d23(); - return; -} diff --git a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.msl b/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.msl deleted file mode 100644 index ef9c562780..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumSamples_449d23(texture2d_ms tint_symbol_1) { - int res = int(tint_symbol_1.get_num_samples()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_ms tint_symbol_2) { - textureNumSamples_449d23(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { - textureNumSamples_449d23(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { - textureNumSamples_449d23(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.wgsl deleted file mode 100644 index 9cab69e2c1..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/449d23.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_multisampled_2d; - -fn textureNumSamples_449d23() { - var res : i32 = textureNumSamples(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumSamples_449d23(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumSamples_449d23(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumSamples_449d23(); -} diff --git a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl b/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl deleted file mode 100644 index 3599955e1b..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; - -// fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32 -fn textureNumSamples_a3c8a0() { - var res: i32 = textureNumSamples(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumSamples_a3c8a0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumSamples_a3c8a0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumSamples_a3c8a0(); -} diff --git a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.glsl b/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.glsl deleted file mode 100644 index 03bd8d5fbf..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureNumSamples_a3c8a0() { - int res = textureSamples(arg_0_1); -} - -vec4 vertex_main() { - textureNumSamples_a3c8a0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureSamples' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2DMS arg_0_1; -void textureNumSamples_a3c8a0() { - int res = textureSamples(arg_0_1); -} - -void fragment_main() { - textureNumSamples_a3c8a0(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureSamples' : no matching overloaded function found -ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' -ERROR: 0:6: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2DMS arg_0_1; -void textureNumSamples_a3c8a0() { - int res = textureSamples(arg_0_1); -} - -void compute_main() { - textureNumSamples_a3c8a0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:5: 'textureSamples' : no matching overloaded function found -ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.hlsl b/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.hlsl deleted file mode 100644 index 106cba4713..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); - -void textureNumSamples_a3c8a0() { - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - int res = tint_tmp.z; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureNumSamples_a3c8a0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureNumSamples_a3c8a0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureNumSamples_a3c8a0(); - return; -} diff --git a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.msl b/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.msl deleted file mode 100644 index 011207af71..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureNumSamples_a3c8a0(depth2d_ms tint_symbol_1) { - int res = int(tint_symbol_1.get_num_samples()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_ms tint_symbol_2) { - textureNumSamples_a3c8a0(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { - textureNumSamples_a3c8a0(tint_symbol_4); - return; -} - -kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { - textureNumSamples_a3c8a0(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.wgsl deleted file mode 100644 index 29a914ad8b..0000000000 --- a/test/tint/builtins/gen/textureNumSamples/a3c8a0.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; - -fn textureNumSamples_a3c8a0() { - var res : i32 = textureNumSamples(arg_0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureNumSamples_a3c8a0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureNumSamples_a3c8a0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureNumSamples_a3c8a0(); -} diff --git a/test/tint/builtins/gen/textureSample/02aa9b.wgsl b/test/tint/builtins/gen/textureSample/02aa9b.wgsl deleted file mode 100644 index e392604f62..0000000000 --- a/test/tint/builtins/gen/textureSample/02aa9b.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> vec4 -fn textureSample_02aa9b() { - var res: vec4 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_02aa9b(); -} diff --git a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.glsl b/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.glsl deleted file mode 100644 index 00c91e0177..0000000000 --- a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSample_02aa9b() { - vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0)); -} - -void fragment_main() { - textureSample_02aa9b(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.hlsl deleted file mode 100644 index 1e21709ed5..0000000000 --- a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_02aa9b() { - float4 res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), int2(0, 0)); -} - -void fragment_main() { - textureSample_02aa9b(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.msl deleted file mode 100644 index 13ceaa0e5a..0000000000 --- a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_02aa9b(texture2d_array tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(), 1, int2()); -} - -fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_02aa9b(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.spvasm deleted file mode 100644 index 5a0148c52e..0000000000 --- a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.spvasm +++ /dev/null @@ -1,54 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_02aa9b "textureSample_02aa9b" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %25 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %28 = OpConstantNull %v4float -%textureSample_02aa9b = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %28 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %20 = OpConvertSToF %float %int_1 - %23 = OpCompositeConstruct %v3float %float_0 %float_0 %20 - %12 = OpImageSampleImplicitLod %v4float %17 %23 ConstOffset %25 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %30 = OpLabel - %31 = OpFunctionCall %void %textureSample_02aa9b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.wgsl deleted file mode 100644 index 855799167a..0000000000 --- a/test/tint/builtins/gen/textureSample/02aa9b.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_02aa9b() { - var res : vec4 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_02aa9b(); -} diff --git a/test/tint/builtins/gen/textureSample/100dc0.wgsl b/test/tint/builtins/gen/textureSample/100dc0.wgsl deleted file mode 100644 index 89ecf17588..0000000000 --- a/test/tint/builtins/gen/textureSample/100dc0.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, offset: vec3) -> vec4 -fn textureSample_100dc0() { - var res: vec4 = textureSample(arg_0, arg_1, vec3(), vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_100dc0(); -} diff --git a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.glsl b/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.glsl deleted file mode 100644 index 97c7b80ceb..0000000000 --- a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSample_100dc0() { - vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), ivec3(0, 0, 0)); -} - -void fragment_main() { - textureSample_100dc0(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.hlsl deleted file mode 100644 index 0e60a50697..0000000000 --- a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_100dc0() { - float4 res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, 0.0f), int3(0, 0, 0)); -} - -void fragment_main() { - textureSample_100dc0(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.msl deleted file mode 100644 index 0d15b26efc..0000000000 --- a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_100dc0(texture3d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3(), int3()); -} - -fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_100dc0(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.spvasm deleted file mode 100644 index 4639de28d3..0000000000 --- a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.spvasm +++ /dev/null @@ -1,51 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 29 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_100dc0 "textureSample_100dc0" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %19 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %22 = OpConstantNull %v3int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %25 = OpConstantNull %v4float -%textureSample_100dc0 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %25 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %12 = OpImageSampleImplicitLod %v4float %17 %19 ConstOffset %22 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %27 = OpLabel - %28 = OpFunctionCall %void %textureSample_100dc0 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.wgsl deleted file mode 100644 index b972855ab8..0000000000 --- a/test/tint/builtins/gen/textureSample/100dc0.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_100dc0() { - var res : vec4 = textureSample(arg_0, arg_1, vec3(), vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_100dc0(); -} diff --git a/test/tint/builtins/gen/textureSample/38bbb9.wgsl b/test/tint/builtins/gen/textureSample/38bbb9.wgsl deleted file mode 100644 index 3174564f99..0000000000 --- a/test/tint/builtins/gen/textureSample/38bbb9.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> f32 -fn textureSample_38bbb9() { - var res: f32 = textureSample(arg_0, arg_1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_38bbb9(); -} diff --git a/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.hlsl deleted file mode 100644 index eed7099604..0000000000 --- a/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_38bbb9() { - float res = arg_0.Sample(arg_1, float2(0.0f, 0.0f)).x; -} - -void fragment_main() { - textureSample_38bbb9(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.msl deleted file mode 100644 index 8fc7af49ef..0000000000 --- a/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_38bbb9(depth2d tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample(tint_symbol_1, float2()); -} - -fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_38bbb9(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.wgsl deleted file mode 100644 index 438d008290..0000000000 --- a/test/tint/builtins/gen/textureSample/38bbb9.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_38bbb9() { - var res : f32 = textureSample(arg_0, arg_1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_38bbb9(); -} diff --git a/test/tint/builtins/gen/textureSample/3b50bd.wgsl b/test/tint/builtins/gen/textureSample/3b50bd.wgsl deleted file mode 100644 index f0ee1c54da..0000000000 --- a/test/tint/builtins/gen/textureSample/3b50bd.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3) -> vec4 -fn textureSample_3b50bd() { - var res: vec4 = textureSample(arg_0, arg_1, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_3b50bd(); -} diff --git a/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.glsl b/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.glsl deleted file mode 100644 index 10aa7b4398..0000000000 --- a/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSample_3b50bd() { - vec4 res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureSample_3b50bd(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.hlsl deleted file mode 100644 index b52b901561..0000000000 --- a/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_3b50bd() { - float4 res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureSample_3b50bd(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.msl deleted file mode 100644 index 2d5945b1ff..0000000000 --- a/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_3b50bd(texture3d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3()); -} - -fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_3b50bd(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.wgsl deleted file mode 100644 index 03ccde3ebe..0000000000 --- a/test/tint/builtins/gen/textureSample/3b50bd.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_3b50bd() { - var res : vec4 = textureSample(arg_0, arg_1, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_3b50bd(); -} diff --git a/test/tint/builtins/gen/textureSample/4dd1bf.wgsl b/test/tint/builtins/gen/textureSample/4dd1bf.wgsl deleted file mode 100644 index 508775aa10..0000000000 --- a/test/tint/builtins/gen/textureSample/4dd1bf.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 -fn textureSample_4dd1bf() { - var res: vec4 = textureSample(arg_0, arg_1, vec3(), 1); -} - -@stage(fragment) -fn fragment_main() { - textureSample_4dd1bf(); -} diff --git a/test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.msl deleted file mode 100644 index 3424a0e059..0000000000 --- a/test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_4dd1bf(texturecube_array tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3(), 1); -} - -fragment void fragment_main(texturecube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_4dd1bf(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.wgsl deleted file mode 100644 index 77ad88a393..0000000000 --- a/test/tint/builtins/gen/textureSample/4dd1bf.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_4dd1bf() { - var res : vec4 = textureSample(arg_0, arg_1, vec3(), 1); -} - -@stage(fragment) -fn fragment_main() { - textureSample_4dd1bf(); -} diff --git a/test/tint/builtins/gen/textureSample/51b514.wgsl b/test/tint/builtins/gen/textureSample/51b514.wgsl deleted file mode 100644 index 47f972c504..0000000000 --- a/test/tint/builtins/gen/textureSample/51b514.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 -fn textureSample_51b514() { - var res: vec4 = textureSample(arg_0, arg_1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_51b514(); -} diff --git a/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.glsl b/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.glsl deleted file mode 100644 index ead0363d98..0000000000 --- a/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSample_51b514() { - vec4 res = texture(arg_0_arg_1, vec2(0.0f, 0.0f)); -} - -void fragment_main() { - textureSample_51b514(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.hlsl deleted file mode 100644 index a608c750a9..0000000000 --- a/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_51b514() { - float4 res = arg_0.Sample(arg_1, float2(0.0f, 0.0f)); -} - -void fragment_main() { - textureSample_51b514(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.msl deleted file mode 100644 index 85ec0ef4b4..0000000000 --- a/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_51b514(texture2d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2()); -} - -fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_51b514(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.wgsl deleted file mode 100644 index f866a59b78..0000000000 --- a/test/tint/builtins/gen/textureSample/51b514.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_51b514() { - var res : vec4 = textureSample(arg_0, arg_1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_51b514(); -} diff --git a/test/tint/builtins/gen/textureSample/667d76.wgsl b/test/tint/builtins/gen/textureSample/667d76.wgsl deleted file mode 100644 index f4d62ddfb4..0000000000 --- a/test/tint/builtins/gen/textureSample/667d76.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, offset: vec2) -> f32 -fn textureSample_667d76() { - var res: f32 = textureSample(arg_0, arg_1, vec2(), vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_667d76(); -} diff --git a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.glsl b/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.glsl deleted file mode 100644 index ca5c5c77c9..0000000000 --- a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSample_667d76() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), ivec2(0, 0)); -} - -void fragment_main() { - textureSample_667d76(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.hlsl deleted file mode 100644 index 6f582e3460..0000000000 --- a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_667d76() { - float res = arg_0.Sample(arg_1, float2(0.0f, 0.0f), int2(0, 0)).x; -} - -void fragment_main() { - textureSample_667d76(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.msl deleted file mode 100644 index 06381b01b6..0000000000 --- a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_667d76(depth2d tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample(tint_symbol_1, float2(), int2()); -} - -fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_667d76(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.spvasm deleted file mode 100644 index 51d8c51396..0000000000 --- a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.spvasm +++ /dev/null @@ -1,52 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 30 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_667d76 "textureSample_667d76" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %17 = OpTypeSampledImage %3 - %v2float = OpTypeVector %float 2 - %20 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %23 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %26 = OpConstantNull %float -%textureSample_667d76 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_float Function %26 - %15 = OpLoad %7 %arg_1 - %16 = OpLoad %3 %arg_0 - %18 = OpSampledImage %17 %16 %15 - %13 = OpImageSampleImplicitLod %v4float %18 %20 ConstOffset %23 - %12 = OpCompositeExtract %float %13 0 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %28 = OpLabel - %29 = OpFunctionCall %void %textureSample_667d76 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.wgsl deleted file mode 100644 index d541431fc6..0000000000 --- a/test/tint/builtins/gen/textureSample/667d76.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_667d76() { - var res : f32 = textureSample(arg_0, arg_1, vec2(), vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_667d76(); -} diff --git a/test/tint/builtins/gen/textureSample/6717ca.wgsl b/test/tint/builtins/gen/textureSample/6717ca.wgsl deleted file mode 100644 index 4180ea0ed7..0000000000 --- a/test/tint/builtins/gen/textureSample/6717ca.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 -fn textureSample_6717ca() { - var res: vec4 = textureSample(arg_0, arg_1, vec2(), 1); -} - -@stage(fragment) -fn fragment_main() { - textureSample_6717ca(); -} diff --git a/test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.msl deleted file mode 100644 index 9753b100ba..0000000000 --- a/test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_6717ca(texture2d_array tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(), 1); -} - -fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_6717ca(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.wgsl deleted file mode 100644 index b767d29334..0000000000 --- a/test/tint/builtins/gen/textureSample/6717ca.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_6717ca() { - var res : vec4 = textureSample(arg_0, arg_1, vec2(), 1); -} - -@stage(fragment) -fn fragment_main() { - textureSample_6717ca(); -} diff --git a/test/tint/builtins/gen/textureSample/6e64fb.wgsl b/test/tint/builtins/gen/textureSample/6e64fb.wgsl deleted file mode 100644 index 92ec8555da..0000000000 --- a/test/tint/builtins/gen/textureSample/6e64fb.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_1d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_1d, sampler: sampler, coords: f32) -> vec4 -fn textureSample_6e64fb() { - var res: vec4 = textureSample(arg_0, arg_1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSample_6e64fb(); -} diff --git a/test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.wgsl deleted file mode 100644 index 4d7b6ce81d..0000000000 --- a/test/tint/builtins/gen/textureSample/6e64fb.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_1d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_6e64fb() { - var res : vec4 = textureSample(arg_0, arg_1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSample_6e64fb(); -} diff --git a/test/tint/builtins/gen/textureSample/7c3baa.wgsl b/test/tint/builtins/gen/textureSample/7c3baa.wgsl deleted file mode 100644 index 14d09e4512..0000000000 --- a/test/tint/builtins/gen/textureSample/7c3baa.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, offset: vec2) -> vec4 -fn textureSample_7c3baa() { - var res: vec4 = textureSample(arg_0, arg_1, vec2(), vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_7c3baa(); -} diff --git a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.glsl b/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.glsl deleted file mode 100644 index 9d7c7492b2..0000000000 --- a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSample_7c3baa() { - vec4 res = textureOffset(arg_0_arg_1, vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -void fragment_main() { - textureSample_7c3baa(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.hlsl deleted file mode 100644 index fb6be7b9ad..0000000000 --- a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_7c3baa() { - float4 res = arg_0.Sample(arg_1, float2(0.0f, 0.0f), int2(0, 0)); -} - -void fragment_main() { - textureSample_7c3baa(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.msl deleted file mode 100644 index 2e192ca218..0000000000 --- a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_7c3baa(texture2d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(), int2()); -} - -fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_7c3baa(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.spvasm deleted file mode 100644 index fcc0c5194d..0000000000 --- a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.spvasm +++ /dev/null @@ -1,51 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 29 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_7c3baa "textureSample_7c3baa" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v2float = OpTypeVector %float 2 - %19 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %22 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %25 = OpConstantNull %v4float -%textureSample_7c3baa = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %25 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %12 = OpImageSampleImplicitLod %v4float %17 %19 ConstOffset %22 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %27 = OpLabel - %28 = OpFunctionCall %void %textureSample_7c3baa - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.wgsl deleted file mode 100644 index f4105d88d3..0000000000 --- a/test/tint/builtins/gen/textureSample/7c3baa.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_7c3baa() { - var res : vec4 = textureSample(arg_0, arg_1, vec2(), vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_7c3baa(); -} diff --git a/test/tint/builtins/gen/textureSample/7e9ffd.wgsl b/test/tint/builtins/gen/textureSample/7e9ffd.wgsl deleted file mode 100644 index 15c221cf2d..0000000000 --- a/test/tint/builtins/gen/textureSample/7e9ffd.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> f32 -fn textureSample_7e9ffd() { - var res: f32 = textureSample(arg_0, arg_1, vec2(), 1); -} - -@stage(fragment) -fn fragment_main() { - textureSample_7e9ffd(); -} diff --git a/test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.msl deleted file mode 100644 index 6b7b50bdca..0000000000 --- a/test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_7e9ffd(depth2d_array tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample(tint_symbol_1, float2(), 1); -} - -fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_7e9ffd(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.wgsl deleted file mode 100644 index ba76347178..0000000000 --- a/test/tint/builtins/gen/textureSample/7e9ffd.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_7e9ffd() { - var res : f32 = textureSample(arg_0, arg_1, vec2(), 1); -} - -@stage(fragment) -fn fragment_main() { - textureSample_7e9ffd(); -} diff --git a/test/tint/builtins/gen/textureSample/8522e7.wgsl b/test/tint/builtins/gen/textureSample/8522e7.wgsl deleted file mode 100644 index d82c289cd2..0000000000 --- a/test/tint/builtins/gen/textureSample/8522e7.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, offset: vec2) -> f32 -fn textureSample_8522e7() { - var res: f32 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_8522e7(); -} diff --git a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.glsl b/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.glsl deleted file mode 100644 index 762475e343..0000000000 --- a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.glsl +++ /dev/null @@ -1,26 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSample_8522e7() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), ivec2(0, 0)); -} - -void fragment_main() { - textureSample_8522e7(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.hlsl deleted file mode 100644 index a47e848497..0000000000 --- a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_8522e7() { - float res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, float(1)), int2(0, 0)).x; -} - -void fragment_main() { - textureSample_8522e7(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.msl deleted file mode 100644 index a2c56ffc12..0000000000 --- a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_8522e7(depth2d_array tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample(tint_symbol_1, float2(), 1, int2()); -} - -fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_8522e7(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.spvasm deleted file mode 100644 index 4a1400c1f4..0000000000 --- a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.spvasm +++ /dev/null @@ -1,55 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSample_8522e7 "textureSample_8522e7" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %17 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2int = OpTypeVector %int 2 - %26 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %29 = OpConstantNull %float -%textureSample_8522e7 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_float Function %29 - %15 = OpLoad %7 %arg_1 - %16 = OpLoad %3 %arg_0 - %18 = OpSampledImage %17 %16 %15 - %21 = OpConvertSToF %float %int_1 - %24 = OpCompositeConstruct %v3float %float_0 %float_0 %21 - %13 = OpImageSampleImplicitLod %v4float %18 %24 ConstOffset %26 - %12 = OpCompositeExtract %float %13 0 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %31 = OpLabel - %32 = OpFunctionCall %void %textureSample_8522e7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.wgsl deleted file mode 100644 index a3d93c8f81..0000000000 --- a/test/tint/builtins/gen/textureSample/8522e7.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_8522e7() { - var res : f32 = textureSample(arg_0, arg_1, vec2(), 1, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_8522e7(); -} diff --git a/test/tint/builtins/gen/textureSample/c2f4e8.wgsl b/test/tint/builtins/gen/textureSample/c2f4e8.wgsl deleted file mode 100644 index b577d22053..0000000000 --- a/test/tint/builtins/gen/textureSample/c2f4e8.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> f32 -fn textureSample_c2f4e8() { - var res: f32 = textureSample(arg_0, arg_1, vec3(), 1); -} - -@stage(fragment) -fn fragment_main() { - textureSample_c2f4e8(); -} diff --git a/test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.msl deleted file mode 100644 index 824463db88..0000000000 --- a/test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_c2f4e8(depthcube_array tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample(tint_symbol_1, float3(), 1); -} - -fragment void fragment_main(depthcube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_c2f4e8(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.wgsl deleted file mode 100644 index 0a6f332709..0000000000 --- a/test/tint/builtins/gen/textureSample/c2f4e8.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_c2f4e8() { - var res : f32 = textureSample(arg_0, arg_1, vec3(), 1); -} - -@stage(fragment) -fn fragment_main() { - textureSample_c2f4e8(); -} diff --git a/test/tint/builtins/gen/textureSample/e53267.wgsl b/test/tint/builtins/gen/textureSample/e53267.wgsl deleted file mode 100644 index 39add1398c..0000000000 --- a/test/tint/builtins/gen/textureSample/e53267.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 -fn textureSample_e53267() { - var res: vec4 = textureSample(arg_0, arg_1, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_e53267(); -} diff --git a/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.glsl b/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.glsl deleted file mode 100644 index 43ac089e0e..0000000000 --- a/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_arg_1; - -void textureSample_e53267() { - vec4 res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureSample_e53267(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.hlsl deleted file mode 100644 index bd516608a1..0000000000 --- a/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_e53267() { - float4 res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureSample_e53267(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.msl deleted file mode 100644 index b7190c8500..0000000000 --- a/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_e53267(texturecube tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3()); -} - -fragment void fragment_main(texturecube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_e53267(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.wgsl deleted file mode 100644 index b1d17e78d4..0000000000 --- a/test/tint/builtins/gen/textureSample/e53267.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_e53267() { - var res : vec4 = textureSample(arg_0, arg_1, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_e53267(); -} diff --git a/test/tint/builtins/gen/textureSample/ea7030.wgsl b/test/tint/builtins/gen/textureSample/ea7030.wgsl deleted file mode 100644 index ebd9e50c57..0000000000 --- a/test/tint/builtins/gen/textureSample/ea7030.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> f32 -fn textureSample_ea7030() { - var res: f32 = textureSample(arg_0, arg_1, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_ea7030(); -} diff --git a/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.hlsl deleted file mode 100644 index f01c286204..0000000000 --- a/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSample_ea7030() { - float res = arg_0.Sample(arg_1, float3(0.0f, 0.0f, 0.0f)).x; -} - -void fragment_main() { - textureSample_ea7030(); - return; -} diff --git a/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.msl b/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.msl deleted file mode 100644 index 3497e1566c..0000000000 --- a/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSample_ea7030(depthcube tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample(tint_symbol_1, float3()); -} - -fragment void fragment_main(depthcube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSample_ea7030(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.wgsl deleted file mode 100644 index 4fffe530b2..0000000000 --- a/test/tint/builtins/gen/textureSample/ea7030.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSample_ea7030() { - var res : f32 = textureSample(arg_0, arg_1, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSample_ea7030(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl b/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl deleted file mode 100644 index 18c60e7d67..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_cube, sampler: sampler, coords: vec3, bias: f32) -> vec4 -fn textureSampleBias_53b9f7() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_53b9f7(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.glsl deleted file mode 100644 index b85dbcd418..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_arg_1; - -void textureSampleBias_53b9f7() { - vec4 res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleBias_53b9f7(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.hlsl deleted file mode 100644 index f5fecb41a9..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleBias_53b9f7() { - float4 res = arg_0.SampleBias(arg_1, float3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleBias_53b9f7(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.msl deleted file mode 100644 index 675e006688..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_53b9f7(texturecube tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3(), bias(1.0f)); -} - -fragment void fragment_main(texturecube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_53b9f7(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.wgsl deleted file mode 100644 index 58e2030565..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/53b9f7.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_53b9f7() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_53b9f7(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl b/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl deleted file mode 100644 index 42615671b3..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, offset: vec2) -> vec4 -fn textureSampleBias_65ac50() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_65ac50(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.glsl deleted file mode 100644 index 9a0a158ca1..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleBias_65ac50() { - vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), ivec2(0, 0), 1.0f); -} - -void fragment_main() { - textureSampleBias_65ac50(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.hlsl deleted file mode 100644 index f2e3c1dfa5..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleBias_65ac50() { - float4 res = arg_0.SampleBias(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, int2(0, 0)); -} - -void fragment_main() { - textureSampleBias_65ac50(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.msl deleted file mode 100644 index ee8021382f..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_65ac50(texture2d_array tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(), 1, bias(1.0f), int2()); -} - -fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_65ac50(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.spvasm deleted file mode 100644 index 9b83b1fa82..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.spvasm +++ /dev/null @@ -1,55 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleBias_65ac50 "textureSampleBias_65ac50" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %26 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %29 = OpConstantNull %v4float -%textureSampleBias_65ac50 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %29 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %20 = OpConvertSToF %float %int_1 - %23 = OpCompositeConstruct %v3float %float_0 %float_0 %20 - %12 = OpImageSampleImplicitLod %v4float %17 %23 Bias|ConstOffset %float_1 %26 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %31 = OpLabel - %32 = OpFunctionCall %void %textureSampleBias_65ac50 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.wgsl deleted file mode 100644 index ca8e190b66..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/65ac50.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_65ac50() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_65ac50(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl b/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl deleted file mode 100644 index 8366a13ac7..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32) -> vec4 -fn textureSampleBias_6a9113() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_6a9113(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.glsl deleted file mode 100644 index 2420cc9341..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleBias_6a9113() { - vec4 res = texture(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleBias_6a9113(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.hlsl deleted file mode 100644 index 39fe8c0835..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleBias_6a9113() { - float4 res = arg_0.SampleBias(arg_1, float2(0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleBias_6a9113(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.msl deleted file mode 100644 index aae831bb7f..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_6a9113(texture2d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(), bias(1.0f)); -} - -fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_6a9113(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.wgsl deleted file mode 100644 index a5ff76e529..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/6a9113.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_6a9113() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_6a9113(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/80e579.wgsl b/test/tint/builtins/gen/textureSampleBias/80e579.wgsl deleted file mode 100644 index bdf66214f7..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/80e579.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32) -> vec4 -fn textureSampleBias_80e579() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_80e579(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.msl deleted file mode 100644 index 357833db91..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_80e579(texture2d_array tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(), 1, bias(1.0f)); -} - -fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_80e579(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.wgsl deleted file mode 100644 index 164c81e917..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/80e579.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_80e579() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_80e579(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl b/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl deleted file mode 100644 index 1404fe96e8..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, offset: vec2) -> vec4 -fn textureSampleBias_81c19a() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_81c19a(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.glsl deleted file mode 100644 index 6672660fa6..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleBias_81c19a() { - vec4 res = textureOffset(arg_0_arg_1, vec2(0.0f, 0.0f), ivec2(0, 0), 1.0f); -} - -void fragment_main() { - textureSampleBias_81c19a(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.hlsl deleted file mode 100644 index 4c7b4dff13..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleBias_81c19a() { - float4 res = arg_0.SampleBias(arg_1, float2(0.0f, 0.0f), 1.0f, int2(0, 0)); -} - -void fragment_main() { - textureSampleBias_81c19a(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.msl deleted file mode 100644 index 2d6dacdd03..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_81c19a(texture2d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float2(), bias(1.0f), int2()); -} - -fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_81c19a(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.spvasm deleted file mode 100644 index 84424e35ec..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.spvasm +++ /dev/null @@ -1,52 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 30 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleBias_81c19a "textureSampleBias_81c19a" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v2float = OpTypeVector %float 2 - %19 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %23 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %26 = OpConstantNull %v4float -%textureSampleBias_81c19a = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %26 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %12 = OpImageSampleImplicitLod %v4float %17 %19 Bias|ConstOffset %float_1 %23 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %28 = OpLabel - %29 = OpFunctionCall %void %textureSampleBias_81c19a - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.wgsl deleted file mode 100644 index 2719198c9e..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/81c19a.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_81c19a() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_81c19a(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl b/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl deleted file mode 100644 index c35677ced3..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32) -> vec4 -fn textureSampleBias_d3fa1b() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_d3fa1b(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.glsl deleted file mode 100644 index 0530165953..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleBias_d3fa1b() { - vec4 res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleBias_d3fa1b(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.hlsl deleted file mode 100644 index 5d08b9dffb..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleBias_d3fa1b() { - float4 res = arg_0.SampleBias(arg_1, float3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleBias_d3fa1b(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.msl deleted file mode 100644 index 80a9324d40..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_d3fa1b(texture3d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3(), bias(1.0f)); -} - -fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_d3fa1b(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.wgsl deleted file mode 100644 index 7a07c3093d..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/d3fa1b.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_d3fa1b() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_d3fa1b(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl b/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl deleted file mode 100644 index 0232d0aa52..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, offset: vec3) -> vec4 -fn textureSampleBias_df91bb() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_df91bb(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.glsl deleted file mode 100644 index e68a55142f..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleBias_df91bb() { - vec4 res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), ivec3(0, 0, 0), 1.0f); -} - -void fragment_main() { - textureSampleBias_df91bb(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.hlsl deleted file mode 100644 index c1ea919317..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleBias_df91bb() { - float4 res = arg_0.SampleBias(arg_1, float3(0.0f, 0.0f, 0.0f), 1.0f, int3(0, 0, 0)); -} - -void fragment_main() { - textureSampleBias_df91bb(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.msl deleted file mode 100644 index 312611422a..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_df91bb(texture3d tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3(), bias(1.0f), int3()); -} - -fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_df91bb(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.spvasm deleted file mode 100644 index 3b58d2d5b8..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.spvasm +++ /dev/null @@ -1,52 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 30 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleBias_df91bb "textureSampleBias_df91bb" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %v4float = OpTypeVector %float 4 - %16 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %19 = OpConstantNull %v3float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %23 = OpConstantNull %v3int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %26 = OpConstantNull %v4float -%textureSampleBias_df91bb = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %26 - %14 = OpLoad %7 %arg_1 - %15 = OpLoad %3 %arg_0 - %17 = OpSampledImage %16 %15 %14 - %12 = OpImageSampleImplicitLod %v4float %17 %19 Bias|ConstOffset %float_1 %23 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %28 = OpLabel - %29 = OpFunctionCall %void %textureSampleBias_df91bb - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.wgsl deleted file mode 100644 index 9f530da746..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/df91bb.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_df91bb() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1.0, vec3()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_df91bb(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl b/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl deleted file mode 100644 index bbc1ad7de6..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleBias(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, bias: f32) -> vec4 -fn textureSampleBias_eed7c4() { - var res: vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_eed7c4(); -} diff --git a/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.msl deleted file mode 100644 index 123b4f105a..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleBias_eed7c4(texturecube_array tint_symbol, sampler tint_symbol_1) { - float4 res = tint_symbol.sample(tint_symbol_1, float3(), 1, bias(1.0f)); -} - -fragment void fragment_main(texturecube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleBias_eed7c4(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.wgsl deleted file mode 100644 index e2c3aa7712..0000000000 --- a/test/tint/builtins/gen/textureSampleBias/eed7c4.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleBias_eed7c4() { - var res : vec4 = textureSampleBias(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleBias_eed7c4(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl b/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl deleted file mode 100644 index a5b48036c9..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 -fn textureSampleCompare_25fcd1() { - var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_25fcd1(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.glsl deleted file mode 100644 index 9e4ad0c446..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompare_25fcd1() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0, 0)); -} - -void fragment_main() { - textureSampleCompare_25fcd1(); -} - -void main() { - fragment_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.hlsl deleted file mode 100644 index 98685b6922..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompare_25fcd1() { - float res = arg_0.SampleCmp(arg_1, float2(0.0f, 0.0f), 1.0f, int2(0, 0)); -} - -void fragment_main() { - textureSampleCompare_25fcd1(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.msl deleted file mode 100644 index f076683192..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompare_25fcd1(depth2d tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample_compare(tint_symbol_1, float2(), 1.0f, int2()); -} - -fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleCompare_25fcd1(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.spvasm deleted file mode 100644 index 9fff619371..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.spvasm +++ /dev/null @@ -1,51 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 29 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleCompare_25fcd1 "textureSampleCompare_25fcd1" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %15 = OpTypeSampledImage %3 - %v2float = OpTypeVector %float 2 - %18 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %22 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %25 = OpConstantNull %float -%textureSampleCompare_25fcd1 = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_float Function %25 - %13 = OpLoad %7 %arg_1 - %14 = OpLoad %3 %arg_0 - %16 = OpSampledImage %15 %14 %13 - %12 = OpImageSampleDrefImplicitLod %float %16 %18 %float_1 ConstOffset %22 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %27 = OpLabel - %28 = OpFunctionCall %void %textureSampleCompare_25fcd1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.wgsl deleted file mode 100644 index 532be33609..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/25fcd1.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompare_25fcd1() { - var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_25fcd1(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl b/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl deleted file mode 100644 index 7c8fda5e7b..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 -fn textureSampleCompare_3a5923() { - var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_3a5923(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.hlsl deleted file mode 100644 index f34e7be963..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompare_3a5923() { - float res = arg_0.SampleCmp(arg_1, float2(0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleCompare_3a5923(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.msl deleted file mode 100644 index eb88f71197..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompare_3a5923(depth2d tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample_compare(tint_symbol_1, float2(), 1.0f); -} - -fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleCompare_3a5923(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.wgsl deleted file mode 100644 index eb88140083..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/3a5923.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompare_3a5923() { - var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_3a5923(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl b/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl deleted file mode 100644 index 163731a766..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 -fn textureSampleCompare_63fb83() { - var res: f32 = textureSampleCompare(arg_0, arg_1, vec3(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_63fb83(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.hlsl deleted file mode 100644 index 4df9a68ffa..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompare_63fb83() { - float res = arg_0.SampleCmp(arg_1, float3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleCompare_63fb83(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.msl deleted file mode 100644 index a0bb49bc55..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompare_63fb83(depthcube tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample_compare(tint_symbol_1, float3(), 1.0f); -} - -fragment void fragment_main(depthcube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleCompare_63fb83(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.wgsl deleted file mode 100644 index 38e555e2e1..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/63fb83.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompare_63fb83() { - var res : f32 = textureSampleCompare(arg_0, arg_1, vec3(), 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_63fb83(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl b/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl deleted file mode 100644 index a21c6e9659..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 -fn textureSampleCompare_98b85c() { - var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_98b85c(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.glsl deleted file mode 100644 index 00647179a3..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.glsl +++ /dev/null @@ -1,26 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompare_98b85c() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0, 0)); -} - -void fragment_main() { - textureSampleCompare_98b85c(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.hlsl deleted file mode 100644 index 51f701e638..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompare_98b85c() { - float res = arg_0.SampleCmp(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, int2(0, 0)); -} - -void fragment_main() { - textureSampleCompare_98b85c(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.msl deleted file mode 100644 index d92c04ce1f..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompare_98b85c(depth2d_array tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample_compare(tint_symbol_1, float2(), 1, 1.0f, int2()); -} - -fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleCompare_98b85c(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.spvasm deleted file mode 100644 index d0f924cf92..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.spvasm +++ /dev/null @@ -1,54 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %fragment_main "fragment_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleCompare_98b85c "textureSampleCompare_98b85c" - OpName %res "res" - OpName %fragment_main "fragment_main" - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %3 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 - %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant - %7 = OpTypeSampler -%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 - %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant - %void = OpTypeVoid - %8 = OpTypeFunction %void - %15 = OpTypeSampledImage %3 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %25 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %28 = OpConstantNull %float -%textureSampleCompare_98b85c = OpFunction %void None %8 - %11 = OpLabel - %res = OpVariable %_ptr_Function_float Function %28 - %13 = OpLoad %7 %arg_1 - %14 = OpLoad %3 %arg_0 - %16 = OpSampledImage %15 %14 %13 - %19 = OpConvertSToF %float %int_1 - %22 = OpCompositeConstruct %v3float %float_0 %float_0 %19 - %12 = OpImageSampleDrefImplicitLod %float %16 %22 %float_1 ConstOffset %25 - OpStore %res %12 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %8 - %30 = OpLabel - %31 = OpFunctionCall %void %textureSampleCompare_98b85c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.wgsl deleted file mode 100644 index de96847f64..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/98b85c.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompare_98b85c() { - var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_98b85c(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl b/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl deleted file mode 100644 index 24aa9b5b4f..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 -fn textureSampleCompare_a3ca7e() { - var res: f32 = textureSampleCompare(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_a3ca7e(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.msl deleted file mode 100644 index abb06a0e97..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompare_a3ca7e(depthcube_array tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample_compare(tint_symbol_1, float3(), 1, 1.0f); -} - -fragment void fragment_main(depthcube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleCompare_a3ca7e(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.wgsl deleted file mode 100644 index 5dc12e5516..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/a3ca7e.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompare_a3ca7e() { - var res : f32 = textureSampleCompare(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_a3ca7e(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl b/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl deleted file mode 100644 index 53015a42bf..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 -fn textureSampleCompare_dd431d() { - var res: f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_dd431d(); -} diff --git a/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.msl deleted file mode 100644 index 3b9cc896ef..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompare_dd431d(depth2d_array tint_symbol, sampler tint_symbol_1) { - float res = tint_symbol.sample_compare(tint_symbol_1, float2(), 1, 1.0f); -} - -fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { - textureSampleCompare_dd431d(tint_symbol_2, tint_symbol_3); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.wgsl deleted file mode 100644 index f36d443315..0000000000 --- a/test/tint/builtins/gen/textureSampleCompare/dd431d.wgsl.expected.wgsl +++ /dev/null @@ -1,12 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompare_dd431d() { - var res : f32 = textureSampleCompare(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompare_dd431d(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl deleted file mode 100644 index a6fa885a8b..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, offset: vec2) -> f32 -fn textureSampleCompareLevel_011a8f() { - var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_011a8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_011a8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_011a8f(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.glsl deleted file mode 100644 index 6bc5a40084..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_011a8f() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0, 0)); -} - -vec4 vertex_main() { - textureSampleCompareLevel_011a8f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_011a8f() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0, 0)); -} - -void fragment_main() { - textureSampleCompareLevel_011a8f(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_011a8f() { - float res = textureOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f), ivec2(0, 0)); -} - -void compute_main() { - textureSampleCompareLevel_011a8f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.hlsl deleted file mode 100644 index 8662f0c6fd..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompareLevel_011a8f() { - float res = arg_0.SampleCmpLevelZero(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleCompareLevel_011a8f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleCompareLevel_011a8f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleCompareLevel_011a8f(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.msl deleted file mode 100644 index 07485ae20b..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompareLevel_011a8f(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(), 1, 1.0f, level(0), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleCompareLevel_011a8f(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleCompareLevel_011a8f(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleCompareLevel_011a8f(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.spvasm deleted file mode 100644 index 47d942ccd0..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleCompareLevel_011a8f "textureSampleCompareLevel_011a8f" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %35 = OpTypeFunction %v4float -%textureSampleCompareLevel_011a8f = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageSampleDrefExplicitLod %float %23 %29 %float_1 Lod|ConstOffset %float_0 %32 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureSampleCompareLevel_011a8f - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleCompareLevel_011a8f - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureSampleCompareLevel_011a8f - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.wgsl deleted file mode 100644 index d98d813b5d..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/011a8f.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompareLevel_011a8f() { - var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_011a8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_011a8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_011a8f(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl deleted file mode 100644 index 126cedc97a..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 -fn textureSampleCompareLevel_1116ed() { - var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_1116ed(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_1116ed(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_1116ed(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.glsl deleted file mode 100644 index cab593f0f7..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_1116ed() { - float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f)); -} - -vec4 vertex_main() { - textureSampleCompareLevel_1116ed(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_1116ed() { - float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f)); -} - -void fragment_main() { - textureSampleCompareLevel_1116ed(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_1116ed() { - float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 1.0f)); -} - -void compute_main() { - textureSampleCompareLevel_1116ed(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl deleted file mode 100644 index b37ef587cd..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompareLevel_1116ed() { - float res = arg_0.SampleCmpLevelZero(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleCompareLevel_1116ed(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleCompareLevel_1116ed(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleCompareLevel_1116ed(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.msl deleted file mode 100644 index afa4f782f8..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompareLevel_1116ed(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(), 1, 1.0f, level(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleCompareLevel_1116ed(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleCompareLevel_1116ed(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleCompareLevel_1116ed(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl deleted file mode 100644 index 97ee86714d..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompareLevel_1116ed() { - var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_1116ed(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_1116ed(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_1116ed(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl deleted file mode 100644 index 1525450b32..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 -fn textureSampleCompareLevel_1568e3() { - var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_1568e3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_1568e3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_1568e3(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.glsl deleted file mode 100644 index a504902f5e..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureSampleCompareLevel_1568e3() { - float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 1.0f)); -} - -vec4 vertex_main() { - textureSampleCompareLevel_1568e3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureSampleCompareLevel_1568e3() { - float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 1.0f)); -} - -void fragment_main() { - textureSampleCompareLevel_1568e3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureSampleCompareLevel_1568e3() { - float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 1.0f)); -} - -void compute_main() { - textureSampleCompareLevel_1568e3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl deleted file mode 100644 index 0596d33d4a..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompareLevel_1568e3() { - float res = arg_0.SampleCmpLevelZero(arg_1, float3(0.0f, 0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleCompareLevel_1568e3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleCompareLevel_1568e3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleCompareLevel_1568e3(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.msl deleted file mode 100644 index 3c3babe1a8..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompareLevel_1568e3(depthcube tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample_compare(tint_symbol_2, float3(), 1.0f, level(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { - textureSampleCompareLevel_1568e3(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleCompareLevel_1568e3(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleCompareLevel_1568e3(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl deleted file mode 100644 index ff5e88df3f..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompareLevel_1568e3() { - var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_1568e3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_1568e3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_1568e3(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl deleted file mode 100644 index b03768d3e1..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 -fn textureSampleCompareLevel_2ad2b1() { - var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_2ad2b1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_2ad2b1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_2ad2b1(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl deleted file mode 100644 index 929a63f09b..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompareLevel_2ad2b1() { - float res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f)); -} - -vec4 vertex_main() { - textureSampleCompareLevel_2ad2b1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompareLevel_2ad2b1() { - float res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f)); -} - -void fragment_main() { - textureSampleCompareLevel_2ad2b1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompareLevel_2ad2b1() { - float res = texture(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f)); -} - -void compute_main() { - textureSampleCompareLevel_2ad2b1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl deleted file mode 100644 index 9b86db7cbf..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompareLevel_2ad2b1() { - float res = arg_0.SampleCmpLevelZero(arg_1, float2(0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleCompareLevel_2ad2b1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleCompareLevel_2ad2b1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleCompareLevel_2ad2b1(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl deleted file mode 100644 index 0757bfe25d..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompareLevel_2ad2b1(depth2d tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(), 1.0f, level(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleCompareLevel_2ad2b1(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleCompareLevel_2ad2b1(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleCompareLevel_2ad2b1(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl deleted file mode 100644 index 76fe2cbea8..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompareLevel_2ad2b1() { - var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_2ad2b1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_2ad2b1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_2ad2b1(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl deleted file mode 100644 index 46931cbd12..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 -fn textureSampleCompareLevel_4cf3a2() { - var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_4cf3a2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_4cf3a2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_4cf3a2(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl deleted file mode 100644 index bdb0e8cefd..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_4cf3a2() { - float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -vec4 vertex_main() { - textureSampleCompareLevel_4cf3a2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_4cf3a2() { - float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -void fragment_main() { - textureSampleCompareLevel_4cf3a2(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureSampleCompareLevel_4cf3a2() { - float res = texture(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -void compute_main() { - textureSampleCompareLevel_4cf3a2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl deleted file mode 100644 index 6429d444b7..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompareLevel_4cf3a2() { - float res = arg_0.SampleCmpLevelZero(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleCompareLevel_4cf3a2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleCompareLevel_4cf3a2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleCompareLevel_4cf3a2(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl deleted file mode 100644 index a2db2a966c..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompareLevel_4cf3a2(depthcube_array tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample_compare(tint_symbol_2, float3(), 1, 1.0f, level(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleCompareLevel_4cf3a2(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleCompareLevel_4cf3a2(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleCompareLevel_4cf3a2(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl deleted file mode 100644 index 1fb3470f0e..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompareLevel_4cf3a2() { - var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_4cf3a2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_4cf3a2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_4cf3a2(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl deleted file mode 100644 index 50fbbe1fdf..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler_comparison; - -// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, offset: vec2) -> f32 -fn textureSampleCompareLevel_f8121c() { - var res: f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_f8121c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_f8121c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_f8121c(); -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.glsl deleted file mode 100644 index b026ab00cf..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompareLevel_f8121c() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0, 0)); -} - -vec4 vertex_main() { - textureSampleCompareLevel_f8121c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompareLevel_f8121c() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0, 0)); -} - -void fragment_main() { - textureSampleCompareLevel_f8121c(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleCompareLevel_f8121c() { - float res = textureOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 1.0f), ivec2(0, 0)); -} - -void compute_main() { - textureSampleCompareLevel_f8121c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.hlsl deleted file mode 100644 index a96b6312fe..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerComparisonState arg_1 : register(s1, space1); - -void textureSampleCompareLevel_f8121c() { - float res = arg_0.SampleCmpLevelZero(arg_1, float2(0.0f, 0.0f), 1.0f, int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleCompareLevel_f8121c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleCompareLevel_f8121c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleCompareLevel_f8121c(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.msl deleted file mode 100644 index c72e97bfb3..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleCompareLevel_f8121c(depth2d tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample_compare(tint_symbol_2, float2(), 1.0f, level(0), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleCompareLevel_f8121c(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleCompareLevel_f8121c(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleCompareLevel_f8121c(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.spvasm deleted file mode 100644 index e74be2ed1d..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleCompareLevel_f8121c "textureSampleCompareLevel_f8121c" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %30 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %33 = OpTypeFunction %v4float -%textureSampleCompareLevel_f8121c = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleDrefExplicitLod %float %23 %25 %float_1 Lod|ConstOffset %float_0 %30 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureSampleCompareLevel_f8121c - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureSampleCompareLevel_f8121c - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureSampleCompareLevel_f8121c - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.wgsl deleted file mode 100644 index a63e6b36cf..0000000000 --- a/test/tint/builtins/gen/textureSampleCompareLevel/f8121c.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler_comparison; - -fn textureSampleCompareLevel_f8121c() { - var res : f32 = textureSampleCompareLevel(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleCompareLevel_f8121c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleCompareLevel_f8121c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleCompareLevel_f8121c(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl b/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl deleted file mode 100644 index ca02ceee79..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 -fn textureSampleGrad_21402b() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_21402b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_21402b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_21402b(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.glsl deleted file mode 100644 index e40ae0f057..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleGrad_21402b() { - vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureSampleGrad_21402b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleGrad_21402b() { - vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureSampleGrad_21402b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleGrad_21402b() { - vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureSampleGrad_21402b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.hlsl deleted file mode 100644 index d983c7549c..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_21402b() { - float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_21402b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_21402b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_21402b(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.msl deleted file mode 100644 index 611f192f40..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_21402b(texture3d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(), gradient3d(float3(), float3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_21402b(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_21402b(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_21402b(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.wgsl deleted file mode 100644 index c5e185ca06..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/21402b.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_21402b() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_21402b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_21402b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_21402b(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl b/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl deleted file mode 100644 index b68b12e4ab..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2) -> vec4 -fn textureSampleGrad_2ecd8f() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_2ecd8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_2ecd8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_2ecd8f(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.glsl deleted file mode 100644 index c250eff06b..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleGrad_2ecd8f() { - vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureSampleGrad_2ecd8f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleGrad_2ecd8f() { - vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - textureSampleGrad_2ecd8f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleGrad_2ecd8f() { - vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - textureSampleGrad_2ecd8f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.hlsl deleted file mode 100644 index 618dadc6a1..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_2ecd8f() { - float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, float(1)), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_2ecd8f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_2ecd8f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_2ecd8f(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.msl deleted file mode 100644 index cb35a40226..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_2ecd8f(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(), 1, gradient2d(float2(), float2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_2ecd8f(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_2ecd8f(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_2ecd8f(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.wgsl deleted file mode 100644 index 233ce18732..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/2ecd8f.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_2ecd8f() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_2ecd8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_2ecd8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_2ecd8f(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl b/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl deleted file mode 100644 index a15d5446fe..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 -fn textureSampleGrad_468f88() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_468f88(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_468f88(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_468f88(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.glsl deleted file mode 100644 index 84a91408b4..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleGrad_468f88() { - vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -vec4 vertex_main() { - textureSampleGrad_468f88(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleGrad_468f88() { - vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -void fragment_main() { - textureSampleGrad_468f88(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleGrad_468f88() { - vec4 res = textureGradOffset(arg_0_arg_1, vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -void compute_main() { - textureSampleGrad_468f88(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.hlsl deleted file mode 100644 index a3aa56facb..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_468f88() { - float4 res = arg_0.SampleGrad(arg_1, float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_468f88(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_468f88(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_468f88(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.msl deleted file mode 100644 index 984039bb85..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_468f88(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(), gradient2d(float2(), float2()), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_468f88(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_468f88(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_468f88(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.spvasm deleted file mode 100644 index 9caa2c3a11..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleGrad_468f88 "textureSampleGrad_468f88" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %28 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %31 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleGrad_468f88 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleExplicitLod %v4float %23 %25 Grad|ConstOffset %25 %25 %28 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %31 - %33 = OpLabel - %34 = OpFunctionCall %void %textureSampleGrad_468f88 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %36 = OpLabel - %37 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %37 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureSampleGrad_468f88 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleGrad_468f88 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.wgsl deleted file mode 100644 index fc63b372a9..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/468f88.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_468f88() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_468f88(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_468f88(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_468f88(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl b/test/tint/builtins/gen/textureSampleGrad/521263.wgsl deleted file mode 100644 index 37946854bb..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2) -> vec4 -fn textureSampleGrad_521263() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_521263(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_521263(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_521263(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.glsl deleted file mode 100644 index 874a6e5ed8..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleGrad_521263() { - vec4 res = textureGrad(arg_0_arg_1, vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureSampleGrad_521263(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleGrad_521263() { - vec4 res = textureGrad(arg_0_arg_1, vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void fragment_main() { - textureSampleGrad_521263(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleGrad_521263() { - vec4 res = textureGrad(arg_0_arg_1, vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); -} - -void compute_main() { - textureSampleGrad_521263(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.hlsl deleted file mode 100644 index 434705bf94..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_521263() { - float4 res = arg_0.SampleGrad(arg_1, float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_521263(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_521263(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_521263(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.msl deleted file mode 100644 index fdf14137f5..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_521263(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(), gradient2d(float2(), float2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_521263(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_521263(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_521263(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.wgsl deleted file mode 100644 index f440117500..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/521263.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_521263() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_521263(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_521263(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_521263(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl b/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl deleted file mode 100644 index 03e79302a5..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_cube, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 -fn textureSampleGrad_5312f4() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_5312f4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_5312f4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_5312f4(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.glsl deleted file mode 100644 index 3bf3809bd7..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp samplerCube arg_0_arg_1; - -void textureSampleGrad_5312f4() { - vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureSampleGrad_5312f4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_arg_1; - -void textureSampleGrad_5312f4() { - vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureSampleGrad_5312f4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCube arg_0_arg_1; - -void textureSampleGrad_5312f4() { - vec4 res = textureGrad(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureSampleGrad_5312f4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.hlsl deleted file mode 100644 index 279979df18..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_5312f4() { - float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_5312f4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_5312f4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_5312f4(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.msl deleted file mode 100644 index e76967f74d..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_5312f4(texturecube tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(), gradientcube(float3(), float3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_5312f4(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_5312f4(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_5312f4(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.wgsl deleted file mode 100644 index 22507b7a62..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/5312f4.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_5312f4() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_5312f4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_5312f4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_5312f4(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl b/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl deleted file mode 100644 index 13fa7379bd..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, offset: vec2) -> vec4 -fn textureSampleGrad_872f00() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_872f00(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_872f00(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_872f00(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.glsl deleted file mode 100644 index 9a58c71b52..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleGrad_872f00() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -vec4 vertex_main() { - textureSampleGrad_872f00(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleGrad_872f00() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -void fragment_main() { - textureSampleGrad_872f00(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleGrad_872f00() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), ivec2(0, 0)); -} - -void compute_main() { - textureSampleGrad_872f00(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.hlsl deleted file mode 100644 index 6768f3a968..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_872f00() { - float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, float(1)), float2(0.0f, 0.0f), float2(0.0f, 0.0f), int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_872f00(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_872f00(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_872f00(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.msl deleted file mode 100644 index c4756df015..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_872f00(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(), 1, gradient2d(float2(), float2()), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_872f00(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_872f00(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_872f00(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.spvasm deleted file mode 100644 index 8fb8f21b34..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.spvasm +++ /dev/null @@ -1,90 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 50 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleGrad_872f00 "textureSampleGrad_872f00" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %v2float = OpTypeVector %float 2 - %31 = OpConstantNull %v2float - %v2int = OpTypeVector %int 2 - %33 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %36 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleGrad_872f00 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageSampleExplicitLod %v4float %23 %29 Grad|ConstOffset %31 %31 %33 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %36 - %38 = OpLabel - %39 = OpFunctionCall %void %textureSampleGrad_872f00 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %42 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %45 = OpLabel - %46 = OpFunctionCall %void %textureSampleGrad_872f00 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %48 = OpLabel - %49 = OpFunctionCall %void %textureSampleGrad_872f00 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.wgsl deleted file mode 100644 index 095fe4fb4b..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/872f00.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_872f00() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec2(), 1, vec2(), vec2(), vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_872f00(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_872f00(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_872f00(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl b/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl deleted file mode 100644 index 4e2e62ae24..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, ddx: vec3, ddy: vec3) -> vec4 -fn textureSampleGrad_e383db() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), 1, vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_e383db(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_e383db(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_e383db(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.glsl deleted file mode 100644 index f55321046e..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_arg_1; - -void textureSampleGrad_e383db() { - vec4 res = textureGrad(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureSampleGrad_e383db(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_arg_1; - -void textureSampleGrad_e383db() { - vec4 res = textureGrad(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureSampleGrad_e383db(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_arg_1; - -void textureSampleGrad_e383db() { - vec4 res = textureGrad(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureSampleGrad_e383db(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.hlsl deleted file mode 100644 index 72c2207d94..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_e383db() { - float4 res = arg_0.SampleGrad(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_e383db(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_e383db(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_e383db(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.msl deleted file mode 100644 index 0df18f03b0..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_e383db(texturecube_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(), 1, gradientcube(float3(), float3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_e383db(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_e383db(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_e383db(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.wgsl deleted file mode 100644 index dad5f7ff32..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e383db.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_e383db() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), 1, vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_e383db(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_e383db(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_e383db(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl b/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl deleted file mode 100644 index 0b0c659ca0..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, offset: vec3) -> vec4 -fn textureSampleGrad_e9a2f7() { - var res: vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_e9a2f7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_e9a2f7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_e9a2f7(); -} diff --git a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.glsl deleted file mode 100644 index 63205153eb..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleGrad_e9a2f7() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - textureSampleGrad_e9a2f7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleGrad_e9a2f7() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), ivec3(0, 0, 0)); -} - -void fragment_main() { - textureSampleGrad_e9a2f7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleGrad_e9a2f7() { - vec4 res = textureGradOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), ivec3(0, 0, 0)); -} - -void compute_main() { - textureSampleGrad_e9a2f7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.hlsl deleted file mode 100644 index a3855dd8a5..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleGrad_e9a2f7() { - float4 res = arg_0.SampleGrad(arg_1, float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleGrad_e9a2f7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleGrad_e9a2f7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleGrad_e9a2f7(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.msl deleted file mode 100644 index 8c31911f3c..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleGrad_e9a2f7(texture3d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(), gradient3d(float3(), float3()), int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { - textureSampleGrad_e9a2f7(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleGrad_e9a2f7(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleGrad_e9a2f7(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.spvasm deleted file mode 100644 index a54c398690..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleGrad_e9a2f7 "textureSampleGrad_e9a2f7" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %25 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %28 = OpConstantNull %v3int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %31 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleGrad_e9a2f7 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleExplicitLod %v4float %23 %25 Grad|ConstOffset %25 %25 %28 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %31 - %33 = OpLabel - %34 = OpFunctionCall %void %textureSampleGrad_e9a2f7 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %36 = OpLabel - %37 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %37 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureSampleGrad_e9a2f7 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleGrad_e9a2f7 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.wgsl deleted file mode 100644 index 4336d026ac..0000000000 --- a/test/tint/builtins/gen/textureSampleGrad/e9a2f7.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleGrad_e9a2f7() { - var res : vec4 = textureSampleGrad(arg_0, arg_1, vec3(), vec3(), vec3(), vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleGrad_e9a2f7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleGrad_e9a2f7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleGrad_e9a2f7(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl b/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl deleted file mode 100644 index 6bce2c61bc..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32) -> f32 -fn textureSampleLevel_02be59() { - var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_02be59(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_02be59(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_02be59(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.glsl deleted file mode 100644 index 6556ad0b30..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleLevel_02be59() { - float res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0)); -} - -vec4 vertex_main() { - textureSampleLevel_02be59(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleLevel_02be59() { - float res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0)); -} - -void fragment_main() { - textureSampleLevel_02be59(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleLevel_02be59() { - float res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0)); -} - -void compute_main() { - textureSampleLevel_02be59(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.hlsl deleted file mode 100644 index 0f2e171f7c..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_02be59() { - float res = arg_0.SampleLevel(arg_1, float2(0.0f, 0.0f), 0).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_02be59(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_02be59(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_02be59(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.msl deleted file mode 100644 index a8efa2b92d..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_02be59(depth2d tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample(tint_symbol_2, float2(), level(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_02be59(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_02be59(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_02be59(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.spvasm deleted file mode 100644 index 9a116965fc..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_02be59 "textureSampleLevel_02be59" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %23 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %26 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 -%_ptr_Function_float = OpTypePointer Function %float - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleLevel_02be59 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %21 = OpLoad %14 %arg_1 - %22 = OpLoad %11 %arg_0 - %24 = OpSampledImage %23 %22 %21 - %27 = OpConvertSToF %float %int_0 - %20 = OpImageSampleExplicitLod %v4float %24 %26 Lod %27 - %19 = OpCompositeExtract %float %20 0 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureSampleLevel_02be59 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureSampleLevel_02be59 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureSampleLevel_02be59 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.wgsl deleted file mode 100644 index e5eb1c6b7d..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/02be59.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_02be59() { - var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_02be59(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_02be59(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_02be59(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl b/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl deleted file mode 100644 index f4b34fec6b..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: f32) -> vec4 -fn textureSampleLevel_0bdd9a() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_0bdd9a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_0bdd9a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_0bdd9a(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.glsl deleted file mode 100644 index 60ebf4e7a7..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArray arg_0_arg_1; - -void textureSampleLevel_0bdd9a() { - vec4 res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -vec4 vertex_main() { - textureSampleLevel_0bdd9a(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArray arg_0_arg_1; - -void textureSampleLevel_0bdd9a() { - vec4 res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -void fragment_main() { - textureSampleLevel_0bdd9a(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArray' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArray arg_0_arg_1; - -void textureSampleLevel_0bdd9a() { - vec4 res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -void compute_main() { - textureSampleLevel_0bdd9a(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArray' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.hlsl deleted file mode 100644 index 79982318dd..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_0bdd9a() { - float4 res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_0bdd9a(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_0bdd9a(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_0bdd9a(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.msl deleted file mode 100644 index 5250bb5b44..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_0bdd9a(texturecube_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(), 1, level(1.0f)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_0bdd9a(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_0bdd9a(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_0bdd9a(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.wgsl deleted file mode 100644 index 432273cda6..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/0bdd9a.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_0bdd9a() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_0bdd9a(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_0bdd9a(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_0bdd9a(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl b/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl deleted file mode 100644 index 307442c215..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3, level: i32) -> f32 -fn textureSampleLevel_1b0291() { - var res: f32 = textureSampleLevel(arg_0, arg_1, vec3(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_1b0291(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_1b0291(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_1b0291(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.glsl deleted file mode 100644 index c410e7c180..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureSampleLevel_1b0291() { - float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 0.0f), float(0)); -} - -vec4 vertex_main() { - textureSampleLevel_1b0291(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureLod' : no matching overloaded function found -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureSampleLevel_1b0291() { - float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 0.0f), float(0)); -} - -void fragment_main() { - textureSampleLevel_1b0291(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'textureLod' : no matching overloaded function found -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeShadow arg_0_arg_1; - -void textureSampleLevel_1b0291() { - float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, 0.0f), float(0)); -} - -void compute_main() { - textureSampleLevel_1b0291(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureLod' : no matching overloaded function found -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.hlsl deleted file mode 100644 index b21e9fda1a..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_1b0291() { - float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, 0.0f), 0).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_1b0291(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_1b0291(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_1b0291(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.msl deleted file mode 100644 index d16918218e..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_1b0291(depthcube tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample(tint_symbol_2, float3(), level(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_1b0291(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_1b0291(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_1b0291(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.spvasm deleted file mode 100644 index fe52162d4f..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.spvasm +++ /dev/null @@ -1,86 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 46 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_1b0291 "textureSampleLevel_1b0291" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %23 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %26 = OpConstantNull %v3float - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 -%_ptr_Function_float = OpTypePointer Function %float - %32 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleLevel_1b0291 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %21 = OpLoad %14 %arg_1 - %22 = OpLoad %11 %arg_0 - %24 = OpSampledImage %23 %22 %21 - %27 = OpConvertSToF %float %int_0 - %20 = OpImageSampleExplicitLod %v4float %24 %26 Lod %27 - %19 = OpCompositeExtract %float %20 0 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureSampleLevel_1b0291 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %41 = OpLabel - %42 = OpFunctionCall %void %textureSampleLevel_1b0291 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureSampleLevel_1b0291 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.wgsl deleted file mode 100644 index 8ce844e4b4..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1b0291.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_1b0291() { - var res : f32 = textureSampleLevel(arg_0, arg_1, vec3(), 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_1b0291(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_1b0291(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_1b0291(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl b/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl deleted file mode 100644 index b32ce00f94..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32) -> f32 -fn textureSampleLevel_1bf73e() { - var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_1bf73e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_1bf73e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_1bf73e(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.glsl deleted file mode 100644 index defb6f6aec..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleLevel_1bf73e() { - float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0)); -} - -vec4 vertex_main() { - textureSampleLevel_1bf73e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureLod' : no matching overloaded function found -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleLevel_1bf73e() { - float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0)); -} - -void fragment_main() { - textureSampleLevel_1bf73e(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'textureLod' : no matching overloaded function found -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleLevel_1bf73e() { - float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0)); -} - -void compute_main() { - textureSampleLevel_1bf73e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureLod' : no matching overloaded function found -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.hlsl deleted file mode 100644 index 9231e911f6..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_1bf73e() { - float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_1bf73e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_1bf73e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_1bf73e(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.msl deleted file mode 100644 index e792a86a11..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_1bf73e(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample(tint_symbol_2, float2(), 1, level(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_1bf73e(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_1bf73e(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_1bf73e(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.spvasm deleted file mode 100644 index 28e22104ce..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 49 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_1bf73e "textureSampleLevel_1bf73e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %23 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 -%_ptr_Function_float = OpTypePointer Function %float - %35 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleLevel_1bf73e = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %21 = OpLoad %14 %arg_1 - %22 = OpLoad %11 %arg_0 - %24 = OpSampledImage %23 %22 %21 - %27 = OpConvertSToF %float %int_1 - %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27 - %31 = OpConvertSToF %float %int_0 - %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod %31 - %19 = OpCompositeExtract %float %20 0 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureSampleLevel_1bf73e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %44 = OpLabel - %45 = OpFunctionCall %void %textureSampleLevel_1bf73e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %47 = OpLabel - %48 = OpFunctionCall %void %textureSampleLevel_1bf73e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.wgsl deleted file mode 100644 index ff739ce857..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/1bf73e.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_1bf73e() { - var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_1bf73e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_1bf73e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_1bf73e(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl b/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl deleted file mode 100644 index fb1df7c65d..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32) -> vec4 -fn textureSampleLevel_302be4() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_302be4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_302be4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_302be4(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.glsl deleted file mode 100644 index 5e963cedd3..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleLevel_302be4() { - vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); -} - -vec4 vertex_main() { - textureSampleLevel_302be4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleLevel_302be4() { - vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); -} - -void fragment_main() { - textureSampleLevel_302be4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleLevel_302be4() { - vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f); -} - -void compute_main() { - textureSampleLevel_302be4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.hlsl deleted file mode 100644 index 71a5560e87..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_302be4() { - float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_302be4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_302be4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_302be4(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.msl deleted file mode 100644 index 81fb6d9992..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_302be4(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(), 1, level(1.0f)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_302be4(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_302be4(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_302be4(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.wgsl deleted file mode 100644 index 15af8c661c..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/302be4.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_302be4() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_302be4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_302be4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_302be4(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl b/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl deleted file mode 100644 index b7d0ced426..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, offset: vec2) -> f32 -fn textureSampleLevel_47daa4() { - var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_47daa4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_47daa4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_47daa4(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.glsl deleted file mode 100644 index 9040c71fb2..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleLevel_47daa4() { - float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0, 0)); -} - -vec4 vertex_main() { - textureSampleLevel_47daa4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleLevel_47daa4() { - float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0, 0)); -} - -void fragment_main() { - textureSampleLevel_47daa4(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DShadow arg_0_arg_1; - -void textureSampleLevel_47daa4() { - float res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), float(0), ivec2(0, 0)); -} - -void compute_main() { - textureSampleLevel_47daa4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.hlsl deleted file mode 100644 index 0c1ee21277..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_47daa4() { - float res = arg_0.SampleLevel(arg_1, float2(0.0f, 0.0f), 0, int2(0, 0)).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_47daa4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_47daa4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_47daa4(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.msl deleted file mode 100644 index 932bcb38b8..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_47daa4(depth2d tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample(tint_symbol_2, float2(), level(0), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_47daa4(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_47daa4(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_47daa4(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.spvasm deleted file mode 100644 index e46c365d1e..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_47daa4 "textureSampleLevel_47daa4" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %23 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %26 = OpConstantNull %v2float - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %v2int = OpTypeVector %int 2 - %31 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleLevel_47daa4 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %21 = OpLoad %14 %arg_1 - %22 = OpLoad %11 %arg_0 - %24 = OpSampledImage %23 %22 %21 - %27 = OpConvertSToF %float %int_0 - %20 = OpImageSampleExplicitLod %v4float %24 %26 Lod|ConstOffset %27 %31 - %19 = OpCompositeExtract %float %20 0 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureSampleLevel_47daa4 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleLevel_47daa4 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureSampleLevel_47daa4 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.wgsl deleted file mode 100644 index 28ee9080ea..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/47daa4.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_47daa4() { - var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_47daa4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_47daa4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_47daa4(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl b/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl deleted file mode 100644 index 4d3d865f62..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, offset: vec2) -> vec4 -fn textureSampleLevel_690d95() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_690d95(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_690d95(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_690d95(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.glsl deleted file mode 100644 index 7bda115c50..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleLevel_690d95() { - vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f, ivec2(0, 0)); -} - -vec4 vertex_main() { - textureSampleLevel_690d95(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleLevel_690d95() { - vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f, ivec2(0, 0)); -} - -void fragment_main() { - textureSampleLevel_690d95(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleLevel_690d95() { - vec4 res = textureLodOffset(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f, ivec2(0, 0)); -} - -void compute_main() { - textureSampleLevel_690d95(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.hlsl deleted file mode 100644 index 3e1fd5638e..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_690d95() { - float4 res = arg_0.SampleLevel(arg_1, float2(0.0f, 0.0f), 1.0f, int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_690d95(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_690d95(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_690d95(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.msl deleted file mode 100644 index 508a589e31..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_690d95(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(), level(1.0f), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_690d95(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_690d95(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_690d95(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.spvasm deleted file mode 100644 index 50a4990458..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_690d95 "textureSampleLevel_690d95" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v2float = OpTypeVector %float 2 - %25 = OpConstantNull %v2float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v2int = OpTypeVector %int 2 - %29 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float -%textureSampleLevel_690d95 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleExplicitLod %v4float %23 %25 Lod|ConstOffset %float_1 %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureSampleLevel_690d95 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureSampleLevel_690d95 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleLevel_690d95 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.wgsl deleted file mode 100644 index 6584e4654b..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/690d95.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_690d95() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_690d95(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_690d95(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_690d95(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl b/test/tint/builtins/gen/textureSampleLevel/979816.wgsl deleted file mode 100644 index 17345bb5d1..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_external; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2) -> vec4 -fn textureSampleLevel_979816() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_979816(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_979816(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_979816(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.glsl deleted file mode 100644 index 0685239655..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.glsl +++ /dev/null @@ -1,174 +0,0 @@ -SKIP: FAILED - -#version 310 es - -struct ExternalTextureParams { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -}; - -layout(binding = 3) uniform ExternalTextureParams_1 { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -} ext_tex_params; - - -vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { - if ((params.numPlanes == 1u)) { - return textureLod(plane0_smp, coord, 0.0f); - } - float y = (textureLod(plane0_smp, coord, 0.0f).r - 0.0625f); - vec2 uv = (textureLod(plane1_smp, coord, 0.0f).rg - 0.5f); - float u = uv.x; - float v = uv.y; - float r = ((1.164000034f * y) + (params.vr * v)); - float g = (((1.164000034f * y) - (params.ug * u)) - (params.vg * v)); - float b = ((1.164000034f * y) + (params.ub * u)); - return vec4(r, g, b, 1.0f); -} - -uniform highp sampler2D arg_0_arg_1; -uniform highp sampler2D ext_tex_plane_1_arg_1; -void textureSampleLevel_979816() { - vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, vec2(0.0f, 0.0f), ext_tex_params); -} - -vec4 vertex_main() { - textureSampleLevel_979816(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:37: 'textureSampleExternal' : no matching overloaded function found -ERROR: 0:37: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' -ERROR: 0:37: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -struct ExternalTextureParams { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -}; - -layout(binding = 3) uniform ExternalTextureParams_1 { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -} ext_tex_params; - - -vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { - if ((params.numPlanes == 1u)) { - return textureLod(plane0_smp, coord, 0.0f); - } - float y = (textureLod(plane0_smp, coord, 0.0f).r - 0.0625f); - vec2 uv = (textureLod(plane1_smp, coord, 0.0f).rg - 0.5f); - float u = uv.x; - float v = uv.y; - float r = ((1.164000034f * y) + (params.vr * v)); - float g = (((1.164000034f * y) - (params.ug * u)) - (params.vg * v)); - float b = ((1.164000034f * y) + (params.ub * u)); - return vec4(r, g, b, 1.0f); -} - -uniform highp sampler2D arg_0_arg_1; -uniform highp sampler2D ext_tex_plane_1_arg_1; -void textureSampleLevel_979816() { - vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, vec2(0.0f, 0.0f), ext_tex_params); -} - -void fragment_main() { - textureSampleLevel_979816(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:38: 'textureSampleExternal' : no matching overloaded function found -ERROR: 0:38: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' -ERROR: 0:38: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - -#version 310 es - -struct ExternalTextureParams { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -}; - -layout(binding = 3) uniform ExternalTextureParams_1 { - uint numPlanes; - float vr; - float ug; - float vg; - float ub; -} ext_tex_params; - - -vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { - if ((params.numPlanes == 1u)) { - return textureLod(plane0_smp, coord, 0.0f); - } - float y = (textureLod(plane0_smp, coord, 0.0f).r - 0.0625f); - vec2 uv = (textureLod(plane1_smp, coord, 0.0f).rg - 0.5f); - float u = uv.x; - float v = uv.y; - float r = ((1.164000034f * y) + (params.vr * v)); - float g = (((1.164000034f * y) - (params.ug * u)) - (params.vg * v)); - float b = ((1.164000034f * y) + (params.ub * u)); - return vec4(r, g, b, 1.0f); -} - -uniform highp sampler2D arg_0_arg_1; -uniform highp sampler2D ext_tex_plane_1_arg_1; -void textureSampleLevel_979816() { - vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, vec2(0.0f, 0.0f), ext_tex_params); -} - -void compute_main() { - textureSampleLevel_979816(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:37: 'textureSampleExternal' : no matching overloaded function found -ERROR: 0:37: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' -ERROR: 0:37: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.hlsl deleted file mode 100644 index d673a4f094..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.hlsl +++ /dev/null @@ -1,108 +0,0 @@ -struct GammaTransferParams { - float G; - float A; - float B; - float C; - float D; - float E; - float F; - uint padding; -}; -struct ExternalTextureParams { - uint numPlanes; - float3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - float3x3 gamutConversionMatrix; -}; - -Texture2D ext_tex_plane_1 : register(t2, space1); -cbuffer cbuffer_ext_tex_params : register(b3, space1) { - uint4 ext_tex_params[11]; -}; -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -float3 gammaCorrection(float3 v, GammaTransferParams params) { - const bool3 cond = (abs(v) < float3((params.D).xxx)); - const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); - const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); - return (cond ? t : f); -} - -float4 textureSampleExternal(Texture2D plane0, Texture2D plane1, SamplerState smp, float2 coord, ExternalTextureParams params) { - float3 color = float3(0.0f, 0.0f, 0.0f); - if ((params.numPlanes == 1u)) { - color = plane0.SampleLevel(smp, coord, 0.0f).rgb; - } else { - color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f)); - } - color = gammaCorrection(color, params.gammaDecodeParams); - color = mul(color, params.gamutConversionMatrix); - color = gammaCorrection(color, params.gammaEncodeParams); - return float4(color, 1.0f); -} - -float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { - const uint scalar_offset = ((offset + 0u)) / 4; - const uint scalar_offset_1 = ((offset + 16u)) / 4; - const uint scalar_offset_2 = ((offset + 32u)) / 4; - return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); -} - -GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { - const uint scalar_offset_3 = ((offset + 0u)) / 4; - const uint scalar_offset_4 = ((offset + 4u)) / 4; - const uint scalar_offset_5 = ((offset + 8u)) / 4; - const uint scalar_offset_6 = ((offset + 12u)) / 4; - const uint scalar_offset_7 = ((offset + 16u)) / 4; - const uint scalar_offset_8 = ((offset + 20u)) / 4; - const uint scalar_offset_9 = ((offset + 24u)) / 4; - const uint scalar_offset_10 = ((offset + 28u)) / 4; - const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; - return tint_symbol_9; -} - -float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { - const uint scalar_offset_11 = ((offset + 0u)) / 4; - const uint scalar_offset_12 = ((offset + 16u)) / 4; - const uint scalar_offset_13 = ((offset + 32u)) / 4; - return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); -} - -ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { - const uint scalar_offset_14 = ((offset + 0u)) / 4; - const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; - return tint_symbol_10; -} - -void textureSampleLevel_979816() { - float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, float2(0.0f, 0.0f), tint_symbol_1(ext_tex_params, 0u)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_979816(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_979816(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_979816(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.msl deleted file mode 100644 index abe1cccfd6..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.msl +++ /dev/null @@ -1,73 +0,0 @@ -#include - -using namespace metal; -struct GammaTransferParams { - /* 0x0000 */ float G; - /* 0x0004 */ float A; - /* 0x0008 */ float B; - /* 0x000c */ float C; - /* 0x0010 */ float D; - /* 0x0014 */ float E; - /* 0x0018 */ float F; - /* 0x001c */ uint padding; -}; - -struct ExternalTextureParams { - /* 0x0000 */ uint numPlanes; - /* 0x0004 */ int8_t tint_pad[12]; - /* 0x0010 */ float3x4 yuvToRgbConversionMatrix; - /* 0x0040 */ GammaTransferParams gammaDecodeParams; - /* 0x0060 */ GammaTransferParams gammaEncodeParams; - /* 0x0080 */ float3x3 gamutConversionMatrix; -}; - -float3 gammaCorrection(float3 v, GammaTransferParams params) { - bool3 const cond = (fabs(v) < float3(params.D)); - float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F)); - float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E)); - return select(f, t, cond); -} - -float4 textureSampleExternal(texture2d plane0, texture2d plane1, sampler smp, float2 coord, ExternalTextureParams params) { - float3 color = 0.0f; - if ((params.numPlanes == 1u)) { - color = float4(plane0.sample(smp, coord, level(0.0f))).rgb; - } else { - color = (float4(plane0.sample(smp, coord, level(0.0f))[0], float4(plane1.sample(smp, coord, level(0.0f))).rg, 1.0f) * params.yuvToRgbConversionMatrix); - } - color = gammaCorrection(color, params.gammaDecodeParams); - color = (params.gamutConversionMatrix * color); - color = gammaCorrection(color, params.gammaEncodeParams); - return float4(color, 1.0f); -} - -void textureSampleLevel_979816(texture2d tint_symbol_1, texture2d tint_symbol_2, sampler tint_symbol_3, const constant ExternalTextureParams* const tint_symbol_4) { - float4 res = textureSampleExternal(tint_symbol_1, tint_symbol_2, tint_symbol_3, float2(), *(tint_symbol_4)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_5, texture2d tint_symbol_6, sampler tint_symbol_7, const constant ExternalTextureParams* const tint_symbol_8) { - textureSampleLevel_979816(tint_symbol_5, tint_symbol_6, tint_symbol_7, tint_symbol_8); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_9 [[texture(0)]], texture2d tint_symbol_10 [[texture(1)]], sampler tint_symbol_11 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_13 [[texture(0)]], texture2d tint_symbol_14 [[texture(1)]], sampler tint_symbol_15 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_16 [[buffer(2)]]) { - textureSampleLevel_979816(tint_symbol_13, tint_symbol_14, tint_symbol_15, tint_symbol_16); - return; -} - -kernel void compute_main(texture2d tint_symbol_17 [[texture(0)]], texture2d tint_symbol_18 [[texture(1)]], sampler tint_symbol_19 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_20 [[buffer(2)]]) { - textureSampleLevel_979816(tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.spvasm deleted file mode 100644 index ebf64411fe..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.spvasm +++ /dev/null @@ -1,239 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 136 -; Schema: 0 - OpCapability Shader - %30 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %ext_tex_plane_1 "ext_tex_plane_1" - OpName %ExternalTextureParams "ExternalTextureParams" - OpMemberName %ExternalTextureParams 0 "numPlanes" - OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix" - OpMemberName %ExternalTextureParams 2 "gammaDecodeParams" - OpName %GammaTransferParams "GammaTransferParams" - OpMemberName %GammaTransferParams 0 "G" - OpMemberName %GammaTransferParams 1 "A" - OpMemberName %GammaTransferParams 2 "B" - OpMemberName %GammaTransferParams 3 "C" - OpMemberName %GammaTransferParams 4 "D" - OpMemberName %GammaTransferParams 5 "E" - OpMemberName %GammaTransferParams 6 "F" - OpMemberName %GammaTransferParams 7 "padding" - OpMemberName %ExternalTextureParams 3 "gammaEncodeParams" - OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix" - OpName %ext_tex_params "ext_tex_params" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %gammaCorrection "gammaCorrection" - OpName %v "v" - OpName %params "params" - OpName %textureSampleExternal "textureSampleExternal" - OpName %plane0 "plane0" - OpName %plane1 "plane1" - OpName %smp "smp" - OpName %coord "coord" - OpName %params_0 "params" - OpName %color "color" - OpName %textureSampleLevel_979816 "textureSampleLevel_979816" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %ext_tex_plane_1 DescriptorSet 1 - OpDecorate %ext_tex_plane_1 Binding 2 - OpDecorate %ExternalTextureParams Block - OpMemberDecorate %ExternalTextureParams 0 Offset 0 - OpMemberDecorate %ExternalTextureParams 1 Offset 16 - OpMemberDecorate %ExternalTextureParams 1 ColMajor - OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16 - OpMemberDecorate %ExternalTextureParams 2 Offset 64 - OpMemberDecorate %GammaTransferParams 0 Offset 0 - OpMemberDecorate %GammaTransferParams 1 Offset 4 - OpMemberDecorate %GammaTransferParams 2 Offset 8 - OpMemberDecorate %GammaTransferParams 3 Offset 12 - OpMemberDecorate %GammaTransferParams 4 Offset 16 - OpMemberDecorate %GammaTransferParams 5 Offset 20 - OpMemberDecorate %GammaTransferParams 6 Offset 24 - OpMemberDecorate %GammaTransferParams 7 Offset 28 - OpMemberDecorate %ExternalTextureParams 3 Offset 96 - OpMemberDecorate %ExternalTextureParams 4 Offset 128 - OpMemberDecorate %ExternalTextureParams 4 ColMajor - OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16 - OpDecorate %ext_tex_params NonWritable - OpDecorate %ext_tex_params DescriptorSet 1 - OpDecorate %ext_tex_params Binding 3 - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 -%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %uint = OpTypeInt 32 0 -%mat3v4float = OpTypeMatrix %v4float 3 -%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint - %v3float = OpTypeVector %float 3 -%mat3v3float = OpTypeMatrix %v3float 3 -%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float -%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams -%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %23 = OpTypeSampler -%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 - %arg_1 = OpVariable %_ptr_UniformConstant_23 UniformConstant - %24 = OpTypeFunction %v3float %v3float %GammaTransferParams - %bool = OpTypeBool - %v3bool = OpTypeVector %bool 3 -%_ptr_Function_v3float = OpTypePointer Function %v3float - %44 = OpConstantNull %v3float - %v2float = OpTypeVector %float 2 - %64 = OpTypeFunction %v4float %11 %11 %23 %v2float %ExternalTextureParams - %uint_1 = OpConstant %uint 1 - %81 = OpTypeSampledImage %11 - %float_0 = OpConstant %float 0 - %float_1 = OpConstant %float 1 - %void = OpTypeVoid - %111 = OpTypeFunction %void - %119 = OpConstantNull %v2float -%_ptr_Function_v4float = OpTypePointer Function %v4float - %123 = OpTypeFunction %v4float -%gammaCorrection = OpFunction %v3float None %24 - %v = OpFunctionParameter %v3float - %params = OpFunctionParameter %GammaTransferParams - %28 = OpLabel - %42 = OpVariable %_ptr_Function_v3float Function %44 - %54 = OpVariable %_ptr_Function_v3float Function %44 - %60 = OpVariable %_ptr_Function_v3float Function %44 - %29 = OpExtInst %v3float %30 FAbs %v - %31 = OpCompositeExtract %float %params 4 - %32 = OpCompositeConstruct %v3float %31 %31 %31 - %33 = OpFOrdLessThan %v3bool %29 %32 - %36 = OpExtInst %v3float %30 FSign %v - %37 = OpCompositeExtract %float %params 3 - %38 = OpExtInst %v3float %30 FAbs %v - %39 = OpVectorTimesScalar %v3float %38 %37 - %40 = OpCompositeExtract %float %params 6 - %45 = OpCompositeConstruct %v3float %40 %40 %40 - %41 = OpFAdd %v3float %39 %45 - %46 = OpFMul %v3float %36 %41 - %47 = OpExtInst %v3float %30 FSign %v - %49 = OpCompositeExtract %float %params 1 - %50 = OpExtInst %v3float %30 FAbs %v - %51 = OpVectorTimesScalar %v3float %50 %49 - %52 = OpCompositeExtract %float %params 2 - %55 = OpCompositeConstruct %v3float %52 %52 %52 - %53 = OpFAdd %v3float %51 %55 - %56 = OpCompositeExtract %float %params 0 - %57 = OpCompositeConstruct %v3float %56 %56 %56 - %48 = OpExtInst %v3float %30 Pow %53 %57 - %58 = OpCompositeExtract %float %params 5 - %61 = OpCompositeConstruct %v3float %58 %58 %58 - %59 = OpFAdd %v3float %48 %61 - %62 = OpFMul %v3float %47 %59 - %63 = OpSelect %v3float %33 %46 %62 - OpReturnValue %63 - OpFunctionEnd -%textureSampleExternal = OpFunction %v4float None %64 - %plane0 = OpFunctionParameter %11 - %plane1 = OpFunctionParameter %11 - %smp = OpFunctionParameter %23 - %coord = OpFunctionParameter %v2float - %params_0 = OpFunctionParameter %ExternalTextureParams - %72 = OpLabel - %color = OpVariable %_ptr_Function_v3float Function %44 - %74 = OpCompositeExtract %uint %params_0 0 - %76 = OpIEqual %bool %74 %uint_1 - OpSelectionMerge %77 None - OpBranchConditional %76 %78 %79 - %78 = OpLabel - %82 = OpSampledImage %81 %plane0 %smp - %80 = OpImageSampleExplicitLod %v4float %82 %coord Lod %float_0 - %84 = OpVectorShuffle %v3float %80 %80 0 1 2 - OpStore %color %84 - OpBranch %77 - %79 = OpLabel - %86 = OpSampledImage %81 %plane0 %smp - %85 = OpImageSampleExplicitLod %v4float %86 %coord Lod %float_0 - %87 = OpCompositeExtract %float %85 0 - %89 = OpSampledImage %81 %plane1 %smp - %88 = OpImageSampleExplicitLod %v4float %89 %coord Lod %float_0 - %90 = OpVectorShuffle %v2float %88 %88 0 1 - %91 = OpCompositeExtract %float %90 0 - %92 = OpCompositeExtract %float %90 1 - %94 = OpCompositeConstruct %v4float %87 %91 %92 %float_1 - %95 = OpCompositeExtract %mat3v4float %params_0 1 - %96 = OpVectorTimesMatrix %v3float %94 %95 - OpStore %color %96 - OpBranch %77 - %77 = OpLabel - %98 = OpLoad %v3float %color - %99 = OpCompositeExtract %GammaTransferParams %params_0 2 - %97 = OpFunctionCall %v3float %gammaCorrection %98 %99 - OpStore %color %97 - %100 = OpCompositeExtract %mat3v3float %params_0 4 - %101 = OpLoad %v3float %color - %102 = OpMatrixTimesVector %v3float %100 %101 - OpStore %color %102 - %104 = OpLoad %v3float %color - %105 = OpCompositeExtract %GammaTransferParams %params_0 3 - %103 = OpFunctionCall %v3float %gammaCorrection %104 %105 - OpStore %color %103 - %106 = OpLoad %v3float %color - %107 = OpCompositeExtract %float %106 0 - %108 = OpCompositeExtract %float %106 1 - %109 = OpCompositeExtract %float %106 2 - %110 = OpCompositeConstruct %v4float %107 %108 %109 %float_1 - OpReturnValue %110 - OpFunctionEnd -%textureSampleLevel_979816 = OpFunction %void None %111 - %114 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %116 = OpLoad %11 %arg_0 - %117 = OpLoad %11 %ext_tex_plane_1 - %118 = OpLoad %23 %arg_1 - %120 = OpLoad %ExternalTextureParams %ext_tex_params - %115 = OpFunctionCall %v4float %textureSampleExternal %116 %117 %118 %119 %120 - OpStore %res %115 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %123 - %125 = OpLabel - %126 = OpFunctionCall %void %textureSampleLevel_979816 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %111 - %128 = OpLabel - %129 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %129 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %111 - %131 = OpLabel - %132 = OpFunctionCall %void %textureSampleLevel_979816 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %111 - %134 = OpLabel - %135 = OpFunctionCall %void %textureSampleLevel_979816 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.wgsl deleted file mode 100644 index 3d1980fa01..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/979816.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_external; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_979816() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_979816(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_979816(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_979816(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl b/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl deleted file mode 100644 index 6620b3138b..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, offset: vec3) -> vec4 -fn textureSampleLevel_9bd37b() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_9bd37b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_9bd37b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_9bd37b(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.glsl deleted file mode 100644 index c6050576f5..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleLevel_9bd37b() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f, ivec3(0, 0, 0)); -} - -vec4 vertex_main() { - textureSampleLevel_9bd37b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleLevel_9bd37b() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f, ivec3(0, 0, 0)); -} - -void fragment_main() { - textureSampleLevel_9bd37b(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleLevel_9bd37b() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f, ivec3(0, 0, 0)); -} - -void compute_main() { - textureSampleLevel_9bd37b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.hlsl deleted file mode 100644 index 9d059defcd..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_9bd37b() { - float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, 0.0f), 1.0f, int3(0, 0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_9bd37b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_9bd37b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_9bd37b(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.msl deleted file mode 100644 index b1f5d43ba7..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_9bd37b(texture3d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(), level(1.0f), int3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_9bd37b(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_9bd37b(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_9bd37b(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.spvasm deleted file mode 100644 index 661813303a..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.spvasm +++ /dev/null @@ -1,85 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 45 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_9bd37b "textureSampleLevel_9bd37b" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 3D 0 0 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %25 = OpConstantNull %v3float - %float_1 = OpConstant %float 1 - %int = OpTypeInt 32 1 - %v3int = OpTypeVector %int 3 - %29 = OpConstantNull %v3int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %32 = OpTypeFunction %v4float -%textureSampleLevel_9bd37b = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %19 = OpImageSampleExplicitLod %v4float %23 %25 Lod|ConstOffset %float_1 %29 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %32 - %34 = OpLabel - %35 = OpFunctionCall %void %textureSampleLevel_9bd37b - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %37 = OpLabel - %38 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %38 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %void %textureSampleLevel_9bd37b - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleLevel_9bd37b - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.wgsl deleted file mode 100644 index 081f0c3acc..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/9bd37b.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_9bd37b() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0, vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_9bd37b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_9bd37b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_9bd37b(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl b/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl deleted file mode 100644 index dc7ae8cc3e..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, offset: vec2) -> vec4 -fn textureSampleLevel_a4af26() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_a4af26(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_a4af26(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_a4af26(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.glsl deleted file mode 100644 index c16d3e2853..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleLevel_a4af26() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0, 0)); -} - -vec4 vertex_main() { - textureSampleLevel_a4af26(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleLevel_a4af26() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0, 0)); -} - -void fragment_main() { - textureSampleLevel_a4af26(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2DArray arg_0_arg_1; - -void textureSampleLevel_a4af26() { - vec4 res = textureLodOffset(arg_0_arg_1, vec3(0.0f, 0.0f, float(1)), 1.0f, ivec2(0, 0)); -} - -void compute_main() { - textureSampleLevel_a4af26(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.hlsl deleted file mode 100644 index c1d9157db1..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_a4af26() { - float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1.0f, int2(0, 0)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_a4af26(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_a4af26(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_a4af26(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.msl deleted file mode 100644 index 4fc39a8aae..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_a4af26(texture2d_array tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(), 1, level(1.0f), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_a4af26(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_a4af26(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_a4af26(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.spvasm deleted file mode 100644 index ddb13a5fdf..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.spvasm +++ /dev/null @@ -1,88 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_a4af26 "textureSampleLevel_a4af26" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %22 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %float_1 = OpConstant %float 1 - %v2int = OpTypeVector %int 2 - %32 = OpConstantNull %v2int -%_ptr_Function_v4float = OpTypePointer Function %v4float - %35 = OpTypeFunction %v4float -%textureSampleLevel_a4af26 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpLoad %14 %arg_1 - %21 = OpLoad %11 %arg_0 - %23 = OpSampledImage %22 %21 %20 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26 - %19 = OpImageSampleExplicitLod %v4float %23 %29 Lod|ConstOffset %float_1 %32 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %35 - %37 = OpLabel - %38 = OpFunctionCall %void %textureSampleLevel_a4af26 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %40 = OpLabel - %41 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %41 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleLevel_a4af26 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureSampleLevel_a4af26 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.wgsl deleted file mode 100644 index 69f8f800dc..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/a4af26.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_a4af26() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 1.0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_a4af26(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_a4af26(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_a4af26(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl b/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl deleted file mode 100644 index 1ee0d7a0f0..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_3d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32) -> vec4 -fn textureSampleLevel_abfcc0() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_abfcc0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_abfcc0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_abfcc0(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.glsl deleted file mode 100644 index 4965ee4b4c..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleLevel_abfcc0() { - vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - textureSampleLevel_abfcc0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleLevel_abfcc0() { - vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleLevel_abfcc0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler3D arg_0_arg_1; - -void textureSampleLevel_abfcc0() { - vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void compute_main() { - textureSampleLevel_abfcc0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.hlsl deleted file mode 100644 index 2110c77419..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture3D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_abfcc0() { - float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_abfcc0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_abfcc0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_abfcc0(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.msl deleted file mode 100644 index 6bf2714ca4..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_abfcc0(texture3d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(), level(1.0f)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_abfcc0(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_abfcc0(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_abfcc0(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.wgsl deleted file mode 100644 index f8f6faf81c..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/abfcc0.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_3d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_abfcc0() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_abfcc0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_abfcc0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_abfcc0(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl b/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl deleted file mode 100644 index b5a132353b..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_cube_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: i32) -> f32 -fn textureSampleLevel_ae5e39() { - var res: f32 = textureSampleLevel(arg_0, arg_1, vec3(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_ae5e39(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_ae5e39(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_ae5e39(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.glsl deleted file mode 100644 index 93e68a6ffb..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureSampleLevel_ae5e39() { - float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), float(0)); -} - -vec4 vertex_main() { - textureSampleLevel_ae5e39(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureSampleLevel_ae5e39() { - float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), float(0)); -} - -void fragment_main() { - textureSampleLevel_ae5e39(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp samplerCubeArrayShadow arg_0_arg_1; - -void textureSampleLevel_ae5e39() { - float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), float(0)); -} - -void compute_main() { - textureSampleLevel_ae5e39(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.hlsl deleted file mode 100644 index e03bc6671b..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCubeArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_ae5e39() { - float res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 0).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_ae5e39(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_ae5e39(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_ae5e39(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.msl deleted file mode 100644 index 43f1b2b126..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_ae5e39(depthcube_array tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample(tint_symbol_2, float3(), 1, level(0)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_ae5e39(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_ae5e39(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_ae5e39(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.spvasm deleted file mode 100644 index 550cf30e16..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.spvasm +++ /dev/null @@ -1,89 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 48 -; Schema: 0 - OpCapability Shader - OpCapability SampledCubeArray - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_ae5e39 "textureSampleLevel_ae5e39" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float Cube 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %23 = OpTypeSampledImage %11 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 -%_ptr_Function_float = OpTypePointer Function %float - %34 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleLevel_ae5e39 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %21 = OpLoad %14 %arg_1 - %22 = OpLoad %11 %arg_0 - %24 = OpSampledImage %23 %22 %21 - %26 = OpConvertSToF %float %int_1 - %29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %26 - %30 = OpConvertSToF %float %int_0 - %20 = OpImageSampleExplicitLod %v4float %24 %29 Lod %30 - %19 = OpCompositeExtract %float %20 0 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %34 - %36 = OpLabel - %37 = OpFunctionCall %void %textureSampleLevel_ae5e39 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %39 = OpLabel - %40 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %40 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %43 = OpLabel - %44 = OpFunctionCall %void %textureSampleLevel_ae5e39 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureSampleLevel_ae5e39 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.wgsl deleted file mode 100644 index 4fc5ac8665..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ae5e39.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_cube_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_ae5e39() { - var res : f32 = textureSampleLevel(arg_0, arg_1, vec3(), 1, 0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_ae5e39(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_ae5e39(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_ae5e39(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl b/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl deleted file mode 100644 index 6c4178e0fd..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_depth_2d_array; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, offset: vec2) -> f32 -fn textureSampleLevel_ba93b3() { - var res: f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_ba93b3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_ba93b3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_ba93b3(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.glsl deleted file mode 100644 index 2cc11f5bf0..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleLevel_ba93b3() { - float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0, 0)); -} - -vec4 vertex_main() { - textureSampleLevel_ba93b3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleLevel_ba93b3() { - float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0, 0)); -} - -void fragment_main() { - textureSampleLevel_ba93b3(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:7: 'textureLodOffset' : no matching overloaded function found -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -uniform highp sampler2DArrayShadow arg_0_arg_1; - -void textureSampleLevel_ba93b3() { - float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(0), ivec2(0, 0)); -} - -void compute_main() { - textureSampleLevel_ba93b3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found -ERROR: 0:6: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.hlsl deleted file mode 100644 index c375c7ce1f..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2DArray arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_ba93b3() { - float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0, int2(0, 0)).x; -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_ba93b3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_ba93b3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_ba93b3(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.msl deleted file mode 100644 index 411b77e098..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_ba93b3(depth2d_array tint_symbol_1, sampler tint_symbol_2) { - float res = tint_symbol_1.sample(tint_symbol_2, float2(), 1, level(0), int2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_ba93b3(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_ba93b3(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_ba93b3(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.spvasm b/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.spvasm deleted file mode 100644 index 043c7ba194..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.spvasm +++ /dev/null @@ -1,91 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 51 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %arg_0 "arg_0" - OpName %arg_1 "arg_1" - OpName %textureSampleLevel_ba93b3 "textureSampleLevel_ba93b3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %arg_0 DescriptorSet 1 - OpDecorate %arg_0 Binding 0 - OpDecorate %arg_1 DescriptorSet 1 - OpDecorate %arg_1 Binding 1 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant - %14 = OpTypeSampler -%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 - %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant - %void = OpTypeVoid - %15 = OpTypeFunction %void - %23 = OpTypeSampledImage %11 - %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 - %v2int = OpTypeVector %int 2 - %34 = OpConstantNull %v2int -%_ptr_Function_float = OpTypePointer Function %float - %37 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%textureSampleLevel_ba93b3 = OpFunction %void None %15 - %18 = OpLabel - %res = OpVariable %_ptr_Function_float Function %8 - %21 = OpLoad %14 %arg_1 - %22 = OpLoad %11 %arg_0 - %24 = OpSampledImage %23 %22 %21 - %27 = OpConvertSToF %float %int_1 - %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27 - %31 = OpConvertSToF %float %int_0 - %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod|ConstOffset %31 %34 - %19 = OpCompositeExtract %float %20 0 - OpStore %res %19 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %37 - %39 = OpLabel - %40 = OpFunctionCall %void %textureSampleLevel_ba93b3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %15 - %42 = OpLabel - %43 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %43 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %15 - %46 = OpLabel - %47 = OpFunctionCall %void %textureSampleLevel_ba93b3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %15 - %49 = OpLabel - %50 = OpFunctionCall %void %textureSampleLevel_ba93b3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.wgsl deleted file mode 100644 index 954891cb37..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/ba93b3.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_depth_2d_array; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_ba93b3() { - var res : f32 = textureSampleLevel(arg_0, arg_1, vec2(), 1, 0, vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_ba93b3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_ba93b3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_ba93b3(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl b/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl deleted file mode 100644 index 16ef52b815..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_cube; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_cube, sampler: sampler, coords: vec3, level: f32) -> vec4 -fn textureSampleLevel_c32df7() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_c32df7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_c32df7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_c32df7(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.glsl deleted file mode 100644 index f65cea0823..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp samplerCube arg_0_arg_1; - -void textureSampleLevel_c32df7() { - vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - textureSampleLevel_c32df7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp samplerCube arg_0_arg_1; - -void textureSampleLevel_c32df7() { - vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleLevel_c32df7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp samplerCube arg_0_arg_1; - -void textureSampleLevel_c32df7() { - vec4 res = textureLod(arg_0_arg_1, vec3(0.0f, 0.0f, 0.0f), 1.0f); -} - -void compute_main() { - textureSampleLevel_c32df7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.hlsl deleted file mode 100644 index 92b39bb254..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -TextureCube arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_c32df7() { - float4 res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_c32df7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_c32df7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_c32df7(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.msl deleted file mode 100644 index 0dccab6296..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_c32df7(texturecube tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float3(), level(1.0f)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_c32df7(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_c32df7(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_c32df7(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.wgsl deleted file mode 100644 index 2f2df13b05..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c32df7.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_cube; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_c32df7() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec3(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_c32df7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_c32df7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_c32df7(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl b/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl deleted file mode 100644 index 8a5a47f024..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_2d; -@group(1) @binding(1) var arg_1: sampler; - -// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32) -> vec4 -fn textureSampleLevel_c6aca6() { - var res: vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_c6aca6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_c6aca6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_c6aca6(); -} diff --git a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.glsl b/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.glsl deleted file mode 100644 index 6b5cc104ef..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.glsl +++ /dev/null @@ -1,55 +0,0 @@ -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleLevel_c6aca6() { - vec4 res = textureLod(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f); -} - -vec4 vertex_main() { - textureSampleLevel_c6aca6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleLevel_c6aca6() { - vec4 res = textureLod(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f); -} - -void fragment_main() { - textureSampleLevel_c6aca6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -uniform highp sampler2D arg_0_arg_1; - -void textureSampleLevel_c6aca6() { - vec4 res = textureLod(arg_0_arg_1, vec2(0.0f, 0.0f), 1.0f); -} - -void compute_main() { - textureSampleLevel_c6aca6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.hlsl deleted file mode 100644 index 69ec00e251..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -Texture2D arg_0 : register(t0, space1); -SamplerState arg_1 : register(s1, space1); - -void textureSampleLevel_c6aca6() { - float4 res = arg_0.SampleLevel(arg_1, float2(0.0f, 0.0f), 1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureSampleLevel_c6aca6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureSampleLevel_c6aca6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureSampleLevel_c6aca6(); - return; -} diff --git a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.msl b/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.msl deleted file mode 100644 index 804b0eb85b..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureSampleLevel_c6aca6(texture2d tint_symbol_1, sampler tint_symbol_2) { - float4 res = tint_symbol_1.sample(tint_symbol_2, float2(), level(1.0f)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { - textureSampleLevel_c6aca6(tint_symbol_3, tint_symbol_4); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { - textureSampleLevel_c6aca6(tint_symbol_7, tint_symbol_8); - return; -} - -kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { - textureSampleLevel_c6aca6(tint_symbol_9, tint_symbol_10); - return; -} - diff --git a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.wgsl deleted file mode 100644 index 35dc735246..0000000000 --- a/test/tint/builtins/gen/textureSampleLevel/c6aca6.wgsl.expected.wgsl +++ /dev/null @@ -1,23 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_2d; - -@group(1) @binding(1) var arg_1 : sampler; - -fn textureSampleLevel_c6aca6() { - var res : vec4 = textureSampleLevel(arg_0, arg_1, vec2(), 1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureSampleLevel_c6aca6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureSampleLevel_c6aca6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureSampleLevel_c6aca6(); -} diff --git a/test/tint/builtins/gen/textureStore/05ce15.wgsl b/test/tint/builtins/gen/textureStore/05ce15.wgsl deleted file mode 100644 index 88fb6bd546..0000000000 --- a/test/tint/builtins/gen/textureStore/05ce15.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_05ce15() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_05ce15(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_05ce15(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_05ce15(); -} diff --git a/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.glsl deleted file mode 100644 index 6598bca67c..0000000000 --- a/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32f) uniform highp writeonly image2D arg_0; -void textureStore_05ce15() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_05ce15(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32f) uniform highp writeonly image2D arg_0; -void textureStore_05ce15() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_05ce15(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32f) uniform highp writeonly image2D arg_0; -void textureStore_05ce15() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_05ce15(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.hlsl deleted file mode 100644 index ed042228cf..0000000000 --- a/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_05ce15() { - arg_0[int2(0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_05ce15(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_05ce15(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_05ce15(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.msl deleted file mode 100644 index 96f17cc685..0000000000 --- a/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_05ce15(texture2d tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_05ce15(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_05ce15(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_05ce15(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.wgsl deleted file mode 100644 index 2627d0e3ff..0000000000 --- a/test/tint/builtins/gen/textureStore/05ce15.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_05ce15() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_05ce15(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_05ce15(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_05ce15(); -} diff --git a/test/tint/builtins/gen/textureStore/064c7f.wgsl b/test/tint/builtins/gen/textureStore/064c7f.wgsl deleted file mode 100644 index 411a952f13..0000000000 --- a/test/tint/builtins/gen/textureStore/064c7f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_064c7f() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_064c7f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_064c7f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_064c7f(); -} diff --git a/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.glsl deleted file mode 100644 index 911c39435e..0000000000 --- a/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32f) uniform highp writeonly image2D arg_0; -void textureStore_064c7f() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_064c7f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32f) uniform highp writeonly image2D arg_0; -void textureStore_064c7f() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_064c7f(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32f) uniform highp writeonly image2D arg_0; -void textureStore_064c7f() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_064c7f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.hlsl deleted file mode 100644 index 39c01859f7..0000000000 --- a/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_064c7f() { - arg_0[int2(0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_064c7f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_064c7f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_064c7f(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.msl deleted file mode 100644 index 7e40f3e340..0000000000 --- a/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_064c7f(texture2d tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_064c7f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_064c7f(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_064c7f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.wgsl deleted file mode 100644 index 042b3afd27..0000000000 --- a/test/tint/builtins/gen/textureStore/064c7f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_064c7f() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_064c7f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_064c7f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_064c7f(); -} diff --git a/test/tint/builtins/gen/textureStore/068641.wgsl b/test/tint/builtins/gen/textureStore/068641.wgsl deleted file mode 100644 index b8b50f4e9b..0000000000 --- a/test/tint/builtins/gen/textureStore/068641.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_068641() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_068641(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_068641(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_068641(); -} diff --git a/test/tint/builtins/gen/textureStore/068641.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/068641.wgsl.expected.glsl deleted file mode 100644 index 91e51c2b96..0000000000 --- a/test/tint/builtins/gen/textureStore/068641.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage3D arg_0; -void textureStore_068641() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_068641(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16ui) uniform highp writeonly uimage3D arg_0; -void textureStore_068641() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_068641(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage3D arg_0; -void textureStore_068641() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_068641(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/068641.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/068641.wgsl.expected.hlsl deleted file mode 100644 index e6cd71aea0..0000000000 --- a/test/tint/builtins/gen/textureStore/068641.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_068641() { - arg_0[int3(0, 0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_068641(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_068641(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_068641(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/068641.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/068641.wgsl.expected.msl deleted file mode 100644 index dc1bdc8860..0000000000 --- a/test/tint/builtins/gen/textureStore/068641.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_068641(texture3d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_068641(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_068641(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_068641(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/068641.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/068641.wgsl.expected.wgsl deleted file mode 100644 index 5b3279a129..0000000000 --- a/test/tint/builtins/gen/textureStore/068641.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_068641() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_068641(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_068641(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_068641(); -} diff --git a/test/tint/builtins/gen/textureStore/0af6b5.wgsl b/test/tint/builtins/gen/textureStore/0af6b5.wgsl deleted file mode 100644 index d58fe96ca1..0000000000 --- a/test/tint/builtins/gen/textureStore/0af6b5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_0af6b5() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_0af6b5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_0af6b5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_0af6b5(); -} diff --git a/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.glsl deleted file mode 100644 index 75d84384b6..0000000000 --- a/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32f) uniform highp writeonly image2D arg_0; -void textureStore_0af6b5() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_0af6b5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32f) uniform highp writeonly image2D arg_0; -void textureStore_0af6b5() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_0af6b5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32f) uniform highp writeonly image2D arg_0; -void textureStore_0af6b5() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_0af6b5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.hlsl deleted file mode 100644 index a7f40f74bf..0000000000 --- a/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_0af6b5() { - arg_0[int2(0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_0af6b5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_0af6b5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_0af6b5(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.msl deleted file mode 100644 index 74b0941fa4..0000000000 --- a/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_0af6b5(texture2d tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_0af6b5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_0af6b5(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_0af6b5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.wgsl deleted file mode 100644 index 1e67b082fa..0000000000 --- a/test/tint/builtins/gen/textureStore/0af6b5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_0af6b5() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_0af6b5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_0af6b5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_0af6b5(); -} diff --git a/test/tint/builtins/gen/textureStore/0c3dff.wgsl b/test/tint/builtins/gen/textureStore/0c3dff.wgsl deleted file mode 100644 index 6320997251..0000000000 --- a/test/tint/builtins/gen/textureStore/0c3dff.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_0c3dff() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_0c3dff(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_0c3dff(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_0c3dff(); -} diff --git a/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.glsl deleted file mode 100644 index f7d13a5459..0000000000 --- a/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2D arg_0; -void textureStore_0c3dff() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_0c3dff(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16ui) uniform highp writeonly uimage2D arg_0; -void textureStore_0c3dff() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_0c3dff(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2D arg_0; -void textureStore_0c3dff() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_0c3dff(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.hlsl deleted file mode 100644 index 0ca7a424aa..0000000000 --- a/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_0c3dff() { - arg_0[int2(0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_0c3dff(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_0c3dff(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_0c3dff(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.msl deleted file mode 100644 index 408f6948dc..0000000000 --- a/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_0c3dff(texture2d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_0c3dff(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_0c3dff(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_0c3dff(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.wgsl deleted file mode 100644 index b115e07dfc..0000000000 --- a/test/tint/builtins/gen/textureStore/0c3dff.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_0c3dff() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_0c3dff(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_0c3dff(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_0c3dff(); -} diff --git a/test/tint/builtins/gen/textureStore/102722.wgsl b/test/tint/builtins/gen/textureStore/102722.wgsl deleted file mode 100644 index 845511824c..0000000000 --- a/test/tint/builtins/gen/textureStore/102722.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_102722() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_102722(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_102722(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_102722(); -} diff --git a/test/tint/builtins/gen/textureStore/102722.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/102722.wgsl.expected.glsl deleted file mode 100644 index cf61c8d405..0000000000 --- a/test/tint/builtins/gen/textureStore/102722.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(r32ui) uniform highp writeonly uimage1D arg_0; -void textureStore_102722() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_102722(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(r32ui) uniform highp writeonly uimage1D arg_0; -void textureStore_102722() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_102722(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'uimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(r32ui) uniform highp writeonly uimage1D arg_0; -void textureStore_102722() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_102722(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/102722.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/102722.wgsl.expected.hlsl deleted file mode 100644 index 5ff0d4427e..0000000000 --- a/test/tint/builtins/gen/textureStore/102722.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_102722() { - arg_0[1] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_102722(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_102722(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_102722(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/102722.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/102722.wgsl.expected.msl deleted file mode 100644 index 5846677897..0000000000 --- a/test/tint/builtins/gen/textureStore/102722.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_102722(texture1d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_102722(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_102722(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_102722(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/102722.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/102722.wgsl.expected.wgsl deleted file mode 100644 index 593c342baf..0000000000 --- a/test/tint/builtins/gen/textureStore/102722.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_102722() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_102722(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_102722(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_102722(); -} diff --git a/test/tint/builtins/gen/textureStore/1bbd08.wgsl b/test/tint/builtins/gen/textureStore/1bbd08.wgsl deleted file mode 100644 index 2537d612d9..0000000000 --- a/test/tint/builtins/gen/textureStore/1bbd08.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_1bbd08() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_1bbd08(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_1bbd08(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_1bbd08(); -} diff --git a/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.glsl deleted file mode 100644 index 54cb87d526..0000000000 --- a/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8) uniform highp writeonly image3D arg_0; -void textureStore_1bbd08() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_1bbd08(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8) uniform highp writeonly image3D arg_0; -void textureStore_1bbd08() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_1bbd08(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8) uniform highp writeonly image3D arg_0; -void textureStore_1bbd08() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_1bbd08(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.hlsl deleted file mode 100644 index 7394a043ed..0000000000 --- a/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_1bbd08() { - arg_0[int3(0, 0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_1bbd08(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_1bbd08(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_1bbd08(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.msl deleted file mode 100644 index abc4ff09e6..0000000000 --- a/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_1bbd08(texture3d tint_symbol_1) { - tint_symbol_1.write(float4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_1bbd08(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_1bbd08(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_1bbd08(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.wgsl deleted file mode 100644 index a775be711e..0000000000 --- a/test/tint/builtins/gen/textureStore/1bbd08.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_1bbd08() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_1bbd08(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_1bbd08(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_1bbd08(); -} diff --git a/test/tint/builtins/gen/textureStore/1c02e7.wgsl b/test/tint/builtins/gen/textureStore/1c02e7.wgsl deleted file mode 100644 index c1dc4146e7..0000000000 --- a/test/tint/builtins/gen/textureStore/1c02e7.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_1c02e7() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_1c02e7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_1c02e7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_1c02e7(); -} diff --git a/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.glsl deleted file mode 100644 index fee964016a..0000000000 --- a/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_1c02e7() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_1c02e7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_1c02e7() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_1c02e7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_1c02e7() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_1c02e7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.hlsl deleted file mode 100644 index 18e87d37e8..0000000000 --- a/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_1c02e7() { - arg_0[int3(0, 0, 1)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_1c02e7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_1c02e7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_1c02e7(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.msl deleted file mode 100644 index 2f25bbfa7b..0000000000 --- a/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_1c02e7(texture2d_array tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_1c02e7(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_1c02e7(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_1c02e7(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.wgsl deleted file mode 100644 index 732759fccb..0000000000 --- a/test/tint/builtins/gen/textureStore/1c02e7.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_1c02e7() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_1c02e7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_1c02e7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_1c02e7(); -} diff --git a/test/tint/builtins/gen/textureStore/22d955.wgsl b/test/tint/builtins/gen/textureStore/22d955.wgsl deleted file mode 100644 index fd3f3ce2fb..0000000000 --- a/test/tint/builtins/gen/textureStore/22d955.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_22d955() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_22d955(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_22d955(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_22d955(); -} diff --git a/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.glsl deleted file mode 100644 index d54f0b26be..0000000000 --- a/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_22d955() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_22d955(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_22d955() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_22d955(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_22d955() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_22d955(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.hlsl deleted file mode 100644 index 3621eee4e8..0000000000 --- a/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_22d955() { - arg_0[int3(0, 0, 1)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_22d955(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_22d955(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_22d955(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.msl deleted file mode 100644 index 41c9ba061f..0000000000 --- a/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_22d955(texture2d_array tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_22d955(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_22d955(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_22d955(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.wgsl deleted file mode 100644 index b9fe255b4a..0000000000 --- a/test/tint/builtins/gen/textureStore/22d955.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_22d955() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_22d955(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_22d955(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_22d955(); -} diff --git a/test/tint/builtins/gen/textureStore/26bf70.wgsl b/test/tint/builtins/gen/textureStore/26bf70.wgsl deleted file mode 100644 index 1610dec258..0000000000 --- a/test/tint/builtins/gen/textureStore/26bf70.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_26bf70() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_26bf70(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_26bf70(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_26bf70(); -} diff --git a/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.glsl deleted file mode 100644 index 5287dadcba..0000000000 --- a/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2D arg_0; -void textureStore_26bf70() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_26bf70(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32ui) uniform highp writeonly uimage2D arg_0; -void textureStore_26bf70() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_26bf70(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2D arg_0; -void textureStore_26bf70() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_26bf70(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.hlsl deleted file mode 100644 index 9e7dc61094..0000000000 --- a/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_26bf70() { - arg_0[int2(0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_26bf70(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_26bf70(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_26bf70(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.msl deleted file mode 100644 index b016d7fa02..0000000000 --- a/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_26bf70(texture2d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_26bf70(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_26bf70(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_26bf70(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.wgsl deleted file mode 100644 index 896b4f7a4f..0000000000 --- a/test/tint/builtins/gen/textureStore/26bf70.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_26bf70() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_26bf70(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_26bf70(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_26bf70(); -} diff --git a/test/tint/builtins/gen/textureStore/2796b4.wgsl b/test/tint/builtins/gen/textureStore/2796b4.wgsl deleted file mode 100644 index f8376a714c..0000000000 --- a/test/tint/builtins/gen/textureStore/2796b4.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_2796b4() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_2796b4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_2796b4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_2796b4(); -} diff --git a/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.glsl deleted file mode 100644 index 6a9ddd4195..0000000000 --- a/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage3D arg_0; -void textureStore_2796b4() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_2796b4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32i) uniform highp writeonly iimage3D arg_0; -void textureStore_2796b4() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_2796b4(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage3D arg_0; -void textureStore_2796b4() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_2796b4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.hlsl deleted file mode 100644 index 4a08b65c2c..0000000000 --- a/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_2796b4() { - arg_0[int3(0, 0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_2796b4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_2796b4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_2796b4(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.msl deleted file mode 100644 index 4c315532b3..0000000000 --- a/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_2796b4(texture3d tint_symbol_1) { - tint_symbol_1.write(int4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_2796b4(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_2796b4(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_2796b4(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.wgsl deleted file mode 100644 index 3fcb394f8f..0000000000 --- a/test/tint/builtins/gen/textureStore/2796b4.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_2796b4() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_2796b4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_2796b4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_2796b4(); -} diff --git a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl b/test/tint/builtins/gen/textureStore/2ac6c7.wgsl deleted file mode 100644 index 030b84b39b..0000000000 --- a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_2ac6c7() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_2ac6c7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_2ac6c7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_2ac6c7(); -} diff --git a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.glsl deleted file mode 100644 index 4ae2c8960c..0000000000 --- a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(r32f) uniform highp writeonly image1D arg_0; -void textureStore_2ac6c7() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_2ac6c7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(r32f) uniform highp writeonly image1D arg_0; -void textureStore_2ac6c7() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_2ac6c7(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(r32f) uniform highp writeonly image1D arg_0; -void textureStore_2ac6c7() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_2ac6c7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.hlsl deleted file mode 100644 index 07e338efb4..0000000000 --- a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_2ac6c7() { - arg_0[1] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_2ac6c7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_2ac6c7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_2ac6c7(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.msl deleted file mode 100644 index 5fb901be62..0000000000 --- a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_2ac6c7(texture1d tint_symbol_1) { - tint_symbol_1.write(float4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_2ac6c7(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_2ac6c7(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_2ac6c7(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.wgsl deleted file mode 100644 index 2786ca40da..0000000000 --- a/test/tint/builtins/gen/textureStore/2ac6c7.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_2ac6c7() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_2ac6c7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_2ac6c7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_2ac6c7(); -} diff --git a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl b/test/tint/builtins/gen/textureStore/2eb2a4.wgsl deleted file mode 100644 index 56d3c7377b..0000000000 --- a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_2eb2a4() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_2eb2a4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_2eb2a4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_2eb2a4(); -} diff --git a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.glsl deleted file mode 100644 index fb385901a8..0000000000 --- a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage1D arg_0; -void textureStore_2eb2a4() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_2eb2a4(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba16ui) uniform highp writeonly uimage1D arg_0; -void textureStore_2eb2a4() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_2eb2a4(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'uimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage1D arg_0; -void textureStore_2eb2a4() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_2eb2a4(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.hlsl deleted file mode 100644 index 7bdb1f6ec7..0000000000 --- a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_2eb2a4() { - arg_0[1] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_2eb2a4(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_2eb2a4(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_2eb2a4(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.msl deleted file mode 100644 index 52eff0b1a3..0000000000 --- a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_2eb2a4(texture1d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_2eb2a4(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_2eb2a4(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_2eb2a4(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.wgsl deleted file mode 100644 index 51c5cd9e53..0000000000 --- a/test/tint/builtins/gen/textureStore/2eb2a4.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_2eb2a4() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_2eb2a4(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_2eb2a4(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_2eb2a4(); -} diff --git a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl b/test/tint/builtins/gen/textureStore/2ed2a3.wgsl deleted file mode 100644 index f86ec1f322..0000000000 --- a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_2ed2a3() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_2ed2a3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_2ed2a3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_2ed2a3(); -} diff --git a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.glsl deleted file mode 100644 index a6aa8e7af0..0000000000 --- a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image1D arg_0; -void textureStore_2ed2a3() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_2ed2a3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba8_snorm) uniform highp writeonly image1D arg_0; -void textureStore_2ed2a3() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_2ed2a3(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image1D arg_0; -void textureStore_2ed2a3() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_2ed2a3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.hlsl deleted file mode 100644 index a0822a03c5..0000000000 --- a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_2ed2a3() { - arg_0[1] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_2ed2a3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_2ed2a3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_2ed2a3(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.msl deleted file mode 100644 index 3f46f67f3f..0000000000 --- a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_2ed2a3(texture1d tint_symbol_1) { - tint_symbol_1.write(float4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_2ed2a3(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_2ed2a3(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_2ed2a3(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.wgsl deleted file mode 100644 index c415d580b7..0000000000 --- a/test/tint/builtins/gen/textureStore/2ed2a3.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_2ed2a3() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_2ed2a3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_2ed2a3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_2ed2a3(); -} diff --git a/test/tint/builtins/gen/textureStore/31745b.wgsl b/test/tint/builtins/gen/textureStore/31745b.wgsl deleted file mode 100644 index 41125fed20..0000000000 --- a/test/tint/builtins/gen/textureStore/31745b.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_31745b() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_31745b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_31745b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_31745b(); -} diff --git a/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.glsl deleted file mode 100644 index 58f502feae..0000000000 --- a/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2D arg_0; -void textureStore_31745b() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_31745b(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32i) uniform highp writeonly iimage2D arg_0; -void textureStore_31745b() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_31745b(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2D arg_0; -void textureStore_31745b() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_31745b(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.hlsl deleted file mode 100644 index c9378fad2a..0000000000 --- a/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_31745b() { - arg_0[int2(0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_31745b(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_31745b(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_31745b(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.msl deleted file mode 100644 index 21a80b4087..0000000000 --- a/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_31745b(texture2d tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_31745b(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_31745b(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_31745b(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.wgsl deleted file mode 100644 index 42884340b0..0000000000 --- a/test/tint/builtins/gen/textureStore/31745b.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_31745b() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_31745b(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_31745b(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_31745b(); -} diff --git a/test/tint/builtins/gen/textureStore/32f368.wgsl b/test/tint/builtins/gen/textureStore/32f368.wgsl deleted file mode 100644 index 5b2aa6bf87..0000000000 --- a/test/tint/builtins/gen/textureStore/32f368.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_32f368() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_32f368(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_32f368(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_32f368(); -} diff --git a/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.glsl deleted file mode 100644 index 4ce1115bc7..0000000000 --- a/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16f) uniform highp writeonly image2DArray arg_0; -void textureStore_32f368() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_32f368(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16f) uniform highp writeonly image2DArray arg_0; -void textureStore_32f368() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_32f368(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16f) uniform highp writeonly image2DArray arg_0; -void textureStore_32f368() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_32f368(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.hlsl deleted file mode 100644 index 35cb76fbbc..0000000000 --- a/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_32f368() { - arg_0[int3(0, 0, 1)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_32f368(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_32f368(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_32f368(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.msl deleted file mode 100644 index 869f74d9de..0000000000 --- a/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_32f368(texture2d_array tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_32f368(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_32f368(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_32f368(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.wgsl deleted file mode 100644 index a7478222ef..0000000000 --- a/test/tint/builtins/gen/textureStore/32f368.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_32f368() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_32f368(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_32f368(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_32f368(); -} diff --git a/test/tint/builtins/gen/textureStore/331aee.wgsl b/test/tint/builtins/gen/textureStore/331aee.wgsl deleted file mode 100644 index 115b0b0211..0000000000 --- a/test/tint/builtins/gen/textureStore/331aee.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_331aee() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_331aee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_331aee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_331aee(); -} diff --git a/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.glsl deleted file mode 100644 index d0a4acfdcc..0000000000 --- a/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32f) uniform highp writeonly image3D arg_0; -void textureStore_331aee() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_331aee(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32f) uniform highp writeonly image3D arg_0; -void textureStore_331aee() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_331aee(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32f) uniform highp writeonly image3D arg_0; -void textureStore_331aee() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_331aee(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.hlsl deleted file mode 100644 index 5a823d41c5..0000000000 --- a/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_331aee() { - arg_0[int3(0, 0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_331aee(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_331aee(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_331aee(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.msl deleted file mode 100644 index aab61d34c6..0000000000 --- a/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_331aee(texture3d tint_symbol_1) { - tint_symbol_1.write(float4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_331aee(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_331aee(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_331aee(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.wgsl deleted file mode 100644 index 036326017f..0000000000 --- a/test/tint/builtins/gen/textureStore/331aee.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_331aee() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_331aee(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_331aee(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_331aee(); -} diff --git a/test/tint/builtins/gen/textureStore/38e8d7.wgsl b/test/tint/builtins/gen/textureStore/38e8d7.wgsl deleted file mode 100644 index e8fc960497..0000000000 --- a/test/tint/builtins/gen/textureStore/38e8d7.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_38e8d7() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_38e8d7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_38e8d7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_38e8d7(); -} diff --git a/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.glsl deleted file mode 100644 index 77c1f2f7e8..0000000000 --- a/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_38e8d7() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_38e8d7(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_38e8d7() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_38e8d7(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_38e8d7() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_38e8d7(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.hlsl deleted file mode 100644 index 9ab58469d7..0000000000 --- a/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_38e8d7() { - arg_0[int3(0, 0, 1)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_38e8d7(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_38e8d7(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_38e8d7(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.msl deleted file mode 100644 index 7b2b0f17a2..0000000000 --- a/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_38e8d7(texture2d_array tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_38e8d7(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_38e8d7(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_38e8d7(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.wgsl deleted file mode 100644 index 28d17915c2..0000000000 --- a/test/tint/builtins/gen/textureStore/38e8d7.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_38e8d7() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_38e8d7(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_38e8d7(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_38e8d7(); -} diff --git a/test/tint/builtins/gen/textureStore/3a52ac.wgsl b/test/tint/builtins/gen/textureStore/3a52ac.wgsl deleted file mode 100644 index c129d6704e..0000000000 --- a/test/tint/builtins/gen/textureStore/3a52ac.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_3a52ac() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_3a52ac(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_3a52ac(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_3a52ac(); -} diff --git a/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.glsl deleted file mode 100644 index 61763f727f..0000000000 --- a/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_3a52ac() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_3a52ac(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_3a52ac() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_3a52ac(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_3a52ac() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_3a52ac(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.hlsl deleted file mode 100644 index 7e1c172e06..0000000000 --- a/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_3a52ac() { - arg_0[int3(0, 0, 1)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_3a52ac(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_3a52ac(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_3a52ac(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.msl deleted file mode 100644 index 6dc9c94aa0..0000000000 --- a/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_3a52ac(texture2d_array tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_3a52ac(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_3a52ac(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_3a52ac(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.wgsl deleted file mode 100644 index 6fbbab08f1..0000000000 --- a/test/tint/builtins/gen/textureStore/3a52ac.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_3a52ac() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_3a52ac(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_3a52ac(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_3a52ac(); -} diff --git a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl b/test/tint/builtins/gen/textureStore/3bb7a1.wgsl deleted file mode 100644 index d1cc97c88f..0000000000 --- a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_3bb7a1() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_3bb7a1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_3bb7a1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_3bb7a1(); -} diff --git a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.glsl deleted file mode 100644 index 2078d9fd5d..0000000000 --- a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32f) uniform highp writeonly image2DArray arg_0; -void textureStore_3bb7a1() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_3bb7a1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32f) uniform highp writeonly image2DArray arg_0; -void textureStore_3bb7a1() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_3bb7a1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32f) uniform highp writeonly image2DArray arg_0; -void textureStore_3bb7a1() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_3bb7a1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.hlsl deleted file mode 100644 index a81883ca60..0000000000 --- a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_3bb7a1() { - arg_0[int3(0, 0, 1)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_3bb7a1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_3bb7a1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_3bb7a1(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.msl deleted file mode 100644 index d3dcf83376..0000000000 --- a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_3bb7a1(texture2d_array tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_3bb7a1(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_3bb7a1(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_3bb7a1(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.wgsl deleted file mode 100644 index ccb304d97c..0000000000 --- a/test/tint/builtins/gen/textureStore/3bb7a1.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_3bb7a1() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_3bb7a1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_3bb7a1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_3bb7a1(); -} diff --git a/test/tint/builtins/gen/textureStore/3bec15.wgsl b/test/tint/builtins/gen/textureStore/3bec15.wgsl deleted file mode 100644 index 6c2e068a9e..0000000000 --- a/test/tint/builtins/gen/textureStore/3bec15.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_3bec15() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_3bec15(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_3bec15(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_3bec15(); -} diff --git a/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.glsl deleted file mode 100644 index dc8afb237f..0000000000 --- a/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage1D arg_0; -void textureStore_3bec15() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_3bec15(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba8ui) uniform highp writeonly uimage1D arg_0; -void textureStore_3bec15() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_3bec15(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'uimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage1D arg_0; -void textureStore_3bec15() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_3bec15(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.hlsl deleted file mode 100644 index a9f622dcda..0000000000 --- a/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_3bec15() { - arg_0[1] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_3bec15(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_3bec15(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_3bec15(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.msl deleted file mode 100644 index 63deae2576..0000000000 --- a/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_3bec15(texture1d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_3bec15(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_3bec15(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_3bec15(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.wgsl deleted file mode 100644 index c594be03d2..0000000000 --- a/test/tint/builtins/gen/textureStore/3bec15.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_3bec15() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_3bec15(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_3bec15(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_3bec15(); -} diff --git a/test/tint/builtins/gen/textureStore/441ba8.wgsl b/test/tint/builtins/gen/textureStore/441ba8.wgsl deleted file mode 100644 index 4082003f96..0000000000 --- a/test/tint/builtins/gen/textureStore/441ba8.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_441ba8() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_441ba8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_441ba8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_441ba8(); -} diff --git a/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.glsl deleted file mode 100644 index bb598171cd..0000000000 --- a/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage3D arg_0; -void textureStore_441ba8() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_441ba8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32ui) uniform highp writeonly uimage3D arg_0; -void textureStore_441ba8() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_441ba8(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage3D arg_0; -void textureStore_441ba8() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_441ba8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.hlsl deleted file mode 100644 index 593faf20e6..0000000000 --- a/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_441ba8() { - arg_0[int3(0, 0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_441ba8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_441ba8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_441ba8(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.msl deleted file mode 100644 index ddd88f9f31..0000000000 --- a/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_441ba8(texture3d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_441ba8(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_441ba8(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_441ba8(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.wgsl deleted file mode 100644 index b59255a55d..0000000000 --- a/test/tint/builtins/gen/textureStore/441ba8.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_441ba8() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_441ba8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_441ba8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_441ba8(); -} diff --git a/test/tint/builtins/gen/textureStore/4fc057.wgsl b/test/tint/builtins/gen/textureStore/4fc057.wgsl deleted file mode 100644 index c95a1cfad3..0000000000 --- a/test/tint/builtins/gen/textureStore/4fc057.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_4fc057() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_4fc057(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_4fc057(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_4fc057(); -} diff --git a/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.glsl deleted file mode 100644 index c92e32ca94..0000000000 --- a/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; -void textureStore_4fc057() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_4fc057(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; -void textureStore_4fc057() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_4fc057(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; -void textureStore_4fc057() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_4fc057(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.hlsl deleted file mode 100644 index b8e3f68abd..0000000000 --- a/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_4fc057() { - arg_0[int3(0, 0, 1)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_4fc057(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_4fc057(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_4fc057(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.msl deleted file mode 100644 index 73b2de8c04..0000000000 --- a/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_4fc057(texture2d_array tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_4fc057(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_4fc057(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_4fc057(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.wgsl deleted file mode 100644 index 26a0018f20..0000000000 --- a/test/tint/builtins/gen/textureStore/4fc057.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_4fc057() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_4fc057(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_4fc057(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_4fc057(); -} diff --git a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl b/test/tint/builtins/gen/textureStore/5a2f8f.wgsl deleted file mode 100644 index 6d800c9dde..0000000000 --- a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_5a2f8f() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_5a2f8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_5a2f8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_5a2f8f(); -} diff --git a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.glsl deleted file mode 100644 index d94204def8..0000000000 --- a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage1D arg_0; -void textureStore_5a2f8f() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_5a2f8f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba16i) uniform highp writeonly iimage1D arg_0; -void textureStore_5a2f8f() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_5a2f8f(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'iimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage1D arg_0; -void textureStore_5a2f8f() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_5a2f8f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.hlsl deleted file mode 100644 index 7fa35a8870..0000000000 --- a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_5a2f8f() { - arg_0[1] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_5a2f8f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_5a2f8f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_5a2f8f(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.msl deleted file mode 100644 index a1a8470722..0000000000 --- a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_5a2f8f(texture1d tint_symbol_1) { - tint_symbol_1.write(int4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_5a2f8f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_5a2f8f(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_5a2f8f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.wgsl deleted file mode 100644 index 13d97f40aa..0000000000 --- a/test/tint/builtins/gen/textureStore/5a2f8f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_5a2f8f() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_5a2f8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_5a2f8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_5a2f8f(); -} diff --git a/test/tint/builtins/gen/textureStore/60975f.wgsl b/test/tint/builtins/gen/textureStore/60975f.wgsl deleted file mode 100644 index 6ec404516a..0000000000 --- a/test/tint/builtins/gen/textureStore/60975f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_60975f() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_60975f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_60975f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_60975f(); -} diff --git a/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.glsl deleted file mode 100644 index de7d5dc904..0000000000 --- a/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8) uniform highp writeonly image2DArray arg_0; -void textureStore_60975f() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_60975f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8) uniform highp writeonly image2DArray arg_0; -void textureStore_60975f() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_60975f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8) uniform highp writeonly image2DArray arg_0; -void textureStore_60975f() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_60975f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.hlsl deleted file mode 100644 index 811a27c847..0000000000 --- a/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_60975f() { - arg_0[int3(0, 0, 1)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_60975f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_60975f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_60975f(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.msl deleted file mode 100644 index 38bf10c6f7..0000000000 --- a/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_60975f(texture2d_array tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_60975f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_60975f(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_60975f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.wgsl deleted file mode 100644 index 47cdd347a1..0000000000 --- a/test/tint/builtins/gen/textureStore/60975f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_60975f() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_60975f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_60975f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_60975f(); -} diff --git a/test/tint/builtins/gen/textureStore/682fd6.wgsl b/test/tint/builtins/gen/textureStore/682fd6.wgsl deleted file mode 100644 index 789c05161f..0000000000 --- a/test/tint/builtins/gen/textureStore/682fd6.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_682fd6() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_682fd6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_682fd6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_682fd6(); -} diff --git a/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.glsl deleted file mode 100644 index 4b5e6391c0..0000000000 --- a/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2D arg_0; -void textureStore_682fd6() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_682fd6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32ui) uniform highp writeonly uimage2D arg_0; -void textureStore_682fd6() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_682fd6(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2D arg_0; -void textureStore_682fd6() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_682fd6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.hlsl deleted file mode 100644 index 95a07d3746..0000000000 --- a/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_682fd6() { - arg_0[int2(0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_682fd6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_682fd6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_682fd6(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.msl deleted file mode 100644 index 592b20f09a..0000000000 --- a/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_682fd6(texture2d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_682fd6(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_682fd6(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_682fd6(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.wgsl deleted file mode 100644 index 20603cc7b1..0000000000 --- a/test/tint/builtins/gen/textureStore/682fd6.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_682fd6() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_682fd6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_682fd6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_682fd6(); -} diff --git a/test/tint/builtins/gen/textureStore/6b75c3.wgsl b/test/tint/builtins/gen/textureStore/6b75c3.wgsl deleted file mode 100644 index b6b95b641b..0000000000 --- a/test/tint/builtins/gen/textureStore/6b75c3.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_6b75c3() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_6b75c3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_6b75c3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_6b75c3(); -} diff --git a/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.glsl deleted file mode 100644 index 1a9dd67548..0000000000 --- a/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba32f) uniform highp writeonly image1D arg_0; -void textureStore_6b75c3() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_6b75c3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba32f) uniform highp writeonly image1D arg_0; -void textureStore_6b75c3() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_6b75c3(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba32f) uniform highp writeonly image1D arg_0; -void textureStore_6b75c3() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_6b75c3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.hlsl deleted file mode 100644 index d2c7cacacb..0000000000 --- a/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_6b75c3() { - arg_0[1] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_6b75c3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_6b75c3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_6b75c3(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.msl deleted file mode 100644 index 7f987b232a..0000000000 --- a/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_6b75c3(texture1d tint_symbol_1) { - tint_symbol_1.write(float4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_6b75c3(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_6b75c3(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_6b75c3(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.wgsl deleted file mode 100644 index cd827a3990..0000000000 --- a/test/tint/builtins/gen/textureStore/6b75c3.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_6b75c3() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_6b75c3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_6b75c3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_6b75c3(); -} diff --git a/test/tint/builtins/gen/textureStore/6b80d2.wgsl b/test/tint/builtins/gen/textureStore/6b80d2.wgsl deleted file mode 100644 index 9e0850635a..0000000000 --- a/test/tint/builtins/gen/textureStore/6b80d2.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_6b80d2() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_6b80d2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_6b80d2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_6b80d2(); -} diff --git a/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.glsl deleted file mode 100644 index beb60b7d5c..0000000000 --- a/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(r32i) uniform highp writeonly iimage1D arg_0; -void textureStore_6b80d2() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_6b80d2(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(r32i) uniform highp writeonly iimage1D arg_0; -void textureStore_6b80d2() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_6b80d2(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'iimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(r32i) uniform highp writeonly iimage1D arg_0; -void textureStore_6b80d2() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_6b80d2(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.hlsl deleted file mode 100644 index 630297ab7a..0000000000 --- a/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_6b80d2() { - arg_0[1] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_6b80d2(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_6b80d2(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_6b80d2(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.msl deleted file mode 100644 index 5db31c8e0c..0000000000 --- a/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_6b80d2(texture1d tint_symbol_1) { - tint_symbol_1.write(int4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_6b80d2(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_6b80d2(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_6b80d2(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.wgsl deleted file mode 100644 index e7efff2d8e..0000000000 --- a/test/tint/builtins/gen/textureStore/6b80d2.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_6b80d2() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_6b80d2(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_6b80d2(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_6b80d2(); -} diff --git a/test/tint/builtins/gen/textureStore/6cff2e.wgsl b/test/tint/builtins/gen/textureStore/6cff2e.wgsl deleted file mode 100644 index 79346c80c6..0000000000 --- a/test/tint/builtins/gen/textureStore/6cff2e.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_6cff2e() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_6cff2e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_6cff2e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_6cff2e(); -} diff --git a/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.glsl deleted file mode 100644 index 822db4169c..0000000000 --- a/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2D arg_0; -void textureStore_6cff2e() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_6cff2e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32ui) uniform highp writeonly uimage2D arg_0; -void textureStore_6cff2e() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_6cff2e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32ui) uniform highp writeonly uimage2D arg_0; -void textureStore_6cff2e() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_6cff2e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.hlsl deleted file mode 100644 index e6355996a6..0000000000 --- a/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_6cff2e() { - arg_0[int2(0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_6cff2e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_6cff2e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_6cff2e(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.msl deleted file mode 100644 index b086eed446..0000000000 --- a/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_6cff2e(texture2d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_6cff2e(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_6cff2e(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_6cff2e(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.wgsl deleted file mode 100644 index 4f43b983ec..0000000000 --- a/test/tint/builtins/gen/textureStore/6cff2e.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_6cff2e() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_6cff2e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_6cff2e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_6cff2e(); -} diff --git a/test/tint/builtins/gen/textureStore/6da692.wgsl b/test/tint/builtins/gen/textureStore/6da692.wgsl deleted file mode 100644 index adad2a6b95..0000000000 --- a/test/tint/builtins/gen/textureStore/6da692.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_6da692() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_6da692(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_6da692(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_6da692(); -} diff --git a/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.glsl deleted file mode 100644 index d8080ac1f1..0000000000 --- a/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_6da692() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_6da692(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_6da692() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_6da692(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_6da692() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_6da692(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.hlsl deleted file mode 100644 index a227f8f6dc..0000000000 --- a/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_6da692() { - arg_0[int3(0, 0, 1)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_6da692(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_6da692(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_6da692(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.msl deleted file mode 100644 index a83fda74df..0000000000 --- a/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_6da692(texture2d_array tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_6da692(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_6da692(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_6da692(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.wgsl deleted file mode 100644 index 2497a692c8..0000000000 --- a/test/tint/builtins/gen/textureStore/6da692.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_6da692() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_6da692(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_6da692(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_6da692(); -} diff --git a/test/tint/builtins/gen/textureStore/731349.wgsl b/test/tint/builtins/gen/textureStore/731349.wgsl deleted file mode 100644 index 82da1b3ed8..0000000000 --- a/test/tint/builtins/gen/textureStore/731349.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_731349() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_731349(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_731349(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_731349(); -} diff --git a/test/tint/builtins/gen/textureStore/731349.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/731349.wgsl.expected.glsl deleted file mode 100644 index 170ed65696..0000000000 --- a/test/tint/builtins/gen/textureStore/731349.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8) uniform highp writeonly image2D arg_0; -void textureStore_731349() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_731349(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8) uniform highp writeonly image2D arg_0; -void textureStore_731349() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_731349(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8) uniform highp writeonly image2D arg_0; -void textureStore_731349() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_731349(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/731349.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/731349.wgsl.expected.hlsl deleted file mode 100644 index b13dd3024e..0000000000 --- a/test/tint/builtins/gen/textureStore/731349.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_731349() { - arg_0[int2(0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_731349(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_731349(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_731349(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/731349.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/731349.wgsl.expected.msl deleted file mode 100644 index 2346b59a83..0000000000 --- a/test/tint/builtins/gen/textureStore/731349.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_731349(texture2d tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_731349(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_731349(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_731349(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/731349.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/731349.wgsl.expected.wgsl deleted file mode 100644 index d5466d87c5..0000000000 --- a/test/tint/builtins/gen/textureStore/731349.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_731349() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_731349(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_731349(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_731349(); -} diff --git a/test/tint/builtins/gen/textureStore/752da6.wgsl b/test/tint/builtins/gen/textureStore/752da6.wgsl deleted file mode 100644 index 628b5e38c7..0000000000 --- a/test/tint/builtins/gen/textureStore/752da6.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_752da6() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_752da6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_752da6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_752da6(); -} diff --git a/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.glsl deleted file mode 100644 index 0758a63c03..0000000000 --- a/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2D arg_0; -void textureStore_752da6() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_752da6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32i) uniform highp writeonly iimage2D arg_0; -void textureStore_752da6() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_752da6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2D arg_0; -void textureStore_752da6() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_752da6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.hlsl deleted file mode 100644 index 5e8ed8ac72..0000000000 --- a/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_752da6() { - arg_0[int2(0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_752da6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_752da6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_752da6(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.msl deleted file mode 100644 index 3c4ff0b185..0000000000 --- a/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_752da6(texture2d tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_752da6(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_752da6(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_752da6(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.wgsl deleted file mode 100644 index e029549a8a..0000000000 --- a/test/tint/builtins/gen/textureStore/752da6.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_752da6() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_752da6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_752da6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_752da6(); -} diff --git a/test/tint/builtins/gen/textureStore/77c0ae.wgsl b/test/tint/builtins/gen/textureStore/77c0ae.wgsl deleted file mode 100644 index fd3e35bb75..0000000000 --- a/test/tint/builtins/gen/textureStore/77c0ae.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_77c0ae() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_77c0ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_77c0ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_77c0ae(); -} diff --git a/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.glsl deleted file mode 100644 index 60833b202a..0000000000 --- a/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2D arg_0; -void textureStore_77c0ae() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_77c0ae(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8ui) uniform highp writeonly uimage2D arg_0; -void textureStore_77c0ae() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_77c0ae(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage2D arg_0; -void textureStore_77c0ae() { - imageStore(arg_0, ivec2(0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_77c0ae(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.hlsl deleted file mode 100644 index ad9871f15e..0000000000 --- a/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_77c0ae() { - arg_0[int2(0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_77c0ae(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_77c0ae(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_77c0ae(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.msl deleted file mode 100644 index 051bd4e07b..0000000000 --- a/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_77c0ae(texture2d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_77c0ae(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_77c0ae(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_77c0ae(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.wgsl deleted file mode 100644 index 56cf0793e5..0000000000 --- a/test/tint/builtins/gen/textureStore/77c0ae.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_77c0ae() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_77c0ae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_77c0ae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_77c0ae(); -} diff --git a/test/tint/builtins/gen/textureStore/7cec8d.wgsl b/test/tint/builtins/gen/textureStore/7cec8d.wgsl deleted file mode 100644 index 33f5538843..0000000000 --- a/test/tint/builtins/gen/textureStore/7cec8d.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_7cec8d() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_7cec8d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_7cec8d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_7cec8d(); -} diff --git a/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.glsl deleted file mode 100644 index ca986aae64..0000000000 --- a/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_7cec8d() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_7cec8d(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_7cec8d() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_7cec8d(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_7cec8d() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_7cec8d(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.hlsl deleted file mode 100644 index 312c3d8d06..0000000000 --- a/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_7cec8d() { - arg_0[int3(0, 0, 1)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_7cec8d(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_7cec8d(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_7cec8d(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.msl deleted file mode 100644 index 00250f3235..0000000000 --- a/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_7cec8d(texture2d_array tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_7cec8d(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_7cec8d(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_7cec8d(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.wgsl deleted file mode 100644 index 89ed161d72..0000000000 --- a/test/tint/builtins/gen/textureStore/7cec8d.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_7cec8d() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_7cec8d(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_7cec8d(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_7cec8d(); -} diff --git a/test/tint/builtins/gen/textureStore/7f7fae.wgsl b/test/tint/builtins/gen/textureStore/7f7fae.wgsl deleted file mode 100644 index e65082e7f6..0000000000 --- a/test/tint/builtins/gen/textureStore/7f7fae.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_7f7fae() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_7f7fae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_7f7fae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_7f7fae(); -} diff --git a/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.glsl deleted file mode 100644 index f008dd1016..0000000000 --- a/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba8) uniform highp writeonly image1D arg_0; -void textureStore_7f7fae() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_7f7fae(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba8) uniform highp writeonly image1D arg_0; -void textureStore_7f7fae() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_7f7fae(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba8) uniform highp writeonly image1D arg_0; -void textureStore_7f7fae() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_7f7fae(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.hlsl deleted file mode 100644 index aa796401b8..0000000000 --- a/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_7f7fae() { - arg_0[1] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_7f7fae(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_7f7fae(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_7f7fae(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.msl deleted file mode 100644 index 8b11e389dc..0000000000 --- a/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_7f7fae(texture1d tint_symbol_1) { - tint_symbol_1.write(float4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_7f7fae(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_7f7fae(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_7f7fae(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.wgsl deleted file mode 100644 index 438123c898..0000000000 --- a/test/tint/builtins/gen/textureStore/7f7fae.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_7f7fae() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_7f7fae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_7f7fae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_7f7fae(); -} diff --git a/test/tint/builtins/gen/textureStore/804942.wgsl b/test/tint/builtins/gen/textureStore/804942.wgsl deleted file mode 100644 index 95ac5506ce..0000000000 --- a/test/tint/builtins/gen/textureStore/804942.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_804942() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_804942(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_804942(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_804942(); -} diff --git a/test/tint/builtins/gen/textureStore/804942.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/804942.wgsl.expected.glsl deleted file mode 100644 index fcee8b0503..0000000000 --- a/test/tint/builtins/gen/textureStore/804942.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32i) uniform highp writeonly iimage2D arg_0; -void textureStore_804942() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_804942(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32i) uniform highp writeonly iimage2D arg_0; -void textureStore_804942() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_804942(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32i) uniform highp writeonly iimage2D arg_0; -void textureStore_804942() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_804942(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/804942.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/804942.wgsl.expected.hlsl deleted file mode 100644 index e8cf229829..0000000000 --- a/test/tint/builtins/gen/textureStore/804942.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_804942() { - arg_0[int2(0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_804942(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_804942(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_804942(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/804942.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/804942.wgsl.expected.msl deleted file mode 100644 index df25a3242a..0000000000 --- a/test/tint/builtins/gen/textureStore/804942.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_804942(texture2d tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_804942(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_804942(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_804942(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/804942.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/804942.wgsl.expected.wgsl deleted file mode 100644 index f4a325c7ad..0000000000 --- a/test/tint/builtins/gen/textureStore/804942.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_804942() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_804942(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_804942(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_804942(); -} diff --git a/test/tint/builtins/gen/textureStore/805dae.wgsl b/test/tint/builtins/gen/textureStore/805dae.wgsl deleted file mode 100644 index 9d96265647..0000000000 --- a/test/tint/builtins/gen/textureStore/805dae.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_805dae() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_805dae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_805dae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_805dae(); -} diff --git a/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.glsl deleted file mode 100644 index bfe1010c34..0000000000 --- a/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2D arg_0; -void textureStore_805dae() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_805dae(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8_snorm) uniform highp writeonly image2D arg_0; -void textureStore_805dae() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_805dae(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image2D arg_0; -void textureStore_805dae() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_805dae(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.hlsl deleted file mode 100644 index 1259ff3c77..0000000000 --- a/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_805dae() { - arg_0[int2(0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_805dae(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_805dae(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_805dae(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.msl deleted file mode 100644 index bd51b5ae12..0000000000 --- a/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_805dae(texture2d tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_805dae(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_805dae(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_805dae(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.wgsl deleted file mode 100644 index 667452dffa..0000000000 --- a/test/tint/builtins/gen/textureStore/805dae.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_805dae() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_805dae(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_805dae(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_805dae(); -} diff --git a/test/tint/builtins/gen/textureStore/83bcc1.wgsl b/test/tint/builtins/gen/textureStore/83bcc1.wgsl deleted file mode 100644 index fad38173fa..0000000000 --- a/test/tint/builtins/gen/textureStore/83bcc1.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_83bcc1() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_83bcc1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_83bcc1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_83bcc1(); -} diff --git a/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.glsl deleted file mode 100644 index 18fe898b29..0000000000 --- a/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage1D arg_0; -void textureStore_83bcc1() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_83bcc1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32ui) uniform highp writeonly uimage1D arg_0; -void textureStore_83bcc1() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_83bcc1(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage1D arg_0; -void textureStore_83bcc1() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_83bcc1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.hlsl deleted file mode 100644 index c73ba1f8a5..0000000000 --- a/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_83bcc1() { - arg_0[1] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_83bcc1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_83bcc1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_83bcc1(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.msl deleted file mode 100644 index f0be4b0be3..0000000000 --- a/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_83bcc1(texture1d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_83bcc1(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_83bcc1(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_83bcc1(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.wgsl deleted file mode 100644 index f0ee8634d7..0000000000 --- a/test/tint/builtins/gen/textureStore/83bcc1.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_83bcc1() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_83bcc1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_83bcc1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_83bcc1(); -} diff --git a/test/tint/builtins/gen/textureStore/872747.wgsl b/test/tint/builtins/gen/textureStore/872747.wgsl deleted file mode 100644 index ebb8f4532a..0000000000 --- a/test/tint/builtins/gen/textureStore/872747.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_872747() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_872747(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_872747(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_872747(); -} diff --git a/test/tint/builtins/gen/textureStore/872747.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/872747.wgsl.expected.glsl deleted file mode 100644 index afd9b08a16..0000000000 --- a/test/tint/builtins/gen/textureStore/872747.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32f) uniform highp writeonly image1D arg_0; -void textureStore_872747() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_872747(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32f) uniform highp writeonly image1D arg_0; -void textureStore_872747() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_872747(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32f) uniform highp writeonly image1D arg_0; -void textureStore_872747() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_872747(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/872747.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/872747.wgsl.expected.hlsl deleted file mode 100644 index 2f1f45b901..0000000000 --- a/test/tint/builtins/gen/textureStore/872747.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_872747() { - arg_0[1] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_872747(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_872747(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_872747(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/872747.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/872747.wgsl.expected.msl deleted file mode 100644 index 916a2be74c..0000000000 --- a/test/tint/builtins/gen/textureStore/872747.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_872747(texture1d tint_symbol_1) { - tint_symbol_1.write(float4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_872747(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_872747(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_872747(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/872747.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/872747.wgsl.expected.wgsl deleted file mode 100644 index b5c291414e..0000000000 --- a/test/tint/builtins/gen/textureStore/872747.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_872747() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_872747(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_872747(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_872747(); -} diff --git a/test/tint/builtins/gen/textureStore/8e0479.wgsl b/test/tint/builtins/gen/textureStore/8e0479.wgsl deleted file mode 100644 index e948201ff2..0000000000 --- a/test/tint/builtins/gen/textureStore/8e0479.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_8e0479() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_8e0479(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_8e0479(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_8e0479(); -} diff --git a/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.glsl deleted file mode 100644 index 5a303b1e84..0000000000 --- a/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_8e0479() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_8e0479(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_8e0479() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_8e0479(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_8e0479() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_8e0479(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.hlsl deleted file mode 100644 index 7ce20468bc..0000000000 --- a/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_8e0479() { - arg_0[int3(0, 0, 1)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_8e0479(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_8e0479(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_8e0479(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.msl deleted file mode 100644 index b7b344bc02..0000000000 --- a/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_8e0479(texture2d_array tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_8e0479(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_8e0479(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_8e0479(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.wgsl deleted file mode 100644 index 07408ae262..0000000000 --- a/test/tint/builtins/gen/textureStore/8e0479.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_8e0479() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_8e0479(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_8e0479(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_8e0479(); -} diff --git a/test/tint/builtins/gen/textureStore/8f71a1.wgsl b/test/tint/builtins/gen/textureStore/8f71a1.wgsl deleted file mode 100644 index 4d7c91ee0a..0000000000 --- a/test/tint/builtins/gen/textureStore/8f71a1.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_8f71a1() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_8f71a1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_8f71a1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_8f71a1(); -} diff --git a/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.glsl deleted file mode 100644 index ce8eb02257..0000000000 --- a/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage3D arg_0; -void textureStore_8f71a1() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_8f71a1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16i) uniform highp writeonly iimage3D arg_0; -void textureStore_8f71a1() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_8f71a1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage3D arg_0; -void textureStore_8f71a1() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_8f71a1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.hlsl deleted file mode 100644 index 6a9b01f2e7..0000000000 --- a/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_8f71a1() { - arg_0[int3(0, 0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_8f71a1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_8f71a1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_8f71a1(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.msl deleted file mode 100644 index 097f768caa..0000000000 --- a/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_8f71a1(texture3d tint_symbol_1) { - tint_symbol_1.write(int4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_8f71a1(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_8f71a1(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_8f71a1(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.wgsl deleted file mode 100644 index 9bacd31188..0000000000 --- a/test/tint/builtins/gen/textureStore/8f71a1.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_8f71a1() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_8f71a1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_8f71a1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_8f71a1(); -} diff --git a/test/tint/builtins/gen/textureStore/969534.wgsl b/test/tint/builtins/gen/textureStore/969534.wgsl deleted file mode 100644 index 5897793dd3..0000000000 --- a/test/tint/builtins/gen/textureStore/969534.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_969534() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_969534(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_969534(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_969534(); -} diff --git a/test/tint/builtins/gen/textureStore/969534.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/969534.wgsl.expected.glsl deleted file mode 100644 index c9fdae97f9..0000000000 --- a/test/tint/builtins/gen/textureStore/969534.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage1D arg_0; -void textureStore_969534() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_969534(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba32i) uniform highp writeonly iimage1D arg_0; -void textureStore_969534() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_969534(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'iimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage1D arg_0; -void textureStore_969534() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_969534(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/969534.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/969534.wgsl.expected.hlsl deleted file mode 100644 index 4ec5ed25d4..0000000000 --- a/test/tint/builtins/gen/textureStore/969534.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_969534() { - arg_0[1] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_969534(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_969534(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_969534(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/969534.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/969534.wgsl.expected.msl deleted file mode 100644 index 9792266077..0000000000 --- a/test/tint/builtins/gen/textureStore/969534.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_969534(texture1d tint_symbol_1) { - tint_symbol_1.write(int4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_969534(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_969534(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_969534(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/969534.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/969534.wgsl.expected.wgsl deleted file mode 100644 index 467cbdad03..0000000000 --- a/test/tint/builtins/gen/textureStore/969534.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_969534() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_969534(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_969534(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_969534(); -} diff --git a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl b/test/tint/builtins/gen/textureStore/9a3ecc.wgsl deleted file mode 100644 index 6fd2d30105..0000000000 --- a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_9a3ecc() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_9a3ecc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_9a3ecc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_9a3ecc(); -} diff --git a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.glsl deleted file mode 100644 index 4f93898eb7..0000000000 --- a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage3D arg_0; -void textureStore_9a3ecc() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_9a3ecc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32i) uniform highp writeonly iimage3D arg_0; -void textureStore_9a3ecc() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_9a3ecc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32i) uniform highp writeonly iimage3D arg_0; -void textureStore_9a3ecc() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_9a3ecc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.hlsl deleted file mode 100644 index f57c02d772..0000000000 --- a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_9a3ecc() { - arg_0[int3(0, 0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_9a3ecc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_9a3ecc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_9a3ecc(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.msl deleted file mode 100644 index 7977030aad..0000000000 --- a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_9a3ecc(texture3d tint_symbol_1) { - tint_symbol_1.write(int4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_9a3ecc(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_9a3ecc(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_9a3ecc(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.wgsl deleted file mode 100644 index 6fe66cb25f..0000000000 --- a/test/tint/builtins/gen/textureStore/9a3ecc.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_9a3ecc() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_9a3ecc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_9a3ecc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_9a3ecc(); -} diff --git a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl b/test/tint/builtins/gen/textureStore/9d9cd5.wgsl deleted file mode 100644 index 4c09b3a33a..0000000000 --- a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_9d9cd5() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_9d9cd5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_9d9cd5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_9d9cd5(); -} diff --git a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.glsl deleted file mode 100644 index 11b5beebcc..0000000000 --- a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba32f) uniform highp writeonly image2DArray arg_0; -void textureStore_9d9cd5() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_9d9cd5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba32f) uniform highp writeonly image2DArray arg_0; -void textureStore_9d9cd5() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_9d9cd5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba32f) uniform highp writeonly image2DArray arg_0; -void textureStore_9d9cd5() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_9d9cd5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.hlsl deleted file mode 100644 index 1f1816f6c4..0000000000 --- a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_9d9cd5() { - arg_0[int3(0, 0, 1)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_9d9cd5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_9d9cd5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_9d9cd5(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.msl deleted file mode 100644 index 6e704caace..0000000000 --- a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_9d9cd5(texture2d_array tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_9d9cd5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_9d9cd5(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_9d9cd5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.wgsl deleted file mode 100644 index 346f01068b..0000000000 --- a/test/tint/builtins/gen/textureStore/9d9cd5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_9d9cd5() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_9d9cd5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_9d9cd5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_9d9cd5(); -} diff --git a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl b/test/tint/builtins/gen/textureStore/9e3ec5.wgsl deleted file mode 100644 index 72323bd3e2..0000000000 --- a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_9e3ec5() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_9e3ec5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_9e3ec5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_9e3ec5(); -} diff --git a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.glsl deleted file mode 100644 index 0277d6c72a..0000000000 --- a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2D arg_0; -void textureStore_9e3ec5() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_9e3ec5(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16i) uniform highp writeonly iimage2D arg_0; -void textureStore_9e3ec5() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_9e3ec5(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16i) uniform highp writeonly iimage2D arg_0; -void textureStore_9e3ec5() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_9e3ec5(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.hlsl deleted file mode 100644 index 8dc4ac13bd..0000000000 --- a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_9e3ec5() { - arg_0[int2(0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_9e3ec5(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_9e3ec5(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_9e3ec5(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.msl deleted file mode 100644 index 9bdfb7a314..0000000000 --- a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_9e3ec5(texture2d tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_9e3ec5(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_9e3ec5(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_9e3ec5(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.wgsl deleted file mode 100644 index aaa8bf6a56..0000000000 --- a/test/tint/builtins/gen/textureStore/9e3ec5.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_9e3ec5() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_9e3ec5(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_9e3ec5(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_9e3ec5(); -} diff --git a/test/tint/builtins/gen/textureStore/ac67aa.wgsl b/test/tint/builtins/gen/textureStore/ac67aa.wgsl deleted file mode 100644 index e9392db438..0000000000 --- a/test/tint/builtins/gen/textureStore/ac67aa.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_ac67aa() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_ac67aa(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_ac67aa(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_ac67aa(); -} diff --git a/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.glsl deleted file mode 100644 index d11d5c13a3..0000000000 --- a/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage3D arg_0; -void textureStore_ac67aa() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_ac67aa(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32ui) uniform highp writeonly uimage3D arg_0; -void textureStore_ac67aa() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_ac67aa(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage3D arg_0; -void textureStore_ac67aa() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_ac67aa(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.hlsl deleted file mode 100644 index e80007ede2..0000000000 --- a/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_ac67aa() { - arg_0[int3(0, 0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_ac67aa(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_ac67aa(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_ac67aa(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.msl deleted file mode 100644 index f61229ed22..0000000000 --- a/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_ac67aa(texture3d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_ac67aa(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_ac67aa(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_ac67aa(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.wgsl deleted file mode 100644 index 21d0d22720..0000000000 --- a/test/tint/builtins/gen/textureStore/ac67aa.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_ac67aa() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_ac67aa(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_ac67aa(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_ac67aa(); -} diff --git a/test/tint/builtins/gen/textureStore/b706b1.wgsl b/test/tint/builtins/gen/textureStore/b706b1.wgsl deleted file mode 100644 index bd55c9efcc..0000000000 --- a/test/tint/builtins/gen/textureStore/b706b1.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_b706b1() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_b706b1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_b706b1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_b706b1(); -} diff --git a/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.glsl deleted file mode 100644 index 797a8cc787..0000000000 --- a/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage3D arg_0; -void textureStore_b706b1() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_b706b1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8i) uniform highp writeonly iimage3D arg_0; -void textureStore_b706b1() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_b706b1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage3D arg_0; -void textureStore_b706b1() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_b706b1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.hlsl deleted file mode 100644 index 60cde5e9ce..0000000000 --- a/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_b706b1() { - arg_0[int3(0, 0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_b706b1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_b706b1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_b706b1(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.msl deleted file mode 100644 index a28cf356c7..0000000000 --- a/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_b706b1(texture3d tint_symbol_1) { - tint_symbol_1.write(int4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_b706b1(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_b706b1(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_b706b1(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.wgsl deleted file mode 100644 index 7b77dc85ef..0000000000 --- a/test/tint/builtins/gen/textureStore/b706b1.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_b706b1() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_b706b1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_b706b1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_b706b1(); -} diff --git a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl b/test/tint/builtins/gen/textureStore/bbcb7f.wgsl deleted file mode 100644 index b220ec5328..0000000000 --- a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_bbcb7f() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_bbcb7f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_bbcb7f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_bbcb7f(); -} diff --git a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.glsl deleted file mode 100644 index 7e52091dce..0000000000 --- a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2D arg_0; -void textureStore_bbcb7f() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_bbcb7f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8i) uniform highp writeonly iimage2D arg_0; -void textureStore_bbcb7f() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_bbcb7f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2D arg_0; -void textureStore_bbcb7f() { - imageStore(arg_0, ivec2(0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_bbcb7f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.hlsl deleted file mode 100644 index 9b7d1734ed..0000000000 --- a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_bbcb7f() { - arg_0[int2(0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_bbcb7f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_bbcb7f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_bbcb7f(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.msl deleted file mode 100644 index 8eff861150..0000000000 --- a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_bbcb7f(texture2d tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_bbcb7f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_bbcb7f(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_bbcb7f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.wgsl deleted file mode 100644 index 8c4bb4df15..0000000000 --- a/test/tint/builtins/gen/textureStore/bbcb7f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_bbcb7f() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_bbcb7f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_bbcb7f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_bbcb7f(); -} diff --git a/test/tint/builtins/gen/textureStore/be6e30.wgsl b/test/tint/builtins/gen/textureStore/be6e30.wgsl deleted file mode 100644 index af203c8a0a..0000000000 --- a/test/tint/builtins/gen/textureStore/be6e30.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d; - -// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) -fn textureStore_be6e30() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_be6e30(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_be6e30(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_be6e30(); -} diff --git a/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.glsl deleted file mode 100644 index 31f01cbc2c..0000000000 --- a/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16f) uniform highp writeonly image2D arg_0; -void textureStore_be6e30() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_be6e30(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16f) uniform highp writeonly image2D arg_0; -void textureStore_be6e30() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_be6e30(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16f) uniform highp writeonly image2D arg_0; -void textureStore_be6e30() { - imageStore(arg_0, ivec2(0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_be6e30(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.hlsl deleted file mode 100644 index 7e32849ac7..0000000000 --- a/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2D arg_0 : register(u0, space1); - -void textureStore_be6e30() { - arg_0[int2(0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_be6e30(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_be6e30(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_be6e30(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.msl deleted file mode 100644 index 5ed9b5f0aa..0000000000 --- a/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_be6e30(texture2d tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d tint_symbol_2) { - textureStore_be6e30(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { - textureStore_be6e30(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { - textureStore_be6e30(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.wgsl deleted file mode 100644 index 3a4c747e01..0000000000 --- a/test/tint/builtins/gen/textureStore/be6e30.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d; - -fn textureStore_be6e30() { - textureStore(arg_0, vec2(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_be6e30(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_be6e30(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_be6e30(); -} diff --git a/test/tint/builtins/gen/textureStore/bf775c.wgsl b/test/tint/builtins/gen/textureStore/bf775c.wgsl deleted file mode 100644 index c793b5f986..0000000000 --- a/test/tint/builtins/gen/textureStore/bf775c.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_bf775c() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_bf775c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_bf775c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_bf775c(); -} diff --git a/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.glsl deleted file mode 100644 index 38cb0e5625..0000000000 --- a/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage1D arg_0; -void textureStore_bf775c() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_bf775c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba8i) uniform highp writeonly iimage1D arg_0; -void textureStore_bf775c() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_bf775c(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'iimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage1D arg_0; -void textureStore_bf775c() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_bf775c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'iimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.hlsl deleted file mode 100644 index e7f85a4f7d..0000000000 --- a/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_bf775c() { - arg_0[1] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_bf775c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_bf775c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_bf775c(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.msl deleted file mode 100644 index d722999e9c..0000000000 --- a/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_bf775c(texture1d tint_symbol_1) { - tint_symbol_1.write(int4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_bf775c(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_bf775c(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_bf775c(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.wgsl deleted file mode 100644 index db5d80e7be..0000000000 --- a/test/tint/builtins/gen/textureStore/bf775c.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_bf775c() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_bf775c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_bf775c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_bf775c(); -} diff --git a/test/tint/builtins/gen/textureStore/c5af1e.wgsl b/test/tint/builtins/gen/textureStore/c5af1e.wgsl deleted file mode 100644 index 8c8a49d24b..0000000000 --- a/test/tint/builtins/gen/textureStore/c5af1e.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_c5af1e() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_c5af1e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_c5af1e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_c5af1e(); -} diff --git a/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.glsl deleted file mode 100644 index f0353e33c3..0000000000 --- a/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba16f) uniform highp writeonly image3D arg_0; -void textureStore_c5af1e() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_c5af1e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba16f) uniform highp writeonly image3D arg_0; -void textureStore_c5af1e() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_c5af1e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba16f) uniform highp writeonly image3D arg_0; -void textureStore_c5af1e() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_c5af1e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.hlsl deleted file mode 100644 index 21f9e2c045..0000000000 --- a/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_c5af1e() { - arg_0[int3(0, 0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_c5af1e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_c5af1e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_c5af1e(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.msl deleted file mode 100644 index 2ed8fe7d4d..0000000000 --- a/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_c5af1e(texture3d tint_symbol_1) { - tint_symbol_1.write(float4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_c5af1e(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_c5af1e(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_c5af1e(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.wgsl deleted file mode 100644 index 02c2ef8e18..0000000000 --- a/test/tint/builtins/gen/textureStore/c5af1e.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_c5af1e() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_c5af1e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_c5af1e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_c5af1e(); -} diff --git a/test/tint/builtins/gen/textureStore/c863be.wgsl b/test/tint/builtins/gen/textureStore/c863be.wgsl deleted file mode 100644 index 2e60dd2656..0000000000 --- a/test/tint/builtins/gen/textureStore/c863be.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_c863be() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_c863be(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_c863be(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_c863be(); -} diff --git a/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.glsl deleted file mode 100644 index 57d609def9..0000000000 --- a/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32f) uniform highp writeonly image2DArray arg_0; -void textureStore_c863be() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_c863be(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32f) uniform highp writeonly image2DArray arg_0; -void textureStore_c863be() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_c863be(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32f) uniform highp writeonly image2DArray arg_0; -void textureStore_c863be() { - imageStore(arg_0, ivec3(0, 0, 1), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_c863be(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.hlsl deleted file mode 100644 index 80266bd8db..0000000000 --- a/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_c863be() { - arg_0[int3(0, 0, 1)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_c863be(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_c863be(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_c863be(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.msl deleted file mode 100644 index cea5b8e7a4..0000000000 --- a/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_c863be(texture2d_array tint_symbol_1) { - tint_symbol_1.write(float4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_c863be(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_c863be(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_c863be(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.wgsl deleted file mode 100644 index 46b5a6920c..0000000000 --- a/test/tint/builtins/gen/textureStore/c863be.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_c863be() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_c863be(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_c863be(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_c863be(); -} diff --git a/test/tint/builtins/gen/textureStore/d73b5c.wgsl b/test/tint/builtins/gen/textureStore/d73b5c.wgsl deleted file mode 100644 index 21d95b93d3..0000000000 --- a/test/tint/builtins/gen/textureStore/d73b5c.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_d73b5c() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_d73b5c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_d73b5c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_d73b5c(); -} diff --git a/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.glsl deleted file mode 100644 index 2c8d566585..0000000000 --- a/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage1D arg_0; -void textureStore_d73b5c() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_d73b5c(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32i) uniform highp writeonly iimage1D arg_0; -void textureStore_d73b5c() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_d73b5c(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage1D arg_0; -void textureStore_d73b5c() { - imageStore(arg_0, 1, ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_d73b5c(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.hlsl deleted file mode 100644 index d3ded482f8..0000000000 --- a/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_d73b5c() { - arg_0[1] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_d73b5c(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_d73b5c(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_d73b5c(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.msl deleted file mode 100644 index 44ed0f4d8f..0000000000 --- a/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_d73b5c(texture1d tint_symbol_1) { - tint_symbol_1.write(int4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_d73b5c(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_d73b5c(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_d73b5c(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.wgsl deleted file mode 100644 index 2b09cbc70e..0000000000 --- a/test/tint/builtins/gen/textureStore/d73b5c.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_d73b5c() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_d73b5c(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_d73b5c(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_d73b5c(); -} diff --git a/test/tint/builtins/gen/textureStore/dd7d81.wgsl b/test/tint/builtins/gen/textureStore/dd7d81.wgsl deleted file mode 100644 index 93a30cd113..0000000000 --- a/test/tint/builtins/gen/textureStore/dd7d81.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_dd7d81() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_dd7d81(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_dd7d81(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_dd7d81(); -} diff --git a/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.glsl deleted file mode 100644 index 14ef8b72f4..0000000000 --- a/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image3D arg_0; -void textureStore_dd7d81() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_dd7d81(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8_snorm) uniform highp writeonly image3D arg_0; -void textureStore_dd7d81() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_dd7d81(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8_snorm) uniform highp writeonly image3D arg_0; -void textureStore_dd7d81() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_dd7d81(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.hlsl deleted file mode 100644 index c46b2b6a1c..0000000000 --- a/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_dd7d81() { - arg_0[int3(0, 0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_dd7d81(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_dd7d81(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_dd7d81(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.msl deleted file mode 100644 index 13e19b40a8..0000000000 --- a/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_dd7d81(texture3d tint_symbol_1) { - tint_symbol_1.write(float4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_dd7d81(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_dd7d81(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_dd7d81(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.wgsl deleted file mode 100644 index f7f4bc1ec9..0000000000 --- a/test/tint/builtins/gen/textureStore/dd7d81.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_dd7d81() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_dd7d81(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_dd7d81(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_dd7d81(); -} diff --git a/test/tint/builtins/gen/textureStore/dde364.wgsl b/test/tint/builtins/gen/textureStore/dde364.wgsl deleted file mode 100644 index d613cb7391..0000000000 --- a/test/tint/builtins/gen/textureStore/dde364.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_dde364() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_dde364(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_dde364(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_dde364(); -} diff --git a/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.glsl deleted file mode 100644 index 43f3727870..0000000000 --- a/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_dde364() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_dde364(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_dde364() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_dde364(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; -void textureStore_dde364() { - imageStore(arg_0, ivec3(0, 0, 1), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_dde364(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.hlsl deleted file mode 100644 index ad7b855c2c..0000000000 --- a/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_dde364() { - arg_0[int3(0, 0, 1)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_dde364(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_dde364(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_dde364(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.msl deleted file mode 100644 index bf69fde29d..0000000000 --- a/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_dde364(texture2d_array tint_symbol_1) { - tint_symbol_1.write(uint4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_dde364(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_dde364(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_dde364(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.wgsl deleted file mode 100644 index 044b09d03d..0000000000 --- a/test/tint/builtins/gen/textureStore/dde364.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_dde364() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_dde364(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_dde364(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_dde364(); -} diff --git a/test/tint/builtins/gen/textureStore/e885e8.wgsl b/test/tint/builtins/gen/textureStore/e885e8.wgsl deleted file mode 100644 index 025f448c94..0000000000 --- a/test/tint/builtins/gen/textureStore/e885e8.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_e885e8() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_e885e8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_e885e8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_e885e8(); -} diff --git a/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.glsl deleted file mode 100644 index a631fcabf9..0000000000 --- a/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba16f) uniform highp writeonly image1D arg_0; -void textureStore_e885e8() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_e885e8(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba16f) uniform highp writeonly image1D arg_0; -void textureStore_e885e8() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_e885e8(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba16f) uniform highp writeonly image1D arg_0; -void textureStore_e885e8() { - imageStore(arg_0, 1, vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_e885e8(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.hlsl deleted file mode 100644 index 0cc502d3cf..0000000000 --- a/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_e885e8() { - arg_0[1] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_e885e8(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_e885e8(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_e885e8(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.msl deleted file mode 100644 index b69dd1b20f..0000000000 --- a/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_e885e8(texture1d tint_symbol_1) { - tint_symbol_1.write(float4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_e885e8(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_e885e8(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_e885e8(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.wgsl deleted file mode 100644 index eac4ea6fbe..0000000000 --- a/test/tint/builtins/gen/textureStore/e885e8.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_e885e8() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_e885e8(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_e885e8(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_e885e8(); -} diff --git a/test/tint/builtins/gen/textureStore/eb702f.wgsl b/test/tint/builtins/gen/textureStore/eb702f.wgsl deleted file mode 100644 index a188948c2c..0000000000 --- a/test/tint/builtins/gen/textureStore/eb702f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_eb702f() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_eb702f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_eb702f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_eb702f(); -} diff --git a/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.glsl deleted file mode 100644 index 0e583a7f56..0000000000 --- a/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32f) uniform highp writeonly image3D arg_0; -void textureStore_eb702f() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_eb702f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32f) uniform highp writeonly image3D arg_0; -void textureStore_eb702f() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_eb702f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32f) uniform highp writeonly image3D arg_0; -void textureStore_eb702f() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_eb702f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.hlsl deleted file mode 100644 index 8d2e233f3c..0000000000 --- a/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_eb702f() { - arg_0[int3(0, 0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_eb702f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_eb702f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_eb702f(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.msl deleted file mode 100644 index 3265301a11..0000000000 --- a/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_eb702f(texture3d tint_symbol_1) { - tint_symbol_1.write(float4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_eb702f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_eb702f(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_eb702f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.wgsl deleted file mode 100644 index c2b8653104..0000000000 --- a/test/tint/builtins/gen/textureStore/eb702f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_eb702f() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_eb702f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_eb702f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_eb702f(); -} diff --git a/test/tint/builtins/gen/textureStore/eb78b9.wgsl b/test/tint/builtins/gen/textureStore/eb78b9.wgsl deleted file mode 100644 index 5c1857bcd3..0000000000 --- a/test/tint/builtins/gen/textureStore/eb78b9.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_eb78b9() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_eb78b9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_eb78b9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_eb78b9(); -} diff --git a/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.glsl deleted file mode 100644 index 2ff97d6528..0000000000 --- a/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32i) uniform highp writeonly iimage3D arg_0; -void textureStore_eb78b9() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_eb78b9(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32i) uniform highp writeonly iimage3D arg_0; -void textureStore_eb78b9() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_eb78b9(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32i) uniform highp writeonly iimage3D arg_0; -void textureStore_eb78b9() { - imageStore(arg_0, ivec3(0, 0, 0), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_eb78b9(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.hlsl deleted file mode 100644 index 1268ff76fc..0000000000 --- a/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_eb78b9() { - arg_0[int3(0, 0, 0)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_eb78b9(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_eb78b9(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_eb78b9(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.msl deleted file mode 100644 index f5956b7486..0000000000 --- a/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_eb78b9(texture3d tint_symbol_1) { - tint_symbol_1.write(int4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_eb78b9(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_eb78b9(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_eb78b9(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.wgsl deleted file mode 100644 index 09472aed9a..0000000000 --- a/test/tint/builtins/gen/textureStore/eb78b9.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_eb78b9() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_eb78b9(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_eb78b9(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_eb78b9(); -} diff --git a/test/tint/builtins/gen/textureStore/ee6acc.wgsl b/test/tint/builtins/gen/textureStore/ee6acc.wgsl deleted file mode 100644 index 43201cc48d..0000000000 --- a/test/tint/builtins/gen/textureStore/ee6acc.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_ee6acc() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_ee6acc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_ee6acc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_ee6acc(); -} diff --git a/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.glsl deleted file mode 100644 index 793103114b..0000000000 --- a/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32f) uniform highp writeonly image3D arg_0; -void textureStore_ee6acc() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - textureStore_ee6acc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32f) uniform highp writeonly image3D arg_0; -void textureStore_ee6acc() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - textureStore_ee6acc(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32f) uniform highp writeonly image3D arg_0; -void textureStore_ee6acc() { - imageStore(arg_0, ivec3(0, 0, 0), vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - textureStore_ee6acc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.hlsl deleted file mode 100644 index 3b0c419c30..0000000000 --- a/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_ee6acc() { - arg_0[int3(0, 0, 0)] = float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_ee6acc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_ee6acc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_ee6acc(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.msl deleted file mode 100644 index e2577eabbe..0000000000 --- a/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_ee6acc(texture3d tint_symbol_1) { - tint_symbol_1.write(float4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_ee6acc(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_ee6acc(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_ee6acc(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.wgsl deleted file mode 100644 index 8b5b0ab80e..0000000000 --- a/test/tint/builtins/gen/textureStore/ee6acc.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_ee6acc() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_ee6acc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_ee6acc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_ee6acc(); -} diff --git a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl b/test/tint/builtins/gen/textureStore/ef9f2f.wgsl deleted file mode 100644 index 6296d30271..0000000000 --- a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_ef9f2f() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_ef9f2f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_ef9f2f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_ef9f2f(); -} diff --git a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.glsl deleted file mode 100644 index 6f3b0a68f9..0000000000 --- a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(r32ui) uniform highp writeonly uimage3D arg_0; -void textureStore_ef9f2f() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_ef9f2f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(r32ui) uniform highp writeonly uimage3D arg_0; -void textureStore_ef9f2f() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_ef9f2f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(r32ui) uniform highp writeonly uimage3D arg_0; -void textureStore_ef9f2f() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_ef9f2f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.hlsl deleted file mode 100644 index 65da5f360c..0000000000 --- a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_ef9f2f() { - arg_0[int3(0, 0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_ef9f2f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_ef9f2f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_ef9f2f(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.msl deleted file mode 100644 index 28b42e68ea..0000000000 --- a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_ef9f2f(texture3d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_ef9f2f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_ef9f2f(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_ef9f2f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.wgsl deleted file mode 100644 index 72cb6d0b96..0000000000 --- a/test/tint/builtins/gen/textureStore/ef9f2f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_ef9f2f() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_ef9f2f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_ef9f2f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_ef9f2f(); -} diff --git a/test/tint/builtins/gen/textureStore/f8dead.wgsl b/test/tint/builtins/gen/textureStore/f8dead.wgsl deleted file mode 100644 index 8954b30af6..0000000000 --- a/test/tint/builtins/gen/textureStore/f8dead.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_3d; - -// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) -fn textureStore_f8dead() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_f8dead(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_f8dead(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_f8dead(); -} diff --git a/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.glsl deleted file mode 100644 index a0fa754cc9..0000000000 --- a/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage3D arg_0; -void textureStore_f8dead() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_f8dead(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8ui) uniform highp writeonly uimage3D arg_0; -void textureStore_f8dead() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_f8dead(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8ui) uniform highp writeonly uimage3D arg_0; -void textureStore_f8dead() { - imageStore(arg_0, ivec3(0, 0, 0), uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_f8dead(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.hlsl deleted file mode 100644 index dd2268a5de..0000000000 --- a/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture3D arg_0 : register(u0, space1); - -void textureStore_f8dead() { - arg_0[int3(0, 0, 0)] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_f8dead(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_f8dead(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_f8dead(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.msl deleted file mode 100644 index 35885fa586..0000000000 --- a/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_f8dead(texture3d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint3(int3())); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture3d tint_symbol_2) { - textureStore_f8dead(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { - textureStore_f8dead(tint_symbol_4); - return; -} - -kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { - textureStore_f8dead(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.wgsl deleted file mode 100644 index eabfbca22d..0000000000 --- a/test/tint/builtins/gen/textureStore/f8dead.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_3d; - -fn textureStore_f8dead() { - textureStore(arg_0, vec3(), vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_f8dead(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_f8dead(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_f8dead(); -} diff --git a/test/tint/builtins/gen/textureStore/f9be83.wgsl b/test/tint/builtins/gen/textureStore/f9be83.wgsl deleted file mode 100644 index 09830dcaa5..0000000000 --- a/test/tint/builtins/gen/textureStore/f9be83.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_f9be83() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_f9be83(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_f9be83(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_f9be83(); -} diff --git a/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.glsl deleted file mode 100644 index 975a5dbbf2..0000000000 --- a/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.glsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_f9be83() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_f9be83(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rg32i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_f9be83() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_f9be83(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'image load-store format' : not supported with this profile: es -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rg32i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_f9be83() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_f9be83(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'image load-store format' : not supported with this profile: es -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.hlsl deleted file mode 100644 index 6194d27473..0000000000 --- a/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_f9be83() { - arg_0[int3(0, 0, 1)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_f9be83(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_f9be83(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_f9be83(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.msl deleted file mode 100644 index 04178a6047..0000000000 --- a/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_f9be83(texture2d_array tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_f9be83(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_f9be83(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_f9be83(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.wgsl deleted file mode 100644 index c6bb3c4846..0000000000 --- a/test/tint/builtins/gen/textureStore/f9be83.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_f9be83() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_f9be83(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_f9be83(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_f9be83(); -} diff --git a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl b/test/tint/builtins/gen/textureStore/fb9a8f.wgsl deleted file mode 100644 index 78ac51e16c..0000000000 --- a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_1d; - -// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) -fn textureStore_fb9a8f() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_fb9a8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_fb9a8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_fb9a8f(); -} diff --git a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.glsl deleted file mode 100644 index b50c0e44bc..0000000000 --- a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.glsl +++ /dev/null @@ -1,78 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage1D arg_0; -void textureStore_fb9a8f() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -vec4 vertex_main() { - textureStore_fb9a8f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es -precision mediump float; - -layout(rgba32ui) uniform highp writeonly uimage1D arg_0; -void textureStore_fb9a8f() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void fragment_main() { - textureStore_fb9a8f(); -} - -void main() { - fragment_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: 'uimage1D' : Reserved word. -WARNING: 0:4: 'layout' : useless application of layout qualifier -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - -#version 310 es - -layout(rgba32ui) uniform highp writeonly uimage1D arg_0; -void textureStore_fb9a8f() { - imageStore(arg_0, 1, uvec4(0u, 0u, 0u, 0u)); -} - -void compute_main() { - textureStore_fb9a8f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: 'uimage1D' : Reserved word. -WARNING: 0:3: 'layout' : useless application of layout qualifier -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.hlsl deleted file mode 100644 index 8c233c3022..0000000000 --- a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture1D arg_0 : register(u0, space1); - -void textureStore_fb9a8f() { - arg_0[1] = uint4(0u, 0u, 0u, 0u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_fb9a8f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_fb9a8f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_fb9a8f(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.msl deleted file mode 100644 index 0522eb949b..0000000000 --- a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_fb9a8f(texture1d tint_symbol_1) { - tint_symbol_1.write(uint4(), uint(1)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture1d tint_symbol_2) { - textureStore_fb9a8f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { - textureStore_fb9a8f(tint_symbol_4); - return; -} - -kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { - textureStore_fb9a8f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.wgsl deleted file mode 100644 index 27aa300648..0000000000 --- a/test/tint/builtins/gen/textureStore/fb9a8f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_1d; - -fn textureStore_fb9a8f() { - textureStore(arg_0, 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_fb9a8f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_fb9a8f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_fb9a8f(); -} diff --git a/test/tint/builtins/gen/textureStore/fbf53f.wgsl b/test/tint/builtins/gen/textureStore/fbf53f.wgsl deleted file mode 100644 index d0d41a13ec..0000000000 --- a/test/tint/builtins/gen/textureStore/fbf53f.wgsl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - -@group(1) @binding(0) var arg_0: texture_storage_2d_array; - -// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) -fn textureStore_fbf53f() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_fbf53f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_fbf53f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_fbf53f(); -} diff --git a/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.glsl b/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.glsl deleted file mode 100644 index a24713fb6e..0000000000 --- a/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_fbf53f() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -vec4 vertex_main() { - textureStore_fbf53f(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_fbf53f() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void fragment_main() { - textureStore_fbf53f(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; -void textureStore_fbf53f() { - imageStore(arg_0, ivec3(0, 0, 1), ivec4(0, 0, 0, 0)); -} - -void compute_main() { - textureStore_fbf53f(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.hlsl b/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.hlsl deleted file mode 100644 index 6cf5b0183c..0000000000 --- a/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -RWTexture2DArray arg_0 : register(u0, space1); - -void textureStore_fbf53f() { - arg_0[int3(0, 0, 1)] = int4(0, 0, 0, 0); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - textureStore_fbf53f(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - textureStore_fbf53f(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - textureStore_fbf53f(); - return; -} diff --git a/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.msl b/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.msl deleted file mode 100644 index 3b9a0e69d8..0000000000 --- a/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void textureStore_fbf53f(texture2d_array tint_symbol_1) { - tint_symbol_1.write(int4(), uint2(int2()), 1); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner(texture2d_array tint_symbol_2) { - textureStore_fbf53f(tint_symbol_2); - return float4(); -} - -vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { - float4 const inner_result = vertex_main_inner(tint_symbol_3); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { - textureStore_fbf53f(tint_symbol_4); - return; -} - -kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { - textureStore_fbf53f(tint_symbol_5); - return; -} - diff --git a/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.wgsl b/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.wgsl deleted file mode 100644 index 8ee531692e..0000000000 --- a/test/tint/builtins/gen/textureStore/fbf53f.wgsl.expected.wgsl +++ /dev/null @@ -1,21 +0,0 @@ -@group(1) @binding(0) var arg_0 : texture_storage_2d_array; - -fn textureStore_fbf53f() { - textureStore(arg_0, vec2(), 1, vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - textureStore_fbf53f(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - textureStore_fbf53f(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - textureStore_fbf53f(); -} diff --git a/test/tint/builtins/gen/transpose/2585cd.wgsl b/test/tint/builtins/gen/transpose/2585cd.wgsl deleted file mode 100644 index f111002e8b..0000000000 --- a/test/tint/builtins/gen/transpose/2585cd.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn transpose(mat<4, 3, f32>) -> mat<3, 4, f32> -fn transpose_2585cd() { - var res: mat3x4 = transpose(mat4x3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_2585cd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_2585cd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_2585cd(); -} diff --git a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.glsl b/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.glsl deleted file mode 100644 index e4f38e1f9d..0000000000 --- a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void transpose_2585cd() { - mat3x4 res = transpose(mat4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - transpose_2585cd(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void transpose_2585cd() { - mat3x4 res = transpose(mat4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - transpose_2585cd(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void transpose_2585cd() { - mat3x4 res = transpose(mat4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - transpose_2585cd(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.hlsl b/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.hlsl deleted file mode 100644 index 0dcb894c5e..0000000000 --- a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void transpose_2585cd() { - float3x4 res = transpose(float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - transpose_2585cd(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - transpose_2585cd(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - transpose_2585cd(); - return; -} diff --git a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.msl b/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.msl deleted file mode 100644 index bd0aea83d5..0000000000 --- a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void transpose_2585cd() { - float3x4 res = transpose(float4x3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - transpose_2585cd(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - transpose_2585cd(); - return; -} - -kernel void compute_main() { - transpose_2585cd(); - return; -} - diff --git a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.spvasm b/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.spvasm deleted file mode 100644 index b91c1a9ba6..0000000000 --- a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %transpose_2585cd "transpose_2585cd" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%mat3v4float = OpTypeMatrix %v4float 3 - %v3float = OpTypeVector %float 3 -%mat4v3float = OpTypeMatrix %v3float 4 - %17 = OpConstantNull %mat4v3float -%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float - %20 = OpConstantNull %mat3v4float - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%transpose_2585cd = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_mat3v4float Function %20 - %13 = OpTranspose %mat3v4float %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %transpose_2585cd - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %transpose_2585cd - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %transpose_2585cd - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.wgsl b/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.wgsl deleted file mode 100644 index e2bcbee591..0000000000 --- a/test/tint/builtins/gen/transpose/2585cd.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn transpose_2585cd() { - var res : mat3x4 = transpose(mat4x3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_2585cd(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_2585cd(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_2585cd(); -} diff --git a/test/tint/builtins/gen/transpose/31d679.wgsl b/test/tint/builtins/gen/transpose/31d679.wgsl deleted file mode 100644 index 18c1a51a2e..0000000000 --- a/test/tint/builtins/gen/transpose/31d679.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn transpose(mat<2, 2, f32>) -> mat<2, 2, f32> -fn transpose_31d679() { - var res: mat2x2 = transpose(mat2x2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_31d679(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_31d679(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_31d679(); -} diff --git a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.glsl b/test/tint/builtins/gen/transpose/31d679.wgsl.expected.glsl deleted file mode 100644 index 627a84e2c4..0000000000 --- a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void transpose_31d679() { - mat2 res = transpose(mat2(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - transpose_31d679(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void transpose_31d679() { - mat2 res = transpose(mat2(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - transpose_31d679(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void transpose_31d679() { - mat2 res = transpose(mat2(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - transpose_31d679(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.hlsl b/test/tint/builtins/gen/transpose/31d679.wgsl.expected.hlsl deleted file mode 100644 index f81bc9b663..0000000000 --- a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void transpose_31d679() { - float2x2 res = transpose(float2x2(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - transpose_31d679(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - transpose_31d679(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - transpose_31d679(); - return; -} diff --git a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.msl b/test/tint/builtins/gen/transpose/31d679.wgsl.expected.msl deleted file mode 100644 index 37161be200..0000000000 --- a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void transpose_31d679() { - float2x2 res = transpose(float2x2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - transpose_31d679(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - transpose_31d679(); - return; -} - -kernel void compute_main() { - transpose_31d679(); - return; -} - diff --git a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.spvasm b/test/tint/builtins/gen/transpose/31d679.wgsl.expected.spvasm deleted file mode 100644 index c6e3c94eac..0000000000 --- a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %transpose_31d679 "transpose_31d679" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 -%mat2v2float = OpTypeMatrix %v2float 2 - %16 = OpConstantNull %mat2v2float -%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%transpose_31d679 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_mat2v2float Function %16 - %13 = OpTranspose %mat2v2float %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %transpose_31d679 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %transpose_31d679 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %transpose_31d679 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.wgsl b/test/tint/builtins/gen/transpose/31d679.wgsl.expected.wgsl deleted file mode 100644 index f588cbaf60..0000000000 --- a/test/tint/builtins/gen/transpose/31d679.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn transpose_31d679() { - var res : mat2x2 = transpose(mat2x2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_31d679(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_31d679(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_31d679(); -} diff --git a/test/tint/builtins/gen/transpose/31e37e.wgsl b/test/tint/builtins/gen/transpose/31e37e.wgsl deleted file mode 100644 index 1b411a7ac2..0000000000 --- a/test/tint/builtins/gen/transpose/31e37e.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn transpose(mat<4, 2, f32>) -> mat<2, 4, f32> -fn transpose_31e37e() { - var res: mat2x4 = transpose(mat4x2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_31e37e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_31e37e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_31e37e(); -} diff --git a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.glsl b/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.glsl deleted file mode 100644 index add3f23289..0000000000 --- a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void transpose_31e37e() { - mat2x4 res = transpose(mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - transpose_31e37e(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void transpose_31e37e() { - mat2x4 res = transpose(mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - transpose_31e37e(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void transpose_31e37e() { - mat2x4 res = transpose(mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - transpose_31e37e(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.hlsl b/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.hlsl deleted file mode 100644 index 7a98209a1b..0000000000 --- a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void transpose_31e37e() { - float2x4 res = transpose(float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - transpose_31e37e(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - transpose_31e37e(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - transpose_31e37e(); - return; -} diff --git a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.msl b/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.msl deleted file mode 100644 index 393d1c2dd3..0000000000 --- a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void transpose_31e37e() { - float2x4 res = transpose(float4x2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - transpose_31e37e(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - transpose_31e37e(); - return; -} - -kernel void compute_main() { - transpose_31e37e(); - return; -} - diff --git a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.spvasm b/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.spvasm deleted file mode 100644 index 3b97b35392..0000000000 --- a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %transpose_31e37e "transpose_31e37e" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%mat2v4float = OpTypeMatrix %v4float 2 - %v2float = OpTypeVector %float 2 -%mat4v2float = OpTypeMatrix %v2float 4 - %17 = OpConstantNull %mat4v2float -%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float - %20 = OpConstantNull %mat2v4float - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%transpose_31e37e = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_mat2v4float Function %20 - %13 = OpTranspose %mat2v4float %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %transpose_31e37e - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %transpose_31e37e - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %transpose_31e37e - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.wgsl b/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.wgsl deleted file mode 100644 index 3462f91963..0000000000 --- a/test/tint/builtins/gen/transpose/31e37e.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn transpose_31e37e() { - var res : mat2x4 = transpose(mat4x2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_31e37e(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_31e37e(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_31e37e(); -} diff --git a/test/tint/builtins/gen/transpose/4ce359.wgsl b/test/tint/builtins/gen/transpose/4ce359.wgsl deleted file mode 100644 index 947cd87935..0000000000 --- a/test/tint/builtins/gen/transpose/4ce359.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn transpose(mat<2, 4, f32>) -> mat<4, 2, f32> -fn transpose_4ce359() { - var res: mat4x2 = transpose(mat2x4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_4ce359(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_4ce359(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_4ce359(); -} diff --git a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.glsl b/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.glsl deleted file mode 100644 index 8939e1c07b..0000000000 --- a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void transpose_4ce359() { - mat4x2 res = transpose(mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - transpose_4ce359(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void transpose_4ce359() { - mat4x2 res = transpose(mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - transpose_4ce359(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void transpose_4ce359() { - mat4x2 res = transpose(mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - transpose_4ce359(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.hlsl b/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.hlsl deleted file mode 100644 index ce5e8de2ea..0000000000 --- a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void transpose_4ce359() { - float4x2 res = transpose(float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - transpose_4ce359(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - transpose_4ce359(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - transpose_4ce359(); - return; -} diff --git a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.msl b/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.msl deleted file mode 100644 index 6f191fcac0..0000000000 --- a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void transpose_4ce359() { - float4x2 res = transpose(float2x4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - transpose_4ce359(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - transpose_4ce359(); - return; -} - -kernel void compute_main() { - transpose_4ce359(); - return; -} - diff --git a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.spvasm b/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.spvasm deleted file mode 100644 index 432493923b..0000000000 --- a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %transpose_4ce359 "transpose_4ce359" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 -%mat4v2float = OpTypeMatrix %v2float 4 -%mat2v4float = OpTypeMatrix %v4float 2 - %17 = OpConstantNull %mat2v4float -%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float - %20 = OpConstantNull %mat4v2float - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%transpose_4ce359 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_mat4v2float Function %20 - %13 = OpTranspose %mat4v2float %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %transpose_4ce359 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %transpose_4ce359 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %transpose_4ce359 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.wgsl b/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.wgsl deleted file mode 100644 index a4123d5fa9..0000000000 --- a/test/tint/builtins/gen/transpose/4ce359.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn transpose_4ce359() { - var res : mat4x2 = transpose(mat2x4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_4ce359(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_4ce359(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_4ce359(); -} diff --git a/test/tint/builtins/gen/transpose/4dc9a1.wgsl b/test/tint/builtins/gen/transpose/4dc9a1.wgsl deleted file mode 100644 index f4d5dc3330..0000000000 --- a/test/tint/builtins/gen/transpose/4dc9a1.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn transpose(mat<2, 3, f32>) -> mat<3, 2, f32> -fn transpose_4dc9a1() { - var res: mat3x2 = transpose(mat2x3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_4dc9a1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_4dc9a1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_4dc9a1(); -} diff --git a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.glsl b/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.glsl deleted file mode 100644 index e9f161d43e..0000000000 --- a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void transpose_4dc9a1() { - mat3x2 res = transpose(mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - transpose_4dc9a1(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void transpose_4dc9a1() { - mat3x2 res = transpose(mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - transpose_4dc9a1(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void transpose_4dc9a1() { - mat3x2 res = transpose(mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - transpose_4dc9a1(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.hlsl b/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.hlsl deleted file mode 100644 index 2471cff5b4..0000000000 --- a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void transpose_4dc9a1() { - float3x2 res = transpose(float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - transpose_4dc9a1(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - transpose_4dc9a1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - transpose_4dc9a1(); - return; -} diff --git a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.msl b/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.msl deleted file mode 100644 index 758e4046b4..0000000000 --- a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void transpose_4dc9a1() { - float3x2 res = transpose(float2x3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - transpose_4dc9a1(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - transpose_4dc9a1(); - return; -} - -kernel void compute_main() { - transpose_4dc9a1(); - return; -} - diff --git a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.spvasm b/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.spvasm deleted file mode 100644 index a67bcffde7..0000000000 --- a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %transpose_4dc9a1 "transpose_4dc9a1" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 -%mat3v2float = OpTypeMatrix %v2float 3 - %v3float = OpTypeVector %float 3 -%mat2v3float = OpTypeMatrix %v3float 2 - %18 = OpConstantNull %mat2v3float -%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float - %21 = OpConstantNull %mat3v2float - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%transpose_4dc9a1 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_mat3v2float Function %21 - %13 = OpTranspose %mat3v2float %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %transpose_4dc9a1 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %transpose_4dc9a1 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %transpose_4dc9a1 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.wgsl b/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.wgsl deleted file mode 100644 index 9a579e0022..0000000000 --- a/test/tint/builtins/gen/transpose/4dc9a1.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn transpose_4dc9a1() { - var res : mat3x2 = transpose(mat2x3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_4dc9a1(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_4dc9a1(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_4dc9a1(); -} diff --git a/test/tint/builtins/gen/transpose/854336.wgsl b/test/tint/builtins/gen/transpose/854336.wgsl deleted file mode 100644 index ffb40b7bf5..0000000000 --- a/test/tint/builtins/gen/transpose/854336.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn transpose(mat<3, 3, f32>) -> mat<3, 3, f32> -fn transpose_854336() { - var res: mat3x3 = transpose(mat3x3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_854336(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_854336(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_854336(); -} diff --git a/test/tint/builtins/gen/transpose/854336.wgsl.expected.glsl b/test/tint/builtins/gen/transpose/854336.wgsl.expected.glsl deleted file mode 100644 index 2e75149399..0000000000 --- a/test/tint/builtins/gen/transpose/854336.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void transpose_854336() { - mat3 res = transpose(mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - transpose_854336(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void transpose_854336() { - mat3 res = transpose(mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - transpose_854336(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void transpose_854336() { - mat3 res = transpose(mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - transpose_854336(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/transpose/854336.wgsl.expected.hlsl b/test/tint/builtins/gen/transpose/854336.wgsl.expected.hlsl deleted file mode 100644 index e90dab8d76..0000000000 --- a/test/tint/builtins/gen/transpose/854336.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void transpose_854336() { - float3x3 res = transpose(float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - transpose_854336(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - transpose_854336(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - transpose_854336(); - return; -} diff --git a/test/tint/builtins/gen/transpose/854336.wgsl.expected.msl b/test/tint/builtins/gen/transpose/854336.wgsl.expected.msl deleted file mode 100644 index f541c74fc9..0000000000 --- a/test/tint/builtins/gen/transpose/854336.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void transpose_854336() { - float3x3 res = transpose(float3x3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - transpose_854336(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - transpose_854336(); - return; -} - -kernel void compute_main() { - transpose_854336(); - return; -} - diff --git a/test/tint/builtins/gen/transpose/854336.wgsl.expected.spvasm b/test/tint/builtins/gen/transpose/854336.wgsl.expected.spvasm deleted file mode 100644 index 21308c0ecb..0000000000 --- a/test/tint/builtins/gen/transpose/854336.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %transpose_854336 "transpose_854336" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 -%mat3v3float = OpTypeMatrix %v3float 3 - %16 = OpConstantNull %mat3v3float -%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%transpose_854336 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_mat3v3float Function %16 - %13 = OpTranspose %mat3v3float %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %transpose_854336 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %transpose_854336 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %transpose_854336 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/transpose/854336.wgsl.expected.wgsl b/test/tint/builtins/gen/transpose/854336.wgsl.expected.wgsl deleted file mode 100644 index 9eac4c0547..0000000000 --- a/test/tint/builtins/gen/transpose/854336.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn transpose_854336() { - var res : mat3x3 = transpose(mat3x3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_854336(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_854336(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_854336(); -} diff --git a/test/tint/builtins/gen/transpose/c1b600.wgsl b/test/tint/builtins/gen/transpose/c1b600.wgsl deleted file mode 100644 index 7e4683f1a7..0000000000 --- a/test/tint/builtins/gen/transpose/c1b600.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn transpose(mat<4, 4, f32>) -> mat<4, 4, f32> -fn transpose_c1b600() { - var res: mat4x4 = transpose(mat4x4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_c1b600(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_c1b600(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_c1b600(); -} diff --git a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.glsl b/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.glsl deleted file mode 100644 index 82eb50d840..0000000000 --- a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void transpose_c1b600() { - mat4 res = transpose(mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - transpose_c1b600(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void transpose_c1b600() { - mat4 res = transpose(mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - transpose_c1b600(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void transpose_c1b600() { - mat4 res = transpose(mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - transpose_c1b600(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.hlsl b/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.hlsl deleted file mode 100644 index bc2bd204a6..0000000000 --- a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void transpose_c1b600() { - float4x4 res = transpose(float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - transpose_c1b600(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - transpose_c1b600(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - transpose_c1b600(); - return; -} diff --git a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.msl b/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.msl deleted file mode 100644 index b1c7ea42d1..0000000000 --- a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void transpose_c1b600() { - float4x4 res = transpose(float4x4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - transpose_c1b600(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - transpose_c1b600(); - return; -} - -kernel void compute_main() { - transpose_c1b600(); - return; -} - diff --git a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.spvasm b/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.spvasm deleted file mode 100644 index cb8a50408f..0000000000 --- a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.spvasm +++ /dev/null @@ -1,66 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 32 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %transpose_c1b600 "transpose_c1b600" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%mat4v4float = OpTypeMatrix %v4float 4 - %15 = OpConstantNull %mat4v4float -%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float - %18 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%transpose_c1b600 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_mat4v4float Function %15 - %13 = OpTranspose %mat4v4float %15 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %transpose_c1b600 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %transpose_c1b600 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %transpose_c1b600 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.wgsl b/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.wgsl deleted file mode 100644 index f391f5c3ab..0000000000 --- a/test/tint/builtins/gen/transpose/c1b600.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn transpose_c1b600() { - var res : mat4x4 = transpose(mat4x4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_c1b600(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_c1b600(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_c1b600(); -} diff --git a/test/tint/builtins/gen/transpose/d8f8ba.wgsl b/test/tint/builtins/gen/transpose/d8f8ba.wgsl deleted file mode 100644 index f8ec16ca06..0000000000 --- a/test/tint/builtins/gen/transpose/d8f8ba.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn transpose(mat<3, 4, f32>) -> mat<4, 3, f32> -fn transpose_d8f8ba() { - var res: mat4x3 = transpose(mat3x4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_d8f8ba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_d8f8ba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_d8f8ba(); -} diff --git a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.glsl b/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.glsl deleted file mode 100644 index ac3ecdf2a2..0000000000 --- a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void transpose_d8f8ba() { - mat4x3 res = transpose(mat3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - transpose_d8f8ba(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void transpose_d8f8ba() { - mat4x3 res = transpose(mat3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - transpose_d8f8ba(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void transpose_d8f8ba() { - mat4x3 res = transpose(mat3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - transpose_d8f8ba(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.hlsl b/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.hlsl deleted file mode 100644 index 860eed7630..0000000000 --- a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void transpose_d8f8ba() { - float4x3 res = transpose(float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - transpose_d8f8ba(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - transpose_d8f8ba(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - transpose_d8f8ba(); - return; -} diff --git a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.msl b/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.msl deleted file mode 100644 index c0fe7fe9f9..0000000000 --- a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void transpose_d8f8ba() { - float4x3 res = transpose(float3x4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - transpose_d8f8ba(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - transpose_d8f8ba(); - return; -} - -kernel void compute_main() { - transpose_d8f8ba(); - return; -} - diff --git a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.spvasm b/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.spvasm deleted file mode 100644 index e28c4ff9f0..0000000000 --- a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.spvasm +++ /dev/null @@ -1,69 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 35 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %transpose_d8f8ba "transpose_d8f8ba" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 -%mat4v3float = OpTypeMatrix %v3float 4 -%mat3v4float = OpTypeMatrix %v4float 3 - %17 = OpConstantNull %mat3v4float -%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float - %20 = OpConstantNull %mat4v3float - %21 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%transpose_d8f8ba = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_mat4v3float Function %20 - %13 = OpTranspose %mat4v3float %17 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %transpose_d8f8ba - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %transpose_d8f8ba - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %transpose_d8f8ba - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.wgsl b/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.wgsl deleted file mode 100644 index e5af1d47a7..0000000000 --- a/test/tint/builtins/gen/transpose/d8f8ba.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn transpose_d8f8ba() { - var res : mat4x3 = transpose(mat3x4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_d8f8ba(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_d8f8ba(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_d8f8ba(); -} diff --git a/test/tint/builtins/gen/transpose/ed4bdc.wgsl b/test/tint/builtins/gen/transpose/ed4bdc.wgsl deleted file mode 100644 index 9b5fb4bd10..0000000000 --- a/test/tint/builtins/gen/transpose/ed4bdc.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn transpose(mat<3, 2, f32>) -> mat<2, 3, f32> -fn transpose_ed4bdc() { - var res: mat2x3 = transpose(mat3x2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_ed4bdc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_ed4bdc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_ed4bdc(); -} diff --git a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.glsl b/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.glsl deleted file mode 100644 index d1474d5230..0000000000 --- a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void transpose_ed4bdc() { - mat2x3 res = transpose(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - transpose_ed4bdc(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void transpose_ed4bdc() { - mat2x3 res = transpose(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - transpose_ed4bdc(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void transpose_ed4bdc() { - mat2x3 res = transpose(mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - transpose_ed4bdc(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.hlsl b/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.hlsl deleted file mode 100644 index fc957c6b36..0000000000 --- a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void transpose_ed4bdc() { - float2x3 res = transpose(float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - transpose_ed4bdc(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - transpose_ed4bdc(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - transpose_ed4bdc(); - return; -} diff --git a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.msl b/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.msl deleted file mode 100644 index 3b4dfac436..0000000000 --- a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void transpose_ed4bdc() { - float2x3 res = transpose(float3x2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - transpose_ed4bdc(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - transpose_ed4bdc(); - return; -} - -kernel void compute_main() { - transpose_ed4bdc(); - return; -} - diff --git a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.spvasm b/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.spvasm deleted file mode 100644 index d413d04ea0..0000000000 --- a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.spvasm +++ /dev/null @@ -1,70 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 36 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %transpose_ed4bdc "transpose_ed4bdc" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 -%mat2v3float = OpTypeMatrix %v3float 2 - %v2float = OpTypeVector %float 2 -%mat3v2float = OpTypeMatrix %v2float 3 - %18 = OpConstantNull %mat3v2float -%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float - %21 = OpConstantNull %mat2v3float - %22 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%transpose_ed4bdc = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_mat2v3float Function %21 - %13 = OpTranspose %mat2v3float %18 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %transpose_ed4bdc - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %transpose_ed4bdc - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %transpose_ed4bdc - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.wgsl b/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.wgsl deleted file mode 100644 index 462a2cf536..0000000000 --- a/test/tint/builtins/gen/transpose/ed4bdc.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn transpose_ed4bdc() { - var res : mat2x3 = transpose(mat3x2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - transpose_ed4bdc(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - transpose_ed4bdc(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - transpose_ed4bdc(); -} diff --git a/test/tint/builtins/gen/trunc/562d05.wgsl b/test/tint/builtins/gen/trunc/562d05.wgsl deleted file mode 100644 index 4aab73d02e..0000000000 --- a/test/tint/builtins/gen/trunc/562d05.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn trunc(vec<3, f32>) -> vec<3, f32> -fn trunc_562d05() { - var res: vec3 = trunc(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - trunc_562d05(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - trunc_562d05(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - trunc_562d05(); -} diff --git a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.glsl b/test/tint/builtins/gen/trunc/562d05.wgsl.expected.glsl deleted file mode 100644 index 5bcdcc9459..0000000000 --- a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void trunc_562d05() { - vec3 res = trunc(vec3(0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - trunc_562d05(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void trunc_562d05() { - vec3 res = trunc(vec3(0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - trunc_562d05(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void trunc_562d05() { - vec3 res = trunc(vec3(0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - trunc_562d05(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.hlsl b/test/tint/builtins/gen/trunc/562d05.wgsl.expected.hlsl deleted file mode 100644 index 2d89674637..0000000000 --- a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void trunc_562d05() { - float3 res = trunc(float3(0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - trunc_562d05(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - trunc_562d05(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - trunc_562d05(); - return; -} diff --git a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.msl b/test/tint/builtins/gen/trunc/562d05.wgsl.expected.msl deleted file mode 100644 index 491d58729a..0000000000 --- a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void trunc_562d05() { - float3 res = trunc(float3()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - trunc_562d05(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - trunc_562d05(); - return; -} - -kernel void compute_main() { - trunc_562d05(); - return; -} - diff --git a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.spvasm b/test/tint/builtins/gen/trunc/562d05.wgsl.expected.spvasm deleted file mode 100644 index afd4688cfd..0000000000 --- a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %trunc_562d05 "trunc_562d05" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v3float = OpTypeVector %float 3 - %16 = OpConstantNull %v3float -%_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%trunc_562d05 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %16 - %13 = OpExtInst %v3float %15 Trunc %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %trunc_562d05 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %trunc_562d05 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %trunc_562d05 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.wgsl b/test/tint/builtins/gen/trunc/562d05.wgsl.expected.wgsl deleted file mode 100644 index cef969738f..0000000000 --- a/test/tint/builtins/gen/trunc/562d05.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn trunc_562d05() { - var res : vec3 = trunc(vec3()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - trunc_562d05(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - trunc_562d05(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - trunc_562d05(); -} diff --git a/test/tint/builtins/gen/trunc/e183aa.wgsl b/test/tint/builtins/gen/trunc/e183aa.wgsl deleted file mode 100644 index bd01e6f912..0000000000 --- a/test/tint/builtins/gen/trunc/e183aa.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn trunc(vec<4, f32>) -> vec<4, f32> -fn trunc_e183aa() { - var res: vec4 = trunc(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - trunc_e183aa(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - trunc_e183aa(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - trunc_e183aa(); -} diff --git a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.glsl b/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.glsl deleted file mode 100644 index 75fb549d12..0000000000 --- a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void trunc_e183aa() { - vec4 res = trunc(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -vec4 vertex_main() { - trunc_e183aa(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void trunc_e183aa() { - vec4 res = trunc(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void fragment_main() { - trunc_e183aa(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void trunc_e183aa() { - vec4 res = trunc(vec4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -void compute_main() { - trunc_e183aa(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.hlsl b/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.hlsl deleted file mode 100644 index d65dc52f04..0000000000 --- a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void trunc_e183aa() { - float4 res = trunc(float4(0.0f, 0.0f, 0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - trunc_e183aa(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - trunc_e183aa(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - trunc_e183aa(); - return; -} diff --git a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.msl b/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.msl deleted file mode 100644 index 3e8d78d6f1..0000000000 --- a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void trunc_e183aa() { - float4 res = trunc(float4()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - trunc_e183aa(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - trunc_e183aa(); - return; -} - -kernel void compute_main() { - trunc_e183aa(); - return; -} - diff --git a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.spvasm b/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.spvasm deleted file mode 100644 index c43501487e..0000000000 --- a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.spvasm +++ /dev/null @@ -1,65 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %trunc_e183aa "trunc_e183aa" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void -%_ptr_Function_v4float = OpTypePointer Function %v4float - %17 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%trunc_e183aa = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Trunc %5 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %17 - %19 = OpLabel - %20 = OpFunctionCall %void %trunc_e183aa - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %22 = OpLabel - %23 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %23 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %trunc_e183aa - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %trunc_e183aa - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.wgsl b/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.wgsl deleted file mode 100644 index 94e505f668..0000000000 --- a/test/tint/builtins/gen/trunc/e183aa.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn trunc_e183aa() { - var res : vec4 = trunc(vec4()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - trunc_e183aa(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - trunc_e183aa(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - trunc_e183aa(); -} diff --git a/test/tint/builtins/gen/trunc/eb83df.wgsl b/test/tint/builtins/gen/trunc/eb83df.wgsl deleted file mode 100644 index 406f2a3b51..0000000000 --- a/test/tint/builtins/gen/trunc/eb83df.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn trunc(f32) -> f32 -fn trunc_eb83df() { - var res: f32 = trunc(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - trunc_eb83df(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - trunc_eb83df(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - trunc_eb83df(); -} diff --git a/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.glsl b/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.glsl deleted file mode 100644 index 24a8209275..0000000000 --- a/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void trunc_eb83df() { - float res = trunc(1.0f); -} - -vec4 vertex_main() { - trunc_eb83df(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void trunc_eb83df() { - float res = trunc(1.0f); -} - -void fragment_main() { - trunc_eb83df(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void trunc_eb83df() { - float res = trunc(1.0f); -} - -void compute_main() { - trunc_eb83df(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.hlsl b/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.hlsl deleted file mode 100644 index 2e556ed556..0000000000 --- a/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void trunc_eb83df() { - float res = trunc(1.0f); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - trunc_eb83df(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - trunc_eb83df(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - trunc_eb83df(); - return; -} diff --git a/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.msl b/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.msl deleted file mode 100644 index 950182f686..0000000000 --- a/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void trunc_eb83df() { - float res = trunc(1.0f); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - trunc_eb83df(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - trunc_eb83df(); - return; -} - -kernel void compute_main() { - trunc_eb83df(); - return; -} - diff --git a/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.wgsl b/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.wgsl deleted file mode 100644 index 7392b6cfc7..0000000000 --- a/test/tint/builtins/gen/trunc/eb83df.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn trunc_eb83df() { - var res : f32 = trunc(1.0); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - trunc_eb83df(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - trunc_eb83df(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - trunc_eb83df(); -} diff --git a/test/tint/builtins/gen/trunc/f370d3.wgsl b/test/tint/builtins/gen/trunc/f370d3.wgsl deleted file mode 100644 index cb6e843662..0000000000 --- a/test/tint/builtins/gen/trunc/f370d3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn trunc(vec<2, f32>) -> vec<2, f32> -fn trunc_f370d3() { - var res: vec2 = trunc(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - trunc_f370d3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - trunc_f370d3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - trunc_f370d3(); -} diff --git a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.glsl b/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.glsl deleted file mode 100644 index 93d07fb6fa..0000000000 --- a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void trunc_f370d3() { - vec2 res = trunc(vec2(0.0f, 0.0f)); -} - -vec4 vertex_main() { - trunc_f370d3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void trunc_f370d3() { - vec2 res = trunc(vec2(0.0f, 0.0f)); -} - -void fragment_main() { - trunc_f370d3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void trunc_f370d3() { - vec2 res = trunc(vec2(0.0f, 0.0f)); -} - -void compute_main() { - trunc_f370d3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.hlsl b/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.hlsl deleted file mode 100644 index bd5514f382..0000000000 --- a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void trunc_f370d3() { - float2 res = trunc(float2(0.0f, 0.0f)); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - trunc_f370d3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - trunc_f370d3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - trunc_f370d3(); - return; -} diff --git a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.msl b/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.msl deleted file mode 100644 index aa5a099944..0000000000 --- a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void trunc_f370d3() { - float2 res = trunc(float2()); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - trunc_f370d3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - trunc_f370d3(); - return; -} - -kernel void compute_main() { - trunc_f370d3(); - return; -} - diff --git a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.spvasm b/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.spvasm deleted file mode 100644 index f02cd4c079..0000000000 --- a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 33 -; Schema: 0 - OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size - OpEntryPoint Fragment %fragment_main "fragment_main" - OpEntryPoint GLCompute %compute_main "compute_main" - OpExecutionMode %fragment_main OriginUpperLeft - OpExecutionMode %compute_main LocalSize 1 1 1 - OpName %value "value" - OpName %vertex_point_size "vertex_point_size" - OpName %trunc_f370d3 "trunc_f370d3" - OpName %res "res" - OpName %vertex_main_inner "vertex_main_inner" - OpName %vertex_main "vertex_main" - OpName %fragment_main "fragment_main" - OpName %compute_main "compute_main" - OpDecorate %value BuiltIn Position - OpDecorate %vertex_point_size BuiltIn PointSize - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 -%_ptr_Output_float = OpTypePointer Output %float - %8 = OpConstantNull %float -%vertex_point_size = OpVariable %_ptr_Output_float Output %8 - %void = OpTypeVoid - %9 = OpTypeFunction %void - %v2float = OpTypeVector %float 2 - %16 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpTypeFunction %v4float - %float_1 = OpConstant %float 1 -%trunc_f370d3 = OpFunction %void None %9 - %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %16 - %13 = OpExtInst %v2float %15 Trunc %16 - OpStore %res %13 - OpReturn - OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %trunc_f370d3 - OpReturnValue %5 - OpFunctionEnd -%vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 - OpStore %vertex_point_size %float_1 - OpReturn - OpFunctionEnd -%fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %trunc_f370d3 - OpReturn - OpFunctionEnd -%compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %trunc_f370d3 - OpReturn - OpFunctionEnd diff --git a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.wgsl b/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.wgsl deleted file mode 100644 index 8393d973d2..0000000000 --- a/test/tint/builtins/gen/trunc/f370d3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn trunc_f370d3() { - var res : vec2 = trunc(vec2()); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - trunc_f370d3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - trunc_f370d3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - trunc_f370d3(); -} diff --git a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl b/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl deleted file mode 100644 index c3dbec2291..0000000000 --- a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn unpack2x16float(u32) -> vec2 -fn unpack2x16float_32a5cf() { - var res: vec2 = unpack2x16float(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack2x16float_32a5cf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack2x16float_32a5cf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack2x16float_32a5cf(); -} diff --git a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.glsl b/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.glsl deleted file mode 100644 index b89b95ce8b..0000000000 --- a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void unpack2x16float_32a5cf() { - vec2 res = unpackHalf2x16(1u); -} - -vec4 vertex_main() { - unpack2x16float_32a5cf(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void unpack2x16float_32a5cf() { - vec2 res = unpackHalf2x16(1u); -} - -void fragment_main() { - unpack2x16float_32a5cf(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void unpack2x16float_32a5cf() { - vec2 res = unpackHalf2x16(1u); -} - -void compute_main() { - unpack2x16float_32a5cf(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.hlsl b/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.hlsl deleted file mode 100644 index 3402aff335..0000000000 --- a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.hlsl +++ /dev/null @@ -1,35 +0,0 @@ -float2 tint_unpack2x16float(uint param_0) { - uint i = param_0; - return f16tof32(uint2(i & 0xffff, i >> 16)); -} - -void unpack2x16float_32a5cf() { - float2 res = tint_unpack2x16float(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - unpack2x16float_32a5cf(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - unpack2x16float_32a5cf(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - unpack2x16float_32a5cf(); - return; -} diff --git a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.msl b/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.msl deleted file mode 100644 index ba41cd61d7..0000000000 --- a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void unpack2x16float_32a5cf() { - float2 res = float2(as_type(1u)); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - unpack2x16float_32a5cf(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - unpack2x16float_32a5cf(); - return; -} - -kernel void compute_main() { - unpack2x16float_32a5cf(); - return; -} - diff --git a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.wgsl b/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.wgsl deleted file mode 100644 index fac905879c..0000000000 --- a/test/tint/builtins/gen/unpack2x16float/32a5cf.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn unpack2x16float_32a5cf() { - var res : vec2 = unpack2x16float(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack2x16float_32a5cf(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack2x16float_32a5cf(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack2x16float_32a5cf(); -} diff --git a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl b/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl deleted file mode 100644 index 3a5952e3bf..0000000000 --- a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn unpack2x16snorm(u32) -> vec2 -fn unpack2x16snorm_b4aea6() { - var res: vec2 = unpack2x16snorm(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack2x16snorm_b4aea6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack2x16snorm_b4aea6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack2x16snorm_b4aea6(); -} diff --git a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.glsl b/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.glsl deleted file mode 100644 index 0aa117cead..0000000000 --- a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void unpack2x16snorm_b4aea6() { - vec2 res = unpackSnorm2x16(1u); -} - -vec4 vertex_main() { - unpack2x16snorm_b4aea6(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void unpack2x16snorm_b4aea6() { - vec2 res = unpackSnorm2x16(1u); -} - -void fragment_main() { - unpack2x16snorm_b4aea6(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void unpack2x16snorm_b4aea6() { - vec2 res = unpackSnorm2x16(1u); -} - -void compute_main() { - unpack2x16snorm_b4aea6(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.hlsl b/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.hlsl deleted file mode 100644 index 3ad23703a7..0000000000 --- a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.hlsl +++ /dev/null @@ -1,36 +0,0 @@ -float2 tint_unpack2x16snorm(uint param_0) { - int j = int(param_0); - int2 i = int2(j << 16, j) >> 16; - return clamp(float2(i) / 32767.0, -1.0, 1.0); -} - -void unpack2x16snorm_b4aea6() { - float2 res = tint_unpack2x16snorm(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - unpack2x16snorm_b4aea6(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - unpack2x16snorm_b4aea6(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - unpack2x16snorm_b4aea6(); - return; -} diff --git a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.msl b/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.msl deleted file mode 100644 index 03a4ab63d1..0000000000 --- a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void unpack2x16snorm_b4aea6() { - float2 res = unpack_snorm2x16_to_float(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - unpack2x16snorm_b4aea6(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - unpack2x16snorm_b4aea6(); - return; -} - -kernel void compute_main() { - unpack2x16snorm_b4aea6(); - return; -} - diff --git a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.wgsl b/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.wgsl deleted file mode 100644 index a97f8754b8..0000000000 --- a/test/tint/builtins/gen/unpack2x16snorm/b4aea6.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn unpack2x16snorm_b4aea6() { - var res : vec2 = unpack2x16snorm(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack2x16snorm_b4aea6(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack2x16snorm_b4aea6(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack2x16snorm_b4aea6(); -} diff --git a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl b/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl deleted file mode 100644 index 82e0ce9e36..0000000000 --- a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn unpack2x16unorm(u32) -> vec2 -fn unpack2x16unorm_7699c0() { - var res: vec2 = unpack2x16unorm(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack2x16unorm_7699c0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack2x16unorm_7699c0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack2x16unorm_7699c0(); -} diff --git a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.glsl b/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.glsl deleted file mode 100644 index dcea7f7941..0000000000 --- a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void unpack2x16unorm_7699c0() { - vec2 res = unpackUnorm2x16(1u); -} - -vec4 vertex_main() { - unpack2x16unorm_7699c0(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void unpack2x16unorm_7699c0() { - vec2 res = unpackUnorm2x16(1u); -} - -void fragment_main() { - unpack2x16unorm_7699c0(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void unpack2x16unorm_7699c0() { - vec2 res = unpackUnorm2x16(1u); -} - -void compute_main() { - unpack2x16unorm_7699c0(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.hlsl b/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.hlsl deleted file mode 100644 index a404f41658..0000000000 --- a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.hlsl +++ /dev/null @@ -1,36 +0,0 @@ -float2 tint_unpack2x16unorm(uint param_0) { - uint j = param_0; - uint2 i = uint2(j & 0xffff, j >> 16); - return float2(i) / 65535.0; -} - -void unpack2x16unorm_7699c0() { - float2 res = tint_unpack2x16unorm(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - unpack2x16unorm_7699c0(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - unpack2x16unorm_7699c0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - unpack2x16unorm_7699c0(); - return; -} diff --git a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.msl b/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.msl deleted file mode 100644 index fda9e15242..0000000000 --- a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void unpack2x16unorm_7699c0() { - float2 res = unpack_unorm2x16_to_float(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - unpack2x16unorm_7699c0(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - unpack2x16unorm_7699c0(); - return; -} - -kernel void compute_main() { - unpack2x16unorm_7699c0(); - return; -} - diff --git a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.wgsl b/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.wgsl deleted file mode 100644 index 784f95a804..0000000000 --- a/test/tint/builtins/gen/unpack2x16unorm/7699c0.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn unpack2x16unorm_7699c0() { - var res : vec2 = unpack2x16unorm(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack2x16unorm_7699c0(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack2x16unorm_7699c0(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack2x16unorm_7699c0(); -} diff --git a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl b/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl deleted file mode 100644 index 6cabee7c54..0000000000 --- a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn unpack4x8snorm(u32) -> vec4 -fn unpack4x8snorm_523fb3() { - var res: vec4 = unpack4x8snorm(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack4x8snorm_523fb3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack4x8snorm_523fb3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack4x8snorm_523fb3(); -} diff --git a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.glsl b/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.glsl deleted file mode 100644 index 7f4bafce27..0000000000 --- a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void unpack4x8snorm_523fb3() { - vec4 res = unpackSnorm4x8(1u); -} - -vec4 vertex_main() { - unpack4x8snorm_523fb3(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void unpack4x8snorm_523fb3() { - vec4 res = unpackSnorm4x8(1u); -} - -void fragment_main() { - unpack4x8snorm_523fb3(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void unpack4x8snorm_523fb3() { - vec4 res = unpackSnorm4x8(1u); -} - -void compute_main() { - unpack4x8snorm_523fb3(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.hlsl b/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.hlsl deleted file mode 100644 index c7e5031c16..0000000000 --- a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.hlsl +++ /dev/null @@ -1,36 +0,0 @@ -float4 tint_unpack4x8snorm(uint param_0) { - int j = int(param_0); - int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; - return clamp(float4(i) / 127.0, -1.0, 1.0); -} - -void unpack4x8snorm_523fb3() { - float4 res = tint_unpack4x8snorm(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - unpack4x8snorm_523fb3(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - unpack4x8snorm_523fb3(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - unpack4x8snorm_523fb3(); - return; -} diff --git a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.msl b/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.msl deleted file mode 100644 index 9235de24ba..0000000000 --- a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void unpack4x8snorm_523fb3() { - float4 res = unpack_snorm4x8_to_float(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - unpack4x8snorm_523fb3(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - unpack4x8snorm_523fb3(); - return; -} - -kernel void compute_main() { - unpack4x8snorm_523fb3(); - return; -} - diff --git a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.wgsl b/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.wgsl deleted file mode 100644 index d3baad3594..0000000000 --- a/test/tint/builtins/gen/unpack4x8snorm/523fb3.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn unpack4x8snorm_523fb3() { - var res : vec4 = unpack4x8snorm(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack4x8snorm_523fb3(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack4x8snorm_523fb3(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack4x8snorm_523fb3(); -} diff --git a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl b/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl deleted file mode 100644 index cee8f63143..0000000000 --- a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn unpack4x8unorm(u32) -> vec4 -fn unpack4x8unorm_750c74() { - var res: vec4 = unpack4x8unorm(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack4x8unorm_750c74(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack4x8unorm_750c74(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack4x8unorm_750c74(); -} diff --git a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.glsl b/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.glsl deleted file mode 100644 index ad90ee882a..0000000000 --- a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.glsl +++ /dev/null @@ -1,49 +0,0 @@ -#version 310 es - -void unpack4x8unorm_750c74() { - vec4 res = unpackUnorm4x8(1u); -} - -vec4 vertex_main() { - unpack4x8unorm_750c74(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - gl_PointSize = 1.0; - vec4 inner_result = vertex_main(); - gl_Position = inner_result; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -#version 310 es -precision mediump float; - -void unpack4x8unorm_750c74() { - vec4 res = unpackUnorm4x8(1u); -} - -void fragment_main() { - unpack4x8unorm_750c74(); -} - -void main() { - fragment_main(); - return; -} -#version 310 es - -void unpack4x8unorm_750c74() { - vec4 res = unpackUnorm4x8(1u); -} - -void compute_main() { - unpack4x8unorm_750c74(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - compute_main(); - return; -} diff --git a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.hlsl b/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.hlsl deleted file mode 100644 index 78266e5a9e..0000000000 --- a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.hlsl +++ /dev/null @@ -1,36 +0,0 @@ -float4 tint_unpack4x8unorm(uint param_0) { - uint j = param_0; - uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); - return float4(i) / 255.0; -} - -void unpack4x8unorm_750c74() { - float4 res = tint_unpack4x8unorm(1u); -} - -struct tint_symbol { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - unpack4x8unorm_750c74(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - unpack4x8unorm_750c74(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - unpack4x8unorm_750c74(); - return; -} diff --git a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.msl b/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.msl deleted file mode 100644 index cc5cd0a170..0000000000 --- a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.msl +++ /dev/null @@ -1,33 +0,0 @@ -#include - -using namespace metal; -void unpack4x8unorm_750c74() { - float4 res = unpack_unorm4x8_to_float(1u); -} - -struct tint_symbol { - float4 value [[position]]; -}; - -float4 vertex_main_inner() { - unpack4x8unorm_750c74(); - return float4(); -} - -vertex tint_symbol vertex_main() { - float4 const inner_result = vertex_main_inner(); - tint_symbol wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - -fragment void fragment_main() { - unpack4x8unorm_750c74(); - return; -} - -kernel void compute_main() { - unpack4x8unorm_750c74(); - return; -} - diff --git a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.wgsl b/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.wgsl deleted file mode 100644 index bfedafb717..0000000000 --- a/test/tint/builtins/gen/unpack4x8unorm/750c74.wgsl.expected.wgsl +++ /dev/null @@ -1,19 +0,0 @@ -fn unpack4x8unorm_750c74() { - var res : vec4 = unpack4x8unorm(1u); -} - -@stage(vertex) -fn vertex_main() -> @builtin(position) vec4 { - unpack4x8unorm_750c74(); - return vec4(); -} - -@stage(fragment) -fn fragment_main() { - unpack4x8unorm_750c74(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - unpack4x8unorm_750c74(); -} diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl b/test/tint/builtins/gen/var/abs/002533.wgsl new file mode 100644 index 0000000000..c1d7213ee4 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<4, f32>) -> vec<4, f32> +fn abs_002533() { + var arg_0 = vec4(1.f); + var res: vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_002533(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_002533(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_002533(); +} diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b6f00c7e9 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_002533() { + float4 arg_0 = (1.0f).xxxx; + float4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_002533(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_002533(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_002533(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b6f00c7e9 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_002533() { + float4 arg_0 = (1.0f).xxxx; + float4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_002533(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_002533(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_002533(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl new file mode 100644 index 0000000000..b2b0c1e34b --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_002533() { + vec4 arg_0 = vec4(1.0f); + vec4 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_002533(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_002533() { + vec4 arg_0 = vec4(1.0f); + vec4 res = abs(arg_0); +} + +void fragment_main() { + abs_002533(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_002533() { + vec4 arg_0 = vec4(1.0f); + vec4 res = abs(arg_0); +} + +void compute_main() { + abs_002533(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl new file mode 100644 index 0000000000..ecdc7ee604 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_002533() { + float4 arg_0 = float4(1.0f); + float4 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_002533(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_002533(); + return; +} + +kernel void compute_main() { + abs_002533(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm new file mode 100644 index 0000000000..db4456dfc5 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_002533 "abs_002533" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %abs_002533 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 FAbs %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_002533 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %abs_002533 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_002533 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl new file mode 100644 index 0000000000..267fb80a07 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_002533() { + var arg_0 = vec4(1.0f); + var res : vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_002533(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_002533(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_002533(); +} diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl b/test/tint/builtins/gen/var/abs/005174.wgsl new file mode 100644 index 0000000000..3158995e15 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<3, f32>) -> vec<3, f32> +fn abs_005174() { + var arg_0 = vec3(1.f); + var res: vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_005174(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_005174(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_005174(); +} diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..812400353c --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_005174() { + float3 arg_0 = (1.0f).xxx; + float3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_005174(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_005174(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_005174(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..812400353c --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_005174() { + float3 arg_0 = (1.0f).xxx; + float3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_005174(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_005174(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_005174(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl new file mode 100644 index 0000000000..eafcd88375 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_005174() { + vec3 arg_0 = vec3(1.0f); + vec3 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_005174(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_005174() { + vec3 arg_0 = vec3(1.0f); + vec3 res = abs(arg_0); +} + +void fragment_main() { + abs_005174(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_005174() { + vec3 arg_0 = vec3(1.0f); + vec3 res = abs(arg_0); +} + +void compute_main() { + abs_005174(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl new file mode 100644 index 0000000000..c87ee076d4 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_005174() { + float3 arg_0 = float3(1.0f); + float3 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_005174(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_005174(); + return; +} + +kernel void compute_main() { + abs_005174(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm new file mode 100644 index 0000000000..62a78524f3 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_005174 "abs_005174" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float + %abs_005174 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 FAbs %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %abs_005174 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_005174 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_005174 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ac6dff7ba --- /dev/null +++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_005174() { + var arg_0 = vec3(1.0f); + var res : vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_005174(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_005174(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_005174(); +} diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl new file mode 100644 index 0000000000..b9623325c9 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<4, u32>) -> vec<4, u32> +fn abs_1ce782() { + var arg_0 = vec4(1u); + var res: vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_1ce782(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_1ce782(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_1ce782(); +} diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..636bde583b --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_1ce782() { + uint4 arg_0 = (1u).xxxx; + uint4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1ce782(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1ce782(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1ce782(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..636bde583b --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_1ce782() { + uint4 arg_0 = (1u).xxxx; + uint4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1ce782(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1ce782(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1ce782(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl new file mode 100644 index 0000000000..118f0ffa31 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_1ce782() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = arg_0; +} + +vec4 vertex_main() { + abs_1ce782(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_1ce782() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = arg_0; +} + +void fragment_main() { + abs_1ce782(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_1ce782() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = arg_0; +} + +void compute_main() { + abs_1ce782(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl new file mode 100644 index 0000000000..18c3c5adab --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_1ce782() { + uint4 arg_0 = uint4(1u); + uint4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_1ce782(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_1ce782(); + return; +} + +kernel void compute_main() { + abs_1ce782(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm new file mode 100644 index 0000000000..e08a560b30 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_1ce782 "abs_1ce782" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_1ce782 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %19 + %res = OpVariable %_ptr_Function_v4uint Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v4uint %arg_0 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %abs_1ce782 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_1ce782 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %abs_1ce782 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl new file mode 100644 index 0000000000..92b0f35d2b --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_1ce782() { + var arg_0 = vec4(1u); + var res : vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_1ce782(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_1ce782(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_1ce782(); +} diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl new file mode 100644 index 0000000000..afc65bf8af --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<2, f32>) -> vec<2, f32> +fn abs_1e9d53() { + var arg_0 = vec2(1.f); + var res: vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_1e9d53(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_1e9d53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_1e9d53(); +} diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8ae3d40689 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_1e9d53() { + float2 arg_0 = (1.0f).xx; + float2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1e9d53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1e9d53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1e9d53(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8ae3d40689 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_1e9d53() { + float2 arg_0 = (1.0f).xx; + float2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_1e9d53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_1e9d53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_1e9d53(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl new file mode 100644 index 0000000000..edb76d66dd --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_1e9d53() { + vec2 arg_0 = vec2(1.0f); + vec2 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_1e9d53(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_1e9d53() { + vec2 arg_0 = vec2(1.0f); + vec2 res = abs(arg_0); +} + +void fragment_main() { + abs_1e9d53(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_1e9d53() { + vec2 arg_0 = vec2(1.0f); + vec2 res = abs(arg_0); +} + +void compute_main() { + abs_1e9d53(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl new file mode 100644 index 0000000000..87a6a67c31 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_1e9d53() { + float2 arg_0 = float2(1.0f); + float2 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_1e9d53(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_1e9d53(); + return; +} + +kernel void compute_main() { + abs_1e9d53(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm new file mode 100644 index 0000000000..43daf5db94 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_1e9d53 "abs_1e9d53" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float + %abs_1e9d53 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 FAbs %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %abs_1e9d53 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_1e9d53 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_1e9d53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl new file mode 100644 index 0000000000..92d84c31e0 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_1e9d53() { + var arg_0 = vec2(1.0f); + var res : vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_1e9d53(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_1e9d53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_1e9d53(); +} diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl new file mode 100644 index 0000000000..c5557d3864 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<3, f16>) -> vec<3, f16> +fn abs_421ca3() { + var arg_0 = vec3(f16()); + var res: vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_421ca3(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_421ca3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_421ca3(); +} diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd5239b78d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_421ca3() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_421ca3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_421ca3(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5e90e2dffd --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void abs_421ca3() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_421ca3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_421ca3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002C922E88770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002C922E88770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.glsl new file mode 100644 index 0000000000..8ddae5f59f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_421ca3() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_421ca3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_421ca3() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = abs(arg_0); +} + +void fragment_main() { + abs_421ca3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_421ca3() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = abs(arg_0); +} + +void compute_main() { + abs_421ca3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.msl new file mode 100644 index 0000000000..e40c3ac86a --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_421ca3() { + half3 arg_0 = half3(0.0h); + half3 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_421ca3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_421ca3(); + return; +} + +kernel void compute_main() { + abs_421ca3(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.spvasm new file mode 100644 index 0000000000..1f1be0aec4 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_421ca3 "abs_421ca3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_421ca3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 FAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_421ca3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_421ca3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_421ca3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d15e4aebc --- /dev/null +++ b/test/tint/builtins/gen/var/abs/421ca3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn abs_421ca3() { + var arg_0 = vec3(f16()); + var res : vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_421ca3(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_421ca3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_421ca3(); +} diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl new file mode 100644 index 0000000000..6c1b5d4aae --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(u32) -> u32 +fn abs_467cd1() { + var arg_0 = 1u; + var res: u32 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_467cd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_467cd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_467cd1(); +} diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1843affb8e --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_467cd1() { + uint arg_0 = 1u; + uint res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_467cd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_467cd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_467cd1(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1843affb8e --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_467cd1() { + uint arg_0 = 1u; + uint res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_467cd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_467cd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_467cd1(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl new file mode 100644 index 0000000000..14629ec8fc --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_467cd1() { + uint arg_0 = 1u; + uint res = arg_0; +} + +vec4 vertex_main() { + abs_467cd1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_467cd1() { + uint arg_0 = 1u; + uint res = arg_0; +} + +void fragment_main() { + abs_467cd1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_467cd1() { + uint arg_0 = 1u; + uint res = arg_0; +} + +void compute_main() { + abs_467cd1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl new file mode 100644 index 0000000000..2185834a8d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_467cd1() { + uint arg_0 = 1u; + uint res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_467cd1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_467cd1(); + return; +} + +kernel void compute_main() { + abs_467cd1(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm new file mode 100644 index 0000000000..0c22f425c0 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_467cd1 "abs_467cd1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_467cd1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %19 = OpLoad %uint %arg_0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_467cd1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_467cd1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_467cd1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl new file mode 100644 index 0000000000..13846884f5 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_467cd1() { + var arg_0 = 1u; + var res : u32 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_467cd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_467cd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_467cd1(); +} diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl new file mode 100644 index 0000000000..5518ed005c --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(i32) -> i32 +fn abs_4ad288() { + var arg_0 = 1; + var res: i32 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_4ad288(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_4ad288(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_4ad288(); +} diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b755468c3 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_4ad288(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_4ad288(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_4ad288(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b755468c3 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_4ad288(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_4ad288(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_4ad288(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl new file mode 100644 index 0000000000..cf24591ba9 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +vec4 vertex_main() { + abs_4ad288(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +void fragment_main() { + abs_4ad288(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +void compute_main() { + abs_4ad288(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl new file mode 100644 index 0000000000..a721e9122e --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_4ad288() { + int arg_0 = 1; + int res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_4ad288(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_4ad288(); + return; +} + +kernel void compute_main() { + abs_4ad288(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm new file mode 100644 index 0000000000..2de82a8ceb --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_4ad288 "abs_4ad288" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_4ad288 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + %20 = OpLoad %int %arg_0 + %18 = OpExtInst %int %19 SAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_4ad288 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_4ad288 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_4ad288 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl new file mode 100644 index 0000000000..1a9cb02f2d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_4ad288() { + var arg_0 = 1; + var res : i32 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_4ad288(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_4ad288(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_4ad288(); +} diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl b/test/tint/builtins/gen/var/abs/538d29.wgsl new file mode 100644 index 0000000000..333532f40d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<4, f16>) -> vec<4, f16> +fn abs_538d29() { + var arg_0 = vec4(f16()); + var res: vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_538d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_538d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_538d29(); +} diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..99a98603c7 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_538d29() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_538d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_538d29(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1f4e9ce445 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void abs_538d29() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_538d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_538d29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B8FDD307F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B8FDD307F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.glsl new file mode 100644 index 0000000000..10d37e7f97 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_538d29() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_538d29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_538d29() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = abs(arg_0); +} + +void fragment_main() { + abs_538d29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_538d29() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = abs(arg_0); +} + +void compute_main() { + abs_538d29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.msl new file mode 100644 index 0000000000..3c8d74a014 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_538d29() { + half4 arg_0 = half4(0.0h); + half4 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_538d29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_538d29(); + return; +} + +kernel void compute_main() { + abs_538d29(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.spvasm new file mode 100644 index 0000000000..777bcc2e4f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_538d29 "abs_538d29" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_538d29 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 FAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_538d29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_538d29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_538d29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7749f15e9 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/538d29.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn abs_538d29() { + var arg_0 = vec4(f16()); + var res : vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_538d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_538d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_538d29(); +} diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl new file mode 100644 index 0000000000..9dbfdc50f1 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<3, i32>) -> vec<3, i32> +fn abs_5ad50a() { + var arg_0 = vec3(1); + var res: vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ad50a(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ad50a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ad50a(); +} diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c9db60bafc --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_5ad50a() { + int3 arg_0 = (1).xxx; + int3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ad50a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ad50a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ad50a(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9db60bafc --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_5ad50a() { + int3 arg_0 = (1).xxx; + int3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ad50a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ad50a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ad50a(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl new file mode 100644 index 0000000000..a3976e9607 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_5ad50a() { + ivec3 arg_0 = ivec3(1); + ivec3 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_5ad50a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_5ad50a() { + ivec3 arg_0 = ivec3(1); + ivec3 res = abs(arg_0); +} + +void fragment_main() { + abs_5ad50a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_5ad50a() { + ivec3 arg_0 = ivec3(1); + ivec3 res = abs(arg_0); +} + +void compute_main() { + abs_5ad50a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl new file mode 100644 index 0000000000..1ff6dc4a03 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_5ad50a() { + int3 arg_0 = int3(1); + int3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_5ad50a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_5ad50a(); + return; +} + +kernel void compute_main() { + abs_5ad50a(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm new file mode 100644 index 0000000000..160d442be2 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_5ad50a "abs_5ad50a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_5ad50a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %19 + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %arg_0 %16 + %22 = OpLoad %v3int %arg_0 + %20 = OpExtInst %v3int %21 SAbs %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %abs_5ad50a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_5ad50a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %abs_5ad50a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl new file mode 100644 index 0000000000..04a451941d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_5ad50a() { + var arg_0 = vec3(1); + var res : vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ad50a(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ad50a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ad50a(); +} diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl new file mode 100644 index 0000000000..19384bc9b6 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(vec<2, f16>) -> vec<2, f16> +fn abs_5ae4fe() { + var arg_0 = vec2(f16()); + var res: vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ae4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ae4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ae4fe(); +} diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eb119af9b1 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_5ae4fe() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ae4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ae4fe(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dc15e74690 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void abs_5ae4fe() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_5ae4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_5ae4fe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000183992C05E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000183992C05E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.glsl new file mode 100644 index 0000000000..38a613d9a9 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_5ae4fe() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_5ae4fe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_5ae4fe() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = abs(arg_0); +} + +void fragment_main() { + abs_5ae4fe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_5ae4fe() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = abs(arg_0); +} + +void compute_main() { + abs_5ae4fe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.msl new file mode 100644 index 0000000000..2a223eb9ec --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_5ae4fe() { + half2 arg_0 = half2(0.0h); + half2 res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_5ae4fe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_5ae4fe(); + return; +} + +kernel void compute_main() { + abs_5ae4fe(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.spvasm new file mode 100644 index 0000000000..451a9324b3 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_5ae4fe "abs_5ae4fe" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_5ae4fe = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 FAbs %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %abs_5ae4fe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_5ae4fe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %abs_5ae4fe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe5cd69d41 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/5ae4fe.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn abs_5ae4fe() { + var arg_0 = vec2(f16()); + var res : vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_5ae4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_5ae4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_5ae4fe(); +} diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl b/test/tint/builtins/gen/var/abs/7326de.wgsl new file mode 100644 index 0000000000..7405e00d72 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<3, u32>) -> vec<3, u32> +fn abs_7326de() { + var arg_0 = vec3(1u); + var res: vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7326de(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7326de(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7326de(); +} diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d0ae4a5031 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_7326de() { + uint3 arg_0 = (1u).xxx; + uint3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7326de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7326de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7326de(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d0ae4a5031 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_7326de() { + uint3 arg_0 = (1u).xxx; + uint3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7326de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7326de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7326de(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl new file mode 100644 index 0000000000..52ac50a4f6 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_7326de() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = arg_0; +} + +vec4 vertex_main() { + abs_7326de(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_7326de() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = arg_0; +} + +void fragment_main() { + abs_7326de(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_7326de() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = arg_0; +} + +void compute_main() { + abs_7326de(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl new file mode 100644 index 0000000000..07f3f440d1 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_7326de() { + uint3 arg_0 = uint3(1u); + uint3 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_7326de(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_7326de(); + return; +} + +kernel void compute_main() { + abs_7326de(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm new file mode 100644 index 0000000000..fddef64aaf --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_7326de "abs_7326de" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_7326de = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %19 + %res = OpVariable %_ptr_Function_v3uint Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v3uint %arg_0 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %abs_7326de + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_7326de + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %abs_7326de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b2089dd08 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_7326de() { + var arg_0 = vec3(1u); + var res : vec3 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7326de(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7326de(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7326de(); +} diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl new file mode 100644 index 0000000000..35e5893c31 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<2, u32>) -> vec<2, u32> +fn abs_7f28e6() { + var arg_0 = vec2(1u); + var res: vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7f28e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7f28e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7f28e6(); +} diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c311d9ac38 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_7f28e6() { + uint2 arg_0 = (1u).xx; + uint2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7f28e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7f28e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7f28e6(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c311d9ac38 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_7f28e6() { + uint2 arg_0 = (1u).xx; + uint2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7f28e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7f28e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7f28e6(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl new file mode 100644 index 0000000000..58a3941503 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_7f28e6() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = arg_0; +} + +vec4 vertex_main() { + abs_7f28e6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_7f28e6() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = arg_0; +} + +void fragment_main() { + abs_7f28e6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_7f28e6() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = arg_0; +} + +void compute_main() { + abs_7f28e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl new file mode 100644 index 0000000000..3a1d4a5c3b --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_7f28e6() { + uint2 arg_0 = uint2(1u); + uint2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_7f28e6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_7f28e6(); + return; +} + +kernel void compute_main() { + abs_7f28e6(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..ead810c77f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_7f28e6 "abs_7f28e6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_7f28e6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %19 + %res = OpVariable %_ptr_Function_v2uint Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v2uint %arg_0 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %abs_7f28e6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %abs_7f28e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %abs_7f28e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..076f526ba3 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_7f28e6() { + var arg_0 = vec2(1u); + var res : vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7f28e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7f28e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7f28e6(); +} diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl new file mode 100644 index 0000000000..e30951b970 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<2, i32>) -> vec<2, i32> +fn abs_7faa9e() { + var arg_0 = vec2(1); + var res: vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7faa9e(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7faa9e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7faa9e(); +} diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e3d0de9c0f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_7faa9e() { + int2 arg_0 = (1).xx; + int2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7faa9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7faa9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7faa9e(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e3d0de9c0f --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_7faa9e() { + int2 arg_0 = (1).xx; + int2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_7faa9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_7faa9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_7faa9e(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl new file mode 100644 index 0000000000..ee151820f8 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_7faa9e() { + ivec2 arg_0 = ivec2(1); + ivec2 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_7faa9e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_7faa9e() { + ivec2 arg_0 = ivec2(1); + ivec2 res = abs(arg_0); +} + +void fragment_main() { + abs_7faa9e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_7faa9e() { + ivec2 arg_0 = ivec2(1); + ivec2 res = abs(arg_0); +} + +void compute_main() { + abs_7faa9e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl new file mode 100644 index 0000000000..94be3da1b4 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_7faa9e() { + int2 arg_0 = int2(1); + int2 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_7faa9e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_7faa9e(); + return; +} + +kernel void compute_main() { + abs_7faa9e(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9187ec72a --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_7faa9e "abs_7faa9e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_7faa9e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %19 + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %arg_0 %16 + %22 = OpLoad %v2int %arg_0 + %20 = OpExtInst %v2int %21 SAbs %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %abs_7faa9e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_7faa9e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %abs_7faa9e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl new file mode 100644 index 0000000000..23c2fe7830 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_7faa9e() { + var arg_0 = vec2(1); + var res : vec2 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_7faa9e(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_7faa9e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_7faa9e(); +} diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl new file mode 100644 index 0000000000..d6a145fb72 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(vec<4, i32>) -> vec<4, i32> +fn abs_9c80a6() { + var arg_0 = vec4(1); + var res: vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_9c80a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_9c80a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_9c80a6(); +} diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64b41fca2d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_9c80a6() { + int4 arg_0 = (1).xxxx; + int4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_9c80a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_9c80a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_9c80a6(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64b41fca2d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_9c80a6() { + int4 arg_0 = (1).xxxx; + int4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_9c80a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_9c80a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_9c80a6(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl new file mode 100644 index 0000000000..4a05134d90 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_9c80a6() { + ivec4 arg_0 = ivec4(1); + ivec4 res = abs(arg_0); +} + +vec4 vertex_main() { + abs_9c80a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_9c80a6() { + ivec4 arg_0 = ivec4(1); + ivec4 res = abs(arg_0); +} + +void fragment_main() { + abs_9c80a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_9c80a6() { + ivec4 arg_0 = ivec4(1); + ivec4 res = abs(arg_0); +} + +void compute_main() { + abs_9c80a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl new file mode 100644 index 0000000000..dc91c5e30b --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_9c80a6() { + int4 arg_0 = int4(1); + int4 res = abs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_9c80a6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_9c80a6(); + return; +} + +kernel void compute_main() { + abs_9c80a6(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..2948a66061 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_9c80a6 "abs_9c80a6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_9c80a6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %19 + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %arg_0 %16 + %22 = OpLoad %v4int %arg_0 + %20 = OpExtInst %v4int %21 SAbs %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %abs_9c80a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_9c80a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %abs_9c80a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e3fd3ad51 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_9c80a6() { + var arg_0 = vec4(1); + var res : vec4 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_9c80a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_9c80a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_9c80a6(); +} diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl b/test/tint/builtins/gen/var/abs/b96037.wgsl new file mode 100644 index 0000000000..88b177def1 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn abs(f32) -> f32 +fn abs_b96037() { + var arg_0 = 1.f; + var res: f32 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_b96037(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_b96037(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_b96037(); +} diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b19d55ff79 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_b96037() { + float arg_0 = 1.0f; + float res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_b96037(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_b96037(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_b96037(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b19d55ff79 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void abs_b96037() { + float arg_0 = 1.0f; + float res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_b96037(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_b96037(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_b96037(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl new file mode 100644 index 0000000000..0c3a36456d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void abs_b96037() { + float arg_0 = 1.0f; + float res = abs(arg_0); +} + +vec4 vertex_main() { + abs_b96037(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void abs_b96037() { + float arg_0 = 1.0f; + float res = abs(arg_0); +} + +void fragment_main() { + abs_b96037(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void abs_b96037() { + float arg_0 = 1.0f; + float res = abs(arg_0); +} + +void compute_main() { + abs_b96037(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl new file mode 100644 index 0000000000..ad39e75088 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_b96037() { + float arg_0 = 1.0f; + float res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_b96037(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_b96037(); + return; +} + +kernel void compute_main() { + abs_b96037(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm new file mode 100644 index 0000000000..419d3a15f0 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_b96037 "abs_b96037" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %abs_b96037 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 FAbs %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %abs_b96037 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %abs_b96037 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %abs_b96037 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c6d5dc100 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn abs_b96037() { + var arg_0 = 1.0f; + var res : f32 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_b96037(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_b96037(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_b96037(); +} diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl new file mode 100644 index 0000000000..a347b41699 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn abs(f16) -> f16 +fn abs_fd247f() { + var arg_0 = f16(); + var res: f16 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_fd247f(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_fd247f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_fd247f(); +} diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94ac0c575d --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void abs_fd247f() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_fd247f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_fd247f(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..891b948f02 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void abs_fd247f() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = abs(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + abs_fd247f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + abs_fd247f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002C33CE4C600(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002C33CE4C600(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.glsl new file mode 100644 index 0000000000..704f3ef46a --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_fd247f() { + float16_t arg_0 = 0.0hf; + float16_t res = abs(arg_0); +} + +vec4 vertex_main() { + abs_fd247f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void abs_fd247f() { + float16_t arg_0 = 0.0hf; + float16_t res = abs(arg_0); +} + +void fragment_main() { + abs_fd247f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void abs_fd247f() { + float16_t arg_0 = 0.0hf; + float16_t res = abs(arg_0); +} + +void compute_main() { + abs_fd247f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.msl new file mode 100644 index 0000000000..0090547046 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void abs_fd247f() { + half arg_0 = 0.0h; + half res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + abs_fd247f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + abs_fd247f(); + return; +} + +kernel void compute_main() { + abs_fd247f(); + return; +} + diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.spvasm new file mode 100644 index 0000000000..7594c69b3a --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %abs_fd247f "abs_fd247f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %abs_fd247f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 FAbs %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %abs_fd247f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %abs_fd247f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %abs_fd247f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.wgsl new file mode 100644 index 0000000000..99d265c381 --- /dev/null +++ b/test/tint/builtins/gen/var/abs/fd247f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn abs_fd247f() { + var arg_0 = f16(); + var res : f16 = abs(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + abs_fd247f(); + return vec4(); +} + +@fragment +fn fragment_main() { + abs_fd247f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + abs_fd247f(); +} diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl b/test/tint/builtins/gen/var/acos/004aff.wgsl new file mode 100644 index 0000000000..a414dbc891 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<2, f16>) -> vec<2, f16> +fn acos_004aff() { + var arg_0 = vec2(f16()); + var res: vec2 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_004aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_004aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_004aff(); +} diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46a0caf756 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_004aff() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_004aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_004aff(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6332759029 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void acos_004aff() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_004aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_004aff(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000014A098A05E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000014A098A05E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.glsl new file mode 100644 index 0000000000..1b33ea1962 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_004aff() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_004aff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_004aff() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = acos(arg_0); +} + +void fragment_main() { + acos_004aff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_004aff() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = acos(arg_0); +} + +void compute_main() { + acos_004aff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.msl new file mode 100644 index 0000000000..c5a6e7637b --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_004aff() { + half2 arg_0 = half2(0.0h); + half2 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_004aff(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_004aff(); + return; +} + +kernel void compute_main() { + acos_004aff(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.spvasm new file mode 100644 index 0000000000..b654c2f795 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_004aff "acos_004aff" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_004aff = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Acos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %acos_004aff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_004aff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %acos_004aff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f2035be4a --- /dev/null +++ b/test/tint/builtins/gen/var/acos/004aff.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acos_004aff() { + var arg_0 = vec2(f16()); + var res : vec2 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_004aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_004aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_004aff(); +} diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl b/test/tint/builtins/gen/var/acos/203628.wgsl new file mode 100644 index 0000000000..6ec10ba5f2 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<4, f16>) -> vec<4, f16> +fn acos_203628() { + var arg_0 = vec4(f16()); + var res: vec4 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_203628(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_203628(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_203628(); +} diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2c8911e27 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_203628() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_203628(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_203628(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_203628(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..388e412757 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void acos_203628() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_203628(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_203628(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_203628(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000227066CF430(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000227066CF430(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.glsl new file mode 100644 index 0000000000..fa94d0f58c --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_203628() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_203628(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_203628() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = acos(arg_0); +} + +void fragment_main() { + acos_203628(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_203628() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = acos(arg_0); +} + +void compute_main() { + acos_203628(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.msl new file mode 100644 index 0000000000..9f35174fd5 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_203628() { + half4 arg_0 = half4(0.0h); + half4 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_203628(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_203628(); + return; +} + +kernel void compute_main() { + acos_203628(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.spvasm new file mode 100644 index 0000000000..3069e9aa25 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_203628 "acos_203628" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_203628 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Acos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %acos_203628 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_203628 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %acos_203628 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/203628.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.wgsl new file mode 100644 index 0000000000..78fc613d50 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/203628.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acos_203628() { + var arg_0 = vec4(f16()); + var res : vec4 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_203628(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_203628(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_203628(); +} diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl new file mode 100644 index 0000000000..39290afec5 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(f16) -> f16 +fn acos_303e3d() { + var arg_0 = f16(); + var res: f16 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_303e3d(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_303e3d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_303e3d(); +} diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd39161e8e --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_303e3d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_303e3d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_303e3d(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..48013a182b --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void acos_303e3d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_303e3d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_303e3d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C6C153CEA0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C6C153CEA0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.glsl new file mode 100644 index 0000000000..5a6a3e3b17 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_303e3d() { + float16_t arg_0 = 0.0hf; + float16_t res = acos(arg_0); +} + +vec4 vertex_main() { + acos_303e3d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_303e3d() { + float16_t arg_0 = 0.0hf; + float16_t res = acos(arg_0); +} + +void fragment_main() { + acos_303e3d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_303e3d() { + float16_t arg_0 = 0.0hf; + float16_t res = acos(arg_0); +} + +void compute_main() { + acos_303e3d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.msl new file mode 100644 index 0000000000..05c4e64b42 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_303e3d() { + half arg_0 = 0.0h; + half res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_303e3d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_303e3d(); + return; +} + +kernel void compute_main() { + acos_303e3d(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.spvasm new file mode 100644 index 0000000000..b915e0d28d --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_303e3d "acos_303e3d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_303e3d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Acos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %acos_303e3d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %acos_303e3d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %acos_303e3d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.wgsl new file mode 100644 index 0000000000..e91cf5b527 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/303e3d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acos_303e3d() { + var arg_0 = f16(); + var res : f16 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_303e3d(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_303e3d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_303e3d(); +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl b/test/tint/builtins/gen/var/acos/489247.wgsl new file mode 100644 index 0000000000..5cfbdc1299 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(f32) -> f32 +fn acos_489247() { + var arg_0 = 1.f; + var res: f32 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_489247(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_489247(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_489247(); +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9f53955922 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_489247(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_489247(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_489247(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f53955922 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_489247(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_489247(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_489247(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl new file mode 100644 index 0000000000..bd507c702e --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +vec4 vertex_main() { + acos_489247(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +void fragment_main() { + acos_489247(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +void compute_main() { + acos_489247(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl new file mode 100644 index 0000000000..273a93f6b8 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_489247() { + float arg_0 = 1.0f; + float res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_489247(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_489247(); + return; +} + +kernel void compute_main() { + acos_489247(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm new file mode 100644 index 0000000000..854923b83c --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_489247 "acos_489247" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%acos_489247 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Acos %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %acos_489247 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_489247 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_489247 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl new file mode 100644 index 0000000000..9ec8e7a4dd --- /dev/null +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_489247() { + var arg_0 = 1.0f; + var res : f32 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_489247(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_489247(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_489247(); +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl new file mode 100644 index 0000000000..d5b67ce903 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<4, f32>) -> vec<4, f32> +fn acos_8e2acf() { + var arg_0 = vec4(1.f); + var res: vec4 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_8e2acf(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_8e2acf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_8e2acf(); +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..390e655269 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_8e2acf() { + float4 arg_0 = (1.0f).xxxx; + float4 res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_8e2acf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_8e2acf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_8e2acf(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..390e655269 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void acos_8e2acf() { + float4 arg_0 = (1.0f).xxxx; + float4 res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_8e2acf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_8e2acf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_8e2acf(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl new file mode 100644 index 0000000000..b8d3472288 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void acos_8e2acf() { + vec4 arg_0 = vec4(1.0f); + vec4 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_8e2acf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_8e2acf() { + vec4 arg_0 = vec4(1.0f); + vec4 res = acos(arg_0); +} + +void fragment_main() { + acos_8e2acf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_8e2acf() { + vec4 arg_0 = vec4(1.0f); + vec4 res = acos(arg_0); +} + +void compute_main() { + acos_8e2acf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl new file mode 100644 index 0000000000..4014603e42 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_8e2acf() { + float4 arg_0 = float4(1.0f); + float4 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_8e2acf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_8e2acf(); + return; +} + +kernel void compute_main() { + acos_8e2acf(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e380b619e --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_8e2acf "acos_8e2acf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%acos_8e2acf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Acos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %acos_8e2acf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_8e2acf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_8e2acf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl new file mode 100644 index 0000000000..85e5e1205e --- /dev/null +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_8e2acf() { + var arg_0 = vec4(1.0f); + var res : vec4 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_8e2acf(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_8e2acf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_8e2acf(); +} diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl new file mode 100644 index 0000000000..aa5a3ac7ac --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<3, f32>) -> vec<3, f32> +fn acos_a610c4() { + var arg_0 = vec3(1.f); + var res: vec3 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_a610c4(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_a610c4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_a610c4(); +} diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fb6c37b8f1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_a610c4() { + float3 arg_0 = (1.0f).xxx; + float3 res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_a610c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_a610c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_a610c4(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fb6c37b8f1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void acos_a610c4() { + float3 arg_0 = (1.0f).xxx; + float3 res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_a610c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_a610c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_a610c4(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl new file mode 100644 index 0000000000..05d24a3f79 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void acos_a610c4() { + vec3 arg_0 = vec3(1.0f); + vec3 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_a610c4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_a610c4() { + vec3 arg_0 = vec3(1.0f); + vec3 res = acos(arg_0); +} + +void fragment_main() { + acos_a610c4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_a610c4() { + vec3 arg_0 = vec3(1.0f); + vec3 res = acos(arg_0); +} + +void compute_main() { + acos_a610c4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl new file mode 100644 index 0000000000..1b5fdf10d1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_a610c4() { + float3 arg_0 = float3(1.0f); + float3 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_a610c4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_a610c4(); + return; +} + +kernel void compute_main() { + acos_a610c4(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm new file mode 100644 index 0000000000..185c9a438a --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_a610c4 "acos_a610c4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%acos_a610c4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Acos %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %acos_a610c4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_a610c4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %acos_a610c4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d5d1f947c --- /dev/null +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_a610c4() { + var arg_0 = vec3(1.0f); + var res : vec3 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_a610c4(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_a610c4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_a610c4(); +} diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl new file mode 100644 index 0000000000..ca261a09c4 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<2, f32>) -> vec<2, f32> +fn acos_dfc915() { + var arg_0 = vec2(1.f); + var res: vec2 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_dfc915(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_dfc915(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_dfc915(); +} diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..872e9e2228 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_dfc915() { + float2 arg_0 = (1.0f).xx; + float2 res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_dfc915(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_dfc915(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_dfc915(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..872e9e2228 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void acos_dfc915() { + float2 arg_0 = (1.0f).xx; + float2 res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_dfc915(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_dfc915(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_dfc915(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl new file mode 100644 index 0000000000..af4464ed75 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void acos_dfc915() { + vec2 arg_0 = vec2(1.0f); + vec2 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_dfc915(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void acos_dfc915() { + vec2 arg_0 = vec2(1.0f); + vec2 res = acos(arg_0); +} + +void fragment_main() { + acos_dfc915(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_dfc915() { + vec2 arg_0 = vec2(1.0f); + vec2 res = acos(arg_0); +} + +void compute_main() { + acos_dfc915(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl new file mode 100644 index 0000000000..ffc436fee1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_dfc915() { + float2 arg_0 = float2(1.0f); + float2 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_dfc915(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_dfc915(); + return; +} + +kernel void compute_main() { + acos_dfc915(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm new file mode 100644 index 0000000000..2165f6ee90 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_dfc915 "acos_dfc915" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%acos_dfc915 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Acos %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %acos_dfc915 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_dfc915 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %acos_dfc915 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d627ff1fb --- /dev/null +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_dfc915() { + var arg_0 = vec2(1.0f); + var res : vec2 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_dfc915(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_dfc915(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_dfc915(); +} diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl b/test/tint/builtins/gen/var/acos/f47057.wgsl new file mode 100644 index 0000000000..b1b2fe7dc2 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acos(vec<3, f16>) -> vec<3, f16> +fn acos_f47057() { + var arg_0 = vec3(f16()); + var res: vec3 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_f47057(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_f47057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_f47057(); +} diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8f0fa43bad --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void acos_f47057() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_f47057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_f47057(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b3376d6cd --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void acos_f47057() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = acos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acos_f47057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_f47057(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000287C9AECA00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000287C9AECA00(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.glsl new file mode 100644 index 0000000000..67209db4c6 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_f47057() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = acos(arg_0); +} + +vec4 vertex_main() { + acos_f47057(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void acos_f47057() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = acos(arg_0); +} + +void fragment_main() { + acos_f47057(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void acos_f47057() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = acos(arg_0); +} + +void compute_main() { + acos_f47057(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.msl new file mode 100644 index 0000000000..376ae7ee68 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void acos_f47057() { + half3 arg_0 = half3(0.0h); + half3 res = acos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_f47057(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acos_f47057(); + return; +} + +kernel void compute_main() { + acos_f47057(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcfdc44df6 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_f47057 "acos_f47057" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_f47057 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Acos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %acos_f47057 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_f47057 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %acos_f47057 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b55578aa1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/f47057.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acos_f47057() { + var arg_0 = vec3(f16()); + var res : vec3 = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_f47057(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_f47057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_f47057(); +} diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl new file mode 100644 index 0000000000..d421a819a2 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<2, f16>) -> vec<2, f16> +fn acosh_5f49d8() { + var arg_0 = vec2(f16()); + var res: vec2 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_5f49d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_5f49d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_5f49d8(); +} diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d2768e742e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_5f49d8() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_5f49d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_5f49d8(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bfa965b2cd --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_5f49d8() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_5f49d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_5f49d8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002311F9F6BD0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl new file mode 100644 index 0000000000..033e902092 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_5f49d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_5f49d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_acosh(f16vec2 x) { + return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf))); +} + +void acosh_5f49d8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_5f49d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.msl new file mode 100644 index 0000000000..b6ed0f0939 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half2 tint_acosh(half2 x) { + return select(acosh(x), half2(0.0h), (x < half2(1.0h))); +} + +void acosh_5f49d8() { + half2 arg_0 = half2(0.0h); + half2 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_5f49d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_5f49d8(); + return; +} + +kernel void compute_main() { + acosh_5f49d8(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..bb409ff113 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_5f49d8 "acosh_5f49d8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v2half = OpTypePointer Function %v2half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v2half None %9 + %x = OpFunctionParameter %v2half + %14 = OpLabel + %18 = OpFOrdLessThan %v2bool %x %17 + %22 = OpExtInst %v2half %23 Acosh %x + %15 = OpSelect %v2half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_5f49d8 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %21 + %res = OpVariable %_ptr_Function_v2half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v2half %arg_0 + %30 = OpFunctionCall %v2half %tint_acosh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %acosh_5f49d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %acosh_5f49d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %acosh_5f49d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..027ad7249e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/5f49d8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acosh_5f49d8() { + var arg_0 = vec2(f16()); + var res : vec2 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_5f49d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_5f49d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_5f49d8(); +} diff --git a/test/tint/builtins/gen/var/acosh/640883.wgsl b/test/tint/builtins/gen/var/acosh/640883.wgsl new file mode 100644 index 0000000000..c6a79f2693 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/640883.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acosh(vec<2, f32>) -> vec<2, f32> +fn acosh_640883() { + var arg_0 = vec2(1.f); + var res: vec2 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_640883(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_640883(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_640883(); +} diff --git a/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9d44d7c140 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_acosh(float2 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_640883() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_640883(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_640883(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_640883(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9d44d7c140 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_acosh(float2 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_640883() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_640883(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_640883(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_640883(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.glsl new file mode 100644 index 0000000000..3f38c89384 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec2 tint_acosh(vec2 x) { + return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f))); +} + +void acosh_640883() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_640883(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_acosh(vec2 x) { + return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f))); +} + +void acosh_640883() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_640883(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_acosh(vec2 x) { + return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f))); +} + +void acosh_640883() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_640883(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.msl new file mode 100644 index 0000000000..c8f93643e9 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +float2 tint_acosh(float2 x) { + return select(acosh(x), float2(0.0f), (x < float2(1.0f))); +} + +void acosh_640883() { + float2 arg_0 = float2(1.0f); + float2 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_640883(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_640883(); + return; +} + +kernel void compute_main() { + acosh_640883(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f02c2c585 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_640883 "acosh_640883" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %v2float = OpTypeVector %float 2 + %9 = OpTypeFunction %v2float %v2float + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v2float %float_1 %float_1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %20 = OpConstantNull %v2float + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %32 = OpTypeFunction %v4float + %tint_acosh = OpFunction %v2float None %9 + %x = OpFunctionParameter %v2float + %13 = OpLabel + %17 = OpFOrdLessThan %v2bool %x %16 + %21 = OpExtInst %v2float %22 Acosh %x + %14 = OpSelect %v2float %17 %20 %21 + OpReturnValue %14 + OpFunctionEnd +%acosh_640883 = OpFunction %void None %23 + %26 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v2float Function %20 + OpStore %arg_0 %16 + %30 = OpLoad %v2float %arg_0 + %29 = OpFunctionCall %v2float %tint_acosh %30 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %acosh_640883 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_640883 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %43 = OpLabel + %44 = OpFunctionCall %void %acosh_640883 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.wgsl new file mode 100644 index 0000000000..41b1f976c3 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/640883.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acosh_640883() { + var arg_0 = vec2(1.0f); + var res : vec2 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_640883(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_640883(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_640883(); +} diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl new file mode 100644 index 0000000000..805b9faeac --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(f16) -> f16 +fn acosh_a37dfe() { + var arg_0 = f16(); + var res: f16 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_a37dfe(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_a37dfe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_a37dfe(); +} diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..632b73091a --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_acosh(float16_t x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_a37dfe() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_a37dfe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_a37dfe(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ca1ca1308b --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_acosh(float16_t x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_a37dfe() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_a37dfe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_a37dfe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D63F571640(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl new file mode 100644 index 0000000000..be2d5fea3a --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_a37dfe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_a37dfe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_acosh(float16_t x) { + return ((x < 1.0hf) ? 0.0hf : acosh(x)); +} + +void acosh_a37dfe() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_a37dfe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.msl new file mode 100644 index 0000000000..77aed14e97 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half tint_acosh(half x) { + return select(acosh(x), 0.0h, (x < 1.0h)); +} + +void acosh_a37dfe() { + half arg_0 = 0.0h; + half res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_a37dfe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_a37dfe(); + return; +} + +kernel void compute_main() { + acosh_a37dfe(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.spvasm new file mode 100644 index 0000000000..1eede38652 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_a37dfe "acosh_a37dfe" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %9 = OpTypeFunction %half %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %18 = OpConstantNull %half + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %half None %9 + %x = OpFunctionParameter %half + %13 = OpLabel + %16 = OpFOrdLessThan %bool %x %half_0x1p_0 + %19 = OpExtInst %half %20 Acosh %x + %14 = OpSelect %half %16 %18 %19 + OpReturnValue %14 + OpFunctionEnd +%acosh_a37dfe = OpFunction %void None %21 + %24 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %18 + %res = OpVariable %_ptr_Function_half Function %18 + OpStore %arg_0 %18 + %28 = OpLoad %half %arg_0 + %27 = OpFunctionCall %half %tint_acosh %28 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %acosh_a37dfe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %39 = OpLabel + %40 = OpFunctionCall %void %acosh_a37dfe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %42 = OpLabel + %43 = OpFunctionCall %void %acosh_a37dfe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5a84365b9 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/a37dfe.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acosh_a37dfe() { + var arg_0 = f16(); + var res : f16 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_a37dfe(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_a37dfe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_a37dfe(); +} diff --git a/test/tint/builtins/gen/var/acosh/d51ccb.wgsl b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl new file mode 100644 index 0000000000..ba3a51608e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acosh(vec<4, f32>) -> vec<4, f32> +fn acosh_d51ccb() { + var arg_0 = vec4(1.f); + var res: vec4 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_d51ccb(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_d51ccb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_d51ccb(); +} diff --git a/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..218bf9054c --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_acosh(float4 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_d51ccb() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_d51ccb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_d51ccb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_d51ccb(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..218bf9054c --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_acosh(float4 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_d51ccb() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_d51ccb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_d51ccb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_d51ccb(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.glsl new file mode 100644 index 0000000000..0b0c14c5cc --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec4 tint_acosh(vec4 x) { + return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f))); +} + +void acosh_d51ccb() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_d51ccb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_acosh(vec4 x) { + return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f))); +} + +void acosh_d51ccb() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_d51ccb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_acosh(vec4 x) { + return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f))); +} + +void acosh_d51ccb() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_d51ccb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.msl new file mode 100644 index 0000000000..dd27157e31 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +float4 tint_acosh(float4 x) { + return select(acosh(x), float4(0.0f), (x < float4(1.0f))); +} + +void acosh_d51ccb() { + float4 arg_0 = float4(1.0f); + float4 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_d51ccb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_d51ccb(); + return; +} + +kernel void compute_main() { + acosh_d51ccb(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.spvasm new file mode 100644 index 0000000000..12f52f51cb --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_d51ccb "acosh_d51ccb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %9 = OpTypeFunction %v4float %v4float + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %tint_acosh = OpFunction %v4float None %9 + %x = OpFunctionParameter %v4float + %12 = OpLabel + %16 = OpFOrdLessThan %v4bool %x %15 + %19 = OpExtInst %v4float %20 Acosh %x + %13 = OpSelect %v4float %16 %5 %19 + OpReturnValue %13 + OpFunctionEnd +%acosh_d51ccb = OpFunction %void None %21 + %24 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %15 + %28 = OpLoad %v4float %arg_0 + %27 = OpFunctionCall %v4float %tint_acosh %28 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %acosh_d51ccb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %38 = OpLabel + %39 = OpFunctionCall %void %acosh_d51ccb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %41 = OpLabel + %42 = OpFunctionCall %void %acosh_d51ccb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.wgsl new file mode 100644 index 0000000000..3edc445af4 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/d51ccb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acosh_d51ccb() { + var arg_0 = vec4(1.0f); + var res : vec4 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_d51ccb(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_d51ccb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_d51ccb(); +} diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl new file mode 100644 index 0000000000..06b3c4aeea --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<4, f16>) -> vec<4, f16> +fn acosh_de60d8() { + var arg_0 = vec4(f16()); + var res: vec4 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_de60d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_de60d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_de60d8(); +} diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..beda5f45dc --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_de60d8() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_de60d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_de60d8(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f2776f040e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_de60d8() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_de60d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_de60d8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021E640184D0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl new file mode 100644 index 0000000000..b63ecb78b7 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_de60d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_de60d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_acosh(f16vec4 x) { + return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf))); +} + +void acosh_de60d8() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_de60d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.msl new file mode 100644 index 0000000000..0514328be3 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half4 tint_acosh(half4 x) { + return select(acosh(x), half4(0.0h), (x < half4(1.0h))); +} + +void acosh_de60d8() { + half4 arg_0 = half4(0.0h); + half4 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_de60d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_de60d8(); + return; +} + +kernel void compute_main() { + acosh_de60d8(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..10eef9fe20 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_de60d8 "acosh_de60d8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v4half = OpTypePointer Function %v4half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v4half None %9 + %x = OpFunctionParameter %v4half + %14 = OpLabel + %18 = OpFOrdLessThan %v4bool %x %17 + %22 = OpExtInst %v4half %23 Acosh %x + %15 = OpSelect %v4half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_de60d8 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %21 + %res = OpVariable %_ptr_Function_v4half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v4half %arg_0 + %30 = OpFunctionCall %v4half %tint_acosh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %acosh_de60d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %acosh_de60d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %acosh_de60d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..d8a3b14733 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/de60d8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acosh_de60d8() { + var arg_0 = vec4(f16()); + var res : vec4 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_de60d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_de60d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_de60d8(); +} diff --git a/test/tint/builtins/gen/var/acosh/e38f5c.wgsl b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl new file mode 100644 index 0000000000..e4e2986396 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acosh(vec<3, f32>) -> vec<3, f32> +fn acosh_e38f5c() { + var arg_0 = vec3(1.f); + var res: vec3 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_e38f5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_e38f5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_e38f5c(); +} diff --git a/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..713773f94e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_acosh(float3 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_e38f5c() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_e38f5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_e38f5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_e38f5c(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..713773f94e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_acosh(float3 x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_e38f5c() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_e38f5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_e38f5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_e38f5c(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.glsl new file mode 100644 index 0000000000..47e4e5829f --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec3 tint_acosh(vec3 x) { + return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f))); +} + +void acosh_e38f5c() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_e38f5c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_acosh(vec3 x) { + return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f))); +} + +void acosh_e38f5c() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_e38f5c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_acosh(vec3 x) { + return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f))); +} + +void acosh_e38f5c() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_e38f5c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.msl new file mode 100644 index 0000000000..ffdee45e4b --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +float3 tint_acosh(float3 x) { + return select(acosh(x), float3(0.0f), (x < float3(1.0f))); +} + +void acosh_e38f5c() { + float3 arg_0 = float3(1.0f); + float3 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_e38f5c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_e38f5c(); + return; +} + +kernel void compute_main() { + acosh_e38f5c(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.spvasm new file mode 100644 index 0000000000..cac7b8915f --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_e38f5c "acosh_e38f5c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float %v3float + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %20 = OpConstantNull %v3float + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_v3float = OpTypePointer Function %v3float + %32 = OpTypeFunction %v4float + %tint_acosh = OpFunction %v3float None %9 + %x = OpFunctionParameter %v3float + %13 = OpLabel + %17 = OpFOrdLessThan %v3bool %x %16 + %21 = OpExtInst %v3float %22 Acosh %x + %14 = OpSelect %v3float %17 %20 %21 + OpReturnValue %14 + OpFunctionEnd +%acosh_e38f5c = OpFunction %void None %23 + %26 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v3float Function %20 + OpStore %arg_0 %16 + %30 = OpLoad %v3float %arg_0 + %29 = OpFunctionCall %v3float %tint_acosh %30 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %acosh_e38f5c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %40 = OpLabel + %41 = OpFunctionCall %void %acosh_e38f5c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %43 = OpLabel + %44 = OpFunctionCall %void %acosh_e38f5c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3e0060e32 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/e38f5c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acosh_e38f5c() { + var arg_0 = vec3(1.0f); + var res : vec3 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_e38f5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_e38f5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_e38f5c(); +} diff --git a/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl new file mode 100644 index 0000000000..bb46af4591 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acosh(f32) -> f32 +fn acosh_ecf2d1() { + var arg_0 = 1.f; + var res: f32 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_ecf2d1(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_ecf2d1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_ecf2d1(); +} diff --git a/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..44bd5045fb --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float tint_acosh(float x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_ecf2d1() { + float arg_0 = 1.0f; + float res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_ecf2d1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_ecf2d1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_ecf2d1(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44bd5045fb --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float tint_acosh(float x) { + return log((x + sqrt(((x * x) - 1.0f)))); +} + +void acosh_ecf2d1() { + float arg_0 = 1.0f; + float res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_ecf2d1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_ecf2d1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_ecf2d1(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.glsl new file mode 100644 index 0000000000..65339a266f --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +float tint_acosh(float x) { + return ((x < 1.0f) ? 0.0f : acosh(x)); +} + +void acosh_ecf2d1() { + float arg_0 = 1.0f; + float res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_ecf2d1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_acosh(float x) { + return ((x < 1.0f) ? 0.0f : acosh(x)); +} + +void acosh_ecf2d1() { + float arg_0 = 1.0f; + float res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_ecf2d1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_acosh(float x) { + return ((x < 1.0f) ? 0.0f : acosh(x)); +} + +void acosh_ecf2d1() { + float arg_0 = 1.0f; + float res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_ecf2d1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.msl new file mode 100644 index 0000000000..38b666703d --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +float tint_acosh(float x) { + return select(acosh(x), 0.0f, (x < 1.0f)); +} + +void acosh_ecf2d1() { + float arg_0 = 1.0f; + float res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_ecf2d1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_ecf2d1(); + return; +} + +kernel void compute_main() { + acosh_ecf2d1(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.spvasm new file mode 100644 index 0000000000..196c24eaed --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_ecf2d1 "acosh_ecf2d1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %9 = OpTypeFunction %float %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpTypeFunction %v4float + %tint_acosh = OpFunction %float None %9 + %x = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFOrdLessThan %bool %x %float_1 + %17 = OpExtInst %float %18 Acosh %x + %13 = OpSelect %float %15 %8 %17 + OpReturnValue %13 + OpFunctionEnd +%acosh_ecf2d1 = OpFunction %void None %19 + %22 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %26 = OpLoad %float %arg_0 + %25 = OpFunctionCall %float %tint_acosh %26 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %acosh_ecf2d1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %19 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %19 + %36 = OpLabel + %37 = OpFunctionCall %void %acosh_ecf2d1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %19 + %39 = OpLabel + %40 = OpFunctionCall %void %acosh_ecf2d1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.wgsl new file mode 100644 index 0000000000..17ab657a4e --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/ecf2d1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acosh_ecf2d1() { + var arg_0 = 1.0f; + var res : f32 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_ecf2d1(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_ecf2d1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_ecf2d1(); +} diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl new file mode 100644 index 0000000000..b6e484af58 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn acosh(vec<3, f16>) -> vec<3, f16> +fn acosh_f56574() { + var arg_0 = vec3(f16()); + var res: vec3 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_f56574(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_f56574(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_f56574(); +} diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b89a6f9730 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_f56574() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_f56574(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_f56574(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a5310948c5 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_acosh(vector x) { + return log((x + sqrt(((x * x) - float16_t(1.0h))))); +} + +void acosh_f56574() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + acosh_f56574(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acosh_f56574(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027554446BD0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl new file mode 100644 index 0000000000..a5e2a4db81 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_acosh(arg_0); +} + +vec4 vertex_main() { + acosh_f56574(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_acosh(arg_0); +} + +void fragment_main() { + acosh_f56574(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_acosh(f16vec3 x) { + return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf))); +} + +void acosh_f56574() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_acosh(arg_0); +} + +void compute_main() { + acosh_f56574(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.msl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.msl new file mode 100644 index 0000000000..7499b88191 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half3 tint_acosh(half3 x) { + return select(acosh(x), half3(0.0h), (x < half3(1.0h))); +} + +void acosh_f56574() { + half3 arg_0 = half3(0.0h); + half3 res = tint_acosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acosh_f56574(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + acosh_f56574(); + return; +} + +kernel void compute_main() { + acosh_f56574(); + return; +} + diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.spvasm new file mode 100644 index 0000000000..d818740162 --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_acosh "tint_acosh" + OpName %x "x" + OpName %acosh_f56574 "acosh_f56574" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v3half = OpTypePointer Function %v3half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_acosh = OpFunction %v3half None %9 + %x = OpFunctionParameter %v3half + %14 = OpLabel + %18 = OpFOrdLessThan %v3bool %x %17 + %22 = OpExtInst %v3half %23 Acosh %x + %15 = OpSelect %v3half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%acosh_f56574 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %21 + %res = OpVariable %_ptr_Function_v3half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v3half %arg_0 + %30 = OpFunctionCall %v3half %tint_acosh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %acosh_f56574 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %acosh_f56574 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %acosh_f56574 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.wgsl new file mode 100644 index 0000000000..8cbc4f671c --- /dev/null +++ b/test/tint/builtins/gen/var/acosh/f56574.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn acosh_f56574() { + var arg_0 = vec3(f16()); + var res : vec3 = acosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acosh_f56574(); + return vec4(); +} + +@fragment +fn fragment_main() { + acosh_f56574(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acosh_f56574(); +} diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl b/test/tint/builtins/gen/var/all/353d6a.wgsl new file mode 100644 index 0000000000..0b9fd52d65 --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(bool) -> bool +fn all_353d6a() { + var arg_0 = true; + var res: bool = all(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_353d6a(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_353d6a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_353d6a(); +} diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5a010ec57c --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void all_353d6a() { + bool arg_0 = true; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_353d6a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_353d6a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_353d6a(); + return; +} diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5a010ec57c --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void all_353d6a() { + bool arg_0 = true; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_353d6a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_353d6a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_353d6a(); + return; +} diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl new file mode 100644 index 0000000000..483f75e719 --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void all_353d6a() { + bool arg_0 = true; + bool res = arg_0; +} + +vec4 vertex_main() { + all_353d6a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_353d6a() { + bool arg_0 = true; + bool res = arg_0; +} + +void fragment_main() { + all_353d6a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_353d6a() { + bool arg_0 = true; + bool res = arg_0; +} + +void compute_main() { + all_353d6a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl new file mode 100644 index 0000000000..d58dd64af8 --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void all_353d6a() { + bool arg_0 = true; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_353d6a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_353d6a(); + return; +} + +kernel void compute_main() { + all_353d6a(); + return; +} + diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm new file mode 100644 index 0000000000..11c5919e18 --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_353d6a "all_353d6a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %17 = OpConstantNull %bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_353d6a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_bool Function %17 + %res = OpVariable %_ptr_Function_bool Function %17 + OpStore %arg_0 %true + %19 = OpLoad %bool %arg_0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %all_353d6a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %all_353d6a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %all_353d6a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl new file mode 100644 index 0000000000..52757a784a --- /dev/null +++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn all_353d6a() { + var arg_0 = true; + var res : bool = all(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_353d6a(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_353d6a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_353d6a(); +} diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl b/test/tint/builtins/gen/var/all/986c7b.wgsl new file mode 100644 index 0000000000..a71dda2f9c --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(vec<4, bool>) -> bool +fn all_986c7b() { + var arg_0 = vec4(true); + var res: bool = all(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_986c7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_986c7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_986c7b(); +} diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..35919a5231 --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void all_986c7b() { + bool4 arg_0 = (true).xxxx; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_986c7b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_986c7b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_986c7b(); + return; +} diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..35919a5231 --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void all_986c7b() { + bool4 arg_0 = (true).xxxx; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_986c7b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_986c7b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_986c7b(); + return; +} diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl new file mode 100644 index 0000000000..a39a23757a --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void all_986c7b() { + bvec4 arg_0 = bvec4(true); + bool res = all(arg_0); +} + +vec4 vertex_main() { + all_986c7b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_986c7b() { + bvec4 arg_0 = bvec4(true); + bool res = all(arg_0); +} + +void fragment_main() { + all_986c7b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_986c7b() { + bvec4 arg_0 = bvec4(true); + bool res = all(arg_0); +} + +void compute_main() { + all_986c7b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl new file mode 100644 index 0000000000..b4328dafef --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void all_986c7b() { + bool4 arg_0 = bool4(true); + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_986c7b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_986c7b(); + return; +} + +kernel void compute_main() { + all_986c7b(); + return; +} + diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm new file mode 100644 index 0000000000..5851658be1 --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_986c7b "all_986c7b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %19 = OpConstantNull %v4bool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_986c7b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4bool Function %19 + %res = OpVariable %_ptr_Function_bool Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %v4bool %arg_0 + %20 = OpAll %bool %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %all_986c7b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %all_986c7b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %all_986c7b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl new file mode 100644 index 0000000000..8568959cdb --- /dev/null +++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn all_986c7b() { + var arg_0 = vec4(true); + var res : bool = all(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_986c7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_986c7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_986c7b(); +} diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl new file mode 100644 index 0000000000..93c301d1e2 --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(vec<3, bool>) -> bool +fn all_bd2dba() { + var arg_0 = vec3(true); + var res: bool = all(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_bd2dba(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_bd2dba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_bd2dba(); +} diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..472389105b --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void all_bd2dba() { + bool3 arg_0 = (true).xxx; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_bd2dba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_bd2dba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_bd2dba(); + return; +} diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..472389105b --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void all_bd2dba() { + bool3 arg_0 = (true).xxx; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_bd2dba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_bd2dba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_bd2dba(); + return; +} diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl new file mode 100644 index 0000000000..82452d902f --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void all_bd2dba() { + bvec3 arg_0 = bvec3(true); + bool res = all(arg_0); +} + +vec4 vertex_main() { + all_bd2dba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_bd2dba() { + bvec3 arg_0 = bvec3(true); + bool res = all(arg_0); +} + +void fragment_main() { + all_bd2dba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_bd2dba() { + bvec3 arg_0 = bvec3(true); + bool res = all(arg_0); +} + +void compute_main() { + all_bd2dba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl new file mode 100644 index 0000000000..31dbbfa844 --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void all_bd2dba() { + bool3 arg_0 = bool3(true); + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_bd2dba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_bd2dba(); + return; +} + +kernel void compute_main() { + all_bd2dba(); + return; +} + diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fd83001dc --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_bd2dba "all_bd2dba" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %19 = OpConstantNull %v3bool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_bd2dba = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3bool Function %19 + %res = OpVariable %_ptr_Function_bool Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %v3bool %arg_0 + %20 = OpAll %bool %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %all_bd2dba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %all_bd2dba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %all_bd2dba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl new file mode 100644 index 0000000000..afd3009676 --- /dev/null +++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn all_bd2dba() { + var arg_0 = vec3(true); + var res : bool = all(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_bd2dba(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_bd2dba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_bd2dba(); +} diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl b/test/tint/builtins/gen/var/all/f46790.wgsl new file mode 100644 index 0000000000..b1845ae256 --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn all(vec<2, bool>) -> bool +fn all_f46790() { + var arg_0 = vec2(true); + var res: bool = all(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_f46790(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_f46790(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_f46790(); +} diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b82698778 --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void all_f46790() { + bool2 arg_0 = (true).xx; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_f46790(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_f46790(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_f46790(); + return; +} diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b82698778 --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void all_f46790() { + bool2 arg_0 = (true).xx; + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + all_f46790(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + all_f46790(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + all_f46790(); + return; +} diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl new file mode 100644 index 0000000000..4a0a0159d3 --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void all_f46790() { + bvec2 arg_0 = bvec2(true); + bool res = all(arg_0); +} + +vec4 vertex_main() { + all_f46790(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void all_f46790() { + bvec2 arg_0 = bvec2(true); + bool res = all(arg_0); +} + +void fragment_main() { + all_f46790(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void all_f46790() { + bvec2 arg_0 = bvec2(true); + bool res = all(arg_0); +} + +void compute_main() { + all_f46790(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl new file mode 100644 index 0000000000..76fedd030a --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void all_f46790() { + bool2 arg_0 = bool2(true); + bool res = all(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + all_f46790(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + all_f46790(); + return; +} + +kernel void compute_main() { + all_f46790(); + return; +} + diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm new file mode 100644 index 0000000000..8582a6f0c7 --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %all_f46790 "all_f46790" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %19 = OpConstantNull %v2bool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %all_f46790 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2bool Function %19 + %res = OpVariable %_ptr_Function_bool Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %v2bool %arg_0 + %20 = OpAll %bool %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %all_f46790 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %all_f46790 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %all_f46790 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8f1191229 --- /dev/null +++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn all_f46790() { + var arg_0 = vec2(true); + var res : bool = all(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + all_f46790(); + return vec4(); +} + +@fragment +fn fragment_main() { + all_f46790(); +} + +@compute @workgroup_size(1) +fn compute_main() { + all_f46790(); +} diff --git a/test/tint/builtins/gen/var/any/083428.wgsl b/test/tint/builtins/gen/var/any/083428.wgsl new file mode 100644 index 0000000000..e22ac40b62 --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(vec<4, bool>) -> bool +fn any_083428() { + var arg_0 = vec4(true); + var res: bool = any(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_083428(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_083428(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_083428(); +} diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f03531471e --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void any_083428() { + bool4 arg_0 = (true).xxxx; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_083428(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_083428(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_083428(); + return; +} diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f03531471e --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void any_083428() { + bool4 arg_0 = (true).xxxx; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_083428(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_083428(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_083428(); + return; +} diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl new file mode 100644 index 0000000000..42f191fc42 --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void any_083428() { + bvec4 arg_0 = bvec4(true); + bool res = any(arg_0); +} + +vec4 vertex_main() { + any_083428(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_083428() { + bvec4 arg_0 = bvec4(true); + bool res = any(arg_0); +} + +void fragment_main() { + any_083428(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_083428() { + bvec4 arg_0 = bvec4(true); + bool res = any(arg_0); +} + +void compute_main() { + any_083428(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.msl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.msl new file mode 100644 index 0000000000..7d0c4c70fd --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void any_083428() { + bool4 arg_0 = bool4(true); + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_083428(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_083428(); + return; +} + +kernel void compute_main() { + any_083428(); + return; +} + diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm new file mode 100644 index 0000000000..39c3352bf2 --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_083428 "any_083428" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %19 = OpConstantNull %v4bool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_083428 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4bool Function %19 + %res = OpVariable %_ptr_Function_bool Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %v4bool %arg_0 + %20 = OpAny %bool %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %any_083428 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %any_083428 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %any_083428 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6292463cf --- /dev/null +++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn any_083428() { + var arg_0 = vec4(true); + var res : bool = any(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_083428(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_083428(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_083428(); +} diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl new file mode 100644 index 0000000000..2dc9951110 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(vec<2, bool>) -> bool +fn any_0e3e58() { + var arg_0 = vec2(true); + var res: bool = any(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_0e3e58(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_0e3e58(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_0e3e58(); +} diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54cf0d3e51 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void any_0e3e58() { + bool2 arg_0 = (true).xx; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_0e3e58(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_0e3e58(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_0e3e58(); + return; +} diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54cf0d3e51 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void any_0e3e58() { + bool2 arg_0 = (true).xx; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_0e3e58(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_0e3e58(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_0e3e58(); + return; +} diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl new file mode 100644 index 0000000000..45938a5c6c --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void any_0e3e58() { + bvec2 arg_0 = bvec2(true); + bool res = any(arg_0); +} + +vec4 vertex_main() { + any_0e3e58(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_0e3e58() { + bvec2 arg_0 = bvec2(true); + bool res = any(arg_0); +} + +void fragment_main() { + any_0e3e58(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_0e3e58() { + bvec2 arg_0 = bvec2(true); + bool res = any(arg_0); +} + +void compute_main() { + any_0e3e58(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl new file mode 100644 index 0000000000..05e39b7ed9 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void any_0e3e58() { + bool2 arg_0 = bool2(true); + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_0e3e58(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_0e3e58(); + return; +} + +kernel void compute_main() { + any_0e3e58(); + return; +} + diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm new file mode 100644 index 0000000000..dd08859074 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_0e3e58 "any_0e3e58" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %19 = OpConstantNull %v2bool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_0e3e58 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2bool Function %19 + %res = OpVariable %_ptr_Function_bool Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %v2bool %arg_0 + %20 = OpAny %bool %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %any_0e3e58 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %any_0e3e58 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %any_0e3e58 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl new file mode 100644 index 0000000000..512dd96503 --- /dev/null +++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn any_0e3e58() { + var arg_0 = vec2(true); + var res : bool = any(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_0e3e58(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_0e3e58(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_0e3e58(); +} diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl new file mode 100644 index 0000000000..bb31527ef4 --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(bool) -> bool +fn any_2ab91a() { + var arg_0 = true; + var res: bool = any(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_2ab91a(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_2ab91a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_2ab91a(); +} diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..075ef6788b --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void any_2ab91a() { + bool arg_0 = true; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_2ab91a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_2ab91a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_2ab91a(); + return; +} diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..075ef6788b --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void any_2ab91a() { + bool arg_0 = true; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_2ab91a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_2ab91a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_2ab91a(); + return; +} diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl new file mode 100644 index 0000000000..4ace3e4220 --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void any_2ab91a() { + bool arg_0 = true; + bool res = arg_0; +} + +vec4 vertex_main() { + any_2ab91a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_2ab91a() { + bool arg_0 = true; + bool res = arg_0; +} + +void fragment_main() { + any_2ab91a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_2ab91a() { + bool arg_0 = true; + bool res = arg_0; +} + +void compute_main() { + any_2ab91a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl new file mode 100644 index 0000000000..80537b5490 --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void any_2ab91a() { + bool arg_0 = true; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_2ab91a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_2ab91a(); + return; +} + +kernel void compute_main() { + any_2ab91a(); + return; +} + diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm new file mode 100644 index 0000000000..f28dbc84e2 --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_2ab91a "any_2ab91a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %17 = OpConstantNull %bool + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_2ab91a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_bool Function %17 + %res = OpVariable %_ptr_Function_bool Function %17 + OpStore %arg_0 %true + %19 = OpLoad %bool %arg_0 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %any_2ab91a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %any_2ab91a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %any_2ab91a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl new file mode 100644 index 0000000000..578a2629e1 --- /dev/null +++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn any_2ab91a() { + var arg_0 = true; + var res : bool = any(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_2ab91a(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_2ab91a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_2ab91a(); +} diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl b/test/tint/builtins/gen/var/any/e755c1.wgsl new file mode 100644 index 0000000000..4d036b93ac --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn any(vec<3, bool>) -> bool +fn any_e755c1() { + var arg_0 = vec3(true); + var res: bool = any(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_e755c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_e755c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_e755c1(); +} diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..11aa9b36c5 --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void any_e755c1() { + bool3 arg_0 = (true).xxx; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_e755c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_e755c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_e755c1(); + return; +} diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11aa9b36c5 --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void any_e755c1() { + bool3 arg_0 = (true).xxx; + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + any_e755c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + any_e755c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + any_e755c1(); + return; +} diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl new file mode 100644 index 0000000000..37def14b1c --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void any_e755c1() { + bvec3 arg_0 = bvec3(true); + bool res = any(arg_0); +} + +vec4 vertex_main() { + any_e755c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void any_e755c1() { + bvec3 arg_0 = bvec3(true); + bool res = any(arg_0); +} + +void fragment_main() { + any_e755c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void any_e755c1() { + bvec3 arg_0 = bvec3(true); + bool res = any(arg_0); +} + +void compute_main() { + any_e755c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl new file mode 100644 index 0000000000..62caabf8c4 --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void any_e755c1() { + bool3 arg_0 = bool3(true); + bool res = any(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + any_e755c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + any_e755c1(); + return; +} + +kernel void compute_main() { + any_e755c1(); + return; +} + diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..033d47f5b4 --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %any_e755c1 "any_e755c1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %19 = OpConstantNull %v3bool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %any_e755c1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3bool Function %19 + %res = OpVariable %_ptr_Function_bool Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %v3bool %arg_0 + %20 = OpAny %bool %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %any_e755c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %any_e755c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %any_e755c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d532b5df7 --- /dev/null +++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn any_e755c1() { + var arg_0 = vec3(true); + var res : bool = any(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + any_e755c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + any_e755c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + any_e755c1(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl new file mode 100644 index 0000000000..66f7357ede --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_1588cd() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_1588cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_1588cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_1588cd(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fabbad5078 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_1588cd() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_1588cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_1588cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_1588cd(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fabbad5078 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_1588cd() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_1588cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_1588cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_1588cd(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl new file mode 100644 index 0000000000..a143e1835e --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + int arg_0[]; +} sb_ro; +void arrayLength_1588cd() { + uint res = uint(sb_ro.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_1588cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 1, std430) buffer SB_RO_1 { + int arg_0[]; +} sb_ro; +void arrayLength_1588cd() { + uint res = uint(sb_ro.arg_0.length()); +} + +void fragment_main() { + arrayLength_1588cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + int arg_0[]; +} sb_ro; +void arrayLength_1588cd() { + uint res = uint(sb_ro.arg_0.length()); +} + +void compute_main() { + arrayLength_1588cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl new file mode 100644 index 0000000000..8f9b20980c --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RO { + tint_array arg_0; +}; + +void arrayLength_1588cd(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_1588cd(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_1588cd(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_1588cd(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..40b7f6e6d2 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RO "SB_RO" + OpMemberName %SB_RO 0 "arg_0" + OpName %sb_ro "sb_ro" + OpName %arrayLength_1588cd "arrayLength_1588cd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RO Block + OpMemberDecorate %SB_RO 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %sb_ro NonWritable + OpDecorate %sb_ro DescriptorSet 0 + OpDecorate %sb_ro Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SB_RO = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO + %sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %22 = OpConstantNull %uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_1588cd = OpFunction %void None %14 + %17 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %22 + %18 = OpArrayLength %uint %sb_ro 0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %arrayLength_1588cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %14 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %14 + %32 = OpLabel + %33 = OpFunctionCall %void %arrayLength_1588cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpFunctionCall %void %arrayLength_1588cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..8b3b166c5c --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RO { + arg_0 : array, +} + +@group(0) @binding(1) var sb_ro : SB_RO; + +fn arrayLength_1588cd() { + var res : u32 = arrayLength(&(sb_ro.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_1588cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_1588cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_1588cd(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl new file mode 100644 index 0000000000..1c2902abc4 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_61b1c7() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_61b1c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_61b1c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_61b1c7(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ba47339e36 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_61b1c7() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_61b1c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_61b1c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_61b1c7(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba47339e36 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_61b1c7() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_61b1c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_61b1c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_61b1c7(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl new file mode 100644 index 0000000000..46667de5c6 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0[]; +} sb_rw; +void arrayLength_61b1c7() { + uint res = uint(sb_rw.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_61b1c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0[]; +} sb_rw; +void arrayLength_61b1c7() { + uint res = uint(sb_rw.arg_0.length()); +} + +void fragment_main() { + arrayLength_61b1c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0[]; +} sb_rw; +void arrayLength_61b1c7() { + uint res = uint(sb_rw.arg_0.length()); +} + +void compute_main() { + arrayLength_61b1c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl new file mode 100644 index 0000000000..a0b71875e3 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RW { + tint_array arg_0; +}; + +void arrayLength_61b1c7(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_61b1c7(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_61b1c7(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_61b1c7(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..482bb98d32 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %arrayLength_61b1c7 "arrayLength_61b1c7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SB_RW = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %22 = OpConstantNull %uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_61b1c7 = OpFunction %void None %14 + %17 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %22 + %18 = OpArrayLength %uint %sb_rw 0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %arrayLength_61b1c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %14 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %14 + %32 = OpLabel + %33 = OpFunctionCall %void %arrayLength_61b1c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpFunctionCall %void %arrayLength_61b1c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9b63ee4ad --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RW { + arg_0 : array, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn arrayLength_61b1c7() { + var res : u32 = arrayLength(&(sb_rw.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_61b1c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_61b1c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_61b1c7(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl new file mode 100644 index 0000000000..0a049481b3 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl @@ -0,0 +1,49 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_8421b9() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_8421b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_8421b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_8421b9(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.glsl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.glsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.msl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.msl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.spvasm @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..58ecc49e88 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/8421b9.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/8421b9.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RO { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RO { +^^^^^^ + +gen/var/arrayLength/8421b9.wgsl:28:42 note: see declaration of variable +@group(0) @binding(1) var sb_ro : SB_RO; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl new file mode 100644 index 0000000000..e6d4863d57 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_a0f5ca() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_a0f5ca(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_a0f5ca(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_a0f5ca(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cee7ff20e5 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_a0f5ca() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_a0f5ca(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_a0f5ca(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_a0f5ca(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cee7ff20e5 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_a0f5ca() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_a0f5ca(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_a0f5ca(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_a0f5ca(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl new file mode 100644 index 0000000000..44aaf23ebf --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + float arg_0[]; +} sb_ro; +void arrayLength_a0f5ca() { + uint res = uint(sb_ro.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_a0f5ca(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 1, std430) buffer SB_RO_1 { + float arg_0[]; +} sb_ro; +void arrayLength_a0f5ca() { + uint res = uint(sb_ro.arg_0.length()); +} + +void fragment_main() { + arrayLength_a0f5ca(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + float arg_0[]; +} sb_ro; +void arrayLength_a0f5ca() { + uint res = uint(sb_ro.arg_0.length()); +} + +void compute_main() { + arrayLength_a0f5ca(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl new file mode 100644 index 0000000000..b0aba71531 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RO { + tint_array arg_0; +}; + +void arrayLength_a0f5ca(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_a0f5ca(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_a0f5ca(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_a0f5ca(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm new file mode 100644 index 0000000000..0af5f92524 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RO "SB_RO" + OpMemberName %SB_RO 0 "arg_0" + OpName %sb_ro "sb_ro" + OpName %arrayLength_a0f5ca "arrayLength_a0f5ca" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RO Block + OpMemberDecorate %SB_RO 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %sb_ro NonWritable + OpDecorate %sb_ro DescriptorSet 0 + OpDecorate %sb_ro Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 +%_runtimearr_float = OpTypeRuntimeArray %float + %SB_RO = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO + %sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_a0f5ca = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %21 + %17 = OpArrayLength %uint %sb_ro 0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %arrayLength_a0f5ca + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %arrayLength_a0f5ca + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %arrayLength_a0f5ca + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa60a15aab --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RO { + arg_0 : array, +} + +@group(0) @binding(1) var sb_ro : SB_RO; + +fn arrayLength_a0f5ca() { + var res : u32 = arrayLength(&(sb_ro.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_a0f5ca(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_a0f5ca(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_a0f5ca(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl new file mode 100644 index 0000000000..e457a8a489 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl @@ -0,0 +1,49 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_cbd6b5() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cbd6b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cbd6b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cbd6b5(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.glsl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.glsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.msl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.msl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.spvasm @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..07baca0c0d --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cbd6b5.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +gen/var/arrayLength/cbd6b5.wgsl:26:10 error: using f16 types in 'storage' storage class is not implemented yet + arg_0: array, + ^^^^^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:25:1 note: see layout of struct: +/* align(2) size(2) */ struct SB_RW { +/* offset(0) align(2) size(2) */ arg_0 : array; +/* */ }; +struct SB_RW { +^^^^^^ + +gen/var/arrayLength/cbd6b5.wgsl:28:48 note: see declaration of variable +@group(0) @binding(0) var sb_rw : SB_RW; + ^^^^^ + diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl new file mode 100644 index 0000000000..c524ff6b4a --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_cdd123() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cdd123(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cdd123(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cdd123(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2156844065 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_cdd123() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cdd123(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cdd123(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cdd123(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2156844065 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_cdd123() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cdd123(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cdd123(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cdd123(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl new file mode 100644 index 0000000000..dac4336dee --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + float arg_0[]; +} sb_rw; +void arrayLength_cdd123() { + uint res = uint(sb_rw.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_cdd123(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 0, std430) buffer SB_RW_1 { + float arg_0[]; +} sb_rw; +void arrayLength_cdd123() { + uint res = uint(sb_rw.arg_0.length()); +} + +void fragment_main() { + arrayLength_cdd123(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + float arg_0[]; +} sb_rw; +void arrayLength_cdd123() { + uint res = uint(sb_rw.arg_0.length()); +} + +void compute_main() { + arrayLength_cdd123(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl new file mode 100644 index 0000000000..b7fe50be17 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RW { + tint_array arg_0; +}; + +void arrayLength_cdd123(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_cdd123(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_cdd123(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_cdd123(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm new file mode 100644 index 0000000000..46447961c2 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %arrayLength_cdd123 "arrayLength_cdd123" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 +%_runtimearr_float = OpTypeRuntimeArray %float + %SB_RW = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_cdd123 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %21 + %17 = OpArrayLength %uint %sb_rw 0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %arrayLength_cdd123 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %arrayLength_cdd123 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %arrayLength_cdd123 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl new file mode 100644 index 0000000000..d792619112 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RW { + arg_0 : array, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn arrayLength_cdd123() { + var res : u32 = arrayLength(&(sb_rw.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cdd123(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cdd123(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cdd123(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl new file mode 100644 index 0000000000..9581e2e47c --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RO { + arg_0: array, +}; +@group(0) @binding(1) var sb_ro : SB_RO; + +// fn arrayLength(ptr, read>) -> u32 +fn arrayLength_cfca0a() { + var res: u32 = arrayLength(&sb_ro.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cfca0a(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cfca0a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cfca0a(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6cf72ccdb --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_cfca0a() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cfca0a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cfca0a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cfca0a(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6cf72ccdb --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +ByteAddressBuffer sb_ro : register(t1, space0); + +void arrayLength_cfca0a() { + uint tint_symbol_2 = 0u; + sb_ro.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_cfca0a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_cfca0a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_cfca0a(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl new file mode 100644 index 0000000000..e159befc7e --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + uint arg_0[]; +} sb_ro; +void arrayLength_cfca0a() { + uint res = uint(sb_ro.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_cfca0a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 1, std430) buffer SB_RO_1 { + uint arg_0[]; +} sb_ro; +void arrayLength_cfca0a() { + uint res = uint(sb_ro.arg_0.length()); +} + +void fragment_main() { + arrayLength_cfca0a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 1, std430) buffer SB_RO_1 { + uint arg_0[]; +} sb_ro; +void arrayLength_cfca0a() { + uint res = uint(sb_ro.arg_0.length()); +} + +void compute_main() { + arrayLength_cfca0a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl new file mode 100644 index 0000000000..f62106e376 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RO { + tint_array arg_0; +}; + +void arrayLength_cfca0a(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_cfca0a(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_cfca0a(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_cfca0a(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm new file mode 100644 index 0000000000..db230e90cd --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RO "SB_RO" + OpMemberName %SB_RO 0 "arg_0" + OpName %sb_ro "sb_ro" + OpName %arrayLength_cfca0a "arrayLength_cfca0a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RO Block + OpMemberDecorate %SB_RO 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %sb_ro NonWritable + OpDecorate %sb_ro DescriptorSet 0 + OpDecorate %sb_ro Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SB_RO = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO + %sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_cfca0a = OpFunction %void None %14 + %17 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %21 + %18 = OpArrayLength %uint %sb_ro 0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %arrayLength_cfca0a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %14 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %14 + %31 = OpLabel + %32 = OpFunctionCall %void %arrayLength_cfca0a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %14 + %34 = OpLabel + %35 = OpFunctionCall %void %arrayLength_cfca0a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl new file mode 100644 index 0000000000..d741ef0924 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RO { + arg_0 : array, +} + +@group(0) @binding(1) var sb_ro : SB_RO; + +fn arrayLength_cfca0a() { + var res : u32 = arrayLength(&(sb_ro.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_cfca0a(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_cfca0a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_cfca0a(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl new file mode 100644 index 0000000000..5c2eca0aa4 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: array, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn arrayLength(ptr, read_write>) -> u32 +fn arrayLength_eb510f() { + var res: u32 = arrayLength(&sb_rw.arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_eb510f(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_eb510f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_eb510f(); +} diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b05a0fc83 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_eb510f() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_eb510f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_eb510f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_eb510f(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b05a0fc83 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void arrayLength_eb510f() { + uint tint_symbol_2 = 0u; + sb_rw.GetDimensions(tint_symbol_2); + const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u); + uint res = tint_symbol_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + arrayLength_eb510f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + arrayLength_eb510f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + arrayLength_eb510f(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl new file mode 100644 index 0000000000..a11f1aa674 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0[]; +} sb_rw; +void arrayLength_eb510f() { + uint res = uint(sb_rw.arg_0.length()); +} + +vec4 vertex_main() { + arrayLength_eb510f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0[]; +} sb_rw; +void arrayLength_eb510f() { + uint res = uint(sb_rw.arg_0.length()); +} + +void fragment_main() { + arrayLength_eb510f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0[]; +} sb_rw; +void arrayLength_eb510f() { + uint res = uint(sb_rw.arg_0.length()); +} + +void compute_main() { + arrayLength_eb510f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl new file mode 100644 index 0000000000..05c3bc9710 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + /* 0x0000 */ tint_array buffer_size; +}; + +struct SB_RW { + tint_array arg_0; +}; + +void arrayLength_eb510f(const constant tint_symbol_1* const tint_symbol_3) { + uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) { + arrayLength_eb510f(tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) { + arrayLength_eb510f(tint_symbol_6); + return; +} + +kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) { + arrayLength_eb510f(tint_symbol_7); + return; +} + diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm new file mode 100644 index 0000000000..b165c3fbc0 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %arrayLength_eb510f "arrayLength_eb510f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SB_RW = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%arrayLength_eb510f = OpFunction %void None %14 + %17 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %21 + %18 = OpArrayLength %uint %sb_rw 0 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %arrayLength_eb510f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %14 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %14 + %31 = OpLabel + %32 = OpFunctionCall %void %arrayLength_eb510f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %14 + %34 = OpLabel + %35 = OpFunctionCall %void %arrayLength_eb510f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl new file mode 100644 index 0000000000..a048944656 --- /dev/null +++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +struct SB_RW { + arg_0 : array, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn arrayLength_eb510f() { + var res : u32 = arrayLength(&(sb_rw.arg_0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + arrayLength_eb510f(); + return vec4(); +} + +@fragment +fn fragment_main() { + arrayLength_eb510f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + arrayLength_eb510f(); +} diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl b/test/tint/builtins/gen/var/asin/064953.wgsl new file mode 100644 index 0000000000..dc35b202bd --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(vec<4, f32>) -> vec<4, f32> +fn asin_064953() { + var arg_0 = vec4(1.f); + var res: vec4 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_064953(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_064953(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_064953(); +} diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..932c5da428 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_064953() { + float4 arg_0 = (1.0f).xxxx; + float4 res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_064953(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_064953(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_064953(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..932c5da428 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void asin_064953() { + float4 arg_0 = (1.0f).xxxx; + float4 res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_064953(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_064953(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_064953(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl new file mode 100644 index 0000000000..26c0c37a14 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asin_064953() { + vec4 arg_0 = vec4(1.0f); + vec4 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_064953(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_064953() { + vec4 arg_0 = vec4(1.0f); + vec4 res = asin(arg_0); +} + +void fragment_main() { + asin_064953(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_064953() { + vec4 arg_0 = vec4(1.0f); + vec4 res = asin(arg_0); +} + +void compute_main() { + asin_064953(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl new file mode 100644 index 0000000000..481b8b1d6e --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_064953() { + float4 arg_0 = float4(1.0f); + float4 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_064953(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_064953(); + return; +} + +kernel void compute_main() { + asin_064953(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm new file mode 100644 index 0000000000..d5813cdc79 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_064953 "asin_064953" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%asin_064953 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Asin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asin_064953 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asin_064953 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asin_064953 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl new file mode 100644 index 0000000000..205c94de61 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asin_064953() { + var arg_0 = vec4(1.0f); + var res : vec4 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_064953(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_064953(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_064953(); +} diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl new file mode 100644 index 0000000000..c9b250607d --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(f16) -> f16 +fn asin_11dfda() { + var arg_0 = f16(); + var res: f16 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_11dfda(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_11dfda(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_11dfda(); +} diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..10ac617a2f --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_11dfda() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_11dfda(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_11dfda(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..806254cdc3 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void asin_11dfda() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_11dfda(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_11dfda(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D54DD58900(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D54DD58900(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.glsl new file mode 100644 index 0000000000..948c08d4ad --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_11dfda() { + float16_t arg_0 = 0.0hf; + float16_t res = asin(arg_0); +} + +vec4 vertex_main() { + asin_11dfda(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_11dfda() { + float16_t arg_0 = 0.0hf; + float16_t res = asin(arg_0); +} + +void fragment_main() { + asin_11dfda(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_11dfda() { + float16_t arg_0 = 0.0hf; + float16_t res = asin(arg_0); +} + +void compute_main() { + asin_11dfda(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.msl new file mode 100644 index 0000000000..f59c879943 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_11dfda() { + half arg_0 = 0.0h; + half res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_11dfda(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_11dfda(); + return; +} + +kernel void compute_main() { + asin_11dfda(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e6097a9a1 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_11dfda "asin_11dfda" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_11dfda = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Asin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asin_11dfda + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %asin_11dfda + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %asin_11dfda + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.wgsl new file mode 100644 index 0000000000..abe2463306 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/11dfda.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asin_11dfda() { + var arg_0 = f16(); + var res : f16 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_11dfda(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_11dfda(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_11dfda(); +} diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl new file mode 100644 index 0000000000..fdf613e9a5 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<3, f16>) -> vec<3, f16> +fn asin_2d8e29() { + var arg_0 = vec3(f16()); + var res: vec3 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_2d8e29(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_2d8e29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_2d8e29(); +} diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c22612734 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_2d8e29() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_2d8e29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_2d8e29(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c95a38dc01 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void asin_2d8e29() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_2d8e29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_2d8e29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000243E5218C90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000243E5218C90(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.glsl new file mode 100644 index 0000000000..e5c01aeb73 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_2d8e29() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_2d8e29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_2d8e29() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asin(arg_0); +} + +void fragment_main() { + asin_2d8e29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_2d8e29() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asin(arg_0); +} + +void compute_main() { + asin_2d8e29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.msl new file mode 100644 index 0000000000..efafdf5cb7 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_2d8e29() { + half3 arg_0 = half3(0.0h); + half3 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_2d8e29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_2d8e29(); + return; +} + +kernel void compute_main() { + asin_2d8e29(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.spvasm new file mode 100644 index 0000000000..292429ed07 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_2d8e29 "asin_2d8e29" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_2d8e29 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Asin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asin_2d8e29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_2d8e29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asin_2d8e29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.wgsl new file mode 100644 index 0000000000..c93cae1f51 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/2d8e29.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asin_2d8e29() { + var arg_0 = vec3(f16()); + var res : vec3 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_2d8e29(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_2d8e29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_2d8e29(); +} diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl new file mode 100644 index 0000000000..022f69af8e --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<4, f16>) -> vec<4, f16> +fn asin_3cfbd4() { + var arg_0 = vec4(f16()); + var res: vec4 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_3cfbd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_3cfbd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_3cfbd4(); +} diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a35655859b --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_3cfbd4() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_3cfbd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_3cfbd4(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16015bbb6b --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void asin_3cfbd4() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_3cfbd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_3cfbd4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019720581EE0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019720581EE0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.glsl new file mode 100644 index 0000000000..35f9bd9cea --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_3cfbd4() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_3cfbd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_3cfbd4() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asin(arg_0); +} + +void fragment_main() { + asin_3cfbd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_3cfbd4() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asin(arg_0); +} + +void compute_main() { + asin_3cfbd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.msl new file mode 100644 index 0000000000..394f485044 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_3cfbd4() { + half4 arg_0 = half4(0.0h); + half4 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_3cfbd4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_3cfbd4(); + return; +} + +kernel void compute_main() { + asin_3cfbd4(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..35e557c51a --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_3cfbd4 "asin_3cfbd4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_3cfbd4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Asin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asin_3cfbd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_3cfbd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asin_3cfbd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..91e42c6252 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/3cfbd4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asin_3cfbd4() { + var arg_0 = vec4(f16()); + var res : vec4 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_3cfbd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_3cfbd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_3cfbd4(); +} diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl new file mode 100644 index 0000000000..5c7a496c5c --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(vec<2, f32>) -> vec<2, f32> +fn asin_7b6a44() { + var arg_0 = vec2(1.f); + var res: vec2 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_7b6a44(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_7b6a44(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_7b6a44(); +} diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2491ebdaf6 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_7b6a44() { + float2 arg_0 = (1.0f).xx; + float2 res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_7b6a44(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_7b6a44(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_7b6a44(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2491ebdaf6 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void asin_7b6a44() { + float2 arg_0 = (1.0f).xx; + float2 res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_7b6a44(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_7b6a44(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_7b6a44(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl new file mode 100644 index 0000000000..0604e88c9d --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asin_7b6a44() { + vec2 arg_0 = vec2(1.0f); + vec2 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_7b6a44(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_7b6a44() { + vec2 arg_0 = vec2(1.0f); + vec2 res = asin(arg_0); +} + +void fragment_main() { + asin_7b6a44(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_7b6a44() { + vec2 arg_0 = vec2(1.0f); + vec2 res = asin(arg_0); +} + +void compute_main() { + asin_7b6a44(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl new file mode 100644 index 0000000000..37b62137cc --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_7b6a44() { + float2 arg_0 = float2(1.0f); + float2 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_7b6a44(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_7b6a44(); + return; +} + +kernel void compute_main() { + asin_7b6a44(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm new file mode 100644 index 0000000000..21aa1abc7d --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_7b6a44 "asin_7b6a44" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%asin_7b6a44 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Asin %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %asin_7b6a44 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_7b6a44 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asin_7b6a44 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl new file mode 100644 index 0000000000..4f0c2fd816 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asin_7b6a44() { + var arg_0 = vec2(1.0f); + var res : vec2 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_7b6a44(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_7b6a44(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_7b6a44(); +} diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl new file mode 100644 index 0000000000..6460397a04 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(vec<3, f32>) -> vec<3, f32> +fn asin_8cd9c9() { + var arg_0 = vec3(1.f); + var res: vec3 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_8cd9c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_8cd9c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_8cd9c9(); +} diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..96d0acac1c --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_8cd9c9() { + float3 arg_0 = (1.0f).xxx; + float3 res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_8cd9c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_8cd9c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_8cd9c9(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..96d0acac1c --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void asin_8cd9c9() { + float3 arg_0 = (1.0f).xxx; + float3 res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_8cd9c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_8cd9c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_8cd9c9(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl new file mode 100644 index 0000000000..95a2e1c272 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asin_8cd9c9() { + vec3 arg_0 = vec3(1.0f); + vec3 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_8cd9c9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_8cd9c9() { + vec3 arg_0 = vec3(1.0f); + vec3 res = asin(arg_0); +} + +void fragment_main() { + asin_8cd9c9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_8cd9c9() { + vec3 arg_0 = vec3(1.0f); + vec3 res = asin(arg_0); +} + +void compute_main() { + asin_8cd9c9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl new file mode 100644 index 0000000000..8ff1ba728a --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_8cd9c9() { + float3 arg_0 = float3(1.0f); + float3 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_8cd9c9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_8cd9c9(); + return; +} + +kernel void compute_main() { + asin_8cd9c9(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm new file mode 100644 index 0000000000..734c4e8b6e --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_8cd9c9 "asin_8cd9c9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%asin_8cd9c9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Asin %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %asin_8cd9c9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_8cd9c9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asin_8cd9c9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl new file mode 100644 index 0000000000..db757e53ba --- /dev/null +++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asin_8cd9c9() { + var arg_0 = vec3(1.0f); + var res : vec3 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_8cd9c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_8cd9c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_8cd9c9(); +} diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl new file mode 100644 index 0000000000..f69143a4e7 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asin(vec<2, f16>) -> vec<2, f16> +fn asin_b4aced() { + var arg_0 = vec2(f16()); + var res: vec2 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_b4aced(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_b4aced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_b4aced(); +} diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d0043aaf2 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_b4aced() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_b4aced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_b4aced(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..729a746438 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void asin_b4aced() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_b4aced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_b4aced(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000274BBD1CA00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000274BBD1CA00(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.glsl new file mode 100644 index 0000000000..65fdee3486 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_b4aced() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asin(arg_0); +} + +vec4 vertex_main() { + asin_b4aced(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asin_b4aced() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asin(arg_0); +} + +void fragment_main() { + asin_b4aced(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asin_b4aced() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asin(arg_0); +} + +void compute_main() { + asin_b4aced(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.msl new file mode 100644 index 0000000000..c2bab896df --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_b4aced() { + half2 arg_0 = half2(0.0h); + half2 res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_b4aced(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_b4aced(); + return; +} + +kernel void compute_main() { + asin_b4aced(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.spvasm new file mode 100644 index 0000000000..b11a78292a --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_b4aced "asin_b4aced" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asin_b4aced = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Asin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asin_b4aced + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_b4aced + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asin_b4aced + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.wgsl new file mode 100644 index 0000000000..056003b5d9 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/b4aced.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asin_b4aced() { + var arg_0 = vec2(f16()); + var res : vec2 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_b4aced(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_b4aced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_b4aced(); +} diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl new file mode 100644 index 0000000000..3c73f52505 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asin(f32) -> f32 +fn asin_c0c272() { + var arg_0 = 1.f; + var res: f32 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_c0c272(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_c0c272(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_c0c272(); +} diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad66315d46 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_c0c272(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_c0c272(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_c0c272(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad66315d46 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asin_c0c272(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asin_c0c272(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asin_c0c272(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl new file mode 100644 index 0000000000..9869bdbc05 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +vec4 vertex_main() { + asin_c0c272(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +void fragment_main() { + asin_c0c272(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +void compute_main() { + asin_c0c272(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl new file mode 100644 index 0000000000..c8dc4da358 --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asin_c0c272() { + float arg_0 = 1.0f; + float res = asin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asin_c0c272(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asin_c0c272(); + return; +} + +kernel void compute_main() { + asin_c0c272(); + return; +} + diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm new file mode 100644 index 0000000000..6ee3f4a9cb --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asin_c0c272 "asin_c0c272" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%asin_c0c272 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Asin %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asin_c0c272 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %asin_c0c272 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asin_c0c272 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl new file mode 100644 index 0000000000..c9af00fcff --- /dev/null +++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asin_c0c272() { + var arg_0 = 1.0f; + var res : f32 = asin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asin_c0c272(); + return vec4(); +} + +@fragment +fn fragment_main() { + asin_c0c272(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asin_c0c272(); +} diff --git a/test/tint/builtins/gen/var/asinh/157447.wgsl b/test/tint/builtins/gen/var/asinh/157447.wgsl new file mode 100644 index 0000000000..607689fa50 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/157447.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asinh(f32) -> f32 +fn asinh_157447() { + var arg_0 = 1.f; + var res: f32 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_157447(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_157447(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_157447(); +} diff --git a/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a439a80897 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float tint_sinh(float x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_157447() { + float arg_0 = 1.0f; + float res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_157447(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_157447(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_157447(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a439a80897 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float tint_sinh(float x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_157447() { + float arg_0 = 1.0f; + float res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_157447(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_157447(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_157447(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.glsl new file mode 100644 index 0000000000..80bac645e9 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asinh_157447() { + float arg_0 = 1.0f; + float res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_157447(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asinh_157447() { + float arg_0 = 1.0f; + float res = asinh(arg_0); +} + +void fragment_main() { + asinh_157447(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asinh_157447() { + float arg_0 = 1.0f; + float res = asinh(arg_0); +} + +void compute_main() { + asinh_157447(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.msl new file mode 100644 index 0000000000..d7a90ee17f --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_157447() { + float arg_0 = 1.0f; + float res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_157447(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_157447(); + return; +} + +kernel void compute_main() { + asinh_157447(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.spvasm new file mode 100644 index 0000000000..57a3ce4b96 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_157447 "asinh_157447" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%asinh_157447 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Asinh %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %asinh_157447 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %asinh_157447 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_157447 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba5660d7ce --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/157447.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asinh_157447() { + var arg_0 = 1.0f; + var res : f32 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_157447(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_157447(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_157447(); +} diff --git a/test/tint/builtins/gen/var/asinh/2265ee.wgsl b/test/tint/builtins/gen/var/asinh/2265ee.wgsl new file mode 100644 index 0000000000..245a89e139 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/2265ee.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asinh(vec<3, f32>) -> vec<3, f32> +fn asinh_2265ee() { + var arg_0 = vec3(1.f); + var res: vec3 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_2265ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_2265ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_2265ee(); +} diff --git a/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2e876fa737 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_sinh(float3 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_2265ee() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_2265ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_2265ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_2265ee(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e876fa737 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_sinh(float3 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_2265ee() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_2265ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_2265ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_2265ee(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.glsl new file mode 100644 index 0000000000..b9ed885987 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asinh_2265ee() { + vec3 arg_0 = vec3(1.0f); + vec3 res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_2265ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asinh_2265ee() { + vec3 arg_0 = vec3(1.0f); + vec3 res = asinh(arg_0); +} + +void fragment_main() { + asinh_2265ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asinh_2265ee() { + vec3 arg_0 = vec3(1.0f); + vec3 res = asinh(arg_0); +} + +void compute_main() { + asinh_2265ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.msl new file mode 100644 index 0000000000..30f2f78bf1 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_2265ee() { + float3 arg_0 = float3(1.0f); + float3 res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_2265ee(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_2265ee(); + return; +} + +kernel void compute_main() { + asinh_2265ee(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..96b36e62e5 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_2265ee "asinh_2265ee" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%asinh_2265ee = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Asinh %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %asinh_2265ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_2265ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asinh_2265ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..60d90c523d --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/2265ee.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asinh_2265ee() { + var arg_0 = vec3(1.0f); + var res : vec3 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_2265ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_2265ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_2265ee(); +} diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl new file mode 100644 index 0000000000..6a2992f3c6 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(f16) -> f16 +fn asinh_468a48() { + var arg_0 = f16(); + var res: f16 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_468a48(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_468a48(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_468a48(); +} diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bdeb8b8e75 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_sinh(float16_t x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_468a48() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_468a48(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_468a48(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dcbf45070a --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_sinh(float16_t x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_468a48() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_468a48(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_468a48(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002776ED11E20(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.glsl new file mode 100644 index 0000000000..70eee10d64 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_468a48() { + float16_t arg_0 = 0.0hf; + float16_t res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_468a48(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_468a48() { + float16_t arg_0 = 0.0hf; + float16_t res = asinh(arg_0); +} + +void fragment_main() { + asinh_468a48(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_468a48() { + float16_t arg_0 = 0.0hf; + float16_t res = asinh(arg_0); +} + +void compute_main() { + asinh_468a48(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.msl new file mode 100644 index 0000000000..22a59d4014 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_468a48() { + half arg_0 = 0.0h; + half res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_468a48(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_468a48(); + return; +} + +kernel void compute_main() { + asinh_468a48(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.spvasm new file mode 100644 index 0000000000..93c8f5ac26 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_468a48 "asinh_468a48" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_468a48 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Asinh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asinh_468a48 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %asinh_468a48 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %asinh_468a48 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.wgsl new file mode 100644 index 0000000000..b8b458cd20 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/468a48.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asinh_468a48() { + var arg_0 = f16(); + var res : f16 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_468a48(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_468a48(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_468a48(); +} diff --git a/test/tint/builtins/gen/var/asinh/4a2226.wgsl b/test/tint/builtins/gen/var/asinh/4a2226.wgsl new file mode 100644 index 0000000000..c59d2ec4b2 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/4a2226.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asinh(vec<2, f32>) -> vec<2, f32> +fn asinh_4a2226() { + var arg_0 = vec2(1.f); + var res: vec2 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_4a2226(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_4a2226(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_4a2226(); +} diff --git a/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5c1e542b90 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_sinh(float2 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_4a2226() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_4a2226(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_4a2226(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_4a2226(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5c1e542b90 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_sinh(float2 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_4a2226() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_4a2226(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_4a2226(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_4a2226(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.glsl new file mode 100644 index 0000000000..3b555dd85e --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asinh_4a2226() { + vec2 arg_0 = vec2(1.0f); + vec2 res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_4a2226(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asinh_4a2226() { + vec2 arg_0 = vec2(1.0f); + vec2 res = asinh(arg_0); +} + +void fragment_main() { + asinh_4a2226(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asinh_4a2226() { + vec2 arg_0 = vec2(1.0f); + vec2 res = asinh(arg_0); +} + +void compute_main() { + asinh_4a2226(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.msl new file mode 100644 index 0000000000..ebfb3267f6 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_4a2226() { + float2 arg_0 = float2(1.0f); + float2 res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_4a2226(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_4a2226(); + return; +} + +kernel void compute_main() { + asinh_4a2226(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.spvasm new file mode 100644 index 0000000000..49303738f3 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_4a2226 "asinh_4a2226" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%asinh_4a2226 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Asinh %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %asinh_4a2226 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_4a2226 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asinh_4a2226 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.wgsl new file mode 100644 index 0000000000..be7f9d4a3e --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/4a2226.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asinh_4a2226() { + var arg_0 = vec2(1.0f); + var res : vec2 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_4a2226(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_4a2226(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_4a2226(); +} diff --git a/test/tint/builtins/gen/var/asinh/8d2e51.wgsl b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl new file mode 100644 index 0000000000..2683f52fcf --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn asinh(vec<4, f32>) -> vec<4, f32> +fn asinh_8d2e51() { + var arg_0 = vec4(1.f); + var res: vec4 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_8d2e51(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_8d2e51(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_8d2e51(); +} diff --git a/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f0ec74af92 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_sinh(float4 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_8d2e51() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_8d2e51(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_8d2e51(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_8d2e51(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0ec74af92 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_sinh(float4 x) { + return log((x + sqrt(((x * x) + 1.0f)))); +} + +void asinh_8d2e51() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_8d2e51(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_8d2e51(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_8d2e51(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.glsl new file mode 100644 index 0000000000..0cdcad1ae5 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void asinh_8d2e51() { + vec4 arg_0 = vec4(1.0f); + vec4 res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_8d2e51(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void asinh_8d2e51() { + vec4 arg_0 = vec4(1.0f); + vec4 res = asinh(arg_0); +} + +void fragment_main() { + asinh_8d2e51(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void asinh_8d2e51() { + vec4 arg_0 = vec4(1.0f); + vec4 res = asinh(arg_0); +} + +void compute_main() { + asinh_8d2e51(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.msl new file mode 100644 index 0000000000..9a20b10ffb --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_8d2e51() { + float4 arg_0 = float4(1.0f); + float4 res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_8d2e51(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_8d2e51(); + return; +} + +kernel void compute_main() { + asinh_8d2e51(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4d1182eff --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_8d2e51 "asinh_8d2e51" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%asinh_8d2e51 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Asinh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %asinh_8d2e51 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %asinh_8d2e51 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %asinh_8d2e51 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.wgsl new file mode 100644 index 0000000000..865abf72ea --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/8d2e51.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn asinh_8d2e51() { + var arg_0 = vec4(1.0f); + var res : vec4 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_8d2e51(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_8d2e51(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_8d2e51(); +} diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl new file mode 100644 index 0000000000..1c734788da --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<4, f16>) -> vec<4, f16> +fn asinh_95ab2b() { + var arg_0 = vec4(f16()); + var res: vec4 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_95ab2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_95ab2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_95ab2b(); +} diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bbbe9f7650 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_95ab2b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_95ab2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_95ab2b(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60b07b0416 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_95ab2b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_95ab2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_95ab2b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002E3B2D56BD0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.glsl new file mode 100644 index 0000000000..ec6f916dc7 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_95ab2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_95ab2b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_95ab2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asinh(arg_0); +} + +void fragment_main() { + asinh_95ab2b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_95ab2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = asinh(arg_0); +} + +void compute_main() { + asinh_95ab2b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.msl new file mode 100644 index 0000000000..ab992468c6 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_95ab2b() { + half4 arg_0 = half4(0.0h); + half4 res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_95ab2b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_95ab2b(); + return; +} + +kernel void compute_main() { + asinh_95ab2b(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbaf25c23a --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_95ab2b "asinh_95ab2b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_95ab2b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Asinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asinh_95ab2b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_95ab2b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asinh_95ab2b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.wgsl new file mode 100644 index 0000000000..882f15d022 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/95ab2b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asinh_95ab2b() { + var arg_0 = vec4(f16()); + var res : vec4 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_95ab2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_95ab2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_95ab2b(); +} diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl new file mode 100644 index 0000000000..6cc709d6f5 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<2, f16>) -> vec<2, f16> +fn asinh_ad8f8b() { + var arg_0 = vec2(f16()); + var res: vec2 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_ad8f8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_ad8f8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_ad8f8b(); +} diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..68d01e676e --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_ad8f8b() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_ad8f8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_ad8f8b(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2bec5b56fb --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_ad8f8b() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_ad8f8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_ad8f8b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8AF6F1580(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.glsl new file mode 100644 index 0000000000..2f66aaaab4 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_ad8f8b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_ad8f8b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_ad8f8b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asinh(arg_0); +} + +void fragment_main() { + asinh_ad8f8b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_ad8f8b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = asinh(arg_0); +} + +void compute_main() { + asinh_ad8f8b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.msl new file mode 100644 index 0000000000..4a6745f14c --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_ad8f8b() { + half2 arg_0 = half2(0.0h); + half2 res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_ad8f8b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_ad8f8b(); + return; +} + +kernel void compute_main() { + asinh_ad8f8b(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.spvasm new file mode 100644 index 0000000000..b41573f020 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_ad8f8b "asinh_ad8f8b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_ad8f8b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Asinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asinh_ad8f8b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_ad8f8b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asinh_ad8f8b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2a96fe6b11 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/ad8f8b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asinh_ad8f8b() { + var arg_0 = vec2(f16()); + var res : vec2 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_ad8f8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_ad8f8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_ad8f8b(); +} diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl new file mode 100644 index 0000000000..648ab732fb --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn asinh(vec<3, f16>) -> vec<3, f16> +fn asinh_fb5e8c() { + var arg_0 = vec3(f16()); + var res: vec3 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_fb5e8c(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_fb5e8c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_fb5e8c(); +} diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2e127aa9e2 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_fb5e8c() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_fb5e8c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_fb5e8c(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..75a4736351 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_sinh(vector x) { + return log((x + sqrt(((x * x) + float16_t(1.0h))))); +} + +void asinh_fb5e8c() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + asinh_fb5e8c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + asinh_fb5e8c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B966509E00(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.glsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.glsl new file mode 100644 index 0000000000..bb5859f703 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_fb5e8c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asinh(arg_0); +} + +vec4 vertex_main() { + asinh_fb5e8c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void asinh_fb5e8c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asinh(arg_0); +} + +void fragment_main() { + asinh_fb5e8c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void asinh_fb5e8c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = asinh(arg_0); +} + +void compute_main() { + asinh_fb5e8c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.msl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.msl new file mode 100644 index 0000000000..344f7c5eb7 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void asinh_fb5e8c() { + half3 arg_0 = half3(0.0h); + half3 res = asinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + asinh_fb5e8c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + asinh_fb5e8c(); + return; +} + +kernel void compute_main() { + asinh_fb5e8c(); + return; +} + diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.spvasm new file mode 100644 index 0000000000..63c34df8d9 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %asinh_fb5e8c "asinh_fb5e8c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%asinh_fb5e8c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Asinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %asinh_fb5e8c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %asinh_fb5e8c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %asinh_fb5e8c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.wgsl new file mode 100644 index 0000000000..c228108c10 --- /dev/null +++ b/test/tint/builtins/gen/var/asinh/fb5e8c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn asinh_fb5e8c() { + var arg_0 = vec3(f16()); + var res : vec3 = asinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + asinh_fb5e8c(); + return vec4(); +} + +@fragment +fn fragment_main() { + asinh_fb5e8c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + asinh_fb5e8c(); +} diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl b/test/tint/builtins/gen/var/atan/02979a.wgsl new file mode 100644 index 0000000000..f768b7c2da --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(f32) -> f32 +fn atan_02979a() { + var arg_0 = 1.f; + var res: f32 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_02979a(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_02979a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_02979a(); +} diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b78942c67 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_02979a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_02979a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_02979a(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b78942c67 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_02979a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_02979a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_02979a(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl new file mode 100644 index 0000000000..b228c08b1b --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +vec4 vertex_main() { + atan_02979a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +void fragment_main() { + atan_02979a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +void compute_main() { + atan_02979a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl new file mode 100644 index 0000000000..53002f43d1 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_02979a() { + float arg_0 = 1.0f; + float res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_02979a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_02979a(); + return; +} + +kernel void compute_main() { + atan_02979a(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm new file mode 100644 index 0000000000..b405e4a798 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_02979a "atan_02979a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%atan_02979a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Atan %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %atan_02979a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan_02979a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_02979a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl new file mode 100644 index 0000000000..b5dd9d01b5 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atan_02979a() { + var arg_0 = 1.0f; + var res : f32 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_02979a(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_02979a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_02979a(); +} diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl b/test/tint/builtins/gen/var/atan/19faea.wgsl new file mode 100644 index 0000000000..14c20e9ca8 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<4, f16>) -> vec<4, f16> +fn atan_19faea() { + var arg_0 = vec4(f16()); + var res: vec4 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_19faea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_19faea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_19faea(); +} diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..557db5849a --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_19faea() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_19faea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_19faea(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04ac231b6b --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void atan_19faea() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_19faea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_19faea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F5B44507F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F5B44507F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.glsl new file mode 100644 index 0000000000..46811fcf2d --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_19faea() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_19faea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_19faea() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0); +} + +void fragment_main() { + atan_19faea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_19faea() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0); +} + +void compute_main() { + atan_19faea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.msl new file mode 100644 index 0000000000..f8d735b3dd --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_19faea() { + half4 arg_0 = half4(0.0h); + half4 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_19faea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_19faea(); + return; +} + +kernel void compute_main() { + atan_19faea(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.spvasm new file mode 100644 index 0000000000..2daa3f6b0b --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_19faea "atan_19faea" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_19faea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Atan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %atan_19faea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_19faea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %atan_19faea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.wgsl new file mode 100644 index 0000000000..d93bec72a5 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/19faea.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atan_19faea() { + var arg_0 = vec4(f16()); + var res : vec4 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_19faea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_19faea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_19faea(); +} diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl new file mode 100644 index 0000000000..2f5d3b90dc --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<2, f16>) -> vec<2, f16> +fn atan_1e1764() { + var arg_0 = vec2(f16()); + var res: vec2 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_1e1764(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_1e1764(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_1e1764(); +} diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6cb0a491fb --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_1e1764() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_1e1764(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_1e1764(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1775ffff7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void atan_1e1764() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_1e1764(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_1e1764(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015CC8119100(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015CC8119100(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.glsl new file mode 100644 index 0000000000..8c16874da2 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_1e1764() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_1e1764(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_1e1764() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0); +} + +void fragment_main() { + atan_1e1764(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_1e1764() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0); +} + +void compute_main() { + atan_1e1764(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.msl new file mode 100644 index 0000000000..f7651c4178 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_1e1764() { + half2 arg_0 = half2(0.0h); + half2 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_1e1764(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_1e1764(); + return; +} + +kernel void compute_main() { + atan_1e1764(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a1b7de1c7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_1e1764 "atan_1e1764" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_1e1764 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Atan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %atan_1e1764 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_1e1764 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %atan_1e1764 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.wgsl new file mode 100644 index 0000000000..86ba26788d --- /dev/null +++ b/test/tint/builtins/gen/var/atan/1e1764.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atan_1e1764() { + var arg_0 = vec2(f16()); + var res : vec2 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_1e1764(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_1e1764(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_1e1764(); +} diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl new file mode 100644 index 0000000000..ebe857e657 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(vec<3, f32>) -> vec<3, f32> +fn atan_331e6d() { + var arg_0 = vec3(1.f); + var res: vec3 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_331e6d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_331e6d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_331e6d(); +} diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7ab750dd9a --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_331e6d() { + float3 arg_0 = (1.0f).xxx; + float3 res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_331e6d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_331e6d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_331e6d(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7ab750dd9a --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void atan_331e6d() { + float3 arg_0 = (1.0f).xxx; + float3 res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_331e6d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_331e6d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_331e6d(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl new file mode 100644 index 0000000000..b48d70d013 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void atan_331e6d() { + vec3 arg_0 = vec3(1.0f); + vec3 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_331e6d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_331e6d() { + vec3 arg_0 = vec3(1.0f); + vec3 res = atan(arg_0); +} + +void fragment_main() { + atan_331e6d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_331e6d() { + vec3 arg_0 = vec3(1.0f); + vec3 res = atan(arg_0); +} + +void compute_main() { + atan_331e6d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl new file mode 100644 index 0000000000..964c412f24 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_331e6d() { + float3 arg_0 = float3(1.0f); + float3 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_331e6d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_331e6d(); + return; +} + +kernel void compute_main() { + atan_331e6d(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfd498de56 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_331e6d "atan_331e6d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%atan_331e6d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Atan %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %atan_331e6d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_331e6d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %atan_331e6d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl new file mode 100644 index 0000000000..43496f2c56 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atan_331e6d() { + var arg_0 = vec3(1.0f); + var res : vec3 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_331e6d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_331e6d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_331e6d(); +} diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl new file mode 100644 index 0000000000..c76fe4ceee --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(vec<3, f16>) -> vec<3, f16> +fn atan_a5f421() { + var arg_0 = vec3(f16()); + var res: vec3 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a5f421(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a5f421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a5f421(); +} diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aca9149beb --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_a5f421() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a5f421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a5f421(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7eeb5025f7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void atan_a5f421() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a5f421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a5f421(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E218212B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E218212B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.glsl new file mode 100644 index 0000000000..e4a545a61a --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a5f421() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_a5f421(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_a5f421() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0); +} + +void fragment_main() { + atan_a5f421(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a5f421() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0); +} + +void compute_main() { + atan_a5f421(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.msl new file mode 100644 index 0000000000..800084d68e --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_a5f421() { + half3 arg_0 = half3(0.0h); + half3 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a5f421(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a5f421(); + return; +} + +kernel void compute_main() { + atan_a5f421(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.spvasm new file mode 100644 index 0000000000..c41d678766 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a5f421 "atan_a5f421" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_a5f421 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Atan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %atan_a5f421 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_a5f421 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %atan_a5f421 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.wgsl new file mode 100644 index 0000000000..48d261a315 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a5f421.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atan_a5f421() { + var arg_0 = vec3(f16()); + var res : vec3 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a5f421(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a5f421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a5f421(); +} diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl new file mode 100644 index 0000000000..a19eafc469 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan(f16) -> f16 +fn atan_a7ba61() { + var arg_0 = f16(); + var res: f16 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a7ba61(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a7ba61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a7ba61(); +} diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2697f3e783 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_a7ba61() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a7ba61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a7ba61(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1fae88d969 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void atan_a7ba61() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a7ba61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a7ba61(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000193197C2E20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000193197C2E20(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.glsl new file mode 100644 index 0000000000..4f7d41f548 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a7ba61() { + float16_t arg_0 = 0.0hf; + float16_t res = atan(arg_0); +} + +vec4 vertex_main() { + atan_a7ba61(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan_a7ba61() { + float16_t arg_0 = 0.0hf; + float16_t res = atan(arg_0); +} + +void fragment_main() { + atan_a7ba61(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan_a7ba61() { + float16_t arg_0 = 0.0hf; + float16_t res = atan(arg_0); +} + +void compute_main() { + atan_a7ba61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.msl new file mode 100644 index 0000000000..33674c9fd0 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_a7ba61() { + half arg_0 = 0.0h; + half res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a7ba61(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a7ba61(); + return; +} + +kernel void compute_main() { + atan_a7ba61(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.spvasm new file mode 100644 index 0000000000..2442909f4e --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a7ba61 "atan_a7ba61" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan_a7ba61 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Atan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %atan_a7ba61 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan_a7ba61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan_a7ba61 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.wgsl new file mode 100644 index 0000000000..2237e13955 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a7ba61.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atan_a7ba61() { + var arg_0 = f16(); + var res : f16 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a7ba61(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a7ba61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a7ba61(); +} diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl new file mode 100644 index 0000000000..5bb9e3eeb9 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(vec<4, f32>) -> vec<4, f32> +fn atan_a8b696() { + var arg_0 = vec4(1.f); + var res: vec4 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a8b696(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a8b696(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a8b696(); +} diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..15a19264a7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_a8b696() { + float4 arg_0 = (1.0f).xxxx; + float4 res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a8b696(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a8b696(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a8b696(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15a19264a7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void atan_a8b696() { + float4 arg_0 = (1.0f).xxxx; + float4 res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_a8b696(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_a8b696(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_a8b696(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl new file mode 100644 index 0000000000..61e17ddde8 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void atan_a8b696() { + vec4 arg_0 = vec4(1.0f); + vec4 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_a8b696(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_a8b696() { + vec4 arg_0 = vec4(1.0f); + vec4 res = atan(arg_0); +} + +void fragment_main() { + atan_a8b696(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_a8b696() { + vec4 arg_0 = vec4(1.0f); + vec4 res = atan(arg_0); +} + +void compute_main() { + atan_a8b696(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl new file mode 100644 index 0000000000..350a03842f --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_a8b696() { + float4 arg_0 = float4(1.0f); + float4 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_a8b696(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_a8b696(); + return; +} + +kernel void compute_main() { + atan_a8b696(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm new file mode 100644 index 0000000000..694b6bf913 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_a8b696 "atan_a8b696" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%atan_a8b696 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Atan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %atan_a8b696 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan_a8b696 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan_a8b696 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl new file mode 100644 index 0000000000..38016aab1b --- /dev/null +++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atan_a8b696() { + var arg_0 = vec4(1.0f); + var res : vec4 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_a8b696(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_a8b696(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_a8b696(); +} diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl new file mode 100644 index 0000000000..82f398994f --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan(vec<2, f32>) -> vec<2, f32> +fn atan_ad96e4() { + var arg_0 = vec2(1.f); + var res: vec2 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_ad96e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_ad96e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_ad96e4(); +} diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..86c25dc2a7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void atan_ad96e4() { + float2 arg_0 = (1.0f).xx; + float2 res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_ad96e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_ad96e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_ad96e4(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..86c25dc2a7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void atan_ad96e4() { + float2 arg_0 = (1.0f).xx; + float2 res = atan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan_ad96e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan_ad96e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan_ad96e4(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl new file mode 100644 index 0000000000..0c07baffe3 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void atan_ad96e4() { + vec2 arg_0 = vec2(1.0f); + vec2 res = atan(arg_0); +} + +vec4 vertex_main() { + atan_ad96e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan_ad96e4() { + vec2 arg_0 = vec2(1.0f); + vec2 res = atan(arg_0); +} + +void fragment_main() { + atan_ad96e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan_ad96e4() { + vec2 arg_0 = vec2(1.0f); + vec2 res = atan(arg_0); +} + +void compute_main() { + atan_ad96e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl new file mode 100644 index 0000000000..1928597ed0 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void atan_ad96e4() { + float2 arg_0 = float2(1.0f); + float2 res = atan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan_ad96e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan_ad96e4(); + return; +} + +kernel void compute_main() { + atan_ad96e4(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6e02818f7 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan_ad96e4 "atan_ad96e4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%atan_ad96e4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Atan %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %atan_ad96e4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan_ad96e4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %atan_ad96e4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..35b3936322 --- /dev/null +++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atan_ad96e4() { + var arg_0 = vec2(1.0f); + var res : vec2 = atan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan_ad96e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan_ad96e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan_ad96e4(); +} diff --git a/test/tint/builtins/gen/var/atan2/034ace.wgsl b/test/tint/builtins/gen/var/atan2/034ace.wgsl new file mode 100644 index 0000000000..e52cf6831c --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/034ace.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(fa, fa) -> fa +fn atan2_034ace() { + const arg_0 = 1; + const arg_1 = 1; + var res = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_034ace(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_034ace(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_034ace(); +} diff --git a/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dce0209f87 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_034ace() { + float res = 0.785398185f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_034ace(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_034ace(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_034ace(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dce0209f87 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_034ace() { + float res = 0.785398185f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_034ace(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_034ace(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_034ace(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.glsl new file mode 100644 index 0000000000..4919787a0b --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_034ace() { + float res = 0.785398185f; +} + +vec4 vertex_main() { + atan2_034ace(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_034ace() { + float res = 0.785398185f; +} + +void fragment_main() { + atan2_034ace(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_034ace() { + float res = 0.785398185f; +} + +void compute_main() { + atan2_034ace(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.msl new file mode 100644 index 0000000000..fb91e8d5e4 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_034ace() { + float res = 0.785398185f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_034ace(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_034ace(); + return; +} + +kernel void compute_main() { + atan2_034ace(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.spvasm new file mode 100644 index 0000000000..abac9b451f --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_034ace "atan2_034ace" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%float_0_785398185 = OpConstant %float 0.785398185 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_034ace = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_0_785398185 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %atan2_034ace + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %atan2_034ace + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan2_034ace + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.wgsl new file mode 100644 index 0000000000..1de898dbf8 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/034ace.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_034ace() { + const arg_0 = 1; + const arg_1 = 1; + var res = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_034ace(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_034ace(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_034ace(); +} diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl new file mode 100644 index 0000000000..f45981bc42 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn atan2_21dfea() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_21dfea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_21dfea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_21dfea(); +} diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..811f791bec --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_21dfea() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_21dfea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_21dfea(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7952947429 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void atan2_21dfea() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_21dfea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_21dfea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000155102818A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000155102818A0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000155102818A0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.glsl new file mode 100644 index 0000000000..e10e1d9bbf --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_21dfea() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_21dfea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_21dfea() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_21dfea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_21dfea() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_21dfea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.msl new file mode 100644 index 0000000000..2ed4954aaf --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_21dfea() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_21dfea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_21dfea(); + return; +} + +kernel void compute_main() { + atan2_21dfea(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.spvasm new file mode 100644 index 0000000000..22b64b3ebc --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_21dfea "atan2_21dfea" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_21dfea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Atan2 %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_21dfea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_21dfea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %atan2_21dfea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.wgsl new file mode 100644 index 0000000000..e4c6b6b893 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/21dfea.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn atan2_21dfea() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_21dfea(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_21dfea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_21dfea(); +} diff --git a/test/tint/builtins/gen/var/atan2/3c2865.wgsl b/test/tint/builtins/gen/var/atan2/3c2865.wgsl new file mode 100644 index 0000000000..499e571e80 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/3c2865.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<3, fa>, vec<3, fa>) -> vec<3, fa> +fn atan2_3c2865() { + const arg_0 = vec3(1); + const arg_1 = vec3(1); + var res = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_3c2865(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_3c2865(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_3c2865(); +} diff --git a/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..71f64a4057 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_3c2865() { + float3 res = (0.785398185f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_3c2865(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_3c2865(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_3c2865(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..71f64a4057 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_3c2865() { + float3 res = (0.785398185f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_3c2865(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_3c2865(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_3c2865(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.glsl new file mode 100644 index 0000000000..b2ebe380a2 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_3c2865() { + vec3 res = vec3(0.785398185f); +} + +vec4 vertex_main() { + atan2_3c2865(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_3c2865() { + vec3 res = vec3(0.785398185f); +} + +void fragment_main() { + atan2_3c2865(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_3c2865() { + vec3 res = vec3(0.785398185f); +} + +void compute_main() { + atan2_3c2865(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.msl new file mode 100644 index 0000000000..867108a468 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_3c2865() { + float3 res = float3(0.785398185f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_3c2865(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_3c2865(); + return; +} + +kernel void compute_main() { + atan2_3c2865(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.spvasm new file mode 100644 index 0000000000..56fba1d2ac --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_3c2865 "atan2_3c2865" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%float_0_785398185 = OpConstant %float 0.785398185 + %15 = OpConstantComposite %v3float %float_0_785398185 %float_0_785398185 %float_0_785398185 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_3c2865 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan2_3c2865 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan2_3c2865 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan2_3c2865 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.wgsl new file mode 100644 index 0000000000..cb7b4c8e9e --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/3c2865.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_3c2865() { + const arg_0 = vec3(1); + const arg_1 = vec3(1); + var res = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_3c2865(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_3c2865(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_3c2865(); +} diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl new file mode 100644 index 0000000000..b96b973538 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn atan2_57fb13() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var res: vec2 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_57fb13(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_57fb13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_57fb13(); +} diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8056f7df1a --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_57fb13() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_57fb13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_57fb13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_57fb13(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8056f7df1a --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void atan2_57fb13() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_57fb13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_57fb13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_57fb13(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl new file mode 100644 index 0000000000..e763d96883 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void atan2_57fb13() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_57fb13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_57fb13() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_57fb13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_57fb13() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_57fb13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl new file mode 100644 index 0000000000..e7a3592f7e --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_57fb13() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_57fb13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_57fb13(); + return; +} + +kernel void compute_main() { + atan2_57fb13(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm new file mode 100644 index 0000000000..50706eab73 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_57fb13 "atan2_57fb13" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float +%atan2_57fb13 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v2float %arg_0 + %23 = OpLoad %v2float %arg_1 + %20 = OpExtInst %v2float %21 Atan2 %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %atan2_57fb13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_57fb13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %atan2_57fb13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9d5b3334a --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_57fb13() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var res : vec2 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_57fb13(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_57fb13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_57fb13(); +} diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl new file mode 100644 index 0000000000..a09bf18e21 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn atan2_93febc() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_93febc(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_93febc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_93febc(); +} diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..780ec69979 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_93febc() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_93febc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_93febc(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cdf19482f9 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void atan2_93febc() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_93febc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_93febc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B1F88A7150(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B1F88A7150(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B1F88A7150(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.glsl new file mode 100644 index 0000000000..2184e82e82 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_93febc() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_93febc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_93febc() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_93febc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_93febc() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_93febc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.msl new file mode 100644 index 0000000000..27e327db2e --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_93febc() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_93febc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_93febc(); + return; +} + +kernel void compute_main() { + atan2_93febc(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.spvasm new file mode 100644 index 0000000000..bdcbc06b41 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_93febc "atan2_93febc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_93febc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 Atan2 %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_93febc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_93febc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %atan2_93febc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.wgsl new file mode 100644 index 0000000000..487d27110c --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/93febc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn atan2_93febc() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_93febc(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_93febc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_93febc(); +} diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl new file mode 100644 index 0000000000..4d8e68256d --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(f32, f32) -> f32 +fn atan2_96057c() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var res: f32 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_96057c(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_96057c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_96057c(); +} diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39bf0d5e19 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_96057c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_96057c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_96057c(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..39bf0d5e19 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_96057c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_96057c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_96057c(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl new file mode 100644 index 0000000000..f1ea03a736 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_96057c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_96057c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_96057c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl new file mode 100644 index 0000000000..799efaa0c6 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_96057c() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_96057c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_96057c(); + return; +} + +kernel void compute_main() { + atan2_96057c(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm new file mode 100644 index 0000000000..8a92d4b071 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_96057c "atan2_96057c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float +%atan2_96057c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 Atan2 %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %atan2_96057c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %atan2_96057c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_96057c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl new file mode 100644 index 0000000000..311e811d27 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_96057c() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var res : f32 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_96057c(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_96057c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_96057c(); +} diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl new file mode 100644 index 0000000000..0ed20f41a2 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn atan2_a70d0d() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var res: vec3 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_a70d0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_a70d0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_a70d0d(); +} diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e544eea6c --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_a70d0d() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_a70d0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_a70d0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_a70d0d(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6e544eea6c --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void atan2_a70d0d() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_a70d0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_a70d0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_a70d0d(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl new file mode 100644 index 0000000000..a489410883 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void atan2_a70d0d() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_a70d0d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_a70d0d() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_a70d0d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_a70d0d() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_a70d0d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl new file mode 100644 index 0000000000..ec2a783f69 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_a70d0d() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_a70d0d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_a70d0d(); + return; +} + +kernel void compute_main() { + atan2_a70d0d(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm new file mode 100644 index 0000000000..89d66414b8 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_a70d0d "atan2_a70d0d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %25 = OpTypeFunction %v4float +%atan2_a70d0d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v3float %arg_0 + %23 = OpLoad %v3float %arg_1 + %20 = OpExtInst %v3float %21 Atan2 %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %atan2_a70d0d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_a70d0d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %atan2_a70d0d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl new file mode 100644 index 0000000000..3caf18d2f9 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_a70d0d() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var res : vec3 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_a70d0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_a70d0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_a70d0d(); +} diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl new file mode 100644 index 0000000000..6fc425e1ae --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn atan2_ae713e() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var res: vec4 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ae713e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ae713e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ae713e(); +} diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e262cb425b --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_ae713e() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ae713e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ae713e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ae713e(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e262cb425b --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void atan2_ae713e() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ae713e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ae713e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ae713e(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl new file mode 100644 index 0000000000..80c808f69e --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void atan2_ae713e() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_ae713e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_ae713e() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_ae713e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_ae713e() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_ae713e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl new file mode 100644 index 0000000000..100f2dc520 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_ae713e() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_ae713e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_ae713e(); + return; +} + +kernel void compute_main() { + atan2_ae713e(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm new file mode 100644 index 0000000000..b54fe82983 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_ae713e "atan2_ae713e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float +%atan2_ae713e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v4float %arg_0 + %21 = OpLoad %v4float %arg_1 + %18 = OpExtInst %v4float %19 Atan2 %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %atan2_ae713e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan2_ae713e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %atan2_ae713e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc0e1fff70 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_ae713e() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var res : vec4 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ae713e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ae713e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ae713e(); +} diff --git a/test/tint/builtins/gen/var/atan2/c19683.wgsl b/test/tint/builtins/gen/var/atan2/c19683.wgsl new file mode 100644 index 0000000000..3e2522a989 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c19683.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<2, fa>, vec<2, fa>) -> vec<2, fa> +fn atan2_c19683() { + const arg_0 = vec2(1); + const arg_1 = vec2(1); + var res = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_c19683(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_c19683(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_c19683(); +} diff --git a/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..93f2273a4d --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_c19683() { + float2 res = (0.785398185f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_c19683(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_c19683(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_c19683(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..93f2273a4d --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_c19683() { + float2 res = (0.785398185f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_c19683(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_c19683(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_c19683(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.glsl new file mode 100644 index 0000000000..d823d61220 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_c19683() { + vec2 res = vec2(0.785398185f); +} + +vec4 vertex_main() { + atan2_c19683(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_c19683() { + vec2 res = vec2(0.785398185f); +} + +void fragment_main() { + atan2_c19683(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_c19683() { + vec2 res = vec2(0.785398185f); +} + +void compute_main() { + atan2_c19683(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.msl new file mode 100644 index 0000000000..3af76c71ab --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_c19683() { + float2 res = float2(0.785398185f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_c19683(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_c19683(); + return; +} + +kernel void compute_main() { + atan2_c19683(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.spvasm new file mode 100644 index 0000000000..66dfdb29f5 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_c19683 "atan2_c19683" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_785398185 = OpConstant %float 0.785398185 + %15 = OpConstantComposite %v2float %float_0_785398185 %float_0_785398185 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_c19683 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %atan2_c19683 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %atan2_c19683 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %atan2_c19683 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc8d8ee59a --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c19683.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_c19683() { + const arg_0 = vec2(1); + const arg_1 = vec2(1); + var res = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_c19683(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_c19683(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_c19683(); +} diff --git a/test/tint/builtins/gen/var/atan2/c4be45.wgsl b/test/tint/builtins/gen/var/atan2/c4be45.wgsl new file mode 100644 index 0000000000..761ecc8978 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c4be45.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atan2(vec<4, fa>, vec<4, fa>) -> vec<4, fa> +fn atan2_c4be45() { + const arg_0 = vec4(1); + const arg_1 = vec4(1); + var res = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_c4be45(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_c4be45(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_c4be45(); +} diff --git a/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c666d69302 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void atan2_c4be45() { + float4 res = (0.785398185f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_c4be45(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_c4be45(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_c4be45(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c666d69302 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void atan2_c4be45() { + float4 res = (0.785398185f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_c4be45(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_c4be45(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_c4be45(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.glsl new file mode 100644 index 0000000000..2d65f8235f --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void atan2_c4be45() { + vec4 res = vec4(0.785398185f); +} + +vec4 vertex_main() { + atan2_c4be45(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void atan2_c4be45() { + vec4 res = vec4(0.785398185f); +} + +void fragment_main() { + atan2_c4be45(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void atan2_c4be45() { + vec4 res = vec4(0.785398185f); +} + +void compute_main() { + atan2_c4be45(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.msl new file mode 100644 index 0000000000..89fe4fad5d --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void atan2_c4be45() { + float4 res = float4(0.785398185f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_c4be45(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_c4be45(); + return; +} + +kernel void compute_main() { + atan2_c4be45(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f8d2b6337 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_c4be45 "atan2_c4be45" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%float_0_785398185 = OpConstant %float 0.785398185 + %14 = OpConstantComposite %v4float %float_0_785398185 %float_0_785398185 %float_0_785398185 %float_0_785398185 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_c4be45 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %atan2_c4be45 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_c4be45 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %atan2_c4be45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6d2ed6380 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/c4be45.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn atan2_c4be45() { + const arg_0 = vec4(1); + const arg_1 = vec4(1); + var res = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_c4be45(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_c4be45(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_c4be45(); +} diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl new file mode 100644 index 0000000000..e1c18bc74a --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(f16, f16) -> f16 +fn atan2_ca698e() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ca698e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ca698e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ca698e(); +} diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0d5b1d999e --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_ca698e() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ca698e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ca698e(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..044e1b8c88 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void atan2_ca698e() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_ca698e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_ca698e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000284FEEEF860(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000284FEEEF860(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.glsl new file mode 100644 index 0000000000..3db5c43a7a --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_ca698e() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_ca698e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_ca698e() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_ca698e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_ca698e() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_ca698e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.msl new file mode 100644 index 0000000000..575cd00cb4 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_ca698e() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_ca698e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_ca698e(); + return; +} + +kernel void compute_main() { + atan2_ca698e(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.spvasm new file mode 100644 index 0000000000..01adb51acf --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_ca698e "atan2_ca698e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_ca698e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 Atan2 %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %atan2_ca698e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %atan2_ca698e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %atan2_ca698e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.wgsl new file mode 100644 index 0000000000..1097b260d6 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/ca698e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn atan2_ca698e() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_ca698e(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_ca698e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_ca698e(); +} diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl new file mode 100644 index 0000000000..2d87cea9f0 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atan2(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn atan2_d983ab() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_d983ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_d983ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_d983ab(); +} diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1e09843ae4 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void atan2_d983ab() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_d983ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_d983ab(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..926647d579 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void atan2_d983ab() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atan2_d983ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atan2_d983ab(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023A1AB1D2D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023A1AB1D2D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023A1AB1D2D0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.glsl new file mode 100644 index 0000000000..294b5375c4 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_d983ab() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0, arg_1); +} + +vec4 vertex_main() { + atan2_d983ab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void atan2_d983ab() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0, arg_1); +} + +void fragment_main() { + atan2_d983ab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void atan2_d983ab() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = atan(arg_0, arg_1); +} + +void compute_main() { + atan2_d983ab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.msl new file mode 100644 index 0000000000..1f3cdbc58c --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void atan2_d983ab() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = atan2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atan2_d983ab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atan2_d983ab(); + return; +} + +kernel void compute_main() { + atan2_d983ab(); + return; +} + diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.spvasm new file mode 100644 index 0000000000..a8b43d8044 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %atan2_d983ab "atan2_d983ab" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%atan2_d983ab = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 Atan2 %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %atan2_d983ab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %atan2_d983ab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %atan2_d983ab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d7f9377e8 --- /dev/null +++ b/test/tint/builtins/gen/var/atan2/d983ab.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn atan2_d983ab() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = atan2(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atan2_d983ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + atan2_d983ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atan2_d983ab(); +} diff --git a/test/tint/builtins/gen/var/atanh/440cca.wgsl b/test/tint/builtins/gen/var/atanh/440cca.wgsl new file mode 100644 index 0000000000..753c7a9ce1 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/440cca.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atanh(vec<3, f32>) -> vec<3, f32> +fn atanh_440cca() { + var arg_0 = vec3(1.f); + var res: vec3 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_440cca(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_440cca(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_440cca(); +} diff --git a/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..703758d97b --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_atanh(float3 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_440cca() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_440cca(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_440cca(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_440cca(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..703758d97b --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_atanh(float3 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_440cca() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_440cca(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_440cca(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_440cca(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.glsl new file mode 100644 index 0000000000..4e5fb6b3e2 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec3 tint_atanh(vec3 x) { + return mix(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f))); +} + +void atanh_440cca() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_440cca(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_atanh(vec3 x) { + return mix(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f))); +} + +void atanh_440cca() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_440cca(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_atanh(vec3 x) { + return mix(atanh(x), vec3(0.0f), greaterThanEqual(x, vec3(1.0f))); +} + +void atanh_440cca() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_440cca(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.msl new file mode 100644 index 0000000000..00cc45ce68 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +float3 tint_atanh(float3 x) { + return select(atanh(x), float3(0.0f), (x >= float3(1.0f))); +} + +void atanh_440cca() { + float3 arg_0 = float3(1.0f); + float3 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_440cca(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_440cca(); + return; +} + +kernel void compute_main() { + atanh_440cca(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b60b5112c --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_440cca "atanh_440cca" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float %v3float + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %20 = OpConstantNull %v3float + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_v3float = OpTypePointer Function %v3float + %32 = OpTypeFunction %v4float + %tint_atanh = OpFunction %v3float None %9 + %x = OpFunctionParameter %v3float + %13 = OpLabel + %17 = OpFOrdGreaterThanEqual %v3bool %x %16 + %21 = OpExtInst %v3float %22 Atanh %x + %14 = OpSelect %v3float %17 %20 %21 + OpReturnValue %14 + OpFunctionEnd +%atanh_440cca = OpFunction %void None %23 + %26 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v3float Function %20 + OpStore %arg_0 %16 + %30 = OpLoad %v3float %arg_0 + %29 = OpFunctionCall %v3float %tint_atanh %30 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %atanh_440cca + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_440cca + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %43 = OpLabel + %44 = OpFunctionCall %void %atanh_440cca + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.wgsl new file mode 100644 index 0000000000..b2d4a5a520 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/440cca.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atanh_440cca() { + var arg_0 = vec3(1.0f); + var res : vec3 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_440cca(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_440cca(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_440cca(); +} diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl new file mode 100644 index 0000000000..9ad6f3fe48 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<2, f16>) -> vec<2, f16> +fn atanh_5bf88d() { + var arg_0 = vec2(f16()); + var res: vec2 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_5bf88d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_5bf88d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_5bf88d(); +} diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..50adf29658 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_5bf88d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_5bf88d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_5bf88d(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c08dcf65f3 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_5bf88d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_5bf88d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_5bf88d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000223A4C149E0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl new file mode 100644 index 0000000000..d8e42b98e6 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_5bf88d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_5bf88d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_atanh(f16vec2 x) { + return mix(atanh(x), f16vec2(0.0hf), greaterThanEqual(x, f16vec2(1.0hf))); +} + +void atanh_5bf88d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_5bf88d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.msl new file mode 100644 index 0000000000..633f841000 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half2 tint_atanh(half2 x) { + return select(atanh(x), half2(0.0h), (x >= half2(1.0h))); +} + +void atanh_5bf88d() { + half2 arg_0 = half2(0.0h); + half2 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_5bf88d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_5bf88d(); + return; +} + +kernel void compute_main() { + atanh_5bf88d(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.spvasm new file mode 100644 index 0000000000..55870bc65c --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_5bf88d "atanh_5bf88d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %21 = OpConstantNull %v2half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v2half = OpTypePointer Function %v2half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v2half None %9 + %x = OpFunctionParameter %v2half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v2bool %x %17 + %22 = OpExtInst %v2half %23 Atanh %x + %15 = OpSelect %v2half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_5bf88d = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %21 + %res = OpVariable %_ptr_Function_v2half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v2half %arg_0 + %30 = OpFunctionCall %v2half %tint_atanh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %atanh_5bf88d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %atanh_5bf88d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %atanh_5bf88d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d38ee5257 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/5bf88d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atanh_5bf88d() { + var arg_0 = vec2(f16()); + var res : vec2 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_5bf88d(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_5bf88d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_5bf88d(); +} diff --git a/test/tint/builtins/gen/var/atanh/7997d8.wgsl b/test/tint/builtins/gen/var/atanh/7997d8.wgsl new file mode 100644 index 0000000000..c08b2316fe --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/7997d8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atanh(f32) -> f32 +fn atanh_7997d8() { + var arg_0 = 1.f; + var res: f32 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_7997d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_7997d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_7997d8(); +} diff --git a/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..20a886c866 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float tint_atanh(float x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_7997d8() { + float arg_0 = 1.0f; + float res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_7997d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_7997d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_7997d8(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20a886c866 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float tint_atanh(float x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_7997d8() { + float arg_0 = 1.0f; + float res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_7997d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_7997d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_7997d8(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.glsl new file mode 100644 index 0000000000..cedc900282 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +float tint_atanh(float x) { + return ((x >= 1.0f) ? 0.0f : atanh(x)); +} + +void atanh_7997d8() { + float arg_0 = 1.0f; + float res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_7997d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_atanh(float x) { + return ((x >= 1.0f) ? 0.0f : atanh(x)); +} + +void atanh_7997d8() { + float arg_0 = 1.0f; + float res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_7997d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_atanh(float x) { + return ((x >= 1.0f) ? 0.0f : atanh(x)); +} + +void atanh_7997d8() { + float arg_0 = 1.0f; + float res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_7997d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.msl new file mode 100644 index 0000000000..3944dd009c --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +float tint_atanh(float x) { + return select(atanh(x), 0.0f, (x >= 1.0f)); +} + +void atanh_7997d8() { + float arg_0 = 1.0f; + float res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_7997d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_7997d8(); + return; +} + +kernel void compute_main() { + atanh_7997d8(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b473e9f4c --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_7997d8 "atanh_7997d8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %9 = OpTypeFunction %float %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpTypeFunction %v4float + %tint_atanh = OpFunction %float None %9 + %x = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFOrdGreaterThanEqual %bool %x %float_1 + %17 = OpExtInst %float %18 Atanh %x + %13 = OpSelect %float %15 %8 %17 + OpReturnValue %13 + OpFunctionEnd +%atanh_7997d8 = OpFunction %void None %19 + %22 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %26 = OpLoad %float %arg_0 + %25 = OpFunctionCall %float %tint_atanh %26 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %atanh_7997d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %19 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %19 + %36 = OpLabel + %37 = OpFunctionCall %void %atanh_7997d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %19 + %39 = OpLabel + %40 = OpFunctionCall %void %atanh_7997d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..4355659004 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/7997d8.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atanh_7997d8() { + var arg_0 = 1.0f; + var res : f32 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_7997d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_7997d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_7997d8(); +} diff --git a/test/tint/builtins/gen/var/atanh/c0e634.wgsl b/test/tint/builtins/gen/var/atanh/c0e634.wgsl new file mode 100644 index 0000000000..1538619e85 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/c0e634.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atanh(vec<2, f32>) -> vec<2, f32> +fn atanh_c0e634() { + var arg_0 = vec2(1.f); + var res: vec2 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_c0e634(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_c0e634(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_c0e634(); +} diff --git a/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2573bee49b --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_atanh(float2 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_c0e634() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_c0e634(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_c0e634(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_c0e634(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2573bee49b --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_atanh(float2 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_c0e634() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_c0e634(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_c0e634(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_c0e634(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.glsl new file mode 100644 index 0000000000..a6857cd97d --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec2 tint_atanh(vec2 x) { + return mix(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f))); +} + +void atanh_c0e634() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_c0e634(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_atanh(vec2 x) { + return mix(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f))); +} + +void atanh_c0e634() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_c0e634(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_atanh(vec2 x) { + return mix(atanh(x), vec2(0.0f), greaterThanEqual(x, vec2(1.0f))); +} + +void atanh_c0e634() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_c0e634(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.msl new file mode 100644 index 0000000000..a407911fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +float2 tint_atanh(float2 x) { + return select(atanh(x), float2(0.0f), (x >= float2(1.0f))); +} + +void atanh_c0e634() { + float2 arg_0 = float2(1.0f); + float2 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_c0e634(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_c0e634(); + return; +} + +kernel void compute_main() { + atanh_c0e634(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.spvasm new file mode 100644 index 0000000000..3bfbe162ff --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_c0e634 "atanh_c0e634" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %v2float = OpTypeVector %float 2 + %9 = OpTypeFunction %v2float %v2float + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v2float %float_1 %float_1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %20 = OpConstantNull %v2float + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %32 = OpTypeFunction %v4float + %tint_atanh = OpFunction %v2float None %9 + %x = OpFunctionParameter %v2float + %13 = OpLabel + %17 = OpFOrdGreaterThanEqual %v2bool %x %16 + %21 = OpExtInst %v2float %22 Atanh %x + %14 = OpSelect %v2float %17 %20 %21 + OpReturnValue %14 + OpFunctionEnd +%atanh_c0e634 = OpFunction %void None %23 + %26 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v2float Function %20 + OpStore %arg_0 %16 + %30 = OpLoad %v2float %arg_0 + %29 = OpFunctionCall %v2float %tint_atanh %30 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %atanh_c0e634 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %40 = OpLabel + %41 = OpFunctionCall %void %atanh_c0e634 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %43 = OpLabel + %44 = OpFunctionCall %void %atanh_c0e634 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.wgsl new file mode 100644 index 0000000000..e9d9908b06 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/c0e634.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atanh_c0e634() { + var arg_0 = vec2(1.0f); + var res : vec2 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_c0e634(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_c0e634(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_c0e634(); +} diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl new file mode 100644 index 0000000000..bbe88cba03 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(f16) -> f16 +fn atanh_d2d8cd() { + var arg_0 = f16(); + var res: f16 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_d2d8cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_d2d8cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_d2d8cd(); +} diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bf8166ad75 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_atanh(float16_t x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_d2d8cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_d2d8cd(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b725226906 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_atanh(float16_t x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_d2d8cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_d2d8cd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000275850EA270(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl new file mode 100644 index 0000000000..d829f337c4 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_d2d8cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_d2d8cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_atanh(float16_t x) { + return ((x >= 1.0hf) ? 0.0hf : atanh(x)); +} + +void atanh_d2d8cd() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_d2d8cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.msl new file mode 100644 index 0000000000..d76fbdd82e --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half tint_atanh(half x) { + return select(atanh(x), 0.0h, (x >= 1.0h)); +} + +void atanh_d2d8cd() { + half arg_0 = 0.0h; + half res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_d2d8cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_d2d8cd(); + return; +} + +kernel void compute_main() { + atanh_d2d8cd(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..343b75f623 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_d2d8cd "atanh_d2d8cd" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %9 = OpTypeFunction %half %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %18 = OpConstantNull %half + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %half None %9 + %x = OpFunctionParameter %half + %13 = OpLabel + %16 = OpFOrdGreaterThanEqual %bool %x %half_0x1p_0 + %19 = OpExtInst %half %20 Atanh %x + %14 = OpSelect %half %16 %18 %19 + OpReturnValue %14 + OpFunctionEnd +%atanh_d2d8cd = OpFunction %void None %21 + %24 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %18 + %res = OpVariable %_ptr_Function_half Function %18 + OpStore %arg_0 %18 + %28 = OpLoad %half %arg_0 + %27 = OpFunctionCall %half %tint_atanh %28 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %atanh_d2d8cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %39 = OpLabel + %40 = OpFunctionCall %void %atanh_d2d8cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %42 = OpLabel + %43 = OpFunctionCall %void %atanh_d2d8cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..f9720ab61b --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/d2d8cd.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atanh_d2d8cd() { + var arg_0 = f16(); + var res : f16 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_d2d8cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_d2d8cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_d2d8cd(); +} diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl new file mode 100644 index 0000000000..f1fa1f3658 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<4, f16>) -> vec<4, f16> +fn atanh_e3b450() { + var arg_0 = vec4(f16()); + var res: vec4 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_e3b450(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_e3b450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_e3b450(); +} diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e36b362efb --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_e3b450() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_e3b450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_e3b450(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a96d5844f6 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_e3b450() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_e3b450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_e3b450(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C82047E7C0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl new file mode 100644 index 0000000000..160e4643a2 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_e3b450(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_e3b450(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_atanh(f16vec4 x) { + return mix(atanh(x), f16vec4(0.0hf), greaterThanEqual(x, f16vec4(1.0hf))); +} + +void atanh_e3b450() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_e3b450(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.msl new file mode 100644 index 0000000000..70237ec209 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half4 tint_atanh(half4 x) { + return select(atanh(x), half4(0.0h), (x >= half4(1.0h))); +} + +void atanh_e3b450() { + half4 arg_0 = half4(0.0h); + half4 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_e3b450(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_e3b450(); + return; +} + +kernel void compute_main() { + atanh_e3b450(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.spvasm new file mode 100644 index 0000000000..b284d66e04 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_e3b450 "atanh_e3b450" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %21 = OpConstantNull %v4half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v4half = OpTypePointer Function %v4half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v4half None %9 + %x = OpFunctionParameter %v4half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v4bool %x %17 + %22 = OpExtInst %v4half %23 Atanh %x + %15 = OpSelect %v4half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_e3b450 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %21 + %res = OpVariable %_ptr_Function_v4half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v4half %arg_0 + %30 = OpFunctionCall %v4half %tint_atanh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %atanh_e3b450 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %atanh_e3b450 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %atanh_e3b450 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4fe719b28 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/e3b450.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atanh_e3b450() { + var arg_0 = vec4(f16()); + var res : vec4 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_e3b450(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_e3b450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_e3b450(); +} diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl new file mode 100644 index 0000000000..57babedd92 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn atanh(vec<3, f16>) -> vec<3, f16> +fn atanh_ec4b06() { + var arg_0 = vec3(f16()); + var res: vec3 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_ec4b06(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_ec4b06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_ec4b06(); +} diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f59fe902f8 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_ec4b06() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_ec4b06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_ec4b06(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c96a0ee959 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_atanh(vector x) { + return (log(((float16_t(1.0h) + x) / (float16_t(1.0h) - x))) * float16_t(0.5h)); +} + +void atanh_ec4b06() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_ec4b06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_ec4b06(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AC957584B0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl new file mode 100644 index 0000000000..13d4a41cb5 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_ec4b06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_ec4b06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_atanh(f16vec3 x) { + return mix(atanh(x), f16vec3(0.0hf), greaterThanEqual(x, f16vec3(1.0hf))); +} + +void atanh_ec4b06() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_ec4b06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.msl new file mode 100644 index 0000000000..6238a7df21 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +half3 tint_atanh(half3 x) { + return select(atanh(x), half3(0.0h), (x >= half3(1.0h))); +} + +void atanh_ec4b06() { + half3 arg_0 = half3(0.0h); + half3 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_ec4b06(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_ec4b06(); + return; +} + +kernel void compute_main() { + atanh_ec4b06(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.spvasm new file mode 100644 index 0000000000..c58d4e33f5 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_ec4b06 "atanh_ec4b06" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %21 = OpConstantNull %v3half + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_v3half = OpTypePointer Function %v3half + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tint_atanh = OpFunction %v3half None %9 + %x = OpFunctionParameter %v3half + %14 = OpLabel + %18 = OpFOrdGreaterThanEqual %v3bool %x %17 + %22 = OpExtInst %v3half %23 Atanh %x + %15 = OpSelect %v3half %18 %21 %22 + OpReturnValue %15 + OpFunctionEnd +%atanh_ec4b06 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %21 + %res = OpVariable %_ptr_Function_v3half Function %21 + OpStore %arg_0 %21 + %31 = OpLoad %v3half %arg_0 + %30 = OpFunctionCall %v3half %tint_atanh %31 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %atanh_ec4b06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %42 = OpLabel + %43 = OpFunctionCall %void %atanh_ec4b06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %45 = OpLabel + %46 = OpFunctionCall %void %atanh_ec4b06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.wgsl new file mode 100644 index 0000000000..b22a682d07 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/ec4b06.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn atanh_ec4b06() { + var arg_0 = vec3(f16()); + var res : vec3 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_ec4b06(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_ec4b06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_ec4b06(); +} diff --git a/test/tint/builtins/gen/var/atanh/f3e01b.wgsl b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl new file mode 100644 index 0000000000..c97144012e --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn atanh(vec<4, f32>) -> vec<4, f32> +fn atanh_f3e01b() { + var arg_0 = vec4(1.f); + var res: vec4 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_f3e01b(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_f3e01b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_f3e01b(); +} diff --git a/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f85a7e62a4 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_atanh(float4 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_f3e01b() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_f3e01b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_f3e01b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_f3e01b(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f85a7e62a4 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_atanh(float4 x) { + return (log(((1.0f + x) / (1.0f - x))) * 0.5f); +} + +void atanh_f3e01b() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + atanh_f3e01b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + atanh_f3e01b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atanh_f3e01b(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.glsl new file mode 100644 index 0000000000..75486c5f35 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +vec4 tint_atanh(vec4 x) { + return mix(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f))); +} + +void atanh_f3e01b() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_atanh(arg_0); +} + +vec4 vertex_main() { + atanh_f3e01b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_atanh(vec4 x) { + return mix(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f))); +} + +void atanh_f3e01b() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_atanh(arg_0); +} + +void fragment_main() { + atanh_f3e01b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_atanh(vec4 x) { + return mix(atanh(x), vec4(0.0f), greaterThanEqual(x, vec4(1.0f))); +} + +void atanh_f3e01b() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_atanh(arg_0); +} + +void compute_main() { + atanh_f3e01b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.msl new file mode 100644 index 0000000000..41b2f08ff2 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +float4 tint_atanh(float4 x) { + return select(atanh(x), float4(0.0f), (x >= float4(1.0f))); +} + +void atanh_f3e01b() { + float4 arg_0 = float4(1.0f); + float4 res = tint_atanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + atanh_f3e01b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + atanh_f3e01b(); + return; +} + +kernel void compute_main() { + atanh_f3e01b(); + return; +} + diff --git a/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.spvasm new file mode 100644 index 0000000000..e78165eaa5 --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_atanh "tint_atanh" + OpName %x "x" + OpName %atanh_f3e01b "atanh_f3e01b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %9 = OpTypeFunction %v4float %v4float + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %tint_atanh = OpFunction %v4float None %9 + %x = OpFunctionParameter %v4float + %12 = OpLabel + %16 = OpFOrdGreaterThanEqual %v4bool %x %15 + %19 = OpExtInst %v4float %20 Atanh %x + %13 = OpSelect %v4float %16 %5 %19 + OpReturnValue %13 + OpFunctionEnd +%atanh_f3e01b = OpFunction %void None %21 + %24 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %15 + %28 = OpLoad %v4float %arg_0 + %27 = OpFunctionCall %v4float %tint_atanh %28 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %atanh_f3e01b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %38 = OpLabel + %39 = OpFunctionCall %void %atanh_f3e01b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %41 = OpLabel + %42 = OpFunctionCall %void %atanh_f3e01b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.wgsl new file mode 100644 index 0000000000..ead0ca86cc --- /dev/null +++ b/test/tint/builtins/gen/var/atanh/f3e01b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn atanh_f3e01b() { + var arg_0 = vec4(1.0f); + var res : vec4 = atanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + atanh_f3e01b(); + return vec4(); +} + +@fragment +fn fragment_main() { + atanh_f3e01b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atanh_f3e01b(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl new file mode 100644 index 0000000000..556c47f18e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAdd(ptr, read_write>, i32) -> i32 +fn atomicAdd_794055() { + var arg_1 = 1; + var res: i32 = atomicAdd(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_794055(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94edce7bd4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicAdd_794055() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..94edce7bd4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicAdd_794055() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAdd_794055(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl new file mode 100644 index 0000000000..6e7ea7eca9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicAdd_794055() { + int arg_1 = 1; + int res = atomicAdd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicAdd_794055(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl new file mode 100644 index 0000000000..b84f508e6c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_add_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_794055(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a311f18c4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_794055 "atomicAdd_794055" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_794055 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAdd_794055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl new file mode 100644 index 0000000000..969958e629 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicAdd_794055() { + var arg_1 = 1; + var res : i32 = atomicAdd(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_794055(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl new file mode 100644 index 0000000000..ff49cca836 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAdd(ptr, read_write>, u32) -> u32 +fn atomicAdd_8a199a() { + var arg_1 = 1u; + var res: u32 = atomicAdd(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicAdd_8a199a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_8a199a(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1bf7c3ef82 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint arg_1 = 1u; + uint res = tint_atomicAdd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_8a199a(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1bf7c3ef82 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_8a199a() { + uint arg_1 = 1u; + uint res = tint_atomicAdd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAdd_8a199a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_8a199a(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl new file mode 100644 index 0000000000..b4e7e25b56 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 1u; + uint res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicAdd_8a199a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicAdd_8a199a() { + uint arg_1 = 1u; + uint res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicAdd_8a199a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl new file mode 100644 index 0000000000..e1e7c61b97 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicAdd_8a199a(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicAdd_8a199a(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicAdd_8a199a(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm new file mode 100644 index 0000000000..98d9690d34 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_8a199a "atomicAdd_8a199a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAdd_8a199a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicIAdd %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_8a199a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl new file mode 100644 index 0000000000..60690f00e7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAdd_8a199a() { + var arg_1 = 1u; + var res : u32 = atomicAdd(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicAdd_8a199a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_8a199a(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl new file mode 100644 index 0000000000..9e02742e66 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAdd(ptr, read_write>, i32) -> i32 +fn atomicAdd_d32fe4() { + var arg_1 = 1; + var res: i32 = atomicAdd(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicAdd_d32fe4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_d32fe4(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..213221ba82 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int arg_1 = 1; + int res = tint_atomicAdd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_d32fe4(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..213221ba82 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, value, original_value); + return original_value; +} + + +void atomicAdd_d32fe4() { + int arg_1 = 1; + int res = tint_atomicAdd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAdd_d32fe4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAdd_d32fe4(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl new file mode 100644 index 0000000000..c589612d2b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 1; + int res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicAdd_d32fe4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicAdd_d32fe4() { + int arg_1 = 1; + int res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicAdd_d32fe4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl new file mode 100644 index 0000000000..2ef2df3e6e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicAdd_d32fe4(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicAdd_d32fe4(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicAdd_d32fe4(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fd0e19721 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAdd_d32fe4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_d32fe4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b4b44b6e2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAdd_d32fe4() { + var arg_1 = 1; + var res : i32 = atomicAdd(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicAdd_d32fe4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_d32fe4(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl new file mode 100644 index 0000000000..68a0d63496 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAdd(ptr, read_write>, u32) -> u32 +fn atomicAdd_d5db1d() { + var arg_1 = 1u; + var res: u32 = atomicAdd(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_d5db1d(); +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c74e7bdbe4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c74e7bdbe4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicAdd_d5db1d() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAdd_d5db1d(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl new file mode 100644 index 0000000000..4d92172b69 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicAdd_d5db1d() { + uint arg_1 = 1u; + uint res = atomicAdd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicAdd_d5db1d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl new file mode 100644 index 0000000000..c05a45c9e0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_add_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAdd_d5db1d(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..7ab1e8d2e3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAdd_d5db1d "atomicAdd_d5db1d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAdd_d5db1d = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAdd_d5db1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7ca6d0c11 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicAdd_d5db1d() { + var arg_1 = 1u; + var res : u32 = atomicAdd(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAdd_d5db1d(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl new file mode 100644 index 0000000000..1425f29154 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAnd(ptr, read_write>, i32) -> i32 +fn atomicAnd_152966() { + var arg_1 = 1; + var res: i32 = atomicAnd(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicAnd_152966(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_152966(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4562edbdc2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_152966() { + int arg_1 = 1; + int res = tint_atomicAnd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAnd_152966(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_152966(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4562edbdc2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_152966() { + int arg_1 = 1; + int res = tint_atomicAnd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAnd_152966(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_152966(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl new file mode 100644 index 0000000000..3e8c40f3ce --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicAnd_152966() { + int arg_1 = 1; + int res = atomicAnd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicAnd_152966(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicAnd_152966() { + int arg_1 = 1; + int res = atomicAnd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicAnd_152966(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl new file mode 100644 index 0000000000..c7bf4a8624 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicAnd_152966(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicAnd_152966(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicAnd_152966(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm new file mode 100644 index 0000000000..18408ba002 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_152966 "atomicAnd_152966" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicAnd_152966 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicAnd %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAnd_152966 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl new file mode 100644 index 0000000000..3fd9d1c365 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAnd_152966() { + var arg_1 = 1; + var res : i32 = atomicAnd(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicAnd_152966(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_152966(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl new file mode 100644 index 0000000000..48e876456c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAnd(ptr, read_write>, u32) -> u32 +fn atomicAnd_34edd3() { + var arg_1 = 1u; + var res: u32 = atomicAnd(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_34edd3(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9aca847882 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicAnd_34edd3() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAnd(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAnd_34edd3(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9aca847882 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicAnd_34edd3() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAnd(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAnd_34edd3(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl new file mode 100644 index 0000000000..1233dc8dde --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicAnd_34edd3() { + uint arg_1 = 1u; + uint res = atomicAnd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicAnd_34edd3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl new file mode 100644 index 0000000000..ea6ba7ebd7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicAnd_34edd3(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_and_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_34edd3(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6e94c1a3a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_34edd3 "atomicAnd_34edd3" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_34edd3 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicAnd_34edd3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl new file mode 100644 index 0000000000..95152936c2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicAnd_34edd3() { + var arg_1 = 1u; + var res : u32 = atomicAnd(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_34edd3(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl new file mode 100644 index 0000000000..6a961b1f9f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicAnd(ptr, read_write>, i32) -> i32 +fn atomicAnd_45a819() { + var arg_1 = 1; + var res: i32 = atomicAnd(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_45a819(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7bf2f53a90 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicAnd_45a819() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedAnd(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAnd_45a819(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7bf2f53a90 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicAnd_45a819() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedAnd(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicAnd_45a819(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl new file mode 100644 index 0000000000..5f90d4a6b4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicAnd_45a819() { + int arg_1 = 1; + int res = atomicAnd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicAnd_45a819(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl new file mode 100644 index 0000000000..ece0c9f64b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicAnd_45a819(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_and_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicAnd_45a819(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0c9a7e2f3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicAnd_45a819 "atomicAnd_45a819" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicAnd_45a819 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicAnd_45a819 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl new file mode 100644 index 0000000000..317fe39eeb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicAnd_45a819() { + var arg_1 = 1; + var res : i32 = atomicAnd(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_45a819(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl new file mode 100644 index 0000000000..5e1b35e436 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicAnd(ptr, read_write>, u32) -> u32 +fn atomicAnd_85a8d9() { + var arg_1 = 1u; + var res: u32 = atomicAnd(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicAnd_85a8d9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_85a8d9(); +} diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f2099cfe1a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_85a8d9() { + uint arg_1 = 1u; + uint res = tint_atomicAnd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAnd_85a8d9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_85a8d9(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f2099cfe1a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAnd(offset, value, original_value); + return original_value; +} + + +void atomicAnd_85a8d9() { + uint arg_1 = 1u; + uint res = tint_atomicAnd(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicAnd_85a8d9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicAnd_85a8d9(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl new file mode 100644 index 0000000000..6d6dd70164 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicAnd_85a8d9() { + uint arg_1 = 1u; + uint res = atomicAnd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicAnd_85a8d9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicAnd_85a8d9() { + uint arg_1 = 1u; + uint res = atomicAnd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicAnd_85a8d9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl new file mode 100644 index 0000000000..f38ff4345e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicAnd_85a8d9(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicAnd_85a8d9(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicAnd_85a8d9(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm new file mode 100644 index 0000000000..d8c4b78793 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicAnd_85a8d9 "atomicAnd_85a8d9" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicAnd_85a8d9 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicAnd %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAnd_85a8d9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl new file mode 100644 index 0000000000..b0eb8caa23 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicAnd_85a8d9() { + var arg_1 = 1u; + var res : u32 = atomicAnd(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicAnd_85a8d9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicAnd_85a8d9(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl new file mode 100644 index 0000000000..f302d121e7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicCompareExchangeWeak(ptr, read_write>, i32, i32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_1bd40a() { + var arg_1 = 1; + var arg_2 = 1; + var res = atomicCompareExchangeWeak(&sb_rw.arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_1bd40a(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53a01c6f54 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, arg_2); +} + +void fragment_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..53a01c6f54 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + int old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, arg_2); +} + +void fragment_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_1bd40a(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl new file mode 100644 index 0000000000..cae561bc0a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl @@ -0,0 +1,66 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resulti32 res = atomic_compare_result; +} + +void fragment_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicCompareExchangeWeak_1bd40a() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resulti32 res = atomic_compare_result; +} + +void compute_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl new file mode 100644 index 0000000000..d2b66917f6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(device atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicCompareExchangeWeak_1bd40a(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), arg_1, arg_2); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicCompareExchangeWeak_1bd40a(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm new file mode 100644 index 0000000000..0999969646 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_1bd40a "atomicCompareExchangeWeak_1bd40a" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %29 = OpConstantNull %__atomic_compare_exchange_resulti32 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %arg_2 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %29 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %23 = OpLoad %int %arg_2 + %24 = OpLoad %int %arg_1 + %25 = OpAtomicCompareExchange %int %22 %uint_1 %uint_0 %uint_0 %23 %24 + %26 = OpIEqual %bool %25 %23 + %14 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %25 %26 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %31 = OpLabel + %32 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %34 = OpLabel + %35 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl new file mode 100644 index 0000000000..a97dff5ca3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicCompareExchangeWeak_1bd40a() { + var arg_1 = 1; + var arg_2 = 1; + var res = atomicCompareExchangeWeak(&(sb_rw.arg_0), arg_1, arg_2); +} + +@fragment +fn fragment_main() { + atomicCompareExchangeWeak_1bd40a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_1bd40a(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl new file mode 100644 index 0000000000..9fdbc09c90 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl @@ -0,0 +1,43 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicCompareExchangeWeak(ptr, read_write>, u32, u32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_63d8e6() { + var arg_1 = 1u; + var arg_2 = 1u; + var res = atomicCompareExchangeWeak(&sb_rw.arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_63d8e6(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c22dc7ece --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, arg_2); +} + +void fragment_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c22dc7ece --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +struct atomic_compare_exchange_weak_ret_type { + uint old_value; + bool exchanged; +}; + +atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) { + atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0; + buffer.InterlockedCompareExchange(offset, compare, value, result.old_value); + result.exchanged = result.old_value == compare; + return result; +} + + +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, arg_2); +} + +void fragment_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicCompareExchangeWeak_63d8e6(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl new file mode 100644 index 0000000000..a30b533d18 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl @@ -0,0 +1,66 @@ +#version 310 es +precision mediump float; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resultu32 res = atomic_compare_result; +} + +void fragment_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicCompareExchangeWeak_63d8e6() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resultu32 res = atomic_compare_result; +} + +void compute_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl new file mode 100644 index 0000000000..f4fda565e0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(device atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicCompareExchangeWeak_63d8e6(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), arg_1, arg_2); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicCompareExchangeWeak_63d8e6(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..3723643514 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicCompareExchangeWeak_63d8e6 "atomicCompareExchangeWeak_63d8e6" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %27 = OpConstantNull %__atomic_compare_exchange_resultu32 +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %arg_2 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %27 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %21 = OpLoad %uint %arg_2 + %22 = OpLoad %uint %arg_1 + %23 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %21 %22 + %24 = OpIEqual %bool %23 %21 + %14 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %23 %24 + OpStore %res %14 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %32 = OpLabel + %33 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..6c674d5c76 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicCompareExchangeWeak_63d8e6() { + var arg_1 = 1u; + var arg_2 = 1u; + var res = atomicCompareExchangeWeak(&(sb_rw.arg_0), arg_1, arg_2); +} + +@fragment +fn fragment_main() { + atomicCompareExchangeWeak_63d8e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_63d8e6(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl new file mode 100644 index 0000000000..0f47c9b077 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicCompareExchangeWeak(ptr, read_write>, u32, u32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_83580d() { + var arg_1 = 1u; + var arg_2 = 1u; + var res = atomicCompareExchangeWeak(&arg_0, arg_1, arg_2); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_83580d(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a445a1d0ab --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +groupshared uint arg_0; + +void atomicCompareExchangeWeak_83580d() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 atomic_result = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = arg_1; + InterlockedCompareExchange(arg_0, atomic_compare_value, arg_2, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + atomic_compare_exchange_resultu32 res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_83580d(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a445a1d0ab --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +groupshared uint arg_0; + +void atomicCompareExchangeWeak_83580d() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 atomic_result = (atomic_compare_exchange_resultu32)0; + uint atomic_compare_value = arg_1; + InterlockedCompareExchange(arg_0, atomic_compare_value, arg_2, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + atomic_compare_exchange_resultu32 res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_83580d(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl new file mode 100644 index 0000000000..a9569da165 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl @@ -0,0 +1,31 @@ +#version 310 es + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; + + +shared uint arg_0; +void atomicCompareExchangeWeak_83580d() { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resultu32 res = atomic_compare_result; +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicCompareExchangeWeak_83580d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl new file mode 100644 index 0000000000..811dd26244 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resultu32 { + uint old_value; + bool exchanged; +}; +atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(threadgroup atomic_uint* atomic, uint compare, uint value) { + uint old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint arg_2 = 1u; + atomic_compare_exchange_resultu32 res = atomicCompareExchangeWeak_1(tint_symbol, arg_1, arg_2); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_83580d(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm new file mode 100644 index 0000000000..b163b6f12c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_83580d "atomicCompareExchangeWeak_83580d" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32" + OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %bool = OpTypeBool +%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 + %27 = OpConstantNull %__atomic_compare_exchange_resultu32 + %28 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_83580d = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %arg_2 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %27 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %21 = OpLoad %uint %arg_2 + %22 = OpLoad %uint %arg_1 + %23 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %21 %22 + %24 = OpIEqual %bool %23 %21 + %15 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %23 %24 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %28 +%local_invocation_index = OpFunctionParameter %uint + %31 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %36 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %38 = OpLabel + %40 = OpLoad %uint %local_invocation_index_1 + %39 = OpFunctionCall %void %compute_main_inner %40 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cfbe69f43 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_83580d() { + var arg_1 = 1u; + var arg_2 = 1u; + var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_83580d(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl new file mode 100644 index 0000000000..8ff42eef3c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicCompareExchangeWeak(ptr, read_write>, i32, i32) -> __atomic_compare_exchange_result +fn atomicCompareExchangeWeak_e88938() { + var arg_1 = 1; + var arg_2 = 1; + var res = atomicCompareExchangeWeak(&arg_0, arg_1, arg_2); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_e88938(); +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c14dade47d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +groupshared int arg_0; + +void atomicCompareExchangeWeak_e88938() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 atomic_result = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value = arg_1; + InterlockedCompareExchange(arg_0, atomic_compare_value, arg_2, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + atomic_compare_exchange_resulti32 res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_e88938(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c14dade47d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +groupshared int arg_0; + +void atomicCompareExchangeWeak_e88938() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 atomic_result = (atomic_compare_exchange_resulti32)0; + int atomic_compare_value = arg_1; + InterlockedCompareExchange(arg_0, atomic_compare_value, arg_2, atomic_result.old_value); + atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; + atomic_compare_exchange_resulti32 res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicCompareExchangeWeak_e88938(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl new file mode 100644 index 0000000000..2c5d1a394a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl @@ -0,0 +1,31 @@ +#version 310 es + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; + + +shared int arg_0; +void atomicCompareExchangeWeak_e88938() { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 atomic_compare_result; + atomic_compare_result.old_value = atomicCompSwap(arg_0, arg_1, arg_2); + atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; + atomic_compare_exchange_resulti32 res = atomic_compare_result; +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicCompareExchangeWeak_e88938(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl new file mode 100644 index 0000000000..de5d73f584 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; + +struct atomic_compare_exchange_resulti32 { + int old_value; + bool exchanged; +}; +atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(threadgroup atomic_int* atomic, int compare, int value) { + int old_value = compare; + bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed); + return {old_value, exchanged}; +} + +void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int arg_2 = 1; + atomic_compare_exchange_resulti32 res = atomicCompareExchangeWeak_1(tint_symbol, arg_1, arg_2); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicCompareExchangeWeak_e88938(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4e3102de6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicCompareExchangeWeak_e88938 "atomicCompareExchangeWeak_e88938" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32" + OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value" + OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0 + OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %bool = OpTypeBool +%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 + %28 = OpConstantNull %__atomic_compare_exchange_resulti32 + %29 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicCompareExchangeWeak_e88938 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %arg_2 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %28 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %22 = OpLoad %int %arg_2 + %23 = OpLoad %int %arg_1 + %24 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %22 %23 + %25 = OpIEqual %bool %24 %22 + %16 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %24 %25 + OpStore %res %16 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %29 +%local_invocation_index = OpFunctionParameter %uint + %32 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %37 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %39 = OpLabel + %41 = OpLoad %uint %local_invocation_index_1 + %40 = OpFunctionCall %void %compute_main_inner %41 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl new file mode 100644 index 0000000000..3eb4780352 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +var arg_0 : atomic; + +fn atomicCompareExchangeWeak_e88938() { + var arg_1 = 1; + var arg_2 = 1; + var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicCompareExchangeWeak_e88938(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl new file mode 100644 index 0000000000..58fce8a827 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicExchange(ptr, read_write>, u32) -> u32 +fn atomicExchange_0a5dca() { + var arg_1 = 1u; + var res: u32 = atomicExchange(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_0a5dca(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b119a3ff20 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicExchange_0a5dca() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicExchange_0a5dca(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b119a3ff20 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicExchange_0a5dca() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicExchange_0a5dca(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl new file mode 100644 index 0000000000..268ea18e7a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicExchange_0a5dca() { + uint arg_1 = 1u; + uint res = atomicExchange(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicExchange_0a5dca(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl new file mode 100644 index 0000000000..3b21e2f29c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicExchange_0a5dca(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_exchange_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_0a5dca(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm new file mode 100644 index 0000000000..3bbfe18b89 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_0a5dca "atomicExchange_0a5dca" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_0a5dca = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicExchange_0a5dca + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d58d702a6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicExchange_0a5dca() { + var arg_1 = 1u; + var res : u32 = atomicExchange(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_0a5dca(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl new file mode 100644 index 0000000000..08fac93ac0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicExchange(ptr, read_write>, u32) -> u32 +fn atomicExchange_d59712() { + var arg_1 = 1u; + var res: u32 = atomicExchange(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicExchange_d59712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_d59712(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cec9984aab --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_d59712() { + uint arg_1 = 1u; + uint res = tint_atomicExchange(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicExchange_d59712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_d59712(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cec9984aab --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_d59712() { + uint arg_1 = 1u; + uint res = tint_atomicExchange(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicExchange_d59712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_d59712(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl new file mode 100644 index 0000000000..36903e217d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicExchange_d59712() { + uint arg_1 = 1u; + uint res = atomicExchange(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicExchange_d59712(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicExchange_d59712() { + uint arg_1 = 1u; + uint res = atomicExchange(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicExchange_d59712(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl new file mode 100644 index 0000000000..425a34f260 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicExchange_d59712(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicExchange_d59712(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicExchange_d59712(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm new file mode 100644 index 0000000000..2ec90f3908 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_d59712 "atomicExchange_d59712" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicExchange_d59712 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicExchange %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicExchange_d59712 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl new file mode 100644 index 0000000000..5f0d591249 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicExchange_d59712() { + var arg_1 = 1u; + var res : u32 = atomicExchange(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicExchange_d59712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_d59712(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl new file mode 100644 index 0000000000..65473b6f71 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicExchange(ptr, read_write>, i32) -> i32 +fn atomicExchange_e114ba() { + var arg_1 = 1; + var res: i32 = atomicExchange(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_e114ba(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..86842c2267 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicExchange_e114ba() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicExchange_e114ba(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..86842c2267 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicExchange_e114ba() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicExchange_e114ba(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl new file mode 100644 index 0000000000..7eb05f37bd --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicExchange_e114ba() { + int arg_1 = 1; + int res = atomicExchange(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicExchange_e114ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl new file mode 100644 index 0000000000..a7180f6cae --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicExchange_e114ba(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_exchange_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicExchange_e114ba(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e6f0a80e1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicExchange_e114ba "atomicExchange_e114ba" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicExchange_e114ba = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicExchange_e114ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..e9b702730c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicExchange_e114ba() { + var arg_1 = 1; + var res : i32 = atomicExchange(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_e114ba(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl new file mode 100644 index 0000000000..a76f74546c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicExchange(ptr, read_write>, i32) -> i32 +fn atomicExchange_f2e22f() { + var arg_1 = 1; + var res: i32 = atomicExchange(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicExchange_f2e22f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_f2e22f(); +} diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8c0fe233c1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_f2e22f() { + int arg_1 = 1; + int res = tint_atomicExchange(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicExchange_f2e22f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_f2e22f(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c0fe233c1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedExchange(offset, value, original_value); + return original_value; +} + + +void atomicExchange_f2e22f() { + int arg_1 = 1; + int res = tint_atomicExchange(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicExchange_f2e22f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicExchange_f2e22f(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl new file mode 100644 index 0000000000..c74e310d92 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicExchange_f2e22f() { + int arg_1 = 1; + int res = atomicExchange(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicExchange_f2e22f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicExchange_f2e22f() { + int arg_1 = 1; + int res = atomicExchange(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicExchange_f2e22f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl new file mode 100644 index 0000000000..e4e291f80c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicExchange_f2e22f(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicExchange_f2e22f(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicExchange_f2e22f(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm new file mode 100644 index 0000000000..755a537b01 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicExchange_f2e22f "atomicExchange_f2e22f" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicExchange_f2e22f = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicExchange %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicExchange_f2e22f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e874721e6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicExchange_f2e22f() { + var arg_1 = 1; + var res : i32 = atomicExchange(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicExchange_f2e22f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicExchange_f2e22f(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl new file mode 100644 index 0000000000..488d6641ba --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicLoad(ptr, read_write>) -> i32 +fn atomicLoad_0806ad() { + var res: i32 = atomicLoad(&sb_rw.arg_0); +} + +@fragment +fn fragment_main() { + atomicLoad_0806ad(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_0806ad(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a278b2c16c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_0806ad() { + int res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_0806ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_0806ad(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a278b2c16c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + int value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_0806ad() { + int res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_0806ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_0806ad(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl new file mode 100644 index 0000000000..38a8c929f0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl @@ -0,0 +1,44 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicLoad_0806ad() { + int res = atomicOr(sb_rw.arg_0, 0); +} + +void fragment_main() { + atomicLoad_0806ad(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicLoad_0806ad() { + int res = atomicOr(sb_rw.arg_0, 0); +} + +void compute_main() { + atomicLoad_0806ad(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl new file mode 100644 index 0000000000..2335d0d0df --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicLoad_0806ad(device SB_RW* const tint_symbol) { + int res = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicLoad_0806ad(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicLoad_0806ad(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm new file mode 100644 index 0000000000..d961ea5c86 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_0806ad "atomicLoad_0806ad" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int +%atomicLoad_0806ad = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_int Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %9 = OpAtomicLoad %int %15 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicLoad_0806ad + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl new file mode 100644 index 0000000000..06c2703d56 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicLoad_0806ad() { + var res : i32 = atomicLoad(&(sb_rw.arg_0)); +} + +@fragment +fn fragment_main() { + atomicLoad_0806ad(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_0806ad(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl new file mode 100644 index 0000000000..162c19f577 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicLoad(ptr, read_write>) -> u32 +fn atomicLoad_361bf1() { + var res: u32 = atomicLoad(&arg_0); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_361bf1(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f0f031f320 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.dxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicLoad_361bf1() { + uint atomic_result = 0u; + InterlockedOr(arg_0, 0, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicLoad_361bf1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0f031f320 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicLoad_361bf1() { + uint atomic_result = 0u; + InterlockedOr(arg_0, 0, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicLoad_361bf1(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl new file mode 100644 index 0000000000..f56f5a7f6e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es + +shared uint arg_0; +void atomicLoad_361bf1() { + uint res = atomicOr(arg_0, 0u); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicLoad_361bf1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl new file mode 100644 index 0000000000..eedf946e10 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicLoad_361bf1(threadgroup atomic_uint* const tint_symbol) { + uint res = atomic_load_explicit(tint_symbol, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_361bf1(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm new file mode 100644 index 0000000000..20eeca7ef5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_361bf1 "atomicLoad_361bf1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %17 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_361bf1 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %16 + %10 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0 + OpStore %res %10 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %17 +%local_invocation_index = OpFunctionParameter %uint + %20 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %16 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %25 = OpFunctionCall %void %atomicLoad_361bf1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %29 = OpLoad %uint %local_invocation_index_1 + %28 = OpFunctionCall %void %compute_main_inner %29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl new file mode 100644 index 0000000000..2fb4caaf45 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicLoad_361bf1() { + var res : u32 = atomicLoad(&(arg_0)); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_361bf1(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl new file mode 100644 index 0000000000..5b2faf20ff --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicLoad(ptr, read_write>) -> i32 +fn atomicLoad_afcc03() { + var res: i32 = atomicLoad(&arg_0); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_afcc03(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..adf265f6aa --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.dxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicLoad_afcc03() { + int atomic_result = 0; + InterlockedOr(arg_0, 0, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicLoad_afcc03(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..adf265f6aa --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicLoad_afcc03() { + int atomic_result = 0; + InterlockedOr(arg_0, 0, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicLoad_afcc03(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl new file mode 100644 index 0000000000..a290c99b4e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es + +shared int arg_0; +void atomicLoad_afcc03() { + int res = atomicOr(arg_0, 0); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicLoad_afcc03(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl new file mode 100644 index 0000000000..90d483da2f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void atomicLoad_afcc03(threadgroup atomic_int* const tint_symbol) { + int res = atomic_load_explicit(tint_symbol, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicLoad_afcc03(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm new file mode 100644 index 0000000000..b996359601 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicLoad_afcc03 "atomicLoad_afcc03" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %18 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicLoad_afcc03 = OpFunction %void None %7 + %10 = OpLabel + %res = OpVariable %_ptr_Function_int Function %17 + %11 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0 + OpStore %res %11 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %18 +%local_invocation_index = OpFunctionParameter %uint + %21 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %17 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %26 = OpFunctionCall %void %atomicLoad_afcc03 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %28 = OpLabel + %30 = OpLoad %uint %local_invocation_index_1 + %29 = OpFunctionCall %void %compute_main_inner %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl new file mode 100644 index 0000000000..37509cad76 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var arg_0 : atomic; + +fn atomicLoad_afcc03() { + var res : i32 = atomicLoad(&(arg_0)); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_afcc03(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl new file mode 100644 index 0000000000..47b80d7084 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl @@ -0,0 +1,41 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicLoad(ptr, read_write>) -> u32 +fn atomicLoad_fe6cc3() { + var res: u32 = atomicLoad(&sb_rw.arg_0); +} + +@fragment +fn fragment_main() { + atomicLoad_fe6cc3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_fe6cc3(); +} diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..77edab3db2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_fe6cc3() { + uint res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_fe6cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_fe6cc3(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77edab3db2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) { + uint value = 0; + buffer.InterlockedOr(offset, 0, value); + return value; +} + + +void atomicLoad_fe6cc3() { + uint res = tint_atomicLoad(sb_rw, 0u); +} + +void fragment_main() { + atomicLoad_fe6cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicLoad_fe6cc3(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl new file mode 100644 index 0000000000..b4bd0d8472 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl @@ -0,0 +1,44 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicLoad_fe6cc3() { + uint res = atomicOr(sb_rw.arg_0, 0u); +} + +void fragment_main() { + atomicLoad_fe6cc3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicLoad_fe6cc3() { + uint res = atomicOr(sb_rw.arg_0, 0u); +} + +void compute_main() { + atomicLoad_fe6cc3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl new file mode 100644 index 0000000000..e78624ded8 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicLoad_fe6cc3(device SB_RW* const tint_symbol) { + uint res = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicLoad_fe6cc3(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicLoad_fe6cc3(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm new file mode 100644 index 0000000000..776c62c09f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicLoad_fe6cc3 "atomicLoad_fe6cc3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%atomicLoad_fe6cc3 = OpFunction %void None %5 + %8 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %17 + %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %9 = OpAtomicLoad %uint %14 %uint_1 %uint_0 + OpStore %res %9 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicLoad_fe6cc3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl new file mode 100644 index 0000000000..8691467386 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicLoad_fe6cc3() { + var res : u32 = atomicLoad(&(sb_rw.arg_0)); +} + +@fragment +fn fragment_main() { + atomicLoad_fe6cc3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicLoad_fe6cc3(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl new file mode 100644 index 0000000000..d6cce3d1c6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMax(ptr, read_write>, u32) -> u32 +fn atomicMax_51b9be() { + var arg_1 = 1u; + var res: u32 = atomicMax(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicMax_51b9be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_51b9be(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..174521d4e0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_51b9be() { + uint arg_1 = 1u; + uint res = tint_atomicMax(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMax_51b9be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_51b9be(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..174521d4e0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_51b9be() { + uint arg_1 = 1u; + uint res = tint_atomicMax(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMax_51b9be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_51b9be(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl new file mode 100644 index 0000000000..947c35ceaf --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicMax_51b9be() { + uint arg_1 = 1u; + uint res = atomicMax(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicMax_51b9be(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicMax_51b9be() { + uint arg_1 = 1u; + uint res = atomicMax(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicMax_51b9be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl new file mode 100644 index 0000000000..71acd56b54 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicMax_51b9be(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicMax_51b9be(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicMax_51b9be(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm new file mode 100644 index 0000000000..97bae6a5c4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_51b9be "atomicMax_51b9be" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMax_51b9be = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicUMax %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMax_51b9be + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl new file mode 100644 index 0000000000..a786881a2b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMax_51b9be() { + var arg_1 = 1u; + var res : u32 = atomicMax(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicMax_51b9be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_51b9be(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl new file mode 100644 index 0000000000..cf887387c3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMax(ptr, read_write>, i32) -> i32 +fn atomicMax_92aa72() { + var arg_1 = 1; + var res: i32 = atomicMax(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicMax_92aa72(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_92aa72(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a649f98afb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_92aa72() { + int arg_1 = 1; + int res = tint_atomicMax(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMax_92aa72(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_92aa72(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a649f98afb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMax(offset, value, original_value); + return original_value; +} + + +void atomicMax_92aa72() { + int arg_1 = 1; + int res = tint_atomicMax(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMax_92aa72(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMax_92aa72(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl new file mode 100644 index 0000000000..326e6edf3b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicMax_92aa72() { + int arg_1 = 1; + int res = atomicMax(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicMax_92aa72(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicMax_92aa72() { + int arg_1 = 1; + int res = atomicMax(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicMax_92aa72(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl new file mode 100644 index 0000000000..9fefd97c6b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicMax_92aa72(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicMax_92aa72(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicMax_92aa72(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6ff30ef3a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMax_92aa72 "atomicMax_92aa72" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicMax_92aa72 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicSMax %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicMax_92aa72 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5039e52a3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMax_92aa72() { + var arg_1 = 1; + var res : i32 = atomicMax(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicMax_92aa72(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_92aa72(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl new file mode 100644 index 0000000000..d08a51bcd9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMax(ptr, read_write>, i32) -> i32 +fn atomicMax_a89cc3() { + var arg_1 = 1; + var res: i32 = atomicMax(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_a89cc3(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f4f6cb431 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicMax_a89cc3() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedMax(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMax_a89cc3(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5f4f6cb431 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicMax_a89cc3() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedMax(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMax_a89cc3(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl new file mode 100644 index 0000000000..cfc9b4f608 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicMax_a89cc3() { + int arg_1 = 1; + int res = atomicMax(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicMax_a89cc3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl new file mode 100644 index 0000000000..a067fcd7c2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicMax_a89cc3(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_max_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_a89cc3(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm new file mode 100644 index 0000000000..2864a14479 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_a89cc3 "atomicMax_a89cc3" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_a89cc3 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicMax_a89cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl new file mode 100644 index 0000000000..10ed82e499 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicMax_a89cc3() { + var arg_1 = 1; + var res : i32 = atomicMax(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_a89cc3(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl new file mode 100644 index 0000000000..b80c65f8ed --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMax(ptr, read_write>, u32) -> u32 +fn atomicMax_beccfc() { + var arg_1 = 1u; + var res: u32 = atomicMax(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_beccfc(); +} diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..acdda2c11f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicMax_beccfc() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMax(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMax_beccfc(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..acdda2c11f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicMax_beccfc() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMax(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMax_beccfc(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl new file mode 100644 index 0000000000..b68a3e2163 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicMax_beccfc() { + uint arg_1 = 1u; + uint res = atomicMax(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicMax_beccfc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl new file mode 100644 index 0000000000..96c5d283a2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicMax_beccfc(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_max_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMax_beccfc(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm new file mode 100644 index 0000000000..03577ee568 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMax_beccfc "atomicMax_beccfc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMax_beccfc = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicMax_beccfc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl new file mode 100644 index 0000000000..22cf4aab39 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicMax_beccfc() { + var arg_1 = 1u; + var res : u32 = atomicMax(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMax_beccfc(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl new file mode 100644 index 0000000000..1ac338c1b9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMin(ptr, read_write>, i32) -> i32 +fn atomicMin_278235() { + var arg_1 = 1; + var res: i32 = atomicMin(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_278235(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..06c49cd013 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicMin_278235() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedMin(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMin_278235(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..06c49cd013 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicMin_278235() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedMin(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMin_278235(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl new file mode 100644 index 0000000000..e27c1f1348 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicMin_278235() { + int arg_1 = 1; + int res = atomicMin(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicMin_278235(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl new file mode 100644 index 0000000000..8443629b2a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicMin_278235(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_min_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_278235(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm new file mode 100644 index 0000000000..ddfa25a7f9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_278235 "atomicMin_278235" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_278235 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicMin_278235 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl new file mode 100644 index 0000000000..79955631a0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicMin_278235() { + var arg_1 = 1; + var res : i32 = atomicMin(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_278235(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl new file mode 100644 index 0000000000..164a4c040d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicMin(ptr, read_write>, u32) -> u32 +fn atomicMin_69d383() { + var arg_1 = 1u; + var res: u32 = atomicMin(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_69d383(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1c16fc8ba1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicMin_69d383() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMin(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMin_69d383(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c16fc8ba1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicMin_69d383() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedMin(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicMin_69d383(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl new file mode 100644 index 0000000000..c14fbe6b79 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicMin_69d383() { + uint arg_1 = 1u; + uint res = atomicMin(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicMin_69d383(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl new file mode 100644 index 0000000000..c04290f7a2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicMin_69d383(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_min_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicMin_69d383(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm new file mode 100644 index 0000000000..784a0143e3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicMin_69d383 "atomicMin_69d383" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicMin_69d383 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicMin_69d383 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0fd2ad915 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicMin_69d383() { + var arg_1 = 1u; + var res : u32 = atomicMin(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_69d383(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl new file mode 100644 index 0000000000..6da76be0f2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMin(ptr, read_write>, i32) -> i32 +fn atomicMin_8e38dc() { + var arg_1 = 1; + var res: i32 = atomicMin(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicMin_8e38dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_8e38dc(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ff4793b2c5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_8e38dc() { + int arg_1 = 1; + int res = tint_atomicMin(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMin_8e38dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_8e38dc(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ff4793b2c5 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_8e38dc() { + int arg_1 = 1; + int res = tint_atomicMin(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMin_8e38dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_8e38dc(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl new file mode 100644 index 0000000000..215a335101 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicMin_8e38dc() { + int arg_1 = 1; + int res = atomicMin(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicMin_8e38dc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicMin_8e38dc() { + int arg_1 = 1; + int res = atomicMin(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicMin_8e38dc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl new file mode 100644 index 0000000000..d670f6f671 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicMin_8e38dc(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicMin_8e38dc(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicMin_8e38dc(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm new file mode 100644 index 0000000000..f2ca9b8e59 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_8e38dc "atomicMin_8e38dc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicMin_8e38dc = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicSMin %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicMin_8e38dc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl new file mode 100644 index 0000000000..61d4a1eabe --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMin_8e38dc() { + var arg_1 = 1; + var res : i32 = atomicMin(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicMin_8e38dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_8e38dc(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl new file mode 100644 index 0000000000..ac0e9af86d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicMin(ptr, read_write>, u32) -> u32 +fn atomicMin_c67a74() { + var arg_1 = 1u; + var res: u32 = atomicMin(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicMin_c67a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_c67a74(); +} diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae974e3f7a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_c67a74() { + uint arg_1 = 1u; + uint res = tint_atomicMin(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMin_c67a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_c67a74(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ae974e3f7a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedMin(offset, value, original_value); + return original_value; +} + + +void atomicMin_c67a74() { + uint arg_1 = 1u; + uint res = tint_atomicMin(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicMin_c67a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicMin_c67a74(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl new file mode 100644 index 0000000000..4d5b79bf23 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicMin_c67a74() { + uint arg_1 = 1u; + uint res = atomicMin(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicMin_c67a74(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicMin_c67a74() { + uint arg_1 = 1u; + uint res = atomicMin(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicMin_c67a74(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl new file mode 100644 index 0000000000..86f2cf2db9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicMin_c67a74(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicMin_c67a74(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicMin_c67a74(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm new file mode 100644 index 0000000000..f3cc67b6e6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicMin_c67a74 "atomicMin_c67a74" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicMin_c67a74 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicUMin %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMin_c67a74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl new file mode 100644 index 0000000000..880c6a673d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicMin_c67a74() { + var arg_1 = 1u; + var res : u32 = atomicMin(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicMin_c67a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicMin_c67a74(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl new file mode 100644 index 0000000000..40170684b7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicOr(ptr, read_write>, u32) -> u32 +fn atomicOr_5e3d61() { + var arg_1 = 1u; + var res: u32 = atomicOr(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_5e3d61(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..80cf20e811 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicOr_5e3d61() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedOr(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicOr_5e3d61(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80cf20e811 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicOr_5e3d61() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedOr(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicOr_5e3d61(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl new file mode 100644 index 0000000000..23ddd2e722 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicOr_5e3d61() { + uint arg_1 = 1u; + uint res = atomicOr(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicOr_5e3d61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl new file mode 100644 index 0000000000..0801fc9e4e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicOr_5e3d61(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_or_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_5e3d61(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm new file mode 100644 index 0000000000..9db7191d2f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_5e3d61 "atomicOr_5e3d61" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_5e3d61 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicOr_5e3d61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl new file mode 100644 index 0000000000..c88c5a9b99 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicOr_5e3d61() { + var arg_1 = 1u; + var res : u32 = atomicOr(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_5e3d61(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl new file mode 100644 index 0000000000..6219ffe235 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicOr(ptr, read_write>, u32) -> u32 +fn atomicOr_5e95d4() { + var arg_1 = 1u; + var res: u32 = atomicOr(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicOr_5e95d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_5e95d4(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2df87d268b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_5e95d4() { + uint arg_1 = 1u; + uint res = tint_atomicOr(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicOr_5e95d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_5e95d4(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2df87d268b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_5e95d4() { + uint arg_1 = 1u; + uint res = tint_atomicOr(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicOr_5e95d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_5e95d4(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl new file mode 100644 index 0000000000..ddd41fedb0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicOr_5e95d4() { + uint arg_1 = 1u; + uint res = atomicOr(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicOr_5e95d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicOr_5e95d4() { + uint arg_1 = 1u; + uint res = atomicOr(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicOr_5e95d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl new file mode 100644 index 0000000000..f6a899e24b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicOr_5e95d4(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicOr_5e95d4(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicOr_5e95d4(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..c38fc528ec --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_5e95d4 "atomicOr_5e95d4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicOr_5e95d4 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicOr %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicOr_5e95d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..c9d86b6030 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicOr_5e95d4() { + var arg_1 = 1u; + var res : u32 = atomicOr(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicOr_5e95d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_5e95d4(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl new file mode 100644 index 0000000000..8b7f6bc5e8 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicOr(ptr, read_write>, i32) -> i32 +fn atomicOr_8d96a0() { + var arg_1 = 1; + var res: i32 = atomicOr(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicOr_8d96a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_8d96a0(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b3d4bb9f5d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_8d96a0() { + int arg_1 = 1; + int res = tint_atomicOr(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicOr_8d96a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_8d96a0(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b3d4bb9f5d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedOr(offset, value, original_value); + return original_value; +} + + +void atomicOr_8d96a0() { + int arg_1 = 1; + int res = tint_atomicOr(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicOr_8d96a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicOr_8d96a0(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl new file mode 100644 index 0000000000..237e6b0b54 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicOr_8d96a0() { + int arg_1 = 1; + int res = atomicOr(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicOr_8d96a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicOr_8d96a0() { + int arg_1 = 1; + int res = atomicOr(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicOr_8d96a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl new file mode 100644 index 0000000000..e21e22d1a8 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicOr_8d96a0(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicOr_8d96a0(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicOr_8d96a0(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..978e4ad7b2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicOr_8d96a0 "atomicOr_8d96a0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicOr_8d96a0 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicOr %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicOr_8d96a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd513803b2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicOr_8d96a0() { + var arg_1 = 1; + var res : i32 = atomicOr(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicOr_8d96a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_8d96a0(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl new file mode 100644 index 0000000000..6058d4155f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicOr(ptr, read_write>, i32) -> i32 +fn atomicOr_d09248() { + var arg_1 = 1; + var res: i32 = atomicOr(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_d09248(); +} diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..04e7f92200 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicOr_d09248() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedOr(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicOr_d09248(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04e7f92200 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicOr_d09248() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedOr(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicOr_d09248(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl new file mode 100644 index 0000000000..d601550281 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicOr_d09248() { + int arg_1 = 1; + int res = atomicOr(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicOr_d09248(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl new file mode 100644 index 0000000000..7569a487d4 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicOr_d09248(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_or_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicOr_d09248(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a5541c37d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicOr_d09248 "atomicOr_d09248" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicOr_d09248 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicOr_d09248 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl new file mode 100644 index 0000000000..c8ae9e1efb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicOr_d09248() { + var arg_1 = 1; + var res : i32 = atomicOr(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicOr_d09248(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl new file mode 100644 index 0000000000..93846e1005 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicStore(ptr, read_write>, u32) +fn atomicStore_726882() { + var arg_1 = 1u; + atomicStore(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_726882(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4bff9093d2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.dxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicStore_726882() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicStore_726882(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bff9093d2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared uint arg_0; + +void atomicStore_726882() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedExchange(arg_0, arg_1, atomic_result); +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicStore_726882(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl new file mode 100644 index 0000000000..96fecad817 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicStore_726882() { + uint arg_1 = 1u; + atomicExchange(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicStore_726882(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl new file mode 100644 index 0000000000..a6a35a9da2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicStore_726882(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + atomic_store_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_726882(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm new file mode 100644 index 0000000000..72d2c5fc56 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_726882 "atomicStore_726882" + OpName %arg_1 "arg_1" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %19 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_726882 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + OpAtomicStore %arg_0 %uint_2 %uint_0 %18 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %19 +%local_invocation_index = OpFunctionParameter %uint + %22 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %27 = OpFunctionCall %void %atomicStore_726882 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %31 = OpLoad %uint %local_invocation_index_1 + %30 = OpFunctionCall %void %compute_main_inner %31 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl new file mode 100644 index 0000000000..a49ac811b1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicStore_726882() { + var arg_1 = 1u; + atomicStore(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_726882(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl new file mode 100644 index 0000000000..c73fcab73f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicStore(ptr, read_write>, i32) +fn atomicStore_8bea94() { + var arg_1 = 1; + atomicStore(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_8bea94(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..35781aba87 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.dxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicStore_8bea94() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicStore_8bea94(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..35781aba87 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +groupshared int arg_0; + +void atomicStore_8bea94() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedExchange(arg_0, arg_1, atomic_result); +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicStore_8bea94(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl new file mode 100644 index 0000000000..c0d2497a4e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicStore_8bea94() { + int arg_1 = 1; + atomicExchange(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicStore_8bea94(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl new file mode 100644 index 0000000000..7a984c2a55 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicStore_8bea94(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + atomic_store_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicStore_8bea94(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0c7fb72f9 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicStore_8bea94 "atomicStore_8bea94" + OpName %arg_1 "arg_1" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicStore_8bea94 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + OpAtomicStore %arg_0 %uint_2 %uint_0 %19 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicStore_8bea94 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl new file mode 100644 index 0000000000..637085b9d2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicStore_8bea94() { + var arg_1 = 1; + atomicStore(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_8bea94(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl new file mode 100644 index 0000000000..d109ef7ebb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicStore(ptr, read_write>, u32) +fn atomicStore_cdc29e() { + var arg_1 = 1u; + atomicStore(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicStore_cdc29e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_cdc29e(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..253ad312c0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) { + uint ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_cdc29e() { + uint arg_1 = 1u; + tint_atomicStore(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicStore_cdc29e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_cdc29e(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..253ad312c0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) { + uint ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_cdc29e() { + uint arg_1 = 1u; + tint_atomicStore(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicStore_cdc29e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_cdc29e(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl new file mode 100644 index 0000000000..22fd7a19f1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicStore_cdc29e() { + uint arg_1 = 1u; + atomicExchange(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicStore_cdc29e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicStore_cdc29e() { + uint arg_1 = 1u; + atomicExchange(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicStore_cdc29e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl new file mode 100644 index 0000000000..be5057e21f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicStore_cdc29e(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + atomic_store_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicStore_cdc29e(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicStore_cdc29e(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm new file mode 100644 index 0000000000..f0d74fe1cf --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_cdc29e "atomicStore_cdc29e" + OpName %arg_1 "arg_1" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicStore_cdc29e = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + OpAtomicStore %17 %uint_1 %uint_0 %18 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicStore_cdc29e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl new file mode 100644 index 0000000000..437c69e81c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicStore_cdc29e() { + var arg_1 = 1u; + atomicStore(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicStore_cdc29e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_cdc29e(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl new file mode 100644 index 0000000000..50d4d3bf92 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicStore(ptr, read_write>, i32) +fn atomicStore_d1e9a6() { + var arg_1 = 1; + atomicStore(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicStore_d1e9a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_d1e9a6(); +} diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bb02128e2d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_d1e9a6() { + int arg_1 = 1; + tint_atomicStore(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicStore_d1e9a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_d1e9a6(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bb02128e2d --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) { + int ignored; + buffer.InterlockedExchange(offset, value, ignored); +} + + +void atomicStore_d1e9a6() { + int arg_1 = 1; + tint_atomicStore(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicStore_d1e9a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicStore_d1e9a6(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl new file mode 100644 index 0000000000..f5e52e4b19 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicStore_d1e9a6() { + int arg_1 = 1; + atomicExchange(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicStore_d1e9a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicStore_d1e9a6() { + int arg_1 = 1; + atomicExchange(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicStore_d1e9a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl new file mode 100644 index 0000000000..9ef1a4f620 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicStore_d1e9a6(device SB_RW* const tint_symbol) { + int arg_1 = 1; + atomic_store_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicStore_d1e9a6(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicStore_d1e9a6(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d03e4ee54 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicStore_d1e9a6 "atomicStore_d1e9a6" + OpName %arg_1 "arg_1" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicStore_d1e9a6 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + OpAtomicStore %19 %uint_1 %uint_0 %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicStore_d1e9a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..6548753bb2 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicStore_d1e9a6() { + var arg_1 = 1; + atomicStore(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicStore_d1e9a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicStore_d1e9a6(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl new file mode 100644 index 0000000000..9e8fe1440c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicSub(ptr, read_write>, i32) -> i32 +fn atomicSub_051100() { + var arg_1 = 1; + var res: i32 = atomicSub(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicSub_051100(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_051100(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eac50d325c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_051100() { + int arg_1 = 1; + int res = tint_atomicSub(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicSub_051100(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_051100(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..eac50d325c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_051100() { + int arg_1 = 1; + int res = tint_atomicSub(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicSub_051100(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_051100(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl new file mode 100644 index 0000000000..25f8eba74f --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicSub_051100() { + int arg_1 = 1; + int res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicSub_051100(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicSub_051100() { + int arg_1 = 1; + int res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicSub_051100(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl new file mode 100644 index 0000000000..695c08502c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicSub_051100(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicSub_051100(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicSub_051100(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm new file mode 100644 index 0000000000..3bbf26a4b0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_051100 "atomicSub_051100" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicSub_051100 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicISub %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicSub_051100 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl new file mode 100644 index 0000000000..6eecb4f561 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicSub_051100() { + var arg_1 = 1; + var res : i32 = atomicSub(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicSub_051100(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_051100(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl new file mode 100644 index 0000000000..6113cf9ca6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicSub(ptr, read_write>, u32) -> u32 +fn atomicSub_0d26c2() { + var arg_1 = 1u; + var res: u32 = atomicSub(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_0d26c2(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abced13695 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicSub_0d26c2() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicSub_0d26c2(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..abced13695 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicSub_0d26c2() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedAdd(arg_0, -arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicSub_0d26c2(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl new file mode 100644 index 0000000000..739fc9e262 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicSub_0d26c2() { + uint arg_1 = 1u; + uint res = atomicAdd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicSub_0d26c2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl new file mode 100644 index 0000000000..2f510de4d8 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicSub_0d26c2(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_sub_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_0d26c2(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c6b98e511 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_0d26c2 "atomicSub_0d26c2" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_0d26c2 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicSub_0d26c2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl new file mode 100644 index 0000000000..1f5446e9aa --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicSub_0d26c2() { + var arg_1 = 1u; + var res : u32 = atomicSub(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_0d26c2(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl new file mode 100644 index 0000000000..e676cc28f6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicSub(ptr, read_write>, u32) -> u32 +fn atomicSub_15bfc9() { + var arg_1 = 1u; + var res: u32 = atomicSub(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicSub_15bfc9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_15bfc9(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..166f709699 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_15bfc9() { + uint arg_1 = 1u; + uint res = tint_atomicSub(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicSub_15bfc9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_15bfc9(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..166f709699 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedAdd(offset, -value, original_value); + return original_value; +} + + +void atomicSub_15bfc9() { + uint arg_1 = 1u; + uint res = tint_atomicSub(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicSub_15bfc9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicSub_15bfc9(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl new file mode 100644 index 0000000000..c21f8f7cd7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicSub_15bfc9() { + uint arg_1 = 1u; + uint res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicSub_15bfc9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicSub_15bfc9() { + uint arg_1 = 1u; + uint res = atomicAdd(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicSub_15bfc9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl new file mode 100644 index 0000000000..c664e5a307 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicSub_15bfc9(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicSub_15bfc9(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicSub_15bfc9(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d20c6d426 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicSub_15bfc9 "atomicSub_15bfc9" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicSub_15bfc9 = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicISub %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicSub_15bfc9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl new file mode 100644 index 0000000000..ea7a046dea --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicSub_15bfc9() { + var arg_1 = 1u; + var res : u32 = atomicSub(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicSub_15bfc9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_15bfc9(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl new file mode 100644 index 0000000000..bfc8f99eb0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicSub(ptr, read_write>, i32) -> i32 +fn atomicSub_77883a() { + var arg_1 = 1; + var res: i32 = atomicSub(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_77883a(); +} diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dcc2e250ba --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicSub_77883a() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, -arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicSub_77883a(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dcc2e250ba --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicSub_77883a() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedAdd(arg_0, -arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicSub_77883a(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl new file mode 100644 index 0000000000..02de7e66d0 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicSub_77883a() { + int arg_1 = 1; + int res = atomicAdd(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicSub_77883a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl new file mode 100644 index 0000000000..2e54b645c7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicSub_77883a(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_sub_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicSub_77883a(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm new file mode 100644 index 0000000000..d96432dd36 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicSub_77883a "atomicSub_77883a" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicSub_77883a = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicSub_77883a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c35436eeb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicSub_77883a() { + var arg_1 = 1; + var res : i32 = atomicSub(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicSub_77883a(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl new file mode 100644 index 0000000000..7eeb0dcf73 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicXor(ptr, read_write>, u32) -> u32 +fn atomicXor_54510e() { + var arg_1 = 1u; + var res: u32 = atomicXor(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicXor_54510e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_54510e(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d745f1232c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_54510e() { + uint arg_1 = 1u; + uint res = tint_atomicXor(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicXor_54510e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_54510e(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d745f1232c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) { + uint original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_54510e() { + uint arg_1 = 1u; + uint res = tint_atomicXor(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicXor_54510e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_54510e(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl new file mode 100644 index 0000000000..7ac44209ed --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicXor_54510e() { + uint arg_1 = 1u; + uint res = atomicXor(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicXor_54510e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + uint arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + uint arg_0; +} sb_rw; +void atomicXor_54510e() { + uint arg_1 = 1u; + uint res = atomicXor(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicXor_54510e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl new file mode 100644 index 0000000000..fc578f9d66 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_uint arg_0; +}; + +void atomicXor_54510e(device SB_RW* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicXor_54510e(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicXor_54510e(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm new file mode 100644 index 0000000000..a16daff5f6 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_54510e "atomicXor_54510e" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %uint = OpTypeInt 32 0 + %SB_RW = OpTypeStruct %uint +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %12 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%atomicXor_54510e = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %12 + %res = OpVariable %_ptr_Function_uint Function %12 + OpStore %arg_1 %uint_1 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 + %18 = OpLoad %uint %arg_1 + %13 = OpAtomicXor %uint %17 %uint_1 %uint_0 %18 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicXor_54510e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl new file mode 100644 index 0000000000..873a86320e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicXor_54510e() { + var arg_1 = 1u; + var res : u32 = atomicXor(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicXor_54510e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_54510e(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl new file mode 100644 index 0000000000..0f3352b950 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicXor(ptr, read_write>, i32) -> i32 +fn atomicXor_75dc95() { + var arg_1 = 1; + var res: i32 = atomicXor(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_75dc95(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a93c5dc2fb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicXor_75dc95() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedXor(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicXor_75dc95(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a93c5dc2fb --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared int arg_0; + +void atomicXor_75dc95() { + int arg_1 = 1; + int atomic_result = 0; + InterlockedXor(arg_0, arg_1, atomic_result); + int res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + int atomic_result_1 = 0; + InterlockedExchange(arg_0, 0, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicXor_75dc95(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl new file mode 100644 index 0000000000..207bfd41b3 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared int arg_0; +void atomicXor_75dc95() { + int arg_1 = 1; + int res = atomicXor(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0); + } + barrier(); + atomicXor_75dc95(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl new file mode 100644 index 0000000000..afad14bc2e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicXor_75dc95(threadgroup atomic_int* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_xor_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_75dc95(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_int tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm new file mode 100644 index 0000000000..62e03513cf --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_75dc95 "atomicXor_75dc95" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %21 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_75dc95 = OpFunction %void None %7 + %10 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %14 + %res = OpVariable %_ptr_Function_int Function %14 + OpStore %arg_1 %int_1 + %19 = OpLoad %int %arg_1 + %15 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %19 + OpStore %res %15 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %21 +%local_invocation_index = OpFunctionParameter %uint + %24 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %14 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %29 = OpFunctionCall %void %atomicXor_75dc95 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %7 + %31 = OpLabel + %33 = OpLoad %uint %local_invocation_index_1 + %32 = OpFunctionCall %void %compute_main_inner %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf056861ac --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicXor_75dc95() { + var arg_1 = 1; + var res : i32 = atomicXor(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_75dc95(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl new file mode 100644 index 0000000000..d74dc91191 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl @@ -0,0 +1,42 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +struct SB_RW { + arg_0: atomic, +}; +@group(0) @binding(0) var sb_rw : SB_RW; + +// fn atomicXor(ptr, read_write>, i32) -> i32 +fn atomicXor_c1b78c() { + var arg_1 = 1; + var res: i32 = atomicXor(&sb_rw.arg_0, arg_1); +} + +@fragment +fn fragment_main() { + atomicXor_c1b78c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_c1b78c(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..df83cd93d1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_c1b78c() { + int arg_1 = 1; + int res = tint_atomicXor(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicXor_c1b78c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_c1b78c(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..df83cd93d1 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +RWByteAddressBuffer sb_rw : register(u0, space0); + +int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) { + int original_value = 0; + buffer.InterlockedXor(offset, value, original_value); + return original_value; +} + + +void atomicXor_c1b78c() { + int arg_1 = 1; + int res = tint_atomicXor(sb_rw, 0u, arg_1); +} + +void fragment_main() { + atomicXor_c1b78c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + atomicXor_c1b78c(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl new file mode 100644 index 0000000000..3f8236cd0a --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es +precision mediump float; + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicXor_c1b78c() { + int arg_1 = 1; + int res = atomicXor(sb_rw.arg_0, arg_1); +} + +void fragment_main() { + atomicXor_c1b78c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct SB_RW { + int arg_0; +}; + +layout(binding = 0, std430) buffer SB_RW_1 { + int arg_0; +} sb_rw; +void atomicXor_c1b78c() { + int arg_1 = 1; + int res = atomicXor(sb_rw.arg_0, arg_1); +} + +void compute_main() { + atomicXor_c1b78c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl new file mode 100644 index 0000000000..1dba5012bc --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct SB_RW { + /* 0x0000 */ atomic_int arg_0; +}; + +void atomicXor_c1b78c(device SB_RW* const tint_symbol) { + int arg_1 = 1; + int res = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed); +} + +fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) { + atomicXor_c1b78c(tint_symbol_1); + return; +} + +kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) { + atomicXor_c1b78c(tint_symbol_2); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm new file mode 100644 index 0000000000..cff5564090 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %SB_RW "SB_RW" + OpMemberName %SB_RW 0 "arg_0" + OpName %sb_rw "sb_rw" + OpName %atomicXor_c1b78c "atomicXor_c1b78c" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %SB_RW Block + OpMemberDecorate %SB_RW 0 Offset 0 + OpDecorate %sb_rw DescriptorSet 0 + OpDecorate %sb_rw Binding 0 + %int = OpTypeInt 32 1 + %SB_RW = OpTypeStruct %int +%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW + %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%atomicXor_c1b78c = OpFunction %void None %5 + %8 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %12 + %res = OpVariable %_ptr_Function_int Function %12 + OpStore %arg_1 %int_1 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 + %20 = OpLoad %int %arg_1 + %13 = OpAtomicXor %int %19 %uint_1 %uint_0 %20 + OpStore %res %13 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %5 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %5 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicXor_c1b78c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl new file mode 100644 index 0000000000..f26d9de339 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +struct SB_RW { + arg_0 : atomic, +} + +@group(0) @binding(0) var sb_rw : SB_RW; + +fn atomicXor_c1b78c() { + var arg_1 = 1; + var res : i32 = atomicXor(&(sb_rw.arg_0), arg_1); +} + +@fragment +fn fragment_main() { + atomicXor_c1b78c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_c1b78c(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl new file mode 100644 index 0000000000..3596bc8d2c --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl @@ -0,0 +1,34 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +var arg_0: atomic; + +// fn atomicXor(ptr, read_write>, u32) -> u32 +fn atomicXor_c8e6be() { + var arg_1 = 1u; + var res: u32 = atomicXor(&arg_0, arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_c8e6be(); +} diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18b6de75b7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.dxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicXor_c8e6be() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedXor(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicXor_c8e6be(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..18b6de75b7 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +groupshared uint arg_0; + +void atomicXor_c8e6be() { + uint arg_1 = 1u; + uint atomic_result = 0u; + InterlockedXor(arg_0, arg_1, atomic_result); + uint res = atomic_result; +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void compute_main_inner(uint local_invocation_index) { + { + uint atomic_result_1 = 0u; + InterlockedExchange(arg_0, 0u, atomic_result_1); + } + GroupMemoryBarrierWithGroupSync(); + atomicXor_c8e6be(); +} + +[numthreads(1, 1, 1)] +void compute_main(tint_symbol_1 tint_symbol) { + compute_main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl new file mode 100644 index 0000000000..36660a3903 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es + +shared uint arg_0; +void atomicXor_c8e6be() { + uint arg_1 = 1u; + uint res = atomicXor(arg_0, arg_1); +} + +void compute_main(uint local_invocation_index) { + { + atomicExchange(arg_0, 0u); + } + barrier(); + atomicXor_c8e6be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl new file mode 100644 index 0000000000..0f81e1e78b --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +void atomicXor_c8e6be(threadgroup atomic_uint* const tint_symbol) { + uint arg_1 = 1u; + uint res = atomic_fetch_xor_explicit(tint_symbol, arg_1, memory_order_relaxed); +} + +void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) { + { + atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed); + } + threadgroup_barrier(mem_flags::mem_threadgroup); + atomicXor_c8e6be(tint_symbol_1); +} + +kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup atomic_uint tint_symbol_2; + compute_main_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba98e8dc4e --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1 + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %arg_0 "arg_0" + OpName %atomicXor_c8e6be "atomicXor_c8e6be" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %compute_main_inner "compute_main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %compute_main "compute_main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint + %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %13 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %uint_0 = OpConstant %uint 0 + %20 = OpTypeFunction %void %uint + %uint_264 = OpConstant %uint 264 +%atomicXor_c8e6be = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 + OpStore %arg_1 %uint_1 + %18 = OpLoad %uint %arg_1 + %14 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %18 + OpStore %res %14 + OpReturn + OpFunctionEnd +%compute_main_inner = OpFunction %void None %20 +%local_invocation_index = OpFunctionParameter %uint + %23 = OpLabel + OpAtomicStore %arg_0 %uint_2 %uint_0 %13 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %28 = OpFunctionCall %void %atomicXor_c8e6be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %32 = OpLoad %uint %local_invocation_index_1 + %31 = OpFunctionCall %void %compute_main_inner %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cf4fef326 --- /dev/null +++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var arg_0 : atomic; + +fn atomicXor_c8e6be() { + var arg_1 = 1u; + var res : u32 = atomicXor(&(arg_0), arg_1); +} + +@compute @workgroup_size(1) +fn compute_main() { + atomicXor_c8e6be(); +} diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl new file mode 100644 index 0000000000..a248d8656e --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<3, f16>) -> vec<3, f16> +fn ceil_09bf52() { + var arg_0 = vec3(f16()); + var res: vec3 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_09bf52(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_09bf52(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_09bf52(); +} diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f513773952 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_09bf52() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_09bf52(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_09bf52(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..75dab64c24 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void ceil_09bf52() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_09bf52(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_09bf52(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A987B49660(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A987B49660(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.glsl new file mode 100644 index 0000000000..252778dc52 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_09bf52() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_09bf52(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_09bf52() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = ceil(arg_0); +} + +void fragment_main() { + ceil_09bf52(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_09bf52() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = ceil(arg_0); +} + +void compute_main() { + ceil_09bf52(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.msl new file mode 100644 index 0000000000..9ee766b625 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_09bf52() { + half3 arg_0 = half3(0.0h); + half3 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_09bf52(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_09bf52(); + return; +} + +kernel void compute_main() { + ceil_09bf52(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcc2ae08bd --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_09bf52 "ceil_09bf52" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_09bf52 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Ceil %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %ceil_09bf52 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_09bf52 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ceil_09bf52 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.wgsl new file mode 100644 index 0000000000..c190c8922a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/09bf52.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn ceil_09bf52() { + var arg_0 = vec3(f16()); + var res : vec3 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_09bf52(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_09bf52(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_09bf52(); +} diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl new file mode 100644 index 0000000000..76d060cfea --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<2, f16>) -> vec<2, f16> +fn ceil_18c240() { + var arg_0 = vec2(f16()); + var res: vec2 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_18c240(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_18c240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_18c240(); +} diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5080e4666a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_18c240() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_18c240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_18c240(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c34ea03ed3 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void ceil_18c240() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_18c240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_18c240(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F7F15A6FA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F7F15A6FA0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.glsl new file mode 100644 index 0000000000..5b75aaacd1 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_18c240() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_18c240(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_18c240() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = ceil(arg_0); +} + +void fragment_main() { + ceil_18c240(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_18c240() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = ceil(arg_0); +} + +void compute_main() { + ceil_18c240(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.msl new file mode 100644 index 0000000000..dab2bcc65f --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_18c240() { + half2 arg_0 = half2(0.0h); + half2 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_18c240(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_18c240(); + return; +} + +kernel void compute_main() { + ceil_18c240(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.spvasm new file mode 100644 index 0000000000..2bb39dee3f --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_18c240 "ceil_18c240" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_18c240 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Ceil %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %ceil_18c240 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_18c240 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ceil_18c240 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.wgsl new file mode 100644 index 0000000000..aaf0fad6bd --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/18c240.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn ceil_18c240() { + var arg_0 = vec2(f16()); + var res : vec2 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_18c240(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_18c240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_18c240(); +} diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl new file mode 100644 index 0000000000..9d5569310e --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(vec<3, f32>) -> vec<3, f32> +fn ceil_34064b() { + var arg_0 = vec3(1.f); + var res: vec3 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_34064b(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_34064b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_34064b(); +} diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cf62426b25 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_34064b() { + float3 arg_0 = (1.0f).xxx; + float3 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_34064b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_34064b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_34064b(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cf62426b25 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void ceil_34064b() { + float3 arg_0 = (1.0f).xxx; + float3 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_34064b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_34064b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_34064b(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl new file mode 100644 index 0000000000..068e52ae00 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void ceil_34064b() { + vec3 arg_0 = vec3(1.0f); + vec3 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_34064b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_34064b() { + vec3 arg_0 = vec3(1.0f); + vec3 res = ceil(arg_0); +} + +void fragment_main() { + ceil_34064b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_34064b() { + vec3 arg_0 = vec3(1.0f); + vec3 res = ceil(arg_0); +} + +void compute_main() { + ceil_34064b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl new file mode 100644 index 0000000000..ce94f136c0 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_34064b() { + float3 arg_0 = float3(1.0f); + float3 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_34064b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_34064b(); + return; +} + +kernel void compute_main() { + ceil_34064b(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9674bfc02 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_34064b "ceil_34064b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%ceil_34064b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Ceil %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %ceil_34064b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_34064b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ceil_34064b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec9cd284b0 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn ceil_34064b() { + var arg_0 = vec3(1.0f); + var res : vec3 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_34064b(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_34064b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_34064b(); +} diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl new file mode 100644 index 0000000000..28f5121b3d --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(vec<4, f16>) -> vec<4, f16> +fn ceil_4bca2a() { + var arg_0 = vec4(f16()); + var res: vec4 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_4bca2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_4bca2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_4bca2a(); +} diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..804cde298a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_4bca2a() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_4bca2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_4bca2a(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c01139ba21 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void ceil_4bca2a() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_4bca2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_4bca2a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CF8246830(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CF8246830(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.glsl new file mode 100644 index 0000000000..d9ac78fa2d --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_4bca2a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_4bca2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_4bca2a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = ceil(arg_0); +} + +void fragment_main() { + ceil_4bca2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_4bca2a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = ceil(arg_0); +} + +void compute_main() { + ceil_4bca2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.msl new file mode 100644 index 0000000000..82cc7148fa --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_4bca2a() { + half4 arg_0 = half4(0.0h); + half4 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_4bca2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_4bca2a(); + return; +} + +kernel void compute_main() { + ceil_4bca2a(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0f5dea8b6 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_4bca2a "ceil_4bca2a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_4bca2a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Ceil %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %ceil_4bca2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_4bca2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ceil_4bca2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..682d1c394d --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/4bca2a.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn ceil_4bca2a() { + var arg_0 = vec4(f16()); + var res : vec4 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_4bca2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_4bca2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_4bca2a(); +} diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl b/test/tint/builtins/gen/var/ceil/678655.wgsl new file mode 100644 index 0000000000..6906a4dad6 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(f32) -> f32 +fn ceil_678655() { + var arg_0 = 1.f; + var res: f32 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_678655(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_678655(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_678655(); +} diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..61f3dc0d3c --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_678655(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_678655(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_678655(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..61f3dc0d3c --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_678655(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_678655(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_678655(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl new file mode 100644 index 0000000000..56f09a6e13 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_678655(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +void fragment_main() { + ceil_678655(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +void compute_main() { + ceil_678655(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl new file mode 100644 index 0000000000..8714a884f9 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_678655() { + float arg_0 = 1.0f; + float res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_678655(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_678655(); + return; +} + +kernel void compute_main() { + ceil_678655(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm new file mode 100644 index 0000000000..465ddd442a --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_678655 "ceil_678655" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%ceil_678655 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Ceil %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %ceil_678655 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %ceil_678655 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_678655 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl new file mode 100644 index 0000000000..d3cc9b4d7b --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn ceil_678655() { + var arg_0 = 1.0f; + var res : f32 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_678655(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_678655(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_678655(); +} diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl new file mode 100644 index 0000000000..d856956ef4 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(vec<2, f32>) -> vec<2, f32> +fn ceil_96f597() { + var arg_0 = vec2(1.f); + var res: vec2 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_96f597(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_96f597(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_96f597(); +} diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7bdb61b698 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_96f597() { + float2 arg_0 = (1.0f).xx; + float2 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_96f597(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_96f597(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_96f597(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7bdb61b698 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void ceil_96f597() { + float2 arg_0 = (1.0f).xx; + float2 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_96f597(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_96f597(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_96f597(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl new file mode 100644 index 0000000000..3c93695c8b --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void ceil_96f597() { + vec2 arg_0 = vec2(1.0f); + vec2 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_96f597(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_96f597() { + vec2 arg_0 = vec2(1.0f); + vec2 res = ceil(arg_0); +} + +void fragment_main() { + ceil_96f597(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_96f597() { + vec2 arg_0 = vec2(1.0f); + vec2 res = ceil(arg_0); +} + +void compute_main() { + ceil_96f597(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl new file mode 100644 index 0000000000..e3cb08bb9c --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_96f597() { + float2 arg_0 = float2(1.0f); + float2 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_96f597(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_96f597(); + return; +} + +kernel void compute_main() { + ceil_96f597(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba9ec75480 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_96f597 "ceil_96f597" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%ceil_96f597 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Ceil %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %ceil_96f597 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %ceil_96f597 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ceil_96f597 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl new file mode 100644 index 0000000000..a08c2befd5 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn ceil_96f597() { + var arg_0 = vec2(1.0f); + var res : vec2 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_96f597(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_96f597(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_96f597(); +} diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl new file mode 100644 index 0000000000..697dab2113 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ceil(vec<4, f32>) -> vec<4, f32> +fn ceil_b74c16() { + var arg_0 = vec4(1.f); + var res: vec4 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_b74c16(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_b74c16(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_b74c16(); +} diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f914edfc0e --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_b74c16() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_b74c16(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_b74c16(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_b74c16(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f914edfc0e --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void ceil_b74c16() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_b74c16(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_b74c16(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_b74c16(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl new file mode 100644 index 0000000000..f630971992 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void ceil_b74c16() { + vec4 arg_0 = vec4(1.0f); + vec4 res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_b74c16(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ceil_b74c16() { + vec4 arg_0 = vec4(1.0f); + vec4 res = ceil(arg_0); +} + +void fragment_main() { + ceil_b74c16(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ceil_b74c16() { + vec4 arg_0 = vec4(1.0f); + vec4 res = ceil(arg_0); +} + +void compute_main() { + ceil_b74c16(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl new file mode 100644 index 0000000000..66c5898efe --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_b74c16() { + float4 arg_0 = float4(1.0f); + float4 res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_b74c16(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_b74c16(); + return; +} + +kernel void compute_main() { + ceil_b74c16(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e581a1a62 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_b74c16 "ceil_b74c16" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%ceil_b74c16 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Ceil %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %ceil_b74c16 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %ceil_b74c16 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %ceil_b74c16 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl new file mode 100644 index 0000000000..e2a7c63218 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn ceil_b74c16() { + var arg_0 = vec4(1.0f); + var res : vec4 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_b74c16(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_b74c16(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_b74c16(); +} diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl new file mode 100644 index 0000000000..2053a508f4 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ceil(f16) -> f16 +fn ceil_f3f889() { + var arg_0 = f16(); + var res: f16 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_f3f889(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_f3f889(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_f3f889(); +} diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..03dab80377 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void ceil_f3f889() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_f3f889(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_f3f889(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ecdbf03d00 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void ceil_f3f889() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = ceil(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ceil_f3f889(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ceil_f3f889(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002391D5D1160(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002391D5D1160(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.glsl new file mode 100644 index 0000000000..3459b17432 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_f3f889() { + float16_t arg_0 = 0.0hf; + float16_t res = ceil(arg_0); +} + +vec4 vertex_main() { + ceil_f3f889(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ceil_f3f889() { + float16_t arg_0 = 0.0hf; + float16_t res = ceil(arg_0); +} + +void fragment_main() { + ceil_f3f889(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ceil_f3f889() { + float16_t arg_0 = 0.0hf; + float16_t res = ceil(arg_0); +} + +void compute_main() { + ceil_f3f889(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.msl new file mode 100644 index 0000000000..48f8d6d794 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void ceil_f3f889() { + half arg_0 = 0.0h; + half res = ceil(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ceil_f3f889(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ceil_f3f889(); + return; +} + +kernel void compute_main() { + ceil_f3f889(); + return; +} + diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d48df9faa --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ceil_f3f889 "ceil_f3f889" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ceil_f3f889 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Ceil %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %ceil_f3f889 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %ceil_f3f889 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %ceil_f3f889 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.wgsl new file mode 100644 index 0000000000..d00960ecd8 --- /dev/null +++ b/test/tint/builtins/gen/var/ceil/f3f889.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn ceil_f3f889() { + var arg_0 = f16(); + var res : f16 = ceil(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ceil_f3f889(); + return vec4(); +} + +@fragment +fn fragment_main() { + ceil_f3f889(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ceil_f3f889(); +} diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl new file mode 100644 index 0000000000..2c7a13697c --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn clamp_0acf8f() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var arg_2 = vec2(1.f); + var res: vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_0acf8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_0acf8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_0acf8f(); +} diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db83687deb --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_0acf8f() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_0acf8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_0acf8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_0acf8f(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..db83687deb --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_0acf8f() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_0acf8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_0acf8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_0acf8f(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl new file mode 100644 index 0000000000..440ce35f98 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_0acf8f() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_0acf8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_0acf8f() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_0acf8f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_0acf8f() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_0acf8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl new file mode 100644 index 0000000000..a8a7875023 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_0acf8f() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 arg_2 = float2(1.0f); + float2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_0acf8f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_0acf8f(); + return; +} + +kernel void compute_main() { + clamp_0acf8f(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d32a7b5bd --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_0acf8f "clamp_0acf8f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %27 = OpTypeFunction %v4float +%clamp_0acf8f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %arg_2 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v2float %arg_0 + %24 = OpLoad %v2float %arg_1 + %25 = OpLoad %v2float %arg_2 + %21 = OpExtInst %v2float %22 NClamp %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_0acf8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_0acf8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_0acf8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..a217c189c2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_0acf8f() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var arg_2 = vec2(1.0f); + var res : vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_0acf8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_0acf8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_0acf8f(); +} diff --git a/test/tint/builtins/gen/var/clamp/177548.wgsl b/test/tint/builtins/gen/var/clamp/177548.wgsl new file mode 100644 index 0000000000..8a92059fee --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/177548.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, ia>, vec<2, ia>, vec<2, ia>) -> vec<2, ia> +fn clamp_177548() { + const arg_0 = vec2(1.0); + const arg_1 = vec2(1.0); + const arg_2 = vec2(1.0); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_177548(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_177548(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_177548(); +} diff --git a/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6db476c70 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_177548() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_177548(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_177548(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_177548(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6db476c70 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_177548() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_177548(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_177548(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_177548(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.glsl new file mode 100644 index 0000000000..aef0c70f7c --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_177548() { + vec2 res = vec2(1.0f); +} + +vec4 vertex_main() { + clamp_177548(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_177548() { + vec2 res = vec2(1.0f); +} + +void fragment_main() { + clamp_177548(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_177548() { + vec2 res = vec2(1.0f); +} + +void compute_main() { + clamp_177548(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.msl new file mode 100644 index 0000000000..7c91b67871 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_177548() { + float2 res = float2(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_177548(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_177548(); + return; +} + +kernel void compute_main() { + clamp_177548(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b2e5dc76e --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_177548 "clamp_177548" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float +%clamp_177548 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %clamp_177548 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_177548 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_177548 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.wgsl new file mode 100644 index 0000000000..0562596b9f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/177548.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_177548() { + const arg_0 = vec2(1.0); + const arg_1 = vec2(1.0); + const arg_2 = vec2(1.0); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_177548(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_177548(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_177548(); +} diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl new file mode 100644 index 0000000000..cc330c9bab --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, i32>, vec<4, i32>, vec<4, i32>) -> vec<4, i32> +fn clamp_1a32e3() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var arg_2 = vec4(1); + var res: vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_1a32e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_1a32e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_1a32e3(); +} diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5df22b18dc --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_1a32e3() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + int4 arg_2 = (1).xxxx; + int4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_1a32e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_1a32e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_1a32e3(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5df22b18dc --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_1a32e3() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + int4 arg_2 = (1).xxxx; + int4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_1a32e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_1a32e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_1a32e3(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl new file mode 100644 index 0000000000..ed2339ae25 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_1a32e3() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + ivec4 arg_2 = ivec4(1); + ivec4 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_1a32e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_1a32e3() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + ivec4 arg_2 = ivec4(1); + ivec4 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_1a32e3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_1a32e3() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + ivec4 arg_2 = ivec4(1); + ivec4 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_1a32e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl new file mode 100644 index 0000000000..16ff83af8e --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_1a32e3() { + int4 arg_0 = int4(1); + int4 arg_1 = int4(1); + int4 arg_2 = int4(1); + int4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_1a32e3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_1a32e3(); + return; +} + +kernel void compute_main() { + clamp_1a32e3(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..5945c1298a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_1a32e3 "clamp_1a32e3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_1a32e3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %19 + %arg_1 = OpVariable %_ptr_Function_v4int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4int Function %19 + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %16 + %24 = OpLoad %v4int %arg_0 + %25 = OpLoad %v4int %arg_1 + %26 = OpLoad %v4int %arg_2 + %22 = OpExtInst %v4int %23 SClamp %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_1a32e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_1a32e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %clamp_1a32e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b2884dd25 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_1a32e3() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var arg_2 = vec4(1); + var res : vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_1a32e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_1a32e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_1a32e3(); +} diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl new file mode 100644 index 0000000000..c77a34095b --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn clamp_235b29() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_235b29(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_235b29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_235b29(); +} diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0bab035852 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_235b29() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_235b29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_235b29(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1169ce494c --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void clamp_235b29() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_235b29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_235b29(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CD8072900(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CD8072900(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CD8072900(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024CD8072900(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.glsl new file mode 100644 index 0000000000..1921aab221 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_235b29() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_235b29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_235b29() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_235b29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_235b29() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_235b29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.msl new file mode 100644 index 0000000000..1d2f620b4f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_235b29() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_235b29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_235b29(); + return; +} + +kernel void compute_main() { + clamp_235b29(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.spvasm new file mode 100644 index 0000000000..c93b5b8cc0 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_235b29 "clamp_235b29" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_235b29 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 NClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_235b29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_235b29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_235b29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.wgsl new file mode 100644 index 0000000000..93013b2912 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/235b29.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn clamp_235b29() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_235b29(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_235b29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_235b29(); +} diff --git a/test/tint/builtins/gen/var/clamp/23aa4f.wgsl b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl new file mode 100644 index 0000000000..fee18f2f54 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(fa, fa, fa) -> fa +fn clamp_23aa4f() { + const arg_0 = 1; + const arg_1 = 1; + const arg_2 = 1; + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_23aa4f(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_23aa4f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_23aa4f(); +} diff --git a/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95967c6565 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_23aa4f() { + int res = 1; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_23aa4f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_23aa4f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_23aa4f(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95967c6565 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_23aa4f() { + int res = 1; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_23aa4f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_23aa4f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_23aa4f(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.glsl new file mode 100644 index 0000000000..745c8d9039 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_23aa4f() { + int res = 1; +} + +vec4 vertex_main() { + clamp_23aa4f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_23aa4f() { + int res = 1; +} + +void fragment_main() { + clamp_23aa4f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_23aa4f() { + int res = 1; +} + +void compute_main() { + clamp_23aa4f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.msl new file mode 100644 index 0000000000..e6b476f7e2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_23aa4f() { + int res = 1; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_23aa4f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_23aa4f(); + return; +} + +kernel void compute_main() { + clamp_23aa4f(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e7f69b6f4 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_23aa4f "clamp_23aa4f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %18 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_23aa4f = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %res %int_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %clamp_23aa4f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_23aa4f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_23aa4f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.wgsl new file mode 100644 index 0000000000..4024be1627 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/23aa4f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_23aa4f() { + const arg_0 = 1; + const arg_1 = 1; + const arg_2 = 1; + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_23aa4f(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_23aa4f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_23aa4f(); +} diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl new file mode 100644 index 0000000000..a924231b08 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(f32, f32, f32) -> f32 +fn clamp_2bd567() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var arg_2 = 1.f; + var res: f32 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bd567(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2bd567(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2bd567(); +} diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..658444791b --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bd567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bd567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bd567(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..658444791b --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bd567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bd567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bd567(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl new file mode 100644 index 0000000000..a152ab211e --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_2bd567(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_2bd567(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_2bd567(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl new file mode 100644 index 0000000000..033fc2aebb --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_2bd567() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2bd567(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2bd567(); + return; +} + +kernel void compute_main() { + clamp_2bd567(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm new file mode 100644 index 0000000000..0319b1f7c2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2bd567 "clamp_2bd567" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float +%clamp_2bd567 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %float_1 + %20 = OpLoad %float %arg_0 + %21 = OpLoad %float %arg_1 + %22 = OpLoad %float %arg_2 + %18 = OpExtInst %float %19 NClamp %20 %21 %22 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %clamp_2bd567 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_2bd567 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_2bd567 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl new file mode 100644 index 0000000000..54ea1337fc --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_2bd567() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var arg_2 = 1.0f; + var res : f32 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bd567(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2bd567(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2bd567(); +} diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl new file mode 100644 index 0000000000..bf67874f57 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn clamp_2bde41() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var arg_2 = vec4(1.f); + var res: vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bde41(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2bde41(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2bde41(); +} diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..78e4d3f1c5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_2bde41() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bde41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bde41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bde41(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..78e4d3f1c5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_2bde41() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2bde41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2bde41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2bde41(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl new file mode 100644 index 0000000000..6be8122bd3 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_2bde41() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_2bde41(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_2bde41() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_2bde41(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_2bde41() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_2bde41(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl new file mode 100644 index 0000000000..e8206cd6f2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_2bde41() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 arg_2 = float4(1.0f); + float4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2bde41(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2bde41(); + return; +} + +kernel void compute_main() { + clamp_2bde41(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm new file mode 100644 index 0000000000..e481bf2cfe --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2bde41 "clamp_2bde41" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %v4float +%clamp_2bde41 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v4float %arg_0 + %22 = OpLoad %v4float %arg_1 + %23 = OpLoad %v4float %arg_2 + %19 = OpExtInst %v4float %20 NClamp %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_2bde41 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %clamp_2bde41 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %clamp_2bde41 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl new file mode 100644 index 0000000000..0b42465cd2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_2bde41() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var arg_2 = vec4(1.0f); + var res : vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2bde41(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2bde41(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2bde41(); +} diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl new file mode 100644 index 0000000000..95d83b921a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn clamp_2c251b() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2c251b(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2c251b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2c251b(); +} diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..71ec4f69a2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_2c251b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2c251b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2c251b(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..946d07a4a8 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void clamp_2c251b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_2c251b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_2c251b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D56C1F9DE0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D56C1F9DE0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D56C1F9DE0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D56C1F9DE0(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.glsl new file mode 100644 index 0000000000..6c4f3c1514 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_2c251b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_2c251b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_2c251b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_2c251b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_2c251b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_2c251b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.msl new file mode 100644 index 0000000000..b84d2b06af --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_2c251b() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_2c251b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_2c251b(); + return; +} + +kernel void compute_main() { + clamp_2c251b(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.spvasm new file mode 100644 index 0000000000..995110b45b --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_2c251b "clamp_2c251b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_2c251b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 NClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_2c251b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_2c251b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_2c251b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.wgsl new file mode 100644 index 0000000000..66ca8c34fa --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/2c251b.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn clamp_2c251b() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_2c251b(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_2c251b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_2c251b(); +} diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl new file mode 100644 index 0000000000..4f7728b0f1 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, u32>, vec<3, u32>, vec<3, u32>) -> vec<3, u32> +fn clamp_548fc7() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var arg_2 = vec3(1u); + var res: vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_548fc7(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_548fc7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_548fc7(); +} diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..50830b07ce --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_548fc7() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint3 arg_2 = (1u).xxx; + uint3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_548fc7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_548fc7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_548fc7(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..50830b07ce --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_548fc7() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint3 arg_2 = (1u).xxx; + uint3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_548fc7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_548fc7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_548fc7(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl new file mode 100644 index 0000000000..49510412f1 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_548fc7() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uvec3 arg_2 = uvec3(1u); + uvec3 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_548fc7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_548fc7() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uvec3 arg_2 = uvec3(1u); + uvec3 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_548fc7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_548fc7() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uvec3 arg_2 = uvec3(1u); + uvec3 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_548fc7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl new file mode 100644 index 0000000000..d7b9b9ce80 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_548fc7() { + uint3 arg_0 = uint3(1u); + uint3 arg_1 = uint3(1u); + uint3 arg_2 = uint3(1u); + uint3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_548fc7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_548fc7(); + return; +} + +kernel void compute_main() { + clamp_548fc7(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm new file mode 100644 index 0000000000..d1dabc9a6e --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_548fc7 "clamp_548fc7" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_548fc7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %19 + %arg_2 = OpVariable %_ptr_Function_v3uint Function %19 + %res = OpVariable %_ptr_Function_v3uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %16 + %24 = OpLoad %v3uint %arg_0 + %25 = OpLoad %v3uint %arg_1 + %26 = OpLoad %v3uint %arg_2 + %22 = OpExtInst %v3uint %23 UClamp %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_548fc7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_548fc7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %clamp_548fc7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2ff699d85 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_548fc7() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var arg_2 = vec3(1u); + var res : vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_548fc7(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_548fc7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_548fc7(); +} diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl new file mode 100644 index 0000000000..accceec0d5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(f16, f16, f16) -> f16 +fn clamp_553ffb() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res: f16 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_553ffb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_553ffb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_553ffb(); +} diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3b9eae4e48 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_553ffb() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_553ffb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_553ffb(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6c663b8dfc --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void clamp_553ffb() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_553ffb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_553ffb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022BE4491540(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022BE4491540(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.glsl new file mode 100644 index 0000000000..30b888f626 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_553ffb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_553ffb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_553ffb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_553ffb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_553ffb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_553ffb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.msl new file mode 100644 index 0000000000..27aaf05b6f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_553ffb() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half arg_2 = 0.0h; + half res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_553ffb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_553ffb(); + return; +} + +kernel void compute_main() { + clamp_553ffb(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.spvasm new file mode 100644 index 0000000000..4254790664 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_553ffb "clamp_553ffb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_553ffb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %half %arg_0 + %22 = OpLoad %half %arg_1 + %23 = OpLoad %half %arg_2 + %19 = OpExtInst %half %20 NClamp %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_553ffb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %clamp_553ffb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_553ffb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.wgsl new file mode 100644 index 0000000000..875ec681d6 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/553ffb.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn clamp_553ffb() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res : f16 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_553ffb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_553ffb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_553ffb(); +} diff --git a/test/tint/builtins/gen/var/clamp/5cf700.wgsl b/test/tint/builtins/gen/var/clamp/5cf700.wgsl new file mode 100644 index 0000000000..d39f7096e1 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5cf700.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, fa>, vec<3, fa>, vec<3, fa>) -> vec<3, fa> +fn clamp_5cf700() { + const arg_0 = vec3(1); + const arg_1 = vec3(1); + const arg_2 = vec3(1); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_5cf700(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_5cf700(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_5cf700(); +} diff --git a/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..06d6121193 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_5cf700() { + int3 res = (1).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_5cf700(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_5cf700(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_5cf700(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..06d6121193 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_5cf700() { + int3 res = (1).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_5cf700(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_5cf700(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_5cf700(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.glsl new file mode 100644 index 0000000000..a1ce57531a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_5cf700() { + ivec3 res = ivec3(1); +} + +vec4 vertex_main() { + clamp_5cf700(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_5cf700() { + ivec3 res = ivec3(1); +} + +void fragment_main() { + clamp_5cf700(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_5cf700() { + ivec3 res = ivec3(1); +} + +void compute_main() { + clamp_5cf700(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.msl new file mode 100644 index 0000000000..55c384c198 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_5cf700() { + int3 res = int3(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_5cf700(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_5cf700(); + return; +} + +kernel void compute_main() { + clamp_5cf700(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b26acae61 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_5cf700 "clamp_5cf700" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_5cf700 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_5cf700 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_5cf700 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_5cf700 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0f4e504fd --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5cf700.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_5cf700() { + const arg_0 = vec3(1); + const arg_1 = vec3(1); + const arg_2 = vec3(1); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_5cf700(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_5cf700(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_5cf700(); +} diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl new file mode 100644 index 0000000000..6265c23f65 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, i32>, vec<3, i32>, vec<3, i32>) -> vec<3, i32> +fn clamp_5f0819() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var arg_2 = vec3(1); + var res: vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_5f0819(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_5f0819(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_5f0819(); +} diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aa13f0d7d2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_5f0819() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + int3 arg_2 = (1).xxx; + int3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_5f0819(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_5f0819(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_5f0819(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aa13f0d7d2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_5f0819() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + int3 arg_2 = (1).xxx; + int3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_5f0819(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_5f0819(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_5f0819(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl new file mode 100644 index 0000000000..d56a2105db --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_5f0819() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + ivec3 arg_2 = ivec3(1); + ivec3 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_5f0819(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_5f0819() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + ivec3 arg_2 = ivec3(1); + ivec3 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_5f0819(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_5f0819() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + ivec3 arg_2 = ivec3(1); + ivec3 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_5f0819(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl new file mode 100644 index 0000000000..e4086213e0 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_5f0819() { + int3 arg_0 = int3(1); + int3 arg_1 = int3(1); + int3 arg_2 = int3(1); + int3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_5f0819(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_5f0819(); + return; +} + +kernel void compute_main() { + clamp_5f0819(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm new file mode 100644 index 0000000000..44ca5d7722 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_5f0819 "clamp_5f0819" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_5f0819 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %19 + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v3int Function %19 + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %16 + %24 = OpLoad %v3int %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v3int %arg_2 + %22 = OpExtInst %v3int %23 SClamp %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_5f0819 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_5f0819 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %clamp_5f0819 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl new file mode 100644 index 0000000000..198a03ed60 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_5f0819() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var arg_2 = vec3(1); + var res : vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_5f0819(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_5f0819(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_5f0819(); +} diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl new file mode 100644 index 0000000000..ab33debaea --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, i32>, vec<2, i32>, vec<2, i32>) -> vec<2, i32> +fn clamp_6c1749() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var arg_2 = vec2(1); + var res: vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_6c1749(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_6c1749(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_6c1749(); +} diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..77e3d802b8 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_6c1749() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + int2 arg_2 = (1).xx; + int2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_6c1749(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_6c1749(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_6c1749(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77e3d802b8 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_6c1749() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + int2 arg_2 = (1).xx; + int2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_6c1749(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_6c1749(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_6c1749(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl new file mode 100644 index 0000000000..40d616fe73 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_6c1749() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + ivec2 arg_2 = ivec2(1); + ivec2 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_6c1749(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_6c1749() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + ivec2 arg_2 = ivec2(1); + ivec2 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_6c1749(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_6c1749() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + ivec2 arg_2 = ivec2(1); + ivec2 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_6c1749(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl new file mode 100644 index 0000000000..dd11a3f796 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_6c1749() { + int2 arg_0 = int2(1); + int2 arg_1 = int2(1); + int2 arg_2 = int2(1); + int2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_6c1749(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_6c1749(); + return; +} + +kernel void compute_main() { + clamp_6c1749(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm new file mode 100644 index 0000000000..490c50a703 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_6c1749 "clamp_6c1749" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_6c1749 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %19 + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v2int Function %19 + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %16 + %24 = OpLoad %v2int %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v2int %arg_2 + %22 = OpExtInst %v2int %23 SClamp %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_6c1749 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_6c1749 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %clamp_6c1749 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e4a5ac1a6 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_6c1749() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var arg_2 = vec2(1); + var res : vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_6c1749(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_6c1749(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_6c1749(); +} diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl new file mode 100644 index 0000000000..d8f14ec5d1 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, u32>, vec<2, u32>, vec<2, u32>) -> vec<2, u32> +fn clamp_7706d7() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var arg_2 = vec2(1u); + var res: vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_7706d7(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_7706d7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_7706d7(); +} diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bb60ac2388 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_7706d7() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint2 arg_2 = (1u).xx; + uint2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_7706d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_7706d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_7706d7(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bb60ac2388 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_7706d7() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint2 arg_2 = (1u).xx; + uint2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_7706d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_7706d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_7706d7(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl new file mode 100644 index 0000000000..993b295425 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_7706d7() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uvec2 arg_2 = uvec2(1u); + uvec2 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_7706d7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_7706d7() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uvec2 arg_2 = uvec2(1u); + uvec2 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_7706d7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_7706d7() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uvec2 arg_2 = uvec2(1u); + uvec2 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_7706d7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl new file mode 100644 index 0000000000..e70e2d5832 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_7706d7() { + uint2 arg_0 = uint2(1u); + uint2 arg_1 = uint2(1u); + uint2 arg_2 = uint2(1u); + uint2 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_7706d7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_7706d7(); + return; +} + +kernel void compute_main() { + clamp_7706d7(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm new file mode 100644 index 0000000000..5bd65879c1 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_7706d7 "clamp_7706d7" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_7706d7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %19 + %arg_2 = OpVariable %_ptr_Function_v2uint Function %19 + %res = OpVariable %_ptr_Function_v2uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %16 + %24 = OpLoad %v2uint %arg_0 + %25 = OpLoad %v2uint %arg_1 + %26 = OpLoad %v2uint %arg_2 + %22 = OpExtInst %v2uint %23 UClamp %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_7706d7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_7706d7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %clamp_7706d7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca14f76cb2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_7706d7() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var arg_2 = vec2(1u); + var res : vec2 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_7706d7(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_7706d7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_7706d7(); +} diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl b/test/tint/builtins/gen/var/clamp/867397.wgsl new file mode 100644 index 0000000000..31706deff5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn clamp_867397() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var arg_2 = vec3(1.f); + var res: vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_867397(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_867397(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_867397(); +} diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..08aaf748e9 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_867397() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_867397(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_867397(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_867397(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..08aaf748e9 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_867397() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_867397(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_867397(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_867397(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl new file mode 100644 index 0000000000..3fd741c6c8 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_867397() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_867397(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_867397() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_867397(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_867397() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_867397(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl new file mode 100644 index 0000000000..0e88a81ddb --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_867397() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 arg_2 = float3(1.0f); + float3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_867397(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_867397(); + return; +} + +kernel void compute_main() { + clamp_867397(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm new file mode 100644 index 0000000000..6283a26f69 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_867397 "clamp_867397" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %27 = OpTypeFunction %v4float +%clamp_867397 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %arg_2 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v3float %arg_0 + %24 = OpLoad %v3float %arg_1 + %25 = OpLoad %v3float %arg_2 + %21 = OpExtInst %v3float %22 NClamp %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_867397 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_867397 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_867397 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f64a6ee9f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_867397() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var arg_2 = vec3(1.0f); + var res : vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_867397(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_867397(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_867397(); +} diff --git a/test/tint/builtins/gen/var/clamp/87df46.wgsl b/test/tint/builtins/gen/var/clamp/87df46.wgsl new file mode 100644 index 0000000000..8b27e0f52d --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/87df46.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, fa>, vec<4, fa>, vec<4, fa>) -> vec<4, fa> +fn clamp_87df46() { + const arg_0 = vec4(1); + const arg_1 = vec4(1); + const arg_2 = vec4(1); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_87df46(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_87df46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_87df46(); +} diff --git a/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8af196a973 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_87df46() { + int4 res = (1).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_87df46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_87df46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_87df46(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8af196a973 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_87df46() { + int4 res = (1).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_87df46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_87df46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_87df46(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.glsl new file mode 100644 index 0000000000..b3db98f4e6 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_87df46() { + ivec4 res = ivec4(1); +} + +vec4 vertex_main() { + clamp_87df46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_87df46() { + ivec4 res = ivec4(1); +} + +void fragment_main() { + clamp_87df46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_87df46() { + ivec4 res = ivec4(1); +} + +void compute_main() { + clamp_87df46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.msl new file mode 100644 index 0000000000..62aa4bb0a3 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_87df46() { + int4 res = int4(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_87df46(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_87df46(); + return; +} + +kernel void compute_main() { + clamp_87df46(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e036506bf --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_87df46 "clamp_87df46" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_87df46 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_87df46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_87df46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_87df46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.wgsl new file mode 100644 index 0000000000..ae5d00e8e0 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/87df46.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_87df46() { + const arg_0 = vec4(1); + const arg_1 = vec4(1); + const arg_2 = vec4(1); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_87df46(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_87df46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_87df46(); +} diff --git a/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl new file mode 100644 index 0000000000..6ffecf3c27 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<3, ia>, vec<3, ia>, vec<3, ia>) -> vec<3, ia> +fn clamp_8b1eaa() { + const arg_0 = vec3(1.0); + const arg_1 = vec3(1.0); + const arg_2 = vec3(1.0); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_8b1eaa(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_8b1eaa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_8b1eaa(); +} diff --git a/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8270dd1e8a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_8b1eaa() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_8b1eaa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_8b1eaa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_8b1eaa(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8270dd1e8a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_8b1eaa() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_8b1eaa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_8b1eaa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_8b1eaa(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.glsl new file mode 100644 index 0000000000..6729165a11 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_8b1eaa() { + vec3 res = vec3(1.0f); +} + +vec4 vertex_main() { + clamp_8b1eaa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_8b1eaa() { + vec3 res = vec3(1.0f); +} + +void fragment_main() { + clamp_8b1eaa(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_8b1eaa() { + vec3 res = vec3(1.0f); +} + +void compute_main() { + clamp_8b1eaa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.msl new file mode 100644 index 0000000000..786aaaa128 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_8b1eaa() { + float3 res = float3(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_8b1eaa(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_8b1eaa(); + return; +} + +kernel void compute_main() { + clamp_8b1eaa(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.spvasm new file mode 100644 index 0000000000..faa36f5c9e --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_8b1eaa "clamp_8b1eaa" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float +%clamp_8b1eaa = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %clamp_8b1eaa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_8b1eaa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_8b1eaa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.wgsl new file mode 100644 index 0000000000..f61ad358c1 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/8b1eaa.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_8b1eaa() { + const arg_0 = vec3(1.0); + const arg_1 = vec3(1.0); + const arg_2 = vec3(1.0); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_8b1eaa(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_8b1eaa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_8b1eaa(); +} diff --git a/test/tint/builtins/gen/var/clamp/96e56a.wgsl b/test/tint/builtins/gen/var/clamp/96e56a.wgsl new file mode 100644 index 0000000000..e53292c7dc --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/96e56a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(ia, ia, ia) -> ia +fn clamp_96e56a() { + const arg_0 = 1.0; + const arg_1 = 1.0; + const arg_2 = 1.0; + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_96e56a(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_96e56a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_96e56a(); +} diff --git a/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6231928d78 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_96e56a() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_96e56a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_96e56a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_96e56a(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6231928d78 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_96e56a() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_96e56a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_96e56a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_96e56a(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.glsl new file mode 100644 index 0000000000..c7dbb9bdc3 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_96e56a() { + float res = 1.0f; +} + +vec4 vertex_main() { + clamp_96e56a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_96e56a() { + float res = 1.0f; +} + +void fragment_main() { + clamp_96e56a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_96e56a() { + float res = 1.0f; +} + +void compute_main() { + clamp_96e56a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.msl new file mode 100644 index 0000000000..a28781ca2c --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_96e56a() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_96e56a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_96e56a(); + return; +} + +kernel void compute_main() { + clamp_96e56a(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.spvasm new file mode 100644 index 0000000000..07544da303 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_96e56a "clamp_96e56a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float +%clamp_96e56a = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %clamp_96e56a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %void %clamp_96e56a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %clamp_96e56a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.wgsl new file mode 100644 index 0000000000..d6007ca80f --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/96e56a.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_96e56a() { + const arg_0 = 1.0; + const arg_1 = 1.0; + const arg_2 = 1.0; + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_96e56a(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_96e56a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_96e56a(); +} diff --git a/test/tint/builtins/gen/var/clamp/9d731c.wgsl b/test/tint/builtins/gen/var/clamp/9d731c.wgsl new file mode 100644 index 0000000000..c86c2689a3 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/9d731c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<2, fa>, vec<2, fa>, vec<2, fa>) -> vec<2, fa> +fn clamp_9d731c() { + const arg_0 = vec2(1); + const arg_1 = vec2(1); + const arg_2 = vec2(1); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_9d731c(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_9d731c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_9d731c(); +} diff --git a/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..25efa1a8e9 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_9d731c() { + int2 res = (1).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_9d731c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_9d731c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_9d731c(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..25efa1a8e9 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_9d731c() { + int2 res = (1).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_9d731c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_9d731c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_9d731c(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.glsl new file mode 100644 index 0000000000..8f283b5ee4 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_9d731c() { + ivec2 res = ivec2(1); +} + +vec4 vertex_main() { + clamp_9d731c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_9d731c() { + ivec2 res = ivec2(1); +} + +void fragment_main() { + clamp_9d731c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_9d731c() { + ivec2 res = ivec2(1); +} + +void compute_main() { + clamp_9d731c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.msl new file mode 100644 index 0000000000..5a78c71ece --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_9d731c() { + int2 res = int2(1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_9d731c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_9d731c(); + return; +} + +kernel void compute_main() { + clamp_9d731c(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.spvasm new file mode 100644 index 0000000000..533a9b057d --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_9d731c "clamp_9d731c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_9d731c = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %clamp_9d731c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %clamp_9d731c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %clamp_9d731c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.wgsl new file mode 100644 index 0000000000..54adf9a63c --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/9d731c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_9d731c() { + const arg_0 = vec2(1); + const arg_1 = vec2(1); + const arg_2 = vec2(1); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_9d731c(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_9d731c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_9d731c(); +} diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl new file mode 100644 index 0000000000..40dae61486 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(u32, u32, u32) -> u32 +fn clamp_a2de25() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var res: u32 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_a2de25(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_a2de25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_a2de25(); +} diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ec730dace5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_a2de25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_a2de25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_a2de25(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec730dace5 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_a2de25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_a2de25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_a2de25(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl new file mode 100644 index 0000000000..93c876b3fe --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_a2de25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_a2de25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_a2de25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl new file mode 100644 index 0000000000..e22ed1be47 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_a2de25() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_a2de25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_a2de25(); + return; +} + +kernel void compute_main() { + clamp_a2de25(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e53f306ad --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_a2de25 "clamp_a2de25" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_a2de25 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %arg_2 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %22 = OpLoad %uint %arg_0 + %23 = OpLoad %uint %arg_1 + %24 = OpLoad %uint %arg_2 + %20 = OpExtInst %uint %21 UClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_a2de25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_a2de25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_a2de25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2e55fe571 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_a2de25() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var res : u32 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_a2de25(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_a2de25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_a2de25(); +} diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl new file mode 100644 index 0000000000..6dfc15e474 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(i32, i32, i32) -> i32 +fn clamp_b07c65() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = 1; + var res: i32 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b07c65(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b07c65(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b07c65(); +} diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..42208eb360 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b07c65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b07c65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b07c65(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..42208eb360 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b07c65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b07c65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b07c65(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl new file mode 100644 index 0000000000..4e79afee70 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_b07c65(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_b07c65(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_b07c65(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl new file mode 100644 index 0000000000..90b191c737 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_b07c65() { + int arg_0 = 1; + int arg_1 = 1; + int arg_2 = 1; + int res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_b07c65(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_b07c65(); + return; +} + +kernel void compute_main() { + clamp_b07c65(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5935027da --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_b07c65 "clamp_b07c65" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_b07c65 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %arg_2 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + OpStore %arg_2 %int_1 + %22 = OpLoad %int %arg_0 + %23 = OpLoad %int %arg_1 + %24 = OpLoad %int %arg_2 + %20 = OpExtInst %int %21 SClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_b07c65 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_b07c65 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_b07c65 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl new file mode 100644 index 0000000000..ea26e1122b --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_b07c65() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = 1; + var res : i32 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b07c65(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b07c65(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b07c65(); +} diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl new file mode 100644 index 0000000000..b0680c3e20 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn clamp(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn clamp_b195eb() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b195eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b195eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b195eb(); +} diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..51d3bc68d0 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_b195eb() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b195eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b195eb(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87a16e60d2 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void clamp_b195eb() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_b195eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_b195eb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002017A6F3930(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002017A6F3930(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002017A6F3930(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002017A6F3930(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.glsl new file mode 100644 index 0000000000..d1d0084050 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_b195eb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_b195eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void clamp_b195eb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_b195eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void clamp_b195eb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_b195eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.msl new file mode 100644 index 0000000000..3bedc87f91 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_b195eb() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_b195eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_b195eb(); + return; +} + +kernel void compute_main() { + clamp_b195eb(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..2383ac6f7e --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_b195eb "clamp_b195eb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_b195eb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 NClamp %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_b195eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %clamp_b195eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %clamp_b195eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..7baa8c0ee0 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/b195eb.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn clamp_b195eb() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_b195eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_b195eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_b195eb(); +} diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl new file mode 100644 index 0000000000..9351489789 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, u32>, vec<4, u32>, vec<4, u32>) -> vec<4, u32> +fn clamp_bd43ce() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var arg_2 = vec4(1u); + var res: vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_bd43ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_bd43ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_bd43ce(); +} diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..871fa94ee7 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void clamp_bd43ce() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint4 arg_2 = (1u).xxxx; + uint4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_bd43ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_bd43ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_bd43ce(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..871fa94ee7 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void clamp_bd43ce() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint4 arg_2 = (1u).xxxx; + uint4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_bd43ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_bd43ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_bd43ce(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl new file mode 100644 index 0000000000..be421b3334 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void clamp_bd43ce() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uvec4 arg_2 = uvec4(1u); + uvec4 res = clamp(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + clamp_bd43ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_bd43ce() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uvec4 arg_2 = uvec4(1u); + uvec4 res = clamp(arg_0, arg_1, arg_2); +} + +void fragment_main() { + clamp_bd43ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_bd43ce() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uvec4 arg_2 = uvec4(1u); + uvec4 res = clamp(arg_0, arg_1, arg_2); +} + +void compute_main() { + clamp_bd43ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl new file mode 100644 index 0000000000..b4af656bc0 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void clamp_bd43ce() { + uint4 arg_0 = uint4(1u); + uint4 arg_1 = uint4(1u); + uint4 arg_2 = uint4(1u); + uint4 res = clamp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_bd43ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_bd43ce(); + return; +} + +kernel void compute_main() { + clamp_bd43ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..465e316359 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_bd43ce "clamp_bd43ce" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%clamp_bd43ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %19 + %res = OpVariable %_ptr_Function_v4uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %16 + %24 = OpLoad %v4uint %arg_0 + %25 = OpLoad %v4uint %arg_1 + %26 = OpLoad %v4uint %arg_2 + %22 = OpExtInst %v4uint %23 UClamp %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %clamp_bd43ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %clamp_bd43ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %clamp_bd43ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef14a311cf --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_bd43ce() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var arg_2 = vec4(1u); + var res : vec4 = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_bd43ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_bd43ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_bd43ce(); +} diff --git a/test/tint/builtins/gen/var/clamp/d396af.wgsl b/test/tint/builtins/gen/var/clamp/d396af.wgsl new file mode 100644 index 0000000000..6c43a0ccca --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/d396af.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn clamp(vec<4, ia>, vec<4, ia>, vec<4, ia>) -> vec<4, ia> +fn clamp_d396af() { + const arg_0 = vec4(1.0); + const arg_1 = vec4(1.0); + const arg_2 = vec4(1.0); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_d396af(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_d396af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_d396af(); +} diff --git a/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f04061838 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void clamp_d396af() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_d396af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_d396af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_d396af(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1f04061838 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void clamp_d396af() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + clamp_d396af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + clamp_d396af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + clamp_d396af(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.glsl new file mode 100644 index 0000000000..57aa0178bd --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void clamp_d396af() { + vec4 res = vec4(1.0f); +} + +vec4 vertex_main() { + clamp_d396af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void clamp_d396af() { + vec4 res = vec4(1.0f); +} + +void fragment_main() { + clamp_d396af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void clamp_d396af() { + vec4 res = vec4(1.0f); +} + +void compute_main() { + clamp_d396af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.msl new file mode 100644 index 0000000000..3a1316e8a3 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void clamp_d396af() { + float4 res = float4(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + clamp_d396af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + clamp_d396af(); + return; +} + +kernel void compute_main() { + clamp_d396af(); + return; +} + diff --git a/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.spvasm new file mode 100644 index 0000000000..4403ee445a --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %clamp_d396af "clamp_d396af" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float +%clamp_d396af = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %clamp_d396af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %clamp_d396af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %clamp_d396af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd665f6fb6 --- /dev/null +++ b/test/tint/builtins/gen/var/clamp/d396af.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn clamp_d396af() { + const arg_0 = vec4(1.0); + const arg_1 = vec4(1.0); + const arg_2 = vec4(1.0); + var res = clamp(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + clamp_d396af(); + return vec4(); +} + +@fragment +fn fragment_main() { + clamp_d396af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + clamp_d396af(); +} diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl new file mode 100644 index 0000000000..305a93ebe7 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<3, f16>) -> vec<3, f16> +fn cos_0835a8() { + var arg_0 = vec3(f16()); + var res: vec3 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0835a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0835a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0835a8(); +} diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cced281af6 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_0835a8() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0835a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0835a8(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a8d875b56 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cos_0835a8() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0835a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0835a8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FB6F714B0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FB6F714B0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl new file mode 100644 index 0000000000..bafe1a5463 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0835a8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_0835a8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_0835a8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cos(arg_0); +} + +void fragment_main() { + cos_0835a8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0835a8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cos(arg_0); +} + +void compute_main() { + cos_0835a8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl new file mode 100644 index 0000000000..9420e0baf2 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_0835a8() { + half3 arg_0 = half3(0.0h); + half3 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_0835a8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_0835a8(); + return; +} + +kernel void compute_main() { + cos_0835a8(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm new file mode 100644 index 0000000000..9ae25ea410 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_0835a8 "cos_0835a8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_0835a8 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Cos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_0835a8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_0835a8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_0835a8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl new file mode 100644 index 0000000000..9646c47041 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cos_0835a8() { + var arg_0 = vec3(f16()); + var res : vec3 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0835a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0835a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0835a8(); +} diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl new file mode 100644 index 0000000000..57ead0ae8d --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<4, f16>) -> vec<4, f16> +fn cos_0a89f7() { + var arg_0 = vec4(f16()); + var res: vec4 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0a89f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0a89f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0a89f7(); +} diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3d47a4ab2b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_0a89f7() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0a89f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0a89f7(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01410b8820 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cos_0a89f7() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_0a89f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_0a89f7(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000012D2C4B1DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000012D2C4B1DB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl new file mode 100644 index 0000000000..ba601e2f1a --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0a89f7() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_0a89f7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_0a89f7() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cos(arg_0); +} + +void fragment_main() { + cos_0a89f7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_0a89f7() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cos(arg_0); +} + +void compute_main() { + cos_0a89f7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl new file mode 100644 index 0000000000..82d913de47 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_0a89f7() { + half4 arg_0 = half4(0.0h); + half4 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_0a89f7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_0a89f7(); + return; +} + +kernel void compute_main() { + cos_0a89f7(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..c2987df17f --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_0a89f7 "cos_0a89f7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_0a89f7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Cos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_0a89f7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_0a89f7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_0a89f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..9d809bd010 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cos_0a89f7() { + var arg_0 = vec4(f16()); + var res : vec4 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_0a89f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_0a89f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_0a89f7(); +} diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl new file mode 100644 index 0000000000..05fb496903 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<3, f32>) -> vec<3, f32> +fn cos_16dc15() { + var arg_0 = vec3(1.f); + var res: vec3 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_16dc15(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_16dc15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_16dc15(); +} diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aeb63a709b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_16dc15() { + float3 arg_0 = (1.0f).xxx; + float3 res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_16dc15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_16dc15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_16dc15(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aeb63a709b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void cos_16dc15() { + float3 arg_0 = (1.0f).xxx; + float3 res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_16dc15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_16dc15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_16dc15(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl new file mode 100644 index 0000000000..84d1b0f61a --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cos_16dc15() { + vec3 arg_0 = vec3(1.0f); + vec3 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_16dc15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_16dc15() { + vec3 arg_0 = vec3(1.0f); + vec3 res = cos(arg_0); +} + +void fragment_main() { + cos_16dc15(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_16dc15() { + vec3 arg_0 = vec3(1.0f); + vec3 res = cos(arg_0); +} + +void compute_main() { + cos_16dc15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl new file mode 100644 index 0000000000..69d0bd099b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_16dc15() { + float3 arg_0 = float3(1.0f); + float3 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_16dc15(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_16dc15(); + return; +} + +kernel void compute_main() { + cos_16dc15(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f74c5bf49 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_16dc15 "cos_16dc15" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float + %cos_16dc15 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Cos %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %cos_16dc15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_16dc15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_16dc15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e3aef05c1 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_16dc15() { + var arg_0 = vec3(1.0f); + var res : vec3 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_16dc15(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_16dc15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_16dc15(); +} diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl new file mode 100644 index 0000000000..3708fa9530 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<4, f32>) -> vec<4, f32> +fn cos_29d66d() { + var arg_0 = vec4(1.f); + var res: vec4 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_29d66d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_29d66d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_29d66d(); +} diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..127e2fbb3c --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_29d66d() { + float4 arg_0 = (1.0f).xxxx; + float4 res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_29d66d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_29d66d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_29d66d(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..127e2fbb3c --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void cos_29d66d() { + float4 arg_0 = (1.0f).xxxx; + float4 res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_29d66d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_29d66d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_29d66d(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl new file mode 100644 index 0000000000..263c8d3211 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cos_29d66d() { + vec4 arg_0 = vec4(1.0f); + vec4 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_29d66d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_29d66d() { + vec4 arg_0 = vec4(1.0f); + vec4 res = cos(arg_0); +} + +void fragment_main() { + cos_29d66d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_29d66d() { + vec4 arg_0 = vec4(1.0f); + vec4 res = cos(arg_0); +} + +void compute_main() { + cos_29d66d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl new file mode 100644 index 0000000000..b30c90be6f --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_29d66d() { + float4 arg_0 = float4(1.0f); + float4 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_29d66d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_29d66d(); + return; +} + +kernel void compute_main() { + cos_29d66d(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b4d38f60b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_29d66d "cos_29d66d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %cos_29d66d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Cos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_29d66d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_29d66d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_29d66d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl new file mode 100644 index 0000000000..090cbe1361 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_29d66d() { + var arg_0 = vec4(1.0f); + var res : vec4 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_29d66d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_29d66d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_29d66d(); +} diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl new file mode 100644 index 0000000000..f539734fb8 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(vec<2, f16>) -> vec<2, f16> +fn cos_5bc2c6() { + var arg_0 = vec2(f16()); + var res: vec2 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_5bc2c6(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_5bc2c6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_5bc2c6(); +} diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..09dad0a3da --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_5bc2c6() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_5bc2c6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_5bc2c6(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..856b91fd2a --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cos_5bc2c6() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_5bc2c6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_5bc2c6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021A2289CA00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021A2289CA00(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl new file mode 100644 index 0000000000..511a5070e1 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_5bc2c6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_5bc2c6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_5bc2c6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cos(arg_0); +} + +void fragment_main() { + cos_5bc2c6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_5bc2c6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cos(arg_0); +} + +void compute_main() { + cos_5bc2c6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl new file mode 100644 index 0000000000..0eb35962e6 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_5bc2c6() { + half2 arg_0 = half2(0.0h); + half2 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_5bc2c6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_5bc2c6(); + return; +} + +kernel void compute_main() { + cos_5bc2c6(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3000bb0d1 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_5bc2c6 "cos_5bc2c6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_5bc2c6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Cos %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_5bc2c6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_5bc2c6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_5bc2c6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl new file mode 100644 index 0000000000..f5711b7cca --- /dev/null +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cos_5bc2c6() { + var arg_0 = vec2(f16()); + var res : vec2 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_5bc2c6(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_5bc2c6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_5bc2c6(); +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl new file mode 100644 index 0000000000..28bff9ad86 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<2, f32>) -> vec<2, f32> +fn cos_c3b486() { + var arg_0 = vec2(1.f); + var res: vec2 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_c3b486(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_c3b486(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_c3b486(); +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1e1389c63b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_c3b486() { + float2 arg_0 = (1.0f).xx; + float2 res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c3b486(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c3b486(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c3b486(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1e1389c63b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void cos_c3b486() { + float2 arg_0 = (1.0f).xx; + float2 res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c3b486(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c3b486(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c3b486(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl new file mode 100644 index 0000000000..c4851f5c62 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cos_c3b486() { + vec2 arg_0 = vec2(1.0f); + vec2 res = cos(arg_0); +} + +vec4 vertex_main() { + cos_c3b486(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_c3b486() { + vec2 arg_0 = vec2(1.0f); + vec2 res = cos(arg_0); +} + +void fragment_main() { + cos_c3b486(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_c3b486() { + vec2 arg_0 = vec2(1.0f); + vec2 res = cos(arg_0); +} + +void compute_main() { + cos_c3b486(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl new file mode 100644 index 0000000000..cade059182 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_c3b486() { + float2 arg_0 = float2(1.0f); + float2 res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_c3b486(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_c3b486(); + return; +} + +kernel void compute_main() { + cos_c3b486(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8a58de530 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_c3b486 "cos_c3b486" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float + %cos_c3b486 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Cos %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %cos_c3b486 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_c3b486 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_c3b486 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4f69019f1 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_c3b486() { + var arg_0 = vec2(1.0f); + var res : vec2 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_c3b486(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_c3b486(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_c3b486(); +} diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl new file mode 100644 index 0000000000..fd7bd2cdbf --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(f32) -> f32 +fn cos_c5c28e() { + var arg_0 = 1.f; + var res: f32 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_c5c28e(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_c5c28e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_c5c28e(); +} diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d5e81f65c6 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c5c28e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c5c28e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c5c28e(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5e81f65c6 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_c5c28e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_c5c28e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_c5c28e(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl new file mode 100644 index 0000000000..cb5df10552 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +vec4 vertex_main() { + cos_c5c28e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +void fragment_main() { + cos_c5c28e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +void compute_main() { + cos_c5c28e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl new file mode 100644 index 0000000000..2eeca23185 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_c5c28e() { + float arg_0 = 1.0f; + float res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_c5c28e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_c5c28e(); + return; +} + +kernel void compute_main() { + cos_c5c28e(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1091134ca --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_c5c28e "cos_c5c28e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %cos_c5c28e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Cos %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_c5c28e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cos_c5c28e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_c5c28e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl new file mode 100644 index 0000000000..0356754222 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_c5c28e() { + var arg_0 = 1.0f; + var res : f32 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_c5c28e(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_c5c28e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_c5c28e(); +} diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl new file mode 100644 index 0000000000..0daf862c95 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cos(f16) -> f16 +fn cos_fc047d() { + var arg_0 = f16(); + var res: f16 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_fc047d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_fc047d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_fc047d(); +} diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54b9f70a02 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cos_fc047d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_fc047d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_fc047d(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fb57ccb021 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cos_fc047d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = cos(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_fc047d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_fc047d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023368939570(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023368939570(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl new file mode 100644 index 0000000000..093b9d2e4c --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_fc047d() { + float16_t arg_0 = 0.0hf; + float16_t res = cos(arg_0); +} + +vec4 vertex_main() { + cos_fc047d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cos_fc047d() { + float16_t arg_0 = 0.0hf; + float16_t res = cos(arg_0); +} + +void fragment_main() { + cos_fc047d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cos_fc047d() { + float16_t arg_0 = 0.0hf; + float16_t res = cos(arg_0); +} + +void compute_main() { + cos_fc047d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl new file mode 100644 index 0000000000..2c230eb3df --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cos_fc047d() { + half arg_0 = 0.0h; + half res = cos(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_fc047d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_fc047d(); + return; +} + +kernel void compute_main() { + cos_fc047d(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm new file mode 100644 index 0000000000..4adfb5efe3 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_fc047d "cos_fc047d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %cos_fc047d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Cos %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_fc047d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_fc047d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cos_fc047d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl new file mode 100644 index 0000000000..2230ba231a --- /dev/null +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cos_fc047d() { + var arg_0 = f16(); + var res : f16 = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_fc047d(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_fc047d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_fc047d(); +} diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl new file mode 100644 index 0000000000..b1f69a8002 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(f16) -> f16 +fn cosh_2ed778() { + var arg_0 = f16(); + var res: f16 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_2ed778(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_2ed778(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_2ed778(); +} diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6689a7fa3f --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_2ed778() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_2ed778(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_2ed778(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..daec56396a --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cosh_2ed778() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_2ed778(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_2ed778(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025119222EB0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025119222EB0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl new file mode 100644 index 0000000000..52057b9508 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_2ed778() { + float16_t arg_0 = 0.0hf; + float16_t res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_2ed778(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_2ed778() { + float16_t arg_0 = 0.0hf; + float16_t res = cosh(arg_0); +} + +void fragment_main() { + cosh_2ed778(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_2ed778() { + float16_t arg_0 = 0.0hf; + float16_t res = cosh(arg_0); +} + +void compute_main() { + cosh_2ed778(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl new file mode 100644 index 0000000000..6f72358aae --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_2ed778() { + half arg_0 = 0.0h; + half res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_2ed778(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_2ed778(); + return; +} + +kernel void compute_main() { + cosh_2ed778(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm new file mode 100644 index 0000000000..2079d7e03b --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_2ed778 "cosh_2ed778" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_2ed778 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Cosh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_2ed778 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_2ed778 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cosh_2ed778 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl new file mode 100644 index 0000000000..4d5670595f --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cosh_2ed778() { + var arg_0 = f16(); + var res : f16 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_2ed778(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_2ed778(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_2ed778(); +} diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl b/test/tint/builtins/gen/var/cosh/377652.wgsl new file mode 100644 index 0000000000..4ddda6e8f8 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<3, f32>) -> vec<3, f32> +fn cosh_377652() { + var arg_0 = vec3(1.f); + var res: vec3 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_377652(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_377652(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_377652(); +} diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1a8733f161 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_377652() { + float3 arg_0 = (1.0f).xxx; + float3 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_377652(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_377652(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_377652(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1a8733f161 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void cosh_377652() { + float3 arg_0 = (1.0f).xxx; + float3 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_377652(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_377652(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_377652(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl new file mode 100644 index 0000000000..e6afbd866d --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cosh_377652() { + vec3 arg_0 = vec3(1.0f); + vec3 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_377652(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_377652() { + vec3 arg_0 = vec3(1.0f); + vec3 res = cosh(arg_0); +} + +void fragment_main() { + cosh_377652(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_377652() { + vec3 arg_0 = vec3(1.0f); + vec3 res = cosh(arg_0); +} + +void compute_main() { + cosh_377652(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl new file mode 100644 index 0000000000..baa735beb6 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_377652() { + float3 arg_0 = float3(1.0f); + float3 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_377652(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_377652(); + return; +} + +kernel void compute_main() { + cosh_377652(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f33d505b9 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_377652 "cosh_377652" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%cosh_377652 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Cosh %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %cosh_377652 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_377652 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_377652 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl new file mode 100644 index 0000000000..6196cadb85 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_377652() { + var arg_0 = vec3(1.0f); + var res : vec3 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_377652(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_377652(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_377652(); +} diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl new file mode 100644 index 0000000000..133748afb0 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<4, f16>) -> vec<4, f16> +fn cosh_3b7bbf() { + var arg_0 = vec4(f16()); + var res: vec4 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_3b7bbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_3b7bbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_3b7bbf(); +} diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5a96478604 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_3b7bbf() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_3b7bbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_3b7bbf(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5838354002 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cosh_3b7bbf() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_3b7bbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_3b7bbf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023E2A2C07F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023E2A2C07F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl new file mode 100644 index 0000000000..8ea08d9328 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_3b7bbf() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_3b7bbf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_3b7bbf() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cosh(arg_0); +} + +void fragment_main() { + cosh_3b7bbf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_3b7bbf() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = cosh(arg_0); +} + +void compute_main() { + cosh_3b7bbf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl new file mode 100644 index 0000000000..12acf5fd52 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_3b7bbf() { + half4 arg_0 = half4(0.0h); + half4 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_3b7bbf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_3b7bbf(); + return; +} + +kernel void compute_main() { + cosh_3b7bbf(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b9f8d4ba1 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_3b7bbf "cosh_3b7bbf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_3b7bbf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Cosh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_3b7bbf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_3b7bbf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_3b7bbf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl new file mode 100644 index 0000000000..06d346d94e --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cosh_3b7bbf() { + var arg_0 = vec4(f16()); + var res : vec4 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_3b7bbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_3b7bbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_3b7bbf(); +} diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl new file mode 100644 index 0000000000..a1e32ad8da --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<2, f16>) -> vec<2, f16> +fn cosh_43b672() { + var arg_0 = vec2(f16()); + var res: vec2 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_43b672(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_43b672(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_43b672(); +} diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db19b27193 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_43b672() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_43b672(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_43b672(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a35fa628a4 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cosh_43b672() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_43b672(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_43b672(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000244BAA52310(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000244BAA52310(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl new file mode 100644 index 0000000000..8c60a2cd95 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_43b672() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_43b672(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_43b672() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cosh(arg_0); +} + +void fragment_main() { + cosh_43b672(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_43b672() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = cosh(arg_0); +} + +void compute_main() { + cosh_43b672(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl new file mode 100644 index 0000000000..1a50e7e669 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_43b672() { + half2 arg_0 = half2(0.0h); + half2 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_43b672(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_43b672(); + return; +} + +kernel void compute_main() { + cosh_43b672(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm new file mode 100644 index 0000000000..5658285aea --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_43b672 "cosh_43b672" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_43b672 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Cosh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_43b672 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_43b672 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_43b672 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl new file mode 100644 index 0000000000..979119f2b6 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cosh_43b672() { + var arg_0 = vec2(f16()); + var res : vec2 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_43b672(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_43b672(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_43b672(); +} diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl new file mode 100644 index 0000000000..10b551b180 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cosh(vec<3, f16>) -> vec<3, f16> +fn cosh_b1b8a0() { + var arg_0 = vec3(f16()); + var res: vec3 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_b1b8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_b1b8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_b1b8a0(); +} diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a058cd26b0 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_b1b8a0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_b1b8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_b1b8a0(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..86a786ded5 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void cosh_b1b8a0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_b1b8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_b1b8a0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018FD1882B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018FD1882B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl new file mode 100644 index 0000000000..6566e922c4 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_b1b8a0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_b1b8a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cosh_b1b8a0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cosh(arg_0); +} + +void fragment_main() { + cosh_b1b8a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cosh_b1b8a0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = cosh(arg_0); +} + +void compute_main() { + cosh_b1b8a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl new file mode 100644 index 0000000000..2cf0802e2c --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_b1b8a0() { + half3 arg_0 = half3(0.0h); + half3 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_b1b8a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_b1b8a0(); + return; +} + +kernel void compute_main() { + cosh_b1b8a0(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..29505ec4ba --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_b1b8a0 "cosh_b1b8a0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cosh_b1b8a0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Cosh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_b1b8a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_b1b8a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_b1b8a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..273765b77d --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn cosh_b1b8a0() { + var arg_0 = vec3(f16()); + var res : vec3 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_b1b8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_b1b8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_b1b8a0(); +} diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl new file mode 100644 index 0000000000..5ac6b09993 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<2, f32>) -> vec<2, f32> +fn cosh_c13756() { + var arg_0 = vec2(1.f); + var res: vec2 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_c13756(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_c13756(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_c13756(); +} diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7136500a20 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_c13756() { + float2 arg_0 = (1.0f).xx; + float2 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_c13756(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_c13756(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_c13756(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7136500a20 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void cosh_c13756() { + float2 arg_0 = (1.0f).xx; + float2 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_c13756(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_c13756(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_c13756(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl new file mode 100644 index 0000000000..b484ca753d --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cosh_c13756() { + vec2 arg_0 = vec2(1.0f); + vec2 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_c13756(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_c13756() { + vec2 arg_0 = vec2(1.0f); + vec2 res = cosh(arg_0); +} + +void fragment_main() { + cosh_c13756(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_c13756() { + vec2 arg_0 = vec2(1.0f); + vec2 res = cosh(arg_0); +} + +void compute_main() { + cosh_c13756(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl new file mode 100644 index 0000000000..93ce84c77e --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_c13756() { + float2 arg_0 = float2(1.0f); + float2 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_c13756(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_c13756(); + return; +} + +kernel void compute_main() { + cosh_c13756(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm new file mode 100644 index 0000000000..246ed00bcc --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_c13756 "cosh_c13756" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%cosh_c13756 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Cosh %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %cosh_c13756 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_c13756 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_c13756 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl new file mode 100644 index 0000000000..2b9a859ab8 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_c13756() { + var arg_0 = vec2(1.0f); + var res : vec2 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_c13756(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_c13756(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_c13756(); +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl new file mode 100644 index 0000000000..bebbde2eb4 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(f32) -> f32 +fn cosh_da92dd() { + var arg_0 = 1.f; + var res: f32 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_da92dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_da92dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_da92dd(); +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..657c3dd842 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_da92dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_da92dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_da92dd(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..657c3dd842 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_da92dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_da92dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_da92dd(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl new file mode 100644 index 0000000000..f87144f079 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_da92dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +void fragment_main() { + cosh_da92dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +void compute_main() { + cosh_da92dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl new file mode 100644 index 0000000000..ed4cc477f5 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_da92dd() { + float arg_0 = 1.0f; + float res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_da92dd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_da92dd(); + return; +} + +kernel void compute_main() { + cosh_da92dd(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..c82b34fb4c --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_da92dd "cosh_da92dd" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%cosh_da92dd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Cosh %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_da92dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cosh_da92dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_da92dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..92c780e9f7 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_da92dd() { + var arg_0 = 1.0f; + var res : f32 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_da92dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_da92dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_da92dd(); +} diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl new file mode 100644 index 0000000000..826f151046 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<4, f32>) -> vec<4, f32> +fn cosh_e0c1de() { + var arg_0 = vec4(1.f); + var res: vec4 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_e0c1de(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_e0c1de(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_e0c1de(); +} diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..37d3c569eb --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void cosh_e0c1de() { + float4 arg_0 = (1.0f).xxxx; + float4 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_e0c1de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_e0c1de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_e0c1de(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..37d3c569eb --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void cosh_e0c1de() { + float4 arg_0 = (1.0f).xxxx; + float4 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_e0c1de(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_e0c1de(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_e0c1de(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl new file mode 100644 index 0000000000..48eb02fe6e --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void cosh_e0c1de() { + vec4 arg_0 = vec4(1.0f); + vec4 res = cosh(arg_0); +} + +vec4 vertex_main() { + cosh_e0c1de(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_e0c1de() { + vec4 arg_0 = vec4(1.0f); + vec4 res = cosh(arg_0); +} + +void fragment_main() { + cosh_e0c1de(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_e0c1de() { + vec4 arg_0 = vec4(1.0f); + vec4 res = cosh(arg_0); +} + +void compute_main() { + cosh_e0c1de(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl new file mode 100644 index 0000000000..c96ffa68c5 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void cosh_e0c1de() { + float4 arg_0 = float4(1.0f); + float4 res = cosh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_e0c1de(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_e0c1de(); + return; +} + +kernel void compute_main() { + cosh_e0c1de(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm new file mode 100644 index 0000000000..fba4a835b2 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_e0c1de "cosh_e0c1de" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%cosh_e0c1de = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Cosh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_e0c1de + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_e0c1de + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_e0c1de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl new file mode 100644 index 0000000000..46f14b868a --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_e0c1de() { + var arg_0 = vec4(1.0f); + var res : vec4 = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_e0c1de(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_e0c1de(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_e0c1de(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl new file mode 100644 index 0000000000..55921e4cb5 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(u32) -> u32 +fn countLeadingZeros_208d46() { + var arg_0 = 1u; + var res: u32 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_208d46(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_208d46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_208d46(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..65bbec9d87 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_208d46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_208d46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_208d46(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65bbec9d87 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_208d46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_208d46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_208d46(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl new file mode 100644 index 0000000000..d416594795 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_208d46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_208d46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_count_leading_zeros(uint v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_208d46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl new file mode 100644 index 0000000000..545a925403 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_208d46() { + uint arg_0 = 1u; + uint res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_208d46(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_208d46(); + return; +} + +kernel void compute_main() { + countLeadingZeros_208d46(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fb26d7b2d --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_208d46 "countLeadingZeros_208d46" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %uint_65535 = OpConstant %uint 65535 + %bool = OpTypeBool + %uint_16 = OpConstant %uint 16 +%uint_16777215 = OpConstant %uint 16777215 + %uint_8 = OpConstant %uint 8 +%uint_268435455 = OpConstant %uint 268435455 + %uint_4 = OpConstant %uint 4 +%uint_1073741823 = OpConstant %uint 1073741823 + %uint_2 = OpConstant %uint 2 +%uint_2147483647 = OpConstant %uint 2147483647 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %61 = OpTypeFunction %void + %69 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %17 + OpStore %x %v + %19 = OpLoad %uint %x + %21 = OpULessThanEqual %bool %19 %uint_65535 + %18 = OpSelect %uint %21 %uint_16 %17 + %24 = OpLoad %uint %x + %25 = OpShiftLeftLogical %uint %24 %18 + OpStore %x %25 + %27 = OpLoad %uint %x + %29 = OpULessThanEqual %bool %27 %uint_16777215 + %26 = OpSelect %uint %29 %uint_8 %17 + %31 = OpLoad %uint %x + %32 = OpShiftLeftLogical %uint %31 %26 + OpStore %x %32 + %34 = OpLoad %uint %x + %36 = OpULessThanEqual %bool %34 %uint_268435455 + %33 = OpSelect %uint %36 %uint_4 %17 + %38 = OpLoad %uint %x + %39 = OpShiftLeftLogical %uint %38 %33 + OpStore %x %39 + %41 = OpLoad %uint %x + %43 = OpULessThanEqual %bool %41 %uint_1073741823 + %40 = OpSelect %uint %43 %uint_2 %17 + %45 = OpLoad %uint %x + %46 = OpShiftLeftLogical %uint %45 %40 + OpStore %x %46 + %48 = OpLoad %uint %x + %50 = OpULessThanEqual %bool %48 %uint_2147483647 + %47 = OpSelect %uint %50 %uint_1 %17 + %53 = OpLoad %uint %x + %54 = OpIEqual %bool %53 %17 + %52 = OpSelect %uint %54 %uint_1 %17 + %56 = OpBitwiseOr %uint %18 %26 + %57 = OpBitwiseOr %uint %56 %33 + %58 = OpBitwiseOr %uint %57 %40 + %59 = OpBitwiseOr %uint %58 %47 + %60 = OpIAdd %uint %59 %52 + OpReturnValue %60 + OpFunctionEnd +%countLeadingZeros_208d46 = OpFunction %void None %61 + %64 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %67 = OpLoad %uint %arg_0 + %66 = OpFunctionCall %uint %tint_count_leading_zeros %67 + OpStore %res %66 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %69 + %71 = OpLabel + %72 = OpFunctionCall %void %countLeadingZeros_208d46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %61 + %74 = OpLabel + %75 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %75 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %61 + %78 = OpLabel + %79 = OpFunctionCall %void %countLeadingZeros_208d46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %61 + %81 = OpLabel + %82 = OpFunctionCall %void %countLeadingZeros_208d46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe43b71e84 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_208d46() { + var arg_0 = 1u; + var res : u32 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_208d46(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_208d46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_208d46(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl new file mode 100644 index 0000000000..67a815bc33 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(i32) -> i32 +fn countLeadingZeros_6d4656() { + var arg_0 = 1; + var res: i32 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_6d4656(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_6d4656(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_6d4656(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ddf54fb1eb --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int tint_count_leading_zeros(int v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_6d4656(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_6d4656(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_6d4656(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ddf54fb1eb --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int tint_count_leading_zeros(int v) { + uint x = uint(v); + const uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + const uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + const uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + const uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + const uint b1 = ((x <= 2147483647u) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_6d4656(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_6d4656(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_6d4656(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl new file mode 100644 index 0000000000..4e140afbc9 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +int tint_count_leading_zeros(int v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_6d4656(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_count_leading_zeros(int v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_6d4656(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_count_leading_zeros(int v) { + uint x = uint(v); + uint b16 = ((x <= 65535u) ? 16u : 0u); + x = (x << b16); + uint b8 = ((x <= 16777215u) ? 8u : 0u); + x = (x << b8); + uint b4 = ((x <= 268435455u) ? 4u : 0u); + x = (x << b4); + uint b2 = ((x <= 1073741823u) ? 2u : 0u); + x = (x << b2); + uint b1 = ((x <= 2147483647u) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_6d4656(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl new file mode 100644 index 0000000000..260714f47b --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_6d4656() { + int arg_0 = 1; + int res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_6d4656(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_6d4656(); + return; +} + +kernel void compute_main() { + countLeadingZeros_6d4656(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm new file mode 100644 index 0000000000..558ca73783 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_6d4656 "countLeadingZeros_6d4656" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %uint_65535 = OpConstant %uint 65535 + %bool = OpTypeBool + %uint_16 = OpConstant %uint 16 +%uint_16777215 = OpConstant %uint 16777215 + %uint_8 = OpConstant %uint 8 +%uint_268435455 = OpConstant %uint 268435455 + %uint_4 = OpConstant %uint 4 +%uint_1073741823 = OpConstant %uint 1073741823 + %uint_2 = OpConstant %uint 2 +%uint_2147483647 = OpConstant %uint 2147483647 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %62 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %69 = OpConstantNull %int + %73 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %18 + %14 = OpBitcast %uint %v + OpStore %x %14 + %20 = OpLoad %uint %x + %22 = OpULessThanEqual %bool %20 %uint_65535 + %19 = OpSelect %uint %22 %uint_16 %18 + %25 = OpLoad %uint %x + %26 = OpShiftLeftLogical %uint %25 %19 + OpStore %x %26 + %28 = OpLoad %uint %x + %30 = OpULessThanEqual %bool %28 %uint_16777215 + %27 = OpSelect %uint %30 %uint_8 %18 + %32 = OpLoad %uint %x + %33 = OpShiftLeftLogical %uint %32 %27 + OpStore %x %33 + %35 = OpLoad %uint %x + %37 = OpULessThanEqual %bool %35 %uint_268435455 + %34 = OpSelect %uint %37 %uint_4 %18 + %39 = OpLoad %uint %x + %40 = OpShiftLeftLogical %uint %39 %34 + OpStore %x %40 + %42 = OpLoad %uint %x + %44 = OpULessThanEqual %bool %42 %uint_1073741823 + %41 = OpSelect %uint %44 %uint_2 %18 + %46 = OpLoad %uint %x + %47 = OpShiftLeftLogical %uint %46 %41 + OpStore %x %47 + %49 = OpLoad %uint %x + %51 = OpULessThanEqual %bool %49 %uint_2147483647 + %48 = OpSelect %uint %51 %uint_1 %18 + %54 = OpLoad %uint %x + %55 = OpIEqual %bool %54 %18 + %53 = OpSelect %uint %55 %uint_1 %18 + %57 = OpBitwiseOr %uint %19 %27 + %58 = OpBitwiseOr %uint %57 %34 + %59 = OpBitwiseOr %uint %58 %41 + %60 = OpBitwiseOr %uint %59 %48 + %61 = OpIAdd %uint %60 %53 + %56 = OpBitcast %int %61 + OpReturnValue %56 + OpFunctionEnd +%countLeadingZeros_6d4656 = OpFunction %void None %62 + %65 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %69 + %res = OpVariable %_ptr_Function_int Function %69 + OpStore %arg_0 %int_1 + %71 = OpLoad %int %arg_0 + %70 = OpFunctionCall %int %tint_count_leading_zeros %71 + OpStore %res %70 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %73 + %75 = OpLabel + %76 = OpFunctionCall %void %countLeadingZeros_6d4656 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %62 + %78 = OpLabel + %79 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %79 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %62 + %82 = OpLabel + %83 = OpFunctionCall %void %countLeadingZeros_6d4656 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %62 + %85 = OpLabel + %86 = OpFunctionCall %void %countLeadingZeros_6d4656 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl new file mode 100644 index 0000000000..2b8a2721c5 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_6d4656() { + var arg_0 = 1; + var res : i32 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_6d4656(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_6d4656(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_6d4656(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl new file mode 100644 index 0000000000..3758296834 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<2, u32>) -> vec<2, u32> +fn countLeadingZeros_70783f() { + var arg_0 = vec2(1u); + var res: vec2 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_70783f(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_70783f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_70783f(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d1fb0c6d14 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint2 tint_count_leading_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uint2 arg_0 = (1u).xx; + uint2 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_70783f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_70783f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_70783f(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d1fb0c6d14 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint2 tint_count_leading_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uint2 arg_0 = (1u).xx; + uint2 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_70783f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_70783f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_70783f(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl new file mode 100644 index 0000000000..22a8c45e9f --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec2 tint_count_leading_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_70783f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_count_leading_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_70783f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_count_leading_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_70783f() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_70783f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl new file mode 100644 index 0000000000..e79069ae67 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_70783f() { + uint2 arg_0 = uint2(1u); + uint2 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_70783f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_70783f(); + return; +} + +kernel void compute_main() { + countLeadingZeros_70783f(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm new file mode 100644 index 0000000000..869590d9e2 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 95 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_70783f "countLeadingZeros_70783f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %18 = OpConstantNull %v2uint + %uint_65535 = OpConstant %uint 65535 + %22 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v2uint %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %33 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %36 = OpConstantComposite %v2uint %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %42 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %45 = OpConstantComposite %v2uint %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %51 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %54 = OpConstantComposite %v2uint %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %60 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %63 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %73 = OpTypeFunction %void + %81 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %x %v + %20 = OpLoad %v2uint %x + %23 = OpULessThanEqual %v2bool %20 %22 + %19 = OpSelect %v2uint %23 %27 %18 + %28 = OpLoad %v2uint %x + %29 = OpShiftLeftLogical %v2uint %28 %19 + OpStore %x %29 + %31 = OpLoad %v2uint %x + %34 = OpULessThanEqual %v2bool %31 %33 + %30 = OpSelect %v2uint %34 %36 %18 + %37 = OpLoad %v2uint %x + %38 = OpShiftLeftLogical %v2uint %37 %30 + OpStore %x %38 + %40 = OpLoad %v2uint %x + %43 = OpULessThanEqual %v2bool %40 %42 + %39 = OpSelect %v2uint %43 %45 %18 + %46 = OpLoad %v2uint %x + %47 = OpShiftLeftLogical %v2uint %46 %39 + OpStore %x %47 + %49 = OpLoad %v2uint %x + %52 = OpULessThanEqual %v2bool %49 %51 + %48 = OpSelect %v2uint %52 %54 %18 + %55 = OpLoad %v2uint %x + %56 = OpShiftLeftLogical %v2uint %55 %48 + OpStore %x %56 + %58 = OpLoad %v2uint %x + %61 = OpULessThanEqual %v2bool %58 %60 + %57 = OpSelect %v2uint %61 %63 %18 + %65 = OpLoad %v2uint %x + %66 = OpIEqual %v2bool %65 %18 + %64 = OpSelect %v2uint %66 %63 %18 + %68 = OpBitwiseOr %v2uint %19 %30 + %69 = OpBitwiseOr %v2uint %68 %39 + %70 = OpBitwiseOr %v2uint %69 %48 + %71 = OpBitwiseOr %v2uint %70 %57 + %72 = OpIAdd %v2uint %71 %64 + OpReturnValue %72 + OpFunctionEnd +%countLeadingZeros_70783f = OpFunction %void None %73 + %76 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %18 + %res = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %arg_0 %63 + %79 = OpLoad %v2uint %arg_0 + %78 = OpFunctionCall %v2uint %tint_count_leading_zeros %79 + OpStore %res %78 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %81 + %83 = OpLabel + %84 = OpFunctionCall %void %countLeadingZeros_70783f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %73 + %86 = OpLabel + %87 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %87 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %73 + %90 = OpLabel + %91 = OpFunctionCall %void %countLeadingZeros_70783f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %73 + %93 = OpLabel + %94 = OpFunctionCall %void %countLeadingZeros_70783f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl new file mode 100644 index 0000000000..27e31b6105 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_70783f() { + var arg_0 = vec2(1u); + var res : vec2 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_70783f(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_70783f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_70783f(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl new file mode 100644 index 0000000000..83dba7b863 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<3, i32>) -> vec<3, i32> +fn countLeadingZeros_7c38a6() { + var arg_0 = vec3(1); + var res: vec3 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_7c38a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_7c38a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_7c38a6(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..07c2c53af0 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int3 tint_count_leading_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + int3 arg_0 = (1).xxx; + int3 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_7c38a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_7c38a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_7c38a6(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..07c2c53af0 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int3 tint_count_leading_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + int3 arg_0 = (1).xxx; + int3 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_7c38a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_7c38a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_7c38a6(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl new file mode 100644 index 0000000000..bfef89e604 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec3 tint_count_leading_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_7c38a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_count_leading_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_7c38a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_count_leading_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_7c38a6() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_7c38a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl new file mode 100644 index 0000000000..05f2c9c52a --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_7c38a6() { + int3 arg_0 = int3(1); + int3 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_7c38a6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_7c38a6(); + return; +} + +kernel void compute_main() { + countLeadingZeros_7c38a6(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..fa15928f9f --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 101 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_7c38a6 "countLeadingZeros_7c38a6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %uint_65535 = OpConstant %uint 65535 + %24 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_16 = OpConstant %uint 16 + %29 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %35 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %44 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %53 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %56 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %62 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %75 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %80 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %83 = OpConstantNull %v3int + %87 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %20 + %15 = OpBitcast %v3uint %v + OpStore %x %15 + %22 = OpLoad %v3uint %x + %25 = OpULessThanEqual %v3bool %22 %24 + %21 = OpSelect %v3uint %25 %29 %20 + %30 = OpLoad %v3uint %x + %31 = OpShiftLeftLogical %v3uint %30 %21 + OpStore %x %31 + %33 = OpLoad %v3uint %x + %36 = OpULessThanEqual %v3bool %33 %35 + %32 = OpSelect %v3uint %36 %38 %20 + %39 = OpLoad %v3uint %x + %40 = OpShiftLeftLogical %v3uint %39 %32 + OpStore %x %40 + %42 = OpLoad %v3uint %x + %45 = OpULessThanEqual %v3bool %42 %44 + %41 = OpSelect %v3uint %45 %47 %20 + %48 = OpLoad %v3uint %x + %49 = OpShiftLeftLogical %v3uint %48 %41 + OpStore %x %49 + %51 = OpLoad %v3uint %x + %54 = OpULessThanEqual %v3bool %51 %53 + %50 = OpSelect %v3uint %54 %56 %20 + %57 = OpLoad %v3uint %x + %58 = OpShiftLeftLogical %v3uint %57 %50 + OpStore %x %58 + %60 = OpLoad %v3uint %x + %63 = OpULessThanEqual %v3bool %60 %62 + %59 = OpSelect %v3uint %63 %65 %20 + %67 = OpLoad %v3uint %x + %68 = OpIEqual %v3bool %67 %20 + %66 = OpSelect %v3uint %68 %65 %20 + %70 = OpBitwiseOr %v3uint %21 %32 + %71 = OpBitwiseOr %v3uint %70 %41 + %72 = OpBitwiseOr %v3uint %71 %50 + %73 = OpBitwiseOr %v3uint %72 %59 + %74 = OpIAdd %v3uint %73 %66 + %69 = OpBitcast %v3int %74 + OpReturnValue %69 + OpFunctionEnd +%countLeadingZeros_7c38a6 = OpFunction %void None %75 + %78 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %83 + %res = OpVariable %_ptr_Function_v3int Function %83 + OpStore %arg_0 %80 + %85 = OpLoad %v3int %arg_0 + %84 = OpFunctionCall %v3int %tint_count_leading_zeros %85 + OpStore %res %84 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %87 + %89 = OpLabel + %90 = OpFunctionCall %void %countLeadingZeros_7c38a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %75 + %92 = OpLabel + %93 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %93 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %75 + %96 = OpLabel + %97 = OpFunctionCall %void %countLeadingZeros_7c38a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %75 + %99 = OpLabel + %100 = OpFunctionCall %void %countLeadingZeros_7c38a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e75705fc5 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_7c38a6() { + var arg_0 = vec3(1); + var res : vec3 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_7c38a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_7c38a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_7c38a6(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl new file mode 100644 index 0000000000..303408fa60 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<2, i32>) -> vec<2, i32> +fn countLeadingZeros_858d40() { + var arg_0 = vec2(1); + var res: vec2 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_858d40(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_858d40(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_858d40(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d7b466fa18 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int2 tint_count_leading_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + int2 arg_0 = (1).xx; + int2 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_858d40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_858d40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_858d40(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d7b466fa18 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int2 tint_count_leading_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx); + x = (x << b16); + const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx); + x = (x << b8); + const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx); + x = (x << b4); + const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx); + x = (x << b2); + const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + int2 arg_0 = (1).xx; + int2 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_858d40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_858d40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_858d40(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl new file mode 100644 index 0000000000..5608edd9e8 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec2 tint_count_leading_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_858d40(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_count_leading_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_858d40(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_count_leading_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u))); + x = (x << b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u))); + x = (x << b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u))); + x = (x << b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u))); + x = (x << b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_858d40() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_858d40(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl new file mode 100644 index 0000000000..cb4b096ac9 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_858d40() { + int2 arg_0 = int2(1); + int2 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_858d40(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_858d40(); + return; +} + +kernel void compute_main() { + countLeadingZeros_858d40(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm new file mode 100644 index 0000000000..f09f222492 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 101 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_858d40 "countLeadingZeros_858d40" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %uint_65535 = OpConstant %uint 65535 + %24 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_16 = OpConstant %uint 16 + %29 = OpConstantComposite %v2uint %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %35 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v2uint %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %44 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v2uint %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %53 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %56 = OpConstantComposite %v2uint %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %62 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %75 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %80 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %83 = OpConstantNull %v2int + %87 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %20 + %15 = OpBitcast %v2uint %v + OpStore %x %15 + %22 = OpLoad %v2uint %x + %25 = OpULessThanEqual %v2bool %22 %24 + %21 = OpSelect %v2uint %25 %29 %20 + %30 = OpLoad %v2uint %x + %31 = OpShiftLeftLogical %v2uint %30 %21 + OpStore %x %31 + %33 = OpLoad %v2uint %x + %36 = OpULessThanEqual %v2bool %33 %35 + %32 = OpSelect %v2uint %36 %38 %20 + %39 = OpLoad %v2uint %x + %40 = OpShiftLeftLogical %v2uint %39 %32 + OpStore %x %40 + %42 = OpLoad %v2uint %x + %45 = OpULessThanEqual %v2bool %42 %44 + %41 = OpSelect %v2uint %45 %47 %20 + %48 = OpLoad %v2uint %x + %49 = OpShiftLeftLogical %v2uint %48 %41 + OpStore %x %49 + %51 = OpLoad %v2uint %x + %54 = OpULessThanEqual %v2bool %51 %53 + %50 = OpSelect %v2uint %54 %56 %20 + %57 = OpLoad %v2uint %x + %58 = OpShiftLeftLogical %v2uint %57 %50 + OpStore %x %58 + %60 = OpLoad %v2uint %x + %63 = OpULessThanEqual %v2bool %60 %62 + %59 = OpSelect %v2uint %63 %65 %20 + %67 = OpLoad %v2uint %x + %68 = OpIEqual %v2bool %67 %20 + %66 = OpSelect %v2uint %68 %65 %20 + %70 = OpBitwiseOr %v2uint %21 %32 + %71 = OpBitwiseOr %v2uint %70 %41 + %72 = OpBitwiseOr %v2uint %71 %50 + %73 = OpBitwiseOr %v2uint %72 %59 + %74 = OpIAdd %v2uint %73 %66 + %69 = OpBitcast %v2int %74 + OpReturnValue %69 + OpFunctionEnd +%countLeadingZeros_858d40 = OpFunction %void None %75 + %78 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %83 + %res = OpVariable %_ptr_Function_v2int Function %83 + OpStore %arg_0 %80 + %85 = OpLoad %v2int %arg_0 + %84 = OpFunctionCall %v2int %tint_count_leading_zeros %85 + OpStore %res %84 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %87 + %89 = OpLabel + %90 = OpFunctionCall %void %countLeadingZeros_858d40 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %75 + %92 = OpLabel + %93 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %93 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %75 + %96 = OpLabel + %97 = OpFunctionCall %void %countLeadingZeros_858d40 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %75 + %99 = OpLabel + %100 = OpFunctionCall %void %countLeadingZeros_858d40 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl new file mode 100644 index 0000000000..9641853620 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_858d40() { + var arg_0 = vec2(1); + var res : vec2 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_858d40(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_858d40(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_858d40(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl new file mode 100644 index 0000000000..1a5300ad6e --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<3, u32>) -> vec<3, u32> +fn countLeadingZeros_ab6345() { + var arg_0 = vec3(1u); + var res: vec3 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_ab6345(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_ab6345(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_ab6345(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2ca1c78096 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint3 tint_count_leading_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uint3 arg_0 = (1u).xxx; + uint3 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_ab6345(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_ab6345(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_ab6345(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ca1c78096 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint3 tint_count_leading_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx); + x = (x << b16); + const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx); + x = (x << b8); + const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx); + x = (x << b4); + const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx); + x = (x << b2); + const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uint3 arg_0 = (1u).xxx; + uint3 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_ab6345(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_ab6345(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_ab6345(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl new file mode 100644 index 0000000000..5da2eb62c9 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec3 tint_count_leading_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_ab6345(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_count_leading_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_ab6345(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_count_leading_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u))); + x = (x << b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u))); + x = (x << b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u))); + x = (x << b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u))); + x = (x << b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_ab6345() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_ab6345(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl new file mode 100644 index 0000000000..080bc735e7 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_ab6345() { + uint3 arg_0 = uint3(1u); + uint3 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_ab6345(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_ab6345(); + return; +} + +kernel void compute_main() { + countLeadingZeros_ab6345(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm new file mode 100644 index 0000000000..e152518f90 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 95 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_ab6345 "countLeadingZeros_ab6345" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %uint_65535 = OpConstant %uint 65535 + %22 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %33 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %36 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %42 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %45 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %51 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %54 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %60 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %63 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %73 = OpTypeFunction %void + %81 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %x %v + %20 = OpLoad %v3uint %x + %23 = OpULessThanEqual %v3bool %20 %22 + %19 = OpSelect %v3uint %23 %27 %18 + %28 = OpLoad %v3uint %x + %29 = OpShiftLeftLogical %v3uint %28 %19 + OpStore %x %29 + %31 = OpLoad %v3uint %x + %34 = OpULessThanEqual %v3bool %31 %33 + %30 = OpSelect %v3uint %34 %36 %18 + %37 = OpLoad %v3uint %x + %38 = OpShiftLeftLogical %v3uint %37 %30 + OpStore %x %38 + %40 = OpLoad %v3uint %x + %43 = OpULessThanEqual %v3bool %40 %42 + %39 = OpSelect %v3uint %43 %45 %18 + %46 = OpLoad %v3uint %x + %47 = OpShiftLeftLogical %v3uint %46 %39 + OpStore %x %47 + %49 = OpLoad %v3uint %x + %52 = OpULessThanEqual %v3bool %49 %51 + %48 = OpSelect %v3uint %52 %54 %18 + %55 = OpLoad %v3uint %x + %56 = OpShiftLeftLogical %v3uint %55 %48 + OpStore %x %56 + %58 = OpLoad %v3uint %x + %61 = OpULessThanEqual %v3bool %58 %60 + %57 = OpSelect %v3uint %61 %63 %18 + %65 = OpLoad %v3uint %x + %66 = OpIEqual %v3bool %65 %18 + %64 = OpSelect %v3uint %66 %63 %18 + %68 = OpBitwiseOr %v3uint %19 %30 + %69 = OpBitwiseOr %v3uint %68 %39 + %70 = OpBitwiseOr %v3uint %69 %48 + %71 = OpBitwiseOr %v3uint %70 %57 + %72 = OpIAdd %v3uint %71 %64 + OpReturnValue %72 + OpFunctionEnd +%countLeadingZeros_ab6345 = OpFunction %void None %73 + %76 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %18 + %res = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %arg_0 %63 + %79 = OpLoad %v3uint %arg_0 + %78 = OpFunctionCall %v3uint %tint_count_leading_zeros %79 + OpStore %res %78 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %81 + %83 = OpLabel + %84 = OpFunctionCall %void %countLeadingZeros_ab6345 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %73 + %86 = OpLabel + %87 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %87 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %73 + %90 = OpLabel + %91 = OpFunctionCall %void %countLeadingZeros_ab6345 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %73 + %93 = OpLabel + %94 = OpFunctionCall %void %countLeadingZeros_ab6345 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl new file mode 100644 index 0000000000..abf1355c3a --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_ab6345() { + var arg_0 = vec3(1u); + var res : vec3 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_ab6345(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_ab6345(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_ab6345(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl new file mode 100644 index 0000000000..0bea18aaa1 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<4, i32>) -> vec<4, i32> +fn countLeadingZeros_eab32b() { + var arg_0 = vec4(1); + var res: vec4 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_eab32b(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_eab32b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_eab32b(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..945fbe238e --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int4 tint_count_leading_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + int4 arg_0 = (1).xxxx; + int4 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_eab32b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_eab32b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_eab32b(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..945fbe238e --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int4 tint_count_leading_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + int4 arg_0 = (1).xxxx; + int4 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_eab32b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_eab32b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_eab32b(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl new file mode 100644 index 0000000000..32c3d54e7d --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec4 tint_count_leading_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_eab32b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_count_leading_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_eab32b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_count_leading_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_eab32b() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_eab32b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl new file mode 100644 index 0000000000..dc41bfefbd --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_eab32b() { + int4 arg_0 = int4(1); + int4 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_eab32b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_eab32b(); + return; +} + +kernel void compute_main() { + countLeadingZeros_eab32b(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm new file mode 100644 index 0000000000..da49ea1253 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 101 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_eab32b "countLeadingZeros_eab32b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %uint_65535 = OpConstant %uint 65535 + %24 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_16 = OpConstant %uint 16 + %29 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %35 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %44 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %53 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %56 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %62 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %75 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %80 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %83 = OpConstantNull %v4int + %87 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %20 + %15 = OpBitcast %v4uint %v + OpStore %x %15 + %22 = OpLoad %v4uint %x + %25 = OpULessThanEqual %v4bool %22 %24 + %21 = OpSelect %v4uint %25 %29 %20 + %30 = OpLoad %v4uint %x + %31 = OpShiftLeftLogical %v4uint %30 %21 + OpStore %x %31 + %33 = OpLoad %v4uint %x + %36 = OpULessThanEqual %v4bool %33 %35 + %32 = OpSelect %v4uint %36 %38 %20 + %39 = OpLoad %v4uint %x + %40 = OpShiftLeftLogical %v4uint %39 %32 + OpStore %x %40 + %42 = OpLoad %v4uint %x + %45 = OpULessThanEqual %v4bool %42 %44 + %41 = OpSelect %v4uint %45 %47 %20 + %48 = OpLoad %v4uint %x + %49 = OpShiftLeftLogical %v4uint %48 %41 + OpStore %x %49 + %51 = OpLoad %v4uint %x + %54 = OpULessThanEqual %v4bool %51 %53 + %50 = OpSelect %v4uint %54 %56 %20 + %57 = OpLoad %v4uint %x + %58 = OpShiftLeftLogical %v4uint %57 %50 + OpStore %x %58 + %60 = OpLoad %v4uint %x + %63 = OpULessThanEqual %v4bool %60 %62 + %59 = OpSelect %v4uint %63 %65 %20 + %67 = OpLoad %v4uint %x + %68 = OpIEqual %v4bool %67 %20 + %66 = OpSelect %v4uint %68 %65 %20 + %70 = OpBitwiseOr %v4uint %21 %32 + %71 = OpBitwiseOr %v4uint %70 %41 + %72 = OpBitwiseOr %v4uint %71 %50 + %73 = OpBitwiseOr %v4uint %72 %59 + %74 = OpIAdd %v4uint %73 %66 + %69 = OpBitcast %v4int %74 + OpReturnValue %69 + OpFunctionEnd +%countLeadingZeros_eab32b = OpFunction %void None %75 + %78 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %83 + %res = OpVariable %_ptr_Function_v4int Function %83 + OpStore %arg_0 %80 + %85 = OpLoad %v4int %arg_0 + %84 = OpFunctionCall %v4int %tint_count_leading_zeros %85 + OpStore %res %84 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %87 + %89 = OpLabel + %90 = OpFunctionCall %void %countLeadingZeros_eab32b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %75 + %92 = OpLabel + %93 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %93 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %75 + %96 = OpLabel + %97 = OpFunctionCall %void %countLeadingZeros_eab32b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %75 + %99 = OpLabel + %100 = OpFunctionCall %void %countLeadingZeros_eab32b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl new file mode 100644 index 0000000000..c7057d3355 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_eab32b() { + var arg_0 = vec4(1); + var res : vec4 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_eab32b(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_eab32b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_eab32b(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl new file mode 100644 index 0000000000..adbc4fbaea --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countLeadingZeros(vec<4, u32>) -> vec<4, u32> +fn countLeadingZeros_f70103() { + var arg_0 = vec4(1u); + var res: vec4 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_f70103(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_f70103(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_f70103(); +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d5f3876346 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint4 tint_count_leading_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uint4 arg_0 = (1u).xxxx; + uint4 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_f70103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_f70103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_f70103(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5f3876346 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint4 tint_count_leading_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx); + x = (x << b16); + const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx); + x = (x << b8); + const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx); + x = (x << b4); + const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx); + x = (x << b2); + const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uint4 arg_0 = (1u).xxxx; + uint4 res = tint_count_leading_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countLeadingZeros_f70103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countLeadingZeros_f70103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countLeadingZeros_f70103(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl new file mode 100644 index 0000000000..472ba3213b --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec4 tint_count_leading_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_count_leading_zeros(arg_0); +} + +vec4 vertex_main() { + countLeadingZeros_f70103(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_count_leading_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_count_leading_zeros(arg_0); +} + +void fragment_main() { + countLeadingZeros_f70103(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_count_leading_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u))); + x = (x << b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u))); + x = (x << b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u))); + x = (x << b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u))); + x = (x << b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countLeadingZeros_f70103() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_count_leading_zeros(arg_0); +} + +void compute_main() { + countLeadingZeros_f70103(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl new file mode 100644 index 0000000000..2f462c8153 --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countLeadingZeros_f70103() { + uint4 arg_0 = uint4(1u); + uint4 res = clz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countLeadingZeros_f70103(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countLeadingZeros_f70103(); + return; +} + +kernel void compute_main() { + countLeadingZeros_f70103(); + return; +} + diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm new file mode 100644 index 0000000000..03ed1f963e --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 95 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_leading_zeros "tint_count_leading_zeros" + OpName %v "v" + OpName %x "x" + OpName %countLeadingZeros_f70103 "countLeadingZeros_f70103" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %18 = OpConstantNull %v4uint + %uint_65535 = OpConstant %uint 65535 + %22 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 +%uint_16777215 = OpConstant %uint 16777215 + %33 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215 + %uint_8 = OpConstant %uint 8 + %36 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 +%uint_268435455 = OpConstant %uint 268435455 + %42 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455 + %uint_4 = OpConstant %uint 4 + %45 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 +%uint_1073741823 = OpConstant %uint 1073741823 + %51 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823 + %uint_2 = OpConstant %uint 2 + %54 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%uint_2147483647 = OpConstant %uint 2147483647 + %60 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647 + %uint_1 = OpConstant %uint 1 + %63 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %73 = OpTypeFunction %void + %81 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_leading_zeros = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %x %v + %20 = OpLoad %v4uint %x + %23 = OpULessThanEqual %v4bool %20 %22 + %19 = OpSelect %v4uint %23 %27 %18 + %28 = OpLoad %v4uint %x + %29 = OpShiftLeftLogical %v4uint %28 %19 + OpStore %x %29 + %31 = OpLoad %v4uint %x + %34 = OpULessThanEqual %v4bool %31 %33 + %30 = OpSelect %v4uint %34 %36 %18 + %37 = OpLoad %v4uint %x + %38 = OpShiftLeftLogical %v4uint %37 %30 + OpStore %x %38 + %40 = OpLoad %v4uint %x + %43 = OpULessThanEqual %v4bool %40 %42 + %39 = OpSelect %v4uint %43 %45 %18 + %46 = OpLoad %v4uint %x + %47 = OpShiftLeftLogical %v4uint %46 %39 + OpStore %x %47 + %49 = OpLoad %v4uint %x + %52 = OpULessThanEqual %v4bool %49 %51 + %48 = OpSelect %v4uint %52 %54 %18 + %55 = OpLoad %v4uint %x + %56 = OpShiftLeftLogical %v4uint %55 %48 + OpStore %x %56 + %58 = OpLoad %v4uint %x + %61 = OpULessThanEqual %v4bool %58 %60 + %57 = OpSelect %v4uint %61 %63 %18 + %65 = OpLoad %v4uint %x + %66 = OpIEqual %v4bool %65 %18 + %64 = OpSelect %v4uint %66 %63 %18 + %68 = OpBitwiseOr %v4uint %19 %30 + %69 = OpBitwiseOr %v4uint %68 %39 + %70 = OpBitwiseOr %v4uint %69 %48 + %71 = OpBitwiseOr %v4uint %70 %57 + %72 = OpIAdd %v4uint %71 %64 + OpReturnValue %72 + OpFunctionEnd +%countLeadingZeros_f70103 = OpFunction %void None %73 + %76 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %18 + %res = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %arg_0 %63 + %79 = OpLoad %v4uint %arg_0 + %78 = OpFunctionCall %v4uint %tint_count_leading_zeros %79 + OpStore %res %78 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %81 + %83 = OpLabel + %84 = OpFunctionCall %void %countLeadingZeros_f70103 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %73 + %86 = OpLabel + %87 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %87 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %73 + %90 = OpLabel + %91 = OpFunctionCall %void %countLeadingZeros_f70103 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %73 + %93 = OpLabel + %94 = OpFunctionCall %void %countLeadingZeros_f70103 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ff370cd5d --- /dev/null +++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countLeadingZeros_f70103() { + var arg_0 = vec4(1u); + var res : vec4 = countLeadingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countLeadingZeros_f70103(); + return vec4(); +} + +@fragment +fn fragment_main() { + countLeadingZeros_f70103(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countLeadingZeros_f70103(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl new file mode 100644 index 0000000000..7b2217fd86 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<4, u32>) -> vec<4, u32> +fn countOneBits_0d0e46() { + var arg_0 = vec4(1u); + var res: vec4 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0d0e46(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_0d0e46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_0d0e46(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c1a064914 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_0d0e46() { + uint4 arg_0 = (1u).xxxx; + uint4 res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0d0e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0d0e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0d0e46(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c1a064914 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_0d0e46() { + uint4 arg_0 = (1u).xxxx; + uint4 res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0d0e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0d0e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0d0e46(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl new file mode 100644 index 0000000000..72feada534 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_0d0e46() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = uvec4(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_0d0e46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_0d0e46() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = uvec4(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_0d0e46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_0d0e46() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = uvec4(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_0d0e46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl new file mode 100644 index 0000000000..d7e418d964 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_0d0e46() { + uint4 arg_0 = uint4(1u); + uint4 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_0d0e46(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_0d0e46(); + return; +} + +kernel void compute_main() { + countOneBits_0d0e46(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ce78110da --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_0d0e46 "countOneBits_0d0e46" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_0d0e46 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %19 + %res = OpVariable %_ptr_Function_v4uint Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v4uint %arg_0 + %20 = OpBitCount %v4uint %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %countOneBits_0d0e46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %countOneBits_0d0e46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %countOneBits_0d0e46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl new file mode 100644 index 0000000000..af94001510 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_0d0e46() { + var arg_0 = vec4(1u); + var res : vec4 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0d0e46(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_0d0e46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_0d0e46(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl new file mode 100644 index 0000000000..3e184e5685 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<4, i32>) -> vec<4, i32> +fn countOneBits_0f7980() { + var arg_0 = vec4(1); + var res: vec4 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0f7980(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_0f7980(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_0f7980(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e2d8352b9 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_0f7980() { + int4 arg_0 = (1).xxxx; + int4 res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0f7980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0f7980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0f7980(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6e2d8352b9 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_0f7980() { + int4 arg_0 = (1).xxxx; + int4 res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_0f7980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_0f7980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_0f7980(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl new file mode 100644 index 0000000000..693d84ea72 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_0f7980() { + ivec4 arg_0 = ivec4(1); + ivec4 res = ivec4(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_0f7980(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_0f7980() { + ivec4 arg_0 = ivec4(1); + ivec4 res = ivec4(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_0f7980(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_0f7980() { + ivec4 arg_0 = ivec4(1); + ivec4 res = ivec4(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_0f7980(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl new file mode 100644 index 0000000000..f54cd90cdf --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_0f7980() { + int4 arg_0 = int4(1); + int4 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_0f7980(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_0f7980(); + return; +} + +kernel void compute_main() { + countOneBits_0f7980(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm new file mode 100644 index 0000000000..b3ecc12356 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_0f7980 "countOneBits_0f7980" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_0f7980 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %19 + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v4int %arg_0 + %20 = OpBitCount %v4int %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %countOneBits_0f7980 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %countOneBits_0f7980 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %countOneBits_0f7980 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl new file mode 100644 index 0000000000..739f34dffe --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_0f7980() { + var arg_0 = vec4(1); + var res : vec4 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_0f7980(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_0f7980(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_0f7980(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl new file mode 100644 index 0000000000..02670bcbac --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<3, i32>) -> vec<3, i32> +fn countOneBits_65d2ae() { + var arg_0 = vec3(1); + var res: vec3 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_65d2ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_65d2ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_65d2ae(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef6ef81421 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_65d2ae() { + int3 arg_0 = (1).xxx; + int3 res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_65d2ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_65d2ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_65d2ae(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ef6ef81421 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_65d2ae() { + int3 arg_0 = (1).xxx; + int3 res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_65d2ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_65d2ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_65d2ae(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl new file mode 100644 index 0000000000..62f967fb9c --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_65d2ae() { + ivec3 arg_0 = ivec3(1); + ivec3 res = ivec3(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_65d2ae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_65d2ae() { + ivec3 arg_0 = ivec3(1); + ivec3 res = ivec3(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_65d2ae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_65d2ae() { + ivec3 arg_0 = ivec3(1); + ivec3 res = ivec3(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_65d2ae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl new file mode 100644 index 0000000000..e1151d4c9a --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_65d2ae() { + int3 arg_0 = int3(1); + int3 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_65d2ae(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_65d2ae(); + return; +} + +kernel void compute_main() { + countOneBits_65d2ae(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b6122e42e --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_65d2ae "countOneBits_65d2ae" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_65d2ae = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %19 + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v3int %arg_0 + %20 = OpBitCount %v3int %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %countOneBits_65d2ae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %countOneBits_65d2ae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %countOneBits_65d2ae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl new file mode 100644 index 0000000000..e3c751adf3 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_65d2ae() { + var arg_0 = vec3(1); + var res : vec3 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_65d2ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_65d2ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_65d2ae(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl new file mode 100644 index 0000000000..9805d99b54 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<3, u32>) -> vec<3, u32> +fn countOneBits_690cfc() { + var arg_0 = vec3(1u); + var res: vec3 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_690cfc(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_690cfc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_690cfc(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cde2efd10b --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_690cfc() { + uint3 arg_0 = (1u).xxx; + uint3 res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_690cfc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_690cfc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_690cfc(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cde2efd10b --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_690cfc() { + uint3 arg_0 = (1u).xxx; + uint3 res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_690cfc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_690cfc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_690cfc(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl new file mode 100644 index 0000000000..583c4c9067 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_690cfc() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = uvec3(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_690cfc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_690cfc() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = uvec3(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_690cfc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_690cfc() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = uvec3(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_690cfc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl new file mode 100644 index 0000000000..9ac2be0798 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_690cfc() { + uint3 arg_0 = uint3(1u); + uint3 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_690cfc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_690cfc(); + return; +} + +kernel void compute_main() { + countOneBits_690cfc(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm new file mode 100644 index 0000000000..097fb8e1aa --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_690cfc "countOneBits_690cfc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_690cfc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %19 + %res = OpVariable %_ptr_Function_v3uint Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v3uint %arg_0 + %20 = OpBitCount %v3uint %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %countOneBits_690cfc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %countOneBits_690cfc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %countOneBits_690cfc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl new file mode 100644 index 0000000000..cf36f505e9 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_690cfc() { + var arg_0 = vec3(1u); + var res : vec3 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_690cfc(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_690cfc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_690cfc(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl new file mode 100644 index 0000000000..55d2249705 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<2, u32>) -> vec<2, u32> +fn countOneBits_94fd81() { + var arg_0 = vec2(1u); + var res: vec2 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_94fd81(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_94fd81(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_94fd81(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..016aa3c684 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_94fd81() { + uint2 arg_0 = (1u).xx; + uint2 res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_94fd81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_94fd81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_94fd81(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..016aa3c684 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_94fd81() { + uint2 arg_0 = (1u).xx; + uint2 res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_94fd81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_94fd81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_94fd81(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl new file mode 100644 index 0000000000..e092a1941e --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_94fd81() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = uvec2(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_94fd81(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_94fd81() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = uvec2(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_94fd81(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_94fd81() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = uvec2(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_94fd81(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl new file mode 100644 index 0000000000..7f22c6bfd1 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_94fd81() { + uint2 arg_0 = uint2(1u); + uint2 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_94fd81(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_94fd81(); + return; +} + +kernel void compute_main() { + countOneBits_94fd81(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm new file mode 100644 index 0000000000..60720c8c1b --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_94fd81 "countOneBits_94fd81" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_94fd81 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %19 + %res = OpVariable %_ptr_Function_v2uint Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v2uint %arg_0 + %20 = OpBitCount %v2uint %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %countOneBits_94fd81 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %countOneBits_94fd81 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %countOneBits_94fd81 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl new file mode 100644 index 0000000000..e237e7ac09 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_94fd81() { + var arg_0 = vec2(1u); + var res : vec2 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_94fd81(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_94fd81(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_94fd81(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl new file mode 100644 index 0000000000..0eb6ee0869 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(u32) -> u32 +fn countOneBits_ae44f9() { + var arg_0 = 1u; + var res: u32 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_ae44f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_ae44f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_ae44f9(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5c19408cde --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_ae44f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_ae44f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_ae44f9(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5c19408cde --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = countbits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_ae44f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_ae44f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_ae44f9(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl new file mode 100644 index 0000000000..c47d7d073a --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = uint(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_ae44f9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = uint(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_ae44f9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = uint(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_ae44f9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl new file mode 100644 index 0000000000..a04bb18100 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_ae44f9() { + uint arg_0 = 1u; + uint res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_ae44f9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_ae44f9(); + return; +} + +kernel void compute_main() { + countOneBits_ae44f9(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm new file mode 100644 index 0000000000..5879bf3329 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_ae44f9 "countOneBits_ae44f9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_ae44f9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %19 = OpLoad %uint %arg_0 + %18 = OpBitCount %uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_ae44f9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_ae44f9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_ae44f9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d63e7b66e --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_ae44f9() { + var arg_0 = 1u; + var res : u32 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_ae44f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_ae44f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_ae44f9(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl new file mode 100644 index 0000000000..1a2765095d --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(vec<2, i32>) -> vec<2, i32> +fn countOneBits_af90e2() { + var arg_0 = vec2(1); + var res: vec2 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_af90e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_af90e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_af90e2(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..533b326674 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_af90e2() { + int2 arg_0 = (1).xx; + int2 res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_af90e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_af90e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_af90e2(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..533b326674 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_af90e2() { + int2 arg_0 = (1).xx; + int2 res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_af90e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_af90e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_af90e2(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl new file mode 100644 index 0000000000..3db2472363 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_af90e2() { + ivec2 arg_0 = ivec2(1); + ivec2 res = ivec2(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_af90e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_af90e2() { + ivec2 arg_0 = ivec2(1); + ivec2 res = ivec2(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_af90e2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_af90e2() { + ivec2 arg_0 = ivec2(1); + ivec2 res = ivec2(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_af90e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl new file mode 100644 index 0000000000..afda6524d2 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_af90e2() { + int2 arg_0 = int2(1); + int2 res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_af90e2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_af90e2(); + return; +} + +kernel void compute_main() { + countOneBits_af90e2(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm new file mode 100644 index 0000000000..814be8ba5b --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_af90e2 "countOneBits_af90e2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_af90e2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %19 + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v2int %arg_0 + %20 = OpBitCount %v2int %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %countOneBits_af90e2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %countOneBits_af90e2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %countOneBits_af90e2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..363086fac5 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_af90e2() { + var arg_0 = vec2(1); + var res : vec2 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_af90e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_af90e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_af90e2(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl new file mode 100644 index 0000000000..e93efb4c7f --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countOneBits(i32) -> i32 +fn countOneBits_fd88b2() { + var arg_0 = 1; + var res: i32 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_fd88b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_fd88b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_fd88b2(); +} diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7801d95ad6 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_fd88b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_fd88b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_fd88b2(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7801d95ad6 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = asint(countbits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countOneBits_fd88b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countOneBits_fd88b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countOneBits_fd88b2(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl new file mode 100644 index 0000000000..7ef846b5c2 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = int(bitCount(arg_0)); +} + +vec4 vertex_main() { + countOneBits_fd88b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = int(bitCount(arg_0)); +} + +void fragment_main() { + countOneBits_fd88b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = int(bitCount(arg_0)); +} + +void compute_main() { + countOneBits_fd88b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl new file mode 100644 index 0000000000..5077121a00 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countOneBits_fd88b2() { + int arg_0 = 1; + int res = popcount(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countOneBits_fd88b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countOneBits_fd88b2(); + return; +} + +kernel void compute_main() { + countOneBits_fd88b2(); + return; +} + diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3733f0ad9 --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %countOneBits_fd88b2 "countOneBits_fd88b2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%countOneBits_fd88b2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + %19 = OpLoad %int %arg_0 + %18 = OpBitCount %int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %countOneBits_fd88b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %countOneBits_fd88b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %countOneBits_fd88b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..3712925abe --- /dev/null +++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countOneBits_fd88b2() { + var arg_0 = 1; + var res : i32 = countOneBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countOneBits_fd88b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + countOneBits_fd88b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countOneBits_fd88b2(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl new file mode 100644 index 0000000000..d5e221dbdb --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<2, u32>) -> vec<2, u32> +fn countTrailingZeros_1ad138() { + var arg_0 = vec2(1u); + var res: vec2 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1ad138(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_1ad138(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1ad138(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..afb63e86e0 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint2 tint_count_trailing_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uint2 arg_0 = (1u).xx; + uint2 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1ad138(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1ad138(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1ad138(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..afb63e86e0 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint2 tint_count_trailing_zeros(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uint2 arg_0 = (1u).xx; + uint2 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1ad138(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1ad138(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1ad138(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl new file mode 100644 index 0000000000..e3cd7e91f5 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec2 tint_count_trailing_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_1ad138(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_count_trailing_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_1ad138(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_count_trailing_zeros(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1ad138() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_1ad138(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl new file mode 100644 index 0000000000..347a560bc1 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_1ad138() { + uint2 arg_0 = uint2(1u); + uint2 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1ad138(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_1ad138(); + return; +} + +kernel void compute_main() { + countTrailingZeros_1ad138(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm new file mode 100644 index 0000000000..beda11c11a --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_1ad138 "countTrailingZeros_1ad138" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %18 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %84 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %x %v + %23 = OpLoad %v2uint %x + %26 = OpBitwiseAnd %v2uint %23 %25 + %20 = OpINotEqual %v2bool %26 %18 + %19 = OpSelect %v2uint %20 %18 %28 + %29 = OpLoad %v2uint %x + %30 = OpShiftRightLogical %v2uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v2uint %x + %36 = OpBitwiseAnd %v2uint %33 %35 + %32 = OpINotEqual %v2bool %36 %18 + %31 = OpSelect %v2uint %32 %18 %38 + %39 = OpLoad %v2uint %x + %40 = OpShiftRightLogical %v2uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v2uint %x + %46 = OpBitwiseAnd %v2uint %43 %45 + %42 = OpINotEqual %v2bool %46 %18 + %41 = OpSelect %v2uint %42 %18 %48 + %49 = OpLoad %v2uint %x + %50 = OpShiftRightLogical %v2uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v2uint %x + %56 = OpBitwiseAnd %v2uint %53 %55 + %52 = OpINotEqual %v2bool %56 %18 + %51 = OpSelect %v2uint %52 %18 %58 + %59 = OpLoad %v2uint %x + %60 = OpShiftRightLogical %v2uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v2uint %x + %66 = OpBitwiseAnd %v2uint %63 %65 + %62 = OpINotEqual %v2bool %66 %18 + %61 = OpSelect %v2uint %62 %18 %65 + %68 = OpLoad %v2uint %x + %69 = OpIEqual %v2bool %68 %18 + %67 = OpSelect %v2uint %69 %65 %18 + %71 = OpBitwiseOr %v2uint %19 %31 + %72 = OpBitwiseOr %v2uint %71 %41 + %73 = OpBitwiseOr %v2uint %72 %51 + %74 = OpBitwiseOr %v2uint %73 %61 + %75 = OpIAdd %v2uint %74 %67 + OpReturnValue %75 + OpFunctionEnd +%countTrailingZeros_1ad138 = OpFunction %void None %76 + %79 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %18 + %res = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %arg_0 %65 + %82 = OpLoad %v2uint %arg_0 + %81 = OpFunctionCall %v2uint %tint_count_trailing_zeros %82 + OpStore %res %81 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %84 + %86 = OpLabel + %87 = OpFunctionCall %void %countTrailingZeros_1ad138 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %76 + %89 = OpLabel + %90 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %90 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %76 + %93 = OpLabel + %94 = OpFunctionCall %void %countTrailingZeros_1ad138 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %76 + %96 = OpLabel + %97 = OpFunctionCall %void %countTrailingZeros_1ad138 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl new file mode 100644 index 0000000000..e80e5fedaa --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_1ad138() { + var arg_0 = vec2(1u); + var res : vec2 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1ad138(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_1ad138(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1ad138(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl new file mode 100644 index 0000000000..761c93d5f0 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<4, i32>) -> vec<4, i32> +fn countTrailingZeros_1dc84a() { + var arg_0 = vec4(1); + var res: vec4 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1dc84a(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_1dc84a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1dc84a(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..596f2110a5 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int4 tint_count_trailing_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + int4 arg_0 = (1).xxxx; + int4 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1dc84a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1dc84a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1dc84a(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..596f2110a5 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int4 tint_count_trailing_zeros(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + int4 arg_0 = (1).xxxx; + int4 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1dc84a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_1dc84a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_1dc84a(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl new file mode 100644 index 0000000000..c94ebd8f7c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec4 tint_count_trailing_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_1dc84a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_count_trailing_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_1dc84a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_count_trailing_zeros(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_1dc84a() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_1dc84a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl new file mode 100644 index 0000000000..a7c85816b5 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_1dc84a() { + int4 arg_0 = int4(1); + int4 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_1dc84a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_1dc84a(); + return; +} + +kernel void compute_main() { + countTrailingZeros_1dc84a(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm new file mode 100644 index 0000000000..f3f97a816e --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_1dc84a "countTrailingZeros_1dc84a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %86 = OpConstantNull %v4int + %90 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %20 + %15 = OpBitcast %v4uint %v + OpStore %x %15 + %25 = OpLoad %v4uint %x + %28 = OpBitwiseAnd %v4uint %25 %27 + %22 = OpINotEqual %v4bool %28 %20 + %21 = OpSelect %v4uint %22 %20 %30 + %31 = OpLoad %v4uint %x + %32 = OpShiftRightLogical %v4uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v4uint %x + %38 = OpBitwiseAnd %v4uint %35 %37 + %34 = OpINotEqual %v4bool %38 %20 + %33 = OpSelect %v4uint %34 %20 %40 + %41 = OpLoad %v4uint %x + %42 = OpShiftRightLogical %v4uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v4uint %x + %48 = OpBitwiseAnd %v4uint %45 %47 + %44 = OpINotEqual %v4bool %48 %20 + %43 = OpSelect %v4uint %44 %20 %50 + %51 = OpLoad %v4uint %x + %52 = OpShiftRightLogical %v4uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v4uint %x + %58 = OpBitwiseAnd %v4uint %55 %57 + %54 = OpINotEqual %v4bool %58 %20 + %53 = OpSelect %v4uint %54 %20 %60 + %61 = OpLoad %v4uint %x + %62 = OpShiftRightLogical %v4uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v4uint %x + %68 = OpBitwiseAnd %v4uint %65 %67 + %64 = OpINotEqual %v4bool %68 %20 + %63 = OpSelect %v4uint %64 %20 %67 + %70 = OpLoad %v4uint %x + %71 = OpIEqual %v4bool %70 %20 + %69 = OpSelect %v4uint %71 %67 %20 + %73 = OpBitwiseOr %v4uint %21 %33 + %74 = OpBitwiseOr %v4uint %73 %43 + %75 = OpBitwiseOr %v4uint %74 %53 + %76 = OpBitwiseOr %v4uint %75 %63 + %77 = OpIAdd %v4uint %76 %69 + %72 = OpBitcast %v4int %77 + OpReturnValue %72 + OpFunctionEnd +%countTrailingZeros_1dc84a = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %86 + %res = OpVariable %_ptr_Function_v4int Function %86 + OpStore %arg_0 %83 + %88 = OpLoad %v4int %arg_0 + %87 = OpFunctionCall %v4int %tint_count_trailing_zeros %88 + OpStore %res %87 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %90 + %92 = OpLabel + %93 = OpFunctionCall %void %countTrailingZeros_1dc84a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %95 = OpLabel + %96 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %96 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %99 = OpLabel + %100 = OpFunctionCall %void %countTrailingZeros_1dc84a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %102 = OpLabel + %103 = OpFunctionCall %void %countTrailingZeros_1dc84a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl new file mode 100644 index 0000000000..4556332577 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_1dc84a() { + var arg_0 = vec4(1); + var res : vec4 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_1dc84a(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_1dc84a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_1dc84a(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl new file mode 100644 index 0000000000..bceddce4d7 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(u32) -> u32 +fn countTrailingZeros_21e394() { + var arg_0 = 1u; + var res: u32 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_21e394(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_21e394(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_21e394(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4581899842 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_21e394(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_21e394(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_21e394(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4581899842 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_21e394(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_21e394(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_21e394(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl new file mode 100644 index 0000000000..8995ab5d14 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_21e394(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_21e394(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_count_trailing_zeros(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_21e394(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl new file mode 100644 index 0000000000..6c9c98741a --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_21e394() { + uint arg_0 = 1u; + uint res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_21e394(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_21e394(); + return; +} + +kernel void compute_main() { + countTrailingZeros_21e394(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm new file mode 100644 index 0000000000..afa8fca93a --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_21e394 "countTrailingZeros_21e394" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %65 = OpTypeFunction %void + %73 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %17 + OpStore %x %v + %21 = OpLoad %uint %x + %23 = OpBitwiseAnd %uint %21 %uint_65535 + %19 = OpINotEqual %bool %23 %17 + %18 = OpSelect %uint %19 %17 %uint_16 + %25 = OpLoad %uint %x + %26 = OpShiftRightLogical %uint %25 %18 + OpStore %x %26 + %29 = OpLoad %uint %x + %31 = OpBitwiseAnd %uint %29 %uint_255 + %28 = OpINotEqual %bool %31 %17 + %27 = OpSelect %uint %28 %17 %uint_8 + %33 = OpLoad %uint %x + %34 = OpShiftRightLogical %uint %33 %27 + OpStore %x %34 + %37 = OpLoad %uint %x + %39 = OpBitwiseAnd %uint %37 %uint_15 + %36 = OpINotEqual %bool %39 %17 + %35 = OpSelect %uint %36 %17 %uint_4 + %41 = OpLoad %uint %x + %42 = OpShiftRightLogical %uint %41 %35 + OpStore %x %42 + %45 = OpLoad %uint %x + %47 = OpBitwiseAnd %uint %45 %uint_3 + %44 = OpINotEqual %bool %47 %17 + %43 = OpSelect %uint %44 %17 %uint_2 + %49 = OpLoad %uint %x + %50 = OpShiftRightLogical %uint %49 %43 + OpStore %x %50 + %53 = OpLoad %uint %x + %55 = OpBitwiseAnd %uint %53 %uint_1 + %52 = OpINotEqual %bool %55 %17 + %51 = OpSelect %uint %52 %17 %uint_1 + %57 = OpLoad %uint %x + %58 = OpIEqual %bool %57 %17 + %56 = OpSelect %uint %58 %uint_1 %17 + %60 = OpBitwiseOr %uint %18 %27 + %61 = OpBitwiseOr %uint %60 %35 + %62 = OpBitwiseOr %uint %61 %43 + %63 = OpBitwiseOr %uint %62 %51 + %64 = OpIAdd %uint %63 %56 + OpReturnValue %64 + OpFunctionEnd +%countTrailingZeros_21e394 = OpFunction %void None %65 + %68 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %71 = OpLoad %uint %arg_0 + %70 = OpFunctionCall %uint %tint_count_trailing_zeros %71 + OpStore %res %70 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %73 + %75 = OpLabel + %76 = OpFunctionCall %void %countTrailingZeros_21e394 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %65 + %78 = OpLabel + %79 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %79 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %65 + %82 = OpLabel + %83 = OpFunctionCall %void %countTrailingZeros_21e394 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %65 + %85 = OpLabel + %86 = OpFunctionCall %void %countTrailingZeros_21e394 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl new file mode 100644 index 0000000000..cafc47e200 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_21e394() { + var arg_0 = 1u; + var res : u32 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_21e394(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_21e394(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_21e394(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl new file mode 100644 index 0000000000..e63bb60174 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<2, i32>) -> vec<2, i32> +fn countTrailingZeros_327c37() { + var arg_0 = vec2(1); + var res: vec2 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_327c37(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_327c37(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_327c37(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0e85869696 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int2 tint_count_trailing_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + int2 arg_0 = (1).xx; + int2 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_327c37(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_327c37(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_327c37(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0e85869696 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int2 tint_count_trailing_zeros(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + int2 arg_0 = (1).xx; + int2 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_327c37(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_327c37(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_327c37(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl new file mode 100644 index 0000000000..8dd29793bc --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec2 tint_count_trailing_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_327c37(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_count_trailing_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_327c37(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_count_trailing_zeros(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_327c37() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_327c37(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl new file mode 100644 index 0000000000..fb1d1dff48 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_327c37() { + int2 arg_0 = int2(1); + int2 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_327c37(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_327c37(); + return; +} + +kernel void compute_main() { + countTrailingZeros_327c37(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm new file mode 100644 index 0000000000..d086314bba --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_327c37 "countTrailingZeros_327c37" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v2uint %uint_1 %uint_1 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %86 = OpConstantNull %v2int + %90 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %20 + %15 = OpBitcast %v2uint %v + OpStore %x %15 + %25 = OpLoad %v2uint %x + %28 = OpBitwiseAnd %v2uint %25 %27 + %22 = OpINotEqual %v2bool %28 %20 + %21 = OpSelect %v2uint %22 %20 %30 + %31 = OpLoad %v2uint %x + %32 = OpShiftRightLogical %v2uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v2uint %x + %38 = OpBitwiseAnd %v2uint %35 %37 + %34 = OpINotEqual %v2bool %38 %20 + %33 = OpSelect %v2uint %34 %20 %40 + %41 = OpLoad %v2uint %x + %42 = OpShiftRightLogical %v2uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v2uint %x + %48 = OpBitwiseAnd %v2uint %45 %47 + %44 = OpINotEqual %v2bool %48 %20 + %43 = OpSelect %v2uint %44 %20 %50 + %51 = OpLoad %v2uint %x + %52 = OpShiftRightLogical %v2uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v2uint %x + %58 = OpBitwiseAnd %v2uint %55 %57 + %54 = OpINotEqual %v2bool %58 %20 + %53 = OpSelect %v2uint %54 %20 %60 + %61 = OpLoad %v2uint %x + %62 = OpShiftRightLogical %v2uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v2uint %x + %68 = OpBitwiseAnd %v2uint %65 %67 + %64 = OpINotEqual %v2bool %68 %20 + %63 = OpSelect %v2uint %64 %20 %67 + %70 = OpLoad %v2uint %x + %71 = OpIEqual %v2bool %70 %20 + %69 = OpSelect %v2uint %71 %67 %20 + %73 = OpBitwiseOr %v2uint %21 %33 + %74 = OpBitwiseOr %v2uint %73 %43 + %75 = OpBitwiseOr %v2uint %74 %53 + %76 = OpBitwiseOr %v2uint %75 %63 + %77 = OpIAdd %v2uint %76 %69 + %72 = OpBitcast %v2int %77 + OpReturnValue %72 + OpFunctionEnd +%countTrailingZeros_327c37 = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %86 + %res = OpVariable %_ptr_Function_v2int Function %86 + OpStore %arg_0 %83 + %88 = OpLoad %v2int %arg_0 + %87 = OpFunctionCall %v2int %tint_count_trailing_zeros %88 + OpStore %res %87 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %90 + %92 = OpLabel + %93 = OpFunctionCall %void %countTrailingZeros_327c37 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %95 = OpLabel + %96 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %96 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %99 = OpLabel + %100 = OpFunctionCall %void %countTrailingZeros_327c37 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %102 = OpLabel + %103 = OpFunctionCall %void %countTrailingZeros_327c37 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl new file mode 100644 index 0000000000..22d9fb892c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_327c37() { + var arg_0 = vec2(1); + var res : vec2 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_327c37(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_327c37(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_327c37(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl new file mode 100644 index 0000000000..6412651085 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(i32) -> i32 +fn countTrailingZeros_42fed6() { + var arg_0 = 1; + var res: i32 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_42fed6(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_42fed6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_42fed6(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..464986a871 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_42fed6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_42fed6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_42fed6(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..464986a871 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_42fed6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_42fed6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_42fed6(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl new file mode 100644 index 0000000000..80ff533989 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_42fed6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_42fed6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_count_trailing_zeros(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 1u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_42fed6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl new file mode 100644 index 0000000000..6811b6b83c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_42fed6() { + int arg_0 = 1; + int res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_42fed6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_42fed6(); + return; +} + +kernel void compute_main() { + countTrailingZeros_42fed6(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm new file mode 100644 index 0000000000..f727b4e248 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_42fed6 "countTrailingZeros_42fed6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %void = OpTypeVoid + %66 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %73 = OpConstantNull %int + %77 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %18 + %14 = OpBitcast %uint %v + OpStore %x %14 + %22 = OpLoad %uint %x + %24 = OpBitwiseAnd %uint %22 %uint_65535 + %20 = OpINotEqual %bool %24 %18 + %19 = OpSelect %uint %20 %18 %uint_16 + %26 = OpLoad %uint %x + %27 = OpShiftRightLogical %uint %26 %19 + OpStore %x %27 + %30 = OpLoad %uint %x + %32 = OpBitwiseAnd %uint %30 %uint_255 + %29 = OpINotEqual %bool %32 %18 + %28 = OpSelect %uint %29 %18 %uint_8 + %34 = OpLoad %uint %x + %35 = OpShiftRightLogical %uint %34 %28 + OpStore %x %35 + %38 = OpLoad %uint %x + %40 = OpBitwiseAnd %uint %38 %uint_15 + %37 = OpINotEqual %bool %40 %18 + %36 = OpSelect %uint %37 %18 %uint_4 + %42 = OpLoad %uint %x + %43 = OpShiftRightLogical %uint %42 %36 + OpStore %x %43 + %46 = OpLoad %uint %x + %48 = OpBitwiseAnd %uint %46 %uint_3 + %45 = OpINotEqual %bool %48 %18 + %44 = OpSelect %uint %45 %18 %uint_2 + %50 = OpLoad %uint %x + %51 = OpShiftRightLogical %uint %50 %44 + OpStore %x %51 + %54 = OpLoad %uint %x + %56 = OpBitwiseAnd %uint %54 %uint_1 + %53 = OpINotEqual %bool %56 %18 + %52 = OpSelect %uint %53 %18 %uint_1 + %58 = OpLoad %uint %x + %59 = OpIEqual %bool %58 %18 + %57 = OpSelect %uint %59 %uint_1 %18 + %61 = OpBitwiseOr %uint %19 %28 + %62 = OpBitwiseOr %uint %61 %36 + %63 = OpBitwiseOr %uint %62 %44 + %64 = OpBitwiseOr %uint %63 %52 + %65 = OpIAdd %uint %64 %57 + %60 = OpBitcast %int %65 + OpReturnValue %60 + OpFunctionEnd +%countTrailingZeros_42fed6 = OpFunction %void None %66 + %69 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %73 + %res = OpVariable %_ptr_Function_int Function %73 + OpStore %arg_0 %int_1 + %75 = OpLoad %int %arg_0 + %74 = OpFunctionCall %int %tint_count_trailing_zeros %75 + OpStore %res %74 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %77 + %79 = OpLabel + %80 = OpFunctionCall %void %countTrailingZeros_42fed6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %66 + %82 = OpLabel + %83 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %83 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %66 + %86 = OpLabel + %87 = OpFunctionCall %void %countTrailingZeros_42fed6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %66 + %89 = OpLabel + %90 = OpFunctionCall %void %countTrailingZeros_42fed6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl new file mode 100644 index 0000000000..3007518bd1 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_42fed6() { + var arg_0 = 1; + var res : i32 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_42fed6(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_42fed6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_42fed6(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl new file mode 100644 index 0000000000..5f6357511f --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<3, u32>) -> vec<3, u32> +fn countTrailingZeros_8ed26f() { + var arg_0 = vec3(1u); + var res: vec3 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_8ed26f(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_8ed26f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_8ed26f(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..12171a800c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint3 tint_count_trailing_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uint3 arg_0 = (1u).xxx; + uint3 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_8ed26f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_8ed26f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_8ed26f(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..12171a800c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint3 tint_count_trailing_zeros(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uint3 arg_0 = (1u).xxx; + uint3 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_8ed26f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_8ed26f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_8ed26f(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl new file mode 100644 index 0000000000..0fcada9132 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec3 tint_count_trailing_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_8ed26f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_count_trailing_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_8ed26f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_count_trailing_zeros(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_8ed26f() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_8ed26f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl new file mode 100644 index 0000000000..2545f18ddc --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_8ed26f() { + uint3 arg_0 = uint3(1u); + uint3 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_8ed26f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_8ed26f(); + return; +} + +kernel void compute_main() { + countTrailingZeros_8ed26f(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm new file mode 100644 index 0000000000..37e494814c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_8ed26f "countTrailingZeros_8ed26f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %84 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %x %v + %23 = OpLoad %v3uint %x + %26 = OpBitwiseAnd %v3uint %23 %25 + %20 = OpINotEqual %v3bool %26 %18 + %19 = OpSelect %v3uint %20 %18 %28 + %29 = OpLoad %v3uint %x + %30 = OpShiftRightLogical %v3uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v3uint %x + %36 = OpBitwiseAnd %v3uint %33 %35 + %32 = OpINotEqual %v3bool %36 %18 + %31 = OpSelect %v3uint %32 %18 %38 + %39 = OpLoad %v3uint %x + %40 = OpShiftRightLogical %v3uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v3uint %x + %46 = OpBitwiseAnd %v3uint %43 %45 + %42 = OpINotEqual %v3bool %46 %18 + %41 = OpSelect %v3uint %42 %18 %48 + %49 = OpLoad %v3uint %x + %50 = OpShiftRightLogical %v3uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v3uint %x + %56 = OpBitwiseAnd %v3uint %53 %55 + %52 = OpINotEqual %v3bool %56 %18 + %51 = OpSelect %v3uint %52 %18 %58 + %59 = OpLoad %v3uint %x + %60 = OpShiftRightLogical %v3uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v3uint %x + %66 = OpBitwiseAnd %v3uint %63 %65 + %62 = OpINotEqual %v3bool %66 %18 + %61 = OpSelect %v3uint %62 %18 %65 + %68 = OpLoad %v3uint %x + %69 = OpIEqual %v3bool %68 %18 + %67 = OpSelect %v3uint %69 %65 %18 + %71 = OpBitwiseOr %v3uint %19 %31 + %72 = OpBitwiseOr %v3uint %71 %41 + %73 = OpBitwiseOr %v3uint %72 %51 + %74 = OpBitwiseOr %v3uint %73 %61 + %75 = OpIAdd %v3uint %74 %67 + OpReturnValue %75 + OpFunctionEnd +%countTrailingZeros_8ed26f = OpFunction %void None %76 + %79 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %18 + %res = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %arg_0 %65 + %82 = OpLoad %v3uint %arg_0 + %81 = OpFunctionCall %v3uint %tint_count_trailing_zeros %82 + OpStore %res %81 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %84 + %86 = OpLabel + %87 = OpFunctionCall %void %countTrailingZeros_8ed26f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %76 + %89 = OpLabel + %90 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %90 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %76 + %93 = OpLabel + %94 = OpFunctionCall %void %countTrailingZeros_8ed26f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %76 + %96 = OpLabel + %97 = OpFunctionCall %void %countTrailingZeros_8ed26f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3d15ef437 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_8ed26f() { + var arg_0 = vec3(1u); + var res : vec3 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_8ed26f(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_8ed26f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_8ed26f(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl new file mode 100644 index 0000000000..3a92479821 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<3, i32>) -> vec<3, i32> +fn countTrailingZeros_acfacb() { + var arg_0 = vec3(1); + var res: vec3 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_acfacb(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_acfacb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_acfacb(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54a07377a7 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int3 tint_count_trailing_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + int3 arg_0 = (1).xxx; + int3 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_acfacb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_acfacb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_acfacb(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54a07377a7 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int3 tint_count_trailing_zeros(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + int3 arg_0 = (1).xxx; + int3 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_acfacb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_acfacb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_acfacb(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl new file mode 100644 index 0000000000..78fee76b05 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec3 tint_count_trailing_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_acfacb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_count_trailing_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_acfacb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_count_trailing_zeros(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_acfacb() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_acfacb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl new file mode 100644 index 0000000000..ed30e64f53 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_acfacb() { + int3 arg_0 = int3(1); + int3 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_acfacb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_acfacb(); + return; +} + +kernel void compute_main() { + countTrailingZeros_acfacb(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm new file mode 100644 index 0000000000..441385376c --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_acfacb "countTrailingZeros_acfacb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %86 = OpConstantNull %v3int + %90 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %20 + %15 = OpBitcast %v3uint %v + OpStore %x %15 + %25 = OpLoad %v3uint %x + %28 = OpBitwiseAnd %v3uint %25 %27 + %22 = OpINotEqual %v3bool %28 %20 + %21 = OpSelect %v3uint %22 %20 %30 + %31 = OpLoad %v3uint %x + %32 = OpShiftRightLogical %v3uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v3uint %x + %38 = OpBitwiseAnd %v3uint %35 %37 + %34 = OpINotEqual %v3bool %38 %20 + %33 = OpSelect %v3uint %34 %20 %40 + %41 = OpLoad %v3uint %x + %42 = OpShiftRightLogical %v3uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v3uint %x + %48 = OpBitwiseAnd %v3uint %45 %47 + %44 = OpINotEqual %v3bool %48 %20 + %43 = OpSelect %v3uint %44 %20 %50 + %51 = OpLoad %v3uint %x + %52 = OpShiftRightLogical %v3uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v3uint %x + %58 = OpBitwiseAnd %v3uint %55 %57 + %54 = OpINotEqual %v3bool %58 %20 + %53 = OpSelect %v3uint %54 %20 %60 + %61 = OpLoad %v3uint %x + %62 = OpShiftRightLogical %v3uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v3uint %x + %68 = OpBitwiseAnd %v3uint %65 %67 + %64 = OpINotEqual %v3bool %68 %20 + %63 = OpSelect %v3uint %64 %20 %67 + %70 = OpLoad %v3uint %x + %71 = OpIEqual %v3bool %70 %20 + %69 = OpSelect %v3uint %71 %67 %20 + %73 = OpBitwiseOr %v3uint %21 %33 + %74 = OpBitwiseOr %v3uint %73 %43 + %75 = OpBitwiseOr %v3uint %74 %53 + %76 = OpBitwiseOr %v3uint %75 %63 + %77 = OpIAdd %v3uint %76 %69 + %72 = OpBitcast %v3int %77 + OpReturnValue %72 + OpFunctionEnd +%countTrailingZeros_acfacb = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %86 + %res = OpVariable %_ptr_Function_v3int Function %86 + OpStore %arg_0 %83 + %88 = OpLoad %v3int %arg_0 + %87 = OpFunctionCall %v3int %tint_count_trailing_zeros %88 + OpStore %res %87 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %90 + %92 = OpLabel + %93 = OpFunctionCall %void %countTrailingZeros_acfacb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %95 = OpLabel + %96 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %96 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %99 = OpLabel + %100 = OpFunctionCall %void %countTrailingZeros_acfacb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %102 = OpLabel + %103 = OpFunctionCall %void %countTrailingZeros_acfacb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e95b9c1e6 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_acfacb() { + var arg_0 = vec3(1); + var res : vec3 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_acfacb(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_acfacb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_acfacb(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl new file mode 100644 index 0000000000..0d1622da0d --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn countTrailingZeros(vec<4, u32>) -> vec<4, u32> +fn countTrailingZeros_d2b4a0() { + var arg_0 = vec4(1u); + var res: vec4 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_d2b4a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_d2b4a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_d2b4a0(); +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2af8797582 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint4 tint_count_trailing_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uint4 arg_0 = (1u).xxxx; + uint4 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_d2b4a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_d2b4a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_d2b4a0(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2af8797582 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint4 tint_count_trailing_zeros(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uint4 arg_0 = (1u).xxxx; + uint4 res = tint_count_trailing_zeros(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + countTrailingZeros_d2b4a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + countTrailingZeros_d2b4a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + countTrailingZeros_d2b4a0(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl new file mode 100644 index 0000000000..474e8d5c9e --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec4 tint_count_trailing_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_count_trailing_zeros(arg_0); +} + +vec4 vertex_main() { + countTrailingZeros_d2b4a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_count_trailing_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_count_trailing_zeros(arg_0); +} + +void fragment_main() { + countTrailingZeros_d2b4a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_count_trailing_zeros(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero)); +} + +void countTrailingZeros_d2b4a0() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_count_trailing_zeros(arg_0); +} + +void compute_main() { + countTrailingZeros_d2b4a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl new file mode 100644 index 0000000000..f6ae4d06e3 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void countTrailingZeros_d2b4a0() { + uint4 arg_0 = uint4(1u); + uint4 res = ctz(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + countTrailingZeros_d2b4a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + countTrailingZeros_d2b4a0(); + return; +} + +kernel void compute_main() { + countTrailingZeros_d2b4a0(); + return; +} + diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd58a155e8 --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_count_trailing_zeros "tint_count_trailing_zeros" + OpName %v "v" + OpName %x "x" + OpName %countTrailingZeros_d2b4a0 "countTrailingZeros_d2b4a0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %18 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %84 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_count_trailing_zeros = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %x %v + %23 = OpLoad %v4uint %x + %26 = OpBitwiseAnd %v4uint %23 %25 + %20 = OpINotEqual %v4bool %26 %18 + %19 = OpSelect %v4uint %20 %18 %28 + %29 = OpLoad %v4uint %x + %30 = OpShiftRightLogical %v4uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v4uint %x + %36 = OpBitwiseAnd %v4uint %33 %35 + %32 = OpINotEqual %v4bool %36 %18 + %31 = OpSelect %v4uint %32 %18 %38 + %39 = OpLoad %v4uint %x + %40 = OpShiftRightLogical %v4uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v4uint %x + %46 = OpBitwiseAnd %v4uint %43 %45 + %42 = OpINotEqual %v4bool %46 %18 + %41 = OpSelect %v4uint %42 %18 %48 + %49 = OpLoad %v4uint %x + %50 = OpShiftRightLogical %v4uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v4uint %x + %56 = OpBitwiseAnd %v4uint %53 %55 + %52 = OpINotEqual %v4bool %56 %18 + %51 = OpSelect %v4uint %52 %18 %58 + %59 = OpLoad %v4uint %x + %60 = OpShiftRightLogical %v4uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v4uint %x + %66 = OpBitwiseAnd %v4uint %63 %65 + %62 = OpINotEqual %v4bool %66 %18 + %61 = OpSelect %v4uint %62 %18 %65 + %68 = OpLoad %v4uint %x + %69 = OpIEqual %v4bool %68 %18 + %67 = OpSelect %v4uint %69 %65 %18 + %71 = OpBitwiseOr %v4uint %19 %31 + %72 = OpBitwiseOr %v4uint %71 %41 + %73 = OpBitwiseOr %v4uint %72 %51 + %74 = OpBitwiseOr %v4uint %73 %61 + %75 = OpIAdd %v4uint %74 %67 + OpReturnValue %75 + OpFunctionEnd +%countTrailingZeros_d2b4a0 = OpFunction %void None %76 + %79 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %18 + %res = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %arg_0 %65 + %82 = OpLoad %v4uint %arg_0 + %81 = OpFunctionCall %v4uint %tint_count_trailing_zeros %82 + OpStore %res %81 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %84 + %86 = OpLabel + %87 = OpFunctionCall %void %countTrailingZeros_d2b4a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %76 + %89 = OpLabel + %90 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %90 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %76 + %93 = OpLabel + %94 = OpFunctionCall %void %countTrailingZeros_d2b4a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %76 + %96 = OpLabel + %97 = OpFunctionCall %void %countTrailingZeros_d2b4a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..940212de0d --- /dev/null +++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn countTrailingZeros_d2b4a0() { + var arg_0 = vec4(1u); + var res : vec4 = countTrailingZeros(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + countTrailingZeros_d2b4a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + countTrailingZeros_d2b4a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + countTrailingZeros_d2b4a0(); +} diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl new file mode 100644 index 0000000000..ef35ef8883 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cross(vec3, vec3) -> vec3 +fn cross_041cb0() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = cross(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_041cb0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_041cb0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_041cb0(); +} diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..272645fb5f --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void cross_041cb0() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_041cb0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_041cb0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_041cb0(); + return; +} diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..272645fb5f --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void cross_041cb0() { + float3 arg_0 = (0.0f).xxx; + float3 arg_1 = (0.0f).xxx; + float3 res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_041cb0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_041cb0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_041cb0(); + return; +} diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl new file mode 100644 index 0000000000..87cb9a34c0 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void cross_041cb0() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = cross(arg_0, arg_1); +} + +vec4 vertex_main() { + cross_041cb0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cross_041cb0() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = cross(arg_0, arg_1); +} + +void fragment_main() { + cross_041cb0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cross_041cb0() { + vec3 arg_0 = vec3(0.0f); + vec3 arg_1 = vec3(0.0f); + vec3 res = cross(arg_0, arg_1); +} + +void compute_main() { + cross_041cb0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl new file mode 100644 index 0000000000..49669392b1 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void cross_041cb0() { + float3 arg_0 = float3(0.0f); + float3 arg_1 = float3(0.0f); + float3 res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cross_041cb0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cross_041cb0(); + return; +} + +kernel void compute_main() { + cross_041cb0(); + return; +} + diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7a1245ca7 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cross_041cb0 "cross_041cb0" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %14 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cross_041cb0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %arg_1 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v3float %arg_0 + %21 = OpLoad %v3float %arg_1 + %18 = OpExtInst %v3float %19 Cross %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %cross_041cb0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %cross_041cb0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %cross_041cb0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl new file mode 100644 index 0000000000..019e81b5e3 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn cross_041cb0() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = cross(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_041cb0(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_041cb0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_041cb0(); +} diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl new file mode 100644 index 0000000000..39258c8702 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn cross(vec3, vec3) -> vec3 +fn cross_9857cb() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res: vec3 = cross(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_9857cb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_9857cb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_9857cb(); +} diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fdb9f034ef --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void cross_9857cb() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_9857cb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_9857cb(); + return; +} diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c32ca71bd --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void cross_9857cb() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cross_9857cb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cross_9857cb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E1A1D1BC0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E1A1D1BC0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E1A1D1BC0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.glsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.glsl new file mode 100644 index 0000000000..8d62b4025e --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cross_9857cb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = cross(arg_0, arg_1); +} + +vec4 vertex_main() { + cross_9857cb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void cross_9857cb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = cross(arg_0, arg_1); +} + +void fragment_main() { + cross_9857cb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void cross_9857cb() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = cross(arg_0, arg_1); +} + +void compute_main() { + cross_9857cb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.msl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.msl new file mode 100644 index 0000000000..23ad005920 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void cross_9857cb() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = cross(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cross_9857cb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cross_9857cb(); + return; +} + +kernel void compute_main() { + cross_9857cb(); + return; +} + diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f88a0b061 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cross_9857cb "cross_9857cb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%cross_9857cb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Cross %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %cross_9857cb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %cross_9857cb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %cross_9857cb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.wgsl new file mode 100644 index 0000000000..c249f4f934 --- /dev/null +++ b/test/tint/builtins/gen/var/cross/9857cb.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn cross_9857cb() { + var arg_0 = vec3(); + var arg_1 = vec3(); + var res : vec3 = cross(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cross_9857cb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cross_9857cb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cross_9857cb(); +} diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl new file mode 100644 index 0000000000..95a3e92bc7 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(vec<4, f32>) -> vec<4, f32> +fn degrees_0d170c() { + var arg_0 = vec4(1.f); + var res: vec4 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_0d170c(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_0d170c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_0d170c(); +} diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f7e58a897 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_0d170c() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_0d170c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_0d170c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_0d170c(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2f7e58a897 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_0d170c() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_0d170c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_0d170c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_0d170c(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl new file mode 100644 index 0000000000..44c9a1a7f5 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec4 tint_degrees(vec4 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_0d170c() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_0d170c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_degrees(vec4 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_0d170c() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_0d170c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_degrees(vec4 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_0d170c() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_0d170c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl new file mode 100644 index 0000000000..d1297cc1ab --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_0d170c() { + float4 arg_0 = float4(1.0f); + float4 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_0d170c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_0d170c(); + return; +} + +kernel void compute_main() { + degrees_0d170c(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm new file mode 100644 index 0000000000..ebb45b3ce9 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_0d170c "degrees_0d170c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%degrees_0d170c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Degrees %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %degrees_0d170c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %degrees_0d170c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %degrees_0d170c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl new file mode 100644 index 0000000000..27c944eaae --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn degrees_0d170c() { + var arg_0 = vec4(1.0f); + var res : vec4 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_0d170c(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_0d170c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_0d170c(); +} diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl new file mode 100644 index 0000000000..b0a2860903 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(vec<2, f32>) -> vec<2, f32> +fn degrees_1ad5df() { + var arg_0 = vec2(1.f); + var res: vec2 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_1ad5df(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_1ad5df(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_1ad5df(); +} diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ff76e46111 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_degrees(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_1ad5df() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_1ad5df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_1ad5df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_1ad5df(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ff76e46111 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_degrees(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_1ad5df() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_1ad5df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_1ad5df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_1ad5df(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl new file mode 100644 index 0000000000..e3e890f374 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec2 tint_degrees(vec2 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_1ad5df() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_1ad5df(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_degrees(vec2 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_1ad5df() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_1ad5df(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_degrees(vec2 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_1ad5df() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_1ad5df(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl new file mode 100644 index 0000000000..8c258eb67c --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float2 tint_degrees(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_1ad5df() { + float2 arg_0 = float2(1.0f); + float2 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_1ad5df(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_1ad5df(); + return; +} + +kernel void compute_main() { + degrees_1ad5df(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm new file mode 100644 index 0000000000..b941f0cc8b --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_1ad5df "degrees_1ad5df" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%degrees_1ad5df = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Degrees %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %degrees_1ad5df + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_1ad5df + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %degrees_1ad5df + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1ee3c95e2 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn degrees_1ad5df() { + var arg_0 = vec2(1.0f); + var res : vec2 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_1ad5df(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_1ad5df(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_1ad5df(); +} diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl new file mode 100644 index 0000000000..ea3e24bbff --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(vec<3, f32>) -> vec<3, f32> +fn degrees_2af623() { + var arg_0 = vec3(1.f); + var res: vec3 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_2af623(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_2af623(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_2af623(); +} diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b16be3da81 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_degrees(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_2af623() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_2af623(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_2af623(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_2af623(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b16be3da81 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_degrees(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_2af623() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_2af623(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_2af623(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_2af623(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl new file mode 100644 index 0000000000..fa113c888c --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec3 tint_degrees(vec3 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_2af623() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_2af623(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_degrees(vec3 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_2af623() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_2af623(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_degrees(vec3 param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_2af623() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_2af623(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl new file mode 100644 index 0000000000..46aaa0b740 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float3 tint_degrees(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_2af623() { + float3 arg_0 = float3(1.0f); + float3 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_2af623(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_2af623(); + return; +} + +kernel void compute_main() { + degrees_2af623(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm new file mode 100644 index 0000000000..65830c83aa --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_2af623 "degrees_2af623" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%degrees_2af623 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Degrees %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %degrees_2af623 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_2af623 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %degrees_2af623 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl new file mode 100644 index 0000000000..20f580e013 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn degrees_2af623() { + var arg_0 = vec3(1.0f); + var res : vec3 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_2af623(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_2af623(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_2af623(); +} diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl new file mode 100644 index 0000000000..2ccb71f726 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<4, f16>) -> vec<4, f16> +fn degrees_3055d3() { + var arg_0 = vec4(f16()); + var res: vec4 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_3055d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_3055d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_3055d3(); +} diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b7a4b58df9 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_3055d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_3055d3(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dc4b54ad56 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_3055d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_3055d3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000151C0FBF8C0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.glsl new file mode 100644 index 0000000000..8a051036cb --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_3055d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_3055d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_degrees(f16vec4 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_3055d3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_3055d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.msl new file mode 100644 index 0000000000..e4ca478fba --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half4 tint_degrees(half4 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_3055d3() { + half4 arg_0 = half4(0.0h); + half4 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_3055d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_3055d3(); + return; +} + +kernel void compute_main() { + degrees_3055d3(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.spvasm new file mode 100644 index 0000000000..2604fcfe33 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_3055d3 "degrees_3055d3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_3055d3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Degrees %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %degrees_3055d3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_3055d3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %degrees_3055d3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..284c1c8c72 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/3055d3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn degrees_3055d3() { + var arg_0 = vec4(f16()); + var res : vec4 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_3055d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_3055d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_3055d3(); +} diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl new file mode 100644 index 0000000000..fdda236882 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn degrees(f32) -> f32 +fn degrees_51f705() { + var arg_0 = 1.f; + var res: f32 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_51f705(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_51f705(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_51f705(); +} diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..98215142de --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_51f705(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_51f705(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_51f705(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..98215142de --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_51f705(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_51f705(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_51f705(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl new file mode 100644 index 0000000000..78500d70dc --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_51f705(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_51f705(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865f; +} + + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_51f705(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl new file mode 100644 index 0000000000..4feaad036b --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float tint_degrees(float param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_51f705() { + float arg_0 = 1.0f; + float res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_51f705(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_51f705(); + return; +} + +kernel void compute_main() { + degrees_51f705(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm new file mode 100644 index 0000000000..10bc58e43d --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_51f705 "degrees_51f705" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%degrees_51f705 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Degrees %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %degrees_51f705 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %degrees_51f705 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_51f705 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl new file mode 100644 index 0000000000..5321c3a473 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn degrees_51f705() { + var arg_0 = 1.0f; + var res : f32 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_51f705(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_51f705(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_51f705(); +} diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl new file mode 100644 index 0000000000..3b13f5f558 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(f16) -> f16 +fn degrees_5e9805() { + var arg_0 = f16(); + var res: f16 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_5e9805(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_5e9805(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_5e9805(); +} diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b23805c45e --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_5e9805(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_5e9805(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32b3d346a4 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_5e9805(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_5e9805(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020047AF8DA0(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.glsl new file mode 100644 index 0000000000..69aaca4062 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_5e9805(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_5e9805(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_degrees(float16_t param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_5e9805() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_5e9805(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.msl new file mode 100644 index 0000000000..6639be5e18 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half tint_degrees(half param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_5e9805() { + half arg_0 = 0.0h; + half res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_5e9805(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_5e9805(); + return; +} + +kernel void compute_main() { + degrees_5e9805(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.spvasm new file mode 100644 index 0000000000..bb166209c3 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_5e9805 "degrees_5e9805" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_5e9805 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Degrees %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %degrees_5e9805 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %degrees_5e9805 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %degrees_5e9805 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d9e554e2e --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/5e9805.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn degrees_5e9805() { + var arg_0 = f16(); + var res : f16 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_5e9805(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_5e9805(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_5e9805(); +} diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl new file mode 100644 index 0000000000..6cd4a1de97 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<3, f16>) -> vec<3, f16> +fn degrees_dfe8f4() { + var arg_0 = vec3(f16()); + var res: vec3 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_dfe8f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_dfe8f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_dfe8f4(); +} diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..392869bdb9 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_dfe8f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_dfe8f4(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5066e38d73 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_dfe8f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_dfe8f4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000192E8B81620(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.glsl new file mode 100644 index 0000000000..d82db9e073 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_dfe8f4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_dfe8f4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_degrees(f16vec3 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_dfe8f4() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_dfe8f4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.msl new file mode 100644 index 0000000000..cf288cdb58 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half3 tint_degrees(half3 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_dfe8f4() { + half3 arg_0 = half3(0.0h); + half3 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_dfe8f4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_dfe8f4(); + return; +} + +kernel void compute_main() { + degrees_dfe8f4(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.spvasm new file mode 100644 index 0000000000..32166139d0 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_dfe8f4 "degrees_dfe8f4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_dfe8f4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Degrees %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %degrees_dfe8f4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_dfe8f4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %degrees_dfe8f4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ec216f1bb --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/dfe8f4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn degrees_dfe8f4() { + var arg_0 = vec3(f16()); + var res : vec3 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_dfe8f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_dfe8f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_dfe8f4(); +} diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl new file mode 100644 index 0000000000..a091857dc5 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn degrees(vec<2, f16>) -> vec<2, f16> +fn degrees_f59715() { + var arg_0 = vec2(f16()); + var res: vec2 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_f59715(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_f59715(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_f59715(); +} diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2bf6ba7b6b --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_f59715(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_f59715(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b378860836 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_degrees(vector param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + degrees_f59715(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + degrees_f59715(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022454CA0150(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.glsl new file mode 100644 index 0000000000..0273ac4221 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_degrees(arg_0); +} + +vec4 vertex_main() { + degrees_f59715(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_degrees(arg_0); +} + +void fragment_main() { + degrees_f59715(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_degrees(f16vec2 param_0) { + return param_0 * 57.295779513082322865hf; +} + + +void degrees_f59715() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_degrees(arg_0); +} + +void compute_main() { + degrees_f59715(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.msl new file mode 100644 index 0000000000..a454ff0a37 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half2 tint_degrees(half2 param_0) { + return param_0 * 57.295779513082322865; +} + +void degrees_f59715() { + half2 arg_0 = half2(0.0h); + half2 res = tint_degrees(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + degrees_f59715(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + degrees_f59715(); + return; +} + +kernel void compute_main() { + degrees_f59715(); + return; +} + diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.spvasm new file mode 100644 index 0000000000..dfdcb2435f --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %degrees_f59715 "degrees_f59715" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%degrees_f59715 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Degrees %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %degrees_f59715 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %degrees_f59715 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %degrees_f59715 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3a6abf730 --- /dev/null +++ b/test/tint/builtins/gen/var/degrees/f59715.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn degrees_f59715() { + var arg_0 = vec2(f16()); + var res : vec2 = degrees(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + degrees_f59715(); + return vec4(); +} + +@fragment +fn fragment_main() { + degrees_f59715(); +} + +@compute @workgroup_size(1) +fn compute_main() { + degrees_f59715(); +} diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl new file mode 100644 index 0000000000..30a6d55321 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn determinant(mat<3, 3, f32>) -> f32 +fn determinant_2b62ba() { + var arg_0 = mat3x3(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: f32 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_2b62ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_2b62ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_2b62ba(); +} diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d562cdfcb --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void determinant_2b62ba() { + float3x3 arg_0 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_2b62ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_2b62ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_2b62ba(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d562cdfcb --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void determinant_2b62ba() { + float3x3 arg_0 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_2b62ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_2b62ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_2b62ba(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl new file mode 100644 index 0000000000..618def4222 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void determinant_2b62ba() { + mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f)); + float res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_2b62ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void determinant_2b62ba() { + mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f)); + float res = determinant(arg_0); +} + +void fragment_main() { + determinant_2b62ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void determinant_2b62ba() { + mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f)); + float res = determinant(arg_0); +} + +void compute_main() { + determinant_2b62ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl new file mode 100644 index 0000000000..d04b49ccfa --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_2b62ba() { + float3x3 arg_0 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f)); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_2b62ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_2b62ba(); + return; +} + +kernel void compute_main() { + determinant_2b62ba(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..6d9142b027 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_2b62ba "determinant_2b62ba" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %17 = OpConstantComposite %mat3v3float %16 %16 %16 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %20 = OpConstantNull %mat3v3float +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpTypeFunction %v4float +%determinant_2b62ba = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v3float Function %20 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %17 + %23 = OpLoad %mat3v3float %arg_0 + %21 = OpExtInst %float %22 Determinant %23 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %determinant_2b62ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_2b62ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %determinant_2b62ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..effc94f1eb --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn determinant_2b62ba() { + var arg_0 = mat3x3(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : f32 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_2b62ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_2b62ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_2b62ba(); +} diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl new file mode 100644 index 0000000000..fd0a38e315 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<4, 4, f16>) -> f16 +fn determinant_32bfde() { + var arg_0 = mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_32bfde(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_32bfde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_32bfde(); +} diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21bb924a04 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void determinant_32bfde() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_32bfde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_32bfde(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3db7954463 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void determinant_32bfde() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_32bfde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_32bfde(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022F54326C80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022F54326C80(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022F54326C80(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.glsl new file mode 100644 index 0000000000..2edc4dbcb3 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_32bfde() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + float16_t res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_32bfde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_32bfde() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + float16_t res = determinant(arg_0); +} + +void fragment_main() { + determinant_32bfde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_32bfde() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + float16_t res = determinant(arg_0); +} + +void compute_main() { + determinant_32bfde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.msl new file mode 100644 index 0000000000..2398440469 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_32bfde() { + half4x4 arg_0 = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h)); + half res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_32bfde(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_32bfde(); + return; +} + +kernel void compute_main() { + determinant_32bfde(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.spvasm new file mode 100644 index 0000000000..3af3168271 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_32bfde "determinant_32bfde" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %16 = OpConstantNull %mat4v4half +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_32bfde = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v4half Function %16 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %mat4v4half %arg_0 + %19 = OpExtInst %half %20 Determinant %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %determinant_32bfde + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_32bfde + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %determinant_32bfde + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0fcade5c0 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/32bfde.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn determinant_32bfde() { + var arg_0 = mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_32bfde(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_32bfde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_32bfde(); +} diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl new file mode 100644 index 0000000000..cf826dff23 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn determinant(mat<4, 4, f32>) -> f32 +fn determinant_a0a87c() { + var arg_0 = mat4x4(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: f32 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_a0a87c(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_a0a87c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_a0a87c(); +} diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dfae910a6d --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void determinant_a0a87c() { + float4x4 arg_0 = float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_a0a87c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_a0a87c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_a0a87c(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dfae910a6d --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void determinant_a0a87c() { + float4x4 arg_0 = float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_a0a87c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_a0a87c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_a0a87c(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl new file mode 100644 index 0000000000..3428e8ac38 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void determinant_a0a87c() { + mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f)); + float res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_a0a87c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void determinant_a0a87c() { + mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f)); + float res = determinant(arg_0); +} + +void fragment_main() { + determinant_a0a87c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void determinant_a0a87c() { + mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f)); + float res = determinant(arg_0); +} + +void compute_main() { + determinant_a0a87c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl new file mode 100644 index 0000000000..470aa403c8 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_a0a87c() { + float4x4 arg_0 = float4x4(float4(1.0f), float4(1.0f), float4(1.0f), float4(1.0f)); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_a0a87c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_a0a87c(); + return; +} + +kernel void compute_main() { + determinant_a0a87c(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm new file mode 100644 index 0000000000..6c4acf3448 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_a0a87c "determinant_a0a87c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %16 = OpConstantComposite %mat4v4float %15 %15 %15 %15 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %19 = OpConstantNull %mat4v4float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpTypeFunction %v4float +%determinant_a0a87c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v4float Function %19 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %16 + %22 = OpLoad %mat4v4float %arg_0 + %20 = OpExtInst %float %21 Determinant %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %determinant_a0a87c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %determinant_a0a87c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %determinant_a0a87c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl new file mode 100644 index 0000000000..5409069897 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn determinant_a0a87c() { + var arg_0 = mat4x4(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : f32 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_a0a87c(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_a0a87c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_a0a87c(); +} diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl new file mode 100644 index 0000000000..b071018e54 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<3, 3, f16>) -> f16 +fn determinant_d7c86f() { + var arg_0 = mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_d7c86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_d7c86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_d7c86f(); +} diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..899cb344ae --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void determinant_d7c86f() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_d7c86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_d7c86f(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d769802e1a --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void determinant_d7c86f() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_d7c86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_d7c86f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C5F7AE5180(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C5F7AE5180(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C5F7AE5180(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.glsl new file mode 100644 index 0000000000..9718310c09 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_d7c86f() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + float16_t res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_d7c86f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_d7c86f() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + float16_t res = determinant(arg_0); +} + +void fragment_main() { + determinant_d7c86f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_d7c86f() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + float16_t res = determinant(arg_0); +} + +void compute_main() { + determinant_d7c86f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.msl new file mode 100644 index 0000000000..a3b282f07a --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_d7c86f() { + half3x3 arg_0 = half3x3(half3(0.0h), half3(0.0h), half3(0.0h)); + half res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_d7c86f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_d7c86f(); + return; +} + +kernel void compute_main() { + determinant_d7c86f(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.spvasm new file mode 100644 index 0000000000..0540412c56 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_d7c86f "determinant_d7c86f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %16 = OpConstantNull %mat3v3half +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_d7c86f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v3half Function %16 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %mat3v3half %arg_0 + %19 = OpExtInst %half %20 Determinant %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %determinant_d7c86f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_d7c86f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %determinant_d7c86f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.wgsl new file mode 100644 index 0000000000..aae4d08d2c --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/d7c86f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn determinant_d7c86f() { + var arg_0 = mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_d7c86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_d7c86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_d7c86f(); +} diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl new file mode 100644 index 0000000000..54a6399d09 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn determinant(mat<2, 2, f32>) -> f32 +fn determinant_e19305() { + var arg_0 = mat2x2(1.f, 1.f, 1.f, 1.f); + var res: f32 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_e19305(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_e19305(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_e19305(); +} diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2869e99214 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void determinant_e19305() { + float2x2 arg_0 = float2x2((1.0f).xx, (1.0f).xx); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_e19305(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_e19305(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_e19305(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2869e99214 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void determinant_e19305() { + float2x2 arg_0 = float2x2((1.0f).xx, (1.0f).xx); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_e19305(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_e19305(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_e19305(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl new file mode 100644 index 0000000000..4834f5ed3a --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void determinant_e19305() { + mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f)); + float res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_e19305(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void determinant_e19305() { + mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f)); + float res = determinant(arg_0); +} + +void fragment_main() { + determinant_e19305(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void determinant_e19305() { + mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f)); + float res = determinant(arg_0); +} + +void compute_main() { + determinant_e19305(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl new file mode 100644 index 0000000000..9a9604bef4 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_e19305() { + float2x2 arg_0 = float2x2(float2(1.0f), float2(1.0f)); + float res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_e19305(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_e19305(); + return; +} + +kernel void compute_main() { + determinant_e19305(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm new file mode 100644 index 0000000000..f0741cb48e --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_e19305 "determinant_e19305" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v2float %float_1 %float_1 + %17 = OpConstantComposite %mat2v2float %16 %16 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %20 = OpConstantNull %mat2v2float +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpTypeFunction %v4float +%determinant_e19305 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v2float Function %20 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %17 + %23 = OpLoad %mat2v2float %arg_0 + %21 = OpExtInst %float %22 Determinant %23 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %determinant_e19305 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_e19305 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %determinant_e19305 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa8b4f6fd2 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn determinant_e19305() { + var arg_0 = mat2x2(1.0f, 1.0f, 1.0f, 1.0f); + var res : f32 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_e19305(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_e19305(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_e19305(); +} diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl new file mode 100644 index 0000000000..bcb0f6e481 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn determinant(mat<2, 2, f16>) -> f16 +fn determinant_fc12a5() { + var arg_0 = mat2x2(f16(), f16(), f16(), f16()); + var res: f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_fc12a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_fc12a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_fc12a5(); +} diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46328d560a --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void determinant_fc12a5() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_fc12a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_fc12a5(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a06af79785 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void determinant_fc12a5() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + float16_t res = determinant(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + determinant_fc12a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + determinant_fc12a5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022674B2E9D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022674B2E9D0(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022674B2E9D0(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.glsl new file mode 100644 index 0000000000..a8dbfa6a0f --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_fc12a5() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + float16_t res = determinant(arg_0); +} + +vec4 vertex_main() { + determinant_fc12a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void determinant_fc12a5() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + float16_t res = determinant(arg_0); +} + +void fragment_main() { + determinant_fc12a5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void determinant_fc12a5() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + float16_t res = determinant(arg_0); +} + +void compute_main() { + determinant_fc12a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.msl new file mode 100644 index 0000000000..2e6b14e149 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void determinant_fc12a5() { + half2x2 arg_0 = half2x2(half2(0.0h), half2(0.0h)); + half res = determinant(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + determinant_fc12a5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + determinant_fc12a5(); + return; +} + +kernel void compute_main() { + determinant_fc12a5(); + return; +} + diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.spvasm new file mode 100644 index 0000000000..1141730e28 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %determinant_fc12a5 "determinant_fc12a5" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %16 = OpConstantNull %mat2v2half +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%determinant_fc12a5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v2half Function %16 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %16 + %21 = OpLoad %mat2v2half %arg_0 + %19 = OpExtInst %half %20 Determinant %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %determinant_fc12a5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %determinant_fc12a5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %determinant_fc12a5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..225d3cfd93 --- /dev/null +++ b/test/tint/builtins/gen/var/determinant/fc12a5.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn determinant_fc12a5() { + var arg_0 = mat2x2(f16(), f16(), f16(), f16()); + var res : f16 = determinant(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + determinant_fc12a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + determinant_fc12a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + determinant_fc12a5(); +} diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl new file mode 100644 index 0000000000..31f6abe1d2 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(vec<3, f32>, vec<3, f32>) -> f32 +fn distance_0657d4() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var res: f32 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_0657d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_0657d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_0657d4(); +} diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d6d090cca7 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_0657d4() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_0657d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_0657d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_0657d4(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d6d090cca7 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void distance_0657d4() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_0657d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_0657d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_0657d4(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl new file mode 100644 index 0000000000..6ce3dea3e6 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void distance_0657d4() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_0657d4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_0657d4() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_0657d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_0657d4() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_0657d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl new file mode 100644 index 0000000000..caefb1ae6a --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_0657d4() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_0657d4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_0657d4(); + return; +} + +kernel void compute_main() { + distance_0657d4(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..41dfc73a6f --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_0657d4 "distance_0657d4" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpTypeFunction %v4float +%distance_0657d4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v3float %arg_0 + %23 = OpLoad %v3float %arg_1 + %20 = OpExtInst %float %21 Distance %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_0657d4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %distance_0657d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %distance_0657d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..8a96f48c06 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn distance_0657d4() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var res : f32 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_0657d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_0657d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_0657d4(); +} diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl new file mode 100644 index 0000000000..f8aad30c93 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<4, f16>, vec<4, f16>) -> f16 +fn distance_7272f3() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7272f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7272f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7272f3(); +} diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1b62fdc621 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_7272f3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7272f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7272f3(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..019f6afc3a --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void distance_7272f3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7272f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7272f3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EADAF82D50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EADAF82D50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EADAF82D50(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EADAF82D50(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.glsl new file mode 100644 index 0000000000..16eba83445 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7272f3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_7272f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_7272f3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_7272f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7272f3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_7272f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.msl new file mode 100644 index 0000000000..24a1476c81 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_7272f3() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_7272f3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_7272f3(); + return; +} + +kernel void compute_main() { + distance_7272f3(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..967f8eab46 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_7272f3 "distance_7272f3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpConstantNull %half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_7272f3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_half Function %25 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %half %20 Distance %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_7272f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %distance_7272f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %distance_7272f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..3689ad7631 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7272f3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn distance_7272f3() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7272f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7272f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7272f3(); +} diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl new file mode 100644 index 0000000000..a66064c8b5 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(f16, f16) -> f16 +fn distance_7d201f() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7d201f(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7d201f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7d201f(); +} diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e83ccf12fe --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_7d201f() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7d201f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7d201f(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..42c0407676 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void distance_7d201f() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_7d201f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_7d201f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020A788F9640(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020A788F9640(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.glsl new file mode 100644 index 0000000000..0ed25e6a06 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7d201f() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_7d201f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_7d201f() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_7d201f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_7d201f() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_7d201f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.msl new file mode 100644 index 0000000000..780d62ec89 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_7d201f() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = fabs(arg_0 - arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_7d201f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_7d201f(); + return; +} + +kernel void compute_main() { + distance_7d201f(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.spvasm new file mode 100644 index 0000000000..b39b43cfbb --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_7d201f "distance_7d201f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_7d201f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 Distance %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %distance_7d201f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %distance_7d201f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %distance_7d201f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.wgsl new file mode 100644 index 0000000000..4480b58193 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/7d201f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn distance_7d201f() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_7d201f(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_7d201f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_7d201f(); +} diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl new file mode 100644 index 0000000000..2a5c2080ce --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<2, f16>, vec<2, f16>) -> f16 +fn distance_892a5d() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_892a5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_892a5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_892a5d(); +} diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..034e57e09b --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_892a5d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_892a5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_892a5d(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6d94bf908 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void distance_892a5d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_892a5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_892a5d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA47782B40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA47782B40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA47782B40(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FA47782B40(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.glsl new file mode 100644 index 0000000000..a615b6f8e3 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_892a5d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_892a5d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_892a5d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_892a5d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_892a5d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_892a5d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.msl new file mode 100644 index 0000000000..8fe755ddb3 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_892a5d() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_892a5d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_892a5d(); + return; +} + +kernel void compute_main() { + distance_892a5d(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.spvasm new file mode 100644 index 0000000000..59a5d06ed9 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_892a5d "distance_892a5d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpConstantNull %half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_892a5d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_half Function %25 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %half %20 Distance %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_892a5d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %distance_892a5d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %distance_892a5d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.wgsl new file mode 100644 index 0000000000..279adafbd4 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/892a5d.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn distance_892a5d() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_892a5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_892a5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_892a5d(); +} diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl new file mode 100644 index 0000000000..83a533b887 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn distance(vec<3, f16>, vec<3, f16>) -> f16 +fn distance_928fa0() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_928fa0(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_928fa0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_928fa0(); +} diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..097d7b8edd --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_928fa0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_928fa0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_928fa0(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..354f95e3a7 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void distance_928fa0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_928fa0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_928fa0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000277E5AD2CF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000277E5AD2CF0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000277E5AD2CF0(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000277E5AD2CF0(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.glsl new file mode 100644 index 0000000000..77dd598b10 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_928fa0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_928fa0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void distance_928fa0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_928fa0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void distance_928fa0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_928fa0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.msl new file mode 100644 index 0000000000..b2a96ab114 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_928fa0() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_928fa0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_928fa0(); + return; +} + +kernel void compute_main() { + distance_928fa0(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.spvasm new file mode 100644 index 0000000000..96965393a9 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_928fa0 "distance_928fa0" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpConstantNull %half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%distance_928fa0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_half Function %25 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %half %20 Distance %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_928fa0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %distance_928fa0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %distance_928fa0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.wgsl new file mode 100644 index 0000000000..840d9e5cf0 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/928fa0.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn distance_928fa0() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : f16 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_928fa0(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_928fa0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_928fa0(); +} diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl new file mode 100644 index 0000000000..b60b963732 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(vec<4, f32>, vec<4, f32>) -> f32 +fn distance_9646ea() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var res: f32 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_9646ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_9646ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_9646ea(); +} diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d4f1a67b0a --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_9646ea() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_9646ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_9646ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_9646ea(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d4f1a67b0a --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void distance_9646ea() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_9646ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_9646ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_9646ea(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl new file mode 100644 index 0000000000..6d31f7e51e --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void distance_9646ea() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_9646ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_9646ea() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_9646ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_9646ea() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_9646ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl new file mode 100644 index 0000000000..e2657c4029 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_9646ea() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_9646ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_9646ea(); + return; +} + +kernel void compute_main() { + distance_9646ea(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..733a196da4 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_9646ea "distance_9646ea" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float +%distance_9646ea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v4float %arg_0 + %21 = OpLoad %v4float %arg_1 + %18 = OpExtInst %float %19 Distance %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %distance_9646ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %distance_9646ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %distance_9646ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc9c86a087 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn distance_9646ea() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var res : f32 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_9646ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_9646ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_9646ea(); +} diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl new file mode 100644 index 0000000000..732682276b --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(vec<2, f32>, vec<2, f32>) -> f32 +fn distance_aa4055() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var res: f32 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_aa4055(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_aa4055(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_aa4055(); +} diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9cc0da96e --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_aa4055() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_aa4055(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_aa4055(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_aa4055(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f9cc0da96e --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void distance_aa4055() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_aa4055(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_aa4055(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_aa4055(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl new file mode 100644 index 0000000000..a16e7bbd52 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void distance_aa4055() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_aa4055(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_aa4055() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_aa4055(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_aa4055() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_aa4055(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl new file mode 100644 index 0000000000..0bd15e19e2 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_aa4055() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_aa4055(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_aa4055(); + return; +} + +kernel void compute_main() { + distance_aa4055(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm new file mode 100644 index 0000000000..0bc74bc143 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_aa4055 "distance_aa4055" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpTypeFunction %v4float +%distance_aa4055 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v2float %arg_0 + %23 = OpLoad %v2float %arg_1 + %20 = OpExtInst %float %21 Distance %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %distance_aa4055 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %distance_aa4055 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %distance_aa4055 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl new file mode 100644 index 0000000000..9846b11cc5 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn distance_aa4055() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var res : f32 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_aa4055(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_aa4055(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_aa4055(); +} diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl new file mode 100644 index 0000000000..3f3d1d2cb7 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn distance(f32, f32) -> f32 +fn distance_cfed73() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var res: f32 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_cfed73(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_cfed73(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_cfed73(); +} diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2345aa74d --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_cfed73(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_cfed73(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_cfed73(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b2345aa74d --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = distance(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + distance_cfed73(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + distance_cfed73(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + distance_cfed73(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl new file mode 100644 index 0000000000..916a23d68d --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = distance(arg_0, arg_1); +} + +vec4 vertex_main() { + distance_cfed73(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = distance(arg_0, arg_1); +} + +void fragment_main() { + distance_cfed73(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = distance(arg_0, arg_1); +} + +void compute_main() { + distance_cfed73(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl new file mode 100644 index 0000000000..5f68fe8887 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void distance_cfed73() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = fabs(arg_0 - arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + distance_cfed73(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + distance_cfed73(); + return; +} + +kernel void compute_main() { + distance_cfed73(); + return; +} + diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm new file mode 100644 index 0000000000..49a0f989d1 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %distance_cfed73 "distance_cfed73" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float +%distance_cfed73 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 Distance %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %distance_cfed73 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %distance_cfed73 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %distance_cfed73 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl new file mode 100644 index 0000000000..e52cb2a4f6 --- /dev/null +++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn distance_cfed73() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var res : f32 = distance(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + distance_cfed73(); + return vec4(); +} + +@fragment +fn fragment_main() { + distance_cfed73(); +} + +@compute @workgroup_size(1) +fn compute_main() { + distance_cfed73(); +} diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl new file mode 100644 index 0000000000..ab16fb2cd7 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<4, f32>, vec<4, f32>) -> f32 +fn dot_0c577b() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var res: f32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_0c577b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_0c577b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_0c577b(); +} diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8487fa9b84 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_0c577b() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_0c577b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_0c577b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_0c577b(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8487fa9b84 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void dot_0c577b() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_0c577b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_0c577b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_0c577b(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl new file mode 100644 index 0000000000..f469ef1266 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void dot_0c577b() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_0c577b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void dot_0c577b() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_0c577b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void dot_0c577b() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_0c577b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl new file mode 100644 index 0000000000..f9d4bd8c76 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_0c577b() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_0c577b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_0c577b(); + return; +} + +kernel void compute_main() { + dot_0c577b(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm new file mode 100644 index 0000000000..9b003e92c7 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_0c577b "dot_0c577b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %v4float + %dot_0c577b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %19 = OpLoad %v4float %arg_0 + %20 = OpLoad %v4float %arg_1 + %18 = OpDot %float %19 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %dot_0c577b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %dot_0c577b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %dot_0c577b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl new file mode 100644 index 0000000000..69cc640b7b --- /dev/null +++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_0c577b() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var res : f32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_0c577b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_0c577b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_0c577b(); +} diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl new file mode 100644 index 0000000000..2f59af9488 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<3, u32>, vec<3, u32>) -> u32 +fn dot_7548a0() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var res: u32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_7548a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_7548a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_7548a0(); +} diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f70435589 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_7548a0() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_7548a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_7548a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_7548a0(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5f70435589 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void dot_7548a0() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_7548a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_7548a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_7548a0(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl new file mode 100644 index 0000000000..45a7402ac3 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uint tint_int_dot(uvec3 a, uvec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_7548a0() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uint res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_7548a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_int_dot(uvec3 a, uvec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_7548a0() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_7548a0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_int_dot(uvec3 a, uvec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_7548a0() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_7548a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl new file mode 100644 index 0000000000..6649a395fb --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot3(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} +void dot_7548a0() { + uint3 arg_0 = uint3(1u); + uint3 arg_1 = uint3(1u); + uint res = tint_dot3(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_7548a0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_7548a0(); + return; +} + +kernel void compute_main() { + dot_7548a0(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..23f432bbec --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_7548a0 "dot_7548a0" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint +%_ptr_Function_uint = OpTypePointer Function %uint + %36 = OpConstantNull %uint + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_7548a0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %19 + %res = OpVariable %_ptr_Function_uint Function %36 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %22 = OpLoad %v3uint %arg_0 + %23 = OpLoad %v3uint %arg_1 + %24 = OpCompositeExtract %uint %22 0 + %25 = OpCompositeExtract %uint %23 0 + %26 = OpIMul %uint %24 %25 + %27 = OpCompositeExtract %uint %22 1 + %28 = OpCompositeExtract %uint %23 1 + %29 = OpIMul %uint %27 %28 + %30 = OpIAdd %uint %26 %29 + %31 = OpCompositeExtract %uint %22 2 + %32 = OpCompositeExtract %uint %23 2 + %33 = OpIMul %uint %31 %32 + %21 = OpIAdd %uint %30 %33 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %dot_7548a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %dot_7548a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %49 = OpLabel + %50 = OpFunctionCall %void %dot_7548a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ff92a3aad --- /dev/null +++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_7548a0() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var res : u32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_7548a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_7548a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_7548a0(); +} diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl new file mode 100644 index 0000000000..638c1bdbd5 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<2, f32>, vec<2, f32>) -> f32 +fn dot_883f0e() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var res: f32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_883f0e(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_883f0e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_883f0e(); +} diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dea3692513 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_883f0e() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_883f0e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_883f0e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_883f0e(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dea3692513 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void dot_883f0e() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_883f0e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_883f0e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_883f0e(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl new file mode 100644 index 0000000000..05ac5dd550 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void dot_883f0e() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_883f0e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void dot_883f0e() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_883f0e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void dot_883f0e() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_883f0e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl new file mode 100644 index 0000000000..0c1415dbb8 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_883f0e() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_883f0e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_883f0e(); + return; +} + +kernel void compute_main() { + dot_883f0e(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm new file mode 100644 index 0000000000..10882a041e --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_883f0e "dot_883f0e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpTypeFunction %v4float + %dot_883f0e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2float %arg_0 + %22 = OpLoad %v2float %arg_1 + %20 = OpDot %float %21 %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_883f0e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %dot_883f0e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %dot_883f0e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl new file mode 100644 index 0000000000..263f3dd47a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_883f0e() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var res : f32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_883f0e(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_883f0e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_883f0e(); +} diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl new file mode 100644 index 0000000000..eceecd1056 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<3, f16>, vec<3, f16>) -> f16 +fn dot_8e40f1() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_8e40f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_8e40f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_8e40f1(); +} diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad11be220a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_8e40f1() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_8e40f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_8e40f1(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad26057ae0 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void dot_8e40f1() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_8e40f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_8e40f1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018A9A333310(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018A9A333310(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018A9A333310(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018A9A333310(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.glsl new file mode 100644 index 0000000000..18066bf0c5 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_8e40f1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_8e40f1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_8e40f1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_8e40f1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_8e40f1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_8e40f1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.msl new file mode 100644 index 0000000000..eacb81c04d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_8e40f1() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_8e40f1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_8e40f1(); + return; +} + +kernel void compute_main() { + dot_8e40f1(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.spvasm new file mode 100644 index 0000000000..6bed79d843 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_8e40f1 "dot_8e40f1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_8e40f1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v3half %arg_0 + %21 = OpLoad %v3half %arg_1 + %19 = OpDot %half %20 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_8e40f1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %dot_8e40f1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_8e40f1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.wgsl new file mode 100644 index 0000000000..db92b086bc --- /dev/null +++ b/test/tint/builtins/gen/var/dot/8e40f1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn dot_8e40f1() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_8e40f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_8e40f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_8e40f1(); +} diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl new file mode 100644 index 0000000000..bcfec67ea6 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<2, u32>, vec<2, u32>) -> u32 +fn dot_97c7ee() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var res: u32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_97c7ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_97c7ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_97c7ee(); +} diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f537c336cf --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_97c7ee() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_97c7ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_97c7ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_97c7ee(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f537c336cf --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void dot_97c7ee() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_97c7ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_97c7ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_97c7ee(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl new file mode 100644 index 0000000000..246c21ba65 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uint tint_int_dot(uvec2 a, uvec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_97c7ee() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uint res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_97c7ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_int_dot(uvec2 a, uvec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_97c7ee() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_97c7ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_int_dot(uvec2 a, uvec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_97c7ee() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_97c7ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl new file mode 100644 index 0000000000..6957fe4a01 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot2(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1]; +} +void dot_97c7ee() { + uint2 arg_0 = uint2(1u); + uint2 arg_1 = uint2(1u); + uint res = tint_dot2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_97c7ee(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_97c7ee(); + return; +} + +kernel void compute_main() { + dot_97c7ee(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..480735d77d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_97c7ee "dot_97c7ee" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint +%_ptr_Function_uint = OpTypePointer Function %uint + %32 = OpConstantNull %uint + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_97c7ee = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %19 + %res = OpVariable %_ptr_Function_uint Function %32 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %22 = OpLoad %v2uint %arg_0 + %23 = OpLoad %v2uint %arg_1 + %24 = OpCompositeExtract %uint %22 0 + %25 = OpCompositeExtract %uint %23 0 + %26 = OpIMul %uint %24 %25 + %27 = OpCompositeExtract %uint %22 1 + %28 = OpCompositeExtract %uint %23 1 + %29 = OpIMul %uint %27 %28 + %21 = OpIAdd %uint %26 %29 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %dot_97c7ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %dot_97c7ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %dot_97c7ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c2b5c2706 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_97c7ee() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var res : u32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_97c7ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_97c7ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_97c7ee(); +} diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl new file mode 100644 index 0000000000..a0a9b32a27 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<3, f32>, vec<3, f32>) -> f32 +fn dot_ba4246() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var res: f32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_ba4246(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_ba4246(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_ba4246(); +} diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a69fd9eba7 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_ba4246() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ba4246(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ba4246(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ba4246(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a69fd9eba7 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void dot_ba4246() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ba4246(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ba4246(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ba4246(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl new file mode 100644 index 0000000000..a43c686a10 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void dot_ba4246() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_ba4246(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void dot_ba4246() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_ba4246(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void dot_ba4246() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_ba4246(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl new file mode 100644 index 0000000000..7a789d08fa --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_ba4246() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_ba4246(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_ba4246(); + return; +} + +kernel void compute_main() { + dot_ba4246(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm new file mode 100644 index 0000000000..ebb73d635e --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_ba4246 "dot_ba4246" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpTypeFunction %v4float + %dot_ba4246 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3float %arg_0 + %22 = OpLoad %v3float %arg_1 + %20 = OpDot %float %21 %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_ba4246 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %dot_ba4246 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %dot_ba4246 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl new file mode 100644 index 0000000000..9964247a1a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_ba4246() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var res : f32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_ba4246(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_ba4246(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_ba4246(); +} diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl new file mode 100644 index 0000000000..9226d5cffb --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<2, f16>, vec<2, f16>) -> f16 +fn dot_cd5a04() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_cd5a04(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_cd5a04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_cd5a04(); +} diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..27c17be74c --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_cd5a04() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_cd5a04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_cd5a04(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2a3cca805f --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void dot_cd5a04() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_cd5a04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_cd5a04(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020151407920(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020151407920(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020151407920(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020151407920(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.glsl new file mode 100644 index 0000000000..03060cef0e --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_cd5a04() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_cd5a04(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_cd5a04() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_cd5a04(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_cd5a04() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_cd5a04(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.msl new file mode 100644 index 0000000000..b70c4db63d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_cd5a04() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_cd5a04(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_cd5a04(); + return; +} + +kernel void compute_main() { + dot_cd5a04(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.spvasm new file mode 100644 index 0000000000..9cef5f77fa --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_cd5a04 "dot_cd5a04" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_cd5a04 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v2half %arg_0 + %21 = OpLoad %v2half %arg_1 + %19 = OpDot %half %20 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_cd5a04 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %dot_cd5a04 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_cd5a04 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.wgsl new file mode 100644 index 0000000000..8fc1a17fc2 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/cd5a04.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn dot_cd5a04() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_cd5a04(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_cd5a04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_cd5a04(); +} diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl new file mode 100644 index 0000000000..972ce4323e --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn dot(vec<4, f16>, vec<4, f16>) -> f16 +fn dot_d0d179() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_d0d179(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_d0d179(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_d0d179(); +} diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6a5b4c7a7 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_d0d179() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_d0d179(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_d0d179(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67a0bee40b --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void dot_d0d179() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_d0d179(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_d0d179(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019F987BD460(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019F987BD460(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019F987BD460(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019F987BD460(4,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.glsl new file mode 100644 index 0000000000..fd6939cedb --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_d0d179() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_d0d179(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void dot_d0d179() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void fragment_main() { + dot_d0d179(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void dot_d0d179() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t res = dot(arg_0, arg_1); +} + +void compute_main() { + dot_d0d179(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.msl new file mode 100644 index 0000000000..4a83867129 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void dot_d0d179() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_d0d179(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_d0d179(); + return; +} + +kernel void compute_main() { + dot_d0d179(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.spvasm new file mode 100644 index 0000000000..5bca82850a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_d0d179 "dot_d0d179" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_d0d179 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_half Function %24 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %20 = OpLoad %v4half %arg_0 + %21 = OpLoad %v4half %arg_1 + %19 = OpDot %half %20 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %dot_d0d179 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %dot_d0d179 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %dot_d0d179 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.wgsl new file mode 100644 index 0000000000..3297912d2d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/d0d179.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn dot_d0d179() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : f16 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_d0d179(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_d0d179(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_d0d179(); +} diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl new file mode 100644 index 0000000000..9b70a9f0a1 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<4, u32>, vec<4, u32>) -> u32 +fn dot_e994c7() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var res: u32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_e994c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_e994c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_e994c7(); +} diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c75a1db55a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_e994c7() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_e994c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_e994c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_e994c7(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c75a1db55a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void dot_e994c7() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_e994c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_e994c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_e994c7(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl new file mode 100644 index 0000000000..9a4aa4d6b4 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uint tint_int_dot(uvec4 a, uvec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_e994c7() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uint res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_e994c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_int_dot(uvec4 a, uvec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_e994c7() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_e994c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_int_dot(uvec4 a, uvec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_e994c7() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uint res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_e994c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl new file mode 100644 index 0000000000..6429d76e19 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot4(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} +void dot_e994c7() { + uint4 arg_0 = uint4(1u); + uint4 arg_1 = uint4(1u); + uint res = tint_dot4(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_e994c7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_e994c7(); + return; +} + +kernel void compute_main() { + dot_e994c7(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..e285599f3d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_e994c7 "dot_e994c7" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint +%_ptr_Function_uint = OpTypePointer Function %uint + %40 = OpConstantNull %uint + %41 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_e994c7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %19 + %res = OpVariable %_ptr_Function_uint Function %40 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %22 = OpLoad %v4uint %arg_0 + %23 = OpLoad %v4uint %arg_1 + %24 = OpCompositeExtract %uint %22 0 + %25 = OpCompositeExtract %uint %23 0 + %26 = OpIMul %uint %24 %25 + %27 = OpCompositeExtract %uint %22 1 + %28 = OpCompositeExtract %uint %23 1 + %29 = OpIMul %uint %27 %28 + %30 = OpIAdd %uint %26 %29 + %31 = OpCompositeExtract %uint %22 2 + %32 = OpCompositeExtract %uint %23 2 + %33 = OpIMul %uint %31 %32 + %34 = OpIAdd %uint %30 %33 + %35 = OpCompositeExtract %uint %22 3 + %36 = OpCompositeExtract %uint %23 3 + %37 = OpIMul %uint %35 %36 + %21 = OpIAdd %uint %34 %37 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %41 + %43 = OpLabel + %44 = OpFunctionCall %void %dot_e994c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %47 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %50 = OpLabel + %51 = OpFunctionCall %void %dot_e994c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %53 = OpLabel + %54 = OpFunctionCall %void %dot_e994c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..9deb5995f5 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_e994c7() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var res : u32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_e994c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_e994c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_e994c7(); +} diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl new file mode 100644 index 0000000000..12ded4f92d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<4, i32>, vec<4, i32>) -> i32 +fn dot_ef6b1d() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var res: i32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_ef6b1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_ef6b1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_ef6b1d(); +} diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..96174b6763 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_ef6b1d() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + int res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ef6b1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ef6b1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ef6b1d(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..96174b6763 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void dot_ef6b1d() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + int res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_ef6b1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_ef6b1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_ef6b1d(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl new file mode 100644 index 0000000000..f5ab0f232c --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +int tint_int_dot(ivec4 a, ivec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_ef6b1d() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + int res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_ef6b1d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_int_dot(ivec4 a, ivec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_ef6b1d() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + int res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_ef6b1d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_int_dot(ivec4 a, ivec4 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} + +void dot_ef6b1d() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + int res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_ef6b1d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl new file mode 100644 index 0000000000..700a2af47a --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot4(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; +} +void dot_ef6b1d() { + int4 arg_0 = int4(1); + int4 arg_1 = int4(1); + int res = tint_dot4(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_ef6b1d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_ef6b1d(); + return; +} + +kernel void compute_main() { + dot_ef6b1d(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..a640cfbbbe --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_ef6b1d "dot_ef6b1d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int +%_ptr_Function_int = OpTypePointer Function %int + %40 = OpConstantNull %int + %41 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_ef6b1d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %19 + %arg_1 = OpVariable %_ptr_Function_v4int Function %19 + %res = OpVariable %_ptr_Function_int Function %40 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %22 = OpLoad %v4int %arg_0 + %23 = OpLoad %v4int %arg_1 + %24 = OpCompositeExtract %int %22 0 + %25 = OpCompositeExtract %int %23 0 + %26 = OpIMul %int %24 %25 + %27 = OpCompositeExtract %int %22 1 + %28 = OpCompositeExtract %int %23 1 + %29 = OpIMul %int %27 %28 + %30 = OpIAdd %int %26 %29 + %31 = OpCompositeExtract %int %22 2 + %32 = OpCompositeExtract %int %23 2 + %33 = OpIMul %int %31 %32 + %34 = OpIAdd %int %30 %33 + %35 = OpCompositeExtract %int %22 3 + %36 = OpCompositeExtract %int %23 3 + %37 = OpIMul %int %35 %36 + %21 = OpIAdd %int %34 %37 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %41 + %43 = OpLabel + %44 = OpFunctionCall %void %dot_ef6b1d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %47 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %50 = OpLabel + %51 = OpFunctionCall %void %dot_ef6b1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %53 = OpLabel + %54 = OpFunctionCall %void %dot_ef6b1d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..19a334c045 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_ef6b1d() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var res : i32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_ef6b1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_ef6b1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_ef6b1d(); +} diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl new file mode 100644 index 0000000000..52b4107f7c --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<3, i32>, vec<3, i32>) -> i32 +fn dot_f1312c() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var res: i32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_f1312c(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_f1312c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_f1312c(); +} diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..68dde1e96d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_f1312c() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + int res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_f1312c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_f1312c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_f1312c(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68dde1e96d --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void dot_f1312c() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + int res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_f1312c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_f1312c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_f1312c(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl new file mode 100644 index 0000000000..24335d93ad --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +int tint_int_dot(ivec3 a, ivec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_f1312c() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + int res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_f1312c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_int_dot(ivec3 a, ivec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_f1312c() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + int res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_f1312c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_int_dot(ivec3 a, ivec3 b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} + +void dot_f1312c() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + int res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_f1312c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl new file mode 100644 index 0000000000..4707e730cd --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot3(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; +} +void dot_f1312c() { + int3 arg_0 = int3(1); + int3 arg_1 = int3(1); + int res = tint_dot3(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_f1312c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_f1312c(); + return; +} + +kernel void compute_main() { + dot_f1312c(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a72f60f93 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_f1312c "dot_f1312c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_f1312c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %19 + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %res = OpVariable %_ptr_Function_int Function %36 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %22 = OpLoad %v3int %arg_0 + %23 = OpLoad %v3int %arg_1 + %24 = OpCompositeExtract %int %22 0 + %25 = OpCompositeExtract %int %23 0 + %26 = OpIMul %int %24 %25 + %27 = OpCompositeExtract %int %22 1 + %28 = OpCompositeExtract %int %23 1 + %29 = OpIMul %int %27 %28 + %30 = OpIAdd %int %26 %29 + %31 = OpCompositeExtract %int %22 2 + %32 = OpCompositeExtract %int %23 2 + %33 = OpIMul %int %31 %32 + %21 = OpIAdd %int %30 %33 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %dot_f1312c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %dot_f1312c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %49 = OpLabel + %50 = OpFunctionCall %void %dot_f1312c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl new file mode 100644 index 0000000000..e260aa688b --- /dev/null +++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_f1312c() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var res : i32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_f1312c(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_f1312c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_f1312c(); +} diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl new file mode 100644 index 0000000000..ceb4c521f8 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dot(vec<2, i32>, vec<2, i32>) -> i32 +fn dot_fc5f7c() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var res: i32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_fc5f7c(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_fc5f7c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_fc5f7c(); +} diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..14ede0a827 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void dot_fc5f7c() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + int res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_fc5f7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_fc5f7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_fc5f7c(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..14ede0a827 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void dot_fc5f7c() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + int res = dot(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot_fc5f7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot_fc5f7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot_fc5f7c(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl new file mode 100644 index 0000000000..b83abe5caa --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +int tint_int_dot(ivec2 a, ivec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_fc5f7c() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + int res = tint_int_dot(arg_0, arg_1); +} + +vec4 vertex_main() { + dot_fc5f7c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_int_dot(ivec2 a, ivec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_fc5f7c() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + int res = tint_int_dot(arg_0, arg_1); +} + +void fragment_main() { + dot_fc5f7c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_int_dot(ivec2 a, ivec2 b) { + return a[0]*b[0] + a[1]*b[1]; +} + +void dot_fc5f7c() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + int res = tint_int_dot(arg_0, arg_1); +} + +void compute_main() { + dot_fc5f7c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl new file mode 100644 index 0000000000..e3da2a2663 --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; + +template +T tint_dot2(vec a, vec b) { + return a[0]*b[0] + a[1]*b[1]; +} +void dot_fc5f7c() { + int2 arg_0 = int2(1); + int2 arg_1 = int2(1); + int res = tint_dot2(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + dot_fc5f7c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + dot_fc5f7c(); + return; +} + +kernel void compute_main() { + dot_fc5f7c(); + return; +} + diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm new file mode 100644 index 0000000000..8406ecc1ae --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot_fc5f7c "dot_fc5f7c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpConstantNull %int + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %dot_fc5f7c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %19 + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %res = OpVariable %_ptr_Function_int Function %32 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %22 = OpLoad %v2int %arg_0 + %23 = OpLoad %v2int %arg_1 + %24 = OpCompositeExtract %int %22 0 + %25 = OpCompositeExtract %int %23 0 + %26 = OpIMul %int %24 %25 + %27 = OpCompositeExtract %int %22 1 + %28 = OpCompositeExtract %int %23 1 + %29 = OpIMul %int %27 %28 + %21 = OpIAdd %int %26 %29 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %dot_fc5f7c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %dot_fc5f7c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %dot_fc5f7c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl new file mode 100644 index 0000000000..8778c2320f --- /dev/null +++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn dot_fc5f7c() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var res : i32 = dot(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot_fc5f7c(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot_fc5f7c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot_fc5f7c(); +} diff --git a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl new file mode 100644 index 0000000000..73fd181ff1 --- /dev/null +++ b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable chromium_experimental_dp4a; + +// fn dot4I8Packed(u32, u32) -> i32 +fn dot4I8Packed_881e62() { + var arg_0 = 1u; + var arg_1 = 1u; + var res: i32 = dot4I8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} diff --git a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..16555b7136 --- /dev/null +++ b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +int tint_dot4I8Packed(uint param_0, uint param_1) { + int accumulator = 0; + return dot4add_i8packed(param_0, param_1, accumulator); +} + +void dot4I8Packed_881e62() { + uint arg_0 = 1u; + uint arg_1 = 1u; + int res = tint_dot4I8Packed(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot4I8Packed_881e62(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot4I8Packed_881e62(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot4I8Packed_881e62(); + return; +} diff --git a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..733f9e5858 --- /dev/null +++ b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.fxc.hlsl @@ -0,0 +1,42 @@ +SKIP: FAILED + +int tint_dot4I8Packed(uint param_0, uint param_1) { + int accumulator = 0; + return dot4add_i8packed(param_0, param_1, accumulator); +} + +void dot4I8Packed_881e62() { + uint arg_0 = 1u; + uint arg_1 = 1u; + int res = tint_dot4I8Packed(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot4I8Packed_881e62(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot4I8Packed_881e62(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot4I8Packed_881e62(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A416C12830(3,10-56): error X3004: undeclared identifier 'dot4add_i8packed' + diff --git a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.glsl new file mode 100644 index 0000000000..04bfe47de5 --- /dev/null +++ b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.glsl @@ -0,0 +1,80 @@ +SKIP: FAILED + + +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : i32 = dot4I8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} + +Failed to generate: error: Unknown builtin method: dot4I8Packed + +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : i32 = dot4I8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} + +Failed to generate: error: Unknown builtin method: dot4I8Packed + +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : i32 = dot4I8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} + +Failed to generate: error: Unknown builtin method: dot4I8Packed diff --git a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.msl b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.msl new file mode 100644 index 0000000000..21893221c5 --- /dev/null +++ b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.msl @@ -0,0 +1,28 @@ +SKIP: FAILED + + +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : i32 = dot4I8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} + +Failed to generate: error: Unknown import method: dot4I8Packed diff --git a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.spvasm new file mode 100644 index 0000000000..075bf9bf0f --- /dev/null +++ b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability DotProduct + OpCapability DotProductInput4x8BitPacked + OpExtension "SPV_KHR_integer_dot_product" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot4I8Packed_881e62 "dot4I8Packed_881e62" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%dot4I8Packed_881e62 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_int Function %25 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + %21 = OpLoad %uint %arg_0 + %22 = OpLoad %uint %arg_1 + %19 = OpSDot %int %21 %22 PackedVectorFormat4x8Bit + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %dot4I8Packed_881e62 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %dot4I8Packed_881e62 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %dot4I8Packed_881e62 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba5f0a753f --- /dev/null +++ b/test/tint/builtins/gen/var/dot4I8Packed/881e62.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable chromium_experimental_dp4a; + +fn dot4I8Packed_881e62() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : i32 = dot4I8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4I8Packed_881e62(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4I8Packed_881e62(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4I8Packed_881e62(); +} diff --git a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl new file mode 100644 index 0000000000..8c90e74c5e --- /dev/null +++ b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable chromium_experimental_dp4a; + +// fn dot4U8Packed(u32, u32) -> u32 +fn dot4U8Packed_fbed7b() { + var arg_0 = 1u; + var arg_1 = 1u; + var res: u32 = dot4U8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} diff --git a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b66aa9fbb --- /dev/null +++ b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +uint tint_dot4U8Packed(uint param_0, uint param_1) { + uint accumulator = 0u; + return dot4add_u8packed(param_0, param_1, accumulator); +} + +void dot4U8Packed_fbed7b() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = tint_dot4U8Packed(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot4U8Packed_fbed7b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot4U8Packed_fbed7b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot4U8Packed_fbed7b(); + return; +} diff --git a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fef2404566 --- /dev/null +++ b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.fxc.hlsl @@ -0,0 +1,42 @@ +SKIP: FAILED + +uint tint_dot4U8Packed(uint param_0, uint param_1) { + uint accumulator = 0u; + return dot4add_u8packed(param_0, param_1, accumulator); +} + +void dot4U8Packed_fbed7b() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = tint_dot4U8Packed(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + dot4U8Packed_fbed7b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + dot4U8Packed_fbed7b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + dot4U8Packed_fbed7b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000191724B1570(3,10-56): error X3004: undeclared identifier 'dot4add_u8packed' + diff --git a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.glsl new file mode 100644 index 0000000000..2a5cb1e690 --- /dev/null +++ b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.glsl @@ -0,0 +1,80 @@ +SKIP: FAILED + + +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : u32 = dot4U8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} + +Failed to generate: error: Unknown builtin method: dot4U8Packed + +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : u32 = dot4U8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} + +Failed to generate: error: Unknown builtin method: dot4U8Packed + +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : u32 = dot4U8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} + +Failed to generate: error: Unknown builtin method: dot4U8Packed diff --git a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.msl b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.msl new file mode 100644 index 0000000000..4ca1d46994 --- /dev/null +++ b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.msl @@ -0,0 +1,28 @@ +SKIP: FAILED + + +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : u32 = dot4U8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} + +Failed to generate: error: Unknown import method: dot4U8Packed diff --git a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0a4f48f0e --- /dev/null +++ b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability DotProduct + OpCapability DotProductInput4x8BitPacked + OpExtension "SPV_KHR_integer_dot_product" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %dot4U8Packed_fbed7b "dot4U8Packed_fbed7b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%dot4U8Packed_fbed7b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + %20 = OpLoad %uint %arg_0 + %21 = OpLoad %uint %arg_1 + %19 = OpUDot %uint %20 %21 PackedVectorFormat4x8Bit + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %dot4U8Packed_fbed7b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %dot4U8Packed_fbed7b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %dot4U8Packed_fbed7b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc9897f162 --- /dev/null +++ b/test/tint/builtins/gen/var/dot4U8Packed/fbed7b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable chromium_experimental_dp4a; + +fn dot4U8Packed_fbed7b() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : u32 = dot4U8Packed(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + dot4U8Packed_fbed7b(); + return vec4(); +} + +@fragment +fn fragment_main() { + dot4U8Packed_fbed7b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + dot4U8Packed_fbed7b(); +} diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl new file mode 100644 index 0000000000..18f94300d0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(vec<3, f32>) -> vec<3, f32> +fn dpdx_0763f7() { + var arg_0 = vec3(1.f); + var res: vec3 = dpdx(arg_0); +} + +@fragment +fn fragment_main() { + dpdx_0763f7(); +} diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b7fe53c99 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdx_0763f7() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddx(arg_0); +} + +void fragment_main() { + dpdx_0763f7(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b7fe53c99 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdx_0763f7() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddx(arg_0); +} + +void fragment_main() { + dpdx_0763f7(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl new file mode 100644 index 0000000000..2bfea7d55a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdx_0763f7() { + vec3 arg_0 = vec3(1.0f); + vec3 res = dFdx(arg_0); +} + +void fragment_main() { + dpdx_0763f7(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl new file mode 100644 index 0000000000..2cacfcd985 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdx_0763f7() { + float3 arg_0 = float3(1.0f); + float3 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdx_0763f7(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..cdcc699b65 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_0763f7 "dpdx_0763f7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %11 = OpConstantNull %v3float +%dpdx_0763f7 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %11 + %res = OpVariable %_ptr_Function_v3float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v3float %arg_0 + %12 = OpDPdx %v3float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdx_0763f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..9fff661a0e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdx_0763f7() { + var arg_0 = vec3(1.0f); + var res : vec3 = dpdx(arg_0); +} + +@fragment +fn fragment_main() { + dpdx_0763f7(); +} diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl new file mode 100644 index 0000000000..b767d36e07 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(vec<2, f32>) -> vec<2, f32> +fn dpdx_99edb1() { + var arg_0 = vec2(1.f); + var res: vec2 = dpdx(arg_0); +} + +@fragment +fn fragment_main() { + dpdx_99edb1(); +} diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d63d96b6ce --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdx_99edb1() { + float2 arg_0 = (1.0f).xx; + float2 res = ddx(arg_0); +} + +void fragment_main() { + dpdx_99edb1(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d63d96b6ce --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdx_99edb1() { + float2 arg_0 = (1.0f).xx; + float2 res = ddx(arg_0); +} + +void fragment_main() { + dpdx_99edb1(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl new file mode 100644 index 0000000000..4229e0f8f0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdx_99edb1() { + vec2 arg_0 = vec2(1.0f); + vec2 res = dFdx(arg_0); +} + +void fragment_main() { + dpdx_99edb1(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl new file mode 100644 index 0000000000..e48ad6b638 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdx_99edb1() { + float2 arg_0 = float2(1.0f); + float2 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdx_99edb1(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm new file mode 100644 index 0000000000..8740414a03 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_99edb1 "dpdx_99edb1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpConstantNull %v2float +%dpdx_99edb1 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %11 + %res = OpVariable %_ptr_Function_v2float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v2float %arg_0 + %12 = OpDPdx %v2float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdx_99edb1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe4f948d97 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdx_99edb1() { + var arg_0 = vec2(1.0f); + var res : vec2 = dpdx(arg_0); +} + +@fragment +fn fragment_main() { + dpdx_99edb1(); +} diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl new file mode 100644 index 0000000000..ef6722809a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(vec<4, f32>) -> vec<4, f32> +fn dpdx_c487fa() { + var arg_0 = vec4(1.f); + var res: vec4 = dpdx(arg_0); +} + +@fragment +fn fragment_main() { + dpdx_c487fa(); +} diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..00894e79fd --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdx_c487fa() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddx(arg_0); +} + +void fragment_main() { + dpdx_c487fa(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..00894e79fd --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdx_c487fa() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddx(arg_0); +} + +void fragment_main() { + dpdx_c487fa(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl new file mode 100644 index 0000000000..6991ecbb48 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdx_c487fa() { + vec4 arg_0 = vec4(1.0f); + vec4 res = dFdx(arg_0); +} + +void fragment_main() { + dpdx_c487fa(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl new file mode 100644 index 0000000000..b6af68cf2e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdx_c487fa() { + float4 arg_0 = float4(1.0f); + float4 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdx_c487fa(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm new file mode 100644 index 0000000000..7eb298015f --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_c487fa "dpdx_c487fa" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %11 = OpConstantNull %v4float +%dpdx_c487fa = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %11 + %res = OpVariable %_ptr_Function_v4float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v4float %arg_0 + %12 = OpDPdx %v4float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdx_c487fa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl new file mode 100644 index 0000000000..24dead72b2 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdx_c487fa() { + var arg_0 = vec4(1.0f); + var res : vec4 = dpdx(arg_0); +} + +@fragment +fn fragment_main() { + dpdx_c487fa(); +} diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl new file mode 100644 index 0000000000..b9ba1ccb6c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdx(f32) -> f32 +fn dpdx_e263de() { + var arg_0 = 1.f; + var res: f32 = dpdx(arg_0); +} + +@fragment +fn fragment_main() { + dpdx_e263de(); +} diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef8ef066b6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdx_e263de() { + float arg_0 = 1.0f; + float res = ddx(arg_0); +} + +void fragment_main() { + dpdx_e263de(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ef8ef066b6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdx_e263de() { + float arg_0 = 1.0f; + float res = ddx(arg_0); +} + +void fragment_main() { + dpdx_e263de(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl new file mode 100644 index 0000000000..7debcdb80c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdx_e263de() { + float arg_0 = 1.0f; + float res = dFdx(arg_0); +} + +void fragment_main() { + dpdx_e263de(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl new file mode 100644 index 0000000000..81401f4ab3 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdx_e263de() { + float arg_0 = 1.0f; + float res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdx_e263de(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm new file mode 100644 index 0000000000..8346357d0a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdx_e263de "dpdx_e263de" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdx_e263de = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdx %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdx_e263de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl new file mode 100644 index 0000000000..803a3d32b0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdx_e263de() { + var arg_0 = 1.0f; + var res : f32 = dpdx(arg_0); +} + +@fragment +fn fragment_main() { + dpdx_e263de(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl new file mode 100644 index 0000000000..cada76b19b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(f32) -> f32 +fn dpdxCoarse_029152() { + var arg_0 = 1.f; + var res: f32 = dpdxCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdxCoarse_029152(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e2ee49789e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_029152() { + float arg_0 = 1.0f; + float res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_029152(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e2ee49789e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_029152() { + float arg_0 = 1.0f; + float res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_029152(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl new file mode 100644 index 0000000000..22fcf55f6c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_029152() { + float arg_0 = 1.0f; + float res = dFdx(arg_0); +} + +void fragment_main() { + dpdxCoarse_029152(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl new file mode 100644 index 0000000000..82e95e8eb5 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxCoarse_029152() { + float arg_0 = 1.0f; + float res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxCoarse_029152(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm new file mode 100644 index 0000000000..c61f62b88b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_029152 "dpdxCoarse_029152" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdxCoarse_029152 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdxCoarse %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxCoarse_029152 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl new file mode 100644 index 0000000000..ff88b0e1af --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxCoarse_029152() { + var arg_0 = 1.0f; + var res : f32 = dpdxCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdxCoarse_029152(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl new file mode 100644 index 0000000000..a6178ac513 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(vec<2, f32>) -> vec<2, f32> +fn dpdxCoarse_9581cf() { + var arg_0 = vec2(1.f); + var res: vec2 = dpdxCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdxCoarse_9581cf(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b9505f1f19 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_9581cf() { + float2 arg_0 = (1.0f).xx; + float2 res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_9581cf(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b9505f1f19 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_9581cf() { + float2 arg_0 = (1.0f).xx; + float2 res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_9581cf(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl new file mode 100644 index 0000000000..47d14b3f7c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_9581cf() { + vec2 arg_0 = vec2(1.0f); + vec2 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxCoarse_9581cf(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl new file mode 100644 index 0000000000..334f231714 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxCoarse_9581cf() { + float2 arg_0 = float2(1.0f); + float2 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxCoarse_9581cf(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4a4163e70 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_9581cf "dpdxCoarse_9581cf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpConstantNull %v2float +%dpdxCoarse_9581cf = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %11 + %res = OpVariable %_ptr_Function_v2float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v2float %arg_0 + %12 = OpDPdxCoarse %v2float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdxCoarse_9581cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..75c0d80ed1 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxCoarse_9581cf() { + var arg_0 = vec2(1.0f); + var res : vec2 = dpdxCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdxCoarse_9581cf(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl new file mode 100644 index 0000000000..61110d78a7 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(vec<4, f32>) -> vec<4, f32> +fn dpdxCoarse_c28641() { + var arg_0 = vec4(1.f); + var res: vec4 = dpdxCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdxCoarse_c28641(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1000e18133 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_c28641() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_c28641(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1000e18133 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_c28641() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_c28641(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl new file mode 100644 index 0000000000..08f05dd04c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_c28641() { + vec4 arg_0 = vec4(1.0f); + vec4 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxCoarse_c28641(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl new file mode 100644 index 0000000000..84e40cdd97 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxCoarse_c28641() { + float4 arg_0 = float4(1.0f); + float4 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxCoarse_c28641(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm new file mode 100644 index 0000000000..49d4ad65d4 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_c28641 "dpdxCoarse_c28641" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %11 = OpConstantNull %v4float +%dpdxCoarse_c28641 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %11 + %res = OpVariable %_ptr_Function_v4float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v4float %arg_0 + %12 = OpDPdxCoarse %v4float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdxCoarse_c28641 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cfb2262ff --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxCoarse_c28641() { + var arg_0 = vec4(1.0f); + var res : vec4 = dpdxCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdxCoarse_c28641(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl new file mode 100644 index 0000000000..81434d9979 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxCoarse(vec<3, f32>) -> vec<3, f32> +fn dpdxCoarse_f64d7b() { + var arg_0 = vec3(1.f); + var res: vec3 = dpdxCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdxCoarse_f64d7b(); +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe12d76fed --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_f64d7b() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_f64d7b(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe12d76fed --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdxCoarse_f64d7b() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddx_coarse(arg_0); +} + +void fragment_main() { + dpdxCoarse_f64d7b(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl new file mode 100644 index 0000000000..bef053eab3 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxCoarse_f64d7b() { + vec3 arg_0 = vec3(1.0f); + vec3 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxCoarse_f64d7b(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl new file mode 100644 index 0000000000..ef8fc2766a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxCoarse_f64d7b() { + float3 arg_0 = float3(1.0f); + float3 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxCoarse_f64d7b(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm new file mode 100644 index 0000000000..79a6c0916b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxCoarse_f64d7b "dpdxCoarse_f64d7b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %11 = OpConstantNull %v3float +%dpdxCoarse_f64d7b = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %11 + %res = OpVariable %_ptr_Function_v3float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v3float %arg_0 + %12 = OpDPdxCoarse %v3float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdxCoarse_f64d7b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl new file mode 100644 index 0000000000..b11e280993 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxCoarse_f64d7b() { + var arg_0 = vec3(1.0f); + var res : vec3 = dpdxCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdxCoarse_f64d7b(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl new file mode 100644 index 0000000000..957fd017c7 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(vec<4, f32>) -> vec<4, f32> +fn dpdxFine_8c5069() { + var arg_0 = vec4(1.f); + var res: vec4 = dpdxFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdxFine_8c5069(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d95c391163 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_8c5069() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_8c5069(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d95c391163 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_8c5069() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_8c5069(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl new file mode 100644 index 0000000000..023e3be131 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxFine_8c5069() { + vec4 arg_0 = vec4(1.0f); + vec4 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxFine_8c5069(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl new file mode 100644 index 0000000000..80b43a1169 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxFine_8c5069() { + float4 arg_0 = float4(1.0f); + float4 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxFine_8c5069(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm new file mode 100644 index 0000000000..2936feec63 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_8c5069 "dpdxFine_8c5069" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %11 = OpConstantNull %v4float +%dpdxFine_8c5069 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %11 + %res = OpVariable %_ptr_Function_v4float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v4float %arg_0 + %12 = OpDPdxFine %v4float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdxFine_8c5069 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl new file mode 100644 index 0000000000..4d3515826d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxFine_8c5069() { + var arg_0 = vec4(1.0f); + var res : vec4 = dpdxFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdxFine_8c5069(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl new file mode 100644 index 0000000000..f7793e247e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(vec<2, f32>) -> vec<2, f32> +fn dpdxFine_9631de() { + var arg_0 = vec2(1.f); + var res: vec2 = dpdxFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdxFine_9631de(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..271d791341 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_9631de() { + float2 arg_0 = (1.0f).xx; + float2 res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_9631de(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..271d791341 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_9631de() { + float2 arg_0 = (1.0f).xx; + float2 res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_9631de(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl new file mode 100644 index 0000000000..53e7fb4285 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxFine_9631de() { + vec2 arg_0 = vec2(1.0f); + vec2 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxFine_9631de(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl new file mode 100644 index 0000000000..93b0911cdc --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxFine_9631de() { + float2 arg_0 = float2(1.0f); + float2 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxFine_9631de(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm new file mode 100644 index 0000000000..dd97e0c95b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_9631de "dpdxFine_9631de" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpConstantNull %v2float +%dpdxFine_9631de = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %11 + %res = OpVariable %_ptr_Function_v2float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v2float %arg_0 + %12 = OpDPdxFine %v2float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdxFine_9631de + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6a892f494 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxFine_9631de() { + var arg_0 = vec2(1.0f); + var res : vec2 = dpdxFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdxFine_9631de(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl new file mode 100644 index 0000000000..db3483602c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(f32) -> f32 +fn dpdxFine_f401a2() { + var arg_0 = 1.f; + var res: f32 = dpdxFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdxFine_f401a2(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c1d8c4fa6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_f401a2() { + float arg_0 = 1.0f; + float res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_f401a2(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4c1d8c4fa6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_f401a2() { + float arg_0 = 1.0f; + float res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_f401a2(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl new file mode 100644 index 0000000000..5840665b14 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxFine_f401a2() { + float arg_0 = 1.0f; + float res = dFdx(arg_0); +} + +void fragment_main() { + dpdxFine_f401a2(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl new file mode 100644 index 0000000000..6d33b99f78 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxFine_f401a2() { + float arg_0 = 1.0f; + float res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxFine_f401a2(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm new file mode 100644 index 0000000000..3806d733b4 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_f401a2 "dpdxFine_f401a2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdxFine_f401a2 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdxFine %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdxFine_f401a2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl new file mode 100644 index 0000000000..b0842b2249 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxFine_f401a2() { + var arg_0 = 1.0f; + var res : f32 = dpdxFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdxFine_f401a2(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl new file mode 100644 index 0000000000..3f6cf3545d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdxFine(vec<3, f32>) -> vec<3, f32> +fn dpdxFine_f92fb6() { + var arg_0 = vec3(1.f); + var res: vec3 = dpdxFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdxFine_f92fb6(); +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..60d0b82c0d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_f92fb6() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_f92fb6(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60d0b82c0d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdxFine_f92fb6() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddx_fine(arg_0); +} + +void fragment_main() { + dpdxFine_f92fb6(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl new file mode 100644 index 0000000000..4dab9bcf11 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdxFine_f92fb6() { + vec3 arg_0 = vec3(1.0f); + vec3 res = dFdx(arg_0); +} + +void fragment_main() { + dpdxFine_f92fb6(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl new file mode 100644 index 0000000000..654abac1f9 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdxFine_f92fb6() { + float3 arg_0 = float3(1.0f); + float3 res = dfdx(arg_0); +} + +fragment void fragment_main() { + dpdxFine_f92fb6(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm new file mode 100644 index 0000000000..dee390d8da --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdxFine_f92fb6 "dpdxFine_f92fb6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %11 = OpConstantNull %v3float +%dpdxFine_f92fb6 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %11 + %res = OpVariable %_ptr_Function_v3float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v3float %arg_0 + %12 = OpDPdxFine %v3float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdxFine_f92fb6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c4849b542 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdxFine_f92fb6() { + var arg_0 = vec3(1.0f); + var res : vec3 = dpdxFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdxFine_f92fb6(); +} diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl new file mode 100644 index 0000000000..80c7dffedd --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(vec<4, f32>) -> vec<4, f32> +fn dpdy_699a05() { + var arg_0 = vec4(1.f); + var res: vec4 = dpdy(arg_0); +} + +@fragment +fn fragment_main() { + dpdy_699a05(); +} diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8ba18415b0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdy_699a05() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddy(arg_0); +} + +void fragment_main() { + dpdy_699a05(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8ba18415b0 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdy_699a05() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddy(arg_0); +} + +void fragment_main() { + dpdy_699a05(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl new file mode 100644 index 0000000000..dcb3024974 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdy_699a05() { + vec4 arg_0 = vec4(1.0f); + vec4 res = dFdy(arg_0); +} + +void fragment_main() { + dpdy_699a05(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl new file mode 100644 index 0000000000..3ac1a30786 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdy_699a05() { + float4 arg_0 = float4(1.0f); + float4 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdy_699a05(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm new file mode 100644 index 0000000000..66f394627f --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_699a05 "dpdy_699a05" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %11 = OpConstantNull %v4float +%dpdy_699a05 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %11 + %res = OpVariable %_ptr_Function_v4float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v4float %arg_0 + %12 = OpDPdy %v4float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdy_699a05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl new file mode 100644 index 0000000000..a64ad342c7 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdy_699a05() { + var arg_0 = vec4(1.0f); + var res : vec4 = dpdy(arg_0); +} + +@fragment +fn fragment_main() { + dpdy_699a05(); +} diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl new file mode 100644 index 0000000000..763b514d35 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(f32) -> f32 +fn dpdy_7f8d84() { + var arg_0 = 1.f; + var res: f32 = dpdy(arg_0); +} + +@fragment +fn fragment_main() { + dpdy_7f8d84(); +} diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..566c64bb64 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdy_7f8d84() { + float arg_0 = 1.0f; + float res = ddy(arg_0); +} + +void fragment_main() { + dpdy_7f8d84(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..566c64bb64 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdy_7f8d84() { + float arg_0 = 1.0f; + float res = ddy(arg_0); +} + +void fragment_main() { + dpdy_7f8d84(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl new file mode 100644 index 0000000000..298a7951b1 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdy_7f8d84() { + float arg_0 = 1.0f; + float res = dFdy(arg_0); +} + +void fragment_main() { + dpdy_7f8d84(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl new file mode 100644 index 0000000000..5651aa7755 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdy_7f8d84() { + float arg_0 = 1.0f; + float res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdy_7f8d84(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm new file mode 100644 index 0000000000..4480737a10 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_7f8d84 "dpdy_7f8d84" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdy_7f8d84 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdy %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdy_7f8d84 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl new file mode 100644 index 0000000000..b538f0fd87 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdy_7f8d84() { + var arg_0 = 1.0f; + var res : f32 = dpdy(arg_0); +} + +@fragment +fn fragment_main() { + dpdy_7f8d84(); +} diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl new file mode 100644 index 0000000000..ddfd0bee5b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(vec<2, f32>) -> vec<2, f32> +fn dpdy_a8b56e() { + var arg_0 = vec2(1.f); + var res: vec2 = dpdy(arg_0); +} + +@fragment +fn fragment_main() { + dpdy_a8b56e(); +} diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fb0a29984a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdy_a8b56e() { + float2 arg_0 = (1.0f).xx; + float2 res = ddy(arg_0); +} + +void fragment_main() { + dpdy_a8b56e(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fb0a29984a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdy_a8b56e() { + float2 arg_0 = (1.0f).xx; + float2 res = ddy(arg_0); +} + +void fragment_main() { + dpdy_a8b56e(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl new file mode 100644 index 0000000000..5078de0766 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdy_a8b56e() { + vec2 arg_0 = vec2(1.0f); + vec2 res = dFdy(arg_0); +} + +void fragment_main() { + dpdy_a8b56e(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl new file mode 100644 index 0000000000..0fdd9382cb --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdy_a8b56e() { + float2 arg_0 = float2(1.0f); + float2 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdy_a8b56e(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm new file mode 100644 index 0000000000..62f7bb3152 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_a8b56e "dpdy_a8b56e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpConstantNull %v2float +%dpdy_a8b56e = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %11 + %res = OpVariable %_ptr_Function_v2float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v2float %arg_0 + %12 = OpDPdy %v2float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdy_a8b56e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl new file mode 100644 index 0000000000..772a595de4 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdy_a8b56e() { + var arg_0 = vec2(1.0f); + var res : vec2 = dpdy(arg_0); +} + +@fragment +fn fragment_main() { + dpdy_a8b56e(); +} diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl new file mode 100644 index 0000000000..41123f003e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdy(vec<3, f32>) -> vec<3, f32> +fn dpdy_feb40f() { + var arg_0 = vec3(1.f); + var res: vec3 = dpdy(arg_0); +} + +@fragment +fn fragment_main() { + dpdy_feb40f(); +} diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..595c0afd0a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdy_feb40f() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddy(arg_0); +} + +void fragment_main() { + dpdy_feb40f(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..595c0afd0a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdy_feb40f() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddy(arg_0); +} + +void fragment_main() { + dpdy_feb40f(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl new file mode 100644 index 0000000000..e7ff0a6b2b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdy_feb40f() { + vec3 arg_0 = vec3(1.0f); + vec3 res = dFdy(arg_0); +} + +void fragment_main() { + dpdy_feb40f(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl new file mode 100644 index 0000000000..786b30e932 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdy_feb40f() { + float3 arg_0 = float3(1.0f); + float3 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdy_feb40f(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm new file mode 100644 index 0000000000..19026075eb --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdy_feb40f "dpdy_feb40f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %11 = OpConstantNull %v3float +%dpdy_feb40f = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %11 + %res = OpVariable %_ptr_Function_v3float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v3float %arg_0 + %12 = OpDPdy %v3float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdy_feb40f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl new file mode 100644 index 0000000000..f1d84707b4 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdy_feb40f() { + var arg_0 = vec3(1.0f); + var res : vec3 = dpdy(arg_0); +} + +@fragment +fn fragment_main() { + dpdy_feb40f(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl new file mode 100644 index 0000000000..2b8f103e38 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(vec<2, f32>) -> vec<2, f32> +fn dpdyCoarse_3e1ab4() { + var arg_0 = vec2(1.f); + var res: vec2 = dpdyCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdyCoarse_3e1ab4(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c5a7e6f68e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_3e1ab4() { + float2 arg_0 = (1.0f).xx; + float2 res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_3e1ab4(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c5a7e6f68e --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_3e1ab4() { + float2 arg_0 = (1.0f).xx; + float2 res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_3e1ab4(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl new file mode 100644 index 0000000000..0565b5be2d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_3e1ab4() { + vec2 arg_0 = vec2(1.0f); + vec2 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyCoarse_3e1ab4(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl new file mode 100644 index 0000000000..b36ba5dc17 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyCoarse_3e1ab4() { + float2 arg_0 = float2(1.0f); + float2 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyCoarse_3e1ab4(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm new file mode 100644 index 0000000000..55909a53fc --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_3e1ab4 "dpdyCoarse_3e1ab4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpConstantNull %v2float +%dpdyCoarse_3e1ab4 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %11 + %res = OpVariable %_ptr_Function_v2float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v2float %arg_0 + %12 = OpDPdyCoarse %v2float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdyCoarse_3e1ab4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl new file mode 100644 index 0000000000..4d32658093 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyCoarse_3e1ab4() { + var arg_0 = vec2(1.0f); + var res : vec2 = dpdyCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdyCoarse_3e1ab4(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl new file mode 100644 index 0000000000..e9aa22bc0b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(vec<4, f32>) -> vec<4, f32> +fn dpdyCoarse_445d24() { + var arg_0 = vec4(1.f); + var res: vec4 = dpdyCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdyCoarse_445d24(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e12a367c98 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_445d24() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_445d24(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e12a367c98 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_445d24() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_445d24(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl new file mode 100644 index 0000000000..bf231ff228 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_445d24() { + vec4 arg_0 = vec4(1.0f); + vec4 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyCoarse_445d24(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl new file mode 100644 index 0000000000..9e132ba210 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyCoarse_445d24() { + float4 arg_0 = float4(1.0f); + float4 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyCoarse_445d24(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm new file mode 100644 index 0000000000..5a787f3232 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_445d24 "dpdyCoarse_445d24" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %11 = OpConstantNull %v4float +%dpdyCoarse_445d24 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %11 + %res = OpVariable %_ptr_Function_v4float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v4float %arg_0 + %12 = OpDPdyCoarse %v4float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdyCoarse_445d24 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl new file mode 100644 index 0000000000..58965af6cc --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyCoarse_445d24() { + var arg_0 = vec4(1.0f); + var res : vec4 = dpdyCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdyCoarse_445d24(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl new file mode 100644 index 0000000000..28f7bf3457 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(f32) -> f32 +fn dpdyCoarse_870a7e() { + var arg_0 = 1.f; + var res: f32 = dpdyCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdyCoarse_870a7e(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c5c4e1e399 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_870a7e() { + float arg_0 = 1.0f; + float res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_870a7e(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c5c4e1e399 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_870a7e() { + float arg_0 = 1.0f; + float res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_870a7e(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl new file mode 100644 index 0000000000..a0e2cd77b6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_870a7e() { + float arg_0 = 1.0f; + float res = dFdy(arg_0); +} + +void fragment_main() { + dpdyCoarse_870a7e(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl new file mode 100644 index 0000000000..88e086cf00 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyCoarse_870a7e() { + float arg_0 = 1.0f; + float res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyCoarse_870a7e(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0bc403fdc --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_870a7e "dpdyCoarse_870a7e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdyCoarse_870a7e = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdyCoarse %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyCoarse_870a7e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl new file mode 100644 index 0000000000..cbb4a1fa4f --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyCoarse_870a7e() { + var arg_0 = 1.0f; + var res : f32 = dpdyCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdyCoarse_870a7e(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl new file mode 100644 index 0000000000..2c94cc3df2 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyCoarse(vec<3, f32>) -> vec<3, f32> +fn dpdyCoarse_ae1873() { + var arg_0 = vec3(1.f); + var res: vec3 = dpdyCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdyCoarse_ae1873(); +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7fa49bfa47 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_ae1873() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_ae1873(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7fa49bfa47 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdyCoarse_ae1873() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddy_coarse(arg_0); +} + +void fragment_main() { + dpdyCoarse_ae1873(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl new file mode 100644 index 0000000000..76f66f649c --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyCoarse_ae1873() { + vec3 arg_0 = vec3(1.0f); + vec3 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyCoarse_ae1873(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl new file mode 100644 index 0000000000..439b32e537 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyCoarse_ae1873() { + float3 arg_0 = float3(1.0f); + float3 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyCoarse_ae1873(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b409ff456 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyCoarse_ae1873 "dpdyCoarse_ae1873" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %11 = OpConstantNull %v3float +%dpdyCoarse_ae1873 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %11 + %res = OpVariable %_ptr_Function_v3float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v3float %arg_0 + %12 = OpDPdyCoarse %v3float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdyCoarse_ae1873 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl new file mode 100644 index 0000000000..8a04b99f49 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyCoarse_ae1873() { + var arg_0 = vec3(1.0f); + var res : vec3 = dpdyCoarse(arg_0); +} + +@fragment +fn fragment_main() { + dpdyCoarse_ae1873(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl new file mode 100644 index 0000000000..6f6df2f82b --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(vec<3, f32>) -> vec<3, f32> +fn dpdyFine_1fb7ab() { + var arg_0 = vec3(1.f); + var res: vec3 = dpdyFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdyFine_1fb7ab(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e5d56fa8fd --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_1fb7ab() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_1fb7ab(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5d56fa8fd --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_1fb7ab() { + float3 arg_0 = (1.0f).xxx; + float3 res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_1fb7ab(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl new file mode 100644 index 0000000000..6717b929f9 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyFine_1fb7ab() { + vec3 arg_0 = vec3(1.0f); + vec3 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyFine_1fb7ab(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl new file mode 100644 index 0000000000..f4c0101bea --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyFine_1fb7ab() { + float3 arg_0 = float3(1.0f); + float3 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyFine_1fb7ab(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm new file mode 100644 index 0000000000..3891288ecf --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_1fb7ab "dpdyFine_1fb7ab" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %11 = OpConstantNull %v3float +%dpdyFine_1fb7ab = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %11 + %res = OpVariable %_ptr_Function_v3float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v3float %arg_0 + %12 = OpDPdyFine %v3float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdyFine_1fb7ab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..09af0c8fb8 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyFine_1fb7ab() { + var arg_0 = vec3(1.0f); + var res : vec3 = dpdyFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdyFine_1fb7ab(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl new file mode 100644 index 0000000000..3ae95b3649 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(f32) -> f32 +fn dpdyFine_6eb673() { + var arg_0 = 1.f; + var res: f32 = dpdyFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdyFine_6eb673(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ddec2103fb --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_6eb673() { + float arg_0 = 1.0f; + float res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_6eb673(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ddec2103fb --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_6eb673() { + float arg_0 = 1.0f; + float res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_6eb673(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl new file mode 100644 index 0000000000..1762ecfe3d --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyFine_6eb673() { + float arg_0 = 1.0f; + float res = dFdy(arg_0); +} + +void fragment_main() { + dpdyFine_6eb673(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl new file mode 100644 index 0000000000..57adf6b9e8 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyFine_6eb673() { + float arg_0 = 1.0f; + float res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyFine_6eb673(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm new file mode 100644 index 0000000000..cac131b00a --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_6eb673 "dpdyFine_6eb673" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%dpdyFine_6eb673 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpDPdyFine %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %dpdyFine_6eb673 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl new file mode 100644 index 0000000000..2eeb69c0ea --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyFine_6eb673() { + var arg_0 = 1.0f; + var res : f32 = dpdyFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdyFine_6eb673(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl new file mode 100644 index 0000000000..07f1dd2bd6 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(vec<4, f32>) -> vec<4, f32> +fn dpdyFine_d0a648() { + var arg_0 = vec4(1.f); + var res: vec4 = dpdyFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdyFine_d0a648(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a0519e8310 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_d0a648() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_d0a648(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a0519e8310 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_d0a648() { + float4 arg_0 = (1.0f).xxxx; + float4 res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_d0a648(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl new file mode 100644 index 0000000000..a641baa3dd --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyFine_d0a648() { + vec4 arg_0 = vec4(1.0f); + vec4 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyFine_d0a648(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl new file mode 100644 index 0000000000..ff8d7275ea --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyFine_d0a648() { + float4 arg_0 = float4(1.0f); + float4 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyFine_d0a648(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm new file mode 100644 index 0000000000..c5aff59c75 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_d0a648 "dpdyFine_d0a648" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %11 = OpConstantNull %v4float +%dpdyFine_d0a648 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %11 + %res = OpVariable %_ptr_Function_v4float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v4float %arg_0 + %12 = OpDPdyFine %v4float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdyFine_d0a648 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl new file mode 100644 index 0000000000..5587c56b03 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyFine_d0a648() { + var arg_0 = vec4(1.0f); + var res : vec4 = dpdyFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdyFine_d0a648(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl new file mode 100644 index 0000000000..1cf896d385 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn dpdyFine(vec<2, f32>) -> vec<2, f32> +fn dpdyFine_df33aa() { + var arg_0 = vec2(1.f); + var res: vec2 = dpdyFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdyFine_df33aa(); +} diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..22b13fde50 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_df33aa() { + float2 arg_0 = (1.0f).xx; + float2 res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_df33aa(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..22b13fde50 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void dpdyFine_df33aa() { + float2 arg_0 = (1.0f).xx; + float2 res = ddy_fine(arg_0); +} + +void fragment_main() { + dpdyFine_df33aa(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl new file mode 100644 index 0000000000..fc4c4abcf5 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void dpdyFine_df33aa() { + vec2 arg_0 = vec2(1.0f); + vec2 res = dFdy(arg_0); +} + +void fragment_main() { + dpdyFine_df33aa(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl new file mode 100644 index 0000000000..936c707af9 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void dpdyFine_df33aa() { + float2 arg_0 = float2(1.0f); + float2 res = dfdy(arg_0); +} + +fragment void fragment_main() { + dpdyFine_df33aa(); + return; +} + diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm new file mode 100644 index 0000000000..eefe1d13e1 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %dpdyFine_df33aa "dpdyFine_df33aa" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpConstantNull %v2float +%dpdyFine_df33aa = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %11 + %res = OpVariable %_ptr_Function_v2float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v2float %arg_0 + %12 = OpDPdyFine %v2float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %dpdyFine_df33aa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl new file mode 100644 index 0000000000..17ff43f064 --- /dev/null +++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn dpdyFine_df33aa() { + var arg_0 = vec2(1.0f); + var res : vec2 = dpdyFine(arg_0); +} + +@fragment +fn fragment_main() { + dpdyFine_df33aa(); +} diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl new file mode 100644 index 0000000000..8d7893e5fa --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(vec<4, f32>) -> vec<4, f32> +fn exp_0f70eb() { + var arg_0 = vec4(1.f); + var res: vec4 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_0f70eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_0f70eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_0f70eb(); +} diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8aaf090cf6 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_0f70eb() { + float4 arg_0 = (1.0f).xxxx; + float4 res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_0f70eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_0f70eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_0f70eb(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8aaf090cf6 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void exp_0f70eb() { + float4 arg_0 = (1.0f).xxxx; + float4 res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_0f70eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_0f70eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_0f70eb(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl new file mode 100644 index 0000000000..23953b3270 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp_0f70eb() { + vec4 arg_0 = vec4(1.0f); + vec4 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_0f70eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_0f70eb() { + vec4 arg_0 = vec4(1.0f); + vec4 res = exp(arg_0); +} + +void fragment_main() { + exp_0f70eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_0f70eb() { + vec4 arg_0 = vec4(1.0f); + vec4 res = exp(arg_0); +} + +void compute_main() { + exp_0f70eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl new file mode 100644 index 0000000000..533177b619 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_0f70eb() { + float4 arg_0 = float4(1.0f); + float4 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_0f70eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_0f70eb(); + return; +} + +kernel void compute_main() { + exp_0f70eb(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..9ce96e74d0 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_0f70eb "exp_0f70eb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %exp_0f70eb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Exp %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp_0f70eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp_0f70eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp_0f70eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..25f940408b --- /dev/null +++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp_0f70eb() { + var arg_0 = vec4(1.0f); + var res : vec4 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_0f70eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_0f70eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_0f70eb(); +} diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl b/test/tint/builtins/gen/var/exp/13806d.wgsl new file mode 100644 index 0000000000..6c3ccde44c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<3, f16>) -> vec<3, f16> +fn exp_13806d() { + var arg_0 = vec3(f16()); + var res: vec3 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_13806d(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_13806d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_13806d(); +} diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eb7e5a8895 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_13806d() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_13806d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_13806d(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ebcc65f90c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp_13806d() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_13806d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_13806d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002270EAE6F40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002270EAE6F40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.glsl new file mode 100644 index 0000000000..72d5c8a5d6 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_13806d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_13806d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_13806d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp(arg_0); +} + +void fragment_main() { + exp_13806d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_13806d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp(arg_0); +} + +void compute_main() { + exp_13806d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.msl new file mode 100644 index 0000000000..891a68a9d4 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_13806d() { + half3 arg_0 = half3(0.0h); + half3 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_13806d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_13806d(); + return; +} + +kernel void compute_main() { + exp_13806d(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.spvasm new file mode 100644 index 0000000000..90c05375c8 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_13806d "exp_13806d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_13806d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Exp %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp_13806d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_13806d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp_13806d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.wgsl new file mode 100644 index 0000000000..044b03aa4c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/13806d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp_13806d() { + var arg_0 = vec3(f16()); + var res : vec3 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_13806d(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_13806d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_13806d(); +} diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl new file mode 100644 index 0000000000..16cfa21964 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(vec<2, f32>) -> vec<2, f32> +fn exp_1951e7() { + var arg_0 = vec2(1.f); + var res: vec2 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_1951e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_1951e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_1951e7(); +} diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab01f7f8b9 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_1951e7() { + float2 arg_0 = (1.0f).xx; + float2 res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_1951e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_1951e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_1951e7(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ab01f7f8b9 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void exp_1951e7() { + float2 arg_0 = (1.0f).xx; + float2 res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_1951e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_1951e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_1951e7(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl new file mode 100644 index 0000000000..535a3078e7 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp_1951e7() { + vec2 arg_0 = vec2(1.0f); + vec2 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_1951e7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_1951e7() { + vec2 arg_0 = vec2(1.0f); + vec2 res = exp(arg_0); +} + +void fragment_main() { + exp_1951e7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_1951e7() { + vec2 arg_0 = vec2(1.0f); + vec2 res = exp(arg_0); +} + +void compute_main() { + exp_1951e7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl new file mode 100644 index 0000000000..0f7df5c08c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_1951e7() { + float2 arg_0 = float2(1.0f); + float2 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_1951e7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_1951e7(); + return; +} + +kernel void compute_main() { + exp_1951e7(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f4a41e7bf --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_1951e7 "exp_1951e7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float + %exp_1951e7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Exp %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %exp_1951e7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_1951e7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp_1951e7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl new file mode 100644 index 0000000000..a72dfbf93e --- /dev/null +++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp_1951e7() { + var arg_0 = vec2(1.0f); + var res : vec2 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_1951e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_1951e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_1951e7(); +} diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl new file mode 100644 index 0000000000..15f67b1b9c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<2, f16>) -> vec<2, f16> +fn exp_2e08e2() { + var arg_0 = vec2(f16()); + var res: vec2 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_2e08e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_2e08e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_2e08e2(); +} diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e9d14139a7 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_2e08e2() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_2e08e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_2e08e2(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f2359df39 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp_2e08e2() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_2e08e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_2e08e2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000256E60D6F90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000256E60D6F90(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.glsl new file mode 100644 index 0000000000..f53e9a7ffc --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_2e08e2() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_2e08e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_2e08e2() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp(arg_0); +} + +void fragment_main() { + exp_2e08e2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_2e08e2() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp(arg_0); +} + +void compute_main() { + exp_2e08e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.msl new file mode 100644 index 0000000000..cc293279fa --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_2e08e2() { + half2 arg_0 = half2(0.0h); + half2 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_2e08e2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_2e08e2(); + return; +} + +kernel void compute_main() { + exp_2e08e2(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.spvasm new file mode 100644 index 0000000000..6c662e04b1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_2e08e2 "exp_2e08e2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_2e08e2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Exp %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp_2e08e2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_2e08e2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp_2e08e2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..c041e1a63c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/2e08e2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp_2e08e2() { + var arg_0 = vec2(f16()); + var res : vec2 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_2e08e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_2e08e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_2e08e2(); +} diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl b/test/tint/builtins/gen/var/exp/611a87.wgsl new file mode 100644 index 0000000000..86e69d5924 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(vec<4, f16>) -> vec<4, f16> +fn exp_611a87() { + var arg_0 = vec4(f16()); + var res: vec4 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_611a87(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_611a87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_611a87(); +} diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b99c789f3 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_611a87() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_611a87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_611a87(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..30ab783003 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp_611a87() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_611a87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_611a87(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002855D95D650(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002855D95D650(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.glsl new file mode 100644 index 0000000000..ed49b7cd38 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_611a87() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_611a87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_611a87() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp(arg_0); +} + +void fragment_main() { + exp_611a87(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_611a87() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp(arg_0); +} + +void compute_main() { + exp_611a87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.msl new file mode 100644 index 0000000000..dd3d353de5 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_611a87() { + half4 arg_0 = half4(0.0h); + half4 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_611a87(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_611a87(); + return; +} + +kernel void compute_main() { + exp_611a87(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.spvasm new file mode 100644 index 0000000000..17d3daf799 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_611a87 "exp_611a87" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_611a87 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Exp %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp_611a87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_611a87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp_611a87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.wgsl new file mode 100644 index 0000000000..d208a93878 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/611a87.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp_611a87() { + var arg_0 = vec4(f16()); + var res : vec4 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_611a87(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_611a87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_611a87(); +} diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl new file mode 100644 index 0000000000..96ccf91c00 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(f32) -> f32 +fn exp_771fd2() { + var arg_0 = 1.f; + var res: f32 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_771fd2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_771fd2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_771fd2(); +} diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..578cedb5ce --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_771fd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_771fd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_771fd2(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..578cedb5ce --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_771fd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_771fd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_771fd2(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl new file mode 100644 index 0000000000..3c874f6191 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +vec4 vertex_main() { + exp_771fd2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +void fragment_main() { + exp_771fd2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +void compute_main() { + exp_771fd2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl new file mode 100644 index 0000000000..0e3c093e4f --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_771fd2() { + float arg_0 = 1.0f; + float res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_771fd2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_771fd2(); + return; +} + +kernel void compute_main() { + exp_771fd2(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm new file mode 100644 index 0000000000..83173a6e58 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_771fd2 "exp_771fd2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %exp_771fd2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Exp %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp_771fd2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp_771fd2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_771fd2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl new file mode 100644 index 0000000000..0e9c5f19d9 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp_771fd2() { + var arg_0 = 1.0f; + var res : f32 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_771fd2(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_771fd2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_771fd2(); +} diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl new file mode 100644 index 0000000000..e28c16ab4b --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp(f16) -> f16 +fn exp_c18fe9() { + var arg_0 = f16(); + var res: f16 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_c18fe9(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_c18fe9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_c18fe9(); +} diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c137c9c5c1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_c18fe9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_c18fe9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_c18fe9(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad6ebcad4c --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp_c18fe9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_c18fe9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_c18fe9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AE86501340(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AE86501340(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.glsl new file mode 100644 index 0000000000..73b9ba13eb --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_c18fe9() { + float16_t arg_0 = 0.0hf; + float16_t res = exp(arg_0); +} + +vec4 vertex_main() { + exp_c18fe9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp_c18fe9() { + float16_t arg_0 = 0.0hf; + float16_t res = exp(arg_0); +} + +void fragment_main() { + exp_c18fe9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp_c18fe9() { + float16_t arg_0 = 0.0hf; + float16_t res = exp(arg_0); +} + +void compute_main() { + exp_c18fe9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.msl new file mode 100644 index 0000000000..6bcb8c64e2 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_c18fe9() { + half arg_0 = 0.0h; + half res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_c18fe9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_c18fe9(); + return; +} + +kernel void compute_main() { + exp_c18fe9(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.spvasm new file mode 100644 index 0000000000..8575fb843a --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_c18fe9 "exp_c18fe9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %exp_c18fe9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Exp %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp_c18fe9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp_c18fe9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %exp_c18fe9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.wgsl new file mode 100644 index 0000000000..3daf44c664 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/c18fe9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp_c18fe9() { + var arg_0 = f16(); + var res : f16 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_c18fe9(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_c18fe9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_c18fe9(); +} diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl b/test/tint/builtins/gen/var/exp/d98450.wgsl new file mode 100644 index 0000000000..69ef9d9e1b --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp(vec<3, f32>) -> vec<3, f32> +fn exp_d98450() { + var arg_0 = vec3(1.f); + var res: vec3 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_d98450(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_d98450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_d98450(); +} diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1b70b1807b --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp_d98450() { + float3 arg_0 = (1.0f).xxx; + float3 res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_d98450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_d98450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_d98450(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1b70b1807b --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void exp_d98450() { + float3 arg_0 = (1.0f).xxx; + float3 res = exp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp_d98450(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp_d98450(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp_d98450(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl new file mode 100644 index 0000000000..0ebf07ec24 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp_d98450() { + vec3 arg_0 = vec3(1.0f); + vec3 res = exp(arg_0); +} + +vec4 vertex_main() { + exp_d98450(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp_d98450() { + vec3 arg_0 = vec3(1.0f); + vec3 res = exp(arg_0); +} + +void fragment_main() { + exp_d98450(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp_d98450() { + vec3 arg_0 = vec3(1.0f); + vec3 res = exp(arg_0); +} + +void compute_main() { + exp_d98450(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl new file mode 100644 index 0000000000..30443738dd --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp_d98450() { + float3 arg_0 = float3(1.0f); + float3 res = exp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp_d98450(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp_d98450(); + return; +} + +kernel void compute_main() { + exp_d98450(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm new file mode 100644 index 0000000000..12759c0497 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp_d98450 "exp_d98450" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float + %exp_d98450 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Exp %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %exp_d98450 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp_d98450 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp_d98450 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl new file mode 100644 index 0000000000..b37eb28f79 --- /dev/null +++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp_d98450() { + var arg_0 = vec3(1.0f); + var res : vec3 = exp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp_d98450(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp_d98450(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp_d98450(); +} diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl new file mode 100644 index 0000000000..5a42f5b46f --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<2, f16>) -> vec<2, f16> +fn exp2_151a4c() { + var arg_0 = vec2(f16()); + var res: vec2 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_151a4c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_151a4c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_151a4c(); +} diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d1633f9d7e --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_151a4c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_151a4c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_151a4c(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aaf1ee1fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp2_151a4c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_151a4c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_151a4c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027F32148910(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027F32148910(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.glsl new file mode 100644 index 0000000000..a3e4e9381f --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_151a4c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_151a4c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_151a4c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp2(arg_0); +} + +void fragment_main() { + exp2_151a4c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_151a4c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = exp2(arg_0); +} + +void compute_main() { + exp2_151a4c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.msl new file mode 100644 index 0000000000..26b057cd5e --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_151a4c() { + half2 arg_0 = half2(0.0h); + half2 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_151a4c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_151a4c(); + return; +} + +kernel void compute_main() { + exp2_151a4c(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.spvasm new file mode 100644 index 0000000000..7db1e64e22 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_151a4c "exp2_151a4c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_151a4c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Exp2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp2_151a4c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_151a4c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp2_151a4c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.wgsl new file mode 100644 index 0000000000..33f0c7f702 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/151a4c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp2_151a4c() { + var arg_0 = vec2(f16()); + var res : vec2 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_151a4c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_151a4c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_151a4c(); +} diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl new file mode 100644 index 0000000000..f42be18b7a --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(vec<3, f32>) -> vec<3, f32> +fn exp2_1f8680() { + var arg_0 = vec3(1.f); + var res: vec3 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_1f8680(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_1f8680(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_1f8680(); +} diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ecfc371d95 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_1f8680() { + float3 arg_0 = (1.0f).xxx; + float3 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_1f8680(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_1f8680(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_1f8680(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ecfc371d95 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void exp2_1f8680() { + float3 arg_0 = (1.0f).xxx; + float3 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_1f8680(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_1f8680(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_1f8680(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl new file mode 100644 index 0000000000..b22fadacd1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp2_1f8680() { + vec3 arg_0 = vec3(1.0f); + vec3 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_1f8680(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_1f8680() { + vec3 arg_0 = vec3(1.0f); + vec3 res = exp2(arg_0); +} + +void fragment_main() { + exp2_1f8680(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_1f8680() { + vec3 arg_0 = vec3(1.0f); + vec3 res = exp2(arg_0); +} + +void compute_main() { + exp2_1f8680(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl new file mode 100644 index 0000000000..06fee444ff --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_1f8680() { + float3 arg_0 = float3(1.0f); + float3 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_1f8680(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_1f8680(); + return; +} + +kernel void compute_main() { + exp2_1f8680(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm new file mode 100644 index 0000000000..7101abcae1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_1f8680 "exp2_1f8680" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%exp2_1f8680 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Exp2 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %exp2_1f8680 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_1f8680 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp2_1f8680 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl new file mode 100644 index 0000000000..409bfde884 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp2_1f8680() { + var arg_0 = vec3(1.0f); + var res : vec3 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_1f8680(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_1f8680(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_1f8680(); +} diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl b/test/tint/builtins/gen/var/exp2/751377.wgsl new file mode 100644 index 0000000000..9f15ce7925 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<3, f16>) -> vec<3, f16> +fn exp2_751377() { + var arg_0 = vec3(f16()); + var res: vec3 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_751377(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_751377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_751377(); +} diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6251d2770 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_751377() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_751377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_751377(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3284d6f4c4 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp2_751377() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_751377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_751377(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028B810B9560(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028B810B9560(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.glsl new file mode 100644 index 0000000000..93e0de7380 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_751377() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_751377(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_751377() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp2(arg_0); +} + +void fragment_main() { + exp2_751377(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_751377() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = exp2(arg_0); +} + +void compute_main() { + exp2_751377(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.msl new file mode 100644 index 0000000000..ee675e3f78 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_751377() { + half3 arg_0 = half3(0.0h); + half3 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_751377(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_751377(); + return; +} + +kernel void compute_main() { + exp2_751377(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6a7c0c133 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_751377 "exp2_751377" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_751377 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Exp2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp2_751377 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_751377 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp2_751377 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.wgsl new file mode 100644 index 0000000000..54d18f084c --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/751377.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp2_751377() { + var arg_0 = vec3(f16()); + var res : vec3 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_751377(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_751377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_751377(); +} diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl new file mode 100644 index 0000000000..5f58818410 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(vec<4, f32>) -> vec<4, f32> +fn exp2_a9d0a7() { + var arg_0 = vec4(1.f); + var res: vec4 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_a9d0a7(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_a9d0a7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_a9d0a7(); +} diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18f11f22c3 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_a9d0a7() { + float4 arg_0 = (1.0f).xxxx; + float4 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_a9d0a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_a9d0a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_a9d0a7(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..18f11f22c3 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void exp2_a9d0a7() { + float4 arg_0 = (1.0f).xxxx; + float4 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_a9d0a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_a9d0a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_a9d0a7(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl new file mode 100644 index 0000000000..3fbbba0332 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp2_a9d0a7() { + vec4 arg_0 = vec4(1.0f); + vec4 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_a9d0a7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_a9d0a7() { + vec4 arg_0 = vec4(1.0f); + vec4 res = exp2(arg_0); +} + +void fragment_main() { + exp2_a9d0a7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_a9d0a7() { + vec4 arg_0 = vec4(1.0f); + vec4 res = exp2(arg_0); +} + +void compute_main() { + exp2_a9d0a7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl new file mode 100644 index 0000000000..c0807017f2 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_a9d0a7() { + float4 arg_0 = float4(1.0f); + float4 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_a9d0a7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_a9d0a7(); + return; +} + +kernel void compute_main() { + exp2_a9d0a7(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm new file mode 100644 index 0000000000..35fb41a304 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_a9d0a7 "exp2_a9d0a7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%exp2_a9d0a7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Exp2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp2_a9d0a7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %exp2_a9d0a7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %exp2_a9d0a7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl new file mode 100644 index 0000000000..f10b3ddc43 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp2_a9d0a7() { + var arg_0 = vec4(1.0f); + var res : vec4 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_a9d0a7(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_a9d0a7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_a9d0a7(); +} diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl new file mode 100644 index 0000000000..25f4d91ebe --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(f16) -> f16 +fn exp2_b408e4() { + var arg_0 = f16(); + var res: f16 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_b408e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_b408e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_b408e4(); +} diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1da83c0d56 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_b408e4() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_b408e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_b408e4(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dad65555bb --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp2_b408e4() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_b408e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_b408e4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CEFA5170D0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CEFA5170D0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.glsl new file mode 100644 index 0000000000..978b7dfe08 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_b408e4() { + float16_t arg_0 = 0.0hf; + float16_t res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_b408e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_b408e4() { + float16_t arg_0 = 0.0hf; + float16_t res = exp2(arg_0); +} + +void fragment_main() { + exp2_b408e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_b408e4() { + float16_t arg_0 = 0.0hf; + float16_t res = exp2(arg_0); +} + +void compute_main() { + exp2_b408e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.msl new file mode 100644 index 0000000000..3e0cbb24fa --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_b408e4() { + half arg_0 = 0.0h; + half res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_b408e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_b408e4(); + return; +} + +kernel void compute_main() { + exp2_b408e4(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.spvasm new file mode 100644 index 0000000000..c387afbc58 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_b408e4 "exp2_b408e4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_b408e4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Exp2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %exp2_b408e4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %exp2_b408e4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %exp2_b408e4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..0772e03956 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/b408e4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp2_b408e4() { + var arg_0 = f16(); + var res : f16 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_b408e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_b408e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_b408e4(); +} diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl new file mode 100644 index 0000000000..55df1ef702 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(vec<2, f32>) -> vec<2, f32> +fn exp2_d6777c() { + var arg_0 = vec2(1.f); + var res: vec2 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_d6777c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_d6777c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_d6777c(); +} diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d70fa34015 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_d6777c() { + float2 arg_0 = (1.0f).xx; + float2 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_d6777c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_d6777c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_d6777c(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d70fa34015 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void exp2_d6777c() { + float2 arg_0 = (1.0f).xx; + float2 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_d6777c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_d6777c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_d6777c(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl new file mode 100644 index 0000000000..2367875f5c --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp2_d6777c() { + vec2 arg_0 = vec2(1.0f); + vec2 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_d6777c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_d6777c() { + vec2 arg_0 = vec2(1.0f); + vec2 res = exp2(arg_0); +} + +void fragment_main() { + exp2_d6777c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_d6777c() { + vec2 arg_0 = vec2(1.0f); + vec2 res = exp2(arg_0); +} + +void compute_main() { + exp2_d6777c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl new file mode 100644 index 0000000000..93d9152e1f --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_d6777c() { + float2 arg_0 = float2(1.0f); + float2 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_d6777c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_d6777c(); + return; +} + +kernel void compute_main() { + exp2_d6777c(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm new file mode 100644 index 0000000000..f2c0806e6f --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_d6777c "exp2_d6777c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%exp2_d6777c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Exp2 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %exp2_d6777c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_d6777c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp2_d6777c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl new file mode 100644 index 0000000000..11b0aa5f38 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp2_d6777c() { + var arg_0 = vec2(1.0f); + var res : vec2 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_d6777c(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_d6777c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_d6777c(); +} diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl new file mode 100644 index 0000000000..2b8e608948 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn exp2(f32) -> f32 +fn exp2_dea523() { + var arg_0 = 1.f; + var res: f32 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_dea523(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_dea523(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_dea523(); +} diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d276db9823 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_dea523(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_dea523(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_dea523(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d276db9823 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_dea523(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_dea523(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_dea523(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl new file mode 100644 index 0000000000..0599396c99 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_dea523(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +void fragment_main() { + exp2_dea523(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +void compute_main() { + exp2_dea523(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl new file mode 100644 index 0000000000..38c0029036 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_dea523() { + float arg_0 = 1.0f; + float res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_dea523(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_dea523(); + return; +} + +kernel void compute_main() { + exp2_dea523(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm new file mode 100644 index 0000000000..b350153939 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_dea523 "exp2_dea523" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%exp2_dea523 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Exp2 %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %exp2_dea523 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %exp2_dea523 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_dea523 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl new file mode 100644 index 0000000000..b696280a62 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn exp2_dea523() { + var arg_0 = 1.0f; + var res : f32 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_dea523(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_dea523(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_dea523(); +} diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl new file mode 100644 index 0000000000..f9fc7cbd63 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn exp2(vec<4, f16>) -> vec<4, f16> +fn exp2_ffa827() { + var arg_0 = vec4(f16()); + var res: vec4 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_ffa827(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_ffa827(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_ffa827(); +} diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..199b7a8b8a --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void exp2_ffa827() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_ffa827(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_ffa827(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87e544c06b --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void exp2_ffa827() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = exp2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + exp2_ffa827(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + exp2_ffa827(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E8001E07F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E8001E07F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.glsl new file mode 100644 index 0000000000..eacdcb00e1 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_ffa827() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp2(arg_0); +} + +vec4 vertex_main() { + exp2_ffa827(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void exp2_ffa827() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp2(arg_0); +} + +void fragment_main() { + exp2_ffa827(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void exp2_ffa827() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = exp2(arg_0); +} + +void compute_main() { + exp2_ffa827(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.msl new file mode 100644 index 0000000000..0dc6782398 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void exp2_ffa827() { + half4 arg_0 = half4(0.0h); + half4 res = exp2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + exp2_ffa827(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + exp2_ffa827(); + return; +} + +kernel void compute_main() { + exp2_ffa827(); + return; +} + diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.spvasm new file mode 100644 index 0000000000..d343ed6620 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %exp2_ffa827 "exp2_ffa827" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%exp2_ffa827 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Exp2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %exp2_ffa827 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %exp2_ffa827 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %exp2_ffa827 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc00537444 --- /dev/null +++ b/test/tint/builtins/gen/var/exp2/ffa827.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn exp2_ffa827() { + var arg_0 = vec4(f16()); + var res : vec4 = exp2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + exp2_ffa827(); + return vec4(); +} + +@fragment +fn fragment_main() { + exp2_ffa827(); +} + +@compute @workgroup_size(1) +fn compute_main() { + exp2_ffa827(); +} diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl new file mode 100644 index 0000000000..b7a2827981 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<3, u32>, u32, u32) -> vec<3, u32> +fn extractBits_12b197() { + var arg_0 = vec3(1u); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec3 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_12b197(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_12b197(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_12b197(); +} diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d5d112534f --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_12b197() { + uint3 arg_0 = (1u).xxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_12b197(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_12b197(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_12b197(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5d112534f --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_12b197() { + uint3 arg_0 = (1u).xxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_12b197(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_12b197(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_12b197(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl new file mode 100644 index 0000000000..6372fc9474 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_12b197() { + uvec3 arg_0 = uvec3(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_12b197(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_12b197() { + uvec3 arg_0 = uvec3(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_12b197(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_12b197() { + uvec3 arg_0 = uvec3(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_12b197(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl new file mode 100644 index 0000000000..9ef807a344 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +uint3 tint_extract_bits(uint3 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_12b197() { + uint3 arg_0 = uint3(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uint3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_12b197(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_12b197(); + return; +} + +kernel void compute_main() { + extractBits_12b197(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm new file mode 100644 index 0000000000..2038b02b54 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_12b197 "extractBits_12b197" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %29 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %32 = OpConstantNull %v3uint +%_ptr_Function_uint = OpTypePointer Function %uint + %35 = OpConstantNull %uint + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldUExtract %v3uint %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_12b197 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %32 + %arg_1 = OpVariable %_ptr_Function_uint Function %35 + %arg_2 = OpVariable %_ptr_Function_uint Function %35 + %res = OpVariable %_ptr_Function_v3uint Function %32 + OpStore %arg_0 %29 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %38 = OpLoad %v3uint %arg_0 + %39 = OpLoad %uint %arg_1 + %40 = OpLoad %uint %arg_2 + %37 = OpFunctionCall %v3uint %tint_extract_bits %38 %39 %40 + OpStore %res %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %extractBits_12b197 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %51 = OpLabel + %52 = OpFunctionCall %void %extractBits_12b197 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %54 = OpLabel + %55 = OpFunctionCall %void %extractBits_12b197 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl new file mode 100644 index 0000000000..8728cc5cf5 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_12b197() { + var arg_0 = vec3(1u); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec3 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_12b197(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_12b197(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_12b197(); +} diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl new file mode 100644 index 0000000000..212395a8a8 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(i32, u32, u32) -> i32 +fn extractBits_249874() { + var arg_0 = 1; + var arg_1 = 1u; + var arg_2 = 1u; + var res: i32 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_249874(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_249874(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_249874(); +} diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bd0e6fe47e --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +int tint_extract_bits(int v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_249874(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_249874(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_249874(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bd0e6fe47e --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +int tint_extract_bits(int v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_249874(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_249874(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_249874(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl new file mode 100644 index 0000000000..1c7b829a1f --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +int tint_extract_bits(int v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_249874(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_extract_bits(int v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_249874(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_extract_bits(int v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_249874(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl new file mode 100644 index 0000000000..fe768fe5d1 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +int tint_extract_bits(int v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_249874() { + int arg_0 = 1; + uint arg_1 = 1u; + uint arg_2 = 1u; + int res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_249874(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_249874(); + return; +} + +kernel void compute_main() { + extractBits_249874(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm new file mode 100644 index 0000000000..8b8dc87c52 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_249874 "extractBits_249874" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %int %int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %35 = OpConstantNull %uint + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %int None %9 + %v = OpFunctionParameter %int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldSExtract %int %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_249874 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %31 + %arg_1 = OpVariable %_ptr_Function_uint Function %35 + %arg_2 = OpVariable %_ptr_Function_uint Function %35 + %res = OpVariable %_ptr_Function_int Function %31 + OpStore %arg_0 %int_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %38 = OpLoad %int %arg_0 + %39 = OpLoad %uint %arg_1 + %40 = OpLoad %uint %arg_2 + %37 = OpFunctionCall %int %tint_extract_bits %38 %39 %40 + OpStore %res %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %extractBits_249874 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %51 = OpLabel + %52 = OpFunctionCall %void %extractBits_249874 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %54 = OpLabel + %55 = OpFunctionCall %void %extractBits_249874 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl new file mode 100644 index 0000000000..129115695c --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_249874() { + var arg_0 = 1; + var arg_1 = 1u; + var arg_2 = 1u; + var res : i32 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_249874(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_249874(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_249874(); +} diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl new file mode 100644 index 0000000000..42f17f60f0 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<4, u32>, u32, u32) -> vec<4, u32> +fn extractBits_631377() { + var arg_0 = vec4(1u); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec4 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_631377(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_631377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_631377(); +} diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f5832cab7 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +uint4 tint_extract_bits(uint4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_631377() { + uint4 arg_0 = (1u).xxxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_631377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_631377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_631377(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5f5832cab7 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +uint4 tint_extract_bits(uint4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_631377() { + uint4 arg_0 = (1u).xxxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_631377(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_631377(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_631377(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl new file mode 100644 index 0000000000..e8221d989b --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_631377() { + uvec4 arg_0 = uvec4(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_631377(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_631377() { + uvec4 arg_0 = uvec4(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_631377(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_631377() { + uvec4 arg_0 = uvec4(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_631377(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl new file mode 100644 index 0000000000..e641ab58f8 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +uint4 tint_extract_bits(uint4 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_631377() { + uint4 arg_0 = uint4(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uint4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_631377(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_631377(); + return; +} + +kernel void compute_main() { + extractBits_631377(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm new file mode 100644 index 0000000000..531a1c3d53 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_631377 "extractBits_631377" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %29 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %32 = OpConstantNull %v4uint +%_ptr_Function_uint = OpTypePointer Function %uint + %35 = OpConstantNull %uint + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldUExtract %v4uint %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_631377 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %32 + %arg_1 = OpVariable %_ptr_Function_uint Function %35 + %arg_2 = OpVariable %_ptr_Function_uint Function %35 + %res = OpVariable %_ptr_Function_v4uint Function %32 + OpStore %arg_0 %29 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %38 = OpLoad %v4uint %arg_0 + %39 = OpLoad %uint %arg_1 + %40 = OpLoad %uint %arg_2 + %37 = OpFunctionCall %v4uint %tint_extract_bits %38 %39 %40 + OpStore %res %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %extractBits_631377 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %51 = OpLabel + %52 = OpFunctionCall %void %extractBits_631377 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %54 = OpLabel + %55 = OpFunctionCall %void %extractBits_631377 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3136d97f3 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_631377() { + var arg_0 = vec4(1u); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec4 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_631377(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_631377(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_631377(); +} diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl new file mode 100644 index 0000000000..38ee048ed0 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<2, i32>, u32, u32) -> vec<2, i32> +fn extractBits_a99a8d() { + var arg_0 = vec2(1); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec2 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_a99a8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_a99a8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_a99a8d(); +} diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4971f269a4 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +int2 tint_extract_bits(int2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_a99a8d() { + int2 arg_0 = (1).xx; + uint arg_1 = 1u; + uint arg_2 = 1u; + int2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_a99a8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_a99a8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_a99a8d(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4971f269a4 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +int2 tint_extract_bits(int2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_a99a8d() { + int2 arg_0 = (1).xx; + uint arg_1 = 1u; + uint arg_2 = 1u; + int2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_a99a8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_a99a8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_a99a8d(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl new file mode 100644 index 0000000000..9cfb4f29ab --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_a99a8d() { + ivec2 arg_0 = ivec2(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_a99a8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_a99a8d() { + ivec2 arg_0 = ivec2(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_a99a8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_a99a8d() { + ivec2 arg_0 = ivec2(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_a99a8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl new file mode 100644 index 0000000000..3aa841b003 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +int2 tint_extract_bits(int2 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_a99a8d() { + int2 arg_0 = int2(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + int2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_a99a8d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_a99a8d(); + return; +} + +kernel void compute_main() { + extractBits_a99a8d(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm new file mode 100644 index 0000000000..135fd673b9 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_a99a8d "extractBits_a99a8d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v2int %v2int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %30 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %33 = OpConstantNull %v2int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldSExtract %v2int %v %18 %24 + OpReturnValue %23 + OpFunctionEnd +%extractBits_a99a8d = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %33 + %arg_1 = OpVariable %_ptr_Function_uint Function %37 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_v2int Function %33 + OpStore %arg_0 %30 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %40 = OpLoad %v2int %arg_0 + %41 = OpLoad %uint %arg_1 + %42 = OpLoad %uint %arg_2 + %39 = OpFunctionCall %v2int %tint_extract_bits %40 %41 %42 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %extractBits_a99a8d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %53 = OpLabel + %54 = OpFunctionCall %void %extractBits_a99a8d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %56 = OpLabel + %57 = OpFunctionCall %void %extractBits_a99a8d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..1f814034b9 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_a99a8d() { + var arg_0 = vec2(1); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec2 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_a99a8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_a99a8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_a99a8d(); +} diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl new file mode 100644 index 0000000000..37cf6e5ff0 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(u32, u32, u32) -> u32 +fn extractBits_ce81f8() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var res: u32 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_ce81f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_ce81f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_ce81f8(); +} diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..944fe861ff --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +uint tint_extract_bits(uint v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_ce81f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_ce81f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_ce81f8(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..944fe861ff --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +uint tint_extract_bits(uint v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << shl) >> shr); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_ce81f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_ce81f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_ce81f8(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl new file mode 100644 index 0000000000..117480c023 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +uint tint_extract_bits(uint v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_ce81f8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_extract_bits(uint v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_ce81f8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_extract_bits(uint v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_ce81f8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl new file mode 100644 index 0000000000..60f0680fb3 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +uint tint_extract_bits(uint v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_ce81f8() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_ce81f8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_ce81f8(); + return; +} + +kernel void compute_main() { + extractBits_ce81f8(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd13e5e704 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_ce81f8 "extractBits_ce81f8" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %30 = OpConstantNull %uint + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %15 = OpLabel + %16 = OpExtInst %uint %17 UMin %offset %uint_32 + %20 = OpIAdd %uint %16 %count + %19 = OpExtInst %uint %17 UMin %uint_32 %20 + %22 = OpISub %uint %19 %16 + %21 = OpBitFieldUExtract %uint %v %16 %22 + OpReturnValue %21 + OpFunctionEnd +%extractBits_ce81f8 = OpFunction %void None %23 + %26 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %30 + %arg_1 = OpVariable %_ptr_Function_uint Function %30 + %arg_2 = OpVariable %_ptr_Function_uint Function %30 + %res = OpVariable %_ptr_Function_uint Function %30 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %34 = OpLoad %uint %arg_0 + %35 = OpLoad %uint %arg_1 + %36 = OpLoad %uint %arg_2 + %33 = OpFunctionCall %uint %tint_extract_bits %34 %35 %36 + OpStore %res %33 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %extractBits_ce81f8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %23 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %23 + %47 = OpLabel + %48 = OpFunctionCall %void %extractBits_ce81f8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %23 + %50 = OpLabel + %51 = OpFunctionCall %void %extractBits_ce81f8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl new file mode 100644 index 0000000000..c99ed1a5ad --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_ce81f8() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var res : u32 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_ce81f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_ce81f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_ce81f8(); +} diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl new file mode 100644 index 0000000000..0b3153d933 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<3, i32>, u32, u32) -> vec<3, i32> +fn extractBits_e04f5d() { + var arg_0 = vec3(1); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec3 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_e04f5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_e04f5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_e04f5d(); +} diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c45a595f13 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +int3 tint_extract_bits(int3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_e04f5d() { + int3 arg_0 = (1).xxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + int3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_e04f5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_e04f5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_e04f5d(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c45a595f13 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +int3 tint_extract_bits(int3 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint3((shl).xxx)) >> uint3((shr).xxx)); +} + +void extractBits_e04f5d() { + int3 arg_0 = (1).xxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + int3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_e04f5d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_e04f5d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_e04f5d(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl new file mode 100644 index 0000000000..66f53085a6 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_e04f5d() { + ivec3 arg_0 = ivec3(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_e04f5d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_e04f5d() { + ivec3 arg_0 = ivec3(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_e04f5d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_e04f5d() { + ivec3 arg_0 = ivec3(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_e04f5d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl new file mode 100644 index 0000000000..bbc7412b42 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +int3 tint_extract_bits(int3 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_e04f5d() { + int3 arg_0 = int3(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + int3 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_e04f5d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_e04f5d(); + return; +} + +kernel void compute_main() { + extractBits_e04f5d(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm new file mode 100644 index 0000000000..3efe52e030 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_e04f5d "extractBits_e04f5d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v3int %v3int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %30 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %33 = OpConstantNull %v3int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldSExtract %v3int %v %18 %24 + OpReturnValue %23 + OpFunctionEnd +%extractBits_e04f5d = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %33 + %arg_1 = OpVariable %_ptr_Function_uint Function %37 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_v3int Function %33 + OpStore %arg_0 %30 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %40 = OpLoad %v3int %arg_0 + %41 = OpLoad %uint %arg_1 + %42 = OpLoad %uint %arg_2 + %39 = OpFunctionCall %v3int %tint_extract_bits %40 %41 %42 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %extractBits_e04f5d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %53 = OpLabel + %54 = OpFunctionCall %void %extractBits_e04f5d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %56 = OpLabel + %57 = OpFunctionCall %void %extractBits_e04f5d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl new file mode 100644 index 0000000000..f15bb47a07 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_e04f5d() { + var arg_0 = vec3(1); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec3 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_e04f5d(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_e04f5d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_e04f5d(); +} diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl new file mode 100644 index 0000000000..a68e40b5f7 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<2, u32>, u32, u32) -> vec<2, u32> +fn extractBits_f28f69() { + var arg_0 = vec2(1u); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec2 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_f28f69(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_f28f69(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_f28f69(); +} diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c56231c894 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +uint2 tint_extract_bits(uint2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_f28f69() { + uint2 arg_0 = (1u).xx; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_f28f69(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_f28f69(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_f28f69(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c56231c894 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +uint2 tint_extract_bits(uint2 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint2((shl).xx)) >> uint2((shr).xx)); +} + +void extractBits_f28f69() { + uint2 arg_0 = (1u).xx; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_f28f69(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_f28f69(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_f28f69(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl new file mode 100644 index 0000000000..019abe98ee --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_f28f69() { + uvec2 arg_0 = uvec2(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_f28f69(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_f28f69() { + uvec2 arg_0 = uvec2(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_f28f69(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_f28f69() { + uvec2 arg_0 = uvec2(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uvec2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_f28f69(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl new file mode 100644 index 0000000000..660fe43873 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +uint2 tint_extract_bits(uint2 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_f28f69() { + uint2 arg_0 = uint2(1u); + uint arg_1 = 1u; + uint arg_2 = 1u; + uint2 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_f28f69(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_f28f69(); + return; +} + +kernel void compute_main() { + extractBits_f28f69(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm new file mode 100644 index 0000000000..61e11491e2 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_f28f69 "extractBits_f28f69" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %29 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %32 = OpConstantNull %v2uint +%_ptr_Function_uint = OpTypePointer Function %uint + %35 = OpConstantNull %uint + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldUExtract %v2uint %v %17 %23 + OpReturnValue %22 + OpFunctionEnd +%extractBits_f28f69 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %32 + %arg_1 = OpVariable %_ptr_Function_uint Function %35 + %arg_2 = OpVariable %_ptr_Function_uint Function %35 + %res = OpVariable %_ptr_Function_v2uint Function %32 + OpStore %arg_0 %29 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %38 = OpLoad %v2uint %arg_0 + %39 = OpLoad %uint %arg_1 + %40 = OpLoad %uint %arg_2 + %37 = OpFunctionCall %v2uint %tint_extract_bits %38 %39 %40 + OpStore %res %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %extractBits_f28f69 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %51 = OpLabel + %52 = OpFunctionCall %void %extractBits_f28f69 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %54 = OpLabel + %55 = OpFunctionCall %void %extractBits_f28f69 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3b0b7d398 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_f28f69() { + var arg_0 = vec2(1u); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec2 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_f28f69(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_f28f69(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_f28f69(); +} diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl new file mode 100644 index 0000000000..06e0a7217d --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn extractBits(vec<4, i32>, u32, u32) -> vec<4, i32> +fn extractBits_fb850f() { + var arg_0 = vec4(1); + var arg_1 = 1u; + var arg_2 = 1u; + var res: vec4 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_fb850f(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_fb850f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_fb850f(); +} diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..40ab22ce85 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +int4 tint_extract_bits(int4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_fb850f() { + int4 arg_0 = (1).xxxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + int4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_fb850f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_fb850f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_fb850f(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..40ab22ce85 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +int4 tint_extract_bits(int4 v, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint shl = (32u - e); + const uint shr = (shl + s); + return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx)); +} + +void extractBits_fb850f() { + int4 arg_0 = (1).xxxx; + uint arg_1 = 1u; + uint arg_2 = 1u; + int4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + extractBits_fb850f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + extractBits_fb850f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + extractBits_fb850f(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl new file mode 100644 index 0000000000..36e408950d --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl @@ -0,0 +1,76 @@ +#version 310 es + +ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_fb850f() { + ivec4 arg_0 = ivec4(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + extractBits_fb850f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_fb850f() { + ivec4 arg_0 = ivec4(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void fragment_main() { + extractBits_fb850f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldExtract(v, int(s), int((e - s))); +} + +void extractBits_fb850f() { + ivec4 arg_0 = ivec4(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + ivec4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +void compute_main() { + extractBits_fb850f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl new file mode 100644 index 0000000000..bc83c627d8 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +int4 tint_extract_bits(int4 v, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return extract_bits(v, s, (e - s)); +} + +void extractBits_fb850f() { + int4 arg_0 = int4(1); + uint arg_1 = 1u; + uint arg_2 = 1u; + int4 res = tint_extract_bits(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + extractBits_fb850f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + extractBits_fb850f(); + return; +} + +kernel void compute_main() { + extractBits_fb850f(); + return; +} + diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b66eed101 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_extract_bits "tint_extract_bits" + OpName %v "v" + OpName %offset "offset" + OpName %count "count" + OpName %extractBits_fb850f "extractBits_fb850f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v4int %v4int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %30 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %33 = OpConstantNull %v4int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_extract_bits = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldSExtract %v4int %v %18 %24 + OpReturnValue %23 + OpFunctionEnd +%extractBits_fb850f = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %33 + %arg_1 = OpVariable %_ptr_Function_uint Function %37 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_v4int Function %33 + OpStore %arg_0 %30 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + %40 = OpLoad %v4int %arg_0 + %41 = OpLoad %uint %arg_1 + %42 = OpLoad %uint %arg_2 + %39 = OpFunctionCall %v4int %tint_extract_bits %40 %41 %42 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %extractBits_fb850f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %53 = OpLabel + %54 = OpFunctionCall %void %extractBits_fb850f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %56 = OpLabel + %57 = OpFunctionCall %void %extractBits_fb850f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8b9c66600 --- /dev/null +++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn extractBits_fb850f() { + var arg_0 = vec4(1); + var arg_1 = 1u; + var arg_2 = 1u; + var res : vec4 = extractBits(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + extractBits_fb850f(); + return vec4(); +} + +@fragment +fn fragment_main() { + extractBits_fb850f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + extractBits_fb850f(); +} diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl new file mode 100644 index 0000000000..1dafe7bcfe --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn faceForward_524986() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_524986(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_524986(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_524986(); +} diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ebf2086ccc --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_524986() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_524986(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_524986(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13e64eb462 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void faceForward_524986() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_524986(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_524986(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C6562990(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C6562990(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C6562990(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000295C6562990(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.glsl new file mode 100644 index 0000000000..a53d71045d --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_524986() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_524986(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_524986() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_524986(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_524986() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_524986(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.msl new file mode 100644 index 0000000000..71beddb9a4 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_524986() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_524986(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_524986(); + return; +} + +kernel void compute_main() { + faceForward_524986(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.spvasm new file mode 100644 index 0000000000..7c84d75b56 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_524986 "faceForward_524986" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_524986 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 FaceForward %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %faceForward_524986 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %faceForward_524986 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %faceForward_524986 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.wgsl new file mode 100644 index 0000000000..99a0ce8f7c --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/524986.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn faceForward_524986() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_524986(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_524986(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_524986(); +} diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl new file mode 100644 index 0000000000..e569e195c5 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn faceForward(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn faceForward_5afbd5() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var arg_2 = vec3(1.f); + var res: vec3 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_5afbd5(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_5afbd5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_5afbd5(); +} diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d4dbbc14ec --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_5afbd5() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_5afbd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_5afbd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_5afbd5(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d4dbbc14ec --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_5afbd5() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_5afbd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_5afbd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_5afbd5(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl new file mode 100644 index 0000000000..cc2d73df8d --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void faceForward_5afbd5() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_5afbd5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void faceForward_5afbd5() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_5afbd5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void faceForward_5afbd5() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_5afbd5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl new file mode 100644 index 0000000000..adb259e042 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_5afbd5() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 arg_2 = float3(1.0f); + float3 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_5afbd5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_5afbd5(); + return; +} + +kernel void compute_main() { + faceForward_5afbd5(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm new file mode 100644 index 0000000000..3cfa4894be --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_5afbd5 "faceForward_5afbd5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %27 = OpTypeFunction %v4float +%faceForward_5afbd5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %arg_2 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v3float %arg_0 + %24 = OpLoad %v3float %arg_1 + %25 = OpLoad %v3float %arg_2 + %21 = OpExtInst %v3float %22 FaceForward %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_5afbd5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %faceForward_5afbd5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %faceForward_5afbd5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl new file mode 100644 index 0000000000..56a1589748 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn faceForward_5afbd5() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var arg_2 = vec3(1.0f); + var res : vec3 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_5afbd5(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_5afbd5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_5afbd5(); +} diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl new file mode 100644 index 0000000000..06da297e73 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn faceForward(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn faceForward_b316e5() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var arg_2 = vec4(1.f); + var res: vec4 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_b316e5(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_b316e5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_b316e5(); +} diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1ec3bc9000 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_b316e5() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_b316e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_b316e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_b316e5(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1ec3bc9000 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_b316e5() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_b316e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_b316e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_b316e5(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl new file mode 100644 index 0000000000..2df8c57627 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void faceForward_b316e5() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_b316e5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void faceForward_b316e5() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_b316e5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void faceForward_b316e5() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_b316e5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl new file mode 100644 index 0000000000..d94bb16fdb --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_b316e5() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 arg_2 = float4(1.0f); + float4 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_b316e5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_b316e5(); + return; +} + +kernel void compute_main() { + faceForward_b316e5(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm new file mode 100644 index 0000000000..9baaf65542 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_b316e5 "faceForward_b316e5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %v4float +%faceForward_b316e5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v4float %arg_0 + %22 = OpLoad %v4float %arg_1 + %23 = OpLoad %v4float %arg_2 + %19 = OpExtInst %v4float %20 FaceForward %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %faceForward_b316e5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %faceForward_b316e5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %faceForward_b316e5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc70986e21 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn faceForward_b316e5() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var arg_2 = vec4(1.0f); + var res : vec4 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_b316e5(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_b316e5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_b316e5(); +} diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl new file mode 100644 index 0000000000..4c15845b28 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn faceForward_cc63dc() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_cc63dc(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_cc63dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_cc63dc(); +} diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9137554b02 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_cc63dc() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_cc63dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_cc63dc(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1942e9304 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void faceForward_cc63dc() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_cc63dc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_cc63dc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002186E2D0B70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002186E2D0B70(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002186E2D0B70(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002186E2D0B70(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.glsl new file mode 100644 index 0000000000..37cf24fcf5 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_cc63dc() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_cc63dc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_cc63dc() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_cc63dc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_cc63dc() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_cc63dc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.msl new file mode 100644 index 0000000000..aa5ce15687 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_cc63dc() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_cc63dc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_cc63dc(); + return; +} + +kernel void compute_main() { + faceForward_cc63dc(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.spvasm new file mode 100644 index 0000000000..eccdf4368f --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_cc63dc "faceForward_cc63dc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_cc63dc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 FaceForward %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %faceForward_cc63dc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %faceForward_cc63dc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %faceForward_cc63dc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.wgsl new file mode 100644 index 0000000000..48f247d081 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/cc63dc.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn faceForward_cc63dc() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_cc63dc(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_cc63dc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_cc63dc(); +} diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl new file mode 100644 index 0000000000..ae429ace92 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn faceForward(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn faceForward_e6908b() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var arg_2 = vec2(1.f); + var res: vec2 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_e6908b(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_e6908b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_e6908b(); +} diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..420451bde7 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_e6908b() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_e6908b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_e6908b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_e6908b(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..420451bde7 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_e6908b() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_e6908b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_e6908b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_e6908b(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl new file mode 100644 index 0000000000..d15e8d677c --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void faceForward_e6908b() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_e6908b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void faceForward_e6908b() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_e6908b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void faceForward_e6908b() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_e6908b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl new file mode 100644 index 0000000000..a932e4fe0a --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_e6908b() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 arg_2 = float2(1.0f); + float2 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_e6908b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_e6908b(); + return; +} + +kernel void compute_main() { + faceForward_e6908b(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm new file mode 100644 index 0000000000..e02d85ebe7 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_e6908b "faceForward_e6908b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %27 = OpTypeFunction %v4float +%faceForward_e6908b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %arg_2 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v2float %arg_0 + %24 = OpLoad %v2float %arg_1 + %25 = OpLoad %v2float %arg_2 + %21 = OpExtInst %v2float %22 FaceForward %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %faceForward_e6908b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %faceForward_e6908b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %faceForward_e6908b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl new file mode 100644 index 0000000000..b2a922b78a --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn faceForward_e6908b() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var arg_2 = vec2(1.0f); + var res : vec2 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_e6908b(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_e6908b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_e6908b(); +} diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl new file mode 100644 index 0000000000..51da087a3a --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn faceForward(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn faceForward_fb0f2e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_fb0f2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_fb0f2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_fb0f2e(); +} diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9e0972c562 --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void faceForward_fb0f2e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_fb0f2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_fb0f2e(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68f1d02e8c --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void faceForward_fb0f2e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + faceForward_fb0f2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + faceForward_fb0f2e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002526D7A2430(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002526D7A2430(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002526D7A2430(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002526D7A2430(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.glsl new file mode 100644 index 0000000000..9dfcea05eb --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_fb0f2e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + faceForward_fb0f2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void faceForward_fb0f2e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +void fragment_main() { + faceForward_fb0f2e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void faceForward_fb0f2e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = faceforward(arg_0, arg_1, arg_2); +} + +void compute_main() { + faceForward_fb0f2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.msl new file mode 100644 index 0000000000..9a425c70cc --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void faceForward_fb0f2e() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = faceforward(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + faceForward_fb0f2e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + faceForward_fb0f2e(); + return; +} + +kernel void compute_main() { + faceForward_fb0f2e(); + return; +} + diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5f1f816ad --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %faceForward_fb0f2e "faceForward_fb0f2e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%faceForward_fb0f2e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 FaceForward %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %faceForward_fb0f2e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %faceForward_fb0f2e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %faceForward_fb0f2e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..985cbab1af --- /dev/null +++ b/test/tint/builtins/gen/var/faceForward/fb0f2e.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn faceForward_fb0f2e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = faceForward(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + faceForward_fb0f2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + faceForward_fb0f2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + faceForward_fb0f2e(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl new file mode 100644 index 0000000000..50f579e132 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<4, u32>) -> vec<4, u32> +fn firstLeadingBit_000ff3() { + var arg_0 = vec4(1u); + var res: vec4 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_000ff3(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_000ff3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_000ff3(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a7aba557e0 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint4 tint_first_leading_bit(uint4 v) { + uint4 x = v; + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uint4 arg_0 = (1u).xxxx; + uint4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_000ff3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_000ff3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_000ff3(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a7aba557e0 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint4 tint_first_leading_bit(uint4 v) { + uint4 x = v; + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uint4 arg_0 = (1u).xxxx; + uint4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_000ff3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_000ff3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_000ff3(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl new file mode 100644 index 0000000000..f468c8a1c0 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec4 tint_first_leading_bit(uvec4 v) { + uvec4 x = v; + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_000ff3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_first_leading_bit(uvec4 v) { + uvec4 x = v; + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_000ff3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_first_leading_bit(uvec4 v) { + uvec4 x = v; + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_000ff3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl new file mode 100644 index 0000000000..cdf2e4bb6a --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint4 tint_first_leading_bit(uint4 v) { + uint4 x = v; + uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_000ff3() { + uint4 arg_0 = uint4(1u); + uint4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_000ff3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_000ff3(); + return; +} + +kernel void compute_main() { + firstLeadingBit_000ff3(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm new file mode 100644 index 0000000000..99937e2c47 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_000ff3 "firstLeadingBit_000ff3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %17 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%uint_4294901760 = OpConstant %uint 4294901760 + %24 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %34 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %37 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %44 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %54 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %57 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %70 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %77 = OpTypeFunction %void + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %17 + OpStore %x %v + %22 = OpLoad %v4uint %x + %25 = OpBitwiseAnd %v4uint %22 %24 + %19 = OpINotEqual %v4bool %25 %17 + %18 = OpSelect %v4uint %19 %27 %17 + %28 = OpLoad %v4uint %x + %29 = OpShiftRightLogical %v4uint %28 %18 + OpStore %x %29 + %32 = OpLoad %v4uint %x + %35 = OpBitwiseAnd %v4uint %32 %34 + %31 = OpINotEqual %v4bool %35 %17 + %30 = OpSelect %v4uint %31 %37 %17 + %38 = OpLoad %v4uint %x + %39 = OpShiftRightLogical %v4uint %38 %30 + OpStore %x %39 + %42 = OpLoad %v4uint %x + %45 = OpBitwiseAnd %v4uint %42 %44 + %41 = OpINotEqual %v4bool %45 %17 + %40 = OpSelect %v4uint %41 %47 %17 + %48 = OpLoad %v4uint %x + %49 = OpShiftRightLogical %v4uint %48 %40 + OpStore %x %49 + %52 = OpLoad %v4uint %x + %55 = OpBitwiseAnd %v4uint %52 %54 + %51 = OpINotEqual %v4bool %55 %17 + %50 = OpSelect %v4uint %51 %57 %17 + %58 = OpLoad %v4uint %x + %59 = OpShiftRightLogical %v4uint %58 %50 + OpStore %x %59 + %62 = OpLoad %v4uint %x + %63 = OpBitwiseAnd %v4uint %62 %57 + %61 = OpINotEqual %v4bool %63 %17 + %60 = OpSelect %v4uint %61 %65 %17 + %67 = OpLoad %v4uint %x + %68 = OpIEqual %v4bool %67 %17 + %66 = OpSelect %v4uint %68 %70 %17 + %72 = OpBitwiseOr %v4uint %18 %30 + %73 = OpBitwiseOr %v4uint %72 %40 + %74 = OpBitwiseOr %v4uint %73 %50 + %75 = OpBitwiseOr %v4uint %74 %60 + %76 = OpBitwiseOr %v4uint %75 %66 + OpReturnValue %76 + OpFunctionEnd +%firstLeadingBit_000ff3 = OpFunction %void None %77 + %80 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %17 + %res = OpVariable %_ptr_Function_v4uint Function %17 + OpStore %arg_0 %65 + %83 = OpLoad %v4uint %arg_0 + %82 = OpFunctionCall %v4uint %tint_first_leading_bit %83 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %firstLeadingBit_000ff3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %77 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %77 + %94 = OpLabel + %95 = OpFunctionCall %void %firstLeadingBit_000ff3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %77 + %97 = OpLabel + %98 = OpFunctionCall %void %firstLeadingBit_000ff3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl new file mode 100644 index 0000000000..a3a7d0c4cb --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_000ff3() { + var arg_0 = vec4(1u); + var res : vec4 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_000ff3(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_000ff3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_000ff3(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl new file mode 100644 index 0000000000..d7887c2836 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<3, i32>) -> vec<3, i32> +fn firstLeadingBit_35053e() { + var arg_0 = vec3(1); + var res: vec3 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_35053e(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_35053e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_35053e(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2a9bbbc78d --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int3 tint_first_leading_bit(int3 v) { + uint3 x = ((v < (0).xxx) ? uint3(~(v)) : uint3(v)); + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + int3 arg_0 = (1).xxx; + int3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_35053e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_35053e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_35053e(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2a9bbbc78d --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int3 tint_first_leading_bit(int3 v) { + uint3 x = ((v < (0).xxx) ? uint3(~(v)) : uint3(v)); + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + int3 arg_0 = (1).xxx; + int3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_35053e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_35053e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_35053e(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl new file mode 100644 index 0000000000..4fa238305e --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec3 tint_first_leading_bit(ivec3 v) { + uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_35053e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_first_leading_bit(ivec3 v) { + uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_35053e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_first_leading_bit(ivec3 v) { + uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0))); + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_35053e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl new file mode 100644 index 0000000000..584154aca7 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int3 tint_first_leading_bit(int3 v) { + uint3 x = select(uint3(v), uint3(~(v)), (v < int3(0))); + uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_35053e() { + int3 arg_0 = int3(1); + int3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_35053e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_35053e(); + return; +} + +kernel void compute_main() { + firstLeadingBit_35053e(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm new file mode 100644 index 0000000000..ca524f380b --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm @@ -0,0 +1,156 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_35053e "firstLeadingBit_35053e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %18 = OpConstantNull %v3int + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %27 = OpConstantNull %v3uint +%uint_4294901760 = OpConstant %uint 4294901760 + %32 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %35 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %42 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %45 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %52 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %55 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %62 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %65 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %73 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %78 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %85 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %90 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %96 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %27 + %19 = OpSLessThan %v3bool %v %18 + %23 = OpNot %v3int %v + %22 = OpBitcast %v3uint %23 + %24 = OpBitcast %v3uint %v + %15 = OpSelect %v3uint %19 %22 %24 + OpStore %x %15 + %30 = OpLoad %v3uint %x + %33 = OpBitwiseAnd %v3uint %30 %32 + %29 = OpINotEqual %v3bool %33 %27 + %28 = OpSelect %v3uint %29 %35 %27 + %36 = OpLoad %v3uint %x + %37 = OpShiftRightLogical %v3uint %36 %28 + OpStore %x %37 + %40 = OpLoad %v3uint %x + %43 = OpBitwiseAnd %v3uint %40 %42 + %39 = OpINotEqual %v3bool %43 %27 + %38 = OpSelect %v3uint %39 %45 %27 + %46 = OpLoad %v3uint %x + %47 = OpShiftRightLogical %v3uint %46 %38 + OpStore %x %47 + %50 = OpLoad %v3uint %x + %53 = OpBitwiseAnd %v3uint %50 %52 + %49 = OpINotEqual %v3bool %53 %27 + %48 = OpSelect %v3uint %49 %55 %27 + %56 = OpLoad %v3uint %x + %57 = OpShiftRightLogical %v3uint %56 %48 + OpStore %x %57 + %60 = OpLoad %v3uint %x + %63 = OpBitwiseAnd %v3uint %60 %62 + %59 = OpINotEqual %v3bool %63 %27 + %58 = OpSelect %v3uint %59 %65 %27 + %66 = OpLoad %v3uint %x + %67 = OpShiftRightLogical %v3uint %66 %58 + OpStore %x %67 + %70 = OpLoad %v3uint %x + %71 = OpBitwiseAnd %v3uint %70 %65 + %69 = OpINotEqual %v3bool %71 %27 + %68 = OpSelect %v3uint %69 %73 %27 + %75 = OpLoad %v3uint %x + %76 = OpIEqual %v3bool %75 %27 + %74 = OpSelect %v3uint %76 %78 %27 + %80 = OpBitwiseOr %v3uint %28 %38 + %81 = OpBitwiseOr %v3uint %80 %48 + %82 = OpBitwiseOr %v3uint %81 %58 + %83 = OpBitwiseOr %v3uint %82 %68 + %84 = OpBitwiseOr %v3uint %83 %74 + %79 = OpBitcast %v3int %84 + OpReturnValue %79 + OpFunctionEnd +%firstLeadingBit_35053e = OpFunction %void None %85 + %88 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %18 + %res = OpVariable %_ptr_Function_v3int Function %18 + OpStore %arg_0 %90 + %94 = OpLoad %v3int %arg_0 + %93 = OpFunctionCall %v3int %tint_first_leading_bit %94 + OpStore %res %93 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %96 + %98 = OpLabel + %99 = OpFunctionCall %void %firstLeadingBit_35053e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %85 + %101 = OpLabel + %102 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %102 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %85 + %105 = OpLabel + %106 = OpFunctionCall %void %firstLeadingBit_35053e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %85 + %108 = OpLabel + %109 = OpFunctionCall %void %firstLeadingBit_35053e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl new file mode 100644 index 0000000000..af23e37014 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_35053e() { + var arg_0 = vec3(1); + var res : vec3 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_35053e(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_35053e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_35053e(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl new file mode 100644 index 0000000000..7a81f1b1c3 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<3, u32>) -> vec<3, u32> +fn firstLeadingBit_3fd7d0() { + var arg_0 = vec3(1u); + var res: vec3 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_3fd7d0(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_3fd7d0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_3fd7d0(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f782560180 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint3 tint_first_leading_bit(uint3 v) { + uint3 x = v; + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uint3 arg_0 = (1u).xxx; + uint3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_3fd7d0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_3fd7d0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_3fd7d0(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f782560180 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint3 tint_first_leading_bit(uint3 v) { + uint3 x = v; + const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uint3 arg_0 = (1u).xxx; + uint3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_3fd7d0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_3fd7d0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_3fd7d0(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl new file mode 100644 index 0000000000..a1f7c6f5ca --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec3 tint_first_leading_bit(uvec3 v) { + uvec3 x = v; + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_3fd7d0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_first_leading_bit(uvec3 v) { + uvec3 x = v; + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_3fd7d0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_first_leading_bit(uvec3 v) { + uvec3 x = v; + uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_3fd7d0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl new file mode 100644 index 0000000000..2a6a83630d --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint3 tint_first_leading_bit(uint3 v) { + uint3 x = v; + uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_3fd7d0() { + uint3 arg_0 = uint3(1u); + uint3 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_3fd7d0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_3fd7d0(); + return; +} + +kernel void compute_main() { + firstLeadingBit_3fd7d0(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm new file mode 100644 index 0000000000..43a1b12fda --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_3fd7d0 "firstLeadingBit_3fd7d0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %17 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%uint_4294901760 = OpConstant %uint 4294901760 + %24 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %34 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %37 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %44 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %54 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %57 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %70 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %77 = OpTypeFunction %void + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %17 + OpStore %x %v + %22 = OpLoad %v3uint %x + %25 = OpBitwiseAnd %v3uint %22 %24 + %19 = OpINotEqual %v3bool %25 %17 + %18 = OpSelect %v3uint %19 %27 %17 + %28 = OpLoad %v3uint %x + %29 = OpShiftRightLogical %v3uint %28 %18 + OpStore %x %29 + %32 = OpLoad %v3uint %x + %35 = OpBitwiseAnd %v3uint %32 %34 + %31 = OpINotEqual %v3bool %35 %17 + %30 = OpSelect %v3uint %31 %37 %17 + %38 = OpLoad %v3uint %x + %39 = OpShiftRightLogical %v3uint %38 %30 + OpStore %x %39 + %42 = OpLoad %v3uint %x + %45 = OpBitwiseAnd %v3uint %42 %44 + %41 = OpINotEqual %v3bool %45 %17 + %40 = OpSelect %v3uint %41 %47 %17 + %48 = OpLoad %v3uint %x + %49 = OpShiftRightLogical %v3uint %48 %40 + OpStore %x %49 + %52 = OpLoad %v3uint %x + %55 = OpBitwiseAnd %v3uint %52 %54 + %51 = OpINotEqual %v3bool %55 %17 + %50 = OpSelect %v3uint %51 %57 %17 + %58 = OpLoad %v3uint %x + %59 = OpShiftRightLogical %v3uint %58 %50 + OpStore %x %59 + %62 = OpLoad %v3uint %x + %63 = OpBitwiseAnd %v3uint %62 %57 + %61 = OpINotEqual %v3bool %63 %17 + %60 = OpSelect %v3uint %61 %65 %17 + %67 = OpLoad %v3uint %x + %68 = OpIEqual %v3bool %67 %17 + %66 = OpSelect %v3uint %68 %70 %17 + %72 = OpBitwiseOr %v3uint %18 %30 + %73 = OpBitwiseOr %v3uint %72 %40 + %74 = OpBitwiseOr %v3uint %73 %50 + %75 = OpBitwiseOr %v3uint %74 %60 + %76 = OpBitwiseOr %v3uint %75 %66 + OpReturnValue %76 + OpFunctionEnd +%firstLeadingBit_3fd7d0 = OpFunction %void None %77 + %80 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %17 + %res = OpVariable %_ptr_Function_v3uint Function %17 + OpStore %arg_0 %65 + %83 = OpLoad %v3uint %arg_0 + %82 = OpFunctionCall %v3uint %tint_first_leading_bit %83 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %firstLeadingBit_3fd7d0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %77 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %77 + %94 = OpLabel + %95 = OpFunctionCall %void %firstLeadingBit_3fd7d0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %77 + %97 = OpLabel + %98 = OpFunctionCall %void %firstLeadingBit_3fd7d0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl new file mode 100644 index 0000000000..9bf81547c8 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_3fd7d0() { + var arg_0 = vec3(1u); + var res : vec3 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_3fd7d0(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_3fd7d0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_3fd7d0(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl new file mode 100644 index 0000000000..e2a76c9a4c --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(i32) -> i32 +fn firstLeadingBit_57a1a3() { + var arg_0 = 1; + var res: i32 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_57a1a3(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_57a1a3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_57a1a3(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..34f27f0b54 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_57a1a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_57a1a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_57a1a3(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..34f27f0b54 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_57a1a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_57a1a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_57a1a3(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl new file mode 100644 index 0000000000..5a738fc670 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_57a1a3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_57a1a3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_first_leading_bit(int v) { + uint x = ((v < 0) ? uint(~(v)) : uint(v)); + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_57a1a3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl new file mode 100644 index 0000000000..cb6e84db64 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int tint_first_leading_bit(int v) { + uint x = select(uint(v), uint(~(v)), (v < 0)); + uint const b16 = select(0u, 16u, bool((x & 4294901760u))); + x = (x >> b16); + uint const b8 = select(0u, 8u, bool((x & 65280u))); + x = (x >> b8); + uint const b4 = select(0u, 4u, bool((x & 240u))); + x = (x >> b4); + uint const b2 = select(0u, 2u, bool((x & 12u))); + x = (x >> b2); + uint const b1 = select(0u, 1u, bool((x & 2u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_57a1a3() { + int arg_0 = 1; + int res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_57a1a3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_57a1a3(); + return; +} + +kernel void compute_main() { + firstLeadingBit_57a1a3(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f38eac2b4 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_57a1a3 "firstLeadingBit_57a1a3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 + %16 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpConstantNull %uint +%uint_4294901760 = OpConstant %uint 4294901760 + %uint_16 = OpConstant %uint 16 + %uint_65280 = OpConstant %uint 65280 + %uint_8 = OpConstant %uint 8 + %uint_240 = OpConstant %uint 240 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %72 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %82 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %24 + %17 = OpSLessThan %bool %v %16 + %20 = OpNot %int %v + %19 = OpBitcast %uint %20 + %21 = OpBitcast %uint %v + %14 = OpSelect %uint %17 %19 %21 + OpStore %x %14 + %27 = OpLoad %uint %x + %29 = OpBitwiseAnd %uint %27 %uint_4294901760 + %26 = OpINotEqual %bool %29 %24 + %25 = OpSelect %uint %26 %uint_16 %24 + %31 = OpLoad %uint %x + %32 = OpShiftRightLogical %uint %31 %25 + OpStore %x %32 + %35 = OpLoad %uint %x + %37 = OpBitwiseAnd %uint %35 %uint_65280 + %34 = OpINotEqual %bool %37 %24 + %33 = OpSelect %uint %34 %uint_8 %24 + %39 = OpLoad %uint %x + %40 = OpShiftRightLogical %uint %39 %33 + OpStore %x %40 + %43 = OpLoad %uint %x + %45 = OpBitwiseAnd %uint %43 %uint_240 + %42 = OpINotEqual %bool %45 %24 + %41 = OpSelect %uint %42 %uint_4 %24 + %47 = OpLoad %uint %x + %48 = OpShiftRightLogical %uint %47 %41 + OpStore %x %48 + %51 = OpLoad %uint %x + %53 = OpBitwiseAnd %uint %51 %uint_12 + %50 = OpINotEqual %bool %53 %24 + %49 = OpSelect %uint %50 %uint_2 %24 + %55 = OpLoad %uint %x + %56 = OpShiftRightLogical %uint %55 %49 + OpStore %x %56 + %59 = OpLoad %uint %x + %60 = OpBitwiseAnd %uint %59 %uint_2 + %58 = OpINotEqual %bool %60 %24 + %57 = OpSelect %uint %58 %uint_1 %24 + %63 = OpLoad %uint %x + %64 = OpIEqual %bool %63 %24 + %62 = OpSelect %uint %64 %uint_4294967295 %24 + %67 = OpBitwiseOr %uint %25 %33 + %68 = OpBitwiseOr %uint %67 %41 + %69 = OpBitwiseOr %uint %68 %49 + %70 = OpBitwiseOr %uint %69 %57 + %71 = OpBitwiseOr %uint %70 %62 + %66 = OpBitcast %int %71 + OpReturnValue %66 + OpFunctionEnd +%firstLeadingBit_57a1a3 = OpFunction %void None %72 + %75 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %16 + %res = OpVariable %_ptr_Function_int Function %16 + OpStore %arg_0 %int_1 + %80 = OpLoad %int %arg_0 + %79 = OpFunctionCall %int %tint_first_leading_bit %80 + OpStore %res %79 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %82 + %84 = OpLabel + %85 = OpFunctionCall %void %firstLeadingBit_57a1a3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %72 + %87 = OpLabel + %88 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %88 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %72 + %91 = OpLabel + %92 = OpFunctionCall %void %firstLeadingBit_57a1a3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %72 + %94 = OpLabel + %95 = OpFunctionCall %void %firstLeadingBit_57a1a3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa872659da --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_57a1a3() { + var arg_0 = 1; + var res : i32 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_57a1a3(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_57a1a3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_57a1a3(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl new file mode 100644 index 0000000000..72c6c5f7a6 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<2, u32>) -> vec<2, u32> +fn firstLeadingBit_6fe804() { + var arg_0 = vec2(1u); + var res: vec2 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_6fe804(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_6fe804(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_6fe804(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..451630ecae --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint2 tint_first_leading_bit(uint2 v) { + uint2 x = v; + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uint2 arg_0 = (1u).xx; + uint2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_6fe804(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_6fe804(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_6fe804(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..451630ecae --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint2 tint_first_leading_bit(uint2 v) { + uint2 x = v; + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uint2 arg_0 = (1u).xx; + uint2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_6fe804(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_6fe804(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_6fe804(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl new file mode 100644 index 0000000000..b45183ba1f --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec2 tint_first_leading_bit(uvec2 v) { + uvec2 x = v; + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_6fe804(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_first_leading_bit(uvec2 v) { + uvec2 x = v; + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_6fe804(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_first_leading_bit(uvec2 v) { + uvec2 x = v; + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_6fe804(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl new file mode 100644 index 0000000000..d81e18029a --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint2 tint_first_leading_bit(uint2 v) { + uint2 x = v; + uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_6fe804() { + uint2 arg_0 = uint2(1u); + uint2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_6fe804(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_6fe804(); + return; +} + +kernel void compute_main() { + firstLeadingBit_6fe804(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm new file mode 100644 index 0000000000..2a85a2b488 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_6fe804 "firstLeadingBit_6fe804" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %17 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%uint_4294901760 = OpConstant %uint 4294901760 + %24 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %27 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %34 = OpConstantComposite %v2uint %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %37 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %44 = OpConstantComposite %v2uint %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %47 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %54 = OpConstantComposite %v2uint %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %57 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %70 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %77 = OpTypeFunction %void + %85 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %17 + OpStore %x %v + %22 = OpLoad %v2uint %x + %25 = OpBitwiseAnd %v2uint %22 %24 + %19 = OpINotEqual %v2bool %25 %17 + %18 = OpSelect %v2uint %19 %27 %17 + %28 = OpLoad %v2uint %x + %29 = OpShiftRightLogical %v2uint %28 %18 + OpStore %x %29 + %32 = OpLoad %v2uint %x + %35 = OpBitwiseAnd %v2uint %32 %34 + %31 = OpINotEqual %v2bool %35 %17 + %30 = OpSelect %v2uint %31 %37 %17 + %38 = OpLoad %v2uint %x + %39 = OpShiftRightLogical %v2uint %38 %30 + OpStore %x %39 + %42 = OpLoad %v2uint %x + %45 = OpBitwiseAnd %v2uint %42 %44 + %41 = OpINotEqual %v2bool %45 %17 + %40 = OpSelect %v2uint %41 %47 %17 + %48 = OpLoad %v2uint %x + %49 = OpShiftRightLogical %v2uint %48 %40 + OpStore %x %49 + %52 = OpLoad %v2uint %x + %55 = OpBitwiseAnd %v2uint %52 %54 + %51 = OpINotEqual %v2bool %55 %17 + %50 = OpSelect %v2uint %51 %57 %17 + %58 = OpLoad %v2uint %x + %59 = OpShiftRightLogical %v2uint %58 %50 + OpStore %x %59 + %62 = OpLoad %v2uint %x + %63 = OpBitwiseAnd %v2uint %62 %57 + %61 = OpINotEqual %v2bool %63 %17 + %60 = OpSelect %v2uint %61 %65 %17 + %67 = OpLoad %v2uint %x + %68 = OpIEqual %v2bool %67 %17 + %66 = OpSelect %v2uint %68 %70 %17 + %72 = OpBitwiseOr %v2uint %18 %30 + %73 = OpBitwiseOr %v2uint %72 %40 + %74 = OpBitwiseOr %v2uint %73 %50 + %75 = OpBitwiseOr %v2uint %74 %60 + %76 = OpBitwiseOr %v2uint %75 %66 + OpReturnValue %76 + OpFunctionEnd +%firstLeadingBit_6fe804 = OpFunction %void None %77 + %80 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %17 + %res = OpVariable %_ptr_Function_v2uint Function %17 + OpStore %arg_0 %65 + %83 = OpLoad %v2uint %arg_0 + %82 = OpFunctionCall %v2uint %tint_first_leading_bit %83 + OpStore %res %82 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %85 + %87 = OpLabel + %88 = OpFunctionCall %void %firstLeadingBit_6fe804 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %77 + %90 = OpLabel + %91 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %91 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %77 + %94 = OpLabel + %95 = OpFunctionCall %void %firstLeadingBit_6fe804 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %77 + %97 = OpLabel + %98 = OpFunctionCall %void %firstLeadingBit_6fe804 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ae1f87fc0 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_6fe804() { + var arg_0 = vec2(1u); + var res : vec2 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_6fe804(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_6fe804(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_6fe804(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl new file mode 100644 index 0000000000..fb335c252a --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<2, i32>) -> vec<2, i32> +fn firstLeadingBit_a622c2() { + var arg_0 = vec2(1); + var res: vec2 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_a622c2(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_a622c2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_a622c2(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..25765f1ab8 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int2 tint_first_leading_bit(int2 v) { + uint2 x = ((v < (0).xx) ? uint2(~(v)) : uint2(v)); + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + int2 arg_0 = (1).xx; + int2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_a622c2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_a622c2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_a622c2(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..25765f1ab8 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int2 tint_first_leading_bit(int2 v) { + uint2 x = ((v < (0).xx) ? uint2(~(v)) : uint2(v)); + const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + int2 arg_0 = (1).xx; + int2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_a622c2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_a622c2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_a622c2(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl new file mode 100644 index 0000000000..b893de3026 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec2 tint_first_leading_bit(ivec2 v) { + uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_a622c2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_first_leading_bit(ivec2 v) { + uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_a622c2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_first_leading_bit(ivec2 v) { + uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0))); + uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_a622c2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl new file mode 100644 index 0000000000..321198c644 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int2 tint_first_leading_bit(int2 v) { + uint2 x = select(uint2(v), uint2(~(v)), (v < int2(0))); + uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_a622c2() { + int2 arg_0 = int2(1); + int2 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_a622c2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_a622c2(); + return; +} + +kernel void compute_main() { + firstLeadingBit_a622c2(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm new file mode 100644 index 0000000000..908ce65578 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm @@ -0,0 +1,156 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_a622c2 "firstLeadingBit_a622c2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %18 = OpConstantNull %v2int + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %27 = OpConstantNull %v2uint +%uint_4294901760 = OpConstant %uint 4294901760 + %32 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %35 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %42 = OpConstantComposite %v2uint %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %45 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %52 = OpConstantComposite %v2uint %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %55 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %62 = OpConstantComposite %v2uint %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %65 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %73 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %78 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %85 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %90 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %96 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %27 + %19 = OpSLessThan %v2bool %v %18 + %23 = OpNot %v2int %v + %22 = OpBitcast %v2uint %23 + %24 = OpBitcast %v2uint %v + %15 = OpSelect %v2uint %19 %22 %24 + OpStore %x %15 + %30 = OpLoad %v2uint %x + %33 = OpBitwiseAnd %v2uint %30 %32 + %29 = OpINotEqual %v2bool %33 %27 + %28 = OpSelect %v2uint %29 %35 %27 + %36 = OpLoad %v2uint %x + %37 = OpShiftRightLogical %v2uint %36 %28 + OpStore %x %37 + %40 = OpLoad %v2uint %x + %43 = OpBitwiseAnd %v2uint %40 %42 + %39 = OpINotEqual %v2bool %43 %27 + %38 = OpSelect %v2uint %39 %45 %27 + %46 = OpLoad %v2uint %x + %47 = OpShiftRightLogical %v2uint %46 %38 + OpStore %x %47 + %50 = OpLoad %v2uint %x + %53 = OpBitwiseAnd %v2uint %50 %52 + %49 = OpINotEqual %v2bool %53 %27 + %48 = OpSelect %v2uint %49 %55 %27 + %56 = OpLoad %v2uint %x + %57 = OpShiftRightLogical %v2uint %56 %48 + OpStore %x %57 + %60 = OpLoad %v2uint %x + %63 = OpBitwiseAnd %v2uint %60 %62 + %59 = OpINotEqual %v2bool %63 %27 + %58 = OpSelect %v2uint %59 %65 %27 + %66 = OpLoad %v2uint %x + %67 = OpShiftRightLogical %v2uint %66 %58 + OpStore %x %67 + %70 = OpLoad %v2uint %x + %71 = OpBitwiseAnd %v2uint %70 %65 + %69 = OpINotEqual %v2bool %71 %27 + %68 = OpSelect %v2uint %69 %73 %27 + %75 = OpLoad %v2uint %x + %76 = OpIEqual %v2bool %75 %27 + %74 = OpSelect %v2uint %76 %78 %27 + %80 = OpBitwiseOr %v2uint %28 %38 + %81 = OpBitwiseOr %v2uint %80 %48 + %82 = OpBitwiseOr %v2uint %81 %58 + %83 = OpBitwiseOr %v2uint %82 %68 + %84 = OpBitwiseOr %v2uint %83 %74 + %79 = OpBitcast %v2int %84 + OpReturnValue %79 + OpFunctionEnd +%firstLeadingBit_a622c2 = OpFunction %void None %85 + %88 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %18 + OpStore %arg_0 %90 + %94 = OpLoad %v2int %arg_0 + %93 = OpFunctionCall %v2int %tint_first_leading_bit %94 + OpStore %res %93 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %96 + %98 = OpLabel + %99 = OpFunctionCall %void %firstLeadingBit_a622c2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %85 + %101 = OpLabel + %102 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %102 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %85 + %105 = OpLabel + %106 = OpFunctionCall %void %firstLeadingBit_a622c2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %85 + %108 = OpLabel + %109 = OpFunctionCall %void %firstLeadingBit_a622c2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl new file mode 100644 index 0000000000..457d5f1d2e --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_a622c2() { + var arg_0 = vec2(1); + var res : vec2 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_a622c2(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_a622c2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_a622c2(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl new file mode 100644 index 0000000000..132eabaa09 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(vec<4, i32>) -> vec<4, i32> +fn firstLeadingBit_c1f940() { + var arg_0 = vec4(1); + var res: vec4 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_c1f940(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_c1f940(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_c1f940(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c05d3dcd69 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int4 tint_first_leading_bit(int4 v) { + uint4 x = ((v < (0).xxxx) ? uint4(~(v)) : uint4(v)); + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + int4 arg_0 = (1).xxxx; + int4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_c1f940(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_c1f940(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_c1f940(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c05d3dcd69 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int4 tint_first_leading_bit(int4 v) { + uint4 x = ((v < (0).xxxx) ? uint4(~(v)) : uint4(v)); + const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + int4 arg_0 = (1).xxxx; + int4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_c1f940(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_c1f940(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_c1f940(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl new file mode 100644 index 0000000000..ef4ab88498 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec4 tint_first_leading_bit(ivec4 v) { + uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_c1f940(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_first_leading_bit(ivec4 v) { + uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_c1f940(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_first_leading_bit(ivec4 v) { + uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0))); + uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_c1f940(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl new file mode 100644 index 0000000000..042e4178b7 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int4 tint_first_leading_bit(int4 v) { + uint4 x = select(uint4(v), uint4(~(v)), (v < int4(0))); + uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_c1f940() { + int4 arg_0 = int4(1); + int4 res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_c1f940(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_c1f940(); + return; +} + +kernel void compute_main() { + firstLeadingBit_c1f940(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm new file mode 100644 index 0000000000..581af1df40 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm @@ -0,0 +1,156 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_c1f940 "firstLeadingBit_c1f940" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %18 = OpConstantNull %v4int + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %27 = OpConstantNull %v4uint +%uint_4294901760 = OpConstant %uint 4294901760 + %32 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760 + %uint_16 = OpConstant %uint 16 + %35 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_65280 = OpConstant %uint 65280 + %42 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280 + %uint_8 = OpConstant %uint 8 + %45 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_240 = OpConstant %uint 240 + %52 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240 + %uint_4 = OpConstant %uint 4 + %55 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_12 = OpConstant %uint 12 + %62 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12 + %uint_2 = OpConstant %uint 2 + %65 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %73 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %78 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %85 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %90 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %96 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %27 + %19 = OpSLessThan %v4bool %v %18 + %23 = OpNot %v4int %v + %22 = OpBitcast %v4uint %23 + %24 = OpBitcast %v4uint %v + %15 = OpSelect %v4uint %19 %22 %24 + OpStore %x %15 + %30 = OpLoad %v4uint %x + %33 = OpBitwiseAnd %v4uint %30 %32 + %29 = OpINotEqual %v4bool %33 %27 + %28 = OpSelect %v4uint %29 %35 %27 + %36 = OpLoad %v4uint %x + %37 = OpShiftRightLogical %v4uint %36 %28 + OpStore %x %37 + %40 = OpLoad %v4uint %x + %43 = OpBitwiseAnd %v4uint %40 %42 + %39 = OpINotEqual %v4bool %43 %27 + %38 = OpSelect %v4uint %39 %45 %27 + %46 = OpLoad %v4uint %x + %47 = OpShiftRightLogical %v4uint %46 %38 + OpStore %x %47 + %50 = OpLoad %v4uint %x + %53 = OpBitwiseAnd %v4uint %50 %52 + %49 = OpINotEqual %v4bool %53 %27 + %48 = OpSelect %v4uint %49 %55 %27 + %56 = OpLoad %v4uint %x + %57 = OpShiftRightLogical %v4uint %56 %48 + OpStore %x %57 + %60 = OpLoad %v4uint %x + %63 = OpBitwiseAnd %v4uint %60 %62 + %59 = OpINotEqual %v4bool %63 %27 + %58 = OpSelect %v4uint %59 %65 %27 + %66 = OpLoad %v4uint %x + %67 = OpShiftRightLogical %v4uint %66 %58 + OpStore %x %67 + %70 = OpLoad %v4uint %x + %71 = OpBitwiseAnd %v4uint %70 %65 + %69 = OpINotEqual %v4bool %71 %27 + %68 = OpSelect %v4uint %69 %73 %27 + %75 = OpLoad %v4uint %x + %76 = OpIEqual %v4bool %75 %27 + %74 = OpSelect %v4uint %76 %78 %27 + %80 = OpBitwiseOr %v4uint %28 %38 + %81 = OpBitwiseOr %v4uint %80 %48 + %82 = OpBitwiseOr %v4uint %81 %58 + %83 = OpBitwiseOr %v4uint %82 %68 + %84 = OpBitwiseOr %v4uint %83 %74 + %79 = OpBitcast %v4int %84 + OpReturnValue %79 + OpFunctionEnd +%firstLeadingBit_c1f940 = OpFunction %void None %85 + %88 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %18 + %res = OpVariable %_ptr_Function_v4int Function %18 + OpStore %arg_0 %90 + %94 = OpLoad %v4int %arg_0 + %93 = OpFunctionCall %v4int %tint_first_leading_bit %94 + OpStore %res %93 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %96 + %98 = OpLabel + %99 = OpFunctionCall %void %firstLeadingBit_c1f940 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %85 + %101 = OpLabel + %102 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %102 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %85 + %105 = OpLabel + %106 = OpFunctionCall %void %firstLeadingBit_c1f940 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %85 + %108 = OpLabel + %109 = OpFunctionCall %void %firstLeadingBit_c1f940 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl new file mode 100644 index 0000000000..06fd90f3c8 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_c1f940() { + var arg_0 = vec4(1); + var res : vec4 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_c1f940(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_c1f940(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_c1f940(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl new file mode 100644 index 0000000000..06814efa66 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstLeadingBit(u32) -> u32 +fn firstLeadingBit_f0779d() { + var arg_0 = 1u; + var res: u32 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_f0779d(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_f0779d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_f0779d(); +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..26c2ab932f --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint tint_first_leading_bit(uint v) { + uint x = v; + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_f0779d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_f0779d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_f0779d(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26c2ab932f --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint tint_first_leading_bit(uint v) { + uint x = v; + const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + const uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + const uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + const uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + const uint b1 = (bool((x & 2u)) ? 1u : 0u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstLeadingBit_f0779d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstLeadingBit_f0779d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstLeadingBit_f0779d(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl new file mode 100644 index 0000000000..fe38e683ca --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uint tint_first_leading_bit(uint v) { + uint x = v; + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +vec4 vertex_main() { + firstLeadingBit_f0779d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_first_leading_bit(uint v) { + uint x = v; + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +void fragment_main() { + firstLeadingBit_f0779d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_first_leading_bit(uint v) { + uint x = v; + uint b16 = (bool((x & 4294901760u)) ? 16u : 0u); + x = (x >> b16); + uint b8 = (bool((x & 65280u)) ? 8u : 0u); + x = (x >> b8); + uint b4 = (bool((x & 240u)) ? 4u : 0u); + x = (x >> b4); + uint b2 = (bool((x & 12u)) ? 2u : 0u); + x = (x >> b2); + uint b1 = (bool((x & 2u)) ? 1u : 0u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +void compute_main() { + firstLeadingBit_f0779d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl new file mode 100644 index 0000000000..daac75af97 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint tint_first_leading_bit(uint v) { + uint x = v; + uint const b16 = select(0u, 16u, bool((x & 4294901760u))); + x = (x >> b16); + uint const b8 = select(0u, 8u, bool((x & 65280u))); + x = (x >> b8); + uint const b4 = select(0u, 4u, bool((x & 240u))); + x = (x >> b4); + uint const b2 = select(0u, 2u, bool((x & 12u))); + x = (x >> b2); + uint const b1 = select(0u, 1u, bool((x & 2u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstLeadingBit_f0779d() { + uint arg_0 = 1u; + uint res = tint_first_leading_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstLeadingBit_f0779d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstLeadingBit_f0779d(); + return; +} + +kernel void compute_main() { + firstLeadingBit_f0779d(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm new file mode 100644 index 0000000000..9236998e6f --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_leading_bit "tint_first_leading_bit" + OpName %v "v" + OpName %x "x" + OpName %firstLeadingBit_f0779d "firstLeadingBit_f0779d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %bool = OpTypeBool +%uint_4294901760 = OpConstant %uint 4294901760 + %uint_16 = OpConstant %uint 16 + %uint_65280 = OpConstant %uint 65280 + %uint_8 = OpConstant %uint 8 + %uint_240 = OpConstant %uint 240 + %uint_4 = OpConstant %uint 4 + %uint_12 = OpConstant %uint 12 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %65 = OpTypeFunction %void + %73 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_leading_bit = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %16 + OpStore %x %v + %20 = OpLoad %uint %x + %22 = OpBitwiseAnd %uint %20 %uint_4294901760 + %18 = OpINotEqual %bool %22 %16 + %17 = OpSelect %uint %18 %uint_16 %16 + %24 = OpLoad %uint %x + %25 = OpShiftRightLogical %uint %24 %17 + OpStore %x %25 + %28 = OpLoad %uint %x + %30 = OpBitwiseAnd %uint %28 %uint_65280 + %27 = OpINotEqual %bool %30 %16 + %26 = OpSelect %uint %27 %uint_8 %16 + %32 = OpLoad %uint %x + %33 = OpShiftRightLogical %uint %32 %26 + OpStore %x %33 + %36 = OpLoad %uint %x + %38 = OpBitwiseAnd %uint %36 %uint_240 + %35 = OpINotEqual %bool %38 %16 + %34 = OpSelect %uint %35 %uint_4 %16 + %40 = OpLoad %uint %x + %41 = OpShiftRightLogical %uint %40 %34 + OpStore %x %41 + %44 = OpLoad %uint %x + %46 = OpBitwiseAnd %uint %44 %uint_12 + %43 = OpINotEqual %bool %46 %16 + %42 = OpSelect %uint %43 %uint_2 %16 + %48 = OpLoad %uint %x + %49 = OpShiftRightLogical %uint %48 %42 + OpStore %x %49 + %52 = OpLoad %uint %x + %53 = OpBitwiseAnd %uint %52 %uint_2 + %51 = OpINotEqual %bool %53 %16 + %50 = OpSelect %uint %51 %uint_1 %16 + %56 = OpLoad %uint %x + %57 = OpIEqual %bool %56 %16 + %55 = OpSelect %uint %57 %uint_4294967295 %16 + %60 = OpBitwiseOr %uint %17 %26 + %61 = OpBitwiseOr %uint %60 %34 + %62 = OpBitwiseOr %uint %61 %42 + %63 = OpBitwiseOr %uint %62 %50 + %64 = OpBitwiseOr %uint %63 %55 + OpReturnValue %64 + OpFunctionEnd +%firstLeadingBit_f0779d = OpFunction %void None %65 + %68 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %16 + %res = OpVariable %_ptr_Function_uint Function %16 + OpStore %arg_0 %uint_1 + %71 = OpLoad %uint %arg_0 + %70 = OpFunctionCall %uint %tint_first_leading_bit %71 + OpStore %res %70 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %73 + %75 = OpLabel + %76 = OpFunctionCall %void %firstLeadingBit_f0779d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %65 + %78 = OpLabel + %79 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %79 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %65 + %82 = OpLabel + %83 = OpFunctionCall %void %firstLeadingBit_f0779d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %65 + %85 = OpLabel + %86 = OpFunctionCall %void %firstLeadingBit_f0779d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl new file mode 100644 index 0000000000..b47e829975 --- /dev/null +++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstLeadingBit_f0779d() { + var arg_0 = 1u; + var res : u32 = firstLeadingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstLeadingBit_f0779d(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstLeadingBit_f0779d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstLeadingBit_f0779d(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl new file mode 100644 index 0000000000..018a67ae79 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<4, u32>) -> vec<4, u32> +fn firstTrailingBit_110f2c() { + var arg_0 = vec4(1u); + var res: vec4 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_110f2c(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_110f2c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_110f2c(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..65939d8468 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint4 tint_first_trailing_bit(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uint4 arg_0 = (1u).xxxx; + uint4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_110f2c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_110f2c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_110f2c(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65939d8468 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint4 tint_first_trailing_bit(uint4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uint4 arg_0 = (1u).xxxx; + uint4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_110f2c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_110f2c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_110f2c(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl new file mode 100644 index 0000000000..907cba7cce --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec4 tint_first_trailing_bit(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_110f2c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_first_trailing_bit(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_110f2c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_first_trailing_bit(uvec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_110f2c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl new file mode 100644 index 0000000000..7a1f15894a --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint4 tint_first_trailing_bit(uint4 v) { + uint4 x = uint4(v); + uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_110f2c() { + uint4 arg_0 = uint4(1u); + uint4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_110f2c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_110f2c(); + return; +} + +kernel void compute_main() { + firstTrailingBit_110f2c(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa68727462 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_110f2c "firstTrailingBit_110f2c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %18 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %71 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %86 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %x %v + %23 = OpLoad %v4uint %x + %26 = OpBitwiseAnd %v4uint %23 %25 + %20 = OpINotEqual %v4bool %26 %18 + %19 = OpSelect %v4uint %20 %18 %28 + %29 = OpLoad %v4uint %x + %30 = OpShiftRightLogical %v4uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v4uint %x + %36 = OpBitwiseAnd %v4uint %33 %35 + %32 = OpINotEqual %v4bool %36 %18 + %31 = OpSelect %v4uint %32 %18 %38 + %39 = OpLoad %v4uint %x + %40 = OpShiftRightLogical %v4uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v4uint %x + %46 = OpBitwiseAnd %v4uint %43 %45 + %42 = OpINotEqual %v4bool %46 %18 + %41 = OpSelect %v4uint %42 %18 %48 + %49 = OpLoad %v4uint %x + %50 = OpShiftRightLogical %v4uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v4uint %x + %56 = OpBitwiseAnd %v4uint %53 %55 + %52 = OpINotEqual %v4bool %56 %18 + %51 = OpSelect %v4uint %52 %18 %58 + %59 = OpLoad %v4uint %x + %60 = OpShiftRightLogical %v4uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v4uint %x + %66 = OpBitwiseAnd %v4uint %63 %65 + %62 = OpINotEqual %v4bool %66 %18 + %61 = OpSelect %v4uint %62 %18 %65 + %68 = OpLoad %v4uint %x + %69 = OpIEqual %v4bool %68 %18 + %67 = OpSelect %v4uint %69 %71 %18 + %73 = OpBitwiseOr %v4uint %19 %31 + %74 = OpBitwiseOr %v4uint %73 %41 + %75 = OpBitwiseOr %v4uint %74 %51 + %76 = OpBitwiseOr %v4uint %75 %61 + %77 = OpBitwiseOr %v4uint %76 %67 + OpReturnValue %77 + OpFunctionEnd +%firstTrailingBit_110f2c = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %18 + %res = OpVariable %_ptr_Function_v4uint Function %18 + OpStore %arg_0 %65 + %84 = OpLoad %v4uint %arg_0 + %83 = OpFunctionCall %v4uint %tint_first_trailing_bit %84 + OpStore %res %83 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %86 + %88 = OpLabel + %89 = OpFunctionCall %void %firstTrailingBit_110f2c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %91 = OpLabel + %92 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %92 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %95 = OpLabel + %96 = OpFunctionCall %void %firstTrailingBit_110f2c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %98 = OpLabel + %99 = OpFunctionCall %void %firstTrailingBit_110f2c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl new file mode 100644 index 0000000000..2cd770d555 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_110f2c() { + var arg_0 = vec4(1u); + var res : vec4 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_110f2c(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_110f2c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_110f2c(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl new file mode 100644 index 0000000000..c911939cf8 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(i32) -> i32 +fn firstTrailingBit_3a2acc() { + var arg_0 = 1; + var res: i32 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_3a2acc(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_3a2acc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_3a2acc(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18cddbf55e --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int tint_first_trailing_bit(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_3a2acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_3a2acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_3a2acc(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..18cddbf55e --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int tint_first_trailing_bit(int v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_3a2acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_3a2acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_3a2acc(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl new file mode 100644 index 0000000000..7bc6250b8d --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_3a2acc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_3a2acc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_3a2acc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl new file mode 100644 index 0000000000..580ba30336 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int tint_first_trailing_bit(int v) { + uint x = uint(v); + uint const b16 = select(16u, 0u, bool((x & 65535u))); + x = (x >> b16); + uint const b8 = select(8u, 0u, bool((x & 255u))); + x = (x >> b8); + uint const b4 = select(4u, 0u, bool((x & 15u))); + x = (x >> b4); + uint const b2 = select(2u, 0u, bool((x & 3u))); + x = (x >> b2); + uint const b1 = select(1u, 0u, bool((x & 1u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return int((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_3a2acc() { + int arg_0 = 1; + int res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_3a2acc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_3a2acc(); + return; +} + +kernel void compute_main() { + firstTrailingBit_3a2acc(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba548bc345 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_3a2acc "firstTrailingBit_3a2acc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %67 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %74 = OpConstantNull %int + %78 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %int None %9 + %v = OpFunctionParameter %int + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %18 + %14 = OpBitcast %uint %v + OpStore %x %14 + %22 = OpLoad %uint %x + %24 = OpBitwiseAnd %uint %22 %uint_65535 + %20 = OpINotEqual %bool %24 %18 + %19 = OpSelect %uint %20 %18 %uint_16 + %26 = OpLoad %uint %x + %27 = OpShiftRightLogical %uint %26 %19 + OpStore %x %27 + %30 = OpLoad %uint %x + %32 = OpBitwiseAnd %uint %30 %uint_255 + %29 = OpINotEqual %bool %32 %18 + %28 = OpSelect %uint %29 %18 %uint_8 + %34 = OpLoad %uint %x + %35 = OpShiftRightLogical %uint %34 %28 + OpStore %x %35 + %38 = OpLoad %uint %x + %40 = OpBitwiseAnd %uint %38 %uint_15 + %37 = OpINotEqual %bool %40 %18 + %36 = OpSelect %uint %37 %18 %uint_4 + %42 = OpLoad %uint %x + %43 = OpShiftRightLogical %uint %42 %36 + OpStore %x %43 + %46 = OpLoad %uint %x + %48 = OpBitwiseAnd %uint %46 %uint_3 + %45 = OpINotEqual %bool %48 %18 + %44 = OpSelect %uint %45 %18 %uint_2 + %50 = OpLoad %uint %x + %51 = OpShiftRightLogical %uint %50 %44 + OpStore %x %51 + %54 = OpLoad %uint %x + %56 = OpBitwiseAnd %uint %54 %uint_1 + %53 = OpINotEqual %bool %56 %18 + %52 = OpSelect %uint %53 %18 %uint_1 + %58 = OpLoad %uint %x + %59 = OpIEqual %bool %58 %18 + %57 = OpSelect %uint %59 %uint_4294967295 %18 + %62 = OpBitwiseOr %uint %19 %28 + %63 = OpBitwiseOr %uint %62 %36 + %64 = OpBitwiseOr %uint %63 %44 + %65 = OpBitwiseOr %uint %64 %52 + %66 = OpBitwiseOr %uint %65 %57 + %61 = OpBitcast %int %66 + OpReturnValue %61 + OpFunctionEnd +%firstTrailingBit_3a2acc = OpFunction %void None %67 + %70 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %74 + %res = OpVariable %_ptr_Function_int Function %74 + OpStore %arg_0 %int_1 + %76 = OpLoad %int %arg_0 + %75 = OpFunctionCall %int %tint_first_trailing_bit %76 + OpStore %res %75 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %78 + %80 = OpLabel + %81 = OpFunctionCall %void %firstTrailingBit_3a2acc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %67 + %83 = OpLabel + %84 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %84 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %67 + %87 = OpLabel + %88 = OpFunctionCall %void %firstTrailingBit_3a2acc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %67 + %90 = OpLabel + %91 = OpFunctionCall %void %firstTrailingBit_3a2acc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3e2dfba69 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_3a2acc() { + var arg_0 = 1; + var res : i32 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_3a2acc(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_3a2acc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_3a2acc(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl new file mode 100644 index 0000000000..5a8dca4958 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<2, u32>) -> vec<2, u32> +fn firstTrailingBit_45eb10() { + var arg_0 = vec2(1u); + var res: vec2 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_45eb10(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_45eb10(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_45eb10(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2891be4bde --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint2 tint_first_trailing_bit(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uint2 arg_0 = (1u).xx; + uint2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_45eb10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_45eb10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_45eb10(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2891be4bde --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint2 tint_first_trailing_bit(uint2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uint2 arg_0 = (1u).xx; + uint2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_45eb10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_45eb10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_45eb10(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl new file mode 100644 index 0000000000..0675a95a29 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec2 tint_first_trailing_bit(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_45eb10(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_first_trailing_bit(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_45eb10(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_first_trailing_bit(uvec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_45eb10(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl new file mode 100644 index 0000000000..35d9b6a4e0 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint2 tint_first_trailing_bit(uint2 v) { + uint2 x = uint2(v); + uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_45eb10() { + uint2 arg_0 = uint2(1u); + uint2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_45eb10(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_45eb10(); + return; +} + +kernel void compute_main() { + firstTrailingBit_45eb10(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm new file mode 100644 index 0000000000..c2e7c3874b --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_45eb10 "firstTrailingBit_45eb10" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %18 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %71 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %86 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %x %v + %23 = OpLoad %v2uint %x + %26 = OpBitwiseAnd %v2uint %23 %25 + %20 = OpINotEqual %v2bool %26 %18 + %19 = OpSelect %v2uint %20 %18 %28 + %29 = OpLoad %v2uint %x + %30 = OpShiftRightLogical %v2uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v2uint %x + %36 = OpBitwiseAnd %v2uint %33 %35 + %32 = OpINotEqual %v2bool %36 %18 + %31 = OpSelect %v2uint %32 %18 %38 + %39 = OpLoad %v2uint %x + %40 = OpShiftRightLogical %v2uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v2uint %x + %46 = OpBitwiseAnd %v2uint %43 %45 + %42 = OpINotEqual %v2bool %46 %18 + %41 = OpSelect %v2uint %42 %18 %48 + %49 = OpLoad %v2uint %x + %50 = OpShiftRightLogical %v2uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v2uint %x + %56 = OpBitwiseAnd %v2uint %53 %55 + %52 = OpINotEqual %v2bool %56 %18 + %51 = OpSelect %v2uint %52 %18 %58 + %59 = OpLoad %v2uint %x + %60 = OpShiftRightLogical %v2uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v2uint %x + %66 = OpBitwiseAnd %v2uint %63 %65 + %62 = OpINotEqual %v2bool %66 %18 + %61 = OpSelect %v2uint %62 %18 %65 + %68 = OpLoad %v2uint %x + %69 = OpIEqual %v2bool %68 %18 + %67 = OpSelect %v2uint %69 %71 %18 + %73 = OpBitwiseOr %v2uint %19 %31 + %74 = OpBitwiseOr %v2uint %73 %41 + %75 = OpBitwiseOr %v2uint %74 %51 + %76 = OpBitwiseOr %v2uint %75 %61 + %77 = OpBitwiseOr %v2uint %76 %67 + OpReturnValue %77 + OpFunctionEnd +%firstTrailingBit_45eb10 = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %18 + %res = OpVariable %_ptr_Function_v2uint Function %18 + OpStore %arg_0 %65 + %84 = OpLoad %v2uint %arg_0 + %83 = OpFunctionCall %v2uint %tint_first_trailing_bit %84 + OpStore %res %83 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %86 + %88 = OpLabel + %89 = OpFunctionCall %void %firstTrailingBit_45eb10 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %91 = OpLabel + %92 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %92 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %95 = OpLabel + %96 = OpFunctionCall %void %firstTrailingBit_45eb10 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %98 = OpLabel + %99 = OpFunctionCall %void %firstTrailingBit_45eb10 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c02e95d91 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_45eb10() { + var arg_0 = vec2(1u); + var res : vec2 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_45eb10(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_45eb10(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_45eb10(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl new file mode 100644 index 0000000000..1a8409406b --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(u32) -> u32 +fn firstTrailingBit_47d475() { + var arg_0 = 1u; + var res: u32 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_47d475(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_47d475(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_47d475(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ba3f283902 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_47d475(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_47d475(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_47d475(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba3f283902 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + const uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + const uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + const uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + const uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + const uint b1 = (bool((x & 1u)) ? 0u : 1u); + const uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_47d475(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_47d475(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_47d475(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl new file mode 100644 index 0000000000..69af5555fa --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_47d475(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_47d475(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint b16 = (bool((x & 65535u)) ? 0u : 16u); + x = (x >> b16); + uint b8 = (bool((x & 255u)) ? 0u : 8u); + x = (x >> b8); + uint b4 = (bool((x & 15u)) ? 0u : 4u); + x = (x >> b4); + uint b2 = (bool((x & 3u)) ? 0u : 2u); + x = (x >> b2); + uint b1 = (bool((x & 1u)) ? 0u : 1u); + uint is_zero = ((x == 0u) ? 4294967295u : 0u); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_47d475(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl new file mode 100644 index 0000000000..9053e17964 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint tint_first_trailing_bit(uint v) { + uint x = uint(v); + uint const b16 = select(16u, 0u, bool((x & 65535u))); + x = (x >> b16); + uint const b8 = select(8u, 0u, bool((x & 255u))); + x = (x >> b8); + uint const b4 = select(4u, 0u, bool((x & 15u))); + x = (x >> b4); + uint const b2 = select(2u, 0u, bool((x & 3u))); + x = (x >> b2); + uint const b1 = select(1u, 0u, bool((x & 1u))); + uint const is_zero = select(0u, 4294967295u, (x == 0u)); + return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_47d475() { + uint arg_0 = 1u; + uint res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_47d475(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_47d475(); + return; +} + +kernel void compute_main() { + firstTrailingBit_47d475(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm new file mode 100644 index 0000000000..fba4aa4753 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_47d475 "firstTrailingBit_47d475" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 + %uint_255 = OpConstant %uint 255 + %uint_8 = OpConstant %uint 8 + %uint_15 = OpConstant %uint 15 + %uint_4 = OpConstant %uint 4 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 +%uint_4294967295 = OpConstant %uint 4294967295 + %void = OpTypeVoid + %66 = OpTypeFunction %void + %74 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %13 = OpLabel + %x = OpVariable %_ptr_Function_uint Function %17 + OpStore %x %v + %21 = OpLoad %uint %x + %23 = OpBitwiseAnd %uint %21 %uint_65535 + %19 = OpINotEqual %bool %23 %17 + %18 = OpSelect %uint %19 %17 %uint_16 + %25 = OpLoad %uint %x + %26 = OpShiftRightLogical %uint %25 %18 + OpStore %x %26 + %29 = OpLoad %uint %x + %31 = OpBitwiseAnd %uint %29 %uint_255 + %28 = OpINotEqual %bool %31 %17 + %27 = OpSelect %uint %28 %17 %uint_8 + %33 = OpLoad %uint %x + %34 = OpShiftRightLogical %uint %33 %27 + OpStore %x %34 + %37 = OpLoad %uint %x + %39 = OpBitwiseAnd %uint %37 %uint_15 + %36 = OpINotEqual %bool %39 %17 + %35 = OpSelect %uint %36 %17 %uint_4 + %41 = OpLoad %uint %x + %42 = OpShiftRightLogical %uint %41 %35 + OpStore %x %42 + %45 = OpLoad %uint %x + %47 = OpBitwiseAnd %uint %45 %uint_3 + %44 = OpINotEqual %bool %47 %17 + %43 = OpSelect %uint %44 %17 %uint_2 + %49 = OpLoad %uint %x + %50 = OpShiftRightLogical %uint %49 %43 + OpStore %x %50 + %53 = OpLoad %uint %x + %55 = OpBitwiseAnd %uint %53 %uint_1 + %52 = OpINotEqual %bool %55 %17 + %51 = OpSelect %uint %52 %17 %uint_1 + %57 = OpLoad %uint %x + %58 = OpIEqual %bool %57 %17 + %56 = OpSelect %uint %58 %uint_4294967295 %17 + %61 = OpBitwiseOr %uint %18 %27 + %62 = OpBitwiseOr %uint %61 %35 + %63 = OpBitwiseOr %uint %62 %43 + %64 = OpBitwiseOr %uint %63 %51 + %65 = OpBitwiseOr %uint %64 %56 + OpReturnValue %65 + OpFunctionEnd +%firstTrailingBit_47d475 = OpFunction %void None %66 + %69 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %72 = OpLoad %uint %arg_0 + %71 = OpFunctionCall %uint %tint_first_trailing_bit %72 + OpStore %res %71 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %74 + %76 = OpLabel + %77 = OpFunctionCall %void %firstTrailingBit_47d475 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %66 + %79 = OpLabel + %80 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %80 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %66 + %83 = OpLabel + %84 = OpFunctionCall %void %firstTrailingBit_47d475 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %66 + %86 = OpLabel + %87 = OpFunctionCall %void %firstTrailingBit_47d475 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl new file mode 100644 index 0000000000..4653891507 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_47d475() { + var arg_0 = 1u; + var res : u32 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_47d475(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_47d475(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_47d475(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl new file mode 100644 index 0000000000..75196a7bee --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<2, i32>) -> vec<2, i32> +fn firstTrailingBit_50c072() { + var arg_0 = vec2(1); + var res: vec2 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_50c072(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_50c072(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_50c072(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..85abd4a103 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int2 tint_first_trailing_bit(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + int2 arg_0 = (1).xx; + int2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_50c072(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_50c072(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_50c072(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..85abd4a103 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int2 tint_first_trailing_bit(int2 v) { + uint2 x = uint2(v); + const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx); + x = (x >> b16); + const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx); + x = (x >> b8); + const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx); + x = (x >> b4); + const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx); + x = (x >> b2); + const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx); + const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + int2 arg_0 = (1).xx; + int2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_50c072(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_50c072(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_50c072(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl new file mode 100644 index 0000000000..68c8393a7f --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec2 tint_first_trailing_bit(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_50c072(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_first_trailing_bit(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_50c072(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_first_trailing_bit(ivec2 v) { + uvec2 x = uvec2(v); + uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u)))); + x = (x >> b16); + uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u)))); + x = (x >> b8); + uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u)))); + x = (x >> b4); + uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u)))); + x = (x >> b2); + uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u)))); + uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u))); + return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + ivec2 arg_0 = ivec2(1); + ivec2 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_50c072(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl new file mode 100644 index 0000000000..1b4e0cfb1a --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int2 tint_first_trailing_bit(int2 v) { + uint2 x = uint2(v); + uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u)))); + x = (x >> b16); + uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u)))); + x = (x >> b8); + uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u)))); + x = (x >> b4); + uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u)))); + x = (x >> b2); + uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u)))); + uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u))); + return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_50c072() { + int2 arg_0 = int2(1); + int2 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_50c072(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_50c072(); + return; +} + +kernel void compute_main() { + firstTrailingBit_50c072(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm new file mode 100644 index 0000000000..c7663e131a --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm @@ -0,0 +1,152 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 106 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_50c072 "firstTrailingBit_50c072" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int %v2int + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %20 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v2uint %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v2uint %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v2uint %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v2uint %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v2uint %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v2uint %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v2uint %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v2uint %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %73 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %85 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %88 = OpConstantNull %v2int + %92 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v2uint Function %20 + %15 = OpBitcast %v2uint %v + OpStore %x %15 + %25 = OpLoad %v2uint %x + %28 = OpBitwiseAnd %v2uint %25 %27 + %22 = OpINotEqual %v2bool %28 %20 + %21 = OpSelect %v2uint %22 %20 %30 + %31 = OpLoad %v2uint %x + %32 = OpShiftRightLogical %v2uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v2uint %x + %38 = OpBitwiseAnd %v2uint %35 %37 + %34 = OpINotEqual %v2bool %38 %20 + %33 = OpSelect %v2uint %34 %20 %40 + %41 = OpLoad %v2uint %x + %42 = OpShiftRightLogical %v2uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v2uint %x + %48 = OpBitwiseAnd %v2uint %45 %47 + %44 = OpINotEqual %v2bool %48 %20 + %43 = OpSelect %v2uint %44 %20 %50 + %51 = OpLoad %v2uint %x + %52 = OpShiftRightLogical %v2uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v2uint %x + %58 = OpBitwiseAnd %v2uint %55 %57 + %54 = OpINotEqual %v2bool %58 %20 + %53 = OpSelect %v2uint %54 %20 %60 + %61 = OpLoad %v2uint %x + %62 = OpShiftRightLogical %v2uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v2uint %x + %68 = OpBitwiseAnd %v2uint %65 %67 + %64 = OpINotEqual %v2bool %68 %20 + %63 = OpSelect %v2uint %64 %20 %67 + %70 = OpLoad %v2uint %x + %71 = OpIEqual %v2bool %70 %20 + %69 = OpSelect %v2uint %71 %73 %20 + %75 = OpBitwiseOr %v2uint %21 %33 + %76 = OpBitwiseOr %v2uint %75 %43 + %77 = OpBitwiseOr %v2uint %76 %53 + %78 = OpBitwiseOr %v2uint %77 %63 + %79 = OpBitwiseOr %v2uint %78 %69 + %74 = OpBitcast %v2int %79 + OpReturnValue %74 + OpFunctionEnd +%firstTrailingBit_50c072 = OpFunction %void None %80 + %83 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %88 + %res = OpVariable %_ptr_Function_v2int Function %88 + OpStore %arg_0 %85 + %90 = OpLoad %v2int %arg_0 + %89 = OpFunctionCall %v2int %tint_first_trailing_bit %90 + OpStore %res %89 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %92 + %94 = OpLabel + %95 = OpFunctionCall %void %firstTrailingBit_50c072 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %80 + %97 = OpLabel + %98 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %98 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %80 + %101 = OpLabel + %102 = OpFunctionCall %void %firstTrailingBit_50c072 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %80 + %104 = OpLabel + %105 = OpFunctionCall %void %firstTrailingBit_50c072 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl new file mode 100644 index 0000000000..055d7c801d --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_50c072() { + var arg_0 = vec2(1); + var res : vec2 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_50c072(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_50c072(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_50c072(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl new file mode 100644 index 0000000000..57da8ed513 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<3, i32>) -> vec<3, i32> +fn firstTrailingBit_7496d6() { + var arg_0 = vec3(1); + var res: vec3 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_7496d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_7496d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_7496d6(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..91c45c1629 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int3 tint_first_trailing_bit(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + int3 arg_0 = (1).xxx; + int3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_7496d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_7496d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_7496d6(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..91c45c1629 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int3 tint_first_trailing_bit(int3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + int3 arg_0 = (1).xxx; + int3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_7496d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_7496d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_7496d6(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl new file mode 100644 index 0000000000..43ab7d83ab --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec3 tint_first_trailing_bit(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_7496d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_first_trailing_bit(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_7496d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_first_trailing_bit(ivec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + ivec3 arg_0 = ivec3(1); + ivec3 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_7496d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl new file mode 100644 index 0000000000..c1b2b08189 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int3 tint_first_trailing_bit(int3 v) { + uint3 x = uint3(v); + uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_7496d6() { + int3 arg_0 = int3(1); + int3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_7496d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_7496d6(); + return; +} + +kernel void compute_main() { + firstTrailingBit_7496d6(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..de9c0d8445 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm @@ -0,0 +1,152 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 106 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_7496d6 "firstTrailingBit_7496d6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int %v3int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %20 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %73 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %85 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %88 = OpConstantNull %v3int + %92 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %20 + %15 = OpBitcast %v3uint %v + OpStore %x %15 + %25 = OpLoad %v3uint %x + %28 = OpBitwiseAnd %v3uint %25 %27 + %22 = OpINotEqual %v3bool %28 %20 + %21 = OpSelect %v3uint %22 %20 %30 + %31 = OpLoad %v3uint %x + %32 = OpShiftRightLogical %v3uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v3uint %x + %38 = OpBitwiseAnd %v3uint %35 %37 + %34 = OpINotEqual %v3bool %38 %20 + %33 = OpSelect %v3uint %34 %20 %40 + %41 = OpLoad %v3uint %x + %42 = OpShiftRightLogical %v3uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v3uint %x + %48 = OpBitwiseAnd %v3uint %45 %47 + %44 = OpINotEqual %v3bool %48 %20 + %43 = OpSelect %v3uint %44 %20 %50 + %51 = OpLoad %v3uint %x + %52 = OpShiftRightLogical %v3uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v3uint %x + %58 = OpBitwiseAnd %v3uint %55 %57 + %54 = OpINotEqual %v3bool %58 %20 + %53 = OpSelect %v3uint %54 %20 %60 + %61 = OpLoad %v3uint %x + %62 = OpShiftRightLogical %v3uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v3uint %x + %68 = OpBitwiseAnd %v3uint %65 %67 + %64 = OpINotEqual %v3bool %68 %20 + %63 = OpSelect %v3uint %64 %20 %67 + %70 = OpLoad %v3uint %x + %71 = OpIEqual %v3bool %70 %20 + %69 = OpSelect %v3uint %71 %73 %20 + %75 = OpBitwiseOr %v3uint %21 %33 + %76 = OpBitwiseOr %v3uint %75 %43 + %77 = OpBitwiseOr %v3uint %76 %53 + %78 = OpBitwiseOr %v3uint %77 %63 + %79 = OpBitwiseOr %v3uint %78 %69 + %74 = OpBitcast %v3int %79 + OpReturnValue %74 + OpFunctionEnd +%firstTrailingBit_7496d6 = OpFunction %void None %80 + %83 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %88 + %res = OpVariable %_ptr_Function_v3int Function %88 + OpStore %arg_0 %85 + %90 = OpLoad %v3int %arg_0 + %89 = OpFunctionCall %v3int %tint_first_trailing_bit %90 + OpStore %res %89 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %92 + %94 = OpLabel + %95 = OpFunctionCall %void %firstTrailingBit_7496d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %80 + %97 = OpLabel + %98 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %98 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %80 + %101 = OpLabel + %102 = OpFunctionCall %void %firstTrailingBit_7496d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %80 + %104 = OpLabel + %105 = OpFunctionCall %void %firstTrailingBit_7496d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d9963671b --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_7496d6() { + var arg_0 = vec3(1); + var res : vec3 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_7496d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_7496d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_7496d6(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl new file mode 100644 index 0000000000..ace5fb380f --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<4, i32>) -> vec<4, i32> +fn firstTrailingBit_86551b() { + var arg_0 = vec4(1); + var res: vec4 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_86551b(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_86551b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_86551b(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3af45b0288 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +int4 tint_first_trailing_bit(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + int4 arg_0 = (1).xxxx; + int4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_86551b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_86551b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_86551b(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3af45b0288 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +int4 tint_first_trailing_bit(int4 v) { + uint4 x = uint4(v); + const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx); + x = (x >> b16); + const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx); + x = (x >> b8); + const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx); + x = (x >> b4); + const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx); + x = (x >> b2); + const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx); + const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + int4 arg_0 = (1).xxxx; + int4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_86551b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_86551b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_86551b(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl new file mode 100644 index 0000000000..5738b7c6e6 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +ivec4 tint_first_trailing_bit(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_86551b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_first_trailing_bit(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_86551b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_first_trailing_bit(ivec4 v) { + uvec4 x = uvec4(v); + uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u)))); + x = (x >> b16); + uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u)))); + x = (x >> b8); + uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u)))); + x = (x >> b4); + uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u)))); + x = (x >> b2); + uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u)))); + uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u))); + return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + ivec4 arg_0 = ivec4(1); + ivec4 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_86551b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl new file mode 100644 index 0000000000..a74be59c9a --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +int4 tint_first_trailing_bit(int4 v) { + uint4 x = uint4(v); + uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u)))); + x = (x >> b16); + uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u)))); + x = (x >> b8); + uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u)))); + x = (x >> b4); + uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u)))); + x = (x >> b2); + uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u)))); + uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u))); + return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_86551b() { + int4 arg_0 = int4(1); + int4 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_86551b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_86551b(); + return; +} + +kernel void compute_main() { + firstTrailingBit_86551b(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm new file mode 100644 index 0000000000..b62d585f21 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm @@ -0,0 +1,152 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 106 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_86551b "firstTrailingBit_86551b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int %v4int + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %20 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %uint_65535 = OpConstant %uint 65535 + %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %73 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %85 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %88 = OpConstantNull %v4int + %92 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %14 = OpLabel + %x = OpVariable %_ptr_Function_v4uint Function %20 + %15 = OpBitcast %v4uint %v + OpStore %x %15 + %25 = OpLoad %v4uint %x + %28 = OpBitwiseAnd %v4uint %25 %27 + %22 = OpINotEqual %v4bool %28 %20 + %21 = OpSelect %v4uint %22 %20 %30 + %31 = OpLoad %v4uint %x + %32 = OpShiftRightLogical %v4uint %31 %21 + OpStore %x %32 + %35 = OpLoad %v4uint %x + %38 = OpBitwiseAnd %v4uint %35 %37 + %34 = OpINotEqual %v4bool %38 %20 + %33 = OpSelect %v4uint %34 %20 %40 + %41 = OpLoad %v4uint %x + %42 = OpShiftRightLogical %v4uint %41 %33 + OpStore %x %42 + %45 = OpLoad %v4uint %x + %48 = OpBitwiseAnd %v4uint %45 %47 + %44 = OpINotEqual %v4bool %48 %20 + %43 = OpSelect %v4uint %44 %20 %50 + %51 = OpLoad %v4uint %x + %52 = OpShiftRightLogical %v4uint %51 %43 + OpStore %x %52 + %55 = OpLoad %v4uint %x + %58 = OpBitwiseAnd %v4uint %55 %57 + %54 = OpINotEqual %v4bool %58 %20 + %53 = OpSelect %v4uint %54 %20 %60 + %61 = OpLoad %v4uint %x + %62 = OpShiftRightLogical %v4uint %61 %53 + OpStore %x %62 + %65 = OpLoad %v4uint %x + %68 = OpBitwiseAnd %v4uint %65 %67 + %64 = OpINotEqual %v4bool %68 %20 + %63 = OpSelect %v4uint %64 %20 %67 + %70 = OpLoad %v4uint %x + %71 = OpIEqual %v4bool %70 %20 + %69 = OpSelect %v4uint %71 %73 %20 + %75 = OpBitwiseOr %v4uint %21 %33 + %76 = OpBitwiseOr %v4uint %75 %43 + %77 = OpBitwiseOr %v4uint %76 %53 + %78 = OpBitwiseOr %v4uint %77 %63 + %79 = OpBitwiseOr %v4uint %78 %69 + %74 = OpBitcast %v4int %79 + OpReturnValue %74 + OpFunctionEnd +%firstTrailingBit_86551b = OpFunction %void None %80 + %83 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %88 + %res = OpVariable %_ptr_Function_v4int Function %88 + OpStore %arg_0 %85 + %90 = OpLoad %v4int %arg_0 + %89 = OpFunctionCall %v4int %tint_first_trailing_bit %90 + OpStore %res %89 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %92 + %94 = OpLabel + %95 = OpFunctionCall %void %firstTrailingBit_86551b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %80 + %97 = OpLabel + %98 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %98 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %80 + %101 = OpLabel + %102 = OpFunctionCall %void %firstTrailingBit_86551b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %80 + %104 = OpLabel + %105 = OpFunctionCall %void %firstTrailingBit_86551b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl new file mode 100644 index 0000000000..83011241a4 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_86551b() { + var arg_0 = vec4(1); + var res : vec4 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_86551b(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_86551b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_86551b(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl new file mode 100644 index 0000000000..048b174b3e --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn firstTrailingBit(vec<3, u32>) -> vec<3, u32> +fn firstTrailingBit_cb51ce() { + var arg_0 = vec3(1u); + var res: vec3 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_cb51ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_cb51ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_cb51ce(); +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..27105f4273 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,46 @@ +uint3 tint_first_trailing_bit(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uint3 arg_0 = (1u).xxx; + uint3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_cb51ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_cb51ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_cb51ce(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..27105f4273 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +uint3 tint_first_trailing_bit(uint3 v) { + uint3 x = uint3(v); + const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx); + x = (x >> b16); + const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx); + x = (x >> b8); + const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx); + x = (x >> b4); + const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx); + x = (x >> b2); + const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx); + const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uint3 arg_0 = (1u).xxx; + uint3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + firstTrailingBit_cb51ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + firstTrailingBit_cb51ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + firstTrailingBit_cb51ce(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl new file mode 100644 index 0000000000..3afc2b037e --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl @@ -0,0 +1,97 @@ +#version 310 es + +uvec3 tint_first_trailing_bit(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_first_trailing_bit(arg_0); +} + +vec4 vertex_main() { + firstTrailingBit_cb51ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_first_trailing_bit(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_first_trailing_bit(arg_0); +} + +void fragment_main() { + firstTrailingBit_cb51ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_first_trailing_bit(uvec3 v) { + uvec3 x = uvec3(v); + uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u)))); + x = (x >> b16); + uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u)))); + x = (x >> b8); + uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u)))); + x = (x >> b4); + uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u)))); + x = (x >> b2); + uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u)))); + uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u))); + return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = tint_first_trailing_bit(arg_0); +} + +void compute_main() { + firstTrailingBit_cb51ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl new file mode 100644 index 0000000000..d35012ccc6 --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +uint3 tint_first_trailing_bit(uint3 v) { + uint3 x = uint3(v); + uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u)))); + x = (x >> b16); + uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u)))); + x = (x >> b8); + uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u)))); + x = (x >> b4); + uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u)))); + x = (x >> b2); + uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u)))); + uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u))); + return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero)); +} + +void firstTrailingBit_cb51ce() { + uint3 arg_0 = uint3(1u); + uint3 res = tint_first_trailing_bit(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + firstTrailingBit_cb51ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + firstTrailingBit_cb51ce(); + return; +} + +kernel void compute_main() { + firstTrailingBit_cb51ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1d62698fe --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_first_trailing_bit "tint_first_trailing_bit" + OpName %v "v" + OpName %x "x" + OpName %firstTrailingBit_cb51ce "firstTrailingBit_cb51ce" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %18 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %uint_65535 = OpConstant %uint 65535 + %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535 + %uint_16 = OpConstant %uint 16 + %28 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16 + %uint_255 = OpConstant %uint 255 + %35 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255 + %uint_8 = OpConstant %uint 8 + %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8 + %uint_15 = OpConstant %uint 15 + %45 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15 + %uint_4 = OpConstant %uint 4 + %48 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4 + %uint_3 = OpConstant %uint 3 + %55 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 + %uint_2 = OpConstant %uint 2 + %58 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2 + %uint_1 = OpConstant %uint 1 + %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%uint_4294967295 = OpConstant %uint 4294967295 + %71 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295 + %void = OpTypeVoid + %78 = OpTypeFunction %void + %86 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_first_trailing_bit = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %14 = OpLabel + %x = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %x %v + %23 = OpLoad %v3uint %x + %26 = OpBitwiseAnd %v3uint %23 %25 + %20 = OpINotEqual %v3bool %26 %18 + %19 = OpSelect %v3uint %20 %18 %28 + %29 = OpLoad %v3uint %x + %30 = OpShiftRightLogical %v3uint %29 %19 + OpStore %x %30 + %33 = OpLoad %v3uint %x + %36 = OpBitwiseAnd %v3uint %33 %35 + %32 = OpINotEqual %v3bool %36 %18 + %31 = OpSelect %v3uint %32 %18 %38 + %39 = OpLoad %v3uint %x + %40 = OpShiftRightLogical %v3uint %39 %31 + OpStore %x %40 + %43 = OpLoad %v3uint %x + %46 = OpBitwiseAnd %v3uint %43 %45 + %42 = OpINotEqual %v3bool %46 %18 + %41 = OpSelect %v3uint %42 %18 %48 + %49 = OpLoad %v3uint %x + %50 = OpShiftRightLogical %v3uint %49 %41 + OpStore %x %50 + %53 = OpLoad %v3uint %x + %56 = OpBitwiseAnd %v3uint %53 %55 + %52 = OpINotEqual %v3bool %56 %18 + %51 = OpSelect %v3uint %52 %18 %58 + %59 = OpLoad %v3uint %x + %60 = OpShiftRightLogical %v3uint %59 %51 + OpStore %x %60 + %63 = OpLoad %v3uint %x + %66 = OpBitwiseAnd %v3uint %63 %65 + %62 = OpINotEqual %v3bool %66 %18 + %61 = OpSelect %v3uint %62 %18 %65 + %68 = OpLoad %v3uint %x + %69 = OpIEqual %v3bool %68 %18 + %67 = OpSelect %v3uint %69 %71 %18 + %73 = OpBitwiseOr %v3uint %19 %31 + %74 = OpBitwiseOr %v3uint %73 %41 + %75 = OpBitwiseOr %v3uint %74 %51 + %76 = OpBitwiseOr %v3uint %75 %61 + %77 = OpBitwiseOr %v3uint %76 %67 + OpReturnValue %77 + OpFunctionEnd +%firstTrailingBit_cb51ce = OpFunction %void None %78 + %81 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %18 + %res = OpVariable %_ptr_Function_v3uint Function %18 + OpStore %arg_0 %65 + %84 = OpLoad %v3uint %arg_0 + %83 = OpFunctionCall %v3uint %tint_first_trailing_bit %84 + OpStore %res %83 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %86 + %88 = OpLabel + %89 = OpFunctionCall %void %firstTrailingBit_cb51ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %78 + %91 = OpLabel + %92 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %92 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %78 + %95 = OpLabel + %96 = OpFunctionCall %void %firstTrailingBit_cb51ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %78 + %98 = OpLabel + %99 = OpFunctionCall %void %firstTrailingBit_cb51ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..cb7c799f4a --- /dev/null +++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn firstTrailingBit_cb51ce() { + var arg_0 = vec3(1u); + var res : vec3 = firstTrailingBit(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + firstTrailingBit_cb51ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + firstTrailingBit_cb51ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + firstTrailingBit_cb51ce(); +} diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl new file mode 100644 index 0000000000..22ede14734 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<3, f16>) -> vec<3, f16> +fn floor_3802c0() { + var arg_0 = vec3(f16()); + var res: vec3 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3802c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3802c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3802c0(); +} diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a997d823f0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_3802c0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3802c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3802c0(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e3478266ea --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void floor_3802c0() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3802c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3802c0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CFD3102AA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002CFD3102AA0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.glsl new file mode 100644 index 0000000000..2f0dabfa35 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_3802c0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_3802c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_3802c0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = floor(arg_0); +} + +void fragment_main() { + floor_3802c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_3802c0() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = floor(arg_0); +} + +void compute_main() { + floor_3802c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.msl new file mode 100644 index 0000000000..48f2187e8d --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_3802c0() { + half3 arg_0 = half3(0.0h); + half3 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_3802c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_3802c0(); + return; +} + +kernel void compute_main() { + floor_3802c0(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c34a52ae4 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_3802c0 "floor_3802c0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_3802c0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Floor %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %floor_3802c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_3802c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %floor_3802c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..e668dbc57e --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3802c0.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn floor_3802c0() { + var arg_0 = vec3(f16()); + var res : vec3 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3802c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3802c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3802c0(); +} diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl new file mode 100644 index 0000000000..6f1745a85b --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(vec<4, f32>) -> vec<4, f32> +fn floor_3bccc4() { + var arg_0 = vec4(1.f); + var res: vec4 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3bccc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3bccc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3bccc4(); +} diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..550e52d01e --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_3bccc4() { + float4 arg_0 = (1.0f).xxxx; + float4 res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3bccc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3bccc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3bccc4(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..550e52d01e --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void floor_3bccc4() { + float4 arg_0 = (1.0f).xxxx; + float4 res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_3bccc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_3bccc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_3bccc4(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl new file mode 100644 index 0000000000..431bdefc65 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void floor_3bccc4() { + vec4 arg_0 = vec4(1.0f); + vec4 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_3bccc4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_3bccc4() { + vec4 arg_0 = vec4(1.0f); + vec4 res = floor(arg_0); +} + +void fragment_main() { + floor_3bccc4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_3bccc4() { + vec4 arg_0 = vec4(1.0f); + vec4 res = floor(arg_0); +} + +void compute_main() { + floor_3bccc4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl new file mode 100644 index 0000000000..b9607dc6a4 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_3bccc4() { + float4 arg_0 = float4(1.0f); + float4 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_3bccc4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_3bccc4(); + return; +} + +kernel void compute_main() { + floor_3bccc4(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..dadadc8826 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_3bccc4 "floor_3bccc4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%floor_3bccc4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Floor %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %floor_3bccc4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %floor_3bccc4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %floor_3bccc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..6600c70305 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn floor_3bccc4() { + var arg_0 = vec4(1.0f); + var res : vec4 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_3bccc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_3bccc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_3bccc4(); +} diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl new file mode 100644 index 0000000000..8681a51bbe --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(vec<2, f32>) -> vec<2, f32> +fn floor_5fc9ac() { + var arg_0 = vec2(1.f); + var res: vec2 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_5fc9ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_5fc9ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_5fc9ac(); +} diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dca7290a48 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_5fc9ac() { + float2 arg_0 = (1.0f).xx; + float2 res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_5fc9ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_5fc9ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_5fc9ac(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dca7290a48 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void floor_5fc9ac() { + float2 arg_0 = (1.0f).xx; + float2 res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_5fc9ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_5fc9ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_5fc9ac(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl new file mode 100644 index 0000000000..abd2378146 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void floor_5fc9ac() { + vec2 arg_0 = vec2(1.0f); + vec2 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_5fc9ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_5fc9ac() { + vec2 arg_0 = vec2(1.0f); + vec2 res = floor(arg_0); +} + +void fragment_main() { + floor_5fc9ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_5fc9ac() { + vec2 arg_0 = vec2(1.0f); + vec2 res = floor(arg_0); +} + +void compute_main() { + floor_5fc9ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl new file mode 100644 index 0000000000..5e718db49b --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_5fc9ac() { + float2 arg_0 = float2(1.0f); + float2 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_5fc9ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_5fc9ac(); + return; +} + +kernel void compute_main() { + floor_5fc9ac(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..045c8c9e5e --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_5fc9ac "floor_5fc9ac" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%floor_5fc9ac = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Floor %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %floor_5fc9ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_5fc9ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %floor_5fc9ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..a961b8d966 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn floor_5fc9ac() { + var arg_0 = vec2(1.0f); + var res : vec2 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_5fc9ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_5fc9ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_5fc9ac(); +} diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl new file mode 100644 index 0000000000..08b74048a2 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(vec<3, f32>) -> vec<3, f32> +fn floor_60d7ea() { + var arg_0 = vec3(1.f); + var res: vec3 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_60d7ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_60d7ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_60d7ea(); +} diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2c0000b321 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_60d7ea() { + float3 arg_0 = (1.0f).xxx; + float3 res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_60d7ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_60d7ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_60d7ea(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2c0000b321 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void floor_60d7ea() { + float3 arg_0 = (1.0f).xxx; + float3 res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_60d7ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_60d7ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_60d7ea(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl new file mode 100644 index 0000000000..03b1b4a7a9 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void floor_60d7ea() { + vec3 arg_0 = vec3(1.0f); + vec3 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_60d7ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_60d7ea() { + vec3 arg_0 = vec3(1.0f); + vec3 res = floor(arg_0); +} + +void fragment_main() { + floor_60d7ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_60d7ea() { + vec3 arg_0 = vec3(1.0f); + vec3 res = floor(arg_0); +} + +void compute_main() { + floor_60d7ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl new file mode 100644 index 0000000000..74b2f97f60 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_60d7ea() { + float3 arg_0 = float3(1.0f); + float3 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_60d7ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_60d7ea(); + return; +} + +kernel void compute_main() { + floor_60d7ea(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..94973ec905 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_60d7ea "floor_60d7ea" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%floor_60d7ea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Floor %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %floor_60d7ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_60d7ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %floor_60d7ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1427d9e06 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn floor_60d7ea() { + var arg_0 = vec3(1.0f); + var res : vec3 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_60d7ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_60d7ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_60d7ea(); +} diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl b/test/tint/builtins/gen/var/floor/66f154.wgsl new file mode 100644 index 0000000000..e035b37db9 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn floor(f32) -> f32 +fn floor_66f154() { + var arg_0 = 1.f; + var res: f32 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_66f154(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_66f154(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_66f154(); +} diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..43aecf810f --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_66f154(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_66f154(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_66f154(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43aecf810f --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_66f154(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_66f154(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_66f154(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl new file mode 100644 index 0000000000..4de296cd7c --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +vec4 vertex_main() { + floor_66f154(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +void fragment_main() { + floor_66f154(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +void compute_main() { + floor_66f154(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl new file mode 100644 index 0000000000..577960f4a8 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_66f154() { + float arg_0 = 1.0f; + float res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_66f154(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_66f154(); + return; +} + +kernel void compute_main() { + floor_66f154(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm new file mode 100644 index 0000000000..dc8849461d --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_66f154 "floor_66f154" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%floor_66f154 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Floor %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %floor_66f154 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %floor_66f154 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_66f154 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl new file mode 100644 index 0000000000..72c13767a0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn floor_66f154() { + var arg_0 = 1.0f; + var res : f32 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_66f154(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_66f154(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_66f154(); +} diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl b/test/tint/builtins/gen/var/floor/84658c.wgsl new file mode 100644 index 0000000000..9cf6d75491 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<2, f16>) -> vec<2, f16> +fn floor_84658c() { + var arg_0 = vec2(f16()); + var res: vec2 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_84658c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_84658c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_84658c(); +} diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d10e8f8b52 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_84658c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_84658c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_84658c(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04bf97acdc --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void floor_84658c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_84658c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_84658c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000208743D86D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000208743D86D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.glsl new file mode 100644 index 0000000000..6c2236fcc7 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_84658c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_84658c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_84658c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = floor(arg_0); +} + +void fragment_main() { + floor_84658c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_84658c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = floor(arg_0); +} + +void compute_main() { + floor_84658c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.msl new file mode 100644 index 0000000000..dbc91a4c58 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_84658c() { + half2 arg_0 = half2(0.0h); + half2 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_84658c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_84658c(); + return; +} + +kernel void compute_main() { + floor_84658c(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ab1072c26 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_84658c "floor_84658c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_84658c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Floor %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %floor_84658c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_84658c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %floor_84658c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.wgsl new file mode 100644 index 0000000000..af40f90ea0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/84658c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn floor_84658c() { + var arg_0 = vec2(f16()); + var res : vec2 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_84658c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_84658c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_84658c(); +} diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl new file mode 100644 index 0000000000..edc990a1fe --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(vec<4, f16>) -> vec<4, f16> +fn floor_a2d31b() { + var arg_0 = vec4(f16()); + var res: vec4 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_a2d31b(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_a2d31b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_a2d31b(); +} diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3eccce668e --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_a2d31b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_a2d31b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_a2d31b(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b670bde492 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void floor_a2d31b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_a2d31b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_a2d31b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020277229EB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020277229EB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.glsl new file mode 100644 index 0000000000..4e2d116377 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_a2d31b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = floor(arg_0); +} + +vec4 vertex_main() { + floor_a2d31b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_a2d31b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = floor(arg_0); +} + +void fragment_main() { + floor_a2d31b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_a2d31b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = floor(arg_0); +} + +void compute_main() { + floor_a2d31b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.msl new file mode 100644 index 0000000000..521eda3580 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_a2d31b() { + half4 arg_0 = half4(0.0h); + half4 res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_a2d31b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_a2d31b(); + return; +} + +kernel void compute_main() { + floor_a2d31b(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.spvasm new file mode 100644 index 0000000000..4cf75b1f50 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_a2d31b "floor_a2d31b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_a2d31b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Floor %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %floor_a2d31b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %floor_a2d31b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %floor_a2d31b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b23f7d38a --- /dev/null +++ b/test/tint/builtins/gen/var/floor/a2d31b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn floor_a2d31b() { + var arg_0 = vec4(f16()); + var res : vec4 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_a2d31b(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_a2d31b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_a2d31b(); +} diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl new file mode 100644 index 0000000000..7ddbc74948 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn floor(f16) -> f16 +fn floor_b6e09c() { + var arg_0 = f16(); + var res: f16 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_b6e09c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_b6e09c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_b6e09c(); +} diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a13fef1f77 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void floor_b6e09c() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_b6e09c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_b6e09c(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04d82705d0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void floor_b6e09c() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = floor(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + floor_b6e09c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + floor_b6e09c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FC8E37C9F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FC8E37C9F0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.glsl new file mode 100644 index 0000000000..5a9ededee0 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_b6e09c() { + float16_t arg_0 = 0.0hf; + float16_t res = floor(arg_0); +} + +vec4 vertex_main() { + floor_b6e09c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void floor_b6e09c() { + float16_t arg_0 = 0.0hf; + float16_t res = floor(arg_0); +} + +void fragment_main() { + floor_b6e09c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void floor_b6e09c() { + float16_t arg_0 = 0.0hf; + float16_t res = floor(arg_0); +} + +void compute_main() { + floor_b6e09c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.msl new file mode 100644 index 0000000000..eddf8f2c10 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void floor_b6e09c() { + half arg_0 = 0.0h; + half res = floor(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + floor_b6e09c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + floor_b6e09c(); + return; +} + +kernel void compute_main() { + floor_b6e09c(); + return; +} + diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.spvasm new file mode 100644 index 0000000000..45cc608104 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %floor_b6e09c "floor_b6e09c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%floor_b6e09c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Floor %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %floor_b6e09c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %floor_b6e09c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %floor_b6e09c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.wgsl new file mode 100644 index 0000000000..68db5d7201 --- /dev/null +++ b/test/tint/builtins/gen/var/floor/b6e09c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn floor_b6e09c() { + var arg_0 = f16(); + var res : f16 = floor(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + floor_b6e09c(); + return vec4(); +} + +@fragment +fn fragment_main() { + floor_b6e09c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + floor_b6e09c(); +} diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl new file mode 100644 index 0000000000..e47de3231f --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn fma_26a7a9() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var arg_2 = vec2(1.f); + var res: vec2 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_26a7a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_26a7a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_26a7a9(); +} diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8f2ec1e29b --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_26a7a9() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_26a7a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_26a7a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_26a7a9(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8f2ec1e29b --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void fma_26a7a9() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_26a7a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_26a7a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_26a7a9(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl new file mode 100644 index 0000000000..f2f2970ca5 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void fma_26a7a9() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_26a7a9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_26a7a9() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_26a7a9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_26a7a9() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_26a7a9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl new file mode 100644 index 0000000000..c863f64eb1 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_26a7a9() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 arg_2 = float2(1.0f); + float2 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_26a7a9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_26a7a9(); + return; +} + +kernel void compute_main() { + fma_26a7a9(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm new file mode 100644 index 0000000000..46a54af7ca --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_26a7a9 "fma_26a7a9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %27 = OpTypeFunction %v4float + %fma_26a7a9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %arg_2 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v2float %arg_0 + %24 = OpLoad %v2float %arg_1 + %25 = OpLoad %v2float %arg_2 + %21 = OpExtInst %v2float %22 Fma %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_26a7a9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_26a7a9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %fma_26a7a9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl new file mode 100644 index 0000000000..213d68077c --- /dev/null +++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn fma_26a7a9() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var arg_2 = vec2(1.0f); + var res : vec2 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_26a7a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_26a7a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_26a7a9(); +} diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl new file mode 100644 index 0000000000..94a268c714 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn fma_6a3283() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var arg_2 = vec4(1.f); + var res: vec4 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_6a3283(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_6a3283(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_6a3283(); +} diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52370323bb --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_6a3283() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_6a3283(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_6a3283(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_6a3283(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52370323bb --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void fma_6a3283() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_6a3283(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_6a3283(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_6a3283(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl new file mode 100644 index 0000000000..381001c265 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void fma_6a3283() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_6a3283(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_6a3283() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_6a3283(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_6a3283() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_6a3283(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl new file mode 100644 index 0000000000..0e48f02a40 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_6a3283() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 arg_2 = float4(1.0f); + float4 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_6a3283(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_6a3283(); + return; +} + +kernel void compute_main() { + fma_6a3283(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm new file mode 100644 index 0000000000..a33378950d --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_6a3283 "fma_6a3283" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %v4float + %fma_6a3283 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v4float %arg_0 + %22 = OpLoad %v4float %arg_1 + %23 = OpLoad %v4float %arg_2 + %19 = OpExtInst %v4float %20 Fma %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %fma_6a3283 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %fma_6a3283 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %fma_6a3283 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl new file mode 100644 index 0000000000..a514d9da21 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn fma_6a3283() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var arg_2 = vec4(1.0f); + var res : vec4 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_6a3283(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_6a3283(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_6a3283(); +} diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl new file mode 100644 index 0000000000..ab0ffd7e47 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn fma_ab7818() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_ab7818(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_ab7818(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_ab7818(); +} diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ba7fd240c1 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_ab7818() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_ab7818(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_ab7818(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4cc79d74ea --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void fma_ab7818() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_ab7818(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_ab7818(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8EC063920(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8EC063920(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8EC063920(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8EC063920(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.glsl new file mode 100644 index 0000000000..210f2f999d --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_ab7818() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_ab7818(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_ab7818() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_ab7818(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_ab7818() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_ab7818(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.msl new file mode 100644 index 0000000000..7618e6d448 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_ab7818() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_ab7818(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_ab7818(); + return; +} + +kernel void compute_main() { + fma_ab7818(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfe30fe69c --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_ab7818 "fma_ab7818" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_ab7818 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 Fma %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %fma_ab7818 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_ab7818 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %fma_ab7818 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.wgsl new file mode 100644 index 0000000000..14808bab52 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/ab7818.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn fma_ab7818() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_ab7818(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_ab7818(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_ab7818(); +} diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl new file mode 100644 index 0000000000..7fa271160c --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn fma_bf21b6() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_bf21b6(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_bf21b6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_bf21b6(); +} diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fad050827b --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_bf21b6() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_bf21b6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_bf21b6(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c30ed3a656 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void fma_bf21b6() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_bf21b6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_bf21b6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000213565C3920(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000213565C3920(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000213565C3920(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000213565C3920(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.glsl new file mode 100644 index 0000000000..d6376ec1ff --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_bf21b6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_bf21b6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_bf21b6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_bf21b6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_bf21b6() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_bf21b6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.msl new file mode 100644 index 0000000000..fd5f39ce59 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_bf21b6() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_bf21b6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_bf21b6(); + return; +} + +kernel void compute_main() { + fma_bf21b6(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.spvasm new file mode 100644 index 0000000000..d66229d6f1 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_bf21b6 "fma_bf21b6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_bf21b6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 Fma %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %fma_bf21b6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_bf21b6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %fma_bf21b6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.wgsl new file mode 100644 index 0000000000..aef061d83a --- /dev/null +++ b/test/tint/builtins/gen/var/fma/bf21b6.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn fma_bf21b6() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_bf21b6(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_bf21b6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_bf21b6(); +} diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl new file mode 100644 index 0000000000..5dac8346b1 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(f32, f32, f32) -> f32 +fn fma_c10ba3() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var arg_2 = 1.f; + var res: f32 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c10ba3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c10ba3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c10ba3(); +} diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c4b6a2d3f --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c10ba3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c10ba3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c10ba3(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c4b6a2d3f --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c10ba3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c10ba3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c10ba3(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl new file mode 100644 index 0000000000..895f1bc45e --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_c10ba3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_c10ba3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_c10ba3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl new file mode 100644 index 0000000000..a58b323c9a --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_c10ba3() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_c10ba3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_c10ba3(); + return; +} + +kernel void compute_main() { + fma_c10ba3(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm new file mode 100644 index 0000000000..5c99fc8eda --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_c10ba3 "fma_c10ba3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float + %fma_c10ba3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %float_1 + %20 = OpLoad %float %arg_0 + %21 = OpLoad %float %arg_1 + %22 = OpLoad %float %arg_2 + %18 = OpExtInst %float %19 Fma %20 %21 %22 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %fma_c10ba3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fma_c10ba3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_c10ba3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ccb70f458 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn fma_c10ba3() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var arg_2 = 1.0f; + var res : f32 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c10ba3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c10ba3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c10ba3(); +} diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl new file mode 100644 index 0000000000..c86a6991f0 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(f16, f16, f16) -> f16 +fn fma_c8abb3() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res: f16 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c8abb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c8abb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c8abb3(); +} diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ce25e33259 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_c8abb3() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c8abb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c8abb3(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0085a06f40 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void fma_c8abb3() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_c8abb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_c8abb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001545EC319C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001545EC319C0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.glsl new file mode 100644 index 0000000000..971fb93533 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_c8abb3() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_c8abb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_c8abb3() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_c8abb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_c8abb3() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_c8abb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.msl new file mode 100644 index 0000000000..8cef0c3de5 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_c8abb3() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half arg_2 = 0.0h; + half res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_c8abb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_c8abb3(); + return; +} + +kernel void compute_main() { + fma_c8abb3(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..b033681808 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_c8abb3 "fma_c8abb3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_c8abb3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %half %arg_0 + %22 = OpLoad %half %arg_1 + %23 = OpLoad %half %arg_2 + %19 = OpExtInst %half %20 Fma %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %fma_c8abb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fma_c8abb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %fma_c8abb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..6f24f34dc5 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/c8abb3.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn fma_c8abb3() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res : f16 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_c8abb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_c8abb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_c8abb3(); +} diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl new file mode 100644 index 0000000000..3babd02afc --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fma(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn fma_e17c5c() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var arg_2 = vec3(1.f); + var res: vec3 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e17c5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e17c5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e17c5c(); +} diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a2f5cba230 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_e17c5c() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e17c5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e17c5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e17c5c(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a2f5cba230 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void fma_e17c5c() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e17c5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e17c5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e17c5c(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl new file mode 100644 index 0000000000..aabb648150 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void fma_e17c5c() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_e17c5c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fma_e17c5c() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_e17c5c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fma_e17c5c() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_e17c5c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl new file mode 100644 index 0000000000..3931c86512 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_e17c5c() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 arg_2 = float3(1.0f); + float3 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_e17c5c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_e17c5c(); + return; +} + +kernel void compute_main() { + fma_e17c5c(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm new file mode 100644 index 0000000000..15197e2e82 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_e17c5c "fma_e17c5c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %27 = OpTypeFunction %v4float + %fma_e17c5c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %arg_2 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v3float %arg_0 + %24 = OpLoad %v3float %arg_1 + %25 = OpLoad %v3float %arg_2 + %21 = OpExtInst %v3float %22 Fma %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %fma_e17c5c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_e17c5c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %fma_e17c5c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl new file mode 100644 index 0000000000..83a46ea1bc --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn fma_e17c5c() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var arg_2 = vec3(1.0f); + var res : vec3 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e17c5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e17c5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e17c5c(); +} diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl new file mode 100644 index 0000000000..a07279df16 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fma(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn fma_e7abdc() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e7abdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e7abdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e7abdc(); +} diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b6b357e77b --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void fma_e7abdc() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e7abdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e7abdc(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0866b5c4f2 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void fma_e7abdc() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = mad(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fma_e7abdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fma_e7abdc(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D742133930(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D742133930(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D742133930(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D742133930(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.glsl new file mode 100644 index 0000000000..ba47f42fee --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_e7abdc() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +vec4 vertex_main() { + fma_e7abdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fma_e7abdc() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void fragment_main() { + fma_e7abdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fma_e7abdc() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = ((arg_0) * (arg_1) + (arg_2)); +} + +void compute_main() { + fma_e7abdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.msl new file mode 100644 index 0000000000..c7e165ade3 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void fma_e7abdc() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = fma(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fma_e7abdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fma_e7abdc(); + return; +} + +kernel void compute_main() { + fma_e7abdc(); + return; +} + diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9aaaf7a64 --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fma_e7abdc "fma_e7abdc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %fma_e7abdc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 Fma %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %fma_e7abdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %fma_e7abdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %fma_e7abdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..2dbbcac3fc --- /dev/null +++ b/test/tint/builtins/gen/var/fma/e7abdc.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn fma_e7abdc() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = fma(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fma_e7abdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + fma_e7abdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fma_e7abdc(); +} diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl new file mode 100644 index 0000000000..12cc4bf347 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<2, f16>) -> vec<2, f16> +fn fract_181aa9() { + var arg_0 = vec2(f16()); + var res: vec2 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_181aa9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_181aa9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_181aa9(); +} diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..08a307dbd7 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_181aa9() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_181aa9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_181aa9(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87fc1a1e47 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void fract_181aa9() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_181aa9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_181aa9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000290A4231990(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000290A4231990(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.glsl new file mode 100644 index 0000000000..e9871d3d3c --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_181aa9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_181aa9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_181aa9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = fract(arg_0); +} + +void fragment_main() { + fract_181aa9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_181aa9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = fract(arg_0); +} + +void compute_main() { + fract_181aa9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.msl new file mode 100644 index 0000000000..f3351da3af --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_181aa9() { + half2 arg_0 = half2(0.0h); + half2 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_181aa9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_181aa9(); + return; +} + +kernel void compute_main() { + fract_181aa9(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.spvasm new file mode 100644 index 0000000000..47d1ee6787 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_181aa9 "fract_181aa9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_181aa9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Fract %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %fract_181aa9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_181aa9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fract_181aa9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e73c70769 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/181aa9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn fract_181aa9() { + var arg_0 = vec2(f16()); + var res : vec2 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_181aa9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_181aa9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_181aa9(); +} diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl b/test/tint/builtins/gen/var/fract/498c77.wgsl new file mode 100644 index 0000000000..aef30b3549 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<4, f16>) -> vec<4, f16> +fn fract_498c77() { + var arg_0 = vec4(f16()); + var res: vec4 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_498c77(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_498c77(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_498c77(); +} diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d9e34efb4f --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_498c77() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_498c77(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_498c77(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf6c7aedbe --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void fract_498c77() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_498c77(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_498c77(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F8576786D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F8576786D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.glsl new file mode 100644 index 0000000000..c9daa26d24 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_498c77() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_498c77(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_498c77() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = fract(arg_0); +} + +void fragment_main() { + fract_498c77(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_498c77() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = fract(arg_0); +} + +void compute_main() { + fract_498c77(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.msl new file mode 100644 index 0000000000..3f7a3f18e9 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_498c77() { + half4 arg_0 = half4(0.0h); + half4 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_498c77(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_498c77(); + return; +} + +kernel void compute_main() { + fract_498c77(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.spvasm new file mode 100644 index 0000000000..62ab9e0992 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_498c77 "fract_498c77" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_498c77 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Fract %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %fract_498c77 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_498c77 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fract_498c77 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.wgsl new file mode 100644 index 0000000000..325c892908 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/498c77.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn fract_498c77() { + var arg_0 = vec4(f16()); + var res : vec4 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_498c77(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_498c77(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_498c77(); +} diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl new file mode 100644 index 0000000000..1591a977ef --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(vec<4, f32>) -> vec<4, f32> +fn fract_8bc1e9() { + var arg_0 = vec4(1.f); + var res: vec4 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_8bc1e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_8bc1e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_8bc1e9(); +} diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3fc1143b9b --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_8bc1e9() { + float4 arg_0 = (1.0f).xxxx; + float4 res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_8bc1e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_8bc1e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_8bc1e9(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3fc1143b9b --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void fract_8bc1e9() { + float4 arg_0 = (1.0f).xxxx; + float4 res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_8bc1e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_8bc1e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_8bc1e9(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl new file mode 100644 index 0000000000..a931954b01 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void fract_8bc1e9() { + vec4 arg_0 = vec4(1.0f); + vec4 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_8bc1e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_8bc1e9() { + vec4 arg_0 = vec4(1.0f); + vec4 res = fract(arg_0); +} + +void fragment_main() { + fract_8bc1e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_8bc1e9() { + vec4 arg_0 = vec4(1.0f); + vec4 res = fract(arg_0); +} + +void compute_main() { + fract_8bc1e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl new file mode 100644 index 0000000000..de4a03dae9 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_8bc1e9() { + float4 arg_0 = float4(1.0f); + float4 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_8bc1e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_8bc1e9(); + return; +} + +kernel void compute_main() { + fract_8bc1e9(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fce3d9e9b --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_8bc1e9 "fract_8bc1e9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%fract_8bc1e9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Fract %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %fract_8bc1e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %fract_8bc1e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %fract_8bc1e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..31c9a04c0b --- /dev/null +++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn fract_8bc1e9() { + var arg_0 = vec4(1.0f); + var res : vec4 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_8bc1e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_8bc1e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_8bc1e9(); +} diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl new file mode 100644 index 0000000000..19a5428142 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(vec<2, f32>) -> vec<2, f32> +fn fract_943cb1() { + var arg_0 = vec2(1.f); + var res: vec2 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_943cb1(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_943cb1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_943cb1(); +} diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7ebeca26a5 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_943cb1() { + float2 arg_0 = (1.0f).xx; + float2 res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_943cb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_943cb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_943cb1(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7ebeca26a5 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void fract_943cb1() { + float2 arg_0 = (1.0f).xx; + float2 res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_943cb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_943cb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_943cb1(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl new file mode 100644 index 0000000000..0cdaa88a5c --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void fract_943cb1() { + vec2 arg_0 = vec2(1.0f); + vec2 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_943cb1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_943cb1() { + vec2 arg_0 = vec2(1.0f); + vec2 res = fract(arg_0); +} + +void fragment_main() { + fract_943cb1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_943cb1() { + vec2 arg_0 = vec2(1.0f); + vec2 res = fract(arg_0); +} + +void compute_main() { + fract_943cb1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl new file mode 100644 index 0000000000..1d5202fd3f --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_943cb1() { + float2 arg_0 = float2(1.0f); + float2 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_943cb1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_943cb1(); + return; +} + +kernel void compute_main() { + fract_943cb1(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm new file mode 100644 index 0000000000..1c141d57a3 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_943cb1 "fract_943cb1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%fract_943cb1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Fract %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %fract_943cb1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_943cb1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fract_943cb1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl new file mode 100644 index 0000000000..456ab98d63 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn fract_943cb1() { + var arg_0 = vec2(1.0f); + var res : vec2 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_943cb1(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_943cb1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_943cb1(); +} diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl new file mode 100644 index 0000000000..187f494946 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(vec<3, f16>) -> vec<3, f16> +fn fract_958a1d() { + var arg_0 = vec3(f16()); + var res: vec3 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_958a1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_958a1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_958a1d(); +} diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..98322b9651 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_958a1d() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_958a1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_958a1d(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6771ca7dd9 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void fract_958a1d() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_958a1d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_958a1d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002450F006F40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002450F006F40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.glsl new file mode 100644 index 0000000000..283602bbf9 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_958a1d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_958a1d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_958a1d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = fract(arg_0); +} + +void fragment_main() { + fract_958a1d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_958a1d() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = fract(arg_0); +} + +void compute_main() { + fract_958a1d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.msl new file mode 100644 index 0000000000..745157e8d7 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_958a1d() { + half3 arg_0 = half3(0.0h); + half3 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_958a1d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_958a1d(); + return; +} + +kernel void compute_main() { + fract_958a1d(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..9393329722 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_958a1d "fract_958a1d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_958a1d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Fract %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %fract_958a1d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_958a1d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fract_958a1d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..d35d4d5513 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/958a1d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn fract_958a1d() { + var arg_0 = vec3(f16()); + var res : vec3 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_958a1d(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_958a1d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_958a1d(); +} diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl b/test/tint/builtins/gen/var/fract/a49758.wgsl new file mode 100644 index 0000000000..cf4b0bc109 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(vec<3, f32>) -> vec<3, f32> +fn fract_a49758() { + var arg_0 = vec3(1.f); + var res: vec3 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_a49758(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_a49758(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_a49758(); +} diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cbd7af2d90 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_a49758() { + float3 arg_0 = (1.0f).xxx; + float3 res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_a49758(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_a49758(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_a49758(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cbd7af2d90 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void fract_a49758() { + float3 arg_0 = (1.0f).xxx; + float3 res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_a49758(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_a49758(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_a49758(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl new file mode 100644 index 0000000000..0f4157fc04 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void fract_a49758() { + vec3 arg_0 = vec3(1.0f); + vec3 res = fract(arg_0); +} + +vec4 vertex_main() { + fract_a49758(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_a49758() { + vec3 arg_0 = vec3(1.0f); + vec3 res = fract(arg_0); +} + +void fragment_main() { + fract_a49758(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_a49758() { + vec3 arg_0 = vec3(1.0f); + vec3 res = fract(arg_0); +} + +void compute_main() { + fract_a49758(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl new file mode 100644 index 0000000000..2814c3ec9d --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_a49758() { + float3 arg_0 = float3(1.0f); + float3 res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_a49758(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_a49758(); + return; +} + +kernel void compute_main() { + fract_a49758(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm new file mode 100644 index 0000000000..b2d7346033 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_a49758 "fract_a49758" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%fract_a49758 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Fract %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %fract_a49758 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_a49758 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %fract_a49758 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl new file mode 100644 index 0000000000..637345259c --- /dev/null +++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn fract_a49758() { + var arg_0 = vec3(1.0f); + var res : vec3 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_a49758(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_a49758(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_a49758(); +} diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl new file mode 100644 index 0000000000..435df2c91b --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn fract(f16) -> f16 +fn fract_eb38ce() { + var arg_0 = f16(); + var res: f16 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_eb38ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_eb38ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_eb38ce(); +} diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9aa5d74d2b --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_eb38ce() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_eb38ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_eb38ce(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c481b82bbf --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void fract_eb38ce() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_eb38ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_eb38ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024B27352E20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024B27352E20(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.glsl new file mode 100644 index 0000000000..bb439189a8 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_eb38ce() { + float16_t arg_0 = 0.0hf; + float16_t res = fract(arg_0); +} + +vec4 vertex_main() { + fract_eb38ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void fract_eb38ce() { + float16_t arg_0 = 0.0hf; + float16_t res = fract(arg_0); +} + +void fragment_main() { + fract_eb38ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void fract_eb38ce() { + float16_t arg_0 = 0.0hf; + float16_t res = fract(arg_0); +} + +void compute_main() { + fract_eb38ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.msl new file mode 100644 index 0000000000..6ca36be1f4 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_eb38ce() { + half arg_0 = 0.0h; + half res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_eb38ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_eb38ce(); + return; +} + +kernel void compute_main() { + fract_eb38ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..1d320c349d --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_eb38ce "fract_eb38ce" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%fract_eb38ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Fract %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %fract_eb38ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %fract_eb38ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %fract_eb38ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..a590daeccd --- /dev/null +++ b/test/tint/builtins/gen/var/fract/eb38ce.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn fract_eb38ce() { + var arg_0 = f16(); + var res : f16 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_eb38ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_eb38ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_eb38ce(); +} diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl new file mode 100644 index 0000000000..1f6235df4a --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fract(f32) -> f32 +fn fract_fa5c71() { + var arg_0 = 1.f; + var res: f32 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_fa5c71(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_fa5c71(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_fa5c71(); +} diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c24fc77101 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_fa5c71(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_fa5c71(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_fa5c71(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c24fc77101 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = frac(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + fract_fa5c71(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + fract_fa5c71(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + fract_fa5c71(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl new file mode 100644 index 0000000000..1727089675 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = fract(arg_0); +} + +vec4 vertex_main() { + fract_fa5c71(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = fract(arg_0); +} + +void fragment_main() { + fract_fa5c71(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = fract(arg_0); +} + +void compute_main() { + fract_fa5c71(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl new file mode 100644 index 0000000000..28643cc127 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void fract_fa5c71() { + float arg_0 = 1.0f; + float res = fract(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + fract_fa5c71(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + fract_fa5c71(); + return; +} + +kernel void compute_main() { + fract_fa5c71(); + return; +} + diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm new file mode 100644 index 0000000000..18cc7aad61 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %fract_fa5c71 "fract_fa5c71" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%fract_fa5c71 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Fract %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %fract_fa5c71 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %fract_fa5c71 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %fract_fa5c71 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl new file mode 100644 index 0000000000..e69460b456 --- /dev/null +++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn fract_fa5c71() { + var arg_0 = 1.0f; + var res : f32 = fract(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + fract_fa5c71(); + return vec4(); +} + +@fragment +fn fragment_main() { + fract_fa5c71(); +} + +@compute @workgroup_size(1) +fn compute_main() { + fract_fa5c71(); +} diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl new file mode 100644 index 0000000000..6b40118a1f --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<4, f16>) -> __frexp_result_vec<4, f16> +fn frexp_3dd21e() { + var arg_0 = vec4(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_3dd21e(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_3dd21e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_3dd21e(); +} diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..557bac1ec8 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec4_f16 { + vector sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec4_f16 result = {sig, int4(exp)}; + return result; +} + +void frexp_3dd21e() { + vector arg_0 = (float16_t(0.0h)).xxxx; + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_3dd21e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_3dd21e(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c514368998 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +struct frexp_result_vec4_f16 { + vector sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec4_f16 result = {sig, int4(exp)}; + return result; +} + +void frexp_3dd21e() { + vector arg_0 = (float16_t(0.0h)).xxxx; + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_3dd21e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_3dd21e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002B0820A2F50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.glsl new file mode 100644 index 0000000000..a1dc1665bf --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + f16vec4 arg_0 = f16vec4(0.0hf); + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_3dd21e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + f16vec4 arg_0 = f16vec4(0.0hf); + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_3dd21e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec4_f16 { + f16vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4_f16 tint_frexp(f16vec4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_3dd21e() { + f16vec4 arg_0 = f16vec4(0.0hf); + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_3dd21e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.msl new file mode 100644 index 0000000000..7ca5bd7611 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec4_f16 { + half4 sig; + int4 exp; +}; +frexp_result_vec4_f16 tint_frexp(half4 param_0) { + frexp_result_vec4_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_3dd21e() { + half4 arg_0 = half4(0.0h); + frexp_result_vec4_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_3dd21e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_3dd21e(); + return; +} + +kernel void compute_main() { + frexp_3dd21e(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.spvasm new file mode 100644 index 0000000000..70eddba230 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_3dd21e "frexp_3dd21e" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec4_f16 "__frexp_result_vec4_f16" + OpMemberName %__frexp_result_vec4_f16 0 "sig" + OpMemberName %__frexp_result_vec4_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec4_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec4_f16 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%__frexp_result_vec4_f16 = OpTypeStruct %v4half %v4int +%_ptr_Function___frexp_result_vec4_f16 = OpTypePointer Function %__frexp_result_vec4_f16 + %26 = OpConstantNull %__frexp_result_vec4_f16 + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_3dd21e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function___frexp_result_vec4_f16 Function %26 + OpStore %arg_0 %15 + %23 = OpLoad %v4half %arg_0 + %18 = OpExtInst %__frexp_result_vec4_f16 %22 FrexpStruct %23 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %frexp_3dd21e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_3dd21e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %frexp_3dd21e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.wgsl new file mode 100644 index 0000000000..557f702e52 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/3dd21e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn frexp_3dd21e() { + var arg_0 = vec4(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_3dd21e(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_3dd21e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_3dd21e(); +} diff --git a/test/tint/builtins/gen/var/frexp/4b2200.wgsl b/test/tint/builtins/gen/var/frexp/4b2200.wgsl new file mode 100644 index 0000000000..2802b5f050 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4b2200.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(f32) -> __frexp_result +fn frexp_4b2200() { + var arg_0 = 1.f; + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_4b2200(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_4b2200(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_4b2200(); +} diff --git a/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8dcfcd2914 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + float exp; + float sig = frexp(param_0, exp); + frexp_result result = {sig, int(exp)}; + return result; +} + +void frexp_4b2200() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_4b2200(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_4b2200(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_4b2200(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8dcfcd2914 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.fxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + float exp; + float sig = frexp(param_0, exp); + frexp_result result = {sig, int(exp)}; + return result; +} + +void frexp_4b2200() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_4b2200(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_4b2200(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_4b2200(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.glsl new file mode 100644 index 0000000000..bcf42ce205 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct frexp_result { + float sig; + int exp; +}; + +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_4b2200() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_4b2200(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result { + float sig; + int exp; +}; + +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_4b2200() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_4b2200(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result { + float sig; + int exp; +}; + +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_4b2200() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_4b2200(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.msl new file mode 100644 index 0000000000..3c34d9cf3b --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result { + float sig; + int exp; +}; +frexp_result tint_frexp(float param_0) { + frexp_result result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_4b2200() { + float arg_0 = 1.0f; + frexp_result res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_4b2200(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_4b2200(); + return; +} + +kernel void compute_main() { + frexp_4b2200(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.spvasm new file mode 100644 index 0000000000..b871068844 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_4b2200 "frexp_4b2200" + OpName %arg_0 "arg_0" + OpName %__frexp_result "__frexp_result" + OpMemberName %__frexp_result 0 "sig" + OpMemberName %__frexp_result 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result 0 Offset 0 + OpMemberDecorate %__frexp_result 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%__frexp_result = OpTypeStruct %float %int +%_ptr_Function___frexp_result = OpTypePointer Function %__frexp_result + %23 = OpConstantNull %__frexp_result + %24 = OpTypeFunction %v4float +%frexp_4b2200 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function___frexp_result Function %23 + OpStore %arg_0 %float_1 + %20 = OpLoad %float %arg_0 + %16 = OpExtInst %__frexp_result %19 FrexpStruct %20 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %frexp_4b2200 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %frexp_4b2200 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %frexp_4b2200 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.wgsl new file mode 100644 index 0000000000..c06eb399a9 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/4b2200.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn frexp_4b2200() { + var arg_0 = 1.0f; + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_4b2200(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_4b2200(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_4b2200(); +} diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl new file mode 100644 index 0000000000..9451324f73 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(f16) -> __frexp_result +fn frexp_5257dd() { + var arg_0 = f16(); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5257dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5257dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5257dd(); +} diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b52f6d8b82 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_f16 { + float16_t sig; + int exp; +}; +frexp_result_f16 tint_frexp(float16_t param_0) { + float16_t exp; + float16_t sig = frexp(param_0, exp); + frexp_result_f16 result = {sig, int(exp)}; + return result; +} + +void frexp_5257dd() { + float16_t arg_0 = float16_t(0.0h); + frexp_result_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5257dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5257dd(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4e360f6ac --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; +frexp_result_f16 tint_frexp(float16_t param_0) { + float16_t exp; + float16_t sig = frexp(param_0, exp); + frexp_result_f16 result = {sig, int(exp)}; + return result; +} + +void frexp_5257dd() { + float16_t arg_0 = float16_t(0.0h); + frexp_result_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5257dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5257dd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029E12ED17D0(2,3-11): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.glsl new file mode 100644 index 0000000000..0d7e39fc58 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + float16_t arg_0 = 0.0hf; + frexp_result_f16 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_5257dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + float16_t arg_0 = 0.0hf; + frexp_result_f16 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_5257dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_f16 { + float16_t sig; + int exp; +}; + +frexp_result_f16 tint_frexp(float16_t param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5257dd() { + float16_t arg_0 = 0.0hf; + frexp_result_f16 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_5257dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.msl new file mode 100644 index 0000000000..9d0edc3971 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_f16 { + half sig; + int exp; +}; +frexp_result_f16 tint_frexp(half param_0) { + frexp_result_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_5257dd() { + half arg_0 = 0.0h; + frexp_result_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_5257dd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_5257dd(); + return; +} + +kernel void compute_main() { + frexp_5257dd(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0008a83b7 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_5257dd "frexp_5257dd" + OpName %arg_0 "arg_0" + OpName %__frexp_result_f16 "__frexp_result_f16" + OpMemberName %__frexp_result_f16 0 "sig" + OpMemberName %__frexp_result_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_f16 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %int = OpTypeInt 32 1 +%__frexp_result_f16 = OpTypeStruct %half %int +%_ptr_Function___frexp_result_f16 = OpTypePointer Function %__frexp_result_f16 + %24 = OpConstantNull %__frexp_result_f16 + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_5257dd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function___frexp_result_f16 Function %24 + OpStore %arg_0 %14 + %21 = OpLoad %half %arg_0 + %17 = OpExtInst %__frexp_result_f16 %20 FrexpStruct %21 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %frexp_5257dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %frexp_5257dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %frexp_5257dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..664e19ab35 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5257dd.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn frexp_5257dd() { + var arg_0 = f16(); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5257dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5257dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5257dd(); +} diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl new file mode 100644 index 0000000000..8d43e800bd --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<2, f16>) -> __frexp_result_vec<2, f16> +fn frexp_5f47bf() { + var arg_0 = vec2(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5f47bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5f47bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5f47bf(); +} diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..478ced8cc2 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec2_f16 { + vector sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec2_f16 result = {sig, int2(exp)}; + return result; +} + +void frexp_5f47bf() { + vector arg_0 = (float16_t(0.0h)).xx; + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5f47bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5f47bf(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..82d183ac7a --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +struct frexp_result_vec2_f16 { + vector sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec2_f16 result = {sig, int2(exp)}; + return result; +} + +void frexp_5f47bf() { + vector arg_0 = (float16_t(0.0h)).xx; + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_5f47bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_5f47bf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002974137DC80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.glsl new file mode 100644 index 0000000000..2864a81f1d --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + f16vec2 arg_0 = f16vec2(0.0hf); + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_5f47bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + f16vec2 arg_0 = f16vec2(0.0hf); + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_5f47bf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec2_f16 { + f16vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2_f16 tint_frexp(f16vec2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_5f47bf() { + f16vec2 arg_0 = f16vec2(0.0hf); + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_5f47bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.msl new file mode 100644 index 0000000000..dfdef716a0 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec2_f16 { + half2 sig; + int2 exp; +}; +frexp_result_vec2_f16 tint_frexp(half2 param_0) { + frexp_result_vec2_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_5f47bf() { + half2 arg_0 = half2(0.0h); + frexp_result_vec2_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_5f47bf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_5f47bf(); + return; +} + +kernel void compute_main() { + frexp_5f47bf(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9c41906a9 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_5f47bf "frexp_5f47bf" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec2_f16 "__frexp_result_vec2_f16" + OpMemberName %__frexp_result_vec2_f16 0 "sig" + OpMemberName %__frexp_result_vec2_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec2_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec2_f16 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%__frexp_result_vec2_f16 = OpTypeStruct %v2half %v2int +%_ptr_Function___frexp_result_vec2_f16 = OpTypePointer Function %__frexp_result_vec2_f16 + %26 = OpConstantNull %__frexp_result_vec2_f16 + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_5f47bf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function___frexp_result_vec2_f16 Function %26 + OpStore %arg_0 %15 + %23 = OpLoad %v2half %arg_0 + %18 = OpExtInst %__frexp_result_vec2_f16 %22 FrexpStruct %23 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %frexp_5f47bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_5f47bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %frexp_5f47bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..63fce21c8c --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/5f47bf.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn frexp_5f47bf() { + var arg_0 = vec2(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_5f47bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_5f47bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_5f47bf(); +} diff --git a/test/tint/builtins/gen/var/frexp/77af93.wgsl b/test/tint/builtins/gen/var/frexp/77af93.wgsl new file mode 100644 index 0000000000..4aab6cda20 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/77af93.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(vec<4, f32>) -> __frexp_result_vec<4, f32> +fn frexp_77af93() { + var arg_0 = vec4(1.f); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_77af93(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_77af93(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_77af93(); +} diff --git a/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b828fd2595 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec4 { + float4 sig; + int4 exp; +}; +frexp_result_vec4 tint_frexp(float4 param_0) { + float4 exp; + float4 sig = frexp(param_0, exp); + frexp_result_vec4 result = {sig, int4(exp)}; + return result; +} + +void frexp_77af93() { + float4 arg_0 = (1.0f).xxxx; + frexp_result_vec4 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_77af93(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_77af93(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_77af93(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b828fd2595 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.fxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec4 { + float4 sig; + int4 exp; +}; +frexp_result_vec4 tint_frexp(float4 param_0) { + float4 exp; + float4 sig = frexp(param_0, exp); + frexp_result_vec4 result = {sig, int4(exp)}; + return result; +} + +void frexp_77af93() { + float4 arg_0 = (1.0f).xxxx; + frexp_result_vec4 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_77af93(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_77af93(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_77af93(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.glsl new file mode 100644 index 0000000000..cf01df2fe3 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct frexp_result_vec4 { + vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4 tint_frexp(vec4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_77af93() { + vec4 arg_0 = vec4(1.0f); + frexp_result_vec4 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_77af93(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result_vec4 { + vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4 tint_frexp(vec4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_77af93() { + vec4 arg_0 = vec4(1.0f); + frexp_result_vec4 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_77af93(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result_vec4 { + vec4 sig; + ivec4 exp; +}; + +frexp_result_vec4 tint_frexp(vec4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_77af93() { + vec4 arg_0 = vec4(1.0f); + frexp_result_vec4 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_77af93(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.msl new file mode 100644 index 0000000000..013a8f3410 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec4 { + float4 sig; + int4 exp; +}; +frexp_result_vec4 tint_frexp(float4 param_0) { + frexp_result_vec4 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_77af93() { + float4 arg_0 = float4(1.0f); + frexp_result_vec4 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_77af93(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_77af93(); + return; +} + +kernel void compute_main() { + frexp_77af93(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.spvasm new file mode 100644 index 0000000000..42998a126f --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_77af93 "frexp_77af93" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec4 "__frexp_result_vec4" + OpMemberName %__frexp_result_vec4 0 "sig" + OpMemberName %__frexp_result_vec4 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec4 0 Offset 0 + OpMemberDecorate %__frexp_result_vec4 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%__frexp_result_vec4 = OpTypeStruct %v4float %v4int +%_ptr_Function___frexp_result_vec4 = OpTypePointer Function %__frexp_result_vec4 + %25 = OpConstantNull %__frexp_result_vec4 + %26 = OpTypeFunction %v4float +%frexp_77af93 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function___frexp_result_vec4 Function %25 + OpStore %arg_0 %14 + %22 = OpLoad %v4float %arg_0 + %17 = OpExtInst %__frexp_result_vec4 %21 FrexpStruct %22 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %frexp_77af93 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %frexp_77af93 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %frexp_77af93 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.wgsl new file mode 100644 index 0000000000..b07da65e74 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/77af93.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn frexp_77af93() { + var arg_0 = vec4(1.0f); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_77af93(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_77af93(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_77af93(); +} diff --git a/test/tint/builtins/gen/var/frexp/979800.wgsl b/test/tint/builtins/gen/var/frexp/979800.wgsl new file mode 100644 index 0000000000..500cf91a89 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/979800.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(vec<3, f32>) -> __frexp_result_vec<3, f32> +fn frexp_979800() { + var arg_0 = vec3(1.f); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_979800(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_979800(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_979800(); +} diff --git a/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a15f9899d8 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec3 { + float3 sig; + int3 exp; +}; +frexp_result_vec3 tint_frexp(float3 param_0) { + float3 exp; + float3 sig = frexp(param_0, exp); + frexp_result_vec3 result = {sig, int3(exp)}; + return result; +} + +void frexp_979800() { + float3 arg_0 = (1.0f).xxx; + frexp_result_vec3 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_979800(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_979800(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_979800(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a15f9899d8 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.fxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec3 { + float3 sig; + int3 exp; +}; +frexp_result_vec3 tint_frexp(float3 param_0) { + float3 exp; + float3 sig = frexp(param_0, exp); + frexp_result_vec3 result = {sig, int3(exp)}; + return result; +} + +void frexp_979800() { + float3 arg_0 = (1.0f).xxx; + frexp_result_vec3 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_979800(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_979800(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_979800(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.glsl new file mode 100644 index 0000000000..256584b731 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct frexp_result_vec3 { + vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3 tint_frexp(vec3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_979800() { + vec3 arg_0 = vec3(1.0f); + frexp_result_vec3 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_979800(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result_vec3 { + vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3 tint_frexp(vec3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_979800() { + vec3 arg_0 = vec3(1.0f); + frexp_result_vec3 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_979800(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result_vec3 { + vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3 tint_frexp(vec3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_979800() { + vec3 arg_0 = vec3(1.0f); + frexp_result_vec3 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_979800(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.msl new file mode 100644 index 0000000000..5f511cd8ab --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec3 { + float3 sig; + int3 exp; +}; +frexp_result_vec3 tint_frexp(float3 param_0) { + frexp_result_vec3 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_979800() { + float3 arg_0 = float3(1.0f); + frexp_result_vec3 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_979800(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_979800(); + return; +} + +kernel void compute_main() { + frexp_979800(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.spvasm new file mode 100644 index 0000000000..2aed3d5e01 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_979800 "frexp_979800" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec3 "__frexp_result_vec3" + OpMemberName %__frexp_result_vec3 0 "sig" + OpMemberName %__frexp_result_vec3 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec3 0 Offset 0 + OpMemberDecorate %__frexp_result_vec3 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%__frexp_result_vec3 = OpTypeStruct %v3float %v3int +%_ptr_Function___frexp_result_vec3 = OpTypePointer Function %__frexp_result_vec3 + %27 = OpConstantNull %__frexp_result_vec3 + %28 = OpTypeFunction %v4float +%frexp_979800 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function___frexp_result_vec3 Function %27 + OpStore %arg_0 %15 + %24 = OpLoad %v3float %arg_0 + %19 = OpExtInst %__frexp_result_vec3 %23 FrexpStruct %24 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %frexp_979800 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_979800 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %frexp_979800 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.wgsl new file mode 100644 index 0000000000..529fccb8df --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/979800.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn frexp_979800() { + var arg_0 = vec3(1.0f); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_979800(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_979800(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_979800(); +} diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl new file mode 100644 index 0000000000..e5aad680cc --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn frexp(vec<3, f16>) -> __frexp_result_vec<3, f16> +fn frexp_ae4a66() { + var arg_0 = vec3(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_ae4a66(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_ae4a66(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_ae4a66(); +} diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..633a556ae8 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec3_f16 { + vector sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec3_f16 result = {sig, int3(exp)}; + return result; +} + +void frexp_ae4a66() { + vector arg_0 = (float16_t(0.0h)).xxx; + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_ae4a66(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_ae4a66(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31c17af458 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +struct frexp_result_vec3_f16 { + vector sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(vector param_0) { + vector exp; + vector sig = frexp(param_0, exp); + frexp_result_vec3_f16 result = {sig, int3(exp)}; + return result; +} + +void frexp_ae4a66() { + vector arg_0 = (float16_t(0.0h)).xxx; + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_ae4a66(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_ae4a66(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024B22CBDA70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.glsl new file mode 100644 index 0000000000..36a46283c2 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + f16vec3 arg_0 = f16vec3(0.0hf); + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_ae4a66(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + f16vec3 arg_0 = f16vec3(0.0hf); + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_ae4a66(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct frexp_result_vec3_f16 { + f16vec3 sig; + ivec3 exp; +}; + +frexp_result_vec3_f16 tint_frexp(f16vec3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_ae4a66() { + f16vec3 arg_0 = f16vec3(0.0hf); + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_ae4a66(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.msl new file mode 100644 index 0000000000..670a53486e --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec3_f16 { + half3 sig; + int3 exp; +}; +frexp_result_vec3_f16 tint_frexp(half3 param_0) { + frexp_result_vec3_f16 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_ae4a66() { + half3 arg_0 = half3(0.0h); + frexp_result_vec3_f16 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_ae4a66(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_ae4a66(); + return; +} + +kernel void compute_main() { + frexp_ae4a66(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.spvasm new file mode 100644 index 0000000000..e71e3524d4 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_ae4a66 "frexp_ae4a66" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec3_f16 "__frexp_result_vec3_f16" + OpMemberName %__frexp_result_vec3_f16 0 "sig" + OpMemberName %__frexp_result_vec3_f16 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec3_f16 0 Offset 0 + OpMemberDecorate %__frexp_result_vec3_f16 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%__frexp_result_vec3_f16 = OpTypeStruct %v3half %v3int +%_ptr_Function___frexp_result_vec3_f16 = OpTypePointer Function %__frexp_result_vec3_f16 + %26 = OpConstantNull %__frexp_result_vec3_f16 + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%frexp_ae4a66 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function___frexp_result_vec3_f16 Function %26 + OpStore %arg_0 %15 + %23 = OpLoad %v3half %arg_0 + %18 = OpExtInst %__frexp_result_vec3_f16 %22 FrexpStruct %23 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %frexp_ae4a66 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_ae4a66 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %frexp_ae4a66 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.wgsl new file mode 100644 index 0000000000..cdbd561c76 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/ae4a66.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn frexp_ae4a66() { + var arg_0 = vec3(f16()); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_ae4a66(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_ae4a66(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_ae4a66(); +} diff --git a/test/tint/builtins/gen/var/frexp/eb2421.wgsl b/test/tint/builtins/gen/var/frexp/eb2421.wgsl new file mode 100644 index 0000000000..760e5f98ce --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eb2421.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn frexp(vec<2, f32>) -> __frexp_result_vec<2, f32> +fn frexp_eb2421() { + var arg_0 = vec2(1.f); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_eb2421(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_eb2421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_eb2421(); +} diff --git a/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32121e69bb --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.dxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec2 { + float2 sig; + int2 exp; +}; +frexp_result_vec2 tint_frexp(float2 param_0) { + float2 exp; + float2 sig = frexp(param_0, exp); + frexp_result_vec2 result = {sig, int2(exp)}; + return result; +} + +void frexp_eb2421() { + float2 arg_0 = (1.0f).xx; + frexp_result_vec2 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_eb2421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_eb2421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_eb2421(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32121e69bb --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.fxc.hlsl @@ -0,0 +1,42 @@ +struct frexp_result_vec2 { + float2 sig; + int2 exp; +}; +frexp_result_vec2 tint_frexp(float2 param_0) { + float2 exp; + float2 sig = frexp(param_0, exp); + frexp_result_vec2 result = {sig, int2(exp)}; + return result; +} + +void frexp_eb2421() { + float2 arg_0 = (1.0f).xx; + frexp_result_vec2 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + frexp_eb2421(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + frexp_eb2421(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + frexp_eb2421(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.glsl new file mode 100644 index 0000000000..a0dc6561f1 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct frexp_result_vec2 { + vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2 tint_frexp(vec2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_eb2421() { + vec2 arg_0 = vec2(1.0f); + frexp_result_vec2 res = tint_frexp(arg_0); +} + +vec4 vertex_main() { + frexp_eb2421(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct frexp_result_vec2 { + vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2 tint_frexp(vec2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_eb2421() { + vec2 arg_0 = vec2(1.0f); + frexp_result_vec2 res = tint_frexp(arg_0); +} + +void fragment_main() { + frexp_eb2421(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct frexp_result_vec2 { + vec2 sig; + ivec2 exp; +}; + +frexp_result_vec2 tint_frexp(vec2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + + +void frexp_eb2421() { + vec2 arg_0 = vec2(1.0f); + frexp_result_vec2 res = tint_frexp(arg_0); +} + +void compute_main() { + frexp_eb2421(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.msl new file mode 100644 index 0000000000..95235f23a8 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct frexp_result_vec2 { + float2 sig; + int2 exp; +}; +frexp_result_vec2 tint_frexp(float2 param_0) { + frexp_result_vec2 result; + result.sig = frexp(param_0, result.exp); + return result; +} + +void frexp_eb2421() { + float2 arg_0 = float2(1.0f); + frexp_result_vec2 res = tint_frexp(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + frexp_eb2421(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + frexp_eb2421(); + return; +} + +kernel void compute_main() { + frexp_eb2421(); + return; +} + diff --git a/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.spvasm new file mode 100644 index 0000000000..4703e9af39 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %frexp_eb2421 "frexp_eb2421" + OpName %arg_0 "arg_0" + OpName %__frexp_result_vec2 "__frexp_result_vec2" + OpMemberName %__frexp_result_vec2 0 "sig" + OpMemberName %__frexp_result_vec2 1 "exp" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__frexp_result_vec2 0 Offset 0 + OpMemberDecorate %__frexp_result_vec2 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%__frexp_result_vec2 = OpTypeStruct %v2float %v2int +%_ptr_Function___frexp_result_vec2 = OpTypePointer Function %__frexp_result_vec2 + %27 = OpConstantNull %__frexp_result_vec2 + %28 = OpTypeFunction %v4float +%frexp_eb2421 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function___frexp_result_vec2 Function %27 + OpStore %arg_0 %15 + %24 = OpLoad %v2float %arg_0 + %19 = OpExtInst %__frexp_result_vec2 %23 FrexpStruct %24 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %frexp_eb2421 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %frexp_eb2421 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %frexp_eb2421 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.wgsl new file mode 100644 index 0000000000..83b52e83d0 --- /dev/null +++ b/test/tint/builtins/gen/var/frexp/eb2421.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn frexp_eb2421() { + var arg_0 = vec2(1.0f); + var res = frexp(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + frexp_eb2421(); + return vec4(); +} + +@fragment +fn fragment_main() { + frexp_eb2421(); +} + +@compute @workgroup_size(1) +fn compute_main() { + frexp_eb2421(); +} diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl new file mode 100644 index 0000000000..580effab9b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(vec<3, f32>) -> vec<3, f32> +fn fwidth_5d1b39() { + var arg_0 = vec3(1.f); + var res: vec3 = fwidth(arg_0); +} + +@fragment +fn fragment_main() { + fwidth_5d1b39(); +} diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53c95e243d --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidth_5d1b39() { + float3 arg_0 = (1.0f).xxx; + float3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_5d1b39(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..53c95e243d --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidth_5d1b39() { + float3 arg_0 = (1.0f).xxx; + float3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_5d1b39(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl new file mode 100644 index 0000000000..d0789a86fb --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidth_5d1b39() { + vec3 arg_0 = vec3(1.0f); + vec3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_5d1b39(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl new file mode 100644 index 0000000000..3611773ea3 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidth_5d1b39() { + float3 arg_0 = float3(1.0f); + float3 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidth_5d1b39(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm new file mode 100644 index 0000000000..1683a434cd --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_5d1b39 "fwidth_5d1b39" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %11 = OpConstantNull %v3float +%fwidth_5d1b39 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %11 + %res = OpVariable %_ptr_Function_v3float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v3float %arg_0 + %12 = OpFwidth %v3float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %fwidth_5d1b39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl new file mode 100644 index 0000000000..b402cb22f8 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidth_5d1b39() { + var arg_0 = vec3(1.0f); + var res : vec3 = fwidth(arg_0); +} + +@fragment +fn fragment_main() { + fwidth_5d1b39(); +} diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl new file mode 100644 index 0000000000..8ebc5f1a35 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(vec<2, f32>) -> vec<2, f32> +fn fwidth_b83ebb() { + var arg_0 = vec2(1.f); + var res: vec2 = fwidth(arg_0); +} + +@fragment +fn fragment_main() { + fwidth_b83ebb(); +} diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b8655729be --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidth_b83ebb() { + float2 arg_0 = (1.0f).xx; + float2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_b83ebb(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b8655729be --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidth_b83ebb() { + float2 arg_0 = (1.0f).xx; + float2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_b83ebb(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl new file mode 100644 index 0000000000..ced1f2922b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidth_b83ebb() { + vec2 arg_0 = vec2(1.0f); + vec2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_b83ebb(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl new file mode 100644 index 0000000000..b5ecf5d03c --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidth_b83ebb() { + float2 arg_0 = float2(1.0f); + float2 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidth_b83ebb(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc85924328 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_b83ebb "fwidth_b83ebb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpConstantNull %v2float +%fwidth_b83ebb = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %11 + %res = OpVariable %_ptr_Function_v2float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v2float %arg_0 + %12 = OpFwidth %v2float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %fwidth_b83ebb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl new file mode 100644 index 0000000000..d3b1b6e84a --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidth_b83ebb() { + var arg_0 = vec2(1.0f); + var res : vec2 = fwidth(arg_0); +} + +@fragment +fn fragment_main() { + fwidth_b83ebb(); +} diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl new file mode 100644 index 0000000000..5bc917728a --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(vec<4, f32>) -> vec<4, f32> +fn fwidth_d2ab9a() { + var arg_0 = vec4(1.f); + var res: vec4 = fwidth(arg_0); +} + +@fragment +fn fragment_main() { + fwidth_d2ab9a(); +} diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..535124d62b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidth_d2ab9a() { + float4 arg_0 = (1.0f).xxxx; + float4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_d2ab9a(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..535124d62b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidth_d2ab9a() { + float4 arg_0 = (1.0f).xxxx; + float4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_d2ab9a(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl new file mode 100644 index 0000000000..5fa156078e --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidth_d2ab9a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_d2ab9a(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl new file mode 100644 index 0000000000..2290a21aa2 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidth_d2ab9a() { + float4 arg_0 = float4(1.0f); + float4 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidth_d2ab9a(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm new file mode 100644 index 0000000000..fadc0f60f3 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_d2ab9a "fwidth_d2ab9a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %11 = OpConstantNull %v4float +%fwidth_d2ab9a = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %11 + %res = OpVariable %_ptr_Function_v4float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v4float %arg_0 + %12 = OpFwidth %v4float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %fwidth_d2ab9a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..82baa9f6d3 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidth_d2ab9a() { + var arg_0 = vec4(1.0f); + var res : vec4 = fwidth(arg_0); +} + +@fragment +fn fragment_main() { + fwidth_d2ab9a(); +} diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl new file mode 100644 index 0000000000..57b96d50b1 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidth(f32) -> f32 +fn fwidth_df38ef() { + var arg_0 = 1.f; + var res: f32 = fwidth(arg_0); +} + +@fragment +fn fragment_main() { + fwidth_df38ef(); +} diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8c0b254c76 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidth_df38ef() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_df38ef(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c0b254c76 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidth_df38ef() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_df38ef(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl new file mode 100644 index 0000000000..fd90c67695 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidth_df38ef() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidth_df38ef(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl new file mode 100644 index 0000000000..45cdac69c0 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidth_df38ef() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidth_df38ef(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b89aaa672 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidth_df38ef "fwidth_df38ef" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%fwidth_df38ef = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpFwidth %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidth_df38ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..b168e0c3ca --- /dev/null +++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidth_df38ef() { + var arg_0 = 1.0f; + var res : f32 = fwidth(arg_0); +} + +@fragment +fn fragment_main() { + fwidth_df38ef(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl new file mode 100644 index 0000000000..445223337b --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(f32) -> f32 +fn fwidthCoarse_159c8a() { + var arg_0 = 1.f; + var res: f32 = fwidthCoarse(arg_0); +} + +@fragment +fn fragment_main() { + fwidthCoarse_159c8a(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..37bbb25ea1 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_159c8a() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_159c8a(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..37bbb25ea1 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_159c8a() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_159c8a(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl new file mode 100644 index 0000000000..7d57bbf632 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_159c8a() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_159c8a(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl new file mode 100644 index 0000000000..eb66e084bd --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthCoarse_159c8a() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthCoarse_159c8a(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm new file mode 100644 index 0000000000..324f1af78e --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_159c8a "fwidthCoarse_159c8a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%fwidthCoarse_159c8a = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpFwidthCoarse %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthCoarse_159c8a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee9e1cbd08 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthCoarse_159c8a() { + var arg_0 = 1.0f; + var res : f32 = fwidthCoarse(arg_0); +} + +@fragment +fn fragment_main() { + fwidthCoarse_159c8a(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl new file mode 100644 index 0000000000..a460748eb4 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(vec<3, f32>) -> vec<3, f32> +fn fwidthCoarse_1e59d9() { + var arg_0 = vec3(1.f); + var res: vec3 = fwidthCoarse(arg_0); +} + +@fragment +fn fragment_main() { + fwidthCoarse_1e59d9(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b35c76ca4f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_1e59d9() { + float3 arg_0 = (1.0f).xxx; + float3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_1e59d9(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b35c76ca4f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_1e59d9() { + float3 arg_0 = (1.0f).xxx; + float3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_1e59d9(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl new file mode 100644 index 0000000000..2e0b4701b9 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_1e59d9() { + vec3 arg_0 = vec3(1.0f); + vec3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_1e59d9(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl new file mode 100644 index 0000000000..2b697391e0 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthCoarse_1e59d9() { + float3 arg_0 = float3(1.0f); + float3 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthCoarse_1e59d9(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm new file mode 100644 index 0000000000..2afcab00cf --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_1e59d9 "fwidthCoarse_1e59d9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %11 = OpConstantNull %v3float +%fwidthCoarse_1e59d9 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %11 + %res = OpVariable %_ptr_Function_v3float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v3float %arg_0 + %12 = OpFwidthCoarse %v3float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %fwidthCoarse_1e59d9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ba840c1d6 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthCoarse_1e59d9() { + var arg_0 = vec3(1.0f); + var res : vec3 = fwidthCoarse(arg_0); +} + +@fragment +fn fragment_main() { + fwidthCoarse_1e59d9(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl new file mode 100644 index 0000000000..c0f2e1ff82 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(vec<4, f32>) -> vec<4, f32> +fn fwidthCoarse_4e4fc4() { + var arg_0 = vec4(1.f); + var res: vec4 = fwidthCoarse(arg_0); +} + +@fragment +fn fragment_main() { + fwidthCoarse_4e4fc4(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2ed8dd6900 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_4e4fc4() { + float4 arg_0 = (1.0f).xxxx; + float4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_4e4fc4(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ed8dd6900 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_4e4fc4() { + float4 arg_0 = (1.0f).xxxx; + float4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_4e4fc4(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl new file mode 100644 index 0000000000..5415252db2 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_4e4fc4() { + vec4 arg_0 = vec4(1.0f); + vec4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_4e4fc4(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl new file mode 100644 index 0000000000..714e8b9dbf --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthCoarse_4e4fc4() { + float4 arg_0 = float4(1.0f); + float4 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthCoarse_4e4fc4(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..c26ac6780d --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_4e4fc4 "fwidthCoarse_4e4fc4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %11 = OpConstantNull %v4float +%fwidthCoarse_4e4fc4 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %11 + %res = OpVariable %_ptr_Function_v4float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v4float %arg_0 + %12 = OpFwidthCoarse %v4float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %fwidthCoarse_4e4fc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..9468c41e93 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthCoarse_4e4fc4() { + var arg_0 = vec4(1.0f); + var res : vec4 = fwidthCoarse(arg_0); +} + +@fragment +fn fragment_main() { + fwidthCoarse_4e4fc4(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl new file mode 100644 index 0000000000..f3386b2480 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthCoarse(vec<2, f32>) -> vec<2, f32> +fn fwidthCoarse_e653f7() { + var arg_0 = vec2(1.f); + var res: vec2 = fwidthCoarse(arg_0); +} + +@fragment +fn fragment_main() { + fwidthCoarse_e653f7(); +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..be7258d0e0 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_e653f7() { + float2 arg_0 = (1.0f).xx; + float2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_e653f7(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..be7258d0e0 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidthCoarse_e653f7() { + float2 arg_0 = (1.0f).xx; + float2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_e653f7(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl new file mode 100644 index 0000000000..d480dba0bf --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthCoarse_e653f7() { + vec2 arg_0 = vec2(1.0f); + vec2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthCoarse_e653f7(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl new file mode 100644 index 0000000000..dc0784380a --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthCoarse_e653f7() { + float2 arg_0 = float2(1.0f); + float2 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthCoarse_e653f7(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..64daf80d9e --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthCoarse_e653f7 "fwidthCoarse_e653f7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpConstantNull %v2float +%fwidthCoarse_e653f7 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %11 + %res = OpVariable %_ptr_Function_v2float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v2float %arg_0 + %12 = OpFwidthCoarse %v2float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %fwidthCoarse_e653f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..daeca58c06 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthCoarse_e653f7() { + var arg_0 = vec2(1.0f); + var res : vec2 = fwidthCoarse(arg_0); +} + +@fragment +fn fragment_main() { + fwidthCoarse_e653f7(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl new file mode 100644 index 0000000000..a7f576d73e --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(vec<3, f32>) -> vec<3, f32> +fn fwidthFine_523fdc() { + var arg_0 = vec3(1.f); + var res: vec3 = fwidthFine(arg_0); +} + +@fragment +fn fragment_main() { + fwidthFine_523fdc(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bb1e86bc15 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_523fdc() { + float3 arg_0 = (1.0f).xxx; + float3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_523fdc(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bb1e86bc15 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_523fdc() { + float3 arg_0 = (1.0f).xxx; + float3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_523fdc(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl new file mode 100644 index 0000000000..67dca6ca3a --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthFine_523fdc() { + vec3 arg_0 = vec3(1.0f); + vec3 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_523fdc(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl new file mode 100644 index 0000000000..d64921d1ef --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthFine_523fdc() { + float3 arg_0 = float3(1.0f); + float3 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthFine_523fdc(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..47cb385f36 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_523fdc "fwidthFine_523fdc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %11 = OpConstantNull %v3float +%fwidthFine_523fdc = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %11 + %res = OpVariable %_ptr_Function_v3float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v3float %arg_0 + %12 = OpFwidthFine %v3float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %fwidthFine_523fdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..a82a25039d --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthFine_523fdc() { + var arg_0 = vec3(1.0f); + var res : vec3 = fwidthFine(arg_0); +} + +@fragment +fn fragment_main() { + fwidthFine_523fdc(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl new file mode 100644 index 0000000000..bc0bb73c8e --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(vec<4, f32>) -> vec<4, f32> +fn fwidthFine_68f4ef() { + var arg_0 = vec4(1.f); + var res: vec4 = fwidthFine(arg_0); +} + +@fragment +fn fragment_main() { + fwidthFine_68f4ef(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a9ede9547f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_68f4ef() { + float4 arg_0 = (1.0f).xxxx; + float4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_68f4ef(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a9ede9547f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_68f4ef() { + float4 arg_0 = (1.0f).xxxx; + float4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_68f4ef(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl new file mode 100644 index 0000000000..ff47798197 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthFine_68f4ef() { + vec4 arg_0 = vec4(1.0f); + vec4 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_68f4ef(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl new file mode 100644 index 0000000000..d6c8c437bb --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthFine_68f4ef() { + float4 arg_0 = float4(1.0f); + float4 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthFine_68f4ef(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..635d2b0f05 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_68f4ef "fwidthFine_68f4ef" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %11 = OpConstantNull %v4float +%fwidthFine_68f4ef = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %11 + %res = OpVariable %_ptr_Function_v4float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v4float %arg_0 + %12 = OpFwidthFine %v4float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %fwidthFine_68f4ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..23978b3e2f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthFine_68f4ef() { + var arg_0 = vec4(1.0f); + var res : vec4 = fwidthFine(arg_0); +} + +@fragment +fn fragment_main() { + fwidthFine_68f4ef(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl new file mode 100644 index 0000000000..8962ffe619 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(f32) -> f32 +fn fwidthFine_f1742d() { + var arg_0 = 1.f; + var res: f32 = fwidthFine(arg_0); +} + +@fragment +fn fragment_main() { + fwidthFine_f1742d(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8e2b50b96f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_f1742d() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_f1742d(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e2b50b96f --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_f1742d() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_f1742d(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl new file mode 100644 index 0000000000..8baea1cfbb --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthFine_f1742d() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_f1742d(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl new file mode 100644 index 0000000000..badc5cbe31 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthFine_f1742d() { + float arg_0 = 1.0f; + float res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthFine_f1742d(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm new file mode 100644 index 0000000000..a2d3e96f6c --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_f1742d "fwidthFine_f1742d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %9 = OpConstantNull %float +%fwidthFine_f1742d = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %9 + %res = OpVariable %_ptr_Function_float Function %9 + OpStore %arg_0 %float_1 + %11 = OpLoad %float %arg_0 + %10 = OpFwidthFine %float %11 + OpStore %res %10 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %14 = OpLabel + %15 = OpFunctionCall %void %fwidthFine_f1742d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl new file mode 100644 index 0000000000..78a6eb9382 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthFine_f1742d() { + var arg_0 = 1.0f; + var res : f32 = fwidthFine(arg_0); +} + +@fragment +fn fragment_main() { + fwidthFine_f1742d(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl new file mode 100644 index 0000000000..fbaa7ecc5e --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl @@ -0,0 +1,33 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn fwidthFine(vec<2, f32>) -> vec<2, f32> +fn fwidthFine_ff6aa0() { + var arg_0 = vec2(1.f); + var res: vec2 = fwidthFine(arg_0); +} + +@fragment +fn fragment_main() { + fwidthFine_ff6aa0(); +} diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7c2303f724 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_ff6aa0() { + float2 arg_0 = (1.0f).xx; + float2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_ff6aa0(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c2303f724 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void fwidthFine_ff6aa0() { + float2 arg_0 = (1.0f).xx; + float2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_ff6aa0(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl new file mode 100644 index 0000000000..18a0c6f939 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +void fwidthFine_ff6aa0() { + vec2 arg_0 = vec2(1.0f); + vec2 res = fwidth(arg_0); +} + +void fragment_main() { + fwidthFine_ff6aa0(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl new file mode 100644 index 0000000000..4397415113 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void fwidthFine_ff6aa0() { + float2 arg_0 = float2(1.0f); + float2 res = fwidth(arg_0); +} + +fragment void fragment_main() { + fwidthFine_ff6aa0(); + return; +} + diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm new file mode 100644 index 0000000000..fad56e4c4a --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability DerivativeControl + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %fwidthFine_ff6aa0 "fwidthFine_ff6aa0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %fragment_main "fragment_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %8 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpConstantNull %v2float +%fwidthFine_ff6aa0 = OpFunction %void None %1 + %4 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %11 + %res = OpVariable %_ptr_Function_v2float Function %11 + OpStore %arg_0 %8 + %13 = OpLoad %v2float %arg_0 + %12 = OpFwidthFine %v2float %13 + OpStore %res %12 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %1 + %16 = OpLabel + %17 = OpFunctionCall %void %fwidthFine_ff6aa0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl new file mode 100644 index 0000000000..9175e3ebb8 --- /dev/null +++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +fn fwidthFine_ff6aa0() { + var arg_0 = vec2(1.0f); + var res : vec2 = fwidthFine(arg_0); +} + +@fragment +fn fragment_main() { + fwidthFine_ff6aa0(); +} diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl new file mode 100644 index 0000000000..0606cf79a5 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<2, u32>, vec<2, u32>, u32, u32) -> vec<2, u32> +fn insertBits_3c7ba5() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec2 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_3c7ba5(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_3c7ba5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_3c7ba5(); +} diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e84e9b82ce --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & uint2((mask).xx)) | (v & uint2((~(mask)).xx))); +} + +void insertBits_3c7ba5() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_3c7ba5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_3c7ba5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_3c7ba5(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e84e9b82ce --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & uint2((mask).xx)) | (v & uint2((~(mask)).xx))); +} + +void insertBits_3c7ba5() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_3c7ba5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_3c7ba5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_3c7ba5(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl new file mode 100644 index 0000000000..ae7fd8a896 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_3c7ba5() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_3c7ba5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_3c7ba5() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_3c7ba5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_3c7ba5() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_3c7ba5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl new file mode 100644 index 0000000000..8cee554f31 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_3c7ba5() { + uint2 arg_0 = uint2(1u); + uint2 arg_1 = uint2(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uint2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_3c7ba5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_3c7ba5(); + return; +} + +kernel void compute_main() { + insertBits_3c7ba5(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm new file mode 100644 index 0000000000..98fd575eca --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_3c7ba5 "insertBits_3c7ba5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint %v2uint %v2uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %30 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %33 = OpConstantNull %v2uint +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v2uint None %9 + %v = OpFunctionParameter %v2uint + %n = OpFunctionParameter %v2uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %v2uint %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_3c7ba5 = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %33 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %33 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %arg_3 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_v2uint Function %33 + OpStore %arg_0 %30 + OpStore %arg_1 %30 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %40 = OpLoad %v2uint %arg_0 + %41 = OpLoad %v2uint %arg_1 + %42 = OpLoad %uint %arg_2 + %43 = OpLoad %uint %arg_3 + %39 = OpFunctionCall %v2uint %tint_insert_bits %40 %41 %42 %43 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_3c7ba5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %54 = OpLabel + %55 = OpFunctionCall %void %insertBits_3c7ba5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %57 = OpLabel + %58 = OpFunctionCall %void %insertBits_3c7ba5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl new file mode 100644 index 0000000000..78175d62c1 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_3c7ba5() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec2 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_3c7ba5(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_3c7ba5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_3c7ba5(); +} diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl new file mode 100644 index 0000000000..8f0bca4db7 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<3, i32>, vec<3, i32>, u32, u32) -> vec<3, i32> +fn insertBits_428b0b() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec3 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_428b0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_428b0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_428b0b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2991280163 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx))); +} + +void insertBits_428b0b() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + int3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_428b0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_428b0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_428b0b(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2991280163 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx))); +} + +void insertBits_428b0b() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + int3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_428b0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_428b0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_428b0b(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl new file mode 100644 index 0000000000..f4ed94fe2b --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_428b0b() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_428b0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_428b0b() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_428b0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_428b0b() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_428b0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl new file mode 100644 index 0000000000..3034164499 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_428b0b() { + int3 arg_0 = int3(1); + int3 arg_1 = int3(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + int3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_428b0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_428b0b(); + return; +} + +kernel void compute_main() { + insertBits_428b0b(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f7625b822 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_428b0b "insertBits_428b0b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v3int %v3int %v3int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %31 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %34 = OpConstantNull %v3int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %39 = OpConstantNull %uint + %47 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v3int None %9 + %v = OpFunctionParameter %v3int + %n = OpFunctionParameter %v3int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %18 = OpLabel + %19 = OpExtInst %uint %20 UMin %offset %uint_32 + %23 = OpIAdd %uint %19 %count + %22 = OpExtInst %uint %20 UMin %uint_32 %23 + %25 = OpISub %uint %22 %19 + %24 = OpBitFieldInsert %v3int %v %n %19 %25 + OpReturnValue %24 + OpFunctionEnd +%insertBits_428b0b = OpFunction %void None %26 + %29 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %34 + %arg_1 = OpVariable %_ptr_Function_v3int Function %34 + %arg_2 = OpVariable %_ptr_Function_uint Function %39 + %arg_3 = OpVariable %_ptr_Function_uint Function %39 + %res = OpVariable %_ptr_Function_v3int Function %34 + OpStore %arg_0 %31 + OpStore %arg_1 %31 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %42 = OpLoad %v3int %arg_0 + %43 = OpLoad %v3int %arg_1 + %44 = OpLoad %uint %arg_2 + %45 = OpLoad %uint %arg_3 + %41 = OpFunctionCall %v3int %tint_insert_bits %42 %43 %44 %45 + OpStore %res %41 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %47 + %49 = OpLabel + %50 = OpFunctionCall %void %insertBits_428b0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %26 + %52 = OpLabel + %53 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %53 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %26 + %56 = OpLabel + %57 = OpFunctionCall %void %insertBits_428b0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %26 + %59 = OpLabel + %60 = OpFunctionCall %void %insertBits_428b0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..3c5e1eea18 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_428b0b() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec3 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_428b0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_428b0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_428b0b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl new file mode 100644 index 0000000000..98af954654 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<4, u32>, vec<4, u32>, u32, u32) -> vec<4, u32> +fn insertBits_51ede1() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec4 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_51ede1(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_51ede1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_51ede1(); +} diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46f552abaa --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & uint4((mask).xxxx)) | (v & uint4((~(mask)).xxxx))); +} + +void insertBits_51ede1() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_51ede1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_51ede1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_51ede1(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..46f552abaa --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & uint4((mask).xxxx)) | (v & uint4((~(mask)).xxxx))); +} + +void insertBits_51ede1() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_51ede1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_51ede1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_51ede1(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl new file mode 100644 index 0000000000..2832d7b8bc --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_51ede1() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_51ede1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_51ede1() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_51ede1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_51ede1() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_51ede1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl new file mode 100644 index 0000000000..2dbc14f661 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_51ede1() { + uint4 arg_0 = uint4(1u); + uint4 arg_1 = uint4(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uint4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_51ede1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_51ede1(); + return; +} + +kernel void compute_main() { + insertBits_51ede1(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbbcd39486 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_51ede1 "insertBits_51ede1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint %v4uint %v4uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %30 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %33 = OpConstantNull %v4uint +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v4uint None %9 + %v = OpFunctionParameter %v4uint + %n = OpFunctionParameter %v4uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %v4uint %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_51ede1 = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %33 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %33 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %arg_3 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_v4uint Function %33 + OpStore %arg_0 %30 + OpStore %arg_1 %30 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %40 = OpLoad %v4uint %arg_0 + %41 = OpLoad %v4uint %arg_1 + %42 = OpLoad %uint %arg_2 + %43 = OpLoad %uint %arg_3 + %39 = OpFunctionCall %v4uint %tint_insert_bits %40 %41 %42 %43 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_51ede1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %54 = OpLabel + %55 = OpFunctionCall %void %insertBits_51ede1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %57 = OpLabel + %58 = OpFunctionCall %void %insertBits_51ede1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl new file mode 100644 index 0000000000..76a46b8350 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_51ede1() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec4 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_51ede1(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_51ede1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_51ede1(); +} diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl new file mode 100644 index 0000000000..2021ae8ac0 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(i32, i32, u32, u32) -> i32 +fn insertBits_65468b() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = 1u; + var arg_3 = 1u; + var res: i32 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_65468b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_65468b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_65468b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f87cc19c6b --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +int tint_insert_bits(int v, int n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & int(mask)) | (v & int(~(mask)))); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_65468b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_65468b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_65468b(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f87cc19c6b --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +int tint_insert_bits(int v, int n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & int(mask)) | (v & int(~(mask)))); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_65468b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_65468b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_65468b(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl new file mode 100644 index 0000000000..8d9614e4e0 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_65468b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_65468b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_65468b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl new file mode 100644 index 0000000000..21411f7ce2 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +int tint_insert_bits(int v, int n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_65468b() { + int arg_0 = 1; + int arg_1 = 1; + uint arg_2 = 1u; + uint arg_3 = 1u; + int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_65468b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_65468b(); + return; +} + +kernel void compute_main() { + insertBits_65468b(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d4e69f1eb --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_65468b "insertBits_65468b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %int %int %int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %int None %9 + %v = OpFunctionParameter %int + %n = OpFunctionParameter %int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %int %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_65468b = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %32 + %arg_1 = OpVariable %_ptr_Function_int Function %32 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %arg_3 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_int Function %32 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %40 = OpLoad %int %arg_0 + %41 = OpLoad %int %arg_1 + %42 = OpLoad %uint %arg_2 + %43 = OpLoad %uint %arg_3 + %39 = OpFunctionCall %int %tint_insert_bits %40 %41 %42 %43 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_65468b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %54 = OpLabel + %55 = OpFunctionCall %void %insertBits_65468b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %57 = OpLabel + %58 = OpFunctionCall %void %insertBits_65468b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl new file mode 100644 index 0000000000..c1388577e3 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_65468b() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = 1u; + var arg_3 = 1u; + var res : i32 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_65468b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_65468b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_65468b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl new file mode 100644 index 0000000000..12ea9ba123 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<3, u32>, vec<3, u32>, u32, u32) -> vec<3, u32> +fn insertBits_87826b() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec3 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_87826b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_87826b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_87826b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a820be8691 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx))); +} + +void insertBits_87826b() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_87826b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_87826b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_87826b(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a820be8691 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx))); +} + +void insertBits_87826b() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_87826b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_87826b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_87826b(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl new file mode 100644 index 0000000000..cebc13a434 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_87826b() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_87826b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_87826b() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_87826b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_87826b() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uvec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_87826b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl new file mode 100644 index 0000000000..e4901f91de --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_87826b() { + uint3 arg_0 = uint3(1u); + uint3 arg_1 = uint3(1u); + uint arg_2 = 1u; + uint arg_3 = 1u; + uint3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_87826b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_87826b(); + return; +} + +kernel void compute_main() { + insertBits_87826b(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm new file mode 100644 index 0000000000..23c2e7afdf --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_87826b "insertBits_87826b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint %v3uint %v3uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 + %30 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %33 = OpConstantNull %v3uint +%_ptr_Function_uint = OpTypePointer Function %uint + %37 = OpConstantNull %uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v3uint None %9 + %v = OpFunctionParameter %v3uint + %n = OpFunctionParameter %v3uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %17 = OpLabel + %18 = OpExtInst %uint %19 UMin %offset %uint_32 + %22 = OpIAdd %uint %18 %count + %21 = OpExtInst %uint %19 UMin %uint_32 %22 + %24 = OpISub %uint %21 %18 + %23 = OpBitFieldInsert %v3uint %v %n %18 %24 + OpReturnValue %23 + OpFunctionEnd +%insertBits_87826b = OpFunction %void None %25 + %28 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %33 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %33 + %arg_2 = OpVariable %_ptr_Function_uint Function %37 + %arg_3 = OpVariable %_ptr_Function_uint Function %37 + %res = OpVariable %_ptr_Function_v3uint Function %33 + OpStore %arg_0 %30 + OpStore %arg_1 %30 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %40 = OpLoad %v3uint %arg_0 + %41 = OpLoad %v3uint %arg_1 + %42 = OpLoad %uint %arg_2 + %43 = OpLoad %uint %arg_3 + %39 = OpFunctionCall %v3uint %tint_insert_bits %40 %41 %42 %43 + OpStore %res %39 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %insertBits_87826b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %25 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %25 + %54 = OpLabel + %55 = OpFunctionCall %void %insertBits_87826b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %25 + %57 = OpLabel + %58 = OpFunctionCall %void %insertBits_87826b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl new file mode 100644 index 0000000000..cfbc74eaa9 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_87826b() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec3 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_87826b(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_87826b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_87826b(); +} diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl new file mode 100644 index 0000000000..9208faa3c6 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<4, i32>, vec<4, i32>, u32, u32) -> vec<4, i32> +fn insertBits_d86978() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec4 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_d86978(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_d86978(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_d86978(); +} diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fdf1dd3c2b --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & int4((int(mask)).xxxx)) | (v & int4((int(~(mask))).xxxx))); +} + +void insertBits_d86978() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + int4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_d86978(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_d86978(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_d86978(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fdf1dd3c2b --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint4((s).xxxx)) & int4((int(mask)).xxxx)) | (v & int4((int(~(mask))).xxxx))); +} + +void insertBits_d86978() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + uint arg_2 = 1u; + uint arg_3 = 1u; + int4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_d86978(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_d86978(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_d86978(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl new file mode 100644 index 0000000000..ff4206ae07 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_d86978() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_d86978(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_d86978() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_d86978(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_d86978() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_d86978(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl new file mode 100644 index 0000000000..da3e5a1f78 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_d86978() { + int4 arg_0 = int4(1); + int4 arg_1 = int4(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + int4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_d86978(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_d86978(); + return; +} + +kernel void compute_main() { + insertBits_d86978(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9ea59ef76 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_d86978 "insertBits_d86978" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v4int %v4int %v4int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %31 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %34 = OpConstantNull %v4int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %39 = OpConstantNull %uint + %47 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v4int None %9 + %v = OpFunctionParameter %v4int + %n = OpFunctionParameter %v4int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %18 = OpLabel + %19 = OpExtInst %uint %20 UMin %offset %uint_32 + %23 = OpIAdd %uint %19 %count + %22 = OpExtInst %uint %20 UMin %uint_32 %23 + %25 = OpISub %uint %22 %19 + %24 = OpBitFieldInsert %v4int %v %n %19 %25 + OpReturnValue %24 + OpFunctionEnd +%insertBits_d86978 = OpFunction %void None %26 + %29 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %34 + %arg_1 = OpVariable %_ptr_Function_v4int Function %34 + %arg_2 = OpVariable %_ptr_Function_uint Function %39 + %arg_3 = OpVariable %_ptr_Function_uint Function %39 + %res = OpVariable %_ptr_Function_v4int Function %34 + OpStore %arg_0 %31 + OpStore %arg_1 %31 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %42 = OpLoad %v4int %arg_0 + %43 = OpLoad %v4int %arg_1 + %44 = OpLoad %uint %arg_2 + %45 = OpLoad %uint %arg_3 + %41 = OpFunctionCall %v4int %tint_insert_bits %42 %43 %44 %45 + OpStore %res %41 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %47 + %49 = OpLabel + %50 = OpFunctionCall %void %insertBits_d86978 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %26 + %52 = OpLabel + %53 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %53 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %26 + %56 = OpLabel + %57 = OpFunctionCall %void %insertBits_d86978 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %26 + %59 = OpLabel + %60 = OpFunctionCall %void %insertBits_d86978 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl new file mode 100644 index 0000000000..a54232509f --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_d86978() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec4 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_d86978(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_d86978(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_d86978(); +} diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl new file mode 100644 index 0000000000..515a8d9309 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(u32, u32, u32, u32) -> u32 +fn insertBits_e3e3a2() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var arg_3 = 1u; + var res: u32 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_e3e3a2(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_e3e3a2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_e3e3a2(); +} diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cfbbeee243 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & mask) | (v & ~(mask))); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_e3e3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_e3e3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_e3e3a2(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cfbbeee243 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & mask) | (v & ~(mask))); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_e3e3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_e3e3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_e3e3a2(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl new file mode 100644 index 0000000000..07f56be678 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_e3e3a2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_e3e3a2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_e3e3a2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl new file mode 100644 index 0000000000..20a4950d72 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_e3e3a2() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint arg_2 = 1u; + uint arg_3 = 1u; + uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_e3e3a2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_e3e3a2(); + return; +} + +kernel void compute_main() { + insertBits_e3e3a2(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm new file mode 100644 index 0000000000..17e63b9b9d --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_e3e3a2 "insertBits_e3e3a2" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %uint %uint %uint %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %31 = OpConstantNull %uint + %41 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %uint None %9 + %v = OpFunctionParameter %uint + %n = OpFunctionParameter %uint + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %16 = OpLabel + %17 = OpExtInst %uint %18 UMin %offset %uint_32 + %21 = OpIAdd %uint %17 %count + %20 = OpExtInst %uint %18 UMin %uint_32 %21 + %23 = OpISub %uint %20 %17 + %22 = OpBitFieldInsert %uint %v %n %17 %23 + OpReturnValue %22 + OpFunctionEnd +%insertBits_e3e3a2 = OpFunction %void None %24 + %27 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %31 + %arg_1 = OpVariable %_ptr_Function_uint Function %31 + %arg_2 = OpVariable %_ptr_Function_uint Function %31 + %arg_3 = OpVariable %_ptr_Function_uint Function %31 + %res = OpVariable %_ptr_Function_uint Function %31 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %36 = OpLoad %uint %arg_0 + %37 = OpLoad %uint %arg_1 + %38 = OpLoad %uint %arg_2 + %39 = OpLoad %uint %arg_3 + %35 = OpFunctionCall %uint %tint_insert_bits %36 %37 %38 %39 + OpStore %res %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %41 + %43 = OpLabel + %44 = OpFunctionCall %void %insertBits_e3e3a2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %24 + %46 = OpLabel + %47 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %47 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %24 + %50 = OpLabel + %51 = OpFunctionCall %void %insertBits_e3e3a2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %24 + %53 = OpLabel + %54 = OpFunctionCall %void %insertBits_e3e3a2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl new file mode 100644 index 0000000000..4541379846 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_e3e3a2() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = 1u; + var arg_3 = 1u; + var res : u32 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_e3e3a2(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_e3e3a2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_e3e3a2(); +} diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl new file mode 100644 index 0000000000..86b9f4f493 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn insertBits(vec<2, i32>, vec<2, i32>, u32, u32) -> vec<2, i32> +fn insertBits_fe6ba6() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var arg_2 = 1u; + var arg_3 = 1u; + var res: vec2 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_fe6ba6(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_fe6ba6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_fe6ba6(); +} diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d2a307318f --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & int2((int(mask)).xx)) | (v & int2((int(~(mask))).xx))); +} + +void insertBits_fe6ba6() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + uint arg_2 = 1u; + uint arg_3 = 1u; + int2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_fe6ba6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_fe6ba6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_fe6ba6(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d2a307318f --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint2((s).xx)) & int2((int(mask)).xx)) | (v & int2((int(~(mask))).xx))); +} + +void insertBits_fe6ba6() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + uint arg_2 = 1u; + uint arg_3 = 1u; + int2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + insertBits_fe6ba6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + insertBits_fe6ba6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + insertBits_fe6ba6(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl new file mode 100644 index 0000000000..775c87c54a --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl @@ -0,0 +1,79 @@ +#version 310 es + +ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_fe6ba6() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + insertBits_fe6ba6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_fe6ba6() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void fragment_main() { + insertBits_fe6ba6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) { + uint s = min(offset, 32u); + uint e = min(32u, (s + count)); + return bitfieldInsert(v, n, int(s), int((e - s))); +} + +void insertBits_fe6ba6() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + ivec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +void compute_main() { + insertBits_fe6ba6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl new file mode 100644 index 0000000000..9720049d62 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) { + uint const s = min(offset, 32u); + uint const e = min(32u, (s + count)); + return insert_bits(v, n, s, (e - s)); +} + +void insertBits_fe6ba6() { + int2 arg_0 = int2(1); + int2 arg_1 = int2(1); + uint arg_2 = 1u; + uint arg_3 = 1u; + int2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + insertBits_fe6ba6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + insertBits_fe6ba6(); + return; +} + +kernel void compute_main() { + insertBits_fe6ba6(); + return; +} + diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d41b6eb40 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tint_insert_bits "tint_insert_bits" + OpName %v "v" + OpName %n "n" + OpName %offset "offset" + OpName %count "count" + OpName %insertBits_fe6ba6 "insertBits_fe6ba6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %9 = OpTypeFunction %v2int %v2int %v2int %uint %uint + %uint_32 = OpConstant %uint 32 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %31 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %34 = OpConstantNull %v2int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %39 = OpConstantNull %uint + %47 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tint_insert_bits = OpFunction %v2int None %9 + %v = OpFunctionParameter %v2int + %n = OpFunctionParameter %v2int + %offset = OpFunctionParameter %uint + %count = OpFunctionParameter %uint + %18 = OpLabel + %19 = OpExtInst %uint %20 UMin %offset %uint_32 + %23 = OpIAdd %uint %19 %count + %22 = OpExtInst %uint %20 UMin %uint_32 %23 + %25 = OpISub %uint %22 %19 + %24 = OpBitFieldInsert %v2int %v %n %19 %25 + OpReturnValue %24 + OpFunctionEnd +%insertBits_fe6ba6 = OpFunction %void None %26 + %29 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %34 + %arg_1 = OpVariable %_ptr_Function_v2int Function %34 + %arg_2 = OpVariable %_ptr_Function_uint Function %39 + %arg_3 = OpVariable %_ptr_Function_uint Function %39 + %res = OpVariable %_ptr_Function_v2int Function %34 + OpStore %arg_0 %31 + OpStore %arg_1 %31 + OpStore %arg_2 %uint_1 + OpStore %arg_3 %uint_1 + %42 = OpLoad %v2int %arg_0 + %43 = OpLoad %v2int %arg_1 + %44 = OpLoad %uint %arg_2 + %45 = OpLoad %uint %arg_3 + %41 = OpFunctionCall %v2int %tint_insert_bits %42 %43 %44 %45 + OpStore %res %41 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %47 + %49 = OpLabel + %50 = OpFunctionCall %void %insertBits_fe6ba6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %26 + %52 = OpLabel + %53 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %53 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %26 + %56 = OpLabel + %57 = OpFunctionCall %void %insertBits_fe6ba6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %26 + %59 = OpLabel + %60 = OpFunctionCall %void %insertBits_fe6ba6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl new file mode 100644 index 0000000000..d6efd197b4 --- /dev/null +++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +fn insertBits_fe6ba6() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var arg_2 = 1u; + var arg_3 = 1u; + var res : vec2 = insertBits(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + insertBits_fe6ba6(); + return vec4(); +} + +@fragment +fn fragment_main() { + insertBits_fe6ba6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + insertBits_fe6ba6(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl new file mode 100644 index 0000000000..246419557f --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(f16) -> f16 +fn inverseSqrt_440300() { + var arg_0 = f16(); + var res: f16 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_440300(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_440300(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_440300(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe2cbec09a --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_440300() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_440300(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_440300(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68da594354 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void inverseSqrt_440300() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_440300(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_440300(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020CC4502790(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020CC4502790(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.glsl new file mode 100644 index 0000000000..d673b30861 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_440300() { + float16_t arg_0 = 0.0hf; + float16_t res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_440300(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_440300() { + float16_t arg_0 = 0.0hf; + float16_t res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_440300(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_440300() { + float16_t arg_0 = 0.0hf; + float16_t res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_440300(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.msl new file mode 100644 index 0000000000..f8cd8539be --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_440300() { + half arg_0 = 0.0h; + half res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_440300(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_440300(); + return; +} + +kernel void compute_main() { + inverseSqrt_440300(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.spvasm new file mode 100644 index 0000000000..d53e1d78b1 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_440300 "inverseSqrt_440300" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_440300 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 InverseSqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %inverseSqrt_440300 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %inverseSqrt_440300 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %inverseSqrt_440300 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0c832a9b5 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/440300.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn inverseSqrt_440300() { + var arg_0 = f16(); + var res : f16 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_440300(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_440300(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_440300(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl new file mode 100644 index 0000000000..e7e70aa188 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<2, f16>) -> vec<2, f16> +fn inverseSqrt_5f51f8() { + var arg_0 = vec2(f16()); + var res: vec2 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_5f51f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_5f51f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_5f51f8(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ed334a92c --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_5f51f8() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_5f51f8(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13b4979149 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void inverseSqrt_5f51f8() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_5f51f8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002676056B340(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002676056B340(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.glsl new file mode 100644 index 0000000000..4117f6a4ba --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_5f51f8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_5f51f8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_5f51f8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_5f51f8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_5f51f8() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_5f51f8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.msl new file mode 100644 index 0000000000..58cd62850e --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_5f51f8() { + half2 arg_0 = half2(0.0h); + half2 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_5f51f8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_5f51f8(); + return; +} + +kernel void compute_main() { + inverseSqrt_5f51f8(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d428891b2 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_5f51f8 "inverseSqrt_5f51f8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_5f51f8 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 InverseSqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %inverseSqrt_5f51f8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.wgsl new file mode 100644 index 0000000000..edabbfce51 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/5f51f8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn inverseSqrt_5f51f8() { + var arg_0 = vec2(f16()); + var res : vec2 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_5f51f8(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_5f51f8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_5f51f8(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl new file mode 100644 index 0000000000..286a18d036 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(f32) -> f32 +fn inverseSqrt_84407e() { + var arg_0 = 1.f; + var res: f32 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_84407e(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_84407e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_84407e(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..97c63e575d --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_84407e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_84407e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_84407e(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..97c63e575d --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_84407e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_84407e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_84407e(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl new file mode 100644 index 0000000000..9ddc69421a --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_84407e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_84407e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_84407e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl new file mode 100644 index 0000000000..61e9b67c70 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_84407e() { + float arg_0 = 1.0f; + float res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_84407e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_84407e(); + return; +} + +kernel void compute_main() { + inverseSqrt_84407e(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm new file mode 100644 index 0000000000..c3503738fa --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_84407e "inverseSqrt_84407e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%inverseSqrt_84407e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 InverseSqrt %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %inverseSqrt_84407e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %inverseSqrt_84407e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_84407e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl new file mode 100644 index 0000000000..6ab5da9b76 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn inverseSqrt_84407e() { + var arg_0 = 1.0f; + var res : f32 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_84407e(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_84407e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_84407e(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl new file mode 100644 index 0000000000..0074c41619 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(vec<2, f32>) -> vec<2, f32> +fn inverseSqrt_8f2bd2() { + var arg_0 = vec2(1.f); + var res: vec2 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_8f2bd2(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_8f2bd2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_8f2bd2(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6956b0b431 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_8f2bd2() { + float2 arg_0 = (1.0f).xx; + float2 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_8f2bd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_8f2bd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_8f2bd2(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6956b0b431 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_8f2bd2() { + float2 arg_0 = (1.0f).xx; + float2 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_8f2bd2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_8f2bd2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_8f2bd2(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl new file mode 100644 index 0000000000..5cd5fdb0d5 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void inverseSqrt_8f2bd2() { + vec2 arg_0 = vec2(1.0f); + vec2 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_8f2bd2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_8f2bd2() { + vec2 arg_0 = vec2(1.0f); + vec2 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_8f2bd2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_8f2bd2() { + vec2 arg_0 = vec2(1.0f); + vec2 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_8f2bd2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl new file mode 100644 index 0000000000..3c9cc54e48 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_8f2bd2() { + float2 arg_0 = float2(1.0f); + float2 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_8f2bd2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_8f2bd2(); + return; +} + +kernel void compute_main() { + inverseSqrt_8f2bd2(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm new file mode 100644 index 0000000000..db0bc7f49b --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_8f2bd2 "inverseSqrt_8f2bd2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%inverseSqrt_8f2bd2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 InverseSqrt %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %inverseSqrt_8f2bd2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_8f2bd2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %inverseSqrt_8f2bd2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl new file mode 100644 index 0000000000..6d49dff6ed --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn inverseSqrt_8f2bd2() { + var arg_0 = vec2(1.0f); + var res : vec2 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_8f2bd2(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_8f2bd2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_8f2bd2(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl new file mode 100644 index 0000000000..fa7fb19b2d --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(vec<3, f32>) -> vec<3, f32> +fn inverseSqrt_b197b1() { + var arg_0 = vec3(1.f); + var res: vec3 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b197b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b197b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b197b1(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..77b75e25c4 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_b197b1() { + float3 arg_0 = (1.0f).xxx; + float3 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b197b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b197b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b197b1(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77b75e25c4 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_b197b1() { + float3 arg_0 = (1.0f).xxx; + float3 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b197b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b197b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b197b1(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl new file mode 100644 index 0000000000..07deb2d286 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void inverseSqrt_b197b1() { + vec3 arg_0 = vec3(1.0f); + vec3 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_b197b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_b197b1() { + vec3 arg_0 = vec3(1.0f); + vec3 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_b197b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_b197b1() { + vec3 arg_0 = vec3(1.0f); + vec3 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_b197b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl new file mode 100644 index 0000000000..686c30f552 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_b197b1() { + float3 arg_0 = float3(1.0f); + float3 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_b197b1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_b197b1(); + return; +} + +kernel void compute_main() { + inverseSqrt_b197b1(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm new file mode 100644 index 0000000000..18110312bd --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_b197b1 "inverseSqrt_b197b1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%inverseSqrt_b197b1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 InverseSqrt %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %inverseSqrt_b197b1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_b197b1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %inverseSqrt_b197b1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b7c5f6462 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn inverseSqrt_b197b1() { + var arg_0 = vec3(1.0f); + var res : vec3 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b197b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b197b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b197b1(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl new file mode 100644 index 0000000000..4a9369f80c --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<3, f16>) -> vec<3, f16> +fn inverseSqrt_b85ebd() { + var arg_0 = vec3(f16()); + var res: vec3 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b85ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b85ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b85ebd(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fdeb4e86d9 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_b85ebd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b85ebd(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4fd1981ca6 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void inverseSqrt_b85ebd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_b85ebd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000214452BD540(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000214452BD540(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.glsl new file mode 100644 index 0000000000..bf3927205f --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_b85ebd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_b85ebd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_b85ebd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_b85ebd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_b85ebd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_b85ebd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.msl new file mode 100644 index 0000000000..a7f7be195c --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_b85ebd() { + half3 arg_0 = half3(0.0h); + half3 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_b85ebd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_b85ebd(); + return; +} + +kernel void compute_main() { + inverseSqrt_b85ebd(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.spvasm new file mode 100644 index 0000000000..a43efc81ab --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_b85ebd "inverseSqrt_b85ebd" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_b85ebd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 InverseSqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %inverseSqrt_b85ebd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.wgsl new file mode 100644 index 0000000000..b53c8ee421 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/b85ebd.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn inverseSqrt_b85ebd() { + var arg_0 = vec3(f16()); + var res : vec3 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_b85ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_b85ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_b85ebd(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl new file mode 100644 index 0000000000..5fc9084cfc --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn inverseSqrt(vec<4, f32>) -> vec<4, f32> +fn inverseSqrt_c22347() { + var arg_0 = vec4(1.f); + var res: vec4 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_c22347(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_c22347(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_c22347(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bbc1a79de3 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_c22347() { + float4 arg_0 = (1.0f).xxxx; + float4 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_c22347(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_c22347(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_c22347(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bbc1a79de3 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_c22347() { + float4 arg_0 = (1.0f).xxxx; + float4 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_c22347(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_c22347(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_c22347(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl new file mode 100644 index 0000000000..ca6a413b52 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void inverseSqrt_c22347() { + vec4 arg_0 = vec4(1.0f); + vec4 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_c22347(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void inverseSqrt_c22347() { + vec4 arg_0 = vec4(1.0f); + vec4 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_c22347(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void inverseSqrt_c22347() { + vec4 arg_0 = vec4(1.0f); + vec4 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_c22347(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl new file mode 100644 index 0000000000..a0933d1469 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_c22347() { + float4 arg_0 = float4(1.0f); + float4 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_c22347(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_c22347(); + return; +} + +kernel void compute_main() { + inverseSqrt_c22347(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm new file mode 100644 index 0000000000..4c1b062b52 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_c22347 "inverseSqrt_c22347" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%inverseSqrt_c22347 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 InverseSqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %inverseSqrt_c22347 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %inverseSqrt_c22347 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %inverseSqrt_c22347 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl new file mode 100644 index 0000000000..d5aeee3f3d --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn inverseSqrt_c22347() { + var arg_0 = vec4(1.0f); + var res : vec4 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_c22347(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_c22347(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_c22347(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl new file mode 100644 index 0000000000..fdb5f64849 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn inverseSqrt(vec<4, f16>) -> vec<4, f16> +fn inverseSqrt_cbdc70() { + var arg_0 = vec4(f16()); + var res: vec4 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_cbdc70(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_cbdc70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_cbdc70(); +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae31e2e3bf --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void inverseSqrt_cbdc70() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_cbdc70(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5079fc1bbc --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void inverseSqrt_cbdc70() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + inverseSqrt_cbdc70(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024C10401C30(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024C10401C30(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.glsl new file mode 100644 index 0000000000..5d41267e07 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_cbdc70() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = inversesqrt(arg_0); +} + +vec4 vertex_main() { + inverseSqrt_cbdc70(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void inverseSqrt_cbdc70() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = inversesqrt(arg_0); +} + +void fragment_main() { + inverseSqrt_cbdc70(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void inverseSqrt_cbdc70() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = inversesqrt(arg_0); +} + +void compute_main() { + inverseSqrt_cbdc70(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.msl new file mode 100644 index 0000000000..0dc51ef684 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void inverseSqrt_cbdc70() { + half4 arg_0 = half4(0.0h); + half4 res = rsqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + inverseSqrt_cbdc70(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + inverseSqrt_cbdc70(); + return; +} + +kernel void compute_main() { + inverseSqrt_cbdc70(); + return; +} + diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.spvasm new file mode 100644 index 0000000000..e476973fac --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %inverseSqrt_cbdc70 "inverseSqrt_cbdc70" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%inverseSqrt_cbdc70 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 InverseSqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %inverseSqrt_cbdc70 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.wgsl new file mode 100644 index 0000000000..f4e10cf477 --- /dev/null +++ b/test/tint/builtins/gen/var/inverseSqrt/cbdc70.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn inverseSqrt_cbdc70() { + var arg_0 = vec4(f16()); + var res : vec4 = inverseSqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + inverseSqrt_cbdc70(); + return vec4(); +} + +@fragment +fn fragment_main() { + inverseSqrt_cbdc70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + inverseSqrt_cbdc70(); +} diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl new file mode 100644 index 0000000000..152969f810 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<2, f16>, vec<2, i32>) -> vec<2, f16> +fn ldexp_3d90b4() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(1); + var res: vec2 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_3d90b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_3d90b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_3d90b4(); +} diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..876fcb1a34 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_3d90b4() { + vector arg_0 = (float16_t(0.0h)).xx; + int2 arg_1 = (1).xx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_3d90b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_3d90b4(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e19db386b6 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void ldexp_3d90b4() { + vector arg_0 = (float16_t(0.0h)).xx; + int2 arg_1 = (1).xx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_3d90b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_3d90b4(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000297E2767C20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000297E2767C20(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.glsl new file mode 100644 index 0000000000..13d5b8901e --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_3d90b4() { + f16vec2 arg_0 = f16vec2(0.0hf); + ivec2 arg_1 = ivec2(1); + f16vec2 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_3d90b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_3d90b4() { + f16vec2 arg_0 = f16vec2(0.0hf); + ivec2 arg_1 = ivec2(1); + f16vec2 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_3d90b4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_3d90b4() { + f16vec2 arg_0 = f16vec2(0.0hf); + ivec2 arg_1 = ivec2(1); + f16vec2 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_3d90b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.msl new file mode 100644 index 0000000000..317c875f17 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_3d90b4() { + half2 arg_0 = half2(0.0h); + int2 arg_1 = int2(1); + half2 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_3d90b4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_3d90b4(); + return; +} + +kernel void compute_main() { + ldexp_3d90b4(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.spvasm new file mode 100644 index 0000000000..61326bd8b9 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_3d90b4 "ldexp_3d90b4" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_3d90b4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2int Function %24 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %21 + %27 = OpLoad %v2half %arg_0 + %28 = OpLoad %v2int %arg_1 + %25 = OpExtInst %v2half %26 Ldexp %27 %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %ldexp_3d90b4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_3d90b4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %ldexp_3d90b4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4773b8f7a --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/3d90b4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn ldexp_3d90b4() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(1); + var res : vec2 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_3d90b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_3d90b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_3d90b4(); +} diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl new file mode 100644 index 0000000000..2bf526d0ae --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(f16, i32) -> f16 +fn ldexp_624e0c() { + var arg_0 = f16(); + var arg_1 = 1; + var res: f16 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_624e0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_624e0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_624e0c(); +} diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6c7e796f95 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_624e0c() { + float16_t arg_0 = float16_t(0.0h); + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_624e0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_624e0c(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77d2859f6b --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void ldexp_624e0c() { + float16_t arg_0 = float16_t(0.0h); + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_624e0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_624e0c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8D38A1580(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8D38A1580(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.glsl new file mode 100644 index 0000000000..f978069f59 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_624e0c() { + float16_t arg_0 = 0.0hf; + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_624e0c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_624e0c() { + float16_t arg_0 = 0.0hf; + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_624e0c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_624e0c() { + float16_t arg_0 = 0.0hf; + int arg_1 = 1; + float16_t res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_624e0c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.msl new file mode 100644 index 0000000000..f0bc88f5de --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_624e0c() { + half arg_0 = 0.0h; + int arg_1 = 1; + half res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_624e0c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_624e0c(); + return; +} + +kernel void compute_main() { + ldexp_624e0c(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fead306b3 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_624e0c "ldexp_624e0c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_624e0c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %int_1 + %24 = OpLoad %half %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpExtInst %half %23 Ldexp %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %ldexp_624e0c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %ldexp_624e0c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_624e0c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.wgsl new file mode 100644 index 0000000000..393f1ba872 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/624e0c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn ldexp_624e0c() { + var arg_0 = f16(); + var arg_1 = 1; + var res : f16 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_624e0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_624e0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_624e0c(); +} diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl new file mode 100644 index 0000000000..8904fef899 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<3, f16>, vec<3, i32>) -> vec<3, f16> +fn ldexp_7485ce() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(1); + var res: vec3 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7485ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7485ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7485ce(); +} diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ca8bf2bcac --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_7485ce() { + vector arg_0 = (float16_t(0.0h)).xxx; + int3 arg_1 = (1).xxx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7485ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7485ce(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa06333971 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void ldexp_7485ce() { + vector arg_0 = (float16_t(0.0h)).xxx; + int3 arg_1 = (1).xxx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7485ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7485ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001553C486F80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001553C486F80(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.glsl new file mode 100644 index 0000000000..39204f5ac8 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7485ce() { + f16vec3 arg_0 = f16vec3(0.0hf); + ivec3 arg_1 = ivec3(1); + f16vec3 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_7485ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_7485ce() { + f16vec3 arg_0 = f16vec3(0.0hf); + ivec3 arg_1 = ivec3(1); + f16vec3 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_7485ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7485ce() { + f16vec3 arg_0 = f16vec3(0.0hf); + ivec3 arg_1 = ivec3(1); + f16vec3 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_7485ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.msl new file mode 100644 index 0000000000..3475cb2467 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_7485ce() { + half3 arg_0 = half3(0.0h); + int3 arg_1 = int3(1); + half3 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_7485ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_7485ce(); + return; +} + +kernel void compute_main() { + ldexp_7485ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..046509c282 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_7485ce "ldexp_7485ce" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpConstantNull %v3int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_7485ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3int Function %24 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %21 + %27 = OpLoad %v3half %arg_0 + %28 = OpLoad %v3int %arg_1 + %25 = OpExtInst %v3half %26 Ldexp %27 %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %ldexp_7485ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_7485ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %ldexp_7485ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..004f279727 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7485ce.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn ldexp_7485ce() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(1); + var res : vec3 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7485ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7485ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7485ce(); +} diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl new file mode 100644 index 0000000000..b5b562f70b --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn ldexp(vec<4, f16>, vec<4, i32>) -> vec<4, f16> +fn ldexp_7fa13c() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(1); + var res: vec4 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7fa13c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7fa13c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7fa13c(); +} diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd28414385 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_7fa13c() { + vector arg_0 = (float16_t(0.0h)).xxxx; + int4 arg_1 = (1).xxxx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7fa13c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7fa13c(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..07506fca80 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void ldexp_7fa13c() { + vector arg_0 = (float16_t(0.0h)).xxxx; + int4 arg_1 = (1).xxxx; + vector res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_7fa13c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_7fa13c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020AEA25D620(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020AEA25D620(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.glsl new file mode 100644 index 0000000000..d447a14634 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7fa13c() { + f16vec4 arg_0 = f16vec4(0.0hf); + ivec4 arg_1 = ivec4(1); + f16vec4 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_7fa13c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void ldexp_7fa13c() { + f16vec4 arg_0 = f16vec4(0.0hf); + ivec4 arg_1 = ivec4(1); + f16vec4 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_7fa13c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void ldexp_7fa13c() { + f16vec4 arg_0 = f16vec4(0.0hf); + ivec4 arg_1 = ivec4(1); + f16vec4 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_7fa13c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.msl new file mode 100644 index 0000000000..b4089fb7ad --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_7fa13c() { + half4 arg_0 = half4(0.0h); + int4 arg_1 = int4(1); + half4 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_7fa13c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_7fa13c(); + return; +} + +kernel void compute_main() { + ldexp_7fa13c(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b6c20a73a --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_7fa13c "ldexp_7fa13c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %21 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %24 = OpConstantNull %v4int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%ldexp_7fa13c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4int Function %24 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %21 + %27 = OpLoad %v4half %arg_0 + %28 = OpLoad %v4int %arg_1 + %25 = OpExtInst %v4half %26 Ldexp %27 %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %ldexp_7fa13c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_7fa13c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %ldexp_7fa13c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.wgsl new file mode 100644 index 0000000000..350729e0fb --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/7fa13c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn ldexp_7fa13c() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(1); + var res : vec4 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_7fa13c(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_7fa13c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_7fa13c(); +} diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl new file mode 100644 index 0000000000..e6fa75ef8e --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(vec<3, f32>, vec<3, i32>) -> vec<3, f32> +fn ldexp_a31cdc() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1); + var res: vec3 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_a31cdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_a31cdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_a31cdc(); +} diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..feac4453ee --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_a31cdc() { + float3 arg_0 = (1.0f).xxx; + int3 arg_1 = (1).xxx; + float3 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_a31cdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_a31cdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_a31cdc(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..feac4453ee --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_a31cdc() { + float3 arg_0 = (1.0f).xxx; + int3 arg_1 = (1).xxx; + float3 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_a31cdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_a31cdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_a31cdc(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl new file mode 100644 index 0000000000..c9bc4617fb --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void ldexp_a31cdc() { + vec3 arg_0 = vec3(1.0f); + ivec3 arg_1 = ivec3(1); + vec3 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_a31cdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_a31cdc() { + vec3 arg_0 = vec3(1.0f); + ivec3 arg_1 = ivec3(1); + vec3 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_a31cdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_a31cdc() { + vec3 arg_0 = vec3(1.0f); + ivec3 arg_1 = ivec3(1); + vec3 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_a31cdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl new file mode 100644 index 0000000000..f8215af477 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_a31cdc() { + float3 arg_0 = float3(1.0f); + int3 arg_1 = int3(1); + float3 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_a31cdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_a31cdc(); + return; +} + +kernel void compute_main() { + ldexp_a31cdc(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..560f0ab5c3 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_a31cdc "ldexp_a31cdc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %22 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %25 = OpConstantNull %v3int + %31 = OpTypeFunction %v4float +%ldexp_a31cdc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3int Function %25 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %22 + %28 = OpLoad %v3float %arg_0 + %29 = OpLoad %v3int %arg_1 + %26 = OpExtInst %v3float %27 Ldexp %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_a31cdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_a31cdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %ldexp_a31cdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e5f870926 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn ldexp_a31cdc() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1); + var res : vec3 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_a31cdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_a31cdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_a31cdc(); +} diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl new file mode 100644 index 0000000000..2ac13ae88c --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(vec<2, f32>, vec<2, i32>) -> vec<2, f32> +fn ldexp_abd718() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1); + var res: vec2 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_abd718(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_abd718(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_abd718(); +} diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47cfc47b77 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_abd718() { + float2 arg_0 = (1.0f).xx; + int2 arg_1 = (1).xx; + float2 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_abd718(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_abd718(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_abd718(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..47cfc47b77 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_abd718() { + float2 arg_0 = (1.0f).xx; + int2 arg_1 = (1).xx; + float2 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_abd718(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_abd718(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_abd718(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl new file mode 100644 index 0000000000..d024ddac59 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void ldexp_abd718() { + vec2 arg_0 = vec2(1.0f); + ivec2 arg_1 = ivec2(1); + vec2 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_abd718(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_abd718() { + vec2 arg_0 = vec2(1.0f); + ivec2 arg_1 = ivec2(1); + vec2 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_abd718(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_abd718() { + vec2 arg_0 = vec2(1.0f); + ivec2 arg_1 = ivec2(1); + vec2 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_abd718(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl new file mode 100644 index 0000000000..7cfe631d9d --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_abd718() { + float2 arg_0 = float2(1.0f); + int2 arg_1 = int2(1); + float2 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_abd718(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_abd718(); + return; +} + +kernel void compute_main() { + ldexp_abd718(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm new file mode 100644 index 0000000000..1bd52811d1 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_abd718 "ldexp_abd718" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %22 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %31 = OpTypeFunction %v4float +%ldexp_abd718 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2int Function %25 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %22 + %28 = OpLoad %v2float %arg_0 + %29 = OpLoad %v2int %arg_1 + %26 = OpExtInst %v2float %27 Ldexp %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %ldexp_abd718 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %ldexp_abd718 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %ldexp_abd718 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl new file mode 100644 index 0000000000..92b66d8c49 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn ldexp_abd718() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1); + var res : vec2 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_abd718(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_abd718(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_abd718(); +} diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl new file mode 100644 index 0000000000..2fe0571124 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(vec<4, f32>, vec<4, i32>) -> vec<4, f32> +fn ldexp_cc9cde() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1); + var res: vec4 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_cc9cde(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_cc9cde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_cc9cde(); +} diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d1ee9bf7c4 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_cc9cde() { + float4 arg_0 = (1.0f).xxxx; + int4 arg_1 = (1).xxxx; + float4 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_cc9cde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_cc9cde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_cc9cde(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d1ee9bf7c4 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_cc9cde() { + float4 arg_0 = (1.0f).xxxx; + int4 arg_1 = (1).xxxx; + float4 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_cc9cde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_cc9cde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_cc9cde(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl new file mode 100644 index 0000000000..fdb98cd0e2 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void ldexp_cc9cde() { + vec4 arg_0 = vec4(1.0f); + ivec4 arg_1 = ivec4(1); + vec4 res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_cc9cde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_cc9cde() { + vec4 arg_0 = vec4(1.0f); + ivec4 arg_1 = ivec4(1); + vec4 res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_cc9cde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_cc9cde() { + vec4 arg_0 = vec4(1.0f); + ivec4 arg_1 = ivec4(1); + vec4 res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_cc9cde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl new file mode 100644 index 0000000000..2b70f29c63 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_cc9cde() { + float4 arg_0 = float4(1.0f); + int4 arg_1 = int4(1); + float4 res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_cc9cde(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_cc9cde(); + return; +} + +kernel void compute_main() { + ldexp_cc9cde(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm new file mode 100644 index 0000000000..7dfbd0e979 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_cc9cde "ldexp_cc9cde" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %20 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %23 = OpConstantNull %v4int + %29 = OpTypeFunction %v4float +%ldexp_cc9cde = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4int Function %23 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %20 + %26 = OpLoad %v4float %arg_0 + %27 = OpLoad %v4int %arg_1 + %24 = OpExtInst %v4float %25 Ldexp %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %ldexp_cc9cde + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %ldexp_cc9cde + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %ldexp_cc9cde + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac164c7655 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn ldexp_cc9cde() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1); + var res : vec4 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_cc9cde(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_cc9cde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_cc9cde(); +} diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl new file mode 100644 index 0000000000..5caec47f7d --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn ldexp(f32, i32) -> f32 +fn ldexp_db8b49() { + var arg_0 = 1.f; + var arg_1 = 1; + var res: f32 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_db8b49(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_db8b49(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_db8b49(); +} diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9f6253185a --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_db8b49(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_db8b49(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_db8b49(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f6253185a --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + ldexp_db8b49(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + ldexp_db8b49(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + ldexp_db8b49(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl new file mode 100644 index 0000000000..72e097224d --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +vec4 vertex_main() { + ldexp_db8b49(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +void fragment_main() { + ldexp_db8b49(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +void compute_main() { + ldexp_db8b49(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl new file mode 100644 index 0000000000..e980316da9 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void ldexp_db8b49() { + float arg_0 = 1.0f; + int arg_1 = 1; + float res = ldexp(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + ldexp_db8b49(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + ldexp_db8b49(); + return; +} + +kernel void compute_main() { + ldexp_db8b49(); + return; +} + diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a22486b7b --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ldexp_db8b49 "ldexp_db8b49" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %26 = OpTypeFunction %v4float +%ldexp_db8b49 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %int_1 + %23 = OpLoad %float %arg_0 + %24 = OpLoad %int %arg_1 + %21 = OpExtInst %float %22 Ldexp %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %ldexp_db8b49 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %ldexp_db8b49 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %ldexp_db8b49 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl new file mode 100644 index 0000000000..b20b79c7d3 --- /dev/null +++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn ldexp_db8b49() { + var arg_0 = 1.0f; + var arg_1 = 1; + var res : f32 = ldexp(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + ldexp_db8b49(); + return vec4(); +} + +@fragment +fn fragment_main() { + ldexp_db8b49(); +} + +@compute @workgroup_size(1) +fn compute_main() { + ldexp_db8b49(); +} diff --git a/test/tint/builtins/gen/var/length/056071.wgsl b/test/tint/builtins/gen/var/length/056071.wgsl new file mode 100644 index 0000000000..27552326c5 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(vec<3, f32>) -> f32 +fn length_056071() { + var arg_0 = vec3(1.f); + var res: f32 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_056071(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_056071(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_056071(); +} diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..563246cfa3 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_056071() { + float3 arg_0 = (1.0f).xxx; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_056071(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_056071(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_056071(); + return; +} diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..563246cfa3 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void length_056071() { + float3 arg_0 = (1.0f).xxx; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_056071(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_056071(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_056071(); + return; +} diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl new file mode 100644 index 0000000000..c7442a6bd7 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void length_056071() { + vec3 arg_0 = vec3(1.0f); + float res = length(arg_0); +} + +vec4 vertex_main() { + length_056071(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_056071() { + vec3 arg_0 = vec3(1.0f); + float res = length(arg_0); +} + +void fragment_main() { + length_056071(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_056071() { + vec3 arg_0 = vec3(1.0f); + float res = length(arg_0); +} + +void compute_main() { + length_056071(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.msl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.msl new file mode 100644 index 0000000000..f2ba3c3ed3 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_056071() { + float3 arg_0 = float3(1.0f); + float res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_056071(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_056071(); + return; +} + +kernel void compute_main() { + length_056071(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm new file mode 100644 index 0000000000..45c6997238 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_056071 "length_056071" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float +%length_056071 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %float %20 Length %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %length_056071 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %length_056071 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %length_056071 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl new file mode 100644 index 0000000000..b5ddeb0079 --- /dev/null +++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn length_056071() { + var arg_0 = vec3(1.0f); + var res : f32 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_056071(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_056071(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_056071(); +} diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl new file mode 100644 index 0000000000..6aa251cab7 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<2, f16>) -> f16 +fn length_3f0e13() { + var arg_0 = vec2(f16()); + var res: f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_3f0e13(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_3f0e13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_3f0e13(); +} diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef03b061f5 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_3f0e13() { + vector arg_0 = (float16_t(0.0h)).xx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_3f0e13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_3f0e13(); + return; +} diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01eb8511c7 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void length_3f0e13() { + vector arg_0 = (float16_t(0.0h)).xx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_3f0e13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_3f0e13(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020BA93CCC20(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020BA93CCC20(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020BA93CCC20(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.glsl new file mode 100644 index 0000000000..a5f2471c6d --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_3f0e13() { + f16vec2 arg_0 = f16vec2(0.0hf); + float16_t res = length(arg_0); +} + +vec4 vertex_main() { + length_3f0e13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_3f0e13() { + f16vec2 arg_0 = f16vec2(0.0hf); + float16_t res = length(arg_0); +} + +void fragment_main() { + length_3f0e13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_3f0e13() { + f16vec2 arg_0 = f16vec2(0.0hf); + float16_t res = length(arg_0); +} + +void compute_main() { + length_3f0e13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.msl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.msl new file mode 100644 index 0000000000..797b6fbc4f --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_3f0e13() { + half2 arg_0 = half2(0.0h); + half res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_3f0e13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_3f0e13(); + return; +} + +kernel void compute_main() { + length_3f0e13(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.spvasm new file mode 100644 index 0000000000..a92c3f18b1 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_3f0e13 "length_3f0e13" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpConstantNull %half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_3f0e13 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_half Function %23 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %half %19 Length %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %length_3f0e13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_3f0e13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %length_3f0e13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.wgsl new file mode 100644 index 0000000000..317830d360 --- /dev/null +++ b/test/tint/builtins/gen/var/length/3f0e13.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn length_3f0e13() { + var arg_0 = vec2(f16()); + var res : f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_3f0e13(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_3f0e13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_3f0e13(); +} diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl new file mode 100644 index 0000000000..9c495a7755 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<4, f16>) -> f16 +fn length_5b1a9b() { + var arg_0 = vec4(f16()); + var res: f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_5b1a9b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_5b1a9b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_5b1a9b(); +} diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4865222bf3 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_5b1a9b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_5b1a9b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_5b1a9b(); + return; +} diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ea492e2b4 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void length_5b1a9b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_5b1a9b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_5b1a9b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EF153A9D90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EF153A9D90(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EF153A9D90(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.glsl new file mode 100644 index 0000000000..75b0701773 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_5b1a9b() { + f16vec4 arg_0 = f16vec4(0.0hf); + float16_t res = length(arg_0); +} + +vec4 vertex_main() { + length_5b1a9b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_5b1a9b() { + f16vec4 arg_0 = f16vec4(0.0hf); + float16_t res = length(arg_0); +} + +void fragment_main() { + length_5b1a9b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_5b1a9b() { + f16vec4 arg_0 = f16vec4(0.0hf); + float16_t res = length(arg_0); +} + +void compute_main() { + length_5b1a9b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.msl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.msl new file mode 100644 index 0000000000..885dd6662e --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_5b1a9b() { + half4 arg_0 = half4(0.0h); + half res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_5b1a9b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_5b1a9b(); + return; +} + +kernel void compute_main() { + length_5b1a9b(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d97afeb8d --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_5b1a9b "length_5b1a9b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpConstantNull %half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_5b1a9b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_half Function %23 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %half %19 Length %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %length_5b1a9b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_5b1a9b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %length_5b1a9b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e0095b9b4 --- /dev/null +++ b/test/tint/builtins/gen/var/length/5b1a9b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn length_5b1a9b() { + var arg_0 = vec4(f16()); + var res : f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_5b1a9b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_5b1a9b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_5b1a9b(); +} diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl b/test/tint/builtins/gen/var/length/602a17.wgsl new file mode 100644 index 0000000000..407ab650e9 --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(f32) -> f32 +fn length_602a17() { + var arg_0 = 1.f; + var res: f32 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_602a17(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_602a17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_602a17(); +} diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f4310e82c --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_602a17() { + float arg_0 = 1.0f; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_602a17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_602a17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_602a17(); + return; +} diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5f4310e82c --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void length_602a17() { + float arg_0 = 1.0f; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_602a17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_602a17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_602a17(); + return; +} diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl new file mode 100644 index 0000000000..41ad408b51 --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void length_602a17() { + float arg_0 = 1.0f; + float res = length(arg_0); +} + +vec4 vertex_main() { + length_602a17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_602a17() { + float arg_0 = 1.0f; + float res = length(arg_0); +} + +void fragment_main() { + length_602a17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_602a17() { + float arg_0 = 1.0f; + float res = length(arg_0); +} + +void compute_main() { + length_602a17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl new file mode 100644 index 0000000000..a88e9edc14 --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_602a17() { + float arg_0 = 1.0f; + float res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_602a17(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_602a17(); + return; +} + +kernel void compute_main() { + length_602a17(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm new file mode 100644 index 0000000000..7d99bccc7d --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_602a17 "length_602a17" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%length_602a17 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Length %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %length_602a17 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %length_602a17 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %length_602a17 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d1a3db6b7 --- /dev/null +++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn length_602a17() { + var arg_0 = 1.0f; + var res : f32 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_602a17(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_602a17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_602a17(); +} diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl b/test/tint/builtins/gen/var/length/afde8b.wgsl new file mode 100644 index 0000000000..d24ca0b32a --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(vec<2, f32>) -> f32 +fn length_afde8b() { + var arg_0 = vec2(1.f); + var res: f32 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_afde8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_afde8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_afde8b(); +} diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..36522765e6 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_afde8b() { + float2 arg_0 = (1.0f).xx; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_afde8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_afde8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_afde8b(); + return; +} diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..36522765e6 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void length_afde8b() { + float2 arg_0 = (1.0f).xx; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_afde8b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_afde8b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_afde8b(); + return; +} diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl new file mode 100644 index 0000000000..95b2f856a8 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void length_afde8b() { + vec2 arg_0 = vec2(1.0f); + float res = length(arg_0); +} + +vec4 vertex_main() { + length_afde8b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_afde8b() { + vec2 arg_0 = vec2(1.0f); + float res = length(arg_0); +} + +void fragment_main() { + length_afde8b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_afde8b() { + vec2 arg_0 = vec2(1.0f); + float res = length(arg_0); +} + +void compute_main() { + length_afde8b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl new file mode 100644 index 0000000000..b283afea9e --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_afde8b() { + float2 arg_0 = float2(1.0f); + float res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_afde8b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_afde8b(); + return; +} + +kernel void compute_main() { + length_afde8b(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm new file mode 100644 index 0000000000..603a9b03fc --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_afde8b "length_afde8b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float +%length_afde8b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %float %20 Length %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %length_afde8b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %length_afde8b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %length_afde8b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl new file mode 100644 index 0000000000..17ad733058 --- /dev/null +++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn length_afde8b() { + var arg_0 = vec2(1.0f); + var res : f32 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_afde8b(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_afde8b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_afde8b(); +} diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl new file mode 100644 index 0000000000..c45837edff --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(vec<3, f16>) -> f16 +fn length_ba16d6() { + var arg_0 = vec3(f16()); + var res: f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_ba16d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_ba16d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_ba16d6(); +} diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7480de09db --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_ba16d6() { + vector arg_0 = (float16_t(0.0h)).xxx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_ba16d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_ba16d6(); + return; +} diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1629874098 --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void length_ba16d6() { + vector arg_0 = (float16_t(0.0h)).xxx; + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_ba16d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_ba16d6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002644DC827C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002644DC827C0(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002644DC827C0(3,13-15): error X3000: unrecognized identifier 'res' + diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.glsl new file mode 100644 index 0000000000..ea04f30ef6 --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_ba16d6() { + f16vec3 arg_0 = f16vec3(0.0hf); + float16_t res = length(arg_0); +} + +vec4 vertex_main() { + length_ba16d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_ba16d6() { + f16vec3 arg_0 = f16vec3(0.0hf); + float16_t res = length(arg_0); +} + +void fragment_main() { + length_ba16d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_ba16d6() { + f16vec3 arg_0 = f16vec3(0.0hf); + float16_t res = length(arg_0); +} + +void compute_main() { + length_ba16d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.msl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.msl new file mode 100644 index 0000000000..54123fcd29 --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_ba16d6() { + half3 arg_0 = half3(0.0h); + half res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_ba16d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_ba16d6(); + return; +} + +kernel void compute_main() { + length_ba16d6(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ec76a0a73 --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_ba16d6 "length_ba16d6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpConstantNull %half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_ba16d6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_half Function %23 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %half %19 Length %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %length_ba16d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_ba16d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %length_ba16d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..9ad37a931d --- /dev/null +++ b/test/tint/builtins/gen/var/length/ba16d6.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn length_ba16d6() { + var arg_0 = vec3(f16()); + var res : f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_ba16d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_ba16d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_ba16d6(); +} diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl b/test/tint/builtins/gen/var/length/becebf.wgsl new file mode 100644 index 0000000000..ef00979eb8 --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn length(vec<4, f32>) -> f32 +fn length_becebf() { + var arg_0 = vec4(1.f); + var res: f32 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_becebf(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_becebf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_becebf(); +} diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..12594bc3cf --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_becebf() { + float4 arg_0 = (1.0f).xxxx; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_becebf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_becebf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_becebf(); + return; +} diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..12594bc3cf --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void length_becebf() { + float4 arg_0 = (1.0f).xxxx; + float res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_becebf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_becebf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_becebf(); + return; +} diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl new file mode 100644 index 0000000000..abe433f234 --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void length_becebf() { + vec4 arg_0 = vec4(1.0f); + float res = length(arg_0); +} + +vec4 vertex_main() { + length_becebf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void length_becebf() { + vec4 arg_0 = vec4(1.0f); + float res = length(arg_0); +} + +void fragment_main() { + length_becebf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void length_becebf() { + vec4 arg_0 = vec4(1.0f); + float res = length(arg_0); +} + +void compute_main() { + length_becebf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl new file mode 100644 index 0000000000..27c3e89215 --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_becebf() { + float4 arg_0 = float4(1.0f); + float res = length(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_becebf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_becebf(); + return; +} + +kernel void compute_main() { + length_becebf(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b2a58afa8 --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_becebf "length_becebf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float +%length_becebf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %float %18 Length %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %length_becebf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_becebf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_becebf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f7791a06d --- /dev/null +++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn length_becebf() { + var arg_0 = vec4(1.0f); + var res : f32 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_becebf(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_becebf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_becebf(); +} diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl b/test/tint/builtins/gen/var/length/c158da.wgsl new file mode 100644 index 0000000000..ce3f91f59f --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn length(f16) -> f16 +fn length_c158da() { + var arg_0 = f16(); + var res: f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_c158da(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_c158da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_c158da(); +} diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e8ad9f71a0 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void length_c158da() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_c158da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_c158da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_c158da(); + return; +} diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ff57d0b231 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void length_c158da() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = length(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + length_c158da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + length_c158da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + length_c158da(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000229284770C0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000229284770C0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.glsl new file mode 100644 index 0000000000..023690cb16 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_c158da() { + float16_t arg_0 = 0.0hf; + float16_t res = length(arg_0); +} + +vec4 vertex_main() { + length_c158da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void length_c158da() { + float16_t arg_0 = 0.0hf; + float16_t res = length(arg_0); +} + +void fragment_main() { + length_c158da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void length_c158da() { + float16_t arg_0 = 0.0hf; + float16_t res = length(arg_0); +} + +void compute_main() { + length_c158da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.msl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.msl new file mode 100644 index 0000000000..ea75d99360 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void length_c158da() { + half arg_0 = 0.0h; + half res = fabs(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + length_c158da(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + length_c158da(); + return; +} + +kernel void compute_main() { + length_c158da(); + return; +} + diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.spvasm new file mode 100644 index 0000000000..5b14574943 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %length_c158da "length_c158da" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%length_c158da = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Length %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %length_c158da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %length_c158da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %length_c158da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/length/c158da.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.wgsl new file mode 100644 index 0000000000..c86993b985 --- /dev/null +++ b/test/tint/builtins/gen/var/length/c158da.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn length_c158da() { + var arg_0 = f16(); + var res : f16 = length(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + length_c158da(); + return vec4(); +} + +@fragment +fn fragment_main() { + length_c158da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + length_c158da(); +} diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl b/test/tint/builtins/gen/var/log/3da25a.wgsl new file mode 100644 index 0000000000..3c4175732a --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(vec<4, f32>) -> vec<4, f32> +fn log_3da25a() { + var arg_0 = vec4(1.f); + var res: vec4 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_3da25a(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_3da25a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_3da25a(); +} diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..48ea81d96c --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_3da25a() { + float4 arg_0 = (1.0f).xxxx; + float4 res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_3da25a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_3da25a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_3da25a(); + return; +} diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..48ea81d96c --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void log_3da25a() { + float4 arg_0 = (1.0f).xxxx; + float4 res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_3da25a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_3da25a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_3da25a(); + return; +} diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl new file mode 100644 index 0000000000..a4e53d1aeb --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log_3da25a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = log(arg_0); +} + +vec4 vertex_main() { + log_3da25a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_3da25a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = log(arg_0); +} + +void fragment_main() { + log_3da25a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_3da25a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = log(arg_0); +} + +void compute_main() { + log_3da25a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl new file mode 100644 index 0000000000..6524679916 --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_3da25a() { + float4 arg_0 = float4(1.0f); + float4 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_3da25a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_3da25a(); + return; +} + +kernel void compute_main() { + log_3da25a(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm new file mode 100644 index 0000000000..196896f1a0 --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_3da25a "log_3da25a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %log_3da25a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Log %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log_3da25a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log_3da25a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log_3da25a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl new file mode 100644 index 0000000000..f66d4f5f55 --- /dev/null +++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log_3da25a() { + var arg_0 = vec4(1.0f); + var res : vec4 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_3da25a(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_3da25a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_3da25a(); +} diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl new file mode 100644 index 0000000000..c99e55d5ca --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<3, f16>) -> vec<3, f16> +fn log_6ff86f() { + var arg_0 = vec3(f16()); + var res: vec3 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_6ff86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_6ff86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_6ff86f(); +} diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..992df89e07 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_6ff86f() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_6ff86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_6ff86f(); + return; +} diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0ea573c830 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log_6ff86f() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_6ff86f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_6ff86f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029DD70F8770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029DD70F8770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.glsl new file mode 100644 index 0000000000..f4c8306889 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_6ff86f() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log(arg_0); +} + +vec4 vertex_main() { + log_6ff86f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_6ff86f() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log(arg_0); +} + +void fragment_main() { + log_6ff86f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_6ff86f() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log(arg_0); +} + +void compute_main() { + log_6ff86f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.msl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.msl new file mode 100644 index 0000000000..941fcd6799 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_6ff86f() { + half3 arg_0 = half3(0.0h); + half3 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_6ff86f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_6ff86f(); + return; +} + +kernel void compute_main() { + log_6ff86f(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc7f7de9a5 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_6ff86f "log_6ff86f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_6ff86f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Log %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log_6ff86f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_6ff86f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log_6ff86f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f1a204fa2 --- /dev/null +++ b/test/tint/builtins/gen/var/log/6ff86f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log_6ff86f() { + var arg_0 = vec3(f16()); + var res : vec3 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_6ff86f(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_6ff86f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_6ff86f(); +} diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl b/test/tint/builtins/gen/var/log/7114a6.wgsl new file mode 100644 index 0000000000..172fc2edd0 --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(f32) -> f32 +fn log_7114a6() { + var arg_0 = 1.f; + var res: f32 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_7114a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_7114a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_7114a6(); +} diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c908d84b77 --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_7114a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_7114a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_7114a6(); + return; +} diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c908d84b77 --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_7114a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_7114a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_7114a6(); + return; +} diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl new file mode 100644 index 0000000000..cac97bfadc --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +vec4 vertex_main() { + log_7114a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +void fragment_main() { + log_7114a6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +void compute_main() { + log_7114a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl new file mode 100644 index 0000000000..65aab32acb --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_7114a6() { + float arg_0 = 1.0f; + float res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_7114a6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_7114a6(); + return; +} + +kernel void compute_main() { + log_7114a6(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..0fab51b979 --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_7114a6 "log_7114a6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %log_7114a6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Log %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log_7114a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log_7114a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_7114a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..952ac3cfda --- /dev/null +++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log_7114a6() { + var arg_0 = 1.0f; + var res : f32 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_7114a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_7114a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_7114a6(); +} diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl new file mode 100644 index 0000000000..02a6f23118 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<2, f16>) -> vec<2, f16> +fn log_8f0e32() { + var arg_0 = vec2(f16()); + var res: vec2 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_8f0e32(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_8f0e32(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_8f0e32(); +} diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f17ddd1ff7 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_8f0e32() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_8f0e32(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_8f0e32(); + return; +} diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5c7cd72626 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log_8f0e32() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_8f0e32(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_8f0e32(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A51B8C05E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A51B8C05E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.glsl new file mode 100644 index 0000000000..5ed7deb5c9 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_8f0e32() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log(arg_0); +} + +vec4 vertex_main() { + log_8f0e32(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_8f0e32() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log(arg_0); +} + +void fragment_main() { + log_8f0e32(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_8f0e32() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log(arg_0); +} + +void compute_main() { + log_8f0e32(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.msl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.msl new file mode 100644 index 0000000000..975ed6d159 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_8f0e32() { + half2 arg_0 = half2(0.0h); + half2 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_8f0e32(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_8f0e32(); + return; +} + +kernel void compute_main() { + log_8f0e32(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.spvasm new file mode 100644 index 0000000000..06d9a8af7e --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_8f0e32 "log_8f0e32" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_8f0e32 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Log %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log_8f0e32 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_8f0e32 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log_8f0e32 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e83d31132 --- /dev/null +++ b/test/tint/builtins/gen/var/log/8f0e32.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log_8f0e32() { + var arg_0 = vec2(f16()); + var res : vec2 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_8f0e32(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_8f0e32(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_8f0e32(); +} diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl new file mode 100644 index 0000000000..f467a86bdb --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(vec<2, f32>) -> vec<2, f32> +fn log_b2ce28() { + var arg_0 = vec2(1.f); + var res: vec2 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_b2ce28(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_b2ce28(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_b2ce28(); +} diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..60c82a616d --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_b2ce28() { + float2 arg_0 = (1.0f).xx; + float2 res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_b2ce28(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_b2ce28(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_b2ce28(); + return; +} diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60c82a616d --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void log_b2ce28() { + float2 arg_0 = (1.0f).xx; + float2 res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_b2ce28(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_b2ce28(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_b2ce28(); + return; +} diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl new file mode 100644 index 0000000000..ce6c62b33b --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log_b2ce28() { + vec2 arg_0 = vec2(1.0f); + vec2 res = log(arg_0); +} + +vec4 vertex_main() { + log_b2ce28(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_b2ce28() { + vec2 arg_0 = vec2(1.0f); + vec2 res = log(arg_0); +} + +void fragment_main() { + log_b2ce28(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_b2ce28() { + vec2 arg_0 = vec2(1.0f); + vec2 res = log(arg_0); +} + +void compute_main() { + log_b2ce28(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl new file mode 100644 index 0000000000..fe0c6d661c --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_b2ce28() { + float2 arg_0 = float2(1.0f); + float2 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_b2ce28(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_b2ce28(); + return; +} + +kernel void compute_main() { + log_b2ce28(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm new file mode 100644 index 0000000000..5fc25bffb9 --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_b2ce28 "log_b2ce28" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float + %log_b2ce28 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Log %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %log_b2ce28 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_b2ce28 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log_b2ce28 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b5a9526e5 --- /dev/null +++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log_b2ce28() { + var arg_0 = vec2(1.0f); + var res : vec2 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_b2ce28(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_b2ce28(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_b2ce28(); +} diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl b/test/tint/builtins/gen/var/log/c9f489.wgsl new file mode 100644 index 0000000000..cc94795d46 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(f16) -> f16 +fn log_c9f489() { + var arg_0 = f16(); + var res: f16 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_c9f489(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_c9f489(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_c9f489(); +} diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f56a6b956f --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_c9f489() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_c9f489(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_c9f489(); + return; +} diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5929a1c109 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log_c9f489() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_c9f489(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_c9f489(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000242D2E74480(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000242D2E74480(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.glsl new file mode 100644 index 0000000000..ab6cf71b76 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_c9f489() { + float16_t arg_0 = 0.0hf; + float16_t res = log(arg_0); +} + +vec4 vertex_main() { + log_c9f489(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_c9f489() { + float16_t arg_0 = 0.0hf; + float16_t res = log(arg_0); +} + +void fragment_main() { + log_c9f489(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_c9f489() { + float16_t arg_0 = 0.0hf; + float16_t res = log(arg_0); +} + +void compute_main() { + log_c9f489(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.msl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.msl new file mode 100644 index 0000000000..2f4c5434b2 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_c9f489() { + half arg_0 = 0.0h; + half res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_c9f489(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_c9f489(); + return; +} + +kernel void compute_main() { + log_c9f489(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.spvasm new file mode 100644 index 0000000000..c2f50ce482 --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_c9f489 "log_c9f489" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_c9f489 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Log %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log_c9f489 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log_c9f489 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %log_c9f489 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4e30a39be --- /dev/null +++ b/test/tint/builtins/gen/var/log/c9f489.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log_c9f489() { + var arg_0 = f16(); + var res : f16 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_c9f489(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_c9f489(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_c9f489(); +} diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl new file mode 100644 index 0000000000..18c4837e1f --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log(vec<4, f16>) -> vec<4, f16> +fn log_cdbdc1() { + var arg_0 = vec4(f16()); + var res: vec4 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_cdbdc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_cdbdc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_cdbdc1(); +} diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4416f3e944 --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_cdbdc1() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_cdbdc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_cdbdc1(); + return; +} diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52bc9ae889 --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log_cdbdc1() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_cdbdc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_cdbdc1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002F51ED070D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002F51ED070D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.glsl new file mode 100644 index 0000000000..8f49855ec3 --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_cdbdc1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log(arg_0); +} + +vec4 vertex_main() { + log_cdbdc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log_cdbdc1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log(arg_0); +} + +void fragment_main() { + log_cdbdc1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log_cdbdc1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log(arg_0); +} + +void compute_main() { + log_cdbdc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.msl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.msl new file mode 100644 index 0000000000..e2e669ee3a --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_cdbdc1() { + half4 arg_0 = half4(0.0h); + half4 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_cdbdc1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_cdbdc1(); + return; +} + +kernel void compute_main() { + log_cdbdc1(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.spvasm new file mode 100644 index 0000000000..aebc066dab --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_cdbdc1 "log_cdbdc1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %log_cdbdc1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Log %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log_cdbdc1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_cdbdc1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log_cdbdc1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ded9287ea --- /dev/null +++ b/test/tint/builtins/gen/var/log/cdbdc1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log_cdbdc1() { + var arg_0 = vec4(f16()); + var res : vec4 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_cdbdc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_cdbdc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_cdbdc1(); +} diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl b/test/tint/builtins/gen/var/log/f4c570.wgsl new file mode 100644 index 0000000000..b509b5d3e8 --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log(vec<3, f32>) -> vec<3, f32> +fn log_f4c570() { + var arg_0 = vec3(1.f); + var res: vec3 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_f4c570(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_f4c570(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_f4c570(); +} diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b1ba5c35b6 --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log_f4c570() { + float3 arg_0 = (1.0f).xxx; + float3 res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_f4c570(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_f4c570(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_f4c570(); + return; +} diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1ba5c35b6 --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void log_f4c570() { + float3 arg_0 = (1.0f).xxx; + float3 res = log(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log_f4c570(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log_f4c570(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log_f4c570(); + return; +} diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl new file mode 100644 index 0000000000..945a3d97ce --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log_f4c570() { + vec3 arg_0 = vec3(1.0f); + vec3 res = log(arg_0); +} + +vec4 vertex_main() { + log_f4c570(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log_f4c570() { + vec3 arg_0 = vec3(1.0f); + vec3 res = log(arg_0); +} + +void fragment_main() { + log_f4c570(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log_f4c570() { + vec3 arg_0 = vec3(1.0f); + vec3 res = log(arg_0); +} + +void compute_main() { + log_f4c570(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl new file mode 100644 index 0000000000..7cf7fb27c6 --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log_f4c570() { + float3 arg_0 = float3(1.0f); + float3 res = log(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log_f4c570(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log_f4c570(); + return; +} + +kernel void compute_main() { + log_f4c570(); + return; +} + diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm new file mode 100644 index 0000000000..7dbf8f93a0 --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log_f4c570 "log_f4c570" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float + %log_f4c570 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Log %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %log_f4c570 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log_f4c570 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log_f4c570 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fa597057f --- /dev/null +++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log_f4c570() { + var arg_0 = vec3(1.0f); + var res : vec3 = log(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log_f4c570(); + return vec4(); +} + +@fragment +fn fragment_main() { + log_f4c570(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log_f4c570(); +} diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl b/test/tint/builtins/gen/var/log2/38b478.wgsl new file mode 100644 index 0000000000..9be143857b --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<3, f16>) -> vec<3, f16> +fn log2_38b478() { + var arg_0 = vec3(f16()); + var res: vec3 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_38b478(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_38b478(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_38b478(); +} diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..78a5e05291 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_38b478() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_38b478(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_38b478(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2bdd2898a1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log2_38b478() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_38b478(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_38b478(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021830188770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021830188770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.glsl new file mode 100644 index 0000000000..3b440c8085 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_38b478() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_38b478(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_38b478() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log2(arg_0); +} + +void fragment_main() { + log2_38b478(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_38b478() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = log2(arg_0); +} + +void compute_main() { + log2_38b478(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.msl new file mode 100644 index 0000000000..86941bfb1f --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_38b478() { + half3 arg_0 = half3(0.0h); + half3 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_38b478(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_38b478(); + return; +} + +kernel void compute_main() { + log2_38b478(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.spvasm new file mode 100644 index 0000000000..f44bd997c1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_38b478 "log2_38b478" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_38b478 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Log2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log2_38b478 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_38b478 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log2_38b478 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.wgsl new file mode 100644 index 0000000000..5564f08cb1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/38b478.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log2_38b478() { + var arg_0 = vec3(f16()); + var res : vec3 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_38b478(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_38b478(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_38b478(); +} diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl new file mode 100644 index 0000000000..b611265955 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(f32) -> f32 +fn log2_4036ed() { + var arg_0 = 1.f; + var res: f32 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_4036ed(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_4036ed(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_4036ed(); +} diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bc9a7c4e4e --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_4036ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_4036ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_4036ed(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bc9a7c4e4e --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_4036ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_4036ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_4036ed(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl new file mode 100644 index 0000000000..dbd9a481c2 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +vec4 vertex_main() { + log2_4036ed(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +void fragment_main() { + log2_4036ed(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +void compute_main() { + log2_4036ed(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl new file mode 100644 index 0000000000..d21766d9d5 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_4036ed() { + float arg_0 = 1.0f; + float res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_4036ed(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_4036ed(); + return; +} + +kernel void compute_main() { + log2_4036ed(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm new file mode 100644 index 0000000000..14887a7014 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_4036ed "log2_4036ed" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%log2_4036ed = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Log2 %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %log2_4036ed + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %log2_4036ed + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_4036ed + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec4ffa1b7a --- /dev/null +++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log2_4036ed() { + var arg_0 = 1.0f; + var res : f32 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_4036ed(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_4036ed(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_4036ed(); +} diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl b/test/tint/builtins/gen/var/log2/776088.wgsl new file mode 100644 index 0000000000..cff82b7344 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<4, f16>) -> vec<4, f16> +fn log2_776088() { + var arg_0 = vec4(f16()); + var res: vec4 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_776088(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_776088(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_776088(); +} diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ddbb999d45 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_776088() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_776088(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_776088(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_776088(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64e5e4a2f0 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log2_776088() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_776088(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_776088(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_776088(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FF2A6D2B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FF2A6D2B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.glsl new file mode 100644 index 0000000000..a4c554489e --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_776088() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_776088(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_776088() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log2(arg_0); +} + +void fragment_main() { + log2_776088(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_776088() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = log2(arg_0); +} + +void compute_main() { + log2_776088(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.msl new file mode 100644 index 0000000000..856c87bf55 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_776088() { + half4 arg_0 = half4(0.0h); + half4 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_776088(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_776088(); + return; +} + +kernel void compute_main() { + log2_776088(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.spvasm new file mode 100644 index 0000000000..0ed06cd53e --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_776088 "log2_776088" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_776088 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Log2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log2_776088 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_776088 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log2_776088 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/776088.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.wgsl new file mode 100644 index 0000000000..63b699d474 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/776088.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log2_776088() { + var arg_0 = vec4(f16()); + var res : vec4 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_776088(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_776088(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_776088(); +} diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl new file mode 100644 index 0000000000..7a838bdb98 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(f16) -> f16 +fn log2_8c10b3() { + var arg_0 = f16(); + var res: f16 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_8c10b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_8c10b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_8c10b3(); +} diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..538dbfcdfd --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_8c10b3() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_8c10b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_8c10b3(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5a8f482e0 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log2_8c10b3() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_8c10b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_8c10b3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002320D6B2E20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002320D6B2E20(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.glsl new file mode 100644 index 0000000000..dc3f0f7a38 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_8c10b3() { + float16_t arg_0 = 0.0hf; + float16_t res = log2(arg_0); +} + +vec4 vertex_main() { + log2_8c10b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_8c10b3() { + float16_t arg_0 = 0.0hf; + float16_t res = log2(arg_0); +} + +void fragment_main() { + log2_8c10b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_8c10b3() { + float16_t arg_0 = 0.0hf; + float16_t res = log2(arg_0); +} + +void compute_main() { + log2_8c10b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.msl new file mode 100644 index 0000000000..4f7aa2e066 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_8c10b3() { + half arg_0 = 0.0h; + half res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_8c10b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_8c10b3(); + return; +} + +kernel void compute_main() { + log2_8c10b3(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..f280c63a73 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_8c10b3 "log2_8c10b3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_8c10b3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Log2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log2_8c10b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %log2_8c10b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %log2_8c10b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..8deaff1a00 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/8c10b3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log2_8c10b3() { + var arg_0 = f16(); + var res : f16 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_8c10b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_8c10b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_8c10b3(); +} diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl b/test/tint/builtins/gen/var/log2/902988.wgsl new file mode 100644 index 0000000000..78ec4cd14d --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(vec<4, f32>) -> vec<4, f32> +fn log2_902988() { + var arg_0 = vec4(1.f); + var res: vec4 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_902988(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_902988(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_902988(); +} diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d2a41fd1c1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_902988() { + float4 arg_0 = (1.0f).xxxx; + float4 res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_902988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_902988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_902988(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d2a41fd1c1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void log2_902988() { + float4 arg_0 = (1.0f).xxxx; + float4 res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_902988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_902988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_902988(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl new file mode 100644 index 0000000000..1ab598ee10 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log2_902988() { + vec4 arg_0 = vec4(1.0f); + vec4 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_902988(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_902988() { + vec4 arg_0 = vec4(1.0f); + vec4 res = log2(arg_0); +} + +void fragment_main() { + log2_902988(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_902988() { + vec4 arg_0 = vec4(1.0f); + vec4 res = log2(arg_0); +} + +void compute_main() { + log2_902988(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl new file mode 100644 index 0000000000..b1afdbd264 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_902988() { + float4 arg_0 = float4(1.0f); + float4 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_902988(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_902988(); + return; +} + +kernel void compute_main() { + log2_902988(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ea274a323 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_902988 "log2_902988" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%log2_902988 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Log2 %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %log2_902988 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %log2_902988 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %log2_902988 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl new file mode 100644 index 0000000000..9bfd632d49 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log2_902988() { + var arg_0 = vec4(1.0f); + var res : vec4 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_902988(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_902988(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_902988(); +} diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl b/test/tint/builtins/gen/var/log2/adb233.wgsl new file mode 100644 index 0000000000..9db61864b7 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(vec<3, f32>) -> vec<3, f32> +fn log2_adb233() { + var arg_0 = vec3(1.f); + var res: vec3 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_adb233(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_adb233(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_adb233(); +} diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..edd19e1fdd --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_adb233() { + float3 arg_0 = (1.0f).xxx; + float3 res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_adb233(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_adb233(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_adb233(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..edd19e1fdd --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void log2_adb233() { + float3 arg_0 = (1.0f).xxx; + float3 res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_adb233(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_adb233(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_adb233(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl new file mode 100644 index 0000000000..08551f479d --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log2_adb233() { + vec3 arg_0 = vec3(1.0f); + vec3 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_adb233(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_adb233() { + vec3 arg_0 = vec3(1.0f); + vec3 res = log2(arg_0); +} + +void fragment_main() { + log2_adb233(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_adb233() { + vec3 arg_0 = vec3(1.0f); + vec3 res = log2(arg_0); +} + +void compute_main() { + log2_adb233(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl new file mode 100644 index 0000000000..11436458cf --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_adb233() { + float3 arg_0 = float3(1.0f); + float3 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_adb233(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_adb233(); + return; +} + +kernel void compute_main() { + log2_adb233(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd25695f0e --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_adb233 "log2_adb233" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%log2_adb233 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Log2 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %log2_adb233 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_adb233 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log2_adb233 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl new file mode 100644 index 0000000000..252dd99e04 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log2_adb233() { + var arg_0 = vec3(1.0f); + var res : vec3 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_adb233(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_adb233(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_adb233(); +} diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl b/test/tint/builtins/gen/var/log2/aea659.wgsl new file mode 100644 index 0000000000..32b5b41fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn log2(vec<2, f32>) -> vec<2, f32> +fn log2_aea659() { + var arg_0 = vec2(1.f); + var res: vec2 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_aea659(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_aea659(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_aea659(); +} diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0a7192df1b --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_aea659() { + float2 arg_0 = (1.0f).xx; + float2 res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_aea659(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_aea659(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_aea659(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0a7192df1b --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void log2_aea659() { + float2 arg_0 = (1.0f).xx; + float2 res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_aea659(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_aea659(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_aea659(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl new file mode 100644 index 0000000000..c2b459e9ea --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void log2_aea659() { + vec2 arg_0 = vec2(1.0f); + vec2 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_aea659(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void log2_aea659() { + vec2 arg_0 = vec2(1.0f); + vec2 res = log2(arg_0); +} + +void fragment_main() { + log2_aea659(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void log2_aea659() { + vec2 arg_0 = vec2(1.0f); + vec2 res = log2(arg_0); +} + +void compute_main() { + log2_aea659(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl new file mode 100644 index 0000000000..f7095c8084 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_aea659() { + float2 arg_0 = float2(1.0f); + float2 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_aea659(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_aea659(); + return; +} + +kernel void compute_main() { + log2_aea659(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b5391637d --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_aea659 "log2_aea659" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%log2_aea659 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Log2 %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %log2_aea659 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_aea659 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log2_aea659 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl new file mode 100644 index 0000000000..86accf151d --- /dev/null +++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn log2_aea659() { + var arg_0 = vec2(1.0f); + var res : vec2 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_aea659(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_aea659(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_aea659(); +} diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl new file mode 100644 index 0000000000..48d01f651f --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn log2(vec<2, f16>) -> vec<2, f16> +fn log2_fb9f0b() { + var arg_0 = vec2(f16()); + var res: vec2 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_fb9f0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_fb9f0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_fb9f0b(); +} diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f99f7bfaaf --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void log2_fb9f0b() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_fb9f0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_fb9f0b(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6e2e2b382 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void log2_fb9f0b() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = log2(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + log2_fb9f0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + log2_fb9f0b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000196C422E8F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000196C422E8F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.glsl new file mode 100644 index 0000000000..0676b9f646 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_fb9f0b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log2(arg_0); +} + +vec4 vertex_main() { + log2_fb9f0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void log2_fb9f0b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log2(arg_0); +} + +void fragment_main() { + log2_fb9f0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void log2_fb9f0b() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = log2(arg_0); +} + +void compute_main() { + log2_fb9f0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.msl new file mode 100644 index 0000000000..dc1c78f701 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void log2_fb9f0b() { + half2 arg_0 = half2(0.0h); + half2 res = log2(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + log2_fb9f0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + log2_fb9f0b(); + return; +} + +kernel void compute_main() { + log2_fb9f0b(); + return; +} + diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..35cba68846 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %log2_fb9f0b "log2_fb9f0b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%log2_fb9f0b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Log2 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %log2_fb9f0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %log2_fb9f0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %log2_fb9f0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe9342f278 --- /dev/null +++ b/test/tint/builtins/gen/var/log2/fb9f0b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn log2_fb9f0b() { + var arg_0 = vec2(f16()); + var res : vec2 = log2(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + log2_fb9f0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + log2_fb9f0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + log2_fb9f0b(); +} diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl new file mode 100644 index 0000000000..d40ba00fef --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(u32, u32) -> u32 +fn max_0c0aae() { + var arg_0 = 1u; + var arg_1 = 1u; + var res: u32 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_0c0aae(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_0c0aae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_0c0aae(); +} diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e7e8dce313 --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_0c0aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_0c0aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_0c0aae(); + return; +} diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e7e8dce313 --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_0c0aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_0c0aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_0c0aae(); + return; +} diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl new file mode 100644 index 0000000000..de68a146a5 --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_0c0aae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +void fragment_main() { + max_0c0aae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +void compute_main() { + max_0c0aae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl new file mode 100644 index 0000000000..6a31914d61 --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_0c0aae() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_0c0aae(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_0c0aae(); + return; +} + +kernel void compute_main() { + max_0c0aae(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f9f3b91d1 --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_0c0aae "max_0c0aae" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_0c0aae = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + %21 = OpLoad %uint %arg_0 + %22 = OpLoad %uint %arg_1 + %19 = OpExtInst %uint %20 UMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_0c0aae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_0c0aae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_0c0aae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl new file mode 100644 index 0000000000..2f1e9c2fbd --- /dev/null +++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_0c0aae() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : u32 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_0c0aae(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_0c0aae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_0c0aae(); +} diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl b/test/tint/builtins/gen/var/max/111ac0.wgsl new file mode 100644 index 0000000000..95fe46e5b4 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(f16, f16) -> f16 +fn max_111ac0() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_111ac0(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_111ac0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_111ac0(); +} diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..96099f3b67 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_111ac0() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_111ac0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_111ac0(); + return; +} diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15b4bffc5d --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void max_111ac0() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_111ac0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_111ac0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261ECC86E70(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261ECC86E70(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl new file mode 100644 index 0000000000..e765053e29 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_111ac0() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_111ac0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_111ac0() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = max(arg_0, arg_1); +} + +void fragment_main() { + max_111ac0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_111ac0() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = max(arg_0, arg_1); +} + +void compute_main() { + max_111ac0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl new file mode 100644 index 0000000000..429db67325 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_111ac0() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_111ac0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_111ac0(); + return; +} + +kernel void compute_main() { + max_111ac0(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm new file mode 100644 index 0000000000..379f8c7c33 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_111ac0 "max_111ac0" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_111ac0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 NMax %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %max_111ac0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %max_111ac0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_111ac0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl new file mode 100644 index 0000000000..b91b325904 --- /dev/null +++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn max_111ac0() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_111ac0(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_111ac0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_111ac0(); +} diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl b/test/tint/builtins/gen/var/max/25eafe.wgsl new file mode 100644 index 0000000000..eb27d08b8e --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<3, i32>, vec<3, i32>) -> vec<3, i32> +fn max_25eafe() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var res: vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_25eafe(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_25eafe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_25eafe(); +} diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1e23c54bcb --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_25eafe() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + int3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_25eafe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_25eafe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_25eafe(); + return; +} diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1e23c54bcb --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_25eafe() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + int3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_25eafe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_25eafe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_25eafe(); + return; +} diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl new file mode 100644 index 0000000000..1f8e21d7be --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_25eafe() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + ivec3 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_25eafe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_25eafe() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + ivec3 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_25eafe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_25eafe() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + ivec3 res = max(arg_0, arg_1); +} + +void compute_main() { + max_25eafe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl new file mode 100644 index 0000000000..1b4a2f248e --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_25eafe() { + int3 arg_0 = int3(1); + int3 arg_1 = int3(1); + int3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_25eafe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_25eafe(); + return; +} + +kernel void compute_main() { + max_25eafe(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm new file mode 100644 index 0000000000..7d84e7cb1b --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_25eafe "max_25eafe" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_25eafe = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %19 + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v3int %arg_0 + %24 = OpLoad %v3int %arg_1 + %21 = OpExtInst %v3int %22 SMax %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %max_25eafe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_25eafe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %max_25eafe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c6eb03b3a --- /dev/null +++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_25eafe() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var res : vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_25eafe(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_25eafe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_25eafe(); +} diff --git a/test/tint/builtins/gen/var/max/320815.wgsl b/test/tint/builtins/gen/var/max/320815.wgsl new file mode 100644 index 0000000000..4a973eeb1d --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<2, u32>, vec<2, u32>) -> vec<2, u32> +fn max_320815() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var res: vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_320815(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_320815(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_320815(); +} diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db6bae6124 --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_320815() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_320815(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_320815(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_320815(); + return; +} diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..db6bae6124 --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_320815() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_320815(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_320815(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_320815(); + return; +} diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl new file mode 100644 index 0000000000..7eb797c46c --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_320815() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uvec2 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_320815(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_320815() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uvec2 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_320815(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_320815() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uvec2 res = max(arg_0, arg_1); +} + +void compute_main() { + max_320815(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.msl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.msl new file mode 100644 index 0000000000..afba782190 --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_320815() { + uint2 arg_0 = uint2(1u); + uint2 arg_1 = uint2(1u); + uint2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_320815(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_320815(); + return; +} + +kernel void compute_main() { + max_320815(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm new file mode 100644 index 0000000000..fcac466e68 --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_320815 "max_320815" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_320815 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %19 + %res = OpVariable %_ptr_Function_v2uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v2uint %arg_0 + %24 = OpLoad %v2uint %arg_1 + %21 = OpExtInst %v2uint %22 UMax %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %max_320815 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_320815 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %max_320815 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl new file mode 100644 index 0000000000..cb862a6402 --- /dev/null +++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_320815() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var res : vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_320815(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_320815(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_320815(); +} diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl b/test/tint/builtins/gen/var/max/34956e.wgsl new file mode 100644 index 0000000000..600a3eb34a --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn max_34956e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_34956e(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_34956e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_34956e(); +} diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..60c2e2f19f --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_34956e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_34956e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_34956e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_34956e(); + return; +} diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6402eb7fff --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void max_34956e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_34956e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_34956e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_34956e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024F90CA9900(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024F90CA9900(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024F90CA9900(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl new file mode 100644 index 0000000000..93be2e6c61 --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_34956e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_34956e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_34956e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_34956e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_34956e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = max(arg_0, arg_1); +} + +void compute_main() { + max_34956e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl new file mode 100644 index 0000000000..c90bfebda7 --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_34956e() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_34956e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_34956e(); + return; +} + +kernel void compute_main() { + max_34956e(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm new file mode 100644 index 0000000000..f63b8cd689 --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_34956e "max_34956e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_34956e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 NMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_34956e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_34956e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_34956e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl new file mode 100644 index 0000000000..69327a8f55 --- /dev/null +++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn max_34956e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_34956e(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_34956e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_34956e(); +} diff --git a/test/tint/builtins/gen/var/max/445169.wgsl b/test/tint/builtins/gen/var/max/445169.wgsl new file mode 100644 index 0000000000..24aad6114a --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn max_445169() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_445169(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_445169(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_445169(); +} diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b65af3400 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_445169() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_445169(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_445169(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_445169(); + return; +} diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3f48199b30 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void max_445169() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_445169(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_445169(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_445169(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DB65BB6D70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DB65BB6D70(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DB65BB6D70(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl new file mode 100644 index 0000000000..a524e0f279 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_445169() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_445169(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_445169() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_445169(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_445169() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = max(arg_0, arg_1); +} + +void compute_main() { + max_445169(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl new file mode 100644 index 0000000000..3f2fe1ea2a --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_445169() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_445169(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_445169(); + return; +} + +kernel void compute_main() { + max_445169(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm new file mode 100644 index 0000000000..5a3366ef32 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_445169 "max_445169" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_445169 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 NMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_445169 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_445169 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_445169 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl new file mode 100644 index 0000000000..e21636f485 --- /dev/null +++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn max_445169() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_445169(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_445169(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_445169(); +} diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl b/test/tint/builtins/gen/var/max/44a39d.wgsl new file mode 100644 index 0000000000..6b09e76e99 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(f32, f32) -> f32 +fn max_44a39d() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var res: f32 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_44a39d(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_44a39d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_44a39d(); +} diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4435435f63 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_44a39d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_44a39d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_44a39d(); + return; +} diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4435435f63 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_44a39d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_44a39d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_44a39d(); + return; +} diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl new file mode 100644 index 0000000000..aff772a7b9 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_44a39d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = max(arg_0, arg_1); +} + +void fragment_main() { + max_44a39d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = max(arg_0, arg_1); +} + +void compute_main() { + max_44a39d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl new file mode 100644 index 0000000000..da0146ba77 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_44a39d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_44a39d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_44a39d(); + return; +} + +kernel void compute_main() { + max_44a39d(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d075c28b87 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_44a39d "max_44a39d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %max_44a39d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 NMax %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %max_44a39d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %max_44a39d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_44a39d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0ff168885 --- /dev/null +++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_44a39d() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var res : f32 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_44a39d(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_44a39d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_44a39d(); +} diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl b/test/tint/builtins/gen/var/max/453e04.wgsl new file mode 100644 index 0000000000..f25c9e3d2a --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<4, u32>, vec<4, u32>) -> vec<4, u32> +fn max_453e04() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var res: vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_453e04(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_453e04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_453e04(); +} diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..70b7cb462e --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_453e04() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_453e04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_453e04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_453e04(); + return; +} diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..70b7cb462e --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_453e04() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_453e04(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_453e04(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_453e04(); + return; +} diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl new file mode 100644 index 0000000000..8345f5c1cf --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_453e04() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uvec4 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_453e04(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_453e04() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uvec4 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_453e04(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_453e04() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uvec4 res = max(arg_0, arg_1); +} + +void compute_main() { + max_453e04(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl new file mode 100644 index 0000000000..bd9f1ce89e --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_453e04() { + uint4 arg_0 = uint4(1u); + uint4 arg_1 = uint4(1u); + uint4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_453e04(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_453e04(); + return; +} + +kernel void compute_main() { + max_453e04(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a27d3012a --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_453e04 "max_453e04" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_453e04 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %19 + %res = OpVariable %_ptr_Function_v4uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v4uint %arg_0 + %24 = OpLoad %v4uint %arg_1 + %21 = OpExtInst %v4uint %22 UMax %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %max_453e04 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_453e04 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %max_453e04 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce4a47cc69 --- /dev/null +++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_453e04() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var res : vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_453e04(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_453e04(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_453e04(); +} diff --git a/test/tint/builtins/gen/var/max/462050.wgsl b/test/tint/builtins/gen/var/max/462050.wgsl new file mode 100644 index 0000000000..9345d44041 --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn max_462050() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var res: vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_462050(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_462050(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_462050(); +} diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..74aa9e81af --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_462050() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_462050(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_462050(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_462050(); + return; +} diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..74aa9e81af --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_462050() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_462050(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_462050(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_462050(); + return; +} diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl new file mode 100644 index 0000000000..627f0c95dc --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_462050() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_462050(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_462050() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_462050(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_462050() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = max(arg_0, arg_1); +} + +void compute_main() { + max_462050(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.msl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.msl new file mode 100644 index 0000000000..77fd1ac508 --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_462050() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_462050(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_462050(); + return; +} + +kernel void compute_main() { + max_462050(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm new file mode 100644 index 0000000000..7a9ff564d6 --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_462050 "max_462050" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float + %max_462050 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v2float %arg_0 + %23 = OpLoad %v2float %arg_1 + %20 = OpExtInst %v2float %21 NMax %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %max_462050 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_462050 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_462050 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl new file mode 100644 index 0000000000..28b3e0d20c --- /dev/null +++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_462050() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var res : vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_462050(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_462050(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_462050(); +} diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl b/test/tint/builtins/gen/var/max/4883ac.wgsl new file mode 100644 index 0000000000..b83adc0890 --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn max_4883ac() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var res: vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_4883ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_4883ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_4883ac(); +} diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee0df6b18a --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_4883ac() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_4883ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_4883ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_4883ac(); + return; +} diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ee0df6b18a --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_4883ac() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_4883ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_4883ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_4883ac(); + return; +} diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl new file mode 100644 index 0000000000..0821605151 --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_4883ac() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_4883ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_4883ac() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_4883ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_4883ac() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = max(arg_0, arg_1); +} + +void compute_main() { + max_4883ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl new file mode 100644 index 0000000000..28df7d6ad5 --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_4883ac() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_4883ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_4883ac(); + return; +} + +kernel void compute_main() { + max_4883ac(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..3c32bd9a31 --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_4883ac "max_4883ac" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %25 = OpTypeFunction %v4float + %max_4883ac = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v3float %arg_0 + %23 = OpLoad %v3float %arg_1 + %20 = OpExtInst %v3float %21 NMax %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %max_4883ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_4883ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_4883ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..4da24d3f62 --- /dev/null +++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_4883ac() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var res : vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_4883ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_4883ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_4883ac(); +} diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl new file mode 100644 index 0000000000..f4e4e7a391 --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<4, i32>, vec<4, i32>) -> vec<4, i32> +fn max_85e6bc() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var res: vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_85e6bc(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_85e6bc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_85e6bc(); +} diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..51e9ac41ba --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_85e6bc() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + int4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_85e6bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_85e6bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_85e6bc(); + return; +} diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..51e9ac41ba --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_85e6bc() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + int4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_85e6bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_85e6bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_85e6bc(); + return; +} diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl new file mode 100644 index 0000000000..cf4d0afd4b --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_85e6bc() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + ivec4 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_85e6bc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_85e6bc() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + ivec4 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_85e6bc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_85e6bc() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + ivec4 res = max(arg_0, arg_1); +} + +void compute_main() { + max_85e6bc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl new file mode 100644 index 0000000000..77d28f2a4f --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_85e6bc() { + int4 arg_0 = int4(1); + int4 arg_1 = int4(1); + int4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_85e6bc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_85e6bc(); + return; +} + +kernel void compute_main() { + max_85e6bc(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm new file mode 100644 index 0000000000..09be5c69e3 --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_85e6bc "max_85e6bc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_85e6bc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %19 + %arg_1 = OpVariable %_ptr_Function_v4int Function %19 + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v4int %arg_0 + %24 = OpLoad %v4int %arg_1 + %21 = OpExtInst %v4int %22 SMax %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %max_85e6bc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_85e6bc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %max_85e6bc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl new file mode 100644 index 0000000000..64f813bb6c --- /dev/null +++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_85e6bc() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var res : vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_85e6bc(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_85e6bc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_85e6bc(); +} diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl b/test/tint/builtins/gen/var/max/a93419.wgsl new file mode 100644 index 0000000000..2f72d7a319 --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn max_a93419() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var res: vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_a93419(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_a93419(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_a93419(); +} diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..69e83f617e --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_a93419() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_a93419(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_a93419(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_a93419(); + return; +} diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..69e83f617e --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_a93419() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_a93419(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_a93419(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_a93419(); + return; +} diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl new file mode 100644 index 0000000000..3f2450c619 --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_a93419() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_a93419(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_a93419() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_a93419(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_a93419() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = max(arg_0, arg_1); +} + +void compute_main() { + max_a93419(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl new file mode 100644 index 0000000000..6a04eaf181 --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_a93419() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_a93419(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_a93419(); + return; +} + +kernel void compute_main() { + max_a93419(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm new file mode 100644 index 0000000000..f70b7bdf18 --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_a93419 "max_a93419" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %max_a93419 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v4float %arg_0 + %21 = OpLoad %v4float %arg_1 + %18 = OpExtInst %v4float %19 NMax %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %max_a93419 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %max_a93419 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %max_a93419 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ae8a6df98 --- /dev/null +++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_a93419() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var res : vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_a93419(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_a93419(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_a93419(); +} diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl new file mode 100644 index 0000000000..e806a90d27 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<3, u32>, vec<3, u32>) -> vec<3, u32> +fn max_b1b73a() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var res: vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_b1b73a(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_b1b73a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_b1b73a(); +} diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1469748076 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_b1b73a() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_b1b73a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_b1b73a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_b1b73a(); + return; +} diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1469748076 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_b1b73a() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_b1b73a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_b1b73a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_b1b73a(); + return; +} diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl new file mode 100644 index 0000000000..2e42313311 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_b1b73a() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uvec3 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_b1b73a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_b1b73a() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uvec3 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_b1b73a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_b1b73a() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uvec3 res = max(arg_0, arg_1); +} + +void compute_main() { + max_b1b73a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl new file mode 100644 index 0000000000..d26d86edbe --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_b1b73a() { + uint3 arg_0 = uint3(1u); + uint3 arg_1 = uint3(1u); + uint3 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_b1b73a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_b1b73a(); + return; +} + +kernel void compute_main() { + max_b1b73a(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm new file mode 100644 index 0000000000..9c16755bf3 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_b1b73a "max_b1b73a" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_b1b73a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %19 + %res = OpVariable %_ptr_Function_v3uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v3uint %arg_0 + %24 = OpLoad %v3uint %arg_1 + %21 = OpExtInst %v3uint %22 UMax %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %max_b1b73a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_b1b73a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %max_b1b73a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl new file mode 100644 index 0000000000..8585dbeb10 --- /dev/null +++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_b1b73a() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var res : vec3 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_b1b73a(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_b1b73a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_b1b73a(); +} diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl new file mode 100644 index 0000000000..d478d0b442 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(i32, i32) -> i32 +fn max_ce7c30() { + var arg_0 = 1; + var arg_1 = 1; + var res: i32 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_ce7c30(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_ce7c30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_ce7c30(); +} diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..532d8ac2b6 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_ce7c30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_ce7c30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_ce7c30(); + return; +} diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..532d8ac2b6 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_ce7c30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_ce7c30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_ce7c30(); + return; +} diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl new file mode 100644 index 0000000000..fde5bcffb4 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_ce7c30(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +void fragment_main() { + max_ce7c30(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +void compute_main() { + max_ce7c30(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl new file mode 100644 index 0000000000..1f01f8a0d7 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_ce7c30() { + int arg_0 = 1; + int arg_1 = 1; + int res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_ce7c30(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_ce7c30(); + return; +} + +kernel void compute_main() { + max_ce7c30(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm new file mode 100644 index 0000000000..faeb02c767 --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_ce7c30 "max_ce7c30" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_ce7c30 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + %21 = OpLoad %int %arg_0 + %22 = OpLoad %int %arg_1 + %19 = OpExtInst %int %20 SMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_ce7c30 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_ce7c30 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_ce7c30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl new file mode 100644 index 0000000000..830432685c --- /dev/null +++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_ce7c30() { + var arg_0 = 1; + var arg_1 = 1; + var res : i32 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_ce7c30(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_ce7c30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_ce7c30(); +} diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl new file mode 100644 index 0000000000..12fd3d9a48 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn max(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn max_e14f2b() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e14f2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e14f2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e14f2b(); +} diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0f6659fd2 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_e14f2b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e14f2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e14f2b(); + return; +} diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1251ca9005 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void max_e14f2b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e14f2b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e14f2b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026D512195F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026D512195F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026D512195F0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl new file mode 100644 index 0000000000..9c13143714 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_e14f2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_e14f2b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void max_e14f2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_e14f2b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void max_e14f2b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = max(arg_0, arg_1); +} + +void compute_main() { + max_e14f2b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl new file mode 100644 index 0000000000..4410e6fff5 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_e14f2b() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = fmax(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_e14f2b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_e14f2b(); + return; +} + +kernel void compute_main() { + max_e14f2b(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm new file mode 100644 index 0000000000..99fc971989 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_e14f2b "max_e14f2b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_e14f2b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 NMax %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %max_e14f2b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %max_e14f2b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %max_e14f2b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl new file mode 100644 index 0000000000..446f509ff3 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn max_e14f2b() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e14f2b(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e14f2b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e14f2b(); +} diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl b/test/tint/builtins/gen/var/max/e8192f.wgsl new file mode 100644 index 0000000000..6bc1049fa0 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn max(vec<2, i32>, vec<2, i32>) -> vec<2, i32> +fn max_e8192f() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var res: vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e8192f(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e8192f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e8192f(); +} diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e773f17870 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void max_e8192f() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + int2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e8192f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e8192f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e8192f(); + return; +} diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e773f17870 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void max_e8192f() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + int2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + max_e8192f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + max_e8192f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + max_e8192f(); + return; +} diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl new file mode 100644 index 0000000000..a25ec00f75 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void max_e8192f() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + ivec2 res = max(arg_0, arg_1); +} + +vec4 vertex_main() { + max_e8192f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void max_e8192f() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + ivec2 res = max(arg_0, arg_1); +} + +void fragment_main() { + max_e8192f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void max_e8192f() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + ivec2 res = max(arg_0, arg_1); +} + +void compute_main() { + max_e8192f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl new file mode 100644 index 0000000000..91e431b7a6 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void max_e8192f() { + int2 arg_0 = int2(1); + int2 arg_1 = int2(1); + int2 res = max(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + max_e8192f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + max_e8192f(); + return; +} + +kernel void compute_main() { + max_e8192f(); + return; +} + diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm new file mode 100644 index 0000000000..de054b1bd3 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %max_e8192f "max_e8192f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %max_e8192f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %19 + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v2int %arg_0 + %24 = OpLoad %v2int %arg_1 + %21 = OpExtInst %v2int %22 SMax %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %max_e8192f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %max_e8192f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %max_e8192f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl new file mode 100644 index 0000000000..e102472da8 --- /dev/null +++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn max_e8192f() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var res : vec2 = max(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + max_e8192f(); + return vec4(); +} + +@fragment +fn fragment_main() { + max_e8192f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + max_e8192f(); +} diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl new file mode 100644 index 0000000000..7a4a432368 --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<2, i32>, vec<2, i32>) -> vec<2, i32> +fn min_03c7e3() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var res: vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_03c7e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_03c7e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_03c7e3(); +} diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3e1a788bba --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_03c7e3() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + int2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_03c7e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_03c7e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_03c7e3(); + return; +} diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3e1a788bba --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_03c7e3() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + int2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_03c7e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_03c7e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_03c7e3(); + return; +} diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl new file mode 100644 index 0000000000..89c44192da --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_03c7e3() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + ivec2 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_03c7e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_03c7e3() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + ivec2 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_03c7e3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_03c7e3() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + ivec2 res = min(arg_0, arg_1); +} + +void compute_main() { + min_03c7e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl new file mode 100644 index 0000000000..f5fd9d78d2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_03c7e3() { + int2 arg_0 = int2(1); + int2 arg_1 = int2(1); + int2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_03c7e3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_03c7e3(); + return; +} + +kernel void compute_main() { + min_03c7e3(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..c78e2bab43 --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_03c7e3 "min_03c7e3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_03c7e3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %19 + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v2int %arg_0 + %24 = OpLoad %v2int %arg_1 + %21 = OpExtInst %v2int %22 SMin %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %min_03c7e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_03c7e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %min_03c7e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..17f1a72d9b --- /dev/null +++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_03c7e3() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var res : vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_03c7e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_03c7e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_03c7e3(); +} diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl b/test/tint/builtins/gen/var/min/0dc614.wgsl new file mode 100644 index 0000000000..2b190ebf79 --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<4, u32>, vec<4, u32>) -> vec<4, u32> +fn min_0dc614() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var res: vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_0dc614(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_0dc614(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_0dc614(); +} diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c2b0bc40e --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_0dc614() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_0dc614(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_0dc614(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_0dc614(); + return; +} diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4c2b0bc40e --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_0dc614() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + uint4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_0dc614(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_0dc614(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_0dc614(); + return; +} diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl new file mode 100644 index 0000000000..d866fed95b --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_0dc614() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uvec4 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_0dc614(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_0dc614() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uvec4 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_0dc614(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_0dc614() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + uvec4 res = min(arg_0, arg_1); +} + +void compute_main() { + min_0dc614(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl new file mode 100644 index 0000000000..9bd62b159c --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_0dc614() { + uint4 arg_0 = uint4(1u); + uint4 arg_1 = uint4(1u); + uint4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_0dc614(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_0dc614(); + return; +} + +kernel void compute_main() { + min_0dc614(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm new file mode 100644 index 0000000000..1d33b5d199 --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_0dc614 "min_0dc614" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_0dc614 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %19 + %res = OpVariable %_ptr_Function_v4uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v4uint %arg_0 + %24 = OpLoad %v4uint %arg_1 + %21 = OpExtInst %v4uint %22 UMin %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %min_0dc614 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_0dc614 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %min_0dc614 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl new file mode 100644 index 0000000000..77091778df --- /dev/null +++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_0dc614() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var res : vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_0dc614(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_0dc614(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_0dc614(); +} diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl b/test/tint/builtins/gen/var/min/3941e1.wgsl new file mode 100644 index 0000000000..2b9849596d --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<4, i32>, vec<4, i32>) -> vec<4, i32> +fn min_3941e1() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var res: vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_3941e1(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_3941e1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_3941e1(); +} diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3b6cb18e00 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_3941e1() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + int4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_3941e1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_3941e1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_3941e1(); + return; +} diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3b6cb18e00 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_3941e1() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + int4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_3941e1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_3941e1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_3941e1(); + return; +} diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl new file mode 100644 index 0000000000..0e2fa7b393 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_3941e1() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + ivec4 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_3941e1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_3941e1() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + ivec4 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_3941e1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_3941e1() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + ivec4 res = min(arg_0, arg_1); +} + +void compute_main() { + min_3941e1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl new file mode 100644 index 0000000000..3bf044dc79 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_3941e1() { + int4 arg_0 = int4(1); + int4 arg_1 = int4(1); + int4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_3941e1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_3941e1(); + return; +} + +kernel void compute_main() { + min_3941e1(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm new file mode 100644 index 0000000000..3cea99c411 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_3941e1 "min_3941e1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_3941e1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %19 + %arg_1 = OpVariable %_ptr_Function_v4int Function %19 + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v4int %arg_0 + %24 = OpLoad %v4int %arg_1 + %21 = OpExtInst %v4int %22 SMin %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %min_3941e1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_3941e1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %min_3941e1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2683dbe67 --- /dev/null +++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_3941e1() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var res : vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_3941e1(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_3941e1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_3941e1(); +} diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl new file mode 100644 index 0000000000..820ce72ae0 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(u32, u32) -> u32 +fn min_46c5d3() { + var arg_0 = 1u; + var arg_1 = 1u; + var res: u32 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_46c5d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_46c5d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_46c5d3(); +} diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..68dfb8ecc4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_46c5d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_46c5d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_46c5d3(); + return; +} diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68dfb8ecc4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_46c5d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_46c5d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_46c5d3(); + return; +} diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl new file mode 100644 index 0000000000..d2cce51fc7 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_46c5d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +void fragment_main() { + min_46c5d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +void compute_main() { + min_46c5d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl new file mode 100644 index 0000000000..a66228b9b4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_46c5d3() { + uint arg_0 = 1u; + uint arg_1 = 1u; + uint res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_46c5d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_46c5d3(); + return; +} + +kernel void compute_main() { + min_46c5d3(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm new file mode 100644 index 0000000000..f68a728287 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_46c5d3 "min_46c5d3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_46c5d3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + %21 = OpLoad %uint %arg_0 + %22 = OpLoad %uint %arg_1 + %19 = OpExtInst %uint %20 UMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_46c5d3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_46c5d3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_46c5d3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c3630f378 --- /dev/null +++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_46c5d3() { + var arg_0 = 1u; + var arg_1 = 1u; + var res : u32 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_46c5d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_46c5d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_46c5d3(); +} diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl b/test/tint/builtins/gen/var/min/7c710a.wgsl new file mode 100644 index 0000000000..1ccd54e62c --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn min_7c710a() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_7c710a(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_7c710a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_7c710a(); +} diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c47899a2ae --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_7c710a() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_7c710a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_7c710a(); + return; +} diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1e7afd77ca --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void min_7c710a() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_7c710a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_7c710a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019DCD0014A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019DCD0014A0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019DCD0014A0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.glsl new file mode 100644 index 0000000000..e7acfb3b56 --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_7c710a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_7c710a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_7c710a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_7c710a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_7c710a() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = min(arg_0, arg_1); +} + +void compute_main() { + min_7c710a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.msl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.msl new file mode 100644 index 0000000000..c3ccbdc0af --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_7c710a() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_7c710a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_7c710a(); + return; +} + +kernel void compute_main() { + min_7c710a(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.spvasm new file mode 100644 index 0000000000..d8aff45213 --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_7c710a "min_7c710a" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_7c710a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 NMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_7c710a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_7c710a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_7c710a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.wgsl new file mode 100644 index 0000000000..24aba2c2e4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/7c710a.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn min_7c710a() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_7c710a(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_7c710a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_7c710a(); +} diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl b/test/tint/builtins/gen/var/min/82b28f.wgsl new file mode 100644 index 0000000000..57ea7978e8 --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<2, u32>, vec<2, u32>) -> vec<2, u32> +fn min_82b28f() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var res: vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_82b28f(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_82b28f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_82b28f(); +} diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8d028e3ea5 --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_82b28f() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_82b28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_82b28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_82b28f(); + return; +} diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8d028e3ea5 --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_82b28f() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + uint2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_82b28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_82b28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_82b28f(); + return; +} diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl new file mode 100644 index 0000000000..49661cf6c2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_82b28f() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uvec2 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_82b28f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_82b28f() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uvec2 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_82b28f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_82b28f() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + uvec2 res = min(arg_0, arg_1); +} + +void compute_main() { + min_82b28f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl new file mode 100644 index 0000000000..840a24efab --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_82b28f() { + uint2 arg_0 = uint2(1u); + uint2 arg_1 = uint2(1u); + uint2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_82b28f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_82b28f(); + return; +} + +kernel void compute_main() { + min_82b28f(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm new file mode 100644 index 0000000000..1515f3a56e --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_82b28f "min_82b28f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_82b28f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %19 + %res = OpVariable %_ptr_Function_v2uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v2uint %arg_0 + %24 = OpLoad %v2uint %arg_1 + %21 = OpExtInst %v2uint %22 UMin %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %min_82b28f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_82b28f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %min_82b28f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl new file mode 100644 index 0000000000..f97e16bebd --- /dev/null +++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_82b28f() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var res : vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_82b28f(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_82b28f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_82b28f(); +} diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl new file mode 100644 index 0000000000..9d485a696a --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn min_93cfc4() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var res: vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_93cfc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_93cfc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_93cfc4(); +} diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a4c9d49291 --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_93cfc4() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_93cfc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_93cfc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_93cfc4(); + return; +} diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a4c9d49291 --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_93cfc4() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_93cfc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_93cfc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_93cfc4(); + return; +} diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl new file mode 100644 index 0000000000..93215e8aab --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_93cfc4() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_93cfc4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_93cfc4() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_93cfc4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_93cfc4() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = min(arg_0, arg_1); +} + +void compute_main() { + min_93cfc4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl new file mode 100644 index 0000000000..2504c4b5e1 --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_93cfc4() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_93cfc4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_93cfc4(); + return; +} + +kernel void compute_main() { + min_93cfc4(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..da67bad90b --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_93cfc4 "min_93cfc4" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %25 = OpTypeFunction %v4float + %min_93cfc4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v3float %arg_0 + %23 = OpLoad %v3float %arg_1 + %20 = OpExtInst %v3float %21 NMin %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %min_93cfc4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_93cfc4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_93cfc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..b71c5382d6 --- /dev/null +++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_93cfc4() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var res : vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_93cfc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_93cfc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_93cfc4(); +} diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl b/test/tint/builtins/gen/var/min/a45171.wgsl new file mode 100644 index 0000000000..993e850341 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<3, i32>, vec<3, i32>) -> vec<3, i32> +fn min_a45171() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var res: vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_a45171(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_a45171(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_a45171(); +} diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ceca0114c9 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_a45171() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + int3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_a45171(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_a45171(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_a45171(); + return; +} diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ceca0114c9 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_a45171() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + int3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_a45171(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_a45171(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_a45171(); + return; +} diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl new file mode 100644 index 0000000000..341b229a32 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_a45171() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + ivec3 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_a45171(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_a45171() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + ivec3 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_a45171(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_a45171() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + ivec3 res = min(arg_0, arg_1); +} + +void compute_main() { + min_a45171(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl new file mode 100644 index 0000000000..4a44fabf0e --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_a45171() { + int3 arg_0 = int3(1); + int3 arg_1 = int3(1); + int3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_a45171(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_a45171(); + return; +} + +kernel void compute_main() { + min_a45171(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm new file mode 100644 index 0000000000..c21caef497 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_a45171 "min_a45171" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_a45171 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %19 + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v3int %arg_0 + %24 = OpLoad %v3int %arg_1 + %21 = OpExtInst %v3int %22 SMin %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %min_a45171 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_a45171 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %min_a45171 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5ea2e4e70 --- /dev/null +++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_a45171() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var res : vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_a45171(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_a45171(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_a45171(); +} diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl new file mode 100644 index 0000000000..caabe4fcf8 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn min_aa28ad() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var res: vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_aa28ad(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_aa28ad(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_aa28ad(); +} diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..44fe479090 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_aa28ad() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_aa28ad(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_aa28ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_aa28ad(); + return; +} diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44fe479090 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_aa28ad() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_aa28ad(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_aa28ad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_aa28ad(); + return; +} diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl new file mode 100644 index 0000000000..03446d0de0 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_aa28ad() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_aa28ad(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_aa28ad() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_aa28ad(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_aa28ad() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = min(arg_0, arg_1); +} + +void compute_main() { + min_aa28ad(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl new file mode 100644 index 0000000000..aed687ecc1 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_aa28ad() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_aa28ad(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_aa28ad(); + return; +} + +kernel void compute_main() { + min_aa28ad(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fc4843770 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_aa28ad "min_aa28ad" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float + %min_aa28ad = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v2float %arg_0 + %23 = OpLoad %v2float %arg_1 + %20 = OpExtInst %v2float %21 NMin %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %min_aa28ad + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_aa28ad + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_aa28ad + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl new file mode 100644 index 0000000000..92baedc239 --- /dev/null +++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_aa28ad() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var res : vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_aa28ad(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_aa28ad(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_aa28ad(); +} diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl new file mode 100644 index 0000000000..ea0e29c650 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn min_ab0acd() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ab0acd(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ab0acd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ab0acd(); +} diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..10c5fadb0c --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_ab0acd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ab0acd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ab0acd(); + return; +} diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5da4fb593f --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void min_ab0acd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ab0acd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ab0acd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019AECEC2DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019AECEC2DB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000019AECEC2DB0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.glsl new file mode 100644 index 0000000000..a8dfcfc241 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ab0acd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_ab0acd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_ab0acd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_ab0acd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ab0acd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = min(arg_0, arg_1); +} + +void compute_main() { + min_ab0acd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.msl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.msl new file mode 100644 index 0000000000..ecf13e6f4b --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_ab0acd() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_ab0acd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_ab0acd(); + return; +} + +kernel void compute_main() { + min_ab0acd(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.spvasm new file mode 100644 index 0000000000..c3695bc6c4 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_ab0acd "min_ab0acd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_ab0acd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 NMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_ab0acd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_ab0acd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_ab0acd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c941443dc --- /dev/null +++ b/test/tint/builtins/gen/var/min/ab0acd.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn min_ab0acd() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ab0acd(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ab0acd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ab0acd(); +} diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl new file mode 100644 index 0000000000..8166c17b83 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(f16, f16) -> f16 +fn min_ac84d6() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ac84d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ac84d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ac84d6(); +} diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..62864ef558 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_ac84d6() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ac84d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ac84d6(); + return; +} diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77aa23fffe --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void min_ac84d6() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_ac84d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_ac84d6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000216706F6E70(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000216706F6E70(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.glsl new file mode 100644 index 0000000000..e0ca81b8c2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ac84d6() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_ac84d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_ac84d6() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = min(arg_0, arg_1); +} + +void fragment_main() { + min_ac84d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_ac84d6() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = min(arg_0, arg_1); +} + +void compute_main() { + min_ac84d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.msl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.msl new file mode 100644 index 0000000000..c8f31e2327 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_ac84d6() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_ac84d6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_ac84d6(); + return; +} + +kernel void compute_main() { + min_ac84d6(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f048ea8c7 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_ac84d6 "min_ac84d6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_ac84d6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 NMin %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %min_ac84d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %min_ac84d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_ac84d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..508794c237 --- /dev/null +++ b/test/tint/builtins/gen/var/min/ac84d6.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn min_ac84d6() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_ac84d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_ac84d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_ac84d6(); +} diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl b/test/tint/builtins/gen/var/min/af326d.wgsl new file mode 100644 index 0000000000..0bff055dda --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(f32, f32) -> f32 +fn min_af326d() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var res: f32 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_af326d(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_af326d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_af326d(); +} diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ea481e531a --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_af326d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_af326d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_af326d(); + return; +} diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ea481e531a --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_af326d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_af326d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_af326d(); + return; +} diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl new file mode 100644 index 0000000000..070d859e74 --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_af326d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = min(arg_0, arg_1); +} + +void fragment_main() { + min_af326d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = min(arg_0, arg_1); +} + +void compute_main() { + min_af326d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl new file mode 100644 index 0000000000..f7b47f6131 --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_af326d() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_af326d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_af326d(); + return; +} + +kernel void compute_main() { + min_af326d(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm new file mode 100644 index 0000000000..70b60fe235 --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_af326d "min_af326d" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %min_af326d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 NMin %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %min_af326d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %min_af326d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_af326d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl new file mode 100644 index 0000000000..02bc142826 --- /dev/null +++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_af326d() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var res : f32 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_af326d(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_af326d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_af326d(); +} diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl new file mode 100644 index 0000000000..aa2a34f0af --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<3, u32>, vec<3, u32>) -> vec<3, u32> +fn min_c70bb7() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var res: vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c70bb7(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c70bb7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c70bb7(); +} diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d0518f5fc2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_c70bb7() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c70bb7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c70bb7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c70bb7(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d0518f5fc2 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_c70bb7() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + uint3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c70bb7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c70bb7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c70bb7(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl new file mode 100644 index 0000000000..356455e077 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_c70bb7() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uvec3 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_c70bb7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_c70bb7() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uvec3 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_c70bb7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_c70bb7() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + uvec3 res = min(arg_0, arg_1); +} + +void compute_main() { + min_c70bb7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl new file mode 100644 index 0000000000..174463a743 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_c70bb7() { + uint3 arg_0 = uint3(1u); + uint3 arg_1 = uint3(1u); + uint3 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_c70bb7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_c70bb7(); + return; +} + +kernel void compute_main() { + min_c70bb7(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm new file mode 100644 index 0000000000..f0e6690c4c --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_c70bb7 "min_c70bb7" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_c70bb7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %19 + %res = OpVariable %_ptr_Function_v3uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + %23 = OpLoad %v3uint %arg_0 + %24 = OpLoad %v3uint %arg_1 + %21 = OpExtInst %v3uint %22 UMin %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %min_c70bb7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %min_c70bb7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %min_c70bb7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl new file mode 100644 index 0000000000..86e9d1ffb0 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_c70bb7() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var res : vec3 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c70bb7(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c70bb7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c70bb7(); +} diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl b/test/tint/builtins/gen/var/min/c73147.wgsl new file mode 100644 index 0000000000..c86d5a2988 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(i32, i32) -> i32 +fn min_c73147() { + var arg_0 = 1; + var arg_1 = 1; + var res: i32 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c73147(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c73147(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c73147(); +} diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a50a55d1e8 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c73147(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c73147(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c73147(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a50a55d1e8 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c73147(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c73147(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c73147(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl new file mode 100644 index 0000000000..0cf036e493 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_c73147(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +void fragment_main() { + min_c73147(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +void compute_main() { + min_c73147(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl new file mode 100644 index 0000000000..22a72c9130 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_c73147() { + int arg_0 = 1; + int arg_1 = 1; + int res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_c73147(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_c73147(); + return; +} + +kernel void compute_main() { + min_c73147(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm new file mode 100644 index 0000000000..51ce10471e --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_c73147 "min_c73147" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_c73147 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + %21 = OpLoad %int %arg_0 + %22 = OpLoad %int %arg_1 + %19 = OpExtInst %int %20 SMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_c73147 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_c73147 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_c73147 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl new file mode 100644 index 0000000000..035e6661d9 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_c73147() { + var arg_0 = 1; + var arg_1 = 1; + var res : i32 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c73147(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c73147(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c73147(); +} diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl new file mode 100644 index 0000000000..b1b4f0eb14 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn min(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn min_c76fa6() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var res: vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c76fa6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c76fa6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c76fa6(); +} diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bd0c327285 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_c76fa6() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c76fa6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c76fa6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c76fa6(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bd0c327285 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void min_c76fa6() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_c76fa6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_c76fa6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_c76fa6(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl new file mode 100644 index 0000000000..88ac3d3e00 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void min_c76fa6() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_c76fa6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void min_c76fa6() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_c76fa6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void min_c76fa6() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = min(arg_0, arg_1); +} + +void compute_main() { + min_c76fa6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl new file mode 100644 index 0000000000..313f56cdfa --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_c76fa6() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_c76fa6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_c76fa6(); + return; +} + +kernel void compute_main() { + min_c76fa6(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm new file mode 100644 index 0000000000..1512cf1d14 --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_c76fa6 "min_c76fa6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %min_c76fa6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v4float %arg_0 + %21 = OpLoad %v4float %arg_1 + %18 = OpExtInst %v4float %19 NMin %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %min_c76fa6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %min_c76fa6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %min_c76fa6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl new file mode 100644 index 0000000000..c624b7e38f --- /dev/null +++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn min_c76fa6() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var res : vec4 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_c76fa6(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_c76fa6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_c76fa6(); +} diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl b/test/tint/builtins/gen/var/min/e780f9.wgsl new file mode 100644 index 0000000000..58e70eb280 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn min(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn min_e780f9() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_e780f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_e780f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_e780f9(); +} diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2b207d346 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void min_e780f9() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_e780f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_e780f9(); + return; +} diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7a24d5deb5 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void min_e780f9() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = min(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + min_e780f9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + min_e780f9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C199F46BD0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C199F46BD0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C199F46BD0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.glsl new file mode 100644 index 0000000000..7942c5eae6 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_e780f9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = min(arg_0, arg_1); +} + +vec4 vertex_main() { + min_e780f9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void min_e780f9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = min(arg_0, arg_1); +} + +void fragment_main() { + min_e780f9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void min_e780f9() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = min(arg_0, arg_1); +} + +void compute_main() { + min_e780f9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.msl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.msl new file mode 100644 index 0000000000..49649a3c4f --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void min_e780f9() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = fmin(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + min_e780f9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + min_e780f9(); + return; +} + +kernel void compute_main() { + min_e780f9(); + return; +} + diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.spvasm new file mode 100644 index 0000000000..aac4bd1ecc --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %min_e780f9 "min_e780f9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %min_e780f9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 NMin %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %min_e780f9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %min_e780f9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %min_e780f9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce1ac48788 --- /dev/null +++ b/test/tint/builtins/gen/var/min/e780f9.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn min_e780f9() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = min(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + min_e780f9(); + return vec4(); +} + +@fragment +fn fragment_main() { + min_e780f9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + min_e780f9(); +} diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl new file mode 100644 index 0000000000..08012767b9 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn mix_0c8c33() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var arg_2 = vec3(1.f); + var res: vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_0c8c33(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_0c8c33(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_0c8c33(); +} diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..575d95d3cc --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_0c8c33() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_0c8c33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_0c8c33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_0c8c33(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..575d95d3cc --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void mix_0c8c33() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_0c8c33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_0c8c33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_0c8c33(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl new file mode 100644 index 0000000000..b6a83cf52c --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_0c8c33() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_0c8c33(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_0c8c33() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_0c8c33(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_0c8c33() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_0c8c33(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl new file mode 100644 index 0000000000..fb8ce73366 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_0c8c33() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 arg_2 = float3(1.0f); + float3 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_0c8c33(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_0c8c33(); + return; +} + +kernel void compute_main() { + mix_0c8c33(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm new file mode 100644 index 0000000000..945a11f392 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_0c8c33 "mix_0c8c33" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %27 = OpTypeFunction %v4float + %mix_0c8c33 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %arg_2 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v3float %arg_0 + %24 = OpLoad %v3float %arg_1 + %25 = OpLoad %v3float %arg_2 + %21 = OpExtInst %v3float %22 FMix %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_0c8c33 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_0c8c33 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_0c8c33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl new file mode 100644 index 0000000000..5cac533bd8 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_0c8c33() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var arg_2 = vec3(1.0f); + var res : vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_0c8c33(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_0c8c33(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_0c8c33(); +} diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl new file mode 100644 index 0000000000..74c16771ab --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32> +fn mix_1faeb1() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var arg_2 = 1.f; + var res: vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_1faeb1(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_1faeb1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_1faeb1(); +} diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..849c498a22 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_1faeb1() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float arg_2 = 1.0f; + float4 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_1faeb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_1faeb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_1faeb1(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..849c498a22 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void mix_1faeb1() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float arg_2 = 1.0f; + float4 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_1faeb1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_1faeb1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_1faeb1(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl new file mode 100644 index 0000000000..7fbecbbe08 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_1faeb1() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float arg_2 = 1.0f; + vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_1faeb1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_1faeb1() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float arg_2 = 1.0f; + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_1faeb1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_1faeb1() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float arg_2 = 1.0f; + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_1faeb1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl new file mode 100644 index 0000000000..1707059509 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_1faeb1() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float arg_2 = 1.0f; + float4 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_1faeb1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_1faeb1(); + return; +} + +kernel void compute_main() { + mix_1faeb1(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm new file mode 100644 index 0000000000..787c9a82eb --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_1faeb1 "mix_1faeb1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpTypeFunction %v4float + %mix_1faeb1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %25 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %float_1 + %22 = OpLoad %v4float %arg_0 + %23 = OpLoad %v4float %arg_1 + %24 = OpLoad %float %arg_2 + %26 = OpCompositeConstruct %v4float %24 %24 %24 %24 + %20 = OpExtInst %v4float %21 FMix %22 %23 %26 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %mix_1faeb1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %mix_1faeb1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %mix_1faeb1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl new file mode 100644 index 0000000000..0bd8c68f00 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_1faeb1() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var arg_2 = 1.0f; + var res : vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_1faeb1(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_1faeb1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_1faeb1(); +} diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl new file mode 100644 index 0000000000..c5719fd336 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32> +fn mix_2fadab() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var arg_2 = 1.f; + var res: vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_2fadab(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_2fadab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_2fadab(); +} diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f46a543a7a --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_2fadab() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float arg_2 = 1.0f; + float2 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_2fadab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_2fadab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_2fadab(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f46a543a7a --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void mix_2fadab() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float arg_2 = 1.0f; + float2 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_2fadab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_2fadab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_2fadab(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl new file mode 100644 index 0000000000..cb94e51add --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_2fadab() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float arg_2 = 1.0f; + vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_2fadab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_2fadab() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float arg_2 = 1.0f; + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_2fadab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_2fadab() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float arg_2 = 1.0f; + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_2fadab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl new file mode 100644 index 0000000000..ad998d733c --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_2fadab() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float arg_2 = 1.0f; + float2 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_2fadab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_2fadab(); + return; +} + +kernel void compute_main() { + mix_2fadab(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm new file mode 100644 index 0000000000..4e77aa1c28 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_2fadab "mix_2fadab" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpTypeFunction %v4float + %mix_2fadab = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %27 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %float_1 + %24 = OpLoad %v2float %arg_0 + %25 = OpLoad %v2float %arg_1 + %26 = OpLoad %float %arg_2 + %28 = OpCompositeConstruct %v2float %26 %26 + %22 = OpExtInst %v2float %23 FMix %24 %25 %28 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_2fadab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_2fadab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %mix_2fadab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl new file mode 100644 index 0000000000..82845ab7b9 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_2fadab() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var arg_2 = 1.0f; + var res : vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_2fadab(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_2fadab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_2fadab(); +} diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl b/test/tint/builtins/gen/var/mix/315264.wgsl new file mode 100644 index 0000000000..3d8f9ace73 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32> +fn mix_315264() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var arg_2 = 1.f; + var res: vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_315264(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_315264(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_315264(); +} diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64aa63f195 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_315264() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float arg_2 = 1.0f; + float3 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_315264(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_315264(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_315264(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64aa63f195 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void mix_315264() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float arg_2 = 1.0f; + float3 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_315264(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_315264(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_315264(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl new file mode 100644 index 0000000000..ee1b5a76ce --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_315264() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float arg_2 = 1.0f; + vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_315264(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_315264() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float arg_2 = 1.0f; + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_315264(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_315264() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float arg_2 = 1.0f; + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_315264(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl new file mode 100644 index 0000000000..0b75b9212f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_315264() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float arg_2 = 1.0f; + float3 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_315264(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_315264(); + return; +} + +kernel void compute_main() { + mix_315264(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm new file mode 100644 index 0000000000..c3dcf6299f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_315264 "mix_315264" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpTypeFunction %v4float + %mix_315264 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %27 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %float_1 + %24 = OpLoad %v3float %arg_0 + %25 = OpLoad %v3float %arg_1 + %26 = OpLoad %float %arg_2 + %28 = OpCompositeConstruct %v3float %26 %26 %26 + %22 = OpExtInst %v3float %23 FMix %24 %25 %28 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_315264 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_315264 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %mix_315264 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl new file mode 100644 index 0000000000..209ecade6a --- /dev/null +++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_315264() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var arg_2 = 1.0f; + var res : vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_315264(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_315264(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_315264(); +} diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl new file mode 100644 index 0000000000..c319eeae80 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(f16, f16, f16) -> f16 +fn mix_38cbbb() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res: f16 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_38cbbb(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_38cbbb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_38cbbb(); +} diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a0edd4a44c --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_38cbbb() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_38cbbb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_38cbbb(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f7267d243c --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void mix_38cbbb() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_38cbbb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_38cbbb(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000265C36E19E0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000265C36E19E0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.glsl new file mode 100644 index 0000000000..c5da8564ad --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_38cbbb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_38cbbb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_38cbbb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_38cbbb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_38cbbb() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_38cbbb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.msl new file mode 100644 index 0000000000..45b6845d57 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_38cbbb() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half arg_2 = 0.0h; + half res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_38cbbb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_38cbbb(); + return; +} + +kernel void compute_main() { + mix_38cbbb(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.spvasm new file mode 100644 index 0000000000..601a4f8eab --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_38cbbb "mix_38cbbb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_38cbbb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %half %arg_0 + %22 = OpLoad %half %arg_1 + %23 = OpLoad %half %arg_2 + %19 = OpExtInst %half %20 FMix %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %mix_38cbbb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %mix_38cbbb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %mix_38cbbb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.wgsl new file mode 100644 index 0000000000..89050575f2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/38cbbb.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_38cbbb() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res : f16 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_38cbbb(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_38cbbb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_38cbbb(); +} diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl new file mode 100644 index 0000000000..88173debb5 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(f32, f32, f32) -> f32 +fn mix_4f0b5e() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var arg_2 = 1.f; + var res: f32 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_4f0b5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_4f0b5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_4f0b5e(); +} diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3ddc02b2d0 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_4f0b5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_4f0b5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_4f0b5e(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ddc02b2d0 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_4f0b5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_4f0b5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_4f0b5e(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl new file mode 100644 index 0000000000..4c40badba7 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_4f0b5e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_4f0b5e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_4f0b5e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl new file mode 100644 index 0000000000..55238da03e --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_4f0b5e() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_4f0b5e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_4f0b5e(); + return; +} + +kernel void compute_main() { + mix_4f0b5e(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm new file mode 100644 index 0000000000..a307df332e --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_4f0b5e "mix_4f0b5e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float + %mix_4f0b5e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %float_1 + %20 = OpLoad %float %arg_0 + %21 = OpLoad %float %arg_1 + %22 = OpLoad %float %arg_2 + %18 = OpExtInst %float %19 FMix %20 %21 %22 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %mix_4f0b5e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_4f0b5e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_4f0b5e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl new file mode 100644 index 0000000000..3543079c05 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_4f0b5e() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var arg_2 = 1.0f; + var res : f32 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_4f0b5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_4f0b5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_4f0b5e(); +} diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl new file mode 100644 index 0000000000..b68ae29f2a --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn mix_63f2fd() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_63f2fd(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_63f2fd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_63f2fd(); +} diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64200d6d08 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_63f2fd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_63f2fd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_63f2fd(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a54e8bdc53 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_63f2fd() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_63f2fd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_63f2fd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DB787B5D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DB787B5D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DB787B5D0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021DB787B5D0(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.glsl new file mode 100644 index 0000000000..21b513d39b --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_63f2fd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_63f2fd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_63f2fd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_63f2fd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_63f2fd() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_63f2fd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.msl new file mode 100644 index 0000000000..434d37abf8 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_63f2fd() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_63f2fd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_63f2fd(); + return; +} + +kernel void compute_main() { + mix_63f2fd(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.spvasm new file mode 100644 index 0000000000..44f6f950c1 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_63f2fd "mix_63f2fd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_63f2fd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 FMix %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %mix_63f2fd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_63f2fd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_63f2fd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.wgsl new file mode 100644 index 0000000000..803966f310 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/63f2fd.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_63f2fd() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_63f2fd(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_63f2fd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_63f2fd(); +} diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl new file mode 100644 index 0000000000..c42ccf90c6 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn mix_6f8adc() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var arg_2 = vec2(1.f); + var res: vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_6f8adc(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_6f8adc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_6f8adc(); +} diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..78b6a371c2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_6f8adc() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_6f8adc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_6f8adc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_6f8adc(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..78b6a371c2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void mix_6f8adc() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_6f8adc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_6f8adc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_6f8adc(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl new file mode 100644 index 0000000000..d1d9e5a37c --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_6f8adc() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_6f8adc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_6f8adc() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_6f8adc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_6f8adc() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_6f8adc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl new file mode 100644 index 0000000000..d81240b448 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_6f8adc() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 arg_2 = float2(1.0f); + float2 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_6f8adc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_6f8adc(); + return; +} + +kernel void compute_main() { + mix_6f8adc(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm new file mode 100644 index 0000000000..d2018979b4 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_6f8adc "mix_6f8adc" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %27 = OpTypeFunction %v4float + %mix_6f8adc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %arg_2 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v2float %arg_0 + %24 = OpLoad %v2float %arg_1 + %25 = OpLoad %v2float %arg_2 + %21 = OpExtInst %v2float %22 FMix %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %mix_6f8adc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_6f8adc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_6f8adc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl new file mode 100644 index 0000000000..5d5ab3c279 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_6f8adc() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var arg_2 = vec2(1.0f); + var res : vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_6f8adc(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_6f8adc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_6f8adc(); +} diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl new file mode 100644 index 0000000000..4ad0e03b51 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn mix_98ee3e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_98ee3e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_98ee3e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_98ee3e(); +} diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c9b6cd1a9 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_98ee3e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_98ee3e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_98ee3e(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..034d0366be --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_98ee3e() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_98ee3e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_98ee3e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261CFF10B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261CFF10B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261CFF10B50(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261CFF10B50(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.glsl new file mode 100644 index 0000000000..4fe64a06d4 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_98ee3e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_98ee3e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_98ee3e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_98ee3e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_98ee3e() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_98ee3e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.msl new file mode 100644 index 0000000000..6dab70bbfe --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_98ee3e() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_98ee3e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_98ee3e(); + return; +} + +kernel void compute_main() { + mix_98ee3e(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.spvasm new file mode 100644 index 0000000000..94ac72eb65 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_98ee3e "mix_98ee3e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_98ee3e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 FMix %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %mix_98ee3e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_98ee3e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_98ee3e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.wgsl new file mode 100644 index 0000000000..28738df928 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/98ee3e.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_98ee3e() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_98ee3e(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_98ee3e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_98ee3e(); +} diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl new file mode 100644 index 0000000000..6eabaff9fa --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<3, f16>, vec<3, f16>, f16) -> vec<3, f16> +fn mix_c1aec6() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = f16(); + var res: vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c1aec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c1aec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c1aec6(); +} diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fae485c639 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_c1aec6() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c1aec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c1aec6(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c8b6210430 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_c1aec6() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c1aec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c1aec6(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002489FE7D9C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002489FE7D9C0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002489FE7D9C0(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002489FE7D9C0(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.glsl new file mode 100644 index 0000000000..8eba39093f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_c1aec6() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_c1aec6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_c1aec6() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_c1aec6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_c1aec6() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_c1aec6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.msl new file mode 100644 index 0000000000..c8161a6c39 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_c1aec6() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half arg_2 = 0.0h; + half3 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_c1aec6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_c1aec6(); + return; +} + +kernel void compute_main() { + mix_c1aec6(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e20acfdde2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_c1aec6 "mix_c1aec6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_c1aec6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %27 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v3half %arg_0 + %25 = OpLoad %v3half %arg_1 + %26 = OpLoad %half %arg_2 + %28 = OpCompositeConstruct %v3half %26 %26 %26 + %22 = OpExtInst %v3half %23 FMix %24 %25 %28 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_c1aec6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %mix_c1aec6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %mix_c1aec6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.wgsl new file mode 100644 index 0000000000..a66c0bc6b2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c1aec6.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_c1aec6() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = f16(); + var res : vec3 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c1aec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c1aec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c1aec6(); +} diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl new file mode 100644 index 0000000000..847edc8f4e --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn mix(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn mix_c37ede() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var arg_2 = vec4(1.f); + var res: vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c37ede(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c37ede(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c37ede(); +} diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..202b6a5bc7 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_c37ede() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c37ede(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c37ede(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c37ede(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..202b6a5bc7 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void mix_c37ede() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_c37ede(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_c37ede(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_c37ede(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl new file mode 100644 index 0000000000..2642b1ce86 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void mix_c37ede() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_c37ede(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void mix_c37ede() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_c37ede(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void mix_c37ede() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_c37ede(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl new file mode 100644 index 0000000000..58c02b51b3 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_c37ede() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 arg_2 = float4(1.0f); + float4 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_c37ede(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_c37ede(); + return; +} + +kernel void compute_main() { + mix_c37ede(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm new file mode 100644 index 0000000000..548ba53ad8 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_c37ede "mix_c37ede" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %v4float + %mix_c37ede = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v4float %arg_0 + %22 = OpLoad %v4float %arg_1 + %23 = OpLoad %v4float %arg_2 + %19 = OpExtInst %v4float %20 FMix %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %mix_c37ede + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %mix_c37ede + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %mix_c37ede + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl new file mode 100644 index 0000000000..6fb66e2eb9 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn mix_c37ede() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var arg_2 = vec4(1.0f); + var res : vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_c37ede(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_c37ede(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_c37ede(); +} diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl new file mode 100644 index 0000000000..2dc7e65c5f --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<2, f16>, vec<2, f16>, f16) -> vec<2, f16> +fn mix_e46a83() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = f16(); + var res: vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_e46a83(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_e46a83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_e46a83(); +} diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f857864601 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_e46a83() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_e46a83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_e46a83(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..088d87963a --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_e46a83() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_e46a83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_e46a83(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F3F7264500(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F3F7264500(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F3F7264500(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F3F7264500(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.glsl new file mode 100644 index 0000000000..63c9a84d04 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_e46a83() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_e46a83(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_e46a83() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_e46a83(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_e46a83() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_e46a83(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.msl new file mode 100644 index 0000000000..8fdd8f3869 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_e46a83() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half arg_2 = 0.0h; + half2 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_e46a83(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_e46a83(); + return; +} + +kernel void compute_main() { + mix_e46a83(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.spvasm new file mode 100644 index 0000000000..228e018447 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_e46a83 "mix_e46a83" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_e46a83 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %27 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v2half %arg_0 + %25 = OpLoad %v2half %arg_1 + %26 = OpLoad %half %arg_2 + %28 = OpCompositeConstruct %v2half %26 %26 + %22 = OpExtInst %v2half %23 FMix %24 %25 %28 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_e46a83 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %mix_e46a83 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %mix_e46a83 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.wgsl new file mode 100644 index 0000000000..f08146ccc2 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/e46a83.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_e46a83() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = f16(); + var res : vec2 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_e46a83(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_e46a83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_e46a83(); +} diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl new file mode 100644 index 0000000000..63a60750a9 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn mix_ee2468() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_ee2468(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_ee2468(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_ee2468(); +} diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7ddd927daa --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_ee2468() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_ee2468(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_ee2468(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7e6e6f0c53 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_ee2468() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_ee2468(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_ee2468(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000122D9269150(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000122D9269150(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000122D9269150(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000122D9269150(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.glsl new file mode 100644 index 0000000000..7ca5dd01b4 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_ee2468() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_ee2468(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_ee2468() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_ee2468(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_ee2468() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_ee2468(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.msl new file mode 100644 index 0000000000..f08697a96b --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_ee2468() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_ee2468(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_ee2468(); + return; +} + +kernel void compute_main() { + mix_ee2468(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.spvasm new file mode 100644 index 0000000000..57a262cddd --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_ee2468 "mix_ee2468" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_ee2468 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 FMix %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %mix_ee2468 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %mix_ee2468 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %mix_ee2468 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ab03948ba --- /dev/null +++ b/test/tint/builtins/gen/var/mix/ee2468.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_ee2468() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_ee2468(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_ee2468(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_ee2468(); +} diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl new file mode 100644 index 0000000000..fc47f42d8d --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn mix(vec<4, f16>, vec<4, f16>, f16) -> vec<4, f16> +fn mix_f1a543() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = f16(); + var res: vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_f1a543(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_f1a543(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_f1a543(); +} diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e21963a103 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void mix_f1a543() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_f1a543(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_f1a543(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..97176f96ae --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void mix_f1a543() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t arg_2 = float16_t(0.0h); + vector res = lerp(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + mix_f1a543(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + mix_f1a543(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027B644EDA60(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027B644EDA60(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027B644EDA60(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027B644EDA60(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.glsl new file mode 100644 index 0000000000..4b023e5eb9 --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_f1a543() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + mix_f1a543(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void mix_f1a543() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + mix_f1a543(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void mix_f1a543() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + mix_f1a543(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.msl new file mode 100644 index 0000000000..2f8163dacc --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void mix_f1a543() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half arg_2 = 0.0h; + half4 res = mix(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + mix_f1a543(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + mix_f1a543(); + return; +} + +kernel void compute_main() { + mix_f1a543(); + return; +} + diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd6d0099ca --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %mix_f1a543 "mix_f1a543" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %mix_f1a543 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %27 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v4half %arg_0 + %25 = OpLoad %v4half %arg_1 + %26 = OpLoad %half %arg_2 + %28 = OpCompositeConstruct %v4half %26 %26 %26 %26 + %22 = OpExtInst %v4half %23 FMix %24 %25 %28 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %mix_f1a543 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %mix_f1a543 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %mix_f1a543 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee4f14c8bd --- /dev/null +++ b/test/tint/builtins/gen/var/mix/f1a543.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn mix_f1a543() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = f16(); + var res : vec4 = mix(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + mix_f1a543(); + return vec4(); +} + +@fragment +fn fragment_main() { + mix_f1a543(); +} + +@compute @workgroup_size(1) +fn compute_main() { + mix_f1a543(); +} diff --git a/test/tint/builtins/gen/var/modf/2d50da.wgsl b/test/tint/builtins/gen/var/modf/2d50da.wgsl new file mode 100644 index 0000000000..d8f067b9b6 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/2d50da.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(vec<2, f32>) -> __modf_result_vec<2, f32> +fn modf_2d50da() { + var arg_0 = vec2(1.f); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_2d50da(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_2d50da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_2d50da(); +} diff --git a/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bf9728ea66 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec2 { + float2 fract; + float2 whole; +}; +modf_result_vec2 tint_modf(float2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_2d50da() { + float2 arg_0 = (1.0f).xx; + modf_result_vec2 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_2d50da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_2d50da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_2d50da(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf9728ea66 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec2 { + float2 fract; + float2 whole; +}; +modf_result_vec2 tint_modf(float2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_2d50da() { + float2 arg_0 = (1.0f).xx; + modf_result_vec2 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_2d50da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_2d50da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_2d50da(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.glsl new file mode 100644 index 0000000000..a1998b9e45 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct modf_result_vec2 { + vec2 fract; + vec2 whole; +}; + +modf_result_vec2 tint_modf(vec2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_2d50da() { + vec2 arg_0 = vec2(1.0f); + modf_result_vec2 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_2d50da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result_vec2 { + vec2 fract; + vec2 whole; +}; + +modf_result_vec2 tint_modf(vec2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_2d50da() { + vec2 arg_0 = vec2(1.0f); + modf_result_vec2 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_2d50da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result_vec2 { + vec2 fract; + vec2 whole; +}; + +modf_result_vec2 tint_modf(vec2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_2d50da() { + vec2 arg_0 = vec2(1.0f); + modf_result_vec2 res = tint_modf(arg_0); +} + +void compute_main() { + modf_2d50da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.msl new file mode 100644 index 0000000000..75795761e1 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec2 { + float2 fract; + float2 whole; +}; +modf_result_vec2 tint_modf(float2 param_0) { + modf_result_vec2 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_2d50da() { + float2 arg_0 = float2(1.0f); + modf_result_vec2 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_2d50da(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_2d50da(); + return; +} + +kernel void compute_main() { + modf_2d50da(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e6337b8ba --- /dev/null +++ b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_2d50da "modf_2d50da" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec2 "__modf_result_vec2" + OpMemberName %__modf_result_vec2 0 "fract" + OpMemberName %__modf_result_vec2 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec2 0 Offset 0 + OpMemberDecorate %__modf_result_vec2 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float +%__modf_result_vec2 = OpTypeStruct %v2float %v2float +%_ptr_Function___modf_result_vec2 = OpTypePointer Function %__modf_result_vec2 + %25 = OpConstantNull %__modf_result_vec2 + %26 = OpTypeFunction %v4float +%modf_2d50da = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function___modf_result_vec2 Function %25 + OpStore %arg_0 %15 + %22 = OpLoad %v2float %arg_0 + %19 = OpExtInst %__modf_result_vec2 %21 ModfStruct %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %modf_2d50da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_2d50da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %modf_2d50da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.wgsl new file mode 100644 index 0000000000..baa503959e --- /dev/null +++ b/test/tint/builtins/gen/var/modf/2d50da.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn modf_2d50da() { + var arg_0 = vec2(1.0f); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_2d50da(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_2d50da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_2d50da(); +} diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl b/test/tint/builtins/gen/var/modf/45005f.wgsl new file mode 100644 index 0000000000..7576567658 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<3, f16>) -> __modf_result_vec<3, f16> +fn modf_45005f() { + var arg_0 = vec3(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_45005f(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_45005f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_45005f(); +} diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e6631d340d --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec3_f16 { + vector fract; + vector whole; +}; +modf_result_vec3_f16 tint_modf(vector param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + vector arg_0 = (float16_t(0.0h)).xxx; + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_45005f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_45005f(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64e0fc49a5 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct modf_result_vec3_f16 { + vector fract; + vector whole; +}; +modf_result_vec3_f16 tint_modf(vector param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + vector arg_0 = (float16_t(0.0h)).xxx; + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_45005f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_45005f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022A03927740(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.glsl new file mode 100644 index 0000000000..238c3c2682 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + f16vec3 arg_0 = f16vec3(0.0hf); + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_45005f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + f16vec3 arg_0 = f16vec3(0.0hf); + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_45005f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec3_f16 { + f16vec3 fract; + f16vec3 whole; +}; + +modf_result_vec3_f16 tint_modf(f16vec3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_45005f() { + f16vec3 arg_0 = f16vec3(0.0hf); + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +void compute_main() { + modf_45005f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.msl new file mode 100644 index 0000000000..736c945edb --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec3_f16 { + half3 fract; + half3 whole; +}; +modf_result_vec3_f16 tint_modf(half3 param_0) { + modf_result_vec3_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_45005f() { + half3 arg_0 = half3(0.0h); + modf_result_vec3_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_45005f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_45005f(); + return; +} + +kernel void compute_main() { + modf_45005f(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.spvasm new file mode 100644 index 0000000000..ff3de45e07 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_45005f "modf_45005f" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec3_f16 "__modf_result_vec3_f16" + OpMemberName %__modf_result_vec3_f16 0 "fract" + OpMemberName %__modf_result_vec3_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec3_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec3_f16 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%__modf_result_vec3_f16 = OpTypeStruct %v3half %v3half +%_ptr_Function___modf_result_vec3_f16 = OpTypePointer Function %__modf_result_vec3_f16 + %24 = OpConstantNull %__modf_result_vec3_f16 + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_45005f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function___modf_result_vec3_f16 Function %24 + OpStore %arg_0 %15 + %21 = OpLoad %v3half %arg_0 + %18 = OpExtInst %__modf_result_vec3_f16 %20 ModfStruct %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %modf_45005f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_45005f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %modf_45005f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.wgsl new file mode 100644 index 0000000000..987ba8ad11 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/45005f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn modf_45005f() { + var arg_0 = vec3(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_45005f(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_45005f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_45005f(); +} diff --git a/test/tint/builtins/gen/var/modf/4bfced.wgsl b/test/tint/builtins/gen/var/modf/4bfced.wgsl new file mode 100644 index 0000000000..4929415af6 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/4bfced.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(vec<4, f32>) -> __modf_result_vec<4, f32> +fn modf_4bfced() { + var arg_0 = vec4(1.f); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_4bfced(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_4bfced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_4bfced(); +} diff --git a/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0cfe790dc1 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec4 { + float4 fract; + float4 whole; +}; +modf_result_vec4 tint_modf(float4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_4bfced() { + float4 arg_0 = (1.0f).xxxx; + modf_result_vec4 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_4bfced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_4bfced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_4bfced(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0cfe790dc1 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec4 { + float4 fract; + float4 whole; +}; +modf_result_vec4 tint_modf(float4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_4bfced() { + float4 arg_0 = (1.0f).xxxx; + modf_result_vec4 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_4bfced(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_4bfced(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_4bfced(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.glsl new file mode 100644 index 0000000000..5d5615b40f --- /dev/null +++ b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct modf_result_vec4 { + vec4 fract; + vec4 whole; +}; + +modf_result_vec4 tint_modf(vec4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_4bfced() { + vec4 arg_0 = vec4(1.0f); + modf_result_vec4 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_4bfced(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result_vec4 { + vec4 fract; + vec4 whole; +}; + +modf_result_vec4 tint_modf(vec4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_4bfced() { + vec4 arg_0 = vec4(1.0f); + modf_result_vec4 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_4bfced(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result_vec4 { + vec4 fract; + vec4 whole; +}; + +modf_result_vec4 tint_modf(vec4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_4bfced() { + vec4 arg_0 = vec4(1.0f); + modf_result_vec4 res = tint_modf(arg_0); +} + +void compute_main() { + modf_4bfced(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.msl new file mode 100644 index 0000000000..4bac39e4e9 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec4 { + float4 fract; + float4 whole; +}; +modf_result_vec4 tint_modf(float4 param_0) { + modf_result_vec4 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_4bfced() { + float4 arg_0 = float4(1.0f); + modf_result_vec4 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_4bfced(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_4bfced(); + return; +} + +kernel void compute_main() { + modf_4bfced(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.spvasm new file mode 100644 index 0000000000..44dedfe0c6 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_4bfced "modf_4bfced" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec4 "__modf_result_vec4" + OpMemberName %__modf_result_vec4 0 "fract" + OpMemberName %__modf_result_vec4 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec4 0 Offset 0 + OpMemberDecorate %__modf_result_vec4 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%__modf_result_vec4 = OpTypeStruct %v4float %v4float +%_ptr_Function___modf_result_vec4 = OpTypePointer Function %__modf_result_vec4 + %23 = OpConstantNull %__modf_result_vec4 + %24 = OpTypeFunction %v4float +%modf_4bfced = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function___modf_result_vec4 Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %v4float %arg_0 + %17 = OpExtInst %__modf_result_vec4 %19 ModfStruct %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %modf_4bfced + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %modf_4bfced + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %modf_4bfced + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.wgsl new file mode 100644 index 0000000000..cff6f57977 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/4bfced.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn modf_4bfced() { + var arg_0 = vec4(1.0f); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_4bfced(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_4bfced(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_4bfced(); +} diff --git a/test/tint/builtins/gen/var/modf/5ea256.wgsl b/test/tint/builtins/gen/var/modf/5ea256.wgsl new file mode 100644 index 0000000000..f85cfeb5af --- /dev/null +++ b/test/tint/builtins/gen/var/modf/5ea256.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(vec<3, f32>) -> __modf_result_vec<3, f32> +fn modf_5ea256() { + var arg_0 = vec3(1.f); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_5ea256(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_5ea256(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_5ea256(); +} diff --git a/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ffd6a125b3 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec3 { + float3 fract; + float3 whole; +}; +modf_result_vec3 tint_modf(float3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_5ea256() { + float3 arg_0 = (1.0f).xxx; + modf_result_vec3 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_5ea256(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_5ea256(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_5ea256(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ffd6a125b3 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec3 { + float3 fract; + float3 whole; +}; +modf_result_vec3 tint_modf(float3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_5ea256() { + float3 arg_0 = (1.0f).xxx; + modf_result_vec3 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_5ea256(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_5ea256(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_5ea256(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.glsl new file mode 100644 index 0000000000..021cf81383 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct modf_result_vec3 { + vec3 fract; + vec3 whole; +}; + +modf_result_vec3 tint_modf(vec3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_5ea256() { + vec3 arg_0 = vec3(1.0f); + modf_result_vec3 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_5ea256(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result_vec3 { + vec3 fract; + vec3 whole; +}; + +modf_result_vec3 tint_modf(vec3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_5ea256() { + vec3 arg_0 = vec3(1.0f); + modf_result_vec3 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_5ea256(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result_vec3 { + vec3 fract; + vec3 whole; +}; + +modf_result_vec3 tint_modf(vec3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_5ea256() { + vec3 arg_0 = vec3(1.0f); + modf_result_vec3 res = tint_modf(arg_0); +} + +void compute_main() { + modf_5ea256(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.msl new file mode 100644 index 0000000000..fa5d28af5a --- /dev/null +++ b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec3 { + float3 fract; + float3 whole; +}; +modf_result_vec3 tint_modf(float3 param_0) { + modf_result_vec3 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_5ea256() { + float3 arg_0 = float3(1.0f); + modf_result_vec3 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_5ea256(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_5ea256(); + return; +} + +kernel void compute_main() { + modf_5ea256(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.spvasm new file mode 100644 index 0000000000..1587506574 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_5ea256 "modf_5ea256" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec3 "__modf_result_vec3" + OpMemberName %__modf_result_vec3 0 "fract" + OpMemberName %__modf_result_vec3 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec3 0 Offset 0 + OpMemberDecorate %__modf_result_vec3 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float +%__modf_result_vec3 = OpTypeStruct %v3float %v3float +%_ptr_Function___modf_result_vec3 = OpTypePointer Function %__modf_result_vec3 + %25 = OpConstantNull %__modf_result_vec3 + %26 = OpTypeFunction %v4float +%modf_5ea256 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function___modf_result_vec3 Function %25 + OpStore %arg_0 %15 + %22 = OpLoad %v3float %arg_0 + %19 = OpExtInst %__modf_result_vec3 %21 ModfStruct %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %modf_5ea256 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_5ea256 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %modf_5ea256 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.wgsl new file mode 100644 index 0000000000..5180d1456a --- /dev/null +++ b/test/tint/builtins/gen/var/modf/5ea256.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn modf_5ea256() { + var arg_0 = vec3(1.0f); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_5ea256(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_5ea256(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_5ea256(); +} diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl new file mode 100644 index 0000000000..057c908b43 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(f16) -> __modf_result +fn modf_8dbbbf() { + var arg_0 = f16(); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_8dbbbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_8dbbbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_8dbbbf(); +} diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53bf292be9 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + float16_t arg_0 = float16_t(0.0h); + modf_result_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_8dbbbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_8dbbbf(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..db80c1f543 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + float16_t arg_0 = float16_t(0.0h); + modf_result_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_8dbbbf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_8dbbbf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A838D20100(2,3-11): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.glsl new file mode 100644 index 0000000000..38e8cf6fbc --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + float16_t arg_0 = 0.0hf; + modf_result_f16 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_8dbbbf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + float16_t arg_0 = 0.0hf; + modf_result_f16 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_8dbbbf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_f16 { + float16_t fract; + float16_t whole; +}; + +modf_result_f16 tint_modf(float16_t param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_8dbbbf() { + float16_t arg_0 = 0.0hf; + modf_result_f16 res = tint_modf(arg_0); +} + +void compute_main() { + modf_8dbbbf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.msl new file mode 100644 index 0000000000..feb162130f --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_f16 { + half fract; + half whole; +}; +modf_result_f16 tint_modf(half param_0) { + modf_result_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_8dbbbf() { + half arg_0 = 0.0h; + modf_result_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_8dbbbf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_8dbbbf(); + return; +} + +kernel void compute_main() { + modf_8dbbbf(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4ab1c8367 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_8dbbbf "modf_8dbbbf" + OpName %arg_0 "arg_0" + OpName %__modf_result_f16 "__modf_result_f16" + OpMemberName %__modf_result_f16 0 "fract" + OpMemberName %__modf_result_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_f16 0 Offset 0 + OpMemberDecorate %__modf_result_f16 1 Offset 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half +%__modf_result_f16 = OpTypeStruct %half %half +%_ptr_Function___modf_result_f16 = OpTypePointer Function %__modf_result_f16 + %23 = OpConstantNull %__modf_result_f16 + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_8dbbbf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function___modf_result_f16 Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %half %arg_0 + %17 = OpExtInst %__modf_result_f16 %19 ModfStruct %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %modf_8dbbbf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %modf_8dbbbf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %modf_8dbbbf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e076874c4 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/8dbbbf.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn modf_8dbbbf() { + var arg_0 = f16(); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_8dbbbf(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_8dbbbf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_8dbbbf(); +} diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl b/test/tint/builtins/gen/var/modf/995934.wgsl new file mode 100644 index 0000000000..b981c28d1f --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<4, f16>) -> __modf_result_vec<4, f16> +fn modf_995934() { + var arg_0 = vec4(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_995934(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_995934(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_995934(); +} diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee6f076b6a --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec4_f16 { + vector fract; + vector whole; +}; +modf_result_vec4_f16 tint_modf(vector param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + vector arg_0 = (float16_t(0.0h)).xxxx; + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_995934(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_995934(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_995934(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d2a213746e --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct modf_result_vec4_f16 { + vector fract; + vector whole; +}; +modf_result_vec4_f16 tint_modf(vector param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + vector arg_0 = (float16_t(0.0h)).xxxx; + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_995934(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_995934(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_995934(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022D4D8C17A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.glsl new file mode 100644 index 0000000000..8bef4a7846 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + f16vec4 arg_0 = f16vec4(0.0hf); + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_995934(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + f16vec4 arg_0 = f16vec4(0.0hf); + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_995934(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec4_f16 { + f16vec4 fract; + f16vec4 whole; +}; + +modf_result_vec4_f16 tint_modf(f16vec4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_995934() { + f16vec4 arg_0 = f16vec4(0.0hf); + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +void compute_main() { + modf_995934(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.msl new file mode 100644 index 0000000000..8f32c42606 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec4_f16 { + half4 fract; + half4 whole; +}; +modf_result_vec4_f16 tint_modf(half4 param_0) { + modf_result_vec4_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_995934() { + half4 arg_0 = half4(0.0h); + modf_result_vec4_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_995934(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_995934(); + return; +} + +kernel void compute_main() { + modf_995934(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.spvasm new file mode 100644 index 0000000000..ddb7405322 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_995934 "modf_995934" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec4_f16 "__modf_result_vec4_f16" + OpMemberName %__modf_result_vec4_f16 0 "fract" + OpMemberName %__modf_result_vec4_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec4_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec4_f16 1 Offset 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%__modf_result_vec4_f16 = OpTypeStruct %v4half %v4half +%_ptr_Function___modf_result_vec4_f16 = OpTypePointer Function %__modf_result_vec4_f16 + %24 = OpConstantNull %__modf_result_vec4_f16 + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_995934 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function___modf_result_vec4_f16 Function %24 + OpStore %arg_0 %15 + %21 = OpLoad %v4half %arg_0 + %18 = OpExtInst %__modf_result_vec4_f16 %20 ModfStruct %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %modf_995934 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_995934 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %modf_995934 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/995934.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.wgsl new file mode 100644 index 0000000000..a1ed549b10 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/995934.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn modf_995934() { + var arg_0 = vec4(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_995934(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_995934(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_995934(); +} diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl new file mode 100644 index 0000000000..891108626c --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn modf(vec<2, f16>) -> __modf_result_vec<2, f16> +fn modf_a545b9() { + var arg_0 = vec2(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_a545b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_a545b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_a545b9(); +} diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66e40ec11d --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result_vec2_f16 { + vector fract; + vector whole; +}; +modf_result_vec2_f16 tint_modf(vector param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + vector arg_0 = (float16_t(0.0h)).xx; + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_a545b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_a545b9(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..412c83d765 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,46 @@ +SKIP: FAILED + +struct modf_result_vec2_f16 { + vector fract; + vector whole; +}; +modf_result_vec2_f16 tint_modf(vector param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + vector arg_0 = (float16_t(0.0h)).xx; + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_a545b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_a545b9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F329190D80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.glsl new file mode 100644 index 0000000000..3d59c415ec --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.glsl @@ -0,0 +1,91 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + f16vec2 arg_0 = f16vec2(0.0hf); + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_a545b9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + f16vec2 arg_0 = f16vec2(0.0hf); + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +void fragment_main() { + modf_a545b9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +struct modf_result_vec2_f16 { + f16vec2 fract; + f16vec2 whole; +}; + +modf_result_vec2_f16 tint_modf(f16vec2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_a545b9() { + f16vec2 arg_0 = f16vec2(0.0hf); + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +void compute_main() { + modf_a545b9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.msl new file mode 100644 index 0000000000..7330f6bd03 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result_vec2_f16 { + half2 fract; + half2 whole; +}; +modf_result_vec2_f16 tint_modf(half2 param_0) { + modf_result_vec2_f16 result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_a545b9() { + half2 arg_0 = half2(0.0h); + modf_result_vec2_f16 res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_a545b9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_a545b9(); + return; +} + +kernel void compute_main() { + modf_a545b9(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..a862a6cdab --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_a545b9 "modf_a545b9" + OpName %arg_0 "arg_0" + OpName %__modf_result_vec2_f16 "__modf_result_vec2_f16" + OpMemberName %__modf_result_vec2_f16 0 "fract" + OpMemberName %__modf_result_vec2_f16 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result_vec2_f16 0 Offset 0 + OpMemberDecorate %__modf_result_vec2_f16 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%__modf_result_vec2_f16 = OpTypeStruct %v2half %v2half +%_ptr_Function___modf_result_vec2_f16 = OpTypePointer Function %__modf_result_vec2_f16 + %24 = OpConstantNull %__modf_result_vec2_f16 + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%modf_a545b9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function___modf_result_vec2_f16 Function %24 + OpStore %arg_0 %15 + %21 = OpLoad %v2half %arg_0 + %18 = OpExtInst %__modf_result_vec2_f16 %20 ModfStruct %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %modf_a545b9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_a545b9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %modf_a545b9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..9016659d56 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/a545b9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn modf_a545b9() { + var arg_0 = vec2(f16()); + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_a545b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_a545b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_a545b9(); +} diff --git a/test/tint/builtins/gen/var/modf/bbf7f7.wgsl b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl new file mode 100644 index 0000000000..60ab469def --- /dev/null +++ b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn modf(f32) -> __modf_result +fn modf_bbf7f7() { + var arg_0 = 1.f; + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_bbf7f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_bbf7f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_bbf7f7(); +} diff --git a/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39adf2d7b4 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_bbf7f7() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_bbf7f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_bbf7f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_bbf7f7(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..39adf2d7b4 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_bbf7f7() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + modf_bbf7f7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + modf_bbf7f7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + modf_bbf7f7(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.glsl new file mode 100644 index 0000000000..4907635438 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.glsl @@ -0,0 +1,88 @@ +#version 310 es + +struct modf_result { + float fract; + float whole; +}; + +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_bbf7f7() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +vec4 vertex_main() { + modf_bbf7f7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct modf_result { + float fract; + float whole; +}; + +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_bbf7f7() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +void fragment_main() { + modf_bbf7f7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct modf_result { + float fract; + float whole; +}; + +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + + +void modf_bbf7f7() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +void compute_main() { + modf_bbf7f7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.msl new file mode 100644 index 0000000000..2ef62514a5 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; + +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +void modf_bbf7f7() { + float arg_0 = 1.0f; + modf_result res = tint_modf(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + modf_bbf7f7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + modf_bbf7f7(); + return; +} + +kernel void compute_main() { + modf_bbf7f7(); + return; +} + diff --git a/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..97fe5104d6 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %modf_bbf7f7 "modf_bbf7f7" + OpName %arg_0 "arg_0" + OpName %__modf_result "__modf_result" + OpMemberName %__modf_result 0 "fract" + OpMemberName %__modf_result 1 "whole" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpMemberDecorate %__modf_result 0 Offset 0 + OpMemberDecorate %__modf_result 1 Offset 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float +%__modf_result = OpTypeStruct %float %float +%_ptr_Function___modf_result = OpTypePointer Function %__modf_result + %22 = OpConstantNull %__modf_result + %23 = OpTypeFunction %v4float +%modf_bbf7f7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function___modf_result Function %22 + OpStore %arg_0 %float_1 + %19 = OpLoad %float %arg_0 + %16 = OpExtInst %__modf_result %18 ModfStruct %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %modf_bbf7f7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %modf_bbf7f7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %modf_bbf7f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ebdc4bb05 --- /dev/null +++ b/test/tint/builtins/gen/var/modf/bbf7f7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn modf_bbf7f7() { + var arg_0 = 1.0f; + var res = modf(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + modf_bbf7f7(); + return vec4(); +} + +@fragment +fn fragment_main() { + modf_bbf7f7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + modf_bbf7f7(); +} diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl new file mode 100644 index 0000000000..9d4465ddfe --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<3, f16>) -> vec<3, f16> +fn normalize_39d5ec() { + var arg_0 = vec3(f16()); + var res: vec3 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_39d5ec(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_39d5ec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_39d5ec(); +} diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..27279be055 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void normalize_39d5ec() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_39d5ec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_39d5ec(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0515aa9636 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void normalize_39d5ec() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_39d5ec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_39d5ec(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026F4DE48920(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026F4DE48920(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.glsl new file mode 100644 index 0000000000..cac08b0b15 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_39d5ec() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_39d5ec(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_39d5ec() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = normalize(arg_0); +} + +void fragment_main() { + normalize_39d5ec(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_39d5ec() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = normalize(arg_0); +} + +void compute_main() { + normalize_39d5ec(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.msl new file mode 100644 index 0000000000..b39c9b3b05 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_39d5ec() { + half3 arg_0 = half3(0.0h); + half3 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_39d5ec(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_39d5ec(); + return; +} + +kernel void compute_main() { + normalize_39d5ec(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.spvasm new file mode 100644 index 0000000000..7ee6ac0a7d --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_39d5ec "normalize_39d5ec" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_39d5ec = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Normalize %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %normalize_39d5ec + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %normalize_39d5ec + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %normalize_39d5ec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.wgsl new file mode 100644 index 0000000000..a1dddf10b0 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/39d5ec.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn normalize_39d5ec() { + var arg_0 = vec3(f16()); + var res : vec3 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_39d5ec(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_39d5ec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_39d5ec(); +} diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl new file mode 100644 index 0000000000..c28991811d --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn normalize(vec<3, f32>) -> vec<3, f32> +fn normalize_64d8c0() { + var arg_0 = vec3(1.f); + var res: vec3 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_64d8c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_64d8c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_64d8c0(); +} diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1d5044b9d3 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void normalize_64d8c0() { + float3 arg_0 = (1.0f).xxx; + float3 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_64d8c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_64d8c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_64d8c0(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1d5044b9d3 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void normalize_64d8c0() { + float3 arg_0 = (1.0f).xxx; + float3 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_64d8c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_64d8c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_64d8c0(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl new file mode 100644 index 0000000000..21405459d9 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void normalize_64d8c0() { + vec3 arg_0 = vec3(1.0f); + vec3 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_64d8c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void normalize_64d8c0() { + vec3 arg_0 = vec3(1.0f); + vec3 res = normalize(arg_0); +} + +void fragment_main() { + normalize_64d8c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void normalize_64d8c0() { + vec3 arg_0 = vec3(1.0f); + vec3 res = normalize(arg_0); +} + +void compute_main() { + normalize_64d8c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl new file mode 100644 index 0000000000..a1177031ba --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_64d8c0() { + float3 arg_0 = float3(1.0f); + float3 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_64d8c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_64d8c0(); + return; +} + +kernel void compute_main() { + normalize_64d8c0(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..d031f1e984 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_64d8c0 "normalize_64d8c0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%normalize_64d8c0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Normalize %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %normalize_64d8c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %normalize_64d8c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %normalize_64d8c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..a014236bbb --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn normalize_64d8c0() { + var arg_0 = vec3(1.0f); + var res : vec3 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_64d8c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_64d8c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_64d8c0(); +} diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl new file mode 100644 index 0000000000..46bb41b667 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<2, f16>) -> vec<2, f16> +fn normalize_7990f3() { + var arg_0 = vec2(f16()); + var res: vec2 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_7990f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_7990f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_7990f3(); +} diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5609e8b8e1 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void normalize_7990f3() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_7990f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_7990f3(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ef29d8400a --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void normalize_7990f3() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_7990f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_7990f3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000234A30F1570(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000234A30F1570(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.glsl new file mode 100644 index 0000000000..f5baf36837 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_7990f3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_7990f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_7990f3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = normalize(arg_0); +} + +void fragment_main() { + normalize_7990f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_7990f3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = normalize(arg_0); +} + +void compute_main() { + normalize_7990f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.msl new file mode 100644 index 0000000000..92d318abe5 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_7990f3() { + half2 arg_0 = half2(0.0h); + half2 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_7990f3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_7990f3(); + return; +} + +kernel void compute_main() { + normalize_7990f3(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..1df719a285 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_7990f3 "normalize_7990f3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_7990f3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Normalize %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %normalize_7990f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %normalize_7990f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %normalize_7990f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..3629918c89 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/7990f3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn normalize_7990f3() { + var arg_0 = vec2(f16()); + var res : vec2 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_7990f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_7990f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_7990f3(); +} diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl new file mode 100644 index 0000000000..f2c2f38c8c --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn normalize(vec<4, f32>) -> vec<4, f32> +fn normalize_9a0aab() { + var arg_0 = vec4(1.f); + var res: vec4 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_9a0aab(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_9a0aab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_9a0aab(); +} diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f5898efe1f --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void normalize_9a0aab() { + float4 arg_0 = (1.0f).xxxx; + float4 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_9a0aab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_9a0aab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_9a0aab(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f5898efe1f --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void normalize_9a0aab() { + float4 arg_0 = (1.0f).xxxx; + float4 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_9a0aab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_9a0aab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_9a0aab(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl new file mode 100644 index 0000000000..7ed5366702 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void normalize_9a0aab() { + vec4 arg_0 = vec4(1.0f); + vec4 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_9a0aab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void normalize_9a0aab() { + vec4 arg_0 = vec4(1.0f); + vec4 res = normalize(arg_0); +} + +void fragment_main() { + normalize_9a0aab(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void normalize_9a0aab() { + vec4 arg_0 = vec4(1.0f); + vec4 res = normalize(arg_0); +} + +void compute_main() { + normalize_9a0aab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl new file mode 100644 index 0000000000..e808882638 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_9a0aab() { + float4 arg_0 = float4(1.0f); + float4 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_9a0aab(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_9a0aab(); + return; +} + +kernel void compute_main() { + normalize_9a0aab(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm new file mode 100644 index 0000000000..1e8195c468 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_9a0aab "normalize_9a0aab" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%normalize_9a0aab = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Normalize %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %normalize_9a0aab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %normalize_9a0aab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %normalize_9a0aab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ac1d49c1f --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn normalize_9a0aab() { + var arg_0 = vec4(1.0f); + var res : vec4 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_9a0aab(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_9a0aab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_9a0aab(); +} diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl new file mode 100644 index 0000000000..ef4811dbed --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn normalize(vec<4, f16>) -> vec<4, f16> +fn normalize_b8cb8d() { + var arg_0 = vec4(f16()); + var res: vec4 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_b8cb8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_b8cb8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_b8cb8d(); +} diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7a7baeadf1 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void normalize_b8cb8d() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_b8cb8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_b8cb8d(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04068803dd --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void normalize_b8cb8d() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_b8cb8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_b8cb8d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021732CD97D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021732CD97D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.glsl new file mode 100644 index 0000000000..d578fb1db0 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_b8cb8d() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_b8cb8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void normalize_b8cb8d() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = normalize(arg_0); +} + +void fragment_main() { + normalize_b8cb8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void normalize_b8cb8d() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = normalize(arg_0); +} + +void compute_main() { + normalize_b8cb8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.msl new file mode 100644 index 0000000000..0534833030 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_b8cb8d() { + half4 arg_0 = half4(0.0h); + half4 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_b8cb8d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_b8cb8d(); + return; +} + +kernel void compute_main() { + normalize_b8cb8d(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.spvasm new file mode 100644 index 0000000000..f904ec0486 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_b8cb8d "normalize_b8cb8d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%normalize_b8cb8d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Normalize %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %normalize_b8cb8d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %normalize_b8cb8d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %normalize_b8cb8d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4793ae29c --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/b8cb8d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn normalize_b8cb8d() { + var arg_0 = vec4(f16()); + var res : vec4 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_b8cb8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_b8cb8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_b8cb8d(); +} diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl new file mode 100644 index 0000000000..f98ac1b7d0 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn normalize(vec<2, f32>) -> vec<2, f32> +fn normalize_fc2ef1() { + var arg_0 = vec2(1.f); + var res: vec2 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_fc2ef1(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_fc2ef1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_fc2ef1(); +} diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9d24fee03b --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void normalize_fc2ef1() { + float2 arg_0 = (1.0f).xx; + float2 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_fc2ef1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_fc2ef1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_fc2ef1(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9d24fee03b --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void normalize_fc2ef1() { + float2 arg_0 = (1.0f).xx; + float2 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + normalize_fc2ef1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + normalize_fc2ef1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + normalize_fc2ef1(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl new file mode 100644 index 0000000000..c9ff24a79a --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void normalize_fc2ef1() { + vec2 arg_0 = vec2(1.0f); + vec2 res = normalize(arg_0); +} + +vec4 vertex_main() { + normalize_fc2ef1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void normalize_fc2ef1() { + vec2 arg_0 = vec2(1.0f); + vec2 res = normalize(arg_0); +} + +void fragment_main() { + normalize_fc2ef1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void normalize_fc2ef1() { + vec2 arg_0 = vec2(1.0f); + vec2 res = normalize(arg_0); +} + +void compute_main() { + normalize_fc2ef1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl new file mode 100644 index 0000000000..6350353dda --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void normalize_fc2ef1() { + float2 arg_0 = float2(1.0f); + float2 res = normalize(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + normalize_fc2ef1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + normalize_fc2ef1(); + return; +} + +kernel void compute_main() { + normalize_fc2ef1(); + return; +} + diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm new file mode 100644 index 0000000000..3294d0268d --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %normalize_fc2ef1 "normalize_fc2ef1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%normalize_fc2ef1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Normalize %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %normalize_fc2ef1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %normalize_fc2ef1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %normalize_fc2ef1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl new file mode 100644 index 0000000000..9d670b7629 --- /dev/null +++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn normalize_fc2ef1() { + var arg_0 = vec2(1.0f); + var res : vec2 = normalize(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + normalize_fc2ef1(); + return vec4(); +} + +@fragment +fn fragment_main() { + normalize_fc2ef1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + normalize_fc2ef1(); +} diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl new file mode 100644 index 0000000000..752a7bd9b2 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack2x16float(vec2) -> u32 +fn pack2x16float_0e97b3() { + var arg_0 = vec2(); + var res: u32 = pack2x16float(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16float_0e97b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16float_0e97b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16float_0e97b3(); +} diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..649e6f1da2 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack2x16float(float2 param_0) { + uint2 i = f32tof16(param_0); + return i.x | (i.y << 16); +} + +void pack2x16float_0e97b3() { + float2 arg_0 = (0.0f).xx; + uint res = tint_pack2x16float(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16float_0e97b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16float_0e97b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16float_0e97b3(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..649e6f1da2 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack2x16float(float2 param_0) { + uint2 i = f32tof16(param_0); + return i.x | (i.y << 16); +} + +void pack2x16float_0e97b3() { + float2 arg_0 = (0.0f).xx; + uint res = tint_pack2x16float(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16float_0e97b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16float_0e97b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16float_0e97b3(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl new file mode 100644 index 0000000000..ccefb26ee8 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack2x16float_0e97b3() { + vec2 arg_0 = vec2(0.0f); + uint res = packHalf2x16(arg_0); +} + +vec4 vertex_main() { + pack2x16float_0e97b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack2x16float_0e97b3() { + vec2 arg_0 = vec2(0.0f); + uint res = packHalf2x16(arg_0); +} + +void fragment_main() { + pack2x16float_0e97b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack2x16float_0e97b3() { + vec2 arg_0 = vec2(0.0f); + uint res = packHalf2x16(arg_0); +} + +void compute_main() { + pack2x16float_0e97b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl new file mode 100644 index 0000000000..d72649aad6 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack2x16float_0e97b3() { + float2 arg_0 = float2(0.0f); + uint res = as_type(half2(arg_0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack2x16float_0e97b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack2x16float_0e97b3(); + return; +} + +kernel void compute_main() { + pack2x16float_0e97b3(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..7855476f93 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack2x16float_0e97b3 "pack2x16float_0e97b3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %23 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack2x16float_0e97b3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_uint Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %v2float %arg_0 + %17 = OpExtInst %uint %19 PackHalf2x16 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pack2x16float_0e97b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pack2x16float_0e97b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pack2x16float_0e97b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..27bed46737 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack2x16float_0e97b3() { + var arg_0 = vec2(); + var res : u32 = pack2x16float(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16float_0e97b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16float_0e97b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16float_0e97b3(); +} diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl new file mode 100644 index 0000000000..d5f475e624 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack2x16snorm(vec2) -> u32 +fn pack2x16snorm_6c169b() { + var arg_0 = vec2(); + var res: u32 = pack2x16snorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16snorm_6c169b(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16snorm_6c169b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16snorm_6c169b(); +} diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c9a6e51087 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack2x16snorm(float2 param_0) { + int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff; + return asuint(i.x | i.y << 16); +} + +void pack2x16snorm_6c169b() { + float2 arg_0 = (0.0f).xx; + uint res = tint_pack2x16snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16snorm_6c169b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16snorm_6c169b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16snorm_6c169b(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9a6e51087 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack2x16snorm(float2 param_0) { + int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff; + return asuint(i.x | i.y << 16); +} + +void pack2x16snorm_6c169b() { + float2 arg_0 = (0.0f).xx; + uint res = tint_pack2x16snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16snorm_6c169b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16snorm_6c169b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16snorm_6c169b(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl new file mode 100644 index 0000000000..06e70da875 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack2x16snorm_6c169b() { + vec2 arg_0 = vec2(0.0f); + uint res = packSnorm2x16(arg_0); +} + +vec4 vertex_main() { + pack2x16snorm_6c169b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack2x16snorm_6c169b() { + vec2 arg_0 = vec2(0.0f); + uint res = packSnorm2x16(arg_0); +} + +void fragment_main() { + pack2x16snorm_6c169b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack2x16snorm_6c169b() { + vec2 arg_0 = vec2(0.0f); + uint res = packSnorm2x16(arg_0); +} + +void compute_main() { + pack2x16snorm_6c169b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl new file mode 100644 index 0000000000..64c72cf753 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack2x16snorm_6c169b() { + float2 arg_0 = float2(0.0f); + uint res = pack_float_to_snorm2x16(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack2x16snorm_6c169b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack2x16snorm_6c169b(); + return; +} + +kernel void compute_main() { + pack2x16snorm_6c169b(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm new file mode 100644 index 0000000000..daad82d957 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack2x16snorm_6c169b "pack2x16snorm_6c169b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %23 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack2x16snorm_6c169b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_uint Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %v2float %arg_0 + %17 = OpExtInst %uint %19 PackSnorm2x16 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pack2x16snorm_6c169b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pack2x16snorm_6c169b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pack2x16snorm_6c169b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl new file mode 100644 index 0000000000..406794bdd4 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack2x16snorm_6c169b() { + var arg_0 = vec2(); + var res : u32 = pack2x16snorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16snorm_6c169b(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16snorm_6c169b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16snorm_6c169b(); +} diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl new file mode 100644 index 0000000000..521e446dae --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack2x16unorm(vec2) -> u32 +fn pack2x16unorm_0f08e4() { + var arg_0 = vec2(); + var res: u32 = pack2x16unorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16unorm_0f08e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16unorm_0f08e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16unorm_0f08e4(); +} diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3f37f6abc9 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack2x16unorm(float2 param_0) { + uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0)); + return (i.x | i.y << 16); +} + +void pack2x16unorm_0f08e4() { + float2 arg_0 = (0.0f).xx; + uint res = tint_pack2x16unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16unorm_0f08e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16unorm_0f08e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16unorm_0f08e4(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3f37f6abc9 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack2x16unorm(float2 param_0) { + uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0)); + return (i.x | i.y << 16); +} + +void pack2x16unorm_0f08e4() { + float2 arg_0 = (0.0f).xx; + uint res = tint_pack2x16unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack2x16unorm_0f08e4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack2x16unorm_0f08e4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack2x16unorm_0f08e4(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl new file mode 100644 index 0000000000..374bacf713 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack2x16unorm_0f08e4() { + vec2 arg_0 = vec2(0.0f); + uint res = packUnorm2x16(arg_0); +} + +vec4 vertex_main() { + pack2x16unorm_0f08e4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack2x16unorm_0f08e4() { + vec2 arg_0 = vec2(0.0f); + uint res = packUnorm2x16(arg_0); +} + +void fragment_main() { + pack2x16unorm_0f08e4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack2x16unorm_0f08e4() { + vec2 arg_0 = vec2(0.0f); + uint res = packUnorm2x16(arg_0); +} + +void compute_main() { + pack2x16unorm_0f08e4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl new file mode 100644 index 0000000000..5433a6d655 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack2x16unorm_0f08e4() { + float2 arg_0 = float2(0.0f); + uint res = pack_float_to_unorm2x16(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack2x16unorm_0f08e4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack2x16unorm_0f08e4(); + return; +} + +kernel void compute_main() { + pack2x16unorm_0f08e4(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm new file mode 100644 index 0000000000..6fd23d6d00 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack2x16unorm_0f08e4 "pack2x16unorm_0f08e4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %14 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %23 = OpConstantNull %uint + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack2x16unorm_0f08e4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_uint Function %23 + OpStore %arg_0 %14 + %20 = OpLoad %v2float %arg_0 + %17 = OpExtInst %uint %19 PackUnorm2x16 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pack2x16unorm_0f08e4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pack2x16unorm_0f08e4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pack2x16unorm_0f08e4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl new file mode 100644 index 0000000000..db3a3317a5 --- /dev/null +++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack2x16unorm_0f08e4() { + var arg_0 = vec2(); + var res : u32 = pack2x16unorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack2x16unorm_0f08e4(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack2x16unorm_0f08e4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack2x16unorm_0f08e4(); +} diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl new file mode 100644 index 0000000000..378a21fe44 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack4x8snorm(vec4) -> u32 +fn pack4x8snorm_4d22e7() { + var arg_0 = vec4(); + var res: u32 = pack4x8snorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack4x8snorm_4d22e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack4x8snorm_4d22e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack4x8snorm_4d22e7(); +} diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bdf414bfc2 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack4x8snorm(float4 param_0) { + int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff; + return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8snorm_4d22e7() { + float4 arg_0 = (0.0f).xxxx; + uint res = tint_pack4x8snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8snorm_4d22e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8snorm_4d22e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8snorm_4d22e7(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bdf414bfc2 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack4x8snorm(float4 param_0) { + int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff; + return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8snorm_4d22e7() { + float4 arg_0 = (0.0f).xxxx; + uint res = tint_pack4x8snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8snorm_4d22e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8snorm_4d22e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8snorm_4d22e7(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl new file mode 100644 index 0000000000..d7f64834eb --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack4x8snorm_4d22e7() { + vec4 arg_0 = vec4(0.0f); + uint res = packSnorm4x8(arg_0); +} + +vec4 vertex_main() { + pack4x8snorm_4d22e7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack4x8snorm_4d22e7() { + vec4 arg_0 = vec4(0.0f); + uint res = packSnorm4x8(arg_0); +} + +void fragment_main() { + pack4x8snorm_4d22e7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack4x8snorm_4d22e7() { + vec4 arg_0 = vec4(0.0f); + uint res = packSnorm4x8(arg_0); +} + +void compute_main() { + pack4x8snorm_4d22e7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl new file mode 100644 index 0000000000..5463f994bf --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack4x8snorm_4d22e7() { + float4 arg_0 = float4(0.0f); + uint res = pack_float_to_snorm4x8(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack4x8snorm_4d22e7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack4x8snorm_4d22e7(); + return; +} + +kernel void compute_main() { + pack4x8snorm_4d22e7(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm new file mode 100644 index 0000000000..74247cd747 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack4x8snorm_4d22e7 "pack4x8snorm_4d22e7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack4x8snorm_4d22e7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_uint Function %21 + OpStore %arg_0 %5 + %18 = OpLoad %v4float %arg_0 + %15 = OpExtInst %uint %17 PackSnorm4x8 %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %pack4x8snorm_4d22e7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %pack4x8snorm_4d22e7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %pack4x8snorm_4d22e7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl new file mode 100644 index 0000000000..b83a2e3dc0 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack4x8snorm_4d22e7() { + var arg_0 = vec4(); + var res : u32 = pack4x8snorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack4x8snorm_4d22e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack4x8snorm_4d22e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack4x8snorm_4d22e7(); +} diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl new file mode 100644 index 0000000000..e4f84c63e7 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pack4x8unorm(vec4) -> u32 +fn pack4x8unorm_95c456() { + var arg_0 = vec4(); + var res: u32 = pack4x8unorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack4x8unorm_95c456(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack4x8unorm_95c456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack4x8unorm_95c456(); +} diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..80d63c98d0 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack4x8unorm(float4 param_0) { + uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); + return (i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8unorm_95c456() { + float4 arg_0 = (0.0f).xxxx; + uint res = tint_pack4x8unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8unorm_95c456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8unorm_95c456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8unorm_95c456(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80d63c98d0 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +uint tint_pack4x8unorm(float4 param_0) { + uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); + return (i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +void pack4x8unorm_95c456() { + float4 arg_0 = (0.0f).xxxx; + uint res = tint_pack4x8unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pack4x8unorm_95c456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pack4x8unorm_95c456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pack4x8unorm_95c456(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl new file mode 100644 index 0000000000..8e9eb906d0 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void pack4x8unorm_95c456() { + vec4 arg_0 = vec4(0.0f); + uint res = packUnorm4x8(arg_0); +} + +vec4 vertex_main() { + pack4x8unorm_95c456(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pack4x8unorm_95c456() { + vec4 arg_0 = vec4(0.0f); + uint res = packUnorm4x8(arg_0); +} + +void fragment_main() { + pack4x8unorm_95c456(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pack4x8unorm_95c456() { + vec4 arg_0 = vec4(0.0f); + uint res = packUnorm4x8(arg_0); +} + +void compute_main() { + pack4x8unorm_95c456(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl new file mode 100644 index 0000000000..faab6f2318 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void pack4x8unorm_95c456() { + float4 arg_0 = float4(0.0f); + uint res = pack_float_to_unorm4x8(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pack4x8unorm_95c456(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pack4x8unorm_95c456(); + return; +} + +kernel void compute_main() { + pack4x8unorm_95c456(); + return; +} + diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc7d9ea508 --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pack4x8unorm_95c456 "pack4x8unorm_95c456" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%pack4x8unorm_95c456 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_uint Function %21 + OpStore %arg_0 %5 + %18 = OpLoad %v4float %arg_0 + %15 = OpExtInst %uint %17 PackUnorm4x8 %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %pack4x8unorm_95c456 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %pack4x8unorm_95c456 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %pack4x8unorm_95c456 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl new file mode 100644 index 0000000000..195c952b3b --- /dev/null +++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn pack4x8unorm_95c456() { + var arg_0 = vec4(); + var res : u32 = pack4x8unorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pack4x8unorm_95c456(); + return vec4(); +} + +@fragment +fn fragment_main() { + pack4x8unorm_95c456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pack4x8unorm_95c456(); +} diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl b/test/tint/builtins/gen/var/pow/04a908.wgsl new file mode 100644 index 0000000000..a5673c637e --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn pow_04a908() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var res: vec4 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_04a908(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_04a908(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_04a908(); +} diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1627d183a6 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_04a908() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_04a908(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_04a908(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_04a908(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1627d183a6 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void pow_04a908() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_04a908(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_04a908(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_04a908(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl new file mode 100644 index 0000000000..73fb0f1c84 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void pow_04a908() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_04a908(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_04a908() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_04a908(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_04a908() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_04a908(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl new file mode 100644 index 0000000000..efc8eebe0d --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_04a908() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_04a908(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_04a908(); + return; +} + +kernel void compute_main() { + pow_04a908(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm new file mode 100644 index 0000000000..1f127be14e --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_04a908 "pow_04a908" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %pow_04a908 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v4float %arg_0 + %21 = OpLoad %v4float %arg_1 + %18 = OpExtInst %v4float %19 Pow %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %pow_04a908 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %pow_04a908 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %pow_04a908 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl new file mode 100644 index 0000000000..4140a311ba --- /dev/null +++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn pow_04a908() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var res : vec4 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_04a908(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_04a908(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_04a908(); +} diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl b/test/tint/builtins/gen/var/pow/46e029.wgsl new file mode 100644 index 0000000000..ac2ab7fe93 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(f32, f32) -> f32 +fn pow_46e029() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var res: f32 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_46e029(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_46e029(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_46e029(); +} diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..82b73ac2f3 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_46e029(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_46e029(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_46e029(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..82b73ac2f3 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_46e029(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_46e029(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_46e029(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl new file mode 100644 index 0000000000..ba9d17ef10 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_46e029(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_46e029(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_46e029(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl new file mode 100644 index 0000000000..2cac6c7015 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_46e029() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_46e029(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_46e029(); + return; +} + +kernel void compute_main() { + pow_46e029(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbf125ff6b --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_46e029 "pow_46e029" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float + %pow_46e029 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 Pow %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %pow_46e029 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %pow_46e029 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_46e029 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl new file mode 100644 index 0000000000..78398b877a --- /dev/null +++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn pow_46e029() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var res : f32 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_46e029(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_46e029(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_46e029(); +} diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl new file mode 100644 index 0000000000..35082e9c44 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn pow_4a46c9() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var res: vec3 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4a46c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4a46c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4a46c9(); +} diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bcc8f22ea8 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_4a46c9() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4a46c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4a46c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4a46c9(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bcc8f22ea8 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void pow_4a46c9() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4a46c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4a46c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4a46c9(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl new file mode 100644 index 0000000000..b01d4b07c7 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void pow_4a46c9() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_4a46c9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_4a46c9() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_4a46c9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_4a46c9() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_4a46c9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl new file mode 100644 index 0000000000..91d2b2d806 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_4a46c9() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_4a46c9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_4a46c9(); + return; +} + +kernel void compute_main() { + pow_4a46c9(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm new file mode 100644 index 0000000000..d5f5ebf0e4 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_4a46c9 "pow_4a46c9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %25 = OpTypeFunction %v4float + %pow_4a46c9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v3float %arg_0 + %23 = OpLoad %v3float %arg_1 + %20 = OpExtInst %v3float %21 Pow %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %pow_4a46c9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_4a46c9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pow_4a46c9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4ec757756 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn pow_4a46c9() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var res : vec3 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4a46c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4a46c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4a46c9(); +} diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl new file mode 100644 index 0000000000..86f18ee4f4 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn pow_4f33b2() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4f33b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4f33b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4f33b2(); +} diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..227638c329 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_4f33b2() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4f33b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4f33b2(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11cb081673 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void pow_4f33b2() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_4f33b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_4f33b2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8CA6D2360(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8CA6D2360(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001C8CA6D2360(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.glsl new file mode 100644 index 0000000000..5986ecac24 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_4f33b2() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_4f33b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_4f33b2() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_4f33b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_4f33b2() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_4f33b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.msl new file mode 100644 index 0000000000..c9055df449 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_4f33b2() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_4f33b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_4f33b2(); + return; +} + +kernel void compute_main() { + pow_4f33b2(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..ab794c7609 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_4f33b2 "pow_4f33b2" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_4f33b2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 Pow %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pow_4f33b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_4f33b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pow_4f33b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ae3aa1407 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/4f33b2.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn pow_4f33b2() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_4f33b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_4f33b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_4f33b2(); +} diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl new file mode 100644 index 0000000000..8ce27eb070 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(f16, f16) -> f16 +fn pow_ce9ef5() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_ce9ef5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_ce9ef5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_ce9ef5(); +} diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..648dc41a6a --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_ce9ef5() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_ce9ef5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_ce9ef5(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a893034d27 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void pow_ce9ef5() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_ce9ef5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_ce9ef5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001987C544730(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001987C544730(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.glsl new file mode 100644 index 0000000000..204e570aed --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_ce9ef5() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_ce9ef5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_ce9ef5() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_ce9ef5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_ce9ef5() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_ce9ef5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.msl new file mode 100644 index 0000000000..53588ac847 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_ce9ef5() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_ce9ef5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_ce9ef5(); + return; +} + +kernel void compute_main() { + pow_ce9ef5(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.spvasm new file mode 100644 index 0000000000..740fe21306 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_ce9ef5 "pow_ce9ef5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_ce9ef5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 Pow %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %pow_ce9ef5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %pow_ce9ef5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %pow_ce9ef5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.wgsl new file mode 100644 index 0000000000..da1a0f3c8c --- /dev/null +++ b/test/tint/builtins/gen/var/pow/ce9ef5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn pow_ce9ef5() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_ce9ef5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_ce9ef5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_ce9ef5(); +} diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl new file mode 100644 index 0000000000..8d8a8f0816 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn pow(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn pow_e60ea5() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var res: vec2 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_e60ea5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_e60ea5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_e60ea5(); +} diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3b7f18fe3c --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_e60ea5() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_e60ea5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_e60ea5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_e60ea5(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3b7f18fe3c --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void pow_e60ea5() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_e60ea5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_e60ea5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_e60ea5(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl new file mode 100644 index 0000000000..0ad8d4e513 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void pow_e60ea5() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_e60ea5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void pow_e60ea5() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_e60ea5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void pow_e60ea5() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_e60ea5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl new file mode 100644 index 0000000000..24f95d3011 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_e60ea5() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_e60ea5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_e60ea5(); + return; +} + +kernel void compute_main() { + pow_e60ea5(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm new file mode 100644 index 0000000000..a31e014a53 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_e60ea5 "pow_e60ea5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float + %pow_e60ea5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v2float %arg_0 + %23 = OpLoad %v2float %arg_1 + %20 = OpExtInst %v2float %21 Pow %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %pow_e60ea5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_e60ea5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pow_e60ea5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c7df27b58 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn pow_e60ea5() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var res : vec2 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_e60ea5(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_e60ea5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_e60ea5(); +} diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl new file mode 100644 index 0000000000..cdaa364b20 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn pow_f37b25() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_f37b25(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_f37b25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_f37b25(); +} diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1656a090d9 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_f37b25() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_f37b25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_f37b25(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..49f883ce2b --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void pow_f37b25() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_f37b25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_f37b25(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018483F919C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018483F919C0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018483F919C0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.glsl new file mode 100644 index 0000000000..c6667068da --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_f37b25() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_f37b25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_f37b25() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_f37b25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_f37b25() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_f37b25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.msl new file mode 100644 index 0000000000..d608b91740 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_f37b25() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_f37b25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_f37b25(); + return; +} + +kernel void compute_main() { + pow_f37b25(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.spvasm new file mode 100644 index 0000000000..34746c576c --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_f37b25 "pow_f37b25" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_f37b25 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 Pow %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pow_f37b25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_f37b25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pow_f37b25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c2e6fc210 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/f37b25.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn pow_f37b25() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_f37b25(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_f37b25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_f37b25(); +} diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl new file mode 100644 index 0000000000..2a6ad1191c --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn pow(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn pow_fa5429() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_fa5429(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_fa5429(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_fa5429(); +} diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fd9cab2337 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void pow_fa5429() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_fa5429(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_fa5429(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9bad326636 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void pow_fa5429() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + pow_fa5429(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + pow_fa5429(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E461739570(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E461739570(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E461739570(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.glsl new file mode 100644 index 0000000000..c57ea280bb --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_fa5429() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = pow(arg_0, arg_1); +} + +vec4 vertex_main() { + pow_fa5429(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void pow_fa5429() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = pow(arg_0, arg_1); +} + +void fragment_main() { + pow_fa5429(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void pow_fa5429() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = pow(arg_0, arg_1); +} + +void compute_main() { + pow_fa5429(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.msl new file mode 100644 index 0000000000..34042bc3a3 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void pow_fa5429() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = pow(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + pow_fa5429(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + pow_fa5429(); + return; +} + +kernel void compute_main() { + pow_fa5429(); + return; +} + diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.spvasm new file mode 100644 index 0000000000..88b8df2dc7 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %pow_fa5429 "pow_fa5429" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %pow_fa5429 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Pow %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %pow_fa5429 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %pow_fa5429 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %pow_fa5429 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.wgsl new file mode 100644 index 0000000000..41114c9302 --- /dev/null +++ b/test/tint/builtins/gen/var/pow/fa5429.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn pow_fa5429() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = pow(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + pow_fa5429(); + return vec4(); +} + +@fragment +fn fragment_main() { + pow_fa5429(); +} + +@compute @workgroup_size(1) +fn compute_main() { + pow_fa5429(); +} diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl new file mode 100644 index 0000000000..02b0f07b5e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(vec<4, f32>) -> vec<4, f32> +fn radians_09b7fc() { + var arg_0 = vec4(1.f); + var res: vec4 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_09b7fc(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_09b7fc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_09b7fc(); +} diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53dad5bdcb --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_radians(float4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_09b7fc() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_09b7fc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_09b7fc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_09b7fc(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..53dad5bdcb --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float4 tint_radians(float4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_09b7fc() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_09b7fc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_09b7fc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_09b7fc(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl new file mode 100644 index 0000000000..1ff16ba43d --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec4 tint_radians(vec4 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_09b7fc() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_09b7fc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec4 tint_radians(vec4 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_09b7fc() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_09b7fc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec4 tint_radians(vec4 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_09b7fc() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tint_radians(arg_0); +} + +void compute_main() { + radians_09b7fc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl new file mode 100644 index 0000000000..eabe094976 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float4 tint_radians(float4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_09b7fc() { + float4 arg_0 = float4(1.0f); + float4 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_09b7fc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_09b7fc(); + return; +} + +kernel void compute_main() { + radians_09b7fc(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d4dee7895 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_09b7fc "radians_09b7fc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%radians_09b7fc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Radians %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %radians_09b7fc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %radians_09b7fc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %radians_09b7fc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl new file mode 100644 index 0000000000..7fc38b5b1c --- /dev/null +++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn radians_09b7fc() { + var arg_0 = vec4(1.0f); + var res : vec4 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_09b7fc(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_09b7fc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_09b7fc(); +} diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl new file mode 100644 index 0000000000..5bf9902339 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(f16) -> f16 +fn radians_208fd9() { + var arg_0 = f16(); + var res: f16 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_208fd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_208fd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_208fd9(); +} diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..627ac2c15c --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_208fd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_208fd9(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d26e91ecaa --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_208fd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_208fd9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025E7A643540(1,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.glsl new file mode 100644 index 0000000000..d22a648619 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_208fd9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_radians(arg_0); +} + +void fragment_main() { + radians_208fd9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_radians(float16_t param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_208fd9() { + float16_t arg_0 = 0.0hf; + float16_t res = tint_radians(arg_0); +} + +void compute_main() { + radians_208fd9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.msl new file mode 100644 index 0000000000..936220398c --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half tint_radians(half param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_208fd9() { + half arg_0 = 0.0h; + half res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_208fd9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_208fd9(); + return; +} + +kernel void compute_main() { + radians_208fd9(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.spvasm new file mode 100644 index 0000000000..40920c5a43 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_208fd9 "radians_208fd9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_208fd9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Radians %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %radians_208fd9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %radians_208fd9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %radians_208fd9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c78c61300 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/208fd9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn radians_208fd9() { + var arg_0 = f16(); + var res : f16 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_208fd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_208fd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_208fd9(); +} diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl new file mode 100644 index 0000000000..0cfd5005cf --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<4, f16>) -> vec<4, f16> +fn radians_44f20b() { + var arg_0 = vec4(f16()); + var res: vec4 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_44f20b(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_44f20b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_44f20b(); +} diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..81c50d08b6 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_44f20b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_44f20b(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e58dd03ea3 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_44f20b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_44f20b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F25F161620(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.glsl new file mode 100644 index 0000000000..ef2074733e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_44f20b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_44f20b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec4 tint_radians(f16vec4 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_44f20b() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tint_radians(arg_0); +} + +void compute_main() { + radians_44f20b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.msl new file mode 100644 index 0000000000..d2f6566e91 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half4 tint_radians(half4 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_44f20b() { + half4 arg_0 = half4(0.0h); + half4 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_44f20b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_44f20b(); + return; +} + +kernel void compute_main() { + radians_44f20b(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.spvasm new file mode 100644 index 0000000000..f11ab7a5cc --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_44f20b "radians_44f20b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_44f20b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Radians %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %radians_44f20b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_44f20b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %radians_44f20b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.wgsl new file mode 100644 index 0000000000..96830d7379 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/44f20b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn radians_44f20b() { + var arg_0 = vec4(f16()); + var res : vec4 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_44f20b(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_44f20b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_44f20b(); +} diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl b/test/tint/builtins/gen/var/radians/61687a.wgsl new file mode 100644 index 0000000000..de47dbffde --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(vec<2, f32>) -> vec<2, f32> +fn radians_61687a() { + var arg_0 = vec2(1.f); + var res: vec2 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_61687a(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_61687a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_61687a(); +} diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..690db4dc32 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_radians(float2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_61687a() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_61687a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_61687a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_61687a(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..690db4dc32 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float2 tint_radians(float2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_61687a() { + float2 arg_0 = (1.0f).xx; + float2 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_61687a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_61687a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_61687a(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl new file mode 100644 index 0000000000..acf786cbaa --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec2 tint_radians(vec2 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_61687a() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_61687a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec2 tint_radians(vec2 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_61687a() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_61687a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec2 tint_radians(vec2 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_61687a() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tint_radians(arg_0); +} + +void compute_main() { + radians_61687a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl new file mode 100644 index 0000000000..995b3cf209 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float2 tint_radians(float2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_61687a() { + float2 arg_0 = float2(1.0f); + float2 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_61687a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_61687a(); + return; +} + +kernel void compute_main() { + radians_61687a(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm new file mode 100644 index 0000000000..637f457f6a --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_61687a "radians_61687a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%radians_61687a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Radians %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %radians_61687a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_61687a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %radians_61687a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl new file mode 100644 index 0000000000..9719b4e261 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn radians_61687a() { + var arg_0 = vec2(1.0f); + var res : vec2 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_61687a(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_61687a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_61687a(); +} diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl new file mode 100644 index 0000000000..387746b56e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(f32) -> f32 +fn radians_6b0ff2() { + var arg_0 = 1.f; + var res: f32 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_6b0ff2(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_6b0ff2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_6b0ff2(); +} diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e10a17da63 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_6b0ff2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_6b0ff2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_6b0ff2(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e10a17da63 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_6b0ff2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_6b0ff2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_6b0ff2(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl new file mode 100644 index 0000000000..2a2bcd244c --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_6b0ff2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +void fragment_main() { + radians_6b0ff2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +void compute_main() { + radians_6b0ff2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl new file mode 100644 index 0000000000..8a969a7539 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_6b0ff2() { + float arg_0 = 1.0f; + float res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_6b0ff2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_6b0ff2(); + return; +} + +kernel void compute_main() { + radians_6b0ff2(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm new file mode 100644 index 0000000000..ddbe63a331 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_6b0ff2 "radians_6b0ff2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%radians_6b0ff2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Radians %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %radians_6b0ff2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %radians_6b0ff2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_6b0ff2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5d9253ae1 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn radians_6b0ff2() { + var arg_0 = 1.0f; + var res : f32 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_6b0ff2(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_6b0ff2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_6b0ff2(); +} diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl new file mode 100644 index 0000000000..693ec90dd9 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<3, f16>) -> vec<3, f16> +fn radians_7ea4c7() { + var arg_0 = vec3(f16()); + var res: vec3 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_7ea4c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_7ea4c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_7ea4c7(); +} diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3367a757c5 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_7ea4c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_7ea4c7(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ca0996d2b6 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_7ea4c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_7ea4c7(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020CCED30150(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.glsl new file mode 100644 index 0000000000..8d3f103373 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_7ea4c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_7ea4c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_radians(f16vec3 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_7ea4c7() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tint_radians(arg_0); +} + +void compute_main() { + radians_7ea4c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.msl new file mode 100644 index 0000000000..a77294f448 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half3 tint_radians(half3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_7ea4c7() { + half3 arg_0 = half3(0.0h); + half3 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_7ea4c7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_7ea4c7(); + return; +} + +kernel void compute_main() { + radians_7ea4c7(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..51771841af --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_7ea4c7 "radians_7ea4c7" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_7ea4c7 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Radians %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %radians_7ea4c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_7ea4c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %radians_7ea4c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..2107e43ab2 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/7ea4c7.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn radians_7ea4c7() { + var arg_0 = vec3(f16()); + var res : vec3 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_7ea4c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_7ea4c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_7ea4c7(); +} diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl b/test/tint/builtins/gen/var/radians/f96258.wgsl new file mode 100644 index 0000000000..0fb7fce7f6 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn radians(vec<3, f32>) -> vec<3, f32> +fn radians_f96258() { + var arg_0 = vec3(1.f); + var res: vec3 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_f96258(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_f96258(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_f96258(); +} diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d67bb7d9e8 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_radians(float3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_f96258() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_f96258(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_f96258(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_f96258(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d67bb7d9e8 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +float3 tint_radians(float3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_f96258() { + float3 arg_0 = (1.0f).xxx; + float3 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_f96258(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_f96258(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_f96258(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl new file mode 100644 index 0000000000..79eb5ec366 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +vec3 tint_radians(vec3 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_f96258() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_f96258(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +vec3 tint_radians(vec3 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_f96258() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_f96258(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +vec3 tint_radians(vec3 param_0) { + return param_0 * 0.017453292519943295474f; +} + + +void radians_f96258() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tint_radians(arg_0); +} + +void compute_main() { + radians_f96258(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl new file mode 100644 index 0000000000..1eabde2976 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +float3 tint_radians(float3 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_f96258() { + float3 arg_0 = float3(1.0f); + float3 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_f96258(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_f96258(); + return; +} + +kernel void compute_main() { + radians_f96258(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0f5711f9f --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_f96258 "radians_f96258" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%radians_f96258 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Radians %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %radians_f96258 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_f96258 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %radians_f96258 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a92c60683 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn radians_f96258() { + var arg_0 = vec3(1.0f); + var res : vec3 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_f96258(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_f96258(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_f96258(); +} diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl new file mode 100644 index 0000000000..87814c0bd6 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn radians(vec<2, f16>) -> vec<2, f16> +fn radians_fbacf0() { + var arg_0 = vec2(f16()); + var res: vec2 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_fbacf0(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_fbacf0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_fbacf0(); +} diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8316865280 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_fbacf0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_fbacf0(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0ea92aba93 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +vector tint_radians(vector param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + radians_fbacf0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + radians_fbacf0(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002290DE021A0(1,8-16): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.glsl new file mode 100644 index 0000000000..f53a087d9c --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.glsl @@ -0,0 +1,70 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_radians(arg_0); +} + +vec4 vertex_main() { + radians_fbacf0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_radians(arg_0); +} + +void fragment_main() { + radians_fbacf0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec2 tint_radians(f16vec2 param_0) { + return param_0 * 0.017453292519943295474hf; +} + + +void radians_fbacf0() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tint_radians(arg_0); +} + +void compute_main() { + radians_fbacf0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.msl new file mode 100644 index 0000000000..6dcfa5b572 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +half2 tint_radians(half2 param_0) { + return param_0 * 0.017453292519943295474; +} + +void radians_fbacf0() { + half2 arg_0 = half2(0.0h); + half2 res = tint_radians(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + radians_fbacf0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + radians_fbacf0(); + return; +} + +kernel void compute_main() { + radians_fbacf0(); + return; +} + diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa11ee5a6e --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %radians_fbacf0 "radians_fbacf0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%radians_fbacf0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Radians %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %radians_fbacf0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %radians_fbacf0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %radians_fbacf0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.wgsl new file mode 100644 index 0000000000..d463eb9224 --- /dev/null +++ b/test/tint/builtins/gen/var/radians/fbacf0.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn radians_fbacf0() { + var arg_0 = vec2(f16()); + var res : vec2 = radians(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + radians_fbacf0(); + return vec4(); +} + +@fragment +fn fragment_main() { + radians_fbacf0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + radians_fbacf0(); +} diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl new file mode 100644 index 0000000000..bd2475d4a5 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reflect(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn reflect_05357e() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var res: vec4 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_05357e(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_05357e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_05357e(); +} diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0cda7e5d85 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void reflect_05357e() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_05357e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_05357e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_05357e(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0cda7e5d85 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void reflect_05357e() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_05357e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_05357e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_05357e(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl new file mode 100644 index 0000000000..adf9b8f1b6 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void reflect_05357e() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_05357e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reflect_05357e() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_05357e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reflect_05357e() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_05357e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl new file mode 100644 index 0000000000..9742733591 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_05357e() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_05357e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_05357e(); + return; +} + +kernel void compute_main() { + reflect_05357e(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm new file mode 100644 index 0000000000..06d192d2ec --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_05357e "reflect_05357e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float +%reflect_05357e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v4float %arg_0 + %21 = OpLoad %v4float %arg_1 + %18 = OpExtInst %v4float %19 Reflect %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %reflect_05357e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %reflect_05357e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %reflect_05357e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl new file mode 100644 index 0000000000..c453132fd5 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn reflect_05357e() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var res : vec4 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_05357e(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_05357e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_05357e(); +} diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl new file mode 100644 index 0000000000..6fd29f5a4e --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn reflect_310de5() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_310de5(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_310de5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_310de5(); +} diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..42cc8e6fb4 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void reflect_310de5() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_310de5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_310de5(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..30317a441e --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void reflect_310de5() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_310de5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_310de5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A447B2CCB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A447B2CCB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A447B2CCB0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.glsl new file mode 100644 index 0000000000..1b9cab0bfa --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_310de5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_310de5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_310de5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_310de5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_310de5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_310de5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.msl new file mode 100644 index 0000000000..bc73148543 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_310de5() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_310de5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_310de5(); + return; +} + +kernel void compute_main() { + reflect_310de5(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.spvasm new file mode 100644 index 0000000000..bcace4f63c --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_310de5 "reflect_310de5" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_310de5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 Reflect %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %reflect_310de5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reflect_310de5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %reflect_310de5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.wgsl new file mode 100644 index 0000000000..09432f5762 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/310de5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn reflect_310de5() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_310de5(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_310de5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_310de5(); +} diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl new file mode 100644 index 0000000000..f7ae376437 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn reflect_61ca21() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_61ca21(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_61ca21(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_61ca21(); +} diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..75d40079a0 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void reflect_61ca21() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_61ca21(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_61ca21(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f3977ef31 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void reflect_61ca21() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_61ca21(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_61ca21(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002B6431BD140(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002B6431BD140(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002B6431BD140(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.glsl new file mode 100644 index 0000000000..ab22f2d094 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_61ca21() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_61ca21(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_61ca21() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_61ca21(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_61ca21() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_61ca21(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.msl new file mode 100644 index 0000000000..7ffb26a1a6 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_61ca21() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_61ca21(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_61ca21(); + return; +} + +kernel void compute_main() { + reflect_61ca21(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.spvasm new file mode 100644 index 0000000000..ad8f002a5d --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_61ca21 "reflect_61ca21" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_61ca21 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Reflect %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %reflect_61ca21 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reflect_61ca21 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %reflect_61ca21 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.wgsl new file mode 100644 index 0000000000..c7e04a80ad --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/61ca21.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn reflect_61ca21() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_61ca21(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_61ca21(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_61ca21(); +} diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl new file mode 100644 index 0000000000..f70d3d9f04 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reflect(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn reflect_b61e10() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var res: vec2 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_b61e10(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_b61e10(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_b61e10(); +} diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66924208b5 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void reflect_b61e10() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_b61e10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_b61e10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_b61e10(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66924208b5 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void reflect_b61e10() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_b61e10(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_b61e10(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_b61e10(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl new file mode 100644 index 0000000000..fe7a35a41b --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void reflect_b61e10() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_b61e10(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reflect_b61e10() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_b61e10(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reflect_b61e10() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_b61e10(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl new file mode 100644 index 0000000000..c565be7f93 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_b61e10() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_b61e10(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_b61e10(); + return; +} + +kernel void compute_main() { + reflect_b61e10(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm new file mode 100644 index 0000000000..998b514c4a --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_b61e10 "reflect_b61e10" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float +%reflect_b61e10 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v2float %arg_0 + %23 = OpLoad %v2float %arg_1 + %20 = OpExtInst %v2float %21 Reflect %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %reflect_b61e10 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reflect_b61e10 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %reflect_b61e10 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a94288e77 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn reflect_b61e10() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var res : vec2 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_b61e10(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_b61e10(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_b61e10(); +} diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl new file mode 100644 index 0000000000..ae704f43b3 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn reflect(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn reflect_bb15ac() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_bb15ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_bb15ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_bb15ac(); +} diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..445e4f2b99 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void reflect_bb15ac() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_bb15ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_bb15ac(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..797983714b --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void reflect_bb15ac() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_bb15ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_bb15ac(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D1F2206F80(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D1F2206F80(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D1F2206F80(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.glsl new file mode 100644 index 0000000000..a52e6db055 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_bb15ac() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_bb15ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void reflect_bb15ac() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_bb15ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void reflect_bb15ac() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_bb15ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.msl new file mode 100644 index 0000000000..bee45f3640 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_bb15ac() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_bb15ac(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_bb15ac(); + return; +} + +kernel void compute_main() { + reflect_bb15ac(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..9af402ba42 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_bb15ac "reflect_bb15ac" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reflect_bb15ac = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 Reflect %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %reflect_bb15ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reflect_bb15ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %reflect_bb15ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..68a49b217f --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/bb15ac.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn reflect_bb15ac() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_bb15ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_bb15ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_bb15ac(); +} diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl new file mode 100644 index 0000000000..b7937846c1 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reflect(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn reflect_f47fdb() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var res: vec3 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_f47fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_f47fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_f47fdb(); +} diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..454cc0f47e --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void reflect_f47fdb() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_f47fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_f47fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_f47fdb(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..454cc0f47e --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void reflect_f47fdb() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reflect_f47fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reflect_f47fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reflect_f47fdb(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl new file mode 100644 index 0000000000..f2dd2c49d2 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void reflect_f47fdb() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = reflect(arg_0, arg_1); +} + +vec4 vertex_main() { + reflect_f47fdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reflect_f47fdb() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = reflect(arg_0, arg_1); +} + +void fragment_main() { + reflect_f47fdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reflect_f47fdb() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = reflect(arg_0, arg_1); +} + +void compute_main() { + reflect_f47fdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl new file mode 100644 index 0000000000..6a48267772 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void reflect_f47fdb() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 res = reflect(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reflect_f47fdb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reflect_f47fdb(); + return; +} + +kernel void compute_main() { + reflect_f47fdb(); + return; +} + diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm new file mode 100644 index 0000000000..256904a9a2 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reflect_f47fdb "reflect_f47fdb" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %25 = OpTypeFunction %v4float +%reflect_f47fdb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v3float %arg_0 + %23 = OpLoad %v3float %arg_1 + %20 = OpExtInst %v3float %21 Reflect %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %reflect_f47fdb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reflect_f47fdb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %reflect_f47fdb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0e8a241f9 --- /dev/null +++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn reflect_f47fdb() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var res : vec3 = reflect(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reflect_f47fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + reflect_f47fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reflect_f47fdb(); +} diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl new file mode 100644 index 0000000000..f6833015fd --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<4, f16>, vec<4, f16>, f16) -> vec<4, f16> +fn refract_0594ba() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = f16(); + var res: vec4 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_0594ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_0594ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_0594ba(); +} diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..463d65f125 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void refract_0594ba() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_0594ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_0594ba(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9201cef51c --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void refract_0594ba() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_0594ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_0594ba(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D61952A880(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D61952A880(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D61952A880(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D61952A880(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.glsl new file mode 100644 index 0000000000..cd98e8619a --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_0594ba() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_0594ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_0594ba() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_0594ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_0594ba() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec4 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_0594ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.msl new file mode 100644 index 0000000000..d0cb126000 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_0594ba() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half arg_2 = 0.0h; + half4 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_0594ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_0594ba(); + return; +} + +kernel void compute_main() { + refract_0594ba(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..c8b16c60e2 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_0594ba "refract_0594ba" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_0594ba = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v4half %arg_0 + %25 = OpLoad %v4half %arg_1 + %26 = OpLoad %half %arg_2 + %22 = OpExtInst %v4half %23 Refract %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_0594ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %refract_0594ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %refract_0594ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..d015c26289 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/0594ba.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn refract_0594ba() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = f16(); + var res : vec4 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_0594ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_0594ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_0594ba(); +} diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl new file mode 100644 index 0000000000..1c5b9539d3 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<2, f16>, vec<2, f16>, f16) -> vec<2, f16> +fn refract_570cb3() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = f16(); + var res: vec2 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_570cb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_570cb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_570cb3(); +} diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..63ce95b63c --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void refract_570cb3() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_570cb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_570cb3(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7d3be7dd88 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void refract_570cb3() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_570cb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_570cb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BAD82D3A70(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BAD82D3A70(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BAD82D3A70(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BAD82D3A70(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.glsl new file mode 100644 index 0000000000..16ff162f9a --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_570cb3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_570cb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_570cb3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_570cb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_570cb3() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec2 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_570cb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.msl new file mode 100644 index 0000000000..2051a9cffe --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_570cb3() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half arg_2 = 0.0h; + half2 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_570cb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_570cb3(); + return; +} + +kernel void compute_main() { + refract_570cb3(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..d7c52d7933 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_570cb3 "refract_570cb3" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_570cb3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v2half %arg_0 + %25 = OpLoad %v2half %arg_1 + %26 = OpLoad %half %arg_2 + %22 = OpExtInst %v2half %23 Refract %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_570cb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %refract_570cb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %refract_570cb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e2895ca7f --- /dev/null +++ b/test/tint/builtins/gen/var/refract/570cb3.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn refract_570cb3() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = f16(); + var res : vec2 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_570cb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_570cb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_570cb3(); +} diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl new file mode 100644 index 0000000000..446c622736 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn refract(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32> +fn refract_7e02e6() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var arg_2 = 1.f; + var res: vec4 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_7e02e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_7e02e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_7e02e6(); +} diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..420f537f9a --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void refract_7e02e6() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float arg_2 = 1.0f; + float4 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_7e02e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_7e02e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_7e02e6(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..420f537f9a --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void refract_7e02e6() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float arg_2 = 1.0f; + float4 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_7e02e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_7e02e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_7e02e6(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl new file mode 100644 index 0000000000..0f3be378df --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void refract_7e02e6() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float arg_2 = 1.0f; + vec4 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_7e02e6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void refract_7e02e6() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float arg_2 = 1.0f; + vec4 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_7e02e6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void refract_7e02e6() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + float arg_2 = 1.0f; + vec4 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_7e02e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl new file mode 100644 index 0000000000..e3336a1a8e --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_7e02e6() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float arg_2 = 1.0f; + float4 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_7e02e6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_7e02e6(); + return; +} + +kernel void compute_main() { + refract_7e02e6(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..d968b0b2e1 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_7e02e6 "refract_7e02e6" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpTypeFunction %v4float +%refract_7e02e6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %float_1 + %22 = OpLoad %v4float %arg_0 + %23 = OpLoad %v4float %arg_1 + %24 = OpLoad %float %arg_2 + %20 = OpExtInst %v4float %21 Refract %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %refract_7e02e6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %refract_7e02e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %refract_7e02e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b09ad8ad6 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn refract_7e02e6() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var arg_2 = 1.0f; + var res : vec4 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_7e02e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_7e02e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_7e02e6(); +} diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl b/test/tint/builtins/gen/var/refract/8984af.wgsl new file mode 100644 index 0000000000..1aa6ded8b3 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn refract(vec<3, f16>, vec<3, f16>, f16) -> vec<3, f16> +fn refract_8984af() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = f16(); + var res: vec3 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_8984af(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_8984af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_8984af(); +} diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c8b3e40a8 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void refract_8984af() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_8984af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_8984af(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..260d085120 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void refract_8984af() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + float16_t arg_2 = float16_t(0.0h); + vector res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_8984af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_8984af(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BED048A880(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BED048A880(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BED048A880(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BED048A880(4,13-17): error X3000: unrecognized identifier 'arg_2' + diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.glsl new file mode 100644 index 0000000000..c44741ede1 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_8984af() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_8984af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void refract_8984af() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_8984af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void refract_8984af() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + float16_t arg_2 = 0.0hf; + f16vec3 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_8984af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.msl new file mode 100644 index 0000000000..8394944213 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_8984af() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half arg_2 = 0.0h; + half3 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_8984af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_8984af(); + return; +} + +kernel void compute_main() { + refract_8984af(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.spvasm new file mode 100644 index 0000000000..4fd9ba81bb --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_8984af "refract_8984af" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %19 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%refract_8984af = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_half Function %19 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %19 + %24 = OpLoad %v3half %arg_0 + %25 = OpLoad %v3half %arg_1 + %26 = OpLoad %half %arg_2 + %22 = OpExtInst %v3half %23 Refract %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_8984af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %refract_8984af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %refract_8984af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.wgsl new file mode 100644 index 0000000000..69d2b2f9ab --- /dev/null +++ b/test/tint/builtins/gen/var/refract/8984af.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn refract_8984af() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = f16(); + var res : vec3 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_8984af(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_8984af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_8984af(); +} diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl new file mode 100644 index 0000000000..50b6c2a9bc --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn refract(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32> +fn refract_cbc1d2() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var arg_2 = 1.f; + var res: vec3 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_cbc1d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_cbc1d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_cbc1d2(); +} diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..67f5603be5 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void refract_cbc1d2() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float arg_2 = 1.0f; + float3 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cbc1d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cbc1d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cbc1d2(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67f5603be5 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void refract_cbc1d2() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float arg_2 = 1.0f; + float3 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cbc1d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cbc1d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cbc1d2(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl new file mode 100644 index 0000000000..70113c87db --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void refract_cbc1d2() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float arg_2 = 1.0f; + vec3 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_cbc1d2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void refract_cbc1d2() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float arg_2 = 1.0f; + vec3 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_cbc1d2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void refract_cbc1d2() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + float arg_2 = 1.0f; + vec3 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_cbc1d2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl new file mode 100644 index 0000000000..7313ac6ac1 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_cbc1d2() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float arg_2 = 1.0f; + float3 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_cbc1d2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_cbc1d2(); + return; +} + +kernel void compute_main() { + refract_cbc1d2(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm new file mode 100644 index 0000000000..e11f35dbc0 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_cbc1d2 "refract_cbc1d2" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpTypeFunction %v4float +%refract_cbc1d2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %float_1 + %24 = OpLoad %v3float %arg_0 + %25 = OpLoad %v3float %arg_1 + %26 = OpLoad %float %arg_2 + %22 = OpExtInst %v3float %23 Refract %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_cbc1d2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %refract_cbc1d2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %refract_cbc1d2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl new file mode 100644 index 0000000000..807c0eec13 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn refract_cbc1d2() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var arg_2 = 1.0f; + var res : vec3 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_cbc1d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_cbc1d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_cbc1d2(); +} diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl new file mode 100644 index 0000000000..87cf6069c4 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn refract(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32> +fn refract_cd905f() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var arg_2 = 1.f; + var res: vec2 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_cd905f(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_cd905f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_cd905f(); +} diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2fe95fd42c --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void refract_cd905f() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float arg_2 = 1.0f; + float2 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cd905f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cd905f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cd905f(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2fe95fd42c --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void refract_cd905f() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float arg_2 = 1.0f; + float2 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + refract_cd905f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + refract_cd905f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + refract_cd905f(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl new file mode 100644 index 0000000000..530fad67eb --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void refract_cd905f() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float arg_2 = 1.0f; + vec2 res = refract(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + refract_cd905f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void refract_cd905f() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float arg_2 = 1.0f; + vec2 res = refract(arg_0, arg_1, arg_2); +} + +void fragment_main() { + refract_cd905f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void refract_cd905f() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + float arg_2 = 1.0f; + vec2 res = refract(arg_0, arg_1, arg_2); +} + +void compute_main() { + refract_cd905f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl new file mode 100644 index 0000000000..b9986c44f5 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void refract_cd905f() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float arg_2 = 1.0f; + float2 res = refract(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + refract_cd905f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + refract_cd905f(); + return; +} + +kernel void compute_main() { + refract_cd905f(); + return; +} + diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b74ab2de9 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %refract_cd905f "refract_cd905f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpTypeFunction %v4float +%refract_cd905f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %float_1 + %24 = OpLoad %v2float %arg_0 + %25 = OpLoad %v2float %arg_1 + %26 = OpLoad %float %arg_2 + %22 = OpExtInst %v2float %23 Refract %24 %25 %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %refract_cd905f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %refract_cd905f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %refract_cd905f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl new file mode 100644 index 0000000000..832641fdc0 --- /dev/null +++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn refract_cd905f() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var arg_2 = 1.0f; + var res : vec2 = refract(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + refract_cd905f(); + return vec4(); +} + +@fragment +fn fragment_main() { + refract_cd905f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + refract_cd905f(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl new file mode 100644 index 0000000000..cd026db1a5 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<2, i32>) -> vec<2, i32> +fn reverseBits_222177() { + var arg_0 = vec2(1); + var res: vec2 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_222177(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_222177(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_222177(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f576da614 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_222177() { + int2 arg_0 = (1).xx; + int2 res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_222177(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_222177(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_222177(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2f576da614 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_222177() { + int2 arg_0 = (1).xx; + int2 res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_222177(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_222177(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_222177(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl new file mode 100644 index 0000000000..e3f8da2206 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_222177() { + ivec2 arg_0 = ivec2(1); + ivec2 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_222177(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_222177() { + ivec2 arg_0 = ivec2(1); + ivec2 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_222177(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_222177() { + ivec2 arg_0 = ivec2(1); + ivec2 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_222177(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl new file mode 100644 index 0000000000..c717678960 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_222177() { + int2 arg_0 = int2(1); + int2 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_222177(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_222177(); + return; +} + +kernel void compute_main() { + reverseBits_222177(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm new file mode 100644 index 0000000000..17502f6ecf --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_222177 "reverseBits_222177" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_222177 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %19 + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v2int %arg_0 + %20 = OpBitReverse %v2int %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %reverseBits_222177 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reverseBits_222177 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %reverseBits_222177 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl new file mode 100644 index 0000000000..52fc3b9df1 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_222177() { + var arg_0 = vec2(1); + var res : vec2 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_222177(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_222177(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_222177(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl new file mode 100644 index 0000000000..e75ce03332 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<4, u32>) -> vec<4, u32> +fn reverseBits_35fea9() { + var arg_0 = vec4(1u); + var res: vec4 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_35fea9(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_35fea9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_35fea9(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd247beed0 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_35fea9() { + uint4 arg_0 = (1u).xxxx; + uint4 res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_35fea9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_35fea9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_35fea9(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd247beed0 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_35fea9() { + uint4 arg_0 = (1u).xxxx; + uint4 res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_35fea9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_35fea9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_35fea9(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl new file mode 100644 index 0000000000..d1dcef5303 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_35fea9() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_35fea9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_35fea9() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_35fea9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_35fea9() { + uvec4 arg_0 = uvec4(1u); + uvec4 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_35fea9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl new file mode 100644 index 0000000000..4844c1ec6e --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_35fea9() { + uint4 arg_0 = uint4(1u); + uint4 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_35fea9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_35fea9(); + return; +} + +kernel void compute_main() { + reverseBits_35fea9(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm new file mode 100644 index 0000000000..9348ffa8f3 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_35fea9 "reverseBits_35fea9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_35fea9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %19 + %res = OpVariable %_ptr_Function_v4uint Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v4uint %arg_0 + %20 = OpBitReverse %v4uint %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %reverseBits_35fea9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reverseBits_35fea9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %reverseBits_35fea9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl new file mode 100644 index 0000000000..72c7a8040f --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_35fea9() { + var arg_0 = vec4(1u); + var res : vec4 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_35fea9(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_35fea9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_35fea9(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl new file mode 100644 index 0000000000..72ca2467ed --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<4, i32>) -> vec<4, i32> +fn reverseBits_4dbd6f() { + var arg_0 = vec4(1); + var res: vec4 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_4dbd6f(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_4dbd6f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_4dbd6f(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae134e788c --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_4dbd6f() { + int4 arg_0 = (1).xxxx; + int4 res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_4dbd6f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_4dbd6f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_4dbd6f(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ae134e788c --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_4dbd6f() { + int4 arg_0 = (1).xxxx; + int4 res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_4dbd6f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_4dbd6f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_4dbd6f(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl new file mode 100644 index 0000000000..cf503b58f1 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_4dbd6f() { + ivec4 arg_0 = ivec4(1); + ivec4 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_4dbd6f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_4dbd6f() { + ivec4 arg_0 = ivec4(1); + ivec4 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_4dbd6f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_4dbd6f() { + ivec4 arg_0 = ivec4(1); + ivec4 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_4dbd6f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl new file mode 100644 index 0000000000..bbf569e5f8 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_4dbd6f() { + int4 arg_0 = int4(1); + int4 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_4dbd6f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_4dbd6f(); + return; +} + +kernel void compute_main() { + reverseBits_4dbd6f(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d0079ccf3 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_4dbd6f "reverseBits_4dbd6f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_4dbd6f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %19 + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v4int %arg_0 + %20 = OpBitReverse %v4int %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %reverseBits_4dbd6f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reverseBits_4dbd6f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %reverseBits_4dbd6f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl new file mode 100644 index 0000000000..03df4481cd --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_4dbd6f() { + var arg_0 = vec4(1); + var res : vec4 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_4dbd6f(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_4dbd6f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_4dbd6f(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl new file mode 100644 index 0000000000..464b045ce0 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(i32) -> i32 +fn reverseBits_7c4269() { + var arg_0 = 1; + var res: i32 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_7c4269(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_7c4269(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_7c4269(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c3ab61c5c3 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_7c4269() { + int arg_0 = 1; + int res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_7c4269(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_7c4269(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_7c4269(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c3ab61c5c3 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_7c4269() { + int arg_0 = 1; + int res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_7c4269(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_7c4269(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_7c4269(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl new file mode 100644 index 0000000000..7f5a81273c --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_7c4269() { + int arg_0 = 1; + int res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_7c4269(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_7c4269() { + int arg_0 = 1; + int res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_7c4269(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_7c4269() { + int arg_0 = 1; + int res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_7c4269(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl new file mode 100644 index 0000000000..2fd16d1baf --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_7c4269() { + int arg_0 = 1; + int res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_7c4269(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_7c4269(); + return; +} + +kernel void compute_main() { + reverseBits_7c4269(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd3505207a --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_7c4269 "reverseBits_7c4269" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_7c4269 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + %19 = OpLoad %int %arg_0 + %18 = OpBitReverse %int %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_7c4269 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_7c4269 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_7c4269 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl new file mode 100644 index 0000000000..d5c8ac15a4 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_7c4269() { + var arg_0 = 1; + var res : i32 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_7c4269(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_7c4269(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_7c4269(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl new file mode 100644 index 0000000000..d89e7a0052 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<3, u32>) -> vec<3, u32> +fn reverseBits_a6ccd4() { + var arg_0 = vec3(1u); + var res: vec3 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_a6ccd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_a6ccd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_a6ccd4(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2a6155a75 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_a6ccd4() { + uint3 arg_0 = (1u).xxx; + uint3 res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_a6ccd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_a6ccd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_a6ccd4(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2a6155a75 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_a6ccd4() { + uint3 arg_0 = (1u).xxx; + uint3 res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_a6ccd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_a6ccd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_a6ccd4(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl new file mode 100644 index 0000000000..56b2a392fd --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_a6ccd4() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_a6ccd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_a6ccd4() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_a6ccd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_a6ccd4() { + uvec3 arg_0 = uvec3(1u); + uvec3 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_a6ccd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl new file mode 100644 index 0000000000..6f9406d255 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_a6ccd4() { + uint3 arg_0 = uint3(1u); + uint3 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_a6ccd4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_a6ccd4(); + return; +} + +kernel void compute_main() { + reverseBits_a6ccd4(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9ba300473 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_a6ccd4 "reverseBits_a6ccd4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_a6ccd4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %19 + %res = OpVariable %_ptr_Function_v3uint Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v3uint %arg_0 + %20 = OpBitReverse %v3uint %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %reverseBits_a6ccd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reverseBits_a6ccd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %reverseBits_a6ccd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ec855fad4 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_a6ccd4() { + var arg_0 = vec3(1u); + var res : vec3 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_a6ccd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_a6ccd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_a6ccd4(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl new file mode 100644 index 0000000000..d079d7b696 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<3, i32>) -> vec<3, i32> +fn reverseBits_c21bc1() { + var arg_0 = vec3(1); + var res: vec3 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_c21bc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_c21bc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_c21bc1(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..30e09176dd --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_c21bc1() { + int3 arg_0 = (1).xxx; + int3 res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_c21bc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_c21bc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_c21bc1(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..30e09176dd --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_c21bc1() { + int3 arg_0 = (1).xxx; + int3 res = asint(reversebits(asuint(arg_0))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_c21bc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_c21bc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_c21bc1(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl new file mode 100644 index 0000000000..e880e50f66 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_c21bc1() { + ivec3 arg_0 = ivec3(1); + ivec3 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_c21bc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_c21bc1() { + ivec3 arg_0 = ivec3(1); + ivec3 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_c21bc1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_c21bc1() { + ivec3 arg_0 = ivec3(1); + ivec3 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_c21bc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl new file mode 100644 index 0000000000..8c295160df --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_c21bc1() { + int3 arg_0 = int3(1); + int3 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_c21bc1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_c21bc1(); + return; +} + +kernel void compute_main() { + reverseBits_c21bc1(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm new file mode 100644 index 0000000000..147d95e440 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_c21bc1 "reverseBits_c21bc1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_c21bc1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %19 + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v3int %arg_0 + %20 = OpBitReverse %v3int %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %reverseBits_c21bc1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reverseBits_c21bc1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %reverseBits_c21bc1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..798bd2dc48 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_c21bc1() { + var arg_0 = vec3(1); + var res : vec3 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_c21bc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_c21bc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_c21bc1(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl new file mode 100644 index 0000000000..5c56cc1e6f --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(vec<2, u32>) -> vec<2, u32> +fn reverseBits_e1f4c1() { + var arg_0 = vec2(1u); + var res: vec2 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e1f4c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_e1f4c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_e1f4c1(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..106f38f2bb --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_e1f4c1() { + uint2 arg_0 = (1u).xx; + uint2 res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e1f4c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e1f4c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e1f4c1(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..106f38f2bb --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_e1f4c1() { + uint2 arg_0 = (1u).xx; + uint2 res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e1f4c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e1f4c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e1f4c1(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl new file mode 100644 index 0000000000..88033b61af --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_e1f4c1() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_e1f4c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_e1f4c1() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_e1f4c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_e1f4c1() { + uvec2 arg_0 = uvec2(1u); + uvec2 res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_e1f4c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl new file mode 100644 index 0000000000..c481bb88ee --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_e1f4c1() { + uint2 arg_0 = uint2(1u); + uint2 res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_e1f4c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_e1f4c1(); + return; +} + +kernel void compute_main() { + reverseBits_e1f4c1(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..512c925a50 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_e1f4c1 "reverseBits_e1f4c1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_e1f4c1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %19 + %res = OpVariable %_ptr_Function_v2uint Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %v2uint %arg_0 + %20 = OpBitReverse %v2uint %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %reverseBits_e1f4c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %reverseBits_e1f4c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %reverseBits_e1f4c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b76ac2d5c --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_e1f4c1() { + var arg_0 = vec2(1u); + var res : vec2 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e1f4c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_e1f4c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_e1f4c1(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl new file mode 100644 index 0000000000..d7ca4841e0 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn reverseBits(u32) -> u32 +fn reverseBits_e31adf() { + var arg_0 = 1u; + var res: u32 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e31adf(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_e31adf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_e31adf(); +} diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..357463196d --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e31adf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e31adf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e31adf(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..357463196d --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = reversebits(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + reverseBits_e31adf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + reverseBits_e31adf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + reverseBits_e31adf(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl new file mode 100644 index 0000000000..0acaf13ac1 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = bitfieldReverse(arg_0); +} + +vec4 vertex_main() { + reverseBits_e31adf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = bitfieldReverse(arg_0); +} + +void fragment_main() { + reverseBits_e31adf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = bitfieldReverse(arg_0); +} + +void compute_main() { + reverseBits_e31adf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl new file mode 100644 index 0000000000..5948fcea8d --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void reverseBits_e31adf() { + uint arg_0 = 1u; + uint res = reverse_bits(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + reverseBits_e31adf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + reverseBits_e31adf(); + return; +} + +kernel void compute_main() { + reverseBits_e31adf(); + return; +} + diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm new file mode 100644 index 0000000000..3dbf2b2988 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %reverseBits_e31adf "reverseBits_e31adf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%reverseBits_e31adf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + %19 = OpLoad %uint %arg_0 + %18 = OpBitReverse %uint %19 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %reverseBits_e31adf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %reverseBits_e31adf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %reverseBits_e31adf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl new file mode 100644 index 0000000000..74890314d9 --- /dev/null +++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn reverseBits_e31adf() { + var arg_0 = 1u; + var res : u32 = reverseBits(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + reverseBits_e31adf(); + return vec4(); +} + +@fragment +fn fragment_main() { + reverseBits_e31adf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + reverseBits_e31adf(); +} diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl b/test/tint/builtins/gen/var/round/106c0b.wgsl new file mode 100644 index 0000000000..9377b8bf67 --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(vec<4, f32>) -> vec<4, f32> +fn round_106c0b() { + var arg_0 = vec4(1.f); + var res: vec4 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_106c0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_106c0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_106c0b(); +} diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a784c58d8f --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_106c0b() { + float4 arg_0 = (1.0f).xxxx; + float4 res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_106c0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_106c0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_106c0b(); + return; +} diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a784c58d8f --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void round_106c0b() { + float4 arg_0 = (1.0f).xxxx; + float4 res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_106c0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_106c0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_106c0b(); + return; +} diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl new file mode 100644 index 0000000000..e36ec984e1 --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void round_106c0b() { + vec4 arg_0 = vec4(1.0f); + vec4 res = round(arg_0); +} + +vec4 vertex_main() { + round_106c0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_106c0b() { + vec4 arg_0 = vec4(1.0f); + vec4 res = round(arg_0); +} + +void fragment_main() { + round_106c0b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_106c0b() { + vec4 arg_0 = vec4(1.0f); + vec4 res = round(arg_0); +} + +void compute_main() { + round_106c0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl new file mode 100644 index 0000000000..b1254e678e --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_106c0b() { + float4 arg_0 = float4(1.0f); + float4 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_106c0b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_106c0b(); + return; +} + +kernel void compute_main() { + round_106c0b(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8cf66d95d --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_106c0b "round_106c0b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%round_106c0b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 RoundEven %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %round_106c0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %round_106c0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %round_106c0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..9faa312bb7 --- /dev/null +++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn round_106c0b() { + var arg_0 = vec4(1.0f); + var res : vec4 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_106c0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_106c0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_106c0b(); +} diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl b/test/tint/builtins/gen/var/round/1c7897.wgsl new file mode 100644 index 0000000000..e7102623df --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(vec<3, f32>) -> vec<3, f32> +fn round_1c7897() { + var arg_0 = vec3(1.f); + var res: vec3 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_1c7897(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_1c7897(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_1c7897(); +} diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..199e2eacf5 --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_1c7897() { + float3 arg_0 = (1.0f).xxx; + float3 res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_1c7897(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_1c7897(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_1c7897(); + return; +} diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..199e2eacf5 --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void round_1c7897() { + float3 arg_0 = (1.0f).xxx; + float3 res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_1c7897(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_1c7897(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_1c7897(); + return; +} diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl new file mode 100644 index 0000000000..6c96538a66 --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void round_1c7897() { + vec3 arg_0 = vec3(1.0f); + vec3 res = round(arg_0); +} + +vec4 vertex_main() { + round_1c7897(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_1c7897() { + vec3 arg_0 = vec3(1.0f); + vec3 res = round(arg_0); +} + +void fragment_main() { + round_1c7897(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_1c7897() { + vec3 arg_0 = vec3(1.0f); + vec3 res = round(arg_0); +} + +void compute_main() { + round_1c7897(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl new file mode 100644 index 0000000000..8317df6d4c --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_1c7897() { + float3 arg_0 = float3(1.0f); + float3 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_1c7897(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_1c7897(); + return; +} + +kernel void compute_main() { + round_1c7897(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd19198984 --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_1c7897 "round_1c7897" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%round_1c7897 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 RoundEven %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %round_1c7897 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_1c7897 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %round_1c7897 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl new file mode 100644 index 0000000000..1cd9dcd177 --- /dev/null +++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn round_1c7897() { + var arg_0 = vec3(1.0f); + var res : vec3 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_1c7897(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_1c7897(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_1c7897(); +} diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl b/test/tint/builtins/gen/var/round/52c84d.wgsl new file mode 100644 index 0000000000..6f15847047 --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(vec<2, f32>) -> vec<2, f32> +fn round_52c84d() { + var arg_0 = vec2(1.f); + var res: vec2 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_52c84d(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_52c84d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_52c84d(); +} diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f8016ba094 --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_52c84d() { + float2 arg_0 = (1.0f).xx; + float2 res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_52c84d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_52c84d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_52c84d(); + return; +} diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f8016ba094 --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void round_52c84d() { + float2 arg_0 = (1.0f).xx; + float2 res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_52c84d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_52c84d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_52c84d(); + return; +} diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl new file mode 100644 index 0000000000..07b1603fbe --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void round_52c84d() { + vec2 arg_0 = vec2(1.0f); + vec2 res = round(arg_0); +} + +vec4 vertex_main() { + round_52c84d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_52c84d() { + vec2 arg_0 = vec2(1.0f); + vec2 res = round(arg_0); +} + +void fragment_main() { + round_52c84d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_52c84d() { + vec2 arg_0 = vec2(1.0f); + vec2 res = round(arg_0); +} + +void compute_main() { + round_52c84d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl new file mode 100644 index 0000000000..03cb3ee1f0 --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_52c84d() { + float2 arg_0 = float2(1.0f); + float2 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_52c84d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_52c84d(); + return; +} + +kernel void compute_main() { + round_52c84d(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm new file mode 100644 index 0000000000..620c31264b --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_52c84d "round_52c84d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%round_52c84d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 RoundEven %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %round_52c84d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_52c84d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %round_52c84d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6cb0527cf --- /dev/null +++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn round_52c84d() { + var arg_0 = vec2(1.0f); + var res : vec2 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_52c84d(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_52c84d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_52c84d(); +} diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl b/test/tint/builtins/gen/var/round/9078ef.wgsl new file mode 100644 index 0000000000..e52a222781 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(f16) -> f16 +fn round_9078ef() { + var arg_0 = f16(); + var res: f16 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9078ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9078ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9078ef(); +} diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cc87dbb813 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_9078ef() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9078ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9078ef(); + return; +} diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1f7b10bb9 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void round_9078ef() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9078ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9078ef(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021E2DBC1640(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000021E2DBC1640(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.glsl new file mode 100644 index 0000000000..0c0cd16e3c --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_9078ef() { + float16_t arg_0 = 0.0hf; + float16_t res = round(arg_0); +} + +vec4 vertex_main() { + round_9078ef(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_9078ef() { + float16_t arg_0 = 0.0hf; + float16_t res = round(arg_0); +} + +void fragment_main() { + round_9078ef(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_9078ef() { + float16_t arg_0 = 0.0hf; + float16_t res = round(arg_0); +} + +void compute_main() { + round_9078ef(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.msl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.msl new file mode 100644 index 0000000000..c7e44da66f --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_9078ef() { + half arg_0 = 0.0h; + half res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_9078ef(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_9078ef(); + return; +} + +kernel void compute_main() { + round_9078ef(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5304a4466 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_9078ef "round_9078ef" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_9078ef = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 RoundEven %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %round_9078ef + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %round_9078ef + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %round_9078ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a6439d3d8 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9078ef.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn round_9078ef() { + var arg_0 = f16(); + var res : f16 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9078ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9078ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9078ef(); +} diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl b/test/tint/builtins/gen/var/round/9edc38.wgsl new file mode 100644 index 0000000000..90a8724d66 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn round(f32) -> f32 +fn round_9edc38() { + var arg_0 = 1.f; + var res: f32 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9edc38(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9edc38(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9edc38(); +} diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f68cfd024f --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_9edc38() { + float arg_0 = 1.0f; + float res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9edc38(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9edc38(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9edc38(); + return; +} diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f68cfd024f --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void round_9edc38() { + float arg_0 = 1.0f; + float res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_9edc38(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_9edc38(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_9edc38(); + return; +} diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl new file mode 100644 index 0000000000..f6758703f6 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void round_9edc38() { + float arg_0 = 1.0f; + float res = round(arg_0); +} + +vec4 vertex_main() { + round_9edc38(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void round_9edc38() { + float arg_0 = 1.0f; + float res = round(arg_0); +} + +void fragment_main() { + round_9edc38(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void round_9edc38() { + float arg_0 = 1.0f; + float res = round(arg_0); +} + +void compute_main() { + round_9edc38(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl new file mode 100644 index 0000000000..bee06fa0b8 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_9edc38() { + float arg_0 = 1.0f; + float res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_9edc38(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_9edc38(); + return; +} + +kernel void compute_main() { + round_9edc38(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm new file mode 100644 index 0000000000..24731f7469 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_9edc38 "round_9edc38" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%round_9edc38 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 RoundEven %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %round_9edc38 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %round_9edc38 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_9edc38 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl new file mode 100644 index 0000000000..f41cc78447 --- /dev/null +++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn round_9edc38() { + var arg_0 = 1.0f; + var res : f32 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_9edc38(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_9edc38(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_9edc38(); +} diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl b/test/tint/builtins/gen/var/round/d87e84.wgsl new file mode 100644 index 0000000000..d130d9568d --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<2, f16>) -> vec<2, f16> +fn round_d87e84() { + var arg_0 = vec2(f16()); + var res: vec2 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_d87e84(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_d87e84(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_d87e84(); +} diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c4ec1d073 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_d87e84() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_d87e84(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_d87e84(); + return; +} diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95b83e2b2e --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void round_d87e84() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_d87e84(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_d87e84(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013FF5D11570(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013FF5D11570(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.glsl new file mode 100644 index 0000000000..bb031c30e3 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_d87e84() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = round(arg_0); +} + +vec4 vertex_main() { + round_d87e84(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_d87e84() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = round(arg_0); +} + +void fragment_main() { + round_d87e84(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_d87e84() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = round(arg_0); +} + +void compute_main() { + round_d87e84(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.msl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.msl new file mode 100644 index 0000000000..70a4f41b19 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_d87e84() { + half2 arg_0 = half2(0.0h); + half2 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_d87e84(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_d87e84(); + return; +} + +kernel void compute_main() { + round_d87e84(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6956ed787 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_d87e84 "round_d87e84" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_d87e84 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 RoundEven %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %round_d87e84 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_d87e84 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %round_d87e84 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.wgsl new file mode 100644 index 0000000000..8911fc3586 --- /dev/null +++ b/test/tint/builtins/gen/var/round/d87e84.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn round_d87e84() { + var arg_0 = vec2(f16()); + var res : vec2 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_d87e84(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_d87e84(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_d87e84(); +} diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl new file mode 100644 index 0000000000..a4494e276b --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<3, f16>) -> vec<3, f16> +fn round_e1bba2() { + var arg_0 = vec3(f16()); + var res: vec3 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_e1bba2(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_e1bba2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_e1bba2(); +} diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..073bbfd68f --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_e1bba2() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_e1bba2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_e1bba2(); + return; +} diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64c5a88a65 --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void round_e1bba2() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_e1bba2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_e1bba2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002DBC8633250(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002DBC8633250(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.glsl new file mode 100644 index 0000000000..421df9b05b --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_e1bba2() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = round(arg_0); +} + +vec4 vertex_main() { + round_e1bba2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_e1bba2() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = round(arg_0); +} + +void fragment_main() { + round_e1bba2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_e1bba2() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = round(arg_0); +} + +void compute_main() { + round_e1bba2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.msl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.msl new file mode 100644 index 0000000000..06bb618516 --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_e1bba2() { + half3 arg_0 = half3(0.0h); + half3 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_e1bba2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_e1bba2(); + return; +} + +kernel void compute_main() { + round_e1bba2(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.spvasm new file mode 100644 index 0000000000..31be1c9d9f --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_e1bba2 "round_e1bba2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_e1bba2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 RoundEven %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %round_e1bba2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_e1bba2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %round_e1bba2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd41b19fa9 --- /dev/null +++ b/test/tint/builtins/gen/var/round/e1bba2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn round_e1bba2() { + var arg_0 = vec3(f16()); + var res : vec3 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_e1bba2(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_e1bba2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_e1bba2(); +} diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl b/test/tint/builtins/gen/var/round/f665b5.wgsl new file mode 100644 index 0000000000..8297439e87 --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn round(vec<4, f16>) -> vec<4, f16> +fn round_f665b5() { + var arg_0 = vec4(f16()); + var res: vec4 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_f665b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_f665b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_f665b5(); +} diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..360cf4ae09 --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void round_f665b5() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_f665b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_f665b5(); + return; +} diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1bdd81434 --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void round_f665b5() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = round(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + round_f665b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + round_f665b5(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023EB7FA70D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023EB7FA70D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.glsl new file mode 100644 index 0000000000..d78cc6aae6 --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_f665b5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = round(arg_0); +} + +vec4 vertex_main() { + round_f665b5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void round_f665b5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = round(arg_0); +} + +void fragment_main() { + round_f665b5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void round_f665b5() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = round(arg_0); +} + +void compute_main() { + round_f665b5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.msl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.msl new file mode 100644 index 0000000000..fb7f28ae5e --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void round_f665b5() { + half4 arg_0 = half4(0.0h); + half4 res = rint(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + round_f665b5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + round_f665b5(); + return; +} + +kernel void compute_main() { + round_f665b5(); + return; +} + diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..7eea88452a --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %round_f665b5 "round_f665b5" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%round_f665b5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 RoundEven %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %round_f665b5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %round_f665b5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %round_f665b5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..b6afe2b58e --- /dev/null +++ b/test/tint/builtins/gen/var/round/f665b5.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn round_f665b5() { + var arg_0 = vec4(f16()); + var res : vec4 = round(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + round_f665b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + round_f665b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + round_f665b5(); +} diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl b/test/tint/builtins/gen/var/select/00b848.wgsl new file mode 100644 index 0000000000..c6132122be --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, i32>, vec<2, i32>, vec<2, bool>) -> vec<2, i32> +fn select_00b848() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var arg_2 = vec2(true); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_00b848(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_00b848(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_00b848(); +} diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c132cca0eb --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_00b848() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + bool2 arg_2 = (true).xx; + int2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_00b848(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_00b848(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_00b848(); + return; +} diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c132cca0eb --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_00b848() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + bool2 arg_2 = (true).xx; + int2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_00b848(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_00b848(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_00b848(); + return; +} diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl new file mode 100644 index 0000000000..2663ba37ca --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_00b848() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + bvec2 arg_2 = bvec2(true); + ivec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_00b848(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_00b848() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + bvec2 arg_2 = bvec2(true); + ivec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_00b848(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_00b848() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + bvec2 arg_2 = bvec2(true); + ivec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_00b848(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl new file mode 100644 index 0000000000..b62d66f203 --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_00b848() { + int2 arg_0 = int2(1); + int2 arg_1 = int2(1); + bool2 arg_2 = bool2(true); + int2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_00b848(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_00b848(); + return; +} + +kernel void compute_main() { + select_00b848(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm new file mode 100644 index 0000000000..355f6889ea --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_00b848 "select_00b848" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %24 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %27 = OpConstantNull %v2bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_00b848 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %19 + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %27 + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %24 + %29 = OpLoad %v2bool %arg_2 + %30 = OpLoad %v2int %arg_1 + %31 = OpLoad %v2int %arg_0 + %28 = OpSelect %v2int %29 %30 %31 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_00b848 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_00b848 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_00b848 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl new file mode 100644 index 0000000000..f386dd5ab5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_00b848() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var arg_2 = vec2(true); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_00b848(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_00b848(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_00b848(); +} diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl new file mode 100644 index 0000000000..dce82d0ae6 --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, i32>, vec<3, i32>, vec<3, bool>) -> vec<3, i32> +fn select_01e2cd() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var arg_2 = vec3(true); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_01e2cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_01e2cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_01e2cd(); +} diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e3d6bc818f --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_01e2cd() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + bool3 arg_2 = (true).xxx; + int3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_01e2cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_01e2cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_01e2cd(); + return; +} diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e3d6bc818f --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_01e2cd() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + bool3 arg_2 = (true).xxx; + int3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_01e2cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_01e2cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_01e2cd(); + return; +} diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl new file mode 100644 index 0000000000..644cc43ef5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_01e2cd() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + bvec3 arg_2 = bvec3(true); + ivec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_01e2cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_01e2cd() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + bvec3 arg_2 = bvec3(true); + ivec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_01e2cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_01e2cd() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + bvec3 arg_2 = bvec3(true); + ivec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_01e2cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl new file mode 100644 index 0000000000..5f68736e50 --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_01e2cd() { + int3 arg_0 = int3(1); + int3 arg_1 = int3(1); + bool3 arg_2 = bool3(true); + int3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_01e2cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_01e2cd(); + return; +} + +kernel void compute_main() { + select_01e2cd(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4bc496c82 --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_01e2cd "select_01e2cd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %24 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %27 = OpConstantNull %v3bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_01e2cd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %19 + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %27 + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %24 + %29 = OpLoad %v3bool %arg_2 + %30 = OpLoad %v3int %arg_1 + %31 = OpLoad %v3int %arg_0 + %28 = OpSelect %v3int %29 %30 %31 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_01e2cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_01e2cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_01e2cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..b12547295d --- /dev/null +++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_01e2cd() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var arg_2 = vec3(true); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_01e2cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_01e2cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_01e2cd(); +} diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl b/test/tint/builtins/gen/var/select/087ea4.wgsl new file mode 100644 index 0000000000..a80c8a0a4c --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, u32>, vec<4, u32>, bool) -> vec<4, u32> +fn select_087ea4() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var arg_2 = true; + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_087ea4(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_087ea4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_087ea4(); +} diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..455752cd34 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_087ea4() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + bool arg_2 = true; + uint4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_087ea4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_087ea4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_087ea4(); + return; +} diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..455752cd34 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_087ea4() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + bool arg_2 = true; + uint4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_087ea4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_087ea4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_087ea4(); + return; +} diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl new file mode 100644 index 0000000000..1c9cbfb313 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_087ea4() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + bool arg_2 = true; + uvec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_087ea4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_087ea4() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + bool arg_2 = true; + uvec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_087ea4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_087ea4() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + bool arg_2 = true; + uvec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_087ea4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl new file mode 100644 index 0000000000..7888548398 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_087ea4() { + uint4 arg_0 = uint4(1u); + uint4 arg_1 = uint4(1u); + bool arg_2 = true; + uint4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_087ea4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_087ea4(); + return; +} + +kernel void compute_main() { + select_087ea4(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm new file mode 100644 index 0000000000..db71937bd2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_087ea4 "select_087ea4" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %33 = OpConstantNull %v4bool + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_087ea4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %19 + %arg_2 = OpVariable %_ptr_Function_bool Function %25 + %31 = OpVariable %_ptr_Function_v4bool Function %33 + %res = OpVariable %_ptr_Function_v4uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %true + %27 = OpLoad %bool %arg_2 + %28 = OpLoad %v4uint %arg_1 + %29 = OpLoad %v4uint %arg_0 + %34 = OpCompositeConstruct %v4bool %27 %27 %27 %27 + %26 = OpSelect %v4uint %34 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %select_087ea4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_087ea4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %48 = OpLabel + %49 = OpFunctionCall %void %select_087ea4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e20ae7b33 --- /dev/null +++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_087ea4() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var arg_2 = true; + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_087ea4(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_087ea4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_087ea4(); +} diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl b/test/tint/builtins/gen/var/select/10e73b.wgsl new file mode 100644 index 0000000000..9362b80fbd --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(f16, f16, bool) -> f16 +fn select_10e73b() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = true; + var res: f16 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_10e73b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_10e73b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_10e73b(); +} diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db83290038 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_10e73b() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_10e73b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_10e73b(); + return; +} diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8c0804870 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void select_10e73b() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_10e73b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_10e73b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B6F116BCD0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B6F116BCD0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl new file mode 100644 index 0000000000..aa7382839d --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_10e73b() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_10e73b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_10e73b() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_10e73b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_10e73b() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + bool arg_2 = true; + float16_t res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_10e73b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.msl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.msl new file mode 100644 index 0000000000..f643c290f0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_10e73b() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + bool arg_2 = true; + half res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_10e73b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_10e73b(); + return; +} + +kernel void compute_main() { + select_10e73b(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.spvasm new file mode 100644 index 0000000000..6f8609b1d1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_10e73b "select_10e73b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_10e73b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_bool Function %22 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %true + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %half %arg_1 + %26 = OpLoad %half %arg_0 + %23 = OpSelect %half %24 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %select_10e73b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_10e73b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_10e73b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4cd0fc411 --- /dev/null +++ b/test/tint/builtins/gen/var/select/10e73b.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_10e73b() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = true; + var res : f16 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_10e73b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_10e73b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_10e73b(); +} diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl new file mode 100644 index 0000000000..421c3ee35f --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<3, f16>, vec<3, f16>, bool) -> vec<3, f16> +fn select_1ada2a() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = true; + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1ada2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1ada2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1ada2a(); +} diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cdb717ce6a --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_1ada2a() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1ada2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1ada2a(); + return; +} diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a7ddf0962f --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_1ada2a() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1ada2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1ada2a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001843DACE700(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001843DACE700(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001843DACE700(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl new file mode 100644 index 0000000000..6111b1ee87 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_1ada2a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bool arg_2 = true; + f16vec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_1ada2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_1ada2a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bool arg_2 = true; + f16vec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_1ada2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_1ada2a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bool arg_2 = true; + f16vec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_1ada2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.msl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.msl new file mode 100644 index 0000000000..3f236362ab --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_1ada2a() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + bool arg_2 = true; + half3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_1ada2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_1ada2a(); + return; +} + +kernel void compute_main() { + select_1ada2a(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..efd6a0aec8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_1ada2a "select_1ada2a" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %31 = OpConstantNull %v3bool + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_1ada2a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %29 = OpVariable %_ptr_Function_v3bool Function %31 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %v3half %arg_1 + %27 = OpLoad %v3half %arg_0 + %32 = OpCompositeConstruct %v3bool %25 %25 %25 + %24 = OpSelect %v3half %32 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %select_1ada2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_1ada2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %select_1ada2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..89e258ccff --- /dev/null +++ b/test/tint/builtins/gen/var/select/1ada2a.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_1ada2a() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = true; + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1ada2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1ada2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1ada2a(); +} diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl b/test/tint/builtins/gen/var/select/1e960b.wgsl new file mode 100644 index 0000000000..12f8a46348 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, u32>, vec<2, u32>, vec<2, bool>) -> vec<2, u32> +fn select_1e960b() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var arg_2 = vec2(true); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1e960b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1e960b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1e960b(); +} diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9ff45c6ac4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_1e960b() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + bool2 arg_2 = (true).xx; + uint2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1e960b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1e960b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1e960b(); + return; +} diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9ff45c6ac4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_1e960b() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + bool2 arg_2 = (true).xx; + uint2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_1e960b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_1e960b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_1e960b(); + return; +} diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl new file mode 100644 index 0000000000..8033d8de58 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_1e960b() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + bvec2 arg_2 = bvec2(true); + uvec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_1e960b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_1e960b() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + bvec2 arg_2 = bvec2(true); + uvec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_1e960b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_1e960b() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + bvec2 arg_2 = bvec2(true); + uvec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_1e960b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl new file mode 100644 index 0000000000..6d78b32234 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_1e960b() { + uint2 arg_0 = uint2(1u); + uint2 arg_1 = uint2(1u); + bool2 arg_2 = bool2(true); + uint2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_1e960b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_1e960b(); + return; +} + +kernel void compute_main() { + select_1e960b(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm new file mode 100644 index 0000000000..87cd7dd4cd --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_1e960b "select_1e960b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %24 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %27 = OpConstantNull %v2bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_1e960b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %19 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %27 + %res = OpVariable %_ptr_Function_v2uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %24 + %29 = OpLoad %v2bool %arg_2 + %30 = OpLoad %v2uint %arg_1 + %31 = OpLoad %v2uint %arg_0 + %28 = OpSelect %v2uint %29 %30 %31 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_1e960b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_1e960b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_1e960b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fd5fc1169 --- /dev/null +++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_1e960b() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var arg_2 = vec2(true); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_1e960b(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_1e960b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_1e960b(); +} diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl b/test/tint/builtins/gen/var/select/266aff.wgsl new file mode 100644 index 0000000000..2daf70e0ea --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, f32>, vec<2, f32>, vec<2, bool>) -> vec<2, f32> +fn select_266aff() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var arg_2 = vec2(true); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_266aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_266aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_266aff(); +} diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6501b1958f --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_266aff() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + bool2 arg_2 = (true).xx; + float2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_266aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_266aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_266aff(); + return; +} diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6501b1958f --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_266aff() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + bool2 arg_2 = (true).xx; + float2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_266aff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_266aff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_266aff(); + return; +} diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl new file mode 100644 index 0000000000..1b530519d6 --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_266aff() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + bvec2 arg_2 = bvec2(true); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_266aff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_266aff() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + bvec2 arg_2 = bvec2(true); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_266aff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_266aff() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + bvec2 arg_2 = bvec2(true); + vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_266aff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl new file mode 100644 index 0000000000..40ec58d2a9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_266aff() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + bool2 arg_2 = bool2(true); + float2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_266aff(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_266aff(); + return; +} + +kernel void compute_main() { + select_266aff(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm new file mode 100644 index 0000000000..c575bbbd49 --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_266aff "select_266aff" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %23 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %26 = OpConstantNull %v2bool + %32 = OpTypeFunction %v4float +%select_266aff = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %26 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %23 + %28 = OpLoad %v2bool %arg_2 + %29 = OpLoad %v2float %arg_1 + %30 = OpLoad %v2float %arg_0 + %27 = OpSelect %v2float %28 %29 %30 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %select_266aff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_266aff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_266aff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl new file mode 100644 index 0000000000..d9669014de --- /dev/null +++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_266aff() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var arg_2 = vec2(true); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_266aff(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_266aff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_266aff(); +} diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl b/test/tint/builtins/gen/var/select/28a27e.wgsl new file mode 100644 index 0000000000..d1b2133005 --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, u32>, vec<3, u32>, vec<3, bool>) -> vec<3, u32> +fn select_28a27e() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var arg_2 = vec3(true); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_28a27e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_28a27e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_28a27e(); +} diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..de3886c81b --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_28a27e() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + bool3 arg_2 = (true).xxx; + uint3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_28a27e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_28a27e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_28a27e(); + return; +} diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..de3886c81b --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_28a27e() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + bool3 arg_2 = (true).xxx; + uint3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_28a27e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_28a27e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_28a27e(); + return; +} diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl new file mode 100644 index 0000000000..33d750b01a --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_28a27e() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + bvec3 arg_2 = bvec3(true); + uvec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_28a27e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_28a27e() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + bvec3 arg_2 = bvec3(true); + uvec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_28a27e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_28a27e() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + bvec3 arg_2 = bvec3(true); + uvec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_28a27e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl new file mode 100644 index 0000000000..35ea1d8937 --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_28a27e() { + uint3 arg_0 = uint3(1u); + uint3 arg_1 = uint3(1u); + bool3 arg_2 = bool3(true); + uint3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_28a27e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_28a27e(); + return; +} + +kernel void compute_main() { + select_28a27e(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm new file mode 100644 index 0000000000..991b27146e --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_28a27e "select_28a27e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %24 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %27 = OpConstantNull %v3bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_28a27e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %19 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %27 + %res = OpVariable %_ptr_Function_v3uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %24 + %29 = OpLoad %v3bool %arg_2 + %30 = OpLoad %v3uint %arg_1 + %31 = OpLoad %v3uint %arg_0 + %28 = OpSelect %v3uint %29 %30 %31 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_28a27e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_28a27e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_28a27e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl new file mode 100644 index 0000000000..257d5e3c59 --- /dev/null +++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_28a27e() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var arg_2 = vec3(true); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_28a27e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_28a27e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_28a27e(); +} diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl new file mode 100644 index 0000000000..367c609dc5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, bool>, vec<3, bool>, bool) -> vec<3, bool> +fn select_3c25ce() { + var arg_0 = vec3(true); + var arg_1 = vec3(true); + var arg_2 = true; + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_3c25ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_3c25ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_3c25ce(); +} diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54ab3e6c6c --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_3c25ce() { + bool3 arg_0 = (true).xxx; + bool3 arg_1 = (true).xxx; + bool arg_2 = true; + bool3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_3c25ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_3c25ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_3c25ce(); + return; +} diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54ab3e6c6c --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_3c25ce() { + bool3 arg_0 = (true).xxx; + bool3 arg_1 = (true).xxx; + bool arg_2 = true; + bool3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_3c25ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_3c25ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_3c25ce(); + return; +} diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl new file mode 100644 index 0000000000..d1c2ced765 --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_3c25ce() { + bvec3 arg_0 = bvec3(true); + bvec3 arg_1 = bvec3(true); + bool arg_2 = true; + bvec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_3c25ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_3c25ce() { + bvec3 arg_0 = bvec3(true); + bvec3 arg_1 = bvec3(true); + bool arg_2 = true; + bvec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_3c25ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_3c25ce() { + bvec3 arg_0 = bvec3(true); + bvec3 arg_1 = bvec3(true); + bool arg_2 = true; + bvec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_3c25ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl new file mode 100644 index 0000000000..b81bb64070 --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_3c25ce() { + bool3 arg_0 = bool3(true); + bool3 arg_1 = bool3(true); + bool arg_2 = true; + bool3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_3c25ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_3c25ce(); + return; +} + +kernel void compute_main() { + select_3c25ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..c92d3eeac4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_3c25ce "select_3c25ce" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %19 = OpConstantNull %v3bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_3c25ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3bool Function %19 + %arg_1 = OpVariable %_ptr_Function_v3bool Function %19 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %28 = OpVariable %_ptr_Function_v3bool Function %19 + %res = OpVariable %_ptr_Function_v3bool Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %v3bool %arg_1 + %27 = OpLoad %v3bool %arg_0 + %29 = OpCompositeConstruct %v3bool %25 %25 %25 + %24 = OpSelect %v3bool %29 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %select_3c25ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_3c25ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_3c25ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..89f2280359 --- /dev/null +++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_3c25ce() { + var arg_0 = vec3(true); + var arg_1 = vec3(true); + var arg_2 = true; + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_3c25ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_3c25ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_3c25ce(); +} diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl b/test/tint/builtins/gen/var/select/416e14.wgsl new file mode 100644 index 0000000000..8cd973909c --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(f32, f32, bool) -> f32 +fn select_416e14() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var arg_2 = true; + var res: f32 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_416e14(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_416e14(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_416e14(); +} diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b3d12d4161 --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = true; + float res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_416e14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_416e14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_416e14(); + return; +} diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b3d12d4161 --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = true; + float res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_416e14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_416e14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_416e14(); + return; +} diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl new file mode 100644 index 0000000000..fb88928b79 --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = true; + float res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_416e14(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = true; + float res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_416e14(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = true; + float res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_416e14(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl new file mode 100644 index 0000000000..1829479d96 --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_416e14() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + bool arg_2 = true; + float res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_416e14(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_416e14(); + return; +} + +kernel void compute_main() { + select_416e14(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm new file mode 100644 index 0000000000..c541b5a43c --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_416e14 "select_416e14" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %21 = OpConstantNull %bool + %27 = OpTypeFunction %v4float +%select_416e14 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_bool Function %21 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %true + %23 = OpLoad %bool %arg_2 + %24 = OpLoad %float %arg_1 + %25 = OpLoad %float %arg_0 + %22 = OpSelect %float %23 %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %select_416e14 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %select_416e14 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_416e14 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl new file mode 100644 index 0000000000..94af34a933 --- /dev/null +++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_416e14() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var arg_2 = true; + var res : f32 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_416e14(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_416e14(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_416e14(); +} diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl b/test/tint/builtins/gen/var/select/51b047.wgsl new file mode 100644 index 0000000000..12c076d1a9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, u32>, vec<2, u32>, bool) -> vec<2, u32> +fn select_51b047() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var arg_2 = true; + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_51b047(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_51b047(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_51b047(); +} diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..40aa3f44c7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_51b047() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + bool arg_2 = true; + uint2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_51b047(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_51b047(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_51b047(); + return; +} diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..40aa3f44c7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_51b047() { + uint2 arg_0 = (1u).xx; + uint2 arg_1 = (1u).xx; + bool arg_2 = true; + uint2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_51b047(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_51b047(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_51b047(); + return; +} diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl new file mode 100644 index 0000000000..06473db3cb --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_51b047() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + bool arg_2 = true; + uvec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_51b047(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_51b047() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + bool arg_2 = true; + uvec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_51b047(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_51b047() { + uvec2 arg_0 = uvec2(1u); + uvec2 arg_1 = uvec2(1u); + bool arg_2 = true; + uvec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_51b047(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl new file mode 100644 index 0000000000..fc7391bf40 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_51b047() { + uint2 arg_0 = uint2(1u); + uint2 arg_1 = uint2(1u); + bool arg_2 = true; + uint2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_51b047(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_51b047(); + return; +} + +kernel void compute_main() { + select_51b047(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b88ea799b --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_51b047 "select_51b047" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %19 = OpConstantNull %v2uint + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %33 = OpConstantNull %v2bool + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_51b047 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v2uint Function %19 + %arg_2 = OpVariable %_ptr_Function_bool Function %25 + %31 = OpVariable %_ptr_Function_v2bool Function %33 + %res = OpVariable %_ptr_Function_v2uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %true + %27 = OpLoad %bool %arg_2 + %28 = OpLoad %v2uint %arg_1 + %29 = OpLoad %v2uint %arg_0 + %34 = OpCompositeConstruct %v2bool %27 %27 + %26 = OpSelect %v2uint %34 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %select_51b047 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_51b047 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %48 = OpLabel + %49 = OpFunctionCall %void %select_51b047 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5412ed860 --- /dev/null +++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_51b047() { + var arg_0 = vec2(1u); + var arg_1 = vec2(1u); + var arg_2 = true; + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_51b047(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_51b047(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_51b047(); +} diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl b/test/tint/builtins/gen/var/select/53d518.wgsl new file mode 100644 index 0000000000..9f43aa80b0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<3, f16>, vec<3, f16>, vec<3, bool>) -> vec<3, f16> +fn select_53d518() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(true); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_53d518(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_53d518(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_53d518(); +} diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a04ba3952a --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_53d518() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + bool3 arg_2 = (true).xxx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_53d518(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_53d518(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_53d518(); + return; +} diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..41ea9bf471 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_53d518() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + bool3 arg_2 = (true).xxx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_53d518(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_53d518(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_53d518(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B5EE857E30(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B5EE857E30(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001B5EE857E30(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl new file mode 100644 index 0000000000..496678a7d9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_53d518() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bvec3 arg_2 = bvec3(true); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_53d518(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_53d518() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bvec3 arg_2 = bvec3(true); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_53d518(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_53d518() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + bvec3 arg_2 = bvec3(true); + f16vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_53d518(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.msl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.msl new file mode 100644 index 0000000000..cc5db044d7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_53d518() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + bool3 arg_2 = bool3(true); + half3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_53d518(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_53d518(); + return; +} + +kernel void compute_main() { + select_53d518(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2bd1a5fee --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_53d518 "select_53d518" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %22 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %25 = OpConstantNull %v3bool + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_53d518 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %25 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %22 + %27 = OpLoad %v3bool %arg_2 + %28 = OpLoad %v3half %arg_1 + %29 = OpLoad %v3half %arg_0 + %26 = OpSelect %v3half %27 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %select_53d518 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_53d518 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_53d518 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/53d518.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c40bca363 --- /dev/null +++ b/test/tint/builtins/gen/var/select/53d518.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_53d518() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(true); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_53d518(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_53d518(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_53d518(); +} diff --git a/test/tint/builtins/gen/var/select/713567.wgsl b/test/tint/builtins/gen/var/select/713567.wgsl new file mode 100644 index 0000000000..91e28873e1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, f32>, vec<4, f32>, bool) -> vec<4, f32> +fn select_713567() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var arg_2 = true; + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_713567(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_713567(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_713567(); +} diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9d70108f81 --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_713567() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + bool arg_2 = true; + float4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_713567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_713567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_713567(); + return; +} diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9d70108f81 --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_713567() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + bool arg_2 = true; + float4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_713567(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_713567(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_713567(); + return; +} diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl new file mode 100644 index 0000000000..e5090f0ba0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_713567() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + bool arg_2 = true; + vec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_713567(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_713567() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + bool arg_2 = true; + vec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_713567(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_713567() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + bool arg_2 = true; + vec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_713567(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.msl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.msl new file mode 100644 index 0000000000..fe42ab07ad --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_713567() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + bool arg_2 = true; + float4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_713567(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_713567(); + return; +} + +kernel void compute_main() { + select_713567(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8bd58655a --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_713567 "select_713567" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %30 = OpConstantNull %v4bool + %33 = OpTypeFunction %v4float +%select_713567 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_bool Function %22 + %28 = OpVariable %_ptr_Function_v4bool Function %30 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %true + %24 = OpLoad %bool %arg_2 + %25 = OpLoad %v4float %arg_1 + %26 = OpLoad %v4float %arg_0 + %31 = OpCompositeConstruct %v4bool %24 %24 %24 %24 + %23 = OpSelect %v4float %31 %25 %26 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_713567 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_713567 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %44 = OpLabel + %45 = OpFunctionCall %void %select_713567 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl new file mode 100644 index 0000000000..62cfc1ab4f --- /dev/null +++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_713567() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var arg_2 = true; + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_713567(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_713567(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_713567(); +} diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl b/test/tint/builtins/gen/var/select/78be5f.wgsl new file mode 100644 index 0000000000..2245ec4d8b --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, f32>, vec<3, f32>, bool) -> vec<3, f32> +fn select_78be5f() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var arg_2 = true; + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_78be5f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_78be5f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_78be5f(); +} diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..997acbeee8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_78be5f() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + bool arg_2 = true; + float3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_78be5f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_78be5f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_78be5f(); + return; +} diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..997acbeee8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_78be5f() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + bool arg_2 = true; + float3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_78be5f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_78be5f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_78be5f(); + return; +} diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl new file mode 100644 index 0000000000..35920b722b --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_78be5f() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + bool arg_2 = true; + vec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_78be5f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_78be5f() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + bool arg_2 = true; + vec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_78be5f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_78be5f() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + bool arg_2 = true; + vec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_78be5f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl new file mode 100644 index 0000000000..251735f463 --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_78be5f() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + bool arg_2 = true; + float3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_78be5f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_78be5f(); + return; +} + +kernel void compute_main() { + select_78be5f(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm new file mode 100644 index 0000000000..07585b808b --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_78be5f "select_78be5f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %32 = OpConstantNull %v3bool + %35 = OpTypeFunction %v4float +%select_78be5f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %arg_2 = OpVariable %_ptr_Function_bool Function %24 + %30 = OpVariable %_ptr_Function_v3bool Function %32 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %true + %26 = OpLoad %bool %arg_2 + %27 = OpLoad %v3float %arg_1 + %28 = OpLoad %v3float %arg_0 + %33 = OpCompositeConstruct %v3bool %26 %26 %26 + %25 = OpSelect %v3float %33 %27 %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %select_78be5f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_78be5f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %select_78be5f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca853b9d2d --- /dev/null +++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_78be5f() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var arg_2 = true; + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_78be5f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_78be5f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_78be5f(); +} diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl new file mode 100644 index 0000000000..4797149158 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, bool>, vec<3, bool>, vec<3, bool>) -> vec<3, bool> +fn select_80a9a9() { + var arg_0 = vec3(true); + var arg_1 = vec3(true); + var arg_2 = vec3(true); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_80a9a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_80a9a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_80a9a9(); +} diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..12841d9042 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_80a9a9() { + bool3 arg_0 = (true).xxx; + bool3 arg_1 = (true).xxx; + bool3 arg_2 = (true).xxx; + bool3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_80a9a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_80a9a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_80a9a9(); + return; +} diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..12841d9042 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_80a9a9() { + bool3 arg_0 = (true).xxx; + bool3 arg_1 = (true).xxx; + bool3 arg_2 = (true).xxx; + bool3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_80a9a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_80a9a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_80a9a9(); + return; +} diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl new file mode 100644 index 0000000000..b2d3f5cf68 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_80a9a9() { + bvec3 arg_0 = bvec3(true); + bvec3 arg_1 = bvec3(true); + bvec3 arg_2 = bvec3(true); + bvec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_80a9a9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_80a9a9() { + bvec3 arg_0 = bvec3(true); + bvec3 arg_1 = bvec3(true); + bvec3 arg_2 = bvec3(true); + bvec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_80a9a9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_80a9a9() { + bvec3 arg_0 = bvec3(true); + bvec3 arg_1 = bvec3(true); + bvec3 arg_2 = bvec3(true); + bvec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_80a9a9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl new file mode 100644 index 0000000000..74edbe1303 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_80a9a9() { + bool3 arg_0 = bool3(true); + bool3 arg_1 = bool3(true); + bool3 arg_2 = bool3(true); + bool3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_80a9a9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_80a9a9(); + return; +} + +kernel void compute_main() { + select_80a9a9(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm new file mode 100644 index 0000000000..9699fed57e --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_80a9a9 "select_80a9a9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %19 = OpConstantNull %v3bool + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_80a9a9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3bool Function %19 + %arg_1 = OpVariable %_ptr_Function_v3bool Function %19 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %19 + %res = OpVariable %_ptr_Function_v3bool Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %16 + %23 = OpLoad %v3bool %arg_2 + %24 = OpLoad %v3bool %arg_1 + %25 = OpLoad %v3bool %arg_0 + %22 = OpSelect %v3bool %23 %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %select_80a9a9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %select_80a9a9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %select_80a9a9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl new file mode 100644 index 0000000000..a016f65f97 --- /dev/null +++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_80a9a9() { + var arg_0 = vec3(true); + var arg_1 = vec3(true); + var arg_2 = vec3(true); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_80a9a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_80a9a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_80a9a9(); +} diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl b/test/tint/builtins/gen/var/select/830dd9.wgsl new file mode 100644 index 0000000000..596c536839 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<4, f16>, vec<4, f16>, bool) -> vec<4, f16> +fn select_830dd9() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = true; + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_830dd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_830dd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_830dd9(); +} diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6cf31e5126 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_830dd9() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_830dd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_830dd9(); + return; +} diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..844a4b78f0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_830dd9() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_830dd9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_830dd9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002476DF13A60(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002476DF13A60(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002476DF13A60(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl new file mode 100644 index 0000000000..76d5e54014 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_830dd9() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bool arg_2 = true; + f16vec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_830dd9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_830dd9() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bool arg_2 = true; + f16vec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_830dd9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_830dd9() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bool arg_2 = true; + f16vec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_830dd9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.msl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.msl new file mode 100644 index 0000000000..e9b5d67ba1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_830dd9() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + bool arg_2 = true; + half4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_830dd9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_830dd9(); + return; +} + +kernel void compute_main() { + select_830dd9(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.spvasm new file mode 100644 index 0000000000..c099ce9b8c --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_830dd9 "select_830dd9" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %31 = OpConstantNull %v4bool + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_830dd9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %29 = OpVariable %_ptr_Function_v4bool Function %31 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %v4half %arg_1 + %27 = OpLoad %v4half %arg_0 + %32 = OpCompositeConstruct %v4bool %25 %25 %25 %25 + %24 = OpSelect %v4half %32 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %select_830dd9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_830dd9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %select_830dd9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1a0be6bae --- /dev/null +++ b/test/tint/builtins/gen/var/select/830dd9.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_830dd9() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = true; + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_830dd9(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_830dd9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_830dd9(); +} diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl new file mode 100644 index 0000000000..fcf7755f5c --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<2, f16>, vec<2, f16>, bool) -> vec<2, f16> +fn select_86f9bd() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = true; + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_86f9bd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_86f9bd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_86f9bd(); +} diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b0d16c2655 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_86f9bd() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_86f9bd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_86f9bd(); + return; +} diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..341d518a38 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_86f9bd() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + bool arg_2 = true; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_86f9bd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_86f9bd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018386C13370(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018386C13370(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018386C13370(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl new file mode 100644 index 0000000000..6217049327 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_86f9bd() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bool arg_2 = true; + f16vec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_86f9bd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_86f9bd() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bool arg_2 = true; + f16vec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_86f9bd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_86f9bd() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bool arg_2 = true; + f16vec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_86f9bd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.msl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.msl new file mode 100644 index 0000000000..1ff94774f4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_86f9bd() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + bool arg_2 = true; + half2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_86f9bd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_86f9bd(); + return; +} + +kernel void compute_main() { + select_86f9bd(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfb8b98ce1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_86f9bd "select_86f9bd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %31 = OpConstantNull %v2bool + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_86f9bd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %29 = OpVariable %_ptr_Function_v2bool Function %31 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %v2half %arg_1 + %27 = OpLoad %v2half %arg_0 + %32 = OpCompositeConstruct %v2bool %25 %25 + %24 = OpSelect %v2half %32 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %select_86f9bd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_86f9bd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %select_86f9bd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd73ed0e79 --- /dev/null +++ b/test/tint/builtins/gen/var/select/86f9bd.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_86f9bd() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = true; + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_86f9bd(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_86f9bd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_86f9bd(); +} diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl new file mode 100644 index 0000000000..ef3c4ff21b --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, i32>, vec<3, i32>, bool) -> vec<3, i32> +fn select_8fa62c() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var arg_2 = true; + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_8fa62c(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_8fa62c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_8fa62c(); +} diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8e5ca9483d --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_8fa62c() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + bool arg_2 = true; + int3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_8fa62c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_8fa62c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_8fa62c(); + return; +} diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e5ca9483d --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_8fa62c() { + int3 arg_0 = (1).xxx; + int3 arg_1 = (1).xxx; + bool arg_2 = true; + int3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_8fa62c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_8fa62c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_8fa62c(); + return; +} diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl new file mode 100644 index 0000000000..4f54fba99c --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_8fa62c() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + bool arg_2 = true; + ivec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_8fa62c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_8fa62c() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + bool arg_2 = true; + ivec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_8fa62c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_8fa62c() { + ivec3 arg_0 = ivec3(1); + ivec3 arg_1 = ivec3(1); + bool arg_2 = true; + ivec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_8fa62c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl new file mode 100644 index 0000000000..c5d92e8817 --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_8fa62c() { + int3 arg_0 = int3(1); + int3 arg_1 = int3(1); + bool arg_2 = true; + int3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_8fa62c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_8fa62c(); + return; +} + +kernel void compute_main() { + select_8fa62c(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm new file mode 100644 index 0000000000..d90c6ea6f7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_8fa62c "select_8fa62c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %19 = OpConstantNull %v3int + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %33 = OpConstantNull %v3bool + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_8fa62c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3int Function %19 + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_bool Function %25 + %31 = OpVariable %_ptr_Function_v3bool Function %33 + %res = OpVariable %_ptr_Function_v3int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %true + %27 = OpLoad %bool %arg_2 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v3int %arg_0 + %34 = OpCompositeConstruct %v3bool %27 %27 %27 + %26 = OpSelect %v3int %34 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %select_8fa62c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_8fa62c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %48 = OpLabel + %49 = OpFunctionCall %void %select_8fa62c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl new file mode 100644 index 0000000000..906f330388 --- /dev/null +++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_8fa62c() { + var arg_0 = vec3(1); + var arg_1 = vec3(1); + var arg_2 = true; + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_8fa62c(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_8fa62c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_8fa62c(); +} diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl b/test/tint/builtins/gen/var/select/99f883.wgsl new file mode 100644 index 0000000000..27bd2e31bd --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(u32, u32, bool) -> u32 +fn select_99f883() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = true; + var res: u32 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_99f883(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_99f883(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_99f883(); +} diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ece0b4ed3c --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = true; + uint res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_99f883(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_99f883(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_99f883(); + return; +} diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ece0b4ed3c --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = true; + uint res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_99f883(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_99f883(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_99f883(); + return; +} diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl new file mode 100644 index 0000000000..1a92d98149 --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = true; + uint res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_99f883(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = true; + uint res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_99f883(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = true; + uint res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_99f883(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl new file mode 100644 index 0000000000..34011c8b0e --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_99f883() { + uint arg_0 = 1u; + uint arg_1 = 1u; + bool arg_2 = true; + uint res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_99f883(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_99f883(); + return; +} + +kernel void compute_main() { + select_99f883(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm new file mode 100644 index 0000000000..9ba6aac26e --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_99f883 "select_99f883" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_99f883 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %arg_1 = OpVariable %_ptr_Function_uint Function %17 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %res = OpVariable %_ptr_Function_uint Function %17 + OpStore %arg_0 %uint_1 + OpStore %arg_1 %uint_1 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %uint %arg_1 + %27 = OpLoad %uint %arg_0 + %24 = OpSelect %uint %25 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_99f883 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_99f883 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_99f883 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl new file mode 100644 index 0000000000..1f34678bc4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_99f883() { + var arg_0 = 1u; + var arg_1 = 1u; + var arg_2 = true; + var res : u32 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_99f883(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_99f883(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_99f883(); +} diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl b/test/tint/builtins/gen/var/select/a081f1.wgsl new file mode 100644 index 0000000000..713d3c73e7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<4, f16>, vec<4, f16>, vec<4, bool>) -> vec<4, f16> +fn select_a081f1() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(true); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a081f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a081f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a081f1(); +} diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abae0c7cb7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_a081f1() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + bool4 arg_2 = (true).xxxx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a081f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a081f1(); + return; +} diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9ac9d28e83 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_a081f1() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + bool4 arg_2 = (true).xxxx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a081f1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a081f1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002045A0049A0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002045A0049A0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002045A0049A0(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl new file mode 100644 index 0000000000..4d8e8c3427 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_a081f1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bvec4 arg_2 = bvec4(true); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_a081f1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_a081f1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bvec4 arg_2 = bvec4(true); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_a081f1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_a081f1() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + bvec4 arg_2 = bvec4(true); + f16vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_a081f1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.msl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.msl new file mode 100644 index 0000000000..4fcb8d9e91 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_a081f1() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + bool4 arg_2 = bool4(true); + half4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_a081f1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_a081f1(); + return; +} + +kernel void compute_main() { + select_a081f1(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.spvasm new file mode 100644 index 0000000000..35b71ba82f --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_a081f1 "select_a081f1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %22 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %25 = OpConstantNull %v4bool + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_a081f1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %25 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %22 + %27 = OpLoad %v4bool %arg_2 + %28 = OpLoad %v4half %arg_1 + %29 = OpLoad %v4half %arg_0 + %26 = OpSelect %v4half %27 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %select_a081f1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_a081f1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_a081f1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e86702635 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a081f1.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_a081f1() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(true); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a081f1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a081f1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a081f1(); +} diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl b/test/tint/builtins/gen/var/select/a2860e.wgsl new file mode 100644 index 0000000000..db8953d907 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, i32>, vec<4, i32>, vec<4, bool>) -> vec<4, i32> +fn select_a2860e() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var arg_2 = vec4(true); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a2860e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a2860e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a2860e(); +} diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9cfb0e58e1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_a2860e() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + bool4 arg_2 = (true).xxxx; + int4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a2860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a2860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a2860e(); + return; +} diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9cfb0e58e1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_a2860e() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + bool4 arg_2 = (true).xxxx; + int4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_a2860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_a2860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_a2860e(); + return; +} diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl new file mode 100644 index 0000000000..cccde14bae --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_a2860e() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + bvec4 arg_2 = bvec4(true); + ivec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_a2860e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_a2860e() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + bvec4 arg_2 = bvec4(true); + ivec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_a2860e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_a2860e() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + bvec4 arg_2 = bvec4(true); + ivec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_a2860e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl new file mode 100644 index 0000000000..2b70f32e4c --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_a2860e() { + int4 arg_0 = int4(1); + int4 arg_1 = int4(1); + bool4 arg_2 = bool4(true); + int4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_a2860e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_a2860e(); + return; +} + +kernel void compute_main() { + select_a2860e(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm new file mode 100644 index 0000000000..ff3b0ac26f --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_a2860e "select_a2860e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %24 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %27 = OpConstantNull %v4bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_a2860e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %19 + %arg_1 = OpVariable %_ptr_Function_v4int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %27 + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %24 + %29 = OpLoad %v4bool %arg_2 + %30 = OpLoad %v4int %arg_1 + %31 = OpLoad %v4int %arg_0 + %28 = OpSelect %v4int %29 %30 %31 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_a2860e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_a2860e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_a2860e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl new file mode 100644 index 0000000000..e9b8e2993a --- /dev/null +++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_a2860e() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var arg_2 = vec4(true); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_a2860e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_a2860e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_a2860e(); +} diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl b/test/tint/builtins/gen/var/select/ab069f.wgsl new file mode 100644 index 0000000000..e30f78a618 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, i32>, vec<4, i32>, bool) -> vec<4, i32> +fn select_ab069f() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var arg_2 = true; + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ab069f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ab069f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ab069f(); +} diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b1ef504913 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_ab069f() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + bool arg_2 = true; + int4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ab069f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ab069f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ab069f(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1ef504913 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_ab069f() { + int4 arg_0 = (1).xxxx; + int4 arg_1 = (1).xxxx; + bool arg_2 = true; + int4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ab069f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ab069f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ab069f(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl new file mode 100644 index 0000000000..da8260c030 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_ab069f() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + bool arg_2 = true; + ivec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_ab069f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_ab069f() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + bool arg_2 = true; + ivec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_ab069f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_ab069f() { + ivec4 arg_0 = ivec4(1); + ivec4 arg_1 = ivec4(1); + bool arg_2 = true; + ivec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_ab069f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl new file mode 100644 index 0000000000..df7f500ead --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_ab069f() { + int4 arg_0 = int4(1); + int4 arg_1 = int4(1); + bool arg_2 = true; + int4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ab069f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ab069f(); + return; +} + +kernel void compute_main() { + select_ab069f(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm new file mode 100644 index 0000000000..fc0ca025b9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ab069f "select_ab069f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %33 = OpConstantNull %v4bool + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ab069f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4int Function %19 + %arg_1 = OpVariable %_ptr_Function_v4int Function %19 + %arg_2 = OpVariable %_ptr_Function_bool Function %25 + %31 = OpVariable %_ptr_Function_v4bool Function %33 + %res = OpVariable %_ptr_Function_v4int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %true + %27 = OpLoad %bool %arg_2 + %28 = OpLoad %v4int %arg_1 + %29 = OpLoad %v4int %arg_0 + %34 = OpCompositeConstruct %v4bool %27 %27 %27 %27 + %26 = OpSelect %v4int %34 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %select_ab069f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_ab069f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %48 = OpLabel + %49 = OpFunctionCall %void %select_ab069f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl new file mode 100644 index 0000000000..609b9e0b97 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_ab069f() { + var arg_0 = vec4(1); + var arg_1 = vec4(1); + var arg_2 = true; + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ab069f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ab069f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ab069f(); +} diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl b/test/tint/builtins/gen/var/select/b04721.wgsl new file mode 100644 index 0000000000..be22dc3d1a --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, u32>, vec<3, u32>, bool) -> vec<3, u32> +fn select_b04721() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var arg_2 = true; + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_b04721(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_b04721(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_b04721(); +} diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..286d31884b --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_b04721() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + bool arg_2 = true; + uint3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_b04721(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_b04721(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_b04721(); + return; +} diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..286d31884b --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_b04721() { + uint3 arg_0 = (1u).xxx; + uint3 arg_1 = (1u).xxx; + bool arg_2 = true; + uint3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_b04721(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_b04721(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_b04721(); + return; +} diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl new file mode 100644 index 0000000000..9b37f7593a --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_b04721() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + bool arg_2 = true; + uvec3 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_b04721(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_b04721() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + bool arg_2 = true; + uvec3 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_b04721(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_b04721() { + uvec3 arg_0 = uvec3(1u); + uvec3 arg_1 = uvec3(1u); + bool arg_2 = true; + uvec3 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_b04721(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl new file mode 100644 index 0000000000..ec77e1ec35 --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_b04721() { + uint3 arg_0 = uint3(1u); + uint3 arg_1 = uint3(1u); + bool arg_2 = true; + uint3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_b04721(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_b04721(); + return; +} + +kernel void compute_main() { + select_b04721(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm new file mode 100644 index 0000000000..a2d40b80ec --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_b04721 "select_b04721" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %19 = OpConstantNull %v3uint + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %33 = OpConstantNull %v3bool + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_b04721 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v3uint Function %19 + %arg_2 = OpVariable %_ptr_Function_bool Function %25 + %31 = OpVariable %_ptr_Function_v3bool Function %33 + %res = OpVariable %_ptr_Function_v3uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %true + %27 = OpLoad %bool %arg_2 + %28 = OpLoad %v3uint %arg_1 + %29 = OpLoad %v3uint %arg_0 + %34 = OpCompositeConstruct %v3bool %27 %27 %27 + %26 = OpSelect %v3uint %34 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %select_b04721 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_b04721 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %48 = OpLabel + %49 = OpFunctionCall %void %select_b04721 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl new file mode 100644 index 0000000000..3eec22a992 --- /dev/null +++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_b04721() { + var arg_0 = vec3(1u); + var arg_1 = vec3(1u); + var arg_2 = true; + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_b04721(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_b04721(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_b04721(); +} diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl b/test/tint/builtins/gen/var/select/bb447f.wgsl new file mode 100644 index 0000000000..f2012e7b95 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, i32>, vec<2, i32>, bool) -> vec<2, i32> +fn select_bb447f() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var arg_2 = true; + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bb447f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bb447f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bb447f(); +} diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54054a5257 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_bb447f() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + bool arg_2 = true; + int2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb447f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb447f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb447f(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54054a5257 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_bb447f() { + int2 arg_0 = (1).xx; + int2 arg_1 = (1).xx; + bool arg_2 = true; + int2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb447f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb447f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb447f(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl new file mode 100644 index 0000000000..2e1cd76790 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_bb447f() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + bool arg_2 = true; + ivec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_bb447f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_bb447f() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + bool arg_2 = true; + ivec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_bb447f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_bb447f() { + ivec2 arg_0 = ivec2(1); + ivec2 arg_1 = ivec2(1); + bool arg_2 = true; + ivec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_bb447f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl new file mode 100644 index 0000000000..6028b17bc7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_bb447f() { + int2 arg_0 = int2(1); + int2 arg_1 = int2(1); + bool arg_2 = true; + int2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_bb447f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_bb447f(); + return; +} + +kernel void compute_main() { + select_bb447f(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba42bca5f8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_bb447f "select_bb447f" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %16 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %33 = OpConstantNull %v2bool + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_bb447f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2int Function %19 + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_bool Function %25 + %31 = OpVariable %_ptr_Function_v2bool Function %33 + %res = OpVariable %_ptr_Function_v2int Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %true + %27 = OpLoad %bool %arg_2 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v2int %arg_0 + %34 = OpCompositeConstruct %v2bool %27 %27 + %26 = OpSelect %v2int %34 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %select_bb447f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_bb447f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %48 = OpLabel + %49 = OpFunctionCall %void %select_bb447f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c7b78912d --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_bb447f() { + var arg_0 = vec2(1); + var arg_1 = vec2(1); + var arg_2 = true; + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bb447f(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bb447f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bb447f(); +} diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl new file mode 100644 index 0000000000..1d0aae688d --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, f32>, vec<4, f32>, vec<4, bool>) -> vec<4, f32> +fn select_bb8aae() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var arg_2 = vec4(true); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bb8aae(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bb8aae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bb8aae(); +} diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5b54bb0711 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_bb8aae() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + bool4 arg_2 = (true).xxxx; + float4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb8aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb8aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb8aae(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5b54bb0711 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_bb8aae() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + bool4 arg_2 = (true).xxxx; + float4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bb8aae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bb8aae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bb8aae(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl new file mode 100644 index 0000000000..11f1221bea --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_bb8aae() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + bvec4 arg_2 = bvec4(true); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_bb8aae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_bb8aae() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + bvec4 arg_2 = bvec4(true); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_bb8aae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_bb8aae() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + bvec4 arg_2 = bvec4(true); + vec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_bb8aae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl new file mode 100644 index 0000000000..aa41986eb5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_bb8aae() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + bool4 arg_2 = bool4(true); + float4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_bb8aae(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_bb8aae(); + return; +} + +kernel void compute_main() { + select_bb8aae(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm new file mode 100644 index 0000000000..bf31dcf013 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_bb8aae "select_bb8aae" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %21 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %24 = OpConstantNull %v4bool + %30 = OpTypeFunction %v4float +%select_bb8aae = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %24 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %21 + %26 = OpLoad %v4bool %arg_2 + %27 = OpLoad %v4float %arg_1 + %28 = OpLoad %v4float %arg_0 + %25 = OpSelect %v4float %26 %27 %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %select_bb8aae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_bb8aae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_bb8aae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0075a141e --- /dev/null +++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_bb8aae() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var arg_2 = vec4(true); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bb8aae(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bb8aae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bb8aae(); +} diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl new file mode 100644 index 0000000000..97325e4fff --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, f32>, vec<2, f32>, bool) -> vec<2, f32> +fn select_bf3d29() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var arg_2 = true; + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bf3d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bf3d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bf3d29(); +} diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..639514de88 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_bf3d29() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + bool arg_2 = true; + float2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bf3d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bf3d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bf3d29(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..639514de88 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_bf3d29() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + bool arg_2 = true; + float2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_bf3d29(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_bf3d29(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_bf3d29(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl new file mode 100644 index 0000000000..f6e07067bc --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_bf3d29() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + bool arg_2 = true; + vec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_bf3d29(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_bf3d29() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + bool arg_2 = true; + vec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_bf3d29(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_bf3d29() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + bool arg_2 = true; + vec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_bf3d29(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl new file mode 100644 index 0000000000..174b98ec21 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_bf3d29() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + bool arg_2 = true; + float2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_bf3d29(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_bf3d29(); + return; +} + +kernel void compute_main() { + select_bf3d29(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm new file mode 100644 index 0000000000..89a1163a47 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_bf3d29 "select_bf3d29" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %32 = OpConstantNull %v2bool + %35 = OpTypeFunction %v4float +%select_bf3d29 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %arg_2 = OpVariable %_ptr_Function_bool Function %24 + %30 = OpVariable %_ptr_Function_v2bool Function %32 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %true + %26 = OpLoad %bool %arg_2 + %27 = OpLoad %v2float %arg_1 + %28 = OpLoad %v2float %arg_0 + %33 = OpCompositeConstruct %v2bool %26 %26 + %25 = OpSelect %v2float %33 %27 %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %select_bf3d29 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_bf3d29 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %46 = OpLabel + %47 = OpFunctionCall %void %select_bf3d29 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl new file mode 100644 index 0000000000..b05a10e8d9 --- /dev/null +++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_bf3d29() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var arg_2 = true; + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_bf3d29(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_bf3d29(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_bf3d29(); +} diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl new file mode 100644 index 0000000000..2d597ba8aa --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(bool, bool, bool) -> bool +fn select_c31f9e() { + var arg_0 = true; + var arg_1 = true; + var arg_2 = true; + var res: bool = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c31f9e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c31f9e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c31f9e(); +} diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3be461a506 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_c31f9e() { + bool arg_0 = true; + bool arg_1 = true; + bool arg_2 = true; + bool res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c31f9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c31f9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c31f9e(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3be461a506 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_c31f9e() { + bool arg_0 = true; + bool arg_1 = true; + bool arg_2 = true; + bool res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c31f9e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c31f9e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c31f9e(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl new file mode 100644 index 0000000000..0f2507eaf8 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_c31f9e() { + bool arg_0 = true; + bool arg_1 = true; + bool arg_2 = true; + bool res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_c31f9e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_c31f9e() { + bool arg_0 = true; + bool arg_1 = true; + bool arg_2 = true; + bool res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_c31f9e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_c31f9e() { + bool arg_0 = true; + bool arg_1 = true; + bool arg_2 = true; + bool res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_c31f9e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl new file mode 100644 index 0000000000..d3176b30ca --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_c31f9e() { + bool arg_0 = true; + bool arg_1 = true; + bool arg_2 = true; + bool res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_c31f9e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_c31f9e(); + return; +} + +kernel void compute_main() { + select_c31f9e(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm new file mode 100644 index 0000000000..794f5668c5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_c31f9e "select_c31f9e" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %17 = OpConstantNull %bool + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_c31f9e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_bool Function %17 + %arg_1 = OpVariable %_ptr_Function_bool Function %17 + %arg_2 = OpVariable %_ptr_Function_bool Function %17 + %res = OpVariable %_ptr_Function_bool Function %17 + OpStore %arg_0 %true + OpStore %arg_1 %true + OpStore %arg_2 %true + %21 = OpLoad %bool %arg_2 + %22 = OpLoad %bool %arg_1 + %23 = OpLoad %bool %arg_0 + %20 = OpSelect %bool %21 %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %select_c31f9e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %select_c31f9e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %select_c31f9e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fa45007e7 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_c31f9e() { + var arg_0 = true; + var arg_1 = true; + var arg_2 = true; + var res : bool = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c31f9e(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c31f9e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c31f9e(); +} diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl new file mode 100644 index 0000000000..dd1d005482 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, bool>, vec<4, bool>, bool) -> vec<4, bool> +fn select_c41bd1() { + var arg_0 = vec4(true); + var arg_1 = vec4(true); + var arg_2 = true; + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c41bd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c41bd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c41bd1(); +} diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3dbc9b20bb --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_c41bd1() { + bool4 arg_0 = (true).xxxx; + bool4 arg_1 = (true).xxxx; + bool arg_2 = true; + bool4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c41bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c41bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c41bd1(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3dbc9b20bb --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_c41bd1() { + bool4 arg_0 = (true).xxxx; + bool4 arg_1 = (true).xxxx; + bool arg_2 = true; + bool4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c41bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c41bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c41bd1(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl new file mode 100644 index 0000000000..048a70d637 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_c41bd1() { + bvec4 arg_0 = bvec4(true); + bvec4 arg_1 = bvec4(true); + bool arg_2 = true; + bvec4 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_c41bd1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_c41bd1() { + bvec4 arg_0 = bvec4(true); + bvec4 arg_1 = bvec4(true); + bool arg_2 = true; + bvec4 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_c41bd1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_c41bd1() { + bvec4 arg_0 = bvec4(true); + bvec4 arg_1 = bvec4(true); + bool arg_2 = true; + bvec4 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_c41bd1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl new file mode 100644 index 0000000000..0f359814ce --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_c41bd1() { + bool4 arg_0 = bool4(true); + bool4 arg_1 = bool4(true); + bool arg_2 = true; + bool4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_c41bd1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_c41bd1(); + return; +} + +kernel void compute_main() { + select_c41bd1(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm new file mode 100644 index 0000000000..c1c88b50fc --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_c41bd1 "select_c41bd1" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %19 = OpConstantNull %v4bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_c41bd1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4bool Function %19 + %arg_1 = OpVariable %_ptr_Function_v4bool Function %19 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %28 = OpVariable %_ptr_Function_v4bool Function %19 + %res = OpVariable %_ptr_Function_v4bool Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %v4bool %arg_1 + %27 = OpLoad %v4bool %arg_0 + %29 = OpCompositeConstruct %v4bool %25 %25 %25 %25 + %24 = OpSelect %v4bool %29 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %select_c41bd1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_c41bd1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_c41bd1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl new file mode 100644 index 0000000000..aeeb85cd5a --- /dev/null +++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_c41bd1() { + var arg_0 = vec4(true); + var arg_1 = vec4(true); + var arg_2 = true; + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c41bd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c41bd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c41bd1(); +} diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl new file mode 100644 index 0000000000..9502b65313 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, u32>, vec<4, u32>, vec<4, bool>) -> vec<4, u32> +fn select_c4a4ef() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var arg_2 = vec4(true); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c4a4ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c4a4ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c4a4ef(); +} diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2ef3ebdaea --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_c4a4ef() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + bool4 arg_2 = (true).xxxx; + uint4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c4a4ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c4a4ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c4a4ef(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ef3ebdaea --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_c4a4ef() { + uint4 arg_0 = (1u).xxxx; + uint4 arg_1 = (1u).xxxx; + bool4 arg_2 = (true).xxxx; + uint4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_c4a4ef(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_c4a4ef(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_c4a4ef(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl new file mode 100644 index 0000000000..d75fbb7fb2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_c4a4ef() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + bvec4 arg_2 = bvec4(true); + uvec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_c4a4ef(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_c4a4ef() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + bvec4 arg_2 = bvec4(true); + uvec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_c4a4ef(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_c4a4ef() { + uvec4 arg_0 = uvec4(1u); + uvec4 arg_1 = uvec4(1u); + bvec4 arg_2 = bvec4(true); + uvec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_c4a4ef(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl new file mode 100644 index 0000000000..7e6eb78453 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_c4a4ef() { + uint4 arg_0 = uint4(1u); + uint4 arg_1 = uint4(1u); + bool4 arg_2 = bool4(true); + uint4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_c4a4ef(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_c4a4ef(); + return; +} + +kernel void compute_main() { + select_c4a4ef(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm new file mode 100644 index 0000000000..620f545594 --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_c4a4ef "select_c4a4ef" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %19 = OpConstantNull %v4uint + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %24 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %27 = OpConstantNull %v4bool + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_c4a4ef = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4uint Function %19 + %arg_1 = OpVariable %_ptr_Function_v4uint Function %19 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %27 + %res = OpVariable %_ptr_Function_v4uint Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %24 + %29 = OpLoad %v4bool %arg_2 + %30 = OpLoad %v4uint %arg_1 + %31 = OpLoad %v4uint %arg_0 + %28 = OpSelect %v4uint %29 %30 %31 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %select_c4a4ef + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %42 = OpLabel + %43 = OpFunctionCall %void %select_c4a4ef + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %45 = OpLabel + %46 = OpFunctionCall %void %select_c4a4ef + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl new file mode 100644 index 0000000000..a155e7653f --- /dev/null +++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_c4a4ef() { + var arg_0 = vec4(1u); + var arg_1 = vec4(1u); + var arg_2 = vec4(true); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_c4a4ef(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_c4a4ef(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_c4a4ef(); +} diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl b/test/tint/builtins/gen/var/select/cb9301.wgsl new file mode 100644 index 0000000000..0948d3d57b --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, bool>, vec<2, bool>, vec<2, bool>) -> vec<2, bool> +fn select_cb9301() { + var arg_0 = vec2(true); + var arg_1 = vec2(true); + var arg_2 = vec2(true); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_cb9301(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_cb9301(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_cb9301(); +} diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..76b1344abb --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_cb9301() { + bool2 arg_0 = (true).xx; + bool2 arg_1 = (true).xx; + bool2 arg_2 = (true).xx; + bool2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_cb9301(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_cb9301(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_cb9301(); + return; +} diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..76b1344abb --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_cb9301() { + bool2 arg_0 = (true).xx; + bool2 arg_1 = (true).xx; + bool2 arg_2 = (true).xx; + bool2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_cb9301(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_cb9301(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_cb9301(); + return; +} diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl new file mode 100644 index 0000000000..8c7e5d2bf5 --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_cb9301() { + bvec2 arg_0 = bvec2(true); + bvec2 arg_1 = bvec2(true); + bvec2 arg_2 = bvec2(true); + bvec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_cb9301(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_cb9301() { + bvec2 arg_0 = bvec2(true); + bvec2 arg_1 = bvec2(true); + bvec2 arg_2 = bvec2(true); + bvec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_cb9301(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_cb9301() { + bvec2 arg_0 = bvec2(true); + bvec2 arg_1 = bvec2(true); + bvec2 arg_2 = bvec2(true); + bvec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_cb9301(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl new file mode 100644 index 0000000000..3bdecabec1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_cb9301() { + bool2 arg_0 = bool2(true); + bool2 arg_1 = bool2(true); + bool2 arg_2 = bool2(true); + bool2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_cb9301(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_cb9301(); + return; +} + +kernel void compute_main() { + select_cb9301(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm new file mode 100644 index 0000000000..0060df1969 --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_cb9301 "select_cb9301" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %19 = OpConstantNull %v2bool + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_cb9301 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2bool Function %19 + %arg_1 = OpVariable %_ptr_Function_v2bool Function %19 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %19 + %res = OpVariable %_ptr_Function_v2bool Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %16 + %23 = OpLoad %v2bool %arg_2 + %24 = OpLoad %v2bool %arg_1 + %25 = OpLoad %v2bool %arg_0 + %22 = OpSelect %v2bool %23 %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %select_cb9301 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %select_cb9301 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %select_cb9301 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl new file mode 100644 index 0000000000..e5744baad6 --- /dev/null +++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_cb9301() { + var arg_0 = vec2(true); + var arg_1 = vec2(true); + var arg_2 = vec2(true); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_cb9301(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_cb9301(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_cb9301(); +} diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl b/test/tint/builtins/gen/var/select/e3e028.wgsl new file mode 100644 index 0000000000..828c3717c0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<4, bool>, vec<4, bool>, vec<4, bool>) -> vec<4, bool> +fn select_e3e028() { + var arg_0 = vec4(true); + var arg_1 = vec4(true); + var arg_2 = vec4(true); + var res: vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_e3e028(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_e3e028(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_e3e028(); +} diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2d1efcf171 --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_e3e028() { + bool4 arg_0 = (true).xxxx; + bool4 arg_1 = (true).xxxx; + bool4 arg_2 = (true).xxxx; + bool4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_e3e028(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_e3e028(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_e3e028(); + return; +} diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d1efcf171 --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_e3e028() { + bool4 arg_0 = (true).xxxx; + bool4 arg_1 = (true).xxxx; + bool4 arg_2 = (true).xxxx; + bool4 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_e3e028(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_e3e028(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_e3e028(); + return; +} diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl new file mode 100644 index 0000000000..afdfd70f00 --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_e3e028() { + bvec4 arg_0 = bvec4(true); + bvec4 arg_1 = bvec4(true); + bvec4 arg_2 = bvec4(true); + bvec4 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_e3e028(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_e3e028() { + bvec4 arg_0 = bvec4(true); + bvec4 arg_1 = bvec4(true); + bvec4 arg_2 = bvec4(true); + bvec4 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_e3e028(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_e3e028() { + bvec4 arg_0 = bvec4(true); + bvec4 arg_1 = bvec4(true); + bvec4 arg_2 = bvec4(true); + bvec4 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_e3e028(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl new file mode 100644 index 0000000000..817ec0d363 --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_e3e028() { + bool4 arg_0 = bool4(true); + bool4 arg_1 = bool4(true); + bool4 arg_2 = bool4(true); + bool4 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_e3e028(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_e3e028(); + return; +} + +kernel void compute_main() { + select_e3e028(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm new file mode 100644 index 0000000000..c5e95acdda --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_e3e028 "select_e3e028" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %19 = OpConstantNull %v4bool + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_e3e028 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4bool Function %19 + %arg_1 = OpVariable %_ptr_Function_v4bool Function %19 + %arg_2 = OpVariable %_ptr_Function_v4bool Function %19 + %res = OpVariable %_ptr_Function_v4bool Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %16 + %23 = OpLoad %v4bool %arg_2 + %24 = OpLoad %v4bool %arg_1 + %25 = OpLoad %v4bool %arg_0 + %22 = OpSelect %v4bool %23 %24 %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %select_e3e028 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %select_e3e028 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %select_e3e028 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl new file mode 100644 index 0000000000..69fe77f464 --- /dev/null +++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_e3e028() { + var arg_0 = vec4(true); + var arg_1 = vec4(true); + var arg_2 = vec4(true); + var res : vec4 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_e3e028(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_e3e028(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_e3e028(); +} diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl new file mode 100644 index 0000000000..3c4235896a --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<3, f32>, vec<3, f32>, vec<3, bool>) -> vec<3, f32> +fn select_ebfea2() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var arg_2 = vec3(true); + var res: vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ebfea2(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ebfea2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ebfea2(); +} diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e60468fcfe --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_ebfea2() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + bool3 arg_2 = (true).xxx; + float3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ebfea2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ebfea2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ebfea2(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e60468fcfe --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_ebfea2() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + bool3 arg_2 = (true).xxx; + float3 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ebfea2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ebfea2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ebfea2(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl new file mode 100644 index 0000000000..38126c63ec --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_ebfea2() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + bvec3 arg_2 = bvec3(true); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_ebfea2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_ebfea2() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + bvec3 arg_2 = bvec3(true); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_ebfea2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_ebfea2() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + bvec3 arg_2 = bvec3(true); + vec3 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_ebfea2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl new file mode 100644 index 0000000000..10ce571773 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_ebfea2() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + bool3 arg_2 = bool3(true); + float3 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ebfea2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ebfea2(); + return; +} + +kernel void compute_main() { + select_ebfea2(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm new file mode 100644 index 0000000000..0657b5e50d --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ebfea2 "select_ebfea2" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %23 = OpConstantComposite %v3bool %true %true %true +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %26 = OpConstantNull %v3bool + %32 = OpTypeFunction %v4float +%select_ebfea2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %arg_2 = OpVariable %_ptr_Function_v3bool Function %26 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %23 + %28 = OpLoad %v3bool %arg_2 + %29 = OpLoad %v3float %arg_1 + %30 = OpLoad %v3float %arg_0 + %27 = OpSelect %v3float %28 %29 %30 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %select_ebfea2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_ebfea2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_ebfea2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl new file mode 100644 index 0000000000..97db546920 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_ebfea2() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var arg_2 = vec3(true); + var res : vec3 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ebfea2(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ebfea2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ebfea2(); +} diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl new file mode 100644 index 0000000000..43274f72ce --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn select(vec<2, f16>, vec<2, f16>, vec<2, bool>) -> vec<2, f16> +fn select_ed7c13() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(true); + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed7c13(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed7c13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed7c13(); +} diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..636eebe094 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_ed7c13() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + bool2 arg_2 = (true).xx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed7c13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed7c13(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..89935f9fd2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.fxc.hlsl @@ -0,0 +1,40 @@ +SKIP: FAILED + +void select_ed7c13() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + bool2 arg_2 = (true).xx; + vector res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed7c13(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed7c13(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002503B521520(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002503B521520(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002503B521520(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl new file mode 100644 index 0000000000..5dbf4afccf --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_ed7c13() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bvec2 arg_2 = bvec2(true); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + select_ed7c13(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void select_ed7c13() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bvec2 arg_2 = bvec2(true); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void fragment_main() { + select_ed7c13(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void select_ed7c13() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + bvec2 arg_2 = bvec2(true); + f16vec2 res = mix(arg_0, arg_1, arg_2); +} + +void compute_main() { + select_ed7c13(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.msl new file mode 100644 index 0000000000..415a0659d3 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_ed7c13() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + bool2 arg_2 = bool2(true); + half2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ed7c13(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ed7c13(); + return; +} + +kernel void compute_main() { + select_ed7c13(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc159cf9e2 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ed7c13 "select_ed7c13" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %22 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %25 = OpConstantNull %v2bool + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ed7c13 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2bool Function %25 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %22 + %27 = OpLoad %v2bool %arg_2 + %28 = OpLoad %v2half %arg_1 + %29 = OpLoad %v2half %arg_0 + %26 = OpSelect %v2half %27 %28 %29 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %select_ed7c13 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_ed7c13 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_ed7c13 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.wgsl new file mode 100644 index 0000000000..67b7d82bd4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed7c13.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn select_ed7c13() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(true); + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed7c13(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed7c13(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed7c13(); +} diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl new file mode 100644 index 0000000000..4569fc521f --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(i32, i32, bool) -> i32 +fn select_ed8a15() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = true; + var res: i32 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed8a15(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed8a15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed8a15(); +} diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a47eb0e4b4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = true; + int res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed8a15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed8a15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed8a15(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a47eb0e4b4 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = true; + int res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_ed8a15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_ed8a15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_ed8a15(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl new file mode 100644 index 0000000000..57b434ca8e --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = true; + int res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_ed8a15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = true; + int res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_ed8a15(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = true; + int res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_ed8a15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl new file mode 100644 index 0000000000..dba6c413f0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_ed8a15() { + int arg_0 = 1; + int arg_1 = 1; + bool arg_2 = true; + int res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_ed8a15(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_ed8a15(); + return; +} + +kernel void compute_main() { + select_ed8a15(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm new file mode 100644 index 0000000000..ecd306f7e0 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_ed8a15 "select_ed8a15" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_ed8a15 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_int Function %17 + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_0 %int_1 + OpStore %arg_1 %int_1 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %int %arg_1 + %27 = OpLoad %int %arg_0 + %24 = OpSelect %int %25 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %select_ed8a15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %select_ed8a15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %41 = OpLabel + %42 = OpFunctionCall %void %select_ed8a15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl new file mode 100644 index 0000000000..c3607cc237 --- /dev/null +++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_ed8a15() { + var arg_0 = 1; + var arg_1 = 1; + var arg_2 = true; + var res : i32 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_ed8a15(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_ed8a15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_ed8a15(); +} diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl new file mode 100644 index 0000000000..bc57d35aae --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn select(vec<2, bool>, vec<2, bool>, bool) -> vec<2, bool> +fn select_fb7e53() { + var arg_0 = vec2(true); + var arg_1 = vec2(true); + var arg_2 = true; + var res: vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_fb7e53(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_fb7e53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_fb7e53(); +} diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db58f482a1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void select_fb7e53() { + bool2 arg_0 = (true).xx; + bool2 arg_1 = (true).xx; + bool arg_2 = true; + bool2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_fb7e53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_fb7e53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_fb7e53(); + return; +} diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..db58f482a1 --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void select_fb7e53() { + bool2 arg_0 = (true).xx; + bool2 arg_1 = (true).xx; + bool arg_2 = true; + bool2 res = (arg_2 ? arg_1 : arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + select_fb7e53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + select_fb7e53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + select_fb7e53(); + return; +} diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl new file mode 100644 index 0000000000..ba17a1bb48 --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void select_fb7e53() { + bvec2 arg_0 = bvec2(true); + bvec2 arg_1 = bvec2(true); + bool arg_2 = true; + bvec2 res = (arg_2 ? arg_1 : arg_0); +} + +vec4 vertex_main() { + select_fb7e53(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void select_fb7e53() { + bvec2 arg_0 = bvec2(true); + bvec2 arg_1 = bvec2(true); + bool arg_2 = true; + bvec2 res = (arg_2 ? arg_1 : arg_0); +} + +void fragment_main() { + select_fb7e53(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void select_fb7e53() { + bvec2 arg_0 = bvec2(true); + bvec2 arg_1 = bvec2(true); + bool arg_2 = true; + bvec2 res = (arg_2 ? arg_1 : arg_0); +} + +void compute_main() { + select_fb7e53(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl new file mode 100644 index 0000000000..4f7aebf107 --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void select_fb7e53() { + bool2 arg_0 = bool2(true); + bool2 arg_1 = bool2(true); + bool arg_2 = true; + bool2 res = select(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + select_fb7e53(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + select_fb7e53(); + return; +} + +kernel void compute_main() { + select_fb7e53(); + return; +} + diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm new file mode 100644 index 0000000000..ce869a995f --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %select_fb7e53 "select_fb7e53" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %16 = OpConstantComposite %v2bool %true %true +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %19 = OpConstantNull %v2bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%select_fb7e53 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2bool Function %19 + %arg_1 = OpVariable %_ptr_Function_v2bool Function %19 + %arg_2 = OpVariable %_ptr_Function_bool Function %23 + %28 = OpVariable %_ptr_Function_v2bool Function %19 + %res = OpVariable %_ptr_Function_v2bool Function %19 + OpStore %arg_0 %16 + OpStore %arg_1 %16 + OpStore %arg_2 %true + %25 = OpLoad %bool %arg_2 + %26 = OpLoad %v2bool %arg_1 + %27 = OpLoad %v2bool %arg_0 + %29 = OpCompositeConstruct %v2bool %25 %25 + %24 = OpSelect %v2bool %29 %26 %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %select_fb7e53 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %40 = OpLabel + %41 = OpFunctionCall %void %select_fb7e53 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %43 = OpLabel + %44 = OpFunctionCall %void %select_fb7e53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2ab9199aa --- /dev/null +++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn select_fb7e53() { + var arg_0 = vec2(true); + var arg_1 = vec2(true); + var arg_2 = true; + var res : vec2 = select(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + select_fb7e53(); + return vec4(); +} + +@fragment +fn fragment_main() { + select_fb7e53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + select_fb7e53(); +} diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl b/test/tint/builtins/gen/var/sign/159665.wgsl new file mode 100644 index 0000000000..b49e5f1cd8 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(vec<3, f32>) -> vec<3, f32> +fn sign_159665() { + var arg_0 = vec3(1.f); + var res: vec3 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_159665(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_159665(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_159665(); +} diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f5abe888e --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_159665() { + float3 arg_0 = (1.0f).xxx; + float3 res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_159665(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_159665(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_159665(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f5abe888e --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sign_159665() { + float3 arg_0 = (1.0f).xxx; + float3 res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_159665(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_159665(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_159665(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl new file mode 100644 index 0000000000..1666599392 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sign_159665() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_159665(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_159665() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sign(arg_0); +} + +void fragment_main() { + sign_159665(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_159665() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sign(arg_0); +} + +void compute_main() { + sign_159665(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl new file mode 100644 index 0000000000..4d43529b52 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_159665() { + float3 arg_0 = float3(1.0f); + float3 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_159665(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_159665(); + return; +} + +kernel void compute_main() { + sign_159665(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm new file mode 100644 index 0000000000..490da92087 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_159665 "sign_159665" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%sign_159665 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 FSign %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %sign_159665 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_159665 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sign_159665 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl new file mode 100644 index 0000000000..b93768d7ee --- /dev/null +++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sign_159665() { + var arg_0 = vec3(1.0f); + var res : vec3 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_159665(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_159665(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_159665(); +} diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl b/test/tint/builtins/gen/var/sign/160933.wgsl new file mode 100644 index 0000000000..3bd21d2d34 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<4, f16>) -> vec<4, f16> +fn sign_160933() { + var arg_0 = vec4(f16()); + var res: vec4 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_160933(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_160933(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_160933(); +} diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5800ea0538 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_160933() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_160933(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_160933(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_160933(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15614dd84d --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sign_160933() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_160933(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_160933(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_160933(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D74F9AEFE0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001D74F9AEFE0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.glsl new file mode 100644 index 0000000000..34a15388a5 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_160933() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_160933(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_160933() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sign(arg_0); +} + +void fragment_main() { + sign_160933(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_160933() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sign(arg_0); +} + +void compute_main() { + sign_160933(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.msl new file mode 100644 index 0000000000..6e7de9c4c2 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_160933() { + half4 arg_0 = half4(0.0h); + half4 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_160933(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_160933(); + return; +} + +kernel void compute_main() { + sign_160933(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.spvasm new file mode 100644 index 0000000000..b1d1b7e55e --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_160933 "sign_160933" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_160933 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 FSign %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sign_160933 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_160933 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sign_160933 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/160933.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.wgsl new file mode 100644 index 0000000000..21ab9a5a47 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/160933.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sign_160933() { + var arg_0 = vec4(f16()); + var res : vec4 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_160933(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_160933(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_160933(); +} diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl new file mode 100644 index 0000000000..0855f7965e --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<3, f16>) -> vec<3, f16> +fn sign_5d283a() { + var arg_0 = vec3(f16()); + var res: vec3 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_5d283a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_5d283a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_5d283a(); +} diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f9a2c34af --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_5d283a() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_5d283a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_5d283a(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f5e127c62 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sign_5d283a() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_5d283a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_5d283a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025242B02410(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025242B02410(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.glsl new file mode 100644 index 0000000000..bb557c08e2 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_5d283a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_5d283a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_5d283a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sign(arg_0); +} + +void fragment_main() { + sign_5d283a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_5d283a() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sign(arg_0); +} + +void compute_main() { + sign_5d283a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.msl new file mode 100644 index 0000000000..06a5e9e1b2 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_5d283a() { + half3 arg_0 = half3(0.0h); + half3 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_5d283a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_5d283a(); + return; +} + +kernel void compute_main() { + sign_5d283a(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.spvasm new file mode 100644 index 0000000000..a65dfc15e2 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_5d283a "sign_5d283a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_5d283a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 FSign %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sign_5d283a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_5d283a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sign_5d283a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.wgsl new file mode 100644 index 0000000000..78cd550cfb --- /dev/null +++ b/test/tint/builtins/gen/var/sign/5d283a.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sign_5d283a() { + var arg_0 = vec3(f16()); + var res : vec3 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_5d283a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_5d283a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_5d283a(); +} diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl new file mode 100644 index 0000000000..55bb282ae3 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(f16) -> f16 +fn sign_7c85ea() { + var arg_0 = f16(); + var res: f16 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_7c85ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_7c85ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_7c85ea(); +} diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..159140c625 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_7c85ea() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_7c85ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_7c85ea(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f270cebf29 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sign_7c85ea() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_7c85ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_7c85ea(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025B195644F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000025B195644F0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.glsl new file mode 100644 index 0000000000..35b29e26ae --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_7c85ea() { + float16_t arg_0 = 0.0hf; + float16_t res = sign(arg_0); +} + +vec4 vertex_main() { + sign_7c85ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_7c85ea() { + float16_t arg_0 = 0.0hf; + float16_t res = sign(arg_0); +} + +void fragment_main() { + sign_7c85ea(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_7c85ea() { + float16_t arg_0 = 0.0hf; + float16_t res = sign(arg_0); +} + +void compute_main() { + sign_7c85ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.msl new file mode 100644 index 0000000000..649103c28a --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_7c85ea() { + half arg_0 = 0.0h; + half res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_7c85ea(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_7c85ea(); + return; +} + +kernel void compute_main() { + sign_7c85ea(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..81d4f68f29 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_7c85ea "sign_7c85ea" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_7c85ea = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 FSign %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sign_7c85ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sign_7c85ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sign_7c85ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d5dd3b8cc --- /dev/null +++ b/test/tint/builtins/gen/var/sign/7c85ea.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sign_7c85ea() { + var arg_0 = f16(); + var res : f16 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_7c85ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_7c85ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_7c85ea(); +} diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl new file mode 100644 index 0000000000..531fe0a736 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(vec<4, f32>) -> vec<4, f32> +fn sign_b8f634() { + var arg_0 = vec4(1.f); + var res: vec4 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_b8f634(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_b8f634(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_b8f634(); +} diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd79825e0c --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_b8f634() { + float4 arg_0 = (1.0f).xxxx; + float4 res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_b8f634(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_b8f634(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_b8f634(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd79825e0c --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sign_b8f634() { + float4 arg_0 = (1.0f).xxxx; + float4 res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_b8f634(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_b8f634(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_b8f634(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl new file mode 100644 index 0000000000..8ef9f02bf7 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sign_b8f634() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_b8f634(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_b8f634() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sign(arg_0); +} + +void fragment_main() { + sign_b8f634(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_b8f634() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sign(arg_0); +} + +void compute_main() { + sign_b8f634(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl new file mode 100644 index 0000000000..78e7a17601 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_b8f634() { + float4 arg_0 = float4(1.0f); + float4 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_b8f634(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_b8f634(); + return; +} + +kernel void compute_main() { + sign_b8f634(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm new file mode 100644 index 0000000000..39b2cc460d --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_b8f634 "sign_b8f634" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%sign_b8f634 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 FSign %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sign_b8f634 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sign_b8f634 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sign_b8f634 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl new file mode 100644 index 0000000000..efd95ce064 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sign_b8f634() { + var arg_0 = vec4(1.0f); + var res : vec4 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_b8f634(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_b8f634(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_b8f634(); +} diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl new file mode 100644 index 0000000000..9796e600b7 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sign(vec<2, f16>) -> vec<2, f16> +fn sign_ccdb3c() { + var arg_0 = vec2(f16()); + var res: vec2 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_ccdb3c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_ccdb3c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_ccdb3c(); +} diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6968272ace --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_ccdb3c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_ccdb3c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_ccdb3c(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2756198dad --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sign_ccdb3c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_ccdb3c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_ccdb3c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027F56D505E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000027F56D505E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.glsl new file mode 100644 index 0000000000..7cd2e5c2f1 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_ccdb3c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_ccdb3c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sign_ccdb3c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sign(arg_0); +} + +void fragment_main() { + sign_ccdb3c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sign_ccdb3c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sign(arg_0); +} + +void compute_main() { + sign_ccdb3c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.msl new file mode 100644 index 0000000000..479a00a2ac --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_ccdb3c() { + half2 arg_0 = half2(0.0h); + half2 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_ccdb3c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_ccdb3c(); + return; +} + +kernel void compute_main() { + sign_ccdb3c(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d7d8e8f7e --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_ccdb3c "sign_ccdb3c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sign_ccdb3c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 FSign %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sign_ccdb3c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_ccdb3c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sign_ccdb3c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.wgsl new file mode 100644 index 0000000000..71231ddbb6 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/ccdb3c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sign_ccdb3c() { + var arg_0 = vec2(f16()); + var res : vec2 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_ccdb3c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_ccdb3c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_ccdb3c(); +} diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl new file mode 100644 index 0000000000..ee8a07b66d --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(vec<2, f32>) -> vec<2, f32> +fn sign_d065d8() { + var arg_0 = vec2(1.f); + var res: vec2 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_d065d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_d065d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_d065d8(); +} diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1c42f9a7d6 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_d065d8() { + float2 arg_0 = (1.0f).xx; + float2 res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_d065d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_d065d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_d065d8(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c42f9a7d6 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sign_d065d8() { + float2 arg_0 = (1.0f).xx; + float2 res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_d065d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_d065d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_d065d8(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl new file mode 100644 index 0000000000..e70621cec8 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sign_d065d8() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sign(arg_0); +} + +vec4 vertex_main() { + sign_d065d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_d065d8() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sign(arg_0); +} + +void fragment_main() { + sign_d065d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_d065d8() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sign(arg_0); +} + +void compute_main() { + sign_d065d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl new file mode 100644 index 0000000000..cc59629539 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_d065d8() { + float2 arg_0 = float2(1.0f); + float2 res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_d065d8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_d065d8(); + return; +} + +kernel void compute_main() { + sign_d065d8(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..b751984fdb --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_d065d8 "sign_d065d8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%sign_d065d8 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 FSign %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %sign_d065d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_d065d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sign_d065d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..f92d409d3f --- /dev/null +++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sign_d065d8() { + var arg_0 = vec2(1.0f); + var res : vec2 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_d065d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_d065d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_d065d8(); +} diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl new file mode 100644 index 0000000000..c5154ace84 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sign(f32) -> f32 +fn sign_dd790e() { + var arg_0 = 1.f; + var res: f32 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_dd790e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_dd790e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_dd790e(); +} diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d0ef005da9 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_dd790e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_dd790e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_dd790e(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d0ef005da9 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sign_dd790e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sign_dd790e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sign_dd790e(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl new file mode 100644 index 0000000000..a34767000c --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +vec4 vertex_main() { + sign_dd790e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +void fragment_main() { + sign_dd790e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +void compute_main() { + sign_dd790e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl new file mode 100644 index 0000000000..8f79ad2df9 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sign_dd790e() { + float arg_0 = 1.0f; + float res = sign(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sign_dd790e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sign_dd790e(); + return; +} + +kernel void compute_main() { + sign_dd790e(); + return; +} + diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ef69f029c --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sign_dd790e "sign_dd790e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%sign_dd790e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 FSign %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sign_dd790e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sign_dd790e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sign_dd790e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl new file mode 100644 index 0000000000..0fa70cc0e9 --- /dev/null +++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sign_dd790e() { + var arg_0 = 1.0f; + var res : f32 = sign(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sign_dd790e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sign_dd790e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sign_dd790e(); +} diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl b/test/tint/builtins/gen/var/sin/01f241.wgsl new file mode 100644 index 0000000000..01345bdfe5 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(vec<3, f32>) -> vec<3, f32> +fn sin_01f241() { + var arg_0 = vec3(1.f); + var res: vec3 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_01f241(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_01f241(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_01f241(); +} diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e8ff0a806b --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_01f241() { + float3 arg_0 = (1.0f).xxx; + float3 res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_01f241(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_01f241(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_01f241(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8ff0a806b --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sin_01f241() { + float3 arg_0 = (1.0f).xxx; + float3 res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_01f241(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_01f241(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_01f241(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl new file mode 100644 index 0000000000..9f99f43209 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sin_01f241() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_01f241(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_01f241() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sin(arg_0); +} + +void fragment_main() { + sin_01f241(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_01f241() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sin(arg_0); +} + +void compute_main() { + sin_01f241(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl new file mode 100644 index 0000000000..d36e8b06c9 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_01f241() { + float3 arg_0 = float3(1.0f); + float3 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_01f241(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_01f241(); + return; +} + +kernel void compute_main() { + sin_01f241(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm new file mode 100644 index 0000000000..14c4afcd67 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_01f241 "sin_01f241" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float + %sin_01f241 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Sin %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %sin_01f241 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_01f241 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sin_01f241 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl new file mode 100644 index 0000000000..41822a417a --- /dev/null +++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sin_01f241() { + var arg_0 = vec3(1.0f); + var res : vec3 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_01f241(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_01f241(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_01f241(); +} diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl new file mode 100644 index 0000000000..d639f9b030 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<3, f16>) -> vec<3, f16> +fn sin_2c903b() { + var arg_0 = vec3(f16()); + var res: vec3 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_2c903b(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_2c903b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_2c903b(); +} diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f4f1c6c931 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_2c903b() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_2c903b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_2c903b(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..06f82a8282 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sin_2c903b() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_2c903b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_2c903b(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022899018770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022899018770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.glsl new file mode 100644 index 0000000000..8af8af092a --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_2c903b() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_2c903b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_2c903b() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sin(arg_0); +} + +void fragment_main() { + sin_2c903b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_2c903b() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sin(arg_0); +} + +void compute_main() { + sin_2c903b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.msl new file mode 100644 index 0000000000..726be54644 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_2c903b() { + half3 arg_0 = half3(0.0h); + half3 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_2c903b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_2c903b(); + return; +} + +kernel void compute_main() { + sin_2c903b(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6340ff0ad --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_2c903b "sin_2c903b" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_2c903b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Sin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sin_2c903b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_2c903b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sin_2c903b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e8f70afb7 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/2c903b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sin_2c903b() { + var arg_0 = vec3(f16()); + var res : vec3 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_2c903b(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_2c903b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_2c903b(); +} diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl new file mode 100644 index 0000000000..fcc4f9f192 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<2, f16>) -> vec<2, f16> +fn sin_3cca11() { + var arg_0 = vec2(f16()); + var res: vec2 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_3cca11(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_3cca11(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_3cca11(); +} diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52c96edba9 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_3cca11() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_3cca11(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_3cca11(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8ea97b8c1e --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sin_3cca11() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_3cca11(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_3cca11(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FCDD1705E0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001FCDD1705E0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.glsl new file mode 100644 index 0000000000..75cdcafa58 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_3cca11() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_3cca11(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_3cca11() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sin(arg_0); +} + +void fragment_main() { + sin_3cca11(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_3cca11() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sin(arg_0); +} + +void compute_main() { + sin_3cca11(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.msl new file mode 100644 index 0000000000..5dbd595150 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_3cca11() { + half2 arg_0 = half2(0.0h); + half2 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_3cca11(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_3cca11(); + return; +} + +kernel void compute_main() { + sin_3cca11(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.spvasm new file mode 100644 index 0000000000..969ca211b2 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_3cca11 "sin_3cca11" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_3cca11 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Sin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sin_3cca11 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_3cca11 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sin_3cca11 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.wgsl new file mode 100644 index 0000000000..34f865d889 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/3cca11.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sin_3cca11() { + var arg_0 = vec2(f16()); + var res : vec2 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_3cca11(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_3cca11(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_3cca11(); +} diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl new file mode 100644 index 0000000000..d4ef5016fe --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(vec<4, f32>) -> vec<4, f32> +fn sin_4e3979() { + var arg_0 = vec4(1.f); + var res: vec4 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_4e3979(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_4e3979(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_4e3979(); +} diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32993b495e --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_4e3979() { + float4 arg_0 = (1.0f).xxxx; + float4 res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_4e3979(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_4e3979(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_4e3979(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32993b495e --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sin_4e3979() { + float4 arg_0 = (1.0f).xxxx; + float4 res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_4e3979(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_4e3979(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_4e3979(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl new file mode 100644 index 0000000000..0134e30c75 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sin_4e3979() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_4e3979(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_4e3979() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sin(arg_0); +} + +void fragment_main() { + sin_4e3979(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_4e3979() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sin(arg_0); +} + +void compute_main() { + sin_4e3979(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl new file mode 100644 index 0000000000..5ea6144da0 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_4e3979() { + float4 arg_0 = float4(1.0f); + float4 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_4e3979(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_4e3979(); + return; +} + +kernel void compute_main() { + sin_4e3979(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm new file mode 100644 index 0000000000..cb3457f908 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_4e3979 "sin_4e3979" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %sin_4e3979 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Sin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sin_4e3979 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sin_4e3979 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sin_4e3979 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl new file mode 100644 index 0000000000..d94d8d267d --- /dev/null +++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sin_4e3979() { + var arg_0 = vec4(1.0f); + var res : vec4 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_4e3979(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_4e3979(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_4e3979(); +} diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl new file mode 100644 index 0000000000..e94e831656 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(vec<4, f16>) -> vec<4, f16> +fn sin_5c0712() { + var arg_0 = vec4(f16()); + var res: vec4 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_5c0712(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_5c0712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_5c0712(); +} diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38a4ccab15 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_5c0712() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_5c0712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_5c0712(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cf3f4d433e --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sin_5c0712() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_5c0712(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_5c0712(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000260A64A2B50(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000260A64A2B50(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.glsl new file mode 100644 index 0000000000..2260625806 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_5c0712() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_5c0712(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_5c0712() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sin(arg_0); +} + +void fragment_main() { + sin_5c0712(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_5c0712() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sin(arg_0); +} + +void compute_main() { + sin_5c0712(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.msl new file mode 100644 index 0000000000..87f6df62f9 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_5c0712() { + half4 arg_0 = half4(0.0h); + half4 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_5c0712(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_5c0712(); + return; +} + +kernel void compute_main() { + sin_5c0712(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.spvasm new file mode 100644 index 0000000000..07ac80981a --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_5c0712 "sin_5c0712" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_5c0712 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Sin %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sin_5c0712 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_5c0712 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sin_5c0712 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.wgsl new file mode 100644 index 0000000000..d737c454f1 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/5c0712.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sin_5c0712() { + var arg_0 = vec4(f16()); + var res : vec4 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_5c0712(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_5c0712(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_5c0712(); +} diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl new file mode 100644 index 0000000000..d73f364e57 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sin(f16) -> f16 +fn sin_66a59f() { + var arg_0 = f16(); + var res: f16 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_66a59f(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_66a59f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_66a59f(); +} diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b1237f82b --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_66a59f() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_66a59f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_66a59f(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..40199e2a2c --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sin_66a59f() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_66a59f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_66a59f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001826042C2F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001826042C2F0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.glsl new file mode 100644 index 0000000000..20ac57e5d7 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_66a59f() { + float16_t arg_0 = 0.0hf; + float16_t res = sin(arg_0); +} + +vec4 vertex_main() { + sin_66a59f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sin_66a59f() { + float16_t arg_0 = 0.0hf; + float16_t res = sin(arg_0); +} + +void fragment_main() { + sin_66a59f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sin_66a59f() { + float16_t arg_0 = 0.0hf; + float16_t res = sin(arg_0); +} + +void compute_main() { + sin_66a59f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.msl new file mode 100644 index 0000000000..1a7188408e --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_66a59f() { + half arg_0 = 0.0h; + half res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_66a59f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_66a59f(); + return; +} + +kernel void compute_main() { + sin_66a59f(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.spvasm new file mode 100644 index 0000000000..f4689fb064 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_66a59f "sin_66a59f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %sin_66a59f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Sin %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sin_66a59f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sin_66a59f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sin_66a59f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.wgsl new file mode 100644 index 0000000000..897e30dd9c --- /dev/null +++ b/test/tint/builtins/gen/var/sin/66a59f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sin_66a59f() { + var arg_0 = f16(); + var res : f16 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_66a59f(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_66a59f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_66a59f(); +} diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl new file mode 100644 index 0000000000..f33be1447f --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(f32) -> f32 +fn sin_b78c91() { + var arg_0 = 1.f; + var res: f32 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_b78c91(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_b78c91(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_b78c91(); +} diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..001dc1b9fd --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_b78c91(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_b78c91(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_b78c91(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..001dc1b9fd --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_b78c91(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_b78c91(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_b78c91(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl new file mode 100644 index 0000000000..97f9d76d56 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +vec4 vertex_main() { + sin_b78c91(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +void fragment_main() { + sin_b78c91(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +void compute_main() { + sin_b78c91(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl new file mode 100644 index 0000000000..8aaa9f7787 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_b78c91() { + float arg_0 = 1.0f; + float res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_b78c91(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_b78c91(); + return; +} + +kernel void compute_main() { + sin_b78c91(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b311132f2 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_b78c91 "sin_b78c91" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %sin_b78c91 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Sin %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sin_b78c91 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sin_b78c91 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_b78c91 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl new file mode 100644 index 0000000000..ea62dd311a --- /dev/null +++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sin_b78c91() { + var arg_0 = 1.0f; + var res : f32 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_b78c91(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_b78c91(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_b78c91(); +} diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl new file mode 100644 index 0000000000..fa779cc170 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sin(vec<2, f32>) -> vec<2, f32> +fn sin_fc8bc4() { + var arg_0 = vec2(1.f); + var res: vec2 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_fc8bc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_fc8bc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_fc8bc4(); +} diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abef57b7a8 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sin_fc8bc4() { + float2 arg_0 = (1.0f).xx; + float2 res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_fc8bc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_fc8bc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_fc8bc4(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..abef57b7a8 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sin_fc8bc4() { + float2 arg_0 = (1.0f).xx; + float2 res = sin(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sin_fc8bc4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sin_fc8bc4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sin_fc8bc4(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl new file mode 100644 index 0000000000..e1341c0ae0 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sin_fc8bc4() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sin(arg_0); +} + +vec4 vertex_main() { + sin_fc8bc4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sin_fc8bc4() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sin(arg_0); +} + +void fragment_main() { + sin_fc8bc4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sin_fc8bc4() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sin(arg_0); +} + +void compute_main() { + sin_fc8bc4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl new file mode 100644 index 0000000000..d303ffe586 --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sin_fc8bc4() { + float2 arg_0 = float2(1.0f); + float2 res = sin(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sin_fc8bc4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sin_fc8bc4(); + return; +} + +kernel void compute_main() { + sin_fc8bc4(); + return; +} + diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm new file mode 100644 index 0000000000..add6aea88d --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sin_fc8bc4 "sin_fc8bc4" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float + %sin_fc8bc4 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Sin %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %sin_fc8bc4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sin_fc8bc4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sin_fc8bc4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl new file mode 100644 index 0000000000..ada801976c --- /dev/null +++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sin_fc8bc4() { + var arg_0 = vec2(1.0f); + var res : vec2 = sin(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sin_fc8bc4(); + return vec4(); +} + +@fragment +fn fragment_main() { + sin_fc8bc4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sin_fc8bc4(); +} diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl new file mode 100644 index 0000000000..13e6f98aba --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<3, f16>) -> vec<3, f16> +fn sinh_0908c1() { + var arg_0 = vec3(f16()); + var res: vec3 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_0908c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_0908c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_0908c1(); +} diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..80c43ed31b --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_0908c1() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_0908c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_0908c1(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..218f8d25d3 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sinh_0908c1() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_0908c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_0908c1(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029A72348830(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000029A72348830(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.glsl new file mode 100644 index 0000000000..5d2c159340 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_0908c1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_0908c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_0908c1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sinh(arg_0); +} + +void fragment_main() { + sinh_0908c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_0908c1() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sinh(arg_0); +} + +void compute_main() { + sinh_0908c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.msl new file mode 100644 index 0000000000..a31c760e22 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_0908c1() { + half3 arg_0 = half3(0.0h); + half3 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_0908c1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_0908c1(); + return; +} + +kernel void compute_main() { + sinh_0908c1(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d347fe26d --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_0908c1 "sinh_0908c1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_0908c1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Sinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sinh_0908c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_0908c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sinh_0908c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..e077d31f8b --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/0908c1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sinh_0908c1() { + var arg_0 = vec3(f16()); + var res : vec3 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_0908c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_0908c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_0908c1(); +} diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl new file mode 100644 index 0000000000..626527a042 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(vec<4, f32>) -> vec<4, f32> +fn sinh_445e33() { + var arg_0 = vec4(1.f); + var res: vec4 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_445e33(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_445e33(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_445e33(); +} diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..29cc9fc15a --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_445e33() { + float4 arg_0 = (1.0f).xxxx; + float4 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_445e33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_445e33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_445e33(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..29cc9fc15a --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sinh_445e33() { + float4 arg_0 = (1.0f).xxxx; + float4 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_445e33(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_445e33(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_445e33(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl new file mode 100644 index 0000000000..6df1cb3595 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sinh_445e33() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_445e33(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_445e33() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sinh(arg_0); +} + +void fragment_main() { + sinh_445e33(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_445e33() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sinh(arg_0); +} + +void compute_main() { + sinh_445e33(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl new file mode 100644 index 0000000000..d4d686d211 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_445e33() { + float4 arg_0 = float4(1.0f); + float4 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_445e33(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_445e33(); + return; +} + +kernel void compute_main() { + sinh_445e33(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm new file mode 100644 index 0000000000..c58c7faa45 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_445e33 "sinh_445e33" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%sinh_445e33 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Sinh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sinh_445e33 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sinh_445e33 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sinh_445e33 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl new file mode 100644 index 0000000000..367c9ebfa8 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sinh_445e33() { + var arg_0 = vec4(1.0f); + var res : vec4 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_445e33(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_445e33(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_445e33(); +} diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl new file mode 100644 index 0000000000..77fa301c62 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(f16) -> f16 +fn sinh_69cce2() { + var arg_0 = f16(); + var res: f16 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_69cce2(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_69cce2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_69cce2(); +} diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4a09bf562b --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_69cce2() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_69cce2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_69cce2(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7029997c74 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sinh_69cce2() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_69cce2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_69cce2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002177048C2F0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002177048C2F0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.glsl new file mode 100644 index 0000000000..62e7689157 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_69cce2() { + float16_t arg_0 = 0.0hf; + float16_t res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_69cce2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_69cce2() { + float16_t arg_0 = 0.0hf; + float16_t res = sinh(arg_0); +} + +void fragment_main() { + sinh_69cce2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_69cce2() { + float16_t arg_0 = 0.0hf; + float16_t res = sinh(arg_0); +} + +void compute_main() { + sinh_69cce2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.msl new file mode 100644 index 0000000000..8c1085407d --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_69cce2() { + half arg_0 = 0.0h; + half res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_69cce2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_69cce2(); + return; +} + +kernel void compute_main() { + sinh_69cce2(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9a45acd2b --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_69cce2 "sinh_69cce2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_69cce2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Sinh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sinh_69cce2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sinh_69cce2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sinh_69cce2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb651b8525 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/69cce2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sinh_69cce2() { + var arg_0 = f16(); + var res : f16 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_69cce2(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_69cce2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_69cce2(); +} diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl new file mode 100644 index 0000000000..48bc9d5cef --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(f32) -> f32 +fn sinh_7bb598() { + var arg_0 = 1.f; + var res: f32 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_7bb598(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_7bb598(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_7bb598(); +} diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1aeb0cdadb --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_7bb598(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_7bb598(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_7bb598(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1aeb0cdadb --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_7bb598(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_7bb598(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_7bb598(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl new file mode 100644 index 0000000000..90e559743a --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_7bb598(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +void fragment_main() { + sinh_7bb598(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +void compute_main() { + sinh_7bb598(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl new file mode 100644 index 0000000000..f78c11ebd8 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_7bb598() { + float arg_0 = 1.0f; + float res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_7bb598(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_7bb598(); + return; +} + +kernel void compute_main() { + sinh_7bb598(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd605b4b2c --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_7bb598 "sinh_7bb598" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%sinh_7bb598 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Sinh %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sinh_7bb598 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sinh_7bb598 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_7bb598 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl new file mode 100644 index 0000000000..fb4583a972 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sinh_7bb598() { + var arg_0 = 1.0f; + var res : f32 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_7bb598(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_7bb598(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_7bb598(); +} diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl new file mode 100644 index 0000000000..5afb8cf721 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<2, f16>) -> vec<2, f16> +fn sinh_924f19() { + var arg_0 = vec2(f16()); + var res: vec2 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_924f19(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_924f19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_924f19(); +} diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd95c74357 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_924f19() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_924f19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_924f19(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65bd9a35c2 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sinh_924f19() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_924f19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_924f19(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023F87A98990(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023F87A98990(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.glsl new file mode 100644 index 0000000000..46efc04741 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_924f19() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_924f19(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_924f19() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sinh(arg_0); +} + +void fragment_main() { + sinh_924f19(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_924f19() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sinh(arg_0); +} + +void compute_main() { + sinh_924f19(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.msl new file mode 100644 index 0000000000..eb99e968ad --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_924f19() { + half2 arg_0 = half2(0.0h); + half2 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_924f19(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_924f19(); + return; +} + +kernel void compute_main() { + sinh_924f19(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.spvasm new file mode 100644 index 0000000000..c1a335dc32 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_924f19 "sinh_924f19" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_924f19 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Sinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sinh_924f19 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_924f19 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sinh_924f19 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6d1440bec --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/924f19.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sinh_924f19() { + var arg_0 = vec2(f16()); + var res : vec2 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_924f19(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_924f19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_924f19(); +} diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl new file mode 100644 index 0000000000..7c3f2d0bbe --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(vec<2, f32>) -> vec<2, f32> +fn sinh_b9860e() { + var arg_0 = vec2(1.f); + var res: vec2 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_b9860e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_b9860e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_b9860e(); +} diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc6a913e97 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_b9860e() { + float2 arg_0 = (1.0f).xx; + float2 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_b9860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_b9860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_b9860e(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fc6a913e97 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sinh_b9860e() { + float2 arg_0 = (1.0f).xx; + float2 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_b9860e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_b9860e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_b9860e(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl new file mode 100644 index 0000000000..613603e8c8 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sinh_b9860e() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_b9860e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_b9860e() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sinh(arg_0); +} + +void fragment_main() { + sinh_b9860e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_b9860e() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sinh(arg_0); +} + +void compute_main() { + sinh_b9860e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl new file mode 100644 index 0000000000..c22f6a3483 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_b9860e() { + float2 arg_0 = float2(1.0f); + float2 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_b9860e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_b9860e(); + return; +} + +kernel void compute_main() { + sinh_b9860e(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm new file mode 100644 index 0000000000..809a295555 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_b9860e "sinh_b9860e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%sinh_b9860e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Sinh %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %sinh_b9860e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_b9860e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sinh_b9860e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl new file mode 100644 index 0000000000..33a4a41c36 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sinh_b9860e() { + var arg_0 = vec2(1.0f); + var res : vec2 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_b9860e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_b9860e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_b9860e(); +} diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl new file mode 100644 index 0000000000..ea5e54c4fb --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sinh(vec<4, f16>) -> vec<4, f16> +fn sinh_ba7e25() { + var arg_0 = vec4(f16()); + var res: vec4 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_ba7e25(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_ba7e25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_ba7e25(); +} diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d40f72623e --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_ba7e25() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_ba7e25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_ba7e25(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6d013e8937 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sinh_ba7e25() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_ba7e25(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_ba7e25(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CF8F9907F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CF8F9907F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.glsl new file mode 100644 index 0000000000..c1e6fe6460 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_ba7e25() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_ba7e25(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sinh_ba7e25() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sinh(arg_0); +} + +void fragment_main() { + sinh_ba7e25(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sinh_ba7e25() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sinh(arg_0); +} + +void compute_main() { + sinh_ba7e25(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.msl new file mode 100644 index 0000000000..c211bfd1a6 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_ba7e25() { + half4 arg_0 = half4(0.0h); + half4 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_ba7e25(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_ba7e25(); + return; +} + +kernel void compute_main() { + sinh_ba7e25(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.spvasm new file mode 100644 index 0000000000..d98c76f598 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_ba7e25 "sinh_ba7e25" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sinh_ba7e25 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Sinh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sinh_ba7e25 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_ba7e25 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sinh_ba7e25 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fdc05007e --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/ba7e25.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sinh_ba7e25() { + var arg_0 = vec4(f16()); + var res : vec4 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_ba7e25(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_ba7e25(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_ba7e25(); +} diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl new file mode 100644 index 0000000000..8a54cb80b9 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sinh(vec<3, f32>) -> vec<3, f32> +fn sinh_c9a5eb() { + var arg_0 = vec3(1.f); + var res: vec3 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_c9a5eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_c9a5eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_c9a5eb(); +} diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..92ed2f7eb9 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sinh_c9a5eb() { + float3 arg_0 = (1.0f).xxx; + float3 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_c9a5eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_c9a5eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_c9a5eb(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..92ed2f7eb9 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sinh_c9a5eb() { + float3 arg_0 = (1.0f).xxx; + float3 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sinh_c9a5eb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sinh_c9a5eb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sinh_c9a5eb(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl new file mode 100644 index 0000000000..2eab0a2aa9 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sinh_c9a5eb() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sinh(arg_0); +} + +vec4 vertex_main() { + sinh_c9a5eb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sinh_c9a5eb() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sinh(arg_0); +} + +void fragment_main() { + sinh_c9a5eb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sinh_c9a5eb() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sinh(arg_0); +} + +void compute_main() { + sinh_c9a5eb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl new file mode 100644 index 0000000000..ba159669c1 --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sinh_c9a5eb() { + float3 arg_0 = float3(1.0f); + float3 res = sinh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sinh_c9a5eb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sinh_c9a5eb(); + return; +} + +kernel void compute_main() { + sinh_c9a5eb(); + return; +} + diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm new file mode 100644 index 0000000000..f5619cd57d --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sinh_c9a5eb "sinh_c9a5eb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%sinh_c9a5eb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Sinh %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %sinh_c9a5eb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sinh_c9a5eb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sinh_c9a5eb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl new file mode 100644 index 0000000000..90f08fb89a --- /dev/null +++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sinh_c9a5eb() { + var arg_0 = vec3(1.0f); + var res : vec3 = sinh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sinh_c9a5eb(); + return vec4(); +} + +@fragment +fn fragment_main() { + sinh_c9a5eb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sinh_c9a5eb(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl new file mode 100644 index 0000000000..630ba4fcce --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<2, f16>, vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn smoothstep_12c031() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res: vec2 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_12c031(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_12c031(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_12c031(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9be0898b47 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_12c031() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_12c031(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_12c031(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8bc939155c --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void smoothstep_12c031() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector arg_2 = (float16_t(0.0h)).xx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_12c031(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_12c031(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E666F5FB00(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E666F5FB00(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E666F5FB00(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001E666F5FB00(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.glsl new file mode 100644 index 0000000000..c5453ff59b --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_12c031() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_12c031(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_12c031() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_12c031(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_12c031() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 arg_2 = f16vec2(0.0hf); + f16vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_12c031(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.msl new file mode 100644 index 0000000000..d21672c1e3 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_12c031() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 arg_2 = half2(0.0h); + half2 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_12c031(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_12c031(); + return; +} + +kernel void compute_main() { + smoothstep_12c031(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.spvasm new file mode 100644 index 0000000000..658663c77b --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_12c031 "smoothstep_12c031" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_12c031 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %arg_2 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v2half %arg_0 + %23 = OpLoad %v2half %arg_1 + %24 = OpLoad %v2half %arg_2 + %20 = OpExtInst %v2half %21 SmoothStep %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %smoothstep_12c031 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_12c031 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %smoothstep_12c031 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.wgsl new file mode 100644 index 0000000000..771f83c71d --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/12c031.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn smoothstep_12c031() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var arg_2 = vec2(f16()); + var res : vec2 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_12c031(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_12c031(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_12c031(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl new file mode 100644 index 0000000000..ef2d2f3b4f --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn smoothstep_392c19() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var arg_2 = vec2(1.f); + var res: vec2 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_392c19(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_392c19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_392c19(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a63dae41f0 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_392c19() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_392c19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_392c19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_392c19(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a63dae41f0 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_392c19() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 arg_2 = (1.0f).xx; + float2 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_392c19(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_392c19(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_392c19(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl new file mode 100644 index 0000000000..9b89ca11f2 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void smoothstep_392c19() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_392c19(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_392c19() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_392c19(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_392c19() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 arg_2 = vec2(1.0f); + vec2 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_392c19(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl new file mode 100644 index 0000000000..a833298557 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_392c19() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 arg_2 = float2(1.0f); + float2 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_392c19(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_392c19(); + return; +} + +kernel void compute_main() { + smoothstep_392c19(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e3a4b1605 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_392c19 "smoothstep_392c19" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %27 = OpTypeFunction %v4float +%smoothstep_392c19 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %arg_2 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v2float %arg_0 + %24 = OpLoad %v2float %arg_1 + %25 = OpLoad %v2float %arg_2 + %21 = OpExtInst %v2float %22 SmoothStep %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_392c19 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_392c19 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %smoothstep_392c19 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d3c0d0ada --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn smoothstep_392c19() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var arg_2 = vec2(1.0f); + var res : vec2 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_392c19(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_392c19(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_392c19(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl new file mode 100644 index 0000000000..9e9ca2e220 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn smoothstep_40864c() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var arg_2 = vec4(1.f); + var res: vec4 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_40864c(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_40864c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_40864c(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c164361fba --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_40864c() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_40864c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_40864c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_40864c(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c164361fba --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_40864c() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 arg_2 = (1.0f).xxxx; + float4 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_40864c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_40864c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_40864c(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl new file mode 100644 index 0000000000..84ac776bcc --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void smoothstep_40864c() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_40864c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_40864c() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_40864c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_40864c() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 arg_2 = vec4(1.0f); + vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_40864c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl new file mode 100644 index 0000000000..6fb06e2f66 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_40864c() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 arg_2 = float4(1.0f); + float4 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_40864c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_40864c(); + return; +} + +kernel void compute_main() { + smoothstep_40864c(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm new file mode 100644 index 0000000000..ae5cf318e1 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_40864c "smoothstep_40864c" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %v4float +%smoothstep_40864c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %v4float %arg_0 + %22 = OpLoad %v4float %arg_1 + %23 = OpLoad %v4float %arg_2 + %19 = OpExtInst %v4float %20 SmoothStep %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %smoothstep_40864c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %smoothstep_40864c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %smoothstep_40864c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6405b6aba --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn smoothstep_40864c() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var arg_2 = vec4(1.0f); + var res : vec4 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_40864c(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_40864c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_40864c(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl new file mode 100644 index 0000000000..55d79620a9 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(f16, f16, f16) -> f16 +fn smoothstep_586e12() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res: f16 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_586e12(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_586e12(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_586e12(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3dd35eb690 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_586e12() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_586e12(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_586e12(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e740197c02 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void smoothstep_586e12() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t arg_2 = float16_t(0.0h); + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_586e12(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_586e12(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CA5325EE80(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001CA5325EE80(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.glsl new file mode 100644 index 0000000000..4aca82eb30 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_586e12() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_586e12(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_586e12() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_586e12(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_586e12() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t arg_2 = 0.0hf; + float16_t res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_586e12(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.msl new file mode 100644 index 0000000000..5b62341cce --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_586e12() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half arg_2 = 0.0h; + half res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_586e12(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_586e12(); + return; +} + +kernel void compute_main() { + smoothstep_586e12(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.spvasm new file mode 100644 index 0000000000..dc12c4697a --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_586e12 "smoothstep_586e12" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_586e12 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %arg_2 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + OpStore %arg_2 %14 + %21 = OpLoad %half %arg_0 + %22 = OpLoad %half %arg_1 + %23 = OpLoad %half %arg_2 + %19 = OpExtInst %half %20 SmoothStep %21 %22 %23 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %smoothstep_586e12 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %smoothstep_586e12 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %smoothstep_586e12 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.wgsl new file mode 100644 index 0000000000..9967bf6593 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/586e12.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn smoothstep_586e12() { + var arg_0 = f16(); + var arg_1 = f16(); + var arg_2 = f16(); + var res : f16 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_586e12(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_586e12(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_586e12(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl new file mode 100644 index 0000000000..e804fd17da --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(f32, f32, f32) -> f32 +fn smoothstep_6c4975() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var arg_2 = 1.f; + var res: f32 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6c4975(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6c4975(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6c4975(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b0bcfc6172 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6c4975(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6c4975(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6c4975(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b0bcfc6172 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6c4975(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6c4975(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6c4975(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl new file mode 100644 index 0000000000..13588501c1 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_6c4975(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_6c4975(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_6c4975(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl new file mode 100644 index 0000000000..0a4293c6d0 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_6c4975() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float arg_2 = 1.0f; + float res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_6c4975(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_6c4975(); + return; +} + +kernel void compute_main() { + smoothstep_6c4975(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm new file mode 100644 index 0000000000..e82372d29a --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_6c4975 "smoothstep_6c4975" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %v4float +%smoothstep_6c4975 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %arg_2 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + OpStore %arg_2 %float_1 + %20 = OpLoad %float %arg_0 + %21 = OpLoad %float %arg_1 + %22 = OpLoad %float %arg_2 + %18 = OpExtInst %float %19 SmoothStep %20 %21 %22 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %smoothstep_6c4975 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %smoothstep_6c4975 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_6c4975 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl new file mode 100644 index 0000000000..eaa85eee7f --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn smoothstep_6c4975() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var arg_2 = 1.0f; + var res : f32 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6c4975(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6c4975(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6c4975(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl new file mode 100644 index 0000000000..fbade6cbff --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<3, f16>, vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn smoothstep_6e7a74() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res: vec3 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6e7a74(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6e7a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6e7a74(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..710439ce57 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_6e7a74() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6e7a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6e7a74(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd99645246 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void smoothstep_6e7a74() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector arg_2 = (float16_t(0.0h)).xxx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_6e7a74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_6e7a74(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E52AF3660(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E52AF3660(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E52AF3660(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018E52AF3660(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.glsl new file mode 100644 index 0000000000..f1ecbb7fa2 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_6e7a74() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_6e7a74(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_6e7a74() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_6e7a74(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_6e7a74() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 arg_2 = f16vec3(0.0hf); + f16vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_6e7a74(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.msl new file mode 100644 index 0000000000..ac08ba83d3 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_6e7a74() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 arg_2 = half3(0.0h); + half3 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_6e7a74(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_6e7a74(); + return; +} + +kernel void compute_main() { + smoothstep_6e7a74(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4fa576d85 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_6e7a74 "smoothstep_6e7a74" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_6e7a74 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %arg_2 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v3half %arg_0 + %23 = OpLoad %v3half %arg_1 + %24 = OpLoad %v3half %arg_2 + %20 = OpExtInst %v3half %21 SmoothStep %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %smoothstep_6e7a74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e668ebf74 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/6e7a74.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn smoothstep_6e7a74() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var arg_2 = vec3(f16()); + var res : vec3 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_6e7a74(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_6e7a74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_6e7a74(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl new file mode 100644 index 0000000000..4096afe3e0 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn smoothstep(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn smoothstep_aad1db() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var arg_2 = vec3(1.f); + var res: vec3 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_aad1db(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_aad1db(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_aad1db(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e6c55ca15 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_aad1db() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_aad1db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_aad1db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_aad1db(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4e6c55ca15 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_aad1db() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 arg_2 = (1.0f).xxx; + float3 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_aad1db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_aad1db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_aad1db(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl new file mode 100644 index 0000000000..632aa04dab --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +void smoothstep_aad1db() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_aad1db(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void smoothstep_aad1db() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_aad1db(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void smoothstep_aad1db() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 arg_2 = vec3(1.0f); + vec3 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_aad1db(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl new file mode 100644 index 0000000000..08e89ff712 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_aad1db() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 arg_2 = float3(1.0f); + float3 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_aad1db(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_aad1db(); + return; +} + +kernel void compute_main() { + smoothstep_aad1db(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm new file mode 100644 index 0000000000..124b722619 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_aad1db "smoothstep_aad1db" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %27 = OpTypeFunction %v4float +%smoothstep_aad1db = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %arg_2 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %23 = OpLoad %v3float %arg_0 + %24 = OpLoad %v3float %arg_1 + %25 = OpLoad %v3float %arg_2 + %21 = OpExtInst %v3float %22 SmoothStep %23 %24 %25 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %smoothstep_aad1db + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_aad1db + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %smoothstep_aad1db + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl new file mode 100644 index 0000000000..b8629a0115 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +fn smoothstep_aad1db() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var arg_2 = vec3(1.0f); + var res : vec3 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_aad1db(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_aad1db(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_aad1db(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl new file mode 100644 index 0000000000..b9a0caf740 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn smoothstep(vec<4, f16>, vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn smoothstep_c43ebd() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res: vec4 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_c43ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_c43ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_c43ebd(); +} diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3bd807dc2a --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void smoothstep_c43ebd() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_c43ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_c43ebd(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dcf7052162 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +void smoothstep_c43ebd() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector arg_2 = (float16_t(0.0h)).xxxx; + vector res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + smoothstep_c43ebd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + smoothstep_c43ebd(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE5BEB1170(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE5BEB1170(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE5BEB1170(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001EE5BEB1170(5,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.glsl new file mode 100644 index 0000000000..66c3b74443 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_c43ebd() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + smoothstep_c43ebd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void smoothstep_c43ebd() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +void fragment_main() { + smoothstep_c43ebd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void smoothstep_c43ebd() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 arg_2 = f16vec4(0.0hf); + f16vec4 res = smoothstep(arg_0, arg_1, arg_2); +} + +void compute_main() { + smoothstep_c43ebd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.msl new file mode 100644 index 0000000000..317c0439c1 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void smoothstep_c43ebd() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 arg_2 = half4(0.0h); + half4 res = smoothstep(arg_0, arg_1, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + smoothstep_c43ebd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + smoothstep_c43ebd(); + return; +} + +kernel void compute_main() { + smoothstep_c43ebd(); + return; +} + diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.spvasm new file mode 100644 index 0000000000..af5f1b0539 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %smoothstep_c43ebd "smoothstep_c43ebd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%smoothstep_c43ebd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %arg_2 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + OpStore %arg_2 %15 + %22 = OpLoad %v4half %arg_0 + %23 = OpLoad %v4half %arg_1 + %24 = OpLoad %v4half %arg_2 + %20 = OpExtInst %v4half %21 SmoothStep %22 %23 %24 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %smoothstep_c43ebd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %smoothstep_c43ebd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %smoothstep_c43ebd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb68100f74 --- /dev/null +++ b/test/tint/builtins/gen/var/smoothstep/c43ebd.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +enable f16; + +fn smoothstep_c43ebd() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var arg_2 = vec4(f16()); + var res : vec4 = smoothstep(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + smoothstep_c43ebd(); + return vec4(); +} + +@fragment +fn fragment_main() { + smoothstep_c43ebd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + smoothstep_c43ebd(); +} diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl new file mode 100644 index 0000000000..d253ffaca7 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(f32) -> f32 +fn sqrt_20c74e() { + var arg_0 = 1.f; + var res: f32 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_20c74e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_20c74e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_20c74e(); +} diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6db93fc191 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_20c74e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_20c74e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_20c74e(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6db93fc191 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_20c74e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_20c74e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_20c74e(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl new file mode 100644 index 0000000000..73ac8a5497 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_20c74e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_20c74e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +void compute_main() { + sqrt_20c74e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl new file mode 100644 index 0000000000..7f9093d554 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_20c74e() { + float arg_0 = 1.0f; + float res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_20c74e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_20c74e(); + return; +} + +kernel void compute_main() { + sqrt_20c74e(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7b4506003 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_20c74e "sqrt_20c74e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%sqrt_20c74e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Sqrt %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %sqrt_20c74e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %sqrt_20c74e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_20c74e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl new file mode 100644 index 0000000000..239eb47ad9 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sqrt_20c74e() { + var arg_0 = 1.0f; + var res : f32 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_20c74e(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_20c74e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_20c74e(); +} diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl new file mode 100644 index 0000000000..39113939f6 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<4, f16>) -> vec<4, f16> +fn sqrt_803d1c() { + var arg_0 = vec4(f16()); + var res: vec4 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_803d1c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_803d1c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_803d1c(); +} diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..58428a6b01 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_803d1c() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_803d1c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_803d1c(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..888036ec97 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sqrt_803d1c() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_803d1c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_803d1c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017B75EA30C0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000017B75EA30C0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.glsl new file mode 100644 index 0000000000..fe15cf8bc8 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_803d1c() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_803d1c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_803d1c() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_803d1c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_803d1c() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_803d1c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.msl new file mode 100644 index 0000000000..f05f55f350 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_803d1c() { + half4 arg_0 = half4(0.0h); + half4 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_803d1c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_803d1c(); + return; +} + +kernel void compute_main() { + sqrt_803d1c(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.spvasm new file mode 100644 index 0000000000..4424826e51 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_803d1c "sqrt_803d1c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_803d1c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Sqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sqrt_803d1c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_803d1c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sqrt_803d1c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c835941e1 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/803d1c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sqrt_803d1c() { + var arg_0 = vec4(f16()); + var res : vec4 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_803d1c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_803d1c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_803d1c(); +} diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl new file mode 100644 index 0000000000..9b4b318ddb --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<3, f16>) -> vec<3, f16> +fn sqrt_895a0c() { + var arg_0 = vec3(f16()); + var res: vec3 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_895a0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_895a0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_895a0c(); +} diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f22d812eea --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_895a0c() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_895a0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_895a0c(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68388d4dd0 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sqrt_895a0c() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_895a0c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_895a0c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000173DFA01300(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000173DFA01300(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.glsl new file mode 100644 index 0000000000..d8f2fbdb98 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_895a0c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_895a0c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_895a0c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_895a0c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_895a0c() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_895a0c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.msl new file mode 100644 index 0000000000..5a04cb5f47 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_895a0c() { + half3 arg_0 = half3(0.0h); + half3 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_895a0c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_895a0c(); + return; +} + +kernel void compute_main() { + sqrt_895a0c(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2fbf41669 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_895a0c "sqrt_895a0c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_895a0c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Sqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sqrt_895a0c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_895a0c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sqrt_895a0c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.wgsl new file mode 100644 index 0000000000..98a857eef2 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/895a0c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sqrt_895a0c() { + var arg_0 = vec3(f16()); + var res : vec3 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_895a0c(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_895a0c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_895a0c(); +} diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl new file mode 100644 index 0000000000..ec9910802a --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(vec<2, f32>) -> vec<2, f32> +fn sqrt_8c7024() { + var arg_0 = vec2(1.f); + var res: vec2 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_8c7024(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_8c7024(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_8c7024(); +} diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c82b5d641 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_8c7024() { + float2 arg_0 = (1.0f).xx; + float2 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_8c7024(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_8c7024(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_8c7024(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c82b5d641 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_8c7024() { + float2 arg_0 = (1.0f).xx; + float2 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_8c7024(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_8c7024(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_8c7024(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl new file mode 100644 index 0000000000..ca45d4a919 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sqrt_8c7024() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_8c7024(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_8c7024() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_8c7024(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_8c7024() { + vec2 arg_0 = vec2(1.0f); + vec2 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_8c7024(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl new file mode 100644 index 0000000000..d6cd786b90 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_8c7024() { + float2 arg_0 = float2(1.0f); + float2 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_8c7024(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_8c7024(); + return; +} + +kernel void compute_main() { + sqrt_8c7024(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm new file mode 100644 index 0000000000..b49d96c9b3 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_8c7024 "sqrt_8c7024" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%sqrt_8c7024 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Sqrt %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %sqrt_8c7024 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_8c7024 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sqrt_8c7024 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl new file mode 100644 index 0000000000..37caec7f26 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sqrt_8c7024() { + var arg_0 = vec2(1.0f); + var res : vec2 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_8c7024(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_8c7024(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_8c7024(); +} diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl new file mode 100644 index 0000000000..9bd6212abe --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(vec<4, f32>) -> vec<4, f32> +fn sqrt_aa0d7a() { + var arg_0 = vec4(1.f); + var res: vec4 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_aa0d7a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_aa0d7a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_aa0d7a(); +} diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..09b9d922d1 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_aa0d7a() { + float4 arg_0 = (1.0f).xxxx; + float4 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_aa0d7a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_aa0d7a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_aa0d7a(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..09b9d922d1 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_aa0d7a() { + float4 arg_0 = (1.0f).xxxx; + float4 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_aa0d7a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_aa0d7a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_aa0d7a(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl new file mode 100644 index 0000000000..8f5ac2a73d --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sqrt_aa0d7a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_aa0d7a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_aa0d7a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_aa0d7a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_aa0d7a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_aa0d7a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl new file mode 100644 index 0000000000..ee5234d84f --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_aa0d7a() { + float4 arg_0 = float4(1.0f); + float4 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_aa0d7a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_aa0d7a(); + return; +} + +kernel void compute_main() { + sqrt_aa0d7a(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm new file mode 100644 index 0000000000..f48213ad2e --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_aa0d7a "sqrt_aa0d7a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%sqrt_aa0d7a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Sqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sqrt_aa0d7a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %sqrt_aa0d7a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %sqrt_aa0d7a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c7c972a0c --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sqrt_aa0d7a() { + var arg_0 = vec4(1.0f); + var res : vec4 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_aa0d7a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_aa0d7a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_aa0d7a(); +} diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl new file mode 100644 index 0000000000..4be2cc6159 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(vec<2, f16>) -> vec<2, f16> +fn sqrt_d9ab4d() { + var arg_0 = vec2(f16()); + var res: vec2 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_d9ab4d(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_d9ab4d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_d9ab4d(); +} diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..472d31d5b0 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_d9ab4d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_d9ab4d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_d9ab4d(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2dae4c2799 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sqrt_d9ab4d() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_d9ab4d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_d9ab4d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261E9DA1200(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000261E9DA1200(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.glsl new file mode 100644 index 0000000000..3cf2d1dfe3 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_d9ab4d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_d9ab4d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_d9ab4d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_d9ab4d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_d9ab4d() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_d9ab4d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.msl new file mode 100644 index 0000000000..39f7f69031 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_d9ab4d() { + half2 arg_0 = half2(0.0h); + half2 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_d9ab4d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_d9ab4d(); + return; +} + +kernel void compute_main() { + sqrt_d9ab4d(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d02e8ccccf --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_d9ab4d "sqrt_d9ab4d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_d9ab4d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Sqrt %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %sqrt_d9ab4d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_d9ab4d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sqrt_d9ab4d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd6f05c191 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/d9ab4d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sqrt_d9ab4d() { + var arg_0 = vec2(f16()); + var res : vec2 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_d9ab4d(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_d9ab4d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_d9ab4d(); +} diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl new file mode 100644 index 0000000000..7a8254056f --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn sqrt(f16) -> f16 +fn sqrt_ec33e9() { + var arg_0 = f16(); + var res: f16 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_ec33e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_ec33e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_ec33e9(); +} diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a0b3d5f96a --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_ec33e9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_ec33e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_ec33e9(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9a31e1357d --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void sqrt_ec33e9() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_ec33e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_ec33e9(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A68F39AB60(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002A68F39AB60(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.glsl new file mode 100644 index 0000000000..5cb1a665d1 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_ec33e9() { + float16_t arg_0 = 0.0hf; + float16_t res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_ec33e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void sqrt_ec33e9() { + float16_t arg_0 = 0.0hf; + float16_t res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_ec33e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void sqrt_ec33e9() { + float16_t arg_0 = 0.0hf; + float16_t res = sqrt(arg_0); +} + +void compute_main() { + sqrt_ec33e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.msl new file mode 100644 index 0000000000..8f4e72e4a6 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_ec33e9() { + half arg_0 = 0.0h; + half res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_ec33e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_ec33e9(); + return; +} + +kernel void compute_main() { + sqrt_ec33e9(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..c593eced59 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_ec33e9 "sqrt_ec33e9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%sqrt_ec33e9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Sqrt %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %sqrt_ec33e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %sqrt_ec33e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %sqrt_ec33e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..af947c5c5e --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/ec33e9.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn sqrt_ec33e9() { + var arg_0 = f16(); + var res : f16 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_ec33e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_ec33e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_ec33e9(); +} diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl new file mode 100644 index 0000000000..9b15edf348 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn sqrt(vec<3, f32>) -> vec<3, f32> +fn sqrt_f8c59a() { + var arg_0 = vec3(1.f); + var res: vec3 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_f8c59a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_f8c59a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_f8c59a(); +} diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f7d971362 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_f8c59a() { + float3 arg_0 = (1.0f).xxx; + float3 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_f8c59a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_f8c59a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_f8c59a(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5f7d971362 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void sqrt_f8c59a() { + float3 arg_0 = (1.0f).xxx; + float3 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + sqrt_f8c59a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + sqrt_f8c59a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + sqrt_f8c59a(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl new file mode 100644 index 0000000000..45e447b9d8 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void sqrt_f8c59a() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sqrt(arg_0); +} + +vec4 vertex_main() { + sqrt_f8c59a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void sqrt_f8c59a() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sqrt(arg_0); +} + +void fragment_main() { + sqrt_f8c59a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void sqrt_f8c59a() { + vec3 arg_0 = vec3(1.0f); + vec3 res = sqrt(arg_0); +} + +void compute_main() { + sqrt_f8c59a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl new file mode 100644 index 0000000000..c0abaebf15 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void sqrt_f8c59a() { + float3 arg_0 = float3(1.0f); + float3 res = sqrt(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + sqrt_f8c59a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + sqrt_f8c59a(); + return; +} + +kernel void compute_main() { + sqrt_f8c59a(); + return; +} + diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm new file mode 100644 index 0000000000..7a009b58cc --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %sqrt_f8c59a "sqrt_f8c59a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%sqrt_f8c59a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Sqrt %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %sqrt_f8c59a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %sqrt_f8c59a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %sqrt_f8c59a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl new file mode 100644 index 0000000000..248cee4e57 --- /dev/null +++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn sqrt_f8c59a() { + var arg_0 = vec3(1.0f); + var res : vec3 = sqrt(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + sqrt_f8c59a(); + return vec4(); +} + +@fragment +fn fragment_main() { + sqrt_f8c59a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + sqrt_f8c59a(); +} diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl b/test/tint/builtins/gen/var/step/07cb06.wgsl new file mode 100644 index 0000000000..a85442c490 --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<2, f16>, vec<2, f16>) -> vec<2, f16> +fn step_07cb06() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res: vec2 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_07cb06(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_07cb06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_07cb06(); +} diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..58b3876a6e --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_07cb06() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_07cb06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_07cb06(); + return; +} diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f643e8f03b --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void step_07cb06() { + vector arg_0 = (float16_t(0.0h)).xx; + vector arg_1 = (float16_t(0.0h)).xx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_07cb06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_07cb06(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FD2EC2DB0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FD2EC2DB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026FD2EC2DB0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.glsl new file mode 100644 index 0000000000..028ea1c5aa --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_07cb06() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_07cb06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_07cb06() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_07cb06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_07cb06() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 arg_1 = f16vec2(0.0hf); + f16vec2 res = step(arg_0, arg_1); +} + +void compute_main() { + step_07cb06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.msl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.msl new file mode 100644 index 0000000000..e831f9197e --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_07cb06() { + half2 arg_0 = half2(0.0h); + half2 arg_1 = half2(0.0h); + half2 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_07cb06(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_07cb06(); + return; +} + +kernel void compute_main() { + step_07cb06(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.spvasm new file mode 100644 index 0000000000..17f336aa19 --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_07cb06 "step_07cb06" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_07cb06 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %arg_1 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v2half %arg_0 + %22 = OpLoad %v2half %arg_1 + %19 = OpExtInst %v2half %20 Step %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %step_07cb06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_07cb06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %step_07cb06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.wgsl new file mode 100644 index 0000000000..373395d8ea --- /dev/null +++ b/test/tint/builtins/gen/var/step/07cb06.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn step_07cb06() { + var arg_0 = vec2(f16()); + var arg_1 = vec2(f16()); + var res : vec2 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_07cb06(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_07cb06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_07cb06(); +} diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl b/test/tint/builtins/gen/var/step/0b073b.wgsl new file mode 100644 index 0000000000..acf3c92385 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(f32, f32) -> f32 +fn step_0b073b() { + var arg_0 = 1.f; + var arg_1 = 1.f; + var res: f32 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_0b073b(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_0b073b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_0b073b(); +} diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..19c85c99c9 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_0b073b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_0b073b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_0b073b(); + return; +} diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..19c85c99c9 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_0b073b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_0b073b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_0b073b(); + return; +} diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl new file mode 100644 index 0000000000..3708760c51 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_0b073b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +void fragment_main() { + step_0b073b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +void compute_main() { + step_0b073b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl new file mode 100644 index 0000000000..275ddb6091 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_0b073b() { + float arg_0 = 1.0f; + float arg_1 = 1.0f; + float res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_0b073b(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_0b073b(); + return; +} + +kernel void compute_main() { + step_0b073b(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm new file mode 100644 index 0000000000..a9e8e76f2a --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_0b073b "step_0b073b" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %v4float +%step_0b073b = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %arg_1 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + OpStore %arg_1 %float_1 + %19 = OpLoad %float %arg_0 + %20 = OpLoad %float %arg_1 + %17 = OpExtInst %float %18 Step %19 %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %step_0b073b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %step_0b073b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_0b073b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f570285d53 --- /dev/null +++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn step_0b073b() { + var arg_0 = 1.0f; + var arg_1 = 1.0f; + var res : f32 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_0b073b(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_0b073b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_0b073b(); +} diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl b/test/tint/builtins/gen/var/step/19accd.wgsl new file mode 100644 index 0000000000..79ffaf0e84 --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(vec<2, f32>, vec<2, f32>) -> vec<2, f32> +fn step_19accd() { + var arg_0 = vec2(1.f); + var arg_1 = vec2(1.f); + var res: vec2 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_19accd(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_19accd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_19accd(); +} diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b59f5215a5 --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_19accd() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_19accd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_19accd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_19accd(); + return; +} diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b59f5215a5 --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void step_19accd() { + float2 arg_0 = (1.0f).xx; + float2 arg_1 = (1.0f).xx; + float2 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_19accd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_19accd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_19accd(); + return; +} diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl new file mode 100644 index 0000000000..475218ff23 --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void step_19accd() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_19accd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_19accd() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_19accd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_19accd() { + vec2 arg_0 = vec2(1.0f); + vec2 arg_1 = vec2(1.0f); + vec2 res = step(arg_0, arg_1); +} + +void compute_main() { + step_19accd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl new file mode 100644 index 0000000000..affcc0ba42 --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_19accd() { + float2 arg_0 = float2(1.0f); + float2 arg_1 = float2(1.0f); + float2 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_19accd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_19accd(); + return; +} + +kernel void compute_main() { + step_19accd(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d25d5f7cc --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_19accd "step_19accd" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float +%step_19accd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %arg_1 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v2float %arg_0 + %23 = OpLoad %v2float %arg_1 + %20 = OpExtInst %v2float %21 Step %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %step_19accd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_19accd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %step_19accd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl new file mode 100644 index 0000000000..a47486530e --- /dev/null +++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn step_19accd() { + var arg_0 = vec2(1.0f); + var arg_1 = vec2(1.0f); + var res : vec2 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_19accd(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_19accd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_19accd(); +} diff --git a/test/tint/builtins/gen/var/step/334303.wgsl b/test/tint/builtins/gen/var/step/334303.wgsl new file mode 100644 index 0000000000..5d289132fc --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(vec<3, f32>, vec<3, f32>) -> vec<3, f32> +fn step_334303() { + var arg_0 = vec3(1.f); + var arg_1 = vec3(1.f); + var res: vec3 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_334303(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_334303(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_334303(); +} diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4de9136234 --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_334303() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_334303(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_334303(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_334303(); + return; +} diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4de9136234 --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void step_334303() { + float3 arg_0 = (1.0f).xxx; + float3 arg_1 = (1.0f).xxx; + float3 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_334303(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_334303(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_334303(); + return; +} diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl new file mode 100644 index 0000000000..b1bc1b6492 --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void step_334303() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_334303(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_334303() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_334303(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_334303() { + vec3 arg_0 = vec3(1.0f); + vec3 arg_1 = vec3(1.0f); + vec3 res = step(arg_0, arg_1); +} + +void compute_main() { + step_334303(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.msl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.msl new file mode 100644 index 0000000000..cac7c059f8 --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_334303() { + float3 arg_0 = float3(1.0f); + float3 arg_1 = float3(1.0f); + float3 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_334303(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_334303(); + return; +} + +kernel void compute_main() { + step_334303(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f9fe018aa --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_334303 "step_334303" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %25 = OpTypeFunction %v4float +%step_334303 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %arg_1 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %22 = OpLoad %v3float %arg_0 + %23 = OpLoad %v3float %arg_1 + %20 = OpExtInst %v3float %21 Step %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %step_334303 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_334303 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %step_334303 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl new file mode 100644 index 0000000000..70b550730f --- /dev/null +++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn step_334303() { + var arg_0 = vec3(1.0f); + var arg_1 = vec3(1.0f); + var res : vec3 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_334303(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_334303(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_334303(); +} diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl b/test/tint/builtins/gen/var/step/630d07.wgsl new file mode 100644 index 0000000000..7b19969d6b --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(f16, f16) -> f16 +fn step_630d07() { + var arg_0 = f16(); + var arg_1 = f16(); + var res: f16 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_630d07(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_630d07(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_630d07(); +} diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..12473dfc9c --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_630d07() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_630d07(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_630d07(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_630d07(); + return; +} diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1d7db44f9f --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +void step_630d07() { + float16_t arg_0 = float16_t(0.0h); + float16_t arg_1 = float16_t(0.0h); + float16_t res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_630d07(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_630d07(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_630d07(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024979951900(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000024979951900(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.glsl new file mode 100644 index 0000000000..a937e6ce10 --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_630d07() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_630d07(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_630d07() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = step(arg_0, arg_1); +} + +void fragment_main() { + step_630d07(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_630d07() { + float16_t arg_0 = 0.0hf; + float16_t arg_1 = 0.0hf; + float16_t res = step(arg_0, arg_1); +} + +void compute_main() { + step_630d07(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.msl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.msl new file mode 100644 index 0000000000..7367608eb9 --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_630d07() { + half arg_0 = 0.0h; + half arg_1 = 0.0h; + half res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_630d07(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_630d07(); + return; +} + +kernel void compute_main() { + step_630d07(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ec1055e0b --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_630d07 "step_630d07" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_630d07 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %arg_1 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %half %arg_0 + %21 = OpLoad %half %arg_1 + %18 = OpExtInst %half %19 Step %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %step_630d07 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %step_630d07 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %step_630d07 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/630d07.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.wgsl new file mode 100644 index 0000000000..fb6884c9a2 --- /dev/null +++ b/test/tint/builtins/gen/var/step/630d07.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn step_630d07() { + var arg_0 = f16(); + var arg_1 = f16(); + var res : f16 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_630d07(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_630d07(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_630d07(); +} diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl b/test/tint/builtins/gen/var/step/baa320.wgsl new file mode 100644 index 0000000000..48a8fe6f58 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<4, f16>, vec<4, f16>) -> vec<4, f16> +fn step_baa320() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res: vec4 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_baa320(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_baa320(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_baa320(); +} diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..11ad9989a1 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_baa320() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_baa320(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_baa320(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_baa320(); + return; +} diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7bae936940 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void step_baa320() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector arg_1 = (float16_t(0.0h)).xxxx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_baa320(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_baa320(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_baa320(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD0BA42C40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD0BA42C40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD0BA42C40(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.glsl new file mode 100644 index 0000000000..6ac70dfe28 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_baa320() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_baa320(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_baa320() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_baa320(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_baa320() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 arg_1 = f16vec4(0.0hf); + f16vec4 res = step(arg_0, arg_1); +} + +void compute_main() { + step_baa320(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.msl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.msl new file mode 100644 index 0000000000..e0841af8a9 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_baa320() { + half4 arg_0 = half4(0.0h); + half4 arg_1 = half4(0.0h); + half4 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_baa320(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_baa320(); + return; +} + +kernel void compute_main() { + step_baa320(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.spvasm new file mode 100644 index 0000000000..57e7451db6 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_baa320 "step_baa320" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_baa320 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %arg_1 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v4half %arg_0 + %22 = OpLoad %v4half %arg_1 + %19 = OpExtInst %v4half %20 Step %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %step_baa320 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_baa320 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %step_baa320 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/baa320.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.wgsl new file mode 100644 index 0000000000..6128002318 --- /dev/null +++ b/test/tint/builtins/gen/var/step/baa320.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn step_baa320() { + var arg_0 = vec4(f16()); + var arg_1 = vec4(f16()); + var res : vec4 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_baa320(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_baa320(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_baa320(); +} diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl new file mode 100644 index 0000000000..7b954e0a83 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl @@ -0,0 +1,47 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn step(vec<3, f16>, vec<3, f16>) -> vec<3, f16> +fn step_cc6b61() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res: vec3 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_cc6b61(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_cc6b61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_cc6b61(); +} diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47f0c73c65 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_cc6b61() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_cc6b61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_cc6b61(); + return; +} diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..285ad21905 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.fxc.hlsl @@ -0,0 +1,39 @@ +SKIP: FAILED + +void step_cc6b61() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector arg_1 = (float16_t(0.0h)).xxx; + vector res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_cc6b61(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_cc6b61(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013865172DA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013865172DA0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013865172DA0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.glsl new file mode 100644 index 0000000000..6b1be2e7b0 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_cc6b61() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_cc6b61(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void step_cc6b61() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_cc6b61(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void step_cc6b61() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 arg_1 = f16vec3(0.0hf); + f16vec3 res = step(arg_0, arg_1); +} + +void compute_main() { + step_cc6b61(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.msl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.msl new file mode 100644 index 0000000000..40defbb646 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_cc6b61() { + half3 arg_0 = half3(0.0h); + half3 arg_1 = half3(0.0h); + half3 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_cc6b61(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_cc6b61(); + return; +} + +kernel void compute_main() { + step_cc6b61(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.spvasm new file mode 100644 index 0000000000..efbdfdce90 --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_cc6b61 "step_cc6b61" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%step_cc6b61 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %arg_1 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + OpStore %arg_1 %15 + %21 = OpLoad %v3half %arg_0 + %22 = OpLoad %v3half %arg_1 + %19 = OpExtInst %v3half %20 Step %21 %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %step_cc6b61 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %step_cc6b61 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %step_cc6b61 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.wgsl new file mode 100644 index 0000000000..68bf8277df --- /dev/null +++ b/test/tint/builtins/gen/var/step/cc6b61.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +enable f16; + +fn step_cc6b61() { + var arg_0 = vec3(f16()); + var arg_1 = vec3(f16()); + var res : vec3 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_cc6b61(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_cc6b61(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_cc6b61(); +} diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl b/test/tint/builtins/gen/var/step/e2b337.wgsl new file mode 100644 index 0000000000..77dbbee6c7 --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn step(vec<4, f32>, vec<4, f32>) -> vec<4, f32> +fn step_e2b337() { + var arg_0 = vec4(1.f); + var arg_1 = vec4(1.f); + var res: vec4 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_e2b337(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_e2b337(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_e2b337(); +} diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8c5c8d03e7 --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +void step_e2b337() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_e2b337(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_e2b337(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_e2b337(); + return; +} diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c5c8d03e7 --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void step_e2b337() { + float4 arg_0 = (1.0f).xxxx; + float4 arg_1 = (1.0f).xxxx; + float4 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + step_e2b337(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + step_e2b337(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + step_e2b337(); + return; +} diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl new file mode 100644 index 0000000000..7455c108fa --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +void step_e2b337() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = step(arg_0, arg_1); +} + +vec4 vertex_main() { + step_e2b337(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void step_e2b337() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = step(arg_0, arg_1); +} + +void fragment_main() { + step_e2b337(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void step_e2b337() { + vec4 arg_0 = vec4(1.0f); + vec4 arg_1 = vec4(1.0f); + vec4 res = step(arg_0, arg_1); +} + +void compute_main() { + step_e2b337(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl new file mode 100644 index 0000000000..1fc7c3170a --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void step_e2b337() { + float4 arg_0 = float4(1.0f); + float4 arg_1 = float4(1.0f); + float4 res = step(arg_0, arg_1); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + step_e2b337(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + step_e2b337(); + return; +} + +kernel void compute_main() { + step_e2b337(); + return; +} + diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm new file mode 100644 index 0000000000..2aa2b49189 --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %step_e2b337 "step_e2b337" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float +%step_e2b337 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %arg_1 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + OpStore %arg_1 %14 + %20 = OpLoad %v4float %arg_0 + %21 = OpLoad %v4float %arg_1 + %18 = OpExtInst %v4float %19 Step %20 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %step_e2b337 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %step_e2b337 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %step_e2b337 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl new file mode 100644 index 0000000000..5dd29a4924 --- /dev/null +++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +fn step_e2b337() { + var arg_0 = vec4(1.0f); + var arg_1 = vec4(1.0f); + var res : vec4 = step(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + step_e2b337(); + return vec4(); +} + +@fragment +fn fragment_main() { + step_e2b337(); +} + +@compute @workgroup_size(1) +fn compute_main() { + step_e2b337(); +} diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl new file mode 100644 index 0000000000..19f89822e6 --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn storageBarrier() +fn storageBarrier_d87211() { + storageBarrier(); +} + +@compute @workgroup_size(1) +fn compute_main() { + storageBarrier_d87211(); +} diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8fb7cf9462 --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void storageBarrier_d87211() { + DeviceMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void compute_main() { + storageBarrier_d87211(); + return; +} diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8fb7cf9462 --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void storageBarrier_d87211() { + DeviceMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void compute_main() { + storageBarrier_d87211(); + return; +} diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl new file mode 100644 index 0000000000..025e85c90d --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es + +void storageBarrier_d87211() { + { barrier(); memoryBarrierBuffer(); }; +} + +void compute_main() { + storageBarrier_d87211(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl new file mode 100644 index 0000000000..53da7477a2 --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void storageBarrier_d87211() { + threadgroup_barrier(mem_flags::mem_device); +} + +kernel void compute_main() { + storageBarrier_d87211(); + return; +} + diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm new file mode 100644 index 0000000000..79f2372a0d --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %storageBarrier_d87211 "storageBarrier_d87211" + OpName %compute_main "compute_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_72 = OpConstant %uint 72 +%storageBarrier_d87211 = OpFunction %void None %1 + %4 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_72 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %1 + %10 = OpLabel + %11 = OpFunctionCall %void %storageBarrier_d87211 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl new file mode 100644 index 0000000000..b92968109a --- /dev/null +++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn storageBarrier_d87211() { + storageBarrier(); +} + +@compute @workgroup_size(1) +fn compute_main() { + storageBarrier_d87211(); +} diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl new file mode 100644 index 0000000000..04844436a2 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(vec<4, f32>) -> vec<4, f32> +fn tan_244e2a() { + var arg_0 = vec4(1.f); + var res: vec4 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_244e2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_244e2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_244e2a(); +} diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..415a64c95c --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_244e2a() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_244e2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_244e2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_244e2a(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..415a64c95c --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void tan_244e2a() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_244e2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_244e2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_244e2a(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl new file mode 100644 index 0000000000..1785332435 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tan_244e2a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_244e2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_244e2a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tan(arg_0); +} + +void fragment_main() { + tan_244e2a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_244e2a() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tan(arg_0); +} + +void compute_main() { + tan_244e2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl new file mode 100644 index 0000000000..80d74762d2 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_244e2a() { + float4 arg_0 = float4(1.0f); + float4 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_244e2a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_244e2a(); + return; +} + +kernel void compute_main() { + tan_244e2a(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..5e535822e9 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_244e2a "tan_244e2a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float + %tan_244e2a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Tan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tan_244e2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tan_244e2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tan_244e2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..49715cc448 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tan_244e2a() { + var arg_0 = vec4(1.0f); + var res : vec4 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_244e2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_244e2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_244e2a(); +} diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl new file mode 100644 index 0000000000..e03b1eef8f --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(f32) -> f32 +fn tan_2f030e() { + var arg_0 = 1.f; + var res: f32 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_2f030e(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_2f030e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_2f030e(); +} diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b3863b59f3 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_2f030e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_2f030e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_2f030e(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b3863b59f3 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_2f030e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_2f030e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_2f030e(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl new file mode 100644 index 0000000000..5075b832a7 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +vec4 vertex_main() { + tan_2f030e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +void fragment_main() { + tan_2f030e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +void compute_main() { + tan_2f030e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl new file mode 100644 index 0000000000..ca719b5d27 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_2f030e() { + float arg_0 = 1.0f; + float res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_2f030e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_2f030e(); + return; +} + +kernel void compute_main() { + tan_2f030e(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm new file mode 100644 index 0000000000..57d1c9b9b4 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_2f030e "tan_2f030e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float + %tan_2f030e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Tan %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tan_2f030e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tan_2f030e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_2f030e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2fb49b282 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tan_2f030e() { + var arg_0 = 1.0f; + var res : f32 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_2f030e(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_2f030e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_2f030e(); +} diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl b/test/tint/builtins/gen/var/tan/539e54.wgsl new file mode 100644 index 0000000000..1b4dec5ab8 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<4, f16>) -> vec<4, f16> +fn tan_539e54() { + var arg_0 = vec4(f16()); + var res: vec4 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_539e54(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_539e54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_539e54(); +} diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..57565884af --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_539e54() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_539e54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_539e54(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9329384d5 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tan_539e54() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_539e54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_539e54(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AE30C0C880(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002AE30C0C880(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.glsl new file mode 100644 index 0000000000..7b8a22d361 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_539e54() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_539e54(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_539e54() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tan(arg_0); +} + +void fragment_main() { + tan_539e54(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_539e54() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tan(arg_0); +} + +void compute_main() { + tan_539e54(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.msl new file mode 100644 index 0000000000..6c347d9b27 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_539e54() { + half4 arg_0 = half4(0.0h); + half4 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_539e54(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_539e54(); + return; +} + +kernel void compute_main() { + tan_539e54(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.spvasm new file mode 100644 index 0000000000..3808f8e208 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_539e54 "tan_539e54" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_539e54 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Tan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tan_539e54 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_539e54 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tan_539e54 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.wgsl new file mode 100644 index 0000000000..ceb00cf272 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/539e54.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tan_539e54() { + var arg_0 = vec4(f16()); + var res : vec4 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_539e54(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_539e54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_539e54(); +} diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl new file mode 100644 index 0000000000..46f4a2b49d --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(vec<3, f32>) -> vec<3, f32> +fn tan_7ea104() { + var arg_0 = vec3(1.f); + var res: vec3 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_7ea104(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_7ea104(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_7ea104(); +} diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6090fd69b2 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_7ea104() { + float3 arg_0 = (1.0f).xxx; + float3 res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_7ea104(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_7ea104(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_7ea104(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6090fd69b2 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void tan_7ea104() { + float3 arg_0 = (1.0f).xxx; + float3 res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_7ea104(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_7ea104(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_7ea104(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl new file mode 100644 index 0000000000..3114bf0079 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tan_7ea104() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_7ea104(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_7ea104() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tan(arg_0); +} + +void fragment_main() { + tan_7ea104(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_7ea104() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tan(arg_0); +} + +void compute_main() { + tan_7ea104(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl new file mode 100644 index 0000000000..0eb10fb291 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_7ea104() { + float3 arg_0 = float3(1.0f); + float3 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_7ea104(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_7ea104(); + return; +} + +kernel void compute_main() { + tan_7ea104(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm new file mode 100644 index 0000000000..69c8aeba58 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_7ea104 "tan_7ea104" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float + %tan_7ea104 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Tan %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %tan_7ea104 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_7ea104 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tan_7ea104 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl new file mode 100644 index 0000000000..99240ec8a2 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tan_7ea104() { + var arg_0 = vec3(1.0f); + var res : vec3 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_7ea104(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_7ea104(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_7ea104(); +} diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl new file mode 100644 index 0000000000..327a3e65bd --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tan(vec<2, f32>) -> vec<2, f32> +fn tan_8ce3e9() { + var arg_0 = vec2(1.f); + var res: vec2 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_8ce3e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_8ce3e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_8ce3e9(); +} diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66df261199 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_8ce3e9() { + float2 arg_0 = (1.0f).xx; + float2 res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_8ce3e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_8ce3e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_8ce3e9(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66df261199 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void tan_8ce3e9() { + float2 arg_0 = (1.0f).xx; + float2 res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_8ce3e9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_8ce3e9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_8ce3e9(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl new file mode 100644 index 0000000000..812a83ed92 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tan_8ce3e9() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_8ce3e9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tan_8ce3e9() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tan(arg_0); +} + +void fragment_main() { + tan_8ce3e9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tan_8ce3e9() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tan(arg_0); +} + +void compute_main() { + tan_8ce3e9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl new file mode 100644 index 0000000000..94890c4d83 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_8ce3e9() { + float2 arg_0 = float2(1.0f); + float2 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_8ce3e9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_8ce3e9(); + return; +} + +kernel void compute_main() { + tan_8ce3e9(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm new file mode 100644 index 0000000000..09c5c1aafb --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_8ce3e9 "tan_8ce3e9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float + %tan_8ce3e9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Tan %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %tan_8ce3e9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_8ce3e9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tan_8ce3e9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl new file mode 100644 index 0000000000..13d8264ab9 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tan_8ce3e9() { + var arg_0 = vec2(1.0f); + var res : vec2 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_8ce3e9(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_8ce3e9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_8ce3e9(); +} diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl new file mode 100644 index 0000000000..812610e314 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<2, f16>) -> vec<2, f16> +fn tan_9f7c9c() { + var arg_0 = vec2(f16()); + var res: vec2 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_9f7c9c(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_9f7c9c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_9f7c9c(); +} diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2dc0ec5de1 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_9f7c9c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_9f7c9c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_9f7c9c(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bfffaf2a2a --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tan_9f7c9c() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_9f7c9c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_9f7c9c(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013C12D4B340(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000013C12D4B340(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.glsl new file mode 100644 index 0000000000..fa9d31ee2d --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_9f7c9c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_9f7c9c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_9f7c9c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tan(arg_0); +} + +void fragment_main() { + tan_9f7c9c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_9f7c9c() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tan(arg_0); +} + +void compute_main() { + tan_9f7c9c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.msl new file mode 100644 index 0000000000..5e664677fe --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_9f7c9c() { + half2 arg_0 = half2(0.0h); + half2 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_9f7c9c(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_9f7c9c(); + return; +} + +kernel void compute_main() { + tan_9f7c9c(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.spvasm new file mode 100644 index 0000000000..f4068eea16 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_9f7c9c "tan_9f7c9c" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_9f7c9c = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Tan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tan_9f7c9c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_9f7c9c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tan_9f7c9c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.wgsl new file mode 100644 index 0000000000..87305cc0f9 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/9f7c9c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tan_9f7c9c() { + var arg_0 = vec2(f16()); + var res : vec2 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_9f7c9c(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_9f7c9c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_9f7c9c(); +} diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl new file mode 100644 index 0000000000..3d3c9fa05c --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(f16) -> f16 +fn tan_d4d491() { + var arg_0 = f16(); + var res: f16 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_d4d491(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_d4d491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_d4d491(); +} diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fb9b0ef077 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_d4d491() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_d4d491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_d4d491(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6df8e23220 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tan_d4d491() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_d4d491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_d4d491(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026911B52E20(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000026911B52E20(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.glsl new file mode 100644 index 0000000000..c826b6bddb --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_d4d491() { + float16_t arg_0 = 0.0hf; + float16_t res = tan(arg_0); +} + +vec4 vertex_main() { + tan_d4d491(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_d4d491() { + float16_t arg_0 = 0.0hf; + float16_t res = tan(arg_0); +} + +void fragment_main() { + tan_d4d491(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_d4d491() { + float16_t arg_0 = 0.0hf; + float16_t res = tan(arg_0); +} + +void compute_main() { + tan_d4d491(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.msl new file mode 100644 index 0000000000..792203e59a --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_d4d491() { + half arg_0 = 0.0h; + half res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_d4d491(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_d4d491(); + return; +} + +kernel void compute_main() { + tan_d4d491(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.spvasm new file mode 100644 index 0000000000..e05388b753 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_d4d491 "tan_d4d491" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_d4d491 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Tan %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tan_d4d491 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tan_d4d491 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %tan_d4d491 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.wgsl new file mode 100644 index 0000000000..34abd8dc84 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/d4d491.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tan_d4d491() { + var arg_0 = f16(); + var res : f16 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_d4d491(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_d4d491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_d4d491(); +} diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl b/test/tint/builtins/gen/var/tan/db0456.wgsl new file mode 100644 index 0000000000..0277fd9754 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tan(vec<3, f16>) -> vec<3, f16> +fn tan_db0456() { + var arg_0 = vec3(f16()); + var res: vec3 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_db0456(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_db0456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_db0456(); +} diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b14a91a10d --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tan_db0456() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_db0456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_db0456(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2c6f4b3f76 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tan_db0456() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tan(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tan_db0456(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tan_db0456(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022CB9A7E270(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022CB9A7E270(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.glsl new file mode 100644 index 0000000000..06986581e9 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_db0456() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tan(arg_0); +} + +vec4 vertex_main() { + tan_db0456(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tan_db0456() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tan(arg_0); +} + +void fragment_main() { + tan_db0456(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tan_db0456() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tan(arg_0); +} + +void compute_main() { + tan_db0456(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.msl new file mode 100644 index 0000000000..35e012d6fa --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tan_db0456() { + half3 arg_0 = half3(0.0h); + half3 res = tan(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tan_db0456(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tan_db0456(); + return; +} + +kernel void compute_main() { + tan_db0456(); + return; +} + diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.spvasm new file mode 100644 index 0000000000..66a7ba7c63 --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tan_db0456 "tan_db0456" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %tan_db0456 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Tan %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tan_db0456 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tan_db0456 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tan_db0456 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.wgsl new file mode 100644 index 0000000000..fb3a092f1e --- /dev/null +++ b/test/tint/builtins/gen/var/tan/db0456.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tan_db0456() { + var arg_0 = vec3(f16()); + var res : vec3 = tan(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tan_db0456(); + return vec4(); +} + +@fragment +fn fragment_main() { + tan_db0456(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tan_db0456(); +} diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl new file mode 100644 index 0000000000..4c328b0616 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<3, f16>) -> vec<3, f16> +fn tanh_06a4fe() { + var arg_0 = vec3(f16()); + var res: vec3 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_06a4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_06a4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_06a4fe(); +} diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..346965fc45 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_06a4fe() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_06a4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_06a4fe(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a8775d630f --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tanh_06a4fe() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_06a4fe(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_06a4fe(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028509F68770(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000028509F68770(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.glsl new file mode 100644 index 0000000000..6d9857aa0c --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_06a4fe() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_06a4fe(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_06a4fe() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tanh(arg_0); +} + +void fragment_main() { + tanh_06a4fe(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_06a4fe() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = tanh(arg_0); +} + +void compute_main() { + tanh_06a4fe(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.msl new file mode 100644 index 0000000000..3f2db876d4 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_06a4fe() { + half3 arg_0 = half3(0.0h); + half3 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_06a4fe(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_06a4fe(); + return; +} + +kernel void compute_main() { + tanh_06a4fe(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a02492154 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_06a4fe "tanh_06a4fe" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_06a4fe = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Tanh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tanh_06a4fe + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_06a4fe + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tanh_06a4fe + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f73c44a8c --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/06a4fe.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tanh_06a4fe() { + var arg_0 = vec3(f16()); + var res : vec3 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_06a4fe(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_06a4fe(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_06a4fe(); +} diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl new file mode 100644 index 0000000000..04c12a72cb --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(vec<4, f32>) -> vec<4, f32> +fn tanh_5663c5() { + var arg_0 = vec4(1.f); + var res: vec4 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5663c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5663c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5663c5(); +} diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..527fc5be9f --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_5663c5() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5663c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5663c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5663c5(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..527fc5be9f --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void tanh_5663c5() { + float4 arg_0 = (1.0f).xxxx; + float4 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5663c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5663c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5663c5(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl new file mode 100644 index 0000000000..715eac62e2 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tanh_5663c5() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_5663c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_5663c5() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tanh(arg_0); +} + +void fragment_main() { + tanh_5663c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_5663c5() { + vec4 arg_0 = vec4(1.0f); + vec4 res = tanh(arg_0); +} + +void compute_main() { + tanh_5663c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl new file mode 100644 index 0000000000..1780f88f61 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_5663c5() { + float4 arg_0 = float4(1.0f); + float4 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5663c5(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5663c5(); + return; +} + +kernel void compute_main() { + tanh_5663c5(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm new file mode 100644 index 0000000000..4afbb8b69d --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5663c5 "tanh_5663c5" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%tanh_5663c5 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Tanh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tanh_5663c5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %tanh_5663c5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %tanh_5663c5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c91cac8cb --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tanh_5663c5() { + var arg_0 = vec4(1.0f); + var res : vec4 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5663c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5663c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5663c5(); +} diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl new file mode 100644 index 0000000000..65217eef97 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(vec<2, f32>) -> vec<2, f32> +fn tanh_5724b3() { + var arg_0 = vec2(1.f); + var res: vec2 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5724b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5724b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5724b3(); +} diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2b68673450 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_5724b3() { + float2 arg_0 = (1.0f).xx; + float2 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5724b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5724b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5724b3(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2b68673450 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void tanh_5724b3() { + float2 arg_0 = (1.0f).xx; + float2 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5724b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5724b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5724b3(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl new file mode 100644 index 0000000000..3eacd11118 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tanh_5724b3() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_5724b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_5724b3() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tanh(arg_0); +} + +void fragment_main() { + tanh_5724b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_5724b3() { + vec2 arg_0 = vec2(1.0f); + vec2 res = tanh(arg_0); +} + +void compute_main() { + tanh_5724b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl new file mode 100644 index 0000000000..dea0ceb809 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_5724b3() { + float2 arg_0 = float2(1.0f); + float2 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5724b3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5724b3(); + return; +} + +kernel void compute_main() { + tanh_5724b3(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b576dcf6e --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5724b3 "tanh_5724b3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%tanh_5724b3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Tanh %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %tanh_5724b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_5724b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tanh_5724b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7bea1967b --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tanh_5724b3() { + var arg_0 = vec2(1.0f); + var res : vec2 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5724b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5724b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5724b3(); +} diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl new file mode 100644 index 0000000000..1b1cc793f1 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(f16) -> f16 +fn tanh_5b19af() { + var arg_0 = f16(); + var res: f16 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5b19af(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5b19af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5b19af(); +} diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..23e33a7e32 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_5b19af() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5b19af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5b19af(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c81022257 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tanh_5b19af() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_5b19af(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_5b19af(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A07EE64130(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A07EE64130(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.glsl new file mode 100644 index 0000000000..27503fc53a --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_5b19af() { + float16_t arg_0 = 0.0hf; + float16_t res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_5b19af(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_5b19af() { + float16_t arg_0 = 0.0hf; + float16_t res = tanh(arg_0); +} + +void fragment_main() { + tanh_5b19af(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_5b19af() { + float16_t arg_0 = 0.0hf; + float16_t res = tanh(arg_0); +} + +void compute_main() { + tanh_5b19af(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.msl new file mode 100644 index 0000000000..143fb989b5 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_5b19af() { + half arg_0 = 0.0h; + half res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_5b19af(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_5b19af(); + return; +} + +kernel void compute_main() { + tanh_5b19af(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.spvasm new file mode 100644 index 0000000000..9ea5007efe --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_5b19af "tanh_5b19af" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_5b19af = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Tanh %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %tanh_5b19af + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %tanh_5b19af + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %tanh_5b19af + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1f8363f16 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/5b19af.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tanh_5b19af() { + var arg_0 = f16(); + var res : f16 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_5b19af(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_5b19af(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_5b19af(); +} diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl new file mode 100644 index 0000000000..08d3e6bb2c --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<2, f16>) -> vec<2, f16> +fn tanh_6d105a() { + var arg_0 = vec2(f16()); + var res: vec2 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_6d105a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_6d105a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_6d105a(); +} diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cb526b42f1 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_6d105a() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_6d105a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_6d105a(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56aff70fb8 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tanh_6d105a() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_6d105a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_6d105a(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022C76563400(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022C76563400(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.glsl new file mode 100644 index 0000000000..ab61ec7a4a --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_6d105a() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_6d105a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_6d105a() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tanh(arg_0); +} + +void fragment_main() { + tanh_6d105a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_6d105a() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = tanh(arg_0); +} + +void compute_main() { + tanh_6d105a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.msl new file mode 100644 index 0000000000..1affd276c0 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_6d105a() { + half2 arg_0 = half2(0.0h); + half2 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_6d105a(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_6d105a(); + return; +} + +kernel void compute_main() { + tanh_6d105a(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fa93ec8a1 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_6d105a "tanh_6d105a" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_6d105a = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Tanh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tanh_6d105a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_6d105a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tanh_6d105a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.wgsl new file mode 100644 index 0000000000..b638ef85ac --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/6d105a.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tanh_6d105a() { + var arg_0 = vec2(f16()); + var res : vec2 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_6d105a(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_6d105a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_6d105a(); +} diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl new file mode 100644 index 0000000000..cd782f0c21 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(vec<3, f32>) -> vec<3, f32> +fn tanh_9f9fb9() { + var arg_0 = vec3(1.f); + var res: vec3 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_9f9fb9(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_9f9fb9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_9f9fb9(); +} diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7af3f448a2 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_9f9fb9() { + float3 arg_0 = (1.0f).xxx; + float3 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_9f9fb9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_9f9fb9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_9f9fb9(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7af3f448a2 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void tanh_9f9fb9() { + float3 arg_0 = (1.0f).xxx; + float3 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_9f9fb9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_9f9fb9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_9f9fb9(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl new file mode 100644 index 0000000000..48c56e87f1 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tanh_9f9fb9() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_9f9fb9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_9f9fb9() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tanh(arg_0); +} + +void fragment_main() { + tanh_9f9fb9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_9f9fb9() { + vec3 arg_0 = vec3(1.0f); + vec3 res = tanh(arg_0); +} + +void compute_main() { + tanh_9f9fb9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl new file mode 100644 index 0000000000..abecf13b60 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_9f9fb9() { + float3 arg_0 = float3(1.0f); + float3 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_9f9fb9(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_9f9fb9(); + return; +} + +kernel void compute_main() { + tanh_9f9fb9(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm new file mode 100644 index 0000000000..007cba69da --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_9f9fb9 "tanh_9f9fb9" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%tanh_9f9fb9 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Tanh %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %tanh_9f9fb9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_9f9fb9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tanh_9f9fb9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl new file mode 100644 index 0000000000..b32a672800 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tanh_9f9fb9() { + var arg_0 = vec3(1.0f); + var res : vec3 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_9f9fb9(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_9f9fb9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_9f9fb9(); +} diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl new file mode 100644 index 0000000000..1353ca096f --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn tanh(f32) -> f32 +fn tanh_c15fdb() { + var arg_0 = 1.f; + var res: f32 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_c15fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_c15fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_c15fdb(); +} diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38d4981b80 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_c15fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_c15fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_c15fdb(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38d4981b80 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_c15fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_c15fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_c15fdb(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl new file mode 100644 index 0000000000..5682daf5bb --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_c15fdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +void fragment_main() { + tanh_c15fdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +void compute_main() { + tanh_c15fdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl new file mode 100644 index 0000000000..81b49244b9 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_c15fdb() { + float arg_0 = 1.0f; + float res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_c15fdb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_c15fdb(); + return; +} + +kernel void compute_main() { + tanh_c15fdb(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm new file mode 100644 index 0000000000..8722def7cc --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_c15fdb "tanh_c15fdb" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%tanh_c15fdb = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Tanh %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %tanh_c15fdb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %tanh_c15fdb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_c15fdb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..6f0f550cc8 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn tanh_c15fdb() { + var arg_0 = 1.0f; + var res : f32 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_c15fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_c15fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_c15fdb(); +} diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl new file mode 100644 index 0000000000..8091075e2e --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn tanh(vec<4, f16>) -> vec<4, f16> +fn tanh_e8efb3() { + var arg_0 = vec4(f16()); + var res: vec4 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_e8efb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_e8efb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_e8efb3(); +} diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..26cb7ee5b7 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void tanh_e8efb3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_e8efb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_e8efb3(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ce063183d --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void tanh_e8efb3() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = tanh(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + tanh_e8efb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + tanh_e8efb3(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020C348DBBA0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020C348DBBA0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.glsl new file mode 100644 index 0000000000..1d866b6cdc --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_e8efb3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tanh(arg_0); +} + +vec4 vertex_main() { + tanh_e8efb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void tanh_e8efb3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tanh(arg_0); +} + +void fragment_main() { + tanh_e8efb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void tanh_e8efb3() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = tanh(arg_0); +} + +void compute_main() { + tanh_e8efb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.msl new file mode 100644 index 0000000000..0b5e6f4d96 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void tanh_e8efb3() { + half4 arg_0 = half4(0.0h); + half4 res = tanh(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + tanh_e8efb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + tanh_e8efb3(); + return; +} + +kernel void compute_main() { + tanh_e8efb3(); + return; +} + diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e079164d6 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %tanh_e8efb3 "tanh_e8efb3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%tanh_e8efb3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Tanh %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %tanh_e8efb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %tanh_e8efb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %tanh_e8efb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..bdb2905503 --- /dev/null +++ b/test/tint/builtins/gen/var/tanh/e8efb3.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn tanh_e8efb3() { + var arg_0 = vec4(f16()); + var res : vec4 = tanh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + tanh_e8efb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + tanh_e8efb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + tanh_e8efb3(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl new file mode 100644 index 0000000000..8ca4261cbd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d) -> i32 +fn textureDimensions_002b2a() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_002b2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_002b2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_002b2a(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..29d0c12d90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_002b2a() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_002b2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_002b2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_002b2a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..29d0c12d90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_002b2a() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_002b2a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_002b2a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_002b2a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl new file mode 100644 index 0000000000..9ee3490e43 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_002b2a() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_002b2a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureDimensions_002b2a() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_002b2a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_002b2a() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_002b2a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl new file mode 100644 index 0000000000..b5b212146d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_002b2a(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_002b2a(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_002b2a(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_002b2a(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm new file mode 100644 index 0000000000..178d73b8ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_002b2a "textureDimensions_002b2a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_002b2a = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %int %18 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_002b2a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_002b2a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_002b2a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl new file mode 100644 index 0000000000..5f09068124 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_002b2a() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_002b2a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_002b2a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_002b2a(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl new file mode 100644 index 0000000000..3fd6388d25 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_012b82() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_012b82(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_012b82(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_012b82(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..56fb818a4f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_012b82() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_012b82(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_012b82(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_012b82(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56fb818a4f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_012b82() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_012b82(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_012b82(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_012b82(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl new file mode 100644 index 0000000000..9ae3c1ba4a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_012b82() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_012b82(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_012b82() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_012b82(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_012b82() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_012b82(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl new file mode 100644 index 0000000000..f53807b875 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_012b82(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_012b82(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_012b82(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_012b82(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm new file mode 100644 index 0000000000..4e8d502e64 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_012b82 "textureDimensions_012b82" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_012b82 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_012b82 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_012b82 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_012b82 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl new file mode 100644 index 0000000000..216df4f29f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_012b82() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_012b82(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_012b82(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_012b82(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl new file mode 100644 index 0000000000..2b1e057b00 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_08753d() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_08753d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_08753d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_08753d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83011fff55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_08753d() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_08753d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_08753d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_08753d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83011fff55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_08753d() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_08753d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_08753d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_08753d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl new file mode 100644 index 0000000000..0b0f9e39c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_08753d() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_08753d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_08753d() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_08753d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_08753d() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_08753d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl new file mode 100644 index 0000000000..a1fa2f3981 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_08753d(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_08753d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_08753d(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_08753d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm new file mode 100644 index 0000000000..8854f381d1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_08753d "textureDimensions_08753d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_08753d = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_08753d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_08753d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_08753d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl new file mode 100644 index 0000000000..443a678ed3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_08753d() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_08753d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_08753d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_08753d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl new file mode 100644 index 0000000000..6341954156 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_0c4772() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0c4772(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0c4772(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0c4772(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3de620cf2c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0c4772() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0c4772(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0c4772(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0c4772(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3de620cf2c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0c4772() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0c4772(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0c4772(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0c4772(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl new file mode 100644 index 0000000000..f58182c691 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureDimensions_0c4772() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0c4772(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureDimensions_0c4772() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0c4772(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureDimensions_0c4772() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0c4772(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl new file mode 100644 index 0000000000..cc675e6c22 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0c4772(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_0c4772(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0c4772(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0c4772(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm new file mode 100644 index 0000000000..77d91d556e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0c4772 "textureDimensions_0c4772" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0c4772 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_0c4772 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_0c4772 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_0c4772 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc2907df4a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_0c4772() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0c4772(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0c4772(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0c4772(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl new file mode 100644 index 0000000000..9b72fc3321 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_0cce40() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cce40(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0cce40(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0cce40(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e10fdf6f36 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_0cce40() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cce40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cce40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cce40(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e10fdf6f36 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_0cce40() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cce40(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cce40(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cce40(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl new file mode 100644 index 0000000000..a0df901a1e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_0cce40() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0cce40(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_0cce40() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0cce40(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_0cce40() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0cce40(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl new file mode 100644 index 0000000000..e95504846d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0cce40(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_0cce40(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0cce40(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0cce40(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm new file mode 100644 index 0000000000..51c3c1474a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0cce40 "textureDimensions_0cce40" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0cce40 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_0cce40 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_0cce40 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_0cce40 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl new file mode 100644 index 0000000000..5193665715 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_0cce40() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cce40(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0cce40(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0cce40(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl new file mode 100644 index 0000000000..82980ef15c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_0cf2ff() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cf2ff(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0cf2ff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0cf2ff(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3b9fd521cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_0cf2ff() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cf2ff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cf2ff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cf2ff(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3b9fd521cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_0cf2ff() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0cf2ff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0cf2ff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0cf2ff(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl new file mode 100644 index 0000000000..d91c9dbce7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_0cf2ff() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0cf2ff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_0cf2ff() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0cf2ff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_0cf2ff() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0cf2ff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl new file mode 100644 index 0000000000..875a38898b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0cf2ff(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_0cf2ff(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0cf2ff(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0cf2ff(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm new file mode 100644 index 0000000000..aece995648 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0cf2ff "textureDimensions_0cf2ff" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0cf2ff = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_0cf2ff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_0cf2ff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_0cf2ff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl new file mode 100644 index 0000000000..a13b916c8a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_0cf2ff() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0cf2ff(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0cf2ff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0cf2ff(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl new file mode 100644 index 0000000000..1a88f862ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_0d8b7e() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0d8b7e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0d8b7e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0d8b7e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..848d8b7dae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_0d8b7e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0d8b7e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0d8b7e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0d8b7e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..848d8b7dae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_0d8b7e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0d8b7e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0d8b7e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0d8b7e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl new file mode 100644 index 0000000000..19bb91aa0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_0d8b7e() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_0d8b7e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_0d8b7e() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_0d8b7e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_0d8b7e() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_0d8b7e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl new file mode 100644 index 0000000000..d07d72a409 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0d8b7e(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_0d8b7e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_0d8b7e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_0d8b7e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm new file mode 100644 index 0000000000..c5406d7f5f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0d8b7e "textureDimensions_0d8b7e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0d8b7e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_0d8b7e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_0d8b7e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_0d8b7e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ce14eadae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_0d8b7e() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0d8b7e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0d8b7e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0d8b7e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl new file mode 100644 index 0000000000..cad4daed9f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_0e32ee() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0e32ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0e32ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0e32ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f338cc3fc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0e32ee() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0e32ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0e32ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0e32ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f338cc3fc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_0e32ee() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0e32ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0e32ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0e32ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl new file mode 100644 index 0000000000..3b004866e0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_0e32ee() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_0e32ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_0e32ee() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_0e32ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_0e32ee() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_0e32ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl new file mode 100644 index 0000000000..376e7b1473 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0e32ee(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_0e32ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_0e32ee(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_0e32ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..c045a1aeb6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0e32ee "textureDimensions_0e32ee" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0e32ee = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_0e32ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_0e32ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_0e32ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..c037616b43 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_0e32ee() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0e32ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0e32ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0e32ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl new file mode 100644 index 0000000000..ed32924912 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array) -> vec2 +fn textureDimensions_0f3c50() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0f3c50(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0f3c50(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0f3c50(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5bef2982da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_0f3c50() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0f3c50(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0f3c50(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0f3c50(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5bef2982da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_0f3c50() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_0f3c50(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_0f3c50(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_0f3c50(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl new file mode 100644 index 0000000000..da53ee88db --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_0f3c50() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_0f3c50(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_0f3c50() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_0f3c50(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_0f3c50() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_0f3c50(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl new file mode 100644 index 0000000000..9e6f6ab279 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_0f3c50(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_0f3c50(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_0f3c50(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_0f3c50(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm new file mode 100644 index 0000000000..53a9a618c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_0f3c50 "textureDimensions_0f3c50" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_0f3c50 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_0f3c50 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_0f3c50 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_0f3c50 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl new file mode 100644 index 0000000000..45eee36977 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_0f3c50() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_0f3c50(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_0f3c50(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_0f3c50(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl new file mode 100644 index 0000000000..d035ecdb6f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d) -> vec2 +fn textureDimensions_1191a5() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1191a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1191a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1191a5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cedbfad032 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_1191a5() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1191a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1191a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1191a5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cedbfad032 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_1191a5() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1191a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1191a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1191a5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl new file mode 100644 index 0000000000..0514b2e300 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_1191a5() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_1191a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureDimensions_1191a5() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_1191a5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_1191a5() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_1191a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl new file mode 100644 index 0000000000..c08c723d33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1191a5(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_1191a5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_1191a5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_1191a5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm new file mode 100644 index 0000000000..1cc88e1923 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1191a5 "textureDimensions_1191a5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1191a5 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %20 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_1191a5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_1191a5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_1191a5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0e1745f76 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_1191a5() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1191a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1191a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1191a5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl new file mode 100644 index 0000000000..7361cba087 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureDimensions(texture: texture_depth_2d, level: i32) -> vec2 +fn textureDimensions_12c9bb() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_12c9bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_12c9bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_12c9bb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6ae5d7780f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_12c9bb() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_12c9bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_12c9bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_12c9bb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ae5d7780f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_12c9bb() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_12c9bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_12c9bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_12c9bb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl new file mode 100644 index 0000000000..c64c5eb66a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_12c9bb() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_12c9bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_12c9bb() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_12c9bb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_12c9bb() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_12c9bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl new file mode 100644 index 0000000000..2fb2f57aef --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_12c9bb(depth2d tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureDimensions_12c9bb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_12c9bb(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_12c9bb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm new file mode 100644 index 0000000000..72881d5f4a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_12c9bb "textureDimensions_12c9bb" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_12c9bb = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_12c9bb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_12c9bb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_12c9bb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..bbeb242256 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureDimensions_12c9bb() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_12c9bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_12c9bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_12c9bb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl new file mode 100644 index 0000000000..8a884251bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_147998() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_147998(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_147998(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_147998(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af1e9bd856 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_147998() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_147998(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_147998(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_147998(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af1e9bd856 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_147998() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_147998(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_147998(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_147998(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl new file mode 100644 index 0000000000..90d19e81e0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureDimensions_147998() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_147998(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureDimensions_147998() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_147998(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureDimensions_147998() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_147998(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl new file mode 100644 index 0000000000..25431038ea --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_147998(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_147998(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_147998(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_147998(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e80b7d798 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_147998 "textureDimensions_147998" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_147998 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_147998 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_147998 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_147998 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl new file mode 100644 index 0000000000..8379507811 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_147998() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_147998(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_147998(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_147998(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl new file mode 100644 index 0000000000..a1baa9600b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_16036c() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_16036c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_16036c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_16036c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..02565baa5f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_16036c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_16036c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_16036c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_16036c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..02565baa5f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_16036c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_16036c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_16036c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_16036c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl new file mode 100644 index 0000000000..5e4d6923f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_16036c() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_16036c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_16036c() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_16036c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_16036c() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_16036c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl new file mode 100644 index 0000000000..4872c899f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_16036c(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_16036c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_16036c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_16036c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm new file mode 100644 index 0000000000..af24793179 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_16036c "textureDimensions_16036c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_16036c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_16036c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_16036c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_16036c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a9c5f30b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_16036c() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_16036c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_16036c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_16036c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl new file mode 100644 index 0000000000..d77491e2f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_1b71f0() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1b71f0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1b71f0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1b71f0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1ffa3d3b90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_1b71f0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1b71f0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1b71f0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1b71f0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1ffa3d3b90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_1b71f0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1b71f0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1b71f0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1b71f0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl new file mode 100644 index 0000000000..16bd5b604e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_1b71f0() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_1b71f0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_1b71f0() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_1b71f0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_1b71f0() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_1b71f0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl new file mode 100644 index 0000000000..9ef7f55bb6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1b71f0(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_1b71f0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_1b71f0(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_1b71f0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba6dd6a703 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1b71f0 "textureDimensions_1b71f0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1b71f0 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_1b71f0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_1b71f0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_1b71f0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee928e222f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_1b71f0() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1b71f0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1b71f0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1b71f0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl new file mode 100644 index 0000000000..b5cb5d958d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_1d6c26() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1d6c26(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1d6c26(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1d6c26(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..26140a05d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_1d6c26() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1d6c26(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1d6c26(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1d6c26(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26140a05d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_1d6c26() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1d6c26(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1d6c26(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1d6c26(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl new file mode 100644 index 0000000000..bea79ae702 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureDimensions_1d6c26() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_1d6c26(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureDimensions_1d6c26() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_1d6c26(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureDimensions_1d6c26() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_1d6c26(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl new file mode 100644 index 0000000000..65d506dd62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1d6c26(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_1d6c26(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_1d6c26(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_1d6c26(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm new file mode 100644 index 0000000000..f0feca547e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1d6c26 "textureDimensions_1d6c26" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1d6c26 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_1d6c26 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_1d6c26 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_1d6c26 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl new file mode 100644 index 0000000000..8bb5c22cd9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_1d6c26() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1d6c26(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1d6c26(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1d6c26(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl new file mode 100644 index 0000000000..8e3eb59b29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_1e9e39() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1e9e39(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1e9e39(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1e9e39(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..16444c0f2a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_1e9e39() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1e9e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1e9e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1e9e39(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16444c0f2a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_1e9e39() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1e9e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1e9e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1e9e39(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl new file mode 100644 index 0000000000..067bc8bce7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureDimensions_1e9e39() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_1e9e39(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureDimensions_1e9e39() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_1e9e39(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureDimensions_1e9e39() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_1e9e39(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl new file mode 100644 index 0000000000..352d58df65 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1e9e39(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_1e9e39(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_1e9e39(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_1e9e39(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm new file mode 100644 index 0000000000..c83aa50543 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1e9e39 "textureDimensions_1e9e39" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1e9e39 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_1e9e39 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_1e9e39 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_1e9e39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl new file mode 100644 index 0000000000..efd42acd26 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_1e9e39() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1e9e39(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1e9e39(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1e9e39(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl new file mode 100644 index 0000000000..4be52a4fdb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array) -> vec2 +fn textureDimensions_1f20c5() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1f20c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1f20c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1f20c5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e453d42df6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_1f20c5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1f20c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1f20c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1f20c5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e453d42df6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_1f20c5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_1f20c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_1f20c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_1f20c5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl new file mode 100644 index 0000000000..ac742c2d81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_1f20c5() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_1f20c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_1f20c5() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_1f20c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_1f20c5() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_1f20c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl new file mode 100644 index 0000000000..d35a456705 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_1f20c5(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_1f20c5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_1f20c5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_1f20c5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm new file mode 100644 index 0000000000..83e1fb4af4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_1f20c5 "textureDimensions_1f20c5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_1f20c5 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %26 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySizeLod %v3int %22 %int_0 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_1f20c5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_1f20c5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_1f20c5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..4800bad9b3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_1f20c5() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_1f20c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_1f20c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_1f20c5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl new file mode 100644 index 0000000000..070bb0bb2c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_214dd4() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_214dd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_214dd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_214dd4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c91423eba6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_214dd4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_214dd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_214dd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_214dd4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c91423eba6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_214dd4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_214dd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_214dd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_214dd4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl new file mode 100644 index 0000000000..d7f534f801 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_214dd4() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_214dd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_214dd4() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_214dd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_214dd4() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_214dd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl new file mode 100644 index 0000000000..169ee329ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_214dd4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_214dd4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_214dd4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_214dd4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..8210ce8f60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_214dd4 "textureDimensions_214dd4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_214dd4 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_214dd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_214dd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_214dd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..8fdb8a387e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_214dd4() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_214dd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_214dd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_214dd4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl new file mode 100644 index 0000000000..5ef2dd65e9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 +fn textureDimensions_221f22() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_221f22(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_221f22(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_221f22(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e40306be9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_221f22() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_221f22(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_221f22(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_221f22(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6e40306be9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_221f22() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_221f22(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_221f22(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_221f22(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl new file mode 100644 index 0000000000..ba1d23a9f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_221f22() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_221f22(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_221f22() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_221f22(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_221f22() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_221f22(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl new file mode 100644 index 0000000000..0a75edb922 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_221f22(texturecube_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_221f22(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_221f22(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_221f22(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4ab8e0159 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_221f22 "textureDimensions_221f22" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_221f22 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_221f22 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_221f22 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_221f22 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d8724580d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_221f22() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_221f22(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_221f22(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_221f22(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl new file mode 100644 index 0000000000..d3f2e9fe87 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 +fn textureDimensions_267788() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_267788(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_267788(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_267788(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..43ab14cb2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_267788() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_267788(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_267788(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_267788(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43ab14cb2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_267788() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_267788(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_267788(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_267788(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl new file mode 100644 index 0000000000..5ab45ccbdb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_267788() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_267788(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_267788() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_267788(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureDimensions_267788() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_267788(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl new file mode 100644 index 0000000000..3f22f32cb2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_267788(texture2d_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_267788(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_267788(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_267788(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm new file mode 100644 index 0000000000..43de7d3c52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_267788 "textureDimensions_267788" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_267788 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %29 + OpStore %arg_1 %18 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %int %arg_1 + %23 = OpImageQuerySizeLod %v3int %25 %26 + %21 = OpVectorShuffle %v2int %23 %23 0 1 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_267788 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_267788 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureDimensions_267788 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl new file mode 100644 index 0000000000..75e5f8413c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_267788() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_267788(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_267788(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_267788(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl new file mode 100644 index 0000000000..b5d16cb486 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 +fn textureDimensions_26bdfa() { + var arg_1 = 0; + var res: vec3 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26bdfa(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_26bdfa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_26bdfa(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d66e9077c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_26bdfa() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26bdfa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26bdfa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26bdfa(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d66e9077c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_26bdfa() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26bdfa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26bdfa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26bdfa(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl new file mode 100644 index 0000000000..cc8ce41851 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_26bdfa() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_26bdfa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureDimensions_26bdfa() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_26bdfa(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_26bdfa() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_26bdfa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl new file mode 100644 index 0000000000..67861526c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_26bdfa(texture3d tint_symbol_1) { + int arg_1 = 0; + int3 res = int3(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1), tint_symbol_1.get_depth(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_26bdfa(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_26bdfa(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_26bdfa(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm new file mode 100644 index 0000000000..99be9549d4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_26bdfa "textureDimensions_26bdfa" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %26 = OpConstantNull %v3int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_26bdfa = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v3int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v3int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_26bdfa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_26bdfa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_26bdfa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl new file mode 100644 index 0000000000..66415999bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_26bdfa() { + var arg_1 = 0; + var res : vec3 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26bdfa(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_26bdfa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_26bdfa(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl new file mode 100644 index 0000000000..4cde4c95e4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_26ef6c() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26ef6c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_26ef6c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_26ef6c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7ccf32f5db --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_26ef6c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26ef6c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26ef6c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26ef6c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7ccf32f5db --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_26ef6c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_26ef6c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_26ef6c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_26ef6c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl new file mode 100644 index 0000000000..dbdb178ec8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_26ef6c() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_26ef6c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_26ef6c() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_26ef6c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_26ef6c() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_26ef6c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl new file mode 100644 index 0000000000..ba9013a8ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_26ef6c(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_26ef6c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_26ef6c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_26ef6c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd40e121a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_26ef6c "textureDimensions_26ef6c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_26ef6c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_26ef6c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_26ef6c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_26ef6c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0b495c846 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_26ef6c() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_26ef6c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_26ef6c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_26ef6c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl new file mode 100644 index 0000000000..593565bdc8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_2ad087() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2ad087(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2ad087(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2ad087(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..33dee501da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_2ad087() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2ad087(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2ad087(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2ad087(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..33dee501da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_2ad087() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2ad087(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2ad087(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2ad087(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl new file mode 100644 index 0000000000..90289b322c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_2ad087() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_2ad087(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_2ad087() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_2ad087(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_2ad087() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_2ad087(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl new file mode 100644 index 0000000000..011b3cb465 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_2ad087(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_2ad087(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2ad087(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2ad087(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm new file mode 100644 index 0000000000..cb89db590a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2ad087 "textureDimensions_2ad087" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2ad087 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_2ad087 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_2ad087 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_2ad087 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl new file mode 100644 index 0000000000..e965a18e09 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_2ad087() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2ad087(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2ad087(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2ad087(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl new file mode 100644 index 0000000000..8255516421 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 +fn textureDimensions_2efa05() { + var arg_1 = 0; + var res: vec3 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2efa05(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2efa05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2efa05(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fd507fafcb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_2efa05() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2efa05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2efa05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2efa05(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fd507fafcb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_2efa05() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2efa05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2efa05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2efa05(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl new file mode 100644 index 0000000000..8b2360281d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_2efa05() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_2efa05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureDimensions_2efa05() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_2efa05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_2efa05() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_2efa05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl new file mode 100644 index 0000000000..3f1b9a431f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_2efa05(texture3d tint_symbol_1) { + int arg_1 = 0; + int3 res = int3(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1), tint_symbol_1.get_depth(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_2efa05(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2efa05(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2efa05(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm new file mode 100644 index 0000000000..8d162f11f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2efa05 "textureDimensions_2efa05" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %27 = OpConstantNull %v3int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2efa05 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v3int Function %27 + OpStore %arg_1 %18 + %23 = OpLoad %11 %arg_0 + %24 = OpLoad %int %arg_1 + %21 = OpImageQuerySizeLod %v3int %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %textureDimensions_2efa05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_2efa05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %40 = OpLabel + %41 = OpFunctionCall %void %textureDimensions_2efa05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2a2fd3533 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_2efa05() { + var arg_1 = 0; + var res : vec3 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2efa05(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2efa05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2efa05(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl new file mode 100644 index 0000000000..d5bbd8606b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_2f289f() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2f289f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2f289f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2f289f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b84004a0c3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_2f289f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2f289f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2f289f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2f289f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b84004a0c3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_2f289f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2f289f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2f289f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2f289f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl new file mode 100644 index 0000000000..ecf5ce00b5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_2f289f() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_2f289f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_2f289f() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_2f289f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_2f289f() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_2f289f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl new file mode 100644 index 0000000000..a61bafeb5d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_2f289f(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_2f289f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2f289f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2f289f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm new file mode 100644 index 0000000000..ae04243b13 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2f289f "textureDimensions_2f289f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2f289f = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_2f289f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_2f289f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_2f289f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl new file mode 100644 index 0000000000..6895807816 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_2f289f() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2f289f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2f289f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2f289f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl new file mode 100644 index 0000000000..94d9227d50 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 +fn textureDimensions_2fe1cc() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2fe1cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2fe1cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2fe1cc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..723a757349 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_2fe1cc() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2fe1cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2fe1cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2fe1cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..723a757349 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_2fe1cc() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_2fe1cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_2fe1cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_2fe1cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl new file mode 100644 index 0000000000..20bbd86217 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_2fe1cc() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_2fe1cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_2fe1cc() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_2fe1cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_2fe1cc() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_2fe1cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl new file mode 100644 index 0000000000..38413c00f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_2fe1cc(texture2d tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_2fe1cc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_2fe1cc(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_2fe1cc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..3dcda16c4e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_2fe1cc "textureDimensions_2fe1cc" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_2fe1cc = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_2fe1cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_2fe1cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_2fe1cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b45aa5c3c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_2fe1cc() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_2fe1cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_2fe1cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_2fe1cc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl new file mode 100644 index 0000000000..dd4bfd14cb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_318ecc() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_318ecc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_318ecc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_318ecc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bc9b732479 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_318ecc() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_318ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_318ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_318ecc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bc9b732479 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_318ecc() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_318ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_318ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_318ecc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl new file mode 100644 index 0000000000..078e8b3968 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_318ecc() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_318ecc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_318ecc() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_318ecc(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_318ecc() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_318ecc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl new file mode 100644 index 0000000000..a9655f52bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_318ecc(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_318ecc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_318ecc(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_318ecc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm new file mode 100644 index 0000000000..c65dba980d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_318ecc "textureDimensions_318ecc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_318ecc = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_318ecc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_318ecc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_318ecc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a7028c4a8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_318ecc() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_318ecc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_318ecc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_318ecc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl new file mode 100644 index 0000000000..df9309bf7e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_340d06() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_340d06(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_340d06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_340d06(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db01f68004 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_340d06() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_340d06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_340d06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_340d06(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..db01f68004 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_340d06() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_340d06(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_340d06(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_340d06(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl new file mode 100644 index 0000000000..78d4994be5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_340d06() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_340d06(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_340d06() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_340d06(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_340d06() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_340d06(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl new file mode 100644 index 0000000000..eb04eb88e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_340d06(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_340d06(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_340d06(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_340d06(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm new file mode 100644 index 0000000000..c58da9bd7b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_340d06 "textureDimensions_340d06" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_340d06 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_340d06 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_340d06 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_340d06 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl new file mode 100644 index 0000000000..99bca2d762 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_340d06() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_340d06(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_340d06(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_340d06(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl new file mode 100644 index 0000000000..f4c09755b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_398e30() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_398e30(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_398e30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_398e30(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee95c58978 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_398e30() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_398e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_398e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_398e30(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ee95c58978 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_398e30() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_398e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_398e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_398e30(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl new file mode 100644 index 0000000000..6db635123c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_398e30() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_398e30(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_398e30() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_398e30(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_398e30() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_398e30(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl new file mode 100644 index 0000000000..8de5617137 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_398e30(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_398e30(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_398e30(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_398e30(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm new file mode 100644 index 0000000000..933984155b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_398e30 "textureDimensions_398e30" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_398e30 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_398e30 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_398e30 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_398e30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl new file mode 100644 index 0000000000..5deab7d0d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_398e30() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_398e30(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_398e30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_398e30(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl new file mode 100644 index 0000000000..db77b57707 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_3a94ea() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3a94ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3a94ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3a94ea(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..347c92e0ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3a94ea() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3a94ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3a94ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3a94ea(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..347c92e0ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3a94ea() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3a94ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3a94ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3a94ea(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl new file mode 100644 index 0000000000..4e7d2639ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_3a94ea() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_3a94ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_3a94ea() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_3a94ea(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_3a94ea() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_3a94ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl new file mode 100644 index 0000000000..7dd2f6b70b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_3a94ea(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_3a94ea(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_3a94ea(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_3a94ea(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..1ef266d1e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_3a94ea "textureDimensions_3a94ea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_3a94ea = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_3a94ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_3a94ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_3a94ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..c1cebafe60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_3a94ea() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3a94ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3a94ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3a94ea(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl new file mode 100644 index 0000000000..673d8c24ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_3aca08() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3aca08(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3aca08(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3aca08(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..05eedf3b92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_3aca08() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3aca08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3aca08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3aca08(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..05eedf3b92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_3aca08() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3aca08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3aca08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3aca08(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl new file mode 100644 index 0000000000..e9c16564df --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureDimensions_3aca08() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_3aca08(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureDimensions_3aca08() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_3aca08(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureDimensions_3aca08() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_3aca08(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl new file mode 100644 index 0000000000..765771f8f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_3aca08(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_3aca08(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_3aca08(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_3aca08(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm new file mode 100644 index 0000000000..faf0effc03 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_3aca08 "textureDimensions_3aca08" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_3aca08 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_3aca08 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_3aca08 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_3aca08 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl new file mode 100644 index 0000000000..1a72665839 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_3aca08() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3aca08(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3aca08(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3aca08(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl new file mode 100644 index 0000000000..3fe2fb6818 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_3c5ad8() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3c5ad8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3c5ad8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3c5ad8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..78cd91bd88 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3c5ad8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3c5ad8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3c5ad8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3c5ad8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..78cd91bd88 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_3c5ad8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_3c5ad8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_3c5ad8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_3c5ad8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl new file mode 100644 index 0000000000..b27ab3b6af --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_3c5ad8() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_3c5ad8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_3c5ad8() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_3c5ad8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_3c5ad8() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_3c5ad8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl new file mode 100644 index 0000000000..ba7e47a6a7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_3c5ad8(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_3c5ad8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_3c5ad8(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_3c5ad8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm new file mode 100644 index 0000000000..f91c033b1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_3c5ad8 "textureDimensions_3c5ad8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_3c5ad8 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_3c5ad8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_3c5ad8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_3c5ad8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl new file mode 100644 index 0000000000..a73139d844 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_3c5ad8() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_3c5ad8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_3c5ad8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_3c5ad8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl new file mode 100644 index 0000000000..2e88d1b469 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array) -> vec2 +fn textureDimensions_4152a6() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4152a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4152a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4152a6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae5eb3529e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_4152a6() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4152a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4152a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4152a6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ae5eb3529e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_4152a6() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4152a6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4152a6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4152a6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl new file mode 100644 index 0000000000..d3120a3cc5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_4152a6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_4152a6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_4152a6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_4152a6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_4152a6() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_4152a6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl new file mode 100644 index 0000000000..ac8d43dac9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_4152a6(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_4152a6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_4152a6(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_4152a6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e092546124 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_4152a6 "textureDimensions_4152a6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_4152a6 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %26 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySizeLod %v3int %22 %int_0 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_4152a6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_4152a6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_4152a6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl new file mode 100644 index 0000000000..67521abbcd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_4152a6() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4152a6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4152a6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4152a6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl new file mode 100644 index 0000000000..f358b83d33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d) -> i32 +fn textureDimensions_423f99() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_423f99(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_423f99(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_423f99(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d6a4e4bc97 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_423f99() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_423f99(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_423f99(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_423f99(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d6a4e4bc97 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_423f99() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_423f99(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_423f99(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_423f99(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl new file mode 100644 index 0000000000..08f2e2498f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_423f99() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_423f99(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureDimensions_423f99() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_423f99(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_423f99() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_423f99(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl new file mode 100644 index 0000000000..77b610faab --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_423f99(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_423f99(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_423f99(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_423f99(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm new file mode 100644 index 0000000000..807bc78654 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_423f99 "textureDimensions_423f99" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_423f99 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %int %18 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_423f99 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_423f99 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_423f99 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ef4f77e1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_423f99() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_423f99(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_423f99(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_423f99(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl new file mode 100644 index 0000000000..cbe8ae3074 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_4267ee() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4267ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4267ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4267ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aab581e07d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_4267ee() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4267ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4267ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4267ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aab581e07d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_4267ee() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4267ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4267ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4267ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl new file mode 100644 index 0000000000..c1f09faf0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureDimensions_4267ee() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_4267ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureDimensions_4267ee() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_4267ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureDimensions_4267ee() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_4267ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl new file mode 100644 index 0000000000..177015d0ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_4267ee(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_4267ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_4267ee(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_4267ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..a93a79d04a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_4267ee "textureDimensions_4267ee" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_4267ee = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_4267ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_4267ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_4267ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..a63426875e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_4267ee() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4267ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4267ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4267ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl new file mode 100644 index 0000000000..1cb86137bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_42d4e6() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_42d4e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_42d4e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_42d4e6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7c818175b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_42d4e6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_42d4e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_42d4e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_42d4e6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c818175b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_42d4e6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_42d4e6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_42d4e6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_42d4e6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl new file mode 100644 index 0000000000..f59d1757c9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureDimensions_42d4e6() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_42d4e6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureDimensions_42d4e6() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_42d4e6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureDimensions_42d4e6() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_42d4e6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl new file mode 100644 index 0000000000..cc3fa542ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_42d4e6(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_42d4e6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_42d4e6(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_42d4e6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm new file mode 100644 index 0000000000..4127ab000e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_42d4e6 "textureDimensions_42d4e6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_42d4e6 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_42d4e6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_42d4e6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_42d4e6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab0376bd4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_42d4e6() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_42d4e6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_42d4e6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_42d4e6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl new file mode 100644 index 0000000000..95910e9264 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_48cb89() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_48cb89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_48cb89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_48cb89(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9ec64be6c1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_48cb89() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_48cb89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_48cb89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_48cb89(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9ec64be6c1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_48cb89() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_48cb89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_48cb89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_48cb89(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl new file mode 100644 index 0000000000..026fcaef19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureDimensions_48cb89() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_48cb89(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureDimensions_48cb89() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_48cb89(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureDimensions_48cb89() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_48cb89(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl new file mode 100644 index 0000000000..5f475e25fe --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_48cb89(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_48cb89(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_48cb89(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_48cb89(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a887dcb64 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_48cb89 "textureDimensions_48cb89" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_48cb89 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_48cb89 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_48cb89 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_48cb89 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e4ee35c96 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_48cb89() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_48cb89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_48cb89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_48cb89(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl new file mode 100644 index 0000000000..ee9101fc47 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_49d274() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_49d274(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_49d274(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_49d274(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9ceff5070d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_49d274() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_49d274(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_49d274(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_49d274(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9ceff5070d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_49d274() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_49d274(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_49d274(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_49d274(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl new file mode 100644 index 0000000000..70347a6ef3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_49d274() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_49d274(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_49d274() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_49d274(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_49d274() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_49d274(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl new file mode 100644 index 0000000000..4ca4453d84 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_49d274(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_49d274(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_49d274(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_49d274(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a63680bd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_49d274 "textureDimensions_49d274" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_49d274 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_49d274 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_49d274 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_49d274 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl new file mode 100644 index 0000000000..060af23164 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_49d274() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_49d274(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_49d274(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_49d274(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl new file mode 100644 index 0000000000..fc79c53ce6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_4df9a8() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4df9a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4df9a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4df9a8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8541c75d63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_4df9a8() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4df9a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4df9a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4df9a8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8541c75d63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_4df9a8() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_4df9a8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_4df9a8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_4df9a8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl new file mode 100644 index 0000000000..7871ed7d01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_4df9a8() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_4df9a8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_4df9a8() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_4df9a8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_4df9a8() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_4df9a8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl new file mode 100644 index 0000000000..54723cb4de --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_4df9a8(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_4df9a8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_4df9a8(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_4df9a8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4be2a728d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_4df9a8 "textureDimensions_4df9a8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_4df9a8 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_4df9a8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_4df9a8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_4df9a8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl new file mode 100644 index 0000000000..b771310fa5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_4df9a8() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_4df9a8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_4df9a8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_4df9a8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl new file mode 100644 index 0000000000..2304162a56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 +fn textureDimensions_50a9ee() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_50a9ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_50a9ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_50a9ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e5b311bc1d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_50a9ee() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_50a9ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_50a9ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_50a9ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5b311bc1d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_50a9ee() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_50a9ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_50a9ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_50a9ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl new file mode 100644 index 0000000000..e06d866cc4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_50a9ee() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_50a9ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_50a9ee() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_50a9ee(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_50a9ee() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_50a9ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl new file mode 100644 index 0000000000..109f854190 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_50a9ee(texturecube_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_50a9ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_50a9ee(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_50a9ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7172f465f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_50a9ee "textureDimensions_50a9ee" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_50a9ee = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_50a9ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_50a9ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_50a9ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..137aadfa33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_50a9ee() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_50a9ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_50a9ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_50a9ee(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl new file mode 100644 index 0000000000..3bf674388f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d, level: i32) -> i32 +fn textureDimensions_52045c() { + var arg_1 = 0; + var res: i32 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_52045c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_52045c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_52045c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cb503d71c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_52045c() { + int arg_1 = 0; + int2 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_52045c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_52045c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_52045c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cb503d71c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_52045c() { + int arg_1 = 0; + int2 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_52045c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_52045c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_52045c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl new file mode 100644 index 0000000000..d4f8701855 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_52045c() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_52045c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureDimensions_52045c() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_52045c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureDimensions_52045c() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_52045c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl new file mode 100644 index 0000000000..f8ccfdf25d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_52045c(texture1d tint_symbol_1) { + int arg_1 = 0; + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_52045c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_52045c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_52045c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm new file mode 100644 index 0000000000..a11913997f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_52045c "textureDimensions_52045c" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_52045c = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_1 %17 + %21 = OpLoad %11 %arg_0 + %22 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %int %21 %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_52045c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_52045c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_52045c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl new file mode 100644 index 0000000000..ea3568c4d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_52045c() { + var arg_1 = 0; + var res : i32 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_52045c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_52045c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_52045c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl new file mode 100644 index 0000000000..a7efa73ac3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_55b23e() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_55b23e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_55b23e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_55b23e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c3634a3b40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_55b23e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_55b23e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_55b23e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_55b23e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c3634a3b40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_55b23e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_55b23e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_55b23e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_55b23e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl new file mode 100644 index 0000000000..a9465b8a2c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureDimensions_55b23e() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_55b23e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureDimensions_55b23e() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_55b23e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureDimensions_55b23e() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_55b23e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl new file mode 100644 index 0000000000..0778752ea7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_55b23e(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_55b23e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_55b23e(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_55b23e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e6470a96b0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_55b23e "textureDimensions_55b23e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_55b23e = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_55b23e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_55b23e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_55b23e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl new file mode 100644 index 0000000000..430da3cdaf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_55b23e() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_55b23e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_55b23e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_55b23e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl new file mode 100644 index 0000000000..111e70b9ba --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 +fn textureDimensions_579629() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_579629(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_579629(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_579629(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..297d5dd29a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_579629() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_579629(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_579629(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_579629(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..297d5dd29a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_579629() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_579629(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_579629(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_579629(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl new file mode 100644 index 0000000000..d1ca2e719e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureDimensions_579629() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_579629(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DMS arg_0_1; +void textureDimensions_579629() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_579629(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureDimensions_579629() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_579629(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl new file mode 100644 index 0000000000..d6c497bc4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_579629(texture2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureDimensions_579629(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_579629(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_579629(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d35bf99e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_579629 "textureDimensions_579629" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_579629 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_579629 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_579629 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_579629 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl new file mode 100644 index 0000000000..1e1d6d7a44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureDimensions_579629() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_579629(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_579629(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_579629(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl new file mode 100644 index 0000000000..f56dbbdf3b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_57da0b() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57da0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_57da0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_57da0b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f9df5efbd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_57da0b() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57da0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57da0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57da0b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f9df5efbd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_57da0b() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57da0b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57da0b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57da0b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl new file mode 100644 index 0000000000..c45ed2f613 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_57da0b() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_57da0b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_57da0b() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_57da0b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_57da0b() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_57da0b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl new file mode 100644 index 0000000000..fb1c232486 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_57da0b(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_57da0b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_57da0b(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_57da0b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d0c96d5dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_57da0b "textureDimensions_57da0b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_57da0b = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_57da0b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_57da0b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_57da0b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl new file mode 100644 index 0000000000..b599184810 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_57da0b() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57da0b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_57da0b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_57da0b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl new file mode 100644 index 0000000000..9da6a8afe4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; + +// fn textureDimensions(texture: texture_depth_cube) -> vec2 +fn textureDimensions_57e28f() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57e28f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_57e28f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_57e28f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8da8d7d569 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_57e28f() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57e28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57e28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57e28f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8da8d7d569 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_57e28f() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_57e28f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_57e28f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_57e28f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl new file mode 100644 index 0000000000..c8713a2ded --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_57e28f() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_57e28f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_57e28f() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_57e28f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_57e28f() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_57e28f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl new file mode 100644 index 0000000000..c089020df3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_57e28f(depthcube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_2) { + textureDimensions_57e28f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { + textureDimensions_57e28f(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { + textureDimensions_57e28f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm new file mode 100644 index 0000000000..9dd34bf759 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_57e28f "textureDimensions_57e28f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_57e28f = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_57e28f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_57e28f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_57e28f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0b854e393 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +fn textureDimensions_57e28f() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_57e28f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_57e28f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_57e28f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl new file mode 100644 index 0000000000..ac97548fff --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_58a515() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_58a515(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_58a515(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_58a515(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e8a7b4b3f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_58a515() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_58a515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_58a515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_58a515(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8a7b4b3f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_58a515() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_58a515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_58a515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_58a515(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl new file mode 100644 index 0000000000..b67bb0f017 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_58a515() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_58a515(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_58a515() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_58a515(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_58a515() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_58a515(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl new file mode 100644 index 0000000000..c8d90cdade --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_58a515(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_58a515(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_58a515(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_58a515(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm new file mode 100644 index 0000000000..5afc929ced --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_58a515 "textureDimensions_58a515" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_58a515 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_58a515 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_58a515 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_58a515 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl new file mode 100644 index 0000000000..21bad72927 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_58a515() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_58a515(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_58a515(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_58a515(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl new file mode 100644 index 0000000000..52d9859616 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_5985f3() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5985f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5985f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5985f3(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..488cb1754f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5985f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5985f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5985f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5985f3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..488cb1754f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5985f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5985f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5985f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5985f3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl new file mode 100644 index 0000000000..4c33a17f6a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_5985f3() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_5985f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_5985f3() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_5985f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_5985f3() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_5985f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl new file mode 100644 index 0000000000..90f407d362 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_5985f3(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_5985f3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_5985f3(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_5985f3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..f51c50b90e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_5985f3 "textureDimensions_5985f3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_5985f3 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_5985f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_5985f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_5985f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..84495171ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_5985f3() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5985f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5985f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5985f3(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl new file mode 100644 index 0000000000..8de30ac23c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_5caa5e() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5caa5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5caa5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5caa5e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..066fbdfdcc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_5caa5e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5caa5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5caa5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5caa5e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..066fbdfdcc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_5caa5e() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5caa5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5caa5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5caa5e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl new file mode 100644 index 0000000000..d02caf1a45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_5caa5e() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_5caa5e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_5caa5e() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_5caa5e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_5caa5e() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_5caa5e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl new file mode 100644 index 0000000000..56e5f71c22 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_5caa5e(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_5caa5e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_5caa5e(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_5caa5e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm new file mode 100644 index 0000000000..68ec968e6d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_5caa5e "textureDimensions_5caa5e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_5caa5e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_5caa5e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_5caa5e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_5caa5e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac87720adb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_5caa5e() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5caa5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5caa5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5caa5e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl new file mode 100644 index 0000000000..6e8e71eca6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_5e295d() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5e295d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5e295d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5e295d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a88725c97e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5e295d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5e295d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5e295d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5e295d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a88725c97e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_5e295d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_5e295d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_5e295d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_5e295d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl new file mode 100644 index 0000000000..f079eb8801 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_5e295d() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_5e295d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_5e295d() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_5e295d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_5e295d() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_5e295d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl new file mode 100644 index 0000000000..50d3988eba --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_5e295d(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_5e295d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_5e295d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_5e295d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm new file mode 100644 index 0000000000..05297b0ca5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_5e295d "textureDimensions_5e295d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_5e295d = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_5e295d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_5e295d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_5e295d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl new file mode 100644 index 0000000000..ae8f76333d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_5e295d() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_5e295d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_5e295d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_5e295d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl new file mode 100644 index 0000000000..36982d84d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_60bf54() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_60bf54(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_60bf54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_60bf54(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d7ac1d3d72 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_60bf54() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_60bf54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_60bf54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_60bf54(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d7ac1d3d72 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_60bf54() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_60bf54(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_60bf54(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_60bf54(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl new file mode 100644 index 0000000000..91d08156b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_60bf54() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_60bf54(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_60bf54() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_60bf54(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_60bf54() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_60bf54(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl new file mode 100644 index 0000000000..bf597c3afd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_60bf54(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_60bf54(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_60bf54(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_60bf54(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm new file mode 100644 index 0000000000..5073da1f55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_60bf54 "textureDimensions_60bf54" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_60bf54 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_60bf54 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_60bf54 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_60bf54 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl new file mode 100644 index 0000000000..fbc7cd74a7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_60bf54() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_60bf54(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_60bf54(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_60bf54(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl new file mode 100644 index 0000000000..deb112547e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_63f3cf() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_63f3cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_63f3cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_63f3cf(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f03906db15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_63f3cf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_63f3cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_63f3cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_63f3cf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f03906db15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_63f3cf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_63f3cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_63f3cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_63f3cf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl new file mode 100644 index 0000000000..6a77ea9751 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureDimensions_63f3cf() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_63f3cf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureDimensions_63f3cf() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_63f3cf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureDimensions_63f3cf() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_63f3cf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl new file mode 100644 index 0000000000..931b457149 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_63f3cf(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_63f3cf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_63f3cf(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_63f3cf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..f146e10ce2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_63f3cf "textureDimensions_63f3cf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_63f3cf = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_63f3cf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_63f3cf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_63f3cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e0ebfd2bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_63f3cf() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_63f3cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_63f3cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_63f3cf(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl new file mode 100644 index 0000000000..6a41cfe496 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_68105c() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_68105c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_68105c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_68105c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c3723286d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_68105c() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_68105c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_68105c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_68105c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c3723286d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_68105c() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_68105c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_68105c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_68105c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl new file mode 100644 index 0000000000..d366071c30 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_68105c() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_68105c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_68105c() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_68105c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_68105c() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_68105c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl new file mode 100644 index 0000000000..a1fdb63b94 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_68105c(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_68105c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_68105c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_68105c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm new file mode 100644 index 0000000000..471b570c85 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_68105c "textureDimensions_68105c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_68105c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_68105c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_68105c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_68105c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl new file mode 100644 index 0000000000..19c49290b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_68105c() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_68105c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_68105c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_68105c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl new file mode 100644 index 0000000000..588648e5ea --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 +fn textureDimensions_686ef2() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_686ef2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_686ef2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_686ef2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eeccbd6628 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_686ef2() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_686ef2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_686ef2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_686ef2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..eeccbd6628 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_686ef2() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_686ef2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_686ef2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_686ef2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl new file mode 100644 index 0000000000..c0209738da --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_686ef2() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_686ef2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_0_1; +void textureDimensions_686ef2() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_686ef2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_686ef2() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_686ef2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl new file mode 100644 index 0000000000..c934b1fcb9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_686ef2(texturecube tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_686ef2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_686ef2(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_686ef2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm new file mode 100644 index 0000000000..83b84ec8e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_686ef2 "textureDimensions_686ef2" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_686ef2 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_686ef2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_686ef2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_686ef2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl new file mode 100644 index 0000000000..df409b74f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_686ef2() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_686ef2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_686ef2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_686ef2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl new file mode 100644 index 0000000000..d2d4a11e34 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_6adac6() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6adac6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6adac6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6adac6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52b2080c05 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_6adac6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6adac6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6adac6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6adac6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52b2080c05 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_6adac6() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6adac6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6adac6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6adac6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl new file mode 100644 index 0000000000..acaaa5adf0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_6adac6() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_6adac6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_6adac6() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_6adac6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_6adac6() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_6adac6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl new file mode 100644 index 0000000000..7087625943 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_6adac6(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_6adac6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_6adac6(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_6adac6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm new file mode 100644 index 0000000000..363af60804 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_6adac6 "textureDimensions_6adac6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_6adac6 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_6adac6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_6adac6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_6adac6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ab67f07a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_6adac6() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6adac6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6adac6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6adac6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl new file mode 100644 index 0000000000..ef7fe5d3f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d) -> vec3 +fn textureDimensions_6ec1b4() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6ec1b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6ec1b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6ec1b4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e9cb1f014 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_6ec1b4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6ec1b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6ec1b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6ec1b4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6e9cb1f014 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_6ec1b4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6ec1b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6ec1b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6ec1b4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl new file mode 100644 index 0000000000..482455da81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_6ec1b4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_6ec1b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureDimensions_6ec1b4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_6ec1b4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureDimensions_6ec1b4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_6ec1b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl new file mode 100644 index 0000000000..52a3369bb2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_6ec1b4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_6ec1b4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_6ec1b4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_6ec1b4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f8be173ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_6ec1b4 "textureDimensions_6ec1b4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpConstantNull %v3int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_6ec1b4 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %24 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v3int %20 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_6ec1b4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_6ec1b4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_6ec1b4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..7573c55260 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_6ec1b4() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6ec1b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6ec1b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6ec1b4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl new file mode 100644 index 0000000000..2e0eb57363 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_6f0d79() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6f0d79(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6f0d79(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6f0d79(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd1a3a48fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_6f0d79() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6f0d79(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6f0d79(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6f0d79(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd1a3a48fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_6f0d79() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_6f0d79(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_6f0d79(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_6f0d79(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl new file mode 100644 index 0000000000..71893cbbf0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureDimensions_6f0d79() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_6f0d79(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureDimensions_6f0d79() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_6f0d79(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureDimensions_6f0d79() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_6f0d79(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl new file mode 100644 index 0000000000..5154f6cfbf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_6f0d79(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_6f0d79(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_6f0d79(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_6f0d79(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1032b6920 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_6f0d79 "textureDimensions_6f0d79" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_6f0d79 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_6f0d79 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_6f0d79 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_6f0d79 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl new file mode 100644 index 0000000000..b055eea1db --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_6f0d79() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_6f0d79(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_6f0d79(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_6f0d79(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl new file mode 100644 index 0000000000..99afe619b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_702c53() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_702c53(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_702c53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_702c53(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..40c27c8f76 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_702c53() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_702c53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_702c53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_702c53(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..40c27c8f76 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_702c53() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_702c53(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_702c53(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_702c53(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl new file mode 100644 index 0000000000..e4f0c34dd6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureDimensions_702c53() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_702c53(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureDimensions_702c53() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_702c53(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureDimensions_702c53() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_702c53(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl new file mode 100644 index 0000000000..d202631130 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_702c53(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_702c53(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_702c53(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_702c53(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm new file mode 100644 index 0000000000..514d19ff32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_702c53 "textureDimensions_702c53" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_702c53 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_702c53 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_702c53 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_702c53 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl new file mode 100644 index 0000000000..093625d570 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_702c53() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_702c53(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_702c53(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_702c53(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl new file mode 100644 index 0000000000..4eb4f83a24 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureDimensions(texture: texture_depth_2d_array, level: i32) -> vec2 +fn textureDimensions_72e5d6() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_72e5d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_72e5d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_72e5d6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..71a9484b3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_72e5d6() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_72e5d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_72e5d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_72e5d6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..71a9484b3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_72e5d6() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_72e5d6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_72e5d6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_72e5d6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl new file mode 100644 index 0000000000..1b5be59272 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_72e5d6() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_72e5d6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_72e5d6() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_72e5d6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_72e5d6() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_72e5d6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl new file mode 100644 index 0000000000..d022c05937 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_72e5d6(depth2d_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureDimensions_72e5d6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_72e5d6(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_72e5d6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm new file mode 100644 index 0000000000..882e22c43f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_72e5d6 "textureDimensions_72e5d6" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_72e5d6 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_72e5d6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_72e5d6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_72e5d6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6f1b85a29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureDimensions_72e5d6() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_72e5d6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_72e5d6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_72e5d6(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl new file mode 100644 index 0000000000..bd1b094339 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d, level: i32) -> i32 +fn textureDimensions_79df87() { + var arg_1 = 0; + var res: i32 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_79df87(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_79df87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_79df87(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d2bf772328 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_79df87() { + int arg_1 = 0; + int2 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_79df87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_79df87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_79df87(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d2bf772328 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_79df87() { + int arg_1 = 0; + int2 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_79df87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_79df87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_79df87(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl new file mode 100644 index 0000000000..1b5edf0262 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_79df87() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_79df87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureDimensions_79df87() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_79df87(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_79df87() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_79df87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl new file mode 100644 index 0000000000..77b77b0f35 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_79df87(texture1d tint_symbol_1) { + int arg_1 = 0; + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_79df87(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_79df87(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_79df87(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm new file mode 100644 index 0000000000..4c4689a931 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_79df87 "textureDimensions_79df87" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_79df87 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_int Function %18 + OpStore %arg_1 %18 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %21 = OpImageQuerySizeLod %int %22 %23 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_79df87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_79df87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_79df87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl new file mode 100644 index 0000000000..23db8dc9e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_79df87() { + var arg_1 = 0; + var res : i32 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_79df87(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_79df87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_79df87(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl new file mode 100644 index 0000000000..8245cc2846 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureDimensions(texture: texture_depth_2d_array) -> vec2 +fn textureDimensions_7bf826() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7bf826(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_7bf826(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_7bf826(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9c0e675218 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_7bf826() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7bf826(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7bf826(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7bf826(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c0e675218 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_7bf826() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7bf826(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7bf826(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7bf826(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl new file mode 100644 index 0000000000..9859cdd941 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_7bf826() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_7bf826(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_7bf826() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_7bf826(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_7bf826() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_7bf826(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl new file mode 100644 index 0000000000..59cd3739f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_7bf826(depth2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureDimensions_7bf826(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_7bf826(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_7bf826(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm new file mode 100644 index 0000000000..2229e184ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_7bf826 "textureDimensions_7bf826" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_7bf826 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_7bf826 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_7bf826 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_7bf826 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl new file mode 100644 index 0000000000..4953ba3b69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureDimensions_7bf826() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7bf826(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_7bf826(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_7bf826(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl new file mode 100644 index 0000000000..87caa4402e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_7f5c2e() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7f5c2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_7f5c2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_7f5c2e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9c6abe3894 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_7f5c2e() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7f5c2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7f5c2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7f5c2e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c6abe3894 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_7f5c2e() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_7f5c2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_7f5c2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_7f5c2e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl new file mode 100644 index 0000000000..ed85e7deb1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_7f5c2e() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_7f5c2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_7f5c2e() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_7f5c2e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_7f5c2e() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_7f5c2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl new file mode 100644 index 0000000000..f853ebcebf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_7f5c2e(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_7f5c2e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_7f5c2e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_7f5c2e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm new file mode 100644 index 0000000000..5a25cc105f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_7f5c2e "textureDimensions_7f5c2e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_7f5c2e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_7f5c2e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_7f5c2e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_7f5c2e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..85bbc4b745 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_7f5c2e() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_7f5c2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_7f5c2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_7f5c2e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl new file mode 100644 index 0000000000..99c4483de1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_8028f3() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8028f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8028f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8028f3(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f18db34932 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8028f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8028f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8028f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8028f3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f18db34932 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8028f3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8028f3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8028f3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8028f3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl new file mode 100644 index 0000000000..4ac9ac9786 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8028f3() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_8028f3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8028f3() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_8028f3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8028f3() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_8028f3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl new file mode 100644 index 0000000000..efc7793dda --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8028f3(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8028f3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8028f3(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8028f3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm new file mode 100644 index 0000000000..814b999de5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8028f3 "textureDimensions_8028f3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8028f3 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_8028f3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_8028f3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_8028f3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl new file mode 100644 index 0000000000..fbc19794de --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_8028f3() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8028f3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8028f3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8028f3(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl new file mode 100644 index 0000000000..630debefca --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_811679() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_811679(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_811679(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_811679(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a474cba784 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_811679() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_811679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_811679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_811679(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a474cba784 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_811679() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_811679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_811679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_811679(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl new file mode 100644 index 0000000000..152d367823 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_811679() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_811679(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_811679() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_811679(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_811679() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_811679(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl new file mode 100644 index 0000000000..825c3ade50 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_811679(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_811679(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_811679(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_811679(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm new file mode 100644 index 0000000000..c051822017 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_811679 "textureDimensions_811679" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_811679 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_811679 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_811679 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_811679 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl new file mode 100644 index 0000000000..494c1da936 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_811679() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_811679(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_811679(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_811679(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl new file mode 100644 index 0000000000..793ab470a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_820596() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_820596(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_820596(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_820596(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af2f262f81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_820596() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_820596(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_820596(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_820596(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af2f262f81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_820596() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_820596(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_820596(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_820596(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl new file mode 100644 index 0000000000..12ee4ecbbe --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_820596() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_820596(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_820596() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_820596(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_820596() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_820596(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl new file mode 100644 index 0000000000..1ecf8c985c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_820596(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_820596(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_820596(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_820596(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm new file mode 100644 index 0000000000..a657294634 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_820596 "textureDimensions_820596" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_820596 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_820596 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_820596 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_820596 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc1379f8f4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_820596() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_820596(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_820596(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_820596(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl new file mode 100644 index 0000000000..d0a3eabe53 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_83ee5a() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_83ee5a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_83ee5a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_83ee5a(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..efa903aa81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_83ee5a() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_83ee5a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_83ee5a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_83ee5a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..efa903aa81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_83ee5a() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_83ee5a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_83ee5a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_83ee5a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl new file mode 100644 index 0000000000..1f6ce583e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_83ee5a() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_83ee5a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_83ee5a() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_83ee5a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_83ee5a() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_83ee5a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl new file mode 100644 index 0000000000..29cff8f6c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_83ee5a(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_83ee5a(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_83ee5a(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_83ee5a(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm new file mode 100644 index 0000000000..32e7431649 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_83ee5a "textureDimensions_83ee5a" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_83ee5a = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_83ee5a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_83ee5a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_83ee5a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d0d5ea87c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_83ee5a() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_83ee5a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_83ee5a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_83ee5a(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl new file mode 100644 index 0000000000..bcfb646b01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 +fn textureDimensions_85d556() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_85d556(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_85d556(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_85d556(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..383bb7d313 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_85d556() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_85d556(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_85d556(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_85d556(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..383bb7d313 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_85d556() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_85d556(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_85d556(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_85d556(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl new file mode 100644 index 0000000000..0186d41694 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_85d556() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_85d556(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_85d556() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_85d556(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_85d556() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_85d556(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl new file mode 100644 index 0000000000..ee20395c33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_85d556(texture2d_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_85d556(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_85d556(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_85d556(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm new file mode 100644 index 0000000000..e15046a773 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_85d556 "textureDimensions_85d556" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_85d556 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_85d556 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_85d556 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_85d556 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl new file mode 100644 index 0000000000..4297cfbea6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_85d556() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_85d556(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_85d556(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_85d556(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl new file mode 100644 index 0000000000..659abf0d8c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 +fn textureDimensions_88ad17() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_88ad17(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_88ad17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_88ad17(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b443c7a6d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_88ad17() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_88ad17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_88ad17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_88ad17(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b443c7a6d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_88ad17() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_88ad17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_88ad17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_88ad17(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl new file mode 100644 index 0000000000..5cfa74e4fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_88ad17() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_88ad17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_0_1; +void textureDimensions_88ad17() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_88ad17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_88ad17() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_88ad17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl new file mode 100644 index 0000000000..6a00fb1ea0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_88ad17(texturecube tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_88ad17(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_88ad17(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_88ad17(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm new file mode 100644 index 0000000000..c88dd065a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_88ad17 "textureDimensions_88ad17" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %27 = OpConstantNull %v2int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_88ad17 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %27 + OpStore %arg_1 %18 + %23 = OpLoad %11 %arg_0 + %24 = OpLoad %int %arg_1 + %21 = OpImageQuerySizeLod %v2int %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %textureDimensions_88ad17 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_88ad17 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %40 = OpLabel + %41 = OpFunctionCall %void %textureDimensions_88ad17 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl new file mode 100644 index 0000000000..c7755b863c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_88ad17() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_88ad17(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_88ad17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_88ad17(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl new file mode 100644 index 0000000000..4a9ac37dd3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d) -> vec3 +fn textureDimensions_8aa4c4() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8aa4c4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8aa4c4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8aa4c4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e8a2fa1d4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8aa4c4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8aa4c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8aa4c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8aa4c4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8a2fa1d4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8aa4c4() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8aa4c4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8aa4c4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8aa4c4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl new file mode 100644 index 0000000000..45495e95e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_8aa4c4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_8aa4c4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureDimensions_8aa4c4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_8aa4c4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureDimensions_8aa4c4() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_8aa4c4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl new file mode 100644 index 0000000000..77f5715a6d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8aa4c4(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8aa4c4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8aa4c4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8aa4c4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b2376f02d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8aa4c4 "textureDimensions_8aa4c4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8aa4c4 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v3int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_8aa4c4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_8aa4c4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_8aa4c4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl new file mode 100644 index 0000000000..840105bae9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_8aa4c4() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8aa4c4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8aa4c4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8aa4c4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl new file mode 100644 index 0000000000..9ecc26fefe --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d) -> vec3 +fn textureDimensions_8deb5e() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8deb5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8deb5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8deb5e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..398823e556 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8deb5e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8deb5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8deb5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8deb5e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..398823e556 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_8deb5e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8deb5e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8deb5e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8deb5e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl new file mode 100644 index 0000000000..8869c19303 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_8deb5e() { + ivec3 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_8deb5e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureDimensions_8deb5e() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_8deb5e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_8deb5e() { + ivec3 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_8deb5e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl new file mode 100644 index 0000000000..7899845cb3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8deb5e(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8deb5e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8deb5e(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8deb5e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm new file mode 100644 index 0000000000..7afdac336f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8deb5e "textureDimensions_8deb5e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8deb5e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v3int %19 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_8deb5e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_8deb5e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_8deb5e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl new file mode 100644 index 0000000000..c3e10c786b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_8deb5e() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8deb5e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8deb5e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8deb5e(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl new file mode 100644 index 0000000000..f5e7f3af7d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array) -> vec2 +fn textureDimensions_8f20bf() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8f20bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8f20bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8f20bf(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..58462cf470 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_8f20bf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8f20bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8f20bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8f20bf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..58462cf470 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_8f20bf() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8f20bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8f20bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8f20bf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl new file mode 100644 index 0000000000..a01eead6eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_8f20bf() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_8f20bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_8f20bf() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_8f20bf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_8f20bf() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_8f20bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl new file mode 100644 index 0000000000..431a4549c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8f20bf(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_8f20bf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_8f20bf(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_8f20bf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..952b3d4b02 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8f20bf "textureDimensions_8f20bf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8f20bf = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_8f20bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_8f20bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_8f20bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d3dcb0619 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_8f20bf() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8f20bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8f20bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8f20bf(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl new file mode 100644 index 0000000000..9492de6cff --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_8fca0f() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8fca0f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8fca0f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8fca0f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ace86e03bd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8fca0f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8fca0f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8fca0f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8fca0f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ace86e03bd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_8fca0f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_8fca0f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_8fca0f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_8fca0f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl new file mode 100644 index 0000000000..255924ad16 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8fca0f() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_8fca0f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8fca0f() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_8fca0f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureDimensions_8fca0f() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_8fca0f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl new file mode 100644 index 0000000000..f104902483 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_8fca0f(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_8fca0f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_8fca0f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_8fca0f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f3281e3ee --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_8fca0f "textureDimensions_8fca0f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_8fca0f = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_8fca0f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_8fca0f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_8fca0f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl new file mode 100644 index 0000000000..6ef7d1ba5c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_8fca0f() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_8fca0f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_8fca0f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_8fca0f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl new file mode 100644 index 0000000000..86f40eda63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureDimensions(texture: texture_depth_cube_array) -> vec2 +fn textureDimensions_90340b() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_90340b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_90340b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_90340b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..26df72fa72 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_90340b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_90340b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_90340b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_90340b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26df72fa72 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_90340b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_90340b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_90340b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_90340b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl new file mode 100644 index 0000000000..09d10eb7bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_90340b() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_90340b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_90340b() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_90340b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_90340b() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_90340b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl new file mode 100644 index 0000000000..f585531ed1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_90340b(depthcube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureDimensions_90340b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_90340b(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_90340b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d4d7e7ef8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_90340b "textureDimensions_90340b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_90340b = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_90340b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_90340b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_90340b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl new file mode 100644 index 0000000000..c70e0d392e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureDimensions_90340b() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_90340b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_90340b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_90340b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl new file mode 100644 index 0000000000..1f6eb1c761 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_9042ab() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9042ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9042ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9042ab(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95dc10539c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9042ab() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9042ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9042ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9042ab(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95dc10539c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9042ab() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9042ab(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9042ab(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9042ab(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl new file mode 100644 index 0000000000..1fb6520aad --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_9042ab() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_9042ab(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_9042ab() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_9042ab(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureDimensions_9042ab() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_9042ab(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl new file mode 100644 index 0000000000..5f29287b31 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9042ab(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_9042ab(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_9042ab(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_9042ab(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm new file mode 100644 index 0000000000..d0099a03d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9042ab "textureDimensions_9042ab" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9042ab = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %22 = OpLoad %11 %arg_0 + %20 = OpImageQuerySize %v3int %22 + %17 = OpVectorShuffle %v2int %20 %20 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_9042ab + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_9042ab + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_9042ab + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl new file mode 100644 index 0000000000..1602fd8232 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_9042ab() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9042ab(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9042ab(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9042ab(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl new file mode 100644 index 0000000000..e45b0a375c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; + +// fn textureDimensions(texture: texture_depth_cube, level: i32) -> vec2 +fn textureDimensions_9393b0() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9393b0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9393b0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9393b0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..452ad7f916 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_9393b0() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9393b0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9393b0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9393b0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..452ad7f916 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_9393b0() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9393b0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9393b0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9393b0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl new file mode 100644 index 0000000000..5faaac0985 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_9393b0() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_9393b0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_9393b0() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_9393b0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_9393b0() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_9393b0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl new file mode 100644 index 0000000000..b564f162f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_9393b0(depthcube tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_2) { + textureDimensions_9393b0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { + textureDimensions_9393b0(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { + textureDimensions_9393b0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7d10e9e71 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9393b0 "textureDimensions_9393b0" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9393b0 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_9393b0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_9393b0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_9393b0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl new file mode 100644 index 0000000000..f46b018d11 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +fn textureDimensions_9393b0() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9393b0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9393b0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9393b0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl new file mode 100644 index 0000000000..6914338469 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureDimensions(texture: texture_depth_2d) -> vec2 +fn textureDimensions_939fdb() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_939fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_939fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_939fdb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1edab80e0e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_939fdb() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_939fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_939fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_939fdb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1edab80e0e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_939fdb() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_939fdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_939fdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_939fdb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl new file mode 100644 index 0000000000..380941ea5f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_939fdb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_939fdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_939fdb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_939fdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_939fdb() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_939fdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl new file mode 100644 index 0000000000..a6283fbd15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_939fdb(depth2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureDimensions_939fdb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_939fdb(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_939fdb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm new file mode 100644 index 0000000000..7e41c36dc2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_939fdb "textureDimensions_939fdb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_939fdb = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_939fdb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_939fdb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_939fdb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..eda2bcb884 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureDimensions_939fdb() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_939fdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_939fdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_939fdb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl new file mode 100644 index 0000000000..af253df8de --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube) -> vec2 +fn textureDimensions_962dcd() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_962dcd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_962dcd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_962dcd(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f1c1eb2a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_962dcd() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_962dcd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_962dcd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_962dcd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f1c1eb2a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_962dcd() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_962dcd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_962dcd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_962dcd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl new file mode 100644 index 0000000000..ded4e4210b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_962dcd() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_962dcd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_0_1; +void textureDimensions_962dcd() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_962dcd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureDimensions_962dcd() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_962dcd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl new file mode 100644 index 0000000000..052154fa52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_962dcd(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_962dcd(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_962dcd(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_962dcd(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm new file mode 100644 index 0000000000..ceac95f3ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_962dcd "textureDimensions_962dcd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_962dcd = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_962dcd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_962dcd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_962dcd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd3ca7aa54 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_962dcd() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_962dcd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_962dcd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_962dcd(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl new file mode 100644 index 0000000000..de9022219c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_9abfe5() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9abfe5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9abfe5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9abfe5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d97dcf7f31 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9abfe5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9abfe5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9abfe5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9abfe5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d97dcf7f31 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_9abfe5() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9abfe5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9abfe5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9abfe5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl new file mode 100644 index 0000000000..0de8c91026 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_9abfe5() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_9abfe5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_9abfe5() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_9abfe5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_9abfe5() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_9abfe5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl new file mode 100644 index 0000000000..cc19962ad6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9abfe5(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_9abfe5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_9abfe5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_9abfe5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a733e8c35 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9abfe5 "textureDimensions_9abfe5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9abfe5 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_9abfe5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_9abfe5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_9abfe5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl new file mode 100644 index 0000000000..5845daaf79 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_9abfe5() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9abfe5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9abfe5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9abfe5(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl new file mode 100644 index 0000000000..0ee2674e19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array, level: i32) -> vec2 +fn textureDimensions_9c9c57() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9c9c57(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9c9c57(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9c9c57(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..31b75d4d15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_9c9c57() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9c9c57(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9c9c57(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9c9c57(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31b75d4d15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_9c9c57() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9c9c57(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9c9c57(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9c9c57(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl new file mode 100644 index 0000000000..09beab32d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_9c9c57() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_9c9c57(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_9c9c57() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_9c9c57(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureDimensions_9c9c57() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_9c9c57(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl new file mode 100644 index 0000000000..97807b6924 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_9c9c57(texture2d_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_9c9c57(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_9c9c57(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_9c9c57(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm new file mode 100644 index 0000000000..f00858a94d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9c9c57 "textureDimensions_9c9c57" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9c9c57 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_9c9c57 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_9c9c57 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_9c9c57 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl new file mode 100644 index 0000000000..cffe4b1ba8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_9c9c57() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9c9c57(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9c9c57(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9c9c57(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl new file mode 100644 index 0000000000..bd2527eaeb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_9da9e2() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9da9e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9da9e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9da9e2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f500491b95 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_9da9e2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9da9e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9da9e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9da9e2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f500491b95 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_9da9e2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9da9e2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9da9e2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9da9e2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl new file mode 100644 index 0000000000..5773b40625 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_9da9e2() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_9da9e2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_9da9e2() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_9da9e2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_9da9e2() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_9da9e2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl new file mode 100644 index 0000000000..ea085fa528 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9da9e2(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_9da9e2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_9da9e2(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_9da9e2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm new file mode 100644 index 0000000000..edaecfe138 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9da9e2 "textureDimensions_9da9e2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9da9e2 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_9da9e2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_9da9e2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_9da9e2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl new file mode 100644 index 0000000000..73cfaf1b3d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_9da9e2() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9da9e2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9da9e2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9da9e2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl new file mode 100644 index 0000000000..c1f41d3bde --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_9eb8d8() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9eb8d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9eb8d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9eb8d8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cf18843418 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_9eb8d8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9eb8d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9eb8d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9eb8d8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cf18843418 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_9eb8d8() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9eb8d8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9eb8d8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9eb8d8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl new file mode 100644 index 0000000000..6185ef1959 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_9eb8d8() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_9eb8d8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_9eb8d8() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_9eb8d8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_9eb8d8() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_9eb8d8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl new file mode 100644 index 0000000000..140c2af898 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9eb8d8(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_9eb8d8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_9eb8d8(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_9eb8d8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm new file mode 100644 index 0000000000..b450c7b327 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9eb8d8 "textureDimensions_9eb8d8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9eb8d8 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_9eb8d8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_9eb8d8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_9eb8d8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc40eab388 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_9eb8d8() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9eb8d8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9eb8d8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9eb8d8(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl new file mode 100644 index 0000000000..2234617163 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d) -> vec2 +fn textureDimensions_9f8e46() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9f8e46(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9f8e46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9f8e46(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..384fdc350c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_9f8e46() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9f8e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9f8e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9f8e46(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..384fdc350c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_9f8e46() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_9f8e46(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_9f8e46(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_9f8e46(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl new file mode 100644 index 0000000000..a292ec4b7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_9f8e46() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_9f8e46(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureDimensions_9f8e46() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_9f8e46(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureDimensions_9f8e46() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_9f8e46(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl new file mode 100644 index 0000000000..b7097a21b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_9f8e46(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_9f8e46(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_9f8e46(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_9f8e46(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm new file mode 100644 index 0000000000..9fabd6ec80 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_9f8e46 "textureDimensions_9f8e46" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_9f8e46 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_9f8e46 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_9f8e46 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_9f8e46 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d3ef8378f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_9f8e46() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_9f8e46(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_9f8e46(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_9f8e46(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl new file mode 100644 index 0000000000..cd7e23a9ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureDimensions(texture: texture_depth_cube_array, level: i32) -> vec2 +fn textureDimensions_a01845() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a01845(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a01845(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a01845(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3fcaee8dbf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_a01845() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a01845(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a01845(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a01845(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3fcaee8dbf --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_a01845() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a01845(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a01845(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a01845(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl new file mode 100644 index 0000000000..283779e46c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_a01845() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_a01845(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_a01845() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_a01845(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureDimensions_a01845() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_a01845(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl new file mode 100644 index 0000000000..a386075dc3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_a01845(depthcube_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureDimensions_a01845(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_a01845(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_a01845(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f49c1bb1c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a01845 "textureDimensions_a01845" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a01845 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %28 + OpStore %arg_1 %17 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %22 = OpImageQuerySizeLod %v3int %24 %25 + %20 = OpVectorShuffle %v2int %22 %22 0 1 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_a01845 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_a01845 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureDimensions_a01845 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d395050cd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureDimensions_a01845() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a01845(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a01845(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a01845(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl new file mode 100644 index 0000000000..c2d14098e2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d) -> i32 +fn textureDimensions_a7d565() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a7d565(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a7d565(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a7d565(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..949e8b1a10 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_a7d565() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a7d565(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a7d565(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a7d565(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..949e8b1a10 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_a7d565() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a7d565(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a7d565(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a7d565(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl new file mode 100644 index 0000000000..24152c71b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_a7d565() { + int res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_a7d565(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureDimensions_a7d565() { + int res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_a7d565(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureDimensions_a7d565() { + int res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_a7d565(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl new file mode 100644 index 0000000000..aef867087f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_a7d565(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_a7d565(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_a7d565(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_a7d565(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm new file mode 100644 index 0000000000..1694f883ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a7d565 "textureDimensions_a7d565" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a7d565 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %int %19 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_a7d565 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_a7d565 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_a7d565 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl new file mode 100644 index 0000000000..76183ec117 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_a7d565() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a7d565(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a7d565(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a7d565(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl new file mode 100644 index 0000000000..4dbf2ed60f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_a863f2() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a863f2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a863f2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a863f2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..212bbcaf5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_a863f2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a863f2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a863f2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a863f2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..212bbcaf5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_a863f2() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a863f2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a863f2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a863f2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl new file mode 100644 index 0000000000..b157dd9015 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureDimensions_a863f2() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_a863f2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureDimensions_a863f2() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_a863f2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureDimensions_a863f2() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_a863f2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl new file mode 100644 index 0000000000..583342b5f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_a863f2(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_a863f2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_a863f2(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_a863f2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e5a66ac12 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a863f2 "textureDimensions_a863f2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a863f2 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_a863f2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_a863f2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_a863f2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl new file mode 100644 index 0000000000..d3e7e38700 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_a863f2() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a863f2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a863f2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a863f2(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl new file mode 100644 index 0000000000..721880be5d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube, level: i32) -> vec2 +fn textureDimensions_a9c9c1() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a9c9c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a9c9c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a9c9c1(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d7f1f2582d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_a9c9c1() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a9c9c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a9c9c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a9c9c1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d7f1f2582d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_a9c9c1() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_a9c9c1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_a9c9c1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_a9c9c1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl new file mode 100644 index 0000000000..2ed5a55c45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_a9c9c1() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_a9c9c1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_a9c9c1() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_a9c9c1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_a9c9c1() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_a9c9c1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl new file mode 100644 index 0000000000..63ccb1a385 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_a9c9c1(texturecube tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_a9c9c1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_a9c9c1(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_a9c9c1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm new file mode 100644 index 0000000000..11c075c971 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_a9c9c1 "textureDimensions_a9c9c1" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_a9c9c1 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_a9c9c1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_a9c9c1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_a9c9c1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl new file mode 100644 index 0000000000..a878fe0575 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_a9c9c1() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_a9c9c1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_a9c9c1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_a9c9c1(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl new file mode 100644 index 0000000000..f7069d2561 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 +fn textureDimensions_b0e16d() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b0e16d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b0e16d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b0e16d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6cdc838b67 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_b0e16d() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b0e16d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b0e16d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b0e16d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6cdc838b67 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_b0e16d() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b0e16d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b0e16d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b0e16d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl new file mode 100644 index 0000000000..08c8f511b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_b0e16d() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_b0e16d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureDimensions_b0e16d() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_b0e16d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_b0e16d() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_b0e16d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl new file mode 100644 index 0000000000..fe9454ada7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_b0e16d(texture2d tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_b0e16d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_b0e16d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_b0e16d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8b73a8666 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b0e16d "textureDimensions_b0e16d" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %26 = OpConstantNull %v2int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b0e16d = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v2int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v2int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_b0e16d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_b0e16d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_b0e16d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl new file mode 100644 index 0000000000..06f39cf7c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_b0e16d() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b0e16d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b0e16d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b0e16d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl new file mode 100644 index 0000000000..36a593aef9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube) -> vec2 +fn textureDimensions_b3c954() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3c954(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b3c954(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b3c954(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f0d031de32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_b3c954() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3c954(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3c954(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3c954(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0d031de32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_b3c954() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3c954(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3c954(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3c954(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl new file mode 100644 index 0000000000..855349fba4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_b3c954() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_b3c954(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_0_1; +void textureDimensions_b3c954() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_b3c954(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureDimensions_b3c954() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_b3c954(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl new file mode 100644 index 0000000000..33fc09aae0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_b3c954(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_b3c954(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_b3c954(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_b3c954(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8a392c057 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b3c954 "textureDimensions_b3c954" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b3c954 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %20 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_b3c954 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_b3c954 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_b3c954 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c364077df --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_b3c954() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3c954(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b3c954(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b3c954(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl new file mode 100644 index 0000000000..0c9bbee371 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureDimensions(texture: texture_1d, level: i32) -> i32 +fn textureDimensions_b3e407() { + var arg_1 = 0; + var res: i32 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3e407(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b3e407(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b3e407(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..035c05f0e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_b3e407() { + int arg_1 = 0; + int2 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3e407(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3e407(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3e407(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..035c05f0e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture1D arg_0 : register(t0, space1); + +void textureDimensions_b3e407() { + int arg_1 = 0; + int2 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b3e407(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b3e407(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b3e407(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl new file mode 100644 index 0000000000..0191881639 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_b3e407() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_b3e407(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureDimensions_b3e407() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_b3e407(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureDimensions_b3e407() { + int arg_1 = 0; + int res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_b3e407(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl new file mode 100644 index 0000000000..bd1261aa98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_b3e407(texture1d tint_symbol_1) { + int arg_1 = 0; + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_b3e407(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_b3e407(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_b3e407(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm new file mode 100644 index 0000000000..fdc21d2b82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b3e407 "textureDimensions_b3e407" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b3e407 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_int Function %17 + OpStore %arg_1 %17 + %21 = OpLoad %11 %arg_0 + %22 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %int %21 %22 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_b3e407 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_b3e407 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_b3e407 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl new file mode 100644 index 0000000000..95f3a26f99 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureDimensions_b3e407() { + var arg_1 = 0; + var res : i32 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b3e407(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b3e407(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b3e407(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl new file mode 100644 index 0000000000..65a63e4035 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_b91240() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b91240(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b91240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b91240(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f3c930964 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_b91240() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b91240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b91240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b91240(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f3c930964 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_b91240() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_b91240(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_b91240(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_b91240(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl new file mode 100644 index 0000000000..3976de3f5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureDimensions_b91240() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_b91240(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureDimensions_b91240() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_b91240(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureDimensions_b91240() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_b91240(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl new file mode 100644 index 0000000000..ee84ff1eb9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_b91240(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_b91240(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_b91240(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_b91240(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0757e4610 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_b91240 "textureDimensions_b91240" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_b91240 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_b91240 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_b91240 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_b91240 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c88173764 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_b91240() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_b91240(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_b91240(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_b91240(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl new file mode 100644 index 0000000000..e48c478e19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_external; + +// fn textureDimensions(texture: texture_external) -> vec2 +fn textureDimensions_ba1481() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ba1481(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_ba1481(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_ba1481(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1761c01751 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.dxc.hlsl @@ -0,0 +1,38 @@ +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_ba1481() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ba1481(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ba1481(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ba1481(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1761c01751 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.fxc.hlsl @@ -0,0 +1,38 @@ +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_ba1481() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ba1481(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ba1481(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ba1481(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl new file mode 100644 index 0000000000..47564aef5d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl @@ -0,0 +1,139 @@ +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +uniform highp sampler2D arg_0_1; +void textureDimensions_ba1481() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_ba1481(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +uniform highp sampler2D arg_0_1; +void textureDimensions_ba1481() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_ba1481(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +uniform highp sampler2D arg_0_1; +void textureDimensions_ba1481() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_ba1481(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl new file mode 100644 index 0000000000..f659868fe8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +void textureDimensions_ba1481(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_ba1481(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_ba1481(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_ba1481(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm new file mode 100644 index 0000000000..a7eb76b8dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ExternalTextureParams "ExternalTextureParams" + OpMemberName %ExternalTextureParams 0 "numPlanes" + OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly" + OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 3 "gammaDecodeParams" + OpName %GammaTransferParams "GammaTransferParams" + OpMemberName %GammaTransferParams 0 "G" + OpMemberName %GammaTransferParams 1 "A" + OpMemberName %GammaTransferParams 2 "B" + OpMemberName %GammaTransferParams 3 "C" + OpMemberName %GammaTransferParams 4 "D" + OpMemberName %GammaTransferParams 5 "E" + OpMemberName %GammaTransferParams 6 "F" + OpMemberName %GammaTransferParams 7 "padding" + OpMemberName %ExternalTextureParams 4 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix" + OpName %ext_tex_params "ext_tex_params" + OpName %arg_0 "arg_0" + OpName %textureDimensions_ba1481 "textureDimensions_ba1481" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %ext_tex_plane_1 DescriptorSet 1 + OpDecorate %ext_tex_plane_1 Binding 1 + OpDecorate %ExternalTextureParams Block + OpMemberDecorate %ExternalTextureParams 0 Offset 0 + OpMemberDecorate %ExternalTextureParams 1 Offset 4 + OpMemberDecorate %ExternalTextureParams 2 Offset 16 + OpMemberDecorate %ExternalTextureParams 2 ColMajor + OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 3 Offset 64 + OpMemberDecorate %GammaTransferParams 0 Offset 0 + OpMemberDecorate %GammaTransferParams 1 Offset 4 + OpMemberDecorate %GammaTransferParams 2 Offset 8 + OpMemberDecorate %GammaTransferParams 3 Offset 12 + OpMemberDecorate %GammaTransferParams 4 Offset 16 + OpMemberDecorate %GammaTransferParams 5 Offset 20 + OpMemberDecorate %GammaTransferParams 6 Offset 24 + OpMemberDecorate %GammaTransferParams 7 Offset 28 + OpMemberDecorate %ExternalTextureParams 4 Offset 96 + OpMemberDecorate %ExternalTextureParams 5 Offset 128 + OpMemberDecorate %ExternalTextureParams 5 ColMajor + OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16 + OpDecorate %ext_tex_params NonWritable + OpDecorate %ext_tex_params DescriptorSet 1 + OpDecorate %ext_tex_params Binding 2 + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 +%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 +%mat3v4float = OpTypeMatrix %v4float 3 +%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams +%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %21 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %32 = OpConstantNull %v2int + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_ba1481 = OpFunction %void None %21 + %24 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %32 + %28 = OpLoad %11 %arg_0 + %25 = OpImageQuerySizeLod %v2int %28 %int_0 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_ba1481 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %21 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %21 + %42 = OpLabel + %43 = OpFunctionCall %void %textureDimensions_ba1481 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %21 + %45 = OpLabel + %46 = OpFunctionCall %void %textureDimensions_ba1481 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl new file mode 100644 index 0000000000..cbc883776d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_external; + +fn textureDimensions_ba1481() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ba1481(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_ba1481(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_ba1481(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl new file mode 100644 index 0000000000..c251ab66a7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_bb3dde() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_bb3dde(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_bb3dde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_bb3dde(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..48b980a2d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_bb3dde() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_bb3dde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_bb3dde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_bb3dde(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..48b980a2d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_bb3dde() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_bb3dde(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_bb3dde(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_bb3dde(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl new file mode 100644 index 0000000000..8c5f7400b3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_bb3dde() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_bb3dde(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_bb3dde() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_bb3dde(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureDimensions_bb3dde() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_bb3dde(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl new file mode 100644 index 0000000000..0f837421b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_bb3dde(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_bb3dde(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_bb3dde(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_bb3dde(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm new file mode 100644 index 0000000000..7d300727de --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_bb3dde "textureDimensions_bb3dde" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_bb3dde = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_bb3dde + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_bb3dde + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_bb3dde + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd224fb852 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_bb3dde() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_bb3dde(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_bb3dde(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_bb3dde(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl new file mode 100644 index 0000000000..6465afc994 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_c30e75() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c30e75(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_c30e75(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_c30e75(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e4ae3823e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c30e75() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c30e75(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c30e75(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c30e75(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4ae3823e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c30e75() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c30e75(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c30e75(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c30e75(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl new file mode 100644 index 0000000000..06b6108b8c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_c30e75() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_c30e75(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_c30e75() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_c30e75(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureDimensions_c30e75() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_c30e75(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl new file mode 100644 index 0000000000..711f4aace3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_c30e75(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_c30e75(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_c30e75(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_c30e75(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm new file mode 100644 index 0000000000..05cad7c90a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_c30e75 "textureDimensions_c30e75" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_c30e75 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_c30e75 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_c30e75 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_c30e75 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl new file mode 100644 index 0000000000..121b2c32dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_c30e75() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c30e75(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_c30e75(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_c30e75(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl new file mode 100644 index 0000000000..53293aa003 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_c7943d() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c7943d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_c7943d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_c7943d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b69252d51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c7943d() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c7943d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c7943d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c7943d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b69252d51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_c7943d() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_c7943d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_c7943d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_c7943d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl new file mode 100644 index 0000000000..ec88d6e813 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_c7943d() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_c7943d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_c7943d() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_c7943d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureDimensions_c7943d() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_c7943d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl new file mode 100644 index 0000000000..39c32d13d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_c7943d(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_c7943d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_c7943d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_c7943d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f1070d207 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_c7943d "textureDimensions_c7943d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_c7943d = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_c7943d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_c7943d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_c7943d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d589b588d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_c7943d() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_c7943d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_c7943d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_c7943d(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl new file mode 100644 index 0000000000..db888ed4a6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_cc968c() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cc968c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cc968c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cc968c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e20e81bcef --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cc968c() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cc968c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cc968c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cc968c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e20e81bcef --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cc968c() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cc968c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cc968c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cc968c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl new file mode 100644 index 0000000000..d7f3becc89 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_cc968c() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cc968c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_cc968c() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cc968c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureDimensions_cc968c() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cc968c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl new file mode 100644 index 0000000000..2a4db09c42 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cc968c(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_cc968c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cc968c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cc968c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm new file mode 100644 index 0000000000..21f2dd1d8e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cc968c "textureDimensions_cc968c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cc968c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_cc968c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_cc968c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_cc968c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl new file mode 100644 index 0000000000..8caceedc84 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_cc968c() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cc968c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cc968c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cc968c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl new file mode 100644 index 0000000000..ac049143ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_cccc8f() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cccc8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cccc8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cccc8f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8030a26359 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cccc8f() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cccc8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cccc8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cccc8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8030a26359 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_cccc8f() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cccc8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cccc8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cccc8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl new file mode 100644 index 0000000000..8ea9b9ed23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureDimensions_cccc8f() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cccc8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureDimensions_cccc8f() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cccc8f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureDimensions_cccc8f() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cccc8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl new file mode 100644 index 0000000000..f03ce0c682 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cccc8f(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_cccc8f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cccc8f(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cccc8f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..ae7cb8d608 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cccc8f "textureDimensions_cccc8f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cccc8f = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureDimensions_cccc8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureDimensions_cccc8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_cccc8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..19570add23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_cccc8f() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cccc8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cccc8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cccc8f(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl new file mode 100644 index 0000000000..1bca07eb21 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_cd76a7() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cd76a7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cd76a7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cd76a7(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..107e7e6b32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cd76a7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cd76a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cd76a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cd76a7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..107e7e6b32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cd76a7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cd76a7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cd76a7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cd76a7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl new file mode 100644 index 0000000000..92b0daea4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureDimensions_cd76a7() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cd76a7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureDimensions_cd76a7() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cd76a7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureDimensions_cd76a7() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cd76a7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl new file mode 100644 index 0000000000..14b141addd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cd76a7(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_cd76a7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cd76a7(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cd76a7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm new file mode 100644 index 0000000000..6d33337b5a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cd76a7 "textureDimensions_cd76a7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cd76a7 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_cd76a7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_cd76a7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_cd76a7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa3b1a9c68 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_cd76a7() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cd76a7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cd76a7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cd76a7(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl new file mode 100644 index 0000000000..f4348817b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_cdf473() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cdf473(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cdf473(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cdf473(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..895f7d05b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_cdf473() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cdf473(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cdf473(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cdf473(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..895f7d05b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_cdf473() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cdf473(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cdf473(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cdf473(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl new file mode 100644 index 0000000000..ea5fe7d9f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_cdf473() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_cdf473(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_cdf473() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_cdf473(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureDimensions_cdf473() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_cdf473(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl new file mode 100644 index 0000000000..fa50285dcc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cdf473(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_cdf473(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_cdf473(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_cdf473(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm new file mode 100644 index 0000000000..30caae894f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cdf473 "textureDimensions_cdf473" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cdf473 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_cdf473 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_cdf473 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_cdf473 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl new file mode 100644 index 0000000000..a675dad97e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_cdf473() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cdf473(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cdf473(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cdf473(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl new file mode 100644 index 0000000000..dfdf7598e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureDimensions(texture: texture_2d_array) -> vec2 +fn textureDimensions_cec841() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cec841(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cec841(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cec841(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b892fb9f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_cec841() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cec841(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cec841(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cec841(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b892fb9f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureDimensions_cec841() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cec841(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cec841(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cec841(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl new file mode 100644 index 0000000000..6c4ff13a80 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_cec841() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_cec841(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_cec841() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_cec841(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureDimensions_cec841() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_cec841(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl new file mode 100644 index 0000000000..7c0b4ee3e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cec841(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_cec841(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_cec841(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_cec841(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm new file mode 100644 index 0000000000..34eb8ecef6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cec841 "textureDimensions_cec841" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cec841 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_cec841 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_cec841 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_cec841 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl new file mode 100644 index 0000000000..7a92b371d0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureDimensions_cec841() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cec841(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cec841(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cec841(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl new file mode 100644 index 0000000000..0d4830e4ce --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_cf7e43() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cf7e43(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cf7e43(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cf7e43(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f8b6211340 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cf7e43() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cf7e43(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cf7e43(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cf7e43(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f8b6211340 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_cf7e43() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_cf7e43(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_cf7e43(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_cf7e43(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl new file mode 100644 index 0000000000..8b491fba70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureDimensions_cf7e43() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_cf7e43(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureDimensions_cf7e43() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_cf7e43(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureDimensions_cf7e43() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_cf7e43(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl new file mode 100644 index 0000000000..210364294b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_cf7e43(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_cf7e43(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_cf7e43(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_cf7e43(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm new file mode 100644 index 0000000000..62a64df145 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_cf7e43 "textureDimensions_cf7e43" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %v3int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_cf7e43 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v3int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_cf7e43 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_cf7e43 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_cf7e43 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl new file mode 100644 index 0000000000..38c9845f8b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_cf7e43() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_cf7e43(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_cf7e43(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_cf7e43(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl new file mode 100644 index 0000000000..1dbf0740ef --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureDimensions(texture: texture_cube) -> vec2 +fn textureDimensions_d125bc() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d125bc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_d125bc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_d125bc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bf2c107f3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_d125bc() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d125bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d125bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d125bc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf2c107f3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureDimensions_d125bc() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d125bc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d125bc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d125bc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl new file mode 100644 index 0000000000..0debada7db --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_d125bc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_d125bc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureDimensions_d125bc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_d125bc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureDimensions_d125bc() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_d125bc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl new file mode 100644 index 0000000000..67f0abcb41 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_d125bc(texturecube tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureDimensions_d125bc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureDimensions_d125bc(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureDimensions_d125bc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d3b32a3d1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_d125bc "textureDimensions_d125bc" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_d125bc = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_d125bc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_d125bc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_d125bc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl new file mode 100644 index 0000000000..21f8b055f3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureDimensions_d125bc() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d125bc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_d125bc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_d125bc(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl new file mode 100644 index 0000000000..78cc307ae0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array, level: i32) -> vec2 +fn textureDimensions_d83c45() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d83c45(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_d83c45(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_d83c45(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ccc18c3d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_d83c45() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d83c45(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d83c45(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d83c45(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ccc18c3d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_d83c45() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_d83c45(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_d83c45(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_d83c45(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl new file mode 100644 index 0000000000..7264f8b3f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_d83c45() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +vec4 vertex_main() { + textureDimensions_d83c45(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_d83c45() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void fragment_main() { + textureDimensions_d83c45(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureDimensions_d83c45() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1).xy; +} + +void compute_main() { + textureDimensions_d83c45(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl new file mode 100644 index 0000000000..15239da48d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_d83c45(texturecube_array tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_d83c45(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_d83c45(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_d83c45(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm new file mode 100644 index 0000000000..8aa6e79da9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_d83c45 "textureDimensions_d83c45" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_d83c45 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %29 + OpStore %arg_1 %18 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %int %arg_1 + %23 = OpImageQuerySizeLod %v3int %25 %26 + %21 = OpVectorShuffle %v2int %23 %23 0 1 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_d83c45 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_d83c45 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureDimensions_d83c45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl new file mode 100644 index 0000000000..13f8d6b1ed --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_d83c45() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_d83c45(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_d83c45(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_d83c45(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl new file mode 100644 index 0000000000..5eb5422f98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 +fn textureDimensions_daf7c0() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_daf7c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_daf7c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_daf7c0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b44a6b8646 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_daf7c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_daf7c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_daf7c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_daf7c0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b44a6b8646 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_daf7c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_daf7c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_daf7c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_daf7c0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl new file mode 100644 index 0000000000..5cfbb47de9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureDimensions_daf7c0() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_daf7c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DMS arg_0_1; +void textureDimensions_daf7c0() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_daf7c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureDimensions_daf7c0() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_daf7c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl new file mode 100644 index 0000000000..9f811af45e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_daf7c0(texture2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureDimensions_daf7c0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_daf7c0(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_daf7c0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..05b6fe7726 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_daf7c0 "textureDimensions_daf7c0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_daf7c0 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v2int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_daf7c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_daf7c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_daf7c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..cf8158373d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureDimensions_daf7c0() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_daf7c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_daf7c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_daf7c0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl new file mode 100644 index 0000000000..ff016ebdab --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureDimensions(texture: texture_storage_1d) -> i32 +fn textureDimensions_dc2dd0() { + var res: i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_dc2dd0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_dc2dd0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_dc2dd0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..20e9146625 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_dc2dd0() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_dc2dd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_dc2dd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_dc2dd0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20e9146625 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureDimensions_dc2dd0() { + int tint_tmp; + arg_0.GetDimensions(tint_tmp); + int res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_dc2dd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_dc2dd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_dc2dd0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl new file mode 100644 index 0000000000..3d7ac148af --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_dc2dd0() { + int res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_dc2dd0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_dc2dd0() { + int res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_dc2dd0(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureDimensions_dc2dd0() { + int res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_dc2dd0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl new file mode 100644 index 0000000000..9e5082a93f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_dc2dd0(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_width(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureDimensions_dc2dd0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureDimensions_dc2dd0(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureDimensions_dc2dd0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm new file mode 100644 index 0000000000..074de23be3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_dc2dd0 "textureDimensions_dc2dd0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_dc2dd0 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_dc2dd0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_dc2dd0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_dc2dd0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl new file mode 100644 index 0000000000..53eaf8fad7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureDimensions_dc2dd0() { + var res : i32 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_dc2dd0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_dc2dd0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_dc2dd0(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl new file mode 100644 index 0000000000..5650d3596c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureDimensions(texture: texture_cube_array) -> vec2 +fn textureDimensions_e927be() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e927be(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_e927be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_e927be(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3be868f09c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_e927be() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e927be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e927be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e927be(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3be868f09c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureDimensions_e927be() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e927be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e927be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e927be(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl new file mode 100644 index 0000000000..a476da2758 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_e927be() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +vec4 vertex_main() { + textureDimensions_e927be(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_e927be() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void fragment_main() { + textureDimensions_e927be(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureDimensions_e927be() { + ivec2 res = textureSize(arg_0_1, 0).xy; +} + +void compute_main() { + textureDimensions_e927be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl new file mode 100644 index 0000000000..709257fa98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_e927be(texturecube_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureDimensions_e927be(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_e927be(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_e927be(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm new file mode 100644 index 0000000000..021901e9ed --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_e927be "textureDimensions_e927be" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %25 = OpConstantNull %v2int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_e927be = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %17 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureDimensions_e927be + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_e927be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureDimensions_e927be + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl new file mode 100644 index 0000000000..1c420a19d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureDimensions_e927be() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e927be(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_e927be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_e927be(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl new file mode 100644 index 0000000000..4399a364f3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_e9e96c() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e9e96c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_e9e96c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_e9e96c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..510eef86c0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_e9e96c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e9e96c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e9e96c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e9e96c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..510eef86c0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_e9e96c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_e9e96c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_e9e96c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_e9e96c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl new file mode 100644 index 0000000000..c167c243cb --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_e9e96c() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_e9e96c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_e9e96c() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_e9e96c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_e9e96c() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_e9e96c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl new file mode 100644 index 0000000000..d512809aa0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_e9e96c(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_e9e96c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_e9e96c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_e9e96c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm new file mode 100644 index 0000000000..3bc1dd4e43 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_e9e96c "textureDimensions_e9e96c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_e9e96c = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_e9e96c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_e9e96c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_e9e96c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl new file mode 100644 index 0000000000..4c37479f96 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_e9e96c() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_e9e96c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_e9e96c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_e9e96c(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl new file mode 100644 index 0000000000..40048ce136 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureDimensions(texture: texture_multisampled_2d) -> vec2 +fn textureDimensions_ef5b89() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ef5b89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_ef5b89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_ef5b89(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4bc53da64e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_ef5b89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ef5b89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ef5b89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ef5b89(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bc53da64e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_ef5b89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_ef5b89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_ef5b89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_ef5b89(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl new file mode 100644 index 0000000000..c0c1d74400 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_ef5b89() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_ef5b89(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_ef5b89() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_ef5b89(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_ef5b89() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_ef5b89(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl new file mode 100644 index 0000000000..a0d18a7526 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_ef5b89(texture2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureDimensions_ef5b89(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_ef5b89(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_ef5b89(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm new file mode 100644 index 0000000000..2cb1a7f2fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_ef5b89 "textureDimensions_ef5b89" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_ef5b89 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_ef5b89 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_ef5b89 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_ef5b89 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl new file mode 100644 index 0000000000..32a0325cfd --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureDimensions_ef5b89() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_ef5b89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_ef5b89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_ef5b89(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl new file mode 100644 index 0000000000..3f12ffe3d1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureDimensions(texture: texture_3d, level: i32) -> vec3 +fn textureDimensions_efc8a4() { + var arg_1 = 0; + var res: vec3 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_efc8a4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_efc8a4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_efc8a4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..359fc0bd59 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_efc8a4() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_efc8a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_efc8a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_efc8a4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..359fc0bd59 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); + +void textureDimensions_efc8a4() { + int arg_1 = 0; + int4 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int3 res = tint_tmp.xyz; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_efc8a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_efc8a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_efc8a4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl new file mode 100644 index 0000000000..eab90c06ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_efc8a4() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_efc8a4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureDimensions_efc8a4() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_efc8a4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureDimensions_efc8a4() { + int arg_1 = 0; + ivec3 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_efc8a4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl new file mode 100644 index 0000000000..d1ba35ec51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_efc8a4(texture3d tint_symbol_1) { + int arg_1 = 0; + int3 res = int3(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1), tint_symbol_1.get_depth(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_efc8a4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_efc8a4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_efc8a4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm new file mode 100644 index 0000000000..83fbad656b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_efc8a4 "textureDimensions_efc8a4" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %26 = OpConstantNull %v3int + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_efc8a4 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %17 + %res = OpVariable %_ptr_Function_v3int Function %26 + OpStore %arg_1 %17 + %22 = OpLoad %11 %arg_0 + %23 = OpLoad %int %arg_1 + %20 = OpImageQuerySizeLod %v3int %22 %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureDimensions_efc8a4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_efc8a4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureDimensions_efc8a4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl new file mode 100644 index 0000000000..f65550d1c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureDimensions_efc8a4() { + var arg_1 = 0; + var res : vec3 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_efc8a4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_efc8a4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_efc8a4(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl new file mode 100644 index 0000000000..836def2a9e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; + +// fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2 +fn textureDimensions_f60bdb() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f60bdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f60bdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f60bdb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1609032503 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_f60bdb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f60bdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f60bdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f60bdb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1609032503 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureDimensions_f60bdb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f60bdb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f60bdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f60bdb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl new file mode 100644 index 0000000000..943195634d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_f60bdb() { + ivec2 res = textureSize(arg_0_1); +} + +vec4 vertex_main() { + textureDimensions_f60bdb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_f60bdb() { + ivec2 res = textureSize(arg_0_1); +} + +void fragment_main() { + textureDimensions_f60bdb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureDimensions_f60bdb() { + ivec2 res = textureSize(arg_0_1); +} + +void compute_main() { + textureDimensions_f60bdb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl new file mode 100644 index 0000000000..1ec0626ad9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_f60bdb(depth2d_ms tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_ms tint_symbol_2) { + textureDimensions_f60bdb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { + textureDimensions_f60bdb(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { + textureDimensions_f60bdb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm new file mode 100644 index 0000000000..e43fe0b98a --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_f60bdb "textureDimensions_f60bdb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_f60bdb = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_f60bdb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_f60bdb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_f60bdb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl new file mode 100644 index 0000000000..f22008da03 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; + +fn textureDimensions_f60bdb() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f60bdb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f60bdb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f60bdb(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl new file mode 100644 index 0000000000..e40ebb4b9b --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d, level: i32) -> vec2 +fn textureDimensions_f7145b() { + var arg_1 = 0; + var res: vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f7145b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f7145b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f7145b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54d1c39bf6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_f7145b() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f7145b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f7145b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f7145b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54d1c39bf6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_f7145b() { + int arg_1 = 0; + int3 tint_tmp; + arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f7145b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f7145b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f7145b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl new file mode 100644 index 0000000000..23309a590d --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_f7145b() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +vec4 vertex_main() { + textureDimensions_f7145b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureDimensions_f7145b() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void fragment_main() { + textureDimensions_f7145b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureDimensions_f7145b() { + int arg_1 = 0; + ivec2 res = textureSize(arg_0_1, arg_1); +} + +void compute_main() { + textureDimensions_f7145b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl new file mode 100644 index 0000000000..7fff8169d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureDimensions_f7145b(texture2d tint_symbol_1) { + int arg_1 = 0; + int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_f7145b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_f7145b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_f7145b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm new file mode 100644 index 0000000000..cf66407f83 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_f7145b "textureDimensions_f7145b" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %27 = OpConstantNull %v2int + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_f7145b = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %18 + %res = OpVariable %_ptr_Function_v2int Function %27 + OpStore %arg_1 %18 + %23 = OpLoad %11 %arg_0 + %24 = OpLoad %int %arg_1 + %21 = OpImageQuerySizeLod %v2int %23 %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %textureDimensions_f7145b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_f7145b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %40 = OpLabel + %41 = OpFunctionCall %void %textureDimensions_f7145b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl new file mode 100644 index 0000000000..a04f27d1fe --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_f7145b() { + var arg_1 = 0; + var res : vec2 = textureDimensions(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f7145b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f7145b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f7145b(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl new file mode 100644 index 0000000000..e7304f57e9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureDimensions(texture: texture_storage_2d) -> vec2 +fn textureDimensions_f931c7() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f931c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f931c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f931c7(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9e231e6b57 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_f931c7() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f931c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f931c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f931c7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9e231e6b57 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureDimensions_f931c7() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_f931c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_f931c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_f931c7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl new file mode 100644 index 0000000000..016f679a07 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureDimensions_f931c7() { + ivec2 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_f931c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureDimensions_f931c7() { + ivec2 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_f931c7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureDimensions_f931c7() { + ivec2 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_f931c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl new file mode 100644 index 0000000000..7b39e0fb9e --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_f931c7(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_f931c7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_f931c7(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_f931c7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..2375b4d725 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_f931c7 "textureDimensions_f931c7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %v2int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_f931c7 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %22 + %19 = OpLoad %11 %arg_0 + %16 = OpImageQuerySize %v2int %19 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureDimensions_f931c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %void %textureDimensions_f931c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %void %textureDimensions_f931c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..041ed4c1b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureDimensions_f931c7() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_f931c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_f931c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_f931c7(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl new file mode 100644 index 0000000000..0f438d3405 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureDimensions(texture: texture_2d) -> vec2 +fn textureDimensions_fa9859() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fa9859(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fa9859(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fa9859(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4bfdddf6b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_fa9859() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fa9859(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fa9859(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fa9859(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bfdddf6b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureDimensions_fa9859() { + int2 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y); + int2 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fa9859(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fa9859(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fa9859(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl new file mode 100644 index 0000000000..d8e8370ef5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_fa9859() { + ivec2 res = textureSize(arg_0_1, 0); +} + +vec4 vertex_main() { + textureDimensions_fa9859(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureDimensions_fa9859() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void fragment_main() { + textureDimensions_fa9859(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureDimensions_fa9859() { + ivec2 res = textureSize(arg_0_1, 0); +} + +void compute_main() { + textureDimensions_fa9859(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl new file mode 100644 index 0000000000..5fca056387 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_fa9859(texture2d tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureDimensions_fa9859(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureDimensions_fa9859(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureDimensions_fa9859(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm new file mode 100644 index 0000000000..769c44ef70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_fa9859 "textureDimensions_fa9859" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %23 = OpConstantNull %v2int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_fa9859 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %23 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySizeLod %v2int %19 %int_0 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_fa9859 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_fa9859 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_fa9859 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl new file mode 100644 index 0000000000..3acbf7dd2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureDimensions_fa9859() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fa9859(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fa9859(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fa9859(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl new file mode 100644 index 0000000000..da81f0dd75 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureDimensions(texture: texture_storage_2d_array) -> vec2 +fn textureDimensions_fb5670() { + var res: vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fb5670(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fb5670(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fb5670(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3f6c71f974 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_fb5670() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fb5670(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fb5670(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fb5670(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3f6c71f974 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureDimensions_fb5670() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int2 res = tint_tmp.xy; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fb5670(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fb5670(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fb5670(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl new file mode 100644 index 0000000000..5c3bd40cfc --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_fb5670() { + ivec2 res = imageSize(arg_0).xy; +} + +vec4 vertex_main() { + textureDimensions_fb5670(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_fb5670() { + ivec2 res = imageSize(arg_0).xy; +} + +void fragment_main() { + textureDimensions_fb5670(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureDimensions_fb5670() { + ivec2 res = imageSize(arg_0).xy; +} + +void compute_main() { + textureDimensions_fb5670(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl new file mode 100644 index 0000000000..fed740f414 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_fb5670(texture2d_array tint_symbol_1) { + int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureDimensions_fb5670(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureDimensions_fb5670(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureDimensions_fb5670(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm new file mode 100644 index 0000000000..c870194c01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_fb5670 "textureDimensions_fb5670" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_fb5670 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_v2int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %16 = OpVectorShuffle %v2int %19 %19 0 1 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureDimensions_fb5670 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureDimensions_fb5670 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureDimensions_fb5670 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl new file mode 100644 index 0000000000..199f3559ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureDimensions_fb5670() { + var res : vec2 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fb5670(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fb5670(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fb5670(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl new file mode 100644 index 0000000000..f99ff3f10c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureDimensions(texture: texture_storage_3d) -> vec3 +fn textureDimensions_fcac78() { + var res: vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fcac78(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fcac78(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fcac78(); +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f02946b4e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_fcac78() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fcac78(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fcac78(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fcac78(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f02946b4e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureDimensions_fcac78() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 res = tint_tmp; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureDimensions_fcac78(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureDimensions_fcac78(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureDimensions_fcac78(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl new file mode 100644 index 0000000000..9226dcd02c --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_fcac78() { + ivec3 res = imageSize(arg_0); +} + +vec4 vertex_main() { + textureDimensions_fcac78(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_fcac78() { + ivec3 res = imageSize(arg_0); +} + +void fragment_main() { + textureDimensions_fcac78(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureDimensions_fcac78() { + ivec3 res = imageSize(arg_0); +} + +void compute_main() { + textureDimensions_fcac78(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl new file mode 100644 index 0000000000..3c6340c1e9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureDimensions_fcac78(texture3d tint_symbol_1) { + int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureDimensions_fcac78(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureDimensions_fcac78(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureDimensions_fcac78(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b1c5c3df1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureDimensions_fcac78 "textureDimensions_fcac78" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %23 = OpConstantNull %v3int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureDimensions_fcac78 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_v3int Function %23 + %20 = OpLoad %11 %arg_0 + %17 = OpImageQuerySize %v3int %20 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureDimensions_fcac78 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureDimensions_fcac78 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_fcac78 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e13671d20 --- /dev/null +++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureDimensions_fcac78() { + var res : vec3 = textureDimensions(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureDimensions_fcac78(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureDimensions_fcac78(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureDimensions_fcac78(); +} diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl new file mode 100644 index 0000000000..49612c6fc9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_10c554() { + var arg_2 = vec3(); + var res: vec4 = textureGather(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_10c554(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_10c554(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_10c554(); +} diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eab22776f4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_10c554() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Gather(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_10c554(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_10c554(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_10c554(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..eab22776f4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_10c554() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Gather(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_10c554(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_10c554(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_10c554(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl new file mode 100644 index 0000000000..e6f2add193 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGather_10c554() { + vec3 arg_2 = vec3(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +vec4 vertex_main() { + textureGather_10c554(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGather_10c554() { + vec3 arg_2 = vec3(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +void fragment_main() { + textureGather_10c554(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGather_10c554() { + vec3 arg_2 = vec3(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +void compute_main() { + textureGather_10c554(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl new file mode 100644 index 0000000000..16595bde0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_10c554(depthcube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureGather_10c554(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_10c554(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_10c554(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm new file mode 100644 index 0000000000..76b255317f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_10c554 "textureGather_10c554" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_10c554 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + %24 = OpLoad %14 %arg_1 + %25 = OpLoad %11 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v3float %arg_2 + %23 = OpImageGather %v4float %27 %28 %int_0 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_10c554 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_10c554 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_10c554 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl new file mode 100644 index 0000000000..4df84e8e08 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_10c554() { + var arg_2 = vec3(); + var res : vec4 = textureGather(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_10c554(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_10c554(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_10c554(); +} diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl new file mode 100644 index 0000000000..2b830f64f4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_1f7f6b() { + var arg_2 = vec2(); + var res: vec4 = textureGather(arg_0, arg_1, arg_2, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_1f7f6b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_1f7f6b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_1f7f6b(); +} diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..36412fad8e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_1f7f6b() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Gather(arg_1, arg_2, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_1f7f6b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_1f7f6b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_1f7f6b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..36412fad8e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_1f7f6b() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Gather(arg_1, arg_2, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_1f7f6b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_1f7f6b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_1f7f6b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl new file mode 100644 index 0000000000..151624890f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, 0.0, ivec2(0)); +} + +vec4 vertex_main() { + textureGather_1f7f6b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, 0.0, ivec2(0)); +} + +void fragment_main() { + textureGather_1f7f6b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_1f7f6b() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, 0.0, ivec2(0)); +} + +void compute_main() { + textureGather_1f7f6b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl new file mode 100644 index 0000000000..5219d4f534 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_1f7f6b(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_1f7f6b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_1f7f6b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_1f7f6b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm new file mode 100644 index 0000000000..d32d0526d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_1f7f6b "textureGather_1f7f6b" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_1f7f6b = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + %24 = OpLoad %14 %arg_1 + %25 = OpLoad %11 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v2float %arg_2 + %23 = OpImageGather %v4float %27 %28 %int_0 ConstOffset %32 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_1f7f6b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_1f7f6b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_1f7f6b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl new file mode 100644 index 0000000000..33aec6eb6c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_1f7f6b() { + var arg_2 = vec2(); + var res : vec4 = textureGather(arg_0, arg_1, arg_2, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_1f7f6b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_1f7f6b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_1f7f6b(); +} diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl new file mode 100644 index 0000000000..55a3549cab --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_22e930() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_22e930(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_22e930(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_22e930(); +} diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7aa31c9885 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_22e930() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_22e930(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_22e930(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_22e930(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7aa31c9885 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_22e930() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_22e930(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_22e930(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_22e930(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl new file mode 100644 index 0000000000..af841336f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_22e930(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_22e930(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_22e930() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_22e930(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl new file mode 100644 index 0000000000..d6b3f74d37 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_22e930(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_22e930(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_22e930(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_22e930(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm new file mode 100644 index 0000000000..dce3fe053d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_22e930 "textureGather_22e930" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_22e930 = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + OpStore %arg_4 %int_1 + %29 = OpLoad %14 %arg_2 + %30 = OpLoad %11 %arg_1 + %32 = OpSampledImage %31 %30 %29 + %34 = OpLoad %v2float %arg_3 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %38 = OpLoad %int %arg_4 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v3float %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_22e930 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %void %textureGather_22e930 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_22e930 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl new file mode 100644 index 0000000000..e804200500 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_22e930() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_22e930(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_22e930(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_22e930(); +} diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl new file mode 100644 index 0000000000..01fa4da1b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_2cc066() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2cc066(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_2cc066(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_2cc066(); +} diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3d64cb3118 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_2cc066() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2cc066(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2cc066(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2cc066(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3d64cb3118 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_2cc066() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2cc066(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2cc066(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2cc066(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl new file mode 100644 index 0000000000..42cedd124d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_2cc066(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_2cc066(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_2cc066() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_2cc066(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl new file mode 100644 index 0000000000..1788324a49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_2cc066(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_2cc066(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_2cc066(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_2cc066(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba22c06769 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_2cc066 "textureGather_2cc066" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %44 = OpConstantNull %v4uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_2cc066 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %28 + %res = OpVariable %_ptr_Function_v4uint Function %44 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %31 = OpLoad %15 %arg_2 + %32 = OpLoad %11 %arg_1 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_3 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_4 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %29 = OpImageGather %v4uint %34 %41 %int_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_2cc066 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_2cc066 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGather_2cc066 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl new file mode 100644 index 0000000000..d6358a9bc4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_2cc066() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2cc066(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_2cc066(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_2cc066(); +} diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl new file mode 100644 index 0000000000..0d14aa36a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_2e0ed5() { + var arg_2 = vec2(); + var res: vec4 = textureGather(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2e0ed5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_2e0ed5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_2e0ed5(); +} diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..995319a09a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_2e0ed5() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Gather(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2e0ed5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2e0ed5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2e0ed5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..995319a09a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_2e0ed5() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Gather(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_2e0ed5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_2e0ed5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_2e0ed5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl new file mode 100644 index 0000000000..56056aeb55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_2e0ed5() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +vec4 vertex_main() { + textureGather_2e0ed5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_2e0ed5() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +void fragment_main() { + textureGather_2e0ed5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGather_2e0ed5() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0); +} + +void compute_main() { + textureGather_2e0ed5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl new file mode 100644 index 0000000000..0fafcf7131 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_2e0ed5(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_2e0ed5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_2e0ed5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_2e0ed5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm new file mode 100644 index 0000000000..c33a890d85 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_2e0ed5 "textureGather_2e0ed5" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_2e0ed5 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + %24 = OpLoad %14 %arg_1 + %25 = OpLoad %11 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v2float %arg_2 + %23 = OpImageGather %v4float %27 %28 %int_0 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_2e0ed5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_2e0ed5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_2e0ed5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl new file mode 100644 index 0000000000..b5d2415adf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_2e0ed5() { + var arg_2 = vec2(); + var res : vec4 = textureGather(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_2e0ed5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_2e0ed5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_2e0ed5(); +} diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl new file mode 100644 index 0000000000..dc783519b0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_32c4e8() { + var arg_3 = vec3(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_32c4e8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_32c4e8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_32c4e8(); +} diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6843bb16f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_32c4e8() { + float3 arg_3 = (0.0f).xxx; + float4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_32c4e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_32c4e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_32c4e8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6843bb16f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_32c4e8() { + float3 arg_3 = (0.0f).xxx; + float4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_32c4e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_32c4e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_32c4e8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl new file mode 100644 index 0000000000..aa2ae8009b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec3 arg_3 = vec3(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_32c4e8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec3 arg_3 = vec3(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_32c4e8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_1_arg_2; + +void textureGather_32c4e8() { + vec3 arg_3 = vec3(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_32c4e8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl new file mode 100644 index 0000000000..6bcc6d7fd3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_32c4e8(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_32c4e8(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_32c4e8(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_32c4e8(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm new file mode 100644 index 0000000000..af17d8105b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_32c4e8 "textureGather_32c4e8" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_32c4e8 = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + %24 = OpLoad %14 %arg_2 + %25 = OpLoad %11 %arg_1 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v3float %arg_3 + %23 = OpImageGather %v4float %27 %28 %int_1 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_32c4e8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_32c4e8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_32c4e8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..d748a7b081 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_32c4e8() { + var arg_3 = vec3(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_32c4e8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_32c4e8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_32c4e8(); +} diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl new file mode 100644 index 0000000000..638c14cc8e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_3b32cc() { + var arg_3 = vec3(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_3b32cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_3b32cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_3b32cc(); +} diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2845979813 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_3b32cc() { + float3 arg_3 = (0.0f).xxx; + uint4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_3b32cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_3b32cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_3b32cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2845979813 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_3b32cc() { + float3 arg_3 = (0.0f).xxx; + uint4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_3b32cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_3b32cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_3b32cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl new file mode 100644 index 0000000000..12cba16237 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + vec3 arg_3 = vec3(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_3b32cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + vec3 arg_3 = vec3(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_3b32cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usamplerCube arg_1_arg_2; + +void textureGather_3b32cc() { + vec3 arg_3 = vec3(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_3b32cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl new file mode 100644 index 0000000000..f1dfbe57b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_3b32cc(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_3b32cc(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_3b32cc(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_3b32cc(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..2a2979191f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_3b32cc "textureGather_3b32cc" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %21 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4uint = OpTypeVector %uint 4 + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %35 = OpConstantNull %v4uint + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_3b32cc = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %21 + %res = OpVariable %_ptr_Function_v4uint Function %35 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_3 + %24 = OpImageGather %v4uint %29 %30 %int_1 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureGather_3b32cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_3b32cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGather_3b32cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d33dcb297 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_3b32cc() { + var arg_3 = vec3(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_3b32cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_3b32cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_3b32cc(); +} diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl new file mode 100644 index 0000000000..2b66be7162 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_43025d() { + var arg_2 = vec3(); + var arg_3 = 1; + var res: vec4 = textureGather(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_43025d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_43025d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_43025d(); +} diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95e40237e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_43025d() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float4 res = arg_0.Gather(arg_1, float4(arg_2, float(arg_3))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_43025d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_43025d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_43025d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95e40237e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_43025d() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float4 res = arg_0.Gather(arg_1, float4(arg_2, float(arg_3))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_43025d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_43025d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_43025d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl new file mode 100644 index 0000000000..864a150164 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGather_43025d() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0); +} + +vec4 vertex_main() { + textureGather_43025d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGather_43025d() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0); +} + +void fragment_main() { + textureGather_43025d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGather_43025d() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0); +} + +void compute_main() { + textureGather_43025d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl new file mode 100644 index 0000000000..ed0f44ae9e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_43025d(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_43025d(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_43025d(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_43025d(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm new file mode 100644 index 0000000000..50439ce0bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_43025d "textureGather_43025d" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %43 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_43025d = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v3float %arg_2 + %34 = OpCompositeExtract %float %33 0 + %35 = OpCompositeExtract %float %33 1 + %36 = OpCompositeExtract %float %33 2 + %38 = OpLoad %int %arg_3 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v4float %34 %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_0 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %43 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_43025d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %48 = OpLabel + %49 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %49 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %52 = OpLabel + %53 = OpFunctionCall %void %textureGather_43025d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureGather_43025d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl new file mode 100644 index 0000000000..8624141d78 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_43025d() { + var arg_2 = vec3(); + var arg_3 = 1; + var res : vec4 = textureGather(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_43025d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_43025d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_43025d(); +} diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl new file mode 100644 index 0000000000..2984b5b3a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_49b07f() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_49b07f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_49b07f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_49b07f(); +} diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..42046f3c0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_49b07f() { + float2 arg_3 = (0.0f).xx; + uint4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_49b07f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_49b07f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_49b07f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..42046f3c0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_49b07f() { + float2 arg_3 = (0.0f).xx; + uint4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_49b07f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_49b07f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_49b07f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl new file mode 100644 index 0000000000..e576f45ad9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_49b07f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void fragment_main() { + textureGather_49b07f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_49b07f() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void compute_main() { + textureGather_49b07f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl new file mode 100644 index 0000000000..b83245ec2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_49b07f(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_49b07f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_49b07f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_49b07f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc3d0f9ce2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_49b07f "textureGather_49b07f" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4uint = OpTypeVector %uint 4 + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %34 = OpConstantNull %v2int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %37 = OpConstantNull %v4uint + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_49b07f = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %res = OpVariable %_ptr_Function_v4uint Function %37 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_3 + %24 = OpImageGather %v4uint %29 %30 %int_1 ConstOffset %34 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureGather_49b07f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_49b07f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %50 = OpLabel + %51 = OpFunctionCall %void %textureGather_49b07f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl new file mode 100644 index 0000000000..78eb732857 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_49b07f() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_49b07f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_49b07f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_49b07f(); +} diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl new file mode 100644 index 0000000000..4afc2bce99 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_4b8103() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_4b8103(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_4b8103(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_4b8103(); +} diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5016110b55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_4b8103() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_4b8103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_4b8103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_4b8103(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5016110b55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_4b8103() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_4b8103(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_4b8103(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_4b8103(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl new file mode 100644 index 0000000000..186aab25b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_4b8103(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_4b8103(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_1_arg_2; + +void textureGather_4b8103() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void compute_main() { + textureGather_4b8103(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl new file mode 100644 index 0000000000..2c3b8cd343 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_4b8103(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_4b8103(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_4b8103(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_4b8103(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b14a0827e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_4b8103 "textureGather_4b8103" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %41 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_4b8103 = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + OpStore %arg_4 %int_1 + %29 = OpLoad %14 %arg_2 + %30 = OpLoad %11 %arg_1 + %32 = OpSampledImage %31 %30 %29 + %34 = OpLoad %v2float %arg_3 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %38 = OpLoad %int %arg_4 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v3float %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_1 ConstOffset %41 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_4b8103 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %void %textureGather_4b8103 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGather_4b8103 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl new file mode 100644 index 0000000000..05fe1370c1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_4b8103() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_4b8103(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_4b8103(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_4b8103(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl new file mode 100644 index 0000000000..b25487ce10 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_5266da() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5266da(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5266da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5266da(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f449a19774 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5266da() { + float2 arg_3 = (0.0f).xx; + float4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5266da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5266da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5266da(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f449a19774 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5266da() { + float2 arg_3 = (0.0f).xx; + float4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5266da(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5266da(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5266da(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl new file mode 100644 index 0000000000..33c4c0ff6f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_5266da(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_5266da(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_5266da() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_5266da(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl new file mode 100644 index 0000000000..09bd3bbd5e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_5266da(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_5266da(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5266da(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5266da(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm new file mode 100644 index 0000000000..b1bb4b9e89 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5266da "textureGather_5266da" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5266da = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + %24 = OpLoad %14 %arg_2 + %25 = OpLoad %11 %arg_1 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v2float %arg_3 + %23 = OpImageGather %v4float %27 %28 %int_1 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureGather_5266da + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpFunctionCall %void %textureGather_5266da + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_5266da + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl new file mode 100644 index 0000000000..9bf8e14dcd --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5266da() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5266da(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5266da(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5266da(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl new file mode 100644 index 0000000000..f282cc3953 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureGather_5ba85f() { + var arg_3 = vec3(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5ba85f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5ba85f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5ba85f(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39a0d15a2e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5ba85f() { + float3 arg_3 = (0.0f).xxx; + int4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5ba85f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5ba85f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5ba85f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..39a0d15a2e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5ba85f() { + float3 arg_3 = (0.0f).xxx; + int4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5ba85f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5ba85f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5ba85f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl new file mode 100644 index 0000000000..096f596b49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + vec3 arg_3 = vec3(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_5ba85f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + vec3 arg_3 = vec3(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_5ba85f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isamplerCube arg_1_arg_2; + +void textureGather_5ba85f() { + vec3 arg_3 = vec3(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_5ba85f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl new file mode 100644 index 0000000000..23a45a4670 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_5ba85f(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureGather_5ba85f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5ba85f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5ba85f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm new file mode 100644 index 0000000000..30b40eb280 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5ba85f "textureGather_5ba85f" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %21 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4int = OpTypeVector %int 4 + %28 = OpTypeSampledImage %11 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %34 = OpConstantNull %v4int + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5ba85f = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %21 + %res = OpVariable %_ptr_Function_v4int Function %34 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_3 + %24 = OpImageGather %v4int %29 %30 %int_1 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_5ba85f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_5ba85f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_5ba85f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f97184d5a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_cube; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5ba85f() { + var arg_3 = vec3(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5ba85f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5ba85f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5ba85f(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl new file mode 100644 index 0000000000..252056d912 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_5bd491() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5bd491(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5bd491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5bd491(); +} diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..50701a2fdf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5bd491() { + float2 arg_3 = (0.0f).xx; + uint4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5bd491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5bd491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5bd491(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..50701a2fdf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_5bd491() { + float2 arg_3 = (0.0f).xx; + uint4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_5bd491(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_5bd491(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_5bd491(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl new file mode 100644 index 0000000000..1cb6b09ae3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_5bd491(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_5bd491(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_1_arg_2; + +void textureGather_5bd491() { + vec2 arg_3 = vec2(0.0f); + uvec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_5bd491(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl new file mode 100644 index 0000000000..22227a8497 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_5bd491(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_5bd491(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_5bd491(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_5bd491(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm new file mode 100644 index 0000000000..601e9883a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_5bd491 "textureGather_5bd491" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4uint = OpTypeVector %uint 4 + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %35 = OpConstantNull %v4uint + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_5bd491 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %res = OpVariable %_ptr_Function_v4uint Function %35 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_3 + %24 = OpImageGather %v4uint %29 %30 %int_1 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureGather_5bd491 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_5bd491 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGather_5bd491 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl new file mode 100644 index 0000000000..e39e4cfc2e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_5bd491() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_5bd491(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_5bd491(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_5bd491(); +} diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl new file mode 100644 index 0000000000..51713969bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_751f8a() { + var arg_3 = vec3(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_751f8a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_751f8a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_751f8a(); +} diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b0055f8cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_751f8a() { + float3 arg_3 = (0.0f).xxx; + int arg_4 = 1; + float4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_751f8a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_751f8a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_751f8a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b0055f8cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_751f8a() { + float3 arg_3 = (0.0f).xxx; + int arg_4 = 1; + float4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_751f8a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_751f8a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_751f8a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl new file mode 100644 index 0000000000..17c501c5d1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_751f8a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_751f8a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_1_arg_2; + +void textureGather_751f8a() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_751f8a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl new file mode 100644 index 0000000000..4b8c748f63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_751f8a(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + int arg_4 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_751f8a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_751f8a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_751f8a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm new file mode 100644 index 0000000000..d65968a079 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_751f8a "textureGather_751f8a" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %42 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_751f8a = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + OpStore %arg_4 %int_1 + %29 = OpLoad %14 %arg_2 + %30 = OpLoad %11 %arg_1 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v3float %arg_3 + %34 = OpCompositeExtract %float %33 0 + %35 = OpCompositeExtract %float %33 1 + %36 = OpCompositeExtract %float %33 2 + %38 = OpLoad %int %arg_4 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v4float %34 %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_751f8a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %48 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %void %textureGather_751f8a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_751f8a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl new file mode 100644 index 0000000000..26429ac4c0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_751f8a() { + var arg_3 = vec3(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_751f8a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_751f8a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_751f8a(); +} diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl new file mode 100644 index 0000000000..f4e6c807b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_7c3828() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_7c3828(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_7c3828(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_7c3828(); +} diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af880b4c3c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_7c3828() { + float2 arg_3 = (0.0f).xx; + int4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_7c3828(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_7c3828(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_7c3828(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af880b4c3c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_7c3828() { + float2 arg_3 = (0.0f).xx; + int4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_7c3828(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_7c3828(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_7c3828(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl new file mode 100644 index 0000000000..862ebb491b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_7c3828(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void fragment_main() { + textureGather_7c3828(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_7c3828() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void compute_main() { + textureGather_7c3828(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl new file mode 100644 index 0000000000..9772d44d29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_7c3828(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_7c3828(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_7c3828(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_7c3828(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm new file mode 100644 index 0000000000..18f210e0db --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_7c3828 "textureGather_7c3828" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4int = OpTypeVector %int 4 + %28 = OpTypeSampledImage %11 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %33 = OpConstantNull %v2int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %36 = OpConstantNull %v4int + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_7c3828 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %res = OpVariable %_ptr_Function_v4int Function %36 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_3 + %24 = OpImageGather %v4int %29 %30 %int_1 ConstOffset %33 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %textureGather_7c3828 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_7c3828 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %49 = OpLabel + %50 = OpFunctionCall %void %textureGather_7c3828 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl new file mode 100644 index 0000000000..326c0a70ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_7c3828() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_7c3828(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_7c3828(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_7c3828(); +} diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl new file mode 100644 index 0000000000..80c76fb57e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_8b754c() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_8b754c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_8b754c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_8b754c(); +} diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..52dcf0fa89 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_8b754c() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_8b754c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_8b754c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_8b754c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52dcf0fa89 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_8b754c() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_8b754c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_8b754c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_8b754c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl new file mode 100644 index 0000000000..b7a690a28e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_8b754c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_8b754c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_8b754c() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_8b754c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl new file mode 100644 index 0000000000..171f733930 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_8b754c(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_8b754c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_8b754c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_8b754c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.spvasm new file mode 100644 index 0000000000..09b943b8b0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_8b754c "textureGather_8b754c" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %32 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %43 = OpConstantNull %v4int + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_8b754c = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4int Function %43 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %30 = OpLoad %15 %arg_2 + %31 = OpLoad %11 %arg_1 + %33 = OpSampledImage %32 %31 %30 + %35 = OpLoad %v2float %arg_3 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %39 = OpLoad %int %arg_4 + %38 = OpConvertSToF %float %39 + %40 = OpCompositeConstruct %v3float %36 %37 %38 + %28 = OpImageGather %v4int %33 %40 %int_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_8b754c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %53 = OpLabel + %54 = OpFunctionCall %void %textureGather_8b754c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGather_8b754c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl new file mode 100644 index 0000000000..11a8062178 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_8b754c() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_8b754c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_8b754c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_8b754c(); +} diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl new file mode 100644 index 0000000000..3a30a4237a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureGather_9a6358() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: vec4 = textureGather(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_9a6358(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_9a6358(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_9a6358(); +} diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..00950b5ffd --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_9a6358() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Gather(arg_1, float3(arg_2, float(arg_3))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_9a6358(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_9a6358(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_9a6358(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..00950b5ffd --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_9a6358() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Gather(arg_1, float3(arg_2, float(arg_3))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_9a6358(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_9a6358(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_9a6358(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl new file mode 100644 index 0000000000..f535b11110 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_9a6358() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0); +} + +vec4 vertex_main() { + textureGather_9a6358(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_9a6358() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0); +} + +void fragment_main() { + textureGather_9a6358(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_9a6358() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0); +} + +void compute_main() { + textureGather_9a6358(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl new file mode 100644 index 0000000000..0b4f909995 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_9a6358(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_9a6358(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_9a6358(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_9a6358(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm new file mode 100644 index 0000000000..96ae32ce24 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_9a6358 "textureGather_9a6358" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %43 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_9a6358 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %34 = OpLoad %v2float %arg_2 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %38 = OpLoad %int %arg_3 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v3float %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_0 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %43 + %45 = OpLabel + %46 = OpFunctionCall %void %textureGather_9a6358 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %48 = OpLabel + %49 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %49 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %52 = OpLabel + %53 = OpFunctionCall %void %textureGather_9a6358 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureGather_9a6358 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl new file mode 100644 index 0000000000..4c3a7ec896 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_9a6358() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : vec4 = textureGather(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_9a6358(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_9a6358(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_9a6358(); +} diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl new file mode 100644 index 0000000000..536f17fa04 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureGather_af55b3() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_af55b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_af55b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_af55b3(); +} diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2cf56d1ba9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_af55b3() { + float2 arg_3 = (0.0f).xx; + float4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_af55b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_af55b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_af55b3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2cf56d1ba9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_af55b3() { + float2 arg_3 = (0.0f).xx; + float4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_af55b3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_af55b3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_af55b3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl new file mode 100644 index 0000000000..ec46313269 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_af55b3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void fragment_main() { + textureGather_af55b3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_1_arg_2; + +void textureGather_af55b3() { + vec2 arg_3 = vec2(0.0f); + vec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1); +} + +void compute_main() { + textureGather_af55b3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl new file mode 100644 index 0000000000..5bdf570683 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_af55b3(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_af55b3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_af55b3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_af55b3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm new file mode 100644 index 0000000000..7bb9edcb23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_af55b3 "textureGather_af55b3" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %32 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_af55b3 = OpFunction %void None %15 + %18 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_3 %20 + %24 = OpLoad %14 %arg_2 + %25 = OpLoad %11 %arg_1 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v2float %arg_3 + %23 = OpImageGather %v4float %27 %28 %int_1 ConstOffset %32 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_af55b3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_af55b3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_af55b3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc63ad8f34 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_af55b3() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_af55b3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_af55b3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_af55b3(); +} diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl new file mode 100644 index 0000000000..9c7772d035 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureGather_bb3ac5() { + var arg_3 = vec2(); + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_bb3ac5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_bb3ac5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_bb3ac5(); +} diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f718f3661 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_bb3ac5() { + float2 arg_3 = (0.0f).xx; + int4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_bb3ac5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_bb3ac5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_bb3ac5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2f718f3661 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_bb3ac5() { + float2 arg_3 = (0.0f).xx; + int4 res = arg_1.GatherGreen(arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_bb3ac5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_bb3ac5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_bb3ac5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl new file mode 100644 index 0000000000..0c9b449c4f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +vec4 vertex_main() { + textureGather_bb3ac5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void fragment_main() { + textureGather_bb3ac5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_1_arg_2; + +void textureGather_bb3ac5() { + vec2 arg_3 = vec2(0.0f); + ivec4 res = textureGather(arg_1_arg_2, arg_3, 1); +} + +void compute_main() { + textureGather_bb3ac5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl new file mode 100644 index 0000000000..99c8768564 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void textureGather_bb3ac5(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureGather_bb3ac5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_bb3ac5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_bb3ac5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d15df0fda --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_bb3ac5 "textureGather_bb3ac5" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4int = OpTypeVector %int 4 + %28 = OpTypeSampledImage %11 + %int_1 = OpConstant %int 1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %34 = OpConstantNull %v4int + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_bb3ac5 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %res = OpVariable %_ptr_Function_v4int Function %34 + OpStore %arg_3 %21 + %26 = OpLoad %15 %arg_2 + %27 = OpLoad %11 %arg_1 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_3 + %24 = OpImageGather %v4int %29 %30 %int_1 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %44 = OpLabel + %45 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_bb3ac5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl new file mode 100644 index 0000000000..62af63a3e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(1) var arg_1 : texture_2d; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_bb3ac5() { + var arg_3 = vec2(); + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_bb3ac5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_bb3ac5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_bb3ac5(); +} diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl new file mode 100644 index 0000000000..c39fad354c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_c0640c() { + var arg_3 = vec3(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_c0640c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_c0640c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_c0640c(); +} diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..76b208b9f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_c0640c() { + float3 arg_3 = (0.0f).xxx; + int arg_4 = 1; + int4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_c0640c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_c0640c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_c0640c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..76b208b9f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_c0640c() { + float3 arg_3 = (0.0f).xxx; + int arg_4 = 1; + int4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_c0640c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_c0640c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_c0640c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl new file mode 100644 index 0000000000..a15bb750df --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_c0640c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_c0640c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_1_arg_2; + +void textureGather_c0640c() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_c0640c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl new file mode 100644 index 0000000000..9e5a33ba67 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_c0640c(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + int arg_4 = 1; + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_c0640c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_c0640c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_c0640c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.spvasm new file mode 100644 index 0000000000..1a0206bfb9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_c0640c "textureGather_c0640c" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %21 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %32 = OpTypeSampledImage %11 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %43 = OpConstantNull %v4int + %44 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_c0640c = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4int Function %43 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %30 = OpLoad %15 %arg_2 + %31 = OpLoad %11 %arg_1 + %33 = OpSampledImage %32 %31 %30 + %34 = OpLoad %v3float %arg_3 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %37 = OpCompositeExtract %float %34 2 + %39 = OpLoad %int %arg_4 + %38 = OpConvertSToF %float %39 + %40 = OpCompositeConstruct %v4float %35 %36 %37 %38 + %28 = OpImageGather %v4int %33 %40 %int_1 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %44 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGather_c0640c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %49 = OpLabel + %50 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %50 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %53 = OpLabel + %54 = OpFunctionCall %void %textureGather_c0640c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGather_c0640c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl new file mode 100644 index 0000000000..ecea543186 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_c0640c() { + var arg_3 = vec3(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_c0640c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_c0640c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_c0640c(); +} diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl new file mode 100644 index 0000000000..2c2a002969 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_d1f187() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d1f187(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_d1f187(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_d1f187(); +} diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6fdf9e4239 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_d1f187() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d1f187(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d1f187(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d1f187(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6fdf9e4239 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_d1f187() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d1f187(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d1f187(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d1f187(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl new file mode 100644 index 0000000000..cf015a2672 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_d1f187(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_d1f187(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_1_arg_2; + +void textureGather_d1f187() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void compute_main() { + textureGather_d1f187(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl new file mode 100644 index 0000000000..a2e3383148 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_d1f187(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_d1f187(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_d1f187(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_d1f187(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm new file mode 100644 index 0000000000..f88d541acb --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_d1f187 "textureGather_d1f187" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %43 = OpConstantNull %v2int +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %46 = OpConstantNull %v4uint + %47 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_d1f187 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %28 + %res = OpVariable %_ptr_Function_v4uint Function %46 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %31 = OpLoad %15 %arg_2 + %32 = OpLoad %11 %arg_1 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_3 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_4 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %29 = OpImageGather %v4uint %34 %41 %int_1 ConstOffset %43 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %47 + %49 = OpLabel + %50 = OpFunctionCall %void %textureGather_d1f187 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %52 = OpLabel + %53 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %53 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGather_d1f187 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %59 = OpLabel + %60 = OpFunctionCall %void %textureGather_d1f187 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl new file mode 100644 index 0000000000..6c817298da --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_d1f187() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d1f187(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_d1f187(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_d1f187(); +} diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl new file mode 100644 index 0000000000..de29a6c5bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_d90605() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: vec4 = textureGather(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d90605(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_d90605(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_d90605(); +} diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..961f7f3b57 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_d90605() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Gather(arg_1, float3(arg_2, float(arg_3)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d90605(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d90605(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d90605(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..961f7f3b57 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureGather_d90605() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Gather(arg_1, float3(arg_2, float(arg_3)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_d90605(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_d90605(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_d90605(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl new file mode 100644 index 0000000000..698dd66a03 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0, ivec2(0)); +} + +vec4 vertex_main() { + textureGather_d90605(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0, ivec2(0)); +} + +void fragment_main() { + textureGather_d90605(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGather_d90605() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0, ivec2(0)); +} + +void compute_main() { + textureGather_d90605(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl new file mode 100644 index 0000000000..b5074d22c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_d90605(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, arg_3, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_d90605(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_d90605(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_d90605(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c1da3faf7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGather_d90605 "textureGather_d90605" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %31 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %42 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_d90605 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %34 = OpLoad %v2float %arg_2 + %35 = OpCompositeExtract %float %34 0 + %36 = OpCompositeExtract %float %34 1 + %38 = OpLoad %int %arg_3 + %37 = OpConvertSToF %float %38 + %39 = OpCompositeConstruct %v3float %35 %36 %37 + %28 = OpImageGather %v4float %32 %39 %int_0 ConstOffset %42 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_d90605 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_d90605 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGather_d90605 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl new file mode 100644 index 0000000000..e27b9c7939 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureGather_d90605() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : vec4 = textureGather(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_d90605(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_d90605(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_d90605(); +} diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl new file mode 100644 index 0000000000..15a4868760 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_2d_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureGather_e9d390() { + var arg_3 = vec2(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_e9d390(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_e9d390(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_e9d390(); +} diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..303164a498 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_e9d390() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_e9d390(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_e9d390(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_e9d390(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..303164a498 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_e9d390() { + float2 arg_3 = (0.0f).xx; + int arg_4 = 1; + int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_e9d390(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_e9d390(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_e9d390(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl new file mode 100644 index 0000000000..51dbcc162e --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +vec4 vertex_main() { + textureGather_e9d390(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void fragment_main() { + textureGather_e9d390(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_1_arg_2; + +void textureGather_e9d390() { + vec2 arg_3 = vec2(0.0f); + int arg_4 = 1; + ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1); +} + +void compute_main() { + textureGather_e9d390(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl new file mode 100644 index 0000000000..6d75549436 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_e9d390(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_3 = float2(0.0f); + int arg_4 = 1; + int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_e9d390(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_e9d390(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_e9d390(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.spvasm new file mode 100644 index 0000000000..0748d70cad --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_e9d390 "textureGather_e9d390" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %21 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %32 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %42 = OpConstantNull %v2int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %45 = OpConstantNull %v4int + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_e9d390 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v2float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_v4int Function %45 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %30 = OpLoad %15 %arg_2 + %31 = OpLoad %11 %arg_1 + %33 = OpSampledImage %32 %31 %30 + %35 = OpLoad %v2float %arg_3 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %39 = OpLoad %int %arg_4 + %38 = OpConvertSToF %float %39 + %40 = OpCompositeConstruct %v3float %36 %37 %38 + %28 = OpImageGather %v4int %33 %40 %int_1 ConstOffset %42 + OpStore %res %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGather_e9d390 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %55 = OpLabel + %56 = OpFunctionCall %void %textureGather_e9d390 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %58 = OpLabel + %59 = OpFunctionCall %void %textureGather_e9d390 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4ffcf0cb6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_2d_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_e9d390() { + var arg_3 = vec2(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_e9d390(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_e9d390(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_e9d390(); +} diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl new file mode 100644 index 0000000000..ab7c3a85fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(1) var arg_1: texture_cube_array; +@group(1) @binding(2) var arg_2: sampler; + +// fn textureGather(@const component: i32, texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureGather_f2c6e3() { + var arg_3 = vec3(); + var arg_4 = 1; + var res: vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_f2c6e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_f2c6e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_f2c6e3(); +} diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e7b6ba868b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_f2c6e3() { + float3 arg_3 = (0.0f).xxx; + int arg_4 = 1; + uint4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_f2c6e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_f2c6e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_f2c6e3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e7b6ba868b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCubeArray arg_1 : register(t1, space1); +SamplerState arg_2 : register(s2, space1); + +void textureGather_f2c6e3() { + float3 arg_3 = (0.0f).xxx; + int arg_4 = 1; + uint4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4))); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGather_f2c6e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGather_f2c6e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGather_f2c6e3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl new file mode 100644 index 0000000000..0b0838a02b --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +vec4 vertex_main() { + textureGather_f2c6e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void fragment_main() { + textureGather_f2c6e3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_1_arg_2; + +void textureGather_f2c6e3() { + vec3 arg_3 = vec3(0.0f); + int arg_4 = 1; + uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1); +} + +void compute_main() { + textureGather_f2c6e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl new file mode 100644 index 0000000000..088082f722 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGather_f2c6e3(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_3 = float3(0.0f); + int arg_4 = 1; + uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, component::y); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureGather_f2c6e3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGather_f2c6e3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGather_f2c6e3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fba92b77f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %textureGather_f2c6e3 "textureGather_f2c6e3" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + OpDecorate %arg_2 DescriptorSet 1 + OpDecorate %arg_2 Binding 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %15 = OpTypeSampler +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant + %void = OpTypeVoid + %16 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %21 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %33 = OpTypeSampledImage %11 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %44 = OpConstantNull %v4uint + %45 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureGather_f2c6e3 = OpFunction %void None %16 + %19 = OpLabel + %arg_3 = OpVariable %_ptr_Function_v3float Function %21 + %arg_4 = OpVariable %_ptr_Function_int Function %28 + %res = OpVariable %_ptr_Function_v4uint Function %44 + OpStore %arg_3 %21 + OpStore %arg_4 %int_1 + %31 = OpLoad %15 %arg_2 + %32 = OpLoad %11 %arg_1 + %34 = OpSampledImage %33 %32 %31 + %35 = OpLoad %v3float %arg_3 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %38 = OpCompositeExtract %float %35 2 + %40 = OpLoad %int %arg_4 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v4float %36 %37 %38 %39 + %29 = OpImageGather %v4uint %34 %41 %int_1 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %45 + %47 = OpLabel + %48 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %16 + %50 = OpLabel + %51 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %51 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %16 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %16 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGather_f2c6e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..725af08831 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(1) var arg_1 : texture_cube_array; + +@group(1) @binding(2) var arg_2 : sampler; + +fn textureGather_f2c6e3() { + var arg_3 = vec3(); + var arg_4 = 1; + var res : vec4 = textureGather(1, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGather_f2c6e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGather_f2c6e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGather_f2c6e3(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl new file mode 100644 index 0000000000..1c12576ea6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> vec4 +fn textureGatherCompare_182fd4() { + var arg_2 = vec3(); + var arg_3 = 1.f; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_182fd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_182fd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_182fd4(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..294d4d3441 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_182fd4() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_182fd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_182fd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_182fd4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..294d4d3441 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_182fd4() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_182fd4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_182fd4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_182fd4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl new file mode 100644 index 0000000000..af1dd4da82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGatherCompare_182fd4() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureGatherCompare_182fd4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGatherCompare_182fd4() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureGatherCompare_182fd4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureGatherCompare_182fd4() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureGatherCompare_182fd4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl new file mode 100644 index 0000000000..5f3be12095 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGatherCompare_182fd4(depthcube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_182fd4(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_182fd4(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_182fd4(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm new file mode 100644 index 0000000000..e8bd4b7ef1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_182fd4 "textureGatherCompare_182fd4" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureGatherCompare_182fd4 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageDrefGather %v4float %30 %31 %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGatherCompare_182fd4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGatherCompare_182fd4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGatherCompare_182fd4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl new file mode 100644 index 0000000000..d2d4c30811 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_182fd4() { + var arg_2 = vec3(); + var arg_3 = 1.0f; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_182fd4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_182fd4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_182fd4(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl new file mode 100644 index 0000000000..0709512bec --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> vec4 +fn textureGatherCompare_313add() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_313add(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_313add(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_313add(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c92a22bdaf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_313add() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_313add(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_313add(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_313add(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c92a22bdaf --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_313add() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_313add(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_313add(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_313add(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl new file mode 100644 index 0000000000..951aa5ab94 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +vec4 vertex_main() { + textureGatherCompare_313add(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +void fragment_main() { + textureGatherCompare_313add(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_313add() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +void compute_main() { + textureGatherCompare_313add(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl new file mode 100644 index 0000000000..48629383d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGatherCompare_313add(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_313add(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_313add(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_313add(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe55f7a924 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_313add "textureGatherCompare_313add" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %35 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float +%textureGatherCompare_313add = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageDrefGather %v4float %30 %31 %32 ConstOffset %35 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureGatherCompare_313add + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGatherCompare_313add + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureGatherCompare_313add + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b877b4023 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_313add() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_313add(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_313add(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_313add(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl new file mode 100644 index 0000000000..1a8d76d2cb --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> vec4 +fn textureGatherCompare_60d2d1() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_60d2d1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_60d2d1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_60d2d1(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a0284d85ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_60d2d1() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_60d2d1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_60d2d1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_60d2d1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a0284d85ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_60d2d1() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_60d2d1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_60d2d1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_60d2d1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl new file mode 100644 index 0000000000..33e06ee954 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGatherCompare_60d2d1() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureGatherCompare_60d2d1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGatherCompare_60d2d1() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureGatherCompare_60d2d1(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureGatherCompare_60d2d1() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureGatherCompare_60d2d1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl new file mode 100644 index 0000000000..682a170df8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureGatherCompare_60d2d1(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_60d2d1(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_60d2d1(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_60d2d1(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm new file mode 100644 index 0000000000..660f0f304f --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_60d2d1 "textureGatherCompare_60d2d1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float +%textureGatherCompare_60d2d1 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %36 = OpLoad %v3float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %39 = OpCompositeExtract %float %36 2 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v4float %37 %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageDrefGather %v4float %35 %42 %43 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGatherCompare_60d2d1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGatherCompare_60d2d1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGatherCompare_60d2d1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.wgsl new file mode 100644 index 0000000000..7dd1a55cd5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_60d2d1() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_60d2d1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_60d2d1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_60d2d1(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl new file mode 100644 index 0000000000..083163ef21 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> vec4 +fn textureGatherCompare_6d9352() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_6d9352(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_6d9352(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_6d9352(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6c7d0f4904 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_6d9352() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_6d9352(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_6d9352(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_6d9352(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6c7d0f4904 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_6d9352() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_6d9352(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_6d9352(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_6d9352(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl new file mode 100644 index 0000000000..b57e6630f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_6d9352() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureGatherCompare_6d9352(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_6d9352() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureGatherCompare_6d9352(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureGatherCompare_6d9352() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureGatherCompare_6d9352(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl new file mode 100644 index 0000000000..ce423455f3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureGatherCompare_6d9352(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_6d9352(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_6d9352(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_6d9352(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a6a85730d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_6d9352 "textureGatherCompare_6d9352" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureGatherCompare_6d9352 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageDrefGather %v4float %30 %31 %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureGatherCompare_6d9352 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureGatherCompare_6d9352 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureGatherCompare_6d9352 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl new file mode 100644 index 0000000000..c20268270c --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_6d9352() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_6d9352(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_6d9352(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_6d9352(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl new file mode 100644 index 0000000000..c773ac66fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> vec4 +fn textureGatherCompare_783e65() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_783e65(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_783e65(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_783e65(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0b2cced51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_783e65() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_783e65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_783e65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_783e65(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c0b2cced51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_783e65() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_783e65(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_783e65(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_783e65(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl new file mode 100644 index 0000000000..84f32d58df --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_783e65() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureGatherCompare_783e65(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_783e65() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureGatherCompare_783e65(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_783e65() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureGatherCompare_783e65(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl new file mode 100644 index 0000000000..b6aade7f31 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureGatherCompare_783e65(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_783e65(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_783e65(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_783e65(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm new file mode 100644 index 0000000000..9b37b338ef --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_783e65 "textureGatherCompare_783e65" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float +%textureGatherCompare_783e65 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageDrefGather %v4float %35 %42 %43 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureGatherCompare_783e65 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureGatherCompare_783e65 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureGatherCompare_783e65 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.wgsl new file mode 100644 index 0000000000..382239d237 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_783e65() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_783e65(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_783e65(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_783e65(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl new file mode 100644 index 0000000000..c4e7970c2d --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> vec4 +fn textureGatherCompare_f585cc() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_f585cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_f585cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_f585cc(); +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eef0720cda --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_f585cc() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_f585cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_f585cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_f585cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..eef0720cda --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureGatherCompare_f585cc() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.GatherCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureGatherCompare_f585cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureGatherCompare_f585cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureGatherCompare_f585cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl new file mode 100644 index 0000000000..8ae1b0adc1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +vec4 vertex_main() { + textureGatherCompare_f585cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +void fragment_main() { + textureGatherCompare_f585cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureGatherCompare_f585cc() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +void compute_main() { + textureGatherCompare_f585cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl new file mode 100644 index 0000000000..31ed159b29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureGatherCompare_f585cc(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, arg_4, int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureGatherCompare_f585cc(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureGatherCompare_f585cc(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureGatherCompare_f585cc(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d23a2274a --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureGatherCompare_f585cc "textureGatherCompare_f585cc" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %45 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %48 = OpTypeFunction %v4float +%textureGatherCompare_f585cc = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageDrefGather %v4float %35 %42 %43 ConstOffset %45 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %59 = OpLabel + %60 = OpFunctionCall %void %textureGatherCompare_f585cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..edea3695a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureGatherCompare_f585cc() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : vec4 = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureGatherCompare_f585cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureGatherCompare_f585cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureGatherCompare_f585cc(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl new file mode 100644 index 0000000000..f24f2f58e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureLoad(texture: texture_depth_2d, coords: vec2, level: i32) -> f32 +fn textureLoad_19cf87() { + var arg_1 = vec2(); + var arg_2 = 0; + var res: f32 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_19cf87(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_19cf87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_19cf87(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af201f2382 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_19cf87() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + float res = arg_0.Load(int3(arg_1, arg_2)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_19cf87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_19cf87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_19cf87(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af201f2382 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_19cf87() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + float res = arg_0.Load(int3(arg_1, arg_2)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_19cf87(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_19cf87(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_19cf87(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl new file mode 100644 index 0000000000..fb34ff94ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_19cf87() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +vec4 vertex_main() { + textureLoad_19cf87(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureLoad_19cf87() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +void fragment_main() { + textureLoad_19cf87(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_19cf87() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +void compute_main() { + textureLoad_19cf87(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl new file mode 100644 index 0000000000..d8455913c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_19cf87(depth2d tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 0; + float res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureLoad_19cf87(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureLoad_19cf87(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureLoad_19cf87(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm new file mode 100644 index 0000000000..62372885de --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_19cf87 "textureLoad_19cf87" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_19cf87 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4float %26 %27 Lod %28 + %24 = OpCompositeExtract %float %25 0 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureLoad_19cf87 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_19cf87 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %void %textureLoad_19cf87 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl new file mode 100644 index 0000000000..af6d6de79a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureLoad_19cf87() { + var arg_1 = vec2(); + var arg_2 = 0; + var res : f32 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_19cf87(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_19cf87(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_19cf87(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl new file mode 100644 index 0000000000..8125e86e47 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 +fn textureLoad_1b8588() { + var arg_1 = 1; + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1b8588(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_1b8588(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_1b8588(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8a7976a797 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_1b8588() { + int arg_1 = 1; + int arg_2 = 0; + uint4 res = arg_0.Load(int2(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1b8588(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1b8588(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1b8588(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8a7976a797 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_1b8588() { + int arg_1 = 1; + int arg_2 = 0; + uint4 res = arg_0.Load(int2(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1b8588(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1b8588(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1b8588(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl new file mode 100644 index 0000000000..7a48c97905 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureLoad_1b8588() { + int arg_1 = 1; + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_1b8588(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureLoad_1b8588() { + int arg_1 = 1; + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_1b8588(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureLoad_1b8588() { + int arg_1 = 1; + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_1b8588(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl new file mode 100644 index 0000000000..ba0109281c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_1b8588(texture1d tint_symbol_1) { + int arg_1 = 1; + int arg_2 = 0; + uint4 res = tint_symbol_1.read(uint(arg_1), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureLoad_1b8588(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureLoad_1b8588(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureLoad_1b8588(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm new file mode 100644 index 0000000000..b68a825a44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_1b8588 "textureLoad_1b8588" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpConstantNull %v4uint + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_1b8588 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4uint Function %30 + OpStore %arg_1 %int_1 + OpStore %arg_2 %21 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %int %arg_1 + %27 = OpLoad %int %arg_2 + %23 = OpImageFetch %v4uint %25 %26 Lod %27 + OpStore %res %23 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureLoad_1b8588 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_1b8588 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %void %textureLoad_1b8588 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl new file mode 100644 index 0000000000..41cc6cb143 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureLoad_1b8588() { + var arg_1 = 1; + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1b8588(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_1b8588(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_1b8588(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl new file mode 100644 index 0000000000..54d0cbd5b0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 +fn textureLoad_1f2016() { + var arg_1 = vec3(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1f2016(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_1f2016(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_1f2016(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9a90498483 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_1f2016() { + int3 arg_1 = (0).xxx; + int arg_2 = 0; + float4 res = arg_0.Load(int4(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1f2016(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1f2016(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1f2016(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9a90498483 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_1f2016() { + int3 arg_1 = (0).xxx; + int arg_2 = 0; + float4 res = arg_0.Load(int4(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_1f2016(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_1f2016(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_1f2016(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl new file mode 100644 index 0000000000..4e6193ef7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureLoad_1f2016() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_1f2016(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureLoad_1f2016() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_1f2016(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureLoad_1f2016() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_1f2016(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl new file mode 100644 index 0000000000..843d5a49dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_1f2016(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int arg_2 = 0; + float4 res = tint_symbol_1.read(uint3(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureLoad_1f2016(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureLoad_1f2016(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureLoad_1f2016(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm new file mode 100644 index 0000000000..d3bd5ef3c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_1f2016 "textureLoad_1f2016" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_1f2016 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %v3int %arg_1 + %27 = OpLoad %int %arg_2 + %24 = OpImageFetch %v4float %25 %26 Lod %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureLoad_1f2016 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_1f2016 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_1f2016 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl new file mode 100644 index 0000000000..f03bb4f292 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureLoad_1f2016() { + var arg_1 = vec3(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_1f2016(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_1f2016(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_1f2016(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl new file mode 100644 index 0000000000..bd7a13b5e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 +fn textureLoad_484344() { + var arg_1 = vec2(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_484344(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_484344(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_484344(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..26f5c566d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_484344() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + float4 res = arg_0.Load(int3(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_484344(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_484344(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_484344(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..26f5c566d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_484344() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + float4 res = arg_0.Load(int3(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_484344(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_484344(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_484344(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl new file mode 100644 index 0000000000..437375735a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_484344() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_484344(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureLoad_484344() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_484344(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureLoad_484344() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_484344(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl new file mode 100644 index 0000000000..cc878b2e12 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_484344(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 0; + float4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureLoad_484344(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureLoad_484344(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureLoad_484344(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1c45187a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_484344 "textureLoad_484344" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_484344 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %25 = OpLoad %11 %arg_0 + %26 = OpLoad %v2int %arg_1 + %27 = OpLoad %int %arg_2 + %24 = OpImageFetch %v4float %25 %26 Lod %27 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureLoad_484344 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_484344 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_484344 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4f317409e --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureLoad_484344() { + var arg_1 = vec2(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_484344(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_484344(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_484344(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl new file mode 100644 index 0000000000..5a65374ddd --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 +fn textureLoad_4fd803() { + var arg_1 = vec3(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_4fd803(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_4fd803(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_4fd803(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..62f5574e15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_4fd803() { + int3 arg_1 = (0).xxx; + int arg_2 = 0; + int4 res = arg_0.Load(int4(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_4fd803(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_4fd803(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_4fd803(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..62f5574e15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_4fd803() { + int3 arg_1 = (0).xxx; + int arg_2 = 0; + int4 res = arg_0.Load(int4(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_4fd803(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_4fd803(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_4fd803(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl new file mode 100644 index 0000000000..d0ac1aba0d --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureLoad_4fd803() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_4fd803(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureLoad_4fd803() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_4fd803(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureLoad_4fd803() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_4fd803(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl new file mode 100644 index 0000000000..0b3b14432a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_4fd803(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int arg_2 = 0; + int4 res = tint_symbol_1.read(uint3(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureLoad_4fd803(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureLoad_4fd803(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureLoad_4fd803(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.spvasm new file mode 100644 index 0000000000..003f85d191 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_4fd803 "textureLoad_4fd803" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %31 = OpConstantNull %v4int + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_4fd803 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4int Function %31 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %int %arg_2 + %24 = OpImageFetch %v4int %26 %27 Lod %28 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureLoad_4fd803 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureLoad_4fd803 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %void %textureLoad_4fd803 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl new file mode 100644 index 0000000000..300acfd649 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureLoad_4fd803() { + var arg_1 = vec3(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_4fd803(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_4fd803(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_4fd803(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl new file mode 100644 index 0000000000..1386c0f2ce --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 +fn textureLoad_5a2f9d() { + var arg_1 = 1; + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_5a2f9d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_5a2f9d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_5a2f9d(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6560358766 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_5a2f9d() { + int arg_1 = 1; + int arg_2 = 0; + int4 res = arg_0.Load(int2(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_5a2f9d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_5a2f9d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_5a2f9d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6560358766 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_5a2f9d() { + int arg_1 = 1; + int arg_2 = 0; + int4 res = arg_0.Load(int2(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_5a2f9d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_5a2f9d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_5a2f9d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl new file mode 100644 index 0000000000..4c2d0e6e5c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureLoad_5a2f9d() { + int arg_1 = 1; + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_5a2f9d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureLoad_5a2f9d() { + int arg_1 = 1; + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_5a2f9d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureLoad_5a2f9d() { + int arg_1 = 1; + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_5a2f9d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl new file mode 100644 index 0000000000..f2f8860f96 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_5a2f9d(texture1d tint_symbol_1) { + int arg_1 = 1; + int arg_2 = 0; + int4 res = tint_symbol_1.read(uint(arg_1), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureLoad_5a2f9d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureLoad_5a2f9d(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureLoad_5a2f9d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm new file mode 100644 index 0000000000..f4ceb92563 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_5a2f9d "textureLoad_5a2f9d" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpConstantNull %v4int + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_5a2f9d = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4int Function %29 + OpStore %arg_1 %int_1 + OpStore %arg_2 %20 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %int %arg_2 + %22 = OpImageFetch %v4int %24 %25 Lod %26 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureLoad_5a2f9d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_5a2f9d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_5a2f9d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl new file mode 100644 index 0000000000..ea4cf9132a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureLoad_5a2f9d() { + var arg_1 = 1; + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_5a2f9d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_5a2f9d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_5a2f9d(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl new file mode 100644 index 0000000000..9d2d0fe84f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 +fn textureLoad_6154d4() { + var arg_1 = vec2(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6154d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_6154d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_6154d4(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38bda4923b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_6154d4() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + uint4 res = arg_0.Load(int3(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6154d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6154d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6154d4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38bda4923b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_6154d4() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + uint4 res = arg_0.Load(int3(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6154d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6154d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6154d4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl new file mode 100644 index 0000000000..5fe0e2b19a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureLoad_6154d4() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_6154d4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureLoad_6154d4() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_6154d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureLoad_6154d4() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_6154d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl new file mode 100644 index 0000000000..ab70ff6a7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_6154d4(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 0; + uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureLoad_6154d4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureLoad_6154d4(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureLoad_6154d4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..e670096868 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_6154d4 "textureLoad_6154d4" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %22 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %32 = OpConstantNull %v4uint + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_6154d4 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %22 + %res = OpVariable %_ptr_Function_v4uint Function %32 + OpStore %arg_1 %19 + OpStore %arg_2 %22 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4uint %27 %28 Lod %29 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_6154d4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_6154d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %45 = OpLabel + %46 = OpFunctionCall %void %textureLoad_6154d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..def8ddb420 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureLoad_6154d4() { + var arg_1 = vec2(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6154d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_6154d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_6154d4(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl new file mode 100644 index 0000000000..353a76b1f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; + +// fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2, sample_index: i32) -> f32 +fn textureLoad_6273b1() { + var arg_1 = vec2(); + var arg_2 = 1; + var res: f32 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6273b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_6273b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_6273b1(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b05e1bbdd4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_6273b1() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float res = arg_0.Load(int3(arg_1, 0), arg_2).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6273b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6273b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6273b1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b05e1bbdd4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_6273b1() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float res = arg_0.Load(int3(arg_1, 0), arg_2).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_6273b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_6273b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_6273b1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl new file mode 100644 index 0000000000..ae0115fb00 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_6273b1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +vec4 vertex_main() { + textureLoad_6273b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureLoad_6273b1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +void fragment_main() { + textureLoad_6273b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_6273b1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + float res = texelFetch(arg_0_1, arg_1, arg_2).x; +} + +void compute_main() { + textureLoad_6273b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl new file mode 100644 index 0000000000..05fb393457 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_6273b1(depth2d_ms tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_ms tint_symbol_2) { + textureLoad_6273b1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_6273b1(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_6273b1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ed02fb712 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_6273b1 "textureLoad_6273b1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_6273b1 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %int %arg_2 + %26 = OpImageFetch %v4float %27 %28 Sample %29 + %25 = OpCompositeExtract %float %26 0 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureLoad_6273b1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %textureLoad_6273b1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %44 = OpLabel + %45 = OpFunctionCall %void %textureLoad_6273b1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..f62b81f696 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; + +fn textureLoad_6273b1() { + var arg_1 = vec2(); + var arg_2 = 1; + var res : f32 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_6273b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_6273b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_6273b1(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl new file mode 100644 index 0000000000..cfb561e92b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 +fn textureLoad_79e697() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_79e697(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_79e697(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_79e697(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..058dfb24b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_79e697() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + int4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_79e697(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_79e697(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_79e697(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..058dfb24b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_79e697() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + int4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_79e697(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_79e697(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_79e697(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl new file mode 100644 index 0000000000..2ddb0881e0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureLoad_79e697() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureLoad_79e697(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureLoad_79e697() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureLoad_79e697(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureLoad_79e697() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureLoad_79e697(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl new file mode 100644 index 0000000000..b2e557e911 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureLoad_79e697(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int arg_3 = 0; + int4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureLoad_79e697(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_79e697(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_79e697(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.spvasm new file mode 100644 index 0000000000..ccc82966e9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_79e697 "textureLoad_79e697" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %38 = OpConstantNull %v4int + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_79e697 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_v4int Function %38 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %24 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %int %arg_3 + %26 = OpImageFetch %v4int %28 %34 Lod %35 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureLoad_79e697 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureLoad_79e697 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureLoad_79e697 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl new file mode 100644 index 0000000000..e792f8b9aa --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureLoad_79e697() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_79e697(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_79e697(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_79e697(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl new file mode 100644 index 0000000000..2fcb74dd6a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 +fn textureLoad_7c90e5() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_7c90e5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_7c90e5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_7c90e5(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eac35c3ca4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_7c90e5() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + uint4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_7c90e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_7c90e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_7c90e5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..eac35c3ca4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_7c90e5() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + uint4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_7c90e5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_7c90e5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_7c90e5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl new file mode 100644 index 0000000000..8777502719 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureLoad_7c90e5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureLoad_7c90e5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureLoad_7c90e5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureLoad_7c90e5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureLoad_7c90e5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureLoad_7c90e5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl new file mode 100644 index 0000000000..12ab5a86b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureLoad_7c90e5(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int arg_3 = 0; + uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureLoad_7c90e5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_7c90e5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_7c90e5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.spvasm new file mode 100644 index 0000000000..d0e8a8dd18 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_7c90e5 "textureLoad_7c90e5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %39 = OpConstantNull %v4uint + %40 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_7c90e5 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_int Function %25 + %res = OpVariable %_ptr_Function_v4uint Function %39 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %25 + %29 = OpLoad %11 %arg_0 + %31 = OpLoad %v2int %arg_1 + %32 = OpCompositeExtract %int %31 0 + %33 = OpCompositeExtract %int %31 1 + %34 = OpLoad %int %arg_2 + %35 = OpCompositeConstruct %v3int %32 %33 %34 + %36 = OpLoad %int %arg_3 + %27 = OpImageFetch %v4uint %29 %35 Lod %36 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %40 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_7c90e5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %45 = OpLabel + %46 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %46 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %49 = OpLabel + %50 = OpFunctionCall %void %textureLoad_7c90e5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %52 = OpLabel + %53 = OpFunctionCall %void %textureLoad_7c90e5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl new file mode 100644 index 0000000000..5c79550378 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureLoad_7c90e5() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_7c90e5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_7c90e5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_7c90e5(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl new file mode 100644 index 0000000000..e2122a30ef --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureLoad(texture: texture_1d, coords: i32, level: i32) -> vec4 +fn textureLoad_81c381() { + var arg_1 = 1; + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_81c381(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_81c381(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_81c381(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f125cbe389 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_81c381() { + int arg_1 = 1; + int arg_2 = 0; + float4 res = arg_0.Load(int2(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_81c381(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_81c381(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_81c381(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f125cbe389 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureLoad_81c381() { + int arg_1 = 1; + int arg_2 = 0; + float4 res = arg_0.Load(int2(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_81c381(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_81c381(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_81c381(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl new file mode 100644 index 0000000000..33ebb737cd --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureLoad_81c381() { + int arg_1 = 1; + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_81c381(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureLoad_81c381() { + int arg_1 = 1; + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_81c381(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureLoad_81c381() { + int arg_1 = 1; + int arg_2 = 0; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_81c381(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl new file mode 100644 index 0000000000..96b31841cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_81c381(texture1d tint_symbol_1) { + int arg_1 = 1; + int arg_2 = 0; + float4 res = tint_symbol_1.read(uint(arg_1), 0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureLoad_81c381(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureLoad_81c381(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureLoad_81c381(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4d8ae6ee7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_81c381 "textureLoad_81c381" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_81c381 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %20 + %23 = OpLoad %11 %arg_0 + %24 = OpLoad %int %arg_1 + %25 = OpLoad %int %arg_2 + %22 = OpImageFetch %v4float %23 %24 Lod %25 + OpStore %res %22 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %textureLoad_81c381 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureLoad_81c381 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_81c381 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl new file mode 100644 index 0000000000..65bb5f55a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureLoad_81c381() { + var arg_1 = 1; + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_81c381(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_81c381(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_81c381(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl new file mode 100644 index 0000000000..6df953e8e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureLoad(texture: texture_2d_array, coords: vec2, array_index: i32, level: i32) -> vec4 +fn textureLoad_87be85() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_87be85(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_87be85(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_87be85(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b22cbff7a8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_87be85() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + float4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_87be85(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_87be85(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_87be85(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b22cbff7a8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_87be85() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + float4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_87be85(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_87be85(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_87be85(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl new file mode 100644 index 0000000000..d7e3830703 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_87be85() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureLoad_87be85(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureLoad_87be85() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureLoad_87be85(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_87be85() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureLoad_87be85(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl new file mode 100644 index 0000000000..fd2e590093 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureLoad_87be85(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int arg_3 = 0; + float4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureLoad_87be85(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_87be85(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_87be85(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm new file mode 100644 index 0000000000..4894eba84b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_87be85 "textureLoad_87be85" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %37 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_87be85 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %24 + %27 = OpLoad %11 %arg_0 + %29 = OpLoad %v2int %arg_1 + %30 = OpCompositeExtract %int %29 0 + %31 = OpCompositeExtract %int %29 1 + %32 = OpLoad %int %arg_2 + %33 = OpCompositeConstruct %v3int %30 %31 %32 + %34 = OpLoad %int %arg_3 + %26 = OpImageFetch %v4float %27 %33 Lod %34 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %37 + %39 = OpLabel + %40 = OpFunctionCall %void %textureLoad_87be85 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %42 = OpLabel + %43 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %43 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %46 = OpLabel + %47 = OpFunctionCall %void %textureLoad_87be85 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %49 = OpLabel + %50 = OpFunctionCall %void %textureLoad_87be85 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl new file mode 100644 index 0000000000..277a603873 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureLoad_87be85() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_87be85(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_87be85(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_87be85(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl new file mode 100644 index 0000000000..fe475137b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl @@ -0,0 +1,45 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_external; + +// fn textureLoad(texture: texture_external, coords: vec2) -> vec4 +fn textureLoad_8acf41() { + var arg_1 = vec2(); + var res: vec4 = textureLoad(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_8acf41(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_8acf41(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_8acf41(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4661657d0b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.dxc.hlsl @@ -0,0 +1,112 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, int2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.Load(int3(coord, 0)).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureLoad_8acf41() { + int2 arg_1 = (0).xx; + float4 res = textureLoadExternal(arg_0, ext_tex_plane_1, arg_1, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_8acf41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_8acf41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_8acf41(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4661657d0b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.fxc.hlsl @@ -0,0 +1,112 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, int2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.Load(int3(coord, 0)).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureLoad_8acf41() { + int2 arg_1 = (0).xx; + float4 res = textureLoadExternal(arg_0, ext_tex_plane_1, arg_1, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_8acf41(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_8acf41(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_8acf41(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl new file mode 100644 index 0000000000..2a7cc09141 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl @@ -0,0 +1,237 @@ +SKIP: FAILED + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + +vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_1; +uniform highp sampler2D ext_tex_plane_1_1; +void textureLoad_8acf41() { + ivec2 arg_1 = ivec2(0); + vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, arg_1, ext_tex_params); +} + +vec4 vertex_main() { + textureLoad_8acf41(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:58: 'textureLoadExternal' : no matching overloaded function found +ERROR: 0:58: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:58: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + +vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_1; +uniform highp sampler2D ext_tex_plane_1_1; +void textureLoad_8acf41() { + ivec2 arg_1 = ivec2(0); + vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, arg_1, ext_tex_params); +} + +void fragment_main() { + textureLoad_8acf41(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:59: 'textureLoadExternal' : no matching overloaded function found +ERROR: 0:59: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' +ERROR: 0:59: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 2) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + +vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_1; +uniform highp sampler2D ext_tex_plane_1_1; +void textureLoad_8acf41() { + ivec2 arg_1 = ivec2(0); + vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, arg_1, ext_tex_params); +} + +void compute_main() { + textureLoad_8acf41(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:58: 'textureLoadExternal' : no matching overloaded function found +ERROR: 0:58: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:58: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl new file mode 100644 index 0000000000..d6fff77b9f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl @@ -0,0 +1,90 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct GammaTransferParams { + /* 0x0000 */ float G; + /* 0x0004 */ float A; + /* 0x0008 */ float B; + /* 0x000c */ float C; + /* 0x0010 */ float D; + /* 0x0014 */ float E; + /* 0x0018 */ float F; + /* 0x001c */ uint padding; +}; + +struct ExternalTextureParams { + /* 0x0000 */ uint numPlanes; + /* 0x0004 */ uint doYuvToRgbConversionOnly; + /* 0x0008 */ tint_array tint_pad; + /* 0x0010 */ float3x4 yuvToRgbConversionMatrix; + /* 0x0040 */ GammaTransferParams gammaDecodeParams; + /* 0x0060 */ GammaTransferParams gammaEncodeParams; + /* 0x0080 */ float3x3 gamutConversionMatrix; +}; + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + bool3 const cond = (fabs(v) < float3(params.D)); + float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F)); + float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E)); + return select(f, t, cond); +} + +float4 textureLoadExternal(texture2d plane0, texture2d plane1, int2 coord, ExternalTextureParams params) { + float3 color = 0.0f; + if ((params.numPlanes == 1u)) { + color = float4(plane0.read(uint2(coord), 0)).rgb; + } else { + color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +void textureLoad_8acf41(texture2d tint_symbol_1, texture2d tint_symbol_2, const constant ExternalTextureParams* const tint_symbol_3) { + int2 arg_1 = int2(0); + float4 res = textureLoadExternal(tint_symbol_1, tint_symbol_2, arg_1, *(tint_symbol_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_4, texture2d tint_symbol_5, const constant ExternalTextureParams* const tint_symbol_6) { + textureLoad_8acf41(tint_symbol_4, tint_symbol_5, tint_symbol_6); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_7 [[texture(0)]], texture2d tint_symbol_8 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_9 [[buffer(2)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_7, tint_symbol_8, tint_symbol_9); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_10 [[texture(0)]], texture2d tint_symbol_11 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) { + textureLoad_8acf41(tint_symbol_10, tint_symbol_11, tint_symbol_12); + return; +} + +kernel void compute_main(texture2d tint_symbol_13 [[texture(0)]], texture2d tint_symbol_14 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_15 [[buffer(2)]]) { + textureLoad_8acf41(tint_symbol_13, tint_symbol_14, tint_symbol_15); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm new file mode 100644 index 0000000000..c70c6b140a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm @@ -0,0 +1,243 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 137 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ExternalTextureParams "ExternalTextureParams" + OpMemberName %ExternalTextureParams 0 "numPlanes" + OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly" + OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 3 "gammaDecodeParams" + OpName %GammaTransferParams "GammaTransferParams" + OpMemberName %GammaTransferParams 0 "G" + OpMemberName %GammaTransferParams 1 "A" + OpMemberName %GammaTransferParams 2 "B" + OpMemberName %GammaTransferParams 3 "C" + OpMemberName %GammaTransferParams 4 "D" + OpMemberName %GammaTransferParams 5 "E" + OpMemberName %GammaTransferParams 6 "F" + OpMemberName %GammaTransferParams 7 "padding" + OpMemberName %ExternalTextureParams 4 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix" + OpName %ext_tex_params "ext_tex_params" + OpName %arg_0 "arg_0" + OpName %gammaCorrection "gammaCorrection" + OpName %v "v" + OpName %params "params" + OpName %textureLoadExternal "textureLoadExternal" + OpName %plane0 "plane0" + OpName %plane1 "plane1" + OpName %coord "coord" + OpName %params_0 "params" + OpName %color "color" + OpName %textureLoad_8acf41 "textureLoad_8acf41" + OpName %arg_1 "arg_1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %ext_tex_plane_1 DescriptorSet 1 + OpDecorate %ext_tex_plane_1 Binding 1 + OpDecorate %ExternalTextureParams Block + OpMemberDecorate %ExternalTextureParams 0 Offset 0 + OpMemberDecorate %ExternalTextureParams 1 Offset 4 + OpMemberDecorate %ExternalTextureParams 2 Offset 16 + OpMemberDecorate %ExternalTextureParams 2 ColMajor + OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 3 Offset 64 + OpMemberDecorate %GammaTransferParams 0 Offset 0 + OpMemberDecorate %GammaTransferParams 1 Offset 4 + OpMemberDecorate %GammaTransferParams 2 Offset 8 + OpMemberDecorate %GammaTransferParams 3 Offset 12 + OpMemberDecorate %GammaTransferParams 4 Offset 16 + OpMemberDecorate %GammaTransferParams 5 Offset 20 + OpMemberDecorate %GammaTransferParams 6 Offset 24 + OpMemberDecorate %GammaTransferParams 7 Offset 28 + OpMemberDecorate %ExternalTextureParams 4 Offset 96 + OpMemberDecorate %ExternalTextureParams 5 Offset 128 + OpMemberDecorate %ExternalTextureParams 5 ColMajor + OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16 + OpDecorate %ext_tex_params NonWritable + OpDecorate %ext_tex_params DescriptorSet 1 + OpDecorate %ext_tex_params Binding 2 + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 +%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 +%mat3v4float = OpTypeMatrix %v4float 3 +%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams +%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %21 = OpTypeFunction %v3float %v3float %GammaTransferParams + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %41 = OpConstantNull %v3float + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %61 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams + %uint_1 = OpConstant %uint 1 + %78 = OpConstantNull %int + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %92 = OpConstantNull %uint + %void = OpTypeVoid + %110 = OpTypeFunction %void + %114 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %124 = OpTypeFunction %v4float +%gammaCorrection = OpFunction %v3float None %21 + %v = OpFunctionParameter %v3float + %params = OpFunctionParameter %GammaTransferParams + %25 = OpLabel + %39 = OpVariable %_ptr_Function_v3float Function %41 + %51 = OpVariable %_ptr_Function_v3float Function %41 + %57 = OpVariable %_ptr_Function_v3float Function %41 + %26 = OpExtInst %v3float %27 FAbs %v + %28 = OpCompositeExtract %float %params 4 + %29 = OpCompositeConstruct %v3float %28 %28 %28 + %30 = OpFOrdLessThan %v3bool %26 %29 + %33 = OpExtInst %v3float %27 FSign %v + %34 = OpCompositeExtract %float %params 3 + %35 = OpExtInst %v3float %27 FAbs %v + %36 = OpVectorTimesScalar %v3float %35 %34 + %37 = OpCompositeExtract %float %params 6 + %42 = OpCompositeConstruct %v3float %37 %37 %37 + %38 = OpFAdd %v3float %36 %42 + %43 = OpFMul %v3float %33 %38 + %44 = OpExtInst %v3float %27 FSign %v + %46 = OpCompositeExtract %float %params 1 + %47 = OpExtInst %v3float %27 FAbs %v + %48 = OpVectorTimesScalar %v3float %47 %46 + %49 = OpCompositeExtract %float %params 2 + %52 = OpCompositeConstruct %v3float %49 %49 %49 + %50 = OpFAdd %v3float %48 %52 + %53 = OpCompositeExtract %float %params 0 + %54 = OpCompositeConstruct %v3float %53 %53 %53 + %45 = OpExtInst %v3float %27 Pow %50 %54 + %55 = OpCompositeExtract %float %params 5 + %58 = OpCompositeConstruct %v3float %55 %55 %55 + %56 = OpFAdd %v3float %45 %58 + %59 = OpFMul %v3float %44 %56 + %60 = OpSelect %v3float %30 %43 %59 + OpReturnValue %60 + OpFunctionEnd +%textureLoadExternal = OpFunction %v4float None %61 + %plane0 = OpFunctionParameter %11 + %plane1 = OpFunctionParameter %11 + %coord = OpFunctionParameter %v2int + %params_0 = OpFunctionParameter %ExternalTextureParams + %69 = OpLabel + %color = OpVariable %_ptr_Function_v3float Function %41 + %71 = OpCompositeExtract %uint %params_0 0 + %73 = OpIEqual %bool %71 %uint_1 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpImageFetch %v4float %plane0 %coord Lod %78 + %79 = OpVectorShuffle %v3float %77 %77 0 1 2 + OpStore %color %79 + OpBranch %74 + %76 = OpLabel + %80 = OpImageFetch %v4float %plane0 %coord Lod %78 + %81 = OpCompositeExtract %float %80 0 + %82 = OpImageFetch %v4float %plane1 %coord Lod %78 + %84 = OpVectorShuffle %v2float %82 %82 0 1 + %85 = OpCompositeExtract %float %84 0 + %86 = OpCompositeExtract %float %84 1 + %88 = OpCompositeConstruct %v4float %81 %85 %86 %float_1 + %89 = OpCompositeExtract %mat3v4float %params_0 2 + %90 = OpVectorTimesMatrix %v3float %88 %89 + OpStore %color %90 + OpBranch %74 + %74 = OpLabel + %91 = OpCompositeExtract %uint %params_0 1 + %93 = OpIEqual %bool %91 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + %97 = OpLoad %v3float %color + %98 = OpCompositeExtract %GammaTransferParams %params_0 3 + %96 = OpFunctionCall %v3float %gammaCorrection %97 %98 + OpStore %color %96 + %99 = OpCompositeExtract %mat3v3float %params_0 5 + %100 = OpLoad %v3float %color + %101 = OpMatrixTimesVector %v3float %99 %100 + OpStore %color %101 + %103 = OpLoad %v3float %color + %104 = OpCompositeExtract %GammaTransferParams %params_0 4 + %102 = OpFunctionCall %v3float %gammaCorrection %103 %104 + OpStore %color %102 + OpBranch %94 + %94 = OpLabel + %105 = OpLoad %v3float %color + %106 = OpCompositeExtract %float %105 0 + %107 = OpCompositeExtract %float %105 1 + %108 = OpCompositeExtract %float %105 2 + %109 = OpCompositeConstruct %v4float %106 %107 %108 %float_1 + OpReturnValue %109 + OpFunctionEnd +%textureLoad_8acf41 = OpFunction %void None %110 + %113 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %114 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %114 + %118 = OpLoad %11 %arg_0 + %119 = OpLoad %11 %ext_tex_plane_1 + %120 = OpLoad %v2int %arg_1 + %121 = OpLoad %ExternalTextureParams %ext_tex_params + %117 = OpFunctionCall %v4float %textureLoadExternal %118 %119 %120 %121 + OpStore %res %117 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %124 + %126 = OpLabel + %127 = OpFunctionCall %void %textureLoad_8acf41 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %110 + %129 = OpLabel + %130 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %130 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %110 + %132 = OpLabel + %133 = OpFunctionCall %void %textureLoad_8acf41 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %110 + %135 = OpLabel + %136 = OpFunctionCall %void %textureLoad_8acf41 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl new file mode 100644 index 0000000000..09bc01249d --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +@group(1) @binding(0) var arg_0 : texture_external; + +fn textureLoad_8acf41() { + var arg_1 = vec2(); + var res : vec4 = textureLoad(arg_0, arg_1); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_8acf41(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_8acf41(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_8acf41(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl new file mode 100644 index 0000000000..923b74a01e --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureLoad(texture: texture_depth_2d_array, coords: vec2, array_index: i32, level: i32) -> f32 +fn textureLoad_9b2667() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res: f32 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_9b2667(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_9b2667(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_9b2667(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b354532f59 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_9b2667() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + float res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_9b2667(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_9b2667(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_9b2667(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b354532f59 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureLoad_9b2667() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int arg_3 = 0; + float res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_9b2667(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_9b2667(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_9b2667(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl new file mode 100644 index 0000000000..59244ebd33 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_9b2667() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3).x; +} + +vec4 vertex_main() { + textureLoad_9b2667(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureLoad_9b2667() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3).x; +} + +void fragment_main() { + textureLoad_9b2667(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureLoad_9b2667() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + int arg_3 = 0; + float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3).x; +} + +void compute_main() { + textureLoad_9b2667(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl new file mode 100644 index 0000000000..456f44dc53 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureLoad_9b2667(depth2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int arg_3 = 0; + float res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureLoad_9b2667(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureLoad_9b2667(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureLoad_9b2667(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d0af88d1c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_9b2667 "textureLoad_9b2667" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v3int = OpTypeVector %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_9b2667 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %24 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %int %arg_3 + %27 = OpImageFetch %v4float %28 %34 Lod %35 + %26 = OpCompositeExtract %float %27 0 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_9b2667 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %47 = OpLabel + %48 = OpFunctionCall %void %textureLoad_9b2667 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %50 = OpLabel + %51 = OpFunctionCall %void %textureLoad_9b2667 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b7f1292d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureLoad_9b2667() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = 0; + var res : f32 = textureLoad(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_9b2667(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_9b2667(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_9b2667(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl new file mode 100644 index 0000000000..ca7533e510 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 +fn textureLoad_a583c9() { + var arg_1 = vec2(); + var arg_2 = 1; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a583c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_a583c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_a583c9(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c8c40f9263 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_a583c9() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 res = arg_0.Load(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a583c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a583c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a583c9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c8c40f9263 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_a583c9() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 res = arg_0.Load(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a583c9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a583c9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a583c9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl new file mode 100644 index 0000000000..2d7faeccad --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_a583c9() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_a583c9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureLoad_a583c9() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_a583c9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureLoad_a583c9() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_a583c9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl new file mode 100644 index 0000000000..666d009f2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_a583c9(texture2d_ms tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureLoad_a583c9(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_a583c9(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_a583c9(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9e24f9b84 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_a583c9 "textureLoad_a583c9" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %31 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_a583c9 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4float %26 %27 Sample %28 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %31 + %33 = OpLabel + %34 = OpFunctionCall %void %textureLoad_a583c9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %37 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %40 = OpLabel + %41 = OpFunctionCall %void %textureLoad_a583c9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %void %textureLoad_a583c9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a92faa62d --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureLoad_a583c9() { + var arg_1 = vec2(); + var arg_2 = 1; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a583c9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_a583c9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_a583c9(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl new file mode 100644 index 0000000000..98ff406425 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureLoad(texture: texture_3d, coords: vec3, level: i32) -> vec4 +fn textureLoad_a9a9f5() { + var arg_1 = vec3(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a9a9f5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_a9a9f5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_a9a9f5(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a44b10ec40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_a9a9f5() { + int3 arg_1 = (0).xxx; + int arg_2 = 0; + uint4 res = arg_0.Load(int4(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a9a9f5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a9a9f5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a9a9f5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a44b10ec40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureLoad_a9a9f5() { + int3 arg_1 = (0).xxx; + int arg_2 = 0; + uint4 res = arg_0.Load(int4(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_a9a9f5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_a9a9f5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_a9a9f5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl new file mode 100644 index 0000000000..66f2e8ca7c --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureLoad_a9a9f5() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_a9a9f5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureLoad_a9a9f5() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_a9a9f5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureLoad_a9a9f5() { + ivec3 arg_1 = ivec3(0); + int arg_2 = 0; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_a9a9f5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl new file mode 100644 index 0000000000..a5491a65ce --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_a9a9f5(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int arg_2 = 0; + uint4 res = tint_symbol_1.read(uint3(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureLoad_a9a9f5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureLoad_a9a9f5(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureLoad_a9a9f5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.spvasm new file mode 100644 index 0000000000..234a175fbd --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_a9a9f5 "textureLoad_a9a9f5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %22 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %32 = OpConstantNull %v4uint + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_a9a9f5 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %22 + %res = OpVariable %_ptr_Function_v4uint Function %32 + OpStore %arg_1 %19 + OpStore %arg_2 %22 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4uint %27 %28 Lod %29 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_a9a9f5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_a9a9f5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %45 = OpLabel + %46 = OpFunctionCall %void %textureLoad_a9a9f5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl new file mode 100644 index 0000000000..660e8183a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureLoad_a9a9f5() { + var arg_1 = vec3(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_a9a9f5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_a9a9f5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_a9a9f5(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl new file mode 100644 index 0000000000..9d525992c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureLoad(texture: texture_2d, coords: vec2, level: i32) -> vec4 +fn textureLoad_c2a480() { + var arg_1 = vec2(); + var arg_2 = 0; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c2a480(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_c2a480(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_c2a480(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..772ad7ddaf --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_c2a480() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + int4 res = arg_0.Load(int3(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c2a480(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c2a480(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c2a480(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..772ad7ddaf --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureLoad_c2a480() { + int2 arg_1 = (0).xx; + int arg_2 = 0; + int4 res = arg_0.Load(int3(arg_1, arg_2)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c2a480(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c2a480(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c2a480(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl new file mode 100644 index 0000000000..17b4070fee --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureLoad_c2a480() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_c2a480(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureLoad_c2a480() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_c2a480(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureLoad_c2a480() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 0; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_c2a480(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl new file mode 100644 index 0000000000..8aa51f457d --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_c2a480(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 0; + int4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureLoad_c2a480(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureLoad_c2a480(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureLoad_c2a480(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.spvasm new file mode 100644 index 0000000000..60ed5452ef --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_c2a480 "textureLoad_c2a480" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %21 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %31 = OpConstantNull %v4int + %32 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_c2a480 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %21 + %res = OpVariable %_ptr_Function_v4int Function %31 + OpStore %arg_1 %18 + OpStore %arg_2 %21 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %int %arg_2 + %24 = OpImageFetch %v4int %26 %27 Lod %28 + OpStore %res %24 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %32 + %34 = OpLabel + %35 = OpFunctionCall %void %textureLoad_c2a480 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %38 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureLoad_c2a480 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %void %textureLoad_c2a480 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ba5cbd123 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureLoad_c2a480() { + var arg_1 = vec2(); + var arg_2 = 0; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c2a480(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_c2a480(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_c2a480(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl new file mode 100644 index 0000000000..357971ef28 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 +fn textureLoad_c378ee() { + var arg_1 = vec2(); + var arg_2 = 1; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c378ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_c378ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_c378ee(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..20193dae9a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_c378ee() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 res = arg_0.Load(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c378ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c378ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c378ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20193dae9a --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_c378ee() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 res = arg_0.Load(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_c378ee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_c378ee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_c378ee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl new file mode 100644 index 0000000000..9d3f844571 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureLoad_c378ee() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_c378ee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DMS arg_0_1; +void textureLoad_c378ee() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_c378ee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureLoad_c378ee() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_c378ee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl new file mode 100644 index 0000000000..c6192ce47f --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_c378ee(texture2d_ms tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureLoad_c378ee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_c378ee(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_c378ee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.spvasm new file mode 100644 index 0000000000..190f4acf34 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_c378ee "textureLoad_c378ee" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %33 = OpConstantNull %v4uint + %34 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_c378ee = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %res = OpVariable %_ptr_Function_v4uint Function %33 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + %28 = OpLoad %11 %arg_0 + %29 = OpLoad %v2int %arg_1 + %30 = OpLoad %int %arg_2 + %26 = OpImageFetch %v4uint %28 %29 Sample %30 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureLoad_c378ee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %void %textureLoad_c378ee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %46 = OpLabel + %47 = OpFunctionCall %void %textureLoad_c378ee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl new file mode 100644 index 0000000000..cb6fd49690 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureLoad_c378ee() { + var arg_1 = vec2(); + var arg_2 = 1; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_c378ee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_c378ee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_c378ee(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl new file mode 100644 index 0000000000..a856096fbc --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureLoad(texture: texture_multisampled_2d, coords: vec2, sample_index: i32) -> vec4 +fn textureLoad_e3d2cc() { + var arg_1 = vec2(); + var arg_2 = 1; + var res: vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_e3d2cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_e3d2cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_e3d2cc(); +} diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2599303c42 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_e3d2cc() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 res = arg_0.Load(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_e3d2cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_e3d2cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_e3d2cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2599303c42 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureLoad_e3d2cc() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 res = arg_0.Load(arg_1, arg_2); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureLoad_e3d2cc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureLoad_e3d2cc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureLoad_e3d2cc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl new file mode 100644 index 0000000000..6c70fb265b --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureLoad_e3d2cc() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +vec4 vertex_main() { + textureLoad_e3d2cc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DMS arg_0_1; +void textureLoad_e3d2cc() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void fragment_main() { + textureLoad_e3d2cc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureLoad_e3d2cc() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 res = texelFetch(arg_0_1, arg_1, arg_2); +} + +void compute_main() { + textureLoad_e3d2cc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl new file mode 100644 index 0000000000..37f3ac3d45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureLoad_e3d2cc(texture2d_ms tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 res = tint_symbol_1.read(uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureLoad_e3d2cc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureLoad_e3d2cc(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureLoad_e3d2cc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.spvasm new file mode 100644 index 0000000000..31837df0fb --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureLoad_e3d2cc "textureLoad_e3d2cc" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %32 = OpConstantNull %v4int + %33 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureLoad_e3d2cc = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_v4int Function %32 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %int %arg_2 + %25 = OpImageFetch %v4int %27 %28 Sample %29 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %33 + %35 = OpLabel + %36 = OpFunctionCall %void %textureLoad_e3d2cc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %39 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureLoad_e3d2cc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %45 = OpLabel + %46 = OpFunctionCall %void %textureLoad_e3d2cc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl new file mode 100644 index 0000000000..f1f2971c7e --- /dev/null +++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureLoad_e3d2cc() { + var arg_1 = vec2(); + var arg_2 = 1; + var res : vec4 = textureLoad(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureLoad_e3d2cc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureLoad_e3d2cc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureLoad_e3d2cc(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl new file mode 100644 index 0000000000..2abd10d2c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLayers(texture: texture_2d_array) -> i32 +fn textureNumLayers_024820() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_024820(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_024820(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_024820(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c54de32f98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_024820() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_024820(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_024820(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_024820(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c54de32f98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_024820() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_024820(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_024820(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_024820(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl new file mode 100644 index 0000000000..9e3639f215 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_024820() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_024820(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_024820() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_024820(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_024820() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_024820(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl new file mode 100644 index 0000000000..62c3cdabae --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_024820(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_024820(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_024820(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_024820(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm new file mode 100644 index 0000000000..5c65a190bc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_024820 "textureNumLayers_024820" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_024820 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_024820 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_024820 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_024820 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl new file mode 100644 index 0000000000..eaa9cc7883 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLayers_024820() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_024820(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_024820(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_024820(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl new file mode 100644 index 0000000000..e4ee7aa5ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLayers(texture: texture_cube_array) -> i32 +fn textureNumLayers_053df7() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_053df7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_053df7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_053df7(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ec0865280f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_053df7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_053df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_053df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_053df7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec0865280f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_053df7() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_053df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_053df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_053df7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl new file mode 100644 index 0000000000..e995abb9b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLayers_053df7() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_053df7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLayers_053df7() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_053df7(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLayers_053df7() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_053df7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl new file mode 100644 index 0000000000..68ceeb46a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_053df7(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLayers_053df7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_053df7(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_053df7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm new file mode 100644 index 0000000000..a8336ca7d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_053df7 "textureNumLayers_053df7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_053df7 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureNumLayers_053df7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLayers_053df7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureNumLayers_053df7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl new file mode 100644 index 0000000000..06592acc08 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLayers_053df7() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_053df7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_053df7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_053df7(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl new file mode 100644 index 0000000000..205475f818 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_058cc3() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_058cc3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_058cc3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_058cc3(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0f9f61ae48 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_058cc3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_058cc3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_058cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_058cc3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0f9f61ae48 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_058cc3() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_058cc3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_058cc3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_058cc3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl new file mode 100644 index 0000000000..0730d3a356 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_058cc3() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_058cc3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_058cc3() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_058cc3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_058cc3() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_058cc3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl new file mode 100644 index 0000000000..f89aa0051f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_058cc3(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_058cc3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_058cc3(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_058cc3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm new file mode 100644 index 0000000000..4737d7e08a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_058cc3 "textureNumLayers_058cc3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_058cc3 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_058cc3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_058cc3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_058cc3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl new file mode 100644 index 0000000000..a39583bf6a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_058cc3() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_058cc3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_058cc3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_058cc3(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl new file mode 100644 index 0000000000..58e1dba6dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_09d05d() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_09d05d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_09d05d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_09d05d(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c52cd47ecc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_09d05d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_09d05d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_09d05d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_09d05d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c52cd47ecc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_09d05d() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_09d05d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_09d05d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_09d05d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl new file mode 100644 index 0000000000..25b7ded5ea --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_09d05d() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_09d05d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_09d05d() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_09d05d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_09d05d() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_09d05d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl new file mode 100644 index 0000000000..6666c52d32 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_09d05d(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_09d05d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_09d05d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_09d05d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm new file mode 100644 index 0000000000..e70fdfceba --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_09d05d "textureNumLayers_09d05d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_09d05d = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_09d05d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_09d05d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_09d05d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl new file mode 100644 index 0000000000..cede280a55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_09d05d() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_09d05d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_09d05d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_09d05d(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl new file mode 100644 index 0000000000..c67abfb40a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_13b4ce() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_13b4ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_13b4ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_13b4ce(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d9ac8afb4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_13b4ce() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_13b4ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_13b4ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_13b4ce(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d9ac8afb4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_13b4ce() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_13b4ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_13b4ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_13b4ce(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl new file mode 100644 index 0000000000..f09006795c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_13b4ce() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_13b4ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_13b4ce() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_13b4ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_13b4ce() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_13b4ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl new file mode 100644 index 0000000000..bb33ae6c61 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_13b4ce(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_13b4ce(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_13b4ce(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_13b4ce(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..651790d490 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_13b4ce "textureNumLayers_13b4ce" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_13b4ce = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_13b4ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_13b4ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_13b4ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..15c0d550e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_13b4ce() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_13b4ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_13b4ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_13b4ce(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl new file mode 100644 index 0000000000..97c27dffa5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_22e53b() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_22e53b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_22e53b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_22e53b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8611a5211c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_22e53b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_22e53b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_22e53b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_22e53b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8611a5211c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_22e53b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_22e53b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_22e53b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_22e53b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl new file mode 100644 index 0000000000..3902bb39d0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_22e53b() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_22e53b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_22e53b() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_22e53b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_22e53b() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_22e53b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl new file mode 100644 index 0000000000..5c5fa33da1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_22e53b(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_22e53b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_22e53b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_22e53b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm new file mode 100644 index 0000000000..953a4a4d4f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_22e53b "textureNumLayers_22e53b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_22e53b = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_22e53b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_22e53b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_22e53b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ac305721e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_22e53b() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_22e53b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_22e53b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_22e53b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl new file mode 100644 index 0000000000..740fc823f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_562013() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_562013(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_562013(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_562013(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..59664cc21b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_562013() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_562013(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_562013(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_562013(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..59664cc21b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_562013() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_562013(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_562013(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_562013(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl new file mode 100644 index 0000000000..713a325a69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_562013() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_562013(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_562013() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_562013(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_562013() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_562013(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl new file mode 100644 index 0000000000..97a5498d1b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_562013(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_562013(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_562013(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_562013(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm new file mode 100644 index 0000000000..96b0fc25af --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_562013 "textureNumLayers_562013" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_562013 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_562013 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_562013 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_562013 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl new file mode 100644 index 0000000000..c82f593d00 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_562013() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_562013(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_562013(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_562013(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl new file mode 100644 index 0000000000..538aee466f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLayers(texture: texture_cube_array) -> i32 +fn textureNumLayers_5d59cd() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_5d59cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_5d59cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_5d59cd(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..063ac3bee8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_5d59cd() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_5d59cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_5d59cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_5d59cd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..063ac3bee8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_5d59cd() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_5d59cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_5d59cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_5d59cd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl new file mode 100644 index 0000000000..c469183479 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_5d59cd() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_5d59cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_5d59cd() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_5d59cd(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_5d59cd() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_5d59cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl new file mode 100644 index 0000000000..aa7890e4f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_5d59cd(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLayers_5d59cd(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_5d59cd(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_5d59cd(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7f1f9e666 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_5d59cd "textureNumLayers_5d59cd" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_5d59cd = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_5d59cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_5d59cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_5d59cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..28bcd65030 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLayers_5d59cd() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_5d59cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_5d59cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_5d59cd(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl new file mode 100644 index 0000000000..e7c4f20427 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_68a65b() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_68a65b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_68a65b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_68a65b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cefd82036d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_68a65b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_68a65b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_68a65b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_68a65b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cefd82036d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_68a65b() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_68a65b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_68a65b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_68a65b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl new file mode 100644 index 0000000000..38cd9e7208 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_68a65b() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_68a65b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_68a65b() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_68a65b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_68a65b() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_68a65b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl new file mode 100644 index 0000000000..906ffc528e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_68a65b(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_68a65b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_68a65b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_68a65b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm new file mode 100644 index 0000000000..53d6ff2d51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_68a65b "textureNumLayers_68a65b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_68a65b = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_68a65b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_68a65b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_68a65b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7cfa50e58 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_68a65b() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_68a65b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_68a65b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_68a65b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl new file mode 100644 index 0000000000..06508d7b2a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureNumLayers(texture: texture_depth_cube_array) -> i32 +fn textureNumLayers_778bd1() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_778bd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_778bd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_778bd1(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..198c36ba40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_778bd1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_778bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_778bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_778bd1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..198c36ba40 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_778bd1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_778bd1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_778bd1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_778bd1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl new file mode 100644 index 0000000000..40debcc79c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_778bd1() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_778bd1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_778bd1() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_778bd1(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLayers_778bd1() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_778bd1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl new file mode 100644 index 0000000000..fc13fba684 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_778bd1(depthcube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureNumLayers_778bd1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_778bd1(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_778bd1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm new file mode 100644 index 0000000000..b1fd36b654 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_778bd1 "textureNumLayers_778bd1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_778bd1 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_778bd1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_778bd1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_778bd1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl new file mode 100644 index 0000000000..8274e1e0dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureNumLayers_778bd1() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_778bd1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_778bd1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_778bd1(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl new file mode 100644 index 0000000000..cf29588b21 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_7f1937() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_7f1937(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_7f1937(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_7f1937(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..edd423aea6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_7f1937() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_7f1937(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_7f1937(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_7f1937(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..edd423aea6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_7f1937() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_7f1937(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_7f1937(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_7f1937(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl new file mode 100644 index 0000000000..f6fdbf0fce --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_7f1937() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_7f1937(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_7f1937() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_7f1937(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_7f1937() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_7f1937(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl new file mode 100644 index 0000000000..05239dae46 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_7f1937(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_7f1937(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_7f1937(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_7f1937(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm new file mode 100644 index 0000000000..59d909df01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_7f1937 "textureNumLayers_7f1937" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_7f1937 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_7f1937 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_7f1937 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_7f1937 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl new file mode 100644 index 0000000000..27ba4129d0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_7f1937() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_7f1937(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_7f1937(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_7f1937(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl new file mode 100644 index 0000000000..38bb36ed9b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLayers(texture: texture_cube_array) -> i32 +fn textureNumLayers_85f980() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_85f980(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_85f980(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_85f980(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bd6cdc4517 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_85f980() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_85f980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_85f980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_85f980(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bd6cdc4517 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLayers_85f980() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_85f980(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_85f980(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_85f980(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl new file mode 100644 index 0000000000..529bfb372b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLayers_85f980() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_85f980(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLayers_85f980() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_85f980(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLayers_85f980() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_85f980(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl new file mode 100644 index 0000000000..e1b10ebfdc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_85f980(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLayers_85f980(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_85f980(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_85f980(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm new file mode 100644 index 0000000000..4484cadba1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_85f980 "textureNumLayers_85f980" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_85f980 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_85f980 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_85f980 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_85f980 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl new file mode 100644 index 0000000000..5206f514f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLayers_85f980() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_85f980(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_85f980(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_85f980(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl new file mode 100644 index 0000000000..b982487d6f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLayers(texture: texture_2d_array) -> i32 +fn textureNumLayers_87953e() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_87953e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_87953e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_87953e(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5c563c486d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_87953e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_87953e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_87953e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_87953e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5c563c486d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_87953e() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_87953e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_87953e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_87953e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl new file mode 100644 index 0000000000..83bae633ce --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLayers_87953e() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_87953e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureNumLayers_87953e() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_87953e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLayers_87953e() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_87953e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl new file mode 100644 index 0000000000..971482f10b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_87953e(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_87953e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_87953e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_87953e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm new file mode 100644 index 0000000000..109f2d05bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_87953e "textureNumLayers_87953e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_87953e = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %25 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySizeLod %v3int %21 %int_0 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %textureNumLayers_87953e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLayers_87953e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureNumLayers_87953e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl new file mode 100644 index 0000000000..55d0f9de7c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLayers_87953e() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_87953e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_87953e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_87953e(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl new file mode 100644 index 0000000000..533a86f261 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLayers(texture: texture_2d_array) -> i32 +fn textureNumLayers_893e7c() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_893e7c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_893e7c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_893e7c(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0991385af2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_893e7c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_893e7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_893e7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_893e7c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0991385af2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_893e7c() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_893e7c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_893e7c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_893e7c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl new file mode 100644 index 0000000000..e2d0eb6a5d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLayers_893e7c() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_893e7c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureNumLayers_893e7c() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_893e7c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLayers_893e7c() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_893e7c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl new file mode 100644 index 0000000000..66d329d6ed --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_893e7c(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_893e7c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_893e7c(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_893e7c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm new file mode 100644 index 0000000000..22bfd83dad --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_893e7c "textureNumLayers_893e7c" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_893e7c = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_893e7c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_893e7c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_893e7c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ef46100e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLayers_893e7c() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_893e7c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_893e7c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_893e7c(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl new file mode 100644 index 0000000000..442d50bad3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_9700fb() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_9700fb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_9700fb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_9700fb(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..63205b7d81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_9700fb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_9700fb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_9700fb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_9700fb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63205b7d81 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_9700fb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_9700fb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_9700fb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_9700fb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl new file mode 100644 index 0000000000..24b2d5dcdf --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_9700fb() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_9700fb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_9700fb() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_9700fb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_9700fb() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_9700fb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl new file mode 100644 index 0000000000..1b296c7c8d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_9700fb(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_9700fb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_9700fb(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_9700fb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm new file mode 100644 index 0000000000..49864947b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_9700fb "textureNumLayers_9700fb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_9700fb = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_9700fb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_9700fb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_9700fb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl new file mode 100644 index 0000000000..d260e369f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_9700fb() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_9700fb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_9700fb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_9700fb(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl new file mode 100644 index 0000000000..634b16def7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_a216d2() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_a216d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_a216d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_a216d2(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d9cf5006ba --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_a216d2() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_a216d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_a216d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_a216d2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d9cf5006ba --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_a216d2() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_a216d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_a216d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_a216d2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl new file mode 100644 index 0000000000..a6deec3075 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_a216d2() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_a216d2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_a216d2() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_a216d2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_a216d2() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_a216d2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl new file mode 100644 index 0000000000..427fe4f144 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_a216d2(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_a216d2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_a216d2(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_a216d2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d82417876 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_a216d2 "textureNumLayers_a216d2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_a216d2 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_a216d2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_a216d2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_a216d2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef09e0ba34 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_a216d2() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_a216d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_a216d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_a216d2(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl new file mode 100644 index 0000000000..b58bc746a6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_cd5dc8() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_cd5dc8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_cd5dc8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_cd5dc8(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ca5a80c50a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_cd5dc8() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_cd5dc8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_cd5dc8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_cd5dc8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ca5a80c50a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_cd5dc8() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_cd5dc8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_cd5dc8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_cd5dc8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl new file mode 100644 index 0000000000..95fdcf49d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_cd5dc8() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_cd5dc8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_cd5dc8() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_cd5dc8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_cd5dc8() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_cd5dc8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl new file mode 100644 index 0000000000..bff98ca56c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_cd5dc8(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_cd5dc8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_cd5dc8(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_cd5dc8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm new file mode 100644 index 0000000000..996f85ebd0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_cd5dc8 "textureNumLayers_cd5dc8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_cd5dc8 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_cd5dc8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_cd5dc8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_cd5dc8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl new file mode 100644 index 0000000000..7fa1228ac1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_cd5dc8() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_cd5dc8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_cd5dc8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_cd5dc8(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl new file mode 100644 index 0000000000..91ac33b9b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_d5b228() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_d5b228(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_d5b228(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_d5b228(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a8c82b0521 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_d5b228() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_d5b228(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_d5b228(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_d5b228(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a8c82b0521 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_d5b228() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_d5b228(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_d5b228(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_d5b228(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl new file mode 100644 index 0000000000..0daa0a3ab4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_d5b228() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_d5b228(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_d5b228() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_d5b228(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_d5b228() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_d5b228(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl new file mode 100644 index 0000000000..d2a101171b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_d5b228(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_d5b228(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_d5b228(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_d5b228(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm new file mode 100644 index 0000000000..08a45eeaa9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_d5b228 "textureNumLayers_d5b228" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_d5b228 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_d5b228 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_d5b228 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_d5b228 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl new file mode 100644 index 0000000000..9cf3683b7b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_d5b228() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_d5b228(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_d5b228(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_d5b228(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl new file mode 100644 index 0000000000..5de9836309 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_e31be1() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e31be1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_e31be1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_e31be1(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6aca3c5454 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_e31be1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e31be1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e31be1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e31be1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6aca3c5454 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_e31be1() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e31be1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e31be1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e31be1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl new file mode 100644 index 0000000000..e5e4797207 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_e31be1() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_e31be1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_e31be1() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_e31be1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureNumLayers_e31be1() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_e31be1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl new file mode 100644 index 0000000000..3b5b47f31f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_e31be1(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_e31be1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_e31be1(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_e31be1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm new file mode 100644 index 0000000000..192aa63e13 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_e31be1 "textureNumLayers_e31be1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_e31be1 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_e31be1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_e31be1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_e31be1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c93038431e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_e31be1() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e31be1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_e31be1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_e31be1(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl new file mode 100644 index 0000000000..c4a290d932 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureNumLayers(texture: texture_depth_2d_array) -> i32 +fn textureNumLayers_e653c0() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e653c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_e653c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_e653c0(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..07d21c43e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_e653c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e653c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e653c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e653c0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..07d21c43e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLayers_e653c0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_e653c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_e653c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_e653c0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl new file mode 100644 index 0000000000..c622a34e56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_e653c0() { + int res = textureSize(arg_0_1, 0).z; +} + +vec4 vertex_main() { + textureNumLayers_e653c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_e653c0() { + int res = textureSize(arg_0_1, 0).z; +} + +void fragment_main() { + textureNumLayers_e653c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLayers_e653c0() { + int res = textureSize(arg_0_1, 0).z; +} + +void compute_main() { + textureNumLayers_e653c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl new file mode 100644 index 0000000000..ade75dde6a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_e653c0(depth2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureNumLayers_e653c0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_e653c0(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_e653c0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..52ed92393e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_e653c0 "textureNumLayers_e653c0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_e653c0 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySizeLod %v3int %20 %int_0 + %16 = OpCompositeExtract %int %18 2 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_e653c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_e653c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_e653c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..601ce1f3f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureNumLayers_e653c0() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_e653c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_e653c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_e653c0(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl new file mode 100644 index 0000000000..f47b3a231d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_ee942f() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ee942f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_ee942f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_ee942f(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b49235b30 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ee942f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ee942f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ee942f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ee942f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b49235b30 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ee942f() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ee942f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ee942f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ee942f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl new file mode 100644 index 0000000000..f5996d30a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ee942f() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_ee942f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ee942f() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_ee942f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ee942f() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_ee942f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl new file mode 100644 index 0000000000..d8f0821835 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_ee942f(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_ee942f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_ee942f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_ee942f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0a11d962e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_ee942f "textureNumLayers_ee942f" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_ee942f = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_ee942f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_ee942f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_ee942f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6d26dd47e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_ee942f() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ee942f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_ee942f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_ee942f(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl new file mode 100644 index 0000000000..97533d2198 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_f33005() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_f33005(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_f33005(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_f33005(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4f341b1db5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_f33005() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_f33005(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_f33005(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_f33005(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f341b1db5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_f33005() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_f33005(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_f33005(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_f33005(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl new file mode 100644 index 0000000000..541d0295a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_f33005() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_f33005(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_f33005() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_f33005(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureNumLayers_f33005() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_f33005(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl new file mode 100644 index 0000000000..d4153049f6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_f33005(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_f33005(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_f33005(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_f33005(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6a62248f3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_f33005 "textureNumLayers_f33005" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %24 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_f33005 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %23 + %20 = OpLoad %11 %arg_0 + %18 = OpImageQuerySize %v3int %20 + %17 = OpCompositeExtract %int %18 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %textureNumLayers_f33005 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %33 = OpLabel + %34 = OpFunctionCall %void %textureNumLayers_f33005 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %36 = OpLabel + %37 = OpFunctionCall %void %textureNumLayers_f33005 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d7eee496d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_f33005() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_f33005(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_f33005(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_f33005(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl new file mode 100644 index 0000000000..eafec6dea5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_fcec98() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_fcec98(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_fcec98(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_fcec98(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ded29d872 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_fcec98() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_fcec98(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_fcec98(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_fcec98(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ded29d872 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_fcec98() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_fcec98(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_fcec98(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_fcec98(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl new file mode 100644 index 0000000000..bfaa76f926 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_fcec98() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_fcec98(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_fcec98() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_fcec98(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_fcec98() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_fcec98(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl new file mode 100644 index 0000000000..62335743da --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_fcec98(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_fcec98(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_fcec98(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_fcec98(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm new file mode 100644 index 0000000000..b33d57b8ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_fcec98 "textureNumLayers_fcec98" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_fcec98 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_fcec98 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_fcec98 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_fcec98 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl new file mode 100644 index 0000000000..1c1e1794f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_fcec98() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_fcec98(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_fcec98(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_fcec98(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl new file mode 100644 index 0000000000..1c1466569e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureNumLayers(texture: texture_storage_2d_array) -> i32 +fn textureNumLayers_ff5e89() { + var res: i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ff5e89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_ff5e89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_ff5e89(); +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ff6d2cbd5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ff5e89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ff5e89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ff5e89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ff5e89(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ff6d2cbd5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureNumLayers_ff5e89() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLayers_ff5e89(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLayers_ff5e89(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLayers_ff5e89(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl new file mode 100644 index 0000000000..76ca5cc24c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ff5e89() { + int res = imageSize(arg_0).z; +} + +vec4 vertex_main() { + textureNumLayers_ff5e89(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ff5e89() { + int res = imageSize(arg_0).z; +} + +void fragment_main() { + textureNumLayers_ff5e89(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureNumLayers_ff5e89() { + int res = imageSize(arg_0).z; +} + +void compute_main() { + textureNumLayers_ff5e89(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl new file mode 100644 index 0000000000..2fb050961d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLayers_ff5e89(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_array_size()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLayers_ff5e89(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLayers_ff5e89(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLayers_ff5e89(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm new file mode 100644 index 0000000000..ae6e277375 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLayers_ff5e89 "textureNumLayers_ff5e89" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLayers_ff5e89 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %24 + %21 = OpLoad %11 %arg_0 + %19 = OpImageQuerySize %v3int %21 + %17 = OpCompositeExtract %int %19 2 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %textureNumLayers_ff5e89 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLayers_ff5e89 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %37 = OpLabel + %38 = OpFunctionCall %void %textureNumLayers_ff5e89 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7b51b4b46 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureNumLayers_ff5e89() { + var res : i32 = textureNumLayers(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLayers_ff5e89(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLayers_ff5e89(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLayers_ff5e89(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl new file mode 100644 index 0000000000..adec74f718 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; + +// fn textureNumLevels(texture: texture_depth_cube) -> i32 +fn textureNumLevels_076cb5() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_076cb5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_076cb5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_076cb5(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7688db98ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_076cb5() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_076cb5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_076cb5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_076cb5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7688db98ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_076cb5() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_076cb5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_076cb5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_076cb5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl new file mode 100644 index 0000000000..6b93674f9d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_076cb5() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_076cb5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureNumLevels_076cb5() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_076cb5(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_076cb5() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_076cb5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl new file mode 100644 index 0000000000..db09bf4245 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_076cb5(depthcube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_2) { + textureNumLevels_076cb5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_076cb5(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_076cb5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b36c1990d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_076cb5 "textureNumLevels_076cb5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_076cb5 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_076cb5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_076cb5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_076cb5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl new file mode 100644 index 0000000000..0470c75a13 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +fn textureNumLevels_076cb5() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_076cb5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_076cb5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_076cb5(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl new file mode 100644 index 0000000000..8ef73a7441 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureNumLevels(texture: texture_cube) -> i32 +fn textureNumLevels_080d95() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_080d95(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_080d95(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_080d95(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..633e7beb77 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_080d95() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_080d95(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_080d95(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_080d95(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..633e7beb77 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_080d95() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_080d95(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_080d95(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_080d95(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl new file mode 100644 index 0000000000..367bb7a01b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureNumLevels_080d95() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_080d95(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCube arg_0_1; +void textureNumLevels_080d95() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_080d95(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCube arg_0_1; +void textureNumLevels_080d95() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_080d95(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl new file mode 100644 index 0000000000..c592ea2124 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_080d95(texturecube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureNumLevels_080d95(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_080d95(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_080d95(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm new file mode 100644 index 0000000000..bcbd3c7cc8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_080d95 "textureNumLevels_080d95" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_080d95 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_080d95 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_080d95 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_080d95 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6f058f938 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureNumLevels_080d95() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_080d95(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_080d95(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_080d95(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl new file mode 100644 index 0000000000..f9f4d80135 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureNumLevels(texture: texture_2d) -> i32 +fn textureNumLevels_09ddd0() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_09ddd0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_09ddd0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_09ddd0(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fa2c6733dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_09ddd0() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_09ddd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_09ddd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_09ddd0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa2c6733dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_09ddd0() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_09ddd0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_09ddd0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_09ddd0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl new file mode 100644 index 0000000000..0691d9b2ee --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureNumLevels_09ddd0() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_09ddd0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler2D arg_0_1; +void textureNumLevels_09ddd0() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_09ddd0(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler2D arg_0_1; +void textureNumLevels_09ddd0() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_09ddd0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl new file mode 100644 index 0000000000..43e490484c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_09ddd0(texture2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureNumLevels_09ddd0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_09ddd0(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_09ddd0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm new file mode 100644 index 0000000000..13e73f59b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_09ddd0 "textureNumLevels_09ddd0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_09ddd0 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_09ddd0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_09ddd0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_09ddd0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cebcabb0a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureNumLevels_09ddd0() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_09ddd0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_09ddd0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_09ddd0(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl new file mode 100644 index 0000000000..61e6a3fa83 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLevels(texture: texture_2d_array) -> i32 +fn textureNumLevels_105988() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_105988(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_105988(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_105988(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..608355f226 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_105988() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_105988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_105988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_105988(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..608355f226 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_105988() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_105988(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_105988(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_105988(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl new file mode 100644 index 0000000000..90e28da994 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_105988() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_105988(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_105988() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_105988(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_105988() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_105988(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl new file mode 100644 index 0000000000..c27305e4e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_105988(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLevels_105988(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_105988(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_105988(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd629e8a9b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_105988 "textureNumLevels_105988" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_105988 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_105988 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_105988 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_105988 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl new file mode 100644 index 0000000000..8eb140d658 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLevels_105988() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_105988(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_105988(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_105988(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl new file mode 100644 index 0000000000..ae28bc695b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureNumLevels(texture: texture_1d) -> i32 +fn textureNumLevels_1e6f3b() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_1e6f3b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_1e6f3b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_1e6f3b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..938309a8d8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_1e6f3b() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_1e6f3b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_1e6f3b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_1e6f3b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..938309a8d8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_1e6f3b() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_1e6f3b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_1e6f3b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_1e6f3b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl new file mode 100644 index 0000000000..50f6f13cbd --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureNumLevels_1e6f3b() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_1e6f3b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler1D arg_0_1; +void textureNumLevels_1e6f3b() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_1e6f3b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler1D arg_0_1; +void textureNumLevels_1e6f3b() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_1e6f3b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl new file mode 100644 index 0000000000..00356f0669 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_1e6f3b(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureNumLevels_1e6f3b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_1e6f3b(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_1e6f3b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm new file mode 100644 index 0000000000..80c21ead09 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_1e6f3b "textureNumLevels_1e6f3b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_1e6f3b = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_1e6f3b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_1e6f3b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_1e6f3b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl new file mode 100644 index 0000000000..58a28d75d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureNumLevels_1e6f3b() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_1e6f3b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_1e6f3b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_1e6f3b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl new file mode 100644 index 0000000000..046b0a8fd9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureNumLevels(texture: texture_2d) -> i32 +fn textureNumLevels_23f750() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_23f750(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_23f750(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_23f750(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..230c77c842 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_23f750() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_23f750(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_23f750(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_23f750(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..230c77c842 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_23f750() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_23f750(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_23f750(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_23f750(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl new file mode 100644 index 0000000000..8b964989fe --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureNumLevels_23f750() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_23f750(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler2D arg_0_1; +void textureNumLevels_23f750() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_23f750(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler2D arg_0_1; +void textureNumLevels_23f750() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_23f750(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl new file mode 100644 index 0000000000..571d0a45f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_23f750(texture2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureNumLevels_23f750(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_23f750(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_23f750(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm new file mode 100644 index 0000000000..8dd3517e52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_23f750 "textureNumLevels_23f750" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_23f750 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_23f750 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_23f750 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_23f750 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ce13f7362 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureNumLevels_23f750() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_23f750(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_23f750(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_23f750(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl new file mode 100644 index 0000000000..98cf2c6b58 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; + +// fn textureNumLevels(texture: texture_depth_cube_array) -> i32 +fn textureNumLevels_2c3575() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_2c3575(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_2c3575(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_2c3575(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..969b67aee9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_2c3575() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_2c3575(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_2c3575(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_2c3575(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..969b67aee9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_2c3575() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_2c3575(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_2c3575(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_2c3575(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl new file mode 100644 index 0000000000..2de59fc0b0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_2c3575() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_2c3575(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_2c3575() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_2c3575(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_2c3575() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_2c3575(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl new file mode 100644 index 0000000000..8f7ed02625 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_2c3575(depthcube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_2) { + textureNumLevels_2c3575(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_2c3575(tint_symbol_4); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_2c3575(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef03d8acf1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_2c3575 "textureNumLevels_2c3575" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_2c3575 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_2c3575 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_2c3575 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_2c3575 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e019602ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +fn textureNumLevels_2c3575() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_2c3575(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_2c3575(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_2c3575(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl new file mode 100644 index 0000000000..9773aa4069 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureNumLevels(texture: texture_1d) -> i32 +fn textureNumLevels_32a0ae() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_32a0ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_32a0ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_32a0ae(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8caa7566e4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_32a0ae() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_32a0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_32a0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_32a0ae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8caa7566e4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_32a0ae() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_32a0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_32a0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_32a0ae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl new file mode 100644 index 0000000000..b0cdc31466 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureNumLevels_32a0ae() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_32a0ae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler1D arg_0_1; +void textureNumLevels_32a0ae() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_32a0ae(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler1D arg_0_1; +void textureNumLevels_32a0ae() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_32a0ae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl new file mode 100644 index 0000000000..11c0362e19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_32a0ae(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureNumLevels_32a0ae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_32a0ae(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_32a0ae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm new file mode 100644 index 0000000000..283d160c19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_32a0ae "textureNumLevels_32a0ae" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_32a0ae = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_32a0ae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_32a0ae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_32a0ae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl new file mode 100644 index 0000000000..13377ce7a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureNumLevels_32a0ae() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_32a0ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_32a0ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_32a0ae(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl new file mode 100644 index 0000000000..d92d07fe01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLevels(texture: texture_2d_array) -> i32 +fn textureNumLevels_5101cf() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_5101cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_5101cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_5101cf(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f6385792ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_5101cf() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_5101cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_5101cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_5101cf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6385792ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_5101cf() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_5101cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_5101cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_5101cf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl new file mode 100644 index 0000000000..e372765680 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLevels_5101cf() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_5101cf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler2DArray arg_0_1; +void textureNumLevels_5101cf() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_5101cf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler2DArray arg_0_1; +void textureNumLevels_5101cf() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_5101cf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl new file mode 100644 index 0000000000..4a17faabec --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_5101cf(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLevels_5101cf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_5101cf(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_5101cf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..321f409e45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_5101cf "textureNumLevels_5101cf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_5101cf = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_5101cf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_5101cf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_5101cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..3425bb26c2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLevels_5101cf() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_5101cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_5101cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_5101cf(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl new file mode 100644 index 0000000000..ec4aa990fe --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; + +// fn textureNumLevels(texture: texture_1d) -> i32 +fn textureNumLevels_51b5bb() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_51b5bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_51b5bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_51b5bb(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e41c4df7b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_51b5bb() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_51b5bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_51b5bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_51b5bb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e41c4df7b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture1D arg_0 : register(t0, space1); + +void textureNumLevels_51b5bb() { + int2 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y); + int res = tint_tmp.y; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_51b5bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_51b5bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_51b5bb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl new file mode 100644 index 0000000000..8969352a69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureNumLevels_51b5bb() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_51b5bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_1; +void textureNumLevels_51b5bb() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_51b5bb(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler1D arg_0_1; +void textureNumLevels_51b5bb() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_51b5bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'sampler1D' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl new file mode 100644 index 0000000000..7acc809df7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_51b5bb(texture1d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureNumLevels_51b5bb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_51b5bb(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_51b5bb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fa2c76d10 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_51b5bb "textureNumLevels_51b5bb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_51b5bb = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_51b5bb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_51b5bb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_51b5bb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..71883b0571 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +fn textureNumLevels_51b5bb() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_51b5bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_51b5bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_51b5bb(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl new file mode 100644 index 0000000000..5c1e1a3145 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureNumLevels(texture: texture_cube) -> i32 +fn textureNumLevels_897aaf() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_897aaf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_897aaf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_897aaf(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1dc79b11bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_897aaf() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_897aaf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_897aaf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_897aaf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1dc79b11bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_897aaf() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_897aaf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_897aaf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_897aaf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl new file mode 100644 index 0000000000..f7d707ee4d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_897aaf() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_897aaf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_1; +void textureNumLevels_897aaf() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_897aaf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCube arg_0_1; +void textureNumLevels_897aaf() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_897aaf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl new file mode 100644 index 0000000000..5f6ffc4d3b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_897aaf(texturecube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureNumLevels_897aaf(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_897aaf(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_897aaf(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm new file mode 100644 index 0000000000..2daa6e87cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_897aaf "textureNumLevels_897aaf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_897aaf = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_897aaf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_897aaf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_897aaf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl new file mode 100644 index 0000000000..473da66aa6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureNumLevels_897aaf() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_897aaf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_897aaf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_897aaf(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl new file mode 100644 index 0000000000..a297fa01a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureNumLevels(texture: texture_3d) -> i32 +fn textureNumLevels_9da7a5() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_9da7a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_9da7a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_9da7a5(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..621c54766b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_9da7a5() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_9da7a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_9da7a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_9da7a5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..621c54766b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_9da7a5() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_9da7a5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_9da7a5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_9da7a5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl new file mode 100644 index 0000000000..83706c6e71 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureNumLevels_9da7a5() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_9da7a5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler3D arg_0_1; +void textureNumLevels_9da7a5() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_9da7a5(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler3D arg_0_1; +void textureNumLevels_9da7a5() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_9da7a5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl new file mode 100644 index 0000000000..f813901183 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_9da7a5(texture3d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureNumLevels_9da7a5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_9da7a5(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_9da7a5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm new file mode 100644 index 0000000000..522fe6852c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_9da7a5 "textureNumLevels_9da7a5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_9da7a5 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_9da7a5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_9da7a5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_9da7a5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl new file mode 100644 index 0000000000..13135d5d47 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureNumLevels_9da7a5() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_9da7a5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_9da7a5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_9da7a5(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl new file mode 100644 index 0000000000..2d2b3e911c --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLevels(texture: texture_cube_array) -> i32 +fn textureNumLevels_a91c03() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_a91c03(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_a91c03(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_a91c03(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..97c379dd7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_a91c03() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_a91c03(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_a91c03(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_a91c03(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..97c379dd7f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_a91c03() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_a91c03(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_a91c03(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_a91c03(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl new file mode 100644 index 0000000000..684bc1b610 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLevels_a91c03() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_a91c03(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLevels_a91c03() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_a91c03(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'isamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isamplerCubeArray arg_0_1; +void textureNumLevels_a91c03() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_a91c03(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'isamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl new file mode 100644 index 0000000000..4a151f0637 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_a91c03(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLevels_a91c03(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_a91c03(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_a91c03(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba04989996 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_a91c03 "textureNumLevels_a91c03" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_a91c03 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_a91c03 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_a91c03 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_a91c03 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl new file mode 100644 index 0000000000..69e569b387 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLevels_a91c03() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_a91c03(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_a91c03(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_a91c03(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl new file mode 100644 index 0000000000..3f14e55f41 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLevels(texture: texture_cube_array) -> i32 +fn textureNumLevels_aee7c8() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_aee7c8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_aee7c8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_aee7c8(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6511a2d27a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_aee7c8() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_aee7c8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_aee7c8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_aee7c8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6511a2d27a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_aee7c8() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_aee7c8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_aee7c8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_aee7c8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl new file mode 100644 index 0000000000..6fbe7623ba --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_aee7c8() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_aee7c8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_aee7c8() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_aee7c8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_1; +void textureNumLevels_aee7c8() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_aee7c8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl new file mode 100644 index 0000000000..a4627cd1b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_aee7c8(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLevels_aee7c8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_aee7c8(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_aee7c8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm new file mode 100644 index 0000000000..d5f9d13cbe --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_aee7c8 "textureNumLevels_aee7c8" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_aee7c8 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_aee7c8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_aee7c8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_aee7c8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl new file mode 100644 index 0000000000..a9336a0aa8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLevels_aee7c8() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_aee7c8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_aee7c8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_aee7c8(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl new file mode 100644 index 0000000000..9f8cbc5956 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; + +// fn textureNumLevels(texture: texture_depth_2d) -> i32 +fn textureNumLevels_b1b12b() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b1b12b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_b1b12b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_b1b12b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd908dca1e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_b1b12b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b1b12b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b1b12b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b1b12b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd908dca1e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_b1b12b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b1b12b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b1b12b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b1b12b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl new file mode 100644 index 0000000000..2a2119a2ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_b1b12b() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_b1b12b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureNumLevels_b1b12b() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_b1b12b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_b1b12b() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_b1b12b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl new file mode 100644 index 0000000000..cdda66a9a0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_b1b12b(depth2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_2) { + textureNumLevels_b1b12b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_b1b12b(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_b1b12b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcd4a668db --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_b1b12b "textureNumLevels_b1b12b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_b1b12b = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_b1b12b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_b1b12b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_b1b12b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl new file mode 100644 index 0000000000..cfb7e4b78d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +fn textureNumLevels_b1b12b() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b1b12b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_b1b12b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_b1b12b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl new file mode 100644 index 0000000000..978bbde2c2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureNumLevels(texture: texture_3d) -> i32 +fn textureNumLevels_b4f5ea() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b4f5ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_b4f5ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_b4f5ea(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..92162ad12d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_b4f5ea() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b4f5ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b4f5ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b4f5ea(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..92162ad12d --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_b4f5ea() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_b4f5ea(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_b4f5ea(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_b4f5ea(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl new file mode 100644 index 0000000000..a857a8aa29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureNumLevels_b4f5ea() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_b4f5ea(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler3D arg_0_1; +void textureNumLevels_b4f5ea() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_b4f5ea(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler3D arg_0_1; +void textureNumLevels_b4f5ea() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_b4f5ea(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl new file mode 100644 index 0000000000..8c251ea96b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_b4f5ea(texture3d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureNumLevels_b4f5ea(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_b4f5ea(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_b4f5ea(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm new file mode 100644 index 0000000000..6508bca3b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_b4f5ea "textureNumLevels_b4f5ea" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_b4f5ea = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_b4f5ea + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_b4f5ea + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_b4f5ea + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1f829abd8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureNumLevels_b4f5ea() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_b4f5ea(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_b4f5ea(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_b4f5ea(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl new file mode 100644 index 0000000000..17c58e11bc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; + +// fn textureNumLevels(texture: texture_2d_array) -> i32 +fn textureNumLevels_d004a9() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_d004a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_d004a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_d004a9(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..34731d5b4e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_d004a9() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_d004a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_d004a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_d004a9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..34731d5b4e --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_d004a9() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_d004a9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_d004a9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_d004a9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl new file mode 100644 index 0000000000..926ded3ccb --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLevels_d004a9() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_d004a9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler2DArray arg_0_1; +void textureNumLevels_d004a9() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_d004a9(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler2DArray arg_0_1; +void textureNumLevels_d004a9() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_d004a9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl new file mode 100644 index 0000000000..d0d19fe935 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_d004a9(texture2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureNumLevels_d004a9(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_d004a9(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_d004a9(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm new file mode 100644 index 0000000000..48fe3de1f7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_d004a9 "textureNumLevels_d004a9" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_d004a9 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_d004a9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_d004a9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_d004a9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl new file mode 100644 index 0000000000..ce8d24dc31 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +fn textureNumLevels_d004a9() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_d004a9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_d004a9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_d004a9(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl new file mode 100644 index 0000000000..e7b032c171 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; + +// fn textureNumLevels(texture: texture_3d) -> i32 +fn textureNumLevels_dca09e() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_dca09e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_dca09e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_dca09e(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..01307a423f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_dca09e() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_dca09e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_dca09e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_dca09e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01307a423f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture3D arg_0 : register(t0, space1); + +void textureNumLevels_dca09e() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_dca09e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_dca09e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_dca09e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl new file mode 100644 index 0000000000..ba0c815048 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureNumLevels_dca09e() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_dca09e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_1; +void textureNumLevels_dca09e() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_dca09e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler3D arg_0_1; +void textureNumLevels_dca09e() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_dca09e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl new file mode 100644 index 0000000000..e7813c56e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_dca09e(texture3d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureNumLevels_dca09e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_dca09e(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_dca09e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ee917e064 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_dca09e "textureNumLevels_dca09e" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_dca09e = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_dca09e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_dca09e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_dca09e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl new file mode 100644 index 0000000000..d5e1e54ad9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +fn textureNumLevels_dca09e() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_dca09e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_dca09e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_dca09e(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl new file mode 100644 index 0000000000..bfec4352b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; + +// fn textureNumLevels(texture: texture_2d) -> i32 +fn textureNumLevels_e67231() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_e67231(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_e67231(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_e67231(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6f8a6f769 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_e67231() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_e67231(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_e67231(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_e67231(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6f8a6f769 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2D arg_0 : register(t0, space1); + +void textureNumLevels_e67231() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_e67231(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_e67231(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_e67231(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl new file mode 100644 index 0000000000..5345038ff9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_e67231() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_e67231(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_1; +void textureNumLevels_e67231() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_e67231(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2D arg_0_1; +void textureNumLevels_e67231() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_e67231(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl new file mode 100644 index 0000000000..0a9f1ef9b3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_e67231(texture2d tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureNumLevels_e67231(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureNumLevels_e67231(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureNumLevels_e67231(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm new file mode 100644 index 0000000000..f2974bb0da --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_e67231 "textureNumLevels_e67231" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_e67231 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_e67231 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_e67231 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_e67231 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl new file mode 100644 index 0000000000..a42349da60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +fn textureNumLevels_e67231() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_e67231(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_e67231(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_e67231(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl new file mode 100644 index 0000000000..9ad4dca600 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; + +// fn textureNumLevels(texture: texture_cube) -> i32 +fn textureNumLevels_ed078b() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_ed078b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_ed078b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_ed078b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..75d40ead62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_ed078b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_ed078b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_ed078b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_ed078b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..75d40ead62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCube arg_0 : register(t0, space1); + +void textureNumLevels_ed078b() { + int3 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_ed078b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_ed078b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_ed078b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl new file mode 100644 index 0000000000..3293d1e204 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureNumLevels_ed078b() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_ed078b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCube arg_0_1; +void textureNumLevels_ed078b() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_ed078b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCube arg_0_1; +void textureNumLevels_ed078b() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_ed078b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl new file mode 100644 index 0000000000..74d65639d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_ed078b(texturecube tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_2) { + textureNumLevels_ed078b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_4 [[texture(0)]]) { + textureNumLevels_ed078b(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube tint_symbol_5 [[texture(0)]]) { + textureNumLevels_ed078b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm new file mode 100644 index 0000000000..78cf1434c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_ed078b "textureNumLevels_ed078b" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_ed078b = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_ed078b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_ed078b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_ed078b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl new file mode 100644 index 0000000000..3a951308d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +fn textureNumLevels_ed078b() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_ed078b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_ed078b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_ed078b(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl new file mode 100644 index 0000000000..f32f53fc1f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; + +// fn textureNumLevels(texture: texture_cube_array) -> i32 +fn textureNumLevels_f46ec6() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f46ec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_f46ec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_f46ec6(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3a16309ca7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_f46ec6() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f46ec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f46ec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f46ec6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3a16309ca7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +TextureCubeArray arg_0 : register(t0, space1); + +void textureNumLevels_f46ec6() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f46ec6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f46ec6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f46ec6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl new file mode 100644 index 0000000000..1da3a81ad4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl @@ -0,0 +1,75 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLevels_f46ec6() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_f46ec6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLevels_f46ec6() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_f46ec6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'usamplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usamplerCubeArray arg_0_1; +void textureNumLevels_f46ec6() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_f46ec6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'usamplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl new file mode 100644 index 0000000000..83873b6123 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_f46ec6(texturecube_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_2) { + textureNumLevels_f46ec6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_f46ec6(tint_symbol_4); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_f46ec6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm new file mode 100644 index 0000000000..7650c289bc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_f46ec6 "textureNumLevels_f46ec6" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_f46ec6 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQueryLevels %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumLevels_f46ec6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumLevels_f46ec6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumLevels_f46ec6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1621389be --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +fn textureNumLevels_f46ec6() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f46ec6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_f46ec6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_f46ec6(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl new file mode 100644 index 0000000000..009134e59b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; + +// fn textureNumLevels(texture: texture_depth_2d_array) -> i32 +fn textureNumLevels_f5828d() { + var res: i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f5828d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_f5828d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_f5828d(); +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..05d604d60a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_f5828d() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f5828d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f5828d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f5828d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..05d604d60a --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DArray arg_0 : register(t0, space1); + +void textureNumLevels_f5828d() { + int4 tint_tmp; + arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w); + int res = tint_tmp.w; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumLevels_f5828d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumLevels_f5828d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumLevels_f5828d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl new file mode 100644 index 0000000000..e810a1a552 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_f5828d() { + int res = textureQueryLevels(arg_0_1); +} + +vec4 vertex_main() { + textureNumLevels_f5828d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_f5828d() { + int res = textureQueryLevels(arg_0_1); +} + +void fragment_main() { + textureNumLevels_f5828d(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArray arg_0_1; +void textureNumLevels_f5828d() { + int res = textureQueryLevels(arg_0_1); +} + +void compute_main() { + textureNumLevels_f5828d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl new file mode 100644 index 0000000000..0a150257cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumLevels_f5828d(depth2d_array tint_symbol_1) { + int res = int(tint_symbol_1.get_num_mip_levels()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_2) { + textureNumLevels_f5828d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_4 [[texture(0)]]) { + textureNumLevels_f5828d(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_5 [[texture(0)]]) { + textureNumLevels_f5828d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm new file mode 100644 index 0000000000..6af2f4a3f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumLevels_f5828d "textureNumLevels_f5828d" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumLevels_f5828d = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQueryLevels %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumLevels_f5828d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumLevels_f5828d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumLevels_f5828d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl new file mode 100644 index 0000000000..02fdd80212 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +fn textureNumLevels_f5828d() { + var res : i32 = textureNumLevels(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumLevels_f5828d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumLevels_f5828d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumLevels_f5828d(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl new file mode 100644 index 0000000000..208dec8ee9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 +fn textureNumSamples_2c6f14() { + var res: i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_2c6f14(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_2c6f14(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_2c6f14(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6c3feafdaa --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_2c6f14() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_2c6f14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_2c6f14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_2c6f14(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6c3feafdaa --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_2c6f14() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_2c6f14(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_2c6f14(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_2c6f14(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl new file mode 100644 index 0000000000..5abe128e4b --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_2c6f14() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_2c6f14(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_2c6f14() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_2c6f14(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_2c6f14() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_2c6f14(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl new file mode 100644 index 0000000000..b062129875 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_2c6f14(texture2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureNumSamples_2c6f14(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_2c6f14(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_2c6f14(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1b55e4d73 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumSamples_2c6f14 "textureNumSamples_2c6f14" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumSamples_2c6f14 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySamples %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumSamples_2c6f14 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumSamples_2c6f14 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumSamples_2c6f14 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl new file mode 100644 index 0000000000..460b4e22b3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureNumSamples_2c6f14() { + var res : i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_2c6f14(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_2c6f14(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_2c6f14(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl new file mode 100644 index 0000000000..a308412674 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 +fn textureNumSamples_42f8bb() { + var res: i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_42f8bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_42f8bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_42f8bb(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..415abda1e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_42f8bb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_42f8bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_42f8bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_42f8bb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..415abda1e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_42f8bb() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_42f8bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_42f8bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_42f8bb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl new file mode 100644 index 0000000000..8a06334bf4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureNumSamples_42f8bb() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_42f8bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp usampler2DMS arg_0_1; +void textureNumSamples_42f8bb() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_42f8bb(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp usampler2DMS arg_0_1; +void textureNumSamples_42f8bb() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_42f8bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl new file mode 100644 index 0000000000..d951a7eee8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_42f8bb(texture2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureNumSamples_42f8bb(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_42f8bb(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_42f8bb(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm new file mode 100644 index 0000000000..a8b65046e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumSamples_42f8bb "textureNumSamples_42f8bb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumSamples_42f8bb = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %22 + %19 = OpLoad %11 %arg_0 + %17 = OpImageQuerySamples %int %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %textureNumSamples_42f8bb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %32 = OpLabel + %33 = OpFunctionCall %void %textureNumSamples_42f8bb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %void %textureNumSamples_42f8bb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..e62f047750 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureNumSamples_42f8bb() { + var res : i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_42f8bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_42f8bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_42f8bb(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl new file mode 100644 index 0000000000..9680606acf --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_multisampled_2d; + +// fn textureNumSamples(texture: texture_multisampled_2d) -> i32 +fn textureNumSamples_449d23() { + var res: i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_449d23(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_449d23(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_449d23(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4dbf2f0a56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_449d23() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_449d23(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_449d23(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_449d23(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4dbf2f0a56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_449d23() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_449d23(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_449d23(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_449d23(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl new file mode 100644 index 0000000000..2b60dd51be --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureNumSamples_449d23() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_449d23(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp isampler2DMS arg_0_1; +void textureNumSamples_449d23() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_449d23(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp isampler2DMS arg_0_1; +void textureNumSamples_449d23() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_449d23(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl new file mode 100644 index 0000000000..18e0ad7500 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_449d23(texture2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_ms tint_symbol_2) { + textureNumSamples_449d23(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_449d23(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_449d23(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm new file mode 100644 index 0000000000..f89f9018a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumSamples_449d23 "textureNumSamples_449d23" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumSamples_449d23 = OpFunction %void None %13 + %16 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %17 = OpImageQuerySamples %int %18 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumSamples_449d23 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumSamples_449d23 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumSamples_449d23 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c9fd1f110 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_multisampled_2d; + +fn textureNumSamples_449d23() { + var res : i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_449d23(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_449d23(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_449d23(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl new file mode 100644 index 0000000000..bddc529888 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d; + +// fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32 +fn textureNumSamples_a3c8a0() { + var res: i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_a3c8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_a3c8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_a3c8a0(); +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0eb375a965 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_a3c8a0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_a3c8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_a3c8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_a3c8a0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0eb375a965 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +Texture2DMS arg_0 : register(t0, space1); + +void textureNumSamples_a3c8a0() { + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + int res = tint_tmp.z; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureNumSamples_a3c8a0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureNumSamples_a3c8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureNumSamples_a3c8a0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl new file mode 100644 index 0000000000..826c680985 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_a3c8a0() { + int res = textureSamples(arg_0_1); +} + +vec4 vertex_main() { + textureNumSamples_a3c8a0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_a3c8a0() { + int res = textureSamples(arg_0_1); +} + +void fragment_main() { + textureNumSamples_a3c8a0(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:6: 'textureSamples' : no matching overloaded function found +ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int' +ERROR: 0:6: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DMS arg_0_1; +void textureNumSamples_a3c8a0() { + int res = textureSamples(arg_0_1); +} + +void compute_main() { + textureNumSamples_a3c8a0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:5: 'textureSamples' : no matching overloaded function found +ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int' +ERROR: 0:5: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl new file mode 100644 index 0000000000..c3db04e5e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void textureNumSamples_a3c8a0(depth2d_ms tint_symbol_1) { + int res = int(tint_symbol_1.get_num_samples()); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_ms tint_symbol_2) { + textureNumSamples_a3c8a0(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_ms tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_ms tint_symbol_4 [[texture(0)]]) { + textureNumSamples_a3c8a0(tint_symbol_4); + return; +} + +kernel void compute_main(depth2d_ms tint_symbol_5 [[texture(0)]]) { + textureNumSamples_a3c8a0(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6f64b190f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureNumSamples_a3c8a0 "textureNumSamples_a3c8a0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureNumSamples_a3c8a0 = OpFunction %void None %12 + %15 = OpLabel + %res = OpVariable %_ptr_Function_int Function %21 + %18 = OpLoad %11 %arg_0 + %16 = OpImageQuerySamples %int %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %textureNumSamples_a3c8a0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %void %textureNumSamples_a3c8a0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %34 = OpLabel + %35 = OpFunctionCall %void %textureNumSamples_a3c8a0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl new file mode 100644 index 0000000000..c78e10135f --- /dev/null +++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d; + +fn textureNumSamples_a3c8a0() { + var res : i32 = textureNumSamples(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureNumSamples_a3c8a0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureNumSamples_a3c8a0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureNumSamples_a3c8a0(); +} diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl new file mode 100644 index 0000000000..2a66afeda9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> f32 +fn textureSample_0dff6c() { + var arg_2 = vec2(); + var res: f32 = textureSample(arg_0, arg_1, arg_2, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_0dff6c(); +} diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4bd60c002c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_0dff6c() { + float2 arg_2 = (0.0f).xx; + float res = arg_0.Sample(arg_1, arg_2, (0).xx).x; +} + +void fragment_main() { + textureSample_0dff6c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bd60c002c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_0dff6c() { + float2 arg_2 = (0.0f).xx; + float res = arg_0.Sample(arg_1, arg_2, (0).xx).x; +} + +void fragment_main() { + textureSample_0dff6c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl new file mode 100644 index 0000000000..29464a04c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSample_0dff6c() { + vec2 arg_2 = vec2(0.0f); + float res = textureOffset(arg_0_arg_1, vec3(arg_2, 0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_0dff6c(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl new file mode 100644 index 0000000000..b6fd4869d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_0dff6c(depth2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float res = tint_symbol.sample(tint_symbol_1, arg_2, int2(0)); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_0dff6c(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm new file mode 100644 index 0000000000..d548219a96 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_0dff6c "textureSample_0dff6c" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 + %21 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %26 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%textureSample_0dff6c = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %res = OpVariable %_ptr_Function_float Function %29 + OpStore %arg_2 %13 + %19 = OpLoad %7 %arg_1 + %20 = OpLoad %3 %arg_0 + %22 = OpSampledImage %21 %20 %19 + %23 = OpLoad %v2float %arg_2 + %17 = OpImageSampleImplicitLod %v4float %22 %23 ConstOffset %26 + %16 = OpCompositeExtract %float %17 0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %31 = OpLabel + %32 = OpFunctionCall %void %textureSample_0dff6c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl new file mode 100644 index 0000000000..699d1c5f97 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_0dff6c() { + var arg_2 = vec2(); + var res : f32 = textureSample(arg_0, arg_1, arg_2, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_0dff6c(); +} diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl new file mode 100644 index 0000000000..d0e4bf55b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> vec4 +fn textureSample_17e988() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: vec4 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_17e988(); +} diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..87521f1266 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_17e988() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3)), (0).xx); +} + +void fragment_main() { + textureSample_17e988(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87521f1266 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_17e988() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3)), (0).xx); +} + +void fragment_main() { + textureSample_17e988(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl new file mode 100644 index 0000000000..95e45f8579 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSample_17e988() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = textureOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), ivec2(0)); +} + +void fragment_main() { + textureSample_17e988(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl new file mode 100644 index 0000000000..19433ebed8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_17e988(texture2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, int2(0)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_17e988(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm new file mode 100644 index 0000000000..4bb6bba355 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_17e988 "textureSample_17e988" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %25 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %35 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpConstantNull %v4float +%textureSample_17e988 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4float Function %38 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %23 = OpLoad %7 %arg_1 + %24 = OpLoad %3 %arg_0 + %26 = OpSampledImage %25 %24 %23 + %28 = OpLoad %v2float %arg_2 + %29 = OpCompositeExtract %float %28 0 + %30 = OpCompositeExtract %float %28 1 + %32 = OpLoad %int %arg_3 + %31 = OpConvertSToF %float %32 + %33 = OpCompositeConstruct %v3float %29 %30 %31 + %21 = OpImageSampleImplicitLod %v4float %26 %33 ConstOffset %35 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSample_17e988 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b022a5afe --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_17e988() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : vec4 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_17e988(); +} diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl new file mode 100644 index 0000000000..b2ccbf47ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3, @const offset: vec3) -> vec4 +fn textureSample_2149ec() { + var arg_2 = vec3(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2, vec3()); +} + +@fragment +fn fragment_main() { + textureSample_2149ec(); +} diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1528b90d0a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_2149ec() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Sample(arg_1, arg_2, (0).xxx); +} + +void fragment_main() { + textureSample_2149ec(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1528b90d0a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_2149ec() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Sample(arg_1, arg_2, (0).xxx); +} + +void fragment_main() { + textureSample_2149ec(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl new file mode 100644 index 0000000000..67fde956fb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSample_2149ec() { + vec3 arg_2 = vec3(0.0f); + vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec3(0)); +} + +void fragment_main() { + textureSample_2149ec(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl new file mode 100644 index 0000000000..96ab51e48c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_2149ec(texture3d tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, int3(0)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_2149ec(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e435b94be --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_2149ec "textureSample_2149ec" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %25 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpConstantNull %v4float +%textureSample_2149ec = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %28 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v3float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 ConstOffset %25 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %30 = OpLabel + %31 = OpFunctionCall %void %textureSample_2149ec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d3f05dd4c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_2149ec() { + var arg_2 = vec3(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2, vec3()); +} + +@fragment +fn fragment_main() { + textureSample_2149ec(); +} diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl new file mode 100644 index 0000000000..201d5e4c16 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2) -> f32 +fn textureSample_38bbb9() { + var arg_2 = vec2(); + var res: f32 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_38bbb9(); +} diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ffedf8fcf9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_38bbb9() { + float2 arg_2 = (0.0f).xx; + float res = arg_0.Sample(arg_1, arg_2).x; +} + +void fragment_main() { + textureSample_38bbb9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ffedf8fcf9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_38bbb9() { + float2 arg_2 = (0.0f).xx; + float res = arg_0.Sample(arg_1, arg_2).x; +} + +void fragment_main() { + textureSample_38bbb9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl new file mode 100644 index 0000000000..31f10fa0b5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSample_38bbb9() { + vec2 arg_2 = vec2(0.0f); + float res = texture(arg_0_arg_1, vec3(arg_2, 0.0f)); +} + +void fragment_main() { + textureSample_38bbb9(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl new file mode 100644 index 0000000000..6482503766 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_38bbb9(depth2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_38bbb9(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm new file mode 100644 index 0000000000..05511e90da --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_38bbb9 "textureSample_38bbb9" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 + %21 = OpTypeSampledImage %3 +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%textureSample_38bbb9 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %res = OpVariable %_ptr_Function_float Function %26 + OpStore %arg_2 %13 + %19 = OpLoad %7 %arg_1 + %20 = OpLoad %3 %arg_0 + %22 = OpSampledImage %21 %20 %19 + %23 = OpLoad %v2float %arg_2 + %17 = OpImageSampleImplicitLod %v4float %22 %23 + %16 = OpCompositeExtract %float %17 0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSample_38bbb9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d6c9d10d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_38bbb9() { + var arg_2 = vec2(); + var res : f32 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_38bbb9(); +} diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl new file mode 100644 index 0000000000..c833f38936 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_3d, sampler: sampler, coords: vec3) -> vec4 +fn textureSample_3b50bd() { + var arg_2 = vec3(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_3b50bd(); +} diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..29a54eaca8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_3b50bd() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_3b50bd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..29a54eaca8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_3b50bd() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_3b50bd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl new file mode 100644 index 0000000000..1f936b41ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSample_3b50bd() { + vec3 arg_2 = vec3(0.0f); + vec4 res = texture(arg_0_arg_1, arg_2); +} + +void fragment_main() { + textureSample_3b50bd(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl new file mode 100644 index 0000000000..0bf2684644 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_3b50bd(texture3d tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_3b50bd(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm new file mode 100644 index 0000000000..2539dd1b7b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_3b50bd "textureSample_3b50bd" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_3b50bd = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %25 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v3float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_3b50bd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl new file mode 100644 index 0000000000..77b2588d34 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_3b50bd() { + var arg_2 = vec3(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_3b50bd(); +} diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl new file mode 100644 index 0000000000..d8bc994140 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> vec4 +fn textureSample_4dd1bf() { + var arg_2 = vec3(); + var arg_3 = 1; + var res: vec4 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSample_4dd1bf(); +} diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c779be1509 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_4dd1bf() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float4 res = arg_0.Sample(arg_1, float4(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_4dd1bf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c779be1509 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_4dd1bf() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float4 res = arg_0.Sample(arg_1, float4(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_4dd1bf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl new file mode 100644 index 0000000000..8d39802d54 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl @@ -0,0 +1,28 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSample_4dd1bf() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec4 res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_4dd1bf(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl new file mode 100644 index 0000000000..89cfd572c0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_4dd1bf(texturecube_array tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(texturecube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_4dd1bf(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..131c440b7a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_4dd1bf "textureSample_4dd1bf" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %25 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpConstantNull %v4float +%textureSample_4dd1bf = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4float Function %36 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %23 = OpLoad %7 %arg_1 + %24 = OpLoad %3 %arg_0 + %26 = OpSampledImage %25 %24 %23 + %27 = OpLoad %v3float %arg_2 + %28 = OpCompositeExtract %float %27 0 + %29 = OpCompositeExtract %float %27 1 + %30 = OpCompositeExtract %float %27 2 + %32 = OpLoad %int %arg_3 + %31 = OpConvertSToF %float %32 + %33 = OpCompositeConstruct %v4float %28 %29 %30 %31 + %21 = OpImageSampleImplicitLod %v4float %26 %33 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %38 = OpLabel + %39 = OpFunctionCall %void %textureSample_4dd1bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..a496a7c957 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_4dd1bf() { + var arg_2 = vec3(); + var arg_3 = 1; + var res : vec4 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSample_4dd1bf(); +} diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl new file mode 100644 index 0000000000..9d0ec56b2a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2) -> vec4 +fn textureSample_51b514() { + var arg_2 = vec2(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_51b514(); +} diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32dce227fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_51b514() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_51b514(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32dce227fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_51b514() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_51b514(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl new file mode 100644 index 0000000000..ab891bc901 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSample_51b514() { + vec2 arg_2 = vec2(0.0f); + vec4 res = texture(arg_0_arg_1, arg_2); +} + +void fragment_main() { + textureSample_51b514(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl new file mode 100644 index 0000000000..bffded98a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_51b514(texture2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_51b514(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe14ef4fd0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_51b514 "textureSample_51b514" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_51b514 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %25 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v2float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_51b514 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl new file mode 100644 index 0000000000..23f0f360a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_51b514() { + var arg_2 = vec2(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_51b514(); +} diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl new file mode 100644 index 0000000000..1f7a43d651 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, @const offset: vec2) -> f32 +fn textureSample_60bf45() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: f32 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_60bf45(); +} diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a9339e032 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_60bf45() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3)), (0).xx).x; +} + +void fragment_main() { + textureSample_60bf45(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a9339e032 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_60bf45() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3)), (0).xx).x; +} + +void fragment_main() { + textureSample_60bf45(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl new file mode 100644 index 0000000000..bd4eaf2087 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl @@ -0,0 +1,28 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSample_60bf45() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), ivec2(0)); +} + +void fragment_main() { + textureSample_60bf45(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl new file mode 100644 index 0000000000..b822a47af9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_60bf45(depth2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, int2(0)); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_60bf45(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm new file mode 100644 index 0000000000..efd63d2aec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_60bf45 "textureSample_60bf45" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %26 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %36 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %39 = OpConstantNull %float +%textureSample_60bf45 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_float Function %39 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %24 = OpLoad %7 %arg_1 + %25 = OpLoad %3 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %29 = OpLoad %v2float %arg_2 + %30 = OpCompositeExtract %float %29 0 + %31 = OpCompositeExtract %float %29 1 + %33 = OpLoad %int %arg_3 + %32 = OpConvertSToF %float %33 + %34 = OpCompositeConstruct %v3float %30 %31 %32 + %22 = OpImageSampleImplicitLod %v4float %27 %34 ConstOffset %36 + %21 = OpCompositeExtract %float %22 0 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %41 = OpLabel + %42 = OpFunctionCall %void %textureSample_60bf45 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl new file mode 100644 index 0000000000..b8950b61e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_60bf45() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : f32 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_60bf45(); +} diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl new file mode 100644 index 0000000000..8a73b9f889 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> vec4 +fn textureSample_6717ca() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: vec4 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSample_6717ca(); +} diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..01c97bce1e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_6717ca() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_6717ca(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01c97bce1e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_6717ca() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float4 res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_6717ca(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl new file mode 100644 index 0000000000..d8cdc14fcb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSample_6717ca() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec4 res = texture(arg_0_arg_1, vec3(arg_2, float(arg_3))); +} + +void fragment_main() { + textureSample_6717ca(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl new file mode 100644 index 0000000000..e512ecabd3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_6717ca(texture2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_6717ca(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fd8ccf870 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_6717ca "textureSample_6717ca" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %25 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpConstantNull %v4float +%textureSample_6717ca = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_v4float Function %36 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %23 = OpLoad %7 %arg_1 + %24 = OpLoad %3 %arg_0 + %26 = OpSampledImage %25 %24 %23 + %28 = OpLoad %v2float %arg_2 + %29 = OpCompositeExtract %float %28 0 + %30 = OpCompositeExtract %float %28 1 + %32 = OpLoad %int %arg_3 + %31 = OpConvertSToF %float %32 + %33 = OpCompositeConstruct %v3float %29 %30 %31 + %21 = OpImageSampleImplicitLod %v4float %26 %33 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %38 = OpLabel + %39 = OpFunctionCall %void %textureSample_6717ca + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl new file mode 100644 index 0000000000..e9a77815c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_6717ca() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : vec4 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSample_6717ca(); +} diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl new file mode 100644 index 0000000000..ced9dcba0b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_1d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_1d, sampler: sampler, coords: f32) -> vec4 +fn textureSample_6e64fb() { + var arg_2 = 1.f; + var res: vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_6e64fb(); +} diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e62e87512f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +Texture1D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_6e64fb() { + float arg_2 = 1.0f; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_6e64fb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e62e87512f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +Texture1D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_6e64fb() { + float arg_2 = 1.0f; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_6e64fb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl new file mode 100644 index 0000000000..15771c5c9a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl @@ -0,0 +1,27 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler1D arg_0_arg_1; + +void textureSample_6e64fb() { + float arg_2 = 1.0f; + vec4 res = texture(arg_0_arg_1, arg_2); +} + +void fragment_main() { + textureSample_6e64fb(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'sampler1D' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl new file mode 100644 index 0000000000..3a9b0a5412 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_6e64fb(texture1d tint_symbol, sampler tint_symbol_1) { + float arg_2 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(texture1d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_6e64fb(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm new file mode 100644 index 0000000000..be90026493 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_6e64fb "textureSample_6e64fb" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_6e64fb = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_float Function %15 + %res = OpVariable %_ptr_Function_v4float Function %25 + OpStore %arg_2 %float_1 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_6e64fb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc576c3a13 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_1d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_6e64fb() { + var arg_2 = 1.0f; + var res : vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_6e64fb(); +} diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl new file mode 100644 index 0000000000..45dce87df4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32) -> f32 +fn textureSample_7e9ffd() { + var arg_2 = vec2(); + var arg_3 = 1; + var res: f32 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSample_7e9ffd(); +} diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..88b7a82131 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_7e9ffd() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3))).x; +} + +void fragment_main() { + textureSample_7e9ffd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..88b7a82131 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_7e9ffd() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3))).x; +} + +void fragment_main() { + textureSample_7e9ffd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl new file mode 100644 index 0000000000..1f79b36b87 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSample_7e9ffd() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f)); +} + +void fragment_main() { + textureSample_7e9ffd(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl new file mode 100644 index 0000000000..9a296765b6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_7e9ffd(depth2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_7e9ffd(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm new file mode 100644 index 0000000000..76ef866554 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_7e9ffd "textureSample_7e9ffd" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %26 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 +%_ptr_Function_float = OpTypePointer Function %float + %37 = OpConstantNull %float +%textureSample_7e9ffd = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_float Function %37 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %24 = OpLoad %7 %arg_1 + %25 = OpLoad %3 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %29 = OpLoad %v2float %arg_2 + %30 = OpCompositeExtract %float %29 0 + %31 = OpCompositeExtract %float %29 1 + %33 = OpLoad %int %arg_3 + %32 = OpConvertSToF %float %33 + %34 = OpCompositeConstruct %v3float %30 %31 %32 + %22 = OpImageSampleImplicitLod %v4float %27 %34 + %21 = OpCompositeExtract %float %22 0 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %textureSample_7e9ffd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl new file mode 100644 index 0000000000..87713db128 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_7e9ffd() { + var arg_2 = vec2(); + var arg_3 = 1; + var res : f32 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSample_7e9ffd(); +} diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl new file mode 100644 index 0000000000..2741ab99a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_2d, sampler: sampler, coords: vec2, @const offset: vec2) -> vec4 +fn textureSample_85c4ba() { + var arg_2 = vec2(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_85c4ba(); +} diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d96272b6b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_85c4ba() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Sample(arg_1, arg_2, (0).xx); +} + +void fragment_main() { + textureSample_85c4ba(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d96272b6b2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_85c4ba() { + float2 arg_2 = (0.0f).xx; + float4 res = arg_0.Sample(arg_1, arg_2, (0).xx); +} + +void fragment_main() { + textureSample_85c4ba(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl new file mode 100644 index 0000000000..7ec1594d48 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSample_85c4ba() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec2(0)); +} + +void fragment_main() { + textureSample_85c4ba(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl new file mode 100644 index 0000000000..16f9ef677f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_85c4ba(texture2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, int2(0)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_85c4ba(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..96546ebf61 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_85c4ba "textureSample_85c4ba" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %25 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpConstantNull %v4float +%textureSample_85c4ba = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %28 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v2float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 ConstOffset %25 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %30 = OpLabel + %31 = OpFunctionCall %void %textureSample_85c4ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..2694416b58 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_85c4ba() { + var arg_2 = vec2(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2, vec2()); +} + +@fragment +fn fragment_main() { + textureSample_85c4ba(); +} diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl new file mode 100644 index 0000000000..d4ca75fc9b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32) -> f32 +fn textureSample_c2f4e8() { + var arg_2 = vec3(); + var arg_3 = 1; + var res: f32 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSample_c2f4e8(); +} diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..209b7d33cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_c2f4e8() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float res = arg_0.Sample(arg_1, float4(arg_2, float(arg_3))).x; +} + +void fragment_main() { + textureSample_c2f4e8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..209b7d33cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_c2f4e8() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float res = arg_0.Sample(arg_1, float4(arg_2, float(arg_3))).x; +} + +void fragment_main() { + textureSample_c2f4e8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl new file mode 100644 index 0000000000..31ee71fd05 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl @@ -0,0 +1,28 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSample_c2f4e8() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0f); +} + +void fragment_main() { + textureSample_c2f4e8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl new file mode 100644 index 0000000000..0a8ee57c20 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSample_c2f4e8(depthcube_array tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(depthcube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_c2f4e8(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm new file mode 100644 index 0000000000..357c5ffeed --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_c2f4e8 "textureSample_c2f4e8" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4float = OpTypeVector %float 4 + %26 = OpTypeSampledImage %3 +%_ptr_Function_float = OpTypePointer Function %float + %37 = OpConstantNull %float +%textureSample_c2f4e8 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %res = OpVariable %_ptr_Function_float Function %37 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + %24 = OpLoad %7 %arg_1 + %25 = OpLoad %3 %arg_0 + %27 = OpSampledImage %26 %25 %24 + %28 = OpLoad %v3float %arg_2 + %29 = OpCompositeExtract %float %28 0 + %30 = OpCompositeExtract %float %28 1 + %31 = OpCompositeExtract %float %28 2 + %33 = OpLoad %int %arg_3 + %32 = OpConvertSToF %float %33 + %34 = OpCompositeConstruct %v4float %29 %30 %31 %32 + %22 = OpImageSampleImplicitLod %v4float %27 %34 + %21 = OpCompositeExtract %float %22 0 + OpStore %res %21 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %textureSample_c2f4e8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..4698069191 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_c2f4e8() { + var arg_2 = vec3(); + var arg_3 = 1; + var res : f32 = textureSample(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSample_c2f4e8(); +} diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl new file mode 100644 index 0000000000..bff2b62eeb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_cube, sampler: sampler, coords: vec3) -> vec4 +fn textureSample_e53267() { + var arg_2 = vec3(); + var res: vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_e53267(); +} diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..171df8aec5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_e53267() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_e53267(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..171df8aec5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_e53267() { + float3 arg_2 = (0.0f).xxx; + float4 res = arg_0.Sample(arg_1, arg_2); +} + +void fragment_main() { + textureSample_e53267(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl new file mode 100644 index 0000000000..7bfc11afec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSample_e53267() { + vec3 arg_2 = vec3(0.0f); + vec4 res = texture(arg_0_arg_1, arg_2); +} + +void fragment_main() { + textureSample_e53267(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl new file mode 100644 index 0000000000..f6987dafa7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_e53267(texturecube tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float4 res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(texturecube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_e53267(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm new file mode 100644 index 0000000000..7a35d91fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_e53267 "textureSample_e53267" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %20 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpConstantNull %v4float +%textureSample_e53267 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %res = OpVariable %_ptr_Function_v4float Function %25 + OpStore %arg_2 %13 + %18 = OpLoad %7 %arg_1 + %19 = OpLoad %3 %arg_0 + %21 = OpSampledImage %20 %19 %18 + %22 = OpLoad %v3float %arg_2 + %16 = OpImageSampleImplicitLod %v4float %21 %22 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpFunctionCall %void %textureSample_e53267 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl new file mode 100644 index 0000000000..457d7c76f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_e53267() { + var arg_2 = vec3(); + var res : vec4 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_e53267(); +} diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl new file mode 100644 index 0000000000..5d28850d94 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl @@ -0,0 +1,35 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3) -> f32 +fn textureSample_ea7030() { + var arg_2 = vec3(); + var res: f32 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_ea7030(); +} diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..35bbed727f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_ea7030() { + float3 arg_2 = (0.0f).xxx; + float res = arg_0.Sample(arg_1, arg_2).x; +} + +void fragment_main() { + textureSample_ea7030(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..35bbed727f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSample_ea7030() { + float3 arg_2 = (0.0f).xxx; + float res = arg_0.Sample(arg_1, arg_2).x; +} + +void fragment_main() { + textureSample_ea7030(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl new file mode 100644 index 0000000000..5658098169 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSample_ea7030() { + vec3 arg_2 = vec3(0.0f); + float res = texture(arg_0_arg_1, vec4(arg_2, 0.0f)); +} + +void fragment_main() { + textureSample_ea7030(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl new file mode 100644 index 0000000000..daefdff15f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void textureSample_ea7030(depthcube tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float res = tint_symbol.sample(tint_symbol_1, arg_2); +} + +fragment void fragment_main(depthcube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSample_ea7030(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm new file mode 100644 index 0000000000..b7bf9af197 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSample_ea7030 "textureSample_ea7030" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 + %21 = OpTypeSampledImage %3 +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%textureSample_ea7030 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %res = OpVariable %_ptr_Function_float Function %26 + OpStore %arg_2 %13 + %19 = OpLoad %7 %arg_1 + %20 = OpLoad %3 %arg_0 + %22 = OpSampledImage %21 %20 %19 + %23 = OpLoad %v3float %arg_2 + %17 = OpImageSampleImplicitLod %v4float %22 %23 + %16 = OpCompositeExtract %float %17 0 + OpStore %res %16 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %28 = OpLabel + %29 = OpFunctionCall %void %textureSample_ea7030 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl new file mode 100644 index 0000000000..db6574c48d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl @@ -0,0 +1,13 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSample_ea7030() { + var arg_2 = vec3(); + var res : f32 = textureSample(arg_0, arg_1, arg_2); +} + +@fragment +fn fragment_main() { + textureSample_ea7030(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl new file mode 100644 index 0000000000..56dd499e50 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_cube, sampler: sampler, coords: vec3, bias: f32) -> vec4 +fn textureSampleBias_53b9f7() { + var arg_2 = vec3(); + var arg_3 = 1.f; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleBias_53b9f7(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6fd71337d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_53b9f7() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_53b9f7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6fd71337d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_53b9f7() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_53b9f7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl new file mode 100644 index 0000000000..26298693d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleBias_53b9f7() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = texture(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_53b9f7(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl new file mode 100644 index 0000000000..c9ed71a013 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_53b9f7(texturecube tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3)); +} + +fragment void fragment_main(texturecube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_53b9f7(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm new file mode 100644 index 0000000000..58add6655c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_53b9f7 "textureSampleBias_53b9f7" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpConstantNull %v4float +%textureSampleBias_53b9f7 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %30 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v3float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias %27 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %32 = OpLabel + %33 = OpFunctionCall %void %textureSampleBias_53b9f7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl new file mode 100644 index 0000000000..b3ca71df60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_53b9f7() { + var arg_2 = vec3(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleBias_53b9f7(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl new file mode 100644 index 0000000000..6eacca7ab8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32, @const offset: vec3) -> vec4 +fn textureSampleBias_594824() { + var arg_2 = vec3(); + var arg_3 = 1.f; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec3()); +} + +@fragment +fn fragment_main() { + textureSampleBias_594824(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fa703bc6ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_594824() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (0).xxx); +} + +void fragment_main() { + textureSampleBias_594824(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa703bc6ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_594824() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (0).xxx); +} + +void fragment_main() { + textureSampleBias_594824(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl new file mode 100644 index 0000000000..86b3985586 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleBias_594824() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec3(0), arg_3); +} + +void fragment_main() { + textureSampleBias_594824(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl new file mode 100644 index 0000000000..b1579e031f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_594824(texture3d tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3), int3(0)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_594824(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm new file mode 100644 index 0000000000..2360528652 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_594824 "textureSampleBias_594824" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %30 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpConstantNull %v4float +%textureSampleBias_594824 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %33 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v3float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias|ConstOffset %27 %30 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %35 = OpLabel + %36 = OpFunctionCall %void %textureSampleBias_594824 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl new file mode 100644 index 0000000000..cca18b9853 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_594824() { + var arg_2 = vec3(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec3()); +} + +@fragment +fn fragment_main() { + textureSampleBias_594824(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl new file mode 100644 index 0000000000..b142eff36f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32) -> vec4 +fn textureSampleBias_6a9113() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleBias_6a9113(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95c453b6eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_6a9113() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_6a9113(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95c453b6eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_6a9113() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_6a9113(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl new file mode 100644 index 0000000000..4ff6ea8165 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleBias_6a9113() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = texture(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_6a9113(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl new file mode 100644 index 0000000000..a60a0d69a6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_6a9113(texture2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_6a9113(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm new file mode 100644 index 0000000000..75ae173e65 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_6a9113 "textureSampleBias_6a9113" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpConstantNull %v4float +%textureSampleBias_6a9113 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %30 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v2float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias %27 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %32 = OpLabel + %33 = OpFunctionCall %void %textureSampleBias_6a9113 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl new file mode 100644 index 0000000000..119bbcac37 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_6a9113() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleBias_6a9113(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl new file mode 100644 index 0000000000..f3281a1560 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32) -> vec4 +fn textureSampleBias_80e579() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@fragment +fn fragment_main() { + textureSampleBias_80e579(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..27ee32dc62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_80e579() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_80e579(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..27ee32dc62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_80e579() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_80e579(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl new file mode 100644 index 0000000000..4b8b55e655 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleBias_80e579() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = texture(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_80e579(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl new file mode 100644 index 0000000000..310f5493d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleBias_80e579(texture2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, bias(arg_4)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_80e579(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm new file mode 100644 index 0000000000..2afe0dfba7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_80e579 "textureSampleBias_80e579" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %29 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %41 = OpConstantNull %v4float +%textureSampleBias_80e579 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_v4float Function %41 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %27 = OpLoad %7 %arg_1 + %28 = OpLoad %3 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %32 = OpLoad %v2float %arg_2 + %33 = OpCompositeExtract %float %32 0 + %34 = OpCompositeExtract %float %32 1 + %36 = OpLoad %int %arg_3 + %35 = OpConvertSToF %float %36 + %37 = OpCompositeConstruct %v3float %33 %34 %35 + %38 = OpLoad %float %arg_4 + %25 = OpImageSampleImplicitLod %v4float %30 %37 Bias %38 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleBias_80e579 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl new file mode 100644 index 0000000000..98cecfb304 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_80e579() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@fragment +fn fragment_main() { + textureSampleBias_80e579(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl new file mode 100644 index 0000000000..ffb36ec25b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, bias: f32, @const offset: vec2) -> vec4 +fn textureSampleBias_9dbb51() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleBias_9dbb51(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83ce4b85a5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_9dbb51() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +void fragment_main() { + textureSampleBias_9dbb51(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83ce4b85a5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_9dbb51() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +void fragment_main() { + textureSampleBias_9dbb51(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl new file mode 100644 index 0000000000..fcb897f30c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleBias_9dbb51() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), ivec2(0), arg_4); +} + +void fragment_main() { + textureSampleBias_9dbb51(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl new file mode 100644 index 0000000000..811369d09f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleBias_9dbb51(texture2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, bias(arg_4), int2(0)); +} + +fragment void fragment_main(texture2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_9dbb51(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm new file mode 100644 index 0000000000..bca222ed22 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_9dbb51 "textureSampleBias_9dbb51" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %29 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %40 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %43 = OpConstantNull %v4float +%textureSampleBias_9dbb51 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_v4float Function %43 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %27 = OpLoad %7 %arg_1 + %28 = OpLoad %3 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %32 = OpLoad %v2float %arg_2 + %33 = OpCompositeExtract %float %32 0 + %34 = OpCompositeExtract %float %32 1 + %36 = OpLoad %int %arg_3 + %35 = OpConvertSToF %float %36 + %37 = OpCompositeConstruct %v3float %33 %34 %35 + %38 = OpLoad %float %arg_4 + %25 = OpImageSampleImplicitLod %v4float %30 %37 Bias|ConstOffset %38 %40 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %45 = OpLabel + %46 = OpFunctionCall %void %textureSampleBias_9dbb51 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl new file mode 100644 index 0000000000..63b803833e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_9dbb51() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleBias_9dbb51(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl new file mode 100644 index 0000000000..05ab472eb8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_2d, sampler: sampler, coords: vec2, bias: f32, @const offset: vec2) -> vec4 +fn textureSampleBias_a161cf() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleBias_a161cf(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..89d28fcd69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_a161cf() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (0).xx); +} + +void fragment_main() { + textureSampleBias_a161cf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..89d28fcd69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_a161cf() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (0).xx); +} + +void fragment_main() { + textureSampleBias_a161cf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl new file mode 100644 index 0000000000..fc23dd4b28 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleBias_a161cf() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec2(0), arg_3); +} + +void fragment_main() { + textureSampleBias_a161cf(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl new file mode 100644 index 0000000000..26145c4757 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_a161cf(texture2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3), int2(0)); +} + +fragment void fragment_main(texture2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_a161cf(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4513e6aed --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_a161cf "textureSampleBias_a161cf" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %30 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %33 = OpConstantNull %v4float +%textureSampleBias_a161cf = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %33 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v2float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias|ConstOffset %27 %30 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %35 = OpLabel + %36 = OpFunctionCall %void %textureSampleBias_a161cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..45096c0840 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_a161cf() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleBias_a161cf(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl new file mode 100644 index 0000000000..b8624599b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_3d, sampler: sampler, coords: vec3, bias: f32) -> vec4 +fn textureSampleBias_d3fa1b() { + var arg_2 = vec3(); + var arg_3 = 1.f; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleBias_d3fa1b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..653f13e9c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_d3fa1b() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_d3fa1b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..653f13e9c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_d3fa1b() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_d3fa1b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl new file mode 100644 index 0000000000..19f7ed419d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleBias_d3fa1b() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = texture(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleBias_d3fa1b(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl new file mode 100644 index 0000000000..d0ca622a21 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleBias_d3fa1b(texture3d tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3)); +} + +fragment void fragment_main(texture3d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_d3fa1b(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm new file mode 100644 index 0000000000..efaf6083b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_d3fa1b "textureSampleBias_d3fa1b" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %24 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %30 = OpConstantNull %v4float +%textureSampleBias_d3fa1b = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_v4float Function %30 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %22 = OpLoad %7 %arg_1 + %23 = OpLoad %3 %arg_0 + %25 = OpSampledImage %24 %23 %22 + %26 = OpLoad %v3float %arg_2 + %27 = OpLoad %float %arg_3 + %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias %27 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %32 = OpLabel + %33 = OpFunctionCall %void %textureSampleBias_d3fa1b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl new file mode 100644 index 0000000000..c7a52318d0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_d3fa1b() { + var arg_2 = vec3(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleBias_d3fa1b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl new file mode 100644 index 0000000000..0816267a42 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleBias(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, bias: f32) -> vec4 +fn textureSampleBias_eed7c4() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@fragment +fn fragment_main() { + textureSampleBias_eed7c4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c225b0104 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_eed7c4() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_eed7c4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4c225b0104 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleBias_eed7c4() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleBias(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_eed7c4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl new file mode 100644 index 0000000000..e26885390c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl @@ -0,0 +1,29 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleBias_eed7c4() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleBias_eed7c4(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl new file mode 100644 index 0000000000..5017e44af1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleBias_eed7c4(texturecube_array tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, bias(arg_4)); +} + +fragment void fragment_main(texturecube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleBias_eed7c4(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm new file mode 100644 index 0000000000..82c77fb665 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleBias_eed7c4 "textureSampleBias_eed7c4" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %v4float = OpTypeVector %float 4 + %29 = OpTypeSampledImage %3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %41 = OpConstantNull %v4float +%textureSampleBias_eed7c4 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_v4float Function %41 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %27 = OpLoad %7 %arg_1 + %28 = OpLoad %3 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %34 = OpCompositeExtract %float %31 2 + %36 = OpLoad %int %arg_3 + %35 = OpConvertSToF %float %36 + %37 = OpCompositeConstruct %v4float %32 %33 %34 %35 + %38 = OpLoad %float %arg_4 + %25 = OpImageSampleImplicitLod %v4float %30 %37 Bias %38 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleBias_eed7c4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl new file mode 100644 index 0000000000..1098aca538 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleBias_eed7c4() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : vec4 = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@fragment +fn fragment_main() { + textureSampleBias_eed7c4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl new file mode 100644 index 0000000000..e10e5036ee --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 +fn textureSampleCompare_3a5923() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleCompare_3a5923(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3bc8810b56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_3a5923() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmp(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleCompare_3a5923(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3bc8810b56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_3a5923() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmp(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleCompare_3a5923(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl new file mode 100644 index 0000000000..3de47a5e46 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompare_3a5923() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec3(arg_2, arg_3)); +} + +void fragment_main() { + textureSampleCompare_3a5923(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl new file mode 100644 index 0000000000..a4ccb01b8f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleCompare_3a5923(depth2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_3a5923(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8f13d0c93 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_3a5923 "textureSampleCompare_3a5923" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %23 = OpTypeSampledImage %3 +%textureSampleCompare_3a5923 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_float Function %19 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %21 = OpLoad %7 %arg_1 + %22 = OpLoad %3 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %25 = OpLoad %v2float %arg_2 + %26 = OpLoad %float %arg_3 + %20 = OpImageSampleDrefImplicitLod %float %24 %25 %26 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %29 = OpLabel + %30 = OpFunctionCall %void %textureSampleCompare_3a5923 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl new file mode 100644 index 0000000000..9afca36f34 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_3a5923() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleCompare_3a5923(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl new file mode 100644 index 0000000000..02fe640cba --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 +fn textureSampleCompare_63fb83() { + var arg_2 = vec3(); + var arg_3 = 1.f; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleCompare_63fb83(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..01de180398 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_63fb83() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmp(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleCompare_63fb83(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01de180398 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_63fb83() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmp(arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleCompare_63fb83(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl new file mode 100644 index 0000000000..d83c925b15 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompare_63fb83() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, arg_3)); +} + +void fragment_main() { + textureSampleCompare_63fb83(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl new file mode 100644 index 0000000000..826159e5bc --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleCompare_63fb83(depthcube tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3); +} + +fragment void fragment_main(depthcube tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_63fb83(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm new file mode 100644 index 0000000000..dde09fdc78 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_63fb83 "textureSampleCompare_63fb83" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %23 = OpTypeSampledImage %3 +%textureSampleCompare_63fb83 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_float Function %19 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %21 = OpLoad %7 %arg_1 + %22 = OpLoad %3 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %25 = OpLoad %v3float %arg_2 + %26 = OpLoad %float %arg_3 + %20 = OpImageSampleDrefImplicitLod %float %24 %25 %26 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %29 = OpLabel + %30 = OpFunctionCall %void %textureSampleCompare_63fb83 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl new file mode 100644 index 0000000000..b52c5900a3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_63fb83() { + var arg_2 = vec3(); + var arg_3 = 1.0f; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3); +} + +@fragment +fn fragment_main() { + textureSampleCompare_63fb83(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl new file mode 100644 index 0000000000..59f967f0b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompare_a3ca7e() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@fragment +fn fragment_main() { + textureSampleCompare_a3ca7e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..06ac88bc5c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_a3ca7e() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmp(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompare_a3ca7e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..06ac88bc5c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_a3ca7e() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmp(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompare_a3ca7e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl new file mode 100644 index 0000000000..f822276b23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl @@ -0,0 +1,29 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompare_a3ca7e() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompare_a3ca7e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl new file mode 100644 index 0000000000..884983e782 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleCompare_a3ca7e(depthcube_array tint_symbol, sampler tint_symbol_1) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4); +} + +fragment void fragment_main(depthcube_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_a3ca7e(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm new file mode 100644 index 0000000000..8438b3e9d4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_a3ca7e "textureSampleCompare_a3ca7e" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %13 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %28 = OpTypeSampledImage %3 + %v4float = OpTypeVector %float 4 +%textureSampleCompare_a3ca7e = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_float Function %24 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %26 = OpLoad %7 %arg_1 + %27 = OpLoad %3 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %31 = OpLoad %v3float %arg_2 + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %34 = OpCompositeExtract %float %31 2 + %36 = OpLoad %int %arg_3 + %35 = OpConvertSToF %float %36 + %37 = OpCompositeConstruct %v4float %32 %33 %34 %35 + %38 = OpLoad %float %arg_4 + %25 = OpImageSampleDrefImplicitLod %float %29 %37 %38 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %41 = OpLabel + %42 = OpFunctionCall %void %textureSampleCompare_a3ca7e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd14a37ff0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_a3ca7e() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@fragment +fn fragment_main() { + textureSampleCompare_a3ca7e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl new file mode 100644 index 0000000000..09f20fa920 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompare_af1051() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleCompare_af1051(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad6956408e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_af1051() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +void fragment_main() { + textureSampleCompare_af1051(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad6956408e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_af1051() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +void fragment_main() { + textureSampleCompare_af1051(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl new file mode 100644 index 0000000000..3633f07d0e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl @@ -0,0 +1,29 @@ +SKIP: FAILED + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompare_af1051() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0)); +} + +void fragment_main() { + textureSampleCompare_af1051(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:10: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:10: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl new file mode 100644 index 0000000000..e241a74c0e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleCompare_af1051(depth2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4, int2(0)); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_af1051(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm new file mode 100644 index 0000000000..290d5fef51 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_af1051 "textureSampleCompare_af1051" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %28 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %39 = OpConstantNull %v2int +%textureSampleCompare_af1051 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_float Function %24 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %26 = OpLoad %7 %arg_1 + %27 = OpLoad %3 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %31 = OpLoad %v2float %arg_2 + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %36 = OpCompositeConstruct %v3float %32 %33 %34 + %37 = OpLoad %float %arg_4 + %25 = OpImageSampleDrefImplicitLod %float %29 %36 %37 ConstOffset %39 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %42 = OpLabel + %43 = OpFunctionCall %void %textureSampleCompare_af1051 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c6081668f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_af1051() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleCompare_af1051(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl new file mode 100644 index 0000000000..98a899c5cb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl @@ -0,0 +1,37 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompare_dd431d() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@fragment +fn fragment_main() { + textureSampleCompare_dd431d(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aed9ea373a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dd431d() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompare_dd431d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aed9ea373a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dd431d() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompare_dd431d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl new file mode 100644 index 0000000000..edba551a2b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompare_dd431d() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4)); +} + +void fragment_main() { + textureSampleCompare_dd431d(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl new file mode 100644 index 0000000000..525ba3b182 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +void textureSampleCompare_dd431d(depth2d_array tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4); +} + +fragment void fragment_main(depth2d_array tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_dd431d(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5fb4fc841 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_dd431d "textureSampleCompare_dd431d" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %28 = OpTypeSampledImage %3 + %v3float = OpTypeVector %float 3 +%textureSampleCompare_dd431d = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_int Function %20 + %arg_4 = OpVariable %_ptr_Function_float Function %24 + %res = OpVariable %_ptr_Function_float Function %24 + OpStore %arg_2 %13 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %26 = OpLoad %7 %arg_1 + %27 = OpLoad %3 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %31 = OpLoad %v2float %arg_2 + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %36 = OpCompositeConstruct %v3float %32 %33 %34 + %37 = OpLoad %float %arg_4 + %25 = OpImageSampleDrefImplicitLod %float %29 %36 %37 + OpStore %res %25 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleCompare_dd431d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl new file mode 100644 index 0000000000..e952b174a8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl @@ -0,0 +1,15 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_dd431d() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@fragment +fn fragment_main() { + textureSampleCompare_dd431d(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl new file mode 100644 index 0000000000..e7afea8163 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl @@ -0,0 +1,36 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompare_dec064() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleCompare_dec064(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21bf5e0222 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dec064() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmp(arg_1, arg_2, arg_3, (0).xx); +} + +void fragment_main() { + textureSampleCompare_dec064(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21bf5e0222 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompare_dec064() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmp(arg_1, arg_2, arg_3, (0).xx); +} + +void fragment_main() { + textureSampleCompare_dec064(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl new file mode 100644 index 0000000000..8adb0eeeda --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompare_dec064() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0)); +} + +void fragment_main() { + textureSampleCompare_dec064(); +} + +void main() { + fragment_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl new file mode 100644 index 0000000000..c22e9dd8ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void textureSampleCompare_dec064(depth2d tint_symbol, sampler tint_symbol_1) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, int2(0)); +} + +fragment void fragment_main(depth2d tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) { + textureSampleCompare_dec064(tint_symbol_2, tint_symbol_3); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm new file mode 100644 index 0000000000..6e55366615 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragment_main "fragment_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompare_dec064 "textureSampleCompare_dec064" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %fragment_main "fragment_main" + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeSampler +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %13 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %23 = OpTypeSampledImage %3 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %29 = OpConstantNull %v2int +%textureSampleCompare_dec064 = OpFunction %void None %8 + %11 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %13 + %arg_3 = OpVariable %_ptr_Function_float Function %19 + %res = OpVariable %_ptr_Function_float Function %19 + OpStore %arg_2 %13 + OpStore %arg_3 %float_1 + %21 = OpLoad %7 %arg_1 + %22 = OpLoad %3 %arg_0 + %24 = OpSampledImage %23 %22 %21 + %25 = OpLoad %v2float %arg_2 + %26 = OpLoad %float %arg_3 + %20 = OpImageSampleDrefImplicitLod %float %24 %25 %26 ConstOffset %29 + OpStore %res %20 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %8 + %32 = OpLabel + %33 = OpFunctionCall %void %textureSampleCompare_dec064 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl new file mode 100644 index 0000000000..ccf80c9b9d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompare_dec064() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@fragment +fn fragment_main() { + textureSampleCompare_dec064(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl new file mode 100644 index 0000000000..60f55ecf09 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_1116ed() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1116ed(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_1116ed(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1116ed(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dfdafaafad --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1116ed() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1116ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1116ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1116ed(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dfdafaafad --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1116ed() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1116ed(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1116ed(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1116ed(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl new file mode 100644 index 0000000000..c5a1359557 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_1116ed() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_1116ed(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_1116ed() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4)); +} + +void fragment_main() { + textureSampleCompareLevel_1116ed(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_1116ed() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4)); +} + +void compute_main() { + textureSampleCompareLevel_1116ed(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl new file mode 100644 index 0000000000..f4bf8844b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_1116ed(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, arg_4, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_1116ed(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_1116ed(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_1116ed(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb2da605d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_1116ed "textureSampleCompareLevel_1116ed" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %46 = OpTypeFunction %v4float +%textureSampleCompareLevel_1116ed = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleDrefExplicitLod %float %35 %42 %43 Lod %float_0 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleCompareLevel_1116ed + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureSampleCompareLevel_1116ed + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleCompareLevel_1116ed + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl new file mode 100644 index 0000000000..c8886981a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_1116ed() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1116ed(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_1116ed(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1116ed(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl new file mode 100644 index 0000000000..500b566c9f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_1568e3() { + var arg_2 = vec3(); + var arg_3 = 1.f; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1568e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_1568e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1568e3(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a0b30fbcff --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1568e3() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1568e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1568e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1568e3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a0b30fbcff --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_1568e3() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_1568e3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_1568e3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_1568e3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl new file mode 100644 index 0000000000..d877ce43e2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompareLevel_1568e3() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, arg_3)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_1568e3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompareLevel_1568e3() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, arg_3)); +} + +void fragment_main() { + textureSampleCompareLevel_1568e3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleCompareLevel_1568e3() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, arg_3)); +} + +void compute_main() { + textureSampleCompareLevel_1568e3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl new file mode 100644 index 0000000000..410b28c70d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_1568e3(depthcube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_1568e3(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_1568e3(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_1568e3(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm new file mode 100644 index 0000000000..b0d97d3bec --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_1568e3 "textureSampleCompareLevel_1568e3" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %35 = OpTypeFunction %v4float +%textureSampleCompareLevel_1568e3 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleDrefExplicitLod %float %30 %31 %32 Lod %float_0 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleCompareLevel_1568e3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleCompareLevel_1568e3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleCompareLevel_1568e3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl new file mode 100644 index 0000000000..db2ba7c57f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_1568e3() { + var arg_2 = vec3(); + var arg_3 = 1.0f; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_1568e3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_1568e3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_1568e3(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl new file mode 100644 index 0000000000..5b0bda1092 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_2ad2b1() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_2ad2b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_2ad2b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_2ad2b1(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c47f096ba8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_2ad2b1() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_2ad2b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c47f096ba8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_2ad2b1() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_2ad2b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_2ad2b1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl new file mode 100644 index 0000000000..fb730f0af0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_2ad2b1() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec3(arg_2, arg_3)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_2ad2b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_2ad2b1() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec3(arg_2, arg_3)); +} + +void fragment_main() { + textureSampleCompareLevel_2ad2b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_2ad2b1() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = texture(arg_0_arg_1, vec3(arg_2, arg_3)); +} + +void compute_main() { + textureSampleCompareLevel_2ad2b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl new file mode 100644 index 0000000000..fb1f7ca9d8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_2ad2b1(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_2ad2b1(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_2ad2b1(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_2ad2b1(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm new file mode 100644 index 0000000000..58b009040d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_2ad2b1 "textureSampleCompareLevel_2ad2b1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %35 = OpTypeFunction %v4float +%textureSampleCompareLevel_2ad2b1 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleDrefExplicitLod %float %30 %31 %32 Lod %float_0 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleCompareLevel_2ad2b1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleCompareLevel_2ad2b1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleCompareLevel_2ad2b1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..698fe146de --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_2ad2b1() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_2ad2b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_2ad2b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_2ad2b1(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl new file mode 100644 index 0000000000..c1f64a89c2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3, array_index: i32, depth_ref: f32) -> f32 +fn textureSampleCompareLevel_4cf3a2() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_4cf3a2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_4cf3a2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_4cf3a2(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7910d95baa --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_4cf3a2() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_4cf3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7910d95baa --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_4cf3a2() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_4cf3a2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_4cf3a2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl new file mode 100644 index 0000000000..dbec8ba1ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_4cf3a2() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureSampleCompareLevel_4cf3a2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_4cf3a2() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleCompareLevel_4cf3a2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_4cf3a2() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureSampleCompareLevel_4cf3a2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl new file mode 100644 index 0000000000..0378014821 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_4cf3a2(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, arg_4, level(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_4cf3a2(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_4cf3a2(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_4cf3a2(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5a685673b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_4cf3a2 "textureSampleCompareLevel_4cf3a2" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %46 = OpTypeFunction %v4float +%textureSampleCompareLevel_4cf3a2 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %36 = OpLoad %v3float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %39 = OpCompositeExtract %float %36 2 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v4float %37 %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleDrefExplicitLod %float %35 %42 %43 Lod %float_0 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleCompareLevel_4cf3a2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureSampleCompareLevel_4cf3a2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleCompareLevel_4cf3a2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl new file mode 100644 index 0000000000..cae5cd45d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_4cf3a2() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_4cf3a2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_4cf3a2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_4cf3a2(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl new file mode 100644 index 0000000000..6d299697a8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompareLevel_7f2b9a() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_7f2b9a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_7f2b9a(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6365c43b70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_7f2b9a() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_7f2b9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6365c43b70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_7f2b9a() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_7f2b9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_7f2b9a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl new file mode 100644 index 0000000000..0dcecc2690 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_7f2b9a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0)); +} + +void fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleCompareLevel_7f2b9a() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0)); +} + +void compute_main() { + textureSampleCompareLevel_7f2b9a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl new file mode 100644 index 0000000000..12a1172be9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_7f2b9a(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_7f2b9a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_7f2b9a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_7f2b9a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e4ef7ce83 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_7f2b9a "textureSampleCompareLevel_7f2b9a" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %36 = OpConstantNull %v2int + %38 = OpTypeFunction %v4float +%textureSampleCompareLevel_7f2b9a = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleDrefExplicitLod %float %30 %31 %32 Lod|ConstOffset %float_0 %36 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4473ab925 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_7f2b9a() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_7f2b9a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_7f2b9a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_7f2b9a(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl new file mode 100644 index 0000000000..c466840566 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler_comparison; + +// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2, array_index: i32, depth_ref: f32, @const offset: vec2) -> f32 +fn textureSampleCompareLevel_b6e47c() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_b6e47c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_b6e47c(); +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..43587976e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_b6e47c() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_b6e47c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_b6e47c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43587976e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerComparisonState arg_1 : register(s1, space1); + +void textureSampleCompareLevel_b6e47c() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float res = arg_0.SampleCmpLevelZero(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleCompareLevel_b6e47c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleCompareLevel_b6e47c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl new file mode 100644 index 0000000000..abe4ad64e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleCompareLevel_b6e47c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0)); +} + +void fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:10: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:10: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleCompareLevel_b6e47c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0)); +} + +void compute_main() { + textureSampleCompareLevel_b6e47c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl new file mode 100644 index 0000000000..a20d5d2cab --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleCompareLevel_b6e47c(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, arg_4, level(0), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleCompareLevel_b6e47c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleCompareLevel_b6e47c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleCompareLevel_b6e47c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm new file mode 100644 index 0000000000..8401e93459 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleCompareLevel_b6e47c "textureSampleCompareLevel_b6e47c" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %v2int = OpTypeVector %int 2 + %46 = OpConstantNull %v2int + %48 = OpTypeFunction %v4float +%textureSampleCompareLevel_b6e47c = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleDrefExplicitLod %float %35 %42 %43 Lod|ConstOffset %float_0 %46 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %59 = OpLabel + %60 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl new file mode 100644 index 0000000000..3bf14153c4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler_comparison; + +fn textureSampleCompareLevel_b6e47c() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleCompareLevel_b6e47c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleCompareLevel_b6e47c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleCompareLevel_b6e47c(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl new file mode 100644 index 0000000000..9435ab13f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 +fn textureSampleGrad_21402b() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_21402b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_21402b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_21402b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..037d976713 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_21402b() { + float3 arg_2 = (0.0f).xxx; + float3 arg_3 = (0.0f).xxx; + float3 arg_4 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_21402b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_21402b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_21402b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..037d976713 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_21402b() { + float3 arg_2 = (0.0f).xxx; + float3 arg_3 = (0.0f).xxx; + float3 arg_4 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_21402b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_21402b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_21402b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl new file mode 100644 index 0000000000..f480d789eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_21402b() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +vec4 vertex_main() { + textureSampleGrad_21402b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_21402b() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void fragment_main() { + textureSampleGrad_21402b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_21402b() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void compute_main() { + textureSampleGrad_21402b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl new file mode 100644 index 0000000000..8be83cd224 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_21402b(texture3d tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float3 arg_3 = float3(0.0f); + float3 arg_4 = float3(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient3d(arg_3, arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_21402b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_21402b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_21402b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm new file mode 100644 index 0000000000..19f41b27cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_21402b "textureSampleGrad_21402b" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %28 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_21402b = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %arg_4 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_2 + %31 = OpLoad %v3float %arg_3 + %32 = OpLoad %v3float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad %31 %32 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleGrad_21402b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleGrad_21402b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_21402b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl new file mode 100644 index 0000000000..4df38281a8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_21402b() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_21402b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_21402b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_21402b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl new file mode 100644 index 0000000000..bd213fd8cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2) -> vec4 +fn textureSampleGrad_2ecd8f() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = vec2(); + var arg_5 = vec2(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_2ecd8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_2ecd8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_2ecd8f(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..51d6b37c44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_2ecd8f() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float2 arg_4 = (0.0f).xx; + float2 arg_5 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, float3(arg_2, float(arg_3)), arg_4, arg_5); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_2ecd8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_2ecd8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_2ecd8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..51d6b37c44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_2ecd8f() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float2 arg_4 = (0.0f).xx; + float2 arg_5 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, float3(arg_2, float(arg_3)), arg_4, arg_5); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_2ecd8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_2ecd8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_2ecd8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl new file mode 100644 index 0000000000..62edc1550f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_2ecd8f() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5); +} + +vec4 vertex_main() { + textureSampleGrad_2ecd8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_2ecd8f() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5); +} + +void fragment_main() { + textureSampleGrad_2ecd8f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_2ecd8f() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5); +} + +void compute_main() { + textureSampleGrad_2ecd8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl new file mode 100644 index 0000000000..0fc4d01071 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +void textureSampleGrad_2ecd8f(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float2 arg_4 = float2(0.0f); + float2 arg_5 = float2(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, gradient2d(arg_4, arg_5)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_2ecd8f(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_2ecd8f(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_2ecd8f(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..adfcab266a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_2ecd8f "textureSampleGrad_2ecd8f" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %arg_5 "arg_5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_2ecd8f = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_v2float Function %20 + %arg_5 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %20 + OpStore %arg_5 %20 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %42 = OpLoad %v2float %arg_4 + %43 = OpLoad %v2float %arg_5 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Grad %42 %43 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleGrad_2ecd8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureSampleGrad_2ecd8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %58 = OpLabel + %59 = OpFunctionCall %void %textureSampleGrad_2ecd8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..32c526c18f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_2ecd8f() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = vec2(); + var arg_5 = vec2(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_2ecd8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_2ecd8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_2ecd8f(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl new file mode 100644 index 0000000000..d93e938159 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2) -> vec4 +fn textureSampleGrad_521263() { + var arg_2 = vec2(); + var arg_3 = vec2(); + var arg_4 = vec2(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_521263(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_521263(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_521263(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b184cd79b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_521263() { + float2 arg_2 = (0.0f).xx; + float2 arg_3 = (0.0f).xx; + float2 arg_4 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_521263(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_521263(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_521263(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b184cd79b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_521263() { + float2 arg_2 = (0.0f).xx; + float2 arg_3 = (0.0f).xx; + float2 arg_4 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_521263(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_521263(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_521263(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl new file mode 100644 index 0000000000..eb7aee0631 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_521263() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +vec4 vertex_main() { + textureSampleGrad_521263(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_521263() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void fragment_main() { + textureSampleGrad_521263(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_521263() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void compute_main() { + textureSampleGrad_521263(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl new file mode 100644 index 0000000000..89f9e8756c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_521263(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float2 arg_3 = float2(0.0f); + float2 arg_4 = float2(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient2d(arg_3, arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_521263(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_521263(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_521263(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm new file mode 100644 index 0000000000..5b90d6c400 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_521263 "textureSampleGrad_521263" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_521263 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %arg_4 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_2 + %31 = OpLoad %v2float %arg_3 + %32 = OpLoad %v2float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad %31 %32 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleGrad_521263 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleGrad_521263 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_521263 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl new file mode 100644 index 0000000000..25a38526f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_521263() { + var arg_2 = vec2(); + var arg_3 = vec2(); + var arg_4 = vec2(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_521263(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_521263(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_521263(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl new file mode 100644 index 0000000000..4cd7722ea1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_cube, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3) -> vec4 +fn textureSampleGrad_5312f4() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5312f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_5312f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5312f4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..14508e1a60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5312f4() { + float3 arg_2 = (0.0f).xxx; + float3 arg_3 = (0.0f).xxx; + float3 arg_4 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5312f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5312f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5312f4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..14508e1a60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5312f4() { + float3 arg_2 = (0.0f).xxx; + float3 arg_3 = (0.0f).xxx; + float3 arg_4 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5312f4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5312f4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5312f4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl new file mode 100644 index 0000000000..7278ce3735 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleGrad_5312f4() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +vec4 vertex_main() { + textureSampleGrad_5312f4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleGrad_5312f4() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void fragment_main() { + textureSampleGrad_5312f4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleGrad_5312f4() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4); +} + +void compute_main() { + textureSampleGrad_5312f4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl new file mode 100644 index 0000000000..d7f4659730 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_5312f4(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float3 arg_3 = float3(0.0f); + float3 arg_4 = float3(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradientcube(arg_3, arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_5312f4(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_5312f4(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_5312f4(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm new file mode 100644 index 0000000000..149aba6073 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_5312f4 "textureSampleGrad_5312f4" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %28 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_5312f4 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %arg_4 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_2 + %31 = OpLoad %v3float %arg_3 + %32 = OpLoad %v3float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad %31 %32 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleGrad_5312f4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %44 = OpLabel + %45 = OpFunctionCall %void %textureSampleGrad_5312f4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_5312f4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl new file mode 100644 index 0000000000..f4175ba165 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_5312f4() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5312f4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_5312f4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5312f4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl new file mode 100644 index 0000000000..029d5928bb --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_3d, sampler: sampler, coords: vec3, ddx: vec3, ddy: vec3, @const offset: vec3) -> vec4 +fn textureSampleGrad_5884dd() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5884dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_5884dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5884dd(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..695dd3062e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5884dd() { + float3 arg_2 = (0.0f).xxx; + float3 arg_3 = (0.0f).xxx; + float3 arg_4 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5884dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5884dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5884dd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..695dd3062e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_5884dd() { + float3 arg_2 = (0.0f).xxx; + float3 arg_3 = (0.0f).xxx; + float3 arg_4 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_5884dd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_5884dd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_5884dd(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl new file mode 100644 index 0000000000..a20b4b4a49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec3(0)); +} + +vec4 vertex_main() { + textureSampleGrad_5884dd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec3(0)); +} + +void fragment_main() { + textureSampleGrad_5884dd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleGrad_5884dd() { + vec3 arg_2 = vec3(0.0f); + vec3 arg_3 = vec3(0.0f); + vec3 arg_4 = vec3(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec3(0)); +} + +void compute_main() { + textureSampleGrad_5884dd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl new file mode 100644 index 0000000000..87a518a419 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_5884dd(texture3d tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float3 arg_3 = float3(0.0f); + float3 arg_4 = float3(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient3d(arg_3, arg_4), int3(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_5884dd(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_5884dd(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_5884dd(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfe63ebfdc --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_5884dd "textureSampleGrad_5884dd" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %35 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_5884dd = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_v3float Function %20 + %arg_4 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v3float %arg_2 + %31 = OpLoad %v3float %arg_3 + %32 = OpLoad %v3float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad|ConstOffset %31 %32 %35 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleGrad_5884dd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl new file mode 100644 index 0000000000..9e7449aa03 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_5884dd() { + var arg_2 = vec3(); + var arg_3 = vec3(); + var arg_4 = vec3(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_5884dd(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_5884dd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_5884dd(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl new file mode 100644 index 0000000000..22b9b2a331 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d, sampler: sampler, coords: vec2, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 +fn textureSampleGrad_d4e3c5() { + var arg_2 = vec2(); + var arg_3 = vec2(); + var arg_4 = vec2(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d4e3c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_d4e3c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d4e3c5(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..203eca8fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d4e3c5() { + float2 arg_2 = (0.0f).xx; + float2 arg_3 = (0.0f).xx; + float2 arg_4 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d4e3c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d4e3c5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..203eca8fb1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d4e3c5() { + float2 arg_2 = (0.0f).xx; + float2 arg_3 = (0.0f).xx; + float2 arg_4 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d4e3c5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d4e3c5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl new file mode 100644 index 0000000000..a772706f45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleGrad_d4e3c5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec2(0)); +} + +void fragment_main() { + textureSampleGrad_d4e3c5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleGrad_d4e3c5() { + vec2 arg_2 = vec2(0.0f); + vec2 arg_3 = vec2(0.0f); + vec2 arg_4 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec2(0)); +} + +void compute_main() { + textureSampleGrad_d4e3c5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl new file mode 100644 index 0000000000..166bab5879 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleGrad_d4e3c5(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float2 arg_3 = float2(0.0f); + float2 arg_4 = float2(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient2d(arg_3, arg_4), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_d4e3c5(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_d4e3c5(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_d4e3c5(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm new file mode 100644 index 0000000000..817905adcf --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_d4e3c5 "textureSampleGrad_d4e3c5" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %35 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_d4e3c5 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_v2float Function %20 + %arg_4 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %20 + OpStore %arg_4 %20 + %26 = OpLoad %14 %arg_1 + %27 = OpLoad %11 %arg_0 + %29 = OpSampledImage %28 %27 %26 + %30 = OpLoad %v2float %arg_2 + %31 = OpLoad %v2float %arg_3 + %32 = OpLoad %v2float %arg_4 + %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad|ConstOffset %31 %32 %35 + OpStore %res %25 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleGrad_d4e3c5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl new file mode 100644 index 0000000000..c40b807de2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_d4e3c5() { + var arg_2 = vec2(); + var arg_3 = vec2(); + var arg_4 = vec2(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d4e3c5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_d4e3c5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d4e3c5(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl new file mode 100644 index 0000000000..5fc0ab213d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, ddx: vec2, ddy: vec2, @const offset: vec2) -> vec4 +fn textureSampleGrad_d65515() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = vec2(); + var arg_5 = vec2(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d65515(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_d65515(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d65515(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..91e62c1e3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d65515() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float2 arg_4 = (0.0f).xx; + float2 arg_5 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, float3(arg_2, float(arg_3)), arg_4, arg_5, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d65515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d65515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d65515(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..91e62c1e3a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_d65515() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float2 arg_4 = (0.0f).xx; + float2 arg_5 = (0.0f).xx; + float4 res = arg_0.SampleGrad(arg_1, float3(arg_2, float(arg_3)), arg_4, arg_5, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_d65515(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_d65515(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_d65515(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl new file mode 100644 index 0000000000..31c47a2771 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl @@ -0,0 +1,67 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleGrad_d65515(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5, ivec2(0)); +} + +void fragment_main() { + textureSampleGrad_d65515(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleGrad_d65515() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + vec2 arg_4 = vec2(0.0f); + vec2 arg_5 = vec2(0.0f); + vec4 res = textureGradOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5, ivec2(0)); +} + +void compute_main() { + textureSampleGrad_d65515(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl new file mode 100644 index 0000000000..ad234a07d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +void textureSampleGrad_d65515(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float2 arg_4 = float2(0.0f); + float2 arg_5 = float2(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, gradient2d(arg_4, arg_5), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_d65515(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_d65515(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_d65515(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm new file mode 100644 index 0000000000..274c793254 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_d65515 "textureSampleGrad_d65515" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %arg_5 "arg_5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %45 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %48 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_d65515 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_v2float Function %20 + %arg_5 = OpVariable %_ptr_Function_v2float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %20 + OpStore %arg_5 %20 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %42 = OpLoad %v2float %arg_4 + %43 = OpLoad %v2float %arg_5 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Grad|ConstOffset %42 %43 %45 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %60 = OpLabel + %61 = OpFunctionCall %void %textureSampleGrad_d65515 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl new file mode 100644 index 0000000000..349514e469 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_d65515() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = vec2(); + var arg_5 = vec2(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_d65515(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_d65515(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_d65515(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl new file mode 100644 index 0000000000..74692eab78 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl @@ -0,0 +1,49 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleGrad(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, ddx: vec3, ddy: vec3) -> vec4 +fn textureSampleGrad_e383db() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = vec3(); + var arg_5 = vec3(); + var res: vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_e383db(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_e383db(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_e383db(); +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f111fbf1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_e383db() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float3 arg_4 = (0.0f).xxx; + float3 arg_5 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, float4(arg_2, float(arg_3)), arg_4, arg_5); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_e383db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_e383db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_e383db(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1f111fbf1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleGrad_e383db() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float3 arg_4 = (0.0f).xxx; + float3 arg_5 = (0.0f).xxx; + float4 res = arg_0.SampleGrad(arg_1, float4(arg_2, float(arg_3)), arg_4, arg_5); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleGrad_e383db(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleGrad_e383db(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleGrad_e383db(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl new file mode 100644 index 0000000000..7e0c762254 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl @@ -0,0 +1,90 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleGrad_e383db() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec3 arg_4 = vec3(0.0f); + vec3 arg_5 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4, arg_5); +} + +vec4 vertex_main() { + textureSampleGrad_e383db(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleGrad_e383db() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec3 arg_4 = vec3(0.0f); + vec3 arg_5 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4, arg_5); +} + +void fragment_main() { + textureSampleGrad_e383db(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleGrad_e383db() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + vec3 arg_4 = vec3(0.0f); + vec3 arg_5 = vec3(0.0f); + vec4 res = textureGrad(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4, arg_5); +} + +void compute_main() { + textureSampleGrad_e383db(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl new file mode 100644 index 0000000000..e452422810 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +void textureSampleGrad_e383db(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float3 arg_4 = float3(0.0f); + float3 arg_5 = float3(0.0f); + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, gradientcube(arg_4, arg_5)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleGrad_e383db(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleGrad_e383db(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleGrad_e383db(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm new file mode 100644 index 0000000000..b63df46741 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleGrad_e383db "textureSampleGrad_e383db" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %arg_5 "arg_5" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleGrad_e383db = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_v3float Function %20 + %arg_5 = OpVariable %_ptr_Function_v3float Function %20 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %20 + OpStore %arg_5 %20 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %35 = OpLoad %v3float %arg_2 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %38 = OpCompositeExtract %float %35 2 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v4float %36 %37 %38 %39 + %42 = OpLoad %v3float %arg_4 + %43 = OpLoad %v3float %arg_5 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Grad %42 %43 + OpStore %res %30 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleGrad_e383db + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureSampleGrad_e383db + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %58 = OpLabel + %59 = OpFunctionCall %void %textureSampleGrad_e383db + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl new file mode 100644 index 0000000000..7271812142 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleGrad_e383db() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = vec3(); + var arg_5 = vec3(); + var res : vec4 = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleGrad_e383db(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleGrad_e383db(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleGrad_e383db(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl new file mode 100644 index 0000000000..70348ab7f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32) -> f32 +fn textureSampleLevel_02be59() { + var arg_2 = vec2(); + var arg_3 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_02be59(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_02be59(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_02be59(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fd23cee6f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_02be59() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 0; + float res = arg_0.SampleLevel(arg_1, arg_2, arg_3).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_02be59(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_02be59(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_02be59(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fd23cee6f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_02be59() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 0; + float res = arg_0.SampleLevel(arg_1, arg_2, arg_3).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_02be59(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_02be59(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_02be59(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl new file mode 100644 index 0000000000..eb71fe0465 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_02be59() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3)); +} + +vec4 vertex_main() { + textureSampleLevel_02be59(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_02be59() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3)); +} + +void fragment_main() { + textureSampleLevel_02be59(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_02be59() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3)); +} + +void compute_main() { + textureSampleLevel_02be59(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl new file mode 100644 index 0000000000..8aa0c8550b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_02be59(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_02be59(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_02be59(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_02be59(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d1fcc2fa6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_02be59 "textureSampleLevel_02be59" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %24 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpTypeSampledImage %11 +%_ptr_Function_float = OpTypePointer Function %float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_02be59 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %24 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v2float %arg_2 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %28 = OpImageSampleExplicitLod %v4float %32 %33 Lod %34 + %27 = OpCompositeExtract %float %28 0 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_02be59 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleLevel_02be59 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleLevel_02be59 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl new file mode 100644 index 0000000000..16b70a60af --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_02be59() { + var arg_2 = vec2(); + var arg_3 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_02be59(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_02be59(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_02be59(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl new file mode 100644 index 0000000000..3f8f697e4f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32, @const offset: vec2) -> vec4 +fn textureSampleLevel_0b0a1b() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0b0a1b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_0b0a1b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0b0a1b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d57bb5e533 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0b0a1b() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0b0a1b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0b0a1b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d57bb5e533 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0b0a1b() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0b0a1b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0b0a1b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl new file mode 100644 index 0000000000..156234643e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_0b0a1b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_0b0a1b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_0b0a1b() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0)); +} + +void compute_main() { + textureSampleLevel_0b0a1b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl new file mode 100644 index 0000000000..5aec41a85d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_0b0a1b(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_0b0a1b(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_0b0a1b(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_0b0a1b(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm new file mode 100644 index 0000000000..128e2c99f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_0b0a1b "textureSampleLevel_0b0a1b" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %35 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float +%textureSampleLevel_0b0a1b = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod|ConstOffset %32 %35 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleLevel_0b0a1b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl new file mode 100644 index 0000000000..751f1b3a28 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_0b0a1b() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0b0a1b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_0b0a1b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0b0a1b(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl new file mode 100644 index 0000000000..95560d85c2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: f32) -> vec4 +fn textureSampleLevel_0bdd9a() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0bdd9a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_0bdd9a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0bdd9a(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fd1c612315 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0bdd9a() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0bdd9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0bdd9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0bdd9a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fd1c612315 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_0bdd9a() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_0bdd9a(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_0bdd9a(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_0bdd9a(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl new file mode 100644 index 0000000000..5cff227c6b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleLevel_0bdd9a() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureSampleLevel_0bdd9a(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleLevel_0bdd9a() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleLevel_0bdd9a(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArray' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArray arg_0_arg_1; + +void textureSampleLevel_0bdd9a() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureSampleLevel_0bdd9a(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArray' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl new file mode 100644 index 0000000000..1a157e0443 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_0bdd9a(texturecube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_0bdd9a(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_0bdd9a(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_0bdd9a(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm new file mode 100644 index 0000000000..31adb35595 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_0bdd9a "textureSampleLevel_0bdd9a" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float +%textureSampleLevel_0bdd9a = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %36 = OpLoad %v3float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %39 = OpCompositeExtract %float %36 2 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v4float %37 %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleExplicitLod %v4float %35 %42 Lod %43 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleLevel_0bdd9a + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureSampleLevel_0bdd9a + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleLevel_0bdd9a + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl new file mode 100644 index 0000000000..80e15ab12e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_0bdd9a() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_0bdd9a(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_0bdd9a(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_0bdd9a(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl new file mode 100644 index 0000000000..a4be615351 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3, level: i32) -> f32 +fn textureSampleLevel_1b0291() { + var arg_2 = vec3(); + var arg_3 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1b0291(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_1b0291(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1b0291(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db87195d36 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1b0291() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 0; + float res = arg_0.SampleLevel(arg_1, arg_2, arg_3).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1b0291(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1b0291(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1b0291(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..db87195d36 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1b0291() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 0; + float res = arg_0.SampleLevel(arg_1, arg_2, arg_3).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1b0291(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1b0291(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1b0291(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl new file mode 100644 index 0000000000..19d3183e63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleLevel_1b0291() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, 0.0f), float(arg_3)); +} + +vec4 vertex_main() { + textureSampleLevel_1b0291(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:8: 'textureLod' : no matching overloaded function found +ERROR: 0:8: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleLevel_1b0291() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, 0.0f), float(arg_3)); +} + +void fragment_main() { + textureSampleLevel_1b0291(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLod' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeShadow arg_0_arg_1; + +void textureSampleLevel_1b0291() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, 0.0f), float(arg_3)); +} + +void compute_main() { + textureSampleLevel_1b0291(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:8: 'textureLod' : no matching overloaded function found +ERROR: 0:8: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl new file mode 100644 index 0000000000..6da05d0d63 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_1b0291(depthcube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_1b0291(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_1b0291(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_1b0291(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm new file mode 100644 index 0000000000..89a2e52bfa --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_1b0291 "textureSampleLevel_1b0291" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %24 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpTypeSampledImage %11 +%_ptr_Function_float = OpTypePointer Function %float + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_1b0291 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %24 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v3float %arg_2 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %28 = OpImageSampleExplicitLod %v4float %32 %33 Lod %34 + %27 = OpCompositeExtract %float %28 0 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_1b0291 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %textureSampleLevel_1b0291 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleLevel_1b0291 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl new file mode 100644 index 0000000000..5bae229fb7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_1b0291() { + var arg_2 = vec3(); + var arg_3 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1b0291(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_1b0291(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1b0291(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl new file mode 100644 index 0000000000..3eb753e3fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32) -> f32 +fn textureSampleLevel_1bf73e() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1bf73e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_1bf73e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1bf73e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f04b03a14 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1bf73e() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + int arg_4 = 0; + float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1bf73e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1bf73e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1bf73e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f04b03a14 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_1bf73e() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + int arg_4 = 0; + float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_1bf73e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_1bf73e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_1bf73e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl new file mode 100644 index 0000000000..910156b507 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_1bf73e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4)); +} + +vec4 vertex_main() { + textureSampleLevel_1bf73e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLod' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_1bf73e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4)); +} + +void fragment_main() { + textureSampleLevel_1bf73e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:10: 'textureLod' : no matching overloaded function found +ERROR: 0:10: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_1bf73e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4)); +} + +void compute_main() { + textureSampleLevel_1bf73e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLod' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl new file mode 100644 index 0000000000..672e629841 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_1bf73e(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_1bf73e(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_1bf73e(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_1bf73e(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm new file mode 100644 index 0000000000..e19fd5b69e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_1bf73e "textureSampleLevel_1bf73e" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_float = OpTypePointer Function %float + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_1bf73e = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %27 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %43 = OpLoad %int %arg_4 + %42 = OpConvertSToF %float %43 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Lod %42 + %29 = OpCompositeExtract %float %30 0 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleLevel_1bf73e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureSampleLevel_1bf73e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %58 = OpLabel + %59 = OpFunctionCall %void %textureSampleLevel_1bf73e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cd09cb211 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_1bf73e() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_1bf73e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_1bf73e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_1bf73e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl new file mode 100644 index 0000000000..38fd5b1d36 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32) -> vec4 +fn textureSampleLevel_302be4() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_302be4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_302be4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_302be4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..997a9e9d52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_302be4() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_302be4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_302be4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_302be4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..997a9e9d52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_302be4() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_302be4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_302be4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_302be4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl new file mode 100644 index 0000000000..faded30067 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_302be4() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +vec4 vertex_main() { + textureSampleLevel_302be4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_302be4() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void fragment_main() { + textureSampleLevel_302be4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_302be4() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4); +} + +void compute_main() { + textureSampleLevel_302be4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl new file mode 100644 index 0000000000..ec288702ac --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_302be4(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_302be4(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_302be4(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_302be4(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm new file mode 100644 index 0000000000..bebc87fe92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_302be4 "textureSampleLevel_302be4" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %46 = OpTypeFunction %v4float +%textureSampleLevel_302be4 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleExplicitLod %v4float %35 %42 Lod %43 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleLevel_302be4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %textureSampleLevel_302be4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleLevel_302be4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl new file mode 100644 index 0000000000..4bb4b4d9b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_302be4() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_302be4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_302be4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_302be4(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl new file mode 100644 index 0000000000..6e5af0bb2b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: i32, @const offset: vec2) -> f32 +fn textureSampleLevel_36780e() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_36780e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_36780e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_36780e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..419b8c9a18 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_36780e() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + int arg_4 = 0; + float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_36780e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_36780e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_36780e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..419b8c9a18 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_36780e() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + int arg_4 = 0; + float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_36780e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_36780e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_36780e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl new file mode 100644 index 0000000000..643f052d7e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_36780e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_36780e(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:10: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:10: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp sampler2DArrayShadow arg_0_arg_1; + +void textureSampleLevel_36780e() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0)); +} + +void compute_main() { + textureSampleLevel_36780e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:9: 'textureLodOffset' : no matching overloaded function found +ERROR: 0:9: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl new file mode 100644 index 0000000000..8c15da14c8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_36780e(depth2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_36780e(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_36780e(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_36780e(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd86de3942 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_36780e "textureSampleLevel_36780e" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %45 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %48 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_36780e = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %27 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %36 = OpLoad %v2float %arg_2 + %37 = OpCompositeExtract %float %36 0 + %38 = OpCompositeExtract %float %36 1 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v3float %37 %38 %39 + %43 = OpLoad %int %arg_4 + %42 = OpConvertSToF %float %43 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Lod|ConstOffset %42 %45 + %29 = OpCompositeExtract %float %30 0 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %60 = OpLabel + %61 = OpFunctionCall %void %textureSampleLevel_36780e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ccce18e84 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_36780e() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_36780e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_36780e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_36780e(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl new file mode 100644 index 0000000000..74d2449048 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2, level: i32, @const offset: vec2) -> f32 +fn textureSampleLevel_749baf() { + var arg_2 = vec2(); + var arg_3 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_749baf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_749baf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_749baf(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b1b58de933 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_749baf() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 0; + float res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_749baf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_749baf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_749baf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1b58de933 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_749baf() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 0; + float res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xx).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_749baf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_749baf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_749baf(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl new file mode 100644 index 0000000000..a2d34d0805 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLodOffset(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3), ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_749baf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLodOffset(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3), ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_749baf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DShadow arg_0_arg_1; + +void textureSampleLevel_749baf() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 0; + float res = textureLodOffset(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3), ivec2(0)); +} + +void compute_main() { + textureSampleLevel_749baf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl new file mode 100644 index 0000000000..8ea81b154f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_749baf(depth2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depth2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_749baf(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depth2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depth2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_749baf(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depth2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_749baf(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm new file mode 100644 index 0000000000..c48597cfd0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_749baf "textureSampleLevel_749baf" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %24 = OpConstantNull %int +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpTypeSampledImage %11 + %v2int = OpTypeVector %int 2 + %37 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %40 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_749baf = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %24 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %24 + %29 = OpLoad %14 %arg_1 + %30 = OpLoad %11 %arg_0 + %32 = OpSampledImage %31 %30 %29 + %33 = OpLoad %v2float %arg_2 + %35 = OpLoad %int %arg_3 + %34 = OpConvertSToF %float %35 + %28 = OpImageSampleExplicitLod %v4float %32 %33 Lod|ConstOffset %34 %37 + %27 = OpCompositeExtract %float %28 0 + OpStore %res %27 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %40 + %42 = OpLabel + %43 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %45 = OpLabel + %46 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %46 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %52 = OpLabel + %53 = OpFunctionCall %void %textureSampleLevel_749baf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl new file mode 100644 index 0000000000..534677f6dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_depth_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_749baf() { + var arg_2 = vec2(); + var arg_3 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_749baf(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_749baf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_749baf(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl new file mode 100644 index 0000000000..a54008b6df --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_external; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2) -> vec4 +fn textureSampleLevel_979816() { + var arg_2 = vec2(); + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_979816(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_979816(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_979816(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..20a6a9824d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.dxc.hlsl @@ -0,0 +1,113 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t2, space1); +cbuffer cbuffer_ext_tex_params : register(b3, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureSampleExternal(Texture2D plane0, Texture2D plane1, SamplerState smp, float2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.SampleLevel(smp, coord, 0.0f).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureSampleLevel_979816() { + float2 arg_2 = (0.0f).xx; + float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, arg_2, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_979816(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_979816(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_979816(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20a6a9824d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.fxc.hlsl @@ -0,0 +1,113 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t2, space1); +cbuffer cbuffer_ext_tex_params : register(b3, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureSampleExternal(Texture2D plane0, Texture2D plane1, SamplerState smp, float2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.SampleLevel(smp, coord, 0.0f).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float3x4 tint_symbol_3(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_9; +} + +float3x3 tint_symbol_7(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))}; + return tint_symbol_10; +} + +void textureSampleLevel_979816() { + float2 arg_2 = (0.0f).xx; + float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, arg_2, tint_symbol_1(ext_tex_params, 0u)); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_979816(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_979816(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_979816(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl new file mode 100644 index 0000000000..11782ba912 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl @@ -0,0 +1,240 @@ +SKIP: FAILED + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 3) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + + +vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = textureLod(plane0_smp, coord, 0.0f).rgb; + } else { + color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_arg_1; +uniform highp sampler2D ext_tex_plane_1_arg_1; +void textureSampleLevel_979816() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params); +} + +vec4 vertex_main() { + textureSampleLevel_979816(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:59: 'textureSampleExternal' : no matching overloaded function found +ERROR: 0:59: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:59: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 3) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + + +vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = textureLod(plane0_smp, coord, 0.0f).rgb; + } else { + color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_arg_1; +uniform highp sampler2D ext_tex_plane_1_arg_1; +void textureSampleLevel_979816() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params); +} + +void fragment_main() { + textureSampleLevel_979816(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:60: 'textureSampleExternal' : no matching overloaded function found +ERROR: 0:60: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' +ERROR: 0:60: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + +#version 310 es + +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +}; + +layout(binding = 3) uniform ExternalTextureParams_1 { + uint numPlanes; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; +} ext_tex_params; + +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + + +vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = textureLod(plane0_smp, coord, 0.0f).rgb; + } else { + color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); +} + +uniform highp sampler2D arg_0_arg_1; +uniform highp sampler2D ext_tex_plane_1_arg_1; +void textureSampleLevel_979816() { + vec2 arg_2 = vec2(0.0f); + vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params); +} + +void compute_main() { + textureSampleLevel_979816(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:59: 'textureSampleExternal' : no matching overloaded function found +ERROR: 0:59: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:59: '' : compilation terminated +ERROR: 3 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl new file mode 100644 index 0000000000..96222138d0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl @@ -0,0 +1,90 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct GammaTransferParams { + /* 0x0000 */ float G; + /* 0x0004 */ float A; + /* 0x0008 */ float B; + /* 0x000c */ float C; + /* 0x0010 */ float D; + /* 0x0014 */ float E; + /* 0x0018 */ float F; + /* 0x001c */ uint padding; +}; + +struct ExternalTextureParams { + /* 0x0000 */ uint numPlanes; + /* 0x0004 */ uint doYuvToRgbConversionOnly; + /* 0x0008 */ tint_array tint_pad; + /* 0x0010 */ float3x4 yuvToRgbConversionMatrix; + /* 0x0040 */ GammaTransferParams gammaDecodeParams; + /* 0x0060 */ GammaTransferParams gammaEncodeParams; + /* 0x0080 */ float3x3 gamutConversionMatrix; +}; + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + bool3 const cond = (fabs(v) < float3(params.D)); + float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F)); + float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E)); + return select(f, t, cond); +} + +float4 textureSampleExternal(texture2d plane0, texture2d plane1, sampler smp, float2 coord, ExternalTextureParams params) { + float3 color = 0.0f; + if ((params.numPlanes == 1u)) { + color = float4(plane0.sample(smp, coord, level(0.0f))).rgb; + } else { + color = (float4(plane0.sample(smp, coord, level(0.0f))[0], float4(plane1.sample(smp, coord, level(0.0f))).rg, 1.0f) * params.yuvToRgbConversionMatrix); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +void textureSampleLevel_979816(texture2d tint_symbol_1, texture2d tint_symbol_2, sampler tint_symbol_3, const constant ExternalTextureParams* const tint_symbol_4) { + float2 arg_2 = float2(0.0f); + float4 res = textureSampleExternal(tint_symbol_1, tint_symbol_2, tint_symbol_3, arg_2, *(tint_symbol_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_5, texture2d tint_symbol_6, sampler tint_symbol_7, const constant ExternalTextureParams* const tint_symbol_8) { + textureSampleLevel_979816(tint_symbol_5, tint_symbol_6, tint_symbol_7, tint_symbol_8); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_9 [[texture(0)]], texture2d tint_symbol_10 [[texture(1)]], sampler tint_symbol_11 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_13 [[texture(0)]], texture2d tint_symbol_14 [[texture(1)]], sampler tint_symbol_15 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_16 [[buffer(2)]]) { + textureSampleLevel_979816(tint_symbol_13, tint_symbol_14, tint_symbol_15, tint_symbol_16); + return; +} + +kernel void compute_main(texture2d tint_symbol_17 [[texture(0)]], texture2d tint_symbol_18 [[texture(1)]], sampler tint_symbol_19 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_20 [[buffer(2)]]) { + textureSampleLevel_979816(tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm new file mode 100644 index 0000000000..ad6d2a9ab7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm @@ -0,0 +1,253 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 143 +; Schema: 0 + OpCapability Shader + %30 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ExternalTextureParams "ExternalTextureParams" + OpMemberName %ExternalTextureParams 0 "numPlanes" + OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly" + OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 3 "gammaDecodeParams" + OpName %GammaTransferParams "GammaTransferParams" + OpMemberName %GammaTransferParams 0 "G" + OpMemberName %GammaTransferParams 1 "A" + OpMemberName %GammaTransferParams 2 "B" + OpMemberName %GammaTransferParams 3 "C" + OpMemberName %GammaTransferParams 4 "D" + OpMemberName %GammaTransferParams 5 "E" + OpMemberName %GammaTransferParams 6 "F" + OpMemberName %GammaTransferParams 7 "padding" + OpMemberName %ExternalTextureParams 4 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix" + OpName %ext_tex_params "ext_tex_params" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %gammaCorrection "gammaCorrection" + OpName %v "v" + OpName %params "params" + OpName %textureSampleExternal "textureSampleExternal" + OpName %plane0 "plane0" + OpName %plane1 "plane1" + OpName %smp "smp" + OpName %coord "coord" + OpName %params_0 "params" + OpName %color "color" + OpName %textureSampleLevel_979816 "textureSampleLevel_979816" + OpName %arg_2 "arg_2" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %ext_tex_plane_1 DescriptorSet 1 + OpDecorate %ext_tex_plane_1 Binding 2 + OpDecorate %ExternalTextureParams Block + OpMemberDecorate %ExternalTextureParams 0 Offset 0 + OpMemberDecorate %ExternalTextureParams 1 Offset 4 + OpMemberDecorate %ExternalTextureParams 2 Offset 16 + OpMemberDecorate %ExternalTextureParams 2 ColMajor + OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 3 Offset 64 + OpMemberDecorate %GammaTransferParams 0 Offset 0 + OpMemberDecorate %GammaTransferParams 1 Offset 4 + OpMemberDecorate %GammaTransferParams 2 Offset 8 + OpMemberDecorate %GammaTransferParams 3 Offset 12 + OpMemberDecorate %GammaTransferParams 4 Offset 16 + OpMemberDecorate %GammaTransferParams 5 Offset 20 + OpMemberDecorate %GammaTransferParams 6 Offset 24 + OpMemberDecorate %GammaTransferParams 7 Offset 28 + OpMemberDecorate %ExternalTextureParams 4 Offset 96 + OpMemberDecorate %ExternalTextureParams 5 Offset 128 + OpMemberDecorate %ExternalTextureParams 5 ColMajor + OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16 + OpDecorate %ext_tex_params NonWritable + OpDecorate %ext_tex_params DescriptorSet 1 + OpDecorate %ext_tex_params Binding 3 + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 +%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 +%mat3v4float = OpTypeMatrix %v4float 3 +%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams +%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %23 = OpTypeSampler +%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 + %arg_1 = OpVariable %_ptr_UniformConstant_23 UniformConstant + %24 = OpTypeFunction %v3float %v3float %GammaTransferParams + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %44 = OpConstantNull %v3float + %v2float = OpTypeVector %float 2 + %64 = OpTypeFunction %v4float %11 %11 %23 %v2float %ExternalTextureParams + %uint_1 = OpConstant %uint 1 + %81 = OpTypeSampledImage %11 + %float_1 = OpConstant %float 1 + %97 = OpConstantNull %uint + %void = OpTypeVoid + %115 = OpTypeFunction %void + %119 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %130 = OpTypeFunction %v4float +%gammaCorrection = OpFunction %v3float None %24 + %v = OpFunctionParameter %v3float + %params = OpFunctionParameter %GammaTransferParams + %28 = OpLabel + %42 = OpVariable %_ptr_Function_v3float Function %44 + %54 = OpVariable %_ptr_Function_v3float Function %44 + %60 = OpVariable %_ptr_Function_v3float Function %44 + %29 = OpExtInst %v3float %30 FAbs %v + %31 = OpCompositeExtract %float %params 4 + %32 = OpCompositeConstruct %v3float %31 %31 %31 + %33 = OpFOrdLessThan %v3bool %29 %32 + %36 = OpExtInst %v3float %30 FSign %v + %37 = OpCompositeExtract %float %params 3 + %38 = OpExtInst %v3float %30 FAbs %v + %39 = OpVectorTimesScalar %v3float %38 %37 + %40 = OpCompositeExtract %float %params 6 + %45 = OpCompositeConstruct %v3float %40 %40 %40 + %41 = OpFAdd %v3float %39 %45 + %46 = OpFMul %v3float %36 %41 + %47 = OpExtInst %v3float %30 FSign %v + %49 = OpCompositeExtract %float %params 1 + %50 = OpExtInst %v3float %30 FAbs %v + %51 = OpVectorTimesScalar %v3float %50 %49 + %52 = OpCompositeExtract %float %params 2 + %55 = OpCompositeConstruct %v3float %52 %52 %52 + %53 = OpFAdd %v3float %51 %55 + %56 = OpCompositeExtract %float %params 0 + %57 = OpCompositeConstruct %v3float %56 %56 %56 + %48 = OpExtInst %v3float %30 Pow %53 %57 + %58 = OpCompositeExtract %float %params 5 + %61 = OpCompositeConstruct %v3float %58 %58 %58 + %59 = OpFAdd %v3float %48 %61 + %62 = OpFMul %v3float %47 %59 + %63 = OpSelect %v3float %33 %46 %62 + OpReturnValue %63 + OpFunctionEnd +%textureSampleExternal = OpFunction %v4float None %64 + %plane0 = OpFunctionParameter %11 + %plane1 = OpFunctionParameter %11 + %smp = OpFunctionParameter %23 + %coord = OpFunctionParameter %v2float + %params_0 = OpFunctionParameter %ExternalTextureParams + %72 = OpLabel + %color = OpVariable %_ptr_Function_v3float Function %44 + %74 = OpCompositeExtract %uint %params_0 0 + %76 = OpIEqual %bool %74 %uint_1 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %82 = OpSampledImage %81 %plane0 %smp + %80 = OpImageSampleExplicitLod %v4float %82 %coord Lod %8 + %83 = OpVectorShuffle %v3float %80 %80 0 1 2 + OpStore %color %83 + OpBranch %77 + %79 = OpLabel + %85 = OpSampledImage %81 %plane0 %smp + %84 = OpImageSampleExplicitLod %v4float %85 %coord Lod %8 + %86 = OpCompositeExtract %float %84 0 + %88 = OpSampledImage %81 %plane1 %smp + %87 = OpImageSampleExplicitLod %v4float %88 %coord Lod %8 + %89 = OpVectorShuffle %v2float %87 %87 0 1 + %90 = OpCompositeExtract %float %89 0 + %91 = OpCompositeExtract %float %89 1 + %93 = OpCompositeConstruct %v4float %86 %90 %91 %float_1 + %94 = OpCompositeExtract %mat3v4float %params_0 2 + %95 = OpVectorTimesMatrix %v3float %93 %94 + OpStore %color %95 + OpBranch %77 + %77 = OpLabel + %96 = OpCompositeExtract %uint %params_0 1 + %98 = OpIEqual %bool %96 %97 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %99 + %100 = OpLabel + %102 = OpLoad %v3float %color + %103 = OpCompositeExtract %GammaTransferParams %params_0 3 + %101 = OpFunctionCall %v3float %gammaCorrection %102 %103 + OpStore %color %101 + %104 = OpCompositeExtract %mat3v3float %params_0 5 + %105 = OpLoad %v3float %color + %106 = OpMatrixTimesVector %v3float %104 %105 + OpStore %color %106 + %108 = OpLoad %v3float %color + %109 = OpCompositeExtract %GammaTransferParams %params_0 4 + %107 = OpFunctionCall %v3float %gammaCorrection %108 %109 + OpStore %color %107 + OpBranch %99 + %99 = OpLabel + %110 = OpLoad %v3float %color + %111 = OpCompositeExtract %float %110 0 + %112 = OpCompositeExtract %float %110 1 + %113 = OpCompositeExtract %float %110 2 + %114 = OpCompositeConstruct %v4float %111 %112 %113 %float_1 + OpReturnValue %114 + OpFunctionEnd +%textureSampleLevel_979816 = OpFunction %void None %115 + %118 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %119 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %119 + %123 = OpLoad %11 %arg_0 + %124 = OpLoad %11 %ext_tex_plane_1 + %125 = OpLoad %23 %arg_1 + %126 = OpLoad %v2float %arg_2 + %127 = OpLoad %ExternalTextureParams %ext_tex_params + %122 = OpFunctionCall %v4float %textureSampleExternal %123 %124 %125 %126 %127 + OpStore %res %122 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %130 + %132 = OpLabel + %133 = OpFunctionCall %void %textureSampleLevel_979816 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %115 + %135 = OpLabel + %136 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %136 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %115 + %138 = OpLabel + %139 = OpFunctionCall %void %textureSampleLevel_979816 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %115 + %141 = OpLabel + %142 = OpFunctionCall %void %textureSampleLevel_979816 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl new file mode 100644 index 0000000000..3c31778c28 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_external; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_979816() { + var arg_2 = vec2(); + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_979816(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_979816(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_979816(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl new file mode 100644 index 0000000000..7d31330a60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32) -> vec4 +fn textureSampleLevel_abfcc0() { + var arg_2 = vec3(); + var arg_3 = 1.f; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_abfcc0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_abfcc0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_abfcc0(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cabcb9012a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_abfcc0() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_abfcc0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_abfcc0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_abfcc0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cabcb9012a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_abfcc0() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_abfcc0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_abfcc0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_abfcc0(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl new file mode 100644 index 0000000000..f94eaea51a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_abfcc0() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureSampleLevel_abfcc0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_abfcc0() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleLevel_abfcc0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_abfcc0() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureSampleLevel_abfcc0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl new file mode 100644 index 0000000000..399820b91b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_abfcc0(texture3d tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_abfcc0(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_abfcc0(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_abfcc0(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm new file mode 100644 index 0000000000..46b9eb551b --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_abfcc0 "textureSampleLevel_abfcc0" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureSampleLevel_abfcc0 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleLevel_abfcc0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_abfcc0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_abfcc0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl new file mode 100644 index 0000000000..73e792178e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_abfcc0() { + var arg_2 = vec3(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_abfcc0(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_abfcc0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_abfcc0(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl new file mode 100644 index 0000000000..cda803035a --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_depth_cube_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3, array_index: i32, level: i32) -> f32 +fn textureSampleLevel_ae5e39() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 0; + var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_ae5e39(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_ae5e39(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_ae5e39(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d003c3bf0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_ae5e39() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + int arg_4 = 0; + float res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_ae5e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_ae5e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_ae5e39(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d003c3bf0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +TextureCubeArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_ae5e39() { + float3 arg_2 = (0.0f).xxx; + int arg_3 = 1; + int arg_4 = 0; + float res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4).x; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_ae5e39(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_ae5e39(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_ae5e39(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl new file mode 100644 index 0000000000..9c64c667c3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl @@ -0,0 +1,87 @@ +SKIP: FAILED + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleLevel_ae5e39() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4)); +} + +vec4 vertex_main() { + textureSampleLevel_ae5e39(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleLevel_ae5e39() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4)); +} + +void fragment_main() { + textureSampleLevel_ae5e39(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +uniform highp samplerCubeArrayShadow arg_0_arg_1; + +void textureSampleLevel_ae5e39() { + vec3 arg_2 = vec3(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4)); +} + +void compute_main() { + textureSampleLevel_ae5e39(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word. +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl new file mode 100644 index 0000000000..f50b671b55 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_ae5e39(depthcube_array tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + int arg_3 = 1; + int arg_4 = 0; + float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(depthcube_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_ae5e39(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(depthcube_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(depthcube_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_ae5e39(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(depthcube_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_ae5e39(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm new file mode 100644 index 0000000000..ee03d7f38d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_ae5e39 "textureSampleLevel_ae5e39" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %33 = OpTypeSampledImage %11 +%_ptr_Function_float = OpTypePointer Function %float + %46 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureSampleLevel_ae5e39 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_int Function %27 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %27 + %31 = OpLoad %14 %arg_1 + %32 = OpLoad %11 %arg_0 + %34 = OpSampledImage %33 %32 %31 + %35 = OpLoad %v3float %arg_2 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %38 = OpCompositeExtract %float %35 2 + %40 = OpLoad %int %arg_3 + %39 = OpConvertSToF %float %40 + %41 = OpCompositeConstruct %v4float %36 %37 %38 %39 + %43 = OpLoad %int %arg_4 + %42 = OpConvertSToF %float %43 + %30 = OpImageSampleExplicitLod %v4float %34 %41 Lod %42 + %29 = OpCompositeExtract %float %30 0 + OpStore %res %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %46 + %48 = OpLabel + %49 = OpFunctionCall %void %textureSampleLevel_ae5e39 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %51 = OpLabel + %52 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %52 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %55 = OpLabel + %56 = OpFunctionCall %void %textureSampleLevel_ae5e39 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %58 = OpLabel + %59 = OpFunctionCall %void %textureSampleLevel_ae5e39 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.wgsl new file mode 100644 index 0000000000..730bdfdc52 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_depth_cube_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_ae5e39() { + var arg_2 = vec3(); + var arg_3 = 1; + var arg_4 = 0; + var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_ae5e39(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_ae5e39(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_ae5e39(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl new file mode 100644 index 0000000000..70b74095ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl @@ -0,0 +1,48 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d_array; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d_array, sampler: sampler, coords: vec2, array_index: i32, level: f32, @const offset: vec2) -> vec4 +fn textureSampleLevel_b7c55c() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.f; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_b7c55c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_b7c55c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_b7c55c(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..df52dfd933 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_b7c55c() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_b7c55c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_b7c55c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_b7c55c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..df52dfd933 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2DArray arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_b7c55c() { + float2 arg_2 = (0.0f).xx; + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_b7c55c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_b7c55c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_b7c55c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl new file mode 100644 index 0000000000..baad6220dd --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl @@ -0,0 +1,64 @@ +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +vec4 vertex_main() { + textureSampleLevel_b7c55c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +void fragment_main() { + textureSampleLevel_b7c55c(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2DArray arg_0_arg_1; + +void textureSampleLevel_b7c55c() { + vec2 arg_2 = vec2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0)); +} + +void compute_main() { + textureSampleLevel_b7c55c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl new file mode 100644 index 0000000000..a1882e9488 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureSampleLevel_b7c55c(texture2d_array tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + int arg_3 = 1; + float arg_4 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4), int2(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_b7c55c(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_b7c55c(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_b7c55c(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm new file mode 100644 index 0000000000..d7121f1b28 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_b7c55c "textureSampleLevel_b7c55c" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %arg_4 "arg_4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpTypeSampledImage %11 + %v3float = OpTypeVector %float 3 + %v2int = OpTypeVector %int 2 + %45 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %48 = OpTypeFunction %v4float +%textureSampleLevel_b7c55c = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_int Function %27 + %arg_4 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %int_1 + OpStore %arg_4 %float_1 + %32 = OpLoad %14 %arg_1 + %33 = OpLoad %11 %arg_0 + %35 = OpSampledImage %34 %33 %32 + %37 = OpLoad %v2float %arg_2 + %38 = OpCompositeExtract %float %37 0 + %39 = OpCompositeExtract %float %37 1 + %41 = OpLoad %int %arg_3 + %40 = OpConvertSToF %float %41 + %42 = OpCompositeConstruct %v3float %38 %39 %40 + %43 = OpLoad %float %arg_4 + %31 = OpImageSampleExplicitLod %v4float %35 %42 Lod|ConstOffset %43 %45 + OpStore %res %31 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %48 + %50 = OpLabel + %51 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %54 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %59 = OpLabel + %60 = OpFunctionCall %void %textureSampleLevel_b7c55c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl new file mode 100644 index 0000000000..b03c566d0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +@group(1) @binding(0) var arg_0 : texture_2d_array; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_b7c55c() { + var arg_2 = vec2(); + var arg_3 = 1; + var arg_4 = 1.0f; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_b7c55c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_b7c55c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_b7c55c(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl new file mode 100644 index 0000000000..9339db55a1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_cube; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_cube, sampler: sampler, coords: vec3, level: f32) -> vec4 +fn textureSampleLevel_c32df7() { + var arg_2 = vec3(); + var arg_3 = 1.f; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c32df7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_c32df7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c32df7(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e5a4de66d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c32df7() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c32df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c32df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c32df7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5a4de66d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +TextureCube arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c32df7() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c32df7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c32df7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c32df7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl new file mode 100644 index 0000000000..91a2a08fdc --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleLevel_c32df7() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureSampleLevel_c32df7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleLevel_c32df7() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleLevel_c32df7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp samplerCube arg_0_arg_1; + +void textureSampleLevel_c32df7() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureSampleLevel_c32df7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl new file mode 100644 index 0000000000..aed75443b3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_c32df7(texturecube tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texturecube tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_c32df7(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texturecube tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texturecube tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_c32df7(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texturecube tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_c32df7(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5cb38fd69 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_c32df7 "textureSampleLevel_c32df7" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureSampleLevel_c32df7 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleLevel_c32df7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_c32df7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_c32df7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl new file mode 100644 index 0000000000..46209393d4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_cube; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_c32df7() { + var arg_2 = vec3(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c32df7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_c32df7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c32df7(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl new file mode 100644 index 0000000000..9c03fdcb85 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_2d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_2d, sampler: sampler, coords: vec2, level: f32) -> vec4 +fn textureSampleLevel_c6aca6() { + var arg_2 = vec2(); + var arg_3 = 1.f; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c6aca6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_c6aca6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c6aca6(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..812fee1354 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c6aca6() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c6aca6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c6aca6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c6aca6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..812fee1354 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture2D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_c6aca6() { + float2 arg_2 = (0.0f).xx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_c6aca6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_c6aca6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_c6aca6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl new file mode 100644 index 0000000000..7784b1e309 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_c6aca6() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +vec4 vertex_main() { + textureSampleLevel_c6aca6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_c6aca6() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void fragment_main() { + textureSampleLevel_c6aca6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler2D arg_0_arg_1; + +void textureSampleLevel_c6aca6() { + vec2 arg_2 = vec2(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3); +} + +void compute_main() { + textureSampleLevel_c6aca6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl new file mode 100644 index 0000000000..1f0f432365 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_c6aca6(texture2d tint_symbol_1, sampler tint_symbol_2) { + float2 arg_2 = float2(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_c6aca6(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_c6aca6(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture2d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_c6aca6(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm new file mode 100644 index 0000000000..f0f3069e9d --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_c6aca6 "textureSampleLevel_c6aca6" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %20 = OpConstantNull %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %35 = OpTypeFunction %v4float +%textureSampleLevel_c6aca6 = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v2float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v2float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod %32 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %35 + %37 = OpLabel + %38 = OpFunctionCall %void %textureSampleLevel_c6aca6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %40 = OpLabel + %41 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %41 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %void %textureSampleLevel_c6aca6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_c6aca6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl new file mode 100644 index 0000000000..9fe9c9fb16 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_2d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_c6aca6() { + var arg_2 = vec2(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_c6aca6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_c6aca6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_c6aca6(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl new file mode 100644 index 0000000000..68e6ca4ab9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_3d; +@group(1) @binding(1) var arg_1: sampler; + +// fn textureSampleLevel(texture: texture_3d, sampler: sampler, coords: vec3, level: f32, @const offset: vec3) -> vec4 +fn textureSampleLevel_dcbecb() { + var arg_2 = vec3(); + var arg_3 = 1.f; + var res: vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_dcbecb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_dcbecb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_dcbecb(); +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1c3bad7651 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_dcbecb() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_dcbecb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_dcbecb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_dcbecb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c3bad7651 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +Texture3D arg_0 : register(t0, space1); +SamplerState arg_1 : register(s1, space1); + +void textureSampleLevel_dcbecb() { + float3 arg_2 = (0.0f).xxx; + float arg_3 = 1.0f; + float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xxx); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureSampleLevel_dcbecb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureSampleLevel_dcbecb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureSampleLevel_dcbecb(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl new file mode 100644 index 0000000000..3875ed6679 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec3(0)); +} + +vec4 vertex_main() { + textureSampleLevel_dcbecb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec3(0)); +} + +void fragment_main() { + textureSampleLevel_dcbecb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +uniform highp sampler3D arg_0_arg_1; + +void textureSampleLevel_dcbecb() { + vec3 arg_2 = vec3(0.0f); + float arg_3 = 1.0f; + vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec3(0)); +} + +void compute_main() { + textureSampleLevel_dcbecb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl new file mode 100644 index 0000000000..9068307c0c --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureSampleLevel_dcbecb(texture3d tint_symbol_1, sampler tint_symbol_2) { + float3 arg_2 = float3(0.0f); + float arg_3 = 1.0f; + float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3), int3(0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_3, sampler tint_symbol_4) { + textureSampleLevel_dcbecb(tint_symbol_3, tint_symbol_4); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) { + textureSampleLevel_dcbecb(tint_symbol_7, tint_symbol_8); + return; +} + +kernel void compute_main(texture3d tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) { + textureSampleLevel_dcbecb(tint_symbol_9, tint_symbol_10); + return; +} + diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm new file mode 100644 index 0000000000..59538e76a6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %arg_1 "arg_1" + OpName %textureSampleLevel_dcbecb "textureSampleLevel_dcbecb" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + OpDecorate %arg_1 DescriptorSet 1 + OpDecorate %arg_1 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %20 = OpConstantNull %v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpTypeSampledImage %11 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %35 = OpConstantNull %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %38 = OpTypeFunction %v4float +%textureSampleLevel_dcbecb = OpFunction %void None %15 + %18 = OpLabel + %arg_2 = OpVariable %_ptr_Function_v3float Function %20 + %arg_3 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_2 %20 + OpStore %arg_3 %float_1 + %27 = OpLoad %14 %arg_1 + %28 = OpLoad %11 %arg_0 + %30 = OpSampledImage %29 %28 %27 + %31 = OpLoad %v3float %arg_2 + %32 = OpLoad %float %arg_3 + %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod|ConstOffset %32 %35 + OpStore %res %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %15 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %15 + %46 = OpLabel + %47 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %textureSampleLevel_dcbecb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl new file mode 100644 index 0000000000..298cf72c9e --- /dev/null +++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +@group(1) @binding(0) var arg_0 : texture_3d; + +@group(1) @binding(1) var arg_1 : sampler; + +fn textureSampleLevel_dcbecb() { + var arg_2 = vec3(); + var arg_3 = 1.0f; + var res : vec4 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec3()); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureSampleLevel_dcbecb(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureSampleLevel_dcbecb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureSampleLevel_dcbecb(); +} diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl new file mode 100644 index 0000000000..9195e698d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_05ce15() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_05ce15(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_05ce15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_05ce15(); +} diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c83a95c0fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_05ce15() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_05ce15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_05ce15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_05ce15(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c83a95c0fd --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_05ce15() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_05ce15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_05ce15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_05ce15(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl new file mode 100644 index 0000000000..5437eda3ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureStore_05ce15() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_05ce15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureStore_05ce15() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_05ce15(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2D arg_0; +void textureStore_05ce15() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_05ce15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl new file mode 100644 index 0000000000..9eb8590790 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_05ce15(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_05ce15(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_05ce15(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_05ce15(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm new file mode 100644 index 0000000000..8120c433d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_05ce15 "textureStore_05ce15" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_05ce15 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_05ce15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_05ce15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_05ce15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl new file mode 100644 index 0000000000..85050b5e87 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_05ce15() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_05ce15(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_05ce15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_05ce15(); +} diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl new file mode 100644 index 0000000000..d1ee9965f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_064c7f() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_064c7f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_064c7f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_064c7f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8adf145298 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_064c7f() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_064c7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_064c7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_064c7f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8adf145298 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_064c7f() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_064c7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_064c7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_064c7f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl new file mode 100644 index 0000000000..b7cf6cd5b7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureStore_064c7f() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_064c7f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureStore_064c7f() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_064c7f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2D arg_0; +void textureStore_064c7f() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_064c7f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl new file mode 100644 index 0000000000..00a4cf7bf7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_064c7f(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_064c7f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_064c7f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_064c7f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm new file mode 100644 index 0000000000..d6d60c0d1d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_064c7f "textureStore_064c7f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_064c7f = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_064c7f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_064c7f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_064c7f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba056bcdc1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_064c7f() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_064c7f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_064c7f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_064c7f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl new file mode 100644 index 0000000000..32f39e33e3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_068641() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_068641(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_068641(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_068641(); +} diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..092e801f92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_068641() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_068641(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_068641(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_068641(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..092e801f92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_068641() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_068641(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_068641(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_068641(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl new file mode 100644 index 0000000000..f84a5f2ad5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureStore_068641() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_068641(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureStore_068641() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_068641(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage3D arg_0; +void textureStore_068641() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_068641(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl new file mode 100644 index 0000000000..a35ed83af9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_068641(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_068641(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_068641(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_068641(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm new file mode 100644 index 0000000000..b77d315a09 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_068641 "textureStore_068641" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_068641 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_068641 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_068641 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_068641 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl new file mode 100644 index 0000000000..bad48dd022 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_068641() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_068641(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_068641(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_068641(); +} diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl new file mode 100644 index 0000000000..8814567883 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_0af6b5() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0af6b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_0af6b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_0af6b5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a0e877b0d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0af6b5() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0af6b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0af6b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0af6b5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a0e877b0d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0af6b5() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0af6b5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0af6b5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0af6b5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl new file mode 100644 index 0000000000..1ae6b6b55d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureStore_0af6b5() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_0af6b5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureStore_0af6b5() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_0af6b5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2D arg_0; +void textureStore_0af6b5() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_0af6b5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl new file mode 100644 index 0000000000..cbf31010c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_0af6b5(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_0af6b5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_0af6b5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_0af6b5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c11b9d396 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_0af6b5 "textureStore_0af6b5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_0af6b5 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_0af6b5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_0af6b5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_0af6b5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl new file mode 100644 index 0000000000..cba9b0299d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_0af6b5() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0af6b5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_0af6b5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_0af6b5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl new file mode 100644 index 0000000000..09d159576d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_0c3dff() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0c3dff(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_0c3dff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_0c3dff(); +} diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2c960efa6f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0c3dff() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0c3dff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0c3dff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0c3dff(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2c960efa6f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_0c3dff() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_0c3dff(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_0c3dff(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_0c3dff(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl new file mode 100644 index 0000000000..216ba1ae82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureStore_0c3dff() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_0c3dff(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureStore_0c3dff() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_0c3dff(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2D arg_0; +void textureStore_0c3dff() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_0c3dff(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl new file mode 100644 index 0000000000..7778f10003 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_0c3dff(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_0c3dff(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_0c3dff(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_0c3dff(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5e6876376 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_0c3dff "textureStore_0c3dff" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_0c3dff = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_0c3dff + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_0c3dff + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_0c3dff + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl new file mode 100644 index 0000000000..3da20f2e56 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_0c3dff() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_0c3dff(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_0c3dff(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_0c3dff(); +} diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl new file mode 100644 index 0000000000..4a695579d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_102722() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_102722(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_102722(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_102722(); +} diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e256ac82da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_102722() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_102722(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_102722(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_102722(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e256ac82da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_102722() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_102722(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_102722(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_102722(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl new file mode 100644 index 0000000000..79c3f3a7d3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_102722() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_102722(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_102722() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_102722(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_102722() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_102722(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl new file mode 100644 index 0000000000..f197dcc1af --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_102722(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_102722(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_102722(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_102722(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm new file mode 100644 index 0000000000..0311196930 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_102722 "textureStore_102722" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_102722 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_102722 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_102722 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_102722 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl new file mode 100644 index 0000000000..6abacf8be8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_102722() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_102722(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_102722(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_102722(); +} diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl new file mode 100644 index 0000000000..4445c3d0a6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_1bbd08() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1bbd08(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_1bbd08(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_1bbd08(); +} diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9bbd9cf51d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_1bbd08() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1bbd08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1bbd08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1bbd08(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9bbd9cf51d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_1bbd08() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1bbd08(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1bbd08(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1bbd08(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl new file mode 100644 index 0000000000..8bbedc5a87 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureStore_1bbd08() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_1bbd08(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureStore_1bbd08() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_1bbd08(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image3D arg_0; +void textureStore_1bbd08() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_1bbd08(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl new file mode 100644 index 0000000000..a09fc63482 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_1bbd08(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_1bbd08(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_1bbd08(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_1bbd08(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5356afe90 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_1bbd08 "textureStore_1bbd08" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_1bbd08 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_1bbd08 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_1bbd08 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_1bbd08 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl new file mode 100644 index 0000000000..7043ee1847 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_1bbd08() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1bbd08(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_1bbd08(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_1bbd08(); +} diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl new file mode 100644 index 0000000000..bb1ab311da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_1c02e7() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1c02e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_1c02e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_1c02e7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4fe7a79eec --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_1c02e7() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1c02e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1c02e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1c02e7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4fe7a79eec --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_1c02e7() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_1c02e7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_1c02e7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_1c02e7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl new file mode 100644 index 0000000000..43e87d1e0a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_1c02e7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_1c02e7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_1c02e7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_1c02e7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_1c02e7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_1c02e7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl new file mode 100644 index 0000000000..a2ef827b92 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_1c02e7(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_1c02e7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_1c02e7(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_1c02e7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.spvasm new file mode 100644 index 0000000000..8497c205e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_1c02e7 "textureStore_1c02e7" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_1c02e7 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_1c02e7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_1c02e7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_1c02e7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1665ea0f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_1c02e7() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_1c02e7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_1c02e7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_1c02e7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl new file mode 100644 index 0000000000..5b65d69225 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_22d955() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_22d955(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_22d955(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_22d955(); +} diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ac28249652 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_22d955() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_22d955(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_22d955(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_22d955(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac28249652 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_22d955() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_22d955(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_22d955(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_22d955(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl new file mode 100644 index 0000000000..d8279c2c8f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_22d955() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_22d955(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_22d955() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_22d955(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_22d955() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_22d955(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl new file mode 100644 index 0000000000..be88306d8c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_22d955(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_22d955(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_22d955(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_22d955(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm new file mode 100644 index 0000000000..dff6bf19ff --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_22d955 "textureStore_22d955" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_22d955 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_22d955 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_22d955 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_22d955 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl new file mode 100644 index 0000000000..d46610c035 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_22d955() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_22d955(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_22d955(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_22d955(); +} diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl new file mode 100644 index 0000000000..137e2cd63f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_26bf70() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_26bf70(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_26bf70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_26bf70(); +} diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..57341d9428 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_26bf70() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_26bf70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_26bf70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_26bf70(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..57341d9428 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_26bf70() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_26bf70(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_26bf70(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_26bf70(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl new file mode 100644 index 0000000000..048b5b4332 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_26bf70() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_26bf70(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_26bf70() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_26bf70(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_26bf70() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_26bf70(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl new file mode 100644 index 0000000000..73242ad956 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_26bf70(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_26bf70(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_26bf70(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_26bf70(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm new file mode 100644 index 0000000000..188aded061 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_26bf70 "textureStore_26bf70" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_26bf70 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_26bf70 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_26bf70 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_26bf70 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl new file mode 100644 index 0000000000..9585cafc5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_26bf70() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_26bf70(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_26bf70(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_26bf70(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl new file mode 100644 index 0000000000..39d8497c7a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_2796b4() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2796b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2796b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2796b4(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..63eefce1cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_2796b4() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2796b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2796b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2796b4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63eefce1cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_2796b4() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2796b4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2796b4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2796b4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl new file mode 100644 index 0000000000..8b3dd99ab9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureStore_2796b4() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_2796b4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureStore_2796b4() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_2796b4(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage3D arg_0; +void textureStore_2796b4() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_2796b4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl new file mode 100644 index 0000000000..c2ebcd9a9f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_2796b4(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_2796b4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_2796b4(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_2796b4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm new file mode 100644 index 0000000000..d79adda805 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_2796b4 "textureStore_2796b4" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_2796b4 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_2796b4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_2796b4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_2796b4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl new file mode 100644 index 0000000000..00dfc5d60c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_2796b4() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2796b4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2796b4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2796b4(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl new file mode 100644 index 0000000000..fa72662e62 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_2ac6c7() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ac6c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2ac6c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2ac6c7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..299e980785 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ac6c7() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ac6c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ac6c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ac6c7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..299e980785 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ac6c7() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ac6c7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ac6c7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ac6c7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl new file mode 100644 index 0000000000..199d3fd88d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureStore_2ac6c7() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_2ac6c7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureStore_2ac6c7() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_2ac6c7(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32f) uniform highp writeonly image1D arg_0; +void textureStore_2ac6c7() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_2ac6c7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl new file mode 100644 index 0000000000..da12ebc7d2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_2ac6c7(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_2ac6c7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_2ac6c7(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_2ac6c7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm new file mode 100644 index 0000000000..f15467a58d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_2ac6c7 "textureStore_2ac6c7" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_2ac6c7 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_2ac6c7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_2ac6c7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_2ac6c7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl new file mode 100644 index 0000000000..c370053ba8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_2ac6c7() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ac6c7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2ac6c7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2ac6c7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl new file mode 100644 index 0000000000..d1e78a7e7e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_2eb2a4() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2eb2a4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2eb2a4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2eb2a4(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..36b1326f29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2eb2a4() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2eb2a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2eb2a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2eb2a4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..36b1326f29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2eb2a4() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2eb2a4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2eb2a4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2eb2a4(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl new file mode 100644 index 0000000000..3d85eaf4f5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureStore_2eb2a4() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_2eb2a4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureStore_2eb2a4() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_2eb2a4(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage1D arg_0; +void textureStore_2eb2a4() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_2eb2a4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl new file mode 100644 index 0000000000..07e1c2a3b4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_2eb2a4(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_2eb2a4(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_2eb2a4(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_2eb2a4(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm new file mode 100644 index 0000000000..c00ec81f1d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_2eb2a4 "textureStore_2eb2a4" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_2eb2a4 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_2eb2a4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_2eb2a4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_2eb2a4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed6ea1f703 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_2eb2a4() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2eb2a4(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2eb2a4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2eb2a4(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl new file mode 100644 index 0000000000..3d95b21d00 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_2ed2a3() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ed2a3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2ed2a3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2ed2a3(); +} diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5d63a7b6ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ed2a3() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ed2a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ed2a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ed2a3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5d63a7b6ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_2ed2a3() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_2ed2a3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_2ed2a3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_2ed2a3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl new file mode 100644 index 0000000000..90689a7c8e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureStore_2ed2a3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_2ed2a3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureStore_2ed2a3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_2ed2a3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image1D arg_0; +void textureStore_2ed2a3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_2ed2a3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl new file mode 100644 index 0000000000..e3b850b99d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_2ed2a3(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_2ed2a3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_2ed2a3(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_2ed2a3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm new file mode 100644 index 0000000000..c692c2f9a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_2ed2a3 "textureStore_2ed2a3" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_2ed2a3 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_2ed2a3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_2ed2a3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_2ed2a3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl new file mode 100644 index 0000000000..811df1cdf6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_2ed2a3() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_2ed2a3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_2ed2a3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_2ed2a3(); +} diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl new file mode 100644 index 0000000000..05bde5ffcf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_31745b() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_31745b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_31745b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_31745b(); +} diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..33865302fc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_31745b() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_31745b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_31745b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_31745b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..33865302fc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_31745b() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_31745b(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_31745b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_31745b(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl new file mode 100644 index 0000000000..e5e4f60990 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureStore_31745b() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_31745b(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureStore_31745b() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_31745b(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2D arg_0; +void textureStore_31745b() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_31745b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl new file mode 100644 index 0000000000..bde273accd --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_31745b(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_31745b(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_31745b(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_31745b(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm new file mode 100644 index 0000000000..016eb27321 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_31745b "textureStore_31745b" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_31745b = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_31745b + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_31745b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_31745b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl new file mode 100644 index 0000000000..03ffd0b2a9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_31745b() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_31745b(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_31745b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_31745b(); +} diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl new file mode 100644 index 0000000000..33bbe0b39e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_32f368() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_32f368(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_32f368(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_32f368(); +} diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1c217b20a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_32f368() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_32f368(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_32f368(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_32f368(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c217b20a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_32f368() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_32f368(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_32f368(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_32f368(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl new file mode 100644 index 0000000000..b86d5eb850 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureStore_32f368() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_32f368(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureStore_32f368() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_32f368(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2DArray arg_0; +void textureStore_32f368() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_32f368(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl new file mode 100644 index 0000000000..3daf6cbadb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_32f368(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_32f368(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_32f368(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_32f368(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm new file mode 100644 index 0000000000..a154105c0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_32f368 "textureStore_32f368" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_32f368 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_32f368 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_32f368 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_32f368 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e57641c60 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_32f368() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_32f368(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_32f368(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_32f368(); +} diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl new file mode 100644 index 0000000000..55d78a093e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_331aee() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_331aee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_331aee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_331aee(); +} diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1070c26429 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_331aee() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_331aee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_331aee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_331aee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1070c26429 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_331aee() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_331aee(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_331aee(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_331aee(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl new file mode 100644 index 0000000000..6d0ade0e9f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureStore_331aee() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_331aee(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureStore_331aee() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_331aee(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image3D arg_0; +void textureStore_331aee() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_331aee(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl new file mode 100644 index 0000000000..94c0dee52b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_331aee(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_331aee(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_331aee(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_331aee(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm new file mode 100644 index 0000000000..df8cccf6e2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_331aee "textureStore_331aee" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_331aee = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_331aee + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_331aee + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_331aee + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl new file mode 100644 index 0000000000..97cea3bf30 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_331aee() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_331aee(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_331aee(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_331aee(); +} diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl new file mode 100644 index 0000000000..5f292f384f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_38e8d7() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_38e8d7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_38e8d7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_38e8d7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e867ecc1c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_38e8d7() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_38e8d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_38e8d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_38e8d7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6e867ecc1c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_38e8d7() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_38e8d7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_38e8d7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_38e8d7(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl new file mode 100644 index 0000000000..7a6850e040 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_38e8d7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_38e8d7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_38e8d7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_38e8d7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_38e8d7() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_38e8d7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl new file mode 100644 index 0000000000..c22bedbdef --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_38e8d7(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_38e8d7(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_38e8d7(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_38e8d7(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm new file mode 100644 index 0000000000..623d520d43 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_38e8d7 "textureStore_38e8d7" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_38e8d7 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_38e8d7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_38e8d7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_38e8d7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ae4af0511 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_38e8d7() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_38e8d7(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_38e8d7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_38e8d7(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl new file mode 100644 index 0000000000..1ec9c4ccb5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_3a52ac() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3a52ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3a52ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3a52ac(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f682606ef8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3a52ac() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3a52ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3a52ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3a52ac(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f682606ef8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3a52ac() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3a52ac(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3a52ac(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3a52ac(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl new file mode 100644 index 0000000000..4ae9505508 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_3a52ac() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_3a52ac(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_3a52ac() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_3a52ac(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_3a52ac() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_3a52ac(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl new file mode 100644 index 0000000000..e243637964 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_3a52ac(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_3a52ac(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_3a52ac(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_3a52ac(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef89e77746 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_3a52ac "textureStore_3a52ac" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_3a52ac = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_3a52ac + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_3a52ac + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_3a52ac + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl new file mode 100644 index 0000000000..b213fc0509 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_3a52ac() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3a52ac(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3a52ac(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3a52ac(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl new file mode 100644 index 0000000000..d3e2ca2fad --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_3bb7a1() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bb7a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3bb7a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3bb7a1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e18ed4d8d4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3bb7a1() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bb7a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bb7a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bb7a1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e18ed4d8d4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_3bb7a1() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bb7a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bb7a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bb7a1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl new file mode 100644 index 0000000000..a46b20beaa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureStore_3bb7a1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_3bb7a1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureStore_3bb7a1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_3bb7a1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image2DArray arg_0; +void textureStore_3bb7a1() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_3bb7a1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl new file mode 100644 index 0000000000..70c180e005 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_3bb7a1(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_3bb7a1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_3bb7a1(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_3bb7a1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7e7b38d38 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_3bb7a1 "textureStore_3bb7a1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_3bb7a1 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_3bb7a1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_3bb7a1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_3bb7a1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl new file mode 100644 index 0000000000..e8a6e50305 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_3bb7a1() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bb7a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3bb7a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3bb7a1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl new file mode 100644 index 0000000000..17e5c74582 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_3bec15() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bec15(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3bec15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3bec15(); +} diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7092f585ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_3bec15() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bec15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bec15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bec15(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7092f585ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_3bec15() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_3bec15(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_3bec15(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_3bec15(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl new file mode 100644 index 0000000000..99b7eef8e6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureStore_3bec15() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_3bec15(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureStore_3bec15() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_3bec15(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage1D arg_0; +void textureStore_3bec15() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_3bec15(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl new file mode 100644 index 0000000000..75e47f1ba6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_3bec15(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_3bec15(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_3bec15(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_3bec15(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm new file mode 100644 index 0000000000..4688a0fe23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_3bec15 "textureStore_3bec15" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_3bec15 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_3bec15 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_3bec15 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_3bec15 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b320e3cef --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_3bec15() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_3bec15(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_3bec15(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_3bec15(); +} diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl new file mode 100644 index 0000000000..5fe3eb259d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_441ba8() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_441ba8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_441ba8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_441ba8(); +} diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3af481a9be --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_441ba8() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_441ba8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_441ba8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_441ba8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3af481a9be --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_441ba8() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_441ba8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_441ba8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_441ba8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl new file mode 100644 index 0000000000..ef4af5194c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_441ba8() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_441ba8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_441ba8() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_441ba8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_441ba8() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_441ba8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl new file mode 100644 index 0000000000..1464ab71ad --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_441ba8(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_441ba8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_441ba8(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_441ba8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6748801df --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_441ba8 "textureStore_441ba8" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_441ba8 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_441ba8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_441ba8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_441ba8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl new file mode 100644 index 0000000000..773999aa38 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_441ba8() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_441ba8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_441ba8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_441ba8(); +} diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl new file mode 100644 index 0000000000..f728b23ef3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_4fc057() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_4fc057(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_4fc057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_4fc057(); +} diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee4b614355 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_4fc057() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_4fc057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_4fc057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_4fc057(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ee4b614355 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_4fc057() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_4fc057(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_4fc057(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_4fc057(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl new file mode 100644 index 0000000000..039e0bb9d9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureStore_4fc057() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_4fc057(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureStore_4fc057() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_4fc057(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0; +void textureStore_4fc057() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_4fc057(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl new file mode 100644 index 0000000000..c7d5dbbda7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_4fc057(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_4fc057(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_4fc057(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_4fc057(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm new file mode 100644 index 0000000000..710a585b1b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_4fc057 "textureStore_4fc057" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_4fc057 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_4fc057 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_4fc057 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_4fc057 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cd0bf7b8d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_4fc057() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_4fc057(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_4fc057(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_4fc057(); +} diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl new file mode 100644 index 0000000000..7ea8bb1853 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_5a2f8f() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_5a2f8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_5a2f8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_5a2f8f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f6002770bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_5a2f8f() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_5a2f8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_5a2f8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_5a2f8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6002770bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_5a2f8f() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_5a2f8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_5a2f8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_5a2f8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl new file mode 100644 index 0000000000..00c217817c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureStore_5a2f8f() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_5a2f8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureStore_5a2f8f() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_5a2f8f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage1D arg_0; +void textureStore_5a2f8f() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_5a2f8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl new file mode 100644 index 0000000000..7ffe1a41c7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_5a2f8f(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_5a2f8f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_5a2f8f(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_5a2f8f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fd643704e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_5a2f8f "textureStore_5a2f8f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_5a2f8f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_5a2f8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_5a2f8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_5a2f8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..26334c9808 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_5a2f8f() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_5a2f8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_5a2f8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_5a2f8f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl new file mode 100644 index 0000000000..faae6ca3af --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_60975f() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_60975f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_60975f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_60975f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..15c91c67eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_60975f() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_60975f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_60975f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_60975f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15c91c67eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_60975f() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_60975f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_60975f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_60975f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl new file mode 100644 index 0000000000..0a167a8d5d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureStore_60975f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_60975f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureStore_60975f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_60975f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2DArray arg_0; +void textureStore_60975f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_60975f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl new file mode 100644 index 0000000000..e70fe51588 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_60975f(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_60975f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_60975f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_60975f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm new file mode 100644 index 0000000000..7807d15407 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_60975f "textureStore_60975f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_60975f = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_60975f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_60975f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_60975f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl new file mode 100644 index 0000000000..896fd6378e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_60975f() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_60975f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_60975f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_60975f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl new file mode 100644 index 0000000000..4f6e6dfad2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_682fd6() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_682fd6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_682fd6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_682fd6(); +} diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..613ddb2446 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_682fd6() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_682fd6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_682fd6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_682fd6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..613ddb2446 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_682fd6() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_682fd6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_682fd6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_682fd6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl new file mode 100644 index 0000000000..02980deab8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_682fd6() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_682fd6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_682fd6() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_682fd6(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_682fd6() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_682fd6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl new file mode 100644 index 0000000000..8ef52b03f9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_682fd6(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_682fd6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_682fd6(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_682fd6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7ffff92e8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_682fd6 "textureStore_682fd6" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_682fd6 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_682fd6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_682fd6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_682fd6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl new file mode 100644 index 0000000000..a7d1e078f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_682fd6() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_682fd6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_682fd6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_682fd6(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl new file mode 100644 index 0000000000..aeb1fd844f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_6b75c3() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b75c3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6b75c3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6b75c3(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d1842f9a0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b75c3() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b75c3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b75c3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b75c3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d1842f9a0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b75c3() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b75c3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b75c3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b75c3(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl new file mode 100644 index 0000000000..851f0cb487 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureStore_6b75c3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_6b75c3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureStore_6b75c3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_6b75c3(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32f) uniform highp writeonly image1D arg_0; +void textureStore_6b75c3() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_6b75c3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl new file mode 100644 index 0000000000..525cdb8cf8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_6b75c3(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_6b75c3(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_6b75c3(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_6b75c3(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm new file mode 100644 index 0000000000..436599f7ec --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_6b75c3 "textureStore_6b75c3" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_6b75c3 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_6b75c3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_6b75c3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_6b75c3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl new file mode 100644 index 0000000000..37dfe80df4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_6b75c3() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b75c3(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6b75c3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6b75c3(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl new file mode 100644 index 0000000000..46f56c572c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_6b80d2() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b80d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6b80d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6b80d2(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dc45c996a0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b80d2() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b80d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b80d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b80d2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dc45c996a0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_6b80d2() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6b80d2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6b80d2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6b80d2(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl new file mode 100644 index 0000000000..2fd85dc9f8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureStore_6b80d2() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_6b80d2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureStore_6b80d2() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_6b80d2(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(r32i) uniform highp writeonly iimage1D arg_0; +void textureStore_6b80d2() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_6b80d2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl new file mode 100644 index 0000000000..4ec6f6e3c5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_6b80d2(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_6b80d2(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_6b80d2(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_6b80d2(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc127a7c30 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_6b80d2 "textureStore_6b80d2" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_6b80d2 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_6b80d2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_6b80d2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_6b80d2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl new file mode 100644 index 0000000000..84625decdf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_6b80d2() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6b80d2(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6b80d2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6b80d2(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl new file mode 100644 index 0000000000..21f50ca627 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_6cff2e() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6cff2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6cff2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6cff2e(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..030b9a173c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_6cff2e() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6cff2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6cff2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6cff2e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..030b9a173c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_6cff2e() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6cff2e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6cff2e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6cff2e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl new file mode 100644 index 0000000000..31dca2829c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_6cff2e() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_6cff2e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_6cff2e() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_6cff2e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage2D arg_0; +void textureStore_6cff2e() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_6cff2e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl new file mode 100644 index 0000000000..47ac09aac6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_6cff2e(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_6cff2e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_6cff2e(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_6cff2e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm new file mode 100644 index 0000000000..7907a0009e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_6cff2e "textureStore_6cff2e" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_6cff2e = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_6cff2e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_6cff2e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_6cff2e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl new file mode 100644 index 0000000000..37ba249a35 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_6cff2e() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6cff2e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6cff2e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6cff2e(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl new file mode 100644 index 0000000000..d9909e6485 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_6da692() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6da692(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6da692(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6da692(); +} diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2188ce1d44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_6da692() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6da692(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6da692(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6da692(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2188ce1d44 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_6da692() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_6da692(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_6da692(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_6da692(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl new file mode 100644 index 0000000000..c7bc567f98 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_6da692() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_6da692(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_6da692() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_6da692(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_6da692() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_6da692(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl new file mode 100644 index 0000000000..305d2bdb7c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_6da692(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_6da692(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_6da692(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_6da692(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm new file mode 100644 index 0000000000..4296871beb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_6da692 "textureStore_6da692" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_6da692 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_6da692 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_6da692 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_6da692 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl new file mode 100644 index 0000000000..c54b75ba61 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_6da692() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_6da692(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_6da692(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_6da692(); +} diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl new file mode 100644 index 0000000000..c28f3a2347 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_731349() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_731349(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_731349(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_731349(); +} diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..96475461bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_731349() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_731349(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_731349(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_731349(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..96475461bf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_731349() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_731349(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_731349(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_731349(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl new file mode 100644 index 0000000000..2fc13d7a11 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureStore_731349() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_731349(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureStore_731349() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_731349(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8) uniform highp writeonly image2D arg_0; +void textureStore_731349() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_731349(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl new file mode 100644 index 0000000000..f7898d74ca --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_731349(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_731349(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_731349(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_731349(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d4982f853 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_731349 "textureStore_731349" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_731349 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_731349 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_731349 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_731349 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl new file mode 100644 index 0000000000..eb1aa14f46 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_731349() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_731349(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_731349(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_731349(); +} diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl new file mode 100644 index 0000000000..e085cce799 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_752da6() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_752da6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_752da6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_752da6(); +} diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..74afe66697 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_752da6() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_752da6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_752da6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_752da6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..74afe66697 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_752da6() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_752da6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_752da6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_752da6(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl new file mode 100644 index 0000000000..4c49f79992 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureStore_752da6() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_752da6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureStore_752da6() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_752da6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2D arg_0; +void textureStore_752da6() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_752da6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl new file mode 100644 index 0000000000..14805dc55f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_752da6(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_752da6(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_752da6(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_752da6(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b831a25d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_752da6 "textureStore_752da6" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_752da6 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_752da6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_752da6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_752da6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl new file mode 100644 index 0000000000..5ec1d8d7df --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_752da6() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_752da6(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_752da6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_752da6(); +} diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl new file mode 100644 index 0000000000..052401c266 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_77c0ae() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_77c0ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_77c0ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_77c0ae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..04dafb025f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_77c0ae() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_77c0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_77c0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_77c0ae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..04dafb025f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_77c0ae() { + int2 arg_1 = (0).xx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_77c0ae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_77c0ae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_77c0ae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl new file mode 100644 index 0000000000..ebdb9079da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureStore_77c0ae() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_77c0ae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureStore_77c0ae() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_77c0ae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage2D arg_0; +void textureStore_77c0ae() { + ivec2 arg_1 = ivec2(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_77c0ae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl new file mode 100644 index 0000000000..d7d84576de --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_77c0ae(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_77c0ae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_77c0ae(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_77c0ae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm new file mode 100644 index 0000000000..6bacd0e827 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_77c0ae "textureStore_77c0ae" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_77c0ae = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v2int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_77c0ae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_77c0ae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_77c0ae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl new file mode 100644 index 0000000000..28994fc19b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_77c0ae() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_77c0ae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_77c0ae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_77c0ae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl new file mode 100644 index 0000000000..48ab7ac534 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_7cec8d() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7cec8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_7cec8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_7cec8d(); +} diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d31432b373 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_7cec8d() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7cec8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7cec8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7cec8d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d31432b373 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_7cec8d() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7cec8d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7cec8d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7cec8d(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl new file mode 100644 index 0000000000..05b54d94dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_7cec8d() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_7cec8d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_7cec8d() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_7cec8d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_7cec8d() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_7cec8d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl new file mode 100644 index 0000000000..bc6820285a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_7cec8d(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_7cec8d(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_7cec8d(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_7cec8d(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.spvasm new file mode 100644 index 0000000000..b36ee5ff45 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_7cec8d "textureStore_7cec8d" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_7cec8d = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_7cec8d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_7cec8d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_7cec8d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d60abcd5e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_7cec8d() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7cec8d(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_7cec8d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_7cec8d(); +} diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl new file mode 100644 index 0000000000..29150849b1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_7f7fae() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7f7fae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_7f7fae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_7f7fae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6d80e547de --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_7f7fae() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7f7fae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7f7fae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7f7fae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6d80e547de --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_7f7fae() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_7f7fae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_7f7fae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_7f7fae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl new file mode 100644 index 0000000000..1658f25e1a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureStore_7f7fae() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_7f7fae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureStore_7f7fae() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_7f7fae(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8) uniform highp writeonly image1D arg_0; +void textureStore_7f7fae() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_7f7fae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl new file mode 100644 index 0000000000..a991af17f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_7f7fae(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_7f7fae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_7f7fae(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_7f7fae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm new file mode 100644 index 0000000000..aace840d49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_7f7fae "textureStore_7f7fae" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_7f7fae = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_7f7fae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_7f7fae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_7f7fae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl new file mode 100644 index 0000000000..accb7c0e70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_7f7fae() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_7f7fae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_7f7fae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_7f7fae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl new file mode 100644 index 0000000000..f2bae965ef --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_804942() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_804942(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_804942(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_804942(); +} diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f2f0dd3b7d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_804942() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_804942(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_804942(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_804942(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f2f0dd3b7d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_804942() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_804942(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_804942(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_804942(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl new file mode 100644 index 0000000000..e99ccc58e4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureStore_804942() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_804942(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureStore_804942() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_804942(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage2D arg_0; +void textureStore_804942() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_804942(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl new file mode 100644 index 0000000000..d2e755d720 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_804942(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_804942(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_804942(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_804942(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6cc2c9c14 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_804942 "textureStore_804942" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_804942 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_804942 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_804942 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_804942 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl new file mode 100644 index 0000000000..171f2496e5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_804942() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_804942(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_804942(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_804942(); +} diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl new file mode 100644 index 0000000000..d38a59f17a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_805dae() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_805dae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_805dae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_805dae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b251d9f807 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_805dae() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_805dae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_805dae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_805dae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b251d9f807 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_805dae() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_805dae(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_805dae(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_805dae(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl new file mode 100644 index 0000000000..77e3041e20 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureStore_805dae() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_805dae(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureStore_805dae() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_805dae(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image2D arg_0; +void textureStore_805dae() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_805dae(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl new file mode 100644 index 0000000000..8ba8e4802e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_805dae(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_805dae(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_805dae(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_805dae(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm new file mode 100644 index 0000000000..0bcb46d765 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_805dae "textureStore_805dae" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_805dae = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_805dae + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_805dae + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_805dae + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e6f446db3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_805dae() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_805dae(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_805dae(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_805dae(); +} diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl new file mode 100644 index 0000000000..1e8241180b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_83bcc1() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_83bcc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_83bcc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_83bcc1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b606a3a1ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_83bcc1() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_83bcc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_83bcc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_83bcc1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b606a3a1ab --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_83bcc1() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_83bcc1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_83bcc1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_83bcc1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl new file mode 100644 index 0000000000..d44613f744 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_83bcc1() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_83bcc1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_83bcc1() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_83bcc1(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_83bcc1() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_83bcc1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl new file mode 100644 index 0000000000..bf59f21af9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_83bcc1(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_83bcc1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_83bcc1(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_83bcc1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm new file mode 100644 index 0000000000..da8b6bf230 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_83bcc1 "textureStore_83bcc1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_83bcc1 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_83bcc1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_83bcc1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_83bcc1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl new file mode 100644 index 0000000000..32662db119 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_83bcc1() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_83bcc1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_83bcc1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_83bcc1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl new file mode 100644 index 0000000000..e96ce4ca0e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_872747() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_872747(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_872747(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_872747(); +} diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9c937a509e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_872747() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_872747(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_872747(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_872747(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c937a509e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_872747() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_872747(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_872747(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_872747(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl new file mode 100644 index 0000000000..c07a4da762 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureStore_872747() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_872747(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureStore_872747() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_872747(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image1D arg_0; +void textureStore_872747() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_872747(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl new file mode 100644 index 0000000000..fcb5caa91f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_872747(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_872747(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_872747(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_872747(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm new file mode 100644 index 0000000000..a197ec4bcc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_872747 "textureStore_872747" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_872747 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_872747 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_872747 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_872747 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl new file mode 100644 index 0000000000..f1ce50d71f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_872747() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_872747(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_872747(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_872747(); +} diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl new file mode 100644 index 0000000000..832f27773c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_8e0479() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8e0479(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_8e0479(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_8e0479(); +} diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..24d93ef7cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_8e0479() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8e0479(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8e0479(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8e0479(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..24d93ef7cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_8e0479() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8e0479(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8e0479(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8e0479(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl new file mode 100644 index 0000000000..0a78791db4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_8e0479() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_8e0479(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_8e0479() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_8e0479(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_8e0479() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_8e0479(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl new file mode 100644 index 0000000000..6ad4aba381 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_8e0479(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_8e0479(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_8e0479(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_8e0479(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm new file mode 100644 index 0000000000..baca5da445 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_8e0479 "textureStore_8e0479" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_8e0479 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_8e0479 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_8e0479 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_8e0479 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl new file mode 100644 index 0000000000..1543d39c29 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_8e0479() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8e0479(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_8e0479(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_8e0479(); +} diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl new file mode 100644 index 0000000000..dd7f731af1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_8f71a1() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8f71a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_8f71a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_8f71a1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..513e3775f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_8f71a1() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8f71a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8f71a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8f71a1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..513e3775f0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_8f71a1() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_8f71a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_8f71a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_8f71a1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl new file mode 100644 index 0000000000..ebb51a8ba0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureStore_8f71a1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_8f71a1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureStore_8f71a1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_8f71a1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage3D arg_0; +void textureStore_8f71a1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_8f71a1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl new file mode 100644 index 0000000000..bf5a54ee48 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_8f71a1(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_8f71a1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_8f71a1(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_8f71a1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm new file mode 100644 index 0000000000..14926980e7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_8f71a1 "textureStore_8f71a1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_8f71a1 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_8f71a1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_8f71a1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_8f71a1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl new file mode 100644 index 0000000000..709f78ea49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_8f71a1() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_8f71a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_8f71a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_8f71a1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl new file mode 100644 index 0000000000..8c18b0b659 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_969534() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_969534(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_969534(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_969534(); +} diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abe1eac2a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_969534() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_969534(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_969534(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_969534(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..abe1eac2a2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_969534() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_969534(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_969534(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_969534(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl new file mode 100644 index 0000000000..488d24e1cc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureStore_969534() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_969534(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureStore_969534() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_969534(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage1D arg_0; +void textureStore_969534() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_969534(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl new file mode 100644 index 0000000000..aed04dd167 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_969534(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_969534(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_969534(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_969534(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm new file mode 100644 index 0000000000..74def9c76e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_969534 "textureStore_969534" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_969534 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_969534 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_969534 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_969534 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl new file mode 100644 index 0000000000..c83ec9523d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_969534() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_969534(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_969534(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_969534(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl new file mode 100644 index 0000000000..d732945f6f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_9a3ecc() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9a3ecc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9a3ecc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9a3ecc(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f6dae1cba2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_9a3ecc() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9a3ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9a3ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9a3ecc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6dae1cba2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_9a3ecc() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9a3ecc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9a3ecc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9a3ecc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl new file mode 100644 index 0000000000..9beb825420 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureStore_9a3ecc() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_9a3ecc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureStore_9a3ecc() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_9a3ecc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32i) uniform highp writeonly iimage3D arg_0; +void textureStore_9a3ecc() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_9a3ecc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl new file mode 100644 index 0000000000..44b8e33d0c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_9a3ecc(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_9a3ecc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_9a3ecc(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_9a3ecc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b6db7c21b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_9a3ecc "textureStore_9a3ecc" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_9a3ecc = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_9a3ecc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_9a3ecc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_9a3ecc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl new file mode 100644 index 0000000000..04f9424c83 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_9a3ecc() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9a3ecc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9a3ecc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9a3ecc(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl new file mode 100644 index 0000000000..214054a8a0 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_9d9cd5() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9d9cd5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9d9cd5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9d9cd5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..63531a6046 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_9d9cd5() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9d9cd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9d9cd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9d9cd5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63531a6046 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_9d9cd5() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9d9cd5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9d9cd5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9d9cd5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl new file mode 100644 index 0000000000..05a0d53f2d --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureStore_9d9cd5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_9d9cd5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureStore_9d9cd5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_9d9cd5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba32f) uniform highp writeonly image2DArray arg_0; +void textureStore_9d9cd5() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_9d9cd5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl new file mode 100644 index 0000000000..48036cda82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_9d9cd5(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_9d9cd5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_9d9cd5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_9d9cd5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e3237055b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_9d9cd5 "textureStore_9d9cd5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_9d9cd5 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_9d9cd5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_9d9cd5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_9d9cd5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl new file mode 100644 index 0000000000..b0dbf55d70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_9d9cd5() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9d9cd5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9d9cd5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9d9cd5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl new file mode 100644 index 0000000000..8175a48290 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_9e3ec5() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9e3ec5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9e3ec5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9e3ec5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c02acb52b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_9e3ec5() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9e3ec5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9e3ec5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9e3ec5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c02acb52b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_9e3ec5() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_9e3ec5(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_9e3ec5(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_9e3ec5(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl new file mode 100644 index 0000000000..19ace0b4cb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureStore_9e3ec5() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_9e3ec5(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureStore_9e3ec5() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_9e3ec5(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16i) uniform highp writeonly iimage2D arg_0; +void textureStore_9e3ec5() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_9e3ec5(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl new file mode 100644 index 0000000000..942418d022 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_9e3ec5(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_9e3ec5(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_9e3ec5(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_9e3ec5(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ce3d9ee19 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_9e3ec5 "textureStore_9e3ec5" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_9e3ec5 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_9e3ec5 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_9e3ec5 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_9e3ec5 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8259239b9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_9e3ec5() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_9e3ec5(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_9e3ec5(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_9e3ec5(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl new file mode 100644 index 0000000000..e92ea384ea --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_ac67aa() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ac67aa(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ac67aa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ac67aa(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b36799d5e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ac67aa() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ac67aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ac67aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ac67aa(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b36799d5e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ac67aa() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ac67aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ac67aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ac67aa(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl new file mode 100644 index 0000000000..95a8c41a1b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ac67aa() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_ac67aa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ac67aa() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_ac67aa(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ac67aa() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_ac67aa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl new file mode 100644 index 0000000000..bff5a97664 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_ac67aa(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_ac67aa(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_ac67aa(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_ac67aa(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm new file mode 100644 index 0000000000..df550ab8db --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_ac67aa "textureStore_ac67aa" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_ac67aa = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_ac67aa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_ac67aa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_ac67aa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl new file mode 100644 index 0000000000..2145e3ae82 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_ac67aa() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ac67aa(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ac67aa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ac67aa(); +} diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl new file mode 100644 index 0000000000..c0eedb2522 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_b706b1() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_b706b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_b706b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_b706b1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e961147c9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_b706b1() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_b706b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_b706b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_b706b1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4e961147c9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_b706b1() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_b706b1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_b706b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_b706b1(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl new file mode 100644 index 0000000000..72e03e7354 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureStore_b706b1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_b706b1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureStore_b706b1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_b706b1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage3D arg_0; +void textureStore_b706b1() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_b706b1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl new file mode 100644 index 0000000000..635cb6c0f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_b706b1(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_b706b1(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_b706b1(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_b706b1(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm new file mode 100644 index 0000000000..32c2bcb935 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_b706b1 "textureStore_b706b1" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_b706b1 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_b706b1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_b706b1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_b706b1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl new file mode 100644 index 0000000000..42775a482a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_b706b1() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_b706b1(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_b706b1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_b706b1(); +} diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl new file mode 100644 index 0000000000..a15240cee9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_bbcb7f() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bbcb7f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_bbcb7f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_bbcb7f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..366a2e7824 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_bbcb7f() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bbcb7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bbcb7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bbcb7f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..366a2e7824 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_bbcb7f() { + int2 arg_1 = (0).xx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bbcb7f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bbcb7f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bbcb7f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl new file mode 100644 index 0000000000..2b486d8fb8 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureStore_bbcb7f() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_bbcb7f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureStore_bbcb7f() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_bbcb7f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2D arg_0; +void textureStore_bbcb7f() { + ivec2 arg_1 = ivec2(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_bbcb7f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl new file mode 100644 index 0000000000..0a942853e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_bbcb7f(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_bbcb7f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_bbcb7f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_bbcb7f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm new file mode 100644 index 0000000000..59e7b74967 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_bbcb7f "textureStore_bbcb7f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_bbcb7f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v2int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_bbcb7f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_bbcb7f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_bbcb7f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl new file mode 100644 index 0000000000..1bf17d91d7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_bbcb7f() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bbcb7f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_bbcb7f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_bbcb7f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl new file mode 100644 index 0000000000..340cf9ea12 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d; + +// fn textureStore(texture: texture_storage_2d, coords: vec2, value: vec4) +fn textureStore_be6e30() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_be6e30(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_be6e30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_be6e30(); +} diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..67ff8b2119 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_be6e30() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_be6e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_be6e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_be6e30(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67ff8b2119 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture2D arg_0 : register(u0, space1); + +void textureStore_be6e30() { + int2 arg_1 = (0).xx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_be6e30(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_be6e30(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_be6e30(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl new file mode 100644 index 0000000000..95fa82c8a4 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureStore_be6e30() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_be6e30(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureStore_be6e30() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_be6e30(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image2D arg_0; +void textureStore_be6e30() { + ivec2 arg_1 = ivec2(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_be6e30(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl new file mode 100644 index 0000000000..ad189e0815 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_be6e30(texture2d tint_symbol_1) { + int2 arg_1 = int2(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint2(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d tint_symbol_2) { + textureStore_be6e30(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d tint_symbol_4 [[texture(0)]]) { + textureStore_be6e30(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d tint_symbol_5 [[texture(0)]]) { + textureStore_be6e30(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm new file mode 100644 index 0000000000..57d0a8caaa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_be6e30 "textureStore_be6e30" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_be6e30 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v2int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_be6e30 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_be6e30 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_be6e30 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl new file mode 100644 index 0000000000..3fa9fde298 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d; + +fn textureStore_be6e30() { + var arg_1 = vec2(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_be6e30(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_be6e30(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_be6e30(); +} diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl new file mode 100644 index 0000000000..444fed431b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_bf775c() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bf775c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_bf775c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_bf775c(); +} diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c75cb0ba5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_bf775c() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bf775c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bf775c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bf775c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c75cb0ba5b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_bf775c() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_bf775c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_bf775c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_bf775c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl new file mode 100644 index 0000000000..276322e6f1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureStore_bf775c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_bf775c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureStore_bf775c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_bf775c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'iimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage1D arg_0; +void textureStore_bf775c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_bf775c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'iimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl new file mode 100644 index 0000000000..24079fd3d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_bf775c(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_bf775c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_bf775c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_bf775c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm new file mode 100644 index 0000000000..c699fc002a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_bf775c "textureStore_bf775c" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_bf775c = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_bf775c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_bf775c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_bf775c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl new file mode 100644 index 0000000000..b2fae4d556 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_bf775c() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_bf775c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_bf775c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_bf775c(); +} diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl new file mode 100644 index 0000000000..3f51529a70 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_c5af1e() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c5af1e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_c5af1e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_c5af1e(); +} diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c52db8f8be --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_c5af1e() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c5af1e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c5af1e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c5af1e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c52db8f8be --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_c5af1e() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c5af1e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c5af1e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c5af1e(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl new file mode 100644 index 0000000000..d75b39b00c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureStore_c5af1e() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_c5af1e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureStore_c5af1e() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_c5af1e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba16f) uniform highp writeonly image3D arg_0; +void textureStore_c5af1e() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_c5af1e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl new file mode 100644 index 0000000000..6e9206f482 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_c5af1e(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_c5af1e(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_c5af1e(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_c5af1e(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a7e6556eb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_c5af1e "textureStore_c5af1e" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_c5af1e = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_c5af1e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_c5af1e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_c5af1e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc2c9d11da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_c5af1e() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c5af1e(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_c5af1e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_c5af1e(); +} diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl new file mode 100644 index 0000000000..364cf2f897 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_c863be() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c863be(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_c863be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_c863be(); +} diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bf1dd2cb3c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_c863be() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c863be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c863be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c863be(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf1dd2cb3c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_c863be() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + float4 arg_3 = (0.0f).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_c863be(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_c863be(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_c863be(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl new file mode 100644 index 0000000000..964605ed97 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureStore_c863be() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_c863be(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureStore_c863be() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_c863be(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image2DArray arg_0; +void textureStore_c863be() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + vec4 arg_3 = vec4(0.0f); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_c863be(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl new file mode 100644 index 0000000000..3b4ee66666 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_c863be(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + float4 arg_3 = float4(0.0f); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_c863be(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_c863be(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_c863be(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm new file mode 100644 index 0000000000..49ae3b6aa5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_c863be "textureStore_c863be" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3int = OpTypeVector %int 3 + %36 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_c863be = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %5 + %28 = OpLoad %11 %arg_0 + %30 = OpLoad %v2int %arg_1 + %31 = OpCompositeExtract %int %30 0 + %32 = OpCompositeExtract %int %30 1 + %33 = OpLoad %int %arg_2 + %34 = OpCompositeConstruct %v3int %31 %32 %33 + %35 = OpLoad %v4float %arg_3 + OpImageWrite %28 %34 %35 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %36 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_c863be + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %42 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %textureStore_c863be + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_c863be + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl new file mode 100644 index 0000000000..daa524bcbd --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_c863be() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_c863be(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_c863be(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_c863be(); +} diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl new file mode 100644 index 0000000000..7787cc9008 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_d73b5c() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_d73b5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_d73b5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_d73b5c(); +} diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e4f893ab01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_d73b5c() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_d73b5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_d73b5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_d73b5c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4f893ab01 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_d73b5c() { + int arg_1 = 1; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_d73b5c(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_d73b5c(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_d73b5c(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl new file mode 100644 index 0000000000..ca21e8d934 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureStore_d73b5c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_d73b5c(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureStore_d73b5c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_d73b5c(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage1D arg_0; +void textureStore_d73b5c() { + int arg_1 = 1; + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_d73b5c(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl new file mode 100644 index 0000000000..0fe1471f72 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_d73b5c(texture1d tint_symbol_1) { + int arg_1 = 1; + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_d73b5c(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_d73b5c(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_d73b5c(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm new file mode 100644 index 0000000000..b558399701 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_d73b5c "textureStore_d73b5c" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 1D 0 0 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_d73b5c = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %int_1 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_d73b5c + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_d73b5c + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_d73b5c + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl new file mode 100644 index 0000000000..9025a3e20c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_d73b5c() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_d73b5c(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_d73b5c(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_d73b5c(); +} diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl new file mode 100644 index 0000000000..a026e431cd --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_dd7d81() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dd7d81(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_dd7d81(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_dd7d81(); +} diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..303f614926 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_dd7d81() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dd7d81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dd7d81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dd7d81(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..303f614926 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_dd7d81() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dd7d81(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dd7d81(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dd7d81(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl new file mode 100644 index 0000000000..2a86984a65 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureStore_dd7d81() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_dd7d81(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureStore_dd7d81() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_dd7d81(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8_snorm) uniform highp writeonly image3D arg_0; +void textureStore_dd7d81() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_dd7d81(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl new file mode 100644 index 0000000000..e87f2ed170 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_dd7d81(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_dd7d81(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_dd7d81(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_dd7d81(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e21c4c58a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_dd7d81 "textureStore_dd7d81" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_dd7d81 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_dd7d81 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_dd7d81 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_dd7d81 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl new file mode 100644 index 0000000000..812587cc6a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_dd7d81() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dd7d81(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_dd7d81(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_dd7d81(); +} diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl new file mode 100644 index 0000000000..5023cc66ae --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_dde364() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dde364(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_dde364(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_dde364(); +} diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8bda58b0d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_dde364() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dde364(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dde364(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dde364(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8bda58b0d5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_dde364() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + uint4 arg_3 = (0u).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_dde364(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_dde364(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_dde364(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl new file mode 100644 index 0000000000..30fc1380d6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_dde364() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_dde364(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_dde364() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_dde364(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32ui) uniform highp writeonly uimage2DArray arg_0; +void textureStore_dde364() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + uvec4 arg_3 = uvec4(0u); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_dde364(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl new file mode 100644 index 0000000000..8ac8d03c8a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_dde364(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + uint4 arg_3 = uint4(0u); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_dde364(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_dde364(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_dde364(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm new file mode 100644 index 0000000000..39505fa9cb --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_dde364 "textureStore_dde364" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %19 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %27 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %v3int = OpTypeVector %int 3 + %39 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_dde364 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %19 + %arg_2 = OpVariable %_ptr_Function_int Function %25 + %arg_3 = OpVariable %_ptr_Function_v4uint Function %27 + OpStore %arg_1 %19 + OpStore %arg_2 %int_1 + OpStore %arg_3 %27 + %31 = OpLoad %11 %arg_0 + %33 = OpLoad %v2int %arg_1 + %34 = OpCompositeExtract %int %33 0 + %35 = OpCompositeExtract %int %33 1 + %36 = OpLoad %int %arg_2 + %37 = OpCompositeConstruct %v3int %34 %35 %36 + %38 = OpLoad %v4uint %arg_3 + OpImageWrite %31 %37 %38 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %39 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_dde364 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %44 = OpLabel + %45 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %45 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %48 = OpLabel + %49 = OpFunctionCall %void %textureStore_dde364 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %51 = OpLabel + %52 = OpFunctionCall %void %textureStore_dde364 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl new file mode 100644 index 0000000000..8719ec97cf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_dde364() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_dde364(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_dde364(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_dde364(); +} diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl new file mode 100644 index 0000000000..6e1fd340c6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_e885e8() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_e885e8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_e885e8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_e885e8(); +} diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3a6acf9920 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_e885e8() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_e885e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_e885e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_e885e8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3a6acf9920 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_e885e8() { + int arg_1 = 1; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_e885e8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_e885e8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_e885e8(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl new file mode 100644 index 0000000000..ceee356612 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureStore_e885e8() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_e885e8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureStore_e885e8() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_e885e8(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba16f) uniform highp writeonly image1D arg_0; +void textureStore_e885e8() { + int arg_1 = 1; + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_e885e8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl new file mode 100644 index 0000000000..67de77cde1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_e885e8(texture1d tint_symbol_1) { + int arg_1 = 1; + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_e885e8(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_e885e8(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_e885e8(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm new file mode 100644 index 0000000000..de6672d838 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_e885e8 "textureStore_e885e8" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 1D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_e885e8 = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %20 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %int_1 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_e885e8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_e885e8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_e885e8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b1b9acf83 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_e885e8() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_e885e8(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_e885e8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_e885e8(); +} diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl new file mode 100644 index 0000000000..098cfadfb3 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_eb702f() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb702f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_eb702f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_eb702f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..55d4e79233 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb702f() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb702f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb702f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb702f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..55d4e79233 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb702f() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb702f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb702f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb702f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl new file mode 100644 index 0000000000..5dfa23db7b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureStore_eb702f() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_eb702f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureStore_eb702f() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_eb702f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32f) uniform highp writeonly image3D arg_0; +void textureStore_eb702f() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_eb702f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl new file mode 100644 index 0000000000..9926e894f2 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_eb702f(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_eb702f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_eb702f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_eb702f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm new file mode 100644 index 0000000000..8d9bddbc03 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_eb702f "textureStore_eb702f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 R32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_eb702f = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_eb702f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_eb702f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_eb702f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc8a259f79 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_eb702f() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb702f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_eb702f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_eb702f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl new file mode 100644 index 0000000000..0ec2c27b9e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_eb78b9() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb78b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_eb78b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_eb78b9(); +} diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c798708dd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb78b9() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb78b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb78b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb78b9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c798708dd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_eb78b9() { + int3 arg_1 = (0).xxx; + int4 arg_2 = (0).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_eb78b9(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_eb78b9(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_eb78b9(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl new file mode 100644 index 0000000000..7a6aa1221e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureStore_eb78b9() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_eb78b9(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureStore_eb78b9() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_eb78b9(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32i) uniform highp writeonly iimage3D arg_0; +void textureStore_eb78b9() { + ivec3 arg_1 = ivec3(0); + ivec4 arg_2 = ivec4(0); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_eb78b9(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl new file mode 100644 index 0000000000..e5b872f51c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_eb78b9(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + int4 arg_2 = int4(0); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_eb78b9(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_eb78b9(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_eb78b9(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm new file mode 100644 index 0000000000..ca55182024 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_eb78b9 "textureStore_eb78b9" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 3D 0 0 0 2 R32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4int = OpTypeVector %int 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %29 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_eb78b9 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4int Function %22 + OpStore %arg_1 %18 + OpStore %arg_2 %22 + %26 = OpLoad %11 %arg_0 + %27 = OpLoad %v3int %arg_1 + %28 = OpLoad %v4int %arg_2 + OpImageWrite %26 %27 %28 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %29 + %31 = OpLabel + %32 = OpFunctionCall %void %textureStore_eb78b9 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %34 = OpLabel + %35 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %35 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %38 = OpLabel + %39 = OpFunctionCall %void %textureStore_eb78b9 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %41 = OpLabel + %42 = OpFunctionCall %void %textureStore_eb78b9 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d7e63513b --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_eb78b9() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_eb78b9(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_eb78b9(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_eb78b9(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl new file mode 100644 index 0000000000..19d501f745 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_ee6acc() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ee6acc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ee6acc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ee6acc(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6ce8c7b0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ee6acc() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ee6acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ee6acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ee6acc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6ce8c7b0f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ee6acc() { + int3 arg_1 = (0).xxx; + float4 arg_2 = (0.0f).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ee6acc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ee6acc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ee6acc(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl new file mode 100644 index 0000000000..bce0c58279 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl @@ -0,0 +1,81 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureStore_ee6acc() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_ee6acc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureStore_ee6acc() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_ee6acc(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32f) uniform highp writeonly image3D arg_0; +void textureStore_ee6acc() { + ivec3 arg_1 = ivec3(0); + vec4 arg_2 = vec4(0.0f); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_ee6acc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl new file mode 100644 index 0000000000..9b5c9220e9 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_ee6acc(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + float4 arg_2 = float4(0.0f); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_ee6acc(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_ee6acc(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_ee6acc(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc3df6dbd5 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_ee6acc "textureStore_ee6acc" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %11 = OpTypeImage %float 3D 0 0 0 2 Rg32f +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %18 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %27 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_ee6acc = OpFunction %void None %12 + %15 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %18 + %arg_2 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_1 %18 + OpStore %arg_2 %5 + %24 = OpLoad %11 %arg_0 + %25 = OpLoad %v3int %arg_1 + %26 = OpLoad %v4float %arg_2 + OpImageWrite %24 %25 %26 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %textureStore_ee6acc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %12 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %12 + %36 = OpLabel + %37 = OpFunctionCall %void %textureStore_ee6acc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_ee6acc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ba6d40420 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_ee6acc() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ee6acc(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ee6acc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ee6acc(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl new file mode 100644 index 0000000000..fa28513936 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_ef9f2f() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ef9f2f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ef9f2f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ef9f2f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ded9f9515a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ef9f2f() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ef9f2f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ef9f2f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ef9f2f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ded9f9515a --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_ef9f2f() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_ef9f2f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_ef9f2f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_ef9f2f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl new file mode 100644 index 0000000000..040973d2dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ef9f2f() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_ef9f2f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ef9f2f() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_ef9f2f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(r32ui) uniform highp writeonly uimage3D arg_0; +void textureStore_ef9f2f() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_ef9f2f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl new file mode 100644 index 0000000000..9c6a6bdac6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_ef9f2f(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_ef9f2f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_ef9f2f(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_ef9f2f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm new file mode 100644 index 0000000000..4148955254 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_ef9f2f "textureStore_ef9f2f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 R32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_ef9f2f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_ef9f2f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_ef9f2f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_ef9f2f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl new file mode 100644 index 0000000000..1045a895fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_ef9f2f() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_ef9f2f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_ef9f2f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_ef9f2f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl new file mode 100644 index 0000000000..b58c3ffab6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_3d; + +// fn textureStore(texture: texture_storage_3d, coords: vec3, value: vec4) +fn textureStore_f8dead() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f8dead(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_f8dead(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_f8dead(); +} diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94111fb252 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_f8dead() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f8dead(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f8dead(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f8dead(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..94111fb252 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture3D arg_0 : register(u0, space1); + +void textureStore_f8dead() { + int3 arg_1 = (0).xxx; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f8dead(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f8dead(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f8dead(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl new file mode 100644 index 0000000000..3583671c2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl @@ -0,0 +1,58 @@ +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureStore_f8dead() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_f8dead(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureStore_f8dead() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_f8dead(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8ui) uniform highp writeonly uimage3D arg_0; +void textureStore_f8dead() { + ivec3 arg_1 = ivec3(0); + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_f8dead(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl new file mode 100644 index 0000000000..4e6da981dc --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_f8dead(texture3d tint_symbol_1) { + int3 arg_1 = int3(0); + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint3(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture3d tint_symbol_2) { + textureStore_f8dead(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture3d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture3d tint_symbol_4 [[texture(0)]]) { + textureStore_f8dead(tint_symbol_4); + return; +} + +kernel void compute_main(texture3d tint_symbol_5 [[texture(0)]]) { + textureStore_f8dead(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm new file mode 100644 index 0000000000..2a9e3e8e2e --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_f8dead "textureStore_f8dead" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %19 = OpConstantNull %v3int +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_f8dead = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v3int Function %19 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %19 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %v3int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_f8dead + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_f8dead + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_f8dead + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl new file mode 100644 index 0000000000..52a1d3e12c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_3d; + +fn textureStore_f8dead() { + var arg_1 = vec3(); + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f8dead(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_f8dead(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_f8dead(); +} diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl new file mode 100644 index 0000000000..f125124fbf --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_f9be83() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f9be83(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_f9be83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_f9be83(); +} diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..129bfb8de6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_f9be83() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f9be83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f9be83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f9be83(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..129bfb8de6 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_f9be83() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_f9be83(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_f9be83(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_f9be83(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl new file mode 100644 index 0000000000..60b3e0b612 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_f9be83() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_f9be83(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_f9be83() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_f9be83(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'image load-store format' : not supported with this profile: es +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rg32i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_f9be83() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_f9be83(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'image load-store format' : not supported with this profile: es +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl new file mode 100644 index 0000000000..0217d28a2f --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_f9be83(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_f9be83(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_f9be83(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_f9be83(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.spvasm new file mode 100644 index 0000000000..c7ee036056 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_f9be83 "textureStore_f9be83" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_f9be83 = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_f9be83 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_f9be83 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_f9be83 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3601ae9e1 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_f9be83() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_f9be83(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_f9be83(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_f9be83(); +} diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl new file mode 100644 index 0000000000..a68f2163fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_1d; + +// fn textureStore(texture: texture_storage_1d, coords: i32, value: vec4) +fn textureStore_fb9a8f() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fb9a8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_fb9a8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_fb9a8f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7e5b23d042 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.dxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_fb9a8f() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fb9a8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fb9a8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fb9a8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7e5b23d042 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.fxc.hlsl @@ -0,0 +1,34 @@ +RWTexture1D arg_0 : register(u0, space1); + +void textureStore_fb9a8f() { + int arg_1 = 1; + uint4 arg_2 = (0u).xxxx; + arg_0[arg_1] = arg_2; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fb9a8f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fb9a8f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fb9a8f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl new file mode 100644 index 0000000000..9976dc1c49 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_fb9a8f() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +vec4 vertex_main() { + textureStore_fb9a8f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es +precision mediump float; + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_fb9a8f() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void fragment_main() { + textureStore_fb9a8f(); +} + +void main() { + fragment_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:4: 'uimage1D' : Reserved word. +WARNING: 0:4: 'layout' : useless application of layout qualifier +ERROR: 0:4: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + +#version 310 es + +layout(rgba32ui) uniform highp writeonly uimage1D arg_0; +void textureStore_fb9a8f() { + int arg_1 = 1; + uvec4 arg_2 = uvec4(0u); + imageStore(arg_0, arg_1, arg_2); +} + +void compute_main() { + textureStore_fb9a8f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} +Error parsing GLSL shader: +ERROR: 0:3: 'uimage1D' : Reserved word. +WARNING: 0:3: 'layout' : useless application of layout qualifier +ERROR: 0:3: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl new file mode 100644 index 0000000000..a808ba3fd7 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +void textureStore_fb9a8f(texture1d tint_symbol_1) { + int arg_1 = 1; + uint4 arg_2 = uint4(0u); + tint_symbol_1.write(arg_2, uint(arg_1)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture1d tint_symbol_2) { + textureStore_fb9a8f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture1d tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture1d tint_symbol_4 [[texture(0)]]) { + textureStore_fb9a8f(tint_symbol_4); + return; +} + +kernel void compute_main(texture1d tint_symbol_5 [[texture(0)]]) { + textureStore_fb9a8f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm new file mode 100644 index 0000000000..708e2397fa --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_fb9a8f "textureStore_fb9a8f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v4uint = OpTypeVector %uint 4 + %23 = OpConstantNull %v4uint +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %30 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_fb9a8f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %21 + %arg_2 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %arg_1 %int_1 + OpStore %arg_2 %23 + %27 = OpLoad %11 %arg_0 + %28 = OpLoad %int %arg_1 + %29 = OpLoad %v4uint %arg_2 + OpImageWrite %27 %28 %29 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %textureStore_fb9a8f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %35 = OpLabel + %36 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %36 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %39 = OpLabel + %40 = OpFunctionCall %void %textureStore_fb9a8f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %42 = OpLabel + %43 = OpFunctionCall %void %textureStore_fb9a8f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d6561b21c --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl @@ -0,0 +1,23 @@ +@group(1) @binding(0) var arg_0 : texture_storage_1d; + +fn textureStore_fb9a8f() { + var arg_1 = 1; + var arg_2 = vec4(); + textureStore(arg_0, arg_1, arg_2); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fb9a8f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_fb9a8f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_fb9a8f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl new file mode 100644 index 0000000000..98bf971228 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl @@ -0,0 +1,47 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +@group(1) @binding(0) var arg_0: texture_storage_2d_array; + +// fn textureStore(texture: texture_storage_2d_array, coords: vec2, array_index: i32, value: vec4) +fn textureStore_fbf53f() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fbf53f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_fbf53f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_fbf53f(); +} diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46a154da23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.dxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_fbf53f() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fbf53f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fbf53f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fbf53f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..46a154da23 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.fxc.hlsl @@ -0,0 +1,35 @@ +RWTexture2DArray arg_0 : register(u0, space1); + +void textureStore_fbf53f() { + int2 arg_1 = (0).xx; + int arg_2 = 1; + int4 arg_3 = (0).xxxx; + arg_0[int3(arg_1, arg_2)] = arg_3; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + textureStore_fbf53f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + textureStore_fbf53f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + textureStore_fbf53f(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl new file mode 100644 index 0000000000..c36d4950da --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl @@ -0,0 +1,61 @@ +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_fbf53f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +vec4 vertex_main() { + textureStore_fbf53f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_fbf53f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void fragment_main() { + textureStore_fbf53f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +layout(rgba8i) uniform highp writeonly iimage2DArray arg_0; +void textureStore_fbf53f() { + ivec2 arg_1 = ivec2(0); + int arg_2 = 1; + ivec4 arg_3 = ivec4(0); + imageStore(arg_0, ivec3(arg_1, arg_2), arg_3); +} + +void compute_main() { + textureStore_fbf53f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl new file mode 100644 index 0000000000..7d00e81d24 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +void textureStore_fbf53f(texture2d_array tint_symbol_1) { + int2 arg_1 = int2(0); + int arg_2 = 1; + int4 arg_3 = int4(0); + tint_symbol_1.write(arg_3, uint2(arg_1), arg_2); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner(texture2d_array tint_symbol_2) { + textureStore_fbf53f(tint_symbol_2); + return float4(0.0f); +} + +vertex tint_symbol vertex_main(texture2d_array tint_symbol_3 [[texture(0)]]) { + float4 const inner_result = vertex_main_inner(tint_symbol_3); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main(texture2d_array tint_symbol_4 [[texture(0)]]) { + textureStore_fbf53f(tint_symbol_4); + return; +} + +kernel void compute_main(texture2d_array tint_symbol_5 [[texture(0)]]) { + textureStore_fbf53f(tint_symbol_5); + return; +} + diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.spvasm new file mode 100644 index 0000000000..037b3ee220 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %arg_0 "arg_0" + OpName %textureStore_fbf53f "textureStore_fbf53f" + OpName %arg_1 "arg_1" + OpName %arg_2 "arg_2" + OpName %arg_3 "arg_3" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + OpDecorate %arg_0 NonReadable + OpDecorate %arg_0 DescriptorSet 1 + OpDecorate %arg_0 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %18 = OpConstantNull %v2int +%_ptr_Function_v2int = OpTypePointer Function %v2int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %v4int = OpTypeVector %int 4 + %26 = OpConstantNull %v4int +%_ptr_Function_v4int = OpTypePointer Function %v4int + %v3int = OpTypeVector %int 3 + %38 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%textureStore_fbf53f = OpFunction %void None %13 + %16 = OpLabel + %arg_1 = OpVariable %_ptr_Function_v2int Function %18 + %arg_2 = OpVariable %_ptr_Function_int Function %24 + %arg_3 = OpVariable %_ptr_Function_v4int Function %26 + OpStore %arg_1 %18 + OpStore %arg_2 %int_1 + OpStore %arg_3 %26 + %30 = OpLoad %11 %arg_0 + %32 = OpLoad %v2int %arg_1 + %33 = OpCompositeExtract %int %32 0 + %34 = OpCompositeExtract %int %32 1 + %35 = OpLoad %int %arg_2 + %36 = OpCompositeConstruct %v3int %33 %34 %35 + %37 = OpLoad %v4int %arg_3 + OpImageWrite %30 %36 %37 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %38 + %40 = OpLabel + %41 = OpFunctionCall %void %textureStore_fbf53f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %13 + %43 = OpLabel + %44 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %44 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %13 + %47 = OpLabel + %48 = OpFunctionCall %void %textureStore_fbf53f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %13 + %50 = OpLabel + %51 = OpFunctionCall %void %textureStore_fbf53f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd79a14f18 --- /dev/null +++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +@group(1) @binding(0) var arg_0 : texture_storage_2d_array; + +fn textureStore_fbf53f() { + var arg_1 = vec2(); + var arg_2 = 1; + var arg_3 = vec4(); + textureStore(arg_0, arg_1, arg_2, arg_3); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + textureStore_fbf53f(); + return vec4(); +} + +@fragment +fn fragment_main() { + textureStore_fbf53f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + textureStore_fbf53f(); +} diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl new file mode 100644 index 0000000000..e17468f1cf --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 3, f16>) -> mat<3, 3, f16> +fn transpose_06794e() { + var arg_0 = mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat3x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_06794e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_06794e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_06794e(); +} diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cdd16a4175 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_06794e() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_06794e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_06794e(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e83264b06 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_06794e() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_06794e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_06794e(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000166C5129750(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x00000166C5129750(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl new file mode 100644 index 0000000000..558f547934 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_06794e() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_06794e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_06794e() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_06794e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_06794e() { + f16mat3 arg_0 = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3 res = transpose(arg_0); +} + +void compute_main() { + transpose_06794e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.msl new file mode 100644 index 0000000000..bef8041f1c --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_06794e() { + half3x3 arg_0 = half3x3(half3(0.0h), half3(0.0h), half3(0.0h)); + half3x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_06794e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_06794e(); + return; +} + +kernel void compute_main() { + transpose_06794e(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.spvasm new file mode 100644 index 0000000000..7817296401 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_06794e "transpose_06794e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %16 = OpConstantNull %mat3v3half +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_06794e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v3half Function %16 + %res = OpVariable %_ptr_Function_mat3v3half Function %16 + OpStore %arg_0 %16 + %20 = OpLoad %mat3v3half %arg_0 + %19 = OpTranspose %mat3v3half %20 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %transpose_06794e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_06794e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_06794e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.wgsl new file mode 100644 index 0000000000..500244dfe2 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/06794e.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_06794e() { + var arg_0 = mat3x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat3x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_06794e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_06794e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_06794e(); +} diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl new file mode 100644 index 0000000000..ac28d29592 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<4, 3, f32>) -> mat<3, 4, f32> +fn transpose_2585cd() { + var arg_0 = mat4x3(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: mat3x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_2585cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_2585cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_2585cd(); +} diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5050a328de --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_2585cd() { + float4x3 arg_0 = float4x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx, (1.0f).xxx); + float3x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_2585cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_2585cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_2585cd(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5050a328de --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void transpose_2585cd() { + float4x3 arg_0 = float4x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx, (1.0f).xxx); + float3x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_2585cd(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_2585cd(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_2585cd(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl new file mode 100644 index 0000000000..336d930269 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_2585cd() { + mat4x3 arg_0 = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f)); + mat3x4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_2585cd(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_2585cd() { + mat4x3 arg_0 = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f)); + mat3x4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_2585cd(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_2585cd() { + mat4x3 arg_0 = mat4x3(vec3(1.0f), vec3(1.0f), vec3(1.0f), vec3(1.0f)); + mat3x4 res = transpose(arg_0); +} + +void compute_main() { + transpose_2585cd(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl new file mode 100644 index 0000000000..f0cf8135d2 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_2585cd() { + float4x3 arg_0 = float4x3(float3(1.0f), float3(1.0f), float3(1.0f), float3(1.0f)); + float3x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_2585cd(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_2585cd(); + return; +} + +kernel void compute_main() { + transpose_2585cd(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm new file mode 100644 index 0000000000..f75aad35ba --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_2585cd "transpose_2585cd" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %17 = OpConstantComposite %mat4v3float %16 %16 %16 %16 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %20 = OpConstantNull %mat4v3float +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %26 = OpConstantNull %mat3v4float + %27 = OpTypeFunction %v4float +%transpose_2585cd = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v3float Function %20 + %res = OpVariable %_ptr_Function_mat3v4float Function %26 + OpStore %arg_0 %17 + %23 = OpLoad %mat4v3float %arg_0 + %21 = OpTranspose %mat3v4float %23 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_2585cd + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_2585cd + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_2585cd + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl new file mode 100644 index 0000000000..7390cfe0cc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_2585cd() { + var arg_0 = mat4x3(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : mat3x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_2585cd(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_2585cd(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_2585cd(); +} diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl new file mode 100644 index 0000000000..9f1e0ef1f8 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<2, 2, f32>) -> mat<2, 2, f32> +fn transpose_31d679() { + var arg_0 = mat2x2(1.f, 1.f, 1.f, 1.f); + var res: mat2x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_31d679(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_31d679(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_31d679(); +} diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd4d593201 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_31d679() { + float2x2 arg_0 = float2x2((1.0f).xx, (1.0f).xx); + float2x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31d679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31d679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31d679(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd4d593201 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void transpose_31d679() { + float2x2 arg_0 = float2x2((1.0f).xx, (1.0f).xx); + float2x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31d679(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31d679(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31d679(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl new file mode 100644 index 0000000000..4db7e7f753 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_31d679() { + mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f)); + mat2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_31d679(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_31d679() { + mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f)); + mat2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_31d679(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_31d679() { + mat2 arg_0 = mat2(vec2(1.0f), vec2(1.0f)); + mat2 res = transpose(arg_0); +} + +void compute_main() { + transpose_31d679(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl new file mode 100644 index 0000000000..5029a9672f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_31d679() { + float2x2 arg_0 = float2x2(float2(1.0f), float2(1.0f)); + float2x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_31d679(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_31d679(); + return; +} + +kernel void compute_main() { + transpose_31d679(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm new file mode 100644 index 0000000000..836104a7aa --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_31d679 "transpose_31d679" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v2float %float_1 %float_1 + %17 = OpConstantComposite %mat2v2float %16 %16 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %20 = OpConstantNull %mat2v2float + %24 = OpTypeFunction %v4float +%transpose_31d679 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v2float Function %20 + %res = OpVariable %_ptr_Function_mat2v2float Function %20 + OpStore %arg_0 %17 + %22 = OpLoad %mat2v2float %arg_0 + %21 = OpTranspose %mat2v2float %22 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %transpose_31d679 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_31d679 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_31d679 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl new file mode 100644 index 0000000000..b647749045 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_31d679() { + var arg_0 = mat2x2(1.0f, 1.0f, 1.0f, 1.0f); + var res : mat2x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_31d679(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_31d679(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_31d679(); +} diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl new file mode 100644 index 0000000000..bd023b95e8 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<4, 2, f32>) -> mat<2, 4, f32> +fn transpose_31e37e() { + var arg_0 = mat4x2(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: mat2x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_31e37e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_31e37e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_31e37e(); +} diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..85970ed8cc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_31e37e() { + float4x2 arg_0 = float4x2((1.0f).xx, (1.0f).xx, (1.0f).xx, (1.0f).xx); + float2x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31e37e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31e37e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31e37e(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..85970ed8cc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void transpose_31e37e() { + float4x2 arg_0 = float4x2((1.0f).xx, (1.0f).xx, (1.0f).xx, (1.0f).xx); + float2x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_31e37e(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_31e37e(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_31e37e(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl new file mode 100644 index 0000000000..bf4eb4abd0 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_31e37e() { + mat4x2 arg_0 = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f)); + mat2x4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_31e37e(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_31e37e() { + mat4x2 arg_0 = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f)); + mat2x4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_31e37e(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_31e37e() { + mat4x2 arg_0 = mat4x2(vec2(1.0f), vec2(1.0f), vec2(1.0f), vec2(1.0f)); + mat2x4 res = transpose(arg_0); +} + +void compute_main() { + transpose_31e37e(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl new file mode 100644 index 0000000000..87dadd9553 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_31e37e() { + float4x2 arg_0 = float4x2(float2(1.0f), float2(1.0f), float2(1.0f), float2(1.0f)); + float2x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_31e37e(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_31e37e(); + return; +} + +kernel void compute_main() { + transpose_31e37e(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a80ab51a7 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_31e37e "transpose_31e37e" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v2float %float_1 %float_1 + %17 = OpConstantComposite %mat4v2float %16 %16 %16 %16 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %20 = OpConstantNull %mat4v2float +%mat2v4float = OpTypeMatrix %v4float 2 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %26 = OpConstantNull %mat2v4float + %27 = OpTypeFunction %v4float +%transpose_31e37e = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v2float Function %20 + %res = OpVariable %_ptr_Function_mat2v4float Function %26 + OpStore %arg_0 %17 + %23 = OpLoad %mat4v2float %arg_0 + %21 = OpTranspose %mat2v4float %23 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_31e37e + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_31e37e + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_31e37e + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl new file mode 100644 index 0000000000..a19b38a770 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_31e37e() { + var arg_0 = mat4x2(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : mat2x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_31e37e(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_31e37e(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_31e37e(); +} diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl new file mode 100644 index 0000000000..ddd59ceda3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<2, 4, f32>) -> mat<4, 2, f32> +fn transpose_4ce359() { + var arg_0 = mat2x4(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: mat4x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_4ce359(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_4ce359(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_4ce359(); +} diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3ae0139957 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_4ce359() { + float2x4 arg_0 = float2x4((1.0f).xxxx, (1.0f).xxxx); + float4x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4ce359(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4ce359(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4ce359(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ae0139957 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void transpose_4ce359() { + float2x4 arg_0 = float2x4((1.0f).xxxx, (1.0f).xxxx); + float4x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4ce359(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4ce359(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4ce359(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl new file mode 100644 index 0000000000..1c639d62d0 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_4ce359() { + mat2x4 arg_0 = mat2x4(vec4(1.0f), vec4(1.0f)); + mat4x2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_4ce359(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_4ce359() { + mat2x4 arg_0 = mat2x4(vec4(1.0f), vec4(1.0f)); + mat4x2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_4ce359(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_4ce359() { + mat2x4 arg_0 = mat2x4(vec4(1.0f), vec4(1.0f)); + mat4x2 res = transpose(arg_0); +} + +void compute_main() { + transpose_4ce359(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl new file mode 100644 index 0000000000..e6fb42dc76 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_4ce359() { + float2x4 arg_0 = float2x4(float4(1.0f), float4(1.0f)); + float4x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_4ce359(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_4ce359(); + return; +} + +kernel void compute_main() { + transpose_4ce359(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc2dcb5851 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_4ce359 "transpose_4ce359" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat2v4float = OpTypeMatrix %v4float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %16 = OpConstantComposite %mat2v4float %15 %15 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %19 = OpConstantNull %mat2v4float + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %26 = OpConstantNull %mat4v2float + %27 = OpTypeFunction %v4float +%transpose_4ce359 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v4float Function %19 + %res = OpVariable %_ptr_Function_mat4v2float Function %26 + OpStore %arg_0 %16 + %23 = OpLoad %mat2v4float %arg_0 + %20 = OpTranspose %mat4v2float %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_4ce359 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_4ce359 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_4ce359 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl new file mode 100644 index 0000000000..41d870dfbb --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_4ce359() { + var arg_0 = mat2x4(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : mat4x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_4ce359(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_4ce359(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_4ce359(); +} diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl new file mode 100644 index 0000000000..8b75992561 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<2, 3, f32>) -> mat<3, 2, f32> +fn transpose_4dc9a1() { + var arg_0 = mat2x3(1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: mat3x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_4dc9a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_4dc9a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_4dc9a1(); +} diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..140fa1c7a1 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_4dc9a1() { + float2x3 arg_0 = float2x3((1.0f).xxx, (1.0f).xxx); + float3x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4dc9a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4dc9a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4dc9a1(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..140fa1c7a1 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void transpose_4dc9a1() { + float2x3 arg_0 = float2x3((1.0f).xxx, (1.0f).xxx); + float3x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_4dc9a1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_4dc9a1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_4dc9a1(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl new file mode 100644 index 0000000000..37428d1e12 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_4dc9a1() { + mat2x3 arg_0 = mat2x3(vec3(1.0f), vec3(1.0f)); + mat3x2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_4dc9a1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_4dc9a1() { + mat2x3 arg_0 = mat2x3(vec3(1.0f), vec3(1.0f)); + mat3x2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_4dc9a1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_4dc9a1() { + mat2x3 arg_0 = mat2x3(vec3(1.0f), vec3(1.0f)); + mat3x2 res = transpose(arg_0); +} + +void compute_main() { + transpose_4dc9a1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl new file mode 100644 index 0000000000..df256e4823 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_4dc9a1() { + float2x3 arg_0 = float2x3(float3(1.0f), float3(1.0f)); + float3x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_4dc9a1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_4dc9a1(); + return; +} + +kernel void compute_main() { + transpose_4dc9a1(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.spvasm new file mode 100644 index 0000000000..2be80fea90 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_4dc9a1 "transpose_4dc9a1" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %17 = OpConstantComposite %mat2v3float %16 %16 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %20 = OpConstantNull %mat2v3float + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %27 = OpConstantNull %mat3v2float + %28 = OpTypeFunction %v4float +%transpose_4dc9a1 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v3float Function %20 + %res = OpVariable %_ptr_Function_mat3v2float Function %27 + OpStore %arg_0 %17 + %24 = OpLoad %mat2v3float %arg_0 + %21 = OpTranspose %mat3v2float %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %transpose_4dc9a1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %transpose_4dc9a1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %transpose_4dc9a1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl new file mode 100644 index 0000000000..666dc84388 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_4dc9a1() { + var arg_0 = mat2x3(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : mat3x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_4dc9a1(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_4dc9a1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_4dc9a1(); +} diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl new file mode 100644 index 0000000000..8bf22e8ebc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 2, f16>) -> mat<2, 4, f16> +fn transpose_5edd96() { + var arg_0 = mat4x2(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat2x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5edd96(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5edd96(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5edd96(); +} diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5bfa600378 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_5edd96() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5edd96(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5edd96(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9874ab3527 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_5edd96() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5edd96(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5edd96(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F440374A40(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001F440374A40(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl new file mode 100644 index 0000000000..68629f5da7 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5edd96() { + f16mat4x2 arg_0 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_5edd96(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_5edd96() { + f16mat4x2 arg_0 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_5edd96(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5edd96() { + f16mat4x2 arg_0 = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x4 res = transpose(arg_0); +} + +void compute_main() { + transpose_5edd96(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.msl new file mode 100644 index 0000000000..c656586ff3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_5edd96() { + half4x2 arg_0 = half4x2(half2(0.0h), half2(0.0h), half2(0.0h), half2(0.0h)); + half2x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_5edd96(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_5edd96(); + return; +} + +kernel void compute_main() { + transpose_5edd96(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.spvasm new file mode 100644 index 0000000000..a433092809 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_5edd96 "transpose_5edd96" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %16 = OpConstantNull %mat4v2half +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half + %25 = OpConstantNull %mat2v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_5edd96 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v2half Function %16 + %res = OpVariable %_ptr_Function_mat2v4half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat4v2half %arg_0 + %19 = OpTranspose %mat2v4half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_5edd96 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_5edd96 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_5edd96 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c293d94ed --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5edd96.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_5edd96() { + var arg_0 = mat4x2(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat2x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5edd96(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5edd96(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5edd96(); +} diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl new file mode 100644 index 0000000000..7dfb05cdf1 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 3, f16>) -> mat<3, 4, f16> +fn transpose_5f36bf() { + var arg_0 = mat4x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat3x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5f36bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5f36bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5f36bf(); +} diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f424bdd13 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_5f36bf() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5f36bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5f36bf(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cfb38a5f4e --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_5f36bf() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_5f36bf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_5f36bf(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002500869E2F0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000002500869E2F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl new file mode 100644 index 0000000000..306e862be8 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5f36bf() { + f16mat4x3 arg_0 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_5f36bf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_5f36bf() { + f16mat4x3 arg_0 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_5f36bf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_5f36bf() { + f16mat4x3 arg_0 = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x4 res = transpose(arg_0); +} + +void compute_main() { + transpose_5f36bf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.msl new file mode 100644 index 0000000000..2f8a2ac28f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_5f36bf() { + half4x3 arg_0 = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h)); + half3x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_5f36bf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_5f36bf(); + return; +} + +kernel void compute_main() { + transpose_5f36bf(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.spvasm new file mode 100644 index 0000000000..8a2641b0cf --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_5f36bf "transpose_5f36bf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %16 = OpConstantNull %mat4v3half +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half + %25 = OpConstantNull %mat3v4half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_5f36bf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v3half Function %16 + %res = OpVariable %_ptr_Function_mat3v4half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat4v3half %arg_0 + %19 = OpTranspose %mat3v4half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_5f36bf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_5f36bf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_5f36bf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fe203151d --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/5f36bf.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_5f36bf() { + var arg_0 = mat4x3(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat3x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_5f36bf(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_5f36bf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_5f36bf(); +} diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl new file mode 100644 index 0000000000..7102102baf --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 2, f16>) -> mat<2, 2, f16> +fn transpose_7be8b2() { + var arg_0 = mat2x2(f16(), f16(), f16(), f16()); + var res: mat2x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_7be8b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_7be8b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_7be8b2(); +} diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee1edd6352 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_7be8b2() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_7be8b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_7be8b2(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd61e2cab3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_7be8b2() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_7be8b2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_7be8b2(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015E28C70990(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000015E28C70990(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl new file mode 100644 index 0000000000..f9c1764182 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_7be8b2() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_7be8b2(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_7be8b2() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_7be8b2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_7be8b2() { + f16mat2 arg_0 = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2 res = transpose(arg_0); +} + +void compute_main() { + transpose_7be8b2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.msl new file mode 100644 index 0000000000..f53a158427 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_7be8b2() { + half2x2 arg_0 = half2x2(half2(0.0h), half2(0.0h)); + half2x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_7be8b2(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_7be8b2(); + return; +} + +kernel void compute_main() { + transpose_7be8b2(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.spvasm new file mode 100644 index 0000000000..f676cac4f0 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_7be8b2 "transpose_7be8b2" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %16 = OpConstantNull %mat2v2half +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_7be8b2 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v2half Function %16 + %res = OpVariable %_ptr_Function_mat2v2half Function %16 + OpStore %arg_0 %16 + %20 = OpLoad %mat2v2half %arg_0 + %19 = OpTranspose %mat2v2half %20 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %transpose_7be8b2 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_7be8b2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_7be8b2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.wgsl new file mode 100644 index 0000000000..277d2e5d5f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/7be8b2.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_7be8b2() { + var arg_0 = mat2x2(f16(), f16(), f16(), f16()); + var res : mat2x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_7be8b2(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_7be8b2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_7be8b2(); +} diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl b/test/tint/builtins/gen/var/transpose/844869.wgsl new file mode 100644 index 0000000000..920f4448fc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<4, 4, f16>) -> mat<4, 4, f16> +fn transpose_844869() { + var arg_0 = mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat4x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_844869(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_844869(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_844869(); +} diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..17bcee893a --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_844869() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_844869(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_844869(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..62a940892d --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_844869() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_844869(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_844869(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A73CD16C90(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001A73CD16C90(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl new file mode 100644 index 0000000000..97269852bd --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_844869() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_844869(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_844869() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_844869(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_844869() { + f16mat4 arg_0 = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4 res = transpose(arg_0); +} + +void compute_main() { + transpose_844869(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.msl new file mode 100644 index 0000000000..564ba7de7e --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_844869() { + half4x4 arg_0 = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h)); + half4x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_844869(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_844869(); + return; +} + +kernel void compute_main() { + transpose_844869(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.spvasm new file mode 100644 index 0000000000..204bd6cab5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_844869 "transpose_844869" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %16 = OpConstantNull %mat4v4half +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_844869 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v4half Function %16 + %res = OpVariable %_ptr_Function_mat4v4half Function %16 + OpStore %arg_0 %16 + %20 = OpLoad %mat4v4half %arg_0 + %19 = OpTranspose %mat4v4half %20 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %transpose_844869 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_844869 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_844869 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.wgsl new file mode 100644 index 0000000000..a96ffd3034 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/844869.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_844869() { + var arg_0 = mat4x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat4x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_844869(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_844869(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_844869(); +} diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl b/test/tint/builtins/gen/var/transpose/854336.wgsl new file mode 100644 index 0000000000..b763f692f5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<3, 3, f32>) -> mat<3, 3, f32> +fn transpose_854336() { + var arg_0 = mat3x3(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: mat3x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_854336(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_854336(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_854336(); +} diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..838bc5106b --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_854336() { + float3x3 arg_0 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); + float3x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_854336(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_854336(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_854336(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..838bc5106b --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void transpose_854336() { + float3x3 arg_0 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); + float3x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_854336(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_854336(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_854336(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl new file mode 100644 index 0000000000..8a50d4322a --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_854336() { + mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f)); + mat3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_854336(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_854336() { + mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f)); + mat3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_854336(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_854336() { + mat3 arg_0 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f)); + mat3 res = transpose(arg_0); +} + +void compute_main() { + transpose_854336(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl new file mode 100644 index 0000000000..5837ea60a9 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_854336() { + float3x3 arg_0 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f)); + float3x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_854336(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_854336(); + return; +} + +kernel void compute_main() { + transpose_854336(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm new file mode 100644 index 0000000000..406209bde8 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_854336 "transpose_854336" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %17 = OpConstantComposite %mat3v3float %16 %16 %16 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %20 = OpConstantNull %mat3v3float + %24 = OpTypeFunction %v4float +%transpose_854336 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v3float Function %20 + %res = OpVariable %_ptr_Function_mat3v3float Function %20 + OpStore %arg_0 %17 + %22 = OpLoad %mat3v3float %arg_0 + %21 = OpTranspose %mat3v3float %22 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %24 + %26 = OpLabel + %27 = OpFunctionCall %void %transpose_854336 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %30 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %transpose_854336 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_854336 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl new file mode 100644 index 0000000000..e20f97e5bf --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_854336() { + var arg_0 = mat3x3(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : mat3x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_854336(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_854336(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_854336(); +} diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl new file mode 100644 index 0000000000..591691377f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 4, f16>) -> mat<4, 3, f16> +fn transpose_8c06ce() { + var arg_0 = mat3x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat4x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_8c06ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_8c06ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_8c06ce(); +} diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8af9aa19df --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_8c06ce() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_8c06ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_8c06ce(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..478d92f635 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_8c06ce() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_8c06ce(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_8c06ce(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018FE8A7D600(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018FE8A7D600(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl new file mode 100644 index 0000000000..eb6e17c2fd --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_8c06ce() { + f16mat3x4 arg_0 = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_8c06ce(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_8c06ce() { + f16mat3x4 arg_0 = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_8c06ce(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_8c06ce() { + f16mat3x4 arg_0 = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x3 res = transpose(arg_0); +} + +void compute_main() { + transpose_8c06ce(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.msl new file mode 100644 index 0000000000..ae175b0d33 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_8c06ce() { + half3x4 arg_0 = half3x4(half4(0.0h), half4(0.0h), half4(0.0h)); + half4x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_8c06ce(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_8c06ce(); + return; +} + +kernel void compute_main() { + transpose_8c06ce(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.spvasm new file mode 100644 index 0000000000..c01b8c6b5f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_8c06ce "transpose_8c06ce" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %16 = OpConstantNull %mat3v4half +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half + %25 = OpConstantNull %mat4v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_8c06ce = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v4half Function %16 + %res = OpVariable %_ptr_Function_mat4v3half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat3v4half %arg_0 + %19 = OpTranspose %mat4v3half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_8c06ce + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_8c06ce + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_8c06ce + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee401e76ed --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/8c06ce.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_8c06ce() { + var arg_0 = mat3x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat4x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_8c06ce(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_8c06ce(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_8c06ce(); +} diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl new file mode 100644 index 0000000000..fd8dc13bd2 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<3, 2, f16>) -> mat<2, 3, f16> +fn transpose_b9ad1f() { + var arg_0 = mat3x2(f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat2x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_b9ad1f(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_b9ad1f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_b9ad1f(); +} diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dae12f3130 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_b9ad1f() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_b9ad1f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_b9ad1f(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba9abbe274 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_b9ad1f() { + matrix arg_0 = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_b9ad1f(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_b9ad1f(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BE022AEC60(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001BE022AEC60(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl new file mode 100644 index 0000000000..fbe4830053 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_b9ad1f() { + f16mat3x2 arg_0 = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_b9ad1f(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_b9ad1f() { + f16mat3x2 arg_0 = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_b9ad1f(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_b9ad1f() { + f16mat3x2 arg_0 = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2x3 res = transpose(arg_0); +} + +void compute_main() { + transpose_b9ad1f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.msl new file mode 100644 index 0000000000..df905fe9d5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_b9ad1f() { + half3x2 arg_0 = half3x2(half2(0.0h), half2(0.0h), half2(0.0h)); + half2x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_b9ad1f(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_b9ad1f(); + return; +} + +kernel void compute_main() { + transpose_b9ad1f(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.spvasm new file mode 100644 index 0000000000..0aefff3660 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_b9ad1f "transpose_b9ad1f" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %16 = OpConstantNull %mat3v2half +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half + %25 = OpConstantNull %mat2v3half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_b9ad1f = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v2half Function %16 + %res = OpVariable %_ptr_Function_mat2v3half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat3v2half %arg_0 + %19 = OpTranspose %mat2v3half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_b9ad1f + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_b9ad1f + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_b9ad1f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.wgsl new file mode 100644 index 0000000000..c96a7dc0b5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/b9ad1f.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_b9ad1f() { + var arg_0 = mat3x2(f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat2x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_b9ad1f(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_b9ad1f(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_b9ad1f(); +} diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl new file mode 100644 index 0000000000..584077675a --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<4, 4, f32>) -> mat<4, 4, f32> +fn transpose_c1b600() { + var arg_0 = mat4x4(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: mat4x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_c1b600(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_c1b600(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_c1b600(); +} diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..464f750876 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_c1b600() { + float4x4 arg_0 = float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); + float4x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_c1b600(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_c1b600(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_c1b600(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..464f750876 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void transpose_c1b600() { + float4x4 arg_0 = float4x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); + float4x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_c1b600(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_c1b600(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_c1b600(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl new file mode 100644 index 0000000000..b4705c83c0 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_c1b600() { + mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f)); + mat4 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_c1b600(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_c1b600() { + mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f)); + mat4 res = transpose(arg_0); +} + +void fragment_main() { + transpose_c1b600(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_c1b600() { + mat4 arg_0 = mat4(vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f)); + mat4 res = transpose(arg_0); +} + +void compute_main() { + transpose_c1b600(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl new file mode 100644 index 0000000000..862013a575 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_c1b600() { + float4x4 arg_0 = float4x4(float4(1.0f), float4(1.0f), float4(1.0f), float4(1.0f)); + float4x4 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_c1b600(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_c1b600(); + return; +} + +kernel void compute_main() { + transpose_c1b600(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm new file mode 100644 index 0000000000..27235eee39 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_c1b600 "transpose_c1b600" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %16 = OpConstantComposite %mat4v4float %15 %15 %15 %15 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %19 = OpConstantNull %mat4v4float + %23 = OpTypeFunction %v4float +%transpose_c1b600 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat4v4float Function %19 + %res = OpVariable %_ptr_Function_mat4v4float Function %19 + OpStore %arg_0 %16 + %21 = OpLoad %mat4v4float %arg_0 + %20 = OpTranspose %mat4v4float %21 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %transpose_c1b600 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %transpose_c1b600 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %transpose_c1b600 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl new file mode 100644 index 0000000000..435849ace5 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_c1b600() { + var arg_0 = mat4x4(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : mat4x4 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_c1b600(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_c1b600(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_c1b600(); +} diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl new file mode 100644 index 0000000000..d5b7ec3e39 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 3, f16>) -> mat<3, 2, f16> +fn transpose_d6faec() { + var arg_0 = mat2x3(f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat3x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d6faec(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d6faec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d6faec(); +} diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f07e18872 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_d6faec() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d6faec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d6faec(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cab57863c4 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_d6faec() { + matrix arg_0 = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d6faec(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d6faec(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022366B94660(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000022366B94660(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl new file mode 100644 index 0000000000..b4d1afed88 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_d6faec() { + f16mat2x3 arg_0 = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_d6faec(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_d6faec() { + f16mat2x3 arg_0 = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_d6faec(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_d6faec() { + f16mat2x3 arg_0 = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3x2 res = transpose(arg_0); +} + +void compute_main() { + transpose_d6faec(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.msl new file mode 100644 index 0000000000..1f7eac07e3 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_d6faec() { + half2x3 arg_0 = half2x3(half3(0.0h), half3(0.0h)); + half3x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_d6faec(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_d6faec(); + return; +} + +kernel void compute_main() { + transpose_d6faec(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.spvasm new file mode 100644 index 0000000000..513643d34f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_d6faec "transpose_d6faec" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %16 = OpConstantNull %mat2v3half +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half + %25 = OpConstantNull %mat3v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_d6faec = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v3half Function %16 + %res = OpVariable %_ptr_Function_mat3v2half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat2v3half %arg_0 + %19 = OpTranspose %mat3v2half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_d6faec + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_d6faec + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_d6faec + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.wgsl new file mode 100644 index 0000000000..472aade960 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d6faec.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_d6faec() { + var arg_0 = mat2x3(f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat3x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d6faec(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d6faec(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d6faec(); +} diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl new file mode 100644 index 0000000000..9f61b7c17f --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<3, 4, f32>) -> mat<4, 3, f32> +fn transpose_d8f8ba() { + var arg_0 = mat3x4(1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: mat4x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d8f8ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d8f8ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d8f8ba(); +} diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2cd9d6bacc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_d8f8ba() { + float3x4 arg_0 = float3x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); + float4x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d8f8ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d8f8ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d8f8ba(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2cd9d6bacc --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void transpose_d8f8ba() { + float3x4 arg_0 = float3x4((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx); + float4x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_d8f8ba(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_d8f8ba(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_d8f8ba(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl new file mode 100644 index 0000000000..fd91e2e185 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_d8f8ba() { + mat3x4 arg_0 = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f)); + mat4x3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_d8f8ba(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_d8f8ba() { + mat3x4 arg_0 = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f)); + mat4x3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_d8f8ba(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_d8f8ba() { + mat3x4 arg_0 = mat3x4(vec4(1.0f), vec4(1.0f), vec4(1.0f)); + mat4x3 res = transpose(arg_0); +} + +void compute_main() { + transpose_d8f8ba(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl new file mode 100644 index 0000000000..29a2dad566 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_d8f8ba() { + float3x4 arg_0 = float3x4(float4(1.0f), float4(1.0f), float4(1.0f)); + float4x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_d8f8ba(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_d8f8ba(); + return; +} + +kernel void compute_main() { + transpose_d8f8ba(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6b20c4123 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_d8f8ba "transpose_d8f8ba" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%mat3v4float = OpTypeMatrix %v4float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %16 = OpConstantComposite %mat3v4float %15 %15 %15 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %19 = OpConstantNull %mat3v4float + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %26 = OpConstantNull %mat4v3float + %27 = OpTypeFunction %v4float +%transpose_d8f8ba = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v4float Function %19 + %res = OpVariable %_ptr_Function_mat4v3float Function %26 + OpStore %arg_0 %16 + %23 = OpLoad %mat3v4float %arg_0 + %20 = OpTranspose %mat4v3float %23 + OpStore %res %20 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %27 + %29 = OpLabel + %30 = OpFunctionCall %void %transpose_d8f8ba + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %33 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_d8f8ba + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_d8f8ba + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl new file mode 100644 index 0000000000..c7717059d1 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_d8f8ba() { + var arg_0 = mat3x4(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : mat4x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_d8f8ba(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_d8f8ba(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_d8f8ba(); +} diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl new file mode 100644 index 0000000000..713d61c3f9 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn transpose(mat<3, 2, f32>) -> mat<2, 3, f32> +fn transpose_ed4bdc() { + var arg_0 = mat3x2(1.f, 1.f, 1.f, 1.f, 1.f, 1.f); + var res: mat2x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_ed4bdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_ed4bdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_ed4bdc(); +} diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..78abe82781 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_ed4bdc() { + float3x2 arg_0 = float3x2((1.0f).xx, (1.0f).xx, (1.0f).xx); + float2x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_ed4bdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_ed4bdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_ed4bdc(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..78abe82781 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void transpose_ed4bdc() { + float3x2 arg_0 = float3x2((1.0f).xx, (1.0f).xx, (1.0f).xx); + float2x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_ed4bdc(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_ed4bdc(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_ed4bdc(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl new file mode 100644 index 0000000000..00d785f233 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void transpose_ed4bdc() { + mat3x2 arg_0 = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f)); + mat2x3 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_ed4bdc(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void transpose_ed4bdc() { + mat3x2 arg_0 = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f)); + mat2x3 res = transpose(arg_0); +} + +void fragment_main() { + transpose_ed4bdc(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void transpose_ed4bdc() { + mat3x2 arg_0 = mat3x2(vec2(1.0f), vec2(1.0f), vec2(1.0f)); + mat2x3 res = transpose(arg_0); +} + +void compute_main() { + transpose_ed4bdc(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl new file mode 100644 index 0000000000..ecb35026f7 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_ed4bdc() { + float3x2 arg_0 = float3x2(float2(1.0f), float2(1.0f), float2(1.0f)); + float2x3 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_ed4bdc(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_ed4bdc(); + return; +} + +kernel void compute_main() { + transpose_ed4bdc(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.spvasm new file mode 100644 index 0000000000..da5aaeb7b2 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_ed4bdc "transpose_ed4bdc" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %float_1 = OpConstant %float 1 + %16 = OpConstantComposite %v2float %float_1 %float_1 + %17 = OpConstantComposite %mat3v2float %16 %16 %16 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %20 = OpConstantNull %mat3v2float + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %27 = OpConstantNull %mat2v3float + %28 = OpTypeFunction %v4float +%transpose_ed4bdc = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat3v2float Function %20 + %res = OpVariable %_ptr_Function_mat2v3float Function %27 + OpStore %arg_0 %17 + %24 = OpLoad %mat3v2float %arg_0 + %21 = OpTranspose %mat2v3float %24 + OpStore %res %21 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %28 + %30 = OpLabel + %31 = OpFunctionCall %void %transpose_ed4bdc + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %34 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %36 = OpLabel + %37 = OpFunctionCall %void %transpose_ed4bdc + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %39 = OpLabel + %40 = OpFunctionCall %void %transpose_ed4bdc + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl new file mode 100644 index 0000000000..a024948e8b --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn transpose_ed4bdc() { + var arg_0 = mat3x2(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + var res : mat2x3 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_ed4bdc(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_ed4bdc(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_ed4bdc(); +} diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl new file mode 100644 index 0000000000..0e2feed300 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn transpose(mat<2, 4, f16>) -> mat<4, 2, f16> +fn transpose_faeb05() { + var arg_0 = mat2x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res: mat4x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_faeb05(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_faeb05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_faeb05(); +} diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e318602606 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void transpose_faeb05() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_faeb05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_faeb05(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d4414a3503 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void transpose_faeb05() { + matrix arg_0 = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + matrix res = transpose(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + transpose_faeb05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + transpose_faeb05(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018F09DB3BF0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000018F09DB3BF0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl new file mode 100644 index 0000000000..3080917650 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_faeb05() { + f16mat2x4 arg_0 = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x2 res = transpose(arg_0); +} + +vec4 vertex_main() { + transpose_faeb05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void transpose_faeb05() { + f16mat2x4 arg_0 = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x2 res = transpose(arg_0); +} + +void fragment_main() { + transpose_faeb05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void transpose_faeb05() { + f16mat2x4 arg_0 = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4x2 res = transpose(arg_0); +} + +void compute_main() { + transpose_faeb05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.msl new file mode 100644 index 0000000000..f941a64552 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void transpose_faeb05() { + half2x4 arg_0 = half2x4(half4(0.0h), half4(0.0h)); + half4x2 res = transpose(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + transpose_faeb05(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + transpose_faeb05(); + return; +} + +kernel void compute_main() { + transpose_faeb05(); + return; +} + diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7a4c55661 --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.spvasm @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %transpose_faeb05 "transpose_faeb05" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %16 = OpConstantNull %mat2v4half +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half + %25 = OpConstantNull %mat4v2half + %26 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%transpose_faeb05 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_mat2v4half Function %16 + %res = OpVariable %_ptr_Function_mat4v2half Function %25 + OpStore %arg_0 %16 + %22 = OpLoad %mat2v4half %arg_0 + %19 = OpTranspose %mat4v2half %22 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %26 + %28 = OpLabel + %29 = OpFunctionCall %void %transpose_faeb05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %32 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %transpose_faeb05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %38 = OpLabel + %39 = OpFunctionCall %void %transpose_faeb05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6de2cbd2c --- /dev/null +++ b/test/tint/builtins/gen/var/transpose/faeb05.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn transpose_faeb05() { + var arg_0 = mat2x4(f16(), f16(), f16(), f16(), f16(), f16(), f16(), f16()); + var res : mat4x2 = transpose(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + transpose_faeb05(); + return vec4(); +} + +@fragment +fn fragment_main() { + transpose_faeb05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + transpose_faeb05(); +} diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl new file mode 100644 index 0000000000..144541ae66 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<3, f16>) -> vec<3, f16> +fn trunc_103ab8() { + var arg_0 = vec3(f16()); + var res: vec3 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_103ab8(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_103ab8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_103ab8(); +} diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6adf48c5c4 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_103ab8() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_103ab8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_103ab8(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b061405db5 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void trunc_103ab8() { + vector arg_0 = (float16_t(0.0h)).xxx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_103ab8(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_103ab8(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020DD35586D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000020DD35586D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl new file mode 100644 index 0000000000..cd4f15d4f1 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_103ab8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_103ab8(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_103ab8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = trunc(arg_0); +} + +void fragment_main() { + trunc_103ab8(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_103ab8() { + f16vec3 arg_0 = f16vec3(0.0hf); + f16vec3 res = trunc(arg_0); +} + +void compute_main() { + trunc_103ab8(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl new file mode 100644 index 0000000000..3bd56b9c27 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_103ab8() { + half3 arg_0 = half3(0.0h); + half3 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_103ab8(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_103ab8(); + return; +} + +kernel void compute_main() { + trunc_103ab8(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm new file mode 100644 index 0000000000..7080335868 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_103ab8 "trunc_103ab8" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %15 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_103ab8 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Trunc %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %trunc_103ab8 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_103ab8 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %trunc_103ab8 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4cd5c830b --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn trunc_103ab8() { + var arg_0 = vec3(f16()); + var res : vec3 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_103ab8(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_103ab8(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_103ab8(); +} diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl new file mode 100644 index 0000000000..14bc4a65b1 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(vec<3, f32>) -> vec<3, f32> +fn trunc_562d05() { + var arg_0 = vec3(1.f); + var res: vec3 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_562d05(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_562d05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_562d05(); +} diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..685ad83f10 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_562d05() { + float3 arg_0 = (1.0f).xxx; + float3 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_562d05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_562d05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_562d05(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..685ad83f10 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void trunc_562d05() { + float3 arg_0 = (1.0f).xxx; + float3 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_562d05(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_562d05(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_562d05(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl new file mode 100644 index 0000000000..7b2bc3cd7e --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void trunc_562d05() { + vec3 arg_0 = vec3(1.0f); + vec3 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_562d05(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_562d05() { + vec3 arg_0 = vec3(1.0f); + vec3 res = trunc(arg_0); +} + +void fragment_main() { + trunc_562d05(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_562d05() { + vec3 arg_0 = vec3(1.0f); + vec3 res = trunc(arg_0); +} + +void compute_main() { + trunc_562d05(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl new file mode 100644 index 0000000000..e5632e67dc --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_562d05() { + float3 arg_0 = float3(1.0f); + float3 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_562d05(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_562d05(); + return; +} + +kernel void compute_main() { + trunc_562d05(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm new file mode 100644 index 0000000000..f5f52887b0 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_562d05 "trunc_562d05" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %23 = OpTypeFunction %v4float +%trunc_562d05 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v3float Function %18 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v3float %arg_0 + %19 = OpExtInst %v3float %20 Trunc %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %trunc_562d05 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_562d05 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %trunc_562d05 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl new file mode 100644 index 0000000000..f005830dc6 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn trunc_562d05() { + var arg_0 = vec3(1.0f); + var res : vec3 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_562d05(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_562d05(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_562d05(); +} diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl new file mode 100644 index 0000000000..f7ece8d716 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<2, f16>) -> vec<2, f16> +fn trunc_a56109() { + var arg_0 = vec2(f16()); + var res: vec2 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_a56109(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_a56109(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_a56109(); +} diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39ea25561b --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_a56109() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_a56109(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_a56109(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..36a52b19da --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void trunc_a56109() { + vector arg_0 = (float16_t(0.0h)).xx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_a56109(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_a56109(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD3B6C86D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001DD3B6C86D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl new file mode 100644 index 0000000000..754116e0ec --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_a56109() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_a56109(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_a56109() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = trunc(arg_0); +} + +void fragment_main() { + trunc_a56109(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_a56109() { + f16vec2 arg_0 = f16vec2(0.0hf); + f16vec2 res = trunc(arg_0); +} + +void compute_main() { + trunc_a56109(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl new file mode 100644 index 0000000000..395166bc39 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_a56109() { + half2 arg_0 = half2(0.0h); + half2 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_a56109(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_a56109(); + return; +} + +kernel void compute_main() { + trunc_a56109(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm new file mode 100644 index 0000000000..fa693e8dd3 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_a56109 "trunc_a56109" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %15 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_a56109 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Trunc %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %trunc_a56109 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_a56109 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %trunc_a56109 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl new file mode 100644 index 0000000000..be9c55da32 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn trunc_a56109() { + var arg_0 = vec2(f16()); + var res : vec2 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_a56109(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_a56109(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_a56109(); +} diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl new file mode 100644 index 0000000000..3aad0e3d85 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(f16) -> f16 +fn trunc_cc2b0d() { + var arg_0 = f16(); + var res: f16 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_cc2b0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_cc2b0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_cc2b0d(); +} diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e998713fb2 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_cc2b0d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_cc2b0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_cc2b0d(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2c934e2bef --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void trunc_cc2b0d() { + float16_t arg_0 = float16_t(0.0h); + float16_t res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_cc2b0d(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_cc2b0d(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023FD3F982D0(2,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x0000023FD3F982D0(2,13-17): error X3000: unrecognized identifier 'arg_0' + diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl new file mode 100644 index 0000000000..73a3d1e537 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_cc2b0d() { + float16_t arg_0 = 0.0hf; + float16_t res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_cc2b0d(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_cc2b0d() { + float16_t arg_0 = 0.0hf; + float16_t res = trunc(arg_0); +} + +void fragment_main() { + trunc_cc2b0d(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_cc2b0d() { + float16_t arg_0 = 0.0hf; + float16_t res = trunc(arg_0); +} + +void compute_main() { + trunc_cc2b0d(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl new file mode 100644 index 0000000000..3b88cd73ed --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_cc2b0d() { + half arg_0 = 0.0h; + half res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_cc2b0d(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_cc2b0d(); + return; +} + +kernel void compute_main() { + trunc_cc2b0d(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm new file mode 100644 index 0000000000..a227bbaf5b --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_cc2b0d "trunc_cc2b0d" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_cc2b0d = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Trunc %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %trunc_cc2b0d + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %trunc_cc2b0d + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpFunctionCall %void %trunc_cc2b0d + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl new file mode 100644 index 0000000000..5530fe352e --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn trunc_cc2b0d() { + var arg_0 = f16(); + var res : f16 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_cc2b0d(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_cc2b0d(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_cc2b0d(); +} diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl new file mode 100644 index 0000000000..a90b8321b1 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl @@ -0,0 +1,46 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +enable f16; + +// fn trunc(vec<4, f16>) -> vec<4, f16> +fn trunc_ce7c17() { + var arg_0 = vec4(f16()); + var res: vec4 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_ce7c17(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_ce7c17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_ce7c17(); +} diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b3fc9a34d3 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_ce7c17() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_ce7c17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_ce7c17(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..58aab6d079 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +SKIP: FAILED + +void trunc_ce7c17() { + vector arg_0 = (float16_t(0.0h)).xxxx; + vector res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_ce7c17(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_ce7c17(); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001469F0570D0(2,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\builtins\Shader@0x000001469F0570D0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl new file mode 100644 index 0000000000..53c46bdd96 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl @@ -0,0 +1,55 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_ce7c17() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_ce7c17(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +void trunc_ce7c17() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = trunc(arg_0); +} + +void fragment_main() { + trunc_ce7c17(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void trunc_ce7c17() { + f16vec4 arg_0 = f16vec4(0.0hf); + f16vec4 res = trunc(arg_0); +} + +void compute_main() { + trunc_ce7c17(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl new file mode 100644 index 0000000000..183371de7f --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_ce7c17() { + half4 arg_0 = half4(0.0h); + half4 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_ce7c17(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_ce7c17(); + return; +} + +kernel void compute_main() { + trunc_ce7c17(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm new file mode 100644 index 0000000000..9341301ab6 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_ce7c17 "trunc_ce7c17" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %15 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half + %22 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%trunc_ce7c17 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Trunc %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %trunc_ce7c17 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_ce7c17 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %trunc_ce7c17 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc7e46a46f --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +enable f16; + +fn trunc_ce7c17() { + var arg_0 = vec4(f16()); + var res : vec4 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_ce7c17(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_ce7c17(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_ce7c17(); +} diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl new file mode 100644 index 0000000000..c21a06b99e --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(vec<4, f32>) -> vec<4, f32> +fn trunc_e183aa() { + var arg_0 = vec4(1.f); + var res: vec4 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_e183aa(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_e183aa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_e183aa(); +} diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..10af761992 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_e183aa() { + float4 arg_0 = (1.0f).xxxx; + float4 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_e183aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_e183aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_e183aa(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..10af761992 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void trunc_e183aa() { + float4 arg_0 = (1.0f).xxxx; + float4 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_e183aa(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_e183aa(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_e183aa(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl new file mode 100644 index 0000000000..efb9d97035 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void trunc_e183aa() { + vec4 arg_0 = vec4(1.0f); + vec4 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_e183aa(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_e183aa() { + vec4 arg_0 = vec4(1.0f); + vec4 res = trunc(arg_0); +} + +void fragment_main() { + trunc_e183aa(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_e183aa() { + vec4 arg_0 = vec4(1.0f); + vec4 res = trunc(arg_0); +} + +void compute_main() { + trunc_e183aa(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl new file mode 100644 index 0000000000..4820d6cb84 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_e183aa() { + float4 arg_0 = float4(1.0f); + float4 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_e183aa(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_e183aa(); + return; +} + +kernel void compute_main() { + trunc_e183aa(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm new file mode 100644 index 0000000000..565159a506 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_e183aa "trunc_e183aa" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpTypeFunction %v4float +%trunc_e183aa = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v4float Function %5 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %14 + %19 = OpLoad %v4float %arg_0 + %17 = OpExtInst %v4float %18 Trunc %19 + OpStore %res %17 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %trunc_e183aa + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %trunc_e183aa + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %trunc_e183aa + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl new file mode 100644 index 0000000000..f1f1db3af4 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn trunc_e183aa() { + var arg_0 = vec4(1.0f); + var res : vec4 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_e183aa(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_e183aa(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_e183aa(); +} diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl new file mode 100644 index 0000000000..8ac0bdba26 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(f32) -> f32 +fn trunc_eb83df() { + var arg_0 = 1.f; + var res: f32 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_eb83df(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_eb83df(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_eb83df(); +} diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f13d9aa9c --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_eb83df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_eb83df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_eb83df(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f13d9aa9c --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_eb83df(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_eb83df(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_eb83df(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl new file mode 100644 index 0000000000..57e9bd8e22 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_eb83df(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +void fragment_main() { + trunc_eb83df(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +void compute_main() { + trunc_eb83df(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl new file mode 100644 index 0000000000..2408d6cc46 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_eb83df() { + float arg_0 = 1.0f; + float res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_eb83df(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_eb83df(); + return; +} + +kernel void compute_main() { + trunc_eb83df(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm new file mode 100644 index 0000000000..f5fa2a263e --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_eb83df "trunc_eb83df" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %v4float +%trunc_eb83df = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_float Function %8 + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %arg_0 %float_1 + %18 = OpLoad %float %arg_0 + %16 = OpExtInst %float %17 Trunc %18 + OpStore %res %16 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %trunc_eb83df + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %trunc_eb83df + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_eb83df + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl new file mode 100644 index 0000000000..ae1518f18a --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn trunc_eb83df() { + var arg_0 = 1.0f; + var res : f32 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_eb83df(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_eb83df(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_eb83df(); +} diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl new file mode 100644 index 0000000000..79159564f9 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn trunc(vec<2, f32>) -> vec<2, f32> +fn trunc_f370d3() { + var arg_0 = vec2(1.f); + var res: vec2 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_f370d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_f370d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_f370d3(); +} diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5f59f24583 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +void trunc_f370d3() { + float2 arg_0 = (1.0f).xx; + float2 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_f370d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_f370d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_f370d3(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5f59f24583 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +void trunc_f370d3() { + float2 arg_0 = (1.0f).xx; + float2 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + trunc_f370d3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + trunc_f370d3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + trunc_f370d3(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl new file mode 100644 index 0000000000..a850df2896 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void trunc_f370d3() { + vec2 arg_0 = vec2(1.0f); + vec2 res = trunc(arg_0); +} + +vec4 vertex_main() { + trunc_f370d3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void trunc_f370d3() { + vec2 arg_0 = vec2(1.0f); + vec2 res = trunc(arg_0); +} + +void fragment_main() { + trunc_f370d3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void trunc_f370d3() { + vec2 arg_0 = vec2(1.0f); + vec2 res = trunc(arg_0); +} + +void compute_main() { + trunc_f370d3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl new file mode 100644 index 0000000000..fdce7c2238 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void trunc_f370d3() { + float2 arg_0 = float2(1.0f); + float2 res = trunc(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + trunc_f370d3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + trunc_f370d3(); + return; +} + +kernel void compute_main() { + trunc_f370d3(); + return; +} + diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm new file mode 100644 index 0000000000..3736cd6243 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %trunc_f370d3 "trunc_f370d3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %23 = OpTypeFunction %v4float +%trunc_f370d3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_v2float Function %18 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %arg_0 %15 + %21 = OpLoad %v2float %arg_0 + %19 = OpExtInst %v2float %20 Trunc %21 + OpStore %res %19 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %trunc_f370d3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %trunc_f370d3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %trunc_f370d3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl new file mode 100644 index 0000000000..537761fb75 --- /dev/null +++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn trunc_f370d3() { + var arg_0 = vec2(1.0f); + var res : vec2 = trunc(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + trunc_f370d3(); + return vec4(); +} + +@fragment +fn fragment_main() { + trunc_f370d3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + trunc_f370d3(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl new file mode 100644 index 0000000000..da1e21b75e --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack2x16float(u32) -> vec2 +fn unpack2x16float_32a5cf() { + var arg_0 = 1u; + var res: vec2 = unpack2x16float(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16float_32a5cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16float_32a5cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16float_32a5cf(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1497db89b3 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +float2 tint_unpack2x16float(uint param_0) { + uint i = param_0; + return f16tof32(uint2(i & 0xffff, i >> 16)); +} + +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + float2 res = tint_unpack2x16float(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16float_32a5cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16float_32a5cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16float_32a5cf(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1497db89b3 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +float2 tint_unpack2x16float(uint param_0) { + uint i = param_0; + return f16tof32(uint2(i & 0xffff, i >> 16)); +} + +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + float2 res = tint_unpack2x16float(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16float_32a5cf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16float_32a5cf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16float_32a5cf(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl new file mode 100644 index 0000000000..e88f3bcd96 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + vec2 res = unpackHalf2x16(arg_0); +} + +vec4 vertex_main() { + unpack2x16float_32a5cf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + vec2 res = unpackHalf2x16(arg_0); +} + +void fragment_main() { + unpack2x16float_32a5cf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + vec2 res = unpackHalf2x16(arg_0); +} + +void compute_main() { + unpack2x16float_32a5cf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl new file mode 100644 index 0000000000..9bd1c579f2 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack2x16float_32a5cf() { + uint arg_0 = 1u; + float2 res = float2(as_type(arg_0)); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack2x16float_32a5cf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack2x16float_32a5cf(); + return; +} + +kernel void compute_main() { + unpack2x16float_32a5cf(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm new file mode 100644 index 0000000000..1abc4ab13f --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack2x16float_32a5cf "unpack2x16float_32a5cf" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack2x16float_32a5cf = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v2float Function %24 + OpStore %arg_0 %uint_1 + %21 = OpLoad %uint %arg_0 + %18 = OpExtInst %v2float %20 UnpackHalf2x16 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %unpack2x16float_32a5cf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %unpack2x16float_32a5cf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %unpack2x16float_32a5cf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl new file mode 100644 index 0000000000..98598a4a4e --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack2x16float_32a5cf() { + var arg_0 = 1u; + var res : vec2 = unpack2x16float(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16float_32a5cf(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16float_32a5cf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16float_32a5cf(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl new file mode 100644 index 0000000000..d25b7d7fb2 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack2x16snorm(u32) -> vec2 +fn unpack2x16snorm_b4aea6() { + var arg_0 = 1u; + var res: vec2 = unpack2x16snorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16snorm_b4aea6(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16snorm_b4aea6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16snorm_b4aea6(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab650e8f52 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +float2 tint_unpack2x16snorm(uint param_0) { + int j = int(param_0); + int2 i = int2(j << 16, j) >> 16; + return clamp(float2(i) / 32767.0, -1.0, 1.0); +} + +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + float2 res = tint_unpack2x16snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16snorm_b4aea6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16snorm_b4aea6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16snorm_b4aea6(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ab650e8f52 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +float2 tint_unpack2x16snorm(uint param_0) { + int j = int(param_0); + int2 i = int2(j << 16, j) >> 16; + return clamp(float2(i) / 32767.0, -1.0, 1.0); +} + +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + float2 res = tint_unpack2x16snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16snorm_b4aea6(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16snorm_b4aea6(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16snorm_b4aea6(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl new file mode 100644 index 0000000000..bb3b180e66 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + vec2 res = unpackSnorm2x16(arg_0); +} + +vec4 vertex_main() { + unpack2x16snorm_b4aea6(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + vec2 res = unpackSnorm2x16(arg_0); +} + +void fragment_main() { + unpack2x16snorm_b4aea6(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + vec2 res = unpackSnorm2x16(arg_0); +} + +void compute_main() { + unpack2x16snorm_b4aea6(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl new file mode 100644 index 0000000000..f3290ba722 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack2x16snorm_b4aea6() { + uint arg_0 = 1u; + float2 res = unpack_snorm2x16_to_float(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack2x16snorm_b4aea6(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack2x16snorm_b4aea6(); + return; +} + +kernel void compute_main() { + unpack2x16snorm_b4aea6(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f93655432 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack2x16snorm_b4aea6 "unpack2x16snorm_b4aea6" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack2x16snorm_b4aea6 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v2float Function %24 + OpStore %arg_0 %uint_1 + %21 = OpLoad %uint %arg_0 + %18 = OpExtInst %v2float %20 UnpackSnorm2x16 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %unpack2x16snorm_b4aea6 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %unpack2x16snorm_b4aea6 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %unpack2x16snorm_b4aea6 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl new file mode 100644 index 0000000000..fbff51dca0 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack2x16snorm_b4aea6() { + var arg_0 = 1u; + var res : vec2 = unpack2x16snorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16snorm_b4aea6(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16snorm_b4aea6(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16snorm_b4aea6(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl new file mode 100644 index 0000000000..7ada0e69db --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack2x16unorm(u32) -> vec2 +fn unpack2x16unorm_7699c0() { + var arg_0 = 1u; + var res: vec2 = unpack2x16unorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16unorm_7699c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16unorm_7699c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16unorm_7699c0(); +} diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..acf38cabbc --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +float2 tint_unpack2x16unorm(uint param_0) { + uint j = param_0; + uint2 i = uint2(j & 0xffff, j >> 16); + return float2(i) / 65535.0; +} + +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + float2 res = tint_unpack2x16unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16unorm_7699c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16unorm_7699c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16unorm_7699c0(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..acf38cabbc --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +float2 tint_unpack2x16unorm(uint param_0) { + uint j = param_0; + uint2 i = uint2(j & 0xffff, j >> 16); + return float2(i) / 65535.0; +} + +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + float2 res = tint_unpack2x16unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack2x16unorm_7699c0(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack2x16unorm_7699c0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack2x16unorm_7699c0(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl new file mode 100644 index 0000000000..500c304196 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + vec2 res = unpackUnorm2x16(arg_0); +} + +vec4 vertex_main() { + unpack2x16unorm_7699c0(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + vec2 res = unpackUnorm2x16(arg_0); +} + +void fragment_main() { + unpack2x16unorm_7699c0(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + vec2 res = unpackUnorm2x16(arg_0); +} + +void compute_main() { + unpack2x16unorm_7699c0(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl new file mode 100644 index 0000000000..9c935ce1f0 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack2x16unorm_7699c0() { + uint arg_0 = 1u; + float2 res = unpack_unorm2x16_to_float(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack2x16unorm_7699c0(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack2x16unorm_7699c0(); + return; +} + +kernel void compute_main() { + unpack2x16unorm_7699c0(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm new file mode 100644 index 0000000000..d73b4479a5 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %20 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack2x16unorm_7699c0 "unpack2x16unorm_7699c0" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float + %25 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack2x16unorm_7699c0 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v2float Function %24 + OpStore %arg_0 %uint_1 + %21 = OpLoad %uint %arg_0 + %18 = OpExtInst %v2float %20 UnpackUnorm2x16 %21 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %25 + %27 = OpLabel + %28 = OpFunctionCall %void %unpack2x16unorm_7699c0 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %31 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %34 = OpLabel + %35 = OpFunctionCall %void %unpack2x16unorm_7699c0 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %37 = OpLabel + %38 = OpFunctionCall %void %unpack2x16unorm_7699c0 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl new file mode 100644 index 0000000000..893e4db52d --- /dev/null +++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack2x16unorm_7699c0() { + var arg_0 = 1u; + var res : vec2 = unpack2x16unorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack2x16unorm_7699c0(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack2x16unorm_7699c0(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack2x16unorm_7699c0(); +} diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl new file mode 100644 index 0000000000..4375d6bf18 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack4x8snorm(u32) -> vec4 +fn unpack4x8snorm_523fb3() { + var arg_0 = 1u; + var res: vec4 = unpack4x8snorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8snorm_523fb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack4x8snorm_523fb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack4x8snorm_523fb3(); +} diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b7cc7308a4 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + float4 res = tint_unpack4x8snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8snorm_523fb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8snorm_523fb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8snorm_523fb3(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b7cc7308a4 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + float4 res = tint_unpack4x8snorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8snorm_523fb3(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8snorm_523fb3(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8snorm_523fb3(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl new file mode 100644 index 0000000000..2f7c01bf80 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + vec4 res = unpackSnorm4x8(arg_0); +} + +vec4 vertex_main() { + unpack4x8snorm_523fb3(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + vec4 res = unpackSnorm4x8(arg_0); +} + +void fragment_main() { + unpack4x8snorm_523fb3(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + vec4 res = unpackSnorm4x8(arg_0); +} + +void compute_main() { + unpack4x8snorm_523fb3(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl new file mode 100644 index 0000000000..364d8ea43a --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack4x8snorm_523fb3() { + uint arg_0 = 1u; + float4 res = unpack_snorm4x8_to_float(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack4x8snorm_523fb3(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack4x8snorm_523fb3(); + return; +} + +kernel void compute_main() { + unpack4x8snorm_523fb3(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ce5456522 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack4x8snorm_523fb3 "unpack4x8snorm_523fb3" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack4x8snorm_523fb3 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %uint_1 + %20 = OpLoad %uint %arg_0 + %18 = OpExtInst %v4float %19 UnpackSnorm4x8 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %unpack4x8snorm_523fb3 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %unpack4x8snorm_523fb3 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %unpack4x8snorm_523fb3 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl new file mode 100644 index 0000000000..14ff067904 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack4x8snorm_523fb3() { + var arg_0 = 1u; + var res : vec4 = unpack4x8snorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8snorm_523fb3(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack4x8snorm_523fb3(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack4x8snorm_523fb3(); +} diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl new file mode 100644 index 0000000000..bd30aa0b3d --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl @@ -0,0 +1,44 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn unpack4x8unorm(u32) -> vec4 +fn unpack4x8unorm_750c74() { + var arg_0 = 1u; + var res: vec4 = unpack4x8unorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8unorm_750c74(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack4x8unorm_750c74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack4x8unorm_750c74(); +} diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8cbb85395a --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + float4 res = tint_unpack4x8unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8unorm_750c74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8unorm_750c74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8unorm_750c74(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8cbb85395a --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + float4 res = tint_unpack4x8unorm(arg_0); +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + unpack4x8unorm_750c74(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + unpack4x8unorm_750c74(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + unpack4x8unorm_750c74(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl new file mode 100644 index 0000000000..b7d4334532 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl @@ -0,0 +1,52 @@ +#version 310 es + +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + vec4 res = unpackUnorm4x8(arg_0); +} + +vec4 vertex_main() { + unpack4x8unorm_750c74(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + vec4 res = unpackUnorm4x8(arg_0); +} + +void fragment_main() { + unpack4x8unorm_750c74(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + vec4 res = unpackUnorm4x8(arg_0); +} + +void compute_main() { + unpack4x8unorm_750c74(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl new file mode 100644 index 0000000000..a1bf4ae5c1 --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +void unpack4x8unorm_750c74() { + uint arg_0 = 1u; + float4 res = unpack_unorm4x8_to_float(arg_0); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + unpack4x8unorm_750c74(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + unpack4x8unorm_750c74(); + return; +} + +kernel void compute_main() { + unpack4x8unorm_750c74(); + return; +} + diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm new file mode 100644 index 0000000000..962a06f20a --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %19 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %unpack4x8unorm_750c74 "unpack4x8unorm_750c74" + OpName %arg_0 "arg_0" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %17 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float + %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%unpack4x8unorm_750c74 = OpFunction %void None %9 + %12 = OpLabel + %arg_0 = OpVariable %_ptr_Function_uint Function %17 + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %arg_0 %uint_1 + %20 = OpLoad %uint %arg_0 + %18 = OpExtInst %v4float %19 UnpackUnorm4x8 %20 + OpStore %res %18 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %23 + %25 = OpLabel + %26 = OpFunctionCall %void %unpack4x8unorm_750c74 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %29 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %32 = OpLabel + %33 = OpFunctionCall %void %unpack4x8unorm_750c74 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpFunctionCall %void %unpack4x8unorm_750c74 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl new file mode 100644 index 0000000000..70c798000d --- /dev/null +++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn unpack4x8unorm_750c74() { + var arg_0 = 1u; + var res : vec4 = unpack4x8unorm(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + unpack4x8unorm_750c74(); + return vec4(); +} + +@fragment +fn fragment_main() { + unpack4x8unorm_750c74(); +} + +@compute @workgroup_size(1) +fn compute_main() { + unpack4x8unorm_750c74(); +} diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl new file mode 100644 index 0000000000..e4933373e1 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl @@ -0,0 +1,32 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn workgroupBarrier() +fn workgroupBarrier_a17f7f() { + workgroupBarrier(); +} + +@compute @workgroup_size(1) +fn compute_main() { + workgroupBarrier_a17f7f(); +} diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8879f79963 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +void workgroupBarrier_a17f7f() { + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void compute_main() { + workgroupBarrier_a17f7f(); + return; +} diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8879f79963 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +void workgroupBarrier_a17f7f() { + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void compute_main() { + workgroupBarrier_a17f7f(); + return; +} diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl new file mode 100644 index 0000000000..677f05bcc3 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es + +void workgroupBarrier_a17f7f() { + barrier(); +} + +void compute_main() { + workgroupBarrier_a17f7f(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl new file mode 100644 index 0000000000..ed5ed22355 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +void workgroupBarrier_a17f7f() { + threadgroup_barrier(mem_flags::mem_threadgroup); +} + +kernel void compute_main() { + workgroupBarrier_a17f7f(); + return; +} + diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm new file mode 100644 index 0000000000..dfea5e8a20 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %workgroupBarrier_a17f7f "workgroupBarrier_a17f7f" + OpName %compute_main "compute_main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%workgroupBarrier_a17f7f = OpFunction %void None %1 + %4 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %1 + %10 = OpLabel + %11 = OpFunctionCall %void %workgroupBarrier_a17f7f + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl new file mode 100644 index 0000000000..377a35e3e8 --- /dev/null +++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn workgroupBarrier_a17f7f() { + workgroupBarrier(); +} + +@compute @workgroup_size(1) +fn compute_main() { + workgroupBarrier_a17f7f(); +} diff --git a/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl b/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl deleted file mode 100644 index 2f1d6d6ba3..0000000000 --- a/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2021 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//////////////////////////////////////////////////////////////////////////////// -// File generated by tools/intrinsic-gen -// using the template: -// test/tint/builtins/builtins.wgsl.tmpl -// and the intrinsic defintion file: -// src/tint/intrinsics.def -// -// Do not modify this file directly -//////////////////////////////////////////////////////////////////////////////// - - -// fn workgroupBarrier() -fn workgroupBarrier_a17f7f() { - workgroupBarrier(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - workgroupBarrier_a17f7f(); -} diff --git a/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.wgsl b/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.wgsl deleted file mode 100644 index 34db6c85a0..0000000000 --- a/test/tint/builtins/gen/workgroupBarrier/a17f7f.wgsl.expected.wgsl +++ /dev/null @@ -1,8 +0,0 @@ -fn workgroupBarrier_a17f7f() { - workgroupBarrier(); -} - -@stage(compute) @workgroup_size(1) -fn compute_main() { - workgroupBarrier_a17f7f(); -} diff --git a/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.hlsl b/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/insertBits/scalar/i32.spvasm.expected.hlsl rename to test/tint/builtins/insertBits/scalar/i32.spvasm.expected.dxc.hlsl diff --git a/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..8819221525 --- /dev/null +++ b/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,21 @@ +int tint_insert_bits(int v, int n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & int(mask)) | (v & int(~(mask)))); +} + +void f_1() { + int v = 0; + int n = 0; + uint offset_1 = 0u; + uint count = 0u; + const int x_15 = tint_insert_bits(v, n, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.spvasm b/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.spvasm index b8aa1b6a60..637e76d438 100644 --- a/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.spvasm +++ b/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 39 +; Bound: 37 ; Schema: 0 OpCapability Shader %11 = OpExtInstImport "GLSL.std.450" @@ -25,12 +25,10 @@ %uint_32 = OpConstant %uint 32 %void = OpTypeVoid %17 = OpTypeFunction %void - %int_0 = OpConstant %int 0 + %21 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %24 = OpConstantNull %int - %uint_0 = OpConstant %uint 0 + %25 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %29 = OpConstantNull %uint %tint_insert_bits = OpFunction %int None %1 %v = OpFunctionParameter %int %n = OpFunctionParameter %int @@ -46,23 +44,23 @@ OpFunctionEnd %f_1 = OpFunction %void None %17 %20 = OpLabel - %v_0 = OpVariable %_ptr_Function_int Function %24 - %n_0 = OpVariable %_ptr_Function_int Function %24 - %offset_1 = OpVariable %_ptr_Function_uint Function %29 - %count_0 = OpVariable %_ptr_Function_uint Function %29 - OpStore %v_0 %int_0 - OpStore %n_0 %int_0 - OpStore %offset_1 %uint_0 - OpStore %count_0 %uint_0 - %31 = OpLoad %int %v_0 - %32 = OpLoad %int %n_0 - %33 = OpLoad %uint %offset_1 - %34 = OpLoad %uint %count_0 - %35 = OpFunctionCall %int %tint_insert_bits %31 %32 %33 %34 + %v_0 = OpVariable %_ptr_Function_int Function %21 + %n_0 = OpVariable %_ptr_Function_int Function %21 + %offset_1 = OpVariable %_ptr_Function_uint Function %25 + %count_0 = OpVariable %_ptr_Function_uint Function %25 + OpStore %v_0 %21 + OpStore %n_0 %21 + OpStore %offset_1 %25 + OpStore %count_0 %25 + %29 = OpLoad %int %v_0 + %30 = OpLoad %int %n_0 + %31 = OpLoad %uint %offset_1 + %32 = OpLoad %uint %count_0 + %33 = OpFunctionCall %int %tint_insert_bits %29 %30 %31 %32 OpReturn OpFunctionEnd %f = OpFunction %void None %17 - %37 = OpLabel - %38 = OpFunctionCall %void %f_1 + %35 = OpLabel + %36 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.wgsl b/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.wgsl index d2859bc1c8..b10742e8d9 100644 --- a/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.wgsl +++ b/test/tint/builtins/insertBits/scalar/i32.spvasm.expected.wgsl @@ -11,7 +11,7 @@ fn f_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.hlsl b/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/insertBits/scalar/u32.spvasm.expected.hlsl rename to test/tint/builtins/insertBits/scalar/u32.spvasm.expected.dxc.hlsl diff --git a/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..3d759c7e1c --- /dev/null +++ b/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,21 @@ +uint tint_insert_bits(uint v, uint n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << s) & mask) | (v & ~(mask))); +} + +void f_1() { + uint v = 0u; + uint n = 0u; + uint offset_1 = 0u; + uint count = 0u; + const uint x_12 = tint_insert_bits(v, n, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.spvasm b/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.spvasm index a44f9da469..843fb94aff 100644 --- a/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.spvasm +++ b/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 35 +; Bound: 34 ; Schema: 0 OpCapability Shader %10 = OpExtInstImport "GLSL.std.450" @@ -24,9 +24,8 @@ %uint_32 = OpConstant %uint 32 %void = OpTypeVoid %16 = OpTypeFunction %void - %uint_0 = OpConstant %uint 0 + %20 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %23 = OpConstantNull %uint %tint_insert_bits = OpFunction %uint None %1 %v = OpFunctionParameter %uint %n = OpFunctionParameter %uint @@ -42,23 +41,23 @@ OpFunctionEnd %f_1 = OpFunction %void None %16 %19 = OpLabel - %v_0 = OpVariable %_ptr_Function_uint Function %23 - %n_0 = OpVariable %_ptr_Function_uint Function %23 - %offset_1 = OpVariable %_ptr_Function_uint Function %23 - %count_0 = OpVariable %_ptr_Function_uint Function %23 - OpStore %v_0 %uint_0 - OpStore %n_0 %uint_0 - OpStore %offset_1 %uint_0 - OpStore %count_0 %uint_0 - %27 = OpLoad %uint %v_0 - %28 = OpLoad %uint %n_0 - %29 = OpLoad %uint %offset_1 - %30 = OpLoad %uint %count_0 - %31 = OpFunctionCall %uint %tint_insert_bits %27 %28 %29 %30 + %v_0 = OpVariable %_ptr_Function_uint Function %20 + %n_0 = OpVariable %_ptr_Function_uint Function %20 + %offset_1 = OpVariable %_ptr_Function_uint Function %20 + %count_0 = OpVariable %_ptr_Function_uint Function %20 + OpStore %v_0 %20 + OpStore %n_0 %20 + OpStore %offset_1 %20 + OpStore %count_0 %20 + %26 = OpLoad %uint %v_0 + %27 = OpLoad %uint %n_0 + %28 = OpLoad %uint %offset_1 + %29 = OpLoad %uint %count_0 + %30 = OpFunctionCall %uint %tint_insert_bits %26 %27 %28 %29 OpReturn OpFunctionEnd %f = OpFunction %void None %16 - %33 = OpLabel - %34 = OpFunctionCall %void %f_1 + %32 = OpLabel + %33 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.wgsl b/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.wgsl index 78bbda0326..b10c69d299 100644 --- a/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.wgsl +++ b/test/tint/builtins/insertBits/scalar/u32.spvasm.expected.wgsl @@ -11,7 +11,7 @@ fn f_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..65915104b3 --- /dev/null +++ b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,21 @@ +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx))); +} + +void f_1() { + int3 v = (0).xxx; + int3 n = (0).xxx; + uint offset_1 = 0u; + uint count = 0u; + const int3 x_16 = tint_insert_bits(v, n, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..65915104b3 --- /dev/null +++ b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,21 @@ +int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx))); +} + +void f_1() { + int3 v = (0).xxx; + int3 n = (0).xxx; + uint offset_1 = 0u; + uint count = 0u; + const int3 x_16 = tint_insert_bits(v, n, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.glsl b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.glsl index 1befc7df04..8fd8ecde66 100644 --- a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.glsl +++ b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.glsl @@ -7,8 +7,8 @@ ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) { } void f_1() { - ivec3 v = ivec3(0, 0, 0); - ivec3 n = ivec3(0, 0, 0); + ivec3 v = ivec3(0); + ivec3 n = ivec3(0); uint offset_1 = 0u; uint count = 0u; ivec3 x_16 = tint_insert_bits(v, n, offset_1, count); diff --git a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.hlsl b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.hlsl deleted file mode 100644 index 617fce0974..0000000000 --- a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx))); -} - -void f_1() { - int3 v = int3(0, 0, 0); - int3 n = int3(0, 0, 0); - uint offset_1 = 0u; - uint count = 0u; - const int3 x_16 = tint_insert_bits(v, n, offset_1, count); - return; -} - -[numthreads(1, 1, 1)] -void f() { - f_1(); - return; -} diff --git a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.msl b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.msl index af5112b81f..f13a3b7b29 100644 --- a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.msl +++ b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.msl @@ -8,8 +8,8 @@ int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) { } void f_1() { - int3 v = int3(); - int3 n = int3(); + int3 v = int3(0); + int3 n = int3(0); uint offset_1 = 0u; uint count = 0u; int3 const x_18 = v; diff --git a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.spvasm b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.spvasm index b595d27b70..9681d0162c 100644 --- a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.spvasm +++ b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 39 +; Bound: 38 ; Schema: 0 OpCapability Shader %12 = OpExtInstImport "GLSL.std.450" @@ -28,9 +28,8 @@ %18 = OpTypeFunction %void %22 = OpConstantNull %v3int %_ptr_Function_v3int = OpTypePointer Function %v3int - %uint_0 = OpConstant %uint 0 + %26 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %29 = OpConstantNull %uint %tint_insert_bits = OpFunction %v3int None %1 %v = OpFunctionParameter %v3int %n = OpFunctionParameter %v3int @@ -48,21 +47,21 @@ %21 = OpLabel %v_0 = OpVariable %_ptr_Function_v3int Function %22 %n_0 = OpVariable %_ptr_Function_v3int Function %22 - %offset_1 = OpVariable %_ptr_Function_uint Function %29 - %count_0 = OpVariable %_ptr_Function_uint Function %29 + %offset_1 = OpVariable %_ptr_Function_uint Function %26 + %count_0 = OpVariable %_ptr_Function_uint Function %26 OpStore %v_0 %22 OpStore %n_0 %22 - OpStore %offset_1 %uint_0 - OpStore %count_0 %uint_0 - %31 = OpLoad %v3int %v_0 - %32 = OpLoad %v3int %n_0 - %33 = OpLoad %uint %offset_1 - %34 = OpLoad %uint %count_0 - %35 = OpFunctionCall %v3int %tint_insert_bits %31 %32 %33 %34 + OpStore %offset_1 %26 + OpStore %count_0 %26 + %30 = OpLoad %v3int %v_0 + %31 = OpLoad %v3int %n_0 + %32 = OpLoad %uint %offset_1 + %33 = OpLoad %uint %count_0 + %34 = OpFunctionCall %v3int %tint_insert_bits %30 %31 %32 %33 OpReturn OpFunctionEnd %f = OpFunction %void None %18 - %37 = OpLabel - %38 = OpFunctionCall %void %f_1 + %36 = OpLabel + %37 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.wgsl b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.wgsl index b5c54ca98b..ecacd5f395 100644 --- a/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.wgsl +++ b/test/tint/builtins/insertBits/vec3/i32.spvasm.expected.wgsl @@ -11,7 +11,7 @@ fn f_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..9d914838a0 --- /dev/null +++ b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.dxc.hlsl @@ -0,0 +1,21 @@ +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx))); +} + +void f_1() { + uint3 v = (0u).xxx; + uint3 n = (0u).xxx; + uint offset_1 = 0u; + uint count = 0u; + const uint3 x_15 = tint_insert_bits(v, n, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..9d914838a0 --- /dev/null +++ b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.fxc.hlsl @@ -0,0 +1,21 @@ +uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { + const uint s = min(offset, 32u); + const uint e = min(32u, (s + count)); + const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); + return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx))); +} + +void f_1() { + uint3 v = (0u).xxx; + uint3 n = (0u).xxx; + uint offset_1 = 0u; + uint count = 0u; + const uint3 x_15 = tint_insert_bits(v, n, offset_1, count); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.glsl b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.glsl index f42aebd394..186da21170 100644 --- a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.glsl +++ b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.glsl @@ -7,8 +7,8 @@ uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) { } void f_1() { - uvec3 v = uvec3(0u, 0u, 0u); - uvec3 n = uvec3(0u, 0u, 0u); + uvec3 v = uvec3(0u); + uvec3 n = uvec3(0u); uint offset_1 = 0u; uint count = 0u; uvec3 x_15 = tint_insert_bits(v, n, offset_1, count); diff --git a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.hlsl b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.hlsl deleted file mode 100644 index 9972d6a64b..0000000000 --- a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { - const uint s = min(offset, 32u); - const uint e = min(32u, (s + count)); - const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u)); - return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx))); -} - -void f_1() { - uint3 v = uint3(0u, 0u, 0u); - uint3 n = uint3(0u, 0u, 0u); - uint offset_1 = 0u; - uint count = 0u; - const uint3 x_15 = tint_insert_bits(v, n, offset_1, count); - return; -} - -[numthreads(1, 1, 1)] -void f() { - f_1(); - return; -} diff --git a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.msl b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.msl index 62eb987e7e..c85887169b 100644 --- a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.msl +++ b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.msl @@ -8,8 +8,8 @@ uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) { } void f_1() { - uint3 v = uint3(); - uint3 n = uint3(); + uint3 v = uint3(0u); + uint3 n = uint3(0u); uint offset_1 = 0u; uint count = 0u; uint3 const x_17 = v; diff --git a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.spvasm b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.spvasm index 688e14073c..b60baaf771 100644 --- a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.spvasm +++ b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 37 ; Schema: 0 OpCapability Shader %11 = OpExtInstImport "GLSL.std.450" @@ -27,9 +27,8 @@ %17 = OpTypeFunction %void %21 = OpConstantNull %v3uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %uint_0 = OpConstant %uint 0 + %25 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %28 = OpConstantNull %uint %tint_insert_bits = OpFunction %v3uint None %1 %v = OpFunctionParameter %v3uint %n = OpFunctionParameter %v3uint @@ -47,21 +46,21 @@ %20 = OpLabel %v_0 = OpVariable %_ptr_Function_v3uint Function %21 %n_0 = OpVariable %_ptr_Function_v3uint Function %21 - %offset_1 = OpVariable %_ptr_Function_uint Function %28 - %count_0 = OpVariable %_ptr_Function_uint Function %28 + %offset_1 = OpVariable %_ptr_Function_uint Function %25 + %count_0 = OpVariable %_ptr_Function_uint Function %25 OpStore %v_0 %21 OpStore %n_0 %21 - OpStore %offset_1 %uint_0 - OpStore %count_0 %uint_0 - %30 = OpLoad %v3uint %v_0 - %31 = OpLoad %v3uint %n_0 - %32 = OpLoad %uint %offset_1 - %33 = OpLoad %uint %count_0 - %34 = OpFunctionCall %v3uint %tint_insert_bits %30 %31 %32 %33 + OpStore %offset_1 %25 + OpStore %count_0 %25 + %29 = OpLoad %v3uint %v_0 + %30 = OpLoad %v3uint %n_0 + %31 = OpLoad %uint %offset_1 + %32 = OpLoad %uint %count_0 + %33 = OpFunctionCall %v3uint %tint_insert_bits %29 %30 %31 %32 OpReturn OpFunctionEnd %f = OpFunction %void None %17 - %36 = OpLabel - %37 = OpFunctionCall %void %f_1 + %35 = OpLabel + %36 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.wgsl b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.wgsl index 69dd715a5f..23b4e7fa3b 100644 --- a/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.wgsl +++ b/test/tint/builtins/insertBits/vec3/u32.spvasm.expected.wgsl @@ -11,7 +11,7 @@ fn f_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/builtins/modf.wgsl b/test/tint/builtins/modf.wgsl index 6991b74f30..c96821a333 100644 --- a/test/tint/builtins/modf.wgsl +++ b/test/tint/builtins/modf.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let res = modf(1.23); let fract : f32 = res.fract; diff --git a/test/tint/builtins/modf.wgsl.expected.dxc.hlsl b/test/tint/builtins/modf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6ea70f3eed --- /dev/null +++ b/test/tint/builtins/modf.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +[numthreads(1, 1, 1)] +void main() { + const modf_result res = tint_modf(1.230000019f); + const float fract = res.fract; + const float whole = res.whole; + return; +} diff --git a/test/tint/builtins/modf.wgsl.expected.fxc.hlsl b/test/tint/builtins/modf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ea70f3eed --- /dev/null +++ b/test/tint/builtins/modf.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +struct modf_result { + float fract; + float whole; +}; +modf_result tint_modf(float param_0) { + modf_result result; + result.fract = modf(param_0, result.whole); + return result; +} + +[numthreads(1, 1, 1)] +void main() { + const modf_result res = tint_modf(1.230000019f); + const float fract = res.fract; + const float whole = res.whole; + return; +} diff --git a/test/tint/builtins/modf.wgsl.expected.hlsl b/test/tint/builtins/modf.wgsl.expected.hlsl deleted file mode 100644 index d2bdca4499..0000000000 --- a/test/tint/builtins/modf.wgsl.expected.hlsl +++ /dev/null @@ -1,18 +0,0 @@ -struct modf_result { - float fract; - float whole; -}; -modf_result tint_modf(float param_0) { - float whole; - float fract = modf(param_0, whole); - modf_result result = {fract, whole}; - return result; -} - -[numthreads(1, 1, 1)] -void main() { - const modf_result res = tint_modf(1.230000019f); - const float fract = res.fract; - const float whole = res.whole; - return; -} diff --git a/test/tint/builtins/modf.wgsl.expected.msl b/test/tint/builtins/modf.wgsl.expected.msl index 6f6cf69501..108250d0ae 100644 --- a/test/tint/builtins/modf.wgsl.expected.msl +++ b/test/tint/builtins/modf.wgsl.expected.msl @@ -7,9 +7,9 @@ struct modf_result { float whole; }; modf_result tint_modf(float param_0) { - float whole; - float fract = modf(param_0, whole); - return {fract, whole}; + modf_result result; + result.fract = modf(param_0, result.whole); + return result; } kernel void tint_symbol() { diff --git a/test/tint/builtins/modf.wgsl.expected.wgsl b/test/tint/builtins/modf.wgsl.expected.wgsl index 8e95d07f81..a0f85b816c 100644 --- a/test/tint/builtins/modf.wgsl.expected.wgsl +++ b/test/tint/builtins/modf.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let res = modf(1.230000019); let fract : f32 = res.fract; diff --git a/test/tint/builtins/radians.spvasm.expected.hlsl b/test/tint/builtins/radians.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/builtins/radians.spvasm.expected.hlsl rename to test/tint/builtins/radians.spvasm.expected.dxc.hlsl diff --git a/test/tint/builtins/radians.spvasm.expected.fxc.hlsl b/test/tint/builtins/radians.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b573cec1c6 --- /dev/null +++ b/test/tint/builtins/radians.spvasm.expected.fxc.hlsl @@ -0,0 +1,17 @@ +float tint_radians(float param_0) { + return param_0 * 0.017453292519943295474; +} + +void main_1() { + float a = 0.0f; + float b = 0.0f; + a = 42.0f; + b = tint_radians(a); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/builtins/radians.spvasm.expected.glsl b/test/tint/builtins/radians.spvasm.expected.glsl index 619ecb1796..eafeefec21 100644 --- a/test/tint/builtins/radians.spvasm.expected.glsl +++ b/test/tint/builtins/radians.spvasm.expected.glsl @@ -1,7 +1,7 @@ #version 310 es float tint_radians(float param_0) { - return param_0 * 0.017453292519943295474; + return param_0 * 0.017453292519943295474f; } diff --git a/test/tint/builtins/radians.spvasm.expected.wgsl b/test/tint/builtins/radians.spvasm.expected.wgsl index 82cb5fb0e2..a3de69200f 100644 --- a/test/tint/builtins/radians.spvasm.expected.wgsl +++ b/test/tint/builtins/radians.spvasm.expected.wgsl @@ -1,13 +1,13 @@ fn main_1() { var a : f32; var b : f32; - a = 42.0; + a = 42.0f; let x_11 : f32 = a; b = radians(x_11); return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/builtins/repeated_use.wgsl b/test/tint/builtins/repeated_use.wgsl index 511968d0f2..f1f1f0f5c4 100644 --- a/test/tint/builtins/repeated_use.wgsl +++ b/test/tint/builtins/repeated_use.wgsl @@ -1,20 +1,20 @@ // Check that for backends that generate builtin helpers, repeated use of the // same builtin overload results in single helper being generated. -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = degrees(vec4()); - _ = degrees(vec4(1.)); - _ = degrees(vec4(1., 2., 3., 4.)); + let a = degrees(vec4()); + let b = degrees(vec4(1.)); + let c = degrees(vec4(1., 2., 3., 4.)); - _ = degrees(vec3()); - _ = degrees(vec3(1.)); - _ = degrees(vec3(1., 2., 3.)); + let d = degrees(vec3()); + let e = degrees(vec3(1.)); + let f = degrees(vec3(1., 2., 3.)); - _ = degrees(vec2()); - _ = degrees(vec2(1.)); - _ = degrees(vec2(1., 2.)); + let g = degrees(vec2()); + let h = degrees(vec2(1.)); + let i = degrees(vec2(1., 2.)); - _ = degrees(1.); - _ = degrees(2.); - _ = degrees(3.); + let j = degrees(1.); + let k = degrees(2.); + let l = degrees(3.); } diff --git a/test/tint/builtins/repeated_use.wgsl.expected.dxc.hlsl b/test/tint/builtins/repeated_use.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bbf29d1edc --- /dev/null +++ b/test/tint/builtins/repeated_use.wgsl.expected.dxc.hlsl @@ -0,0 +1,32 @@ +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +float3 tint_degrees_1(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +float2 tint_degrees_2(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +float tint_degrees_3(float param_0) { + return param_0 * 57.295779513082322865; +} + +[numthreads(1, 1, 1)] +void main() { + const float4 a = tint_degrees((0.0f).xxxx); + const float4 b = tint_degrees((1.0f).xxxx); + const float4 c = tint_degrees(float4(1.0f, 2.0f, 3.0f, 4.0f)); + const float3 d = tint_degrees_1((0.0f).xxx); + const float3 e = tint_degrees_1((1.0f).xxx); + const float3 f = tint_degrees_1(float3(1.0f, 2.0f, 3.0f)); + const float2 g = tint_degrees_2((0.0f).xx); + const float2 h = tint_degrees_2((1.0f).xx); + const float2 i = tint_degrees_2(float2(1.0f, 2.0f)); + const float j = tint_degrees_3(1.0f); + const float k = tint_degrees_3(2.0f); + const float l = tint_degrees_3(3.0f); + return; +} diff --git a/test/tint/builtins/repeated_use.wgsl.expected.fxc.hlsl b/test/tint/builtins/repeated_use.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bbf29d1edc --- /dev/null +++ b/test/tint/builtins/repeated_use.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +float4 tint_degrees(float4 param_0) { + return param_0 * 57.295779513082322865; +} + +float3 tint_degrees_1(float3 param_0) { + return param_0 * 57.295779513082322865; +} + +float2 tint_degrees_2(float2 param_0) { + return param_0 * 57.295779513082322865; +} + +float tint_degrees_3(float param_0) { + return param_0 * 57.295779513082322865; +} + +[numthreads(1, 1, 1)] +void main() { + const float4 a = tint_degrees((0.0f).xxxx); + const float4 b = tint_degrees((1.0f).xxxx); + const float4 c = tint_degrees(float4(1.0f, 2.0f, 3.0f, 4.0f)); + const float3 d = tint_degrees_1((0.0f).xxx); + const float3 e = tint_degrees_1((1.0f).xxx); + const float3 f = tint_degrees_1(float3(1.0f, 2.0f, 3.0f)); + const float2 g = tint_degrees_2((0.0f).xx); + const float2 h = tint_degrees_2((1.0f).xx); + const float2 i = tint_degrees_2(float2(1.0f, 2.0f)); + const float j = tint_degrees_3(1.0f); + const float k = tint_degrees_3(2.0f); + const float l = tint_degrees_3(3.0f); + return; +} diff --git a/test/tint/builtins/repeated_use.wgsl.expected.glsl b/test/tint/builtins/repeated_use.wgsl.expected.glsl index 6c50347e7e..fdd29e0245 100644 --- a/test/tint/builtins/repeated_use.wgsl.expected.glsl +++ b/test/tint/builtins/repeated_use.wgsl.expected.glsl @@ -1,35 +1,35 @@ #version 310 es vec4 tint_degrees(vec4 param_0) { - return param_0 * 57.295779513082322865; + return param_0 * 57.295779513082322865f; } vec3 tint_degrees_1(vec3 param_0) { - return param_0 * 57.295779513082322865; + return param_0 * 57.295779513082322865f; } vec2 tint_degrees_2(vec2 param_0) { - return param_0 * 57.295779513082322865; + return param_0 * 57.295779513082322865f; } float tint_degrees_3(float param_0) { - return param_0 * 57.295779513082322865; + return param_0 * 57.295779513082322865f; } void tint_symbol() { - tint_degrees(vec4(0.0f, 0.0f, 0.0f, 0.0f)); - tint_degrees(vec4(1.0f)); - tint_degrees(vec4(1.0f, 2.0f, 3.0f, 4.0f)); - tint_degrees_1(vec3(0.0f, 0.0f, 0.0f)); - tint_degrees_1(vec3(1.0f)); - tint_degrees_1(vec3(1.0f, 2.0f, 3.0f)); - tint_degrees_2(vec2(0.0f, 0.0f)); - tint_degrees_2(vec2(1.0f)); - tint_degrees_2(vec2(1.0f, 2.0f)); - tint_degrees_3(1.0f); - tint_degrees_3(2.0f); - tint_degrees_3(3.0f); + vec4 a = tint_degrees(vec4(0.0f)); + vec4 b = tint_degrees(vec4(1.0f)); + vec4 c = tint_degrees(vec4(1.0f, 2.0f, 3.0f, 4.0f)); + vec3 d = tint_degrees_1(vec3(0.0f)); + vec3 e = tint_degrees_1(vec3(1.0f)); + vec3 f = tint_degrees_1(vec3(1.0f, 2.0f, 3.0f)); + vec2 g = tint_degrees_2(vec2(0.0f)); + vec2 h = tint_degrees_2(vec2(1.0f)); + vec2 i = tint_degrees_2(vec2(1.0f, 2.0f)); + float j = tint_degrees_3(1.0f); + float k = tint_degrees_3(2.0f); + float l = tint_degrees_3(3.0f); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/builtins/repeated_use.wgsl.expected.hlsl b/test/tint/builtins/repeated_use.wgsl.expected.hlsl deleted file mode 100644 index c1cb022e03..0000000000 --- a/test/tint/builtins/repeated_use.wgsl.expected.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -float4 tint_degrees(float4 param_0) { - return param_0 * 57.295779513082322865; -} - -float3 tint_degrees_1(float3 param_0) { - return param_0 * 57.295779513082322865; -} - -float2 tint_degrees_2(float2 param_0) { - return param_0 * 57.295779513082322865; -} - -float tint_degrees_3(float param_0) { - return param_0 * 57.295779513082322865; -} - -[numthreads(1, 1, 1)] -void main() { - tint_degrees(float4(0.0f, 0.0f, 0.0f, 0.0f)); - tint_degrees(float4((1.0f).xxxx)); - tint_degrees(float4(1.0f, 2.0f, 3.0f, 4.0f)); - tint_degrees_1(float3(0.0f, 0.0f, 0.0f)); - tint_degrees_1(float3((1.0f).xxx)); - tint_degrees_1(float3(1.0f, 2.0f, 3.0f)); - tint_degrees_2(float2(0.0f, 0.0f)); - tint_degrees_2(float2((1.0f).xx)); - tint_degrees_2(float2(1.0f, 2.0f)); - tint_degrees_3(1.0f); - tint_degrees_3(2.0f); - tint_degrees_3(3.0f); - return; -} diff --git a/test/tint/builtins/repeated_use.wgsl.expected.msl b/test/tint/builtins/repeated_use.wgsl.expected.msl index cdf0372264..c0ea4a3d75 100644 --- a/test/tint/builtins/repeated_use.wgsl.expected.msl +++ b/test/tint/builtins/repeated_use.wgsl.expected.msl @@ -19,18 +19,18 @@ float tint_degrees_3(float param_0) { } kernel void tint_symbol() { - tint_degrees(float4()); - tint_degrees(float4(1.0f)); - tint_degrees(float4(1.0f, 2.0f, 3.0f, 4.0f)); - tint_degrees_1(float3()); - tint_degrees_1(float3(1.0f)); - tint_degrees_1(float3(1.0f, 2.0f, 3.0f)); - tint_degrees_2(float2()); - tint_degrees_2(float2(1.0f)); - tint_degrees_2(float2(1.0f, 2.0f)); - tint_degrees_3(1.0f); - tint_degrees_3(2.0f); - tint_degrees_3(3.0f); + float4 const a = tint_degrees(float4(0.0f)); + float4 const b = tint_degrees(float4(1.0f)); + float4 const c = tint_degrees(float4(1.0f, 2.0f, 3.0f, 4.0f)); + float3 const d = tint_degrees_1(float3(0.0f)); + float3 const e = tint_degrees_1(float3(1.0f)); + float3 const f = tint_degrees_1(float3(1.0f, 2.0f, 3.0f)); + float2 const g = tint_degrees_2(float2(0.0f)); + float2 const h = tint_degrees_2(float2(1.0f)); + float2 const i = tint_degrees_2(float2(1.0f, 2.0f)); + float const j = tint_degrees_3(1.0f); + float const k = tint_degrees_3(2.0f); + float const l = tint_degrees_3(3.0f); return; } diff --git a/test/tint/builtins/repeated_use.wgsl.expected.wgsl b/test/tint/builtins/repeated_use.wgsl.expected.wgsl index 7b270c734e..0af3aa2bf2 100644 --- a/test/tint/builtins/repeated_use.wgsl.expected.wgsl +++ b/test/tint/builtins/repeated_use.wgsl.expected.wgsl @@ -1,15 +1,15 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = degrees(vec4()); - _ = degrees(vec4(1.0)); - _ = degrees(vec4(1.0, 2.0, 3.0, 4.0)); - _ = degrees(vec3()); - _ = degrees(vec3(1.0)); - _ = degrees(vec3(1.0, 2.0, 3.0)); - _ = degrees(vec2()); - _ = degrees(vec2(1.0)); - _ = degrees(vec2(1.0, 2.0)); - _ = degrees(1.0); - _ = degrees(2.0); - _ = degrees(3.0); + let a = degrees(vec4()); + let b = degrees(vec4(1.0)); + let c = degrees(vec4(1.0, 2.0, 3.0, 4.0)); + let d = degrees(vec3()); + let e = degrees(vec3(1.0)); + let f = degrees(vec3(1.0, 2.0, 3.0)); + let g = degrees(vec2()); + let h = degrees(vec2(1.0)); + let i = degrees(vec2(1.0, 2.0)); + let j = degrees(1.0); + let k = degrees(2.0); + let l = degrees(3.0); } diff --git a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.dxc.hlsl b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..1f9139f59b --- /dev/null +++ b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.dxc.hlsl @@ -0,0 +1,63 @@ +Texture2DMS arg_0 : register(t0, space1); +static float4 tint_symbol_1 = (0.0f).xxxx; + +void textureDimensions_f60bdb() { + int2 res = (0).xx; + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + const int2 x_16 = int2(tint_tmp.xy); + res = x_16; + return; +} + +void tint_symbol_2(float4 tint_symbol) { + tint_symbol_1 = tint_symbol; + return; +} + +void vertex_main_1() { + textureDimensions_f60bdb(); + tint_symbol_2((0.0f).xxxx); + return; +} + +struct vertex_main_out { + float4 tint_symbol_1_1; +}; +struct tint_symbol_3 { + float4 tint_symbol_1_1 : SV_Position; +}; + +vertex_main_out vertex_main_inner() { + vertex_main_1(); + const vertex_main_out tint_symbol_4 = {tint_symbol_1}; + return tint_symbol_4; +} + +tint_symbol_3 vertex_main() { + const vertex_main_out inner_result = vertex_main_inner(); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; + return wrapper_result; +} + +void fragment_main_1() { + textureDimensions_f60bdb(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + textureDimensions_f60bdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.fxc.hlsl b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1f9139f59b --- /dev/null +++ b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.fxc.hlsl @@ -0,0 +1,63 @@ +Texture2DMS arg_0 : register(t0, space1); +static float4 tint_symbol_1 = (0.0f).xxxx; + +void textureDimensions_f60bdb() { + int2 res = (0).xx; + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + const int2 x_16 = int2(tint_tmp.xy); + res = x_16; + return; +} + +void tint_symbol_2(float4 tint_symbol) { + tint_symbol_1 = tint_symbol; + return; +} + +void vertex_main_1() { + textureDimensions_f60bdb(); + tint_symbol_2((0.0f).xxxx); + return; +} + +struct vertex_main_out { + float4 tint_symbol_1_1; +}; +struct tint_symbol_3 { + float4 tint_symbol_1_1 : SV_Position; +}; + +vertex_main_out vertex_main_inner() { + vertex_main_1(); + const vertex_main_out tint_symbol_4 = {tint_symbol_1}; + return tint_symbol_4; +} + +tint_symbol_3 vertex_main() { + const vertex_main_out inner_result = vertex_main_inner(); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; + return wrapper_result; +} + +void fragment_main_1() { + textureDimensions_f60bdb(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + textureDimensions_f60bdb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.glsl b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.glsl index 2d8912e19f..d4d4faf8eb 100644 --- a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.glsl +++ b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.glsl @@ -1,9 +1,9 @@ #version 310 es -vec4 tint_symbol_1 = vec4(0.0f, 0.0f, 0.0f, 0.0f); +vec4 tint_symbol_1 = vec4(0.0f); uniform highp sampler2DMS arg_0_1; void textureDimensions_f60bdb() { - ivec2 res = ivec2(0, 0); + ivec2 res = ivec2(0); ivec2 x_16 = ivec2(textureSize(arg_0_1)); res = x_16; return; @@ -16,7 +16,7 @@ void tint_symbol_2(vec4 tint_symbol) { void vertex_main_1() { textureDimensions_f60bdb(); - tint_symbol_2(vec4(0.0f, 0.0f, 0.0f, 0.0f)); + tint_symbol_2(vec4(0.0f)); return; } @@ -43,7 +43,7 @@ precision mediump float; uniform highp sampler2DMS arg_0_1; void textureDimensions_f60bdb() { - ivec2 res = ivec2(0, 0); + ivec2 res = ivec2(0); ivec2 x_16 = ivec2(textureSize(arg_0_1)); res = x_16; return; @@ -70,7 +70,7 @@ void main() { uniform highp sampler2DMS arg_0_1; void textureDimensions_f60bdb() { - ivec2 res = ivec2(0, 0); + ivec2 res = ivec2(0); ivec2 x_16 = ivec2(textureSize(arg_0_1)); res = x_16; return; diff --git a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.hlsl b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.hlsl deleted file mode 100644 index f031e02803..0000000000 --- a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.hlsl +++ /dev/null @@ -1,63 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); -static float4 tint_symbol_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void textureDimensions_f60bdb() { - int2 res = int2(0, 0); - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - const int2 x_16 = int2(tint_tmp.xy); - res = x_16; - return; -} - -void tint_symbol_2(float4 tint_symbol) { - tint_symbol_1 = tint_symbol; - return; -} - -void vertex_main_1() { - textureDimensions_f60bdb(); - tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f)); - return; -} - -struct vertex_main_out { - float4 tint_symbol_1_1; -}; -struct tint_symbol_3 { - float4 tint_symbol_1_1 : SV_Position; -}; - -vertex_main_out vertex_main_inner() { - vertex_main_1(); - const vertex_main_out tint_symbol_4 = {tint_symbol_1}; - return tint_symbol_4; -} - -tint_symbol_3 vertex_main() { - const vertex_main_out inner_result = vertex_main_inner(); - tint_symbol_3 wrapper_result = (tint_symbol_3)0; - wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; - return wrapper_result; -} - -void fragment_main_1() { - textureDimensions_f60bdb(); - return; -} - -void fragment_main() { - fragment_main_1(); - return; -} - -void compute_main_1() { - textureDimensions_f60bdb(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - compute_main_1(); - return; -} diff --git a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.msl b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.msl index 670bd019f3..888f685a86 100644 --- a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.msl +++ b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void textureDimensions_f60bdb(depth2d_ms tint_symbol_5) { - int2 res = int2(); + int2 res = int2(0); int2 const x_16 = int2(int2(tint_symbol_5.get_width(), tint_symbol_5.get_height())); res = x_16; return; @@ -15,7 +15,7 @@ void tint_symbol_2(float4 tint_symbol, thread float4* const tint_symbol_6) { void vertex_main_1(depth2d_ms tint_symbol_7, thread float4* const tint_symbol_8) { textureDimensions_f60bdb(tint_symbol_7); - tint_symbol_2(float4(), tint_symbol_8); + tint_symbol_2(float4(0.0f), tint_symbol_8); return; } @@ -34,7 +34,7 @@ vertex_main_out vertex_main_inner(depth2d_ms tint_symbol_9, } vertex tint_symbol_3 vertex_main(depth2d_ms tint_symbol_11 [[texture(0)]]) { - thread float4 tint_symbol_12 = float4(); + thread float4 tint_symbol_12 = float4(0.0f); vertex_main_out const inner_result = vertex_main_inner(tint_symbol_11, &(tint_symbol_12)); tint_symbol_3 wrapper_result = {}; wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; diff --git a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.wgsl b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.wgsl index 3a370a18fc..078ede8547 100644 --- a/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.wgsl +++ b/test/tint/builtins/textureDimensions/depth_ms.spvasm.expected.wgsl @@ -25,7 +25,7 @@ struct vertex_main_out { tint_symbol_1_1 : vec4, } -@stage(vertex) +@vertex fn vertex_main() -> vertex_main_out { vertex_main_1(); return vertex_main_out(tint_symbol_1); @@ -36,7 +36,7 @@ fn fragment_main_1() { return; } -@stage(fragment) +@fragment fn fragment_main() { fragment_main_1(); } @@ -46,7 +46,7 @@ fn compute_main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn compute_main() { compute_main_1(); } diff --git a/test/tint/builtins/textureGather/f32/alpha.wgsl b/test/tint/builtins/textureGather/f32/alpha.wgsl index 1336988542..2b3eac525f 100644 --- a/test/tint/builtins/textureGather/f32/alpha.wgsl +++ b/test/tint/builtins/textureGather/f32/alpha.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(3, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f63ae88f46 --- /dev/null +++ b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + float4 res = t.GatherAlpha(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f63ae88f46 --- /dev/null +++ b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + float4 res = t.GatherAlpha(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.glsl b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.glsl index c49cedfd30..fb86fb4917 100644 --- a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp sampler2D t_s; void tint_symbol() { - vec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 3); + vec4 res = textureGather(t_s, vec2(0.0f), 3); } void main() { diff --git a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.hlsl b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.hlsl deleted file mode 100644 index 7f8232f6db..0000000000 --- a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - float4 res = t.GatherAlpha(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.msl b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.msl index 1f71e85b58..f085127191 100644 --- a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::w); + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::w); return; } diff --git a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.wgsl b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.wgsl index 3cf1392938..57049afb99 100644 --- a/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/f32/alpha.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(3, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/f32/blue.wgsl b/test/tint/builtins/textureGather/f32/blue.wgsl index f31387b1cd..fc3054de6d 100644 --- a/test/tint/builtins/textureGather/f32/blue.wgsl +++ b/test/tint/builtins/textureGather/f32/blue.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(2, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..56e8a18b7b --- /dev/null +++ b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + float4 res = t.GatherBlue(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56e8a18b7b --- /dev/null +++ b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + float4 res = t.GatherBlue(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.glsl b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.glsl index af5fc44f0f..7840c94e7e 100644 --- a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp sampler2D t_s; void tint_symbol() { - vec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 2); + vec4 res = textureGather(t_s, vec2(0.0f), 2); } void main() { diff --git a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.hlsl b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.hlsl deleted file mode 100644 index 696a8f020f..0000000000 --- a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - float4 res = t.GatherBlue(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.msl b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.msl index 588e727b40..4aef266cbe 100644 --- a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::z); + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::z); return; } diff --git a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.wgsl b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.wgsl index 2512919ec6..e7ddb12a0b 100644 --- a/test/tint/builtins/textureGather/f32/blue.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/f32/blue.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(2, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/f32/green.wgsl b/test/tint/builtins/textureGather/f32/green.wgsl index c0574ca628..9f3b06709c 100644 --- a/test/tint/builtins/textureGather/f32/green.wgsl +++ b/test/tint/builtins/textureGather/f32/green.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(1, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/f32/green.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/f32/green.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c56f1aaa6e --- /dev/null +++ b/test/tint/builtins/textureGather/f32/green.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + float4 res = t.GatherGreen(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/f32/green.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/f32/green.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c56f1aaa6e --- /dev/null +++ b/test/tint/builtins/textureGather/f32/green.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + float4 res = t.GatherGreen(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/f32/green.wgsl.expected.glsl b/test/tint/builtins/textureGather/f32/green.wgsl.expected.glsl index d0d5dbe8ba..fbccb56b27 100644 --- a/test/tint/builtins/textureGather/f32/green.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/f32/green.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp sampler2D t_s; void tint_symbol() { - vec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 1); + vec4 res = textureGather(t_s, vec2(0.0f), 1); } void main() { diff --git a/test/tint/builtins/textureGather/f32/green.wgsl.expected.hlsl b/test/tint/builtins/textureGather/f32/green.wgsl.expected.hlsl deleted file mode 100644 index ca621d7023..0000000000 --- a/test/tint/builtins/textureGather/f32/green.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - float4 res = t.GatherGreen(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/f32/green.wgsl.expected.msl b/test/tint/builtins/textureGather/f32/green.wgsl.expected.msl index c672905541..b3b3b4aa7f 100644 --- a/test/tint/builtins/textureGather/f32/green.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/f32/green.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::y); + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); return; } diff --git a/test/tint/builtins/textureGather/f32/green.wgsl.expected.wgsl b/test/tint/builtins/textureGather/f32/green.wgsl.expected.wgsl index 524c0c4efb..ea2c87f108 100644 --- a/test/tint/builtins/textureGather/f32/green.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/f32/green.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(1, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/f32/red.wgsl b/test/tint/builtins/textureGather/f32/red.wgsl index 4eb8c60275..abcb93a72b 100644 --- a/test/tint/builtins/textureGather/f32/red.wgsl +++ b/test/tint/builtins/textureGather/f32/red.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(0, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/f32/red.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/f32/red.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21d576122b --- /dev/null +++ b/test/tint/builtins/textureGather/f32/red.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + float4 res = t.GatherRed(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/f32/red.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/f32/red.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21d576122b --- /dev/null +++ b/test/tint/builtins/textureGather/f32/red.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + float4 res = t.GatherRed(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/f32/red.wgsl.expected.glsl b/test/tint/builtins/textureGather/f32/red.wgsl.expected.glsl index c1a257176b..ad15faf35e 100644 --- a/test/tint/builtins/textureGather/f32/red.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/f32/red.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp sampler2D t_s; void tint_symbol() { - vec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 0); + vec4 res = textureGather(t_s, vec2(0.0f), 0); } void main() { diff --git a/test/tint/builtins/textureGather/f32/red.wgsl.expected.hlsl b/test/tint/builtins/textureGather/f32/red.wgsl.expected.hlsl deleted file mode 100644 index c84ae29109..0000000000 --- a/test/tint/builtins/textureGather/f32/red.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - float4 res = t.GatherRed(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/f32/red.wgsl.expected.msl b/test/tint/builtins/textureGather/f32/red.wgsl.expected.msl index 78a9e9cebe..27d3c20c8a 100644 --- a/test/tint/builtins/textureGather/f32/red.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/f32/red.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::x); + float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::x); return; } diff --git a/test/tint/builtins/textureGather/f32/red.wgsl.expected.spvasm b/test/tint/builtins/textureGather/f32/red.wgsl.expected.spvasm index 6baa49c22d..23c3071c72 100644 --- a/test/tint/builtins/textureGather/f32/red.wgsl.expected.spvasm +++ b/test/tint/builtins/textureGather/f32/red.wgsl.expected.spvasm @@ -29,7 +29,7 @@ %v2float = OpTypeVector %float 2 %19 = OpConstantNull %v2float %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %21 = OpConstantNull %int %_ptr_Function_v4float = OpTypePointer Function %v4float %24 = OpConstantNull %v4float %main = OpFunction %void None %8 @@ -38,7 +38,7 @@ %14 = OpLoad %7 %s %15 = OpLoad %3 %t %17 = OpSampledImage %16 %15 %14 - %12 = OpImageGather %v4float %17 %19 %int_0 + %12 = OpImageGather %v4float %17 %19 %21 OpStore %res %12 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/textureGather/f32/red.wgsl.expected.wgsl b/test/tint/builtins/textureGather/f32/red.wgsl.expected.wgsl index 05244292d2..cb29a4c646 100644 --- a/test/tint/builtins/textureGather/f32/red.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/f32/red.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(0, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/i32/alpha.wgsl b/test/tint/builtins/textureGather/i32/alpha.wgsl index 42133c99aa..88813ac8b7 100644 --- a/test/tint/builtins/textureGather/i32/alpha.wgsl +++ b/test/tint/builtins/textureGather/i32/alpha.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(3, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f3e0cbe4ee --- /dev/null +++ b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + int4 res = t.GatherAlpha(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f3e0cbe4ee --- /dev/null +++ b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + int4 res = t.GatherAlpha(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.glsl b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.glsl index 5215de2c25..771cf95eab 100644 --- a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp isampler2D t_s; void tint_symbol() { - ivec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 3); + ivec4 res = textureGather(t_s, vec2(0.0f), 3); } void main() { diff --git a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.hlsl b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.hlsl deleted file mode 100644 index 80023eb184..0000000000 --- a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - int4 res = t.GatherAlpha(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.msl b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.msl index 49861cfb9a..a52b2be425 100644 --- a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::w); + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::w); return; } diff --git a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.wgsl b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.wgsl index 35d727c4b4..60cd449f96 100644 --- a/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/i32/alpha.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(3, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/i32/blue.wgsl b/test/tint/builtins/textureGather/i32/blue.wgsl index 396dd5204a..43406d3edc 100644 --- a/test/tint/builtins/textureGather/i32/blue.wgsl +++ b/test/tint/builtins/textureGather/i32/blue.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(2, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4590910bc7 --- /dev/null +++ b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + int4 res = t.GatherBlue(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4590910bc7 --- /dev/null +++ b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + int4 res = t.GatherBlue(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.glsl b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.glsl index 1efabfab53..0c41727348 100644 --- a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp isampler2D t_s; void tint_symbol() { - ivec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 2); + ivec4 res = textureGather(t_s, vec2(0.0f), 2); } void main() { diff --git a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.hlsl b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.hlsl deleted file mode 100644 index 2292741bf0..0000000000 --- a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - int4 res = t.GatherBlue(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.msl b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.msl index f00ee18957..2401cf94ab 100644 --- a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::z); + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::z); return; } diff --git a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.wgsl b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.wgsl index 116439f117..1df66ddc13 100644 --- a/test/tint/builtins/textureGather/i32/blue.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/i32/blue.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(2, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/i32/green.wgsl b/test/tint/builtins/textureGather/i32/green.wgsl index ee162d149f..ed02d1f71f 100644 --- a/test/tint/builtins/textureGather/i32/green.wgsl +++ b/test/tint/builtins/textureGather/i32/green.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(1, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/i32/green.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/i32/green.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a642fc96df --- /dev/null +++ b/test/tint/builtins/textureGather/i32/green.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + int4 res = t.GatherGreen(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/i32/green.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/i32/green.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a642fc96df --- /dev/null +++ b/test/tint/builtins/textureGather/i32/green.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + int4 res = t.GatherGreen(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/i32/green.wgsl.expected.glsl b/test/tint/builtins/textureGather/i32/green.wgsl.expected.glsl index ea50a62167..be8e62f54f 100644 --- a/test/tint/builtins/textureGather/i32/green.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/i32/green.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp isampler2D t_s; void tint_symbol() { - ivec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 1); + ivec4 res = textureGather(t_s, vec2(0.0f), 1); } void main() { diff --git a/test/tint/builtins/textureGather/i32/green.wgsl.expected.hlsl b/test/tint/builtins/textureGather/i32/green.wgsl.expected.hlsl deleted file mode 100644 index e267c2e259..0000000000 --- a/test/tint/builtins/textureGather/i32/green.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - int4 res = t.GatherGreen(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/i32/green.wgsl.expected.msl b/test/tint/builtins/textureGather/i32/green.wgsl.expected.msl index 277e4e15d7..f039daf4bf 100644 --- a/test/tint/builtins/textureGather/i32/green.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/i32/green.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::y); + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); return; } diff --git a/test/tint/builtins/textureGather/i32/green.wgsl.expected.wgsl b/test/tint/builtins/textureGather/i32/green.wgsl.expected.wgsl index 6f7512284d..60c563c132 100644 --- a/test/tint/builtins/textureGather/i32/green.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/i32/green.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(1, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/i32/red.wgsl b/test/tint/builtins/textureGather/i32/red.wgsl index 60117f7d8b..3545c1ce75 100644 --- a/test/tint/builtins/textureGather/i32/red.wgsl +++ b/test/tint/builtins/textureGather/i32/red.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(0, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/i32/red.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/i32/red.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b1f0d11ff7 --- /dev/null +++ b/test/tint/builtins/textureGather/i32/red.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + int4 res = t.GatherRed(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/i32/red.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/i32/red.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1f0d11ff7 --- /dev/null +++ b/test/tint/builtins/textureGather/i32/red.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + int4 res = t.GatherRed(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/i32/red.wgsl.expected.glsl b/test/tint/builtins/textureGather/i32/red.wgsl.expected.glsl index 3013d47994..e386231f03 100644 --- a/test/tint/builtins/textureGather/i32/red.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/i32/red.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp isampler2D t_s; void tint_symbol() { - ivec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 0); + ivec4 res = textureGather(t_s, vec2(0.0f), 0); } void main() { diff --git a/test/tint/builtins/textureGather/i32/red.wgsl.expected.hlsl b/test/tint/builtins/textureGather/i32/red.wgsl.expected.hlsl deleted file mode 100644 index f34d0d1bc6..0000000000 --- a/test/tint/builtins/textureGather/i32/red.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - int4 res = t.GatherRed(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/i32/red.wgsl.expected.msl b/test/tint/builtins/textureGather/i32/red.wgsl.expected.msl index 1fe688c49a..da82fc4029 100644 --- a/test/tint/builtins/textureGather/i32/red.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/i32/red.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::x); + int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::x); return; } diff --git a/test/tint/builtins/textureGather/i32/red.wgsl.expected.spvasm b/test/tint/builtins/textureGather/i32/red.wgsl.expected.spvasm index 2a619fa1a5..712859a3b0 100644 --- a/test/tint/builtins/textureGather/i32/red.wgsl.expected.spvasm +++ b/test/tint/builtins/textureGather/i32/red.wgsl.expected.spvasm @@ -29,7 +29,7 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %20 = OpConstantNull %v2float - %int_0 = OpConstant %int 0 + %21 = OpConstantNull %int %_ptr_Function_v4int = OpTypePointer Function %v4int %24 = OpConstantNull %v4int %main = OpFunction %void None %8 @@ -38,7 +38,7 @@ %14 = OpLoad %7 %s %15 = OpLoad %3 %t %17 = OpSampledImage %16 %15 %14 - %12 = OpImageGather %v4int %17 %20 %int_0 + %12 = OpImageGather %v4int %17 %20 %21 OpStore %res %12 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/textureGather/i32/red.wgsl.expected.wgsl b/test/tint/builtins/textureGather/i32/red.wgsl.expected.wgsl index c2552b0717..3793b29291 100644 --- a/test/tint/builtins/textureGather/i32/red.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/i32/red.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(0, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/u32/alpha.wgsl b/test/tint/builtins/textureGather/u32/alpha.wgsl index adcc5fd950..51f05de251 100644 --- a/test/tint/builtins/textureGather/u32/alpha.wgsl +++ b/test/tint/builtins/textureGather/u32/alpha.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(3, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abad934a81 --- /dev/null +++ b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + uint4 res = t.GatherAlpha(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..abad934a81 --- /dev/null +++ b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + uint4 res = t.GatherAlpha(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.glsl b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.glsl index 087d1a2988..8b8cc4e995 100644 --- a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp usampler2D t_s; void tint_symbol() { - uvec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 3); + uvec4 res = textureGather(t_s, vec2(0.0f), 3); } void main() { diff --git a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.hlsl b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.hlsl deleted file mode 100644 index 78147c90d2..0000000000 --- a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - uint4 res = t.GatherAlpha(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.msl b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.msl index fc990a5f57..5afd9afed4 100644 --- a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::w); + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::w); return; } diff --git a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.wgsl b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.wgsl index 496586d125..966ca54015 100644 --- a/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/u32/alpha.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(3, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/u32/blue.wgsl b/test/tint/builtins/textureGather/u32/blue.wgsl index 30e266c9e8..06727a6002 100644 --- a/test/tint/builtins/textureGather/u32/blue.wgsl +++ b/test/tint/builtins/textureGather/u32/blue.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(2, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54ed2add9c --- /dev/null +++ b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + uint4 res = t.GatherBlue(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54ed2add9c --- /dev/null +++ b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + uint4 res = t.GatherBlue(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.glsl b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.glsl index 3329a19829..9faa6f1ee9 100644 --- a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp usampler2D t_s; void tint_symbol() { - uvec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 2); + uvec4 res = textureGather(t_s, vec2(0.0f), 2); } void main() { diff --git a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.hlsl b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.hlsl deleted file mode 100644 index 6f3f6d31f2..0000000000 --- a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - uint4 res = t.GatherBlue(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.msl b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.msl index 55a95fc36d..b445375f93 100644 --- a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::z); + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::z); return; } diff --git a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.wgsl b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.wgsl index eb2c3e1300..41aab9e528 100644 --- a/test/tint/builtins/textureGather/u32/blue.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/u32/blue.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(2, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/u32/green.wgsl b/test/tint/builtins/textureGather/u32/green.wgsl index 5b9ae18526..9012bad64e 100644 --- a/test/tint/builtins/textureGather/u32/green.wgsl +++ b/test/tint/builtins/textureGather/u32/green.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(1, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/u32/green.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/u32/green.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95d7018c6d --- /dev/null +++ b/test/tint/builtins/textureGather/u32/green.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + uint4 res = t.GatherGreen(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/u32/green.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/u32/green.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95d7018c6d --- /dev/null +++ b/test/tint/builtins/textureGather/u32/green.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + uint4 res = t.GatherGreen(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/u32/green.wgsl.expected.glsl b/test/tint/builtins/textureGather/u32/green.wgsl.expected.glsl index 832b1d2b48..ce868e2711 100644 --- a/test/tint/builtins/textureGather/u32/green.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/u32/green.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp usampler2D t_s; void tint_symbol() { - uvec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 1); + uvec4 res = textureGather(t_s, vec2(0.0f), 1); } void main() { diff --git a/test/tint/builtins/textureGather/u32/green.wgsl.expected.hlsl b/test/tint/builtins/textureGather/u32/green.wgsl.expected.hlsl deleted file mode 100644 index 9ec62e8ae6..0000000000 --- a/test/tint/builtins/textureGather/u32/green.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - uint4 res = t.GatherGreen(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/u32/green.wgsl.expected.msl b/test/tint/builtins/textureGather/u32/green.wgsl.expected.msl index 41be791153..1e36e58a77 100644 --- a/test/tint/builtins/textureGather/u32/green.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/u32/green.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::y); + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::y); return; } diff --git a/test/tint/builtins/textureGather/u32/green.wgsl.expected.wgsl b/test/tint/builtins/textureGather/u32/green.wgsl.expected.wgsl index 935c1e255f..2c60e956a8 100644 --- a/test/tint/builtins/textureGather/u32/green.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/u32/green.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(1, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/u32/red.wgsl b/test/tint/builtins/textureGather/u32/red.wgsl index 70ec158f37..70a9c65092 100644 --- a/test/tint/builtins/textureGather/u32/red.wgsl +++ b/test/tint/builtins/textureGather/u32/red.wgsl @@ -1,7 +1,7 @@ @group(1) @binding(0) var t : texture_2d; @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(0, t, s, vec2()); } diff --git a/test/tint/builtins/textureGather/u32/red.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureGather/u32/red.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ba8405fa44 --- /dev/null +++ b/test/tint/builtins/textureGather/u32/red.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + uint4 res = t.GatherRed(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/u32/red.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureGather/u32/red.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ba8405fa44 --- /dev/null +++ b/test/tint/builtins/textureGather/u32/red.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +Texture2D t : register(t0, space1); +SamplerState s : register(s1, space1); + +void main() { + uint4 res = t.GatherRed(s, (0.0f).xx); + return; +} diff --git a/test/tint/builtins/textureGather/u32/red.wgsl.expected.glsl b/test/tint/builtins/textureGather/u32/red.wgsl.expected.glsl index df0ef7bfb5..85550c6006 100644 --- a/test/tint/builtins/textureGather/u32/red.wgsl.expected.glsl +++ b/test/tint/builtins/textureGather/u32/red.wgsl.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; uniform highp usampler2D t_s; void tint_symbol() { - uvec4 res = textureGather(t_s, vec2(0.0f, 0.0f), 0); + uvec4 res = textureGather(t_s, vec2(0.0f), 0); } void main() { diff --git a/test/tint/builtins/textureGather/u32/red.wgsl.expected.hlsl b/test/tint/builtins/textureGather/u32/red.wgsl.expected.hlsl deleted file mode 100644 index a9597459c8..0000000000 --- a/test/tint/builtins/textureGather/u32/red.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -Texture2D t : register(t0, space1); -SamplerState s : register(s1, space1); - -void main() { - uint4 res = t.GatherRed(s, float2(0.0f, 0.0f)); - return; -} diff --git a/test/tint/builtins/textureGather/u32/red.wgsl.expected.msl b/test/tint/builtins/textureGather/u32/red.wgsl.expected.msl index b16b3679da..d71627df31 100644 --- a/test/tint/builtins/textureGather/u32/red.wgsl.expected.msl +++ b/test/tint/builtins/textureGather/u32/red.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; fragment void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], sampler tint_symbol_2 [[sampler(0)]]) { - uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::x); + uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), int2(0), component::x); return; } diff --git a/test/tint/builtins/textureGather/u32/red.wgsl.expected.spvasm b/test/tint/builtins/textureGather/u32/red.wgsl.expected.spvasm index 8c52b9ce3a..63693d6b2b 100644 --- a/test/tint/builtins/textureGather/u32/red.wgsl.expected.spvasm +++ b/test/tint/builtins/textureGather/u32/red.wgsl.expected.spvasm @@ -30,7 +30,7 @@ %v2float = OpTypeVector %float 2 %20 = OpConstantNull %v2float %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %22 = OpConstantNull %int %_ptr_Function_v4uint = OpTypePointer Function %v4uint %25 = OpConstantNull %v4uint %main = OpFunction %void None %8 @@ -39,7 +39,7 @@ %14 = OpLoad %7 %s %15 = OpLoad %3 %t %17 = OpSampledImage %16 %15 %14 - %12 = OpImageGather %v4uint %17 %20 %int_0 + %12 = OpImageGather %v4uint %17 %20 %22 OpStore %res %12 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/textureGather/u32/red.wgsl.expected.wgsl b/test/tint/builtins/textureGather/u32/red.wgsl.expected.wgsl index 528958dc87..a5c334cea1 100644 --- a/test/tint/builtins/textureGather/u32/red.wgsl.expected.wgsl +++ b/test/tint/builtins/textureGather/u32/red.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(1) @binding(1) var s : sampler; -@stage(fragment) +@fragment fn main() { var res : vec4 = textureGather(0, t, s, vec2()); } diff --git a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.dxc.hlsl b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..79113c0419 --- /dev/null +++ b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.dxc.hlsl @@ -0,0 +1,61 @@ +Texture2DMS arg_0 : register(t0, space1); +static float4 tint_symbol_1 = (0.0f).xxxx; + +void textureLoad_6273b1() { + float res = 0.0f; + const float4 x_17 = float4(arg_0.Load(int3(0, 0, 0), 1).x, 0.0f, 0.0f, 0.0f); + res = x_17.x; + return; +} + +void tint_symbol_2(float4 tint_symbol) { + tint_symbol_1 = tint_symbol; + return; +} + +void vertex_main_1() { + textureLoad_6273b1(); + tint_symbol_2((0.0f).xxxx); + return; +} + +struct vertex_main_out { + float4 tint_symbol_1_1; +}; +struct tint_symbol_3 { + float4 tint_symbol_1_1 : SV_Position; +}; + +vertex_main_out vertex_main_inner() { + vertex_main_1(); + const vertex_main_out tint_symbol_4 = {tint_symbol_1}; + return tint_symbol_4; +} + +tint_symbol_3 vertex_main() { + const vertex_main_out inner_result = vertex_main_inner(); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; + return wrapper_result; +} + +void fragment_main_1() { + textureLoad_6273b1(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + textureLoad_6273b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.fxc.hlsl b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..79113c0419 --- /dev/null +++ b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.fxc.hlsl @@ -0,0 +1,61 @@ +Texture2DMS arg_0 : register(t0, space1); +static float4 tint_symbol_1 = (0.0f).xxxx; + +void textureLoad_6273b1() { + float res = 0.0f; + const float4 x_17 = float4(arg_0.Load(int3(0, 0, 0), 1).x, 0.0f, 0.0f, 0.0f); + res = x_17.x; + return; +} + +void tint_symbol_2(float4 tint_symbol) { + tint_symbol_1 = tint_symbol; + return; +} + +void vertex_main_1() { + textureLoad_6273b1(); + tint_symbol_2((0.0f).xxxx); + return; +} + +struct vertex_main_out { + float4 tint_symbol_1_1; +}; +struct tint_symbol_3 { + float4 tint_symbol_1_1 : SV_Position; +}; + +vertex_main_out vertex_main_inner() { + vertex_main_1(); + const vertex_main_out tint_symbol_4 = {tint_symbol_1}; + return tint_symbol_4; +} + +tint_symbol_3 vertex_main() { + const vertex_main_out inner_result = vertex_main_inner(); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; + return wrapper_result; +} + +void fragment_main_1() { + textureLoad_6273b1(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + textureLoad_6273b1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.glsl b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.glsl index 9d64f20307..f02ac1f9e9 100644 --- a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.glsl +++ b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.glsl @@ -1,10 +1,10 @@ #version 310 es -vec4 tint_symbol_1 = vec4(0.0f, 0.0f, 0.0f, 0.0f); +vec4 tint_symbol_1 = vec4(0.0f); uniform highp sampler2DMS arg_0_1; void textureLoad_6273b1() { float res = 0.0f; - vec4 x_17 = vec4(texelFetch(arg_0_1, ivec2(0, 0), 1).x, 0.0f, 0.0f, 0.0f); + vec4 x_17 = vec4(texelFetch(arg_0_1, ivec2(0), 1).x, 0.0f, 0.0f, 0.0f); res = x_17.x; return; } @@ -16,7 +16,7 @@ void tint_symbol_2(vec4 tint_symbol) { void vertex_main_1() { textureLoad_6273b1(); - tint_symbol_2(vec4(0.0f, 0.0f, 0.0f, 0.0f)); + tint_symbol_2(vec4(0.0f)); return; } @@ -44,7 +44,7 @@ precision mediump float; uniform highp sampler2DMS arg_0_1; void textureLoad_6273b1() { float res = 0.0f; - vec4 x_17 = vec4(texelFetch(arg_0_1, ivec2(0, 0), 1).x, 0.0f, 0.0f, 0.0f); + vec4 x_17 = vec4(texelFetch(arg_0_1, ivec2(0), 1).x, 0.0f, 0.0f, 0.0f); res = x_17.x; return; } @@ -71,7 +71,7 @@ void main() { uniform highp sampler2DMS arg_0_1; void textureLoad_6273b1() { float res = 0.0f; - vec4 x_17 = vec4(texelFetch(arg_0_1, ivec2(0, 0), 1).x, 0.0f, 0.0f, 0.0f); + vec4 x_17 = vec4(texelFetch(arg_0_1, ivec2(0), 1).x, 0.0f, 0.0f, 0.0f); res = x_17.x; return; } diff --git a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.hlsl b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.hlsl deleted file mode 100644 index 41cb191251..0000000000 --- a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.hlsl +++ /dev/null @@ -1,61 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); -static float4 tint_symbol_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void textureLoad_6273b1() { - float res = 0.0f; - const float4 x_17 = float4(arg_0.Load(int3(0, 0, 0), 1).x, 0.0f, 0.0f, 0.0f); - res = x_17.x; - return; -} - -void tint_symbol_2(float4 tint_symbol) { - tint_symbol_1 = tint_symbol; - return; -} - -void vertex_main_1() { - textureLoad_6273b1(); - tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f)); - return; -} - -struct vertex_main_out { - float4 tint_symbol_1_1; -}; -struct tint_symbol_3 { - float4 tint_symbol_1_1 : SV_Position; -}; - -vertex_main_out vertex_main_inner() { - vertex_main_1(); - const vertex_main_out tint_symbol_4 = {tint_symbol_1}; - return tint_symbol_4; -} - -tint_symbol_3 vertex_main() { - const vertex_main_out inner_result = vertex_main_inner(); - tint_symbol_3 wrapper_result = (tint_symbol_3)0; - wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; - return wrapper_result; -} - -void fragment_main_1() { - textureLoad_6273b1(); - return; -} - -void fragment_main() { - fragment_main_1(); - return; -} - -void compute_main_1() { - textureLoad_6273b1(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - compute_main_1(); - return; -} diff --git a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.msl b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.msl index 072549da16..4fdc4b60b9 100644 --- a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.msl +++ b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.msl @@ -3,7 +3,7 @@ using namespace metal; void textureLoad_6273b1(depth2d_ms tint_symbol_5) { float res = 0.0f; - float4 const x_17 = float4(tint_symbol_5.read(uint2(int2()), 1), 0.0f, 0.0f, 0.0f); + float4 const x_17 = float4(tint_symbol_5.read(uint2(int2(0)), 1), 0.0f, 0.0f, 0.0f); res = x_17[0]; return; } @@ -15,7 +15,7 @@ void tint_symbol_2(float4 tint_symbol, thread float4* const tint_symbol_6) { void vertex_main_1(depth2d_ms tint_symbol_7, thread float4* const tint_symbol_8) { textureLoad_6273b1(tint_symbol_7); - tint_symbol_2(float4(), tint_symbol_8); + tint_symbol_2(float4(0.0f), tint_symbol_8); return; } @@ -34,7 +34,7 @@ vertex_main_out vertex_main_inner(depth2d_ms tint_symbol_9, } vertex tint_symbol_3 vertex_main(depth2d_ms tint_symbol_11 [[texture(0)]]) { - thread float4 tint_symbol_12 = float4(); + thread float4 tint_symbol_12 = float4(0.0f); vertex_main_out const inner_result = vertex_main_inner(tint_symbol_11, &(tint_symbol_12)); tint_symbol_3 wrapper_result = {}; wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; diff --git a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.spvasm b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.spvasm index ffa937e53b..b6a920161d 100644 --- a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.spvasm +++ b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 62 +; Bound: 61 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -47,72 +47,71 @@ %tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %5 %void = OpTypeVoid %14 = OpTypeFunction %void - %float_0 = OpConstant %float 0 %_ptr_Function_float = OpTypePointer Function %float %int = OpTypeInt 32 1 %v2int = OpTypeVector %int 2 - %26 = OpConstantNull %v2int + %25 = OpConstantNull %v2int %int_1 = OpConstant %int 1 - %30 = OpTypeFunction %void %v4float + %29 = OpTypeFunction %void %v4float %vertex_main_out = OpTypeStruct %v4float - %38 = OpTypeFunction %vertex_main_out + %37 = OpTypeFunction %vertex_main_out %float_1 = OpConstant %float 1 %textureLoad_6273b1 = OpFunction %void None %14 %17 = OpLabel %res = OpVariable %_ptr_Function_float Function %8 - OpStore %res %float_0 - %23 = OpLoad %11 %arg_0 - %22 = OpImageFetch %v4float %23 %26 Sample %int_1 - %21 = OpCompositeExtract %float %22 0 - %28 = OpCompositeConstruct %v4float %21 %float_0 %float_0 %float_0 - %29 = OpCompositeExtract %float %28 0 - OpStore %res %29 + OpStore %res %8 + %22 = OpLoad %11 %arg_0 + %21 = OpImageFetch %v4float %22 %25 Sample %int_1 + %20 = OpCompositeExtract %float %21 0 + %27 = OpCompositeConstruct %v4float %20 %8 %8 %8 + %28 = OpCompositeExtract %float %27 0 + OpStore %res %28 OpReturn OpFunctionEnd -%tint_symbol_2 = OpFunction %void None %30 +%tint_symbol_2 = OpFunction %void None %29 %tint_symbol = OpFunctionParameter %v4float - %33 = OpLabel + %32 = OpLabel OpStore %tint_symbol_1 %tint_symbol OpReturn OpFunctionEnd %vertex_main_1 = OpFunction %void None %14 - %35 = OpLabel - %36 = OpFunctionCall %void %textureLoad_6273b1 - %37 = OpFunctionCall %void %tint_symbol_2 %5 + %34 = OpLabel + %35 = OpFunctionCall %void %textureLoad_6273b1 + %36 = OpFunctionCall %void %tint_symbol_2 %5 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %vertex_main_out None %38 - %41 = OpLabel - %42 = OpFunctionCall %void %vertex_main_1 - %43 = OpLoad %v4float %tint_symbol_1 - %44 = OpCompositeConstruct %vertex_main_out %43 - OpReturnValue %44 +%vertex_main_inner = OpFunction %vertex_main_out None %37 + %40 = OpLabel + %41 = OpFunctionCall %void %vertex_main_1 + %42 = OpLoad %v4float %tint_symbol_1 + %43 = OpCompositeConstruct %vertex_main_out %42 + OpReturnValue %43 OpFunctionEnd %vertex_main = OpFunction %void None %14 - %46 = OpLabel - %47 = OpFunctionCall %vertex_main_out %vertex_main_inner - %48 = OpCompositeExtract %v4float %47 0 - OpStore %tint_symbol_1_1_1 %48 + %45 = OpLabel + %46 = OpFunctionCall %vertex_main_out %vertex_main_inner + %47 = OpCompositeExtract %v4float %46 0 + OpStore %tint_symbol_1_1_1 %47 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main_1 = OpFunction %void None %14 - %51 = OpLabel - %52 = OpFunctionCall %void %textureLoad_6273b1 + %50 = OpLabel + %51 = OpFunctionCall %void %textureLoad_6273b1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %14 - %54 = OpLabel - %55 = OpFunctionCall %void %fragment_main_1 + %53 = OpLabel + %54 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd %compute_main_1 = OpFunction %void None %14 - %57 = OpLabel - %58 = OpFunctionCall %void %textureLoad_6273b1 + %56 = OpLabel + %57 = OpFunctionCall %void %textureLoad_6273b1 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %14 - %60 = OpLabel - %61 = OpFunctionCall %void %compute_main_1 + %59 = OpLabel + %60 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.wgsl b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.wgsl index 8f6220811b..ca431c7d06 100644 --- a/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.wgsl +++ b/test/tint/builtins/textureLoad/depth_ms.spvasm.expected.wgsl @@ -3,8 +3,8 @@ var tint_symbol_1 : vec4 = vec4(); fn textureLoad_6273b1() { - var res : f32 = 0.0; - let x_17 : vec4 = vec4(textureLoad(arg_0, vec2(), 1i), 0.0, 0.0, 0.0); + var res : f32 = 0.0f; + let x_17 : vec4 = vec4(textureLoad(arg_0, vec2(), 1i), 0.0f, 0.0f, 0.0f); res = x_17.x; return; } @@ -25,7 +25,7 @@ struct vertex_main_out { tint_symbol_1_1 : vec4, } -@stage(vertex) +@vertex fn vertex_main() -> vertex_main_out { vertex_main_1(); return vertex_main_out(tint_symbol_1); @@ -36,7 +36,7 @@ fn fragment_main_1() { return; } -@stage(fragment) +@fragment fn fragment_main() { fragment_main_1(); } @@ -46,7 +46,7 @@ fn compute_main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn compute_main() { compute_main_1(); } diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl index 4a8edf8f8e..b246fe2274 100644 --- a/test/tint/builtins/textureLoad/texture_external_param.wgsl +++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl @@ -8,18 +8,18 @@ fn doTextureLoad() { var res: vec4 = textureLoad2d(arg_0, vec2()); } -@stage(vertex) +@vertex fn vertex_main() -> @builtin(position) vec4 { doTextureLoad(); return vec4(); } -@stage(fragment) +@fragment fn fragment_main() { doTextureLoad(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn compute_main() { doTextureLoad(); } diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2f84d98a3 --- /dev/null +++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.dxc.hlsl @@ -0,0 +1,115 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, int2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.Load(int3(coord, 0)).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float4 textureLoad2d(Texture2D tint_symbol, Texture2D ext_tex_plane_1_1, ExternalTextureParams ext_tex_params_1, int2 coords) { + return textureLoadExternal(tint_symbol, ext_tex_plane_1_1, coords, ext_tex_params_1); +} + +float3x4 tint_symbol_4(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_6(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_10 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_10; +} + +float3x3 tint_symbol_8(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_2(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_11 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_4(buffer, (offset + 16u)), tint_symbol_6(buffer, (offset + 64u)), tint_symbol_6(buffer, (offset + 96u)), tint_symbol_8(buffer, (offset + 128u))}; + return tint_symbol_11; +} + +void doTextureLoad() { + float4 res = textureLoad2d(arg_0, ext_tex_plane_1, tint_symbol_2(ext_tex_params, 0u), (0).xx); +} + +struct tint_symbol_1 { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + doTextureLoad(); + return (0.0f).xxxx; +} + +tint_symbol_1 vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol_1 wrapper_result = (tint_symbol_1)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + doTextureLoad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + doTextureLoad(); + return; +} diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b2f84d98a3 --- /dev/null +++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.fxc.hlsl @@ -0,0 +1,115 @@ +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; +struct ExternalTextureParams { + uint numPlanes; + uint doYuvToRgbConversionOnly; + float3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + float3x3 gamutConversionMatrix; +}; + +Texture2D ext_tex_plane_1 : register(t1, space1); +cbuffer cbuffer_ext_tex_params : register(b2, space1) { + uint4 ext_tex_params[11]; +}; +Texture2D arg_0 : register(t0, space1); + +float3 gammaCorrection(float3 v, GammaTransferParams params) { + const bool3 cond = (abs(v) < float3((params.D).xxx)); + const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); + return (cond ? t : f); +} + +float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, int2 coord, ExternalTextureParams params) { + float3 color = float3(0.0f, 0.0f, 0.0f); + if ((params.numPlanes == 1u)) { + color = plane0.Load(int3(coord, 0)).rgb; + } else { + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); + } + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = mul(color, params.gamutConversionMatrix); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return float4(color, 1.0f); +} + +float4 textureLoad2d(Texture2D tint_symbol, Texture2D ext_tex_plane_1_1, ExternalTextureParams ext_tex_params_1, int2 coords) { + return textureLoadExternal(tint_symbol, ext_tex_plane_1_1, coords, ext_tex_params_1); +} + +float3x4 tint_symbol_4(uint4 buffer[11], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); +} + +GammaTransferParams tint_symbol_6(uint4 buffer[11], uint offset) { + const uint scalar_offset_3 = ((offset + 0u)) / 4; + const uint scalar_offset_4 = ((offset + 4u)) / 4; + const uint scalar_offset_5 = ((offset + 8u)) / 4; + const uint scalar_offset_6 = ((offset + 12u)) / 4; + const uint scalar_offset_7 = ((offset + 16u)) / 4; + const uint scalar_offset_8 = ((offset + 20u)) / 4; + const uint scalar_offset_9 = ((offset + 24u)) / 4; + const uint scalar_offset_10 = ((offset + 28u)) / 4; + const GammaTransferParams tint_symbol_10 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol_10; +} + +float3x3 tint_symbol_8(uint4 buffer[11], uint offset) { + const uint scalar_offset_11 = ((offset + 0u)) / 4; + const uint scalar_offset_12 = ((offset + 16u)) / 4; + const uint scalar_offset_13 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); +} + +ExternalTextureParams tint_symbol_2(uint4 buffer[11], uint offset) { + const uint scalar_offset_14 = ((offset + 0u)) / 4; + const uint scalar_offset_15 = ((offset + 4u)) / 4; + const ExternalTextureParams tint_symbol_11 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_4(buffer, (offset + 16u)), tint_symbol_6(buffer, (offset + 64u)), tint_symbol_6(buffer, (offset + 96u)), tint_symbol_8(buffer, (offset + 128u))}; + return tint_symbol_11; +} + +void doTextureLoad() { + float4 res = textureLoad2d(arg_0, ext_tex_plane_1, tint_symbol_2(ext_tex_params, 0u), (0).xx); +} + +struct tint_symbol_1 { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + doTextureLoad(); + return (0.0f).xxxx; +} + +tint_symbol_1 vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol_1 wrapper_result = (tint_symbol_1)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + doTextureLoad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + doTextureLoad(); + return; +} diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl index bed2c39151..0d233de701 100644 --- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl +++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl @@ -2,34 +2,55 @@ SKIP: FAILED #version 310 es +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + struct ExternalTextureParams { uint numPlanes; - float vr; - float ug; - float vg; - float ub; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; }; layout(binding = 2) uniform ExternalTextureParams_1 { uint numPlanes; - float vr; - float ug; - float vg; - float ub; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; } ext_tex_params; +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); if ((params.numPlanes == 1u)) { - return texelFetch(plane0_1, coord, 0); + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - float y = (texelFetch(plane0_1, coord, 0).r - 0.0625f); - vec2 uv = (texelFetch(plane1_1, coord, 0).rg - 0.5f); - float u = uv.x; - float v = uv.y; - float r = ((1.164000034f * y) + (params.vr * v)); - float g = (((1.164000034f * y) - (params.ug * u)) - (params.vg * v)); - float b = ((1.164000034f * y) + (params.ub * u)); - return vec4(r, g, b, 1.0f); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_1_1_1, ExternalTextureParams ext_tex_params_1, ivec2 coords) { @@ -39,12 +60,12 @@ vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_ uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_2; void doTextureLoad() { - vec4 res = textureLoad2d(arg_0_1, ext_tex_plane_1_2, ext_tex_params, ivec2(0, 0)); + vec4 res = textureLoad2d(arg_0_1, ext_tex_plane_1_2, ext_tex_params, ivec2(0)); } vec4 vertex_main() { doTextureLoad(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { @@ -56,9 +77,9 @@ void main() { return; } Error parsing GLSL shader: -ERROR: 0:40: 'textureLoad2d' : no matching overloaded function found -ERROR: 0:40: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' -ERROR: 0:40: '' : compilation terminated +ERROR: 0:61: 'textureLoad2d' : no matching overloaded function found +ERROR: 0:61: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:61: '' : compilation terminated ERROR: 3 compilation errors. No code generated. @@ -66,34 +87,55 @@ ERROR: 3 compilation errors. No code generated. #version 310 es precision mediump float; +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + struct ExternalTextureParams { uint numPlanes; - float vr; - float ug; - float vg; - float ub; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; }; layout(binding = 2) uniform ExternalTextureParams_1 { uint numPlanes; - float vr; - float ug; - float vg; - float ub; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; } ext_tex_params; +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); if ((params.numPlanes == 1u)) { - return texelFetch(plane0_1, coord, 0); + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - float y = (texelFetch(plane0_1, coord, 0).r - 0.0625f); - vec2 uv = (texelFetch(plane1_1, coord, 0).rg - 0.5f); - float u = uv.x; - float v = uv.y; - float r = ((1.164000034f * y) + (params.vr * v)); - float g = (((1.164000034f * y) - (params.ug * u)) - (params.vg * v)); - float b = ((1.164000034f * y) + (params.ub * u)); - return vec4(r, g, b, 1.0f); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_1_1_1, ExternalTextureParams ext_tex_params_1, ivec2 coords) { @@ -103,7 +145,7 @@ vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_ uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_2; void doTextureLoad() { - vec4 res = textureLoad2d(arg_0_1, ext_tex_plane_1_2, ext_tex_params, ivec2(0, 0)); + vec4 res = textureLoad2d(arg_0_1, ext_tex_plane_1_2, ext_tex_params, ivec2(0)); } void fragment_main() { @@ -115,43 +157,64 @@ void main() { return; } Error parsing GLSL shader: -ERROR: 0:41: 'textureLoad2d' : no matching overloaded function found -ERROR: 0:41: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' -ERROR: 0:41: '' : compilation terminated +ERROR: 0:62: 'textureLoad2d' : no matching overloaded function found +ERROR: 0:62: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float' +ERROR: 0:62: '' : compilation terminated ERROR: 3 compilation errors. No code generated. #version 310 es +struct GammaTransferParams { + float G; + float A; + float B; + float C; + float D; + float E; + float F; + uint padding; +}; + struct ExternalTextureParams { uint numPlanes; - float vr; - float ug; - float vg; - float ub; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; }; layout(binding = 2) uniform ExternalTextureParams_1 { uint numPlanes; - float vr; - float ug; - float vg; - float ub; + uint doYuvToRgbConversionOnly; + mat3x4 yuvToRgbConversionMatrix; + GammaTransferParams gammaDecodeParams; + GammaTransferParams gammaEncodeParams; + mat3 gamutConversionMatrix; } ext_tex_params; +vec3 gammaCorrection(vec3 v, GammaTransferParams params) { + bvec3 cond = lessThan(abs(v), vec3(params.D)); + vec3 t = (sign(v) * ((params.C * abs(v)) + params.F)); + vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E)); + return mix(f, t, cond); +} + vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { + vec3 color = vec3(0.0f, 0.0f, 0.0f); if ((params.numPlanes == 1u)) { - return texelFetch(plane0_1, coord, 0); + color = texelFetch(plane0_1, coord, 0).rgb; + } else { + color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); } - float y = (texelFetch(plane0_1, coord, 0).r - 0.0625f); - vec2 uv = (texelFetch(plane1_1, coord, 0).rg - 0.5f); - float u = uv.x; - float v = uv.y; - float r = ((1.164000034f * y) + (params.vr * v)); - float g = (((1.164000034f * y) - (params.ug * u)) - (params.vg * v)); - float b = ((1.164000034f * y) + (params.ub * u)); - return vec4(r, g, b, 1.0f); + if ((params.doYuvToRgbConversionOnly == 0u)) { + color = gammaCorrection(color, params.gammaDecodeParams); + color = (params.gamutConversionMatrix * color); + color = gammaCorrection(color, params.gammaEncodeParams); + } + return vec4(color, 1.0f); } vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_1_1_1, ExternalTextureParams ext_tex_params_1, ivec2 coords) { @@ -161,7 +224,7 @@ vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_ uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_2; void doTextureLoad() { - vec4 res = textureLoad2d(arg_0_1, ext_tex_plane_1_2, ext_tex_params, ivec2(0, 0)); + vec4 res = textureLoad2d(arg_0_1, ext_tex_plane_1_2, ext_tex_params, ivec2(0)); } void compute_main() { @@ -174,9 +237,9 @@ void main() { return; } Error parsing GLSL shader: -ERROR: 0:40: 'textureLoad2d' : no matching overloaded function found -ERROR: 0:40: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' -ERROR: 0:40: '' : compilation terminated +ERROR: 0:61: 'textureLoad2d' : no matching overloaded function found +ERROR: 0:61: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float' +ERROR: 0:61: '' : compilation terminated ERROR: 3 compilation errors. No code generated. diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.hlsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.hlsl deleted file mode 100644 index 2fb9dfebde..0000000000 --- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.hlsl +++ /dev/null @@ -1,111 +0,0 @@ -struct GammaTransferParams { - float G; - float A; - float B; - float C; - float D; - float E; - float F; - uint padding; -}; -struct ExternalTextureParams { - uint numPlanes; - float3x4 yuvToRgbConversionMatrix; - GammaTransferParams gammaDecodeParams; - GammaTransferParams gammaEncodeParams; - float3x3 gamutConversionMatrix; -}; - -Texture2D ext_tex_plane_1 : register(t1, space1); -cbuffer cbuffer_ext_tex_params : register(b2, space1) { - uint4 ext_tex_params[11]; -}; -Texture2D arg_0 : register(t0, space1); - -float3 gammaCorrection(float3 v, GammaTransferParams params) { - const bool3 cond = (abs(v) < float3((params.D).xxx)); - const float3 t = (sign(v) * ((params.C * abs(v)) + params.F)); - const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E)); - return (cond ? t : f); -} - -float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, int2 coord, ExternalTextureParams params) { - float3 color = float3(0.0f, 0.0f, 0.0f); - if ((params.numPlanes == 1u)) { - color = plane0.Load(int3(coord, 0)).rgb; - } else { - color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); - } - color = gammaCorrection(color, params.gammaDecodeParams); - color = mul(color, params.gamutConversionMatrix); - color = gammaCorrection(color, params.gammaEncodeParams); - return float4(color, 1.0f); -} - -float4 textureLoad2d(Texture2D tint_symbol, Texture2D ext_tex_plane_1_1, ExternalTextureParams ext_tex_params_1, int2 coords) { - return textureLoadExternal(tint_symbol, ext_tex_plane_1_1, coords, ext_tex_params_1); -} - -float3x4 tint_symbol_4(uint4 buffer[11], uint offset) { - const uint scalar_offset = ((offset + 0u)) / 4; - const uint scalar_offset_1 = ((offset + 16u)) / 4; - const uint scalar_offset_2 = ((offset + 32u)) / 4; - return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4])); -} - -GammaTransferParams tint_symbol_6(uint4 buffer[11], uint offset) { - const uint scalar_offset_3 = ((offset + 0u)) / 4; - const uint scalar_offset_4 = ((offset + 4u)) / 4; - const uint scalar_offset_5 = ((offset + 8u)) / 4; - const uint scalar_offset_6 = ((offset + 12u)) / 4; - const uint scalar_offset_7 = ((offset + 16u)) / 4; - const uint scalar_offset_8 = ((offset + 20u)) / 4; - const uint scalar_offset_9 = ((offset + 24u)) / 4; - const uint scalar_offset_10 = ((offset + 28u)) / 4; - const GammaTransferParams tint_symbol_10 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]}; - return tint_symbol_10; -} - -float3x3 tint_symbol_8(uint4 buffer[11], uint offset) { - const uint scalar_offset_11 = ((offset + 0u)) / 4; - const uint scalar_offset_12 = ((offset + 16u)) / 4; - const uint scalar_offset_13 = ((offset + 32u)) / 4; - return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz)); -} - -ExternalTextureParams tint_symbol_2(uint4 buffer[11], uint offset) { - const uint scalar_offset_14 = ((offset + 0u)) / 4; - const ExternalTextureParams tint_symbol_11 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], tint_symbol_4(buffer, (offset + 16u)), tint_symbol_6(buffer, (offset + 64u)), tint_symbol_6(buffer, (offset + 96u)), tint_symbol_8(buffer, (offset + 128u))}; - return tint_symbol_11; -} - -void doTextureLoad() { - float4 res = textureLoad2d(arg_0, ext_tex_plane_1, tint_symbol_2(ext_tex_params, 0u), int2(0, 0)); -} - -struct tint_symbol_1 { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - doTextureLoad(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol_1 vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol_1 wrapper_result = (tint_symbol_1)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - doTextureLoad(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - doTextureLoad(); - return; -} diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.msl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.msl index c1e9dd6cc1..2afc80124b 100644 --- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.msl +++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct GammaTransferParams { /* 0x0000 */ float G; /* 0x0004 */ float A; @@ -14,7 +27,8 @@ struct GammaTransferParams { struct ExternalTextureParams { /* 0x0000 */ uint numPlanes; - /* 0x0004 */ int8_t tint_pad[12]; + /* 0x0004 */ uint doYuvToRgbConversionOnly; + /* 0x0008 */ tint_array tint_pad; /* 0x0010 */ float3x4 yuvToRgbConversionMatrix; /* 0x0040 */ GammaTransferParams gammaDecodeParams; /* 0x0060 */ GammaTransferParams gammaEncodeParams; @@ -35,9 +49,11 @@ float4 textureLoadExternal(texture2d plane0, texture2d tint_symbol, texture2d tint_symbol_2, texture2d tint_symbol_3, const constant ExternalTextureParams* const tint_symbol_4) { - float4 res = textureLoad2d(tint_symbol_2, tint_symbol_3, *(tint_symbol_4), int2()); + float4 res = textureLoad2d(tint_symbol_2, tint_symbol_3, *(tint_symbol_4), int2(0)); } struct tint_symbol_1 { @@ -55,7 +71,7 @@ struct tint_symbol_1 { float4 vertex_main_inner(texture2d tint_symbol_5, texture2d tint_symbol_6, const constant ExternalTextureParams* const tint_symbol_7) { doTextureLoad(tint_symbol_5, tint_symbol_6, tint_symbol_7); - return float4(); + return float4(0.0f); } vertex tint_symbol_1 vertex_main(texture2d tint_symbol_8 [[texture(0)]], texture2d tint_symbol_9 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_10 [[buffer(2)]]) { diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.spvasm b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.spvasm index b7d51afc21..a894d4c376 100644 --- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.spvasm +++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 137 +; Bound: 142 ; Schema: 0 OpCapability Shader %27 = OpExtInstImport "GLSL.std.450" @@ -16,8 +16,9 @@ OpName %ext_tex_plane_1 "ext_tex_plane_1" OpName %ExternalTextureParams "ExternalTextureParams" OpMemberName %ExternalTextureParams 0 "numPlanes" - OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix" - OpMemberName %ExternalTextureParams 2 "gammaDecodeParams" + OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly" + OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix" + OpMemberName %ExternalTextureParams 3 "gammaDecodeParams" OpName %GammaTransferParams "GammaTransferParams" OpMemberName %GammaTransferParams 0 "G" OpMemberName %GammaTransferParams 1 "A" @@ -27,8 +28,8 @@ OpMemberName %GammaTransferParams 5 "E" OpMemberName %GammaTransferParams 6 "F" OpMemberName %GammaTransferParams 7 "padding" - OpMemberName %ExternalTextureParams 3 "gammaEncodeParams" - OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix" + OpMemberName %ExternalTextureParams 4 "gammaEncodeParams" + OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix" OpName %ext_tex_params "ext_tex_params" OpName %arg_0 "arg_0" OpName %gammaCorrection "gammaCorrection" @@ -57,10 +58,11 @@ OpDecorate %ext_tex_plane_1 Binding 1 OpDecorate %ExternalTextureParams Block OpMemberDecorate %ExternalTextureParams 0 Offset 0 - OpMemberDecorate %ExternalTextureParams 1 Offset 16 - OpMemberDecorate %ExternalTextureParams 1 ColMajor - OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16 - OpMemberDecorate %ExternalTextureParams 2 Offset 64 + OpMemberDecorate %ExternalTextureParams 1 Offset 4 + OpMemberDecorate %ExternalTextureParams 2 Offset 16 + OpMemberDecorate %ExternalTextureParams 2 ColMajor + OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 3 Offset 64 OpMemberDecorate %GammaTransferParams 0 Offset 0 OpMemberDecorate %GammaTransferParams 1 Offset 4 OpMemberDecorate %GammaTransferParams 2 Offset 8 @@ -69,10 +71,10 @@ OpMemberDecorate %GammaTransferParams 5 Offset 20 OpMemberDecorate %GammaTransferParams 6 Offset 24 OpMemberDecorate %GammaTransferParams 7 Offset 28 - OpMemberDecorate %ExternalTextureParams 3 Offset 96 - OpMemberDecorate %ExternalTextureParams 4 Offset 128 - OpMemberDecorate %ExternalTextureParams 4 ColMajor - OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16 + OpMemberDecorate %ExternalTextureParams 4 Offset 96 + OpMemberDecorate %ExternalTextureParams 5 Offset 128 + OpMemberDecorate %ExternalTextureParams 5 ColMajor + OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16 OpDecorate %ext_tex_params NonWritable OpDecorate %ext_tex_params DescriptorSet 1 OpDecorate %ext_tex_params Binding 2 @@ -94,7 +96,7 @@ %GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 -%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float +%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams %ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant @@ -107,15 +109,16 @@ %v2int = OpTypeVector %int 2 %61 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams %uint_1 = OpConstant %uint 1 - %int_0 = OpConstant %int 0 + %78 = OpConstantNull %int %v2float = OpTypeVector %float 2 %float_1 = OpConstant %float 1 - %105 = OpTypeFunction %v4float %11 %11 %ExternalTextureParams %v2int + %92 = OpConstantNull %uint + %110 = OpTypeFunction %v4float %11 %11 %ExternalTextureParams %v2int %void = OpTypeVoid - %113 = OpTypeFunction %void - %121 = OpConstantNull %v2int + %118 = OpTypeFunction %void + %126 = OpConstantNull %v2int %_ptr_Function_v4float = OpTypePointer Function %v4float - %124 = OpTypeFunction %v4float + %129 = OpTypeFunction %v4float %gammaCorrection = OpFunction %v3float None %21 %v = OpFunctionParameter %v3float %params = OpFunctionParameter %GammaTransferParams @@ -164,80 +167,87 @@ OpSelectionMerge %74 None OpBranchConditional %73 %75 %76 %75 = OpLabel - %77 = OpImageFetch %v4float %plane0 %coord Lod %int_0 + %77 = OpImageFetch %v4float %plane0 %coord Lod %78 %79 = OpVectorShuffle %v3float %77 %77 0 1 2 OpStore %color %79 OpBranch %74 %76 = OpLabel - %80 = OpImageFetch %v4float %plane0 %coord Lod %int_0 + %80 = OpImageFetch %v4float %plane0 %coord Lod %78 %81 = OpCompositeExtract %float %80 0 - %82 = OpImageFetch %v4float %plane1 %coord Lod %int_0 + %82 = OpImageFetch %v4float %plane1 %coord Lod %78 %84 = OpVectorShuffle %v2float %82 %82 0 1 %85 = OpCompositeExtract %float %84 0 %86 = OpCompositeExtract %float %84 1 %88 = OpCompositeConstruct %v4float %81 %85 %86 %float_1 - %89 = OpCompositeExtract %mat3v4float %params_0 1 + %89 = OpCompositeExtract %mat3v4float %params_0 2 %90 = OpVectorTimesMatrix %v3float %88 %89 OpStore %color %90 OpBranch %74 %74 = OpLabel - %92 = OpLoad %v3float %color - %93 = OpCompositeExtract %GammaTransferParams %params_0 2 - %91 = OpFunctionCall %v3float %gammaCorrection %92 %93 - OpStore %color %91 - %94 = OpCompositeExtract %mat3v3float %params_0 4 - %95 = OpLoad %v3float %color - %96 = OpMatrixTimesVector %v3float %94 %95 + %91 = OpCompositeExtract %uint %params_0 1 + %93 = OpIEqual %bool %91 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + %97 = OpLoad %v3float %color + %98 = OpCompositeExtract %GammaTransferParams %params_0 3 + %96 = OpFunctionCall %v3float %gammaCorrection %97 %98 OpStore %color %96 - %98 = OpLoad %v3float %color - %99 = OpCompositeExtract %GammaTransferParams %params_0 3 - %97 = OpFunctionCall %v3float %gammaCorrection %98 %99 - OpStore %color %97 + %99 = OpCompositeExtract %mat3v3float %params_0 5 %100 = OpLoad %v3float %color - %101 = OpCompositeExtract %float %100 0 - %102 = OpCompositeExtract %float %100 1 - %103 = OpCompositeExtract %float %100 2 - %104 = OpCompositeConstruct %v4float %101 %102 %103 %float_1 - OpReturnValue %104 + %101 = OpMatrixTimesVector %v3float %99 %100 + OpStore %color %101 + %103 = OpLoad %v3float %color + %104 = OpCompositeExtract %GammaTransferParams %params_0 4 + %102 = OpFunctionCall %v3float %gammaCorrection %103 %104 + OpStore %color %102 + OpBranch %94 + %94 = OpLabel + %105 = OpLoad %v3float %color + %106 = OpCompositeExtract %float %105 0 + %107 = OpCompositeExtract %float %105 1 + %108 = OpCompositeExtract %float %105 2 + %109 = OpCompositeConstruct %v4float %106 %107 %108 %float_1 + OpReturnValue %109 OpFunctionEnd -%textureLoad2d = OpFunction %v4float None %105 +%textureLoad2d = OpFunction %v4float None %110 %texture = OpFunctionParameter %11 %ext_tex_plane_1_1 = OpFunctionParameter %11 %ext_tex_params_1 = OpFunctionParameter %ExternalTextureParams %coords = OpFunctionParameter %v2int - %111 = OpLabel - %112 = OpFunctionCall %v4float %textureLoadExternal %texture %ext_tex_plane_1_1 %coords %ext_tex_params_1 - OpReturnValue %112 - OpFunctionEnd -%doTextureLoad = OpFunction %void None %113 %116 = OpLabel + %117 = OpFunctionCall %v4float %textureLoadExternal %texture %ext_tex_plane_1_1 %coords %ext_tex_params_1 + OpReturnValue %117 + OpFunctionEnd +%doTextureLoad = OpFunction %void None %118 + %121 = OpLabel %res = OpVariable %_ptr_Function_v4float Function %5 - %118 = OpLoad %11 %arg_0 - %119 = OpLoad %11 %ext_tex_plane_1 - %120 = OpLoad %ExternalTextureParams %ext_tex_params - %117 = OpFunctionCall %v4float %textureLoad2d %118 %119 %120 %121 - OpStore %res %117 + %123 = OpLoad %11 %arg_0 + %124 = OpLoad %11 %ext_tex_plane_1 + %125 = OpLoad %ExternalTextureParams %ext_tex_params + %122 = OpFunctionCall %v4float %textureLoad2d %123 %124 %125 %126 + OpStore %res %122 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %124 - %126 = OpLabel - %127 = OpFunctionCall %void %doTextureLoad +%vertex_main_inner = OpFunction %v4float None %129 + %131 = OpLabel + %132 = OpFunctionCall %void %doTextureLoad OpReturnValue %5 OpFunctionEnd -%vertex_main = OpFunction %void None %113 - %129 = OpLabel - %130 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %130 +%vertex_main = OpFunction %void None %118 + %134 = OpLabel + %135 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %135 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %113 - %132 = OpLabel - %133 = OpFunctionCall %void %doTextureLoad +%fragment_main = OpFunction %void None %118 + %137 = OpLabel + %138 = OpFunctionCall %void %doTextureLoad OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %113 - %135 = OpLabel - %136 = OpFunctionCall %void %doTextureLoad +%compute_main = OpFunction %void None %118 + %140 = OpLabel + %141 = OpFunctionCall %void %doTextureLoad OpReturn OpFunctionEnd diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.wgsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.wgsl index edba45dc64..cb2c13099e 100644 --- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.wgsl +++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.wgsl @@ -8,18 +8,18 @@ fn doTextureLoad() { var res : vec4 = textureLoad2d(arg_0, vec2()); } -@stage(vertex) +@vertex fn vertex_main() -> @builtin(position) vec4 { doTextureLoad(); return vec4(); } -@stage(fragment) +@fragment fn fragment_main() { doTextureLoad(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn compute_main() { doTextureLoad(); } diff --git a/test/tint/builtins/textureLoad/texture_param.wgsl b/test/tint/builtins/textureLoad/texture_param.wgsl index 81f359ea41..e51ece0198 100644 --- a/test/tint/builtins/textureLoad/texture_param.wgsl +++ b/test/tint/builtins/textureLoad/texture_param.wgsl @@ -8,18 +8,18 @@ fn doTextureLoad() { var res: vec4 = textureLoad2d(arg_0, vec2(), 0); } -@stage(vertex) +@vertex fn vertex_main() -> @builtin(position) vec4 { doTextureLoad(); return vec4(); } -@stage(fragment) +@fragment fn fragment_main() { doTextureLoad(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn compute_main() { doTextureLoad(); } diff --git a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e4f441ebd0 --- /dev/null +++ b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.dxc.hlsl @@ -0,0 +1,36 @@ +Texture2D arg_0 : register(t0, space1); + +int4 textureLoad2d(Texture2D tint_symbol, int2 coords, int level) { + return tint_symbol.Load(int3(coords, level)); +} + +void doTextureLoad() { + int4 res = textureLoad2d(arg_0, (0).xx, 0); +} + +struct tint_symbol_1 { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + doTextureLoad(); + return (0.0f).xxxx; +} + +tint_symbol_1 vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol_1 wrapper_result = (tint_symbol_1)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + doTextureLoad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + doTextureLoad(); + return; +} diff --git a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4f441ebd0 --- /dev/null +++ b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +Texture2D arg_0 : register(t0, space1); + +int4 textureLoad2d(Texture2D tint_symbol, int2 coords, int level) { + return tint_symbol.Load(int3(coords, level)); +} + +void doTextureLoad() { + int4 res = textureLoad2d(arg_0, (0).xx, 0); +} + +struct tint_symbol_1 { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + doTextureLoad(); + return (0.0f).xxxx; +} + +tint_symbol_1 vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol_1 wrapper_result = (tint_symbol_1)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + doTextureLoad(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + doTextureLoad(); + return; +} diff --git a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.glsl b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.glsl index ca55f5356f..61bffaac4c 100644 --- a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.glsl +++ b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.glsl @@ -6,12 +6,12 @@ ivec4 textureLoad2d(highp isampler2D tint_symbol_1, ivec2 coords, int level) { uniform highp isampler2D arg_0_1; void doTextureLoad() { - ivec4 res = textureLoad2d(arg_0_1, ivec2(0, 0), 0); + ivec4 res = textureLoad2d(arg_0_1, ivec2(0), 0); } vec4 vertex_main() { doTextureLoad(); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { @@ -31,7 +31,7 @@ ivec4 textureLoad2d(highp isampler2D tint_symbol_1, ivec2 coords, int level) { uniform highp isampler2D arg_0_1; void doTextureLoad() { - ivec4 res = textureLoad2d(arg_0_1, ivec2(0, 0), 0); + ivec4 res = textureLoad2d(arg_0_1, ivec2(0), 0); } void fragment_main() { @@ -50,7 +50,7 @@ ivec4 textureLoad2d(highp isampler2D tint_symbol_1, ivec2 coords, int level) { uniform highp isampler2D arg_0_1; void doTextureLoad() { - ivec4 res = textureLoad2d(arg_0_1, ivec2(0, 0), 0); + ivec4 res = textureLoad2d(arg_0_1, ivec2(0), 0); } void compute_main() { diff --git a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.hlsl b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.hlsl deleted file mode 100644 index 1544f5ec7c..0000000000 --- a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.hlsl +++ /dev/null @@ -1,36 +0,0 @@ -Texture2D arg_0 : register(t0, space1); - -int4 textureLoad2d(Texture2D tint_symbol, int2 coords, int level) { - return tint_symbol.Load(int3(coords, level)); -} - -void doTextureLoad() { - int4 res = textureLoad2d(arg_0, int2(0, 0), 0); -} - -struct tint_symbol_1 { - float4 value : SV_Position; -}; - -float4 vertex_main_inner() { - doTextureLoad(); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol_1 vertex_main() { - const float4 inner_result = vertex_main_inner(); - tint_symbol_1 wrapper_result = (tint_symbol_1)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -void fragment_main() { - doTextureLoad(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - doTextureLoad(); - return; -} diff --git a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.msl b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.msl index cee9f8ef51..eda6fa124d 100644 --- a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.msl +++ b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.msl @@ -6,7 +6,7 @@ int4 textureLoad2d(texture2d tint_symbol, int2 coords, int } void doTextureLoad(texture2d tint_symbol_2) { - int4 res = textureLoad2d(tint_symbol_2, int2(), 0); + int4 res = textureLoad2d(tint_symbol_2, int2(0), 0); } struct tint_symbol_1 { @@ -15,7 +15,7 @@ struct tint_symbol_1 { float4 vertex_main_inner(texture2d tint_symbol_3) { doTextureLoad(tint_symbol_3); - return float4(); + return float4(0.0f); } vertex tint_symbol_1 vertex_main(texture2d tint_symbol_4 [[texture(0)]]) { diff --git a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.spvasm b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.spvasm index b292e121d8..4345ed19fe 100644 --- a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.spvasm +++ b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.spvasm @@ -45,7 +45,7 @@ %void = OpTypeVoid %22 = OpTypeFunction %void %28 = OpConstantNull %v2int - %int_0 = OpConstant %int 0 + %29 = OpConstantNull %int %_ptr_Function_v4int = OpTypePointer Function %v4int %32 = OpConstantNull %v4int %33 = OpTypeFunction %v4float @@ -62,7 +62,7 @@ %25 = OpLabel %res = OpVariable %_ptr_Function_v4int Function %32 %27 = OpLoad %11 %arg_0 - %26 = OpFunctionCall %v4int %textureLoad2d %27 %28 %int_0 + %26 = OpFunctionCall %v4int %textureLoad2d %27 %28 %29 OpStore %res %26 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.wgsl b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.wgsl index 13f6d82c09..02138475f2 100644 --- a/test/tint/builtins/textureLoad/texture_param.wgsl.expected.wgsl +++ b/test/tint/builtins/textureLoad/texture_param.wgsl.expected.wgsl @@ -8,18 +8,18 @@ fn doTextureLoad() { var res : vec4 = textureLoad2d(arg_0, vec2(), 0); } -@stage(vertex) +@vertex fn vertex_main() -> @builtin(position) vec4 { doTextureLoad(); return vec4(); } -@stage(fragment) +@fragment fn fragment_main() { doTextureLoad(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn compute_main() { doTextureLoad(); } diff --git a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.dxc.hlsl b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..2fd5b5e493 --- /dev/null +++ b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.dxc.hlsl @@ -0,0 +1,63 @@ +Texture2DMS arg_0 : register(t0, space1); +static float4 tint_symbol_1 = (0.0f).xxxx; + +void textureNumSamples_a3c8a0() { + int res = 0; + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + const int x_16 = tint_tmp.z; + res = x_16; + return; +} + +void tint_symbol_2(float4 tint_symbol) { + tint_symbol_1 = tint_symbol; + return; +} + +void vertex_main_1() { + textureNumSamples_a3c8a0(); + tint_symbol_2((0.0f).xxxx); + return; +} + +struct vertex_main_out { + float4 tint_symbol_1_1; +}; +struct tint_symbol_3 { + float4 tint_symbol_1_1 : SV_Position; +}; + +vertex_main_out vertex_main_inner() { + vertex_main_1(); + const vertex_main_out tint_symbol_4 = {tint_symbol_1}; + return tint_symbol_4; +} + +tint_symbol_3 vertex_main() { + const vertex_main_out inner_result = vertex_main_inner(); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; + return wrapper_result; +} + +void fragment_main_1() { + textureNumSamples_a3c8a0(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + textureNumSamples_a3c8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.fxc.hlsl b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..2fd5b5e493 --- /dev/null +++ b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.fxc.hlsl @@ -0,0 +1,63 @@ +Texture2DMS arg_0 : register(t0, space1); +static float4 tint_symbol_1 = (0.0f).xxxx; + +void textureNumSamples_a3c8a0() { + int res = 0; + int3 tint_tmp; + arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); + const int x_16 = tint_tmp.z; + res = x_16; + return; +} + +void tint_symbol_2(float4 tint_symbol) { + tint_symbol_1 = tint_symbol; + return; +} + +void vertex_main_1() { + textureNumSamples_a3c8a0(); + tint_symbol_2((0.0f).xxxx); + return; +} + +struct vertex_main_out { + float4 tint_symbol_1_1; +}; +struct tint_symbol_3 { + float4 tint_symbol_1_1 : SV_Position; +}; + +vertex_main_out vertex_main_inner() { + vertex_main_1(); + const vertex_main_out tint_symbol_4 = {tint_symbol_1}; + return tint_symbol_4; +} + +tint_symbol_3 vertex_main() { + const vertex_main_out inner_result = vertex_main_inner(); + tint_symbol_3 wrapper_result = (tint_symbol_3)0; + wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; + return wrapper_result; +} + +void fragment_main_1() { + textureNumSamples_a3c8a0(); + return; +} + +void fragment_main() { + fragment_main_1(); + return; +} + +void compute_main_1() { + textureNumSamples_a3c8a0(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + compute_main_1(); + return; +} diff --git a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.glsl b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.glsl index be5c091986..6a38e8ab1c 100644 --- a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.glsl +++ b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.glsl @@ -2,7 +2,7 @@ SKIP: FAILED #version 310 es -vec4 tint_symbol_1 = vec4(0.0f, 0.0f, 0.0f, 0.0f); +vec4 tint_symbol_1 = vec4(0.0f); uniform highp sampler2DMS arg_0_1; void textureNumSamples_a3c8a0() { int res = 0; @@ -18,7 +18,7 @@ void tint_symbol_2(vec4 tint_symbol) { void vertex_main_1() { textureNumSamples_a3c8a0(); - tint_symbol_2(vec4(0.0f, 0.0f, 0.0f, 0.0f)); + tint_symbol_2(vec4(0.0f)); return; } diff --git a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.hlsl b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.hlsl deleted file mode 100644 index 4d492d297e..0000000000 --- a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.hlsl +++ /dev/null @@ -1,63 +0,0 @@ -Texture2DMS arg_0 : register(t0, space1); -static float4 tint_symbol_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void textureNumSamples_a3c8a0() { - int res = 0; - int3 tint_tmp; - arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z); - const int x_16 = tint_tmp.z; - res = x_16; - return; -} - -void tint_symbol_2(float4 tint_symbol) { - tint_symbol_1 = tint_symbol; - return; -} - -void vertex_main_1() { - textureNumSamples_a3c8a0(); - tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f)); - return; -} - -struct vertex_main_out { - float4 tint_symbol_1_1; -}; -struct tint_symbol_3 { - float4 tint_symbol_1_1 : SV_Position; -}; - -vertex_main_out vertex_main_inner() { - vertex_main_1(); - const vertex_main_out tint_symbol_4 = {tint_symbol_1}; - return tint_symbol_4; -} - -tint_symbol_3 vertex_main() { - const vertex_main_out inner_result = vertex_main_inner(); - tint_symbol_3 wrapper_result = (tint_symbol_3)0; - wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; - return wrapper_result; -} - -void fragment_main_1() { - textureNumSamples_a3c8a0(); - return; -} - -void fragment_main() { - fragment_main_1(); - return; -} - -void compute_main_1() { - textureNumSamples_a3c8a0(); - return; -} - -[numthreads(1, 1, 1)] -void compute_main() { - compute_main_1(); - return; -} diff --git a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.msl b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.msl index 8a92713589..cd3bb3bdf5 100644 --- a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.msl +++ b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.msl @@ -15,7 +15,7 @@ void tint_symbol_2(float4 tint_symbol, thread float4* const tint_symbol_6) { void vertex_main_1(depth2d_ms tint_symbol_7, thread float4* const tint_symbol_8) { textureNumSamples_a3c8a0(tint_symbol_7); - tint_symbol_2(float4(), tint_symbol_8); + tint_symbol_2(float4(0.0f), tint_symbol_8); return; } @@ -34,7 +34,7 @@ vertex_main_out vertex_main_inner(depth2d_ms tint_symbol_9, } vertex tint_symbol_3 vertex_main(depth2d_ms tint_symbol_11 [[texture(0)]]) { - thread float4 tint_symbol_12 = float4(); + thread float4 tint_symbol_12 = float4(0.0f); vertex_main_out const inner_result = vertex_main_inner(tint_symbol_11, &(tint_symbol_12)); tint_symbol_3 wrapper_result = {}; wrapper_result.tint_symbol_1_1 = inner_result.tint_symbol_1_1; diff --git a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.spvasm b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.spvasm index 5844481871..9c7f8a5955 100644 --- a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.spvasm +++ b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 57 +; Bound: 56 ; Schema: 0 OpCapability Shader OpCapability ImageQuery @@ -49,66 +49,65 @@ %void = OpTypeVoid %14 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %19 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %22 = OpConstantNull %int - %25 = OpTypeFunction %void %v4float + %24 = OpTypeFunction %void %v4float %vertex_main_out = OpTypeStruct %v4float - %33 = OpTypeFunction %vertex_main_out + %32 = OpTypeFunction %vertex_main_out %float_1 = OpConstant %float 1 %textureNumSamples_a3c8a0 = OpFunction %void None %14 %17 = OpLabel - %res = OpVariable %_ptr_Function_int Function %22 - OpStore %res %int_0 - %24 = OpLoad %11 %arg_0 - %23 = OpImageQuerySamples %int %24 - OpStore %res %23 + %res = OpVariable %_ptr_Function_int Function %19 + OpStore %res %19 + %23 = OpLoad %11 %arg_0 + %22 = OpImageQuerySamples %int %23 + OpStore %res %22 OpReturn OpFunctionEnd -%tint_symbol_2 = OpFunction %void None %25 +%tint_symbol_2 = OpFunction %void None %24 %tint_symbol = OpFunctionParameter %v4float - %28 = OpLabel + %27 = OpLabel OpStore %tint_symbol_1 %tint_symbol OpReturn OpFunctionEnd %vertex_main_1 = OpFunction %void None %14 - %30 = OpLabel - %31 = OpFunctionCall %void %textureNumSamples_a3c8a0 - %32 = OpFunctionCall %void %tint_symbol_2 %5 + %29 = OpLabel + %30 = OpFunctionCall %void %textureNumSamples_a3c8a0 + %31 = OpFunctionCall %void %tint_symbol_2 %5 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %vertex_main_out None %33 - %36 = OpLabel - %37 = OpFunctionCall %void %vertex_main_1 - %38 = OpLoad %v4float %tint_symbol_1 - %39 = OpCompositeConstruct %vertex_main_out %38 - OpReturnValue %39 +%vertex_main_inner = OpFunction %vertex_main_out None %32 + %35 = OpLabel + %36 = OpFunctionCall %void %vertex_main_1 + %37 = OpLoad %v4float %tint_symbol_1 + %38 = OpCompositeConstruct %vertex_main_out %37 + OpReturnValue %38 OpFunctionEnd %vertex_main = OpFunction %void None %14 - %41 = OpLabel - %42 = OpFunctionCall %vertex_main_out %vertex_main_inner - %43 = OpCompositeExtract %v4float %42 0 - OpStore %tint_symbol_1_1_1 %43 + %40 = OpLabel + %41 = OpFunctionCall %vertex_main_out %vertex_main_inner + %42 = OpCompositeExtract %v4float %41 0 + OpStore %tint_symbol_1_1_1 %42 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main_1 = OpFunction %void None %14 - %46 = OpLabel - %47 = OpFunctionCall %void %textureNumSamples_a3c8a0 + %45 = OpLabel + %46 = OpFunctionCall %void %textureNumSamples_a3c8a0 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %14 - %49 = OpLabel - %50 = OpFunctionCall %void %fragment_main_1 + %48 = OpLabel + %49 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd %compute_main_1 = OpFunction %void None %14 - %52 = OpLabel - %53 = OpFunctionCall %void %textureNumSamples_a3c8a0 + %51 = OpLabel + %52 = OpFunctionCall %void %textureNumSamples_a3c8a0 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %14 - %55 = OpLabel - %56 = OpFunctionCall %void %compute_main_1 + %54 = OpLabel + %55 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.wgsl b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.wgsl index 455889a908..b2c5a8de51 100644 --- a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.wgsl +++ b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.wgsl @@ -25,7 +25,7 @@ struct vertex_main_out { tint_symbol_1_1 : vec4, } -@stage(vertex) +@vertex fn vertex_main() -> vertex_main_out { vertex_main_1(); return vertex_main_out(tint_symbol_1); @@ -36,7 +36,7 @@ fn fragment_main_1() { return; } -@stage(fragment) +@fragment fn fragment_main() { fragment_main_1(); } @@ -46,7 +46,7 @@ fn compute_main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn compute_main() { compute_main_1(); } diff --git a/test/tint/const/global/global.wgsl b/test/tint/const/global/global.wgsl new file mode 100644 index 0000000000..12f56a808f --- /dev/null +++ b/test/tint/const/global/global.wgsl @@ -0,0 +1,27 @@ +type MyArray = array; + +// Global consts +const c1 = 1; +const c2 = 1u; +const c3 = 1.0; + +const c4 = vec3(1, 1, 1); +const c5 = vec3(1u, 1u, 1u); +const c6 = vec3(1.0, 1.0, 1.0); + +const c7 = mat3x3(vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); + +const c9 = MyArray(); + +@fragment +fn main() -> @location(0) vec4 { + var v1 = c1; + var v2 = c2; + var v3 = c3; + var v4 = c4; + var v5 = c5; + var v6 = c6; + var v7 = c7; + var v9 = c9; + return vec4(0.0,0.0,0.0,0.0); +} diff --git a/test/tint/const/global/global.wgsl.expected.dxc.hlsl b/test/tint/const/global/global.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cc2c4c660b --- /dev/null +++ b/test/tint/const/global/global.wgsl.expected.dxc.hlsl @@ -0,0 +1,22 @@ +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + int v1 = 1; + uint v2 = 1u; + float v3 = 1.0f; + int3 v4 = (1).xxx; + uint3 v5 = (1u).xxx; + float3 v6 = (1.0f).xxx; + float3x3 v7 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); + float v9[10] = (float[10])0; + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/const/global/global.wgsl.expected.fxc.hlsl b/test/tint/const/global/global.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc2c4c660b --- /dev/null +++ b/test/tint/const/global/global.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + int v1 = 1; + uint v2 = 1u; + float v3 = 1.0f; + int3 v4 = (1).xxx; + uint3 v5 = (1u).xxx; + float3 v6 = (1.0f).xxx; + float3x3 v7 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx); + float v9[10] = (float[10])0; + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/const/global/global.wgsl.expected.glsl b/test/tint/const/global/global.wgsl.expected.glsl new file mode 100644 index 0000000000..54e642bbf8 --- /dev/null +++ b/test/tint/const/global/global.wgsl.expected.glsl @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 value; +vec4 tint_symbol() { + int v1 = 1; + uint v2 = 1u; + float v3 = 1.0f; + ivec3 v4 = ivec3(1); + uvec3 v5 = uvec3(1u); + vec3 v6 = vec3(1.0f); + mat3 v7 = mat3(vec3(1.0f), vec3(1.0f), vec3(1.0f)); + float v9[10] = float[10](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); +} + +void main() { + vec4 inner_result = tint_symbol(); + value = inner_result; + return; +} diff --git a/test/tint/const/global/global.wgsl.expected.msl b/test/tint/const/global/global.wgsl.expected.msl new file mode 100644 index 0000000000..1807542550 --- /dev/null +++ b/test/tint/const/global/global.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct tint_symbol_1 { + float4 value [[color(0)]]; +}; + +float4 tint_symbol_inner() { + int v1 = 1; + uint v2 = 1u; + float v3 = 1.0f; + int3 v4 = int3(1); + uint3 v5 = uint3(1u); + float3 v6 = float3(1.0f); + float3x3 v7 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f)); + tint_array v9 = tint_array{}; + return float4(0.0f); +} + +fragment tint_symbol_1 tint_symbol() { + float4 const inner_result = tint_symbol_inner(); + tint_symbol_1 wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + diff --git a/test/tint/const/global/global.wgsl.expected.spvasm b/test/tint/const/global/global.wgsl.expected.spvasm new file mode 100644 index 0000000000..d93b74dc90 --- /dev/null +++ b/test/tint/const/global/global.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %value + OpExecutionMode %main OriginUpperLeft + OpName %value "value" + OpName %main_inner "main_inner" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + OpName %v5 "v5" + OpName %v6 "v6" + OpName %v7 "v7" + OpName %v9 "v9" + OpName %main "main" + OpDecorate %value Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 + %6 = OpTypeFunction %v4float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %13 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float + %v3int = OpTypeVector %int 3 + %24 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %27 = OpConstantNull %v3int + %v3uint = OpTypeVector %uint 3 + %29 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %32 = OpConstantNull %v3uint + %v3float = OpTypeVector %float 3 + %34 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %37 = OpConstantNull %v3float +%mat3v3float = OpTypeMatrix %v3float 3 + %39 = OpConstantComposite %mat3v3float %34 %34 %34 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %42 = OpConstantNull %mat3v3float + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 + %45 = OpConstantNull %_arr_float_uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %void = OpTypeVoid + %48 = OpTypeFunction %void + %main_inner = OpFunction %v4float None %6 + %8 = OpLabel + %v1 = OpVariable %_ptr_Function_int Function %13 + %v2 = OpVariable %_ptr_Function_uint Function %18 + %v3 = OpVariable %_ptr_Function_float Function %22 + %v4 = OpVariable %_ptr_Function_v3int Function %27 + %v5 = OpVariable %_ptr_Function_v3uint Function %32 + %v6 = OpVariable %_ptr_Function_v3float Function %37 + %v7 = OpVariable %_ptr_Function_mat3v3float Function %42 + %v9 = OpVariable %_ptr_Function__arr_float_uint_10 Function %45 + OpStore %v1 %int_1 + OpStore %v2 %uint_1 + OpStore %v3 %float_1 + OpStore %v4 %24 + OpStore %v5 %29 + OpStore %v6 %34 + OpStore %v7 %39 + OpStore %v9 %45 + OpReturnValue %5 + OpFunctionEnd + %main = OpFunction %void None %48 + %51 = OpLabel + %52 = OpFunctionCall %v4float %main_inner + OpStore %value %52 + OpReturn + OpFunctionEnd diff --git a/test/tint/const/global/global.wgsl.expected.wgsl b/test/tint/const/global/global.wgsl.expected.wgsl new file mode 100644 index 0000000000..8fc010612f --- /dev/null +++ b/test/tint/const/global/global.wgsl.expected.wgsl @@ -0,0 +1,30 @@ +type MyArray = array; + +const c1 = 1; + +const c2 = 1u; + +const c3 = 1.0; + +const c4 = vec3(1, 1, 1); + +const c5 = vec3(1u, 1u, 1u); + +const c6 = vec3(1.0, 1.0, 1.0); + +const c7 = mat3x3(vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); + +const c9 = MyArray(); + +@fragment +fn main() -> @location(0) vec4 { + var v1 = c1; + var v2 = c2; + var v3 = c3; + var v4 = c4; + var v5 = c5; + var v6 = c6; + var v7 = c7; + var v9 = c9; + return vec4(0.0, 0.0, 0.0, 0.0); +} diff --git a/test/tint/const/inferred/function.wgsl b/test/tint/const/inferred/function.wgsl new file mode 100644 index 0000000000..cd8811be7e --- /dev/null +++ b/test/tint/const/inferred/function.wgsl @@ -0,0 +1,21 @@ +type MyArray = array; + +// Function-scope consts +fn const_decls() { + const v1 = 1; + const v2 = 1u; + const v3 = 1.0; + + const v4 = vec3(1, 1, 1); + const v5 = vec3(1u, 1u, 1u); + const v6 = vec3(1.0, 1.0, 1.0); + + const v7 = mat3x3(v6, v6, v6); + + const v8 = MyArray(); +} + +@fragment +fn main() -> @location(0) vec4 { + return vec4(0.0,0.0,0.0,0.0); +} diff --git a/test/tint/const/inferred/function.wgsl.expected.dxc.hlsl b/test/tint/const/inferred/function.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f60a041791 --- /dev/null +++ b/test/tint/const/inferred/function.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +void const_decls() { +} + +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/const/inferred/function.wgsl.expected.fxc.hlsl b/test/tint/const/inferred/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f60a041791 --- /dev/null +++ b/test/tint/const/inferred/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +void const_decls() { +} + +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/const/inferred/function.wgsl.expected.glsl b/test/tint/const/inferred/function.wgsl.expected.glsl new file mode 100644 index 0000000000..69a3a97fb2 --- /dev/null +++ b/test/tint/const/inferred/function.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 value; +vec4 tint_symbol() { + return vec4(0.0f); +} + +void main() { + vec4 inner_result = tint_symbol(); + value = inner_result; + return; +} diff --git a/test/tint/const/inferred/function.wgsl.expected.msl b/test/tint/const/inferred/function.wgsl.expected.msl new file mode 100644 index 0000000000..ad4f6346c9 --- /dev/null +++ b/test/tint/const/inferred/function.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +void const_decls() { +} + +struct tint_symbol_1 { + float4 value [[color(0)]]; +}; + +float4 tint_symbol_inner() { + return float4(0.0f); +} + +fragment tint_symbol_1 tint_symbol() { + float4 const inner_result = tint_symbol_inner(); + tint_symbol_1 wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + diff --git a/test/tint/const/inferred/function.wgsl.expected.spvasm b/test/tint/const/inferred/function.wgsl.expected.spvasm new file mode 100644 index 0000000000..c24ee9e3f7 --- /dev/null +++ b/test/tint/const/inferred/function.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %value + OpExecutionMode %main OriginUpperLeft + OpName %value "value" + OpName %const_decls "const_decls" + OpName %main_inner "main_inner" + OpName %main "main" + OpDecorate %value Location 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %10 = OpTypeFunction %v4float +%const_decls = OpFunction %void None %6 + %9 = OpLabel + OpReturn + OpFunctionEnd + %main_inner = OpFunction %v4float None %10 + %12 = OpLabel + OpReturnValue %5 + OpFunctionEnd + %main = OpFunction %void None %6 + %14 = OpLabel + %15 = OpFunctionCall %v4float %main_inner + OpStore %value %15 + OpReturn + OpFunctionEnd diff --git a/test/tint/const/inferred/function.wgsl.expected.wgsl b/test/tint/const/inferred/function.wgsl.expected.wgsl new file mode 100644 index 0000000000..94ff328b5b --- /dev/null +++ b/test/tint/const/inferred/function.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +type MyArray = array; + +fn const_decls() { + const v1 = 1; + const v2 = 1u; + const v3 = 1.0; + const v4 = vec3(1, 1, 1); + const v5 = vec3(1u, 1u, 1u); + const v6 = vec3(1.0, 1.0, 1.0); + const v7 = mat3x3(v6, v6, v6); + const v8 = MyArray(); +} + +@fragment +fn main() -> @location(0) vec4 { + return vec4(0.0, 0.0, 0.0, 0.0); +} diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl new file mode 100644 index 0000000000..26c53ee7e5 --- /dev/null +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = mat3x3(vec3( 1.h, 2.h, 3.h), vec3( 4.h, 5.h, 6.h), vec3( 7.h, 8.h, 9.h)); + let b = mat3x3(vec3(-1.h, -2.h, -3.h), vec3(-4.h, -5.h, -6.h), vec3(-7.h, -8.h, -9.h)); + let r : mat3x3 = a + b; +} diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0ea5b30d96 --- /dev/null +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); + const matrix b = matrix(vector(float16_t(-1.0h), float16_t(-2.0h), float16_t(-3.0h)), vector(float16_t(-4.0h), float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h), float16_t(-9.0h))); + const matrix r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4026222434 --- /dev/null +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); + const matrix b = matrix(vector(float16_t(-1.0h), float16_t(-2.0h), float16_t(-3.0h)), vector(float16_t(-4.0h), float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h), float16_t(-9.0h))); + const matrix r = (a + b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002112F6749E0(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002112F6749E0(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002112F6749E0(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..be49ba92b8 --- /dev/null +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16mat3 a = f16mat3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf)); + f16mat3 b = f16mat3(f16vec3(-1.0hf, -2.0hf, -3.0hf), f16vec3(-4.0hf, -5.0hf, -6.0hf), f16vec3(-7.0hf, -8.0hf, -9.0hf)); + f16mat3 r = (a + b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.msl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..7588dfb7ec --- /dev/null +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3x3 const a = half3x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h)); + half3x3 const b = half3x3(half3(-1.0h, -2.0h, -3.0h), half3(-4.0h, -5.0h, -6.0h), half3(-7.0h, -8.0h, -9.0h)); + half3x3 const r = (a + b); + return; +} + diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0518c6af11 --- /dev/null +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %15 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 + %19 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3 + %20 = OpConstantComposite %mat3v3half %11 %15 %19 +%half_n0x1p_0 = OpConstant %half -0x1p+0 +%half_n0x1p_1 = OpConstant %half -0x1p+1 +%half_n0x1_8p_1 = OpConstant %half -0x1.8p+1 + %24 = OpConstantComposite %v3half %half_n0x1p_0 %half_n0x1p_1 %half_n0x1_8p_1 +%half_n0x1p_2 = OpConstant %half -0x1p+2 +%half_n0x1_4p_2 = OpConstant %half -0x1.4p+2 +%half_n0x1_8p_2 = OpConstant %half -0x1.8p+2 + %28 = OpConstantComposite %v3half %half_n0x1p_2 %half_n0x1_4p_2 %half_n0x1_8p_2 +%half_n0x1_cp_2 = OpConstant %half -0x1.cp+2 +%half_n0x1p_3 = OpConstant %half -0x1p+3 +%half_n0x1_2p_3 = OpConstant %half -0x1.2p+3 + %32 = OpConstantComposite %v3half %half_n0x1_cp_2 %half_n0x1p_3 %half_n0x1_2p_3 + %33 = OpConstantComposite %mat3v3half %24 %28 %32 + %f = OpFunction %void None %1 + %4 = OpLabel + %35 = OpCompositeExtract %v3half %20 0 + %36 = OpCompositeExtract %v3half %33 0 + %37 = OpFAdd %v3half %35 %36 + %38 = OpCompositeExtract %v3half %20 1 + %39 = OpCompositeExtract %v3half %33 1 + %40 = OpFAdd %v3half %38 %39 + %41 = OpCompositeExtract %v3half %20 2 + %42 = OpCompositeExtract %v3half %33 2 + %43 = OpFAdd %v3half %41 %42 + %44 = OpCompositeConstruct %mat3v3half %37 %40 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..202712af77 --- /dev/null +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = mat3x3(vec3(1.0h, 2.0h, 3.0h), vec3(4.0h, 5.0h, 6.0h), vec3(7.0h, 8.0h, 9.0h)); + let b = mat3x3(vec3(-1.0h, -2.0h, -3.0h), vec3(-4.0h, -5.0h, -6.0h), vec3(-7.0h, -8.0h, -9.0h)); + let r : mat3x3 = (a + b); +} diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl index eac9ef652e..0e214f6795 100644 --- a/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat3x3(vec3( 1., 2., 3.), vec3( 4., 5., 6.), vec3( 7., 8., 9.)); let b = mat3x3(vec3(-1., -2., -3.), vec3(-4., -5., -6.), vec3(-7., -8., -9.)); diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e20dd0701c --- /dev/null +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3x3 a = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + const float3x3 b = float3x3(float3(-1.0f, -2.0f, -3.0f), float3(-4.0f, -5.0f, -6.0f), float3(-7.0f, -8.0f, -9.0f)); + const float3x3 r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.wgsl index 2dfb7c8232..8aa0a4c3f6 100644 --- a/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/mat3x3-mat3x3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat3x3(vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0)); let b = mat3x3(vec3(-1.0, -2.0, -3.0), vec3(-4.0, -5.0, -6.0), vec3(-7.0, -8.0, -9.0)); diff --git a/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..35afc350db --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 1.h; + let b = 2.h; + let r : f16 = a + b; +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..14fbe55c12 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t r = float16_t(3.0h); + return; +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d9f60f79fe --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) + float16_t(2.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000026EC74E4450(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5cf03c78a7 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t r = 3.0hf; +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..44aa753823 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 1.0h; + half const b = 2.0h; + half const r = (a + b); + return; +} + diff --git a/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..d021b50f65 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %f = OpFunction %void None %1 + %4 = OpLabel + %8 = OpFAdd %half %half_0x1p_0 %half_0x1p_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4134eb558 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 1.0h; + let b = 2.0h; + let r : f16 = (a + b); +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl index 6dcc6537a1..348f59e916 100644 --- a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.; let b = 2.; diff --git a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66a8434b2e --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float r = 3.0f; + return; +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66a8434b2e --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float r = 3.0f; + return; +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.glsl b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.glsl index f12c446992..75e8dd683e 100644 --- a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void f() { - float r = (1.0f + 2.0f); + float r = 3.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.hlsl deleted file mode 100644 index 7d73fa9945..0000000000 --- a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,5 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const float r = (1.0f + 2.0f); - return; -} diff --git a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.wgsl index 0997a1a1c7..a8dbf32b57 100644 --- a/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.0; let b = 2.0; diff --git a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl index 93e8a35d6e..e772c347ff 100644 --- a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6202d8b57b --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = 3; + return; +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6202d8b57b --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = 3; + return; +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.glsl index 884b5ac6b9..aa5e335278 100644 --- a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void f() { - int r = (1 + 2); + int r = 3; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.hlsl deleted file mode 100644 index 9a9dd1f034..0000000000 --- a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,5 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int r = (1 + 2); - return; -} diff --git a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.wgsl index 46fe066d2d..417ace5679 100644 --- a/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl index cf3c56d14a..a55df641b3 100644 --- a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8a5e6557bb --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = 3u; + return; +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8a5e6557bb --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = 3u; + return; +} diff --git a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.glsl index e5c3783a16..936c36da95 100644 --- a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void f() { - uint r = (1u + 2u); + uint r = 3u; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.hlsl deleted file mode 100644 index f540a8170e..0000000000 --- a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,5 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint r = (1u + 2u); - return; -} diff --git a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.wgsl index c052925ebd..ca5acd2f68 100644 --- a/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl new file mode 100644 index 0000000000..24f6cbd463 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 4.h; + let b = vec3(1.h, 2.h, 3.h); + let r : vec3 = a + b; +} diff --git a/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f3064f82a --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ef38070e0c --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a + b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001CF2FA94E40(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..c3c99031b7 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t a = 4.0hf; + f16vec3 b = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = (a + b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..9e269b9328 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 4.0h; + half3 const b = half3(1.0h, 2.0h, 3.0h); + half3 const r = (a + b); + return; +} + diff --git a/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..68934a4130 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %13 = OpVariable %_ptr_Function_v3half Function %15 + %16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2 + %12 = OpFAdd %v3half %16 %11 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f39fb6a68c --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 4.0h; + let b = vec3(1.0h, 2.0h, 3.0h); + let r : vec3 = (a + b); +} diff --git a/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl b/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl index 8467ba6183..4bd9fdf2d7 100644 --- a/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl +++ b/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.; let b = vec3(1., 2., 3.); diff --git a/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bab272bbf2 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float a = 4.0f; + const float3 b = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.wgsl index 95a584bab1..160e0f3359 100644 --- a/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/scalar-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.0; let b = vec3(1.0, 2.0, 3.0); diff --git a/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl index a61cd74957..849fab26f5 100644 --- a/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1b2562e535 --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(1, 2, 3); + const int3 r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.wgsl index c1193c60a6..2d9c3f82d0 100644 --- a/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl index 0fb18d4c6e..a37afa7209 100644 --- a/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5b43e9e11b --- /dev/null +++ b/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(1u, 2u, 3u); + const uint3 r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.wgsl index 2ec05952c2..0ece2c3244 100644 --- a/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl new file mode 100644 index 0000000000..df5fa3b69b --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = 4.h; + let r : vec3 = a + b; +} diff --git a/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..84ade7b324 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a + float16_t(4.0h)); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f98df2a1bc --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a + float16_t(4.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023450E536E0(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023450E536E0(4,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1cfdba27eb --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = (a + 4.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..fa2a46e312 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half const b = 4.0h; + half3 const r = (a + b); + return; +} + diff --git a/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..6f64d3ebea --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %13 = OpVariable %_ptr_Function_v3half Function %15 + %16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2 + %12 = OpFAdd %v3half %10 %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..d30221538c --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = 4.0h; + let r : vec3 = (a + b); +} diff --git a/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl b/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl index 38320af7d7..d7234dbe30 100644 --- a/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl +++ b/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = 4.; diff --git a/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a7fe143d2d --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a + 4.0f); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.wgsl index 86904e569a..bdc58ee8f2 100644 --- a/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/vec3-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = 4.0; diff --git a/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl index eacbc3be21..10ad527bca 100644 --- a/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5875ef7090 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 r = (a + 4); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.wgsl index e4775e1498..29a003d453 100644 --- a/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl index 50ceeadb00..603bce20e6 100644 --- a/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..056ee37a82 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 r = (a + 4u); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.wgsl index 8f0116ae17..d5a5ddd960 100644 --- a/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..04e90a4001 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = vec3(4.h, 5.h, 6.h); + let r : vec3 = a + b; +} diff --git a/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ac2c946310 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cbca96a598 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a + b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C79E5B27F0(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C79E5B27F0(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C79E5B27F0(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..fc54dd1ccb --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(4.0hf, 5.0hf, 6.0hf); + f16vec3 r = (a + b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..280b62c62b --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half3 const b = half3(4.0h, 5.0h, 6.0h); + half3 const r = (a + b); + return; +} + diff --git a/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..1a58d65dba --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %14 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 + %f = OpFunction %void None %1 + %4 = OpLabel + %15 = OpFAdd %v3half %10 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..4ba0f3b555 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = vec3(4.0h, 5.0h, 6.0h); + let r : vec3 = (a + b); +} diff --git a/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl index 5658e4e9ed..86573beef6 100644 --- a/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = vec3(4., 5., 6.); diff --git a/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2fa34ecac4 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 b = float3(4.0f, 5.0f, 6.0f); + const float3 r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.wgsl index b18ded4bfe..635bd4888a 100644 --- a/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = vec3(4.0, 5.0, 6.0); diff --git a/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl index 98ca5c24f2..b9ef4839f7 100644 --- a/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ff77a02d6 --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.wgsl index 58712eaeca..a5d4297e30 100644 --- a/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl index f6d72ce47a..50400c7e1f 100644 --- a/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5bf855478c --- /dev/null +++ b/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a + b); + return; +} diff --git a/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.wgsl index db61dda135..1569266283 100644 --- a/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/add/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl new file mode 100644 index 0000000000..4c3b55d92e --- /dev/null +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl @@ -0,0 +1,6 @@ +@compute @workgroup_size(1) +fn f() { + let a = true; + let b = false; + let r : bool = a & b; +} diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..17423e395b --- /dev/null +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const bool r = (true & false); + return; +} diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..17423e395b --- /dev/null +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const bool r = (true & false); + return; +} diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.glsl b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.glsl new file mode 100644 index 0000000000..f82b0dc0ae --- /dev/null +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +void f() { + bool r = bool(uint(true) & uint(false)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.msl b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.msl new file mode 100644 index 0000000000..48bc530e57 --- /dev/null +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + bool const a = true; + bool const b = false; + bool const r = bool(a & b); + return; +} + diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.spvasm b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f27a16fc0 --- /dev/null +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.spvasm @@ -0,0 +1,20 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool + %7 = OpConstantNull %bool + %f = OpFunction %void None %1 + %4 = OpLabel + %8 = OpLogicalAnd %bool %true %7 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd359b787b --- /dev/null +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/bool.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +@compute @workgroup_size(1) +fn f() { + let a = true; + let b = false; + let r : bool = (a & b); +} diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl index e4d1a8650f..2b7c554b9f 100644 --- a/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..632b46c6aa --- /dev/null +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 & 2); + return; +} diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.wgsl index 24bab02372..7d7e9b7a09 100644 --- a/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl index c297f9d0f2..3485fa7db2 100644 --- a/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0024712e1e --- /dev/null +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u & 2u); + return; +} diff --git a/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.wgsl index a158e4c2b0..b83374b906 100644 --- a/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-and/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl new file mode 100644 index 0000000000..bc65645e16 --- /dev/null +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl @@ -0,0 +1,6 @@ +@compute @workgroup_size(1) +fn f() { + let a = vec3(true, true, false); + let b = vec3(true, false, true); + let r : vec3 = a & b; +} diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0975dc9df6 --- /dev/null +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const bool3 a = bool3(true, true, false); + const bool3 b = bool3(true, false, true); + const bool3 r = (a & b); + return; +} diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0975dc9df6 --- /dev/null +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const bool3 a = bool3(true, true, false); + const bool3 b = bool3(true, false, true); + const bool3 r = (a & b); + return; +} diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.glsl b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.glsl new file mode 100644 index 0000000000..2c08551b7b --- /dev/null +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es + +void f() { + bvec3 a = bvec3(true, true, false); + bvec3 b = bvec3(true, false, true); + bvec3 r = bvec3(uvec3(a) & uvec3(b)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.msl b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.msl new file mode 100644 index 0000000000..f8eed1d343 --- /dev/null +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + bool3 const a = bool3(true, true, false); + bool3 const b = bool3(true, false, true); + bool3 const r = (a & b); + return; +} + diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.spvasm b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e9e13ad1d --- /dev/null +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %8 = OpConstantNull %bool + %9 = OpConstantComposite %v3bool %true %true %8 + %10 = OpConstantComposite %v3bool %true %8 %true + %f = OpFunction %void None %1 + %4 = OpLabel + %11 = OpLogicalAnd %v3bool %9 %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1e9a774c0 --- /dev/null +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/bool.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +@compute @workgroup_size(1) +fn f() { + let a = vec3(true, true, false); + let b = vec3(true, false, true); + let r : vec3 = (a & b); +} diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl index c2be41dc2f..78641a7112 100644 --- a/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..34f8f47958 --- /dev/null +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a & b); + return; +} diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.wgsl index 334474a744..36203aef16 100644 --- a/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl index 8383a869a6..5bdc140159 100644 --- a/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e74758f29 --- /dev/null +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a & b); + return; +} diff --git a/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.wgsl index 7a95503d5e..169e15c63f 100644 --- a/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-and/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl index e0c227d39d..a5390dffe7 100644 --- a/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4818fbd5c7 --- /dev/null +++ b/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 | 2); + return; +} diff --git a/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.wgsl index 65617cb426..19fd9837a7 100644 --- a/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-or/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl index c8d425742c..d16a8b2414 100644 --- a/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..90fd8af65d --- /dev/null +++ b/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u | 2u); + return; +} diff --git a/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.wgsl index 3c9bed31d4..19d671e877 100644 --- a/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-or/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl index d5f60366b8..0f2f83b2c5 100644 --- a/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6d9541386b --- /dev/null +++ b/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a | b); + return; +} diff --git a/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.wgsl index ffc87a095f..54093a0a25 100644 --- a/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-or/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl index cac160f452..43f1e9d075 100644 --- a/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4e2c7a5014 --- /dev/null +++ b/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a | b); + return; +} diff --git a/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.wgsl index 580a328f4f..acdd66ee7b 100644 --- a/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-or/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl index 9844c807d5..eb53f2416b 100644 --- a/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f3a33ad1eb --- /dev/null +++ b/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 ^ 2); + return; +} diff --git a/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.wgsl index dc73ec6312..1de88f20fe 100644 --- a/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-xor/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl index f0f7a54255..712ecddc22 100644 --- a/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5e4b9090cb --- /dev/null +++ b/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u ^ 2u); + return; +} diff --git a/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.wgsl index 930b21f2cd..e4d519b208 100644 --- a/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-xor/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl index 0a5f1c22ff..f3267097f0 100644 --- a/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..db0a3c1aed --- /dev/null +++ b/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a ^ b); + return; +} diff --git a/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.wgsl index de62f80ce8..4dc949afb4 100644 --- a/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-xor/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl index ce705f6b44..7296b3c193 100644 --- a/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e29687a334 --- /dev/null +++ b/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a ^ b); + return; +} diff --git a/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.wgsl index 044e1389c4..998a81b046 100644 --- a/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/bit-xor/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..c5b96af5b7 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 1.h; + let b = 2.h; + let r : f16 = a / b; +} diff --git a/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6d24970107 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) / float16_t(2.0h)); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..afcbb547ef --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) / float16_t(2.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000232390C4180(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..19336bf38b --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t r = (1.0hf / 2.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..e1c7109ffa --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 1.0h; + half const b = 2.0h; + half const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..3c80e50397 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %f = OpFunction %void None %1 + %4 = OpLabel + %8 = OpFDiv %half %half_0x1p_0 %half_0x1p_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..42cc5de2dc --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 1.0h; + let b = 2.0h; + let r : f16 = (a / b); +} diff --git a/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl index 025664dc36..af5a2c3886 100644 --- a/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.; let b = 2.; diff --git a/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e9f00ff091 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float r = (1.0f / 2.0f); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.wgsl index 4f2fc18f9e..39150b5e75 100644 --- a/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.0; let b = 2.0; diff --git a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl index cba5901387..78571fe61c 100644 --- a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8fe265a729 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 / 2); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.wgsl index 8f7e574c6c..783dd121ef 100644 --- a/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl index 441f376df6..9e9fc5c6b2 100644 --- a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f1d7c0cdfa --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u / 2u); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.wgsl index cff0385af8..b73c90af7f 100644 --- a/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl new file mode 100644 index 0000000000..8478d61fae --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 4.h; + let b = vec3(1.h, 2.h, 3.h); + let r : vec3 = a / b; +} diff --git a/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..be3d642978 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87a855f1bb --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a / b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DE5F7F2A90(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..2128e6fcab --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t a = 4.0hf; + f16vec3 b = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = (a / b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..2281dade34 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 4.0h; + half3 const b = half3(1.0h, 2.0h, 3.0h); + half3 const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0c74972d0a --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %13 = OpVariable %_ptr_Function_v3half Function %15 + %16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2 + %12 = OpFDiv %v3half %16 %11 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..bfb638f675 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 4.0h; + let b = vec3(1.0h, 2.0h, 3.0h); + let r : vec3 = (a / b); +} diff --git a/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl b/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl index f43e97cad4..8025d7d967 100644 --- a/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl +++ b/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.; let b = vec3(1., 2., 3.); diff --git a/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3eabba064d --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float a = 4.0f; + const float3 b = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.wgsl index b8f74f4b4c..e8d13f2a52 100644 --- a/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/scalar-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.0; let b = vec3(1.0, 2.0, 3.0); diff --git a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl index 071efcf6a4..dd35284888 100644 --- a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c41e7ef6d6 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(1, 2, 3); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c41e7ef6d6 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(1, 2, 3); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.hlsl deleted file mode 100644 index cb4a95bd44..0000000000 --- a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int a = 4; - const int3 b = int3(1, 2, 3); - const int3 r = (a / b); - return; -} diff --git a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.wgsl index 1a8cb05f25..a6dd21a9ea 100644 --- a/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl index 5ad53ee09e..1694f6e327 100644 --- a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ac675e22d1 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(1u, 2u, 3u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac675e22d1 --- /dev/null +++ b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(1u, 2u, 3u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.hlsl deleted file mode 100644 index 8942ff8e4b..0000000000 --- a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint a = 4u; - const uint3 b = uint3(1u, 2u, 3u); - const uint3 r = (a / b); - return; -} diff --git a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.wgsl index ffe64127a1..e278d29254 100644 --- a/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl new file mode 100644 index 0000000000..387a7aa581 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = 4.h; + let r : vec3 = a / b; +} diff --git a/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5d6ce5fba0 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a / float16_t(4.0h)); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0715818127 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a / float16_t(4.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FA1E656B40(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FA1E656B40(4,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f596b49b98 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = (a / 4.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..b3e1a699f8 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half const b = 4.0h; + half3 const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5deea7719 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %13 = OpVariable %_ptr_Function_v3half Function %15 + %16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2 + %12 = OpFDiv %v3half %10 %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..5ee44a1eb9 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = 4.0h; + let r : vec3 = (a / b); +} diff --git a/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl b/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl index 087c0d30af..f1c3d76971 100644 --- a/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl +++ b/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = 4.; diff --git a/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f1645a27ab --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a / 4.0f); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.wgsl index 70432dbc6d..79851b8c7e 100644 --- a/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/vec3-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = 4.0; diff --git a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl index 890b12551b..fdc8002747 100644 --- a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..672f46ec18 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 r = (a / 4); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.wgsl index f3a1164d8f..f664fcee0f 100644 --- a/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl index 7ab6dd501e..4a68b5e3c8 100644 --- a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2f4dc9cb10 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 r = (a / 4u); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.wgsl index 2f64dd9b14..20dcced044 100644 --- a/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..a46ca46c14 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = vec3(4.h, 5.h, 6.h); + let r : vec3 = a / b; +} diff --git a/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..99e2413875 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6952b71503 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a / b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002A238932BC0(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002A238932BC0(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002A238932BC0(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..150332476b --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(4.0hf, 5.0hf, 6.0hf); + f16vec3 r = (a / b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..fcbe08cf55 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half3 const b = half3(4.0h, 5.0h, 6.0h); + half3 const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..1c75e32d68 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %14 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 + %f = OpFunction %void None %1 + %4 = OpLabel + %15 = OpFDiv %v3half %10 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..6367b34fb8 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = vec3(4.0h, 5.0h, 6.0h); + let r : vec3 = (a / b); +} diff --git a/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl index 1f253ea991..9d9071bdbf 100644 --- a/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = vec3(4., 5., 6.); diff --git a/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7ae0123dbd --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 b = float3(4.0f, 5.0f, 6.0f); + const float3 r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.wgsl index c3129a964d..0946de88a5 100644 --- a/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = vec3(4.0, 5.0, 6.0); diff --git a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl index 68d844f8ae..daa29b5e41 100644 --- a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..98c4e64f45 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..98c4e64f45 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.hlsl deleted file mode 100644 index 33a4443cf7..0000000000 --- a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int3 a = int3(1, 2, 3); - const int3 b = int3(4, 5, 6); - const int3 r = (a / b); - return; -} diff --git a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.wgsl index a601fa0bfe..fef75fb6e4 100644 --- a/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl index 9215590e7c..318abf1465 100644 --- a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f2a501ee5 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2f2a501ee5 --- /dev/null +++ b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.hlsl deleted file mode 100644 index 815ad9bfd9..0000000000 --- a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint3 a = uint3(1u, 2u, 3u); - const uint3 b = uint3(4u, 5u, 6u); - const uint3 r = (a / b); - return; -} diff --git a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.wgsl index 66261d5cbb..2b03205a4b 100644 --- a/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..921f09a771 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 1.h; + let b = 0.h; + let r : f16 = a / b; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..82d70e4350 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) / float16_t(0.0h)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..85a7e0dffd --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) / float16_t(0.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001E4C7696450(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f2529d1250 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t r = (1.0hf / 0.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..c179608b1f --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 1.0h; + half const b = 0.0h; + half const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..8b49f81fd8 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %7 = OpConstantNull %half + %f = OpFunction %void None %1 + %4 = OpLabel + %8 = OpFDiv %half %half_0x1p_0 %7 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2c310d196 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 1.0h; + let b = 0.0h; + let r : f16 = (a / b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl index 9503e44304..c892171298 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.; let b = 0.; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a06ee90be9 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float r = (1.0f / 0.0f); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.spvasm index aba66b3f77..c7d8708815 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.spvasm @@ -12,9 +12,9 @@ %1 = OpTypeFunction %void %float = OpTypeFloat 32 %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 + %7 = OpConstantNull %float %f = OpFunction %void None %1 %4 = OpLabel - %8 = OpFDiv %float %float_1 %float_0 + %8 = OpFDiv %float %float_1 %7 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.wgsl index 8036fce278..d1acaebcbc 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.0; let b = 0.0; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl index 73f03b7e40..7df831e9fe 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67f002e540 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 / 1); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm index 47589eb15f..fa188bd8fe 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm @@ -12,9 +12,9 @@ %1 = OpTypeFunction %void %int = OpTypeInt 32 1 %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 + %7 = OpConstantNull %int %f = OpFunction %void None %1 %4 = OpLabel - %8 = OpSDiv %int %int_1 %int_0 + %8 = OpSDiv %int %int_1 %7 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.wgsl index 5284d7d16f..a5c138528c 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl index 38b3d2493a..be8b480d28 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60e18ed73b --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u / 1u); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.spvasm index 96e2a307e6..57df98086c 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.spvasm @@ -12,9 +12,9 @@ %1 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 - %uint_0 = OpConstant %uint 0 + %7 = OpConstantNull %uint %f = OpFunction %void None %1 %4 = OpLabel - %8 = OpUDiv %uint %uint_1 %uint_0 + %8 = OpUDiv %uint %uint_1 %7 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.wgsl index 8c8f7ae0fd..ddaf341dfd 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl new file mode 100644 index 0000000000..a32ff905a2 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 4.h; + let b = vec3(0.h, 2.h, 0.h); + let r : vec3 = a / b; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1d718d2df4 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(0.0h), float16_t(2.0h), float16_t(0.0h)); + const vector r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63289fa438 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(0.0h), float16_t(2.0h), float16_t(0.0h)); + const vector r = (a / b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001A1C20B2D10(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..88e56e86f2 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t a = 4.0hf; + f16vec3 b = f16vec3(0.0hf, 2.0hf, 0.0hf); + f16vec3 r = (a / b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..45660aefc8 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 4.0h; + half3 const b = half3(0.0h, 2.0h, 0.0h); + half3 const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0ba97a16d2 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %v3half = OpTypeVector %half 3 + %8 = OpConstantNull %half +%half_0x1p_1 = OpConstant %half 0x1p+1 + %10 = OpConstantComposite %v3half %8 %half_0x1p_1 %8 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %14 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %12 = OpVariable %_ptr_Function_v3half Function %14 + %15 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2 + %11 = OpFDiv %v3half %15 %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed3ca80cee --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 4.0h; + let b = vec3(0.0h, 2.0h, 0.0h); + let r : vec3 = (a / b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl index 0db5465133..79419333ce 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.; let b = vec3(0., 2., 0.); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..85db3bff58 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float a = 4.0f; + const float3 b = float3(0.0f, 2.0f, 0.0f); + const float3 r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.spvasm index 517826d399..456e1438f7 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.spvasm @@ -13,9 +13,9 @@ %float = OpTypeFloat 32 %float_4 = OpConstant %float 4 %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 + %8 = OpConstantNull %float %float_2 = OpConstant %float 2 - %10 = OpConstantComposite %v3float %float_0 %float_2 %float_0 + %10 = OpConstantComposite %v3float %8 %float_2 %8 %_ptr_Function_v3float = OpTypePointer Function %v3float %14 = OpConstantNull %v3float %f = OpFunction %void None %1 diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.wgsl index 24d6132667..606020072d 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.0; let b = vec3(0.0, 2.0, 0.0); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl index 2b6ef483fa..756562b58a 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..99ed924ffe --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(0, 2, 0); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..99ed924ffe --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(0, 2, 0); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl deleted file mode 100644 index 35cc532378..0000000000 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int a = 4; - const int3 b = int3(0, 2, 0); - const int3 r = (a / int3(1, 2, 1)); - return; -} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm index 7cf0d5898a..7cfcbadf7f 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm @@ -13,9 +13,9 @@ %int = OpTypeInt 32 1 %int_4 = OpConstant %int 4 %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 + %8 = OpConstantNull %int %int_2 = OpConstant %int 2 - %10 = OpConstantComposite %v3int %int_0 %int_2 %int_0 + %10 = OpConstantComposite %v3int %8 %int_2 %8 %_ptr_Function_v3int = OpTypePointer Function %v3int %14 = OpConstantNull %v3int %f = OpFunction %void None %1 diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.wgsl index 58c1887622..f627163dd8 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl index a0a8fe6c34..6aa885ba62 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1ebcc7f0ca --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(0u, 2u, 0u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1ebcc7f0ca --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(0u, 2u, 0u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl deleted file mode 100644 index f57e7ed806..0000000000 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint a = 4u; - const uint3 b = uint3(0u, 2u, 0u); - const uint3 r = (a / uint3(1u, 2u, 1u)); - return; -} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.spvasm index af6d858953..81b44169de 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.spvasm @@ -13,9 +13,9 @@ %uint = OpTypeInt 32 0 %uint_4 = OpConstant %uint 4 %v3uint = OpTypeVector %uint 3 - %uint_0 = OpConstant %uint 0 + %8 = OpConstantNull %uint %uint_2 = OpConstant %uint 2 - %10 = OpConstantComposite %v3uint %uint_0 %uint_2 %uint_0 + %10 = OpConstantComposite %v3uint %8 %uint_2 %8 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %14 = OpConstantNull %v3uint %f = OpFunction %void None %1 diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.wgsl index bb436e1c72..309e490b97 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl new file mode 100644 index 0000000000..4dfef44aeb --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = 0.h; + let r : vec3 = a / b; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3a50c61c73 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a / float16_t(0.0h)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c4b9952ca --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a / float16_t(0.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000198035B3410(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000198035B3410(4,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..ce7bfccc2d --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = (a / 0.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..02c38eb7a7 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half const b = 0.0h; + half3 const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f0fb91a88 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 + %11 = OpConstantNull %half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %13 = OpVariable %_ptr_Function_v3half Function %15 + %16 = OpCompositeConstruct %v3half %11 %11 %11 + %12 = OpFDiv %v3half %10 %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd50862682 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = 0.0h; + let r : vec3 = (a / b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl index b83333f920..c4c0d016a8 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = 0.; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c661ab1e6c --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a / 0.0f); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.spvasm index cc78cc9a86..f14f5aaea9 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.spvasm @@ -16,13 +16,13 @@ %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 - %float_0 = OpConstant %float 0 + %11 = OpConstantNull %float %_ptr_Function_v3float = OpTypePointer Function %v3float %15 = OpConstantNull %v3float %f = OpFunction %void None %1 %4 = OpLabel %13 = OpVariable %_ptr_Function_v3float Function %15 - %16 = OpCompositeConstruct %v3float %float_0 %float_0 %float_0 + %16 = OpCompositeConstruct %v3float %11 %11 %11 %12 = OpFDiv %v3float %10 %16 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.wgsl index f48af63db1..43f2400608 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = 0.0; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl index f9291d5385..946579726f 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8a44ac5b09 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 r = (a / 1); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm index 7f5c03fff7..af40beba9b 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm @@ -16,13 +16,13 @@ %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %int_0 = OpConstant %int 0 + %11 = OpConstantNull %int %_ptr_Function_v3int = OpTypePointer Function %v3int %15 = OpConstantNull %v3int %f = OpFunction %void None %1 %4 = OpLabel %13 = OpVariable %_ptr_Function_v3int Function %15 - %16 = OpCompositeConstruct %v3int %int_0 %int_0 %int_0 + %16 = OpCompositeConstruct %v3int %11 %11 %11 %12 = OpSDiv %v3int %10 %16 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.wgsl index c7f11a180c..9c2f12f16a 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl index 5446b2a145..bebd1d8fa6 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..18d1da5a71 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 r = (a / 1u); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.spvasm index a81a4c231d..2a83009118 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.spvasm @@ -16,13 +16,13 @@ %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 - %uint_0 = OpConstant %uint 0 + %11 = OpConstantNull %uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint %15 = OpConstantNull %v3uint %f = OpFunction %void None %1 %4 = OpLabel %13 = OpVariable %_ptr_Function_v3uint Function %15 - %16 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %uint_0 + %16 = OpCompositeConstruct %v3uint %11 %11 %11 %12 = OpUDiv %v3uint %10 %16 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.wgsl index 5ead9830c8..a0bc135359 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..55afdb5100 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = vec3(0.h, 5.h, 0.h); + let r : vec3 = a / b; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..82953a7e75 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e14e32cea7 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a / b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002160BCD37C0(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002160BCD37C0(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002160BCD37C0(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..cc52a027ec --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(0.0hf, 5.0hf, 0.0hf); + f16vec3 r = (a / b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..231f820f99 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half3 const b = half3(0.0h, 5.0h, 0.0h); + half3 const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcd39f368d --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 + %11 = OpConstantNull %half +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %13 = OpConstantComposite %v3half %11 %half_0x1_4p_2 %11 + %f = OpFunction %void None %1 + %4 = OpLabel + %14 = OpFDiv %v3half %10 %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..d1143756b2 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = vec3(0.0h, 5.0h, 0.0h); + let r : vec3 = (a / b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl index 6db41a47bd..b2706abe77 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = vec3(0., 5., 0.); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..94b990b7f2 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 b = float3(0.0f, 5.0f, 0.0f); + const float3 r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.spvasm index 5a8a4d8b90..bb66a5e365 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.spvasm @@ -16,9 +16,9 @@ %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 - %float_0 = OpConstant %float 0 + %11 = OpConstantNull %float %float_5 = OpConstant %float 5 - %13 = OpConstantComposite %v3float %float_0 %float_5 %float_0 + %13 = OpConstantComposite %v3float %11 %float_5 %11 %f = OpFunction %void None %1 %4 = OpLabel %14 = OpFDiv %v3float %10 %13 diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.wgsl index 6f4aa8c57a..ec8b4ed2a9 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = vec3(0.0, 5.0, 0.0); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl index 5d583e65d2..963fbc7b0d 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..30d26ca22f --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(0, 5, 0); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..30d26ca22f --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(0, 5, 0); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl deleted file mode 100644 index 3cd640ec4b..0000000000 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int3 a = int3(1, 2, 3); - const int3 b = int3(0, 5, 0); - const int3 r = (a / int3(1, 5, 1)); - return; -} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm index 8176141843..e986304d30 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm @@ -16,9 +16,9 @@ %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %int_0 = OpConstant %int 0 + %11 = OpConstantNull %int %int_5 = OpConstant %int 5 - %13 = OpConstantComposite %v3int %int_0 %int_5 %int_0 + %13 = OpConstantComposite %v3int %11 %int_5 %11 %f = OpFunction %void None %1 %4 = OpLabel %14 = OpSDiv %v3int %10 %13 diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.wgsl index 76bf812cf7..401f1e52e7 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl index 16a0dd08bb..13e9f8fe22 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c337dc39a8 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(0u, 5u, 0u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c337dc39a8 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(0u, 5u, 0u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl deleted file mode 100644 index ea7ca067ab..0000000000 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint3 a = uint3(1u, 2u, 3u); - const uint3 b = uint3(0u, 5u, 0u); - const uint3 r = (a / uint3(1u, 5u, 1u)); - return; -} diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.spvasm index 276d688288..2536318538 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.spvasm @@ -16,9 +16,9 @@ %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 - %uint_0 = OpConstant %uint 0 + %11 = OpConstantNull %uint %uint_5 = OpConstant %uint 5 - %13 = OpConstantComposite %v3uint %uint_0 %uint_5 %uint_0 + %13 = OpConstantComposite %v3uint %11 %uint_5 %11 %f = OpFunction %void None %1 %4 = OpLabel %14 = OpUDiv %v3uint %10 %13 diff --git a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.wgsl index eb849bdccd..4212c52d2f 100644 --- a/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..c77813dbde --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = 1.h; + var b = 0.h; + let r : f16 = a / (b + b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..45ec9fd737 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(0.0h); + const float16_t r = (a / (b + b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a4e405fd09 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(0.0h); + const float16_t r = (a / (b + b)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000154BF386B50(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000154BF386B50(3,13): error X3000: unrecognized identifier 'a' + diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..2dfc6163b1 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t a = 1.0hf; + float16_t b = 0.0hf; + float16_t r = (a / (b + b)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..e428a9c62e --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half a = 1.0h; + half b = 0.0h; + half const r = (a / (b + b)); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc2c2e35e1 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Function_half = OpTypePointer Function %half + %9 = OpConstantNull %half + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_half Function %9 + %b = OpVariable %_ptr_Function_half Function %9 + OpStore %a %half_0x1p_0 + OpStore %b %9 + %11 = OpLoad %half %a + %12 = OpLoad %half %b + %13 = OpLoad %half %b + %14 = OpFAdd %half %12 %13 + %15 = OpFDiv %half %11 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..65ea76cbd1 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = 1.0h; + var b = 0.0h; + let r : f16 = (a / (b + b)); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl index 55c73c5c1d..886a8488bd 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1.; var b = 0.; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf3a16e737 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float a = 1.0f; + float b = 0.0f; + const float r = (a / (b + b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.spvasm index c4eaf69931..ebfbdb58d4 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,17 +16,16 @@ %float_1 = OpConstant %float 1 %_ptr_Function_float = OpTypePointer Function %float %9 = OpConstantNull %float - %float_0 = OpConstant %float 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_float Function %9 %b = OpVariable %_ptr_Function_float Function %9 OpStore %a %float_1 - OpStore %b %float_0 - %12 = OpLoad %float %a + OpStore %b %9 + %11 = OpLoad %float %a + %12 = OpLoad %float %b %13 = OpLoad %float %b - %14 = OpLoad %float %b - %15 = OpFAdd %float %13 %14 - %16 = OpFDiv %float %12 %15 + %14 = OpFAdd %float %12 %13 + %15 = OpFDiv %float %11 %14 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.wgsl index 8b3d931bfe..278a02a1aa 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1.0; var b = 0.0; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl index 016e7a81df..7d196fb67f 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1; var b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ed443002a --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +int value_or_one_if_zero_int(int value) { + return value == 0 ? 1 : value; +} + +[numthreads(1, 1, 1)] +void f() { + int a = 1; + int b = 0; + const int r = (a / value_or_one_if_zero_int((b + b))); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm index e1a8969c5f..2cad16a763 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,17 +16,16 @@ %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int %9 = OpConstantNull %int - %int_0 = OpConstant %int 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_int Function %9 %b = OpVariable %_ptr_Function_int Function %9 OpStore %a %int_1 - OpStore %b %int_0 - %12 = OpLoad %int %a + OpStore %b %9 + %11 = OpLoad %int %a + %12 = OpLoad %int %b %13 = OpLoad %int %b - %14 = OpLoad %int %b - %15 = OpIAdd %int %13 %14 - %16 = OpSDiv %int %12 %15 + %14 = OpIAdd %int %12 %13 + %15 = OpSDiv %int %11 %14 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.wgsl index c762d02ff5..d258b8a7a3 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1; var b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl index a265dd0d2a..42c1872f21 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1u; var b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec658be559 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +uint value_or_one_if_zero_uint(uint value) { + return value == 0u ? 1u : value; +} + +[numthreads(1, 1, 1)] +void f() { + uint a = 1u; + uint b = 0u; + const uint r = (a / value_or_one_if_zero_uint((b + b))); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.spvasm index 8d771cca2e..f245f406fb 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,17 +16,16 @@ %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint %9 = OpConstantNull %uint - %uint_0 = OpConstant %uint 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_uint Function %9 %b = OpVariable %_ptr_Function_uint Function %9 OpStore %a %uint_1 - OpStore %b %uint_0 - %12 = OpLoad %uint %a + OpStore %b %9 + %11 = OpLoad %uint %a + %12 = OpLoad %uint %b %13 = OpLoad %uint %b - %14 = OpLoad %uint %b - %15 = OpIAdd %uint %13 %14 - %16 = OpUDiv %uint %12 %15 + %14 = OpIAdd %uint %12 %13 + %15 = OpUDiv %uint %11 %14 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.wgsl index ad82462488..f60cdb5bb1 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1u; var b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl new file mode 100644 index 0000000000..e5a465da42 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = 4.h; + var b = vec3(0.h, 2.h, 0.h); + let r : vec3 = a / (b + b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c5a6fe36e2 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(4.0h); + vector b = vector(float16_t(0.0h), float16_t(2.0h), float16_t(0.0h)); + const vector r = (a / (b + b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf0993f390 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(4.0h); + vector b = vector(float16_t(0.0h), float16_t(2.0h), float16_t(0.0h)); + const vector r = (a / (b + b)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001AAC9012BB0(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001AAC9012BB0(3,13): error X3000: unrecognized identifier 'a' + diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..ded2048ba4 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t a = 4.0hf; + f16vec3 b = f16vec3(0.0hf, 2.0hf, 0.0hf); + f16vec3 r = (a / (b + b)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..ec458c826d --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half a = 4.0h; + half3 b = half3(0.0h, 2.0h, 0.0h); + half3 const r = (a / (b + b)); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..e563bb99ac --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%_ptr_Function_half = OpTypePointer Function %half + %9 = OpConstantNull %half + %v3half = OpTypeVector %half 3 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %12 = OpConstantComposite %v3half %9 %half_0x1p_1 %9 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_half Function %9 + %b = OpVariable %_ptr_Function_v3half Function %15 + %21 = OpVariable %_ptr_Function_v3half Function %15 + OpStore %a %half_0x1p_2 + OpStore %b %12 + %16 = OpLoad %half %a + %17 = OpLoad %v3half %b + %18 = OpLoad %v3half %b + %19 = OpFAdd %v3half %17 %18 + %22 = OpCompositeConstruct %v3half %16 %16 %16 + %20 = OpFDiv %v3half %22 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..462009d2de --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = 4.0h; + var b = vec3(0.0h, 2.0h, 0.0h); + let r : vec3 = (a / (b + b)); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl index ba92b627b7..986c1b13b1 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4.; var b = vec3(0., 2., 0.); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..399b2b9c6a --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float a = 4.0f; + float3 b = float3(0.0f, 2.0f, 0.0f); + const float3 r = (a / (b + b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.spvasm index ac14577d53..e44ff2dbaf 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,23 +17,22 @@ %_ptr_Function_float = OpTypePointer Function %float %9 = OpConstantNull %float %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 %float_2 = OpConstant %float 2 - %13 = OpConstantComposite %v3float %float_0 %float_2 %float_0 + %12 = OpConstantComposite %v3float %9 %float_2 %9 %_ptr_Function_v3float = OpTypePointer Function %v3float - %16 = OpConstantNull %v3float + %15 = OpConstantNull %v3float %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_float Function %9 - %b = OpVariable %_ptr_Function_v3float Function %16 - %22 = OpVariable %_ptr_Function_v3float Function %16 + %b = OpVariable %_ptr_Function_v3float Function %15 + %21 = OpVariable %_ptr_Function_v3float Function %15 OpStore %a %float_4 - OpStore %b %13 - %17 = OpLoad %float %a + OpStore %b %12 + %16 = OpLoad %float %a + %17 = OpLoad %v3float %b %18 = OpLoad %v3float %b - %19 = OpLoad %v3float %b - %20 = OpFAdd %v3float %18 %19 - %23 = OpCompositeConstruct %v3float %17 %17 %17 - %21 = OpFDiv %v3float %23 %20 + %19 = OpFAdd %v3float %17 %18 + %22 = OpCompositeConstruct %v3float %16 %16 %16 + %20 = OpFDiv %v3float %22 %19 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.wgsl index c7a6ac1d75..d3495356a9 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4.0; var b = vec3(0.0, 2.0, 0.0); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl index 9dc07d5d5d..ed13271d84 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4; var b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f23bda330e --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +int3 value_or_one_if_zero_int3(int3 value) { + return value == int3(0, 0, 0) ? int3(1, 1, 1) : value; +} + +[numthreads(1, 1, 1)] +void f() { + int a = 4; + int3 b = int3(0, 2, 0); + const int3 r = (a / value_or_one_if_zero_int3((b + b))); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm index cfc7c26729..ac46dbb214 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,23 +17,22 @@ %_ptr_Function_int = OpTypePointer Function %int %9 = OpConstantNull %int %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 %int_2 = OpConstant %int 2 - %13 = OpConstantComposite %v3int %int_0 %int_2 %int_0 + %12 = OpConstantComposite %v3int %9 %int_2 %9 %_ptr_Function_v3int = OpTypePointer Function %v3int - %16 = OpConstantNull %v3int + %15 = OpConstantNull %v3int %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_int Function %9 - %b = OpVariable %_ptr_Function_v3int Function %16 - %22 = OpVariable %_ptr_Function_v3int Function %16 + %b = OpVariable %_ptr_Function_v3int Function %15 + %21 = OpVariable %_ptr_Function_v3int Function %15 OpStore %a %int_4 - OpStore %b %13 - %17 = OpLoad %int %a + OpStore %b %12 + %16 = OpLoad %int %a + %17 = OpLoad %v3int %b %18 = OpLoad %v3int %b - %19 = OpLoad %v3int %b - %20 = OpIAdd %v3int %18 %19 - %23 = OpCompositeConstruct %v3int %17 %17 %17 - %21 = OpSDiv %v3int %23 %20 + %19 = OpIAdd %v3int %17 %18 + %22 = OpCompositeConstruct %v3int %16 %16 %16 + %20 = OpSDiv %v3int %22 %19 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.wgsl index e4dd4b4264..c92fad82ae 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4; var b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl index 0547691f07..628a77852d 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4u; var b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ec3621c697 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +uint3 value_or_one_if_zero_uint3(uint3 value) { + return value == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : value; +} + +[numthreads(1, 1, 1)] +void f() { + uint a = 4u; + uint3 b = uint3(0u, 2u, 0u); + const uint3 r = (a / value_or_one_if_zero_uint3((b + b))); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.spvasm index e0abc2f4d4..d4fb717401 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,23 +17,22 @@ %_ptr_Function_uint = OpTypePointer Function %uint %9 = OpConstantNull %uint %v3uint = OpTypeVector %uint 3 - %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 - %13 = OpConstantComposite %v3uint %uint_0 %uint_2 %uint_0 + %12 = OpConstantComposite %v3uint %9 %uint_2 %9 %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %16 = OpConstantNull %v3uint + %15 = OpConstantNull %v3uint %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_uint Function %9 - %b = OpVariable %_ptr_Function_v3uint Function %16 - %22 = OpVariable %_ptr_Function_v3uint Function %16 + %b = OpVariable %_ptr_Function_v3uint Function %15 + %21 = OpVariable %_ptr_Function_v3uint Function %15 OpStore %a %uint_4 - OpStore %b %13 - %17 = OpLoad %uint %a + OpStore %b %12 + %16 = OpLoad %uint %a + %17 = OpLoad %v3uint %b %18 = OpLoad %v3uint %b - %19 = OpLoad %v3uint %b - %20 = OpIAdd %v3uint %18 %19 - %23 = OpCompositeConstruct %v3uint %17 %17 %17 - %21 = OpUDiv %v3uint %23 %20 + %19 = OpIAdd %v3uint %17 %18 + %22 = OpCompositeConstruct %v3uint %16 %16 %16 + %20 = OpUDiv %v3uint %22 %19 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.wgsl index 9f103fba29..647e299481 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4u; var b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl new file mode 100644 index 0000000000..b0837e976d --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.h, 2.h, 3.h); + var b = 0.h; + let r : vec3 = a / (b + b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0ecccc00b9 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + float16_t b = float16_t(0.0h); + const vector r = (a / (b + b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d67a196626 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + float16_t b = float16_t(0.0h); + const vector r = (a / (b + b)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000015421E739B0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000015421E739B0(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000015421E739B0(4,13): error X3000: unrecognized identifier 'b' + diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..09050725ab --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + float16_t b = 0.0hf; + f16vec3 r = (a / (b + b)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..74be1a42ad --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 a = half3(1.0h, 2.0h, 3.0h); + half b = 0.0h; + half3 const r = (a / (b + b)); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..66236edcd3 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %13 = OpConstantNull %v3half + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_v3half Function %13 + %b = OpVariable %_ptr_Function_half Function %14 + %22 = OpVariable %_ptr_Function_v3half Function %13 + OpStore %a %10 + OpStore %b %14 + %17 = OpLoad %v3half %a + %18 = OpLoad %half %b + %19 = OpLoad %half %b + %20 = OpFAdd %half %18 %19 + %23 = OpCompositeConstruct %v3half %20 %20 %20 + %21 = OpFDiv %v3half %17 %23 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f418eb6f0 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.0h, 2.0h, 3.0h); + var b = 0.0h; + let r : vec3 = (a / (b + b)); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl index 98ff5f0ca3..a0b8b9bdb7 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1., 2., 3.); var b = 0.; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..85f1063e05 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float3 a = float3(1.0f, 2.0f, 3.0f); + float b = 0.0f; + const float3 r = (a / (b + b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.spvasm index 6f77e087d7..a8ab379116 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,21 +20,20 @@ %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 %_ptr_Function_v3float = OpTypePointer Function %v3float %13 = OpConstantNull %v3float - %float_0 = OpConstant %float 0 + %14 = OpConstantNull %float %_ptr_Function_float = OpTypePointer Function %float - %17 = OpConstantNull %float %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3float Function %13 - %b = OpVariable %_ptr_Function_float Function %17 - %23 = OpVariable %_ptr_Function_v3float Function %13 + %b = OpVariable %_ptr_Function_float Function %14 + %22 = OpVariable %_ptr_Function_v3float Function %13 OpStore %a %10 - OpStore %b %float_0 - %18 = OpLoad %v3float %a + OpStore %b %14 + %17 = OpLoad %v3float %a + %18 = OpLoad %float %b %19 = OpLoad %float %b - %20 = OpLoad %float %b - %21 = OpFAdd %float %19 %20 - %24 = OpCompositeConstruct %v3float %21 %21 %21 - %22 = OpFDiv %v3float %18 %24 + %20 = OpFAdd %float %18 %19 + %23 = OpCompositeConstruct %v3float %20 %20 %20 + %21 = OpFDiv %v3float %17 %23 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.wgsl index f0df1be843..01272da464 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1.0, 2.0, 3.0); var b = 0.0; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl index b792c3ac19..6ccbded465 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..964d2751f3 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +int value_or_one_if_zero_int(int value) { + return value == 0 ? 1 : value; +} + +[numthreads(1, 1, 1)] +void f() { + int3 a = int3(1, 2, 3); + int b = 0; + const int3 r = (a / value_or_one_if_zero_int((b + b))); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm index 755ab0e6d4..565dd46094 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,21 +20,20 @@ %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %_ptr_Function_v3int = OpTypePointer Function %v3int %13 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 + %14 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %17 = OpConstantNull %int %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3int Function %13 - %b = OpVariable %_ptr_Function_int Function %17 - %23 = OpVariable %_ptr_Function_v3int Function %13 + %b = OpVariable %_ptr_Function_int Function %14 + %22 = OpVariable %_ptr_Function_v3int Function %13 OpStore %a %10 - OpStore %b %int_0 - %18 = OpLoad %v3int %a + OpStore %b %14 + %17 = OpLoad %v3int %a + %18 = OpLoad %int %b %19 = OpLoad %int %b - %20 = OpLoad %int %b - %21 = OpIAdd %int %19 %20 - %24 = OpCompositeConstruct %v3int %21 %21 %21 - %22 = OpSDiv %v3int %18 %24 + %20 = OpIAdd %int %18 %19 + %23 = OpCompositeConstruct %v3int %20 %20 %20 + %21 = OpSDiv %v3int %17 %23 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.wgsl index 6bbc51bf35..82ce280991 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl index 4e4eacba24..3adbb4fc5f 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f4bd21bd64 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +uint value_or_one_if_zero_uint(uint value) { + return value == 0u ? 1u : value; +} + +[numthreads(1, 1, 1)] +void f() { + uint3 a = uint3(1u, 2u, 3u); + uint b = 0u; + const uint3 r = (a / value_or_one_if_zero_uint((b + b))); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.spvasm index d83d27bf9d..726b715e18 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,21 +20,20 @@ %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %13 = OpConstantNull %v3uint - %uint_0 = OpConstant %uint 0 + %14 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3uint Function %13 - %b = OpVariable %_ptr_Function_uint Function %17 - %23 = OpVariable %_ptr_Function_v3uint Function %13 + %b = OpVariable %_ptr_Function_uint Function %14 + %22 = OpVariable %_ptr_Function_v3uint Function %13 OpStore %a %10 - OpStore %b %uint_0 - %18 = OpLoad %v3uint %a + OpStore %b %14 + %17 = OpLoad %v3uint %a + %18 = OpLoad %uint %b %19 = OpLoad %uint %b - %20 = OpLoad %uint %b - %21 = OpIAdd %uint %19 %20 - %24 = OpCompositeConstruct %v3uint %21 %21 %21 - %22 = OpUDiv %v3uint %18 %24 + %20 = OpIAdd %uint %18 %19 + %23 = OpCompositeConstruct %v3uint %20 %20 %20 + %21 = OpUDiv %v3uint %17 %23 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.wgsl index 238736409e..0d57402a0c 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..465e9c2f5c --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.h, 2.h, 3.h); + var b = vec3(0.h, 5.h, 0.h); + let r : vec3 = a / (b + b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..59d720cfc9 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a / (b + b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7fd5723df4 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a / (b + b)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000022203DE1EB0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000022203DE1EB0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000022203DE1EB0(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5eefe2581f --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(0.0hf, 5.0hf, 0.0hf); + f16vec3 r = (a / (b + b)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..c059d40cdf --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 a = half3(1.0h, 2.0h, 3.0h); + half3 b = half3(0.0h, 5.0h, 0.0h); + half3 const r = (a / (b + b)); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..203736b7ba --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %13 = OpConstantNull %v3half + %14 = OpConstantNull %half +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %16 = OpConstantComposite %v3half %14 %half_0x1_4p_2 %14 + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_v3half Function %13 + %b = OpVariable %_ptr_Function_v3half Function %13 + OpStore %a %10 + OpStore %b %16 + %18 = OpLoad %v3half %a + %19 = OpLoad %v3half %b + %20 = OpLoad %v3half %b + %21 = OpFAdd %v3half %19 %20 + %22 = OpFDiv %v3half %18 %21 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..12179f9938 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.0h, 2.0h, 3.0h); + var b = vec3(0.0h, 5.0h, 0.0h); + let r : vec3 = (a / (b + b)); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl index 69761db539..1c1d54e33b 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1., 2., 3.); var b = vec3(0., 5., 0.); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..413547827e --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float3 a = float3(1.0f, 2.0f, 3.0f); + float3 b = float3(0.0f, 5.0f, 0.0f); + const float3 r = (a / (b + b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.spvasm index eed89f715e..f3ba492852 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 %_ptr_Function_v3float = OpTypePointer Function %v3float %13 = OpConstantNull %v3float - %float_0 = OpConstant %float 0 + %14 = OpConstantNull %float %float_5 = OpConstant %float 5 - %16 = OpConstantComposite %v3float %float_0 %float_5 %float_0 + %16 = OpConstantComposite %v3float %14 %float_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3float Function %13 diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.wgsl index 2e518af2ec..b3998ed113 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1.0, 2.0, 3.0); var b = vec3(0.0, 5.0, 0.0); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl index 65e13dcd86..d858603ad9 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fefc614241 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +int3 value_or_one_if_zero_int3(int3 value) { + return value == int3(0, 0, 0) ? int3(1, 1, 1) : value; +} + +[numthreads(1, 1, 1)] +void f() { + int3 a = int3(1, 2, 3); + int3 b = int3(0, 5, 0); + const int3 r = (a / value_or_one_if_zero_int3((b + b))); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm index 5552161c94..03b642c93e 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %_ptr_Function_v3int = OpTypePointer Function %v3int %13 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 + %14 = OpConstantNull %int %int_5 = OpConstant %int 5 - %16 = OpConstantComposite %v3int %int_0 %int_5 %int_0 + %16 = OpConstantComposite %v3int %14 %int_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3int Function %13 diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.wgsl index 3700b5723d..baeed85f13 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl index d2e0417e85..bb71e4b633 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..841bf62a9f --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +uint3 value_or_one_if_zero_uint3(uint3 value) { + return value == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : value; +} + +[numthreads(1, 1, 1)] +void f() { + uint3 a = uint3(1u, 2u, 3u); + uint3 b = uint3(0u, 5u, 0u); + const uint3 r = (a / value_or_one_if_zero_uint3((b + b))); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.spvasm index 8f37304efa..9cde60af40 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %13 = OpConstantNull %v3uint - %uint_0 = OpConstant %uint 0 + %14 = OpConstantNull %uint %uint_5 = OpConstant %uint 5 - %16 = OpConstantComposite %v3uint %uint_0 %uint_5 %uint_0 + %16 = OpConstantComposite %v3uint %14 %uint_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3uint Function %13 diff --git a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.wgsl index ab03350d49..247bd29a5c 100644 --- a/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..05f2aae5ea --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = 1.h; + var b = 0.h; + let r : f16 = a / b; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..638a7214bc --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(0.0h); + const float16_t r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ffd29e645 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(0.0h); + const float16_t r = (a / b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000247BCDC5A20(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000247BCDC5A20(3,13): error X3000: unrecognized identifier 'a' + diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..833b48f639 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t a = 1.0hf; + float16_t b = 0.0hf; + float16_t r = (a / b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..156b3e176e --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half a = 1.0h; + half b = 0.0h; + half const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..208f2ce9f9 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Function_half = OpTypePointer Function %half + %9 = OpConstantNull %half + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_half Function %9 + %b = OpVariable %_ptr_Function_half Function %9 + OpStore %a %half_0x1p_0 + OpStore %b %9 + %11 = OpLoad %half %a + %12 = OpLoad %half %b + %13 = OpFDiv %half %11 %12 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..5d179950fd --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = 1.0h; + var b = 0.0h; + let r : f16 = (a / b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl index 2084ec5d35..ed45e70fd0 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1.; var b = 0.; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..47c924ed1f --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float a = 1.0f; + float b = 0.0f; + const float r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.spvasm index b1ac052be3..4c590c2985 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,15 +16,14 @@ %float_1 = OpConstant %float 1 %_ptr_Function_float = OpTypePointer Function %float %9 = OpConstantNull %float - %float_0 = OpConstant %float 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_float Function %9 %b = OpVariable %_ptr_Function_float Function %9 OpStore %a %float_1 - OpStore %b %float_0 - %12 = OpLoad %float %a - %13 = OpLoad %float %b - %14 = OpFDiv %float %12 %13 + OpStore %b %9 + %11 = OpLoad %float %a + %12 = OpLoad %float %b + %13 = OpFDiv %float %11 %12 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.wgsl index d616f9b4e9..f0f32597f6 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1.0; var b = 0.0; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl index b693c7c17c..96bcdf1d69 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1; var b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..111cfc9df4 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + int a = 1; + int b = 0; + const int r = (a / (b == 0 ? 1 : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm index 14dcaa0d45..96e1544311 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,15 +16,14 @@ %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int %9 = OpConstantNull %int - %int_0 = OpConstant %int 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_int Function %9 %b = OpVariable %_ptr_Function_int Function %9 OpStore %a %int_1 - OpStore %b %int_0 - %12 = OpLoad %int %a - %13 = OpLoad %int %b - %14 = OpSDiv %int %12 %13 + OpStore %b %9 + %11 = OpLoad %int %a + %12 = OpLoad %int %b + %13 = OpSDiv %int %11 %12 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.wgsl index da1a3c44a9..ed24ae4a21 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1; var b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl index 7cab8cf39a..e78d08cef7 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1u; var b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..289c446b63 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + uint a = 1u; + uint b = 0u; + const uint r = (a / (b == 0u ? 1u : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.spvasm index 0519b51298..ce40e45760 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,15 +16,14 @@ %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint %9 = OpConstantNull %uint - %uint_0 = OpConstant %uint 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_uint Function %9 %b = OpVariable %_ptr_Function_uint Function %9 OpStore %a %uint_1 - OpStore %b %uint_0 - %12 = OpLoad %uint %a - %13 = OpLoad %uint %b - %14 = OpUDiv %uint %12 %13 + OpStore %b %9 + %11 = OpLoad %uint %a + %12 = OpLoad %uint %b + %13 = OpUDiv %uint %11 %12 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.wgsl index 7ac2a45d0c..8000ade357 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1u; var b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl new file mode 100644 index 0000000000..88e1716b09 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = 4.h; + var b = vec3(0.h, 2.h, 0.h); + let r : vec3 = a / b; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..08a1beeff0 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(4.0h); + vector b = vector(float16_t(0.0h), float16_t(2.0h), float16_t(0.0h)); + const vector r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77afce8367 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(4.0h); + vector b = vector(float16_t(0.0h), float16_t(2.0h), float16_t(0.0h)); + const vector r = (a / b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002AA30442DD0(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002AA30442DD0(3,13): error X3000: unrecognized identifier 'a' + diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..88e56e86f2 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t a = 4.0hf; + f16vec3 b = f16vec3(0.0hf, 2.0hf, 0.0hf); + f16vec3 r = (a / b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..92592439d8 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half a = 4.0h; + half3 b = half3(0.0h, 2.0h, 0.0h); + half3 const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcbce64619 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%_ptr_Function_half = OpTypePointer Function %half + %9 = OpConstantNull %half + %v3half = OpTypeVector %half 3 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %12 = OpConstantComposite %v3half %9 %half_0x1p_1 %9 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_half Function %9 + %b = OpVariable %_ptr_Function_v3half Function %15 + %19 = OpVariable %_ptr_Function_v3half Function %15 + OpStore %a %half_0x1p_2 + OpStore %b %12 + %16 = OpLoad %half %a + %17 = OpLoad %v3half %b + %20 = OpCompositeConstruct %v3half %16 %16 %16 + %18 = OpFDiv %v3half %20 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab787bbeb1 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = 4.0h; + var b = vec3(0.0h, 2.0h, 0.0h); + let r : vec3 = (a / b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl index 62267d4e3b..21f3a0b500 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4.; var b = vec3(0., 2., 0.); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6f9cc203c7 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float a = 4.0f; + float3 b = float3(0.0f, 2.0f, 0.0f); + const float3 r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.spvasm index a213c44c9d..fc18a9ebda 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,21 +17,20 @@ %_ptr_Function_float = OpTypePointer Function %float %9 = OpConstantNull %float %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 %float_2 = OpConstant %float 2 - %13 = OpConstantComposite %v3float %float_0 %float_2 %float_0 + %12 = OpConstantComposite %v3float %9 %float_2 %9 %_ptr_Function_v3float = OpTypePointer Function %v3float - %16 = OpConstantNull %v3float + %15 = OpConstantNull %v3float %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_float Function %9 - %b = OpVariable %_ptr_Function_v3float Function %16 - %20 = OpVariable %_ptr_Function_v3float Function %16 + %b = OpVariable %_ptr_Function_v3float Function %15 + %19 = OpVariable %_ptr_Function_v3float Function %15 OpStore %a %float_4 - OpStore %b %13 - %17 = OpLoad %float %a - %18 = OpLoad %v3float %b - %21 = OpCompositeConstruct %v3float %17 %17 %17 - %19 = OpFDiv %v3float %21 %18 + OpStore %b %12 + %16 = OpLoad %float %a + %17 = OpLoad %v3float %b + %20 = OpCompositeConstruct %v3float %16 %16 %16 + %18 = OpFDiv %v3float %20 %17 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.wgsl index 538b208d21..b41f23d323 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4.0; var b = vec3(0.0, 2.0, 0.0); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl index c2e1627e66..f2cabd4eb7 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4; var b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..24f0e8fde9 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + int a = 4; + int3 b = int3(0, 2, 0); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm index 91649665c2..34cd2cfe46 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,21 +17,20 @@ %_ptr_Function_int = OpTypePointer Function %int %9 = OpConstantNull %int %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 %int_2 = OpConstant %int 2 - %13 = OpConstantComposite %v3int %int_0 %int_2 %int_0 + %12 = OpConstantComposite %v3int %9 %int_2 %9 %_ptr_Function_v3int = OpTypePointer Function %v3int - %16 = OpConstantNull %v3int + %15 = OpConstantNull %v3int %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_int Function %9 - %b = OpVariable %_ptr_Function_v3int Function %16 - %20 = OpVariable %_ptr_Function_v3int Function %16 + %b = OpVariable %_ptr_Function_v3int Function %15 + %19 = OpVariable %_ptr_Function_v3int Function %15 OpStore %a %int_4 - OpStore %b %13 - %17 = OpLoad %int %a - %18 = OpLoad %v3int %b - %21 = OpCompositeConstruct %v3int %17 %17 %17 - %19 = OpSDiv %v3int %21 %18 + OpStore %b %12 + %16 = OpLoad %int %a + %17 = OpLoad %v3int %b + %20 = OpCompositeConstruct %v3int %16 %16 %16 + %18 = OpSDiv %v3int %20 %17 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.wgsl index c29283ed5b..d73824b692 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4; var b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl index 6810e9a61e..2af672a5ab 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4u; var b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0692d218e0 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + uint a = 4u; + uint3 b = uint3(0u, 2u, 0u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.spvasm index ce88d36b72..9f6d5d567b 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,21 +17,20 @@ %_ptr_Function_uint = OpTypePointer Function %uint %9 = OpConstantNull %uint %v3uint = OpTypeVector %uint 3 - %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 - %13 = OpConstantComposite %v3uint %uint_0 %uint_2 %uint_0 + %12 = OpConstantComposite %v3uint %9 %uint_2 %9 %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %16 = OpConstantNull %v3uint + %15 = OpConstantNull %v3uint %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_uint Function %9 - %b = OpVariable %_ptr_Function_v3uint Function %16 - %20 = OpVariable %_ptr_Function_v3uint Function %16 + %b = OpVariable %_ptr_Function_v3uint Function %15 + %19 = OpVariable %_ptr_Function_v3uint Function %15 OpStore %a %uint_4 - OpStore %b %13 - %17 = OpLoad %uint %a - %18 = OpLoad %v3uint %b - %21 = OpCompositeConstruct %v3uint %17 %17 %17 - %19 = OpUDiv %v3uint %21 %18 + OpStore %b %12 + %16 = OpLoad %uint %a + %17 = OpLoad %v3uint %b + %20 = OpCompositeConstruct %v3uint %16 %16 %16 + %18 = OpUDiv %v3uint %20 %17 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.wgsl index 286538ad2d..d1137a8cce 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4u; var b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl new file mode 100644 index 0000000000..3b36e28867 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.h, 2.h, 3.h); + var b = 0.h; + let r : vec3 = a / b; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..69e70dc29a --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + float16_t b = float16_t(0.0h); + const vector r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cf89ada284 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + float16_t b = float16_t(0.0h); + const vector r = (a / b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C9783D4180(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C9783D4180(4,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C9783D4180(4,13): error X3000: unrecognized identifier 'b' + diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..57bba7bff6 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + float16_t b = 0.0hf; + f16vec3 r = (a / b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..644bfb4442 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 a = half3(1.0h, 2.0h, 3.0h); + half b = 0.0h; + half3 const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..40338e892f --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %13 = OpConstantNull %v3half + %14 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_v3half Function %13 + %b = OpVariable %_ptr_Function_half Function %14 + %20 = OpVariable %_ptr_Function_v3half Function %13 + OpStore %a %10 + OpStore %b %14 + %17 = OpLoad %v3half %a + %18 = OpLoad %half %b + %21 = OpCompositeConstruct %v3half %18 %18 %18 + %19 = OpFDiv %v3half %17 %21 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f5c342b61e --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.0h, 2.0h, 3.0h); + var b = 0.0h; + let r : vec3 = (a / b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl index 71b747421f..21d2173ac3 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1., 2., 3.); var b = 0.; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8d9066901f --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float3 a = float3(1.0f, 2.0f, 3.0f); + float b = 0.0f; + const float3 r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.spvasm index 292b63143f..c7112421ce 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,19 +20,18 @@ %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 %_ptr_Function_v3float = OpTypePointer Function %v3float %13 = OpConstantNull %v3float - %float_0 = OpConstant %float 0 + %14 = OpConstantNull %float %_ptr_Function_float = OpTypePointer Function %float - %17 = OpConstantNull %float %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3float Function %13 - %b = OpVariable %_ptr_Function_float Function %17 - %21 = OpVariable %_ptr_Function_v3float Function %13 + %b = OpVariable %_ptr_Function_float Function %14 + %20 = OpVariable %_ptr_Function_v3float Function %13 OpStore %a %10 - OpStore %b %float_0 - %18 = OpLoad %v3float %a - %19 = OpLoad %float %b - %22 = OpCompositeConstruct %v3float %19 %19 %19 - %20 = OpFDiv %v3float %18 %22 + OpStore %b %14 + %17 = OpLoad %v3float %a + %18 = OpLoad %float %b + %21 = OpCompositeConstruct %v3float %18 %18 %18 + %19 = OpFDiv %v3float %17 %21 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.wgsl index 8caf79ea42..42d30fedd4 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1.0, 2.0, 3.0); var b = 0.0; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl index 27fea3220c..75167b3bb9 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f87f70de4 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + int3 a = int3(1, 2, 3); + int b = 0; + const int3 r = (a / (b == 0 ? 1 : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm index 35ceb4ac6c..88da03782c 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,19 +20,18 @@ %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %_ptr_Function_v3int = OpTypePointer Function %v3int %13 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 + %14 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %17 = OpConstantNull %int %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3int Function %13 - %b = OpVariable %_ptr_Function_int Function %17 - %21 = OpVariable %_ptr_Function_v3int Function %13 + %b = OpVariable %_ptr_Function_int Function %14 + %20 = OpVariable %_ptr_Function_v3int Function %13 OpStore %a %10 - OpStore %b %int_0 - %18 = OpLoad %v3int %a - %19 = OpLoad %int %b - %22 = OpCompositeConstruct %v3int %19 %19 %19 - %20 = OpSDiv %v3int %18 %22 + OpStore %b %14 + %17 = OpLoad %v3int %a + %18 = OpLoad %int %b + %21 = OpCompositeConstruct %v3int %18 %18 %18 + %19 = OpSDiv %v3int %17 %21 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.wgsl index f11c30ed51..2a49d07371 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = 0; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl index ea02f5cb5b..11c34c3f10 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..012cb29b31 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + uint3 a = uint3(1u, 2u, 3u); + uint b = 0u; + const uint3 r = (a / (b == 0u ? 1u : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.spvasm index d04ce1e691..759be2a7bc 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,19 +20,18 @@ %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %13 = OpConstantNull %v3uint - %uint_0 = OpConstant %uint 0 + %14 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3uint Function %13 - %b = OpVariable %_ptr_Function_uint Function %17 - %21 = OpVariable %_ptr_Function_v3uint Function %13 + %b = OpVariable %_ptr_Function_uint Function %14 + %20 = OpVariable %_ptr_Function_v3uint Function %13 OpStore %a %10 - OpStore %b %uint_0 - %18 = OpLoad %v3uint %a - %19 = OpLoad %uint %b - %22 = OpCompositeConstruct %v3uint %19 %19 %19 - %20 = OpUDiv %v3uint %18 %22 + OpStore %b %14 + %17 = OpLoad %v3uint %a + %18 = OpLoad %uint %b + %21 = OpCompositeConstruct %v3uint %18 %18 %18 + %19 = OpUDiv %v3uint %17 %21 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.wgsl index 0154b03910..79a08bc795 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = 0u; diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..aa95136b53 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.h, 2.h, 3.h); + var b = vec3(0.h, 5.h, 0.h); + let r : vec3 = a / b; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..15f5b157b8 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..37c2fbf52f --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a / b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001D90BA93590(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001D90BA93590(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001D90BA93590(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..cc52a027ec --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(0.0hf, 5.0hf, 0.0hf); + f16vec3 r = (a / b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..9d6798d41d --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 a = half3(1.0h, 2.0h, 3.0h); + half3 b = half3(0.0h, 5.0h, 0.0h); + half3 const r = (a / b); + return; +} + diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..d3f53f6f64 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %13 = OpConstantNull %v3half + %14 = OpConstantNull %half +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %16 = OpConstantComposite %v3half %14 %half_0x1_4p_2 %14 + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_v3half Function %13 + %b = OpVariable %_ptr_Function_v3half Function %13 + OpStore %a %10 + OpStore %b %16 + %18 = OpLoad %v3half %a + %19 = OpLoad %v3half %b + %20 = OpFDiv %v3half %18 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..e724f5c020 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.0h, 2.0h, 3.0h); + var b = vec3(0.0h, 5.0h, 0.0h); + let r : vec3 = (a / b); +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl index fdcbb747c1..a7ab819d4c 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1., 2., 3.); var b = vec3(0., 5., 0.); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ed2f85934 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float3 a = float3(1.0f, 2.0f, 3.0f); + float3 b = float3(0.0f, 5.0f, 0.0f); + const float3 r = (a / b); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.spvasm index f5b1805818..ade4c78992 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 %_ptr_Function_v3float = OpTypePointer Function %v3float %13 = OpConstantNull %v3float - %float_0 = OpConstant %float 0 + %14 = OpConstantNull %float %float_5 = OpConstant %float 5 - %16 = OpConstantComposite %v3float %float_0 %float_5 %float_0 + %16 = OpConstantComposite %v3float %14 %float_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3float Function %13 diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.wgsl index d37119ad20..35a6ea9184 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1.0, 2.0, 3.0); var b = vec3(0.0, 5.0, 0.0); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl index bb4bda306e..ca2fa9890f 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3e1ba7ffa9 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + int3 a = int3(1, 2, 3); + int3 b = int3(0, 5, 0); + const int3 r = (a / (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm index 56479101ba..575bfe6acc 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %_ptr_Function_v3int = OpTypePointer Function %v3int %13 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 + %14 = OpConstantNull %int %int_5 = OpConstant %int 5 - %16 = OpConstantComposite %v3int %int_0 %int_5 %int_0 + %16 = OpConstantComposite %v3int %14 %int_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3int Function %13 diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.wgsl index 17e72b3430..42f945beb4 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl index 26097c9692..ef07fe2b31 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5f022e4092 --- /dev/null +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + uint3 a = uint3(1u, 2u, 3u); + uint3 b = uint3(0u, 5u, 0u); + const uint3 r = (a / (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.spvasm index aba2a2b931..033612735b 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %13 = OpConstantNull %v3uint - %uint_0 = OpConstant %uint 0 + %14 = OpConstantNull %uint %uint_5 = OpConstant %uint 5 - %16 = OpConstantComposite %v3uint %uint_0 %uint_5 %uint_0 + %16 = OpConstantComposite %v3uint %14 %uint_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3uint Function %13 diff --git a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.wgsl index f2206eec05..8cae1a4148 100644 --- a/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/div_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl index 1779cb0b24..9798d4a7c5 100644 --- a/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2u; diff --git a/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b54fe4a73 --- /dev/null +++ b/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 << 2u); + return; +} diff --git a/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.wgsl index 69143dd6df..4339485357 100644 --- a/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/left-shift/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2u; diff --git a/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl index 9638b83037..05ea9539c9 100644 --- a/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3195ab7638 --- /dev/null +++ b/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u << 2u); + return; +} diff --git a/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.wgsl index 39595c9ec0..19d9671519 100644 --- a/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/left-shift/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl b/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl index fd21fb4abb..268f0a01e8 100644 --- a/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl +++ b/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d43dfb6f80 --- /dev/null +++ b/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const uint3 b = uint3(4u, 5u, 6u); + const int3 r = (a << b); + return; +} diff --git a/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.wgsl index 43d4d00a1f..f062d946ce 100644 --- a/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/left-shift/vector-vector/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl b/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl index 7e0db01dcb..903a83c088 100644 --- a/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl +++ b/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2de16f0c9b --- /dev/null +++ b/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a << b); + return; +} diff --git a/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.wgsl index 12a5cde094..12bd7b82be 100644 --- a/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/left-shift/vector-vector/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..e2a3e21456 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 1.h; + let b = 2.h; + let r : f16 = a % b; +} diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7956edf23f --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) % float16_t(2.0h)); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b7fbe467b5 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) % float16_t(2.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023722D34110(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..13400ac6eb --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_float_modulo(float16_t lhs, float16_t rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + float16_t r = tint_float_modulo(1.0hf, 2.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..b163fed163 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 1.0h; + half const b = 2.0h; + half const r = fmod(a, b); + return; +} + diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..043435114a --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %f = OpFunction %void None %1 + %4 = OpLabel + %8 = OpFRem %half %half_0x1p_0 %half_0x1p_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..25246e4c13 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 1.0h; + let b = 2.0h; + let r : f16 = (a % b); +} diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl index 20513e7770..1988f9d763 100644 --- a/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.; let b = 2.; diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d9e671ccd --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float r = (1.0f % 2.0f); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.wgsl index eebb252da0..5a085a412d 100644 --- a/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.0; let b = 2.0; diff --git a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl index 12a7c72d9c..eac3d53130 100644 --- a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9088e51d9f --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 % 2); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.wgsl index 549140ec4d..1b9c716cc4 100644 --- a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl index 96042bd249..6102f347ad 100644 --- a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5e11c531a --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u % 2u); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.wgsl index d3835edd12..793dded342 100644 --- a/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl new file mode 100644 index 0000000000..efa88e0227 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 4.h; + let b = vec3(1.h, 2.h, 3.h); + let r : vec3 = a % b; +} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5b7fdbe997 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c4f7b003a --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a % b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002545B962860(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..6a6041d5ef --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_float_modulo(float16_t lhs, f16vec3 rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + float16_t a = 4.0hf; + f16vec3 b = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = tint_float_modulo(a, b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..eac108b293 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 4.0h; + half3 const b = half3(1.0h, 2.0h, 3.0h); + half3 const r = fmod(a, b); + return; +} + diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b2b5546c1 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %13 = OpVariable %_ptr_Function_v3half Function %15 + %16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2 + %12 = OpFRem %v3half %16 %11 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c17c3a7d3d --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 4.0h; + let b = vec3(1.0h, 2.0h, 3.0h); + let r : vec3 = (a % b); +} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl b/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl index 55a3accb00..f8ffb239f7 100644 --- a/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl +++ b/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.; let b = vec3(1., 2., 3.); diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b2653df18a --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float a = 4.0f; + const float3 b = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.wgsl index 7bfc341cc4..25b0d9b6aa 100644 --- a/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/scalar-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.0; let b = vec3(1.0, 2.0, 3.0); diff --git a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl index 9e874a51a3..051d509593 100644 --- a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..847b0fbbe2 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(1, 2, 3); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..847b0fbbe2 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(1, 2, 3); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.hlsl deleted file mode 100644 index 5b0bfcaf8f..0000000000 --- a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int a = 4; - const int3 b = int3(1, 2, 3); - const int3 r = (a % b); - return; -} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.wgsl index 6b76bbbd91..d0ba74fa12 100644 --- a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl index e4d45cab8b..879c95c057 100644 --- a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..396d57a875 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(1u, 2u, 3u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..396d57a875 --- /dev/null +++ b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(1u, 2u, 3u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.hlsl deleted file mode 100644 index 97533fbd9d..0000000000 --- a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint a = 4u; - const uint3 b = uint3(1u, 2u, 3u); - const uint3 r = (a % b); - return; -} diff --git a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.wgsl index 309c295d3b..180e6e19e9 100644 --- a/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl new file mode 100644 index 0000000000..4aff68f3b4 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = 4.h; + let r : vec3 = a % b; +} diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2c8708a052 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a % float16_t(4.0h)); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c6bb49b0b --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a % float16_t(4.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000018D97903680(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000018D97903680(4,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..79d21f10c8 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_float_modulo(f16vec3 lhs, float16_t rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = tint_float_modulo(a, 4.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..ca7a6be3f6 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half const b = 4.0h; + half3 const r = fmod(a, b); + return; +} + diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..d1f5fcca5f --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %13 = OpVariable %_ptr_Function_v3half Function %15 + %16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2 + %12 = OpFRem %v3half %10 %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..99d24666e8 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = 4.0h; + let r : vec3 = (a % b); +} diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl b/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl index 7a9cd13e14..30586c46e7 100644 --- a/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl +++ b/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = 4.; diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3aca50d29f --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a % 4.0f); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.wgsl index 31c0bbd3c1..e8cfd804df 100644 --- a/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/vec3-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = 4.0; diff --git a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl index e06a539b82..3c223e7169 100644 --- a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1abee48ed0 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 r = (a % 4); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.wgsl index afa5ad72d2..6b8644ee19 100644 --- a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl index af3a204bce..57a94c5636 100644 --- a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2d051d102 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 r = (a % 4u); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.wgsl index 3c97f77b6c..3f59fa11d6 100644 --- a/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..9ed638f64f --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = vec3(4.h, 5.h, 6.h); + let r : vec3 = a % b; +} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..69def7917c --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af5b04dd04 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a % b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C9BEF22740(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C9BEF22740(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C9BEF22740(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f7a8132950 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_float_modulo(f16vec3 lhs, f16vec3 rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(4.0hf, 5.0hf, 6.0hf); + f16vec3 r = tint_float_modulo(a, b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..df3f2dbfb2 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half3 const b = half3(4.0h, 5.0h, 6.0h); + half3 const r = fmod(a, b); + return; +} + diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..aac78aabb7 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %14 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 + %f = OpFunction %void None %1 + %4 = OpLabel + %15 = OpFRem %v3half %10 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8abcd10ca --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = vec3(4.0h, 5.0h, 6.0h); + let r : vec3 = (a % b); +} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl index 815fb66077..7b228609a9 100644 --- a/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = vec3(4., 5., 6.); diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87e4dd4a72 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 b = float3(4.0f, 5.0f, 6.0f); + const float3 r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.wgsl index d37c9d959d..abb9bd1de9 100644 --- a/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = vec3(4.0, 5.0, 6.0); diff --git a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl index 55bfa49eb5..39c41ea603 100644 --- a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..86d89a53e5 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..86d89a53e5 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.hlsl deleted file mode 100644 index f39516d1d0..0000000000 --- a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int3 a = int3(1, 2, 3); - const int3 b = int3(4, 5, 6); - const int3 r = (a % b); - return; -} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.wgsl index 17693869af..b3877c7a77 100644 --- a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl index 02f1eeaf66..7ecdd67934 100644 --- a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5d234b8432 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5d234b8432 --- /dev/null +++ b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.hlsl deleted file mode 100644 index 33e6b962e6..0000000000 --- a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint3 a = uint3(1u, 2u, 3u); - const uint3 b = uint3(4u, 5u, 6u); - const uint3 r = (a % b); - return; -} diff --git a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.wgsl index 36fa71e020..198cfaf129 100644 --- a/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..123a345a68 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 1.h; + let b = 0.h; + let r : f16 = a % b; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..76596316d7 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) % float16_t(0.0h)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13b7899b6e --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) % float16_t(0.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002639CD34EB0(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..674512d4b2 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_float_modulo(float16_t lhs, float16_t rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + float16_t r = tint_float_modulo(1.0hf, 0.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..f00d1bb249 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 1.0h; + half const b = 0.0h; + half const r = fmod(a, b); + return; +} + diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e95305c57 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %7 = OpConstantNull %half + %f = OpFunction %void None %1 + %4 = OpLabel + %8 = OpFRem %half %half_0x1p_0 %7 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..097197306b --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 1.0h; + let b = 0.0h; + let r : f16 = (a % b); +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl index 6d014b8a38..a4e2a3fcda 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.; let b = 0.; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d3de7dbaa6 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float r = (1.0f % 0.0f); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.spvasm index 71bf9df9b6..8931a70cc5 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.spvasm @@ -12,9 +12,9 @@ %1 = OpTypeFunction %void %float = OpTypeFloat 32 %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 + %7 = OpConstantNull %float %f = OpFunction %void None %1 %4 = OpLabel - %8 = OpFRem %float %float_1 %float_0 + %8 = OpFRem %float %float_1 %7 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.wgsl index 542a2e7420..26f004c0a4 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.0; let b = 0.0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl index 4c05b0ea38..bf5c46c3bb 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b79aad9396 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 % 1); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm index 37536a116e..bf9393fa49 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm @@ -12,9 +12,9 @@ %1 = OpTypeFunction %void %int = OpTypeInt 32 1 %int_1 = OpConstant %int 1 - %int_0 = OpConstant %int 0 + %7 = OpConstantNull %int %f = OpFunction %void None %1 %4 = OpLabel - %8 = OpSMod %int %int_1 %int_0 + %8 = OpSMod %int %int_1 %7 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.wgsl index e63b37dfa1..fd3cc284a3 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl index a63ca8fb1b..dc8e4d5bc6 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..241c5f5c2b --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u % 1u); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.spvasm index e59fd6eae8..94d22635b1 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.spvasm @@ -12,9 +12,9 @@ %1 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 - %uint_0 = OpConstant %uint 0 + %7 = OpConstantNull %uint %f = OpFunction %void None %1 %4 = OpLabel - %8 = OpUMod %uint %uint_1 %uint_0 + %8 = OpUMod %uint %uint_1 %7 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.wgsl index 02a078b252..58946be617 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl index b319205019..f48f0b4d46 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dfe722c849 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(0, 2, 0); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dfe722c849 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(0, 2, 0); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl deleted file mode 100644 index fa4482f682..0000000000 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int a = 4; - const int3 b = int3(0, 2, 0); - const int3 r = (a % int3(1, 2, 1)); - return; -} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm index dc1cd0582c..65d27ce133 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm @@ -13,9 +13,9 @@ %int = OpTypeInt 32 1 %int_4 = OpConstant %int 4 %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 + %8 = OpConstantNull %int %int_2 = OpConstant %int 2 - %10 = OpConstantComposite %v3int %int_0 %int_2 %int_0 + %10 = OpConstantComposite %v3int %8 %int_2 %8 %_ptr_Function_v3int = OpTypePointer Function %v3int %14 = OpConstantNull %v3int %f = OpFunction %void None %1 diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.wgsl index 5b99aeabe9..7b02ef6f37 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl index 94494c3d78..9ec296c5b0 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5583772270 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(0u, 2u, 0u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5583772270 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(0u, 2u, 0u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl deleted file mode 100644 index 12aa8c01ee..0000000000 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint a = 4u; - const uint3 b = uint3(0u, 2u, 0u); - const uint3 r = (a % uint3(1u, 2u, 1u)); - return; -} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.spvasm index 019876b5ff..03b04093aa 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.spvasm @@ -13,9 +13,9 @@ %uint = OpTypeInt 32 0 %uint_4 = OpConstant %uint 4 %v3uint = OpTypeVector %uint 3 - %uint_0 = OpConstant %uint 0 + %8 = OpConstantNull %uint %uint_2 = OpConstant %uint 2 - %10 = OpConstantComposite %v3uint %uint_0 %uint_2 %uint_0 + %10 = OpConstantComposite %v3uint %8 %uint_2 %8 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %14 = OpConstantNull %v3uint %f = OpFunction %void None %1 diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.wgsl index 0aca8c0a0e..1056273ff5 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl index 0a0f4d4fdd..d99c708aa4 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6906266038 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 r = (a % 1); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm index ac1f1d7a1b..64592c9d9b 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm @@ -16,13 +16,13 @@ %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %int_0 = OpConstant %int 0 + %11 = OpConstantNull %int %_ptr_Function_v3int = OpTypePointer Function %v3int %15 = OpConstantNull %v3int %f = OpFunction %void None %1 %4 = OpLabel %13 = OpVariable %_ptr_Function_v3int Function %15 - %16 = OpCompositeConstruct %v3int %int_0 %int_0 %int_0 + %16 = OpCompositeConstruct %v3int %11 %11 %11 %12 = OpSMod %v3int %10 %16 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.wgsl index 8cc8abe910..8dcffb772e 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl index 796e15f8dc..b03befca33 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d8b0b4eef --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 r = (a % 1u); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.spvasm index b8ce74fa9c..79e64e8ae9 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.spvasm @@ -16,13 +16,13 @@ %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 - %uint_0 = OpConstant %uint 0 + %11 = OpConstantNull %uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint %15 = OpConstantNull %v3uint %f = OpFunction %void None %1 %4 = OpLabel %13 = OpVariable %_ptr_Function_v3uint Function %15 - %16 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %uint_0 + %16 = OpCompositeConstruct %v3uint %11 %11 %11 %12 = OpUMod %v3uint %10 %16 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.wgsl index 98c4523b2d..f75f0cd271 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..c5074b64a0 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = vec3(0.h, 5.h, 0.h); + let r : vec3 = a % b; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8c6cb4ca24 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7ff795b8d5 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a % b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000014E5DAA6DB0(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000014E5DAA6DB0(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000014E5DAA6DB0(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..ca050558d7 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_float_modulo(f16vec3 lhs, f16vec3 rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(0.0hf, 5.0hf, 0.0hf); + f16vec3 r = tint_float_modulo(a, b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..ab415f64d9 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half3 const b = half3(0.0h, 5.0h, 0.0h); + half3 const r = fmod(a, b); + return; +} + diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..80dd8d0119 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 + %11 = OpConstantNull %half +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %13 = OpConstantComposite %v3half %11 %half_0x1_4p_2 %11 + %f = OpFunction %void None %1 + %4 = OpLabel + %14 = OpFRem %v3half %10 %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..65ee468457 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = vec3(0.0h, 5.0h, 0.0h); + let r : vec3 = (a % b); +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl index 64fc4d5dfa..b420076284 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = vec3(0., 5., 0.); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ea2fbd98f --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 b = float3(0.0f, 5.0f, 0.0f); + const float3 r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.spvasm index 6f5c42785e..cfb714d1e8 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.spvasm @@ -16,9 +16,9 @@ %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 - %float_0 = OpConstant %float 0 + %11 = OpConstantNull %float %float_5 = OpConstant %float 5 - %13 = OpConstantComposite %v3float %float_0 %float_5 %float_0 + %13 = OpConstantComposite %v3float %11 %float_5 %11 %f = OpFunction %void None %1 %4 = OpLabel %14 = OpFRem %v3float %10 %13 diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.wgsl index 227a070b13..9bd9c985cc 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = vec3(0.0, 5.0, 0.0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl index 9e64d49d33..63144cd563 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ce3cfcaaaa --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(0, 5, 0); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ce3cfcaaaa --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(0, 5, 0); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl deleted file mode 100644 index ee6067476a..0000000000 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int3 a = int3(1, 2, 3); - const int3 b = int3(0, 5, 0); - const int3 r = (a % int3(1, 5, 1)); - return; -} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm index 5205a1957c..64e929a48d 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm @@ -16,9 +16,9 @@ %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %int_0 = OpConstant %int 0 + %11 = OpConstantNull %int %int_5 = OpConstant %int 5 - %13 = OpConstantComposite %v3int %int_0 %int_5 %int_0 + %13 = OpConstantComposite %v3int %11 %int_5 %11 %f = OpFunction %void None %1 %4 = OpLabel %14 = OpSMod %v3int %10 %13 diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.wgsl index b6fc8c0a3e..a5a8a27f8e 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl index 6724d92d86..a4d1eed0c1 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef3ed4541b --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(0u, 5u, 0u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ef3ed4541b --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(0u, 5u, 0u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl deleted file mode 100644 index 2389839626..0000000000 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint3 a = uint3(1u, 2u, 3u); - const uint3 b = uint3(0u, 5u, 0u); - const uint3 r = (a % uint3(1u, 5u, 1u)); - return; -} diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.spvasm index f1fa32537a..1dd5605b1a 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.spvasm @@ -16,9 +16,9 @@ %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 - %uint_0 = OpConstant %uint 0 + %11 = OpConstantNull %uint %uint_5 = OpConstant %uint 5 - %13 = OpConstantComposite %v3uint %uint_0 %uint_5 %uint_0 + %13 = OpConstantComposite %v3uint %11 %uint_5 %11 %f = OpFunction %void None %1 %4 = OpLabel %14 = OpUMod %v3uint %10 %13 diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.wgsl index 24d48be0f4..42e75d86af 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..5ae5292eab --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = 1.h; + var b = 0.h; + let r : f16 = a % (b + b); +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9dd48b3282 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(0.0h); + const float16_t r = (a % (b + b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d529595abc --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(0.0h); + const float16_t r = (a % (b + b)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000290AE802EA0(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000290AE802EA0(3,13): error X3000: unrecognized identifier 'a' + diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..2c77e53701 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_float_modulo(float16_t lhs, float16_t rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + float16_t a = 1.0hf; + float16_t b = 0.0hf; + float16_t r = tint_float_modulo(a, (b + b)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..431e1599e3 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half a = 1.0h; + half b = 0.0h; + half const r = fmod(a, (b + b)); + return; +} + diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b3c8126afa --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Function_half = OpTypePointer Function %half + %9 = OpConstantNull %half + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_half Function %9 + %b = OpVariable %_ptr_Function_half Function %9 + OpStore %a %half_0x1p_0 + OpStore %b %9 + %11 = OpLoad %half %a + %12 = OpLoad %half %b + %13 = OpLoad %half %b + %14 = OpFAdd %half %12 %13 + %15 = OpFRem %half %11 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..5c2497d49b --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = 1.0h; + var b = 0.0h; + let r : f16 = (a % (b + b)); +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl index 820231bc7c..0f6e3e42ff 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1.; var b = 0.; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..468c33d586 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float a = 1.0f; + float b = 0.0f; + const float r = (a % (b + b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.spvasm index 33268b0b64..02c2aa5ae1 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,17 +16,16 @@ %float_1 = OpConstant %float 1 %_ptr_Function_float = OpTypePointer Function %float %9 = OpConstantNull %float - %float_0 = OpConstant %float 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_float Function %9 %b = OpVariable %_ptr_Function_float Function %9 OpStore %a %float_1 - OpStore %b %float_0 - %12 = OpLoad %float %a + OpStore %b %9 + %11 = OpLoad %float %a + %12 = OpLoad %float %b %13 = OpLoad %float %b - %14 = OpLoad %float %b - %15 = OpFAdd %float %13 %14 - %16 = OpFRem %float %12 %15 + %14 = OpFAdd %float %12 %13 + %15 = OpFRem %float %11 %14 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.wgsl index 019d543f00..a52447eb62 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1.0; var b = 0.0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl index 949d0fe8a1..9489c9a877 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1; var b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fd4f932ff7 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +int value_or_one_if_zero_int(int value) { + return value == 0 ? 1 : value; +} + +[numthreads(1, 1, 1)] +void f() { + int a = 1; + int b = 0; + const int r = (a % value_or_one_if_zero_int((b + b))); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm index a37441fe4d..fac854f6d1 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,17 +16,16 @@ %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int %9 = OpConstantNull %int - %int_0 = OpConstant %int 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_int Function %9 %b = OpVariable %_ptr_Function_int Function %9 OpStore %a %int_1 - OpStore %b %int_0 - %12 = OpLoad %int %a + OpStore %b %9 + %11 = OpLoad %int %a + %12 = OpLoad %int %b %13 = OpLoad %int %b - %14 = OpLoad %int %b - %15 = OpIAdd %int %13 %14 - %16 = OpSMod %int %12 %15 + %14 = OpIAdd %int %12 %13 + %15 = OpSMod %int %11 %14 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.wgsl index 74888f2ec0..d626886f93 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1; var b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl index caf8b51ac0..d1d8910159 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1u; var b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f8f7511f41 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +uint value_or_one_if_zero_uint(uint value) { + return value == 0u ? 1u : value; +} + +[numthreads(1, 1, 1)] +void f() { + uint a = 1u; + uint b = 0u; + const uint r = (a % value_or_one_if_zero_uint((b + b))); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.spvasm index ae27d46639..ca8d7a50ef 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,17 +16,16 @@ %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint %9 = OpConstantNull %uint - %uint_0 = OpConstant %uint 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_uint Function %9 %b = OpVariable %_ptr_Function_uint Function %9 OpStore %a %uint_1 - OpStore %b %uint_0 - %12 = OpLoad %uint %a + OpStore %b %9 + %11 = OpLoad %uint %a + %12 = OpLoad %uint %b %13 = OpLoad %uint %b - %14 = OpLoad %uint %b - %15 = OpIAdd %uint %13 %14 - %16 = OpUMod %uint %12 %15 + %14 = OpIAdd %uint %12 %13 + %15 = OpUMod %uint %11 %14 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.wgsl index a75275dcfc..1a4bb6e307 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1u; var b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl index d3415885a3..052a71133c 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4; var b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8e8a7d0533 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +int3 value_or_one_if_zero_int3(int3 value) { + return value == int3(0, 0, 0) ? int3(1, 1, 1) : value; +} + +[numthreads(1, 1, 1)] +void f() { + int a = 4; + int3 b = int3(0, 2, 0); + const int3 r = (a % value_or_one_if_zero_int3((b + b))); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm index b293226629..a4acd729a8 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,23 +17,22 @@ %_ptr_Function_int = OpTypePointer Function %int %9 = OpConstantNull %int %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 %int_2 = OpConstant %int 2 - %13 = OpConstantComposite %v3int %int_0 %int_2 %int_0 + %12 = OpConstantComposite %v3int %9 %int_2 %9 %_ptr_Function_v3int = OpTypePointer Function %v3int - %16 = OpConstantNull %v3int + %15 = OpConstantNull %v3int %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_int Function %9 - %b = OpVariable %_ptr_Function_v3int Function %16 - %22 = OpVariable %_ptr_Function_v3int Function %16 + %b = OpVariable %_ptr_Function_v3int Function %15 + %21 = OpVariable %_ptr_Function_v3int Function %15 OpStore %a %int_4 - OpStore %b %13 - %17 = OpLoad %int %a + OpStore %b %12 + %16 = OpLoad %int %a + %17 = OpLoad %v3int %b %18 = OpLoad %v3int %b - %19 = OpLoad %v3int %b - %20 = OpIAdd %v3int %18 %19 - %23 = OpCompositeConstruct %v3int %17 %17 %17 - %21 = OpSMod %v3int %23 %20 + %19 = OpIAdd %v3int %17 %18 + %22 = OpCompositeConstruct %v3int %16 %16 %16 + %20 = OpSMod %v3int %22 %19 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.wgsl index 1cff64c91a..226235f6bf 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4; var b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl index bbe0ada976..028da4a024 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4u; var b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2330363261 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +uint3 value_or_one_if_zero_uint3(uint3 value) { + return value == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : value; +} + +[numthreads(1, 1, 1)] +void f() { + uint a = 4u; + uint3 b = uint3(0u, 2u, 0u); + const uint3 r = (a % value_or_one_if_zero_uint3((b + b))); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.spvasm index ee0be7a97d..296cc5c0a8 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,23 +17,22 @@ %_ptr_Function_uint = OpTypePointer Function %uint %9 = OpConstantNull %uint %v3uint = OpTypeVector %uint 3 - %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 - %13 = OpConstantComposite %v3uint %uint_0 %uint_2 %uint_0 + %12 = OpConstantComposite %v3uint %9 %uint_2 %9 %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %16 = OpConstantNull %v3uint + %15 = OpConstantNull %v3uint %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_uint Function %9 - %b = OpVariable %_ptr_Function_v3uint Function %16 - %22 = OpVariable %_ptr_Function_v3uint Function %16 + %b = OpVariable %_ptr_Function_v3uint Function %15 + %21 = OpVariable %_ptr_Function_v3uint Function %15 OpStore %a %uint_4 - OpStore %b %13 - %17 = OpLoad %uint %a + OpStore %b %12 + %16 = OpLoad %uint %a + %17 = OpLoad %v3uint %b %18 = OpLoad %v3uint %b - %19 = OpLoad %v3uint %b - %20 = OpIAdd %v3uint %18 %19 - %23 = OpCompositeConstruct %v3uint %17 %17 %17 - %21 = OpUMod %v3uint %23 %20 + %19 = OpIAdd %v3uint %17 %18 + %22 = OpCompositeConstruct %v3uint %16 %16 %16 + %20 = OpUMod %v3uint %22 %19 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.wgsl index c292b7baf6..3ad73087f1 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4u; var b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl index 732dff413b..26792f79f3 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ea6b4cbb42 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +int value_or_one_if_zero_int(int value) { + return value == 0 ? 1 : value; +} + +[numthreads(1, 1, 1)] +void f() { + int3 a = int3(1, 2, 3); + int b = 0; + const int3 r = (a % value_or_one_if_zero_int((b + b))); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm index d9dd3f1a99..1b579c4a1e 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,21 +20,20 @@ %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %_ptr_Function_v3int = OpTypePointer Function %v3int %13 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 + %14 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %17 = OpConstantNull %int %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3int Function %13 - %b = OpVariable %_ptr_Function_int Function %17 - %23 = OpVariable %_ptr_Function_v3int Function %13 + %b = OpVariable %_ptr_Function_int Function %14 + %22 = OpVariable %_ptr_Function_v3int Function %13 OpStore %a %10 - OpStore %b %int_0 - %18 = OpLoad %v3int %a + OpStore %b %14 + %17 = OpLoad %v3int %a + %18 = OpLoad %int %b %19 = OpLoad %int %b - %20 = OpLoad %int %b - %21 = OpIAdd %int %19 %20 - %24 = OpCompositeConstruct %v3int %21 %21 %21 - %22 = OpSMod %v3int %18 %24 + %20 = OpIAdd %int %18 %19 + %23 = OpCompositeConstruct %v3int %20 %20 %20 + %21 = OpSMod %v3int %17 %23 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.wgsl index 0aaa1a256a..f5cc2da922 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl index 87c0466968..4456979b15 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dca1662c8d --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +uint value_or_one_if_zero_uint(uint value) { + return value == 0u ? 1u : value; +} + +[numthreads(1, 1, 1)] +void f() { + uint3 a = uint3(1u, 2u, 3u); + uint b = 0u; + const uint3 r = (a % value_or_one_if_zero_uint((b + b))); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.spvasm index 78e1a7eb2e..4676fea349 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,21 +20,20 @@ %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %13 = OpConstantNull %v3uint - %uint_0 = OpConstant %uint 0 + %14 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3uint Function %13 - %b = OpVariable %_ptr_Function_uint Function %17 - %23 = OpVariable %_ptr_Function_v3uint Function %13 + %b = OpVariable %_ptr_Function_uint Function %14 + %22 = OpVariable %_ptr_Function_v3uint Function %13 OpStore %a %10 - OpStore %b %uint_0 - %18 = OpLoad %v3uint %a + OpStore %b %14 + %17 = OpLoad %v3uint %a + %18 = OpLoad %uint %b %19 = OpLoad %uint %b - %20 = OpLoad %uint %b - %21 = OpIAdd %uint %19 %20 - %24 = OpCompositeConstruct %v3uint %21 %21 %21 - %22 = OpUMod %v3uint %18 %24 + %20 = OpIAdd %uint %18 %19 + %23 = OpCompositeConstruct %v3uint %20 %20 %20 + %21 = OpUMod %v3uint %17 %23 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.wgsl index 9433a5a0c9..c8ca7501d4 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..f49e5579af --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.h, 2.h, 3.h); + var b = vec3(0.h, 5.h, 0.h); + let r : vec3 = a % (b + b); +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f75bb382c --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a % (b + b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f78abeac48 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a % (b + b)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C6CF8C3C20(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C6CF8C3C20(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C6CF8C3C20(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..20a4516bf6 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_float_modulo(f16vec3 lhs, f16vec3 rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(0.0hf, 5.0hf, 0.0hf); + f16vec3 r = tint_float_modulo(a, (b + b)); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..8f29db77ca --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 a = half3(1.0h, 2.0h, 3.0h); + half3 b = half3(0.0h, 5.0h, 0.0h); + half3 const r = fmod(a, (b + b)); + return; +} + diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..58aa1b1656 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %13 = OpConstantNull %v3half + %14 = OpConstantNull %half +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %16 = OpConstantComposite %v3half %14 %half_0x1_4p_2 %14 + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_v3half Function %13 + %b = OpVariable %_ptr_Function_v3half Function %13 + OpStore %a %10 + OpStore %b %16 + %18 = OpLoad %v3half %a + %19 = OpLoad %v3half %b + %20 = OpLoad %v3half %b + %21 = OpFAdd %v3half %19 %20 + %22 = OpFRem %v3half %18 %21 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..9774c7ab61 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.0h, 2.0h, 3.0h); + var b = vec3(0.0h, 5.0h, 0.0h); + let r : vec3 = (a % (b + b)); +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl index 6a67f5463e..e060e571af 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1., 2., 3.); var b = vec3(0., 5., 0.); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8d2155076d --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float3 a = float3(1.0f, 2.0f, 3.0f); + float3 b = float3(0.0f, 5.0f, 0.0f); + const float3 r = (a % (b + b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.spvasm index fb8ce28375..f8ef6f39dd 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 %_ptr_Function_v3float = OpTypePointer Function %v3float %13 = OpConstantNull %v3float - %float_0 = OpConstant %float 0 + %14 = OpConstantNull %float %float_5 = OpConstant %float 5 - %16 = OpConstantComposite %v3float %float_0 %float_5 %float_0 + %16 = OpConstantComposite %v3float %14 %float_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3float Function %13 diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.wgsl index 965767fa89..512708fdd2 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1.0, 2.0, 3.0); var b = vec3(0.0, 5.0, 0.0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl index 6996804f7e..60f69ff9fa 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f33a43d8ef --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +int3 value_or_one_if_zero_int3(int3 value) { + return value == int3(0, 0, 0) ? int3(1, 1, 1) : value; +} + +[numthreads(1, 1, 1)] +void f() { + int3 a = int3(1, 2, 3); + int3 b = int3(0, 5, 0); + const int3 r = (a % value_or_one_if_zero_int3((b + b))); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm index b96d65ac92..0a116e033e 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %_ptr_Function_v3int = OpTypePointer Function %v3int %13 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 + %14 = OpConstantNull %int %int_5 = OpConstant %int 5 - %16 = OpConstantComposite %v3int %int_0 %int_5 %int_0 + %16 = OpConstantComposite %v3int %14 %int_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3int Function %13 diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.wgsl index b327a60b91..1aad41efc1 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl index 769ce16204..9dc5c6cb6f 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f112cf8458 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +uint3 value_or_one_if_zero_uint3(uint3 value) { + return value == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : value; +} + +[numthreads(1, 1, 1)] +void f() { + uint3 a = uint3(1u, 2u, 3u); + uint3 b = uint3(0u, 5u, 0u); + const uint3 r = (a % value_or_one_if_zero_uint3((b + b))); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.spvasm index c4b1f903c6..92c17181c7 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %13 = OpConstantNull %v3uint - %uint_0 = OpConstant %uint 0 + %14 = OpConstantNull %uint %uint_5 = OpConstant %uint 5 - %16 = OpConstantComposite %v3uint %uint_0 %uint_5 %uint_0 + %16 = OpConstantComposite %v3uint %14 %uint_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3uint Function %13 diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.wgsl index cdc78486af..822cec2c6a 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..0c4f7f2426 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = 1.h; + var b = 0.h; + let r : f16 = a % b; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18770f0087 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(0.0h); + const float16_t r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..70806b9389 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(0.0h); + const float16_t r = (a % b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000019B7B10C910(3,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000019B7B10C910(3,13): error X3000: unrecognized identifier 'a' + diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..59db7a7fd7 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +float16_t tint_float_modulo(float16_t lhs, float16_t rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + float16_t a = 1.0hf; + float16_t b = 0.0hf; + float16_t r = tint_float_modulo(a, b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..d3d1db2405 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half a = 1.0h; + half b = 0.0h; + half const r = fmod(a, b); + return; +} + diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d0f3a73d3 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Function_half = OpTypePointer Function %half + %9 = OpConstantNull %half + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_half Function %9 + %b = OpVariable %_ptr_Function_half Function %9 + OpStore %a %half_0x1p_0 + OpStore %b %9 + %11 = OpLoad %half %a + %12 = OpLoad %half %b + %13 = OpFRem %half %11 %12 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..13205078f6 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = 1.0h; + var b = 0.0h; + let r : f16 = (a % b); +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl index ec5cc7d701..6ee4fca418 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1.; var b = 0.; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3d43aff25b --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float a = 1.0f; + float b = 0.0f; + const float r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.spvasm index 14b6b443af..2ba1bacc70 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,15 +16,14 @@ %float_1 = OpConstant %float 1 %_ptr_Function_float = OpTypePointer Function %float %9 = OpConstantNull %float - %float_0 = OpConstant %float 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_float Function %9 %b = OpVariable %_ptr_Function_float Function %9 OpStore %a %float_1 - OpStore %b %float_0 - %12 = OpLoad %float %a - %13 = OpLoad %float %b - %14 = OpFRem %float %12 %13 + OpStore %b %9 + %11 = OpLoad %float %a + %12 = OpLoad %float %b + %13 = OpFRem %float %11 %12 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.wgsl index 37faeaa333..1fe8662427 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1.0; var b = 0.0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl index 3f673f95d5..a089a587a3 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1; var b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f27720ec7 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + int a = 1; + int b = 0; + const int r = (a % (b == 0 ? 1 : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm index f942f0b9bb..68aabf4ccb 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,15 +16,14 @@ %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int %9 = OpConstantNull %int - %int_0 = OpConstant %int 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_int Function %9 %b = OpVariable %_ptr_Function_int Function %9 OpStore %a %int_1 - OpStore %b %int_0 - %12 = OpLoad %int %a - %13 = OpLoad %int %b - %14 = OpSMod %int %12 %13 + OpStore %b %9 + %11 = OpLoad %int %a + %12 = OpLoad %int %b + %13 = OpSMod %int %11 %12 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.wgsl index 241e4c3ff9..88b9efdfea 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1; var b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl index 19f6c04147..38f86449ab 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1u; var b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc3d3c11d4 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + uint a = 1u; + uint b = 0u; + const uint r = (a % (b == 0u ? 1u : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.spvasm index 8d29bb63e8..62435a14ba 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,15 +16,14 @@ %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint %9 = OpConstantNull %uint - %uint_0 = OpConstant %uint 0 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_uint Function %9 %b = OpVariable %_ptr_Function_uint Function %9 OpStore %a %uint_1 - OpStore %b %uint_0 - %12 = OpLoad %uint %a - %13 = OpLoad %uint %b - %14 = OpUMod %uint %12 %13 + OpStore %b %9 + %11 = OpLoad %uint %a + %12 = OpLoad %uint %b + %13 = OpUMod %uint %11 %12 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.wgsl index 8d6291b4b8..333e9e0b5c 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 1u; var b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl index ac029c5f9c..3980b9db6b 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4; var b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0b14c77017 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + int a = 4; + int3 b = int3(0, 2, 0); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm index 1098fb21ae..4ceb097d01 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,21 +17,20 @@ %_ptr_Function_int = OpTypePointer Function %int %9 = OpConstantNull %int %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 %int_2 = OpConstant %int 2 - %13 = OpConstantComposite %v3int %int_0 %int_2 %int_0 + %12 = OpConstantComposite %v3int %9 %int_2 %9 %_ptr_Function_v3int = OpTypePointer Function %v3int - %16 = OpConstantNull %v3int + %15 = OpConstantNull %v3int %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_int Function %9 - %b = OpVariable %_ptr_Function_v3int Function %16 - %20 = OpVariable %_ptr_Function_v3int Function %16 + %b = OpVariable %_ptr_Function_v3int Function %15 + %19 = OpVariable %_ptr_Function_v3int Function %15 OpStore %a %int_4 - OpStore %b %13 - %17 = OpLoad %int %a - %18 = OpLoad %v3int %b - %21 = OpCompositeConstruct %v3int %17 %17 %17 - %19 = OpSMod %v3int %21 %18 + OpStore %b %12 + %16 = OpLoad %int %a + %17 = OpLoad %v3int %b + %20 = OpCompositeConstruct %v3int %16 %16 %16 + %18 = OpSMod %v3int %20 %17 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.wgsl index 30bdb80d53..449c6c3290 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4; var b = vec3(0, 2, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl index 74885a7296..3c490d9e44 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4u; var b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fa88822f21 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + uint a = 4u; + uint3 b = uint3(0u, 2u, 0u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.spvasm index 45bce24034..3c1d47c9e2 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,21 +17,20 @@ %_ptr_Function_uint = OpTypePointer Function %uint %9 = OpConstantNull %uint %v3uint = OpTypeVector %uint 3 - %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 - %13 = OpConstantComposite %v3uint %uint_0 %uint_2 %uint_0 + %12 = OpConstantComposite %v3uint %9 %uint_2 %9 %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %16 = OpConstantNull %v3uint + %15 = OpConstantNull %v3uint %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_uint Function %9 - %b = OpVariable %_ptr_Function_v3uint Function %16 - %20 = OpVariable %_ptr_Function_v3uint Function %16 + %b = OpVariable %_ptr_Function_v3uint Function %15 + %19 = OpVariable %_ptr_Function_v3uint Function %15 OpStore %a %uint_4 - OpStore %b %13 - %17 = OpLoad %uint %a - %18 = OpLoad %v3uint %b - %21 = OpCompositeConstruct %v3uint %17 %17 %17 - %19 = OpUMod %v3uint %21 %18 + OpStore %b %12 + %16 = OpLoad %uint %a + %17 = OpLoad %v3uint %b + %20 = OpCompositeConstruct %v3uint %16 %16 %16 + %18 = OpUMod %v3uint %20 %17 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.wgsl index 0abb9dce56..00bf43bab5 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = 4u; var b = vec3(0u, 2u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl index 8ceeb13d89..3071db9e93 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..208637ee75 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + int3 a = int3(1, 2, 3); + int b = 0; + const int3 r = (a % (b == 0 ? 1 : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm index f25b33386b..d5f44f4be2 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,19 +20,18 @@ %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %_ptr_Function_v3int = OpTypePointer Function %v3int %13 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 + %14 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %17 = OpConstantNull %int %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3int Function %13 - %b = OpVariable %_ptr_Function_int Function %17 - %21 = OpVariable %_ptr_Function_v3int Function %13 + %b = OpVariable %_ptr_Function_int Function %14 + %20 = OpVariable %_ptr_Function_v3int Function %13 OpStore %a %10 - OpStore %b %int_0 - %18 = OpLoad %v3int %a - %19 = OpLoad %int %b - %22 = OpCompositeConstruct %v3int %19 %19 %19 - %20 = OpSMod %v3int %18 %22 + OpStore %b %14 + %17 = OpLoad %v3int %a + %18 = OpLoad %int %b + %21 = OpCompositeConstruct %v3int %18 %18 %18 + %19 = OpSMod %v3int %17 %21 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.wgsl index b9f853c89d..f0b54fd504 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = 0; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl index aa6b581249..2ff8b8a8d9 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0cb79cfea2 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + uint3 a = uint3(1u, 2u, 3u); + uint b = 0u; + const uint3 r = (a % (b == 0u ? 1u : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.spvasm index 0965b4a729..36e59096a8 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -20,19 +20,18 @@ %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %13 = OpConstantNull %v3uint - %uint_0 = OpConstant %uint 0 + %14 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3uint Function %13 - %b = OpVariable %_ptr_Function_uint Function %17 - %21 = OpVariable %_ptr_Function_v3uint Function %13 + %b = OpVariable %_ptr_Function_uint Function %14 + %20 = OpVariable %_ptr_Function_v3uint Function %13 OpStore %a %10 - OpStore %b %uint_0 - %18 = OpLoad %v3uint %a - %19 = OpLoad %uint %b - %22 = OpCompositeConstruct %v3uint %19 %19 %19 - %20 = OpUMod %v3uint %18 %22 + OpStore %b %14 + %17 = OpLoad %v3uint %a + %18 = OpLoad %uint %b + %21 = OpCompositeConstruct %v3uint %18 %18 %18 + %19 = OpUMod %v3uint %17 %21 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.wgsl index d79da42260..2625b9b791 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = 0u; diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..50088f16ed --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.h, 2.h, 3.h); + var b = vec3(0.h, 5.h, 0.h); + let r : vec3 = a % b; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d79d88c455 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cbf68cce34 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + vector b = vector(float16_t(0.0h), float16_t(5.0h), float16_t(0.0h)); + const vector r = (a % b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000024A088362F0(3,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000024A088362F0(4,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000024A088362F0(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..ca050558d7 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +f16vec3 tint_float_modulo(f16vec3 lhs, f16vec3 rhs) { + return (lhs - rhs * trunc(lhs / rhs)); +} + + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(0.0hf, 5.0hf, 0.0hf); + f16vec3 r = tint_float_modulo(a, b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..1bbd6de85e --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 a = half3(1.0h, 2.0h, 3.0h); + half3 b = half3(0.0h, 5.0h, 0.0h); + half3 const r = fmod(a, b); + return; +} + diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..1ff59b63ae --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + OpName %a "a" + OpName %b "b" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %13 = OpConstantNull %v3half + %14 = OpConstantNull %half +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %16 = OpConstantComposite %v3half %14 %half_0x1_4p_2 %14 + %f = OpFunction %void None %1 + %4 = OpLabel + %a = OpVariable %_ptr_Function_v3half Function %13 + %b = OpVariable %_ptr_Function_v3half Function %13 + OpStore %a %10 + OpStore %b %16 + %18 = OpLoad %v3half %a + %19 = OpLoad %v3half %b + %20 = OpFRem %v3half %18 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..1647580f0e --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + var a = vec3(1.0h, 2.0h, 3.0h); + var b = vec3(0.0h, 5.0h, 0.0h); + let r : vec3 = (a % b); +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl index f5d27d5092..eacb9ea021 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1., 2., 3.); var b = vec3(0., 5., 0.); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..636719b6d6 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + float3 a = float3(1.0f, 2.0f, 3.0f); + float3 b = float3(0.0f, 5.0f, 0.0f); + const float3 r = (a % b); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.spvasm index 1cdd95a931..4dce1530e4 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3float %float_1 %float_2 %float_3 %_ptr_Function_v3float = OpTypePointer Function %v3float %13 = OpConstantNull %v3float - %float_0 = OpConstant %float 0 + %14 = OpConstantNull %float %float_5 = OpConstant %float 5 - %16 = OpConstantComposite %v3float %float_0 %float_5 %float_0 + %16 = OpConstantComposite %v3float %14 %float_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3float Function %13 diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.wgsl index c178fab3eb..3dfb44cd34 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1.0, 2.0, 3.0); var b = vec3(0.0, 5.0, 0.0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl index 129d4b011c..f899ffaed7 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..97e59e6254 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + int3 a = int3(1, 2, 3); + int3 b = int3(0, 5, 0); + const int3 r = (a % (b == int3(0, 0, 0) ? int3(1, 1, 1) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm index 29c04a65b9..fe57bb5a5d 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %_ptr_Function_v3int = OpTypePointer Function %v3int %13 = OpConstantNull %v3int - %int_0 = OpConstant %int 0 + %14 = OpConstantNull %int %int_5 = OpConstant %int 5 - %16 = OpConstantComposite %v3int %int_0 %int_5 %int_0 + %16 = OpConstantComposite %v3int %14 %int_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3int Function %13 diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.wgsl index 96c95e91a0..4183cc4d0e 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1, 2, 3); var b = vec3(0, 5, 0); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl index b6be872f19..fb5ab3901b 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b041731b55 --- /dev/null +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + uint3 a = uint3(1u, 2u, 3u); + uint3 b = uint3(0u, 5u, 0u); + const uint3 r = (a % (b == uint3(0u, 0u, 0u) ? uint3(1u, 1u, 1u) : b)); + return; +} diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.spvasm index 3fbdc22a31..2c87495019 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.spvasm @@ -20,9 +20,9 @@ %10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint %13 = OpConstantNull %v3uint - %uint_0 = OpConstant %uint 0 + %14 = OpConstantNull %uint %uint_5 = OpConstant %uint 5 - %16 = OpConstantComposite %v3uint %uint_0 %uint_5 %uint_0 + %16 = OpConstantComposite %v3uint %14 %uint_5 %14 %f = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_v3uint Function %13 diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.wgsl index de150e4a41..36d0e2d83f 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var a = vec3(1u, 2u, 3u); var b = vec3(0u, 5u, 0u); diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl new file mode 100644 index 0000000000..8e68956255 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = mat2x4(vec4(1.h, 2.h, 3.h, 4.h), vec4(5.h, 6.h, 7.h, 8.h)); + let b = mat4x2(vec2(-1.h, -2.h), vec2(-3.h, -4.h), vec2(-5.h, -6.h), vec2(-7.h, -8.h)); + let r : mat4x4 = a * b; +} diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ff6d4ae330 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + const matrix b = matrix(vector(float16_t(-1.0h), float16_t(-2.0h)), vector(float16_t(-3.0h), float16_t(-4.0h)), vector(float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h))); + const matrix r = mul(b, a); + return; +} diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b0dcb1ef60 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + const matrix b = matrix(vector(float16_t(-1.0h), float16_t(-2.0h)), vector(float16_t(-3.0h), float16_t(-4.0h)), vector(float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h))); + const matrix r = mul(b, a); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000029C36D606A0(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000029C36D606A0(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000029C36D606A0(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..94710802ce --- /dev/null +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16mat2x4 a = f16mat2x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf)); + f16mat4x2 b = f16mat4x2(f16vec2(-1.0hf, -2.0hf), f16vec2(-3.0hf, -4.0hf), f16vec2(-5.0hf, -6.0hf), f16vec2(-7.0hf, -8.0hf)); + f16mat4 r = (a * b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.msl new file mode 100644 index 0000000000..195e875ba1 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half2x4 const a = half2x4(half4(1.0h, 2.0h, 3.0h, 4.0h), half4(5.0h, 6.0h, 7.0h, 8.0h)); + half4x2 const b = half4x2(half2(-1.0h, -2.0h), half2(-3.0h, -4.0h), half2(-5.0h, -6.0h), half2(-7.0h, -8.0h)); + half4x4 const r = (a * b); + return; +} + diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..9b8da5d07c --- /dev/null +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %12 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %17 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %18 = OpConstantComposite %mat2v4half %12 %17 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 +%half_n0x1p_0 = OpConstant %half -0x1p+0 +%half_n0x1p_1 = OpConstant %half -0x1p+1 + %23 = OpConstantComposite %v2half %half_n0x1p_0 %half_n0x1p_1 +%half_n0x1_8p_1 = OpConstant %half -0x1.8p+1 +%half_n0x1p_2 = OpConstant %half -0x1p+2 + %26 = OpConstantComposite %v2half %half_n0x1_8p_1 %half_n0x1p_2 +%half_n0x1_4p_2 = OpConstant %half -0x1.4p+2 +%half_n0x1_8p_2 = OpConstant %half -0x1.8p+2 + %29 = OpConstantComposite %v2half %half_n0x1_4p_2 %half_n0x1_8p_2 +%half_n0x1_cp_2 = OpConstant %half -0x1.cp+2 +%half_n0x1p_3 = OpConstant %half -0x1p+3 + %32 = OpConstantComposite %v2half %half_n0x1_cp_2 %half_n0x1p_3 + %33 = OpConstantComposite %mat4v2half %23 %26 %29 %32 + %mat4v4half = OpTypeMatrix %v4half 4 + %f = OpFunction %void None %1 + %4 = OpLabel + %34 = OpMatrixTimesMatrix %mat4v4half %18 %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c63d459ef1 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = mat2x4(vec4(1.0h, 2.0h, 3.0h, 4.0h), vec4(5.0h, 6.0h, 7.0h, 8.0h)); + let b = mat4x2(vec2(-1.0h, -2.0h), vec2(-3.0h, -4.0h), vec2(-5.0h, -6.0h), vec2(-7.0h, -8.0h)); + let r : mat4x4 = (a * b); +} diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl index d9e43313e1..452713d078 100644 --- a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat2x4(vec4(1., 2., 3., 4.), vec4(5., 6., 7., 8.)); let b = mat4x2(vec2(-1., -2.), vec2(-3., -4.), vec2(-5., -6.), vec2(-7., -8.)); diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c502b098d5 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float2x4 a = float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); + const float4x2 b = float4x2(float2(-1.0f, -2.0f), float2(-3.0f, -4.0f), float2(-5.0f, -6.0f), float2(-7.0f, -8.0f)); + const float4x4 r = mul(b, a); + return; +} diff --git a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.wgsl index 2bdcf998e2..46edcc4cfc 100644 --- a/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/mat2x4-mat4x2/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat2x4(vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0)); let b = mat4x2(vec2(-1.0, -2.0), vec2(-3.0, -4.0), vec2(-5.0, -6.0), vec2(-7.0, -8.0)); diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl new file mode 100644 index 0000000000..50e83f7723 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl @@ -0,0 +1,11 @@ +enable f16; +struct S { + matrix : mat3x2, + vector : vec3, +}; +@group(0) @binding(0) var data: S; + +@fragment +fn main() { + let x = data.matrix * data.vector; +} diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..729d8e0398 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,20 @@ +SKIP: FAILED + +binary/mul/mat3x2-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x2, + ^^^^^^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(24) */ struct S { +/* offset( 0) align(4) size(12) */ matrix : mat3x2; +/* offset(12) align(1) size( 4) */ // -- implicit field alignment padding --; +/* offset(16) align(8) size( 6) */ vector : vec3; +/* offset(22) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..729d8e0398 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,20 @@ +SKIP: FAILED + +binary/mul/mat3x2-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x2, + ^^^^^^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(24) */ struct S { +/* offset( 0) align(4) size(12) */ matrix : mat3x2; +/* offset(12) align(1) size( 4) */ // -- implicit field alignment padding --; +/* offset(16) align(8) size( 6) */ vector : vec3; +/* offset(22) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..729d8e0398 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,20 @@ +SKIP: FAILED + +binary/mul/mat3x2-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x2, + ^^^^^^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(24) */ struct S { +/* offset( 0) align(4) size(12) */ matrix : mat3x2; +/* offset(12) align(1) size( 4) */ // -- implicit field alignment padding --; +/* offset(16) align(8) size( 6) */ vector : vec3; +/* offset(22) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..729d8e0398 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.msl @@ -0,0 +1,20 @@ +SKIP: FAILED + +binary/mul/mat3x2-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x2, + ^^^^^^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(24) */ struct S { +/* offset( 0) align(4) size(12) */ matrix : mat3x2; +/* offset(12) align(1) size( 4) */ // -- implicit field alignment padding --; +/* offset(16) align(8) size( 6) */ vector : vec3; +/* offset(22) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..729d8e0398 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,20 @@ +SKIP: FAILED + +binary/mul/mat3x2-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x2, + ^^^^^^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(24) */ struct S { +/* offset( 0) align(4) size(12) */ matrix : mat3x2; +/* offset(12) align(1) size( 4) */ // -- implicit field alignment padding --; +/* offset(16) align(8) size( 6) */ vector : vec3; +/* offset(22) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..729d8e0398 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +SKIP: FAILED + +binary/mul/mat3x2-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x2, + ^^^^^^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(24) */ struct S { +/* offset( 0) align(4) size(12) */ matrix : mat3x2; +/* offset(12) align(1) size( 4) */ // -- implicit field alignment padding --; +/* offset(16) align(8) size( 6) */ vector : vec3; +/* offset(22) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x2-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl index c05600b78b..c367e0ffa6 100644 --- a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl @@ -4,7 +4,7 @@ struct S { }; @group(0) @binding(0) var data: S; -@stage(fragment) +@fragment fn main() { let x = data.matrix * data.vector; } diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6e12e5cfc5 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +cbuffer cbuffer_data : register(b0, space0) { + uint4 data[3]; +}; + +float3x2 tint_symbol_2(uint4 buffer[3], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + uint4 ubo_load = buffer[scalar_offset / 4]; + const uint scalar_offset_1 = ((offset + 8u)) / 4; + uint4 ubo_load_1 = buffer[scalar_offset_1 / 4]; + const uint scalar_offset_2 = ((offset + 16u)) / 4; + uint4 ubo_load_2 = buffer[scalar_offset_2 / 4]; + return float3x2(asfloat(((scalar_offset & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_1 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_2 & 2) ? ubo_load_2.zw : ubo_load_2.xy))); +} + +void main() { + const float2 x = mul(asfloat(data[2].xyz), tint_symbol_2(data, 0u)); + return; +} diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.msl b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.msl index 31add6568c..e210c3cd6e 100644 --- a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.msl +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.msl @@ -2,6 +2,18 @@ using namespace metal; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + template inline vec operator*(matrix lhs, packed_vec rhs) { return lhs * vec(rhs); @@ -14,9 +26,9 @@ inline vec operator*(packed_vec lhs, matrix rhs) { struct S { /* 0x0000 */ float3x2 tint_symbol; - /* 0x0018 */ int8_t tint_pad[8]; + /* 0x0018 */ tint_array tint_pad; /* 0x0020 */ packed_float3 vector; - /* 0x002c */ int8_t tint_pad_1[4]; + /* 0x002c */ tint_array tint_pad_1; }; fragment void tint_symbol_1(const constant S* tint_symbol_2 [[buffer(0)]]) { diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.spvasm index ea2ff2624b..d0c526683a 100644 --- a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.spvasm @@ -1,3 +1,5 @@ +SKIP: FAILED + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 @@ -43,3 +45,6 @@ %21 = OpMatrixTimesVector %v2float %16 %20 OpReturn OpFunctionEnd +1:1: Structure id 3 decorated as Block for variable in Uniform storage class must follow relaxed uniform buffer layout rules: member 0 is a matrix with stride 8 not satisfying alignment to 16 + %S = OpTypeStruct %mat3v2float %v3float + diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.wgsl index 3c5744ea07..edaba0514c 100644 --- a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct S { @group(0) @binding(0) var data : S; -@stage(fragment) +@fragment fn main() { let x = (data.matrix * data.vector); } diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl new file mode 100644 index 0000000000..5676321ac3 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = mat3x3(vec3( 1.h, 2.h, 3.h), vec3( 4.h, 5.h, 6.h), vec3( 7.h, 8.h, 9.h)); + let b = mat3x3(vec3(-1.h, -2.h, -3.h), vec3(-4.h, -5.h, -6.h), vec3(-7.h, -8.h, -9.h)); + let r : mat3x3 = a * b; +} diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e4a2007853 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); + const matrix b = matrix(vector(float16_t(-1.0h), float16_t(-2.0h), float16_t(-3.0h)), vector(float16_t(-4.0h), float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h), float16_t(-9.0h))); + const matrix r = mul(b, a); + return; +} diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1115b9b27 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); + const matrix b = matrix(vector(float16_t(-1.0h), float16_t(-2.0h), float16_t(-3.0h)), vector(float16_t(-4.0h), float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h), float16_t(-9.0h))); + const matrix r = mul(b, a); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001A5CF164C00(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001A5CF164C00(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001A5CF164C00(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..c6a90b6fe9 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16mat3 a = f16mat3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf)); + f16mat3 b = f16mat3(f16vec3(-1.0hf, -2.0hf, -3.0hf), f16vec3(-4.0hf, -5.0hf, -6.0hf), f16vec3(-7.0hf, -8.0hf, -9.0hf)); + f16mat3 r = (a * b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..8e7ecd12f4 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3x3 const a = half3x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h)); + half3x3 const b = half3x3(half3(-1.0h, -2.0h, -3.0h), half3(-4.0h, -5.0h, -6.0h), half3(-7.0h, -8.0h, -9.0h)); + half3x3 const r = (a * b); + return; +} + diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..9376c74d75 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %15 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 + %19 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3 + %20 = OpConstantComposite %mat3v3half %11 %15 %19 +%half_n0x1p_0 = OpConstant %half -0x1p+0 +%half_n0x1p_1 = OpConstant %half -0x1p+1 +%half_n0x1_8p_1 = OpConstant %half -0x1.8p+1 + %24 = OpConstantComposite %v3half %half_n0x1p_0 %half_n0x1p_1 %half_n0x1_8p_1 +%half_n0x1p_2 = OpConstant %half -0x1p+2 +%half_n0x1_4p_2 = OpConstant %half -0x1.4p+2 +%half_n0x1_8p_2 = OpConstant %half -0x1.8p+2 + %28 = OpConstantComposite %v3half %half_n0x1p_2 %half_n0x1_4p_2 %half_n0x1_8p_2 +%half_n0x1_cp_2 = OpConstant %half -0x1.cp+2 +%half_n0x1p_3 = OpConstant %half -0x1p+3 +%half_n0x1_2p_3 = OpConstant %half -0x1.2p+3 + %32 = OpConstantComposite %v3half %half_n0x1_cp_2 %half_n0x1p_3 %half_n0x1_2p_3 + %33 = OpConstantComposite %mat3v3half %24 %28 %32 + %f = OpFunction %void None %1 + %4 = OpLabel + %34 = OpMatrixTimesMatrix %mat3v3half %20 %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..aef6f82a30 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = mat3x3(vec3(1.0h, 2.0h, 3.0h), vec3(4.0h, 5.0h, 6.0h), vec3(7.0h, 8.0h, 9.0h)); + let b = mat3x3(vec3(-1.0h, -2.0h, -3.0h), vec3(-4.0h, -5.0h, -6.0h), vec3(-7.0h, -8.0h, -9.0h)); + let r : mat3x3 = (a * b); +} diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl index 693b097da9..2b50d02841 100644 --- a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat3x3(vec3( 1., 2., 3.), vec3( 4., 5., 6.), vec3( 7., 8., 9.)); let b = mat3x3(vec3(-1., -2., -3.), vec3(-4., -5., -6.), vec3(-7., -8., -9.)); diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..22af87eee1 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3x3 a = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + const float3x3 b = float3x3(float3(-1.0f, -2.0f, -3.0f), float3(-4.0f, -5.0f, -6.0f), float3(-7.0f, -8.0f, -9.0f)); + const float3x3 r = mul(b, a); + return; +} diff --git a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.wgsl index 872ec3d080..32653664f6 100644 --- a/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/mat3x3-mat3x3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat3x3(vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0)); let b = mat3x3(vec3(-1.0, -2.0, -3.0), vec3(-4.0, -5.0, -6.0), vec3(-7.0, -8.0, -9.0)); diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl new file mode 100644 index 0000000000..64f7fb119f --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl @@ -0,0 +1,11 @@ +enable f16; +struct S { + matrix : mat3x3, + vector : vec3, +}; +@group(0) @binding(0) var data: S; + +@fragment +fn main() { + let x = data.matrix * data.vector; +} diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe18486ecc --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/mat3x3-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe18486ecc --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/mat3x3-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..fe18486ecc --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/mat3x3-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..fe18486ecc --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/mat3x3-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe18486ecc --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/mat3x3-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe18486ecc --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/mat3x3-vec3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/mat3x3-vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl index 2c0c966b8f..adf19ee960 100644 --- a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl @@ -4,7 +4,7 @@ struct S { }; @group(0) @binding(0) var data: S; -@stage(fragment) +@fragment fn main() { let x = data.matrix * data.vector; } diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c680c08b29 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +cbuffer cbuffer_data : register(b0, space0) { + uint4 data[4]; +}; + +float3x3 tint_symbol_2(uint4 buffer[4], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset / 4].xyz), asfloat(buffer[scalar_offset_1 / 4].xyz), asfloat(buffer[scalar_offset_2 / 4].xyz)); +} + +void main() { + const float3 x = mul(asfloat(data[3].xyz), tint_symbol_2(data, 0u)); + return; +} diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.msl b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.msl index 40ec53343b..8f4ff550d7 100644 --- a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.msl +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.msl @@ -12,10 +12,22 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ float3x3 tint_symbol; /* 0x0030 */ packed_float3 vector; - /* 0x003c */ int8_t tint_pad[4]; + /* 0x003c */ tint_array tint_pad; }; fragment void tint_symbol_1(const constant S* tint_symbol_2 [[buffer(0)]]) { diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.wgsl index 9c51fa6f6d..777ccc01e4 100644 --- a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct S { @group(0) @binding(0) var data : S; -@stage(fragment) +@fragment fn main() { let x = (data.matrix * data.vector); } diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl new file mode 100644 index 0000000000..cdccb74b67 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = mat4x2(vec2(-1.h, -2.h), vec2(-3.h, -4.h), vec2(-5.h, -6.h), vec2(-7.h, -8.h)); + let b = mat2x4(vec4(1.h, 2.h, 3.h, 4.h), vec4(5.h, 6.h, 7.h, 8.h)); + let r : mat2x2 = a * b; +} diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..20a2c6604c --- /dev/null +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(-1.0h), float16_t(-2.0h)), vector(float16_t(-3.0h), float16_t(-4.0h)), vector(float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h))); + const matrix b = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + const matrix r = mul(b, a); + return; +} diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bcfe84a940 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(-1.0h), float16_t(-2.0h)), vector(float16_t(-3.0h), float16_t(-4.0h)), vector(float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h))); + const matrix b = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + const matrix r = mul(b, a); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001CE35477700(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001CE35477700(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001CE35477700(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..26d8f4e04b --- /dev/null +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16mat4x2 a = f16mat4x2(f16vec2(-1.0hf, -2.0hf), f16vec2(-3.0hf, -4.0hf), f16vec2(-5.0hf, -6.0hf), f16vec2(-7.0hf, -8.0hf)); + f16mat2x4 b = f16mat2x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf)); + f16mat2 r = (a * b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.msl new file mode 100644 index 0000000000..a95ebdc933 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half4x2 const a = half4x2(half2(-1.0h, -2.0h), half2(-3.0h, -4.0h), half2(-5.0h, -6.0h), half2(-7.0h, -8.0h)); + half2x4 const b = half2x4(half4(1.0h, 2.0h, 3.0h, 4.0h), half4(5.0h, 6.0h, 7.0h, 8.0h)); + half2x2 const r = (a * b); + return; +} + diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..4dc4e62373 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 +%half_n0x1p_0 = OpConstant %half -0x1p+0 +%half_n0x1p_1 = OpConstant %half -0x1p+1 + %10 = OpConstantComposite %v2half %half_n0x1p_0 %half_n0x1p_1 +%half_n0x1_8p_1 = OpConstant %half -0x1.8p+1 +%half_n0x1p_2 = OpConstant %half -0x1p+2 + %13 = OpConstantComposite %v2half %half_n0x1_8p_1 %half_n0x1p_2 +%half_n0x1_4p_2 = OpConstant %half -0x1.4p+2 +%half_n0x1_8p_2 = OpConstant %half -0x1.8p+2 + %16 = OpConstantComposite %v2half %half_n0x1_4p_2 %half_n0x1_8p_2 +%half_n0x1_cp_2 = OpConstant %half -0x1.cp+2 +%half_n0x1p_3 = OpConstant %half -0x1p+3 + %19 = OpConstantComposite %v2half %half_n0x1_cp_2 %half_n0x1p_3 + %20 = OpConstantComposite %mat4v2half %10 %13 %16 %19 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %27 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %32 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %33 = OpConstantComposite %mat2v4half %27 %32 + %mat2v2half = OpTypeMatrix %v2half 2 + %f = OpFunction %void None %1 + %4 = OpLabel + %34 = OpMatrixTimesMatrix %mat2v2half %20 %33 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..87b308aae8 --- /dev/null +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = mat4x2(vec2(-1.0h, -2.0h), vec2(-3.0h, -4.0h), vec2(-5.0h, -6.0h), vec2(-7.0h, -8.0h)); + let b = mat2x4(vec4(1.0h, 2.0h, 3.0h, 4.0h), vec4(5.0h, 6.0h, 7.0h, 8.0h)); + let r : mat2x2 = (a * b); +} diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl index 76e4db22d4..bddcda1b04 100644 --- a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat4x2(vec2(-1., -2.), vec2(-3., -4.), vec2(-5., -6.), vec2(-7., -8.)); let b = mat2x4(vec4(1., 2., 3., 4.), vec4(5., 6., 7., 8.)); diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f4028af0e --- /dev/null +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float4x2 a = float4x2(float2(-1.0f, -2.0f), float2(-3.0f, -4.0f), float2(-5.0f, -6.0f), float2(-7.0f, -8.0f)); + const float2x4 b = float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); + const float2x2 r = mul(b, a); + return; +} diff --git a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.wgsl index cc6bf09931..0e59163060 100644 --- a/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/mat4x2-mat2x4/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat4x2(vec2(-1.0, -2.0), vec2(-3.0, -4.0), vec2(-5.0, -6.0), vec2(-7.0, -8.0)); let b = mat2x4(vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0)); diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..5fb45c7745 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 1.h; + let b = 2.h; + let r : f16 = a * b; +} diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c3dc99b5f4 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) * float16_t(2.0h)); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d9b0ec110a --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) * float16_t(2.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000252E8C86030(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..ad5aa1a24b --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t r = (1.0hf * 2.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..d0217a5a7c --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 1.0h; + half const b = 2.0h; + half const r = (a * b); + return; +} + diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd3c94bd0c --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %f = OpFunction %void None %1 + %4 = OpLabel + %8 = OpFMul %half %half_0x1p_0 %half_0x1p_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cb4852a54 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 1.0h; + let b = 2.0h; + let r : f16 = (a * b); +} diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl index 7c3a49412f..3d0778576f 100644 --- a/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.; let b = 2.; diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a2d27f9b82 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float r = (1.0f * 2.0f); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.wgsl index 1308e5a1b9..ea04f10f56 100644 --- a/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.0; let b = 2.0; diff --git a/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl index 841429e890..5e55d6673c 100644 --- a/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b93ecb2bf --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 * 2); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.wgsl index e0189a5e0d..03fe7ce3d6 100644 --- a/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl index 4998346224..c943b96b87 100644 --- a/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4623783d4f --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u * 2u); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.wgsl index 3dda0e08d8..1a4cfcb703 100644 --- a/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl new file mode 100644 index 0000000000..02d9542b06 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 4.h; + let b = vec3(1.h, 2.h, 3.h); + let r : vec3 = a * b; +} diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fbd4580e89 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a * b); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3b8d09052b --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a * b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000178A2942A20(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4f5eccc78b --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t a = 4.0hf; + f16vec3 b = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = (a * b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..28ddb32877 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 4.0h; + half3 const b = half3(1.0h, 2.0h, 3.0h); + half3 const r = (a * b); + return; +} + diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..156d292e03 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,28 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 + %f = OpFunction %void None %1 + %4 = OpLabel + %12 = OpVectorTimesScalar %v3half %11 %half_0x1p_2 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..8b0a1055ac --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 4.0h; + let b = vec3(1.0h, 2.0h, 3.0h); + let r : vec3 = (a * b); +} diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl b/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl index 62560cb8ac..745133422e 100644 --- a/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl +++ b/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.; let b = vec3(1., 2., 3.); diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ab39cdc7f0 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float a = 4.0f; + const float3 b = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a * b); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.wgsl index f2cf6c497c..d61b5165c6 100644 --- a/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/scalar-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.0; let b = vec3(1.0, 2.0, 3.0); diff --git a/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl index 8f8d3e437c..e5424b3bf9 100644 --- a/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6d7c62af51 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(1, 2, 3); + const int3 r = (a * b); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.wgsl index 85f39b5049..2531599554 100644 --- a/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl index 5c9260f078..a48bd99513 100644 --- a/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..73ec042b26 --- /dev/null +++ b/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(1u, 2u, 3u); + const uint3 r = (a * b); + return; +} diff --git a/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.wgsl index 9fc3bffa95..df4670734a 100644 --- a/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl new file mode 100644 index 0000000000..b2b72254cf --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl @@ -0,0 +1,11 @@ +enable f16; +struct S { + matrix : mat3x3, + vector : vec3, +}; +@group(0) @binding(0) var data: S; + +@fragment +fn main() { + let x = data.vector * data.matrix; +} diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..da8a0b2f5b --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat3x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..da8a0b2f5b --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat3x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..da8a0b2f5b --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat3x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..da8a0b2f5b --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.msl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat3x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..da8a0b2f5b --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.spvasm @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat3x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..da8a0b2f5b --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f16.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat3x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat3x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(32) */ struct S { +/* offset( 0) align(8) size(24) */ matrix : mat3x3; +/* offset(24) align(8) size( 6) */ vector : vec3; +/* offset(30) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat3x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl index 6f7e5df351..f2fb487f5f 100644 --- a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl @@ -4,7 +4,7 @@ struct S { }; @group(0) @binding(0) var data: S; -@stage(fragment) +@fragment fn main() { let x = data.vector * data.matrix; } diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bd768f2a7 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +cbuffer cbuffer_data : register(b0, space0) { + uint4 data[4]; +}; + +float3x3 tint_symbol_3(uint4 buffer[4], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + return float3x3(asfloat(buffer[scalar_offset / 4].xyz), asfloat(buffer[scalar_offset_1 / 4].xyz), asfloat(buffer[scalar_offset_2 / 4].xyz)); +} + +void main() { + const float3 x = mul(tint_symbol_3(data, 0u), asfloat(data[3].xyz)); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.msl b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.msl index a5da864847..d9fc80bf60 100644 --- a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.msl +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.msl @@ -12,10 +12,22 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ float3x3 tint_symbol; /* 0x0030 */ packed_float3 vector; - /* 0x003c */ int8_t tint_pad[4]; + /* 0x003c */ tint_array tint_pad; }; fragment void tint_symbol_1(const constant S* tint_symbol_2 [[buffer(0)]]) { diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.wgsl index 6aa7aac1a3..f0923a777b 100644 --- a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct S { @group(0) @binding(0) var data : S; -@stage(fragment) +@fragment fn main() { let x = (data.vector * data.matrix); } diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl new file mode 100644 index 0000000000..7ea4792aa7 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl @@ -0,0 +1,11 @@ +enable f16; +struct S { + matrix : mat4x3, + vector : vec3, +}; +@group(0) @binding(0) var data: S; + +@fragment +fn main() { + let x = data.vector * data.matrix; +} diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b075b5ca3 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat4x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat4x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(40) */ struct S { +/* offset( 0) align(8) size(32) */ matrix : mat4x3; +/* offset(32) align(8) size( 6) */ vector : vec3; +/* offset(38) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b075b5ca3 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat4x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat4x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(40) */ struct S { +/* offset( 0) align(8) size(32) */ matrix : mat4x3; +/* offset(32) align(8) size( 6) */ vector : vec3; +/* offset(38) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4b075b5ca3 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat4x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat4x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(40) */ struct S { +/* offset( 0) align(8) size(32) */ matrix : mat4x3; +/* offset(32) align(8) size( 6) */ vector : vec3; +/* offset(38) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..4b075b5ca3 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.msl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat4x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat4x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(40) */ struct S { +/* offset( 0) align(8) size(32) */ matrix : mat4x3; +/* offset(32) align(8) size( 6) */ vector : vec3; +/* offset(38) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b075b5ca3 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.spvasm @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat4x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat4x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(40) */ struct S { +/* offset( 0) align(8) size(32) */ matrix : mat4x3; +/* offset(32) align(8) size( 6) */ vector : vec3; +/* offset(38) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b075b5ca3 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f16.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +SKIP: FAILED + +binary/mul/vec3-mat4x3/f16.wgsl:3:14 error: using f16 types in 'uniform' storage class is not implemented yet + matrix : mat4x3, + ^^^^^^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(40) */ struct S { +/* offset( 0) align(8) size(32) */ matrix : mat4x3; +/* offset(32) align(8) size( 6) */ vector : vec3; +/* offset(38) align(1) size( 2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +binary/mul/vec3-mat4x3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var data: S; + ^^^^ + diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl index be83514680..0165011501 100644 --- a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl @@ -4,7 +4,7 @@ struct S { }; @group(0) @binding(0) var data: S; -@stage(fragment) +@fragment fn main() { let x = data.vector * data.matrix; } diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..574af42142 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +cbuffer cbuffer_data : register(b0, space0) { + uint4 data[5]; +}; + +float4x3 tint_symbol_3(uint4 buffer[5], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + const uint scalar_offset_3 = ((offset + 48u)) / 4; + return float4x3(asfloat(buffer[scalar_offset / 4].xyz), asfloat(buffer[scalar_offset_1 / 4].xyz), asfloat(buffer[scalar_offset_2 / 4].xyz), asfloat(buffer[scalar_offset_3 / 4].xyz)); +} + +void main() { + const float4 x = mul(tint_symbol_3(data, 0u), asfloat(data[4].xyz)); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.msl b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.msl index 36412baa45..3f66659e22 100644 --- a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.msl +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.msl @@ -12,10 +12,22 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ float4x3 tint_symbol; /* 0x0040 */ packed_float3 vector; - /* 0x004c */ int8_t tint_pad[4]; + /* 0x004c */ tint_array tint_pad; }; fragment void tint_symbol_1(const constant S* tint_symbol_2 [[buffer(0)]]) { diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.wgsl index cf6fffd2b3..961743023f 100644 --- a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct S { @group(0) @binding(0) var data : S; -@stage(fragment) +@fragment fn main() { let x = (data.vector * data.matrix); } diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl new file mode 100644 index 0000000000..af79bc115b --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = 4.h; + let r : vec3 = a * b; +} diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f65d60dfa2 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a * float16_t(4.0h)); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c633188ac0 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a * float16_t(4.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000298EEEF3700(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000298EEEF3700(4,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5a9325cefb --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = (a * 4.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..d78ae97026 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half const b = 4.0h; + half3 const r = (a * b); + return; +} + diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..dac12df679 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,28 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %f = OpFunction %void None %1 + %4 = OpLabel + %12 = OpVectorTimesScalar %v3half %10 %half_0x1p_2 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f1d2acef1 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = 4.0h; + let r : vec3 = (a * b); +} diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl b/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl index 10f72ae41e..3a346e6b87 100644 --- a/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl +++ b/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = 4.; diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..646399da07 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a * 4.0f); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.wgsl index b3acece835..2d7356b484 100644 --- a/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/vec3-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = 4.0; diff --git a/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl index d4d06787ac..fb5627284b 100644 --- a/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e86c189375 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 r = (a * 4); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.wgsl index a72729454a..55b9f6ff23 100644 --- a/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl index 03a79ac1aa..162083fbf2 100644 --- a/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d61b59a580 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 r = (a * 4u); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.wgsl index fc7e60dd3a..33bd16a995 100644 --- a/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..5af4884a6d --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = vec3(4.h, 5.h, 6.h); + let r : vec3 = a * b; +} diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7e75e282f3 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a * b); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..51fe0b8483 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a * b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001B65F083630(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001B65F083630(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001B65F083630(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4bdd8f4065 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(4.0hf, 5.0hf, 6.0hf); + f16vec3 r = (a * b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..697fb36e25 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half3 const b = half3(4.0h, 5.0h, 6.0h); + half3 const r = (a * b); + return; +} + diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..2fc26920f5 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %14 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 + %f = OpFunction %void None %1 + %4 = OpLabel + %15 = OpFMul %v3half %10 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..5d4baa90b9 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = vec3(4.0h, 5.0h, 6.0h); + let r : vec3 = (a * b); +} diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl index 6d0e2111ea..5b4b11afb7 100644 --- a/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = vec3(4., 5., 6.); diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8a51b14eeb --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 b = float3(4.0f, 5.0f, 6.0f); + const float3 r = (a * b); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.wgsl index a0dd1f7745..30c7e0cb0e 100644 --- a/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = vec3(4.0, 5.0, 6.0); diff --git a/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl index 32ae83f005..d8c64e655b 100644 --- a/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d532aaf513 --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a * b); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.wgsl index 20121b5913..a6ff5b4936 100644 --- a/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl index 39e1db491f..76c46b5d28 100644 --- a/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5db3034bcc --- /dev/null +++ b/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a * b); + return; +} diff --git a/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.wgsl index a910c86463..1e40fe76c1 100644 --- a/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/mul/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl index 54eda6d516..6f4dadce9d 100644 --- a/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2u; diff --git a/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..861995c7bc --- /dev/null +++ b/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = (1 >> 2u); + return; +} diff --git a/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.wgsl index 57f33c8958..054f0efb71 100644 --- a/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/right-shift/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2u; diff --git a/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl index 4cf2a84532..ae28e96080 100644 --- a/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4e90e73f1d --- /dev/null +++ b/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = (1u >> 2u); + return; +} diff --git a/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.wgsl index 827e23f748..633685a75b 100644 --- a/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/right-shift/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl b/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl index 366c8c440f..b59067a825 100644 --- a/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl +++ b/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2520c5e787 --- /dev/null +++ b/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const uint3 b = uint3(4u, 5u, 6u); + const int3 r = (a >> b); + return; +} diff --git a/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.wgsl index 96e088f710..3fd119e3b4 100644 --- a/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/right-shift/vector-vector/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl b/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl index a70095deb5..e4214f3172 100644 --- a/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl +++ b/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c57ee7a4d --- /dev/null +++ b/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a >> b); + return; +} diff --git a/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.wgsl index 4b44e73d76..f7073ef9d3 100644 --- a/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/right-shift/vector-vector/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl new file mode 100644 index 0000000000..e2f91da2f7 --- /dev/null +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = mat3x3(vec3( 1.h, 2.h, 3.h), vec3( 4.h, 5.h, 6.h), vec3( 7.h, 8.h, 9.h)); + let b = mat3x3(vec3(-1.h, -2.h, -3.h), vec3(-4.h, -5.h, -6.h), vec3(-7.h, -8.h, -9.h)); + let r : mat3x3 = a - b; +} diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94f9755bdf --- /dev/null +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); + const matrix b = matrix(vector(float16_t(-1.0h), float16_t(-2.0h), float16_t(-3.0h)), vector(float16_t(-4.0h), float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h), float16_t(-9.0h))); + const matrix r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ee09fb97e --- /dev/null +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const matrix a = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); + const matrix b = matrix(vector(float16_t(-1.0h), float16_t(-2.0h), float16_t(-3.0h)), vector(float16_t(-4.0h), float16_t(-5.0h), float16_t(-6.0h)), vector(float16_t(-7.0h), float16_t(-8.0h), float16_t(-9.0h))); + const matrix r = (a - b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000014C51995C90(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000014C51995C90(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000014C51995C90(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..50855dbe3d --- /dev/null +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16mat3 a = f16mat3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf)); + f16mat3 b = f16mat3(f16vec3(-1.0hf, -2.0hf, -3.0hf), f16vec3(-4.0hf, -5.0hf, -6.0hf), f16vec3(-7.0hf, -8.0hf, -9.0hf)); + f16mat3 r = (a - b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.msl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..912eb29e6b --- /dev/null +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3x3 const a = half3x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h)); + half3x3 const b = half3x3(half3(-1.0h, -2.0h, -3.0h), half3(-4.0h, -5.0h, -6.0h), half3(-7.0h, -8.0h, -9.0h)); + half3x3 const r = (a - b); + return; +} + diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a433c16685 --- /dev/null +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %15 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 + %19 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3 + %20 = OpConstantComposite %mat3v3half %11 %15 %19 +%half_n0x1p_0 = OpConstant %half -0x1p+0 +%half_n0x1p_1 = OpConstant %half -0x1p+1 +%half_n0x1_8p_1 = OpConstant %half -0x1.8p+1 + %24 = OpConstantComposite %v3half %half_n0x1p_0 %half_n0x1p_1 %half_n0x1_8p_1 +%half_n0x1p_2 = OpConstant %half -0x1p+2 +%half_n0x1_4p_2 = OpConstant %half -0x1.4p+2 +%half_n0x1_8p_2 = OpConstant %half -0x1.8p+2 + %28 = OpConstantComposite %v3half %half_n0x1p_2 %half_n0x1_4p_2 %half_n0x1_8p_2 +%half_n0x1_cp_2 = OpConstant %half -0x1.cp+2 +%half_n0x1p_3 = OpConstant %half -0x1p+3 +%half_n0x1_2p_3 = OpConstant %half -0x1.2p+3 + %32 = OpConstantComposite %v3half %half_n0x1_cp_2 %half_n0x1p_3 %half_n0x1_2p_3 + %33 = OpConstantComposite %mat3v3half %24 %28 %32 + %f = OpFunction %void None %1 + %4 = OpLabel + %35 = OpCompositeExtract %v3half %20 0 + %36 = OpCompositeExtract %v3half %33 0 + %37 = OpFSub %v3half %35 %36 + %38 = OpCompositeExtract %v3half %20 1 + %39 = OpCompositeExtract %v3half %33 1 + %40 = OpFSub %v3half %38 %39 + %41 = OpCompositeExtract %v3half %20 2 + %42 = OpCompositeExtract %v3half %33 2 + %43 = OpFSub %v3half %41 %42 + %44 = OpCompositeConstruct %mat3v3half %37 %40 %43 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..22415884bd --- /dev/null +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = mat3x3(vec3(1.0h, 2.0h, 3.0h), vec3(4.0h, 5.0h, 6.0h), vec3(7.0h, 8.0h, 9.0h)); + let b = mat3x3(vec3(-1.0h, -2.0h, -3.0h), vec3(-4.0h, -5.0h, -6.0h), vec3(-7.0h, -8.0h, -9.0h)); + let r : mat3x3 = (a - b); +} diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl index 1d90779f42..fbe5639535 100644 --- a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat3x3(vec3( 1., 2., 3.), vec3( 4., 5., 6.), vec3( 7., 8., 9.)); let b = mat3x3(vec3(-1., -2., -3.), vec3(-4., -5., -6.), vec3(-7., -8., -9.)); diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9d1b2b3fb1 --- /dev/null +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3x3 a = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + const float3x3 b = float3x3(float3(-1.0f, -2.0f, -3.0f), float3(-4.0f, -5.0f, -6.0f), float3(-7.0f, -8.0f, -9.0f)); + const float3x3 r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.wgsl index d54c2dcc11..014521028f 100644 --- a/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/mat3x3-mat3x3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = mat3x3(vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0)); let b = mat3x3(vec3(-1.0, -2.0, -3.0), vec3(-4.0, -5.0, -6.0), vec3(-7.0, -8.0, -9.0)); diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl new file mode 100644 index 0000000000..1a0b18506c --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 1.h; + let b = 2.h; + let r : f16 = a - b; +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..754b2e2116 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t r = float16_t(-1.0h); + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..368197c72d --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t r = (float16_t(1.0h) - float16_t(2.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000028D0FDE52F0(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..17f9f5d35a --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t r = -1.0hf; +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..fc7f51a641 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 1.0h; + half const b = 2.0h; + half const r = (a - b); + return; +} + diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..01d688b2f5 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %f = OpFunction %void None %1 + %4 = OpLabel + %8 = OpFSub %half %half_0x1p_0 %half_0x1p_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0002345915 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 1.0h; + let b = 2.0h; + let r : f16 = (a - b); +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl index 7aec1fe56c..9dff5710ad 100644 --- a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl +++ b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.; let b = 2.; diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..671ced5396 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float r = -1.0f; + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..671ced5396 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float r = -1.0f; + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.glsl b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.glsl index ee8b862e2d..6906c48b37 100644 --- a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void f() { - float r = (1.0f - 2.0f); + float r = -1.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.hlsl deleted file mode 100644 index 04ab363789..0000000000 --- a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,5 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const float r = (1.0f - 2.0f); - return; -} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.wgsl index 7639858eaa..9362f39ed8 100644 --- a/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/scalar-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1.0; let b = 2.0; diff --git a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl index 93fb7e057d..a8fb3a1036 100644 --- a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl +++ b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..716d120f16 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = -1; + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..716d120f16 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int r = -1; + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.glsl b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.glsl index 310f35025f..689a77035f 100644 --- a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void f() { - int r = (1 - 2); + int r = -1; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.hlsl deleted file mode 100644 index 4f995b55ca..0000000000 --- a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,5 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const int r = (1 - 2); - return; -} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.wgsl index 9aa9bf3ed2..50a769f1e7 100644 --- a/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/scalar-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1; let b = 2; diff --git a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl index fa75c67a4c..c93a3428b8 100644 --- a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl +++ b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fafd6aabcd --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = 4294967295u; + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fafd6aabcd --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint r = 4294967295u; + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.glsl b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.glsl index 4b278df660..ce3479e8a4 100644 --- a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void f() { - uint r = (1u - 2u); + uint r = 4294967295u; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.hlsl deleted file mode 100644 index 23719acecc..0000000000 --- a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,5 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - const uint r = (1u - 2u); - return; -} diff --git a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.wgsl index 81cbedda57..32a886943d 100644 --- a/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/scalar-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 1u; let b = 2u; diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl new file mode 100644 index 0000000000..82c7de8c36 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = 4.h; + let b = vec3(1.h, 2.h, 3.h); + let r : vec3 = a - b; +} diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f59e9c353d --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67a6a84a2c --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const float16_t a = float16_t(4.0h); + const vector b = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a - b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FE69582A90(3,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..44a54c2557 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + float16_t a = 4.0hf; + f16vec3 b = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = (a - b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..7a481e2d9a --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half const a = 4.0h; + half3 const b = half3(1.0h, 2.0h, 3.0h); + half3 const r = (a - b); + return; +} + diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..4fe7e31a1d --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %11 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %13 = OpVariable %_ptr_Function_v3half Function %15 + %16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2 + %12 = OpFSub %v3half %16 %11 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..8127b6b1f6 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = 4.0h; + let b = vec3(1.0h, 2.0h, 3.0h); + let r : vec3 = (a - b); +} diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl b/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl index 8a4a112ee0..25d44e6a49 100644 --- a/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl +++ b/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.; let b = vec3(1., 2., 3.); diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d714c62fc1 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float a = 4.0f; + const float3 b = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.wgsl index 14046957cc..ed0afe4474 100644 --- a/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/scalar-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4.0; let b = vec3(1.0, 2.0, 3.0); diff --git a/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl b/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl index 8b31299bfb..de161621fb 100644 --- a/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl +++ b/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1e67f1327e --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int a = 4; + const int3 b = int3(1, 2, 3); + const int3 r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.wgsl index bec3a199d7..e3d4493dff 100644 --- a/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/scalar-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4; let b = vec3(1, 2, 3); diff --git a/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl b/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl index 562719f9cc..d138510cdc 100644 --- a/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl +++ b/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..90f540d219 --- /dev/null +++ b/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint a = 4u; + const uint3 b = uint3(1u, 2u, 3u); + const uint3 r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.wgsl index 4e1bca98a9..2e003d4812 100644 --- a/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/scalar-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = 4u; let b = vec3(1u, 2u, 3u); diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl new file mode 100644 index 0000000000..19ff2a94d4 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = 4.h; + let r : vec3 = a - b; +} diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3738c63024 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a - float16_t(4.0h)); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..083ec01024 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector r = (a - float16_t(4.0h)); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001E70BC13730(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001E70BC13730(4,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.glsl b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..d9cea5fa9c --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 r = (a - 4.0hf); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.msl b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..f136b52fd8 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half const b = 4.0h; + half3 const r = (a - b); + return; +} + diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..95f70ff215 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %15 = OpConstantNull %v3half + %f = OpFunction %void None %1 + %4 = OpLabel + %13 = OpVariable %_ptr_Function_v3half Function %15 + %16 = OpCompositeConstruct %v3half %half_0x1p_2 %half_0x1p_2 %half_0x1p_2 + %12 = OpFSub %v3half %10 %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..643ba98bef --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = 4.0h; + let r : vec3 = (a - b); +} diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl b/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl index 4b4aced691..5e151fd95d 100644 --- a/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl +++ b/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = 4.; diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0476c62e45 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 r = (a - 4.0f); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.wgsl index 169e9db17b..b9470ecce4 100644 --- a/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/vec3-scalar/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = 4.0; diff --git a/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl b/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl index e12a2bae2a..d2f30e4c68 100644 --- a/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl +++ b/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8db37c95f4 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 r = (a - 4); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.wgsl index 003acfab8f..bc52104045 100644 --- a/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/vec3-scalar/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = 4; diff --git a/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl b/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl index f5e4e5adad..37dce9c6db 100644 --- a/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl +++ b/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a9b7eefbc --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 r = (a - 4u); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.wgsl index 9b9c0de2d3..5daa30077c 100644 --- a/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/vec3-scalar/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = 4u; diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl new file mode 100644 index 0000000000..8c618d02d4 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.h, 2.h, 3.h); + let b = vec3(4.h, 5.h, 6.h); + let r : vec3 = a - b; +} diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e1ed257ef --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6432f857ee --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void f() { + const vector a = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + const vector b = vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)); + const vector r = (a - b); + return; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000027B612936C0(3,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000027B612936C0(4,16-24): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000027B612936C0(5,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.glsl b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..deb51548ed --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +void f() { + f16vec3 a = f16vec3(1.0hf, 2.0hf, 3.0hf); + f16vec3 b = f16vec3(4.0hf, 5.0hf, 6.0hf); + f16vec3 r = (a - b); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.msl b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..1e30ff0d09 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void f() { + half3 const a = half3(1.0h, 2.0h, 3.0h); + half3 const b = half3(4.0h, 5.0h, 6.0h); + half3 const r = (a - b); + return; +} + diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a9f690f39b --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %14 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 + %f = OpFunction %void None %1 + %4 = OpLabel + %15 = OpFSub %v3half %10 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..719d069a27 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +@compute @workgroup_size(1) +fn f() { + let a = vec3(1.0h, 2.0h, 3.0h); + let b = vec3(4.0h, 5.0h, 6.0h); + let r : vec3 = (a - b); +} diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl b/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl index cea0bb7a8c..b2967b6509 100644 --- a/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl +++ b/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1., 2., 3.); let b = vec3(4., 5., 6.); diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f4a568e530 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 b = float3(4.0f, 5.0f, 6.0f); + const float3 r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.wgsl index 60754052c5..e3e32b1cda 100644 --- a/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/vec3-vec3/f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1.0, 2.0, 3.0); let b = vec3(4.0, 5.0, 6.0); diff --git a/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl b/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl index 2ab7275dad..f1b01446e8 100644 --- a/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl +++ b/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8a26227e0 --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = int3(4, 5, 6); + const int3 r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.wgsl index a5b306b812..474ada031c 100644 --- a/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/vec3-vec3/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1, 2, 3); let b = vec3(4, 5, 6); diff --git a/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl b/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl index cb59c1fd56..2dfe12e00c 100644 --- a/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl +++ b/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1a8d03f66d --- /dev/null +++ b/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = uint3(4u, 5u, 6u); + const uint3 r = (a - b); + return; +} diff --git a/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.wgsl b/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.wgsl index dea4cfe84d..83f2ec2c39 100644 --- a/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/binary/sub/vec3-vec3/u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a = vec3(1u, 2u, 3u); let b = vec3(4u, 5u, 6u); diff --git a/test/tint/expressions/bitcast/scalar/f32-f32.wgsl b/test/tint/expressions/bitcast/scalar/f32-f32.wgsl index 0e7b8ba5c7..5243db2cf0 100644 --- a/test/tint/expressions/bitcast/scalar/f32-f32.wgsl +++ b/test/tint/expressions/bitcast/scalar/f32-f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : f32 = 1.; let b : f32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e5fee687b --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float b = asfloat(1.0f); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.wgsl index ac6a874d8a..2cd540505e 100644 --- a/test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/f32-f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : f32 = 1.0; let b : f32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/f32-i32.wgsl b/test/tint/expressions/bitcast/scalar/f32-i32.wgsl index 91c3d8f2f0..40d370f7dc 100644 --- a/test/tint/expressions/bitcast/scalar/f32-i32.wgsl +++ b/test/tint/expressions/bitcast/scalar/f32-i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : f32 = 1.; let b : i32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e7f1a217a5 --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int b = asint(1.0f); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.wgsl index 81e6fa61ef..20807eb324 100644 --- a/test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/f32-i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : f32 = 1.0; let b : i32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/f32-u32.wgsl b/test/tint/expressions/bitcast/scalar/f32-u32.wgsl index 6f33d5adc8..9cf72ec8dc 100644 --- a/test/tint/expressions/bitcast/scalar/f32-u32.wgsl +++ b/test/tint/expressions/bitcast/scalar/f32-u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : f32 = 1.; let b : u32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..289a1d5241 --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint b = asuint(1.0f); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.wgsl index c230fb888c..3850451c2b 100644 --- a/test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/f32-u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : f32 = 1.0; let b : u32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/i32-f32.wgsl b/test/tint/expressions/bitcast/scalar/i32-f32.wgsl index 00a8099ce8..272043823b 100644 --- a/test/tint/expressions/bitcast/scalar/i32-f32.wgsl +++ b/test/tint/expressions/bitcast/scalar/i32-f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : i32 = 1; let b : f32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2fcce4faea --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float b = asfloat(1); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.wgsl index 1aae69a801..16f86b24f7 100644 --- a/test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/i32-f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : i32 = 1; let b : f32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/i32-i32.wgsl b/test/tint/expressions/bitcast/scalar/i32-i32.wgsl index 282e2183fc..ca5e70f712 100644 --- a/test/tint/expressions/bitcast/scalar/i32-i32.wgsl +++ b/test/tint/expressions/bitcast/scalar/i32-i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : i32 = 1; let b : i32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4fc4846484 --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int b = asint(1); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.wgsl index 9ecbee506d..94c44a972e 100644 --- a/test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/i32-i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : i32 = 1; let b : i32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/i32-u32.wgsl b/test/tint/expressions/bitcast/scalar/i32-u32.wgsl index ebb81b4d91..4a34de6d05 100644 --- a/test/tint/expressions/bitcast/scalar/i32-u32.wgsl +++ b/test/tint/expressions/bitcast/scalar/i32-u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : i32 = 1; let b : u32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d85da9add3 --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint b = asuint(1); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.wgsl index cb8e316d19..28a65c9d8d 100644 --- a/test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/i32-u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : i32 = 1; let b : u32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl b/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl index de5778872b..374110c184 100644 --- a/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl +++ b/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let b : u32 = bitcast(-2147483648); } diff --git a/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6044ed9a5c --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint b = asuint(-2147483648); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.wgsl index de5778872b..374110c184 100644 --- a/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/i32min-u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let b : u32 = bitcast(-2147483648); } diff --git a/test/tint/expressions/bitcast/scalar/u32-f32.wgsl b/test/tint/expressions/bitcast/scalar/u32-f32.wgsl index c196d83133..3905040f72 100644 --- a/test/tint/expressions/bitcast/scalar/u32-f32.wgsl +++ b/test/tint/expressions/bitcast/scalar/u32-f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : u32 = 1u; let b : f32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1a00f3bdd8 --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const float b = asfloat(1u); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.wgsl index 7c0cb22da5..4873e26b04 100644 --- a/test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/u32-f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : u32 = 1u; let b : f32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/u32-i32.wgsl b/test/tint/expressions/bitcast/scalar/u32-i32.wgsl index 9d6785a46d..c5028312c4 100644 --- a/test/tint/expressions/bitcast/scalar/u32-i32.wgsl +++ b/test/tint/expressions/bitcast/scalar/u32-i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : u32 = 1u; let b : i32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2650dff4d6 --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const int b = asint(1u); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.wgsl index 4d8f585d66..e07225eb95 100644 --- a/test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/u32-i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : u32 = 1u; let b : i32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/u32-u32.wgsl b/test/tint/expressions/bitcast/scalar/u32-u32.wgsl index 35f0a23af2..c1a4aede35 100644 --- a/test/tint/expressions/bitcast/scalar/u32-u32.wgsl +++ b/test/tint/expressions/bitcast/scalar/u32-u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : u32 = 1u; let b : u32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..62d26becba --- /dev/null +++ b/test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void f() { + const uint b = asuint(1u); + return; +} diff --git a/test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.wgsl index 45c6de7c33..ad7e55b77b 100644 --- a/test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/scalar/u32-u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : u32 = 1u; let b : u32 = bitcast(a); diff --git a/test/tint/expressions/bitcast/vector/f32-f32.wgsl b/test/tint/expressions/bitcast/vector/f32-f32.wgsl index 8842275cc3..a8f1759202 100644 --- a/test/tint/expressions/bitcast/vector/f32-f32.wgsl +++ b/test/tint/expressions/bitcast/vector/f32-f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1., 2., 3.); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6ce40345d --- /dev/null +++ b/test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const float3 b = asfloat(a); + return; +} diff --git a/test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.wgsl index 1af19c7ba3..452705cf09 100644 --- a/test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/vector/f32-f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1.0, 2.0, 3.0); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/f32-i32.wgsl b/test/tint/expressions/bitcast/vector/f32-i32.wgsl index 69a8ee6a4e..8a818f0ad8 100644 --- a/test/tint/expressions/bitcast/vector/f32-i32.wgsl +++ b/test/tint/expressions/bitcast/vector/f32-i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1., 2., 3.); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ebeb519e8 --- /dev/null +++ b/test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const int3 b = asint(a); + return; +} diff --git a/test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.wgsl index 6f7c20ec6d..3971ac84fa 100644 --- a/test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/vector/f32-i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1.0, 2.0, 3.0); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/f32-u32.wgsl b/test/tint/expressions/bitcast/vector/f32-u32.wgsl index c478dc8b0e..962f4f92aa 100644 --- a/test/tint/expressions/bitcast/vector/f32-u32.wgsl +++ b/test/tint/expressions/bitcast/vector/f32-u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1., 2., 3.); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9490820770 --- /dev/null +++ b/test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const float3 a = float3(1.0f, 2.0f, 3.0f); + const uint3 b = asuint(a); + return; +} diff --git a/test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.wgsl index d47bade91a..a4acebceb6 100644 --- a/test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/vector/f32-u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1.0, 2.0, 3.0); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/i32-f32.wgsl b/test/tint/expressions/bitcast/vector/i32-f32.wgsl index 7fa9e52851..b71ae34585 100644 --- a/test/tint/expressions/bitcast/vector/i32-f32.wgsl +++ b/test/tint/expressions/bitcast/vector/i32-f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1, 2, 3); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..73bb1187e9 --- /dev/null +++ b/test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const float3 b = asfloat(a); + return; +} diff --git a/test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.wgsl index 424988de59..0026268a58 100644 --- a/test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/vector/i32-f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1, 2, 3); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/i32-i32.wgsl b/test/tint/expressions/bitcast/vector/i32-i32.wgsl index 1b332c6636..2becdf5e5a 100644 --- a/test/tint/expressions/bitcast/vector/i32-i32.wgsl +++ b/test/tint/expressions/bitcast/vector/i32-i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1, 2, 3); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2304f932c2 --- /dev/null +++ b/test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const int3 b = asint(a); + return; +} diff --git a/test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.wgsl index b77a8bfd48..888cba48d1 100644 --- a/test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/vector/i32-i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1, 2, 3); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/i32-u32.wgsl b/test/tint/expressions/bitcast/vector/i32-u32.wgsl index f60a90455c..b0bbe463be 100644 --- a/test/tint/expressions/bitcast/vector/i32-u32.wgsl +++ b/test/tint/expressions/bitcast/vector/i32-u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1, 2, 3); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80e6646d61 --- /dev/null +++ b/test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const int3 a = int3(1, 2, 3); + const uint3 b = asuint(a); + return; +} diff --git a/test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.wgsl index a0d6f73acc..eed5e13cb7 100644 --- a/test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/vector/i32-u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1, 2, 3); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/u32-f32.wgsl b/test/tint/expressions/bitcast/vector/u32-f32.wgsl index 76adfdddf8..362773c38f 100644 --- a/test/tint/expressions/bitcast/vector/u32-f32.wgsl +++ b/test/tint/expressions/bitcast/vector/u32-f32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1u, 2u, 3u); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..72084e94a0 --- /dev/null +++ b/test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const float3 b = asfloat(a); + return; +} diff --git a/test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.wgsl index dd4b3a348f..c4954a8086 100644 --- a/test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/vector/u32-f32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1u, 2u, 3u); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/u32-i32.wgsl b/test/tint/expressions/bitcast/vector/u32-i32.wgsl index 9ae5c29240..a3f6d262a1 100644 --- a/test/tint/expressions/bitcast/vector/u32-i32.wgsl +++ b/test/tint/expressions/bitcast/vector/u32-i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1u, 2u, 3u); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66223231b8 --- /dev/null +++ b/test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const int3 b = asint(a); + return; +} diff --git a/test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.wgsl index 7291adea9e..7539435982 100644 --- a/test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/vector/u32-i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1u, 2u, 3u); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/u32-u32.wgsl b/test/tint/expressions/bitcast/vector/u32-u32.wgsl index 277597db2d..9ee4e82da4 100644 --- a/test/tint/expressions/bitcast/vector/u32-u32.wgsl +++ b/test/tint/expressions/bitcast/vector/u32-u32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1u, 2u, 3u); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.hlsl b/test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.hlsl rename to test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..71f2935211 --- /dev/null +++ b/test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void f() { + const uint3 a = uint3(1u, 2u, 3u); + const uint3 b = asuint(a); + return; +} diff --git a/test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.wgsl b/test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.wgsl index 86d926565f..3296a7abc0 100644 --- a/test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.wgsl +++ b/test/tint/expressions/bitcast/vector/u32-u32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let a : vec3 = vec3(1u, 2u, 3u); let b : vec3 = bitcast>(a); diff --git a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/let/literal/array.wgsl.expected.hlsl rename to test/tint/expressions/index/let/let/literal/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/let/literal/array.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/literal/array.wgsl.expected.hlsl rename to test/tint/expressions/index/let/let/literal/array.wgsl.expected.fxc.hlsl diff --git a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.msl b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.msl index 57bf97dffe..f999fd1a0e 100644 --- a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.msl +++ b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.msl @@ -1,13 +1,22 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; int f() { - tint_array_wrapper const a = {.arr={1, 2, 3, 4, 5, 6, 7, 8}}; + tint_array const a = tint_array{1, 2, 3, 4, 5, 6, 7, 8}; int const i = 1; - return a.arr[i]; + return a[i]; } diff --git a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.spvasm b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.spvasm index 1dc9cdaa63..3530a99728 100644 --- a/test/tint/expressions/index/let/let/literal/array.wgsl.expected.spvasm +++ b/test/tint/expressions/index/let/let/literal/array.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,7 @@ OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpName %unused_entry_point "unused_entry_point" OpName %f "f" + OpName %var_for_index "var_for_index" OpDecorate %_arr_int_uint_8 ArrayStride 4 %void = OpTypeVoid %1 = OpTypeFunction %void @@ -26,12 +27,18 @@ %int_7 = OpConstant %int 7 %int_8 = OpConstant %int 8 %20 = OpConstantComposite %_arr_int_uint_8 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8 +%_ptr_Function__arr_int_uint_8 = OpTypePointer Function %_arr_int_uint_8 + %23 = OpConstantNull %_arr_int_uint_8 +%_ptr_Function_int = OpTypePointer Function %int %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %int None %5 %8 = OpLabel - %21 = OpCompositeExtract %int %20 1 - OpReturnValue %21 +%var_for_index = OpVariable %_ptr_Function__arr_int_uint_8 Function %23 + OpStore %var_for_index %20 + %25 = OpAccessChain %_ptr_Function_int %var_for_index %int_1 + %26 = OpLoad %int %25 + OpReturnValue %26 OpFunctionEnd diff --git a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad2d36bf30 --- /dev/null +++ b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad2d36bf30 --- /dev/null +++ b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.glsl b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.glsl index 2c4e81a602..1b66086685 100644 --- a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.glsl +++ b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } vec3 f() { - mat3 m = mat3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); return m[1]; } diff --git a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.hlsl deleted file mode 100644 index f209d03b56..0000000000 --- a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -float3 f() { - const float3x3 m = float3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); - return m[1]; -} diff --git a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.spvasm b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.spvasm index 0e46829aaf..500165ef61 100644 --- a/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.spvasm +++ b/test/tint/expressions/index/let/let/literal/matrix.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 27 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,7 @@ OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpName %unused_entry_point "unused_entry_point" OpName %f "f" + OpName %var_for_index "var_for_index" %void = OpTypeVoid %1 = OpTypeFunction %void %float = OpTypeFloat 32 @@ -30,12 +31,18 @@ %23 = OpConstantComposite %mat3v3float %14 %18 %22 %int = OpTypeInt 32 1 %int_1 = OpConstant %int 1 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %28 = OpConstantNull %mat3v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %v3float None %5 %9 = OpLabel - %26 = OpCompositeExtract %v3float %23 1 - OpReturnValue %26 +%var_for_index = OpVariable %_ptr_Function_mat3v3float Function %28 + OpStore %var_for_index %23 + %30 = OpAccessChain %_ptr_Function_v3float %var_for_index %int_1 + %31 = OpLoad %v3float %30 + OpReturnValue %31 OpFunctionEnd diff --git a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/let/literal/vector.wgsl.expected.hlsl rename to test/tint/expressions/index/let/let/literal/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/let/literal/vector.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/literal/vector.wgsl.expected.hlsl rename to test/tint/expressions/index/let/let/literal/vector.wgsl.expected.fxc.hlsl diff --git a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.spvasm b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.spvasm index d274e46e20..86157e18e0 100644 --- a/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.spvasm +++ b/test/tint/expressions/index/let/let/literal/vector.wgsl.expected.spvasm @@ -26,6 +26,6 @@ OpFunctionEnd %f = OpFunction %float None %5 %8 = OpLabel - %16 = OpCompositeExtract %float %13 1 + %16 = OpVectorExtractDynamic %float %13 %int_1 OpReturnValue %16 OpFunctionEnd diff --git a/test/tint/expressions/index/let/let/param/array.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/param/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/let/param/array.wgsl.expected.hlsl rename to test/tint/expressions/index/let/let/param/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/let/let/param/array.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/let/param/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..520cdf8768 --- /dev/null +++ b/test/tint/expressions/index/let/let/param/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f(int x) { + const int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; + return a[x]; +} diff --git a/test/tint/expressions/index/let/let/param/array.wgsl.expected.msl b/test/tint/expressions/index/let/let/param/array.wgsl.expected.msl index 7b941e45fe..11906e9481 100644 --- a/test/tint/expressions/index/let/let/param/array.wgsl.expected.msl +++ b/test/tint/expressions/index/let/let/param/array.wgsl.expected.msl @@ -1,13 +1,22 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; int f(int x) { - tint_array_wrapper const a = {.arr={1, 2, 3, 4, 5, 6, 7, 8}}; + tint_array const a = tint_array{1, 2, 3, 4, 5, 6, 7, 8}; int const i = x; - return a.arr[i]; + return a[i]; } diff --git a/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..332312c0bc --- /dev/null +++ b/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f(int x) { + const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[x]; +} diff --git a/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..332312c0bc --- /dev/null +++ b/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f(int x) { + const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[x]; +} diff --git a/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.glsl b/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.glsl index 13e265b8c3..358024a612 100644 --- a/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.glsl +++ b/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } vec3 f(int x) { - mat3 m = mat3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); return m[x]; } diff --git a/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.hlsl deleted file mode 100644 index 9dd1ad7b06..0000000000 --- a/test/tint/expressions/index/let/let/param/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -float3 f(int x) { - const float3x3 m = float3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); - return m[x]; -} diff --git a/test/tint/expressions/index/let/let/param/vector.wgsl.expected.hlsl b/test/tint/expressions/index/let/let/param/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/let/param/vector.wgsl.expected.hlsl rename to test/tint/expressions/index/let/let/param/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/let/let/param/vector.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/let/param/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5629258475 --- /dev/null +++ b/test/tint/expressions/index/let/let/param/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float f(int x) { + const float3 v = float3(1.0f, 2.0f, 3.0f); + return v[x]; +} diff --git a/test/tint/expressions/index/let/literal/array.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/let/literal/array.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7174cfacca --- /dev/null +++ b/test/tint/expressions/index/let/literal/array.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + const int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; + return a[1]; +} diff --git a/test/tint/expressions/index/let/literal/array.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/literal/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7174cfacca --- /dev/null +++ b/test/tint/expressions/index/let/literal/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + const int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; + return a[1]; +} diff --git a/test/tint/expressions/index/let/literal/array.wgsl.expected.msl b/test/tint/expressions/index/let/literal/array.wgsl.expected.msl index d4d28b1529..2196ad9823 100644 --- a/test/tint/expressions/index/let/literal/array.wgsl.expected.msl +++ b/test/tint/expressions/index/let/literal/array.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; int f() { - tint_array_wrapper const a = {.arr={1, 2, 3, 4, 5, 6, 7, 8}}; - return a.arr[1]; + tint_array const a = tint_array{1, 2, 3, 4, 5, 6, 7, 8}; + return a[1]; } diff --git a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad2d36bf30 --- /dev/null +++ b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad2d36bf30 --- /dev/null +++ b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.glsl b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.glsl index 2c4e81a602..1b66086685 100644 --- a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.glsl +++ b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } vec3 f() { - mat3 m = mat3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); return m[1]; } diff --git a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/let/literal/matrix.wgsl.expected.hlsl deleted file mode 100644 index f209d03b56..0000000000 --- a/test/tint/expressions/index/let/literal/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -float3 f() { - const float3x3 m = float3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); - return m[1]; -} diff --git a/test/tint/expressions/index/let/literal/vector.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/let/literal/vector.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ede611872b --- /dev/null +++ b/test/tint/expressions/index/let/literal/vector.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float f() { + const float3 v = float3(1.0f, 2.0f, 3.0f); + return v[1]; +} diff --git a/test/tint/expressions/index/let/literal/vector.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/literal/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ede611872b --- /dev/null +++ b/test/tint/expressions/index/let/literal/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float f() { + const float3 v = float3(1.0f, 2.0f, 3.0f); + return v[1]; +} diff --git a/test/tint/expressions/index/let/param/array.wgsl.expected.hlsl b/test/tint/expressions/index/let/param/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/param/array.wgsl.expected.hlsl rename to test/tint/expressions/index/let/param/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/let/param/array.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/param/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..28830b2165 --- /dev/null +++ b/test/tint/expressions/index/let/param/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f(int i) { + const int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; + return a[i]; +} diff --git a/test/tint/expressions/index/let/param/array.wgsl.expected.msl b/test/tint/expressions/index/let/param/array.wgsl.expected.msl index eac5c4272c..d3bbdaed63 100644 --- a/test/tint/expressions/index/let/param/array.wgsl.expected.msl +++ b/test/tint/expressions/index/let/param/array.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; int f(int i) { - tint_array_wrapper const a = {.arr={1, 2, 3, 4, 5, 6, 7, 8}}; - return a.arr[i]; + tint_array const a = tint_array{1, 2, 3, 4, 5, 6, 7, 8}; + return a[i]; } diff --git a/test/tint/expressions/index/let/param/matrix.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/let/param/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3714c1c0fd --- /dev/null +++ b/test/tint/expressions/index/let/param/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f(int i) { + const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[i]; +} diff --git a/test/tint/expressions/index/let/param/matrix.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/param/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3714c1c0fd --- /dev/null +++ b/test/tint/expressions/index/let/param/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f(int i) { + const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[i]; +} diff --git a/test/tint/expressions/index/let/param/matrix.wgsl.expected.glsl b/test/tint/expressions/index/let/param/matrix.wgsl.expected.glsl index 762d026b70..32c62fc383 100644 --- a/test/tint/expressions/index/let/param/matrix.wgsl.expected.glsl +++ b/test/tint/expressions/index/let/param/matrix.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } vec3 f(int i) { - mat3 m = mat3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); return m[i]; } diff --git a/test/tint/expressions/index/let/param/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/let/param/matrix.wgsl.expected.hlsl deleted file mode 100644 index 5609c2a96d..0000000000 --- a/test/tint/expressions/index/let/param/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -float3 f(int i) { - const float3x3 m = float3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); - return m[i]; -} diff --git a/test/tint/expressions/index/let/param/vector.wgsl.expected.hlsl b/test/tint/expressions/index/let/param/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/param/vector.wgsl.expected.hlsl rename to test/tint/expressions/index/let/param/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/let/param/vector.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/param/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16cccbf289 --- /dev/null +++ b/test/tint/expressions/index/let/param/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float f(int i) { + const float3 v = float3(1.0f, 2.0f, 3.0f); + return v[i]; +} diff --git a/test/tint/expressions/index/let/var/literal/array.wgsl.expected.hlsl b/test/tint/expressions/index/let/var/literal/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/var/literal/array.wgsl.expected.hlsl rename to test/tint/expressions/index/let/var/literal/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/var/let/literal/array.wgsl.expected.hlsl b/test/tint/expressions/index/let/var/literal/array.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/expressions/index/var/let/literal/array.wgsl.expected.hlsl rename to test/tint/expressions/index/let/var/literal/array.wgsl.expected.fxc.hlsl diff --git a/test/tint/expressions/index/let/var/literal/array.wgsl.expected.msl b/test/tint/expressions/index/let/var/literal/array.wgsl.expected.msl index 808c68843f..a435dacadc 100644 --- a/test/tint/expressions/index/let/var/literal/array.wgsl.expected.msl +++ b/test/tint/expressions/index/let/var/literal/array.wgsl.expected.msl @@ -1,13 +1,22 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; int f() { - tint_array_wrapper a = {.arr={1, 2, 3, 4, 5, 6, 7, 8}}; + tint_array a = tint_array{1, 2, 3, 4, 5, 6, 7, 8}; int const i = 1; - return a.arr[i]; + return a[i]; } diff --git a/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b1ea5a0e1 --- /dev/null +++ b/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b1ea5a0e1 --- /dev/null +++ b/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.glsl b/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.glsl index 2c4e81a602..1b66086685 100644 --- a/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.glsl +++ b/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } vec3 f() { - mat3 m = mat3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); return m[1]; } diff --git a/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.hlsl deleted file mode 100644 index 46a799502b..0000000000 --- a/test/tint/expressions/index/let/var/literal/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -float3 f() { - float3x3 m = float3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); - return m[1]; -} diff --git a/test/tint/expressions/index/let/var/literal/vector.wgsl.expected.hlsl b/test/tint/expressions/index/let/var/literal/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/let/var/literal/vector.wgsl.expected.hlsl rename to test/tint/expressions/index/let/var/literal/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/var/let/literal/vector.wgsl.expected.hlsl b/test/tint/expressions/index/let/var/literal/vector.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/expressions/index/var/let/literal/vector.wgsl.expected.hlsl rename to test/tint/expressions/index/let/var/literal/vector.wgsl.expected.fxc.hlsl diff --git a/test/tint/expressions/index/var/literal/array.wgsl.expected.hlsl b/test/tint/expressions/index/var/let/literal/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/var/literal/array.wgsl.expected.hlsl rename to test/tint/expressions/index/var/let/literal/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/var/let/literal/array.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/let/literal/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43387185c0 --- /dev/null +++ b/test/tint/expressions/index/var/let/literal/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; + return a[1]; +} diff --git a/test/tint/expressions/index/var/let/literal/array.wgsl.expected.msl b/test/tint/expressions/index/var/let/literal/array.wgsl.expected.msl index 808c68843f..a435dacadc 100644 --- a/test/tint/expressions/index/var/let/literal/array.wgsl.expected.msl +++ b/test/tint/expressions/index/var/let/literal/array.wgsl.expected.msl @@ -1,13 +1,22 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; int f() { - tint_array_wrapper a = {.arr={1, 2, 3, 4, 5, 6, 7, 8}}; + tint_array a = tint_array{1, 2, 3, 4, 5, 6, 7, 8}; int const i = 1; - return a.arr[i]; + return a[i]; } diff --git a/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b1ea5a0e1 --- /dev/null +++ b/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b1ea5a0e1 --- /dev/null +++ b/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.glsl b/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.glsl index 2c4e81a602..1b66086685 100644 --- a/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.glsl +++ b/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } vec3 f() { - mat3 m = mat3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); return m[1]; } diff --git a/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.hlsl deleted file mode 100644 index 46a799502b..0000000000 --- a/test/tint/expressions/index/var/let/literal/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -float3 f() { - float3x3 m = float3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); - return m[1]; -} diff --git a/test/tint/expressions/index/var/literal/vector.wgsl.expected.hlsl b/test/tint/expressions/index/var/let/literal/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/var/literal/vector.wgsl.expected.hlsl rename to test/tint/expressions/index/var/let/literal/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/var/let/literal/vector.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/let/literal/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7297f63a51 --- /dev/null +++ b/test/tint/expressions/index/var/let/literal/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float f() { + float3 v = float3(1.0f, 2.0f, 3.0f); + return v[1]; +} diff --git a/test/tint/expressions/index/var/let/param/array.wgsl.expected.hlsl b/test/tint/expressions/index/var/let/param/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/var/let/param/array.wgsl.expected.hlsl rename to test/tint/expressions/index/var/let/param/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/var/let/param/array.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/let/param/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..09ebc7d3f4 --- /dev/null +++ b/test/tint/expressions/index/var/let/param/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f(int x) { + int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; + return a[x]; +} diff --git a/test/tint/expressions/index/var/let/param/array.wgsl.expected.msl b/test/tint/expressions/index/var/let/param/array.wgsl.expected.msl index b1e207d53a..970f6178f5 100644 --- a/test/tint/expressions/index/var/let/param/array.wgsl.expected.msl +++ b/test/tint/expressions/index/var/let/param/array.wgsl.expected.msl @@ -1,13 +1,22 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; int f(int x) { - tint_array_wrapper a = {.arr={1, 2, 3, 4, 5, 6, 7, 8}}; + tint_array a = tint_array{1, 2, 3, 4, 5, 6, 7, 8}; int const i = x; - return a.arr[i]; + return a[i]; } diff --git a/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e71fa03f7d --- /dev/null +++ b/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f(int x) { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[x]; +} diff --git a/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e71fa03f7d --- /dev/null +++ b/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f(int x) { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[x]; +} diff --git a/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.glsl b/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.glsl index 13e265b8c3..358024a612 100644 --- a/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.glsl +++ b/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } vec3 f(int x) { - mat3 m = mat3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); return m[x]; } diff --git a/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.hlsl deleted file mode 100644 index 0920c9149f..0000000000 --- a/test/tint/expressions/index/var/let/param/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -float3 f(int x) { - float3x3 m = float3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); - return m[x]; -} diff --git a/test/tint/expressions/index/var/let/param/vector.wgsl.expected.hlsl b/test/tint/expressions/index/var/let/param/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/var/let/param/vector.wgsl.expected.hlsl rename to test/tint/expressions/index/var/let/param/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/var/let/param/vector.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/let/param/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..590b92e92a --- /dev/null +++ b/test/tint/expressions/index/var/let/param/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float f(int x) { + float3 v = float3(1.0f, 2.0f, 3.0f); + return v[x]; +} diff --git a/test/tint/expressions/index/var/literal/array.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/var/literal/array.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..43387185c0 --- /dev/null +++ b/test/tint/expressions/index/var/literal/array.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; + return a[1]; +} diff --git a/test/tint/expressions/index/var/literal/array.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/literal/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43387185c0 --- /dev/null +++ b/test/tint/expressions/index/var/literal/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; + return a[1]; +} diff --git a/test/tint/expressions/index/var/literal/array.wgsl.expected.msl b/test/tint/expressions/index/var/literal/array.wgsl.expected.msl index ae2d9cac5a..5cc2f07134 100644 --- a/test/tint/expressions/index/var/literal/array.wgsl.expected.msl +++ b/test/tint/expressions/index/var/literal/array.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; int f() { - tint_array_wrapper a = {.arr={1, 2, 3, 4, 5, 6, 7, 8}}; - return a.arr[1]; + tint_array a = tint_array{1, 2, 3, 4, 5, 6, 7, 8}; + return a[1]; } diff --git a/test/tint/expressions/index/var/literal/matrix.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/var/literal/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b1ea5a0e1 --- /dev/null +++ b/test/tint/expressions/index/var/literal/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/var/literal/matrix.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/literal/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b1ea5a0e1 --- /dev/null +++ b/test/tint/expressions/index/var/literal/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f() { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[1]; +} diff --git a/test/tint/expressions/index/var/literal/matrix.wgsl.expected.glsl b/test/tint/expressions/index/var/literal/matrix.wgsl.expected.glsl index 2c4e81a602..1b66086685 100644 --- a/test/tint/expressions/index/var/literal/matrix.wgsl.expected.glsl +++ b/test/tint/expressions/index/var/literal/matrix.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } vec3 f() { - mat3 m = mat3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); return m[1]; } diff --git a/test/tint/expressions/index/var/literal/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/var/literal/matrix.wgsl.expected.hlsl deleted file mode 100644 index 46a799502b..0000000000 --- a/test/tint/expressions/index/var/literal/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -float3 f() { - float3x3 m = float3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); - return m[1]; -} diff --git a/test/tint/expressions/index/var/literal/vector.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/var/literal/vector.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7297f63a51 --- /dev/null +++ b/test/tint/expressions/index/var/literal/vector.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float f() { + float3 v = float3(1.0f, 2.0f, 3.0f); + return v[1]; +} diff --git a/test/tint/expressions/index/var/literal/vector.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/literal/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7297f63a51 --- /dev/null +++ b/test/tint/expressions/index/var/literal/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float f() { + float3 v = float3(1.0f, 2.0f, 3.0f); + return v[1]; +} diff --git a/test/tint/expressions/index/var/param/array.wgsl.expected.hlsl b/test/tint/expressions/index/var/param/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/var/param/array.wgsl.expected.hlsl rename to test/tint/expressions/index/var/param/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/var/param/array.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/param/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0e32a075d --- /dev/null +++ b/test/tint/expressions/index/var/param/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f(int i) { + int a[8] = {1, 2, 3, 4, 5, 6, 7, 8}; + return a[i]; +} diff --git a/test/tint/expressions/index/var/param/array.wgsl.expected.msl b/test/tint/expressions/index/var/param/array.wgsl.expected.msl index 9d03b80c37..918a63b5bc 100644 --- a/test/tint/expressions/index/var/param/array.wgsl.expected.msl +++ b/test/tint/expressions/index/var/param/array.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; int f(int i) { - tint_array_wrapper a = {.arr={1, 2, 3, 4, 5, 6, 7, 8}}; - return a.arr[i]; + tint_array a = tint_array{1, 2, 3, 4, 5, 6, 7, 8}; + return a[i]; } diff --git a/test/tint/expressions/index/var/param/matrix.wgsl.expected.dxc.hlsl b/test/tint/expressions/index/var/param/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..724ad8824e --- /dev/null +++ b/test/tint/expressions/index/var/param/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f(int i) { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[i]; +} diff --git a/test/tint/expressions/index/var/param/matrix.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/param/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..724ad8824e --- /dev/null +++ b/test/tint/expressions/index/var/param/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float3 f(int i) { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + return m[i]; +} diff --git a/test/tint/expressions/index/var/param/matrix.wgsl.expected.glsl b/test/tint/expressions/index/var/param/matrix.wgsl.expected.glsl index 762d026b70..32c62fc383 100644 --- a/test/tint/expressions/index/var/param/matrix.wgsl.expected.glsl +++ b/test/tint/expressions/index/var/param/matrix.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } vec3 f(int i) { - mat3 m = mat3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); return m[i]; } diff --git a/test/tint/expressions/index/var/param/matrix.wgsl.expected.hlsl b/test/tint/expressions/index/var/param/matrix.wgsl.expected.hlsl deleted file mode 100644 index 2b104d6ff1..0000000000 --- a/test/tint/expressions/index/var/param/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -float3 f(int i) { - float3x3 m = float3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); - return m[i]; -} diff --git a/test/tint/expressions/index/var/param/vector.wgsl.expected.hlsl b/test/tint/expressions/index/var/param/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/index/var/param/vector.wgsl.expected.hlsl rename to test/tint/expressions/index/var/param/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/index/var/param/vector.wgsl.expected.fxc.hlsl b/test/tint/expressions/index/var/param/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d046c84bdc --- /dev/null +++ b/test/tint/expressions/index/var/param/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float f(int i) { + float3 v = float3(1.0f, 2.0f, 3.0f); + return v[i]; +} diff --git a/test/tint/expressions/literals/-inf.spvasm.expected.dxc.hlsl b/test/tint/expressions/literals/-inf.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..e4f9b252d3 --- /dev/null +++ b/test/tint/expressions/literals/-inf.spvasm.expected.dxc.hlsl @@ -0,0 +1,26 @@ +static float4 out_var_SV_TARGET = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + out_var_SV_TARGET = (asfloat(0xff800000u)).xxxx; + return; +} + +struct main_out { + float4 out_var_SV_TARGET_1; +}; +struct tint_symbol { + float4 out_var_SV_TARGET_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {out_var_SV_TARGET}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.out_var_SV_TARGET_1 = inner_result.out_var_SV_TARGET_1; + return wrapper_result; +} diff --git a/test/tint/expressions/literals/-inf.spvasm.expected.fxc.hlsl b/test/tint/expressions/literals/-inf.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..e4f9b252d3 --- /dev/null +++ b/test/tint/expressions/literals/-inf.spvasm.expected.fxc.hlsl @@ -0,0 +1,26 @@ +static float4 out_var_SV_TARGET = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + out_var_SV_TARGET = (asfloat(0xff800000u)).xxxx; + return; +} + +struct main_out { + float4 out_var_SV_TARGET_1; +}; +struct tint_symbol { + float4 out_var_SV_TARGET_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {out_var_SV_TARGET}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.out_var_SV_TARGET_1 = inner_result.out_var_SV_TARGET_1; + return wrapper_result; +} diff --git a/test/tint/expressions/literals/-inf.spvasm.expected.glsl b/test/tint/expressions/literals/-inf.spvasm.expected.glsl index e1caa5435c..ea4fcf5de4 100644 --- a/test/tint/expressions/literals/-inf.spvasm.expected.glsl +++ b/test/tint/expressions/literals/-inf.spvasm.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; layout(location = 0) out vec4 out_var_SV_TARGET_1_1; vec4 out_var_SV_TARGET = vec4(0.0f, 0.0f, 0.0f, 0.0f); void main_1() { - out_var_SV_TARGET = vec4(uintBitsToFloat(0xff800000u), uintBitsToFloat(0xff800000u), uintBitsToFloat(0xff800000u), uintBitsToFloat(0xff800000u)); + out_var_SV_TARGET = vec4(uintBitsToFloat(0xff800000u)); return; } diff --git a/test/tint/expressions/literals/-inf.spvasm.expected.hlsl b/test/tint/expressions/literals/-inf.spvasm.expected.hlsl deleted file mode 100644 index d5108a6dbc..0000000000 --- a/test/tint/expressions/literals/-inf.spvasm.expected.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -static float4 out_var_SV_TARGET = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - out_var_SV_TARGET = float4(asfloat(0xff800000u), asfloat(0xff800000u), asfloat(0xff800000u), asfloat(0xff800000u)); - return; -} - -struct main_out { - float4 out_var_SV_TARGET_1; -}; -struct tint_symbol { - float4 out_var_SV_TARGET_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {out_var_SV_TARGET}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.out_var_SV_TARGET_1 = inner_result.out_var_SV_TARGET_1; - return wrapper_result; -} diff --git a/test/tint/expressions/literals/-inf.spvasm.expected.msl b/test/tint/expressions/literals/-inf.spvasm.expected.msl index f9c80baa16..561c9a21ad 100644 --- a/test/tint/expressions/literals/-inf.spvasm.expected.msl +++ b/test/tint/expressions/literals/-inf.spvasm.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void main_1(thread float4* const tint_symbol_3) { - *(tint_symbol_3) = float4(-INFINITY, -INFINITY, -INFINITY, -INFINITY); + *(tint_symbol_3) = float4(-INFINITY); return; } diff --git a/test/tint/expressions/literals/-inf.spvasm.expected.wgsl b/test/tint/expressions/literals/-inf.spvasm.expected.wgsl index 2588c6b909..2e063cec22 100644 --- a/test/tint/expressions/literals/-inf.spvasm.expected.wgsl +++ b/test/tint/expressions/literals/-inf.spvasm.expected.wgsl @@ -1,7 +1,7 @@ var out_var_SV_TARGET : vec4; fn main_1() { - out_var_SV_TARGET = vec4(-0x1p+128, -0x1p+128, -0x1p+128, -0x1p+128); + out_var_SV_TARGET = vec4(-0x1p+128f, -0x1p+128f, -0x1p+128f, -0x1p+128f); return; } @@ -10,7 +10,7 @@ struct main_out { out_var_SV_TARGET_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(out_var_SV_TARGET); diff --git a/test/tint/expressions/literals/inf.spvasm.expected.dxc.hlsl b/test/tint/expressions/literals/inf.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..1ce8ff8bc6 --- /dev/null +++ b/test/tint/expressions/literals/inf.spvasm.expected.dxc.hlsl @@ -0,0 +1,26 @@ +static float4 out_var_SV_TARGET = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + out_var_SV_TARGET = (asfloat(0x7f800000u)).xxxx; + return; +} + +struct main_out { + float4 out_var_SV_TARGET_1; +}; +struct tint_symbol { + float4 out_var_SV_TARGET_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {out_var_SV_TARGET}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.out_var_SV_TARGET_1 = inner_result.out_var_SV_TARGET_1; + return wrapper_result; +} diff --git a/test/tint/expressions/literals/inf.spvasm.expected.fxc.hlsl b/test/tint/expressions/literals/inf.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1ce8ff8bc6 --- /dev/null +++ b/test/tint/expressions/literals/inf.spvasm.expected.fxc.hlsl @@ -0,0 +1,26 @@ +static float4 out_var_SV_TARGET = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + out_var_SV_TARGET = (asfloat(0x7f800000u)).xxxx; + return; +} + +struct main_out { + float4 out_var_SV_TARGET_1; +}; +struct tint_symbol { + float4 out_var_SV_TARGET_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {out_var_SV_TARGET}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.out_var_SV_TARGET_1 = inner_result.out_var_SV_TARGET_1; + return wrapper_result; +} diff --git a/test/tint/expressions/literals/inf.spvasm.expected.glsl b/test/tint/expressions/literals/inf.spvasm.expected.glsl index 637b87c984..229678db5b 100644 --- a/test/tint/expressions/literals/inf.spvasm.expected.glsl +++ b/test/tint/expressions/literals/inf.spvasm.expected.glsl @@ -4,7 +4,7 @@ precision mediump float; layout(location = 0) out vec4 out_var_SV_TARGET_1_1; vec4 out_var_SV_TARGET = vec4(0.0f, 0.0f, 0.0f, 0.0f); void main_1() { - out_var_SV_TARGET = vec4(uintBitsToFloat(0x7f800000u), uintBitsToFloat(0x7f800000u), uintBitsToFloat(0x7f800000u), uintBitsToFloat(0x7f800000u)); + out_var_SV_TARGET = vec4(uintBitsToFloat(0x7f800000u)); return; } diff --git a/test/tint/expressions/literals/inf.spvasm.expected.hlsl b/test/tint/expressions/literals/inf.spvasm.expected.hlsl deleted file mode 100644 index 04a77bd70c..0000000000 --- a/test/tint/expressions/literals/inf.spvasm.expected.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -static float4 out_var_SV_TARGET = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - out_var_SV_TARGET = float4(asfloat(0x7f800000u), asfloat(0x7f800000u), asfloat(0x7f800000u), asfloat(0x7f800000u)); - return; -} - -struct main_out { - float4 out_var_SV_TARGET_1; -}; -struct tint_symbol { - float4 out_var_SV_TARGET_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {out_var_SV_TARGET}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.out_var_SV_TARGET_1 = inner_result.out_var_SV_TARGET_1; - return wrapper_result; -} diff --git a/test/tint/expressions/literals/inf.spvasm.expected.msl b/test/tint/expressions/literals/inf.spvasm.expected.msl index 73aca9e91e..95e5c78761 100644 --- a/test/tint/expressions/literals/inf.spvasm.expected.msl +++ b/test/tint/expressions/literals/inf.spvasm.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void main_1(thread float4* const tint_symbol_3) { - *(tint_symbol_3) = float4(INFINITY, INFINITY, INFINITY, INFINITY); + *(tint_symbol_3) = float4(INFINITY); return; } diff --git a/test/tint/expressions/literals/inf.spvasm.expected.wgsl b/test/tint/expressions/literals/inf.spvasm.expected.wgsl index c18af0d9b1..dea7b3bc7e 100644 --- a/test/tint/expressions/literals/inf.spvasm.expected.wgsl +++ b/test/tint/expressions/literals/inf.spvasm.expected.wgsl @@ -1,7 +1,7 @@ var out_var_SV_TARGET : vec4; fn main_1() { - out_var_SV_TARGET = vec4(0x1p+128, 0x1p+128, 0x1p+128, 0x1p+128); + out_var_SV_TARGET = vec4(0x1p+128f, 0x1p+128f, 0x1p+128f, 0x1p+128f); return; } @@ -10,7 +10,7 @@ struct main_out { out_var_SV_TARGET_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(out_var_SV_TARGET); diff --git a/test/tint/expressions/literals/intmin.wgsl.expected.dxc.hlsl b/test/tint/expressions/literals/intmin.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eef47c82b5 --- /dev/null +++ b/test/tint/expressions/literals/intmin.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int add_int_min_explicit() { + int a = -2147483648; + int b = (a + 1); + int c = -2147483647; + return c; +} diff --git a/test/tint/expressions/literals/intmin.wgsl.expected.fxc.hlsl b/test/tint/expressions/literals/intmin.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..eef47c82b5 --- /dev/null +++ b/test/tint/expressions/literals/intmin.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int add_int_min_explicit() { + int a = -2147483648; + int b = (a + 1); + int c = -2147483647; + return c; +} diff --git a/test/tint/expressions/literals/intmin.wgsl.expected.glsl b/test/tint/expressions/literals/intmin.wgsl.expected.glsl index 06eeb7c4c4..410c45d2a7 100644 --- a/test/tint/expressions/literals/intmin.wgsl.expected.glsl +++ b/test/tint/expressions/literals/intmin.wgsl.expected.glsl @@ -7,7 +7,7 @@ void unused_entry_point() { int add_int_min_explicit() { int a = -2147483648; int b = (a + 1); - int c = (-2147483648 + 1); + int c = -2147483647; return c; } diff --git a/test/tint/expressions/literals/intmin.wgsl.expected.hlsl b/test/tint/expressions/literals/intmin.wgsl.expected.hlsl deleted file mode 100644 index 90844e8065..0000000000 --- a/test/tint/expressions/literals/intmin.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -int add_int_min_explicit() { - int a = -2147483648; - int b = (a + 1); - int c = (-2147483648 + 1); - return c; -} diff --git a/test/tint/expressions/literals/intmin.wgsl.expected.msl b/test/tint/expressions/literals/intmin.wgsl.expected.msl index c51ac85827..3910d7808b 100644 --- a/test/tint/expressions/literals/intmin.wgsl.expected.msl +++ b/test/tint/expressions/literals/intmin.wgsl.expected.msl @@ -4,7 +4,7 @@ using namespace metal; int add_int_min_explicit() { int a = (-2147483647 - 1); int b = as_type((as_type(a) + as_type(1))); - int c = as_type((as_type((-2147483647 - 1)) + as_type(1))); + int c = -2147483647; return c; } diff --git a/test/tint/expressions/literals/intmin.wgsl.expected.spvasm b/test/tint/expressions/literals/intmin.wgsl.expected.spvasm index b7eb829642..9ddfafeb10 100644 --- a/test/tint/expressions/literals/intmin.wgsl.expected.spvasm +++ b/test/tint/expressions/literals/intmin.wgsl.expected.spvasm @@ -20,6 +20,7 @@ %_ptr_Function_int = OpTypePointer Function %int %12 = OpConstantNull %int %int_1 = OpConstant %int 1 +%int_n2147483647 = OpConstant %int -2147483647 %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn @@ -33,8 +34,7 @@ %13 = OpLoad %int %a %15 = OpIAdd %int %13 %int_1 OpStore %b %15 - %17 = OpIAdd %int %int_n2147483648 %int_1 - OpStore %c %17 + OpStore %c %int_n2147483647 %19 = OpLoad %int %c OpReturnValue %19 OpFunctionEnd diff --git a/test/tint/expressions/literals/nan.spvasm.expected.hlsl b/test/tint/expressions/literals/nan.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/literals/nan.spvasm.expected.hlsl rename to test/tint/expressions/literals/nan.spvasm.expected.dxc.hlsl diff --git a/test/tint/expressions/literals/nan.spvasm.expected.fxc.hlsl b/test/tint/expressions/literals/nan.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..110eb4066d --- /dev/null +++ b/test/tint/expressions/literals/nan.spvasm.expected.fxc.hlsl @@ -0,0 +1,26 @@ +static float4 out_var_SV_TARGET = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + out_var_SV_TARGET = float4(asfloat(0x7fc00000u), asfloat(0x7fc00000u), asfloat(0x7fc00000u), asfloat(0x7fc00000u)); + return; +} + +struct main_out { + float4 out_var_SV_TARGET_1; +}; +struct tint_symbol { + float4 out_var_SV_TARGET_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {out_var_SV_TARGET}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.out_var_SV_TARGET_1 = inner_result.out_var_SV_TARGET_1; + return wrapper_result; +} diff --git a/test/tint/expressions/literals/nan.spvasm.expected.spvasm b/test/tint/expressions/literals/nan.spvasm.expected.spvasm index c9e283d078..4f6a1247c9 100644 --- a/test/tint/expressions/literals/nan.spvasm.expected.spvasm +++ b/test/tint/expressions/literals/nan.spvasm.expected.spvasm @@ -25,8 +25,8 @@ %out_var_SV_TARGET = OpVariable %_ptr_Private_v4float Private %5 %void = OpTypeVoid %8 = OpTypeFunction %void -%float_0x1_1p_128 = OpConstant %float 0x1.1p+128 - %13 = OpConstantComposite %v4float %float_0x1_1p_128 %float_0x1_1p_128 %float_0x1_1p_128 %float_0x1_1p_128 +%float_0x1_9p_128 = OpConstant %float 0x1.9p+128 + %13 = OpConstantComposite %v4float %float_0x1_9p_128 %float_0x1_9p_128 %float_0x1_9p_128 %float_0x1_9p_128 %main_out = OpTypeStruct %v4float %14 = OpTypeFunction %main_out %main_1 = OpFunction %void None %8 diff --git a/test/tint/expressions/literals/nan.spvasm.expected.wgsl b/test/tint/expressions/literals/nan.spvasm.expected.wgsl index be2a3af17d..922572a034 100644 --- a/test/tint/expressions/literals/nan.spvasm.expected.wgsl +++ b/test/tint/expressions/literals/nan.spvasm.expected.wgsl @@ -1,7 +1,7 @@ var out_var_SV_TARGET : vec4; fn main_1() { - out_var_SV_TARGET = vec4(0x1.1p+128, 0x1.1p+128, 0x1.1p+128, 0x1.1p+128); + out_var_SV_TARGET = vec4(0x1.9p+128f, 0x1.9p+128f, 0x1.9p+128f, 0x1.9p+128f); return; } @@ -10,7 +10,7 @@ struct main_out { out_var_SV_TARGET_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(out_var_SV_TARGET); diff --git a/test/tint/expressions/splat/call/bool.wgsl.expected.hlsl b/test/tint/expressions/splat/call/bool.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/splat/call/bool.wgsl.expected.hlsl rename to test/tint/expressions/splat/call/bool.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/splat/call/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/call/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5a0bf4e6a8 --- /dev/null +++ b/test/tint/expressions/splat/call/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +bool get_bool() { + return true; +} + +void f() { + const bool tint_symbol = get_bool(); + bool2 v2 = bool2((tint_symbol).xx); + const bool tint_symbol_1 = get_bool(); + bool3 v3 = bool3((tint_symbol_1).xxx); + const bool tint_symbol_2 = get_bool(); + bool4 v4 = bool4((tint_symbol_2).xxxx); +} diff --git a/test/tint/expressions/splat/call/f16.wgsl b/test/tint/expressions/splat/call/f16.wgsl new file mode 100644 index 0000000000..f049f4a092 --- /dev/null +++ b/test/tint/expressions/splat/call/f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +fn get_f16() -> f16 { return 1.0h; } + +fn f() { + var v2 : vec2 = vec2(get_f16()); + var v3 : vec3 = vec3(get_f16()); + var v4 : vec4 = vec4(get_f16()); +} diff --git a/test/tint/expressions/splat/call/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/call/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f8fcd250e1 --- /dev/null +++ b/test/tint/expressions/splat/call/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float16_t get_f16() { + return float16_t(1.0h); +} + +void f() { + const float16_t tint_symbol = get_f16(); + vector v2 = vector((tint_symbol).xx); + const float16_t tint_symbol_1 = get_f16(); + vector v3 = vector((tint_symbol_1).xxx); + const float16_t tint_symbol_2 = get_f16(); + vector v4 = vector((tint_symbol_2).xxxx); +} diff --git a/test/tint/expressions/splat/call/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/call/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f8c520895 --- /dev/null +++ b/test/tint/expressions/splat/call/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float16_t get_f16() { + return float16_t(1.0h); +} + +void f() { + const float16_t tint_symbol = get_f16(); + vector v2 = vector((tint_symbol).xx); + const float16_t tint_symbol_1 = get_f16(); + vector v3 = vector((tint_symbol_1).xxx); + const float16_t tint_symbol_2 = get_f16(); + vector v4 = vector((tint_symbol_2).xxxx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001EAED2412C0(6,1-9): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/splat/call/f16.wgsl.expected.glsl b/test/tint/expressions/splat/call/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..25138a65bd --- /dev/null +++ b/test/tint/expressions/splat/call/f16.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t get_f16() { + return 1.0hf; +} + +void f() { + float16_t tint_symbol = get_f16(); + f16vec2 v2 = f16vec2(tint_symbol); + float16_t tint_symbol_1 = get_f16(); + f16vec3 v3 = f16vec3(tint_symbol_1); + float16_t tint_symbol_2 = get_f16(); + f16vec4 v4 = f16vec4(tint_symbol_2); +} + diff --git a/test/tint/expressions/splat/call/f16.wgsl.expected.msl b/test/tint/expressions/splat/call/f16.wgsl.expected.msl new file mode 100644 index 0000000000..ee386160b5 --- /dev/null +++ b/test/tint/expressions/splat/call/f16.wgsl.expected.msl @@ -0,0 +1,16 @@ +#include + +using namespace metal; +half get_f16() { + return 1.0h; +} + +void f() { + half const tint_symbol = get_f16(); + half2 v2 = half2(tint_symbol); + half const tint_symbol_1 = get_f16(); + half3 v3 = half3(tint_symbol_1); + half const tint_symbol_2 = get_f16(); + half4 v4 = half4(tint_symbol_2); +} + diff --git a/test/tint/expressions/splat/call/f16.wgsl.expected.spvasm b/test/tint/expressions/splat/call/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..5870499130 --- /dev/null +++ b/test/tint/expressions/splat/call/f16.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %get_f16 "get_f16" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %5 = OpTypeFunction %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %v2half = OpTypeVector %half 2 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %17 = OpConstantNull %v2half + %v3half = OpTypeVector %half 3 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %23 = OpConstantNull %v3half + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %29 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %get_f16 = OpFunction %half None %5 + %8 = OpLabel + OpReturnValue %half_0x1p_0 + OpFunctionEnd + %f = OpFunction %void None %1 + %11 = OpLabel + %v2 = OpVariable %_ptr_Function_v2half Function %17 + %v3 = OpVariable %_ptr_Function_v3half Function %23 + %v4 = OpVariable %_ptr_Function_v4half Function %29 + %12 = OpFunctionCall %half %get_f16 + %14 = OpCompositeConstruct %v2half %12 %12 + OpStore %v2 %14 + %18 = OpFunctionCall %half %get_f16 + %20 = OpCompositeConstruct %v3half %18 %18 %18 + OpStore %v3 %20 + %24 = OpFunctionCall %half %get_f16 + %26 = OpCompositeConstruct %v4half %24 %24 %24 %24 + OpStore %v4 %26 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/splat/call/f16.wgsl.expected.wgsl b/test/tint/expressions/splat/call/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..3cdca121e4 --- /dev/null +++ b/test/tint/expressions/splat/call/f16.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +enable f16; + +fn get_f16() -> f16 { + return 1.0h; +} + +fn f() { + var v2 : vec2 = vec2(get_f16()); + var v3 : vec3 = vec3(get_f16()); + var v4 : vec4 = vec4(get_f16()); +} diff --git a/test/tint/expressions/splat/call/f32.wgsl.expected.hlsl b/test/tint/expressions/splat/call/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/splat/call/f32.wgsl.expected.hlsl rename to test/tint/expressions/splat/call/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/splat/call/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/call/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..541bccfbdd --- /dev/null +++ b/test/tint/expressions/splat/call/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +float get_f32() { + return 1.0f; +} + +void f() { + const float tint_symbol = get_f32(); + float2 v2 = float2((tint_symbol).xx); + const float tint_symbol_1 = get_f32(); + float3 v3 = float3((tint_symbol_1).xxx); + const float tint_symbol_2 = get_f32(); + float4 v4 = float4((tint_symbol_2).xxxx); +} diff --git a/test/tint/expressions/splat/call/i32.wgsl.expected.hlsl b/test/tint/expressions/splat/call/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/splat/call/i32.wgsl.expected.hlsl rename to test/tint/expressions/splat/call/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/splat/call/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/call/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b4334fef41 --- /dev/null +++ b/test/tint/expressions/splat/call/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int get_i32() { + return 1; +} + +void f() { + const int tint_symbol = get_i32(); + int2 v2 = int2((tint_symbol).xx); + const int tint_symbol_1 = get_i32(); + int3 v3 = int3((tint_symbol_1).xxx); + const int tint_symbol_2 = get_i32(); + int4 v4 = int4((tint_symbol_2).xxxx); +} diff --git a/test/tint/expressions/splat/call/u32.wgsl.expected.hlsl b/test/tint/expressions/splat/call/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/splat/call/u32.wgsl.expected.hlsl rename to test/tint/expressions/splat/call/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/splat/call/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/call/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0e7dc61757 --- /dev/null +++ b/test/tint/expressions/splat/call/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +uint get_u32() { + return 1u; +} + +void f() { + const uint tint_symbol = get_u32(); + uint2 v2 = uint2((tint_symbol).xx); + const uint tint_symbol_1 = get_u32(); + uint3 v3 = uint3((tint_symbol_1).xxx); + const uint tint_symbol_2 = get_u32(); + uint4 v4 = uint4((tint_symbol_2).xxxx); +} diff --git a/test/tint/expressions/splat/expression/bool.wgsl.expected.hlsl b/test/tint/expressions/splat/expression/bool.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/splat/expression/bool.wgsl.expected.hlsl rename to test/tint/expressions/splat/expression/bool.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/splat/expression/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/expression/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..544f39d0ef --- /dev/null +++ b/test/tint/expressions/splat/expression/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool tint_tmp = true; + if (!tint_tmp) { + tint_tmp = false; + } + bool2 v2 = bool2(((tint_tmp)).xx); + bool tint_tmp_1 = true; + if (!tint_tmp_1) { + tint_tmp_1 = false; + } + bool3 v3 = bool3(((tint_tmp_1)).xxx); + bool tint_tmp_2 = true; + if (!tint_tmp_2) { + tint_tmp_2 = false; + } + bool4 v4 = bool4(((tint_tmp_2)).xxxx); +} diff --git a/test/tint/expressions/splat/expression/bool.wgsl.expected.spvasm b/test/tint/expressions/splat/expression/bool.wgsl.expected.spvasm index 7a6eb60e97..8bf9fa114e 100644 --- a/test/tint/expressions/splat/expression/bool.wgsl.expected.spvasm +++ b/test/tint/expressions/splat/expression/bool.wgsl.expected.spvasm @@ -17,7 +17,7 @@ %bool = OpTypeBool %v2bool = OpTypeVector %bool 2 %true = OpConstantTrue %bool - %false = OpConstantFalse %bool + %12 = OpConstantNull %bool %_ptr_Function_v2bool = OpTypePointer Function %v2bool %17 = OpConstantNull %v2bool %v3bool = OpTypeVector %bool 3 @@ -40,7 +40,7 @@ %11 = OpLabel OpBranch %10 %10 = OpLabel - %13 = OpPhi %bool %true %6 %false %11 + %13 = OpPhi %bool %true %6 %12 %11 %14 = OpCompositeConstruct %v2bool %13 %13 OpStore %v2 %14 OpSelectionMerge %19 None @@ -48,7 +48,7 @@ %20 = OpLabel OpBranch %19 %19 = OpLabel - %21 = OpPhi %bool %true %10 %false %20 + %21 = OpPhi %bool %true %10 %12 %20 %22 = OpCompositeConstruct %v3bool %21 %21 %21 OpStore %v3 %22 OpSelectionMerge %27 None @@ -56,7 +56,7 @@ %28 = OpLabel OpBranch %27 %27 = OpLabel - %29 = OpPhi %bool %true %19 %false %28 + %29 = OpPhi %bool %true %19 %12 %28 %30 = OpCompositeConstruct %v4bool %29 %29 %29 %29 OpStore %v4 %30 OpReturn diff --git a/test/tint/expressions/splat/expression/f16.wgsl b/test/tint/expressions/splat/expression/f16.wgsl new file mode 100644 index 0000000000..588abdede4 --- /dev/null +++ b/test/tint/expressions/splat/expression/f16.wgsl @@ -0,0 +1,6 @@ +enable f16; +fn f() { + var v2 : vec2 = vec2(1.0h + 2.0h); + var v3 : vec3 = vec3(1.0h + 2.0h); + var v4 : vec4 = vec4(1.0h + 2.0h); +} diff --git a/test/tint/expressions/splat/expression/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/expression/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0635dcb2fd --- /dev/null +++ b/test/tint/expressions/splat/expression/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v2 = (float16_t(3.0h)).xx; + vector v3 = (float16_t(3.0h)).xxx; + vector v4 = (float16_t(3.0h)).xxxx; +} diff --git a/test/tint/expressions/splat/expression/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/expression/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0527080cdd --- /dev/null +++ b/test/tint/expressions/splat/expression/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v2 = vector(((float16_t(1.0h) + float16_t(2.0h))).xx); + vector v3 = vector(((float16_t(1.0h) + float16_t(2.0h))).xxx); + vector v4 = vector(((float16_t(1.0h) + float16_t(2.0h))).xxxx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002661C202C10(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002661C202C10(8,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002661C202C10(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/splat/expression/f16.wgsl.expected.glsl b/test/tint/expressions/splat/expression/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..6b832129d6 --- /dev/null +++ b/test/tint/expressions/splat/expression/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16vec2 v2 = f16vec2(3.0hf); + f16vec3 v3 = f16vec3(3.0hf); + f16vec4 v4 = f16vec4(3.0hf); +} + diff --git a/test/tint/expressions/splat/expression/f16.wgsl.expected.msl b/test/tint/expressions/splat/expression/f16.wgsl.expected.msl new file mode 100644 index 0000000000..6ce49cd97b --- /dev/null +++ b/test/tint/expressions/splat/expression/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + half2 v2 = half2(3.0h); + half3 v3 = half3(3.0h); + half4 v4 = half4(3.0h); +} + diff --git a/test/tint/expressions/splat/expression/f16.wgsl.expected.spvasm b/test/tint/expressions/splat/expression/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..629dfca5fa --- /dev/null +++ b/test/tint/expressions/splat/expression/f16.wgsl.expected.spvasm @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %10 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1_8p_1 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %13 = OpConstantNull %v2half + %v3half = OpTypeVector %half 3 + %15 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1_8p_1 %half_0x1_8p_1 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %18 = OpConstantNull %v3half + %v4half = OpTypeVector %half 4 + %20 = OpConstantComposite %v4half %half_0x1_8p_1 %half_0x1_8p_1 %half_0x1_8p_1 %half_0x1_8p_1 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %23 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2half Function %13 + %v3 = OpVariable %_ptr_Function_v3half Function %18 + %v4 = OpVariable %_ptr_Function_v4half Function %23 + OpStore %v2 %10 + OpStore %v3 %15 + OpStore %v4 %20 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/splat/expression/f16.wgsl.expected.wgsl b/test/tint/expressions/splat/expression/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b22311dccf --- /dev/null +++ b/test/tint/expressions/splat/expression/f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +fn f() { + var v2 : vec2 = vec2((1.0h + 2.0h)); + var v3 : vec3 = vec3((1.0h + 2.0h)); + var v4 : vec4 = vec4((1.0h + 2.0h)); +} diff --git a/test/tint/expressions/splat/expression/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/expression/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..399b318407 --- /dev/null +++ b/test/tint/expressions/splat/expression/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2 v2 = (3.0f).xx; + float3 v3 = (3.0f).xxx; + float4 v4 = (3.0f).xxxx; +} diff --git a/test/tint/expressions/splat/expression/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/expression/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..399b318407 --- /dev/null +++ b/test/tint/expressions/splat/expression/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2 v2 = (3.0f).xx; + float3 v3 = (3.0f).xxx; + float4 v4 = (3.0f).xxxx; +} diff --git a/test/tint/expressions/splat/expression/f32.wgsl.expected.glsl b/test/tint/expressions/splat/expression/f32.wgsl.expected.glsl index 2efc43d677..8952aadc5d 100644 --- a/test/tint/expressions/splat/expression/f32.wgsl.expected.glsl +++ b/test/tint/expressions/splat/expression/f32.wgsl.expected.glsl @@ -5,8 +5,8 @@ void unused_entry_point() { return; } void f() { - vec2 v2 = vec2((1.0f + 2.0f)); - vec3 v3 = vec3((1.0f + 2.0f)); - vec4 v4 = vec4((1.0f + 2.0f)); + vec2 v2 = vec2(3.0f); + vec3 v3 = vec3(3.0f); + vec4 v4 = vec4(3.0f); } diff --git a/test/tint/expressions/splat/expression/f32.wgsl.expected.hlsl b/test/tint/expressions/splat/expression/f32.wgsl.expected.hlsl deleted file mode 100644 index 9ed6e5ab17..0000000000 --- a/test/tint/expressions/splat/expression/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float2 v2 = float2(((1.0f + 2.0f)).xx); - float3 v3 = float3(((1.0f + 2.0f)).xxx); - float4 v4 = float4(((1.0f + 2.0f)).xxxx); -} diff --git a/test/tint/expressions/splat/expression/f32.wgsl.expected.msl b/test/tint/expressions/splat/expression/f32.wgsl.expected.msl index 9dd8768fb6..691c7e399d 100644 --- a/test/tint/expressions/splat/expression/f32.wgsl.expected.msl +++ b/test/tint/expressions/splat/expression/f32.wgsl.expected.msl @@ -2,8 +2,8 @@ using namespace metal; void f() { - float2 v2 = float2((1.0f + 2.0f)); - float3 v3 = float3((1.0f + 2.0f)); - float4 v4 = float4((1.0f + 2.0f)); + float2 v2 = float2(3.0f); + float3 v3 = float3(3.0f); + float4 v4 = float4(3.0f); } diff --git a/test/tint/expressions/splat/expression/f32.wgsl.expected.spvasm b/test/tint/expressions/splat/expression/f32.wgsl.expected.spvasm index 286c6bace5..7e44ab8340 100644 --- a/test/tint/expressions/splat/expression/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/splat/expression/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,33 +16,29 @@ %1 = OpTypeFunction %void %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 - %float_1 = OpConstant %float 1 - %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %10 = OpConstantComposite %v2float %float_3 %float_3 %_ptr_Function_v2float = OpTypePointer Function %v2float - %15 = OpConstantNull %v2float + %13 = OpConstantNull %v2float %v3float = OpTypeVector %float 3 + %15 = OpConstantComposite %v3float %float_3 %float_3 %float_3 %_ptr_Function_v3float = OpTypePointer Function %v3float - %21 = OpConstantNull %v3float + %18 = OpConstantNull %v3float %v4float = OpTypeVector %float 4 + %20 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 %_ptr_Function_v4float = OpTypePointer Function %v4float - %27 = OpConstantNull %v4float + %23 = OpConstantNull %v4float %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %v2 = OpVariable %_ptr_Function_v2float Function %15 - %v3 = OpVariable %_ptr_Function_v3float Function %21 - %v4 = OpVariable %_ptr_Function_v4float Function %27 - %11 = OpFAdd %float %float_1 %float_2 - %12 = OpCompositeConstruct %v2float %11 %11 - OpStore %v2 %12 - %17 = OpFAdd %float %float_1 %float_2 - %18 = OpCompositeConstruct %v3float %17 %17 %17 - OpStore %v3 %18 - %23 = OpFAdd %float %float_1 %float_2 - %24 = OpCompositeConstruct %v4float %23 %23 %23 %23 - OpStore %v4 %24 + %v2 = OpVariable %_ptr_Function_v2float Function %13 + %v3 = OpVariable %_ptr_Function_v3float Function %18 + %v4 = OpVariable %_ptr_Function_v4float Function %23 + OpStore %v2 %10 + OpStore %v3 %15 + OpStore %v4 %20 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/splat/expression/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/expression/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21fee65307 --- /dev/null +++ b/test/tint/expressions/splat/expression/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int2 v2 = (3).xx; + int3 v3 = (3).xxx; + int4 v4 = (3).xxxx; +} diff --git a/test/tint/expressions/splat/expression/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/expression/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21fee65307 --- /dev/null +++ b/test/tint/expressions/splat/expression/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int2 v2 = (3).xx; + int3 v3 = (3).xxx; + int4 v4 = (3).xxxx; +} diff --git a/test/tint/expressions/splat/expression/i32.wgsl.expected.glsl b/test/tint/expressions/splat/expression/i32.wgsl.expected.glsl index aec2f1dc24..3e05824b61 100644 --- a/test/tint/expressions/splat/expression/i32.wgsl.expected.glsl +++ b/test/tint/expressions/splat/expression/i32.wgsl.expected.glsl @@ -5,8 +5,8 @@ void unused_entry_point() { return; } void f() { - ivec2 v2 = ivec2((1 + 2)); - ivec3 v3 = ivec3((1 + 2)); - ivec4 v4 = ivec4((1 + 2)); + ivec2 v2 = ivec2(3); + ivec3 v3 = ivec3(3); + ivec4 v4 = ivec4(3); } diff --git a/test/tint/expressions/splat/expression/i32.wgsl.expected.hlsl b/test/tint/expressions/splat/expression/i32.wgsl.expected.hlsl deleted file mode 100644 index 1a1fa76f6a..0000000000 --- a/test/tint/expressions/splat/expression/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - int2 v2 = int2(((1 + 2)).xx); - int3 v3 = int3(((1 + 2)).xxx); - int4 v4 = int4(((1 + 2)).xxxx); -} diff --git a/test/tint/expressions/splat/expression/i32.wgsl.expected.msl b/test/tint/expressions/splat/expression/i32.wgsl.expected.msl index afbc9b28ba..9fbac03820 100644 --- a/test/tint/expressions/splat/expression/i32.wgsl.expected.msl +++ b/test/tint/expressions/splat/expression/i32.wgsl.expected.msl @@ -2,8 +2,8 @@ using namespace metal; void f() { - int2 v2 = int2(as_type((as_type(1) + as_type(2)))); - int3 v3 = int3(as_type((as_type(1) + as_type(2)))); - int4 v4 = int4(as_type((as_type(1) + as_type(2)))); + int2 v2 = int2(3); + int3 v3 = int3(3); + int4 v4 = int4(3); } diff --git a/test/tint/expressions/splat/expression/i32.wgsl.expected.spvasm b/test/tint/expressions/splat/expression/i32.wgsl.expected.spvasm index 83c14c2da8..a6e58e03ad 100644 --- a/test/tint/expressions/splat/expression/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/splat/expression/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,33 +16,29 @@ %1 = OpTypeFunction %void %int = OpTypeInt 32 1 %v2int = OpTypeVector %int 2 - %int_1 = OpConstant %int 1 - %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %10 = OpConstantComposite %v2int %int_3 %int_3 %_ptr_Function_v2int = OpTypePointer Function %v2int - %15 = OpConstantNull %v2int + %13 = OpConstantNull %v2int %v3int = OpTypeVector %int 3 + %15 = OpConstantComposite %v3int %int_3 %int_3 %int_3 %_ptr_Function_v3int = OpTypePointer Function %v3int - %21 = OpConstantNull %v3int + %18 = OpConstantNull %v3int %v4int = OpTypeVector %int 4 + %20 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3 %_ptr_Function_v4int = OpTypePointer Function %v4int - %27 = OpConstantNull %v4int + %23 = OpConstantNull %v4int %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %v2 = OpVariable %_ptr_Function_v2int Function %15 - %v3 = OpVariable %_ptr_Function_v3int Function %21 - %v4 = OpVariable %_ptr_Function_v4int Function %27 - %11 = OpIAdd %int %int_1 %int_2 - %12 = OpCompositeConstruct %v2int %11 %11 - OpStore %v2 %12 - %17 = OpIAdd %int %int_1 %int_2 - %18 = OpCompositeConstruct %v3int %17 %17 %17 - OpStore %v3 %18 - %23 = OpIAdd %int %int_1 %int_2 - %24 = OpCompositeConstruct %v4int %23 %23 %23 %23 - OpStore %v4 %24 + %v2 = OpVariable %_ptr_Function_v2int Function %13 + %v3 = OpVariable %_ptr_Function_v3int Function %18 + %v4 = OpVariable %_ptr_Function_v4int Function %23 + OpStore %v2 %10 + OpStore %v3 %15 + OpStore %v4 %20 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/splat/expression/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/expression/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a1689f7263 --- /dev/null +++ b/test/tint/expressions/splat/expression/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint2 v2 = (3u).xx; + uint3 v3 = (3u).xxx; + uint4 v4 = (3u).xxxx; +} diff --git a/test/tint/expressions/splat/expression/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/expression/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1689f7263 --- /dev/null +++ b/test/tint/expressions/splat/expression/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint2 v2 = (3u).xx; + uint3 v3 = (3u).xxx; + uint4 v4 = (3u).xxxx; +} diff --git a/test/tint/expressions/splat/expression/u32.wgsl.expected.glsl b/test/tint/expressions/splat/expression/u32.wgsl.expected.glsl index b88947064f..004883ea02 100644 --- a/test/tint/expressions/splat/expression/u32.wgsl.expected.glsl +++ b/test/tint/expressions/splat/expression/u32.wgsl.expected.glsl @@ -5,8 +5,8 @@ void unused_entry_point() { return; } void f() { - uvec2 v2 = uvec2((1u + 2u)); - uvec3 v3 = uvec3((1u + 2u)); - uvec4 v4 = uvec4((1u + 2u)); + uvec2 v2 = uvec2(3u); + uvec3 v3 = uvec3(3u); + uvec4 v4 = uvec4(3u); } diff --git a/test/tint/expressions/splat/expression/u32.wgsl.expected.hlsl b/test/tint/expressions/splat/expression/u32.wgsl.expected.hlsl deleted file mode 100644 index afbc8e2e88..0000000000 --- a/test/tint/expressions/splat/expression/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - uint2 v2 = uint2(((1u + 2u)).xx); - uint3 v3 = uint3(((1u + 2u)).xxx); - uint4 v4 = uint4(((1u + 2u)).xxxx); -} diff --git a/test/tint/expressions/splat/expression/u32.wgsl.expected.msl b/test/tint/expressions/splat/expression/u32.wgsl.expected.msl index 0bec34dd33..1d35ae0658 100644 --- a/test/tint/expressions/splat/expression/u32.wgsl.expected.msl +++ b/test/tint/expressions/splat/expression/u32.wgsl.expected.msl @@ -2,8 +2,8 @@ using namespace metal; void f() { - uint2 v2 = uint2((1u + 2u)); - uint3 v3 = uint3((1u + 2u)); - uint4 v4 = uint4((1u + 2u)); + uint2 v2 = uint2(3u); + uint3 v3 = uint3(3u); + uint4 v4 = uint4(3u); } diff --git a/test/tint/expressions/splat/expression/u32.wgsl.expected.spvasm b/test/tint/expressions/splat/expression/u32.wgsl.expected.spvasm index 209c60ed3e..459d127a0f 100644 --- a/test/tint/expressions/splat/expression/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/splat/expression/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,33 +16,29 @@ %1 = OpTypeFunction %void %uint = OpTypeInt 32 0 %v2uint = OpTypeVector %uint 2 - %uint_1 = OpConstant %uint 1 - %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %10 = OpConstantComposite %v2uint %uint_3 %uint_3 %_ptr_Function_v2uint = OpTypePointer Function %v2uint - %15 = OpConstantNull %v2uint + %13 = OpConstantNull %v2uint %v3uint = OpTypeVector %uint 3 + %15 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %21 = OpConstantNull %v3uint + %18 = OpConstantNull %v3uint %v4uint = OpTypeVector %uint 4 + %20 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3 %_ptr_Function_v4uint = OpTypePointer Function %v4uint - %27 = OpConstantNull %v4uint + %23 = OpConstantNull %v4uint %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %v2 = OpVariable %_ptr_Function_v2uint Function %15 - %v3 = OpVariable %_ptr_Function_v3uint Function %21 - %v4 = OpVariable %_ptr_Function_v4uint Function %27 - %11 = OpIAdd %uint %uint_1 %uint_2 - %12 = OpCompositeConstruct %v2uint %11 %11 - OpStore %v2 %12 - %17 = OpIAdd %uint %uint_1 %uint_2 - %18 = OpCompositeConstruct %v3uint %17 %17 %17 - OpStore %v3 %18 - %23 = OpIAdd %uint %uint_1 %uint_2 - %24 = OpCompositeConstruct %v4uint %23 %23 %23 %23 - OpStore %v4 %24 + %v2 = OpVariable %_ptr_Function_v2uint Function %13 + %v3 = OpVariable %_ptr_Function_v3uint Function %18 + %v4 = OpVariable %_ptr_Function_v4uint Function %23 + OpStore %v2 %10 + OpStore %v3 %15 + OpStore %v4 %20 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/splat/immediate/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/immediate/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ee704106c --- /dev/null +++ b/test/tint/expressions/splat/immediate/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool2 v2 = (true).xx; + bool3 v3 = (true).xxx; + bool4 v4 = (true).xxxx; +} diff --git a/test/tint/expressions/splat/immediate/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/immediate/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ee704106c --- /dev/null +++ b/test/tint/expressions/splat/immediate/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool2 v2 = (true).xx; + bool3 v3 = (true).xxx; + bool4 v4 = (true).xxxx; +} diff --git a/test/tint/expressions/splat/immediate/bool.wgsl.expected.hlsl b/test/tint/expressions/splat/immediate/bool.wgsl.expected.hlsl deleted file mode 100644 index c00d526492..0000000000 --- a/test/tint/expressions/splat/immediate/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - bool2 v2 = bool2((true).xx); - bool3 v3 = bool3((true).xxx); - bool4 v4 = bool4((true).xxxx); -} diff --git a/test/tint/expressions/splat/immediate/f16.wgsl b/test/tint/expressions/splat/immediate/f16.wgsl new file mode 100644 index 0000000000..453d42f8e1 --- /dev/null +++ b/test/tint/expressions/splat/immediate/f16.wgsl @@ -0,0 +1,6 @@ +enable f16; +fn f() { + var v2 : vec2 = vec2(1.0h); + var v3 : vec3 = vec3(1.0h); + var v4 : vec4 = vec4(1.0h); +} diff --git a/test/tint/expressions/splat/immediate/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/immediate/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8104a42983 --- /dev/null +++ b/test/tint/expressions/splat/immediate/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v2 = (float16_t(1.0h)).xx; + vector v3 = (float16_t(1.0h)).xxx; + vector v4 = (float16_t(1.0h)).xxxx; +} diff --git a/test/tint/expressions/splat/immediate/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/immediate/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b8d6512ed0 --- /dev/null +++ b/test/tint/expressions/splat/immediate/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v2 = (float16_t(1.0h)).xx; + vector v3 = (float16_t(1.0h)).xxx; + vector v4 = (float16_t(1.0h)).xxxx; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023F6A192800(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023F6A192800(8,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023F6A192800(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/splat/immediate/f16.wgsl.expected.glsl b/test/tint/expressions/splat/immediate/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..3ae021d84f --- /dev/null +++ b/test/tint/expressions/splat/immediate/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16vec2 v2 = f16vec2(1.0hf); + f16vec3 v3 = f16vec3(1.0hf); + f16vec4 v4 = f16vec4(1.0hf); +} + diff --git a/test/tint/expressions/splat/immediate/f16.wgsl.expected.msl b/test/tint/expressions/splat/immediate/f16.wgsl.expected.msl new file mode 100644 index 0000000000..b5608c7d93 --- /dev/null +++ b/test/tint/expressions/splat/immediate/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + half2 v2 = half2(1.0h); + half3 v3 = half3(1.0h); + half4 v4 = half4(1.0h); +} + diff --git a/test/tint/expressions/splat/immediate/f16.wgsl.expected.spvasm b/test/tint/expressions/splat/immediate/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2a3b6746d --- /dev/null +++ b/test/tint/expressions/splat/immediate/f16.wgsl.expected.spvasm @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %10 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %13 = OpConstantNull %v2half + %v3half = OpTypeVector %half 3 + %15 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %18 = OpConstantNull %v3half + %v4half = OpTypeVector %half 4 + %20 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %23 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v2 = OpVariable %_ptr_Function_v2half Function %13 + %v3 = OpVariable %_ptr_Function_v3half Function %18 + %v4 = OpVariable %_ptr_Function_v4half Function %23 + OpStore %v2 %10 + OpStore %v3 %15 + OpStore %v4 %20 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/splat/immediate/f16.wgsl.expected.wgsl b/test/tint/expressions/splat/immediate/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..d9d31e6925 --- /dev/null +++ b/test/tint/expressions/splat/immediate/f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +fn f() { + var v2 : vec2 = vec2(1.0h); + var v3 : vec3 = vec3(1.0h); + var v4 : vec4 = vec4(1.0h); +} diff --git a/test/tint/expressions/splat/immediate/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/immediate/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8efc94d4c3 --- /dev/null +++ b/test/tint/expressions/splat/immediate/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2 v2 = (1.0f).xx; + float3 v3 = (1.0f).xxx; + float4 v4 = (1.0f).xxxx; +} diff --git a/test/tint/expressions/splat/immediate/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/immediate/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8efc94d4c3 --- /dev/null +++ b/test/tint/expressions/splat/immediate/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2 v2 = (1.0f).xx; + float3 v3 = (1.0f).xxx; + float4 v4 = (1.0f).xxxx; +} diff --git a/test/tint/expressions/splat/immediate/f32.wgsl.expected.hlsl b/test/tint/expressions/splat/immediate/f32.wgsl.expected.hlsl deleted file mode 100644 index c757ba2ce3..0000000000 --- a/test/tint/expressions/splat/immediate/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float2 v2 = float2((1.0f).xx); - float3 v3 = float3((1.0f).xxx); - float4 v4 = float4((1.0f).xxxx); -} diff --git a/test/tint/expressions/splat/immediate/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/immediate/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7d6156280d --- /dev/null +++ b/test/tint/expressions/splat/immediate/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int2 v2 = (1).xx; + int3 v3 = (1).xxx; + int4 v4 = (1).xxxx; +} diff --git a/test/tint/expressions/splat/immediate/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/immediate/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7d6156280d --- /dev/null +++ b/test/tint/expressions/splat/immediate/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int2 v2 = (1).xx; + int3 v3 = (1).xxx; + int4 v4 = (1).xxxx; +} diff --git a/test/tint/expressions/splat/immediate/i32.wgsl.expected.hlsl b/test/tint/expressions/splat/immediate/i32.wgsl.expected.hlsl deleted file mode 100644 index 7598cd0283..0000000000 --- a/test/tint/expressions/splat/immediate/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - int2 v2 = int2((1).xx); - int3 v3 = int3((1).xxx); - int4 v4 = int4((1).xxxx); -} diff --git a/test/tint/expressions/splat/immediate/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/immediate/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..44f0407422 --- /dev/null +++ b/test/tint/expressions/splat/immediate/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint2 v2 = (1u).xx; + uint3 v3 = (1u).xxx; + uint4 v4 = (1u).xxxx; +} diff --git a/test/tint/expressions/splat/immediate/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/immediate/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44f0407422 --- /dev/null +++ b/test/tint/expressions/splat/immediate/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint2 v2 = (1u).xx; + uint3 v3 = (1u).xxx; + uint4 v4 = (1u).xxxx; +} diff --git a/test/tint/expressions/splat/immediate/u32.wgsl.expected.hlsl b/test/tint/expressions/splat/immediate/u32.wgsl.expected.hlsl deleted file mode 100644 index 3bb8b1fa9a..0000000000 --- a/test/tint/expressions/splat/immediate/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - uint2 v2 = uint2((1u).xx); - uint3 v3 = uint3((1u).xxx); - uint4 v4 = uint4((1u).xxxx); -} diff --git a/test/tint/expressions/splat/var/bool.wgsl.expected.hlsl b/test/tint/expressions/splat/var/bool.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/splat/var/bool.wgsl.expected.hlsl rename to test/tint/expressions/splat/var/bool.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/splat/var/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/var/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..76b97e29d8 --- /dev/null +++ b/test/tint/expressions/splat/var/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool tint_tmp = true; + if (!tint_tmp) { + tint_tmp = false; + } + bool v = (tint_tmp); + bool2 v2 = bool2((v).xx); + bool3 v3 = bool3((v).xxx); + bool4 v4 = bool4((v).xxxx); +} diff --git a/test/tint/expressions/splat/var/bool.wgsl.expected.spvasm b/test/tint/expressions/splat/var/bool.wgsl.expected.spvasm index 155f6e6caa..7eee754994 100644 --- a/test/tint/expressions/splat/var/bool.wgsl.expected.spvasm +++ b/test/tint/expressions/splat/var/bool.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,43 +17,42 @@ %1 = OpTypeFunction %void %bool = OpTypeBool %true = OpConstantTrue %bool - %false = OpConstantFalse %bool + %11 = OpConstantNull %bool %_ptr_Function_bool = OpTypePointer Function %bool - %15 = OpConstantNull %bool %v2bool = OpTypeVector %bool 2 %_ptr_Function_v2bool = OpTypePointer Function %v2bool - %21 = OpConstantNull %v2bool + %20 = OpConstantNull %v2bool %v3bool = OpTypeVector %bool 3 %_ptr_Function_v3bool = OpTypePointer Function %v3bool - %27 = OpConstantNull %v3bool + %26 = OpConstantNull %v3bool %v4bool = OpTypeVector %bool 4 %_ptr_Function_v4bool = OpTypePointer Function %v4bool - %33 = OpConstantNull %v4bool + %32 = OpConstantNull %v4bool %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %v = OpVariable %_ptr_Function_bool Function %15 - %v2 = OpVariable %_ptr_Function_v2bool Function %21 - %v3 = OpVariable %_ptr_Function_v3bool Function %27 - %v4 = OpVariable %_ptr_Function_v4bool Function %33 + %v = OpVariable %_ptr_Function_bool Function %11 + %v2 = OpVariable %_ptr_Function_v2bool Function %20 + %v3 = OpVariable %_ptr_Function_v3bool Function %26 + %v4 = OpVariable %_ptr_Function_v4bool Function %32 OpSelectionMerge %9 None OpBranchConditional %true %9 %10 %10 = OpLabel OpBranch %9 %9 = OpLabel - %12 = OpPhi %bool %true %6 %false %10 + %12 = OpPhi %bool %true %6 %11 %10 OpStore %v %12 - %17 = OpLoad %bool %v - %18 = OpCompositeConstruct %v2bool %17 %17 - OpStore %v2 %18 - %23 = OpLoad %bool %v - %24 = OpCompositeConstruct %v3bool %23 %23 %23 - OpStore %v3 %24 - %29 = OpLoad %bool %v - %30 = OpCompositeConstruct %v4bool %29 %29 %29 %29 - OpStore %v4 %30 + %16 = OpLoad %bool %v + %17 = OpCompositeConstruct %v2bool %16 %16 + OpStore %v2 %17 + %22 = OpLoad %bool %v + %23 = OpCompositeConstruct %v3bool %22 %22 %22 + OpStore %v3 %23 + %28 = OpLoad %bool %v + %29 = OpCompositeConstruct %v4bool %28 %28 %28 %28 + OpStore %v4 %29 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/splat/var/f16.wgsl b/test/tint/expressions/splat/var/f16.wgsl new file mode 100644 index 0000000000..354147c5a1 --- /dev/null +++ b/test/tint/expressions/splat/var/f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +fn f() { + var v = 1.0h + 2.0h; + var v2 : vec2 = vec2(v); + var v3 : vec3 = vec3(v); + var v4 : vec4 = vec4(v); +} diff --git a/test/tint/expressions/splat/var/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/var/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b06f88b7f --- /dev/null +++ b/test/tint/expressions/splat/var/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float16_t v = float16_t(3.0h); + vector v2 = vector((v).xx); + vector v3 = vector((v).xxx); + vector v4 = vector((v).xxxx); +} diff --git a/test/tint/expressions/splat/var/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/var/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..334ebc0e61 --- /dev/null +++ b/test/tint/expressions/splat/var/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float16_t v = (float16_t(1.0h) + float16_t(2.0h)); + vector v2 = vector((v).xx); + vector v3 = vector((v).xxx); + vector v4 = vector((v).xxxx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FDC0B44610(7,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FDC0B44610(7,13): error X3000: unrecognized identifier 'v' + diff --git a/test/tint/expressions/splat/var/f16.wgsl.expected.glsl b/test/tint/expressions/splat/var/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..90ac38564e --- /dev/null +++ b/test/tint/expressions/splat/var/f16.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + float16_t v = 3.0hf; + f16vec2 v2 = f16vec2(v); + f16vec3 v3 = f16vec3(v); + f16vec4 v4 = f16vec4(v); +} + diff --git a/test/tint/expressions/splat/var/f16.wgsl.expected.msl b/test/tint/expressions/splat/var/f16.wgsl.expected.msl new file mode 100644 index 0000000000..dbb362ecf1 --- /dev/null +++ b/test/tint/expressions/splat/var/f16.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +void f() { + half v = 3.0h; + half2 v2 = half2(v); + half3 v3 = half3(v); + half4 v4 = half4(v); +} + diff --git a/test/tint/expressions/splat/var/f16.wgsl.expected.spvasm b/test/tint/expressions/splat/var/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..e10ce9922d --- /dev/null +++ b/test/tint/expressions/splat/var/f16.wgsl.expected.spvasm @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%_ptr_Function_half = OpTypePointer Function %half + %11 = OpConstantNull %half + %v2half = OpTypeVector %half 2 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %17 = OpConstantNull %v2half + %v3half = OpTypeVector %half 3 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %23 = OpConstantNull %v3half + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %29 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_half Function %11 + %v2 = OpVariable %_ptr_Function_v2half Function %17 + %v3 = OpVariable %_ptr_Function_v3half Function %23 + %v4 = OpVariable %_ptr_Function_v4half Function %29 + OpStore %v %half_0x1_8p_1 + %13 = OpLoad %half %v + %14 = OpCompositeConstruct %v2half %13 %13 + OpStore %v2 %14 + %19 = OpLoad %half %v + %20 = OpCompositeConstruct %v3half %19 %19 %19 + OpStore %v3 %20 + %25 = OpLoad %half %v + %26 = OpCompositeConstruct %v4half %25 %25 %25 %25 + OpStore %v4 %26 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/splat/var/f16.wgsl.expected.wgsl b/test/tint/expressions/splat/var/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ac0cab3e5 --- /dev/null +++ b/test/tint/expressions/splat/var/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +fn f() { + var v = (1.0h + 2.0h); + var v2 : vec2 = vec2(v); + var v3 : vec3 = vec3(v); + var v4 : vec4 = vec4(v); +} diff --git a/test/tint/expressions/splat/var/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/var/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1f921ec9ef --- /dev/null +++ b/test/tint/expressions/splat/var/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float v = 3.0f; + float2 v2 = float2((v).xx); + float3 v3 = float3((v).xxx); + float4 v4 = float4((v).xxxx); +} diff --git a/test/tint/expressions/splat/var/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/var/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1f921ec9ef --- /dev/null +++ b/test/tint/expressions/splat/var/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float v = 3.0f; + float2 v2 = float2((v).xx); + float3 v3 = float3((v).xxx); + float4 v4 = float4((v).xxxx); +} diff --git a/test/tint/expressions/splat/var/f32.wgsl.expected.glsl b/test/tint/expressions/splat/var/f32.wgsl.expected.glsl index fc53821972..3d79f3eede 100644 --- a/test/tint/expressions/splat/var/f32.wgsl.expected.glsl +++ b/test/tint/expressions/splat/var/f32.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } void f() { - float v = (1.0f + 2.0f); + float v = 3.0f; vec2 v2 = vec2(v); vec3 v3 = vec3(v); vec4 v4 = vec4(v); diff --git a/test/tint/expressions/splat/var/f32.wgsl.expected.hlsl b/test/tint/expressions/splat/var/f32.wgsl.expected.hlsl deleted file mode 100644 index 00091d7f6e..0000000000 --- a/test/tint/expressions/splat/var/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float v = (1.0f + 2.0f); - float2 v2 = float2((v).xx); - float3 v3 = float3((v).xxx); - float4 v4 = float4((v).xxxx); -} diff --git a/test/tint/expressions/splat/var/f32.wgsl.expected.msl b/test/tint/expressions/splat/var/f32.wgsl.expected.msl index 101d125c0d..4d66e56a07 100644 --- a/test/tint/expressions/splat/var/f32.wgsl.expected.msl +++ b/test/tint/expressions/splat/var/f32.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void f() { - float v = (1.0f + 2.0f); + float v = 3.0f; float2 v2 = float2(v); float3 v3 = float3(v); float4 v4 = float4(v); diff --git a/test/tint/expressions/splat/var/f32.wgsl.expected.spvasm b/test/tint/expressions/splat/var/f32.wgsl.expected.spvasm index 5d45b4a412..73d8a78b08 100644 --- a/test/tint/expressions/splat/var/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/splat/var/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 30 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,39 +16,37 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %float = OpTypeFloat 32 - %float_1 = OpConstant %float 1 - %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 %_ptr_Function_float = OpTypePointer Function %float - %13 = OpConstantNull %float + %11 = OpConstantNull %float %v2float = OpTypeVector %float 2 %_ptr_Function_v2float = OpTypePointer Function %v2float - %19 = OpConstantNull %v2float + %17 = OpConstantNull %v2float %v3float = OpTypeVector %float 3 %_ptr_Function_v3float = OpTypePointer Function %v3float - %25 = OpConstantNull %v3float + %23 = OpConstantNull %v3float %v4float = OpTypeVector %float 4 %_ptr_Function_v4float = OpTypePointer Function %v4float - %31 = OpConstantNull %v4float + %29 = OpConstantNull %v4float %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %v = OpVariable %_ptr_Function_float Function %13 - %v2 = OpVariable %_ptr_Function_v2float Function %19 - %v3 = OpVariable %_ptr_Function_v3float Function %25 - %v4 = OpVariable %_ptr_Function_v4float Function %31 - %10 = OpFAdd %float %float_1 %float_2 - OpStore %v %10 - %15 = OpLoad %float %v - %16 = OpCompositeConstruct %v2float %15 %15 - OpStore %v2 %16 - %21 = OpLoad %float %v - %22 = OpCompositeConstruct %v3float %21 %21 %21 - OpStore %v3 %22 - %27 = OpLoad %float %v - %28 = OpCompositeConstruct %v4float %27 %27 %27 %27 - OpStore %v4 %28 + %v = OpVariable %_ptr_Function_float Function %11 + %v2 = OpVariable %_ptr_Function_v2float Function %17 + %v3 = OpVariable %_ptr_Function_v3float Function %23 + %v4 = OpVariable %_ptr_Function_v4float Function %29 + OpStore %v %float_3 + %13 = OpLoad %float %v + %14 = OpCompositeConstruct %v2float %13 %13 + OpStore %v2 %14 + %19 = OpLoad %float %v + %20 = OpCompositeConstruct %v3float %19 %19 %19 + OpStore %v3 %20 + %25 = OpLoad %float %v + %26 = OpCompositeConstruct %v4float %25 %25 %25 %25 + OpStore %v4 %26 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/splat/var/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/var/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d0b1d2b38a --- /dev/null +++ b/test/tint/expressions/splat/var/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int v = 3; + int2 v2 = int2((v).xx); + int3 v3 = int3((v).xxx); + int4 v4 = int4((v).xxxx); +} diff --git a/test/tint/expressions/splat/var/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/var/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d0b1d2b38a --- /dev/null +++ b/test/tint/expressions/splat/var/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int v = 3; + int2 v2 = int2((v).xx); + int3 v3 = int3((v).xxx); + int4 v4 = int4((v).xxxx); +} diff --git a/test/tint/expressions/splat/var/i32.wgsl.expected.glsl b/test/tint/expressions/splat/var/i32.wgsl.expected.glsl index 7c1f53d2cd..d908df81f8 100644 --- a/test/tint/expressions/splat/var/i32.wgsl.expected.glsl +++ b/test/tint/expressions/splat/var/i32.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } void f() { - int v = (1 + 2); + int v = 3; ivec2 v2 = ivec2(v); ivec3 v3 = ivec3(v); ivec4 v4 = ivec4(v); diff --git a/test/tint/expressions/splat/var/i32.wgsl.expected.hlsl b/test/tint/expressions/splat/var/i32.wgsl.expected.hlsl deleted file mode 100644 index c9905a8e6b..0000000000 --- a/test/tint/expressions/splat/var/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - int v = (1 + 2); - int2 v2 = int2((v).xx); - int3 v3 = int3((v).xxx); - int4 v4 = int4((v).xxxx); -} diff --git a/test/tint/expressions/splat/var/i32.wgsl.expected.msl b/test/tint/expressions/splat/var/i32.wgsl.expected.msl index 7e62e14488..10524ad183 100644 --- a/test/tint/expressions/splat/var/i32.wgsl.expected.msl +++ b/test/tint/expressions/splat/var/i32.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void f() { - int v = as_type((as_type(1) + as_type(2))); + int v = 3; int2 v2 = int2(v); int3 v3 = int3(v); int4 v4 = int4(v); diff --git a/test/tint/expressions/splat/var/i32.wgsl.expected.spvasm b/test/tint/expressions/splat/var/i32.wgsl.expected.spvasm index 157b2da2c6..4ac3a5198d 100644 --- a/test/tint/expressions/splat/var/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/splat/var/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 30 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,39 +16,37 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 %_ptr_Function_int = OpTypePointer Function %int - %13 = OpConstantNull %int + %11 = OpConstantNull %int %v2int = OpTypeVector %int 2 %_ptr_Function_v2int = OpTypePointer Function %v2int - %19 = OpConstantNull %v2int + %17 = OpConstantNull %v2int %v3int = OpTypeVector %int 3 %_ptr_Function_v3int = OpTypePointer Function %v3int - %25 = OpConstantNull %v3int + %23 = OpConstantNull %v3int %v4int = OpTypeVector %int 4 %_ptr_Function_v4int = OpTypePointer Function %v4int - %31 = OpConstantNull %v4int + %29 = OpConstantNull %v4int %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %v = OpVariable %_ptr_Function_int Function %13 - %v2 = OpVariable %_ptr_Function_v2int Function %19 - %v3 = OpVariable %_ptr_Function_v3int Function %25 - %v4 = OpVariable %_ptr_Function_v4int Function %31 - %10 = OpIAdd %int %int_1 %int_2 - OpStore %v %10 - %15 = OpLoad %int %v - %16 = OpCompositeConstruct %v2int %15 %15 - OpStore %v2 %16 - %21 = OpLoad %int %v - %22 = OpCompositeConstruct %v3int %21 %21 %21 - OpStore %v3 %22 - %27 = OpLoad %int %v - %28 = OpCompositeConstruct %v4int %27 %27 %27 %27 - OpStore %v4 %28 + %v = OpVariable %_ptr_Function_int Function %11 + %v2 = OpVariable %_ptr_Function_v2int Function %17 + %v3 = OpVariable %_ptr_Function_v3int Function %23 + %v4 = OpVariable %_ptr_Function_v4int Function %29 + OpStore %v %int_3 + %13 = OpLoad %int %v + %14 = OpCompositeConstruct %v2int %13 %13 + OpStore %v2 %14 + %19 = OpLoad %int %v + %20 = OpCompositeConstruct %v3int %19 %19 %19 + OpStore %v3 %20 + %25 = OpLoad %int %v + %26 = OpCompositeConstruct %v4int %25 %25 %25 %25 + OpStore %v4 %26 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/splat/var/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/var/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..413a7ace51 --- /dev/null +++ b/test/tint/expressions/splat/var/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint v = 3u; + uint2 v2 = uint2((v).xx); + uint3 v3 = uint3((v).xxx); + uint4 v4 = uint4((v).xxxx); +} diff --git a/test/tint/expressions/splat/var/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/var/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..413a7ace51 --- /dev/null +++ b/test/tint/expressions/splat/var/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint v = 3u; + uint2 v2 = uint2((v).xx); + uint3 v3 = uint3((v).xxx); + uint4 v4 = uint4((v).xxxx); +} diff --git a/test/tint/expressions/splat/var/u32.wgsl.expected.glsl b/test/tint/expressions/splat/var/u32.wgsl.expected.glsl index 5ce7291b39..5649868172 100644 --- a/test/tint/expressions/splat/var/u32.wgsl.expected.glsl +++ b/test/tint/expressions/splat/var/u32.wgsl.expected.glsl @@ -5,7 +5,7 @@ void unused_entry_point() { return; } void f() { - uint v = (1u + 2u); + uint v = 3u; uvec2 v2 = uvec2(v); uvec3 v3 = uvec3(v); uvec4 v4 = uvec4(v); diff --git a/test/tint/expressions/splat/var/u32.wgsl.expected.hlsl b/test/tint/expressions/splat/var/u32.wgsl.expected.hlsl deleted file mode 100644 index 5e51b8dc15..0000000000 --- a/test/tint/expressions/splat/var/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - uint v = (1u + 2u); - uint2 v2 = uint2((v).xx); - uint3 v3 = uint3((v).xxx); - uint4 v4 = uint4((v).xxxx); -} diff --git a/test/tint/expressions/splat/var/u32.wgsl.expected.msl b/test/tint/expressions/splat/var/u32.wgsl.expected.msl index 28df296595..435cfc0bab 100644 --- a/test/tint/expressions/splat/var/u32.wgsl.expected.msl +++ b/test/tint/expressions/splat/var/u32.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void f() { - uint v = (1u + 2u); + uint v = 3u; uint2 v2 = uint2(v); uint3 v3 = uint3(v); uint4 v4 = uint4(v); diff --git a/test/tint/expressions/splat/var/u32.wgsl.expected.spvasm b/test/tint/expressions/splat/var/u32.wgsl.expected.spvasm index ed6444af1d..9a92f8113d 100644 --- a/test/tint/expressions/splat/var/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/splat/var/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 30 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,39 +16,37 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %uint = OpTypeInt 32 0 - %uint_1 = OpConstant %uint 1 - %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 %_ptr_Function_uint = OpTypePointer Function %uint - %13 = OpConstantNull %uint + %11 = OpConstantNull %uint %v2uint = OpTypeVector %uint 2 %_ptr_Function_v2uint = OpTypePointer Function %v2uint - %19 = OpConstantNull %v2uint + %17 = OpConstantNull %v2uint %v3uint = OpTypeVector %uint 3 %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %25 = OpConstantNull %v3uint + %23 = OpConstantNull %v3uint %v4uint = OpTypeVector %uint 4 %_ptr_Function_v4uint = OpTypePointer Function %v4uint - %31 = OpConstantNull %v4uint + %29 = OpConstantNull %v4uint %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %v = OpVariable %_ptr_Function_uint Function %13 - %v2 = OpVariable %_ptr_Function_v2uint Function %19 - %v3 = OpVariable %_ptr_Function_v3uint Function %25 - %v4 = OpVariable %_ptr_Function_v4uint Function %31 - %10 = OpIAdd %uint %uint_1 %uint_2 - OpStore %v %10 - %15 = OpLoad %uint %v - %16 = OpCompositeConstruct %v2uint %15 %15 - OpStore %v2 %16 - %21 = OpLoad %uint %v - %22 = OpCompositeConstruct %v3uint %21 %21 %21 - OpStore %v3 %22 - %27 = OpLoad %uint %v - %28 = OpCompositeConstruct %v4uint %27 %27 %27 %27 - OpStore %v4 %28 + %v = OpVariable %_ptr_Function_uint Function %11 + %v2 = OpVariable %_ptr_Function_v2uint Function %17 + %v3 = OpVariable %_ptr_Function_v3uint Function %23 + %v4 = OpVariable %_ptr_Function_v4uint Function %29 + OpStore %v %uint_3 + %13 = OpLoad %uint %v + %14 = OpCompositeConstruct %v2uint %13 %13 + OpStore %v2 %14 + %19 = OpLoad %uint %v + %20 = OpCompositeConstruct %v3uint %19 %19 %19 + OpStore %v3 %20 + %25 = OpLoad %uint %v + %26 = OpCompositeConstruct %v4uint %25 %25 %25 %25 + OpStore %v4 %26 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/splat/with_swizzle/f16.wgsl b/test/tint/expressions/splat/with_swizzle/f16.wgsl new file mode 100644 index 0000000000..cdadd0c5dd --- /dev/null +++ b/test/tint/expressions/splat/with_swizzle/f16.wgsl @@ -0,0 +1,6 @@ +enable f16; +fn f() { + var a = vec2(1.0h).y; + var b = vec3(1.0h).z; + var c = vec4(1.0h).w; +} diff --git a/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a11d559691 --- /dev/null +++ b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(1.0h); + float16_t c = float16_t(1.0h); +} diff --git a/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..992a8edb35 --- /dev/null +++ b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float16_t a = float16_t(1.0h); + float16_t b = float16_t(1.0h); + float16_t c = float16_t(1.0h); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000025AD8484E80(7,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000025AD8484E80(7,13): error X3000: unrecognized identifier 'a' + diff --git a/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.glsl b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..d5216efae5 --- /dev/null +++ b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + float16_t a = 1.0hf; + float16_t b = 1.0hf; + float16_t c = 1.0hf; +} + diff --git a/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.msl b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.msl new file mode 100644 index 0000000000..1ede386d82 --- /dev/null +++ b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +void f() { + half a = 1.0h; + half b = 1.0h; + half c = 1.0h; +} + diff --git a/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.spvasm b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..62a4f5405e --- /dev/null +++ b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %c "c" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Function_half = OpTypePointer Function %half + %11 = OpConstantNull %half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %a = OpVariable %_ptr_Function_half Function %11 + %b = OpVariable %_ptr_Function_half Function %11 + %c = OpVariable %_ptr_Function_half Function %11 + OpStore %a %half_0x1p_0 + OpStore %b %half_0x1p_0 + OpStore %c %half_0x1p_0 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.wgsl b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b20911de69 --- /dev/null +++ b/test/tint/expressions/splat/with_swizzle/f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +fn f() { + var a = vec2(1.0h).y; + var b = vec3(1.0h).z; + var c = vec4(1.0h).w; +} diff --git a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bc8913a3c0 --- /dev/null +++ b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float a = 1.0f; + float b = 1.0f; + float c = 1.0f; +} diff --git a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bc8913a3c0 --- /dev/null +++ b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float a = 1.0f; + float b = 1.0f; + float c = 1.0f; +} diff --git a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.glsl b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.glsl index 34933541da..b00eb0983a 100644 --- a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.glsl +++ b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.glsl @@ -5,8 +5,8 @@ void unused_entry_point() { return; } void f() { - float a = vec2(1.0f).y; - float b = vec3(1.0f).z; - float c = vec4(1.0f).w; + float a = 1.0f; + float b = 1.0f; + float c = 1.0f; } diff --git a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.hlsl b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.hlsl deleted file mode 100644 index 0ee0a3771a..0000000000 --- a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float a = float2((1.0f).xx).y; - float b = float3((1.0f).xxx).z; - float c = float4((1.0f).xxxx).w; -} diff --git a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.msl b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.msl index 2f9ac2a2d4..d7d4949b47 100644 --- a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.msl +++ b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.msl @@ -2,8 +2,8 @@ using namespace metal; void f() { - float a = float2(1.0f)[1]; - float b = float3(1.0f)[2]; - float c = float4(1.0f)[3]; + float a = 1.0f; + float b = 1.0f; + float c = 1.0f; } diff --git a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.spvasm b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.spvasm index fe1995c1aa..1fa9baf1e2 100644 --- a/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/splat/with_swizzle/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -15,29 +15,20 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 %float_1 = OpConstant %float 1 - %10 = OpConstantComposite %v2float %float_1 %float_1 %_ptr_Function_float = OpTypePointer Function %float - %14 = OpConstantNull %float - %v3float = OpTypeVector %float 3 - %16 = OpConstantComposite %v3float %float_1 %float_1 %float_1 - %v4float = OpTypeVector %float 4 - %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %11 = OpConstantNull %float %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %a = OpVariable %_ptr_Function_float Function %14 - %b = OpVariable %_ptr_Function_float Function %14 - %c = OpVariable %_ptr_Function_float Function %14 - %11 = OpCompositeExtract %float %10 1 - OpStore %a %11 - %17 = OpCompositeExtract %float %16 2 - OpStore %b %17 - %21 = OpCompositeExtract %float %20 3 - OpStore %c %21 + %a = OpVariable %_ptr_Function_float Function %11 + %b = OpVariable %_ptr_Function_float Function %11 + %c = OpVariable %_ptr_Function_float Function %11 + OpStore %a %float_1 + OpStore %b %float_1 + OpStore %c %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl new file mode 100644 index 0000000000..c3633ea733 --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl @@ -0,0 +1,144 @@ +enable f16; +struct S { + v: vec3, +}; + +@group(0) @binding(0) var U : S; + +fn f() { + var v = U.v; + + var x = U.v.x; + var y = U.v.y; + var z = U.v.z; + + var xx = U.v.xx; + var xy = U.v.xy; + var xz = U.v.xz; + var yx = U.v.yx; + var yy = U.v.yy; + var yz = U.v.yz; + var zx = U.v.zx; + var zy = U.v.zy; + var zz = U.v.zz; + + var xxx = U.v.xxx; + var xxy = U.v.xxy; + var xxz = U.v.xxz; + var xyx = U.v.xyx; + var xyy = U.v.xyy; + var xyz = U.v.xyz; + var xzx = U.v.xzx; + var xzy = U.v.xzy; + var xzz = U.v.xzz; + + var yxx = U.v.yxx; + var yxy = U.v.yxy; + var yxz = U.v.yxz; + var yyx = U.v.yyx; + var yyy = U.v.yyy; + var yyz = U.v.yyz; + var yzx = U.v.yzx; + var yzy = U.v.yzy; + var yzz = U.v.yzz; + + var zxx = U.v.zxx; + var zxy = U.v.zxy; + var zxz = U.v.zxz; + var zyx = U.v.zyx; + var zyy = U.v.zyy; + var zyz = U.v.zyz; + var zzx = U.v.zzx; + var zzy = U.v.zzy; + var zzz = U.v.zzz; + + var xxxx = U.v.xxxx; + var xxxy = U.v.xxxy; + var xxxz = U.v.xxxz; + var xxyx = U.v.xxyx; + var xxyy = U.v.xxyy; + var xxyz = U.v.xxyz; + var xxzx = U.v.xxzx; + var xxzy = U.v.xxzy; + var xxzz = U.v.xxzz; + + var xyxx = U.v.xyxx; + var xyxy = U.v.xyxy; + var xyxz = U.v.xyxz; + var xyyx = U.v.xyyx; + var xyyy = U.v.xyyy; + var xyyz = U.v.xyyz; + var xyzx = U.v.xyzx; + var xyzy = U.v.xyzy; + var xyzz = U.v.xyzz; + + var xzxx = U.v.xzxx; + var xzxy = U.v.xzxy; + var xzxz = U.v.xzxz; + var xzyx = U.v.xzyx; + var xzyy = U.v.xzyy; + var xzyz = U.v.xzyz; + var xzzx = U.v.xzzx; + var xzzy = U.v.xzzy; + var xzzz = U.v.xzzz; + + var yxxx = U.v.yxxx; + var yxxy = U.v.yxxy; + var yxxz = U.v.yxxz; + var yxyx = U.v.yxyx; + var yxyy = U.v.yxyy; + var yxyz = U.v.yxyz; + var yxzx = U.v.yxzx; + var yxzy = U.v.yxzy; + var yxzz = U.v.yxzz; + + var yyxx = U.v.yyxx; + var yyxy = U.v.yyxy; + var yyxz = U.v.yyxz; + var yyyx = U.v.yyyx; + var yyyy = U.v.yyyy; + var yyyz = U.v.yyyz; + var yyzx = U.v.yyzx; + var yyzy = U.v.yyzy; + var yyzz = U.v.yyzz; + + var yzxx = U.v.yzxx; + var yzxy = U.v.yzxy; + var yzxz = U.v.yzxz; + var yzyx = U.v.yzyx; + var yzyy = U.v.yzyy; + var yzyz = U.v.yzyz; + var yzzx = U.v.yzzx; + var yzzy = U.v.yzzy; + var yzzz = U.v.yzzz; + + var zxxx = U.v.zxxx; + var zxxy = U.v.zxxy; + var zxxz = U.v.zxxz; + var zxyx = U.v.zxyx; + var zxyy = U.v.zxyy; + var zxyz = U.v.zxyz; + var zxzx = U.v.zxzx; + var zxzy = U.v.zxzy; + var zxzz = U.v.zxzz; + + var zyxx = U.v.zyxx; + var zyxy = U.v.zyxy; + var zyxz = U.v.zyxz; + var zyyx = U.v.zyyx; + var zyyy = U.v.zyyy; + var zyyz = U.v.zyyz; + var zyzx = U.v.zyzx; + var zyzy = U.v.zyzy; + var zyzz = U.v.zyzz; + + var zzxx = U.v.zzxx; + var zzxy = U.v.zzxy; + var zzxz = U.v.zzxz; + var zzyx = U.v.zzyx; + var zzyy = U.v.zzyy; + var zzyz = U.v.zzyz; + var zzzx = U.v.zzzx; + var zzzy = U.v.zzzy; + var zzzz = U.v.zzzz; +} diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..77452b8b9b --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/read/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'uniform' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77452b8b9b --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/read/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'uniform' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.glsl b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..77452b8b9b --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/read/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'uniform' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.msl b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..77452b8b9b --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.msl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/read/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'uniform' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..77452b8b9b --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/read/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'uniform' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..77452b8b9b --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/read/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'uniform' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/read/packed_vec3/f16.wgsl:6:36 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a0fa0de4ab --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,132 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +cbuffer cbuffer_U : register(b0, space0) { + uint4 U[1]; +}; + +void f() { + float3 v = asfloat(U[0].xyz); + float x = asfloat(U[0].x); + float y = asfloat(U[0].y); + float z = asfloat(U[0].z); + float2 xx = asfloat(U[0].xyz).xx; + float2 xy = asfloat(U[0].xyz).xy; + float2 xz = asfloat(U[0].xyz).xz; + float2 yx = asfloat(U[0].xyz).yx; + float2 yy = asfloat(U[0].xyz).yy; + float2 yz = asfloat(U[0].xyz).yz; + float2 zx = asfloat(U[0].xyz).zx; + float2 zy = asfloat(U[0].xyz).zy; + float2 zz = asfloat(U[0].xyz).zz; + float3 xxx = asfloat(U[0].xyz).xxx; + float3 xxy = asfloat(U[0].xyz).xxy; + float3 xxz = asfloat(U[0].xyz).xxz; + float3 xyx = asfloat(U[0].xyz).xyx; + float3 xyy = asfloat(U[0].xyz).xyy; + float3 xyz = asfloat(U[0].xyz).xyz; + float3 xzx = asfloat(U[0].xyz).xzx; + float3 xzy = asfloat(U[0].xyz).xzy; + float3 xzz = asfloat(U[0].xyz).xzz; + float3 yxx = asfloat(U[0].xyz).yxx; + float3 yxy = asfloat(U[0].xyz).yxy; + float3 yxz = asfloat(U[0].xyz).yxz; + float3 yyx = asfloat(U[0].xyz).yyx; + float3 yyy = asfloat(U[0].xyz).yyy; + float3 yyz = asfloat(U[0].xyz).yyz; + float3 yzx = asfloat(U[0].xyz).yzx; + float3 yzy = asfloat(U[0].xyz).yzy; + float3 yzz = asfloat(U[0].xyz).yzz; + float3 zxx = asfloat(U[0].xyz).zxx; + float3 zxy = asfloat(U[0].xyz).zxy; + float3 zxz = asfloat(U[0].xyz).zxz; + float3 zyx = asfloat(U[0].xyz).zyx; + float3 zyy = asfloat(U[0].xyz).zyy; + float3 zyz = asfloat(U[0].xyz).zyz; + float3 zzx = asfloat(U[0].xyz).zzx; + float3 zzy = asfloat(U[0].xyz).zzy; + float3 zzz = asfloat(U[0].xyz).zzz; + float4 xxxx = asfloat(U[0].xyz).xxxx; + float4 xxxy = asfloat(U[0].xyz).xxxy; + float4 xxxz = asfloat(U[0].xyz).xxxz; + float4 xxyx = asfloat(U[0].xyz).xxyx; + float4 xxyy = asfloat(U[0].xyz).xxyy; + float4 xxyz = asfloat(U[0].xyz).xxyz; + float4 xxzx = asfloat(U[0].xyz).xxzx; + float4 xxzy = asfloat(U[0].xyz).xxzy; + float4 xxzz = asfloat(U[0].xyz).xxzz; + float4 xyxx = asfloat(U[0].xyz).xyxx; + float4 xyxy = asfloat(U[0].xyz).xyxy; + float4 xyxz = asfloat(U[0].xyz).xyxz; + float4 xyyx = asfloat(U[0].xyz).xyyx; + float4 xyyy = asfloat(U[0].xyz).xyyy; + float4 xyyz = asfloat(U[0].xyz).xyyz; + float4 xyzx = asfloat(U[0].xyz).xyzx; + float4 xyzy = asfloat(U[0].xyz).xyzy; + float4 xyzz = asfloat(U[0].xyz).xyzz; + float4 xzxx = asfloat(U[0].xyz).xzxx; + float4 xzxy = asfloat(U[0].xyz).xzxy; + float4 xzxz = asfloat(U[0].xyz).xzxz; + float4 xzyx = asfloat(U[0].xyz).xzyx; + float4 xzyy = asfloat(U[0].xyz).xzyy; + float4 xzyz = asfloat(U[0].xyz).xzyz; + float4 xzzx = asfloat(U[0].xyz).xzzx; + float4 xzzy = asfloat(U[0].xyz).xzzy; + float4 xzzz = asfloat(U[0].xyz).xzzz; + float4 yxxx = asfloat(U[0].xyz).yxxx; + float4 yxxy = asfloat(U[0].xyz).yxxy; + float4 yxxz = asfloat(U[0].xyz).yxxz; + float4 yxyx = asfloat(U[0].xyz).yxyx; + float4 yxyy = asfloat(U[0].xyz).yxyy; + float4 yxyz = asfloat(U[0].xyz).yxyz; + float4 yxzx = asfloat(U[0].xyz).yxzx; + float4 yxzy = asfloat(U[0].xyz).yxzy; + float4 yxzz = asfloat(U[0].xyz).yxzz; + float4 yyxx = asfloat(U[0].xyz).yyxx; + float4 yyxy = asfloat(U[0].xyz).yyxy; + float4 yyxz = asfloat(U[0].xyz).yyxz; + float4 yyyx = asfloat(U[0].xyz).yyyx; + float4 yyyy = asfloat(U[0].xyz).yyyy; + float4 yyyz = asfloat(U[0].xyz).yyyz; + float4 yyzx = asfloat(U[0].xyz).yyzx; + float4 yyzy = asfloat(U[0].xyz).yyzy; + float4 yyzz = asfloat(U[0].xyz).yyzz; + float4 yzxx = asfloat(U[0].xyz).yzxx; + float4 yzxy = asfloat(U[0].xyz).yzxy; + float4 yzxz = asfloat(U[0].xyz).yzxz; + float4 yzyx = asfloat(U[0].xyz).yzyx; + float4 yzyy = asfloat(U[0].xyz).yzyy; + float4 yzyz = asfloat(U[0].xyz).yzyz; + float4 yzzx = asfloat(U[0].xyz).yzzx; + float4 yzzy = asfloat(U[0].xyz).yzzy; + float4 yzzz = asfloat(U[0].xyz).yzzz; + float4 zxxx = asfloat(U[0].xyz).zxxx; + float4 zxxy = asfloat(U[0].xyz).zxxy; + float4 zxxz = asfloat(U[0].xyz).zxxz; + float4 zxyx = asfloat(U[0].xyz).zxyx; + float4 zxyy = asfloat(U[0].xyz).zxyy; + float4 zxyz = asfloat(U[0].xyz).zxyz; + float4 zxzx = asfloat(U[0].xyz).zxzx; + float4 zxzy = asfloat(U[0].xyz).zxzy; + float4 zxzz = asfloat(U[0].xyz).zxzz; + float4 zyxx = asfloat(U[0].xyz).zyxx; + float4 zyxy = asfloat(U[0].xyz).zyxy; + float4 zyxz = asfloat(U[0].xyz).zyxz; + float4 zyyx = asfloat(U[0].xyz).zyyx; + float4 zyyy = asfloat(U[0].xyz).zyyy; + float4 zyyz = asfloat(U[0].xyz).zyyz; + float4 zyzx = asfloat(U[0].xyz).zyzx; + float4 zyzy = asfloat(U[0].xyz).zyzy; + float4 zyzz = asfloat(U[0].xyz).zyzz; + float4 zzxx = asfloat(U[0].xyz).zzxx; + float4 zzxy = asfloat(U[0].xyz).zzxy; + float4 zzxz = asfloat(U[0].xyz).zzxz; + float4 zzyx = asfloat(U[0].xyz).zzyx; + float4 zzyy = asfloat(U[0].xyz).zzyy; + float4 zzyz = asfloat(U[0].xyz).zzyz; + float4 zzzx = asfloat(U[0].xyz).zzzx; + float4 zzzy = asfloat(U[0].xyz).zzzy; + float4 zzzz = asfloat(U[0].xyz).zzzz; +} diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.msl b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.msl index 9f40be1e68..e2bbca322e 100644 --- a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.msl @@ -12,9 +12,21 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ packed_float3 v; - /* 0x000c */ int8_t tint_pad[4]; + /* 0x000c */ tint_array tint_pad; }; void f(const constant S* const tint_symbol) { diff --git a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13b2315d12 --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,132 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +cbuffer cbuffer_U : register(b0, space0) { + uint4 U[1]; +}; + +void f() { + int3 v = asint(U[0].xyz); + int x = asint(U[0].x); + int y = asint(U[0].y); + int z = asint(U[0].z); + int2 xx = asint(U[0].xyz).xx; + int2 xy = asint(U[0].xyz).xy; + int2 xz = asint(U[0].xyz).xz; + int2 yx = asint(U[0].xyz).yx; + int2 yy = asint(U[0].xyz).yy; + int2 yz = asint(U[0].xyz).yz; + int2 zx = asint(U[0].xyz).zx; + int2 zy = asint(U[0].xyz).zy; + int2 zz = asint(U[0].xyz).zz; + int3 xxx = asint(U[0].xyz).xxx; + int3 xxy = asint(U[0].xyz).xxy; + int3 xxz = asint(U[0].xyz).xxz; + int3 xyx = asint(U[0].xyz).xyx; + int3 xyy = asint(U[0].xyz).xyy; + int3 xyz = asint(U[0].xyz).xyz; + int3 xzx = asint(U[0].xyz).xzx; + int3 xzy = asint(U[0].xyz).xzy; + int3 xzz = asint(U[0].xyz).xzz; + int3 yxx = asint(U[0].xyz).yxx; + int3 yxy = asint(U[0].xyz).yxy; + int3 yxz = asint(U[0].xyz).yxz; + int3 yyx = asint(U[0].xyz).yyx; + int3 yyy = asint(U[0].xyz).yyy; + int3 yyz = asint(U[0].xyz).yyz; + int3 yzx = asint(U[0].xyz).yzx; + int3 yzy = asint(U[0].xyz).yzy; + int3 yzz = asint(U[0].xyz).yzz; + int3 zxx = asint(U[0].xyz).zxx; + int3 zxy = asint(U[0].xyz).zxy; + int3 zxz = asint(U[0].xyz).zxz; + int3 zyx = asint(U[0].xyz).zyx; + int3 zyy = asint(U[0].xyz).zyy; + int3 zyz = asint(U[0].xyz).zyz; + int3 zzx = asint(U[0].xyz).zzx; + int3 zzy = asint(U[0].xyz).zzy; + int3 zzz = asint(U[0].xyz).zzz; + int4 xxxx = asint(U[0].xyz).xxxx; + int4 xxxy = asint(U[0].xyz).xxxy; + int4 xxxz = asint(U[0].xyz).xxxz; + int4 xxyx = asint(U[0].xyz).xxyx; + int4 xxyy = asint(U[0].xyz).xxyy; + int4 xxyz = asint(U[0].xyz).xxyz; + int4 xxzx = asint(U[0].xyz).xxzx; + int4 xxzy = asint(U[0].xyz).xxzy; + int4 xxzz = asint(U[0].xyz).xxzz; + int4 xyxx = asint(U[0].xyz).xyxx; + int4 xyxy = asint(U[0].xyz).xyxy; + int4 xyxz = asint(U[0].xyz).xyxz; + int4 xyyx = asint(U[0].xyz).xyyx; + int4 xyyy = asint(U[0].xyz).xyyy; + int4 xyyz = asint(U[0].xyz).xyyz; + int4 xyzx = asint(U[0].xyz).xyzx; + int4 xyzy = asint(U[0].xyz).xyzy; + int4 xyzz = asint(U[0].xyz).xyzz; + int4 xzxx = asint(U[0].xyz).xzxx; + int4 xzxy = asint(U[0].xyz).xzxy; + int4 xzxz = asint(U[0].xyz).xzxz; + int4 xzyx = asint(U[0].xyz).xzyx; + int4 xzyy = asint(U[0].xyz).xzyy; + int4 xzyz = asint(U[0].xyz).xzyz; + int4 xzzx = asint(U[0].xyz).xzzx; + int4 xzzy = asint(U[0].xyz).xzzy; + int4 xzzz = asint(U[0].xyz).xzzz; + int4 yxxx = asint(U[0].xyz).yxxx; + int4 yxxy = asint(U[0].xyz).yxxy; + int4 yxxz = asint(U[0].xyz).yxxz; + int4 yxyx = asint(U[0].xyz).yxyx; + int4 yxyy = asint(U[0].xyz).yxyy; + int4 yxyz = asint(U[0].xyz).yxyz; + int4 yxzx = asint(U[0].xyz).yxzx; + int4 yxzy = asint(U[0].xyz).yxzy; + int4 yxzz = asint(U[0].xyz).yxzz; + int4 yyxx = asint(U[0].xyz).yyxx; + int4 yyxy = asint(U[0].xyz).yyxy; + int4 yyxz = asint(U[0].xyz).yyxz; + int4 yyyx = asint(U[0].xyz).yyyx; + int4 yyyy = asint(U[0].xyz).yyyy; + int4 yyyz = asint(U[0].xyz).yyyz; + int4 yyzx = asint(U[0].xyz).yyzx; + int4 yyzy = asint(U[0].xyz).yyzy; + int4 yyzz = asint(U[0].xyz).yyzz; + int4 yzxx = asint(U[0].xyz).yzxx; + int4 yzxy = asint(U[0].xyz).yzxy; + int4 yzxz = asint(U[0].xyz).yzxz; + int4 yzyx = asint(U[0].xyz).yzyx; + int4 yzyy = asint(U[0].xyz).yzyy; + int4 yzyz = asint(U[0].xyz).yzyz; + int4 yzzx = asint(U[0].xyz).yzzx; + int4 yzzy = asint(U[0].xyz).yzzy; + int4 yzzz = asint(U[0].xyz).yzzz; + int4 zxxx = asint(U[0].xyz).zxxx; + int4 zxxy = asint(U[0].xyz).zxxy; + int4 zxxz = asint(U[0].xyz).zxxz; + int4 zxyx = asint(U[0].xyz).zxyx; + int4 zxyy = asint(U[0].xyz).zxyy; + int4 zxyz = asint(U[0].xyz).zxyz; + int4 zxzx = asint(U[0].xyz).zxzx; + int4 zxzy = asint(U[0].xyz).zxzy; + int4 zxzz = asint(U[0].xyz).zxzz; + int4 zyxx = asint(U[0].xyz).zyxx; + int4 zyxy = asint(U[0].xyz).zyxy; + int4 zyxz = asint(U[0].xyz).zyxz; + int4 zyyx = asint(U[0].xyz).zyyx; + int4 zyyy = asint(U[0].xyz).zyyy; + int4 zyyz = asint(U[0].xyz).zyyz; + int4 zyzx = asint(U[0].xyz).zyzx; + int4 zyzy = asint(U[0].xyz).zyzy; + int4 zyzz = asint(U[0].xyz).zyzz; + int4 zzxx = asint(U[0].xyz).zzxx; + int4 zzxy = asint(U[0].xyz).zzxy; + int4 zzxz = asint(U[0].xyz).zzxz; + int4 zzyx = asint(U[0].xyz).zzyx; + int4 zzyy = asint(U[0].xyz).zzyy; + int4 zzyz = asint(U[0].xyz).zzyz; + int4 zzzx = asint(U[0].xyz).zzzx; + int4 zzzy = asint(U[0].xyz).zzzy; + int4 zzzz = asint(U[0].xyz).zzzz; +} diff --git a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.msl b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.msl index d396d1f779..7a93a594a7 100644 --- a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.msl @@ -1,9 +1,22 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ packed_int3 v; - /* 0x000c */ int8_t tint_pad[4]; + /* 0x000c */ tint_array tint_pad; }; void f(const constant S* const tint_symbol) { diff --git a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..72d8077c21 --- /dev/null +++ b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,132 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +cbuffer cbuffer_U : register(b0, space0) { + uint4 U[1]; +}; + +void f() { + uint3 v = U[0].xyz; + uint x = U[0].x; + uint y = U[0].y; + uint z = U[0].z; + uint2 xx = U[0].xyz.xx; + uint2 xy = U[0].xyz.xy; + uint2 xz = U[0].xyz.xz; + uint2 yx = U[0].xyz.yx; + uint2 yy = U[0].xyz.yy; + uint2 yz = U[0].xyz.yz; + uint2 zx = U[0].xyz.zx; + uint2 zy = U[0].xyz.zy; + uint2 zz = U[0].xyz.zz; + uint3 xxx = U[0].xyz.xxx; + uint3 xxy = U[0].xyz.xxy; + uint3 xxz = U[0].xyz.xxz; + uint3 xyx = U[0].xyz.xyx; + uint3 xyy = U[0].xyz.xyy; + uint3 xyz = U[0].xyz.xyz; + uint3 xzx = U[0].xyz.xzx; + uint3 xzy = U[0].xyz.xzy; + uint3 xzz = U[0].xyz.xzz; + uint3 yxx = U[0].xyz.yxx; + uint3 yxy = U[0].xyz.yxy; + uint3 yxz = U[0].xyz.yxz; + uint3 yyx = U[0].xyz.yyx; + uint3 yyy = U[0].xyz.yyy; + uint3 yyz = U[0].xyz.yyz; + uint3 yzx = U[0].xyz.yzx; + uint3 yzy = U[0].xyz.yzy; + uint3 yzz = U[0].xyz.yzz; + uint3 zxx = U[0].xyz.zxx; + uint3 zxy = U[0].xyz.zxy; + uint3 zxz = U[0].xyz.zxz; + uint3 zyx = U[0].xyz.zyx; + uint3 zyy = U[0].xyz.zyy; + uint3 zyz = U[0].xyz.zyz; + uint3 zzx = U[0].xyz.zzx; + uint3 zzy = U[0].xyz.zzy; + uint3 zzz = U[0].xyz.zzz; + uint4 xxxx = U[0].xyz.xxxx; + uint4 xxxy = U[0].xyz.xxxy; + uint4 xxxz = U[0].xyz.xxxz; + uint4 xxyx = U[0].xyz.xxyx; + uint4 xxyy = U[0].xyz.xxyy; + uint4 xxyz = U[0].xyz.xxyz; + uint4 xxzx = U[0].xyz.xxzx; + uint4 xxzy = U[0].xyz.xxzy; + uint4 xxzz = U[0].xyz.xxzz; + uint4 xyxx = U[0].xyz.xyxx; + uint4 xyxy = U[0].xyz.xyxy; + uint4 xyxz = U[0].xyz.xyxz; + uint4 xyyx = U[0].xyz.xyyx; + uint4 xyyy = U[0].xyz.xyyy; + uint4 xyyz = U[0].xyz.xyyz; + uint4 xyzx = U[0].xyz.xyzx; + uint4 xyzy = U[0].xyz.xyzy; + uint4 xyzz = U[0].xyz.xyzz; + uint4 xzxx = U[0].xyz.xzxx; + uint4 xzxy = U[0].xyz.xzxy; + uint4 xzxz = U[0].xyz.xzxz; + uint4 xzyx = U[0].xyz.xzyx; + uint4 xzyy = U[0].xyz.xzyy; + uint4 xzyz = U[0].xyz.xzyz; + uint4 xzzx = U[0].xyz.xzzx; + uint4 xzzy = U[0].xyz.xzzy; + uint4 xzzz = U[0].xyz.xzzz; + uint4 yxxx = U[0].xyz.yxxx; + uint4 yxxy = U[0].xyz.yxxy; + uint4 yxxz = U[0].xyz.yxxz; + uint4 yxyx = U[0].xyz.yxyx; + uint4 yxyy = U[0].xyz.yxyy; + uint4 yxyz = U[0].xyz.yxyz; + uint4 yxzx = U[0].xyz.yxzx; + uint4 yxzy = U[0].xyz.yxzy; + uint4 yxzz = U[0].xyz.yxzz; + uint4 yyxx = U[0].xyz.yyxx; + uint4 yyxy = U[0].xyz.yyxy; + uint4 yyxz = U[0].xyz.yyxz; + uint4 yyyx = U[0].xyz.yyyx; + uint4 yyyy = U[0].xyz.yyyy; + uint4 yyyz = U[0].xyz.yyyz; + uint4 yyzx = U[0].xyz.yyzx; + uint4 yyzy = U[0].xyz.yyzy; + uint4 yyzz = U[0].xyz.yyzz; + uint4 yzxx = U[0].xyz.yzxx; + uint4 yzxy = U[0].xyz.yzxy; + uint4 yzxz = U[0].xyz.yzxz; + uint4 yzyx = U[0].xyz.yzyx; + uint4 yzyy = U[0].xyz.yzyy; + uint4 yzyz = U[0].xyz.yzyz; + uint4 yzzx = U[0].xyz.yzzx; + uint4 yzzy = U[0].xyz.yzzy; + uint4 yzzz = U[0].xyz.yzzz; + uint4 zxxx = U[0].xyz.zxxx; + uint4 zxxy = U[0].xyz.zxxy; + uint4 zxxz = U[0].xyz.zxxz; + uint4 zxyx = U[0].xyz.zxyx; + uint4 zxyy = U[0].xyz.zxyy; + uint4 zxyz = U[0].xyz.zxyz; + uint4 zxzx = U[0].xyz.zxzx; + uint4 zxzy = U[0].xyz.zxzy; + uint4 zxzz = U[0].xyz.zxzz; + uint4 zyxx = U[0].xyz.zyxx; + uint4 zyxy = U[0].xyz.zyxy; + uint4 zyxz = U[0].xyz.zyxz; + uint4 zyyx = U[0].xyz.zyyx; + uint4 zyyy = U[0].xyz.zyyy; + uint4 zyyz = U[0].xyz.zyyz; + uint4 zyzx = U[0].xyz.zyzx; + uint4 zyzy = U[0].xyz.zyzy; + uint4 zyzz = U[0].xyz.zyzz; + uint4 zzxx = U[0].xyz.zzxx; + uint4 zzxy = U[0].xyz.zzxy; + uint4 zzxz = U[0].xyz.zzxz; + uint4 zzyx = U[0].xyz.zzyx; + uint4 zzyy = U[0].xyz.zzyy; + uint4 zzyz = U[0].xyz.zzyz; + uint4 zzzx = U[0].xyz.zzzx; + uint4 zzzy = U[0].xyz.zzzy; + uint4 zzzz = U[0].xyz.zzzz; +} diff --git a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.msl b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.msl index 8f6a4a6b63..7444f75464 100644 --- a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.msl @@ -1,9 +1,22 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ packed_uint3 v; - /* 0x000c */ int8_t tint_pad[4]; + /* 0x000c */ tint_array tint_pad; }; void f(const constant S* const tint_symbol) { diff --git a/test/tint/expressions/swizzle/read/vec3/f16.wgsl b/test/tint/expressions/swizzle/read/vec3/f16.wgsl new file mode 100644 index 0000000000..c60121dd30 --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/f16.wgsl @@ -0,0 +1,144 @@ +enable f16; +struct S { + v: vec3, +}; + +var P : S; + +fn f() { + var v = P.v; + + var x = P.v.x; + var y = P.v.y; + var z = P.v.z; + + var xx = P.v.xx; + var xy = P.v.xy; + var xz = P.v.xz; + var yx = P.v.yx; + var yy = P.v.yy; + var yz = P.v.yz; + var zx = P.v.zx; + var zy = P.v.zy; + var zz = P.v.zz; + + var xxx = P.v.xxx; + var xxy = P.v.xxy; + var xxz = P.v.xxz; + var xyx = P.v.xyx; + var xyy = P.v.xyy; + var xyz = P.v.xyz; + var xzx = P.v.xzx; + var xzy = P.v.xzy; + var xzz = P.v.xzz; + + var yxx = P.v.yxx; + var yxy = P.v.yxy; + var yxz = P.v.yxz; + var yyx = P.v.yyx; + var yyy = P.v.yyy; + var yyz = P.v.yyz; + var yzx = P.v.yzx; + var yzy = P.v.yzy; + var yzz = P.v.yzz; + + var zxx = P.v.zxx; + var zxy = P.v.zxy; + var zxz = P.v.zxz; + var zyx = P.v.zyx; + var zyy = P.v.zyy; + var zyz = P.v.zyz; + var zzx = P.v.zzx; + var zzy = P.v.zzy; + var zzz = P.v.zzz; + + var xxxx = P.v.xxxx; + var xxxy = P.v.xxxy; + var xxxz = P.v.xxxz; + var xxyx = P.v.xxyx; + var xxyy = P.v.xxyy; + var xxyz = P.v.xxyz; + var xxzx = P.v.xxzx; + var xxzy = P.v.xxzy; + var xxzz = P.v.xxzz; + + var xyxx = P.v.xyxx; + var xyxy = P.v.xyxy; + var xyxz = P.v.xyxz; + var xyyx = P.v.xyyx; + var xyyy = P.v.xyyy; + var xyyz = P.v.xyyz; + var xyzx = P.v.xyzx; + var xyzy = P.v.xyzy; + var xyzz = P.v.xyzz; + + var xzxx = P.v.xzxx; + var xzxy = P.v.xzxy; + var xzxz = P.v.xzxz; + var xzyx = P.v.xzyx; + var xzyy = P.v.xzyy; + var xzyz = P.v.xzyz; + var xzzx = P.v.xzzx; + var xzzy = P.v.xzzy; + var xzzz = P.v.xzzz; + + var yxxx = P.v.yxxx; + var yxxy = P.v.yxxy; + var yxxz = P.v.yxxz; + var yxyx = P.v.yxyx; + var yxyy = P.v.yxyy; + var yxyz = P.v.yxyz; + var yxzx = P.v.yxzx; + var yxzy = P.v.yxzy; + var yxzz = P.v.yxzz; + + var yyxx = P.v.yyxx; + var yyxy = P.v.yyxy; + var yyxz = P.v.yyxz; + var yyyx = P.v.yyyx; + var yyyy = P.v.yyyy; + var yyyz = P.v.yyyz; + var yyzx = P.v.yyzx; + var yyzy = P.v.yyzy; + var yyzz = P.v.yyzz; + + var yzxx = P.v.yzxx; + var yzxy = P.v.yzxy; + var yzxz = P.v.yzxz; + var yzyx = P.v.yzyx; + var yzyy = P.v.yzyy; + var yzyz = P.v.yzyz; + var yzzx = P.v.yzzx; + var yzzy = P.v.yzzy; + var yzzz = P.v.yzzz; + + var zxxx = P.v.zxxx; + var zxxy = P.v.zxxy; + var zxxz = P.v.zxxz; + var zxyx = P.v.zxyx; + var zxyy = P.v.zxyy; + var zxyz = P.v.zxyz; + var zxzx = P.v.zxzx; + var zxzy = P.v.zxzy; + var zxzz = P.v.zxzz; + + var zyxx = P.v.zyxx; + var zyxy = P.v.zyxy; + var zyxz = P.v.zyxz; + var zyyx = P.v.zyyx; + var zyyy = P.v.zyyy; + var zyyz = P.v.zyyz; + var zyzx = P.v.zyzx; + var zyzy = P.v.zyzy; + var zyzz = P.v.zyzz; + + var zzxx = P.v.zzxx; + var zzxy = P.v.zzxy; + var zzxz = P.v.zzxz; + var zzyx = P.v.zzyx; + var zzyy = P.v.zzyy; + var zzyz = P.v.zzyz; + var zzzx = P.v.zzzx; + var zzzy = P.v.zzzy; + var zzzz = P.v.zzzz; +} diff --git a/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d37fb2c57b --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,134 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + vector v; +}; + +static S P = (S)0; + +void f() { + vector v = P.v; + float16_t x = P.v.x; + float16_t y = P.v.y; + float16_t z = P.v.z; + vector xx = P.v.xx; + vector xy = P.v.xy; + vector xz = P.v.xz; + vector yx = P.v.yx; + vector yy = P.v.yy; + vector yz = P.v.yz; + vector zx = P.v.zx; + vector zy = P.v.zy; + vector zz = P.v.zz; + vector xxx = P.v.xxx; + vector xxy = P.v.xxy; + vector xxz = P.v.xxz; + vector xyx = P.v.xyx; + vector xyy = P.v.xyy; + vector xyz = P.v.xyz; + vector xzx = P.v.xzx; + vector xzy = P.v.xzy; + vector xzz = P.v.xzz; + vector yxx = P.v.yxx; + vector yxy = P.v.yxy; + vector yxz = P.v.yxz; + vector yyx = P.v.yyx; + vector yyy = P.v.yyy; + vector yyz = P.v.yyz; + vector yzx = P.v.yzx; + vector yzy = P.v.yzy; + vector yzz = P.v.yzz; + vector zxx = P.v.zxx; + vector zxy = P.v.zxy; + vector zxz = P.v.zxz; + vector zyx = P.v.zyx; + vector zyy = P.v.zyy; + vector zyz = P.v.zyz; + vector zzx = P.v.zzx; + vector zzy = P.v.zzy; + vector zzz = P.v.zzz; + vector xxxx = P.v.xxxx; + vector xxxy = P.v.xxxy; + vector xxxz = P.v.xxxz; + vector xxyx = P.v.xxyx; + vector xxyy = P.v.xxyy; + vector xxyz = P.v.xxyz; + vector xxzx = P.v.xxzx; + vector xxzy = P.v.xxzy; + vector xxzz = P.v.xxzz; + vector xyxx = P.v.xyxx; + vector xyxy = P.v.xyxy; + vector xyxz = P.v.xyxz; + vector xyyx = P.v.xyyx; + vector xyyy = P.v.xyyy; + vector xyyz = P.v.xyyz; + vector xyzx = P.v.xyzx; + vector xyzy = P.v.xyzy; + vector xyzz = P.v.xyzz; + vector xzxx = P.v.xzxx; + vector xzxy = P.v.xzxy; + vector xzxz = P.v.xzxz; + vector xzyx = P.v.xzyx; + vector xzyy = P.v.xzyy; + vector xzyz = P.v.xzyz; + vector xzzx = P.v.xzzx; + vector xzzy = P.v.xzzy; + vector xzzz = P.v.xzzz; + vector yxxx = P.v.yxxx; + vector yxxy = P.v.yxxy; + vector yxxz = P.v.yxxz; + vector yxyx = P.v.yxyx; + vector yxyy = P.v.yxyy; + vector yxyz = P.v.yxyz; + vector yxzx = P.v.yxzx; + vector yxzy = P.v.yxzy; + vector yxzz = P.v.yxzz; + vector yyxx = P.v.yyxx; + vector yyxy = P.v.yyxy; + vector yyxz = P.v.yyxz; + vector yyyx = P.v.yyyx; + vector yyyy = P.v.yyyy; + vector yyyz = P.v.yyyz; + vector yyzx = P.v.yyzx; + vector yyzy = P.v.yyzy; + vector yyzz = P.v.yyzz; + vector yzxx = P.v.yzxx; + vector yzxy = P.v.yzxy; + vector yzxz = P.v.yzxz; + vector yzyx = P.v.yzyx; + vector yzyy = P.v.yzyy; + vector yzyz = P.v.yzyz; + vector yzzx = P.v.yzzx; + vector yzzy = P.v.yzzy; + vector yzzz = P.v.yzzz; + vector zxxx = P.v.zxxx; + vector zxxy = P.v.zxxy; + vector zxxz = P.v.zxxz; + vector zxyx = P.v.zxyx; + vector zxyy = P.v.zxyy; + vector zxyz = P.v.zxyz; + vector zxzx = P.v.zxzx; + vector zxzy = P.v.zxzy; + vector zxzz = P.v.zxzz; + vector zyxx = P.v.zyxx; + vector zyxy = P.v.zyxy; + vector zyxz = P.v.zyxz; + vector zyyx = P.v.zyyx; + vector zyyy = P.v.zyyy; + vector zyyz = P.v.zyyz; + vector zyzx = P.v.zyzx; + vector zyzy = P.v.zyzy; + vector zyzz = P.v.zyzz; + vector zzxx = P.v.zzxx; + vector zzxy = P.v.zzxy; + vector zzxz = P.v.zzxz; + vector zzyx = P.v.zzyx; + vector zzyy = P.v.zzyy; + vector zzyz = P.v.zzyz; + vector zzzx = P.v.zzzx; + vector zzzy = P.v.zzzy; + vector zzzz = P.v.zzzz; +} diff --git a/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..09b853a99d --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,139 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + vector v; +}; + +static S P = (S)0; + +void f() { + vector v = P.v; + float16_t x = P.v.x; + float16_t y = P.v.y; + float16_t z = P.v.z; + vector xx = P.v.xx; + vector xy = P.v.xy; + vector xz = P.v.xz; + vector yx = P.v.yx; + vector yy = P.v.yy; + vector yz = P.v.yz; + vector zx = P.v.zx; + vector zy = P.v.zy; + vector zz = P.v.zz; + vector xxx = P.v.xxx; + vector xxy = P.v.xxy; + vector xxz = P.v.xxz; + vector xyx = P.v.xyx; + vector xyy = P.v.xyy; + vector xyz = P.v.xyz; + vector xzx = P.v.xzx; + vector xzy = P.v.xzy; + vector xzz = P.v.xzz; + vector yxx = P.v.yxx; + vector yxy = P.v.yxy; + vector yxz = P.v.yxz; + vector yyx = P.v.yyx; + vector yyy = P.v.yyy; + vector yyz = P.v.yyz; + vector yzx = P.v.yzx; + vector yzy = P.v.yzy; + vector yzz = P.v.yzz; + vector zxx = P.v.zxx; + vector zxy = P.v.zxy; + vector zxz = P.v.zxz; + vector zyx = P.v.zyx; + vector zyy = P.v.zyy; + vector zyz = P.v.zyz; + vector zzx = P.v.zzx; + vector zzy = P.v.zzy; + vector zzz = P.v.zzz; + vector xxxx = P.v.xxxx; + vector xxxy = P.v.xxxy; + vector xxxz = P.v.xxxz; + vector xxyx = P.v.xxyx; + vector xxyy = P.v.xxyy; + vector xxyz = P.v.xxyz; + vector xxzx = P.v.xxzx; + vector xxzy = P.v.xxzy; + vector xxzz = P.v.xxzz; + vector xyxx = P.v.xyxx; + vector xyxy = P.v.xyxy; + vector xyxz = P.v.xyxz; + vector xyyx = P.v.xyyx; + vector xyyy = P.v.xyyy; + vector xyyz = P.v.xyyz; + vector xyzx = P.v.xyzx; + vector xyzy = P.v.xyzy; + vector xyzz = P.v.xyzz; + vector xzxx = P.v.xzxx; + vector xzxy = P.v.xzxy; + vector xzxz = P.v.xzxz; + vector xzyx = P.v.xzyx; + vector xzyy = P.v.xzyy; + vector xzyz = P.v.xzyz; + vector xzzx = P.v.xzzx; + vector xzzy = P.v.xzzy; + vector xzzz = P.v.xzzz; + vector yxxx = P.v.yxxx; + vector yxxy = P.v.yxxy; + vector yxxz = P.v.yxxz; + vector yxyx = P.v.yxyx; + vector yxyy = P.v.yxyy; + vector yxyz = P.v.yxyz; + vector yxzx = P.v.yxzx; + vector yxzy = P.v.yxzy; + vector yxzz = P.v.yxzz; + vector yyxx = P.v.yyxx; + vector yyxy = P.v.yyxy; + vector yyxz = P.v.yyxz; + vector yyyx = P.v.yyyx; + vector yyyy = P.v.yyyy; + vector yyyz = P.v.yyyz; + vector yyzx = P.v.yyzx; + vector yyzy = P.v.yyzy; + vector yyzz = P.v.yyzz; + vector yzxx = P.v.yzxx; + vector yzxy = P.v.yzxy; + vector yzxz = P.v.yzxz; + vector yzyx = P.v.yzyx; + vector yzyy = P.v.yzyy; + vector yzyz = P.v.yzyz; + vector yzzx = P.v.yzzx; + vector yzzy = P.v.yzzy; + vector yzzz = P.v.yzzz; + vector zxxx = P.v.zxxx; + vector zxxy = P.v.zxxy; + vector zxxz = P.v.zxxz; + vector zxyx = P.v.zxyx; + vector zxyy = P.v.zxyy; + vector zxyz = P.v.zxyz; + vector zxzx = P.v.zxzx; + vector zxzy = P.v.zxzy; + vector zxzz = P.v.zxzz; + vector zyxx = P.v.zyxx; + vector zyxy = P.v.zyxy; + vector zyxz = P.v.zyxz; + vector zyyx = P.v.zyyx; + vector zyyy = P.v.zyyy; + vector zyyz = P.v.zyyz; + vector zyzx = P.v.zyzx; + vector zyzy = P.v.zyzy; + vector zyzz = P.v.zyzz; + vector zzxx = P.v.zzxx; + vector zzxy = P.v.zzxy; + vector zzxz = P.v.zzxz; + vector zzyx = P.v.zzyx; + vector zzyy = P.v.zzyy; + vector zzyz = P.v.zzyz; + vector zzzx = P.v.zzzx; + vector zzzy = P.v.zzzy; + vector zzzz = P.v.zzzz; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DD905D7700(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.glsl b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9c3237ff3b --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.glsl @@ -0,0 +1,136 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +struct S { + f16vec3 v; +}; + +S P = S(f16vec3(0.0hf, 0.0hf, 0.0hf)); +void f() { + f16vec3 v = P.v; + float16_t x = P.v.x; + float16_t y = P.v.y; + float16_t z = P.v.z; + f16vec2 xx = P.v.xx; + f16vec2 xy = P.v.xy; + f16vec2 xz = P.v.xz; + f16vec2 yx = P.v.yx; + f16vec2 yy = P.v.yy; + f16vec2 yz = P.v.yz; + f16vec2 zx = P.v.zx; + f16vec2 zy = P.v.zy; + f16vec2 zz = P.v.zz; + f16vec3 xxx = P.v.xxx; + f16vec3 xxy = P.v.xxy; + f16vec3 xxz = P.v.xxz; + f16vec3 xyx = P.v.xyx; + f16vec3 xyy = P.v.xyy; + f16vec3 xyz = P.v.xyz; + f16vec3 xzx = P.v.xzx; + f16vec3 xzy = P.v.xzy; + f16vec3 xzz = P.v.xzz; + f16vec3 yxx = P.v.yxx; + f16vec3 yxy = P.v.yxy; + f16vec3 yxz = P.v.yxz; + f16vec3 yyx = P.v.yyx; + f16vec3 yyy = P.v.yyy; + f16vec3 yyz = P.v.yyz; + f16vec3 yzx = P.v.yzx; + f16vec3 yzy = P.v.yzy; + f16vec3 yzz = P.v.yzz; + f16vec3 zxx = P.v.zxx; + f16vec3 zxy = P.v.zxy; + f16vec3 zxz = P.v.zxz; + f16vec3 zyx = P.v.zyx; + f16vec3 zyy = P.v.zyy; + f16vec3 zyz = P.v.zyz; + f16vec3 zzx = P.v.zzx; + f16vec3 zzy = P.v.zzy; + f16vec3 zzz = P.v.zzz; + f16vec4 xxxx = P.v.xxxx; + f16vec4 xxxy = P.v.xxxy; + f16vec4 xxxz = P.v.xxxz; + f16vec4 xxyx = P.v.xxyx; + f16vec4 xxyy = P.v.xxyy; + f16vec4 xxyz = P.v.xxyz; + f16vec4 xxzx = P.v.xxzx; + f16vec4 xxzy = P.v.xxzy; + f16vec4 xxzz = P.v.xxzz; + f16vec4 xyxx = P.v.xyxx; + f16vec4 xyxy = P.v.xyxy; + f16vec4 xyxz = P.v.xyxz; + f16vec4 xyyx = P.v.xyyx; + f16vec4 xyyy = P.v.xyyy; + f16vec4 xyyz = P.v.xyyz; + f16vec4 xyzx = P.v.xyzx; + f16vec4 xyzy = P.v.xyzy; + f16vec4 xyzz = P.v.xyzz; + f16vec4 xzxx = P.v.xzxx; + f16vec4 xzxy = P.v.xzxy; + f16vec4 xzxz = P.v.xzxz; + f16vec4 xzyx = P.v.xzyx; + f16vec4 xzyy = P.v.xzyy; + f16vec4 xzyz = P.v.xzyz; + f16vec4 xzzx = P.v.xzzx; + f16vec4 xzzy = P.v.xzzy; + f16vec4 xzzz = P.v.xzzz; + f16vec4 yxxx = P.v.yxxx; + f16vec4 yxxy = P.v.yxxy; + f16vec4 yxxz = P.v.yxxz; + f16vec4 yxyx = P.v.yxyx; + f16vec4 yxyy = P.v.yxyy; + f16vec4 yxyz = P.v.yxyz; + f16vec4 yxzx = P.v.yxzx; + f16vec4 yxzy = P.v.yxzy; + f16vec4 yxzz = P.v.yxzz; + f16vec4 yyxx = P.v.yyxx; + f16vec4 yyxy = P.v.yyxy; + f16vec4 yyxz = P.v.yyxz; + f16vec4 yyyx = P.v.yyyx; + f16vec4 yyyy = P.v.yyyy; + f16vec4 yyyz = P.v.yyyz; + f16vec4 yyzx = P.v.yyzx; + f16vec4 yyzy = P.v.yyzy; + f16vec4 yyzz = P.v.yyzz; + f16vec4 yzxx = P.v.yzxx; + f16vec4 yzxy = P.v.yzxy; + f16vec4 yzxz = P.v.yzxz; + f16vec4 yzyx = P.v.yzyx; + f16vec4 yzyy = P.v.yzyy; + f16vec4 yzyz = P.v.yzyz; + f16vec4 yzzx = P.v.yzzx; + f16vec4 yzzy = P.v.yzzy; + f16vec4 yzzz = P.v.yzzz; + f16vec4 zxxx = P.v.zxxx; + f16vec4 zxxy = P.v.zxxy; + f16vec4 zxxz = P.v.zxxz; + f16vec4 zxyx = P.v.zxyx; + f16vec4 zxyy = P.v.zxyy; + f16vec4 zxyz = P.v.zxyz; + f16vec4 zxzx = P.v.zxzx; + f16vec4 zxzy = P.v.zxzy; + f16vec4 zxzz = P.v.zxzz; + f16vec4 zyxx = P.v.zyxx; + f16vec4 zyxy = P.v.zyxy; + f16vec4 zyxz = P.v.zyxz; + f16vec4 zyyx = P.v.zyyx; + f16vec4 zyyy = P.v.zyyy; + f16vec4 zyyz = P.v.zyyz; + f16vec4 zyzx = P.v.zyzx; + f16vec4 zyzy = P.v.zyzy; + f16vec4 zyzz = P.v.zyzz; + f16vec4 zzxx = P.v.zzxx; + f16vec4 zzxy = P.v.zzxy; + f16vec4 zzxz = P.v.zzxz; + f16vec4 zzyx = P.v.zzyx; + f16vec4 zzyy = P.v.zzyy; + f16vec4 zzyz = P.v.zzyz; + f16vec4 zzzx = P.v.zzzx; + f16vec4 zzzy = P.v.zzzy; + f16vec4 zzzz = P.v.zzzz; +} + diff --git a/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.msl b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..4ea8f92629 --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.msl @@ -0,0 +1,132 @@ +#include + +using namespace metal; +struct S { + half3 v; +}; + +void f() { + thread S tint_symbol = {}; + half3 v = tint_symbol.v; + half x = tint_symbol.v[0]; + half y = tint_symbol.v[1]; + half z = tint_symbol.v[2]; + half2 xx = half3(tint_symbol.v).xx; + half2 xy = half3(tint_symbol.v).xy; + half2 xz = half3(tint_symbol.v).xz; + half2 yx = half3(tint_symbol.v).yx; + half2 yy = half3(tint_symbol.v).yy; + half2 yz = half3(tint_symbol.v).yz; + half2 zx = half3(tint_symbol.v).zx; + half2 zy = half3(tint_symbol.v).zy; + half2 zz = half3(tint_symbol.v).zz; + half3 xxx = half3(tint_symbol.v).xxx; + half3 xxy = half3(tint_symbol.v).xxy; + half3 xxz = half3(tint_symbol.v).xxz; + half3 xyx = half3(tint_symbol.v).xyx; + half3 xyy = half3(tint_symbol.v).xyy; + half3 xyz = half3(tint_symbol.v).xyz; + half3 xzx = half3(tint_symbol.v).xzx; + half3 xzy = half3(tint_symbol.v).xzy; + half3 xzz = half3(tint_symbol.v).xzz; + half3 yxx = half3(tint_symbol.v).yxx; + half3 yxy = half3(tint_symbol.v).yxy; + half3 yxz = half3(tint_symbol.v).yxz; + half3 yyx = half3(tint_symbol.v).yyx; + half3 yyy = half3(tint_symbol.v).yyy; + half3 yyz = half3(tint_symbol.v).yyz; + half3 yzx = half3(tint_symbol.v).yzx; + half3 yzy = half3(tint_symbol.v).yzy; + half3 yzz = half3(tint_symbol.v).yzz; + half3 zxx = half3(tint_symbol.v).zxx; + half3 zxy = half3(tint_symbol.v).zxy; + half3 zxz = half3(tint_symbol.v).zxz; + half3 zyx = half3(tint_symbol.v).zyx; + half3 zyy = half3(tint_symbol.v).zyy; + half3 zyz = half3(tint_symbol.v).zyz; + half3 zzx = half3(tint_symbol.v).zzx; + half3 zzy = half3(tint_symbol.v).zzy; + half3 zzz = half3(tint_symbol.v).zzz; + half4 xxxx = half3(tint_symbol.v).xxxx; + half4 xxxy = half3(tint_symbol.v).xxxy; + half4 xxxz = half3(tint_symbol.v).xxxz; + half4 xxyx = half3(tint_symbol.v).xxyx; + half4 xxyy = half3(tint_symbol.v).xxyy; + half4 xxyz = half3(tint_symbol.v).xxyz; + half4 xxzx = half3(tint_symbol.v).xxzx; + half4 xxzy = half3(tint_symbol.v).xxzy; + half4 xxzz = half3(tint_symbol.v).xxzz; + half4 xyxx = half3(tint_symbol.v).xyxx; + half4 xyxy = half3(tint_symbol.v).xyxy; + half4 xyxz = half3(tint_symbol.v).xyxz; + half4 xyyx = half3(tint_symbol.v).xyyx; + half4 xyyy = half3(tint_symbol.v).xyyy; + half4 xyyz = half3(tint_symbol.v).xyyz; + half4 xyzx = half3(tint_symbol.v).xyzx; + half4 xyzy = half3(tint_symbol.v).xyzy; + half4 xyzz = half3(tint_symbol.v).xyzz; + half4 xzxx = half3(tint_symbol.v).xzxx; + half4 xzxy = half3(tint_symbol.v).xzxy; + half4 xzxz = half3(tint_symbol.v).xzxz; + half4 xzyx = half3(tint_symbol.v).xzyx; + half4 xzyy = half3(tint_symbol.v).xzyy; + half4 xzyz = half3(tint_symbol.v).xzyz; + half4 xzzx = half3(tint_symbol.v).xzzx; + half4 xzzy = half3(tint_symbol.v).xzzy; + half4 xzzz = half3(tint_symbol.v).xzzz; + half4 yxxx = half3(tint_symbol.v).yxxx; + half4 yxxy = half3(tint_symbol.v).yxxy; + half4 yxxz = half3(tint_symbol.v).yxxz; + half4 yxyx = half3(tint_symbol.v).yxyx; + half4 yxyy = half3(tint_symbol.v).yxyy; + half4 yxyz = half3(tint_symbol.v).yxyz; + half4 yxzx = half3(tint_symbol.v).yxzx; + half4 yxzy = half3(tint_symbol.v).yxzy; + half4 yxzz = half3(tint_symbol.v).yxzz; + half4 yyxx = half3(tint_symbol.v).yyxx; + half4 yyxy = half3(tint_symbol.v).yyxy; + half4 yyxz = half3(tint_symbol.v).yyxz; + half4 yyyx = half3(tint_symbol.v).yyyx; + half4 yyyy = half3(tint_symbol.v).yyyy; + half4 yyyz = half3(tint_symbol.v).yyyz; + half4 yyzx = half3(tint_symbol.v).yyzx; + half4 yyzy = half3(tint_symbol.v).yyzy; + half4 yyzz = half3(tint_symbol.v).yyzz; + half4 yzxx = half3(tint_symbol.v).yzxx; + half4 yzxy = half3(tint_symbol.v).yzxy; + half4 yzxz = half3(tint_symbol.v).yzxz; + half4 yzyx = half3(tint_symbol.v).yzyx; + half4 yzyy = half3(tint_symbol.v).yzyy; + half4 yzyz = half3(tint_symbol.v).yzyz; + half4 yzzx = half3(tint_symbol.v).yzzx; + half4 yzzy = half3(tint_symbol.v).yzzy; + half4 yzzz = half3(tint_symbol.v).yzzz; + half4 zxxx = half3(tint_symbol.v).zxxx; + half4 zxxy = half3(tint_symbol.v).zxxy; + half4 zxxz = half3(tint_symbol.v).zxxz; + half4 zxyx = half3(tint_symbol.v).zxyx; + half4 zxyy = half3(tint_symbol.v).zxyy; + half4 zxyz = half3(tint_symbol.v).zxyz; + half4 zxzx = half3(tint_symbol.v).zxzx; + half4 zxzy = half3(tint_symbol.v).zxzy; + half4 zxzz = half3(tint_symbol.v).zxzz; + half4 zyxx = half3(tint_symbol.v).zyxx; + half4 zyxy = half3(tint_symbol.v).zyxy; + half4 zyxz = half3(tint_symbol.v).zyxz; + half4 zyyx = half3(tint_symbol.v).zyyx; + half4 zyyy = half3(tint_symbol.v).zyyy; + half4 zyyz = half3(tint_symbol.v).zyyz; + half4 zyzx = half3(tint_symbol.v).zyzx; + half4 zyzy = half3(tint_symbol.v).zyzy; + half4 zyzz = half3(tint_symbol.v).zyzz; + half4 zzxx = half3(tint_symbol.v).zzxx; + half4 zzxy = half3(tint_symbol.v).zzxy; + half4 zzxz = half3(tint_symbol.v).zzxz; + half4 zzyx = half3(tint_symbol.v).zzyx; + half4 zzyy = half3(tint_symbol.v).zzyy; + half4 zzyz = half3(tint_symbol.v).zzyz; + half4 zzzx = half3(tint_symbol.v).zzzx; + half4 zzzy = half3(tint_symbol.v).zzzy; + half4 zzzz = half3(tint_symbol.v).zzzz; +} + diff --git a/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb69483a52 --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,773 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 509 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %S "S" + OpMemberName %S 0 "v" + OpName %P "P" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpName %x "x" + OpName %y "y" + OpName %z "z" + OpName %xx "xx" + OpName %xy "xy" + OpName %xz "xz" + OpName %yx "yx" + OpName %yy "yy" + OpName %yz "yz" + OpName %zx "zx" + OpName %zy "zy" + OpName %zz "zz" + OpName %xxx "xxx" + OpName %xxy "xxy" + OpName %xxz "xxz" + OpName %xyx "xyx" + OpName %xyy "xyy" + OpName %xyz "xyz" + OpName %xzx "xzx" + OpName %xzy "xzy" + OpName %xzz "xzz" + OpName %yxx "yxx" + OpName %yxy "yxy" + OpName %yxz "yxz" + OpName %yyx "yyx" + OpName %yyy "yyy" + OpName %yyz "yyz" + OpName %yzx "yzx" + OpName %yzy "yzy" + OpName %yzz "yzz" + OpName %zxx "zxx" + OpName %zxy "zxy" + OpName %zxz "zxz" + OpName %zyx "zyx" + OpName %zyy "zyy" + OpName %zyz "zyz" + OpName %zzx "zzx" + OpName %zzy "zzy" + OpName %zzz "zzz" + OpName %xxxx "xxxx" + OpName %xxxy "xxxy" + OpName %xxxz "xxxz" + OpName %xxyx "xxyx" + OpName %xxyy "xxyy" + OpName %xxyz "xxyz" + OpName %xxzx "xxzx" + OpName %xxzy "xxzy" + OpName %xxzz "xxzz" + OpName %xyxx "xyxx" + OpName %xyxy "xyxy" + OpName %xyxz "xyxz" + OpName %xyyx "xyyx" + OpName %xyyy "xyyy" + OpName %xyyz "xyyz" + OpName %xyzx "xyzx" + OpName %xyzy "xyzy" + OpName %xyzz "xyzz" + OpName %xzxx "xzxx" + OpName %xzxy "xzxy" + OpName %xzxz "xzxz" + OpName %xzyx "xzyx" + OpName %xzyy "xzyy" + OpName %xzyz "xzyz" + OpName %xzzx "xzzx" + OpName %xzzy "xzzy" + OpName %xzzz "xzzz" + OpName %yxxx "yxxx" + OpName %yxxy "yxxy" + OpName %yxxz "yxxz" + OpName %yxyx "yxyx" + OpName %yxyy "yxyy" + OpName %yxyz "yxyz" + OpName %yxzx "yxzx" + OpName %yxzy "yxzy" + OpName %yxzz "yxzz" + OpName %yyxx "yyxx" + OpName %yyxy "yyxy" + OpName %yyxz "yyxz" + OpName %yyyx "yyyx" + OpName %yyyy "yyyy" + OpName %yyyz "yyyz" + OpName %yyzx "yyzx" + OpName %yyzy "yyzy" + OpName %yyzz "yyzz" + OpName %yzxx "yzxx" + OpName %yzxy "yzxy" + OpName %yzxz "yzxz" + OpName %yzyx "yzyx" + OpName %yzyy "yzyy" + OpName %yzyz "yzyz" + OpName %yzzx "yzzx" + OpName %yzzy "yzzy" + OpName %yzzz "yzzz" + OpName %zxxx "zxxx" + OpName %zxxy "zxxy" + OpName %zxxz "zxxz" + OpName %zxyx "zxyx" + OpName %zxyy "zxyy" + OpName %zxyz "zxyz" + OpName %zxzx "zxzx" + OpName %zxzy "zxzy" + OpName %zxzz "zxzz" + OpName %zyxx "zyxx" + OpName %zyxy "zyxy" + OpName %zyxz "zyxz" + OpName %zyyx "zyyx" + OpName %zyyy "zyyy" + OpName %zyyz "zyyz" + OpName %zyzx "zyzx" + OpName %zyzy "zyzy" + OpName %zyzz "zyzz" + OpName %zzxx "zzxx" + OpName %zzxy "zzxy" + OpName %zzxz "zzxz" + OpName %zzyx "zzyx" + OpName %zzyy "zzyy" + OpName %zzyz "zzyz" + OpName %zzzx "zzzx" + OpName %zzzy "zzzy" + OpName %zzzz "zzzz" + OpMemberDecorate %S 0 Offset 0 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %S = OpTypeStruct %v3half +%_ptr_Private_S = OpTypePointer Private %S + %6 = OpConstantNull %S + %P = OpVariable %_ptr_Private_S Private %6 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_v3half = OpTypePointer Private %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half + %20 = OpConstantNull %v3half +%_ptr_Private_half = OpTypePointer Private %half +%_ptr_Function_half = OpTypePointer Function %half + %26 = OpConstantNull %half + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %v2half = OpTypeVector %half 2 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %41 = OpConstantNull %v2half + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %188 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %v = OpVariable %_ptr_Function_v3half Function %20 + %x = OpVariable %_ptr_Function_half Function %26 + %y = OpVariable %_ptr_Function_half Function %26 + %z = OpVariable %_ptr_Function_half Function %26 + %xx = OpVariable %_ptr_Function_v2half Function %41 + %xy = OpVariable %_ptr_Function_v2half Function %41 + %xz = OpVariable %_ptr_Function_v2half Function %41 + %yx = OpVariable %_ptr_Function_v2half Function %41 + %yy = OpVariable %_ptr_Function_v2half Function %41 + %yz = OpVariable %_ptr_Function_v2half Function %41 + %zx = OpVariable %_ptr_Function_v2half Function %41 + %zy = OpVariable %_ptr_Function_v2half Function %41 + %zz = OpVariable %_ptr_Function_v2half Function %41 + %xxx = OpVariable %_ptr_Function_v3half Function %20 + %xxy = OpVariable %_ptr_Function_v3half Function %20 + %xxz = OpVariable %_ptr_Function_v3half Function %20 + %xyx = OpVariable %_ptr_Function_v3half Function %20 + %xyy = OpVariable %_ptr_Function_v3half Function %20 + %xyz = OpVariable %_ptr_Function_v3half Function %20 + %xzx = OpVariable %_ptr_Function_v3half Function %20 + %xzy = OpVariable %_ptr_Function_v3half Function %20 + %xzz = OpVariable %_ptr_Function_v3half Function %20 + %yxx = OpVariable %_ptr_Function_v3half Function %20 + %yxy = OpVariable %_ptr_Function_v3half Function %20 + %yxz = OpVariable %_ptr_Function_v3half Function %20 + %yyx = OpVariable %_ptr_Function_v3half Function %20 + %yyy = OpVariable %_ptr_Function_v3half Function %20 + %yyz = OpVariable %_ptr_Function_v3half Function %20 + %yzx = OpVariable %_ptr_Function_v3half Function %20 + %yzy = OpVariable %_ptr_Function_v3half Function %20 + %yzz = OpVariable %_ptr_Function_v3half Function %20 + %zxx = OpVariable %_ptr_Function_v3half Function %20 + %zxy = OpVariable %_ptr_Function_v3half Function %20 + %zxz = OpVariable %_ptr_Function_v3half Function %20 + %zyx = OpVariable %_ptr_Function_v3half Function %20 + %zyy = OpVariable %_ptr_Function_v3half Function %20 + %zyz = OpVariable %_ptr_Function_v3half Function %20 + %zzx = OpVariable %_ptr_Function_v3half Function %20 + %zzy = OpVariable %_ptr_Function_v3half Function %20 + %zzz = OpVariable %_ptr_Function_v3half Function %20 + %xxxx = OpVariable %_ptr_Function_v4half Function %188 + %xxxy = OpVariable %_ptr_Function_v4half Function %188 + %xxxz = OpVariable %_ptr_Function_v4half Function %188 + %xxyx = OpVariable %_ptr_Function_v4half Function %188 + %xxyy = OpVariable %_ptr_Function_v4half Function %188 + %xxyz = OpVariable %_ptr_Function_v4half Function %188 + %xxzx = OpVariable %_ptr_Function_v4half Function %188 + %xxzy = OpVariable %_ptr_Function_v4half Function %188 + %xxzz = OpVariable %_ptr_Function_v4half Function %188 + %xyxx = OpVariable %_ptr_Function_v4half Function %188 + %xyxy = OpVariable %_ptr_Function_v4half Function %188 + %xyxz = OpVariable %_ptr_Function_v4half Function %188 + %xyyx = OpVariable %_ptr_Function_v4half Function %188 + %xyyy = OpVariable %_ptr_Function_v4half Function %188 + %xyyz = OpVariable %_ptr_Function_v4half Function %188 + %xyzx = OpVariable %_ptr_Function_v4half Function %188 + %xyzy = OpVariable %_ptr_Function_v4half Function %188 + %xyzz = OpVariable %_ptr_Function_v4half Function %188 + %xzxx = OpVariable %_ptr_Function_v4half Function %188 + %xzxy = OpVariable %_ptr_Function_v4half Function %188 + %xzxz = OpVariable %_ptr_Function_v4half Function %188 + %xzyx = OpVariable %_ptr_Function_v4half Function %188 + %xzyy = OpVariable %_ptr_Function_v4half Function %188 + %xzyz = OpVariable %_ptr_Function_v4half Function %188 + %xzzx = OpVariable %_ptr_Function_v4half Function %188 + %xzzy = OpVariable %_ptr_Function_v4half Function %188 + %xzzz = OpVariable %_ptr_Function_v4half Function %188 + %yxxx = OpVariable %_ptr_Function_v4half Function %188 + %yxxy = OpVariable %_ptr_Function_v4half Function %188 + %yxxz = OpVariable %_ptr_Function_v4half Function %188 + %yxyx = OpVariable %_ptr_Function_v4half Function %188 + %yxyy = OpVariable %_ptr_Function_v4half Function %188 + %yxyz = OpVariable %_ptr_Function_v4half Function %188 + %yxzx = OpVariable %_ptr_Function_v4half Function %188 + %yxzy = OpVariable %_ptr_Function_v4half Function %188 + %yxzz = OpVariable %_ptr_Function_v4half Function %188 + %yyxx = OpVariable %_ptr_Function_v4half Function %188 + %yyxy = OpVariable %_ptr_Function_v4half Function %188 + %yyxz = OpVariable %_ptr_Function_v4half Function %188 + %yyyx = OpVariable %_ptr_Function_v4half Function %188 + %yyyy = OpVariable %_ptr_Function_v4half Function %188 + %yyyz = OpVariable %_ptr_Function_v4half Function %188 + %yyzx = OpVariable %_ptr_Function_v4half Function %188 + %yyzy = OpVariable %_ptr_Function_v4half Function %188 + %yyzz = OpVariable %_ptr_Function_v4half Function %188 + %yzxx = OpVariable %_ptr_Function_v4half Function %188 + %yzxy = OpVariable %_ptr_Function_v4half Function %188 + %yzxz = OpVariable %_ptr_Function_v4half Function %188 + %yzyx = OpVariable %_ptr_Function_v4half Function %188 + %yzyy = OpVariable %_ptr_Function_v4half Function %188 + %yzyz = OpVariable %_ptr_Function_v4half Function %188 + %yzzx = OpVariable %_ptr_Function_v4half Function %188 + %yzzy = OpVariable %_ptr_Function_v4half Function %188 + %yzzz = OpVariable %_ptr_Function_v4half Function %188 + %zxxx = OpVariable %_ptr_Function_v4half Function %188 + %zxxy = OpVariable %_ptr_Function_v4half Function %188 + %zxxz = OpVariable %_ptr_Function_v4half Function %188 + %zxyx = OpVariable %_ptr_Function_v4half Function %188 + %zxyy = OpVariable %_ptr_Function_v4half Function %188 + %zxyz = OpVariable %_ptr_Function_v4half Function %188 + %zxzx = OpVariable %_ptr_Function_v4half Function %188 + %zxzy = OpVariable %_ptr_Function_v4half Function %188 + %zxzz = OpVariable %_ptr_Function_v4half Function %188 + %zyxx = OpVariable %_ptr_Function_v4half Function %188 + %zyxy = OpVariable %_ptr_Function_v4half Function %188 + %zyxz = OpVariable %_ptr_Function_v4half Function %188 + %zyyx = OpVariable %_ptr_Function_v4half Function %188 + %zyyy = OpVariable %_ptr_Function_v4half Function %188 + %zyyz = OpVariable %_ptr_Function_v4half Function %188 + %zyzx = OpVariable %_ptr_Function_v4half Function %188 + %zyzy = OpVariable %_ptr_Function_v4half Function %188 + %zyzz = OpVariable %_ptr_Function_v4half Function %188 + %zzxx = OpVariable %_ptr_Function_v4half Function %188 + %zzxy = OpVariable %_ptr_Function_v4half Function %188 + %zzxz = OpVariable %_ptr_Function_v4half Function %188 + %zzyx = OpVariable %_ptr_Function_v4half Function %188 + %zzyy = OpVariable %_ptr_Function_v4half Function %188 + %zzyz = OpVariable %_ptr_Function_v4half Function %188 + %zzzx = OpVariable %_ptr_Function_v4half Function %188 + %zzzy = OpVariable %_ptr_Function_v4half Function %188 + %zzzz = OpVariable %_ptr_Function_v4half Function %188 + %16 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %17 = OpLoad %v3half %16 + OpStore %v %17 + %22 = OpAccessChain %_ptr_Private_half %P %uint_0 %uint_0 + %23 = OpLoad %half %22 + OpStore %x %23 + %28 = OpAccessChain %_ptr_Private_half %P %uint_0 %uint_1 + %29 = OpLoad %half %28 + OpStore %y %29 + %32 = OpAccessChain %_ptr_Private_half %P %uint_0 %uint_2 + %33 = OpLoad %half %32 + OpStore %z %33 + %35 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %37 = OpLoad %v3half %35 + %38 = OpVectorShuffle %v2half %37 %37 0 0 + OpStore %xx %38 + %42 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %43 = OpLoad %v3half %42 + %44 = OpVectorShuffle %v2half %43 %43 0 1 + OpStore %xy %44 + %46 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %47 = OpLoad %v3half %46 + %48 = OpVectorShuffle %v2half %47 %47 0 2 + OpStore %xz %48 + %50 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %51 = OpLoad %v3half %50 + %52 = OpVectorShuffle %v2half %51 %51 1 0 + OpStore %yx %52 + %54 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %55 = OpLoad %v3half %54 + %56 = OpVectorShuffle %v2half %55 %55 1 1 + OpStore %yy %56 + %58 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %59 = OpLoad %v3half %58 + %60 = OpVectorShuffle %v2half %59 %59 1 2 + OpStore %yz %60 + %62 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %63 = OpLoad %v3half %62 + %64 = OpVectorShuffle %v2half %63 %63 2 0 + OpStore %zx %64 + %66 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %67 = OpLoad %v3half %66 + %68 = OpVectorShuffle %v2half %67 %67 2 1 + OpStore %zy %68 + %70 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %71 = OpLoad %v3half %70 + %72 = OpVectorShuffle %v2half %71 %71 2 2 + OpStore %zz %72 + %74 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %75 = OpLoad %v3half %74 + %76 = OpVectorShuffle %v3half %75 %75 0 0 0 + OpStore %xxx %76 + %78 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %79 = OpLoad %v3half %78 + %80 = OpVectorShuffle %v3half %79 %79 0 0 1 + OpStore %xxy %80 + %82 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %83 = OpLoad %v3half %82 + %84 = OpVectorShuffle %v3half %83 %83 0 0 2 + OpStore %xxz %84 + %86 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %87 = OpLoad %v3half %86 + %88 = OpVectorShuffle %v3half %87 %87 0 1 0 + OpStore %xyx %88 + %90 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %91 = OpLoad %v3half %90 + %92 = OpVectorShuffle %v3half %91 %91 0 1 1 + OpStore %xyy %92 + %94 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %95 = OpLoad %v3half %94 + %96 = OpVectorShuffle %v3half %95 %95 0 1 2 + OpStore %xyz %96 + %98 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %99 = OpLoad %v3half %98 + %100 = OpVectorShuffle %v3half %99 %99 0 2 0 + OpStore %xzx %100 + %102 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %103 = OpLoad %v3half %102 + %104 = OpVectorShuffle %v3half %103 %103 0 2 1 + OpStore %xzy %104 + %106 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %107 = OpLoad %v3half %106 + %108 = OpVectorShuffle %v3half %107 %107 0 2 2 + OpStore %xzz %108 + %110 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %111 = OpLoad %v3half %110 + %112 = OpVectorShuffle %v3half %111 %111 1 0 0 + OpStore %yxx %112 + %114 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %115 = OpLoad %v3half %114 + %116 = OpVectorShuffle %v3half %115 %115 1 0 1 + OpStore %yxy %116 + %118 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %119 = OpLoad %v3half %118 + %120 = OpVectorShuffle %v3half %119 %119 1 0 2 + OpStore %yxz %120 + %122 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %123 = OpLoad %v3half %122 + %124 = OpVectorShuffle %v3half %123 %123 1 1 0 + OpStore %yyx %124 + %126 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %127 = OpLoad %v3half %126 + %128 = OpVectorShuffle %v3half %127 %127 1 1 1 + OpStore %yyy %128 + %130 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %131 = OpLoad %v3half %130 + %132 = OpVectorShuffle %v3half %131 %131 1 1 2 + OpStore %yyz %132 + %134 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %135 = OpLoad %v3half %134 + %136 = OpVectorShuffle %v3half %135 %135 1 2 0 + OpStore %yzx %136 + %138 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %139 = OpLoad %v3half %138 + %140 = OpVectorShuffle %v3half %139 %139 1 2 1 + OpStore %yzy %140 + %142 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %143 = OpLoad %v3half %142 + %144 = OpVectorShuffle %v3half %143 %143 1 2 2 + OpStore %yzz %144 + %146 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %147 = OpLoad %v3half %146 + %148 = OpVectorShuffle %v3half %147 %147 2 0 0 + OpStore %zxx %148 + %150 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %151 = OpLoad %v3half %150 + %152 = OpVectorShuffle %v3half %151 %151 2 0 1 + OpStore %zxy %152 + %154 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %155 = OpLoad %v3half %154 + %156 = OpVectorShuffle %v3half %155 %155 2 0 2 + OpStore %zxz %156 + %158 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %159 = OpLoad %v3half %158 + %160 = OpVectorShuffle %v3half %159 %159 2 1 0 + OpStore %zyx %160 + %162 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %163 = OpLoad %v3half %162 + %164 = OpVectorShuffle %v3half %163 %163 2 1 1 + OpStore %zyy %164 + %166 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %167 = OpLoad %v3half %166 + %168 = OpVectorShuffle %v3half %167 %167 2 1 2 + OpStore %zyz %168 + %170 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %171 = OpLoad %v3half %170 + %172 = OpVectorShuffle %v3half %171 %171 2 2 0 + OpStore %zzx %172 + %174 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %175 = OpLoad %v3half %174 + %176 = OpVectorShuffle %v3half %175 %175 2 2 1 + OpStore %zzy %176 + %178 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %179 = OpLoad %v3half %178 + %180 = OpVectorShuffle %v3half %179 %179 2 2 2 + OpStore %zzz %180 + %182 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %184 = OpLoad %v3half %182 + %185 = OpVectorShuffle %v4half %184 %184 0 0 0 0 + OpStore %xxxx %185 + %189 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %190 = OpLoad %v3half %189 + %191 = OpVectorShuffle %v4half %190 %190 0 0 0 1 + OpStore %xxxy %191 + %193 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %194 = OpLoad %v3half %193 + %195 = OpVectorShuffle %v4half %194 %194 0 0 0 2 + OpStore %xxxz %195 + %197 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %198 = OpLoad %v3half %197 + %199 = OpVectorShuffle %v4half %198 %198 0 0 1 0 + OpStore %xxyx %199 + %201 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %202 = OpLoad %v3half %201 + %203 = OpVectorShuffle %v4half %202 %202 0 0 1 1 + OpStore %xxyy %203 + %205 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %206 = OpLoad %v3half %205 + %207 = OpVectorShuffle %v4half %206 %206 0 0 1 2 + OpStore %xxyz %207 + %209 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %210 = OpLoad %v3half %209 + %211 = OpVectorShuffle %v4half %210 %210 0 0 2 0 + OpStore %xxzx %211 + %213 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %214 = OpLoad %v3half %213 + %215 = OpVectorShuffle %v4half %214 %214 0 0 2 1 + OpStore %xxzy %215 + %217 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %218 = OpLoad %v3half %217 + %219 = OpVectorShuffle %v4half %218 %218 0 0 2 2 + OpStore %xxzz %219 + %221 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %222 = OpLoad %v3half %221 + %223 = OpVectorShuffle %v4half %222 %222 0 1 0 0 + OpStore %xyxx %223 + %225 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %226 = OpLoad %v3half %225 + %227 = OpVectorShuffle %v4half %226 %226 0 1 0 1 + OpStore %xyxy %227 + %229 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %230 = OpLoad %v3half %229 + %231 = OpVectorShuffle %v4half %230 %230 0 1 0 2 + OpStore %xyxz %231 + %233 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %234 = OpLoad %v3half %233 + %235 = OpVectorShuffle %v4half %234 %234 0 1 1 0 + OpStore %xyyx %235 + %237 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %238 = OpLoad %v3half %237 + %239 = OpVectorShuffle %v4half %238 %238 0 1 1 1 + OpStore %xyyy %239 + %241 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %242 = OpLoad %v3half %241 + %243 = OpVectorShuffle %v4half %242 %242 0 1 1 2 + OpStore %xyyz %243 + %245 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %246 = OpLoad %v3half %245 + %247 = OpVectorShuffle %v4half %246 %246 0 1 2 0 + OpStore %xyzx %247 + %249 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %250 = OpLoad %v3half %249 + %251 = OpVectorShuffle %v4half %250 %250 0 1 2 1 + OpStore %xyzy %251 + %253 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %254 = OpLoad %v3half %253 + %255 = OpVectorShuffle %v4half %254 %254 0 1 2 2 + OpStore %xyzz %255 + %257 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %258 = OpLoad %v3half %257 + %259 = OpVectorShuffle %v4half %258 %258 0 2 0 0 + OpStore %xzxx %259 + %261 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %262 = OpLoad %v3half %261 + %263 = OpVectorShuffle %v4half %262 %262 0 2 0 1 + OpStore %xzxy %263 + %265 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %266 = OpLoad %v3half %265 + %267 = OpVectorShuffle %v4half %266 %266 0 2 0 2 + OpStore %xzxz %267 + %269 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %270 = OpLoad %v3half %269 + %271 = OpVectorShuffle %v4half %270 %270 0 2 1 0 + OpStore %xzyx %271 + %273 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %274 = OpLoad %v3half %273 + %275 = OpVectorShuffle %v4half %274 %274 0 2 1 1 + OpStore %xzyy %275 + %277 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %278 = OpLoad %v3half %277 + %279 = OpVectorShuffle %v4half %278 %278 0 2 1 2 + OpStore %xzyz %279 + %281 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %282 = OpLoad %v3half %281 + %283 = OpVectorShuffle %v4half %282 %282 0 2 2 0 + OpStore %xzzx %283 + %285 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %286 = OpLoad %v3half %285 + %287 = OpVectorShuffle %v4half %286 %286 0 2 2 1 + OpStore %xzzy %287 + %289 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %290 = OpLoad %v3half %289 + %291 = OpVectorShuffle %v4half %290 %290 0 2 2 2 + OpStore %xzzz %291 + %293 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %294 = OpLoad %v3half %293 + %295 = OpVectorShuffle %v4half %294 %294 1 0 0 0 + OpStore %yxxx %295 + %297 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %298 = OpLoad %v3half %297 + %299 = OpVectorShuffle %v4half %298 %298 1 0 0 1 + OpStore %yxxy %299 + %301 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %302 = OpLoad %v3half %301 + %303 = OpVectorShuffle %v4half %302 %302 1 0 0 2 + OpStore %yxxz %303 + %305 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %306 = OpLoad %v3half %305 + %307 = OpVectorShuffle %v4half %306 %306 1 0 1 0 + OpStore %yxyx %307 + %309 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %310 = OpLoad %v3half %309 + %311 = OpVectorShuffle %v4half %310 %310 1 0 1 1 + OpStore %yxyy %311 + %313 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %314 = OpLoad %v3half %313 + %315 = OpVectorShuffle %v4half %314 %314 1 0 1 2 + OpStore %yxyz %315 + %317 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %318 = OpLoad %v3half %317 + %319 = OpVectorShuffle %v4half %318 %318 1 0 2 0 + OpStore %yxzx %319 + %321 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %322 = OpLoad %v3half %321 + %323 = OpVectorShuffle %v4half %322 %322 1 0 2 1 + OpStore %yxzy %323 + %325 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %326 = OpLoad %v3half %325 + %327 = OpVectorShuffle %v4half %326 %326 1 0 2 2 + OpStore %yxzz %327 + %329 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %330 = OpLoad %v3half %329 + %331 = OpVectorShuffle %v4half %330 %330 1 1 0 0 + OpStore %yyxx %331 + %333 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %334 = OpLoad %v3half %333 + %335 = OpVectorShuffle %v4half %334 %334 1 1 0 1 + OpStore %yyxy %335 + %337 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %338 = OpLoad %v3half %337 + %339 = OpVectorShuffle %v4half %338 %338 1 1 0 2 + OpStore %yyxz %339 + %341 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %342 = OpLoad %v3half %341 + %343 = OpVectorShuffle %v4half %342 %342 1 1 1 0 + OpStore %yyyx %343 + %345 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %346 = OpLoad %v3half %345 + %347 = OpVectorShuffle %v4half %346 %346 1 1 1 1 + OpStore %yyyy %347 + %349 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %350 = OpLoad %v3half %349 + %351 = OpVectorShuffle %v4half %350 %350 1 1 1 2 + OpStore %yyyz %351 + %353 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %354 = OpLoad %v3half %353 + %355 = OpVectorShuffle %v4half %354 %354 1 1 2 0 + OpStore %yyzx %355 + %357 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %358 = OpLoad %v3half %357 + %359 = OpVectorShuffle %v4half %358 %358 1 1 2 1 + OpStore %yyzy %359 + %361 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %362 = OpLoad %v3half %361 + %363 = OpVectorShuffle %v4half %362 %362 1 1 2 2 + OpStore %yyzz %363 + %365 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %366 = OpLoad %v3half %365 + %367 = OpVectorShuffle %v4half %366 %366 1 2 0 0 + OpStore %yzxx %367 + %369 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %370 = OpLoad %v3half %369 + %371 = OpVectorShuffle %v4half %370 %370 1 2 0 1 + OpStore %yzxy %371 + %373 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %374 = OpLoad %v3half %373 + %375 = OpVectorShuffle %v4half %374 %374 1 2 0 2 + OpStore %yzxz %375 + %377 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %378 = OpLoad %v3half %377 + %379 = OpVectorShuffle %v4half %378 %378 1 2 1 0 + OpStore %yzyx %379 + %381 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %382 = OpLoad %v3half %381 + %383 = OpVectorShuffle %v4half %382 %382 1 2 1 1 + OpStore %yzyy %383 + %385 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %386 = OpLoad %v3half %385 + %387 = OpVectorShuffle %v4half %386 %386 1 2 1 2 + OpStore %yzyz %387 + %389 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %390 = OpLoad %v3half %389 + %391 = OpVectorShuffle %v4half %390 %390 1 2 2 0 + OpStore %yzzx %391 + %393 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %394 = OpLoad %v3half %393 + %395 = OpVectorShuffle %v4half %394 %394 1 2 2 1 + OpStore %yzzy %395 + %397 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %398 = OpLoad %v3half %397 + %399 = OpVectorShuffle %v4half %398 %398 1 2 2 2 + OpStore %yzzz %399 + %401 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %402 = OpLoad %v3half %401 + %403 = OpVectorShuffle %v4half %402 %402 2 0 0 0 + OpStore %zxxx %403 + %405 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %406 = OpLoad %v3half %405 + %407 = OpVectorShuffle %v4half %406 %406 2 0 0 1 + OpStore %zxxy %407 + %409 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %410 = OpLoad %v3half %409 + %411 = OpVectorShuffle %v4half %410 %410 2 0 0 2 + OpStore %zxxz %411 + %413 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %414 = OpLoad %v3half %413 + %415 = OpVectorShuffle %v4half %414 %414 2 0 1 0 + OpStore %zxyx %415 + %417 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %418 = OpLoad %v3half %417 + %419 = OpVectorShuffle %v4half %418 %418 2 0 1 1 + OpStore %zxyy %419 + %421 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %422 = OpLoad %v3half %421 + %423 = OpVectorShuffle %v4half %422 %422 2 0 1 2 + OpStore %zxyz %423 + %425 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %426 = OpLoad %v3half %425 + %427 = OpVectorShuffle %v4half %426 %426 2 0 2 0 + OpStore %zxzx %427 + %429 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %430 = OpLoad %v3half %429 + %431 = OpVectorShuffle %v4half %430 %430 2 0 2 1 + OpStore %zxzy %431 + %433 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %434 = OpLoad %v3half %433 + %435 = OpVectorShuffle %v4half %434 %434 2 0 2 2 + OpStore %zxzz %435 + %437 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %438 = OpLoad %v3half %437 + %439 = OpVectorShuffle %v4half %438 %438 2 1 0 0 + OpStore %zyxx %439 + %441 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %442 = OpLoad %v3half %441 + %443 = OpVectorShuffle %v4half %442 %442 2 1 0 1 + OpStore %zyxy %443 + %445 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %446 = OpLoad %v3half %445 + %447 = OpVectorShuffle %v4half %446 %446 2 1 0 2 + OpStore %zyxz %447 + %449 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %450 = OpLoad %v3half %449 + %451 = OpVectorShuffle %v4half %450 %450 2 1 1 0 + OpStore %zyyx %451 + %453 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %454 = OpLoad %v3half %453 + %455 = OpVectorShuffle %v4half %454 %454 2 1 1 1 + OpStore %zyyy %455 + %457 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %458 = OpLoad %v3half %457 + %459 = OpVectorShuffle %v4half %458 %458 2 1 1 2 + OpStore %zyyz %459 + %461 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %462 = OpLoad %v3half %461 + %463 = OpVectorShuffle %v4half %462 %462 2 1 2 0 + OpStore %zyzx %463 + %465 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %466 = OpLoad %v3half %465 + %467 = OpVectorShuffle %v4half %466 %466 2 1 2 1 + OpStore %zyzy %467 + %469 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %470 = OpLoad %v3half %469 + %471 = OpVectorShuffle %v4half %470 %470 2 1 2 2 + OpStore %zyzz %471 + %473 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %474 = OpLoad %v3half %473 + %475 = OpVectorShuffle %v4half %474 %474 2 2 0 0 + OpStore %zzxx %475 + %477 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %478 = OpLoad %v3half %477 + %479 = OpVectorShuffle %v4half %478 %478 2 2 0 1 + OpStore %zzxy %479 + %481 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %482 = OpLoad %v3half %481 + %483 = OpVectorShuffle %v4half %482 %482 2 2 0 2 + OpStore %zzxz %483 + %485 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %486 = OpLoad %v3half %485 + %487 = OpVectorShuffle %v4half %486 %486 2 2 1 0 + OpStore %zzyx %487 + %489 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %490 = OpLoad %v3half %489 + %491 = OpVectorShuffle %v4half %490 %490 2 2 1 1 + OpStore %zzyy %491 + %493 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %494 = OpLoad %v3half %493 + %495 = OpVectorShuffle %v4half %494 %494 2 2 1 2 + OpStore %zzyz %495 + %497 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %498 = OpLoad %v3half %497 + %499 = OpVectorShuffle %v4half %498 %498 2 2 2 0 + OpStore %zzzx %499 + %501 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %502 = OpLoad %v3half %501 + %503 = OpVectorShuffle %v4half %502 %502 2 2 2 1 + OpStore %zzzy %503 + %505 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + %506 = OpLoad %v3half %505 + %507 = OpVectorShuffle %v4half %506 %506 2 2 2 2 + OpStore %zzzz %507 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..812dd2e5cb --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,131 @@ +enable f16; + +struct S { + v : vec3, +} + +var P : S; + +fn f() { + var v = P.v; + var x = P.v.x; + var y = P.v.y; + var z = P.v.z; + var xx = P.v.xx; + var xy = P.v.xy; + var xz = P.v.xz; + var yx = P.v.yx; + var yy = P.v.yy; + var yz = P.v.yz; + var zx = P.v.zx; + var zy = P.v.zy; + var zz = P.v.zz; + var xxx = P.v.xxx; + var xxy = P.v.xxy; + var xxz = P.v.xxz; + var xyx = P.v.xyx; + var xyy = P.v.xyy; + var xyz = P.v.xyz; + var xzx = P.v.xzx; + var xzy = P.v.xzy; + var xzz = P.v.xzz; + var yxx = P.v.yxx; + var yxy = P.v.yxy; + var yxz = P.v.yxz; + var yyx = P.v.yyx; + var yyy = P.v.yyy; + var yyz = P.v.yyz; + var yzx = P.v.yzx; + var yzy = P.v.yzy; + var yzz = P.v.yzz; + var zxx = P.v.zxx; + var zxy = P.v.zxy; + var zxz = P.v.zxz; + var zyx = P.v.zyx; + var zyy = P.v.zyy; + var zyz = P.v.zyz; + var zzx = P.v.zzx; + var zzy = P.v.zzy; + var zzz = P.v.zzz; + var xxxx = P.v.xxxx; + var xxxy = P.v.xxxy; + var xxxz = P.v.xxxz; + var xxyx = P.v.xxyx; + var xxyy = P.v.xxyy; + var xxyz = P.v.xxyz; + var xxzx = P.v.xxzx; + var xxzy = P.v.xxzy; + var xxzz = P.v.xxzz; + var xyxx = P.v.xyxx; + var xyxy = P.v.xyxy; + var xyxz = P.v.xyxz; + var xyyx = P.v.xyyx; + var xyyy = P.v.xyyy; + var xyyz = P.v.xyyz; + var xyzx = P.v.xyzx; + var xyzy = P.v.xyzy; + var xyzz = P.v.xyzz; + var xzxx = P.v.xzxx; + var xzxy = P.v.xzxy; + var xzxz = P.v.xzxz; + var xzyx = P.v.xzyx; + var xzyy = P.v.xzyy; + var xzyz = P.v.xzyz; + var xzzx = P.v.xzzx; + var xzzy = P.v.xzzy; + var xzzz = P.v.xzzz; + var yxxx = P.v.yxxx; + var yxxy = P.v.yxxy; + var yxxz = P.v.yxxz; + var yxyx = P.v.yxyx; + var yxyy = P.v.yxyy; + var yxyz = P.v.yxyz; + var yxzx = P.v.yxzx; + var yxzy = P.v.yxzy; + var yxzz = P.v.yxzz; + var yyxx = P.v.yyxx; + var yyxy = P.v.yyxy; + var yyxz = P.v.yyxz; + var yyyx = P.v.yyyx; + var yyyy = P.v.yyyy; + var yyyz = P.v.yyyz; + var yyzx = P.v.yyzx; + var yyzy = P.v.yyzy; + var yyzz = P.v.yyzz; + var yzxx = P.v.yzxx; + var yzxy = P.v.yzxy; + var yzxz = P.v.yzxz; + var yzyx = P.v.yzyx; + var yzyy = P.v.yzyy; + var yzyz = P.v.yzyz; + var yzzx = P.v.yzzx; + var yzzy = P.v.yzzy; + var yzzz = P.v.yzzz; + var zxxx = P.v.zxxx; + var zxxy = P.v.zxxy; + var zxxz = P.v.zxxz; + var zxyx = P.v.zxyx; + var zxyy = P.v.zxyy; + var zxyz = P.v.zxyz; + var zxzx = P.v.zxzx; + var zxzy = P.v.zxzy; + var zxzz = P.v.zxzz; + var zyxx = P.v.zyxx; + var zyxy = P.v.zyxy; + var zyxz = P.v.zyxz; + var zyyx = P.v.zyyx; + var zyyy = P.v.zyyy; + var zyyz = P.v.zyyz; + var zyzx = P.v.zyzx; + var zyzy = P.v.zyzy; + var zyzz = P.v.zyzz; + var zzxx = P.v.zzxx; + var zzxy = P.v.zzxy; + var zzxz = P.v.zzxz; + var zzyx = P.v.zzyx; + var zzyy = P.v.zzyy; + var zzyz = P.v.zzyz; + var zzzx = P.v.zzzx; + var zzzy = P.v.zzzy; + var zzzz = P.v.zzzz; +} diff --git a/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f65e9211d --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,134 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + float3 v; +}; + +static S P = (S)0; + +void f() { + float3 v = P.v; + float x = P.v.x; + float y = P.v.y; + float z = P.v.z; + float2 xx = P.v.xx; + float2 xy = P.v.xy; + float2 xz = P.v.xz; + float2 yx = P.v.yx; + float2 yy = P.v.yy; + float2 yz = P.v.yz; + float2 zx = P.v.zx; + float2 zy = P.v.zy; + float2 zz = P.v.zz; + float3 xxx = P.v.xxx; + float3 xxy = P.v.xxy; + float3 xxz = P.v.xxz; + float3 xyx = P.v.xyx; + float3 xyy = P.v.xyy; + float3 xyz = P.v.xyz; + float3 xzx = P.v.xzx; + float3 xzy = P.v.xzy; + float3 xzz = P.v.xzz; + float3 yxx = P.v.yxx; + float3 yxy = P.v.yxy; + float3 yxz = P.v.yxz; + float3 yyx = P.v.yyx; + float3 yyy = P.v.yyy; + float3 yyz = P.v.yyz; + float3 yzx = P.v.yzx; + float3 yzy = P.v.yzy; + float3 yzz = P.v.yzz; + float3 zxx = P.v.zxx; + float3 zxy = P.v.zxy; + float3 zxz = P.v.zxz; + float3 zyx = P.v.zyx; + float3 zyy = P.v.zyy; + float3 zyz = P.v.zyz; + float3 zzx = P.v.zzx; + float3 zzy = P.v.zzy; + float3 zzz = P.v.zzz; + float4 xxxx = P.v.xxxx; + float4 xxxy = P.v.xxxy; + float4 xxxz = P.v.xxxz; + float4 xxyx = P.v.xxyx; + float4 xxyy = P.v.xxyy; + float4 xxyz = P.v.xxyz; + float4 xxzx = P.v.xxzx; + float4 xxzy = P.v.xxzy; + float4 xxzz = P.v.xxzz; + float4 xyxx = P.v.xyxx; + float4 xyxy = P.v.xyxy; + float4 xyxz = P.v.xyxz; + float4 xyyx = P.v.xyyx; + float4 xyyy = P.v.xyyy; + float4 xyyz = P.v.xyyz; + float4 xyzx = P.v.xyzx; + float4 xyzy = P.v.xyzy; + float4 xyzz = P.v.xyzz; + float4 xzxx = P.v.xzxx; + float4 xzxy = P.v.xzxy; + float4 xzxz = P.v.xzxz; + float4 xzyx = P.v.xzyx; + float4 xzyy = P.v.xzyy; + float4 xzyz = P.v.xzyz; + float4 xzzx = P.v.xzzx; + float4 xzzy = P.v.xzzy; + float4 xzzz = P.v.xzzz; + float4 yxxx = P.v.yxxx; + float4 yxxy = P.v.yxxy; + float4 yxxz = P.v.yxxz; + float4 yxyx = P.v.yxyx; + float4 yxyy = P.v.yxyy; + float4 yxyz = P.v.yxyz; + float4 yxzx = P.v.yxzx; + float4 yxzy = P.v.yxzy; + float4 yxzz = P.v.yxzz; + float4 yyxx = P.v.yyxx; + float4 yyxy = P.v.yyxy; + float4 yyxz = P.v.yyxz; + float4 yyyx = P.v.yyyx; + float4 yyyy = P.v.yyyy; + float4 yyyz = P.v.yyyz; + float4 yyzx = P.v.yyzx; + float4 yyzy = P.v.yyzy; + float4 yyzz = P.v.yyzz; + float4 yzxx = P.v.yzxx; + float4 yzxy = P.v.yzxy; + float4 yzxz = P.v.yzxz; + float4 yzyx = P.v.yzyx; + float4 yzyy = P.v.yzyy; + float4 yzyz = P.v.yzyz; + float4 yzzx = P.v.yzzx; + float4 yzzy = P.v.yzzy; + float4 yzzz = P.v.yzzz; + float4 zxxx = P.v.zxxx; + float4 zxxy = P.v.zxxy; + float4 zxxz = P.v.zxxz; + float4 zxyx = P.v.zxyx; + float4 zxyy = P.v.zxyy; + float4 zxyz = P.v.zxyz; + float4 zxzx = P.v.zxzx; + float4 zxzy = P.v.zxzy; + float4 zxzz = P.v.zxzz; + float4 zyxx = P.v.zyxx; + float4 zyxy = P.v.zyxy; + float4 zyxz = P.v.zyxz; + float4 zyyx = P.v.zyyx; + float4 zyyy = P.v.zyyy; + float4 zyyz = P.v.zyyz; + float4 zyzx = P.v.zyzx; + float4 zyzy = P.v.zyzy; + float4 zyzz = P.v.zyzz; + float4 zzxx = P.v.zzxx; + float4 zzxy = P.v.zzxy; + float4 zzxz = P.v.zzxz; + float4 zzyx = P.v.zzyx; + float4 zzyy = P.v.zzyy; + float4 zzyz = P.v.zzyz; + float4 zzzx = P.v.zzzx; + float4 zzzy = P.v.zzzy; + float4 zzzz = P.v.zzzz; +} diff --git a/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.msl b/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.msl index 85b1790824..a682cd481e 100644 --- a/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/read/vec3/f32.wgsl.expected.msl @@ -5,127 +5,128 @@ struct S { float3 v; }; -void f(thread S* const tint_symbol) { - float3 v = (*(tint_symbol)).v; - float x = (*(tint_symbol)).v[0]; - float y = (*(tint_symbol)).v[1]; - float z = (*(tint_symbol)).v[2]; - float2 xx = float3((*(tint_symbol)).v).xx; - float2 xy = float3((*(tint_symbol)).v).xy; - float2 xz = float3((*(tint_symbol)).v).xz; - float2 yx = float3((*(tint_symbol)).v).yx; - float2 yy = float3((*(tint_symbol)).v).yy; - float2 yz = float3((*(tint_symbol)).v).yz; - float2 zx = float3((*(tint_symbol)).v).zx; - float2 zy = float3((*(tint_symbol)).v).zy; - float2 zz = float3((*(tint_symbol)).v).zz; - float3 xxx = float3((*(tint_symbol)).v).xxx; - float3 xxy = float3((*(tint_symbol)).v).xxy; - float3 xxz = float3((*(tint_symbol)).v).xxz; - float3 xyx = float3((*(tint_symbol)).v).xyx; - float3 xyy = float3((*(tint_symbol)).v).xyy; - float3 xyz = float3((*(tint_symbol)).v).xyz; - float3 xzx = float3((*(tint_symbol)).v).xzx; - float3 xzy = float3((*(tint_symbol)).v).xzy; - float3 xzz = float3((*(tint_symbol)).v).xzz; - float3 yxx = float3((*(tint_symbol)).v).yxx; - float3 yxy = float3((*(tint_symbol)).v).yxy; - float3 yxz = float3((*(tint_symbol)).v).yxz; - float3 yyx = float3((*(tint_symbol)).v).yyx; - float3 yyy = float3((*(tint_symbol)).v).yyy; - float3 yyz = float3((*(tint_symbol)).v).yyz; - float3 yzx = float3((*(tint_symbol)).v).yzx; - float3 yzy = float3((*(tint_symbol)).v).yzy; - float3 yzz = float3((*(tint_symbol)).v).yzz; - float3 zxx = float3((*(tint_symbol)).v).zxx; - float3 zxy = float3((*(tint_symbol)).v).zxy; - float3 zxz = float3((*(tint_symbol)).v).zxz; - float3 zyx = float3((*(tint_symbol)).v).zyx; - float3 zyy = float3((*(tint_symbol)).v).zyy; - float3 zyz = float3((*(tint_symbol)).v).zyz; - float3 zzx = float3((*(tint_symbol)).v).zzx; - float3 zzy = float3((*(tint_symbol)).v).zzy; - float3 zzz = float3((*(tint_symbol)).v).zzz; - float4 xxxx = float3((*(tint_symbol)).v).xxxx; - float4 xxxy = float3((*(tint_symbol)).v).xxxy; - float4 xxxz = float3((*(tint_symbol)).v).xxxz; - float4 xxyx = float3((*(tint_symbol)).v).xxyx; - float4 xxyy = float3((*(tint_symbol)).v).xxyy; - float4 xxyz = float3((*(tint_symbol)).v).xxyz; - float4 xxzx = float3((*(tint_symbol)).v).xxzx; - float4 xxzy = float3((*(tint_symbol)).v).xxzy; - float4 xxzz = float3((*(tint_symbol)).v).xxzz; - float4 xyxx = float3((*(tint_symbol)).v).xyxx; - float4 xyxy = float3((*(tint_symbol)).v).xyxy; - float4 xyxz = float3((*(tint_symbol)).v).xyxz; - float4 xyyx = float3((*(tint_symbol)).v).xyyx; - float4 xyyy = float3((*(tint_symbol)).v).xyyy; - float4 xyyz = float3((*(tint_symbol)).v).xyyz; - float4 xyzx = float3((*(tint_symbol)).v).xyzx; - float4 xyzy = float3((*(tint_symbol)).v).xyzy; - float4 xyzz = float3((*(tint_symbol)).v).xyzz; - float4 xzxx = float3((*(tint_symbol)).v).xzxx; - float4 xzxy = float3((*(tint_symbol)).v).xzxy; - float4 xzxz = float3((*(tint_symbol)).v).xzxz; - float4 xzyx = float3((*(tint_symbol)).v).xzyx; - float4 xzyy = float3((*(tint_symbol)).v).xzyy; - float4 xzyz = float3((*(tint_symbol)).v).xzyz; - float4 xzzx = float3((*(tint_symbol)).v).xzzx; - float4 xzzy = float3((*(tint_symbol)).v).xzzy; - float4 xzzz = float3((*(tint_symbol)).v).xzzz; - float4 yxxx = float3((*(tint_symbol)).v).yxxx; - float4 yxxy = float3((*(tint_symbol)).v).yxxy; - float4 yxxz = float3((*(tint_symbol)).v).yxxz; - float4 yxyx = float3((*(tint_symbol)).v).yxyx; - float4 yxyy = float3((*(tint_symbol)).v).yxyy; - float4 yxyz = float3((*(tint_symbol)).v).yxyz; - float4 yxzx = float3((*(tint_symbol)).v).yxzx; - float4 yxzy = float3((*(tint_symbol)).v).yxzy; - float4 yxzz = float3((*(tint_symbol)).v).yxzz; - float4 yyxx = float3((*(tint_symbol)).v).yyxx; - float4 yyxy = float3((*(tint_symbol)).v).yyxy; - float4 yyxz = float3((*(tint_symbol)).v).yyxz; - float4 yyyx = float3((*(tint_symbol)).v).yyyx; - float4 yyyy = float3((*(tint_symbol)).v).yyyy; - float4 yyyz = float3((*(tint_symbol)).v).yyyz; - float4 yyzx = float3((*(tint_symbol)).v).yyzx; - float4 yyzy = float3((*(tint_symbol)).v).yyzy; - float4 yyzz = float3((*(tint_symbol)).v).yyzz; - float4 yzxx = float3((*(tint_symbol)).v).yzxx; - float4 yzxy = float3((*(tint_symbol)).v).yzxy; - float4 yzxz = float3((*(tint_symbol)).v).yzxz; - float4 yzyx = float3((*(tint_symbol)).v).yzyx; - float4 yzyy = float3((*(tint_symbol)).v).yzyy; - float4 yzyz = float3((*(tint_symbol)).v).yzyz; - float4 yzzx = float3((*(tint_symbol)).v).yzzx; - float4 yzzy = float3((*(tint_symbol)).v).yzzy; - float4 yzzz = float3((*(tint_symbol)).v).yzzz; - float4 zxxx = float3((*(tint_symbol)).v).zxxx; - float4 zxxy = float3((*(tint_symbol)).v).zxxy; - float4 zxxz = float3((*(tint_symbol)).v).zxxz; - float4 zxyx = float3((*(tint_symbol)).v).zxyx; - float4 zxyy = float3((*(tint_symbol)).v).zxyy; - float4 zxyz = float3((*(tint_symbol)).v).zxyz; - float4 zxzx = float3((*(tint_symbol)).v).zxzx; - float4 zxzy = float3((*(tint_symbol)).v).zxzy; - float4 zxzz = float3((*(tint_symbol)).v).zxzz; - float4 zyxx = float3((*(tint_symbol)).v).zyxx; - float4 zyxy = float3((*(tint_symbol)).v).zyxy; - float4 zyxz = float3((*(tint_symbol)).v).zyxz; - float4 zyyx = float3((*(tint_symbol)).v).zyyx; - float4 zyyy = float3((*(tint_symbol)).v).zyyy; - float4 zyyz = float3((*(tint_symbol)).v).zyyz; - float4 zyzx = float3((*(tint_symbol)).v).zyzx; - float4 zyzy = float3((*(tint_symbol)).v).zyzy; - float4 zyzz = float3((*(tint_symbol)).v).zyzz; - float4 zzxx = float3((*(tint_symbol)).v).zzxx; - float4 zzxy = float3((*(tint_symbol)).v).zzxy; - float4 zzxz = float3((*(tint_symbol)).v).zzxz; - float4 zzyx = float3((*(tint_symbol)).v).zzyx; - float4 zzyy = float3((*(tint_symbol)).v).zzyy; - float4 zzyz = float3((*(tint_symbol)).v).zzyz; - float4 zzzx = float3((*(tint_symbol)).v).zzzx; - float4 zzzy = float3((*(tint_symbol)).v).zzzy; - float4 zzzz = float3((*(tint_symbol)).v).zzzz; +void f() { + thread S tint_symbol = {}; + float3 v = tint_symbol.v; + float x = tint_symbol.v[0]; + float y = tint_symbol.v[1]; + float z = tint_symbol.v[2]; + float2 xx = float3(tint_symbol.v).xx; + float2 xy = float3(tint_symbol.v).xy; + float2 xz = float3(tint_symbol.v).xz; + float2 yx = float3(tint_symbol.v).yx; + float2 yy = float3(tint_symbol.v).yy; + float2 yz = float3(tint_symbol.v).yz; + float2 zx = float3(tint_symbol.v).zx; + float2 zy = float3(tint_symbol.v).zy; + float2 zz = float3(tint_symbol.v).zz; + float3 xxx = float3(tint_symbol.v).xxx; + float3 xxy = float3(tint_symbol.v).xxy; + float3 xxz = float3(tint_symbol.v).xxz; + float3 xyx = float3(tint_symbol.v).xyx; + float3 xyy = float3(tint_symbol.v).xyy; + float3 xyz = float3(tint_symbol.v).xyz; + float3 xzx = float3(tint_symbol.v).xzx; + float3 xzy = float3(tint_symbol.v).xzy; + float3 xzz = float3(tint_symbol.v).xzz; + float3 yxx = float3(tint_symbol.v).yxx; + float3 yxy = float3(tint_symbol.v).yxy; + float3 yxz = float3(tint_symbol.v).yxz; + float3 yyx = float3(tint_symbol.v).yyx; + float3 yyy = float3(tint_symbol.v).yyy; + float3 yyz = float3(tint_symbol.v).yyz; + float3 yzx = float3(tint_symbol.v).yzx; + float3 yzy = float3(tint_symbol.v).yzy; + float3 yzz = float3(tint_symbol.v).yzz; + float3 zxx = float3(tint_symbol.v).zxx; + float3 zxy = float3(tint_symbol.v).zxy; + float3 zxz = float3(tint_symbol.v).zxz; + float3 zyx = float3(tint_symbol.v).zyx; + float3 zyy = float3(tint_symbol.v).zyy; + float3 zyz = float3(tint_symbol.v).zyz; + float3 zzx = float3(tint_symbol.v).zzx; + float3 zzy = float3(tint_symbol.v).zzy; + float3 zzz = float3(tint_symbol.v).zzz; + float4 xxxx = float3(tint_symbol.v).xxxx; + float4 xxxy = float3(tint_symbol.v).xxxy; + float4 xxxz = float3(tint_symbol.v).xxxz; + float4 xxyx = float3(tint_symbol.v).xxyx; + float4 xxyy = float3(tint_symbol.v).xxyy; + float4 xxyz = float3(tint_symbol.v).xxyz; + float4 xxzx = float3(tint_symbol.v).xxzx; + float4 xxzy = float3(tint_symbol.v).xxzy; + float4 xxzz = float3(tint_symbol.v).xxzz; + float4 xyxx = float3(tint_symbol.v).xyxx; + float4 xyxy = float3(tint_symbol.v).xyxy; + float4 xyxz = float3(tint_symbol.v).xyxz; + float4 xyyx = float3(tint_symbol.v).xyyx; + float4 xyyy = float3(tint_symbol.v).xyyy; + float4 xyyz = float3(tint_symbol.v).xyyz; + float4 xyzx = float3(tint_symbol.v).xyzx; + float4 xyzy = float3(tint_symbol.v).xyzy; + float4 xyzz = float3(tint_symbol.v).xyzz; + float4 xzxx = float3(tint_symbol.v).xzxx; + float4 xzxy = float3(tint_symbol.v).xzxy; + float4 xzxz = float3(tint_symbol.v).xzxz; + float4 xzyx = float3(tint_symbol.v).xzyx; + float4 xzyy = float3(tint_symbol.v).xzyy; + float4 xzyz = float3(tint_symbol.v).xzyz; + float4 xzzx = float3(tint_symbol.v).xzzx; + float4 xzzy = float3(tint_symbol.v).xzzy; + float4 xzzz = float3(tint_symbol.v).xzzz; + float4 yxxx = float3(tint_symbol.v).yxxx; + float4 yxxy = float3(tint_symbol.v).yxxy; + float4 yxxz = float3(tint_symbol.v).yxxz; + float4 yxyx = float3(tint_symbol.v).yxyx; + float4 yxyy = float3(tint_symbol.v).yxyy; + float4 yxyz = float3(tint_symbol.v).yxyz; + float4 yxzx = float3(tint_symbol.v).yxzx; + float4 yxzy = float3(tint_symbol.v).yxzy; + float4 yxzz = float3(tint_symbol.v).yxzz; + float4 yyxx = float3(tint_symbol.v).yyxx; + float4 yyxy = float3(tint_symbol.v).yyxy; + float4 yyxz = float3(tint_symbol.v).yyxz; + float4 yyyx = float3(tint_symbol.v).yyyx; + float4 yyyy = float3(tint_symbol.v).yyyy; + float4 yyyz = float3(tint_symbol.v).yyyz; + float4 yyzx = float3(tint_symbol.v).yyzx; + float4 yyzy = float3(tint_symbol.v).yyzy; + float4 yyzz = float3(tint_symbol.v).yyzz; + float4 yzxx = float3(tint_symbol.v).yzxx; + float4 yzxy = float3(tint_symbol.v).yzxy; + float4 yzxz = float3(tint_symbol.v).yzxz; + float4 yzyx = float3(tint_symbol.v).yzyx; + float4 yzyy = float3(tint_symbol.v).yzyy; + float4 yzyz = float3(tint_symbol.v).yzyz; + float4 yzzx = float3(tint_symbol.v).yzzx; + float4 yzzy = float3(tint_symbol.v).yzzy; + float4 yzzz = float3(tint_symbol.v).yzzz; + float4 zxxx = float3(tint_symbol.v).zxxx; + float4 zxxy = float3(tint_symbol.v).zxxy; + float4 zxxz = float3(tint_symbol.v).zxxz; + float4 zxyx = float3(tint_symbol.v).zxyx; + float4 zxyy = float3(tint_symbol.v).zxyy; + float4 zxyz = float3(tint_symbol.v).zxyz; + float4 zxzx = float3(tint_symbol.v).zxzx; + float4 zxzy = float3(tint_symbol.v).zxzy; + float4 zxzz = float3(tint_symbol.v).zxzz; + float4 zyxx = float3(tint_symbol.v).zyxx; + float4 zyxy = float3(tint_symbol.v).zyxy; + float4 zyxz = float3(tint_symbol.v).zyxz; + float4 zyyx = float3(tint_symbol.v).zyyx; + float4 zyyy = float3(tint_symbol.v).zyyy; + float4 zyyz = float3(tint_symbol.v).zyyz; + float4 zyzx = float3(tint_symbol.v).zyzx; + float4 zyzy = float3(tint_symbol.v).zyzy; + float4 zyzz = float3(tint_symbol.v).zyzz; + float4 zzxx = float3(tint_symbol.v).zzxx; + float4 zzxy = float3(tint_symbol.v).zzxy; + float4 zzxz = float3(tint_symbol.v).zzxz; + float4 zzyx = float3(tint_symbol.v).zzyx; + float4 zzyy = float3(tint_symbol.v).zzyy; + float4 zzyz = float3(tint_symbol.v).zzyz; + float4 zzzx = float3(tint_symbol.v).zzzx; + float4 zzzy = float3(tint_symbol.v).zzzy; + float4 zzzz = float3(tint_symbol.v).zzzz; } diff --git a/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b6314fba50 --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,134 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int3 v; +}; + +static S P = (S)0; + +void f() { + int3 v = P.v; + int x = P.v.x; + int y = P.v.y; + int z = P.v.z; + int2 xx = P.v.xx; + int2 xy = P.v.xy; + int2 xz = P.v.xz; + int2 yx = P.v.yx; + int2 yy = P.v.yy; + int2 yz = P.v.yz; + int2 zx = P.v.zx; + int2 zy = P.v.zy; + int2 zz = P.v.zz; + int3 xxx = P.v.xxx; + int3 xxy = P.v.xxy; + int3 xxz = P.v.xxz; + int3 xyx = P.v.xyx; + int3 xyy = P.v.xyy; + int3 xyz = P.v.xyz; + int3 xzx = P.v.xzx; + int3 xzy = P.v.xzy; + int3 xzz = P.v.xzz; + int3 yxx = P.v.yxx; + int3 yxy = P.v.yxy; + int3 yxz = P.v.yxz; + int3 yyx = P.v.yyx; + int3 yyy = P.v.yyy; + int3 yyz = P.v.yyz; + int3 yzx = P.v.yzx; + int3 yzy = P.v.yzy; + int3 yzz = P.v.yzz; + int3 zxx = P.v.zxx; + int3 zxy = P.v.zxy; + int3 zxz = P.v.zxz; + int3 zyx = P.v.zyx; + int3 zyy = P.v.zyy; + int3 zyz = P.v.zyz; + int3 zzx = P.v.zzx; + int3 zzy = P.v.zzy; + int3 zzz = P.v.zzz; + int4 xxxx = P.v.xxxx; + int4 xxxy = P.v.xxxy; + int4 xxxz = P.v.xxxz; + int4 xxyx = P.v.xxyx; + int4 xxyy = P.v.xxyy; + int4 xxyz = P.v.xxyz; + int4 xxzx = P.v.xxzx; + int4 xxzy = P.v.xxzy; + int4 xxzz = P.v.xxzz; + int4 xyxx = P.v.xyxx; + int4 xyxy = P.v.xyxy; + int4 xyxz = P.v.xyxz; + int4 xyyx = P.v.xyyx; + int4 xyyy = P.v.xyyy; + int4 xyyz = P.v.xyyz; + int4 xyzx = P.v.xyzx; + int4 xyzy = P.v.xyzy; + int4 xyzz = P.v.xyzz; + int4 xzxx = P.v.xzxx; + int4 xzxy = P.v.xzxy; + int4 xzxz = P.v.xzxz; + int4 xzyx = P.v.xzyx; + int4 xzyy = P.v.xzyy; + int4 xzyz = P.v.xzyz; + int4 xzzx = P.v.xzzx; + int4 xzzy = P.v.xzzy; + int4 xzzz = P.v.xzzz; + int4 yxxx = P.v.yxxx; + int4 yxxy = P.v.yxxy; + int4 yxxz = P.v.yxxz; + int4 yxyx = P.v.yxyx; + int4 yxyy = P.v.yxyy; + int4 yxyz = P.v.yxyz; + int4 yxzx = P.v.yxzx; + int4 yxzy = P.v.yxzy; + int4 yxzz = P.v.yxzz; + int4 yyxx = P.v.yyxx; + int4 yyxy = P.v.yyxy; + int4 yyxz = P.v.yyxz; + int4 yyyx = P.v.yyyx; + int4 yyyy = P.v.yyyy; + int4 yyyz = P.v.yyyz; + int4 yyzx = P.v.yyzx; + int4 yyzy = P.v.yyzy; + int4 yyzz = P.v.yyzz; + int4 yzxx = P.v.yzxx; + int4 yzxy = P.v.yzxy; + int4 yzxz = P.v.yzxz; + int4 yzyx = P.v.yzyx; + int4 yzyy = P.v.yzyy; + int4 yzyz = P.v.yzyz; + int4 yzzx = P.v.yzzx; + int4 yzzy = P.v.yzzy; + int4 yzzz = P.v.yzzz; + int4 zxxx = P.v.zxxx; + int4 zxxy = P.v.zxxy; + int4 zxxz = P.v.zxxz; + int4 zxyx = P.v.zxyx; + int4 zxyy = P.v.zxyy; + int4 zxyz = P.v.zxyz; + int4 zxzx = P.v.zxzx; + int4 zxzy = P.v.zxzy; + int4 zxzz = P.v.zxzz; + int4 zyxx = P.v.zyxx; + int4 zyxy = P.v.zyxy; + int4 zyxz = P.v.zyxz; + int4 zyyx = P.v.zyyx; + int4 zyyy = P.v.zyyy; + int4 zyyz = P.v.zyyz; + int4 zyzx = P.v.zyzx; + int4 zyzy = P.v.zyzy; + int4 zyzz = P.v.zyzz; + int4 zzxx = P.v.zzxx; + int4 zzxy = P.v.zzxy; + int4 zzxz = P.v.zzxz; + int4 zzyx = P.v.zzyx; + int4 zzyy = P.v.zzyy; + int4 zzyz = P.v.zzyz; + int4 zzzx = P.v.zzzx; + int4 zzzy = P.v.zzzy; + int4 zzzz = P.v.zzzz; +} diff --git a/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.msl b/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.msl index ddcd693ad4..63e124b61e 100644 --- a/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/read/vec3/i32.wgsl.expected.msl @@ -5,127 +5,128 @@ struct S { int3 v; }; -void f(thread S* const tint_symbol) { - int3 v = (*(tint_symbol)).v; - int x = (*(tint_symbol)).v[0]; - int y = (*(tint_symbol)).v[1]; - int z = (*(tint_symbol)).v[2]; - int2 xx = int3((*(tint_symbol)).v).xx; - int2 xy = int3((*(tint_symbol)).v).xy; - int2 xz = int3((*(tint_symbol)).v).xz; - int2 yx = int3((*(tint_symbol)).v).yx; - int2 yy = int3((*(tint_symbol)).v).yy; - int2 yz = int3((*(tint_symbol)).v).yz; - int2 zx = int3((*(tint_symbol)).v).zx; - int2 zy = int3((*(tint_symbol)).v).zy; - int2 zz = int3((*(tint_symbol)).v).zz; - int3 xxx = int3((*(tint_symbol)).v).xxx; - int3 xxy = int3((*(tint_symbol)).v).xxy; - int3 xxz = int3((*(tint_symbol)).v).xxz; - int3 xyx = int3((*(tint_symbol)).v).xyx; - int3 xyy = int3((*(tint_symbol)).v).xyy; - int3 xyz = int3((*(tint_symbol)).v).xyz; - int3 xzx = int3((*(tint_symbol)).v).xzx; - int3 xzy = int3((*(tint_symbol)).v).xzy; - int3 xzz = int3((*(tint_symbol)).v).xzz; - int3 yxx = int3((*(tint_symbol)).v).yxx; - int3 yxy = int3((*(tint_symbol)).v).yxy; - int3 yxz = int3((*(tint_symbol)).v).yxz; - int3 yyx = int3((*(tint_symbol)).v).yyx; - int3 yyy = int3((*(tint_symbol)).v).yyy; - int3 yyz = int3((*(tint_symbol)).v).yyz; - int3 yzx = int3((*(tint_symbol)).v).yzx; - int3 yzy = int3((*(tint_symbol)).v).yzy; - int3 yzz = int3((*(tint_symbol)).v).yzz; - int3 zxx = int3((*(tint_symbol)).v).zxx; - int3 zxy = int3((*(tint_symbol)).v).zxy; - int3 zxz = int3((*(tint_symbol)).v).zxz; - int3 zyx = int3((*(tint_symbol)).v).zyx; - int3 zyy = int3((*(tint_symbol)).v).zyy; - int3 zyz = int3((*(tint_symbol)).v).zyz; - int3 zzx = int3((*(tint_symbol)).v).zzx; - int3 zzy = int3((*(tint_symbol)).v).zzy; - int3 zzz = int3((*(tint_symbol)).v).zzz; - int4 xxxx = int3((*(tint_symbol)).v).xxxx; - int4 xxxy = int3((*(tint_symbol)).v).xxxy; - int4 xxxz = int3((*(tint_symbol)).v).xxxz; - int4 xxyx = int3((*(tint_symbol)).v).xxyx; - int4 xxyy = int3((*(tint_symbol)).v).xxyy; - int4 xxyz = int3((*(tint_symbol)).v).xxyz; - int4 xxzx = int3((*(tint_symbol)).v).xxzx; - int4 xxzy = int3((*(tint_symbol)).v).xxzy; - int4 xxzz = int3((*(tint_symbol)).v).xxzz; - int4 xyxx = int3((*(tint_symbol)).v).xyxx; - int4 xyxy = int3((*(tint_symbol)).v).xyxy; - int4 xyxz = int3((*(tint_symbol)).v).xyxz; - int4 xyyx = int3((*(tint_symbol)).v).xyyx; - int4 xyyy = int3((*(tint_symbol)).v).xyyy; - int4 xyyz = int3((*(tint_symbol)).v).xyyz; - int4 xyzx = int3((*(tint_symbol)).v).xyzx; - int4 xyzy = int3((*(tint_symbol)).v).xyzy; - int4 xyzz = int3((*(tint_symbol)).v).xyzz; - int4 xzxx = int3((*(tint_symbol)).v).xzxx; - int4 xzxy = int3((*(tint_symbol)).v).xzxy; - int4 xzxz = int3((*(tint_symbol)).v).xzxz; - int4 xzyx = int3((*(tint_symbol)).v).xzyx; - int4 xzyy = int3((*(tint_symbol)).v).xzyy; - int4 xzyz = int3((*(tint_symbol)).v).xzyz; - int4 xzzx = int3((*(tint_symbol)).v).xzzx; - int4 xzzy = int3((*(tint_symbol)).v).xzzy; - int4 xzzz = int3((*(tint_symbol)).v).xzzz; - int4 yxxx = int3((*(tint_symbol)).v).yxxx; - int4 yxxy = int3((*(tint_symbol)).v).yxxy; - int4 yxxz = int3((*(tint_symbol)).v).yxxz; - int4 yxyx = int3((*(tint_symbol)).v).yxyx; - int4 yxyy = int3((*(tint_symbol)).v).yxyy; - int4 yxyz = int3((*(tint_symbol)).v).yxyz; - int4 yxzx = int3((*(tint_symbol)).v).yxzx; - int4 yxzy = int3((*(tint_symbol)).v).yxzy; - int4 yxzz = int3((*(tint_symbol)).v).yxzz; - int4 yyxx = int3((*(tint_symbol)).v).yyxx; - int4 yyxy = int3((*(tint_symbol)).v).yyxy; - int4 yyxz = int3((*(tint_symbol)).v).yyxz; - int4 yyyx = int3((*(tint_symbol)).v).yyyx; - int4 yyyy = int3((*(tint_symbol)).v).yyyy; - int4 yyyz = int3((*(tint_symbol)).v).yyyz; - int4 yyzx = int3((*(tint_symbol)).v).yyzx; - int4 yyzy = int3((*(tint_symbol)).v).yyzy; - int4 yyzz = int3((*(tint_symbol)).v).yyzz; - int4 yzxx = int3((*(tint_symbol)).v).yzxx; - int4 yzxy = int3((*(tint_symbol)).v).yzxy; - int4 yzxz = int3((*(tint_symbol)).v).yzxz; - int4 yzyx = int3((*(tint_symbol)).v).yzyx; - int4 yzyy = int3((*(tint_symbol)).v).yzyy; - int4 yzyz = int3((*(tint_symbol)).v).yzyz; - int4 yzzx = int3((*(tint_symbol)).v).yzzx; - int4 yzzy = int3((*(tint_symbol)).v).yzzy; - int4 yzzz = int3((*(tint_symbol)).v).yzzz; - int4 zxxx = int3((*(tint_symbol)).v).zxxx; - int4 zxxy = int3((*(tint_symbol)).v).zxxy; - int4 zxxz = int3((*(tint_symbol)).v).zxxz; - int4 zxyx = int3((*(tint_symbol)).v).zxyx; - int4 zxyy = int3((*(tint_symbol)).v).zxyy; - int4 zxyz = int3((*(tint_symbol)).v).zxyz; - int4 zxzx = int3((*(tint_symbol)).v).zxzx; - int4 zxzy = int3((*(tint_symbol)).v).zxzy; - int4 zxzz = int3((*(tint_symbol)).v).zxzz; - int4 zyxx = int3((*(tint_symbol)).v).zyxx; - int4 zyxy = int3((*(tint_symbol)).v).zyxy; - int4 zyxz = int3((*(tint_symbol)).v).zyxz; - int4 zyyx = int3((*(tint_symbol)).v).zyyx; - int4 zyyy = int3((*(tint_symbol)).v).zyyy; - int4 zyyz = int3((*(tint_symbol)).v).zyyz; - int4 zyzx = int3((*(tint_symbol)).v).zyzx; - int4 zyzy = int3((*(tint_symbol)).v).zyzy; - int4 zyzz = int3((*(tint_symbol)).v).zyzz; - int4 zzxx = int3((*(tint_symbol)).v).zzxx; - int4 zzxy = int3((*(tint_symbol)).v).zzxy; - int4 zzxz = int3((*(tint_symbol)).v).zzxz; - int4 zzyx = int3((*(tint_symbol)).v).zzyx; - int4 zzyy = int3((*(tint_symbol)).v).zzyy; - int4 zzyz = int3((*(tint_symbol)).v).zzyz; - int4 zzzx = int3((*(tint_symbol)).v).zzzx; - int4 zzzy = int3((*(tint_symbol)).v).zzzy; - int4 zzzz = int3((*(tint_symbol)).v).zzzz; +void f() { + thread S tint_symbol = {}; + int3 v = tint_symbol.v; + int x = tint_symbol.v[0]; + int y = tint_symbol.v[1]; + int z = tint_symbol.v[2]; + int2 xx = int3(tint_symbol.v).xx; + int2 xy = int3(tint_symbol.v).xy; + int2 xz = int3(tint_symbol.v).xz; + int2 yx = int3(tint_symbol.v).yx; + int2 yy = int3(tint_symbol.v).yy; + int2 yz = int3(tint_symbol.v).yz; + int2 zx = int3(tint_symbol.v).zx; + int2 zy = int3(tint_symbol.v).zy; + int2 zz = int3(tint_symbol.v).zz; + int3 xxx = int3(tint_symbol.v).xxx; + int3 xxy = int3(tint_symbol.v).xxy; + int3 xxz = int3(tint_symbol.v).xxz; + int3 xyx = int3(tint_symbol.v).xyx; + int3 xyy = int3(tint_symbol.v).xyy; + int3 xyz = int3(tint_symbol.v).xyz; + int3 xzx = int3(tint_symbol.v).xzx; + int3 xzy = int3(tint_symbol.v).xzy; + int3 xzz = int3(tint_symbol.v).xzz; + int3 yxx = int3(tint_symbol.v).yxx; + int3 yxy = int3(tint_symbol.v).yxy; + int3 yxz = int3(tint_symbol.v).yxz; + int3 yyx = int3(tint_symbol.v).yyx; + int3 yyy = int3(tint_symbol.v).yyy; + int3 yyz = int3(tint_symbol.v).yyz; + int3 yzx = int3(tint_symbol.v).yzx; + int3 yzy = int3(tint_symbol.v).yzy; + int3 yzz = int3(tint_symbol.v).yzz; + int3 zxx = int3(tint_symbol.v).zxx; + int3 zxy = int3(tint_symbol.v).zxy; + int3 zxz = int3(tint_symbol.v).zxz; + int3 zyx = int3(tint_symbol.v).zyx; + int3 zyy = int3(tint_symbol.v).zyy; + int3 zyz = int3(tint_symbol.v).zyz; + int3 zzx = int3(tint_symbol.v).zzx; + int3 zzy = int3(tint_symbol.v).zzy; + int3 zzz = int3(tint_symbol.v).zzz; + int4 xxxx = int3(tint_symbol.v).xxxx; + int4 xxxy = int3(tint_symbol.v).xxxy; + int4 xxxz = int3(tint_symbol.v).xxxz; + int4 xxyx = int3(tint_symbol.v).xxyx; + int4 xxyy = int3(tint_symbol.v).xxyy; + int4 xxyz = int3(tint_symbol.v).xxyz; + int4 xxzx = int3(tint_symbol.v).xxzx; + int4 xxzy = int3(tint_symbol.v).xxzy; + int4 xxzz = int3(tint_symbol.v).xxzz; + int4 xyxx = int3(tint_symbol.v).xyxx; + int4 xyxy = int3(tint_symbol.v).xyxy; + int4 xyxz = int3(tint_symbol.v).xyxz; + int4 xyyx = int3(tint_symbol.v).xyyx; + int4 xyyy = int3(tint_symbol.v).xyyy; + int4 xyyz = int3(tint_symbol.v).xyyz; + int4 xyzx = int3(tint_symbol.v).xyzx; + int4 xyzy = int3(tint_symbol.v).xyzy; + int4 xyzz = int3(tint_symbol.v).xyzz; + int4 xzxx = int3(tint_symbol.v).xzxx; + int4 xzxy = int3(tint_symbol.v).xzxy; + int4 xzxz = int3(tint_symbol.v).xzxz; + int4 xzyx = int3(tint_symbol.v).xzyx; + int4 xzyy = int3(tint_symbol.v).xzyy; + int4 xzyz = int3(tint_symbol.v).xzyz; + int4 xzzx = int3(tint_symbol.v).xzzx; + int4 xzzy = int3(tint_symbol.v).xzzy; + int4 xzzz = int3(tint_symbol.v).xzzz; + int4 yxxx = int3(tint_symbol.v).yxxx; + int4 yxxy = int3(tint_symbol.v).yxxy; + int4 yxxz = int3(tint_symbol.v).yxxz; + int4 yxyx = int3(tint_symbol.v).yxyx; + int4 yxyy = int3(tint_symbol.v).yxyy; + int4 yxyz = int3(tint_symbol.v).yxyz; + int4 yxzx = int3(tint_symbol.v).yxzx; + int4 yxzy = int3(tint_symbol.v).yxzy; + int4 yxzz = int3(tint_symbol.v).yxzz; + int4 yyxx = int3(tint_symbol.v).yyxx; + int4 yyxy = int3(tint_symbol.v).yyxy; + int4 yyxz = int3(tint_symbol.v).yyxz; + int4 yyyx = int3(tint_symbol.v).yyyx; + int4 yyyy = int3(tint_symbol.v).yyyy; + int4 yyyz = int3(tint_symbol.v).yyyz; + int4 yyzx = int3(tint_symbol.v).yyzx; + int4 yyzy = int3(tint_symbol.v).yyzy; + int4 yyzz = int3(tint_symbol.v).yyzz; + int4 yzxx = int3(tint_symbol.v).yzxx; + int4 yzxy = int3(tint_symbol.v).yzxy; + int4 yzxz = int3(tint_symbol.v).yzxz; + int4 yzyx = int3(tint_symbol.v).yzyx; + int4 yzyy = int3(tint_symbol.v).yzyy; + int4 yzyz = int3(tint_symbol.v).yzyz; + int4 yzzx = int3(tint_symbol.v).yzzx; + int4 yzzy = int3(tint_symbol.v).yzzy; + int4 yzzz = int3(tint_symbol.v).yzzz; + int4 zxxx = int3(tint_symbol.v).zxxx; + int4 zxxy = int3(tint_symbol.v).zxxy; + int4 zxxz = int3(tint_symbol.v).zxxz; + int4 zxyx = int3(tint_symbol.v).zxyx; + int4 zxyy = int3(tint_symbol.v).zxyy; + int4 zxyz = int3(tint_symbol.v).zxyz; + int4 zxzx = int3(tint_symbol.v).zxzx; + int4 zxzy = int3(tint_symbol.v).zxzy; + int4 zxzz = int3(tint_symbol.v).zxzz; + int4 zyxx = int3(tint_symbol.v).zyxx; + int4 zyxy = int3(tint_symbol.v).zyxy; + int4 zyxz = int3(tint_symbol.v).zyxz; + int4 zyyx = int3(tint_symbol.v).zyyx; + int4 zyyy = int3(tint_symbol.v).zyyy; + int4 zyyz = int3(tint_symbol.v).zyyz; + int4 zyzx = int3(tint_symbol.v).zyzx; + int4 zyzy = int3(tint_symbol.v).zyzy; + int4 zyzz = int3(tint_symbol.v).zyzz; + int4 zzxx = int3(tint_symbol.v).zzxx; + int4 zzxy = int3(tint_symbol.v).zzxy; + int4 zzxz = int3(tint_symbol.v).zzxz; + int4 zzyx = int3(tint_symbol.v).zzyx; + int4 zzyy = int3(tint_symbol.v).zzyy; + int4 zzyz = int3(tint_symbol.v).zzyz; + int4 zzzx = int3(tint_symbol.v).zzzx; + int4 zzzy = int3(tint_symbol.v).zzzy; + int4 zzzz = int3(tint_symbol.v).zzzz; } diff --git a/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..79fb83777f --- /dev/null +++ b/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,134 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + uint3 v; +}; + +static S P = (S)0; + +void f() { + uint3 v = P.v; + uint x = P.v.x; + uint y = P.v.y; + uint z = P.v.z; + uint2 xx = P.v.xx; + uint2 xy = P.v.xy; + uint2 xz = P.v.xz; + uint2 yx = P.v.yx; + uint2 yy = P.v.yy; + uint2 yz = P.v.yz; + uint2 zx = P.v.zx; + uint2 zy = P.v.zy; + uint2 zz = P.v.zz; + uint3 xxx = P.v.xxx; + uint3 xxy = P.v.xxy; + uint3 xxz = P.v.xxz; + uint3 xyx = P.v.xyx; + uint3 xyy = P.v.xyy; + uint3 xyz = P.v.xyz; + uint3 xzx = P.v.xzx; + uint3 xzy = P.v.xzy; + uint3 xzz = P.v.xzz; + uint3 yxx = P.v.yxx; + uint3 yxy = P.v.yxy; + uint3 yxz = P.v.yxz; + uint3 yyx = P.v.yyx; + uint3 yyy = P.v.yyy; + uint3 yyz = P.v.yyz; + uint3 yzx = P.v.yzx; + uint3 yzy = P.v.yzy; + uint3 yzz = P.v.yzz; + uint3 zxx = P.v.zxx; + uint3 zxy = P.v.zxy; + uint3 zxz = P.v.zxz; + uint3 zyx = P.v.zyx; + uint3 zyy = P.v.zyy; + uint3 zyz = P.v.zyz; + uint3 zzx = P.v.zzx; + uint3 zzy = P.v.zzy; + uint3 zzz = P.v.zzz; + uint4 xxxx = P.v.xxxx; + uint4 xxxy = P.v.xxxy; + uint4 xxxz = P.v.xxxz; + uint4 xxyx = P.v.xxyx; + uint4 xxyy = P.v.xxyy; + uint4 xxyz = P.v.xxyz; + uint4 xxzx = P.v.xxzx; + uint4 xxzy = P.v.xxzy; + uint4 xxzz = P.v.xxzz; + uint4 xyxx = P.v.xyxx; + uint4 xyxy = P.v.xyxy; + uint4 xyxz = P.v.xyxz; + uint4 xyyx = P.v.xyyx; + uint4 xyyy = P.v.xyyy; + uint4 xyyz = P.v.xyyz; + uint4 xyzx = P.v.xyzx; + uint4 xyzy = P.v.xyzy; + uint4 xyzz = P.v.xyzz; + uint4 xzxx = P.v.xzxx; + uint4 xzxy = P.v.xzxy; + uint4 xzxz = P.v.xzxz; + uint4 xzyx = P.v.xzyx; + uint4 xzyy = P.v.xzyy; + uint4 xzyz = P.v.xzyz; + uint4 xzzx = P.v.xzzx; + uint4 xzzy = P.v.xzzy; + uint4 xzzz = P.v.xzzz; + uint4 yxxx = P.v.yxxx; + uint4 yxxy = P.v.yxxy; + uint4 yxxz = P.v.yxxz; + uint4 yxyx = P.v.yxyx; + uint4 yxyy = P.v.yxyy; + uint4 yxyz = P.v.yxyz; + uint4 yxzx = P.v.yxzx; + uint4 yxzy = P.v.yxzy; + uint4 yxzz = P.v.yxzz; + uint4 yyxx = P.v.yyxx; + uint4 yyxy = P.v.yyxy; + uint4 yyxz = P.v.yyxz; + uint4 yyyx = P.v.yyyx; + uint4 yyyy = P.v.yyyy; + uint4 yyyz = P.v.yyyz; + uint4 yyzx = P.v.yyzx; + uint4 yyzy = P.v.yyzy; + uint4 yyzz = P.v.yyzz; + uint4 yzxx = P.v.yzxx; + uint4 yzxy = P.v.yzxy; + uint4 yzxz = P.v.yzxz; + uint4 yzyx = P.v.yzyx; + uint4 yzyy = P.v.yzyy; + uint4 yzyz = P.v.yzyz; + uint4 yzzx = P.v.yzzx; + uint4 yzzy = P.v.yzzy; + uint4 yzzz = P.v.yzzz; + uint4 zxxx = P.v.zxxx; + uint4 zxxy = P.v.zxxy; + uint4 zxxz = P.v.zxxz; + uint4 zxyx = P.v.zxyx; + uint4 zxyy = P.v.zxyy; + uint4 zxyz = P.v.zxyz; + uint4 zxzx = P.v.zxzx; + uint4 zxzy = P.v.zxzy; + uint4 zxzz = P.v.zxzz; + uint4 zyxx = P.v.zyxx; + uint4 zyxy = P.v.zyxy; + uint4 zyxz = P.v.zyxz; + uint4 zyyx = P.v.zyyx; + uint4 zyyy = P.v.zyyy; + uint4 zyyz = P.v.zyyz; + uint4 zyzx = P.v.zyzx; + uint4 zyzy = P.v.zyzy; + uint4 zyzz = P.v.zyzz; + uint4 zzxx = P.v.zzxx; + uint4 zzxy = P.v.zzxy; + uint4 zzxz = P.v.zzxz; + uint4 zzyx = P.v.zzyx; + uint4 zzyy = P.v.zzyy; + uint4 zzyz = P.v.zzyz; + uint4 zzzx = P.v.zzzx; + uint4 zzzy = P.v.zzzy; + uint4 zzzz = P.v.zzzz; +} diff --git a/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.msl b/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.msl index 61bc87d078..62ca0b30e5 100644 --- a/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/read/vec3/u32.wgsl.expected.msl @@ -5,127 +5,128 @@ struct S { uint3 v; }; -void f(thread S* const tint_symbol) { - uint3 v = (*(tint_symbol)).v; - uint x = (*(tint_symbol)).v[0]; - uint y = (*(tint_symbol)).v[1]; - uint z = (*(tint_symbol)).v[2]; - uint2 xx = uint3((*(tint_symbol)).v).xx; - uint2 xy = uint3((*(tint_symbol)).v).xy; - uint2 xz = uint3((*(tint_symbol)).v).xz; - uint2 yx = uint3((*(tint_symbol)).v).yx; - uint2 yy = uint3((*(tint_symbol)).v).yy; - uint2 yz = uint3((*(tint_symbol)).v).yz; - uint2 zx = uint3((*(tint_symbol)).v).zx; - uint2 zy = uint3((*(tint_symbol)).v).zy; - uint2 zz = uint3((*(tint_symbol)).v).zz; - uint3 xxx = uint3((*(tint_symbol)).v).xxx; - uint3 xxy = uint3((*(tint_symbol)).v).xxy; - uint3 xxz = uint3((*(tint_symbol)).v).xxz; - uint3 xyx = uint3((*(tint_symbol)).v).xyx; - uint3 xyy = uint3((*(tint_symbol)).v).xyy; - uint3 xyz = uint3((*(tint_symbol)).v).xyz; - uint3 xzx = uint3((*(tint_symbol)).v).xzx; - uint3 xzy = uint3((*(tint_symbol)).v).xzy; - uint3 xzz = uint3((*(tint_symbol)).v).xzz; - uint3 yxx = uint3((*(tint_symbol)).v).yxx; - uint3 yxy = uint3((*(tint_symbol)).v).yxy; - uint3 yxz = uint3((*(tint_symbol)).v).yxz; - uint3 yyx = uint3((*(tint_symbol)).v).yyx; - uint3 yyy = uint3((*(tint_symbol)).v).yyy; - uint3 yyz = uint3((*(tint_symbol)).v).yyz; - uint3 yzx = uint3((*(tint_symbol)).v).yzx; - uint3 yzy = uint3((*(tint_symbol)).v).yzy; - uint3 yzz = uint3((*(tint_symbol)).v).yzz; - uint3 zxx = uint3((*(tint_symbol)).v).zxx; - uint3 zxy = uint3((*(tint_symbol)).v).zxy; - uint3 zxz = uint3((*(tint_symbol)).v).zxz; - uint3 zyx = uint3((*(tint_symbol)).v).zyx; - uint3 zyy = uint3((*(tint_symbol)).v).zyy; - uint3 zyz = uint3((*(tint_symbol)).v).zyz; - uint3 zzx = uint3((*(tint_symbol)).v).zzx; - uint3 zzy = uint3((*(tint_symbol)).v).zzy; - uint3 zzz = uint3((*(tint_symbol)).v).zzz; - uint4 xxxx = uint3((*(tint_symbol)).v).xxxx; - uint4 xxxy = uint3((*(tint_symbol)).v).xxxy; - uint4 xxxz = uint3((*(tint_symbol)).v).xxxz; - uint4 xxyx = uint3((*(tint_symbol)).v).xxyx; - uint4 xxyy = uint3((*(tint_symbol)).v).xxyy; - uint4 xxyz = uint3((*(tint_symbol)).v).xxyz; - uint4 xxzx = uint3((*(tint_symbol)).v).xxzx; - uint4 xxzy = uint3((*(tint_symbol)).v).xxzy; - uint4 xxzz = uint3((*(tint_symbol)).v).xxzz; - uint4 xyxx = uint3((*(tint_symbol)).v).xyxx; - uint4 xyxy = uint3((*(tint_symbol)).v).xyxy; - uint4 xyxz = uint3((*(tint_symbol)).v).xyxz; - uint4 xyyx = uint3((*(tint_symbol)).v).xyyx; - uint4 xyyy = uint3((*(tint_symbol)).v).xyyy; - uint4 xyyz = uint3((*(tint_symbol)).v).xyyz; - uint4 xyzx = uint3((*(tint_symbol)).v).xyzx; - uint4 xyzy = uint3((*(tint_symbol)).v).xyzy; - uint4 xyzz = uint3((*(tint_symbol)).v).xyzz; - uint4 xzxx = uint3((*(tint_symbol)).v).xzxx; - uint4 xzxy = uint3((*(tint_symbol)).v).xzxy; - uint4 xzxz = uint3((*(tint_symbol)).v).xzxz; - uint4 xzyx = uint3((*(tint_symbol)).v).xzyx; - uint4 xzyy = uint3((*(tint_symbol)).v).xzyy; - uint4 xzyz = uint3((*(tint_symbol)).v).xzyz; - uint4 xzzx = uint3((*(tint_symbol)).v).xzzx; - uint4 xzzy = uint3((*(tint_symbol)).v).xzzy; - uint4 xzzz = uint3((*(tint_symbol)).v).xzzz; - uint4 yxxx = uint3((*(tint_symbol)).v).yxxx; - uint4 yxxy = uint3((*(tint_symbol)).v).yxxy; - uint4 yxxz = uint3((*(tint_symbol)).v).yxxz; - uint4 yxyx = uint3((*(tint_symbol)).v).yxyx; - uint4 yxyy = uint3((*(tint_symbol)).v).yxyy; - uint4 yxyz = uint3((*(tint_symbol)).v).yxyz; - uint4 yxzx = uint3((*(tint_symbol)).v).yxzx; - uint4 yxzy = uint3((*(tint_symbol)).v).yxzy; - uint4 yxzz = uint3((*(tint_symbol)).v).yxzz; - uint4 yyxx = uint3((*(tint_symbol)).v).yyxx; - uint4 yyxy = uint3((*(tint_symbol)).v).yyxy; - uint4 yyxz = uint3((*(tint_symbol)).v).yyxz; - uint4 yyyx = uint3((*(tint_symbol)).v).yyyx; - uint4 yyyy = uint3((*(tint_symbol)).v).yyyy; - uint4 yyyz = uint3((*(tint_symbol)).v).yyyz; - uint4 yyzx = uint3((*(tint_symbol)).v).yyzx; - uint4 yyzy = uint3((*(tint_symbol)).v).yyzy; - uint4 yyzz = uint3((*(tint_symbol)).v).yyzz; - uint4 yzxx = uint3((*(tint_symbol)).v).yzxx; - uint4 yzxy = uint3((*(tint_symbol)).v).yzxy; - uint4 yzxz = uint3((*(tint_symbol)).v).yzxz; - uint4 yzyx = uint3((*(tint_symbol)).v).yzyx; - uint4 yzyy = uint3((*(tint_symbol)).v).yzyy; - uint4 yzyz = uint3((*(tint_symbol)).v).yzyz; - uint4 yzzx = uint3((*(tint_symbol)).v).yzzx; - uint4 yzzy = uint3((*(tint_symbol)).v).yzzy; - uint4 yzzz = uint3((*(tint_symbol)).v).yzzz; - uint4 zxxx = uint3((*(tint_symbol)).v).zxxx; - uint4 zxxy = uint3((*(tint_symbol)).v).zxxy; - uint4 zxxz = uint3((*(tint_symbol)).v).zxxz; - uint4 zxyx = uint3((*(tint_symbol)).v).zxyx; - uint4 zxyy = uint3((*(tint_symbol)).v).zxyy; - uint4 zxyz = uint3((*(tint_symbol)).v).zxyz; - uint4 zxzx = uint3((*(tint_symbol)).v).zxzx; - uint4 zxzy = uint3((*(tint_symbol)).v).zxzy; - uint4 zxzz = uint3((*(tint_symbol)).v).zxzz; - uint4 zyxx = uint3((*(tint_symbol)).v).zyxx; - uint4 zyxy = uint3((*(tint_symbol)).v).zyxy; - uint4 zyxz = uint3((*(tint_symbol)).v).zyxz; - uint4 zyyx = uint3((*(tint_symbol)).v).zyyx; - uint4 zyyy = uint3((*(tint_symbol)).v).zyyy; - uint4 zyyz = uint3((*(tint_symbol)).v).zyyz; - uint4 zyzx = uint3((*(tint_symbol)).v).zyzx; - uint4 zyzy = uint3((*(tint_symbol)).v).zyzy; - uint4 zyzz = uint3((*(tint_symbol)).v).zyzz; - uint4 zzxx = uint3((*(tint_symbol)).v).zzxx; - uint4 zzxy = uint3((*(tint_symbol)).v).zzxy; - uint4 zzxz = uint3((*(tint_symbol)).v).zzxz; - uint4 zzyx = uint3((*(tint_symbol)).v).zzyx; - uint4 zzyy = uint3((*(tint_symbol)).v).zzyy; - uint4 zzyz = uint3((*(tint_symbol)).v).zzyz; - uint4 zzzx = uint3((*(tint_symbol)).v).zzzx; - uint4 zzzy = uint3((*(tint_symbol)).v).zzzy; - uint4 zzzz = uint3((*(tint_symbol)).v).zzzz; +void f() { + thread S tint_symbol = {}; + uint3 v = tint_symbol.v; + uint x = tint_symbol.v[0]; + uint y = tint_symbol.v[1]; + uint z = tint_symbol.v[2]; + uint2 xx = uint3(tint_symbol.v).xx; + uint2 xy = uint3(tint_symbol.v).xy; + uint2 xz = uint3(tint_symbol.v).xz; + uint2 yx = uint3(tint_symbol.v).yx; + uint2 yy = uint3(tint_symbol.v).yy; + uint2 yz = uint3(tint_symbol.v).yz; + uint2 zx = uint3(tint_symbol.v).zx; + uint2 zy = uint3(tint_symbol.v).zy; + uint2 zz = uint3(tint_symbol.v).zz; + uint3 xxx = uint3(tint_symbol.v).xxx; + uint3 xxy = uint3(tint_symbol.v).xxy; + uint3 xxz = uint3(tint_symbol.v).xxz; + uint3 xyx = uint3(tint_symbol.v).xyx; + uint3 xyy = uint3(tint_symbol.v).xyy; + uint3 xyz = uint3(tint_symbol.v).xyz; + uint3 xzx = uint3(tint_symbol.v).xzx; + uint3 xzy = uint3(tint_symbol.v).xzy; + uint3 xzz = uint3(tint_symbol.v).xzz; + uint3 yxx = uint3(tint_symbol.v).yxx; + uint3 yxy = uint3(tint_symbol.v).yxy; + uint3 yxz = uint3(tint_symbol.v).yxz; + uint3 yyx = uint3(tint_symbol.v).yyx; + uint3 yyy = uint3(tint_symbol.v).yyy; + uint3 yyz = uint3(tint_symbol.v).yyz; + uint3 yzx = uint3(tint_symbol.v).yzx; + uint3 yzy = uint3(tint_symbol.v).yzy; + uint3 yzz = uint3(tint_symbol.v).yzz; + uint3 zxx = uint3(tint_symbol.v).zxx; + uint3 zxy = uint3(tint_symbol.v).zxy; + uint3 zxz = uint3(tint_symbol.v).zxz; + uint3 zyx = uint3(tint_symbol.v).zyx; + uint3 zyy = uint3(tint_symbol.v).zyy; + uint3 zyz = uint3(tint_symbol.v).zyz; + uint3 zzx = uint3(tint_symbol.v).zzx; + uint3 zzy = uint3(tint_symbol.v).zzy; + uint3 zzz = uint3(tint_symbol.v).zzz; + uint4 xxxx = uint3(tint_symbol.v).xxxx; + uint4 xxxy = uint3(tint_symbol.v).xxxy; + uint4 xxxz = uint3(tint_symbol.v).xxxz; + uint4 xxyx = uint3(tint_symbol.v).xxyx; + uint4 xxyy = uint3(tint_symbol.v).xxyy; + uint4 xxyz = uint3(tint_symbol.v).xxyz; + uint4 xxzx = uint3(tint_symbol.v).xxzx; + uint4 xxzy = uint3(tint_symbol.v).xxzy; + uint4 xxzz = uint3(tint_symbol.v).xxzz; + uint4 xyxx = uint3(tint_symbol.v).xyxx; + uint4 xyxy = uint3(tint_symbol.v).xyxy; + uint4 xyxz = uint3(tint_symbol.v).xyxz; + uint4 xyyx = uint3(tint_symbol.v).xyyx; + uint4 xyyy = uint3(tint_symbol.v).xyyy; + uint4 xyyz = uint3(tint_symbol.v).xyyz; + uint4 xyzx = uint3(tint_symbol.v).xyzx; + uint4 xyzy = uint3(tint_symbol.v).xyzy; + uint4 xyzz = uint3(tint_symbol.v).xyzz; + uint4 xzxx = uint3(tint_symbol.v).xzxx; + uint4 xzxy = uint3(tint_symbol.v).xzxy; + uint4 xzxz = uint3(tint_symbol.v).xzxz; + uint4 xzyx = uint3(tint_symbol.v).xzyx; + uint4 xzyy = uint3(tint_symbol.v).xzyy; + uint4 xzyz = uint3(tint_symbol.v).xzyz; + uint4 xzzx = uint3(tint_symbol.v).xzzx; + uint4 xzzy = uint3(tint_symbol.v).xzzy; + uint4 xzzz = uint3(tint_symbol.v).xzzz; + uint4 yxxx = uint3(tint_symbol.v).yxxx; + uint4 yxxy = uint3(tint_symbol.v).yxxy; + uint4 yxxz = uint3(tint_symbol.v).yxxz; + uint4 yxyx = uint3(tint_symbol.v).yxyx; + uint4 yxyy = uint3(tint_symbol.v).yxyy; + uint4 yxyz = uint3(tint_symbol.v).yxyz; + uint4 yxzx = uint3(tint_symbol.v).yxzx; + uint4 yxzy = uint3(tint_symbol.v).yxzy; + uint4 yxzz = uint3(tint_symbol.v).yxzz; + uint4 yyxx = uint3(tint_symbol.v).yyxx; + uint4 yyxy = uint3(tint_symbol.v).yyxy; + uint4 yyxz = uint3(tint_symbol.v).yyxz; + uint4 yyyx = uint3(tint_symbol.v).yyyx; + uint4 yyyy = uint3(tint_symbol.v).yyyy; + uint4 yyyz = uint3(tint_symbol.v).yyyz; + uint4 yyzx = uint3(tint_symbol.v).yyzx; + uint4 yyzy = uint3(tint_symbol.v).yyzy; + uint4 yyzz = uint3(tint_symbol.v).yyzz; + uint4 yzxx = uint3(tint_symbol.v).yzxx; + uint4 yzxy = uint3(tint_symbol.v).yzxy; + uint4 yzxz = uint3(tint_symbol.v).yzxz; + uint4 yzyx = uint3(tint_symbol.v).yzyx; + uint4 yzyy = uint3(tint_symbol.v).yzyy; + uint4 yzyz = uint3(tint_symbol.v).yzyz; + uint4 yzzx = uint3(tint_symbol.v).yzzx; + uint4 yzzy = uint3(tint_symbol.v).yzzy; + uint4 yzzz = uint3(tint_symbol.v).yzzz; + uint4 zxxx = uint3(tint_symbol.v).zxxx; + uint4 zxxy = uint3(tint_symbol.v).zxxy; + uint4 zxxz = uint3(tint_symbol.v).zxxz; + uint4 zxyx = uint3(tint_symbol.v).zxyx; + uint4 zxyy = uint3(tint_symbol.v).zxyy; + uint4 zxyz = uint3(tint_symbol.v).zxyz; + uint4 zxzx = uint3(tint_symbol.v).zxzx; + uint4 zxzy = uint3(tint_symbol.v).zxzy; + uint4 zxzz = uint3(tint_symbol.v).zxzz; + uint4 zyxx = uint3(tint_symbol.v).zyxx; + uint4 zyxy = uint3(tint_symbol.v).zyxy; + uint4 zyxz = uint3(tint_symbol.v).zyxz; + uint4 zyyx = uint3(tint_symbol.v).zyyx; + uint4 zyyy = uint3(tint_symbol.v).zyyy; + uint4 zyyz = uint3(tint_symbol.v).zyyz; + uint4 zyzx = uint3(tint_symbol.v).zyzx; + uint4 zyzy = uint3(tint_symbol.v).zyzy; + uint4 zyzz = uint3(tint_symbol.v).zyzz; + uint4 zzxx = uint3(tint_symbol.v).zzxx; + uint4 zzxy = uint3(tint_symbol.v).zzxy; + uint4 zzxz = uint3(tint_symbol.v).zzxz; + uint4 zzyx = uint3(tint_symbol.v).zzyx; + uint4 zzyy = uint3(tint_symbol.v).zzyy; + uint4 zzyz = uint3(tint_symbol.v).zzyz; + uint4 zzzx = uint3(tint_symbol.v).zzzx; + uint4 zzzy = uint3(tint_symbol.v).zzzy; + uint4 zzzz = uint3(tint_symbol.v).zzzz; } diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl new file mode 100644 index 0000000000..5d1b3aa37d --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl @@ -0,0 +1,14 @@ +enable f16; +struct S { + v: vec3, +}; + +@group(0) @binding(0) var U : S; + +fn f() { + U.v = vec3(1.0h, 2.0h, 3.0h); + + U.v.x = 1.0h; + U.v.y = 2.0h; + U.v.z = 3.0h; +} diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f7fb998495 --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/write/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'storage' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:6:48 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f7fb998495 --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/write/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'storage' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:6:48 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.glsl b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f7fb998495 --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/write/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'storage' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:6:48 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.msl b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..f7fb998495 --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.msl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/write/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'storage' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:6:48 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7fb998495 --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/write/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'storage' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:6:48 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7fb998495 --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,18 @@ +SKIP: FAILED + +swizzle/write/packed_vec3/f16.wgsl:3:8 error: using f16 types in 'storage' storage class is not implemented yet + v: vec3, + ^^^^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:2:1 note: see layout of struct: +/* align(8) size(8) */ struct S { +/* offset(0) align(8) size(6) */ v : vec3; +/* offset(6) align(1) size(2) */ // -- implicit struct size padding --; +/* */ }; +struct S { +^^^^^^ + +swizzle/write/packed_vec3/f16.wgsl:6:48 note: see declaration of variable +@group(0) @binding(0) var U : S; + ^ + diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bd302bc9a5 --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer U : register(u0, space0); + +void f() { + U.Store3(0u, asuint(float3(1.0f, 2.0f, 3.0f))); + U.Store(0u, asuint(1.0f)); + U.Store(4u, asuint(2.0f)); + U.Store(8u, asuint(3.0f)); +} diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.msl b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.msl index 2e63ec796e..7599cbc49e 100644 --- a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.msl @@ -12,9 +12,21 @@ inline vec operator*(packed_vec lhs, matrix rhs) { return vec(lhs) * rhs; } +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ packed_float3 v; - /* 0x000c */ int8_t tint_pad[4]; + /* 0x000c */ tint_array tint_pad; }; void f(device S* const tint_symbol) { diff --git a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1be931da54 --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer U : register(u0, space0); + +void f() { + U.Store3(0u, asuint(int3(1, 2, 3))); + U.Store(0u, asuint(1)); + U.Store(4u, asuint(2)); + U.Store(8u, asuint(3)); +} diff --git a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.msl b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.msl index 2bcecc1f0f..06cb457f8a 100644 --- a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.msl @@ -1,9 +1,22 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ packed_int3 v; - /* 0x000c */ int8_t tint_pad[4]; + /* 0x000c */ tint_array tint_pad; }; void f(device S* const tint_symbol) { diff --git a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fd7ff481b7 --- /dev/null +++ b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer U : register(u0, space0); + +void f() { + U.Store3(0u, asuint(uint3(1u, 2u, 3u))); + U.Store(0u, asuint(1u)); + U.Store(4u, asuint(2u)); + U.Store(8u, asuint(3u)); +} diff --git a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.msl b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.msl index b55912db40..e8e4904508 100644 --- a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.msl @@ -1,9 +1,22 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ packed_uint3 v; - /* 0x000c */ int8_t tint_pad[4]; + /* 0x000c */ tint_array tint_pad; }; void f(device S* const tint_symbol) { diff --git a/test/tint/expressions/swizzle/write/vec3/f16.wgsl b/test/tint/expressions/swizzle/write/vec3/f16.wgsl new file mode 100644 index 0000000000..e857da0c31 --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/f16.wgsl @@ -0,0 +1,14 @@ +enable f16; +struct S { + v: vec3, +}; + +var P : S; + +fn f() { + P.v = vec3(1.0h, 2.0h, 3.0h); + + P.v.x = 1.0h; + P.v.y = 2.0h; + P.v.z = 3.0h; +} diff --git a/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7887f1a306 --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + vector v; +}; + +static S P = (S)0; + +void f() { + P.v = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + P.v.x = float16_t(1.0h); + P.v.y = float16_t(2.0h); + P.v.z = float16_t(3.0h); +} diff --git a/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf281be214 --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + vector v; +}; + +static S P = (S)0; + +void f() { + P.v = vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); + P.v.x = float16_t(1.0h); + P.v.y = float16_t(2.0h); + P.v.z = float16_t(3.0h); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000029037AE4370(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.glsl b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..6fa1583d9e --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +struct S { + f16vec3 v; +}; + +S P = S(f16vec3(0.0hf, 0.0hf, 0.0hf)); +void f() { + P.v = f16vec3(1.0hf, 2.0hf, 3.0hf); + P.v.x = 1.0hf; + P.v.y = 2.0hf; + P.v.z = 3.0hf; +} + diff --git a/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.msl b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..87ad75db70 --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.msl @@ -0,0 +1,15 @@ +#include + +using namespace metal; +struct S { + half3 v; +}; + +void f() { + thread S tint_symbol = {}; + tint_symbol.v = half3(1.0h, 2.0h, 3.0h); + tint_symbol.v[0] = 1.0h; + tint_symbol.v[1] = 2.0h; + tint_symbol.v[2] = 3.0h; +} + diff --git a/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b373b67f6 --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %S "S" + OpMemberName %S 0 "v" + OpName %P "P" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpMemberDecorate %S 0 Offset 0 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %S = OpTypeStruct %v3half +%_ptr_Private_S = OpTypePointer Private %S + %6 = OpConstantNull %S + %P = OpVariable %_ptr_Private_S Private %6 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_v3half = OpTypePointer Private %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %20 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Private_half = OpTypePointer Private %half + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_Private_v3half %P %uint_0 + OpStore %16 %20 + %22 = OpAccessChain %_ptr_Private_half %P %uint_0 %uint_0 + OpStore %22 %half_0x1p_0 + %24 = OpAccessChain %_ptr_Private_half %P %uint_0 %uint_1 + OpStore %24 %half_0x1p_1 + %26 = OpAccessChain %_ptr_Private_half %P %uint_0 %uint_2 + OpStore %26 %half_0x1_8p_1 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1b0315b14 --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +enable f16; + +struct S { + v : vec3, +} + +var P : S; + +fn f() { + P.v = vec3(1.0h, 2.0h, 3.0h); + P.v.x = 1.0h; + P.v.y = 2.0h; + P.v.z = 3.0h; +} diff --git a/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4cfaf20633 --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + float3 v; +}; + +static S P = (S)0; + +void f() { + P.v = float3(1.0f, 2.0f, 3.0f); + P.v.x = 1.0f; + P.v.y = 2.0f; + P.v.z = 3.0f; +} diff --git a/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.msl b/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.msl index 17624cfcf9..7122f54351 100644 --- a/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/write/vec3/f32.wgsl.expected.msl @@ -5,10 +5,11 @@ struct S { float3 v; }; -void f(thread S* const tint_symbol) { - (*(tint_symbol)).v = float3(1.0f, 2.0f, 3.0f); - (*(tint_symbol)).v[0] = 1.0f; - (*(tint_symbol)).v[1] = 2.0f; - (*(tint_symbol)).v[2] = 3.0f; +void f() { + thread S tint_symbol = {}; + tint_symbol.v = float3(1.0f, 2.0f, 3.0f); + tint_symbol.v[0] = 1.0f; + tint_symbol.v[1] = 2.0f; + tint_symbol.v[2] = 3.0f; } diff --git a/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e3ecfbc847 --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int3 v; +}; + +static S P = (S)0; + +void f() { + P.v = int3(1, 2, 3); + P.v.x = 1; + P.v.y = 2; + P.v.z = 3; +} diff --git a/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.msl b/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.msl index bbd4748e60..1e4aee136e 100644 --- a/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/write/vec3/i32.wgsl.expected.msl @@ -5,10 +5,11 @@ struct S { int3 v; }; -void f(thread S* const tint_symbol) { - (*(tint_symbol)).v = int3(1, 2, 3); - (*(tint_symbol)).v[0] = 1; - (*(tint_symbol)).v[1] = 2; - (*(tint_symbol)).v[2] = 3; +void f() { + thread S tint_symbol = {}; + tint_symbol.v = int3(1, 2, 3); + tint_symbol.v[0] = 1; + tint_symbol.v[1] = 2; + tint_symbol.v[2] = 3; } diff --git a/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.hlsl rename to test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..172c6990e7 --- /dev/null +++ b/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + uint3 v; +}; + +static S P = (S)0; + +void f() { + P.v = uint3(1u, 2u, 3u); + P.v.x = 1u; + P.v.y = 2u; + P.v.z = 3u; +} diff --git a/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.msl b/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.msl index f665ab6387..5b5f76943d 100644 --- a/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.msl +++ b/test/tint/expressions/swizzle/write/vec3/u32.wgsl.expected.msl @@ -5,10 +5,11 @@ struct S { uint3 v; }; -void f(thread S* const tint_symbol) { - (*(tint_symbol)).v = uint3(1u, 2u, 3u); - (*(tint_symbol)).v[0] = 1u; - (*(tint_symbol)).v[1] = 2u; - (*(tint_symbol)).v[2] = 3u; +void f() { + thread S tint_symbol = {}; + tint_symbol.v = uint3(1u, 2u, 3u); + tint_symbol.v[0] = 1u; + tint_symbol.v[1] = 2u; + tint_symbol.v[2] = 3u; } diff --git a/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl new file mode 100644 index 0000000000..25681434ff --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl @@ -0,0 +1,5 @@ +var arr = array(1, 2); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c7b036c84 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2] = {1.0f, 2.0f}; + +void f() { + float v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c7b036c84 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2] = {1.0f, 2.0f}; + +void f() { + float v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.glsl new file mode 100644 index 0000000000..55d9783942 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float arr[2] = float[2](1.0f, 2.0f); +void f() { + float v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.msl new file mode 100644 index 0000000000..948a0e3a48 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{1.0f, 2.0f}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.spvasm new file mode 100644 index 0000000000..232dd327da --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_float_uint_2 ArrayStride 4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_2 +%_ptr_Private__arr_float_uint_2 = OpTypePointer Private %_arr_float_uint_2 + %arr = OpVariable %_ptr_Private__arr_float_uint_2 Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %19 = OpConstantNull %_arr_float_uint_2 +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %10 + %15 = OpLabel + %v = OpVariable %_ptr_Function__arr_float_uint_2 Function %19 + %16 = OpLoad %_arr_float_uint_2 %arr + OpStore %v %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa9a7245e4 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/abstract.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(1, 2); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl new file mode 100644 index 0000000000..d2167cfd82 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl @@ -0,0 +1,6 @@ +var arr = array, 2>(array(1, 2), + array(3, 4)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2b389c6c62 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2][2] = {{1.0f, 2.0f}, {3.0f, 4.0f}}; + +void f() { + float v[2][2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2b389c6c62 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2][2] = {{1.0f, 2.0f}, {3.0f, 4.0f}}; + +void f() { + float v[2][2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.glsl new file mode 100644 index 0000000000..0550a29a67 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float arr[2][2] = float[2][2](float[2](1.0f, 2.0f), float[2](3.0f, 4.0f)); +void f() { + float v[2][2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.msl new file mode 100644 index 0000000000..78574d3134 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array, 2> tint_symbol = tint_array, 2>{tint_array{1.0f, 2.0f}, tint_array{3.0f, 4.0f}}; + tint_array, 2> v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.spvasm new file mode 100644 index 0000000000..a98cc92027 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpDecorate %_arr__arr_float_uint_2_uint_2 ArrayStride 8 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_arr__arr_float_uint_2_uint_2 = OpTypeArray %_arr_float_uint_2 %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %8 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %11 = OpConstantComposite %_arr_float_uint_2 %float_3 %float_4 + %12 = OpConstantComposite %_arr__arr_float_uint_2_uint_2 %8 %11 +%_ptr_Private__arr__arr_float_uint_2_uint_2 = OpTypePointer Private %_arr__arr_float_uint_2_uint_2 + %arr = OpVariable %_ptr_Private__arr__arr_float_uint_2_uint_2 Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function__arr__arr_float_uint_2_uint_2 = OpTypePointer Function %_arr__arr_float_uint_2_uint_2 + %24 = OpConstantNull %_arr__arr_float_uint_2_uint_2 +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %15 + %20 = OpLabel + %v = OpVariable %_ptr_Function__arr__arr_float_uint_2_uint_2 Function %24 + %21 = OpLoad %_arr__arr_float_uint_2_uint_2 %arr + OpStore %v %21 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.wgsl new file mode 100644 index 0000000000..c017a84bf2 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/abstract.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(array(1, 2), array(3, 4)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl new file mode 100644 index 0000000000..27aaa4ff72 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl @@ -0,0 +1,6 @@ +var arr = array, 2>(array(1f, 2f), + array(3f, 4f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2b389c6c62 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2][2] = {{1.0f, 2.0f}, {3.0f, 4.0f}}; + +void f() { + float v[2][2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2b389c6c62 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2][2] = {{1.0f, 2.0f}, {3.0f, 4.0f}}; + +void f() { + float v[2][2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..0550a29a67 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float arr[2][2] = float[2][2](float[2](1.0f, 2.0f), float[2](3.0f, 4.0f)); +void f() { + float v[2][2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.msl new file mode 100644 index 0000000000..78574d3134 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array, 2> tint_symbol = tint_array, 2>{tint_array{1.0f, 2.0f}, tint_array{3.0f, 4.0f}}; + tint_array, 2> v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..a98cc92027 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpDecorate %_arr__arr_float_uint_2_uint_2 ArrayStride 8 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_arr__arr_float_uint_2_uint_2 = OpTypeArray %_arr_float_uint_2 %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %8 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %11 = OpConstantComposite %_arr_float_uint_2 %float_3 %float_4 + %12 = OpConstantComposite %_arr__arr_float_uint_2_uint_2 %8 %11 +%_ptr_Private__arr__arr_float_uint_2_uint_2 = OpTypePointer Private %_arr__arr_float_uint_2_uint_2 + %arr = OpVariable %_ptr_Private__arr__arr_float_uint_2_uint_2 Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function__arr__arr_float_uint_2_uint_2 = OpTypePointer Function %_arr__arr_float_uint_2_uint_2 + %24 = OpConstantNull %_arr__arr_float_uint_2_uint_2 +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %15 + %20 = OpLabel + %v = OpVariable %_ptr_Function__arr__arr_float_uint_2_uint_2 Function %24 + %21 = OpLoad %_arr__arr_float_uint_2_uint_2 %arr + OpStore %v %21 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..945dbb9ffe --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/array/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(array(1.0f, 2.0f), array(3.0f, 4.0f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/f32.wgsl b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl new file mode 100644 index 0000000000..e04e28f380 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl @@ -0,0 +1,5 @@ +var arr = array(1f, 2f); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c7b036c84 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2] = {1.0f, 2.0f}; + +void f() { + float v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c7b036c84 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2] = {1.0f, 2.0f}; + +void f() { + float v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..55d9783942 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float arr[2] = float[2](1.0f, 2.0f); +void f() { + float v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.msl new file mode 100644 index 0000000000..948a0e3a48 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{1.0f, 2.0f}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..232dd327da --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_float_uint_2 ArrayStride 4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_2 +%_ptr_Private__arr_float_uint_2 = OpTypePointer Private %_arr_float_uint_2 + %arr = OpVariable %_ptr_Private__arr_float_uint_2 Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %19 = OpConstantNull %_arr_float_uint_2 +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %10 + %15 = OpLabel + %v = OpVariable %_ptr_Function__arr_float_uint_2 Function %19 + %16 = OpLoad %_arr_float_uint_2 %arr + OpStore %v %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d88fd5d11 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(1.0f, 2.0f); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/i32.wgsl b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl new file mode 100644 index 0000000000..5b3e09f038 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl @@ -0,0 +1,5 @@ +var arr = array(1i, 2i); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b4f01b7c56 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int arr[2] = {1, 2}; + +void f() { + int v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b4f01b7c56 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int arr[2] = {1, 2}; + +void f() { + int v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.glsl new file mode 100644 index 0000000000..03840ace35 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int arr[2] = int[2](1, 2); +void f() { + int v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.msl new file mode 100644 index 0000000000..b25f389a17 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{1, 2}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..45acd1acdf --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_int_uint_2 ArrayStride 4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %7 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2 +%_ptr_Private__arr_int_uint_2 = OpTypePointer Private %_arr_int_uint_2 + %arr = OpVariable %_ptr_Private__arr_int_uint_2 Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %19 = OpConstantNull %_arr_int_uint_2 +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %10 + %15 = OpLabel + %v = OpVariable %_ptr_Function__arr_int_uint_2 Function %19 + %16 = OpLoad %_arr_int_uint_2 %arr + OpStore %v %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f79abd013 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(1i, 2i); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl new file mode 100644 index 0000000000..5659c692fd --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl @@ -0,0 +1,6 @@ +var arr = array, 2>(mat2x2(1, 2, 3, 4), + mat2x2(5, 6, 7, 8)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc37ba6e6e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 arr[2] = {float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + +void f() { + float2x2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fc37ba6e6e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 arr[2] = {float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + +void f() { + float2x2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.glsl new file mode 100644 index 0000000000..9df4d00ac9 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 arr[2] = mat2[2](mat2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)), mat2(vec2(5.0f, 6.0f), vec2(7.0f, 8.0f))); +void f() { + mat2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.msl new file mode 100644 index 0000000000..fc7a396e93 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ad3dab236 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_mat2v2float_uint_2 ArrayStride 16 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_mat2v2float_uint_2 = OpTypeArray %mat2v2float %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %9 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %12 = OpConstantComposite %v2float %float_3 %float_4 + %13 = OpConstantComposite %mat2v2float %9 %12 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %16 = OpConstantComposite %v2float %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %19 = OpConstantComposite %v2float %float_7 %float_8 + %20 = OpConstantComposite %mat2v2float %16 %19 + %21 = OpConstantComposite %_arr_mat2v2float_uint_2 %13 %20 +%_ptr_Private__arr_mat2v2float_uint_2 = OpTypePointer Private %_arr_mat2v2float_uint_2 + %arr = OpVariable %_ptr_Private__arr_mat2v2float_uint_2 Private %21 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function__arr_mat2v2float_uint_2 = OpTypePointer Function %_arr_mat2v2float_uint_2 + %33 = OpConstantNull %_arr_mat2v2float_uint_2 +%unused_entry_point = OpFunction %void None %24 + %27 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %24 + %29 = OpLabel + %v = OpVariable %_ptr_Function__arr_mat2v2float_uint_2 Function %33 + %30 = OpLoad %_arr_mat2v2float_uint_2 %arr + OpStore %v %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b0eb2753f --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/abstract.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(mat2x2(1, 2, 3, 4), mat2x2(5, 6, 7, 8)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl new file mode 100644 index 0000000000..99e6732d33 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl @@ -0,0 +1,6 @@ +var arr = array, 2>(mat2x2(1f, 2f, 3f, 4f), + mat2x2(5f, 6f, 7f, 8f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc37ba6e6e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 arr[2] = {float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + +void f() { + float2x2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fc37ba6e6e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 arr[2] = {float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + +void f() { + float2x2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..9df4d00ac9 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 arr[2] = mat2[2](mat2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)), mat2(vec2(5.0f, 6.0f), vec2(7.0f, 8.0f))); +void f() { + mat2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.msl new file mode 100644 index 0000000000..fc7a396e93 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ad3dab236 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_mat2v2float_uint_2 ArrayStride 16 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_mat2v2float_uint_2 = OpTypeArray %mat2v2float %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %9 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %12 = OpConstantComposite %v2float %float_3 %float_4 + %13 = OpConstantComposite %mat2v2float %9 %12 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %16 = OpConstantComposite %v2float %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %19 = OpConstantComposite %v2float %float_7 %float_8 + %20 = OpConstantComposite %mat2v2float %16 %19 + %21 = OpConstantComposite %_arr_mat2v2float_uint_2 %13 %20 +%_ptr_Private__arr_mat2v2float_uint_2 = OpTypePointer Private %_arr_mat2v2float_uint_2 + %arr = OpVariable %_ptr_Private__arr_mat2v2float_uint_2 Private %21 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function__arr_mat2v2float_uint_2 = OpTypePointer Function %_arr_mat2v2float_uint_2 + %33 = OpConstantNull %_arr_mat2v2float_uint_2 +%unused_entry_point = OpFunction %void None %24 + %27 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %24 + %29 = OpLabel + %v = OpVariable %_ptr_Function__arr_mat2v2float_uint_2 Function %33 + %30 = OpLoad %_arr_mat2v2float_uint_2 %arr + OpStore %v %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..64f1bdf525 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/mat2x2/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(mat2x2(1.0f, 2.0f, 3.0f, 4.0f), mat2x2(5.0f, 6.0f, 7.0f, 8.0f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/u32.wgsl b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl new file mode 100644 index 0000000000..3dcc9ab1e1 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl @@ -0,0 +1,5 @@ +var arr = array(1u, 2u); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b26a6aefa1 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint arr[2] = {1u, 2u}; + +void f() { + uint v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b26a6aefa1 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint arr[2] = {1u, 2u}; + +void f() { + uint v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.glsl new file mode 100644 index 0000000000..5165ecde72 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint arr[2] = uint[2](1u, 2u); +void f() { + uint v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.msl new file mode 100644 index 0000000000..ae65b6ab83 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{1u, 2u}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..93e55c3d32 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_uint_uint_2 ArrayStride 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %uint_1 = OpConstant %uint 1 + %5 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2 +%_ptr_Private__arr_uint_uint_2 = OpTypePointer Private %_arr_uint_uint_2 + %arr = OpVariable %_ptr_Private__arr_uint_uint_2 Private %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2 + %17 = OpConstantNull %_arr_uint_uint_2 +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %8 + %13 = OpLabel + %v = OpVariable %_ptr_Function__arr_uint_uint_2 Function %17 + %14 = OpLoad %_arr_uint_uint_2 %arr + OpStore %v %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e44d516d1 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(1u, 2u); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl new file mode 100644 index 0000000000..bedbafc61b --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(vec2(1), vec2(2)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..090d6cc40d --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 arr[2] = {(1.0f).xx, (2.0f).xx}; + +void f() { + float2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..090d6cc40d --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 arr[2] = {(1.0f).xx, (2.0f).xx}; + +void f() { + float2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.glsl new file mode 100644 index 0000000000..eb17daee94 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 arr[2] = vec2[2](vec2(1.0f), vec2(2.0f)); +void f() { + vec2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.msl new file mode 100644 index 0000000000..6965cc267a --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{float2(1.0f), float2(2.0f)}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.spvasm new file mode 100644 index 0000000000..1539882468 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_v2float_uint_2 ArrayStride 8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v2float_uint_2 = OpTypeArray %v2float %uint_2 + %float_1 = OpConstant %float 1 + %7 = OpConstantComposite %v2float %float_1 %float_1 + %float_2 = OpConstant %float 2 + %9 = OpConstantComposite %v2float %float_2 %float_2 + %10 = OpConstantComposite %_arr_v2float_uint_2 %7 %9 +%_ptr_Private__arr_v2float_uint_2 = OpTypePointer Private %_arr_v2float_uint_2 + %arr = OpVariable %_ptr_Private__arr_v2float_uint_2 Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function__arr_v2float_uint_2 = OpTypePointer Function %_arr_v2float_uint_2 + %22 = OpConstantNull %_arr_v2float_uint_2 +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %13 + %18 = OpLabel + %v = OpVariable %_ptr_Function__arr_v2float_uint_2 Function %22 + %19 = OpLoad %_arr_v2float_uint_2 %arr + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.wgsl new file mode 100644 index 0000000000..a3bfdc9cf9 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/abstract.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(vec2(1), vec2(2)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl new file mode 100644 index 0000000000..3123eb862b --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(vec2(1f), vec2(2f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..090d6cc40d --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 arr[2] = {(1.0f).xx, (2.0f).xx}; + +void f() { + float2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..090d6cc40d --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 arr[2] = {(1.0f).xx, (2.0f).xx}; + +void f() { + float2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..eb17daee94 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 arr[2] = vec2[2](vec2(1.0f), vec2(2.0f)); +void f() { + vec2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.msl new file mode 100644 index 0000000000..6965cc267a --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{float2(1.0f), float2(2.0f)}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..1539882468 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_v2float_uint_2 ArrayStride 8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v2float_uint_2 = OpTypeArray %v2float %uint_2 + %float_1 = OpConstant %float 1 + %7 = OpConstantComposite %v2float %float_1 %float_1 + %float_2 = OpConstant %float 2 + %9 = OpConstantComposite %v2float %float_2 %float_2 + %10 = OpConstantComposite %_arr_v2float_uint_2 %7 %9 +%_ptr_Private__arr_v2float_uint_2 = OpTypePointer Private %_arr_v2float_uint_2 + %arr = OpVariable %_ptr_Private__arr_v2float_uint_2 Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function__arr_v2float_uint_2 = OpTypePointer Function %_arr_v2float_uint_2 + %22 = OpConstantNull %_arr_v2float_uint_2 +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %13 + %18 = OpLabel + %v = OpVariable %_ptr_Function__arr_v2float_uint_2 Function %22 + %19 = OpLoad %_arr_v2float_uint_2 %arr + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..4afe341a23 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(vec2(1.0f), vec2(2.0f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl new file mode 100644 index 0000000000..7ce2e8b8b9 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(vec2(1i), vec2(2i)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1332312db0 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 arr[2] = {(1).xx, (2).xx}; + +void f() { + int2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1332312db0 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 arr[2] = {(1).xx, (2).xx}; + +void f() { + int2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.glsl new file mode 100644 index 0000000000..10442a77be --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 arr[2] = ivec2[2](ivec2(1), ivec2(2)); +void f() { + ivec2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.msl new file mode 100644 index 0000000000..d6e620261f --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{int2(1), int2(2)}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9330784556 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_v2int_uint_2 ArrayStride 8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v2int_uint_2 = OpTypeArray %v2int %uint_2 + %int_1 = OpConstant %int 1 + %7 = OpConstantComposite %v2int %int_1 %int_1 + %int_2 = OpConstant %int 2 + %9 = OpConstantComposite %v2int %int_2 %int_2 + %10 = OpConstantComposite %_arr_v2int_uint_2 %7 %9 +%_ptr_Private__arr_v2int_uint_2 = OpTypePointer Private %_arr_v2int_uint_2 + %arr = OpVariable %_ptr_Private__arr_v2int_uint_2 Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function__arr_v2int_uint_2 = OpTypePointer Function %_arr_v2int_uint_2 + %22 = OpConstantNull %_arr_v2int_uint_2 +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %13 + %18 = OpLabel + %v = OpVariable %_ptr_Function__arr_v2int_uint_2 Function %22 + %19 = OpLoad %_arr_v2int_uint_2 %arr + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f89c05f78f --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(vec2(1i), vec2(2i)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl new file mode 100644 index 0000000000..acfa49f2de --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(vec2(1u), vec2(2u)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5526776a83 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 arr[2] = {(1u).xx, (2u).xx}; + +void f() { + uint2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5526776a83 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 arr[2] = {(1u).xx, (2u).xx}; + +void f() { + uint2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.glsl new file mode 100644 index 0000000000..7c15fe0843 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 arr[2] = uvec2[2](uvec2(1u), uvec2(2u)); +void f() { + uvec2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.msl new file mode 100644 index 0000000000..53c875d0c5 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{uint2(1u), uint2(2u)}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..3af2262c4e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_v2uint_uint_2 ArrayStride 8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_2 = OpConstant %uint 2 +%_arr_v2uint_uint_2 = OpTypeArray %v2uint %uint_2 + %uint_1 = OpConstant %uint 1 + %6 = OpConstantComposite %v2uint %uint_1 %uint_1 + %7 = OpConstantComposite %v2uint %uint_2 %uint_2 + %8 = OpConstantComposite %_arr_v2uint_uint_2 %6 %7 +%_ptr_Private__arr_v2uint_uint_2 = OpTypePointer Private %_arr_v2uint_uint_2 + %arr = OpVariable %_ptr_Private__arr_v2uint_uint_2 Private %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function__arr_v2uint_uint_2 = OpTypePointer Function %_arr_v2uint_uint_2 + %20 = OpConstantNull %_arr_v2uint_uint_2 +%unused_entry_point = OpFunction %void None %11 + %14 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %11 + %16 = OpLabel + %v = OpVariable %_ptr_Function__arr_v2uint_uint_2 Function %20 + %17 = OpLoad %_arr_v2uint_uint_2 %arr + OpStore %v %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..4755a46c17 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/explicit/vec2/u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array, 2>(vec2(1u), vec2(2u)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl new file mode 100644 index 0000000000..c1f722fb66 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl @@ -0,0 +1,5 @@ +var arr = array(1, 2); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b4f01b7c56 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int arr[2] = {1, 2}; + +void f() { + int v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b4f01b7c56 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int arr[2] = {1, 2}; + +void f() { + int v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.glsl new file mode 100644 index 0000000000..03840ace35 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int arr[2] = int[2](1, 2); +void f() { + int v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.msl new file mode 100644 index 0000000000..b25f389a17 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{1, 2}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.spvasm new file mode 100644 index 0000000000..45acd1acdf --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_int_uint_2 ArrayStride 4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %7 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2 +%_ptr_Private__arr_int_uint_2 = OpTypePointer Private %_arr_int_uint_2 + %arr = OpVariable %_ptr_Private__arr_int_uint_2 Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %19 = OpConstantNull %_arr_int_uint_2 +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %10 + %15 = OpLabel + %v = OpVariable %_ptr_Function__arr_int_uint_2 Function %19 + %16 = OpLoad %_arr_int_uint_2 %arr + OpStore %v %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.wgsl new file mode 100644 index 0000000000..11afd2c44d --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/abstract.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(1, 2); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl new file mode 100644 index 0000000000..db47643d16 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl @@ -0,0 +1,5 @@ +var arr = array(array(1, 2), array(3, 4)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..79c4bfd33f --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int arr[2][2] = {{1, 2}, {3, 4}}; + +void f() { + int v[2][2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..79c4bfd33f --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int arr[2][2] = {{1, 2}, {3, 4}}; + +void f() { + int v[2][2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.glsl new file mode 100644 index 0000000000..de3ccef153 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int arr[2][2] = int[2][2](int[2](1, 2), int[2](3, 4)); +void f() { + int v[2][2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.msl new file mode 100644 index 0000000000..1782585711 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array, 2> tint_symbol = tint_array, 2>{tint_array{1, 2}, tint_array{3, 4}}; + tint_array, 2> v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.spvasm new file mode 100644 index 0000000000..de0259bae9 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpDecorate %_arr__arr_int_uint_2_uint_2 ArrayStride 8 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_arr__arr_int_uint_2_uint_2 = OpTypeArray %_arr_int_uint_2 %uint_2 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %8 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %11 = OpConstantComposite %_arr_int_uint_2 %int_3 %int_4 + %12 = OpConstantComposite %_arr__arr_int_uint_2_uint_2 %8 %11 +%_ptr_Private__arr__arr_int_uint_2_uint_2 = OpTypePointer Private %_arr__arr_int_uint_2_uint_2 + %arr = OpVariable %_ptr_Private__arr__arr_int_uint_2_uint_2 Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function__arr__arr_int_uint_2_uint_2 = OpTypePointer Function %_arr__arr_int_uint_2_uint_2 + %24 = OpConstantNull %_arr__arr_int_uint_2_uint_2 +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %15 + %20 = OpLabel + %v = OpVariable %_ptr_Function__arr__arr_int_uint_2_uint_2 Function %24 + %21 = OpLoad %_arr__arr_int_uint_2_uint_2 %arr + OpStore %v %21 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.wgsl new file mode 100644 index 0000000000..77ebaf43b2 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/abstract.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(array(1, 2), array(3, 4)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl new file mode 100644 index 0000000000..37501451b8 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl @@ -0,0 +1,5 @@ +var arr = array(array(1f, 2f), array(3f, 4f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2b389c6c62 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2][2] = {{1.0f, 2.0f}, {3.0f, 4.0f}}; + +void f() { + float v[2][2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2b389c6c62 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2][2] = {{1.0f, 2.0f}, {3.0f, 4.0f}}; + +void f() { + float v[2][2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..0550a29a67 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float arr[2][2] = float[2][2](float[2](1.0f, 2.0f), float[2](3.0f, 4.0f)); +void f() { + float v[2][2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.msl new file mode 100644 index 0000000000..78574d3134 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array, 2> tint_symbol = tint_array, 2>{tint_array{1.0f, 2.0f}, tint_array{3.0f, 4.0f}}; + tint_array, 2> v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..a98cc92027 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpDecorate %_arr__arr_float_uint_2_uint_2 ArrayStride 8 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_arr__arr_float_uint_2_uint_2 = OpTypeArray %_arr_float_uint_2 %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %8 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %11 = OpConstantComposite %_arr_float_uint_2 %float_3 %float_4 + %12 = OpConstantComposite %_arr__arr_float_uint_2_uint_2 %8 %11 +%_ptr_Private__arr__arr_float_uint_2_uint_2 = OpTypePointer Private %_arr__arr_float_uint_2_uint_2 + %arr = OpVariable %_ptr_Private__arr__arr_float_uint_2_uint_2 Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function__arr__arr_float_uint_2_uint_2 = OpTypePointer Function %_arr__arr_float_uint_2_uint_2 + %24 = OpConstantNull %_arr__arr_float_uint_2_uint_2 +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %15 + %20 = OpLabel + %v = OpVariable %_ptr_Function__arr__arr_float_uint_2_uint_2 Function %24 + %21 = OpLoad %_arr__arr_float_uint_2_uint_2 %arr + OpStore %v %21 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0e95a3cdd --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/array/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(array(1.0f, 2.0f), array(3.0f, 4.0f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/f32.wgsl b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl new file mode 100644 index 0000000000..79e46695eb --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl @@ -0,0 +1,5 @@ +var arr = array(1f, 2f); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c7b036c84 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2] = {1.0f, 2.0f}; + +void f() { + float v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c7b036c84 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float arr[2] = {1.0f, 2.0f}; + +void f() { + float v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..55d9783942 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float arr[2] = float[2](1.0f, 2.0f); +void f() { + float v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.msl new file mode 100644 index 0000000000..948a0e3a48 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{1.0f, 2.0f}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..232dd327da --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_float_uint_2 ArrayStride 4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_2 +%_ptr_Private__arr_float_uint_2 = OpTypePointer Private %_arr_float_uint_2 + %arr = OpVariable %_ptr_Private__arr_float_uint_2 Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %19 = OpConstantNull %_arr_float_uint_2 +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %10 + %15 = OpLabel + %v = OpVariable %_ptr_Function__arr_float_uint_2 Function %19 + %16 = OpLoad %_arr_float_uint_2 %arr + OpStore %v %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f9c4a624c --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(1.0f, 2.0f); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/i32.wgsl b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl new file mode 100644 index 0000000000..d7c159058f --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl @@ -0,0 +1,5 @@ +var arr = array(1i, 2i); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b4f01b7c56 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int arr[2] = {1, 2}; + +void f() { + int v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b4f01b7c56 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int arr[2] = {1, 2}; + +void f() { + int v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.glsl new file mode 100644 index 0000000000..03840ace35 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int arr[2] = int[2](1, 2); +void f() { + int v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.msl new file mode 100644 index 0000000000..b25f389a17 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{1, 2}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..45acd1acdf --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_int_uint_2 ArrayStride 4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %7 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2 +%_ptr_Private__arr_int_uint_2 = OpTypePointer Private %_arr_int_uint_2 + %arr = OpVariable %_ptr_Private__arr_int_uint_2 Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %19 = OpConstantNull %_arr_int_uint_2 +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %10 + %15 = OpLabel + %v = OpVariable %_ptr_Function__arr_int_uint_2 Function %19 + %16 = OpLoad %_arr_int_uint_2 %arr + OpStore %v %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..85af2c4106 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(1i, 2i); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl new file mode 100644 index 0000000000..c8d10101b5 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl @@ -0,0 +1,6 @@ +var arr = array(mat2x2(1, 2, 3, 4), + mat2x2(5, 6, 7, 8)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc37ba6e6e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 arr[2] = {float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + +void f() { + float2x2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fc37ba6e6e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 arr[2] = {float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + +void f() { + float2x2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.glsl new file mode 100644 index 0000000000..9df4d00ac9 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 arr[2] = mat2[2](mat2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)), mat2(vec2(5.0f, 6.0f), vec2(7.0f, 8.0f))); +void f() { + mat2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.msl new file mode 100644 index 0000000000..fc7a396e93 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ad3dab236 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_mat2v2float_uint_2 ArrayStride 16 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_mat2v2float_uint_2 = OpTypeArray %mat2v2float %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %9 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %12 = OpConstantComposite %v2float %float_3 %float_4 + %13 = OpConstantComposite %mat2v2float %9 %12 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %16 = OpConstantComposite %v2float %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %19 = OpConstantComposite %v2float %float_7 %float_8 + %20 = OpConstantComposite %mat2v2float %16 %19 + %21 = OpConstantComposite %_arr_mat2v2float_uint_2 %13 %20 +%_ptr_Private__arr_mat2v2float_uint_2 = OpTypePointer Private %_arr_mat2v2float_uint_2 + %arr = OpVariable %_ptr_Private__arr_mat2v2float_uint_2 Private %21 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function__arr_mat2v2float_uint_2 = OpTypePointer Function %_arr_mat2v2float_uint_2 + %33 = OpConstantNull %_arr_mat2v2float_uint_2 +%unused_entry_point = OpFunction %void None %24 + %27 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %24 + %29 = OpLabel + %v = OpVariable %_ptr_Function__arr_mat2v2float_uint_2 Function %33 + %30 = OpLoad %_arr_mat2v2float_uint_2 %arr + OpStore %v %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.wgsl new file mode 100644 index 0000000000..c054fac944 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/abstract.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(mat2x2(1, 2, 3, 4), mat2x2(5, 6, 7, 8)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl new file mode 100644 index 0000000000..8ebcd89f17 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl @@ -0,0 +1,6 @@ +var arr = array(mat2x2(1f, 2f, 3f, 4f), + mat2x2(5f, 6f, 7f, 8f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fc37ba6e6e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 arr[2] = {float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + +void f() { + float2x2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fc37ba6e6e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 arr[2] = {float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + +void f() { + float2x2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..9df4d00ac9 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 arr[2] = mat2[2](mat2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)), mat2(vec2(5.0f, 6.0f), vec2(7.0f, 8.0f))); +void f() { + mat2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.msl new file mode 100644 index 0000000000..fc7a396e93 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)), float2x2(float2(5.0f, 6.0f), float2(7.0f, 8.0f))}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8ad3dab236 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_mat2v2float_uint_2 ArrayStride 16 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_mat2v2float_uint_2 = OpTypeArray %mat2v2float %uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %9 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %12 = OpConstantComposite %v2float %float_3 %float_4 + %13 = OpConstantComposite %mat2v2float %9 %12 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %16 = OpConstantComposite %v2float %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %19 = OpConstantComposite %v2float %float_7 %float_8 + %20 = OpConstantComposite %mat2v2float %16 %19 + %21 = OpConstantComposite %_arr_mat2v2float_uint_2 %13 %20 +%_ptr_Private__arr_mat2v2float_uint_2 = OpTypePointer Private %_arr_mat2v2float_uint_2 + %arr = OpVariable %_ptr_Private__arr_mat2v2float_uint_2 Private %21 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function__arr_mat2v2float_uint_2 = OpTypePointer Function %_arr_mat2v2float_uint_2 + %33 = OpConstantNull %_arr_mat2v2float_uint_2 +%unused_entry_point = OpFunction %void None %24 + %27 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %24 + %29 = OpLabel + %v = OpVariable %_ptr_Function__arr_mat2v2float_uint_2 Function %33 + %30 = OpLoad %_arr_mat2v2float_uint_2 %arr + OpStore %v %30 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..bfd30eb1e1 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/mat2x2/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(mat2x2(1.0f, 2.0f, 3.0f, 4.0f), mat2x2(5.0f, 6.0f, 7.0f, 8.0f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/u32.wgsl b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl new file mode 100644 index 0000000000..f0d896e845 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl @@ -0,0 +1,5 @@ +var arr = array(1u, 2u); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b26a6aefa1 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint arr[2] = {1u, 2u}; + +void f() { + uint v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b26a6aefa1 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint arr[2] = {1u, 2u}; + +void f() { + uint v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.glsl new file mode 100644 index 0000000000..5165ecde72 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint arr[2] = uint[2](1u, 2u); +void f() { + uint v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.msl new file mode 100644 index 0000000000..ae65b6ab83 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{1u, 2u}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..93e55c3d32 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_uint_uint_2 ArrayStride 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %uint_1 = OpConstant %uint 1 + %5 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2 +%_ptr_Private__arr_uint_uint_2 = OpTypePointer Private %_arr_uint_uint_2 + %arr = OpVariable %_ptr_Private__arr_uint_uint_2 Private %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2 + %17 = OpConstantNull %_arr_uint_uint_2 +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %8 + %13 = OpLabel + %v = OpVariable %_ptr_Function__arr_uint_uint_2 Function %17 + %14 = OpLoad %_arr_uint_uint_2 %arr + OpStore %v %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..586586a8c5 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(1u, 2u); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl new file mode 100644 index 0000000000..0d9798661e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl @@ -0,0 +1,5 @@ +var arr = array(vec2(1), vec2(2)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..090d6cc40d --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 arr[2] = {(1.0f).xx, (2.0f).xx}; + +void f() { + float2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..090d6cc40d --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 arr[2] = {(1.0f).xx, (2.0f).xx}; + +void f() { + float2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.glsl new file mode 100644 index 0000000000..eb17daee94 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 arr[2] = vec2[2](vec2(1.0f), vec2(2.0f)); +void f() { + vec2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.msl new file mode 100644 index 0000000000..6965cc267a --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{float2(1.0f), float2(2.0f)}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.spvasm new file mode 100644 index 0000000000..1539882468 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_v2float_uint_2 ArrayStride 8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v2float_uint_2 = OpTypeArray %v2float %uint_2 + %float_1 = OpConstant %float 1 + %7 = OpConstantComposite %v2float %float_1 %float_1 + %float_2 = OpConstant %float 2 + %9 = OpConstantComposite %v2float %float_2 %float_2 + %10 = OpConstantComposite %_arr_v2float_uint_2 %7 %9 +%_ptr_Private__arr_v2float_uint_2 = OpTypePointer Private %_arr_v2float_uint_2 + %arr = OpVariable %_ptr_Private__arr_v2float_uint_2 Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function__arr_v2float_uint_2 = OpTypePointer Function %_arr_v2float_uint_2 + %22 = OpConstantNull %_arr_v2float_uint_2 +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %13 + %18 = OpLabel + %v = OpVariable %_ptr_Function__arr_v2float_uint_2 Function %22 + %19 = OpLoad %_arr_v2float_uint_2 %arr + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.wgsl new file mode 100644 index 0000000000..eccfd76754 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/abstract.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(vec2(1), vec2(2)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl new file mode 100644 index 0000000000..f9c4109e29 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl @@ -0,0 +1,5 @@ +var arr = array(vec2(1f), vec2(2f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..090d6cc40d --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 arr[2] = {(1.0f).xx, (2.0f).xx}; + +void f() { + float2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..090d6cc40d --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 arr[2] = {(1.0f).xx, (2.0f).xx}; + +void f() { + float2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..eb17daee94 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 arr[2] = vec2[2](vec2(1.0f), vec2(2.0f)); +void f() { + vec2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.msl new file mode 100644 index 0000000000..6965cc267a --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{float2(1.0f), float2(2.0f)}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..1539882468 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_v2float_uint_2 ArrayStride 8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v2float_uint_2 = OpTypeArray %v2float %uint_2 + %float_1 = OpConstant %float 1 + %7 = OpConstantComposite %v2float %float_1 %float_1 + %float_2 = OpConstant %float 2 + %9 = OpConstantComposite %v2float %float_2 %float_2 + %10 = OpConstantComposite %_arr_v2float_uint_2 %7 %9 +%_ptr_Private__arr_v2float_uint_2 = OpTypePointer Private %_arr_v2float_uint_2 + %arr = OpVariable %_ptr_Private__arr_v2float_uint_2 Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function__arr_v2float_uint_2 = OpTypePointer Function %_arr_v2float_uint_2 + %22 = OpConstantNull %_arr_v2float_uint_2 +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %13 + %18 = OpLabel + %v = OpVariable %_ptr_Function__arr_v2float_uint_2 Function %22 + %19 = OpLoad %_arr_v2float_uint_2 %arr + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..be602f2fcc --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(vec2(1.0f), vec2(2.0f)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl new file mode 100644 index 0000000000..bfd9096ac6 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl @@ -0,0 +1,5 @@ +var arr = array(vec2(1i), vec2(2i)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1332312db0 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 arr[2] = {(1).xx, (2).xx}; + +void f() { + int2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1332312db0 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 arr[2] = {(1).xx, (2).xx}; + +void f() { + int2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.glsl new file mode 100644 index 0000000000..10442a77be --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 arr[2] = ivec2[2](ivec2(1), ivec2(2)); +void f() { + ivec2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.msl new file mode 100644 index 0000000000..d6e620261f --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{int2(1), int2(2)}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9330784556 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_v2int_uint_2 ArrayStride 8 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v2int_uint_2 = OpTypeArray %v2int %uint_2 + %int_1 = OpConstant %int 1 + %7 = OpConstantComposite %v2int %int_1 %int_1 + %int_2 = OpConstant %int 2 + %9 = OpConstantComposite %v2int %int_2 %int_2 + %10 = OpConstantComposite %_arr_v2int_uint_2 %7 %9 +%_ptr_Private__arr_v2int_uint_2 = OpTypePointer Private %_arr_v2int_uint_2 + %arr = OpVariable %_ptr_Private__arr_v2int_uint_2 Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function__arr_v2int_uint_2 = OpTypePointer Function %_arr_v2int_uint_2 + %22 = OpConstantNull %_arr_v2int_uint_2 +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %13 + %18 = OpLabel + %v = OpVariable %_ptr_Function__arr_v2int_uint_2 Function %22 + %19 = OpLoad %_arr_v2int_uint_2 %arr + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..559c989ac4 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(vec2(1i), vec2(2i)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl new file mode 100644 index 0000000000..0cdf984d85 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl @@ -0,0 +1,5 @@ +var arr = array(vec2(1u), vec2(2u)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5526776a83 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 arr[2] = {(1u).xx, (2u).xx}; + +void f() { + uint2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5526776a83 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 arr[2] = {(1u).xx, (2u).xx}; + +void f() { + uint2 v[2] = arr; +} diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.glsl new file mode 100644 index 0000000000..7c15fe0843 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 arr[2] = uvec2[2](uvec2(1u), uvec2(2u)); +void f() { + uvec2 v[2] = arr; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.msl new file mode 100644 index 0000000000..53c875d0c5 --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + thread tint_array tint_symbol = tint_array{uint2(1u), uint2(2u)}; + tint_array v = tint_symbol; +} + diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..3af2262c4e --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %arr "arr" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_v2uint_uint_2 ArrayStride 8 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_2 = OpConstant %uint 2 +%_arr_v2uint_uint_2 = OpTypeArray %v2uint %uint_2 + %uint_1 = OpConstant %uint 1 + %6 = OpConstantComposite %v2uint %uint_1 %uint_1 + %7 = OpConstantComposite %v2uint %uint_2 %uint_2 + %8 = OpConstantComposite %_arr_v2uint_uint_2 %6 %7 +%_ptr_Private__arr_v2uint_uint_2 = OpTypePointer Private %_arr_v2uint_uint_2 + %arr = OpVariable %_ptr_Private__arr_v2uint_uint_2 Private %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function__arr_v2uint_uint_2 = OpTypePointer Function %_arr_v2uint_uint_2 + %20 = OpConstantNull %_arr_v2uint_uint_2 +%unused_entry_point = OpFunction %void None %11 + %14 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %11 + %16 = OpLabel + %v = OpVariable %_ptr_Function__arr_v2uint_uint_2 Function %20 + %17 = OpLoad %_arr_v2uint_uint_2 %arr + OpStore %v %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a016835b8b --- /dev/null +++ b/test/tint/expressions/type_ctor/array/inferred/vec2/u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var arr = array(vec2(1u), vec2(2u)); + +fn f() { + var v = arr; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl new file mode 100644 index 0000000000..ef4f0cd2c4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +var m = mat2x2(mat2x2(0.0h, 1.0h, + 2.0h, 3.0h)); + +fn f() -> mat2x2 { + let m_1 = mat2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..909b45b60e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..23c577251d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001E4D4452850(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8fd1749ac8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf)); +f16mat2 f() { + f16mat2 m_1 = f16mat2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..e4fadc8f46 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half2x2 f() { + thread half2x2 tint_symbol = half2x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h)); + half2x2 const m_1 = half2x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..81b52d74a0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 + %10 = OpConstantComposite %mat2v2half %6 %9 +%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half + %m = OpVariable %_ptr_Private_mat2v2half Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpTypeFunction %mat2v2half +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v2half None %17 + %19 = OpLabel + %21 = OpLoad %mat2v2half %m + OpReturnValue %21 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ffe12692f4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat2x2(mat2x2(0.0h, 1.0h, 2.0h, 3.0h)); + +fn f() -> mat2x2 { + let m_1 = mat2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl new file mode 100644 index 0000000000..195dba5f26 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl @@ -0,0 +1,7 @@ +var m = mat2x2(mat2x2(0.0f, 1.0f, + 2.0f, 3.0f)); + +fn f() -> mat2x2 { + let m_1 = mat2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..738053f3f9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); + +float2x2 f() { + const float2x2 m_1 = float2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..738053f3f9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); + +float2x2 f() { + const float2x2 m_1 = float2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..f820bd4695 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); +mat2 f() { + mat2 m_1 = mat2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..dcbe1b0e2f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float2x2 f() { + thread float2x2 tint_symbol = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); + float2x2 const m_1 = float2x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..07b1ba1123 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %m = OpVariable %_ptr_Private_mat2v2float Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpTypeFunction %mat2v2float +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v2float None %17 + %19 = OpLabel + %21 = OpLoad %mat2v2float %m + OpReturnValue %21 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..5950793a1a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat2x2(mat2x2(0.0f, 1.0f, 2.0f, 3.0f)); + +fn f() -> mat2x2 { + let m_1 = mat2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl new file mode 100644 index 0000000000..06d901c238 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x2(0.0h, 1.0h, + 2.0h, 3.0h); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e07b4a16d7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4044a4abc0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001F6AB2037B0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8b22b1971b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0b6221e46 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 + %10 = OpConstantComposite %mat2v2half %6 %9 +%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half + %m = OpVariable %_ptr_Private_mat2v2half Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..afe7f0a51d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x2(0.0h, 1.0h, 2.0h, 3.0h); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl index bbf4c71ee0..8f8c2f9f03 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x2(0.0, 1.0, - 2.0, 3.0); +var m = mat2x2(0.0f, 1.0f, + 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.glsl index f79600efe0..cb3e1d20c9 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2 m = mat2(0.0f, 1.0f, 2.0f, 3.0f); +mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 6dd93cf473..0000000000 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x2 m = float2x2(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.msl index b62a321cb2..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.spvasm index 16c63452ff..c04960ae18 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 17 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,16 +12,18 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat2v2float = OpTypeMatrix %v2float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 - %m = OpConstantComposite %mat2v2float %6 %9 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %m = OpVariable %_ptr_Private_mat2v2float Private %10 %void = OpTypeVoid - %11 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %11 - %14 = OpLabel + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.wgsl index c9626bd497..027ab224dd 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x2(0.0, 1.0, 2.0, 3.0); +var m = mat2x2(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl new file mode 100644 index 0000000000..7998488110 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x2(vec2(0.0h, 1.0h), + vec2(2.0h, 3.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e07b4a16d7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c1367c4f4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000020882B36A90(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8b22b1971b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0b6221e46 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 + %10 = OpConstantComposite %mat2v2half %6 %9 +%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half + %m = OpVariable %_ptr_Private_mat2v2half Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..7be5a433fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x2(vec2(0.0h, 1.0h), vec2(2.0h, 3.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl index b2ceabff10..691281633b 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x2(vec2(0.0, 1.0), - vec2(2.0, 3.0)); +var m = mat2x2(vec2(0.0f, 1.0f), + vec2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.glsl index f2eeed59ea..cb3e1d20c9 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); +mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index c2e0d31160..0000000000 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl index b62a321cb2..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm index 16c63452ff..c04960ae18 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 17 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,16 +12,18 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat2v2float = OpTypeMatrix %v2float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 - %m = OpConstantComposite %mat2v2float %6 %9 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %m = OpVariable %_ptr_Private_mat2v2float Private %10 %void = OpTypeVoid - %11 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %11 - %14 = OpLabel + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl index 5da680bcea..b3b5d6e3fa 100644 --- a/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x2/explicit/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0)); +var m = mat2x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl new file mode 100644 index 0000000000..4c2c065ffe --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +var m = mat2x2(mat2x2(0.0h, 1.0h, + 2.0h, 3.0h)); + +fn f() -> mat2x2 { + let m_1 = mat2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..909b45b60e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d54b18fc07 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000192F6581860(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8fd1749ac8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf)); +f16mat2 f() { + f16mat2 m_1 = f16mat2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..e4fadc8f46 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half2x2 f() { + thread half2x2 tint_symbol = half2x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h)); + half2x2 const m_1 = half2x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..81b52d74a0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 + %10 = OpConstantComposite %mat2v2half %6 %9 +%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half + %m = OpVariable %_ptr_Private_mat2v2half Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpTypeFunction %mat2v2half +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v2half None %17 + %19 = OpLabel + %21 = OpLoad %mat2v2half %m + OpReturnValue %21 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..35e5253b34 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat2x2(mat2x2(0.0h, 1.0h, 2.0h, 3.0h)); + +fn f() -> mat2x2 { + let m_1 = mat2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl new file mode 100644 index 0000000000..bd51d6bc40 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl @@ -0,0 +1,7 @@ +var m = mat2x2(mat2x2(0.0f, 1.0f, + 2.0f, 3.0f)); + +fn f() -> mat2x2 { + let m_1 = mat2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..738053f3f9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); + +float2x2 f() { + const float2x2 m_1 = float2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..738053f3f9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); + +float2x2 f() { + const float2x2 m_1 = float2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..f820bd4695 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); +mat2 f() { + mat2 m_1 = mat2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..dcbe1b0e2f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float2x2 f() { + thread float2x2 tint_symbol = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); + float2x2 const m_1 = float2x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..07b1ba1123 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %m = OpVariable %_ptr_Private_mat2v2float Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %17 = OpTypeFunction %mat2v2float +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v2float None %17 + %19 = OpLabel + %21 = OpLoad %mat2v2float %m + OpReturnValue %21 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..fb8399a4e9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat2x2(mat2x2(0.0f, 1.0f, 2.0f, 3.0f)); + +fn f() -> mat2x2 { + let m_1 = mat2x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl new file mode 100644 index 0000000000..99f7353021 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl @@ -0,0 +1,2 @@ +var m = mat2x2(0.0, 1.0, + 2.0, 3.0); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..cb3e1d20c9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..c04960ae18 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %m = OpVariable %_ptr_Private_mat2v2float Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1064e8dc8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat2x2(0.0, 1.0, 2.0, 3.0); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl new file mode 100644 index 0000000000..5b28fdb147 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x2(0.0h, 1.0h, + 2.0h, 3.0h); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e07b4a16d7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fbb36352ac --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002A196C42AF0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8b22b1971b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0b6221e46 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 + %10 = OpConstantComposite %mat2v2half %6 %9 +%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half + %m = OpVariable %_ptr_Private_mat2v2half Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ce8a82030 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x2(0.0h, 1.0h, 2.0h, 3.0h); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl index 0195661eb0..0fb8992f97 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x2(0.0, 1.0, - 2.0, 3.0); +var m = mat2x2(0.0f, 1.0f, + 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.glsl index f79600efe0..cb3e1d20c9 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2 m = mat2(0.0f, 1.0f, 2.0f, 3.0f); +mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 6dd93cf473..0000000000 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x2 m = float2x2(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.msl index b62a321cb2..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.spvasm index 16c63452ff..c04960ae18 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 17 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,16 +12,18 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat2v2float = OpTypeMatrix %v2float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 - %m = OpConstantComposite %mat2v2float %6 %9 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %m = OpVariable %_ptr_Private_mat2v2float Private %10 %void = OpTypeVoid - %11 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %11 - %14 = OpLabel + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.wgsl index e4941d5989..4a3c56d60e 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x2(0.0, 1.0, 2.0, 3.0); +var m = mat2x2(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl new file mode 100644 index 0000000000..8c1ad0ef94 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl @@ -0,0 +1,2 @@ +var m = mat2x2(vec2(0.0, 1.0), + vec2(2.0, 3.0)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..cb3e1d20c9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..c04960ae18 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %m = OpVariable %_ptr_Private_mat2v2float Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..38d5333d4e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl new file mode 100644 index 0000000000..d1af65f2d1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x2(vec2(0.0h, 1.0h), + vec2(2.0h, 3.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e07b4a16d7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d928439df0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002405AAC7810(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8b22b1971b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2 m = f16mat2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0b6221e46 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 + %10 = OpConstantComposite %mat2v2half %6 %9 +%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half + %m = OpVariable %_ptr_Private_mat2v2half Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..e3a0990137 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x2(vec2(0.0h, 1.0h), vec2(2.0h, 3.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl index f802821326..c592c6c7d4 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x2(vec2(0.0, 1.0), - vec2(2.0, 3.0)); +var m = mat2x2(vec2(0.0, 1.0), + vec2(2.0, 3.0)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..28c5d1f90e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.glsl index f2eeed59ea..cb3e1d20c9 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); +mat2 m = mat2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index c2e0d31160..0000000000 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.msl index b62a321cb2..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x2 m = float2x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.spvasm index 16c63452ff..c04960ae18 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 17 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,16 +12,18 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat2v2float = OpTypeMatrix %v2float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 - %m = OpConstantComposite %mat2v2float %6 %9 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %m = OpVariable %_ptr_Private_mat2v2float Private %10 %void = OpTypeVoid - %11 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %11 - %14 = OpLabel + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.wgsl index 9a1f4c6dc8..48f4288f53 100644 --- a/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x2/inferred/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0)); +var m = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0)); diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl new file mode 100644 index 0000000000..32f74973ed --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +fn f() { + var m = mat2x2(); + let m_1 = mat2x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2d8ecf1219 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + const matrix m_1 = matrix(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..950ec5e9a0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + const matrix m_1 = matrix(m); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001826FCF69C0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001826FCF69C0(8,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..d9cb0c72c0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat2 m = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat2 m_1 = f16mat2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.msl new file mode 100644 index 0000000000..e751fe80a7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + half2x2 m = half2x2(half2(0.0h), half2(0.0h)); + half2x2 const m_1 = half2x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..361a44bb6d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %10 = OpConstantNull %mat2v2half +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2half Function %10 + OpStore %m %10 + %14 = OpLoad %mat2v2half %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..1744993a28 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f16.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +fn f() { + var m = mat2x2(); + let m_1 = mat2x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl new file mode 100644 index 0000000000..0d79135445 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat2x2(); + let m_1 = mat2x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b737fd29e7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x2 m = float2x2((0.0f).xx, (0.0f).xx); + const float2x2 m_1 = float2x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b737fd29e7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x2 m = float2x2((0.0f).xx, (0.0f).xx); + const float2x2 m_1 = float2x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..ee78c72e8f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + mat2 m = mat2(vec2(0.0f), vec2(0.0f)); + mat2 m_1 = mat2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.msl new file mode 100644 index 0000000000..091d06ab21 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + float2x2 m = float2x2(float2(0.0f), float2(0.0f)); + float2x2 const m_1 = float2x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..853903c4dd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %10 = OpConstantNull %mat2v2float +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function %10 + OpStore %m %10 + %14 = OpLoad %mat2v2float %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a7b8f431c2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/load/f32.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat2x2(); + let m_1 = mat2x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl new file mode 100644 index 0000000000..7f54a51db5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var m = mat2x2(); diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ce399c0ac3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..33b620265d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002A75BF02D20(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..be0493d8f2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2 m = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..094ad885df --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %4 = OpConstantNull %mat2v2half +%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half + %m = OpVariable %_ptr_Private_mat2v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..efb9304969 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x2(); diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl new file mode 100644 index 0000000000..8f77ea2b6e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl @@ -0,0 +1 @@ +var m = mat2x2(); diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1140175688 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2((0.0f).xx, (0.0f).xx); diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1140175688 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 m = float2x2((0.0f).xx, (0.0f).xx); diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..bd82c138e5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 m = mat2(vec2(0.0f), vec2(0.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd2602abb4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %4 = OpConstantNull %mat2v2float +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %m = OpVariable %_ptr_Private_mat2v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f77ea2b6e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x2/zero/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat2x2(); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl new file mode 100644 index 0000000000..f1e6ea4221 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +var m = mat2x3(mat2x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h)); + +fn f() -> mat2x3 { + let m_1 = mat2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18ec1c61ee --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..691260de5d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000190AE6414C0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..03af3462b3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf)); +f16mat2x3 f() { + f16mat2x3 m_1 = f16mat2x3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..30f8cc70b5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half2x3 f() { + thread half2x3 tint_symbol = half2x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h)); + half2x3 const m_1 = half2x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..13b1d5cf7b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 + %12 = OpConstantComposite %mat2v3half %7 %11 +%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half + %m = OpVariable %_ptr_Private_mat2v3half Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %19 = OpTypeFunction %mat2v3half +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v3half None %19 + %21 = OpLabel + %23 = OpLoad %mat2v3half %m + OpReturnValue %23 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f147705d7e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat2x3(mat2x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h)); + +fn f() -> mat2x3 { + let m_1 = mat2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl new file mode 100644 index 0000000000..2c63c91d2f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl @@ -0,0 +1,7 @@ +var m = mat2x3(mat2x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f)); + +fn f() -> mat2x3 { + let m_1 = mat2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4fee3744cd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); + +float2x3 f() { + const float2x3 m_1 = float2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4fee3744cd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); + +float2x3 f() { + const float2x3 m_1 = float2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..03da8f60b0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); +mat2x3 f() { + mat2x3 m_1 = mat2x3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..03b6fd7c8e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float2x3 f() { + thread float2x3 tint_symbol = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); + float2x3 const m_1 = float2x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c235ee3b2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %m = OpVariable %_ptr_Private_mat2v3float Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %19 = OpTypeFunction %mat2v3float +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v3float None %19 + %21 = OpLabel + %23 = OpLoad %mat2v3float %m + OpReturnValue %23 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e934f8332e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat2x3(mat2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f)); + +fn f() -> mat2x3 { + let m_1 = mat2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl new file mode 100644 index 0000000000..0faefd9a24 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aafd9d1104 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cdc284cd8a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002078D6517E0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9986763d42 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b54bc343c9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 + %12 = OpConstantComposite %mat2v3half %7 %11 +%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half + %m = OpVariable %_ptr_Private_mat2v3half Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..41b5bcca00 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl index 9b605ccb1c..eb4e496b06 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x3(0.0, 1.0, 2.0, - 3.0, 4.0, 5.0); +var m = mat2x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.glsl index ea329c5a88..275e22bc4b 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2x3 m = mat2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); +mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index adc216fdb4..0000000000 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x3 m = float2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.msl index 443c61f166..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.spvasm index d99921cf67..578716d4c1 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 19 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,18 +12,20 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat2v3float = OpTypeMatrix %v3float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 - %m = OpConstantComposite %mat2v3float %7 %11 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %m = OpVariable %_ptr_Private_mat2v3float Private %12 %void = OpTypeVoid - %13 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %13 - %16 = OpLabel + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.wgsl index 9af09937aa..a886d0995b 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0); +var m = mat2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl new file mode 100644 index 0000000000..969a0344d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x3(vec3(0.0h, 1.0h, 2.0h), + vec3(3.0h, 4.0h, 5.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aafd9d1104 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d0856647f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023F007541A0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9986763d42 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b54bc343c9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 + %12 = OpConstantComposite %mat2v3half %7 %11 +%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half + %m = OpVariable %_ptr_Private_mat2v3half Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef3117888e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x3(vec3(0.0h, 1.0h, 2.0h), vec3(3.0h, 4.0h, 5.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl index ffa6470f42..2439d6d752 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x3(vec3(0.0, 1.0, 2.0), - vec3(3.0, 4.0, 5.0)); +var m = mat2x3(vec3(0.0f, 1.0f, 2.0f), + vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.glsl index 919400a470..275e22bc4b 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); +mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index fb12d01088..0000000000 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl index 443c61f166..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm index d99921cf67..578716d4c1 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 19 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,18 +12,20 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat2v3float = OpTypeMatrix %v3float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 - %m = OpConstantComposite %mat2v3float %7 %11 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %m = OpVariable %_ptr_Private_mat2v3float Private %12 %void = OpTypeVoid - %13 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %13 - %16 = OpLabel + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl index 2e36381f2f..79d55b3a82 100644 --- a/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x3/explicit/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0)); +var m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl new file mode 100644 index 0000000000..3f8ce3256a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +var m = mat2x3(mat2x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h)); + +fn f() -> mat2x3 { + let m_1 = mat2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18ec1c61ee --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..165c82d665 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001871FDC1880(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..03af3462b3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf)); +f16mat2x3 f() { + f16mat2x3 m_1 = f16mat2x3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..30f8cc70b5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half2x3 f() { + thread half2x3 tint_symbol = half2x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h)); + half2x3 const m_1 = half2x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..13b1d5cf7b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 + %12 = OpConstantComposite %mat2v3half %7 %11 +%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half + %m = OpVariable %_ptr_Private_mat2v3half Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %19 = OpTypeFunction %mat2v3half +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v3half None %19 + %21 = OpLabel + %23 = OpLoad %mat2v3half %m + OpReturnValue %23 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..7605c36c7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat2x3(mat2x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h)); + +fn f() -> mat2x3 { + let m_1 = mat2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl new file mode 100644 index 0000000000..6babe00fcd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl @@ -0,0 +1,7 @@ +var m = mat2x3(mat2x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f)); + +fn f() -> mat2x3 { + let m_1 = mat2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4fee3744cd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); + +float2x3 f() { + const float2x3 m_1 = float2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4fee3744cd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); + +float2x3 f() { + const float2x3 m_1 = float2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..03da8f60b0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); +mat2x3 f() { + mat2x3 m_1 = mat2x3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..03b6fd7c8e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float2x3 f() { + thread float2x3 tint_symbol = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); + float2x3 const m_1 = float2x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c235ee3b2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %m = OpVariable %_ptr_Private_mat2v3float Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %19 = OpTypeFunction %mat2v3float +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v3float None %19 + %21 = OpLabel + %23 = OpLoad %mat2v3float %m + OpReturnValue %23 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6cf4e64c1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat2x3(mat2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f)); + +fn f() -> mat2x3 { + let m_1 = mat2x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl new file mode 100644 index 0000000000..c13c5b1eb6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl @@ -0,0 +1,2 @@ +var m = mat2x3(0.0, 1.0, 2.0, + 3.0, 4.0, 5.0); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..275e22bc4b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..578716d4c1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %m = OpVariable %_ptr_Private_mat2v3float Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..2dae43bb79 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat2x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl new file mode 100644 index 0000000000..d2a6bf55d4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aafd9d1104 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a5167c0667 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000020FD5E22900(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9986763d42 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b54bc343c9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 + %12 = OpConstantComposite %mat2v3half %7 %11 +%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half + %m = OpVariable %_ptr_Private_mat2v3half Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f254ff6b30 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl index dc7f65ff3e..79031cb85f 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x3(0.0, 1.0, 2.0, - 3.0, 4.0, 5.0); +var m = mat2x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.glsl index ea329c5a88..275e22bc4b 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2x3 m = mat2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); +mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index adc216fdb4..0000000000 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x3 m = float2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.msl index 443c61f166..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.spvasm index d99921cf67..578716d4c1 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 19 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,18 +12,20 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat2v3float = OpTypeMatrix %v3float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 - %m = OpConstantComposite %mat2v3float %7 %11 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %m = OpVariable %_ptr_Private_mat2v3float Private %12 %void = OpTypeVoid - %13 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %13 - %16 = OpLabel + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.wgsl index 0be516f032..d183723816 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0); +var m = mat2x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl new file mode 100644 index 0000000000..bb589a1c49 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl @@ -0,0 +1,2 @@ +var m = mat2x3(vec3(0.0, 1.0, 2.0), + vec3(3.0, 4.0, 5.0)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..275e22bc4b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..578716d4c1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %m = OpVariable %_ptr_Private_mat2v3float Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..b194c30246 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat2x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl new file mode 100644 index 0000000000..795b6ef806 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x3(vec3(0.0h, 1.0h, 2.0h), + vec3(3.0h, 4.0h, 5.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aafd9d1104 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2b57eed9ca --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000020795733BD0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9986763d42 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x3 m = f16mat2x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b54bc343c9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 + %12 = OpConstantComposite %mat2v3half %7 %11 +%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half + %m = OpVariable %_ptr_Private_mat2v3half Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..9edfbc9662 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x3(vec3(0.0h, 1.0h, 2.0h), vec3(3.0h, 4.0h, 5.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl index 6819a819b6..ab3d40304a 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x3(vec3(0.0, 1.0, 2.0), - vec3(3.0, 4.0, 5.0)); +var m = mat2x3(vec3(0.0f, 1.0f, 2.0f), + vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2d1be771d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.glsl index 919400a470..275e22bc4b 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); +mat2x3 m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index fb12d01088..0000000000 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.msl index 443c61f166..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x3 m = float2x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.spvasm index d99921cf67..578716d4c1 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 19 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,18 +12,20 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat2v3float = OpTypeMatrix %v3float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 - %m = OpConstantComposite %mat2v3float %7 %11 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %m = OpVariable %_ptr_Private_mat2v3float Private %12 %void = OpTypeVoid - %13 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %13 - %16 = OpLabel + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.wgsl index 092445aaf9..709c5a8969 100644 --- a/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x3/inferred/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0)); +var m = mat2x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl new file mode 100644 index 0000000000..836529bddf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +fn f() { + var m = mat2x3(); + let m_1 = mat2x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1dfddbc82a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + const matrix m_1 = matrix(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b8cd076010 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + const matrix m_1 = matrix(m); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000221FD786780(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000221FD786780(8,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..6b72dfa8b9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat2x3 m = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat2x3 m_1 = f16mat2x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.msl new file mode 100644 index 0000000000..27442fa923 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + half2x3 m = half2x3(half3(0.0h), half3(0.0h)); + half2x3 const m_1 = half2x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..c7f050a650 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %10 = OpConstantNull %mat2v3half +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat2v3half Function %10 + OpStore %m %10 + %14 = OpLoad %mat2v3half %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..3774e39c7a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f16.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +fn f() { + var m = mat2x3(); + let m_1 = mat2x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl new file mode 100644 index 0000000000..61ba845f9c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat2x3(); + let m_1 = mat2x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..488b65cddd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx); + const float2x3 m_1 = float2x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..488b65cddd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx); + const float2x3 m_1 = float2x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..a6d4fefcf0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + mat2x3 m = mat2x3(vec3(0.0f), vec3(0.0f)); + mat2x3 m_1 = mat2x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.msl new file mode 100644 index 0000000000..62720d761a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + float2x3 m = float2x3(float3(0.0f), float3(0.0f)); + float2x3 const m_1 = float2x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..7545cbd557 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %10 = OpConstantNull %mat2v3float +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat2v3float Function %10 + OpStore %m %10 + %14 = OpLoad %mat2v3float %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..bdd3075633 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/load/f32.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat2x3(); + let m_1 = mat2x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl new file mode 100644 index 0000000000..2fe4fc8f0b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var m = mat2x3(); diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9a9865bef9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c4d1981ef5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001F06D082D20(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..d98ea56a92 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x3 m = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b417fb40e7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %4 = OpConstantNull %mat2v3half +%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half + %m = OpVariable %_ptr_Private_mat2v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b95f501d5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x3(); diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl new file mode 100644 index 0000000000..e9b1825c78 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl @@ -0,0 +1 @@ +var m = mat2x3(); diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3fe1f11e7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx); diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3fe1f11e7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 m = float2x3((0.0f).xxx, (0.0f).xxx); diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..6d2c8f5745 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x3 m = mat2x3(vec3(0.0f), vec3(0.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ee697139bf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %4 = OpConstantNull %mat2v3float +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %m = OpVariable %_ptr_Private_mat2v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e9b1825c78 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x3/zero/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat2x3(); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl new file mode 100644 index 0000000000..55c21042e2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +var m = mat2x4(mat2x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h)); + +fn f() -> mat2x4 { + let m_1 = mat2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..06dab04359 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d06754f5f1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001926F041BB0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5bafb957b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf)); +f16mat2x4 f() { + f16mat2x4 m_1 = f16mat2x4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..ce986aface --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half2x4 f() { + thread half2x4 tint_symbol = half2x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h)); + half2x4 const m_1 = half2x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..e94c1148f5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 + %14 = OpConstantComposite %mat2v4half %8 %13 +%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half + %m = OpVariable %_ptr_Private_mat2v4half Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %21 = OpTypeFunction %mat2v4half +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v4half None %21 + %23 = OpLabel + %25 = OpLoad %mat2v4half %m + OpReturnValue %25 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..9ba7b468f8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat2x4(mat2x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h)); + +fn f() -> mat2x4 { + let m_1 = mat2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl new file mode 100644 index 0000000000..c8f8bc5549 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl @@ -0,0 +1,7 @@ +var m = mat2x4(mat2x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f)); + +fn f() -> mat2x4 { + let m_1 = mat2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b37e3b77bf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); + +float2x4 f() { + const float2x4 m_1 = float2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b37e3b77bf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); + +float2x4 f() { + const float2x4 m_1 = float2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..06eabf0f26 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); +mat2x4 f() { + mat2x4 m_1 = mat2x4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..63b4e2a0d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float2x4 f() { + thread float2x4 tint_symbol = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); + float2x4 const m_1 = float2x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..6dbb4cea02 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %m = OpVariable %_ptr_Private_mat2v4float Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %21 = OpTypeFunction %mat2v4float +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v4float None %21 + %23 = OpLabel + %25 = OpLoad %mat2v4float %m + OpReturnValue %25 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..476ed2cce0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat2x4(mat2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f)); + +fn f() -> mat2x4 { + let m_1 = mat2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl new file mode 100644 index 0000000000..3dbdba0244 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9fb8b2c782 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dff0490d21 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001F7AAA504B0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a4b80ad643 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a816002e14 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 + %14 = OpConstantComposite %mat2v4half %8 %13 +%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half + %m = OpVariable %_ptr_Private_mat2v4half Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f49129917 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl index e258e63b11..a65308ee5a 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x4(0.0, 1.0, 2.0, 3.0, - 4.0, 5.0, 6.0, 7.0); +var m = mat2x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.glsl index 6ee3601c95..15a453537c 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2x4 m = mat2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); +mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 7bcde853ec..0000000000 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x4 m = float2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.msl index b309bde1e4..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.spvasm index 57110c528c..c97b583900 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,20 +12,22 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 %float_7 = OpConstant %float 7 %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 - %m = OpConstantComposite %mat2v4float %8 %13 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %m = OpVariable %_ptr_Private_mat2v4float Private %14 %void = OpTypeVoid - %15 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %15 - %18 = OpLabel + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.wgsl index 9ceabf7f2b..0eea600cec 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); +var m = mat2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl new file mode 100644 index 0000000000..2c00ec6d05 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), + vec4(4.0h, 5.0h, 6.0h, 7.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9fb8b2c782 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..12f8c04602 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000020136922A40(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a4b80ad643 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a816002e14 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 + %14 = OpConstantComposite %mat2v4half %8 %13 +%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half + %m = OpVariable %_ptr_Private_mat2v4half Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..6f791d54d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), vec4(4.0h, 5.0h, 6.0h, 7.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl index 0a9b59a213..00a8d119a1 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0), - vec4(4.0, 5.0, 6.0, 7.0)); +var m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), + vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.glsl index 461bebd73a..15a453537c 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); +mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 5ed2b1bb39..0000000000 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl index b309bde1e4..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm index 57110c528c..c97b583900 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,20 +12,22 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 %float_7 = OpConstant %float 7 %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 - %m = OpConstantComposite %mat2v4float %8 %13 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %m = OpVariable %_ptr_Private_mat2v4float Private %14 %void = OpTypeVoid - %15 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %15 - %18 = OpLabel + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl index a3a8fd3ab8..760becb0d3 100644 --- a/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x4/explicit/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0)); +var m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl new file mode 100644 index 0000000000..c0811f6664 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +var m = mat2x4(mat2x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h)); + +fn f() -> mat2x4 { + let m_1 = mat2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..06dab04359 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5c3cd1d395 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000171282B1C50(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5bafb957b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf)); +f16mat2x4 f() { + f16mat2x4 m_1 = f16mat2x4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..ce986aface --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half2x4 f() { + thread half2x4 tint_symbol = half2x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h)); + half2x4 const m_1 = half2x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..e94c1148f5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 + %14 = OpConstantComposite %mat2v4half %8 %13 +%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half + %m = OpVariable %_ptr_Private_mat2v4half Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %21 = OpTypeFunction %mat2v4half +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v4half None %21 + %23 = OpLabel + %25 = OpLoad %mat2v4half %m + OpReturnValue %25 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..31b87919fb --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat2x4(mat2x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h)); + +fn f() -> mat2x4 { + let m_1 = mat2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl new file mode 100644 index 0000000000..345e097d4e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl @@ -0,0 +1,7 @@ +var m = mat2x4(mat2x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f)); + +fn f() -> mat2x4 { + let m_1 = mat2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b37e3b77bf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); + +float2x4 f() { + const float2x4 m_1 = float2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b37e3b77bf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); + +float2x4 f() { + const float2x4 m_1 = float2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..06eabf0f26 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); +mat2x4 f() { + mat2x4 m_1 = mat2x4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..63b4e2a0d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float2x4 f() { + thread float2x4 tint_symbol = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); + float2x4 const m_1 = float2x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..6dbb4cea02 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %m = OpVariable %_ptr_Private_mat2v4float Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %21 = OpTypeFunction %mat2v4float +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat2v4float None %21 + %23 = OpLabel + %25 = OpLoad %mat2v4float %m + OpReturnValue %25 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e388e1afb --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat2x4(mat2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f)); + +fn f() -> mat2x4 { + let m_1 = mat2x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl new file mode 100644 index 0000000000..0fb3201d78 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl @@ -0,0 +1,2 @@ +var m = mat2x4(0.0, 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, 7.0); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..15a453537c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..c97b583900 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %m = OpVariable %_ptr_Private_mat2v4float Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..7103b47df7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat2x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl new file mode 100644 index 0000000000..d66ba4d80b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9fb8b2c782 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11dc3ce551 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000022AEBBF0410(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a4b80ad643 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a816002e14 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 + %14 = OpConstantComposite %mat2v4half %8 %13 +%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half + %m = OpVariable %_ptr_Private_mat2v4half Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..6d7353bab0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl index 81abe9f668..ea9a9c4bbd 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x4(0.0, 1.0, 2.0, 3.0, - 4.0, 5.0, 6.0, 7.0); +var m = mat2x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.glsl index 6ee3601c95..15a453537c 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2x4 m = mat2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); +mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 7bcde853ec..0000000000 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x4 m = float2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.msl index b309bde1e4..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.spvasm index 57110c528c..c97b583900 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,20 +12,22 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 %float_7 = OpConstant %float 7 %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 - %m = OpConstantComposite %mat2v4float %8 %13 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %m = OpVariable %_ptr_Private_mat2v4float Private %14 %void = OpTypeVoid - %15 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %15 - %18 = OpLabel + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.wgsl index bcb4dfe908..7e04fcf835 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); +var m = mat2x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl new file mode 100644 index 0000000000..db96125a40 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl @@ -0,0 +1,2 @@ +var m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0), + vec4(4.0, 5.0, 6.0, 7.0)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..15a453537c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..c97b583900 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %m = OpVariable %_ptr_Private_mat2v4float Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..7f64fdb575 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl new file mode 100644 index 0000000000..d6d5547a2e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var m = mat2x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), + vec4(4.0h, 5.0h, 6.0h, 7.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9fb8b2c782 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e3e5366fab --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000016AAA603900(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a4b80ad643 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x4 m = f16mat2x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a816002e14 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 + %14 = OpConstantComposite %mat2v4half %8 %13 +%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half + %m = OpVariable %_ptr_Private_mat2v4half Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..4c61cd099d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), vec4(4.0h, 5.0h, 6.0h, 7.0h)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl index c57c2ed3bd..946f9ad8ac 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl @@ -1,2 +1,2 @@ -let m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0), - vec4(4.0, 5.0, 6.0, 7.0)); +var m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), + vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f63f53176 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.glsl index 461bebd73a..15a453537c 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); +mat2x4 m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 5ed2b1bb39..0000000000 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.msl index b309bde1e4..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2x4 m = float2x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f)); - diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.spvasm index 57110c528c..c97b583900 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,20 +12,22 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 %float_7 = OpConstant %float 7 %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 - %m = OpConstantComposite %mat2v4float %8 %13 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %m = OpVariable %_ptr_Private_mat2v4float Private %14 %void = OpTypeVoid - %15 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %15 - %18 = OpLabel + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.wgsl index f6335df52a..5e4e09ad8f 100644 --- a/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat2x4/inferred/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat2x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0)); +var m = mat2x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl new file mode 100644 index 0000000000..6cbe666eff --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +fn f() { + var m = mat2x4(); + let m_1 = mat2x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47aedf9190 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + const matrix m_1 = matrix(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0fd2b27ab8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + const matrix m_1 = matrix(m); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DD62E069C0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DD62E069C0(8,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..716fbaf728 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat2x4 m = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat2x4 m_1 = f16mat2x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.msl new file mode 100644 index 0000000000..0e7df1df1c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + half2x4 m = half2x4(half4(0.0h), half4(0.0h)); + half2x4 const m_1 = half2x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b3d7fe05d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %10 = OpConstantNull %mat2v4half +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat2v4half Function %10 + OpStore %m %10 + %14 = OpLoad %mat2v4half %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..9d30a05102 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f16.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +fn f() { + var m = mat2x4(); + let m_1 = mat2x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl new file mode 100644 index 0000000000..a4a11f60c7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat2x4(); + let m_1 = mat2x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..17da42af06 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx); + const float2x4 m_1 = float2x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..17da42af06 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx); + const float2x4 m_1 = float2x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..f05ce0b8bb --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + mat2x4 m = mat2x4(vec4(0.0f), vec4(0.0f)); + mat2x4 m_1 = mat2x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.msl new file mode 100644 index 0000000000..46b147843a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + float2x4 m = float2x4(float4(0.0f), float4(0.0f)); + float2x4 const m_1 = float2x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..121e516016 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %10 = OpConstantNull %mat2v4float +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat2v4float Function %10 + OpStore %m %10 + %14 = OpLoad %mat2v4float %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..0cd645c40a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/load/f32.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat2x4(); + let m_1 = mat2x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl new file mode 100644 index 0000000000..08392d41e5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var m = mat2x4(); diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..acaa3fa14d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3d62e3bae1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000028156C54E00(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4d4c48cc89 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x4 m = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf)); diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..175bb390d4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %4 = OpConstantNull %mat2v4half +%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half + %m = OpVariable %_ptr_Private_mat2v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec878ca104 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat2x4(); diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl new file mode 100644 index 0000000000..f9c67c829a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl @@ -0,0 +1 @@ +var m = mat2x4(); diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aaeb1e05f7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx); diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aaeb1e05f7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 m = float2x4((0.0f).xxxx, (0.0f).xxxx); diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..addaec52d1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x4 m = mat2x4(vec4(0.0f), vec4(0.0f)); diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..edf312f14f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %4 = OpConstantNull %mat2v4float +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %m = OpVariable %_ptr_Private_mat2v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f9c67c829a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat2x4/zero/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat2x4(); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl new file mode 100644 index 0000000000..190d2cc804 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var m = mat3x2(mat3x2(0.0h, 1.0h, + 2.0h, 3.0h, + 4.0h, 5.0h)); + +fn f() -> mat3x2 { + let m_1 = mat3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..097a2cc899 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5c605437b4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001B47F361BB0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..768ba2f246 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf)); +f16mat3x2 f() { + f16mat3x2 m_1 = f16mat3x2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..f9d4d85946 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half3x2 f() { + thread half3x2 tint_symbol = half3x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h)); + half3x2 const m_1 = half3x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..7aa87adc07 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 + %13 = OpConstantComposite %mat3v2half %6 %9 %12 +%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half + %m = OpVariable %_ptr_Private_mat3v2half Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %20 = OpTypeFunction %mat3v2half +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v2half None %20 + %22 = OpLabel + %24 = OpLoad %mat3v2half %m + OpReturnValue %24 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..9380d8194f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat3x2(mat3x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h)); + +fn f() -> mat3x2 { + let m_1 = mat3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl new file mode 100644 index 0000000000..53bc3aa633 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl @@ -0,0 +1,8 @@ +var m = mat3x2(mat3x2(0.0f, 1.0f, + 2.0f, 3.0f, + 4.0f, 5.0f)); + +fn f() -> mat3x2 { + let m_1 = mat3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a51b6633e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); + +float3x2 f() { + const float3x2 m_1 = float3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a51b6633e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); + +float3x2 f() { + const float3x2 m_1 = float3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..076d42483d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); +mat3x2 f() { + mat3x2 m_1 = mat3x2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..41fb71ebba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float3x2 f() { + thread float3x2 tint_symbol = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); + float3x2 const m_1 = float3x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c46731f20 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %12 = OpConstantComposite %v2float %float_4 %float_5 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %m = OpVariable %_ptr_Private_mat3v2float Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %20 = OpTypeFunction %mat3v2float +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v2float None %20 + %22 = OpLabel + %24 = OpLoad %mat3v2float %m + OpReturnValue %24 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..1be72c65ec --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat3x2(mat3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f)); + +fn f() -> mat3x2 { + let m_1 = mat3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl new file mode 100644 index 0000000000..868bb41295 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x2(0.0h, 1.0h, + 2.0h, 3.0h, + 4.0h, 5.0h); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab80f0745a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cdfa8eadc2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FF8A2507D0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f33f3631c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f04bca4521 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 + %13 = OpConstantComposite %mat3v2half %6 %9 %12 +%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half + %m = OpVariable %_ptr_Private_mat3v2half Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..75f2d01920 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl index 67b5b1914d..e724832eed 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x2(0.0, 1.0, - 2.0, 3.0, - 4.0, 5.0); +var m = mat3x2(0.0f, 1.0f, + 2.0f, 3.0f, + 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.glsl index ee6b9c0c34..3df809bb93 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3x2 m = mat3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); +mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 32160adcad..0000000000 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x2 m = float3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.msl index ae7f33c2da..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.spvasm index ffaa504ab7..cfc645fbcc 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 18 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,19 +12,21 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat3v2float = OpTypeMatrix %v2float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %12 = OpConstantComposite %v2float %float_4 %float_5 - %m = OpConstantComposite %mat3v2float %6 %9 %12 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %m = OpVariable %_ptr_Private_mat3v2float Private %13 %void = OpTypeVoid - %14 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %14 - %17 = OpLabel + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.wgsl index 2be115ead5..14bc7c9ce3 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0); +var m = mat3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl new file mode 100644 index 0000000000..436037e60f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x2(vec2(0.0h, 1.0h), + vec2(2.0h, 3.0h), + vec2(4.0h, 5.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab80f0745a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b5c0e7e66d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000020D8E7A4940(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f33f3631c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f04bca4521 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 + %13 = OpConstantComposite %mat3v2half %6 %9 %12 +%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half + %m = OpVariable %_ptr_Private_mat3v2half Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..d10b8594f1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x2(vec2(0.0h, 1.0h), vec2(2.0h, 3.0h), vec2(4.0h, 5.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl index 2afe85b7d0..9abe9948d9 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x2(vec2(0.0, 1.0), - vec2(2.0, 3.0), - vec2(4.0, 5.0)); +var m = mat3x2(vec2(0.0f, 1.0f), + vec2(2.0f, 3.0f), + vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.glsl index 1447967e95..3df809bb93 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); +mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 27568edf53..0000000000 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl index ae7f33c2da..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm index ffaa504ab7..cfc645fbcc 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 18 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,19 +12,21 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat3v2float = OpTypeMatrix %v2float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %12 = OpConstantComposite %v2float %float_4 %float_5 - %m = OpConstantComposite %mat3v2float %6 %9 %12 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %m = OpVariable %_ptr_Private_mat3v2float Private %13 %void = OpTypeVoid - %14 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %14 - %17 = OpLabel + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl index 23a270ec14..6e2dea94b5 100644 --- a/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x2/explicit/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0)); +var m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl new file mode 100644 index 0000000000..a48d81b142 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var m = mat3x2(mat3x2(0.0h, 1.0h, + 2.0h, 3.0h, + 4.0h, 5.0h)); + +fn f() -> mat3x2 { + let m_1 = mat3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..097a2cc899 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21dba902d2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DBAE481200(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..768ba2f246 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf)); +f16mat3x2 f() { + f16mat3x2 m_1 = f16mat3x2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..f9d4d85946 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half3x2 f() { + thread half3x2 tint_symbol = half3x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h)); + half3x2 const m_1 = half3x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..7aa87adc07 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 + %13 = OpConstantComposite %mat3v2half %6 %9 %12 +%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half + %m = OpVariable %_ptr_Private_mat3v2half Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %20 = OpTypeFunction %mat3v2half +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v2half None %20 + %22 = OpLabel + %24 = OpLoad %mat3v2half %m + OpReturnValue %24 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..dfdd0a4ef2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat3x2(mat3x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h)); + +fn f() -> mat3x2 { + let m_1 = mat3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl new file mode 100644 index 0000000000..73d3fd1f5b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl @@ -0,0 +1,8 @@ +var m = mat3x2(mat3x2(0.0f, 1.0f, + 2.0f, 3.0f, + 4.0f, 5.0f)); + +fn f() -> mat3x2 { + let m_1 = mat3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a51b6633e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); + +float3x2 f() { + const float3x2 m_1 = float3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a51b6633e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); + +float3x2 f() { + const float3x2 m_1 = float3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..076d42483d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); +mat3x2 f() { + mat3x2 m_1 = mat3x2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..41fb71ebba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float3x2 f() { + thread float3x2 tint_symbol = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); + float3x2 const m_1 = float3x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c46731f20 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %12 = OpConstantComposite %v2float %float_4 %float_5 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %m = OpVariable %_ptr_Private_mat3v2float Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %20 = OpTypeFunction %mat3v2float +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v2float None %20 + %22 = OpLabel + %24 = OpLoad %mat3v2float %m + OpReturnValue %24 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc65cbb191 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat3x2(mat3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f)); + +fn f() -> mat3x2 { + let m_1 = mat3x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl new file mode 100644 index 0000000000..9507f0e196 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl @@ -0,0 +1,3 @@ +var m = mat3x2(0.0, 1.0, + 2.0, 3.0, + 4.0, 5.0); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..3df809bb93 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfc645fbcc --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %12 = OpConstantComposite %v2float %float_4 %float_5 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %m = OpVariable %_ptr_Private_mat3v2float Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..28d39157bb --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat3x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl new file mode 100644 index 0000000000..e5faa670d5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x2(0.0h, 1.0h, + 2.0h, 3.0h, + 4.0h, 5.0h); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab80f0745a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a2478eb8fe --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000224423219B0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f33f3631c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f04bca4521 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 + %13 = OpConstantComposite %mat3v2half %6 %9 %12 +%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half + %m = OpVariable %_ptr_Private_mat3v2half Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca1eccf777 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl index 6fbe3b8504..e5f9de67f3 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x2(0.0, 1.0, - 2.0, 3.0, - 4.0, 5.0); +var m = mat3x2(0.0f, 1.0f, + 2.0f, 3.0f, + 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.glsl index ee6b9c0c34..3df809bb93 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3x2 m = mat3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); +mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 32160adcad..0000000000 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x2 m = float3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.msl index ae7f33c2da..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.spvasm index ffaa504ab7..cfc645fbcc 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 18 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,19 +12,21 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat3v2float = OpTypeMatrix %v2float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %12 = OpConstantComposite %v2float %float_4 %float_5 - %m = OpConstantComposite %mat3v2float %6 %9 %12 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %m = OpVariable %_ptr_Private_mat3v2float Private %13 %void = OpTypeVoid - %14 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %14 - %17 = OpLabel + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.wgsl index 4d48f5936f..045b91db45 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0); +var m = mat3x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl new file mode 100644 index 0000000000..bb7736253a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl @@ -0,0 +1,3 @@ +var m = mat3x2(vec2(0.0, 1.0), + vec2(2.0, 3.0), + vec2(4.0, 5.0)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..3df809bb93 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfc645fbcc --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %12 = OpConstantComposite %v2float %float_4 %float_5 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %m = OpVariable %_ptr_Private_mat3v2float Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..4cb423621b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat3x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl new file mode 100644 index 0000000000..b37674a9dd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x2(vec2(0.0h, 1.0h), + vec2(2.0h, 3.0h), + vec2(4.0h, 5.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab80f0745a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..afd8a43513 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000016648824340(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f33f3631c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x2 m = f16mat3x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f04bca4521 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 + %13 = OpConstantComposite %mat3v2half %6 %9 %12 +%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half + %m = OpVariable %_ptr_Private_mat3v2half Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..42a3882a44 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x2(vec2(0.0h, 1.0h), vec2(2.0h, 3.0h), vec2(4.0h, 5.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl index d9950cad64..029a9b0252 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x2(vec2(0.0, 1.0), - vec2(2.0, 3.0), - vec2(4.0, 5.0)); +var m = mat3x2(vec2(0.0f, 1.0f), + vec2(2.0f, 3.0f), + vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c86bed2b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.glsl index 1447967e95..3df809bb93 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); +mat3x2 m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 27568edf53..0000000000 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.msl index ae7f33c2da..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x2 m = float3x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.spvasm index ffaa504ab7..cfc645fbcc 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 18 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,19 +12,21 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat3v2float = OpTypeMatrix %v2float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %12 = OpConstantComposite %v2float %float_4 %float_5 - %m = OpConstantComposite %mat3v2float %6 %9 %12 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %m = OpVariable %_ptr_Private_mat3v2float Private %13 %void = OpTypeVoid - %14 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %14 - %17 = OpLabel + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.wgsl index 70fc4e69a3..d813053a0e 100644 --- a/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x2/inferred/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0)); +var m = mat3x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl new file mode 100644 index 0000000000..5055c8f6fb --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +fn f() { + var m = mat3x2(); + let m_1 = mat3x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..54c737dd2b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + const matrix m_1 = matrix(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b7926226c3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + const matrix m_1 = matrix(m); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023975DC6E10(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023975DC6E10(8,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..eb943c045a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat3x2 m = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat3x2 m_1 = f16mat3x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.msl new file mode 100644 index 0000000000..a4a5b4e89e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + half3x2 m = half3x2(half2(0.0h), half2(0.0h), half2(0.0h)); + half3x2 const m_1 = half3x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..3112cc75cc --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %10 = OpConstantNull %mat3v2half +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat3v2half Function %10 + OpStore %m %10 + %14 = OpLoad %mat3v2half %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..aa1e690d80 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f16.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +fn f() { + var m = mat3x2(); + let m_1 = mat3x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl new file mode 100644 index 0000000000..07073d9962 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat3x2(); + let m_1 = mat3x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ea45e8659 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx); + const float3x2 m_1 = float3x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ea45e8659 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx); + const float3x2 m_1 = float3x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..018f1f2c88 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + mat3x2 m = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); + mat3x2 m_1 = mat3x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.msl new file mode 100644 index 0000000000..b27479c04c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + float3x2 m = float3x2(float2(0.0f), float2(0.0f), float2(0.0f)); + float3x2 const m_1 = float3x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..6e73ae367a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %10 = OpConstantNull %mat3v2float +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat3v2float Function %10 + OpStore %m %10 + %14 = OpLoad %mat3v2float %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..03b321318c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/load/f32.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat3x2(); + let m_1 = mat3x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl new file mode 100644 index 0000000000..b1a48ac0a1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var m = mat3x2(); diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b04e700213 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d08a30ca07 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DBA4A93F60(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..284ed0450d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x2 m = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..679a4b2c92 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %4 = OpConstantNull %mat3v2half +%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half + %m = OpVariable %_ptr_Private_mat3v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0da4464e01 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x2(); diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl new file mode 100644 index 0000000000..817cb6cf92 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl @@ -0,0 +1 @@ +var m = mat3x2(); diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b279d96690 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx); diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b279d96690 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 m = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx); diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..809c79a3f2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x2 m = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e4bc4d5a81 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %4 = OpConstantNull %mat3v2float +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %m = OpVariable %_ptr_Private_mat3v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..817cb6cf92 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x2/zero/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat3x2(); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl new file mode 100644 index 0000000000..ed2caebf9a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var m = mat3x3(mat3x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h, + 6.0h, 7.0h, 8.0h)); + +fn f() -> mat3x3 { + let m_1 = mat3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a80d0d72da --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..542169b5b4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001A5119D1200(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..e2dc0e229d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf)); +f16mat3 f() { + f16mat3 m_1 = f16mat3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..0e09b51cfe --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half3x3 f() { + thread half3x3 tint_symbol = half3x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h)); + half3x3 const m_1 = half3x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b72423e67a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %16 = OpConstantComposite %mat3v3half %7 %11 %15 +%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half + %m = OpVariable %_ptr_Private_mat3v3half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %23 = OpTypeFunction %mat3v3half +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v3half None %23 + %25 = OpLabel + %27 = OpLoad %mat3v3half %m + OpReturnValue %27 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..d6147b91b4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat3x3(mat3x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h)); + +fn f() -> mat3x3 { + let m_1 = mat3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl new file mode 100644 index 0000000000..f3b62f5c56 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl @@ -0,0 +1,8 @@ +var m = mat3x3(mat3x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f, + 6.0f, 7.0f, 8.0f)); + +fn f() -> mat3x3 { + let m_1 = mat3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2d4c4b28c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); + +float3x3 f() { + const float3x3 m_1 = float3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d4c4b28c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); + +float3x3 f() { + const float3x3 m_1 = float3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..6bb27b8702 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); +mat3 f() { + mat3 m_1 = mat3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..d19a026f19 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float3x3 f() { + thread float3x3 tint_symbol = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); + float3x3 const m_1 = float3x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4fe3bbd59d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %m = OpVariable %_ptr_Private_mat3v3float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %23 = OpTypeFunction %mat3v3float +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v3float None %23 + %25 = OpLabel + %27 = OpLoad %mat3v3float %m + OpReturnValue %27 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..028783d3b4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat3x3(mat3x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f)); + +fn f() -> mat3x3 { + let m_1 = mat3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl new file mode 100644 index 0000000000..97694e287b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h, + 6.0h, 7.0h, 8.0h); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1405c1655b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66db7ff492 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000018E245E0610(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1a90ddb96d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..891215c3d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %16 = OpConstantComposite %mat3v3half %7 %11 %15 +%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half + %m = OpVariable %_ptr_Private_mat3v3half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..abe3dbeeba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl index b6a5ce10f7..1d80d6947e 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x3(0.0, 1.0, 2.0, - 3.0, 4.0, 5.0, - 6.0, 7.0, 8.0); +var m = mat3x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f, + 6.0f, 7.0f, 8.0f); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.glsl index 0006430145..31b0b4ab12 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3 m = mat3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); +mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 513d8f803e..0000000000 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x3 m = float3x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.msl index 2635df5e2e..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.spvasm index 8ec1da43f0..c0f68aa95a 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,10 +12,10 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 @@ -24,10 +24,12 @@ %float_7 = OpConstant %float 7 %float_8 = OpConstant %float 8 %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 - %m = OpConstantComposite %mat3v3float %7 %11 %15 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %m = OpVariable %_ptr_Private_mat3v3float Private %16 %void = OpTypeVoid - %17 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %17 - %20 = OpLabel + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.wgsl index acd785e24a..d1ef960e80 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); +var m = mat3x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl new file mode 100644 index 0000000000..3afadc1d5a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x3(vec3(0.0h, 1.0h, 2.0h), + vec3(3.0h, 4.0h, 5.0h), + vec3(6.0h, 7.0h, 8.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1405c1655b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5e5a8688b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000234598D4A60(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1a90ddb96d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..891215c3d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %16 = OpConstantComposite %mat3v3half %7 %11 %15 +%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half + %m = OpVariable %_ptr_Private_mat3v3half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..9008bed9ba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x3(vec3(0.0h, 1.0h, 2.0h), vec3(3.0h, 4.0h, 5.0h), vec3(6.0h, 7.0h, 8.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl index fd4d236f38..8a1972e201 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x3(vec3(0.0, 1.0, 2.0), - vec3(3.0, 4.0, 5.0), - vec3(6.0, 7.0, 8.0)); +var m = mat3x3(vec3(0.0f, 1.0f, 2.0f), + vec3(3.0f, 4.0f, 5.0f), + vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.glsl index f4631cb30a..31b0b4ab12 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); +mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index c35ca2af2e..0000000000 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl index 2635df5e2e..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm index 8ec1da43f0..c0f68aa95a 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,10 +12,10 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 @@ -24,10 +24,12 @@ %float_7 = OpConstant %float 7 %float_8 = OpConstant %float 8 %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 - %m = OpConstantComposite %mat3v3float %7 %11 %15 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %m = OpVariable %_ptr_Private_mat3v3float Private %16 %void = OpTypeVoid - %17 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %17 - %20 = OpLabel + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl index 9a9a20f64a..914a6a7e76 100644 --- a/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x3/explicit/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0)); +var m = mat3x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl new file mode 100644 index 0000000000..8e269f5e70 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var m = mat3x3(mat3x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h, + 6.0h, 7.0h, 8.0h)); + +fn f() -> mat3x3 { + let m_1 = mat3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a80d0d72da --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43b833c0ef --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000020E313B2780(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..e2dc0e229d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf)); +f16mat3 f() { + f16mat3 m_1 = f16mat3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..0e09b51cfe --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half3x3 f() { + thread half3x3 tint_symbol = half3x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h)); + half3x3 const m_1 = half3x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b72423e67a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %16 = OpConstantComposite %mat3v3half %7 %11 %15 +%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half + %m = OpVariable %_ptr_Private_mat3v3half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %23 = OpTypeFunction %mat3v3half +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v3half None %23 + %25 = OpLabel + %27 = OpLoad %mat3v3half %m + OpReturnValue %27 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a93d332988 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat3x3(mat3x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h)); + +fn f() -> mat3x3 { + let m_1 = mat3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl new file mode 100644 index 0000000000..b06cadc493 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl @@ -0,0 +1,8 @@ +var m = mat3x3(mat3x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f, + 6.0f, 7.0f, 8.0f)); + +fn f() -> mat3x3 { + let m_1 = mat3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2d4c4b28c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); + +float3x3 f() { + const float3x3 m_1 = float3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d4c4b28c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); + +float3x3 f() { + const float3x3 m_1 = float3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..6bb27b8702 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); +mat3 f() { + mat3 m_1 = mat3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..d19a026f19 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float3x3 f() { + thread float3x3 tint_symbol = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); + float3x3 const m_1 = float3x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4fe3bbd59d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %m = OpVariable %_ptr_Private_mat3v3float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %23 = OpTypeFunction %mat3v3float +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v3float None %23 + %25 = OpLabel + %27 = OpLoad %mat3v3float %m + OpReturnValue %27 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..03f3cd0934 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat3x3(mat3x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f)); + +fn f() -> mat3x3 { + let m_1 = mat3x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl new file mode 100644 index 0000000000..cfb9789423 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl @@ -0,0 +1,3 @@ +var m = mat3x3(0.0, 1.0, 2.0, + 3.0, 4.0, 5.0, + 6.0, 7.0, 8.0); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..31b0b4ab12 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..c0f68aa95a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %m = OpVariable %_ptr_Private_mat3v3float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..51e56891d1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat3x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl new file mode 100644 index 0000000000..9a5a98e3e3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h, + 6.0h, 7.0h, 8.0h); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1405c1655b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..afe0f11422 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023EB85117F0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1a90ddb96d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..891215c3d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %16 = OpConstantComposite %mat3v3half %7 %11 %15 +%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half + %m = OpVariable %_ptr_Private_mat3v3half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..21482a9f96 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl index ecdafe7191..84ea539866 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x3(0.0, 1.0, 2.0, - 3.0, 4.0, 5.0, - 6.0, 7.0, 8.0); +var m = mat3x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f, + 6.0f, 7.0f, 8.0f); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.glsl index 0006430145..31b0b4ab12 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3 m = mat3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); +mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 513d8f803e..0000000000 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x3 m = float3x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.msl index 2635df5e2e..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.spvasm index 8ec1da43f0..c0f68aa95a 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,10 +12,10 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 @@ -24,10 +24,12 @@ %float_7 = OpConstant %float 7 %float_8 = OpConstant %float 8 %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 - %m = OpConstantComposite %mat3v3float %7 %11 %15 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %m = OpVariable %_ptr_Private_mat3v3float Private %16 %void = OpTypeVoid - %17 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %17 - %20 = OpLabel + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.wgsl index 18ca6e3c20..ce6bd445e7 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0); +var m = mat3x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl new file mode 100644 index 0000000000..d8fa2b4090 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl @@ -0,0 +1,3 @@ +var m = mat3x3(vec3(0.0, 1.0, 2.0), + vec3(3.0, 4.0, 5.0), + vec3(6.0, 7.0, 8.0)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..31b0b4ab12 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..c0f68aa95a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %m = OpVariable %_ptr_Private_mat3v3float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b34421488 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat3x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl new file mode 100644 index 0000000000..ae24d6995b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x3(vec3(0.0h, 1.0h, 2.0h), + vec3(3.0h, 4.0h, 5.0h), + vec3(6.0h, 7.0h, 8.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1405c1655b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8d008948b8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000023F51A63530(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1a90ddb96d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3 m = f16mat3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..891215c3d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %16 = OpConstantComposite %mat3v3half %7 %11 %15 +%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half + %m = OpVariable %_ptr_Private_mat3v3half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a138f7546c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x3(vec3(0.0h, 1.0h, 2.0h), vec3(3.0h, 4.0h, 5.0h), vec3(6.0h, 7.0h, 8.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl index 5c2b614103..aeff918657 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x3(vec3(0.0, 1.0, 2.0), - vec3(3.0, 4.0, 5.0), - vec3(6.0, 7.0, 8.0)); +var m = mat3x3(vec3(0.0f, 1.0f, 2.0f), + vec3(3.0f, 4.0f, 5.0f), + vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..65b0c98407 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.glsl index f4631cb30a..31b0b4ab12 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); +mat3 m = mat3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index c35ca2af2e..0000000000 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.msl index 2635df5e2e..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x3 m = float3x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.spvasm index 8ec1da43f0..c0f68aa95a 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,10 +12,10 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 @@ -24,10 +24,12 @@ %float_7 = OpConstant %float 7 %float_8 = OpConstant %float 8 %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 - %m = OpConstantComposite %mat3v3float %7 %11 %15 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %m = OpVariable %_ptr_Private_mat3v3float Private %16 %void = OpTypeVoid - %17 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %17 - %20 = OpLabel + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.wgsl index 9fdc4c906e..f9d685ee0c 100644 --- a/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x3/inferred/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0)); +var m = mat3x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl new file mode 100644 index 0000000000..e2f1754131 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +fn f() { + var m = mat3x3(); + let m_1 = mat3x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a1b9c34804 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + const matrix m_1 = matrix(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..467728e2e0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + const matrix m_1 = matrix(m); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DD9A7165C0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DD9A7165C0(8,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..85dd0fd7b4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat3 m = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat3 m_1 = f16mat3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.msl new file mode 100644 index 0000000000..a08ddaaf01 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + half3x3 m = half3x3(half3(0.0h), half3(0.0h), half3(0.0h)); + half3x3 const m_1 = half3x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..96f5af4e99 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %10 = OpConstantNull %mat3v3half +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat3v3half Function %10 + OpStore %m %10 + %14 = OpLoad %mat3v3half %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..55ec37b224 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f16.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +fn f() { + var m = mat3x3(); + let m_1 = mat3x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl new file mode 100644 index 0000000000..0fcea297e3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat3x3(); + let m_1 = mat3x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b8f5f60f51 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + const float3x3 m_1 = float3x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b8f5f60f51 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + const float3x3 m_1 = float3x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..640c15188c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + mat3 m = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); + mat3 m_1 = mat3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.msl new file mode 100644 index 0000000000..f7cc4fcb70 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + float3x3 m = float3x3(float3(0.0f), float3(0.0f), float3(0.0f)); + float3x3 const m_1 = float3x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..7d55f41539 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %10 = OpConstantNull %mat3v3float +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat3v3float Function %10 + OpStore %m %10 + %14 = OpLoad %mat3v3float %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c38fae6a2a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/load/f32.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat3x3(); + let m_1 = mat3x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl new file mode 100644 index 0000000000..a1afeefbba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var m = mat3x3(); diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dfbd701689 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..052fa4e83f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000024FC77C3040(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..36df20de50 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3 m = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..523c388b30 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %4 = OpConstantNull %mat3v3half +%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half + %m = OpVariable %_ptr_Private_mat3v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9b1ef330b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x3(); diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl new file mode 100644 index 0000000000..0ecffa30db --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl @@ -0,0 +1 @@ +var m = mat3x3(); diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b96d4e1071 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b96d4e1071 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..421fc2b69a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3 m = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..743b9d42f6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %4 = OpConstantNull %mat3v3float +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %m = OpVariable %_ptr_Private_mat3v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ecffa30db --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x3/zero/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat3x3(); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl new file mode 100644 index 0000000000..bbf1cf6527 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var m = mat3x4(mat3x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h, + 8.0h, 9.0h, 10.0h, 11.0h)); + +fn f() -> mat3x4 { + let m_1 = mat3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3db1f7c154 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd87376e3c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001E9C71C1A50(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..28a0c2ad48 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf)); +f16mat3x4 f() { + f16mat3x4 m_1 = f16mat3x4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..28109d3156 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half3x4 f() { + thread half3x4 tint_symbol = half3x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h)); + half3x4 const m_1 = half3x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..913cbed976 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,49 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %19 = OpConstantComposite %mat3v4half %8 %13 %18 +%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half + %m = OpVariable %_ptr_Private_mat3v4half Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %26 = OpTypeFunction %mat3v4half +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v4half None %26 + %28 = OpLabel + %30 = OpLoad %mat3v4half %m + OpReturnValue %30 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..7cb77d010e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat3x4(mat3x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h)); + +fn f() -> mat3x4 { + let m_1 = mat3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl new file mode 100644 index 0000000000..6997b0ee76 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl @@ -0,0 +1,8 @@ +var m = mat3x4(mat3x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f, + 8.0f, 9.0f, 10.0f, 11.0f)); + +fn f() -> mat3x4 { + let m_1 = mat3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..11e3fe8d54 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); + +float3x4 f() { + const float3x4 m_1 = float3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11e3fe8d54 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); + +float3x4 f() { + const float3x4 m_1 = float3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..cd411382a2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); +mat3x4 f() { + mat3x4 m_1 = mat3x4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..9295b89377 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float3x4 f() { + thread float3x4 tint_symbol = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); + float3x4 const m_1 = float3x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..707e9ce5b8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,45 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %m = OpVariable %_ptr_Private_mat3v4float Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %26 = OpTypeFunction %mat3v4float +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v4float None %26 + %28 = OpLabel + %30 = OpLoad %mat3v4float %m + OpReturnValue %30 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..14caa3e737 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat3x4(mat3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f)); + +fn f() -> mat3x4 { + let m_1 = mat3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl new file mode 100644 index 0000000000..abeb2ab200 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h, + 8.0h, 9.0h, 10.0h, 11.0h); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5a44d3fc87 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1190d108a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001B600294B90(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..af6ad9c801 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..57969444ad --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %19 = OpConstantComposite %mat3v4half %8 %13 %18 +%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half + %m = OpVariable %_ptr_Private_mat3v4half Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b8fc7c8a3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl index 8b1a949a9d..99d896b920 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x4(0.0, 1.0, 2.0, 3.0, - 4.0, 5.0, 6.0, 7.0, - 8.0, 9.0, 10.0, 11.0); +var m = mat3x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f, + 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.glsl index 824c533694..766e72cdd8 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3x4 m = mat3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); +mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index c76e3b85df..0000000000 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x4 m = float3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.msl index 3608220014..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.spvasm index b6ff57d5e3..d29b311ecf 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,11 +12,11 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat3v4float = OpTypeMatrix %v4float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 @@ -27,10 +27,12 @@ %float_10 = OpConstant %float 10 %float_11 = OpConstant %float 11 %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 - %m = OpConstantComposite %mat3v4float %8 %13 %18 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %m = OpVariable %_ptr_Private_mat3v4float Private %19 %void = OpTypeVoid - %20 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %20 - %23 = OpLabel + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.wgsl index 84d2e1f4de..e4268e1f5a 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0); +var m = mat3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl new file mode 100644 index 0000000000..604231ca14 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), + vec4(4.0h, 5.0h, 6.0h, 7.0h), + vec4(8.0h, 9.0h, 10.0h, 11.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5a44d3fc87 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f90763b04b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002007DCE3350(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..af6ad9c801 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..57969444ad --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %19 = OpConstantComposite %mat3v4half %8 %13 %18 +%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half + %m = OpVariable %_ptr_Private_mat3v4half Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f4797d66ce --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), vec4(4.0h, 5.0h, 6.0h, 7.0h), vec4(8.0h, 9.0h, 10.0h, 11.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl index 0551705012..672ac2e95b 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0), - vec4(4.0, 5.0, 6.0, 7.0), - vec4(8.0, 9.0, 10.0, 11.0)); +var m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), + vec4(4.0f, 5.0f, 6.0f, 7.0f), + vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.glsl index 2b8f5786b9..766e72cdd8 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); +mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index fae68dfa2d..0000000000 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl index 3608220014..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm index b6ff57d5e3..d29b311ecf 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,11 +12,11 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat3v4float = OpTypeMatrix %v4float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 @@ -27,10 +27,12 @@ %float_10 = OpConstant %float 10 %float_11 = OpConstant %float 11 %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 - %m = OpConstantComposite %mat3v4float %8 %13 %18 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %m = OpVariable %_ptr_Private_mat3v4float Private %19 %void = OpTypeVoid - %20 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %20 - %23 = OpLabel + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl index 9c51aa682a..8a529c9032 100644 --- a/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x4/explicit/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0)); +var m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl new file mode 100644 index 0000000000..e958d5062f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var m = mat3x4(mat3x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h, + 8.0h, 9.0h, 10.0h, 11.0h)); + +fn f() -> mat3x4 { + let m_1 = mat3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3db1f7c154 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c22fd7cb9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000025B6F661A50(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..28a0c2ad48 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf)); +f16mat3x4 f() { + f16mat3x4 m_1 = f16mat3x4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..28109d3156 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half3x4 f() { + thread half3x4 tint_symbol = half3x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h)); + half3x4 const m_1 = half3x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..913cbed976 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,49 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %19 = OpConstantComposite %mat3v4half %8 %13 %18 +%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half + %m = OpVariable %_ptr_Private_mat3v4half Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %26 = OpTypeFunction %mat3v4half +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v4half None %26 + %28 = OpLabel + %30 = OpLoad %mat3v4half %m + OpReturnValue %30 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a1a2f1617b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat3x4(mat3x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h)); + +fn f() -> mat3x4 { + let m_1 = mat3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl new file mode 100644 index 0000000000..b46182b390 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl @@ -0,0 +1,8 @@ +var m = mat3x4(mat3x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f, + 8.0f, 9.0f, 10.0f, 11.0f)); + +fn f() -> mat3x4 { + let m_1 = mat3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..11e3fe8d54 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); + +float3x4 f() { + const float3x4 m_1 = float3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11e3fe8d54 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); + +float3x4 f() { + const float3x4 m_1 = float3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..cd411382a2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); +mat3x4 f() { + mat3x4 m_1 = mat3x4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..9295b89377 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float3x4 f() { + thread float3x4 tint_symbol = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); + float3x4 const m_1 = float3x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..707e9ce5b8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,45 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %m = OpVariable %_ptr_Private_mat3v4float Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %26 = OpTypeFunction %mat3v4float +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat3v4float None %26 + %28 = OpLabel + %30 = OpLoad %mat3v4float %m + OpReturnValue %30 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..83bb686814 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat3x4(mat3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f)); + +fn f() -> mat3x4 { + let m_1 = mat3x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl new file mode 100644 index 0000000000..ac7c5bde23 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl @@ -0,0 +1,3 @@ +var m = mat3x4(0.0, 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, 7.0, + 8.0, 9.0, 10.0, 11.0); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..766e72cdd8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..d29b311ecf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %m = OpVariable %_ptr_Private_mat3v4float Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..cdc7e44c3b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat3x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl new file mode 100644 index 0000000000..42bafec759 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h, + 8.0h, 9.0h, 10.0h, 11.0h); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5a44d3fc87 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67b9425f75 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000024D56723D80(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..af6ad9c801 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..57969444ad --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %19 = OpConstantComposite %mat3v4half %8 %13 %18 +%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half + %m = OpVariable %_ptr_Private_mat3v4half Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..e578b48d0c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl index cce81618e0..21f4e06102 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x4(0.0, 1.0, 2.0, 3.0, - 4.0, 5.0, 6.0, 7.0, - 8.0, 9.0, 10.0, 11.0); +var m = mat3x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f, + 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.glsl index 824c533694..766e72cdd8 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3x4 m = mat3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); +mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index c76e3b85df..0000000000 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x4 m = float3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.msl index 3608220014..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.spvasm index b6ff57d5e3..d29b311ecf 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,11 +12,11 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat3v4float = OpTypeMatrix %v4float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 @@ -27,10 +27,12 @@ %float_10 = OpConstant %float 10 %float_11 = OpConstant %float 11 %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 - %m = OpConstantComposite %mat3v4float %8 %13 %18 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %m = OpVariable %_ptr_Private_mat3v4float Private %19 %void = OpTypeVoid - %20 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %20 - %23 = OpLabel + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.wgsl index 5fce07ff64..7af29f037f 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0); +var m = mat3x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl new file mode 100644 index 0000000000..0fdc26b243 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl @@ -0,0 +1,3 @@ +var m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0), + vec4(4.0, 5.0, 6.0, 7.0), + vec4(8.0, 9.0, 10.0, 11.0)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..766e72cdd8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..d29b311ecf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %m = OpVariable %_ptr_Private_mat3v4float Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..bec21cf1a0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl new file mode 100644 index 0000000000..59c3ec00a6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var m = mat3x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), + vec4(4.0h, 5.0h, 6.0h, 7.0h), + vec4(8.0h, 9.0h, 10.0h, 11.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5a44d3fc87 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..48da0250e0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000241D6B23CE0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..af6ad9c801 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x4 m = f16mat3x4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..57969444ad --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %19 = OpConstantComposite %mat3v4half %8 %13 %18 +%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half + %m = OpVariable %_ptr_Private_mat3v4half Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..95c3950561 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), vec4(4.0h, 5.0h, 6.0h, 7.0h), vec4(8.0h, 9.0h, 10.0h, 11.0h)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl index eb6fad25a3..7cb7da6399 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl @@ -1,3 +1,3 @@ -let m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0), - vec4(4.0, 5.0, 6.0, 7.0), - vec4(8.0, 9.0, 10.0, 11.0)); +var m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), + vec4(4.0f, 5.0f, 6.0f, 7.0f), + vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b23383ef7d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.glsl index 2b8f5786b9..766e72cdd8 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); +mat3x4 m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index fae68dfa2d..0000000000 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.msl index 3608220014..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3x4 m = float3x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f)); - diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.spvasm index b6ff57d5e3..d29b311ecf 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,11 +12,11 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat3v4float = OpTypeMatrix %v4float 3 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 @@ -27,10 +27,12 @@ %float_10 = OpConstant %float 10 %float_11 = OpConstant %float 11 %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 - %m = OpConstantComposite %mat3v4float %8 %13 %18 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %m = OpVariable %_ptr_Private_mat3v4float Private %19 %void = OpTypeVoid - %20 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %20 - %23 = OpLabel + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.wgsl index 6d3960ee3d..a0c86ae2df 100644 --- a/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat3x4/inferred/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat3x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0)); +var m = mat3x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl new file mode 100644 index 0000000000..338f539336 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +fn f() { + var m = mat3x4(); + let m_1 = mat3x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3e689b4b38 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + const matrix m_1 = matrix(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dc746bf853 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + const matrix m_1 = matrix(m); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001AE930269D0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001AE930269D0(8,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..657d16d571 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat3x4 m = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat3x4 m_1 = f16mat3x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.msl new file mode 100644 index 0000000000..c501e235f3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + half3x4 m = half3x4(half4(0.0h), half4(0.0h), half4(0.0h)); + half3x4 const m_1 = half3x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..ae940640f9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %10 = OpConstantNull %mat3v4half +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat3v4half Function %10 + OpStore %m %10 + %14 = OpLoad %mat3v4half %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b4378411c4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f16.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +fn f() { + var m = mat3x4(); + let m_1 = mat3x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl new file mode 100644 index 0000000000..385ba60995 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat3x4(); + let m_1 = mat3x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0aa5662520 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + const float3x4 m_1 = float3x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0aa5662520 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + const float3x4 m_1 = float3x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..73df09c99e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + mat3x4 m = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f)); + mat3x4 m_1 = mat3x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.msl new file mode 100644 index 0000000000..2dc900ea8e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + float3x4 m = float3x4(float4(0.0f), float4(0.0f), float4(0.0f)); + float3x4 const m_1 = float3x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2ef020679 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %10 = OpConstantNull %mat3v4float +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat3v4float Function %10 + OpStore %m %10 + %14 = OpLoad %mat3v4float %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9d22deaca8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/load/f32.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat3x4(); + let m_1 = mat3x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl new file mode 100644 index 0000000000..425d5b04c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var m = mat3x4(); diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..41130ec570 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31c249b2c7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000020DF1435780(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4d7e4c061c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x4 m = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b3157f6b8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %4 = OpConstantNull %mat3v4half +%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half + %m = OpVariable %_ptr_Private_mat3v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d9490dbd7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat3x4(); diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl new file mode 100644 index 0000000000..6b2bb52cfa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl @@ -0,0 +1 @@ +var m = mat3x4(); diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3f3c45b168 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3f3c45b168 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 m = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..845aed19c2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x4 m = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f)); diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..329a1ab38a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %4 = OpConstantNull %mat3v4float +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %m = OpVariable %_ptr_Private_mat3v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6b2bb52cfa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat3x4/zero/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat3x4(); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl new file mode 100644 index 0000000000..dcc7e57edf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl @@ -0,0 +1,10 @@ +enable f16; +var m = mat4x2(mat4x2(0.0h, 1.0h, + 2.0h, 3.0h, + 4.0h, 5.0h, + 6.0h, 7.0h)); + +fn f() -> mat4x2 { + let m_1 = mat4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..be358f3cd0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9f40df7e8f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000029979253250(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..572fcd04ca --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf)); +f16mat4x2 f() { + f16mat4x2 m_1 = f16mat4x2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..35da177172 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half4x2 f() { + thread half4x2 tint_symbol = half4x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h), half2(6.0h, 7.0h)); + half4x2 const m_1 = half4x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..6bbc56e80f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %15 = OpConstantComposite %v2half %half_0x1_8p_2 %half_0x1_cp_2 + %16 = OpConstantComposite %mat4v2half %6 %9 %12 %15 +%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half + %m = OpVariable %_ptr_Private_mat4v2half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %23 = OpTypeFunction %mat4v2half +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v2half None %23 + %25 = OpLabel + %27 = OpLoad %mat4v2half %m + OpReturnValue %27 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..cdd9ef82d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat4x2(mat4x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h)); + +fn f() -> mat4x2 { + let m_1 = mat4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl new file mode 100644 index 0000000000..d82b3ff796 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl @@ -0,0 +1,9 @@ +var m = mat4x2(mat4x2(0.0f, 1.0f, + 2.0f, 3.0f, + 4.0f, 5.0f, + 6.0f, 7.0f)); + +fn f() -> mat4x2 { + let m_1 = mat4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b957caa4c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); + +float4x2 f() { + const float4x2 m_1 = float4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b957caa4c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); + +float4x2 f() { + const float4x2 m_1 = float4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..e5a475dfcc --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); +mat4x2 f() { + mat4x2 m_1 = mat4x2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..21148953a4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float4x2 f() { + thread float4x2 tint_symbol = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); + float4x2 const m_1 = float4x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..f40139edf8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %12 = OpConstantComposite %v2float %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %15 = OpConstantComposite %v2float %float_6 %float_7 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %23 = OpTypeFunction %mat4v2float +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v2float None %23 + %25 = OpLabel + %27 = OpLoad %mat4v2float %m + OpReturnValue %27 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6eb8cc6f13 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat4x2(mat4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f)); + +fn f() -> mat4x2 { + let m_1 = mat4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl new file mode 100644 index 0000000000..f89ebb990d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x2(0.0h, 1.0h, + 2.0h, 3.0h, + 4.0h, 5.0h, + 6.0h, 7.0h); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d449a86eb4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c697dc9990 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000026AE4660720(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f24340e07d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..282162b895 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %15 = OpConstantComposite %v2half %half_0x1_8p_2 %half_0x1_cp_2 + %16 = OpConstantComposite %mat4v2half %6 %9 %12 %15 +%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half + %m = OpVariable %_ptr_Private_mat4v2half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..2da061a6b2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl index 0148e38439..1332e8557f 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x2(0.0, 1.0, - 2.0, 3.0, - 4.0, 5.0, - 6.0, 7.0); +var m = mat4x2(0.0f, 1.0f, + 2.0f, 3.0f, + 4.0f, 5.0f, + 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.glsl index 864c631eee..2fbbb7e9fe 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4x2 m = mat4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); +mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index de866706ff..0000000000 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x2 m = float4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.msl index 0597230800..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.spvasm index c6a6c63a6e..fd79610037 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,9 +12,9 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat4v2float = OpTypeMatrix %v2float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 @@ -24,10 +24,12 @@ %float_6 = OpConstant %float 6 %float_7 = OpConstant %float 7 %15 = OpConstantComposite %v2float %float_6 %float_7 - %m = OpConstantComposite %mat4v2float %6 %9 %12 %15 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %16 %void = OpTypeVoid - %17 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %17 - %20 = OpLabel + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.wgsl index 5cb1e08bdd..5ca62398bf 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); +var m = mat4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl new file mode 100644 index 0000000000..fa13d77854 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x2(vec2(0.0h, 1.0h), + vec2(2.0h, 3.0h), + vec2(4.0h, 5.0h), + vec2(6.0h, 7.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d449a86eb4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..097db2a46c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000157ECB54590(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f24340e07d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..282162b895 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %15 = OpConstantComposite %v2half %half_0x1_8p_2 %half_0x1_cp_2 + %16 = OpConstantComposite %mat4v2half %6 %9 %12 %15 +%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half + %m = OpVariable %_ptr_Private_mat4v2half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..e97eb296c2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x2(vec2(0.0h, 1.0h), vec2(2.0h, 3.0h), vec2(4.0h, 5.0h), vec2(6.0h, 7.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl index a1a32f807b..74227f4276 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x2(vec2(0.0, 1.0), - vec2(2.0, 3.0), - vec2(4.0, 5.0), - vec2(6.0, 7.0)); +var m = mat4x2(vec2(0.0f, 1.0f), + vec2(2.0f, 3.0f), + vec2(4.0f, 5.0f), + vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.glsl index 93ae98cd4b..2fbbb7e9fe 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); +mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 2acab36b4d..0000000000 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl index 0597230800..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm index c6a6c63a6e..fd79610037 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,9 +12,9 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat4v2float = OpTypeMatrix %v2float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 @@ -24,10 +24,12 @@ %float_6 = OpConstant %float 6 %float_7 = OpConstant %float 7 %15 = OpConstantComposite %v2float %float_6 %float_7 - %m = OpConstantComposite %mat4v2float %6 %9 %12 %15 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %16 %void = OpTypeVoid - %17 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %17 - %20 = OpLabel + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl index dea4919d69..a425e47410 100644 --- a/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x2/explicit/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0), vec2(6.0, 7.0)); +var m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl new file mode 100644 index 0000000000..c3f66f16c3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl @@ -0,0 +1,10 @@ +enable f16; +var m = mat4x2(mat4x2(0.0h, 1.0h, + 2.0h, 3.0h, + 4.0h, 5.0h, + 6.0h, 7.0h)); + +fn f() -> mat4x2 { + let m_1 = mat4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..be358f3cd0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7695ffe74b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001AC29EA1B60(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..572fcd04ca --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf)); +f16mat4x2 f() { + f16mat4x2 m_1 = f16mat4x2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..35da177172 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half4x2 f() { + thread half4x2 tint_symbol = half4x2(half2(0.0h, 1.0h), half2(2.0h, 3.0h), half2(4.0h, 5.0h), half2(6.0h, 7.0h)); + half4x2 const m_1 = half4x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..6bbc56e80f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %15 = OpConstantComposite %v2half %half_0x1_8p_2 %half_0x1_cp_2 + %16 = OpConstantComposite %mat4v2half %6 %9 %12 %15 +%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half + %m = OpVariable %_ptr_Private_mat4v2half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %23 = OpTypeFunction %mat4v2half +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v2half None %23 + %25 = OpLabel + %27 = OpLoad %mat4v2half %m + OpReturnValue %27 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef56f0c653 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat4x2(mat4x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h)); + +fn f() -> mat4x2 { + let m_1 = mat4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl new file mode 100644 index 0000000000..70ea4dfe6e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl @@ -0,0 +1,9 @@ +var m = mat4x2(mat4x2(0.0f, 1.0f, + 2.0f, 3.0f, + 4.0f, 5.0f, + 6.0f, 7.0f)); + +fn f() -> mat4x2 { + let m_1 = mat4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b957caa4c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); + +float4x2 f() { + const float4x2 m_1 = float4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b957caa4c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); + +float4x2 f() { + const float4x2 m_1 = float4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..e5a475dfcc --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); +mat4x2 f() { + mat4x2 m_1 = mat4x2(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..21148953a4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float4x2 f() { + thread float4x2 tint_symbol = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); + float4x2 const m_1 = float4x2(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..f40139edf8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 28 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %12 = OpConstantComposite %v2float %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %15 = OpConstantComposite %v2float %float_6 %float_7 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %23 = OpTypeFunction %mat4v2float +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v2float None %23 + %25 = OpLabel + %27 = OpLoad %mat4v2float %m + OpReturnValue %27 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..11bedce44c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat4x2(mat4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f)); + +fn f() -> mat4x2 { + let m_1 = mat4x2(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl new file mode 100644 index 0000000000..61644c1c71 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl @@ -0,0 +1,4 @@ +var m = mat4x2(0.0, 1.0, + 2.0, 3.0, + 4.0, 5.0, + 6.0, 7.0); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..2fbbb7e9fe --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd79610037 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %12 = OpConstantComposite %v2float %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %15 = OpConstantComposite %v2float %float_6 %float_7 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f217927c0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat4x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl new file mode 100644 index 0000000000..18d3a88d4d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x2(0.0h, 1.0h, + 2.0h, 3.0h, + 4.0h, 5.0h, + 6.0h, 7.0h); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d449a86eb4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..224d6e33bd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001F5E91C1A90(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f24340e07d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..282162b895 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %15 = OpConstantComposite %v2half %half_0x1_8p_2 %half_0x1_cp_2 + %16 = OpConstantComposite %mat4v2half %6 %9 %12 %15 +%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half + %m = OpVariable %_ptr_Private_mat4v2half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e79133d8b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x2(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl index f0946b93a5..f4ad0c1485 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x2(0.0, 1.0, - 2.0, 3.0, - 4.0, 5.0, - 6.0, 7.0); +var m = mat4x2(0.0f, 1.0f, + 2.0f, 3.0f, + 4.0f, 5.0f, + 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.glsl index 864c631eee..2fbbb7e9fe 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4x2 m = mat4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); +mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index de866706ff..0000000000 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x2 m = float4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.msl index 0597230800..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.spvasm index c6a6c63a6e..fd79610037 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,9 +12,9 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat4v2float = OpTypeMatrix %v2float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 @@ -24,10 +24,12 @@ %float_6 = OpConstant %float 6 %float_7 = OpConstant %float 7 %15 = OpConstantComposite %v2float %float_6 %float_7 - %m = OpConstantComposite %mat4v2float %6 %9 %12 %15 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %16 %void = OpTypeVoid - %17 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %17 - %20 = OpLabel + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.wgsl index 8f695084f5..94293b0801 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x2(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); +var m = mat4x2(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl new file mode 100644 index 0000000000..8d088c5ee7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl @@ -0,0 +1,4 @@ +var m = mat4x2(vec2(0.0, 1.0), + vec2(2.0, 3.0), + vec2(4.0, 5.0), + vec2(6.0, 7.0)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..2fbbb7e9fe --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd79610037 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %6 = OpConstantComposite %v2float %4 %float_1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %9 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %12 = OpConstantComposite %v2float %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %15 = OpConstantComposite %v2float %float_6 %float_7 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..571207b86f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat4x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0), vec2(6.0, 7.0)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl new file mode 100644 index 0000000000..3b0e7883ec --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x2(vec2(0.0h, 1.0h), + vec2(2.0h, 3.0h), + vec2(4.0h, 5.0h), + vec2(6.0h, 7.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d449a86eb4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..49a45a9bae --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h)), vector(float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000002612CA849E0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..f24340e07d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x2 m = f16mat4x2(f16vec2(0.0hf, 1.0hf), f16vec2(2.0hf, 3.0hf), f16vec2(4.0hf, 5.0hf), f16vec2(6.0hf, 7.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..282162b895 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %6 = OpConstantComposite %v2half %4 %half_0x1p_0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %9 = OpConstantComposite %v2half %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %12 = OpConstantComposite %v2half %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %15 = OpConstantComposite %v2half %half_0x1_8p_2 %half_0x1_cp_2 + %16 = OpConstantComposite %mat4v2half %6 %9 %12 %15 +%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half + %m = OpVariable %_ptr_Private_mat4v2half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c08c723969 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x2(vec2(0.0h, 1.0h), vec2(2.0h, 3.0h), vec2(4.0h, 5.0h), vec2(6.0h, 7.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl index c1bd5eee1a..8da6415cd6 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x2(vec2(0.0, 1.0), - vec2(2.0, 3.0), - vec2(4.0, 5.0), - vec2(6.0, 7.0)); +var m = mat4x2(vec2(0.0f, 1.0f), + vec2(2.0f, 3.0f), + vec2(4.0f, 5.0f), + vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e97d2792c8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.glsl index 93ae98cd4b..2fbbb7e9fe 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); +mat4x2 m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 2acab36b4d..0000000000 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.msl index 0597230800..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x2 m = float4x2(float2(0.0f, 1.0f), float2(2.0f, 3.0f), float2(4.0f, 5.0f), float2(6.0f, 7.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.spvasm index c6a6c63a6e..fd79610037 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,9 +12,9 @@ %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 %mat4v2float = OpTypeMatrix %v2float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 - %6 = OpConstantComposite %v2float %float_0 %float_1 + %6 = OpConstantComposite %v2float %4 %float_1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 %9 = OpConstantComposite %v2float %float_2 %float_3 @@ -24,10 +24,12 @@ %float_6 = OpConstant %float 6 %float_7 = OpConstant %float 7 %15 = OpConstantComposite %v2float %float_6 %float_7 - %m = OpConstantComposite %mat4v2float %6 %9 %12 %15 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %16 %void = OpTypeVoid - %17 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %17 - %20 = OpLabel + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.wgsl index ca404bf655..e024293935 100644 --- a/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x2/inferred/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0), vec2(6.0, 7.0)); +var m = mat4x2(vec2(0.0f, 1.0f), vec2(2.0f, 3.0f), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl new file mode 100644 index 0000000000..d9c0b36cb4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +fn f() { + var m = mat4x2(); + let m_1 = mat4x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..db3e6a7cd3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + const matrix m_1 = matrix(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..039096dcae --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); + const matrix m_1 = matrix(m); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000029684918660(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000029684918660(8,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..e75435c881 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat4x2 m = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); + f16mat4x2 m_1 = f16mat4x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.msl new file mode 100644 index 0000000000..e3c6532126 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + half4x2 m = half4x2(half2(0.0h), half2(0.0h), half2(0.0h), half2(0.0h)); + half4x2 const m_1 = half4x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..37c3f3b5be --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %10 = OpConstantNull %mat4v2half +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat4v2half Function %10 + OpStore %m %10 + %14 = OpLoad %mat4v2half %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..13a9671539 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f16.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +fn f() { + var m = mat4x2(); + let m_1 = mat4x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl new file mode 100644 index 0000000000..9651287676 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat4x2(); + let m_1 = mat4x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..92ac9a0725 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx); + const float4x2 m_1 = float4x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..92ac9a0725 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx); + const float4x2 m_1 = float4x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..ae6ce5f87d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + mat4x2 m = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f)); + mat4x2 m_1 = mat4x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.msl new file mode 100644 index 0000000000..2f4e0c353c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + float4x2 m = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f)); + float4x2 const m_1 = float4x2(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..66dbb323ba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %10 = OpConstantNull %mat4v2float +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat4v2float Function %10 + OpStore %m %10 + %14 = OpLoad %mat4v2float %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c9476020b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/load/f32.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat4x2(); + let m_1 = mat4x2(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl new file mode 100644 index 0000000000..924406a308 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var m = mat4x2(); diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..84cfdd53a9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..06f7c19e03 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000021E1FA32CE0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..800e158983 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x2 m = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..268ad7e8d4 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %4 = OpConstantNull %mat4v2half +%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half + %m = OpVariable %_ptr_Private_mat4v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0378a99b9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x2(); diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl new file mode 100644 index 0000000000..4c85dffa66 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl @@ -0,0 +1 @@ +var m = mat4x2(); diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f402a95105 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx); diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f402a95105 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 m = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx); diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..9e082c7ff6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x2 m = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..328b41856d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %4 = OpConstantNull %mat4v2float +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..4c85dffa66 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x2/zero/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat4x2(); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl new file mode 100644 index 0000000000..f8c21ad35f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl @@ -0,0 +1,10 @@ +enable f16; +var m = mat4x3(mat4x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h, + 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h)); + +fn f() -> mat4x3 { + let m_1 = mat4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9b9f603d4d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af6180ef9c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000027A67D14860(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..b17a39b21a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf)); +f16mat4x3 f() { + f16mat4x3 m_1 = f16mat4x3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..21bcccac8a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half4x3 f() { + thread half4x3 tint_symbol = half4x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h), half3(9.0h, 10.0h, 11.0h)); + half4x3 const m_1 = half4x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..dead4f42d8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %19 = OpConstantComposite %v3half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %20 = OpConstantComposite %mat4v3half %7 %11 %15 %19 +%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half + %m = OpVariable %_ptr_Private_mat4v3half Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %27 = OpTypeFunction %mat4v3half +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v3half None %27 + %29 = OpLabel + %31 = OpLoad %mat4v3half %m + OpReturnValue %31 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..94f3cedbf7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat4x3(mat4x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h)); + +fn f() -> mat4x3 { + let m_1 = mat4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl new file mode 100644 index 0000000000..9b7dee42fc --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl @@ -0,0 +1,9 @@ +var m = mat4x3(mat4x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f, + 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f)); + +fn f() -> mat4x3 { + let m_1 = mat4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..284dccbd44 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); + +float4x3 f() { + const float4x3 m_1 = float4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..284dccbd44 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); + +float4x3 f() { + const float4x3 m_1 = float4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..9b28954648 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); +mat4x3 f() { + mat4x3 m_1 = mat4x3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..73272195cf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float4x3 f() { + thread float4x3 tint_symbol = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); + float4x3 const m_1 = float4x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8cfb499643 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %m = OpVariable %_ptr_Private_mat4v3float Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %27 = OpTypeFunction %mat4v3float +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v3float None %27 + %29 = OpLabel + %31 = OpLoad %mat4v3float %m + OpReturnValue %31 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..d406f38987 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat4x3(mat4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f)); + +fn f() -> mat4x3 { + let m_1 = mat4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl new file mode 100644 index 0000000000..e17d69d88e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h, + 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3fd1b03592 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b275abc03c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000020AAA862BF0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..962c5ea814 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..cec02640ba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %19 = OpConstantComposite %v3half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %20 = OpConstantComposite %mat4v3half %7 %11 %15 %19 +%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half + %m = OpVariable %_ptr_Private_mat4v3half Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c9c72ab43e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl index d29dcf731b..afb562feaa 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x3(0.0, 1.0, 2.0, - 3.0, 4.0, 5.0, - 6.0, 7.0, 8.0, - 9.0, 10.0, 11.0); +var m = mat4x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f, + 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.glsl index d18bd377c5..06560c7397 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4x3 m = mat4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); +mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 38a7333496..0000000000 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x3 m = float4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.msl index d935650860..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.spvasm index d99b492f7e..f5592ed4ba 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,10 +12,10 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat4v3float = OpTypeMatrix %v3float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 @@ -28,10 +28,12 @@ %float_10 = OpConstant %float 10 %float_11 = OpConstant %float 11 %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11 - %m = OpConstantComposite %mat4v3float %7 %11 %15 %19 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %m = OpVariable %_ptr_Private_mat4v3float Private %20 %void = OpTypeVoid - %21 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %21 - %24 = OpLabel + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.wgsl index 2172728eb5..aaa7fd78ac 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0); +var m = mat4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl new file mode 100644 index 0000000000..fa9c762c72 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x3(vec3(0.0h, 1.0h, 2.0h), + vec3(3.0h, 4.0h, 5.0h), + vec3(6.0h, 7.0h, 8.0h), + vec3(9.0h, 10.0h, 11.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3fd1b03592 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f916e8380d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FC8B0B3B50(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..962c5ea814 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..cec02640ba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %19 = OpConstantComposite %v3half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %20 = OpConstantComposite %mat4v3half %7 %11 %15 %19 +%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half + %m = OpVariable %_ptr_Private_mat4v3half Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..2693abb197 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x3(vec3(0.0h, 1.0h, 2.0h), vec3(3.0h, 4.0h, 5.0h), vec3(6.0h, 7.0h, 8.0h), vec3(9.0h, 10.0h, 11.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl index 7f218e143d..00f6cb1bff 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x3(vec3(0.0, 1.0, 2.0), - vec3(3.0, 4.0, 5.0), - vec3(6.0, 7.0, 8.0), - vec3(9.0, 10.0, 11.0)); +var m = mat4x3(vec3(0.0f, 1.0f, 2.0f), + vec3(3.0f, 4.0f, 5.0f), + vec3(6.0f, 7.0f, 8.0f), + vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.glsl index 532369fbf2..06560c7397 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); +mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 254cc408e6..0000000000 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl index d935650860..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm index d99b492f7e..f5592ed4ba 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,10 +12,10 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat4v3float = OpTypeMatrix %v3float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 @@ -28,10 +28,12 @@ %float_10 = OpConstant %float 10 %float_11 = OpConstant %float 11 %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11 - %m = OpConstantComposite %mat4v3float %7 %11 %15 %19 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %m = OpVariable %_ptr_Private_mat4v3float Private %20 %void = OpTypeVoid - %21 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %21 - %24 = OpLabel + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl index ae271221da..8e07672901 100644 --- a/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x3/explicit/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0), vec3(9.0, 10.0, 11.0)); +var m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl new file mode 100644 index 0000000000..b85217b737 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl @@ -0,0 +1,10 @@ +enable f16; +var m = mat4x3(mat4x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h, + 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h)); + +fn f() -> mat4x3 { + let m_1 = mat4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9b9f603d4d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..de8810c545 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001F62FD73DD0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..b17a39b21a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf)); +f16mat4x3 f() { + f16mat4x3 m_1 = f16mat4x3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..21bcccac8a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half4x3 f() { + thread half4x3 tint_symbol = half4x3(half3(0.0h, 1.0h, 2.0h), half3(3.0h, 4.0h, 5.0h), half3(6.0h, 7.0h, 8.0h), half3(9.0h, 10.0h, 11.0h)); + half4x3 const m_1 = half4x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..dead4f42d8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %19 = OpConstantComposite %v3half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %20 = OpConstantComposite %mat4v3half %7 %11 %15 %19 +%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half + %m = OpVariable %_ptr_Private_mat4v3half Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %27 = OpTypeFunction %mat4v3half +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v3half None %27 + %29 = OpLabel + %31 = OpLoad %mat4v3half %m + OpReturnValue %31 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fae55a627 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat4x3(mat4x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h)); + +fn f() -> mat4x3 { + let m_1 = mat4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl new file mode 100644 index 0000000000..ad7c1b29fd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl @@ -0,0 +1,9 @@ +var m = mat4x3(mat4x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f, + 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f)); + +fn f() -> mat4x3 { + let m_1 = mat4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..284dccbd44 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); + +float4x3 f() { + const float4x3 m_1 = float4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..284dccbd44 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); + +float4x3 f() { + const float4x3 m_1 = float4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..9b28954648 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); +mat4x3 f() { + mat4x3 m_1 = mat4x3(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..73272195cf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float4x3 f() { + thread float4x3 tint_symbol = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); + float4x3 const m_1 = float4x3(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8cfb499643 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %m = OpVariable %_ptr_Private_mat4v3float Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %27 = OpTypeFunction %mat4v3float +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v3float None %27 + %29 = OpLabel + %31 = OpLoad %mat4v3float %m + OpReturnValue %31 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..58662e48c7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat4x3(mat4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f)); + +fn f() -> mat4x3 { + let m_1 = mat4x3(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl new file mode 100644 index 0000000000..449400b741 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl @@ -0,0 +1,4 @@ +var m = mat4x3(0.0, 1.0, 2.0, + 3.0, 4.0, 5.0, + 6.0, 7.0, 8.0, + 9.0, 10.0, 11.0); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..06560c7397 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..f5592ed4ba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %m = OpVariable %_ptr_Private_mat4v3float Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..b8f80a723a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat4x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl new file mode 100644 index 0000000000..29609a1381 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x3(0.0h, 1.0h, 2.0h, + 3.0h, 4.0h, 5.0h, + 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3fd1b03592 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5e6e0a6410 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001952AFE1CC0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..962c5ea814 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..cec02640ba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %19 = OpConstantComposite %v3half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %20 = OpConstantComposite %mat4v3half %7 %11 %15 %19 +%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half + %m = OpVariable %_ptr_Private_mat4v3half Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..71b04e6cd5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x3(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl index 32326a9ed8..dfa9afebf0 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x3(0.0, 1.0, 2.0, - 3.0, 4.0, 5.0, - 6.0, 7.0, 8.0, - 9.0, 10.0, 11.0); +var m = mat4x3(0.0f, 1.0f, 2.0f, + 3.0f, 4.0f, 5.0f, + 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.glsl index d18bd377c5..06560c7397 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4x3 m = mat4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); +mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 38a7333496..0000000000 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x3 m = float4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.msl index d935650860..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.spvasm index d99b492f7e..f5592ed4ba 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,10 +12,10 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat4v3float = OpTypeMatrix %v3float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 @@ -28,10 +28,12 @@ %float_10 = OpConstant %float 10 %float_11 = OpConstant %float 11 %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11 - %m = OpConstantComposite %mat4v3float %7 %11 %15 %19 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %m = OpVariable %_ptr_Private_mat4v3float Private %20 %void = OpTypeVoid - %21 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %21 - %24 = OpLabel + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.wgsl index 209a37625f..11bbddb918 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x3(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0); +var m = mat4x3(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl new file mode 100644 index 0000000000..cd71d8c3e6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl @@ -0,0 +1,4 @@ +var m = mat4x3(vec3(0.0, 1.0, 2.0), + vec3(3.0, 4.0, 5.0), + vec3(6.0, 7.0, 8.0), + vec3(9.0, 10.0, 11.0)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..06560c7397 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..f5592ed4ba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %11 = OpConstantComposite %v3float %float_3 %float_4 %float_5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v3float %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %m = OpVariable %_ptr_Private_mat4v3float Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..2ec81b06a8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat4x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0), vec3(9.0, 10.0, 11.0)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl new file mode 100644 index 0000000000..60dc832364 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x3(vec3(0.0h, 1.0h, 2.0h), + vec3(3.0h, 4.0h, 5.0h), + vec3(6.0h, 7.0h, 8.0h), + vec3(9.0h, 10.0h, 11.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3fd1b03592 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..079a8202ed --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)), vector(float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000022E236833F0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..962c5ea814 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x3 m = f16mat4x3(f16vec3(0.0hf, 1.0hf, 2.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf), f16vec3(6.0hf, 7.0hf, 8.0hf), f16vec3(9.0hf, 10.0hf, 11.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..cec02640ba --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %7 = OpConstantComposite %v3half %4 %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 + %11 = OpConstantComposite %v3half %half_0x1_8p_1 %half_0x1p_2 %half_0x1_4p_2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v3half %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %19 = OpConstantComposite %v3half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 + %20 = OpConstantComposite %mat4v3half %7 %11 %15 %19 +%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half + %m = OpVariable %_ptr_Private_mat4v3half Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..57520804a7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x3(vec3(0.0h, 1.0h, 2.0h), vec3(3.0h, 4.0h, 5.0h), vec3(6.0h, 7.0h, 8.0h), vec3(9.0h, 10.0h, 11.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl index a3ae9f2839..f55af6c7cb 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x3(vec3(0.0, 1.0, 2.0), - vec3(3.0, 4.0, 5.0), - vec3(6.0, 7.0, 8.0), - vec3(9.0, 10.0, 11.0)); +var m = mat4x3(vec3(0.0f, 1.0f, 2.0f), + vec3(3.0f, 4.0f, 5.0f), + vec3(6.0f, 7.0f, 8.0f), + vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b34e6e1fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.glsl index 532369fbf2..06560c7397 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); +mat4x3 m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 254cc408e6..0000000000 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.msl index d935650860..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x3 m = float4x3(float3(0.0f, 1.0f, 2.0f), float3(3.0f, 4.0f, 5.0f), float3(6.0f, 7.0f, 8.0f), float3(9.0f, 10.0f, 11.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.spvasm index d99b492f7e..f5592ed4ba 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,10 +12,10 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat4v3float = OpTypeMatrix %v3float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %7 = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %7 = OpConstantComposite %v3float %4 %float_1 %float_2 %float_3 = OpConstant %float 3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 @@ -28,10 +28,12 @@ %float_10 = OpConstant %float 10 %float_11 = OpConstant %float 11 %19 = OpConstantComposite %v3float %float_9 %float_10 %float_11 - %m = OpConstantComposite %mat4v3float %7 %11 %15 %19 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %m = OpVariable %_ptr_Private_mat4v3float Private %20 %void = OpTypeVoid - %21 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %21 - %24 = OpLabel + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.wgsl index ca7b45f34e..7eb4b32d47 100644 --- a/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x3/inferred/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x3(vec3(0.0, 1.0, 2.0), vec3(3.0, 4.0, 5.0), vec3(6.0, 7.0, 8.0), vec3(9.0, 10.0, 11.0)); +var m = mat4x3(vec3(0.0f, 1.0f, 2.0f), vec3(3.0f, 4.0f, 5.0f), vec3(6.0f, 7.0f, 8.0f), vec3(9.0f, 10.0f, 11.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl new file mode 100644 index 0000000000..7afb7980fd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +fn f() { + var m = mat4x3(); + let m_1 = mat4x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e84ac54fa --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + const matrix m_1 = matrix(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..665574d15e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); + const matrix m_1 = matrix(m); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000234940E69F0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000234940E69F0(8,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..38e2182ae9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat4x3 m = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); + f16mat4x3 m_1 = f16mat4x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.msl new file mode 100644 index 0000000000..0f11ff84e1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + half4x3 m = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h)); + half4x3 const m_1 = half4x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0326b42e1a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %10 = OpConstantNull %mat4v3half +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat4v3half Function %10 + OpStore %m %10 + %14 = OpLoad %mat4v3half %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..2b3362560b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f16.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +fn f() { + var m = mat4x3(); + let m_1 = mat4x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl new file mode 100644 index 0000000000..8ac728cb8e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat4x3(); + let m_1 = mat4x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..16edf138b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + const float4x3 m_1 = float4x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16edf138b6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + const float4x3 m_1 = float4x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..13bad688a0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + mat4x3 m = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f)); + mat4x3 m_1 = mat4x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.msl new file mode 100644 index 0000000000..e5a0c7d316 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + float4x3 m = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f)); + float4x3 const m_1 = float4x3(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..220eba0df5 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %10 = OpConstantNull %mat4v3float +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat4v3float Function %10 + OpStore %m %10 + %14 = OpLoad %mat4v3float %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a3186e82da --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/load/f32.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat4x3(); + let m_1 = mat4x3(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl new file mode 100644 index 0000000000..6f6f3f575d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var m = mat4x3(); diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38327b1e9b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52810cf886 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001DD79FA20D0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..094c7e9af8 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x3 m = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..4573010beb --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %4 = OpConstantNull %mat4v3half +%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half + %m = OpVariable %_ptr_Private_mat4v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..9725227b91 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x3(); diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl new file mode 100644 index 0000000000..e23b03f16d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl @@ -0,0 +1 @@ +var m = mat4x3(); diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..297a867820 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..297a867820 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 m = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..b24fd7aded --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x3 m = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..53ffa7d21c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %4 = OpConstantNull %mat4v3float +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %m = OpVariable %_ptr_Private_mat4v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e23b03f16d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x3/zero/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat4x3(); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl new file mode 100644 index 0000000000..08075c90e3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl @@ -0,0 +1,10 @@ +enable f16; +var m = mat4x4(mat4x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h, + 8.0h, 9.0h, 10.0h, 11.0h, + 12.0h, 13.0h, 14.0h, 15.0h)); + +fn f() -> mat4x4 { + let m_1 = mat4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..96567136ab --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a44fb83748 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000288ADE91440(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8d3ad80c91 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf)); +f16mat4 f() { + f16mat4 m_1 = f16mat4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..178ef596ef --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half4x4 f() { + thread half4x4 tint_symbol = half4x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h), half4(12.0h, 13.0h, 14.0h, 15.0h)); + half4x4 const m_1 = half4x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..20aa3b2d3d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 +%half_0x1_ap_3 = OpConstant %half 0x1.ap+3 +%half_0x1_cp_3 = OpConstant %half 0x1.cp+3 +%half_0x1_ep_3 = OpConstant %half 0x1.ep+3 + %23 = OpConstantComposite %v4half %half_0x1_8p_3 %half_0x1_ap_3 %half_0x1_cp_3 %half_0x1_ep_3 + %24 = OpConstantComposite %mat4v4half %8 %13 %18 %23 +%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half + %m = OpVariable %_ptr_Private_mat4v4half Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %31 = OpTypeFunction %mat4v4half +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v4half None %31 + %33 = OpLabel + %35 = OpLoad %mat4v4half %m + OpReturnValue %35 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..8130c8f780 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat4x4(mat4x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h)); + +fn f() -> mat4x4 { + let m_1 = mat4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl new file mode 100644 index 0000000000..ff2b04a2c7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl @@ -0,0 +1,9 @@ +var m = mat4x4(mat4x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f, + 8.0f, 9.0f, 10.0f, 11.0f, + 12.0f, 13.0f, 14.0f, 15.0f)); + +fn f() -> mat4x4 { + let m_1 = mat4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe1a3a7e28 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); + +float4x4 f() { + const float4x4 m_1 = float4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe1a3a7e28 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); + +float4x4 f() { + const float4x4 m_1 = float4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..5b8ecf497d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); +mat4 f() { + mat4 m_1 = mat4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..71f0986e53 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float4x4 f() { + thread float4x4 tint_symbol = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); + float4x4 const m_1 = float4x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e503126c9f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 + %float_12 = OpConstant %float 12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %m = OpVariable %_ptr_Private_mat4v4float Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %31 = OpTypeFunction %mat4v4float +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v4float None %31 + %33 = OpLabel + %35 = OpLoad %mat4v4float %m + OpReturnValue %35 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..ddab90cff7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat4x4(mat4x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f)); + +fn f() -> mat4x4 { + let m_1 = mat4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl new file mode 100644 index 0000000000..d42ee170b3 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h, + 8.0h, 9.0h, 10.0h, 11.0h, + 12.0h, 13.0h, 14.0h, 15.0h); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6243cce6e9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..de235ce4be --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000021418B60EF0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..46f9ec3551 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d55c43041 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 +%half_0x1_ap_3 = OpConstant %half 0x1.ap+3 +%half_0x1_cp_3 = OpConstant %half 0x1.cp+3 +%half_0x1_ep_3 = OpConstant %half 0x1.ep+3 + %23 = OpConstantComposite %v4half %half_0x1_8p_3 %half_0x1_ap_3 %half_0x1_cp_3 %half_0x1_ep_3 + %24 = OpConstantComposite %mat4v4half %8 %13 %18 %23 +%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half + %m = OpVariable %_ptr_Private_mat4v4half Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..762aa0a267 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl index b89957b6f7..bdd6737c66 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x4(0.0, 1.0, 2.0, 3.0, - 4.0, 5.0, 6.0, 7.0, - 8.0, 9.0, 10.0, 11.0, - 12.0, 13.0, 14.0, 15.0); +var m = mat4x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f, + 8.0f, 9.0f, 10.0f, 11.0f, + 12.0f, 13.0f, 14.0f, 15.0f); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.glsl index c1bb385a4c..5f8a2263f6 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4 m = mat4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f); +mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 3a70922519..0000000000 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x4 m = float4x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.msl index 053e23dbe9..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.spvasm index 84a8f8962d..ac2d6d7bef 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 29 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,11 +12,11 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat4v4float = OpTypeMatrix %v4float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 @@ -32,10 +32,12 @@ %float_14 = OpConstant %float 14 %float_15 = OpConstant %float 15 %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15 - %m = OpConstantComposite %mat4v4float %8 %13 %18 %23 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %m = OpVariable %_ptr_Private_mat4v4float Private %24 %void = OpTypeVoid - %25 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %25 - %28 = OpLabel + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.wgsl index 5916e6a519..adc3d0cafb 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0); +var m = mat4x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl new file mode 100644 index 0000000000..73cb5081bc --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), + vec4(4.0h, 5.0h, 6.0h, 7.0h), + vec4(8.0h, 9.0h, 10.0h, 11.0h), + vec4(12.0h, 13.0h, 14.0h, 15.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6243cce6e9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c4193c8dd --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000263A6DB3030(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..46f9ec3551 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d55c43041 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 +%half_0x1_ap_3 = OpConstant %half 0x1.ap+3 +%half_0x1_cp_3 = OpConstant %half 0x1.cp+3 +%half_0x1_ep_3 = OpConstant %half 0x1.ep+3 + %23 = OpConstantComposite %v4half %half_0x1_8p_3 %half_0x1_ap_3 %half_0x1_cp_3 %half_0x1_ep_3 + %24 = OpConstantComposite %mat4v4half %8 %13 %18 %23 +%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half + %m = OpVariable %_ptr_Private_mat4v4half Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..4af01b343a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), vec4(4.0h, 5.0h, 6.0h, 7.0h), vec4(8.0h, 9.0h, 10.0h, 11.0h), vec4(12.0h, 13.0h, 14.0h, 15.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl index 02b4118093..62b2ea3788 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0), - vec4(4.0, 5.0, 6.0, 7.0), - vec4(8.0, 9.0, 10.0, 11.0), - vec4(12.0, 13.0, 14.0, 15.0)); +var m = mat4x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), + vec4(4.0f, 5.0f, 6.0f, 7.0f), + vec4(8.0f, 9.0f, 10.0f, 11.0f), + vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.glsl index b86a544c92..5f8a2263f6 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); +mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 270799912a..0000000000 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl index 053e23dbe9..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm index 84a8f8962d..ac2d6d7bef 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 29 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,11 +12,11 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat4v4float = OpTypeMatrix %v4float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 @@ -32,10 +32,12 @@ %float_14 = OpConstant %float 14 %float_15 = OpConstant %float 15 %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15 - %m = OpConstantComposite %mat4v4float %8 %13 %18 %23 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %m = OpVariable %_ptr_Private_mat4v4float Private %24 %void = OpTypeVoid - %25 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %25 - %28 = OpLabel + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl index 6bdb25745f..e3c85d64ca 100644 --- a/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x4/explicit/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0), vec4(12.0, 13.0, 14.0, 15.0)); +var m = mat4x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl new file mode 100644 index 0000000000..651128bd77 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl @@ -0,0 +1,10 @@ +enable f16; +var m = mat4x4(mat4x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h, + 8.0h, 9.0h, 10.0h, 11.0h, + 12.0h, 13.0h, 14.0h, 15.0h)); + +fn f() -> mat4x4 { + let m_1 = mat4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..96567136ab --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c491101a56 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); + +matrix f() { + const matrix m_1 = matrix(m); + return m_1; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000019A49281440(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8d3ad80c91 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.glsl @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf)); +f16mat4 f() { + f16mat4 m_1 = f16mat4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.msl new file mode 100644 index 0000000000..178ef596ef --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +half4x4 f() { + thread half4x4 tint_symbol = half4x4(half4(0.0h, 1.0h, 2.0h, 3.0h), half4(4.0h, 5.0h, 6.0h, 7.0h), half4(8.0h, 9.0h, 10.0h, 11.0h), half4(12.0h, 13.0h, 14.0h, 15.0h)); + half4x4 const m_1 = half4x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..20aa3b2d3d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 +%half_0x1_ap_3 = OpConstant %half 0x1.ap+3 +%half_0x1_cp_3 = OpConstant %half 0x1.cp+3 +%half_0x1_ep_3 = OpConstant %half 0x1.ep+3 + %23 = OpConstantComposite %v4half %half_0x1_8p_3 %half_0x1_ap_3 %half_0x1_cp_3 %half_0x1_ep_3 + %24 = OpConstantComposite %mat4v4half %8 %13 %18 %23 +%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half + %m = OpVariable %_ptr_Private_mat4v4half Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %31 = OpTypeFunction %mat4v4half +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v4half None %31 + %33 = OpLabel + %35 = OpLoad %mat4v4half %m + OpReturnValue %35 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4281c7184 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f16.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; + +var m = mat4x4(mat4x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h)); + +fn f() -> mat4x4 { + let m_1 = mat4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl new file mode 100644 index 0000000000..3024289809 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl @@ -0,0 +1,9 @@ +var m = mat4x4(mat4x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f, + 8.0f, 9.0f, 10.0f, 11.0f, + 12.0f, 13.0f, 14.0f, 15.0f)); + +fn f() -> mat4x4 { + let m_1 = mat4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe1a3a7e28 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); + +float4x4 f() { + const float4x4 m_1 = float4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe1a3a7e28 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); + +float4x4 f() { + const float4x4 m_1 = float4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..5b8ecf497d --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); +mat4 f() { + mat4 m_1 = mat4(m); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.msl new file mode 100644 index 0000000000..71f0986e53 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +float4x4 f() { + thread float4x4 tint_symbol = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); + float4x4 const m_1 = float4x4(tint_symbol); + return m_1; +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e503126c9f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 + %float_12 = OpConstant %float 12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %m = OpVariable %_ptr_Private_mat4v4float Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %31 = OpTypeFunction %mat4v4float +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %mat4v4float None %31 + %33 = OpLabel + %35 = OpLoad %mat4v4float %m + OpReturnValue %35 + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..aa96555bca --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/identity/f32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var m = mat4x4(mat4x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f)); + +fn f() -> mat4x4 { + let m_1 = mat4x4(m); + return m_1; +} diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl new file mode 100644 index 0000000000..3339d4da54 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl @@ -0,0 +1,4 @@ +var m = mat4x4(0.0, 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, 7.0, + 8.0, 9.0, 10.0, 11.0, + 12.0, 13.0, 14.0, 15.0); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..5f8a2263f6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..ac2d6d7bef --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 + %float_12 = OpConstant %float 12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %m = OpVariable %_ptr_Private_mat4v4float Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..83572f2a94 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat4x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl new file mode 100644 index 0000000000..2dd0fe3865 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x4(0.0h, 1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, 7.0h, + 8.0h, 9.0h, 10.0h, 11.0h, + 12.0h, 13.0h, 14.0h, 15.0h); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6243cce6e9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..872d95e3be --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000020995B43790(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..46f9ec3551 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d55c43041 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 +%half_0x1_ap_3 = OpConstant %half 0x1.ap+3 +%half_0x1_cp_3 = OpConstant %half 0x1.cp+3 +%half_0x1_ep_3 = OpConstant %half 0x1.ep+3 + %23 = OpConstantComposite %v4half %half_0x1_8p_3 %half_0x1_ap_3 %half_0x1_cp_3 %half_0x1_ep_3 + %24 = OpConstantComposite %mat4v4half %8 %13 %18 %23 +%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half + %m = OpVariable %_ptr_Private_mat4v4half Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..630381ced6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x4(0.0h, 1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl index 571610f480..178b95bd82 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x4(0.0, 1.0, 2.0, 3.0, - 4.0, 5.0, 6.0, 7.0, - 8.0, 9.0, 10.0, 11.0, - 12.0, 13.0, 14.0, 15.0); +var m = mat4x4(0.0f, 1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, 7.0f, + 8.0f, 9.0f, 10.0f, 11.0f, + 12.0f, 13.0f, 14.0f, 15.0f); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.glsl index c1bb385a4c..5f8a2263f6 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4 m = mat4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f); +mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.hlsl deleted file mode 100644 index 3a70922519..0000000000 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x4 m = float4x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.msl index 053e23dbe9..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.spvasm index 84a8f8962d..ac2d6d7bef 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 29 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,11 +12,11 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat4v4float = OpTypeMatrix %v4float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 @@ -32,10 +32,12 @@ %float_14 = OpConstant %float 14 %float_15 = OpConstant %float 15 %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15 - %m = OpConstantComposite %mat4v4float %8 %13 %18 %23 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %m = OpVariable %_ptr_Private_mat4v4float Private %24 %void = OpTypeVoid - %25 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %25 - %28 = OpLabel + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.wgsl index 33b0598be3..ae47f65b4b 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/scalars/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0); +var m = mat4x4(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl new file mode 100644 index 0000000000..52c70d1877 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl @@ -0,0 +1,4 @@ +var m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0), + vec4(4.0, 5.0, 6.0, 7.0), + vec4(8.0, 9.0, 10.0, 11.0), + vec4(12.0, 13.0, 14.0, 15.0)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..5f8a2263f6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..ac2d6d7bef --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %4 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %13 = OpConstantComposite %v4float %float_4 %float_5 %float_6 %float_7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %18 = OpConstantComposite %v4float %float_8 %float_9 %float_10 %float_11 + %float_12 = OpConstant %float 12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %m = OpVariable %_ptr_Private_mat4v4float Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..13ec29a7b9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0), vec4(12.0, 13.0, 14.0, 15.0)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl new file mode 100644 index 0000000000..7a6dadf44b --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var m = mat4x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), + vec4(4.0h, 5.0h, 6.0h, 7.0h), + vec4(8.0h, 9.0h, 10.0h, 11.0h), + vec4(12.0h, 13.0h, 14.0h, 15.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6243cce6e9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8772700b14 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix(vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h), float16_t(7.0h)), vector(float16_t(8.0h), float16_t(9.0h), float16_t(10.0h), float16_t(11.0h)), vector(float16_t(12.0h), float16_t(13.0h), float16_t(14.0h), float16_t(15.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000024092DA38D0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..46f9ec3551 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4 m = f16mat4(f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf), f16vec4(4.0hf, 5.0hf, 6.0hf, 7.0hf), f16vec4(8.0hf, 9.0hf, 10.0hf, 11.0hf), f16vec4(12.0hf, 13.0hf, 14.0hf, 15.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d55c43041 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %4 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %8 = OpConstantComposite %v4half %4 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 + %13 = OpConstantComposite %v4half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 + %18 = OpConstantComposite %v4half %half_0x1p_3 %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 +%half_0x1_ap_3 = OpConstant %half 0x1.ap+3 +%half_0x1_cp_3 = OpConstant %half 0x1.cp+3 +%half_0x1_ep_3 = OpConstant %half 0x1.ep+3 + %23 = OpConstantComposite %v4half %half_0x1_8p_3 %half_0x1_ap_3 %half_0x1_cp_3 %half_0x1_ep_3 + %24 = OpConstantComposite %mat4v4half %8 %13 %18 %23 +%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half + %m = OpVariable %_ptr_Private_mat4v4half Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..6d28d49b88 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x4(vec4(0.0h, 1.0h, 2.0h, 3.0h), vec4(4.0h, 5.0h, 6.0h, 7.0h), vec4(8.0h, 9.0h, 10.0h, 11.0h), vec4(12.0h, 13.0h, 14.0h, 15.0h)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl index 1e2c0d775f..1e8e479cd0 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl @@ -1,4 +1,4 @@ -let m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0), - vec4(4.0, 5.0, 6.0, 7.0), - vec4(8.0, 9.0, 10.0, 11.0), - vec4(12.0, 13.0, 14.0, 15.0)); +var m = mat4x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), + vec4(4.0f, 5.0f, 6.0f, 7.0f), + vec4(8.0f, 9.0f, 10.0f, 11.0f), + vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b506f6515 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.glsl index b86a544c92..5f8a2263f6 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); +mat4 m = mat4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.hlsl deleted file mode 100644 index 270799912a..0000000000 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.msl index 053e23dbe9..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4x4 m = float4x4(float4(0.0f, 1.0f, 2.0f, 3.0f), float4(4.0f, 5.0f, 6.0f, 7.0f), float4(8.0f, 9.0f, 10.0f, 11.0f), float4(12.0f, 13.0f, 14.0f, 15.0f)); - diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.spvasm index 84a8f8962d..ac2d6d7bef 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 29 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,11 +12,11 @@ %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat4v4float = OpTypeMatrix %v4float 4 - %float_0 = OpConstant %float 0 + %4 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %8 = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %8 = OpConstantComposite %v4float %4 %float_1 %float_2 %float_3 %float_4 = OpConstant %float 4 %float_5 = OpConstant %float 5 %float_6 = OpConstant %float 6 @@ -32,10 +32,12 @@ %float_14 = OpConstant %float 14 %float_15 = OpConstant %float 15 %23 = OpConstantComposite %v4float %float_12 %float_13 %float_14 %float_15 - %m = OpConstantComposite %mat4v4float %8 %13 %18 %23 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %m = OpVariable %_ptr_Private_mat4v4float Private %24 %void = OpTypeVoid - %25 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %25 - %28 = OpLabel + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.wgsl index b022afe64a..9934a44967 100644 --- a/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/mat4x4/inferred/vectors/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let m = mat4x4(vec4(0.0, 1.0, 2.0, 3.0), vec4(4.0, 5.0, 6.0, 7.0), vec4(8.0, 9.0, 10.0, 11.0), vec4(12.0, 13.0, 14.0, 15.0)); +var m = mat4x4(vec4(0.0f, 1.0f, 2.0f, 3.0f), vec4(4.0f, 5.0f, 6.0f, 7.0f), vec4(8.0f, 9.0f, 10.0f, 11.0f), vec4(12.0f, 13.0f, 14.0f, 15.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl new file mode 100644 index 0000000000..a99703123a --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +fn f() { + var m = mat4x4(); + let m_1 = mat4x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9eb4352559 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + const matrix m_1 = matrix(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31b976ceca --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); + const matrix m_1 = matrix(m); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000016C5A9809A0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000016C5A9809A0(8,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..0ea582dc69 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat4 m = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); + f16mat4 m_1 = f16mat4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.msl new file mode 100644 index 0000000000..b63a8b4ac1 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + half4x4 m = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h)); + half4x4 const m_1 = half4x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba9b0c723e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %10 = OpConstantNull %mat4v4half +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat4v4half Function %10 + OpStore %m %10 + %14 = OpLoad %mat4v4half %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..2907c89b0f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f16.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +fn f() { + var m = mat4x4(); + let m_1 = mat4x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl new file mode 100644 index 0000000000..b361a63fc9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat4x4(); + let m_1 = mat4x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..03e51e9ac6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + const float4x4 m_1 = float4x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..03e51e9ac6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + const float4x4 m_1 = float4x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..aa36f7cdb7 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + mat4 m = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); + mat4 m_1 = mat4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.msl new file mode 100644 index 0000000000..019e73b1e9 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + float4x4 m = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f)); + float4x4 const m_1 = float4x4(m); +} + diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..373458cbf0 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %m "m" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %10 = OpConstantNull %mat4v4float +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %m = OpVariable %_ptr_Function_mat4v4float Function %10 + OpStore %m %10 + %14 = OpLoad %mat4v4float %m + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6fabb6a016 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/load/f32.wgsl.expected.wgsl @@ -0,0 +1,4 @@ +fn f() { + var m = mat4x4(); + let m_1 = mat4x4(m); +} diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl new file mode 100644 index 0000000000..3968945da2 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var m = mat4x4(); diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..434fa7de64 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2bc3cdfc36 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix m = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000277C3AD2D20(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..cecf0ffc1e --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4 m = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..34c0617f9c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %4 = OpConstantNull %mat4v4half +%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half + %m = OpVariable %_ptr_Private_mat4v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c944f80308 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var m = mat4x4(); diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl new file mode 100644 index 0000000000..9a80a22bed --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl @@ -0,0 +1 @@ +var m = mat4x4(); diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a1f75e203f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1f75e203f --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 m = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..b5f43a3a5c --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4 m = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..fc3f2dd6cf --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %m "m" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %4 = OpConstantNull %mat4v4float +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %m = OpVariable %_ptr_Private_mat4v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a80a22bed --- /dev/null +++ b/test/tint/expressions/type_ctor/mat4x4/zero/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var m = mat4x4(); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl index c215909294..3b03f91f63 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl @@ -1 +1 @@ -let v = vec2(false, true); +var v = vec2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7c65ba8487 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 v = bool2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c65ba8487 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 v = bool2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.glsl index bfd0cb766d..4d0120f6c5 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const bvec2 v = bvec2(false, true); +bvec2 v = bvec2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.hlsl deleted file mode 100644 index 0ba8ae6725..0000000000 --- a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const bool2 v = bool2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.msl index 15bd21b7a2..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant bool2 v = bool2(false, true); - diff --git a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.spvasm index b982dbdbd5..f3a92363a9 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %bool = OpTypeBool %v2bool = OpTypeVector %bool 2 - %false = OpConstantFalse %bool + %3 = OpConstantNull %bool %true = OpConstantTrue %bool - %v = OpConstantComposite %v2bool %false %true + %5 = OpConstantComposite %v2bool %3 %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %v = OpVariable %_ptr_Private_v2bool Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.wgsl index c215909294..3b03f91f63 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/bool.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec2(false, true); +var v = vec2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl new file mode 100644 index 0000000000..4c41b8333e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var v = vec2(0.0h, 1.0h); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6fe8e329d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h)); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fbee362fac --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h)); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000164D3022BF0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..b925642b0c --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 v = f16vec2(0.0hf, 1.0hf); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..d1d3ed2c7b --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.spvasm @@ -0,0 +1,28 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %3 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %5 = OpConstantComposite %v2half %3 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %v = OpVariable %_ptr_Private_v2half Private %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..1525c4adb4 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var v = vec2(0.0h, 1.0h); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl index 87b10550fd..c64a997db5 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl @@ -1 +1 @@ -let v = vec2(0.0, 1.0); +var v = vec2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53ed02812f --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 v = float2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..53ed02812f --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 v = float2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.glsl index af91949ceb..e6f149f1be 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const vec2 v = vec2(0.0f, 1.0f); +vec2 v = vec2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.hlsl deleted file mode 100644 index 8802bbb621..0000000000 --- a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2 v = float2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.msl index f343a2593e..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2 v = float2(0.0f, 1.0f); - diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.spvasm index d12bbf2285..26be8307aa 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 - %float_0 = OpConstant %float 0 + %3 = OpConstantNull %float %float_1 = OpConstant %float 1 - %v = OpConstantComposite %v2float %float_0 %float_1 + %5 = OpConstantComposite %v2float %3 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %v = OpVariable %_ptr_Private_v2float Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.wgsl index 87b10550fd..c64a997db5 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec2(0.0, 1.0); +var v = vec2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl index ee90f91d6d..684570e0a3 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl @@ -1 +1 @@ -let v = vec2(0, 1); +var v = vec2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..203fe9a8f2 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 v = int2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..203fe9a8f2 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 v = int2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.glsl index ebef7ff07d..cc388f0c86 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const ivec2 v = ivec2(0, 1); +ivec2 v = ivec2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.hlsl deleted file mode 100644 index afa632e39a..0000000000 --- a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const int2 v = int2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.msl index af85d231cc..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant int2 v = int2(0, 1); - diff --git a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.spvasm index 2e021f90e8..3fdf50d78d 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %int = OpTypeInt 32 1 %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 + %3 = OpConstantNull %int %int_1 = OpConstant %int 1 - %v = OpConstantComposite %v2int %int_0 %int_1 + %5 = OpConstantComposite %v2int %3 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %v = OpVariable %_ptr_Private_v2int Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.wgsl index ee90f91d6d..684570e0a3 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/i32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec2(0, 1); +var v = vec2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl index 1b3006c3a7..1d75b1f36f 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl @@ -1 +1 @@ -let v = vec2(0u, 1u); +var v = vec2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3138b6c630 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 v = uint2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3138b6c630 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 v = uint2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.glsl index 96300974e8..0319a076ab 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const uvec2 v = uvec2(0u, 1u); +uvec2 v = uvec2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.hlsl deleted file mode 100644 index c2987138f9..0000000000 --- a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const uint2 v = uint2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.msl index 764c49a343..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant uint2 v = uint2(0u, 1u); - diff --git a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.spvasm index 8c3ad8f532..37aa2cb1d0 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %uint = OpTypeInt 32 0 %v2uint = OpTypeVector %uint 2 - %uint_0 = OpConstant %uint 0 + %3 = OpConstantNull %uint %uint_1 = OpConstant %uint 1 - %v = OpConstantComposite %v2uint %uint_0 %uint_1 + %5 = OpConstantComposite %v2uint %3 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %v = OpVariable %_ptr_Private_v2uint Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.wgsl index 1b3006c3a7..1d75b1f36f 100644 --- a/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec2/explicit/u32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec2(0u, 1u); +var v = vec2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl new file mode 100644 index 0000000000..eba6e76b86 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl @@ -0,0 +1 @@ +var v = vec2(0.0, 1.0); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53ed02812f --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 v = float2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..53ed02812f --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 v = float2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..e6f149f1be --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 v = vec2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..26be8307aa --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %3 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %5 = OpConstantComposite %v2float %3 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %v = OpVariable %_ptr_Private_v2float Private %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..eba6e76b86 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec2(0.0, 1.0); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl new file mode 100644 index 0000000000..6aabaca620 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl @@ -0,0 +1 @@ +var v = vec2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..203fe9a8f2 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 v = int2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..203fe9a8f2 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 v = int2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.glsl new file mode 100644 index 0000000000..cc388f0c86 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 v = ivec2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.spvasm new file mode 100644 index 0000000000..3fdf50d78d --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %3 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %5 = OpConstantComposite %v2int %3 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %v = OpVariable %_ptr_Private_v2int Private %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.wgsl new file mode 100644 index 0000000000..6aabaca620 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/abstract-int.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl index f5aced36db..c5bc0b15f0 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl @@ -1 +1 @@ -let v = vec2(false, true); +var v = vec2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7c65ba8487 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 v = bool2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c65ba8487 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 v = bool2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.glsl index bfd0cb766d..4d0120f6c5 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const bvec2 v = bvec2(false, true); +bvec2 v = bvec2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.hlsl deleted file mode 100644 index 0ba8ae6725..0000000000 --- a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const bool2 v = bool2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.msl index 15bd21b7a2..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant bool2 v = bool2(false, true); - diff --git a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.spvasm index b982dbdbd5..f3a92363a9 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %bool = OpTypeBool %v2bool = OpTypeVector %bool 2 - %false = OpConstantFalse %bool + %3 = OpConstantNull %bool %true = OpConstantTrue %bool - %v = OpConstantComposite %v2bool %false %true + %5 = OpConstantComposite %v2bool %3 %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %v = OpVariable %_ptr_Private_v2bool Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.wgsl index f5aced36db..c5bc0b15f0 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/bool.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec2(false, true); +var v = vec2(false, true); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl new file mode 100644 index 0000000000..3e9d814ccc --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var v = vec2(0.0h, 1.0h); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6fe8e329d0 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h)); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1147c3e77 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h)); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000218D6124C10(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..b925642b0c --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 v = f16vec2(0.0hf, 1.0hf); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..d1d3ed2c7b --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.spvasm @@ -0,0 +1,28 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %3 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %5 = OpConstantComposite %v2half %3 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %v = OpVariable %_ptr_Private_v2half Private %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..eb99f37b4f --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var v = vec2(0.0h, 1.0h); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl index e0e5dc904f..03994f3402 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl @@ -1 +1 @@ -let v = vec2(0.0, 1.0); +var v = vec2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53ed02812f --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 v = float2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..53ed02812f --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 v = float2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.glsl index af91949ceb..e6f149f1be 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const vec2 v = vec2(0.0f, 1.0f); +vec2 v = vec2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.hlsl deleted file mode 100644 index 8802bbb621..0000000000 --- a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float2 v = float2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.msl index f343a2593e..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float2 v = float2(0.0f, 1.0f); - diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.spvasm index d12bbf2285..26be8307aa 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %float = OpTypeFloat 32 %v2float = OpTypeVector %float 2 - %float_0 = OpConstant %float 0 + %3 = OpConstantNull %float %float_1 = OpConstant %float 1 - %v = OpConstantComposite %v2float %float_0 %float_1 + %5 = OpConstantComposite %v2float %3 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %v = OpVariable %_ptr_Private_v2float Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.wgsl index e0e5dc904f..03994f3402 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec2(0.0, 1.0); +var v = vec2(0.0f, 1.0f); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl index de5642e08a..4ea409db46 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl @@ -1 +1 @@ -let v = vec2(0, 1); +var v = vec2(0i, 1i); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..203fe9a8f2 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 v = int2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..203fe9a8f2 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 v = int2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.glsl index ebef7ff07d..cc388f0c86 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const ivec2 v = ivec2(0, 1); +ivec2 v = ivec2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.hlsl deleted file mode 100644 index afa632e39a..0000000000 --- a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const int2 v = int2(0, 1); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.msl index af85d231cc..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant int2 v = int2(0, 1); - diff --git a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.spvasm index 2e021f90e8..3fdf50d78d 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %int = OpTypeInt 32 1 %v2int = OpTypeVector %int 2 - %int_0 = OpConstant %int 0 + %3 = OpConstantNull %int %int_1 = OpConstant %int 1 - %v = OpConstantComposite %v2int %int_0 %int_1 + %5 = OpConstantComposite %v2int %3 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %v = OpVariable %_ptr_Private_v2int Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.wgsl index de5642e08a..4ea409db46 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/i32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec2(0, 1); +var v = vec2(0i, 1i); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl index bd3e939b06..dafac2d000 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl @@ -1 +1 @@ -let v = vec2(0u, 1u); +var v = vec2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3138b6c630 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 v = uint2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3138b6c630 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 v = uint2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.glsl index 96300974e8..0319a076ab 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const uvec2 v = uvec2(0u, 1u); +uvec2 v = uvec2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.hlsl deleted file mode 100644 index c2987138f9..0000000000 --- a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const uint2 v = uint2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.msl index 764c49a343..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant uint2 v = uint2(0u, 1u); - diff --git a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.spvasm index 8c3ad8f532..37aa2cb1d0 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %uint = OpTypeInt 32 0 %v2uint = OpTypeVector %uint 2 - %uint_0 = OpConstant %uint 0 + %3 = OpConstantNull %uint %uint_1 = OpConstant %uint 1 - %v = OpConstantComposite %v2uint %uint_0 %uint_1 + %5 = OpConstantComposite %v2uint %3 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %v = OpVariable %_ptr_Private_v2uint Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.wgsl index bd3e939b06..dafac2d000 100644 --- a/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec2/inferred/u32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec2(0u, 1u); +var v = vec2(0u, 1u); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl index 9f3a1f3852..aeee5a282d 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl @@ -1 +1 @@ -let v = vec3(false, true, false); +var v = vec3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..420e0c3155 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 v = bool3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..420e0c3155 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 v = bool3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.glsl index e7d7818003..872f1a2d9d 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const bvec3 v = bvec3(false, true, false); +bvec3 v = bvec3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.hlsl deleted file mode 100644 index d5acfa022d..0000000000 --- a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const bool3 v = bool3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.msl index 0cd9b5b483..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant bool3 v = bool3(false, true, false); - diff --git a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.spvasm index b712760ab3..587225f83c 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %bool = OpTypeBool %v3bool = OpTypeVector %bool 3 - %false = OpConstantFalse %bool + %3 = OpConstantNull %bool %true = OpConstantTrue %bool - %v = OpConstantComposite %v3bool %false %true %false + %5 = OpConstantComposite %v3bool %3 %true %3 +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %v = OpVariable %_ptr_Private_v3bool Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.wgsl index 9f3a1f3852..aeee5a282d 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/bool.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec3(false, true, false); +var v = vec3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl new file mode 100644 index 0000000000..6173e586b9 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var v = vec3(0.0h, 1.0h, 2.0h); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..06a3d9d244 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c154104b76 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000013667CF29C0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..532023413c --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 v = f16vec3(0.0hf, 1.0hf, 2.0hf); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..43d150bbd6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %3 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %6 = OpConstantComposite %v3half %3 %half_0x1p_0 %half_0x1p_1 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %v = OpVariable %_ptr_Private_v3half Private %6 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..51fe341721 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var v = vec3(0.0h, 1.0h, 2.0h); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl index 376f901c51..2815001caf 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl @@ -1 +1 @@ -let v = vec3(0.0, 1.0, 2.0); +var v = vec3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f2ffb86b97 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 v = float3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f2ffb86b97 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 v = float3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.glsl index 9f73b75785..f63fa393dd 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const vec3 v = vec3(0.0f, 1.0f, 2.0f); +vec3 v = vec3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.hlsl deleted file mode 100644 index daa5a1c21d..0000000000 --- a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float3 v = float3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.msl index b0b245a391..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float3 v = float3(0.0f, 1.0f, 2.0f); - diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.spvasm index 62e8bc30c7..5df28a4d64 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 11 +; Bound: 13 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,13 +11,15 @@ OpName %unused_entry_point "unused_entry_point" %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 - %float_0 = OpConstant %float 0 + %3 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 - %v = OpConstantComposite %v3float %float_0 %float_1 %float_2 + %6 = OpConstantComposite %v3float %3 %float_1 %float_2 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %v = OpVariable %_ptr_Private_v3float Private %6 %void = OpTypeVoid - %7 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %7 - %10 = OpLabel + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.wgsl index 376f901c51..2815001caf 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec3(0.0, 1.0, 2.0); +var v = vec3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl index 7b9ebcb87e..434bb562a3 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl @@ -1 +1 @@ -let v = vec3(0, 1, 2); +var v = vec3(0i, 1i, 2i); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fcb08024ed --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 v = int3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fcb08024ed --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 v = int3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.glsl index 0392e707da..26b55814d3 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const ivec3 v = ivec3(0, 1, 2); +ivec3 v = ivec3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.hlsl deleted file mode 100644 index 9bc1dc4652..0000000000 --- a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const int3 v = int3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.msl index 63fbce8f89..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant int3 v = int3(0, 1, 2); - diff --git a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.spvasm index fe0276e9ba..68ed2d6a15 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 11 +; Bound: 13 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,13 +11,15 @@ OpName %unused_entry_point "unused_entry_point" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 - %int_0 = OpConstant %int 0 + %3 = OpConstantNull %int %int_1 = OpConstant %int 1 %int_2 = OpConstant %int 2 - %v = OpConstantComposite %v3int %int_0 %int_1 %int_2 + %6 = OpConstantComposite %v3int %3 %int_1 %int_2 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %v = OpVariable %_ptr_Private_v3int Private %6 %void = OpTypeVoid - %7 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %7 - %10 = OpLabel + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.wgsl index 7b9ebcb87e..434bb562a3 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/i32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec3(0, 1, 2); +var v = vec3(0i, 1i, 2i); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl index 0040d27e6c..ab0e79742a 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl @@ -1 +1 @@ -let v = vec3(0u, 1u, 2u); +var v = vec3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3190b32f53 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 v = uint3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3190b32f53 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 v = uint3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.glsl index 1aabf2da89..7187970bdf 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const uvec3 v = uvec3(0u, 1u, 2u); +uvec3 v = uvec3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.hlsl deleted file mode 100644 index 18899ea0d3..0000000000 --- a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const uint3 v = uint3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.msl index 6090ecfdc8..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant uint3 v = uint3(0u, 1u, 2u); - diff --git a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.spvasm index e4b4797464..1e4e51f397 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 11 +; Bound: 13 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,13 +11,15 @@ OpName %unused_entry_point "unused_entry_point" %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 - %uint_0 = OpConstant %uint 0 + %3 = OpConstantNull %uint %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 - %v = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 + %6 = OpConstantComposite %v3uint %3 %uint_1 %uint_2 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %v = OpVariable %_ptr_Private_v3uint Private %6 %void = OpTypeVoid - %7 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %7 - %10 = OpLabel + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.wgsl index 0040d27e6c..ab0e79742a 100644 --- a/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec3/explicit/u32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec3(0u, 1u, 2u); +var v = vec3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl new file mode 100644 index 0000000000..2b4faacadf --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl @@ -0,0 +1 @@ +var v = vec3(0.0, 1.0, 2.0); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f2ffb86b97 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 v = float3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f2ffb86b97 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 v = float3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..f63fa393dd --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 v = vec3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..5df28a4d64 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %3 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %6 = OpConstantComposite %v3float %3 %float_1 %float_2 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %v = OpVariable %_ptr_Private_v3float Private %6 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..2b4faacadf --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec3(0.0, 1.0, 2.0); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl new file mode 100644 index 0000000000..1c301e1061 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl @@ -0,0 +1 @@ +var v = vec3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fcb08024ed --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 v = int3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fcb08024ed --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 v = int3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.glsl new file mode 100644 index 0000000000..26b55814d3 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 v = ivec3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.spvasm new file mode 100644 index 0000000000..68ed2d6a15 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %3 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %6 = OpConstantComposite %v3int %3 %int_1 %int_2 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %v = OpVariable %_ptr_Private_v3int Private %6 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.wgsl new file mode 100644 index 0000000000..1c301e1061 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/abstract-int.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl new file mode 100644 index 0000000000..741e88269e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl @@ -0,0 +1 @@ +var v = vec3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..420e0c3155 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 v = bool3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..420e0c3155 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 v = bool3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.glsl new file mode 100644 index 0000000000..872f1a2d9d --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec3 v = bvec3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..587225f83c --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %3 = OpConstantNull %bool + %true = OpConstantTrue %bool + %5 = OpConstantComposite %v3bool %3 %true %3 +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %v = OpVariable %_ptr_Private_v3bool Private %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..741e88269e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec3(false, true, false); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl new file mode 100644 index 0000000000..a89c48e6df --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var v = vec3(0.0h, 1.0h, 2.0h); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..06a3d9d244 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b054a69385 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h)); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000025E9B6B7060(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..532023413c --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 v = f16vec3(0.0hf, 1.0hf, 2.0hf); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..43d150bbd6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %3 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %6 = OpConstantComposite %v3half %3 %half_0x1p_0 %half_0x1p_1 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %v = OpVariable %_ptr_Private_v3half Private %6 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..d47e17ad4d --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var v = vec3(0.0h, 1.0h, 2.0h); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl new file mode 100644 index 0000000000..05ccfdd0c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl @@ -0,0 +1 @@ +var v = vec3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f2ffb86b97 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 v = float3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f2ffb86b97 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 v = float3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..f63fa393dd --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 v = vec3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..5df28a4d64 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %3 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %6 = OpConstantComposite %v3float %3 %float_1 %float_2 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %v = OpVariable %_ptr_Private_v3float Private %6 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..05ccfdd0c6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec3(0.0f, 1.0f, 2.0f); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl new file mode 100644 index 0000000000..1fbcabec46 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl @@ -0,0 +1 @@ +var v = vec3(0i, 1i, 2i); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fcb08024ed --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 v = int3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fcb08024ed --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 v = int3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.glsl new file mode 100644 index 0000000000..26b55814d3 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 v = ivec3(0, 1, 2); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..68ed2d6a15 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %3 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %6 = OpConstantComposite %v3int %3 %int_1 %int_2 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %v = OpVariable %_ptr_Private_v3int Private %6 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fbcabec46 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec3(0i, 1i, 2i); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl new file mode 100644 index 0000000000..8b6ff5af38 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl @@ -0,0 +1 @@ +var v = vec3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3190b32f53 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 v = uint3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3190b32f53 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 v = uint3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.glsl new file mode 100644 index 0000000000..7187970bdf --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec3 v = uvec3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..1e4e51f397 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %3 = OpConstantNull %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %6 = OpConstantComposite %v3uint %3 %uint_1 %uint_2 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %v = OpVariable %_ptr_Private_v3uint Private %6 + %void = OpTypeVoid + %9 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %9 + %12 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8b6ff5af38 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec3/inferred/u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec3(0u, 1u, 2u); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl index baeff0f35f..118eaf5ec2 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl @@ -1 +1 @@ -let v = vec4(false, true, false, true); +var v = vec4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c15046878 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 v = bool4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c15046878 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 v = bool4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.glsl index 11236dbca8..6b3de93f5e 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const bvec4 v = bvec4(false, true, false, true); +bvec4 v = bvec4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.hlsl deleted file mode 100644 index af7e30f4e6..0000000000 --- a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const bool4 v = bool4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.msl index 840b113e49..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant bool4 v = bool4(false, true, false, true); - diff --git a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.spvasm index 1ecbff115e..32c8adc58a 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,12 +11,14 @@ OpName %unused_entry_point "unused_entry_point" %bool = OpTypeBool %v4bool = OpTypeVector %bool 4 - %false = OpConstantFalse %bool + %3 = OpConstantNull %bool %true = OpConstantTrue %bool - %v = OpConstantComposite %v4bool %false %true %false %true + %5 = OpConstantComposite %v4bool %3 %true %3 %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %v = OpVariable %_ptr_Private_v4bool Private %5 %void = OpTypeVoid - %6 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.wgsl index baeff0f35f..118eaf5ec2 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/bool.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec4(false, true, false, true); +var v = vec4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl new file mode 100644 index 0000000000..cf7ccbface --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var v = vec4(0.h, 1.h, 2.h, 3.h); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e0eda7951 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..daae81c954 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001D7941D2A60(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4d91872dc1 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 v = f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f118e4c359 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %3 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %7 = OpConstantComposite %v4half %3 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %v = OpVariable %_ptr_Private_v4half Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8dfcf0d97 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var v = vec4(0.0h, 1.0h, 2.0h, 3.0h); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl index bb1280e19d..9ade06d992 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl @@ -1 +1 @@ -let v = vec4(0.0, 1.0, 2.0, 3.0); +var v = vec4(0.f, 1.f, 2.f, 3.f); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f518edb05e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 v = float4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f518edb05e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 v = float4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.glsl index 254bda9e7a..b0532140e8 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const vec4 v = vec4(0.0f, 1.0f, 2.0f, 3.0f); +vec4 v = vec4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.hlsl deleted file mode 100644 index bd679f3022..0000000000 --- a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const float4 v = float4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.msl index 568e746ed8..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant float4 v = float4(0.0f, 1.0f, 2.0f, 3.0f); - diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.spvasm index 783aa84a45..d98cea524e 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 12 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,14 +11,16 @@ OpName %unused_entry_point "unused_entry_point" %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 - %float_0 = OpConstant %float 0 + %3 = OpConstantNull %float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %v = OpConstantComposite %v4float %float_0 %float_1 %float_2 %float_3 + %7 = OpConstantComposite %v4float %3 %float_1 %float_2 %float_3 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %v = OpVariable %_ptr_Private_v4float Private %7 %void = OpTypeVoid - %8 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %8 - %11 = OpLabel + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.wgsl index bb1280e19d..27e5285207 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/f32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec4(0.0, 1.0, 2.0, 3.0); +var v = vec4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl index ab60e6e781..b274f75d6a 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl @@ -1 +1 @@ -let v = vec4(0, 1, 2, 3); +var v = vec4(0i, 1i, 2i, 3i); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..baeb4274da --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 v = int4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..baeb4274da --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 v = int4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.glsl index 77c907bcd1..b7c56a238e 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const ivec4 v = ivec4(0, 1, 2, 3); +ivec4 v = ivec4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.hlsl deleted file mode 100644 index 58b86cecad..0000000000 --- a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const int4 v = int4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.msl index f00d2ebbd7..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant int4 v = int4(0, 1, 2, 3); - diff --git a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.spvasm index 88201cc543..98f034707a 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 12 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,14 +11,16 @@ OpName %unused_entry_point "unused_entry_point" %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 - %int_0 = OpConstant %int 0 + %3 = OpConstantNull %int %int_1 = OpConstant %int 1 %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %v = OpConstantComposite %v4int %int_0 %int_1 %int_2 %int_3 + %7 = OpConstantComposite %v4int %3 %int_1 %int_2 %int_3 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %v = OpVariable %_ptr_Private_v4int Private %7 %void = OpTypeVoid - %8 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %8 - %11 = OpLabel + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.wgsl index ab60e6e781..b274f75d6a 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/i32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec4(0, 1, 2, 3); +var v = vec4(0i, 1i, 2i, 3i); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl index ef7c7662f5..0c12dbf6a7 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl @@ -1 +1 @@ -let v = vec4(0u, 1u, 2u, 3u); +var v = vec4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2ab778a964 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 v = uint4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ab778a964 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 v = uint4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.glsl index a6bfcaefda..8414d82aa8 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.glsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.glsl @@ -4,4 +4,4 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const uvec4 v = uvec4(0u, 1u, 2u, 3u); +uvec4 v = uvec4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.hlsl b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.hlsl deleted file mode 100644 index 014390a471..0000000000 --- a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const uint4 v = uint4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.msl index 83695b894d..466ceaa5d6 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.msl +++ b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.msl @@ -1,5 +1,3 @@ #include using namespace metal; -constant uint4 v = uint4(0u, 1u, 2u, 3u); - diff --git a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.spvasm index 23b7d4495e..b2ae7f4d89 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 12 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,14 +11,16 @@ OpName %unused_entry_point "unused_entry_point" %uint = OpTypeInt 32 0 %v4uint = OpTypeVector %uint 4 - %uint_0 = OpConstant %uint 0 + %3 = OpConstantNull %uint %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 - %v = OpConstantComposite %v4uint %uint_0 %uint_1 %uint_2 %uint_3 + %7 = OpConstantComposite %v4uint %3 %uint_1 %uint_2 %uint_3 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %v = OpVariable %_ptr_Private_v4uint Private %7 %void = OpTypeVoid - %8 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %8 - %11 = OpLabel + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.wgsl index ef7c7662f5..0c12dbf6a7 100644 --- a/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.wgsl +++ b/test/tint/expressions/type_ctor/vec4/explicit/u32.wgsl.expected.wgsl @@ -1 +1 @@ -let v = vec4(0u, 1u, 2u, 3u); +var v = vec4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl new file mode 100644 index 0000000000..3d81ce6ada --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl @@ -0,0 +1 @@ +var v = vec4(0.0, 1.0, 2.0, 3.0); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f518edb05e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 v = float4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f518edb05e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 v = float4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.glsl new file mode 100644 index 0000000000..b0532140e8 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 v = vec4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.spvasm new file mode 100644 index 0000000000..d98cea524e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %3 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %7 = OpConstantComposite %v4float %3 %float_1 %float_2 %float_3 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %v = OpVariable %_ptr_Private_v4float Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d81ce6ada --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-float.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec4(0.0, 1.0, 2.0, 3.0); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl new file mode 100644 index 0000000000..f59b42c3ec --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl @@ -0,0 +1 @@ +var v = vec4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..baeb4274da --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 v = int4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..baeb4274da --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 v = int4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.glsl new file mode 100644 index 0000000000..b7c56a238e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 v = ivec4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.spvasm new file mode 100644 index 0000000000..98f034707a --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %3 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %7 = OpConstantComposite %v4int %3 %int_1 %int_2 %int_3 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %v = OpVariable %_ptr_Private_v4int Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.wgsl new file mode 100644 index 0000000000..f59b42c3ec --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/abstract-int.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl new file mode 100644 index 0000000000..118eaf5ec2 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl @@ -0,0 +1 @@ +var v = vec4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0c15046878 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 v = bool4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0c15046878 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 v = bool4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.glsl new file mode 100644 index 0000000000..6b3de93f5e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec4 v = bvec4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..32c8adc58a --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %3 = OpConstantNull %bool + %true = OpConstantTrue %bool + %5 = OpConstantComposite %v4bool %3 %true %3 %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %v = OpVariable %_ptr_Private_v4bool Private %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..118eaf5ec2 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec4(false, true, false, true); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl new file mode 100644 index 0000000000..a8ce096191 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var v = vec4(0.0h, 1.0h, 2.0h, 3.0h); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e0eda7951 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..efef6b8df5 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector v = vector(float16_t(0.0h), float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000028825FD4A00(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4d91872dc1 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 v = f16vec4(0.0hf, 1.0hf, 2.0hf, 3.0hf); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f118e4c359 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %3 = OpConstantNull %half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %7 = OpConstantComposite %v4half %3 %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %v = OpVariable %_ptr_Private_v4half Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8dfcf0d97 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var v = vec4(0.0h, 1.0h, 2.0h, 3.0h); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl new file mode 100644 index 0000000000..27e5285207 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl @@ -0,0 +1 @@ +var v = vec4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f518edb05e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 v = float4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f518edb05e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 v = float4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.glsl new file mode 100644 index 0000000000..b0532140e8 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 v = vec4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..d98cea524e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %3 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %7 = OpConstantComposite %v4float %3 %float_1 %float_2 %float_3 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %v = OpVariable %_ptr_Private_v4float Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..27e5285207 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec4(0.0f, 1.0f, 2.0f, 3.0f); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl new file mode 100644 index 0000000000..b274f75d6a --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl @@ -0,0 +1 @@ +var v = vec4(0i, 1i, 2i, 3i); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..baeb4274da --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 v = int4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..baeb4274da --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 v = int4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.glsl new file mode 100644 index 0000000000..b7c56a238e --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 v = ivec4(0, 1, 2, 3); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..98f034707a --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %3 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %7 = OpConstantComposite %v4int %3 %int_1 %int_2 %int_3 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %v = OpVariable %_ptr_Private_v4int Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..b274f75d6a --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec4(0i, 1i, 2i, 3i); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl new file mode 100644 index 0000000000..0c12dbf6a7 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl @@ -0,0 +1 @@ +var v = vec4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2ab778a964 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 v = uint4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ab778a964 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 v = uint4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.glsl b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.glsl new file mode 100644 index 0000000000..8414d82aa8 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec4 v = uvec4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.msl b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.spvasm b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..b2ae7f4d89 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %3 = OpConstantNull %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %7 = OpConstantComposite %v4uint %3 %uint_1 %uint_2 %uint_3 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %v = OpVariable %_ptr_Private_v4uint Private %7 + %void = OpTypeVoid + %10 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %10 + %13 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.wgsl b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c12dbf6a7 --- /dev/null +++ b/test/tint/expressions/type_ctor/vec4/inferred/u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var v = vec4(0u, 1u, 2u, 3u); diff --git a/test/tint/expressions/unary/complement/complement.wgsl.expected.hlsl b/test/tint/expressions/unary/complement/complement.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/unary/complement/complement.wgsl.expected.hlsl rename to test/tint/expressions/unary/complement/complement.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/unary/complement/complement.wgsl.expected.fxc.hlsl b/test/tint/expressions/unary/complement/complement.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d3f5a689a --- /dev/null +++ b/test/tint/expressions/unary/complement/complement.wgsl.expected.fxc.hlsl @@ -0,0 +1,20 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int i(int x) { + return ~(x); +} + +uint u(uint x) { + return ~(x); +} + +int4 vi(int4 x) { + return ~(x); +} + +uint4 vu(uint4 x) { + return ~(x); +} diff --git a/test/tint/expressions/unary/negate/negate.wgsl.expected.hlsl b/test/tint/expressions/unary/negate/negate.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/unary/negate/negate.wgsl.expected.hlsl rename to test/tint/expressions/unary/negate/negate.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/unary/negate/negate.wgsl.expected.fxc.hlsl b/test/tint/expressions/unary/negate/negate.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a19621ebe6 --- /dev/null +++ b/test/tint/expressions/unary/negate/negate.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int i(int x) { + return -(x); +} + +int4 vi(int4 x) { + return -(x); +} diff --git a/test/tint/expressions/zero_init/array/bool.wgsl.expected.hlsl b/test/tint/expressions/zero_init/array/bool.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/array/bool.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/array/bool.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/array/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/array/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7231ab6fb0 --- /dev/null +++ b/test/tint/expressions/zero_init/array/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool v[4] = (bool[4])0; +} diff --git a/test/tint/expressions/zero_init/array/bool.wgsl.expected.msl b/test/tint/expressions/zero_init/array/bool.wgsl.expected.msl index ead82c7e6f..8b8b451ac4 100644 --- a/test/tint/expressions/zero_init/array/bool.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/array/bool.wgsl.expected.msl @@ -1,11 +1,20 @@ #include using namespace metal; -struct tint_array_wrapper { - bool arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; void f() { - tint_array_wrapper v = {.arr={}}; + tint_array v = tint_array{}; } diff --git a/test/tint/expressions/zero_init/array/f16.wgsl b/test/tint/expressions/zero_init/array/f16.wgsl new file mode 100644 index 0000000000..cbf5b94078 --- /dev/null +++ b/test/tint/expressions/zero_init/array/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = array(); +} diff --git a/test/tint/expressions/zero_init/array/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/array/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..074f6185fd --- /dev/null +++ b/test/tint/expressions/zero_init/array/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float16_t v[4] = (float16_t[4])0; +} diff --git a/test/tint/expressions/zero_init/array/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/array/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c261d4cca --- /dev/null +++ b/test/tint/expressions/zero_init/array/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float16_t v[4] = (float16_t[4])0; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C7D06B43D0(7,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001C7D06B43D0(7,13): error X3000: unrecognized identifier 'v' + diff --git a/test/tint/expressions/zero_init/array/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/array/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..d9215978ee --- /dev/null +++ b/test/tint/expressions/zero_init/array/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + float16_t v[4] = float16_t[4](0.0hf, 0.0hf, 0.0hf, 0.0hf); +} + diff --git a/test/tint/expressions/zero_init/array/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/array/f16.wgsl.expected.msl new file mode 100644 index 0000000000..d5a7e30019 --- /dev/null +++ b/test/tint/expressions/zero_init/array/f16.wgsl.expected.msl @@ -0,0 +1,20 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void f() { + tint_array v = tint_array{}; +} + diff --git a/test/tint/expressions/zero_init/array/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/array/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..de57b6f259 --- /dev/null +++ b/test/tint/expressions/zero_init/array/f16.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + OpDecorate %_arr_half_uint_4 ArrayStride 2 + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_half_uint_4 = OpTypeArray %half %uint_4 + %11 = OpConstantNull %_arr_half_uint_4 +%_ptr_Function__arr_half_uint_4 = OpTypePointer Function %_arr_half_uint_4 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function__arr_half_uint_4 Function %11 + OpStore %v %11 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/array/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/array/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a84593a4e9 --- /dev/null +++ b/test/tint/expressions/zero_init/array/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = array(); +} diff --git a/test/tint/expressions/zero_init/array/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/array/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/array/f32.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/array/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/array/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/array/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fdd7f6fe23 --- /dev/null +++ b/test/tint/expressions/zero_init/array/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float v[4] = (float[4])0; +} diff --git a/test/tint/expressions/zero_init/array/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/array/f32.wgsl.expected.msl index 7a8df6c368..60e142d2c0 100644 --- a/test/tint/expressions/zero_init/array/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/array/f32.wgsl.expected.msl @@ -1,11 +1,20 @@ #include using namespace metal; -struct tint_array_wrapper { - float arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; void f() { - tint_array_wrapper v = {.arr={}}; + tint_array v = tint_array{}; } diff --git a/test/tint/expressions/zero_init/array/i32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/array/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/array/i32.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/array/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/array/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/array/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0b0cdfc711 --- /dev/null +++ b/test/tint/expressions/zero_init/array/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int v[4] = (int[4])0; +} diff --git a/test/tint/expressions/zero_init/array/i32.wgsl.expected.msl b/test/tint/expressions/zero_init/array/i32.wgsl.expected.msl index e8cd266394..42ecab73c5 100644 --- a/test/tint/expressions/zero_init/array/i32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/array/i32.wgsl.expected.msl @@ -1,11 +1,20 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; void f() { - tint_array_wrapper v = {.arr={}}; + tint_array v = tint_array{}; } diff --git a/test/tint/expressions/zero_init/array/struct.wgsl.expected.hlsl b/test/tint/expressions/zero_init/array/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/array/struct.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/array/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/array/struct.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/array/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f8250ba175 --- /dev/null +++ b/test/tint/expressions/zero_init/array/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int i; + uint u; + float f; + bool b; +}; + +void f() { + S v[4] = (S[4])0; +} diff --git a/test/tint/expressions/zero_init/array/struct.wgsl.expected.msl b/test/tint/expressions/zero_init/array/struct.wgsl.expected.msl index 79d7fd70d9..510189125e 100644 --- a/test/tint/expressions/zero_init/array/struct.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/array/struct.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { int i; uint u; @@ -8,11 +21,7 @@ struct S { bool b; }; -struct tint_array_wrapper { - S arr[4]; -}; - void f() { - tint_array_wrapper v = {.arr={}}; + tint_array v = tint_array{}; } diff --git a/test/tint/expressions/zero_init/array/u32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/array/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/array/u32.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/array/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/array/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/array/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..acb74fc361 --- /dev/null +++ b/test/tint/expressions/zero_init/array/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint v[4] = (uint[4])0; +} diff --git a/test/tint/expressions/zero_init/array/u32.wgsl.expected.msl b/test/tint/expressions/zero_init/array/u32.wgsl.expected.msl index 83dceb066b..b2f713554d 100644 --- a/test/tint/expressions/zero_init/array/u32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/array/u32.wgsl.expected.msl @@ -1,11 +1,20 @@ #include using namespace metal; -struct tint_array_wrapper { - uint arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; void f() { - tint_array_wrapper v = {.arr={}}; + tint_array v = tint_array{}; } diff --git a/test/tint/expressions/zero_init/mat2x2/f16.wgsl b/test/tint/expressions/zero_init/mat2x2/f16.wgsl new file mode 100644 index 0000000000..3a5e24072e --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x2/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = mat2x2(); +} diff --git a/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..440cd35c79 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} diff --git a/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5f7bb9c6a --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000026AC08B2AA0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1c6ba8853d --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat2 v = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf)); +} + diff --git a/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.msl new file mode 100644 index 0000000000..1f9c7461ce --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half2x2 v = half2x2(half2(0.0h), half2(0.0h)); +} + diff --git a/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..aca7f738f2 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %10 = OpConstantNull %mat2v2half +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_mat2v2half Function %10 + OpStore %v %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d4b98ef8c --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x2/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = mat2x2(); +} diff --git a/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..098caae33b --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x2 v = float2x2((0.0f).xx, (0.0f).xx); +} diff --git a/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..098caae33b --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x2 v = float2x2((0.0f).xx, (0.0f).xx); +} diff --git a/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.glsl index e9d2689786..3f147cc3e3 100644 --- a/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - mat2 v = mat2(0.0f, 0.0f, 0.0f, 0.0f); + mat2 v = mat2(vec2(0.0f), vec2(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.hlsl deleted file mode 100644 index d711f2289f..0000000000 --- a/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float2x2 v = float2x2(0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.msl index 323a16b57a..fe3798dabd 100644 --- a/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/mat2x2/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float2x2 v = float2x2(); + float2x2 v = float2x2(float2(0.0f), float2(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat2x3/f16.wgsl b/test/tint/expressions/zero_init/mat2x3/f16.wgsl new file mode 100644 index 0000000000..36f1a1e2b8 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x3/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = mat2x3(); +} diff --git a/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4e3864ba0b --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} diff --git a/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2fa29e416 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001F989322760(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a8c24f72fc --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat2x3 v = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf)); +} + diff --git a/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..f01c3c69d3 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half2x3 v = half2x3(half3(0.0h), half3(0.0h)); +} + diff --git a/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ba09a9aaf --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %10 = OpConstantNull %mat2v3half +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_mat2v3half Function %10 + OpStore %v %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b526f861af --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x3/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = mat2x3(); +} diff --git a/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bef617cae9 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x3 v = float2x3((0.0f).xxx, (0.0f).xxx); +} diff --git a/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bef617cae9 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x3 v = float2x3((0.0f).xxx, (0.0f).xxx); +} diff --git a/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.glsl index 3f6a35722f..3225bdd1cf 100644 --- a/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - mat2x3 v = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat2x3 v = mat2x3(vec3(0.0f), vec3(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.hlsl deleted file mode 100644 index 76872743a9..0000000000 --- a/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float2x3 v = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.msl index 6b1c1a6d8a..97feea8104 100644 --- a/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/mat2x3/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float2x3 v = float2x3(); + float2x3 v = float2x3(float3(0.0f), float3(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat2x4/f16.wgsl b/test/tint/expressions/zero_init/mat2x4/f16.wgsl new file mode 100644 index 0000000000..9489503280 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x4/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = mat2x4(); +} diff --git a/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4cf375d3ff --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} diff --git a/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11cd97ce96 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000216FF5427E0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..923caed0a3 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat2x4 v = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf)); +} + diff --git a/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.msl new file mode 100644 index 0000000000..89880f59a3 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half2x4 v = half2x4(half4(0.0h), half4(0.0h)); +} + diff --git a/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..d617e59457 --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %10 = OpConstantNull %mat2v4half +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_mat2v4half Function %10 + OpStore %v %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..320c26f69a --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x4/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = mat2x4(); +} diff --git a/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f4458617ff --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x4 v = float2x4((0.0f).xxxx, (0.0f).xxxx); +} diff --git a/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f4458617ff --- /dev/null +++ b/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2x4 v = float2x4((0.0f).xxxx, (0.0f).xxxx); +} diff --git a/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.glsl index 83704ab2f5..0623f34d2e 100644 --- a/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - mat2x4 v = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat2x4 v = mat2x4(vec4(0.0f), vec4(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.hlsl deleted file mode 100644 index fee298a456..0000000000 --- a/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float2x4 v = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.msl index 07088be241..d078a6dc3b 100644 --- a/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/mat2x4/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float2x4 v = float2x4(); + float2x4 v = float2x4(float4(0.0f), float4(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat3x2/f16.wgsl b/test/tint/expressions/zero_init/mat3x2/f16.wgsl new file mode 100644 index 0000000000..cb4d5421b9 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x2/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = mat3x2(); +} diff --git a/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4fb4e3eb1f --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} diff --git a/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..05e0405ecb --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000027C22166760(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..6a82cc5944 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat3x2 v = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + diff --git a/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.msl new file mode 100644 index 0000000000..46feabe818 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half3x2 v = half3x2(half2(0.0h), half2(0.0h), half2(0.0h)); +} + diff --git a/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5db7c1368 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %10 = OpConstantNull %mat3v2half +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_mat3v2half Function %10 + OpStore %v %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..73c7acd2eb --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x2/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = mat3x2(); +} diff --git a/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7b4b4e37ad --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x2 v = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx); +} diff --git a/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b4b4e37ad --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x2 v = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx); +} diff --git a/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.glsl index 08b7b21ecf..8c85eb3e18 100644 --- a/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - mat3x2 v = mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat3x2 v = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.hlsl deleted file mode 100644 index 69c6a43c10..0000000000 --- a/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float3x2 v = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.msl index 8f611d235c..333cabf712 100644 --- a/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/mat3x2/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float3x2 v = float3x2(); + float3x2 v = float3x2(float2(0.0f), float2(0.0f), float2(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat3x3/f16.wgsl b/test/tint/expressions/zero_init/mat3x3/f16.wgsl new file mode 100644 index 0000000000..dfdf7ea90f --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x3/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = mat3x3(); +} diff --git a/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c582e52b2e --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} diff --git a/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7602999f4f --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000021D6A972A90(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4359d06d31 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat3 v = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + diff --git a/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..6190f9ad85 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half3x3 v = half3x3(half3(0.0h), half3(0.0h), half3(0.0h)); +} + diff --git a/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..68be909515 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %10 = OpConstantNull %mat3v3half +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_mat3v3half Function %10 + OpStore %v %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..89bedbd12a --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x3/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = mat3x3(); +} diff --git a/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f4baaf47fe --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x3 v = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); +} diff --git a/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f4baaf47fe --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x3 v = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); +} diff --git a/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.glsl index f0ba4a9606..eee3dad693 100644 --- a/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - mat3 v = mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat3 v = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.hlsl deleted file mode 100644 index a75039f80e..0000000000 --- a/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float3x3 v = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.msl index 46aa385cfa..9d404a42c3 100644 --- a/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/mat3x3/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float3x3 v = float3x3(); + float3x3 v = float3x3(float3(0.0f), float3(0.0f), float3(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat3x4/f16.wgsl b/test/tint/expressions/zero_init/mat3x4/f16.wgsl new file mode 100644 index 0000000000..45e5d705c7 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x4/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = mat3x4(); +} diff --git a/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..269e523530 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} diff --git a/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..44961fceb9 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001FC83E62640(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..59565ccb45 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat3x4 v = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + diff --git a/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.msl new file mode 100644 index 0000000000..5fe56bd6a3 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half3x4 v = half3x4(half4(0.0h), half4(0.0h), half4(0.0h)); +} + diff --git a/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..700924f816 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %10 = OpConstantNull %mat3v4half +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_mat3v4half Function %10 + OpStore %v %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..204d830213 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x4/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = mat3x4(); +} diff --git a/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4f3a733dc8 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x4 v = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); +} diff --git a/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4f3a733dc8 --- /dev/null +++ b/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3x4 v = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); +} diff --git a/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.glsl index 45b100ca32..b11a3afe1a 100644 --- a/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - mat3x4 v = mat3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat3x4 v = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.hlsl deleted file mode 100644 index 2b08d5f47e..0000000000 --- a/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float3x4 v = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.msl index 21f15d0b22..85d73cf8a7 100644 --- a/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/mat3x4/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float3x4 v = float3x4(); + float3x4 v = float3x4(float4(0.0f), float4(0.0f), float4(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat4x2/f16.wgsl b/test/tint/expressions/zero_init/mat4x2/f16.wgsl new file mode 100644 index 0000000000..724efc4839 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x2/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = mat4x2(); +} diff --git a/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..301532eb2a --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} diff --git a/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..273a3fca5b --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000021A5C7026F0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..12705716ac --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat4x2 v = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf)); +} + diff --git a/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.msl new file mode 100644 index 0000000000..690ed345a6 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half4x2 v = half4x2(half2(0.0h), half2(0.0h), half2(0.0h), half2(0.0h)); +} + diff --git a/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..552b59c387 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %10 = OpConstantNull %mat4v2half +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_mat4v2half Function %10 + OpStore %v %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..76de39042a --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x2/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = mat4x2(); +} diff --git a/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64638f7533 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x2 v = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx); +} diff --git a/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64638f7533 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x2 v = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx); +} diff --git a/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.glsl index 5c7e392e7e..a207606f92 100644 --- a/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - mat4x2 v = mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat4x2 v = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.hlsl deleted file mode 100644 index ceba05a00b..0000000000 --- a/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float4x2 v = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.msl index 5c2410f7ac..ac56eedd17 100644 --- a/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/mat4x2/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float4x2 v = float4x2(); + float4x2 v = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat4x3/f16.wgsl b/test/tint/expressions/zero_init/mat4x3/f16.wgsl new file mode 100644 index 0000000000..f9a3bd579f --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x3/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = mat4x3(); +} diff --git a/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2cacd728f1 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} diff --git a/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..419dd8d789 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000261642D2630(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1adf5bf371 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat4x3 v = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf)); +} + diff --git a/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..95f2f343df --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half4x3 v = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h)); +} + diff --git a/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f3f12fe9cf --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %10 = OpConstantNull %mat4v3half +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_mat4v3half Function %10 + OpStore %v %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..96fe8b6b5d --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x3/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = mat4x3(); +} diff --git a/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..15083b5319 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x3 v = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); +} diff --git a/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15083b5319 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x3 v = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); +} diff --git a/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.glsl index 998cfc1ce2..76492d6147 100644 --- a/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - mat4x3 v = mat4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat4x3 v = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.hlsl deleted file mode 100644 index 6b43a167cf..0000000000 --- a/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float4x3 v = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.msl index 80c8b94d7f..555091d84e 100644 --- a/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/mat4x3/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float4x3 v = float4x3(); + float4x3 v = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat4x4/f16.wgsl b/test/tint/expressions/zero_init/mat4x4/f16.wgsl new file mode 100644 index 0000000000..dc3d454842 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x4/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = mat4x4(); +} diff --git a/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2e9f3c848a --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} diff --git a/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3628197fd3 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + matrix v = matrix((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001B8769B2170(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..aa4d80f5a8 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16mat4 v = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf)); +} + diff --git a/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.msl new file mode 100644 index 0000000000..5b903cca18 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half4x4 v = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h)); +} + diff --git a/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..8255663594 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %10 = OpConstantNull %mat4v4half +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_mat4v4half Function %10 + OpStore %v %10 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..d6e0bfb5a3 --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x4/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = mat4x4(); +} diff --git a/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d72e99852d --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x4 v = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); +} diff --git a/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d72e99852d --- /dev/null +++ b/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4x4 v = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); +} diff --git a/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.glsl index aaa3044be9..83f05ce12c 100644 --- a/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - mat4 v = mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat4 v = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f)); } diff --git a/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.hlsl deleted file mode 100644 index 72825c9119..0000000000 --- a/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float4x4 v = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.msl index 9b2c252ed4..e25f4b3cbd 100644 --- a/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/mat4x4/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float4x4 v = float4x4(); + float4x4 v = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f)); } diff --git a/test/tint/expressions/zero_init/scalar/bool.wgsl.expected.hlsl b/test/tint/expressions/zero_init/scalar/bool.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/scalar/bool.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/scalar/bool.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/scalar/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/scalar/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e3a07b66e9 --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool v = false; +} diff --git a/test/tint/expressions/zero_init/scalar/bool.wgsl.expected.msl b/test/tint/expressions/zero_init/scalar/bool.wgsl.expected.msl index a68d88c79d..0913b4c7fb 100644 --- a/test/tint/expressions/zero_init/scalar/bool.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/scalar/bool.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - bool v = bool(); + bool v = false; } diff --git a/test/tint/expressions/zero_init/scalar/f16.wgsl b/test/tint/expressions/zero_init/scalar/f16.wgsl new file mode 100644 index 0000000000..9e07943e7d --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = f16(); +} diff --git a/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d38fa9abbe --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float16_t v = float16_t(0.0h); +} diff --git a/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..089063681a --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float16_t v = float16_t(0.0h); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000026A4CFF2ED0(7,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000026A4CFF2ED0(7,13): error X3000: unrecognized identifier 'v' + diff --git a/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5411d76897 --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + float16_t v = 0.0hf; +} + diff --git a/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.msl new file mode 100644 index 0000000000..e8948e78b7 --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half v = 0.0h; +} + diff --git a/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..440d40a7b8 --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %8 = OpConstantNull %half +%_ptr_Function_half = OpTypePointer Function %half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_half Function %8 + OpStore %v %8 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..eacde46e10 --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = f16(); +} diff --git a/test/tint/expressions/zero_init/scalar/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/scalar/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/scalar/f32.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/scalar/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/scalar/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/scalar/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ed23c73028 --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float v = 0.0f; +} diff --git a/test/tint/expressions/zero_init/scalar/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/scalar/f32.wgsl.expected.msl index 7e8266ed6a..04daba28db 100644 --- a/test/tint/expressions/zero_init/scalar/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/scalar/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float v = float(); + float v = 0.0f; } diff --git a/test/tint/expressions/zero_init/scalar/i32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/scalar/i32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/scalar/i32.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/scalar/i32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/scalar/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/scalar/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd9b566641 --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int v = 0; +} diff --git a/test/tint/expressions/zero_init/scalar/i32.wgsl.expected.msl b/test/tint/expressions/zero_init/scalar/i32.wgsl.expected.msl index 222df20d76..cffd2c1b24 100644 --- a/test/tint/expressions/zero_init/scalar/i32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/scalar/i32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - int v = int(); + int v = 0; } diff --git a/test/tint/expressions/zero_init/scalar/u32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/scalar/u32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/scalar/u32.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/scalar/u32.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/scalar/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/scalar/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..58f3b9a8aa --- /dev/null +++ b/test/tint/expressions/zero_init/scalar/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint v = 0u; +} diff --git a/test/tint/expressions/zero_init/scalar/u32.wgsl.expected.msl b/test/tint/expressions/zero_init/scalar/u32.wgsl.expected.msl index e11e857be4..1e9a665290 100644 --- a/test/tint/expressions/zero_init/scalar/u32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/scalar/u32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - uint v = uint(); + uint v = 0u; } diff --git a/test/tint/expressions/zero_init/struct/array.wgsl.expected.hlsl b/test/tint/expressions/zero_init/struct/array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/struct/array.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/struct/array.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/struct/array.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/struct/array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b9d582cbc --- /dev/null +++ b/test/tint/expressions/zero_init/struct/array.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + float a[4]; +}; + +void f() { + S v = (S)0; +} diff --git a/test/tint/expressions/zero_init/struct/array.wgsl.expected.msl b/test/tint/expressions/zero_init/struct/array.wgsl.expected.msl index 260053689d..7d32cc34a5 100644 --- a/test/tint/expressions/zero_init/struct/array.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/struct/array.wgsl.expected.msl @@ -1,15 +1,24 @@ #include using namespace metal; -struct tint_array_wrapper { - float arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct S { - tint_array_wrapper a; + tint_array a; }; void f() { - S v = {}; + S v = S{}; } diff --git a/test/tint/expressions/zero_init/struct/scalar.wgsl.expected.hlsl b/test/tint/expressions/zero_init/struct/scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/expressions/zero_init/struct/scalar.wgsl.expected.hlsl rename to test/tint/expressions/zero_init/struct/scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/expressions/zero_init/struct/scalar.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/struct/scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0547345ec0 --- /dev/null +++ b/test/tint/expressions/zero_init/struct/scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int i; + uint u; + float f; + bool b; +}; + +void f() { + S v = (S)0; +} diff --git a/test/tint/expressions/zero_init/struct/scalar.wgsl.expected.msl b/test/tint/expressions/zero_init/struct/scalar.wgsl.expected.msl index b72ea5e63e..f63b27c232 100644 --- a/test/tint/expressions/zero_init/struct/scalar.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/struct/scalar.wgsl.expected.msl @@ -9,6 +9,6 @@ struct S { }; void f() { - S v = {}; + S v = S{}; } diff --git a/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f88df09251 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool2 v = (false).xx; +} diff --git a/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f88df09251 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool2 v = (false).xx; +} diff --git a/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.glsl index fb810226b2..06b825e33b 100644 --- a/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - bvec2 v = bvec2(false, false); + bvec2 v = bvec2(false); } diff --git a/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.hlsl deleted file mode 100644 index bad31ebdf8..0000000000 --- a/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - bool2 v = bool2(false, false); -} diff --git a/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.msl b/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.msl index fd03aaf1b9..91af3c746e 100644 --- a/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec2/bool.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - bool2 v = bool2(); + bool2 v = bool2(false); } diff --git a/test/tint/expressions/zero_init/vec2/f16.wgsl b/test/tint/expressions/zero_init/vec2/f16.wgsl new file mode 100644 index 0000000000..ed7c07db3a --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = vec2(); +} diff --git a/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8edfe3cb50 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v = (float16_t(0.0h)).xx; +} diff --git a/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..086c082ed8 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v = (float16_t(0.0h)).xx; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x000001584E715AC0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..c89f9b3abe --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16vec2 v = f16vec2(0.0hf); +} + diff --git a/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.msl new file mode 100644 index 0000000000..055baac7d0 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half2 v = half2(0.0h); +} + diff --git a/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..55cddace68 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %9 = OpConstantNull %v2half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_v2half Function %9 + OpStore %v %9 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ab1bf3ef3c --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = vec2(); +} diff --git a/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..62eb9b0a85 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2 v = (0.0f).xx; +} diff --git a/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..62eb9b0a85 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float2 v = (0.0f).xx; +} diff --git a/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.glsl index a619be588b..45d7313401 100644 --- a/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - vec2 v = vec2(0.0f, 0.0f); + vec2 v = vec2(0.0f); } diff --git a/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.hlsl deleted file mode 100644 index 45a2969de6..0000000000 --- a/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float2 v = float2(0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.msl index 07013f1e94..39f121ae00 100644 --- a/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec2/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float2 v = float2(); + float2 v = float2(0.0f); } diff --git a/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..51cb931bb3 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int2 v = (0).xx; +} diff --git a/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..51cb931bb3 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int2 v = (0).xx; +} diff --git a/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.glsl index fe7adc5a84..c4e266039a 100644 --- a/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - ivec2 v = ivec2(0, 0); + ivec2 v = ivec2(0); } diff --git a/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.hlsl deleted file mode 100644 index 8c92953daf..0000000000 --- a/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - int2 v = int2(0, 0); -} diff --git a/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.msl b/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.msl index d29f4d1df9..2732848ad1 100644 --- a/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec2/i32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - int2 v = int2(); + int2 v = int2(0); } diff --git a/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..102c0df719 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint2 v = (0u).xx; +} diff --git a/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..102c0df719 --- /dev/null +++ b/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint2 v = (0u).xx; +} diff --git a/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.glsl index c40ee0b517..f28336028e 100644 --- a/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - uvec2 v = uvec2(0u, 0u); + uvec2 v = uvec2(0u); } diff --git a/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.hlsl deleted file mode 100644 index 4b9581f773..0000000000 --- a/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - uint2 v = uint2(0u, 0u); -} diff --git a/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.msl b/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.msl index 9c0f70cf37..e47d1d37fa 100644 --- a/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec2/u32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - uint2 v = uint2(); + uint2 v = uint2(0u); } diff --git a/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b81df980c8 --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool3 v = (false).xxx; +} diff --git a/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b81df980c8 --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool3 v = (false).xxx; +} diff --git a/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.glsl index 3582149ebc..b742fc02ae 100644 --- a/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - bvec3 v = bvec3(false, false, false); + bvec3 v = bvec3(false); } diff --git a/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.hlsl deleted file mode 100644 index 5e6f7f7064..0000000000 --- a/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - bool3 v = bool3(false, false, false); -} diff --git a/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.msl b/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.msl index fa8cb80ed5..c09ff79e40 100644 --- a/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec3/bool.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - bool3 v = bool3(); + bool3 v = bool3(false); } diff --git a/test/tint/expressions/zero_init/vec3/f16.wgsl b/test/tint/expressions/zero_init/vec3/f16.wgsl new file mode 100644 index 0000000000..bcea251ff5 --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = vec3(); +} diff --git a/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4be6a51fdc --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v = (float16_t(0.0h)).xxx; +} diff --git a/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f1cb0565c4 --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v = (float16_t(0.0h)).xxx; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x00000178F2A23920(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..597b731c53 --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16vec3 v = f16vec3(0.0hf); +} + diff --git a/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.msl new file mode 100644 index 0000000000..18252f12b6 --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half3 v = half3(0.0h); +} + diff --git a/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0112142c03 --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %9 = OpConstantNull %v3half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_v3half Function %9 + OpStore %v %9 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..9394b4e1df --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = vec3(); +} diff --git a/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46b01ec855 --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3 v = (0.0f).xxx; +} diff --git a/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..46b01ec855 --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float3 v = (0.0f).xxx; +} diff --git a/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.glsl index 113de8b079..6a1d2b9c1a 100644 --- a/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - vec3 v = vec3(0.0f, 0.0f, 0.0f); + vec3 v = vec3(0.0f); } diff --git a/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.hlsl deleted file mode 100644 index 6f4b969e08..0000000000 --- a/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float3 v = float3(0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.msl index c40910cd65..e6660e3f13 100644 --- a/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec3/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float3 v = float3(); + float3 v = float3(0.0f); } diff --git a/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..90c77ca85d --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int3 v = (0).xxx; +} diff --git a/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..90c77ca85d --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int3 v = (0).xxx; +} diff --git a/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.glsl index fe9a4cdd44..30c1594180 100644 --- a/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - ivec3 v = ivec3(0, 0, 0); + ivec3 v = ivec3(0); } diff --git a/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.hlsl deleted file mode 100644 index 5f68dd83b1..0000000000 --- a/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - int3 v = int3(0, 0, 0); -} diff --git a/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.msl b/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.msl index 86777661cc..8a0e41e797 100644 --- a/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec3/i32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - int3 v = int3(); + int3 v = int3(0); } diff --git a/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..77de9cadbf --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint3 v = (0u).xxx; +} diff --git a/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77de9cadbf --- /dev/null +++ b/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint3 v = (0u).xxx; +} diff --git a/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.glsl index 151277875a..37a2115e8d 100644 --- a/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - uvec3 v = uvec3(0u, 0u, 0u); + uvec3 v = uvec3(0u); } diff --git a/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.hlsl deleted file mode 100644 index 01274d3af9..0000000000 --- a/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - uint3 v = uint3(0u, 0u, 0u); -} diff --git a/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.msl b/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.msl index bb2de04b9d..2460883a7d 100644 --- a/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec3/u32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - uint3 v = uint3(); + uint3 v = uint3(0u); } diff --git a/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..68855f2890 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool4 v = (false).xxxx; +} diff --git a/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..68855f2890 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + bool4 v = (false).xxxx; +} diff --git a/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.glsl index 21a558f235..44d05dd5ba 100644 --- a/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - bvec4 v = bvec4(false, false, false, false); + bvec4 v = bvec4(false); } diff --git a/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.hlsl deleted file mode 100644 index af6543dc9e..0000000000 --- a/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - bool4 v = bool4(false, false, false, false); -} diff --git a/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.msl b/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.msl index 0d3be82417..757574d093 100644 --- a/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec4/bool.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - bool4 v = bool4(); + bool4 v = bool4(false); } diff --git a/test/tint/expressions/zero_init/vec4/f16.wgsl b/test/tint/expressions/zero_init/vec4/f16.wgsl new file mode 100644 index 0000000000..261f5a5645 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +fn f() { + var v = vec4(); +} diff --git a/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ff622c072f --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v = (float16_t(0.0h)).xxxx; +} diff --git a/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..22ad739bc6 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + vector v = (float16_t(0.0h)).xxxx; +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\Shader@0x0000025C4B7127F0(7,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.glsl new file mode 100644 index 0000000000..429268ebd4 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + f16vec4 v = f16vec4(0.0hf); +} + diff --git a/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.msl b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.msl new file mode 100644 index 0000000000..66d27d5763 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +void f() { + half4 v = half4(0.0h); +} + diff --git a/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.spvasm b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..ca0e483886 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %9 = OpConstantNull %v4half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + %v = OpVariable %_ptr_Function_v4half Function %9 + OpStore %v %9 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.wgsl b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0516045674 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/f16.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +enable f16; + +fn f() { + var v = vec4(); +} diff --git a/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b417e1b99b --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4 v = (0.0f).xxxx; +} diff --git a/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b417e1b99b --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + float4 v = (0.0f).xxxx; +} diff --git a/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.glsl index 09d7ecba90..36bf89a7fa 100644 --- a/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - vec4 v = vec4(0.0f, 0.0f, 0.0f, 0.0f); + vec4 v = vec4(0.0f); } diff --git a/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.hlsl deleted file mode 100644 index 77c44c2fcd..0000000000 --- a/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); -} diff --git a/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.msl b/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.msl index 76c2b7798c..c3f90b5f96 100644 --- a/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec4/f32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - float4 v = float4(); + float4 v = float4(0.0f); } diff --git a/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cfe08fbe18 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int4 v = (0).xxxx; +} diff --git a/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cfe08fbe18 --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int4 v = (0).xxxx; +} diff --git a/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.glsl index 52b1af7c01..361d05abea 100644 --- a/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - ivec4 v = ivec4(0, 0, 0, 0); + ivec4 v = ivec4(0); } diff --git a/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.hlsl deleted file mode 100644 index 5df80272b0..0000000000 --- a/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - int4 v = int4(0, 0, 0, 0); -} diff --git a/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.msl b/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.msl index 78ebdab612..8d8ee8e5cc 100644 --- a/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec4/i32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - int4 v = int4(); + int4 v = int4(0); } diff --git a/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..60e5fe4b7e --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint4 v = (0u).xxxx; +} diff --git a/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60e5fe4b7e --- /dev/null +++ b/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + uint4 v = (0u).xxxx; +} diff --git a/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.glsl b/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.glsl index 61fe7e5b60..56cfba100e 100644 --- a/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.glsl +++ b/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.glsl @@ -5,6 +5,6 @@ void unused_entry_point() { return; } void f() { - uvec4 v = uvec4(0u, 0u, 0u, 0u); + uvec4 v = uvec4(0u); } diff --git a/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.hlsl b/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.hlsl deleted file mode 100644 index 0a7eccdc22..0000000000 --- a/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void f() { - uint4 v = uint4(0u, 0u, 0u, 0u); -} diff --git a/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.msl b/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.msl index 9d55361706..bb5fafabc0 100644 --- a/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.msl +++ b/test/tint/expressions/zero_init/vec4/u32.wgsl.expected.msl @@ -2,6 +2,6 @@ using namespace metal; void f() { - uint4 v = uint4(); + uint4 v = uint4(0u); } diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl b/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl deleted file mode 100644 index 9ed8f61592..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2022 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Enable a void internal extension -enable InternalExtensionForTesting; - -fn bar() { -} - -@stage(fragment) -fn main() -> @location(0) vec4 { - var a : vec2 = vec2(); - bar(); - return vec4(0.4, 0.4, 0.8, 1.0); -} diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.glsl b/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.glsl deleted file mode 100644 index 995583f921..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.glsl +++ /dev/null @@ -1,18 +0,0 @@ -#version 310 es -precision mediump float; - -layout(location = 0) out vec4 value; -void bar() { -} - -vec4 tint_symbol() { - vec2 a = vec2(0.0f, 0.0f); - bar(); - return vec4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); -} - -void main() { - vec4 inner_result = tint_symbol(); - value = inner_result; - return; -} diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.hlsl b/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.hlsl deleted file mode 100644 index 93c7fa7301..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.hlsl +++ /dev/null @@ -1,19 +0,0 @@ -void bar() { -} - -struct tint_symbol { - float4 value : SV_Target0; -}; - -float4 main_inner() { - float2 a = float2(0.0f, 0.0f); - bar(); - return float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); -} - -tint_symbol main() { - const float4 inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.msl b/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.msl deleted file mode 100644 index d7fde539d8..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.msl +++ /dev/null @@ -1,23 +0,0 @@ -#include - -using namespace metal; -void bar() { -} - -struct tint_symbol_1 { - float4 value [[color(0)]]; -}; - -float4 tint_symbol_inner() { - float2 a = float2(); - bar(); - return float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); -} - -fragment tint_symbol_1 tint_symbol() { - float4 const inner_result = tint_symbol_inner(); - tint_symbol_1 wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.spvasm b/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.spvasm deleted file mode 100644 index f07e733007..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.spvasm +++ /dev/null @@ -1,47 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 25 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %value - OpExecutionMode %main OriginUpperLeft - OpName %value "value" - OpName %bar "bar" - OpName %main_inner "main_inner" - OpName %a "a" - OpName %main "main" - OpDecorate %value Location 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 - %void = OpTypeVoid - %6 = OpTypeFunction %void - %10 = OpTypeFunction %v4float - %v2float = OpTypeVector %float 2 - %14 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%float_0_400000006 = OpConstant %float 0.400000006 -%float_0_800000012 = OpConstant %float 0.800000012 - %float_1 = OpConstant %float 1 - %21 = OpConstantComposite %v4float %float_0_400000006 %float_0_400000006 %float_0_800000012 %float_1 - %bar = OpFunction %void None %6 - %9 = OpLabel - OpReturn - OpFunctionEnd - %main_inner = OpFunction %v4float None %10 - %12 = OpLabel - %a = OpVariable %_ptr_Function_v2float Function %14 - OpStore %a %14 - %17 = OpFunctionCall %void %bar - OpReturnValue %21 - OpFunctionEnd - %main = OpFunction %void None %6 - %23 = OpLabel - %24 = OpFunctionCall %v4float %main_inner - OpStore %value %24 - OpReturn - OpFunctionEnd diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.wgsl b/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.wgsl deleted file mode 100644 index 987fb57fa8..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_InternalExtensionForTesting.wgsl.expected.wgsl +++ /dev/null @@ -1,11 +0,0 @@ -enable InternalExtensionForTesting; - -fn bar() { -} - -@stage(fragment) -fn main() -> @location(0) vec4 { - var a : vec2 = vec2(); - bar(); - return vec4(0.400000006, 0.400000006, 0.800000012, 1.0); -} diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl b/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl deleted file mode 100644 index c20b4535ba..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2022 The Tint Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Enable a void internal extension for multiple times -enable InternalExtensionForTesting; -enable InternalExtensionForTesting; -enable InternalExtensionForTesting; - -fn bar() { -} - -@stage(fragment) -fn main() -> @location(0) vec4 { - var a : vec2 = vec2(); - bar(); - return vec4(0.4, 0.4, 0.8, 1.0); -} diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.glsl b/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.glsl deleted file mode 100644 index 995583f921..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.glsl +++ /dev/null @@ -1,18 +0,0 @@ -#version 310 es -precision mediump float; - -layout(location = 0) out vec4 value; -void bar() { -} - -vec4 tint_symbol() { - vec2 a = vec2(0.0f, 0.0f); - bar(); - return vec4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); -} - -void main() { - vec4 inner_result = tint_symbol(); - value = inner_result; - return; -} diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.hlsl b/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.hlsl deleted file mode 100644 index 93c7fa7301..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.hlsl +++ /dev/null @@ -1,19 +0,0 @@ -void bar() { -} - -struct tint_symbol { - float4 value : SV_Target0; -}; - -float4 main_inner() { - float2 a = float2(0.0f, 0.0f); - bar(); - return float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); -} - -tint_symbol main() { - const float4 inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.msl b/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.msl deleted file mode 100644 index d7fde539d8..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.msl +++ /dev/null @@ -1,23 +0,0 @@ -#include - -using namespace metal; -void bar() { -} - -struct tint_symbol_1 { - float4 value [[color(0)]]; -}; - -float4 tint_symbol_inner() { - float2 a = float2(); - bar(); - return float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); -} - -fragment tint_symbol_1 tint_symbol() { - float4 const inner_result = tint_symbol_inner(); - tint_symbol_1 wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.spvasm b/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.spvasm deleted file mode 100644 index f07e733007..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.spvasm +++ /dev/null @@ -1,47 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 25 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %value - OpExecutionMode %main OriginUpperLeft - OpName %value "value" - OpName %bar "bar" - OpName %main_inner "main_inner" - OpName %a "a" - OpName %main "main" - OpDecorate %value Location 0 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 - %void = OpTypeVoid - %6 = OpTypeFunction %void - %10 = OpTypeFunction %v4float - %v2float = OpTypeVector %float 2 - %14 = OpConstantNull %v2float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%float_0_400000006 = OpConstant %float 0.400000006 -%float_0_800000012 = OpConstant %float 0.800000012 - %float_1 = OpConstant %float 1 - %21 = OpConstantComposite %v4float %float_0_400000006 %float_0_400000006 %float_0_800000012 %float_1 - %bar = OpFunction %void None %6 - %9 = OpLabel - OpReturn - OpFunctionEnd - %main_inner = OpFunction %v4float None %10 - %12 = OpLabel - %a = OpVariable %_ptr_Function_v2float Function %14 - OpStore %a %14 - %17 = OpFunctionCall %void %bar - OpReturnValue %21 - OpFunctionEnd - %main = OpFunction %void None %6 - %23 = OpLabel - %24 = OpFunctionCall %v4float %main_inner - OpStore %value %24 - OpReturn - OpFunctionEnd diff --git a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.wgsl b/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.wgsl deleted file mode 100644 index 987fb57fa8..0000000000 --- a/test/tint/extensions/InternalExtensionForTesting/simple_with_duplicated_InternalExtensionForTesting.wgsl.expected.wgsl +++ /dev/null @@ -1,11 +0,0 @@ -enable InternalExtensionForTesting; - -fn bar() { -} - -@stage(fragment) -fn main() -> @location(0) vec4 { - var a : vec2 = vec2(); - bar(); - return vec4(0.400000006, 0.400000006, 0.800000012, 1.0); -} diff --git a/test/tint/extensions/parsing/basic.wgsl b/test/tint/extensions/parsing/basic.wgsl new file mode 100644 index 0000000000..f7b6bd5ab7 --- /dev/null +++ b/test/tint/extensions/parsing/basic.wgsl @@ -0,0 +1,7 @@ +// Enable a void internal extension +enable f16; + +@fragment +fn main() -> @location(0) vec4 { + return vec4(0.1, 0.2, 0.3, 0.4); +} diff --git a/test/tint/extensions/parsing/basic.wgsl.expected.dxc.hlsl b/test/tint/extensions/parsing/basic.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1af441af34 --- /dev/null +++ b/test/tint/extensions/parsing/basic.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return float4(0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f); +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/extensions/parsing/basic.wgsl.expected.fxc.hlsl b/test/tint/extensions/parsing/basic.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1af441af34 --- /dev/null +++ b/test/tint/extensions/parsing/basic.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return float4(0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f); +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/extensions/parsing/basic.wgsl.expected.glsl b/test/tint/extensions/parsing/basic.wgsl.expected.glsl new file mode 100644 index 0000000000..c4ffd0ec0b --- /dev/null +++ b/test/tint/extensions/parsing/basic.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +layout(location = 0) out vec4 value; +vec4 tint_symbol() { + return vec4(0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f); +} + +void main() { + vec4 inner_result = tint_symbol(); + value = inner_result; + return; +} diff --git a/test/tint/extensions/parsing/basic.wgsl.expected.msl b/test/tint/extensions/parsing/basic.wgsl.expected.msl new file mode 100644 index 0000000000..dc91926917 --- /dev/null +++ b/test/tint/extensions/parsing/basic.wgsl.expected.msl @@ -0,0 +1,18 @@ +#include + +using namespace metal; +struct tint_symbol_1 { + float4 value [[color(0)]]; +}; + +float4 tint_symbol_inner() { + return float4(0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f); +} + +fragment tint_symbol_1 tint_symbol() { + float4 const inner_result = tint_symbol_inner(); + tint_symbol_1 wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + diff --git a/test/tint/extensions/parsing/basic.wgsl.expected.spvasm b/test/tint/extensions/parsing/basic.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b3eac5cae --- /dev/null +++ b/test/tint/extensions/parsing/basic.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %value + OpExecutionMode %main OriginUpperLeft + OpName %value "value" + OpName %main_inner "main_inner" + OpName %main "main" + OpDecorate %value Location 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 + %6 = OpTypeFunction %v4float +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 +%float_0_400000006 = OpConstant %float 0.400000006 + %13 = OpConstantComposite %v4float %float_0_100000001 %float_0_200000003 %float_0_300000012 %float_0_400000006 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %main_inner = OpFunction %v4float None %6 + %8 = OpLabel + OpReturnValue %13 + OpFunctionEnd + %main = OpFunction %void None %14 + %17 = OpLabel + %18 = OpFunctionCall %v4float %main_inner + OpStore %value %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/extensions/parsing/basic.wgsl.expected.wgsl b/test/tint/extensions/parsing/basic.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8bd65ac7f --- /dev/null +++ b/test/tint/extensions/parsing/basic.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +enable f16; + +@fragment +fn main() -> @location(0) vec4 { + return vec4(0.100000001, 0.200000003, 0.300000012, 0.400000006); +} diff --git a/test/tint/extensions/parsing/duplicated_extensions.wgsl b/test/tint/extensions/parsing/duplicated_extensions.wgsl new file mode 100644 index 0000000000..b90bbcf65f --- /dev/null +++ b/test/tint/extensions/parsing/duplicated_extensions.wgsl @@ -0,0 +1,9 @@ +// Enable a void internal extension for multiple times +enable f16; +enable f16; +enable f16; + +@fragment +fn main() -> @location(0) vec4 { + return vec4(0.1, 0.2, 0.3, 0.4); +} diff --git a/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.dxc.hlsl b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1af441af34 --- /dev/null +++ b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return float4(0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f); +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.fxc.hlsl b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1af441af34 --- /dev/null +++ b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return float4(0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f); +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.glsl b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.glsl new file mode 100644 index 0000000000..c4ffd0ec0b --- /dev/null +++ b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require +precision mediump float; + +layout(location = 0) out vec4 value; +vec4 tint_symbol() { + return vec4(0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f); +} + +void main() { + vec4 inner_result = tint_symbol(); + value = inner_result; + return; +} diff --git a/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.msl b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.msl new file mode 100644 index 0000000000..dc91926917 --- /dev/null +++ b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.msl @@ -0,0 +1,18 @@ +#include + +using namespace metal; +struct tint_symbol_1 { + float4 value [[color(0)]]; +}; + +float4 tint_symbol_inner() { + return float4(0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f); +} + +fragment tint_symbol_1 tint_symbol() { + float4 const inner_result = tint_symbol_inner(); + tint_symbol_1 wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + diff --git a/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.spvasm b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b3eac5cae --- /dev/null +++ b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %value + OpExecutionMode %main OriginUpperLeft + OpName %value "value" + OpName %main_inner "main_inner" + OpName %main "main" + OpDecorate %value Location 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 + %6 = OpTypeFunction %v4float +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 +%float_0_400000006 = OpConstant %float 0.400000006 + %13 = OpConstantComposite %v4float %float_0_100000001 %float_0_200000003 %float_0_300000012 %float_0_400000006 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %main_inner = OpFunction %v4float None %6 + %8 = OpLabel + OpReturnValue %13 + OpFunctionEnd + %main = OpFunction %void None %14 + %17 = OpLabel + %18 = OpFunctionCall %v4float %main_inner + OpStore %value %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.wgsl b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.wgsl new file mode 100644 index 0000000000..b20c55fb12 --- /dev/null +++ b/test/tint/extensions/parsing/duplicated_extensions.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +enable f16; +enable f16; +enable f16; + +@fragment +fn main() -> @location(0) vec4 { + return vec4(0.100000001, 0.200000003, 0.300000012, 0.400000006); +} diff --git a/test/tint/identifiers/underscore/double/alias.wgsl.expected.hlsl b/test/tint/identifiers/underscore/double/alias.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/double/alias.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/double/alias.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/lower/alias.wgsl.expected.hlsl b/test/tint/identifiers/underscore/double/alias.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/lower/alias.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/double/alias.wgsl.expected.fxc.hlsl diff --git a/test/tint/identifiers/underscore/double/const.wgsl b/test/tint/identifiers/underscore/double/const.wgsl new file mode 100644 index 0000000000..cb9cf5b58d --- /dev/null +++ b/test/tint/identifiers/underscore/double/const.wgsl @@ -0,0 +1,7 @@ +const a : i32 = 1; +const a__ : i32 = 2; + +fn f() { + const b = a; + const b__ = a__; +} diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.dxc.hlsl b/test/tint/identifiers/underscore/double/const.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7412e64899 --- /dev/null +++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { +} diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/double/const.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7412e64899 --- /dev/null +++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { +} diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.glsl b/test/tint/identifiers/underscore/double/const.wgsl.expected.glsl new file mode 100644 index 0000000000..45d48f9b04 --- /dev/null +++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.glsl @@ -0,0 +1,9 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { +} + diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.msl b/test/tint/identifiers/underscore/double/const.wgsl.expected.msl new file mode 100644 index 0000000000..7e5829a9f8 --- /dev/null +++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.msl @@ -0,0 +1,6 @@ +#include + +using namespace metal; +void f() { +} + diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.spvasm b/test/tint/identifiers/underscore/double/const.wgsl.expected.spvasm new file mode 100644 index 0000000000..1c4d684e74 --- /dev/null +++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 7 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/identifiers/underscore/double/const.wgsl.expected.wgsl b/test/tint/identifiers/underscore/double/const.wgsl.expected.wgsl new file mode 100644 index 0000000000..9e4c8c2997 --- /dev/null +++ b/test/tint/identifiers/underscore/double/const.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +const a : i32 = 1; + +const a__ : i32 = 2; + +fn f() { + const b = a; + const b__ = a__; +} diff --git a/test/tint/identifiers/underscore/double/fn.wgsl.expected.hlsl b/test/tint/identifiers/underscore/double/fn.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/double/fn.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/double/fn.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/double/fn.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/double/fn.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aa8d1a9fb5 --- /dev/null +++ b/test/tint/identifiers/underscore/double/fn.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void a() { +} + +void a__() { +} + +void b() { + a(); +} + +void b__() { + a__(); +} diff --git a/test/tint/identifiers/underscore/double/let.wgsl b/test/tint/identifiers/underscore/double/let.wgsl index a6f5ba98e3..0ee15c4fd9 100644 --- a/test/tint/identifiers/underscore/double/let.wgsl +++ b/test/tint/identifiers/underscore/double/let.wgsl @@ -1,7 +1,6 @@ -let a : i32 = 1; -let a__ : i32 = 2; - fn f() { + let a = 1; + let a__ = a; let b = a; let b__ = a__; } diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.dxc.hlsl b/test/tint/identifiers/underscore/double/let.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b35994e92f --- /dev/null +++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + const int a = 1; + const int b = a; + const int b__ = a; +} diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/double/let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b35994e92f --- /dev/null +++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + const int a = 1; + const int b = a; + const int b__ = a; +} diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl b/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl index a0bbe15b38..88072eaaf4 100644 --- a/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl +++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl @@ -4,10 +4,9 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const int a = 1; -const int a__ = 2; void f() { + int a = 1; int b = a; - int b__ = a__; + int b__ = a; } diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.hlsl b/test/tint/identifiers/underscore/double/let.wgsl.expected.hlsl deleted file mode 100644 index 8f66e9d398..0000000000 --- a/test/tint/identifiers/underscore/double/let.wgsl.expected.hlsl +++ /dev/null @@ -1,12 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const int a = 1; -static const int a__ = 2; - -void f() { - const int b = a; - const int b__ = a__; -} diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.msl b/test/tint/identifiers/underscore/double/let.wgsl.expected.msl index 47c1b05685..ed01a8f115 100644 --- a/test/tint/identifiers/underscore/double/let.wgsl.expected.msl +++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.msl @@ -1,11 +1,9 @@ #include using namespace metal; -constant int a = 1; - -constant int a__ = 2; - void f() { + int const a = 1; + int const a__ = a; int const b = a; int const b__ = a__; } diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.spvasm b/test/tint/identifiers/underscore/double/let.wgsl.expected.spvasm index f51d6d6255..a8ec18858a 100644 --- a/test/tint/identifiers/underscore/double/let.wgsl.expected.spvasm +++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.spvasm @@ -1,26 +1,23 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 9 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 - OpName %a "a" - OpName %a__ "a__" OpName %unused_entry_point "unused_entry_point" OpName %f "f" - %int = OpTypeInt 32 1 - %a = OpConstant %int 1 - %a__ = OpConstant %int 2 %void = OpTypeVoid - %4 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %4 - %7 = OpLabel + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel OpReturn OpFunctionEnd - %f = OpFunction %void None %4 - %9 = OpLabel + %f = OpFunction %void None %1 + %6 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.wgsl b/test/tint/identifiers/underscore/double/let.wgsl.expected.wgsl index a8db78cedb..ff017efaea 100644 --- a/test/tint/identifiers/underscore/double/let.wgsl.expected.wgsl +++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.wgsl @@ -1,8 +1,6 @@ -let a : i32 = 1; - -let a__ : i32 = 2; - fn f() { + let a = 1; + let a__ = a; let b = a; let b__ = a__; } diff --git a/test/tint/identifiers/underscore/double/parameter.wgsl.expected.hlsl b/test/tint/identifiers/underscore/double/parameter.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/double/parameter.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/double/parameter.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/double/parameter.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/double/parameter.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6926de2dd3 --- /dev/null +++ b/test/tint/identifiers/underscore/double/parameter.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f(int a__) { + const int b = a__; +} diff --git a/test/tint/identifiers/underscore/double/struct.wgsl.expected.hlsl b/test/tint/identifiers/underscore/double/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/double/struct.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/double/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/double/struct.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/double/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c04697732 --- /dev/null +++ b/test/tint/identifiers/underscore/double/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct a__ { + int b__; +}; + +void f() { + const a__ c = (a__)0; + const int d = c.b__; +} diff --git a/test/tint/identifiers/underscore/double/struct.wgsl.expected.msl b/test/tint/identifiers/underscore/double/struct.wgsl.expected.msl index 0b38868282..3847b30bb8 100644 --- a/test/tint/identifiers/underscore/double/struct.wgsl.expected.msl +++ b/test/tint/identifiers/underscore/double/struct.wgsl.expected.msl @@ -10,7 +10,7 @@ struct a__ { }; void f() { - a__ const c = {}; + a__ const c = a__{}; int const d = c.b__; } diff --git a/test/tint/identifiers/underscore/double/var.wgsl.expected.hlsl b/test/tint/identifiers/underscore/double/var.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/double/var.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/double/var.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/double/var.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/double/var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3b20c1dd6c --- /dev/null +++ b/test/tint/identifiers/underscore/double/var.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int a = 1; +static int a__ = 2; + +void f() { + int b = a; + int b__ = a__; +} diff --git a/test/tint/identifiers/underscore/double/var.wgsl.expected.msl b/test/tint/identifiers/underscore/double/var.wgsl.expected.msl index 3feee1fb83..6d12124fe2 100644 --- a/test/tint/identifiers/underscore/double/var.wgsl.expected.msl +++ b/test/tint/identifiers/underscore/double/var.wgsl.expected.msl @@ -1,8 +1,10 @@ #include using namespace metal; -void f(thread int* const tint_symbol, thread int* const tint_symbol_1) { - int b = *(tint_symbol); - int b__ = *(tint_symbol_1); +void f() { + thread int tint_symbol = 1; + thread int tint_symbol_1 = 2; + int b = tint_symbol; + int b__ = tint_symbol_1; } diff --git a/test/tint/identifiers/underscore/prefix/upper/alias.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/lower/alias.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/upper/alias.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/prefix/lower/alias.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/lower/alias.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/lower/alias.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0e84791b54 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/alias.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int c = 0; + int d = 0; +} diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl new file mode 100644 index 0000000000..626eaa3ea7 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl @@ -0,0 +1,7 @@ +const a : i32 = 1; +const _a : i32 = 2; + +fn f() { + const b = a; + const _b = _a; +} diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.dxc.hlsl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7412e64899 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { +} diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7412e64899 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { +} diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.glsl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.glsl new file mode 100644 index 0000000000..45d48f9b04 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.glsl @@ -0,0 +1,9 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { +} + diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.msl new file mode 100644 index 0000000000..7e5829a9f8 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.msl @@ -0,0 +1,6 @@ +#include + +using namespace metal; +void f() { +} + diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.spvasm b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.spvasm new file mode 100644 index 0000000000..1c4d684e74 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 7 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.wgsl b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.wgsl new file mode 100644 index 0000000000..1a5d5659f4 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/const.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +const a : i32 = 1; + +const _a : i32 = 2; + +fn f() { + const b = a; + const _b = _a; +} diff --git a/test/tint/identifiers/underscore/prefix/lower/fn.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/lower/fn.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/lower/fn.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/prefix/lower/fn.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/lower/fn.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/lower/fn.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..328adcf61f --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/fn.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void a() { +} + +void _a() { +} + +void b() { + a(); +} + +void _b() { + _a(); +} diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl index 6ded6208cd..6670f416d0 100644 --- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl +++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl @@ -1,7 +1,6 @@ -let a : i32 = 1; -let _a : i32 = 2; - fn f() { + let a = 1; + let _a = a; let b = a; let _b = _a; } diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.dxc.hlsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7698191792 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + const int a = 1; + const int b = a; + const int _b = a; +} diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7698191792 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + const int a = 1; + const int b = a; + const int _b = a; +} diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.glsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.glsl index c5a6a9f5e9..469fa8c574 100644 --- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.glsl +++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.glsl @@ -4,10 +4,9 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const int a = 1; -const int _a = 2; void f() { + int a = 1; int b = a; - int _b = _a; + int _b = a; } diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.hlsl deleted file mode 100644 index 4e65f71a8a..0000000000 --- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.hlsl +++ /dev/null @@ -1,12 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const int a = 1; -static const int _a = 2; - -void f() { - const int b = a; - const int _b = _a; -} diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.msl index 7b3d669476..f62a1f41ca 100644 --- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.msl +++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.msl @@ -1,11 +1,9 @@ #include using namespace metal; -constant int a = 1; - -constant int _a = 2; - void f() { + int const a = 1; + int const _a = a; int const b = a; int const _b = _a; } diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.spvasm b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.spvasm index df61dfed89..a8ec18858a 100644 --- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.spvasm +++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.spvasm @@ -1,26 +1,23 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 10 +; Bound: 9 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 - OpName %a "a" - OpName %_a "_a" OpName %unused_entry_point "unused_entry_point" OpName %f "f" - %int = OpTypeInt 32 1 - %a = OpConstant %int 1 - %_a = OpConstant %int 2 %void = OpTypeVoid - %4 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %4 - %7 = OpLabel + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel OpReturn OpFunctionEnd - %f = OpFunction %void None %4 - %9 = OpLabel + %f = OpFunction %void None %1 + %6 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.wgsl b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.wgsl index 9f75219456..f2bfc614ba 100644 --- a/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.wgsl +++ b/test/tint/identifiers/underscore/prefix/lower/let.wgsl.expected.wgsl @@ -1,8 +1,6 @@ -let a : i32 = 1; - -let _a : i32 = 2; - fn f() { + let a = 1; + let _a = a; let b = a; let _b = _a; } diff --git a/test/tint/identifiers/underscore/prefix/lower/parameter.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/lower/parameter.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/lower/parameter.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/prefix/lower/parameter.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/lower/parameter.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/lower/parameter.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..246087c438 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/parameter.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f(int _a) { + const int b = _a; +} diff --git a/test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31e48b6082 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct _a { + int _b; +}; + +void f() { + const _a c = (_a)0; + const int d = c._b; +} diff --git a/test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.msl index 72759ea544..19351299e4 100644 --- a/test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.msl +++ b/test/tint/identifiers/underscore/prefix/lower/struct.wgsl.expected.msl @@ -10,7 +10,7 @@ struct _a { }; void f() { - _a const c = {}; + _a const c = _a{}; int const d = c._b; } diff --git a/test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac75353c49 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int a = 1; +static int _a = 2; + +void f() { + int b = a; + int _b = _a; +} diff --git a/test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.msl index 4b5a7c869f..d700a2a19c 100644 --- a/test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.msl +++ b/test/tint/identifiers/underscore/prefix/lower/var.wgsl.expected.msl @@ -1,8 +1,10 @@ #include using namespace metal; -void f(thread int* const tint_symbol, thread int* const tint_symbol_1) { - int b = *(tint_symbol); - int _b = *(tint_symbol_1); +void f() { + thread int tint_symbol = 1; + thread int tint_symbol_1 = 2; + int b = tint_symbol; + int _b = tint_symbol_1; } diff --git a/test/tint/identifiers/underscore/prefix/upper/alias.wgsl.expected.dxc.hlsl b/test/tint/identifiers/underscore/prefix/upper/alias.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0e84791b54 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/upper/alias.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int c = 0; + int d = 0; +} diff --git a/test/tint/identifiers/underscore/prefix/upper/alias.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/upper/alias.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0e84791b54 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/upper/alias.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int c = 0; + int d = 0; +} diff --git a/test/tint/identifiers/underscore/prefix/upper/fn.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/upper/fn.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/upper/fn.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/prefix/upper/fn.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/upper/fn.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/upper/fn.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6baa073c3f --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/upper/fn.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void A() { +} + +void _A() { +} + +void B() { + A(); +} + +void _B() { + _A(); +} diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl index 06c3aaedd8..0a76a88513 100644 --- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl +++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl @@ -1,7 +1,6 @@ -let A : i32 = 1; -let _A : i32 = 2; - fn f() { + let A : i32 = 1; + let _A : i32 = 2; let B = A; let _B = _A; } diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.dxc.hlsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..11ce0764e8 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + const int B = 1; + const int _B = 2; +} diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..11ce0764e8 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + const int B = 1; + const int _B = 2; +} diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.glsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.glsl index ae9a9c8e8e..2ea9129801 100644 --- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.glsl +++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.glsl @@ -4,10 +4,8 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -const int A = 1; -const int _A = 2; void f() { - int B = A; - int _B = _A; + int B = 1; + int _B = 2; } diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.hlsl deleted file mode 100644 index fa81c838f1..0000000000 --- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.hlsl +++ /dev/null @@ -1,12 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static const int A = 1; -static const int _A = 2; - -void f() { - const int B = A; - const int _B = _A; -} diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.msl index 5afe76fb2b..3614d7c69b 100644 --- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.msl +++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.msl @@ -1,11 +1,9 @@ #include using namespace metal; -constant int A = 1; - -constant int _A = 2; - void f() { + int const A = 1; + int const _A = 2; int const B = A; int const _B = _A; } diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.spvasm b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.spvasm index 8683520ef1..f52c090a2d 100644 --- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.spvasm +++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.spvasm @@ -7,20 +7,18 @@ OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 - OpName %A "A" - OpName %_A "_A" OpName %unused_entry_point "unused_entry_point" OpName %f "f" - %int = OpTypeInt 32 1 - %A = OpConstant %int 1 - %_A = OpConstant %int 2 %void = OpTypeVoid - %4 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %4 - %7 = OpLabel + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel OpReturn OpFunctionEnd - %f = OpFunction %void None %4 - %9 = OpLabel + %f = OpFunction %void None %1 + %6 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.wgsl b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.wgsl index 5c9a0fb8c2..e9ac4ced01 100644 --- a/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.wgsl +++ b/test/tint/identifiers/underscore/prefix/upper/let.wgsl.expected.wgsl @@ -1,8 +1,6 @@ -let A : i32 = 1; - -let _A : i32 = 2; - fn f() { + let A : i32 = 1; + let _A : i32 = 2; let B = A; let _B = _A; } diff --git a/test/tint/identifiers/underscore/prefix/upper/parameter.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/upper/parameter.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/upper/parameter.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/prefix/upper/parameter.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/upper/parameter.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/upper/parameter.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c8ca5f6208 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/upper/parameter.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f(int _A) { + const int B = _A; +} diff --git a/test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2fa6f90ce5 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct _A { + int _B; +}; + +void f() { + const _A c = (_A)0; + const int d = c._B; +} diff --git a/test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.msl index cc20aac0d5..ce966ad4f8 100644 --- a/test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.msl +++ b/test/tint/identifiers/underscore/prefix/upper/struct.wgsl.expected.msl @@ -10,7 +10,7 @@ struct _A { }; void f() { - _A const c = {}; + _A const c = _A{}; int const d = c._B; } diff --git a/test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.hlsl b/test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.hlsl rename to test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.dxc.hlsl diff --git a/test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.fxc.hlsl b/test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3b733cb2f6 --- /dev/null +++ b/test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int A = 1; +static int _A = 2; + +void f() { + int B = A; + int _B = _A; +} diff --git a/test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.msl b/test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.msl index f889d4df12..da05cb2df9 100644 --- a/test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.msl +++ b/test/tint/identifiers/underscore/prefix/upper/var.wgsl.expected.msl @@ -1,8 +1,10 @@ #include using namespace metal; -void f(thread int* const tint_symbol, thread int* const tint_symbol_1) { - int B = *(tint_symbol); - int _B = *(tint_symbol_1); +void f() { + thread int tint_symbol = 1; + thread int tint_symbol_1 = 2; + int B = tint_symbol; + int _B = tint_symbol_1; } diff --git a/test/tint/layout/storage/mat2x2/f32.wgsl b/test/tint/layout/storage/mat2x2/f32.wgsl index 67afba01ca..7b9cfa8918 100644 --- a/test/tint/layout/storage/mat2x2/f32.wgsl +++ b/test/tint/layout/storage/mat2x2/f32.wgsl @@ -3,7 +3,7 @@ struct SSBO { }; @group(0) @binding(0) var ssbo : SSBO; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let v = ssbo.m; ssbo.m = v; diff --git a/test/tint/layout/storage/mat2x2/f32.wgsl.expected.hlsl b/test/tint/layout/storage/mat2x2/f32.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/layout/storage/mat2x2/f32.wgsl.expected.hlsl rename to test/tint/layout/storage/mat2x2/f32.wgsl.expected.dxc.hlsl diff --git a/test/tint/layout/storage/mat2x2/f32.wgsl.expected.fxc.hlsl b/test/tint/layout/storage/mat2x2/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..49afc068ce --- /dev/null +++ b/test/tint/layout/storage/mat2x2/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +RWByteAddressBuffer ssbo : register(u0, space0); + +float2x2 tint_symbol(RWByteAddressBuffer buffer, uint offset) { + return float2x2(asfloat(buffer.Load2((offset + 0u))), asfloat(buffer.Load2((offset + 8u)))); +} + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, float2x2 value) { + buffer.Store2((offset + 0u), asuint(value[0u])); + buffer.Store2((offset + 8u), asuint(value[1u])); +} + +[numthreads(1, 1, 1)] +void f() { + const float2x2 v = tint_symbol(ssbo, 0u); + tint_symbol_2(ssbo, 0u, v); + return; +} diff --git a/test/tint/layout/storage/mat2x2/f32.wgsl.expected.wgsl b/test/tint/layout/storage/mat2x2/f32.wgsl.expected.wgsl index 0a3e9970a3..b73757845f 100644 --- a/test/tint/layout/storage/mat2x2/f32.wgsl.expected.wgsl +++ b/test/tint/layout/storage/mat2x2/f32.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct SSBO { @group(0) @binding(0) var ssbo : SSBO; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { let v = ssbo.m; ssbo.m = v; diff --git a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.hlsl b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.hlsl rename to test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.dxc.hlsl diff --git a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.fxc.hlsl b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b62f051aa6 --- /dev/null +++ b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.fxc.hlsl @@ -0,0 +1,59 @@ +struct strided_arr { + float2 el; +}; + +RWByteAddressBuffer ssbo : register(u0, space0); + +float2x2 arr_to_mat2x2_stride_16(strided_arr arr[2]) { + return float2x2(arr[0u].el, arr[1u].el); +} + +typedef strided_arr mat2x2_stride_16_to_arr_ret[2]; +mat2x2_stride_16_to_arr_ret mat2x2_stride_16_to_arr(float2x2 m) { + const strided_arr tint_symbol_7 = {m[0u]}; + const strided_arr tint_symbol_8 = {m[1u]}; + const strided_arr tint_symbol_9[2] = {tint_symbol_7, tint_symbol_8}; + return tint_symbol_9; +} + +strided_arr tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { + const strided_arr tint_symbol_10 = {asfloat(buffer.Load2((offset + 0u)))}; + return tint_symbol_10; +} + +typedef strided_arr tint_symbol_1_ret[2]; +tint_symbol_1_ret tint_symbol_1(RWByteAddressBuffer buffer, uint offset) { + strided_arr arr_1[2] = (strided_arr[2])0; + { + [loop] for(uint i = 0u; (i < 2u); i = (i + 1u)) { + arr_1[i] = tint_symbol_2(buffer, (offset + (i * 16u))); + } + } + return arr_1; +} + +void tint_symbol_5(RWByteAddressBuffer buffer, uint offset, strided_arr value) { + buffer.Store2((offset + 0u), asuint(value.el)); +} + +void tint_symbol_4(RWByteAddressBuffer buffer, uint offset, strided_arr value[2]) { + strided_arr array[2] = value; + { + [loop] for(uint i_1 = 0u; (i_1 < 2u); i_1 = (i_1 + 1u)) { + tint_symbol_5(buffer, (offset + (i_1 * 16u)), array[i_1]); + } + } +} + +void f_1() { + const float2x2 x_15 = arr_to_mat2x2_stride_16(tint_symbol_1(ssbo, 0u)); + const strided_arr tint_symbol[2] = mat2x2_stride_16_to_arr(x_15); + tint_symbol_4(ssbo, 0u, tint_symbol); + return; +} + +[numthreads(1, 1, 1)] +void f() { + f_1(); + return; +} diff --git a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.msl b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.msl index abb676bfe8..860459d207 100644 --- a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.msl +++ b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.msl @@ -1,33 +1,42 @@ #include using namespace metal; -struct strided_arr { - /* 0x0000 */ float2 el; - /* 0x0008 */ int8_t tint_pad[8]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -struct tint_array_wrapper { - /* 0x0000 */ strided_arr arr[2]; +struct strided_arr { + /* 0x0000 */ float2 el; + /* 0x0008 */ tint_array tint_pad; }; struct SSBO { - /* 0x0000 */ tint_array_wrapper m; + /* 0x0000 */ tint_array m; }; -float2x2 arr_to_mat2x2_stride_16(tint_array_wrapper arr) { - return float2x2(arr.arr[0u].el, arr.arr[1u].el); +float2x2 arr_to_mat2x2_stride_16(tint_array arr) { + return float2x2(arr[0u].el, arr[1u].el); } -tint_array_wrapper mat2x2_stride_16_to_arr(float2x2 m) { +tint_array mat2x2_stride_16_to_arr(float2x2 m) { strided_arr const tint_symbol_1 = {.el=m[0u]}; strided_arr const tint_symbol_2 = {.el=m[1u]}; - tint_array_wrapper const tint_symbol_3 = {.arr={tint_symbol_1, tint_symbol_2}}; + tint_array const tint_symbol_3 = tint_array{tint_symbol_1, tint_symbol_2}; return tint_symbol_3; } void f_1(device SSBO* const tint_symbol_4) { float2x2 const x_15 = arr_to_mat2x2_stride_16((*(tint_symbol_4)).m); - tint_array_wrapper const tint_symbol = mat2x2_stride_16_to_arr(x_15); + tint_array const tint_symbol = mat2x2_stride_16_to_arr(x_15); (*(tint_symbol_4)).m = tint_symbol; return; } diff --git a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.spvasm b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.spvasm index 80b7d9793c..7427fec70b 100644 --- a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.spvasm +++ b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 44 +; Bound: 45 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -35,11 +35,12 @@ %ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer %mat2v2float = OpTypeMatrix %v2float 2 %10 = OpTypeFunction %mat2v2float %_arr_strided_arr_uint_2 - %uint_0 = OpConstant %uint 0 + %15 = OpConstantNull %uint %uint_1 = OpConstant %uint 1 %22 = OpTypeFunction %_arr_strided_arr_uint_2 %mat2v2float %void = OpTypeVoid %31 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer__arr_strided_arr_uint_2 = OpTypePointer StorageBuffer %_arr_strided_arr_uint_2 %arr_to_mat2x2_stride_16 = OpFunction %mat2v2float None %10 %arr = OpFunctionParameter %_arr_strided_arr_uint_2 @@ -63,16 +64,16 @@ OpFunctionEnd %f_1 = OpFunction %void None %31 %34 = OpLabel - %37 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 - %38 = OpLoad %_arr_strided_arr_uint_2 %37 - %35 = OpFunctionCall %mat2v2float %arr_to_mat2x2_stride_16 %38 - %39 = OpFunctionCall %_arr_strided_arr_uint_2 %mat2x2_stride_16_to_arr %35 - %40 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 - OpStore %40 %39 + %38 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 + %39 = OpLoad %_arr_strided_arr_uint_2 %38 + %35 = OpFunctionCall %mat2v2float %arr_to_mat2x2_stride_16 %39 + %40 = OpFunctionCall %_arr_strided_arr_uint_2 %mat2x2_stride_16_to_arr %35 + %41 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 + OpStore %41 %40 OpReturn OpFunctionEnd %f = OpFunction %void None %31 - %42 = OpLabel - %43 = OpFunctionCall %void %f_1 + %43 = OpLabel + %44 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl index 119ede2a86..488d5301a5 100644 --- a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl +++ b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl @@ -23,7 +23,7 @@ fn f_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn f() { f_1(); } diff --git a/test/tint/let/global/global.wgsl b/test/tint/let/global/global.wgsl deleted file mode 100644 index 9f4597ba4f..0000000000 --- a/test/tint/let/global/global.wgsl +++ /dev/null @@ -1,24 +0,0 @@ -struct MyStruct { - f1 : f32, -}; - -type MyArray = array; - -// Global lets -let v1 = 1; -let v2 = 1u; -let v3 = 1.0; - -let v4 = vec3(1, 1, 1); -let v5 = vec3(1u, 1u, 1u); -let v6 = vec3(1.0, 1.0, 1.0); - -let v7 = mat3x3(vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); - -let v8 = MyStruct(); -let v9 = MyArray(); - -@stage(fragment) -fn main() -> @location(0) vec4 { - return vec4(0.0,0.0,0.0,0.0); -} diff --git a/test/tint/let/global/global.wgsl.expected.glsl b/test/tint/let/global/global.wgsl.expected.glsl deleted file mode 100644 index 797dbaf28f..0000000000 --- a/test/tint/let/global/global.wgsl.expected.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 310 es -precision mediump float; - -layout(location = 0) out vec4 value; -struct MyStruct { - float f1; -}; - -vec4 tint_symbol() { - return vec4(0.0f, 0.0f, 0.0f, 0.0f); -} - -void main() { - vec4 inner_result = tint_symbol(); - value = inner_result; - return; -} diff --git a/test/tint/let/global/global.wgsl.expected.hlsl b/test/tint/let/global/global.wgsl.expected.hlsl deleted file mode 100644 index 6dd234ca84..0000000000 --- a/test/tint/let/global/global.wgsl.expected.hlsl +++ /dev/null @@ -1,28 +0,0 @@ -struct MyStruct { - float f1; -}; - -static const int v1 = 1; -static const uint v2 = 1u; -static const float v3 = 1.0f; -static const int3 v4 = int3(1, 1, 1); -static const uint3 v5 = uint3(1u, 1u, 1u); -static const float3 v6 = float3(1.0f, 1.0f, 1.0f); -static const float3x3 v7 = float3x3(float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f)); -static const MyStruct v8 = (MyStruct)0; -static const float v9[10] = (float[10])0; - -struct tint_symbol { - float4 value : SV_Target0; -}; - -float4 main_inner() { - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol main() { - const float4 inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/let/global/global.wgsl.expected.msl b/test/tint/let/global/global.wgsl.expected.msl deleted file mode 100644 index d5efc4eda1..0000000000 --- a/test/tint/let/global/global.wgsl.expected.msl +++ /dev/null @@ -1,44 +0,0 @@ -#include - -using namespace metal; -struct MyStruct { - float f1; -}; - -struct tint_array_wrapper { - float arr[10]; -}; - -constant int v1 = 1; - -constant uint v2 = 1u; - -constant float v3 = 1.0f; - -constant int3 v4 = int3(1, 1, 1); - -constant uint3 v5 = uint3(1u, 1u, 1u); - -constant float3 v6 = float3(1.0f, 1.0f, 1.0f); - -constant float3x3 v7 = float3x3(float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f)); - -constant MyStruct v8 = {}; - -constant tint_array_wrapper v9 = {.arr={}}; - -struct tint_symbol_1 { - float4 value [[color(0)]]; -}; - -float4 tint_symbol_inner() { - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -fragment tint_symbol_1 tint_symbol() { - float4 const inner_result = tint_symbol_inner(); - tint_symbol_1 wrapper_result = {}; - wrapper_result.value = inner_result; - return wrapper_result; -} - diff --git a/test/tint/let/global/global.wgsl.expected.spvasm b/test/tint/let/global/global.wgsl.expected.spvasm deleted file mode 100644 index 6bbf8ad3a3..0000000000 --- a/test/tint/let/global/global.wgsl.expected.spvasm +++ /dev/null @@ -1,64 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 34 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %value - OpExecutionMode %main OriginUpperLeft - OpName %value "value" - OpName %v1 "v1" - OpName %v2 "v2" - OpName %v3 "v3" - OpName %v4 "v4" - OpName %v5 "v5" - OpName %v6 "v6" - OpName %v7 "v7" - OpName %MyStruct "MyStruct" - OpMemberName %MyStruct 0 "f1" - OpName %v8 "v8" - OpName %v9 "v9" - OpName %main_inner "main_inner" - OpName %main "main" - OpDecorate %value Location 0 - OpMemberDecorate %MyStruct 0 Offset 0 - OpDecorate %_arr_float_uint_10 ArrayStride 4 - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %5 = OpConstantNull %v4float - %value = OpVariable %_ptr_Output_v4float Output %5 - %int = OpTypeInt 32 1 - %v1 = OpConstant %int 1 - %uint = OpTypeInt 32 0 - %v2 = OpConstant %uint 1 - %v3 = OpConstant %float 1 - %v3int = OpTypeVector %int 3 - %v4 = OpConstantComposite %v3int %v1 %v1 %v1 - %v3uint = OpTypeVector %uint 3 - %v5 = OpConstantComposite %v3uint %v2 %v2 %v2 - %v3float = OpTypeVector %float 3 - %v6 = OpConstantComposite %v3float %v3 %v3 %v3 -%mat3v3float = OpTypeMatrix %v3float 3 - %v7 = OpConstantComposite %mat3v3float %v6 %v6 %v6 - %MyStruct = OpTypeStruct %float - %v8 = OpConstantNull %MyStruct - %uint_10 = OpConstant %uint 10 -%_arr_float_uint_10 = OpTypeArray %float %uint_10 - %v9 = OpConstantNull %_arr_float_uint_10 - %24 = OpTypeFunction %v4float - %float_0 = OpConstant %float 0 - %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 - %void = OpTypeVoid - %29 = OpTypeFunction %void - %main_inner = OpFunction %v4float None %24 - %26 = OpLabel - OpReturnValue %28 - OpFunctionEnd - %main = OpFunction %void None %29 - %32 = OpLabel - %33 = OpFunctionCall %v4float %main_inner - OpStore %value %33 - OpReturn - OpFunctionEnd diff --git a/test/tint/let/global/global.wgsl.expected.wgsl b/test/tint/let/global/global.wgsl.expected.wgsl deleted file mode 100644 index b1e4d6ed5b..0000000000 --- a/test/tint/let/global/global.wgsl.expected.wgsl +++ /dev/null @@ -1,28 +0,0 @@ -struct MyStruct { - f1 : f32, -} - -type MyArray = array; - -let v1 = 1; - -let v2 = 1u; - -let v3 = 1.0; - -let v4 = vec3(1, 1, 1); - -let v5 = vec3(1u, 1u, 1u); - -let v6 = vec3(1.0, 1.0, 1.0); - -let v7 = mat3x3(vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); - -let v8 = MyStruct(); - -let v9 = MyArray(); - -@stage(fragment) -fn main() -> @location(0) vec4 { - return vec4(0.0, 0.0, 0.0, 0.0); -} diff --git a/test/tint/let/inferred/function.wgsl b/test/tint/let/inferred/function.wgsl index 48ab6f034b..b436f469de 100644 --- a/test/tint/let/inferred/function.wgsl +++ b/test/tint/let/inferred/function.wgsl @@ -33,7 +33,7 @@ fn let_decls() { let v15 = ret_MyArray(); } -@stage(fragment) +@fragment fn main() -> @location(0) vec4 { return vec4(0.0,0.0,0.0,0.0); } diff --git a/test/tint/let/inferred/function.wgsl.expected.dxc.hlsl b/test/tint/let/inferred/function.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..152e8d178c --- /dev/null +++ b/test/tint/let/inferred/function.wgsl.expected.dxc.hlsl @@ -0,0 +1,59 @@ +struct MyStruct { + float f1; +}; + +int ret_i32() { + return 1; +} + +uint ret_u32() { + return 1u; +} + +float ret_f32() { + return 1.0f; +} + +MyStruct ret_MyStruct() { + const MyStruct tint_symbol_1 = (MyStruct)0; + return tint_symbol_1; +} + +typedef float ret_MyArray_ret[10]; +ret_MyArray_ret ret_MyArray() { + const float tint_symbol_2[10] = (float[10])0; + return tint_symbol_2; +} + +void let_decls() { + const int v1 = 1; + const uint v2 = 1u; + const float v3 = 1.0f; + const int3 v4 = (1).xxx; + const uint3 v5 = (1u).xxx; + const float3 v6 = (1.0f).xxx; + const float3x3 v7 = float3x3(v6, v6, v6); + const MyStruct v8 = {1.0f}; + const float v9[10] = (float[10])0; + const int v10 = ret_i32(); + const uint v11 = ret_u32(); + const float v12 = ret_f32(); + const MyStruct v13 = ret_MyStruct(); + const MyStruct v14 = ret_MyStruct(); + const float v15[10] = ret_MyArray(); +} + +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/let/inferred/function.wgsl.expected.fxc.hlsl b/test/tint/let/inferred/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..152e8d178c --- /dev/null +++ b/test/tint/let/inferred/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,59 @@ +struct MyStruct { + float f1; +}; + +int ret_i32() { + return 1; +} + +uint ret_u32() { + return 1u; +} + +float ret_f32() { + return 1.0f; +} + +MyStruct ret_MyStruct() { + const MyStruct tint_symbol_1 = (MyStruct)0; + return tint_symbol_1; +} + +typedef float ret_MyArray_ret[10]; +ret_MyArray_ret ret_MyArray() { + const float tint_symbol_2[10] = (float[10])0; + return tint_symbol_2; +} + +void let_decls() { + const int v1 = 1; + const uint v2 = 1u; + const float v3 = 1.0f; + const int3 v4 = (1).xxx; + const uint3 v5 = (1u).xxx; + const float3 v6 = (1.0f).xxx; + const float3x3 v7 = float3x3(v6, v6, v6); + const MyStruct v8 = {1.0f}; + const float v9[10] = (float[10])0; + const int v10 = ret_i32(); + const uint v11 = ret_u32(); + const float v12 = ret_f32(); + const MyStruct v13 = ret_MyStruct(); + const MyStruct v14 = ret_MyStruct(); + const float v15[10] = ret_MyArray(); +} + +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/let/inferred/function.wgsl.expected.glsl b/test/tint/let/inferred/function.wgsl.expected.glsl index 797dbaf28f..b3504567a6 100644 --- a/test/tint/let/inferred/function.wgsl.expected.glsl +++ b/test/tint/let/inferred/function.wgsl.expected.glsl @@ -7,7 +7,7 @@ struct MyStruct { }; vec4 tint_symbol() { - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/let/inferred/function.wgsl.expected.hlsl b/test/tint/let/inferred/function.wgsl.expected.hlsl deleted file mode 100644 index 380a749323..0000000000 --- a/test/tint/let/inferred/function.wgsl.expected.hlsl +++ /dev/null @@ -1,59 +0,0 @@ -struct MyStruct { - float f1; -}; - -int ret_i32() { - return 1; -} - -uint ret_u32() { - return 1u; -} - -float ret_f32() { - return 1.0f; -} - -MyStruct ret_MyStruct() { - const MyStruct tint_symbol_1 = (MyStruct)0; - return tint_symbol_1; -} - -typedef float ret_MyArray_ret[10]; -ret_MyArray_ret ret_MyArray() { - const float tint_symbol_2[10] = (float[10])0; - return tint_symbol_2; -} - -void let_decls() { - const int v1 = 1; - const uint v2 = 1u; - const float v3 = 1.0f; - const int3 v4 = int3(1, 1, 1); - const uint3 v5 = uint3(1u, 1u, 1u); - const float3 v6 = float3(1.0f, 1.0f, 1.0f); - const float3x3 v7 = float3x3(v6, v6, v6); - const MyStruct v8 = {1.0f}; - const float v9[10] = (float[10])0; - const int v10 = ret_i32(); - const uint v11 = ret_u32(); - const float v12 = ret_f32(); - const MyStruct v13 = ret_MyStruct(); - const MyStruct v14 = ret_MyStruct(); - const float v15[10] = ret_MyArray(); -} - -struct tint_symbol { - float4 value : SV_Target0; -}; - -float4 main_inner() { - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol main() { - const float4 inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/let/inferred/function.wgsl.expected.msl b/test/tint/let/inferred/function.wgsl.expected.msl index 6a699b5f81..85e3a0c4a8 100644 --- a/test/tint/let/inferred/function.wgsl.expected.msl +++ b/test/tint/let/inferred/function.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct MyStruct { - float f1; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -struct tint_array_wrapper { - float arr[10]; +struct MyStruct { + float f1; }; int ret_i32() { @@ -22,12 +31,12 @@ float ret_f32() { } MyStruct ret_MyStruct() { - MyStruct const tint_symbol_2 = {}; + MyStruct const tint_symbol_2 = MyStruct{}; return tint_symbol_2; } -tint_array_wrapper ret_MyArray() { - tint_array_wrapper const tint_symbol_3 = {.arr={}}; +tint_array ret_MyArray() { + tint_array const tint_symbol_3 = tint_array{}; return tint_symbol_3; } @@ -35,18 +44,18 @@ void let_decls() { int const v1 = 1; uint const v2 = 1u; float const v3 = 1.0f; - int3 const v4 = int3(1, 1, 1); - uint3 const v5 = uint3(1u, 1u, 1u); - float3 const v6 = float3(1.0f, 1.0f, 1.0f); + int3 const v4 = int3(1); + uint3 const v5 = uint3(1u); + float3 const v6 = float3(1.0f); float3x3 const v7 = float3x3(v6, v6, v6); - MyStruct const v8 = {.f1=1.0f}; - tint_array_wrapper const v9 = {.arr={}}; + MyStruct const v8 = MyStruct{.f1=1.0f}; + tint_array const v9 = tint_array{}; int const v10 = ret_i32(); uint const v11 = ret_u32(); float const v12 = ret_f32(); MyStruct const v13 = ret_MyStruct(); MyStruct const v14 = ret_MyStruct(); - tint_array_wrapper const v15 = ret_MyArray(); + tint_array const v15 = ret_MyArray(); } struct tint_symbol_1 { @@ -54,7 +63,7 @@ struct tint_symbol_1 { }; float4 tint_symbol_inner() { - return float4(0.0f, 0.0f, 0.0f, 0.0f); + return float4(0.0f); } fragment tint_symbol_1 tint_symbol() { diff --git a/test/tint/let/inferred/function.wgsl.expected.spvasm b/test/tint/let/inferred/function.wgsl.expected.spvasm index 3593a241ae..6e2ddcbd49 100644 --- a/test/tint/let/inferred/function.wgsl.expected.spvasm +++ b/test/tint/let/inferred/function.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 58 +; Bound: 56 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -52,8 +52,6 @@ %mat3v3float = OpTypeMatrix %v3float 3 %43 = OpConstantComposite %MyStruct %float_1 %50 = OpTypeFunction %v4float - %float_0 = OpConstant %float 0 - %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 %ret_i32 = OpFunction %int None %6 %9 = OpLabel OpReturnValue %int_1 @@ -87,11 +85,11 @@ OpFunctionEnd %main_inner = OpFunction %v4float None %50 %52 = OpLabel - OpReturnValue %54 + OpReturnValue %5 OpFunctionEnd %main = OpFunction %void None %31 - %56 = OpLabel - %57 = OpFunctionCall %v4float %main_inner - OpStore %value %57 + %54 = OpLabel + %55 = OpFunctionCall %v4float %main_inner + OpStore %value %55 OpReturn OpFunctionEnd diff --git a/test/tint/let/inferred/function.wgsl.expected.wgsl b/test/tint/let/inferred/function.wgsl.expected.wgsl index 34c18ffec4..82654aad27 100644 --- a/test/tint/let/inferred/function.wgsl.expected.wgsl +++ b/test/tint/let/inferred/function.wgsl.expected.wgsl @@ -42,7 +42,7 @@ fn let_decls() { let v15 = ret_MyArray(); } -@stage(fragment) +@fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } diff --git a/test/tint/loops/continue_in_switch.wgsl b/test/tint/loops/continue_in_switch.wgsl index b523874c31..475964a20e 100644 --- a/test/tint/loops/continue_in_switch.wgsl +++ b/test/tint/loops/continue_in_switch.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { for (var i : i32 = 0; i < 4; i = i + 1) { switch(i) { diff --git a/test/tint/loops/continue_in_switch.wgsl.expected.hlsl b/test/tint/loops/continue_in_switch.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/loops/continue_in_switch.wgsl.expected.hlsl rename to test/tint/loops/continue_in_switch.wgsl.expected.dxc.hlsl diff --git a/test/tint/loops/continue_in_switch.wgsl.expected.fxc.hlsl b/test/tint/loops/continue_in_switch.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3aa81e3f03 --- /dev/null +++ b/test/tint/loops/continue_in_switch.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +[numthreads(1, 1, 1)] +void f() { + { + [loop] for(int i = 0; (i < 4); i = (i + 1)) { + bool tint_continue = false; + switch(i) { + case 0: { + { + tint_continue = true; + break; + } + break; + } + default: { + break; + } + } + if (tint_continue) { + continue; + } + } + } + return; +} diff --git a/test/tint/loops/continue_in_switch.wgsl.expected.spvasm b/test/tint/loops/continue_in_switch.wgsl.expected.spvasm index d9378ba27c..ec8a10115c 100644 --- a/test/tint/loops/continue_in_switch.wgsl.expected.spvasm +++ b/test/tint/loops/continue_in_switch.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,43 +12,42 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %6 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %9 = OpConstantNull %int %int_4 = OpConstant %int 4 %bool = OpTypeBool %int_1 = OpConstant %int 1 %f = OpFunction %void None %1 %4 = OpLabel - %i = OpVariable %_ptr_Function_int Function %9 - OpStore %i %int_0 - OpBranch %10 - %10 = OpLabel - OpLoopMerge %11 %12 None - OpBranch %13 - %13 = OpLabel - %15 = OpLoad %int %i - %17 = OpSLessThan %bool %15 %int_4 - %14 = OpLogicalNot %bool %17 - OpSelectionMerge %19 None - OpBranchConditional %14 %20 %19 - %20 = OpLabel - OpBranch %11 - %19 = OpLabel - %22 = OpLoad %int %i - OpSelectionMerge %21 None - OpSwitch %22 %23 0 %24 - %24 = OpLabel - OpBranch %12 - %23 = OpLabel - OpBranch %21 - %21 = OpLabel + %i = OpVariable %_ptr_Function_int Function %6 + OpStore %i %6 + OpBranch %9 + %9 = OpLabel + OpLoopMerge %10 %11 None OpBranch %12 %12 = OpLabel - %25 = OpLoad %int %i - %27 = OpIAdd %int %25 %int_1 - OpStore %i %27 + %14 = OpLoad %int %i + %16 = OpSLessThan %bool %14 %int_4 + %13 = OpLogicalNot %bool %16 + OpSelectionMerge %18 None + OpBranchConditional %13 %19 %18 + %19 = OpLabel OpBranch %10 + %18 = OpLabel + %21 = OpLoad %int %i + OpSelectionMerge %20 None + OpSwitch %21 %22 0 %23 + %23 = OpLabel + OpBranch %11 + %22 = OpLabel + OpBranch %20 + %20 = OpLabel + OpBranch %11 %11 = OpLabel + %24 = OpLoad %int %i + %26 = OpIAdd %int %24 %int_1 + OpStore %i %26 + OpBranch %9 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/loops/continue_in_switch.wgsl.expected.wgsl b/test/tint/loops/continue_in_switch.wgsl.expected.wgsl index ab9a0295e2..46be659452 100644 --- a/test/tint/loops/continue_in_switch.wgsl.expected.wgsl +++ b/test/tint/loops/continue_in_switch.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { for(var i : i32 = 0; (i < 4); i = (i + 1)) { switch(i) { diff --git a/test/tint/loops/loop.wgsl.expected.hlsl b/test/tint/loops/loop.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/loops/loop.wgsl.expected.hlsl rename to test/tint/loops/loop.wgsl.expected.dxc.hlsl diff --git a/test/tint/loops/loop.wgsl.expected.fxc.hlsl b/test/tint/loops/loop.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d230ae9d5a --- /dev/null +++ b/test/tint/loops/loop.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int i = 0; + [loop] while (true) { + i = (i + 1); + if ((i > 4)) { + return i; + } + } +} diff --git a/test/tint/loops/loop_with_continuing.wgsl.expected.hlsl b/test/tint/loops/loop_with_continuing.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/loops/loop_with_continuing.wgsl.expected.hlsl rename to test/tint/loops/loop_with_continuing.wgsl.expected.dxc.hlsl diff --git a/test/tint/loops/loop_with_continuing.wgsl.expected.fxc.hlsl b/test/tint/loops/loop_with_continuing.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ab6ee627a --- /dev/null +++ b/test/tint/loops/loop_with_continuing.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int i = 0; + [loop] while (true) { + if ((i > 4)) { + return i; + } + { + i = (i + 1); + } + } +} diff --git a/test/tint/loops/nested_loops.wgsl.expected.hlsl b/test/tint/loops/nested_loops.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/loops/nested_loops.wgsl.expected.hlsl rename to test/tint/loops/nested_loops.wgsl.expected.dxc.hlsl diff --git a/test/tint/loops/nested_loops.wgsl.expected.fxc.hlsl b/test/tint/loops/nested_loops.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f5b116478d --- /dev/null +++ b/test/tint/loops/nested_loops.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int i = 0; + int j = 0; + [loop] while (true) { + i = (i + 1); + if ((i > 4)) { + return 1; + } + [loop] while (true) { + j = (j + 1); + if ((j > 4)) { + return 2; + } + } + } +} diff --git a/test/tint/loops/nested_loops_with_continuing.wgsl.expected.hlsl b/test/tint/loops/nested_loops_with_continuing.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/loops/nested_loops_with_continuing.wgsl.expected.hlsl rename to test/tint/loops/nested_loops_with_continuing.wgsl.expected.dxc.hlsl diff --git a/test/tint/loops/nested_loops_with_continuing.wgsl.expected.fxc.hlsl b/test/tint/loops/nested_loops_with_continuing.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..605a079fdd --- /dev/null +++ b/test/tint/loops/nested_loops_with_continuing.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int i = 0; + int j = 0; + [loop] while (true) { + if ((i > 4)) { + return 1; + } + [loop] while (true) { + if ((j > 4)) { + return 2; + } + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } +} diff --git a/test/tint/loops/while.wgsl b/test/tint/loops/while.wgsl new file mode 100644 index 0000000000..e2694d09b6 --- /dev/null +++ b/test/tint/loops/while.wgsl @@ -0,0 +1,7 @@ +fn f() -> i32 { + var i : i32; + while (i < 4) { + i = i + 1; + } + return i; +} diff --git a/test/tint/loops/while.wgsl.expected.dxc.hlsl b/test/tint/loops/while.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b9bfd6545f --- /dev/null +++ b/test/tint/loops/while.wgsl.expected.dxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int i = 0; + [loop] while((i < 4)) { + i = (i + 1); + } + return i; +} diff --git a/test/tint/loops/while.wgsl.expected.fxc.hlsl b/test/tint/loops/while.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b9bfd6545f --- /dev/null +++ b/test/tint/loops/while.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int i = 0; + [loop] while((i < 4)) { + i = (i + 1); + } + return i; +} diff --git a/test/tint/loops/while.wgsl.expected.glsl b/test/tint/loops/while.wgsl.expected.glsl new file mode 100644 index 0000000000..14dbef01ac --- /dev/null +++ b/test/tint/loops/while.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int f() { + int i = 0; + while((i < 4)) { + i = (i + 1); + } + return i; +} + diff --git a/test/tint/loops/while.wgsl.expected.msl b/test/tint/loops/while.wgsl.expected.msl new file mode 100644 index 0000000000..bd8f450bf4 --- /dev/null +++ b/test/tint/loops/while.wgsl.expected.msl @@ -0,0 +1,11 @@ +#include + +using namespace metal; +int f() { + int i = 0; + while((i < 4)) { + i = as_type((as_type(i) + as_type(1))); + } + return i; +} + diff --git a/test/tint/loops/while.wgsl.expected.spvasm b/test/tint/loops/while.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc53917841 --- /dev/null +++ b/test/tint/loops/while.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %i "i" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %5 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %11 = OpConstantNull %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %int None %5 + %8 = OpLabel + %i = OpVariable %_ptr_Function_int Function %11 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %17 = OpLoad %int %i + %19 = OpSLessThan %bool %17 %int_4 + %16 = OpLogicalNot %bool %19 + OpSelectionMerge %21 None + OpBranchConditional %16 %22 %21 + %22 = OpLabel + OpBranch %13 + %21 = OpLabel + %23 = OpLoad %int %i + %25 = OpIAdd %int %23 %int_1 + OpStore %i %25 + OpBranch %14 + %14 = OpLabel + OpBranch %12 + %13 = OpLabel + %26 = OpLoad %int %i + OpReturnValue %26 + OpFunctionEnd diff --git a/test/tint/loops/while.wgsl.expected.wgsl b/test/tint/loops/while.wgsl.expected.wgsl new file mode 100644 index 0000000000..1df88f9bd6 --- /dev/null +++ b/test/tint/loops/while.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +fn f() -> i32 { + var i : i32; + while((i < 4)) { + i = (i + 1); + } + return i; +} diff --git a/test/tint/loops/while_with_continue.wgsl b/test/tint/loops/while_with_continue.wgsl new file mode 100644 index 0000000000..8193a0223d --- /dev/null +++ b/test/tint/loops/while_with_continue.wgsl @@ -0,0 +1,8 @@ +fn f() -> i32 { + var i : i32; + while (i < 4) { + i = i + 1; + continue; + } + return i; +} diff --git a/test/tint/loops/while_with_continue.wgsl.expected.dxc.hlsl b/test/tint/loops/while_with_continue.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0d22da75a --- /dev/null +++ b/test/tint/loops/while_with_continue.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int i = 0; + [loop] while((i < 4)) { + i = (i + 1); + continue; + } + return i; +} diff --git a/test/tint/loops/while_with_continue.wgsl.expected.fxc.hlsl b/test/tint/loops/while_with_continue.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c0d22da75a --- /dev/null +++ b/test/tint/loops/while_with_continue.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +int f() { + int i = 0; + [loop] while((i < 4)) { + i = (i + 1); + continue; + } + return i; +} diff --git a/test/tint/loops/while_with_continue.wgsl.expected.glsl b/test/tint/loops/while_with_continue.wgsl.expected.glsl new file mode 100644 index 0000000000..bc66512a2b --- /dev/null +++ b/test/tint/loops/while_with_continue.wgsl.expected.glsl @@ -0,0 +1,15 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int f() { + int i = 0; + while((i < 4)) { + i = (i + 1); + continue; + } + return i; +} + diff --git a/test/tint/loops/while_with_continue.wgsl.expected.msl b/test/tint/loops/while_with_continue.wgsl.expected.msl new file mode 100644 index 0000000000..7fee4b083d --- /dev/null +++ b/test/tint/loops/while_with_continue.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +int f() { + int i = 0; + while((i < 4)) { + i = as_type((as_type(i) + as_type(1))); + continue; + } + return i; +} + diff --git a/test/tint/loops/while_with_continue.wgsl.expected.spvasm b/test/tint/loops/while_with_continue.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc53917841 --- /dev/null +++ b/test/tint/loops/while_with_continue.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %i "i" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %5 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %11 = OpConstantNull %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %int None %5 + %8 = OpLabel + %i = OpVariable %_ptr_Function_int Function %11 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %17 = OpLoad %int %i + %19 = OpSLessThan %bool %17 %int_4 + %16 = OpLogicalNot %bool %19 + OpSelectionMerge %21 None + OpBranchConditional %16 %22 %21 + %22 = OpLabel + OpBranch %13 + %21 = OpLabel + %23 = OpLoad %int %i + %25 = OpIAdd %int %23 %int_1 + OpStore %i %25 + OpBranch %14 + %14 = OpLabel + OpBranch %12 + %13 = OpLabel + %26 = OpLoad %int %i + OpReturnValue %26 + OpFunctionEnd diff --git a/test/tint/loops/while_with_continue.wgsl.expected.wgsl b/test/tint/loops/while_with_continue.wgsl.expected.wgsl new file mode 100644 index 0000000000..bbbd5fdd18 --- /dev/null +++ b/test/tint/loops/while_with_continue.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn f() -> i32 { + var i : i32; + while((i < 4)) { + i = (i + 1); + continue; + } + return i; +} diff --git a/test/tint/out_of_order_decls/alias/alias.wgsl b/test/tint/out_of_order_decls/alias/alias.wgsl index b1c9e66246..ab6644655c 100644 --- a/test/tint/out_of_order_decls/alias/alias.wgsl +++ b/test/tint/out_of_order_decls/alias/alias.wgsl @@ -1,7 +1,7 @@ type T1 = T2; type T2 = i32; -@stage(fragment) +@fragment fn f() { var v : T1; } diff --git a/test/tint/out_of_order_decls/alias/alias.wgsl.expected.hlsl b/test/tint/out_of_order_decls/alias/alias.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/alias/alias.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/alias/alias.wgsl.expected.dxc.hlsl diff --git a/test/tint/out_of_order_decls/alias/alias.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/alias/alias.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9047109e73 --- /dev/null +++ b/test/tint/out_of_order_decls/alias/alias.wgsl.expected.fxc.hlsl @@ -0,0 +1,4 @@ +void f() { + int v = 0; + return; +} diff --git a/test/tint/out_of_order_decls/alias/alias.wgsl.expected.wgsl b/test/tint/out_of_order_decls/alias/alias.wgsl.expected.wgsl index ca3ee03d48..fbb0dd4f96 100644 --- a/test/tint/out_of_order_decls/alias/alias.wgsl.expected.wgsl +++ b/test/tint/out_of_order_decls/alias/alias.wgsl.expected.wgsl @@ -2,7 +2,7 @@ type T1 = T2; type T2 = i32; -@stage(fragment) +@fragment fn f() { var v : T1; } diff --git a/test/tint/out_of_order_decls/alias/struct.wgsl b/test/tint/out_of_order_decls/alias/struct.wgsl index 923353b723..f736800c32 100644 --- a/test/tint/out_of_order_decls/alias/struct.wgsl +++ b/test/tint/out_of_order_decls/alias/struct.wgsl @@ -4,7 +4,7 @@ struct S { m : i32, } -@stage(fragment) +@fragment fn f() { var v : T; } diff --git a/test/tint/out_of_order_decls/alias/struct.wgsl.expected.hlsl b/test/tint/out_of_order_decls/alias/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/alias/struct.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/alias/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/out_of_order_decls/struct/alias.wgsl.expected.hlsl b/test/tint/out_of_order_decls/alias/struct.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/struct/alias.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/alias/struct.wgsl.expected.fxc.hlsl diff --git a/test/tint/out_of_order_decls/alias/struct.wgsl.expected.wgsl b/test/tint/out_of_order_decls/alias/struct.wgsl.expected.wgsl index 923353b723..f736800c32 100644 --- a/test/tint/out_of_order_decls/alias/struct.wgsl.expected.wgsl +++ b/test/tint/out_of_order_decls/alias/struct.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { m : i32, } -@stage(fragment) +@fragment fn f() { var v : T; } diff --git a/test/tint/out_of_order_decls/array/alias.wgsl b/test/tint/out_of_order_decls/array/alias.wgsl index 95cec5aee3..d7c7835611 100644 --- a/test/tint/out_of_order_decls/array/alias.wgsl +++ b/test/tint/out_of_order_decls/array/alias.wgsl @@ -1,7 +1,7 @@ var A : array; type T = i32; -@stage(fragment) +@fragment fn f() { A[0] = 1; } diff --git a/test/tint/out_of_order_decls/array/alias.wgsl.expected.hlsl b/test/tint/out_of_order_decls/array/alias.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/array/alias.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/array/alias.wgsl.expected.dxc.hlsl diff --git a/test/tint/out_of_order_decls/array/alias.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/array/alias.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2ce6c2494 --- /dev/null +++ b/test/tint/out_of_order_decls/array/alias.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +static int A[4] = (int[4])0; + +void f() { + A[0] = 1; + return; +} diff --git a/test/tint/out_of_order_decls/array/alias.wgsl.expected.msl b/test/tint/out_of_order_decls/array/alias.wgsl.expected.msl index e345a6d58f..3baeea6789 100644 --- a/test/tint/out_of_order_decls/array/alias.wgsl.expected.msl +++ b/test/tint/out_of_order_decls/array/alias.wgsl.expected.msl @@ -1,13 +1,22 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; fragment void f() { - thread tint_array_wrapper tint_symbol = {}; - tint_symbol.arr[0] = 1; + thread tint_array tint_symbol = {}; + tint_symbol[0] = 1; return; } diff --git a/test/tint/out_of_order_decls/array/alias.wgsl.expected.spvasm b/test/tint/out_of_order_decls/array/alias.wgsl.expected.spvasm index 0daa352c19..8cb67b3a24 100644 --- a/test/tint/out_of_order_decls/array/alias.wgsl.expected.spvasm +++ b/test/tint/out_of_order_decls/array/alias.wgsl.expected.spvasm @@ -19,12 +19,12 @@ %A = OpVariable %_ptr_Private__arr_int_uint_4 Private %7 %void = OpTypeVoid %8 = OpTypeFunction %void - %int_0 = OpConstant %int 0 + %12 = OpConstantNull %int %_ptr_Private_int = OpTypePointer Private %int %int_1 = OpConstant %int 1 %f = OpFunction %void None %8 %11 = OpLabel - %14 = OpAccessChain %_ptr_Private_int %A %int_0 + %14 = OpAccessChain %_ptr_Private_int %A %12 OpStore %14 %int_1 OpReturn OpFunctionEnd diff --git a/test/tint/out_of_order_decls/array/alias.wgsl.expected.wgsl b/test/tint/out_of_order_decls/array/alias.wgsl.expected.wgsl index 1e581e047f..5d17f7b0f8 100644 --- a/test/tint/out_of_order_decls/array/alias.wgsl.expected.wgsl +++ b/test/tint/out_of_order_decls/array/alias.wgsl.expected.wgsl @@ -2,7 +2,7 @@ var A : array; type T = i32; -@stage(fragment) +@fragment fn f() { A[0] = 1; } diff --git a/test/tint/out_of_order_decls/array/struct.wgsl b/test/tint/out_of_order_decls/array/struct.wgsl index 70d1560b0a..47495d9bd7 100644 --- a/test/tint/out_of_order_decls/array/struct.wgsl +++ b/test/tint/out_of_order_decls/array/struct.wgsl @@ -3,7 +3,7 @@ struct S { m : i32, }; -@stage(fragment) +@fragment fn f() { A[0] = S(1); } diff --git a/test/tint/out_of_order_decls/array/struct.wgsl.expected.hlsl b/test/tint/out_of_order_decls/array/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/array/struct.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/array/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/out_of_order_decls/array/struct.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/array/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a708176999 --- /dev/null +++ b/test/tint/out_of_order_decls/array/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +struct S { + int m; +}; + +static S A[4] = (S[4])0; + +void f() { + const S tint_symbol = {1}; + A[0] = tint_symbol; + return; +} diff --git a/test/tint/out_of_order_decls/array/struct.wgsl.expected.msl b/test/tint/out_of_order_decls/array/struct.wgsl.expected.msl index 4e91e2e7f0..19160b5128 100644 --- a/test/tint/out_of_order_decls/array/struct.wgsl.expected.msl +++ b/test/tint/out_of_order_decls/array/struct.wgsl.expected.msl @@ -1,18 +1,27 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { int m; }; -struct tint_array_wrapper { - S arr[4]; -}; - fragment void f() { - thread tint_array_wrapper tint_symbol_1 = {}; - S const tint_symbol = {.m=1}; - tint_symbol_1.arr[0] = tint_symbol; + thread tint_array tint_symbol_1 = {}; + S const tint_symbol = S{.m=1}; + tint_symbol_1[0] = tint_symbol; return; } diff --git a/test/tint/out_of_order_decls/array/struct.wgsl.expected.spvasm b/test/tint/out_of_order_decls/array/struct.wgsl.expected.spvasm index 317a4459c1..3358b89277 100644 --- a/test/tint/out_of_order_decls/array/struct.wgsl.expected.spvasm +++ b/test/tint/out_of_order_decls/array/struct.wgsl.expected.spvasm @@ -23,13 +23,13 @@ %A = OpVariable %_ptr_Private__arr_S_uint_4 Private %8 %void = OpTypeVoid %9 = OpTypeFunction %void - %int_0 = OpConstant %int 0 + %13 = OpConstantNull %int %_ptr_Private_S = OpTypePointer Private %S %int_1 = OpConstant %int 1 %17 = OpConstantComposite %S %int_1 %f = OpFunction %void None %9 %12 = OpLabel - %15 = OpAccessChain %_ptr_Private_S %A %int_0 + %15 = OpAccessChain %_ptr_Private_S %A %13 OpStore %15 %17 OpReturn OpFunctionEnd diff --git a/test/tint/out_of_order_decls/array/struct.wgsl.expected.wgsl b/test/tint/out_of_order_decls/array/struct.wgsl.expected.wgsl index 30d0f58006..92a79ac69c 100644 --- a/test/tint/out_of_order_decls/array/struct.wgsl.expected.wgsl +++ b/test/tint/out_of_order_decls/array/struct.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { m : i32, } -@stage(fragment) +@fragment fn f() { A[0] = S(1); } diff --git a/test/tint/out_of_order_decls/func/const.wgsl b/test/tint/out_of_order_decls/func/const.wgsl new file mode 100644 index 0000000000..df32cd305c --- /dev/null +++ b/test/tint/out_of_order_decls/func/const.wgsl @@ -0,0 +1,6 @@ +@fragment +fn f() { + const b = a; +} + +const a : i32 = 1; diff --git a/test/tint/out_of_order_decls/func/const.wgsl.expected.dxc.hlsl b/test/tint/out_of_order_decls/func/const.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f55de9249e --- /dev/null +++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.dxc.hlsl @@ -0,0 +1,3 @@ +void f() { + return; +} diff --git a/test/tint/out_of_order_decls/func/const.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/func/const.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f55de9249e --- /dev/null +++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.fxc.hlsl @@ -0,0 +1,3 @@ +void f() { + return; +} diff --git a/test/tint/out_of_order_decls/func/const.wgsl.expected.glsl b/test/tint/out_of_order_decls/func/const.wgsl.expected.glsl new file mode 100644 index 0000000000..3d91b99378 --- /dev/null +++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.glsl @@ -0,0 +1,10 @@ +#version 310 es +precision mediump float; + +void f() { +} + +void main() { + f(); + return; +} diff --git a/test/tint/out_of_order_decls/func/const.wgsl.expected.msl b/test/tint/out_of_order_decls/func/const.wgsl.expected.msl new file mode 100644 index 0000000000..7733815ce3 --- /dev/null +++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +fragment void f() { + return; +} + diff --git a/test/tint/out_of_order_decls/func/const.wgsl.expected.spvasm b/test/tint/out_of_order_decls/func/const.wgsl.expected.spvasm new file mode 100644 index 0000000000..5a28811be7 --- /dev/null +++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.spvasm @@ -0,0 +1,16 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 5 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %f "f" + OpExecutionMode %f OriginUpperLeft + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %f = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/out_of_order_decls/func/const.wgsl.expected.wgsl b/test/tint/out_of_order_decls/func/const.wgsl.expected.wgsl new file mode 100644 index 0000000000..df32cd305c --- /dev/null +++ b/test/tint/out_of_order_decls/func/const.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +@fragment +fn f() { + const b = a; +} + +const a : i32 = 1; diff --git a/test/tint/out_of_order_decls/func/func.wgsl b/test/tint/out_of_order_decls/func/func.wgsl index 1a0f2129cd..20032c4a4f 100644 --- a/test/tint/out_of_order_decls/func/func.wgsl +++ b/test/tint/out_of_order_decls/func/func.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn f1() { f2(); } diff --git a/test/tint/out_of_order_decls/func/func.wgsl.expected.hlsl b/test/tint/out_of_order_decls/func/func.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/func/func.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/func/func.wgsl.expected.dxc.hlsl diff --git a/test/tint/out_of_order_decls/func/func.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/func/func.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..620afd7ef0 --- /dev/null +++ b/test/tint/out_of_order_decls/func/func.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +void f2() { +} + +void f1() { + f2(); + return; +} diff --git a/test/tint/out_of_order_decls/func/func.wgsl.expected.wgsl b/test/tint/out_of_order_decls/func/func.wgsl.expected.wgsl index 1a0f2129cd..20032c4a4f 100644 --- a/test/tint/out_of_order_decls/func/func.wgsl.expected.wgsl +++ b/test/tint/out_of_order_decls/func/func.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn f1() { f2(); } diff --git a/test/tint/out_of_order_decls/func/let.wgsl b/test/tint/out_of_order_decls/func/let.wgsl deleted file mode 100644 index 25a56c629b..0000000000 --- a/test/tint/out_of_order_decls/func/let.wgsl +++ /dev/null @@ -1,6 +0,0 @@ -@stage(fragment) -fn f() { - let b = a; -} - -let a : i32 = 1; diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.hlsl b/test/tint/out_of_order_decls/func/let.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/func/let.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/func/let.wgsl.expected.dxc.hlsl diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/func/let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c35c25093b --- /dev/null +++ b/test/tint/out_of_order_decls/func/let.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +static const int a = 1; + +void f() { + const int b = a; + return; +} diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.glsl b/test/tint/out_of_order_decls/func/let.wgsl.expected.glsl deleted file mode 100644 index f308959472..0000000000 --- a/test/tint/out_of_order_decls/func/let.wgsl.expected.glsl +++ /dev/null @@ -1,12 +0,0 @@ -#version 310 es -precision mediump float; - -const int a = 1; -void f() { - int b = a; -} - -void main() { - f(); - return; -} diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.msl b/test/tint/out_of_order_decls/func/let.wgsl.expected.msl deleted file mode 100644 index 2509d6c788..0000000000 --- a/test/tint/out_of_order_decls/func/let.wgsl.expected.msl +++ /dev/null @@ -1,10 +0,0 @@ -#include - -using namespace metal; -constant int a = 1; - -fragment void f() { - int const b = a; - return; -} - diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.spvasm b/test/tint/out_of_order_decls/func/let.wgsl.expected.spvasm deleted file mode 100644 index 452861f2a1..0000000000 --- a/test/tint/out_of_order_decls/func/let.wgsl.expected.spvasm +++ /dev/null @@ -1,19 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 7 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %f "f" - OpExecutionMode %f OriginUpperLeft - OpName %a "a" - OpName %f "f" - %int = OpTypeInt 32 1 - %a = OpConstant %int 1 - %void = OpTypeVoid - %3 = OpTypeFunction %void - %f = OpFunction %void None %3 - %6 = OpLabel - OpReturn - OpFunctionEnd diff --git a/test/tint/out_of_order_decls/func/let.wgsl.expected.wgsl b/test/tint/out_of_order_decls/func/let.wgsl.expected.wgsl deleted file mode 100644 index 25a56c629b..0000000000 --- a/test/tint/out_of_order_decls/func/let.wgsl.expected.wgsl +++ /dev/null @@ -1,6 +0,0 @@ -@stage(fragment) -fn f() { - let b = a; -} - -let a : i32 = 1; diff --git a/test/tint/out_of_order_decls/func/type.wgsl b/test/tint/out_of_order_decls/func/type.wgsl index 4810fc1639..596ac2cc64 100644 --- a/test/tint/out_of_order_decls/func/type.wgsl +++ b/test/tint/out_of_order_decls/func/type.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn f() { var b : T; } diff --git a/test/tint/out_of_order_decls/func/type.wgsl.expected.hlsl b/test/tint/out_of_order_decls/func/type.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/func/type.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/func/type.wgsl.expected.dxc.hlsl diff --git a/test/tint/out_of_order_decls/func/type.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/func/type.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f4b327c8b7 --- /dev/null +++ b/test/tint/out_of_order_decls/func/type.wgsl.expected.fxc.hlsl @@ -0,0 +1,4 @@ +void f() { + int b = 0; + return; +} diff --git a/test/tint/out_of_order_decls/func/type.wgsl.expected.wgsl b/test/tint/out_of_order_decls/func/type.wgsl.expected.wgsl index 4810fc1639..596ac2cc64 100644 --- a/test/tint/out_of_order_decls/func/type.wgsl.expected.wgsl +++ b/test/tint/out_of_order_decls/func/type.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn f() { var b : T; } diff --git a/test/tint/out_of_order_decls/func/var.wgsl b/test/tint/out_of_order_decls/func/var.wgsl index d77a968c7a..4635429d4d 100644 --- a/test/tint/out_of_order_decls/func/var.wgsl +++ b/test/tint/out_of_order_decls/func/var.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn f() { let b = a; } diff --git a/test/tint/out_of_order_decls/func/var.wgsl.expected.hlsl b/test/tint/out_of_order_decls/func/var.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/func/var.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/func/var.wgsl.expected.dxc.hlsl diff --git a/test/tint/out_of_order_decls/func/var.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/func/var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..813886a581 --- /dev/null +++ b/test/tint/out_of_order_decls/func/var.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +static int a = 1; + +void f() { + const int b = a; + return; +} diff --git a/test/tint/out_of_order_decls/func/var.wgsl.expected.wgsl b/test/tint/out_of_order_decls/func/var.wgsl.expected.wgsl index d77a968c7a..4635429d4d 100644 --- a/test/tint/out_of_order_decls/func/var.wgsl.expected.wgsl +++ b/test/tint/out_of_order_decls/func/var.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn f() { let b = a; } diff --git a/test/tint/out_of_order_decls/struct/alias.wgsl b/test/tint/out_of_order_decls/struct/alias.wgsl index 57dd249b7b..84f867976d 100644 --- a/test/tint/out_of_order_decls/struct/alias.wgsl +++ b/test/tint/out_of_order_decls/struct/alias.wgsl @@ -4,7 +4,7 @@ struct S { type T = i32; -@stage(fragment) +@fragment fn f() { var v : S; } diff --git a/test/tint/out_of_order_decls/struct/alias.wgsl.expected.dxc.hlsl b/test/tint/out_of_order_decls/struct/alias.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c113dacf08 --- /dev/null +++ b/test/tint/out_of_order_decls/struct/alias.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +struct S { + int m; +}; + +void f() { + S v = (S)0; + return; +} diff --git a/test/tint/out_of_order_decls/struct/alias.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/struct/alias.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c113dacf08 --- /dev/null +++ b/test/tint/out_of_order_decls/struct/alias.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +struct S { + int m; +}; + +void f() { + S v = (S)0; + return; +} diff --git a/test/tint/out_of_order_decls/struct/alias.wgsl.expected.wgsl b/test/tint/out_of_order_decls/struct/alias.wgsl.expected.wgsl index 57dd249b7b..84f867976d 100644 --- a/test/tint/out_of_order_decls/struct/alias.wgsl.expected.wgsl +++ b/test/tint/out_of_order_decls/struct/alias.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { type T = i32; -@stage(fragment) +@fragment fn f() { var v : S; } diff --git a/test/tint/out_of_order_decls/struct/struct.wgsl b/test/tint/out_of_order_decls/struct/struct.wgsl index 44e20301db..3c7857950b 100644 --- a/test/tint/out_of_order_decls/struct/struct.wgsl +++ b/test/tint/out_of_order_decls/struct/struct.wgsl @@ -6,7 +6,7 @@ struct S2 { m : i32, } -@stage(fragment) +@fragment fn f() { var v : S1; } diff --git a/test/tint/out_of_order_decls/struct/struct.wgsl.expected.hlsl b/test/tint/out_of_order_decls/struct/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/out_of_order_decls/struct/struct.wgsl.expected.hlsl rename to test/tint/out_of_order_decls/struct/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/out_of_order_decls/struct/struct.wgsl.expected.fxc.hlsl b/test/tint/out_of_order_decls/struct/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2f48847da4 --- /dev/null +++ b/test/tint/out_of_order_decls/struct/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +struct S2 { + int m; +}; +struct S1 { + S2 m; +}; + +void f() { + S1 v = (S1)0; + return; +} diff --git a/test/tint/out_of_order_decls/struct/struct.wgsl.expected.wgsl b/test/tint/out_of_order_decls/struct/struct.wgsl.expected.wgsl index 44e20301db..3c7857950b 100644 --- a/test/tint/out_of_order_decls/struct/struct.wgsl.expected.wgsl +++ b/test/tint/out_of_order_decls/struct/struct.wgsl.expected.wgsl @@ -6,7 +6,7 @@ struct S2 { m : i32, } -@stage(fragment) +@fragment fn f() { var v : S1; } diff --git a/test/tint/ptr_ref/access/matrix.spvasm.expected.dxc.hlsl b/test/tint/ptr_ref/access/matrix.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..35e3f879f4 --- /dev/null +++ b/test/tint/ptr_ref/access/matrix.spvasm.expected.dxc.hlsl @@ -0,0 +1,12 @@ +void main_1() { + float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + m[1] = (5.0f).xxx; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/access/matrix.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/access/matrix.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..35e3f879f4 --- /dev/null +++ b/test/tint/ptr_ref/access/matrix.spvasm.expected.fxc.hlsl @@ -0,0 +1,12 @@ +void main_1() { + float3x3 m = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + m[1] = (5.0f).xxx; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/access/matrix.spvasm.expected.glsl b/test/tint/ptr_ref/access/matrix.spvasm.expected.glsl index 847b175048..a63164b19b 100644 --- a/test/tint/ptr_ref/access/matrix.spvasm.expected.glsl +++ b/test/tint/ptr_ref/access/matrix.spvasm.expected.glsl @@ -1,9 +1,9 @@ #version 310 es void main_1() { - mat3 m = mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + mat3 m = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f)); m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); - m[1] = vec3(5.0f, 5.0f, 5.0f); + m[1] = vec3(5.0f); return; } diff --git a/test/tint/ptr_ref/access/matrix.spvasm.expected.hlsl b/test/tint/ptr_ref/access/matrix.spvasm.expected.hlsl deleted file mode 100644 index b5e352e7a9..0000000000 --- a/test/tint/ptr_ref/access/matrix.spvasm.expected.hlsl +++ /dev/null @@ -1,12 +0,0 @@ -void main_1() { - float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); - m[1] = float3(5.0f, 5.0f, 5.0f); - return; -} - -[numthreads(1, 1, 1)] -void main() { - main_1(); - return; -} diff --git a/test/tint/ptr_ref/access/matrix.spvasm.expected.msl b/test/tint/ptr_ref/access/matrix.spvasm.expected.msl index e301589b54..4b2c2f7462 100644 --- a/test/tint/ptr_ref/access/matrix.spvasm.expected.msl +++ b/test/tint/ptr_ref/access/matrix.spvasm.expected.msl @@ -2,9 +2,9 @@ using namespace metal; void main_1() { - float3x3 m = float3x3(); + float3x3 m = float3x3(float3(0.0f), float3(0.0f), float3(0.0f)); m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); - m[1] = float3(5.0f, 5.0f, 5.0f); + m[1] = float3(5.0f); return; } diff --git a/test/tint/ptr_ref/access/matrix.spvasm.expected.wgsl b/test/tint/ptr_ref/access/matrix.spvasm.expected.wgsl index 1df5dca066..b91370980a 100644 --- a/test/tint/ptr_ref/access/matrix.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/access/matrix.spvasm.expected.wgsl @@ -1,11 +1,11 @@ fn main_1() { var m : mat3x3 = mat3x3(); - m = mat3x3(vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0)); - m[1i] = vec3(5.0, 5.0, 5.0); + m = mat3x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); + m[1i] = vec3(5.0f, 5.0f, 5.0f); return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/access/matrix.wgsl b/test/tint/ptr_ref/access/matrix.wgsl index a085846214..de714c896c 100644 --- a/test/tint/ptr_ref/access/matrix.wgsl +++ b/test/tint/ptr_ref/access/matrix.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m : mat3x3 = mat3x3(vec3(1., 2., 3.), vec3(4., 5., 6.), vec3(7., 8., 9.)); let v : ptr> = &m[1]; diff --git a/test/tint/ptr_ref/access/matrix.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/access/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a5e6043054 --- /dev/null +++ b/test/tint/ptr_ref/access/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + m[1] = (5.0f).xxx; + return; +} diff --git a/test/tint/ptr_ref/access/matrix.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/access/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a5e6043054 --- /dev/null +++ b/test/tint/ptr_ref/access/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + m[1] = (5.0f).xxx; + return; +} diff --git a/test/tint/ptr_ref/access/matrix.wgsl.expected.glsl b/test/tint/ptr_ref/access/matrix.wgsl.expected.glsl index c1b09b2a53..f8a78066ba 100644 --- a/test/tint/ptr_ref/access/matrix.wgsl.expected.glsl +++ b/test/tint/ptr_ref/access/matrix.wgsl.expected.glsl @@ -2,7 +2,7 @@ void tint_symbol() { mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); - m[1] = vec3(5.0f, 5.0f, 5.0f); + m[1] = vec3(5.0f); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/access/matrix.wgsl.expected.hlsl b/test/tint/ptr_ref/access/matrix.wgsl.expected.hlsl deleted file mode 100644 index d9daaaa463..0000000000 --- a/test/tint/ptr_ref/access/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void main() { - float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); - m[1] = float3(5.0f, 5.0f, 5.0f); - return; -} diff --git a/test/tint/ptr_ref/access/matrix.wgsl.expected.msl b/test/tint/ptr_ref/access/matrix.wgsl.expected.msl index 75c13af6bb..7454aafaef 100644 --- a/test/tint/ptr_ref/access/matrix.wgsl.expected.msl +++ b/test/tint/ptr_ref/access/matrix.wgsl.expected.msl @@ -3,7 +3,7 @@ using namespace metal; kernel void tint_symbol() { float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); - m[1] = float3(5.0f, 5.0f, 5.0f); + m[1] = float3(5.0f); return; } diff --git a/test/tint/ptr_ref/access/matrix.wgsl.expected.wgsl b/test/tint/ptr_ref/access/matrix.wgsl.expected.wgsl index 110e6e6f2e..4f9a3540e0 100644 --- a/test/tint/ptr_ref/access/matrix.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/access/matrix.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var m : mat3x3 = mat3x3(vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0)); let v : ptr> = &(m[1]); diff --git a/test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.hlsl b/test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.hlsl rename to test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..0bc2907bba --- /dev/null +++ b/test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.fxc.hlsl @@ -0,0 +1,10 @@ +void main_1() { + uint x_10 = 0u; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.wgsl b/test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.wgsl index ca43748aa7..a063457ab4 100644 --- a/test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/copy/ptr_copy.spvasm.expected.wgsl @@ -3,7 +3,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/load/global/i32.spvasm.expected.hlsl b/test/tint/ptr_ref/load/global/i32.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/load/global/i32.spvasm.expected.hlsl rename to test/tint/ptr_ref/load/global/i32.spvasm.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/load/global/i32.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/load/global/i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..a75ddfaa7d --- /dev/null +++ b/test/tint/ptr_ref/load/global/i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,12 @@ +static int I = 0; + +void main_1() { + const int x_11 = (I + 1); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/load/global/i32.spvasm.expected.msl b/test/tint/ptr_ref/load/global/i32.spvasm.expected.msl index 178b0a5e25..7e3e1024d6 100644 --- a/test/tint/ptr_ref/load/global/i32.spvasm.expected.msl +++ b/test/tint/ptr_ref/load/global/i32.spvasm.expected.msl @@ -1,15 +1,15 @@ #include using namespace metal; -void main_1(thread int* const tint_symbol_1) { - int const x_9 = *(tint_symbol_1); +void main_1() { + thread int tint_symbol_1 = 0; + int const x_9 = tint_symbol_1; int const x_11 = as_type((as_type(x_9) + as_type(1))); return; } kernel void tint_symbol() { - thread int tint_symbol_2 = 0; - main_1(&(tint_symbol_2)); + main_1(); return; } diff --git a/test/tint/ptr_ref/load/global/i32.spvasm.expected.spvasm b/test/tint/ptr_ref/load/global/i32.spvasm.expected.spvasm index c105555c7e..5aa12a3739 100644 --- a/test/tint/ptr_ref/load/global/i32.spvasm.expected.spvasm +++ b/test/tint/ptr_ref/load/global/i32.spvasm.expected.spvasm @@ -11,9 +11,9 @@ OpName %main_1 "main_1" OpName %main "main" %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %2 = OpConstantNull %int %_ptr_Private_int = OpTypePointer Private %int - %I = OpVariable %_ptr_Private_int Private %int_0 + %I = OpVariable %_ptr_Private_int Private %2 %void = OpTypeVoid %5 = OpTypeFunction %void %int_1 = OpConstant %int 1 diff --git a/test/tint/ptr_ref/load/global/i32.spvasm.expected.wgsl b/test/tint/ptr_ref/load/global/i32.spvasm.expected.wgsl index 24b4dd516e..52e0e8a9fd 100644 --- a/test/tint/ptr_ref/load/global/i32.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/load/global/i32.spvasm.expected.wgsl @@ -6,7 +6,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/load/global/i32.wgsl b/test/tint/ptr_ref/load/global/i32.wgsl index 4f620cf709..2d2c182ca8 100644 --- a/test/tint/ptr_ref/load/global/i32.wgsl +++ b/test/tint/ptr_ref/load/global/i32.wgsl @@ -1,7 +1,7 @@ var I : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let i : i32 = I; - let use : i32 = i + 1; + let u : i32 = i + 1; } diff --git a/test/tint/ptr_ref/load/global/i32.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/global/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ac0732445b --- /dev/null +++ b/test/tint/ptr_ref/load/global/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +static int I = 0; + +[numthreads(1, 1, 1)] +void main() { + const int u = (I + 1); + return; +} diff --git a/test/tint/ptr_ref/load/global/i32.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/global/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac0732445b --- /dev/null +++ b/test/tint/ptr_ref/load/global/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +static int I = 0; + +[numthreads(1, 1, 1)] +void main() { + const int u = (I + 1); + return; +} diff --git a/test/tint/ptr_ref/load/global/i32.wgsl.expected.glsl b/test/tint/ptr_ref/load/global/i32.wgsl.expected.glsl index aa41a9444b..06c5a43c3d 100644 --- a/test/tint/ptr_ref/load/global/i32.wgsl.expected.glsl +++ b/test/tint/ptr_ref/load/global/i32.wgsl.expected.glsl @@ -2,7 +2,7 @@ int I = 0; void tint_symbol() { - int use = (I + 1); + int u = (I + 1); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/load/global/i32.wgsl.expected.hlsl b/test/tint/ptr_ref/load/global/i32.wgsl.expected.hlsl deleted file mode 100644 index 788136bba2..0000000000 --- a/test/tint/ptr_ref/load/global/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -static int I = 0; - -[numthreads(1, 1, 1)] -void main() { - const int use = (I + 1); - return; -} diff --git a/test/tint/ptr_ref/load/global/i32.wgsl.expected.msl b/test/tint/ptr_ref/load/global/i32.wgsl.expected.msl index a041b63463..9aa2253d4b 100644 --- a/test/tint/ptr_ref/load/global/i32.wgsl.expected.msl +++ b/test/tint/ptr_ref/load/global/i32.wgsl.expected.msl @@ -4,7 +4,7 @@ using namespace metal; kernel void tint_symbol() { thread int tint_symbol_1 = 0; int const i = tint_symbol_1; - int const use = as_type((as_type(i) + as_type(1))); + int const u = as_type((as_type(i) + as_type(1))); return; } diff --git a/test/tint/ptr_ref/load/global/i32.wgsl.expected.wgsl b/test/tint/ptr_ref/load/global/i32.wgsl.expected.wgsl index 5e1feeac37..f9f42bcdef 100644 --- a/test/tint/ptr_ref/load/global/i32.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/global/i32.wgsl.expected.wgsl @@ -1,7 +1,7 @@ var I : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let i : i32 = I; - let use : i32 = (i + 1); + let u : i32 = (i + 1); } diff --git a/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.hlsl b/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/load/global/struct_field.spvasm.expected.hlsl rename to test/tint/ptr_ref/load/global/struct_field.spvasm.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4025850136 --- /dev/null +++ b/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.fxc.hlsl @@ -0,0 +1,18 @@ +struct S { + int i; +}; + +static S V = (S)0; + +void main_1() { + int i = 0; + const int x_15 = V.i; + i = x_15; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.msl b/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.msl index 5ac3552344..211485e551 100644 --- a/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.msl +++ b/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.msl @@ -5,16 +5,16 @@ struct S { int i; }; -void main_1(thread S* const tint_symbol_1) { +void main_1() { + thread S tint_symbol_1 = {}; int i = 0; - int const x_15 = (*(tint_symbol_1)).i; + int const x_15 = tint_symbol_1.i; i = x_15; return; } kernel void tint_symbol() { - thread S tint_symbol_2 = {}; - main_1(&(tint_symbol_2)); + main_1(); return; } diff --git a/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.wgsl b/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.wgsl index e3c0fd1e89..477c131115 100644 --- a/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/load/global/struct_field.spvasm.expected.wgsl @@ -11,7 +11,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/load/global/struct_field.wgsl b/test/tint/ptr_ref/load/global/struct_field.wgsl index 071ef62be9..949a6082b8 100644 --- a/test/tint/ptr_ref/load/global/struct_field.wgsl +++ b/test/tint/ptr_ref/load/global/struct_field.wgsl @@ -4,7 +4,7 @@ struct S { var V : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let i : i32 = V.i; } diff --git a/test/tint/ptr_ref/load/global/struct_field.wgsl.expected.hlsl b/test/tint/ptr_ref/load/global/struct_field.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/load/global/struct_field.wgsl.expected.hlsl rename to test/tint/ptr_ref/load/global/struct_field.wgsl.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/load/global/struct_field.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/global/struct_field.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f40dad1e68 --- /dev/null +++ b/test/tint/ptr_ref/load/global/struct_field.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +struct S { + int i; +}; + +static S V = (S)0; + +[numthreads(1, 1, 1)] +void main() { + const int i = V.i; + return; +} diff --git a/test/tint/ptr_ref/load/global/struct_field.wgsl.expected.wgsl b/test/tint/ptr_ref/load/global/struct_field.wgsl.expected.wgsl index 4813b5aaa8..a53018707e 100644 --- a/test/tint/ptr_ref/load/global/struct_field.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/global/struct_field.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { var V : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let i : i32 = V.i; } diff --git a/test/tint/ptr_ref/load/local/i32.spvasm.expected.hlsl b/test/tint/ptr_ref/load/local/i32.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/load/local/i32.spvasm.expected.hlsl rename to test/tint/ptr_ref/load/local/i32.spvasm.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/load/local/i32.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..3f9ee138cb --- /dev/null +++ b/test/tint/ptr_ref/load/local/i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,12 @@ +void main_1() { + int i = 0; + i = 123; + const int x_12 = (i + 1); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/load/local/i32.spvasm.expected.spvasm b/test/tint/ptr_ref/load/local/i32.spvasm.expected.spvasm index f5dfd09b77..65e31c289d 100644 --- a/test/tint/ptr_ref/load/local/i32.spvasm.expected.spvasm +++ b/test/tint/ptr_ref/load/local/i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -13,22 +13,21 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %6 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %9 = OpConstantNull %int %int_123 = OpConstant %int 123 %int_1 = OpConstant %int 1 %main_1 = OpFunction %void None %1 %4 = OpLabel - %i = OpVariable %_ptr_Function_int Function %9 - OpStore %i %int_0 + %i = OpVariable %_ptr_Function_int Function %6 + OpStore %i %6 OpStore %i %int_123 - %11 = OpLoad %int %i - %13 = OpIAdd %int %11 %int_1 + %10 = OpLoad %int %i + %12 = OpIAdd %int %10 %int_1 OpReturn OpFunctionEnd %main = OpFunction %void None %1 - %15 = OpLabel - %16 = OpFunctionCall %void %main_1 + %14 = OpLabel + %15 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/load/local/i32.spvasm.expected.wgsl b/test/tint/ptr_ref/load/local/i32.spvasm.expected.wgsl index 6ffac578e4..e576470d59 100644 --- a/test/tint/ptr_ref/load/local/i32.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/load/local/i32.spvasm.expected.wgsl @@ -6,7 +6,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/load/local/i32.wgsl b/test/tint/ptr_ref/load/local/i32.wgsl index 6c30f81ee2..df29ea499b 100644 --- a/test/tint/ptr_ref/load/local/i32.wgsl +++ b/test/tint/ptr_ref/load/local/i32.wgsl @@ -1,5 +1,5 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; - let use : i32 = i + 1; + let u : i32 = i + 1; } diff --git a/test/tint/ptr_ref/load/local/i32.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/local/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a85842699a --- /dev/null +++ b/test/tint/ptr_ref/load/local/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + int i = 123; + const int u = (i + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/i32.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a85842699a --- /dev/null +++ b/test/tint/ptr_ref/load/local/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + int i = 123; + const int u = (i + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/i32.wgsl.expected.glsl b/test/tint/ptr_ref/load/local/i32.wgsl.expected.glsl index 64ed85ed44..65171a9a92 100644 --- a/test/tint/ptr_ref/load/local/i32.wgsl.expected.glsl +++ b/test/tint/ptr_ref/load/local/i32.wgsl.expected.glsl @@ -2,7 +2,7 @@ void tint_symbol() { int i = 123; - int use = (i + 1); + int u = (i + 1); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/load/local/i32.wgsl.expected.hlsl b/test/tint/ptr_ref/load/local/i32.wgsl.expected.hlsl deleted file mode 100644 index d360aae1b5..0000000000 --- a/test/tint/ptr_ref/load/local/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void main() { - int i = 123; - const int use = (i + 1); - return; -} diff --git a/test/tint/ptr_ref/load/local/i32.wgsl.expected.msl b/test/tint/ptr_ref/load/local/i32.wgsl.expected.msl index 57e23d32f2..53b26da114 100644 --- a/test/tint/ptr_ref/load/local/i32.wgsl.expected.msl +++ b/test/tint/ptr_ref/load/local/i32.wgsl.expected.msl @@ -3,7 +3,7 @@ using namespace metal; kernel void tint_symbol() { int i = 123; - int const use = as_type((as_type(i) + as_type(1))); + int const u = as_type((as_type(i) + as_type(1))); return; } diff --git a/test/tint/ptr_ref/load/local/i32.wgsl.expected.wgsl b/test/tint/ptr_ref/load/local/i32.wgsl.expected.wgsl index 587375ef98..c81c6d374f 100644 --- a/test/tint/ptr_ref/load/local/i32.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/local/i32.wgsl.expected.wgsl @@ -1,5 +1,5 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; - let use : i32 = (i + 1); + let u : i32 = (i + 1); } diff --git a/test/tint/ptr_ref/load/local/ptr_function.wgsl b/test/tint/ptr_ref/load/local/ptr_function.wgsl index ddaafb2c15..96b672cb91 100644 --- a/test/tint/ptr_ref/load/local/ptr_function.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_function.wgsl @@ -1,6 +1,6 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; let p : ptr = &i; - let use : i32 = *p + 1; + let u : i32 = *p + 1; } diff --git a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a85842699a --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + int i = 123; + const int u = (i + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a85842699a --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + int i = 123; + const int u = (i + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.glsl b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.glsl index 64ed85ed44..65171a9a92 100644 --- a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.glsl +++ b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.glsl @@ -2,7 +2,7 @@ void tint_symbol() { int i = 123; - int use = (i + 1); + int u = (i + 1); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.hlsl b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.hlsl deleted file mode 100644 index d360aae1b5..0000000000 --- a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -[numthreads(1, 1, 1)] -void main() { - int i = 123; - const int use = (i + 1); - return; -} diff --git a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.msl b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.msl index 57e23d32f2..53b26da114 100644 --- a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.msl +++ b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.msl @@ -3,7 +3,7 @@ using namespace metal; kernel void tint_symbol() { int i = 123; - int const use = as_type((as_type(i) + as_type(1))); + int const u = as_type((as_type(i) + as_type(1))); return; } diff --git a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.wgsl b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.wgsl index e29289c7e9..bdf0598bd8 100644 --- a/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_function.wgsl.expected.wgsl @@ -1,6 +1,6 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; let p : ptr = &(i); - let use : i32 = (*(p) + 1); + let u : i32 = (*(p) + 1); } diff --git a/test/tint/ptr_ref/load/local/ptr_private.wgsl b/test/tint/ptr_ref/load/local/ptr_private.wgsl index 0f59ad5946..42abd9dd28 100644 --- a/test/tint/ptr_ref/load/local/ptr_private.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_private.wgsl @@ -1,7 +1,7 @@ var i : i32 = 123; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p : ptr = &i; - let use : i32 = *p + 1; + let u : i32 = *p + 1; } diff --git a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2fd76b60d3 --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +static int i = 123; + +[numthreads(1, 1, 1)] +void main() { + const int u = (i + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2fd76b60d3 --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +static int i = 123; + +[numthreads(1, 1, 1)] +void main() { + const int u = (i + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.glsl b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.glsl index 4add6dd56f..f83fa9557a 100644 --- a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.glsl +++ b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.glsl @@ -2,7 +2,7 @@ int i = 123; void tint_symbol() { - int use = (i + 1); + int u = (i + 1); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.hlsl b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.hlsl deleted file mode 100644 index 2de131c8b0..0000000000 --- a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -static int i = 123; - -[numthreads(1, 1, 1)] -void main() { - const int use = (i + 1); - return; -} diff --git a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.msl b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.msl index bbb957e5f1..1b95dbcedd 100644 --- a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.msl +++ b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.msl @@ -3,7 +3,7 @@ using namespace metal; kernel void tint_symbol() { thread int tint_symbol_1 = 123; - int const use = as_type((as_type(tint_symbol_1) + as_type(1))); + int const u = as_type((as_type(tint_symbol_1) + as_type(1))); return; } diff --git a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.wgsl b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.wgsl index 9b77f46346..d3b58b3373 100644 --- a/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_private.wgsl.expected.wgsl @@ -1,7 +1,7 @@ var i : i32 = 123; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p : ptr = &(i); - let use : i32 = (*(p) + 1); + let u : i32 = (*(p) + 1); } diff --git a/test/tint/ptr_ref/load/local/ptr_storage.wgsl b/test/tint/ptr_ref/load/local/ptr_storage.wgsl index b760937c93..886bb898c7 100644 --- a/test/tint/ptr_ref/load/local/ptr_storage.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_storage.wgsl @@ -5,8 +5,8 @@ struct S { @group(0) @binding(0) var v : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p : ptr = &v.a; - let use : i32 = *p + 1; + let u : i32 = *p + 1; } diff --git a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a5e71a793b --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +RWByteAddressBuffer v : register(u0, space0); + +[numthreads(1, 1, 1)] +void main() { + const int u = (asint(v.Load(0u)) + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a5e71a793b --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +RWByteAddressBuffer v : register(u0, space0); + +[numthreads(1, 1, 1)] +void main() { + const int u = (asint(v.Load(0u)) + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.glsl b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.glsl index e2b6f417d7..bd0575de56 100644 --- a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.glsl +++ b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.glsl @@ -8,7 +8,7 @@ layout(binding = 0, std430) buffer S_1 { int a; } v; void tint_symbol() { - int use = (v.a + 1); + int u = (v.a + 1); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.hlsl b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.hlsl deleted file mode 100644 index 4fa8bbd5fd..0000000000 --- a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -RWByteAddressBuffer v : register(u0, space0); - -[numthreads(1, 1, 1)] -void main() { - const int use = (asint(v.Load(0u)) + 1); - return; -} diff --git a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.msl b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.msl index ee2133d642..03332e6727 100644 --- a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.msl +++ b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.msl @@ -6,7 +6,7 @@ struct S { }; kernel void tint_symbol(device S* tint_symbol_1 [[buffer(0)]]) { - int const use = as_type((as_type((*(tint_symbol_1)).a) + as_type(1))); + int const u = as_type((as_type((*(tint_symbol_1)).a) + as_type(1))); return; } diff --git a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.wgsl b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.wgsl index 248519ad8d..049c0eaef9 100644 --- a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.wgsl @@ -4,8 +4,8 @@ struct S { @group(0) @binding(0) var v : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p : ptr = &(v.a); - let use : i32 = (*(p) + 1); + let u : i32 = (*(p) + 1); } diff --git a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl index 749a6e826a..03df7dc4c1 100644 --- a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl @@ -5,8 +5,8 @@ struct S { @group(0) @binding(0) var v : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p : ptr = &v.a; - let use : i32 = *p + 1; + let u : i32 = *p + 1; } diff --git a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d381b73ae --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +cbuffer cbuffer_v : register(b0, space0) { + uint4 v[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + const int u = (asint(v[0].x) + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d381b73ae --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +cbuffer cbuffer_v : register(b0, space0) { + uint4 v[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + const int u = (asint(v[0].x) + 1); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.glsl b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.glsl index 6be3235042..89067aa07c 100644 --- a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.glsl +++ b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.glsl @@ -9,7 +9,7 @@ layout(binding = 0) uniform S_1 { } v; void tint_symbol() { - int use = (v.a + 1); + int u = (v.a + 1); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.hlsl b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.hlsl deleted file mode 100644 index 634b49e6ae..0000000000 --- a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -cbuffer cbuffer_v : register(b0, space0) { - uint4 v[1]; -}; - -[numthreads(1, 1, 1)] -void main() { - const int use = (asint(v[0].x) + 1); - return; -} diff --git a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.msl b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.msl index f86222b70c..5014f2bb96 100644 --- a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.msl +++ b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.msl @@ -6,7 +6,7 @@ struct S { }; kernel void tint_symbol(const constant S* tint_symbol_1 [[buffer(0)]]) { - int const use = as_type((as_type((*(tint_symbol_1)).a) + as_type(1))); + int const u = as_type((as_type((*(tint_symbol_1)).a) + as_type(1))); return; } diff --git a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.wgsl b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.wgsl index e8af559b5e..eba1926268 100644 --- a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.wgsl @@ -4,8 +4,8 @@ struct S { @group(0) @binding(0) var v : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let p : ptr = &(v.a); - let use : i32 = (*(p) + 1); + let u : i32 = (*(p) + 1); } diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl index 269caa5259..e6ba479f0c 100644 --- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl @@ -1,8 +1,8 @@ var i : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { i = 123; let p : ptr = &i; - let use : i32 = *p + 1; + let u : i32 = *p + 1; } diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..74acc44573 --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.dxc.hlsl @@ -0,0 +1,20 @@ +groupshared int i; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + i = 0; + } + GroupMemoryBarrierWithGroupSync(); + i = 123; + const int u = (i + 1); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..74acc44573 --- /dev/null +++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.fxc.hlsl @@ -0,0 +1,20 @@ +groupshared int i; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + i = 0; + } + GroupMemoryBarrierWithGroupSync(); + i = 123; + const int u = (i + 1); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.glsl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.glsl index c18863e340..1a0274558d 100644 --- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.glsl +++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.glsl @@ -7,7 +7,7 @@ void tint_symbol(uint local_invocation_index) { } barrier(); i = 123; - int use = (i + 1); + int u = (i + 1); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.hlsl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.hlsl deleted file mode 100644 index fbd6076821..0000000000 --- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.hlsl +++ /dev/null @@ -1,20 +0,0 @@ -groupshared int i; - -struct tint_symbol_1 { - uint local_invocation_index : SV_GroupIndex; -}; - -void main_inner(uint local_invocation_index) { - { - i = 0; - } - GroupMemoryBarrierWithGroupSync(); - i = 123; - const int use = (i + 1); -} - -[numthreads(1, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.local_invocation_index); - return; -} diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.msl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.msl index 7853720bbc..f738b97458 100644 --- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.msl +++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.msl @@ -3,11 +3,11 @@ using namespace metal; void tint_symbol_inner(uint local_invocation_index, threadgroup int* const tint_symbol_1) { { - *(tint_symbol_1) = int(); + *(tint_symbol_1) = 0; } threadgroup_barrier(mem_flags::mem_threadgroup); *(tint_symbol_1) = 123; - int const use = as_type((as_type(*(tint_symbol_1)) + as_type(1))); + int const u = as_type((as_type(*(tint_symbol_1)) + as_type(1))); } kernel void tint_symbol(uint local_invocation_index [[thread_index_in_threadgroup]]) { diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.wgsl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.wgsl index 39ea1f58a1..0c40a6325d 100644 --- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.wgsl @@ -1,8 +1,8 @@ var i : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { i = 123; let p : ptr = &(i); - let use : i32 = (*(p) + 1); + let u : i32 = (*(p) + 1); } diff --git a/test/tint/ptr_ref/load/local/struct_field.spvasm.expected.hlsl b/test/tint/ptr_ref/load/local/struct_field.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/load/local/struct_field.spvasm.expected.hlsl rename to test/tint/ptr_ref/load/local/struct_field.spvasm.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/load/local/struct_field.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/struct_field.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..5404bcd40a --- /dev/null +++ b/test/tint/ptr_ref/load/local/struct_field.spvasm.expected.fxc.hlsl @@ -0,0 +1,17 @@ +struct S { + int i; +}; + +void main_1() { + int i = 0; + S V = (S)0; + const int x_14 = V.i; + i = x_14; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/load/local/struct_field.spvasm.expected.wgsl b/test/tint/ptr_ref/load/local/struct_field.spvasm.expected.wgsl index 9a273cd745..2e0efd8d05 100644 --- a/test/tint/ptr_ref/load/local/struct_field.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/load/local/struct_field.spvasm.expected.wgsl @@ -10,7 +10,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/load/local/struct_field.wgsl b/test/tint/ptr_ref/load/local/struct_field.wgsl index e2a02fbc78..1187babbfe 100644 --- a/test/tint/ptr_ref/load/local/struct_field.wgsl +++ b/test/tint/ptr_ref/load/local/struct_field.wgsl @@ -2,7 +2,7 @@ struct S { i : i32, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var V : S; var i : i32 = V.i; diff --git a/test/tint/ptr_ref/load/local/struct_field.wgsl.expected.hlsl b/test/tint/ptr_ref/load/local/struct_field.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/load/local/struct_field.wgsl.expected.hlsl rename to test/tint/ptr_ref/load/local/struct_field.wgsl.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/load/local/struct_field.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/struct_field.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67aaf4073a --- /dev/null +++ b/test/tint/ptr_ref/load/local/struct_field.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +struct S { + int i; +}; + +[numthreads(1, 1, 1)] +void main() { + S V = (S)0; + int i = V.i; + return; +} diff --git a/test/tint/ptr_ref/load/local/struct_field.wgsl.expected.wgsl b/test/tint/ptr_ref/load/local/struct_field.wgsl.expected.wgsl index 03fab9e24e..07b85a339e 100644 --- a/test/tint/ptr_ref/load/local/struct_field.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/local/struct_field.wgsl.expected.wgsl @@ -2,7 +2,7 @@ struct S { i : i32, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var V : S; var i : i32 = V.i; diff --git a/test/tint/ptr_ref/load/param/ptr.spvasm.expected.hlsl b/test/tint/ptr_ref/load/param/ptr.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/load/param/ptr.spvasm.expected.hlsl rename to test/tint/ptr_ref/load/param/ptr.spvasm.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/load/param/ptr.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/load/param/ptr.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..2ddad5c62e --- /dev/null +++ b/test/tint/ptr_ref/load/param/ptr.spvasm.expected.fxc.hlsl @@ -0,0 +1,17 @@ +int func(int value, inout int pointer) { + const int x_9 = pointer; + return (value + x_9); +} + +void main_1() { + int i = 0; + i = 123; + const int x_18 = func(i, i); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/load/param/ptr.spvasm.expected.spvasm b/test/tint/ptr_ref/load/param/ptr.spvasm.expected.spvasm index c487a58ed2..47d6500f74 100644 --- a/test/tint/ptr_ref/load/param/ptr.spvasm.expected.spvasm +++ b/test/tint/ptr_ref/load/param/ptr.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -18,8 +18,7 @@ %1 = OpTypeFunction %int %int %_ptr_Function_int %void = OpTypeVoid %11 = OpTypeFunction %void - %int_0 = OpConstant %int 0 - %17 = OpConstantNull %int + %15 = OpConstantNull %int %int_123 = OpConstant %int 123 %func = OpFunction %int None %1 %value = OpFunctionParameter %int @@ -31,15 +30,15 @@ OpFunctionEnd %main_1 = OpFunction %void None %11 %14 = OpLabel - %i = OpVariable %_ptr_Function_int Function %17 - OpStore %i %int_0 + %i = OpVariable %_ptr_Function_int Function %15 + OpStore %i %15 OpStore %i %int_123 - %19 = OpLoad %int %i - %20 = OpFunctionCall %int %func %19 %i + %18 = OpLoad %int %i + %19 = OpFunctionCall %int %func %18 %i OpReturn OpFunctionEnd %main = OpFunction %void None %11 - %23 = OpLabel - %24 = OpFunctionCall %void %main_1 + %22 = OpLabel + %23 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/load/param/ptr.spvasm.expected.wgsl b/test/tint/ptr_ref/load/param/ptr.spvasm.expected.wgsl index 5c5849a2b8..7a2d592cda 100644 --- a/test/tint/ptr_ref/load/param/ptr.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/load/param/ptr.spvasm.expected.wgsl @@ -11,7 +11,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/load/param/ptr.wgsl b/test/tint/ptr_ref/load/param/ptr.wgsl index 1dfc928153..655582063b 100644 --- a/test/tint/ptr_ref/load/param/ptr.wgsl +++ b/test/tint/ptr_ref/load/param/ptr.wgsl @@ -2,7 +2,7 @@ fn func(value : i32, pointer : ptr) -> i32 { return value + *pointer; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; let r : i32 = func(i, &i); diff --git a/test/tint/ptr_ref/load/param/ptr.wgsl.expected.hlsl b/test/tint/ptr_ref/load/param/ptr.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/load/param/ptr.wgsl.expected.hlsl rename to test/tint/ptr_ref/load/param/ptr.wgsl.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/load/param/ptr.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/param/ptr.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..696b0c2016 --- /dev/null +++ b/test/tint/ptr_ref/load/param/ptr.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +int func(int value, inout int pointer) { + return (value + pointer); +} + +[numthreads(1, 1, 1)] +void main() { + int i = 123; + const int r = func(i, i); + return; +} diff --git a/test/tint/ptr_ref/load/param/ptr.wgsl.expected.wgsl b/test/tint/ptr_ref/load/param/ptr.wgsl.expected.wgsl index 68c51dba9a..0901cad619 100644 --- a/test/tint/ptr_ref/load/param/ptr.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/load/param/ptr.wgsl.expected.wgsl @@ -2,7 +2,7 @@ fn func(value : i32, pointer : ptr) -> i32 { return (value + *(pointer)); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; let r : i32 = func(i, &(i)); diff --git a/test/tint/ptr_ref/store/global/i32.spvasm.expected.dxc.hlsl b/test/tint/ptr_ref/store/global/i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..b0598203cc --- /dev/null +++ b/test/tint/ptr_ref/store/global/i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,13 @@ +static int I = 0; + +void main_1() { + I = 123; + I = 123; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/store/global/i32.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/store/global/i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b0598203cc --- /dev/null +++ b/test/tint/ptr_ref/store/global/i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,13 @@ +static int I = 0; + +void main_1() { + I = 123; + I = 123; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/store/global/i32.spvasm.expected.glsl b/test/tint/ptr_ref/store/global/i32.spvasm.expected.glsl index d5fb2c0a95..d32281bed3 100644 --- a/test/tint/ptr_ref/store/global/i32.spvasm.expected.glsl +++ b/test/tint/ptr_ref/store/global/i32.spvasm.expected.glsl @@ -3,7 +3,7 @@ int I = 0; void main_1() { I = 123; - I = ((100 + 20) + 3); + I = 123; return; } diff --git a/test/tint/ptr_ref/store/global/i32.spvasm.expected.hlsl b/test/tint/ptr_ref/store/global/i32.spvasm.expected.hlsl deleted file mode 100644 index ffe06339c1..0000000000 --- a/test/tint/ptr_ref/store/global/i32.spvasm.expected.hlsl +++ /dev/null @@ -1,13 +0,0 @@ -static int I = 0; - -void main_1() { - I = 123; - I = ((100 + 20) + 3); - return; -} - -[numthreads(1, 1, 1)] -void main() { - main_1(); - return; -} diff --git a/test/tint/ptr_ref/store/global/i32.spvasm.expected.msl b/test/tint/ptr_ref/store/global/i32.spvasm.expected.msl index c27b618d1a..5325510d02 100644 --- a/test/tint/ptr_ref/store/global/i32.spvasm.expected.msl +++ b/test/tint/ptr_ref/store/global/i32.spvasm.expected.msl @@ -1,15 +1,15 @@ #include using namespace metal; -void main_1(thread int* const tint_symbol_1) { - *(tint_symbol_1) = 123; - *(tint_symbol_1) = as_type((as_type(as_type((as_type(100) + as_type(20)))) + as_type(3))); +void main_1() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 123; + tint_symbol_1 = 123; return; } kernel void tint_symbol() { - thread int tint_symbol_2 = 0; - main_1(&(tint_symbol_2)); + main_1(); return; } diff --git a/test/tint/ptr_ref/store/global/i32.spvasm.expected.spvasm b/test/tint/ptr_ref/store/global/i32.spvasm.expected.spvasm index dc2e27124d..c38d8d434e 100644 --- a/test/tint/ptr_ref/store/global/i32.spvasm.expected.spvasm +++ b/test/tint/ptr_ref/store/global/i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 18 +; Bound: 13 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -11,25 +11,20 @@ OpName %main_1 "main_1" OpName %main "main" %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %2 = OpConstantNull %int %_ptr_Private_int = OpTypePointer Private %int - %I = OpVariable %_ptr_Private_int Private %int_0 + %I = OpVariable %_ptr_Private_int Private %2 %void = OpTypeVoid %5 = OpTypeFunction %void %int_123 = OpConstant %int 123 - %int_100 = OpConstant %int 100 - %int_20 = OpConstant %int 20 - %int_3 = OpConstant %int 3 %main_1 = OpFunction %void None %5 %8 = OpLabel OpStore %I %int_123 - %12 = OpIAdd %int %int_100 %int_20 - %14 = OpIAdd %int %12 %int_3 - OpStore %I %14 + OpStore %I %int_123 OpReturn OpFunctionEnd %main = OpFunction %void None %5 - %16 = OpLabel - %17 = OpFunctionCall %void %main_1 + %11 = OpLabel + %12 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/store/global/i32.spvasm.expected.wgsl b/test/tint/ptr_ref/store/global/i32.spvasm.expected.wgsl index 949f6c1548..6db2c9655b 100644 --- a/test/tint/ptr_ref/store/global/i32.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/store/global/i32.spvasm.expected.wgsl @@ -6,7 +6,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/store/global/i32.wgsl b/test/tint/ptr_ref/store/global/i32.wgsl index 3a5c72eb66..df189a0e58 100644 --- a/test/tint/ptr_ref/store/global/i32.wgsl +++ b/test/tint/ptr_ref/store/global/i32.wgsl @@ -1,6 +1,6 @@ var I : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { I = 123; // constant I = 100 + 20 + 3; // dynamic diff --git a/test/tint/ptr_ref/store/global/i32.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/global/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5ee58400f9 --- /dev/null +++ b/test/tint/ptr_ref/store/global/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +static int I = 0; + +[numthreads(1, 1, 1)] +void main() { + I = 123; + I = 123; + return; +} diff --git a/test/tint/ptr_ref/store/global/i32.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/global/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ee58400f9 --- /dev/null +++ b/test/tint/ptr_ref/store/global/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +static int I = 0; + +[numthreads(1, 1, 1)] +void main() { + I = 123; + I = 123; + return; +} diff --git a/test/tint/ptr_ref/store/global/i32.wgsl.expected.glsl b/test/tint/ptr_ref/store/global/i32.wgsl.expected.glsl index 0ea572e997..e1eb76606a 100644 --- a/test/tint/ptr_ref/store/global/i32.wgsl.expected.glsl +++ b/test/tint/ptr_ref/store/global/i32.wgsl.expected.glsl @@ -3,7 +3,7 @@ int I = 0; void tint_symbol() { I = 123; - I = ((100 + 20) + 3); + I = 123; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/store/global/i32.wgsl.expected.hlsl b/test/tint/ptr_ref/store/global/i32.wgsl.expected.hlsl deleted file mode 100644 index cb1bb3dbd8..0000000000 --- a/test/tint/ptr_ref/store/global/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,8 +0,0 @@ -static int I = 0; - -[numthreads(1, 1, 1)] -void main() { - I = 123; - I = ((100 + 20) + 3); - return; -} diff --git a/test/tint/ptr_ref/store/global/i32.wgsl.expected.msl b/test/tint/ptr_ref/store/global/i32.wgsl.expected.msl index f68ac56077..7c4f8ee01b 100644 --- a/test/tint/ptr_ref/store/global/i32.wgsl.expected.msl +++ b/test/tint/ptr_ref/store/global/i32.wgsl.expected.msl @@ -4,7 +4,7 @@ using namespace metal; kernel void tint_symbol() { thread int tint_symbol_1 = 0; tint_symbol_1 = 123; - tint_symbol_1 = as_type((as_type(as_type((as_type(100) + as_type(20)))) + as_type(3))); + tint_symbol_1 = 123; return; } diff --git a/test/tint/ptr_ref/store/global/i32.wgsl.expected.spvasm b/test/tint/ptr_ref/store/global/i32.wgsl.expected.spvasm index 8c25a15a92..c1009db9a8 100644 --- a/test/tint/ptr_ref/store/global/i32.wgsl.expected.spvasm +++ b/test/tint/ptr_ref/store/global/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 10 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,14 +16,9 @@ %void = OpTypeVoid %5 = OpTypeFunction %void %int_123 = OpConstant %int 123 - %int_100 = OpConstant %int 100 - %int_20 = OpConstant %int 20 - %int_3 = OpConstant %int 3 %main = OpFunction %void None %5 %8 = OpLabel OpStore %I %int_123 - %12 = OpIAdd %int %int_100 %int_20 - %14 = OpIAdd %int %12 %int_3 - OpStore %I %14 + OpStore %I %int_123 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/store/global/i32.wgsl.expected.wgsl b/test/tint/ptr_ref/store/global/i32.wgsl.expected.wgsl index 807c1cde7d..2d376fe14b 100644 --- a/test/tint/ptr_ref/store/global/i32.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/store/global/i32.wgsl.expected.wgsl @@ -1,6 +1,6 @@ var I : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { I = 123; I = ((100 + 20) + 3); diff --git a/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.hlsl b/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/store/global/struct_field.spvasm.expected.hlsl rename to test/tint/ptr_ref/store/global/struct_field.spvasm.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..938d5d1092 --- /dev/null +++ b/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.fxc.hlsl @@ -0,0 +1,16 @@ +struct S { + int i; +}; + +static S V = (S)0; + +void main_1() { + V.i = 5; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.msl b/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.msl index 451a322e55..08486b5b1d 100644 --- a/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.msl +++ b/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.msl @@ -5,14 +5,14 @@ struct S { int i; }; -void main_1(thread S* const tint_symbol_1) { - (*(tint_symbol_1)).i = 5; +void main_1() { + thread S tint_symbol_1 = {}; + tint_symbol_1.i = 5; return; } kernel void tint_symbol() { - thread S tint_symbol_2 = {}; - main_1(&(tint_symbol_2)); + main_1(); return; } diff --git a/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.wgsl b/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.wgsl index b366fde6bd..e86942067b 100644 --- a/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/store/global/struct_field.spvasm.expected.wgsl @@ -9,7 +9,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/store/local/i32.spvasm.expected.dxc.hlsl b/test/tint/ptr_ref/store/local/i32.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..497729077b --- /dev/null +++ b/test/tint/ptr_ref/store/local/i32.spvasm.expected.dxc.hlsl @@ -0,0 +1,13 @@ +void main_1() { + int i = 0; + i = 123; + i = 123; + i = 123; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/store/local/i32.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/store/local/i32.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..497729077b --- /dev/null +++ b/test/tint/ptr_ref/store/local/i32.spvasm.expected.fxc.hlsl @@ -0,0 +1,13 @@ +void main_1() { + int i = 0; + i = 123; + i = 123; + i = 123; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/store/local/i32.spvasm.expected.glsl b/test/tint/ptr_ref/store/local/i32.spvasm.expected.glsl index ef59ef5655..d74e398002 100644 --- a/test/tint/ptr_ref/store/local/i32.spvasm.expected.glsl +++ b/test/tint/ptr_ref/store/local/i32.spvasm.expected.glsl @@ -4,7 +4,7 @@ void main_1() { int i = 0; i = 123; i = 123; - i = ((100 + 20) + 3); + i = 123; return; } diff --git a/test/tint/ptr_ref/store/local/i32.spvasm.expected.hlsl b/test/tint/ptr_ref/store/local/i32.spvasm.expected.hlsl deleted file mode 100644 index 5a9d251b30..0000000000 --- a/test/tint/ptr_ref/store/local/i32.spvasm.expected.hlsl +++ /dev/null @@ -1,13 +0,0 @@ -void main_1() { - int i = 0; - i = 123; - i = 123; - i = ((100 + 20) + 3); - return; -} - -[numthreads(1, 1, 1)] -void main() { - main_1(); - return; -} diff --git a/test/tint/ptr_ref/store/local/i32.spvasm.expected.msl b/test/tint/ptr_ref/store/local/i32.spvasm.expected.msl index 1e56158829..4737bb042c 100644 --- a/test/tint/ptr_ref/store/local/i32.spvasm.expected.msl +++ b/test/tint/ptr_ref/store/local/i32.spvasm.expected.msl @@ -5,7 +5,7 @@ void main_1() { int i = 0; i = 123; i = 123; - i = as_type((as_type(as_type((as_type(100) + as_type(20)))) + as_type(3))); + i = 123; return; } diff --git a/test/tint/ptr_ref/store/local/i32.spvasm.expected.spvasm b/test/tint/ptr_ref/store/local/i32.spvasm.expected.spvasm index 85a187aad3..64019e9be6 100644 --- a/test/tint/ptr_ref/store/local/i32.spvasm.expected.spvasm +++ b/test/tint/ptr_ref/store/local/i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 13 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -13,26 +13,20 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %6 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %9 = OpConstantNull %int %int_123 = OpConstant %int 123 - %int_100 = OpConstant %int 100 - %int_20 = OpConstant %int 20 - %int_3 = OpConstant %int 3 %main_1 = OpFunction %void None %1 %4 = OpLabel - %i = OpVariable %_ptr_Function_int Function %9 - OpStore %i %int_0 + %i = OpVariable %_ptr_Function_int Function %6 + OpStore %i %6 + OpStore %i %int_123 OpStore %i %int_123 OpStore %i %int_123 - %13 = OpIAdd %int %int_100 %int_20 - %15 = OpIAdd %int %13 %int_3 - OpStore %i %15 OpReturn OpFunctionEnd %main = OpFunction %void None %1 - %17 = OpLabel - %18 = OpFunctionCall %void %main_1 + %11 = OpLabel + %12 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/store/local/i32.spvasm.expected.wgsl b/test/tint/ptr_ref/store/local/i32.spvasm.expected.wgsl index e75e83bba8..1fce2c9e83 100644 --- a/test/tint/ptr_ref/store/local/i32.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/store/local/i32.spvasm.expected.wgsl @@ -6,7 +6,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/store/local/i32.wgsl b/test/tint/ptr_ref/store/local/i32.wgsl index ea390b9171..c193f14cba 100644 --- a/test/tint/ptr_ref/store/local/i32.wgsl +++ b/test/tint/ptr_ref/store/local/i32.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; let p : ptr = &i; diff --git a/test/tint/ptr_ref/store/local/i32.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/local/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e5949b66ef --- /dev/null +++ b/test/tint/ptr_ref/store/local/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void main() { + int i = 123; + i = 123; + i = 123; + return; +} diff --git a/test/tint/ptr_ref/store/local/i32.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/local/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e5949b66ef --- /dev/null +++ b/test/tint/ptr_ref/store/local/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +[numthreads(1, 1, 1)] +void main() { + int i = 123; + i = 123; + i = 123; + return; +} diff --git a/test/tint/ptr_ref/store/local/i32.wgsl.expected.glsl b/test/tint/ptr_ref/store/local/i32.wgsl.expected.glsl index 1ccce1c71a..0fb9035f68 100644 --- a/test/tint/ptr_ref/store/local/i32.wgsl.expected.glsl +++ b/test/tint/ptr_ref/store/local/i32.wgsl.expected.glsl @@ -3,7 +3,7 @@ void tint_symbol() { int i = 123; i = 123; - i = ((100 + 20) + 3); + i = 123; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/store/local/i32.wgsl.expected.hlsl b/test/tint/ptr_ref/store/local/i32.wgsl.expected.hlsl deleted file mode 100644 index 31873655bd..0000000000 --- a/test/tint/ptr_ref/store/local/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,7 +0,0 @@ -[numthreads(1, 1, 1)] -void main() { - int i = 123; - i = 123; - i = ((100 + 20) + 3); - return; -} diff --git a/test/tint/ptr_ref/store/local/i32.wgsl.expected.msl b/test/tint/ptr_ref/store/local/i32.wgsl.expected.msl index fc37fba94b..5c7e7b4031 100644 --- a/test/tint/ptr_ref/store/local/i32.wgsl.expected.msl +++ b/test/tint/ptr_ref/store/local/i32.wgsl.expected.msl @@ -4,7 +4,7 @@ using namespace metal; kernel void tint_symbol() { int i = 123; i = 123; - i = as_type((as_type(as_type((as_type(100) + as_type(20)))) + as_type(3))); + i = 123; return; } diff --git a/test/tint/ptr_ref/store/local/i32.wgsl.expected.spvasm b/test/tint/ptr_ref/store/local/i32.wgsl.expected.spvasm index d4738a2447..11ba7fc027 100644 --- a/test/tint/ptr_ref/store/local/i32.wgsl.expected.spvasm +++ b/test/tint/ptr_ref/store/local/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 10 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -15,16 +15,11 @@ %int_123 = OpConstant %int 123 %_ptr_Function_int = OpTypePointer Function %int %9 = OpConstantNull %int - %int_100 = OpConstant %int 100 - %int_20 = OpConstant %int 20 - %int_3 = OpConstant %int 3 %main = OpFunction %void None %1 %4 = OpLabel %i = OpVariable %_ptr_Function_int Function %9 OpStore %i %int_123 OpStore %i %int_123 - %12 = OpIAdd %int %int_100 %int_20 - %14 = OpIAdd %int %12 %int_3 - OpStore %i %14 + OpStore %i %int_123 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/store/local/i32.wgsl.expected.wgsl b/test/tint/ptr_ref/store/local/i32.wgsl.expected.wgsl index c5f03d5742..a39176de1d 100644 --- a/test/tint/ptr_ref/store/local/i32.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/store/local/i32.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; let p : ptr = &(i); diff --git a/test/tint/ptr_ref/store/local/struct_field.spvasm.expected.hlsl b/test/tint/ptr_ref/store/local/struct_field.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/store/local/struct_field.spvasm.expected.hlsl rename to test/tint/ptr_ref/store/local/struct_field.spvasm.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/store/local/struct_field.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/store/local/struct_field.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..a867b6c981 --- /dev/null +++ b/test/tint/ptr_ref/store/local/struct_field.spvasm.expected.fxc.hlsl @@ -0,0 +1,15 @@ +struct S { + int i; +}; + +void main_1() { + S V = (S)0; + V.i = 5; + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/store/local/struct_field.spvasm.expected.wgsl b/test/tint/ptr_ref/store/local/struct_field.spvasm.expected.wgsl index 6cf6789ca4..56ca420d35 100644 --- a/test/tint/ptr_ref/store/local/struct_field.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/store/local/struct_field.spvasm.expected.wgsl @@ -8,7 +8,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/store/param/ptr.spvasm.expected.hlsl b/test/tint/ptr_ref/store/param/ptr.spvasm.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/store/param/ptr.spvasm.expected.hlsl rename to test/tint/ptr_ref/store/param/ptr.spvasm.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/store/param/ptr.spvasm.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/ptr.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..319111830d --- /dev/null +++ b/test/tint/ptr_ref/store/param/ptr.spvasm.expected.fxc.hlsl @@ -0,0 +1,17 @@ +void func(int value, inout int pointer) { + pointer = value; + return; +} + +void main_1() { + int i = 0; + i = 123; + func(123, i); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/tint/ptr_ref/store/param/ptr.spvasm.expected.spvasm b/test/tint/ptr_ref/store/param/ptr.spvasm.expected.spvasm index c4a8e196b6..54c9ae55e4 100644 --- a/test/tint/ptr_ref/store/param/ptr.spvasm.expected.spvasm +++ b/test/tint/ptr_ref/store/param/ptr.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -18,8 +18,7 @@ %_ptr_Function_int = OpTypePointer Function %int %1 = OpTypeFunction %void %int %_ptr_Function_int %10 = OpTypeFunction %void - %int_0 = OpConstant %int 0 - %15 = OpConstantNull %int + %13 = OpConstantNull %int %int_123 = OpConstant %int 123 %func = OpFunction %void None %1 %value = OpFunctionParameter %int @@ -30,14 +29,14 @@ OpFunctionEnd %main_1 = OpFunction %void None %10 %12 = OpLabel - %i = OpVariable %_ptr_Function_int Function %15 - OpStore %i %int_0 + %i = OpVariable %_ptr_Function_int Function %13 + OpStore %i %13 OpStore %i %int_123 - %17 = OpFunctionCall %void %func %int_123 %i + %16 = OpFunctionCall %void %func %int_123 %i OpReturn OpFunctionEnd %main = OpFunction %void None %10 - %20 = OpLabel - %21 = OpFunctionCall %void %main_1 + %19 = OpLabel + %20 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/store/param/ptr.spvasm.expected.wgsl b/test/tint/ptr_ref/store/param/ptr.spvasm.expected.wgsl index 1ecd3293e5..0a80e4bf67 100644 --- a/test/tint/ptr_ref/store/param/ptr.spvasm.expected.wgsl +++ b/test/tint/ptr_ref/store/param/ptr.spvasm.expected.wgsl @@ -10,7 +10,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1i, 1i, 1i) +@compute @workgroup_size(1i, 1i, 1i) fn main() { main_1(); } diff --git a/test/tint/ptr_ref/store/param/ptr.wgsl b/test/tint/ptr_ref/store/param/ptr.wgsl index b23ad6f144..9adc2c6ba2 100644 --- a/test/tint/ptr_ref/store/param/ptr.wgsl +++ b/test/tint/ptr_ref/store/param/ptr.wgsl @@ -2,7 +2,7 @@ fn func(value : i32, pointer : ptr) { *pointer = value; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; func(123, &i); diff --git a/test/tint/ptr_ref/store/param/ptr.wgsl.expected.hlsl b/test/tint/ptr_ref/store/param/ptr.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/ptr_ref/store/param/ptr.wgsl.expected.hlsl rename to test/tint/ptr_ref/store/param/ptr.wgsl.expected.dxc.hlsl diff --git a/test/tint/ptr_ref/store/param/ptr.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/ptr.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d88b936416 --- /dev/null +++ b/test/tint/ptr_ref/store/param/ptr.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +void func(int value, inout int pointer) { + pointer = value; +} + +[numthreads(1, 1, 1)] +void main() { + int i = 123; + func(123, i); + return; +} diff --git a/test/tint/ptr_ref/store/param/ptr.wgsl.expected.wgsl b/test/tint/ptr_ref/store/param/ptr.wgsl.expected.wgsl index d9d6dbbe58..2955c9b0ed 100644 --- a/test/tint/ptr_ref/store/param/ptr.wgsl.expected.wgsl +++ b/test/tint/ptr_ref/store/param/ptr.wgsl.expected.wgsl @@ -2,7 +2,7 @@ fn func(value : i32, pointer : ptr) { *(pointer) = value; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var i : i32 = 123; func(123, &(i)); diff --git a/test/tint/samples/compute_boids.wgsl b/test/tint/samples/compute_boids.wgsl index fdb9386fcb..e8515a2205 100644 --- a/test/tint/samples/compute_boids.wgsl +++ b/test/tint/samples/compute_boids.wgsl @@ -14,7 +14,7 @@ // vertex shader -@stage(vertex) +@vertex fn vert_main(@location(0) a_particlePos : vec2, @location(1) a_particleVel : vec2, @location(2) a_pos : vec2) @@ -28,7 +28,7 @@ fn vert_main(@location(0) a_particlePos : vec2, // fragment shader -@stage(fragment) +@fragment fn frag_main() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } @@ -58,7 +58,7 @@ struct Particle { @binding(2) @group(0) var particlesB : Particles; // https://github.com/austinEng/Project6-Vulkan-Flocking/blob/master/data/shaders/computeparticles/particle.comp -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main( @builtin(global_invocation_id) gl_GlobalInvocationID : vec3) { var index : u32 = gl_GlobalInvocationID.x; diff --git a/test/tint/samples/compute_boids.wgsl.expected.dxc.hlsl b/test/tint/samples/compute_boids.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dbaabbb78f --- /dev/null +++ b/test/tint/samples/compute_boids.wgsl.expected.dxc.hlsl @@ -0,0 +1,111 @@ +struct tint_symbol_1 { + float2 a_particlePos : TEXCOORD0; + float2 a_particleVel : TEXCOORD1; + float2 a_pos : TEXCOORD2; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 vert_main_inner(float2 a_particlePos, float2 a_particleVel, float2 a_pos) { + float angle = -(atan2(a_particleVel.x, a_particleVel.y)); + float2 pos = float2(((a_pos.x * cos(angle)) - (a_pos.y * sin(angle))), ((a_pos.x * sin(angle)) + (a_pos.y * cos(angle)))); + return float4((pos + a_particlePos), 0.0f, 1.0f); +} + +tint_symbol_2 vert_main(tint_symbol_1 tint_symbol) { + const float4 inner_result = vert_main_inner(tint_symbol.a_particlePos, tint_symbol.a_particleVel, tint_symbol.a_pos); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +struct tint_symbol_3 { + float4 value : SV_Target0; +}; + +float4 frag_main_inner() { + return (1.0f).xxxx; +} + +tint_symbol_3 frag_main() { + const float4 inner_result_1 = frag_main_inner(); + tint_symbol_3 wrapper_result_1 = (tint_symbol_3)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} + +cbuffer cbuffer_params : register(b0, space0) { + uint4 params[2]; +}; +RWByteAddressBuffer particlesA : register(u1, space0); +RWByteAddressBuffer particlesB : register(u2, space0); + +struct tint_symbol_5 { + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main_inner(uint3 gl_GlobalInvocationID) { + uint index = gl_GlobalInvocationID.x; + if ((index >= 5u)) { + return; + } + float2 vPos = asfloat(particlesA.Load2((16u * index))); + float2 vVel = asfloat(particlesA.Load2(((16u * index) + 8u))); + float2 cMass = (0.0f).xx; + float2 cVel = (0.0f).xx; + float2 colVel = (0.0f).xx; + int cMassCount = 0; + int cVelCount = 0; + float2 pos = float2(0.0f, 0.0f); + float2 vel = float2(0.0f, 0.0f); + { + [loop] for(uint i = 0u; (i < 5u); i = (i + 1u)) { + if ((i == index)) { + continue; + } + pos = asfloat(particlesA.Load2((16u * i))).xy; + vel = asfloat(particlesA.Load2(((16u * i) + 8u))).xy; + if ((distance(pos, vPos) < asfloat(params[0].y))) { + cMass = (cMass + pos); + cMassCount = (cMassCount + 1); + } + if ((distance(pos, vPos) < asfloat(params[0].z))) { + colVel = (colVel - (pos - vPos)); + } + if ((distance(pos, vPos) < asfloat(params[0].w))) { + cVel = (cVel + vel); + cVelCount = (cVelCount + 1); + } + } + } + if ((cMassCount > 0)) { + cMass = ((cMass / float2(float(cMassCount), float(cMassCount))) - vPos); + } + if ((cVelCount > 0)) { + cVel = (cVel / float2(float(cVelCount), float(cVelCount))); + } + vVel = (((vVel + (cMass * asfloat(params[1].x))) + (colVel * asfloat(params[1].y))) + (cVel * asfloat(params[1].z))); + vVel = (normalize(vVel) * clamp(length(vVel), 0.0f, 0.100000001f)); + vPos = (vPos + (vVel * asfloat(params[0].x))); + if ((vPos.x < -1.0f)) { + vPos.x = 1.0f; + } + if ((vPos.x > 1.0f)) { + vPos.x = -1.0f; + } + if ((vPos.y < -1.0f)) { + vPos.y = 1.0f; + } + if ((vPos.y > 1.0f)) { + vPos.y = -1.0f; + } + particlesB.Store2((16u * index), asuint(vPos)); + particlesB.Store2(((16u * index) + 8u), asuint(vVel)); +} + +[numthreads(1, 1, 1)] +void comp_main(tint_symbol_5 tint_symbol_4) { + comp_main_inner(tint_symbol_4.gl_GlobalInvocationID); + return; +} diff --git a/test/tint/samples/compute_boids.wgsl.expected.fxc.hlsl b/test/tint/samples/compute_boids.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dbaabbb78f --- /dev/null +++ b/test/tint/samples/compute_boids.wgsl.expected.fxc.hlsl @@ -0,0 +1,111 @@ +struct tint_symbol_1 { + float2 a_particlePos : TEXCOORD0; + float2 a_particleVel : TEXCOORD1; + float2 a_pos : TEXCOORD2; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 vert_main_inner(float2 a_particlePos, float2 a_particleVel, float2 a_pos) { + float angle = -(atan2(a_particleVel.x, a_particleVel.y)); + float2 pos = float2(((a_pos.x * cos(angle)) - (a_pos.y * sin(angle))), ((a_pos.x * sin(angle)) + (a_pos.y * cos(angle)))); + return float4((pos + a_particlePos), 0.0f, 1.0f); +} + +tint_symbol_2 vert_main(tint_symbol_1 tint_symbol) { + const float4 inner_result = vert_main_inner(tint_symbol.a_particlePos, tint_symbol.a_particleVel, tint_symbol.a_pos); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +struct tint_symbol_3 { + float4 value : SV_Target0; +}; + +float4 frag_main_inner() { + return (1.0f).xxxx; +} + +tint_symbol_3 frag_main() { + const float4 inner_result_1 = frag_main_inner(); + tint_symbol_3 wrapper_result_1 = (tint_symbol_3)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} + +cbuffer cbuffer_params : register(b0, space0) { + uint4 params[2]; +}; +RWByteAddressBuffer particlesA : register(u1, space0); +RWByteAddressBuffer particlesB : register(u2, space0); + +struct tint_symbol_5 { + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main_inner(uint3 gl_GlobalInvocationID) { + uint index = gl_GlobalInvocationID.x; + if ((index >= 5u)) { + return; + } + float2 vPos = asfloat(particlesA.Load2((16u * index))); + float2 vVel = asfloat(particlesA.Load2(((16u * index) + 8u))); + float2 cMass = (0.0f).xx; + float2 cVel = (0.0f).xx; + float2 colVel = (0.0f).xx; + int cMassCount = 0; + int cVelCount = 0; + float2 pos = float2(0.0f, 0.0f); + float2 vel = float2(0.0f, 0.0f); + { + [loop] for(uint i = 0u; (i < 5u); i = (i + 1u)) { + if ((i == index)) { + continue; + } + pos = asfloat(particlesA.Load2((16u * i))).xy; + vel = asfloat(particlesA.Load2(((16u * i) + 8u))).xy; + if ((distance(pos, vPos) < asfloat(params[0].y))) { + cMass = (cMass + pos); + cMassCount = (cMassCount + 1); + } + if ((distance(pos, vPos) < asfloat(params[0].z))) { + colVel = (colVel - (pos - vPos)); + } + if ((distance(pos, vPos) < asfloat(params[0].w))) { + cVel = (cVel + vel); + cVelCount = (cVelCount + 1); + } + } + } + if ((cMassCount > 0)) { + cMass = ((cMass / float2(float(cMassCount), float(cMassCount))) - vPos); + } + if ((cVelCount > 0)) { + cVel = (cVel / float2(float(cVelCount), float(cVelCount))); + } + vVel = (((vVel + (cMass * asfloat(params[1].x))) + (colVel * asfloat(params[1].y))) + (cVel * asfloat(params[1].z))); + vVel = (normalize(vVel) * clamp(length(vVel), 0.0f, 0.100000001f)); + vPos = (vPos + (vVel * asfloat(params[0].x))); + if ((vPos.x < -1.0f)) { + vPos.x = 1.0f; + } + if ((vPos.x > 1.0f)) { + vPos.x = -1.0f; + } + if ((vPos.y < -1.0f)) { + vPos.y = 1.0f; + } + if ((vPos.y > 1.0f)) { + vPos.y = -1.0f; + } + particlesB.Store2((16u * index), asuint(vPos)); + particlesB.Store2(((16u * index) + 8u), asuint(vVel)); +} + +[numthreads(1, 1, 1)] +void comp_main(tint_symbol_5 tint_symbol_4) { + comp_main_inner(tint_symbol_4.gl_GlobalInvocationID); + return; +} diff --git a/test/tint/samples/compute_boids.wgsl.expected.glsl b/test/tint/samples/compute_boids.wgsl.expected.glsl index d1d7338489..6a110ffee0 100644 --- a/test/tint/samples/compute_boids.wgsl.expected.glsl +++ b/test/tint/samples/compute_boids.wgsl.expected.glsl @@ -60,7 +60,7 @@ struct Particles { }; vec4 frag_main() { - return vec4(1.0f, 1.0f, 1.0f, 1.0f); + return vec4(1.0f); } void main() { @@ -112,9 +112,9 @@ void comp_main(uvec3 tint_symbol) { } vec2 vPos = particlesA.particles[index].pos; vec2 vVel = particlesA.particles[index].vel; - vec2 cMass = vec2(0.0f, 0.0f); - vec2 cVel = vec2(0.0f, 0.0f); - vec2 colVel = vec2(0.0f, 0.0f); + vec2 cMass = vec2(0.0f); + vec2 cVel = vec2(0.0f); + vec2 colVel = vec2(0.0f); int cMassCount = 0; int cVelCount = 0; vec2 pos = vec2(0.0f, 0.0f); diff --git a/test/tint/samples/compute_boids.wgsl.expected.hlsl b/test/tint/samples/compute_boids.wgsl.expected.hlsl deleted file mode 100644 index b94e5e76b4..0000000000 --- a/test/tint/samples/compute_boids.wgsl.expected.hlsl +++ /dev/null @@ -1,111 +0,0 @@ -struct tint_symbol_1 { - float2 a_particlePos : TEXCOORD0; - float2 a_particleVel : TEXCOORD1; - float2 a_pos : TEXCOORD2; -}; -struct tint_symbol_2 { - float4 value : SV_Position; -}; - -float4 vert_main_inner(float2 a_particlePos, float2 a_particleVel, float2 a_pos) { - float angle = -(atan2(a_particleVel.x, a_particleVel.y)); - float2 pos = float2(((a_pos.x * cos(angle)) - (a_pos.y * sin(angle))), ((a_pos.x * sin(angle)) + (a_pos.y * cos(angle)))); - return float4((pos + a_particlePos), 0.0f, 1.0f); -} - -tint_symbol_2 vert_main(tint_symbol_1 tint_symbol) { - const float4 inner_result = vert_main_inner(tint_symbol.a_particlePos, tint_symbol.a_particleVel, tint_symbol.a_pos); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -struct tint_symbol_3 { - float4 value : SV_Target0; -}; - -float4 frag_main_inner() { - return float4(1.0f, 1.0f, 1.0f, 1.0f); -} - -tint_symbol_3 frag_main() { - const float4 inner_result_1 = frag_main_inner(); - tint_symbol_3 wrapper_result_1 = (tint_symbol_3)0; - wrapper_result_1.value = inner_result_1; - return wrapper_result_1; -} - -cbuffer cbuffer_params : register(b0, space0) { - uint4 params[2]; -}; -RWByteAddressBuffer particlesA : register(u1, space0); -RWByteAddressBuffer particlesB : register(u2, space0); - -struct tint_symbol_5 { - uint3 gl_GlobalInvocationID : SV_DispatchThreadID; -}; - -void comp_main_inner(uint3 gl_GlobalInvocationID) { - uint index = gl_GlobalInvocationID.x; - if ((index >= 5u)) { - return; - } - float2 vPos = asfloat(particlesA.Load2((16u * index))); - float2 vVel = asfloat(particlesA.Load2(((16u * index) + 8u))); - float2 cMass = float2(0.0f, 0.0f); - float2 cVel = float2(0.0f, 0.0f); - float2 colVel = float2(0.0f, 0.0f); - int cMassCount = 0; - int cVelCount = 0; - float2 pos = float2(0.0f, 0.0f); - float2 vel = float2(0.0f, 0.0f); - { - [loop] for(uint i = 0u; (i < 5u); i = (i + 1u)) { - if ((i == index)) { - continue; - } - pos = asfloat(particlesA.Load2((16u * i))).xy; - vel = asfloat(particlesA.Load2(((16u * i) + 8u))).xy; - if ((distance(pos, vPos) < asfloat(params[0].y))) { - cMass = (cMass + pos); - cMassCount = (cMassCount + 1); - } - if ((distance(pos, vPos) < asfloat(params[0].z))) { - colVel = (colVel - (pos - vPos)); - } - if ((distance(pos, vPos) < asfloat(params[0].w))) { - cVel = (cVel + vel); - cVelCount = (cVelCount + 1); - } - } - } - if ((cMassCount > 0)) { - cMass = ((cMass / float2(float(cMassCount), float(cMassCount))) - vPos); - } - if ((cVelCount > 0)) { - cVel = (cVel / float2(float(cVelCount), float(cVelCount))); - } - vVel = (((vVel + (cMass * asfloat(params[1].x))) + (colVel * asfloat(params[1].y))) + (cVel * asfloat(params[1].z))); - vVel = (normalize(vVel) * clamp(length(vVel), 0.0f, 0.100000001f)); - vPos = (vPos + (vVel * asfloat(params[0].x))); - if ((vPos.x < -1.0f)) { - vPos.x = 1.0f; - } - if ((vPos.x > 1.0f)) { - vPos.x = -1.0f; - } - if ((vPos.y < -1.0f)) { - vPos.y = 1.0f; - } - if ((vPos.y > 1.0f)) { - vPos.y = -1.0f; - } - particlesB.Store2((16u * index), asuint(vPos)); - particlesB.Store2(((16u * index) + 8u), asuint(vVel)); -} - -[numthreads(1, 1, 1)] -void comp_main(tint_symbol_5 tint_symbol_4) { - comp_main_inner(tint_symbol_4.gl_GlobalInvocationID); - return; -} diff --git a/test/tint/samples/compute_boids.wgsl.expected.msl b/test/tint/samples/compute_boids.wgsl.expected.msl index 399bdf38c2..a3cb32a44b 100644 --- a/test/tint/samples/compute_boids.wgsl.expected.msl +++ b/test/tint/samples/compute_boids.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct tint_symbol_1 { float2 a_particlePos [[attribute(0)]]; float2 a_particleVel [[attribute(1)]]; @@ -29,7 +42,7 @@ struct tint_symbol_3 { }; float4 frag_main_inner() { - return float4(1.0f, 1.0f, 1.0f, 1.0f); + return float4(1.0f); } fragment tint_symbol_3 frag_main() { @@ -54,12 +67,8 @@ struct SimParams { /* 0x0018 */ float rule3Scale; }; -struct tint_array_wrapper { - /* 0x0000 */ Particle arr[5]; -}; - struct Particles { - /* 0x0000 */ tint_array_wrapper particles; + /* 0x0000 */ tint_array particles; }; void comp_main_inner(uint3 gl_GlobalInvocationID, device Particles* const tint_symbol_4, const constant SimParams* const tint_symbol_5, device Particles* const tint_symbol_6) { @@ -67,11 +76,11 @@ void comp_main_inner(uint3 gl_GlobalInvocationID, device Particles* const tint_s if ((index >= 5u)) { return; } - float2 vPos = (*(tint_symbol_4)).particles.arr[index].pos; - float2 vVel = (*(tint_symbol_4)).particles.arr[index].vel; - float2 cMass = float2(0.0f, 0.0f); - float2 cVel = float2(0.0f, 0.0f); - float2 colVel = float2(0.0f, 0.0f); + float2 vPos = (*(tint_symbol_4)).particles[index].pos; + float2 vVel = (*(tint_symbol_4)).particles[index].vel; + float2 cMass = float2(0.0f); + float2 cVel = float2(0.0f); + float2 colVel = float2(0.0f); int cMassCount = 0; int cVelCount = 0; float2 pos = 0.0f; @@ -80,8 +89,8 @@ void comp_main_inner(uint3 gl_GlobalInvocationID, device Particles* const tint_s if ((i == index)) { continue; } - pos = float2((*(tint_symbol_4)).particles.arr[i].pos).xy; - vel = float2((*(tint_symbol_4)).particles.arr[i].vel).xy; + pos = float2((*(tint_symbol_4)).particles[i].pos).xy; + vel = float2((*(tint_symbol_4)).particles[i].vel).xy; if ((distance(pos, vPos) < (*(tint_symbol_5)).rule1Distance)) { cMass = (cMass + pos); cMassCount = as_type((as_type(cMassCount) + as_type(1))); @@ -115,8 +124,8 @@ void comp_main_inner(uint3 gl_GlobalInvocationID, device Particles* const tint_s if ((vPos[1] > 1.0f)) { vPos[1] = -1.0f; } - (*(tint_symbol_6)).particles.arr[index].pos = vPos; - (*(tint_symbol_6)).particles.arr[index].vel = vVel; + (*(tint_symbol_6)).particles[index].pos = vPos; + (*(tint_symbol_6)).particles[index].vel = vVel; } kernel void comp_main(device Particles* tint_symbol_7 [[buffer(1)]], const constant SimParams* tint_symbol_8 [[buffer(0)]], device Particles* tint_symbol_9 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { diff --git a/test/tint/samples/compute_boids.wgsl.expected.spvasm b/test/tint/samples/compute_boids.wgsl.expected.spvasm index e6305a77d6..d3abbb5382 100644 --- a/test/tint/samples/compute_boids.wgsl.expected.spvasm +++ b/test/tint/samples/compute_boids.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 280 +; Bound: 277 ; Schema: 0 OpCapability Shader %37 = OpExtInstImport "GLSL.std.450" @@ -116,24 +116,21 @@ %_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_v2float = OpTypePointer Function %v2float %63 = OpConstantNull %v2float - %float_0 = OpConstant %float 0 %float_1 = OpConstant %float 1 %void = OpTypeVoid - %71 = OpTypeFunction %void - %79 = OpTypeFunction %v4float - %82 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 - %86 = OpTypeFunction %void %v3uint + %70 = OpTypeFunction %void + %78 = OpTypeFunction %v4float + %81 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %85 = OpTypeFunction %void %v3uint %_ptr_Function_uint = OpTypePointer Function %uint - %93 = OpConstantNull %uint + %92 = OpConstantNull %uint %bool = OpTypeBool %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float %uint_1 = OpConstant %uint 1 - %110 = OpConstantComposite %v2float %float_0 %float_0 %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %113 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %118 = OpConstantNull %int %_ptr_Uniform_float = OpTypePointer Uniform %float %int_1 = OpConstant %int 1 %uint_2 = OpConstant %uint 2 @@ -178,273 +175,273 @@ %65 = OpFAdd %v2float %64 %a_particlePos %66 = OpCompositeExtract %float %65 0 %67 = OpCompositeExtract %float %65 1 - %70 = OpCompositeConstruct %v4float %66 %67 %float_0 %float_1 - OpReturnValue %70 + %69 = OpCompositeConstruct %v4float %66 %67 %13 %float_1 + OpReturnValue %69 OpFunctionEnd - %vert_main = OpFunction %void None %71 - %74 = OpLabel - %76 = OpLoad %v2float %a_particlePos_1 - %77 = OpLoad %v2float %a_particleVel_1 - %78 = OpLoad %v2float %a_pos_1 - %75 = OpFunctionCall %v4float %vert_main_inner %76 %77 %78 - OpStore %value %75 + %vert_main = OpFunction %void None %70 + %73 = OpLabel + %75 = OpLoad %v2float %a_particlePos_1 + %76 = OpLoad %v2float %a_particleVel_1 + %77 = OpLoad %v2float %a_pos_1 + %74 = OpFunctionCall %v4float %vert_main_inner %75 %76 %77 + OpStore %value %74 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd -%frag_main_inner = OpFunction %v4float None %79 - %81 = OpLabel - OpReturnValue %82 +%frag_main_inner = OpFunction %v4float None %78 + %80 = OpLabel + OpReturnValue %81 OpFunctionEnd - %frag_main = OpFunction %void None %71 - %84 = OpLabel - %85 = OpFunctionCall %v4float %frag_main_inner - OpStore %value_1 %85 + %frag_main = OpFunction %void None %70 + %83 = OpLabel + %84 = OpFunctionCall %v4float %frag_main_inner + OpStore %value_1 %84 OpReturn OpFunctionEnd -%comp_main_inner = OpFunction %void None %86 +%comp_main_inner = OpFunction %void None %85 %gl_GlobalInvocationID = OpFunctionParameter %v3uint - %89 = OpLabel - %index = OpVariable %_ptr_Function_uint Function %93 + %88 = OpLabel + %index = OpVariable %_ptr_Function_uint Function %92 %vPos = OpVariable %_ptr_Function_v2float Function %63 %vVel = OpVariable %_ptr_Function_v2float Function %63 %cMass = OpVariable %_ptr_Function_v2float Function %63 %cVel = OpVariable %_ptr_Function_v2float Function %63 %colVel = OpVariable %_ptr_Function_v2float Function %63 - %cMassCount = OpVariable %_ptr_Function_int Function %118 - %cVelCount = OpVariable %_ptr_Function_int Function %118 + %cMassCount = OpVariable %_ptr_Function_int Function %113 + %cVelCount = OpVariable %_ptr_Function_int Function %113 %pos_0 = OpVariable %_ptr_Function_v2float Function %63 %vel = OpVariable %_ptr_Function_v2float Function %63 - %i = OpVariable %_ptr_Function_uint Function %93 - %90 = OpCompositeExtract %uint %gl_GlobalInvocationID 0 - OpStore %index %90 - %94 = OpLoad %uint %index - %95 = OpUGreaterThanEqual %bool %94 %uint_5 - OpSelectionMerge %97 None - OpBranchConditional %95 %98 %97 - %98 = OpLabel - OpReturn + %i = OpVariable %_ptr_Function_uint Function %92 + %89 = OpCompositeExtract %uint %gl_GlobalInvocationID 0 + OpStore %index %89 + %93 = OpLoad %uint %index + %94 = OpUGreaterThanEqual %bool %93 %uint_5 + OpSelectionMerge %96 None + OpBranchConditional %94 %97 %96 %97 = OpLabel - %100 = OpLoad %uint %index - %102 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %100 %uint_0 - %103 = OpLoad %v2float %102 - OpStore %vPos %103 - %105 = OpLoad %uint %index - %107 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %105 %uint_1 - %108 = OpLoad %v2float %107 - OpStore %vVel %108 - OpStore %cMass %110 - OpStore %cVel %110 - OpStore %colVel %110 - OpStore %cMassCount %int_0 - OpStore %cVelCount %int_0 - OpStore %i %uint_0 + OpReturn + %96 = OpLabel + %99 = OpLoad %uint %index + %101 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %99 %uint_0 + %102 = OpLoad %v2float %101 + OpStore %vPos %102 + %104 = OpLoad %uint %index + %106 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %104 %uint_1 + %107 = OpLoad %v2float %106 + OpStore %vVel %107 + OpStore %cMass %63 + OpStore %cVel %63 + OpStore %colVel %63 + OpStore %cMassCount %113 + OpStore %cVelCount %113 + OpStore %i %92 + OpBranch %120 + %120 = OpLabel + OpLoopMerge %121 %122 None OpBranch %123 %123 = OpLabel - OpLoopMerge %124 %125 None - OpBranch %126 - %126 = OpLabel - %128 = OpLoad %uint %i - %129 = OpULessThan %bool %128 %uint_5 - %127 = OpLogicalNot %bool %129 - OpSelectionMerge %130 None - OpBranchConditional %127 %131 %130 - %131 = OpLabel - OpBranch %124 - %130 = OpLabel - %132 = OpLoad %uint %i - %133 = OpLoad %uint %index - %134 = OpIEqual %bool %132 %133 - OpSelectionMerge %135 None - OpBranchConditional %134 %136 %135 - %136 = OpLabel - OpBranch %125 - %135 = OpLabel - %137 = OpLoad %uint %i - %138 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %137 %uint_0 - %139 = OpLoad %v2float %138 - %140 = OpVectorShuffle %v2float %139 %139 0 1 - OpStore %pos_0 %140 - %141 = OpLoad %uint %i - %142 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %141 %uint_1 - %143 = OpLoad %v2float %142 - %144 = OpVectorShuffle %v2float %143 %143 0 1 - OpStore %vel %144 - %146 = OpLoad %v2float %pos_0 - %147 = OpLoad %v2float %vPos - %145 = OpExtInst %float %37 Distance %146 %147 - %149 = OpAccessChain %_ptr_Uniform_float %params %uint_1 - %150 = OpLoad %float %149 - %151 = OpFOrdLessThan %bool %145 %150 - OpSelectionMerge %152 None - OpBranchConditional %151 %153 %152 - %153 = OpLabel - %154 = OpLoad %v2float %cMass - %155 = OpLoad %v2float %pos_0 - %156 = OpFAdd %v2float %154 %155 - OpStore %cMass %156 - %157 = OpLoad %int %cMassCount - %159 = OpIAdd %int %157 %int_1 - OpStore %cMassCount %159 - OpBranch %152 - %152 = OpLabel - %161 = OpLoad %v2float %pos_0 - %162 = OpLoad %v2float %vPos - %160 = OpExtInst %float %37 Distance %161 %162 - %164 = OpAccessChain %_ptr_Uniform_float %params %uint_2 - %165 = OpLoad %float %164 - %166 = OpFOrdLessThan %bool %160 %165 - OpSelectionMerge %167 None - OpBranchConditional %166 %168 %167 - %168 = OpLabel - %169 = OpLoad %v2float %colVel - %170 = OpLoad %v2float %pos_0 - %171 = OpLoad %v2float %vPos - %172 = OpFSub %v2float %170 %171 - %173 = OpFSub %v2float %169 %172 - OpStore %colVel %173 - OpBranch %167 - %167 = OpLabel - %175 = OpLoad %v2float %pos_0 - %176 = OpLoad %v2float %vPos - %174 = OpExtInst %float %37 Distance %175 %176 - %178 = OpAccessChain %_ptr_Uniform_float %params %uint_3 - %179 = OpLoad %float %178 - %180 = OpFOrdLessThan %bool %174 %179 - OpSelectionMerge %181 None - OpBranchConditional %180 %182 %181 - %182 = OpLabel - %183 = OpLoad %v2float %cVel - %184 = OpLoad %v2float %vel - %185 = OpFAdd %v2float %183 %184 - OpStore %cVel %185 - %186 = OpLoad %int %cVelCount - %187 = OpIAdd %int %186 %int_1 - OpStore %cVelCount %187 - OpBranch %181 - %181 = OpLabel - OpBranch %125 - %125 = OpLabel - %188 = OpLoad %uint %i - %189 = OpIAdd %uint %188 %uint_1 - OpStore %i %189 - OpBranch %123 - %124 = OpLabel - %190 = OpLoad %int %cMassCount - %191 = OpSGreaterThan %bool %190 %int_0 - OpSelectionMerge %192 None - OpBranchConditional %191 %193 %192 - %193 = OpLabel - %194 = OpLoad %v2float %cMass - %196 = OpLoad %int %cMassCount - %195 = OpConvertSToF %float %196 - %198 = OpLoad %int %cMassCount - %197 = OpConvertSToF %float %198 - %199 = OpCompositeConstruct %v2float %195 %197 - %200 = OpFDiv %v2float %194 %199 - %201 = OpLoad %v2float %vPos - %202 = OpFSub %v2float %200 %201 - OpStore %cMass %202 - OpBranch %192 - %192 = OpLabel - %203 = OpLoad %int %cVelCount - %204 = OpSGreaterThan %bool %203 %int_0 - OpSelectionMerge %205 None - OpBranchConditional %204 %206 %205 - %206 = OpLabel - %207 = OpLoad %v2float %cVel - %209 = OpLoad %int %cVelCount - %208 = OpConvertSToF %float %209 - %211 = OpLoad %int %cVelCount - %210 = OpConvertSToF %float %211 - %212 = OpCompositeConstruct %v2float %208 %210 - %213 = OpFDiv %v2float %207 %212 - OpStore %cVel %213 - OpBranch %205 - %205 = OpLabel - %214 = OpLoad %v2float %vVel - %215 = OpLoad %v2float %cMass - %217 = OpAccessChain %_ptr_Uniform_float %params %uint_4 - %218 = OpLoad %float %217 - %219 = OpVectorTimesScalar %v2float %215 %218 - %220 = OpFAdd %v2float %214 %219 - %221 = OpLoad %v2float %colVel - %222 = OpAccessChain %_ptr_Uniform_float %params %uint_5 - %223 = OpLoad %float %222 - %224 = OpVectorTimesScalar %v2float %221 %223 - %225 = OpFAdd %v2float %220 %224 - %226 = OpLoad %v2float %cVel - %228 = OpAccessChain %_ptr_Uniform_float %params %uint_6 - %229 = OpLoad %float %228 - %230 = OpVectorTimesScalar %v2float %226 %229 - %231 = OpFAdd %v2float %225 %230 - OpStore %vVel %231 + %125 = OpLoad %uint %i + %126 = OpULessThan %bool %125 %uint_5 + %124 = OpLogicalNot %bool %126 + OpSelectionMerge %127 None + OpBranchConditional %124 %128 %127 + %128 = OpLabel + OpBranch %121 + %127 = OpLabel + %129 = OpLoad %uint %i + %130 = OpLoad %uint %index + %131 = OpIEqual %bool %129 %130 + OpSelectionMerge %132 None + OpBranchConditional %131 %133 %132 + %133 = OpLabel + OpBranch %122 + %132 = OpLabel + %134 = OpLoad %uint %i + %135 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %134 %uint_0 + %136 = OpLoad %v2float %135 + %137 = OpVectorShuffle %v2float %136 %136 0 1 + OpStore %pos_0 %137 + %138 = OpLoad %uint %i + %139 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %138 %uint_1 + %140 = OpLoad %v2float %139 + %141 = OpVectorShuffle %v2float %140 %140 0 1 + OpStore %vel %141 + %143 = OpLoad %v2float %pos_0 + %144 = OpLoad %v2float %vPos + %142 = OpExtInst %float %37 Distance %143 %144 + %146 = OpAccessChain %_ptr_Uniform_float %params %uint_1 + %147 = OpLoad %float %146 + %148 = OpFOrdLessThan %bool %142 %147 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %149 + %150 = OpLabel + %151 = OpLoad %v2float %cMass + %152 = OpLoad %v2float %pos_0 + %153 = OpFAdd %v2float %151 %152 + OpStore %cMass %153 + %154 = OpLoad %int %cMassCount + %156 = OpIAdd %int %154 %int_1 + OpStore %cMassCount %156 + OpBranch %149 + %149 = OpLabel + %158 = OpLoad %v2float %pos_0 + %159 = OpLoad %v2float %vPos + %157 = OpExtInst %float %37 Distance %158 %159 + %161 = OpAccessChain %_ptr_Uniform_float %params %uint_2 + %162 = OpLoad %float %161 + %163 = OpFOrdLessThan %bool %157 %162 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpLoad %v2float %colVel + %167 = OpLoad %v2float %pos_0 + %168 = OpLoad %v2float %vPos + %169 = OpFSub %v2float %167 %168 + %170 = OpFSub %v2float %166 %169 + OpStore %colVel %170 + OpBranch %164 + %164 = OpLabel + %172 = OpLoad %v2float %pos_0 + %173 = OpLoad %v2float %vPos + %171 = OpExtInst %float %37 Distance %172 %173 + %175 = OpAccessChain %_ptr_Uniform_float %params %uint_3 + %176 = OpLoad %float %175 + %177 = OpFOrdLessThan %bool %171 %176 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %178 + %179 = OpLabel + %180 = OpLoad %v2float %cVel + %181 = OpLoad %v2float %vel + %182 = OpFAdd %v2float %180 %181 + OpStore %cVel %182 + %183 = OpLoad %int %cVelCount + %184 = OpIAdd %int %183 %int_1 + OpStore %cVelCount %184 + OpBranch %178 + %178 = OpLabel + OpBranch %122 + %122 = OpLabel + %185 = OpLoad %uint %i + %186 = OpIAdd %uint %185 %uint_1 + OpStore %i %186 + OpBranch %120 + %121 = OpLabel + %187 = OpLoad %int %cMassCount + %188 = OpSGreaterThan %bool %187 %113 + OpSelectionMerge %189 None + OpBranchConditional %188 %190 %189 + %190 = OpLabel + %191 = OpLoad %v2float %cMass + %193 = OpLoad %int %cMassCount + %192 = OpConvertSToF %float %193 + %195 = OpLoad %int %cMassCount + %194 = OpConvertSToF %float %195 + %196 = OpCompositeConstruct %v2float %192 %194 + %197 = OpFDiv %v2float %191 %196 + %198 = OpLoad %v2float %vPos + %199 = OpFSub %v2float %197 %198 + OpStore %cMass %199 + OpBranch %189 + %189 = OpLabel + %200 = OpLoad %int %cVelCount + %201 = OpSGreaterThan %bool %200 %113 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %202 + %203 = OpLabel + %204 = OpLoad %v2float %cVel + %206 = OpLoad %int %cVelCount + %205 = OpConvertSToF %float %206 + %208 = OpLoad %int %cVelCount + %207 = OpConvertSToF %float %208 + %209 = OpCompositeConstruct %v2float %205 %207 + %210 = OpFDiv %v2float %204 %209 + OpStore %cVel %210 + OpBranch %202 + %202 = OpLabel + %211 = OpLoad %v2float %vVel + %212 = OpLoad %v2float %cMass + %214 = OpAccessChain %_ptr_Uniform_float %params %uint_4 + %215 = OpLoad %float %214 + %216 = OpVectorTimesScalar %v2float %212 %215 + %217 = OpFAdd %v2float %211 %216 + %218 = OpLoad %v2float %colVel + %219 = OpAccessChain %_ptr_Uniform_float %params %uint_5 + %220 = OpLoad %float %219 + %221 = OpVectorTimesScalar %v2float %218 %220 + %222 = OpFAdd %v2float %217 %221 + %223 = OpLoad %v2float %cVel + %225 = OpAccessChain %_ptr_Uniform_float %params %uint_6 + %226 = OpLoad %float %225 + %227 = OpVectorTimesScalar %v2float %223 %226 + %228 = OpFAdd %v2float %222 %227 + OpStore %vVel %228 + %230 = OpLoad %v2float %vVel + %229 = OpExtInst %v2float %37 Normalize %230 %233 = OpLoad %v2float %vVel - %232 = OpExtInst %v2float %37 Normalize %233 - %236 = OpLoad %v2float %vVel - %235 = OpExtInst %float %37 Length %236 - %234 = OpExtInst %float %37 NClamp %235 %float_0 %float_0_100000001 - %238 = OpVectorTimesScalar %v2float %232 %234 - OpStore %vVel %238 - %239 = OpLoad %v2float %vPos - %240 = OpLoad %v2float %vVel - %241 = OpAccessChain %_ptr_Uniform_float %params %uint_0 - %242 = OpLoad %float %241 - %243 = OpVectorTimesScalar %v2float %240 %242 - %244 = OpFAdd %v2float %239 %243 - OpStore %vPos %244 - %245 = OpAccessChain %_ptr_Function_float %vPos %uint_0 - %246 = OpLoad %float %245 - %248 = OpFOrdLessThan %bool %246 %float_n1 - OpSelectionMerge %249 None - OpBranchConditional %248 %250 %249 - %250 = OpLabel - %251 = OpAccessChain %_ptr_Function_float %vPos %uint_0 - OpStore %251 %float_1 - OpBranch %249 - %249 = OpLabel - %252 = OpAccessChain %_ptr_Function_float %vPos %uint_0 - %253 = OpLoad %float %252 - %254 = OpFOrdGreaterThan %bool %253 %float_1 - OpSelectionMerge %255 None - OpBranchConditional %254 %256 %255 - %256 = OpLabel - %257 = OpAccessChain %_ptr_Function_float %vPos %uint_0 - OpStore %257 %float_n1 - OpBranch %255 - %255 = OpLabel - %258 = OpAccessChain %_ptr_Function_float %vPos %uint_1 - %259 = OpLoad %float %258 - %260 = OpFOrdLessThan %bool %259 %float_n1 - OpSelectionMerge %261 None - OpBranchConditional %260 %262 %261 - %262 = OpLabel - %263 = OpAccessChain %_ptr_Function_float %vPos %uint_1 - OpStore %263 %float_1 - OpBranch %261 - %261 = OpLabel - %264 = OpAccessChain %_ptr_Function_float %vPos %uint_1 - %265 = OpLoad %float %264 - %266 = OpFOrdGreaterThan %bool %265 %float_1 - OpSelectionMerge %267 None - OpBranchConditional %266 %268 %267 - %268 = OpLabel - %269 = OpAccessChain %_ptr_Function_float %vPos %uint_1 - OpStore %269 %float_n1 - OpBranch %267 - %267 = OpLabel + %232 = OpExtInst %float %37 Length %233 + %231 = OpExtInst %float %37 NClamp %232 %13 %float_0_100000001 + %235 = OpVectorTimesScalar %v2float %229 %231 + OpStore %vVel %235 + %236 = OpLoad %v2float %vPos + %237 = OpLoad %v2float %vVel + %238 = OpAccessChain %_ptr_Uniform_float %params %uint_0 + %239 = OpLoad %float %238 + %240 = OpVectorTimesScalar %v2float %237 %239 + %241 = OpFAdd %v2float %236 %240 + OpStore %vPos %241 + %242 = OpAccessChain %_ptr_Function_float %vPos %uint_0 + %243 = OpLoad %float %242 + %245 = OpFOrdLessThan %bool %243 %float_n1 + OpSelectionMerge %246 None + OpBranchConditional %245 %247 %246 + %247 = OpLabel + %248 = OpAccessChain %_ptr_Function_float %vPos %uint_0 + OpStore %248 %float_1 + OpBranch %246 + %246 = OpLabel + %249 = OpAccessChain %_ptr_Function_float %vPos %uint_0 + %250 = OpLoad %float %249 + %251 = OpFOrdGreaterThan %bool %250 %float_1 + OpSelectionMerge %252 None + OpBranchConditional %251 %253 %252 + %253 = OpLabel + %254 = OpAccessChain %_ptr_Function_float %vPos %uint_0 + OpStore %254 %float_n1 + OpBranch %252 + %252 = OpLabel + %255 = OpAccessChain %_ptr_Function_float %vPos %uint_1 + %256 = OpLoad %float %255 + %257 = OpFOrdLessThan %bool %256 %float_n1 + OpSelectionMerge %258 None + OpBranchConditional %257 %259 %258 + %259 = OpLabel + %260 = OpAccessChain %_ptr_Function_float %vPos %uint_1 + OpStore %260 %float_1 + OpBranch %258 + %258 = OpLabel + %261 = OpAccessChain %_ptr_Function_float %vPos %uint_1 + %262 = OpLoad %float %261 + %263 = OpFOrdGreaterThan %bool %262 %float_1 + OpSelectionMerge %264 None + OpBranchConditional %263 %265 %264 + %265 = OpLabel + %266 = OpAccessChain %_ptr_Function_float %vPos %uint_1 + OpStore %266 %float_n1 + OpBranch %264 + %264 = OpLabel + %267 = OpLoad %uint %index + %268 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %267 %uint_0 + %269 = OpLoad %v2float %vPos + OpStore %268 %269 %270 = OpLoad %uint %index - %271 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %270 %uint_0 - %272 = OpLoad %v2float %vPos + %271 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %270 %uint_1 + %272 = OpLoad %v2float %vVel OpStore %271 %272 - %273 = OpLoad %uint %index - %274 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %273 %uint_1 - %275 = OpLoad %v2float %vVel - OpStore %274 %275 OpReturn OpFunctionEnd - %comp_main = OpFunction %void None %71 - %277 = OpLabel - %279 = OpLoad %v3uint %gl_GlobalInvocationID_1 - %278 = OpFunctionCall %void %comp_main_inner %279 + %comp_main = OpFunction %void None %70 + %274 = OpLabel + %276 = OpLoad %v3uint %gl_GlobalInvocationID_1 + %275 = OpFunctionCall %void %comp_main_inner %276 OpReturn OpFunctionEnd diff --git a/test/tint/samples/compute_boids.wgsl.expected.wgsl b/test/tint/samples/compute_boids.wgsl.expected.wgsl index 45ef30bae7..b41ba8cd6e 100644 --- a/test/tint/samples/compute_boids.wgsl.expected.wgsl +++ b/test/tint/samples/compute_boids.wgsl.expected.wgsl @@ -1,11 +1,11 @@ -@stage(vertex) +@vertex fn vert_main(@location(0) a_particlePos : vec2, @location(1) a_particleVel : vec2, @location(2) a_pos : vec2) -> @builtin(position) vec4 { var angle : f32 = -(atan2(a_particleVel.x, a_particleVel.y)); var pos : vec2 = vec2(((a_pos.x * cos(angle)) - (a_pos.y * sin(angle))), ((a_pos.x * sin(angle)) + (a_pos.y * cos(angle)))); return vec4((pos + a_particlePos), 0.0, 1.0); } -@stage(fragment) +@fragment fn frag_main() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } @@ -35,7 +35,7 @@ struct Particles { @binding(2) @group(0) var particlesB : Particles; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn comp_main(@builtin(global_invocation_id) gl_GlobalInvocationID : vec3) { var index : u32 = gl_GlobalInvocationID.x; if ((index >= 5u)) { diff --git a/test/tint/samples/cube.wgsl b/test/tint/samples/cube.wgsl index a894a2fe05..0a93ac633b 100644 --- a/test/tint/samples/cube.wgsl +++ b/test/tint/samples/cube.wgsl @@ -29,7 +29,7 @@ struct VertexOutput { @builtin(position) Position : vec4, }; -@stage(vertex) +@vertex fn vtx_main(input : VertexInput) -> VertexOutput { var output : VertexOutput; output.Position = uniforms.modelViewProjectionMatrix * input.cur_position; @@ -39,7 +39,7 @@ fn vtx_main(input : VertexInput) -> VertexOutput { // Fragment shader -@stage(fragment) +@fragment fn frag_main(@location(0) fragColor : vec4) -> @location(0) vec4 { return fragColor; diff --git a/test/tint/samples/cube.wgsl.expected.hlsl b/test/tint/samples/cube.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/samples/cube.wgsl.expected.hlsl rename to test/tint/samples/cube.wgsl.expected.dxc.hlsl diff --git a/test/tint/samples/cube.wgsl.expected.fxc.hlsl b/test/tint/samples/cube.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..82af450e84 --- /dev/null +++ b/test/tint/samples/cube.wgsl.expected.fxc.hlsl @@ -0,0 +1,62 @@ +cbuffer cbuffer_uniforms : register(b0, space0) { + uint4 uniforms[4]; +}; + +struct VertexInput { + float4 cur_position; + float4 color; +}; +struct VertexOutput { + float4 vtxFragColor; + float4 Position; +}; +struct tint_symbol_1 { + float4 cur_position : TEXCOORD0; + float4 color : TEXCOORD1; +}; +struct tint_symbol_2 { + float4 vtxFragColor : TEXCOORD0; + float4 Position : SV_Position; +}; + +float4x4 tint_symbol_6(uint4 buffer[4], uint offset) { + const uint scalar_offset = ((offset + 0u)) / 4; + const uint scalar_offset_1 = ((offset + 16u)) / 4; + const uint scalar_offset_2 = ((offset + 32u)) / 4; + const uint scalar_offset_3 = ((offset + 48u)) / 4; + return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4])); +} + +VertexOutput vtx_main_inner(VertexInput input) { + VertexOutput output = (VertexOutput)0; + output.Position = mul(input.cur_position, tint_symbol_6(uniforms, 0u)); + output.vtxFragColor = input.color; + return output; +} + +tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) { + const VertexInput tint_symbol_8 = {tint_symbol.cur_position, tint_symbol.color}; + const VertexOutput inner_result = vtx_main_inner(tint_symbol_8); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.vtxFragColor = inner_result.vtxFragColor; + wrapper_result.Position = inner_result.Position; + return wrapper_result; +} + +struct tint_symbol_4 { + float4 fragColor : TEXCOORD0; +}; +struct tint_symbol_5 { + float4 value : SV_Target0; +}; + +float4 frag_main_inner(float4 fragColor) { + return fragColor; +} + +tint_symbol_5 frag_main(tint_symbol_4 tint_symbol_3) { + const float4 inner_result_1 = frag_main_inner(tint_symbol_3.fragColor); + tint_symbol_5 wrapper_result_1 = (tint_symbol_5)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} diff --git a/test/tint/samples/cube.wgsl.expected.wgsl b/test/tint/samples/cube.wgsl.expected.wgsl index 4014881329..6c36853ff5 100644 --- a/test/tint/samples/cube.wgsl.expected.wgsl +++ b/test/tint/samples/cube.wgsl.expected.wgsl @@ -18,7 +18,7 @@ struct VertexOutput { Position : vec4, } -@stage(vertex) +@vertex fn vtx_main(input : VertexInput) -> VertexOutput { var output : VertexOutput; output.Position = (uniforms.modelViewProjectionMatrix * input.cur_position); @@ -26,7 +26,7 @@ fn vtx_main(input : VertexInput) -> VertexOutput { return output; } -@stage(fragment) +@fragment fn frag_main(@location(0) fragColor : vec4) -> @location(0) vec4 { return fragColor; } diff --git a/test/tint/samples/function.wgsl b/test/tint/samples/function.wgsl index 92ffb04a0a..1987a5f4c6 100644 --- a/test/tint/samples/function.wgsl +++ b/test/tint/samples/function.wgsl @@ -16,6 +16,6 @@ fn main() -> f32 { return ((2. * 3.) - 4.) / 5.; } -@stage(compute) @workgroup_size(2) +@compute @workgroup_size(2) fn ep() { } diff --git a/test/tint/samples/function.wgsl.expected.hlsl b/test/tint/samples/function.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/samples/function.wgsl.expected.hlsl rename to test/tint/samples/function.wgsl.expected.dxc.hlsl diff --git a/test/tint/samples/function.wgsl.expected.fxc.hlsl b/test/tint/samples/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9de43a2241 --- /dev/null +++ b/test/tint/samples/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +float main() { + return (((2.0f * 3.0f) - 4.0f) / 5.0f); +} + +[numthreads(2, 1, 1)] +void ep() { + return; +} diff --git a/test/tint/samples/function.wgsl.expected.wgsl b/test/tint/samples/function.wgsl.expected.wgsl index 5a3a80c47a..23b97bba60 100644 --- a/test/tint/samples/function.wgsl.expected.wgsl +++ b/test/tint/samples/function.wgsl.expected.wgsl @@ -2,6 +2,6 @@ fn main() -> f32 { return (((2.0 * 3.0) - 4.0) / 5.0); } -@stage(compute) @workgroup_size(2) +@compute @workgroup_size(2) fn ep() { } diff --git a/test/tint/samples/simple.wgsl b/test/tint/samples/simple.wgsl index d30b8a0792..28522e86be 100644 --- a/test/tint/samples/simple.wgsl +++ b/test/tint/samples/simple.wgsl @@ -15,7 +15,7 @@ fn bar() { } -@stage(fragment) +@fragment fn main() -> @location(0) vec4 { var a : vec2 = vec2(); bar(); diff --git a/test/tint/samples/simple.wgsl.expected.dxc.hlsl b/test/tint/samples/simple.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f47bf239c1 --- /dev/null +++ b/test/tint/samples/simple.wgsl.expected.dxc.hlsl @@ -0,0 +1,19 @@ +void bar() { +} + +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + float2 a = (0.0f).xx; + bar(); + return float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/samples/simple.wgsl.expected.fxc.hlsl b/test/tint/samples/simple.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f47bf239c1 --- /dev/null +++ b/test/tint/samples/simple.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +void bar() { +} + +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + float2 a = (0.0f).xx; + bar(); + return float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/samples/simple.wgsl.expected.glsl b/test/tint/samples/simple.wgsl.expected.glsl index 995583f921..3e4dabea19 100644 --- a/test/tint/samples/simple.wgsl.expected.glsl +++ b/test/tint/samples/simple.wgsl.expected.glsl @@ -6,7 +6,7 @@ void bar() { } vec4 tint_symbol() { - vec2 a = vec2(0.0f, 0.0f); + vec2 a = vec2(0.0f); bar(); return vec4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); } diff --git a/test/tint/samples/simple.wgsl.expected.hlsl b/test/tint/samples/simple.wgsl.expected.hlsl deleted file mode 100644 index 93c7fa7301..0000000000 --- a/test/tint/samples/simple.wgsl.expected.hlsl +++ /dev/null @@ -1,19 +0,0 @@ -void bar() { -} - -struct tint_symbol { - float4 value : SV_Target0; -}; - -float4 main_inner() { - float2 a = float2(0.0f, 0.0f); - bar(); - return float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); -} - -tint_symbol main() { - const float4 inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/samples/simple.wgsl.expected.msl b/test/tint/samples/simple.wgsl.expected.msl index d7fde539d8..d84f872afc 100644 --- a/test/tint/samples/simple.wgsl.expected.msl +++ b/test/tint/samples/simple.wgsl.expected.msl @@ -9,7 +9,7 @@ struct tint_symbol_1 { }; float4 tint_symbol_inner() { - float2 a = float2(); + float2 a = float2(0.0f); bar(); return float4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f); } diff --git a/test/tint/samples/simple.wgsl.expected.wgsl b/test/tint/samples/simple.wgsl.expected.wgsl index 83388f8899..0c37a6567d 100644 --- a/test/tint/samples/simple.wgsl.expected.wgsl +++ b/test/tint/samples/simple.wgsl.expected.wgsl @@ -1,7 +1,7 @@ fn bar() { } -@stage(fragment) +@fragment fn main() -> @location(0) vec4 { var a : vec2 = vec2(); bar(); diff --git a/test/tint/samples/simple_vertex.spvasm.expected.dxc.hlsl b/test/tint/samples/simple_vertex.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..1971eddee7 --- /dev/null +++ b/test/tint/samples/simple_vertex.spvasm.expected.dxc.hlsl @@ -0,0 +1,26 @@ +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = (0.0f).xxxx; + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol { + float4 gl_Position : SV_Position; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {gl_Position}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.gl_Position = inner_result.gl_Position; + return wrapper_result; +} diff --git a/test/tint/samples/simple_vertex.spvasm.expected.fxc.hlsl b/test/tint/samples/simple_vertex.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1971eddee7 --- /dev/null +++ b/test/tint/samples/simple_vertex.spvasm.expected.fxc.hlsl @@ -0,0 +1,26 @@ +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = (0.0f).xxxx; + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol { + float4 gl_Position : SV_Position; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {gl_Position}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.gl_Position = inner_result.gl_Position; + return wrapper_result; +} diff --git a/test/tint/samples/simple_vertex.spvasm.expected.glsl b/test/tint/samples/simple_vertex.spvasm.expected.glsl index e18ab68c0b..31db9ff5f7 100644 --- a/test/tint/samples/simple_vertex.spvasm.expected.glsl +++ b/test/tint/samples/simple_vertex.spvasm.expected.glsl @@ -2,7 +2,7 @@ vec4 tint_symbol = vec4(0.0f, 0.0f, 0.0f, 0.0f); void main_1() { - tint_symbol = vec4(0.0f, 0.0f, 0.0f, 0.0f); + tint_symbol = vec4(0.0f); return; } diff --git a/test/tint/samples/simple_vertex.spvasm.expected.hlsl b/test/tint/samples/simple_vertex.spvasm.expected.hlsl deleted file mode 100644 index b262a94103..0000000000 --- a/test/tint/samples/simple_vertex.spvasm.expected.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); - return; -} - -struct main_out { - float4 gl_Position; -}; -struct tint_symbol { - float4 gl_Position : SV_Position; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {gl_Position}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.gl_Position = inner_result.gl_Position; - return wrapper_result; -} diff --git a/test/tint/samples/simple_vertex.spvasm.expected.msl b/test/tint/samples/simple_vertex.spvasm.expected.msl index f12b315596..27cb3a45f5 100644 --- a/test/tint/samples/simple_vertex.spvasm.expected.msl +++ b/test/tint/samples/simple_vertex.spvasm.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void main_1(thread float4* const tint_symbol_3) { - *(tint_symbol_3) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_3) = float4(0.0f); return; } diff --git a/test/tint/samples/simple_vertex.spvasm.expected.spvasm b/test/tint/samples/simple_vertex.spvasm.expected.spvasm index 0a7c17bbc0..29cf03454f 100644 --- a/test/tint/samples/simple_vertex.spvasm.expected.spvasm +++ b/test/tint/samples/simple_vertex.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 29 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -29,28 +29,26 @@ %gl_Position = OpVariable %_ptr_Private_v4float Private %5 %void = OpTypeVoid %11 = OpTypeFunction %void - %float_0 = OpConstant %float 0 - %16 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 %main_out = OpTypeStruct %v4float - %17 = OpTypeFunction %main_out + %15 = OpTypeFunction %main_out %float_1 = OpConstant %float 1 %main_1 = OpFunction %void None %11 %14 = OpLabel - OpStore %gl_Position %16 + OpStore %gl_Position %5 OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %17 - %20 = OpLabel - %21 = OpFunctionCall %void %main_1 - %22 = OpLoad %v4float %gl_Position - %23 = OpCompositeConstruct %main_out %22 - OpReturnValue %23 + %main_inner = OpFunction %main_out None %15 + %18 = OpLabel + %19 = OpFunctionCall %void %main_1 + %20 = OpLoad %v4float %gl_Position + %21 = OpCompositeConstruct %main_out %20 + OpReturnValue %21 OpFunctionEnd %main = OpFunction %void None %11 - %25 = OpLabel - %26 = OpFunctionCall %main_out %main_inner - %27 = OpCompositeExtract %v4float %26 0 - OpStore %gl_Position_1 %27 + %23 = OpLabel + %24 = OpFunctionCall %main_out %main_inner + %25 = OpCompositeExtract %v4float %24 0 + OpStore %gl_Position_1 %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/samples/simple_vertex.spvasm.expected.wgsl b/test/tint/samples/simple_vertex.spvasm.expected.wgsl index 3aaf1efc2b..773ef6451f 100644 --- a/test/tint/samples/simple_vertex.spvasm.expected.wgsl +++ b/test/tint/samples/simple_vertex.spvasm.expected.wgsl @@ -1,7 +1,7 @@ var gl_Position : vec4; fn main_1() { - gl_Position = vec4(0.0, 0.0, 0.0, 0.0); + gl_Position = vec4(0.0f, 0.0f, 0.0f, 0.0f); return; } @@ -10,7 +10,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main() -> main_out { main_1(); return main_out(gl_Position); diff --git a/test/tint/samples/triangle.wgsl b/test/tint/samples/triangle.wgsl index 69d22818db..814c1c0be9 100644 --- a/test/tint/samples/triangle.wgsl +++ b/test/tint/samples/triangle.wgsl @@ -13,19 +13,18 @@ // limitations under the License. // Vertex shader -let pos : array, 3> = array, 3>( - vec2(0.0, 0.5), - vec2(-0.5, -0.5), - vec2(0.5, -0.5)); +const pos = array, 3>(vec2(0.0, 0.5), + vec2(-0.5, -0.5), + vec2(0.5, -0.5)); -@stage(vertex) +@vertex fn vtx_main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { return vec4(pos[VertexIndex], 0.0, 1.0); } // Fragment shader -@stage(fragment) +@fragment fn frag_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } diff --git a/test/tint/samples/triangle.wgsl.expected.dxc.hlsl b/test/tint/samples/triangle.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ee8118cd77 --- /dev/null +++ b/test/tint/samples/triangle.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +struct tint_symbol_1 { + uint VertexIndex : SV_VertexID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 vtx_main_inner(uint VertexIndex) { + const float2 tint_symbol_4[3] = {float2(0.0f, 0.5f), (-0.5f).xx, float2(0.5f, -0.5f)}; + return float4(tint_symbol_4[VertexIndex], 0.0f, 1.0f); +} + +tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) { + const float4 inner_result = vtx_main_inner(tint_symbol.VertexIndex); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +struct tint_symbol_3 { + float4 value : SV_Target0; +}; + +float4 frag_main_inner() { + return float4(1.0f, 0.0f, 0.0f, 1.0f); +} + +tint_symbol_3 frag_main() { + const float4 inner_result_1 = frag_main_inner(); + tint_symbol_3 wrapper_result_1 = (tint_symbol_3)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} diff --git a/test/tint/samples/triangle.wgsl.expected.fxc.hlsl b/test/tint/samples/triangle.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ee8118cd77 --- /dev/null +++ b/test/tint/samples/triangle.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +struct tint_symbol_1 { + uint VertexIndex : SV_VertexID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 vtx_main_inner(uint VertexIndex) { + const float2 tint_symbol_4[3] = {float2(0.0f, 0.5f), (-0.5f).xx, float2(0.5f, -0.5f)}; + return float4(tint_symbol_4[VertexIndex], 0.0f, 1.0f); +} + +tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) { + const float4 inner_result = vtx_main_inner(tint_symbol.VertexIndex); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +struct tint_symbol_3 { + float4 value : SV_Target0; +}; + +float4 frag_main_inner() { + return float4(1.0f, 0.0f, 0.0f, 1.0f); +} + +tint_symbol_3 frag_main() { + const float4 inner_result_1 = frag_main_inner(); + tint_symbol_3 wrapper_result_1 = (tint_symbol_3)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} diff --git a/test/tint/samples/triangle.wgsl.expected.glsl b/test/tint/samples/triangle.wgsl.expected.glsl index 71d8fb4081..c0961e2b26 100644 --- a/test/tint/samples/triangle.wgsl.expected.glsl +++ b/test/tint/samples/triangle.wgsl.expected.glsl @@ -1,8 +1,8 @@ #version 310 es -const vec2 pos[3] = vec2[3](vec2(0.0f, 0.5f), vec2(-0.5f, -0.5f), vec2(0.5f, -0.5f)); vec4 vtx_main(uint VertexIndex) { - return vec4(pos[VertexIndex], 0.0f, 1.0f); + vec2 tint_symbol[3] = vec2[3](vec2(0.0f, 0.5f), vec2(-0.5f), vec2(0.5f, -0.5f)); + return vec4(tint_symbol[VertexIndex], 0.0f, 1.0f); } void main() { diff --git a/test/tint/samples/triangle.wgsl.expected.hlsl b/test/tint/samples/triangle.wgsl.expected.hlsl deleted file mode 100644 index c2bc195871..0000000000 --- a/test/tint/samples/triangle.wgsl.expected.hlsl +++ /dev/null @@ -1,34 +0,0 @@ -static const float2 pos[3] = {float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)}; - -struct tint_symbol_1 { - uint VertexIndex : SV_VertexID; -}; -struct tint_symbol_2 { - float4 value : SV_Position; -}; - -float4 vtx_main_inner(uint VertexIndex) { - return float4(pos[VertexIndex], 0.0f, 1.0f); -} - -tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) { - const float4 inner_result = vtx_main_inner(tint_symbol.VertexIndex); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.value = inner_result; - return wrapper_result; -} - -struct tint_symbol_3 { - float4 value : SV_Target0; -}; - -float4 frag_main_inner() { - return float4(1.0f, 0.0f, 0.0f, 1.0f); -} - -tint_symbol_3 frag_main() { - const float4 inner_result_1 = frag_main_inner(); - tint_symbol_3 wrapper_result_1 = (tint_symbol_3)0; - wrapper_result_1.value = inner_result_1; - return wrapper_result_1; -} diff --git a/test/tint/samples/triangle.wgsl.expected.msl b/test/tint/samples/triangle.wgsl.expected.msl index 246e75c83f..bac249a6a6 100644 --- a/test/tint/samples/triangle.wgsl.expected.msl +++ b/test/tint/samples/triangle.wgsl.expected.msl @@ -1,18 +1,26 @@ #include using namespace metal; -struct tint_array_wrapper { - float2 arr[3]; -}; -constant tint_array_wrapper pos = {.arr={float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)}}; +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; struct tint_symbol { float4 value [[position]]; }; float4 vtx_main_inner(uint VertexIndex) { - return float4(pos.arr[VertexIndex], 0.0f, 1.0f); + tint_array const tint_symbol_2 = tint_array{float2(0.0f, 0.5f), float2(-0.5f), float2(0.5f, -0.5f)}; + return float4(tint_symbol_2[VertexIndex], 0.0f, 1.0f); } vertex tint_symbol vtx_main(uint VertexIndex [[vertex_id]]) { diff --git a/test/tint/samples/triangle.wgsl.expected.spvasm b/test/tint/samples/triangle.wgsl.expected.spvasm index 1816286e02..c8c5b59dba 100644 --- a/test/tint/samples/triangle.wgsl.expected.spvasm +++ b/test/tint/samples/triangle.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 50 +; Bound: 49 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -12,7 +12,6 @@ OpName %value "value" OpName %vertex_point_size "vertex_point_size" OpName %value_1 "value_1" - OpName %pos "pos" OpName %vtx_main_inner "vtx_main_inner" OpName %VertexIndex "VertexIndex" OpName %var_for_index "var_for_index" @@ -36,52 +35,51 @@ %11 = OpConstantNull %float %vertex_point_size = OpVariable %_ptr_Output_float Output %11 %value_1 = OpVariable %_ptr_Output_v4float Output %8 + %13 = OpTypeFunction %v4float %uint %v2float = OpTypeVector %float 2 %uint_3 = OpConstant %uint 3 %_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 - %float_0 = OpConstant %float 0 %float_0_5 = OpConstant %float 0.5 - %18 = OpConstantComposite %v2float %float_0 %float_0_5 + %21 = OpConstantComposite %v2float %11 %float_0_5 %float_n0_5 = OpConstant %float -0.5 - %20 = OpConstantComposite %v2float %float_n0_5 %float_n0_5 - %21 = OpConstantComposite %v2float %float_0_5 %float_n0_5 - %pos = OpConstantComposite %_arr_v2float_uint_3 %18 %20 %21 - %23 = OpTypeFunction %v4float %uint + %23 = OpConstantComposite %v2float %float_n0_5 %float_n0_5 + %24 = OpConstantComposite %v2float %float_0_5 %float_n0_5 + %25 = OpConstantComposite %_arr_v2float_uint_3 %21 %23 %24 %_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3 - %29 = OpConstantNull %_arr_v2float_uint_3 + %28 = OpConstantNull %_arr_v2float_uint_3 %_ptr_Function_v2float = OpTypePointer Function %v2float %float_1 = OpConstant %float 1 %void = OpTypeVoid - %37 = OpTypeFunction %void - %43 = OpTypeFunction %v4float - %46 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 -%vtx_main_inner = OpFunction %v4float None %23 + %36 = OpTypeFunction %void + %42 = OpTypeFunction %v4float + %45 = OpConstantComposite %v4float %float_1 %11 %11 %float_1 +%vtx_main_inner = OpFunction %v4float None %13 %VertexIndex = OpFunctionParameter %uint - %26 = OpLabel -%var_for_index = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %29 - OpStore %var_for_index %pos - %31 = OpAccessChain %_ptr_Function_v2float %var_for_index %VertexIndex - %32 = OpLoad %v2float %31 - %33 = OpCompositeExtract %float %32 0 - %34 = OpCompositeExtract %float %32 1 - %36 = OpCompositeConstruct %v4float %33 %34 %float_0 %float_1 - OpReturnValue %36 + %16 = OpLabel +%var_for_index = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %28 + OpStore %var_for_index %25 + %30 = OpAccessChain %_ptr_Function_v2float %var_for_index %VertexIndex + %31 = OpLoad %v2float %30 + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %35 = OpCompositeConstruct %v4float %32 %33 %11 %float_1 + OpReturnValue %35 OpFunctionEnd - %vtx_main = OpFunction %void None %37 - %40 = OpLabel - %42 = OpLoad %uint %VertexIndex_1 - %41 = OpFunctionCall %v4float %vtx_main_inner %42 - OpStore %value %41 + %vtx_main = OpFunction %void None %36 + %39 = OpLabel + %41 = OpLoad %uint %VertexIndex_1 + %40 = OpFunctionCall %v4float %vtx_main_inner %41 + OpStore %value %40 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd -%frag_main_inner = OpFunction %v4float None %43 - %45 = OpLabel - OpReturnValue %46 +%frag_main_inner = OpFunction %v4float None %42 + %44 = OpLabel + OpReturnValue %45 OpFunctionEnd - %frag_main = OpFunction %void None %37 - %48 = OpLabel - %49 = OpFunctionCall %v4float %frag_main_inner - OpStore %value_1 %49 + %frag_main = OpFunction %void None %36 + %47 = OpLabel + %48 = OpFunctionCall %v4float %frag_main_inner + OpStore %value_1 %48 OpReturn OpFunctionEnd diff --git a/test/tint/samples/triangle.wgsl.expected.wgsl b/test/tint/samples/triangle.wgsl.expected.wgsl index c92f0a6141..dcdf48cb69 100644 --- a/test/tint/samples/triangle.wgsl.expected.wgsl +++ b/test/tint/samples/triangle.wgsl.expected.wgsl @@ -1,11 +1,11 @@ -let pos : array, 3> = array, 3>(vec2(0.0, 0.5), vec2(-0.5, -0.5), vec2(0.5, -0.5)); +const pos = array, 3>(vec2(0.0, 0.5), vec2(-0.5, -0.5), vec2(0.5, -0.5)); -@stage(vertex) +@vertex fn vtx_main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4 { return vec4(pos[VertexIndex], 0.0, 1.0); } -@stage(fragment) +@fragment fn frag_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } diff --git a/test/tint/shader_io/compute_input_builtins.wgsl b/test/tint/shader_io/compute_input_builtins.wgsl index 77f209eea6..dfcd8bccb1 100644 --- a/test/tint/shader_io/compute_input_builtins.wgsl +++ b/test/tint/shader_io/compute_input_builtins.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main( @builtin(local_invocation_id) local_invocation_id : vec3, @builtin(local_invocation_index) local_invocation_index : u32, diff --git a/test/tint/shader_io/compute_input_builtins.wgsl.expected.hlsl b/test/tint/shader_io/compute_input_builtins.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/compute_input_builtins.wgsl.expected.hlsl rename to test/tint/shader_io/compute_input_builtins.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/compute_input_builtins.wgsl.expected.fxc.hlsl b/test/tint/shader_io/compute_input_builtins.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d6ab749383 --- /dev/null +++ b/test/tint/shader_io/compute_input_builtins.wgsl.expected.fxc.hlsl @@ -0,0 +1,20 @@ +cbuffer cbuffer_tint_symbol_3 : register(b0, space0) { + uint4 tint_symbol_3[1]; +}; + +struct tint_symbol_1 { + uint3 local_invocation_id : SV_GroupThreadID; + uint local_invocation_index : SV_GroupIndex; + uint3 global_invocation_id : SV_DispatchThreadID; + uint3 workgroup_id : SV_GroupID; +}; + +void main_inner(uint3 local_invocation_id, uint local_invocation_index, uint3 global_invocation_id, uint3 workgroup_id, uint3 num_workgroups) { + const uint foo = ((((local_invocation_id.x + local_invocation_index) + global_invocation_id.x) + workgroup_id.x) + num_workgroups.x); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_id, tint_symbol.local_invocation_index, tint_symbol.global_invocation_id, tint_symbol.workgroup_id, tint_symbol_3[0].xyz); + return; +} diff --git a/test/tint/shader_io/compute_input_builtins.wgsl.expected.wgsl b/test/tint/shader_io/compute_input_builtins.wgsl.expected.wgsl index a1d31636c5..96c52bff89 100644 --- a/test/tint/shader_io/compute_input_builtins.wgsl.expected.wgsl +++ b/test/tint/shader_io/compute_input_builtins.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(@builtin(local_invocation_id) local_invocation_id : vec3, @builtin(local_invocation_index) local_invocation_index : u32, @builtin(global_invocation_id) global_invocation_id : vec3, @builtin(workgroup_id) workgroup_id : vec3, @builtin(num_workgroups) num_workgroups : vec3) { let foo : u32 = ((((local_invocation_id.x + local_invocation_index) + global_invocation_id.x) + workgroup_id.x) + num_workgroups.x); } diff --git a/test/tint/shader_io/compute_input_builtins_struct.wgsl b/test/tint/shader_io/compute_input_builtins_struct.wgsl index 336e82265e..fccdff0654 100644 --- a/test/tint/shader_io/compute_input_builtins_struct.wgsl +++ b/test/tint/shader_io/compute_input_builtins_struct.wgsl @@ -6,7 +6,7 @@ struct ComputeInputs { @builtin(num_workgroups) num_workgroups : vec3, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(inputs : ComputeInputs) { let foo : u32 = inputs.local_invocation_id.x + diff --git a/test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.hlsl b/test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.hlsl rename to test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..783117eb83 --- /dev/null +++ b/test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_tint_symbol_3 : register(b0, space0) { + uint4 tint_symbol_3[1]; +}; + +struct ComputeInputs { + uint3 local_invocation_id; + uint local_invocation_index; + uint3 global_invocation_id; + uint3 workgroup_id; + uint3 num_workgroups; +}; +struct tint_symbol_1 { + uint3 local_invocation_id : SV_GroupThreadID; + uint local_invocation_index : SV_GroupIndex; + uint3 global_invocation_id : SV_DispatchThreadID; + uint3 workgroup_id : SV_GroupID; +}; + +void main_inner(ComputeInputs inputs) { + const uint foo = ((((inputs.local_invocation_id.x + inputs.local_invocation_index) + inputs.global_invocation_id.x) + inputs.workgroup_id.x) + inputs.num_workgroups.x); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const ComputeInputs tint_symbol_5 = {tint_symbol.local_invocation_id, tint_symbol.local_invocation_index, tint_symbol.global_invocation_id, tint_symbol.workgroup_id, tint_symbol_3[0].xyz}; + main_inner(tint_symbol_5); + return; +} diff --git a/test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.wgsl b/test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.wgsl index da12569cf0..84c1a1a1f4 100644 --- a/test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/compute_input_builtins_struct.wgsl.expected.wgsl @@ -11,7 +11,7 @@ struct ComputeInputs { num_workgroups : vec3, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(inputs : ComputeInputs) { let foo : u32 = ((((inputs.local_invocation_id.x + inputs.local_invocation_index) + inputs.global_invocation_id.x) + inputs.workgroup_id.x) + inputs.num_workgroups.x); } diff --git a/test/tint/shader_io/compute_input_mixed.wgsl b/test/tint/shader_io/compute_input_mixed.wgsl index 7142431abb..8b5b9c7aa3 100644 --- a/test/tint/shader_io/compute_input_mixed.wgsl +++ b/test/tint/shader_io/compute_input_mixed.wgsl @@ -5,7 +5,7 @@ struct ComputeInputs1 { @builtin(workgroup_id) workgroup_id : vec3, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main( inputs0 : ComputeInputs0, @builtin(local_invocation_index) local_invocation_index : u32, diff --git a/test/tint/shader_io/compute_input_mixed.wgsl.expected.hlsl b/test/tint/shader_io/compute_input_mixed.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/compute_input_mixed.wgsl.expected.hlsl rename to test/tint/shader_io/compute_input_mixed.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/compute_input_mixed.wgsl.expected.fxc.hlsl b/test/tint/shader_io/compute_input_mixed.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e72a9d2d3c --- /dev/null +++ b/test/tint/shader_io/compute_input_mixed.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +struct ComputeInputs0 { + uint3 local_invocation_id; +}; +struct ComputeInputs1 { + uint3 workgroup_id; +}; +struct tint_symbol_1 { + uint3 local_invocation_id : SV_GroupThreadID; + uint local_invocation_index : SV_GroupIndex; + uint3 global_invocation_id : SV_DispatchThreadID; + uint3 workgroup_id : SV_GroupID; +}; + +void main_inner(ComputeInputs0 inputs0, uint local_invocation_index, uint3 global_invocation_id, ComputeInputs1 inputs1) { + const uint foo = (((inputs0.local_invocation_id.x + local_invocation_index) + global_invocation_id.x) + inputs1.workgroup_id.x); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const ComputeInputs0 tint_symbol_2 = {tint_symbol.local_invocation_id}; + const ComputeInputs1 tint_symbol_3 = {tint_symbol.workgroup_id}; + main_inner(tint_symbol_2, tint_symbol.local_invocation_index, tint_symbol.global_invocation_id, tint_symbol_3); + return; +} diff --git a/test/tint/shader_io/compute_input_mixed.wgsl.expected.wgsl b/test/tint/shader_io/compute_input_mixed.wgsl.expected.wgsl index b84448ab22..9368e0978e 100644 --- a/test/tint/shader_io/compute_input_mixed.wgsl.expected.wgsl +++ b/test/tint/shader_io/compute_input_mixed.wgsl.expected.wgsl @@ -8,7 +8,7 @@ struct ComputeInputs1 { workgroup_id : vec3, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main(inputs0 : ComputeInputs0, @builtin(local_invocation_index) local_invocation_index : u32, @builtin(global_invocation_id) global_invocation_id : vec3, inputs1 : ComputeInputs1) { let foo : u32 = (((inputs0.local_invocation_id.x + local_invocation_index) + global_invocation_id.x) + inputs1.workgroup_id.x); } diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl b/test/tint/shader_io/compute_workgroup_expression.wgsl new file mode 100644 index 0000000000..a465a76db3 --- /dev/null +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl @@ -0,0 +1,7 @@ +@id(0) override x_dim = 2; + +@compute +@workgroup_size(1 + 2, x_dim, clamp((1 - 2) + 4, 0, 5)) +fn main() { +} + diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.dxc.hlsl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2098cb3336 --- /dev/null +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +#ifndef WGSL_SPEC_CONSTANT_0 +#define WGSL_SPEC_CONSTANT_0 2 +#endif +static const int x_dim = WGSL_SPEC_CONSTANT_0; + +[numthreads(3, WGSL_SPEC_CONSTANT_0, 3)] +void main() { + return; +} diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.fxc.hlsl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2098cb3336 --- /dev/null +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +#ifndef WGSL_SPEC_CONSTANT_0 +#define WGSL_SPEC_CONSTANT_0 2 +#endif +static const int x_dim = WGSL_SPEC_CONSTANT_0; + +[numthreads(3, WGSL_SPEC_CONSTANT_0, 3)] +void main() { + return; +} diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.glsl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.glsl new file mode 100644 index 0000000000..6ac96fa4aa --- /dev/null +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es + +#ifndef WGSL_SPEC_CONSTANT_0 +#define WGSL_SPEC_CONSTANT_0 2 +#endif +const int x_dim = WGSL_SPEC_CONSTANT_0; +void tint_symbol() { +} + +layout(local_size_x = 3, local_size_y = WGSL_SPEC_CONSTANT_0, local_size_z = 3) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.msl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.msl new file mode 100644 index 0000000000..d9f2428573 --- /dev/null +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +constant int x_dim [[function_constant(0)]]; + +kernel void tint_symbol() { + return; +} + diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.spvasm b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.spvasm new file mode 100644 index 0000000000..bcd4536dbf --- /dev/null +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 12 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpName %x_dim "x_dim" + OpName %main "main" + OpDecorate %x_dim SpecId 0 + OpDecorate %11 SpecId 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %int = OpTypeInt 32 1 + %x_dim = OpSpecConstant %int 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_3 = OpConstant %uint 3 + %11 = OpSpecConstant %uint 2 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %uint_3 %11 %uint_3 + %main = OpFunction %void None %3 + %6 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.wgsl b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2b260b2f0 --- /dev/null +++ b/test/tint/shader_io/compute_workgroup_expression.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +@id(0) override x_dim = 2; + +@compute @workgroup_size((1 + 2), x_dim, clamp(((1 - 2) + 4), 0, 5)) +fn main() { +} diff --git a/test/tint/shader_io/fragment_input_builtins.wgsl b/test/tint/shader_io/fragment_input_builtins.wgsl index db717eb8e4..5e4acd4e6c 100644 --- a/test/tint/shader_io/fragment_input_builtins.wgsl +++ b/test/tint/shader_io/fragment_input_builtins.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn main( @builtin(position) position : vec4, @builtin(front_facing) front_facing : bool, diff --git a/test/tint/shader_io/fragment_input_builtins.wgsl.expected.hlsl b/test/tint/shader_io/fragment_input_builtins.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_input_builtins.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_input_builtins.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_input_builtins.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_input_builtins.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc5f201352 --- /dev/null +++ b/test/tint/shader_io/fragment_input_builtins.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +struct tint_symbol_1 { + float4 position : SV_Position; + bool front_facing : SV_IsFrontFace; + uint sample_index : SV_SampleIndex; + uint sample_mask : SV_Coverage; +}; + +void main_inner(float4 position, bool front_facing, uint sample_index, uint sample_mask) { + if (front_facing) { + const float4 foo = position; + const uint bar = (sample_index + sample_mask); + } +} + +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.position, tint_symbol.front_facing, tint_symbol.sample_index, tint_symbol.sample_mask); + return; +} diff --git a/test/tint/shader_io/fragment_input_builtins.wgsl.expected.spvasm b/test/tint/shader_io/fragment_input_builtins.wgsl.expected.spvasm index daf288b9b5..d0f643a31c 100644 --- a/test/tint/shader_io/fragment_input_builtins.wgsl.expected.spvasm +++ b/test/tint/shader_io/fragment_input_builtins.wgsl.expected.spvasm @@ -21,8 +21,10 @@ OpDecorate %position_1 BuiltIn FragCoord OpDecorate %front_facing_1 BuiltIn FrontFacing OpDecorate %sample_index_1 BuiltIn SampleId + OpDecorate %sample_index_1 Flat OpDecorate %_arr_uint_uint_1 ArrayStride 4 OpDecorate %sample_mask_1 BuiltIn SampleMask + OpDecorate %sample_mask_1 Flat %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %_ptr_Input_v4float = OpTypePointer Input %v4float @@ -41,7 +43,7 @@ %15 = OpTypeFunction %void %v4float %bool %uint %uint %26 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %34 = OpConstantNull %int %main_inner = OpFunction %void None %15 %position = OpFunctionParameter %v4float %front_facing = OpFunctionParameter %bool @@ -61,7 +63,7 @@ %30 = OpLoad %v4float %position_1 %31 = OpLoad %bool %front_facing_1 %32 = OpLoad %uint %sample_index_1 - %35 = OpAccessChain %_ptr_Input_uint %sample_mask_1 %int_0 + %35 = OpAccessChain %_ptr_Input_uint %sample_mask_1 %34 %36 = OpLoad %uint %35 %29 = OpFunctionCall %void %main_inner %30 %31 %32 %36 OpReturn diff --git a/test/tint/shader_io/fragment_input_builtins.wgsl.expected.wgsl b/test/tint/shader_io/fragment_input_builtins.wgsl.expected.wgsl index 92dfb414b3..d2bd785b74 100644 --- a/test/tint/shader_io/fragment_input_builtins.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_input_builtins.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn main(@builtin(position) position : vec4, @builtin(front_facing) front_facing : bool, @builtin(sample_index) sample_index : u32, @builtin(sample_mask) sample_mask : u32) { if (front_facing) { let foo : vec4 = position; diff --git a/test/tint/shader_io/fragment_input_builtins_struct.wgsl b/test/tint/shader_io/fragment_input_builtins_struct.wgsl index abaa641dd6..e05a5225a9 100644 --- a/test/tint/shader_io/fragment_input_builtins_struct.wgsl +++ b/test/tint/shader_io/fragment_input_builtins_struct.wgsl @@ -5,7 +5,7 @@ struct FragmentInputs { @builtin(sample_mask) sample_mask : u32, }; -@stage(fragment) +@fragment fn main(inputs : FragmentInputs) { if (inputs.front_facing) { let foo : vec4 = inputs.position; diff --git a/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.hlsl b/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6f38a1f522 --- /dev/null +++ b/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +struct FragmentInputs { + float4 position; + bool front_facing; + uint sample_index; + uint sample_mask; +}; +struct tint_symbol_1 { + float4 position : SV_Position; + bool front_facing : SV_IsFrontFace; + uint sample_index : SV_SampleIndex; + uint sample_mask : SV_Coverage; +}; + +void main_inner(FragmentInputs inputs) { + if (inputs.front_facing) { + const float4 foo = inputs.position; + const uint bar = (inputs.sample_index + inputs.sample_mask); + } +} + +void main(tint_symbol_1 tint_symbol) { + const FragmentInputs tint_symbol_2 = {tint_symbol.position, tint_symbol.front_facing, tint_symbol.sample_index, tint_symbol.sample_mask}; + main_inner(tint_symbol_2); + return; +} diff --git a/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.spvasm b/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.spvasm index a826ffb185..ad2c294f87 100644 --- a/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.spvasm +++ b/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.spvasm @@ -23,8 +23,10 @@ OpDecorate %position_1 BuiltIn FragCoord OpDecorate %front_facing_1 BuiltIn FrontFacing OpDecorate %sample_index_1 BuiltIn SampleId + OpDecorate %sample_index_1 Flat OpDecorate %_arr_uint_uint_1 ArrayStride 4 OpDecorate %sample_mask_1 BuiltIn SampleMask + OpDecorate %sample_mask_1 Flat OpMemberDecorate %FragmentInputs 0 Offset 0 OpMemberDecorate %FragmentInputs 1 Offset 16 OpMemberDecorate %FragmentInputs 2 Offset 20 @@ -48,7 +50,7 @@ %15 = OpTypeFunction %void %FragmentInputs %28 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %36 = OpConstantNull %int %main_inner = OpFunction %void None %15 %inputs = OpFunctionParameter %FragmentInputs %20 = OpLabel @@ -69,7 +71,7 @@ %32 = OpLoad %v4float %position_1 %33 = OpLoad %bool %front_facing_1 %34 = OpLoad %uint %sample_index_1 - %37 = OpAccessChain %_ptr_Input_uint %sample_mask_1 %int_0 + %37 = OpAccessChain %_ptr_Input_uint %sample_mask_1 %36 %38 = OpLoad %uint %37 %39 = OpCompositeConstruct %FragmentInputs %32 %33 %34 %38 %31 = OpFunctionCall %void %main_inner %39 diff --git a/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.wgsl b/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.wgsl index 2084cac303..157c2e2f35 100644 --- a/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_input_builtins_struct.wgsl.expected.wgsl @@ -9,7 +9,7 @@ struct FragmentInputs { sample_mask : u32, } -@stage(fragment) +@fragment fn main(inputs : FragmentInputs) { if (inputs.front_facing) { let foo : vec4 = inputs.position; diff --git a/test/tint/shader_io/fragment_input_locations.wgsl b/test/tint/shader_io/fragment_input_locations.wgsl index b33cfe4d8c..117c697ef3 100644 --- a/test/tint/shader_io/fragment_input_locations.wgsl +++ b/test/tint/shader_io/fragment_input_locations.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn main( @location(0) @interpolate(flat) loc0 : i32, @location(1) @interpolate(flat) loc1 : u32, diff --git a/test/tint/shader_io/fragment_input_locations.wgsl.expected.hlsl b/test/tint/shader_io/fragment_input_locations.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_input_locations.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_input_locations.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_input_locations.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_input_locations.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e54969e790 --- /dev/null +++ b/test/tint/shader_io/fragment_input_locations.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +struct tint_symbol_1 { + nointerpolation int loc0 : TEXCOORD0; + nointerpolation uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; +}; + +void main_inner(int loc0, uint loc1, float loc2, float4 loc3) { + const int i = loc0; + const uint u = loc1; + const float f = loc2; + const float4 v = loc3; +} + +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.loc0, tint_symbol.loc1, tint_symbol.loc2, tint_symbol.loc3); + return; +} diff --git a/test/tint/shader_io/fragment_input_locations.wgsl.expected.wgsl b/test/tint/shader_io/fragment_input_locations.wgsl.expected.wgsl index a4cd5026ca..15cf856ae8 100644 --- a/test/tint/shader_io/fragment_input_locations.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_input_locations.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn main(@location(0) @interpolate(flat) loc0 : i32, @location(1) @interpolate(flat) loc1 : u32, @location(2) loc2 : f32, @location(3) loc3 : vec4) { let i : i32 = loc0; let u : u32 = loc1; diff --git a/test/tint/shader_io/fragment_input_locations_struct.wgsl b/test/tint/shader_io/fragment_input_locations_struct.wgsl index 50fb1f7e34..fe3bd0622c 100644 --- a/test/tint/shader_io/fragment_input_locations_struct.wgsl +++ b/test/tint/shader_io/fragment_input_locations_struct.wgsl @@ -5,7 +5,7 @@ struct FragmentInputs { @location(3) loc3 : vec4, }; -@stage(fragment) +@fragment fn main(inputs : FragmentInputs) { let i : i32 = inputs.loc0; let u : u32 = inputs.loc1; diff --git a/test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.hlsl b/test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9564509300 --- /dev/null +++ b/test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +struct FragmentInputs { + int loc0; + uint loc1; + float loc2; + float4 loc3; +}; +struct tint_symbol_1 { + nointerpolation int loc0 : TEXCOORD0; + nointerpolation uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; +}; + +void main_inner(FragmentInputs inputs) { + const int i = inputs.loc0; + const uint u = inputs.loc1; + const float f = inputs.loc2; + const float4 v = inputs.loc3; +} + +void main(tint_symbol_1 tint_symbol) { + const FragmentInputs tint_symbol_2 = {tint_symbol.loc0, tint_symbol.loc1, tint_symbol.loc2, tint_symbol.loc3}; + main_inner(tint_symbol_2); + return; +} diff --git a/test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.wgsl b/test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.wgsl index 4cbe8003cb..fc508cee33 100644 --- a/test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_input_locations_struct.wgsl.expected.wgsl @@ -9,7 +9,7 @@ struct FragmentInputs { loc3 : vec4, } -@stage(fragment) +@fragment fn main(inputs : FragmentInputs) { let i : i32 = inputs.loc0; let u : u32 = inputs.loc1; diff --git a/test/tint/shader_io/fragment_input_mixed.wgsl b/test/tint/shader_io/fragment_input_mixed.wgsl index 8a8c8e26d6..1fb20a76a6 100644 --- a/test/tint/shader_io/fragment_input_mixed.wgsl +++ b/test/tint/shader_io/fragment_input_mixed.wgsl @@ -7,7 +7,7 @@ struct FragmentInputs1 { @builtin(sample_mask) sample_mask : u32, }; -@stage(fragment) +@fragment fn main( inputs0 : FragmentInputs0, @builtin(front_facing) front_facing : bool, diff --git a/test/tint/shader_io/fragment_input_mixed.wgsl.expected.hlsl b/test/tint/shader_io/fragment_input_mixed.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_input_mixed.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_input_mixed.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_input_mixed.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_input_mixed.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1d9d587817 --- /dev/null +++ b/test/tint/shader_io/fragment_input_mixed.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +struct FragmentInputs0 { + float4 position; + int loc0; +}; +struct FragmentInputs1 { + float4 loc3; + uint sample_mask; +}; +struct tint_symbol_1 { + nointerpolation int loc0 : TEXCOORD0; + nointerpolation uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; + float4 position : SV_Position; + bool front_facing : SV_IsFrontFace; + uint sample_index : SV_SampleIndex; + uint sample_mask : SV_Coverage; +}; + +void main_inner(FragmentInputs0 inputs0, bool front_facing, uint loc1, uint sample_index, FragmentInputs1 inputs1, float loc2) { + if (front_facing) { + const float4 foo = inputs0.position; + const uint bar = (sample_index + inputs1.sample_mask); + const int i = inputs0.loc0; + const uint u = loc1; + const float f = loc2; + const float4 v = inputs1.loc3; + } +} + +void main(tint_symbol_1 tint_symbol) { + const FragmentInputs0 tint_symbol_2 = {tint_symbol.position, tint_symbol.loc0}; + const FragmentInputs1 tint_symbol_3 = {tint_symbol.loc3, tint_symbol.sample_mask}; + main_inner(tint_symbol_2, tint_symbol.front_facing, tint_symbol.loc1, tint_symbol.sample_index, tint_symbol_3, tint_symbol.loc2); + return; +} diff --git a/test/tint/shader_io/fragment_input_mixed.wgsl.expected.spvasm b/test/tint/shader_io/fragment_input_mixed.wgsl.expected.spvasm index d312bcf427..55a00e215e 100644 --- a/test/tint/shader_io/fragment_input_mixed.wgsl.expected.spvasm +++ b/test/tint/shader_io/fragment_input_mixed.wgsl.expected.spvasm @@ -37,9 +37,11 @@ OpDecorate %loc1_1 Location 1 OpDecorate %loc1_1 Flat OpDecorate %sample_index_1 BuiltIn SampleId + OpDecorate %sample_index_1 Flat OpDecorate %loc3_1 Location 3 OpDecorate %_arr_uint_uint_1 ArrayStride 4 OpDecorate %sample_mask_1 BuiltIn SampleMask + OpDecorate %sample_mask_1 Flat OpDecorate %loc2_1 Location 2 OpMemberDecorate %FragmentInputs0 0 Offset 0 OpMemberDecorate %FragmentInputs0 1 Offset 16 @@ -71,7 +73,7 @@ %FragmentInputs1 = OpTypeStruct %v4float %uint %22 = OpTypeFunction %void %FragmentInputs0 %bool %uint %uint %FragmentInputs1 %float %41 = OpTypeFunction %void - %int_0 = OpConstant %int 0 + %52 = OpConstantNull %int %main_inner = OpFunction %void None %22 %inputs0 = OpFunctionParameter %FragmentInputs0 %front_facing = OpFunctionParameter %bool @@ -101,7 +103,7 @@ %49 = OpLoad %uint %loc1_1 %50 = OpLoad %uint %sample_index_1 %51 = OpLoad %v4float %loc3_1 - %53 = OpAccessChain %_ptr_Input_uint %sample_mask_1 %int_0 + %53 = OpAccessChain %_ptr_Input_uint %sample_mask_1 %52 %54 = OpLoad %uint %53 %55 = OpCompositeConstruct %FragmentInputs1 %51 %54 %56 = OpLoad %float %loc2_1 diff --git a/test/tint/shader_io/fragment_input_mixed.wgsl.expected.wgsl b/test/tint/shader_io/fragment_input_mixed.wgsl.expected.wgsl index 1734452fbb..8625a412f8 100644 --- a/test/tint/shader_io/fragment_input_mixed.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_input_mixed.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct FragmentInputs1 { sample_mask : u32, } -@stage(fragment) +@fragment fn main(inputs0 : FragmentInputs0, @builtin(front_facing) front_facing : bool, @location(1) @interpolate(flat) loc1 : u32, @builtin(sample_index) sample_index : u32, inputs1 : FragmentInputs1, @location(2) loc2 : f32) { if (front_facing) { let foo : vec4 = inputs0.position; diff --git a/test/tint/shader_io/fragment_output_builtins.wgsl b/test/tint/shader_io/fragment_output_builtins.wgsl index 914cbad9e3..4dd4d68aeb 100644 --- a/test/tint/shader_io/fragment_output_builtins.wgsl +++ b/test/tint/shader_io/fragment_output_builtins.wgsl @@ -1,9 +1,9 @@ -@stage(fragment) +@fragment fn main1() -> @builtin(frag_depth) f32 { return 1.0; } -@stage(fragment) +@fragment fn main2() -> @builtin(sample_mask) u32 { return 1u; } diff --git a/test/tint/shader_io/fragment_output_builtins.wgsl.expected.hlsl b/test/tint/shader_io/fragment_output_builtins.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_output_builtins.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_output_builtins.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_output_builtins.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_output_builtins.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2b972d7ab4 --- /dev/null +++ b/test/tint/shader_io/fragment_output_builtins.wgsl.expected.fxc.hlsl @@ -0,0 +1,29 @@ +struct tint_symbol { + float value : SV_Depth; +}; + +float main1_inner() { + return 1.0f; +} + +tint_symbol main1() { + const float inner_result = main1_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +struct tint_symbol_1 { + uint value : SV_Coverage; +}; + +uint main2_inner() { + return 1u; +} + +tint_symbol_1 main2() { + const uint inner_result_1 = main2_inner(); + tint_symbol_1 wrapper_result_1 = (tint_symbol_1)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} diff --git a/test/tint/shader_io/fragment_output_builtins.wgsl.expected.spvasm b/test/tint/shader_io/fragment_output_builtins.wgsl.expected.spvasm index 7eb37e0c66..02663d13b6 100644 --- a/test/tint/shader_io/fragment_output_builtins.wgsl.expected.spvasm +++ b/test/tint/shader_io/fragment_output_builtins.wgsl.expected.spvasm @@ -35,7 +35,7 @@ %15 = OpTypeFunction %void %20 = OpTypeFunction %uint %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %27 = OpConstantNull %int %_ptr_Output_uint = OpTypePointer Output %uint %main1_inner = OpFunction %float None %11 %13 = OpLabel @@ -54,7 +54,7 @@ %main2 = OpFunction %void None %15 %24 = OpLabel %25 = OpFunctionCall %uint %main2_inner - %29 = OpAccessChain %_ptr_Output_uint %value_1 %int_0 + %29 = OpAccessChain %_ptr_Output_uint %value_1 %27 OpStore %29 %25 OpReturn OpFunctionEnd diff --git a/test/tint/shader_io/fragment_output_builtins.wgsl.expected.wgsl b/test/tint/shader_io/fragment_output_builtins.wgsl.expected.wgsl index 914cbad9e3..4dd4d68aeb 100644 --- a/test/tint/shader_io/fragment_output_builtins.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_output_builtins.wgsl.expected.wgsl @@ -1,9 +1,9 @@ -@stage(fragment) +@fragment fn main1() -> @builtin(frag_depth) f32 { return 1.0; } -@stage(fragment) +@fragment fn main2() -> @builtin(sample_mask) u32 { return 1u; } diff --git a/test/tint/shader_io/fragment_output_builtins_struct.wgsl b/test/tint/shader_io/fragment_output_builtins_struct.wgsl index 8ef212d0e3..117859c042 100644 --- a/test/tint/shader_io/fragment_output_builtins_struct.wgsl +++ b/test/tint/shader_io/fragment_output_builtins_struct.wgsl @@ -3,7 +3,7 @@ struct FragmentOutputs { @builtin(sample_mask) sample_mask : u32, }; -@stage(fragment) +@fragment fn main() -> FragmentOutputs { return FragmentOutputs(1.0, 1u); } diff --git a/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.hlsl b/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d2e660ee7 --- /dev/null +++ b/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +struct FragmentOutputs { + float frag_depth; + uint sample_mask; +}; +struct tint_symbol { + float frag_depth : SV_Depth; + uint sample_mask : SV_Coverage; +}; + +FragmentOutputs main_inner() { + const FragmentOutputs tint_symbol_1 = {1.0f, 1u}; + return tint_symbol_1; +} + +tint_symbol main() { + const FragmentOutputs inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.frag_depth = inner_result.frag_depth; + wrapper_result.sample_mask = inner_result.sample_mask; + return wrapper_result; +} diff --git a/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.msl b/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.msl index c30a67d1be..925415a171 100644 --- a/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.msl +++ b/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.msl @@ -12,7 +12,7 @@ struct tint_symbol_1 { }; FragmentOutputs tint_symbol_inner() { - FragmentOutputs const tint_symbol_2 = {.frag_depth=1.0f, .sample_mask=1u}; + FragmentOutputs const tint_symbol_2 = FragmentOutputs{.frag_depth=1.0f, .sample_mask=1u}; return tint_symbol_2; } diff --git a/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.spvasm b/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.spvasm index b43155135e..6850a788fb 100644 --- a/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.spvasm +++ b/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.spvasm @@ -37,7 +37,7 @@ %void = OpTypeVoid %17 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %24 = OpConstantNull %int %_ptr_Output_uint = OpTypePointer Output %uint %main_inner = OpFunction %FragmentOutputs None %11 %14 = OpLabel @@ -48,7 +48,7 @@ %21 = OpFunctionCall %FragmentOutputs %main_inner %22 = OpCompositeExtract %float %21 0 OpStore %frag_depth_1 %22 - %26 = OpAccessChain %_ptr_Output_uint %sample_mask_1 %int_0 + %26 = OpAccessChain %_ptr_Output_uint %sample_mask_1 %24 %27 = OpCompositeExtract %uint %21 1 OpStore %26 %27 OpReturn diff --git a/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.wgsl b/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.wgsl index 500a094b45..b81cf4788a 100644 --- a/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_output_builtins_struct.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct FragmentOutputs { sample_mask : u32, } -@stage(fragment) +@fragment fn main() -> FragmentOutputs { return FragmentOutputs(1.0, 1u); } diff --git a/test/tint/shader_io/fragment_output_locations.wgsl b/test/tint/shader_io/fragment_output_locations.wgsl index 239589d57d..632fc4249e 100644 --- a/test/tint/shader_io/fragment_output_locations.wgsl +++ b/test/tint/shader_io/fragment_output_locations.wgsl @@ -1,19 +1,19 @@ -@stage(fragment) +@fragment fn main0() -> @location(0) i32 { return 1; } -@stage(fragment) +@fragment fn main1() -> @location(1) u32 { return 1u; } -@stage(fragment) +@fragment fn main2() -> @location(2) f32 { return 1.0; } -@stage(fragment) +@fragment fn main3() -> @location(3) vec4 { return vec4(1.0, 2.0, 3.0, 4.0); } diff --git a/test/tint/shader_io/fragment_output_locations.wgsl.expected.hlsl b/test/tint/shader_io/fragment_output_locations.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_output_locations.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_output_locations.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_output_locations.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_output_locations.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0a9e48f125 --- /dev/null +++ b/test/tint/shader_io/fragment_output_locations.wgsl.expected.fxc.hlsl @@ -0,0 +1,59 @@ +struct tint_symbol { + int value : SV_Target0; +}; + +int main0_inner() { + return 1; +} + +tint_symbol main0() { + const int inner_result = main0_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +struct tint_symbol_1 { + uint value : SV_Target1; +}; + +uint main1_inner() { + return 1u; +} + +tint_symbol_1 main1() { + const uint inner_result_1 = main1_inner(); + tint_symbol_1 wrapper_result_1 = (tint_symbol_1)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} + +struct tint_symbol_2 { + float value : SV_Target2; +}; + +float main2_inner() { + return 1.0f; +} + +tint_symbol_2 main2() { + const float inner_result_2 = main2_inner(); + tint_symbol_2 wrapper_result_2 = (tint_symbol_2)0; + wrapper_result_2.value = inner_result_2; + return wrapper_result_2; +} + +struct tint_symbol_3 { + float4 value : SV_Target3; +}; + +float4 main3_inner() { + return float4(1.0f, 2.0f, 3.0f, 4.0f); +} + +tint_symbol_3 main3() { + const float4 inner_result_3 = main3_inner(); + tint_symbol_3 wrapper_result_3 = (tint_symbol_3)0; + wrapper_result_3.value = inner_result_3; + return wrapper_result_3; +} diff --git a/test/tint/shader_io/fragment_output_locations.wgsl.expected.wgsl b/test/tint/shader_io/fragment_output_locations.wgsl.expected.wgsl index 239589d57d..632fc4249e 100644 --- a/test/tint/shader_io/fragment_output_locations.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_output_locations.wgsl.expected.wgsl @@ -1,19 +1,19 @@ -@stage(fragment) +@fragment fn main0() -> @location(0) i32 { return 1; } -@stage(fragment) +@fragment fn main1() -> @location(1) u32 { return 1u; } -@stage(fragment) +@fragment fn main2() -> @location(2) f32 { return 1.0; } -@stage(fragment) +@fragment fn main3() -> @location(3) vec4 { return vec4(1.0, 2.0, 3.0, 4.0); } diff --git a/test/tint/shader_io/fragment_output_locations_struct.wgsl b/test/tint/shader_io/fragment_output_locations_struct.wgsl index 440a4ad901..5d51299bb5 100644 --- a/test/tint/shader_io/fragment_output_locations_struct.wgsl +++ b/test/tint/shader_io/fragment_output_locations_struct.wgsl @@ -5,7 +5,7 @@ struct FragmentOutputs { @location(3) loc3 : vec4, }; -@stage(fragment) +@fragment fn main() -> FragmentOutputs { return FragmentOutputs(1, 1u, 1.0, vec4(1.0, 2.0, 3.0, 4.0)); } diff --git a/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.hlsl b/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..09216c3bd6 --- /dev/null +++ b/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +struct FragmentOutputs { + int loc0; + uint loc1; + float loc2; + float4 loc3; +}; +struct tint_symbol { + int loc0 : SV_Target0; + uint loc1 : SV_Target1; + float loc2 : SV_Target2; + float4 loc3 : SV_Target3; +}; + +FragmentOutputs main_inner() { + const FragmentOutputs tint_symbol_1 = {1, 1u, 1.0f, float4(1.0f, 2.0f, 3.0f, 4.0f)}; + return tint_symbol_1; +} + +tint_symbol main() { + const FragmentOutputs inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.loc0 = inner_result.loc0; + wrapper_result.loc1 = inner_result.loc1; + wrapper_result.loc2 = inner_result.loc2; + wrapper_result.loc3 = inner_result.loc3; + return wrapper_result; +} diff --git a/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.msl b/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.msl index 1cf0682166..8a867325b4 100644 --- a/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.msl +++ b/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.msl @@ -16,7 +16,7 @@ struct tint_symbol_1 { }; FragmentOutputs tint_symbol_inner() { - FragmentOutputs const tint_symbol_2 = {.loc0=1, .loc1=1u, .loc2=1.0f, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f)}; + FragmentOutputs const tint_symbol_2 = FragmentOutputs{.loc0=1, .loc1=1u, .loc2=1.0f, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f)}; return tint_symbol_2; } diff --git a/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.wgsl b/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.wgsl index b1eee07f85..0ec8340493 100644 --- a/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_output_locations_struct.wgsl.expected.wgsl @@ -9,7 +9,7 @@ struct FragmentOutputs { loc3 : vec4, } -@stage(fragment) +@fragment fn main() -> FragmentOutputs { return FragmentOutputs(1, 1u, 1.0, vec4(1.0, 2.0, 3.0, 4.0)); } diff --git a/test/tint/shader_io/fragment_output_mixed.wgsl b/test/tint/shader_io/fragment_output_mixed.wgsl index 49180ffba7..80af48dacc 100644 --- a/test/tint/shader_io/fragment_output_mixed.wgsl +++ b/test/tint/shader_io/fragment_output_mixed.wgsl @@ -7,7 +7,7 @@ struct FragmentOutputs { @location(3) loc3 : vec4, }; -@stage(fragment) +@fragment fn main() -> FragmentOutputs { return FragmentOutputs(1, 2.0, 1u, 1.0, 2u, vec4(1.0, 2.0, 3.0, 4.0)); } diff --git a/test/tint/shader_io/fragment_output_mixed.wgsl.expected.hlsl b/test/tint/shader_io/fragment_output_mixed.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/fragment_output_mixed.wgsl.expected.hlsl rename to test/tint/shader_io/fragment_output_mixed.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/fragment_output_mixed.wgsl.expected.fxc.hlsl b/test/tint/shader_io/fragment_output_mixed.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..86588758d6 --- /dev/null +++ b/test/tint/shader_io/fragment_output_mixed.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +struct FragmentOutputs { + int loc0; + float frag_depth; + uint loc1; + float loc2; + uint sample_mask; + float4 loc3; +}; +struct tint_symbol { + int loc0 : SV_Target0; + uint loc1 : SV_Target1; + float loc2 : SV_Target2; + float4 loc3 : SV_Target3; + float frag_depth : SV_Depth; + uint sample_mask : SV_Coverage; +}; + +FragmentOutputs main_inner() { + const FragmentOutputs tint_symbol_1 = {1, 2.0f, 1u, 1.0f, 2u, float4(1.0f, 2.0f, 3.0f, 4.0f)}; + return tint_symbol_1; +} + +tint_symbol main() { + const FragmentOutputs inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.loc0 = inner_result.loc0; + wrapper_result.frag_depth = inner_result.frag_depth; + wrapper_result.loc1 = inner_result.loc1; + wrapper_result.loc2 = inner_result.loc2; + wrapper_result.sample_mask = inner_result.sample_mask; + wrapper_result.loc3 = inner_result.loc3; + return wrapper_result; +} diff --git a/test/tint/shader_io/fragment_output_mixed.wgsl.expected.msl b/test/tint/shader_io/fragment_output_mixed.wgsl.expected.msl index 591468cd10..1fa106171c 100644 --- a/test/tint/shader_io/fragment_output_mixed.wgsl.expected.msl +++ b/test/tint/shader_io/fragment_output_mixed.wgsl.expected.msl @@ -20,7 +20,7 @@ struct tint_symbol_1 { }; FragmentOutputs tint_symbol_inner() { - FragmentOutputs const tint_symbol_2 = {.loc0=1, .frag_depth=2.0f, .loc1=1u, .loc2=1.0f, .sample_mask=2u, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f)}; + FragmentOutputs const tint_symbol_2 = FragmentOutputs{.loc0=1, .frag_depth=2.0f, .loc1=1u, .loc2=1.0f, .sample_mask=2u, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f)}; return tint_symbol_2; } diff --git a/test/tint/shader_io/fragment_output_mixed.wgsl.expected.spvasm b/test/tint/shader_io/fragment_output_mixed.wgsl.expected.spvasm index 4002fe6fc3..897421e0e1 100644 --- a/test/tint/shader_io/fragment_output_mixed.wgsl.expected.spvasm +++ b/test/tint/shader_io/fragment_output_mixed.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 48 +; Bound: 47 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -70,7 +70,6 @@ %34 = OpConstantComposite %FragmentOutputs %int_1 %float_2 %uint_1 %float_1 %uint_2 %33 %void = OpTypeVoid %35 = OpTypeFunction %void - %int_0 = OpConstant %int 0 %main_inner = OpFunction %FragmentOutputs None %23 %26 = OpLabel OpReturnValue %34 @@ -86,10 +85,10 @@ OpStore %loc1_1 %42 %43 = OpCompositeExtract %float %39 3 OpStore %loc2_1 %43 - %45 = OpAccessChain %_ptr_Output_uint %sample_mask_1 %int_0 - %46 = OpCompositeExtract %uint %39 4 - OpStore %45 %46 - %47 = OpCompositeExtract %v4float %39 5 - OpStore %loc3_1 %47 + %44 = OpAccessChain %_ptr_Output_uint %sample_mask_1 %4 + %45 = OpCompositeExtract %uint %39 4 + OpStore %44 %45 + %46 = OpCompositeExtract %v4float %39 5 + OpStore %loc3_1 %46 OpReturn OpFunctionEnd diff --git a/test/tint/shader_io/fragment_output_mixed.wgsl.expected.wgsl b/test/tint/shader_io/fragment_output_mixed.wgsl.expected.wgsl index b622a1657d..0177394e22 100644 --- a/test/tint/shader_io/fragment_output_mixed.wgsl.expected.wgsl +++ b/test/tint/shader_io/fragment_output_mixed.wgsl.expected.wgsl @@ -13,7 +13,7 @@ struct FragmentOutputs { loc3 : vec4, } -@stage(fragment) +@fragment fn main() -> FragmentOutputs { return FragmentOutputs(1, 2.0, 1u, 1.0, 2u, vec4(1.0, 2.0, 3.0, 4.0)); } diff --git a/test/tint/shader_io/interpolate_input_parameters.wgsl b/test/tint/shader_io/interpolate_input_parameters.wgsl index 3e350ea55a..599fe9c883 100644 --- a/test/tint/shader_io/interpolate_input_parameters.wgsl +++ b/test/tint/shader_io/interpolate_input_parameters.wgsl @@ -1,4 +1,4 @@ -@stage(fragment) +@fragment fn main( @location(0) none : f32, @location(1) @interpolate(flat) flat : f32, diff --git a/test/tint/shader_io/interpolate_input_parameters.wgsl.expected.hlsl b/test/tint/shader_io/interpolate_input_parameters.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/interpolate_input_parameters.wgsl.expected.hlsl rename to test/tint/shader_io/interpolate_input_parameters.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/interpolate_input_parameters.wgsl.expected.fxc.hlsl b/test/tint/shader_io/interpolate_input_parameters.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bb78da9482 --- /dev/null +++ b/test/tint/shader_io/interpolate_input_parameters.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +struct tint_symbol_1 { + float none : TEXCOORD0; + nointerpolation float flat : TEXCOORD1; + linear float perspective_center : TEXCOORD2; + linear centroid float perspective_centroid : TEXCOORD3; + linear sample float perspective_sample : TEXCOORD4; + noperspective float linear_center : TEXCOORD5; + noperspective centroid float linear_centroid : TEXCOORD6; + noperspective sample float linear_sample : TEXCOORD7; +}; + +void main_inner(float none, float flat, float perspective_center, float perspective_centroid, float perspective_sample, float linear_center, float linear_centroid, float linear_sample) { +} + +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.none, tint_symbol.flat, tint_symbol.perspective_center, tint_symbol.perspective_centroid, tint_symbol.perspective_sample, tint_symbol.linear_center, tint_symbol.linear_centroid, tint_symbol.linear_sample); + return; +} diff --git a/test/tint/shader_io/interpolate_input_parameters.wgsl.expected.wgsl b/test/tint/shader_io/interpolate_input_parameters.wgsl.expected.wgsl index 8dbd5b19ed..df06a212c2 100644 --- a/test/tint/shader_io/interpolate_input_parameters.wgsl.expected.wgsl +++ b/test/tint/shader_io/interpolate_input_parameters.wgsl.expected.wgsl @@ -1,3 +1,3 @@ -@stage(fragment) +@fragment fn main(@location(0) none : f32, @location(1) @interpolate(flat) flat : f32, @location(2) @interpolate(perspective, center) perspective_center : f32, @location(3) @interpolate(perspective, centroid) perspective_centroid : f32, @location(4) @interpolate(perspective, sample) perspective_sample : f32, @location(5) @interpolate(linear, center) linear_center : f32, @location(6) @interpolate(linear, centroid) linear_centroid : f32, @location(7) @interpolate(linear, sample) linear_sample : f32) { } diff --git a/test/tint/shader_io/interpolate_input_struct.wgsl b/test/tint/shader_io/interpolate_input_struct.wgsl index 46546a4f70..93cfec8944 100644 --- a/test/tint/shader_io/interpolate_input_struct.wgsl +++ b/test/tint/shader_io/interpolate_input_struct.wgsl @@ -9,6 +9,6 @@ struct In { @location(7) @interpolate(linear, sample) linear_sample : f32, }; -@stage(fragment) +@fragment fn main(in : In) { } diff --git a/test/tint/shader_io/interpolate_input_struct.wgsl.expected.hlsl b/test/tint/shader_io/interpolate_input_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/interpolate_input_struct.wgsl.expected.hlsl rename to test/tint/shader_io/interpolate_input_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/interpolate_input_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/interpolate_input_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cfc7acd02c --- /dev/null +++ b/test/tint/shader_io/interpolate_input_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,29 @@ +struct In { + float none; + float flat; + float perspective_center; + float perspective_centroid; + float perspective_sample; + float linear_center; + float linear_centroid; + float linear_sample; +}; +struct tint_symbol_2 { + float none : TEXCOORD0; + nointerpolation float flat : TEXCOORD1; + linear float perspective_center : TEXCOORD2; + linear centroid float perspective_centroid : TEXCOORD3; + linear sample float perspective_sample : TEXCOORD4; + noperspective float linear_center : TEXCOORD5; + noperspective centroid float linear_centroid : TEXCOORD6; + noperspective sample float linear_sample : TEXCOORD7; +}; + +void main_inner(In tint_symbol) { +} + +void main(tint_symbol_2 tint_symbol_1) { + const In tint_symbol_3 = {tint_symbol_1.none, tint_symbol_1.flat, tint_symbol_1.perspective_center, tint_symbol_1.perspective_centroid, tint_symbol_1.perspective_sample, tint_symbol_1.linear_center, tint_symbol_1.linear_centroid, tint_symbol_1.linear_sample}; + main_inner(tint_symbol_3); + return; +} diff --git a/test/tint/shader_io/interpolate_input_struct.wgsl.expected.wgsl b/test/tint/shader_io/interpolate_input_struct.wgsl.expected.wgsl index d1b2b5250d..d6f2f045dd 100644 --- a/test/tint/shader_io/interpolate_input_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/interpolate_input_struct.wgsl.expected.wgsl @@ -17,6 +17,6 @@ struct In { linear_sample : f32, } -@stage(fragment) +@fragment fn main(in : In) { } diff --git a/test/tint/shader_io/interpolate_integers.wgsl b/test/tint/shader_io/interpolate_integers.wgsl index 2d93727de7..bad4d854e2 100644 --- a/test/tint/shader_io/interpolate_integers.wgsl +++ b/test/tint/shader_io/interpolate_integers.wgsl @@ -6,12 +6,12 @@ struct Interface { @builtin(position) pos : vec4, }; -@stage(vertex) +@vertex fn vert_main() -> Interface { return Interface(); } -@stage(fragment) +@fragment fn frag_main(inputs : Interface) -> @location(0) i32 { return inputs.i; } diff --git a/test/tint/shader_io/interpolate_integers.wgsl.expected.hlsl b/test/tint/shader_io/interpolate_integers.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/interpolate_integers.wgsl.expected.hlsl rename to test/tint/shader_io/interpolate_integers.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/interpolate_integers.wgsl.expected.fxc.hlsl b/test/tint/shader_io/interpolate_integers.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..02c4f17941 --- /dev/null +++ b/test/tint/shader_io/interpolate_integers.wgsl.expected.fxc.hlsl @@ -0,0 +1,53 @@ +struct Interface { + int i; + uint u; + int4 vi; + uint4 vu; + float4 pos; +}; +struct tint_symbol { + nointerpolation int i : TEXCOORD0; + nointerpolation uint u : TEXCOORD1; + nointerpolation int4 vi : TEXCOORD2; + nointerpolation uint4 vu : TEXCOORD3; + float4 pos : SV_Position; +}; + +Interface vert_main_inner() { + const Interface tint_symbol_4 = (Interface)0; + return tint_symbol_4; +} + +tint_symbol vert_main() { + const Interface inner_result = vert_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.i = inner_result.i; + wrapper_result.u = inner_result.u; + wrapper_result.vi = inner_result.vi; + wrapper_result.vu = inner_result.vu; + wrapper_result.pos = inner_result.pos; + return wrapper_result; +} + +struct tint_symbol_2 { + nointerpolation int i : TEXCOORD0; + nointerpolation uint u : TEXCOORD1; + nointerpolation int4 vi : TEXCOORD2; + nointerpolation uint4 vu : TEXCOORD3; + float4 pos : SV_Position; +}; +struct tint_symbol_3 { + int value : SV_Target0; +}; + +int frag_main_inner(Interface inputs) { + return inputs.i; +} + +tint_symbol_3 frag_main(tint_symbol_2 tint_symbol_1) { + const Interface tint_symbol_5 = {tint_symbol_1.i, tint_symbol_1.u, tint_symbol_1.vi, tint_symbol_1.vu, tint_symbol_1.pos}; + const int inner_result_1 = frag_main_inner(tint_symbol_5); + tint_symbol_3 wrapper_result_1 = (tint_symbol_3)0; + wrapper_result_1.value = inner_result_1; + return wrapper_result_1; +} diff --git a/test/tint/shader_io/interpolate_integers.wgsl.expected.glsl b/test/tint/shader_io/interpolate_integers.wgsl.expected.glsl index c7c2312183..85155cfd48 100644 --- a/test/tint/shader_io/interpolate_integers.wgsl.expected.glsl +++ b/test/tint/shader_io/interpolate_integers.wgsl.expected.glsl @@ -13,7 +13,7 @@ struct Interface { }; Interface vert_main() { - Interface tint_symbol = Interface(0, 0u, ivec4(0, 0, 0, 0), uvec4(0u, 0u, 0u, 0u), vec4(0.0f, 0.0f, 0.0f, 0.0f)); + Interface tint_symbol = Interface(0, 0u, ivec4(0), uvec4(0u), vec4(0.0f)); return tint_symbol; } diff --git a/test/tint/shader_io/interpolate_integers.wgsl.expected.msl b/test/tint/shader_io/interpolate_integers.wgsl.expected.msl index 4a2e39e907..2bc52dbbea 100644 --- a/test/tint/shader_io/interpolate_integers.wgsl.expected.msl +++ b/test/tint/shader_io/interpolate_integers.wgsl.expected.msl @@ -18,7 +18,7 @@ struct tint_symbol { }; Interface vert_main_inner() { - Interface const tint_symbol_4 = {}; + Interface const tint_symbol_4 = Interface{}; return tint_symbol_4; } diff --git a/test/tint/shader_io/interpolate_integers.wgsl.expected.wgsl b/test/tint/shader_io/interpolate_integers.wgsl.expected.wgsl index 65f15f976a..fd38b42c42 100644 --- a/test/tint/shader_io/interpolate_integers.wgsl.expected.wgsl +++ b/test/tint/shader_io/interpolate_integers.wgsl.expected.wgsl @@ -11,12 +11,12 @@ struct Interface { pos : vec4, } -@stage(vertex) +@vertex fn vert_main() -> Interface { return Interface(); } -@stage(fragment) +@fragment fn frag_main(inputs : Interface) -> @location(0) i32 { return inputs.i; } diff --git a/test/tint/shader_io/interpolate_return_struct.wgsl b/test/tint/shader_io/interpolate_return_struct.wgsl index b5c67403ad..966d0b7718 100644 --- a/test/tint/shader_io/interpolate_return_struct.wgsl +++ b/test/tint/shader_io/interpolate_return_struct.wgsl @@ -10,7 +10,7 @@ struct Out { @location(7) @interpolate(linear, sample) linear_sample : f32, }; -@stage(vertex) +@vertex fn main() -> Out { return Out(); } diff --git a/test/tint/shader_io/interpolate_return_struct.wgsl.expected.hlsl b/test/tint/shader_io/interpolate_return_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/interpolate_return_struct.wgsl.expected.hlsl rename to test/tint/shader_io/interpolate_return_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/interpolate_return_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/interpolate_return_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..19290977db --- /dev/null +++ b/test/tint/shader_io/interpolate_return_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,42 @@ +struct Out { + float4 pos; + float none; + float flat; + float perspective_center; + float perspective_centroid; + float perspective_sample; + float linear_center; + float linear_centroid; + float linear_sample; +}; +struct tint_symbol { + float none : TEXCOORD0; + nointerpolation float flat : TEXCOORD1; + linear float perspective_center : TEXCOORD2; + linear centroid float perspective_centroid : TEXCOORD3; + linear sample float perspective_sample : TEXCOORD4; + noperspective float linear_center : TEXCOORD5; + noperspective centroid float linear_centroid : TEXCOORD6; + noperspective sample float linear_sample : TEXCOORD7; + float4 pos : SV_Position; +}; + +Out main_inner() { + const Out tint_symbol_1 = (Out)0; + return tint_symbol_1; +} + +tint_symbol main() { + const Out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.pos = inner_result.pos; + wrapper_result.none = inner_result.none; + wrapper_result.flat = inner_result.flat; + wrapper_result.perspective_center = inner_result.perspective_center; + wrapper_result.perspective_centroid = inner_result.perspective_centroid; + wrapper_result.perspective_sample = inner_result.perspective_sample; + wrapper_result.linear_center = inner_result.linear_center; + wrapper_result.linear_centroid = inner_result.linear_centroid; + wrapper_result.linear_sample = inner_result.linear_sample; + return wrapper_result; +} diff --git a/test/tint/shader_io/interpolate_return_struct.wgsl.expected.glsl b/test/tint/shader_io/interpolate_return_struct.wgsl.expected.glsl index 3d4342d748..6c5994776a 100644 --- a/test/tint/shader_io/interpolate_return_struct.wgsl.expected.glsl +++ b/test/tint/shader_io/interpolate_return_struct.wgsl.expected.glsl @@ -21,7 +21,7 @@ struct Out { }; Out tint_symbol_1() { - Out tint_symbol_3 = Out(vec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + Out tint_symbol_3 = Out(vec4(0.0f), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); return tint_symbol_3; } diff --git a/test/tint/shader_io/interpolate_return_struct.wgsl.expected.msl b/test/tint/shader_io/interpolate_return_struct.wgsl.expected.msl index 4c51b62db1..0b0860dbae 100644 --- a/test/tint/shader_io/interpolate_return_struct.wgsl.expected.msl +++ b/test/tint/shader_io/interpolate_return_struct.wgsl.expected.msl @@ -26,7 +26,7 @@ struct tint_symbol_1 { }; Out tint_symbol_inner() { - Out const tint_symbol_2 = {}; + Out const tint_symbol_2 = Out{}; return tint_symbol_2; } diff --git a/test/tint/shader_io/interpolate_return_struct.wgsl.expected.wgsl b/test/tint/shader_io/interpolate_return_struct.wgsl.expected.wgsl index d224352fa1..a9f9705814 100644 --- a/test/tint/shader_io/interpolate_return_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/interpolate_return_struct.wgsl.expected.wgsl @@ -19,7 +19,7 @@ struct Out { linear_sample : f32, } -@stage(vertex) +@vertex fn main() -> Out { return Out(); } diff --git a/test/tint/shader_io/invariant.wgsl b/test/tint/shader_io/invariant.wgsl index 9abbc940d5..534c2f05b6 100644 --- a/test/tint/shader_io/invariant.wgsl +++ b/test/tint/shader_io/invariant.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main() -> @builtin(position) @invariant vec4 { return vec4(); } diff --git a/test/tint/shader_io/invariant.wgsl.expected.dxc.hlsl b/test/tint/shader_io/invariant.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9bf6b9731a --- /dev/null +++ b/test/tint/shader_io/invariant.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +struct tint_symbol { + precise float4 value : SV_Position; +}; + +float4 main_inner() { + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/invariant.wgsl.expected.fxc.hlsl b/test/tint/shader_io/invariant.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9bf6b9731a --- /dev/null +++ b/test/tint/shader_io/invariant.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +struct tint_symbol { + precise float4 value : SV_Position; +}; + +float4 main_inner() { + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/invariant.wgsl.expected.glsl b/test/tint/shader_io/invariant.wgsl.expected.glsl index 4911a1bfaa..3e02ad3901 100644 --- a/test/tint/shader_io/invariant.wgsl.expected.glsl +++ b/test/tint/shader_io/invariant.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es vec4 tint_symbol() { - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/shader_io/invariant.wgsl.expected.hlsl b/test/tint/shader_io/invariant.wgsl.expected.hlsl deleted file mode 100644 index 63c6c9a0b6..0000000000 --- a/test/tint/shader_io/invariant.wgsl.expected.hlsl +++ /dev/null @@ -1,14 +0,0 @@ -struct tint_symbol { - precise float4 value : SV_Position; -}; - -float4 main_inner() { - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol main() { - const float4 inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/shader_io/invariant.wgsl.expected.msl b/test/tint/shader_io/invariant.wgsl.expected.msl index 3d41ee7b8d..4f6e6f5645 100644 --- a/test/tint/shader_io/invariant.wgsl.expected.msl +++ b/test/tint/shader_io/invariant.wgsl.expected.msl @@ -13,7 +13,7 @@ struct tint_symbol_1 { }; float4 tint_symbol_inner() { - return float4(); + return float4(0.0f); } vertex tint_symbol_1 tint_symbol() { diff --git a/test/tint/shader_io/invariant.wgsl.expected.wgsl b/test/tint/shader_io/invariant.wgsl.expected.wgsl index 9abbc940d5..534c2f05b6 100644 --- a/test/tint/shader_io/invariant.wgsl.expected.wgsl +++ b/test/tint/shader_io/invariant.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main() -> @builtin(position) @invariant vec4 { return vec4(); } diff --git a/test/tint/shader_io/invariant_struct_member.wgsl b/test/tint/shader_io/invariant_struct_member.wgsl index 64f32cef5b..fc58fd39a8 100644 --- a/test/tint/shader_io/invariant_struct_member.wgsl +++ b/test/tint/shader_io/invariant_struct_member.wgsl @@ -2,7 +2,7 @@ struct Out { @builtin(position) @invariant pos : vec4, }; -@stage(vertex) +@vertex fn main() -> Out { return Out(); } diff --git a/test/tint/shader_io/invariant_struct_member.wgsl.expected.hlsl b/test/tint/shader_io/invariant_struct_member.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/invariant_struct_member.wgsl.expected.hlsl rename to test/tint/shader_io/invariant_struct_member.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/invariant_struct_member.wgsl.expected.fxc.hlsl b/test/tint/shader_io/invariant_struct_member.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b99e552e32 --- /dev/null +++ b/test/tint/shader_io/invariant_struct_member.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +struct Out { + float4 pos; +}; +struct tint_symbol { + precise float4 pos : SV_Position; +}; + +Out main_inner() { + const Out tint_symbol_1 = (Out)0; + return tint_symbol_1; +} + +tint_symbol main() { + const Out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.pos = inner_result.pos; + return wrapper_result; +} diff --git a/test/tint/shader_io/invariant_struct_member.wgsl.expected.glsl b/test/tint/shader_io/invariant_struct_member.wgsl.expected.glsl index e271779359..d8f17f6877 100644 --- a/test/tint/shader_io/invariant_struct_member.wgsl.expected.glsl +++ b/test/tint/shader_io/invariant_struct_member.wgsl.expected.glsl @@ -5,7 +5,7 @@ struct Out { }; Out tint_symbol() { - Out tint_symbol_1 = Out(vec4(0.0f, 0.0f, 0.0f, 0.0f)); + Out tint_symbol_1 = Out(vec4(0.0f)); return tint_symbol_1; } diff --git a/test/tint/shader_io/invariant_struct_member.wgsl.expected.msl b/test/tint/shader_io/invariant_struct_member.wgsl.expected.msl index 5b44709f67..1af16da6f6 100644 --- a/test/tint/shader_io/invariant_struct_member.wgsl.expected.msl +++ b/test/tint/shader_io/invariant_struct_member.wgsl.expected.msl @@ -17,7 +17,7 @@ struct tint_symbol_1 { }; Out tint_symbol_inner() { - Out const tint_symbol_2 = {}; + Out const tint_symbol_2 = Out{}; return tint_symbol_2; } diff --git a/test/tint/shader_io/invariant_struct_member.wgsl.expected.wgsl b/test/tint/shader_io/invariant_struct_member.wgsl.expected.wgsl index aa9543136d..e3247ddb6f 100644 --- a/test/tint/shader_io/invariant_struct_member.wgsl.expected.wgsl +++ b/test/tint/shader_io/invariant_struct_member.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct Out { pos : vec4, } -@stage(vertex) +@vertex fn main() -> Out { return Out(); } diff --git a/test/tint/shader_io/shared_struct_different_stages.wgsl b/test/tint/shader_io/shared_struct_different_stages.wgsl index fc2e7ff24d..3d9feaf1c9 100644 --- a/test/tint/shader_io/shared_struct_different_stages.wgsl +++ b/test/tint/shader_io/shared_struct_different_stages.wgsl @@ -4,12 +4,12 @@ struct Interface { @builtin(position) pos : vec4, }; -@stage(vertex) +@vertex fn vert_main() -> Interface { return Interface(0.4, 0.6, vec4()); } -@stage(fragment) +@fragment fn frag_main(colors : Interface) { let r : f32 = colors.col1; let g : f32 = colors.col2; diff --git a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.dxc.hlsl b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..da8ae774b1 --- /dev/null +++ b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct Interface { + float col1; + float col2; + float4 pos; +}; +struct tint_symbol { + float col1 : TEXCOORD1; + float col2 : TEXCOORD2; + float4 pos : SV_Position; +}; + +Interface vert_main_inner() { + const Interface tint_symbol_3 = {0.400000006f, 0.600000024f, (0.0f).xxxx}; + return tint_symbol_3; +} + +tint_symbol vert_main() { + const Interface inner_result = vert_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.col1 = inner_result.col1; + wrapper_result.col2 = inner_result.col2; + wrapper_result.pos = inner_result.pos; + return wrapper_result; +} + +struct tint_symbol_2 { + float col1 : TEXCOORD1; + float col2 : TEXCOORD2; + float4 pos : SV_Position; +}; + +void frag_main_inner(Interface colors) { + const float r = colors.col1; + const float g = colors.col2; +} + +void frag_main(tint_symbol_2 tint_symbol_1) { + const Interface tint_symbol_4 = {tint_symbol_1.col1, tint_symbol_1.col2, tint_symbol_1.pos}; + frag_main_inner(tint_symbol_4); + return; +} diff --git a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.fxc.hlsl b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..da8ae774b1 --- /dev/null +++ b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct Interface { + float col1; + float col2; + float4 pos; +}; +struct tint_symbol { + float col1 : TEXCOORD1; + float col2 : TEXCOORD2; + float4 pos : SV_Position; +}; + +Interface vert_main_inner() { + const Interface tint_symbol_3 = {0.400000006f, 0.600000024f, (0.0f).xxxx}; + return tint_symbol_3; +} + +tint_symbol vert_main() { + const Interface inner_result = vert_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.col1 = inner_result.col1; + wrapper_result.col2 = inner_result.col2; + wrapper_result.pos = inner_result.pos; + return wrapper_result; +} + +struct tint_symbol_2 { + float col1 : TEXCOORD1; + float col2 : TEXCOORD2; + float4 pos : SV_Position; +}; + +void frag_main_inner(Interface colors) { + const float r = colors.col1; + const float g = colors.col2; +} + +void frag_main(tint_symbol_2 tint_symbol_1) { + const Interface tint_symbol_4 = {tint_symbol_1.col1, tint_symbol_1.col2, tint_symbol_1.pos}; + frag_main_inner(tint_symbol_4); + return; +} diff --git a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.glsl b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.glsl index 6a6f8e1f8c..5e359e25bf 100644 --- a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.glsl +++ b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.glsl @@ -9,7 +9,7 @@ struct Interface { }; Interface vert_main() { - Interface tint_symbol = Interface(0.400000006f, 0.600000024f, vec4(0.0f, 0.0f, 0.0f, 0.0f)); + Interface tint_symbol = Interface(0.400000006f, 0.600000024f, vec4(0.0f)); return tint_symbol; } diff --git a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.hlsl b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.hlsl deleted file mode 100644 index 6bb2f0aa93..0000000000 --- a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -struct Interface { - float col1; - float col2; - float4 pos; -}; -struct tint_symbol { - float col1 : TEXCOORD1; - float col2 : TEXCOORD2; - float4 pos : SV_Position; -}; - -Interface vert_main_inner() { - const Interface tint_symbol_3 = {0.400000006f, 0.600000024f, float4(0.0f, 0.0f, 0.0f, 0.0f)}; - return tint_symbol_3; -} - -tint_symbol vert_main() { - const Interface inner_result = vert_main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.col1 = inner_result.col1; - wrapper_result.col2 = inner_result.col2; - wrapper_result.pos = inner_result.pos; - return wrapper_result; -} - -struct tint_symbol_2 { - float col1 : TEXCOORD1; - float col2 : TEXCOORD2; - float4 pos : SV_Position; -}; - -void frag_main_inner(Interface colors) { - const float r = colors.col1; - const float g = colors.col2; -} - -void frag_main(tint_symbol_2 tint_symbol_1) { - const Interface tint_symbol_4 = {tint_symbol_1.col1, tint_symbol_1.col2, tint_symbol_1.pos}; - frag_main_inner(tint_symbol_4); - return; -} diff --git a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.msl b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.msl index 4dc3f1f0a9..123f2d1573 100644 --- a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.msl +++ b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.msl @@ -14,7 +14,7 @@ struct tint_symbol { }; Interface vert_main_inner() { - Interface const tint_symbol_3 = {.col1=0.400000006f, .col2=0.600000024f, .pos=float4()}; + Interface const tint_symbol_3 = Interface{.col1=0.400000006f, .col2=0.600000024f, .pos=float4(0.0f)}; return tint_symbol_3; } diff --git a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.wgsl b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.wgsl index ebf8b86943..4c3967d332 100644 --- a/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.wgsl +++ b/test/tint/shader_io/shared_struct_different_stages.wgsl.expected.wgsl @@ -7,12 +7,12 @@ struct Interface { pos : vec4, } -@stage(vertex) +@vertex fn vert_main() -> Interface { return Interface(0.400000006, 0.600000024, vec4()); } -@stage(fragment) +@fragment fn frag_main(colors : Interface) { let r : f32 = colors.col1; let g : f32 = colors.col2; diff --git a/test/tint/shader_io/shared_struct_helper_function.wgsl b/test/tint/shader_io/shared_struct_helper_function.wgsl index c6bc37b1cb..2dbc8afe70 100644 --- a/test/tint/shader_io/shared_struct_helper_function.wgsl +++ b/test/tint/shader_io/shared_struct_helper_function.wgsl @@ -7,12 +7,12 @@ fn foo(x : f32) -> VertexOutput { return VertexOutput(vec4(x, x, x, 1.0), 42); } -@stage(vertex) +@vertex fn vert_main1() -> VertexOutput { return foo(0.5); } -@stage(vertex) +@vertex fn vert_main2() -> VertexOutput { return foo(0.25); } diff --git a/test/tint/shader_io/shared_struct_helper_function.wgsl.expected.hlsl b/test/tint/shader_io/shared_struct_helper_function.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/shared_struct_helper_function.wgsl.expected.hlsl rename to test/tint/shader_io/shared_struct_helper_function.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/shared_struct_helper_function.wgsl.expected.fxc.hlsl b/test/tint/shader_io/shared_struct_helper_function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0e90b3c337 --- /dev/null +++ b/test/tint/shader_io/shared_struct_helper_function.wgsl.expected.fxc.hlsl @@ -0,0 +1,43 @@ +struct VertexOutput { + float4 pos; + int loc0; +}; + +VertexOutput foo(float x) { + const VertexOutput tint_symbol_2 = {float4(x, x, x, 1.0f), 42}; + return tint_symbol_2; +} + +struct tint_symbol { + nointerpolation int loc0 : TEXCOORD0; + float4 pos : SV_Position; +}; + +VertexOutput vert_main1_inner() { + return foo(0.5f); +} + +tint_symbol vert_main1() { + const VertexOutput inner_result = vert_main1_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.pos = inner_result.pos; + wrapper_result.loc0 = inner_result.loc0; + return wrapper_result; +} + +struct tint_symbol_1 { + nointerpolation int loc0 : TEXCOORD0; + float4 pos : SV_Position; +}; + +VertexOutput vert_main2_inner() { + return foo(0.25f); +} + +tint_symbol_1 vert_main2() { + const VertexOutput inner_result_1 = vert_main2_inner(); + tint_symbol_1 wrapper_result_1 = (tint_symbol_1)0; + wrapper_result_1.pos = inner_result_1.pos; + wrapper_result_1.loc0 = inner_result_1.loc0; + return wrapper_result_1; +} diff --git a/test/tint/shader_io/shared_struct_helper_function.wgsl.expected.wgsl b/test/tint/shader_io/shared_struct_helper_function.wgsl.expected.wgsl index 57e1e1b0a5..fe18db55ac 100644 --- a/test/tint/shader_io/shared_struct_helper_function.wgsl.expected.wgsl +++ b/test/tint/shader_io/shared_struct_helper_function.wgsl.expected.wgsl @@ -9,12 +9,12 @@ fn foo(x : f32) -> VertexOutput { return VertexOutput(vec4(x, x, x, 1.0), 42); } -@stage(vertex) +@vertex fn vert_main1() -> VertexOutput { return foo(0.5); } -@stage(vertex) +@vertex fn vert_main2() -> VertexOutput { return foo(0.25); } diff --git a/test/tint/shader_io/shared_struct_storage_buffer.wgsl b/test/tint/shader_io/shared_struct_storage_buffer.wgsl index d54736564d..2d8444767e 100644 --- a/test/tint/shader_io/shared_struct_storage_buffer.wgsl +++ b/test/tint/shader_io/shared_struct_storage_buffer.wgsl @@ -5,9 +5,9 @@ struct S { }; @group(0) @binding(0) -var output : S; +var output : S; -@stage(fragment) +@fragment fn frag_main(input : S) { let f : f32 = input.f; let u : u32 = input.u; diff --git a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.hlsl b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.hlsl rename to test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.fxc.hlsl b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..45c61bb370 --- /dev/null +++ b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +struct S { + float f; + uint u; + float4 v; +}; + +RWByteAddressBuffer output : register(u0, space0); + +struct tint_symbol_1 { + float f : TEXCOORD0; + nointerpolation uint u : TEXCOORD1; + float4 v : SV_Position; +}; + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) { + buffer.Store((offset + 0u), asuint(value.f)); + buffer.Store((offset + 4u), asuint(value.u)); + buffer.Store4((offset + 128u), asuint(value.v)); +} + +void frag_main_inner(S input) { + const float f = input.f; + const uint u = input.u; + const float4 v = input.v; + tint_symbol_2(output, 0u, input); +} + +void frag_main(tint_symbol_1 tint_symbol) { + const S tint_symbol_6 = {tint_symbol.f, tint_symbol.u, tint_symbol.v}; + frag_main_inner(tint_symbol_6); + return; +} diff --git a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.msl b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.msl index 7b765f6ad3..b086e524ae 100644 --- a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.msl +++ b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.msl @@ -1,12 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { /* 0x0000 */ float f; /* 0x0004 */ uint u; - /* 0x0008 */ int8_t tint_pad[120]; + /* 0x0008 */ tint_array tint_pad; /* 0x0080 */ float4 v; - /* 0x0090 */ int8_t tint_pad_1[112]; + /* 0x0090 */ tint_array tint_pad_1; }; struct tint_symbol_1 { diff --git a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.spvasm b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.spvasm index 5f96817e52..e2748bdaa0 100644 --- a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.spvasm +++ b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.spvasm @@ -26,7 +26,6 @@ OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 1 Offset 4 OpMemberDecorate %S 2 Offset 128 - OpDecorate %output NonReadable OpDecorate %output DescriptorSet 0 OpDecorate %output Binding 0 %float = OpTypeFloat 32 diff --git a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.wgsl b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.wgsl index d8c3ad7c5c..d12912e629 100644 --- a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.wgsl +++ b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.wgsl @@ -7,9 +7,9 @@ struct S { v : vec4, } -@group(0) @binding(0) var output : S; +@group(0) @binding(0) var output : S; -@stage(fragment) +@fragment fn frag_main(input : S) { let f : f32 = input.f; let u : u32 = input.u; diff --git a/test/tint/shader_io/vertex_input_builtins.wgsl b/test/tint/shader_io/vertex_input_builtins.wgsl index a73ae88b9e..8043581b61 100644 --- a/test/tint/shader_io/vertex_input_builtins.wgsl +++ b/test/tint/shader_io/vertex_input_builtins.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main( @builtin(vertex_index) vertex_index : u32, @builtin(instance_index) instance_index : u32, diff --git a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.dxc.hlsl b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cb5f7c7e80 --- /dev/null +++ b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.dxc.hlsl @@ -0,0 +1,19 @@ +struct tint_symbol_1 { + uint vertex_index : SV_VertexID; + uint instance_index : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(uint vertex_index, uint instance_index) { + const uint foo = (vertex_index + instance_index); + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 inner_result = main_inner(tint_symbol.vertex_index, tint_symbol.instance_index); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.fxc.hlsl b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cb5f7c7e80 --- /dev/null +++ b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +struct tint_symbol_1 { + uint vertex_index : SV_VertexID; + uint instance_index : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(uint vertex_index, uint instance_index) { + const uint foo = (vertex_index + instance_index); + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 inner_result = main_inner(tint_symbol.vertex_index, tint_symbol.instance_index); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.glsl b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.glsl index 43f246e8a8..e5e32ae912 100644 --- a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.glsl +++ b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.glsl @@ -2,7 +2,7 @@ vec4 tint_symbol(uint vertex_index, uint instance_index) { uint foo = (vertex_index + instance_index); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.hlsl b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.hlsl deleted file mode 100644 index 99174250ec..0000000000 --- a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.hlsl +++ /dev/null @@ -1,19 +0,0 @@ -struct tint_symbol_1 { - uint vertex_index : SV_VertexID; - uint instance_index : SV_InstanceID; -}; -struct tint_symbol_2 { - float4 value : SV_Position; -}; - -float4 main_inner(uint vertex_index, uint instance_index) { - const uint foo = (vertex_index + instance_index); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const float4 inner_result = main_inner(tint_symbol.vertex_index, tint_symbol.instance_index); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.msl b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.msl index 1ef825bfe6..727497c279 100644 --- a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.msl +++ b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.msl @@ -7,7 +7,7 @@ struct tint_symbol_1 { float4 tint_symbol_inner(uint vertex_index, uint instance_index) { uint const foo = (vertex_index + instance_index); - return float4(); + return float4(0.0f); } vertex tint_symbol_1 tint_symbol(uint vertex_index [[vertex_id]], uint instance_index [[instance_id]]) { diff --git a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.wgsl b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.wgsl index 9955c16160..0b45ee725a 100644 --- a/test/tint/shader_io/vertex_input_builtins.wgsl.expected.wgsl +++ b/test/tint/shader_io/vertex_input_builtins.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main(@builtin(vertex_index) vertex_index : u32, @builtin(instance_index) instance_index : u32) -> @builtin(position) vec4 { let foo : u32 = (vertex_index + instance_index); return vec4(); diff --git a/test/tint/shader_io/vertex_input_builtins_struct.wgsl b/test/tint/shader_io/vertex_input_builtins_struct.wgsl index ceeab778ed..0db20a5015 100644 --- a/test/tint/shader_io/vertex_input_builtins_struct.wgsl +++ b/test/tint/shader_io/vertex_input_builtins_struct.wgsl @@ -3,7 +3,7 @@ struct VertexInputs { @builtin(instance_index) instance_index : u32, }; -@stage(vertex) +@vertex fn main(inputs : VertexInputs) -> @builtin(position) vec4 { let foo : u32 = inputs.vertex_index + inputs.instance_index; return vec4(); diff --git a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.dxc.hlsl b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..74369c8adb --- /dev/null +++ b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +struct VertexInputs { + uint vertex_index; + uint instance_index; +}; +struct tint_symbol_1 { + uint vertex_index : SV_VertexID; + uint instance_index : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(VertexInputs inputs) { + const uint foo = (inputs.vertex_index + inputs.instance_index); + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexInputs tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.instance_index}; + const float4 inner_result = main_inner(tint_symbol_3); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..74369c8adb --- /dev/null +++ b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +struct VertexInputs { + uint vertex_index; + uint instance_index; +}; +struct tint_symbol_1 { + uint vertex_index : SV_VertexID; + uint instance_index : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(VertexInputs inputs) { + const uint foo = (inputs.vertex_index + inputs.instance_index); + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexInputs tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.instance_index}; + const float4 inner_result = main_inner(tint_symbol_3); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.glsl b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.glsl index 1064f027b2..7daad03450 100644 --- a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.glsl +++ b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.glsl @@ -7,7 +7,7 @@ struct VertexInputs { vec4 tint_symbol(VertexInputs inputs) { uint foo = (inputs.vertex_index + inputs.instance_index); - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.hlsl b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.hlsl deleted file mode 100644 index 87f19d6138..0000000000 --- a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.hlsl +++ /dev/null @@ -1,24 +0,0 @@ -struct VertexInputs { - uint vertex_index; - uint instance_index; -}; -struct tint_symbol_1 { - uint vertex_index : SV_VertexID; - uint instance_index : SV_InstanceID; -}; -struct tint_symbol_2 { - float4 value : SV_Position; -}; - -float4 main_inner(VertexInputs inputs) { - const uint foo = (inputs.vertex_index + inputs.instance_index); - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const VertexInputs tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.instance_index}; - const float4 inner_result = main_inner(tint_symbol_3); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.msl b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.msl index 6f67049881..136d88b320 100644 --- a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.msl +++ b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.msl @@ -12,7 +12,7 @@ struct tint_symbol_1 { float4 tint_symbol_inner(VertexInputs inputs) { uint const foo = (inputs.vertex_index + inputs.instance_index); - return float4(); + return float4(0.0f); } vertex tint_symbol_1 tint_symbol(uint vertex_index [[vertex_id]], uint instance_index [[instance_id]]) { diff --git a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.wgsl b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.wgsl index 579d914220..71175a858f 100644 --- a/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/vertex_input_builtins_struct.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct VertexInputs { instance_index : u32, } -@stage(vertex) +@vertex fn main(inputs : VertexInputs) -> @builtin(position) vec4 { let foo : u32 = (inputs.vertex_index + inputs.instance_index); return vec4(); diff --git a/test/tint/shader_io/vertex_input_locations.wgsl b/test/tint/shader_io/vertex_input_locations.wgsl index 3627e13212..0bf249fa6a 100644 --- a/test/tint/shader_io/vertex_input_locations.wgsl +++ b/test/tint/shader_io/vertex_input_locations.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main( @location(0) loc0 : i32, @location(1) loc1 : u32, diff --git a/test/tint/shader_io/vertex_input_locations.wgsl.expected.dxc.hlsl b/test/tint/shader_io/vertex_input_locations.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c803987edb --- /dev/null +++ b/test/tint/shader_io/vertex_input_locations.wgsl.expected.dxc.hlsl @@ -0,0 +1,24 @@ +struct tint_symbol_1 { + int loc0 : TEXCOORD0; + uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(int loc0, uint loc1, float loc2, float4 loc3) { + const int i = loc0; + const uint u = loc1; + const float f = loc2; + const float4 v = loc3; + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 inner_result = main_inner(tint_symbol.loc0, tint_symbol.loc1, tint_symbol.loc2, tint_symbol.loc3); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_locations.wgsl.expected.fxc.hlsl b/test/tint/shader_io/vertex_input_locations.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c803987edb --- /dev/null +++ b/test/tint/shader_io/vertex_input_locations.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +struct tint_symbol_1 { + int loc0 : TEXCOORD0; + uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(int loc0, uint loc1, float loc2, float4 loc3) { + const int i = loc0; + const uint u = loc1; + const float f = loc2; + const float4 v = loc3; + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 inner_result = main_inner(tint_symbol.loc0, tint_symbol.loc1, tint_symbol.loc2, tint_symbol.loc3); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_locations.wgsl.expected.glsl b/test/tint/shader_io/vertex_input_locations.wgsl.expected.glsl index 2ca8d8a123..b24437fa0a 100644 --- a/test/tint/shader_io/vertex_input_locations.wgsl.expected.glsl +++ b/test/tint/shader_io/vertex_input_locations.wgsl.expected.glsl @@ -9,7 +9,7 @@ vec4 tint_symbol(int loc0, uint loc1, float loc2, vec4 loc3) { uint u = loc1; float f = loc2; vec4 v = loc3; - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/shader_io/vertex_input_locations.wgsl.expected.hlsl b/test/tint/shader_io/vertex_input_locations.wgsl.expected.hlsl deleted file mode 100644 index 94c822008e..0000000000 --- a/test/tint/shader_io/vertex_input_locations.wgsl.expected.hlsl +++ /dev/null @@ -1,24 +0,0 @@ -struct tint_symbol_1 { - int loc0 : TEXCOORD0; - uint loc1 : TEXCOORD1; - float loc2 : TEXCOORD2; - float4 loc3 : TEXCOORD3; -}; -struct tint_symbol_2 { - float4 value : SV_Position; -}; - -float4 main_inner(int loc0, uint loc1, float loc2, float4 loc3) { - const int i = loc0; - const uint u = loc1; - const float f = loc2; - const float4 v = loc3; - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const float4 inner_result = main_inner(tint_symbol.loc0, tint_symbol.loc1, tint_symbol.loc2, tint_symbol.loc3); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/shader_io/vertex_input_locations.wgsl.expected.msl b/test/tint/shader_io/vertex_input_locations.wgsl.expected.msl index f45c47ec65..0d6a66bbe1 100644 --- a/test/tint/shader_io/vertex_input_locations.wgsl.expected.msl +++ b/test/tint/shader_io/vertex_input_locations.wgsl.expected.msl @@ -17,7 +17,7 @@ float4 tint_symbol_inner(int loc0, uint loc1, float loc2, float4 loc3) { uint const u = loc1; float const f = loc2; float4 const v = loc3; - return float4(); + return float4(0.0f); } vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { diff --git a/test/tint/shader_io/vertex_input_locations.wgsl.expected.wgsl b/test/tint/shader_io/vertex_input_locations.wgsl.expected.wgsl index 4964dc78c1..af986ac1ec 100644 --- a/test/tint/shader_io/vertex_input_locations.wgsl.expected.wgsl +++ b/test/tint/shader_io/vertex_input_locations.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main(@location(0) loc0 : i32, @location(1) loc1 : u32, @location(2) loc2 : f32, @location(3) loc3 : vec4) -> @builtin(position) vec4 { let i : i32 = loc0; let u : u32 = loc1; diff --git a/test/tint/shader_io/vertex_input_locations_struct.wgsl b/test/tint/shader_io/vertex_input_locations_struct.wgsl index d2afb8cc46..16c86b16dc 100644 --- a/test/tint/shader_io/vertex_input_locations_struct.wgsl +++ b/test/tint/shader_io/vertex_input_locations_struct.wgsl @@ -5,7 +5,7 @@ struct VertexInputs { @location(3) loc3 : vec4, }; -@stage(vertex) +@vertex fn main(inputs : VertexInputs) -> @builtin(position) vec4 { let i : i32 = inputs.loc0; let u : u32 = inputs.loc1; diff --git a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.dxc.hlsl b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ef6fb7563 --- /dev/null +++ b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +struct VertexInputs { + int loc0; + uint loc1; + float loc2; + float4 loc3; +}; +struct tint_symbol_1 { + int loc0 : TEXCOORD0; + uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(VertexInputs inputs) { + const int i = inputs.loc0; + const uint u = inputs.loc1; + const float f = inputs.loc2; + const float4 v = inputs.loc3; + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexInputs tint_symbol_3 = {tint_symbol.loc0, tint_symbol.loc1, tint_symbol.loc2, tint_symbol.loc3}; + const float4 inner_result = main_inner(tint_symbol_3); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ef6fb7563 --- /dev/null +++ b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +struct VertexInputs { + int loc0; + uint loc1; + float loc2; + float4 loc3; +}; +struct tint_symbol_1 { + int loc0 : TEXCOORD0; + uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(VertexInputs inputs) { + const int i = inputs.loc0; + const uint u = inputs.loc1; + const float f = inputs.loc2; + const float4 v = inputs.loc3; + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexInputs tint_symbol_3 = {tint_symbol.loc0, tint_symbol.loc1, tint_symbol.loc2, tint_symbol.loc3}; + const float4 inner_result = main_inner(tint_symbol_3); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.glsl b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.glsl index 1af49794cb..43a2113651 100644 --- a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.glsl +++ b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.glsl @@ -16,7 +16,7 @@ vec4 tint_symbol(VertexInputs inputs) { uint u = inputs.loc1; float f = inputs.loc2; vec4 v = inputs.loc3; - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.hlsl b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.hlsl deleted file mode 100644 index 733014dc37..0000000000 --- a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.hlsl +++ /dev/null @@ -1,31 +0,0 @@ -struct VertexInputs { - int loc0; - uint loc1; - float loc2; - float4 loc3; -}; -struct tint_symbol_1 { - int loc0 : TEXCOORD0; - uint loc1 : TEXCOORD1; - float loc2 : TEXCOORD2; - float4 loc3 : TEXCOORD3; -}; -struct tint_symbol_2 { - float4 value : SV_Position; -}; - -float4 main_inner(VertexInputs inputs) { - const int i = inputs.loc0; - const uint u = inputs.loc1; - const float f = inputs.loc2; - const float4 v = inputs.loc3; - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const VertexInputs tint_symbol_3 = {tint_symbol.loc0, tint_symbol.loc1, tint_symbol.loc2, tint_symbol.loc3}; - const float4 inner_result = main_inner(tint_symbol_3); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.msl b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.msl index 0391ee480c..d0fcffe1e3 100644 --- a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.msl +++ b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.msl @@ -24,7 +24,7 @@ float4 tint_symbol_inner(VertexInputs inputs) { uint const u = inputs.loc1; float const f = inputs.loc2; float4 const v = inputs.loc3; - return float4(); + return float4(0.0f); } vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { diff --git a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.wgsl b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.wgsl index 7cf656dab2..5ccc7d244a 100644 --- a/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/vertex_input_locations_struct.wgsl.expected.wgsl @@ -9,7 +9,7 @@ struct VertexInputs { loc3 : vec4, } -@stage(vertex) +@vertex fn main(inputs : VertexInputs) -> @builtin(position) vec4 { let i : i32 = inputs.loc0; let u : u32 = inputs.loc1; diff --git a/test/tint/shader_io/vertex_input_mixed.wgsl b/test/tint/shader_io/vertex_input_mixed.wgsl index 5c60fa220e..0014192623 100644 --- a/test/tint/shader_io/vertex_input_mixed.wgsl +++ b/test/tint/shader_io/vertex_input_mixed.wgsl @@ -7,7 +7,7 @@ struct VertexInputs1 { @location(3) loc3 : vec4, }; -@stage(vertex) +@vertex fn main( inputs0 : VertexInputs0, @location(1) loc1 : u32, diff --git a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.dxc.hlsl b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39b42ef0bd --- /dev/null +++ b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.dxc.hlsl @@ -0,0 +1,37 @@ +struct VertexInputs0 { + uint vertex_index; + int loc0; +}; +struct VertexInputs1 { + float loc2; + float4 loc3; +}; +struct tint_symbol_1 { + int loc0 : TEXCOORD0; + uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; + uint vertex_index : SV_VertexID; + uint instance_index : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) { + const uint foo = (inputs0.vertex_index + instance_index); + const int i = inputs0.loc0; + const uint u = loc1; + const float f = inputs1.loc2; + const float4 v = inputs1.loc3; + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexInputs0 tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.loc0}; + const VertexInputs1 tint_symbol_4 = {tint_symbol.loc2, tint_symbol.loc3}; + const float4 inner_result = main_inner(tint_symbol_3, tint_symbol.loc1, tint_symbol.instance_index, tint_symbol_4); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.fxc.hlsl b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..39b42ef0bd --- /dev/null +++ b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.fxc.hlsl @@ -0,0 +1,37 @@ +struct VertexInputs0 { + uint vertex_index; + int loc0; +}; +struct VertexInputs1 { + float loc2; + float4 loc3; +}; +struct tint_symbol_1 { + int loc0 : TEXCOORD0; + uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; + uint vertex_index : SV_VertexID; + uint instance_index : SV_InstanceID; +}; +struct tint_symbol_2 { + float4 value : SV_Position; +}; + +float4 main_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) { + const uint foo = (inputs0.vertex_index + instance_index); + const int i = inputs0.loc0; + const uint u = loc1; + const float f = inputs1.loc2; + const float4 v = inputs1.loc3; + return (0.0f).xxxx; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const VertexInputs0 tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.loc0}; + const VertexInputs1 tint_symbol_4 = {tint_symbol.loc2, tint_symbol.loc3}; + const float4 inner_result = main_inner(tint_symbol_3, tint_symbol.loc1, tint_symbol.instance_index, tint_symbol_4); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.glsl b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.glsl index 769f6241b2..2470a13ed7 100644 --- a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.glsl +++ b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.glsl @@ -20,7 +20,7 @@ vec4 tint_symbol(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexIn uint u = loc1; float f = inputs1.loc2; vec4 v = inputs1.loc3; - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.hlsl b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.hlsl deleted file mode 100644 index 916f00f5c0..0000000000 --- a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -struct VertexInputs0 { - uint vertex_index; - int loc0; -}; -struct VertexInputs1 { - float loc2; - float4 loc3; -}; -struct tint_symbol_1 { - int loc0 : TEXCOORD0; - uint loc1 : TEXCOORD1; - float loc2 : TEXCOORD2; - float4 loc3 : TEXCOORD3; - uint vertex_index : SV_VertexID; - uint instance_index : SV_InstanceID; -}; -struct tint_symbol_2 { - float4 value : SV_Position; -}; - -float4 main_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) { - const uint foo = (inputs0.vertex_index + instance_index); - const int i = inputs0.loc0; - const uint u = loc1; - const float f = inputs1.loc2; - const float4 v = inputs1.loc3; - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const VertexInputs0 tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.loc0}; - const VertexInputs1 tint_symbol_4 = {tint_symbol.loc2, tint_symbol.loc3}; - const float4 inner_result = main_inner(tint_symbol_3, tint_symbol.loc1, tint_symbol.instance_index, tint_symbol_4); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.msl b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.msl index 03c4e970dd..1ce7b01ae3 100644 --- a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.msl +++ b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.msl @@ -28,7 +28,7 @@ float4 tint_symbol_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, uint const u = loc1; float const f = inputs1.loc2; float4 const v = inputs1.loc3; - return float4(); + return float4(0.0f); } vertex tint_symbol_3 tint_symbol(uint vertex_index [[vertex_id]], uint instance_index [[instance_id]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { diff --git a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.wgsl b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.wgsl index fc2b4d6aef..931404b372 100644 --- a/test/tint/shader_io/vertex_input_mixed.wgsl.expected.wgsl +++ b/test/tint/shader_io/vertex_input_mixed.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct VertexInputs1 { loc3 : vec4, } -@stage(vertex) +@vertex fn main(inputs0 : VertexInputs0, @location(1) loc1 : u32, @builtin(instance_index) instance_index : u32, inputs1 : VertexInputs1) -> @builtin(position) vec4 { let foo : u32 = (inputs0.vertex_index + instance_index); let i : i32 = inputs0.loc0; diff --git a/test/tint/shader_io/vertex_output_builtins.wgsl b/test/tint/shader_io/vertex_output_builtins.wgsl index d606b44910..3aca32e445 100644 --- a/test/tint/shader_io/vertex_output_builtins.wgsl +++ b/test/tint/shader_io/vertex_output_builtins.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main() -> @builtin(position) vec4 { return vec4(1.0, 2.0, 3.0, 4.0); } diff --git a/test/tint/shader_io/vertex_output_builtins.wgsl.expected.hlsl b/test/tint/shader_io/vertex_output_builtins.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/vertex_output_builtins.wgsl.expected.hlsl rename to test/tint/shader_io/vertex_output_builtins.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/vertex_output_builtins.wgsl.expected.fxc.hlsl b/test/tint/shader_io/vertex_output_builtins.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d08b5d5887 --- /dev/null +++ b/test/tint/shader_io/vertex_output_builtins.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 main_inner() { + return float4(1.0f, 2.0f, 3.0f, 4.0f); +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_output_builtins.wgsl.expected.wgsl b/test/tint/shader_io/vertex_output_builtins.wgsl.expected.wgsl index d606b44910..3aca32e445 100644 --- a/test/tint/shader_io/vertex_output_builtins.wgsl.expected.wgsl +++ b/test/tint/shader_io/vertex_output_builtins.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main() -> @builtin(position) vec4 { return vec4(1.0, 2.0, 3.0, 4.0); } diff --git a/test/tint/shader_io/vertex_output_builtins_struct.wgsl b/test/tint/shader_io/vertex_output_builtins_struct.wgsl index 7f5d2a7f0d..906a0ef9a9 100644 --- a/test/tint/shader_io/vertex_output_builtins_struct.wgsl +++ b/test/tint/shader_io/vertex_output_builtins_struct.wgsl @@ -2,7 +2,7 @@ struct VertexOutputs { @builtin(position) position : vec4, }; -@stage(vertex) +@vertex fn main() -> VertexOutputs { return VertexOutputs(vec4(1.0, 2.0, 3.0, 4.0)); } diff --git a/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.hlsl b/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.hlsl rename to test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..eeaba9692d --- /dev/null +++ b/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +struct VertexOutputs { + float4 position; +}; +struct tint_symbol { + float4 position : SV_Position; +}; + +VertexOutputs main_inner() { + const VertexOutputs tint_symbol_1 = {float4(1.0f, 2.0f, 3.0f, 4.0f)}; + return tint_symbol_1; +} + +tint_symbol main() { + const VertexOutputs inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.position = inner_result.position; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.msl b/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.msl index 2a8b1bcf30..06a2db36c9 100644 --- a/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.msl +++ b/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.msl @@ -10,7 +10,7 @@ struct tint_symbol_1 { }; VertexOutputs tint_symbol_inner() { - VertexOutputs const tint_symbol_2 = {.position=float4(1.0f, 2.0f, 3.0f, 4.0f)}; + VertexOutputs const tint_symbol_2 = VertexOutputs{.position=float4(1.0f, 2.0f, 3.0f, 4.0f)}; return tint_symbol_2; } diff --git a/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.wgsl b/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.wgsl index 5fe2d8f9b1..85ac952748 100644 --- a/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/vertex_output_builtins_struct.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct VertexOutputs { position : vec4, } -@stage(vertex) +@vertex fn main() -> VertexOutputs { return VertexOutputs(vec4(1.0, 2.0, 3.0, 4.0)); } diff --git a/test/tint/shader_io/vertex_output_locations_struct.wgsl b/test/tint/shader_io/vertex_output_locations_struct.wgsl index a13fd72b69..0fcdbfb0be 100644 --- a/test/tint/shader_io/vertex_output_locations_struct.wgsl +++ b/test/tint/shader_io/vertex_output_locations_struct.wgsl @@ -6,7 +6,7 @@ struct VertexOutputs { @builtin(position) position : vec4, }; -@stage(vertex) +@vertex fn main() -> VertexOutputs { return VertexOutputs(1, 1u, 1.0, vec4(1.0, 2.0, 3.0, 4.0), vec4()); } diff --git a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.dxc.hlsl b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0dad7303df --- /dev/null +++ b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +struct VertexOutputs { + int loc0; + uint loc1; + float loc2; + float4 loc3; + float4 position; +}; +struct tint_symbol { + nointerpolation int loc0 : TEXCOORD0; + nointerpolation uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; + float4 position : SV_Position; +}; + +VertexOutputs main_inner() { + const VertexOutputs tint_symbol_1 = {1, 1u, 1.0f, float4(1.0f, 2.0f, 3.0f, 4.0f), (0.0f).xxxx}; + return tint_symbol_1; +} + +tint_symbol main() { + const VertexOutputs inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.loc0 = inner_result.loc0; + wrapper_result.loc1 = inner_result.loc1; + wrapper_result.loc2 = inner_result.loc2; + wrapper_result.loc3 = inner_result.loc3; + wrapper_result.position = inner_result.position; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.fxc.hlsl b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0dad7303df --- /dev/null +++ b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +struct VertexOutputs { + int loc0; + uint loc1; + float loc2; + float4 loc3; + float4 position; +}; +struct tint_symbol { + nointerpolation int loc0 : TEXCOORD0; + nointerpolation uint loc1 : TEXCOORD1; + float loc2 : TEXCOORD2; + float4 loc3 : TEXCOORD3; + float4 position : SV_Position; +}; + +VertexOutputs main_inner() { + const VertexOutputs tint_symbol_1 = {1, 1u, 1.0f, float4(1.0f, 2.0f, 3.0f, 4.0f), (0.0f).xxxx}; + return tint_symbol_1; +} + +tint_symbol main() { + const VertexOutputs inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.loc0 = inner_result.loc0; + wrapper_result.loc1 = inner_result.loc1; + wrapper_result.loc2 = inner_result.loc2; + wrapper_result.loc3 = inner_result.loc3; + wrapper_result.position = inner_result.position; + return wrapper_result; +} diff --git a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.glsl b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.glsl index b09cc4b217..2c772ac464 100644 --- a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.glsl +++ b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.glsl @@ -13,7 +13,7 @@ struct VertexOutputs { }; VertexOutputs tint_symbol() { - VertexOutputs tint_symbol_1 = VertexOutputs(1, 1u, 1.0f, vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); + VertexOutputs tint_symbol_1 = VertexOutputs(1, 1u, 1.0f, vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(0.0f)); return tint_symbol_1; } diff --git a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.hlsl b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.hlsl deleted file mode 100644 index ab7e72f78f..0000000000 --- a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -struct VertexOutputs { - int loc0; - uint loc1; - float loc2; - float4 loc3; - float4 position; -}; -struct tint_symbol { - nointerpolation int loc0 : TEXCOORD0; - nointerpolation uint loc1 : TEXCOORD1; - float loc2 : TEXCOORD2; - float4 loc3 : TEXCOORD3; - float4 position : SV_Position; -}; - -VertexOutputs main_inner() { - const VertexOutputs tint_symbol_1 = {1, 1u, 1.0f, float4(1.0f, 2.0f, 3.0f, 4.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; - return tint_symbol_1; -} - -tint_symbol main() { - const VertexOutputs inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.loc0 = inner_result.loc0; - wrapper_result.loc1 = inner_result.loc1; - wrapper_result.loc2 = inner_result.loc2; - wrapper_result.loc3 = inner_result.loc3; - wrapper_result.position = inner_result.position; - return wrapper_result; -} diff --git a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.msl b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.msl index b24884e721..4d57a0432e 100644 --- a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.msl +++ b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.msl @@ -18,7 +18,7 @@ struct tint_symbol_1 { }; VertexOutputs tint_symbol_inner() { - VertexOutputs const tint_symbol_2 = {.loc0=1, .loc1=1u, .loc2=1.0f, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f), .position=float4()}; + VertexOutputs const tint_symbol_2 = VertexOutputs{.loc0=1, .loc1=1u, .loc2=1.0f, .loc3=float4(1.0f, 2.0f, 3.0f, 4.0f), .position=float4(0.0f)}; return tint_symbol_2; } diff --git a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.wgsl b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.wgsl index b117eccc5d..65ffd0aa8c 100644 --- a/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.wgsl +++ b/test/tint/shader_io/vertex_output_locations_struct.wgsl.expected.wgsl @@ -11,7 +11,7 @@ struct VertexOutputs { position : vec4, } -@stage(vertex) +@vertex fn main() -> VertexOutputs { return VertexOutputs(1, 1u, 1.0, vec4(1.0, 2.0, 3.0, 4.0), vec4()); } diff --git a/test/tint/shadowing/alias/const.wgsl b/test/tint/shadowing/alias/const.wgsl new file mode 100644 index 0000000000..a2bdd05cc3 --- /dev/null +++ b/test/tint/shadowing/alias/const.wgsl @@ -0,0 +1,10 @@ +type a = i32; + +fn f() { + { + const a : a = a(); + const b = a; + } + const a : a = a(); + const b = a; +} diff --git a/test/tint/shadowing/alias/const.wgsl.expected.dxc.hlsl b/test/tint/shadowing/alias/const.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6316714a17 --- /dev/null +++ b/test/tint/shadowing/alias/const.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + { + } +} diff --git a/test/tint/shadowing/alias/const.wgsl.expected.fxc.hlsl b/test/tint/shadowing/alias/const.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6316714a17 --- /dev/null +++ b/test/tint/shadowing/alias/const.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + { + } +} diff --git a/test/tint/shadowing/alias/const.wgsl.expected.glsl b/test/tint/shadowing/alias/const.wgsl.expected.glsl new file mode 100644 index 0000000000..0da98e38fe --- /dev/null +++ b/test/tint/shadowing/alias/const.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +void f() { + { + } +} + diff --git a/test/tint/shadowing/alias/const.wgsl.expected.msl b/test/tint/shadowing/alias/const.wgsl.expected.msl new file mode 100644 index 0000000000..ee183f052d --- /dev/null +++ b/test/tint/shadowing/alias/const.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + { + } +} + diff --git a/test/tint/shadowing/alias/const.wgsl.expected.spvasm b/test/tint/shadowing/alias/const.wgsl.expected.spvasm new file mode 100644 index 0000000000..1c4d684e74 --- /dev/null +++ b/test/tint/shadowing/alias/const.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 7 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %void = OpTypeVoid + %1 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %1 + %6 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/shadowing/alias/const.wgsl.expected.wgsl b/test/tint/shadowing/alias/const.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2bdd05cc3 --- /dev/null +++ b/test/tint/shadowing/alias/const.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +type a = i32; + +fn f() { + { + const a : a = a(); + const b = a; + } + const a : a = a(); + const b = a; +} diff --git a/test/tint/shadowing/alias/let.wgsl.expected.hlsl b/test/tint/shadowing/alias/let.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/alias/let.wgsl.expected.hlsl rename to test/tint/shadowing/alias/let.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/alias/let.wgsl.expected.fxc.hlsl b/test/tint/shadowing/alias/let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad5e10450e --- /dev/null +++ b/test/tint/shadowing/alias/let.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + { + const int a_1 = 0; + const int b = a_1; + } + const int a_2 = 0; + const int b = a_2; +} diff --git a/test/tint/shadowing/alias/let.wgsl.expected.msl b/test/tint/shadowing/alias/let.wgsl.expected.msl index acd894e4c2..0b838424ea 100644 --- a/test/tint/shadowing/alias/let.wgsl.expected.msl +++ b/test/tint/shadowing/alias/let.wgsl.expected.msl @@ -3,10 +3,10 @@ using namespace metal; void f() { { - int const a_1 = int(); + int const a_1 = 0; int const b = a_1; } - int const a_2 = int(); + int const a_2 = 0; int const b = a_2; } diff --git a/test/tint/shadowing/alias/param.wgsl.expected.hlsl b/test/tint/shadowing/alias/param.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/alias/param.wgsl.expected.hlsl rename to test/tint/shadowing/alias/param.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/alias/param.wgsl.expected.fxc.hlsl b/test/tint/shadowing/alias/param.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b48a6b1132 --- /dev/null +++ b/test/tint/shadowing/alias/param.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f(int a_1) { + const int b = a_1; +} diff --git a/test/tint/shadowing/alias/var.wgsl.expected.hlsl b/test/tint/shadowing/alias/var.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/alias/var.wgsl.expected.hlsl rename to test/tint/shadowing/alias/var.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/alias/var.wgsl.expected.fxc.hlsl b/test/tint/shadowing/alias/var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b1a2a095e --- /dev/null +++ b/test/tint/shadowing/alias/var.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + { + int a_1 = 0; + int b = a_1; + } + int a_2 = 0; + int b = a_2; +} diff --git a/test/tint/shadowing/alias/var.wgsl.expected.msl b/test/tint/shadowing/alias/var.wgsl.expected.msl index d507d61cb0..8dfd0c9167 100644 --- a/test/tint/shadowing/alias/var.wgsl.expected.msl +++ b/test/tint/shadowing/alias/var.wgsl.expected.msl @@ -3,10 +3,10 @@ using namespace metal; void f() { { - int a_1 = int(); + int a_1 = 0; int b = a_1; } - int a_2 = int(); + int a_2 = 0; int b = a_2; } diff --git a/test/tint/shadowing/function/let.wgsl.expected.hlsl b/test/tint/shadowing/function/let.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/function/let.wgsl.expected.hlsl rename to test/tint/shadowing/function/let.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/function/let.wgsl.expected.fxc.hlsl b/test/tint/shadowing/function/let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..33c805bb67 --- /dev/null +++ b/test/tint/shadowing/function/let.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void a() { + { + int a_1 = 1; + int b = a_1; + } + const int b = 1; +} diff --git a/test/tint/shadowing/function/param.wgsl.expected.hlsl b/test/tint/shadowing/function/param.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/function/param.wgsl.expected.hlsl rename to test/tint/shadowing/function/param.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/function/param.wgsl.expected.fxc.hlsl b/test/tint/shadowing/function/param.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f06b78f7e6 --- /dev/null +++ b/test/tint/shadowing/function/param.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void a(int a_1) { + const int b = a_1; +} diff --git a/test/tint/shadowing/function/var.wgsl.expected.hlsl b/test/tint/shadowing/function/var.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/function/var.wgsl.expected.hlsl rename to test/tint/shadowing/function/var.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/struct/var.wgsl.expected.hlsl b/test/tint/shadowing/function/var.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/shadowing/struct/var.wgsl.expected.hlsl rename to test/tint/shadowing/function/var.wgsl.expected.fxc.hlsl diff --git a/test/tint/shadowing/function/var.wgsl.expected.msl b/test/tint/shadowing/function/var.wgsl.expected.msl index ad6b654015..ddbbafe087 100644 --- a/test/tint/shadowing/function/var.wgsl.expected.msl +++ b/test/tint/shadowing/function/var.wgsl.expected.msl @@ -7,10 +7,10 @@ struct a { void f() { { - a a_1 = {}; + a a_1 = a{}; a b = a_1; } - a a_2 = {}; + a a_2 = a{}; a b = a_2; } diff --git a/test/tint/shadowing/param/function.wgsl.expected.hlsl b/test/tint/shadowing/param/function.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/param/function.wgsl.expected.hlsl rename to test/tint/shadowing/param/function.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/param/function.wgsl.expected.fxc.hlsl b/test/tint/shadowing/param/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..831cce98b1 --- /dev/null +++ b/test/tint/shadowing/param/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void a(int a_1) { + { + int a_2 = a_1; + int b = a_2; + } +} diff --git a/test/tint/shadowing/param/let.wgsl.expected.hlsl b/test/tint/shadowing/param/let.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/param/let.wgsl.expected.hlsl rename to test/tint/shadowing/param/let.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/param/let.wgsl.expected.fxc.hlsl b/test/tint/shadowing/param/let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad522f35a0 --- /dev/null +++ b/test/tint/shadowing/param/let.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f(int a) { + { + const int b = a; + } +} diff --git a/test/tint/shadowing/param/var.wgsl.expected.hlsl b/test/tint/shadowing/param/var.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/param/var.wgsl.expected.hlsl rename to test/tint/shadowing/param/var.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/param/var.wgsl.expected.fxc.hlsl b/test/tint/shadowing/param/var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..33ab9f179f --- /dev/null +++ b/test/tint/shadowing/param/var.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f(int a) { + { + int a_1 = a; + int b = a_1; + } +} diff --git a/test/tint/shadowing/struct/let.wgsl.expected.hlsl b/test/tint/shadowing/struct/let.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/struct/let.wgsl.expected.hlsl rename to test/tint/shadowing/struct/let.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/struct/let.wgsl.expected.fxc.hlsl b/test/tint/shadowing/struct/let.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c4cb81d50c --- /dev/null +++ b/test/tint/shadowing/struct/let.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct a { + int a; +}; + +void f() { + { + const a a_1 = (a)0; + const a b = a_1; + } + const a a_2 = (a)0; + const a b = a_2; +} diff --git a/test/tint/shadowing/struct/let.wgsl.expected.msl b/test/tint/shadowing/struct/let.wgsl.expected.msl index 4780a5ed31..a281f7b348 100644 --- a/test/tint/shadowing/struct/let.wgsl.expected.msl +++ b/test/tint/shadowing/struct/let.wgsl.expected.msl @@ -7,10 +7,10 @@ struct a { void f() { { - a const a_1 = {}; + a const a_1 = a{}; a const b = a_1; } - a const a_2 = {}; + a const a_2 = a{}; a const b = a_2; } diff --git a/test/tint/shadowing/struct/param.wgsl.expected.hlsl b/test/tint/shadowing/struct/param.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/shadowing/struct/param.wgsl.expected.hlsl rename to test/tint/shadowing/struct/param.wgsl.expected.dxc.hlsl diff --git a/test/tint/shadowing/struct/param.wgsl.expected.fxc.hlsl b/test/tint/shadowing/struct/param.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..03c3814c29 --- /dev/null +++ b/test/tint/shadowing/struct/param.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct a { + int a; +}; + +void f(a a_1) { + const a b = a_1; +} diff --git a/test/tint/shadowing/struct/var.wgsl.expected.dxc.hlsl b/test/tint/shadowing/struct/var.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..96ed5410c6 --- /dev/null +++ b/test/tint/shadowing/struct/var.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct a { + int a; +}; + +void f() { + { + a a_1 = (a)0; + a b = a_1; + } + a a_2 = (a)0; + a b = a_2; +} diff --git a/test/tint/shadowing/struct/var.wgsl.expected.fxc.hlsl b/test/tint/shadowing/struct/var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..96ed5410c6 --- /dev/null +++ b/test/tint/shadowing/struct/var.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct a { + int a; +}; + +void f() { + { + a a_1 = (a)0; + a b = a_1; + } + a a_2 = (a)0; + a b = a_2; +} diff --git a/test/tint/shadowing/struct/var.wgsl.expected.msl b/test/tint/shadowing/struct/var.wgsl.expected.msl index ad6b654015..ddbbafe087 100644 --- a/test/tint/shadowing/struct/var.wgsl.expected.msl +++ b/test/tint/shadowing/struct/var.wgsl.expected.msl @@ -7,10 +7,10 @@ struct a { void f() { { - a a_1 = {}; + a a_1 = a{}; a b = a_1; } - a a_2 = {}; + a a_2 = a{}; a b = a_2; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl index 3535da95ff..5f45701401 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f82b13f649 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +struct InnerS { + int v; +}; +struct OuterS { + InnerS a1[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s1 = (OuterS)0; + { + [loop] for(int i = 0; (i < 4); i = (i + 1)) { + { + InnerS tint_symbol_1[8] = s1.a1; + tint_symbol_1[uniforms[0].x] = v; + s1.a1 = tint_symbol_1; + } + } + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.msl index acf0cc60bc..939ff141e8 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -9,19 +22,15 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; + tint_array a1; }; kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s1 = {}; for(int i = 0; (i < 4); i = as_type((as_type(i) + as_type(1)))) { - s1.a1.arr[(*(tint_symbol_1)).i] = v; + s1.a1[(*(tint_symbol_1)).i] = v; } return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.spvasm index 60f11df715..de7d64cfb8 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 44 +; Bound: 43 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -41,9 +41,8 @@ %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS %19 = OpConstantNull %OuterS - %int_0 = OpConstant %int 0 + %20 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %23 = OpConstantNull %int %int_4 = OpConstant %int 4 %bool = OpTypeBool %uint_0 = OpConstant %uint 0 @@ -53,32 +52,32 @@ %8 = OpLabel %v = OpVariable %_ptr_Function_InnerS Function %13 %s1 = OpVariable %_ptr_Function_OuterS Function %19 - %i = OpVariable %_ptr_Function_int Function %23 - OpStore %i %int_0 - OpBranch %24 - %24 = OpLabel - OpLoopMerge %25 %26 None - OpBranch %27 - %27 = OpLabel - %29 = OpLoad %int %i - %31 = OpSLessThan %bool %29 %int_4 - %28 = OpLogicalNot %bool %31 - OpSelectionMerge %33 None - OpBranchConditional %28 %34 %33 - %34 = OpLabel - OpBranch %25 - %33 = OpLabel - %37 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %38 = OpLoad %uint %37 - %39 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %38 - %40 = OpLoad %InnerS %v - OpStore %39 %40 + %i = OpVariable %_ptr_Function_int Function %20 + OpStore %i %20 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None OpBranch %26 %26 = OpLabel - %41 = OpLoad %int %i - %43 = OpIAdd %int %41 %int_1 - OpStore %i %43 + %28 = OpLoad %int %i + %30 = OpSLessThan %bool %28 %int_4 + %27 = OpLogicalNot %bool %30 + OpSelectionMerge %32 None + OpBranchConditional %27 %33 %32 + %33 = OpLabel OpBranch %24 + %32 = OpLabel + %36 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %37 = OpLoad %uint %36 + %38 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %37 + %39 = OpLoad %InnerS %v + OpStore %38 %39 + OpBranch %25 %25 = OpLabel + %40 = OpLoad %int %i + %42 = OpIAdd %int %40 %int_1 + OpStore %i %42 + OpBranch %23 + %24 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.wgsl index 55968e24d3..7a6a4068b2 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl index 2e4d57b7d6..13774ab9f0 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..382880aa98 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.fxc.hlsl @@ -0,0 +1,29 @@ +struct InnerS { + int v; +}; +struct OuterS { + InnerS a1[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s1 = (OuterS)0; + { + int i = 0; + [loop] while (true) { + if (!((i < 4))) { break; } + i = (i + 1); + { + InnerS tint_symbol_1[8] = s1.a1; + tint_symbol_1[uniforms[0].x] = v; + s1.a1 = tint_symbol_1; + } + } + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.msl index 60c282a077..76e27e97eb 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -9,18 +22,14 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; + tint_array a1; }; kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s1 = {}; - for(int i = 0; (i < 4); s1.a1.arr[(*(tint_symbol_1)).i] = v) { + for(int i = 0; (i < 4); s1.a1[(*(tint_symbol_1)).i] = v) { i = as_type((as_type(i) + as_type(1))); } return; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.spvasm index 223d6261b9..47cbb056cc 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 44 +; Bound: 43 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -41,9 +41,8 @@ %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS %19 = OpConstantNull %OuterS - %int_0 = OpConstant %int 0 + %20 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %23 = OpConstantNull %int %int_4 = OpConstant %int 4 %bool = OpTypeBool %int_1 = OpConstant %int 1 @@ -53,32 +52,32 @@ %8 = OpLabel %v = OpVariable %_ptr_Function_InnerS Function %13 %s1 = OpVariable %_ptr_Function_OuterS Function %19 - %i = OpVariable %_ptr_Function_int Function %23 - OpStore %i %int_0 - OpBranch %24 - %24 = OpLabel - OpLoopMerge %25 %26 None - OpBranch %27 - %27 = OpLabel - %29 = OpLoad %int %i - %31 = OpSLessThan %bool %29 %int_4 - %28 = OpLogicalNot %bool %31 - OpSelectionMerge %33 None - OpBranchConditional %28 %34 %33 - %34 = OpLabel - OpBranch %25 - %33 = OpLabel - %35 = OpLoad %int %i - %37 = OpIAdd %int %35 %int_1 - OpStore %i %37 + %i = OpVariable %_ptr_Function_int Function %20 + OpStore %i %20 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None OpBranch %26 %26 = OpLabel - %40 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %41 = OpLoad %uint %40 - %42 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %41 - %43 = OpLoad %InnerS %v - OpStore %42 %43 + %28 = OpLoad %int %i + %30 = OpSLessThan %bool %28 %int_4 + %27 = OpLogicalNot %bool %30 + OpSelectionMerge %32 None + OpBranchConditional %27 %33 %32 + %33 = OpLabel OpBranch %24 + %32 = OpLabel + %34 = OpLoad %int %i + %36 = OpIAdd %int %34 %int_1 + OpStore %i %36 + OpBranch %25 %25 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %40 = OpLoad %uint %39 + %41 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %40 + %42 = OpLoad %InnerS %v + OpStore %41 %42 + OpBranch %23 + %24 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.wgsl index 9e3319d693..38fa45c35a 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl index c2f9b7f7b3..337a5c39fb 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..78f5452e2c --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.fxc.hlsl @@ -0,0 +1,27 @@ +struct InnerS { + int v; +}; +struct OuterS { + InnerS a1[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s1 = (OuterS)0; + int i = 0; + { + { + InnerS tint_symbol_1[8] = s1.a1; + tint_symbol_1[uniforms[0].x] = v; + s1.a1 = tint_symbol_1; + } + [loop] for(; (i < 4); i = (i + 1)) { + } + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.msl index 8f331410d7..82e2101b78 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -9,19 +22,15 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; + tint_array a1; }; kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s1 = {}; int i = 0; - for(s1.a1.arr[(*(tint_symbol_1)).i] = v; (i < 4); i = as_type((as_type(i) + as_type(1)))) { + for(s1.a1[(*(tint_symbol_1)).i] = v; (i < 4); i = as_type((as_type(i) + as_type(1)))) { } return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.spvasm index ccdfdf38b6..e3e61dd652 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 44 +; Bound: 43 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -41,9 +41,8 @@ %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS %19 = OpConstantNull %OuterS - %int_0 = OpConstant %int 0 + %20 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %23 = OpConstantNull %int %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %int_4 = OpConstant %int 4 @@ -53,32 +52,32 @@ %8 = OpLabel %v = OpVariable %_ptr_Function_InnerS Function %13 %s1 = OpVariable %_ptr_Function_OuterS Function %19 - %i = OpVariable %_ptr_Function_int Function %23 - OpStore %i %int_0 - %26 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %27 = OpLoad %uint %26 - %28 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %27 - %29 = OpLoad %InnerS %v - OpStore %28 %29 - OpBranch %30 - %30 = OpLabel - OpLoopMerge %31 %32 None - OpBranch %33 - %33 = OpLabel - %35 = OpLoad %int %i - %37 = OpSLessThan %bool %35 %int_4 - %34 = OpLogicalNot %bool %37 - OpSelectionMerge %39 None - OpBranchConditional %34 %40 %39 - %40 = OpLabel - OpBranch %31 - %39 = OpLabel + %i = OpVariable %_ptr_Function_int Function %20 + OpStore %i %20 + %25 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %26 + %28 = OpLoad %InnerS %v + OpStore %27 %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None OpBranch %32 %32 = OpLabel - %41 = OpLoad %int %i - %43 = OpIAdd %int %41 %int_1 - OpStore %i %43 + %34 = OpLoad %int %i + %36 = OpSLessThan %bool %34 %int_4 + %33 = OpLogicalNot %bool %36 + OpSelectionMerge %38 None + OpBranchConditional %33 %39 %38 + %39 = OpLabel OpBranch %30 + %38 = OpLabel + OpBranch %31 %31 = OpLabel + %40 = OpLoad %int %i + %42 = OpIAdd %int %40 %int_1 + OpStore %i %42 + OpBranch %29 + %30 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.wgsl index 6efc2590d0..ef5ab682bf 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl index 6bd7876f8b..42c6cd02eb 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl @@ -23,7 +23,7 @@ fn getNextIndex() -> u32 { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e80d207c0d --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.fxc.hlsl @@ -0,0 +1,36 @@ +struct InnerS { + int v; +}; +struct S1 { + InnerS a2[8]; +}; +struct OuterS { + S1 a1[8]; +}; + +static uint nextIndex = 0u; + +uint getNextIndex() { + nextIndex = (nextIndex + 1u); + return nextIndex; +} + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s = (OuterS)0; + { + S1 tint_symbol_1[8] = s.a1; + const uint tint_symbol_4 = getNextIndex(); + const uint tint_symbol_2_save = tint_symbol_4; + InnerS tint_symbol_3[8] = tint_symbol_1[tint_symbol_2_save].a2; + tint_symbol_3[uniforms[0].y] = v; + tint_symbol_1[tint_symbol_2_save].a2 = tint_symbol_3; + s.a1 = tint_symbol_1; + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.msl index 765233767d..7b606ba7e6 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; /* 0x0004 */ uint j; @@ -10,34 +23,26 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct S1 { - tint_array_wrapper a2; -}; - -struct tint_array_wrapper_1 { - S1 arr[8]; + tint_array a2; }; struct OuterS { - tint_array_wrapper_1 a1; + tint_array a1; }; -uint getNextIndex(thread uint* const tint_symbol_3) { - *(tint_symbol_3) = (*(tint_symbol_3) + 1u); - return *(tint_symbol_3); +uint getNextIndex() { + thread uint tint_symbol_3 = 0u; + tint_symbol_3 = (tint_symbol_3 + 1u); + return tint_symbol_3; } -kernel void tint_symbol(const constant Uniforms* tint_symbol_5 [[buffer(0)]]) { - thread uint tint_symbol_4 = 0u; +kernel void tint_symbol(const constant Uniforms* tint_symbol_4 [[buffer(0)]]) { InnerS v = {}; OuterS s = {}; InnerS const tint_symbol_1 = v; - uint const tint_symbol_2 = getNextIndex(&(tint_symbol_4)); - s.a1.arr[tint_symbol_2].a2.arr[(*(tint_symbol_5)).j] = tint_symbol_1; + uint const tint_symbol_2 = getNextIndex(); + s.a1[tint_symbol_2].a2[(*(tint_symbol_4)).j] = tint_symbol_1; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.wgsl index 00f96caf2d..11d871ecce 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.wgsl @@ -24,7 +24,7 @@ fn getNextIndex() -> u32 { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl index 32f96032fb..6e98f33d3e 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15ddcb2011 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +struct InnerS { + int v; +}; +struct OuterS { + InnerS a1[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s1 = (OuterS)0; + { + InnerS tint_symbol_1[8] = s1.a1; + tint_symbol_1[uniforms[0].x] = v; + s1.a1 = tint_symbol_1; + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.msl index 17a3a5e16d..6e93e3132f 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -9,18 +22,14 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; + tint_array a1; }; kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s1 = {}; - s1.a1.arr[(*(tint_symbol_1)).i] = v; + s1.a1[(*(tint_symbol_1)).i] = v; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.wgsl index 9599c41ea0..bb5dd3ac7a 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl index 76bed78f81..b4cb7ab780 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl @@ -13,7 +13,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6ebca2ea12 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +struct InnerS { + int v; +}; +struct OuterS { + InnerS a1[8][8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s1 = (OuterS)0; + { + InnerS tint_symbol_1[8][8] = s1.a1; + tint_symbol_1[uniforms[0].x][uniforms[0].y] = v; + s1.a1 = tint_symbol_1; + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.msl index 12691cd6ba..05ae52c23c 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; /* 0x0004 */ uint j; @@ -10,22 +23,14 @@ struct InnerS { int v; }; -struct tint_array_wrapper_1 { - InnerS arr[8]; -}; - -struct tint_array_wrapper { - tint_array_wrapper_1 arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; + tint_array, 8> a1; }; kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s1 = {}; - s1.a1.arr[(*(tint_symbol_1)).i].arr[(*(tint_symbol_1)).j] = v; + s1.a1[(*(tint_symbol_1)).i][(*(tint_symbol_1)).j] = v; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.wgsl index db8818346f..6da6de056c 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.wgsl @@ -13,7 +13,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl index ea9bdb3fa7..31a2fa1c2f 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl @@ -16,7 +16,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..24cee3d2d0 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +struct InnerS { + int v; +}; +struct S1 { + InnerS s2; +}; +struct OuterS { + S1 a1[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s1 = (OuterS)0; + { + S1 tint_symbol_1[8] = s1.a1; + tint_symbol_1[uniforms[0].x].s2 = v; + s1.a1 = tint_symbol_1; + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.msl index 768693939b..9ad4660118 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -13,18 +26,14 @@ struct S1 { InnerS s2; }; -struct tint_array_wrapper { - S1 arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; + tint_array a1; }; kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s1 = {}; - s1.a1.arr[(*(tint_symbol_1)).i].s2 = v; + s1.a1[(*(tint_symbol_1)).i].s2 = v; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.wgsl index 820aee6406..6315970d42 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl index feadd47c29..b9f558bdb8 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl @@ -17,7 +17,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f4113725bf --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,28 @@ +struct InnerS { + int v; +}; +struct S1 { + InnerS a2[8]; +}; +struct OuterS { + S1 a1[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s = (OuterS)0; + { + S1 tint_symbol_1[8] = s.a1; + const uint tint_symbol_2_save = uniforms[0].x; + InnerS tint_symbol_3[8] = tint_symbol_1[tint_symbol_2_save].a2; + tint_symbol_3[uniforms[0].y] = v; + tint_symbol_1[tint_symbol_2_save].a2 = tint_symbol_3; + s.a1 = tint_symbol_1; + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.msl index a638c3fdcd..c92d7c4db7 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; /* 0x0004 */ uint j; @@ -10,26 +23,18 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct S1 { - tint_array_wrapper a2; -}; - -struct tint_array_wrapper_1 { - S1 arr[8]; + tint_array a2; }; struct OuterS { - tint_array_wrapper_1 a1; + tint_array a1; }; kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s = {}; - s.a1.arr[(*(tint_symbol_1)).i].a2.arr[(*(tint_symbol_1)).j] = v; + s.a1[(*(tint_symbol_1)).i].a2[(*(tint_symbol_1)).j] = v; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.wgsl index da8bd0f150..e77fa87d7f 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.wgsl @@ -17,7 +17,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl index 82aaf7f320..12f615b11b 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl @@ -13,7 +13,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; @binding(0) @group(0) var s1 : OuterS; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; s1.a1[uniforms.i] = v; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ae06055e9 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +struct InnerS { + int v; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; +RWByteAddressBuffer s1 : register(u0, space0); + +void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, InnerS value) { + buffer.Store((offset + 0u), asuint(value.v)); +} + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + tint_symbol_1(s1, (4u * uniforms[0].x), v); + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.msl index 6d0fc32343..ac9d29d02f 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -10,7 +23,7 @@ struct InnerS { }; struct OuterS { - /* 0x0000 */ InnerS a1[1]; + /* 0x0000 */ tint_array a1; }; kernel void tint_symbol(device OuterS* tint_symbol_1 [[buffer(1)]], const constant Uniforms* tint_symbol_2 [[buffer(0)]]) { diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.wgsl index ad1319f802..75b704d1b5 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.wgsl @@ -14,7 +14,7 @@ struct OuterS { @binding(0) @group(0) var s1 : OuterS; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; s1.a1[uniforms.i] = v; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl index 639acf24b3..be7cf3d850 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl @@ -18,7 +18,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; @binding(0) @group(0) var s : OuterS; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; s.a1[uniforms.i].a2[uniforms.j] = v; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..222fd91b33 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +struct InnerS { + int v; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; +RWByteAddressBuffer s : register(u0, space0); + +void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, InnerS value) { + buffer.Store((offset + 0u), asuint(value.v)); +} + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + tint_symbol_1(s, ((32u * uniforms[0].x) + (4u * uniforms[0].y)), v); + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.msl index 2b230841f4..b9abd212d3 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; /* 0x0004 */ uint j; @@ -10,21 +23,17 @@ struct InnerS { /* 0x0000 */ int v; }; -struct tint_array_wrapper { - /* 0x0000 */ InnerS arr[8]; -}; - struct S1 { - /* 0x0000 */ tint_array_wrapper a2; + /* 0x0000 */ tint_array a2; }; struct OuterS { - /* 0x0000 */ S1 a1[1]; + /* 0x0000 */ tint_array a1; }; kernel void tint_symbol(device OuterS* tint_symbol_1 [[buffer(1)]], const constant Uniforms* tint_symbol_2 [[buffer(0)]]) { InnerS v = {}; - (*(tint_symbol_1)).a1[(*(tint_symbol_2)).i].a2.arr[(*(tint_symbol_2)).j] = v; + (*(tint_symbol_1)).a1[(*(tint_symbol_2)).i].a2[(*(tint_symbol_2)).j] = v; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.wgsl index 7c2bd053f6..8935d5339b 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.wgsl @@ -19,7 +19,7 @@ struct OuterS { @binding(0) @group(0) var s : OuterS; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; s.a1[uniforms.i].a2[uniforms.j] = v; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl index 5065ae43cc..9a024e410d 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl @@ -8,7 +8,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; s1.m1[uniforms.i] = vec4(1.0); diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.dxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0ec20f0f8f --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,33 @@ +void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { + switch (col) { + case 0: mat[0] = val; break; + case 1: mat[1] = val; break; + } +} + +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +struct OuterS { + float2x4 m1; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + OuterS s1 = (OuterS)0; + set_vector_float2x4(s1.m1, uniforms[0].x, (1.0f).xxxx); + set_scalar_float2x4(s1.m1, uniforms[0].x, uniforms[0].x, 1.0f); + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0ec20f0f8f --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,33 @@ +void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { + switch (col) { + case 0: mat[0] = val; break; + case 1: mat[1] = val; break; + } +} + +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +struct OuterS { + float2x4 m1; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + OuterS s1 = (OuterS)0; + set_vector_float2x4(s1.m1, uniforms[0].x, (1.0f).xxxx); + set_scalar_float2x4(s1.m1, uniforms[0].x, uniforms[0].x, 1.0f); + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.hlsl deleted file mode 100644 index 819665dc43..0000000000 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -void set_vector_float2x4(inout float2x4 mat, int col, float4 val) { - switch (col) { - case 0: mat[0] = val; break; - case 1: mat[1] = val; break; - } -} - -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; - break; - case 1: - mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; - break; - } -} - -struct OuterS { - float2x4 m1; -}; - -cbuffer cbuffer_uniforms : register(b4, space1) { - uint4 uniforms[1]; -}; - -[numthreads(1, 1, 1)] -void main() { - OuterS s1 = (OuterS)0; - set_vector_float2x4(s1.m1, uniforms[0].x, float4((1.0f).xxxx)); - set_scalar_float2x4(s1.m1, uniforms[0].x, uniforms[0].x, 1.0f); - return; -} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.wgsl index f24bd46bc3..7e843846f7 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.wgsl @@ -8,7 +8,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; s1.m1[uniforms.i] = vec4(1.0); diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl index 8e838306ab..713d9100a4 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl @@ -13,7 +13,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aa6d6bc26c --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.fxc.hlsl @@ -0,0 +1,28 @@ +struct InnerS { + int v; +}; +struct OuterS { + InnerS a1[8]; + InnerS a2[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s1 = (OuterS)0; + { + InnerS tint_symbol_1[8] = s1.a1; + tint_symbol_1[uniforms[0].x] = v; + s1.a1 = tint_symbol_1; + } + { + InnerS tint_symbol_3[8] = s1.a2; + tint_symbol_3[uniforms[0].x] = v; + s1.a2 = tint_symbol_3; + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.msl index 3a268a0fdf..6bdd4e5b9c 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -9,20 +22,16 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; - tint_array_wrapper a2; + tint_array a1; + tint_array a2; }; kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s1 = {}; - s1.a1.arr[(*(tint_symbol_1)).i] = v; - s1.a2.arr[(*(tint_symbol_1)).i] = v; + s1.a1[(*(tint_symbol_1)).i] = v; + s1.a2[(*(tint_symbol_1)).i] = v; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.wgsl index 63096f13fd..d988487492 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.wgsl @@ -13,7 +13,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl index f782c62b00..fa749e8ac5 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl @@ -16,7 +16,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..47f844cb55 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +struct InnerS { + int v; +}; +struct S1 { + InnerS a[8]; +}; +struct OuterS { + S1 s2; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s1 = (OuterS)0; + { + InnerS tint_symbol_1[8] = s1.s2.a; + tint_symbol_1[uniforms[0].x] = v; + s1.s2.a = tint_symbol_1; + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.msl index 2d164b24af..375695c70f 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -9,12 +22,8 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct S1 { - tint_array_wrapper a; + tint_array a; }; struct OuterS { @@ -24,7 +33,7 @@ struct OuterS { kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s1 = {}; - s1.s2.a.arr[(*(tint_symbol_1)).i] = v; + s1.s2.a[(*(tint_symbol_1)).i] = v; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.wgsl index 1d27da44fa..71085072fe 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.wgsl @@ -16,7 +16,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl index 99c85a995d..1cb39fb097 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl @@ -8,7 +8,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; s1.v1[uniforms.i] = 1.0; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dc3f4150c2 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +struct OuterS { + float3 v1; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + OuterS s1 = (OuterS)0; + set_float3(s1.v1, uniforms[0].x, 1.0f); + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.wgsl index 13a4ebc5de..5f4da8ce01 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.wgsl @@ -8,7 +8,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; s1.v1[uniforms.i] = 1.0; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl index 639300ee79..225d858079 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl @@ -12,7 +12,7 @@ fn f(i: u32) -> u32 { return i + 1u; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; var v : vec3; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2d0a255767 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +struct OuterS { + uint a1[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +uint f(uint i) { + return (i + 1u); +} + +[numthreads(1, 1, 1)] +void main() { + OuterS s1 = (OuterS)0; + float3 v = float3(0.0f, 0.0f, 0.0f); + set_float3(v, s1.a1[uniforms[0].x], 1.0f); + const uint tint_symbol = f(s1.a1[uniforms[0].x]); + set_float3(v, tint_symbol, 1.0f); + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.msl index 766be46d72..bccd603326 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.msl @@ -1,16 +1,25 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; -struct tint_array_wrapper { - uint arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; + tint_array a1; }; uint f(uint i) { @@ -20,8 +29,8 @@ uint f(uint i) { kernel void tint_symbol(const constant Uniforms* tint_symbol_2 [[buffer(0)]]) { OuterS s1 = {}; float3 v = 0.0f; - v[s1.a1.arr[(*(tint_symbol_2)).i]] = 1.0f; - uint const tint_symbol_1 = f(s1.a1.arr[(*(tint_symbol_2)).i]); + v[s1.a1[(*(tint_symbol_2)).i]] = 1.0f; + uint const tint_symbol_1 = f(s1.a1[(*(tint_symbol_2)).i]); v[tint_symbol_1] = 1.0f; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.wgsl index 47d2e7b2e8..9282fd06e6 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.wgsl @@ -12,7 +12,7 @@ fn f(i : u32) -> u32 { return (i + 1u); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; var v : vec3; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl index 7776cd23c3..278ed92cd4 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8cedd87bd3 --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +struct InnerS { + int v; +}; +struct OuterS { + InnerS a1[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + InnerS v = (InnerS)0; + OuterS s1 = (OuterS)0; + const uint p_save = uniforms[0].x; + { + InnerS tint_symbol_1[8] = s1.a1; + tint_symbol_1[p_save] = v; + s1.a1 = tint_symbol_1; + } + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.msl index 2f71f6e9bf..573c5670aa 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -9,19 +22,15 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; + tint_array a1; }; kernel void tint_symbol(const constant Uniforms* tint_symbol_1 [[buffer(0)]]) { InnerS v = {}; OuterS s1 = {}; uint const p_save = (*(tint_symbol_1)).i; - s1.a1.arr[p_save] = v; + s1.a1[p_save] = v; return; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.wgsl index acd635d5eb..3db9dea741 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.wgsl @@ -12,7 +12,7 @@ struct OuterS { @group(1) @binding(4) var uniforms : Uniforms; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : InnerS; var s1 : OuterS; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl index fa1ad43fec..950f267b64 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl @@ -14,7 +14,7 @@ fn f(p : ptr) { (*p).a1[uniforms.i] = v; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; f(&s1); diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.hlsl rename to test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bdaae4df4f --- /dev/null +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.fxc.hlsl @@ -0,0 +1,26 @@ +struct InnerS { + int v; +}; +struct OuterS { + InnerS a1[8]; +}; + +cbuffer cbuffer_uniforms : register(b4, space1) { + uint4 uniforms[1]; +}; + +void f(inout OuterS p) { + InnerS v = (InnerS)0; + { + InnerS tint_symbol_1[8] = p.a1; + tint_symbol_1[uniforms[0].x] = v; + p.a1 = tint_symbol_1; + } +} + +[numthreads(1, 1, 1)] +void main() { + OuterS s1 = (OuterS)0; + f(s1); + return; +} diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.msl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.msl index 6ceb36f872..9d025d3661 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.msl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct Uniforms { /* 0x0000 */ uint i; }; @@ -9,17 +22,13 @@ struct InnerS { int v; }; -struct tint_array_wrapper { - InnerS arr[8]; -}; - struct OuterS { - tint_array_wrapper a1; + tint_array a1; }; void f(thread OuterS* const p, const constant Uniforms* const tint_symbol_1) { InnerS v = {}; - (*(p)).a1.arr[(*(tint_symbol_1)).i] = v; + (*(p)).a1[(*(tint_symbol_1)).i] = v; } kernel void tint_symbol(const constant Uniforms* tint_symbol_2 [[buffer(0)]]) { diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.wgsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.wgsl index cebf11274b..8e8c553a45 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.wgsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.wgsl @@ -17,7 +17,7 @@ fn f(p : ptr) { (*(p)).a1[uniforms.i] = v; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var s1 : OuterS; f(&(s1)); diff --git a/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl index 0b07b795d6..601a023a1e 100644 --- a/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl +++ b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl @@ -4,7 +4,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = &s; } diff --git a/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.hlsl b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.hlsl rename to test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.hlsl b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.fxc.hlsl similarity index 100% rename from test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.hlsl rename to test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.fxc.hlsl diff --git a/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.msl b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.msl index 2f292658a1..90a2b8dd19 100644 --- a/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.msl +++ b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.msl @@ -1,8 +1,21 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { - int arr[1]; + tint_array arr; }; kernel void tint_symbol() { diff --git a/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.spvasm b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.spvasm index 36a09629dc..91198147ba 100644 --- a/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.spvasm +++ b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 11 +; Bound: 10 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 diff --git a/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.wgsl b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.wgsl index 4bb4719e1a..0f263ac63e 100644 --- a/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.wgsl +++ b/test/tint/statements/assign/phony/addr_of_non_constructable.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = &(s); } diff --git a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl index 4d7a31985c..b83a8f9e77 100644 --- a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl +++ b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl @@ -4,7 +4,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = &s.arr; } diff --git a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.hlsl b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/phony/storage_buffer.wgsl.expected.hlsl rename to test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..146b286402 --- /dev/null +++ b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +RWByteAddressBuffer s : register(u0, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.msl b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.msl index 2f292658a1..90a2b8dd19 100644 --- a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.msl +++ b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.msl @@ -1,8 +1,21 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { - int arr[1]; + tint_array arr; }; kernel void tint_symbol() { diff --git a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.spvasm b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.spvasm index 8a335943f5..91198147ba 100644 --- a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.spvasm +++ b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 10 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -23,11 +23,7 @@ %s = OpVariable %_ptr_StorageBuffer_S StorageBuffer %void = OpTypeVoid %6 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_StorageBuffer__runtimearr_int = OpTypePointer StorageBuffer %_runtimearr_int %main = OpFunction %void None %6 %9 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer__runtimearr_int %s %uint_0 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.wgsl b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.wgsl index d16ffd29ab..a7509e08f1 100644 --- a/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.wgsl +++ b/test/tint/statements/assign/phony/addr_of_runtime_array.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = &(s.arr); } diff --git a/test/tint/statements/assign/phony/call.wgsl b/test/tint/statements/assign/phony/call.wgsl index 5f44585890..133e3d5f16 100644 --- a/test/tint/statements/assign/phony/call.wgsl +++ b/test/tint/statements/assign/phony/call.wgsl @@ -2,7 +2,7 @@ fn f(a: i32, b: i32, c: i32) -> i32 { return a * b + c; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = f(1, 2, 3); } diff --git a/test/tint/statements/assign/phony/call.wgsl.expected.hlsl b/test/tint/statements/assign/phony/call.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/phony/call.wgsl.expected.hlsl rename to test/tint/statements/assign/phony/call.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/phony/call.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/phony/call.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3d18ac9c64 --- /dev/null +++ b/test/tint/statements/assign/phony/call.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +int f(int a, int b, int c) { + return ((a * b) + c); +} + +[numthreads(1, 1, 1)] +void main() { + f(1, 2, 3); + return; +} diff --git a/test/tint/statements/assign/phony/call.wgsl.expected.wgsl b/test/tint/statements/assign/phony/call.wgsl.expected.wgsl index cef5c5f1eb..5c3d1f7932 100644 --- a/test/tint/statements/assign/phony/call.wgsl.expected.wgsl +++ b/test/tint/statements/assign/phony/call.wgsl.expected.wgsl @@ -2,7 +2,7 @@ fn f(a : i32, b : i32, c : i32) -> i32 { return ((a * b) + c); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = f(1, 2, 3); } diff --git a/test/tint/statements/assign/phony/multiple_side_effects.wgsl b/test/tint/statements/assign/phony/multiple_side_effects.wgsl index da2faf8f35..61abe471ae 100644 --- a/test/tint/statements/assign/phony/multiple_side_effects.wgsl +++ b/test/tint/statements/assign/phony/multiple_side_effects.wgsl @@ -2,7 +2,7 @@ fn f(a: i32, b: i32, c: i32) -> i32 { return a * b + c; } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = f(1, 2, 3) + f(4, 5, 6) * f(7, f(8, 9, 10), 11); } diff --git a/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.hlsl b/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.hlsl rename to test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..12c8813a15 --- /dev/null +++ b/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +int f(int a, int b, int c) { + return ((a * b) + c); +} + +[numthreads(1, 1, 1)] +void main() { + const int tint_symbol = f(1, 2, 3); + const int tint_symbol_1 = f(4, 5, 6); + const int tint_symbol_2 = f(8, 9, 10); + const int tint_symbol_3 = f(7, tint_symbol_2, 11); + return; +} diff --git a/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.spvasm b/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.spvasm index 7b0f464f4e..cde6ee0535 100644 --- a/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.spvasm +++ b/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -42,7 +42,5 @@ %18 = OpFunctionCall %int %f %int_4 %int_5 %int_6 %22 = OpFunctionCall %int %f %int_8 %int_9 %int_10 %26 = OpFunctionCall %int %f %int_7 %22 %int_11 - %29 = OpIMul %int %18 %26 - %30 = OpIAdd %int %14 %29 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.wgsl b/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.wgsl index e438785ccd..0e54c4e990 100644 --- a/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.wgsl +++ b/test/tint/statements/assign/phony/multiple_side_effects.wgsl.expected.wgsl @@ -2,7 +2,7 @@ fn f(a : i32, b : i32, c : i32) -> i32 { return ((a * b) + c); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = (f(1, 2, 3) + (f(4, 5, 6) * f(7, f(8, 9, 10), 11))); } diff --git a/test/tint/statements/assign/phony/storage_buffer.wgsl b/test/tint/statements/assign/phony/storage_buffer.wgsl index caf8296339..848aa2d079 100644 --- a/test/tint/statements/assign/phony/storage_buffer.wgsl +++ b/test/tint/statements/assign/phony/storage_buffer.wgsl @@ -4,7 +4,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = s; _ = s.i; diff --git a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.dxc.hlsl b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..146b286402 --- /dev/null +++ b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +RWByteAddressBuffer s : register(u0, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..146b286402 --- /dev/null +++ b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +RWByteAddressBuffer s : register(u0, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.spvasm b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.spvasm index ff08f0d3e6..41a786bd17 100644 --- a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.spvasm +++ b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 13 +; Bound: 9 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -21,11 +21,7 @@ %s = OpVariable %_ptr_StorageBuffer_S StorageBuffer %void = OpTypeVoid %5 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %main = OpFunction %void None %5 %8 = OpLabel - %12 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.wgsl b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.wgsl index 90c096d3f7..5e13684864 100644 --- a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.wgsl +++ b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @binding(0) @group(0) var s : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = s; _ = s.i; diff --git a/test/tint/statements/assign/phony/uniform_buffer.wgsl b/test/tint/statements/assign/phony/uniform_buffer.wgsl index 5ad1e644c3..0262fafbc8 100644 --- a/test/tint/statements/assign/phony/uniform_buffer.wgsl +++ b/test/tint/statements/assign/phony/uniform_buffer.wgsl @@ -4,7 +4,7 @@ struct S { @binding(0) @group(0) var u : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = u; _ = u.i; diff --git a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.hlsl b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.hlsl rename to test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.fxc.hlsl b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..35f86d85fc --- /dev/null +++ b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +cbuffer cbuffer_u : register(b0, space0) { + uint4 u[1]; +}; + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.spvasm b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.spvasm index aa242e7805..06508a884e 100644 --- a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.spvasm +++ b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 13 +; Bound: 9 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -22,11 +22,7 @@ %u = OpVariable %_ptr_Uniform_S Uniform %void = OpTypeVoid %5 = OpTypeFunction %void - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Uniform_int = OpTypePointer Uniform %int %main = OpFunction %void None %5 %8 = OpLabel - %12 = OpAccessChain %_ptr_Uniform_int %u %uint_0 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.wgsl b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.wgsl index 22a3bc1d4a..33521d99e6 100644 --- a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.wgsl +++ b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.wgsl @@ -4,7 +4,7 @@ struct S { @binding(0) @group(0) var u : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = u; _ = u.i; diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.hlsl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/complex_lhs.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/complex_lhs.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9c2c3d2bd --- /dev/null +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.fxc.hlsl @@ -0,0 +1,32 @@ +void set_int4(inout int4 vec, int idx, int val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int4 a[4]; +}; + +static int counter = 0; + +int foo() { + counter = (counter + 1); + return counter; +} + +int bar() { + counter = (counter + 2); + return counter; +} + +void main() { + S x = (S)0; + const int tint_symbol_2 = foo(); + const int tint_symbol_save = tint_symbol_2; + const int tint_symbol_1 = bar(); + set_int4(x.a[tint_symbol_save], tint_symbol_1, (x.a[tint_symbol_save][tint_symbol_1] + 5)); +} diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.glsl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.glsl index 9c1036497b..2274dde605 100644 --- a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.glsl @@ -20,7 +20,7 @@ int bar() { } void tint_symbol() { - S x = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0))); + S x = S(ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0))); int tint_symbol_3 = foo(); int tint_symbol_1_save = tint_symbol_3; int tint_symbol_2 = bar(); diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.msl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.msl index 6a6d978b9e..3c7c47a353 100644 --- a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct tint_array_wrapper { - int4 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct S { - tint_array_wrapper a; + tint_array a; }; int foo(thread int* const tint_symbol_4) { @@ -20,10 +29,10 @@ int bar(thread int* const tint_symbol_5) { } void tint_symbol(thread int* const tint_symbol_6) { - S x = {}; + S x = S{}; int const tint_symbol_3 = foo(tint_symbol_6); int const tint_symbol_1_save = tint_symbol_3; int const tint_symbol_2 = bar(tint_symbol_6); - x.a.arr[tint_symbol_1_save][tint_symbol_2] = as_type((as_type(x.a.arr[tint_symbol_1_save][tint_symbol_2]) + as_type(5))); + x.a[tint_symbol_1_save][tint_symbol_2] = as_type((as_type(x.a[tint_symbol_1_save][tint_symbol_2]) + as_type(5))); } diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.hlsl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b90f3577b4 --- /dev/null +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int a = 0; +static float b = 0.0f; + +void foo(int maybe_zero) { + a = (a / 1); + a = (a % 1); + a = (a / (maybe_zero == 0 ? 1 : maybe_zero)); + a = (a % (maybe_zero == 0 ? 1 : maybe_zero)); + b = (b / 0.0f); + b = (b % 0.0f); + b = (b / float(maybe_zero)); + b = (b % float(maybe_zero)); +} diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.msl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.msl index a6e7d86144..aa0605fc58 100644 --- a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.msl @@ -1,14 +1,16 @@ #include using namespace metal; -void foo(int maybe_zero, thread int* const tint_symbol, thread float* const tint_symbol_1) { - *(tint_symbol) = (*(tint_symbol) / 0); - *(tint_symbol) = (*(tint_symbol) % 0); - *(tint_symbol) = (*(tint_symbol) / maybe_zero); - *(tint_symbol) = (*(tint_symbol) % maybe_zero); - *(tint_symbol_1) = (*(tint_symbol_1) / 0.0f); - *(tint_symbol_1) = fmod(*(tint_symbol_1), 0.0f); - *(tint_symbol_1) = (*(tint_symbol_1) / float(maybe_zero)); - *(tint_symbol_1) = fmod(*(tint_symbol_1), float(maybe_zero)); +void foo(int maybe_zero) { + thread int tint_symbol = 0; + thread float tint_symbol_1 = 0.0f; + tint_symbol = (tint_symbol / 0); + tint_symbol = (tint_symbol % 0); + tint_symbol = (tint_symbol / maybe_zero); + tint_symbol = (tint_symbol % maybe_zero); + tint_symbol_1 = (tint_symbol_1 / 0.0f); + tint_symbol_1 = fmod(tint_symbol_1, 0.0f); + tint_symbol_1 = (tint_symbol_1 / float(maybe_zero)); + tint_symbol_1 = fmod(tint_symbol_1, float(maybe_zero)); } diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm index 45e0f0f044..c5bc009db6 100644 --- a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 37 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -23,8 +23,6 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %13 = OpTypeFunction %void %int - %int_0 = OpConstant %int 0 - %float_0 = OpConstant %float 0 %unused_entry_point = OpFunction %void None %9 %12 = OpLabel OpReturn @@ -33,30 +31,30 @@ %maybe_zero = OpFunctionParameter %int %16 = OpLabel %17 = OpLoad %int %a - %19 = OpSDiv %int %17 %int_0 - OpStore %a %19 - %20 = OpLoad %int %a - %21 = OpSMod %int %20 %int_0 - OpStore %a %21 - %22 = OpLoad %int %a - %23 = OpSDiv %int %22 %maybe_zero - OpStore %a %23 - %24 = OpLoad %int %a - %25 = OpSMod %int %24 %maybe_zero - OpStore %a %25 - %26 = OpLoad %float %b - %28 = OpFDiv %float %26 %float_0 + %18 = OpSDiv %int %17 %4 + OpStore %a %18 + %19 = OpLoad %int %a + %20 = OpSMod %int %19 %4 + OpStore %a %20 + %21 = OpLoad %int %a + %22 = OpSDiv %int %21 %maybe_zero + OpStore %a %22 + %23 = OpLoad %int %a + %24 = OpSMod %int %23 %maybe_zero + OpStore %a %24 + %25 = OpLoad %float %b + %26 = OpFDiv %float %25 %8 + OpStore %b %26 + %27 = OpLoad %float %b + %28 = OpFRem %float %27 %8 OpStore %b %28 %29 = OpLoad %float %b - %30 = OpFRem %float %29 %float_0 - OpStore %b %30 - %31 = OpLoad %float %b - %32 = OpConvertSToF %float %maybe_zero - %33 = OpFDiv %float %31 %32 - OpStore %b %33 - %34 = OpLoad %float %b - %35 = OpConvertSToF %float %maybe_zero - %36 = OpFRem %float %34 %35 - OpStore %b %36 + %30 = OpConvertSToF %float %maybe_zero + %31 = OpFDiv %float %29 %30 + OpStore %b %31 + %32 = OpLoad %float %b + %33 = OpConvertSToF %float %maybe_zero + %34 = OpFRem %float %32 %33 + OpStore %b %34 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.hlsl b/test/tint/statements/compound_assign/for_loop.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/for_loop.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/for_loop.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/for_loop.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..53bd1a045f --- /dev/null +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.fxc.hlsl @@ -0,0 +1,44 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); +static uint i = 0u; + +int idx1() { + i = (i + 1u); + return 1; +} + +int idx2() { + i = (i + 2u); + return 1; +} + +int idx3() { + i = (i + 3u); + return 1; +} + +void foo() { + float a[4] = (float[4])0; + const int tint_symbol_2 = idx1(); + const int tint_symbol_save = tint_symbol_2; + { + a[tint_symbol_save] = (a[tint_symbol_save] * 2.0f); + [loop] while (true) { + const int tint_symbol_3 = idx2(); + if (!((a[tint_symbol_3] < 10.0f))) { + break; + } + { + } + { + const int tint_symbol_4 = idx3(); + const int tint_symbol_1_save = tint_symbol_4; + a[tint_symbol_1_save] = (a[tint_symbol_1_save] + 1.0f); + } + } + } +} diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.msl b/test/tint/statements/compound_assign/for_loop.wgsl.expected.msl index 4fb8c50eff..36309e9920 100644 --- a/test/tint/statements/compound_assign/for_loop.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { int a; float4 b; @@ -22,19 +35,15 @@ int idx3(thread uint* const tint_symbol_7) { return 1; } -struct tint_array_wrapper { - float arr[4]; -}; - void foo(thread uint* const tint_symbol_8) { - tint_array_wrapper a = {.arr={}}; + tint_array a = tint_array{}; int const tint_symbol_2 = idx1(tint_symbol_8); int const tint_symbol_save = tint_symbol_2; { - a.arr[tint_symbol_save] = (a.arr[tint_symbol_save] * 2.0f); + a[tint_symbol_save] = (a[tint_symbol_save] * 2.0f); while (true) { int const tint_symbol_3 = idx2(tint_symbol_8); - if (!((a.arr[tint_symbol_3] < 10.0f))) { + if (!((a[tint_symbol_3] < 10.0f))) { break; } { @@ -42,7 +51,7 @@ void foo(thread uint* const tint_symbol_8) { { int const tint_symbol_4 = idx3(tint_symbol_8); int const tint_symbol_1_save = tint_symbol_4; - a.arr[tint_symbol_1_save] = (a.arr[tint_symbol_1_save] + 1.0f); + a[tint_symbol_1_save] = (a[tint_symbol_1_save] + 1.0f); } } } diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/function.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bfdebdb6dc --- /dev/null +++ b/test/tint/statements/compound_assign/function.wgsl.expected.dxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void foo() { + int a = 0; + float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + a = (a / 2); + b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); + c = (c * 2.0f); +} diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bfdebdb6dc --- /dev/null +++ b/test/tint/statements/compound_assign/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void foo() { + int a = 0; + float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + a = (a / 2); + b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); + c = (c * 2.0f); +} diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.glsl b/test/tint/statements/compound_assign/function.wgsl.expected.glsl index d2c4d9be91..7b4c01c6de 100644 --- a/test/tint/statements/compound_assign/function.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/function.wgsl.expected.glsl @@ -9,7 +9,7 @@ void foo() { vec4 b = vec4(0.0f, 0.0f, 0.0f, 0.0f); mat2 c = mat2(0.0f, 0.0f, 0.0f, 0.0f); a = (a / 2); - b = (b * mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); + b = (b * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); c = (c * 2.0f); } diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.hlsl b/test/tint/statements/compound_assign/function.wgsl.expected.hlsl deleted file mode 100644 index da9f1de7bd..0000000000 --- a/test/tint/statements/compound_assign/function.wgsl.expected.hlsl +++ /dev/null @@ -1,13 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -void foo() { - int a = 0; - float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f); - float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - a = (a / 2); - b = mul(float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), b); - c = (c * 2.0f); -} diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.msl b/test/tint/statements/compound_assign/function.wgsl.expected.msl index 608c013c00..3acbce949b 100644 --- a/test/tint/statements/compound_assign/function.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/function.wgsl.expected.msl @@ -6,7 +6,7 @@ void foo() { float4 b = 0.0f; float2x2 c = float2x2(0.0f); a = (a / 2); - b = (b * float4x4()); + b = (b * float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f))); c = (c * 2.0f); } diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b0784defc --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.dxc.hlsl @@ -0,0 +1,21 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { + buffer.Store4((offset + 0u), asuint(value[0u])); + buffer.Store4((offset + 16u), asuint(value[1u])); + buffer.Store4((offset + 32u), asuint(value[2u])); + buffer.Store4((offset + 48u), asuint(value[3u])); +} + +float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { + return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); +} + +void foo() { + tint_symbol(v, 0u, (tint_symbol_2(v, 0u) - float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx))); +} diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b0784defc --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { + buffer.Store4((offset + 0u), asuint(value[0u])); + buffer.Store4((offset + 16u), asuint(value[1u])); + buffer.Store4((offset + 32u), asuint(value[2u])); + buffer.Store4((offset + 48u), asuint(value[3u])); +} + +float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { + return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); +} + +void foo() { + tint_symbol(v, 0u, (tint_symbol_2(v, 0u) - float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx))); +} diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl index 89a157d314..bee248827c 100644 --- a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl @@ -12,6 +12,6 @@ layout(binding = 0, std430) buffer S_1 { mat4 a; } v; void foo() { - v.a = (v.a - mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); + v.a = (v.a - mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); } diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.hlsl deleted file mode 100644 index dc28af670c..0000000000 --- a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { - buffer.Store4((offset + 0u), asuint(value[0u])); - buffer.Store4((offset + 16u), asuint(value[1u])); - buffer.Store4((offset + 32u), asuint(value[2u])); - buffer.Store4((offset + 48u), asuint(value[3u])); -} - -float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { - return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); -} - -void foo() { - tint_symbol(v, 0u, (tint_symbol_2(v, 0u) - float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f))); -} diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.msl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.msl index f6fb29f74a..48aaec6683 100644 --- a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.msl @@ -6,6 +6,6 @@ struct S { }; void foo(device S* const tint_symbol) { - (*(tint_symbol)).a = ((*(tint_symbol)).a - float4x4()); + (*(tint_symbol)).a = ((*(tint_symbol)).a - float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f))); } diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..efa7687a93 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.dxc.hlsl @@ -0,0 +1,21 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { + buffer.Store4((offset + 0u), asuint(value[0u])); + buffer.Store4((offset + 16u), asuint(value[1u])); + buffer.Store4((offset + 32u), asuint(value[2u])); + buffer.Store4((offset + 48u), asuint(value[3u])); +} + +float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { + return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); +} + +void foo() { + tint_symbol(v, 0u, (tint_symbol_2(v, 0u) + float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx))); +} diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..efa7687a93 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { + buffer.Store4((offset + 0u), asuint(value[0u])); + buffer.Store4((offset + 16u), asuint(value[1u])); + buffer.Store4((offset + 32u), asuint(value[2u])); + buffer.Store4((offset + 48u), asuint(value[3u])); +} + +float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { + return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); +} + +void foo() { + tint_symbol(v, 0u, (tint_symbol_2(v, 0u) + float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx))); +} diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl index e70299b6ff..86dbf9b9ad 100644 --- a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl @@ -12,6 +12,6 @@ layout(binding = 0, std430) buffer S_1 { mat4 a; } v; void foo() { - v.a = (v.a + mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); + v.a = (v.a + mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); } diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.hlsl deleted file mode 100644 index b4d6c77807..0000000000 --- a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { - buffer.Store4((offset + 0u), asuint(value[0u])); - buffer.Store4((offset + 16u), asuint(value[1u])); - buffer.Store4((offset + 32u), asuint(value[2u])); - buffer.Store4((offset + 48u), asuint(value[3u])); -} - -float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { - return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); -} - -void foo() { - tint_symbol(v, 0u, (tint_symbol_2(v, 0u) + float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f))); -} diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.msl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.msl index 7ff7cc90ee..9dc0ba5d00 100644 --- a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.msl @@ -6,6 +6,6 @@ struct S { }; void foo(device S* const tint_symbol) { - (*(tint_symbol)).a = ((*(tint_symbol)).a + float4x4()); + (*(tint_symbol)).a = ((*(tint_symbol)).a + float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f))); } diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..24236fdc85 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { + buffer.Store4((offset + 0u), asuint(value[0u])); + buffer.Store4((offset + 16u), asuint(value[1u])); + buffer.Store4((offset + 32u), asuint(value[2u])); + buffer.Store4((offset + 48u), asuint(value[3u])); +} + +float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { + return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); +} + +void foo() { + tint_symbol(v, 0u, (tint_symbol_2(v, 0u) * 2.0f)); +} diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..05313f1946 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.dxc.hlsl @@ -0,0 +1,21 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { + buffer.Store4((offset + 0u), asuint(value[0u])); + buffer.Store4((offset + 16u), asuint(value[1u])); + buffer.Store4((offset + 32u), asuint(value[2u])); + buffer.Store4((offset + 48u), asuint(value[3u])); +} + +float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { + return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); +} + +void foo() { + tint_symbol(v, 0u, mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), tint_symbol_2(v, 0u))); +} diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..05313f1946 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { + buffer.Store4((offset + 0u), asuint(value[0u])); + buffer.Store4((offset + 16u), asuint(value[1u])); + buffer.Store4((offset + 32u), asuint(value[2u])); + buffer.Store4((offset + 48u), asuint(value[3u])); +} + +float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { + return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); +} + +void foo() { + tint_symbol(v, 0u, mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), tint_symbol_2(v, 0u))); +} diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl index 0e7f0c26b1..4d224ea363 100644 --- a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl @@ -12,6 +12,6 @@ layout(binding = 0, std430) buffer S_1 { mat4 a; } v; void foo() { - v.a = (v.a * mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); + v.a = (v.a * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); } diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.hlsl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.hlsl deleted file mode 100644 index 464338c525..0000000000 --- a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void tint_symbol(RWByteAddressBuffer buffer, uint offset, float4x4 value) { - buffer.Store4((offset + 0u), asuint(value[0u])); - buffer.Store4((offset + 16u), asuint(value[1u])); - buffer.Store4((offset + 32u), asuint(value[2u])); - buffer.Store4((offset + 48u), asuint(value[3u])); -} - -float4x4 tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { - return float4x4(asfloat(buffer.Load4((offset + 0u))), asfloat(buffer.Load4((offset + 16u))), asfloat(buffer.Load4((offset + 32u))), asfloat(buffer.Load4((offset + 48u)))); -} - -void foo() { - tint_symbol(v, 0u, mul(float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), tint_symbol_2(v, 0u))); -} diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.msl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.msl index bfce1924d0..7dfd863869 100644 --- a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.msl @@ -6,6 +6,6 @@ struct S { }; void foo(device S* const tint_symbol) { - (*(tint_symbol)).a = ((*(tint_symbol)).a * float4x4()); + (*(tint_symbol)).a = ((*(tint_symbol)).a * float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f))); } diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/private.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f01cc42ffa --- /dev/null +++ b/test/tint/statements/compound_assign/private.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int a = 0; +static float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + +void foo() { + a = (a / 2); + b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); + c = (c * 2.0f); +} diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/private.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f01cc42ffa --- /dev/null +++ b/test/tint/statements/compound_assign/private.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int a = 0; +static float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + +void foo() { + a = (a / 2); + b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); + c = (c * 2.0f); +} diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.glsl b/test/tint/statements/compound_assign/private.wgsl.expected.glsl index 2ea59e7987..33efe429c5 100644 --- a/test/tint/statements/compound_assign/private.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/private.wgsl.expected.glsl @@ -9,7 +9,7 @@ vec4 b = vec4(0.0f, 0.0f, 0.0f, 0.0f); mat2 c = mat2(0.0f, 0.0f, 0.0f, 0.0f); void foo() { a = (a / 2); - b = (b * mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); + b = (b * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); c = (c * 2.0f); } diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.hlsl b/test/tint/statements/compound_assign/private.wgsl.expected.hlsl deleted file mode 100644 index 469c40214d..0000000000 --- a/test/tint/statements/compound_assign/private.wgsl.expected.hlsl +++ /dev/null @@ -1,14 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -static int a = 0; -static float4 b = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float2x2 c = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - -void foo() { - a = (a / 2); - b = mul(float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), b); - c = (c * 2.0f); -} diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.msl b/test/tint/statements/compound_assign/private.wgsl.expected.msl index 5b9bcdc082..327107f790 100644 --- a/test/tint/statements/compound_assign/private.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/private.wgsl.expected.msl @@ -1,9 +1,12 @@ #include using namespace metal; -void foo(thread int* const tint_symbol, thread float4* const tint_symbol_1, thread float2x2* const tint_symbol_2) { - *(tint_symbol) = (*(tint_symbol) / 2); - *(tint_symbol_1) = (*(tint_symbol_1) * float4x4()); - *(tint_symbol_2) = (*(tint_symbol_2) * 2.0f); +void foo() { + thread int tint_symbol = 0; + thread float4 tint_symbol_1 = 0.0f; + thread float2x2 tint_symbol_2 = float2x2(0.0f); + tint_symbol = (tint_symbol / 2); + tint_symbol_1 = (tint_symbol_1 * float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f))); + tint_symbol_2 = (tint_symbol_2 * 2.0f); } diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/scalar/and.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/scalar/and.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8af8952a49 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) & 2))); +} diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/scalar/divide.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/scalar/divide.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..affbb2bf49 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) / 2))); +} diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/scalar/minus.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/scalar/minus.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1b557a16be --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) - 2))); +} diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fec5816468 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) % 2))); +} diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/scalar/or.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/scalar/or.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..309c612c59 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) | 2))); +} diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/scalar/plus.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/scalar/plus.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..20f9d1cffa --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) + 2))); +} diff --git a/test/tint/statements/compound_assign/scalar/shift_left.wgsl b/test/tint/statements/compound_assign/scalar/shift_left.wgsl new file mode 100644 index 0000000000..70df3d77d5 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_left.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a <<= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6f3bbd592 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) << 2u))); +} diff --git a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6f3bbd592 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) << 2u))); +} diff --git a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.glsl new file mode 100644 index 0000000000..0d42f568a6 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +struct S { + int a; +}; + +layout(binding = 0, std430) buffer S_1 { + int a; +} v; +void foo() { + v.a = (v.a << 2u); +} + diff --git a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.msl new file mode 100644 index 0000000000..ffb9df8642 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.msl @@ -0,0 +1,11 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int a; +}; + +void foo(device S* const tint_symbol) { + (*(tint_symbol)).a = as_type((as_type((*(tint_symbol)).a) << 2u)); +} + diff --git a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f8c1e83b4 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %S "S" + OpMemberName %S 0 "a" + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + OpName %foo "foo" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %v DescriptorSet 0 + OpDecorate %v Binding 0 + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %uint_2 = OpConstant %uint 2 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %foo = OpFunction %void None %5 + %10 = OpLabel + %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 + %16 = OpLoad %int %15 + %18 = OpShiftLeftLogical %int %16 %uint_2 + OpStore %14 %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.wgsl new file mode 100644 index 0000000000..4bbb4ffa66 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a <<= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/shift_right.wgsl b/test/tint/statements/compound_assign/scalar/shift_right.wgsl new file mode 100644 index 0000000000..fd49158fb9 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_right.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a >>= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b4ea377251 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) >> 2u))); +} diff --git a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b4ea377251 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) >> 2u))); +} diff --git a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.glsl new file mode 100644 index 0000000000..c443ba021b --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +struct S { + int a; +}; + +layout(binding = 0, std430) buffer S_1 { + int a; +} v; +void foo() { + v.a = (v.a >> 2u); +} + diff --git a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.msl new file mode 100644 index 0000000000..d2f8264739 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.msl @@ -0,0 +1,11 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int a; +}; + +void foo(device S* const tint_symbol) { + (*(tint_symbol)).a = ((*(tint_symbol)).a >> 2u); +} + diff --git a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8fcd7a996 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %S "S" + OpMemberName %S 0 "a" + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + OpName %foo "foo" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %v DescriptorSet 0 + OpDecorate %v Binding 0 + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %uint_2 = OpConstant %uint 2 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %foo = OpFunction %void None %5 + %10 = OpLabel + %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 + %16 = OpLoad %int %15 + %18 = OpShiftRightArithmetic %int %16 %uint_2 + OpStore %14 %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.wgsl new file mode 100644 index 0000000000..b96a6560d6 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a >>= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/scalar/times.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/scalar/times.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2735d376b0 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) * 2))); +} diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/scalar/xor.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/scalar/xor.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..69a4c5e414 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store(0u, asuint((asint(v.Load(0u)) ^ 2))); +} diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/and.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4c0f7f3515 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/and.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) & (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/and.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4c0f7f3515 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/and.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) & (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/and.wgsl.expected.hlsl deleted file mode 100644 index 34c5c0dd2b..0000000000 --- a/test/tint/statements/compound_assign/vector/and.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void foo() { - v.Store4(0u, asuint((asint(v.Load4(0u)) & int4((2).xxxx)))); -} diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e0b7c7b8fb --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asfloat(v.Load4(0u)) / 2.0f))); +} diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0e66d73f8a --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) / (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0e66d73f8a --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) / (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.hlsl deleted file mode 100644 index 8ef06663db..0000000000 --- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void foo() { - v.Store4(0u, asuint((asint(v.Load4(0u)) / int4((2).xxxx)))); -} diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..93093753f9 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asfloat(v.Load4(0u)) - 2.0f))); +} diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..03a10ae42a --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) - (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..03a10ae42a --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) - (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.hlsl deleted file mode 100644 index 15e224f896..0000000000 --- a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void foo() { - v.Store4(0u, asuint((asint(v.Load4(0u)) - int4((2).xxxx)))); -} diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f5f8675647 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) % 2))); +} diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b54d9803e7 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) % (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b54d9803e7 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) % (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.hlsl deleted file mode 100644 index 8c38a69818..0000000000 --- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void foo() { - v.Store4(0u, asuint((asint(v.Load4(0u)) % int4((2).xxxx)))); -} diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/or.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8ee7a2022c --- /dev/null +++ b/test/tint/statements/compound_assign/vector/or.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) | (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/or.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8ee7a2022c --- /dev/null +++ b/test/tint/statements/compound_assign/vector/or.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) | (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/or.wgsl.expected.hlsl deleted file mode 100644 index f8b82afefc..0000000000 --- a/test/tint/statements/compound_assign/vector/or.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void foo() { - v.Store4(0u, asuint((asint(v.Load4(0u)) | int4((2).xxxx)))); -} diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..40c7df0163 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asfloat(v.Load4(0u)) + 2.0f))); +} diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7928de28bb --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) + (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7928de28bb --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) + (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.hlsl deleted file mode 100644 index 10269a03d2..0000000000 --- a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void foo() { - v.Store4(0u, asuint((asint(v.Load4(0u)) + int4((2).xxxx)))); -} diff --git a/test/tint/statements/compound_assign/vector/shift_left.wgsl b/test/tint/statements/compound_assign/vector/shift_left.wgsl new file mode 100644 index 0000000000..86d4824a50 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_left.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a <<= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f5fbb2c07e --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) << (2u).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f5fbb2c07e --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) << (2u).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.glsl new file mode 100644 index 0000000000..4a53ae3e18 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +struct S { + ivec4 a; +}; + +layout(binding = 0, std430) buffer S_1 { + ivec4 a; +} v; +void foo() { + v.a = (v.a << uvec4(2u)); +} + diff --git a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.msl new file mode 100644 index 0000000000..2dd819cebe --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.msl @@ -0,0 +1,11 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int4 a; +}; + +void foo(device S* const tint_symbol) { + (*(tint_symbol)).a = as_type((as_type((*(tint_symbol)).a) << uint4(2u))); +} + diff --git a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f42a940ac --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %S "S" + OpMemberName %S 0 "a" + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + OpName %foo "foo" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %v DescriptorSet 0 + OpDecorate %v Binding 0 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %S = OpTypeStruct %v4int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int + %v4uint = OpTypeVector %uint 4 + %uint_2 = OpConstant %uint 2 + %20 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel + OpReturn + OpFunctionEnd + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 + %17 = OpLoad %v4int %16 + %21 = OpShiftLeftLogical %v4int %17 %20 + OpStore %15 %21 + OpReturn + OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.wgsl new file mode 100644 index 0000000000..517488f41d --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a <<= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/shift_right.wgsl b/test/tint/statements/compound_assign/vector/shift_right.wgsl new file mode 100644 index 0000000000..7e83583185 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_right.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a >>= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b6a30f9d7 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) >> (2u).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b6a30f9d7 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) >> (2u).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.glsl new file mode 100644 index 0000000000..51bb554a05 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +struct S { + ivec4 a; +}; + +layout(binding = 0, std430) buffer S_1 { + ivec4 a; +} v; +void foo() { + v.a = (v.a >> uvec4(2u)); +} + diff --git a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.msl new file mode 100644 index 0000000000..03c625d9c5 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.msl @@ -0,0 +1,11 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int4 a; +}; + +void foo(device S* const tint_symbol) { + (*(tint_symbol)).a = ((*(tint_symbol)).a >> uint4(2u)); +} + diff --git a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ab37da073 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %S "S" + OpMemberName %S 0 "a" + OpName %v "v" + OpName %unused_entry_point "unused_entry_point" + OpName %foo "foo" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %v DescriptorSet 0 + OpDecorate %v Binding 0 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %S = OpTypeStruct %v4int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int + %v4uint = OpTypeVector %uint 4 + %uint_2 = OpConstant %uint 2 + %20 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel + OpReturn + OpFunctionEnd + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 + %17 = OpLoad %v4int %16 + %21 = OpShiftRightArithmetic %v4int %17 %20 + OpStore %15 %21 + OpReturn + OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e724aacb4 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a >>= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2ca2d65284 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint(mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), asfloat(v.Load4(0u))))); +} diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ca2d65284 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint(mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), asfloat(v.Load4(0u))))); +} diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl index c2ed67aba5..ee226d277f 100644 --- a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl @@ -12,6 +12,6 @@ layout(binding = 0, std430) buffer S_1 { vec4 a; } v; void foo() { - v.a = (v.a * mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); + v.a = (v.a * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); } diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.hlsl deleted file mode 100644 index c4083be17e..0000000000 --- a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void foo() { - v.Store4(0u, asuint(mul(float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), asfloat(v.Load4(0u))))); -} diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.msl index b7722c8618..7fd679063d 100644 --- a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.msl @@ -6,6 +6,6 @@ struct S { }; void foo(device S* const tint_symbol) { - (*(tint_symbol)).a = ((*(tint_symbol)).a * float4x4()); + (*(tint_symbol)).a = ((*(tint_symbol)).a * float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f))); } diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.hlsl rename to test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67f16d8d0d --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asfloat(v.Load4(0u)) * 2.0f))); +} diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/times.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..43e0df8e3e --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) * (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/times.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43e0df8e3e --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) * (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/times.wgsl.expected.hlsl deleted file mode 100644 index 7b9a6bd747..0000000000 --- a/test/tint/statements/compound_assign/vector/times.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void foo() { - v.Store4(0u, asuint((asint(v.Load4(0u)) * int4((2).xxxx)))); -} diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e53744a06c --- /dev/null +++ b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) ^ (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e53744a06c --- /dev/null +++ b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer v : register(u0, space0); + +void foo() { + v.Store4(0u, asuint((asint(v.Load4(0u)) ^ (2).xxxx))); +} diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.hlsl deleted file mode 100644 index a76154a4b3..0000000000 --- a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -RWByteAddressBuffer v : register(u0, space0); - -void foo() { - v.Store4(0u, asuint((asint(v.Load4(0u)) ^ int4((2).xxxx)))); -} diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dae8e54896 --- /dev/null +++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.dxc.hlsl @@ -0,0 +1,14 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +groupshared int a; +groupshared float4 b; +groupshared float2x2 c; + +void foo() { + a = (a / 2); + b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); + c = (c * 2.0f); +} diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dae8e54896 --- /dev/null +++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.fxc.hlsl @@ -0,0 +1,14 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +groupshared int a; +groupshared float4 b; +groupshared float2x2 c; + +void foo() { + a = (a / 2); + b = mul(float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx), b); + c = (c * 2.0f); +} diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl index 4d492bddbe..d762d8fbe4 100644 --- a/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl @@ -9,7 +9,7 @@ shared vec4 b; shared mat2 c; void foo() { a = (a / 2); - b = (b * mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); + b = (b * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); c = (c * 2.0f); } diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.hlsl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.hlsl deleted file mode 100644 index 1f7527bb6a..0000000000 --- a/test/tint/statements/compound_assign/workgroup.wgsl.expected.hlsl +++ /dev/null @@ -1,14 +0,0 @@ -[numthreads(1, 1, 1)] -void unused_entry_point() { - return; -} - -groupshared int a; -groupshared float4 b; -groupshared float2x2 c; - -void foo() { - a = (a / 2); - b = mul(float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), b); - c = (c * 2.0f); -} diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.msl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.msl index 14ce2d4811..4335b158fa 100644 --- a/test/tint/statements/compound_assign/workgroup.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.msl @@ -3,7 +3,7 @@ using namespace metal; void foo(threadgroup int* const tint_symbol, threadgroup float4* const tint_symbol_1, threadgroup float2x2* const tint_symbol_2) { *(tint_symbol) = (*(tint_symbol) / 2); - *(tint_symbol_1) = (*(tint_symbol_1) * float4x4()); + *(tint_symbol_1) = (*(tint_symbol_1) * float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f))); *(tint_symbol_2) = (*(tint_symbol_2) * 2.0f); } diff --git a/test/tint/statements/decrement/array_element.wgsl.expected.hlsl b/test/tint/statements/decrement/array_element.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/decrement/array_element.wgsl.expected.hlsl rename to test/tint/statements/decrement/array_element.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/decrement/array_element.wgsl.expected.fxc.hlsl b/test/tint/statements/decrement/array_element.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fda70650d8 --- /dev/null +++ b/test/tint/statements/decrement/array_element.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer a : register(u0, space0); + +void main() { + a.Store(4u, asuint((a.Load(4u) - 1u))); +} diff --git a/test/tint/statements/decrement/array_element.wgsl.expected.msl b/test/tint/statements/decrement/array_element.wgsl.expected.msl index 03752fbd02..56896d1d66 100644 --- a/test/tint/statements/decrement/array_element.wgsl.expected.msl +++ b/test/tint/statements/decrement/array_element.wgsl.expected.msl @@ -1,7 +1,20 @@ #include using namespace metal; -void tint_symbol(device uint (*const tint_symbol_2)[1]) { + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void tint_symbol(device tint_array* const tint_symbol_2) { (*(tint_symbol_2))[1] = ((*(tint_symbol_2))[1] - 1u); } diff --git a/test/tint/statements/decrement/complex.wgsl.expected.hlsl b/test/tint/statements/decrement/complex.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/decrement/complex.wgsl.expected.hlsl rename to test/tint/statements/decrement/complex.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/decrement/complex.wgsl.expected.fxc.hlsl b/test/tint/statements/decrement/complex.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..069b822f47 --- /dev/null +++ b/test/tint/statements/decrement/complex.wgsl.expected.fxc.hlsl @@ -0,0 +1,63 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer buffer : register(u0, space0); +static uint v = 0u; + +int idx1() { + v = (v - 1u); + return 1; +} + +int idx2() { + v = (v - 1u); + return 2; +} + +int idx3() { + v = (v - 1u); + return 3; +} + +int idx4() { + v = (v - 1u); + return 4; +} + +int idx5() { + v = (v - 1u); + return 0; +} + +int idx6() { + v = (v - 1u); + return 2; +} + +void main() { + const int tint_symbol_4 = idx1(); + const int tint_symbol_5 = idx2(); + const int tint_symbol_save = tint_symbol_4; + const int tint_symbol_save_1 = tint_symbol_5; + const int tint_symbol_1 = idx3(); + { + buffer.Store((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))))) - 1))); + [loop] while (true) { + if (!((v < 10u))) { + break; + } + { + } + { + const int tint_symbol_6 = idx4(); + const int tint_symbol_7 = idx5(); + const int tint_symbol_2_save = tint_symbol_6; + const int tint_symbol_2_save_1 = tint_symbol_7; + const int tint_symbol_3 = idx6(); + buffer.Store((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))))) - 1))); + } + } + } +} diff --git a/test/tint/statements/decrement/complex.wgsl.expected.msl b/test/tint/statements/decrement/complex.wgsl.expected.msl index e7e4a6cbee..ece89e4751 100644 --- a/test/tint/statements/decrement/complex.wgsl.expected.msl +++ b/test/tint/statements/decrement/complex.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct S { - /* 0x0000 */ tint_array_wrapper a; + /* 0x0000 */ tint_array a; }; int idx1(thread uint* const tint_symbol_10) { @@ -39,14 +48,14 @@ int idx6(thread uint* const tint_symbol_15) { return 2; } -void tint_symbol_1(thread uint* const tint_symbol_16, device S (*const tint_symbol_17)[1]) { +void tint_symbol_1(thread uint* const tint_symbol_16, device tint_array* const tint_symbol_17) { int const tint_symbol_6 = idx1(tint_symbol_16); int const tint_symbol_7 = idx2(tint_symbol_16); int const tint_symbol_2_save = tint_symbol_6; int const tint_symbol_2_save_1 = tint_symbol_7; int const tint_symbol_3 = idx3(tint_symbol_16); { - (*(tint_symbol_17))[tint_symbol_2_save].a.arr[tint_symbol_2_save_1][tint_symbol_3] = as_type((as_type((*(tint_symbol_17))[tint_symbol_2_save].a.arr[tint_symbol_2_save_1][tint_symbol_3]) - as_type(1))); + (*(tint_symbol_17))[tint_symbol_2_save].a[tint_symbol_2_save_1][tint_symbol_3] = as_type((as_type((*(tint_symbol_17))[tint_symbol_2_save].a[tint_symbol_2_save_1][tint_symbol_3]) - as_type(1))); while (true) { if (!((*(tint_symbol_16) < 10u))) { break; @@ -59,7 +68,7 @@ void tint_symbol_1(thread uint* const tint_symbol_16, device S (*const tint_symb int const tint_symbol_4_save = tint_symbol_8; int const tint_symbol_4_save_1 = tint_symbol_9; int const tint_symbol_5 = idx6(tint_symbol_16); - (*(tint_symbol_17))[tint_symbol_4_save].a.arr[tint_symbol_4_save_1][tint_symbol_5] = as_type((as_type((*(tint_symbol_17))[tint_symbol_4_save].a.arr[tint_symbol_4_save_1][tint_symbol_5]) - as_type(1))); + (*(tint_symbol_17))[tint_symbol_4_save].a[tint_symbol_4_save_1][tint_symbol_5] = as_type((as_type((*(tint_symbol_17))[tint_symbol_4_save].a[tint_symbol_4_save_1][tint_symbol_5]) - as_type(1))); } } } diff --git a/test/tint/statements/decrement/complex.wgsl.expected.spvasm b/test/tint/statements/decrement/complex.wgsl.expected.spvasm index 7798efe386..41b2a734ab 100644 --- a/test/tint/statements/decrement/complex.wgsl.expected.spvasm +++ b/test/tint/statements/decrement/complex.wgsl.expected.spvasm @@ -49,7 +49,7 @@ %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 %int_4 = OpConstant %int 4 - %int_0 = OpConstant %int 0 + %44 = OpConstantNull %int %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %uint_10 = OpConstant %uint 10 @@ -91,7 +91,7 @@ %42 = OpLoad %uint %v %43 = OpISub %uint %42 %uint_1 OpStore %v %43 - OpReturnValue %int_0 + OpReturnValue %44 OpFunctionEnd %idx6 = OpFunction %int None %18 %46 = OpLabel diff --git a/test/tint/statements/decrement/for_loop_continuing.wgsl.expected.hlsl b/test/tint/statements/decrement/for_loop_continuing.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/decrement/for_loop_continuing.wgsl.expected.hlsl rename to test/tint/statements/decrement/for_loop_continuing.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/decrement/for_loop_continuing.wgsl.expected.fxc.hlsl b/test/tint/statements/decrement/for_loop_continuing.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7baae1bc1b --- /dev/null +++ b/test/tint/statements/decrement/for_loop_continuing.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer i : register(u0, space0); + +void main() { + { + [loop] for(; (i.Load(0u) < 10u); i.Store(0u, asuint((i.Load(0u) - 1u)))) { + } + } +} diff --git a/test/tint/statements/decrement/for_loop_initializer.wgsl.expected.hlsl b/test/tint/statements/decrement/for_loop_initializer.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/decrement/for_loop_initializer.wgsl.expected.hlsl rename to test/tint/statements/decrement/for_loop_initializer.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/decrement/for_loop_initializer.wgsl.expected.fxc.hlsl b/test/tint/statements/decrement/for_loop_initializer.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e520f5ecf2 --- /dev/null +++ b/test/tint/statements/decrement/for_loop_initializer.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer i : register(u0, space0); + +void main() { + { + [loop] for(i.Store(0u, asuint((i.Load(0u) - 1u))); (i.Load(0u) < 10u); ) { + } + } +} diff --git a/test/tint/statements/decrement/function.wgsl.expected.hlsl b/test/tint/statements/decrement/function.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/decrement/function.wgsl.expected.hlsl rename to test/tint/statements/decrement/function.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/decrement/function.wgsl.expected.fxc.hlsl b/test/tint/statements/decrement/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..479225e69b --- /dev/null +++ b/test/tint/statements/decrement/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void main() { + int i = 0; + i = (i - 1); +} diff --git a/test/tint/statements/decrement/function.wgsl.expected.spvasm b/test/tint/statements/decrement/function.wgsl.expected.spvasm index 1eec1fa720..6fe20e9bc0 100644 --- a/test/tint/statements/decrement/function.wgsl.expected.spvasm +++ b/test/tint/statements/decrement/function.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -13,9 +13,8 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %8 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %11 = OpConstantNull %int %int_1 = OpConstant %int 1 %unused_entry_point = OpFunction %void None %1 %4 = OpLabel @@ -23,10 +22,10 @@ OpFunctionEnd %main = OpFunction %void None %1 %6 = OpLabel - %i = OpVariable %_ptr_Function_int Function %11 - OpStore %i %int_0 - %12 = OpLoad %int %i - %14 = OpISub %int %12 %int_1 - OpStore %i %14 + %i = OpVariable %_ptr_Function_int Function %8 + OpStore %i %8 + %11 = OpLoad %int %i + %13 = OpISub %int %11 %int_1 + OpStore %i %13 OpReturn OpFunctionEnd diff --git a/test/tint/statements/decrement/private.wgsl.expected.hlsl b/test/tint/statements/decrement/private.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/decrement/private.wgsl.expected.hlsl rename to test/tint/statements/decrement/private.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/decrement/private.wgsl.expected.fxc.hlsl b/test/tint/statements/decrement/private.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..56b4922bb1 --- /dev/null +++ b/test/tint/statements/decrement/private.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int i = 0; + +void main() { + i = (i - 1); +} diff --git a/test/tint/statements/decrement/private.wgsl.expected.msl b/test/tint/statements/decrement/private.wgsl.expected.msl index ad64e49a9a..2c42333089 100644 --- a/test/tint/statements/decrement/private.wgsl.expected.msl +++ b/test/tint/statements/decrement/private.wgsl.expected.msl @@ -1,7 +1,8 @@ #include using namespace metal; -void tint_symbol(thread int* const tint_symbol_1) { - *(tint_symbol_1) = as_type((as_type(*(tint_symbol_1)) - as_type(1))); +void tint_symbol() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = as_type((as_type(tint_symbol_1) - as_type(1))); } diff --git a/test/tint/statements/decrement/private.wgsl.expected.spvasm b/test/tint/statements/decrement/private.wgsl.expected.spvasm index 1514ee9241..a28b357653 100644 --- a/test/tint/statements/decrement/private.wgsl.expected.spvasm +++ b/test/tint/statements/decrement/private.wgsl.expected.spvasm @@ -11,9 +11,9 @@ OpName %unused_entry_point "unused_entry_point" OpName %main "main" %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %2 = OpConstantNull %int %_ptr_Private_int = OpTypePointer Private %int - %i = OpVariable %_ptr_Private_int Private %int_0 + %i = OpVariable %_ptr_Private_int Private %2 %void = OpTypeVoid %5 = OpTypeFunction %void %int_1 = OpConstant %int 1 diff --git a/test/tint/statements/decrement/storage.wgsl.expected.hlsl b/test/tint/statements/decrement/storage.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/decrement/storage.wgsl.expected.hlsl rename to test/tint/statements/decrement/storage.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/decrement/storage.wgsl.expected.fxc.hlsl b/test/tint/statements/decrement/storage.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..99f987877f --- /dev/null +++ b/test/tint/statements/decrement/storage.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer i : register(u0, space0); + +void main() { + i.Store(0u, asuint((i.Load(0u) - 1u))); +} diff --git a/test/tint/statements/decrement/vector_component.wgsl.expected.hlsl b/test/tint/statements/decrement/vector_component.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/decrement/vector_component.wgsl.expected.hlsl rename to test/tint/statements/decrement/vector_component.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/decrement/vector_component.wgsl.expected.fxc.hlsl b/test/tint/statements/decrement/vector_component.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..88bf0a8dfc --- /dev/null +++ b/test/tint/statements/decrement/vector_component.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer a : register(u0, space0); + +void main() { + const int tint_symbol_1 = 1; + a.Store((4u * uint(tint_symbol_1)), asuint((a.Load((4u * uint(tint_symbol_1))) - 1u))); + a.Store(8u, asuint((a.Load(8u) - 1u))); +} diff --git a/test/tint/statements/decrement/workgroup.wgsl.expected.hlsl b/test/tint/statements/decrement/workgroup.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/decrement/workgroup.wgsl.expected.hlsl rename to test/tint/statements/decrement/workgroup.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/decrement/workgroup.wgsl.expected.fxc.hlsl b/test/tint/statements/decrement/workgroup.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b39cd010ec --- /dev/null +++ b/test/tint/statements/decrement/workgroup.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +groupshared int i; + +void main() { + i = (i - 1); +} diff --git a/test/tint/statements/for/basic.wgsl.expected.hlsl b/test/tint/statements/for/basic.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/basic.wgsl.expected.hlsl rename to test/tint/statements/for/basic.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/basic.wgsl.expected.fxc.hlsl b/test/tint/statements/for/basic.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..223650392b --- /dev/null +++ b/test/tint/statements/for/basic.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void some_loop_body() { +} + +void f() { + { + [loop] for(int i = 0; (i < 5); i = (i + 1)) { + some_loop_body(); + } + } +} diff --git a/test/tint/statements/for/basic.wgsl.expected.spvasm b/test/tint/statements/for/basic.wgsl.expected.spvasm index b537e54899..c7e0808f90 100644 --- a/test/tint/statements/for/basic.wgsl.expected.spvasm +++ b/test/tint/statements/for/basic.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 29 +; Bound: 28 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -14,9 +14,8 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %13 = OpConstantNull %int %int_5 = OpConstant %int 5 %bool = OpTypeBool %int_1 = OpConstant %int 1 @@ -30,28 +29,28 @@ OpFunctionEnd %f = OpFunction %void None %1 %8 = OpLabel - %i = OpVariable %_ptr_Function_int Function %13 - OpStore %i %int_0 - OpBranch %14 - %14 = OpLabel - OpLoopMerge %15 %16 None - OpBranch %17 - %17 = OpLabel - %19 = OpLoad %int %i - %21 = OpSLessThan %bool %19 %int_5 - %18 = OpLogicalNot %bool %21 - OpSelectionMerge %23 None - OpBranchConditional %18 %24 %23 - %24 = OpLabel - OpBranch %15 - %23 = OpLabel - %25 = OpFunctionCall %void %some_loop_body + %i = OpVariable %_ptr_Function_int Function %10 + OpStore %i %10 + OpBranch %13 + %13 = OpLabel + OpLoopMerge %14 %15 None OpBranch %16 %16 = OpLabel - %26 = OpLoad %int %i - %28 = OpIAdd %int %26 %int_1 - OpStore %i %28 + %18 = OpLoad %int %i + %20 = OpSLessThan %bool %18 %int_5 + %17 = OpLogicalNot %bool %20 + OpSelectionMerge %22 None + OpBranchConditional %17 %23 %22 + %23 = OpLabel OpBranch %14 + %22 = OpLabel + %24 = OpFunctionCall %void %some_loop_body + OpBranch %15 %15 = OpLabel + %25 = OpLoad %int %i + %27 = OpIAdd %int %25 %int_1 + OpStore %i %27 + OpBranch %13 + %14 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/for/complex.wgsl.expected.hlsl b/test/tint/statements/for/complex.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/complex.wgsl.expected.hlsl rename to test/tint/statements/for/complex.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/complex.wgsl.expected.fxc.hlsl b/test/tint/statements/for/complex.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ebc9720860 --- /dev/null +++ b/test/tint/statements/for/complex.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void some_loop_body() { +} + +void f() { + int j = 0; + { + int i = 0; + [loop] while (true) { + bool tint_tmp = (i < 5); + if (tint_tmp) { + tint_tmp = (j < 10); + } + if (!((tint_tmp))) { break; } + some_loop_body(); + j = (i * 30); + i = (i + 1); + } + } +} diff --git a/test/tint/statements/for/complex.wgsl.expected.spvasm b/test/tint/statements/for/complex.wgsl.expected.spvasm index 725edbf6ee..2c41cb0607 100644 --- a/test/tint/statements/for/complex.wgsl.expected.spvasm +++ b/test/tint/statements/for/complex.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 39 +; Bound: 38 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -17,7 +17,6 @@ %int = OpTypeInt 32 1 %_ptr_Function_int = OpTypePointer Function %int %12 = OpConstantNull %int - %int_0 = OpConstant %int 0 %int_5 = OpConstant %int 5 %bool = OpTypeBool %int_10 = OpConstant %int 10 @@ -35,38 +34,38 @@ %8 = OpLabel %j = OpVariable %_ptr_Function_int Function %12 %i = OpVariable %_ptr_Function_int Function %12 - OpStore %i %int_0 - OpBranch %15 - %15 = OpLabel - OpLoopMerge %16 %17 None - OpBranch %18 - %18 = OpLabel - %20 = OpLoad %int %i - %22 = OpSLessThan %bool %20 %int_5 - OpSelectionMerge %24 None - OpBranchConditional %22 %25 %24 - %25 = OpLabel - %26 = OpLoad %int %j - %28 = OpSLessThan %bool %26 %int_10 - OpBranch %24 - %24 = OpLabel - %29 = OpPhi %bool %22 %18 %28 %25 - %19 = OpLogicalNot %bool %29 - OpSelectionMerge %30 None - OpBranchConditional %19 %31 %30 - %31 = OpLabel - OpBranch %16 - %30 = OpLabel - %32 = OpFunctionCall %void %some_loop_body - %33 = OpLoad %int %i - %35 = OpIMul %int %33 %int_30 - OpStore %j %35 + OpStore %i %12 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %15 %16 None OpBranch %17 %17 = OpLabel - %36 = OpLoad %int %i - %38 = OpIAdd %int %36 %int_1 - OpStore %i %38 + %19 = OpLoad %int %i + %21 = OpSLessThan %bool %19 %int_5 + OpSelectionMerge %23 None + OpBranchConditional %21 %24 %23 + %24 = OpLabel + %25 = OpLoad %int %j + %27 = OpSLessThan %bool %25 %int_10 + OpBranch %23 + %23 = OpLabel + %28 = OpPhi %bool %21 %17 %27 %24 + %18 = OpLogicalNot %bool %28 + OpSelectionMerge %29 None + OpBranchConditional %18 %30 %29 + %30 = OpLabel OpBranch %15 + %29 = OpLabel + %31 = OpFunctionCall %void %some_loop_body + %32 = OpLoad %int %i + %34 = OpIMul %int %32 %int_30 + OpStore %j %34 + OpBranch %16 %16 = OpLabel + %35 = OpLoad %int %i + %37 = OpIAdd %int %35 %int_1 + OpStore %i %37 + OpBranch %14 + %15 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/for/condition/array_ctor.wgsl.expected.hlsl b/test/tint/statements/for/condition/array_ctor.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/condition/array_ctor.wgsl.expected.hlsl rename to test/tint/statements/for/condition/array_ctor.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/condition/array_ctor.wgsl.expected.fxc.hlsl b/test/tint/statements/for/condition/array_ctor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..141cd27664 --- /dev/null +++ b/test/tint/statements/for/condition/array_ctor.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int i = 0; + [loop] while (true) { + const int tint_symbol[1] = {1}; + if (!((i < tint_symbol[0]))) { + break; + } + { + } + } +} diff --git a/test/tint/statements/for/condition/array_ctor.wgsl.expected.msl b/test/tint/statements/for/condition/array_ctor.wgsl.expected.msl index 5aefd59235..db046461f6 100644 --- a/test/tint/statements/for/condition/array_ctor.wgsl.expected.msl +++ b/test/tint/statements/for/condition/array_ctor.wgsl.expected.msl @@ -1,15 +1,24 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[1]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; void f() { int i = 0; while (true) { - tint_array_wrapper const tint_symbol = {.arr={1}}; - if (!((i < tint_symbol.arr[0]))) { + tint_array const tint_symbol = tint_array{1}; + if (!((i < tint_symbol[0]))) { break; } { diff --git a/test/tint/statements/for/condition/array_ctor.wgsl.expected.spvasm b/test/tint/statements/for/condition/array_ctor.wgsl.expected.spvasm index b86a19fc5f..e2595ccdd5 100644 --- a/test/tint/statements/for/condition/array_ctor.wgsl.expected.spvasm +++ b/test/tint/statements/for/condition/array_ctor.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,18 +10,12 @@ OpName %unused_entry_point "unused_entry_point" OpName %f "f" OpName %i "i" - OpDecorate %_arr_int_uint_1 ArrayStride 4 %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 %_ptr_Function_int = OpTypePointer Function %int %10 = OpConstantNull %int - %uint = OpTypeInt 32 0 - %uint_1 = OpConstant %uint 1 -%_arr_int_uint_1 = OpTypeArray %int %uint_1 %int_1 = OpConstant %int 1 - %21 = OpConstantComposite %_arr_int_uint_1 %int_1 - %int_0 = OpConstant %int 0 %bool = OpTypeBool %unused_entry_point = OpFunction %void None %1 %4 = OpLabel @@ -36,14 +30,13 @@ OpBranch %14 %14 = OpLabel %16 = OpLoad %int %i - %23 = OpCompositeExtract %int %21 0 - %24 = OpSLessThan %bool %16 %23 - %15 = OpLogicalNot %bool %24 - OpSelectionMerge %26 None - OpBranchConditional %15 %27 %26 - %27 = OpLabel + %18 = OpSLessThan %bool %16 %int_1 + %15 = OpLogicalNot %bool %18 + OpSelectionMerge %20 None + OpBranchConditional %15 %21 %20 + %21 = OpLabel OpBranch %12 - %26 = OpLabel + %20 = OpLabel OpBranch %13 %13 = OpLabel OpBranch %11 diff --git a/test/tint/statements/for/condition/basic.wgsl.expected.hlsl b/test/tint/statements/for/condition/basic.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/condition/basic.wgsl.expected.hlsl rename to test/tint/statements/for/condition/basic.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/condition/basic.wgsl.expected.fxc.hlsl b/test/tint/statements/for/condition/basic.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..96122e55e1 --- /dev/null +++ b/test/tint/statements/for/condition/basic.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int i = 0; + { + [loop] for(; (i < 4); ) { + } + } +} diff --git a/test/tint/statements/for/condition/struct_ctor.wgsl.expected.hlsl b/test/tint/statements/for/condition/struct_ctor.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/condition/struct_ctor.wgsl.expected.hlsl rename to test/tint/statements/for/condition/struct_ctor.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/condition/struct_ctor.wgsl.expected.fxc.hlsl b/test/tint/statements/for/condition/struct_ctor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d80f79a7b4 --- /dev/null +++ b/test/tint/statements/for/condition/struct_ctor.wgsl.expected.fxc.hlsl @@ -0,0 +1,20 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int i; +}; + +void f() { + int i = 0; + [loop] while (true) { + const S tint_symbol = {1}; + if (!((i < tint_symbol.i))) { + break; + } + { + } + } +} diff --git a/test/tint/statements/for/condition/struct_ctor.wgsl.expected.msl b/test/tint/statements/for/condition/struct_ctor.wgsl.expected.msl index a89dfc28ad..7ce803aa4b 100644 --- a/test/tint/statements/for/condition/struct_ctor.wgsl.expected.msl +++ b/test/tint/statements/for/condition/struct_ctor.wgsl.expected.msl @@ -8,7 +8,7 @@ struct S { void f() { int i = 0; while (true) { - S const tint_symbol = {.i=1}; + S const tint_symbol = S{.i=1}; if (!((i < tint_symbol.i))) { break; } diff --git a/test/tint/statements/for/condition/struct_ctor.wgsl.expected.spvasm b/test/tint/statements/for/condition/struct_ctor.wgsl.expected.spvasm index 0ad5b63b3b..e2595ccdd5 100644 --- a/test/tint/statements/for/condition/struct_ctor.wgsl.expected.spvasm +++ b/test/tint/statements/for/condition/struct_ctor.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,17 +10,12 @@ OpName %unused_entry_point "unused_entry_point" OpName %f "f" OpName %i "i" - OpName %S "S" - OpMemberName %S 0 "i" - OpMemberDecorate %S 0 Offset 0 %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 %_ptr_Function_int = OpTypePointer Function %int %10 = OpConstantNull %int - %S = OpTypeStruct %int %int_1 = OpConstant %int 1 - %19 = OpConstantComposite %S %int_1 %bool = OpTypeBool %unused_entry_point = OpFunction %void None %1 %4 = OpLabel @@ -35,14 +30,13 @@ OpBranch %14 %14 = OpLabel %16 = OpLoad %int %i - %20 = OpCompositeExtract %int %19 0 - %21 = OpSLessThan %bool %16 %20 - %15 = OpLogicalNot %bool %21 - OpSelectionMerge %23 None - OpBranchConditional %15 %24 %23 - %24 = OpLabel + %18 = OpSLessThan %bool %16 %int_1 + %15 = OpLogicalNot %bool %18 + OpSelectionMerge %20 None + OpBranchConditional %15 %21 %20 + %21 = OpLabel OpBranch %12 - %23 = OpLabel + %20 = OpLabel OpBranch %13 %13 = OpLabel OpBranch %11 diff --git a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.hlsl b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/continuing/array_ctor.wgsl.expected.hlsl rename to test/tint/statements/for/continuing/array_ctor.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.fxc.hlsl b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7348a72604 --- /dev/null +++ b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.fxc.hlsl @@ -0,0 +1,19 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int i = 0; + [loop] while (true) { + if (!(false)) { + break; + } + { + } + { + const int tint_symbol[1] = {1}; + i = (i + tint_symbol[0]); + } + } +} diff --git a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.msl b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.msl index ac6ffc25ab..775e1670c6 100644 --- a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.msl +++ b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.msl @@ -1,8 +1,17 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[1]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; void f() { @@ -14,8 +23,8 @@ void f() { { } { - tint_array_wrapper const tint_symbol = {.arr={1}}; - i = as_type((as_type(i) + as_type(tint_symbol.arr[0]))); + tint_array const tint_symbol = tint_array{1}; + i = as_type((as_type(i) + as_type(tint_symbol[0]))); } } } diff --git a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.spvasm b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.spvasm index 85841095ed..9c2bfcb5a2 100644 --- a/test/tint/statements/for/continuing/array_ctor.wgsl.expected.spvasm +++ b/test/tint/statements/for/continuing/array_ctor.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 29 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,20 +10,14 @@ OpName %unused_entry_point "unused_entry_point" OpName %f "f" OpName %i "i" - OpDecorate %_arr_int_uint_1 ArrayStride 4 %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 %_ptr_Function_int = OpTypePointer Function %int %10 = OpConstantNull %int %bool = OpTypeBool - %false = OpConstantFalse %bool - %uint = OpTypeInt 32 0 - %uint_1 = OpConstant %uint 1 -%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %17 = OpConstantNull %bool %int_1 = OpConstant %int 1 - %25 = OpConstantComposite %_arr_int_uint_1 %int_1 - %int_0 = OpConstant %int 0 %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn @@ -36,7 +30,7 @@ OpLoopMerge %12 %13 None OpBranch %14 %14 = OpLabel - %15 = OpLogicalNot %bool %false + %15 = OpLogicalNot %bool %17 OpSelectionMerge %18 None OpBranchConditional %15 %19 %18 %19 = OpLabel @@ -45,9 +39,8 @@ OpBranch %13 %13 = OpLabel %20 = OpLoad %int %i - %27 = OpCompositeExtract %int %25 0 - %28 = OpIAdd %int %20 %27 - OpStore %i %28 + %22 = OpIAdd %int %20 %int_1 + OpStore %i %22 OpBranch %11 %12 = OpLabel OpReturn diff --git a/test/tint/statements/for/continuing/basic.wgsl.expected.hlsl b/test/tint/statements/for/continuing/basic.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/continuing/basic.wgsl.expected.hlsl rename to test/tint/statements/for/continuing/basic.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/continuing/basic.wgsl.expected.fxc.hlsl b/test/tint/statements/for/continuing/basic.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6b8fc8fbff --- /dev/null +++ b/test/tint/statements/for/continuing/basic.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + int i = 0; + { + [loop] for(; false; i = (i + 1)) { + } + } +} diff --git a/test/tint/statements/for/continuing/basic.wgsl.expected.spvasm b/test/tint/statements/for/continuing/basic.wgsl.expected.spvasm index a7378a0bdf..9c2bfcb5a2 100644 --- a/test/tint/statements/for/continuing/basic.wgsl.expected.spvasm +++ b/test/tint/statements/for/continuing/basic.wgsl.expected.spvasm @@ -16,7 +16,7 @@ %_ptr_Function_int = OpTypePointer Function %int %10 = OpConstantNull %int %bool = OpTypeBool - %false = OpConstantFalse %bool + %17 = OpConstantNull %bool %int_1 = OpConstant %int 1 %unused_entry_point = OpFunction %void None %1 %4 = OpLabel @@ -30,7 +30,7 @@ OpLoopMerge %12 %13 None OpBranch %14 %14 = OpLabel - %15 = OpLogicalNot %bool %false + %15 = OpLogicalNot %bool %17 OpSelectionMerge %18 None OpBranchConditional %15 %19 %18 %19 = OpLabel diff --git a/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.hlsl b/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/continuing/struct_ctor.wgsl.expected.hlsl rename to test/tint/statements/for/continuing/struct_ctor.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.fxc.hlsl b/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4dd0cf2879 --- /dev/null +++ b/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.fxc.hlsl @@ -0,0 +1,25 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int i; +}; + +void f() { + { + int i = 0; + [loop] while (true) { + if (!(false)) { + break; + } + { + } + { + const S tint_symbol = {1}; + i = (i + tint_symbol.i); + } + } + } +} diff --git a/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.msl b/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.msl index 08603f7ca4..cf7b55f00c 100644 --- a/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.msl +++ b/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.msl @@ -15,7 +15,7 @@ void f() { { } { - S const tint_symbol = {.i=1}; + S const tint_symbol = S{.i=1}; i = as_type((as_type(i) + as_type(tint_symbol.i))); } } diff --git a/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.spvasm b/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.spvasm index 11f198cdc5..446eb42ad8 100644 --- a/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.spvasm +++ b/test/tint/statements/for/continuing/struct_ctor.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 27 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,46 +10,39 @@ OpName %unused_entry_point "unused_entry_point" OpName %f "f" OpName %i "i" - OpName %S "S" - OpMemberName %S 0 "i" - OpMemberDecorate %S 0 Offset 0 %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %8 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %11 = OpConstantNull %int %bool = OpTypeBool - %false = OpConstantFalse %bool - %S = OpTypeStruct %int + %17 = OpConstantNull %bool %int_1 = OpConstant %int 1 - %24 = OpConstantComposite %S %int_1 %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %i = OpVariable %_ptr_Function_int Function %11 - OpStore %i %int_0 - OpBranch %12 - %12 = OpLabel - OpLoopMerge %13 %14 None - OpBranch %15 - %15 = OpLabel - %16 = OpLogicalNot %bool %false - OpSelectionMerge %19 None - OpBranchConditional %16 %20 %19 - %20 = OpLabel - OpBranch %13 - %19 = OpLabel + %i = OpVariable %_ptr_Function_int Function %8 + OpStore %i %8 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %12 %13 None OpBranch %14 %14 = OpLabel - %21 = OpLoad %int %i - %25 = OpCompositeExtract %int %24 0 - %26 = OpIAdd %int %21 %25 - OpStore %i %26 + %15 = OpLogicalNot %bool %17 + OpSelectionMerge %18 None + OpBranchConditional %15 %19 %18 + %19 = OpLabel OpBranch %12 + %18 = OpLabel + OpBranch %13 %13 = OpLabel + %20 = OpLoad %int %i + %22 = OpIAdd %int %20 %int_1 + OpStore %i %22 + OpBranch %11 + %12 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/for/empty.wgsl.expected.hlsl b/test/tint/statements/for/empty.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/empty.wgsl.expected.hlsl rename to test/tint/statements/for/empty.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/empty.wgsl.expected.fxc.hlsl b/test/tint/statements/for/empty.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dcc6c45b23 --- /dev/null +++ b/test/tint/statements/for/empty.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + { + [loop] for(; false; ) { + } + } +} diff --git a/test/tint/statements/for/empty.wgsl.expected.spvasm b/test/tint/statements/for/empty.wgsl.expected.spvasm index da1d1d044b..90ebcc9cec 100644 --- a/test/tint/statements/for/empty.wgsl.expected.spvasm +++ b/test/tint/statements/for/empty.wgsl.expected.spvasm @@ -12,7 +12,7 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %bool = OpTypeBool - %false = OpConstantFalse %bool + %13 = OpConstantNull %bool %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn @@ -24,7 +24,7 @@ OpLoopMerge %8 %9 None OpBranch %10 %10 = OpLabel - %11 = OpLogicalNot %bool %false + %11 = OpLogicalNot %bool %13 OpSelectionMerge %14 None OpBranchConditional %11 %15 %14 %15 = OpLabel diff --git a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.hlsl b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/initializer/array_ctor.wgsl.expected.hlsl rename to test/tint/statements/for/initializer/array_ctor.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.fxc.hlsl b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1de4bce0d6 --- /dev/null +++ b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + const int tint_symbol[1] = {1}; + { + [loop] for(int i = tint_symbol[0]; false; ) { + } + } +} diff --git a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.msl b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.msl index aa3d065342..7600e084ff 100644 --- a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.msl +++ b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.msl @@ -1,13 +1,22 @@ #include using namespace metal; -struct tint_array_wrapper { - int arr[1]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; void f() { - tint_array_wrapper const tint_symbol = {.arr={1}}; - for(int i = tint_symbol.arr[0]; false; ) { + tint_array const tint_symbol = tint_array{1}; + for(int i = tint_symbol[0]; false; ) { } } diff --git a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.spvasm b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.spvasm index 1cd44b84ee..d150616ed3 100644 --- a/test/tint/statements/for/initializer/array_ctor.wgsl.expected.spvasm +++ b/test/tint/statements/for/initializer/array_ctor.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 27 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,43 +10,36 @@ OpName %unused_entry_point "unused_entry_point" OpName %f "f" OpName %i "i" - OpDecorate %_arr_int_uint_1 ArrayStride 4 %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %uint = OpTypeInt 32 0 - %uint_1 = OpConstant %uint 1 -%_arr_int_uint_1 = OpTypeArray %int %uint_1 %int_1 = OpConstant %int 1 - %12 = OpConstantComposite %_arr_int_uint_1 %int_1 - %int_0 = OpConstant %int 0 %_ptr_Function_int = OpTypePointer Function %int - %17 = OpConstantNull %int + %11 = OpConstantNull %int %bool = OpTypeBool - %false = OpConstantFalse %bool + %18 = OpConstantNull %bool %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %i = OpVariable %_ptr_Function_int Function %17 - %14 = OpCompositeExtract %int %12 0 - OpStore %i %14 - OpBranch %18 - %18 = OpLabel - OpLoopMerge %19 %20 None - OpBranch %21 - %21 = OpLabel - %22 = OpLogicalNot %bool %false - OpSelectionMerge %25 None - OpBranchConditional %22 %26 %25 - %26 = OpLabel - OpBranch %19 - %25 = OpLabel - OpBranch %20 + %i = OpVariable %_ptr_Function_int Function %11 + OpStore %i %int_1 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLogicalNot %bool %18 + OpSelectionMerge %19 None + OpBranchConditional %16 %20 %19 %20 = OpLabel - OpBranch %18 + OpBranch %13 %19 = OpLabel + OpBranch %14 + %14 = OpLabel + OpBranch %12 + %13 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/for/initializer/basic.wgsl.expected.hlsl b/test/tint/statements/for/initializer/basic.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/initializer/basic.wgsl.expected.hlsl rename to test/tint/statements/for/initializer/basic.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/initializer/basic.wgsl.expected.fxc.hlsl b/test/tint/statements/for/initializer/basic.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ae9892518 --- /dev/null +++ b/test/tint/statements/for/initializer/basic.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + { + [loop] for(int i = 0; false; ) { + } + } +} diff --git a/test/tint/statements/for/initializer/basic.wgsl.expected.spvasm b/test/tint/statements/for/initializer/basic.wgsl.expected.spvasm index 70e3005476..6ee6fd932c 100644 --- a/test/tint/statements/for/initializer/basic.wgsl.expected.spvasm +++ b/test/tint/statements/for/initializer/basic.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -13,33 +13,32 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %8 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %11 = OpConstantNull %int %bool = OpTypeBool - %false = OpConstantFalse %bool + %17 = OpConstantNull %bool %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %i = OpVariable %_ptr_Function_int Function %11 - OpStore %i %int_0 - OpBranch %12 - %12 = OpLabel - OpLoopMerge %13 %14 None - OpBranch %15 - %15 = OpLabel - %16 = OpLogicalNot %bool %false - OpSelectionMerge %19 None - OpBranchConditional %16 %20 %19 - %20 = OpLabel - OpBranch %13 - %19 = OpLabel + %i = OpVariable %_ptr_Function_int Function %8 + OpStore %i %8 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %12 %13 None OpBranch %14 %14 = OpLabel + %15 = OpLogicalNot %bool %17 + OpSelectionMerge %18 None + OpBranchConditional %15 %19 %18 + %19 = OpLabel OpBranch %12 + %18 = OpLabel + OpBranch %13 %13 = OpLabel + OpBranch %11 + %12 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.hlsl b/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/initializer/struct_ctor.wgsl.expected.hlsl rename to test/tint/statements/for/initializer/struct_ctor.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.fxc.hlsl b/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..657fdbeff0 --- /dev/null +++ b/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +struct S { + int i; +}; + +void f() { + const S tint_symbol = {1}; + { + [loop] for(int i = tint_symbol.i; false; ) { + } + } +} diff --git a/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.msl b/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.msl index eb152f76dd..555f775246 100644 --- a/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.msl +++ b/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.msl @@ -6,7 +6,7 @@ struct S { }; void f() { - S const tint_symbol = {.i=1}; + S const tint_symbol = S{.i=1}; for(int i = tint_symbol.i; false; ) { } } diff --git a/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.spvasm b/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.spvasm index 8e7605a53b..d150616ed3 100644 --- a/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.spvasm +++ b/test/tint/statements/for/initializer/struct_ctor.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,43 +9,37 @@ OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpName %unused_entry_point "unused_entry_point" OpName %f "f" - OpName %S "S" - OpMemberName %S 0 "i" OpName %i "i" - OpMemberDecorate %S 0 Offset 0 %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %S = OpTypeStruct %int %int_1 = OpConstant %int 1 - %10 = OpConstantComposite %S %int_1 %_ptr_Function_int = OpTypePointer Function %int - %14 = OpConstantNull %int + %11 = OpConstantNull %int %bool = OpTypeBool - %false = OpConstantFalse %bool + %18 = OpConstantNull %bool %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel - %i = OpVariable %_ptr_Function_int Function %14 - %11 = OpCompositeExtract %int %10 0 - OpStore %i %11 + %i = OpVariable %_ptr_Function_int Function %11 + OpStore %i %int_1 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %13 %14 None OpBranch %15 %15 = OpLabel - OpLoopMerge %16 %17 None - OpBranch %18 - %18 = OpLabel - %19 = OpLogicalNot %bool %false - OpSelectionMerge %22 None - OpBranchConditional %19 %23 %22 - %23 = OpLabel - OpBranch %16 - %22 = OpLabel - OpBranch %17 - %17 = OpLabel - OpBranch %15 - %16 = OpLabel + %16 = OpLogicalNot %bool %18 + OpSelectionMerge %19 None + OpBranchConditional %16 %20 %19 + %20 = OpLabel + OpBranch %13 + %19 = OpLabel + OpBranch %14 + %14 = OpLabel + OpBranch %12 + %13 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/for/scoping.wgsl.expected.hlsl b/test/tint/statements/for/scoping.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/for/scoping.wgsl.expected.hlsl rename to test/tint/statements/for/scoping.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/for/scoping.wgsl.expected.fxc.hlsl b/test/tint/statements/for/scoping.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..16c30ec326 --- /dev/null +++ b/test/tint/statements/for/scoping.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void f() { + { + [loop] for(int must_not_collide = 0; ; ) { + break; + } + } + int must_not_collide = 0; +} diff --git a/test/tint/statements/for/scoping.wgsl.expected.spvasm b/test/tint/statements/for/scoping.wgsl.expected.spvasm index c17a34eb76..0b0e8b7d5f 100644 --- a/test/tint/statements/for/scoping.wgsl.expected.spvasm +++ b/test/tint/statements/for/scoping.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -14,26 +14,25 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %8 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %11 = OpConstantNull %int %unused_entry_point = OpFunction %void None %1 %4 = OpLabel OpReturn OpFunctionEnd %f = OpFunction %void None %1 %6 = OpLabel -%must_not_collide = OpVariable %_ptr_Function_int Function %11 -%must_not_collide_0 = OpVariable %_ptr_Function_int Function %11 - OpStore %must_not_collide %int_0 - OpBranch %12 - %12 = OpLabel - OpLoopMerge %13 %14 None - OpBranch %15 - %15 = OpLabel - OpBranch %13 +%must_not_collide = OpVariable %_ptr_Function_int Function %8 +%must_not_collide_0 = OpVariable %_ptr_Function_int Function %8 + OpStore %must_not_collide %8 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 %14 = OpLabel OpBranch %12 %13 = OpLabel + OpBranch %11 + %12 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/increment/array_element.wgsl.expected.hlsl b/test/tint/statements/increment/array_element.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/increment/array_element.wgsl.expected.hlsl rename to test/tint/statements/increment/array_element.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/increment/array_element.wgsl.expected.fxc.hlsl b/test/tint/statements/increment/array_element.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9db143fafc --- /dev/null +++ b/test/tint/statements/increment/array_element.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer a : register(u0, space0); + +void main() { + a.Store(4u, asuint((a.Load(4u) + 1u))); +} diff --git a/test/tint/statements/increment/array_element.wgsl.expected.msl b/test/tint/statements/increment/array_element.wgsl.expected.msl index 0347508612..4d41bf9634 100644 --- a/test/tint/statements/increment/array_element.wgsl.expected.msl +++ b/test/tint/statements/increment/array_element.wgsl.expected.msl @@ -1,7 +1,20 @@ #include using namespace metal; -void tint_symbol(device uint (*const tint_symbol_2)[1]) { + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void tint_symbol(device tint_array* const tint_symbol_2) { (*(tint_symbol_2))[1] = ((*(tint_symbol_2))[1] + 1u); } diff --git a/test/tint/statements/increment/complex.wgsl.expected.hlsl b/test/tint/statements/increment/complex.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/increment/complex.wgsl.expected.hlsl rename to test/tint/statements/increment/complex.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/increment/complex.wgsl.expected.fxc.hlsl b/test/tint/statements/increment/complex.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..06d410ad12 --- /dev/null +++ b/test/tint/statements/increment/complex.wgsl.expected.fxc.hlsl @@ -0,0 +1,63 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer buffer : register(u0, space0); +static uint v = 0u; + +int idx1() { + v = (v + 1u); + return 1; +} + +int idx2() { + v = (v + 1u); + return 2; +} + +int idx3() { + v = (v + 1u); + return 3; +} + +int idx4() { + v = (v + 1u); + return 4; +} + +int idx5() { + v = (v + 1u); + return 0; +} + +int idx6() { + v = (v + 1u); + return 2; +} + +void main() { + const int tint_symbol_4 = idx1(); + const int tint_symbol_5 = idx2(); + const int tint_symbol_save = tint_symbol_4; + const int tint_symbol_save_1 = tint_symbol_5; + const int tint_symbol_1 = idx3(); + { + buffer.Store((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))))) + 1))); + [loop] while (true) { + if (!((v < 10u))) { + break; + } + { + } + { + const int tint_symbol_6 = idx4(); + const int tint_symbol_7 = idx5(); + const int tint_symbol_2_save = tint_symbol_6; + const int tint_symbol_2_save_1 = tint_symbol_7; + const int tint_symbol_3 = idx6(); + buffer.Store((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))))) + 1))); + } + } + } +} diff --git a/test/tint/statements/increment/complex.wgsl.expected.msl b/test/tint/statements/increment/complex.wgsl.expected.msl index fbc0f9c862..3f31988eac 100644 --- a/test/tint/statements/increment/complex.wgsl.expected.msl +++ b/test/tint/statements/increment/complex.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct tint_array_wrapper { - /* 0x0000 */ int4 arr[4]; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; struct S { - /* 0x0000 */ tint_array_wrapper a; + /* 0x0000 */ tint_array a; }; int idx1(thread uint* const tint_symbol_10) { @@ -39,14 +48,14 @@ int idx6(thread uint* const tint_symbol_15) { return 2; } -void tint_symbol_1(thread uint* const tint_symbol_16, device S (*const tint_symbol_17)[1]) { +void tint_symbol_1(thread uint* const tint_symbol_16, device tint_array* const tint_symbol_17) { int const tint_symbol_6 = idx1(tint_symbol_16); int const tint_symbol_7 = idx2(tint_symbol_16); int const tint_symbol_2_save = tint_symbol_6; int const tint_symbol_2_save_1 = tint_symbol_7; int const tint_symbol_3 = idx3(tint_symbol_16); { - (*(tint_symbol_17))[tint_symbol_2_save].a.arr[tint_symbol_2_save_1][tint_symbol_3] = as_type((as_type((*(tint_symbol_17))[tint_symbol_2_save].a.arr[tint_symbol_2_save_1][tint_symbol_3]) + as_type(1))); + (*(tint_symbol_17))[tint_symbol_2_save].a[tint_symbol_2_save_1][tint_symbol_3] = as_type((as_type((*(tint_symbol_17))[tint_symbol_2_save].a[tint_symbol_2_save_1][tint_symbol_3]) + as_type(1))); while (true) { if (!((*(tint_symbol_16) < 10u))) { break; @@ -59,7 +68,7 @@ void tint_symbol_1(thread uint* const tint_symbol_16, device S (*const tint_symb int const tint_symbol_4_save = tint_symbol_8; int const tint_symbol_4_save_1 = tint_symbol_9; int const tint_symbol_5 = idx6(tint_symbol_16); - (*(tint_symbol_17))[tint_symbol_4_save].a.arr[tint_symbol_4_save_1][tint_symbol_5] = as_type((as_type((*(tint_symbol_17))[tint_symbol_4_save].a.arr[tint_symbol_4_save_1][tint_symbol_5]) + as_type(1))); + (*(tint_symbol_17))[tint_symbol_4_save].a[tint_symbol_4_save_1][tint_symbol_5] = as_type((as_type((*(tint_symbol_17))[tint_symbol_4_save].a[tint_symbol_4_save_1][tint_symbol_5]) + as_type(1))); } } } diff --git a/test/tint/statements/increment/complex.wgsl.expected.spvasm b/test/tint/statements/increment/complex.wgsl.expected.spvasm index 9cb91f0c1d..3397256a0a 100644 --- a/test/tint/statements/increment/complex.wgsl.expected.spvasm +++ b/test/tint/statements/increment/complex.wgsl.expected.spvasm @@ -49,7 +49,7 @@ %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 %int_4 = OpConstant %int 4 - %int_0 = OpConstant %int 0 + %44 = OpConstantNull %int %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %uint_10 = OpConstant %uint 10 @@ -91,7 +91,7 @@ %42 = OpLoad %uint %v %43 = OpIAdd %uint %42 %uint_1 OpStore %v %43 - OpReturnValue %int_0 + OpReturnValue %44 OpFunctionEnd %idx6 = OpFunction %int None %18 %46 = OpLabel diff --git a/test/tint/statements/increment/for_loop_continuing.wgsl.expected.hlsl b/test/tint/statements/increment/for_loop_continuing.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/increment/for_loop_continuing.wgsl.expected.hlsl rename to test/tint/statements/increment/for_loop_continuing.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/increment/for_loop_continuing.wgsl.expected.fxc.hlsl b/test/tint/statements/increment/for_loop_continuing.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..836d2459e1 --- /dev/null +++ b/test/tint/statements/increment/for_loop_continuing.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer i : register(u0, space0); + +void main() { + { + [loop] for(; (i.Load(0u) < 10u); i.Store(0u, asuint((i.Load(0u) + 1u)))) { + } + } +} diff --git a/test/tint/statements/increment/for_loop_initializer.wgsl.expected.hlsl b/test/tint/statements/increment/for_loop_initializer.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/increment/for_loop_initializer.wgsl.expected.hlsl rename to test/tint/statements/increment/for_loop_initializer.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/increment/for_loop_initializer.wgsl.expected.fxc.hlsl b/test/tint/statements/increment/for_loop_initializer.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8653efa400 --- /dev/null +++ b/test/tint/statements/increment/for_loop_initializer.wgsl.expected.fxc.hlsl @@ -0,0 +1,13 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer i : register(u0, space0); + +void main() { + { + [loop] for(i.Store(0u, asuint((i.Load(0u) + 1u))); (i.Load(0u) < 10u); ) { + } + } +} diff --git a/test/tint/statements/increment/function.wgsl.expected.hlsl b/test/tint/statements/increment/function.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/increment/function.wgsl.expected.hlsl rename to test/tint/statements/increment/function.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/increment/function.wgsl.expected.fxc.hlsl b/test/tint/statements/increment/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..900a2d0fb5 --- /dev/null +++ b/test/tint/statements/increment/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +void main() { + int i = 0; + i = (i + 1); +} diff --git a/test/tint/statements/increment/function.wgsl.expected.spvasm b/test/tint/statements/increment/function.wgsl.expected.spvasm index 0ed1409759..8a57c15959 100644 --- a/test/tint/statements/increment/function.wgsl.expected.spvasm +++ b/test/tint/statements/increment/function.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 15 +; Bound: 14 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -13,9 +13,8 @@ %void = OpTypeVoid %1 = OpTypeFunction %void %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %8 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %11 = OpConstantNull %int %int_1 = OpConstant %int 1 %unused_entry_point = OpFunction %void None %1 %4 = OpLabel @@ -23,10 +22,10 @@ OpFunctionEnd %main = OpFunction %void None %1 %6 = OpLabel - %i = OpVariable %_ptr_Function_int Function %11 - OpStore %i %int_0 - %12 = OpLoad %int %i - %14 = OpIAdd %int %12 %int_1 - OpStore %i %14 + %i = OpVariable %_ptr_Function_int Function %8 + OpStore %i %8 + %11 = OpLoad %int %i + %13 = OpIAdd %int %11 %int_1 + OpStore %i %13 OpReturn OpFunctionEnd diff --git a/test/tint/statements/increment/private.wgsl.expected.hlsl b/test/tint/statements/increment/private.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/increment/private.wgsl.expected.hlsl rename to test/tint/statements/increment/private.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/increment/private.wgsl.expected.fxc.hlsl b/test/tint/statements/increment/private.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d5883bcfd9 --- /dev/null +++ b/test/tint/statements/increment/private.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int i = 0; + +void main() { + i = (i + 1); +} diff --git a/test/tint/statements/increment/private.wgsl.expected.msl b/test/tint/statements/increment/private.wgsl.expected.msl index 4cf93e4c0f..019bc09dc7 100644 --- a/test/tint/statements/increment/private.wgsl.expected.msl +++ b/test/tint/statements/increment/private.wgsl.expected.msl @@ -1,7 +1,8 @@ #include using namespace metal; -void tint_symbol(thread int* const tint_symbol_1) { - *(tint_symbol_1) = as_type((as_type(*(tint_symbol_1)) + as_type(1))); +void tint_symbol() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = as_type((as_type(tint_symbol_1) + as_type(1))); } diff --git a/test/tint/statements/increment/private.wgsl.expected.spvasm b/test/tint/statements/increment/private.wgsl.expected.spvasm index c05c570a5d..fa8fba6804 100644 --- a/test/tint/statements/increment/private.wgsl.expected.spvasm +++ b/test/tint/statements/increment/private.wgsl.expected.spvasm @@ -11,9 +11,9 @@ OpName %unused_entry_point "unused_entry_point" OpName %main "main" %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %2 = OpConstantNull %int %_ptr_Private_int = OpTypePointer Private %int - %i = OpVariable %_ptr_Private_int Private %int_0 + %i = OpVariable %_ptr_Private_int Private %2 %void = OpTypeVoid %5 = OpTypeFunction %void %int_1 = OpConstant %int 1 diff --git a/test/tint/statements/increment/storage.wgsl.expected.hlsl b/test/tint/statements/increment/storage.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/increment/storage.wgsl.expected.hlsl rename to test/tint/statements/increment/storage.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/increment/storage.wgsl.expected.fxc.hlsl b/test/tint/statements/increment/storage.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..219ed95a3c --- /dev/null +++ b/test/tint/statements/increment/storage.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer i : register(u0, space0); + +void main() { + i.Store(0u, asuint((i.Load(0u) + 1u))); +} diff --git a/test/tint/statements/increment/vector_component.wgsl.expected.hlsl b/test/tint/statements/increment/vector_component.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/increment/vector_component.wgsl.expected.hlsl rename to test/tint/statements/increment/vector_component.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/increment/vector_component.wgsl.expected.fxc.hlsl b/test/tint/statements/increment/vector_component.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95c9272ea0 --- /dev/null +++ b/test/tint/statements/increment/vector_component.wgsl.expected.fxc.hlsl @@ -0,0 +1,12 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +RWByteAddressBuffer a : register(u0, space0); + +void main() { + const int tint_symbol_1 = 1; + a.Store((4u * uint(tint_symbol_1)), asuint((a.Load((4u * uint(tint_symbol_1))) + 1u))); + a.Store(8u, asuint((a.Load(8u) + 1u))); +} diff --git a/test/tint/statements/increment/workgroup.wgsl.expected.hlsl b/test/tint/statements/increment/workgroup.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/increment/workgroup.wgsl.expected.hlsl rename to test/tint/statements/increment/workgroup.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/increment/workgroup.wgsl.expected.fxc.hlsl b/test/tint/statements/increment/workgroup.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d8306403cb --- /dev/null +++ b/test/tint/statements/increment/workgroup.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +groupshared int i; + +void main() { + i = (i + 1); +} diff --git a/test/tint/statements/switch/common.wgsl b/test/tint/statements/switch/common.wgsl index 6b8735d1ac..cdebc4e320 100644 --- a/test/tint/statements/switch/common.wgsl +++ b/test/tint/statements/switch/common.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var i : i32; var result : i32; diff --git a/test/tint/statements/switch/common.wgsl.expected.hlsl b/test/tint/statements/switch/common.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/switch/common.wgsl.expected.hlsl rename to test/tint/statements/switch/common.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/switch/common.wgsl.expected.fxc.hlsl b/test/tint/statements/switch/common.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7aa505cf7e --- /dev/null +++ b/test/tint/statements/switch/common.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +[numthreads(1, 1, 1)] +void f() { + int i = 0; + int result = 0; + switch(i) { + case 0: { + result = 10; + break; + } + case 1: { + result = 22; + break; + } + case 2: { + result = 33; + break; + } + default: { + result = 44; + break; + } + } + return; +} diff --git a/test/tint/statements/switch/common.wgsl.expected.wgsl b/test/tint/statements/switch/common.wgsl.expected.wgsl index 8b56b034b6..8e96822eec 100644 --- a/test/tint/statements/switch/common.wgsl.expected.wgsl +++ b/test/tint/statements/switch/common.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var i : i32; var result : i32; diff --git a/test/tint/statements/switch/fallthrough.wgsl b/test/tint/statements/switch/fallthrough.wgsl index 70691c8176..667a8f2f6e 100644 --- a/test/tint/statements/switch/fallthrough.wgsl +++ b/test/tint/statements/switch/fallthrough.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var i : i32; switch(i) { diff --git a/test/tint/statements/switch/fallthrough.wgsl.expected.dxc.hlsl b/test/tint/statements/switch/fallthrough.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0401873c43 --- /dev/null +++ b/test/tint/statements/switch/fallthrough.wgsl.expected.dxc.hlsl @@ -0,0 +1,20 @@ +statements/switch/fallthrough.wgsl:6:13 warning: use of deprecated language feature: fallthrough is set to be removed from WGSL. Case can accept multiple selectors if the existing case bodies are empty. default is not yet supported in a case selector list. + fallthrough; + ^^^^^^^^^^^ + +[numthreads(1, 1, 1)] +void f() { + int i = 0; + switch(i) { + case 0: { + /* fallthrough */ + { + break; + } + } + default: { + break; + } + } + return; +} diff --git a/test/tint/statements/switch/fallthrough.wgsl.expected.fxc.hlsl b/test/tint/statements/switch/fallthrough.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0401873c43 --- /dev/null +++ b/test/tint/statements/switch/fallthrough.wgsl.expected.fxc.hlsl @@ -0,0 +1,20 @@ +statements/switch/fallthrough.wgsl:6:13 warning: use of deprecated language feature: fallthrough is set to be removed from WGSL. Case can accept multiple selectors if the existing case bodies are empty. default is not yet supported in a case selector list. + fallthrough; + ^^^^^^^^^^^ + +[numthreads(1, 1, 1)] +void f() { + int i = 0; + switch(i) { + case 0: { + /* fallthrough */ + { + break; + } + } + default: { + break; + } + } + return; +} diff --git a/test/tint/statements/switch/fallthrough.wgsl.expected.glsl b/test/tint/statements/switch/fallthrough.wgsl.expected.glsl index 85c42c0ea8..a8ba89975f 100644 --- a/test/tint/statements/switch/fallthrough.wgsl.expected.glsl +++ b/test/tint/statements/switch/fallthrough.wgsl.expected.glsl @@ -1,3 +1,7 @@ +statements/switch/fallthrough.wgsl:6:13 warning: use of deprecated language feature: fallthrough is set to be removed from WGSL. Case can accept multiple selectors if the existing case bodies are empty. default is not yet supported in a case selector list. + fallthrough; + ^^^^^^^^^^^ + #version 310 es void f() { diff --git a/test/tint/statements/switch/fallthrough.wgsl.expected.hlsl b/test/tint/statements/switch/fallthrough.wgsl.expected.hlsl deleted file mode 100644 index dc4b920c0c..0000000000 --- a/test/tint/statements/switch/fallthrough.wgsl.expected.hlsl +++ /dev/null @@ -1,16 +0,0 @@ -[numthreads(1, 1, 1)] -void f() { - int i = 0; - switch(i) { - case 0: { - /* fallthrough */ - { - break; - } - } - default: { - break; - } - } - return; -} diff --git a/test/tint/statements/switch/fallthrough.wgsl.expected.msl b/test/tint/statements/switch/fallthrough.wgsl.expected.msl index 93fa98e1d9..3377486b65 100644 --- a/test/tint/statements/switch/fallthrough.wgsl.expected.msl +++ b/test/tint/statements/switch/fallthrough.wgsl.expected.msl @@ -1,3 +1,7 @@ +statements/switch/fallthrough.wgsl:6:13 warning: use of deprecated language feature: fallthrough is set to be removed from WGSL. Case can accept multiple selectors if the existing case bodies are empty. default is not yet supported in a case selector list. + fallthrough; + ^^^^^^^^^^^ + #include using namespace metal; diff --git a/test/tint/statements/switch/fallthrough.wgsl.expected.spvasm b/test/tint/statements/switch/fallthrough.wgsl.expected.spvasm index 4e8b98921f..4daf8702ce 100644 --- a/test/tint/statements/switch/fallthrough.wgsl.expected.spvasm +++ b/test/tint/statements/switch/fallthrough.wgsl.expected.spvasm @@ -1,3 +1,7 @@ +statements/switch/fallthrough.wgsl:6:13 warning: use of deprecated language feature: fallthrough is set to be removed from WGSL. Case can accept multiple selectors if the existing case bodies are empty. default is not yet supported in a case selector list. + fallthrough; + ^^^^^^^^^^^ + ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 diff --git a/test/tint/statements/switch/fallthrough.wgsl.expected.wgsl b/test/tint/statements/switch/fallthrough.wgsl.expected.wgsl index b04e882d1a..b352c8fde8 100644 --- a/test/tint/statements/switch/fallthrough.wgsl.expected.wgsl +++ b/test/tint/statements/switch/fallthrough.wgsl.expected.wgsl @@ -1,4 +1,8 @@ -@stage(compute) @workgroup_size(1) +statements/switch/fallthrough.wgsl:6:13 warning: use of deprecated language feature: fallthrough is set to be removed from WGSL. Case can accept multiple selectors if the existing case bodies are empty. default is not yet supported in a case selector list. + fallthrough; + ^^^^^^^^^^^ + +@compute @workgroup_size(1) fn f() { var i : i32; switch(i) { diff --git a/test/tint/statements/switch/only_default_case.wgsl b/test/tint/statements/switch/only_default_case.wgsl index dcecc4d8ed..967282bbb0 100644 --- a/test/tint/statements/switch/only_default_case.wgsl +++ b/test/tint/statements/switch/only_default_case.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var i : i32; var result : i32; diff --git a/test/tint/statements/switch/only_default_case.wgsl.expected.hlsl b/test/tint/statements/switch/only_default_case.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/statements/switch/only_default_case.wgsl.expected.hlsl rename to test/tint/statements/switch/only_default_case.wgsl.expected.dxc.hlsl diff --git a/test/tint/statements/switch/only_default_case.wgsl.expected.fxc.hlsl b/test/tint/statements/switch/only_default_case.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..128b8a2393 --- /dev/null +++ b/test/tint/statements/switch/only_default_case.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +[numthreads(1, 1, 1)] +void f() { + int i = 0; + int result = 0; + i; + do { + result = 44; + break; + } while (false); + return; +} diff --git a/test/tint/statements/switch/only_default_case.wgsl.expected.wgsl b/test/tint/statements/switch/only_default_case.wgsl.expected.wgsl index 234f2565c8..d3ab4f79dc 100644 --- a/test/tint/statements/switch/only_default_case.wgsl.expected.wgsl +++ b/test/tint/statements/switch/only_default_case.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn f() { var i : i32; var result : i32; diff --git a/test/tint/struct/type_constructor.wgsl b/test/tint/struct/type_constructor.wgsl index b55690207e..30c3dbea79 100644 --- a/test/tint/struct/type_constructor.wgsl +++ b/test/tint/struct/type_constructor.wgsl @@ -20,7 +20,7 @@ struct T { a : array, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x : i32 = 42; diff --git a/test/tint/struct/type_constructor.wgsl.expected.hlsl b/test/tint/struct/type_constructor.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/struct/type_constructor.wgsl.expected.hlsl rename to test/tint/struct/type_constructor.wgsl.expected.dxc.hlsl diff --git a/test/tint/struct/type_constructor.wgsl.expected.fxc.hlsl b/test/tint/struct/type_constructor.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f6285aaa88 --- /dev/null +++ b/test/tint/struct/type_constructor.wgsl.expected.fxc.hlsl @@ -0,0 +1,58 @@ +struct S1 { + int a; + int b; + int c; + int d; +}; +struct S2 { + int e; + S1 f; +}; +struct S3 { + int g; + S1 h; + S2 i; +}; +struct T { + int a[2]; +}; + +[numthreads(1, 1, 1)] +void main() { + const int x = 42; + const S1 empty = (S1)0; + const S1 nonempty = {1, 2, 3, 4}; + const S1 nonempty_with_expr = {1, x, (x + 1), nonempty.d}; + const S3 nested_empty = (S3)0; + const S1 tint_symbol = {2, 3, 4, 5}; + const S1 tint_symbol_1 = {7, 8, 9, 10}; + const S2 tint_symbol_2 = {6, tint_symbol_1}; + const S3 nested_nonempty = {1, tint_symbol, tint_symbol_2}; + const S1 tint_symbol_3 = {2, x, (x + 1), nested_nonempty.i.f.d}; + const S2 tint_symbol_4 = {6, nonempty}; + const S3 nested_nonempty_with_expr = {1, tint_symbol_3, tint_symbol_4}; + const S1 tint_symbol_5 = (S1)0; + const int subexpr_empty = tint_symbol_5.a; + const S1 tint_symbol_6 = {1, 2, 3, 4}; + const int subexpr_nonempty = tint_symbol_6.b; + const S1 tint_symbol_7 = {1, x, (x + 1), nonempty.d}; + const int subexpr_nonempty_with_expr = tint_symbol_7.c; + const S2 tint_symbol_8 = (S2)0; + const S1 subexpr_nested_empty = tint_symbol_8.f; + const S1 tint_symbol_9 = {2, 3, 4, 5}; + const S2 tint_symbol_10 = {1, tint_symbol_9}; + const S1 subexpr_nested_nonempty = tint_symbol_10.f; + const S1 tint_symbol_11 = {2, x, (x + 1), nested_nonempty.i.f.d}; + const S2 tint_symbol_12 = {1, tint_symbol_11}; + const S1 subexpr_nested_nonempty_with_expr = tint_symbol_12.f; + const T aosoa_empty[2] = (T[2])0; + const int tint_symbol_13[2] = {1, 2}; + const T tint_symbol_14 = {tint_symbol_13}; + const int tint_symbol_15[2] = {3, 4}; + const T tint_symbol_16 = {tint_symbol_15}; + const T aosoa_nonempty[2] = {tint_symbol_14, tint_symbol_16}; + const int tint_symbol_17[2] = {1, (aosoa_nonempty[0].a[0] + 1)}; + const T tint_symbol_18 = {tint_symbol_17}; + const T aosoa_nonempty_with_expr[2] = {tint_symbol_18, aosoa_nonempty[1]}; + return; +} diff --git a/test/tint/struct/type_constructor.wgsl.expected.msl b/test/tint/struct/type_constructor.wgsl.expected.msl index e36df06a43..55e2b9b0c0 100644 --- a/test/tint/struct/type_constructor.wgsl.expected.msl +++ b/test/tint/struct/type_constructor.wgsl.expected.msl @@ -1,6 +1,19 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S1 { int a; int b; @@ -19,54 +32,46 @@ struct S3 { S2 i; }; -struct tint_array_wrapper { - int arr[2]; -}; - struct T { - tint_array_wrapper a; -}; - -struct tint_array_wrapper_1 { - T arr[2]; + tint_array a; }; kernel void tint_symbol() { int const x = 42; - S1 const empty = {}; - S1 const nonempty = {.a=1, .b=2, .c=3, .d=4}; + S1 const empty = S1{}; + S1 const nonempty = S1{.a=1, .b=2, .c=3, .d=4}; S1 const nonempty_with_expr = {.a=1, .b=x, .c=as_type((as_type(x) + as_type(1))), .d=nonempty.d}; - S3 const nested_empty = {}; - S1 const tint_symbol_1 = {.a=2, .b=3, .c=4, .d=5}; - S1 const tint_symbol_2 = {.a=7, .b=8, .c=9, .d=10}; + S3 const nested_empty = S3{}; + S1 const tint_symbol_1 = S1{.a=2, .b=3, .c=4, .d=5}; + S1 const tint_symbol_2 = S1{.a=7, .b=8, .c=9, .d=10}; S2 const tint_symbol_3 = {.e=6, .f=tint_symbol_2}; S3 const nested_nonempty = {.g=1, .h=tint_symbol_1, .i=tint_symbol_3}; S1 const tint_symbol_4 = {.a=2, .b=x, .c=as_type((as_type(x) + as_type(1))), .d=nested_nonempty.i.f.d}; S2 const tint_symbol_5 = {.e=6, .f=nonempty}; S3 const nested_nonempty_with_expr = {.g=1, .h=tint_symbol_4, .i=tint_symbol_5}; - S1 const tint_symbol_6 = {}; + S1 const tint_symbol_6 = S1{}; int const subexpr_empty = tint_symbol_6.a; - S1 const tint_symbol_7 = {.a=1, .b=2, .c=3, .d=4}; + S1 const tint_symbol_7 = S1{.a=1, .b=2, .c=3, .d=4}; int const subexpr_nonempty = tint_symbol_7.b; S1 const tint_symbol_8 = {.a=1, .b=x, .c=as_type((as_type(x) + as_type(1))), .d=nonempty.d}; int const subexpr_nonempty_with_expr = tint_symbol_8.c; - S2 const tint_symbol_9 = {}; + S2 const tint_symbol_9 = S2{}; S1 const subexpr_nested_empty = tint_symbol_9.f; - S1 const tint_symbol_10 = {.a=2, .b=3, .c=4, .d=5}; + S1 const tint_symbol_10 = S1{.a=2, .b=3, .c=4, .d=5}; S2 const tint_symbol_11 = {.e=1, .f=tint_symbol_10}; S1 const subexpr_nested_nonempty = tint_symbol_11.f; S1 const tint_symbol_12 = {.a=2, .b=x, .c=as_type((as_type(x) + as_type(1))), .d=nested_nonempty.i.f.d}; S2 const tint_symbol_13 = {.e=1, .f=tint_symbol_12}; S1 const subexpr_nested_nonempty_with_expr = tint_symbol_13.f; - tint_array_wrapper_1 const aosoa_empty = {.arr={}}; - tint_array_wrapper const tint_symbol_14 = {.arr={1, 2}}; + tint_array const aosoa_empty = tint_array{}; + tint_array const tint_symbol_14 = tint_array{1, 2}; T const tint_symbol_15 = {.a=tint_symbol_14}; - tint_array_wrapper const tint_symbol_16 = {.arr={3, 4}}; + tint_array const tint_symbol_16 = tint_array{3, 4}; T const tint_symbol_17 = {.a=tint_symbol_16}; - tint_array_wrapper_1 const aosoa_nonempty = {.arr={tint_symbol_15, tint_symbol_17}}; - tint_array_wrapper const tint_symbol_18 = {.arr={1, as_type((as_type(aosoa_nonempty.arr[0].a.arr[0]) + as_type(1)))}}; + tint_array const aosoa_nonempty = tint_array{tint_symbol_15, tint_symbol_17}; + tint_array const tint_symbol_18 = tint_array{1, as_type((as_type(aosoa_nonempty[0].a[0]) + as_type(1)))}; T const tint_symbol_19 = {.a=tint_symbol_18}; - tint_array_wrapper_1 const aosoa_nonempty_with_expr = {.arr={tint_symbol_19, aosoa_nonempty.arr[1]}}; + tint_array const aosoa_nonempty_with_expr = tint_array{tint_symbol_19, aosoa_nonempty[1]}; return; } diff --git a/test/tint/struct/type_constructor.wgsl.expected.spvasm b/test/tint/struct/type_constructor.wgsl.expected.spvasm index ad4d67bcdc..22a96ee497 100644 --- a/test/tint/struct/type_constructor.wgsl.expected.spvasm +++ b/test/tint/struct/type_constructor.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 74 +; Bound: 68 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -58,20 +58,18 @@ %27 = OpConstantComposite %S1 %int_7 %int_8 %int_9 %int_10 %28 = OpConstantComposite %S2 %int_6 %27 %29 = OpConstantComposite %S3 %int_1 %21 %28 - %43 = OpConstantNull %S2 - %45 = OpConstantComposite %S2 %int_1 %21 + %37 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 %_arr_int_uint_2 = OpTypeArray %int %uint_2 %T = OpTypeStruct %_arr_int_uint_2 %_arr_T_uint_2 = OpTypeArray %T %uint_2 - %59 = OpConstantNull %_arr_T_uint_2 - %60 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2 - %61 = OpConstantComposite %T %60 - %62 = OpConstantComposite %_arr_int_uint_2 %int_3 %int_4 - %63 = OpConstantComposite %T %62 - %64 = OpConstantComposite %_arr_T_uint_2 %61 %63 - %int_0 = OpConstant %int 0 + %54 = OpConstantNull %_arr_T_uint_2 + %55 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2 + %56 = OpConstantComposite %T %55 + %57 = OpConstantComposite %_arr_int_uint_2 %int_3 %int_4 + %58 = OpConstantComposite %T %57 + %59 = OpConstantComposite %_arr_T_uint_2 %56 %58 %main = OpFunction %void None %1 %4 = OpLabel %14 = OpIAdd %int %int_42 %int_1 @@ -84,28 +82,24 @@ %34 = OpCompositeConstruct %S1 %int_2 %int_42 %30 %33 %35 = OpCompositeConstruct %S2 %int_6 %13 %36 = OpCompositeConstruct %S3 %int_1 %34 %35 - %37 = OpCompositeExtract %int %8 0 - %38 = OpCompositeExtract %int %13 1 - %39 = OpIAdd %int %int_42 %int_1 - %40 = OpCompositeExtract %int %13 3 - %41 = OpCompositeConstruct %S1 %int_1 %int_42 %39 %40 - %42 = OpCompositeExtract %int %41 2 + %38 = OpIAdd %int %int_42 %int_1 + %39 = OpCompositeExtract %int %13 3 + %40 = OpCompositeConstruct %S1 %int_1 %int_42 %38 %39 + %41 = OpCompositeExtract %int %40 2 + %42 = OpIAdd %int %int_42 %int_1 + %43 = OpCompositeExtract %S2 %29 2 %44 = OpCompositeExtract %S1 %43 1 - %46 = OpCompositeExtract %S1 %45 1 - %47 = OpIAdd %int %int_42 %int_1 - %48 = OpCompositeExtract %S2 %29 2 - %49 = OpCompositeExtract %S1 %48 1 - %50 = OpCompositeExtract %int %49 3 - %51 = OpCompositeConstruct %S1 %int_2 %int_42 %47 %50 - %52 = OpCompositeConstruct %S2 %int_1 %51 - %53 = OpCompositeExtract %S1 %52 1 - %66 = OpCompositeExtract %T %64 0 - %67 = OpCompositeExtract %_arr_int_uint_2 %66 0 - %68 = OpCompositeExtract %int %67 0 - %69 = OpIAdd %int %68 %int_1 - %70 = OpCompositeConstruct %_arr_int_uint_2 %int_1 %69 - %71 = OpCompositeConstruct %T %70 - %72 = OpCompositeExtract %T %64 1 - %73 = OpCompositeConstruct %_arr_T_uint_2 %71 %72 + %45 = OpCompositeExtract %int %44 3 + %46 = OpCompositeConstruct %S1 %int_2 %int_42 %42 %45 + %47 = OpCompositeConstruct %S2 %int_1 %46 + %48 = OpCompositeExtract %S1 %47 1 + %60 = OpCompositeExtract %T %59 0 + %61 = OpCompositeExtract %_arr_int_uint_2 %60 0 + %62 = OpCompositeExtract %int %61 0 + %63 = OpIAdd %int %62 %int_1 + %64 = OpCompositeConstruct %_arr_int_uint_2 %int_1 %63 + %65 = OpCompositeConstruct %T %64 + %66 = OpCompositeExtract %T %59 1 + %67 = OpCompositeConstruct %_arr_T_uint_2 %65 %66 OpReturn OpFunctionEnd diff --git a/test/tint/struct/type_constructor.wgsl.expected.wgsl b/test/tint/struct/type_constructor.wgsl.expected.wgsl index 6d26b5d1d7..b0a3147143 100644 --- a/test/tint/struct/type_constructor.wgsl.expected.wgsl +++ b/test/tint/struct/type_constructor.wgsl.expected.wgsl @@ -20,7 +20,7 @@ struct T { a : array, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let x : i32 = 42; let empty : S1 = S1(); diff --git a/test/tint/types/function_scope_declarations.wgsl b/test/tint/types/function_scope_declarations.wgsl index 9debfecd7c..938fbf510b 100644 --- a/test/tint/types/function_scope_declarations.wgsl +++ b/test/tint/types/function_scope_declarations.wgsl @@ -2,7 +2,7 @@ struct S { a : f32, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var bool_var : bool = bool(); let bool_let : bool = bool(); diff --git a/test/tint/types/function_scope_declarations.wgsl.expected.dxc.hlsl b/test/tint/types/function_scope_declarations.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a373898a6b --- /dev/null +++ b/test/tint/types/function_scope_declarations.wgsl.expected.dxc.hlsl @@ -0,0 +1,28 @@ +struct S { + float a; +}; + +[numthreads(1, 1, 1)] +void main() { + bool bool_var = false; + const bool bool_let = false; + int i32_var = 0; + const int i32_let = 0; + uint u32_var = 0u; + const uint u32_let = 0u; + float f32_var = 0.0f; + const float f32_let = 0.0f; + int2 v2i32_var = (0).xx; + const int2 v2i32_let = (0).xx; + uint3 v3u32_var = (0u).xxx; + const uint3 v3u32_let = (0u).xxx; + float4 v4f32_var = (0.0f).xxxx; + const float4 v4f32_let = (0.0f).xxxx; + float2x3 m2x3_var = float2x3((0.0f).xxx, (0.0f).xxx); + const float3x4 m3x4_let = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + float arr_var[4] = (float[4])0; + const float arr_let[4] = (float[4])0; + S struct_var = (S)0; + const S struct_let = (S)0; + return; +} diff --git a/test/tint/types/function_scope_declarations.wgsl.expected.fxc.hlsl b/test/tint/types/function_scope_declarations.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a373898a6b --- /dev/null +++ b/test/tint/types/function_scope_declarations.wgsl.expected.fxc.hlsl @@ -0,0 +1,28 @@ +struct S { + float a; +}; + +[numthreads(1, 1, 1)] +void main() { + bool bool_var = false; + const bool bool_let = false; + int i32_var = 0; + const int i32_let = 0; + uint u32_var = 0u; + const uint u32_let = 0u; + float f32_var = 0.0f; + const float f32_let = 0.0f; + int2 v2i32_var = (0).xx; + const int2 v2i32_let = (0).xx; + uint3 v3u32_var = (0u).xxx; + const uint3 v3u32_let = (0u).xxx; + float4 v4f32_var = (0.0f).xxxx; + const float4 v4f32_let = (0.0f).xxxx; + float2x3 m2x3_var = float2x3((0.0f).xxx, (0.0f).xxx); + const float3x4 m3x4_let = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + float arr_var[4] = (float[4])0; + const float arr_let[4] = (float[4])0; + S struct_var = (S)0; + const S struct_let = (S)0; + return; +} diff --git a/test/tint/types/function_scope_declarations.wgsl.expected.glsl b/test/tint/types/function_scope_declarations.wgsl.expected.glsl index 5ef25d5381..3a647fbd6e 100644 --- a/test/tint/types/function_scope_declarations.wgsl.expected.glsl +++ b/test/tint/types/function_scope_declarations.wgsl.expected.glsl @@ -13,14 +13,14 @@ void tint_symbol() { uint u32_let = 0u; float f32_var = 0.0f; float f32_let = 0.0f; - ivec2 v2i32_var = ivec2(0, 0); - ivec2 v2i32_let = ivec2(0, 0); - uvec3 v3u32_var = uvec3(0u, 0u, 0u); - uvec3 v3u32_let = uvec3(0u, 0u, 0u); - vec4 v4f32_var = vec4(0.0f, 0.0f, 0.0f, 0.0f); - vec4 v4f32_let = vec4(0.0f, 0.0f, 0.0f, 0.0f); - mat2x3 m2x3_var = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - mat3x4 m3x4_let = mat3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + ivec2 v2i32_var = ivec2(0); + ivec2 v2i32_let = ivec2(0); + uvec3 v3u32_var = uvec3(0u); + uvec3 v3u32_let = uvec3(0u); + vec4 v4f32_var = vec4(0.0f); + vec4 v4f32_let = vec4(0.0f); + mat2x3 m2x3_var = mat2x3(vec3(0.0f), vec3(0.0f)); + mat3x4 m3x4_let = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f)); float arr_var[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); float arr_let[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); S struct_var = S(0.0f); diff --git a/test/tint/types/function_scope_declarations.wgsl.expected.hlsl b/test/tint/types/function_scope_declarations.wgsl.expected.hlsl deleted file mode 100644 index c120722d24..0000000000 --- a/test/tint/types/function_scope_declarations.wgsl.expected.hlsl +++ /dev/null @@ -1,28 +0,0 @@ -struct S { - float a; -}; - -[numthreads(1, 1, 1)] -void main() { - bool bool_var = false; - const bool bool_let = false; - int i32_var = 0; - const int i32_let = 0; - uint u32_var = 0u; - const uint u32_let = 0u; - float f32_var = 0.0f; - const float f32_let = 0.0f; - int2 v2i32_var = int2(0, 0); - const int2 v2i32_let = int2(0, 0); - uint3 v3u32_var = uint3(0u, 0u, 0u); - const uint3 v3u32_let = uint3(0u, 0u, 0u); - float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); - const float4 v4f32_let = float4(0.0f, 0.0f, 0.0f, 0.0f); - float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - const float3x4 m3x4_let = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float arr_var[4] = (float[4])0; - const float arr_let[4] = (float[4])0; - S struct_var = (S)0; - const S struct_let = (S)0; - return; -} diff --git a/test/tint/types/function_scope_declarations.wgsl.expected.msl b/test/tint/types/function_scope_declarations.wgsl.expected.msl index fc5a302fd2..ab73c5e476 100644 --- a/test/tint/types/function_scope_declarations.wgsl.expected.msl +++ b/test/tint/types/function_scope_declarations.wgsl.expected.msl @@ -1,35 +1,44 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { float a; }; -struct tint_array_wrapper { - float arr[4]; -}; - kernel void tint_symbol() { - bool bool_var = bool(); - bool const bool_let = bool(); - int i32_var = int(); - int const i32_let = int(); - uint u32_var = uint(); - uint const u32_let = uint(); - float f32_var = float(); - float const f32_let = float(); - int2 v2i32_var = int2(); - int2 const v2i32_let = int2(); - uint3 v3u32_var = uint3(); - uint3 const v3u32_let = uint3(); - float4 v4f32_var = float4(); - float4 const v4f32_let = float4(); - float2x3 m2x3_var = float2x3(); - float3x4 const m3x4_let = float3x4(); - tint_array_wrapper arr_var = {.arr={}}; - tint_array_wrapper const arr_let = {.arr={}}; - S struct_var = {}; - S const struct_let = {}; + bool bool_var = false; + bool const bool_let = false; + int i32_var = 0; + int const i32_let = 0; + uint u32_var = 0u; + uint const u32_let = 0u; + float f32_var = 0.0f; + float const f32_let = 0.0f; + int2 v2i32_var = int2(0); + int2 const v2i32_let = int2(0); + uint3 v3u32_var = uint3(0u); + uint3 const v3u32_let = uint3(0u); + float4 v4f32_var = float4(0.0f); + float4 const v4f32_let = float4(0.0f); + float2x3 m2x3_var = float2x3(float3(0.0f), float3(0.0f)); + float3x4 const m3x4_let = float3x4(float4(0.0f), float4(0.0f), float4(0.0f)); + tint_array arr_var = tint_array{}; + tint_array const arr_let = tint_array{}; + S struct_var = S{}; + S const struct_let = S{}; return; } diff --git a/test/tint/types/function_scope_declarations.wgsl.expected.wgsl b/test/tint/types/function_scope_declarations.wgsl.expected.wgsl index d09c44cfb0..7d057651ba 100644 --- a/test/tint/types/function_scope_declarations.wgsl.expected.wgsl +++ b/test/tint/types/function_scope_declarations.wgsl.expected.wgsl @@ -2,7 +2,7 @@ struct S { a : f32, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var bool_var : bool = bool(); let bool_let : bool = bool(); diff --git a/test/tint/types/function_scope_var_conversions.wgsl b/test/tint/types/function_scope_var_conversions.wgsl index 4f58b71701..77ac807681 100644 --- a/test/tint/types/function_scope_var_conversions.wgsl +++ b/test/tint/types/function_scope_var_conversions.wgsl @@ -3,7 +3,7 @@ fn constant_with_non_constant() { var b : vec2 = vec2(f32(i32(1)), a); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var bool_var1 : bool = bool(123u); var bool_var2 : bool = bool(123); diff --git a/test/tint/types/function_scope_var_conversions.wgsl.expected.dxc.hlsl b/test/tint/types/function_scope_var_conversions.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..67738bcda5 --- /dev/null +++ b/test/tint/types/function_scope_var_conversions.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void constant_with_non_constant() { + float a = 0.0f; + float2 b = float2(1.0f, a); +} + +[numthreads(1, 1, 1)] +void main() { + bool bool_var1 = true; + bool bool_var2 = true; + bool bool_var3 = true; + int i32_var1 = 123; + int i32_var2 = 123; + int i32_var3 = 1; + uint u32_var1 = 123u; + uint u32_var2 = 123u; + uint u32_var3 = 1u; + bool3 v3bool_var1 = (true).xxx; + bool3 v3bool_var11 = (true).xxx; + bool3 v3bool_var2 = (true).xxx; + bool3 v3bool_var3 = (true).xxx; + int3 v3i32_var1 = (123).xxx; + int3 v3i32_var2 = (123).xxx; + int3 v3i32_var3 = (1).xxx; + uint3 v3u32_var1 = (123u).xxx; + uint3 v3u32_var2 = (123u).xxx; + uint3 v3u32_var3 = (1u).xxx; + bool3 v3bool_var4 = (true).xxx; + bool4 v4bool_var5 = bool4(true, false, true, false); + return; +} diff --git a/test/tint/types/function_scope_var_conversions.wgsl.expected.fxc.hlsl b/test/tint/types/function_scope_var_conversions.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67738bcda5 --- /dev/null +++ b/test/tint/types/function_scope_var_conversions.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void constant_with_non_constant() { + float a = 0.0f; + float2 b = float2(1.0f, a); +} + +[numthreads(1, 1, 1)] +void main() { + bool bool_var1 = true; + bool bool_var2 = true; + bool bool_var3 = true; + int i32_var1 = 123; + int i32_var2 = 123; + int i32_var3 = 1; + uint u32_var1 = 123u; + uint u32_var2 = 123u; + uint u32_var3 = 1u; + bool3 v3bool_var1 = (true).xxx; + bool3 v3bool_var11 = (true).xxx; + bool3 v3bool_var2 = (true).xxx; + bool3 v3bool_var3 = (true).xxx; + int3 v3i32_var1 = (123).xxx; + int3 v3i32_var2 = (123).xxx; + int3 v3i32_var3 = (1).xxx; + uint3 v3u32_var1 = (123u).xxx; + uint3 v3u32_var2 = (123u).xxx; + uint3 v3u32_var3 = (1u).xxx; + bool3 v3bool_var4 = (true).xxx; + bool4 v4bool_var5 = bool4(true, false, true, false); + return; +} diff --git a/test/tint/types/function_scope_var_conversions.wgsl.expected.glsl b/test/tint/types/function_scope_var_conversions.wgsl.expected.glsl index e91857e37e..afb853e655 100644 --- a/test/tint/types/function_scope_var_conversions.wgsl.expected.glsl +++ b/test/tint/types/function_scope_var_conversions.wgsl.expected.glsl @@ -1,27 +1,27 @@ #version 310 es void tint_symbol() { - bool bool_var1 = bool(123u); - bool bool_var2 = bool(123); - bool bool_var3 = bool(123.0f); - int i32_var1 = int(123u); - int i32_var2 = int(123.0f); - int i32_var3 = int(true); - uint u32_var1 = uint(123); - uint u32_var2 = uint(123.0f); - uint u32_var3 = uint(true); - bvec3 v3bool_var1 = bvec3(uvec3(123u)); - bvec3 v3bool_var11 = bvec3(uvec3(1234u)); - bvec3 v3bool_var2 = bvec3(ivec3(123)); - bvec3 v3bool_var3 = bvec3(vec3(123.0f)); - ivec3 v3i32_var1 = ivec3(uvec3(123u)); - ivec3 v3i32_var2 = ivec3(vec3(123.0f)); - ivec3 v3i32_var3 = ivec3(bvec3(true)); - uvec3 v3u32_var1 = uvec3(ivec3(123)); - uvec3 v3u32_var2 = uvec3(vec3(123.0f)); - uvec3 v3u32_var3 = uvec3(bvec3(true)); - bvec3 v3bool_var4 = bvec3(bvec2(vec2(123.0f)), true); - bvec4 v4bool_var5 = bvec4(bvec2(vec2(123.0f, 0.0f)), bvec2(true, bool(float(0.0f)))); + bool bool_var1 = true; + bool bool_var2 = true; + bool bool_var3 = true; + int i32_var1 = 123; + int i32_var2 = 123; + int i32_var3 = 1; + uint u32_var1 = 123u; + uint u32_var2 = 123u; + uint u32_var3 = 1u; + bvec3 v3bool_var1 = bvec3(true); + bvec3 v3bool_var11 = bvec3(true); + bvec3 v3bool_var2 = bvec3(true); + bvec3 v3bool_var3 = bvec3(true); + ivec3 v3i32_var1 = ivec3(123); + ivec3 v3i32_var2 = ivec3(123); + ivec3 v3i32_var3 = ivec3(1); + uvec3 v3u32_var1 = uvec3(123u); + uvec3 v3u32_var2 = uvec3(123u); + uvec3 v3u32_var3 = uvec3(1u); + bvec3 v3bool_var4 = bvec3(true); + bvec4 v4bool_var5 = bvec4(true, false, true, false); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/types/function_scope_var_conversions.wgsl.expected.hlsl b/test/tint/types/function_scope_var_conversions.wgsl.expected.hlsl deleted file mode 100644 index b0f76c7e15..0000000000 --- a/test/tint/types/function_scope_var_conversions.wgsl.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -void constant_with_non_constant() { - float a = 0.0f; - float2 b = float2(float(int(1)), a); -} - -[numthreads(1, 1, 1)] -void main() { - bool bool_var1 = bool(123u); - bool bool_var2 = bool(123); - bool bool_var3 = bool(123.0f); - int i32_var1 = int(123u); - int i32_var2 = int(123.0f); - int i32_var3 = int(true); - uint u32_var1 = uint(123); - uint u32_var2 = uint(123.0f); - uint u32_var3 = uint(true); - bool3 v3bool_var1 = bool3(uint3((123u).xxx)); - bool3 v3bool_var11 = bool3(uint3((1234u).xxx)); - bool3 v3bool_var2 = bool3(int3((123).xxx)); - bool3 v3bool_var3 = bool3(float3((123.0f).xxx)); - int3 v3i32_var1 = int3(uint3((123u).xxx)); - int3 v3i32_var2 = int3(float3((123.0f).xxx)); - int3 v3i32_var3 = int3(bool3((true).xxx)); - uint3 v3u32_var1 = uint3(int3((123).xxx)); - uint3 v3u32_var2 = uint3(float3((123.0f).xxx)); - uint3 v3u32_var3 = uint3(bool3((true).xxx)); - bool3 v3bool_var4 = bool3(bool2(float2((123.0f).xx)), true); - bool4 v4bool_var5 = bool4(bool2(float2(123.0f, 0.0f)), bool2(true, bool(float(0.0f)))); - return; -} diff --git a/test/tint/types/function_scope_var_conversions.wgsl.expected.msl b/test/tint/types/function_scope_var_conversions.wgsl.expected.msl index a656406724..10e5c4859d 100644 --- a/test/tint/types/function_scope_var_conversions.wgsl.expected.msl +++ b/test/tint/types/function_scope_var_conversions.wgsl.expected.msl @@ -2,32 +2,32 @@ using namespace metal; void constant_with_non_constant() { - float a = float(); - float2 b = float2(float(int(1)), a); + float a = 0.0f; + float2 b = float2(1.0f, a); } kernel void tint_symbol() { - bool bool_var1 = bool(123u); - bool bool_var2 = bool(123); - bool bool_var3 = bool(123.0f); - int i32_var1 = int(123u); - int i32_var2 = int(123.0f); - int i32_var3 = int(true); - uint u32_var1 = uint(123); - uint u32_var2 = uint(123.0f); - uint u32_var3 = uint(true); - bool3 v3bool_var1 = bool3(uint3(123u)); - bool3 v3bool_var11 = bool3(uint3(1234u)); - bool3 v3bool_var2 = bool3(int3(123)); - bool3 v3bool_var3 = bool3(float3(123.0f)); - int3 v3i32_var1 = int3(uint3(123u)); - int3 v3i32_var2 = int3(float3(123.0f)); - int3 v3i32_var3 = int3(bool3(true)); - uint3 v3u32_var1 = uint3(int3(123)); - uint3 v3u32_var2 = uint3(float3(123.0f)); - uint3 v3u32_var3 = uint3(bool3(true)); - bool3 v3bool_var4 = bool3(bool2(float2(123.0f)), true); - bool4 v4bool_var5 = bool4(bool2(float2(123.0f, 0.0f)), bool2(true, bool(float(0.0f)))); + bool bool_var1 = true; + bool bool_var2 = true; + bool bool_var3 = true; + int i32_var1 = 123; + int i32_var2 = 123; + int i32_var3 = 1; + uint u32_var1 = 123u; + uint u32_var2 = 123u; + uint u32_var3 = 1u; + bool3 v3bool_var1 = bool3(true); + bool3 v3bool_var11 = bool3(true); + bool3 v3bool_var2 = bool3(true); + bool3 v3bool_var3 = bool3(true); + int3 v3i32_var1 = int3(123); + int3 v3i32_var2 = int3(123); + int3 v3i32_var3 = int3(1); + uint3 v3u32_var1 = uint3(123u); + uint3 v3u32_var2 = uint3(123u); + uint3 v3u32_var3 = uint3(1u); + bool3 v3bool_var4 = bool3(true); + bool4 v4bool_var5 = bool4(true, false, true, false); return; } diff --git a/test/tint/types/function_scope_var_conversions.wgsl.expected.spvasm b/test/tint/types/function_scope_var_conversions.wgsl.expected.spvasm index 5eee4dfe13..4135223fa3 100644 --- a/test/tint/types/function_scope_var_conversions.wgsl.expected.spvasm +++ b/test/tint/types/function_scope_var_conversions.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 72 +; Bound: 71 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -70,10 +70,9 @@ %61 = OpConstantNull %v3uint %63 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 %v4bool = OpTypeVector %bool 4 - %false = OpConstantFalse %bool - %68 = OpConstantComposite %v4bool %true %false %true %false + %67 = OpConstantComposite %v4bool %true %22 %true %22 %_ptr_Function_v4bool = OpTypePointer Function %v4bool - %71 = OpConstantNull %v4bool + %70 = OpConstantNull %v4bool %constant_with_non_constant = OpFunction %void None %1 %4 = OpLabel %a = OpVariable %_ptr_Function_float Function %6 @@ -106,7 +105,7 @@ %v3u32_var2 = OpVariable %_ptr_Function_v3uint Function %61 %v3u32_var3 = OpVariable %_ptr_Function_v3uint Function %61 %v3bool_var4 = OpVariable %_ptr_Function_v3bool Function %45 -%v4bool_var5 = OpVariable %_ptr_Function_v4bool Function %71 +%v4bool_var5 = OpVariable %_ptr_Function_v4bool Function %70 OpStore %bool_var1 %true OpStore %bool_var2 %true OpStore %bool_var3 %true @@ -127,6 +126,6 @@ OpStore %v3u32_var2 %58 OpStore %v3u32_var3 %63 OpStore %v3bool_var4 %42 - OpStore %v4bool_var5 %68 + OpStore %v4bool_var5 %67 OpReturn OpFunctionEnd diff --git a/test/tint/types/function_scope_var_conversions.wgsl.expected.wgsl b/test/tint/types/function_scope_var_conversions.wgsl.expected.wgsl index 53206b3a31..036ec126fe 100644 --- a/test/tint/types/function_scope_var_conversions.wgsl.expected.wgsl +++ b/test/tint/types/function_scope_var_conversions.wgsl.expected.wgsl @@ -3,7 +3,7 @@ fn constant_with_non_constant() { var b : vec2 = vec2(f32(i32(1)), a); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var bool_var1 : bool = bool(123u); var bool_var2 : bool = bool(123); diff --git a/test/tint/types/module_scope_const.wgsl b/test/tint/types/module_scope_const.wgsl new file mode 100644 index 0000000000..c507b9941d --- /dev/null +++ b/test/tint/types/module_scope_const.wgsl @@ -0,0 +1,13 @@ +const const_bool : bool = bool(); +const const_i32 : i32 = i32(); +const const_u32 : u32 = u32(); +const const_f32 : f32 = f32(); +const const_v2i32 : vec2 = vec2(); +const const_v3u32 : vec3 = vec3(); +const const_v4f32 : vec4 = vec4(); +const const_m3x4 : mat3x4 = mat3x4(); +const const_arr : array = array(); + +@compute @workgroup_size(1) +fn main() { +} diff --git a/test/tint/types/module_scope_const.wgsl.expected.dxc.hlsl b/test/tint/types/module_scope_const.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..998916005d --- /dev/null +++ b/test/tint/types/module_scope_const.wgsl.expected.dxc.hlsl @@ -0,0 +1,4 @@ +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/module_scope_const.wgsl.expected.fxc.hlsl b/test/tint/types/module_scope_const.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..998916005d --- /dev/null +++ b/test/tint/types/module_scope_const.wgsl.expected.fxc.hlsl @@ -0,0 +1,4 @@ +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/module_scope_const.wgsl.expected.glsl b/test/tint/types/module_scope_const.wgsl.expected.glsl new file mode 100644 index 0000000000..5b9616f9be --- /dev/null +++ b/test/tint/types/module_scope_const.wgsl.expected.glsl @@ -0,0 +1,10 @@ +#version 310 es + +void tint_symbol() { +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/types/module_scope_const.wgsl.expected.msl b/test/tint/types/module_scope_const.wgsl.expected.msl new file mode 100644 index 0000000000..09c45a0548 --- /dev/null +++ b/test/tint/types/module_scope_const.wgsl.expected.msl @@ -0,0 +1,7 @@ +#include + +using namespace metal; +kernel void tint_symbol() { + return; +} + diff --git a/test/tint/types/module_scope_const.wgsl.expected.spvasm b/test/tint/types/module_scope_const.wgsl.expected.spvasm new file mode 100644 index 0000000000..292eb05d8d --- /dev/null +++ b/test/tint/types/module_scope_const.wgsl.expected.spvasm @@ -0,0 +1,16 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 5 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + %void = OpTypeVoid + %1 = OpTypeFunction %void + %main = OpFunction %void None %1 + %4 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/types/module_scope_const.wgsl.expected.wgsl b/test/tint/types/module_scope_const.wgsl.expected.wgsl new file mode 100644 index 0000000000..7951dc6c76 --- /dev/null +++ b/test/tint/types/module_scope_const.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +const const_bool : bool = bool(); + +const const_i32 : i32 = i32(); + +const const_u32 : u32 = u32(); + +const const_f32 : f32 = f32(); + +const const_v2i32 : vec2 = vec2(); + +const const_v3u32 : vec3 = vec3(); + +const const_v4f32 : vec4 = vec4(); + +const const_m3x4 : mat3x4 = mat3x4(); + +const const_arr : array = array(); + +@compute @workgroup_size(1) +fn main() { +} diff --git a/test/tint/types/module_scope_let.wgsl b/test/tint/types/module_scope_let.wgsl deleted file mode 100644 index 4f5f7fe13b..0000000000 --- a/test/tint/types/module_scope_let.wgsl +++ /dev/null @@ -1,18 +0,0 @@ -struct S { - a : f32, -}; - -let bool_let : bool = bool(); -let i32_let : i32 = i32(); -let u32_let : u32 = u32(); -let f32_let : f32 = f32(); -let v2i32_let : vec2 = vec2(); -let v3u32_let : vec3 = vec3(); -let v4f32_let : vec4 = vec4(); -let m3x4_let : mat3x4 = mat3x4(); -let arr_let : array = array(); -let struct_let : S = S(); - -@stage(compute) @workgroup_size(1) -fn main() { -} diff --git a/test/tint/types/module_scope_let.wgsl.expected.glsl b/test/tint/types/module_scope_let.wgsl.expected.glsl deleted file mode 100644 index 966cd2aff4..0000000000 --- a/test/tint/types/module_scope_let.wgsl.expected.glsl +++ /dev/null @@ -1,14 +0,0 @@ -#version 310 es - -struct S { - float a; -}; - -void tint_symbol() { -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - tint_symbol(); - return; -} diff --git a/test/tint/types/module_scope_let.wgsl.expected.hlsl b/test/tint/types/module_scope_let.wgsl.expected.hlsl deleted file mode 100644 index d62a81df14..0000000000 --- a/test/tint/types/module_scope_let.wgsl.expected.hlsl +++ /dev/null @@ -1,19 +0,0 @@ -struct S { - float a; -}; - -static const bool bool_let = false; -static const int i32_let = 0; -static const uint u32_let = 0u; -static const float f32_let = 0.0f; -static const int2 v2i32_let = int2(0, 0); -static const uint3 v3u32_let = uint3(0u, 0u, 0u); -static const float4 v4f32_let = float4(0.0f, 0.0f, 0.0f, 0.0f); -static const float3x4 m3x4_let = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -static const float arr_let[4] = (float[4])0; -static const S struct_let = (S)0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/types/module_scope_let.wgsl.expected.msl b/test/tint/types/module_scope_let.wgsl.expected.msl deleted file mode 100644 index 547c797b9e..0000000000 --- a/test/tint/types/module_scope_let.wgsl.expected.msl +++ /dev/null @@ -1,35 +0,0 @@ -#include - -using namespace metal; -struct S { - float a; -}; - -constant bool bool_let = bool(); - -constant int i32_let = int(); - -constant uint u32_let = uint(); - -constant float f32_let = float(); - -constant int2 v2i32_let = int2(); - -constant uint3 v3u32_let = uint3(); - -constant float4 v4f32_let = float4(); - -constant float3x4 m3x4_let = float3x4(); - -struct tint_array_wrapper { - float arr[4]; -}; - -constant tint_array_wrapper arr_let = {.arr={}}; - -constant S struct_let = {}; - -kernel void tint_symbol() { - return; -} - diff --git a/test/tint/types/module_scope_let.wgsl.expected.spvasm b/test/tint/types/module_scope_let.wgsl.expected.spvasm deleted file mode 100644 index 9482c0c454..0000000000 --- a/test/tint/types/module_scope_let.wgsl.expected.spvasm +++ /dev/null @@ -1,51 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 26 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpName %bool_let "bool_let" - OpName %i32_let "i32_let" - OpName %u32_let "u32_let" - OpName %f32_let "f32_let" - OpName %v2i32_let "v2i32_let" - OpName %v3u32_let "v3u32_let" - OpName %v4f32_let "v4f32_let" - OpName %m3x4_let "m3x4_let" - OpName %arr_let "arr_let" - OpName %S "S" - OpMemberName %S 0 "a" - OpName %struct_let "struct_let" - OpName %main "main" - OpDecorate %_arr_float_uint_4 ArrayStride 4 - OpMemberDecorate %S 0 Offset 0 - %bool = OpTypeBool - %bool_let = OpConstantNull %bool - %int = OpTypeInt 32 1 - %i32_let = OpConstantNull %int - %uint = OpTypeInt 32 0 - %u32_let = OpConstantNull %uint - %float = OpTypeFloat 32 - %f32_let = OpConstantNull %float - %v2int = OpTypeVector %int 2 - %v2i32_let = OpConstantNull %v2int - %v3uint = OpTypeVector %uint 3 - %v3u32_let = OpConstantNull %v3uint - %v4float = OpTypeVector %float 4 - %v4f32_let = OpConstantNull %v4float -%mat3v4float = OpTypeMatrix %v4float 3 - %m3x4_let = OpConstantNull %mat3v4float - %uint_4 = OpConstant %uint 4 -%_arr_float_uint_4 = OpTypeArray %float %uint_4 - %arr_let = OpConstantNull %_arr_float_uint_4 - %S = OpTypeStruct %float - %struct_let = OpConstantNull %S - %void = OpTypeVoid - %22 = OpTypeFunction %void - %main = OpFunction %void None %22 - %25 = OpLabel - OpReturn - OpFunctionEnd diff --git a/test/tint/types/module_scope_let.wgsl.expected.wgsl b/test/tint/types/module_scope_let.wgsl.expected.wgsl deleted file mode 100644 index 2585c0c99d..0000000000 --- a/test/tint/types/module_scope_let.wgsl.expected.wgsl +++ /dev/null @@ -1,27 +0,0 @@ -struct S { - a : f32, -} - -let bool_let : bool = bool(); - -let i32_let : i32 = i32(); - -let u32_let : u32 = u32(); - -let f32_let : f32 = f32(); - -let v2i32_let : vec2 = vec2(); - -let v3u32_let : vec3 = vec3(); - -let v4f32_let : vec4 = vec4(); - -let m3x4_let : mat3x4 = mat3x4(); - -let arr_let : array = array(); - -let struct_let : S = S(); - -@stage(compute) @workgroup_size(1) -fn main() { -} diff --git a/test/tint/types/module_scope_var.wgsl b/test/tint/types/module_scope_var.wgsl index c5ea8b6061..4576f807a2 100644 --- a/test/tint/types/module_scope_var.wgsl +++ b/test/tint/types/module_scope_var.wgsl @@ -13,7 +13,7 @@ var m2x3_var : mat2x3; var arr_var : array; var struct_var : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { // Reference the module-scope variables to stop them from being removed. bool_var = bool(); diff --git a/test/tint/types/module_scope_var.wgsl.expected.dxc.hlsl b/test/tint/types/module_scope_var.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..37e4640764 --- /dev/null +++ b/test/tint/types/module_scope_var.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +struct S { + float a; +}; + +static bool bool_var = false; +static int i32_var = 0; +static uint u32_var = 0u; +static float f32_var = 0.0f; +static int2 v2i32_var = int2(0, 0); +static uint3 v3u32_var = uint3(0u, 0u, 0u); +static float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); +static float arr_var[4] = (float[4])0; +static S struct_var = (S)0; + +[numthreads(1, 1, 1)] +void main() { + bool_var = false; + i32_var = 0; + u32_var = 0u; + f32_var = 0.0f; + v2i32_var = (0).xx; + v3u32_var = (0u).xxx; + v4f32_var = (0.0f).xxxx; + m2x3_var = float2x3((0.0f).xxx, (0.0f).xxx); + const float tint_symbol[4] = (float[4])0; + arr_var = tint_symbol; + const S tint_symbol_1 = (S)0; + struct_var = tint_symbol_1; + return; +} diff --git a/test/tint/types/module_scope_var.wgsl.expected.fxc.hlsl b/test/tint/types/module_scope_var.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..37e4640764 --- /dev/null +++ b/test/tint/types/module_scope_var.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +struct S { + float a; +}; + +static bool bool_var = false; +static int i32_var = 0; +static uint u32_var = 0u; +static float f32_var = 0.0f; +static int2 v2i32_var = int2(0, 0); +static uint3 v3u32_var = uint3(0u, 0u, 0u); +static float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); +static float arr_var[4] = (float[4])0; +static S struct_var = (S)0; + +[numthreads(1, 1, 1)] +void main() { + bool_var = false; + i32_var = 0; + u32_var = 0u; + f32_var = 0.0f; + v2i32_var = (0).xx; + v3u32_var = (0u).xxx; + v4f32_var = (0.0f).xxxx; + m2x3_var = float2x3((0.0f).xxx, (0.0f).xxx); + const float tint_symbol[4] = (float[4])0; + arr_var = tint_symbol; + const S tint_symbol_1 = (S)0; + struct_var = tint_symbol_1; + return; +} diff --git a/test/tint/types/module_scope_var.wgsl.expected.glsl b/test/tint/types/module_scope_var.wgsl.expected.glsl index c9ffa1167d..139306db5a 100644 --- a/test/tint/types/module_scope_var.wgsl.expected.glsl +++ b/test/tint/types/module_scope_var.wgsl.expected.glsl @@ -19,10 +19,10 @@ void tint_symbol() { i32_var = 0; u32_var = 0u; f32_var = 0.0f; - v2i32_var = ivec2(0, 0); - v3u32_var = uvec3(0u, 0u, 0u); - v4f32_var = vec4(0.0f, 0.0f, 0.0f, 0.0f); - m2x3_var = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + v2i32_var = ivec2(0); + v3u32_var = uvec3(0u); + v4f32_var = vec4(0.0f); + m2x3_var = mat2x3(vec3(0.0f), vec3(0.0f)); float tint_symbol_1[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); arr_var = tint_symbol_1; S tint_symbol_2 = S(0.0f); diff --git a/test/tint/types/module_scope_var.wgsl.expected.hlsl b/test/tint/types/module_scope_var.wgsl.expected.hlsl deleted file mode 100644 index fefdd19e93..0000000000 --- a/test/tint/types/module_scope_var.wgsl.expected.hlsl +++ /dev/null @@ -1,31 +0,0 @@ -struct S { - float a; -}; - -static bool bool_var = false; -static int i32_var = 0; -static uint u32_var = 0u; -static float f32_var = 0.0f; -static int2 v2i32_var = int2(0, 0); -static uint3 v3u32_var = uint3(0u, 0u, 0u); -static float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -static float arr_var[4] = (float[4])0; -static S struct_var = (S)0; - -[numthreads(1, 1, 1)] -void main() { - bool_var = false; - i32_var = 0; - u32_var = 0u; - f32_var = 0.0f; - v2i32_var = int2(0, 0); - v3u32_var = uint3(0u, 0u, 0u); - v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); - m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - const float tint_symbol[4] = (float[4])0; - arr_var = tint_symbol; - const S tint_symbol_1 = (S)0; - struct_var = tint_symbol_1; - return; -} diff --git a/test/tint/types/module_scope_var.wgsl.expected.msl b/test/tint/types/module_scope_var.wgsl.expected.msl index 4fcfa9e7ad..fbdf1db0d2 100644 --- a/test/tint/types/module_scope_var.wgsl.expected.msl +++ b/test/tint/types/module_scope_var.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct S { - float a; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -struct tint_array_wrapper { - float arr[4]; +struct S { + float a; }; kernel void tint_symbol() { @@ -18,19 +27,19 @@ kernel void tint_symbol() { thread uint3 tint_symbol_8 = 0u; thread float4 tint_symbol_9 = 0.0f; thread float2x3 tint_symbol_10 = float2x3(0.0f); - thread tint_array_wrapper tint_symbol_11 = {}; + thread tint_array tint_symbol_11 = {}; thread S tint_symbol_12 = {}; - tint_symbol_3 = bool(); - tint_symbol_4 = int(); - tint_symbol_5 = uint(); - tint_symbol_6 = float(); - tint_symbol_7 = int2(); - tint_symbol_8 = uint3(); - tint_symbol_9 = float4(); - tint_symbol_10 = float2x3(); - tint_array_wrapper const tint_symbol_1 = {.arr={}}; + tint_symbol_3 = false; + tint_symbol_4 = 0; + tint_symbol_5 = 0u; + tint_symbol_6 = 0.0f; + tint_symbol_7 = int2(0); + tint_symbol_8 = uint3(0u); + tint_symbol_9 = float4(0.0f); + tint_symbol_10 = float2x3(float3(0.0f), float3(0.0f)); + tint_array const tint_symbol_1 = tint_array{}; tint_symbol_11 = tint_symbol_1; - S const tint_symbol_2 = {}; + S const tint_symbol_2 = S{}; tint_symbol_12 = tint_symbol_2; return; } diff --git a/test/tint/types/module_scope_var.wgsl.expected.wgsl b/test/tint/types/module_scope_var.wgsl.expected.wgsl index 31a20b0d8f..d6ffe859bd 100644 --- a/test/tint/types/module_scope_var.wgsl.expected.wgsl +++ b/test/tint/types/module_scope_var.wgsl.expected.wgsl @@ -22,7 +22,7 @@ var arr_var : array; var struct_var : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { bool_var = bool(); i32_var = i32(); diff --git a/test/tint/types/module_scope_var_conversions.wgsl b/test/tint/types/module_scope_var_conversions.wgsl index ce6fa2ee3f..25b8b4047a 100644 --- a/test/tint/types/module_scope_var_conversions.wgsl +++ b/test/tint/types/module_scope_var_conversions.wgsl @@ -25,7 +25,7 @@ var v3u32_var3 : vec3 = vec3(vec3(true)); var v3bool_var4 : vec3 = vec3(vec2(vec2(123.0)), true); var v4bool_var5 : vec4 = vec4(vec2(vec2(123.0, 0.0)), vec2(true, bool(f32(0.0)))); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { // Reference the module-scope variables to stop them from being removed. bool_var1 = bool(); diff --git a/test/tint/types/module_scope_var_conversions.wgsl.expected.dxc.hlsl b/test/tint/types/module_scope_var_conversions.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6577278518 --- /dev/null +++ b/test/tint/types/module_scope_var_conversions.wgsl.expected.dxc.hlsl @@ -0,0 +1,45 @@ +static bool bool_var1 = true; +static bool bool_var2 = true; +static bool bool_var3 = true; +static int i32_var1 = 1; +static int i32_var2 = 1; +static int i32_var3 = 1; +static uint u32_var1 = 1u; +static uint u32_var2 = 1u; +static uint u32_var3 = 1u; +static bool3 v3bool_var1 = (true).xxx; +static bool3 v3bool_var2 = (true).xxx; +static bool3 v3bool_var3 = (true).xxx; +static int3 v3i32_var1 = (1).xxx; +static int3 v3i32_var2 = (1).xxx; +static int3 v3i32_var3 = (1).xxx; +static uint3 v3u32_var1 = (1u).xxx; +static uint3 v3u32_var2 = (1u).xxx; +static uint3 v3u32_var3 = (1u).xxx; +static bool3 v3bool_var4 = (true).xxx; +static bool4 v4bool_var5 = bool4(true, false, true, false); + +[numthreads(1, 1, 1)] +void main() { + bool_var1 = false; + bool_var2 = false; + bool_var3 = false; + i32_var1 = 0; + i32_var2 = 0; + i32_var3 = 0; + u32_var1 = 0u; + u32_var2 = 0u; + u32_var3 = 0u; + v3bool_var1 = (false).xxx; + v3bool_var2 = (false).xxx; + v3bool_var3 = (false).xxx; + v3bool_var4 = (false).xxx; + v4bool_var5 = (false).xxxx; + v3i32_var1 = (0).xxx; + v3i32_var2 = (0).xxx; + v3i32_var3 = (0).xxx; + v3u32_var1 = (0u).xxx; + v3u32_var2 = (0u).xxx; + v3u32_var3 = (0u).xxx; + return; +} diff --git a/test/tint/types/module_scope_var_conversions.wgsl.expected.fxc.hlsl b/test/tint/types/module_scope_var_conversions.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6577278518 --- /dev/null +++ b/test/tint/types/module_scope_var_conversions.wgsl.expected.fxc.hlsl @@ -0,0 +1,45 @@ +static bool bool_var1 = true; +static bool bool_var2 = true; +static bool bool_var3 = true; +static int i32_var1 = 1; +static int i32_var2 = 1; +static int i32_var3 = 1; +static uint u32_var1 = 1u; +static uint u32_var2 = 1u; +static uint u32_var3 = 1u; +static bool3 v3bool_var1 = (true).xxx; +static bool3 v3bool_var2 = (true).xxx; +static bool3 v3bool_var3 = (true).xxx; +static int3 v3i32_var1 = (1).xxx; +static int3 v3i32_var2 = (1).xxx; +static int3 v3i32_var3 = (1).xxx; +static uint3 v3u32_var1 = (1u).xxx; +static uint3 v3u32_var2 = (1u).xxx; +static uint3 v3u32_var3 = (1u).xxx; +static bool3 v3bool_var4 = (true).xxx; +static bool4 v4bool_var5 = bool4(true, false, true, false); + +[numthreads(1, 1, 1)] +void main() { + bool_var1 = false; + bool_var2 = false; + bool_var3 = false; + i32_var1 = 0; + i32_var2 = 0; + i32_var3 = 0; + u32_var1 = 0u; + u32_var2 = 0u; + u32_var3 = 0u; + v3bool_var1 = (false).xxx; + v3bool_var2 = (false).xxx; + v3bool_var3 = (false).xxx; + v3bool_var4 = (false).xxx; + v4bool_var5 = (false).xxxx; + v3i32_var1 = (0).xxx; + v3i32_var2 = (0).xxx; + v3i32_var3 = (0).xxx; + v3u32_var1 = (0u).xxx; + v3u32_var2 = (0u).xxx; + v3u32_var3 = (0u).xxx; + return; +} diff --git a/test/tint/types/module_scope_var_conversions.wgsl.expected.glsl b/test/tint/types/module_scope_var_conversions.wgsl.expected.glsl index 5e715e5c3b..fcf3ca700f 100644 --- a/test/tint/types/module_scope_var_conversions.wgsl.expected.glsl +++ b/test/tint/types/module_scope_var_conversions.wgsl.expected.glsl @@ -1,25 +1,25 @@ #version 310 es -bool bool_var1 = bool(1u); -bool bool_var2 = bool(1); -bool bool_var3 = bool(1.0f); -int i32_var1 = int(1u); -int i32_var2 = int(1.0f); -int i32_var3 = int(true); -uint u32_var1 = uint(1); -uint u32_var2 = uint(1.0f); -uint u32_var3 = uint(true); -bvec3 v3bool_var1 = bvec3(uvec3(1u)); -bvec3 v3bool_var2 = bvec3(ivec3(1)); -bvec3 v3bool_var3 = bvec3(vec3(1.0f)); -ivec3 v3i32_var1 = ivec3(uvec3(1u)); -ivec3 v3i32_var2 = ivec3(vec3(1.0f)); -ivec3 v3i32_var3 = ivec3(bvec3(true)); -uvec3 v3u32_var1 = uvec3(ivec3(1)); -uvec3 v3u32_var2 = uvec3(vec3(1.0f)); -uvec3 v3u32_var3 = uvec3(bvec3(true)); -bvec3 v3bool_var4 = bvec3(bvec2(vec2(123.0f)), true); -bvec4 v4bool_var5 = bvec4(bvec2(vec2(123.0f, 0.0f)), bvec2(true, bool(float(0.0f)))); +bool bool_var1 = true; +bool bool_var2 = true; +bool bool_var3 = true; +int i32_var1 = 1; +int i32_var2 = 1; +int i32_var3 = 1; +uint u32_var1 = 1u; +uint u32_var2 = 1u; +uint u32_var3 = 1u; +bvec3 v3bool_var1 = bvec3(true); +bvec3 v3bool_var2 = bvec3(true); +bvec3 v3bool_var3 = bvec3(true); +ivec3 v3i32_var1 = ivec3(1); +ivec3 v3i32_var2 = ivec3(1); +ivec3 v3i32_var3 = ivec3(1); +uvec3 v3u32_var1 = uvec3(1u); +uvec3 v3u32_var2 = uvec3(1u); +uvec3 v3u32_var3 = uvec3(1u); +bvec3 v3bool_var4 = bvec3(true); +bvec4 v4bool_var5 = bvec4(true, false, true, false); void tint_symbol() { bool_var1 = false; bool_var2 = false; @@ -30,17 +30,17 @@ void tint_symbol() { u32_var1 = 0u; u32_var2 = 0u; u32_var3 = 0u; - v3bool_var1 = bvec3(false, false, false); - v3bool_var2 = bvec3(false, false, false); - v3bool_var3 = bvec3(false, false, false); - v3bool_var4 = bvec3(false, false, false); - v4bool_var5 = bvec4(false, false, false, false); - v3i32_var1 = ivec3(0, 0, 0); - v3i32_var2 = ivec3(0, 0, 0); - v3i32_var3 = ivec3(0, 0, 0); - v3u32_var1 = uvec3(0u, 0u, 0u); - v3u32_var2 = uvec3(0u, 0u, 0u); - v3u32_var3 = uvec3(0u, 0u, 0u); + v3bool_var1 = bvec3(false); + v3bool_var2 = bvec3(false); + v3bool_var3 = bvec3(false); + v3bool_var4 = bvec3(false); + v4bool_var5 = bvec4(false); + v3i32_var1 = ivec3(0); + v3i32_var2 = ivec3(0); + v3i32_var3 = ivec3(0); + v3u32_var1 = uvec3(0u); + v3u32_var2 = uvec3(0u); + v3u32_var3 = uvec3(0u); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/types/module_scope_var_conversions.wgsl.expected.hlsl b/test/tint/types/module_scope_var_conversions.wgsl.expected.hlsl deleted file mode 100644 index e637207b67..0000000000 --- a/test/tint/types/module_scope_var_conversions.wgsl.expected.hlsl +++ /dev/null @@ -1,45 +0,0 @@ -static bool bool_var1 = bool(1u); -static bool bool_var2 = bool(1); -static bool bool_var3 = bool(1.0f); -static int i32_var1 = int(1u); -static int i32_var2 = int(1.0f); -static int i32_var3 = int(true); -static uint u32_var1 = uint(1); -static uint u32_var2 = uint(1.0f); -static uint u32_var3 = uint(true); -static bool3 v3bool_var1 = bool3(uint3((1u).xxx)); -static bool3 v3bool_var2 = bool3(int3((1).xxx)); -static bool3 v3bool_var3 = bool3(float3((1.0f).xxx)); -static int3 v3i32_var1 = int3(uint3((1u).xxx)); -static int3 v3i32_var2 = int3(float3((1.0f).xxx)); -static int3 v3i32_var3 = int3(bool3((true).xxx)); -static uint3 v3u32_var1 = uint3(int3((1).xxx)); -static uint3 v3u32_var2 = uint3(float3((1.0f).xxx)); -static uint3 v3u32_var3 = uint3(bool3((true).xxx)); -static bool3 v3bool_var4 = bool3(bool2(float2((123.0f).xx)), true); -static bool4 v4bool_var5 = bool4(bool2(float2(123.0f, 0.0f)), bool2(true, bool(float(0.0f)))); - -[numthreads(1, 1, 1)] -void main() { - bool_var1 = false; - bool_var2 = false; - bool_var3 = false; - i32_var1 = 0; - i32_var2 = 0; - i32_var3 = 0; - u32_var1 = 0u; - u32_var2 = 0u; - u32_var3 = 0u; - v3bool_var1 = bool3(false, false, false); - v3bool_var2 = bool3(false, false, false); - v3bool_var3 = bool3(false, false, false); - v3bool_var4 = bool3(false, false, false); - v4bool_var5 = bool4(false, false, false, false); - v3i32_var1 = int3(0, 0, 0); - v3i32_var2 = int3(0, 0, 0); - v3i32_var3 = int3(0, 0, 0); - v3u32_var1 = uint3(0u, 0u, 0u); - v3u32_var2 = uint3(0u, 0u, 0u); - v3u32_var3 = uint3(0u, 0u, 0u); - return; -} diff --git a/test/tint/types/module_scope_var_conversions.wgsl.expected.msl b/test/tint/types/module_scope_var_conversions.wgsl.expected.msl index 072e9b0636..012737e158 100644 --- a/test/tint/types/module_scope_var_conversions.wgsl.expected.msl +++ b/test/tint/types/module_scope_var_conversions.wgsl.expected.msl @@ -2,46 +2,46 @@ using namespace metal; kernel void tint_symbol() { - thread bool tint_symbol_1 = bool(1u); - thread bool tint_symbol_2 = bool(1); - thread bool tint_symbol_3 = bool(1.0f); - thread int tint_symbol_4 = int(1u); - thread int tint_symbol_5 = int(1.0f); - thread int tint_symbol_6 = int(true); - thread uint tint_symbol_7 = uint(1); - thread uint tint_symbol_8 = uint(1.0f); - thread uint tint_symbol_9 = uint(true); - thread bool3 tint_symbol_10 = bool3(uint3(1u)); - thread bool3 tint_symbol_11 = bool3(int3(1)); - thread bool3 tint_symbol_12 = bool3(float3(1.0f)); - thread bool3 tint_symbol_13 = bool3(bool2(float2(123.0f)), true); - thread bool4 tint_symbol_14 = bool4(bool2(float2(123.0f, 0.0f)), bool2(true, bool(float(0.0f)))); - thread int3 tint_symbol_15 = int3(uint3(1u)); - thread int3 tint_symbol_16 = int3(float3(1.0f)); - thread int3 tint_symbol_17 = int3(bool3(true)); - thread uint3 tint_symbol_18 = uint3(int3(1)); - thread uint3 tint_symbol_19 = uint3(float3(1.0f)); - thread uint3 tint_symbol_20 = uint3(bool3(true)); - tint_symbol_1 = bool(); - tint_symbol_2 = bool(); - tint_symbol_3 = bool(); - tint_symbol_4 = int(); - tint_symbol_5 = int(); - tint_symbol_6 = int(); - tint_symbol_7 = uint(); - tint_symbol_8 = uint(); - tint_symbol_9 = uint(); - tint_symbol_10 = bool3(); - tint_symbol_11 = bool3(); - tint_symbol_12 = bool3(); - tint_symbol_13 = bool3(); - tint_symbol_14 = bool4(); - tint_symbol_15 = int3(); - tint_symbol_16 = int3(); - tint_symbol_17 = int3(); - tint_symbol_18 = uint3(); - tint_symbol_19 = uint3(); - tint_symbol_20 = uint3(); + thread bool tint_symbol_1 = true; + thread bool tint_symbol_2 = true; + thread bool tint_symbol_3 = true; + thread int tint_symbol_4 = 1; + thread int tint_symbol_5 = 1; + thread int tint_symbol_6 = 1; + thread uint tint_symbol_7 = 1u; + thread uint tint_symbol_8 = 1u; + thread uint tint_symbol_9 = 1u; + thread bool3 tint_symbol_10 = bool3(true); + thread bool3 tint_symbol_11 = bool3(true); + thread bool3 tint_symbol_12 = bool3(true); + thread bool3 tint_symbol_13 = bool3(true); + thread bool4 tint_symbol_14 = bool4(true, false, true, false); + thread int3 tint_symbol_15 = int3(1); + thread int3 tint_symbol_16 = int3(1); + thread int3 tint_symbol_17 = int3(1); + thread uint3 tint_symbol_18 = uint3(1u); + thread uint3 tint_symbol_19 = uint3(1u); + thread uint3 tint_symbol_20 = uint3(1u); + tint_symbol_1 = false; + tint_symbol_2 = false; + tint_symbol_3 = false; + tint_symbol_4 = 0; + tint_symbol_5 = 0; + tint_symbol_6 = 0; + tint_symbol_7 = 0u; + tint_symbol_8 = 0u; + tint_symbol_9 = 0u; + tint_symbol_10 = bool3(false); + tint_symbol_11 = bool3(false); + tint_symbol_12 = bool3(false); + tint_symbol_13 = bool3(false); + tint_symbol_14 = bool4(false); + tint_symbol_15 = int3(0); + tint_symbol_16 = int3(0); + tint_symbol_17 = int3(0); + tint_symbol_18 = uint3(0u); + tint_symbol_19 = uint3(0u); + tint_symbol_20 = uint3(0u); return; } diff --git a/test/tint/types/module_scope_var_conversions.wgsl.expected.spvasm b/test/tint/types/module_scope_var_conversions.wgsl.expected.spvasm index beb15ff3d9..2488e4e26d 100644 --- a/test/tint/types/module_scope_var_conversions.wgsl.expected.spvasm +++ b/test/tint/types/module_scope_var_conversions.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 54 +; Bound: 53 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -66,40 +66,39 @@ %v3u32_var3 = OpVariable %_ptr_Private_v3uint Private %32 %v3bool_var4 = OpVariable %_ptr_Private_v3bool Private %20 %v4bool = OpTypeVector %bool 4 - %false = OpConstantFalse %bool - %40 = OpConstantComposite %v4bool %true %false %true %false + %39 = OpConstantNull %bool + %40 = OpConstantComposite %v4bool %true %39 %true %39 %_ptr_Private_v4bool = OpTypePointer Private %v4bool %v4bool_var5 = OpVariable %_ptr_Private_v4bool Private %40 %void = OpTypeVoid %43 = OpTypeFunction %void - %47 = OpConstantNull %bool - %48 = OpConstantNull %int - %49 = OpConstantNull %uint - %50 = OpConstantNull %v3bool - %51 = OpConstantNull %v4bool - %52 = OpConstantNull %v3int - %53 = OpConstantNull %v3uint + %47 = OpConstantNull %int + %48 = OpConstantNull %uint + %49 = OpConstantNull %v3bool + %50 = OpConstantNull %v4bool + %51 = OpConstantNull %v3int + %52 = OpConstantNull %v3uint %main = OpFunction %void None %43 %46 = OpLabel - OpStore %bool_var1 %47 - OpStore %bool_var2 %47 - OpStore %bool_var3 %47 - OpStore %i32_var1 %48 - OpStore %i32_var2 %48 - OpStore %i32_var3 %48 - OpStore %u32_var1 %49 - OpStore %u32_var2 %49 - OpStore %u32_var3 %49 - OpStore %v3bool_var1 %50 - OpStore %v3bool_var2 %50 - OpStore %v3bool_var3 %50 - OpStore %v3bool_var4 %50 - OpStore %v4bool_var5 %51 - OpStore %v3i32_var1 %52 - OpStore %v3i32_var2 %52 - OpStore %v3i32_var3 %52 - OpStore %v3u32_var1 %53 - OpStore %v3u32_var2 %53 - OpStore %v3u32_var3 %53 + OpStore %bool_var1 %39 + OpStore %bool_var2 %39 + OpStore %bool_var3 %39 + OpStore %i32_var1 %47 + OpStore %i32_var2 %47 + OpStore %i32_var3 %47 + OpStore %u32_var1 %48 + OpStore %u32_var2 %48 + OpStore %u32_var3 %48 + OpStore %v3bool_var1 %49 + OpStore %v3bool_var2 %49 + OpStore %v3bool_var3 %49 + OpStore %v3bool_var4 %49 + OpStore %v4bool_var5 %50 + OpStore %v3i32_var1 %51 + OpStore %v3i32_var2 %51 + OpStore %v3i32_var3 %51 + OpStore %v3u32_var1 %52 + OpStore %v3u32_var2 %52 + OpStore %v3u32_var3 %52 OpReturn OpFunctionEnd diff --git a/test/tint/types/module_scope_var_conversions.wgsl.expected.wgsl b/test/tint/types/module_scope_var_conversions.wgsl.expected.wgsl index b5373bf806..8cbfc018e2 100644 --- a/test/tint/types/module_scope_var_conversions.wgsl.expected.wgsl +++ b/test/tint/types/module_scope_var_conversions.wgsl.expected.wgsl @@ -38,7 +38,7 @@ var v3bool_var4 : vec3 = vec3(vec2(vec2(123.0)), var v4bool_var5 : vec4 = vec4(vec2(vec2(123.0, 0.0)), vec2(true, bool(f32(0.0)))); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { bool_var1 = bool(); bool_var2 = bool(); diff --git a/test/tint/types/module_scope_var_initializers.wgsl b/test/tint/types/module_scope_var_initializers.wgsl index f2ffaeea57..791df7ba26 100644 --- a/test/tint/types/module_scope_var_initializers.wgsl +++ b/test/tint/types/module_scope_var_initializers.wgsl @@ -13,7 +13,7 @@ var m2x3_var : mat2x3 = mat2x3(); var arr_var : array = array(); var struct_var : S = S(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { // Reference the module-scope variables to stop them from being removed. bool_var = bool(); diff --git a/test/tint/types/module_scope_var_initializers.wgsl.expected.dxc.hlsl b/test/tint/types/module_scope_var_initializers.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4693209499 --- /dev/null +++ b/test/tint/types/module_scope_var_initializers.wgsl.expected.dxc.hlsl @@ -0,0 +1,31 @@ +struct S { + float a; +}; + +static bool bool_var = false; +static int i32_var = 0; +static uint u32_var = 0u; +static float f32_var = 0.0f; +static int2 v2i32_var = (0).xx; +static uint3 v3u32_var = (0u).xxx; +static float4 v4f32_var = (0.0f).xxxx; +static float2x3 m2x3_var = float2x3((0.0f).xxx, (0.0f).xxx); +static float arr_var[4] = (float[4])0; +static S struct_var = (S)0; + +[numthreads(1, 1, 1)] +void main() { + bool_var = false; + i32_var = 0; + u32_var = 0u; + f32_var = 0.0f; + v2i32_var = (0).xx; + v3u32_var = (0u).xxx; + v4f32_var = (0.0f).xxxx; + m2x3_var = float2x3((0.0f).xxx, (0.0f).xxx); + const float tint_symbol[4] = (float[4])0; + arr_var = tint_symbol; + const S tint_symbol_1 = (S)0; + struct_var = tint_symbol_1; + return; +} diff --git a/test/tint/types/module_scope_var_initializers.wgsl.expected.fxc.hlsl b/test/tint/types/module_scope_var_initializers.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4693209499 --- /dev/null +++ b/test/tint/types/module_scope_var_initializers.wgsl.expected.fxc.hlsl @@ -0,0 +1,31 @@ +struct S { + float a; +}; + +static bool bool_var = false; +static int i32_var = 0; +static uint u32_var = 0u; +static float f32_var = 0.0f; +static int2 v2i32_var = (0).xx; +static uint3 v3u32_var = (0u).xxx; +static float4 v4f32_var = (0.0f).xxxx; +static float2x3 m2x3_var = float2x3((0.0f).xxx, (0.0f).xxx); +static float arr_var[4] = (float[4])0; +static S struct_var = (S)0; + +[numthreads(1, 1, 1)] +void main() { + bool_var = false; + i32_var = 0; + u32_var = 0u; + f32_var = 0.0f; + v2i32_var = (0).xx; + v3u32_var = (0u).xxx; + v4f32_var = (0.0f).xxxx; + m2x3_var = float2x3((0.0f).xxx, (0.0f).xxx); + const float tint_symbol[4] = (float[4])0; + arr_var = tint_symbol; + const S tint_symbol_1 = (S)0; + struct_var = tint_symbol_1; + return; +} diff --git a/test/tint/types/module_scope_var_initializers.wgsl.expected.glsl b/test/tint/types/module_scope_var_initializers.wgsl.expected.glsl index c9ffa1167d..ecf73686fd 100644 --- a/test/tint/types/module_scope_var_initializers.wgsl.expected.glsl +++ b/test/tint/types/module_scope_var_initializers.wgsl.expected.glsl @@ -8,10 +8,10 @@ bool bool_var = false; int i32_var = 0; uint u32_var = 0u; float f32_var = 0.0f; -ivec2 v2i32_var = ivec2(0, 0); -uvec3 v3u32_var = uvec3(0u, 0u, 0u); -vec4 v4f32_var = vec4(0.0f, 0.0f, 0.0f, 0.0f); -mat2x3 m2x3_var = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); +ivec2 v2i32_var = ivec2(0); +uvec3 v3u32_var = uvec3(0u); +vec4 v4f32_var = vec4(0.0f); +mat2x3 m2x3_var = mat2x3(vec3(0.0f), vec3(0.0f)); float arr_var[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); S struct_var = S(0.0f); void tint_symbol() { @@ -19,10 +19,10 @@ void tint_symbol() { i32_var = 0; u32_var = 0u; f32_var = 0.0f; - v2i32_var = ivec2(0, 0); - v3u32_var = uvec3(0u, 0u, 0u); - v4f32_var = vec4(0.0f, 0.0f, 0.0f, 0.0f); - m2x3_var = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + v2i32_var = ivec2(0); + v3u32_var = uvec3(0u); + v4f32_var = vec4(0.0f); + m2x3_var = mat2x3(vec3(0.0f), vec3(0.0f)); float tint_symbol_1[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); arr_var = tint_symbol_1; S tint_symbol_2 = S(0.0f); diff --git a/test/tint/types/module_scope_var_initializers.wgsl.expected.hlsl b/test/tint/types/module_scope_var_initializers.wgsl.expected.hlsl deleted file mode 100644 index fefdd19e93..0000000000 --- a/test/tint/types/module_scope_var_initializers.wgsl.expected.hlsl +++ /dev/null @@ -1,31 +0,0 @@ -struct S { - float a; -}; - -static bool bool_var = false; -static int i32_var = 0; -static uint u32_var = 0u; -static float f32_var = 0.0f; -static int2 v2i32_var = int2(0, 0); -static uint3 v3u32_var = uint3(0u, 0u, 0u); -static float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -static float arr_var[4] = (float[4])0; -static S struct_var = (S)0; - -[numthreads(1, 1, 1)] -void main() { - bool_var = false; - i32_var = 0; - u32_var = 0u; - f32_var = 0.0f; - v2i32_var = int2(0, 0); - v3u32_var = uint3(0u, 0u, 0u); - v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); - m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - const float tint_symbol[4] = (float[4])0; - arr_var = tint_symbol; - const S tint_symbol_1 = (S)0; - struct_var = tint_symbol_1; - return; -} diff --git a/test/tint/types/module_scope_var_initializers.wgsl.expected.msl b/test/tint/types/module_scope_var_initializers.wgsl.expected.msl index afbc577f13..f21fcf3216 100644 --- a/test/tint/types/module_scope_var_initializers.wgsl.expected.msl +++ b/test/tint/types/module_scope_var_initializers.wgsl.expected.msl @@ -1,36 +1,45 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { float a; }; -struct tint_array_wrapper { - float arr[4]; -}; - kernel void tint_symbol() { - thread bool tint_symbol_3 = bool(); - thread int tint_symbol_4 = int(); - thread uint tint_symbol_5 = uint(); - thread float tint_symbol_6 = float(); - thread int2 tint_symbol_7 = int2(); - thread uint3 tint_symbol_8 = uint3(); - thread float4 tint_symbol_9 = float4(); - thread float2x3 tint_symbol_10 = float2x3(); - thread tint_array_wrapper tint_symbol_11 = {.arr={}}; - thread S tint_symbol_12 = {}; - tint_symbol_3 = bool(); - tint_symbol_4 = int(); - tint_symbol_5 = uint(); - tint_symbol_6 = float(); - tint_symbol_7 = int2(); - tint_symbol_8 = uint3(); - tint_symbol_9 = float4(); - tint_symbol_10 = float2x3(); - tint_array_wrapper const tint_symbol_1 = {.arr={}}; + thread bool tint_symbol_3 = false; + thread int tint_symbol_4 = 0; + thread uint tint_symbol_5 = 0u; + thread float tint_symbol_6 = 0.0f; + thread int2 tint_symbol_7 = int2(0); + thread uint3 tint_symbol_8 = uint3(0u); + thread float4 tint_symbol_9 = float4(0.0f); + thread float2x3 tint_symbol_10 = float2x3(float3(0.0f), float3(0.0f)); + thread tint_array tint_symbol_11 = tint_array{}; + thread S tint_symbol_12 = S{}; + tint_symbol_3 = false; + tint_symbol_4 = 0; + tint_symbol_5 = 0u; + tint_symbol_6 = 0.0f; + tint_symbol_7 = int2(0); + tint_symbol_8 = uint3(0u); + tint_symbol_9 = float4(0.0f); + tint_symbol_10 = float2x3(float3(0.0f), float3(0.0f)); + tint_array const tint_symbol_1 = tint_array{}; tint_symbol_11 = tint_symbol_1; - S const tint_symbol_2 = {}; + S const tint_symbol_2 = S{}; tint_symbol_12 = tint_symbol_2; return; } diff --git a/test/tint/types/module_scope_var_initializers.wgsl.expected.wgsl b/test/tint/types/module_scope_var_initializers.wgsl.expected.wgsl index e8e80d9bd3..26771dffcf 100644 --- a/test/tint/types/module_scope_var_initializers.wgsl.expected.wgsl +++ b/test/tint/types/module_scope_var_initializers.wgsl.expected.wgsl @@ -22,7 +22,7 @@ var arr_var : array = array(); var struct_var : S = S(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { bool_var = bool(); i32_var = i32(); diff --git a/test/tint/types/parameters.wgsl b/test/tint/types/parameters.wgsl index 465a67319a..d2fcf29b27 100644 --- a/test/tint/types/parameters.wgsl +++ b/test/tint/types/parameters.wgsl @@ -18,6 +18,6 @@ fn foo( param_ptr_arr : ptr>, ) {} -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { } diff --git a/test/tint/types/parameters.wgsl.expected.hlsl b/test/tint/types/parameters.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/parameters.wgsl.expected.hlsl rename to test/tint/types/parameters.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/parameters.wgsl.expected.fxc.hlsl b/test/tint/types/parameters.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..10704a79b1 --- /dev/null +++ b/test/tint/types/parameters.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +struct S { + float a; +}; + +void foo(bool param_bool, int param_i32, uint param_u32, float param_f32, int2 param_v2i32, uint3 param_v3u32, float4 param_v4f32, float2x3 param_m2x3, float param_arr[4], S param_struct, inout float param_ptr_f32, inout float4 param_ptr_vec, inout float param_ptr_arr[4]) { +} + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/parameters.wgsl.expected.msl b/test/tint/types/parameters.wgsl.expected.msl index 3c1db257f9..54ad948cfe 100644 --- a/test/tint/types/parameters.wgsl.expected.msl +++ b/test/tint/types/parameters.wgsl.expected.msl @@ -1,15 +1,24 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { float a; }; -struct tint_array_wrapper { - float arr[4]; -}; - -void foo(bool param_bool, int param_i32, uint param_u32, float param_f32, int2 param_v2i32, uint3 param_v3u32, float4 param_v4f32, float2x3 param_m2x3, tint_array_wrapper param_arr, S param_struct, thread float* const param_ptr_f32, thread float4* const param_ptr_vec, thread tint_array_wrapper* const param_ptr_arr) { +void foo(bool param_bool, int param_i32, uint param_u32, float param_f32, int2 param_v2i32, uint3 param_v3u32, float4 param_v4f32, float2x3 param_m2x3, tint_array param_arr, S param_struct, thread float* const param_ptr_f32, thread float4* const param_ptr_vec, thread tint_array* const param_ptr_arr) { } kernel void tint_symbol() { diff --git a/test/tint/types/parameters.wgsl.expected.wgsl b/test/tint/types/parameters.wgsl.expected.wgsl index e98185f645..cc80dc20e7 100644 --- a/test/tint/types/parameters.wgsl.expected.wgsl +++ b/test/tint/types/parameters.wgsl.expected.wgsl @@ -5,6 +5,6 @@ struct S { fn foo(param_bool : bool, param_i32 : i32, param_u32 : u32, param_f32 : f32, param_v2i32 : vec2, param_v3u32 : vec3, param_v4f32 : vec4, param_m2x3 : mat2x3, param_arr : array, param_struct : S, param_ptr_f32 : ptr, param_ptr_vec : ptr>, param_ptr_arr : ptr>) { } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { } diff --git a/test/tint/types/return_types.wgsl b/test/tint/types/return_types.wgsl index 563b219285..06a055e30d 100644 --- a/test/tint/types/return_types.wgsl +++ b/test/tint/types/return_types.wgsl @@ -13,6 +13,6 @@ fn ret_m2x3() -> mat2x3 { return mat2x3(); } fn ret_arr() -> array { return array(); } fn ret_struct() -> S { return S(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { } diff --git a/test/tint/types/return_types.wgsl.expected.dxc.hlsl b/test/tint/types/return_types.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2e82c6ee77 --- /dev/null +++ b/test/tint/types/return_types.wgsl.expected.dxc.hlsl @@ -0,0 +1,51 @@ +struct S { + float a; +}; + +bool ret_bool() { + return false; +} + +int ret_i32() { + return 0; +} + +uint ret_u32() { + return 0u; +} + +float ret_f32() { + return 0.0f; +} + +int2 ret_v2i32() { + return (0).xx; +} + +uint3 ret_v3u32() { + return (0u).xxx; +} + +float4 ret_v4f32() { + return (0.0f).xxxx; +} + +float2x3 ret_m2x3() { + return float2x3((0.0f).xxx, (0.0f).xxx); +} + +typedef float ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const float tint_symbol[4] = (float[4])0; + return tint_symbol; +} + +S ret_struct() { + const S tint_symbol_1 = (S)0; + return tint_symbol_1; +} + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/return_types.wgsl.expected.fxc.hlsl b/test/tint/types/return_types.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2e82c6ee77 --- /dev/null +++ b/test/tint/types/return_types.wgsl.expected.fxc.hlsl @@ -0,0 +1,51 @@ +struct S { + float a; +}; + +bool ret_bool() { + return false; +} + +int ret_i32() { + return 0; +} + +uint ret_u32() { + return 0u; +} + +float ret_f32() { + return 0.0f; +} + +int2 ret_v2i32() { + return (0).xx; +} + +uint3 ret_v3u32() { + return (0u).xxx; +} + +float4 ret_v4f32() { + return (0.0f).xxxx; +} + +float2x3 ret_m2x3() { + return float2x3((0.0f).xxx, (0.0f).xxx); +} + +typedef float ret_arr_ret[4]; +ret_arr_ret ret_arr() { + const float tint_symbol[4] = (float[4])0; + return tint_symbol; +} + +S ret_struct() { + const S tint_symbol_1 = (S)0; + return tint_symbol_1; +} + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/return_types.wgsl.expected.hlsl b/test/tint/types/return_types.wgsl.expected.hlsl deleted file mode 100644 index 1d057d4ded..0000000000 --- a/test/tint/types/return_types.wgsl.expected.hlsl +++ /dev/null @@ -1,51 +0,0 @@ -struct S { - float a; -}; - -bool ret_bool() { - return false; -} - -int ret_i32() { - return 0; -} - -uint ret_u32() { - return 0u; -} - -float ret_f32() { - return 0.0f; -} - -int2 ret_v2i32() { - return int2(0, 0); -} - -uint3 ret_v3u32() { - return uint3(0u, 0u, 0u); -} - -float4 ret_v4f32() { - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -float2x3 ret_m2x3() { - return float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); -} - -typedef float ret_arr_ret[4]; -ret_arr_ret ret_arr() { - const float tint_symbol[4] = (float[4])0; - return tint_symbol; -} - -S ret_struct() { - const S tint_symbol_1 = (S)0; - return tint_symbol_1; -} - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/types/return_types.wgsl.expected.msl b/test/tint/types/return_types.wgsl.expected.msl index 2d5d9cb8d4..2f9822c996 100644 --- a/test/tint/types/return_types.wgsl.expected.msl +++ b/test/tint/types/return_types.wgsl.expected.msl @@ -1,53 +1,62 @@ #include using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + struct S { float a; }; bool ret_bool() { - return bool(); + return false; } int ret_i32() { - return int(); + return 0; } uint ret_u32() { - return uint(); + return 0u; } float ret_f32() { - return float(); + return 0.0f; } int2 ret_v2i32() { - return int2(); + return int2(0); } uint3 ret_v3u32() { - return uint3(); + return uint3(0u); } float4 ret_v4f32() { - return float4(); + return float4(0.0f); } float2x3 ret_m2x3() { - return float2x3(); + return float2x3(float3(0.0f), float3(0.0f)); } -struct tint_array_wrapper { - float arr[4]; -}; - -tint_array_wrapper ret_arr() { - tint_array_wrapper const tint_symbol_1 = {.arr={}}; +tint_array ret_arr() { + tint_array const tint_symbol_1 = tint_array{}; return tint_symbol_1; } S ret_struct() { - S const tint_symbol_2 = {}; + S const tint_symbol_2 = S{}; return tint_symbol_2; } diff --git a/test/tint/types/return_types.wgsl.expected.wgsl b/test/tint/types/return_types.wgsl.expected.wgsl index 3ef490e283..d339d33ec9 100644 --- a/test/tint/types/return_types.wgsl.expected.wgsl +++ b/test/tint/types/return_types.wgsl.expected.wgsl @@ -42,6 +42,6 @@ fn ret_struct() -> S { return S(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { } diff --git a/test/tint/types/sampler.wgsl b/test/tint/types/sampler.wgsl index edeb51e5b2..cf113ec6e4 100644 --- a/test/tint/types/sampler.wgsl +++ b/test/tint/types/sampler.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var s : sampler; @group(0) @binding(1) var sc : sampler_comparison; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = s; _ = sc; diff --git a/test/tint/types/sampler.wgsl.expected.hlsl b/test/tint/types/sampler.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/sampler.wgsl.expected.hlsl rename to test/tint/types/sampler.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/sampler.wgsl.expected.fxc.hlsl b/test/tint/types/sampler.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e6a3bdc39d --- /dev/null +++ b/test/tint/types/sampler.wgsl.expected.fxc.hlsl @@ -0,0 +1,7 @@ +SamplerState s : register(s0, space0); +SamplerComparisonState sc : register(s1, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/sampler.wgsl.expected.wgsl b/test/tint/types/sampler.wgsl.expected.wgsl index 3d873eb83e..de33d8bed5 100644 --- a/test/tint/types/sampler.wgsl.expected.wgsl +++ b/test/tint/types/sampler.wgsl.expected.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var sc : sampler_comparison; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = s; _ = sc; diff --git a/test/tint/types/struct_members.wgsl b/test/tint/types/struct_members.wgsl index 21bc2174c7..180b0428fc 100644 --- a/test/tint/types/struct_members.wgsl +++ b/test/tint/types/struct_members.wgsl @@ -15,7 +15,7 @@ struct S { member_struct : S_inner, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let s : S = S(); } diff --git a/test/tint/types/struct_members.wgsl.expected.hlsl b/test/tint/types/struct_members.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/struct_members.wgsl.expected.hlsl rename to test/tint/types/struct_members.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/struct_members.wgsl.expected.fxc.hlsl b/test/tint/types/struct_members.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..671d9afca7 --- /dev/null +++ b/test/tint/types/struct_members.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +struct S_inner { + float a; +}; +struct S { + bool member_bool; + int member_i32; + uint member_u32; + float member_f32; + int2 member_v2i32; + uint3 member_v3u32; + float4 member_v4f32; + float2x3 member_m2x3; + float member_arr[4]; + S_inner member_struct; +}; + +[numthreads(1, 1, 1)] +void main() { + const S s = (S)0; + return; +} diff --git a/test/tint/types/struct_members.wgsl.expected.glsl b/test/tint/types/struct_members.wgsl.expected.glsl index f7d2db8781..eebcdc6cac 100644 --- a/test/tint/types/struct_members.wgsl.expected.glsl +++ b/test/tint/types/struct_members.wgsl.expected.glsl @@ -18,7 +18,7 @@ struct S { }; void tint_symbol() { - S s = S(false, 0, 0u, 0.0f, ivec2(0, 0), uvec3(0u, 0u, 0u), vec4(0.0f, 0.0f, 0.0f, 0.0f), mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f), S_inner(0.0f)); + S s = S(false, 0, 0u, 0.0f, ivec2(0), uvec3(0u), vec4(0.0f), mat2x3(vec3(0.0f), vec3(0.0f)), float[4](0.0f, 0.0f, 0.0f, 0.0f), S_inner(0.0f)); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/types/struct_members.wgsl.expected.msl b/test/tint/types/struct_members.wgsl.expected.msl index a43d5e0a10..cb40b76575 100644 --- a/test/tint/types/struct_members.wgsl.expected.msl +++ b/test/tint/types/struct_members.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct S_inner { - float a; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -struct tint_array_wrapper { - float arr[4]; +struct S_inner { + float a; }; struct S { @@ -18,12 +27,12 @@ struct S { uint3 member_v3u32; float4 member_v4f32; float2x3 member_m2x3; - tint_array_wrapper member_arr; + tint_array member_arr; S_inner member_struct; }; kernel void tint_symbol() { - S const s = {}; + S const s = S{}; return; } diff --git a/test/tint/types/struct_members.wgsl.expected.wgsl b/test/tint/types/struct_members.wgsl.expected.wgsl index 061b6f7664..89d786706c 100644 --- a/test/tint/types/struct_members.wgsl.expected.wgsl +++ b/test/tint/types/struct_members.wgsl.expected.wgsl @@ -15,7 +15,7 @@ struct S { member_struct : S_inner, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { let s : S = S(); } diff --git a/test/tint/types/texture/depth/2d.wgsl b/test/tint/types/texture/depth/2d.wgsl index e3a53cd85b..b0947c7de6 100644 --- a/test/tint/types/texture/depth/2d.wgsl +++ b/test/tint/types/texture/depth/2d.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var t_f : texture_depth_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; } diff --git a/test/tint/types/texture/depth/2d.wgsl.expected.hlsl b/test/tint/types/texture/depth/2d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/depth/2d.wgsl.expected.hlsl rename to test/tint/types/texture/depth/2d.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/depth/2d.wgsl.expected.fxc.hlsl b/test/tint/types/texture/depth/2d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a1d1935c89 --- /dev/null +++ b/test/tint/types/texture/depth/2d.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +Texture2D t_f : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/depth/2d.wgsl.expected.wgsl b/test/tint/types/texture/depth/2d.wgsl.expected.wgsl index e3a53cd85b..b0947c7de6 100644 --- a/test/tint/types/texture/depth/2d.wgsl.expected.wgsl +++ b/test/tint/types/texture/depth/2d.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var t_f : texture_depth_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; } diff --git a/test/tint/types/texture/depth/2d_array.wgsl b/test/tint/types/texture/depth/2d_array.wgsl index e6fac8c5cb..22ec1c18f9 100644 --- a/test/tint/types/texture/depth/2d_array.wgsl +++ b/test/tint/types/texture/depth/2d_array.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var t_f : texture_depth_2d_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; } diff --git a/test/tint/types/texture/depth/2d_array.wgsl.expected.hlsl b/test/tint/types/texture/depth/2d_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/depth/2d_array.wgsl.expected.hlsl rename to test/tint/types/texture/depth/2d_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/depth/2d_array.wgsl.expected.fxc.hlsl b/test/tint/types/texture/depth/2d_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5ddf7baf19 --- /dev/null +++ b/test/tint/types/texture/depth/2d_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +Texture2DArray t_f : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/depth/2d_array.wgsl.expected.wgsl b/test/tint/types/texture/depth/2d_array.wgsl.expected.wgsl index e6fac8c5cb..22ec1c18f9 100644 --- a/test/tint/types/texture/depth/2d_array.wgsl.expected.wgsl +++ b/test/tint/types/texture/depth/2d_array.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var t_f : texture_depth_2d_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; } diff --git a/test/tint/types/texture/depth/cube.wgsl b/test/tint/types/texture/depth/cube.wgsl index 785b96cd4c..f19bb64169 100644 --- a/test/tint/types/texture/depth/cube.wgsl +++ b/test/tint/types/texture/depth/cube.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var t_f : texture_depth_cube; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; } diff --git a/test/tint/types/texture/depth/cube.wgsl.expected.hlsl b/test/tint/types/texture/depth/cube.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/depth/cube.wgsl.expected.hlsl rename to test/tint/types/texture/depth/cube.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/depth/cube.wgsl.expected.fxc.hlsl b/test/tint/types/texture/depth/cube.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..89d1dc7905 --- /dev/null +++ b/test/tint/types/texture/depth/cube.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +TextureCube t_f : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/depth/cube.wgsl.expected.wgsl b/test/tint/types/texture/depth/cube.wgsl.expected.wgsl index 785b96cd4c..f19bb64169 100644 --- a/test/tint/types/texture/depth/cube.wgsl.expected.wgsl +++ b/test/tint/types/texture/depth/cube.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var t_f : texture_depth_cube; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; } diff --git a/test/tint/types/texture/depth/cube_array.wgsl b/test/tint/types/texture/depth/cube_array.wgsl index 0e1b07e8bc..db539122f6 100644 --- a/test/tint/types/texture/depth/cube_array.wgsl +++ b/test/tint/types/texture/depth/cube_array.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var t_f : texture_depth_cube_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; } diff --git a/test/tint/types/texture/depth/cube_array.wgsl.expected.hlsl b/test/tint/types/texture/depth/cube_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/depth/cube_array.wgsl.expected.hlsl rename to test/tint/types/texture/depth/cube_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/depth/cube_array.wgsl.expected.fxc.hlsl b/test/tint/types/texture/depth/cube_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..57b1946c06 --- /dev/null +++ b/test/tint/types/texture/depth/cube_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +TextureCubeArray t_f : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/depth/cube_array.wgsl.expected.wgsl b/test/tint/types/texture/depth/cube_array.wgsl.expected.wgsl index 0e1b07e8bc..db539122f6 100644 --- a/test/tint/types/texture/depth/cube_array.wgsl.expected.wgsl +++ b/test/tint/types/texture/depth/cube_array.wgsl.expected.wgsl @@ -1,6 +1,6 @@ @group(0) @binding(0) var t_f : texture_depth_cube_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; } diff --git a/test/tint/types/texture/multisampled/2d.wgsl b/test/tint/types/texture/multisampled/2d.wgsl index 76521e5585..771238c935 100644 --- a/test/tint/types/texture/multisampled/2d.wgsl +++ b/test/tint/types/texture/multisampled/2d.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var t_i : texture_multisampled_2d; @group(0) @binding(2) var t_u : texture_multisampled_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/multisampled/2d.wgsl.expected.hlsl b/test/tint/types/texture/multisampled/2d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/multisampled/2d.wgsl.expected.hlsl rename to test/tint/types/texture/multisampled/2d.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/multisampled/2d.wgsl.expected.fxc.hlsl b/test/tint/types/texture/multisampled/2d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9efb9c3ecc --- /dev/null +++ b/test/tint/types/texture/multisampled/2d.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +Texture2DMS t_f : register(t0, space0); +Texture2DMS t_i : register(t1, space0); +Texture2DMS t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/multisampled/2d.wgsl.expected.wgsl b/test/tint/types/texture/multisampled/2d.wgsl.expected.wgsl index d8eb77b57c..156716a8e1 100644 --- a/test/tint/types/texture/multisampled/2d.wgsl.expected.wgsl +++ b/test/tint/types/texture/multisampled/2d.wgsl.expected.wgsl @@ -4,7 +4,7 @@ @group(0) @binding(2) var t_u : texture_multisampled_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/1d.wgsl b/test/tint/types/texture/sampled/1d.wgsl index ed97090b06..90f22dec7c 100644 --- a/test/tint/types/texture/sampled/1d.wgsl +++ b/test/tint/types/texture/sampled/1d.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var t_i : texture_1d; @group(0) @binding(2) var t_u : texture_1d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/1d.wgsl.expected.hlsl b/test/tint/types/texture/sampled/1d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/sampled/1d.wgsl.expected.hlsl rename to test/tint/types/texture/sampled/1d.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/sampled/1d.wgsl.expected.fxc.hlsl b/test/tint/types/texture/sampled/1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5d312e2113 --- /dev/null +++ b/test/tint/types/texture/sampled/1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +Texture1D t_f : register(t0, space0); +Texture1D t_i : register(t1, space0); +Texture1D t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/sampled/1d.wgsl.expected.wgsl b/test/tint/types/texture/sampled/1d.wgsl.expected.wgsl index 565089e820..93f60d0e62 100644 --- a/test/tint/types/texture/sampled/1d.wgsl.expected.wgsl +++ b/test/tint/types/texture/sampled/1d.wgsl.expected.wgsl @@ -4,7 +4,7 @@ @group(0) @binding(2) var t_u : texture_1d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/2d.wgsl b/test/tint/types/texture/sampled/2d.wgsl index b6be42b742..5c7e2e5cbd 100644 --- a/test/tint/types/texture/sampled/2d.wgsl +++ b/test/tint/types/texture/sampled/2d.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var t_i : texture_2d; @group(0) @binding(2) var t_u : texture_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/2d.wgsl.expected.hlsl b/test/tint/types/texture/sampled/2d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/sampled/2d.wgsl.expected.hlsl rename to test/tint/types/texture/sampled/2d.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/sampled/2d.wgsl.expected.fxc.hlsl b/test/tint/types/texture/sampled/2d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b1ec53fcfe --- /dev/null +++ b/test/tint/types/texture/sampled/2d.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +Texture2D t_f : register(t0, space0); +Texture2D t_i : register(t1, space0); +Texture2D t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/sampled/2d.wgsl.expected.wgsl b/test/tint/types/texture/sampled/2d.wgsl.expected.wgsl index 007b85fc2a..a5f3faf97d 100644 --- a/test/tint/types/texture/sampled/2d.wgsl.expected.wgsl +++ b/test/tint/types/texture/sampled/2d.wgsl.expected.wgsl @@ -4,7 +4,7 @@ @group(0) @binding(2) var t_u : texture_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/2d_array.wgsl b/test/tint/types/texture/sampled/2d_array.wgsl index 1dcfc6ce44..120d0f1f39 100644 --- a/test/tint/types/texture/sampled/2d_array.wgsl +++ b/test/tint/types/texture/sampled/2d_array.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var t_i : texture_2d_array; @group(0) @binding(2) var t_u : texture_2d_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/2d_array.wgsl.expected.hlsl b/test/tint/types/texture/sampled/2d_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/sampled/2d_array.wgsl.expected.hlsl rename to test/tint/types/texture/sampled/2d_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/sampled/2d_array.wgsl.expected.fxc.hlsl b/test/tint/types/texture/sampled/2d_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6dfc0fc723 --- /dev/null +++ b/test/tint/types/texture/sampled/2d_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +Texture2DArray t_f : register(t0, space0); +Texture2DArray t_i : register(t1, space0); +Texture2DArray t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/sampled/2d_array.wgsl.expected.wgsl b/test/tint/types/texture/sampled/2d_array.wgsl.expected.wgsl index 5201bbeefa..cec37a4b46 100644 --- a/test/tint/types/texture/sampled/2d_array.wgsl.expected.wgsl +++ b/test/tint/types/texture/sampled/2d_array.wgsl.expected.wgsl @@ -4,7 +4,7 @@ @group(0) @binding(2) var t_u : texture_2d_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/3d.wgsl b/test/tint/types/texture/sampled/3d.wgsl index 37a525ecbb..4e7935738d 100644 --- a/test/tint/types/texture/sampled/3d.wgsl +++ b/test/tint/types/texture/sampled/3d.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var t_i : texture_3d; @group(0) @binding(2) var t_u : texture_3d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/3d.wgsl.expected.hlsl b/test/tint/types/texture/sampled/3d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/sampled/3d.wgsl.expected.hlsl rename to test/tint/types/texture/sampled/3d.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/sampled/3d.wgsl.expected.fxc.hlsl b/test/tint/types/texture/sampled/3d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1a3b441ba8 --- /dev/null +++ b/test/tint/types/texture/sampled/3d.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +Texture3D t_f : register(t0, space0); +Texture3D t_i : register(t1, space0); +Texture3D t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/sampled/3d.wgsl.expected.wgsl b/test/tint/types/texture/sampled/3d.wgsl.expected.wgsl index 747bc8f573..d8bd8a2d16 100644 --- a/test/tint/types/texture/sampled/3d.wgsl.expected.wgsl +++ b/test/tint/types/texture/sampled/3d.wgsl.expected.wgsl @@ -4,7 +4,7 @@ @group(0) @binding(2) var t_u : texture_3d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/cube.wgsl b/test/tint/types/texture/sampled/cube.wgsl index 89859e9c70..c02c905c0d 100644 --- a/test/tint/types/texture/sampled/cube.wgsl +++ b/test/tint/types/texture/sampled/cube.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var t_i : texture_cube; @group(0) @binding(2) var t_u : texture_cube; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/cube.wgsl.expected.hlsl b/test/tint/types/texture/sampled/cube.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/sampled/cube.wgsl.expected.hlsl rename to test/tint/types/texture/sampled/cube.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/sampled/cube.wgsl.expected.fxc.hlsl b/test/tint/types/texture/sampled/cube.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9d0b4c5552 --- /dev/null +++ b/test/tint/types/texture/sampled/cube.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +TextureCube t_f : register(t0, space0); +TextureCube t_i : register(t1, space0); +TextureCube t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/sampled/cube.wgsl.expected.wgsl b/test/tint/types/texture/sampled/cube.wgsl.expected.wgsl index 28c68819e2..21f24026b9 100644 --- a/test/tint/types/texture/sampled/cube.wgsl.expected.wgsl +++ b/test/tint/types/texture/sampled/cube.wgsl.expected.wgsl @@ -4,7 +4,7 @@ @group(0) @binding(2) var t_u : texture_cube; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/cube_array.wgsl b/test/tint/types/texture/sampled/cube_array.wgsl index c7249c88eb..4f51942ff6 100644 --- a/test/tint/types/texture/sampled/cube_array.wgsl +++ b/test/tint/types/texture/sampled/cube_array.wgsl @@ -2,7 +2,7 @@ @group(0) @binding(1) var t_i : texture_cube_array; @group(0) @binding(2) var t_u : texture_cube_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/sampled/cube_array.wgsl.expected.hlsl b/test/tint/types/texture/sampled/cube_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/sampled/cube_array.wgsl.expected.hlsl rename to test/tint/types/texture/sampled/cube_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/sampled/cube_array.wgsl.expected.fxc.hlsl b/test/tint/types/texture/sampled/cube_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4a7de625a1 --- /dev/null +++ b/test/tint/types/texture/sampled/cube_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +TextureCubeArray t_f : register(t0, space0); +TextureCubeArray t_i : register(t1, space0); +TextureCubeArray t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/sampled/cube_array.wgsl.expected.wgsl b/test/tint/types/texture/sampled/cube_array.wgsl.expected.wgsl index 12dc114369..67597b4b6d 100644 --- a/test/tint/types/texture/sampled/cube_array.wgsl.expected.wgsl +++ b/test/tint/types/texture/sampled/cube_array.wgsl.expected.wgsl @@ -4,7 +4,7 @@ @group(0) @binding(2) var t_u : texture_cube_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_f; _ = t_i; diff --git a/test/tint/types/texture/storage/1d.wgsl b/test/tint/types/texture/storage/1d.wgsl index 7adad9e5eb..7ea09c2661 100644 --- a/test/tint/types/texture/storage/1d.wgsl +++ b/test/tint/types/texture/storage/1d.wgsl @@ -15,7 +15,7 @@ @group(0) @binding(14) var t_rgba32sint : texture_storage_1d; @group(0) @binding(15) var t_rgba32float : texture_storage_1d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_rgba8unorm; _ = t_rgba8snorm; diff --git a/test/tint/types/texture/storage/1d.wgsl.expected.hlsl b/test/tint/types/texture/storage/1d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/storage/1d.wgsl.expected.hlsl rename to test/tint/types/texture/storage/1d.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/storage/1d.wgsl.expected.fxc.hlsl b/test/tint/types/texture/storage/1d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1628ef7961 --- /dev/null +++ b/test/tint/types/texture/storage/1d.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +RWTexture1D t_rgba8unorm : register(u0, space0); +RWTexture1D t_rgba8snorm : register(u1, space0); +RWTexture1D t_rgba8uint : register(u2, space0); +RWTexture1D t_rgba8sint : register(u3, space0); +RWTexture1D t_rgba16uint : register(u4, space0); +RWTexture1D t_rgba16sint : register(u5, space0); +RWTexture1D t_rgba16float : register(u6, space0); +RWTexture1D t_r32uint : register(u7, space0); +RWTexture1D t_r32sint : register(u8, space0); +RWTexture1D t_r32float : register(u9, space0); +RWTexture1D t_rg32uint : register(u10, space0); +RWTexture1D t_rg32sint : register(u11, space0); +RWTexture1D t_rg32float : register(u12, space0); +RWTexture1D t_rgba32uint : register(u13, space0); +RWTexture1D t_rgba32sint : register(u14, space0); +RWTexture1D t_rgba32float : register(u15, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/storage/1d.wgsl.expected.wgsl b/test/tint/types/texture/storage/1d.wgsl.expected.wgsl index a3e5555b82..d58214de56 100644 --- a/test/tint/types/texture/storage/1d.wgsl.expected.wgsl +++ b/test/tint/types/texture/storage/1d.wgsl.expected.wgsl @@ -30,7 +30,7 @@ @group(0) @binding(15) var t_rgba32float : texture_storage_1d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_rgba8unorm; _ = t_rgba8snorm; diff --git a/test/tint/types/texture/storage/2d.wgsl b/test/tint/types/texture/storage/2d.wgsl index 44d0dfd7eb..e631bcf769 100644 --- a/test/tint/types/texture/storage/2d.wgsl +++ b/test/tint/types/texture/storage/2d.wgsl @@ -15,7 +15,7 @@ @group(0) @binding(14) var t_rgba32sint : texture_storage_2d; @group(0) @binding(15) var t_rgba32float : texture_storage_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_rgba8unorm; _ = t_rgba8snorm; diff --git a/test/tint/types/texture/storage/2d.wgsl.expected.hlsl b/test/tint/types/texture/storage/2d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/storage/2d.wgsl.expected.hlsl rename to test/tint/types/texture/storage/2d.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/storage/2d.wgsl.expected.fxc.hlsl b/test/tint/types/texture/storage/2d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8d1a7519b7 --- /dev/null +++ b/test/tint/types/texture/storage/2d.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +RWTexture2D t_rgba8unorm : register(u0, space0); +RWTexture2D t_rgba8snorm : register(u1, space0); +RWTexture2D t_rgba8uint : register(u2, space0); +RWTexture2D t_rgba8sint : register(u3, space0); +RWTexture2D t_rgba16uint : register(u4, space0); +RWTexture2D t_rgba16sint : register(u5, space0); +RWTexture2D t_rgba16float : register(u6, space0); +RWTexture2D t_r32uint : register(u7, space0); +RWTexture2D t_r32sint : register(u8, space0); +RWTexture2D t_r32float : register(u9, space0); +RWTexture2D t_rg32uint : register(u10, space0); +RWTexture2D t_rg32sint : register(u11, space0); +RWTexture2D t_rg32float : register(u12, space0); +RWTexture2D t_rgba32uint : register(u13, space0); +RWTexture2D t_rgba32sint : register(u14, space0); +RWTexture2D t_rgba32float : register(u15, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/storage/2d.wgsl.expected.wgsl b/test/tint/types/texture/storage/2d.wgsl.expected.wgsl index 97824adfb9..164be3e72b 100644 --- a/test/tint/types/texture/storage/2d.wgsl.expected.wgsl +++ b/test/tint/types/texture/storage/2d.wgsl.expected.wgsl @@ -30,7 +30,7 @@ @group(0) @binding(15) var t_rgba32float : texture_storage_2d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_rgba8unorm; _ = t_rgba8snorm; diff --git a/test/tint/types/texture/storage/2d_array.wgsl b/test/tint/types/texture/storage/2d_array.wgsl index 6919fda32d..d1830384f6 100644 --- a/test/tint/types/texture/storage/2d_array.wgsl +++ b/test/tint/types/texture/storage/2d_array.wgsl @@ -15,7 +15,7 @@ @group(0) @binding(14) var t_rgba32sint : texture_storage_2d_array; @group(0) @binding(15) var t_rgba32float : texture_storage_2d_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_rgba8unorm; _ = t_rgba8snorm; diff --git a/test/tint/types/texture/storage/2d_array.wgsl.expected.hlsl b/test/tint/types/texture/storage/2d_array.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/storage/2d_array.wgsl.expected.hlsl rename to test/tint/types/texture/storage/2d_array.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/storage/2d_array.wgsl.expected.fxc.hlsl b/test/tint/types/texture/storage/2d_array.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7b08fb84ce --- /dev/null +++ b/test/tint/types/texture/storage/2d_array.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +RWTexture2DArray t_rgba8unorm : register(u0, space0); +RWTexture2DArray t_rgba8snorm : register(u1, space0); +RWTexture2DArray t_rgba8uint : register(u2, space0); +RWTexture2DArray t_rgba8sint : register(u3, space0); +RWTexture2DArray t_rgba16uint : register(u4, space0); +RWTexture2DArray t_rgba16sint : register(u5, space0); +RWTexture2DArray t_rgba16float : register(u6, space0); +RWTexture2DArray t_r32uint : register(u7, space0); +RWTexture2DArray t_r32sint : register(u8, space0); +RWTexture2DArray t_r32float : register(u9, space0); +RWTexture2DArray t_rg32uint : register(u10, space0); +RWTexture2DArray t_rg32sint : register(u11, space0); +RWTexture2DArray t_rg32float : register(u12, space0); +RWTexture2DArray t_rgba32uint : register(u13, space0); +RWTexture2DArray t_rgba32sint : register(u14, space0); +RWTexture2DArray t_rgba32float : register(u15, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/storage/2d_array.wgsl.expected.wgsl b/test/tint/types/texture/storage/2d_array.wgsl.expected.wgsl index c4aa337c22..893a3ba564 100644 --- a/test/tint/types/texture/storage/2d_array.wgsl.expected.wgsl +++ b/test/tint/types/texture/storage/2d_array.wgsl.expected.wgsl @@ -30,7 +30,7 @@ @group(0) @binding(15) var t_rgba32float : texture_storage_2d_array; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_rgba8unorm; _ = t_rgba8snorm; diff --git a/test/tint/types/texture/storage/3d.wgsl b/test/tint/types/texture/storage/3d.wgsl index 710d0d39fc..cd51e6b31d 100644 --- a/test/tint/types/texture/storage/3d.wgsl +++ b/test/tint/types/texture/storage/3d.wgsl @@ -15,7 +15,7 @@ @group(0) @binding(14) var t_rgba32sint : texture_storage_3d; @group(0) @binding(15) var t_rgba32float : texture_storage_3d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_rgba8unorm; _ = t_rgba8snorm; diff --git a/test/tint/types/texture/storage/3d.wgsl.expected.hlsl b/test/tint/types/texture/storage/3d.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/types/texture/storage/3d.wgsl.expected.hlsl rename to test/tint/types/texture/storage/3d.wgsl.expected.dxc.hlsl diff --git a/test/tint/types/texture/storage/3d.wgsl.expected.fxc.hlsl b/test/tint/types/texture/storage/3d.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c4a5add63e --- /dev/null +++ b/test/tint/types/texture/storage/3d.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +RWTexture3D t_rgba8unorm : register(u0, space0); +RWTexture3D t_rgba8snorm : register(u1, space0); +RWTexture3D t_rgba8uint : register(u2, space0); +RWTexture3D t_rgba8sint : register(u3, space0); +RWTexture3D t_rgba16uint : register(u4, space0); +RWTexture3D t_rgba16sint : register(u5, space0); +RWTexture3D t_rgba16float : register(u6, space0); +RWTexture3D t_r32uint : register(u7, space0); +RWTexture3D t_r32sint : register(u8, space0); +RWTexture3D t_r32float : register(u9, space0); +RWTexture3D t_rg32uint : register(u10, space0); +RWTexture3D t_rg32sint : register(u11, space0); +RWTexture3D t_rg32float : register(u12, space0); +RWTexture3D t_rgba32uint : register(u13, space0); +RWTexture3D t_rgba32sint : register(u14, space0); +RWTexture3D t_rgba32float : register(u15, space0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/types/texture/storage/3d.wgsl.expected.wgsl b/test/tint/types/texture/storage/3d.wgsl.expected.wgsl index c3ba6726ab..1ee3b9487b 100644 --- a/test/tint/types/texture/storage/3d.wgsl.expected.wgsl +++ b/test/tint/types/texture/storage/3d.wgsl.expected.wgsl @@ -30,7 +30,7 @@ @group(0) @binding(15) var t_rgba32float : texture_storage_3d; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = t_rgba8unorm; _ = t_rgba8snorm; diff --git a/test/tint/unicode/comments.wgsl b/test/tint/unicode/comments.wgsl index 0e42055222..1d6108bc9f 100644 --- a/test/tint/unicode/comments.wgsl +++ b/test/tint/unicode/comments.wgsl @@ -5,7 +5,7 @@ नमस्ते दुनिया */ -@stage(fragment) +@fragment fn /* こんにちは世界 */ main( /* 你好世界 */ ) { // 안녕하세요 세계 } diff --git a/test/tint/unicode/comments.wgsl.expected.hlsl b/test/tint/unicode/comments.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/unicode/comments.wgsl.expected.hlsl rename to test/tint/unicode/comments.wgsl.expected.dxc.hlsl diff --git a/test/tint/unicode/comments.wgsl.expected.fxc.hlsl b/test/tint/unicode/comments.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..61d6d5716b --- /dev/null +++ b/test/tint/unicode/comments.wgsl.expected.fxc.hlsl @@ -0,0 +1,3 @@ +void main() { + return; +} diff --git a/test/tint/unicode/comments.wgsl.expected.wgsl b/test/tint/unicode/comments.wgsl.expected.wgsl index 3662a35207..1df86fc8a9 100644 --- a/test/tint/unicode/comments.wgsl.expected.wgsl +++ b/test/tint/unicode/comments.wgsl.expected.wgsl @@ -1,3 +1,3 @@ -@stage(fragment) +@fragment fn main() { } diff --git a/test/tint/unicode/identifiers.wgsl b/test/tint/unicode/identifiers.wgsl index 84c904a58b..64fc205f38 100644 --- a/test/tint/unicode/identifiers.wgsl +++ b/test/tint/unicode/identifiers.wgsl @@ -5,7 +5,7 @@ fn 𝓯𝓾𝓷𝓬𝓽𝓲𝓸𝓷(ᵖᵃʳᵃᵐ : 𝓉𝓎𝓅ℯ_𝒶) -> return 𝐭𝐲𝐩𝐞_𝐛(ᵖᵃʳᵃᵐ); } -@stage(fragment) +@fragment fn 𝕖𝕟𝕥𝕣𝕪𝕡𝕠𝕚𝕟𝕥() { var 𝙫𝙖𝙧𝙞𝙖𝙗𝙡𝙚 : 𝓉𝓎𝓅ℯ_𝒶; let 𝖗𝖊𝖘𝖚𝖑𝖙 = 𝓯𝓾𝓷𝓬𝓽𝓲𝓸𝓷(𝙫𝙖𝙧𝙞𝙖𝙗𝙡𝙚); diff --git a/test/tint/unicode/identifiers.wgsl.expected.hlsl b/test/tint/unicode/identifiers.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/unicode/identifiers.wgsl.expected.hlsl rename to test/tint/unicode/identifiers.wgsl.expected.dxc.hlsl diff --git a/test/tint/unicode/identifiers.wgsl.expected.fxc.hlsl b/test/tint/unicode/identifiers.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d82de3a9e7 --- /dev/null +++ b/test/tint/unicode/identifiers.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +float tint_symbol_2(int tint_symbol_3) { + return float(tint_symbol_3); +} + +void tint_symbol_4() { + int tint_symbol_5 = 0; + const float tint_symbol_6 = tint_symbol_2(tint_symbol_5); + return; +} diff --git a/test/tint/unicode/identifiers.wgsl.expected.wgsl b/test/tint/unicode/identifiers.wgsl.expected.wgsl index d78ad348c1..e13248f0c7 100644 --- a/test/tint/unicode/identifiers.wgsl.expected.wgsl +++ b/test/tint/unicode/identifiers.wgsl.expected.wgsl @@ -6,7 +6,7 @@ fn 𝓯𝓾𝓷𝓬𝓽𝓲𝓸𝓷(ᵖᵃʳᵃᵐ : 𝓉𝓎𝓅ℯ_𝒶) -> return 𝐭𝐲𝐩𝐞_𝐛(ᵖᵃʳᵃᵐ); } -@stage(fragment) +@fragment fn 𝕖𝕟𝕥𝕣𝕪𝕡𝕠𝕚𝕟𝕥() { var 𝙫𝙖𝙧𝙞𝙖𝙗𝙡𝙚 : 𝓉𝓎𝓅ℯ_𝒶; let 𝖗𝖊𝖘𝖚𝖑𝖙 = 𝓯𝓾𝓷𝓬𝓽𝓲𝓸𝓷(𝙫𝙖𝙧𝙞𝙖𝙗𝙡𝙚); diff --git a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.glsl b/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.glsl index 9f13868064..9104946d71 100644 --- a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.glsl +++ b/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.glsl @@ -5,7 +5,7 @@ precision mediump float; uniform highp sampler1D x_20_1; void main_1() { - vec4 x_125 = texelFetch(x_20_1, int(1u), 0); + vec4 x_125 = texelFetch(x_20_1, 1, 0); return; } diff --git a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.glsl b/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.glsl index b104a63e00..2d85a108ad 100644 --- a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.glsl +++ b/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.glsl @@ -5,7 +5,7 @@ precision mediump float; layout(rg32f) uniform highp writeonly image1D x_20; void main_1() { - imageStore(x_20, int(1u), vec4(0.0f, 0.0f, 0.0f, 0.0f)); + imageStore(x_20, 1, vec4(0.0f)); return; } diff --git a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.glsl b/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.glsl index 72709a38eb..e147d8cc38 100644 --- a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.glsl +++ b/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.glsl @@ -5,7 +5,7 @@ precision mediump float; uniform highp sampler1D x_20_1; void main_1() { - vec4 x_125 = texelFetch(x_20_1, int(0u), 0); + vec4 x_125 = texelFetch(x_20_1, 0, 0); return; } diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm index bae6f5957e..1a0a9f747f 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm @@ -10,8 +10,10 @@ OpMemoryModel Logical Simple OpEntryPoint Fragment %5 "main" %1 %2 %3 %4 OpExecutionMode %5 OriginUpperLeft OpDecorate %1 Location 0 +OpDecorate %1 Flat OpDecorate %2 Location 0 OpDecorate %3 Location 30 +OpDecorate %3 Flat OpDecorate %4 Location 6 %void = OpTypeVoid %7 = OpTypeFunction %void diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm deleted file mode 100644 index 5e28c67cf5..0000000000 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm +++ /dev/null @@ -1,67 +0,0 @@ -; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 42 -; Schema: 0 -OpCapability Shader -OpCapability SampleRateShading -OpMemoryModel Logical Simple -OpEntryPoint Vertex %7 "main" %1 %2 %3 %4 %5 %6 %gl_Position -OpDecorate %1 Location 1 -OpDecorate %2 Location 2 -OpDecorate %3 Location 3 -OpDecorate %4 Location 4 -OpDecorate %5 Location 5 -OpDecorate %6 Location 6 -OpDecorate %1 Flat -OpDecorate %2 Flat -OpDecorate %3 Flat -OpDecorate %4 Flat -OpDecorate %5 Flat -OpDecorate %6 Flat -OpDecorate %gl_Position BuiltIn Position -%void = OpTypeVoid -%9 = OpTypeFunction %void -%bool = OpTypeBool -%float = OpTypeFloat 32 -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%_ptr_Private_bool = OpTypePointer Private %bool -%_ptr_Private_float = OpTypePointer Private %float -%_ptr_Private_uint = OpTypePointer Private %uint -%_ptr_Private_int = OpTypePointer Private %int -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%float_0 = OpConstant %float 0 -%float_1_5 = OpConstant %float 1.5 -%uint_1 = OpConstant %uint 1 -%int_n1 = OpConstant %int -1 -%int_14 = OpConstant %int 14 -%uint_2 = OpConstant %uint 2 -%v2bool = OpTypeVector %bool 2 -%v2uint = OpTypeVector %uint 2 -%v2int = OpTypeVector %int 2 -%v2float = OpTypeVector %float 2 -%v4float = OpTypeVector %float 4 -%mat3v2float = OpTypeMatrix %v2float 3 -%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 -%_ptr_Input_uint = OpTypePointer Input %uint -%_ptr_Input_v2uint = OpTypePointer Input %v2uint -%_ptr_Input_int = OpTypePointer Input %int -%_ptr_Input_v2int = OpTypePointer Input %v2int -%_ptr_Input_float = OpTypePointer Input %float -%_ptr_Input_v2float = OpTypePointer Input %v2float -%1 = OpVariable %_ptr_Input_uint Input -%2 = OpVariable %_ptr_Input_v2uint Input -%3 = OpVariable %_ptr_Input_int Input -%4 = OpVariable %_ptr_Input_v2int Input -%5 = OpVariable %_ptr_Input_float Input -%6 = OpVariable %_ptr_Input_v2float Input -%_ptr_Output_v4float = OpTypePointer Output %v4float -%gl_Position = OpVariable %_ptr_Output_v4float Output -%7 = OpFunction %void None %9 -%41 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.glsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.glsl deleted file mode 100644 index 88e887649e..0000000000 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.glsl +++ /dev/null @@ -1,52 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(location = 1) flat in uint x_1_param_1; -layout(location = 2) flat in uvec2 x_2_param_1; -layout(location = 3) flat in int x_3_param_1; -layout(location = 4) flat in ivec2 x_4_param_1; -layout(location = 5) flat in float x_5_param_1; -layout(location = 6) flat in vec2 x_6_param_1; -uint x_1 = 0u; -uvec2 x_2 = uvec2(0u, 0u); -int x_3 = 0; -ivec2 x_4 = ivec2(0, 0); -float x_5 = 0.0f; -vec2 x_6 = vec2(0.0f, 0.0f); -vec4 x_8 = vec4(0.0f, 0.0f, 0.0f, 0.0f); -void main_1() { - return; -} - -struct main_out { - vec4 x_8_1; -}; - -main_out tint_symbol(uint x_1_param, uvec2 x_2_param, int x_3_param, ivec2 x_4_param, float x_5_param, vec2 x_6_param) { - x_1 = x_1_param; - x_2 = x_2_param; - x_3 = x_3_param; - x_4 = x_4_param; - x_5 = x_5_param; - x_6 = x_6_param; - main_1(); - main_out tint_symbol_1 = main_out(x_8); - return tint_symbol_1; -} - -void main() { - gl_PointSize = 1.0; - main_out inner_result = tint_symbol(x_1_param_1, x_2_param_1, x_3_param_1, x_4_param_1, x_5_param_1, x_6_param_1); - gl_Position = inner_result.x_8_1; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:3: '' : vertex input cannot be further qualified -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm deleted file mode 100644 index ea0075ea27..0000000000 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm +++ /dev/null @@ -1,61 +0,0 @@ -; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 35 -; Schema: 0 -OpCapability Shader -OpCapability SampleRateShading -OpMemoryModel Logical Simple -OpEntryPoint Fragment %7 "main" %1 %2 %3 %4 %5 %6 -OpExecutionMode %7 OriginUpperLeft -OpDecorate %1 Location 1 -OpDecorate %2 Location 2 -OpDecorate %3 Location 3 -OpDecorate %4 Location 4 -OpDecorate %5 Location 5 -OpDecorate %6 Location 6 -OpDecorate %2 Centroid -OpDecorate %3 Sample -OpDecorate %4 NoPerspective -OpDecorate %5 NoPerspective -OpDecorate %5 Centroid -OpDecorate %6 NoPerspective -OpDecorate %6 Sample -%void = OpTypeVoid -%9 = OpTypeFunction %void -%bool = OpTypeBool -%float = OpTypeFloat 32 -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%_ptr_Private_bool = OpTypePointer Private %bool -%_ptr_Private_float = OpTypePointer Private %float -%_ptr_Private_uint = OpTypePointer Private %uint -%_ptr_Private_int = OpTypePointer Private %int -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%float_0 = OpConstant %float 0 -%float_1_5 = OpConstant %float 1.5 -%uint_1 = OpConstant %uint 1 -%int_n1 = OpConstant %int -1 -%int_14 = OpConstant %int 14 -%uint_2 = OpConstant %uint 2 -%v2bool = OpTypeVector %bool 2 -%v2uint = OpTypeVector %uint 2 -%v2int = OpTypeVector %int 2 -%v2float = OpTypeVector %float 2 -%v4float = OpTypeVector %float 4 -%mat3v2float = OpTypeMatrix %v2float 3 -%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 -%_ptr_Output_float = OpTypePointer Output %float -%1 = OpVariable %_ptr_Output_float Output -%2 = OpVariable %_ptr_Output_float Output -%3 = OpVariable %_ptr_Output_float Output -%4 = OpVariable %_ptr_Output_float Output -%5 = OpVariable %_ptr_Output_float Output -%6 = OpVariable %_ptr_Output_float Output -%7 = OpFunction %void None %9 -%34 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.dxc.hlsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.fxc.hlsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.glsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.glsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.glsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.msl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.msl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.msl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.spvasm new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.spvasm @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.wgsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.wgsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration.spvasm.expected.wgsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.dxc.hlsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.fxc.hlsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.glsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.glsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.glsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.msl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.msl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.msl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.spvasm new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.spvasm @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.wgsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.wgsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.wgsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.dxc.hlsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.fxc.hlsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.glsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.glsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.glsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.msl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.msl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.msl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.spvasm new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.spvasm @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.wgsl b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.wgsl new file mode 100644 index 0000000000..87314ad325 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Natural_Dropped.spvasm.expected.wgsl @@ -0,0 +1,7 @@ +SKIP: FAILED + + + +error: line:16: Structure id 3 decorated as Block must be explicitly laid out with RowMajor or ColMajor decorations. + %_struct_3 = OpTypeStruct %mat3v2float + diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm index 03b178d0d9..aeffafc9b9 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm @@ -10,6 +10,7 @@ OpMemoryModel Logical Simple OpEntryPoint Fragment %3 "main" %gl_SampleID OpExecutionMode %3 OriginUpperLeft OpDecorate %gl_SampleID BuiltIn SampleId +OpDecorate %gl_SampleID Flat %void = OpTypeVoid %5 = OpTypeFunction %void %float = OpTypeFloat 32 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm index 8f5673217d..9b525041c2 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm @@ -10,6 +10,7 @@ OpMemoryModel Logical Simple OpEntryPoint Fragment %3 "main" %gl_SampleID OpExecutionMode %3 OriginUpperLeft OpDecorate %gl_SampleID BuiltIn SampleId +OpDecorate %gl_SampleID Flat %void = OpTypeVoid %5 = OpTypeFunction %void %float = OpTypeFloat 32 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm index e723d72c8b..8d91f35177 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm @@ -10,6 +10,7 @@ OpMemoryModel Logical Simple OpEntryPoint Fragment %3 "main" %gl_SampleID OpExecutionMode %3 OriginUpperLeft OpDecorate %gl_SampleID BuiltIn SampleId +OpDecorate %gl_SampleID Flat %void = OpTypeVoid %5 = OpTypeFunction %void %float = OpTypeFloat 32 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm index ccfb3d148b..a07ca7c6ab 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm @@ -10,6 +10,7 @@ OpMemoryModel Logical Simple OpEntryPoint Fragment %3 "main" %gl_SampleID OpExecutionMode %3 OriginUpperLeft OpDecorate %gl_SampleID BuiltIn SampleId +OpDecorate %gl_SampleID Flat %void = OpTypeVoid %5 = OpTypeFunction %void %float = OpTypeFloat 32 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm index 96f57aad67..a5c27244d3 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm @@ -10,6 +10,7 @@ OpMemoryModel Logical Simple OpEntryPoint Fragment %3 "main" %gl_SampleID OpExecutionMode %3 OriginUpperLeft OpDecorate %gl_SampleID BuiltIn SampleId +OpDecorate %gl_SampleID Flat %void = OpTypeVoid %5 = OpTypeFunction %void %float = OpTypeFloat 32 diff --git a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm index df672992b5..bec06e790a 100644 --- a/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm +++ b/test/tint/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm @@ -10,6 +10,7 @@ OpMemoryModel Logical Simple OpEntryPoint Fragment %3 "main" %gl_SampleID OpExecutionMode %3 OriginUpperLeft OpDecorate %gl_SampleID BuiltIn SampleId +OpDecorate %gl_SampleID Flat %void = OpTypeVoid %5 = OpTypeFunction %void %float = OpTypeFloat 32 diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm deleted file mode 100644 index 52f74d5b73..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm +++ /dev/null @@ -1,57 +0,0 @@ -; Test: SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 1000 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -OpName %var "var" -%void = OpTypeVoid -%3 = OpTypeFunction %void -%bool = OpTypeBool -%5 = OpConstantNull %bool -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%uint_42 = OpConstant %uint 42 -%int_42 = OpConstant %int 42 -%13 = OpTypeFunction %uint -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%uint_6 = OpConstant %uint 6 -%uint_7 = OpConstant %uint 7 -%uint_8 = OpConstant %uint 8 -%uint_10 = OpConstant %uint 10 -%uint_20 = OpConstant %uint 20 -%uint_30 = OpConstant %uint 30 -%uint_40 = OpConstant %uint 40 -%uint_50 = OpConstant %uint 50 -%uint_90 = OpConstant %uint 90 -%uint_99 = OpConstant %uint 99 -%_ptr_Private_uint = OpTypePointer Private %uint -%var = OpVariable %_ptr_Private_uint Private -%uint_999 = OpConstant %uint 999 -%100 = OpFunction %void None %3 -%10 = OpLabel -OpBranch %20 -%20 = OpLabel -OpLoopMerge %99 %20 None -OpBranch %30 -%30 = OpLabel -OpBranch %40 -%40 = OpLabel -OpBranch %50 -%50 = OpLabel -OpBranchConditional %5 %20 %99 -%99 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.hlsl deleted file mode 100644 index c186cf41f5..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -SKIP: FAILED - see https://github.com/microsoft/DirectXShaderCompiler/issues/4422 - -static uint var_1 = 0u; - -void main_1() { - [loop] while (true) { - if (false) { - } else { - break; - } - break; - } - return; -} - -void main() { - main_1(); - return; -} -Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..3e5c387979 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.dxc.hlsl @@ -0,0 +1,25 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + { + [loop] for(; !(false); ) { + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:11: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..46fd51b759 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.fxc.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + { + [loop] for(; !(false); ) { + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.hlsl deleted file mode 100644 index b44e02535a..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.hlsl +++ /dev/null @@ -1,24 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - { - [loop] for(; !(false); ) { - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_ePdsZG:11: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.hlsl deleted file mode 100644 index c186cf41f5..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -SKIP: FAILED - see https://github.com/microsoft/DirectXShaderCompiler/issues/4422 - -static uint var_1 = 0u; - -void main_1() { - [loop] while (true) { - if (false) { - } else { - break; - } - break; - } - return; -} - -void main() { - main_1(); - return; -} -Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..7c95459eec --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.dxc.hlsl @@ -0,0 +1,26 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + if (false) { + break; + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:12: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4731e63a84 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + if (false) { + break; + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.hlsl deleted file mode 100644 index edb22e4f02..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.hlsl +++ /dev/null @@ -1,25 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - [loop] while (true) { - if (false) { - break; - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_1aGHmE:12: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..43a15a6eda --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.dxc.hlsl @@ -0,0 +1,31 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + { + if (false) { + break; + } + } + } + var_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:17: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..413885f5c1 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.fxc.hlsl @@ -0,0 +1,22 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + { + if (false) { + break; + } + } + } + var_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.hlsl deleted file mode 100644 index 34e35796c2..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - var_1 = 0u; - [loop] while (true) { - var_1 = 1u; - { - if (false) { - break; - } - } - } - var_1 = 5u; - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_M0JS53:17: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..220555b5cf --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.dxc.hlsl @@ -0,0 +1,29 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + if (false) { + break; + } + } + var_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:15: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..945c429afa --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.fxc.hlsl @@ -0,0 +1,20 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + if (false) { + break; + } + } + var_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.hlsl deleted file mode 100644 index c7387bd746..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.hlsl +++ /dev/null @@ -1,28 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - var_1 = 0u; - [loop] while (true) { - var_1 = 1u; - if (false) { - break; - } - } - var_1 = 5u; - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_9dTIlS:15: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..2bc5a3bdfd --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.dxc.hlsl @@ -0,0 +1,41 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + if (true) { + var_1 = 2u; + if (false) { + break; + } else { + { + var_1 = 4u; + } + continue; + } + } + var_1 = 3u; + { + var_1 = 4u; + } + } + var_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:27: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b704fdcbb6 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.fxc.hlsl @@ -0,0 +1,32 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + if (true) { + var_1 = 2u; + if (false) { + break; + } else { + { + var_1 = 4u; + } + continue; + } + } + var_1 = 3u; + { + var_1 = 4u; + } + } + var_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.hlsl deleted file mode 100644 index 0aaad00383..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.hlsl +++ /dev/null @@ -1,40 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - var_1 = 0u; - [loop] while (true) { - var_1 = 1u; - if (true) { - var_1 = 2u; - if (false) { - break; - } else { - { - var_1 = 4u; - } - continue; - } - } - var_1 = 3u; - { - var_1 = 4u; - } - } - var_1 = 5u; - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_Rz6lq4:27: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..863d166d6b --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.dxc.hlsl @@ -0,0 +1,34 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + var_1 = 2u; + if (false) { + break; + } + var_1 = 3u; + { + var_1 = 4u; + } + } + var_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:20: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..9c2a726687 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.fxc.hlsl @@ -0,0 +1,25 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + var_1 = 2u; + if (false) { + break; + } + var_1 = 3u; + { + var_1 = 4u; + } + } + var_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.hlsl deleted file mode 100644 index bcca8625a6..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.hlsl +++ /dev/null @@ -1,33 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - var_1 = 0u; - [loop] while (true) { - var_1 = 1u; - var_1 = 2u; - if (false) { - break; - } - var_1 = 3u; - { - var_1 = 4u; - } - } - var_1 = 5u; - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_T39Xh2:20: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..7c95459eec --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.dxc.hlsl @@ -0,0 +1,26 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + if (false) { + break; + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:12: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4731e63a84 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + if (false) { + break; + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.hlsl deleted file mode 100644 index cb1311bd36..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.hlsl +++ /dev/null @@ -1,25 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - [loop] while (true) { - if (false) { - break; - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_lRzVSG:12: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..95860ed202 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.dxc.hlsl @@ -0,0 +1,30 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + var_1 = 1u; + if (false) { + break; + } + { + var_1 = 2u; + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:16: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..ccef7a4e94 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + var_1 = 1u; + if (false) { + break; + } + { + var_1 = 2u; + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.hlsl deleted file mode 100644 index 73f066c0d9..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.hlsl +++ /dev/null @@ -1,29 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - [loop] while (true) { - var_1 = 1u; - if (false) { - break; - } - { - var_1 = 2u; - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_KRVOs8:16: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..22dee7dc7c --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.dxc.hlsl @@ -0,0 +1,31 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + var_1 = 1u; + if (false) { + break; + } + var_1 = 3u; + { + var_1 = 2u; + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:17: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..75aaefc129 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.fxc.hlsl @@ -0,0 +1,22 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + var_1 = 1u; + if (false) { + break; + } + var_1 = 3u; + { + var_1 = 2u; + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.hlsl deleted file mode 100644 index a919464625..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.hlsl +++ /dev/null @@ -1,30 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - [loop] while (true) { - var_1 = 1u; - if (false) { - break; - } - var_1 = 3u; - { - var_1 = 2u; - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_tGC31y:17: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm deleted file mode 100644 index 36d7fd68d2..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm +++ /dev/null @@ -1,57 +0,0 @@ -; Test: SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 1000 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -OpName %var "var" -%void = OpTypeVoid -%3 = OpTypeFunction %void -%bool = OpTypeBool -%5 = OpConstantNull %bool -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%uint_42 = OpConstant %uint 42 -%int_42 = OpConstant %int 42 -%13 = OpTypeFunction %uint -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%uint_6 = OpConstant %uint 6 -%uint_7 = OpConstant %uint 7 -%uint_8 = OpConstant %uint 8 -%uint_10 = OpConstant %uint 10 -%uint_20 = OpConstant %uint 20 -%uint_30 = OpConstant %uint 30 -%uint_40 = OpConstant %uint 40 -%uint_50 = OpConstant %uint 50 -%uint_90 = OpConstant %uint 90 -%uint_99 = OpConstant %uint 99 -%_ptr_Private_uint = OpTypePointer Private %uint -%var = OpVariable %_ptr_Private_uint Private -%uint_999 = OpConstant %uint 999 -%100 = OpFunction %void None %3 -%10 = OpLabel -OpStore %var %uint_0 -OpBranch %20 -%20 = OpLabel -OpStore %var %uint_1 -OpLoopMerge %99 %20 None -OpBranch %80 -%80 = OpLabel -OpStore %var %uint_2 -OpBranchConditional %5 %99 %20 -%99 = OpLabel -OpStore %var %uint_3 -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl deleted file mode 100644 index 4ffe39dbd3..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl +++ /dev/null @@ -1,29 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - var_1 = 0u; - [loop] while (true) { - var_1 = 1u; - var_1 = 2u; - if (false) { - break; - } - } - var_1 = 3u; - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_cS4x46:16: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..6328e71b0d --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.dxc.hlsl @@ -0,0 +1,29 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + if (false) { + break; + } + } + var_1 = 999u; + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:15: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..b12844bc97 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.fxc.hlsl @@ -0,0 +1,20 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + var_1 = 0u; + [loop] while (true) { + var_1 = 1u; + if (false) { + break; + } + } + var_1 = 999u; + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.hlsl deleted file mode 100644 index ba462d695c..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.hlsl +++ /dev/null @@ -1,28 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - var_1 = 0u; - [loop] while (true) { - var_1 = 1u; - if (false) { - break; - } - } - var_1 = 999u; - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_Iz92Ch:15: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..7c95459eec --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.dxc.hlsl @@ -0,0 +1,26 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + if (false) { + break; + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:12: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4731e63a84 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.fxc.hlsl @@ -0,0 +1,17 @@ +SKIP: FAILED + +static uint var_1 = 0u; + +void main_1() { + [loop] while (true) { + if (false) { + break; + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.hlsl deleted file mode 100644 index b1324824fc..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.hlsl +++ /dev/null @@ -1,25 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - [loop] while (true) { - if (false) { - break; - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_ABIRu4:12: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm b/test/tint/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm deleted file mode 100644 index 762da210e7..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm +++ /dev/null @@ -1,57 +0,0 @@ -; Test: SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 1000 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -OpName %var "var" -%void = OpTypeVoid -%3 = OpTypeFunction %void -%bool = OpTypeBool -%5 = OpConstantNull %bool -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%uint_42 = OpConstant %uint 42 -%int_42 = OpConstant %int 42 -%13 = OpTypeFunction %uint -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%uint_6 = OpConstant %uint 6 -%uint_7 = OpConstant %uint 7 -%uint_8 = OpConstant %uint 8 -%uint_10 = OpConstant %uint 10 -%uint_20 = OpConstant %uint 20 -%uint_30 = OpConstant %uint 30 -%uint_40 = OpConstant %uint 40 -%uint_50 = OpConstant %uint 50 -%uint_90 = OpConstant %uint 90 -%uint_99 = OpConstant %uint 99 -%_ptr_Private_uint = OpTypePointer Private %uint -%var = OpVariable %_ptr_Private_uint Private -%uint_999 = OpConstant %uint 999 -%100 = OpFunction %void None %3 -%10 = OpLabel -OpBranch %20 -%20 = OpLabel -OpLoopMerge %99 %20 None -OpBranch %30 -%30 = OpLabel -OpBranch %40 -%40 = OpLabel -OpBranch %50 -%50 = OpLabel -OpBranchConditional %5 %20 %99 -%99 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm b/test/tint/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm deleted file mode 100644 index 00c32d6475..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm +++ /dev/null @@ -1,53 +0,0 @@ -; Test: SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 1000 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -OpName %var "var" -%void = OpTypeVoid -%3 = OpTypeFunction %void -%bool = OpTypeBool -%5 = OpConstantNull %bool -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%uint_42 = OpConstant %uint 42 -%int_42 = OpConstant %int 42 -%13 = OpTypeFunction %uint -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%uint_6 = OpConstant %uint 6 -%uint_7 = OpConstant %uint 7 -%uint_8 = OpConstant %uint 8 -%uint_10 = OpConstant %uint 10 -%uint_20 = OpConstant %uint 20 -%uint_30 = OpConstant %uint 30 -%uint_40 = OpConstant %uint 40 -%uint_50 = OpConstant %uint 50 -%uint_90 = OpConstant %uint 90 -%uint_99 = OpConstant %uint 99 -%_ptr_Private_uint = OpTypePointer Private %uint -%var = OpVariable %_ptr_Private_uint Private -%uint_999 = OpConstant %uint 999 -%100 = OpFunction %void None %3 -%10 = OpLabel -OpBranch %20 -%20 = OpLabel -OpLoopMerge %99 %20 None -OpBranch %30 -%30 = OpLabel -OpBranchConditional %5 %20 %99 -%99 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..ef003ab7de --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.dxc.hlsl @@ -0,0 +1,43 @@ +SKIP: FAILED + +static uint x_1 = 0u; + +void main_1() { + x_1 = 0u; + [loop] while (true) { + uint x_2 = 0u; + x_1 = 1u; + if (false) { + break; + } + x_1 = 3u; + if (true) { + x_2 = (1u + 1u); + } else { + return; + } + x_1 = x_2; + { + x_1 = 4u; + if (false) { + break; + } + } + } + x_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:29: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..2a99a69cca --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.fxc.hlsl @@ -0,0 +1,34 @@ +SKIP: FAILED + +static uint x_1 = 0u; + +void main_1() { + x_1 = 0u; + [loop] while (true) { + uint x_2 = 0u; + x_1 = 1u; + if (false) { + break; + } + x_1 = 3u; + if (true) { + x_2 = (1u + 1u); + } else { + return; + } + x_1 = x_2; + { + x_1 = 4u; + if (false) { + break; + } + } + } + x_1 = 5u; + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.hlsl deleted file mode 100644 index 4818f555ce..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.hlsl +++ /dev/null @@ -1,42 +0,0 @@ -SKIP: FAILED - -static uint x_1 = 0u; - -void main_1() { - x_1 = 0u; - [loop] while (true) { - uint x_2 = 0u; - x_1 = 1u; - if (false) { - break; - } - x_1 = 3u; - if (true) { - x_2 = (1u + 1u); - } else { - return; - } - x_1 = x_2; - { - x_1 = 4u; - if (false) { - break; - } - } - } - x_1 = 5u; - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_LpDCMy:29: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..cf6d23eece --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.dxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +static uint x_1 = 0u; +static bool x_7 = false; +static bool x_8 = false; + +void main_1() { + const bool x_101 = x_7; + const bool x_102 = x_8; + [loop] while (true) { + uint x_2_phi = 0u; + if (x_101) { + break; + } + if (x_102) { + x_2_phi = 0u; + { + x_1 = x_2_phi; + } + continue; + } else { + x_2_phi = 1u; + { + x_1 = x_2_phi; + } + continue; + } + { + x_1 = x_2_phi; + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:33: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..eddebbb939 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +static uint x_1 = 0u; +static bool x_7 = false; +static bool x_8 = false; + +void main_1() { + const bool x_101 = x_7; + const bool x_102 = x_8; + [loop] while (true) { + uint x_2_phi = 0u; + if (x_101) { + break; + } + if (x_102) { + x_2_phi = 0u; + { + x_1 = x_2_phi; + } + continue; + } else { + x_2_phi = 1u; + { + x_1 = x_2_phi; + } + continue; + } + { + x_1 = x_2_phi; + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.hlsl deleted file mode 100644 index ef00dd52d6..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.hlsl +++ /dev/null @@ -1,48 +0,0 @@ -SKIP: FAILED - -warning: code is unreachable -static uint x_1 = 0u; -static bool x_7 = false; -static bool x_8 = false; - -void main_1() { - const bool x_101 = x_7; - const bool x_102 = x_8; - [loop] while (true) { - uint x_2_phi = 0u; - if (x_101) { - break; - } - if (x_102) { - x_2_phi = 0u; - { - x_1 = x_2_phi; - } - continue; - } else { - x_2_phi = 1u; - { - x_1 = x_2_phi; - } - continue; - } - x_2_phi = 0u; - { - x_1 = x_2_phi; - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_l2mEof:34: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..42a507b317 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.dxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +static uint x_1 = 0u; +static bool x_7 = false; +static bool x_8 = false; + +void main_1() { + const bool x_101 = x_7; + const bool x_102 = x_8; + [loop] while (true) { + uint x_2_phi = 0u; + if (x_101) { + break; + } + x_2_phi = 0u; + if (x_102) { + x_2_phi = 1u; + { + x_1 = x_2_phi; + } + continue; + } else { + { + x_1 = x_2_phi; + } + continue; + } + { + x_1 = x_2_phi; + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:33: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..935c533e6b --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +static uint x_1 = 0u; +static bool x_7 = false; +static bool x_8 = false; + +void main_1() { + const bool x_101 = x_7; + const bool x_102 = x_8; + [loop] while (true) { + uint x_2_phi = 0u; + if (x_101) { + break; + } + x_2_phi = 0u; + if (x_102) { + x_2_phi = 1u; + { + x_1 = x_2_phi; + } + continue; + } else { + { + x_1 = x_2_phi; + } + continue; + } + { + x_1 = x_2_phi; + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.hlsl deleted file mode 100644 index 671644cac5..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.hlsl +++ /dev/null @@ -1,48 +0,0 @@ -SKIP: FAILED - -warning: code is unreachable -static uint x_1 = 0u; -static bool x_7 = false; -static bool x_8 = false; - -void main_1() { - const bool x_101 = x_7; - const bool x_102 = x_8; - [loop] while (true) { - uint x_2_phi = 0u; - if (x_101) { - break; - } - x_2_phi = 0u; - if (x_102) { - x_2_phi = 1u; - { - x_1 = x_2_phi; - } - continue; - } else { - { - x_1 = x_2_phi; - } - continue; - } - return; - { - x_1 = x_2_phi; - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_nu4hkX:34: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..e9d44ff28d --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.dxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +static uint x_1 = 0u; +static bool x_7 = false; +static bool x_8 = false; + +void main_1() { + [loop] while (true) { + uint x_2_phi = 0u; + uint x_3_phi = 0u; + const bool x_101 = x_7; + const bool x_102 = x_8; + x_2_phi = 0u; + x_3_phi = 1u; + if (x_101) { + break; + } + [loop] while (true) { + uint x_4 = 0u; + const uint x_2 = x_2_phi; + const uint x_3 = x_3_phi; + if (x_102) { + break; + } + { + x_4 = (x_2 + 1u); + x_2_phi = x_4; + x_3_phi = x_3; + } + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:33: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..f4a795c411 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.fxc.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +static uint x_1 = 0u; +static bool x_7 = false; +static bool x_8 = false; + +void main_1() { + [loop] while (true) { + uint x_2_phi = 0u; + uint x_3_phi = 0u; + const bool x_101 = x_7; + const bool x_102 = x_8; + x_2_phi = 0u; + x_3_phi = 1u; + if (x_101) { + break; + } + [loop] while (true) { + uint x_4 = 0u; + const uint x_2 = x_2_phi; + const uint x_3 = x_3_phi; + if (x_102) { + break; + } + { + x_4 = (x_2 + 1u); + x_2_phi = x_4; + x_3_phi = x_3; + } + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.hlsl deleted file mode 100644 index e80132cf35..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.hlsl +++ /dev/null @@ -1,46 +0,0 @@ -SKIP: FAILED - -static uint x_1 = 0u; -static bool x_7 = false; -static bool x_8 = false; - -void main_1() { - [loop] while (true) { - uint x_2_phi = 0u; - uint x_3_phi = 0u; - const bool x_101 = x_7; - const bool x_102 = x_8; - x_2_phi = 0u; - x_3_phi = 1u; - if (x_101) { - break; - } - [loop] while (true) { - uint x_4 = 0u; - const uint x_2 = x_2_phi; - const uint x_3 = x_3_phi; - if (x_102) { - break; - } - { - x_4 = (x_2 + 1u); - x_2_phi = x_4; - x_3_phi = x_3; - } - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_zJdet0:33: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.dxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.dxc.hlsl new file mode 100644 index 0000000000..c934a2de3a --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.dxc.hlsl @@ -0,0 +1,42 @@ +SKIP: FAILED + +static uint x_1 = 0u; +static bool x_7 = false; +static bool x_8 = false; + +void main_1() { + [loop] while (true) { + uint x_2_phi = 0u; + uint x_3_phi = 0u; + const bool x_101 = x_7; + const bool x_102 = x_8; + x_2_phi = 0u; + x_3_phi = 1u; + if (x_101) { + break; + } + [loop] while (true) { + const uint x_3 = x_3_phi; + x_2_phi = (x_2_phi + 1u); + x_3_phi = x_3; + if (x_102) { + break; + } + } + } + return; +} + +void main() { + main_1(); + return; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:28: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.fxc.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..f1cdbbfc89 --- /dev/null +++ b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.fxc.hlsl @@ -0,0 +1,33 @@ +SKIP: FAILED + +static uint x_1 = 0u; +static bool x_7 = false; +static bool x_8 = false; + +void main_1() { + [loop] while (true) { + uint x_2_phi = 0u; + uint x_3_phi = 0u; + const bool x_101 = x_7; + const bool x_102 = x_8; + x_2_phi = 0u; + x_3_phi = 1u; + if (x_101) { + break; + } + [loop] while (true) { + const uint x_3 = x_3_phi; + x_2_phi = (x_2_phi + 1u); + x_3_phi = x_3; + if (x_102) { + break; + } + } + } + return; +} + +void main() { + main_1(); + return; +} diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.hlsl deleted file mode 100644 index 277b39f48f..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.hlsl +++ /dev/null @@ -1,41 +0,0 @@ -SKIP: FAILED - -static uint x_1 = 0u; -static bool x_7 = false; -static bool x_8 = false; - -void main_1() { - [loop] while (true) { - uint x_2_phi = 0u; - uint x_3_phi = 0u; - const bool x_101 = x_7; - const bool x_102 = x_8; - x_2_phi = 0u; - x_3_phi = 1u; - if (x_101) { - break; - } - [loop] while (true) { - const uint x_3 = x_3_phi; - x_2_phi = (x_2_phi + 1u); - x_3_phi = x_3; - if (x_102) { - break; - } - } - } - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_XDVFVA:28: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm deleted file mode 100644 index 300c05a9a4..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm +++ /dev/null @@ -1,63 +0,0 @@ -; Test: SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 501 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -%void = OpTypeVoid -%2 = OpTypeFunction %void -%bool = OpTypeBool -%float = OpTypeFloat 32 -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%_ptr_Function_bool = OpTypePointer Function %bool -%_ptr_Function_float = OpTypePointer Function %float -%_ptr_Function_uint = OpTypePointer Function %uint -%_ptr_Function_int = OpTypePointer Function %int -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%float_0 = OpConstant %float 0 -%float_1_5 = OpConstant %float 1.5 -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%int_n1 = OpConstant %int -1 -%int_0 = OpConstant %int 0 -%int_1 = OpConstant %int 1 -%int_3 = OpConstant %int 3 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%v2int = OpTypeVector %int 2 -%v2float = OpTypeVector %float 2 -%mat3v2float = OpTypeMatrix %v2float 3 -%32 = OpConstantNull %v2int -%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 -%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2 -%float_42 = OpConstant %float 42 -%36 = OpUndef %bool -%100 = OpFunction %void None %2 -%10 = OpLabel -OpBranch %30 -%20 = OpLabel -%499 = OpFAdd %float %float_42 %float_42 -%500 = OpFAdd %float %499 %float_42 -OpBranch %25 -%25 = OpLabel -OpBranch %80 -%30 = OpLabel -OpLoopMerge %90 %80 None -OpBranchConditional %36 %90 %40 -%40 = OpLabel -OpBranch %90 -%80 = OpLabel -%81 = OpPhi %float %500 %25 -OpBranch %30 -%90 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm b/test/tint/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm deleted file mode 100644 index 89d5db4e0a..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm +++ /dev/null @@ -1,43 +0,0 @@ -; Test: SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 501 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -%void = OpTypeVoid -%2 = OpTypeFunction %void -%bool = OpTypeBool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%float = OpTypeFloat 32 -%v2bool = OpTypeVector %bool 2 -%v2uint = OpTypeVector %uint 2 -%v2int = OpTypeVector %int 2 -%v2float = OpTypeVector %float 2 -%float_42 = OpConstant %float 42 -%13 = OpUndef %bool -%100 = OpFunction %void None %2 -%10 = OpLabel -OpBranch %30 -%20 = OpLabel -%499 = OpFAdd %float %float_42 %float_42 -%500 = OpFAdd %float %499 %float_42 -OpBranch %25 -%25 = OpLabel -OpBranch %80 -%30 = OpLabel -OpLoopMerge %90 %80 None -OpBranchConditional %13 %90 %40 -%40 = OpLabel -OpBranch %90 -%80 = OpLabel -%81 = OpFMul %float %500 %float_42 -OpBranch %30 -%90 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.hlsl deleted file mode 100644 index bdd1aec27a..0000000000 --- a/test/tint/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.hlsl +++ /dev/null @@ -1,25 +0,0 @@ -SKIP: FAILED - see https://github.com/microsoft/DirectXShaderCompiler/issues/4422 - -void main_1() { - [loop] while (true) { - float x_600 = 0.0f; - if (true) { - break; - } - if (true) { - x_600 = 50.0f; - } - break; - { - const uint x_82 = uint(x_600); - } - } - return; -} - -void main() { - main_1(); - return; -} -Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 - diff --git a/test/tint/var/inferred/function.wgsl b/test/tint/var/inferred/function.wgsl index fe9f6fd31f..a955cded1c 100644 --- a/test/tint/var/inferred/function.wgsl +++ b/test/tint/var/inferred/function.wgsl @@ -33,7 +33,7 @@ fn var_decls() { var v15 = ret_MyArray(); } -@stage(fragment) +@fragment fn main() -> @location(0) vec4 { return vec4(0.0,0.0,0.0,0.0); } diff --git a/test/tint/var/inferred/function.wgsl.expected.dxc.hlsl b/test/tint/var/inferred/function.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a0070ce371 --- /dev/null +++ b/test/tint/var/inferred/function.wgsl.expected.dxc.hlsl @@ -0,0 +1,59 @@ +struct MyStruct { + float f1; +}; + +int ret_i32() { + return 1; +} + +uint ret_u32() { + return 1u; +} + +float ret_f32() { + return 1.0f; +} + +MyStruct ret_MyStruct() { + const MyStruct tint_symbol_1 = (MyStruct)0; + return tint_symbol_1; +} + +typedef float ret_MyArray_ret[10]; +ret_MyArray_ret ret_MyArray() { + const float tint_symbol_2[10] = (float[10])0; + return tint_symbol_2; +} + +void var_decls() { + int v1 = 1; + uint v2 = 1u; + float v3 = 1.0f; + int3 v4 = (1).xxx; + uint3 v5 = (1u).xxx; + float3 v6 = (1.0f).xxx; + float3x3 v7 = float3x3(v6, v6, v6); + MyStruct v8 = {1.0f}; + float v9[10] = (float[10])0; + int v10 = ret_i32(); + uint v11 = ret_u32(); + float v12 = ret_f32(); + MyStruct v13 = ret_MyStruct(); + MyStruct v14 = ret_MyStruct(); + float v15[10] = ret_MyArray(); +} + +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/var/inferred/function.wgsl.expected.fxc.hlsl b/test/tint/var/inferred/function.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a0070ce371 --- /dev/null +++ b/test/tint/var/inferred/function.wgsl.expected.fxc.hlsl @@ -0,0 +1,59 @@ +struct MyStruct { + float f1; +}; + +int ret_i32() { + return 1; +} + +uint ret_u32() { + return 1u; +} + +float ret_f32() { + return 1.0f; +} + +MyStruct ret_MyStruct() { + const MyStruct tint_symbol_1 = (MyStruct)0; + return tint_symbol_1; +} + +typedef float ret_MyArray_ret[10]; +ret_MyArray_ret ret_MyArray() { + const float tint_symbol_2[10] = (float[10])0; + return tint_symbol_2; +} + +void var_decls() { + int v1 = 1; + uint v2 = 1u; + float v3 = 1.0f; + int3 v4 = (1).xxx; + uint3 v5 = (1u).xxx; + float3 v6 = (1.0f).xxx; + float3x3 v7 = float3x3(v6, v6, v6); + MyStruct v8 = {1.0f}; + float v9[10] = (float[10])0; + int v10 = ret_i32(); + uint v11 = ret_u32(); + float v12 = ret_f32(); + MyStruct v13 = ret_MyStruct(); + MyStruct v14 = ret_MyStruct(); + float v15[10] = ret_MyArray(); +} + +struct tint_symbol { + float4 value : SV_Target0; +}; + +float4 main_inner() { + return (0.0f).xxxx; +} + +tint_symbol main() { + const float4 inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} diff --git a/test/tint/var/inferred/function.wgsl.expected.glsl b/test/tint/var/inferred/function.wgsl.expected.glsl index 797dbaf28f..b3504567a6 100644 --- a/test/tint/var/inferred/function.wgsl.expected.glsl +++ b/test/tint/var/inferred/function.wgsl.expected.glsl @@ -7,7 +7,7 @@ struct MyStruct { }; vec4 tint_symbol() { - return vec4(0.0f, 0.0f, 0.0f, 0.0f); + return vec4(0.0f); } void main() { diff --git a/test/tint/var/inferred/function.wgsl.expected.hlsl b/test/tint/var/inferred/function.wgsl.expected.hlsl deleted file mode 100644 index d638243ffd..0000000000 --- a/test/tint/var/inferred/function.wgsl.expected.hlsl +++ /dev/null @@ -1,59 +0,0 @@ -struct MyStruct { - float f1; -}; - -int ret_i32() { - return 1; -} - -uint ret_u32() { - return 1u; -} - -float ret_f32() { - return 1.0f; -} - -MyStruct ret_MyStruct() { - const MyStruct tint_symbol_1 = (MyStruct)0; - return tint_symbol_1; -} - -typedef float ret_MyArray_ret[10]; -ret_MyArray_ret ret_MyArray() { - const float tint_symbol_2[10] = (float[10])0; - return tint_symbol_2; -} - -void var_decls() { - int v1 = 1; - uint v2 = 1u; - float v3 = 1.0f; - int3 v4 = int3(1, 1, 1); - uint3 v5 = uint3(1u, 1u, 1u); - float3 v6 = float3(1.0f, 1.0f, 1.0f); - float3x3 v7 = float3x3(v6, v6, v6); - MyStruct v8 = {1.0f}; - float v9[10] = (float[10])0; - int v10 = ret_i32(); - uint v11 = ret_u32(); - float v12 = ret_f32(); - MyStruct v13 = ret_MyStruct(); - MyStruct v14 = ret_MyStruct(); - float v15[10] = ret_MyArray(); -} - -struct tint_symbol { - float4 value : SV_Target0; -}; - -float4 main_inner() { - return float4(0.0f, 0.0f, 0.0f, 0.0f); -} - -tint_symbol main() { - const float4 inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.value = inner_result; - return wrapper_result; -} diff --git a/test/tint/var/inferred/function.wgsl.expected.msl b/test/tint/var/inferred/function.wgsl.expected.msl index ac84088451..1e2e86035d 100644 --- a/test/tint/var/inferred/function.wgsl.expected.msl +++ b/test/tint/var/inferred/function.wgsl.expected.msl @@ -1,12 +1,21 @@ #include using namespace metal; -struct MyStruct { - float f1; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; }; -struct tint_array_wrapper { - float arr[10]; +struct MyStruct { + float f1; }; int ret_i32() { @@ -22,12 +31,12 @@ float ret_f32() { } MyStruct ret_MyStruct() { - MyStruct const tint_symbol_2 = {}; + MyStruct const tint_symbol_2 = MyStruct{}; return tint_symbol_2; } -tint_array_wrapper ret_MyArray() { - tint_array_wrapper const tint_symbol_3 = {.arr={}}; +tint_array ret_MyArray() { + tint_array const tint_symbol_3 = tint_array{}; return tint_symbol_3; } @@ -35,18 +44,18 @@ void var_decls() { int v1 = 1; uint v2 = 1u; float v3 = 1.0f; - int3 v4 = int3(1, 1, 1); - uint3 v5 = uint3(1u, 1u, 1u); - float3 v6 = float3(1.0f, 1.0f, 1.0f); + int3 v4 = int3(1); + uint3 v5 = uint3(1u); + float3 v6 = float3(1.0f); float3x3 v7 = float3x3(v6, v6, v6); - MyStruct v8 = {.f1=1.0f}; - tint_array_wrapper v9 = {.arr={}}; + MyStruct v8 = MyStruct{.f1=1.0f}; + tint_array v9 = tint_array{}; int v10 = ret_i32(); uint v11 = ret_u32(); float v12 = ret_f32(); MyStruct v13 = ret_MyStruct(); MyStruct v14 = ret_MyStruct(); - tint_array_wrapper v15 = ret_MyArray(); + tint_array v15 = ret_MyArray(); } struct tint_symbol_1 { @@ -54,7 +63,7 @@ struct tint_symbol_1 { }; float4 tint_symbol_inner() { - return float4(0.0f, 0.0f, 0.0f, 0.0f); + return float4(0.0f); } fragment tint_symbol_1 tint_symbol() { diff --git a/test/tint/var/inferred/function.wgsl.expected.spvasm b/test/tint/var/inferred/function.wgsl.expected.spvasm index 541efd336a..4d2c421b6f 100644 --- a/test/tint/var/inferred/function.wgsl.expected.spvasm +++ b/test/tint/var/inferred/function.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 92 +; Bound: 90 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -83,8 +83,6 @@ %_ptr_Function_MyStruct = OpTypePointer Function %MyStruct %_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 %84 = OpTypeFunction %v4float - %float_0 = OpConstant %float 0 - %88 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 %ret_i32 = OpFunction %int None %6 %9 = OpLabel OpReturnValue %int_1 @@ -151,11 +149,11 @@ OpFunctionEnd %main_inner = OpFunction %v4float None %84 %86 = OpLabel - OpReturnValue %88 + OpReturnValue %5 OpFunctionEnd %main = OpFunction %void None %31 - %90 = OpLabel - %91 = OpFunctionCall %v4float %main_inner - OpStore %value %91 + %88 = OpLabel + %89 = OpFunctionCall %v4float %main_inner + OpStore %value %89 OpReturn OpFunctionEnd diff --git a/test/tint/var/inferred/function.wgsl.expected.wgsl b/test/tint/var/inferred/function.wgsl.expected.wgsl index ce5434786f..7abf40a195 100644 --- a/test/tint/var/inferred/function.wgsl.expected.wgsl +++ b/test/tint/var/inferred/function.wgsl.expected.wgsl @@ -42,7 +42,7 @@ fn var_decls() { var v15 = ret_MyArray(); } -@stage(fragment) +@fragment fn main() -> @location(0) vec4 { return vec4(0.0, 0.0, 0.0, 0.0); } diff --git a/test/tint/var/inferred/global.wgsl b/test/tint/var/inferred/global.wgsl new file mode 100644 index 0000000000..7ddb3e0ac5 --- /dev/null +++ b/test/tint/var/inferred/global.wgsl @@ -0,0 +1,46 @@ +struct MyStruct { + f1 : f32, +}; + +type MyArray = array; + +var v1 = 1; +var v2 = 1u; +var v3 = 1.0; + +var v4 = vec3(1, 1, 1); +var v5 = vec3(1u, 2u, 3u); +var v6 = vec3(1.0, 2.0, 3.0); + +var v7 = MyStruct(1.0); +var v8 = MyArray(); + +var v9 = i32(); +var v10 = u32(); +var v11 = f32(); +var v12 = MyStruct(); +var v13 = MyStruct(); +var v14 = MyArray(); + +var v15 = vec3(1, 2, 3); +var v16 = vec3(1.0, 2.0, 3.0); + +@compute @workgroup_size(1) +fn f() { + let l1 = v1; + let l2 = v2; + let l3 = v3; + let l4 = v4; + let l5 = v5; + let l6 = v6; + let l7 = v7; + let l8 = v8; + let l9 = v9; + let l10 = v10; + let l11 = v11; + let l12 = v12; + let l13 = v13; + let l14 = v14; + let l15 = v15; + let l16 = v16; +} diff --git a/test/tint/var/inferred/global.wgsl.expected.dxc.hlsl b/test/tint/var/inferred/global.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..09a7a21949 --- /dev/null +++ b/test/tint/var/inferred/global.wgsl.expected.dxc.hlsl @@ -0,0 +1,41 @@ +struct MyStruct { + float f1; +}; + +static int v1 = 1; +static uint v2 = 1u; +static float v3 = 1.0f; +static int3 v4 = (1).xxx; +static uint3 v5 = uint3(1u, 2u, 3u); +static float3 v6 = float3(1.0f, 2.0f, 3.0f); +static MyStruct v7 = {1.0f}; +static float v8[10] = (float[10])0; +static int v9 = 0; +static uint v10 = 0u; +static float v11 = 0.0f; +static MyStruct v12 = (MyStruct)0; +static MyStruct v13 = (MyStruct)0; +static float v14[10] = (float[10])0; +static int3 v15 = int3(1, 2, 3); +static float3 v16 = float3(1.0f, 2.0f, 3.0f); + +[numthreads(1, 1, 1)] +void f() { + const int l1 = v1; + const uint l2 = v2; + const float l3 = v3; + const int3 l4 = v4; + const uint3 l5 = v5; + const float3 l6 = v6; + const MyStruct l7 = v7; + const float l8[10] = v8; + const int l9 = v9; + const uint l10 = v10; + const float l11 = v11; + const MyStruct l12 = v12; + const MyStruct l13 = v13; + const float l14[10] = v14; + const int3 l15 = v15; + const float3 l16 = v16; + return; +} diff --git a/test/tint/var/inferred/global.wgsl.expected.fxc.hlsl b/test/tint/var/inferred/global.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..09a7a21949 --- /dev/null +++ b/test/tint/var/inferred/global.wgsl.expected.fxc.hlsl @@ -0,0 +1,41 @@ +struct MyStruct { + float f1; +}; + +static int v1 = 1; +static uint v2 = 1u; +static float v3 = 1.0f; +static int3 v4 = (1).xxx; +static uint3 v5 = uint3(1u, 2u, 3u); +static float3 v6 = float3(1.0f, 2.0f, 3.0f); +static MyStruct v7 = {1.0f}; +static float v8[10] = (float[10])0; +static int v9 = 0; +static uint v10 = 0u; +static float v11 = 0.0f; +static MyStruct v12 = (MyStruct)0; +static MyStruct v13 = (MyStruct)0; +static float v14[10] = (float[10])0; +static int3 v15 = int3(1, 2, 3); +static float3 v16 = float3(1.0f, 2.0f, 3.0f); + +[numthreads(1, 1, 1)] +void f() { + const int l1 = v1; + const uint l2 = v2; + const float l3 = v3; + const int3 l4 = v4; + const uint3 l5 = v5; + const float3 l6 = v6; + const MyStruct l7 = v7; + const float l8[10] = v8; + const int l9 = v9; + const uint l10 = v10; + const float l11 = v11; + const MyStruct l12 = v12; + const MyStruct l13 = v13; + const float l14[10] = v14; + const int3 l15 = v15; + const float3 l16 = v16; + return; +} diff --git a/test/tint/var/inferred/global.wgsl.expected.glsl b/test/tint/var/inferred/global.wgsl.expected.glsl new file mode 100644 index 0000000000..0c7fe37e47 --- /dev/null +++ b/test/tint/var/inferred/global.wgsl.expected.glsl @@ -0,0 +1,46 @@ +#version 310 es + +struct MyStruct { + float f1; +}; + +int v1 = 1; +uint v2 = 1u; +float v3 = 1.0f; +ivec3 v4 = ivec3(1); +uvec3 v5 = uvec3(1u, 2u, 3u); +vec3 v6 = vec3(1.0f, 2.0f, 3.0f); +MyStruct v7 = MyStruct(1.0f); +float v8[10] = float[10](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); +int v9 = 0; +uint v10 = 0u; +float v11 = 0.0f; +MyStruct v12 = MyStruct(0.0f); +MyStruct v13 = MyStruct(0.0f); +float v14[10] = float[10](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); +ivec3 v15 = ivec3(1, 2, 3); +vec3 v16 = vec3(1.0f, 2.0f, 3.0f); +void f() { + int l1 = v1; + uint l2 = v2; + float l3 = v3; + ivec3 l4 = v4; + uvec3 l5 = v5; + vec3 l6 = v6; + MyStruct l7 = v7; + float l8[10] = v8; + int l9 = v9; + uint l10 = v10; + float l11 = v11; + MyStruct l12 = v12; + MyStruct l13 = v13; + float l14[10] = v14; + ivec3 l15 = v15; + vec3 l16 = v16; +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + f(); + return; +} diff --git a/test/tint/var/inferred/global.wgsl.expected.msl b/test/tint/var/inferred/global.wgsl.expected.msl new file mode 100644 index 0000000000..7213119cb5 --- /dev/null +++ b/test/tint/var/inferred/global.wgsl.expected.msl @@ -0,0 +1,56 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +struct MyStruct { + float f1; +}; + +kernel void f() { + thread int tint_symbol = 1; + thread uint tint_symbol_1 = 1u; + thread float tint_symbol_2 = 1.0f; + thread int3 tint_symbol_3 = int3(1); + thread uint3 tint_symbol_4 = uint3(1u, 2u, 3u); + thread float3 tint_symbol_5 = float3(1.0f, 2.0f, 3.0f); + thread MyStruct tint_symbol_6 = MyStruct{.f1=1.0f}; + thread tint_array tint_symbol_7 = tint_array{}; + thread int tint_symbol_8 = 0; + thread uint tint_symbol_9 = 0u; + thread float tint_symbol_10 = 0.0f; + thread MyStruct tint_symbol_11 = MyStruct{}; + thread MyStruct tint_symbol_12 = MyStruct{}; + thread tint_array tint_symbol_13 = tint_array{}; + thread int3 tint_symbol_14 = int3(1, 2, 3); + thread float3 tint_symbol_15 = float3(1.0f, 2.0f, 3.0f); + int const l1 = tint_symbol; + uint const l2 = tint_symbol_1; + float const l3 = tint_symbol_2; + int3 const l4 = tint_symbol_3; + uint3 const l5 = tint_symbol_4; + float3 const l6 = tint_symbol_5; + MyStruct const l7 = tint_symbol_6; + tint_array const l8 = tint_symbol_7; + int const l9 = tint_symbol_8; + uint const l10 = tint_symbol_9; + float const l11 = tint_symbol_10; + MyStruct const l12 = tint_symbol_11; + MyStruct const l13 = tint_symbol_12; + tint_array const l14 = tint_symbol_13; + int3 const l15 = tint_symbol_14; + float3 const l16 = tint_symbol_15; + return; +} + diff --git a/test/tint/var/inferred/global.wgsl.expected.spvasm b/test/tint/var/inferred/global.wgsl.expected.spvasm new file mode 100644 index 0000000000..e4bae60b2e --- /dev/null +++ b/test/tint/var/inferred/global.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %f "f" + OpExecutionMode %f LocalSize 1 1 1 + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + OpName %v5 "v5" + OpName %v6 "v6" + OpName %MyStruct "MyStruct" + OpMemberName %MyStruct 0 "f1" + OpName %v7 "v7" + OpName %v8 "v8" + OpName %v9 "v9" + OpName %v10 "v10" + OpName %v11 "v11" + OpName %v12 "v12" + OpName %v13 "v13" + OpName %v14 "v14" + OpName %v15 "v15" + OpName %v16 "v16" + OpName %f "f" + OpMemberDecorate %MyStruct 0 Offset 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Private_int = OpTypePointer Private %int + %v1 = OpVariable %_ptr_Private_int Private %int_1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_uint = OpTypePointer Private %uint + %v2 = OpVariable %_ptr_Private_uint Private %uint_1 + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %v3 = OpVariable %_ptr_Private_float Private %float_1 + %v3int = OpTypeVector %int 3 + %14 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %v4 = OpVariable %_ptr_Private_v3int Private %14 + %v3uint = OpTypeVector %uint 3 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %20 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %v5 = OpVariable %_ptr_Private_v3uint Private %20 + %v3float = OpTypeVector %float 3 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %26 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %v6 = OpVariable %_ptr_Private_v3float Private %26 + %MyStruct = OpTypeStruct %float + %30 = OpConstantComposite %MyStruct %float_1 +%_ptr_Private_MyStruct = OpTypePointer Private %MyStruct + %v7 = OpVariable %_ptr_Private_MyStruct Private %30 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 + %35 = OpConstantNull %_arr_float_uint_10 +%_ptr_Private__arr_float_uint_10 = OpTypePointer Private %_arr_float_uint_10 + %v8 = OpVariable %_ptr_Private__arr_float_uint_10 Private %35 + %38 = OpConstantNull %int + %v9 = OpVariable %_ptr_Private_int Private %38 + %40 = OpConstantNull %uint + %v10 = OpVariable %_ptr_Private_uint Private %40 + %42 = OpConstantNull %float + %v11 = OpVariable %_ptr_Private_float Private %42 + %44 = OpConstantNull %MyStruct + %v12 = OpVariable %_ptr_Private_MyStruct Private %44 + %v13 = OpVariable %_ptr_Private_MyStruct Private %44 + %v14 = OpVariable %_ptr_Private__arr_float_uint_10 Private %35 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %50 = OpConstantComposite %v3int %int_1 %int_2 %int_3 + %v15 = OpVariable %_ptr_Private_v3int Private %50 + %v16 = OpVariable %_ptr_Private_v3float Private %26 + %void = OpTypeVoid + %53 = OpTypeFunction %void + %f = OpFunction %void None %53 + %56 = OpLabel + %57 = OpLoad %int %v1 + %58 = OpLoad %uint %v2 + %59 = OpLoad %float %v3 + %60 = OpLoad %v3int %v4 + %61 = OpLoad %v3uint %v5 + %62 = OpLoad %v3float %v6 + %63 = OpLoad %MyStruct %v7 + %64 = OpLoad %_arr_float_uint_10 %v8 + %65 = OpLoad %int %v9 + %66 = OpLoad %uint %v10 + %67 = OpLoad %float %v11 + %68 = OpLoad %MyStruct %v12 + %69 = OpLoad %MyStruct %v13 + %70 = OpLoad %_arr_float_uint_10 %v14 + %71 = OpLoad %v3int %v15 + %72 = OpLoad %v3float %v16 + OpReturn + OpFunctionEnd diff --git a/test/tint/var/inferred/global.wgsl.expected.wgsl b/test/tint/var/inferred/global.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc7132fa3c --- /dev/null +++ b/test/tint/var/inferred/global.wgsl.expected.wgsl @@ -0,0 +1,57 @@ +struct MyStruct { + f1 : f32, +} + +type MyArray = array; + +var v1 = 1; + +var v2 = 1u; + +var v3 = 1.0; + +var v4 = vec3(1, 1, 1); + +var v5 = vec3(1u, 2u, 3u); + +var v6 = vec3(1.0, 2.0, 3.0); + +var v7 = MyStruct(1.0); + +var v8 = MyArray(); + +var v9 = i32(); + +var v10 = u32(); + +var v11 = f32(); + +var v12 = MyStruct(); + +var v13 = MyStruct(); + +var v14 = MyArray(); + +var v15 = vec3(1, 2, 3); + +var v16 = vec3(1.0, 2.0, 3.0); + +@compute @workgroup_size(1) +fn f() { + let l1 = v1; + let l2 = v2; + let l3 = v3; + let l4 = v4; + let l5 = v5; + let l6 = v6; + let l7 = v7; + let l8 = v8; + let l9 = v9; + let l10 = v10; + let l11 = v11; + let l12 = v12; + let l13 = v13; + let l14 = v14; + let l15 = v15; + let l16 = v16; +} diff --git a/test/tint/var/initialization/function/array.wgsl b/test/tint/var/initialization/function/array.wgsl deleted file mode 100644 index c261a3a598..0000000000 --- a/test/tint/var/initialization/function/array.wgsl +++ /dev/null @@ -1,5 +0,0 @@ -@stage(compute) @workgroup_size(1) -fn main() { - var v : array; - _ = v; -} diff --git a/test/tint/var/initialization/function/array.wgsl.expected.glsl b/test/tint/var/initialization/function/array.wgsl.expected.glsl deleted file mode 100644 index 645b82c2d5..0000000000 --- a/test/tint/var/initialization/function/array.wgsl.expected.glsl +++ /dev/null @@ -1,11 +0,0 @@ -#version 310 es - -void tint_symbol() { - int v[3] = int[3](0, 0, 0); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - tint_symbol(); - return; -} diff --git a/test/tint/var/initialization/function/array.wgsl.expected.hlsl b/test/tint/var/initialization/function/array.wgsl.expected.hlsl deleted file mode 100644 index 7f979a02ed..0000000000 --- a/test/tint/var/initialization/function/array.wgsl.expected.hlsl +++ /dev/null @@ -1,5 +0,0 @@ -[numthreads(1, 1, 1)] -void main() { - int v[3] = (int[3])0; - return; -} diff --git a/test/tint/var/initialization/function/array.wgsl.expected.msl b/test/tint/var/initialization/function/array.wgsl.expected.msl deleted file mode 100644 index f4411848c5..0000000000 --- a/test/tint/var/initialization/function/array.wgsl.expected.msl +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace metal; -struct tint_array_wrapper { - int arr[3]; -}; - -kernel void tint_symbol() { - tint_array_wrapper v = {}; - return; -} - diff --git a/test/tint/var/initialization/function/array.wgsl.expected.spvasm b/test/tint/var/initialization/function/array.wgsl.expected.spvasm deleted file mode 100644 index 2112361c0e..0000000000 --- a/test/tint/var/initialization/function/array.wgsl.expected.spvasm +++ /dev/null @@ -1,25 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 12 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpName %main "main" - OpName %v "v" - OpDecorate %_arr_int_uint_3 ArrayStride 4 - %void = OpTypeVoid - %1 = OpTypeFunction %void - %int = OpTypeInt 32 1 - %uint = OpTypeInt 32 0 - %uint_3 = OpConstant %uint 3 -%_arr_int_uint_3 = OpTypeArray %int %uint_3 -%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 - %11 = OpConstantNull %_arr_int_uint_3 - %main = OpFunction %void None %1 - %4 = OpLabel - %v = OpVariable %_ptr_Function__arr_int_uint_3 Function %11 - OpReturn - OpFunctionEnd diff --git a/test/tint/var/initialization/function/array.wgsl.expected.wgsl b/test/tint/var/initialization/function/array.wgsl.expected.wgsl deleted file mode 100644 index 8ff70f285c..0000000000 --- a/test/tint/var/initialization/function/array.wgsl.expected.wgsl +++ /dev/null @@ -1,5 +0,0 @@ -@stage(compute) @workgroup_size(1) -fn main() { - var v : array; - _ = v; -} diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl b/test/tint/var/initialization/function/array/array_i32.wgsl new file mode 100644 index 0000000000..80db6135e3 --- /dev/null +++ b/test/tint/var/initialization/function/array/array_i32.wgsl @@ -0,0 +1,5 @@ +@compute @workgroup_size(1) +fn main() { + var zero : array, 2>; + var init : array, 2> = array, 2>(array(1, 2, 3), array(4, 5, 6)); +} diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..88d2dd3adc --- /dev/null +++ b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void main() { + int zero[2][3] = (int[2][3])0; + const int tint_symbol[3] = {1, 2, 3}; + const int tint_symbol_1[3] = {4, 5, 6}; + int init[2][3] = {tint_symbol, tint_symbol_1}; + return; +} diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..88d2dd3adc --- /dev/null +++ b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,8 @@ +[numthreads(1, 1, 1)] +void main() { + int zero[2][3] = (int[2][3])0; + const int tint_symbol[3] = {1, 2, 3}; + const int tint_symbol_1[3] = {4, 5, 6}; + int init[2][3] = {tint_symbol, tint_symbol_1}; + return; +} diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.glsl b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.glsl new file mode 100644 index 0000000000..132ba505a4 --- /dev/null +++ b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es + +void tint_symbol() { + int zero[2][3] = int[2][3](int[3](0, 0, 0), int[3](0, 0, 0)); + int tint_symbol_1[3] = int[3](1, 2, 3); + int tint_symbol_2[3] = int[3](4, 5, 6); + int init[2][3] = int[2][3](tint_symbol_1, tint_symbol_2); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.msl b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.msl new file mode 100644 index 0000000000..7ad097e56b --- /dev/null +++ b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.msl @@ -0,0 +1,24 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +kernel void tint_symbol() { + tint_array, 2> zero = {}; + tint_array const tint_symbol_1 = tint_array{1, 2, 3}; + tint_array const tint_symbol_2 = tint_array{4, 5, 6}; + tint_array, 2> init = tint_array, 2>{tint_symbol_1, tint_symbol_2}; + return; +} + diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.spvasm b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..12e87cc8cd --- /dev/null +++ b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %zero "zero" + OpName %init "init" + OpDecorate %_arr_int_uint_3 ArrayStride 4 + OpDecorate %_arr__arr_int_uint_3_uint_2 ArrayStride 12 + %void = OpTypeVoid + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %uint_2 = OpConstant %uint 2 +%_arr__arr_int_uint_3_uint_2 = OpTypeArray %_arr_int_uint_3 %uint_2 +%_ptr_Function__arr__arr_int_uint_3_uint_2 = OpTypePointer Function %_arr__arr_int_uint_3_uint_2 + %13 = OpConstantNull %_arr__arr_int_uint_3_uint_2 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %17 = OpConstantComposite %_arr_int_uint_3 %int_1 %int_2 %int_3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %21 = OpConstantComposite %_arr_int_uint_3 %int_4 %int_5 %int_6 + %22 = OpConstantComposite %_arr__arr_int_uint_3_uint_2 %17 %21 + %main = OpFunction %void None %1 + %4 = OpLabel + %zero = OpVariable %_ptr_Function__arr__arr_int_uint_3_uint_2 Function %13 + %init = OpVariable %_ptr_Function__arr__arr_int_uint_3_uint_2 Function %13 + OpStore %init %22 + OpReturn + OpFunctionEnd diff --git a/test/tint/var/initialization/function/array/array_i32.wgsl.expected.wgsl b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9bf37874c9 --- /dev/null +++ b/test/tint/var/initialization/function/array/array_i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +@compute @workgroup_size(1) +fn main() { + var zero : array, 2>; + var init : array, 2> = array, 2>(array(1, 2, 3), array(4, 5, 6)); +} diff --git a/test/tint/var/initialization/function/array/i32.wgsl b/test/tint/var/initialization/function/array/i32.wgsl new file mode 100644 index 0000000000..5e83d390db --- /dev/null +++ b/test/tint/var/initialization/function/array/i32.wgsl @@ -0,0 +1,5 @@ +@compute @workgroup_size(1) +fn main() { + var zero : array; + var init : array = array(1, 2, 3); +} diff --git a/test/tint/var/initialization/function/array/i32.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/function/array/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..93ed2c56f3 --- /dev/null +++ b/test/tint/var/initialization/function/array/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + int zero[3] = (int[3])0; + int init[3] = {1, 2, 3}; + return; +} diff --git a/test/tint/var/initialization/function/array/i32.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/function/array/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..93ed2c56f3 --- /dev/null +++ b/test/tint/var/initialization/function/array/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + int zero[3] = (int[3])0; + int init[3] = {1, 2, 3}; + return; +} diff --git a/test/tint/var/initialization/function/array/i32.wgsl.expected.glsl b/test/tint/var/initialization/function/array/i32.wgsl.expected.glsl new file mode 100644 index 0000000000..8cc2174ef5 --- /dev/null +++ b/test/tint/var/initialization/function/array/i32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es + +void tint_symbol() { + int zero[3] = int[3](0, 0, 0); + int init[3] = int[3](1, 2, 3); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/var/initialization/function/array/i32.wgsl.expected.msl b/test/tint/var/initialization/function/array/i32.wgsl.expected.msl new file mode 100644 index 0000000000..e171bf358f --- /dev/null +++ b/test/tint/var/initialization/function/array/i32.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +kernel void tint_symbol() { + tint_array zero = {}; + tint_array init = tint_array{1, 2, 3}; + return; +} + diff --git a/test/tint/var/initialization/function/array/i32.wgsl.expected.spvasm b/test/tint/var/initialization/function/array/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e61c1ab695 --- /dev/null +++ b/test/tint/var/initialization/function/array/i32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %zero "zero" + OpName %init "init" + OpDecorate %_arr_int_uint_3 ArrayStride 4 + %void = OpTypeVoid + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %11 = OpConstantNull %_arr_int_uint_3 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %15 = OpConstantComposite %_arr_int_uint_3 %int_1 %int_2 %int_3 + %main = OpFunction %void None %1 + %4 = OpLabel + %zero = OpVariable %_ptr_Function__arr_int_uint_3 Function %11 + %init = OpVariable %_ptr_Function__arr_int_uint_3 Function %11 + OpStore %init %15 + OpReturn + OpFunctionEnd diff --git a/test/tint/var/initialization/function/array/i32.wgsl.expected.wgsl b/test/tint/var/initialization/function/array/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..70f7f20c22 --- /dev/null +++ b/test/tint/var/initialization/function/array/i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +@compute @workgroup_size(1) +fn main() { + var zero : array; + var init : array = array(1, 2, 3); +} diff --git a/test/tint/var/initialization/function/matrix.wgsl b/test/tint/var/initialization/function/matrix.wgsl index ea336e833b..02da4d2719 100644 --- a/test/tint/var/initialization/function/matrix.wgsl +++ b/test/tint/var/initialization/function/matrix.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : mat2x3; _ = v; diff --git a/test/tint/var/initialization/function/matrix.wgsl.expected.hlsl b/test/tint/var/initialization/function/matrix.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/function/matrix.wgsl.expected.hlsl rename to test/tint/var/initialization/function/matrix.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/function/matrix.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/function/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8427c53a32 --- /dev/null +++ b/test/tint/var/initialization/function/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void main() { + float2x3 v = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + return; +} diff --git a/test/tint/var/initialization/function/matrix.wgsl.expected.wgsl b/test/tint/var/initialization/function/matrix.wgsl.expected.wgsl index d8bb3919c9..97df0401ab 100644 --- a/test/tint/var/initialization/function/matrix.wgsl.expected.wgsl +++ b/test/tint/var/initialization/function/matrix.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : mat2x3; _ = v; diff --git a/test/tint/var/initialization/function/scalar.wgsl b/test/tint/var/initialization/function/scalar.wgsl index 5d3b86ef51..0ff3a5cef4 100644 --- a/test/tint/var/initialization/function/scalar.wgsl +++ b/test/tint/var/initialization/function/scalar.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : i32; _ = v; diff --git a/test/tint/var/initialization/function/scalar.wgsl.expected.hlsl b/test/tint/var/initialization/function/scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/function/scalar.wgsl.expected.hlsl rename to test/tint/var/initialization/function/scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/function/scalar.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/function/scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f1e0557249 --- /dev/null +++ b/test/tint/var/initialization/function/scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void main() { + int v = 0; + return; +} diff --git a/test/tint/var/initialization/function/scalar.wgsl.expected.wgsl b/test/tint/var/initialization/function/scalar.wgsl.expected.wgsl index 67ee18d612..ecc4d30017 100644 --- a/test/tint/var/initialization/function/scalar.wgsl.expected.wgsl +++ b/test/tint/var/initialization/function/scalar.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : i32; _ = v; diff --git a/test/tint/var/initialization/function/struct.wgsl b/test/tint/var/initialization/function/struct.wgsl index f5ff55dc0d..51d3f3e092 100644 --- a/test/tint/var/initialization/function/struct.wgsl +++ b/test/tint/var/initialization/function/struct.wgsl @@ -3,7 +3,7 @@ struct S { b : f32, }; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : S; _ = v; diff --git a/test/tint/var/initialization/function/struct.wgsl.expected.hlsl b/test/tint/var/initialization/function/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/function/struct.wgsl.expected.hlsl rename to test/tint/var/initialization/function/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/function/struct.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/function/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a64b616c34 --- /dev/null +++ b/test/tint/var/initialization/function/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +struct S { + int a; + float b; +}; + +[numthreads(1, 1, 1)] +void main() { + S v = (S)0; + return; +} diff --git a/test/tint/var/initialization/function/struct.wgsl.expected.wgsl b/test/tint/var/initialization/function/struct.wgsl.expected.wgsl index 8bada3bbbb..be915fc93b 100644 --- a/test/tint/var/initialization/function/struct.wgsl.expected.wgsl +++ b/test/tint/var/initialization/function/struct.wgsl.expected.wgsl @@ -3,7 +3,7 @@ struct S { b : f32, } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : S; _ = v; diff --git a/test/tint/var/initialization/function/vector.wgsl b/test/tint/var/initialization/function/vector.wgsl index 40bc481cd8..d5fe138525 100644 --- a/test/tint/var/initialization/function/vector.wgsl +++ b/test/tint/var/initialization/function/vector.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : vec3; _ = v; diff --git a/test/tint/var/initialization/function/vector.wgsl.expected.hlsl b/test/tint/var/initialization/function/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/function/vector.wgsl.expected.hlsl rename to test/tint/var/initialization/function/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/function/vector.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/function/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..325ed1a5a3 --- /dev/null +++ b/test/tint/var/initialization/function/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,5 @@ +[numthreads(1, 1, 1)] +void main() { + int3 v = int3(0, 0, 0); + return; +} diff --git a/test/tint/var/initialization/function/vector.wgsl.expected.wgsl b/test/tint/var/initialization/function/vector.wgsl.expected.wgsl index 37600e5b0d..f8839b50ec 100644 --- a/test/tint/var/initialization/function/vector.wgsl.expected.wgsl +++ b/test/tint/var/initialization/function/vector.wgsl.expected.wgsl @@ -1,4 +1,4 @@ -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { var v : vec3; _ = v; diff --git a/test/tint/var/initialization/private/array.wgsl b/test/tint/var/initialization/private/array.wgsl deleted file mode 100644 index f01730acb2..0000000000 --- a/test/tint/var/initialization/private/array.wgsl +++ /dev/null @@ -1,6 +0,0 @@ -var v : array; - -@stage(compute) @workgroup_size(1) -fn main() { - _ = v; -} diff --git a/test/tint/var/initialization/private/array.wgsl.expected.glsl b/test/tint/var/initialization/private/array.wgsl.expected.glsl deleted file mode 100644 index 7bbaf79921..0000000000 --- a/test/tint/var/initialization/private/array.wgsl.expected.glsl +++ /dev/null @@ -1,11 +0,0 @@ -#version 310 es - -int v[3] = int[3](0, 0, 0); -void tint_symbol() { -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - tint_symbol(); - return; -} diff --git a/test/tint/var/initialization/private/array.wgsl.expected.hlsl b/test/tint/var/initialization/private/array.wgsl.expected.hlsl deleted file mode 100644 index 5cedea9503..0000000000 --- a/test/tint/var/initialization/private/array.wgsl.expected.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -static int v[3] = (int[3])0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/initialization/private/array.wgsl.expected.msl b/test/tint/var/initialization/private/array.wgsl.expected.msl deleted file mode 100644 index e80edf910c..0000000000 --- a/test/tint/var/initialization/private/array.wgsl.expected.msl +++ /dev/null @@ -1,11 +0,0 @@ -#include - -using namespace metal; -struct tint_array_wrapper { - int arr[3]; -}; - -kernel void tint_symbol() { - return; -} - diff --git a/test/tint/var/initialization/private/array.wgsl.expected.spvasm b/test/tint/var/initialization/private/array.wgsl.expected.spvasm deleted file mode 100644 index 90c0ea5084..0000000000 --- a/test/tint/var/initialization/private/array.wgsl.expected.spvasm +++ /dev/null @@ -1,25 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 12 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" - OpExecutionMode %main LocalSize 1 1 1 - OpName %v "v" - OpName %main "main" - OpDecorate %_arr_int_uint_3 ArrayStride 4 - %int = OpTypeInt 32 1 - %uint = OpTypeInt 32 0 - %uint_3 = OpConstant %uint 3 -%_arr_int_uint_3 = OpTypeArray %int %uint_3 -%_ptr_Private__arr_int_uint_3 = OpTypePointer Private %_arr_int_uint_3 - %7 = OpConstantNull %_arr_int_uint_3 - %v = OpVariable %_ptr_Private__arr_int_uint_3 Private %7 - %void = OpTypeVoid - %8 = OpTypeFunction %void - %main = OpFunction %void None %8 - %11 = OpLabel - OpReturn - OpFunctionEnd diff --git a/test/tint/var/initialization/private/array.wgsl.expected.wgsl b/test/tint/var/initialization/private/array.wgsl.expected.wgsl deleted file mode 100644 index ba967ec751..0000000000 --- a/test/tint/var/initialization/private/array.wgsl.expected.wgsl +++ /dev/null @@ -1,6 +0,0 @@ -var v : array; - -@stage(compute) @workgroup_size(1) -fn main() { - _ = v; -} diff --git a/test/tint/var/initialization/private/array/array_i32.wgsl b/test/tint/var/initialization/private/array/array_i32.wgsl new file mode 100644 index 0000000000..91547aefe6 --- /dev/null +++ b/test/tint/var/initialization/private/array/array_i32.wgsl @@ -0,0 +1,8 @@ +var zero : array, 2>; +var init : array, 2> = array, 2>(array(1, 2, 3), array(4, 5, 6)); + +@compute @workgroup_size(1) +fn main() { + var v0 = zero; + var v1 = init; +} diff --git a/test/tint/var/initialization/private/array/array_i32.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..aa728ab3bb --- /dev/null +++ b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +static int zero[2][3] = (int[2][3])0; +static int init[2][3] = {{1, 2, 3}, {4, 5, 6}}; + +[numthreads(1, 1, 1)] +void main() { + int v0[2][3] = zero; + int v1[2][3] = init; + return; +} diff --git a/test/tint/var/initialization/private/array/array_i32.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aa728ab3bb --- /dev/null +++ b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +static int zero[2][3] = (int[2][3])0; +static int init[2][3] = {{1, 2, 3}, {4, 5, 6}}; + +[numthreads(1, 1, 1)] +void main() { + int v0[2][3] = zero; + int v1[2][3] = init; + return; +} diff --git a/test/tint/var/initialization/private/array/array_i32.wgsl.expected.glsl b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.glsl new file mode 100644 index 0000000000..9ca3db0b88 --- /dev/null +++ b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es + +int zero[2][3] = int[2][3](int[3](0, 0, 0), int[3](0, 0, 0)); +int init[2][3] = int[2][3](int[3](1, 2, 3), int[3](4, 5, 6)); +void tint_symbol() { + int v0[2][3] = zero; + int v1[2][3] = init; +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/var/initialization/private/array/array_i32.wgsl.expected.msl b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.msl new file mode 100644 index 0000000000..33ba833738 --- /dev/null +++ b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.msl @@ -0,0 +1,24 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +kernel void tint_symbol() { + thread tint_array, 2> tint_symbol_1 = {}; + thread tint_array, 2> tint_symbol_2 = tint_array, 2>{tint_array{1, 2, 3}, tint_array{4, 5, 6}}; + tint_array, 2> v0 = tint_symbol_1; + tint_array, 2> v1 = tint_symbol_2; + return; +} + diff --git a/test/tint/var/initialization/private/array/array_i32.wgsl.expected.spvasm b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..81e5d8b78f --- /dev/null +++ b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.spvasm @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %zero "zero" + OpName %init "init" + OpName %main "main" + OpName %v0 "v0" + OpName %v1 "v1" + OpDecorate %_arr_int_uint_3 ArrayStride 4 + OpDecorate %_arr__arr_int_uint_3_uint_2 ArrayStride 12 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %uint_2 = OpConstant %uint 2 +%_arr__arr_int_uint_3_uint_2 = OpTypeArray %_arr_int_uint_3 %uint_2 +%_ptr_Private__arr__arr_int_uint_3_uint_2 = OpTypePointer Private %_arr__arr_int_uint_3_uint_2 + %9 = OpConstantNull %_arr__arr_int_uint_3_uint_2 + %zero = OpVariable %_ptr_Private__arr__arr_int_uint_3_uint_2 Private %9 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %13 = OpConstantComposite %_arr_int_uint_3 %int_1 %int_2 %int_3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %17 = OpConstantComposite %_arr_int_uint_3 %int_4 %int_5 %int_6 + %18 = OpConstantComposite %_arr__arr_int_uint_3_uint_2 %13 %17 + %init = OpVariable %_ptr_Private__arr__arr_int_uint_3_uint_2 Private %18 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function__arr__arr_int_uint_3_uint_2 = OpTypePointer Function %_arr__arr_int_uint_3_uint_2 + %main = OpFunction %void None %20 + %23 = OpLabel + %v0 = OpVariable %_ptr_Function__arr__arr_int_uint_3_uint_2 Function %9 + %v1 = OpVariable %_ptr_Function__arr__arr_int_uint_3_uint_2 Function %9 + %24 = OpLoad %_arr__arr_int_uint_3_uint_2 %zero + OpStore %v0 %24 + %27 = OpLoad %_arr__arr_int_uint_3_uint_2 %init + OpStore %v1 %27 + OpReturn + OpFunctionEnd diff --git a/test/tint/var/initialization/private/array/array_i32.wgsl.expected.wgsl b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..44805741fc --- /dev/null +++ b/test/tint/var/initialization/private/array/array_i32.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +var zero : array, 2>; + +var init : array, 2> = array, 2>(array(1, 2, 3), array(4, 5, 6)); + +@compute @workgroup_size(1) +fn main() { + var v0 = zero; + var v1 = init; +} diff --git a/test/tint/var/initialization/private/array/i32.wgsl b/test/tint/var/initialization/private/array/i32.wgsl new file mode 100644 index 0000000000..c17920aa04 --- /dev/null +++ b/test/tint/var/initialization/private/array/i32.wgsl @@ -0,0 +1,8 @@ +var zero : array; +var init : array = array(1, 2, 3); + +@compute @workgroup_size(1) +fn main() { + var v0 = zero; + var v1 = init; +} diff --git a/test/tint/var/initialization/private/array/i32.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/private/array/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e4cc4bc941 --- /dev/null +++ b/test/tint/var/initialization/private/array/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,9 @@ +static int zero[3] = (int[3])0; +static int init[3] = {1, 2, 3}; + +[numthreads(1, 1, 1)] +void main() { + int v0[3] = zero; + int v1[3] = init; + return; +} diff --git a/test/tint/var/initialization/private/array/i32.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/private/array/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e4cc4bc941 --- /dev/null +++ b/test/tint/var/initialization/private/array/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,9 @@ +static int zero[3] = (int[3])0; +static int init[3] = {1, 2, 3}; + +[numthreads(1, 1, 1)] +void main() { + int v0[3] = zero; + int v1[3] = init; + return; +} diff --git a/test/tint/var/initialization/private/array/i32.wgsl.expected.glsl b/test/tint/var/initialization/private/array/i32.wgsl.expected.glsl new file mode 100644 index 0000000000..956d1965ba --- /dev/null +++ b/test/tint/var/initialization/private/array/i32.wgsl.expected.glsl @@ -0,0 +1,14 @@ +#version 310 es + +int zero[3] = int[3](0, 0, 0); +int init[3] = int[3](1, 2, 3); +void tint_symbol() { + int v0[3] = zero; + int v1[3] = init; +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(); + return; +} diff --git a/test/tint/var/initialization/private/array/i32.wgsl.expected.msl b/test/tint/var/initialization/private/array/i32.wgsl.expected.msl new file mode 100644 index 0000000000..60dac04083 --- /dev/null +++ b/test/tint/var/initialization/private/array/i32.wgsl.expected.msl @@ -0,0 +1,24 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +kernel void tint_symbol() { + thread tint_array tint_symbol_1 = {}; + thread tint_array tint_symbol_2 = tint_array{1, 2, 3}; + tint_array v0 = tint_symbol_1; + tint_array v1 = tint_symbol_2; + return; +} + diff --git a/test/tint/var/initialization/private/array/i32.wgsl.expected.spvasm b/test/tint/var/initialization/private/array/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..0ca3cd6979 --- /dev/null +++ b/test/tint/var/initialization/private/array/i32.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %zero "zero" + OpName %init "init" + OpName %main "main" + OpName %v0 "v0" + OpName %v1 "v1" + OpDecorate %_arr_int_uint_3 ArrayStride 4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Private__arr_int_uint_3 = OpTypePointer Private %_arr_int_uint_3 + %7 = OpConstantNull %_arr_int_uint_3 + %zero = OpVariable %_ptr_Private__arr_int_uint_3 Private %7 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %11 = OpConstantComposite %_arr_int_uint_3 %int_1 %int_2 %int_3 + %init = OpVariable %_ptr_Private__arr_int_uint_3 Private %11 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %main = OpFunction %void None %13 + %16 = OpLabel + %v0 = OpVariable %_ptr_Function__arr_int_uint_3 Function %7 + %v1 = OpVariable %_ptr_Function__arr_int_uint_3 Function %7 + %17 = OpLoad %_arr_int_uint_3 %zero + OpStore %v0 %17 + %20 = OpLoad %_arr_int_uint_3 %init + OpStore %v1 %20 + OpReturn + OpFunctionEnd diff --git a/test/tint/var/initialization/private/array/i32.wgsl.expected.wgsl b/test/tint/var/initialization/private/array/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..59f94480b7 --- /dev/null +++ b/test/tint/var/initialization/private/array/i32.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +var zero : array; + +var init : array = array(1, 2, 3); + +@compute @workgroup_size(1) +fn main() { + var v0 = zero; + var v1 = init; +} diff --git a/test/tint/var/initialization/private/matrix.wgsl b/test/tint/var/initialization/private/matrix.wgsl index e46734c845..5ab7ed2b3e 100644 --- a/test/tint/var/initialization/private/matrix.wgsl +++ b/test/tint/var/initialization/private/matrix.wgsl @@ -1,6 +1,6 @@ var v : mat2x3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/private/matrix.wgsl.expected.hlsl b/test/tint/var/initialization/private/matrix.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/private/matrix.wgsl.expected.hlsl rename to test/tint/var/initialization/private/matrix.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/private/matrix.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/private/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c6aac5c2b3 --- /dev/null +++ b/test/tint/var/initialization/private/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +static float2x3 v = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/var/initialization/private/matrix.wgsl.expected.wgsl b/test/tint/var/initialization/private/matrix.wgsl.expected.wgsl index c3042ab821..e76e77ea28 100644 --- a/test/tint/var/initialization/private/matrix.wgsl.expected.wgsl +++ b/test/tint/var/initialization/private/matrix.wgsl.expected.wgsl @@ -1,6 +1,6 @@ var v : mat2x3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/private/scalar.wgsl b/test/tint/var/initialization/private/scalar.wgsl index 8e46653bb3..c737250b46 100644 --- a/test/tint/var/initialization/private/scalar.wgsl +++ b/test/tint/var/initialization/private/scalar.wgsl @@ -1,6 +1,6 @@ var v : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/private/scalar.wgsl.expected.hlsl b/test/tint/var/initialization/private/scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/private/scalar.wgsl.expected.hlsl rename to test/tint/var/initialization/private/scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/private/scalar.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/private/scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a5deefa2f0 --- /dev/null +++ b/test/tint/var/initialization/private/scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +static int v = 0; + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/var/initialization/private/scalar.wgsl.expected.wgsl b/test/tint/var/initialization/private/scalar.wgsl.expected.wgsl index 911081b60c..7c128faa47 100644 --- a/test/tint/var/initialization/private/scalar.wgsl.expected.wgsl +++ b/test/tint/var/initialization/private/scalar.wgsl.expected.wgsl @@ -1,6 +1,6 @@ var v : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/private/struct.wgsl b/test/tint/var/initialization/private/struct.wgsl index 4d875955da..29e5d307eb 100644 --- a/test/tint/var/initialization/private/struct.wgsl +++ b/test/tint/var/initialization/private/struct.wgsl @@ -5,7 +5,7 @@ struct S { var v : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/private/struct.wgsl.expected.hlsl b/test/tint/var/initialization/private/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/private/struct.wgsl.expected.hlsl rename to test/tint/var/initialization/private/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/private/struct.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/private/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ec62875db --- /dev/null +++ b/test/tint/var/initialization/private/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +struct S { + int a; + float b; +}; + +static S v = (S)0; + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/var/initialization/private/struct.wgsl.expected.wgsl b/test/tint/var/initialization/private/struct.wgsl.expected.wgsl index bb45cd6fdd..53f8f6c040 100644 --- a/test/tint/var/initialization/private/struct.wgsl.expected.wgsl +++ b/test/tint/var/initialization/private/struct.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct S { var v : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/private/vector.wgsl b/test/tint/var/initialization/private/vector.wgsl index 2af1bf50cd..29f58234d1 100644 --- a/test/tint/var/initialization/private/vector.wgsl +++ b/test/tint/var/initialization/private/vector.wgsl @@ -1,6 +1,6 @@ var v : vec3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/private/vector.wgsl.expected.hlsl b/test/tint/var/initialization/private/vector.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/private/vector.wgsl.expected.hlsl rename to test/tint/var/initialization/private/vector.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/private/vector.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/private/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bb1c19583a --- /dev/null +++ b/test/tint/var/initialization/private/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +static int3 v = int3(0, 0, 0); + +[numthreads(1, 1, 1)] +void main() { + return; +} diff --git a/test/tint/var/initialization/private/vector.wgsl.expected.wgsl b/test/tint/var/initialization/private/vector.wgsl.expected.wgsl index 183418e0f9..ea22b217ce 100644 --- a/test/tint/var/initialization/private/vector.wgsl.expected.wgsl +++ b/test/tint/var/initialization/private/vector.wgsl.expected.wgsl @@ -1,6 +1,6 @@ var v : vec3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/workgroup/array.wgsl b/test/tint/var/initialization/workgroup/array.wgsl deleted file mode 100644 index 1d9aa8b84c..0000000000 --- a/test/tint/var/initialization/workgroup/array.wgsl +++ /dev/null @@ -1,6 +0,0 @@ -var v : array; - -@stage(compute) @workgroup_size(1) -fn main() { - _ = v; -} diff --git a/test/tint/var/initialization/workgroup/array.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/array.wgsl.expected.glsl deleted file mode 100644 index 0cb73908ef..0000000000 --- a/test/tint/var/initialization/workgroup/array.wgsl.expected.glsl +++ /dev/null @@ -1,18 +0,0 @@ -#version 310 es - -shared int v[3]; -void tint_symbol(uint local_invocation_index) { - { - for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) { - uint i = idx; - v[i] = 0; - } - } - barrier(); -} - -layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() { - tint_symbol(gl_LocalInvocationIndex); - return; -} diff --git a/test/tint/var/initialization/workgroup/array.wgsl.expected.hlsl b/test/tint/var/initialization/workgroup/array.wgsl.expected.hlsl deleted file mode 100644 index 21c4cabbee..0000000000 --- a/test/tint/var/initialization/workgroup/array.wgsl.expected.hlsl +++ /dev/null @@ -1,21 +0,0 @@ -groupshared int v[3]; - -struct tint_symbol_1 { - uint local_invocation_index : SV_GroupIndex; -}; - -void main_inner(uint local_invocation_index) { - { - [loop] for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) { - const uint i = idx; - v[i] = 0; - } - } - GroupMemoryBarrierWithGroupSync(); -} - -[numthreads(1, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.local_invocation_index); - return; -} diff --git a/test/tint/var/initialization/workgroup/array.wgsl.expected.msl b/test/tint/var/initialization/workgroup/array.wgsl.expected.msl deleted file mode 100644 index 89175b00aa..0000000000 --- a/test/tint/var/initialization/workgroup/array.wgsl.expected.msl +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace metal; -struct tint_array_wrapper { - int arr[3]; -}; - -void tint_symbol_inner(uint local_invocation_index, threadgroup tint_array_wrapper* const tint_symbol_1) { - for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) { - uint const i = idx; - (*(tint_symbol_1)).arr[i] = int(); - } - threadgroup_barrier(mem_flags::mem_threadgroup); -} - -kernel void tint_symbol(uint local_invocation_index [[thread_index_in_threadgroup]]) { - threadgroup tint_array_wrapper tint_symbol_2; - tint_symbol_inner(local_invocation_index, &(tint_symbol_2)); - return; -} - diff --git a/test/tint/var/initialization/workgroup/array.wgsl.expected.spvasm b/test/tint/var/initialization/workgroup/array.wgsl.expected.spvasm deleted file mode 100644 index 97682d3c23..0000000000 --- a/test/tint/var/initialization/workgroup/array.wgsl.expected.spvasm +++ /dev/null @@ -1,73 +0,0 @@ -; SPIR-V -; Version: 1.3 -; Generator: Google Tint Compiler; 0 -; Bound: 42 -; Schema: 0 - OpCapability Shader - OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" %local_invocation_index_1 - OpExecutionMode %main LocalSize 1 1 1 - OpName %local_invocation_index_1 "local_invocation_index_1" - OpName %v "v" - OpName %main_inner "main_inner" - OpName %local_invocation_index "local_invocation_index" - OpName %idx "idx" - OpName %main "main" - OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex - OpDecorate %_arr_int_uint_3 ArrayStride 4 - %uint = OpTypeInt 32 0 -%_ptr_Input_uint = OpTypePointer Input %uint -%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input - %int = OpTypeInt 32 1 - %uint_3 = OpConstant %uint 3 -%_arr_int_uint_3 = OpTypeArray %int %uint_3 -%_ptr_Workgroup__arr_int_uint_3 = OpTypePointer Workgroup %_arr_int_uint_3 - %v = OpVariable %_ptr_Workgroup__arr_int_uint_3 Workgroup - %void = OpTypeVoid - %9 = OpTypeFunction %void %uint -%_ptr_Function_uint = OpTypePointer Function %uint - %16 = OpConstantNull %uint - %bool = OpTypeBool -%_ptr_Workgroup_int = OpTypePointer Workgroup %int - %30 = OpConstantNull %int - %uint_1 = OpConstant %uint 1 - %uint_2 = OpConstant %uint 2 - %uint_264 = OpConstant %uint 264 - %37 = OpTypeFunction %void - %main_inner = OpFunction %void None %9 -%local_invocation_index = OpFunctionParameter %uint - %13 = OpLabel - %idx = OpVariable %_ptr_Function_uint Function %16 - OpStore %idx %local_invocation_index - OpBranch %17 - %17 = OpLabel - OpLoopMerge %18 %19 None - OpBranch %20 - %20 = OpLabel - %22 = OpLoad %uint %idx - %23 = OpULessThan %bool %22 %uint_3 - %21 = OpLogicalNot %bool %23 - OpSelectionMerge %25 None - OpBranchConditional %21 %26 %25 - %26 = OpLabel - OpBranch %18 - %25 = OpLabel - %27 = OpLoad %uint %idx - %29 = OpAccessChain %_ptr_Workgroup_int %v %27 - OpStore %29 %30 - OpBranch %19 - %19 = OpLabel - %31 = OpLoad %uint %idx - %33 = OpIAdd %uint %31 %uint_1 - OpStore %idx %33 - OpBranch %17 - %18 = OpLabel - OpControlBarrier %uint_2 %uint_2 %uint_264 - OpReturn - OpFunctionEnd - %main = OpFunction %void None %37 - %39 = OpLabel - %41 = OpLoad %uint %local_invocation_index_1 - %40 = OpFunctionCall %void %main_inner %41 - OpReturn - OpFunctionEnd diff --git a/test/tint/var/initialization/workgroup/array.wgsl.expected.wgsl b/test/tint/var/initialization/workgroup/array.wgsl.expected.wgsl deleted file mode 100644 index cc53b73850..0000000000 --- a/test/tint/var/initialization/workgroup/array.wgsl.expected.wgsl +++ /dev/null @@ -1,6 +0,0 @@ -var v : array; - -@stage(compute) @workgroup_size(1) -fn main() { - _ = v; -} diff --git a/test/tint/var/initialization/workgroup/array/array_i32.wgsl b/test/tint/var/initialization/workgroup/array/array_i32.wgsl new file mode 100644 index 0000000000..d7ba62cbf4 --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/array_i32.wgsl @@ -0,0 +1,6 @@ +var zero : array, 2>; + +@compute @workgroup_size(1) +fn main() { + var v = zero; +} diff --git a/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0bcec7280e --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,23 @@ +groupshared int zero[2][3]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + const uint i = (idx / 3u); + const uint i_1 = (idx % 3u); + zero[i][i_1] = 0; + } + } + GroupMemoryBarrierWithGroupSync(); + int v[2][3] = zero; +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0bcec7280e --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,23 @@ +groupshared int zero[2][3]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + const uint i = (idx / 3u); + const uint i_1 = (idx % 3u); + zero[i][i_1] = 0; + } + } + GroupMemoryBarrierWithGroupSync(); + int v[2][3] = zero; +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.glsl new file mode 100644 index 0000000000..a3ba5e2cba --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.glsl @@ -0,0 +1,20 @@ +#version 310 es + +shared int zero[2][3]; +void tint_symbol(uint local_invocation_index) { + { + for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + uint i = (idx / 3u); + uint i_1 = (idx % 3u); + zero[i][i_1] = 0; + } + } + barrier(); + int v[2][3] = zero; +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.msl b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.msl new file mode 100644 index 0000000000..81c761941c --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void tint_symbol_inner(uint local_invocation_index, threadgroup tint_array, 2>* const tint_symbol_1) { + for(uint idx = local_invocation_index; (idx < 6u); idx = (idx + 1u)) { + uint const i = (idx / 3u); + uint const i_1 = (idx % 3u); + (*(tint_symbol_1))[i][i_1] = 0; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + tint_array, 2> v = *(tint_symbol_1); +} + +kernel void tint_symbol(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup tint_array, 2> tint_symbol_2; + tint_symbol_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.spvasm b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ff32eed209 --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %local_invocation_index_1 + OpExecutionMode %main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %zero "zero" + OpName %main_inner "main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %v "v" + OpName %main "main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_int_uint_3 ArrayStride 4 + OpDecorate %_arr__arr_int_uint_3_uint_2 ArrayStride 12 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %uint_2 = OpConstant %uint 2 +%_arr__arr_int_uint_3_uint_2 = OpTypeArray %_arr_int_uint_3 %uint_2 +%_ptr_Workgroup__arr__arr_int_uint_3_uint_2 = OpTypePointer Workgroup %_arr__arr_int_uint_3_uint_2 + %zero = OpVariable %_ptr_Workgroup__arr__arr_int_uint_3_uint_2 Workgroup + %void = OpTypeVoid + %11 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %uint_6 = OpConstant %uint 6 + %bool = OpTypeBool +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %36 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 + %uint_264 = OpConstant %uint 264 +%_ptr_Function__arr__arr_int_uint_3_uint_2 = OpTypePointer Function %_arr__arr_int_uint_3_uint_2 + %45 = OpConstantNull %_arr__arr_int_uint_3_uint_2 + %46 = OpTypeFunction %void + %main_inner = OpFunction %void None %11 +%local_invocation_index = OpFunctionParameter %uint + %15 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %18 + %v = OpVariable %_ptr_Function__arr__arr_int_uint_3_uint_2 Function %45 + OpStore %idx %local_invocation_index + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %24 = OpLoad %uint %idx + %26 = OpULessThan %bool %24 %uint_6 + %23 = OpLogicalNot %bool %26 + OpSelectionMerge %28 None + OpBranchConditional %23 %29 %28 + %29 = OpLabel + OpBranch %20 + %28 = OpLabel + %30 = OpLoad %uint %idx + %31 = OpUDiv %uint %30 %uint_3 + %32 = OpLoad %uint %idx + %33 = OpUMod %uint %32 %uint_3 + %35 = OpAccessChain %_ptr_Workgroup_int %zero %31 %33 + OpStore %35 %36 + OpBranch %21 + %21 = OpLabel + %37 = OpLoad %uint %idx + %39 = OpIAdd %uint %37 %uint_1 + OpStore %idx %39 + OpBranch %19 + %20 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %42 = OpLoad %_arr__arr_int_uint_3_uint_2 %zero + OpStore %v %42 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %46 + %48 = OpLabel + %50 = OpLoad %uint %local_invocation_index_1 + %49 = OpFunctionCall %void %main_inner %50 + OpReturn + OpFunctionEnd diff --git a/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.wgsl b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3d6c3c284 --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/array_i32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var zero : array, 2>; + +@compute @workgroup_size(1) +fn main() { + var v = zero; +} diff --git a/test/tint/var/initialization/workgroup/array/i32.wgsl b/test/tint/var/initialization/workgroup/array/i32.wgsl new file mode 100644 index 0000000000..2b910b3e7d --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/i32.wgsl @@ -0,0 +1,6 @@ +var zero : array; + +@compute @workgroup_size(1) +fn main() { + var v = zero; +} diff --git a/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..15e697a9c8 --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,22 @@ +groupshared int zero[3]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) { + const uint i = idx; + zero[i] = 0; + } + } + GroupMemoryBarrierWithGroupSync(); + int v[3] = zero; +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..15e697a9c8 --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +groupshared int zero[3]; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + [loop] for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) { + const uint i = idx; + zero[i] = 0; + } + } + GroupMemoryBarrierWithGroupSync(); + int v[3] = zero; +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.glsl new file mode 100644 index 0000000000..b2191b1543 --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.glsl @@ -0,0 +1,19 @@ +#version 310 es + +shared int zero[3]; +void tint_symbol(uint local_invocation_index) { + { + for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) { + uint i = idx; + zero[i] = 0; + } + } + barrier(); + int v[3] = zero; +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol(gl_LocalInvocationIndex); + return; +} diff --git a/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.msl b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.msl new file mode 100644 index 0000000000..5b98f4af10 --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; + +template +struct tint_array { + const constant T& operator[](size_t i) const constant { return elements[i]; } + device T& operator[](size_t i) device { return elements[i]; } + const device T& operator[](size_t i) const device { return elements[i]; } + thread T& operator[](size_t i) thread { return elements[i]; } + const thread T& operator[](size_t i) const thread { return elements[i]; } + threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } + const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } + T elements[N]; +}; + +void tint_symbol_inner(uint local_invocation_index, threadgroup tint_array* const tint_symbol_1) { + for(uint idx = local_invocation_index; (idx < 3u); idx = (idx + 1u)) { + uint const i = idx; + (*(tint_symbol_1))[i] = 0; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + tint_array v = *(tint_symbol_1); +} + +kernel void tint_symbol(uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup tint_array tint_symbol_2; + tint_symbol_inner(local_invocation_index, &(tint_symbol_2)); + return; +} + diff --git a/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.spvasm b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..59c3e27c0a --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %local_invocation_index_1 + OpExecutionMode %main LocalSize 1 1 1 + OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %zero "zero" + OpName %main_inner "main_inner" + OpName %local_invocation_index "local_invocation_index" + OpName %idx "idx" + OpName %v "v" + OpName %main "main" + OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex + OpDecorate %_arr_int_uint_3 ArrayStride 4 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Workgroup__arr_int_uint_3 = OpTypePointer Workgroup %_arr_int_uint_3 + %zero = OpVariable %_ptr_Workgroup__arr_int_uint_3 Workgroup + %void = OpTypeVoid + %9 = OpTypeFunction %void %uint +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %bool = OpTypeBool +%_ptr_Workgroup_int = OpTypePointer Workgroup %int + %30 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %40 = OpConstantNull %_arr_int_uint_3 + %41 = OpTypeFunction %void + %main_inner = OpFunction %void None %9 +%local_invocation_index = OpFunctionParameter %uint + %13 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %16 + %v = OpVariable %_ptr_Function__arr_int_uint_3 Function %40 + OpStore %idx %local_invocation_index + OpBranch %17 + %17 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %22 = OpLoad %uint %idx + %23 = OpULessThan %bool %22 %uint_3 + %21 = OpLogicalNot %bool %23 + OpSelectionMerge %25 None + OpBranchConditional %21 %26 %25 + %26 = OpLabel + OpBranch %18 + %25 = OpLabel + %27 = OpLoad %uint %idx + %29 = OpAccessChain %_ptr_Workgroup_int %zero %27 + OpStore %29 %30 + OpBranch %19 + %19 = OpLabel + %31 = OpLoad %uint %idx + %33 = OpIAdd %uint %31 %uint_1 + OpStore %idx %33 + OpBranch %17 + %18 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %37 = OpLoad %_arr_int_uint_3 %zero + OpStore %v %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %41 + %43 = OpLabel + %45 = OpLoad %uint %local_invocation_index_1 + %44 = OpFunctionCall %void %main_inner %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.wgsl b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f7cdf652e --- /dev/null +++ b/test/tint/var/initialization/workgroup/array/i32.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +var zero : array; + +@compute @workgroup_size(1) +fn main() { + var v = zero; +} diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl b/test/tint/var/initialization/workgroup/matrix.wgsl index f494319b2d..42505a65b4 100644 --- a/test/tint/var/initialization/workgroup/matrix.wgsl +++ b/test/tint/var/initialization/workgroup/matrix.wgsl @@ -1,6 +1,6 @@ var v : mat2x3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..34e4247859 --- /dev/null +++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.dxc.hlsl @@ -0,0 +1,18 @@ +groupshared float2x3 v; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + v = float2x3((0.0f).xxx, (0.0f).xxx); + } + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..34e4247859 --- /dev/null +++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +groupshared float2x3 v; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + v = float2x3((0.0f).xxx, (0.0f).xxx); + } + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.glsl index 8a9d90aef8..d657b8911f 100644 --- a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.glsl +++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.glsl @@ -3,7 +3,7 @@ shared mat2x3 v; void tint_symbol(uint local_invocation_index) { { - v = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + v = mat2x3(vec3(0.0f), vec3(0.0f)); } barrier(); } diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.hlsl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.hlsl deleted file mode 100644 index db43579856..0000000000 --- a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.hlsl +++ /dev/null @@ -1,18 +0,0 @@ -groupshared float2x3 v; - -struct tint_symbol_1 { - uint local_invocation_index : SV_GroupIndex; -}; - -void main_inner(uint local_invocation_index) { - { - v = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - } - GroupMemoryBarrierWithGroupSync(); -} - -[numthreads(1, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.local_invocation_index); - return; -} diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.msl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.msl index 0a507da342..348fc25805 100644 --- a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.msl +++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.msl @@ -7,7 +7,7 @@ struct tint_symbol_4 { void tint_symbol_inner(uint local_invocation_index, threadgroup float2x3* const tint_symbol_1) { { - *(tint_symbol_1) = float2x3(); + *(tint_symbol_1) = float2x3(float3(0.0f), float3(0.0f)); } threadgroup_barrier(mem_flags::mem_threadgroup); } diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.wgsl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.wgsl index 62ce905895..bdda50ce88 100644 --- a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.wgsl +++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.wgsl @@ -1,6 +1,6 @@ var v : mat2x3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl b/test/tint/var/initialization/workgroup/scalar.wgsl index 37c8a4faf3..f99bf74f8c 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl +++ b/test/tint/var/initialization/workgroup/scalar.wgsl @@ -1,6 +1,6 @@ var v : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.hlsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/workgroup/scalar.wgsl.expected.hlsl rename to test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..43e8f607dc --- /dev/null +++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +groupshared int v; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + v = 0; + } + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl index cbba65b25a..3829fc7306 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl +++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl @@ -3,7 +3,7 @@ using namespace metal; void tint_symbol_inner(uint local_invocation_index, threadgroup int* const tint_symbol_1) { { - *(tint_symbol_1) = int(); + *(tint_symbol_1) = 0; } threadgroup_barrier(mem_flags::mem_threadgroup); } diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.wgsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.wgsl index 3cfef70870..98978d068e 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.wgsl +++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.wgsl @@ -1,6 +1,6 @@ var v : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/workgroup/struct.wgsl b/test/tint/var/initialization/workgroup/struct.wgsl index 5aa0a6d8fb..c26547bced 100644 --- a/test/tint/var/initialization/workgroup/struct.wgsl +++ b/test/tint/var/initialization/workgroup/struct.wgsl @@ -5,7 +5,7 @@ struct S { var v : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/workgroup/struct.wgsl.expected.hlsl b/test/tint/var/initialization/workgroup/struct.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/initialization/workgroup/struct.wgsl.expected.hlsl rename to test/tint/var/initialization/workgroup/struct.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/initialization/workgroup/struct.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/struct.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..277f3c942a --- /dev/null +++ b/test/tint/var/initialization/workgroup/struct.wgsl.expected.fxc.hlsl @@ -0,0 +1,24 @@ +struct S { + int a; + float b; +}; + +groupshared S v; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + const S tint_symbol_2 = (S)0; + v = tint_symbol_2; + } + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/struct.wgsl.expected.msl b/test/tint/var/initialization/workgroup/struct.wgsl.expected.msl index 619559ac63..276d1d6176 100644 --- a/test/tint/var/initialization/workgroup/struct.wgsl.expected.msl +++ b/test/tint/var/initialization/workgroup/struct.wgsl.expected.msl @@ -8,7 +8,7 @@ struct S { void tint_symbol_inner(uint local_invocation_index, threadgroup S* const tint_symbol_2) { { - S const tint_symbol_1 = {}; + S const tint_symbol_1 = S{}; *(tint_symbol_2) = tint_symbol_1; } threadgroup_barrier(mem_flags::mem_threadgroup); diff --git a/test/tint/var/initialization/workgroup/struct.wgsl.expected.wgsl b/test/tint/var/initialization/workgroup/struct.wgsl.expected.wgsl index a8b7f86594..fe9b67f8f5 100644 --- a/test/tint/var/initialization/workgroup/struct.wgsl.expected.wgsl +++ b/test/tint/var/initialization/workgroup/struct.wgsl.expected.wgsl @@ -5,7 +5,7 @@ struct S { var v : S; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/workgroup/vector.wgsl b/test/tint/var/initialization/workgroup/vector.wgsl index 37ff6f2177..8e3a45bf62 100644 --- a/test/tint/var/initialization/workgroup/vector.wgsl +++ b/test/tint/var/initialization/workgroup/vector.wgsl @@ -1,6 +1,6 @@ var v : vec3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6305ce42b8 --- /dev/null +++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.dxc.hlsl @@ -0,0 +1,18 @@ +groupshared int3 v; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + v = (0).xxx; + } + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6305ce42b8 --- /dev/null +++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.fxc.hlsl @@ -0,0 +1,18 @@ +groupshared int3 v; + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main_inner(uint local_invocation_index) { + { + v = (0).xxx; + } + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + main_inner(tint_symbol.local_invocation_index); + return; +} diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.glsl index 8db8861df5..39dfffd338 100644 --- a/test/tint/var/initialization/workgroup/vector.wgsl.expected.glsl +++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.glsl @@ -3,7 +3,7 @@ shared ivec3 v; void tint_symbol(uint local_invocation_index) { { - v = ivec3(0, 0, 0); + v = ivec3(0); } barrier(); } diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.hlsl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.hlsl deleted file mode 100644 index 299df38ee9..0000000000 --- a/test/tint/var/initialization/workgroup/vector.wgsl.expected.hlsl +++ /dev/null @@ -1,18 +0,0 @@ -groupshared int3 v; - -struct tint_symbol_1 { - uint local_invocation_index : SV_GroupIndex; -}; - -void main_inner(uint local_invocation_index) { - { - v = int3(0, 0, 0); - } - GroupMemoryBarrierWithGroupSync(); -} - -[numthreads(1, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.local_invocation_index); - return; -} diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.msl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.msl index d114b14cb6..5c498045c7 100644 --- a/test/tint/var/initialization/workgroup/vector.wgsl.expected.msl +++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.msl @@ -3,7 +3,7 @@ using namespace metal; void tint_symbol_inner(uint local_invocation_index, threadgroup int3* const tint_symbol_1) { { - *(tint_symbol_1) = int3(); + *(tint_symbol_1) = int3(0); } threadgroup_barrier(mem_flags::mem_threadgroup); } diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.wgsl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.wgsl index a6f967cbe7..21d32bacce 100644 --- a/test/tint/var/initialization/workgroup/vector.wgsl.expected.wgsl +++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.wgsl @@ -1,6 +1,6 @@ var v : vec3; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { _ = v; } diff --git a/test/tint/var/override/named/no_init/bool.wgsl b/test/tint/var/override/named/no_init/bool.wgsl index 9c595f28bf..1044195686 100644 --- a/test/tint/var/override/named/no_init/bool.wgsl +++ b/test/tint/var/override/named/no_init/bool.wgsl @@ -1,7 +1,10 @@ -// flags: --overrides WGSL_SPEC_CONSTANT_0=0 +// flags: --overrides o=0,j=1 override o : bool; +override j : bool; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o && j { + _ = 1; + } } diff --git a/test/tint/var/override/named/no_init/bool.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/no_init/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fba945b8e2 --- /dev/null +++ b/test/tint/var/override/named/no_init/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void main() { + bool tint_tmp = false; + if (tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + } + return; +} diff --git a/test/tint/var/override/named/no_init/bool.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/no_init/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fba945b8e2 --- /dev/null +++ b/test/tint/var/override/named/no_init/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void main() { + bool tint_tmp = false; + if (tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + } + return; +} diff --git a/test/tint/var/override/named/no_init/bool.wgsl.expected.glsl b/test/tint/var/override/named/no_init/bool.wgsl.expected.glsl index 4df044d579..677dd8d573 100644 --- a/test/tint/var/override/named/no_init/bool.wgsl.expected.glsl +++ b/test/tint/var/override/named/no_init/bool.wgsl.expected.glsl @@ -1,12 +1,12 @@ -SKIP: FAILED - #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#error spec constant required for constant id 0 -#endif -const bool o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + bool tint_tmp = false; + if (tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -14,11 +14,3 @@ void main() { tint_symbol(); return; } -Error parsing GLSL shader: -ERROR: 0:4: '#error' : spec constant required for constant id 0 -ERROR: 0:5: '' : missing #endif -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/var/override/named/no_init/bool.wgsl.expected.hlsl b/test/tint/var/override/named/no_init/bool.wgsl.expected.hlsl deleted file mode 100644 index 3ea88ba0b2..0000000000 --- a/test/tint/var/override/named/no_init/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#error spec constant required for constant id 0 -#endif -static const bool o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/no_init/bool.wgsl.expected.msl b/test/tint/var/override/named/no_init/bool.wgsl.expected.msl index 014e3b1fd3..c502139d39 100644 --- a/test/tint/var/override/named/no_init/bool.wgsl.expected.msl +++ b/test/tint/var/override/named/no_init/bool.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant bool o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((false && true)) { + } return; } diff --git a/test/tint/var/override/named/no_init/bool.wgsl.expected.spvasm b/test/tint/var/override/named/no_init/bool.wgsl.expected.spvasm index ff12e004f7..3c8eb1b1e5 100644 --- a/test/tint/var/override/named/no_init/bool.wgsl.expected.spvasm +++ b/test/tint/var/override/named/no_init/bool.wgsl.expected.spvasm @@ -1,20 +1,30 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 13 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %bool = OpTypeBool - %o = OpSpecConstantFalse %bool %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %bool = OpTypeBool + %6 = OpConstantNull %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %1 + %4 = OpLabel + OpSelectionMerge %7 None + OpBranchConditional %6 %8 %7 + %8 = OpLabel + OpBranch %7 + %7 = OpLabel + %10 = OpPhi %bool %6 %4 %true %8 + OpSelectionMerge %11 None + OpBranchConditional %10 %12 %11 + %12 = OpLabel + OpBranch %11 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/no_init/bool.wgsl.expected.wgsl b/test/tint/var/override/named/no_init/bool.wgsl.expected.wgsl index 344ec0e312..532159899c 100644 --- a/test/tint/var/override/named/no_init/bool.wgsl.expected.wgsl +++ b/test/tint/var/override/named/no_init/bool.wgsl.expected.wgsl @@ -1,6 +1,10 @@ -override o : bool; +const o : bool = false; -@stage(compute) @workgroup_size(1) +const j : bool = true; + +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o && j)) { + _ = 1; + } } diff --git a/test/tint/var/override/named/no_init/f32.wgsl b/test/tint/var/override/named/no_init/f32.wgsl index 75b08411e2..fa827f9c80 100644 --- a/test/tint/var/override/named/no_init/f32.wgsl +++ b/test/tint/var/override/named/no_init/f32.wgsl @@ -1,7 +1,9 @@ -// flags: --overrides WGSL_SPEC_CONSTANT_0=0 +// flags: --overrides o=0 override o : f32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 0.0 { + _ = 1; + } } diff --git a/test/tint/var/override/named/no_init/f32.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/no_init/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/named/no_init/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/named/no_init/f32.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/no_init/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/named/no_init/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/named/no_init/f32.wgsl.expected.glsl b/test/tint/var/override/named/no_init/f32.wgsl.expected.glsl index bb100addb6..3d082fd3e3 100644 --- a/test/tint/var/override/named/no_init/f32.wgsl.expected.glsl +++ b/test/tint/var/override/named/no_init/f32.wgsl.expected.glsl @@ -1,12 +1,8 @@ -SKIP: FAILED - #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#error spec constant required for constant id 0 -#endif -const float o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + if ((0.0f == 0.0f)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -14,11 +10,3 @@ void main() { tint_symbol(); return; } -Error parsing GLSL shader: -ERROR: 0:4: '#error' : spec constant required for constant id 0 -ERROR: 0:5: '' : missing #endif -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/var/override/named/no_init/f32.wgsl.expected.hlsl b/test/tint/var/override/named/no_init/f32.wgsl.expected.hlsl deleted file mode 100644 index 34bec48685..0000000000 --- a/test/tint/var/override/named/no_init/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#error spec constant required for constant id 0 -#endif -static const float o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/no_init/f32.wgsl.expected.msl b/test/tint/var/override/named/no_init/f32.wgsl.expected.msl index ecf89c4c91..ecda7f6a64 100644 --- a/test/tint/var/override/named/no_init/f32.wgsl.expected.msl +++ b/test/tint/var/override/named/no_init/f32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant float o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((0.0f == 0.0f)) { + } return; } diff --git a/test/tint/var/override/named/no_init/f32.wgsl.expected.spvasm b/test/tint/var/override/named/no_init/f32.wgsl.expected.spvasm index 7ae9060492..9190d7bd41 100644 --- a/test/tint/var/override/named/no_init/f32.wgsl.expected.spvasm +++ b/test/tint/var/override/named/no_init/f32.wgsl.expected.spvasm @@ -1,20 +1,25 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 11 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %float = OpTypeFloat 32 - %o = OpSpecConstant %float 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %6 = OpConstantNull %float + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %7 = OpFOrdEqual %bool %6 %6 + OpSelectionMerge %9 None + OpBranchConditional %7 %10 %9 + %10 = OpLabel + OpBranch %9 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/no_init/f32.wgsl.expected.wgsl b/test/tint/var/override/named/no_init/f32.wgsl.expected.wgsl index bf38cdd930..362776f333 100644 --- a/test/tint/var/override/named/no_init/f32.wgsl.expected.wgsl +++ b/test/tint/var/override/named/no_init/f32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -override o : f32; +const o : f32 = 0.0f; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 0.0)) { + _ = 1; + } } diff --git a/test/tint/var/override/named/no_init/i32.wgsl b/test/tint/var/override/named/no_init/i32.wgsl index 847fb278a3..d78b6e7c66 100644 --- a/test/tint/var/override/named/no_init/i32.wgsl +++ b/test/tint/var/override/named/no_init/i32.wgsl @@ -1,7 +1,9 @@ -// flags: --overrides WGSL_SPEC_CONSTANT_0=0 +// flags: --overrides o=0 override o : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 1 { + _ = o; + } } diff --git a/test/tint/var/override/named/no_init/i32.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/no_init/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d384517be6 --- /dev/null +++ b/test/tint/var/override/named/no_init/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 1)) { + } + return; +} diff --git a/test/tint/var/override/named/no_init/i32.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/no_init/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d384517be6 --- /dev/null +++ b/test/tint/var/override/named/no_init/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 1)) { + } + return; +} diff --git a/test/tint/var/override/named/no_init/i32.wgsl.expected.glsl b/test/tint/var/override/named/no_init/i32.wgsl.expected.glsl index e443a44f4f..aadd0384bb 100644 --- a/test/tint/var/override/named/no_init/i32.wgsl.expected.glsl +++ b/test/tint/var/override/named/no_init/i32.wgsl.expected.glsl @@ -1,12 +1,8 @@ -SKIP: FAILED - #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#error spec constant required for constant id 0 -#endif -const int o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + if ((0 == 1)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -14,11 +10,3 @@ void main() { tint_symbol(); return; } -Error parsing GLSL shader: -ERROR: 0:4: '#error' : spec constant required for constant id 0 -ERROR: 0:5: '' : missing #endif -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/var/override/named/no_init/i32.wgsl.expected.hlsl b/test/tint/var/override/named/no_init/i32.wgsl.expected.hlsl deleted file mode 100644 index 034990e973..0000000000 --- a/test/tint/var/override/named/no_init/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#error spec constant required for constant id 0 -#endif -static const int o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/no_init/i32.wgsl.expected.msl b/test/tint/var/override/named/no_init/i32.wgsl.expected.msl index 6df39feed4..4bcde5e5ec 100644 --- a/test/tint/var/override/named/no_init/i32.wgsl.expected.msl +++ b/test/tint/var/override/named/no_init/i32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant int o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((0 == 1)) { + } return; } diff --git a/test/tint/var/override/named/no_init/i32.wgsl.expected.spvasm b/test/tint/var/override/named/no_init/i32.wgsl.expected.spvasm index 18c8840440..74678ef974 100644 --- a/test/tint/var/override/named/no_init/i32.wgsl.expected.spvasm +++ b/test/tint/var/override/named/no_init/i32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %int = OpTypeInt 32 1 - %o = OpSpecConstant %int 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %6 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %int_1 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/no_init/i32.wgsl.expected.wgsl b/test/tint/var/override/named/no_init/i32.wgsl.expected.wgsl index 95d395c9e9..88b26b31eb 100644 --- a/test/tint/var/override/named/no_init/i32.wgsl.expected.wgsl +++ b/test/tint/var/override/named/no_init/i32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -override o : i32; +const o : i32 = 0i; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 1)) { + _ = o; + } } diff --git a/test/tint/var/override/named/no_init/u32.wgsl b/test/tint/var/override/named/no_init/u32.wgsl index a56cecbec2..e69b91b73e 100644 --- a/test/tint/var/override/named/no_init/u32.wgsl +++ b/test/tint/var/override/named/no_init/u32.wgsl @@ -1,7 +1,9 @@ -// flags: --overrides WGSL_SPEC_CONSTANT_0=0 +// flags: --overrides o=0 override o : u32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 1 { + _ = o; + } } diff --git a/test/tint/var/override/named/no_init/u32.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/no_init/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe084141f7 --- /dev/null +++ b/test/tint/var/override/named/no_init/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 1u)) { + } + return; +} diff --git a/test/tint/var/override/named/no_init/u32.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/no_init/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe084141f7 --- /dev/null +++ b/test/tint/var/override/named/no_init/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 1u)) { + } + return; +} diff --git a/test/tint/var/override/named/no_init/u32.wgsl.expected.glsl b/test/tint/var/override/named/no_init/u32.wgsl.expected.glsl index ba68f323bd..368da7abbf 100644 --- a/test/tint/var/override/named/no_init/u32.wgsl.expected.glsl +++ b/test/tint/var/override/named/no_init/u32.wgsl.expected.glsl @@ -1,12 +1,8 @@ -SKIP: FAILED - #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#error spec constant required for constant id 0 -#endif -const uint o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + if ((0u == 1u)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -14,11 +10,3 @@ void main() { tint_symbol(); return; } -Error parsing GLSL shader: -ERROR: 0:4: '#error' : spec constant required for constant id 0 -ERROR: 0:5: '' : missing #endif -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/var/override/named/no_init/u32.wgsl.expected.hlsl b/test/tint/var/override/named/no_init/u32.wgsl.expected.hlsl deleted file mode 100644 index fb48bbafcf..0000000000 --- a/test/tint/var/override/named/no_init/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#error spec constant required for constant id 0 -#endif -static const uint o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/no_init/u32.wgsl.expected.msl b/test/tint/var/override/named/no_init/u32.wgsl.expected.msl index 8254bed60e..641561bdc7 100644 --- a/test/tint/var/override/named/no_init/u32.wgsl.expected.msl +++ b/test/tint/var/override/named/no_init/u32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant uint o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((0u == 1u)) { + } return; } diff --git a/test/tint/var/override/named/no_init/u32.wgsl.expected.spvasm b/test/tint/var/override/named/no_init/u32.wgsl.expected.spvasm index e5486b0dfb..fa0711ab91 100644 --- a/test/tint/var/override/named/no_init/u32.wgsl.expected.spvasm +++ b/test/tint/var/override/named/no_init/u32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %uint = OpTypeInt 32 0 - %o = OpSpecConstant %uint 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %6 = OpConstantNull %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %uint_1 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/no_init/u32.wgsl.expected.wgsl b/test/tint/var/override/named/no_init/u32.wgsl.expected.wgsl index 8d79972804..b7ac534cc5 100644 --- a/test/tint/var/override/named/no_init/u32.wgsl.expected.wgsl +++ b/test/tint/var/override/named/no_init/u32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -override o : u32; +const o : u32 = 0u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 1)) { + _ = o; + } } diff --git a/test/tint/var/override/named/val_init/bool.wgsl b/test/tint/var/override/named/val_init/bool.wgsl index 8eaca90b85..7d35a70c03 100644 --- a/test/tint/var/override/named/val_init/bool.wgsl +++ b/test/tint/var/override/named/val_init/bool.wgsl @@ -1,6 +1,10 @@ +// flags: --overrides o=0,j=1 override o : bool = true; +override j : bool = false; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o && j { + _ = o; + } } diff --git a/test/tint/var/override/named/val_init/bool.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/val_init/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fba945b8e2 --- /dev/null +++ b/test/tint/var/override/named/val_init/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void main() { + bool tint_tmp = false; + if (tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + } + return; +} diff --git a/test/tint/var/override/named/val_init/bool.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/val_init/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fba945b8e2 --- /dev/null +++ b/test/tint/var/override/named/val_init/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void main() { + bool tint_tmp = false; + if (tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + } + return; +} diff --git a/test/tint/var/override/named/val_init/bool.wgsl.expected.glsl b/test/tint/var/override/named/val_init/bool.wgsl.expected.glsl index 06d171d4ba..677dd8d573 100644 --- a/test/tint/var/override/named/val_init/bool.wgsl.expected.glsl +++ b/test/tint/var/override/named/val_init/bool.wgsl.expected.glsl @@ -1,10 +1,12 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 true -#endif -const bool o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + bool tint_tmp = false; + if (tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/named/val_init/bool.wgsl.expected.hlsl b/test/tint/var/override/named/val_init/bool.wgsl.expected.hlsl deleted file mode 100644 index e4ba79005c..0000000000 --- a/test/tint/var/override/named/val_init/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 true -#endif -static const bool o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/val_init/bool.wgsl.expected.msl b/test/tint/var/override/named/val_init/bool.wgsl.expected.msl index 014e3b1fd3..c502139d39 100644 --- a/test/tint/var/override/named/val_init/bool.wgsl.expected.msl +++ b/test/tint/var/override/named/val_init/bool.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant bool o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((false && true)) { + } return; } diff --git a/test/tint/var/override/named/val_init/bool.wgsl.expected.spvasm b/test/tint/var/override/named/val_init/bool.wgsl.expected.spvasm index 277782e3ef..3c8eb1b1e5 100644 --- a/test/tint/var/override/named/val_init/bool.wgsl.expected.spvasm +++ b/test/tint/var/override/named/val_init/bool.wgsl.expected.spvasm @@ -1,20 +1,30 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 13 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %bool = OpTypeBool - %o = OpSpecConstantTrue %bool %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %bool = OpTypeBool + %6 = OpConstantNull %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %1 + %4 = OpLabel + OpSelectionMerge %7 None + OpBranchConditional %6 %8 %7 + %8 = OpLabel + OpBranch %7 + %7 = OpLabel + %10 = OpPhi %bool %6 %4 %true %8 + OpSelectionMerge %11 None + OpBranchConditional %10 %12 %11 + %12 = OpLabel + OpBranch %11 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/val_init/bool.wgsl.expected.wgsl b/test/tint/var/override/named/val_init/bool.wgsl.expected.wgsl index 02f5b7d2d9..c6e8c19d7c 100644 --- a/test/tint/var/override/named/val_init/bool.wgsl.expected.wgsl +++ b/test/tint/var/override/named/val_init/bool.wgsl.expected.wgsl @@ -1,6 +1,10 @@ -override o : bool = true; +const o : bool = false; -@stage(compute) @workgroup_size(1) +const j : bool = true; + +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o && j)) { + _ = o; + } } diff --git a/test/tint/var/override/named/val_init/f32.wgsl b/test/tint/var/override/named/val_init/f32.wgsl index 0f718e87a3..4a7f3db11f 100644 --- a/test/tint/var/override/named/val_init/f32.wgsl +++ b/test/tint/var/override/named/val_init/f32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides o=0 override o : f32 = 1.0; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 0.0 { + _ = o; + } } diff --git a/test/tint/var/override/named/val_init/f32.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/val_init/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/named/val_init/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/named/val_init/f32.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/val_init/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/named/val_init/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/named/val_init/f32.wgsl.expected.glsl b/test/tint/var/override/named/val_init/f32.wgsl.expected.glsl index 62ee1b4236..3d082fd3e3 100644 --- a/test/tint/var/override/named/val_init/f32.wgsl.expected.glsl +++ b/test/tint/var/override/named/val_init/f32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 1.0f -#endif -const float o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + if ((0.0f == 0.0f)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/named/val_init/f32.wgsl.expected.hlsl b/test/tint/var/override/named/val_init/f32.wgsl.expected.hlsl deleted file mode 100644 index 9d0794c1af..0000000000 --- a/test/tint/var/override/named/val_init/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 1.0f -#endif -static const float o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/val_init/f32.wgsl.expected.msl b/test/tint/var/override/named/val_init/f32.wgsl.expected.msl index ecf89c4c91..ecda7f6a64 100644 --- a/test/tint/var/override/named/val_init/f32.wgsl.expected.msl +++ b/test/tint/var/override/named/val_init/f32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant float o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((0.0f == 0.0f)) { + } return; } diff --git a/test/tint/var/override/named/val_init/f32.wgsl.expected.spvasm b/test/tint/var/override/named/val_init/f32.wgsl.expected.spvasm index d5ce59ae6e..9190d7bd41 100644 --- a/test/tint/var/override/named/val_init/f32.wgsl.expected.spvasm +++ b/test/tint/var/override/named/val_init/f32.wgsl.expected.spvasm @@ -1,20 +1,25 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 11 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %float = OpTypeFloat 32 - %o = OpSpecConstant %float 1 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %6 = OpConstantNull %float + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %7 = OpFOrdEqual %bool %6 %6 + OpSelectionMerge %9 None + OpBranchConditional %7 %10 %9 + %10 = OpLabel + OpBranch %9 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/val_init/f32.wgsl.expected.wgsl b/test/tint/var/override/named/val_init/f32.wgsl.expected.wgsl index 1c53942f13..80171943a9 100644 --- a/test/tint/var/override/named/val_init/f32.wgsl.expected.wgsl +++ b/test/tint/var/override/named/val_init/f32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -override o : f32 = 1.0; +const o : f32 = 0.0f; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 0.0)) { + _ = o; + } } diff --git a/test/tint/var/override/named/val_init/i32.wgsl b/test/tint/var/override/named/val_init/i32.wgsl index 9f4b021ed1..1acc5a1cbd 100644 --- a/test/tint/var/override/named/val_init/i32.wgsl +++ b/test/tint/var/override/named/val_init/i32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides o=0 override o : i32 = 1; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 2 { + _ = o; + } } diff --git a/test/tint/var/override/named/val_init/i32.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/val_init/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21744ce5ca --- /dev/null +++ b/test/tint/var/override/named/val_init/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 2)) { + } + return; +} diff --git a/test/tint/var/override/named/val_init/i32.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/val_init/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21744ce5ca --- /dev/null +++ b/test/tint/var/override/named/val_init/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 2)) { + } + return; +} diff --git a/test/tint/var/override/named/val_init/i32.wgsl.expected.glsl b/test/tint/var/override/named/val_init/i32.wgsl.expected.glsl index 299dbaef3b..e6f817c290 100644 --- a/test/tint/var/override/named/val_init/i32.wgsl.expected.glsl +++ b/test/tint/var/override/named/val_init/i32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 1 -#endif -const int o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + if ((0 == 2)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/named/val_init/i32.wgsl.expected.hlsl b/test/tint/var/override/named/val_init/i32.wgsl.expected.hlsl deleted file mode 100644 index fa2861c472..0000000000 --- a/test/tint/var/override/named/val_init/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 1 -#endif -static const int o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/val_init/i32.wgsl.expected.msl b/test/tint/var/override/named/val_init/i32.wgsl.expected.msl index 6df39feed4..4563b8d153 100644 --- a/test/tint/var/override/named/val_init/i32.wgsl.expected.msl +++ b/test/tint/var/override/named/val_init/i32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant int o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((0 == 2)) { + } return; } diff --git a/test/tint/var/override/named/val_init/i32.wgsl.expected.spvasm b/test/tint/var/override/named/val_init/i32.wgsl.expected.spvasm index 7d30d25b6e..5e40713526 100644 --- a/test/tint/var/override/named/val_init/i32.wgsl.expected.spvasm +++ b/test/tint/var/override/named/val_init/i32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %int = OpTypeInt 32 1 - %o = OpSpecConstant %int 1 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %6 = OpConstantNull %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %int_2 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/val_init/i32.wgsl.expected.wgsl b/test/tint/var/override/named/val_init/i32.wgsl.expected.wgsl index f36ff37a32..6675efccb5 100644 --- a/test/tint/var/override/named/val_init/i32.wgsl.expected.wgsl +++ b/test/tint/var/override/named/val_init/i32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -override o : i32 = 1; +const o : i32 = 0i; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 2)) { + _ = o; + } } diff --git a/test/tint/var/override/named/val_init/u32.wgsl b/test/tint/var/override/named/val_init/u32.wgsl index 77ca84c4ad..a4e4f65d96 100644 --- a/test/tint/var/override/named/val_init/u32.wgsl +++ b/test/tint/var/override/named/val_init/u32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides o=0 override o : u32 = 1u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 2 { + _ = o; + } } diff --git a/test/tint/var/override/named/val_init/u32.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/val_init/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b51955d36d --- /dev/null +++ b/test/tint/var/override/named/val_init/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 2u)) { + } + return; +} diff --git a/test/tint/var/override/named/val_init/u32.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/val_init/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b51955d36d --- /dev/null +++ b/test/tint/var/override/named/val_init/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 2u)) { + } + return; +} diff --git a/test/tint/var/override/named/val_init/u32.wgsl.expected.glsl b/test/tint/var/override/named/val_init/u32.wgsl.expected.glsl index e1067f0375..b19260b440 100644 --- a/test/tint/var/override/named/val_init/u32.wgsl.expected.glsl +++ b/test/tint/var/override/named/val_init/u32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 1u -#endif -const uint o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + if ((0u == 2u)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/named/val_init/u32.wgsl.expected.hlsl b/test/tint/var/override/named/val_init/u32.wgsl.expected.hlsl deleted file mode 100644 index 9529784468..0000000000 --- a/test/tint/var/override/named/val_init/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 1u -#endif -static const uint o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/val_init/u32.wgsl.expected.msl b/test/tint/var/override/named/val_init/u32.wgsl.expected.msl index 8254bed60e..d5f3f223da 100644 --- a/test/tint/var/override/named/val_init/u32.wgsl.expected.msl +++ b/test/tint/var/override/named/val_init/u32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant uint o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((0u == 2u)) { + } return; } diff --git a/test/tint/var/override/named/val_init/u32.wgsl.expected.spvasm b/test/tint/var/override/named/val_init/u32.wgsl.expected.spvasm index 93718f11d9..4212d43c39 100644 --- a/test/tint/var/override/named/val_init/u32.wgsl.expected.spvasm +++ b/test/tint/var/override/named/val_init/u32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %uint = OpTypeInt 32 0 - %o = OpSpecConstant %uint 1 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %6 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %uint_2 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/val_init/u32.wgsl.expected.wgsl b/test/tint/var/override/named/val_init/u32.wgsl.expected.wgsl index 4a56f44644..020319ae6b 100644 --- a/test/tint/var/override/named/val_init/u32.wgsl.expected.wgsl +++ b/test/tint/var/override/named/val_init/u32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -override o : u32 = 1u; +const o : u32 = 0u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 2)) { + _ = o; + } } diff --git a/test/tint/var/override/named/zero_init/bool.wgsl b/test/tint/var/override/named/zero_init/bool.wgsl index 1dff97f0d1..a29e4ab86f 100644 --- a/test/tint/var/override/named/zero_init/bool.wgsl +++ b/test/tint/var/override/named/zero_init/bool.wgsl @@ -1,6 +1,10 @@ +// flags: --overrides o=0,j=1 override o : bool = bool(); +override j : bool = bool(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o && j { + _ = o; + } } diff --git a/test/tint/var/override/named/zero_init/bool.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/zero_init/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fba945b8e2 --- /dev/null +++ b/test/tint/var/override/named/zero_init/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void main() { + bool tint_tmp = false; + if (tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + } + return; +} diff --git a/test/tint/var/override/named/zero_init/bool.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/zero_init/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fba945b8e2 --- /dev/null +++ b/test/tint/var/override/named/zero_init/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void main() { + bool tint_tmp = false; + if (tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + } + return; +} diff --git a/test/tint/var/override/named/zero_init/bool.wgsl.expected.glsl b/test/tint/var/override/named/zero_init/bool.wgsl.expected.glsl index 1d946b4672..677dd8d573 100644 --- a/test/tint/var/override/named/zero_init/bool.wgsl.expected.glsl +++ b/test/tint/var/override/named/zero_init/bool.wgsl.expected.glsl @@ -1,10 +1,12 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 false -#endif -const bool o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + bool tint_tmp = false; + if (tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/named/zero_init/bool.wgsl.expected.hlsl b/test/tint/var/override/named/zero_init/bool.wgsl.expected.hlsl deleted file mode 100644 index d14a339663..0000000000 --- a/test/tint/var/override/named/zero_init/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 false -#endif -static const bool o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/zero_init/bool.wgsl.expected.msl b/test/tint/var/override/named/zero_init/bool.wgsl.expected.msl index 014e3b1fd3..c502139d39 100644 --- a/test/tint/var/override/named/zero_init/bool.wgsl.expected.msl +++ b/test/tint/var/override/named/zero_init/bool.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant bool o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((false && true)) { + } return; } diff --git a/test/tint/var/override/named/zero_init/bool.wgsl.expected.spvasm b/test/tint/var/override/named/zero_init/bool.wgsl.expected.spvasm index ff12e004f7..3c8eb1b1e5 100644 --- a/test/tint/var/override/named/zero_init/bool.wgsl.expected.spvasm +++ b/test/tint/var/override/named/zero_init/bool.wgsl.expected.spvasm @@ -1,20 +1,30 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 13 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %bool = OpTypeBool - %o = OpSpecConstantFalse %bool %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %bool = OpTypeBool + %6 = OpConstantNull %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %1 + %4 = OpLabel + OpSelectionMerge %7 None + OpBranchConditional %6 %8 %7 + %8 = OpLabel + OpBranch %7 + %7 = OpLabel + %10 = OpPhi %bool %6 %4 %true %8 + OpSelectionMerge %11 None + OpBranchConditional %10 %12 %11 + %12 = OpLabel + OpBranch %11 + %11 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/zero_init/bool.wgsl.expected.wgsl b/test/tint/var/override/named/zero_init/bool.wgsl.expected.wgsl index cfd341ee0e..c6e8c19d7c 100644 --- a/test/tint/var/override/named/zero_init/bool.wgsl.expected.wgsl +++ b/test/tint/var/override/named/zero_init/bool.wgsl.expected.wgsl @@ -1,6 +1,10 @@ -override o : bool = bool(); +const o : bool = false; -@stage(compute) @workgroup_size(1) +const j : bool = true; + +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o && j)) { + _ = o; + } } diff --git a/test/tint/var/override/named/zero_init/f32.wgsl b/test/tint/var/override/named/zero_init/f32.wgsl index c4f949ab58..7c41ef3c99 100644 --- a/test/tint/var/override/named/zero_init/f32.wgsl +++ b/test/tint/var/override/named/zero_init/f32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides o=0 override o : f32 = f32(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 0.0 { + _ = o; + } } diff --git a/test/tint/var/override/named/zero_init/f32.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/zero_init/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/named/zero_init/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/named/zero_init/f32.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/zero_init/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/named/zero_init/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/named/zero_init/f32.wgsl.expected.glsl b/test/tint/var/override/named/zero_init/f32.wgsl.expected.glsl index 73ed75be79..3d082fd3e3 100644 --- a/test/tint/var/override/named/zero_init/f32.wgsl.expected.glsl +++ b/test/tint/var/override/named/zero_init/f32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 0.0f -#endif -const float o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + if ((0.0f == 0.0f)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/named/zero_init/f32.wgsl.expected.hlsl b/test/tint/var/override/named/zero_init/f32.wgsl.expected.hlsl deleted file mode 100644 index 5ae59a4ccf..0000000000 --- a/test/tint/var/override/named/zero_init/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 0.0f -#endif -static const float o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/zero_init/f32.wgsl.expected.msl b/test/tint/var/override/named/zero_init/f32.wgsl.expected.msl index ecf89c4c91..ecda7f6a64 100644 --- a/test/tint/var/override/named/zero_init/f32.wgsl.expected.msl +++ b/test/tint/var/override/named/zero_init/f32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant float o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((0.0f == 0.0f)) { + } return; } diff --git a/test/tint/var/override/named/zero_init/f32.wgsl.expected.spvasm b/test/tint/var/override/named/zero_init/f32.wgsl.expected.spvasm index 7ae9060492..9190d7bd41 100644 --- a/test/tint/var/override/named/zero_init/f32.wgsl.expected.spvasm +++ b/test/tint/var/override/named/zero_init/f32.wgsl.expected.spvasm @@ -1,20 +1,25 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 11 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %float = OpTypeFloat 32 - %o = OpSpecConstant %float 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %6 = OpConstantNull %float + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %7 = OpFOrdEqual %bool %6 %6 + OpSelectionMerge %9 None + OpBranchConditional %7 %10 %9 + %10 = OpLabel + OpBranch %9 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/zero_init/f32.wgsl.expected.wgsl b/test/tint/var/override/named/zero_init/f32.wgsl.expected.wgsl index 159b6a90c5..80171943a9 100644 --- a/test/tint/var/override/named/zero_init/f32.wgsl.expected.wgsl +++ b/test/tint/var/override/named/zero_init/f32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -override o : f32 = f32(); +const o : f32 = 0.0f; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 0.0)) { + _ = o; + } } diff --git a/test/tint/var/override/named/zero_init/i32.wgsl b/test/tint/var/override/named/zero_init/i32.wgsl index 2b44da76ea..6a8fc527ce 100644 --- a/test/tint/var/override/named/zero_init/i32.wgsl +++ b/test/tint/var/override/named/zero_init/i32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides o=0 override o : i32 = i32(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 2 { + _ = o; + } } diff --git a/test/tint/var/override/named/zero_init/i32.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/zero_init/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..21744ce5ca --- /dev/null +++ b/test/tint/var/override/named/zero_init/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 2)) { + } + return; +} diff --git a/test/tint/var/override/named/zero_init/i32.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/zero_init/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..21744ce5ca --- /dev/null +++ b/test/tint/var/override/named/zero_init/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 2)) { + } + return; +} diff --git a/test/tint/var/override/named/zero_init/i32.wgsl.expected.glsl b/test/tint/var/override/named/zero_init/i32.wgsl.expected.glsl index d222d52e23..e6f817c290 100644 --- a/test/tint/var/override/named/zero_init/i32.wgsl.expected.glsl +++ b/test/tint/var/override/named/zero_init/i32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 0 -#endif -const int o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + if ((0 == 2)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/named/zero_init/i32.wgsl.expected.hlsl b/test/tint/var/override/named/zero_init/i32.wgsl.expected.hlsl deleted file mode 100644 index 6af794b4cb..0000000000 --- a/test/tint/var/override/named/zero_init/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 0 -#endif -static const int o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/zero_init/i32.wgsl.expected.msl b/test/tint/var/override/named/zero_init/i32.wgsl.expected.msl index 6df39feed4..4563b8d153 100644 --- a/test/tint/var/override/named/zero_init/i32.wgsl.expected.msl +++ b/test/tint/var/override/named/zero_init/i32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant int o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((0 == 2)) { + } return; } diff --git a/test/tint/var/override/named/zero_init/i32.wgsl.expected.spvasm b/test/tint/var/override/named/zero_init/i32.wgsl.expected.spvasm index 18c8840440..5e40713526 100644 --- a/test/tint/var/override/named/zero_init/i32.wgsl.expected.spvasm +++ b/test/tint/var/override/named/zero_init/i32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %int = OpTypeInt 32 1 - %o = OpSpecConstant %int 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %6 = OpConstantNull %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %int_2 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/zero_init/i32.wgsl.expected.wgsl b/test/tint/var/override/named/zero_init/i32.wgsl.expected.wgsl index e02284c769..6675efccb5 100644 --- a/test/tint/var/override/named/zero_init/i32.wgsl.expected.wgsl +++ b/test/tint/var/override/named/zero_init/i32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -override o : i32 = i32(); +const o : i32 = 0i; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 2)) { + _ = o; + } } diff --git a/test/tint/var/override/named/zero_init/u32.wgsl b/test/tint/var/override/named/zero_init/u32.wgsl index de11d5a9c0..84f53a44b1 100644 --- a/test/tint/var/override/named/zero_init/u32.wgsl +++ b/test/tint/var/override/named/zero_init/u32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides o=0 override o : u32 = u32(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 2 { + _ = o; + } } diff --git a/test/tint/var/override/named/zero_init/u32.wgsl.expected.dxc.hlsl b/test/tint/var/override/named/zero_init/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b51955d36d --- /dev/null +++ b/test/tint/var/override/named/zero_init/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 2u)) { + } + return; +} diff --git a/test/tint/var/override/named/zero_init/u32.wgsl.expected.fxc.hlsl b/test/tint/var/override/named/zero_init/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b51955d36d --- /dev/null +++ b/test/tint/var/override/named/zero_init/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 2u)) { + } + return; +} diff --git a/test/tint/var/override/named/zero_init/u32.wgsl.expected.glsl b/test/tint/var/override/named/zero_init/u32.wgsl.expected.glsl index 76638469b9..b19260b440 100644 --- a/test/tint/var/override/named/zero_init/u32.wgsl.expected.glsl +++ b/test/tint/var/override/named/zero_init/u32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 0u -#endif -const uint o = WGSL_SPEC_CONSTANT_0; void tint_symbol() { + if ((0u == 2u)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/named/zero_init/u32.wgsl.expected.hlsl b/test/tint/var/override/named/zero_init/u32.wgsl.expected.hlsl deleted file mode 100644 index 17f5ddf612..0000000000 --- a/test/tint/var/override/named/zero_init/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_0 -#define WGSL_SPEC_CONSTANT_0 0u -#endif -static const uint o = WGSL_SPEC_CONSTANT_0; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/named/zero_init/u32.wgsl.expected.msl b/test/tint/var/override/named/zero_init/u32.wgsl.expected.msl index 8254bed60e..d5f3f223da 100644 --- a/test/tint/var/override/named/zero_init/u32.wgsl.expected.msl +++ b/test/tint/var/override/named/zero_init/u32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant uint o [[function_constant(0)]]; - kernel void tint_symbol() { + if ((0u == 2u)) { + } return; } diff --git a/test/tint/var/override/named/zero_init/u32.wgsl.expected.spvasm b/test/tint/var/override/named/zero_init/u32.wgsl.expected.spvasm index e5486b0dfb..4212d43c39 100644 --- a/test/tint/var/override/named/zero_init/u32.wgsl.expected.spvasm +++ b/test/tint/var/override/named/zero_init/u32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 0 - %uint = OpTypeInt 32 0 - %o = OpSpecConstant %uint 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %6 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %uint_2 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/named/zero_init/u32.wgsl.expected.wgsl b/test/tint/var/override/named/zero_init/u32.wgsl.expected.wgsl index 62250f44b1..020319ae6b 100644 --- a/test/tint/var/override/named/zero_init/u32.wgsl.expected.wgsl +++ b/test/tint/var/override/named/zero_init/u32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -override o : u32 = u32(); +const o : u32 = 0u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 2)) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/no_init/bool.wgsl b/test/tint/var/override/numbered/no_init/bool.wgsl index 34818a18f5..ded2aa4e55 100644 --- a/test/tint/var/override/numbered/no_init/bool.wgsl +++ b/test/tint/var/override/numbered/no_init/bool.wgsl @@ -1,7 +1,9 @@ -// flags: --overrides WGSL_SPEC_CONSTANT_1234=0 +// flags: --overrides 1234=0 @id(1234) override o : bool; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o { + _ = o; + } } diff --git a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af95aed96e --- /dev/null +++ b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if (false) { + } + return; +} diff --git a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af95aed96e --- /dev/null +++ b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if (false) { + } + return; +} diff --git a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.glsl b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.glsl index 2e5beb9985..94d2bb42ca 100644 --- a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.glsl @@ -1,12 +1,8 @@ -SKIP: FAILED - #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#error spec constant required for constant id 1234 -#endif -const bool o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if (false) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -14,11 +10,3 @@ void main() { tint_symbol(); return; } -Error parsing GLSL shader: -ERROR: 0:4: '#error' : spec constant required for constant id 1234 -ERROR: 0:5: '' : missing #endif -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.hlsl b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.hlsl deleted file mode 100644 index fd25726f1a..0000000000 --- a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#error spec constant required for constant id 1234 -#endif -static const bool o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.msl b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.msl index 28e456b41b..6fa26c20be 100644 --- a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.msl +++ b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant bool o [[function_constant(1234)]]; - kernel void tint_symbol() { + if (false) { + } return; } diff --git a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.spvasm b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.spvasm index b1169e6faa..14d2a40e27 100644 --- a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.spvasm @@ -1,20 +1,23 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 9 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %bool = OpTypeBool - %o = OpSpecConstantFalse %bool %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %bool = OpTypeBool + %6 = OpConstantNull %bool + %main = OpFunction %void None %1 + %4 = OpLabel + OpSelectionMerge %7 None + OpBranchConditional %6 %8 %7 + %8 = OpLabel + OpBranch %7 + %7 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.wgsl b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.wgsl index d2077c0006..f662a7e29d 100644 --- a/test/tint/var/override/numbered/no_init/bool.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/no_init/bool.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : bool; +const o : bool = false; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if (o) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/no_init/f32.wgsl b/test/tint/var/override/numbered/no_init/f32.wgsl index dde41d982d..52af3f1244 100644 --- a/test/tint/var/override/numbered/no_init/f32.wgsl +++ b/test/tint/var/override/numbered/no_init/f32.wgsl @@ -1,7 +1,9 @@ -// flags: --overrides WGSL_SPEC_CONSTANT_1234=0 +// flags: --overrides 1234=0 @id(1234) override o : f32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 0.0 { + _ = o; + } } diff --git a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.glsl b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.glsl index ef6bc78b2c..3d082fd3e3 100644 --- a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.glsl @@ -1,12 +1,8 @@ -SKIP: FAILED - #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#error spec constant required for constant id 1234 -#endif -const float o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if ((0.0f == 0.0f)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -14,11 +10,3 @@ void main() { tint_symbol(); return; } -Error parsing GLSL shader: -ERROR: 0:4: '#error' : spec constant required for constant id 1234 -ERROR: 0:5: '' : missing #endif -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.hlsl b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.hlsl deleted file mode 100644 index 2ae70421ea..0000000000 --- a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#error spec constant required for constant id 1234 -#endif -static const float o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.msl b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.msl index ce09e6ef83..ecda7f6a64 100644 --- a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.msl +++ b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant float o [[function_constant(1234)]]; - kernel void tint_symbol() { + if ((0.0f == 0.0f)) { + } return; } diff --git a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.spvasm b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.spvasm index a253f64b1c..9190d7bd41 100644 --- a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.spvasm @@ -1,20 +1,25 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 11 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %float = OpTypeFloat 32 - %o = OpSpecConstant %float 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %6 = OpConstantNull %float + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %7 = OpFOrdEqual %bool %6 %6 + OpSelectionMerge %9 None + OpBranchConditional %7 %10 %9 + %10 = OpLabel + OpBranch %9 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.wgsl b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.wgsl index 1d3c7ca79f..80171943a9 100644 --- a/test/tint/var/override/numbered/no_init/f32.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/no_init/f32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : f32; +const o : f32 = 0.0f; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 0.0)) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/no_init/i32.wgsl b/test/tint/var/override/numbered/no_init/i32.wgsl index afc07efd2d..2296dece78 100644 --- a/test/tint/var/override/numbered/no_init/i32.wgsl +++ b/test/tint/var/override/numbered/no_init/i32.wgsl @@ -1,7 +1,9 @@ -// flags: --overrides WGSL_SPEC_CONSTANT_1234=0 +// flags: --overrides 1234=0 @id(1234) override o : i32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 0 { + _ = o; + } } diff --git a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..95e256f3a8 --- /dev/null +++ b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 0)) { + } + return; +} diff --git a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95e256f3a8 --- /dev/null +++ b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 0)) { + } + return; +} diff --git a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.glsl b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.glsl index 6dabe7ff6c..9edb6dda05 100644 --- a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.glsl @@ -1,12 +1,8 @@ -SKIP: FAILED - #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#error spec constant required for constant id 1234 -#endif -const int o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if ((0 == 0)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -14,11 +10,3 @@ void main() { tint_symbol(); return; } -Error parsing GLSL shader: -ERROR: 0:4: '#error' : spec constant required for constant id 1234 -ERROR: 0:5: '' : missing #endif -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.hlsl b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.hlsl deleted file mode 100644 index a02d224038..0000000000 --- a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#error spec constant required for constant id 1234 -#endif -static const int o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.msl b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.msl index 3e8475293b..abeb66026c 100644 --- a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.msl +++ b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant int o [[function_constant(1234)]]; - kernel void tint_symbol() { + if ((0 == 0)) { + } return; } diff --git a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.spvasm b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.spvasm index aca0b07388..a26f8edc2b 100644 --- a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.spvasm @@ -1,20 +1,25 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 11 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %int = OpTypeInt 32 1 - %o = OpSpecConstant %int 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %6 = OpConstantNull %int + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %7 = OpIEqual %bool %6 %6 + OpSelectionMerge %9 None + OpBranchConditional %7 %10 %9 + %10 = OpLabel + OpBranch %9 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.wgsl b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.wgsl index 89e30497eb..04d8f90c48 100644 --- a/test/tint/var/override/numbered/no_init/i32.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/no_init/i32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : i32; +const o : i32 = 0i; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 0)) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/no_init/u32.wgsl b/test/tint/var/override/numbered/no_init/u32.wgsl index be20c985f0..c00557b200 100644 --- a/test/tint/var/override/numbered/no_init/u32.wgsl +++ b/test/tint/var/override/numbered/no_init/u32.wgsl @@ -1,7 +1,9 @@ -// flags: --overrides WGSL_SPEC_CONSTANT_1234=0 +// flags: --overrides 1234=0 @id(1234) override o : u32; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 1 { + _ = o; + } } diff --git a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe084141f7 --- /dev/null +++ b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 1u)) { + } + return; +} diff --git a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe084141f7 --- /dev/null +++ b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 1u)) { + } + return; +} diff --git a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.glsl b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.glsl index fcf949f115..368da7abbf 100644 --- a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.glsl @@ -1,12 +1,8 @@ -SKIP: FAILED - #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#error spec constant required for constant id 1234 -#endif -const uint o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if ((0u == 1u)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -14,11 +10,3 @@ void main() { tint_symbol(); return; } -Error parsing GLSL shader: -ERROR: 0:4: '#error' : spec constant required for constant id 1234 -ERROR: 0:5: '' : missing #endif -ERROR: 0:5: '' : compilation terminated -ERROR: 3 compilation errors. No code generated. - - - diff --git a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.hlsl b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.hlsl deleted file mode 100644 index 4a3a2e1cfc..0000000000 --- a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#error spec constant required for constant id 1234 -#endif -static const uint o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.msl b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.msl index 51e2d724d4..641561bdc7 100644 --- a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.msl +++ b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant uint o [[function_constant(1234)]]; - kernel void tint_symbol() { + if ((0u == 1u)) { + } return; } diff --git a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.spvasm b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.spvasm index ca38a9a94c..fa0711ab91 100644 --- a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %uint = OpTypeInt 32 0 - %o = OpSpecConstant %uint 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %6 = OpConstantNull %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %uint_1 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.wgsl b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.wgsl index d330537a46..b7ac534cc5 100644 --- a/test/tint/var/override/numbered/no_init/u32.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/no_init/u32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : u32; +const o : u32 = 0u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 1)) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/val_init/bool.wgsl b/test/tint/var/override/numbered/val_init/bool.wgsl index 815e5102d1..0d6a548b05 100644 --- a/test/tint/var/override/numbered/val_init/bool.wgsl +++ b/test/tint/var/override/numbered/val_init/bool.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides 1234=0 @id(1234) override o : bool = true; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o { + _ = o; + } } diff --git a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af95aed96e --- /dev/null +++ b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if (false) { + } + return; +} diff --git a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af95aed96e --- /dev/null +++ b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if (false) { + } + return; +} diff --git a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.glsl b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.glsl index 3b5cc68b4a..94d2bb42ca 100644 --- a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 true -#endif -const bool o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if (false) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.hlsl b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.hlsl deleted file mode 100644 index 6e189ede17..0000000000 --- a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 true -#endif -static const bool o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.msl b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.msl index 28e456b41b..6fa26c20be 100644 --- a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.msl +++ b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant bool o [[function_constant(1234)]]; - kernel void tint_symbol() { + if (false) { + } return; } diff --git a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.spvasm b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.spvasm index 060f8603f6..14d2a40e27 100644 --- a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.spvasm @@ -1,20 +1,23 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 9 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %bool = OpTypeBool - %o = OpSpecConstantTrue %bool %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %bool = OpTypeBool + %6 = OpConstantNull %bool + %main = OpFunction %void None %1 + %4 = OpLabel + OpSelectionMerge %7 None + OpBranchConditional %6 %8 %7 + %8 = OpLabel + OpBranch %7 + %7 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.wgsl b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.wgsl index 623733603a..f662a7e29d 100644 --- a/test/tint/var/override/numbered/val_init/bool.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/val_init/bool.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : bool = true; +const o : bool = false; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if (o) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/val_init/f32.wgsl b/test/tint/var/override/numbered/val_init/f32.wgsl index c565064ee9..f76de51133 100644 --- a/test/tint/var/override/numbered/val_init/f32.wgsl +++ b/test/tint/var/override/numbered/val_init/f32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides 1234=0 @id(1234) override o : f32 = 1.0; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 1 { + _ = o; + } } diff --git a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0d9f804f9d --- /dev/null +++ b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 1.0f)) { + } + return; +} diff --git a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0d9f804f9d --- /dev/null +++ b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 1.0f)) { + } + return; +} diff --git a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.glsl b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.glsl index 5d67c5f1dc..7540a29c95 100644 --- a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 1.0f -#endif -const float o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if ((0.0f == 1.0f)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.hlsl b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.hlsl deleted file mode 100644 index 4671b12b3b..0000000000 --- a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 1.0f -#endif -static const float o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.msl b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.msl index ce09e6ef83..5936a883f6 100644 --- a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.msl +++ b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant float o [[function_constant(1234)]]; - kernel void tint_symbol() { + if ((0.0f == 1.0f)) { + } return; } diff --git a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.spvasm b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.spvasm index c75755700c..704864876a 100644 --- a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %float = OpTypeFloat 32 - %o = OpSpecConstant %float 1 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %6 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpFOrdEqual %bool %6 %float_1 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.wgsl b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.wgsl index 8599cbae21..c97a28d237 100644 --- a/test/tint/var/override/numbered/val_init/f32.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/val_init/f32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : f32 = 1.0; +const o : f32 = 0.0f; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 1)) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/val_init/i32.wgsl b/test/tint/var/override/numbered/val_init/i32.wgsl index 78cb191005..6220760ced 100644 --- a/test/tint/var/override/numbered/val_init/i32.wgsl +++ b/test/tint/var/override/numbered/val_init/i32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides 1234=0 @id(1234) override o : i32 = 1; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 1 { + _ = o; + } } diff --git a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d384517be6 --- /dev/null +++ b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 1)) { + } + return; +} diff --git a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d384517be6 --- /dev/null +++ b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 1)) { + } + return; +} diff --git a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.glsl b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.glsl index 034f0daa88..aadd0384bb 100644 --- a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 1 -#endif -const int o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if ((0 == 1)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.hlsl b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.hlsl deleted file mode 100644 index cfb2fd9371..0000000000 --- a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 1 -#endif -static const int o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.msl b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.msl index 3e8475293b..4bcde5e5ec 100644 --- a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.msl +++ b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant int o [[function_constant(1234)]]; - kernel void tint_symbol() { + if ((0 == 1)) { + } return; } diff --git a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.spvasm b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.spvasm index f66889a42e..74678ef974 100644 --- a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %int = OpTypeInt 32 1 - %o = OpSpecConstant %int 1 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %6 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %int_1 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.wgsl b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.wgsl index 062ca36492..88b26b31eb 100644 --- a/test/tint/var/override/numbered/val_init/i32.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/val_init/i32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : i32 = 1; +const o : i32 = 0i; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 1)) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/val_init/u32.wgsl b/test/tint/var/override/numbered/val_init/u32.wgsl index bbc740930e..e28df648b0 100644 --- a/test/tint/var/override/numbered/val_init/u32.wgsl +++ b/test/tint/var/override/numbered/val_init/u32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides 1234=0 @id(1234) override o : u32 = 1u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 1 { + _ = o; + } } diff --git a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe084141f7 --- /dev/null +++ b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 1u)) { + } + return; +} diff --git a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe084141f7 --- /dev/null +++ b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 1u)) { + } + return; +} diff --git a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.glsl b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.glsl index 2b50d92d67..368da7abbf 100644 --- a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 1u -#endif -const uint o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if ((0u == 1u)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.hlsl b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.hlsl deleted file mode 100644 index 36437dd9e2..0000000000 --- a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 1u -#endif -static const uint o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.msl b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.msl index 51e2d724d4..641561bdc7 100644 --- a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.msl +++ b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant uint o [[function_constant(1234)]]; - kernel void tint_symbol() { + if ((0u == 1u)) { + } return; } diff --git a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.spvasm b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.spvasm index 2b51d1ce62..fa0711ab91 100644 --- a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %uint = OpTypeInt 32 0 - %o = OpSpecConstant %uint 1 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %6 = OpConstantNull %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %uint_1 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.wgsl b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.wgsl index 8a65ad64a0..b7ac534cc5 100644 --- a/test/tint/var/override/numbered/val_init/u32.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/val_init/u32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : u32 = 1u; +const o : u32 = 0u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 1)) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/zero_init/bool.wgsl b/test/tint/var/override/numbered/zero_init/bool.wgsl index b411e9cad7..929b2e1df3 100644 --- a/test/tint/var/override/numbered/zero_init/bool.wgsl +++ b/test/tint/var/override/numbered/zero_init/bool.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides 1234=0 @id(1234) override o : bool = bool(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o { + _ = o; + } } diff --git a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af95aed96e --- /dev/null +++ b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if (false) { + } + return; +} diff --git a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af95aed96e --- /dev/null +++ b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if (false) { + } + return; +} diff --git a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.glsl b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.glsl index 072eb92f2c..94d2bb42ca 100644 --- a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 false -#endif -const bool o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if (false) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.hlsl b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.hlsl deleted file mode 100644 index 86e9b98f87..0000000000 --- a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 false -#endif -static const bool o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.msl b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.msl index 28e456b41b..6fa26c20be 100644 --- a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.msl +++ b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant bool o [[function_constant(1234)]]; - kernel void tint_symbol() { + if (false) { + } return; } diff --git a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.spvasm b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.spvasm index b1169e6faa..14d2a40e27 100644 --- a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.spvasm @@ -1,20 +1,23 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 9 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %bool = OpTypeBool - %o = OpSpecConstantFalse %bool %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %bool = OpTypeBool + %6 = OpConstantNull %bool + %main = OpFunction %void None %1 + %4 = OpLabel + OpSelectionMerge %7 None + OpBranchConditional %6 %8 %7 + %8 = OpLabel + OpBranch %7 + %7 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.wgsl b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.wgsl index 41ae914fba..f662a7e29d 100644 --- a/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/zero_init/bool.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : bool = bool(); +const o : bool = false; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if (o) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/zero_init/f32.wgsl b/test/tint/var/override/numbered/zero_init/f32.wgsl index 92dffa4ce0..6308a76c3e 100644 --- a/test/tint/var/override/numbered/zero_init/f32.wgsl +++ b/test/tint/var/override/numbered/zero_init/f32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides 1234=0 @id(1234) override o : f32 = f32(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 0.0 { + _ = o; + } } diff --git a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e42b8fb027 --- /dev/null +++ b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0.0f == 0.0f)) { + } + return; +} diff --git a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.glsl b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.glsl index fe17e5b528..3d082fd3e3 100644 --- a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 0.0f -#endif -const float o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if ((0.0f == 0.0f)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.hlsl b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.hlsl deleted file mode 100644 index 70f868fce9..0000000000 --- a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 0.0f -#endif -static const float o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.msl b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.msl index ce09e6ef83..ecda7f6a64 100644 --- a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.msl +++ b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant float o [[function_constant(1234)]]; - kernel void tint_symbol() { + if ((0.0f == 0.0f)) { + } return; } diff --git a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.spvasm b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.spvasm index a253f64b1c..9190d7bd41 100644 --- a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.spvasm @@ -1,20 +1,25 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 11 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %float = OpTypeFloat 32 - %o = OpSpecConstant %float 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %float = OpTypeFloat 32 + %6 = OpConstantNull %float + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %7 = OpFOrdEqual %bool %6 %6 + OpSelectionMerge %9 None + OpBranchConditional %7 %10 %9 + %10 = OpLabel + OpBranch %9 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.wgsl b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.wgsl index caaafb029a..80171943a9 100644 --- a/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/zero_init/f32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : f32 = f32(); +const o : f32 = 0.0f; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 0.0)) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/zero_init/i32.wgsl b/test/tint/var/override/numbered/zero_init/i32.wgsl index 79f3f2ca26..621161e679 100644 --- a/test/tint/var/override/numbered/zero_init/i32.wgsl +++ b/test/tint/var/override/numbered/zero_init/i32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides 1234=0 @id(1234) override o : i32 = i32(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 1 { + _ = o; + } } diff --git a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d384517be6 --- /dev/null +++ b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 1)) { + } + return; +} diff --git a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d384517be6 --- /dev/null +++ b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0 == 1)) { + } + return; +} diff --git a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.glsl b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.glsl index a748cb70df..aadd0384bb 100644 --- a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 0 -#endif -const int o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if ((0 == 1)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.hlsl b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.hlsl deleted file mode 100644 index 654ffd6295..0000000000 --- a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 0 -#endif -static const int o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.msl b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.msl index 3e8475293b..4bcde5e5ec 100644 --- a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.msl +++ b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant int o [[function_constant(1234)]]; - kernel void tint_symbol() { + if ((0 == 1)) { + } return; } diff --git a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.spvasm b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.spvasm index aca0b07388..74678ef974 100644 --- a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %int = OpTypeInt 32 1 - %o = OpSpecConstant %int 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %6 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %int_1 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.wgsl b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.wgsl index f10ef51793..88b26b31eb 100644 --- a/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/zero_init/i32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : i32 = i32(); +const o : i32 = 0i; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 1)) { + _ = o; + } } diff --git a/test/tint/var/override/numbered/zero_init/u32.wgsl b/test/tint/var/override/numbered/zero_init/u32.wgsl index a0e7de6b54..fbaf795ed1 100644 --- a/test/tint/var/override/numbered/zero_init/u32.wgsl +++ b/test/tint/var/override/numbered/zero_init/u32.wgsl @@ -1,6 +1,9 @@ +// flags: --overrides 1234=0 @id(1234) override o : u32 = u32(); -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if o == 1 { + _ = o; + } } diff --git a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.dxc.hlsl b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..fe084141f7 --- /dev/null +++ b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 1u)) { + } + return; +} diff --git a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.fxc.hlsl b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe084141f7 --- /dev/null +++ b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void main() { + if ((0u == 1u)) { + } + return; +} diff --git a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.glsl b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.glsl index 85057c1473..368da7abbf 100644 --- a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.glsl +++ b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.glsl @@ -1,10 +1,8 @@ #version 310 es -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 0u -#endif -const uint o = WGSL_SPEC_CONSTANT_1234; void tint_symbol() { + if ((0u == 1u)) { + } } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.hlsl b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.hlsl deleted file mode 100644 index 2fe25d834a..0000000000 --- a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WGSL_SPEC_CONSTANT_1234 -#define WGSL_SPEC_CONSTANT_1234 0u -#endif -static const uint o = WGSL_SPEC_CONSTANT_1234; - -[numthreads(1, 1, 1)] -void main() { - return; -} diff --git a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.msl b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.msl index 51e2d724d4..641561bdc7 100644 --- a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.msl +++ b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.msl @@ -1,9 +1,9 @@ #include using namespace metal; -constant uint o [[function_constant(1234)]]; - kernel void tint_symbol() { + if ((0u == 1u)) { + } return; } diff --git a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.spvasm b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.spvasm index ca38a9a94c..fa0711ab91 100644 --- a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.spvasm +++ b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.spvasm @@ -1,20 +1,26 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 7 +; Bound: 12 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %o "o" OpName %main "main" - OpDecorate %o SpecId 1234 - %uint = OpTypeInt 32 0 - %o = OpSpecConstant %uint 0 %void = OpTypeVoid - %3 = OpTypeFunction %void - %main = OpFunction %void None %3 - %6 = OpLabel + %1 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %6 = OpConstantNull %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %main = OpFunction %void None %1 + %4 = OpLabel + %8 = OpIEqual %bool %6 %uint_1 + OpSelectionMerge %10 None + OpBranchConditional %8 %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.wgsl b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.wgsl index 710e3ebea7..b7ac534cc5 100644 --- a/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.wgsl +++ b/test/tint/var/override/numbered/zero_init/u32.wgsl.expected.wgsl @@ -1,6 +1,8 @@ -@id(1234) override o : u32 = u32(); +const o : u32 = 0u; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main() { - _ = o; + if ((o == 1)) { + _ = o; + } } diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl b/test/tint/var/uses/many_workgroup_vars.wgsl index 56df492ece..4a08679b58 100644 --- a/test/tint/var/uses/many_workgroup_vars.wgsl +++ b/test/tint/var/uses/many_workgroup_vars.wgsl @@ -99,7 +99,7 @@ var m97 : mat2x2; var m98 : mat2x2; var m99 : mat2x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn tint_symbol(@builtin(local_invocation_index) idx : u32) { m00[0][0] = 1.0; m01[0][0] = 1.0; diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.dxc.hlsl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..63d3ea3537 --- /dev/null +++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.dxc.hlsl @@ -0,0 +1,316 @@ +groupshared float2x2 m00; +groupshared float2x2 m01; +groupshared float2x2 m02; +groupshared float2x2 m03; +groupshared float2x2 m04; +groupshared float2x2 m05; +groupshared float2x2 m06; +groupshared float2x2 m07; +groupshared float2x2 m08; +groupshared float2x2 m09; +groupshared float2x2 m10; +groupshared float2x2 m11; +groupshared float2x2 m12; +groupshared float2x2 m13; +groupshared float2x2 m14; +groupshared float2x2 m15; +groupshared float2x2 m16; +groupshared float2x2 m17; +groupshared float2x2 m18; +groupshared float2x2 m19; +groupshared float2x2 m20; +groupshared float2x2 m21; +groupshared float2x2 m22; +groupshared float2x2 m23; +groupshared float2x2 m24; +groupshared float2x2 m25; +groupshared float2x2 m26; +groupshared float2x2 m27; +groupshared float2x2 m28; +groupshared float2x2 m29; +groupshared float2x2 m30; +groupshared float2x2 m31; +groupshared float2x2 m32; +groupshared float2x2 m33; +groupshared float2x2 m34; +groupshared float2x2 m35; +groupshared float2x2 m36; +groupshared float2x2 m37; +groupshared float2x2 m38; +groupshared float2x2 m39; +groupshared float2x2 m40; +groupshared float2x2 m41; +groupshared float2x2 m42; +groupshared float2x2 m43; +groupshared float2x2 m44; +groupshared float2x2 m45; +groupshared float2x2 m46; +groupshared float2x2 m47; +groupshared float2x2 m48; +groupshared float2x2 m49; +groupshared float2x2 m50; +groupshared float2x2 m51; +groupshared float2x2 m52; +groupshared float2x2 m53; +groupshared float2x2 m54; +groupshared float2x2 m55; +groupshared float2x2 m56; +groupshared float2x2 m57; +groupshared float2x2 m58; +groupshared float2x2 m59; +groupshared float2x2 m60; +groupshared float2x2 m61; +groupshared float2x2 m62; +groupshared float2x2 m63; +groupshared float2x2 m64; +groupshared float2x2 m65; +groupshared float2x2 m66; +groupshared float2x2 m67; +groupshared float2x2 m68; +groupshared float2x2 m69; +groupshared float2x2 m70; +groupshared float2x2 m71; +groupshared float2x2 m72; +groupshared float2x2 m73; +groupshared float2x2 m74; +groupshared float2x2 m75; +groupshared float2x2 m76; +groupshared float2x2 m77; +groupshared float2x2 m78; +groupshared float2x2 m79; +groupshared float2x2 m80; +groupshared float2x2 m81; +groupshared float2x2 m82; +groupshared float2x2 m83; +groupshared float2x2 m84; +groupshared float2x2 m85; +groupshared float2x2 m86; +groupshared float2x2 m87; +groupshared float2x2 m88; +groupshared float2x2 m89; +groupshared float2x2 m90; +groupshared float2x2 m91; +groupshared float2x2 m92; +groupshared float2x2 m93; +groupshared float2x2 m94; +groupshared float2x2 m95; +groupshared float2x2 m96; +groupshared float2x2 m97; +groupshared float2x2 m98; +groupshared float2x2 m99; + +struct tint_symbol_2 { + uint idx : SV_GroupIndex; +}; + +void tint_symbol_inner(uint idx) { + { + m00 = float2x2((0.0f).xx, (0.0f).xx); + m01 = float2x2((0.0f).xx, (0.0f).xx); + m02 = float2x2((0.0f).xx, (0.0f).xx); + m03 = float2x2((0.0f).xx, (0.0f).xx); + m04 = float2x2((0.0f).xx, (0.0f).xx); + m05 = float2x2((0.0f).xx, (0.0f).xx); + m06 = float2x2((0.0f).xx, (0.0f).xx); + m07 = float2x2((0.0f).xx, (0.0f).xx); + m08 = float2x2((0.0f).xx, (0.0f).xx); + m09 = float2x2((0.0f).xx, (0.0f).xx); + m10 = float2x2((0.0f).xx, (0.0f).xx); + m11 = float2x2((0.0f).xx, (0.0f).xx); + m12 = float2x2((0.0f).xx, (0.0f).xx); + m13 = float2x2((0.0f).xx, (0.0f).xx); + m14 = float2x2((0.0f).xx, (0.0f).xx); + m15 = float2x2((0.0f).xx, (0.0f).xx); + m16 = float2x2((0.0f).xx, (0.0f).xx); + m17 = float2x2((0.0f).xx, (0.0f).xx); + m18 = float2x2((0.0f).xx, (0.0f).xx); + m19 = float2x2((0.0f).xx, (0.0f).xx); + m20 = float2x2((0.0f).xx, (0.0f).xx); + m21 = float2x2((0.0f).xx, (0.0f).xx); + m22 = float2x2((0.0f).xx, (0.0f).xx); + m23 = float2x2((0.0f).xx, (0.0f).xx); + m24 = float2x2((0.0f).xx, (0.0f).xx); + m25 = float2x2((0.0f).xx, (0.0f).xx); + m26 = float2x2((0.0f).xx, (0.0f).xx); + m27 = float2x2((0.0f).xx, (0.0f).xx); + m28 = float2x2((0.0f).xx, (0.0f).xx); + m29 = float2x2((0.0f).xx, (0.0f).xx); + m30 = float2x2((0.0f).xx, (0.0f).xx); + m31 = float2x2((0.0f).xx, (0.0f).xx); + m32 = float2x2((0.0f).xx, (0.0f).xx); + m33 = float2x2((0.0f).xx, (0.0f).xx); + m34 = float2x2((0.0f).xx, (0.0f).xx); + m35 = float2x2((0.0f).xx, (0.0f).xx); + m36 = float2x2((0.0f).xx, (0.0f).xx); + m37 = float2x2((0.0f).xx, (0.0f).xx); + m38 = float2x2((0.0f).xx, (0.0f).xx); + m39 = float2x2((0.0f).xx, (0.0f).xx); + m40 = float2x2((0.0f).xx, (0.0f).xx); + m41 = float2x2((0.0f).xx, (0.0f).xx); + m42 = float2x2((0.0f).xx, (0.0f).xx); + m43 = float2x2((0.0f).xx, (0.0f).xx); + m44 = float2x2((0.0f).xx, (0.0f).xx); + m45 = float2x2((0.0f).xx, (0.0f).xx); + m46 = float2x2((0.0f).xx, (0.0f).xx); + m47 = float2x2((0.0f).xx, (0.0f).xx); + m48 = float2x2((0.0f).xx, (0.0f).xx); + m49 = float2x2((0.0f).xx, (0.0f).xx); + m50 = float2x2((0.0f).xx, (0.0f).xx); + m51 = float2x2((0.0f).xx, (0.0f).xx); + m52 = float2x2((0.0f).xx, (0.0f).xx); + m53 = float2x2((0.0f).xx, (0.0f).xx); + m54 = float2x2((0.0f).xx, (0.0f).xx); + m55 = float2x2((0.0f).xx, (0.0f).xx); + m56 = float2x2((0.0f).xx, (0.0f).xx); + m57 = float2x2((0.0f).xx, (0.0f).xx); + m58 = float2x2((0.0f).xx, (0.0f).xx); + m59 = float2x2((0.0f).xx, (0.0f).xx); + m60 = float2x2((0.0f).xx, (0.0f).xx); + m61 = float2x2((0.0f).xx, (0.0f).xx); + m62 = float2x2((0.0f).xx, (0.0f).xx); + m63 = float2x2((0.0f).xx, (0.0f).xx); + m64 = float2x2((0.0f).xx, (0.0f).xx); + m65 = float2x2((0.0f).xx, (0.0f).xx); + m66 = float2x2((0.0f).xx, (0.0f).xx); + m67 = float2x2((0.0f).xx, (0.0f).xx); + m68 = float2x2((0.0f).xx, (0.0f).xx); + m69 = float2x2((0.0f).xx, (0.0f).xx); + m70 = float2x2((0.0f).xx, (0.0f).xx); + m71 = float2x2((0.0f).xx, (0.0f).xx); + m72 = float2x2((0.0f).xx, (0.0f).xx); + m73 = float2x2((0.0f).xx, (0.0f).xx); + m74 = float2x2((0.0f).xx, (0.0f).xx); + m75 = float2x2((0.0f).xx, (0.0f).xx); + m76 = float2x2((0.0f).xx, (0.0f).xx); + m77 = float2x2((0.0f).xx, (0.0f).xx); + m78 = float2x2((0.0f).xx, (0.0f).xx); + m79 = float2x2((0.0f).xx, (0.0f).xx); + m80 = float2x2((0.0f).xx, (0.0f).xx); + m81 = float2x2((0.0f).xx, (0.0f).xx); + m82 = float2x2((0.0f).xx, (0.0f).xx); + m83 = float2x2((0.0f).xx, (0.0f).xx); + m84 = float2x2((0.0f).xx, (0.0f).xx); + m85 = float2x2((0.0f).xx, (0.0f).xx); + m86 = float2x2((0.0f).xx, (0.0f).xx); + m87 = float2x2((0.0f).xx, (0.0f).xx); + m88 = float2x2((0.0f).xx, (0.0f).xx); + m89 = float2x2((0.0f).xx, (0.0f).xx); + m90 = float2x2((0.0f).xx, (0.0f).xx); + m91 = float2x2((0.0f).xx, (0.0f).xx); + m92 = float2x2((0.0f).xx, (0.0f).xx); + m93 = float2x2((0.0f).xx, (0.0f).xx); + m94 = float2x2((0.0f).xx, (0.0f).xx); + m95 = float2x2((0.0f).xx, (0.0f).xx); + m96 = float2x2((0.0f).xx, (0.0f).xx); + m97 = float2x2((0.0f).xx, (0.0f).xx); + m98 = float2x2((0.0f).xx, (0.0f).xx); + m99 = float2x2((0.0f).xx, (0.0f).xx); + } + GroupMemoryBarrierWithGroupSync(); + m00[0][0] = 1.0f; + m01[0][0] = 1.0f; + m02[0][0] = 1.0f; + m03[0][0] = 1.0f; + m04[0][0] = 1.0f; + m05[0][0] = 1.0f; + m06[0][0] = 1.0f; + m07[0][0] = 1.0f; + m08[0][0] = 1.0f; + m09[0][0] = 1.0f; + m10[0][0] = 1.0f; + m11[0][0] = 1.0f; + m12[0][0] = 1.0f; + m13[0][0] = 1.0f; + m14[0][0] = 1.0f; + m15[0][0] = 1.0f; + m16[0][0] = 1.0f; + m17[0][0] = 1.0f; + m18[0][0] = 1.0f; + m19[0][0] = 1.0f; + m20[0][0] = 1.0f; + m21[0][0] = 1.0f; + m22[0][0] = 1.0f; + m23[0][0] = 1.0f; + m24[0][0] = 1.0f; + m25[0][0] = 1.0f; + m26[0][0] = 1.0f; + m27[0][0] = 1.0f; + m28[0][0] = 1.0f; + m29[0][0] = 1.0f; + m30[0][0] = 1.0f; + m31[0][0] = 1.0f; + m32[0][0] = 1.0f; + m33[0][0] = 1.0f; + m34[0][0] = 1.0f; + m35[0][0] = 1.0f; + m36[0][0] = 1.0f; + m37[0][0] = 1.0f; + m38[0][0] = 1.0f; + m39[0][0] = 1.0f; + m40[0][0] = 1.0f; + m41[0][0] = 1.0f; + m42[0][0] = 1.0f; + m43[0][0] = 1.0f; + m44[0][0] = 1.0f; + m45[0][0] = 1.0f; + m46[0][0] = 1.0f; + m47[0][0] = 1.0f; + m48[0][0] = 1.0f; + m49[0][0] = 1.0f; + m50[0][0] = 1.0f; + m51[0][0] = 1.0f; + m52[0][0] = 1.0f; + m53[0][0] = 1.0f; + m54[0][0] = 1.0f; + m55[0][0] = 1.0f; + m56[0][0] = 1.0f; + m57[0][0] = 1.0f; + m58[0][0] = 1.0f; + m59[0][0] = 1.0f; + m60[0][0] = 1.0f; + m61[0][0] = 1.0f; + m62[0][0] = 1.0f; + m63[0][0] = 1.0f; + m64[0][0] = 1.0f; + m65[0][0] = 1.0f; + m66[0][0] = 1.0f; + m67[0][0] = 1.0f; + m68[0][0] = 1.0f; + m69[0][0] = 1.0f; + m70[0][0] = 1.0f; + m71[0][0] = 1.0f; + m72[0][0] = 1.0f; + m73[0][0] = 1.0f; + m74[0][0] = 1.0f; + m75[0][0] = 1.0f; + m76[0][0] = 1.0f; + m77[0][0] = 1.0f; + m78[0][0] = 1.0f; + m79[0][0] = 1.0f; + m80[0][0] = 1.0f; + m81[0][0] = 1.0f; + m82[0][0] = 1.0f; + m83[0][0] = 1.0f; + m84[0][0] = 1.0f; + m85[0][0] = 1.0f; + m86[0][0] = 1.0f; + m87[0][0] = 1.0f; + m88[0][0] = 1.0f; + m89[0][0] = 1.0f; + m90[0][0] = 1.0f; + m91[0][0] = 1.0f; + m92[0][0] = 1.0f; + m93[0][0] = 1.0f; + m94[0][0] = 1.0f; + m95[0][0] = 1.0f; + m96[0][0] = 1.0f; + m97[0][0] = 1.0f; + m98[0][0] = 1.0f; + m99[0][0] = 1.0f; +} + +[numthreads(1, 1, 1)] +void tint_symbol(tint_symbol_2 tint_symbol_1) { + tint_symbol_inner(tint_symbol_1.idx); + return; +} diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.fxc.hlsl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..63d3ea3537 --- /dev/null +++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.fxc.hlsl @@ -0,0 +1,316 @@ +groupshared float2x2 m00; +groupshared float2x2 m01; +groupshared float2x2 m02; +groupshared float2x2 m03; +groupshared float2x2 m04; +groupshared float2x2 m05; +groupshared float2x2 m06; +groupshared float2x2 m07; +groupshared float2x2 m08; +groupshared float2x2 m09; +groupshared float2x2 m10; +groupshared float2x2 m11; +groupshared float2x2 m12; +groupshared float2x2 m13; +groupshared float2x2 m14; +groupshared float2x2 m15; +groupshared float2x2 m16; +groupshared float2x2 m17; +groupshared float2x2 m18; +groupshared float2x2 m19; +groupshared float2x2 m20; +groupshared float2x2 m21; +groupshared float2x2 m22; +groupshared float2x2 m23; +groupshared float2x2 m24; +groupshared float2x2 m25; +groupshared float2x2 m26; +groupshared float2x2 m27; +groupshared float2x2 m28; +groupshared float2x2 m29; +groupshared float2x2 m30; +groupshared float2x2 m31; +groupshared float2x2 m32; +groupshared float2x2 m33; +groupshared float2x2 m34; +groupshared float2x2 m35; +groupshared float2x2 m36; +groupshared float2x2 m37; +groupshared float2x2 m38; +groupshared float2x2 m39; +groupshared float2x2 m40; +groupshared float2x2 m41; +groupshared float2x2 m42; +groupshared float2x2 m43; +groupshared float2x2 m44; +groupshared float2x2 m45; +groupshared float2x2 m46; +groupshared float2x2 m47; +groupshared float2x2 m48; +groupshared float2x2 m49; +groupshared float2x2 m50; +groupshared float2x2 m51; +groupshared float2x2 m52; +groupshared float2x2 m53; +groupshared float2x2 m54; +groupshared float2x2 m55; +groupshared float2x2 m56; +groupshared float2x2 m57; +groupshared float2x2 m58; +groupshared float2x2 m59; +groupshared float2x2 m60; +groupshared float2x2 m61; +groupshared float2x2 m62; +groupshared float2x2 m63; +groupshared float2x2 m64; +groupshared float2x2 m65; +groupshared float2x2 m66; +groupshared float2x2 m67; +groupshared float2x2 m68; +groupshared float2x2 m69; +groupshared float2x2 m70; +groupshared float2x2 m71; +groupshared float2x2 m72; +groupshared float2x2 m73; +groupshared float2x2 m74; +groupshared float2x2 m75; +groupshared float2x2 m76; +groupshared float2x2 m77; +groupshared float2x2 m78; +groupshared float2x2 m79; +groupshared float2x2 m80; +groupshared float2x2 m81; +groupshared float2x2 m82; +groupshared float2x2 m83; +groupshared float2x2 m84; +groupshared float2x2 m85; +groupshared float2x2 m86; +groupshared float2x2 m87; +groupshared float2x2 m88; +groupshared float2x2 m89; +groupshared float2x2 m90; +groupshared float2x2 m91; +groupshared float2x2 m92; +groupshared float2x2 m93; +groupshared float2x2 m94; +groupshared float2x2 m95; +groupshared float2x2 m96; +groupshared float2x2 m97; +groupshared float2x2 m98; +groupshared float2x2 m99; + +struct tint_symbol_2 { + uint idx : SV_GroupIndex; +}; + +void tint_symbol_inner(uint idx) { + { + m00 = float2x2((0.0f).xx, (0.0f).xx); + m01 = float2x2((0.0f).xx, (0.0f).xx); + m02 = float2x2((0.0f).xx, (0.0f).xx); + m03 = float2x2((0.0f).xx, (0.0f).xx); + m04 = float2x2((0.0f).xx, (0.0f).xx); + m05 = float2x2((0.0f).xx, (0.0f).xx); + m06 = float2x2((0.0f).xx, (0.0f).xx); + m07 = float2x2((0.0f).xx, (0.0f).xx); + m08 = float2x2((0.0f).xx, (0.0f).xx); + m09 = float2x2((0.0f).xx, (0.0f).xx); + m10 = float2x2((0.0f).xx, (0.0f).xx); + m11 = float2x2((0.0f).xx, (0.0f).xx); + m12 = float2x2((0.0f).xx, (0.0f).xx); + m13 = float2x2((0.0f).xx, (0.0f).xx); + m14 = float2x2((0.0f).xx, (0.0f).xx); + m15 = float2x2((0.0f).xx, (0.0f).xx); + m16 = float2x2((0.0f).xx, (0.0f).xx); + m17 = float2x2((0.0f).xx, (0.0f).xx); + m18 = float2x2((0.0f).xx, (0.0f).xx); + m19 = float2x2((0.0f).xx, (0.0f).xx); + m20 = float2x2((0.0f).xx, (0.0f).xx); + m21 = float2x2((0.0f).xx, (0.0f).xx); + m22 = float2x2((0.0f).xx, (0.0f).xx); + m23 = float2x2((0.0f).xx, (0.0f).xx); + m24 = float2x2((0.0f).xx, (0.0f).xx); + m25 = float2x2((0.0f).xx, (0.0f).xx); + m26 = float2x2((0.0f).xx, (0.0f).xx); + m27 = float2x2((0.0f).xx, (0.0f).xx); + m28 = float2x2((0.0f).xx, (0.0f).xx); + m29 = float2x2((0.0f).xx, (0.0f).xx); + m30 = float2x2((0.0f).xx, (0.0f).xx); + m31 = float2x2((0.0f).xx, (0.0f).xx); + m32 = float2x2((0.0f).xx, (0.0f).xx); + m33 = float2x2((0.0f).xx, (0.0f).xx); + m34 = float2x2((0.0f).xx, (0.0f).xx); + m35 = float2x2((0.0f).xx, (0.0f).xx); + m36 = float2x2((0.0f).xx, (0.0f).xx); + m37 = float2x2((0.0f).xx, (0.0f).xx); + m38 = float2x2((0.0f).xx, (0.0f).xx); + m39 = float2x2((0.0f).xx, (0.0f).xx); + m40 = float2x2((0.0f).xx, (0.0f).xx); + m41 = float2x2((0.0f).xx, (0.0f).xx); + m42 = float2x2((0.0f).xx, (0.0f).xx); + m43 = float2x2((0.0f).xx, (0.0f).xx); + m44 = float2x2((0.0f).xx, (0.0f).xx); + m45 = float2x2((0.0f).xx, (0.0f).xx); + m46 = float2x2((0.0f).xx, (0.0f).xx); + m47 = float2x2((0.0f).xx, (0.0f).xx); + m48 = float2x2((0.0f).xx, (0.0f).xx); + m49 = float2x2((0.0f).xx, (0.0f).xx); + m50 = float2x2((0.0f).xx, (0.0f).xx); + m51 = float2x2((0.0f).xx, (0.0f).xx); + m52 = float2x2((0.0f).xx, (0.0f).xx); + m53 = float2x2((0.0f).xx, (0.0f).xx); + m54 = float2x2((0.0f).xx, (0.0f).xx); + m55 = float2x2((0.0f).xx, (0.0f).xx); + m56 = float2x2((0.0f).xx, (0.0f).xx); + m57 = float2x2((0.0f).xx, (0.0f).xx); + m58 = float2x2((0.0f).xx, (0.0f).xx); + m59 = float2x2((0.0f).xx, (0.0f).xx); + m60 = float2x2((0.0f).xx, (0.0f).xx); + m61 = float2x2((0.0f).xx, (0.0f).xx); + m62 = float2x2((0.0f).xx, (0.0f).xx); + m63 = float2x2((0.0f).xx, (0.0f).xx); + m64 = float2x2((0.0f).xx, (0.0f).xx); + m65 = float2x2((0.0f).xx, (0.0f).xx); + m66 = float2x2((0.0f).xx, (0.0f).xx); + m67 = float2x2((0.0f).xx, (0.0f).xx); + m68 = float2x2((0.0f).xx, (0.0f).xx); + m69 = float2x2((0.0f).xx, (0.0f).xx); + m70 = float2x2((0.0f).xx, (0.0f).xx); + m71 = float2x2((0.0f).xx, (0.0f).xx); + m72 = float2x2((0.0f).xx, (0.0f).xx); + m73 = float2x2((0.0f).xx, (0.0f).xx); + m74 = float2x2((0.0f).xx, (0.0f).xx); + m75 = float2x2((0.0f).xx, (0.0f).xx); + m76 = float2x2((0.0f).xx, (0.0f).xx); + m77 = float2x2((0.0f).xx, (0.0f).xx); + m78 = float2x2((0.0f).xx, (0.0f).xx); + m79 = float2x2((0.0f).xx, (0.0f).xx); + m80 = float2x2((0.0f).xx, (0.0f).xx); + m81 = float2x2((0.0f).xx, (0.0f).xx); + m82 = float2x2((0.0f).xx, (0.0f).xx); + m83 = float2x2((0.0f).xx, (0.0f).xx); + m84 = float2x2((0.0f).xx, (0.0f).xx); + m85 = float2x2((0.0f).xx, (0.0f).xx); + m86 = float2x2((0.0f).xx, (0.0f).xx); + m87 = float2x2((0.0f).xx, (0.0f).xx); + m88 = float2x2((0.0f).xx, (0.0f).xx); + m89 = float2x2((0.0f).xx, (0.0f).xx); + m90 = float2x2((0.0f).xx, (0.0f).xx); + m91 = float2x2((0.0f).xx, (0.0f).xx); + m92 = float2x2((0.0f).xx, (0.0f).xx); + m93 = float2x2((0.0f).xx, (0.0f).xx); + m94 = float2x2((0.0f).xx, (0.0f).xx); + m95 = float2x2((0.0f).xx, (0.0f).xx); + m96 = float2x2((0.0f).xx, (0.0f).xx); + m97 = float2x2((0.0f).xx, (0.0f).xx); + m98 = float2x2((0.0f).xx, (0.0f).xx); + m99 = float2x2((0.0f).xx, (0.0f).xx); + } + GroupMemoryBarrierWithGroupSync(); + m00[0][0] = 1.0f; + m01[0][0] = 1.0f; + m02[0][0] = 1.0f; + m03[0][0] = 1.0f; + m04[0][0] = 1.0f; + m05[0][0] = 1.0f; + m06[0][0] = 1.0f; + m07[0][0] = 1.0f; + m08[0][0] = 1.0f; + m09[0][0] = 1.0f; + m10[0][0] = 1.0f; + m11[0][0] = 1.0f; + m12[0][0] = 1.0f; + m13[0][0] = 1.0f; + m14[0][0] = 1.0f; + m15[0][0] = 1.0f; + m16[0][0] = 1.0f; + m17[0][0] = 1.0f; + m18[0][0] = 1.0f; + m19[0][0] = 1.0f; + m20[0][0] = 1.0f; + m21[0][0] = 1.0f; + m22[0][0] = 1.0f; + m23[0][0] = 1.0f; + m24[0][0] = 1.0f; + m25[0][0] = 1.0f; + m26[0][0] = 1.0f; + m27[0][0] = 1.0f; + m28[0][0] = 1.0f; + m29[0][0] = 1.0f; + m30[0][0] = 1.0f; + m31[0][0] = 1.0f; + m32[0][0] = 1.0f; + m33[0][0] = 1.0f; + m34[0][0] = 1.0f; + m35[0][0] = 1.0f; + m36[0][0] = 1.0f; + m37[0][0] = 1.0f; + m38[0][0] = 1.0f; + m39[0][0] = 1.0f; + m40[0][0] = 1.0f; + m41[0][0] = 1.0f; + m42[0][0] = 1.0f; + m43[0][0] = 1.0f; + m44[0][0] = 1.0f; + m45[0][0] = 1.0f; + m46[0][0] = 1.0f; + m47[0][0] = 1.0f; + m48[0][0] = 1.0f; + m49[0][0] = 1.0f; + m50[0][0] = 1.0f; + m51[0][0] = 1.0f; + m52[0][0] = 1.0f; + m53[0][0] = 1.0f; + m54[0][0] = 1.0f; + m55[0][0] = 1.0f; + m56[0][0] = 1.0f; + m57[0][0] = 1.0f; + m58[0][0] = 1.0f; + m59[0][0] = 1.0f; + m60[0][0] = 1.0f; + m61[0][0] = 1.0f; + m62[0][0] = 1.0f; + m63[0][0] = 1.0f; + m64[0][0] = 1.0f; + m65[0][0] = 1.0f; + m66[0][0] = 1.0f; + m67[0][0] = 1.0f; + m68[0][0] = 1.0f; + m69[0][0] = 1.0f; + m70[0][0] = 1.0f; + m71[0][0] = 1.0f; + m72[0][0] = 1.0f; + m73[0][0] = 1.0f; + m74[0][0] = 1.0f; + m75[0][0] = 1.0f; + m76[0][0] = 1.0f; + m77[0][0] = 1.0f; + m78[0][0] = 1.0f; + m79[0][0] = 1.0f; + m80[0][0] = 1.0f; + m81[0][0] = 1.0f; + m82[0][0] = 1.0f; + m83[0][0] = 1.0f; + m84[0][0] = 1.0f; + m85[0][0] = 1.0f; + m86[0][0] = 1.0f; + m87[0][0] = 1.0f; + m88[0][0] = 1.0f; + m89[0][0] = 1.0f; + m90[0][0] = 1.0f; + m91[0][0] = 1.0f; + m92[0][0] = 1.0f; + m93[0][0] = 1.0f; + m94[0][0] = 1.0f; + m95[0][0] = 1.0f; + m96[0][0] = 1.0f; + m97[0][0] = 1.0f; + m98[0][0] = 1.0f; + m99[0][0] = 1.0f; +} + +[numthreads(1, 1, 1)] +void tint_symbol(tint_symbol_2 tint_symbol_1) { + tint_symbol_inner(tint_symbol_1.idx); + return; +} diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.glsl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.glsl index 2fafa418ab..ea1bcc3abb 100644 --- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.glsl +++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.glsl @@ -102,106 +102,106 @@ shared mat2 m98; shared mat2 m99; void tint_symbol(uint idx) { { - m00 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m01 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m02 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m03 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m04 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m05 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m06 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m07 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m08 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m09 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m10 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m11 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m12 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m13 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m14 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m15 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m16 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m17 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m18 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m19 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m20 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m21 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m22 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m23 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m24 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m25 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m26 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m27 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m28 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m29 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m30 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m31 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m32 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m33 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m34 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m35 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m36 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m37 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m38 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m39 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m40 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m41 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m42 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m43 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m44 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m45 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m46 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m47 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m48 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m49 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m50 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m51 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m52 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m53 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m54 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m55 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m56 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m57 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m58 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m59 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m60 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m61 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m62 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m63 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m64 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m65 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m66 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m67 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m68 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m69 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m70 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m71 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m72 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m73 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m74 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m75 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m76 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m77 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m78 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m79 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m80 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m81 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m82 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m83 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m84 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m85 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m86 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m87 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m88 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m89 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m90 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m91 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m92 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m93 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m94 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m95 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m96 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m97 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m98 = mat2(0.0f, 0.0f, 0.0f, 0.0f); - m99 = mat2(0.0f, 0.0f, 0.0f, 0.0f); + m00 = mat2(vec2(0.0f), vec2(0.0f)); + m01 = mat2(vec2(0.0f), vec2(0.0f)); + m02 = mat2(vec2(0.0f), vec2(0.0f)); + m03 = mat2(vec2(0.0f), vec2(0.0f)); + m04 = mat2(vec2(0.0f), vec2(0.0f)); + m05 = mat2(vec2(0.0f), vec2(0.0f)); + m06 = mat2(vec2(0.0f), vec2(0.0f)); + m07 = mat2(vec2(0.0f), vec2(0.0f)); + m08 = mat2(vec2(0.0f), vec2(0.0f)); + m09 = mat2(vec2(0.0f), vec2(0.0f)); + m10 = mat2(vec2(0.0f), vec2(0.0f)); + m11 = mat2(vec2(0.0f), vec2(0.0f)); + m12 = mat2(vec2(0.0f), vec2(0.0f)); + m13 = mat2(vec2(0.0f), vec2(0.0f)); + m14 = mat2(vec2(0.0f), vec2(0.0f)); + m15 = mat2(vec2(0.0f), vec2(0.0f)); + m16 = mat2(vec2(0.0f), vec2(0.0f)); + m17 = mat2(vec2(0.0f), vec2(0.0f)); + m18 = mat2(vec2(0.0f), vec2(0.0f)); + m19 = mat2(vec2(0.0f), vec2(0.0f)); + m20 = mat2(vec2(0.0f), vec2(0.0f)); + m21 = mat2(vec2(0.0f), vec2(0.0f)); + m22 = mat2(vec2(0.0f), vec2(0.0f)); + m23 = mat2(vec2(0.0f), vec2(0.0f)); + m24 = mat2(vec2(0.0f), vec2(0.0f)); + m25 = mat2(vec2(0.0f), vec2(0.0f)); + m26 = mat2(vec2(0.0f), vec2(0.0f)); + m27 = mat2(vec2(0.0f), vec2(0.0f)); + m28 = mat2(vec2(0.0f), vec2(0.0f)); + m29 = mat2(vec2(0.0f), vec2(0.0f)); + m30 = mat2(vec2(0.0f), vec2(0.0f)); + m31 = mat2(vec2(0.0f), vec2(0.0f)); + m32 = mat2(vec2(0.0f), vec2(0.0f)); + m33 = mat2(vec2(0.0f), vec2(0.0f)); + m34 = mat2(vec2(0.0f), vec2(0.0f)); + m35 = mat2(vec2(0.0f), vec2(0.0f)); + m36 = mat2(vec2(0.0f), vec2(0.0f)); + m37 = mat2(vec2(0.0f), vec2(0.0f)); + m38 = mat2(vec2(0.0f), vec2(0.0f)); + m39 = mat2(vec2(0.0f), vec2(0.0f)); + m40 = mat2(vec2(0.0f), vec2(0.0f)); + m41 = mat2(vec2(0.0f), vec2(0.0f)); + m42 = mat2(vec2(0.0f), vec2(0.0f)); + m43 = mat2(vec2(0.0f), vec2(0.0f)); + m44 = mat2(vec2(0.0f), vec2(0.0f)); + m45 = mat2(vec2(0.0f), vec2(0.0f)); + m46 = mat2(vec2(0.0f), vec2(0.0f)); + m47 = mat2(vec2(0.0f), vec2(0.0f)); + m48 = mat2(vec2(0.0f), vec2(0.0f)); + m49 = mat2(vec2(0.0f), vec2(0.0f)); + m50 = mat2(vec2(0.0f), vec2(0.0f)); + m51 = mat2(vec2(0.0f), vec2(0.0f)); + m52 = mat2(vec2(0.0f), vec2(0.0f)); + m53 = mat2(vec2(0.0f), vec2(0.0f)); + m54 = mat2(vec2(0.0f), vec2(0.0f)); + m55 = mat2(vec2(0.0f), vec2(0.0f)); + m56 = mat2(vec2(0.0f), vec2(0.0f)); + m57 = mat2(vec2(0.0f), vec2(0.0f)); + m58 = mat2(vec2(0.0f), vec2(0.0f)); + m59 = mat2(vec2(0.0f), vec2(0.0f)); + m60 = mat2(vec2(0.0f), vec2(0.0f)); + m61 = mat2(vec2(0.0f), vec2(0.0f)); + m62 = mat2(vec2(0.0f), vec2(0.0f)); + m63 = mat2(vec2(0.0f), vec2(0.0f)); + m64 = mat2(vec2(0.0f), vec2(0.0f)); + m65 = mat2(vec2(0.0f), vec2(0.0f)); + m66 = mat2(vec2(0.0f), vec2(0.0f)); + m67 = mat2(vec2(0.0f), vec2(0.0f)); + m68 = mat2(vec2(0.0f), vec2(0.0f)); + m69 = mat2(vec2(0.0f), vec2(0.0f)); + m70 = mat2(vec2(0.0f), vec2(0.0f)); + m71 = mat2(vec2(0.0f), vec2(0.0f)); + m72 = mat2(vec2(0.0f), vec2(0.0f)); + m73 = mat2(vec2(0.0f), vec2(0.0f)); + m74 = mat2(vec2(0.0f), vec2(0.0f)); + m75 = mat2(vec2(0.0f), vec2(0.0f)); + m76 = mat2(vec2(0.0f), vec2(0.0f)); + m77 = mat2(vec2(0.0f), vec2(0.0f)); + m78 = mat2(vec2(0.0f), vec2(0.0f)); + m79 = mat2(vec2(0.0f), vec2(0.0f)); + m80 = mat2(vec2(0.0f), vec2(0.0f)); + m81 = mat2(vec2(0.0f), vec2(0.0f)); + m82 = mat2(vec2(0.0f), vec2(0.0f)); + m83 = mat2(vec2(0.0f), vec2(0.0f)); + m84 = mat2(vec2(0.0f), vec2(0.0f)); + m85 = mat2(vec2(0.0f), vec2(0.0f)); + m86 = mat2(vec2(0.0f), vec2(0.0f)); + m87 = mat2(vec2(0.0f), vec2(0.0f)); + m88 = mat2(vec2(0.0f), vec2(0.0f)); + m89 = mat2(vec2(0.0f), vec2(0.0f)); + m90 = mat2(vec2(0.0f), vec2(0.0f)); + m91 = mat2(vec2(0.0f), vec2(0.0f)); + m92 = mat2(vec2(0.0f), vec2(0.0f)); + m93 = mat2(vec2(0.0f), vec2(0.0f)); + m94 = mat2(vec2(0.0f), vec2(0.0f)); + m95 = mat2(vec2(0.0f), vec2(0.0f)); + m96 = mat2(vec2(0.0f), vec2(0.0f)); + m97 = mat2(vec2(0.0f), vec2(0.0f)); + m98 = mat2(vec2(0.0f), vec2(0.0f)); + m99 = mat2(vec2(0.0f), vec2(0.0f)); } barrier(); m00[0][0] = 1.0f; diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.hlsl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.hlsl deleted file mode 100644 index 738895a4f4..0000000000 --- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.hlsl +++ /dev/null @@ -1,316 +0,0 @@ -groupshared float2x2 m00; -groupshared float2x2 m01; -groupshared float2x2 m02; -groupshared float2x2 m03; -groupshared float2x2 m04; -groupshared float2x2 m05; -groupshared float2x2 m06; -groupshared float2x2 m07; -groupshared float2x2 m08; -groupshared float2x2 m09; -groupshared float2x2 m10; -groupshared float2x2 m11; -groupshared float2x2 m12; -groupshared float2x2 m13; -groupshared float2x2 m14; -groupshared float2x2 m15; -groupshared float2x2 m16; -groupshared float2x2 m17; -groupshared float2x2 m18; -groupshared float2x2 m19; -groupshared float2x2 m20; -groupshared float2x2 m21; -groupshared float2x2 m22; -groupshared float2x2 m23; -groupshared float2x2 m24; -groupshared float2x2 m25; -groupshared float2x2 m26; -groupshared float2x2 m27; -groupshared float2x2 m28; -groupshared float2x2 m29; -groupshared float2x2 m30; -groupshared float2x2 m31; -groupshared float2x2 m32; -groupshared float2x2 m33; -groupshared float2x2 m34; -groupshared float2x2 m35; -groupshared float2x2 m36; -groupshared float2x2 m37; -groupshared float2x2 m38; -groupshared float2x2 m39; -groupshared float2x2 m40; -groupshared float2x2 m41; -groupshared float2x2 m42; -groupshared float2x2 m43; -groupshared float2x2 m44; -groupshared float2x2 m45; -groupshared float2x2 m46; -groupshared float2x2 m47; -groupshared float2x2 m48; -groupshared float2x2 m49; -groupshared float2x2 m50; -groupshared float2x2 m51; -groupshared float2x2 m52; -groupshared float2x2 m53; -groupshared float2x2 m54; -groupshared float2x2 m55; -groupshared float2x2 m56; -groupshared float2x2 m57; -groupshared float2x2 m58; -groupshared float2x2 m59; -groupshared float2x2 m60; -groupshared float2x2 m61; -groupshared float2x2 m62; -groupshared float2x2 m63; -groupshared float2x2 m64; -groupshared float2x2 m65; -groupshared float2x2 m66; -groupshared float2x2 m67; -groupshared float2x2 m68; -groupshared float2x2 m69; -groupshared float2x2 m70; -groupshared float2x2 m71; -groupshared float2x2 m72; -groupshared float2x2 m73; -groupshared float2x2 m74; -groupshared float2x2 m75; -groupshared float2x2 m76; -groupshared float2x2 m77; -groupshared float2x2 m78; -groupshared float2x2 m79; -groupshared float2x2 m80; -groupshared float2x2 m81; -groupshared float2x2 m82; -groupshared float2x2 m83; -groupshared float2x2 m84; -groupshared float2x2 m85; -groupshared float2x2 m86; -groupshared float2x2 m87; -groupshared float2x2 m88; -groupshared float2x2 m89; -groupshared float2x2 m90; -groupshared float2x2 m91; -groupshared float2x2 m92; -groupshared float2x2 m93; -groupshared float2x2 m94; -groupshared float2x2 m95; -groupshared float2x2 m96; -groupshared float2x2 m97; -groupshared float2x2 m98; -groupshared float2x2 m99; - -struct tint_symbol_2 { - uint idx : SV_GroupIndex; -}; - -void tint_symbol_inner(uint idx) { - { - m00 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m01 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m02 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m03 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m04 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m05 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m06 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m07 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m08 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m09 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m10 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m11 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m12 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m13 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m14 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m15 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m16 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m17 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m18 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m19 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m20 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m21 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m22 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m23 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m24 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m25 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m26 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m27 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m28 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m29 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m30 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m31 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m32 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m33 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m34 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m35 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m36 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m37 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m38 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m39 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m40 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m41 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m42 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m43 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m44 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m45 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m46 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m47 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m48 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m49 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m50 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m51 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m52 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m53 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m54 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m55 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m56 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m57 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m58 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m59 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m60 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m61 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m62 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m63 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m64 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m65 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m66 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m67 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m68 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m69 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m70 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m71 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m72 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m73 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m74 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m75 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m76 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m77 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m78 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m79 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m80 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m81 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m82 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m83 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m84 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m85 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m86 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m87 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m88 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m89 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m90 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m91 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m92 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m93 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m94 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m95 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m96 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m97 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m98 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - m99 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); - } - GroupMemoryBarrierWithGroupSync(); - m00[0][0] = 1.0f; - m01[0][0] = 1.0f; - m02[0][0] = 1.0f; - m03[0][0] = 1.0f; - m04[0][0] = 1.0f; - m05[0][0] = 1.0f; - m06[0][0] = 1.0f; - m07[0][0] = 1.0f; - m08[0][0] = 1.0f; - m09[0][0] = 1.0f; - m10[0][0] = 1.0f; - m11[0][0] = 1.0f; - m12[0][0] = 1.0f; - m13[0][0] = 1.0f; - m14[0][0] = 1.0f; - m15[0][0] = 1.0f; - m16[0][0] = 1.0f; - m17[0][0] = 1.0f; - m18[0][0] = 1.0f; - m19[0][0] = 1.0f; - m20[0][0] = 1.0f; - m21[0][0] = 1.0f; - m22[0][0] = 1.0f; - m23[0][0] = 1.0f; - m24[0][0] = 1.0f; - m25[0][0] = 1.0f; - m26[0][0] = 1.0f; - m27[0][0] = 1.0f; - m28[0][0] = 1.0f; - m29[0][0] = 1.0f; - m30[0][0] = 1.0f; - m31[0][0] = 1.0f; - m32[0][0] = 1.0f; - m33[0][0] = 1.0f; - m34[0][0] = 1.0f; - m35[0][0] = 1.0f; - m36[0][0] = 1.0f; - m37[0][0] = 1.0f; - m38[0][0] = 1.0f; - m39[0][0] = 1.0f; - m40[0][0] = 1.0f; - m41[0][0] = 1.0f; - m42[0][0] = 1.0f; - m43[0][0] = 1.0f; - m44[0][0] = 1.0f; - m45[0][0] = 1.0f; - m46[0][0] = 1.0f; - m47[0][0] = 1.0f; - m48[0][0] = 1.0f; - m49[0][0] = 1.0f; - m50[0][0] = 1.0f; - m51[0][0] = 1.0f; - m52[0][0] = 1.0f; - m53[0][0] = 1.0f; - m54[0][0] = 1.0f; - m55[0][0] = 1.0f; - m56[0][0] = 1.0f; - m57[0][0] = 1.0f; - m58[0][0] = 1.0f; - m59[0][0] = 1.0f; - m60[0][0] = 1.0f; - m61[0][0] = 1.0f; - m62[0][0] = 1.0f; - m63[0][0] = 1.0f; - m64[0][0] = 1.0f; - m65[0][0] = 1.0f; - m66[0][0] = 1.0f; - m67[0][0] = 1.0f; - m68[0][0] = 1.0f; - m69[0][0] = 1.0f; - m70[0][0] = 1.0f; - m71[0][0] = 1.0f; - m72[0][0] = 1.0f; - m73[0][0] = 1.0f; - m74[0][0] = 1.0f; - m75[0][0] = 1.0f; - m76[0][0] = 1.0f; - m77[0][0] = 1.0f; - m78[0][0] = 1.0f; - m79[0][0] = 1.0f; - m80[0][0] = 1.0f; - m81[0][0] = 1.0f; - m82[0][0] = 1.0f; - m83[0][0] = 1.0f; - m84[0][0] = 1.0f; - m85[0][0] = 1.0f; - m86[0][0] = 1.0f; - m87[0][0] = 1.0f; - m88[0][0] = 1.0f; - m89[0][0] = 1.0f; - m90[0][0] = 1.0f; - m91[0][0] = 1.0f; - m92[0][0] = 1.0f; - m93[0][0] = 1.0f; - m94[0][0] = 1.0f; - m95[0][0] = 1.0f; - m96[0][0] = 1.0f; - m97[0][0] = 1.0f; - m98[0][0] = 1.0f; - m99[0][0] = 1.0f; -} - -[numthreads(1, 1, 1)] -void tint_symbol(tint_symbol_2 tint_symbol_1) { - tint_symbol_inner(tint_symbol_1.idx); - return; -} diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.msl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.msl index 8435181bb7..fa73692385 100644 --- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.msl +++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.msl @@ -106,106 +106,106 @@ struct tint_symbol_202 { void tint_symbol_inner(uint idx, threadgroup float2x2* const tint_symbol_1, threadgroup float2x2* const tint_symbol_2, threadgroup float2x2* const tint_symbol_3, threadgroup float2x2* const tint_symbol_4, threadgroup float2x2* const tint_symbol_5, threadgroup float2x2* const tint_symbol_6, threadgroup float2x2* const tint_symbol_7, threadgroup float2x2* const tint_symbol_8, threadgroup float2x2* const tint_symbol_9, threadgroup float2x2* const tint_symbol_10, threadgroup float2x2* const tint_symbol_11, threadgroup float2x2* const tint_symbol_12, threadgroup float2x2* const tint_symbol_13, threadgroup float2x2* const tint_symbol_14, threadgroup float2x2* const tint_symbol_15, threadgroup float2x2* const tint_symbol_16, threadgroup float2x2* const tint_symbol_17, threadgroup float2x2* const tint_symbol_18, threadgroup float2x2* const tint_symbol_19, threadgroup float2x2* const tint_symbol_20, threadgroup float2x2* const tint_symbol_21, threadgroup float2x2* const tint_symbol_22, threadgroup float2x2* const tint_symbol_23, threadgroup float2x2* const tint_symbol_24, threadgroup float2x2* const tint_symbol_25, threadgroup float2x2* const tint_symbol_26, threadgroup float2x2* const tint_symbol_27, threadgroup float2x2* const tint_symbol_28, threadgroup float2x2* const tint_symbol_29, threadgroup float2x2* const tint_symbol_30, threadgroup float2x2* const tint_symbol_31, threadgroup float2x2* const tint_symbol_32, threadgroup float2x2* const tint_symbol_33, threadgroup float2x2* const tint_symbol_34, threadgroup float2x2* const tint_symbol_35, threadgroup float2x2* const tint_symbol_36, threadgroup float2x2* const tint_symbol_37, threadgroup float2x2* const tint_symbol_38, threadgroup float2x2* const tint_symbol_39, threadgroup float2x2* const tint_symbol_40, threadgroup float2x2* const tint_symbol_41, threadgroup float2x2* const tint_symbol_42, threadgroup float2x2* const tint_symbol_43, threadgroup float2x2* const tint_symbol_44, threadgroup float2x2* const tint_symbol_45, threadgroup float2x2* const tint_symbol_46, threadgroup float2x2* const tint_symbol_47, threadgroup float2x2* const tint_symbol_48, threadgroup float2x2* const tint_symbol_49, threadgroup float2x2* const tint_symbol_50, threadgroup float2x2* const tint_symbol_51, threadgroup float2x2* const tint_symbol_52, threadgroup float2x2* const tint_symbol_53, threadgroup float2x2* const tint_symbol_54, threadgroup float2x2* const tint_symbol_55, threadgroup float2x2* const tint_symbol_56, threadgroup float2x2* const tint_symbol_57, threadgroup float2x2* const tint_symbol_58, threadgroup float2x2* const tint_symbol_59, threadgroup float2x2* const tint_symbol_60, threadgroup float2x2* const tint_symbol_61, threadgroup float2x2* const tint_symbol_62, threadgroup float2x2* const tint_symbol_63, threadgroup float2x2* const tint_symbol_64, threadgroup float2x2* const tint_symbol_65, threadgroup float2x2* const tint_symbol_66, threadgroup float2x2* const tint_symbol_67, threadgroup float2x2* const tint_symbol_68, threadgroup float2x2* const tint_symbol_69, threadgroup float2x2* const tint_symbol_70, threadgroup float2x2* const tint_symbol_71, threadgroup float2x2* const tint_symbol_72, threadgroup float2x2* const tint_symbol_73, threadgroup float2x2* const tint_symbol_74, threadgroup float2x2* const tint_symbol_75, threadgroup float2x2* const tint_symbol_76, threadgroup float2x2* const tint_symbol_77, threadgroup float2x2* const tint_symbol_78, threadgroup float2x2* const tint_symbol_79, threadgroup float2x2* const tint_symbol_80, threadgroup float2x2* const tint_symbol_81, threadgroup float2x2* const tint_symbol_82, threadgroup float2x2* const tint_symbol_83, threadgroup float2x2* const tint_symbol_84, threadgroup float2x2* const tint_symbol_85, threadgroup float2x2* const tint_symbol_86, threadgroup float2x2* const tint_symbol_87, threadgroup float2x2* const tint_symbol_88, threadgroup float2x2* const tint_symbol_89, threadgroup float2x2* const tint_symbol_90, threadgroup float2x2* const tint_symbol_91, threadgroup float2x2* const tint_symbol_92, threadgroup float2x2* const tint_symbol_93, threadgroup float2x2* const tint_symbol_94, threadgroup float2x2* const tint_symbol_95, threadgroup float2x2* const tint_symbol_96, threadgroup float2x2* const tint_symbol_97, threadgroup float2x2* const tint_symbol_98, threadgroup float2x2* const tint_symbol_99, threadgroup float2x2* const tint_symbol_100) { { - *(tint_symbol_1) = float2x2(); - *(tint_symbol_2) = float2x2(); - *(tint_symbol_3) = float2x2(); - *(tint_symbol_4) = float2x2(); - *(tint_symbol_5) = float2x2(); - *(tint_symbol_6) = float2x2(); - *(tint_symbol_7) = float2x2(); - *(tint_symbol_8) = float2x2(); - *(tint_symbol_9) = float2x2(); - *(tint_symbol_10) = float2x2(); - *(tint_symbol_11) = float2x2(); - *(tint_symbol_12) = float2x2(); - *(tint_symbol_13) = float2x2(); - *(tint_symbol_14) = float2x2(); - *(tint_symbol_15) = float2x2(); - *(tint_symbol_16) = float2x2(); - *(tint_symbol_17) = float2x2(); - *(tint_symbol_18) = float2x2(); - *(tint_symbol_19) = float2x2(); - *(tint_symbol_20) = float2x2(); - *(tint_symbol_21) = float2x2(); - *(tint_symbol_22) = float2x2(); - *(tint_symbol_23) = float2x2(); - *(tint_symbol_24) = float2x2(); - *(tint_symbol_25) = float2x2(); - *(tint_symbol_26) = float2x2(); - *(tint_symbol_27) = float2x2(); - *(tint_symbol_28) = float2x2(); - *(tint_symbol_29) = float2x2(); - *(tint_symbol_30) = float2x2(); - *(tint_symbol_31) = float2x2(); - *(tint_symbol_32) = float2x2(); - *(tint_symbol_33) = float2x2(); - *(tint_symbol_34) = float2x2(); - *(tint_symbol_35) = float2x2(); - *(tint_symbol_36) = float2x2(); - *(tint_symbol_37) = float2x2(); - *(tint_symbol_38) = float2x2(); - *(tint_symbol_39) = float2x2(); - *(tint_symbol_40) = float2x2(); - *(tint_symbol_41) = float2x2(); - *(tint_symbol_42) = float2x2(); - *(tint_symbol_43) = float2x2(); - *(tint_symbol_44) = float2x2(); - *(tint_symbol_45) = float2x2(); - *(tint_symbol_46) = float2x2(); - *(tint_symbol_47) = float2x2(); - *(tint_symbol_48) = float2x2(); - *(tint_symbol_49) = float2x2(); - *(tint_symbol_50) = float2x2(); - *(tint_symbol_51) = float2x2(); - *(tint_symbol_52) = float2x2(); - *(tint_symbol_53) = float2x2(); - *(tint_symbol_54) = float2x2(); - *(tint_symbol_55) = float2x2(); - *(tint_symbol_56) = float2x2(); - *(tint_symbol_57) = float2x2(); - *(tint_symbol_58) = float2x2(); - *(tint_symbol_59) = float2x2(); - *(tint_symbol_60) = float2x2(); - *(tint_symbol_61) = float2x2(); - *(tint_symbol_62) = float2x2(); - *(tint_symbol_63) = float2x2(); - *(tint_symbol_64) = float2x2(); - *(tint_symbol_65) = float2x2(); - *(tint_symbol_66) = float2x2(); - *(tint_symbol_67) = float2x2(); - *(tint_symbol_68) = float2x2(); - *(tint_symbol_69) = float2x2(); - *(tint_symbol_70) = float2x2(); - *(tint_symbol_71) = float2x2(); - *(tint_symbol_72) = float2x2(); - *(tint_symbol_73) = float2x2(); - *(tint_symbol_74) = float2x2(); - *(tint_symbol_75) = float2x2(); - *(tint_symbol_76) = float2x2(); - *(tint_symbol_77) = float2x2(); - *(tint_symbol_78) = float2x2(); - *(tint_symbol_79) = float2x2(); - *(tint_symbol_80) = float2x2(); - *(tint_symbol_81) = float2x2(); - *(tint_symbol_82) = float2x2(); - *(tint_symbol_83) = float2x2(); - *(tint_symbol_84) = float2x2(); - *(tint_symbol_85) = float2x2(); - *(tint_symbol_86) = float2x2(); - *(tint_symbol_87) = float2x2(); - *(tint_symbol_88) = float2x2(); - *(tint_symbol_89) = float2x2(); - *(tint_symbol_90) = float2x2(); - *(tint_symbol_91) = float2x2(); - *(tint_symbol_92) = float2x2(); - *(tint_symbol_93) = float2x2(); - *(tint_symbol_94) = float2x2(); - *(tint_symbol_95) = float2x2(); - *(tint_symbol_96) = float2x2(); - *(tint_symbol_97) = float2x2(); - *(tint_symbol_98) = float2x2(); - *(tint_symbol_99) = float2x2(); - *(tint_symbol_100) = float2x2(); + *(tint_symbol_1) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_2) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_3) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_4) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_5) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_6) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_7) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_8) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_9) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_10) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_11) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_12) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_13) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_14) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_15) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_16) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_17) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_18) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_19) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_20) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_21) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_22) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_23) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_24) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_25) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_26) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_27) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_28) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_29) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_30) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_31) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_32) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_33) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_34) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_35) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_36) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_37) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_38) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_39) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_40) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_41) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_42) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_43) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_44) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_45) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_46) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_47) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_48) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_49) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_50) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_51) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_52) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_53) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_54) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_55) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_56) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_57) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_58) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_59) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_60) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_61) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_62) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_63) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_64) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_65) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_66) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_67) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_68) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_69) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_70) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_71) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_72) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_73) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_74) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_75) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_76) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_77) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_78) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_79) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_80) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_81) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_82) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_83) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_84) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_85) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_86) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_87) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_88) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_89) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_90) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_91) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_92) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_93) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_94) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_95) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_96) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_97) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_98) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_99) = float2x2(float2(0.0f), float2(0.0f)); + *(tint_symbol_100) = float2x2(float2(0.0f), float2(0.0f)); } threadgroup_barrier(mem_flags::mem_threadgroup); (*(tint_symbol_1))[0][0] = 1.0f; diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.spvasm b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.spvasm index 6c8669beff..1bd4cad43e 100644 --- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.spvasm +++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.spvasm @@ -225,7 +225,7 @@ %uint_2 = OpConstant %uint 2 %uint_264 = OpConstant %uint 264 %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 + %118 = OpConstantNull %int %_ptr_Workgroup_float = OpTypePointer Workgroup %float %float_1 = OpConstant %float 1 %221 = OpTypeFunction %void @@ -333,205 +333,205 @@ OpStore %m98 %113 OpStore %m99 %113 OpControlBarrier %uint_2 %uint_2 %uint_264 - %120 = OpAccessChain %_ptr_Workgroup_float %m00 %int_0 %int_0 + %120 = OpAccessChain %_ptr_Workgroup_float %m00 %118 %118 OpStore %120 %float_1 - %122 = OpAccessChain %_ptr_Workgroup_float %m01 %int_0 %int_0 + %122 = OpAccessChain %_ptr_Workgroup_float %m01 %118 %118 OpStore %122 %float_1 - %123 = OpAccessChain %_ptr_Workgroup_float %m02 %int_0 %int_0 + %123 = OpAccessChain %_ptr_Workgroup_float %m02 %118 %118 OpStore %123 %float_1 - %124 = OpAccessChain %_ptr_Workgroup_float %m03 %int_0 %int_0 + %124 = OpAccessChain %_ptr_Workgroup_float %m03 %118 %118 OpStore %124 %float_1 - %125 = OpAccessChain %_ptr_Workgroup_float %m04 %int_0 %int_0 + %125 = OpAccessChain %_ptr_Workgroup_float %m04 %118 %118 OpStore %125 %float_1 - %126 = OpAccessChain %_ptr_Workgroup_float %m05 %int_0 %int_0 + %126 = OpAccessChain %_ptr_Workgroup_float %m05 %118 %118 OpStore %126 %float_1 - %127 = OpAccessChain %_ptr_Workgroup_float %m06 %int_0 %int_0 + %127 = OpAccessChain %_ptr_Workgroup_float %m06 %118 %118 OpStore %127 %float_1 - %128 = OpAccessChain %_ptr_Workgroup_float %m07 %int_0 %int_0 + %128 = OpAccessChain %_ptr_Workgroup_float %m07 %118 %118 OpStore %128 %float_1 - %129 = OpAccessChain %_ptr_Workgroup_float %m08 %int_0 %int_0 + %129 = OpAccessChain %_ptr_Workgroup_float %m08 %118 %118 OpStore %129 %float_1 - %130 = OpAccessChain %_ptr_Workgroup_float %m09 %int_0 %int_0 + %130 = OpAccessChain %_ptr_Workgroup_float %m09 %118 %118 OpStore %130 %float_1 - %131 = OpAccessChain %_ptr_Workgroup_float %m10 %int_0 %int_0 + %131 = OpAccessChain %_ptr_Workgroup_float %m10 %118 %118 OpStore %131 %float_1 - %132 = OpAccessChain %_ptr_Workgroup_float %m11 %int_0 %int_0 + %132 = OpAccessChain %_ptr_Workgroup_float %m11 %118 %118 OpStore %132 %float_1 - %133 = OpAccessChain %_ptr_Workgroup_float %m12 %int_0 %int_0 + %133 = OpAccessChain %_ptr_Workgroup_float %m12 %118 %118 OpStore %133 %float_1 - %134 = OpAccessChain %_ptr_Workgroup_float %m13 %int_0 %int_0 + %134 = OpAccessChain %_ptr_Workgroup_float %m13 %118 %118 OpStore %134 %float_1 - %135 = OpAccessChain %_ptr_Workgroup_float %m14 %int_0 %int_0 + %135 = OpAccessChain %_ptr_Workgroup_float %m14 %118 %118 OpStore %135 %float_1 - %136 = OpAccessChain %_ptr_Workgroup_float %m15 %int_0 %int_0 + %136 = OpAccessChain %_ptr_Workgroup_float %m15 %118 %118 OpStore %136 %float_1 - %137 = OpAccessChain %_ptr_Workgroup_float %m16 %int_0 %int_0 + %137 = OpAccessChain %_ptr_Workgroup_float %m16 %118 %118 OpStore %137 %float_1 - %138 = OpAccessChain %_ptr_Workgroup_float %m17 %int_0 %int_0 + %138 = OpAccessChain %_ptr_Workgroup_float %m17 %118 %118 OpStore %138 %float_1 - %139 = OpAccessChain %_ptr_Workgroup_float %m18 %int_0 %int_0 + %139 = OpAccessChain %_ptr_Workgroup_float %m18 %118 %118 OpStore %139 %float_1 - %140 = OpAccessChain %_ptr_Workgroup_float %m19 %int_0 %int_0 + %140 = OpAccessChain %_ptr_Workgroup_float %m19 %118 %118 OpStore %140 %float_1 - %141 = OpAccessChain %_ptr_Workgroup_float %m20 %int_0 %int_0 + %141 = OpAccessChain %_ptr_Workgroup_float %m20 %118 %118 OpStore %141 %float_1 - %142 = OpAccessChain %_ptr_Workgroup_float %m21 %int_0 %int_0 + %142 = OpAccessChain %_ptr_Workgroup_float %m21 %118 %118 OpStore %142 %float_1 - %143 = OpAccessChain %_ptr_Workgroup_float %m22 %int_0 %int_0 + %143 = OpAccessChain %_ptr_Workgroup_float %m22 %118 %118 OpStore %143 %float_1 - %144 = OpAccessChain %_ptr_Workgroup_float %m23 %int_0 %int_0 + %144 = OpAccessChain %_ptr_Workgroup_float %m23 %118 %118 OpStore %144 %float_1 - %145 = OpAccessChain %_ptr_Workgroup_float %m24 %int_0 %int_0 + %145 = OpAccessChain %_ptr_Workgroup_float %m24 %118 %118 OpStore %145 %float_1 - %146 = OpAccessChain %_ptr_Workgroup_float %m25 %int_0 %int_0 + %146 = OpAccessChain %_ptr_Workgroup_float %m25 %118 %118 OpStore %146 %float_1 - %147 = OpAccessChain %_ptr_Workgroup_float %m26 %int_0 %int_0 + %147 = OpAccessChain %_ptr_Workgroup_float %m26 %118 %118 OpStore %147 %float_1 - %148 = OpAccessChain %_ptr_Workgroup_float %m27 %int_0 %int_0 + %148 = OpAccessChain %_ptr_Workgroup_float %m27 %118 %118 OpStore %148 %float_1 - %149 = OpAccessChain %_ptr_Workgroup_float %m28 %int_0 %int_0 + %149 = OpAccessChain %_ptr_Workgroup_float %m28 %118 %118 OpStore %149 %float_1 - %150 = OpAccessChain %_ptr_Workgroup_float %m29 %int_0 %int_0 + %150 = OpAccessChain %_ptr_Workgroup_float %m29 %118 %118 OpStore %150 %float_1 - %151 = OpAccessChain %_ptr_Workgroup_float %m30 %int_0 %int_0 + %151 = OpAccessChain %_ptr_Workgroup_float %m30 %118 %118 OpStore %151 %float_1 - %152 = OpAccessChain %_ptr_Workgroup_float %m31 %int_0 %int_0 + %152 = OpAccessChain %_ptr_Workgroup_float %m31 %118 %118 OpStore %152 %float_1 - %153 = OpAccessChain %_ptr_Workgroup_float %m32 %int_0 %int_0 + %153 = OpAccessChain %_ptr_Workgroup_float %m32 %118 %118 OpStore %153 %float_1 - %154 = OpAccessChain %_ptr_Workgroup_float %m33 %int_0 %int_0 + %154 = OpAccessChain %_ptr_Workgroup_float %m33 %118 %118 OpStore %154 %float_1 - %155 = OpAccessChain %_ptr_Workgroup_float %m34 %int_0 %int_0 + %155 = OpAccessChain %_ptr_Workgroup_float %m34 %118 %118 OpStore %155 %float_1 - %156 = OpAccessChain %_ptr_Workgroup_float %m35 %int_0 %int_0 + %156 = OpAccessChain %_ptr_Workgroup_float %m35 %118 %118 OpStore %156 %float_1 - %157 = OpAccessChain %_ptr_Workgroup_float %m36 %int_0 %int_0 + %157 = OpAccessChain %_ptr_Workgroup_float %m36 %118 %118 OpStore %157 %float_1 - %158 = OpAccessChain %_ptr_Workgroup_float %m37 %int_0 %int_0 + %158 = OpAccessChain %_ptr_Workgroup_float %m37 %118 %118 OpStore %158 %float_1 - %159 = OpAccessChain %_ptr_Workgroup_float %m38 %int_0 %int_0 + %159 = OpAccessChain %_ptr_Workgroup_float %m38 %118 %118 OpStore %159 %float_1 - %160 = OpAccessChain %_ptr_Workgroup_float %m39 %int_0 %int_0 + %160 = OpAccessChain %_ptr_Workgroup_float %m39 %118 %118 OpStore %160 %float_1 - %161 = OpAccessChain %_ptr_Workgroup_float %m40 %int_0 %int_0 + %161 = OpAccessChain %_ptr_Workgroup_float %m40 %118 %118 OpStore %161 %float_1 - %162 = OpAccessChain %_ptr_Workgroup_float %m41 %int_0 %int_0 + %162 = OpAccessChain %_ptr_Workgroup_float %m41 %118 %118 OpStore %162 %float_1 - %163 = OpAccessChain %_ptr_Workgroup_float %m42 %int_0 %int_0 + %163 = OpAccessChain %_ptr_Workgroup_float %m42 %118 %118 OpStore %163 %float_1 - %164 = OpAccessChain %_ptr_Workgroup_float %m43 %int_0 %int_0 + %164 = OpAccessChain %_ptr_Workgroup_float %m43 %118 %118 OpStore %164 %float_1 - %165 = OpAccessChain %_ptr_Workgroup_float %m44 %int_0 %int_0 + %165 = OpAccessChain %_ptr_Workgroup_float %m44 %118 %118 OpStore %165 %float_1 - %166 = OpAccessChain %_ptr_Workgroup_float %m45 %int_0 %int_0 + %166 = OpAccessChain %_ptr_Workgroup_float %m45 %118 %118 OpStore %166 %float_1 - %167 = OpAccessChain %_ptr_Workgroup_float %m46 %int_0 %int_0 + %167 = OpAccessChain %_ptr_Workgroup_float %m46 %118 %118 OpStore %167 %float_1 - %168 = OpAccessChain %_ptr_Workgroup_float %m47 %int_0 %int_0 + %168 = OpAccessChain %_ptr_Workgroup_float %m47 %118 %118 OpStore %168 %float_1 - %169 = OpAccessChain %_ptr_Workgroup_float %m48 %int_0 %int_0 + %169 = OpAccessChain %_ptr_Workgroup_float %m48 %118 %118 OpStore %169 %float_1 - %170 = OpAccessChain %_ptr_Workgroup_float %m49 %int_0 %int_0 + %170 = OpAccessChain %_ptr_Workgroup_float %m49 %118 %118 OpStore %170 %float_1 - %171 = OpAccessChain %_ptr_Workgroup_float %m50 %int_0 %int_0 + %171 = OpAccessChain %_ptr_Workgroup_float %m50 %118 %118 OpStore %171 %float_1 - %172 = OpAccessChain %_ptr_Workgroup_float %m51 %int_0 %int_0 + %172 = OpAccessChain %_ptr_Workgroup_float %m51 %118 %118 OpStore %172 %float_1 - %173 = OpAccessChain %_ptr_Workgroup_float %m52 %int_0 %int_0 + %173 = OpAccessChain %_ptr_Workgroup_float %m52 %118 %118 OpStore %173 %float_1 - %174 = OpAccessChain %_ptr_Workgroup_float %m53 %int_0 %int_0 + %174 = OpAccessChain %_ptr_Workgroup_float %m53 %118 %118 OpStore %174 %float_1 - %175 = OpAccessChain %_ptr_Workgroup_float %m54 %int_0 %int_0 + %175 = OpAccessChain %_ptr_Workgroup_float %m54 %118 %118 OpStore %175 %float_1 - %176 = OpAccessChain %_ptr_Workgroup_float %m55 %int_0 %int_0 + %176 = OpAccessChain %_ptr_Workgroup_float %m55 %118 %118 OpStore %176 %float_1 - %177 = OpAccessChain %_ptr_Workgroup_float %m56 %int_0 %int_0 + %177 = OpAccessChain %_ptr_Workgroup_float %m56 %118 %118 OpStore %177 %float_1 - %178 = OpAccessChain %_ptr_Workgroup_float %m57 %int_0 %int_0 + %178 = OpAccessChain %_ptr_Workgroup_float %m57 %118 %118 OpStore %178 %float_1 - %179 = OpAccessChain %_ptr_Workgroup_float %m58 %int_0 %int_0 + %179 = OpAccessChain %_ptr_Workgroup_float %m58 %118 %118 OpStore %179 %float_1 - %180 = OpAccessChain %_ptr_Workgroup_float %m59 %int_0 %int_0 + %180 = OpAccessChain %_ptr_Workgroup_float %m59 %118 %118 OpStore %180 %float_1 - %181 = OpAccessChain %_ptr_Workgroup_float %m60 %int_0 %int_0 + %181 = OpAccessChain %_ptr_Workgroup_float %m60 %118 %118 OpStore %181 %float_1 - %182 = OpAccessChain %_ptr_Workgroup_float %m61 %int_0 %int_0 + %182 = OpAccessChain %_ptr_Workgroup_float %m61 %118 %118 OpStore %182 %float_1 - %183 = OpAccessChain %_ptr_Workgroup_float %m62 %int_0 %int_0 + %183 = OpAccessChain %_ptr_Workgroup_float %m62 %118 %118 OpStore %183 %float_1 - %184 = OpAccessChain %_ptr_Workgroup_float %m63 %int_0 %int_0 + %184 = OpAccessChain %_ptr_Workgroup_float %m63 %118 %118 OpStore %184 %float_1 - %185 = OpAccessChain %_ptr_Workgroup_float %m64 %int_0 %int_0 + %185 = OpAccessChain %_ptr_Workgroup_float %m64 %118 %118 OpStore %185 %float_1 - %186 = OpAccessChain %_ptr_Workgroup_float %m65 %int_0 %int_0 + %186 = OpAccessChain %_ptr_Workgroup_float %m65 %118 %118 OpStore %186 %float_1 - %187 = OpAccessChain %_ptr_Workgroup_float %m66 %int_0 %int_0 + %187 = OpAccessChain %_ptr_Workgroup_float %m66 %118 %118 OpStore %187 %float_1 - %188 = OpAccessChain %_ptr_Workgroup_float %m67 %int_0 %int_0 + %188 = OpAccessChain %_ptr_Workgroup_float %m67 %118 %118 OpStore %188 %float_1 - %189 = OpAccessChain %_ptr_Workgroup_float %m68 %int_0 %int_0 + %189 = OpAccessChain %_ptr_Workgroup_float %m68 %118 %118 OpStore %189 %float_1 - %190 = OpAccessChain %_ptr_Workgroup_float %m69 %int_0 %int_0 + %190 = OpAccessChain %_ptr_Workgroup_float %m69 %118 %118 OpStore %190 %float_1 - %191 = OpAccessChain %_ptr_Workgroup_float %m70 %int_0 %int_0 + %191 = OpAccessChain %_ptr_Workgroup_float %m70 %118 %118 OpStore %191 %float_1 - %192 = OpAccessChain %_ptr_Workgroup_float %m71 %int_0 %int_0 + %192 = OpAccessChain %_ptr_Workgroup_float %m71 %118 %118 OpStore %192 %float_1 - %193 = OpAccessChain %_ptr_Workgroup_float %m72 %int_0 %int_0 + %193 = OpAccessChain %_ptr_Workgroup_float %m72 %118 %118 OpStore %193 %float_1 - %194 = OpAccessChain %_ptr_Workgroup_float %m73 %int_0 %int_0 + %194 = OpAccessChain %_ptr_Workgroup_float %m73 %118 %118 OpStore %194 %float_1 - %195 = OpAccessChain %_ptr_Workgroup_float %m74 %int_0 %int_0 + %195 = OpAccessChain %_ptr_Workgroup_float %m74 %118 %118 OpStore %195 %float_1 - %196 = OpAccessChain %_ptr_Workgroup_float %m75 %int_0 %int_0 + %196 = OpAccessChain %_ptr_Workgroup_float %m75 %118 %118 OpStore %196 %float_1 - %197 = OpAccessChain %_ptr_Workgroup_float %m76 %int_0 %int_0 + %197 = OpAccessChain %_ptr_Workgroup_float %m76 %118 %118 OpStore %197 %float_1 - %198 = OpAccessChain %_ptr_Workgroup_float %m77 %int_0 %int_0 + %198 = OpAccessChain %_ptr_Workgroup_float %m77 %118 %118 OpStore %198 %float_1 - %199 = OpAccessChain %_ptr_Workgroup_float %m78 %int_0 %int_0 + %199 = OpAccessChain %_ptr_Workgroup_float %m78 %118 %118 OpStore %199 %float_1 - %200 = OpAccessChain %_ptr_Workgroup_float %m79 %int_0 %int_0 + %200 = OpAccessChain %_ptr_Workgroup_float %m79 %118 %118 OpStore %200 %float_1 - %201 = OpAccessChain %_ptr_Workgroup_float %m80 %int_0 %int_0 + %201 = OpAccessChain %_ptr_Workgroup_float %m80 %118 %118 OpStore %201 %float_1 - %202 = OpAccessChain %_ptr_Workgroup_float %m81 %int_0 %int_0 + %202 = OpAccessChain %_ptr_Workgroup_float %m81 %118 %118 OpStore %202 %float_1 - %203 = OpAccessChain %_ptr_Workgroup_float %m82 %int_0 %int_0 + %203 = OpAccessChain %_ptr_Workgroup_float %m82 %118 %118 OpStore %203 %float_1 - %204 = OpAccessChain %_ptr_Workgroup_float %m83 %int_0 %int_0 + %204 = OpAccessChain %_ptr_Workgroup_float %m83 %118 %118 OpStore %204 %float_1 - %205 = OpAccessChain %_ptr_Workgroup_float %m84 %int_0 %int_0 + %205 = OpAccessChain %_ptr_Workgroup_float %m84 %118 %118 OpStore %205 %float_1 - %206 = OpAccessChain %_ptr_Workgroup_float %m85 %int_0 %int_0 + %206 = OpAccessChain %_ptr_Workgroup_float %m85 %118 %118 OpStore %206 %float_1 - %207 = OpAccessChain %_ptr_Workgroup_float %m86 %int_0 %int_0 + %207 = OpAccessChain %_ptr_Workgroup_float %m86 %118 %118 OpStore %207 %float_1 - %208 = OpAccessChain %_ptr_Workgroup_float %m87 %int_0 %int_0 + %208 = OpAccessChain %_ptr_Workgroup_float %m87 %118 %118 OpStore %208 %float_1 - %209 = OpAccessChain %_ptr_Workgroup_float %m88 %int_0 %int_0 + %209 = OpAccessChain %_ptr_Workgroup_float %m88 %118 %118 OpStore %209 %float_1 - %210 = OpAccessChain %_ptr_Workgroup_float %m89 %int_0 %int_0 + %210 = OpAccessChain %_ptr_Workgroup_float %m89 %118 %118 OpStore %210 %float_1 - %211 = OpAccessChain %_ptr_Workgroup_float %m90 %int_0 %int_0 + %211 = OpAccessChain %_ptr_Workgroup_float %m90 %118 %118 OpStore %211 %float_1 - %212 = OpAccessChain %_ptr_Workgroup_float %m91 %int_0 %int_0 + %212 = OpAccessChain %_ptr_Workgroup_float %m91 %118 %118 OpStore %212 %float_1 - %213 = OpAccessChain %_ptr_Workgroup_float %m92 %int_0 %int_0 + %213 = OpAccessChain %_ptr_Workgroup_float %m92 %118 %118 OpStore %213 %float_1 - %214 = OpAccessChain %_ptr_Workgroup_float %m93 %int_0 %int_0 + %214 = OpAccessChain %_ptr_Workgroup_float %m93 %118 %118 OpStore %214 %float_1 - %215 = OpAccessChain %_ptr_Workgroup_float %m94 %int_0 %int_0 + %215 = OpAccessChain %_ptr_Workgroup_float %m94 %118 %118 OpStore %215 %float_1 - %216 = OpAccessChain %_ptr_Workgroup_float %m95 %int_0 %int_0 + %216 = OpAccessChain %_ptr_Workgroup_float %m95 %118 %118 OpStore %216 %float_1 - %217 = OpAccessChain %_ptr_Workgroup_float %m96 %int_0 %int_0 + %217 = OpAccessChain %_ptr_Workgroup_float %m96 %118 %118 OpStore %217 %float_1 - %218 = OpAccessChain %_ptr_Workgroup_float %m97 %int_0 %int_0 + %218 = OpAccessChain %_ptr_Workgroup_float %m97 %118 %118 OpStore %218 %float_1 - %219 = OpAccessChain %_ptr_Workgroup_float %m98 %int_0 %int_0 + %219 = OpAccessChain %_ptr_Workgroup_float %m98 %118 %118 OpStore %219 %float_1 - %220 = OpAccessChain %_ptr_Workgroup_float %m99 %int_0 %int_0 + %220 = OpAccessChain %_ptr_Workgroup_float %m99 %118 %118 OpStore %220 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.wgsl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.wgsl index 9d1822e0cd..dd7c89bd63 100644 --- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.wgsl +++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.wgsl @@ -198,7 +198,7 @@ var m98 : mat2x2; var m99 : mat2x2; -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn tint_symbol(@builtin(local_invocation_index) idx : u32) { m00[0][0] = 1.0; m01[0][0] = 1.0; diff --git a/test/tint/var/uses/private.wgsl b/test/tint/var/uses/private.wgsl index 6ec289a94d..9b83ccb906 100644 --- a/test/tint/var/uses/private.wgsl +++ b/test/tint/var/uses/private.wgsl @@ -25,25 +25,25 @@ fn outer() { no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main1() { a = 42; uses_a(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main2() { b = 7; uses_b(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main3() { outer(); no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main4() { no_uses(); } diff --git a/test/tint/var/uses/private.wgsl.expected.hlsl b/test/tint/var/uses/private.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/uses/private.wgsl.expected.hlsl rename to test/tint/var/uses/private.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/uses/private.wgsl.expected.fxc.hlsl b/test/tint/var/uses/private.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..606819feaa --- /dev/null +++ b/test/tint/var/uses/private.wgsl.expected.fxc.hlsl @@ -0,0 +1,53 @@ +static int a = 0; +static int b = 0; +static int c = 0; + +void uses_a() { + a = (a + 1); +} + +void uses_b() { + b = (b * 2); +} + +void uses_a_and_b() { + b = a; +} + +void no_uses() { +} + +void outer() { + a = 0; + uses_a(); + uses_a_and_b(); + uses_b(); + no_uses(); +} + +[numthreads(1, 1, 1)] +void main1() { + a = 42; + uses_a(); + return; +} + +[numthreads(1, 1, 1)] +void main2() { + b = 7; + uses_b(); + return; +} + +[numthreads(1, 1, 1)] +void main3() { + outer(); + no_uses(); + return; +} + +[numthreads(1, 1, 1)] +void main4() { + no_uses(); + return; +} diff --git a/test/tint/var/uses/private.wgsl.expected.spvasm b/test/tint/var/uses/private.wgsl.expected.spvasm index daa3cfb1b8..4b78707db6 100644 --- a/test/tint/var/uses/private.wgsl.expected.spvasm +++ b/test/tint/var/uses/private.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 46 +; Bound: 45 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -35,7 +35,6 @@ %7 = OpTypeFunction %void %int_1 = OpConstant %int 1 %int_2 = OpConstant %int 2 - %int_0 = OpConstant %int 0 %int_42 = OpConstant %int 42 %int_7 = OpConstant %int 7 %uses_a = OpFunction %void None %7 @@ -64,33 +63,33 @@ OpFunctionEnd %outer = OpFunction %void None %7 %25 = OpLabel - OpStore %a %int_0 - %27 = OpFunctionCall %void %uses_a - %28 = OpFunctionCall %void %uses_a_and_b - %29 = OpFunctionCall %void %uses_b - %30 = OpFunctionCall %void %no_uses + OpStore %a %4 + %26 = OpFunctionCall %void %uses_a + %27 = OpFunctionCall %void %uses_a_and_b + %28 = OpFunctionCall %void %uses_b + %29 = OpFunctionCall %void %no_uses OpReturn OpFunctionEnd %main1 = OpFunction %void None %7 - %32 = OpLabel + %31 = OpLabel OpStore %a %int_42 - %34 = OpFunctionCall %void %uses_a + %33 = OpFunctionCall %void %uses_a OpReturn OpFunctionEnd %main2 = OpFunction %void None %7 - %36 = OpLabel + %35 = OpLabel OpStore %b %int_7 - %38 = OpFunctionCall %void %uses_b + %37 = OpFunctionCall %void %uses_b OpReturn OpFunctionEnd %main3 = OpFunction %void None %7 - %40 = OpLabel - %41 = OpFunctionCall %void %outer - %42 = OpFunctionCall %void %no_uses + %39 = OpLabel + %40 = OpFunctionCall %void %outer + %41 = OpFunctionCall %void %no_uses OpReturn OpFunctionEnd %main4 = OpFunction %void None %7 - %44 = OpLabel - %45 = OpFunctionCall %void %no_uses + %43 = OpLabel + %44 = OpFunctionCall %void %no_uses OpReturn OpFunctionEnd diff --git a/test/tint/var/uses/private.wgsl.expected.wgsl b/test/tint/var/uses/private.wgsl.expected.wgsl index 477044740d..e16dddb55d 100644 --- a/test/tint/var/uses/private.wgsl.expected.wgsl +++ b/test/tint/var/uses/private.wgsl.expected.wgsl @@ -27,25 +27,25 @@ fn outer() { no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main1() { a = 42; uses_a(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main2() { b = 7; uses_b(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main3() { outer(); no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main4() { no_uses(); } diff --git a/test/tint/var/uses/push_constant.wgsl b/test/tint/var/uses/push_constant.wgsl new file mode 100644 index 0000000000..8f16f4ec24 --- /dev/null +++ b/test/tint/var/uses/push_constant.wgsl @@ -0,0 +1,36 @@ +enable chromium_experimental_push_constant; + +var a : i32; +var b : i32; +var c : i32; // unused + +fn uses_a() { + let foo = a; +} + +fn uses_uses_a() { + uses_a(); +} + +fn uses_b() { + let foo = b; +} + +@compute @workgroup_size(1) +fn main1() { + uses_a(); +} + +@compute @workgroup_size(1) +fn main2() { + uses_uses_a(); +} + +@compute @workgroup_size(1) +fn main3() { + uses_b(); +} + +@compute @workgroup_size(1) +fn main4() { +} diff --git a/test/tint/var/uses/push_constant.wgsl.expected.dxc.hlsl b/test/tint/var/uses/push_constant.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..895f24ea86 --- /dev/null +++ b/test/tint/var/uses/push_constant.wgsl.expected.dxc.hlsl @@ -0,0 +1,43 @@ +SKIP: FAILED + + +enable chromium_experimental_push_constant; + +var a : i32; + +var b : i32; + +var c : i32; + +fn uses_a() { + let foo = a; +} + +fn uses_uses_a() { + uses_a(); +} + +fn uses_b() { + let foo = b; +} + +@compute @workgroup_size(1) +fn main1() { + uses_a(); +} + +@compute @workgroup_size(1) +fn main2() { + uses_uses_a(); +} + +@compute @workgroup_size(1) +fn main3() { + uses_b(); +} + +@compute @workgroup_size(1) +fn main4() { +} + +Failed to generate: error: unhandled storage class push_constant diff --git a/test/tint/var/uses/push_constant.wgsl.expected.fxc.hlsl b/test/tint/var/uses/push_constant.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..895f24ea86 --- /dev/null +++ b/test/tint/var/uses/push_constant.wgsl.expected.fxc.hlsl @@ -0,0 +1,43 @@ +SKIP: FAILED + + +enable chromium_experimental_push_constant; + +var a : i32; + +var b : i32; + +var c : i32; + +fn uses_a() { + let foo = a; +} + +fn uses_uses_a() { + uses_a(); +} + +fn uses_b() { + let foo = b; +} + +@compute @workgroup_size(1) +fn main1() { + uses_a(); +} + +@compute @workgroup_size(1) +fn main2() { + uses_uses_a(); +} + +@compute @workgroup_size(1) +fn main3() { + uses_b(); +} + +@compute @workgroup_size(1) +fn main4() { +} + +Failed to generate: error: unhandled storage class push_constant diff --git a/test/tint/var/uses/push_constant.wgsl.expected.glsl b/test/tint/var/uses/push_constant.wgsl.expected.glsl new file mode 100644 index 0000000000..b341469158 --- /dev/null +++ b/test/tint/var/uses/push_constant.wgsl.expected.glsl @@ -0,0 +1,135 @@ +SKIP: FAILED + + +enable chromium_experimental_push_constant; + +var a : i32; + +var b : i32; + +var c : i32; + +fn uses_a() { + let foo = a; +} + +fn uses_uses_a() { + uses_a(); +} + +fn uses_b() { + let foo = b; +} + +@compute @workgroup_size(1) +fn main1() { + uses_a(); +} + +@compute @workgroup_size(1) +fn main2() { + uses_uses_a(); +} + +@compute @workgroup_size(1) +fn main3() { + uses_b(); +} + +@compute @workgroup_size(1) +fn main4() { +} + +Failed to generate: error: unhandled storage class push_constant + +enable chromium_experimental_push_constant; + +var a : i32; + +var b : i32; + +var c : i32; + +fn uses_a() { + let foo = a; +} + +fn uses_uses_a() { + uses_a(); +} + +fn uses_b() { + let foo = b; +} + +@compute @workgroup_size(1) +fn main1() { + uses_a(); +} + +@compute @workgroup_size(1) +fn main2() { + uses_uses_a(); +} + +@compute @workgroup_size(1) +fn main3() { + uses_b(); +} + +@compute @workgroup_size(1) +fn main4() { +} + +Failed to generate: error: unhandled storage class push_constant + +enable chromium_experimental_push_constant; + +var a : i32; + +var b : i32; + +var c : i32; + +fn uses_a() { + let foo = a; +} + +fn uses_uses_a() { + uses_a(); +} + +fn uses_b() { + let foo = b; +} + +@compute @workgroup_size(1) +fn main1() { + uses_a(); +} + +@compute @workgroup_size(1) +fn main2() { + uses_uses_a(); +} + +@compute @workgroup_size(1) +fn main3() { + uses_b(); +} + +@compute @workgroup_size(1) +fn main4() { +} + +Failed to generate: error: unhandled storage class push_constant +#version 310 es + +void main4() { +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + main4(); + return; +} diff --git a/test/tint/var/uses/push_constant.wgsl.expected.msl b/test/tint/var/uses/push_constant.wgsl.expected.msl new file mode 100644 index 0000000000..273a21c8a4 --- /dev/null +++ b/test/tint/var/uses/push_constant.wgsl.expected.msl @@ -0,0 +1,48 @@ +SKIP: FAILED + + +enable chromium_experimental_push_constant; + +var a : i32; + +var b : i32; + +var c : i32; + +fn uses_a() { + let foo = a; +} + +fn uses_uses_a() { + uses_a(); +} + +fn uses_b() { + let foo = b; +} + +@compute @workgroup_size(1) +fn main1() { + uses_a(); +} + +@compute @workgroup_size(1) +fn main2() { + uses_uses_a(); +} + +@compute @workgroup_size(1) +fn main3() { + uses_b(); +} + +@compute @workgroup_size(1) +fn main4() { +} + +Failed to generate: error: unhandled module-scope storage class (push_constant) +error: unhandled module-scope storage class (push_constant) +error: unhandled module-scope storage class (push_constant) +error: unhandled module-scope storage class (push_constant) +error: unhandled module-scope storage class (push_constant) +error: unhandled module-scope storage class (push_constant) diff --git a/test/tint/var/uses/push_constant.wgsl.expected.spvasm b/test/tint/var/uses/push_constant.wgsl.expected.spvasm new file mode 100644 index 0000000000..2e3de8de2f --- /dev/null +++ b/test/tint/var/uses/push_constant.wgsl.expected.spvasm @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main1 "main1" + OpEntryPoint GLCompute %main2 "main2" + OpEntryPoint GLCompute %main3 "main3" + OpEntryPoint GLCompute %main4 "main4" + OpExecutionMode %main1 LocalSize 1 1 1 + OpExecutionMode %main2 LocalSize 1 1 1 + OpExecutionMode %main3 LocalSize 1 1 1 + OpExecutionMode %main4 LocalSize 1 1 1 + OpName %a_block "a_block" + OpMemberName %a_block 0 "inner" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %uses_a "uses_a" + OpName %uses_uses_a "uses_uses_a" + OpName %uses_b "uses_b" + OpName %main1 "main1" + OpName %main2 "main2" + OpName %main3 "main3" + OpName %main4 "main4" + OpDecorate %a_block Block + OpMemberDecorate %a_block 0 Offset 0 + %int = OpTypeInt 32 1 + %a_block = OpTypeStruct %int +%_ptr_PushConstant_a_block = OpTypePointer PushConstant %a_block + %a = OpVariable %_ptr_PushConstant_a_block PushConstant + %b = OpVariable %_ptr_PushConstant_a_block PushConstant + %c = OpVariable %_ptr_PushConstant_a_block PushConstant + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_int = OpTypePointer PushConstant %int + %uses_a = OpFunction %void None %7 + %10 = OpLabel + %14 = OpAccessChain %_ptr_PushConstant_int %a %uint_0 + %15 = OpLoad %int %14 + OpReturn + OpFunctionEnd +%uses_uses_a = OpFunction %void None %7 + %17 = OpLabel + %18 = OpFunctionCall %void %uses_a + OpReturn + OpFunctionEnd + %uses_b = OpFunction %void None %7 + %20 = OpLabel + %21 = OpAccessChain %_ptr_PushConstant_int %b %uint_0 + %22 = OpLoad %int %21 + OpReturn + OpFunctionEnd + %main1 = OpFunction %void None %7 + %24 = OpLabel + %25 = OpFunctionCall %void %uses_a + OpReturn + OpFunctionEnd + %main2 = OpFunction %void None %7 + %27 = OpLabel + %28 = OpFunctionCall %void %uses_uses_a + OpReturn + OpFunctionEnd + %main3 = OpFunction %void None %7 + %30 = OpLabel + %31 = OpFunctionCall %void %uses_b + OpReturn + OpFunctionEnd + %main4 = OpFunction %void None %7 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/var/uses/push_constant.wgsl.expected.wgsl b/test/tint/var/uses/push_constant.wgsl.expected.wgsl new file mode 100644 index 0000000000..1087e77cd6 --- /dev/null +++ b/test/tint/var/uses/push_constant.wgsl.expected.wgsl @@ -0,0 +1,38 @@ +enable chromium_experimental_push_constant; + +var a : i32; + +var b : i32; + +var c : i32; + +fn uses_a() { + let foo = a; +} + +fn uses_uses_a() { + uses_a(); +} + +fn uses_b() { + let foo = b; +} + +@compute @workgroup_size(1) +fn main1() { + uses_a(); +} + +@compute @workgroup_size(1) +fn main2() { + uses_uses_a(); +} + +@compute @workgroup_size(1) +fn main3() { + uses_b(); +} + +@compute @workgroup_size(1) +fn main4() { +} diff --git a/test/tint/var/uses/workgroup.wgsl b/test/tint/var/uses/workgroup.wgsl index 23736b525e..029b67da29 100644 --- a/test/tint/var/uses/workgroup.wgsl +++ b/test/tint/var/uses/workgroup.wgsl @@ -25,25 +25,25 @@ fn outer() { no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main1() { a = 42; uses_a(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main2() { b = 7; uses_b(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main3() { outer(); no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main4() { no_uses(); } diff --git a/test/tint/var/uses/workgroup.wgsl.expected.hlsl b/test/tint/var/uses/workgroup.wgsl.expected.dxc.hlsl similarity index 100% rename from test/tint/var/uses/workgroup.wgsl.expected.hlsl rename to test/tint/var/uses/workgroup.wgsl.expected.dxc.hlsl diff --git a/test/tint/var/uses/workgroup.wgsl.expected.fxc.hlsl b/test/tint/var/uses/workgroup.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c5e6b7f63f --- /dev/null +++ b/test/tint/var/uses/workgroup.wgsl.expected.fxc.hlsl @@ -0,0 +1,90 @@ +groupshared int a; +groupshared int b; +groupshared int c; + +void uses_a() { + a = (a + 1); +} + +void uses_b() { + b = (b * 2); +} + +void uses_a_and_b() { + b = a; +} + +void no_uses() { +} + +void outer() { + a = 0; + uses_a(); + uses_a_and_b(); + uses_b(); + no_uses(); +} + +struct tint_symbol_1 { + uint local_invocation_index : SV_GroupIndex; +}; + +void main1_inner(uint local_invocation_index) { + { + a = 0; + } + GroupMemoryBarrierWithGroupSync(); + a = 42; + uses_a(); +} + +[numthreads(1, 1, 1)] +void main1(tint_symbol_1 tint_symbol) { + main1_inner(tint_symbol.local_invocation_index); + return; +} + +struct tint_symbol_3 { + uint local_invocation_index_1 : SV_GroupIndex; +}; + +void main2_inner(uint local_invocation_index_1) { + { + b = 0; + } + GroupMemoryBarrierWithGroupSync(); + b = 7; + uses_b(); +} + +[numthreads(1, 1, 1)] +void main2(tint_symbol_3 tint_symbol_2) { + main2_inner(tint_symbol_2.local_invocation_index_1); + return; +} + +struct tint_symbol_5 { + uint local_invocation_index_2 : SV_GroupIndex; +}; + +void main3_inner(uint local_invocation_index_2) { + { + a = 0; + b = 0; + } + GroupMemoryBarrierWithGroupSync(); + outer(); + no_uses(); +} + +[numthreads(1, 1, 1)] +void main3(tint_symbol_5 tint_symbol_4) { + main3_inner(tint_symbol_4.local_invocation_index_2); + return; +} + +[numthreads(1, 1, 1)] +void main4() { + no_uses(); + return; +} diff --git a/test/tint/var/uses/workgroup.wgsl.expected.msl b/test/tint/var/uses/workgroup.wgsl.expected.msl index 94f106ffe7..1da99299db 100644 --- a/test/tint/var/uses/workgroup.wgsl.expected.msl +++ b/test/tint/var/uses/workgroup.wgsl.expected.msl @@ -26,7 +26,7 @@ void outer(threadgroup int* const tint_symbol_4, threadgroup int* const tint_sym void main1_inner(uint local_invocation_index, threadgroup int* const tint_symbol_6) { { - *(tint_symbol_6) = int(); + *(tint_symbol_6) = 0; } threadgroup_barrier(mem_flags::mem_threadgroup); *(tint_symbol_6) = 42; @@ -41,7 +41,7 @@ kernel void main1(uint local_invocation_index [[thread_index_in_threadgroup]]) { void main2_inner(uint local_invocation_index_1, threadgroup int* const tint_symbol_8) { { - *(tint_symbol_8) = int(); + *(tint_symbol_8) = 0; } threadgroup_barrier(mem_flags::mem_threadgroup); *(tint_symbol_8) = 7; @@ -56,8 +56,8 @@ kernel void main2(uint local_invocation_index_1 [[thread_index_in_threadgroup]]) void main3_inner(uint local_invocation_index_2, threadgroup int* const tint_symbol_10, threadgroup int* const tint_symbol_11) { { - *(tint_symbol_10) = int(); - *(tint_symbol_11) = int(); + *(tint_symbol_10) = 0; + *(tint_symbol_11) = 0; } threadgroup_barrier(mem_flags::mem_threadgroup); outer(tint_symbol_10, tint_symbol_11); diff --git a/test/tint/var/uses/workgroup.wgsl.expected.spvasm b/test/tint/var/uses/workgroup.wgsl.expected.spvasm index e4669d110f..f23084c69f 100644 --- a/test/tint/var/uses/workgroup.wgsl.expected.spvasm +++ b/test/tint/var/uses/workgroup.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 72 +; Bound: 71 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -51,9 +51,8 @@ %11 = OpTypeFunction %void %int_1 = OpConstant %int 1 %int_2 = OpConstant %int 2 - %int_0 = OpConstant %int 0 + %30 = OpConstantNull %int %35 = OpTypeFunction %void %uint - %39 = OpConstantNull %int %uint_2 = OpConstant %uint 2 %uint_264 = OpConstant %uint 264 %int_42 = OpConstant %int 42 @@ -84,7 +83,7 @@ OpFunctionEnd %outer = OpFunction %void None %11 %29 = OpLabel - OpStore %a %int_0 + OpStore %a %30 %31 = OpFunctionCall %void %uses_a %32 = OpFunctionCall %void %uses_a_and_b %33 = OpFunctionCall %void %uses_b @@ -94,51 +93,51 @@ %main1_inner = OpFunction %void None %35 %local_invocation_index = OpFunctionParameter %uint %38 = OpLabel - OpStore %a %39 + OpStore %a %30 OpControlBarrier %uint_2 %uint_2 %uint_264 OpStore %a %int_42 - %44 = OpFunctionCall %void %uses_a + %43 = OpFunctionCall %void %uses_a OpReturn OpFunctionEnd %main1 = OpFunction %void None %11 - %46 = OpLabel - %48 = OpLoad %uint %local_invocation_index_3 - %47 = OpFunctionCall %void %main1_inner %48 + %45 = OpLabel + %47 = OpLoad %uint %local_invocation_index_3 + %46 = OpFunctionCall %void %main1_inner %47 OpReturn OpFunctionEnd %main2_inner = OpFunction %void None %35 %local_invocation_index_1 = OpFunctionParameter %uint - %51 = OpLabel - OpStore %b %39 + %50 = OpLabel + OpStore %b %30 OpControlBarrier %uint_2 %uint_2 %uint_264 OpStore %b %int_7 - %54 = OpFunctionCall %void %uses_b + %53 = OpFunctionCall %void %uses_b OpReturn OpFunctionEnd %main2 = OpFunction %void None %11 - %56 = OpLabel - %58 = OpLoad %uint %local_invocation_index_1_1 - %57 = OpFunctionCall %void %main2_inner %58 + %55 = OpLabel + %57 = OpLoad %uint %local_invocation_index_1_1 + %56 = OpFunctionCall %void %main2_inner %57 OpReturn OpFunctionEnd %main3_inner = OpFunction %void None %35 %local_invocation_index_2 = OpFunctionParameter %uint - %61 = OpLabel - OpStore %a %39 - OpStore %b %39 + %60 = OpLabel + OpStore %a %30 + OpStore %b %30 OpControlBarrier %uint_2 %uint_2 %uint_264 - %63 = OpFunctionCall %void %outer - %64 = OpFunctionCall %void %no_uses + %62 = OpFunctionCall %void %outer + %63 = OpFunctionCall %void %no_uses OpReturn OpFunctionEnd %main3 = OpFunction %void None %11 - %66 = OpLabel - %68 = OpLoad %uint %local_invocation_index_2_1 - %67 = OpFunctionCall %void %main3_inner %68 + %65 = OpLabel + %67 = OpLoad %uint %local_invocation_index_2_1 + %66 = OpFunctionCall %void %main3_inner %67 OpReturn OpFunctionEnd %main4 = OpFunction %void None %11 - %70 = OpLabel - %71 = OpFunctionCall %void %no_uses + %69 = OpLabel + %70 = OpFunctionCall %void %no_uses OpReturn OpFunctionEnd diff --git a/test/tint/var/uses/workgroup.wgsl.expected.wgsl b/test/tint/var/uses/workgroup.wgsl.expected.wgsl index a3386fec6c..bde813ab92 100644 --- a/test/tint/var/uses/workgroup.wgsl.expected.wgsl +++ b/test/tint/var/uses/workgroup.wgsl.expected.wgsl @@ -27,25 +27,25 @@ fn outer() { no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main1() { a = 42; uses_a(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main2() { b = 7; uses_b(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main3() { outer(); no_uses(); } -@stage(compute) @workgroup_size(1) +@compute @workgroup_size(1) fn main4() { no_uses(); } diff --git a/test/tint/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl b/test/tint/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl index 6997f0cb07..798e1a6f26 100644 --- a/test/tint/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl +++ b/test/tint/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl @@ -34,7 +34,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { main_1(); } diff --git a/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl b/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl index ff8d1eebbc..4ededd0cd7 100644 --- a/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl +++ b/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl @@ -9,7 +9,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { main_1(); } diff --git a/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl b/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl index 382abb7056..e77dd7dca9 100644 --- a/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl +++ b/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl @@ -25,7 +25,7 @@ struct main_out { frag_color_1 : vec4, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec4) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl b/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl index a23ed1f26a..574dcecb9d 100644 --- a/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl +++ b/test/tint/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl @@ -13,7 +13,7 @@ struct main_out { final_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@location(0) frag_color_param : vec4) -> main_out { frag_color = frag_color_param; main_1(); diff --git a/test/tint/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl b/test/tint/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl index 02b20e24f3..98179f874b 100644 --- a/test/tint/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl +++ b/test/tint/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl @@ -19,7 +19,7 @@ struct main_out { frag_color_1 : vec4, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec4) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/combined_operations/negintdivand/1.wgsl b/test/tint/vk-gl-cts/combined_operations/negintdivand/1.wgsl index 372cd82d0a..df17ef4b75 100644 --- a/test/tint/vk-gl-cts/combined_operations/negintdivand/1.wgsl +++ b/test/tint/vk-gl-cts/combined_operations/negintdivand/1.wgsl @@ -20,7 +20,7 @@ struct main_out { color_out_1 : vec4, } -@stage(fragment) +@fragment fn main(@location(1) frag_color_param : vec4) -> main_out { frag_color = frag_color_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl index 9ca3830b7d..97d3f2d030 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl @@ -15,7 +15,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl index 4e1dcd4bef..d21b69cf37 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl @@ -105,7 +105,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl index b82911e32a..5589016cfd 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl @@ -189,7 +189,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl index ca479f146b..0a755eae2a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl @@ -95,7 +95,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl index 30a8516e49..ddebef096b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl @@ -105,7 +105,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl index 483497ec90..ade160a768 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl @@ -87,7 +87,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl index db02a9b155..eb6d8beec9 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl @@ -55,7 +55,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(16, 1, 1) +@compute @workgroup_size(16, 1, 1) fn main(@builtin(local_invocation_id) gl_LocalInvocationID_param : vec3) { gl_LocalInvocationID = gl_LocalInvocationID_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl index 58086b587e..8d5b8604a2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl @@ -37,7 +37,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl index 6909d48370..6fdd88161b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl @@ -32,7 +32,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl index 7a949f2ccb..00cdb6388d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl @@ -65,7 +65,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl index 2e3649fe5b..e3c97d72f5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl @@ -24,7 +24,7 @@ struct main_out { x_GLF_color_1 : vec4, }; -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl index c4cb117b18..044314aead 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl @@ -65,7 +65,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl index 7740b40d5c..0413bb0338 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl @@ -43,7 +43,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl index 55480e9e88..55e5cb019d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl @@ -308,7 +308,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl index 989414f77e..bf686471fa 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl @@ -116,7 +116,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl index 14f52ecc40..663f9211df 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl @@ -68,7 +68,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl index 01d481332c..0707959421 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl @@ -67,7 +67,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl index c9e1346dcc..2165d5e334 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl @@ -59,7 +59,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl index 3acd4f40e7..4d66dedb2e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl @@ -27,7 +27,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl index bcb113cb4b..8334cdb88e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl @@ -72,7 +72,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl index 3fcf705b15..3766aeff21 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl @@ -62,7 +62,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl index 2365447da1..824afdba5b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl @@ -67,7 +67,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm index f4303ddc4c..d77e73e317 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm @@ -1,105 +1,105 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 310 - OpName %main "main" - OpName %undefined "undefined" - OpName %buf0 "buf0" - OpMemberName %buf0 0 "_GLF_uniform_int_values" - OpName %_ "" - OpName %buf1 "buf1" - OpMemberName %buf1 0 "_GLF_uniform_float_values" - OpName %__0 "" - OpName %_GLF_color "_GLF_color" - OpDecorate %_arr_int_uint_2 ArrayStride 16 - OpMemberDecorate %buf0 0 RelaxedPrecision - OpMemberDecorate %buf0 0 Offset 0 - OpDecorate %buf0 Block - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 - OpDecorate %10 RelaxedPrecision - OpDecorate %_arr_float_uint_1 ArrayStride 16 - OpMemberDecorate %buf1 0 Offset 0 - OpDecorate %buf1 Block - OpDecorate %__0 DescriptorSet 0 - OpDecorate %__0 Binding 1 - OpDecorate %_GLF_color Location 0 - OpDecorate %12 RelaxedPrecision - OpDecorate %13 RelaxedPrecision - OpDecorate %14 RelaxedPrecision - OpDecorate %15 RelaxedPrecision - OpDecorate %16 RelaxedPrecision - %void = OpTypeVoid - %18 = OpTypeFunction %void - %float = OpTypeFloat 32 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %undefined "undefined" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 %_ptr_Function_float = OpTypePointer Function %float -%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 - %bool = OpTypeBool - %int = OpTypeInt 32 1 - %int_1 = OpConstant %int 1 - %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 -%_arr_int_uint_2 = OpTypeArray %int %uint_2 - %buf0 = OpTypeStruct %_arr_int_uint_2 -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %_ = OpVariable %_ptr_Uniform_buf0 Uniform - %int_0 = OpConstant %int 0 -%_ptr_Uniform_int = OpTypePointer Uniform %int - %uint_1 = OpConstant %uint 1 -%_arr_float_uint_1 = OpTypeArray %float %uint_1 - %buf1 = OpTypeStruct %_arr_float_uint_1 -%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 - %__0 = OpVariable %_ptr_Uniform_buf1 Uniform -%_ptr_Uniform_float = OpTypePointer Uniform %float - %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1.0 + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 + %_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 + %_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 + %_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 %_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %main = OpFunction %void None %18 - %35 = OpLabel - %undefined = OpVariable %_ptr_Function_float Function - %36 = OpExtInst %float %1 Sinh %float_0x1_8p_128 - OpStore %undefined %36 - %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 - %10 = OpLoad %int %37 - %38 = OpIEqual %bool %int_1 %10 - %39 = OpLogicalNot %bool %38 - OpSelectionMerge %40 None - OpBranchConditional %39 %41 %40 - %41 = OpLabel - %42 = OpLoad %float %undefined - %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 - %44 = OpLoad %float %43 - %45 = OpFOrdGreaterThan %bool %42 %44 - OpBranch %40 - %40 = OpLabel - %46 = OpPhi %bool %38 %35 %45 %41 - OpSelectionMerge %47 None - OpBranchConditional %46 %48 %49 - %48 = OpLabel - %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 - %12 = OpLoad %int %50 - %51 = OpConvertSToF %float %12 - %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 - %13 = OpLoad %int %52 - %53 = OpConvertSToF %float %13 - %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 - %14 = OpLoad %int %54 - %55 = OpConvertSToF %float %14 - %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 - %15 = OpLoad %int %56 - %57 = OpConvertSToF %float %15 - %58 = OpCompositeConstruct %v4float %51 %53 %55 %57 - OpStore %_GLF_color %58 - OpBranch %47 - %49 = OpLabel - %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 - %16 = OpLoad %int %59 - %60 = OpConvertSToF %float %16 - %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 - OpStore %_GLF_color %61 - OpBranch %47 - %47 = OpLabel - OpReturn - OpFunctionEnd + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %18 + %35 = OpLabel + %undefined = OpVariable %_ptr_Function_float Function + %36 = OpExtInst %float %1 Sinh %float_1 + OpStore %undefined %36 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %10 = OpLoad %int %37 + %38 = OpIEqual %bool %int_1 %10 + %39 = OpLogicalNot %bool %38 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %42 = OpLoad %float %undefined + %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpFOrdGreaterThan %bool %42 %44 + OpBranch %40 + %40 = OpLabel + %46 = OpPhi %bool %38 %35 %45 %41 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %12 = OpLoad %int %50 + %51 = OpConvertSToF %float %12 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %13 = OpLoad %int %52 + %53 = OpConvertSToF %float %13 + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %14 = OpLoad %int %54 + %55 = OpConvertSToF %float %14 + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %15 = OpLoad %int %56 + %57 = OpConvertSToF %float %15 + %58 = OpCompositeConstruct %v4float %51 %53 %55 %57 + OpStore %_GLF_color %58 + OpBranch %47 + %49 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %16 = OpLoad %int %59 + %60 = OpConvertSToF %float %16 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %_GLF_color %61 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl index 6fbdc834fb..31e0e34db2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl @@ -30,7 +30,7 @@ fn main_1() { var undefined : f32; var x_45 : bool; var x_46_phi : bool; - undefined = sinh(0x1.8p+128); + undefined = sinh(1.0); let x_10 : i32 = x_6.x_GLF_uniform_int_values[0].el; let x_38 : bool = (1 == x_10); x_46_phi = x_38; @@ -60,7 +60,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl index 405795b4c5..2707f5659e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl @@ -26,7 +26,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl index 7ee2ddc013..6d695adf70 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl @@ -93,7 +93,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl index 0c68847fb6..1a714f0b33 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl @@ -53,7 +53,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl index 6a1eb17baa..9b23f2a7f6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl @@ -72,7 +72,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl index e5f7fe4018..7ae5656963 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl @@ -228,7 +228,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm index c686e933a0..0801da5b6f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm @@ -1,154 +1,154 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 310 - OpName %main "main" - OpName %v1 "v1" - OpName %buf0 "buf0" - OpMemberName %buf0 0 "_GLF_uniform_float_values" - OpName %_ "" - OpName %v2 "v2" - OpName %v3 "v3" - OpName %v4 "v4" - OpName %_GLF_color "_GLF_color" - OpDecorate %_arr_float_uint_7 ArrayStride 16 - OpMemberDecorate %buf0 0 Offset 0 - OpDecorate %buf0 Block - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %12 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v1 "v1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_7 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 %_ptr_Function_v4float = OpTypePointer Function %v4float - %uint = OpTypeInt 32 0 - %uint_7 = OpConstant %uint 7 -%_arr_float_uint_7 = OpTypeArray %float %uint_7 - %buf0 = OpTypeStruct %_arr_float_uint_7 -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %_ = OpVariable %_ptr_Uniform_buf0 Uniform - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 - %int_2 = OpConstant %int 2 -%_ptr_Uniform_float = OpTypePointer Uniform %float -%float_1_57079637 = OpConstant %float 1.57079637 -%float_1_11976957 = OpConstant %float 1.11976957 -%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 -%float_0_927295208 = OpConstant %float 0.927295208 - %27 = OpConstantComposite %v4float %float_1_57079637 %float_1_11976957 %float_0x1_8p_128 %float_0_927295208 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %bool = OpTypeBool - %uint_0 = OpConstant %uint 0 -%_ptr_Function_float = OpTypePointer Function %float - %int_4 = OpConstant %int 4 - %int_5 = OpConstant %int 5 - %uint_1 = OpConstant %uint 1 - %int_3 = OpConstant %int 3 - %int_6 = OpConstant %int 6 - %uint_3 = OpConstant %uint 3 - %int_1 = OpConstant %int 1 - %main = OpFunction %void None %12 - %39 = OpLabel - %v1 = OpVariable %_ptr_Function_v4float Function - %v2 = OpVariable %_ptr_Function_v4float Function - %v3 = OpVariable %_ptr_Function_v4float Function - %v4 = OpVariable %_ptr_Function_v4float Function - %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 - %41 = OpLoad %float %40 - %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 - %43 = OpLoad %float %42 - %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %45 = OpLoad %float %44 - %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 - %47 = OpLoad %float %46 - %48 = OpCompositeConstruct %v4float %41 %43 %45 %47 - OpStore %v1 %48 - OpStore %v2 %27 - %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %50 = OpLoad %float %49 - %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 - OpStore %v3 %51 - %52 = OpLoad %v4float %v1 - %53 = OpLoad %v4float %v2 - %54 = OpLoad %v4float %v3 - %55 = OpExtInst %v4float %1 SmoothStep %52 %53 %54 - OpStore %v4 %55 - %56 = OpLoad %v4float %v4 - %57 = OpVectorShuffle %v4float %56 %56 0 1 3 0 - OpStore %_GLF_color %57 - %58 = OpAccessChain %_ptr_Function_float %v4 %uint_0 - %59 = OpLoad %float %58 - %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 - %61 = OpLoad %float %60 - %62 = OpFOrdGreaterThan %bool %59 %61 - OpSelectionMerge %63 None - OpBranchConditional %62 %64 %63 - %64 = OpLabel - %65 = OpAccessChain %_ptr_Function_float %v4 %uint_0 - %66 = OpLoad %float %65 - %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_5 - %68 = OpLoad %float %67 - %69 = OpFOrdLessThan %bool %66 %68 - OpBranch %63 - %63 = OpLabel - %70 = OpPhi %bool %62 %39 %69 %64 - OpSelectionMerge %71 None - OpBranchConditional %70 %72 %71 - %72 = OpLabel - %73 = OpAccessChain %_ptr_Function_float %v4 %uint_1 - %74 = OpLoad %float %73 - %75 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 - %76 = OpLoad %float %75 - %77 = OpFOrdGreaterThan %bool %74 %76 - OpBranch %71 - %71 = OpLabel - %78 = OpPhi %bool %70 %63 %77 %72 - OpSelectionMerge %79 None - OpBranchConditional %78 %80 %79 - %80 = OpLabel - %81 = OpAccessChain %_ptr_Function_float %v4 %uint_1 - %82 = OpLoad %float %81 - %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_6 - %84 = OpLoad %float %83 - %85 = OpFOrdLessThan %bool %82 %84 - OpBranch %79 - %79 = OpLabel - %86 = OpPhi %bool %78 %71 %85 %80 - OpSelectionMerge %87 None - OpBranchConditional %86 %88 %87 - %88 = OpLabel - %89 = OpAccessChain %_ptr_Function_float %v4 %uint_3 - %90 = OpLoad %float %89 - %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %92 = OpLoad %float %91 - %93 = OpFOrdEqual %bool %90 %92 - OpBranch %87 - %87 = OpLabel - %94 = OpPhi %bool %86 %79 %93 %88 - OpSelectionMerge %95 None - OpBranchConditional %94 %96 %97 - %96 = OpLabel - %98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %99 = OpLoad %float %98 - %100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 - %101 = OpLoad %float %100 - %102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 - %103 = OpLoad %float %102 - %104 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %105 = OpLoad %float %104 - %106 = OpCompositeConstruct %v4float %99 %101 %103 %105 - OpStore %_GLF_color %106 - OpBranch %95 - %97 = OpLabel - %107 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 - %108 = OpLoad %float %107 - %109 = OpCompositeConstruct %v4float %108 %108 %108 %108 - OpStore %_GLF_color %109 - OpBranch %95 - %95 = OpLabel - OpReturn - OpFunctionEnd + %uint = OpTypeInt 32 0 + %uint_7 = OpConstant %uint 7 + %_arr_float_uint_7 = OpTypeArray %float %uint_7 + %buf0 = OpTypeStruct %_arr_float_uint_7 + %_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1_57079637 = OpConstant %float 1.57079637 + %float_1_11976957 = OpConstant %float 1.11976957 + %float_1 = OpConstant %float 1.0 + %float_0_927295208 = OpConstant %float 0.927295208 + %27 = OpConstantComposite %v4float %float_1_57079637 %float_1_11976957 %float_1 %float_0_927295208 + %_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %_ptr_Function_float = OpTypePointer Function %float + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %int_3 = OpConstant %int 3 + %int_6 = OpConstant %int 6 + %uint_3 = OpConstant %uint 3 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %12 + %39 = OpLabel + %v1 = OpVariable %_ptr_Function_v4float Function + %v2 = OpVariable %_ptr_Function_v4float Function + %v3 = OpVariable %_ptr_Function_v4float Function + %v4 = OpVariable %_ptr_Function_v4float Function + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v4float %41 %43 %45 %47 + OpStore %v1 %48 + OpStore %v2 %27 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %v3 %51 + %52 = OpLoad %v4float %v1 + %53 = OpLoad %v4float %v2 + %54 = OpLoad %v4float %v3 + %55 = OpExtInst %v4float %1 SmoothStep %52 %53 %54 + OpStore %v4 %55 + %56 = OpLoad %v4float %v4 + %57 = OpVectorShuffle %v4float %56 %56 0 1 3 0 + OpStore %_GLF_color %57 + %58 = OpAccessChain %_ptr_Function_float %v4 %uint_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %61 = OpLoad %float %60 + %62 = OpFOrdGreaterThan %bool %59 %61 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpAccessChain %_ptr_Function_float %v4 %uint_0 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_5 + %68 = OpLoad %float %67 + %69 = OpFOrdLessThan %bool %66 %68 + OpBranch %63 + %63 = OpLabel + %70 = OpPhi %bool %62 %39 %69 %64 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpAccessChain %_ptr_Function_float %v4 %uint_1 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %76 = OpLoad %float %75 + %77 = OpFOrdGreaterThan %bool %74 %76 + OpBranch %71 + %71 = OpLabel + %78 = OpPhi %bool %70 %63 %77 %72 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + %81 = OpAccessChain %_ptr_Function_float %v4 %uint_1 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_6 + %84 = OpLoad %float %83 + %85 = OpFOrdLessThan %bool %82 %84 + OpBranch %79 + %79 = OpLabel + %86 = OpPhi %bool %78 %71 %85 %80 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + %89 = OpAccessChain %_ptr_Function_float %v4 %uint_3 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpFOrdEqual %bool %90 %92 + OpBranch %87 + %87 = OpLabel + %94 = OpPhi %bool %86 %79 %93 %88 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %105 = OpLoad %float %104 + %106 = OpCompositeConstruct %v4float %99 %101 %103 %105 + OpStore %_GLF_color %106 + OpBranch %95 + %97 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %108 = OpLoad %float %107 + %109 = OpCompositeConstruct %v4float %108 %108 %108 %108 + OpStore %_GLF_color %109 + OpBranch %95 + %95 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl index 0d9d1c0f8e..8db47c1376 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl @@ -31,7 +31,7 @@ fn main_1() { let x_45 : f32 = x_6.x_GLF_uniform_float_values[0].el; let x_47 : f32 = x_6.x_GLF_uniform_float_values[2].el; v1 = vec4(x_41, x_43, x_45, x_47); - v2 = vec4(1.570796371, 1.119769573, 0x1.8p+128, 0.927295208); + v2 = vec4(1.570796371, 1.119769573, 1.0, 0.927295208); let x_50 : f32 = x_6.x_GLF_uniform_float_values[0].el; v3 = vec4(x_50, x_50, x_50, x_50); let x_52 : vec4 = v1; @@ -93,7 +93,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl index fd2a248a00..f054a867d0 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl @@ -67,7 +67,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl index 28978282f9..34bdda3bef 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl @@ -51,7 +51,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl index f3376403cc..1dd221f139 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl @@ -75,7 +75,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl index 656a8247be..5ed9acf781 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl @@ -66,7 +66,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl index fe80563295..8b0be0921e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl @@ -67,7 +67,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl index dd18cd58a2..10b0b75688 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl @@ -153,7 +153,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl index 01c22cf13c..0dc3069022 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl @@ -151,7 +151,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl index 1bd35c9f16..56f31adcf4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl @@ -36,7 +36,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl index 6fe0c209fa..44d84ee15c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl @@ -79,7 +79,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl index 2d3a69b39a..e0b1c7d30a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl @@ -55,7 +55,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl index 3803b96b55..a517edc55c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl @@ -85,7 +85,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl index 840baf19bc..12131bc0d9 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl @@ -56,7 +56,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl index f8aae14c96..efd21d3f30 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl @@ -56,7 +56,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl index d77e5eff0f..4763b60610 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl @@ -52,7 +52,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl index 2828ef3183..b4408a66dc 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl @@ -147,7 +147,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl index 723750d3f2..4cd39d2edf 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl @@ -41,7 +41,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl index aed5a7c878..dba1df6619 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl @@ -51,7 +51,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl index 2e7e905122..3d8c594c61 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl @@ -59,7 +59,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl index 5a12a3a0ee..d7b593a704 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl @@ -74,7 +74,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl index f9bf0346b4..961247d226 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl @@ -24,7 +24,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl index 12fa7fd62b..3465cfae35 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl @@ -32,7 +32,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl index e129446fd4..09f2c578bf 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl @@ -22,7 +22,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl index 33f0a301c8..09192ed0fa 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl @@ -27,7 +27,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl index ff07167a20..a49457f8b9 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl @@ -33,7 +33,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl index a37027f6a8..dcc2d71ef7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl @@ -17,7 +17,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl index 4d552c135f..06db937ca3 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl @@ -24,7 +24,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl index dbd8670039..ef5aad630b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl @@ -72,7 +72,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl index bde5e50704..3e94de70fe 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl @@ -32,7 +32,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl index e744089580..e480acbc4c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl @@ -62,7 +62,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl index 0c19e6f3ef..abb114b0ad 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl @@ -44,7 +44,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl index 4563cb8ac9..f78ce8289f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl @@ -46,7 +46,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl index 37d5e8d78c..3e232f0ae8 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl @@ -18,7 +18,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl index 0c8d7f08b6..5887199008 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl @@ -82,7 +82,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl index df26d79d6a..8449566e6c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl @@ -25,7 +25,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl index e9d8121a6e..1903882fa6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl @@ -61,7 +61,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl index 1cab56ccc6..1320e87dd2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl @@ -62,7 +62,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl index 1a5eda78e8..56aa25c136 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl @@ -34,7 +34,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl index 4f9c8f6a6c..f617b1eb34 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl @@ -69,7 +69,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl index 4ead1098d7..ff986fefeb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl @@ -43,7 +43,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl index 401a99e240..a3c7d905df 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl @@ -100,7 +100,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl index 7c8c99e76d..cb7f47c521 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl @@ -69,7 +69,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl index 8903c42a33..b0264c43d7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl @@ -79,7 +79,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl index 2acb3047e4..20f56819fb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl @@ -61,7 +61,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl index 9f7e35015a..ca9da8ce07 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl @@ -92,7 +92,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl index 1146646ff6..94a5965527 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl @@ -45,7 +45,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl index 937966c0c8..528a80e28c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl @@ -53,7 +53,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl index 9cfcb8572d..ea897a92aa 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl @@ -55,7 +55,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl index 730a78bda2..a79e26b022 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl @@ -70,7 +70,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm deleted file mode 100644 index 294733e908..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm +++ /dev/null @@ -1,214 +0,0 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 310 - OpName %main "main" - OpName %func_f1_ "func(f1;" - OpName %x "x" - OpName %a "a" - OpName %f "f" - OpName %i "i" - OpName %param "param" - OpName %param_0 "param" - OpName %_GLF_color "_GLF_color" - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %12 = OpTypeFunction %void - %float = OpTypeFloat 32 -%_ptr_Function_float = OpTypePointer Function %float - %15 = OpTypeFunction %float %_ptr_Function_float - %bool = OpTypeBool - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %float_6 = OpConstant %float 6 - %float_5 = OpConstant %float 5 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 - %false = OpConstantFalse %bool -%_ptr_Function_bool = OpTypePointer Function %bool - %true = OpConstantTrue %bool - %main = OpFunction %void None %12 - %28 = OpLabel - %29 = OpVariable %_ptr_Function_bool Function %false - %30 = OpVariable %_ptr_Function_float Function - %31 = OpVariable %_ptr_Function_float Function - %32 = OpVariable %_ptr_Function_float Function - %33 = OpVariable %_ptr_Function_bool Function %false - %34 = OpVariable %_ptr_Function_float Function - %35 = OpVariable %_ptr_Function_float Function - %36 = OpVariable %_ptr_Function_float Function - %f = OpVariable %_ptr_Function_float Function - %i = OpVariable %_ptr_Function_float Function - %param = OpVariable %_ptr_Function_float Function - %param_0 = OpVariable %_ptr_Function_float Function - OpStore %f %float_0 - OpStore %i %float_0 - OpBranch %37 - %37 = OpLabel - %38 = OpLoad %float %i - OpStore %param %38 - OpStore %33 %false - OpLoopMerge %39 %37 None - OpBranch %40 - %40 = OpLabel - %41 = OpLoad %float %param - OpStore %35 %41 - OpLoopMerge %42 %43 None - OpBranch %44 - %44 = OpLabel - OpLoopMerge %45 %46 None - OpBranch %47 - %47 = OpLabel - %48 = OpLoad %float %35 - %49 = OpLoad %float %param - %50 = OpFOrdEqual %bool %48 %49 - OpSelectionMerge %51 None - OpBranchConditional %50 %52 %51 - %52 = OpLabel - %53 = OpLoad %float %35 - OpStore %33 %true - OpStore %34 %53 - OpBranch %45 - %51 = OpLabel - %54 = OpLoad %float %35 - %55 = OpFAdd %float %54 %float_1 - OpStore %35 %55 - OpBranch %46 - %46 = OpLabel - %56 = OpLoad %float %35 - %57 = OpLoad %float %param - %58 = OpFOrdLessThan %bool %56 %57 - OpBranchConditional %58 %44 %45 - %45 = OpLabel - %59 = OpLoad %bool %33 - OpSelectionMerge %60 None - OpBranchConditional %59 %42 %60 - %60 = OpLabel - OpStore %33 %true - OpStore %34 %float_0 - OpBranch %42 - %43 = OpLabel - OpBranch %40 - %42 = OpLabel - %61 = OpLoad %float %34 - OpStore %36 %61 - OpStore %f %61 - OpStore %param_0 %float_1 - OpStore %29 %false - OpBranch %62 - %62 = OpLabel - %63 = OpLoad %float %param_0 - OpStore %31 %63 - OpLoopMerge %64 %65 None - OpBranch %66 - %66 = OpLabel - OpLoopMerge %67 %68 None - OpBranch %69 - %69 = OpLabel - %70 = OpLoad %float %31 - %71 = OpLoad %float %param_0 - %72 = OpFOrdEqual %bool %70 %71 - OpSelectionMerge %73 None - OpBranchConditional %72 %74 %73 - %74 = OpLabel - %75 = OpLoad %float %31 - OpStore %29 %true - OpStore %30 %75 - OpBranch %67 - %73 = OpLabel - %76 = OpLoad %float %31 - %77 = OpFAdd %float %76 %float_1 - OpStore %31 %77 - OpBranch %68 - %68 = OpLabel - %78 = OpLoad %float %31 - %79 = OpLoad %float %param_0 - %80 = OpFOrdLessThan %bool %78 %79 - OpBranchConditional %80 %66 %67 - %67 = OpLabel - %81 = OpLoad %bool %29 - OpSelectionMerge %82 None - OpBranchConditional %81 %64 %82 - %82 = OpLabel - OpStore %29 %true - OpStore %30 %float_0 - OpBranch %64 - %65 = OpLabel - OpBranch %62 - %64 = OpLabel - %83 = OpLoad %float %30 - OpStore %32 %83 - %84 = OpLoad %float %i - %85 = OpFAdd %float %84 %83 - OpStore %i %85 - %86 = OpFOrdLessThan %bool %85 %float_6 - OpBranchConditional %86 %37 %39 - %39 = OpLabel - %87 = OpLoad %float %f - %88 = OpFOrdEqual %bool %87 %float_5 - OpSelectionMerge %89 None - OpBranchConditional %88 %90 %91 - %90 = OpLabel - OpStore %_GLF_color %23 - OpBranch %89 - %91 = OpLabel - OpStore %_GLF_color %24 - OpBranch %89 - %89 = OpLabel - OpReturn - OpFunctionEnd - %func_f1_ = OpFunction %float None %15 - %x = OpFunctionParameter %_ptr_Function_float - %92 = OpLabel - %93 = OpVariable %_ptr_Function_bool Function %false - %94 = OpVariable %_ptr_Function_float Function - %a = OpVariable %_ptr_Function_float Function - OpBranch %95 - %95 = OpLabel - %96 = OpLoad %float %x - OpStore %a %96 - OpLoopMerge %97 %98 None - OpBranch %99 - %99 = OpLabel - OpLoopMerge %100 %101 None - OpBranch %102 - %102 = OpLabel - %103 = OpLoad %float %a - %104 = OpLoad %float %x - %105 = OpFOrdEqual %bool %103 %104 - OpSelectionMerge %106 None - OpBranchConditional %105 %107 %106 - %107 = OpLabel - %108 = OpLoad %float %a - OpStore %93 %true - OpStore %94 %108 - OpBranch %100 - %106 = OpLabel - %109 = OpLoad %float %a - %110 = OpFAdd %float %109 %float_1 - OpStore %a %110 - OpBranch %101 - %101 = OpLabel - %111 = OpLoad %float %a - %112 = OpLoad %float %x - %113 = OpFOrdLessThan %bool %111 %112 - OpBranchConditional %113 %99 %100 - %100 = OpLabel - %114 = OpLoad %bool %93 - OpSelectionMerge %115 None - OpBranchConditional %114 %97 %115 - %115 = OpLabel - OpStore %93 %true - OpStore %94 %float_0 - OpBranch %97 - %98 = OpLabel - OpBranch %95 - %97 = OpLabel - %116 = OpLoad %float %94 - OpReturnValue %116 - OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl deleted file mode 100644 index a43ae19b6d..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl +++ /dev/null @@ -1,159 +0,0 @@ -var x_GLF_color : vec4; - -fn main_1() { - var x_29 : bool = false; - var x_30 : f32; - var x_31 : f32; - var x_32 : f32; - var x_33 : bool = false; - var x_34 : f32; - var x_35 : f32; - var x_36 : f32; - var f : f32; - var i : f32; - var param : f32; - var param_1 : f32; - f = 0.0; - i = 0.0; - loop { - let x_38 : f32 = i; - param = x_38; - x_33 = false; - loop { - let x_41 : f32 = param; - x_35 = x_41; - loop { - let x_48 : f32 = x_35; - let x_49 : f32 = param; - if ((x_48 == x_49)) { - let x_53 : f32 = x_35; - x_33 = true; - x_34 = x_53; - break; - } - let x_54 : f32 = x_35; - x_35 = (x_54 + 1.0); - - continuing { - let x_56 : f32 = x_35; - let x_57 : f32 = param; - if ((x_56 < x_57)) { - } else { - break; - } - } - } - let x_59 : bool = x_33; - if (x_59) { - break; - } - x_33 = true; - x_34 = 0.0; - break; - } - let x_61 : f32 = x_34; - x_36 = x_61; - f = x_61; - param_1 = 1.0; - x_29 = false; - loop { - let x_63 : f32 = param_1; - x_31 = x_63; - loop { - let x_70 : f32 = x_31; - let x_71 : f32 = param_1; - if ((x_70 == x_71)) { - let x_75 : f32 = x_31; - x_29 = true; - x_30 = x_75; - break; - } - let x_76 : f32 = x_31; - x_31 = (x_76 + 1.0); - - continuing { - let x_78 : f32 = x_31; - let x_79 : f32 = param_1; - if ((x_78 < x_79)) { - } else { - break; - } - } - } - let x_81 : bool = x_29; - if (x_81) { - break; - } - x_29 = true; - x_30 = 0.0; - break; - } - let x_83 : f32 = x_30; - x_32 = x_83; - let x_84 : f32 = i; - let x_85 : f32 = (x_84 + x_83); - i = x_85; - if ((x_85 < 6.0)) { - } else { - break; - } - } - let x_87 : f32 = f; - if ((x_87 == 5.0)) { - x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); - } else { - x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); - } - return; -} - -struct main_out { - @location(0) - x_GLF_color_1 : vec4, -} - -@stage(fragment) -fn main() -> main_out { - main_1(); - return main_out(x_GLF_color); -} - -fn func_f1_(x : ptr) -> f32 { - var x_93 : bool = false; - var x_94 : f32; - var a : f32; - loop { - let x_96 : f32 = *(x); - a = x_96; - loop { - let x_103 : f32 = a; - let x_104 : f32 = *(x); - if ((x_103 == x_104)) { - let x_108 : f32 = a; - x_93 = true; - x_94 = x_108; - break; - } - let x_109 : f32 = a; - a = (x_109 + 1.0); - - continuing { - let x_111 : f32 = a; - let x_112 : f32 = *(x); - if ((x_111 < x_112)) { - } else { - break; - } - } - } - let x_114 : bool = x_93; - if (x_114) { - break; - } - x_93 = true; - x_94 = 0.0; - break; - } - let x_116 : f32 = x_94; - return x_116; -} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.dxc.hlsl new file mode 100755 index 0000000000..f969dee209 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.dxc.hlsl @@ -0,0 +1,93 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float array0[3] = (float[3])0; +static float array1[3] = (float[3])0; +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int q = 0; + int i = 0; + int c = 0; + q = 0; + const float x_55 = gl_FragCoord.x; + i = (int(x_55) % 3); + c = 0; + { + [loop] for(; (c < 3); c = (c + 1)) { + array0[c] = 0.0f; + array1[c] = 0.0f; + const float x_65 = asfloat(x_11[0].x); + switch((int(x_65) + q)) { + case 51: { + [loop] while (true) { + if (true) { + } else { + break; + } + } + array0[c] = 1.0f; + /* fallthrough */ + { + array1[0] = 1.0f; + array1[c] = 1.0f; + } + break; + } + case 61: { + array1[0] = 1.0f; + array1[c] = 1.0f; + break; + } + case 0: { + q = 61; + break; + } + default: { + break; + } + } + } + } + const float x_79 = array1[i]; + const float x_81 = array0[i]; + const float x_83 = array0[i]; + x_GLF_color = float4(x_79, x_81, x_83, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:77: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.fxc.hlsl new file mode 100755 index 0000000000..e42f19ce79 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float array0[3] = (float[3])0; +static float array1[3] = (float[3])0; +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int q = 0; + int i = 0; + int c = 0; + q = 0; + const float x_55 = gl_FragCoord.x; + i = (int(x_55) % 3); + c = 0; + { + [loop] for(; (c < 3); c = (c + 1)) { + array0[c] = 0.0f; + array1[c] = 0.0f; + const float x_65 = asfloat(x_11[0].x); + switch((int(x_65) + q)) { + case 51: { + [loop] while (true) { + if (true) { + } else { + break; + } + } + array0[c] = 1.0f; + /* fallthrough */ + { + array1[0] = 1.0f; + array1[c] = 1.0f; + } + break; + } + case 61: { + array1[0] = 1.0f; + array1[c] = 1.0f; + break; + } + case 0: { + q = 61; + break; + } + default: { + break; + } + } + } + } + const float x_79 = array1[i]; + const float x_81 = array0[i]; + const float x_83 = array0[i]; + x_GLF_color = float4(x_79, x_81, x_83, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl deleted file mode 100755 index 8c99b40998..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,90 +0,0 @@ -SKIP: FAILED - -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float array0[3] = (float[3])0; -static float array1[3] = (float[3])0; -cbuffer cbuffer_x_11 : register(b0, space0) { - uint4 x_11[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - int q = 0; - int i = 0; - int c = 0; - q = 0; - const float x_55 = gl_FragCoord.x; - i = (int(x_55) % 3); - c = 0; - { - [loop] for(; (c < 3); c = (c + 1)) { - array0[c] = 0.0f; - array1[c] = 0.0f; - const float x_65 = asfloat(x_11[0].x); - switch((int(x_65) + q)) { - case 51: { - [loop] while (true) { - if (true) { - } else { - break; - } - } - array0[c] = 1.0f; - /* fallthrough */ - { - array1[0] = 1.0f; - array1[c] = 1.0f; - } - break; - } - case 61: { - array1[0] = 1.0f; - array1[c] = 1.0f; - break; - } - case 0: { - q = 61; - break; - } - default: { - break; - } - } - } - } - const float x_79 = array1[i]; - const float x_81 = array0[i]; - const float x_83 = array0[i]; - x_GLF_color = float4(x_79, x_81, x_83, 1.0f); - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\u1jmg.0:77: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl index 84379722dc..6042980277 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl @@ -76,7 +76,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.dxc.hlsl new file mode 100755 index 0000000000..f969dee209 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.dxc.hlsl @@ -0,0 +1,93 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float array0[3] = (float[3])0; +static float array1[3] = (float[3])0; +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int q = 0; + int i = 0; + int c = 0; + q = 0; + const float x_55 = gl_FragCoord.x; + i = (int(x_55) % 3); + c = 0; + { + [loop] for(; (c < 3); c = (c + 1)) { + array0[c] = 0.0f; + array1[c] = 0.0f; + const float x_65 = asfloat(x_11[0].x); + switch((int(x_65) + q)) { + case 51: { + [loop] while (true) { + if (true) { + } else { + break; + } + } + array0[c] = 1.0f; + /* fallthrough */ + { + array1[0] = 1.0f; + array1[c] = 1.0f; + } + break; + } + case 61: { + array1[0] = 1.0f; + array1[c] = 1.0f; + break; + } + case 0: { + q = 61; + break; + } + default: { + break; + } + } + } + } + const float x_79 = array1[i]; + const float x_81 = array0[i]; + const float x_83 = array0[i]; + x_GLF_color = float4(x_79, x_81, x_83, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:77: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.fxc.hlsl new file mode 100755 index 0000000000..e42f19ce79 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,84 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float array0[3] = (float[3])0; +static float array1[3] = (float[3])0; +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int q = 0; + int i = 0; + int c = 0; + q = 0; + const float x_55 = gl_FragCoord.x; + i = (int(x_55) % 3); + c = 0; + { + [loop] for(; (c < 3); c = (c + 1)) { + array0[c] = 0.0f; + array1[c] = 0.0f; + const float x_65 = asfloat(x_11[0].x); + switch((int(x_65) + q)) { + case 51: { + [loop] while (true) { + if (true) { + } else { + break; + } + } + array0[c] = 1.0f; + /* fallthrough */ + { + array1[0] = 1.0f; + array1[c] = 1.0f; + } + break; + } + case 61: { + array1[0] = 1.0f; + array1[c] = 1.0f; + break; + } + case 0: { + q = 61; + break; + } + default: { + break; + } + } + } + } + const float x_79 = array1[i]; + const float x_81 = array0[i]; + const float x_83 = array0[i]; + x_GLF_color = float4(x_79, x_81, x_83, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl deleted file mode 100755 index 3f39b8282d..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,90 +0,0 @@ -SKIP: FAILED - -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float array0[3] = (float[3])0; -static float array1[3] = (float[3])0; -cbuffer cbuffer_x_11 : register(b0, space0) { - uint4 x_11[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - int q = 0; - int i = 0; - int c = 0; - q = 0; - const float x_55 = gl_FragCoord.x; - i = (int(x_55) % 3); - c = 0; - { - [loop] for(; (c < 3); c = (c + 1)) { - array0[c] = 0.0f; - array1[c] = 0.0f; - const float x_65 = asfloat(x_11[0].x); - switch((int(x_65) + q)) { - case 51: { - [loop] while (true) { - if (true) { - } else { - break; - } - } - array0[c] = 1.0f; - /* fallthrough */ - { - array1[0] = 1.0f; - array1[c] = 1.0f; - } - break; - } - case 61: { - array1[0] = 1.0f; - array1[c] = 1.0f; - break; - } - case 0: { - q = 61; - break; - } - default: { - break; - } - } - } - } - const float x_79 = array1[i]; - const float x_81 = array0[i]; - const float x_83 = array0[i]; - x_GLF_color = float4(x_79, x_81, x_83, 1.0f); - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\u1v1c.0:77: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl index 918fa8a8d8..59f25b4b00 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl @@ -93,7 +93,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl index f1e118ec25..f83ce2ed83 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl @@ -69,7 +69,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl index df50e29cbc..d0d229b646 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl @@ -17,7 +17,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl index 8692c5a959..277b9a220e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl @@ -62,7 +62,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl index 6473fbaa33..cdb1c69aa7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl @@ -69,7 +69,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl index 1fb1cb2451..281a136906 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl @@ -17,7 +17,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl index 803d61a66b..cf44a69640 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl @@ -64,7 +64,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl index fb1065d5bb..0af76ab6da 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl @@ -46,7 +46,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl index 5dcceaaf27..640d4df9e8 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl @@ -21,7 +21,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl index d0c12de4ce..b111a60aeb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl @@ -21,7 +21,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl index 2107dd3b5e..9d3fa96649 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl @@ -20,7 +20,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl index a2a02a0283..245db9ece8 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl @@ -17,7 +17,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl index 4089c1f22d..a8d8ceaa9f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl @@ -31,7 +31,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl index f4422c8caf..48820a310a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl @@ -17,7 +17,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl index 9c233ec420..61658e9032 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl @@ -28,7 +28,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl index 7d02d77e09..af4f4b2f93 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl @@ -17,7 +17,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl index b543414945..58d674c7d6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl @@ -68,7 +68,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl index 007ff8f695..cf7bb0f41c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl @@ -17,7 +17,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl index 58700bc6da..6e7b565f3d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl @@ -20,7 +20,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl index 7e3367d56c..ed6eebed84 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl @@ -37,7 +37,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl index 5b1b46f3b0..4572702313 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl @@ -21,7 +21,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl index 9d3abf8c75..5f8a19bc94 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl index 784949c20e..3e6470ae83 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl @@ -21,7 +21,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl index b751c1be67..7a3f940672 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl @@ -21,7 +21,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl index e2a3c0de2e..9f58ee0c3b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl @@ -28,7 +28,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl index 07b9211791..c5a4fd7bd2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl @@ -25,7 +25,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl index b172dad5b1..72f1d19e38 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl @@ -25,7 +25,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl index 1ff19b5040..58bedfee92 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl @@ -25,7 +25,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl index 61d845160c..e3764baba1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl index aeb7d658ca..0348fd7321 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl index cef61b2ecd..b3a70c415a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl @@ -35,7 +35,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl index 6af612bfba..b18a4268fa 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl @@ -28,7 +28,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl index 812b29d050..f5f52a3c87 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl @@ -21,7 +21,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl index 728b7bc71a..7d3dab7b1c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl @@ -24,7 +24,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl index 3ade036e2a..186261e71f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl @@ -21,7 +21,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl index d242c7fac0..ece67fcabf 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl @@ -21,7 +21,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl index 5139fdca61..bad9a67cc1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl @@ -27,7 +27,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl index 12b5e94cc6..a7ae8bdc65 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl @@ -20,7 +20,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl index 589559b182..496d491acf 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl @@ -29,7 +29,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl index 5cb935fa87..eebd08edfc 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl @@ -50,7 +50,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl index 96df572ffc..ebda8b7e60 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl @@ -73,7 +73,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl index ab5a15799c..ec9ebf03b8 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl @@ -63,7 +63,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm index b22a5e5c0d..3058231251 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm @@ -1,97 +1,97 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 320 - OpName %main "main" - OpName %f0 "f0" - OpName %f1 "f1" - OpName %gl_FragCoord "gl_FragCoord" - OpName %buf0 "buf0" - OpMemberName %buf0 0 "_GLF_uniform_float_values" - OpName %_ "" - OpName %_GLF_color "_GLF_color" - OpName %buf1 "buf1" - OpMemberName %buf1 0 "_GLF_uniform_int_values" - OpName %__0 "" - OpDecorate %gl_FragCoord BuiltIn FragCoord - OpDecorate %_arr_float_uint_1 ArrayStride 16 - OpMemberDecorate %buf0 0 Offset 0 - OpDecorate %buf0 Block - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 - OpDecorate %_GLF_color Location 0 - OpDecorate %_arr_int_uint_2 ArrayStride 16 - OpMemberDecorate %buf1 0 Offset 0 - OpDecorate %buf1 Block - OpDecorate %__0 DescriptorSet 0 - OpDecorate %__0 Binding 1 - %void = OpTypeVoid - %14 = OpTypeFunction %void - %float = OpTypeFloat 32 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f0 "f0" + OpName %f1 "f1" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 %_ptr_Function_float = OpTypePointer Function %float -%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 - %v4float = OpTypeVector %float 4 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%gl_FragCoord = OpVariable %_ptr_Input_v4float Input - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Input_float = OpTypePointer Input %float - %uint_1 = OpConstant %uint 1 -%_arr_float_uint_1 = OpTypeArray %float %uint_1 - %buf0 = OpTypeStruct %_arr_float_uint_1 -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %_ = OpVariable %_ptr_Uniform_buf0 Uniform - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 -%_ptr_Uniform_float = OpTypePointer Uniform %float - %bool = OpTypeBool + %float_1 = OpConstant %float 1.0 + %v4float = OpTypeVector %float 4 + %_ptr_Input_v4float = OpTypePointer Input %v4float + %gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 + %_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 + %_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool %_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %uint_2 = OpConstant %uint 2 -%_arr_int_uint_2 = OpTypeArray %int %uint_2 - %buf1 = OpTypeStruct %_arr_int_uint_2 -%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 - %__0 = OpVariable %_ptr_Uniform_buf1 Uniform - %int_1 = OpConstant %int 1 -%_ptr_Uniform_int = OpTypePointer Uniform %int - %main = OpFunction %void None %14 - %34 = OpLabel - %f0 = OpVariable %_ptr_Function_float Function - %f1 = OpVariable %_ptr_Function_float Function - OpStore %f0 %float_0x1_8p_128 - %35 = OpLoad %float %f0 - %36 = OpExtInst %float %1 Fract %35 - OpStore %f1 %36 - %37 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %38 = OpLoad %float %37 - %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %40 = OpLoad %float %39 - %41 = OpFOrdGreaterThan %bool %38 %40 - OpSelectionMerge %42 None - OpBranchConditional %41 %43 %44 - %43 = OpLabel - %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 - %46 = OpLoad %int %45 - %47 = OpConvertSToF %float %46 - %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 - %49 = OpLoad %int %48 - %50 = OpConvertSToF %float %49 - %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 - %52 = OpLoad %int %51 - %53 = OpConvertSToF %float %52 - %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 - %55 = OpLoad %int %54 - %56 = OpConvertSToF %float %55 - %57 = OpCompositeConstruct %v4float %47 %50 %53 %56 - OpStore %_GLF_color %57 - OpBranch %42 - %44 = OpLabel - %58 = OpLoad %float %f1 - %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 - OpStore %_GLF_color %59 - OpBranch %42 - %42 = OpLabel - OpReturn - OpFunctionEnd + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 + %_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 + %_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 + %_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %14 + %34 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function + %f1 = OpVariable %_ptr_Function_float Function + OpStore %f0 %float_1 + %35 = OpLoad %float %f0 + %36 = OpExtInst %float %1 Fract %35 + OpStore %f1 %36 + %37 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThan %bool %38 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %47 %50 %53 %56 + OpStore %_GLF_color %57 + OpBranch %42 + %44 = OpLabel + %58 = OpLoad %float %f1 + %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 + OpStore %_GLF_color %59 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl index a511274a6d..738125fe0e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl @@ -31,7 +31,7 @@ var x_GLF_color : vec4; fn main_1() { var f0 : f32; var f1 : f32; - f0 = 0x1.8p+128; + f0 = 1.0; let x_35 : f32 = f0; f1 = fract(x_35); let x_38 : f32 = gl_FragCoord.x; @@ -54,7 +54,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl index 6969f4a1d5..1df28851d6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl @@ -57,7 +57,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl index b67f6a21c9..7ea16de819 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl @@ -45,7 +45,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..1b11f2846f --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,102 @@ +SKIP: FAILED + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 data[2] = (float4[2])0; + int b = 0; + int y = 0; + int i = 0; + const uint scalar_offset = ((16u * 0u)) / 4; + const float x_42 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const float x_45 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float4 tint_symbol_5[2] = {float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)}; + data = tint_symbol_5; + const int x_49 = asint(x_10[1].x); + b = x_49; + const float x_51 = gl_FragCoord.y; + const int x_54 = asint(x_10[1].x); + const float x_56 = gl_FragCoord.y; + const int x_60 = asint(x_10[1].x); + y = clamp(int(x_51), (x_54 | int(x_56)), x_60); + const int x_63 = asint(x_10[1].x); + i = x_63; + [loop] while (true) { + bool x_82 = false; + bool x_83_phi = false; + const int x_68 = i; + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_70 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_68 < x_70)) { + } else { + break; + } + const int x_73 = b; + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const int x_75 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const bool x_76 = (x_73 > x_75); + x_83_phi = x_76; + if (x_76) { + const int x_79 = y; + const int x_81 = asint(x_10[1].x); + x_82 = (x_79 > x_81); + x_83_phi = x_82; + } + if (x_83_phi) { + break; + } + b = (b + 1); + { + i = (i + 1); + } + } + const int x_90 = b; + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const int x_92 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_90 == x_92)) { + const int x_97 = asint(x_10[2].x); + const int x_99 = asint(x_10[1].x); + const int x_101 = asint(x_10[3].x); + const int x_104 = asint(x_10[1].x); + const int x_107 = asint(x_10[2].x); + const int x_110 = asint(x_10[2].x); + const int x_113 = asint(x_10[1].x); + data[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113)); + } + const int x_118 = asint(x_10[1].x); + const float4 x_120 = data[x_118]; + x_GLF_color = float4(x_120.x, x_120.y, x_120.z, x_120.w); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_6 = {x_GLF_color}; + return tint_symbol_6; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl deleted file mode 100644 index 582837a88b..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,3 +0,0 @@ -SKIP: FAILED - -exit status 0xc00000fd \ No newline at end of file diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl index 0691fca5de..4e2b13100f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl @@ -99,7 +99,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1b11f2846f --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,102 @@ +SKIP: FAILED + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 data[2] = (float4[2])0; + int b = 0; + int y = 0; + int i = 0; + const uint scalar_offset = ((16u * 0u)) / 4; + const float x_42 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const float x_45 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float4 tint_symbol_5[2] = {float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)}; + data = tint_symbol_5; + const int x_49 = asint(x_10[1].x); + b = x_49; + const float x_51 = gl_FragCoord.y; + const int x_54 = asint(x_10[1].x); + const float x_56 = gl_FragCoord.y; + const int x_60 = asint(x_10[1].x); + y = clamp(int(x_51), (x_54 | int(x_56)), x_60); + const int x_63 = asint(x_10[1].x); + i = x_63; + [loop] while (true) { + bool x_82 = false; + bool x_83_phi = false; + const int x_68 = i; + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_70 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_68 < x_70)) { + } else { + break; + } + const int x_73 = b; + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const int x_75 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const bool x_76 = (x_73 > x_75); + x_83_phi = x_76; + if (x_76) { + const int x_79 = y; + const int x_81 = asint(x_10[1].x); + x_82 = (x_79 > x_81); + x_83_phi = x_82; + } + if (x_83_phi) { + break; + } + b = (b + 1); + { + i = (i + 1); + } + } + const int x_90 = b; + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const int x_92 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_90 == x_92)) { + const int x_97 = asint(x_10[2].x); + const int x_99 = asint(x_10[1].x); + const int x_101 = asint(x_10[3].x); + const int x_104 = asint(x_10[1].x); + const int x_107 = asint(x_10[2].x); + const int x_110 = asint(x_10[2].x); + const int x_113 = asint(x_10[1].x); + data[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113)); + } + const int x_118 = asint(x_10[1].x); + const float4 x_120 = data[x_118]; + x_GLF_color = float4(x_120.x, x_120.y, x_120.z, x_120.w); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_6 = {x_GLF_color}; + return tint_symbol_6; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl deleted file mode 100644 index 582837a88b..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,3 +0,0 @@ -SKIP: FAILED - -exit status 0xc00000fd \ No newline at end of file diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl index 7ca00361b5..0c5a8a5090 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl @@ -76,7 +76,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl index 183832e40e..cf243d6029 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl @@ -96,7 +96,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl index 4ffbb2cb3f..f7a2b84e6e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl @@ -74,7 +74,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl index ca7f418b23..20267d899c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl @@ -64,7 +64,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl index 12c07c69ce..4bbbcb316e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl @@ -144,7 +144,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl index 0361d8a8c7..a997432d9d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl @@ -72,7 +72,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl index 36bfedcce5..adc1178d92 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl @@ -77,7 +77,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl index 854150b417..3e81573484 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl @@ -51,7 +51,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl index 7833a32ddd..3b238a0438 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl @@ -32,7 +32,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl index cf9e22e6ea..d50160bdba 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl @@ -59,7 +59,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl index 66732b5e78..4371470daa 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl @@ -76,7 +76,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl index c682dfc3b9..4f3baca229 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl @@ -55,7 +55,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl index 9c7018ab93..dffd65e968 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl @@ -47,7 +47,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl index ba5f72c231..fc0e8b8bad 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl @@ -91,7 +91,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl index 8d275b8896..d3de501c10 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl @@ -85,7 +85,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl index 89f6084340..45f38025b0 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl @@ -90,7 +90,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl index 592a626558..3a21958ea3 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl @@ -43,7 +43,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl index 8cd0f3123d..8f2685e648 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl @@ -61,7 +61,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl index f5fbe5c826..f4bbc241be 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl @@ -96,7 +96,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl index 0652450f35..27b58b798e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl @@ -72,7 +72,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl index 6cb7a93631..ed73b3dc28 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl @@ -70,7 +70,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl index 488a6f44a4..d63c258a87 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl @@ -31,7 +31,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl index b36fbd078e..8b6de3d890 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl @@ -72,7 +72,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl index c39b3d8648..450f490dd2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl @@ -42,7 +42,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl index e6e3393584..266c5c30f0 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl @@ -33,7 +33,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl index 70a1ede748..d6fa70ffb7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl @@ -87,7 +87,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl index 5a38ad68ba..e1d317bc6f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl @@ -72,7 +72,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl index 5c979eb214..1e20241b83 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl @@ -82,7 +82,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl index 4b7661d0b6..abc3671c8e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl @@ -92,7 +92,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl index 3b6c63b37e..99ea7e4ac9 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl @@ -103,7 +103,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl index ea99ca952d..525654307b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl @@ -78,7 +78,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl index 79615f68b0..b18be7ba3c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl @@ -58,7 +58,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl index 8918a9d9c6..85c9c8df44 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl @@ -50,7 +50,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl index e0cafa1db3..5e207fb2f1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl @@ -80,7 +80,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl index 39cdba3bdf..e2a947974e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl @@ -60,7 +60,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl index 90bbc4afcb..e500f0a085 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl @@ -57,7 +57,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl index 38846e75ff..a50ef0ddf6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl @@ -78,7 +78,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl index 98eb6e6585..9145c249be 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl @@ -99,7 +99,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl index ee6a3df3c2..aeb50098b7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl @@ -73,7 +73,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl index af52c8542a..5484a466cb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl @@ -96,7 +96,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl index 64f35bab45..149b02d5d5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl @@ -98,7 +98,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl index ebf907b2dc..a0d986a6d0 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl @@ -100,7 +100,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl index a55142689c..c84d5e4619 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl @@ -53,7 +53,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl index f473270aec..95fa93bc1f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl @@ -91,7 +91,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl index c587550819..b194928115 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl @@ -33,7 +33,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl index ea785d7757..d7f663bf9c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl index 2815fa85ab..01ab459b35 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl @@ -52,7 +52,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl index 943871b6af..f46299f9a5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl @@ -174,7 +174,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm index 7349452ca9..b26d30ad79 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm @@ -1,93 +1,93 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 310 - OpName %main "main" - OpName %_GLF_color "_GLF_color" - OpName %buf0 "buf0" - OpMemberName %buf0 0 "_GLF_uniform_int_values" - OpName %_ "" - OpName %a "a" - OpName %buf1 "buf1" - OpMemberName %buf1 0 "_GLF_uniform_float_values" - OpName %__0 "" - OpDecorate %_GLF_color Location 0 - OpDecorate %_arr_int_uint_2 ArrayStride 16 - OpMemberDecorate %buf0 0 RelaxedPrecision - OpMemberDecorate %buf0 0 Offset 0 - OpDecorate %buf0 Block - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 - OpDecorate %10 RelaxedPrecision - OpDecorate %11 RelaxedPrecision - OpDecorate %12 RelaxedPrecision - OpDecorate %13 RelaxedPrecision - OpDecorate %_arr_float_uint_2 ArrayStride 16 - OpMemberDecorate %buf1 0 Offset 0 - OpDecorate %buf1 Block - OpDecorate %__0 DescriptorSet 0 - OpDecorate %__0 Binding 1 - %void = OpTypeVoid - %16 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 %_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %int = OpTypeInt 32 1 - %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 -%_arr_int_uint_2 = OpTypeArray %int %uint_2 - %buf0 = OpTypeStruct %_arr_int_uint_2 -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %_ = OpVariable %_ptr_Uniform_buf0 Uniform - %int_0 = OpConstant %int 0 -%_ptr_Uniform_int = OpTypePointer Uniform %int - %int_1 = OpConstant %int 1 + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 + %_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 %_ptr_Function_float = OpTypePointer Function %float -%_arr_float_uint_2 = OpTypeArray %float %uint_2 - %buf1 = OpTypeStruct %_arr_float_uint_2 -%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 - %__0 = OpVariable %_ptr_Uniform_buf1 Uniform -%_ptr_Uniform_float = OpTypePointer Uniform %float -%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 - %bool = OpTypeBool - %uint_1 = OpConstant %uint 1 -%_ptr_Output_float = OpTypePointer Output %float - %main = OpFunction %void None %16 - %34 = OpLabel - %a = OpVariable %_ptr_Function_float Function - %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 - %10 = OpLoad %int %35 - %36 = OpConvertSToF %float %10 - %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 - %11 = OpLoad %int %37 - %38 = OpConvertSToF %float %11 - %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 - %12 = OpLoad %int %39 - %40 = OpConvertSToF %float %12 - %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 - %13 = OpLoad %int %41 - %42 = OpConvertSToF %float %13 - %43 = OpCompositeConstruct %v4float %36 %38 %40 %42 - OpStore %_GLF_color %43 - %44 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 - %45 = OpLoad %float %44 - %46 = OpFMod %float %45 %float_0x1_8p_128 - OpStore %a %46 - %47 = OpLoad %float %a - %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 - %49 = OpLoad %float %48 - %50 = OpFOrdNotEqual %bool %47 %49 - OpSelectionMerge %51 None - OpBranchConditional %50 %52 %51 - %52 = OpLabel - %53 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 - %54 = OpLoad %float %53 - %55 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 - OpStore %55 %54 - OpBranch %51 - %51 = OpLabel - OpReturn - OpFunctionEnd + %_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 + %_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1.0 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %16 + %34 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %10 = OpLoad %int %35 + %36 = OpConvertSToF %float %10 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %11 = OpLoad %int %37 + %38 = OpConvertSToF %float %11 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %12 = OpLoad %int %39 + %40 = OpConvertSToF %float %12 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %13 = OpLoad %int %41 + %42 = OpConvertSToF %float %13 + %43 = OpCompositeConstruct %v4float %36 %38 %40 %42 + OpStore %_GLF_color %43 + %44 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %45 = OpLoad %float %44 + %46 = OpFMod %float %45 %float_1 + OpStore %a %46 + %47 = OpLoad %float %a + %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpFOrdNotEqual %bool %47 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %54 = OpLoad %float %53 + %55 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + OpStore %55 %54 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl index 6eb2fb0bda..a1eccf0865 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl @@ -34,7 +34,7 @@ fn main_1() { let x_13 : i32 = x_5.x_GLF_uniform_int_values[0].el; x_GLF_color = vec4(f32(x_10), f32(x_11), f32(x_12), f32(x_13)); let x_45 : f32 = x_8.x_GLF_uniform_float_values[1].el; - a = (x_45 - (0x1.8p+128 * floor((x_45 / 0x1.8p+128)))); + a = (x_45 - (1.0 * floor((x_45 / 1.0)))); let x_47 : f32 = a; let x_49 : f32 = x_8.x_GLF_uniform_float_values[0].el; if ((x_47 != x_49)) { @@ -49,7 +49,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm index 4be551c61b..e954e6aebe 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm @@ -1,93 +1,93 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 310 - OpName %main "main" - OpName %_GLF_color "_GLF_color" - OpName %buf0 "buf0" - OpMemberName %buf0 0 "_GLF_uniform_int_values" - OpName %_ "" - OpName %a "a" - OpName %buf1 "buf1" - OpMemberName %buf1 0 "_GLF_uniform_float_values" - OpName %__0 "" - OpDecorate %_GLF_color Location 0 - OpDecorate %_arr_int_uint_2 ArrayStride 16 - OpMemberDecorate %buf0 0 RelaxedPrecision - OpMemberDecorate %buf0 0 Offset 0 - OpDecorate %buf0 Block - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 - OpDecorate %10 RelaxedPrecision - OpDecorate %11 RelaxedPrecision - OpDecorate %12 RelaxedPrecision - OpDecorate %13 RelaxedPrecision - OpDecorate %_arr_float_uint_2 ArrayStride 16 - OpMemberDecorate %buf1 0 Offset 0 - OpDecorate %buf1 Block - OpDecorate %__0 DescriptorSet 0 - OpDecorate %__0 Binding 1 - %void = OpTypeVoid - %16 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v4float = OpTypeVector %float 4 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 %_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %int = OpTypeInt 32 1 - %uint = OpTypeInt 32 0 - %uint_2 = OpConstant %uint 2 -%_arr_int_uint_2 = OpTypeArray %int %uint_2 - %buf0 = OpTypeStruct %_arr_int_uint_2 -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %_ = OpVariable %_ptr_Uniform_buf0 Uniform - %int_0 = OpConstant %int 0 -%_ptr_Uniform_int = OpTypePointer Uniform %int - %int_1 = OpConstant %int 1 + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 + %_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 %_ptr_Function_float = OpTypePointer Function %float -%float_n0x1_8p_128 = OpConstant %float -0x1.8p+128 -%_arr_float_uint_2 = OpTypeArray %float %uint_2 - %buf1 = OpTypeStruct %_arr_float_uint_2 -%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 - %__0 = OpVariable %_ptr_Uniform_buf1 Uniform -%_ptr_Uniform_float = OpTypePointer Uniform %float - %bool = OpTypeBool - %uint_1 = OpConstant %uint 1 -%_ptr_Output_float = OpTypePointer Output %float - %main = OpFunction %void None %16 - %34 = OpLabel - %a = OpVariable %_ptr_Function_float Function - %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 - %10 = OpLoad %int %35 - %36 = OpConvertSToF %float %10 - %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 - %11 = OpLoad %int %37 - %38 = OpConvertSToF %float %11 - %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 - %12 = OpLoad %int %39 - %40 = OpConvertSToF %float %12 - %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 - %13 = OpLoad %int %41 - %42 = OpConvertSToF %float %13 - %43 = OpCompositeConstruct %v4float %36 %38 %40 %42 - OpStore %_GLF_color %43 - %44 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 - %45 = OpLoad %float %44 - %46 = OpFMod %float %float_n0x1_8p_128 %45 - OpStore %a %46 - %47 = OpLoad %float %a - %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 - %49 = OpLoad %float %48 - %50 = OpFOrdNotEqual %bool %47 %49 - OpSelectionMerge %51 None - OpBranchConditional %50 %52 %51 - %52 = OpLabel - %53 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 - %54 = OpLoad %float %53 - %55 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 - OpStore %55 %54 - OpBranch %51 - %51 = OpLabel - OpReturn - OpFunctionEnd + %float_1 = OpConstant %float 1.0 + %_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 + %_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %16 + %34 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %10 = OpLoad %int %35 + %36 = OpConvertSToF %float %10 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %11 = OpLoad %int %37 + %38 = OpConvertSToF %float %11 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %12 = OpLoad %int %39 + %40 = OpConvertSToF %float %12 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %13 = OpLoad %int %41 + %42 = OpConvertSToF %float %13 + %43 = OpCompositeConstruct %v4float %36 %38 %40 %42 + OpStore %_GLF_color %43 + %44 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %45 = OpLoad %float %44 + %46 = OpFMod %float %float_1 %45 + OpStore %a %46 + %47 = OpLoad %float %a + %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpFOrdNotEqual %bool %47 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %54 = OpLoad %float %53 + %55 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + OpStore %55 %54 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl index 27651aa0aa..dea586553b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl @@ -34,7 +34,7 @@ fn main_1() { let x_13 : i32 = x_5.x_GLF_uniform_int_values[0].el; x_GLF_color = vec4(f32(x_10), f32(x_11), f32(x_12), f32(x_13)); let x_45 : f32 = x_8.x_GLF_uniform_float_values[1].el; - a = (-0x1.8p+128 - (x_45 * floor((-0x1.8p+128 / x_45)))); + a = (1.0 - (x_45 * floor((1.0 / x_45)))); let x_47 : f32 = a; let x_49 : f32 = x_8.x_GLF_uniform_float_values[0].el; if ((x_47 != x_49)) { @@ -49,7 +49,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl index feea7d72d2..4b06cb602e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl @@ -47,7 +47,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl index 8fc099c090..2a99833293 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl @@ -156,7 +156,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl index 9fa82b9eea..485b2b7b81 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl @@ -64,7 +64,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl index e9236ec3b1..f0040e7378 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl @@ -39,7 +39,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl index 26752c87a1..3dcdf887db 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl @@ -56,7 +56,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl index b5148b4afe..a84b0279ad 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl @@ -60,7 +60,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl index ca56e25c73..0d1da8a426 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl @@ -94,7 +94,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl index b707433bab..ec4f450e4e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl @@ -52,7 +52,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl index f1e5842e1c..dc00bca2d7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl @@ -46,7 +46,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl index 5765012f65..ce1ba21e86 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl @@ -48,7 +48,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl index c4dd2b4cd1..3404785fe1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl @@ -80,7 +80,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl index c6568beab2..62b83a1751 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl @@ -82,7 +82,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl index 15bb11e29b..5deeaa6efa 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl @@ -46,7 +46,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl index 0ea341ff45..d98ec27319 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl @@ -79,7 +79,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl index 456679a175..4d350e0ef8 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl @@ -88,7 +88,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl index 5094e8f3dc..b202044569 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl @@ -85,7 +85,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl index 0ff978ec3f..8c48e020bc 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl @@ -95,7 +95,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl index 88fae6dfbc..bf75f9fccd 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl @@ -62,7 +62,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl index 632ec35af0..4714145b0a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl @@ -47,7 +47,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl index cf183364d2..b59d5b9bf1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl @@ -42,7 +42,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl index c1708e2824..725431946c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl @@ -71,7 +71,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl index b463cdcf87..d71eb46210 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl @@ -95,7 +95,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl index cad8ee4a13..6deb5fb51f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl @@ -133,7 +133,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl index b932d179b7..affe188e0c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl @@ -95,7 +95,7 @@ struct main_out { x_GLF_v1_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl index 3fcd25f635..2cb9c6a096 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl @@ -44,7 +44,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl index f5899f725b..b2f11af0a4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl @@ -70,7 +70,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl index fe1d9b72ef..ca0b70cef4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl @@ -94,7 +94,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl index 8957d40c70..4162bbf01c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl @@ -41,7 +41,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl index 969ad9fbe0..ba55a804d4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl @@ -46,7 +46,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl index b797548508..0c09e844a6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl @@ -23,7 +23,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl index 26d5982645..bba9af124b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl index 7db29fd16d..eb051e5ffb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl @@ -87,7 +87,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl index 92fa2cf458..6b0ff19e20 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl @@ -36,7 +36,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl index 711a60f75b..a4ddb5caf3 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl @@ -54,7 +54,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl index 4558a2f873..aa6f230b8e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl @@ -51,7 +51,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl index 078abbec59..773834a428 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl @@ -16,7 +16,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl index 122db0724f..2d04059364 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl @@ -60,7 +60,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl index 51d8e24426..ad0688d6c2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl @@ -35,7 +35,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl index cf1d21a2ed..d56929dd2a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl @@ -75,7 +75,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..6418ea5997 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,435 @@ +SKIP: FAILED + +void set_scalar_float2x3(inout float2x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + } +} + +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +void set_scalar_float3x2(inout float3x2 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; + break; + case 1: + mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; + break; + case 2: + mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; + break; + } +} + +void set_scalar_float3x3(inout float3x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + } +} + +void set_scalar_float3x4(inout float3x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + case 2: + mat[2] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[2]; + break; + } +} + +void set_scalar_float4x2(inout float4x2 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; + break; + case 1: + mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; + break; + case 2: + mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; + break; + case 3: + mat[3] = (row.xx == int2(0, 1)) ? val.xx : mat[3]; + break; + } +} + +void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + case 3: + mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; + break; + } +} + +void set_scalar_float4x4(inout float4x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + case 2: + mat[2] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[2]; + break; + case 3: + mat[3] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[3]; + break; + } +} + +static int x_GLF_global_loop_count = 0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float2x4 m24 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x3 m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x4 m34 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x2 m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + int i_15 = 0; + int i_16 = 0; + int i_17 = 0; + int i_18 = 0; + int i_19 = 0; + int i_20 = 0; + int i_21 = 0; + int i_22 = 0; + int i_23 = 0; + int i_24 = 0; + int i_25 = 0; + int i_26 = 0; + int i_27 = 0; + int i_28 = 0; + int i_29 = 0; + int i_30 = 0; + int i_31 = 0; + int i_32 = 0; + int i_33 = 0; + int i_34 = 0; + int i_35 = 0; + int i_36 = 0; + int i_37 = 0; + float sum = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + m23 = float2x3((0.0f).xxx, (0.0f).xxx); + m24 = float2x4((0.0f).xxxx, (0.0f).xxxx); + m32 = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx); + m33 = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + m34 = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + m42 = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx); + m43 = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + m44 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + i = 0; + { + [loop] for(; (i < 1); i = (i + 1)) { + i_1 = 0; + { + [loop] for(; (i_1 < 1); i_1 = (i_1 + 1)) { + i_2 = 0; + { + [loop] for(; (i_2 < 1); i_2 = (i_2 + 1)) { + i_3 = 0; + { + [loop] for(; (i_3 < 1); i_3 = (i_3 + 1)) { + i_4 = 0; + { + [loop] for(; (i_4 < 1); i_4 = (i_4 + 1)) { + i_5 = 0; + { + [loop] for(; (i_5 < 1); i_5 = (i_5 + 1)) { + i_6 = 0; + { + [loop] for(; (i_6 < 1); i_6 = (i_6 + 1)) { + i_7 = 0; + { + [loop] for(; (i_7 < 1); i_7 = (i_7 + 1)) { + i_8 = 0; + { + [loop] for(; (i_8 < 1); i_8 = (i_8 + 1)) { + i_9 = 0; + { + [loop] for(; (i_9 < 1); i_9 = (i_9 + 1)) { + i_10 = 0; + { + [loop] for(; (i_10 < 1); i_10 = (i_10 + 1)) { + i_11 = 0; + { + [loop] for(; (i_11 < 1); i_11 = (i_11 + 1)) { + i_12 = 0; + { + [loop] for(; (i_12 < 1); i_12 = (i_12 + 1)) { + i_13 = 0; + { + [loop] for(; (i_13 < 1); i_13 = (i_13 + 1)) { + i_14 = 0; + { + [loop] for(; (i_14 < 1); i_14 = (i_14 + 1)) { + i_15 = 0; + { + [loop] for(; (i_15 < 1); i_15 = (i_15 + 1)) { + i_16 = 0; + { + [loop] for(; (i_16 < 1); i_16 = (i_16 + 1)) { + i_17 = 0; + { + [loop] for(; (i_17 < 1); i_17 = (i_17 + 1)) { + i_18 = 0; + { + [loop] for(; (i_18 < 1); i_18 = (i_18 + 1)) { + i_19 = 0; + { + [loop] for(; (i_19 < 1); i_19 = (i_19 + 1)) { + i_20 = 0; + { + [loop] for(; (i_20 < 1); i_20 = (i_20 + 1)) { + i_21 = 0; + { + [loop] for(; (i_21 < 1); i_21 = (i_21 + 1)) { + i_22 = 0; + { + [loop] for(; (i_22 < 1); i_22 = (i_22 + 1)) { + i_23 = 0; + { + [loop] for(; (i_23 < 1); i_23 = (i_23 + 1)) { + i_24 = 0; + { + [loop] for(; (i_24 < 1); i_24 = (i_24 + 1)) { + i_25 = 0; + { + [loop] for(; (i_25 < 1); i_25 = (i_25 + 1)) { + i_26 = 0; + { + [loop] for(; (i_26 < 1); i_26 = (i_26 + 1)) { + i_27 = 0; + { + [loop] for(; (i_27 < 1); i_27 = (i_27 + 1)) { + i_28 = 0; + { + [loop] for(; (i_28 < 1); i_28 = (i_28 + 1)) { + i_29 = 0; + { + [loop] for(; (i_29 < 1); i_29 = (i_29 + 1)) { + i_30 = 0; + { + [loop] for(; (i_30 < 1); i_30 = (i_30 + 1)) { + i_31 = 0; + { + [loop] for(; (i_31 < 1); i_31 = (i_31 + 1)) { + i_32 = 0; + { + [loop] for(; (i_32 < 1); i_32 = (i_32 + 1)) { + i_33 = 0; + { + [loop] for(; (i_33 < 1); i_33 = (i_33 + 1)) { + i_34 = 0; + { + [loop] for(; (i_34 < 1); i_34 = (i_34 + 1)) { + i_35 = 0; + { + [loop] for(; (i_35 < 1); i_35 = (i_35 + 1)) { + i_36 = 0; + { + [loop] for(; (i_36 < 1); i_36 = (i_36 + 1)) { + i_37 = 0; + { + [loop] for(; (i_37 < 1); i_37 = (i_37 + 1)) { + [loop] while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + { + if ((x_GLF_global_loop_count < 98)) { + } else { + break; + } + } + } + set_scalar_float2x3(m23, i_37, i_37, 1.0f); + set_scalar_float2x4(m24, i_37, i_37, 1.0f); + set_scalar_float3x2(m32, i_37, i_37, 1.0f); + set_scalar_float3x3(m33, i_37, i_37, 1.0f); + set_scalar_float3x4(m34, i_37, i_37, 1.0f); + set_scalar_float4x2(m42, i_37, i_37, 1.0f); + set_scalar_float4x3(m43, i_37, i_37, 1.0f); + set_scalar_float4x4(m44, i_37, i_37, 1.0f); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + sum = 0.0f; + r = 0; + { + [loop] for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const float x_486 = m23[0][r]; + sum = (sum + x_486); + const float x_491 = m24[0][r]; + sum = (sum + x_491); + const float x_496 = m32[0][r]; + sum = (sum + x_496); + const float x_501 = m33[0][r]; + sum = (sum + x_501); + const float x_506 = m34[0][r]; + sum = (sum + x_506); + const float x_511 = m42[0][r]; + sum = (sum + x_511); + const float x_516 = m43[0][r]; + sum = (sum + x_516); + const float x_521 = m44[0][r]; + sum = (sum + x_521); + } + } + if ((sum == 8.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = (0.0f).xxxx; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl deleted file mode 100644 index 15932bf3f7..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,435 +0,0 @@ -SKIP: test times out after 30s with FXC - -void set_scalar_float2x3(inout float2x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - } -} - -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; - break; - case 1: - mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; - break; - } -} - -void set_scalar_float3x2(inout float3x2 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; - break; - case 1: - mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; - break; - case 2: - mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; - break; - } -} - -void set_scalar_float3x3(inout float3x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - case 2: - mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; - break; - } -} - -void set_scalar_float3x4(inout float3x4 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; - break; - case 1: - mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; - break; - case 2: - mat[2] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[2]; - break; - } -} - -void set_scalar_float4x2(inout float4x2 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; - break; - case 1: - mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; - break; - case 2: - mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; - break; - case 3: - mat[3] = (row.xx == int2(0, 1)) ? val.xx : mat[3]; - break; - } -} - -void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - case 2: - mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; - break; - case 3: - mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; - break; - } -} - -void set_scalar_float4x4(inout float4x4 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; - break; - case 1: - mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; - break; - case 2: - mat[2] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[2]; - break; - case 3: - mat[3] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[3]; - break; - } -} - -static int x_GLF_global_loop_count = 0; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float2x4 m24 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3x3 m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3x4 m34 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float4x2 m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - int i = 0; - int i_1 = 0; - int i_2 = 0; - int i_3 = 0; - int i_4 = 0; - int i_5 = 0; - int i_6 = 0; - int i_7 = 0; - int i_8 = 0; - int i_9 = 0; - int i_10 = 0; - int i_11 = 0; - int i_12 = 0; - int i_13 = 0; - int i_14 = 0; - int i_15 = 0; - int i_16 = 0; - int i_17 = 0; - int i_18 = 0; - int i_19 = 0; - int i_20 = 0; - int i_21 = 0; - int i_22 = 0; - int i_23 = 0; - int i_24 = 0; - int i_25 = 0; - int i_26 = 0; - int i_27 = 0; - int i_28 = 0; - int i_29 = 0; - int i_30 = 0; - int i_31 = 0; - int i_32 = 0; - int i_33 = 0; - int i_34 = 0; - int i_35 = 0; - int i_36 = 0; - int i_37 = 0; - float sum = 0.0f; - int r = 0; - x_GLF_global_loop_count = 0; - m23 = float2x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); - m24 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); - m32 = float3x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); - m33 = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); - m34 = float3x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); - m42 = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); - m43 = float4x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); - m44 = float4x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); - i = 0; - { - [loop] for(; (i < 1); i = (i + 1)) { - i_1 = 0; - { - [loop] for(; (i_1 < 1); i_1 = (i_1 + 1)) { - i_2 = 0; - { - [loop] for(; (i_2 < 1); i_2 = (i_2 + 1)) { - i_3 = 0; - { - [loop] for(; (i_3 < 1); i_3 = (i_3 + 1)) { - i_4 = 0; - { - [loop] for(; (i_4 < 1); i_4 = (i_4 + 1)) { - i_5 = 0; - { - [loop] for(; (i_5 < 1); i_5 = (i_5 + 1)) { - i_6 = 0; - { - [loop] for(; (i_6 < 1); i_6 = (i_6 + 1)) { - i_7 = 0; - { - [loop] for(; (i_7 < 1); i_7 = (i_7 + 1)) { - i_8 = 0; - { - [loop] for(; (i_8 < 1); i_8 = (i_8 + 1)) { - i_9 = 0; - { - [loop] for(; (i_9 < 1); i_9 = (i_9 + 1)) { - i_10 = 0; - { - [loop] for(; (i_10 < 1); i_10 = (i_10 + 1)) { - i_11 = 0; - { - [loop] for(; (i_11 < 1); i_11 = (i_11 + 1)) { - i_12 = 0; - { - [loop] for(; (i_12 < 1); i_12 = (i_12 + 1)) { - i_13 = 0; - { - [loop] for(; (i_13 < 1); i_13 = (i_13 + 1)) { - i_14 = 0; - { - [loop] for(; (i_14 < 1); i_14 = (i_14 + 1)) { - i_15 = 0; - { - [loop] for(; (i_15 < 1); i_15 = (i_15 + 1)) { - i_16 = 0; - { - [loop] for(; (i_16 < 1); i_16 = (i_16 + 1)) { - i_17 = 0; - { - [loop] for(; (i_17 < 1); i_17 = (i_17 + 1)) { - i_18 = 0; - { - [loop] for(; (i_18 < 1); i_18 = (i_18 + 1)) { - i_19 = 0; - { - [loop] for(; (i_19 < 1); i_19 = (i_19 + 1)) { - i_20 = 0; - { - [loop] for(; (i_20 < 1); i_20 = (i_20 + 1)) { - i_21 = 0; - { - [loop] for(; (i_21 < 1); i_21 = (i_21 + 1)) { - i_22 = 0; - { - [loop] for(; (i_22 < 1); i_22 = (i_22 + 1)) { - i_23 = 0; - { - [loop] for(; (i_23 < 1); i_23 = (i_23 + 1)) { - i_24 = 0; - { - [loop] for(; (i_24 < 1); i_24 = (i_24 + 1)) { - i_25 = 0; - { - [loop] for(; (i_25 < 1); i_25 = (i_25 + 1)) { - i_26 = 0; - { - [loop] for(; (i_26 < 1); i_26 = (i_26 + 1)) { - i_27 = 0; - { - [loop] for(; (i_27 < 1); i_27 = (i_27 + 1)) { - i_28 = 0; - { - [loop] for(; (i_28 < 1); i_28 = (i_28 + 1)) { - i_29 = 0; - { - [loop] for(; (i_29 < 1); i_29 = (i_29 + 1)) { - i_30 = 0; - { - [loop] for(; (i_30 < 1); i_30 = (i_30 + 1)) { - i_31 = 0; - { - [loop] for(; (i_31 < 1); i_31 = (i_31 + 1)) { - i_32 = 0; - { - [loop] for(; (i_32 < 1); i_32 = (i_32 + 1)) { - i_33 = 0; - { - [loop] for(; (i_33 < 1); i_33 = (i_33 + 1)) { - i_34 = 0; - { - [loop] for(; (i_34 < 1); i_34 = (i_34 + 1)) { - i_35 = 0; - { - [loop] for(; (i_35 < 1); i_35 = (i_35 + 1)) { - i_36 = 0; - { - [loop] for(; (i_36 < 1); i_36 = (i_36 + 1)) { - i_37 = 0; - { - [loop] for(; (i_37 < 1); i_37 = (i_37 + 1)) { - [loop] while (true) { - x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); - { - if ((x_GLF_global_loop_count < 98)) { - } else { - break; - } - } - } - set_scalar_float2x3(m23, i_37, i_37, 1.0f); - set_scalar_float2x4(m24, i_37, i_37, 1.0f); - set_scalar_float3x2(m32, i_37, i_37, 1.0f); - set_scalar_float3x3(m33, i_37, i_37, 1.0f); - set_scalar_float3x4(m34, i_37, i_37, 1.0f); - set_scalar_float4x2(m42, i_37, i_37, 1.0f); - set_scalar_float4x3(m43, i_37, i_37, 1.0f); - set_scalar_float4x4(m44, i_37, i_37, 1.0f); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - sum = 0.0f; - r = 0; - { - [loop] for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { - x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); - const float x_486 = m23[0][r]; - sum = (sum + x_486); - const float x_491 = m24[0][r]; - sum = (sum + x_491); - const float x_496 = m32[0][r]; - sum = (sum + x_496); - const float x_501 = m33[0][r]; - sum = (sum + x_501); - const float x_506 = m34[0][r]; - sum = (sum + x_506); - const float x_511 = m42[0][r]; - sum = (sum + x_511); - const float x_516 = m43[0][r]; - sum = (sum + x_516); - const float x_521 = m44[0][r]; - sum = (sum + x_521); - } - } - if ((sum == 8.0f)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {x_GLF_color}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl index 77c853a2b7..79c369b53f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl @@ -652,7 +652,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6418ea5997 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,435 @@ +SKIP: FAILED + +void set_scalar_float2x3(inout float2x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + } +} + +void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + } +} + +void set_scalar_float3x2(inout float3x2 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; + break; + case 1: + mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; + break; + case 2: + mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; + break; + } +} + +void set_scalar_float3x3(inout float3x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + } +} + +void set_scalar_float3x4(inout float3x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + case 2: + mat[2] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[2]; + break; + } +} + +void set_scalar_float4x2(inout float4x2 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; + break; + case 1: + mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; + break; + case 2: + mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; + break; + case 3: + mat[3] = (row.xx == int2(0, 1)) ? val.xx : mat[3]; + break; + } +} + +void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + case 3: + mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; + break; + } +} + +void set_scalar_float4x4(inout float4x4 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; + break; + case 1: + mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; + break; + case 2: + mat[2] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[2]; + break; + case 3: + mat[3] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[3]; + break; + } +} + +static int x_GLF_global_loop_count = 0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float2x4 m24 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x3 m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x4 m34 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x2 m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + int i_15 = 0; + int i_16 = 0; + int i_17 = 0; + int i_18 = 0; + int i_19 = 0; + int i_20 = 0; + int i_21 = 0; + int i_22 = 0; + int i_23 = 0; + int i_24 = 0; + int i_25 = 0; + int i_26 = 0; + int i_27 = 0; + int i_28 = 0; + int i_29 = 0; + int i_30 = 0; + int i_31 = 0; + int i_32 = 0; + int i_33 = 0; + int i_34 = 0; + int i_35 = 0; + int i_36 = 0; + int i_37 = 0; + float sum = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + m23 = float2x3((0.0f).xxx, (0.0f).xxx); + m24 = float2x4((0.0f).xxxx, (0.0f).xxxx); + m32 = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx); + m33 = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + m34 = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + m42 = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx); + m43 = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx); + m44 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx); + i = 0; + { + [loop] for(; (i < 1); i = (i + 1)) { + i_1 = 0; + { + [loop] for(; (i_1 < 1); i_1 = (i_1 + 1)) { + i_2 = 0; + { + [loop] for(; (i_2 < 1); i_2 = (i_2 + 1)) { + i_3 = 0; + { + [loop] for(; (i_3 < 1); i_3 = (i_3 + 1)) { + i_4 = 0; + { + [loop] for(; (i_4 < 1); i_4 = (i_4 + 1)) { + i_5 = 0; + { + [loop] for(; (i_5 < 1); i_5 = (i_5 + 1)) { + i_6 = 0; + { + [loop] for(; (i_6 < 1); i_6 = (i_6 + 1)) { + i_7 = 0; + { + [loop] for(; (i_7 < 1); i_7 = (i_7 + 1)) { + i_8 = 0; + { + [loop] for(; (i_8 < 1); i_8 = (i_8 + 1)) { + i_9 = 0; + { + [loop] for(; (i_9 < 1); i_9 = (i_9 + 1)) { + i_10 = 0; + { + [loop] for(; (i_10 < 1); i_10 = (i_10 + 1)) { + i_11 = 0; + { + [loop] for(; (i_11 < 1); i_11 = (i_11 + 1)) { + i_12 = 0; + { + [loop] for(; (i_12 < 1); i_12 = (i_12 + 1)) { + i_13 = 0; + { + [loop] for(; (i_13 < 1); i_13 = (i_13 + 1)) { + i_14 = 0; + { + [loop] for(; (i_14 < 1); i_14 = (i_14 + 1)) { + i_15 = 0; + { + [loop] for(; (i_15 < 1); i_15 = (i_15 + 1)) { + i_16 = 0; + { + [loop] for(; (i_16 < 1); i_16 = (i_16 + 1)) { + i_17 = 0; + { + [loop] for(; (i_17 < 1); i_17 = (i_17 + 1)) { + i_18 = 0; + { + [loop] for(; (i_18 < 1); i_18 = (i_18 + 1)) { + i_19 = 0; + { + [loop] for(; (i_19 < 1); i_19 = (i_19 + 1)) { + i_20 = 0; + { + [loop] for(; (i_20 < 1); i_20 = (i_20 + 1)) { + i_21 = 0; + { + [loop] for(; (i_21 < 1); i_21 = (i_21 + 1)) { + i_22 = 0; + { + [loop] for(; (i_22 < 1); i_22 = (i_22 + 1)) { + i_23 = 0; + { + [loop] for(; (i_23 < 1); i_23 = (i_23 + 1)) { + i_24 = 0; + { + [loop] for(; (i_24 < 1); i_24 = (i_24 + 1)) { + i_25 = 0; + { + [loop] for(; (i_25 < 1); i_25 = (i_25 + 1)) { + i_26 = 0; + { + [loop] for(; (i_26 < 1); i_26 = (i_26 + 1)) { + i_27 = 0; + { + [loop] for(; (i_27 < 1); i_27 = (i_27 + 1)) { + i_28 = 0; + { + [loop] for(; (i_28 < 1); i_28 = (i_28 + 1)) { + i_29 = 0; + { + [loop] for(; (i_29 < 1); i_29 = (i_29 + 1)) { + i_30 = 0; + { + [loop] for(; (i_30 < 1); i_30 = (i_30 + 1)) { + i_31 = 0; + { + [loop] for(; (i_31 < 1); i_31 = (i_31 + 1)) { + i_32 = 0; + { + [loop] for(; (i_32 < 1); i_32 = (i_32 + 1)) { + i_33 = 0; + { + [loop] for(; (i_33 < 1); i_33 = (i_33 + 1)) { + i_34 = 0; + { + [loop] for(; (i_34 < 1); i_34 = (i_34 + 1)) { + i_35 = 0; + { + [loop] for(; (i_35 < 1); i_35 = (i_35 + 1)) { + i_36 = 0; + { + [loop] for(; (i_36 < 1); i_36 = (i_36 + 1)) { + i_37 = 0; + { + [loop] for(; (i_37 < 1); i_37 = (i_37 + 1)) { + [loop] while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + { + if ((x_GLF_global_loop_count < 98)) { + } else { + break; + } + } + } + set_scalar_float2x3(m23, i_37, i_37, 1.0f); + set_scalar_float2x4(m24, i_37, i_37, 1.0f); + set_scalar_float3x2(m32, i_37, i_37, 1.0f); + set_scalar_float3x3(m33, i_37, i_37, 1.0f); + set_scalar_float3x4(m34, i_37, i_37, 1.0f); + set_scalar_float4x2(m42, i_37, i_37, 1.0f); + set_scalar_float4x3(m43, i_37, i_37, 1.0f); + set_scalar_float4x4(m44, i_37, i_37, 1.0f); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + sum = 0.0f; + r = 0; + { + [loop] for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const float x_486 = m23[0][r]; + sum = (sum + x_486); + const float x_491 = m24[0][r]; + sum = (sum + x_491); + const float x_496 = m32[0][r]; + sum = (sum + x_496); + const float x_501 = m33[0][r]; + sum = (sum + x_501); + const float x_506 = m34[0][r]; + sum = (sum + x_506); + const float x_511 = m42[0][r]; + sum = (sum + x_511); + const float x_516 = m43[0][r]; + sum = (sum + x_516); + const float x_521 = m44[0][r]; + sum = (sum + x_521); + } + } + if ((sum == 8.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = (0.0f).xxxx; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl deleted file mode 100644 index 15932bf3f7..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,435 +0,0 @@ -SKIP: test times out after 30s with FXC - -void set_scalar_float2x3(inout float2x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - } -} - -void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; - break; - case 1: - mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; - break; - } -} - -void set_scalar_float3x2(inout float3x2 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; - break; - case 1: - mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; - break; - case 2: - mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; - break; - } -} - -void set_scalar_float3x3(inout float3x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - case 2: - mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; - break; - } -} - -void set_scalar_float3x4(inout float3x4 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; - break; - case 1: - mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; - break; - case 2: - mat[2] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[2]; - break; - } -} - -void set_scalar_float4x2(inout float4x2 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xx == int2(0, 1)) ? val.xx : mat[0]; - break; - case 1: - mat[1] = (row.xx == int2(0, 1)) ? val.xx : mat[1]; - break; - case 2: - mat[2] = (row.xx == int2(0, 1)) ? val.xx : mat[2]; - break; - case 3: - mat[3] = (row.xx == int2(0, 1)) ? val.xx : mat[3]; - break; - } -} - -void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - case 2: - mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; - break; - case 3: - mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; - break; - } -} - -void set_scalar_float4x4(inout float4x4 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0]; - break; - case 1: - mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1]; - break; - case 2: - mat[2] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[2]; - break; - case 3: - mat[3] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[3]; - break; - } -} - -static int x_GLF_global_loop_count = 0; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float2x4 m24 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3x3 m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float3x4 m34 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float4x2 m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - int i = 0; - int i_1 = 0; - int i_2 = 0; - int i_3 = 0; - int i_4 = 0; - int i_5 = 0; - int i_6 = 0; - int i_7 = 0; - int i_8 = 0; - int i_9 = 0; - int i_10 = 0; - int i_11 = 0; - int i_12 = 0; - int i_13 = 0; - int i_14 = 0; - int i_15 = 0; - int i_16 = 0; - int i_17 = 0; - int i_18 = 0; - int i_19 = 0; - int i_20 = 0; - int i_21 = 0; - int i_22 = 0; - int i_23 = 0; - int i_24 = 0; - int i_25 = 0; - int i_26 = 0; - int i_27 = 0; - int i_28 = 0; - int i_29 = 0; - int i_30 = 0; - int i_31 = 0; - int i_32 = 0; - int i_33 = 0; - int i_34 = 0; - int i_35 = 0; - int i_36 = 0; - int i_37 = 0; - float sum = 0.0f; - int r = 0; - x_GLF_global_loop_count = 0; - m23 = float2x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); - m24 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); - m32 = float3x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); - m33 = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); - m34 = float3x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); - m42 = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); - m43 = float4x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); - m44 = float4x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); - i = 0; - { - [loop] for(; (i < 1); i = (i + 1)) { - i_1 = 0; - { - [loop] for(; (i_1 < 1); i_1 = (i_1 + 1)) { - i_2 = 0; - { - [loop] for(; (i_2 < 1); i_2 = (i_2 + 1)) { - i_3 = 0; - { - [loop] for(; (i_3 < 1); i_3 = (i_3 + 1)) { - i_4 = 0; - { - [loop] for(; (i_4 < 1); i_4 = (i_4 + 1)) { - i_5 = 0; - { - [loop] for(; (i_5 < 1); i_5 = (i_5 + 1)) { - i_6 = 0; - { - [loop] for(; (i_6 < 1); i_6 = (i_6 + 1)) { - i_7 = 0; - { - [loop] for(; (i_7 < 1); i_7 = (i_7 + 1)) { - i_8 = 0; - { - [loop] for(; (i_8 < 1); i_8 = (i_8 + 1)) { - i_9 = 0; - { - [loop] for(; (i_9 < 1); i_9 = (i_9 + 1)) { - i_10 = 0; - { - [loop] for(; (i_10 < 1); i_10 = (i_10 + 1)) { - i_11 = 0; - { - [loop] for(; (i_11 < 1); i_11 = (i_11 + 1)) { - i_12 = 0; - { - [loop] for(; (i_12 < 1); i_12 = (i_12 + 1)) { - i_13 = 0; - { - [loop] for(; (i_13 < 1); i_13 = (i_13 + 1)) { - i_14 = 0; - { - [loop] for(; (i_14 < 1); i_14 = (i_14 + 1)) { - i_15 = 0; - { - [loop] for(; (i_15 < 1); i_15 = (i_15 + 1)) { - i_16 = 0; - { - [loop] for(; (i_16 < 1); i_16 = (i_16 + 1)) { - i_17 = 0; - { - [loop] for(; (i_17 < 1); i_17 = (i_17 + 1)) { - i_18 = 0; - { - [loop] for(; (i_18 < 1); i_18 = (i_18 + 1)) { - i_19 = 0; - { - [loop] for(; (i_19 < 1); i_19 = (i_19 + 1)) { - i_20 = 0; - { - [loop] for(; (i_20 < 1); i_20 = (i_20 + 1)) { - i_21 = 0; - { - [loop] for(; (i_21 < 1); i_21 = (i_21 + 1)) { - i_22 = 0; - { - [loop] for(; (i_22 < 1); i_22 = (i_22 + 1)) { - i_23 = 0; - { - [loop] for(; (i_23 < 1); i_23 = (i_23 + 1)) { - i_24 = 0; - { - [loop] for(; (i_24 < 1); i_24 = (i_24 + 1)) { - i_25 = 0; - { - [loop] for(; (i_25 < 1); i_25 = (i_25 + 1)) { - i_26 = 0; - { - [loop] for(; (i_26 < 1); i_26 = (i_26 + 1)) { - i_27 = 0; - { - [loop] for(; (i_27 < 1); i_27 = (i_27 + 1)) { - i_28 = 0; - { - [loop] for(; (i_28 < 1); i_28 = (i_28 + 1)) { - i_29 = 0; - { - [loop] for(; (i_29 < 1); i_29 = (i_29 + 1)) { - i_30 = 0; - { - [loop] for(; (i_30 < 1); i_30 = (i_30 + 1)) { - i_31 = 0; - { - [loop] for(; (i_31 < 1); i_31 = (i_31 + 1)) { - i_32 = 0; - { - [loop] for(; (i_32 < 1); i_32 = (i_32 + 1)) { - i_33 = 0; - { - [loop] for(; (i_33 < 1); i_33 = (i_33 + 1)) { - i_34 = 0; - { - [loop] for(; (i_34 < 1); i_34 = (i_34 + 1)) { - i_35 = 0; - { - [loop] for(; (i_35 < 1); i_35 = (i_35 + 1)) { - i_36 = 0; - { - [loop] for(; (i_36 < 1); i_36 = (i_36 + 1)) { - i_37 = 0; - { - [loop] for(; (i_37 < 1); i_37 = (i_37 + 1)) { - [loop] while (true) { - x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); - { - if ((x_GLF_global_loop_count < 98)) { - } else { - break; - } - } - } - set_scalar_float2x3(m23, i_37, i_37, 1.0f); - set_scalar_float2x4(m24, i_37, i_37, 1.0f); - set_scalar_float3x2(m32, i_37, i_37, 1.0f); - set_scalar_float3x3(m33, i_37, i_37, 1.0f); - set_scalar_float3x4(m34, i_37, i_37, 1.0f); - set_scalar_float4x2(m42, i_37, i_37, 1.0f); - set_scalar_float4x3(m43, i_37, i_37, 1.0f); - set_scalar_float4x4(m44, i_37, i_37, 1.0f); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - sum = 0.0f; - r = 0; - { - [loop] for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { - x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); - const float x_486 = m23[0][r]; - sum = (sum + x_486); - const float x_491 = m24[0][r]; - sum = (sum + x_491); - const float x_496 = m32[0][r]; - sum = (sum + x_496); - const float x_501 = m33[0][r]; - sum = (sum + x_501); - const float x_506 = m34[0][r]; - sum = (sum + x_506); - const float x_511 = m42[0][r]; - sum = (sum + x_511); - const float x_516 = m43[0][r]; - sum = (sum + x_516); - const float x_521 = m44[0][r]; - sum = (sum + x_521); - } - } - if ((sum == 8.0f)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {x_GLF_color}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl index e24074c1ba..fd50f46240 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl @@ -132,7 +132,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl index b84b88d70b..6713484beb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl @@ -102,7 +102,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..5716a1551b --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,302 @@ +SKIP: FAILED + +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + float sum = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + const float x_53 = asfloat(x_7[1].x); + f = x_53; + const int x_55 = asint(x_10[1].x); + i = x_55; + [loop] while (true) { + const int x_60 = i; + const uint scalar_offset = ((16u * 0u)) / 4; + const int x_62 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + if ((x_60 < x_62)) { + } else { + break; + } + const int x_66 = asint(x_10[1].x); + i_1 = x_66; + [loop] while (true) { + const int x_71 = i_1; + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const int x_73 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_71 < x_73)) { + } else { + break; + } + const int x_77 = asint(x_10[1].x); + i_2 = x_77; + [loop] while (true) { + const int x_82 = i_2; + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_84 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_82 < x_84)) { + } else { + break; + } + const int x_88 = asint(x_10[1].x); + i_3 = x_88; + [loop] while (true) { + const int x_93 = i_3; + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const int x_95 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_93 < x_95)) { + } else { + break; + } + const int x_99 = asint(x_10[1].x); + i_4 = x_99; + [loop] while (true) { + const int x_104 = i_4; + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const int x_106 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_104 < x_106)) { + } else { + break; + } + const int x_110 = asint(x_10[1].x); + i_5 = x_110; + [loop] while (true) { + const int x_115 = i_5; + const uint scalar_offset_5 = ((16u * 0u)) / 4; + const int x_117 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_115 < x_117)) { + } else { + break; + } + const int x_121 = asint(x_10[1].x); + i_6 = x_121; + [loop] while (true) { + const int x_126 = i_6; + const uint scalar_offset_6 = ((16u * 0u)) / 4; + const int x_128 = asint(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + if ((x_126 < x_128)) { + } else { + break; + } + const int x_132 = asint(x_10[1].x); + i_7 = x_132; + [loop] while (true) { + const int x_137 = i_7; + const uint scalar_offset_7 = ((16u * 0u)) / 4; + const int x_139 = asint(x_10[scalar_offset_7 / 4][scalar_offset_7 % 4]); + if ((x_137 < x_139)) { + } else { + break; + } + const int x_143 = asint(x_10[1].x); + i_8 = x_143; + [loop] while (true) { + const int x_148 = i_8; + const uint scalar_offset_8 = ((16u * 0u)) / 4; + const int x_150 = asint(x_10[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if ((x_148 < x_150)) { + } else { + break; + } + const int x_154 = asint(x_10[1].x); + i_9 = x_154; + [loop] while (true) { + const int x_159 = i_9; + const uint scalar_offset_9 = ((16u * 0u)) / 4; + const int x_161 = asint(x_10[scalar_offset_9 / 4][scalar_offset_9 % 4]); + if ((x_159 < x_161)) { + } else { + break; + } + const int x_165 = asint(x_10[1].x); + i_10 = x_165; + [loop] while (true) { + const int x_170 = i_10; + const uint scalar_offset_10 = ((16u * 0u)) / 4; + const int x_172 = asint(x_10[scalar_offset_10 / 4][scalar_offset_10 % 4]); + if ((x_170 < x_172)) { + } else { + break; + } + const int x_176 = asint(x_10[1].x); + i_11 = x_176; + [loop] while (true) { + const int x_181 = i_11; + const int x_183 = asint(x_10[2].x); + if ((x_181 < x_183)) { + } else { + break; + } + const int x_187 = asint(x_10[1].x); + i_12 = x_187; + [loop] while (true) { + const int x_192 = i_12; + const uint scalar_offset_11 = ((16u * 0u)) / 4; + const int x_194 = asint(x_10[scalar_offset_11 / 4][scalar_offset_11 % 4]); + if ((x_192 < x_194)) { + } else { + break; + } + const int x_198 = asint(x_10[1].x); + i_13 = x_198; + [loop] while (true) { + const int x_203 = i_13; + const uint scalar_offset_12 = ((16u * 0u)) / 4; + const int x_205 = asint(x_10[scalar_offset_12 / 4][scalar_offset_12 % 4]); + if ((x_203 < x_205)) { + } else { + break; + } + const int x_209 = asint(x_10[1].x); + i_14 = x_209; + [loop] while (true) { + const int x_214 = i_14; + const int x_216 = asint(x_10[2].x); + if ((x_214 < x_216)) { + } else { + break; + } + [loop] while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + { + const int x_225 = x_GLF_global_loop_count; + const int x_227 = asint(x_10[3].x); + if ((x_225 < (100 - x_227))) { + } else { + break; + } + } + } + const uint scalar_offset_13 = ((16u * 0u)) / 4; + const float x_231 = asfloat(x_7[scalar_offset_13 / 4][scalar_offset_13 % 4]); + f = (f + x_231); + { + i_14 = (i_14 + 1); + } + } + { + i_13 = (i_13 + 1); + } + } + { + i_12 = (i_12 + 1); + } + } + { + i_11 = (i_11 + 1); + } + } + { + i_10 = (i_10 + 1); + } + } + { + i_9 = (i_9 + 1); + } + } + { + i_8 = (i_8 + 1); + } + } + { + i_7 = (i_7 + 1); + } + } + { + i_6 = (i_6 + 1); + } + } + { + i_5 = (i_5 + 1); + } + } + { + i_4 = (i_4 + 1); + } + } + { + i_3 = (i_3 + 1); + } + } + { + i_2 = (i_2 + 1); + } + } + { + i_1 = (i_1 + 1); + } + } + { + i = (i + 1); + } + } + const float x_265 = asfloat(x_7[1].x); + sum = x_265; + const int x_267 = asint(x_10[1].x); + r = x_267; + { + [loop] for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + sum = (sum + f); + } + } + const float x_282 = sum; + const float x_284 = asfloat(x_7[2].x); + if ((x_282 == x_284)) { + const uint scalar_offset_14 = ((16u * 0u)) / 4; + const int x_290 = asint(x_10[scalar_offset_14 / 4][scalar_offset_14 % 4]); + const int x_293 = asint(x_10[1].x); + const int x_296 = asint(x_10[1].x); + const uint scalar_offset_15 = ((16u * 0u)) / 4; + const int x_299 = asint(x_10[scalar_offset_15 / 4][scalar_offset_15 % 4]); + x_GLF_color = float4(float(x_290), float(x_293), float(x_296), float(x_299)); + } else { + const int x_303 = asint(x_10[1].x); + const float x_304 = float(x_303); + x_GLF_color = float4(x_304, x_304, x_304, x_304); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + return tint_symbol_3; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl deleted file mode 100644 index 46f7ae79e3..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1 +0,0 @@ -SKIP: test times out after 30s with FXC \ No newline at end of file diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl index 12ea1f8870..c243164329 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl @@ -333,7 +333,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5716a1551b --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,302 @@ +SKIP: FAILED + +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + float sum = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + const float x_53 = asfloat(x_7[1].x); + f = x_53; + const int x_55 = asint(x_10[1].x); + i = x_55; + [loop] while (true) { + const int x_60 = i; + const uint scalar_offset = ((16u * 0u)) / 4; + const int x_62 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + if ((x_60 < x_62)) { + } else { + break; + } + const int x_66 = asint(x_10[1].x); + i_1 = x_66; + [loop] while (true) { + const int x_71 = i_1; + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const int x_73 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_71 < x_73)) { + } else { + break; + } + const int x_77 = asint(x_10[1].x); + i_2 = x_77; + [loop] while (true) { + const int x_82 = i_2; + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_84 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_82 < x_84)) { + } else { + break; + } + const int x_88 = asint(x_10[1].x); + i_3 = x_88; + [loop] while (true) { + const int x_93 = i_3; + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const int x_95 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_93 < x_95)) { + } else { + break; + } + const int x_99 = asint(x_10[1].x); + i_4 = x_99; + [loop] while (true) { + const int x_104 = i_4; + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const int x_106 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_104 < x_106)) { + } else { + break; + } + const int x_110 = asint(x_10[1].x); + i_5 = x_110; + [loop] while (true) { + const int x_115 = i_5; + const uint scalar_offset_5 = ((16u * 0u)) / 4; + const int x_117 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_115 < x_117)) { + } else { + break; + } + const int x_121 = asint(x_10[1].x); + i_6 = x_121; + [loop] while (true) { + const int x_126 = i_6; + const uint scalar_offset_6 = ((16u * 0u)) / 4; + const int x_128 = asint(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + if ((x_126 < x_128)) { + } else { + break; + } + const int x_132 = asint(x_10[1].x); + i_7 = x_132; + [loop] while (true) { + const int x_137 = i_7; + const uint scalar_offset_7 = ((16u * 0u)) / 4; + const int x_139 = asint(x_10[scalar_offset_7 / 4][scalar_offset_7 % 4]); + if ((x_137 < x_139)) { + } else { + break; + } + const int x_143 = asint(x_10[1].x); + i_8 = x_143; + [loop] while (true) { + const int x_148 = i_8; + const uint scalar_offset_8 = ((16u * 0u)) / 4; + const int x_150 = asint(x_10[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if ((x_148 < x_150)) { + } else { + break; + } + const int x_154 = asint(x_10[1].x); + i_9 = x_154; + [loop] while (true) { + const int x_159 = i_9; + const uint scalar_offset_9 = ((16u * 0u)) / 4; + const int x_161 = asint(x_10[scalar_offset_9 / 4][scalar_offset_9 % 4]); + if ((x_159 < x_161)) { + } else { + break; + } + const int x_165 = asint(x_10[1].x); + i_10 = x_165; + [loop] while (true) { + const int x_170 = i_10; + const uint scalar_offset_10 = ((16u * 0u)) / 4; + const int x_172 = asint(x_10[scalar_offset_10 / 4][scalar_offset_10 % 4]); + if ((x_170 < x_172)) { + } else { + break; + } + const int x_176 = asint(x_10[1].x); + i_11 = x_176; + [loop] while (true) { + const int x_181 = i_11; + const int x_183 = asint(x_10[2].x); + if ((x_181 < x_183)) { + } else { + break; + } + const int x_187 = asint(x_10[1].x); + i_12 = x_187; + [loop] while (true) { + const int x_192 = i_12; + const uint scalar_offset_11 = ((16u * 0u)) / 4; + const int x_194 = asint(x_10[scalar_offset_11 / 4][scalar_offset_11 % 4]); + if ((x_192 < x_194)) { + } else { + break; + } + const int x_198 = asint(x_10[1].x); + i_13 = x_198; + [loop] while (true) { + const int x_203 = i_13; + const uint scalar_offset_12 = ((16u * 0u)) / 4; + const int x_205 = asint(x_10[scalar_offset_12 / 4][scalar_offset_12 % 4]); + if ((x_203 < x_205)) { + } else { + break; + } + const int x_209 = asint(x_10[1].x); + i_14 = x_209; + [loop] while (true) { + const int x_214 = i_14; + const int x_216 = asint(x_10[2].x); + if ((x_214 < x_216)) { + } else { + break; + } + [loop] while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + { + const int x_225 = x_GLF_global_loop_count; + const int x_227 = asint(x_10[3].x); + if ((x_225 < (100 - x_227))) { + } else { + break; + } + } + } + const uint scalar_offset_13 = ((16u * 0u)) / 4; + const float x_231 = asfloat(x_7[scalar_offset_13 / 4][scalar_offset_13 % 4]); + f = (f + x_231); + { + i_14 = (i_14 + 1); + } + } + { + i_13 = (i_13 + 1); + } + } + { + i_12 = (i_12 + 1); + } + } + { + i_11 = (i_11 + 1); + } + } + { + i_10 = (i_10 + 1); + } + } + { + i_9 = (i_9 + 1); + } + } + { + i_8 = (i_8 + 1); + } + } + { + i_7 = (i_7 + 1); + } + } + { + i_6 = (i_6 + 1); + } + } + { + i_5 = (i_5 + 1); + } + } + { + i_4 = (i_4 + 1); + } + } + { + i_3 = (i_3 + 1); + } + } + { + i_2 = (i_2 + 1); + } + } + { + i_1 = (i_1 + 1); + } + } + { + i = (i + 1); + } + } + const float x_265 = asfloat(x_7[1].x); + sum = x_265; + const int x_267 = asint(x_10[1].x); + r = x_267; + { + [loop] for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + sum = (sum + f); + } + } + const float x_282 = sum; + const float x_284 = asfloat(x_7[2].x); + if ((x_282 == x_284)) { + const uint scalar_offset_14 = ((16u * 0u)) / 4; + const int x_290 = asint(x_10[scalar_offset_14 / 4][scalar_offset_14 % 4]); + const int x_293 = asint(x_10[1].x); + const int x_296 = asint(x_10[1].x); + const uint scalar_offset_15 = ((16u * 0u)) / 4; + const int x_299 = asint(x_10[scalar_offset_15 / 4][scalar_offset_15 % 4]); + x_GLF_color = float4(float(x_290), float(x_293), float(x_296), float(x_299)); + } else { + const int x_303 = asint(x_10[1].x); + const float x_304 = float(x_303); + x_GLF_color = float4(x_304, x_304, x_304, x_304); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + return tint_symbol_3; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl deleted file mode 100644 index 46f7ae79e3..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1 +0,0 @@ -SKIP: test times out after 30s with FXC \ No newline at end of file diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl index adfcd1bc5b..3cf05ac59f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl @@ -125,7 +125,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl index 0a1c942205..465d0b6877 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl @@ -77,7 +77,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl index d39091b7b6..9f4c8f16a1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl @@ -77,7 +77,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl index aa3bb957ec..9c77bd881a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl @@ -78,7 +78,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl index 6ea41efc7a..6764ecb640 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl @@ -40,7 +40,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl index 9e62836d84..13e7aedaf7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl @@ -108,7 +108,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl index 12f14a274f..df6c8dd49e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl @@ -233,7 +233,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl index a08b68a97a..d838fea12b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl @@ -105,7 +105,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl index 5df8e0ffec..47eb90b4bb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl @@ -33,7 +33,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl index 24bcc10a68..d6347ad205 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl @@ -21,7 +21,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl index 5e3792b8c1..84c096d000 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl @@ -85,7 +85,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl index 3e01f1a671..c3cc73633b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl @@ -71,7 +71,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl index 8278bc58a0..2c7406de7b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl @@ -68,7 +68,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl index efc6249e10..b70b2dbd99 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl @@ -44,7 +44,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl index 94ee900ea0..b08467d140 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl index 3a4bee7a15..efe4f32ce1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl index 61e7a69f34..961f4b6ab5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl @@ -36,7 +36,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl index 42b3530288..8c354c5c54 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl @@ -61,7 +61,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl index 95351abd37..6a680de143 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl @@ -84,7 +84,7 @@ struct main_out { x_GLF_v1_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl index 2459e4c6ce..77a280154b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl @@ -84,7 +84,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl index ef12407f35..441f193671 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl @@ -80,7 +80,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..556cf9162d --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,58 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * 0u)) / 4; + const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_25 = asint(x_5[1].x); + const int x_28 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const int x_31 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_22), float(x_25), float(x_28), float(x_31)); + const int x_35 = asint(x_5[1].x); + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_37 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_35 > x_37)) { + [loop] while (true) { + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const int x_46 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_47 = float(x_46); + x_GLF_color = float4(x_47, x_47, x_47, x_47); + { + const int x_50 = asint(x_5[1].x); + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const int x_52 = asint(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_50 > x_52)) { + } else { + break; + } + } + } + return; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl deleted file mode 100644 index b0131b4b8e..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,60 +0,0 @@ -SKIP: FAILED - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_5 : register(b0, space0) { - uint4 x_5[2]; -}; - -void main_1() { - const uint scalar_offset = ((16u * uint(0))) / 4; - const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); - const int x_25 = asint(x_5[1].x); - const int x_28 = asint(x_5[1].x); - const uint scalar_offset_1 = ((16u * uint(0))) / 4; - const int x_31 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); - x_GLF_color = float4(float(x_22), float(x_25), float(x_28), float(x_31)); - const int x_35 = asint(x_5[1].x); - const uint scalar_offset_2 = ((16u * uint(0))) / 4; - const int x_37 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); - if ((x_35 > x_37)) { - [loop] while (true) { - const uint scalar_offset_3 = ((16u * uint(0))) / 4; - const int x_46 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); - const float x_47 = float(x_46); - x_GLF_color = float4(x_47, x_47, x_47, x_47); - { - const int x_50 = asint(x_5[1].x); - const uint scalar_offset_4 = ((16u * uint(0))) / 4; - const int x_52 = asint(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); - if ((x_50 > x_52)) { - } else { - break; - } - } - } - return; - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000002307D6F3EA0(18,19-22): error X3696: infinite loop detected - loop never exits - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl index 79be73adf1..4a5526b05f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl @@ -46,7 +46,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..556cf9162d --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,58 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * 0u)) / 4; + const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_25 = asint(x_5[1].x); + const int x_28 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const int x_31 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_22), float(x_25), float(x_28), float(x_31)); + const int x_35 = asint(x_5[1].x); + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_37 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_35 > x_37)) { + [loop] while (true) { + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const int x_46 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_47 = float(x_46); + x_GLF_color = float4(x_47, x_47, x_47, x_47); + { + const int x_50 = asint(x_5[1].x); + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const int x_52 = asint(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_50 > x_52)) { + } else { + break; + } + } + } + return; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl deleted file mode 100644 index 721c4f2951..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,60 +0,0 @@ -SKIP: FAILED - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_5 : register(b0, space0) { - uint4 x_5[2]; -}; - -void main_1() { - const uint scalar_offset = ((16u * uint(0))) / 4; - const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); - const int x_25 = asint(x_5[1].x); - const int x_28 = asint(x_5[1].x); - const uint scalar_offset_1 = ((16u * uint(0))) / 4; - const int x_31 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); - x_GLF_color = float4(float(x_22), float(x_25), float(x_28), float(x_31)); - const int x_35 = asint(x_5[1].x); - const uint scalar_offset_2 = ((16u * uint(0))) / 4; - const int x_37 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); - if ((x_35 > x_37)) { - [loop] while (true) { - const uint scalar_offset_3 = ((16u * uint(0))) / 4; - const int x_46 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); - const float x_47 = float(x_46); - x_GLF_color = float4(x_47, x_47, x_47, x_47); - { - const int x_50 = asint(x_5[1].x); - const uint scalar_offset_4 = ((16u * uint(0))) / 4; - const int x_52 = asint(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); - if ((x_50 > x_52)) { - } else { - break; - } - } - } - return; - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000001AB97856630(18,19-22): error X3696: infinite loop detected - loop never exits - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl index e15d8deae0..382ffa2740 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl @@ -72,7 +72,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl index de5ae78c9b..19f1fab9ce 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl @@ -64,7 +64,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl index 98a9ebde7a..8c61b22a55 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl @@ -232,7 +232,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl index 66e10506f8..7eccaa598f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl @@ -183,7 +183,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl index 4613f05959..d176ddbfd6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl @@ -53,7 +53,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl index 0665057964..4c0dd1367e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl @@ -33,7 +33,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl index a72e3328ed..c5564955ea 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl @@ -57,7 +57,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl index 895e284567..84e0f7b935 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl @@ -49,7 +49,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl index fe3a5c4802..f15d57acfc 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl @@ -32,7 +32,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl index 8c201e06c6..1ab7d697cc 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl @@ -110,7 +110,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl index c93962f97f..15ea99527b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl @@ -73,7 +73,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl index 3ec072cd5e..f63bade170 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl @@ -81,7 +81,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl index e655d576a9..27eede78b9 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl @@ -55,7 +55,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl index 260dac0b40..d1597ede18 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl @@ -56,7 +56,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl index 1ee580f9ab..aa340d6bb0 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl @@ -39,7 +39,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl index ede3ec0c8c..9ba95b4e62 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl @@ -42,7 +42,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl index 829a0a844e..527a2da5c2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl @@ -24,7 +24,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl index b7f1559c8d..64b0470ad3 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl @@ -58,7 +58,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl index 22f846dc05..d3bceff441 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl @@ -24,7 +24,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl index a52fd11a13..23219d054b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl @@ -95,7 +95,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl index c821a0ba41..47994dcef6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl @@ -50,7 +50,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl index 32d71823f7..81d8511b57 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl @@ -28,7 +28,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl index 7371365fb0..9ef2543443 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl @@ -33,7 +33,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl index a1cbaf4751..d2deae49ea 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl @@ -34,7 +34,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl index 60e6c3a375..7941446220 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl @@ -30,7 +30,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl index b2ff3d7721..a6dfef5777 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl @@ -90,7 +90,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl index c38f758e14..902b2c6c91 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl @@ -49,7 +49,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl index 236b092c7e..bae09d55ce 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl @@ -72,7 +72,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl index 36f9060f51..0cbcc97502 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl @@ -54,7 +54,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl index cec76afe9a..20e9dc8a2a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl @@ -19,7 +19,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl index 1b4b63d95c..18da3eb015 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl @@ -92,7 +92,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl index 07c860c08b..63deae6d78 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl @@ -61,7 +61,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl index 36e7882d19..0302149333 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl @@ -105,7 +105,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.dxc.hlsl new file mode 100755 index 0000000000..b158ceac29 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.dxc.hlsl @@ -0,0 +1,104 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_7 : register(b2, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * 0u)) / 4; + const float x_38 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + const float x_41 = asfloat(x_7[0].x); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_41 > x_43)) { + [loop] while (true) { + const float x_53 = asfloat(x_5[1].x); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + { + if (true) { + } else { + break; + } + } + } + } else { + [loop] while (true) { + [loop] while (true) { + if (true) { + } else { + break; + } + const int x_13 = asint(x_10[1].x); + i = x_13; + [loop] while (true) { + const int x_14 = i; + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_14 < x_15)) { + } else { + break; + } + const float x_73 = asfloat(x_5[1].x); + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const float x_75 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const float x_77 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_79 = asfloat(x_5[1].x); + x_GLF_color = float4(x_73, x_75, x_77, x_79); + { + i = (i + 1); + } + } + break; + } + { + const float x_82 = asfloat(x_7[0].x); + const uint scalar_offset_5 = ((16u * 0u)) / 4; + const float x_84 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:88: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.fxc.hlsl new file mode 100755 index 0000000000..5fbdf33bb8 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,95 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_7 : register(b2, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * 0u)) / 4; + const float x_38 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + const float x_41 = asfloat(x_7[0].x); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_41 > x_43)) { + [loop] while (true) { + const float x_53 = asfloat(x_5[1].x); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + { + if (true) { + } else { + break; + } + } + } + } else { + [loop] while (true) { + [loop] while (true) { + if (true) { + } else { + break; + } + const int x_13 = asint(x_10[1].x); + i = x_13; + [loop] while (true) { + const int x_14 = i; + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_14 < x_15)) { + } else { + break; + } + const float x_73 = asfloat(x_5[1].x); + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const float x_75 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const float x_77 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_79 = asfloat(x_5[1].x); + x_GLF_color = float4(x_73, x_75, x_77, x_79); + { + i = (i + 1); + } + } + break; + } + { + const float x_82 = asfloat(x_7[0].x); + const uint scalar_offset_5 = ((16u * 0u)) / 4; + const float x_84 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl deleted file mode 100755 index cc34599170..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,101 +0,0 @@ -SKIP: FAILED - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_5 : register(b1, space0) { - uint4 x_5[2]; -}; -cbuffer cbuffer_x_7 : register(b2, space0) { - uint4 x_7[1]; -}; -cbuffer cbuffer_x_10 : register(b0, space0) { - uint4 x_10[2]; -}; - -void main_1() { - int i = 0; - const uint scalar_offset = ((16u * uint(0))) / 4; - const float x_38 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); - x_GLF_color = float4(x_38, x_38, x_38, x_38); - const float x_41 = asfloat(x_7[0].x); - const uint scalar_offset_1 = ((16u * uint(0))) / 4; - const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); - if ((x_41 > x_43)) { - [loop] while (true) { - const float x_53 = asfloat(x_5[1].x); - x_GLF_color = float4(x_53, x_53, x_53, x_53); - { - if (true) { - } else { - break; - } - } - } - } else { - [loop] while (true) { - [loop] while (true) { - if (true) { - } else { - break; - } - const int x_13 = asint(x_10[1].x); - i = x_13; - [loop] while (true) { - const int x_14 = i; - const uint scalar_offset_2 = ((16u * uint(0))) / 4; - const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); - if ((x_14 < x_15)) { - } else { - break; - } - const float x_73 = asfloat(x_5[1].x); - const uint scalar_offset_3 = ((16u * uint(0))) / 4; - const float x_75 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); - const uint scalar_offset_4 = ((16u * uint(0))) / 4; - const float x_77 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); - const float x_79 = asfloat(x_5[1].x); - x_GLF_color = float4(x_73, x_75, x_77, x_79); - { - i = (i + 1); - } - } - break; - } - { - const float x_82 = asfloat(x_7[0].x); - const uint scalar_offset_5 = ((16u * uint(0))) / 4; - const float x_84 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); - if ((x_82 > x_84)) { - } else { - break; - } - } - } - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\u1r54.0:88: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl index 57b1326749..fadf785419 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl @@ -98,7 +98,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.dxc.hlsl new file mode 100755 index 0000000000..b158ceac29 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.dxc.hlsl @@ -0,0 +1,104 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_7 : register(b2, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * 0u)) / 4; + const float x_38 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + const float x_41 = asfloat(x_7[0].x); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_41 > x_43)) { + [loop] while (true) { + const float x_53 = asfloat(x_5[1].x); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + { + if (true) { + } else { + break; + } + } + } + } else { + [loop] while (true) { + [loop] while (true) { + if (true) { + } else { + break; + } + const int x_13 = asint(x_10[1].x); + i = x_13; + [loop] while (true) { + const int x_14 = i; + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_14 < x_15)) { + } else { + break; + } + const float x_73 = asfloat(x_5[1].x); + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const float x_75 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const float x_77 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_79 = asfloat(x_5[1].x); + x_GLF_color = float4(x_73, x_75, x_77, x_79); + { + i = (i + 1); + } + } + break; + } + { + const float x_82 = asfloat(x_7[0].x); + const uint scalar_offset_5 = ((16u * 0u)) / 4; + const float x_84 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:88: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.fxc.hlsl new file mode 100755 index 0000000000..5fbdf33bb8 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,95 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_7 : register(b2, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * 0u)) / 4; + const float x_38 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + const float x_41 = asfloat(x_7[0].x); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_41 > x_43)) { + [loop] while (true) { + const float x_53 = asfloat(x_5[1].x); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + { + if (true) { + } else { + break; + } + } + } + } else { + [loop] while (true) { + [loop] while (true) { + if (true) { + } else { + break; + } + const int x_13 = asint(x_10[1].x); + i = x_13; + [loop] while (true) { + const int x_14 = i; + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_14 < x_15)) { + } else { + break; + } + const float x_73 = asfloat(x_5[1].x); + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const float x_75 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const float x_77 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_79 = asfloat(x_5[1].x); + x_GLF_color = float4(x_73, x_75, x_77, x_79); + { + i = (i + 1); + } + } + break; + } + { + const float x_82 = asfloat(x_7[0].x); + const uint scalar_offset_5 = ((16u * 0u)) / 4; + const float x_84 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl deleted file mode 100755 index ed4dfc753f..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,101 +0,0 @@ -SKIP: FAILED - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_5 : register(b1, space0) { - uint4 x_5[2]; -}; -cbuffer cbuffer_x_7 : register(b2, space0) { - uint4 x_7[1]; -}; -cbuffer cbuffer_x_10 : register(b0, space0) { - uint4 x_10[2]; -}; - -void main_1() { - int i = 0; - const uint scalar_offset = ((16u * uint(0))) / 4; - const float x_38 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); - x_GLF_color = float4(x_38, x_38, x_38, x_38); - const float x_41 = asfloat(x_7[0].x); - const uint scalar_offset_1 = ((16u * uint(0))) / 4; - const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); - if ((x_41 > x_43)) { - [loop] while (true) { - const float x_53 = asfloat(x_5[1].x); - x_GLF_color = float4(x_53, x_53, x_53, x_53); - { - if (true) { - } else { - break; - } - } - } - } else { - [loop] while (true) { - [loop] while (true) { - if (true) { - } else { - break; - } - const int x_13 = asint(x_10[1].x); - i = x_13; - [loop] while (true) { - const int x_14 = i; - const uint scalar_offset_2 = ((16u * uint(0))) / 4; - const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); - if ((x_14 < x_15)) { - } else { - break; - } - const float x_73 = asfloat(x_5[1].x); - const uint scalar_offset_3 = ((16u * uint(0))) / 4; - const float x_75 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); - const uint scalar_offset_4 = ((16u * uint(0))) / 4; - const float x_77 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); - const float x_79 = asfloat(x_5[1].x); - x_GLF_color = float4(x_73, x_75, x_77, x_79); - { - i = (i + 1); - } - } - break; - } - { - const float x_82 = asfloat(x_7[0].x); - const uint scalar_offset_5 = ((16u * uint(0))) / 4; - const float x_84 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); - if ((x_82 > x_84)) { - } else { - break; - } - } - } - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\usgc.0:88: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl index 439064cd68..ad71b07de6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl @@ -31,7 +31,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl index 9507f31c26..f9c3613f92 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl @@ -162,7 +162,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl index 37acd795b7..3d5c8b7368 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl @@ -22,7 +22,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl index 4f203544c0..40362b6020 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl @@ -54,7 +54,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl index 91d1acee0b..0f9279b532 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl @@ -23,7 +23,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm index 763916fac1..5fe203b288 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm @@ -1,114 +1,113 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 310 - OpName %main "main" - OpName %m24 "m24" - OpName %buf0 "buf0" - OpMemberName %buf0 0 "_GLF_uniform_float_values" - OpName %_ "" - OpName %buf1 "buf1" - OpMemberName %buf1 0 "v1" - OpName %__0 "" - OpName %a "a" - OpName %v2 "v2" - OpName %v3 "v3" - OpName %_GLF_color "_GLF_color" - OpDecorate %_arr_float_uint_1 ArrayStride 16 - OpMemberDecorate %buf0 0 Offset 0 - OpDecorate %buf0 Block - OpDecorate %_ DescriptorSet 0 - OpDecorate %_ Binding 0 - OpMemberDecorate %buf1 0 Offset 0 - OpDecorate %buf1 Block - OpDecorate %__0 DescriptorSet 0 - OpDecorate %__0 Binding 1 - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %14 = OpTypeFunction %void - %float = OpTypeFloat 32 - %v2float = OpTypeVector %float 2 -%mat2v2float = OpTypeMatrix %v2float 2 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %m24 "m24" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %__0 "" + OpName %a "a" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %mat2v2float = OpTypeMatrix %v2float 2 %_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float - %uint = OpTypeInt 32 0 - %uint_1 = OpConstant %uint 1 -%_arr_float_uint_1 = OpTypeArray %float %uint_1 - %buf0 = OpTypeStruct %_arr_float_uint_1 -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %_ = OpVariable %_ptr_Uniform_buf0 Uniform - %int = OpTypeInt 32 1 - %int_0 = OpConstant %int 0 -%_ptr_Uniform_float = OpTypePointer Uniform %float - %buf1 = OpTypeStruct %v2float -%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 - %__0 = OpVariable %_ptr_Uniform_buf1 Uniform - %uint_0 = OpConstant %uint 0 - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 -%_ptr_Function_float = OpTypePointer Function %float -%_ptr_Function_v2float = OpTypePointer Function %v2float -%float_n0x1_8p_128 = OpConstant %float -0x1.8p+128 - %32 = OpConstantComposite %v2float %float_n0x1_8p_128 %float_1 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %bool = OpTypeBool - %36 = OpConstantComposite %v2float %float_0 %float_0 - %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 - %main = OpFunction %void None %14 - %38 = OpLabel - %m24 = OpVariable %_ptr_Function_mat2v2float Function - %a = OpVariable %_ptr_Function_float Function - %v2 = OpVariable %_ptr_Function_v2float Function - %v3 = OpVariable %_ptr_Function_v2float Function - %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %40 = OpLoad %float %39 - %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %42 = OpLoad %float %41 - %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 - %44 = OpLoad %float %43 - %45 = OpFMul %float %44 %float_1 - %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %47 = OpLoad %float %46 - %48 = OpCompositeConstruct %v2float %40 %42 - %49 = OpCompositeConstruct %v2float %45 %47 - %50 = OpCompositeConstruct %mat2v2float %48 %49 - OpStore %m24 %50 - %51 = OpLoad %mat2v2float %m24 - %52 = OpCompositeExtract %float %51 0 0 - OpStore %a %52 - OpStore %v2 %32 - %53 = OpLoad %v2float %v2 - %54 = OpLoad %float %a - %55 = OpCompositeConstruct %v2float %54 %float_1 - %56 = OpExtInst %v2float %1 Reflect %53 %55 - OpStore %v3 %56 - %57 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %58 = OpLoad %float %57 - %59 = OpLoad %v2float %v3 - %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %61 = OpLoad %float %60 - %62 = OpCompositeExtract %float %59 0 - %63 = OpCompositeExtract %float %59 1 - %64 = OpCompositeConstruct %v4float %58 %62 %63 %61 - OpStore %_GLF_color %64 - %65 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 - %66 = OpLoad %float %65 - %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 - %68 = OpLoad %float %67 - %69 = OpFOrdEqual %bool %66 %68 - OpSelectionMerge %70 None - OpBranchConditional %69 %71 %72 - %71 = OpLabel - %73 = OpLoad %v4float %_GLF_color - %74 = OpVectorShuffle %v4float %73 %36 0 4 5 3 - OpStore %_GLF_color %74 - OpBranch %70 - %72 = OpLabel - OpStore %_GLF_color %37 - OpBranch %70 - %70 = OpLabel - OpReturn - OpFunctionEnd + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 + %_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %_ptr_Uniform_float = OpTypePointer Uniform %float + %buf1 = OpTypeStruct %v2float + %_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint_0 = OpConstant %uint 0 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %_ptr_Function_float = OpTypePointer Function %float + %_ptr_Function_v2float = OpTypePointer Function %v2float + %32 = OpConstantComposite %v2float %float_1 %float_1 + %v4float = OpTypeVector %float 4 + %_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %bool = OpTypeBool + %36 = OpConstantComposite %v2float %float_0 %float_0 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %14 + %38 = OpLabel + %m24 = OpVariable %_ptr_Function_mat2v2float Function + %a = OpVariable %_ptr_Function_float Function + %v2 = OpVariable %_ptr_Function_v2float Function + %v3 = OpVariable %_ptr_Function_v2float Function + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %44 = OpLoad %float %43 + %45 = OpFMul %float %44 %float_1 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v2float %40 %42 + %49 = OpCompositeConstruct %v2float %45 %47 + %50 = OpCompositeConstruct %mat2v2float %48 %49 + OpStore %m24 %50 + %51 = OpLoad %mat2v2float %m24 + %52 = OpCompositeExtract %float %51 0 0 + OpStore %a %52 + OpStore %v2 %32 + %53 = OpLoad %v2float %v2 + %54 = OpLoad %float %a + %55 = OpCompositeConstruct %v2float %54 %float_1 + %56 = OpExtInst %v2float %1 Reflect %53 %55 + OpStore %v3 %56 + %57 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpLoad %v2float %v3 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpCompositeExtract %float %59 0 + %63 = OpCompositeExtract %float %59 1 + %64 = OpCompositeConstruct %v4float %58 %62 %63 %61 + OpStore %_GLF_color %64 + %65 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpFOrdEqual %bool %66 %68 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + %73 = OpLoad %v4float %_GLF_color + %74 = OpVectorShuffle %v4float %73 %36 0 4 5 3 + OpStore %_GLF_color %74 + OpBranch %70 + %72 = OpLabel + OpStore %_GLF_color %37 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl index dc95ab7c5d..2dcba3ad3d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl @@ -31,7 +31,7 @@ fn main_1() { m24 = mat2x2(vec2(x_40, x_42), vec2((x_44 * 1.0), x_47)); let x_51 : mat2x2 = m24; a = x_51[0u].x; - v2 = vec2(-0x1.8p+128, 1.0); + v2 = vec2(1.0, 1.0); let x_53 : vec2 = v2; let x_54 : f32 = a; let x_55 : vec2 = vec2(x_54, 1.0); @@ -56,7 +56,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl index 408951f57a..f25d1e9b8a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl @@ -94,7 +94,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl index e00fdb4925..537ce2b50c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl @@ -70,7 +70,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..abb85d570e --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,133 @@ +SKIP: FAILED + +void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + case 3: + mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; + break; + } +} + +struct strided_arr { + float el; +}; + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + strided_arr sums[3] = (strided_arr[3])0; + int i = 0; + int a = 0; + int x_67_phi = 0; + const float x_44 = asfloat(x_6[1].x); + const float3 x_48 = (0.0f).xxx; + m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), (0.0f).xxx); + const uint scalar_offset = ((16u * 0u)) / 4; + const int x_51 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const int x_53 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_scalar_float4x3(m43, x_53, x_51, x_55); + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const float x_58 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * 0u)) / 4; + const float x_62 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const strided_arr tint_symbol_3 = {x_58}; + const strided_arr tint_symbol_4 = {x_60}; + const strided_arr tint_symbol_5 = {x_62}; + const strided_arr tint_symbol_6[3] = {tint_symbol_3, tint_symbol_4, tint_symbol_5}; + sums = tint_symbol_6; + const uint scalar_offset_6 = ((16u * 0u)) / 4; + const int x_65 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + i = x_65; + x_67_phi = x_65; + [loop] while (true) { + const int x_67 = x_67_phi; + const int x_73 = asint(x_8[3].x); + if ((x_67 < x_73)) { + } else { + break; + } + const uint scalar_offset_7 = ((16u * 0u)) / 4; + const int x_77 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * 0u)) / 4; + const int x_79 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_81 = m43[x_67][x_79]; + const float x_83 = sums[x_77].el; + sums[x_77].el = (x_83 + x_81); + { + const int x_68 = (x_67 + 1); + i = x_68; + x_67_phi = x_68; + } + } + const int x_87 = asint(x_8[1].x); + if ((x_87 == 1)) { + a = 4; + const int x_92 = asint(x_8[2].x); + const uint scalar_offset_9 = ((16u * 0u)) / 4; + const int x_94 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const float x_96 = m43[4][x_94]; + const float x_98 = sums[x_92].el; + sums[x_92].el = (x_98 + x_96); + } + const int x_102 = asint(x_8[1].x); + const float x_104 = sums[x_102].el; + const uint scalar_offset_10 = ((16u * 0u)) / 4; + const int x_106 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const float x_108 = sums[x_106].el; + const float x_111 = asfloat(x_6[2].x); + if (((x_104 + x_108) == x_111)) { + const uint scalar_offset_11 = ((16u * 0u)) / 4; + const int x_117 = asint(x_8[scalar_offset_11 / 4][scalar_offset_11 % 4]); + const int x_120 = asint(x_8[1].x); + const int x_123 = asint(x_8[1].x); + const uint scalar_offset_12 = ((16u * 0u)) / 4; + const int x_126 = asint(x_8[scalar_offset_12 / 4][scalar_offset_12 % 4]); + x_GLF_color = float4(float(x_117), float(x_120), float(x_123), float(x_126)); + } else { + const int x_130 = asint(x_8[1].x); + const float x_131 = float(x_130); + x_GLF_color = float4(x_131, x_131, x_131, x_131); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_7 = {x_GLF_color}; + return tint_symbol_7; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.glsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.glsl index 005362d121..e7e10eef63 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.glsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.glsl @@ -36,8 +36,8 @@ void main_1() { int a = 0; int x_67_phi = 0; float x_44 = x_6.x_GLF_uniform_float_values[1].el; - vec3 x_48 = vec3(0.0f, 0.0f, 0.0f); - m43 = mat4x3(vec3(x_44, 0.0f, 0.0f), vec3(0.0f, x_44, 0.0f), vec3(0.0f, 0.0f, x_44), vec3(0.0f, 0.0f, 0.0f)); + vec3 x_48 = vec3(0.0f); + m43 = mat4x3(vec3(x_44, 0.0f, 0.0f), vec3(0.0f, x_44, 0.0f), vec3(0.0f, 0.0f, x_44), vec3(0.0f)); int x_51 = x_8.x_GLF_uniform_int_values[0].el; int x_53 = x_8.x_GLF_uniform_int_values[0].el; float x_55 = x_6.x_GLF_uniform_float_values[0].el; diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl deleted file mode 100644 index 5b9bdf5d61..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,132 +0,0 @@ -SKIP: FAILED - -void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - case 2: - mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; - break; - case 3: - mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; - break; - } -} - -struct tint_padded_array_element { - float el; -}; - -cbuffer cbuffer_x_6 : register(b1, space0) { - uint4 x_6[3]; -}; -cbuffer cbuffer_x_8 : register(b0, space0) { - uint4 x_8[4]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - tint_padded_array_element sums[3] = (tint_padded_array_element[3])0; - int i = 0; - int a = 0; - int x_67_phi = 0; - const float x_44 = asfloat(x_6[1].x); - const float3 x_48 = float3(0.0f, 0.0f, 0.0f); - m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), float3(0.0f, 0.0f, 0.0f)); - const uint scalar_offset = ((16u * uint(0))) / 4; - const int x_51 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); - const uint scalar_offset_1 = ((16u * uint(0))) / 4; - const int x_53 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); - const uint scalar_offset_2 = ((16u * uint(0))) / 4; - const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); - set_scalar_float4x3(m43, x_53, x_51, x_55); - const uint scalar_offset_3 = ((16u * uint(0))) / 4; - const float x_58 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); - const uint scalar_offset_4 = ((16u * uint(0))) / 4; - const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); - const uint scalar_offset_5 = ((16u * uint(0))) / 4; - const float x_62 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); - const tint_padded_array_element tint_symbol_3[3] = {{x_58}, {x_60}, {x_62}}; - sums = tint_symbol_3; - const uint scalar_offset_6 = ((16u * uint(0))) / 4; - const int x_65 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); - i = x_65; - x_67_phi = x_65; - [loop] while (true) { - const int x_67 = x_67_phi; - const int x_73 = asint(x_8[3].x); - if ((x_67 < x_73)) { - } else { - break; - } - const uint scalar_offset_7 = ((16u * uint(0))) / 4; - const int x_77 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); - const uint scalar_offset_8 = ((16u * uint(0))) / 4; - const int x_79 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]); - const float x_81 = m43[x_67][x_79]; - const float x_83 = sums[x_77].el; - sums[x_77].el = (x_83 + x_81); - { - const int x_68 = (x_67 + 1); - i = x_68; - x_67_phi = x_68; - } - } - const int x_87 = asint(x_8[1].x); - if ((x_87 == 1)) { - a = 4; - const int x_92 = asint(x_8[2].x); - const uint scalar_offset_9 = ((16u * uint(0))) / 4; - const int x_94 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]); - const float x_96 = m43[4][x_94]; - const float x_98 = sums[x_92].el; - sums[x_92].el = (x_98 + x_96); - } - const int x_102 = asint(x_8[1].x); - const float x_104 = sums[x_102].el; - const uint scalar_offset_10 = ((16u * uint(0))) / 4; - const int x_106 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]); - const float x_108 = sums[x_106].el; - const float x_111 = asfloat(x_6[2].x); - if (((x_104 + x_108) == x_111)) { - const uint scalar_offset_11 = ((16u * uint(0))) / 4; - const int x_117 = asint(x_8[scalar_offset_11 / 4][scalar_offset_11 % 4]); - const int x_120 = asint(x_8[1].x); - const int x_123 = asint(x_8[1].x); - const uint scalar_offset_12 = ((16u * uint(0))) / 4; - const int x_126 = asint(x_8[scalar_offset_12 / 4][scalar_offset_12 % 4]); - x_GLF_color = float4(float(x_117), float(x_120), float(x_123), float(x_126)); - } else { - const int x_130 = asint(x_8[1].x); - const float x_131 = float(x_130); - x_GLF_color = float4(x_131, x_131, x_131, x_131); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x00000111C3C21900(84,24-29): error X3504: array index out of bounds - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl index ab2fe1e769..006779f1c3 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl @@ -98,7 +98,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..abb85d570e --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,133 @@ +SKIP: FAILED + +void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + case 3: + mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; + break; + } +} + +struct strided_arr { + float el; +}; + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + strided_arr sums[3] = (strided_arr[3])0; + int i = 0; + int a = 0; + int x_67_phi = 0; + const float x_44 = asfloat(x_6[1].x); + const float3 x_48 = (0.0f).xxx; + m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), (0.0f).xxx); + const uint scalar_offset = ((16u * 0u)) / 4; + const int x_51 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * 0u)) / 4; + const int x_53 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * 0u)) / 4; + const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_scalar_float4x3(m43, x_53, x_51, x_55); + const uint scalar_offset_3 = ((16u * 0u)) / 4; + const float x_58 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * 0u)) / 4; + const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * 0u)) / 4; + const float x_62 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const strided_arr tint_symbol_3 = {x_58}; + const strided_arr tint_symbol_4 = {x_60}; + const strided_arr tint_symbol_5 = {x_62}; + const strided_arr tint_symbol_6[3] = {tint_symbol_3, tint_symbol_4, tint_symbol_5}; + sums = tint_symbol_6; + const uint scalar_offset_6 = ((16u * 0u)) / 4; + const int x_65 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + i = x_65; + x_67_phi = x_65; + [loop] while (true) { + const int x_67 = x_67_phi; + const int x_73 = asint(x_8[3].x); + if ((x_67 < x_73)) { + } else { + break; + } + const uint scalar_offset_7 = ((16u * 0u)) / 4; + const int x_77 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * 0u)) / 4; + const int x_79 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_81 = m43[x_67][x_79]; + const float x_83 = sums[x_77].el; + sums[x_77].el = (x_83 + x_81); + { + const int x_68 = (x_67 + 1); + i = x_68; + x_67_phi = x_68; + } + } + const int x_87 = asint(x_8[1].x); + if ((x_87 == 1)) { + a = 4; + const int x_92 = asint(x_8[2].x); + const uint scalar_offset_9 = ((16u * 0u)) / 4; + const int x_94 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const float x_96 = m43[4][x_94]; + const float x_98 = sums[x_92].el; + sums[x_92].el = (x_98 + x_96); + } + const int x_102 = asint(x_8[1].x); + const float x_104 = sums[x_102].el; + const uint scalar_offset_10 = ((16u * 0u)) / 4; + const int x_106 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const float x_108 = sums[x_106].el; + const float x_111 = asfloat(x_6[2].x); + if (((x_104 + x_108) == x_111)) { + const uint scalar_offset_11 = ((16u * 0u)) / 4; + const int x_117 = asint(x_8[scalar_offset_11 / 4][scalar_offset_11 % 4]); + const int x_120 = asint(x_8[1].x); + const int x_123 = asint(x_8[1].x); + const uint scalar_offset_12 = ((16u * 0u)) / 4; + const int x_126 = asint(x_8[scalar_offset_12 / 4][scalar_offset_12 % 4]); + x_GLF_color = float4(float(x_117), float(x_120), float(x_123), float(x_126)); + } else { + const int x_130 = asint(x_8[1].x); + const float x_131 = float(x_130); + x_GLF_color = float4(x_131, x_131, x_131, x_131); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_7 = {x_GLF_color}; + return tint_symbol_7; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.glsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.glsl index 005362d121..e7e10eef63 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.glsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.glsl @@ -36,8 +36,8 @@ void main_1() { int a = 0; int x_67_phi = 0; float x_44 = x_6.x_GLF_uniform_float_values[1].el; - vec3 x_48 = vec3(0.0f, 0.0f, 0.0f); - m43 = mat4x3(vec3(x_44, 0.0f, 0.0f), vec3(0.0f, x_44, 0.0f), vec3(0.0f, 0.0f, x_44), vec3(0.0f, 0.0f, 0.0f)); + vec3 x_48 = vec3(0.0f); + m43 = mat4x3(vec3(x_44, 0.0f, 0.0f), vec3(0.0f, x_44, 0.0f), vec3(0.0f, 0.0f, x_44), vec3(0.0f)); int x_51 = x_8.x_GLF_uniform_int_values[0].el; int x_53 = x_8.x_GLF_uniform_int_values[0].el; float x_55 = x_6.x_GLF_uniform_float_values[0].el; diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl deleted file mode 100644 index 5ab81af4ec..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,132 +0,0 @@ -SKIP: FAILED - -void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - case 2: - mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; - break; - case 3: - mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; - break; - } -} - -struct tint_padded_array_element { - float el; -}; - -cbuffer cbuffer_x_6 : register(b1, space0) { - uint4 x_6[3]; -}; -cbuffer cbuffer_x_8 : register(b0, space0) { - uint4 x_8[4]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - tint_padded_array_element sums[3] = (tint_padded_array_element[3])0; - int i = 0; - int a = 0; - int x_67_phi = 0; - const float x_44 = asfloat(x_6[1].x); - const float3 x_48 = float3(0.0f, 0.0f, 0.0f); - m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), float3(0.0f, 0.0f, 0.0f)); - const uint scalar_offset = ((16u * uint(0))) / 4; - const int x_51 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); - const uint scalar_offset_1 = ((16u * uint(0))) / 4; - const int x_53 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); - const uint scalar_offset_2 = ((16u * uint(0))) / 4; - const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); - set_scalar_float4x3(m43, x_53, x_51, x_55); - const uint scalar_offset_3 = ((16u * uint(0))) / 4; - const float x_58 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); - const uint scalar_offset_4 = ((16u * uint(0))) / 4; - const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); - const uint scalar_offset_5 = ((16u * uint(0))) / 4; - const float x_62 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); - const tint_padded_array_element tint_symbol_3[3] = {{x_58}, {x_60}, {x_62}}; - sums = tint_symbol_3; - const uint scalar_offset_6 = ((16u * uint(0))) / 4; - const int x_65 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); - i = x_65; - x_67_phi = x_65; - [loop] while (true) { - const int x_67 = x_67_phi; - const int x_73 = asint(x_8[3].x); - if ((x_67 < x_73)) { - } else { - break; - } - const uint scalar_offset_7 = ((16u * uint(0))) / 4; - const int x_77 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); - const uint scalar_offset_8 = ((16u * uint(0))) / 4; - const int x_79 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]); - const float x_81 = m43[x_67][x_79]; - const float x_83 = sums[x_77].el; - sums[x_77].el = (x_83 + x_81); - { - const int x_68 = (x_67 + 1); - i = x_68; - x_67_phi = x_68; - } - } - const int x_87 = asint(x_8[1].x); - if ((x_87 == 1)) { - a = 4; - const int x_92 = asint(x_8[2].x); - const uint scalar_offset_9 = ((16u * uint(0))) / 4; - const int x_94 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]); - const float x_96 = m43[4][x_94]; - const float x_98 = sums[x_92].el; - sums[x_92].el = (x_98 + x_96); - } - const int x_102 = asint(x_8[1].x); - const float x_104 = sums[x_102].el; - const uint scalar_offset_10 = ((16u * uint(0))) / 4; - const int x_106 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]); - const float x_108 = sums[x_106].el; - const float x_111 = asfloat(x_6[2].x); - if (((x_104 + x_108) == x_111)) { - const uint scalar_offset_11 = ((16u * uint(0))) / 4; - const int x_117 = asint(x_8[scalar_offset_11 / 4][scalar_offset_11 % 4]); - const int x_120 = asint(x_8[1].x); - const int x_123 = asint(x_8[1].x); - const uint scalar_offset_12 = ((16u * uint(0))) / 4; - const int x_126 = asint(x_8[scalar_offset_12 / 4][scalar_offset_12 % 4]); - x_GLF_color = float4(float(x_117), float(x_120), float(x_123), float(x_126)); - } else { - const int x_130 = asint(x_8[1].x); - const float x_131 = float(x_130); - x_GLF_color = float4(x_131, x_131, x_131, x_131); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x0000020DD7F92800(84,24-29): error X3504: array index out of bounds - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl index 3e9258a940..118074c86c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl @@ -97,7 +97,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl index 6f1222b3f6..e58d17ee86 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl @@ -35,7 +35,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl index 7f6f64d80f..8418f6e8d8 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl @@ -60,7 +60,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl index f6094954d0..dfc8799c3b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl @@ -61,7 +61,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl index d60a6c4dca..a3eb8ed32b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl @@ -39,7 +39,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl index 6c21a50783..038cbc58cb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl @@ -64,7 +64,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl index 6591588382..f5b06a9f92 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl @@ -64,7 +64,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl index 8360d2ed9c..6475082df3 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl @@ -158,7 +158,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl index 06406f24ba..2020584835 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl @@ -33,7 +33,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl index b8fde85c09..9e9fe23c58 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl @@ -31,7 +31,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl index 8cdf80577e..2586ea3ddc 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl @@ -22,7 +22,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl index ffddefbcd5..07ee5e27b4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl @@ -18,7 +18,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.glsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.glsl index eda3b9ae04..cfdb6b161f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.glsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.glsl @@ -34,7 +34,7 @@ void main_1() { float sums[3] = float[3](0.0f, 0.0f, 0.0f); int x_52_phi = 0; float x_40 = x_6.x_GLF_uniform_float_values[0].el; - m32 = mat3x2(vec2(x_40, 0.0f), vec2(0.0f, x_40), vec2(0.0f, 0.0f)); + m32 = mat3x2(vec2(x_40, 0.0f), vec2(0.0f, x_40), vec2(0.0f)); int x_45 = x_8.x_GLF_uniform_int_values[0].el; if ((x_45 == 1)) { m32[3][x_45] = x_40; diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl index 2878e1de0a..e1d29af29d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl @@ -69,7 +69,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.glsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.glsl index eda3b9ae04..cfdb6b161f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.glsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.glsl @@ -34,7 +34,7 @@ void main_1() { float sums[3] = float[3](0.0f, 0.0f, 0.0f); int x_52_phi = 0; float x_40 = x_6.x_GLF_uniform_float_values[0].el; - m32 = mat3x2(vec2(x_40, 0.0f), vec2(0.0f, x_40), vec2(0.0f, 0.0f)); + m32 = mat3x2(vec2(x_40, 0.0f), vec2(0.0f, x_40), vec2(0.0f)); int x_45 = x_8.x_GLF_uniform_int_values[0].el; if ((x_45 == 1)) { m32[3][x_45] = x_40; diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl index 878faea737..f94b71c520 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl @@ -64,7 +64,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl index 1770f67176..fd261dbd7d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl @@ -70,7 +70,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl index d3898be323..be96401c5e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl @@ -117,7 +117,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl index 0a3e1b3bd1..7855268530 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl @@ -61,7 +61,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl index 8aaf0af58f..2c8368486d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl @@ -91,7 +91,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl index f4c8f8eb18..0a907b9da5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl @@ -101,7 +101,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { main_1(); } diff --git a/test/tint/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl index df826b8540..df60af33a4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl @@ -66,7 +66,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl index f1a3930291..0fbc4eb9eb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl @@ -47,7 +47,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl index 888ee7a0fc..6761b87303 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl @@ -36,7 +36,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl index 6cfa6d91b7..1f09f47eb5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl @@ -42,7 +42,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl index d557692e26..4890b8a506 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl @@ -51,7 +51,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl index 943fe6d63d..7038fc43dc 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl @@ -37,7 +37,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl index b328851826..a819c806a1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl @@ -44,7 +44,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl index e35d29b99f..ce12bf7176 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl @@ -68,7 +68,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl index 896c857ce5..83e36a634a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl @@ -28,7 +28,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl index e4494049a6..7311f29b18 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl @@ -37,7 +37,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { main_1(); } diff --git a/test/tint/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl index d5891cee53..9bb781ce19 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl @@ -77,7 +77,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl index 5e29cbc586..1355b0e4a6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl @@ -35,7 +35,7 @@ struct main_out { color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl index 8d1c3d7448..e5c0b2bc2d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl @@ -19,7 +19,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl index 4b56ed3443..489cbde005 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl @@ -35,7 +35,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl index fa91391fc1..2ca87f2d26 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl @@ -81,7 +81,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.dxc.hlsl new file mode 100755 index 0000000000..f7c09d1bbe --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.dxc.hlsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float fx_() { + const float x_50 = gl_FragCoord.y; + if ((x_50 >= 0.0f)) { + const float x_55 = asfloat(x_7[0].y); + return x_55; + } + [loop] while (true) { + if (true) { + } else { + break; + } + x_GLF_color = (1.0f).xxxx; + } + return 0.0f; +} + +void main_1() { + float x2 = 0.0f; + float B = 0.0f; + float k0 = 0.0f; + x2 = 1.0f; + B = 1.0f; + const float x_34 = fx_(); + x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f); + [loop] while (true) { + if ((x2 > 2.0f)) { + } else { + break; + } + const float x_43 = fx_(); + const float x_44 = fx_(); + k0 = (x_43 - x_44); + B = k0; + x2 = B; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:62: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.fxc.hlsl new file mode 100755 index 0000000000..4e0e7573cf --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,69 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float fx_() { + const float x_50 = gl_FragCoord.y; + if ((x_50 >= 0.0f)) { + const float x_55 = asfloat(x_7[0].y); + return x_55; + } + [loop] while (true) { + if (true) { + } else { + break; + } + x_GLF_color = (1.0f).xxxx; + } + return 0.0f; +} + +void main_1() { + float x2 = 0.0f; + float B = 0.0f; + float k0 = 0.0f; + x2 = 1.0f; + B = 1.0f; + const float x_34 = fx_(); + x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f); + [loop] while (true) { + if ((x2 > 2.0f)) { + } else { + break; + } + const float x_43 = fx_(); + const float x_44 = fx_(); + k0 = (x_43 - x_44); + B = k0; + x2 = B; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl deleted file mode 100755 index 3607e5c69a..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_7 : register(b0, space0) { - uint4 x_7[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -float fx_() { - const float x_50 = gl_FragCoord.y; - if ((x_50 >= 0.0f)) { - const float x_55 = asfloat(x_7[0].y); - return x_55; - } - [loop] while (true) { - if (true) { - } else { - break; - } - x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); - } - return 0.0f; -} - -void main_1() { - float x2 = 0.0f; - float B = 0.0f; - float k0 = 0.0f; - x2 = 1.0f; - B = 1.0f; - const float x_34 = fx_(); - x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f); - [loop] while (true) { - if ((x2 > 2.0f)) { - } else { - break; - } - const float x_43 = fx_(); - const float x_44 = fx_(); - k0 = (x_43 - x_44); - B = k0; - x2 = B; - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\u17p0.0:62: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl index 9ee645ede0..12782cbeee 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl @@ -54,7 +54,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.dxc.hlsl new file mode 100755 index 0000000000..f7c09d1bbe --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.dxc.hlsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float fx_() { + const float x_50 = gl_FragCoord.y; + if ((x_50 >= 0.0f)) { + const float x_55 = asfloat(x_7[0].y); + return x_55; + } + [loop] while (true) { + if (true) { + } else { + break; + } + x_GLF_color = (1.0f).xxxx; + } + return 0.0f; +} + +void main_1() { + float x2 = 0.0f; + float B = 0.0f; + float k0 = 0.0f; + x2 = 1.0f; + B = 1.0f; + const float x_34 = fx_(); + x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f); + [loop] while (true) { + if ((x2 > 2.0f)) { + } else { + break; + } + const float x_43 = fx_(); + const float x_44 = fx_(); + k0 = (x_43 - x_44); + B = k0; + x2 = B; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:62: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.fxc.hlsl new file mode 100755 index 0000000000..4e0e7573cf --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,69 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float fx_() { + const float x_50 = gl_FragCoord.y; + if ((x_50 >= 0.0f)) { + const float x_55 = asfloat(x_7[0].y); + return x_55; + } + [loop] while (true) { + if (true) { + } else { + break; + } + x_GLF_color = (1.0f).xxxx; + } + return 0.0f; +} + +void main_1() { + float x2 = 0.0f; + float B = 0.0f; + float k0 = 0.0f; + x2 = 1.0f; + B = 1.0f; + const float x_34 = fx_(); + x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f); + [loop] while (true) { + if ((x2 > 2.0f)) { + } else { + break; + } + const float x_43 = fx_(); + const float x_44 = fx_(); + k0 = (x_43 - x_44); + B = k0; + x2 = B; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl deleted file mode 100755 index fa21c5b8ec..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,75 +0,0 @@ -SKIP: FAILED - -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_7 : register(b0, space0) { - uint4 x_7[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -float fx_() { - const float x_50 = gl_FragCoord.y; - if ((x_50 >= 0.0f)) { - const float x_55 = asfloat(x_7[0].y); - return x_55; - } - [loop] while (true) { - if (true) { - } else { - break; - } - x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); - } - return 0.0f; -} - -void main_1() { - float x2 = 0.0f; - float B = 0.0f; - float k0 = 0.0f; - x2 = 1.0f; - B = 1.0f; - const float x_34 = fx_(); - x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f); - [loop] while (true) { - if ((x2 > 2.0f)) { - } else { - break; - } - const float x_43 = fx_(); - const float x_44 = fx_(); - k0 = (x_43 - x_44); - B = k0; - x2 = B; - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\uvqg.0:62: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl index 96b3c2144a..68a8df5ab6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl @@ -142,7 +142,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl index 5ba76cfb1a..d9cf1c740e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl @@ -40,7 +40,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..4455eec217 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.fxc.hlsl @@ -0,0 +1,283 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + [loop] while (true) { + bool x_45 = false; + int x_48 = 0; + int x_49 = 0; + bool x_46 = false; + int x_115 = 0; + int x_116 = 0; + bool x_45_phi = false; + int x_48_phi = 0; + int x_50_phi = 0; + int x_52_phi = 0; + int x_111_phi = 0; + bool x_112_phi = false; + int x_115_phi = 0; + int x_118_phi = 0; + int x_120_phi = 0; + int x_161_phi = 0; + const float x_40 = asfloat(x_6[0].x); + const bool x_41 = (x_40 < -1.0f); + x_45_phi = false; + x_48_phi = 0; + x_50_phi = 0; + x_52_phi = 0; + [loop] while (true) { + int x_62 = 0; + int x_65 = 0; + int x_66 = 0; + int x_63 = 0; + int x_53 = 0; + int x_62_phi = 0; + int x_65_phi = 0; + int x_67_phi = 0; + int x_51_phi = 0; + int x_49_phi = 0; + bool x_46_phi = false; + x_45 = x_45_phi; + x_48 = x_48_phi; + const int x_50 = x_50_phi; + const int x_52 = x_52_phi; + const float x_55 = gl_FragCoord.y; + x_111_phi = x_48; + x_112_phi = x_45; + if ((x_52 < ((x_55 > -1.0f) ? 10 : 100))) { + } else { + break; + } + x_62_phi = x_48; + x_65_phi = x_50; + x_67_phi = 0; + [loop] while (true) { + int x_97 = 0; + int x_68 = 0; + int x_66_phi = 0; + x_62 = x_62_phi; + x_65 = x_65_phi; + const int x_67 = x_67_phi; + x_51_phi = x_65; + x_49_phi = x_62; + x_46_phi = x_45; + if ((x_67 < 2)) { + } else { + break; + } + [loop] while (true) { + bool x_78 = false; + int x_86_phi = 0; + int x_97_phi = 0; + bool x_98_phi = false; + const float x_77 = gl_FragCoord.x; + x_78 = (x_77 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_78) { + x_66_phi = 0; + break; + } + x_86_phi = 1; + [loop] while (true) { + int x_87 = 0; + const int x_86 = x_86_phi; + x_97_phi = x_65; + x_98_phi = false; + if ((x_86 < 3)) { + } else { + break; + } + if (x_78) { + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + continue; + } + if ((x_86 > 0)) { + x_97_phi = 1; + x_98_phi = true; + break; + } + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + } + x_97 = x_97_phi; + const bool x_98 = x_98_phi; + x_66_phi = x_97; + if (x_98) { + break; + } + } + x_66_phi = 0; + break; + } + x_66 = x_66_phi; + x_63 = asint((x_62 + x_66)); + if (x_41) { + [loop] while (true) { + if (x_41) { + } else { + break; + } + { + const float x_105 = float(x_52); + x_GLF_color = float4(x_105, x_105, x_105, x_105); + } + } + x_51_phi = x_66; + x_49_phi = x_63; + x_46_phi = true; + break; + } + { + x_68 = (x_67 + 1); + x_62_phi = x_63; + x_65_phi = x_66; + x_67_phi = x_68; + } + } + const int x_51 = x_51_phi; + x_49 = x_49_phi; + x_46 = x_46_phi; + x_111_phi = x_49; + x_112_phi = x_46; + if (x_46) { + break; + } + if (!(x_41)) { + x_111_phi = x_49; + x_112_phi = x_46; + break; + } + { + x_53 = (x_52 + 1); + x_45_phi = x_46; + x_48_phi = x_49; + x_50_phi = x_51; + x_52_phi = x_53; + } + } + const int x_111 = x_111_phi; + if (x_112_phi) { + break; + } + x_115_phi = x_111; + x_118_phi = 0; + x_120_phi = 0; + [loop] while (true) { + int x_154 = 0; + int x_121 = 0; + int x_119_phi = 0; + x_115 = x_115_phi; + const int x_118 = x_118_phi; + const int x_120 = x_120_phi; + const float x_123 = asfloat(x_6[0].y); + x_161_phi = x_115; + if ((x_120 < int((x_123 + 1.0f)))) { + } else { + break; + } + [loop] while (true) { + bool x_135 = false; + int x_143_phi = 0; + int x_154_phi = 0; + bool x_155_phi = false; + const float x_134 = gl_FragCoord.x; + x_135 = (x_134 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_135) { + x_119_phi = 0; + break; + } + x_143_phi = 1; + [loop] while (true) { + int x_144 = 0; + const int x_143 = x_143_phi; + x_154_phi = x_118; + x_155_phi = false; + if ((x_143 < 3)) { + } else { + break; + } + if (x_135) { + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + continue; + } + if ((x_143 > 0)) { + x_154_phi = 1; + x_155_phi = true; + break; + } + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + } + x_154 = x_154_phi; + const bool x_155 = x_155_phi; + x_119_phi = x_154; + if (x_155) { + break; + } + } + x_119_phi = 0; + break; + } + int x_119 = 0; + x_119 = x_119_phi; + x_116 = asint((x_115 + x_119)); + if ((!(x_41) ? false : x_41)) { + x_161_phi = x_116; + break; + } + { + x_121 = (x_120 + 1); + x_115_phi = x_116; + x_118_phi = x_119; + x_120_phi = x_121; + } + } + if ((x_161_phi == 4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = (0.0f).xxxx; + } + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl deleted file mode 100644 index 66cf344350..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl +++ /dev/null @@ -1,288 +0,0 @@ -SKIP: FAILED - -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_6 : register(b0, space0) { - uint4 x_6[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - [loop] while (true) { - bool x_45 = false; - int x_48 = 0; - int x_49 = 0; - bool x_46 = false; - int x_115 = 0; - int x_116 = 0; - bool x_45_phi = false; - int x_48_phi = 0; - int x_50_phi = 0; - int x_52_phi = 0; - int x_111_phi = 0; - bool x_112_phi = false; - int x_115_phi = 0; - int x_118_phi = 0; - int x_120_phi = 0; - int x_161_phi = 0; - const float x_40 = asfloat(x_6[0].x); - const bool x_41 = (x_40 < -1.0f); - x_45_phi = false; - x_48_phi = 0; - x_50_phi = 0; - x_52_phi = 0; - [loop] while (true) { - int x_62 = 0; - int x_65 = 0; - int x_66 = 0; - int x_63 = 0; - int x_53 = 0; - int x_62_phi = 0; - int x_65_phi = 0; - int x_67_phi = 0; - int x_51_phi = 0; - int x_49_phi = 0; - bool x_46_phi = false; - x_45 = x_45_phi; - x_48 = x_48_phi; - const int x_50 = x_50_phi; - const int x_52 = x_52_phi; - const float x_55 = gl_FragCoord.y; - x_111_phi = x_48; - x_112_phi = x_45; - if ((x_52 < ((x_55 > -1.0f) ? 10 : 100))) { - } else { - break; - } - x_62_phi = x_48; - x_65_phi = x_50; - x_67_phi = 0; - [loop] while (true) { - int x_97 = 0; - int x_68 = 0; - int x_66_phi = 0; - x_62 = x_62_phi; - x_65 = x_65_phi; - const int x_67 = x_67_phi; - x_51_phi = x_65; - x_49_phi = x_62; - x_46_phi = x_45; - if ((x_67 < 2)) { - } else { - break; - } - [loop] while (true) { - bool x_78 = false; - int x_86_phi = 0; - int x_97_phi = 0; - bool x_98_phi = false; - const float x_77 = gl_FragCoord.x; - x_78 = (x_77 < -1.0f); - if (!((x_40 < 0.0f))) { - if (x_78) { - x_66_phi = 0; - break; - } - x_86_phi = 1; - [loop] while (true) { - int x_87 = 0; - const int x_86 = x_86_phi; - x_97_phi = x_65; - x_98_phi = false; - if ((x_86 < 3)) { - } else { - break; - } - if (x_78) { - { - x_87 = (x_86 + 1); - x_86_phi = x_87; - } - continue; - } - if ((x_86 > 0)) { - x_97_phi = 1; - x_98_phi = true; - break; - } - { - x_87 = (x_86 + 1); - x_86_phi = x_87; - } - } - x_97 = x_97_phi; - const bool x_98 = x_98_phi; - x_66_phi = x_97; - if (x_98) { - break; - } - } - x_66_phi = 0; - break; - } - x_66 = x_66_phi; - x_63 = asint((x_62 + x_66)); - if (x_41) { - [loop] while (true) { - if (x_41) { - } else { - break; - } - { - const float x_105 = float(x_52); - x_GLF_color = float4(x_105, x_105, x_105, x_105); - } - } - x_51_phi = x_66; - x_49_phi = x_63; - x_46_phi = true; - break; - } - { - x_68 = (x_67 + 1); - x_62_phi = x_63; - x_65_phi = x_66; - x_67_phi = x_68; - } - } - const int x_51 = x_51_phi; - x_49 = x_49_phi; - x_46 = x_46_phi; - x_111_phi = x_49; - x_112_phi = x_46; - if (x_46) { - break; - } - if (!(x_41)) { - x_111_phi = x_49; - x_112_phi = x_46; - break; - } - { - x_53 = (x_52 + 1); - x_45_phi = x_46; - x_48_phi = x_49; - x_50_phi = x_51; - x_52_phi = x_53; - } - } - const int x_111 = x_111_phi; - if (x_112_phi) { - break; - } - x_115_phi = x_111; - x_118_phi = 0; - x_120_phi = 0; - [loop] while (true) { - int x_154 = 0; - int x_121 = 0; - int x_119_phi = 0; - x_115 = x_115_phi; - const int x_118 = x_118_phi; - const int x_120 = x_120_phi; - const float x_123 = asfloat(x_6[0].y); - x_161_phi = x_115; - if ((x_120 < int((x_123 + 1.0f)))) { - } else { - break; - } - [loop] while (true) { - bool x_135 = false; - int x_143_phi = 0; - int x_154_phi = 0; - bool x_155_phi = false; - const float x_134 = gl_FragCoord.x; - x_135 = (x_134 < -1.0f); - if (!((x_40 < 0.0f))) { - if (x_135) { - x_119_phi = 0; - break; - } - x_143_phi = 1; - [loop] while (true) { - int x_144 = 0; - const int x_143 = x_143_phi; - x_154_phi = x_118; - x_155_phi = false; - if ((x_143 < 3)) { - } else { - break; - } - if (x_135) { - { - x_144 = (x_143 + 1); - x_143_phi = x_144; - } - continue; - } - if ((x_143 > 0)) { - x_154_phi = 1; - x_155_phi = true; - break; - } - { - x_144 = (x_143 + 1); - x_143_phi = x_144; - } - } - x_154 = x_154_phi; - const bool x_155 = x_155_phi; - x_119_phi = x_154; - if (x_155) { - break; - } - } - x_119_phi = 0; - break; - } - int x_119 = 0; - x_119 = x_119_phi; - x_116 = asint((x_115 + x_119)); - if ((!(x_41) ? false : x_41)) { - x_161_phi = x_116; - break; - } - { - x_121 = (x_120 + 1); - x_115_phi = x_116; - x_118_phi = x_119; - x_120_phi = x_121; - } - } - if ((x_161_phi == 4)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - } - break; - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000002215620C140(8,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x000002215620C140(71,16-27): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x000002215620C140(186,14-25): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x000002215620C140(123,18-29): error X4029: infinite loop detected - loop never exits - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl index 6dca2565ec..94830bb825 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl @@ -265,7 +265,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4455eec217 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.fxc.hlsl @@ -0,0 +1,283 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + [loop] while (true) { + bool x_45 = false; + int x_48 = 0; + int x_49 = 0; + bool x_46 = false; + int x_115 = 0; + int x_116 = 0; + bool x_45_phi = false; + int x_48_phi = 0; + int x_50_phi = 0; + int x_52_phi = 0; + int x_111_phi = 0; + bool x_112_phi = false; + int x_115_phi = 0; + int x_118_phi = 0; + int x_120_phi = 0; + int x_161_phi = 0; + const float x_40 = asfloat(x_6[0].x); + const bool x_41 = (x_40 < -1.0f); + x_45_phi = false; + x_48_phi = 0; + x_50_phi = 0; + x_52_phi = 0; + [loop] while (true) { + int x_62 = 0; + int x_65 = 0; + int x_66 = 0; + int x_63 = 0; + int x_53 = 0; + int x_62_phi = 0; + int x_65_phi = 0; + int x_67_phi = 0; + int x_51_phi = 0; + int x_49_phi = 0; + bool x_46_phi = false; + x_45 = x_45_phi; + x_48 = x_48_phi; + const int x_50 = x_50_phi; + const int x_52 = x_52_phi; + const float x_55 = gl_FragCoord.y; + x_111_phi = x_48; + x_112_phi = x_45; + if ((x_52 < ((x_55 > -1.0f) ? 10 : 100))) { + } else { + break; + } + x_62_phi = x_48; + x_65_phi = x_50; + x_67_phi = 0; + [loop] while (true) { + int x_97 = 0; + int x_68 = 0; + int x_66_phi = 0; + x_62 = x_62_phi; + x_65 = x_65_phi; + const int x_67 = x_67_phi; + x_51_phi = x_65; + x_49_phi = x_62; + x_46_phi = x_45; + if ((x_67 < 2)) { + } else { + break; + } + [loop] while (true) { + bool x_78 = false; + int x_86_phi = 0; + int x_97_phi = 0; + bool x_98_phi = false; + const float x_77 = gl_FragCoord.x; + x_78 = (x_77 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_78) { + x_66_phi = 0; + break; + } + x_86_phi = 1; + [loop] while (true) { + int x_87 = 0; + const int x_86 = x_86_phi; + x_97_phi = x_65; + x_98_phi = false; + if ((x_86 < 3)) { + } else { + break; + } + if (x_78) { + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + continue; + } + if ((x_86 > 0)) { + x_97_phi = 1; + x_98_phi = true; + break; + } + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + } + x_97 = x_97_phi; + const bool x_98 = x_98_phi; + x_66_phi = x_97; + if (x_98) { + break; + } + } + x_66_phi = 0; + break; + } + x_66 = x_66_phi; + x_63 = asint((x_62 + x_66)); + if (x_41) { + [loop] while (true) { + if (x_41) { + } else { + break; + } + { + const float x_105 = float(x_52); + x_GLF_color = float4(x_105, x_105, x_105, x_105); + } + } + x_51_phi = x_66; + x_49_phi = x_63; + x_46_phi = true; + break; + } + { + x_68 = (x_67 + 1); + x_62_phi = x_63; + x_65_phi = x_66; + x_67_phi = x_68; + } + } + const int x_51 = x_51_phi; + x_49 = x_49_phi; + x_46 = x_46_phi; + x_111_phi = x_49; + x_112_phi = x_46; + if (x_46) { + break; + } + if (!(x_41)) { + x_111_phi = x_49; + x_112_phi = x_46; + break; + } + { + x_53 = (x_52 + 1); + x_45_phi = x_46; + x_48_phi = x_49; + x_50_phi = x_51; + x_52_phi = x_53; + } + } + const int x_111 = x_111_phi; + if (x_112_phi) { + break; + } + x_115_phi = x_111; + x_118_phi = 0; + x_120_phi = 0; + [loop] while (true) { + int x_154 = 0; + int x_121 = 0; + int x_119_phi = 0; + x_115 = x_115_phi; + const int x_118 = x_118_phi; + const int x_120 = x_120_phi; + const float x_123 = asfloat(x_6[0].y); + x_161_phi = x_115; + if ((x_120 < int((x_123 + 1.0f)))) { + } else { + break; + } + [loop] while (true) { + bool x_135 = false; + int x_143_phi = 0; + int x_154_phi = 0; + bool x_155_phi = false; + const float x_134 = gl_FragCoord.x; + x_135 = (x_134 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_135) { + x_119_phi = 0; + break; + } + x_143_phi = 1; + [loop] while (true) { + int x_144 = 0; + const int x_143 = x_143_phi; + x_154_phi = x_118; + x_155_phi = false; + if ((x_143 < 3)) { + } else { + break; + } + if (x_135) { + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + continue; + } + if ((x_143 > 0)) { + x_154_phi = 1; + x_155_phi = true; + break; + } + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + } + x_154 = x_154_phi; + const bool x_155 = x_155_phi; + x_119_phi = x_154; + if (x_155) { + break; + } + } + x_119_phi = 0; + break; + } + int x_119 = 0; + x_119 = x_119_phi; + x_116 = asint((x_115 + x_119)); + if ((!(x_41) ? false : x_41)) { + x_161_phi = x_116; + break; + } + { + x_121 = (x_120 + 1); + x_115_phi = x_116; + x_118_phi = x_119; + x_120_phi = x_121; + } + } + if ((x_161_phi == 4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = (0.0f).xxxx; + } + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl deleted file mode 100644 index 01f2ccde06..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl +++ /dev/null @@ -1,288 +0,0 @@ -SKIP: FAILED - -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_6 : register(b0, space0) { - uint4 x_6[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - [loop] while (true) { - bool x_45 = false; - int x_48 = 0; - int x_49 = 0; - bool x_46 = false; - int x_115 = 0; - int x_116 = 0; - bool x_45_phi = false; - int x_48_phi = 0; - int x_50_phi = 0; - int x_52_phi = 0; - int x_111_phi = 0; - bool x_112_phi = false; - int x_115_phi = 0; - int x_118_phi = 0; - int x_120_phi = 0; - int x_161_phi = 0; - const float x_40 = asfloat(x_6[0].x); - const bool x_41 = (x_40 < -1.0f); - x_45_phi = false; - x_48_phi = 0; - x_50_phi = 0; - x_52_phi = 0; - [loop] while (true) { - int x_62 = 0; - int x_65 = 0; - int x_66 = 0; - int x_63 = 0; - int x_53 = 0; - int x_62_phi = 0; - int x_65_phi = 0; - int x_67_phi = 0; - int x_51_phi = 0; - int x_49_phi = 0; - bool x_46_phi = false; - x_45 = x_45_phi; - x_48 = x_48_phi; - const int x_50 = x_50_phi; - const int x_52 = x_52_phi; - const float x_55 = gl_FragCoord.y; - x_111_phi = x_48; - x_112_phi = x_45; - if ((x_52 < ((x_55 > -1.0f) ? 10 : 100))) { - } else { - break; - } - x_62_phi = x_48; - x_65_phi = x_50; - x_67_phi = 0; - [loop] while (true) { - int x_97 = 0; - int x_68 = 0; - int x_66_phi = 0; - x_62 = x_62_phi; - x_65 = x_65_phi; - const int x_67 = x_67_phi; - x_51_phi = x_65; - x_49_phi = x_62; - x_46_phi = x_45; - if ((x_67 < 2)) { - } else { - break; - } - [loop] while (true) { - bool x_78 = false; - int x_86_phi = 0; - int x_97_phi = 0; - bool x_98_phi = false; - const float x_77 = gl_FragCoord.x; - x_78 = (x_77 < -1.0f); - if (!((x_40 < 0.0f))) { - if (x_78) { - x_66_phi = 0; - break; - } - x_86_phi = 1; - [loop] while (true) { - int x_87 = 0; - const int x_86 = x_86_phi; - x_97_phi = x_65; - x_98_phi = false; - if ((x_86 < 3)) { - } else { - break; - } - if (x_78) { - { - x_87 = (x_86 + 1); - x_86_phi = x_87; - } - continue; - } - if ((x_86 > 0)) { - x_97_phi = 1; - x_98_phi = true; - break; - } - { - x_87 = (x_86 + 1); - x_86_phi = x_87; - } - } - x_97 = x_97_phi; - const bool x_98 = x_98_phi; - x_66_phi = x_97; - if (x_98) { - break; - } - } - x_66_phi = 0; - break; - } - x_66 = x_66_phi; - x_63 = asint((x_62 + x_66)); - if (x_41) { - [loop] while (true) { - if (x_41) { - } else { - break; - } - { - const float x_105 = float(x_52); - x_GLF_color = float4(x_105, x_105, x_105, x_105); - } - } - x_51_phi = x_66; - x_49_phi = x_63; - x_46_phi = true; - break; - } - { - x_68 = (x_67 + 1); - x_62_phi = x_63; - x_65_phi = x_66; - x_67_phi = x_68; - } - } - const int x_51 = x_51_phi; - x_49 = x_49_phi; - x_46 = x_46_phi; - x_111_phi = x_49; - x_112_phi = x_46; - if (x_46) { - break; - } - if (!(x_41)) { - x_111_phi = x_49; - x_112_phi = x_46; - break; - } - { - x_53 = (x_52 + 1); - x_45_phi = x_46; - x_48_phi = x_49; - x_50_phi = x_51; - x_52_phi = x_53; - } - } - const int x_111 = x_111_phi; - if (x_112_phi) { - break; - } - x_115_phi = x_111; - x_118_phi = 0; - x_120_phi = 0; - [loop] while (true) { - int x_154 = 0; - int x_121 = 0; - int x_119_phi = 0; - x_115 = x_115_phi; - const int x_118 = x_118_phi; - const int x_120 = x_120_phi; - const float x_123 = asfloat(x_6[0].y); - x_161_phi = x_115; - if ((x_120 < int((x_123 + 1.0f)))) { - } else { - break; - } - [loop] while (true) { - bool x_135 = false; - int x_143_phi = 0; - int x_154_phi = 0; - bool x_155_phi = false; - const float x_134 = gl_FragCoord.x; - x_135 = (x_134 < -1.0f); - if (!((x_40 < 0.0f))) { - if (x_135) { - x_119_phi = 0; - break; - } - x_143_phi = 1; - [loop] while (true) { - int x_144 = 0; - const int x_143 = x_143_phi; - x_154_phi = x_118; - x_155_phi = false; - if ((x_143 < 3)) { - } else { - break; - } - if (x_135) { - { - x_144 = (x_143 + 1); - x_143_phi = x_144; - } - continue; - } - if ((x_143 > 0)) { - x_154_phi = 1; - x_155_phi = true; - break; - } - { - x_144 = (x_143 + 1); - x_143_phi = x_144; - } - } - x_154 = x_154_phi; - const bool x_155 = x_155_phi; - x_119_phi = x_154; - if (x_155) { - break; - } - } - x_119_phi = 0; - break; - } - int x_119 = 0; - x_119 = x_119_phi; - x_116 = asint((x_115 + x_119)); - if ((!(x_41) ? false : x_41)) { - x_161_phi = x_116; - break; - } - { - x_121 = (x_120 + 1); - x_115_phi = x_116; - x_118_phi = x_119; - x_120_phi = x_121; - } - } - if ((x_161_phi == 4)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - } - break; - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x0000020EFE36E240(8,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x0000020EFE36E240(71,16-27): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x0000020EFE36E240(186,14-25): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x0000020EFE36E240(123,18-29): error X4029: infinite loop detected - loop never exits - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl index b6091b16d5..772bef8f30 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl @@ -104,7 +104,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl index c9a750329e..527d4621b1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl index dec595e348..21ecd84c57 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl @@ -77,7 +77,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl index baeeb55f19..f4377a9ccb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl @@ -41,7 +41,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl index a5552f48d8..7c36589b5a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl @@ -84,7 +84,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl index 51edc7966c..62fa83b5fa 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl @@ -28,7 +28,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl index 2f9bda553b..21bc6588a2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl @@ -32,7 +32,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl index bb411e10a7..8efed25d0c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl @@ -15,7 +15,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl index a35a5152b0..d714e88f8e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl @@ -65,7 +65,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm deleted file mode 100644 index f854eb0011..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm +++ /dev/null @@ -1,86 +0,0 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 310 - OpName %main "main" - OpName %nb_mod_f1_ "nb_mod(f1;" - OpName %limit "limit" - OpName %_injected_loop_counter "_injected_loop_counter" - OpName %_injected_loop_counter_0 "_injected_loop_counter" - OpName %gl_FragCoord "gl_FragCoord" - OpName %param "param" - OpName %_GLF_color "_GLF_color" - OpDecorate %_injected_loop_counter RelaxedPrecision - OpDecorate %_injected_loop_counter_0 RelaxedPrecision - OpDecorate %gl_FragCoord BuiltIn FragCoord - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %11 = OpTypeFunction %void - %float = OpTypeFloat 32 -%_ptr_Function_float = OpTypePointer Function %float - %14 = OpTypeFunction %float %_ptr_Function_float - %float_1 = OpConstant %float 1 - %bool = OpTypeBool - %int = OpTypeInt 32 1 -%_ptr_Function_int = OpTypePointer Function %int - %int_0 = OpConstant %int 0 - %int_2 = OpConstant %int 2 - %int_1 = OpConstant %int 1 - %v4float = OpTypeVector %float 4 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%gl_FragCoord = OpVariable %_ptr_Input_v4float Input - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Input_float = OpTypePointer Input %float -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_0 = OpConstant %float 0 - %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %30 = OpUndef %int - %true = OpConstantTrue %bool - %main = OpFunction %void None %11 - %32 = OpLabel - %param = OpVariable %_ptr_Function_float Function - %33 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %34 = OpLoad %float %33 - OpStore %param %34 - %35 = OpFunctionCall %float %nb_mod_f1_ %param - OpStore %_GLF_color %29 - OpReturn - OpFunctionEnd - %nb_mod_f1_ = OpFunction %float None %14 - %limit = OpFunctionParameter %_ptr_Function_float - %36 = OpLabel -%_injected_loop_counter = OpVariable %_ptr_Function_int Function -%_injected_loop_counter_0 = OpVariable %_ptr_Function_int Function - %37 = OpLoad %float %limit - %38 = OpFOrdGreaterThanEqual %bool %float_1 %37 - OpSelectionMerge %39 None - OpBranchConditional %38 %40 %39 - %40 = OpLabel - OpReturnValue %float_1 - %39 = OpLabel - OpStore %_injected_loop_counter %int_0 - OpBranch %41 - %41 = OpLabel - %42 = OpSLessThan %bool %int_0 %int_2 - OpLoopMerge %43 %44 None - OpBranch %45 - %45 = OpLabel - OpStore %_injected_loop_counter_0 %int_0 - OpBranch %46 - %46 = OpLabel - %47 = OpSLessThan %bool %int_0 %int_1 - OpLoopMerge %44 %48 None - OpBranch %49 - %49 = OpLabel - OpReturnValue %float_1 - %48 = OpLabel - OpBranch %46 - %44 = OpLabel - OpBranch %41 - %43 = OpLabel - OpUnreachable - OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl deleted file mode 100644 index d0af691114..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl +++ /dev/null @@ -1,42 +0,0 @@ -var gl_FragCoord : vec4; - -var x_GLF_color : vec4; - -fn nb_mod_f1_(limit : ptr) -> f32 { - var x_injected_loop_counter : i32; - var x_injected_loop_counter_1 : i32; - let x_37 : f32 = *(limit); - if ((1.0 >= x_37)) { - return 1.0; - } - x_injected_loop_counter = 0; - loop { - let x_42 : bool = (0 < 2); - x_injected_loop_counter_1 = 0; - loop { - let x_47 : bool = (0 < 1); - return 1.0; - } - } -} - -fn main_1() { - var param : f32; - let x_34 : f32 = gl_FragCoord.x; - param = x_34; - let x_35 : f32 = nb_mod_f1_(&(param)); - x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); - return; -} - -struct main_out { - @location(0) - x_GLF_color_1 : vec4, -} - -@stage(fragment) -fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { - gl_FragCoord = gl_FragCoord_param; - main_1(); - return main_out(x_GLF_color); -} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl index 1cd8ddaba6..feee324278 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl index cd954d2aa2..fe4a229ff2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl @@ -113,7 +113,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl index 51cb5d60cc..f932ed929a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl @@ -40,7 +40,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl index 9fd97b82e9..f9e11f4e35 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl @@ -41,7 +41,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl index fbc53b78d9..d18a92760e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl @@ -46,7 +46,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl index 25a5811d96..bea8c03729 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl @@ -53,7 +53,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl index 9b2a3d6f9b..0361cc51ea 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl @@ -67,7 +67,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl deleted file mode 100755 index 9a5f2e2f43..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,119 +0,0 @@ -SKIP: FAILED - see https://github.com/microsoft/DirectXShaderCompiler/issues/4422 - -cbuffer cbuffer_x_5 : register(b0, space0) { - uint4 x_5[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - bool x_36 = false; - bool x_37 = false; - int x_7 = 0; - bool x_38 = false; - float3 color = float3(0.0f, 0.0f, 0.0f); - bool x_40 = false; - float3 x_43 = float3(0.0f, 0.0f, 0.0f); - bool x_40_phi = false; - float3 x_42_phi = float3(0.0f, 0.0f, 0.0f); - bool x_56_phi = false; - bool x_58_phi = false; - x_40_phi = false; - x_42_phi = float3(0.0f, 0.0f, 0.0f); - [loop] while (true) { - float3 x_43_phi = float3(0.0f, 0.0f, 0.0f); - x_40 = x_40_phi; - const float3 x_42 = x_42_phi; - const float x_47 = asfloat(x_5[0].y); - x_43_phi = x_42; - if ((x_47 < 0.0f)) { - color = float3(1.0f, 1.0f, 1.0f); - x_43_phi = float3(1.0f, 1.0f, 1.0f); - } - x_43 = x_43_phi; - { - x_40_phi = x_40; - x_42_phi = x_43; - if (false) { - } else { - break; - } - } - } - x_36 = false; - x_56_phi = x_40; - x_58_phi = false; - [loop] while (true) { - bool x_62 = false; - bool x_62_phi = false; - bool x_64_phi = false; - int x_65_phi = 0; - bool x_70_phi = false; - bool x_71_phi = false; - const bool x_56 = x_56_phi; - const bool x_58 = x_58_phi; - x_7 = 0; - x_62_phi = x_56; - x_64_phi = false; - x_65_phi = 0; - [loop] while (true) { - x_62 = x_62_phi; - const bool x_64 = x_64_phi; - const int x_65 = x_65_phi; - const bool x_68 = (0 < 1); - x_70_phi = x_62; - x_71_phi = false; - if (true) { - } else { - break; - } - x_36 = true; - x_37 = true; - x_70_phi = true; - x_71_phi = true; - break; - { - x_62_phi = false; - x_64_phi = false; - x_65_phi = 0; - } - } - const bool x_70 = x_70_phi; - const bool x_71 = x_71_phi; - if (true) { - break; - } - x_36 = true; - break; - { - x_56_phi = false; - x_58_phi = false; - } - } - x_38 = true; - const float x_73 = (true ? 1.0f : 0.0f); - x_GLF_color = (float4(x_43.x, x_43.y, x_43.z, 1.0f) + float4(x_73, x_73, x_73, x_73)); - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl index 7109cc1a3a..2eda8e346c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl @@ -105,7 +105,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl deleted file mode 100755 index 9a5f2e2f43..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,119 +0,0 @@ -SKIP: FAILED - see https://github.com/microsoft/DirectXShaderCompiler/issues/4422 - -cbuffer cbuffer_x_5 : register(b0, space0) { - uint4 x_5[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - bool x_36 = false; - bool x_37 = false; - int x_7 = 0; - bool x_38 = false; - float3 color = float3(0.0f, 0.0f, 0.0f); - bool x_40 = false; - float3 x_43 = float3(0.0f, 0.0f, 0.0f); - bool x_40_phi = false; - float3 x_42_phi = float3(0.0f, 0.0f, 0.0f); - bool x_56_phi = false; - bool x_58_phi = false; - x_40_phi = false; - x_42_phi = float3(0.0f, 0.0f, 0.0f); - [loop] while (true) { - float3 x_43_phi = float3(0.0f, 0.0f, 0.0f); - x_40 = x_40_phi; - const float3 x_42 = x_42_phi; - const float x_47 = asfloat(x_5[0].y); - x_43_phi = x_42; - if ((x_47 < 0.0f)) { - color = float3(1.0f, 1.0f, 1.0f); - x_43_phi = float3(1.0f, 1.0f, 1.0f); - } - x_43 = x_43_phi; - { - x_40_phi = x_40; - x_42_phi = x_43; - if (false) { - } else { - break; - } - } - } - x_36 = false; - x_56_phi = x_40; - x_58_phi = false; - [loop] while (true) { - bool x_62 = false; - bool x_62_phi = false; - bool x_64_phi = false; - int x_65_phi = 0; - bool x_70_phi = false; - bool x_71_phi = false; - const bool x_56 = x_56_phi; - const bool x_58 = x_58_phi; - x_7 = 0; - x_62_phi = x_56; - x_64_phi = false; - x_65_phi = 0; - [loop] while (true) { - x_62 = x_62_phi; - const bool x_64 = x_64_phi; - const int x_65 = x_65_phi; - const bool x_68 = (0 < 1); - x_70_phi = x_62; - x_71_phi = false; - if (true) { - } else { - break; - } - x_36 = true; - x_37 = true; - x_70_phi = true; - x_71_phi = true; - break; - { - x_62_phi = false; - x_64_phi = false; - x_65_phi = 0; - } - } - const bool x_70 = x_70_phi; - const bool x_71 = x_71_phi; - if (true) { - break; - } - x_36 = true; - break; - { - x_56_phi = false; - x_58_phi = false; - } - } - x_38 = true; - const float x_73 = (true ? 1.0f : 0.0f); - x_GLF_color = (float4(x_43.x, x_43.y, x_43.z, 1.0f) + float4(x_73, x_73, x_73, x_73)); - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl index 21218c2a2a..ed302ea4e6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl @@ -93,7 +93,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..2eb487b2d2 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float gv = 0.0f; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float lv = 0.0f; + float x_43 = 0.0f; + int GLF_live5r = 0; + int GLF_live5_looplimiter6 = 0; + const float x_45 = asfloat(x_7[0].y); + if ((1.0f > x_45)) { + x_43 = abs(gv); + } else { + x_43 = 260.0f; + } + lv = x_43; + if ((int(lv) < 250)) { + if ((int(lv) < 180)) { + const float x_65 = clamp(lv, 1.0f, 1.0f); + } else { + const float x_67 = gl_FragCoord.y; + if ((x_67 < 0.0f)) { + if ((int(lv) < 210)) { + [loop] while (true) { + { + if (true) { + } else { + break; + } + } + } + } + GLF_live5r = 0; + [loop] while (true) { + if (true) { + } else { + break; + } + if ((GLF_live5_looplimiter6 >= 6)) { + break; + } + GLF_live5_looplimiter6 = (GLF_live5_looplimiter6 + 1); + } + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl deleted file mode 100644 index ba951572eb..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,82 +0,0 @@ -SKIP: FAILED - -cbuffer cbuffer_x_7 : register(b0, space0) { - uint4 x_7[1]; -}; -static float gv = 0.0f; -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - float lv = 0.0f; - float x_43 = 0.0f; - int GLF_live5r = 0; - int GLF_live5_looplimiter6 = 0; - const float x_45 = asfloat(x_7[0].y); - if ((1.0f > x_45)) { - x_43 = abs(gv); - } else { - x_43 = 260.0f; - } - lv = x_43; - if ((int(lv) < 250)) { - if ((int(lv) < 180)) { - const float x_65 = clamp(lv, 1.0f, 1.0f); - } else { - const float x_67 = gl_FragCoord.y; - if ((x_67 < 0.0f)) { - if ((int(lv) < 210)) { - [loop] while (true) { - { - if (true) { - } else { - break; - } - } - } - } - GLF_live5r = 0; - [loop] while (true) { - if (true) { - } else { - break; - } - if ((GLF_live5_looplimiter6 >= 6)) { - break; - } - GLF_live5_looplimiter6 = (GLF_live5_looplimiter6 + 1); - } - } - } - } - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000001DCBE0206C0(27,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop] -C:\src\tint\test\Shader@0x000001DCBE0206C0(27,18-29): warning X3551: infinite loop detected - loop writes no values -C:\src\tint\test\Shader@0x000001DCBE0206C0(27,25-28): error X3696: infinite loop detected - loop never exits - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl index 6a68dff995..25213514ab 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl @@ -70,7 +70,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2eb487b2d2 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,78 @@ +SKIP: FAILED + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float gv = 0.0f; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float lv = 0.0f; + float x_43 = 0.0f; + int GLF_live5r = 0; + int GLF_live5_looplimiter6 = 0; + const float x_45 = asfloat(x_7[0].y); + if ((1.0f > x_45)) { + x_43 = abs(gv); + } else { + x_43 = 260.0f; + } + lv = x_43; + if ((int(lv) < 250)) { + if ((int(lv) < 180)) { + const float x_65 = clamp(lv, 1.0f, 1.0f); + } else { + const float x_67 = gl_FragCoord.y; + if ((x_67 < 0.0f)) { + if ((int(lv) < 210)) { + [loop] while (true) { + { + if (true) { + } else { + break; + } + } + } + } + GLF_live5r = 0; + [loop] while (true) { + if (true) { + } else { + break; + } + if ((GLF_live5_looplimiter6 >= 6)) { + break; + } + GLF_live5_looplimiter6 = (GLF_live5_looplimiter6 + 1); + } + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl deleted file mode 100644 index 2d86c5a96d..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,82 +0,0 @@ -SKIP: FAILED - -cbuffer cbuffer_x_7 : register(b0, space0) { - uint4 x_7[1]; -}; -static float gv = 0.0f; -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - float lv = 0.0f; - float x_43 = 0.0f; - int GLF_live5r = 0; - int GLF_live5_looplimiter6 = 0; - const float x_45 = asfloat(x_7[0].y); - if ((1.0f > x_45)) { - x_43 = abs(gv); - } else { - x_43 = 260.0f; - } - lv = x_43; - if ((int(lv) < 250)) { - if ((int(lv) < 180)) { - const float x_65 = clamp(lv, 1.0f, 1.0f); - } else { - const float x_67 = gl_FragCoord.y; - if ((x_67 < 0.0f)) { - if ((int(lv) < 210)) { - [loop] while (true) { - { - if (true) { - } else { - break; - } - } - } - } - GLF_live5r = 0; - [loop] while (true) { - if (true) { - } else { - break; - } - if ((GLF_live5_looplimiter6 >= 6)) { - break; - } - GLF_live5_looplimiter6 = (GLF_live5_looplimiter6 + 1); - } - } - } - } - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x0000023F9486F180(27,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop] -C:\src\tint\test\Shader@0x0000023F9486F180(27,18-29): warning X3551: infinite loop detected - loop writes no values -C:\src\tint\test\Shader@0x0000023F9486F180(27,25-28): error X3696: infinite loop detected - loop never exits - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl index b7a61d93d1..908d8cc8a5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl @@ -25,7 +25,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl index 3374e3174f..fb36a0a6e5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl @@ -339,7 +339,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl index 8ad4074bcb..6ae4e0d7b3 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl @@ -188,7 +188,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl index bbeb9743c4..2b8e59b835 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl @@ -193,7 +193,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl index ef8966d00b..ec7407efe0 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl @@ -47,7 +47,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl index 63a5937eda..9b2e1a89d4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl @@ -48,7 +48,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl index c80d66f757..306792e0af 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl @@ -85,7 +85,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl index 6f2ad79071..3dbfccbab5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl @@ -90,7 +90,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl index 539e851381..d4e6effd92 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl @@ -348,7 +348,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl index aba0ac91fc..f9eeb16329 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl @@ -104,7 +104,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl index a95f9f797f..c658491d7d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl @@ -105,7 +105,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl index 8b594d432f..a4e052f31f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl @@ -303,7 +303,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl index 3ab90cbdd7..d968dc65b7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl @@ -307,7 +307,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl index 6709a3c267..aeb7ee43fd 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl @@ -110,7 +110,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl index b6e14fcc54..c3f0e7647a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl @@ -110,7 +110,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl index df0ae14613..35a5a3ea43 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl @@ -307,7 +307,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..cb62fbcc53 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.fxc.hlsl @@ -0,0 +1,711 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + int x_360 = 0; + int x_62_phi = 0; + bool x_90_phi = false; + int x_357_phi = 0; + int x_360_phi = 0; + int x_362_phi = 0; + const BST tint_symbol_1 = {9, -1, -1}; + tree[0] = tint_symbol_1; + 0u; + do { + x_62_phi = 0; + [loop] while (true) { + int x_88 = 0; + int x_80 = 0; + int x_63 = 0; + int x_63_phi = 0; + const int x_62 = x_62_phi; + x_90_phi = false; + if ((x_62 <= 1)) { + } else { + break; + } + const int x_69 = tree[x_62].data; + if ((5 <= x_69)) { + const int x_82_save = x_62; + const int x_83 = tree[x_82_save].leftIndex; + if ((x_83 == -1)) { + tree[x_82_save].leftIndex = 1; + const BST tint_symbol_2 = {5, -1, -1}; + tree[1] = tint_symbol_2; + x_90_phi = true; + break; + } else { + x_88 = tree[x_82_save].leftIndex; + x_63_phi = x_88; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + } else { + const int x_74_save = x_62; + const int x_75 = tree[x_74_save].rightIndex; + if ((x_75 == -1)) { + tree[x_74_save].rightIndex = 1; + const BST tint_symbol_3 = {5, -1, -1}; + tree[1] = tint_symbol_3; + x_90_phi = true; + break; + } else { + x_80 = tree[x_74_save].rightIndex; + x_63_phi = x_80; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + } + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + } + if (x_90_phi) { + break; + } + } while (false); + int x_95_phi = 0; + bool x_123_phi = false; + 0u; + do { + x_95_phi = 0; + [loop] while (true) { + int x_121 = 0; + int x_113 = 0; + int x_96 = 0; + int x_96_phi = 0; + const int x_95 = x_95_phi; + x_123_phi = false; + if ((x_95 <= 2)) { + } else { + break; + } + const int x_102 = tree[x_95].data; + if ((12 <= x_102)) { + const int x_115_save = x_95; + const int x_116 = tree[x_115_save].leftIndex; + if ((x_116 == -1)) { + tree[x_115_save].leftIndex = 2; + const BST tint_symbol_4 = {12, -1, -1}; + tree[2] = tint_symbol_4; + x_123_phi = true; + break; + } else { + x_121 = tree[x_115_save].leftIndex; + x_96_phi = x_121; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + } else { + const int x_107_save = x_95; + const int x_108 = tree[x_107_save].rightIndex; + if ((x_108 == -1)) { + tree[x_107_save].rightIndex = 2; + const BST tint_symbol_5 = {12, -1, -1}; + tree[2] = tint_symbol_5; + x_123_phi = true; + break; + } else { + x_113 = tree[x_107_save].rightIndex; + x_96_phi = x_113; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + } + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + } + if (x_123_phi) { + break; + } + } while (false); + int x_128_phi = 0; + bool x_156_phi = false; + 0u; + do { + x_128_phi = 0; + [loop] while (true) { + int x_154 = 0; + int x_146 = 0; + int x_129 = 0; + int x_129_phi = 0; + const int x_128 = x_128_phi; + x_156_phi = false; + if ((x_128 <= 3)) { + } else { + break; + } + const int x_135 = tree[x_128].data; + if ((15 <= x_135)) { + const int x_148_save = x_128; + const int x_149 = tree[x_148_save].leftIndex; + if ((x_149 == -1)) { + tree[x_148_save].leftIndex = 3; + const BST tint_symbol_6 = {15, -1, -1}; + tree[3] = tint_symbol_6; + x_156_phi = true; + break; + } else { + x_154 = tree[x_148_save].leftIndex; + x_129_phi = x_154; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + } else { + const int x_140_save = x_128; + const int x_141 = tree[x_140_save].rightIndex; + if ((x_141 == -1)) { + tree[x_140_save].rightIndex = 3; + const BST tint_symbol_7 = {15, -1, -1}; + tree[3] = tint_symbol_7; + x_156_phi = true; + break; + } else { + x_146 = tree[x_140_save].rightIndex; + x_129_phi = x_146; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + } + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + } + if (x_156_phi) { + break; + } + } while (false); + int x_161_phi = 0; + bool x_189_phi = false; + 0u; + do { + x_161_phi = 0; + [loop] while (true) { + int x_187 = 0; + int x_179 = 0; + int x_162 = 0; + int x_162_phi = 0; + const int x_161 = x_161_phi; + x_189_phi = false; + if ((x_161 <= 4)) { + } else { + break; + } + const int x_168 = tree[x_161].data; + if ((7 <= x_168)) { + const int x_181_save = x_161; + const int x_182 = tree[x_181_save].leftIndex; + if ((x_182 == -1)) { + tree[x_181_save].leftIndex = 4; + const BST tint_symbol_8 = {7, -1, -1}; + tree[4] = tint_symbol_8; + x_189_phi = true; + break; + } else { + x_187 = tree[x_181_save].leftIndex; + x_162_phi = x_187; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + } else { + const int x_173_save = x_161; + const int x_174 = tree[x_173_save].rightIndex; + if ((x_174 == -1)) { + tree[x_173_save].rightIndex = 4; + const BST tint_symbol_9 = {7, -1, -1}; + tree[4] = tint_symbol_9; + x_189_phi = true; + break; + } else { + x_179 = tree[x_173_save].rightIndex; + x_162_phi = x_179; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + } + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + } + if (x_189_phi) { + break; + } + } while (false); + int x_194_phi = 0; + bool x_222_phi = false; + 0u; + do { + x_194_phi = 0; + [loop] while (true) { + int x_220 = 0; + int x_212 = 0; + int x_195 = 0; + int x_195_phi = 0; + const int x_194 = x_194_phi; + x_222_phi = false; + if ((x_194 <= 5)) { + } else { + break; + } + const int x_201 = tree[x_194].data; + if ((8 <= x_201)) { + const int x_214_save = x_194; + const int x_215 = tree[x_214_save].leftIndex; + if ((x_215 == -1)) { + tree[x_214_save].leftIndex = 5; + const BST tint_symbol_10 = {8, -1, -1}; + tree[5] = tint_symbol_10; + x_222_phi = true; + break; + } else { + x_220 = tree[x_214_save].leftIndex; + x_195_phi = x_220; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + } else { + const int x_206_save = x_194; + const int x_207 = tree[x_206_save].rightIndex; + if ((x_207 == -1)) { + tree[x_206_save].rightIndex = 5; + const BST tint_symbol_11 = {8, -1, -1}; + tree[5] = tint_symbol_11; + x_222_phi = true; + break; + } else { + x_212 = tree[x_206_save].rightIndex; + x_195_phi = x_212; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + } + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + } + if (x_222_phi) { + break; + } + } while (false); + int x_227_phi = 0; + bool x_255_phi = false; + 0u; + do { + x_227_phi = 0; + [loop] while (true) { + int x_253 = 0; + int x_245 = 0; + int x_228 = 0; + int x_228_phi = 0; + const int x_227 = x_227_phi; + x_255_phi = false; + if ((x_227 <= 6)) { + } else { + break; + } + const int x_234 = tree[x_227].data; + if ((2 <= x_234)) { + const int x_247_save = x_227; + const int x_248 = tree[x_247_save].leftIndex; + if ((x_248 == -1)) { + tree[x_247_save].leftIndex = 6; + const BST tint_symbol_12 = {2, -1, -1}; + tree[6] = tint_symbol_12; + x_255_phi = true; + break; + } else { + x_253 = tree[x_247_save].leftIndex; + x_228_phi = x_253; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + } else { + const int x_239_save = x_227; + const int x_240 = tree[x_239_save].rightIndex; + if ((x_240 == -1)) { + tree[x_239_save].rightIndex = 6; + const BST tint_symbol_13 = {2, -1, -1}; + tree[6] = tint_symbol_13; + x_255_phi = true; + break; + } else { + x_245 = tree[x_239_save].rightIndex; + x_228_phi = x_245; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + } + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + } + if (x_255_phi) { + break; + } + } while (false); + int x_260_phi = 0; + bool x_288_phi = false; + 0u; + do { + x_260_phi = 0; + [loop] while (true) { + int x_286 = 0; + int x_278 = 0; + int x_261 = 0; + int x_261_phi = 0; + const int x_260 = x_260_phi; + x_288_phi = false; + if ((x_260 <= 7)) { + } else { + break; + } + const int x_267 = tree[x_260].data; + if ((6 <= x_267)) { + const int x_280_save = x_260; + const int x_281 = tree[x_280_save].leftIndex; + if ((x_281 == -1)) { + tree[x_280_save].leftIndex = 7; + const BST tint_symbol_14 = {6, -1, -1}; + tree[7] = tint_symbol_14; + x_288_phi = true; + break; + } else { + x_286 = tree[x_280_save].leftIndex; + x_261_phi = x_286; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + } else { + const int x_272_save = x_260; + const int x_273 = tree[x_272_save].rightIndex; + if ((x_273 == -1)) { + tree[x_272_save].rightIndex = 7; + const BST tint_symbol_15 = {6, -1, -1}; + tree[7] = tint_symbol_15; + x_288_phi = true; + break; + } else { + x_278 = tree[x_272_save].rightIndex; + x_261_phi = x_278; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + } + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + } + if (x_288_phi) { + break; + } + } while (false); + int x_293_phi = 0; + bool x_321_phi = false; + 0u; + do { + x_293_phi = 0; + [loop] while (true) { + int x_319 = 0; + int x_311 = 0; + int x_294 = 0; + int x_294_phi = 0; + const int x_293 = x_293_phi; + x_321_phi = false; + if ((x_293 <= 8)) { + } else { + break; + } + const int x_300 = tree[x_293].data; + if ((17 <= x_300)) { + const int x_313_save = x_293; + const int x_314 = tree[x_313_save].leftIndex; + if ((x_314 == -1)) { + tree[x_313_save].leftIndex = 8; + const BST tint_symbol_16 = {17, -1, -1}; + tree[8] = tint_symbol_16; + x_321_phi = true; + break; + } else { + x_319 = tree[x_313_save].leftIndex; + x_294_phi = x_319; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + } else { + const int x_305_save = x_293; + const int x_306 = tree[x_305_save].rightIndex; + if ((x_306 == -1)) { + tree[x_305_save].rightIndex = 8; + const BST tint_symbol_17 = {17, -1, -1}; + tree[8] = tint_symbol_17; + x_321_phi = true; + break; + } else { + x_311 = tree[x_305_save].rightIndex; + x_294_phi = x_311; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + } + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + } + if (x_321_phi) { + break; + } + } while (false); + int x_326_phi = 0; + bool x_354_phi = false; + 0u; + do { + x_326_phi = 0; + [loop] while (true) { + int x_352 = 0; + int x_344 = 0; + int x_327 = 0; + int x_327_phi = 0; + const int x_326 = x_326_phi; + x_354_phi = false; + if ((x_326 <= 9)) { + } else { + break; + } + const int x_333 = tree[x_326].data; + if ((13 <= x_333)) { + const int x_346_save = x_326; + const int x_347 = tree[x_346_save].leftIndex; + if ((x_347 == -1)) { + tree[x_346_save].leftIndex = 9; + const BST tint_symbol_18 = {13, -1, -1}; + tree[9] = tint_symbol_18; + x_354_phi = true; + break; + } else { + x_352 = tree[x_346_save].leftIndex; + x_327_phi = x_352; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + } else { + const int x_338_save = x_326; + const int x_339 = tree[x_338_save].rightIndex; + if ((x_339 == -1)) { + tree[x_338_save].rightIndex = 9; + const BST tint_symbol_19 = {13, -1, -1}; + tree[9] = tint_symbol_19; + x_354_phi = true; + break; + } else { + x_344 = tree[x_338_save].rightIndex; + x_327_phi = x_344; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + } + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + } + if (x_354_phi) { + break; + } + } while (false); + x_357_phi = 0; + x_360_phi = 0; + x_362_phi = 0; + [loop] while (true) { + int x_392 = 0; + int x_402 = 0; + int x_407 = 0; + int x_363 = 0; + int x_358_phi = 0; + int x_361_phi = 0; + const int x_357 = x_357_phi; + x_360 = x_360_phi; + const int x_362 = x_362_phi; + const int x_365 = (6 - 15); + if ((x_362 < 20)) { + } else { + break; + } + int x_374_phi = 0; + int x_392_phi = 0; + bool x_393_phi = false; + 0u; + do { + x_374_phi = 0; + [loop] while (true) { + const int x_374 = x_374_phi; + x_392_phi = x_357; + x_393_phi = false; + if ((x_374 != -1)) { + } else { + break; + } + const BST x_381 = tree[x_374]; + const int x_382 = x_381.data; + const int x_383 = x_381.leftIndex; + const int x_385 = x_381.rightIndex; + if ((x_382 == x_362)) { + x_392_phi = x_362; + x_393_phi = true; + break; + } + const float x_389 = x_GLF_color[((3u <= 3u) ? 3u : 3u)]; + { + x_374_phi = (!((x_362 <= x_382)) ? x_385 : x_383); + } + } + x_392 = x_392_phi; + const bool x_393 = x_393_phi; + x_358_phi = x_392; + if (x_393) { + break; + } + x_358_phi = -1; + } while (false); + int x_358 = 0; + int x_401 = 0; + int x_406 = 0; + int x_402_phi = 0; + int x_407_phi = 0; + x_358 = x_358_phi; + switch(x_362) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_402_phi = x_360; + if ((x_358 == asint(x_362))) { + x_401 = asint((x_360 + asint(1))); + x_402_phi = x_401; + } + x_402 = x_402_phi; + x_361_phi = x_402; + break; + } + default: { + x_407_phi = x_360; + if ((x_358 == asint(-1))) { + x_406 = asint((x_360 + asint(1))); + x_407_phi = x_406; + } + x_407 = x_407_phi; + x_361_phi = x_407; + break; + } + } + const int x_361 = x_361_phi; + { + x_363 = (x_362 + 1); + x_357_phi = x_358; + x_360_phi = x_361; + x_362_phi = x_363; + } + } + if ((x_360 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_20 = {x_GLF_color}; + return tint_symbol_20; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl deleted file mode 100644 index 562c4dcf95..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl +++ /dev/null @@ -1,778 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - BST tree[10] = (BST[10])0; - int x_360 = 0; - int x_62_phi = 0; - bool x_90_phi = false; - int x_357_phi = 0; - int x_360_phi = 0; - int x_362_phi = 0; - const BST tint_symbol_1 = {9, -1, -1}; - tree[0] = tint_symbol_1; - 0u; - do { - x_62_phi = 0; - [loop] while (true) { - int x_88 = 0; - int x_80 = 0; - int x_63 = 0; - int x_63_phi = 0; - const int x_62 = x_62_phi; - x_90_phi = false; - if ((x_62 <= 1)) { - } else { - break; - } - const int x_69 = tree[x_62].data; - if ((5 <= x_69)) { - const int x_82_save = x_62; - const int x_83 = tree[x_82_save].leftIndex; - if ((x_83 == -1)) { - tree[x_82_save].leftIndex = 1; - const BST tint_symbol_2 = {5, -1, -1}; - tree[1] = tint_symbol_2; - x_90_phi = true; - break; - } else { - x_88 = tree[x_82_save].leftIndex; - x_63_phi = x_88; - { - x_63 = x_63_phi; - x_62_phi = x_63; - } - continue; - } - return; - } else { - const int x_74_save = x_62; - const int x_75 = tree[x_74_save].rightIndex; - if ((x_75 == -1)) { - tree[x_74_save].rightIndex = 1; - const BST tint_symbol_3 = {5, -1, -1}; - tree[1] = tint_symbol_3; - x_90_phi = true; - break; - } else { - x_80 = tree[x_74_save].rightIndex; - x_63_phi = x_80; - { - x_63 = x_63_phi; - x_62_phi = x_63; - } - continue; - } - return; - } - return; - { - x_63 = x_63_phi; - x_62_phi = x_63; - } - } - if (x_90_phi) { - break; - } - } while (false); - int x_95_phi = 0; - bool x_123_phi = false; - 0u; - do { - x_95_phi = 0; - [loop] while (true) { - int x_121 = 0; - int x_113 = 0; - int x_96 = 0; - int x_96_phi = 0; - const int x_95 = x_95_phi; - x_123_phi = false; - if ((x_95 <= 2)) { - } else { - break; - } - const int x_102 = tree[x_95].data; - if ((12 <= x_102)) { - const int x_115_save = x_95; - const int x_116 = tree[x_115_save].leftIndex; - if ((x_116 == -1)) { - tree[x_115_save].leftIndex = 2; - const BST tint_symbol_4 = {12, -1, -1}; - tree[2] = tint_symbol_4; - x_123_phi = true; - break; - } else { - x_121 = tree[x_115_save].leftIndex; - x_96_phi = x_121; - { - x_96 = x_96_phi; - x_95_phi = x_96; - } - continue; - } - return; - } else { - const int x_107_save = x_95; - const int x_108 = tree[x_107_save].rightIndex; - if ((x_108 == -1)) { - tree[x_107_save].rightIndex = 2; - const BST tint_symbol_5 = {12, -1, -1}; - tree[2] = tint_symbol_5; - x_123_phi = true; - break; - } else { - x_113 = tree[x_107_save].rightIndex; - x_96_phi = x_113; - { - x_96 = x_96_phi; - x_95_phi = x_96; - } - continue; - } - return; - } - return; - { - x_96 = x_96_phi; - x_95_phi = x_96; - } - } - if (x_123_phi) { - break; - } - } while (false); - int x_128_phi = 0; - bool x_156_phi = false; - 0u; - do { - x_128_phi = 0; - [loop] while (true) { - int x_154 = 0; - int x_146 = 0; - int x_129 = 0; - int x_129_phi = 0; - const int x_128 = x_128_phi; - x_156_phi = false; - if ((x_128 <= 3)) { - } else { - break; - } - const int x_135 = tree[x_128].data; - if ((15 <= x_135)) { - const int x_148_save = x_128; - const int x_149 = tree[x_148_save].leftIndex; - if ((x_149 == -1)) { - tree[x_148_save].leftIndex = 3; - const BST tint_symbol_6 = {15, -1, -1}; - tree[3] = tint_symbol_6; - x_156_phi = true; - break; - } else { - x_154 = tree[x_148_save].leftIndex; - x_129_phi = x_154; - { - x_129 = x_129_phi; - x_128_phi = x_129; - } - continue; - } - return; - } else { - const int x_140_save = x_128; - const int x_141 = tree[x_140_save].rightIndex; - if ((x_141 == -1)) { - tree[x_140_save].rightIndex = 3; - const BST tint_symbol_7 = {15, -1, -1}; - tree[3] = tint_symbol_7; - x_156_phi = true; - break; - } else { - x_146 = tree[x_140_save].rightIndex; - x_129_phi = x_146; - { - x_129 = x_129_phi; - x_128_phi = x_129; - } - continue; - } - return; - } - return; - { - x_129 = x_129_phi; - x_128_phi = x_129; - } - } - if (x_156_phi) { - break; - } - } while (false); - int x_161_phi = 0; - bool x_189_phi = false; - 0u; - do { - x_161_phi = 0; - [loop] while (true) { - int x_187 = 0; - int x_179 = 0; - int x_162 = 0; - int x_162_phi = 0; - const int x_161 = x_161_phi; - x_189_phi = false; - if ((x_161 <= 4)) { - } else { - break; - } - const int x_168 = tree[x_161].data; - if ((7 <= x_168)) { - const int x_181_save = x_161; - const int x_182 = tree[x_181_save].leftIndex; - if ((x_182 == -1)) { - tree[x_181_save].leftIndex = 4; - const BST tint_symbol_8 = {7, -1, -1}; - tree[4] = tint_symbol_8; - x_189_phi = true; - break; - } else { - x_187 = tree[x_181_save].leftIndex; - x_162_phi = x_187; - { - x_162 = x_162_phi; - x_161_phi = x_162; - } - continue; - } - return; - } else { - const int x_173_save = x_161; - const int x_174 = tree[x_173_save].rightIndex; - if ((x_174 == -1)) { - tree[x_173_save].rightIndex = 4; - const BST tint_symbol_9 = {7, -1, -1}; - tree[4] = tint_symbol_9; - x_189_phi = true; - break; - } else { - x_179 = tree[x_173_save].rightIndex; - x_162_phi = x_179; - { - x_162 = x_162_phi; - x_161_phi = x_162; - } - continue; - } - return; - } - return; - { - x_162 = x_162_phi; - x_161_phi = x_162; - } - } - if (x_189_phi) { - break; - } - } while (false); - int x_194_phi = 0; - bool x_222_phi = false; - 0u; - do { - x_194_phi = 0; - [loop] while (true) { - int x_220 = 0; - int x_212 = 0; - int x_195 = 0; - int x_195_phi = 0; - const int x_194 = x_194_phi; - x_222_phi = false; - if ((x_194 <= 5)) { - } else { - break; - } - const int x_201 = tree[x_194].data; - if ((8 <= x_201)) { - const int x_214_save = x_194; - const int x_215 = tree[x_214_save].leftIndex; - if ((x_215 == -1)) { - tree[x_214_save].leftIndex = 5; - const BST tint_symbol_10 = {8, -1, -1}; - tree[5] = tint_symbol_10; - x_222_phi = true; - break; - } else { - x_220 = tree[x_214_save].leftIndex; - x_195_phi = x_220; - { - x_195 = x_195_phi; - x_194_phi = x_195; - } - continue; - } - return; - } else { - const int x_206_save = x_194; - const int x_207 = tree[x_206_save].rightIndex; - if ((x_207 == -1)) { - tree[x_206_save].rightIndex = 5; - const BST tint_symbol_11 = {8, -1, -1}; - tree[5] = tint_symbol_11; - x_222_phi = true; - break; - } else { - x_212 = tree[x_206_save].rightIndex; - x_195_phi = x_212; - { - x_195 = x_195_phi; - x_194_phi = x_195; - } - continue; - } - return; - } - return; - { - x_195 = x_195_phi; - x_194_phi = x_195; - } - } - if (x_222_phi) { - break; - } - } while (false); - int x_227_phi = 0; - bool x_255_phi = false; - 0u; - do { - x_227_phi = 0; - [loop] while (true) { - int x_253 = 0; - int x_245 = 0; - int x_228 = 0; - int x_228_phi = 0; - const int x_227 = x_227_phi; - x_255_phi = false; - if ((x_227 <= 6)) { - } else { - break; - } - const int x_234 = tree[x_227].data; - if ((2 <= x_234)) { - const int x_247_save = x_227; - const int x_248 = tree[x_247_save].leftIndex; - if ((x_248 == -1)) { - tree[x_247_save].leftIndex = 6; - const BST tint_symbol_12 = {2, -1, -1}; - tree[6] = tint_symbol_12; - x_255_phi = true; - break; - } else { - x_253 = tree[x_247_save].leftIndex; - x_228_phi = x_253; - { - x_228 = x_228_phi; - x_227_phi = x_228; - } - continue; - } - return; - } else { - const int x_239_save = x_227; - const int x_240 = tree[x_239_save].rightIndex; - if ((x_240 == -1)) { - tree[x_239_save].rightIndex = 6; - const BST tint_symbol_13 = {2, -1, -1}; - tree[6] = tint_symbol_13; - x_255_phi = true; - break; - } else { - x_245 = tree[x_239_save].rightIndex; - x_228_phi = x_245; - { - x_228 = x_228_phi; - x_227_phi = x_228; - } - continue; - } - return; - } - return; - { - x_228 = x_228_phi; - x_227_phi = x_228; - } - } - if (x_255_phi) { - break; - } - } while (false); - int x_260_phi = 0; - bool x_288_phi = false; - 0u; - do { - x_260_phi = 0; - [loop] while (true) { - int x_286 = 0; - int x_278 = 0; - int x_261 = 0; - int x_261_phi = 0; - const int x_260 = x_260_phi; - x_288_phi = false; - if ((x_260 <= 7)) { - } else { - break; - } - const int x_267 = tree[x_260].data; - if ((6 <= x_267)) { - const int x_280_save = x_260; - const int x_281 = tree[x_280_save].leftIndex; - if ((x_281 == -1)) { - tree[x_280_save].leftIndex = 7; - const BST tint_symbol_14 = {6, -1, -1}; - tree[7] = tint_symbol_14; - x_288_phi = true; - break; - } else { - x_286 = tree[x_280_save].leftIndex; - x_261_phi = x_286; - { - x_261 = x_261_phi; - x_260_phi = x_261; - } - continue; - } - return; - } else { - const int x_272_save = x_260; - const int x_273 = tree[x_272_save].rightIndex; - if ((x_273 == -1)) { - tree[x_272_save].rightIndex = 7; - const BST tint_symbol_15 = {6, -1, -1}; - tree[7] = tint_symbol_15; - x_288_phi = true; - break; - } else { - x_278 = tree[x_272_save].rightIndex; - x_261_phi = x_278; - { - x_261 = x_261_phi; - x_260_phi = x_261; - } - continue; - } - return; - } - return; - { - x_261 = x_261_phi; - x_260_phi = x_261; - } - } - if (x_288_phi) { - break; - } - } while (false); - int x_293_phi = 0; - bool x_321_phi = false; - 0u; - do { - x_293_phi = 0; - [loop] while (true) { - int x_319 = 0; - int x_311 = 0; - int x_294 = 0; - int x_294_phi = 0; - const int x_293 = x_293_phi; - x_321_phi = false; - if ((x_293 <= 8)) { - } else { - break; - } - const int x_300 = tree[x_293].data; - if ((17 <= x_300)) { - const int x_313_save = x_293; - const int x_314 = tree[x_313_save].leftIndex; - if ((x_314 == -1)) { - tree[x_313_save].leftIndex = 8; - const BST tint_symbol_16 = {17, -1, -1}; - tree[8] = tint_symbol_16; - x_321_phi = true; - break; - } else { - x_319 = tree[x_313_save].leftIndex; - x_294_phi = x_319; - { - x_294 = x_294_phi; - x_293_phi = x_294; - } - continue; - } - return; - } else { - const int x_305_save = x_293; - const int x_306 = tree[x_305_save].rightIndex; - if ((x_306 == -1)) { - tree[x_305_save].rightIndex = 8; - const BST tint_symbol_17 = {17, -1, -1}; - tree[8] = tint_symbol_17; - x_321_phi = true; - break; - } else { - x_311 = tree[x_305_save].rightIndex; - x_294_phi = x_311; - { - x_294 = x_294_phi; - x_293_phi = x_294; - } - continue; - } - return; - } - return; - { - x_294 = x_294_phi; - x_293_phi = x_294; - } - } - if (x_321_phi) { - break; - } - } while (false); - int x_326_phi = 0; - bool x_354_phi = false; - 0u; - do { - x_326_phi = 0; - [loop] while (true) { - int x_352 = 0; - int x_344 = 0; - int x_327 = 0; - int x_327_phi = 0; - const int x_326 = x_326_phi; - x_354_phi = false; - if ((x_326 <= 9)) { - } else { - break; - } - const int x_333 = tree[x_326].data; - if ((13 <= x_333)) { - const int x_346_save = x_326; - const int x_347 = tree[x_346_save].leftIndex; - if ((x_347 == -1)) { - tree[x_346_save].leftIndex = 9; - const BST tint_symbol_18 = {13, -1, -1}; - tree[9] = tint_symbol_18; - x_354_phi = true; - break; - } else { - x_352 = tree[x_346_save].leftIndex; - x_327_phi = x_352; - { - x_327 = x_327_phi; - x_326_phi = x_327; - } - continue; - } - return; - } else { - const int x_338_save = x_326; - const int x_339 = tree[x_338_save].rightIndex; - if ((x_339 == -1)) { - tree[x_338_save].rightIndex = 9; - const BST tint_symbol_19 = {13, -1, -1}; - tree[9] = tint_symbol_19; - x_354_phi = true; - break; - } else { - x_344 = tree[x_338_save].rightIndex; - x_327_phi = x_344; - { - x_327 = x_327_phi; - x_326_phi = x_327; - } - continue; - } - return; - } - return; - { - x_327 = x_327_phi; - x_326_phi = x_327; - } - } - if (x_354_phi) { - break; - } - } while (false); - x_357_phi = 0; - x_360_phi = 0; - x_362_phi = 0; - [loop] while (true) { - int x_392 = 0; - int x_402 = 0; - int x_407 = 0; - int x_363 = 0; - int x_358_phi = 0; - int x_361_phi = 0; - const int x_357 = x_357_phi; - x_360 = x_360_phi; - const int x_362 = x_362_phi; - const int x_365 = (6 - 15); - if ((x_362 < 20)) { - } else { - break; - } - int x_374_phi = 0; - int x_392_phi = 0; - bool x_393_phi = false; - 0u; - do { - x_374_phi = 0; - [loop] while (true) { - const int x_374 = x_374_phi; - x_392_phi = x_357; - x_393_phi = false; - if ((x_374 != -1)) { - } else { - break; - } - const BST x_381 = tree[x_374]; - const int x_382 = x_381.data; - const int x_383 = x_381.leftIndex; - const int x_385 = x_381.rightIndex; - if ((x_382 == x_362)) { - x_392_phi = x_362; - x_393_phi = true; - break; - } - const float x_389 = x_GLF_color[((3u <= 3u) ? 3u : 3u)]; - { - x_374_phi = (!((x_362 <= x_382)) ? x_385 : x_383); - } - } - x_392 = x_392_phi; - const bool x_393 = x_393_phi; - x_358_phi = x_392; - if (x_393) { - break; - } - x_358_phi = -1; - } while (false); - int x_358 = 0; - int x_401 = 0; - int x_406 = 0; - int x_402_phi = 0; - int x_407_phi = 0; - x_358 = x_358_phi; - switch(x_362) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - x_402_phi = x_360; - if ((x_358 == asint(x_362))) { - x_401 = asint((x_360 + asint(1))); - x_402_phi = x_401; - } - x_402 = x_402_phi; - x_361_phi = x_402; - break; - } - default: { - x_407_phi = x_360; - if ((x_358 == asint(-1))) { - x_406 = asint((x_360 + asint(1))); - x_407_phi = x_406; - } - x_407 = x_407_phi; - x_361_phi = x_407; - break; - } - } - const int x_361 = x_361_phi; - { - x_363 = (x_362 + 1); - x_357_phi = x_358; - x_360_phi = x_361; - x_362_phi = x_363; - } - } - if ((x_360 == asint(20))) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_20 = {x_GLF_color}; - return tint_symbol_20; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000001F9FB4F5860(82,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F9FB4F5860(22,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x000001F9FB4F5860(148,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F9FB4F5860(214,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F9FB4F5860(280,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F9FB4F5860(346,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F9FB4F5860(412,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F9FB4F5860(478,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F9FB4F5860(544,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F9FB4F5860(610,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F9FB4F5860(664,7-19): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl index c05ac33f45..8552766080 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl @@ -621,7 +621,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cb62fbcc53 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.fxc.hlsl @@ -0,0 +1,711 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + int x_360 = 0; + int x_62_phi = 0; + bool x_90_phi = false; + int x_357_phi = 0; + int x_360_phi = 0; + int x_362_phi = 0; + const BST tint_symbol_1 = {9, -1, -1}; + tree[0] = tint_symbol_1; + 0u; + do { + x_62_phi = 0; + [loop] while (true) { + int x_88 = 0; + int x_80 = 0; + int x_63 = 0; + int x_63_phi = 0; + const int x_62 = x_62_phi; + x_90_phi = false; + if ((x_62 <= 1)) { + } else { + break; + } + const int x_69 = tree[x_62].data; + if ((5 <= x_69)) { + const int x_82_save = x_62; + const int x_83 = tree[x_82_save].leftIndex; + if ((x_83 == -1)) { + tree[x_82_save].leftIndex = 1; + const BST tint_symbol_2 = {5, -1, -1}; + tree[1] = tint_symbol_2; + x_90_phi = true; + break; + } else { + x_88 = tree[x_82_save].leftIndex; + x_63_phi = x_88; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + } else { + const int x_74_save = x_62; + const int x_75 = tree[x_74_save].rightIndex; + if ((x_75 == -1)) { + tree[x_74_save].rightIndex = 1; + const BST tint_symbol_3 = {5, -1, -1}; + tree[1] = tint_symbol_3; + x_90_phi = true; + break; + } else { + x_80 = tree[x_74_save].rightIndex; + x_63_phi = x_80; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + } + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + } + if (x_90_phi) { + break; + } + } while (false); + int x_95_phi = 0; + bool x_123_phi = false; + 0u; + do { + x_95_phi = 0; + [loop] while (true) { + int x_121 = 0; + int x_113 = 0; + int x_96 = 0; + int x_96_phi = 0; + const int x_95 = x_95_phi; + x_123_phi = false; + if ((x_95 <= 2)) { + } else { + break; + } + const int x_102 = tree[x_95].data; + if ((12 <= x_102)) { + const int x_115_save = x_95; + const int x_116 = tree[x_115_save].leftIndex; + if ((x_116 == -1)) { + tree[x_115_save].leftIndex = 2; + const BST tint_symbol_4 = {12, -1, -1}; + tree[2] = tint_symbol_4; + x_123_phi = true; + break; + } else { + x_121 = tree[x_115_save].leftIndex; + x_96_phi = x_121; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + } else { + const int x_107_save = x_95; + const int x_108 = tree[x_107_save].rightIndex; + if ((x_108 == -1)) { + tree[x_107_save].rightIndex = 2; + const BST tint_symbol_5 = {12, -1, -1}; + tree[2] = tint_symbol_5; + x_123_phi = true; + break; + } else { + x_113 = tree[x_107_save].rightIndex; + x_96_phi = x_113; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + } + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + } + if (x_123_phi) { + break; + } + } while (false); + int x_128_phi = 0; + bool x_156_phi = false; + 0u; + do { + x_128_phi = 0; + [loop] while (true) { + int x_154 = 0; + int x_146 = 0; + int x_129 = 0; + int x_129_phi = 0; + const int x_128 = x_128_phi; + x_156_phi = false; + if ((x_128 <= 3)) { + } else { + break; + } + const int x_135 = tree[x_128].data; + if ((15 <= x_135)) { + const int x_148_save = x_128; + const int x_149 = tree[x_148_save].leftIndex; + if ((x_149 == -1)) { + tree[x_148_save].leftIndex = 3; + const BST tint_symbol_6 = {15, -1, -1}; + tree[3] = tint_symbol_6; + x_156_phi = true; + break; + } else { + x_154 = tree[x_148_save].leftIndex; + x_129_phi = x_154; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + } else { + const int x_140_save = x_128; + const int x_141 = tree[x_140_save].rightIndex; + if ((x_141 == -1)) { + tree[x_140_save].rightIndex = 3; + const BST tint_symbol_7 = {15, -1, -1}; + tree[3] = tint_symbol_7; + x_156_phi = true; + break; + } else { + x_146 = tree[x_140_save].rightIndex; + x_129_phi = x_146; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + } + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + } + if (x_156_phi) { + break; + } + } while (false); + int x_161_phi = 0; + bool x_189_phi = false; + 0u; + do { + x_161_phi = 0; + [loop] while (true) { + int x_187 = 0; + int x_179 = 0; + int x_162 = 0; + int x_162_phi = 0; + const int x_161 = x_161_phi; + x_189_phi = false; + if ((x_161 <= 4)) { + } else { + break; + } + const int x_168 = tree[x_161].data; + if ((7 <= x_168)) { + const int x_181_save = x_161; + const int x_182 = tree[x_181_save].leftIndex; + if ((x_182 == -1)) { + tree[x_181_save].leftIndex = 4; + const BST tint_symbol_8 = {7, -1, -1}; + tree[4] = tint_symbol_8; + x_189_phi = true; + break; + } else { + x_187 = tree[x_181_save].leftIndex; + x_162_phi = x_187; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + } else { + const int x_173_save = x_161; + const int x_174 = tree[x_173_save].rightIndex; + if ((x_174 == -1)) { + tree[x_173_save].rightIndex = 4; + const BST tint_symbol_9 = {7, -1, -1}; + tree[4] = tint_symbol_9; + x_189_phi = true; + break; + } else { + x_179 = tree[x_173_save].rightIndex; + x_162_phi = x_179; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + } + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + } + if (x_189_phi) { + break; + } + } while (false); + int x_194_phi = 0; + bool x_222_phi = false; + 0u; + do { + x_194_phi = 0; + [loop] while (true) { + int x_220 = 0; + int x_212 = 0; + int x_195 = 0; + int x_195_phi = 0; + const int x_194 = x_194_phi; + x_222_phi = false; + if ((x_194 <= 5)) { + } else { + break; + } + const int x_201 = tree[x_194].data; + if ((8 <= x_201)) { + const int x_214_save = x_194; + const int x_215 = tree[x_214_save].leftIndex; + if ((x_215 == -1)) { + tree[x_214_save].leftIndex = 5; + const BST tint_symbol_10 = {8, -1, -1}; + tree[5] = tint_symbol_10; + x_222_phi = true; + break; + } else { + x_220 = tree[x_214_save].leftIndex; + x_195_phi = x_220; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + } else { + const int x_206_save = x_194; + const int x_207 = tree[x_206_save].rightIndex; + if ((x_207 == -1)) { + tree[x_206_save].rightIndex = 5; + const BST tint_symbol_11 = {8, -1, -1}; + tree[5] = tint_symbol_11; + x_222_phi = true; + break; + } else { + x_212 = tree[x_206_save].rightIndex; + x_195_phi = x_212; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + } + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + } + if (x_222_phi) { + break; + } + } while (false); + int x_227_phi = 0; + bool x_255_phi = false; + 0u; + do { + x_227_phi = 0; + [loop] while (true) { + int x_253 = 0; + int x_245 = 0; + int x_228 = 0; + int x_228_phi = 0; + const int x_227 = x_227_phi; + x_255_phi = false; + if ((x_227 <= 6)) { + } else { + break; + } + const int x_234 = tree[x_227].data; + if ((2 <= x_234)) { + const int x_247_save = x_227; + const int x_248 = tree[x_247_save].leftIndex; + if ((x_248 == -1)) { + tree[x_247_save].leftIndex = 6; + const BST tint_symbol_12 = {2, -1, -1}; + tree[6] = tint_symbol_12; + x_255_phi = true; + break; + } else { + x_253 = tree[x_247_save].leftIndex; + x_228_phi = x_253; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + } else { + const int x_239_save = x_227; + const int x_240 = tree[x_239_save].rightIndex; + if ((x_240 == -1)) { + tree[x_239_save].rightIndex = 6; + const BST tint_symbol_13 = {2, -1, -1}; + tree[6] = tint_symbol_13; + x_255_phi = true; + break; + } else { + x_245 = tree[x_239_save].rightIndex; + x_228_phi = x_245; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + } + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + } + if (x_255_phi) { + break; + } + } while (false); + int x_260_phi = 0; + bool x_288_phi = false; + 0u; + do { + x_260_phi = 0; + [loop] while (true) { + int x_286 = 0; + int x_278 = 0; + int x_261 = 0; + int x_261_phi = 0; + const int x_260 = x_260_phi; + x_288_phi = false; + if ((x_260 <= 7)) { + } else { + break; + } + const int x_267 = tree[x_260].data; + if ((6 <= x_267)) { + const int x_280_save = x_260; + const int x_281 = tree[x_280_save].leftIndex; + if ((x_281 == -1)) { + tree[x_280_save].leftIndex = 7; + const BST tint_symbol_14 = {6, -1, -1}; + tree[7] = tint_symbol_14; + x_288_phi = true; + break; + } else { + x_286 = tree[x_280_save].leftIndex; + x_261_phi = x_286; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + } else { + const int x_272_save = x_260; + const int x_273 = tree[x_272_save].rightIndex; + if ((x_273 == -1)) { + tree[x_272_save].rightIndex = 7; + const BST tint_symbol_15 = {6, -1, -1}; + tree[7] = tint_symbol_15; + x_288_phi = true; + break; + } else { + x_278 = tree[x_272_save].rightIndex; + x_261_phi = x_278; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + } + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + } + if (x_288_phi) { + break; + } + } while (false); + int x_293_phi = 0; + bool x_321_phi = false; + 0u; + do { + x_293_phi = 0; + [loop] while (true) { + int x_319 = 0; + int x_311 = 0; + int x_294 = 0; + int x_294_phi = 0; + const int x_293 = x_293_phi; + x_321_phi = false; + if ((x_293 <= 8)) { + } else { + break; + } + const int x_300 = tree[x_293].data; + if ((17 <= x_300)) { + const int x_313_save = x_293; + const int x_314 = tree[x_313_save].leftIndex; + if ((x_314 == -1)) { + tree[x_313_save].leftIndex = 8; + const BST tint_symbol_16 = {17, -1, -1}; + tree[8] = tint_symbol_16; + x_321_phi = true; + break; + } else { + x_319 = tree[x_313_save].leftIndex; + x_294_phi = x_319; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + } else { + const int x_305_save = x_293; + const int x_306 = tree[x_305_save].rightIndex; + if ((x_306 == -1)) { + tree[x_305_save].rightIndex = 8; + const BST tint_symbol_17 = {17, -1, -1}; + tree[8] = tint_symbol_17; + x_321_phi = true; + break; + } else { + x_311 = tree[x_305_save].rightIndex; + x_294_phi = x_311; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + } + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + } + if (x_321_phi) { + break; + } + } while (false); + int x_326_phi = 0; + bool x_354_phi = false; + 0u; + do { + x_326_phi = 0; + [loop] while (true) { + int x_352 = 0; + int x_344 = 0; + int x_327 = 0; + int x_327_phi = 0; + const int x_326 = x_326_phi; + x_354_phi = false; + if ((x_326 <= 9)) { + } else { + break; + } + const int x_333 = tree[x_326].data; + if ((13 <= x_333)) { + const int x_346_save = x_326; + const int x_347 = tree[x_346_save].leftIndex; + if ((x_347 == -1)) { + tree[x_346_save].leftIndex = 9; + const BST tint_symbol_18 = {13, -1, -1}; + tree[9] = tint_symbol_18; + x_354_phi = true; + break; + } else { + x_352 = tree[x_346_save].leftIndex; + x_327_phi = x_352; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + } else { + const int x_338_save = x_326; + const int x_339 = tree[x_338_save].rightIndex; + if ((x_339 == -1)) { + tree[x_338_save].rightIndex = 9; + const BST tint_symbol_19 = {13, -1, -1}; + tree[9] = tint_symbol_19; + x_354_phi = true; + break; + } else { + x_344 = tree[x_338_save].rightIndex; + x_327_phi = x_344; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + } + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + } + if (x_354_phi) { + break; + } + } while (false); + x_357_phi = 0; + x_360_phi = 0; + x_362_phi = 0; + [loop] while (true) { + int x_392 = 0; + int x_402 = 0; + int x_407 = 0; + int x_363 = 0; + int x_358_phi = 0; + int x_361_phi = 0; + const int x_357 = x_357_phi; + x_360 = x_360_phi; + const int x_362 = x_362_phi; + const int x_365 = (6 - 15); + if ((x_362 < 20)) { + } else { + break; + } + int x_374_phi = 0; + int x_392_phi = 0; + bool x_393_phi = false; + 0u; + do { + x_374_phi = 0; + [loop] while (true) { + const int x_374 = x_374_phi; + x_392_phi = x_357; + x_393_phi = false; + if ((x_374 != -1)) { + } else { + break; + } + const BST x_381 = tree[x_374]; + const int x_382 = x_381.data; + const int x_383 = x_381.leftIndex; + const int x_385 = x_381.rightIndex; + if ((x_382 == x_362)) { + x_392_phi = x_362; + x_393_phi = true; + break; + } + const float x_389 = x_GLF_color[((3u <= 3u) ? 3u : 3u)]; + { + x_374_phi = (!((x_362 <= x_382)) ? x_385 : x_383); + } + } + x_392 = x_392_phi; + const bool x_393 = x_393_phi; + x_358_phi = x_392; + if (x_393) { + break; + } + x_358_phi = -1; + } while (false); + int x_358 = 0; + int x_401 = 0; + int x_406 = 0; + int x_402_phi = 0; + int x_407_phi = 0; + x_358 = x_358_phi; + switch(x_362) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_402_phi = x_360; + if ((x_358 == asint(x_362))) { + x_401 = asint((x_360 + asint(1))); + x_402_phi = x_401; + } + x_402 = x_402_phi; + x_361_phi = x_402; + break; + } + default: { + x_407_phi = x_360; + if ((x_358 == asint(-1))) { + x_406 = asint((x_360 + asint(1))); + x_407_phi = x_406; + } + x_407 = x_407_phi; + x_361_phi = x_407; + break; + } + } + const int x_361 = x_361_phi; + { + x_363 = (x_362 + 1); + x_357_phi = x_358; + x_360_phi = x_361; + x_362_phi = x_363; + } + } + if ((x_360 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_20 = {x_GLF_color}; + return tint_symbol_20; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl deleted file mode 100644 index bbb2d87a38..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl +++ /dev/null @@ -1,859 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:46:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:60:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:62:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:105:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:119:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:121:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:164:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:178:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:180:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:223:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:237:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:239:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:282:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:296:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:298:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:341:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:355:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:357:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:400:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:414:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:416:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:459:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:473:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:475:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:518:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:532:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:534:9 warning: code is unreachable - return; - ^^^^^^ - -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - BST tree[10] = (BST[10])0; - int x_360 = 0; - int x_62_phi = 0; - bool x_90_phi = false; - int x_357_phi = 0; - int x_360_phi = 0; - int x_362_phi = 0; - const BST tint_symbol_1 = {9, -1, -1}; - tree[0] = tint_symbol_1; - 0u; - do { - x_62_phi = 0; - [loop] while (true) { - int x_88 = 0; - int x_80 = 0; - int x_63 = 0; - int x_63_phi = 0; - const int x_62 = x_62_phi; - x_90_phi = false; - if ((x_62 <= 1)) { - } else { - break; - } - const int x_69 = tree[x_62].data; - if ((5 <= x_69)) { - const int x_82_save = x_62; - const int x_83 = tree[x_82_save].leftIndex; - if ((x_83 == -1)) { - tree[x_82_save].leftIndex = 1; - const BST tint_symbol_2 = {5, -1, -1}; - tree[1] = tint_symbol_2; - x_90_phi = true; - break; - } else { - x_88 = tree[x_82_save].leftIndex; - x_63_phi = x_88; - { - x_63 = x_63_phi; - x_62_phi = x_63; - } - continue; - } - return; - } else { - const int x_74_save = x_62; - const int x_75 = tree[x_74_save].rightIndex; - if ((x_75 == -1)) { - tree[x_74_save].rightIndex = 1; - const BST tint_symbol_3 = {5, -1, -1}; - tree[1] = tint_symbol_3; - x_90_phi = true; - break; - } else { - x_80 = tree[x_74_save].rightIndex; - x_63_phi = x_80; - { - x_63 = x_63_phi; - x_62_phi = x_63; - } - continue; - } - return; - } - return; - { - x_63 = x_63_phi; - x_62_phi = x_63; - } - } - if (x_90_phi) { - break; - } - } while (false); - int x_95_phi = 0; - bool x_123_phi = false; - 0u; - do { - x_95_phi = 0; - [loop] while (true) { - int x_121 = 0; - int x_113 = 0; - int x_96 = 0; - int x_96_phi = 0; - const int x_95 = x_95_phi; - x_123_phi = false; - if ((x_95 <= 2)) { - } else { - break; - } - const int x_102 = tree[x_95].data; - if ((12 <= x_102)) { - const int x_115_save = x_95; - const int x_116 = tree[x_115_save].leftIndex; - if ((x_116 == -1)) { - tree[x_115_save].leftIndex = 2; - const BST tint_symbol_4 = {12, -1, -1}; - tree[2] = tint_symbol_4; - x_123_phi = true; - break; - } else { - x_121 = tree[x_115_save].leftIndex; - x_96_phi = x_121; - { - x_96 = x_96_phi; - x_95_phi = x_96; - } - continue; - } - return; - } else { - const int x_107_save = x_95; - const int x_108 = tree[x_107_save].rightIndex; - if ((x_108 == -1)) { - tree[x_107_save].rightIndex = 2; - const BST tint_symbol_5 = {12, -1, -1}; - tree[2] = tint_symbol_5; - x_123_phi = true; - break; - } else { - x_113 = tree[x_107_save].rightIndex; - x_96_phi = x_113; - { - x_96 = x_96_phi; - x_95_phi = x_96; - } - continue; - } - return; - } - return; - { - x_96 = x_96_phi; - x_95_phi = x_96; - } - } - if (x_123_phi) { - break; - } - } while (false); - int x_128_phi = 0; - bool x_156_phi = false; - 0u; - do { - x_128_phi = 0; - [loop] while (true) { - int x_154 = 0; - int x_146 = 0; - int x_129 = 0; - int x_129_phi = 0; - const int x_128 = x_128_phi; - x_156_phi = false; - if ((x_128 <= 3)) { - } else { - break; - } - const int x_135 = tree[x_128].data; - if ((15 <= x_135)) { - const int x_148_save = x_128; - const int x_149 = tree[x_148_save].leftIndex; - if ((x_149 == -1)) { - tree[x_148_save].leftIndex = 3; - const BST tint_symbol_6 = {15, -1, -1}; - tree[3] = tint_symbol_6; - x_156_phi = true; - break; - } else { - x_154 = tree[x_148_save].leftIndex; - x_129_phi = x_154; - { - x_129 = x_129_phi; - x_128_phi = x_129; - } - continue; - } - return; - } else { - const int x_140_save = x_128; - const int x_141 = tree[x_140_save].rightIndex; - if ((x_141 == -1)) { - tree[x_140_save].rightIndex = 3; - const BST tint_symbol_7 = {15, -1, -1}; - tree[3] = tint_symbol_7; - x_156_phi = true; - break; - } else { - x_146 = tree[x_140_save].rightIndex; - x_129_phi = x_146; - { - x_129 = x_129_phi; - x_128_phi = x_129; - } - continue; - } - return; - } - return; - { - x_129 = x_129_phi; - x_128_phi = x_129; - } - } - if (x_156_phi) { - break; - } - } while (false); - int x_161_phi = 0; - bool x_189_phi = false; - 0u; - do { - x_161_phi = 0; - [loop] while (true) { - int x_187 = 0; - int x_179 = 0; - int x_162 = 0; - int x_162_phi = 0; - const int x_161 = x_161_phi; - x_189_phi = false; - if ((x_161 <= 4)) { - } else { - break; - } - const int x_168 = tree[x_161].data; - if ((7 <= x_168)) { - const int x_181_save = x_161; - const int x_182 = tree[x_181_save].leftIndex; - if ((x_182 == -1)) { - tree[x_181_save].leftIndex = 4; - const BST tint_symbol_8 = {7, -1, -1}; - tree[4] = tint_symbol_8; - x_189_phi = true; - break; - } else { - x_187 = tree[x_181_save].leftIndex; - x_162_phi = x_187; - { - x_162 = x_162_phi; - x_161_phi = x_162; - } - continue; - } - return; - } else { - const int x_173_save = x_161; - const int x_174 = tree[x_173_save].rightIndex; - if ((x_174 == -1)) { - tree[x_173_save].rightIndex = 4; - const BST tint_symbol_9 = {7, -1, -1}; - tree[4] = tint_symbol_9; - x_189_phi = true; - break; - } else { - x_179 = tree[x_173_save].rightIndex; - x_162_phi = x_179; - { - x_162 = x_162_phi; - x_161_phi = x_162; - } - continue; - } - return; - } - return; - { - x_162 = x_162_phi; - x_161_phi = x_162; - } - } - if (x_189_phi) { - break; - } - } while (false); - int x_194_phi = 0; - bool x_222_phi = false; - 0u; - do { - x_194_phi = 0; - [loop] while (true) { - int x_220 = 0; - int x_212 = 0; - int x_195 = 0; - int x_195_phi = 0; - const int x_194 = x_194_phi; - x_222_phi = false; - if ((x_194 <= 5)) { - } else { - break; - } - const int x_201 = tree[x_194].data; - if ((8 <= x_201)) { - const int x_214_save = x_194; - const int x_215 = tree[x_214_save].leftIndex; - if ((x_215 == -1)) { - tree[x_214_save].leftIndex = 5; - const BST tint_symbol_10 = {8, -1, -1}; - tree[5] = tint_symbol_10; - x_222_phi = true; - break; - } else { - x_220 = tree[x_214_save].leftIndex; - x_195_phi = x_220; - { - x_195 = x_195_phi; - x_194_phi = x_195; - } - continue; - } - return; - } else { - const int x_206_save = x_194; - const int x_207 = tree[x_206_save].rightIndex; - if ((x_207 == -1)) { - tree[x_206_save].rightIndex = 5; - const BST tint_symbol_11 = {8, -1, -1}; - tree[5] = tint_symbol_11; - x_222_phi = true; - break; - } else { - x_212 = tree[x_206_save].rightIndex; - x_195_phi = x_212; - { - x_195 = x_195_phi; - x_194_phi = x_195; - } - continue; - } - return; - } - return; - { - x_195 = x_195_phi; - x_194_phi = x_195; - } - } - if (x_222_phi) { - break; - } - } while (false); - int x_227_phi = 0; - bool x_255_phi = false; - 0u; - do { - x_227_phi = 0; - [loop] while (true) { - int x_253 = 0; - int x_245 = 0; - int x_228 = 0; - int x_228_phi = 0; - const int x_227 = x_227_phi; - x_255_phi = false; - if ((x_227 <= 6)) { - } else { - break; - } - const int x_234 = tree[x_227].data; - if ((2 <= x_234)) { - const int x_247_save = x_227; - const int x_248 = tree[x_247_save].leftIndex; - if ((x_248 == -1)) { - tree[x_247_save].leftIndex = 6; - const BST tint_symbol_12 = {2, -1, -1}; - tree[6] = tint_symbol_12; - x_255_phi = true; - break; - } else { - x_253 = tree[x_247_save].leftIndex; - x_228_phi = x_253; - { - x_228 = x_228_phi; - x_227_phi = x_228; - } - continue; - } - return; - } else { - const int x_239_save = x_227; - const int x_240 = tree[x_239_save].rightIndex; - if ((x_240 == -1)) { - tree[x_239_save].rightIndex = 6; - const BST tint_symbol_13 = {2, -1, -1}; - tree[6] = tint_symbol_13; - x_255_phi = true; - break; - } else { - x_245 = tree[x_239_save].rightIndex; - x_228_phi = x_245; - { - x_228 = x_228_phi; - x_227_phi = x_228; - } - continue; - } - return; - } - return; - { - x_228 = x_228_phi; - x_227_phi = x_228; - } - } - if (x_255_phi) { - break; - } - } while (false); - int x_260_phi = 0; - bool x_288_phi = false; - 0u; - do { - x_260_phi = 0; - [loop] while (true) { - int x_286 = 0; - int x_278 = 0; - int x_261 = 0; - int x_261_phi = 0; - const int x_260 = x_260_phi; - x_288_phi = false; - if ((x_260 <= 7)) { - } else { - break; - } - const int x_267 = tree[x_260].data; - if ((6 <= x_267)) { - const int x_280_save = x_260; - const int x_281 = tree[x_280_save].leftIndex; - if ((x_281 == -1)) { - tree[x_280_save].leftIndex = 7; - const BST tint_symbol_14 = {6, -1, -1}; - tree[7] = tint_symbol_14; - x_288_phi = true; - break; - } else { - x_286 = tree[x_280_save].leftIndex; - x_261_phi = x_286; - { - x_261 = x_261_phi; - x_260_phi = x_261; - } - continue; - } - return; - } else { - const int x_272_save = x_260; - const int x_273 = tree[x_272_save].rightIndex; - if ((x_273 == -1)) { - tree[x_272_save].rightIndex = 7; - const BST tint_symbol_15 = {6, -1, -1}; - tree[7] = tint_symbol_15; - x_288_phi = true; - break; - } else { - x_278 = tree[x_272_save].rightIndex; - x_261_phi = x_278; - { - x_261 = x_261_phi; - x_260_phi = x_261; - } - continue; - } - return; - } - return; - { - x_261 = x_261_phi; - x_260_phi = x_261; - } - } - if (x_288_phi) { - break; - } - } while (false); - int x_293_phi = 0; - bool x_321_phi = false; - 0u; - do { - x_293_phi = 0; - [loop] while (true) { - int x_319 = 0; - int x_311 = 0; - int x_294 = 0; - int x_294_phi = 0; - const int x_293 = x_293_phi; - x_321_phi = false; - if ((x_293 <= 8)) { - } else { - break; - } - const int x_300 = tree[x_293].data; - if ((17 <= x_300)) { - const int x_313_save = x_293; - const int x_314 = tree[x_313_save].leftIndex; - if ((x_314 == -1)) { - tree[x_313_save].leftIndex = 8; - const BST tint_symbol_16 = {17, -1, -1}; - tree[8] = tint_symbol_16; - x_321_phi = true; - break; - } else { - x_319 = tree[x_313_save].leftIndex; - x_294_phi = x_319; - { - x_294 = x_294_phi; - x_293_phi = x_294; - } - continue; - } - return; - } else { - const int x_305_save = x_293; - const int x_306 = tree[x_305_save].rightIndex; - if ((x_306 == -1)) { - tree[x_305_save].rightIndex = 8; - const BST tint_symbol_17 = {17, -1, -1}; - tree[8] = tint_symbol_17; - x_321_phi = true; - break; - } else { - x_311 = tree[x_305_save].rightIndex; - x_294_phi = x_311; - { - x_294 = x_294_phi; - x_293_phi = x_294; - } - continue; - } - return; - } - return; - { - x_294 = x_294_phi; - x_293_phi = x_294; - } - } - if (x_321_phi) { - break; - } - } while (false); - int x_326_phi = 0; - bool x_354_phi = false; - 0u; - do { - x_326_phi = 0; - [loop] while (true) { - int x_352 = 0; - int x_344 = 0; - int x_327 = 0; - int x_327_phi = 0; - const int x_326 = x_326_phi; - x_354_phi = false; - if ((x_326 <= 9)) { - } else { - break; - } - const int x_333 = tree[x_326].data; - if ((13 <= x_333)) { - const int x_346_save = x_326; - const int x_347 = tree[x_346_save].leftIndex; - if ((x_347 == -1)) { - tree[x_346_save].leftIndex = 9; - const BST tint_symbol_18 = {13, -1, -1}; - tree[9] = tint_symbol_18; - x_354_phi = true; - break; - } else { - x_352 = tree[x_346_save].leftIndex; - x_327_phi = x_352; - { - x_327 = x_327_phi; - x_326_phi = x_327; - } - continue; - } - return; - } else { - const int x_338_save = x_326; - const int x_339 = tree[x_338_save].rightIndex; - if ((x_339 == -1)) { - tree[x_338_save].rightIndex = 9; - const BST tint_symbol_19 = {13, -1, -1}; - tree[9] = tint_symbol_19; - x_354_phi = true; - break; - } else { - x_344 = tree[x_338_save].rightIndex; - x_327_phi = x_344; - { - x_327 = x_327_phi; - x_326_phi = x_327; - } - continue; - } - return; - } - return; - { - x_327 = x_327_phi; - x_326_phi = x_327; - } - } - if (x_354_phi) { - break; - } - } while (false); - x_357_phi = 0; - x_360_phi = 0; - x_362_phi = 0; - [loop] while (true) { - int x_392 = 0; - int x_402 = 0; - int x_407 = 0; - int x_363 = 0; - int x_358_phi = 0; - int x_361_phi = 0; - const int x_357 = x_357_phi; - x_360 = x_360_phi; - const int x_362 = x_362_phi; - const int x_365 = (6 - 15); - if ((x_362 < 20)) { - } else { - break; - } - int x_374_phi = 0; - int x_392_phi = 0; - bool x_393_phi = false; - 0u; - do { - x_374_phi = 0; - [loop] while (true) { - const int x_374 = x_374_phi; - x_392_phi = x_357; - x_393_phi = false; - if ((x_374 != -1)) { - } else { - break; - } - const BST x_381 = tree[x_374]; - const int x_382 = x_381.data; - const int x_383 = x_381.leftIndex; - const int x_385 = x_381.rightIndex; - if ((x_382 == x_362)) { - x_392_phi = x_362; - x_393_phi = true; - break; - } - const float x_389 = x_GLF_color[((3u <= 3u) ? 3u : 3u)]; - { - x_374_phi = (!((x_362 <= x_382)) ? x_385 : x_383); - } - } - x_392 = x_392_phi; - const bool x_393 = x_393_phi; - x_358_phi = x_392; - if (x_393) { - break; - } - x_358_phi = -1; - } while (false); - int x_358 = 0; - int x_401 = 0; - int x_406 = 0; - int x_402_phi = 0; - int x_407_phi = 0; - x_358 = x_358_phi; - switch(x_362) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - x_402_phi = x_360; - if ((x_358 == asint(x_362))) { - x_401 = asint((x_360 + asint(1))); - x_402_phi = x_401; - } - x_402 = x_402_phi; - x_361_phi = x_402; - break; - } - default: { - x_407_phi = x_360; - if ((x_358 == asint(-1))) { - x_406 = asint((x_360 + asint(1))); - x_407_phi = x_406; - } - x_407 = x_407_phi; - x_361_phi = x_407; - break; - } - } - const int x_361 = x_361_phi; - { - x_363 = (x_362 + 1); - x_357_phi = x_358; - x_360_phi = x_361; - x_362_phi = x_363; - } - } - if ((x_360 == asint(20))) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_20 = {x_GLF_color}; - return tint_symbol_20; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x0000018520DAA240(82,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000018520DAA240(22,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x0000018520DAA240(148,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000018520DAA240(214,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000018520DAA240(280,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000018520DAA240(346,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000018520DAA240(412,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000018520DAA240(478,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000018520DAA240(544,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000018520DAA240(610,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000018520DAA240(664,7-19): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl index 76a3bfc228..54d48f36de 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl @@ -88,7 +88,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl index e5be06f864..c30cb4dd14 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl @@ -51,7 +51,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl index 8147bc1df0..b93af95ef6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl @@ -48,7 +48,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl index 69482c9ce3..a6a0da4fb7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl @@ -130,7 +130,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl index db23b3e946..bc3593e136 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl @@ -187,7 +187,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl index 949a77d2c1..b9a04b8141 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl @@ -54,7 +54,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl index abd147e2a0..3a6ebf8b51 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl @@ -61,7 +61,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl index 635574865b..cf14db2acd 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl @@ -188,7 +188,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..6fbf32e38c --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.fxc.hlsl @@ -0,0 +1,345 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_59 = gl_FragCoord; + const float2 x_62 = asfloat(x_7[0].xy); + pos = (float2(x_59.x, x_59.y) / x_62); + const float x_65 = pos.x; + const float x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + { + [loop] for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = (0).xx; + canwalk = true; + v = 0; + [loop] while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + v = (v + 1); + directions = 0; + const int x_91 = p.x; + const bool x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + const int x_96 = p.x; + const int x_99 = p.y; + const int x_103 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + if (x_105_phi) { + directions = (directions + 1); + } + const int x_111 = p.y; + const bool x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + const int x_116 = p.x; + const int x_118 = p.y; + const int x_123 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + if (x_125_phi) { + directions = (directions + 1); + } + const int x_131 = p.x; + const bool x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + const int x_136 = p.x; + const int x_139 = p.y; + const int x_143 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + if (x_145_phi) { + directions = (directions + 1); + } + const int x_151 = p.y; + const bool x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + const int x_156 = p.x; + const int x_158 = p.y; + const int x_163 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + if (x_165_phi) { + directions = (directions + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + int x_288 = 0; + int x_289 = 0; + int x_295 = 0; + int x_296 = 0; + int x_303[256] = (int[256])0; + int x_304[256] = (int[256])0; + int x_315 = 0; + int x_316 = 0; + bool x_359 = false; + bool x_372 = false; + bool x_411 = false; + bool x_424 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + int x_290_phi = 0; + int x_297_phi = 0; + int x_305_phi[256] = (int[256])0; + int x_317_phi = 0; + bool x_360_phi = false; + bool x_373_phi = false; + bool x_412_phi = false; + bool x_425_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + { + [loop] for(; (i < 8); i = (i + 1)) { + j = 0; + { + [loop] for(; (j < 8); j = (j + 1)) { + const int x_196 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_196 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + } + } + const int x_211 = p.x; + const int x_213 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + d = (v % (directions == 0 ? 1 : directions)); + v = (v + directions); + const bool x_224 = (d >= 0); + x_230_phi = x_224; + if (x_224) { + const int x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + const bool x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + const int x_234 = p.x; + const int x_237 = p.y; + const int x_241 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + if (x_243_phi) { + d = (d - 1); + const int x_249 = p.x; + const int x_251 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + const int x_256 = p.x; + const int x_259 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + const int x_264 = p.x; + const int x_267 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + const int x_272 = p.x; + p.x = (x_272 - 2); + } + const bool x_276 = (d >= 0); + x_282_phi = x_276; + if (x_276) { + const int x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + const bool x_282 = x_282_phi; + if (x_282) { + x_288 = p.x; + x_290_phi = x_288; + } else { + x_289 = 0; + x_290_phi = x_289; + } + const int x_290 = x_290_phi; + if (x_282) { + x_295 = p.y; + x_297_phi = x_295; + } else { + x_296 = 0; + x_297_phi = x_296; + } + const int x_299 = ((x_297_phi - 2) * 16); + if (x_282) { + x_303 = map; + x_305_phi = x_303; + } else { + const int tint_symbol_4[256] = (int[256])0; + x_304 = tint_symbol_4; + x_305_phi = x_304; + } + const int x_305[256] = x_305_phi; + if (x_282) { + const int tint_symbol_5[256] = (int[256])0; + map = tint_symbol_5; + } + if (x_282) { + map = x_305; + } + if (x_282) { + x_315 = map[(x_290 + x_299)]; + x_317_phi = x_315; + } else { + x_316 = 0; + x_317_phi = x_316; + } + const bool x_318 = (x_317_phi == 0); + if ((x_282 ? x_318 : x_282)) { + d = (d - 1); + const int x_326 = p.x; + const int x_328 = p.y; + map[(x_326 + (x_328 * 16))] = 1; + const int x_333 = p.x; + const int x_335 = p.y; + map[(x_333 + ((x_335 - 1) * 16))] = 1; + const int x_341 = p.x; + const int x_343 = p.y; + const int x_345[256] = map; + const int tint_symbol_6[256] = (int[256])0; + map = tint_symbol_6; + map = x_345; + map[(x_341 + ((x_343 - 2) * 16))] = 1; + const int x_350 = p.y; + p.y = (x_350 - 2); + } + const bool x_354 = (d >= 0); + x_360_phi = x_354; + if (x_354) { + const int x_358 = p.x; + x_359 = (x_358 < 14); + x_360_phi = x_359; + } + const bool x_360 = x_360_phi; + x_373_phi = x_360; + if (x_360) { + const int x_364 = p.x; + const int x_367 = p.y; + const int x_371 = map[((x_364 + 2) + (x_367 * 16))]; + x_372 = (x_371 == 0); + x_373_phi = x_372; + } + if (x_373_phi) { + d = (d - 1); + const int x_379 = p.x; + const int x_381 = p.y; + map[(x_379 + (x_381 * 16))] = 1; + const int x_386 = p.x; + const int x_389 = p.y; + map[((x_386 + 1) + (x_389 * 16))] = 1; + const int x_394 = p.x; + const int x_397 = p.y; + map[((x_394 + 2) + (x_397 * 16))] = 1; + const int x_402 = p.x; + p.x = (x_402 + 2); + } + const bool x_406 = (d >= 0); + x_412_phi = x_406; + if (x_406) { + const int x_410 = p.y; + x_411 = (x_410 < 14); + x_412_phi = x_411; + } + const bool x_412 = x_412_phi; + x_425_phi = x_412; + if (x_412) { + const int x_416 = p.x; + const int x_418 = p.y; + const int x_423 = map[(x_416 + ((x_418 + 2) * 16))]; + x_424 = (x_423 == 0); + x_425_phi = x_424; + } + if (x_425_phi) { + d = (d - 1); + const int x_431 = p.x; + const int x_433 = p.y; + map[(x_431 + (x_433 * 16))] = 1; + const int x_438 = p.x; + const int x_440 = p.y; + map[(x_438 + ((x_440 + 1) * 16))] = 1; + const int x_446 = p.x; + const int x_448 = p.y; + map[(x_446 + ((x_448 + 2) * 16))] = 1; + const int x_454 = p.y; + p.y = (x_454 + 2); + } + } + const int x_458 = ipos.y; + const int x_461 = ipos.x; + const int x_464 = map[((x_458 * 16) + x_461)]; + if ((x_464 == 1)) { + x_GLF_color = (1.0f).xxxx; + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_7 = {x_GLF_color}; + return tint_symbol_7; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl deleted file mode 100644 index 6aa974e4fe..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl +++ /dev/null @@ -1 +0,0 @@ -SKIP: test times out after 30s with FXC diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl index af7ad71cdc..81b22d3a55 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl @@ -383,7 +383,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6fbf32e38c --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.fxc.hlsl @@ -0,0 +1,345 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_59 = gl_FragCoord; + const float2 x_62 = asfloat(x_7[0].xy); + pos = (float2(x_59.x, x_59.y) / x_62); + const float x_65 = pos.x; + const float x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + { + [loop] for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = (0).xx; + canwalk = true; + v = 0; + [loop] while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + v = (v + 1); + directions = 0; + const int x_91 = p.x; + const bool x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + const int x_96 = p.x; + const int x_99 = p.y; + const int x_103 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + if (x_105_phi) { + directions = (directions + 1); + } + const int x_111 = p.y; + const bool x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + const int x_116 = p.x; + const int x_118 = p.y; + const int x_123 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + if (x_125_phi) { + directions = (directions + 1); + } + const int x_131 = p.x; + const bool x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + const int x_136 = p.x; + const int x_139 = p.y; + const int x_143 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + if (x_145_phi) { + directions = (directions + 1); + } + const int x_151 = p.y; + const bool x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + const int x_156 = p.x; + const int x_158 = p.y; + const int x_163 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + if (x_165_phi) { + directions = (directions + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + int x_288 = 0; + int x_289 = 0; + int x_295 = 0; + int x_296 = 0; + int x_303[256] = (int[256])0; + int x_304[256] = (int[256])0; + int x_315 = 0; + int x_316 = 0; + bool x_359 = false; + bool x_372 = false; + bool x_411 = false; + bool x_424 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + int x_290_phi = 0; + int x_297_phi = 0; + int x_305_phi[256] = (int[256])0; + int x_317_phi = 0; + bool x_360_phi = false; + bool x_373_phi = false; + bool x_412_phi = false; + bool x_425_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + { + [loop] for(; (i < 8); i = (i + 1)) { + j = 0; + { + [loop] for(; (j < 8); j = (j + 1)) { + const int x_196 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_196 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + } + } + const int x_211 = p.x; + const int x_213 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + d = (v % (directions == 0 ? 1 : directions)); + v = (v + directions); + const bool x_224 = (d >= 0); + x_230_phi = x_224; + if (x_224) { + const int x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + const bool x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + const int x_234 = p.x; + const int x_237 = p.y; + const int x_241 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + if (x_243_phi) { + d = (d - 1); + const int x_249 = p.x; + const int x_251 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + const int x_256 = p.x; + const int x_259 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + const int x_264 = p.x; + const int x_267 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + const int x_272 = p.x; + p.x = (x_272 - 2); + } + const bool x_276 = (d >= 0); + x_282_phi = x_276; + if (x_276) { + const int x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + const bool x_282 = x_282_phi; + if (x_282) { + x_288 = p.x; + x_290_phi = x_288; + } else { + x_289 = 0; + x_290_phi = x_289; + } + const int x_290 = x_290_phi; + if (x_282) { + x_295 = p.y; + x_297_phi = x_295; + } else { + x_296 = 0; + x_297_phi = x_296; + } + const int x_299 = ((x_297_phi - 2) * 16); + if (x_282) { + x_303 = map; + x_305_phi = x_303; + } else { + const int tint_symbol_4[256] = (int[256])0; + x_304 = tint_symbol_4; + x_305_phi = x_304; + } + const int x_305[256] = x_305_phi; + if (x_282) { + const int tint_symbol_5[256] = (int[256])0; + map = tint_symbol_5; + } + if (x_282) { + map = x_305; + } + if (x_282) { + x_315 = map[(x_290 + x_299)]; + x_317_phi = x_315; + } else { + x_316 = 0; + x_317_phi = x_316; + } + const bool x_318 = (x_317_phi == 0); + if ((x_282 ? x_318 : x_282)) { + d = (d - 1); + const int x_326 = p.x; + const int x_328 = p.y; + map[(x_326 + (x_328 * 16))] = 1; + const int x_333 = p.x; + const int x_335 = p.y; + map[(x_333 + ((x_335 - 1) * 16))] = 1; + const int x_341 = p.x; + const int x_343 = p.y; + const int x_345[256] = map; + const int tint_symbol_6[256] = (int[256])0; + map = tint_symbol_6; + map = x_345; + map[(x_341 + ((x_343 - 2) * 16))] = 1; + const int x_350 = p.y; + p.y = (x_350 - 2); + } + const bool x_354 = (d >= 0); + x_360_phi = x_354; + if (x_354) { + const int x_358 = p.x; + x_359 = (x_358 < 14); + x_360_phi = x_359; + } + const bool x_360 = x_360_phi; + x_373_phi = x_360; + if (x_360) { + const int x_364 = p.x; + const int x_367 = p.y; + const int x_371 = map[((x_364 + 2) + (x_367 * 16))]; + x_372 = (x_371 == 0); + x_373_phi = x_372; + } + if (x_373_phi) { + d = (d - 1); + const int x_379 = p.x; + const int x_381 = p.y; + map[(x_379 + (x_381 * 16))] = 1; + const int x_386 = p.x; + const int x_389 = p.y; + map[((x_386 + 1) + (x_389 * 16))] = 1; + const int x_394 = p.x; + const int x_397 = p.y; + map[((x_394 + 2) + (x_397 * 16))] = 1; + const int x_402 = p.x; + p.x = (x_402 + 2); + } + const bool x_406 = (d >= 0); + x_412_phi = x_406; + if (x_406) { + const int x_410 = p.y; + x_411 = (x_410 < 14); + x_412_phi = x_411; + } + const bool x_412 = x_412_phi; + x_425_phi = x_412; + if (x_412) { + const int x_416 = p.x; + const int x_418 = p.y; + const int x_423 = map[(x_416 + ((x_418 + 2) * 16))]; + x_424 = (x_423 == 0); + x_425_phi = x_424; + } + if (x_425_phi) { + d = (d - 1); + const int x_431 = p.x; + const int x_433 = p.y; + map[(x_431 + (x_433 * 16))] = 1; + const int x_438 = p.x; + const int x_440 = p.y; + map[(x_438 + ((x_440 + 1) * 16))] = 1; + const int x_446 = p.x; + const int x_448 = p.y; + map[(x_446 + ((x_448 + 2) * 16))] = 1; + const int x_454 = p.y; + p.y = (x_454 + 2); + } + } + const int x_458 = ipos.y; + const int x_461 = ipos.x; + const int x_464 = map[((x_458 * 16) + x_461)]; + if ((x_464 == 1)) { + x_GLF_color = (1.0f).xxxx; + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_7 = {x_GLF_color}; + return tint_symbol_7; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl deleted file mode 100644 index 6aa974e4fe..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl +++ /dev/null @@ -1 +0,0 @@ -SKIP: test times out after 30s with FXC diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl index 8449a162fe..edf5b87d8c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl @@ -345,7 +345,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl index 0dda483aaa..23603de129 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl @@ -332,7 +332,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl index 3bfc9db965..389189bbae 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl @@ -329,7 +329,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl index 8f8ed41977..8056a036ba 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl @@ -297,7 +297,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl index 1c4985ddb5..00053346ca 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl @@ -312,7 +312,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl index 3344447ca4..2f6e5c2d24 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl @@ -405,7 +405,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl index 57694d18a5..c2f545040c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl @@ -404,7 +404,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl index cc20c9595f..ce42393e47 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl @@ -295,7 +295,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl index b41f89b21b..8bbd92b919 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl @@ -292,7 +292,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl index b88eb31917..9013c673b1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl @@ -96,7 +96,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl index 6f8c83dd1e..b529575805 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl @@ -99,7 +99,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl index 55cd6e5369..e4959478d0 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl @@ -96,7 +96,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl index 903d43b04c..3d271c25d1 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl @@ -99,7 +99,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl index 1692b7964a..ea82726208 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl @@ -96,7 +96,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl index f2297b166d..9841272cb4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl @@ -97,7 +97,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl index 227ca6630c..8479a82d1a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl @@ -90,7 +90,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl index 98b11851b3..463fe2841e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl @@ -75,7 +75,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl index 48f2dd5efd..ec0dce8bbe 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl @@ -81,7 +81,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl index 7580826f49..0d10814c6f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl @@ -247,7 +247,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl index 67280487f7..86252db18a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl @@ -247,7 +247,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl index 3500ff3a60..a4607d0694 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl @@ -94,7 +94,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl index 5345cd694b..afddd208ab 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl @@ -91,7 +91,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..c36a027bc4 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.fxc.hlsl @@ -0,0 +1,709 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + int x_356 = 0; + int x_58_phi = 0; + bool x_86_phi = false; + int x_353_phi = 0; + int x_356_phi = 0; + int x_358_phi = 0; + const BST tint_symbol_1 = {9, -1, -1}; + tree[0] = tint_symbol_1; + 0u; + do { + x_58_phi = 0; + [loop] while (true) { + int x_84 = 0; + int x_76 = 0; + int x_59 = 0; + int x_59_phi = 0; + const int x_58 = x_58_phi; + x_86_phi = false; + if ((x_58 <= 1)) { + } else { + break; + } + const int x_65 = tree[x_58].data; + if ((5 <= x_65)) { + const int x_78_save = x_58; + const int x_79 = tree[x_78_save].leftIndex; + if ((x_79 == -1)) { + tree[x_78_save].leftIndex = 1; + const BST tint_symbol_2 = {5, -1, -1}; + tree[1] = tint_symbol_2; + x_86_phi = true; + break; + } else { + x_84 = tree[x_78_save].leftIndex; + x_59_phi = x_84; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + } else { + const int x_70_save = x_58; + const int x_71 = tree[x_70_save].rightIndex; + if ((x_71 == -1)) { + tree[x_70_save].rightIndex = 1; + const BST tint_symbol_3 = {5, -1, -1}; + tree[1] = tint_symbol_3; + x_86_phi = true; + break; + } else { + x_76 = tree[x_70_save].rightIndex; + x_59_phi = x_76; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + } + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + } + if (x_86_phi) { + break; + } + } while (false); + int x_91_phi = 0; + bool x_119_phi = false; + 0u; + do { + x_91_phi = 0; + [loop] while (true) { + int x_117 = 0; + int x_109 = 0; + int x_92 = 0; + int x_92_phi = 0; + const int x_91 = x_91_phi; + x_119_phi = false; + if ((x_91 <= 2)) { + } else { + break; + } + const int x_98 = tree[x_91].data; + if ((12 <= x_98)) { + const int x_111_save = x_91; + const int x_112 = tree[x_111_save].leftIndex; + if ((x_112 == -1)) { + tree[x_111_save].leftIndex = 2; + const BST tint_symbol_4 = {12, -1, -1}; + tree[2] = tint_symbol_4; + x_119_phi = true; + break; + } else { + x_117 = tree[x_111_save].leftIndex; + x_92_phi = x_117; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + } else { + const int x_103_save = x_91; + const int x_104 = tree[x_103_save].rightIndex; + if ((x_104 == -1)) { + tree[x_103_save].rightIndex = 2; + const BST tint_symbol_5 = {12, -1, -1}; + tree[2] = tint_symbol_5; + x_119_phi = true; + break; + } else { + x_109 = tree[x_103_save].rightIndex; + x_92_phi = x_109; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + } + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + } + if (x_119_phi) { + break; + } + } while (false); + int x_124_phi = 0; + bool x_152_phi = false; + 0u; + do { + x_124_phi = 0; + [loop] while (true) { + int x_150 = 0; + int x_142 = 0; + int x_125 = 0; + int x_125_phi = 0; + const int x_124 = x_124_phi; + x_152_phi = false; + if ((x_124 <= 3)) { + } else { + break; + } + const int x_131 = tree[x_124].data; + if ((15 <= x_131)) { + const int x_144_save = x_124; + const int x_145 = tree[x_144_save].leftIndex; + if ((x_145 == -1)) { + tree[x_144_save].leftIndex = 3; + const BST tint_symbol_6 = {15, -1, -1}; + tree[3] = tint_symbol_6; + x_152_phi = true; + break; + } else { + x_150 = tree[x_144_save].leftIndex; + x_125_phi = x_150; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + } else { + const int x_136_save = x_124; + const int x_137 = tree[x_136_save].rightIndex; + if ((x_137 == -1)) { + tree[x_136_save].rightIndex = 3; + const BST tint_symbol_7 = {15, -1, -1}; + tree[3] = tint_symbol_7; + x_152_phi = true; + break; + } else { + x_142 = tree[x_136_save].rightIndex; + x_125_phi = x_142; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + } + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + } + if (x_152_phi) { + break; + } + } while (false); + int x_157_phi = 0; + bool x_185_phi = false; + 0u; + do { + x_157_phi = 0; + [loop] while (true) { + int x_183 = 0; + int x_175 = 0; + int x_158 = 0; + int x_158_phi = 0; + const int x_157 = x_157_phi; + x_185_phi = false; + if ((x_157 <= 4)) { + } else { + break; + } + const int x_164 = tree[x_157].data; + if ((7 <= x_164)) { + const int x_177_save = x_157; + const int x_178 = tree[x_177_save].leftIndex; + if ((x_178 == -1)) { + tree[x_177_save].leftIndex = 4; + const BST tint_symbol_8 = {7, -1, -1}; + tree[4] = tint_symbol_8; + x_185_phi = true; + break; + } else { + x_183 = tree[x_177_save].leftIndex; + x_158_phi = x_183; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + } else { + const int x_169_save = x_157; + const int x_170 = tree[x_169_save].rightIndex; + if ((x_170 == -1)) { + tree[x_169_save].rightIndex = 4; + const BST tint_symbol_9 = {7, -1, -1}; + tree[4] = tint_symbol_9; + x_185_phi = true; + break; + } else { + x_175 = tree[x_169_save].rightIndex; + x_158_phi = x_175; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + } + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + } + if (x_185_phi) { + break; + } + } while (false); + int x_190_phi = 0; + bool x_218_phi = false; + 0u; + do { + x_190_phi = 0; + [loop] while (true) { + int x_216 = 0; + int x_208 = 0; + int x_191 = 0; + int x_191_phi = 0; + const int x_190 = x_190_phi; + x_218_phi = false; + if ((x_190 <= 5)) { + } else { + break; + } + const int x_197 = tree[x_190].data; + if ((8 <= x_197)) { + const int x_210_save = x_190; + const int x_211 = tree[x_210_save].leftIndex; + if ((x_211 == -1)) { + tree[x_210_save].leftIndex = 5; + const BST tint_symbol_10 = {8, -1, -1}; + tree[5] = tint_symbol_10; + x_218_phi = true; + break; + } else { + x_216 = tree[x_210_save].leftIndex; + x_191_phi = x_216; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + } else { + const int x_202_save = x_190; + const int x_203 = tree[x_202_save].rightIndex; + if ((x_203 == -1)) { + tree[x_202_save].rightIndex = 5; + const BST tint_symbol_11 = {8, -1, -1}; + tree[5] = tint_symbol_11; + x_218_phi = true; + break; + } else { + x_208 = tree[x_202_save].rightIndex; + x_191_phi = x_208; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + } + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + } + if (x_218_phi) { + break; + } + } while (false); + int x_223_phi = 0; + bool x_251_phi = false; + 0u; + do { + x_223_phi = 0; + [loop] while (true) { + int x_249 = 0; + int x_241 = 0; + int x_224 = 0; + int x_224_phi = 0; + const int x_223 = x_223_phi; + x_251_phi = false; + if ((x_223 <= 6)) { + } else { + break; + } + const int x_230 = tree[x_223].data; + if ((2 <= x_230)) { + const int x_243_save = x_223; + const int x_244 = tree[x_243_save].leftIndex; + if ((x_244 == -1)) { + tree[x_243_save].leftIndex = 6; + const BST tint_symbol_12 = {2, -1, -1}; + tree[6] = tint_symbol_12; + x_251_phi = true; + break; + } else { + x_249 = tree[x_243_save].leftIndex; + x_224_phi = x_249; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + } else { + const int x_235_save = x_223; + const int x_236 = tree[x_235_save].rightIndex; + if ((x_236 == -1)) { + tree[x_235_save].rightIndex = 6; + const BST tint_symbol_13 = {2, -1, -1}; + tree[6] = tint_symbol_13; + x_251_phi = true; + break; + } else { + x_241 = tree[x_235_save].rightIndex; + x_224_phi = x_241; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + } + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + } + if (x_251_phi) { + break; + } + } while (false); + int x_256_phi = 0; + bool x_284_phi = false; + 0u; + do { + x_256_phi = 0; + [loop] while (true) { + int x_282 = 0; + int x_274 = 0; + int x_257 = 0; + int x_257_phi = 0; + const int x_256 = x_256_phi; + x_284_phi = false; + if ((x_256 <= 7)) { + } else { + break; + } + const int x_263 = tree[x_256].data; + if ((6 <= x_263)) { + const int x_276_save = x_256; + const int x_277 = tree[x_276_save].leftIndex; + if ((x_277 == -1)) { + tree[x_276_save].leftIndex = 7; + const BST tint_symbol_14 = {6, -1, -1}; + tree[7] = tint_symbol_14; + x_284_phi = true; + break; + } else { + x_282 = tree[x_276_save].leftIndex; + x_257_phi = x_282; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + } else { + const int x_268_save = x_256; + const int x_269 = tree[x_268_save].rightIndex; + if ((x_269 == -1)) { + tree[x_268_save].rightIndex = 7; + const BST tint_symbol_15 = {6, -1, -1}; + tree[7] = tint_symbol_15; + x_284_phi = true; + break; + } else { + x_274 = tree[x_268_save].rightIndex; + x_257_phi = x_274; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + } + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + } + if (x_284_phi) { + break; + } + } while (false); + int x_289_phi = 0; + bool x_317_phi = false; + 0u; + do { + x_289_phi = 0; + [loop] while (true) { + int x_315 = 0; + int x_307 = 0; + int x_290 = 0; + int x_290_phi = 0; + const int x_289 = x_289_phi; + x_317_phi = false; + if ((x_289 <= 8)) { + } else { + break; + } + const int x_296 = tree[x_289].data; + if ((17 <= x_296)) { + const int x_309_save = x_289; + const int x_310 = tree[x_309_save].leftIndex; + if ((x_310 == -1)) { + tree[x_309_save].leftIndex = 8; + const BST tint_symbol_16 = {17, -1, -1}; + tree[8] = tint_symbol_16; + x_317_phi = true; + break; + } else { + x_315 = tree[x_309_save].leftIndex; + x_290_phi = x_315; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + } else { + const int x_301_save = x_289; + const int x_302 = tree[x_301_save].rightIndex; + if ((x_302 == -1)) { + tree[x_301_save].rightIndex = 8; + const BST tint_symbol_17 = {17, -1, -1}; + tree[8] = tint_symbol_17; + x_317_phi = true; + break; + } else { + x_307 = tree[x_301_save].rightIndex; + x_290_phi = x_307; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + } + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + } + if (x_317_phi) { + break; + } + } while (false); + int x_322_phi = 0; + bool x_350_phi = false; + 0u; + do { + x_322_phi = 0; + [loop] while (true) { + int x_348 = 0; + int x_340 = 0; + int x_323 = 0; + int x_323_phi = 0; + const int x_322 = x_322_phi; + x_350_phi = false; + if ((x_322 <= 9)) { + } else { + break; + } + const int x_329 = tree[x_322].data; + if ((13 <= x_329)) { + const int x_342_save = x_322; + const int x_343 = tree[x_342_save].leftIndex; + if ((x_343 == -1)) { + tree[x_342_save].leftIndex = 9; + const BST tint_symbol_18 = {13, -1, -1}; + tree[9] = tint_symbol_18; + x_350_phi = true; + break; + } else { + x_348 = tree[x_342_save].leftIndex; + x_323_phi = x_348; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + } else { + const int x_334_save = x_322; + const int x_335 = tree[x_334_save].rightIndex; + if ((x_335 == -1)) { + tree[x_334_save].rightIndex = 9; + const BST tint_symbol_19 = {13, -1, -1}; + tree[9] = tint_symbol_19; + x_350_phi = true; + break; + } else { + x_340 = tree[x_334_save].rightIndex; + x_323_phi = x_340; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + } + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + } + if (x_350_phi) { + break; + } + } while (false); + x_353_phi = 0; + x_356_phi = 0; + x_358_phi = 0; + [loop] while (true) { + int x_381 = 0; + int x_391 = 0; + int x_396 = 0; + int x_359 = 0; + int x_354_phi = 0; + int x_357_phi = 0; + const int x_353 = x_353_phi; + x_356 = x_356_phi; + const int x_358 = x_358_phi; + if ((x_358 < 20)) { + } else { + break; + } + int x_366_phi = 0; + int x_381_phi = 0; + bool x_382_phi = false; + 0u; + do { + x_366_phi = 0; + [loop] while (true) { + const int x_366 = x_366_phi; + x_381_phi = x_353; + x_382_phi = false; + if ((x_366 != -1)) { + } else { + break; + } + const BST x_373 = tree[x_366]; + const int x_374 = x_373.data; + const int x_375 = x_373.leftIndex; + const int x_376 = x_373.rightIndex; + if ((x_374 == x_358)) { + x_381_phi = x_358; + x_382_phi = true; + break; + } + { + x_366_phi = ((x_358 > x_374) ? x_376 : x_375); + } + } + x_381 = x_381_phi; + const bool x_382 = x_382_phi; + x_354_phi = x_381; + if (x_382) { + break; + } + x_354_phi = -1; + } while (false); + int x_354 = 0; + int x_390 = 0; + int x_395 = 0; + int x_391_phi = 0; + int x_396_phi = 0; + x_354 = x_354_phi; + switch(x_358) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_391_phi = x_356; + if ((x_354 == asint(x_358))) { + x_390 = asint((x_356 + asint(1))); + x_391_phi = x_390; + } + x_391 = x_391_phi; + x_357_phi = x_391; + break; + } + default: { + x_396_phi = x_356; + if ((x_354 == asint(-1))) { + x_395 = asint((x_356 + asint(1))); + x_396_phi = x_395; + } + x_396 = x_396_phi; + x_357_phi = x_396; + break; + } + } + const int x_357 = x_357_phi; + { + x_359 = (x_358 + 1); + x_353_phi = x_354; + x_356_phi = x_357; + x_358_phi = x_359; + } + } + if ((x_356 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_20 = {x_GLF_color}; + return tint_symbol_20; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl deleted file mode 100644 index 383aa47a25..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl +++ /dev/null @@ -1,776 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - BST tree[10] = (BST[10])0; - int x_356 = 0; - int x_58_phi = 0; - bool x_86_phi = false; - int x_353_phi = 0; - int x_356_phi = 0; - int x_358_phi = 0; - const BST tint_symbol_1 = {9, -1, -1}; - tree[0] = tint_symbol_1; - 0u; - do { - x_58_phi = 0; - [loop] while (true) { - int x_84 = 0; - int x_76 = 0; - int x_59 = 0; - int x_59_phi = 0; - const int x_58 = x_58_phi; - x_86_phi = false; - if ((x_58 <= 1)) { - } else { - break; - } - const int x_65 = tree[x_58].data; - if ((5 <= x_65)) { - const int x_78_save = x_58; - const int x_79 = tree[x_78_save].leftIndex; - if ((x_79 == -1)) { - tree[x_78_save].leftIndex = 1; - const BST tint_symbol_2 = {5, -1, -1}; - tree[1] = tint_symbol_2; - x_86_phi = true; - break; - } else { - x_84 = tree[x_78_save].leftIndex; - x_59_phi = x_84; - { - x_59 = x_59_phi; - x_58_phi = x_59; - } - continue; - } - return; - } else { - const int x_70_save = x_58; - const int x_71 = tree[x_70_save].rightIndex; - if ((x_71 == -1)) { - tree[x_70_save].rightIndex = 1; - const BST tint_symbol_3 = {5, -1, -1}; - tree[1] = tint_symbol_3; - x_86_phi = true; - break; - } else { - x_76 = tree[x_70_save].rightIndex; - x_59_phi = x_76; - { - x_59 = x_59_phi; - x_58_phi = x_59; - } - continue; - } - return; - } - return; - { - x_59 = x_59_phi; - x_58_phi = x_59; - } - } - if (x_86_phi) { - break; - } - } while (false); - int x_91_phi = 0; - bool x_119_phi = false; - 0u; - do { - x_91_phi = 0; - [loop] while (true) { - int x_117 = 0; - int x_109 = 0; - int x_92 = 0; - int x_92_phi = 0; - const int x_91 = x_91_phi; - x_119_phi = false; - if ((x_91 <= 2)) { - } else { - break; - } - const int x_98 = tree[x_91].data; - if ((12 <= x_98)) { - const int x_111_save = x_91; - const int x_112 = tree[x_111_save].leftIndex; - if ((x_112 == -1)) { - tree[x_111_save].leftIndex = 2; - const BST tint_symbol_4 = {12, -1, -1}; - tree[2] = tint_symbol_4; - x_119_phi = true; - break; - } else { - x_117 = tree[x_111_save].leftIndex; - x_92_phi = x_117; - { - x_92 = x_92_phi; - x_91_phi = x_92; - } - continue; - } - return; - } else { - const int x_103_save = x_91; - const int x_104 = tree[x_103_save].rightIndex; - if ((x_104 == -1)) { - tree[x_103_save].rightIndex = 2; - const BST tint_symbol_5 = {12, -1, -1}; - tree[2] = tint_symbol_5; - x_119_phi = true; - break; - } else { - x_109 = tree[x_103_save].rightIndex; - x_92_phi = x_109; - { - x_92 = x_92_phi; - x_91_phi = x_92; - } - continue; - } - return; - } - return; - { - x_92 = x_92_phi; - x_91_phi = x_92; - } - } - if (x_119_phi) { - break; - } - } while (false); - int x_124_phi = 0; - bool x_152_phi = false; - 0u; - do { - x_124_phi = 0; - [loop] while (true) { - int x_150 = 0; - int x_142 = 0; - int x_125 = 0; - int x_125_phi = 0; - const int x_124 = x_124_phi; - x_152_phi = false; - if ((x_124 <= 3)) { - } else { - break; - } - const int x_131 = tree[x_124].data; - if ((15 <= x_131)) { - const int x_144_save = x_124; - const int x_145 = tree[x_144_save].leftIndex; - if ((x_145 == -1)) { - tree[x_144_save].leftIndex = 3; - const BST tint_symbol_6 = {15, -1, -1}; - tree[3] = tint_symbol_6; - x_152_phi = true; - break; - } else { - x_150 = tree[x_144_save].leftIndex; - x_125_phi = x_150; - { - x_125 = x_125_phi; - x_124_phi = x_125; - } - continue; - } - return; - } else { - const int x_136_save = x_124; - const int x_137 = tree[x_136_save].rightIndex; - if ((x_137 == -1)) { - tree[x_136_save].rightIndex = 3; - const BST tint_symbol_7 = {15, -1, -1}; - tree[3] = tint_symbol_7; - x_152_phi = true; - break; - } else { - x_142 = tree[x_136_save].rightIndex; - x_125_phi = x_142; - { - x_125 = x_125_phi; - x_124_phi = x_125; - } - continue; - } - return; - } - return; - { - x_125 = x_125_phi; - x_124_phi = x_125; - } - } - if (x_152_phi) { - break; - } - } while (false); - int x_157_phi = 0; - bool x_185_phi = false; - 0u; - do { - x_157_phi = 0; - [loop] while (true) { - int x_183 = 0; - int x_175 = 0; - int x_158 = 0; - int x_158_phi = 0; - const int x_157 = x_157_phi; - x_185_phi = false; - if ((x_157 <= 4)) { - } else { - break; - } - const int x_164 = tree[x_157].data; - if ((7 <= x_164)) { - const int x_177_save = x_157; - const int x_178 = tree[x_177_save].leftIndex; - if ((x_178 == -1)) { - tree[x_177_save].leftIndex = 4; - const BST tint_symbol_8 = {7, -1, -1}; - tree[4] = tint_symbol_8; - x_185_phi = true; - break; - } else { - x_183 = tree[x_177_save].leftIndex; - x_158_phi = x_183; - { - x_158 = x_158_phi; - x_157_phi = x_158; - } - continue; - } - return; - } else { - const int x_169_save = x_157; - const int x_170 = tree[x_169_save].rightIndex; - if ((x_170 == -1)) { - tree[x_169_save].rightIndex = 4; - const BST tint_symbol_9 = {7, -1, -1}; - tree[4] = tint_symbol_9; - x_185_phi = true; - break; - } else { - x_175 = tree[x_169_save].rightIndex; - x_158_phi = x_175; - { - x_158 = x_158_phi; - x_157_phi = x_158; - } - continue; - } - return; - } - return; - { - x_158 = x_158_phi; - x_157_phi = x_158; - } - } - if (x_185_phi) { - break; - } - } while (false); - int x_190_phi = 0; - bool x_218_phi = false; - 0u; - do { - x_190_phi = 0; - [loop] while (true) { - int x_216 = 0; - int x_208 = 0; - int x_191 = 0; - int x_191_phi = 0; - const int x_190 = x_190_phi; - x_218_phi = false; - if ((x_190 <= 5)) { - } else { - break; - } - const int x_197 = tree[x_190].data; - if ((8 <= x_197)) { - const int x_210_save = x_190; - const int x_211 = tree[x_210_save].leftIndex; - if ((x_211 == -1)) { - tree[x_210_save].leftIndex = 5; - const BST tint_symbol_10 = {8, -1, -1}; - tree[5] = tint_symbol_10; - x_218_phi = true; - break; - } else { - x_216 = tree[x_210_save].leftIndex; - x_191_phi = x_216; - { - x_191 = x_191_phi; - x_190_phi = x_191; - } - continue; - } - return; - } else { - const int x_202_save = x_190; - const int x_203 = tree[x_202_save].rightIndex; - if ((x_203 == -1)) { - tree[x_202_save].rightIndex = 5; - const BST tint_symbol_11 = {8, -1, -1}; - tree[5] = tint_symbol_11; - x_218_phi = true; - break; - } else { - x_208 = tree[x_202_save].rightIndex; - x_191_phi = x_208; - { - x_191 = x_191_phi; - x_190_phi = x_191; - } - continue; - } - return; - } - return; - { - x_191 = x_191_phi; - x_190_phi = x_191; - } - } - if (x_218_phi) { - break; - } - } while (false); - int x_223_phi = 0; - bool x_251_phi = false; - 0u; - do { - x_223_phi = 0; - [loop] while (true) { - int x_249 = 0; - int x_241 = 0; - int x_224 = 0; - int x_224_phi = 0; - const int x_223 = x_223_phi; - x_251_phi = false; - if ((x_223 <= 6)) { - } else { - break; - } - const int x_230 = tree[x_223].data; - if ((2 <= x_230)) { - const int x_243_save = x_223; - const int x_244 = tree[x_243_save].leftIndex; - if ((x_244 == -1)) { - tree[x_243_save].leftIndex = 6; - const BST tint_symbol_12 = {2, -1, -1}; - tree[6] = tint_symbol_12; - x_251_phi = true; - break; - } else { - x_249 = tree[x_243_save].leftIndex; - x_224_phi = x_249; - { - x_224 = x_224_phi; - x_223_phi = x_224; - } - continue; - } - return; - } else { - const int x_235_save = x_223; - const int x_236 = tree[x_235_save].rightIndex; - if ((x_236 == -1)) { - tree[x_235_save].rightIndex = 6; - const BST tint_symbol_13 = {2, -1, -1}; - tree[6] = tint_symbol_13; - x_251_phi = true; - break; - } else { - x_241 = tree[x_235_save].rightIndex; - x_224_phi = x_241; - { - x_224 = x_224_phi; - x_223_phi = x_224; - } - continue; - } - return; - } - return; - { - x_224 = x_224_phi; - x_223_phi = x_224; - } - } - if (x_251_phi) { - break; - } - } while (false); - int x_256_phi = 0; - bool x_284_phi = false; - 0u; - do { - x_256_phi = 0; - [loop] while (true) { - int x_282 = 0; - int x_274 = 0; - int x_257 = 0; - int x_257_phi = 0; - const int x_256 = x_256_phi; - x_284_phi = false; - if ((x_256 <= 7)) { - } else { - break; - } - const int x_263 = tree[x_256].data; - if ((6 <= x_263)) { - const int x_276_save = x_256; - const int x_277 = tree[x_276_save].leftIndex; - if ((x_277 == -1)) { - tree[x_276_save].leftIndex = 7; - const BST tint_symbol_14 = {6, -1, -1}; - tree[7] = tint_symbol_14; - x_284_phi = true; - break; - } else { - x_282 = tree[x_276_save].leftIndex; - x_257_phi = x_282; - { - x_257 = x_257_phi; - x_256_phi = x_257; - } - continue; - } - return; - } else { - const int x_268_save = x_256; - const int x_269 = tree[x_268_save].rightIndex; - if ((x_269 == -1)) { - tree[x_268_save].rightIndex = 7; - const BST tint_symbol_15 = {6, -1, -1}; - tree[7] = tint_symbol_15; - x_284_phi = true; - break; - } else { - x_274 = tree[x_268_save].rightIndex; - x_257_phi = x_274; - { - x_257 = x_257_phi; - x_256_phi = x_257; - } - continue; - } - return; - } - return; - { - x_257 = x_257_phi; - x_256_phi = x_257; - } - } - if (x_284_phi) { - break; - } - } while (false); - int x_289_phi = 0; - bool x_317_phi = false; - 0u; - do { - x_289_phi = 0; - [loop] while (true) { - int x_315 = 0; - int x_307 = 0; - int x_290 = 0; - int x_290_phi = 0; - const int x_289 = x_289_phi; - x_317_phi = false; - if ((x_289 <= 8)) { - } else { - break; - } - const int x_296 = tree[x_289].data; - if ((17 <= x_296)) { - const int x_309_save = x_289; - const int x_310 = tree[x_309_save].leftIndex; - if ((x_310 == -1)) { - tree[x_309_save].leftIndex = 8; - const BST tint_symbol_16 = {17, -1, -1}; - tree[8] = tint_symbol_16; - x_317_phi = true; - break; - } else { - x_315 = tree[x_309_save].leftIndex; - x_290_phi = x_315; - { - x_290 = x_290_phi; - x_289_phi = x_290; - } - continue; - } - return; - } else { - const int x_301_save = x_289; - const int x_302 = tree[x_301_save].rightIndex; - if ((x_302 == -1)) { - tree[x_301_save].rightIndex = 8; - const BST tint_symbol_17 = {17, -1, -1}; - tree[8] = tint_symbol_17; - x_317_phi = true; - break; - } else { - x_307 = tree[x_301_save].rightIndex; - x_290_phi = x_307; - { - x_290 = x_290_phi; - x_289_phi = x_290; - } - continue; - } - return; - } - return; - { - x_290 = x_290_phi; - x_289_phi = x_290; - } - } - if (x_317_phi) { - break; - } - } while (false); - int x_322_phi = 0; - bool x_350_phi = false; - 0u; - do { - x_322_phi = 0; - [loop] while (true) { - int x_348 = 0; - int x_340 = 0; - int x_323 = 0; - int x_323_phi = 0; - const int x_322 = x_322_phi; - x_350_phi = false; - if ((x_322 <= 9)) { - } else { - break; - } - const int x_329 = tree[x_322].data; - if ((13 <= x_329)) { - const int x_342_save = x_322; - const int x_343 = tree[x_342_save].leftIndex; - if ((x_343 == -1)) { - tree[x_342_save].leftIndex = 9; - const BST tint_symbol_18 = {13, -1, -1}; - tree[9] = tint_symbol_18; - x_350_phi = true; - break; - } else { - x_348 = tree[x_342_save].leftIndex; - x_323_phi = x_348; - { - x_323 = x_323_phi; - x_322_phi = x_323; - } - continue; - } - return; - } else { - const int x_334_save = x_322; - const int x_335 = tree[x_334_save].rightIndex; - if ((x_335 == -1)) { - tree[x_334_save].rightIndex = 9; - const BST tint_symbol_19 = {13, -1, -1}; - tree[9] = tint_symbol_19; - x_350_phi = true; - break; - } else { - x_340 = tree[x_334_save].rightIndex; - x_323_phi = x_340; - { - x_323 = x_323_phi; - x_322_phi = x_323; - } - continue; - } - return; - } - return; - { - x_323 = x_323_phi; - x_322_phi = x_323; - } - } - if (x_350_phi) { - break; - } - } while (false); - x_353_phi = 0; - x_356_phi = 0; - x_358_phi = 0; - [loop] while (true) { - int x_381 = 0; - int x_391 = 0; - int x_396 = 0; - int x_359 = 0; - int x_354_phi = 0; - int x_357_phi = 0; - const int x_353 = x_353_phi; - x_356 = x_356_phi; - const int x_358 = x_358_phi; - if ((x_358 < 20)) { - } else { - break; - } - int x_366_phi = 0; - int x_381_phi = 0; - bool x_382_phi = false; - 0u; - do { - x_366_phi = 0; - [loop] while (true) { - const int x_366 = x_366_phi; - x_381_phi = x_353; - x_382_phi = false; - if ((x_366 != -1)) { - } else { - break; - } - const BST x_373 = tree[x_366]; - const int x_374 = x_373.data; - const int x_375 = x_373.leftIndex; - const int x_376 = x_373.rightIndex; - if ((x_374 == x_358)) { - x_381_phi = x_358; - x_382_phi = true; - break; - } - { - x_366_phi = ((x_358 > x_374) ? x_376 : x_375); - } - } - x_381 = x_381_phi; - const bool x_382 = x_382_phi; - x_354_phi = x_381; - if (x_382) { - break; - } - x_354_phi = -1; - } while (false); - int x_354 = 0; - int x_390 = 0; - int x_395 = 0; - int x_391_phi = 0; - int x_396_phi = 0; - x_354 = x_354_phi; - switch(x_358) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - x_391_phi = x_356; - if ((x_354 == asint(x_358))) { - x_390 = asint((x_356 + asint(1))); - x_391_phi = x_390; - } - x_391 = x_391_phi; - x_357_phi = x_391; - break; - } - default: { - x_396_phi = x_356; - if ((x_354 == asint(-1))) { - x_395 = asint((x_356 + asint(1))); - x_396_phi = x_395; - } - x_396 = x_396_phi; - x_357_phi = x_396; - break; - } - } - const int x_357 = x_357_phi; - { - x_359 = (x_358 + 1); - x_353_phi = x_354; - x_356_phi = x_357; - x_358_phi = x_359; - } - } - if ((x_356 == asint(20))) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_20 = {x_GLF_color}; - return tint_symbol_20; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x0000022EDBF08060(82,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000022EDBF08060(22,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x0000022EDBF08060(148,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000022EDBF08060(214,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000022EDBF08060(280,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000022EDBF08060(346,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000022EDBF08060(412,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000022EDBF08060(478,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000022EDBF08060(544,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000022EDBF08060(610,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x0000022EDBF08060(662,7-19): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl index 4a1f3e2230..9f1a34b52c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl @@ -619,7 +619,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c36a027bc4 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.fxc.hlsl @@ -0,0 +1,709 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + int x_356 = 0; + int x_58_phi = 0; + bool x_86_phi = false; + int x_353_phi = 0; + int x_356_phi = 0; + int x_358_phi = 0; + const BST tint_symbol_1 = {9, -1, -1}; + tree[0] = tint_symbol_1; + 0u; + do { + x_58_phi = 0; + [loop] while (true) { + int x_84 = 0; + int x_76 = 0; + int x_59 = 0; + int x_59_phi = 0; + const int x_58 = x_58_phi; + x_86_phi = false; + if ((x_58 <= 1)) { + } else { + break; + } + const int x_65 = tree[x_58].data; + if ((5 <= x_65)) { + const int x_78_save = x_58; + const int x_79 = tree[x_78_save].leftIndex; + if ((x_79 == -1)) { + tree[x_78_save].leftIndex = 1; + const BST tint_symbol_2 = {5, -1, -1}; + tree[1] = tint_symbol_2; + x_86_phi = true; + break; + } else { + x_84 = tree[x_78_save].leftIndex; + x_59_phi = x_84; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + } else { + const int x_70_save = x_58; + const int x_71 = tree[x_70_save].rightIndex; + if ((x_71 == -1)) { + tree[x_70_save].rightIndex = 1; + const BST tint_symbol_3 = {5, -1, -1}; + tree[1] = tint_symbol_3; + x_86_phi = true; + break; + } else { + x_76 = tree[x_70_save].rightIndex; + x_59_phi = x_76; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + } + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + } + if (x_86_phi) { + break; + } + } while (false); + int x_91_phi = 0; + bool x_119_phi = false; + 0u; + do { + x_91_phi = 0; + [loop] while (true) { + int x_117 = 0; + int x_109 = 0; + int x_92 = 0; + int x_92_phi = 0; + const int x_91 = x_91_phi; + x_119_phi = false; + if ((x_91 <= 2)) { + } else { + break; + } + const int x_98 = tree[x_91].data; + if ((12 <= x_98)) { + const int x_111_save = x_91; + const int x_112 = tree[x_111_save].leftIndex; + if ((x_112 == -1)) { + tree[x_111_save].leftIndex = 2; + const BST tint_symbol_4 = {12, -1, -1}; + tree[2] = tint_symbol_4; + x_119_phi = true; + break; + } else { + x_117 = tree[x_111_save].leftIndex; + x_92_phi = x_117; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + } else { + const int x_103_save = x_91; + const int x_104 = tree[x_103_save].rightIndex; + if ((x_104 == -1)) { + tree[x_103_save].rightIndex = 2; + const BST tint_symbol_5 = {12, -1, -1}; + tree[2] = tint_symbol_5; + x_119_phi = true; + break; + } else { + x_109 = tree[x_103_save].rightIndex; + x_92_phi = x_109; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + } + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + } + if (x_119_phi) { + break; + } + } while (false); + int x_124_phi = 0; + bool x_152_phi = false; + 0u; + do { + x_124_phi = 0; + [loop] while (true) { + int x_150 = 0; + int x_142 = 0; + int x_125 = 0; + int x_125_phi = 0; + const int x_124 = x_124_phi; + x_152_phi = false; + if ((x_124 <= 3)) { + } else { + break; + } + const int x_131 = tree[x_124].data; + if ((15 <= x_131)) { + const int x_144_save = x_124; + const int x_145 = tree[x_144_save].leftIndex; + if ((x_145 == -1)) { + tree[x_144_save].leftIndex = 3; + const BST tint_symbol_6 = {15, -1, -1}; + tree[3] = tint_symbol_6; + x_152_phi = true; + break; + } else { + x_150 = tree[x_144_save].leftIndex; + x_125_phi = x_150; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + } else { + const int x_136_save = x_124; + const int x_137 = tree[x_136_save].rightIndex; + if ((x_137 == -1)) { + tree[x_136_save].rightIndex = 3; + const BST tint_symbol_7 = {15, -1, -1}; + tree[3] = tint_symbol_7; + x_152_phi = true; + break; + } else { + x_142 = tree[x_136_save].rightIndex; + x_125_phi = x_142; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + } + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + } + if (x_152_phi) { + break; + } + } while (false); + int x_157_phi = 0; + bool x_185_phi = false; + 0u; + do { + x_157_phi = 0; + [loop] while (true) { + int x_183 = 0; + int x_175 = 0; + int x_158 = 0; + int x_158_phi = 0; + const int x_157 = x_157_phi; + x_185_phi = false; + if ((x_157 <= 4)) { + } else { + break; + } + const int x_164 = tree[x_157].data; + if ((7 <= x_164)) { + const int x_177_save = x_157; + const int x_178 = tree[x_177_save].leftIndex; + if ((x_178 == -1)) { + tree[x_177_save].leftIndex = 4; + const BST tint_symbol_8 = {7, -1, -1}; + tree[4] = tint_symbol_8; + x_185_phi = true; + break; + } else { + x_183 = tree[x_177_save].leftIndex; + x_158_phi = x_183; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + } else { + const int x_169_save = x_157; + const int x_170 = tree[x_169_save].rightIndex; + if ((x_170 == -1)) { + tree[x_169_save].rightIndex = 4; + const BST tint_symbol_9 = {7, -1, -1}; + tree[4] = tint_symbol_9; + x_185_phi = true; + break; + } else { + x_175 = tree[x_169_save].rightIndex; + x_158_phi = x_175; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + } + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + } + if (x_185_phi) { + break; + } + } while (false); + int x_190_phi = 0; + bool x_218_phi = false; + 0u; + do { + x_190_phi = 0; + [loop] while (true) { + int x_216 = 0; + int x_208 = 0; + int x_191 = 0; + int x_191_phi = 0; + const int x_190 = x_190_phi; + x_218_phi = false; + if ((x_190 <= 5)) { + } else { + break; + } + const int x_197 = tree[x_190].data; + if ((8 <= x_197)) { + const int x_210_save = x_190; + const int x_211 = tree[x_210_save].leftIndex; + if ((x_211 == -1)) { + tree[x_210_save].leftIndex = 5; + const BST tint_symbol_10 = {8, -1, -1}; + tree[5] = tint_symbol_10; + x_218_phi = true; + break; + } else { + x_216 = tree[x_210_save].leftIndex; + x_191_phi = x_216; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + } else { + const int x_202_save = x_190; + const int x_203 = tree[x_202_save].rightIndex; + if ((x_203 == -1)) { + tree[x_202_save].rightIndex = 5; + const BST tint_symbol_11 = {8, -1, -1}; + tree[5] = tint_symbol_11; + x_218_phi = true; + break; + } else { + x_208 = tree[x_202_save].rightIndex; + x_191_phi = x_208; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + } + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + } + if (x_218_phi) { + break; + } + } while (false); + int x_223_phi = 0; + bool x_251_phi = false; + 0u; + do { + x_223_phi = 0; + [loop] while (true) { + int x_249 = 0; + int x_241 = 0; + int x_224 = 0; + int x_224_phi = 0; + const int x_223 = x_223_phi; + x_251_phi = false; + if ((x_223 <= 6)) { + } else { + break; + } + const int x_230 = tree[x_223].data; + if ((2 <= x_230)) { + const int x_243_save = x_223; + const int x_244 = tree[x_243_save].leftIndex; + if ((x_244 == -1)) { + tree[x_243_save].leftIndex = 6; + const BST tint_symbol_12 = {2, -1, -1}; + tree[6] = tint_symbol_12; + x_251_phi = true; + break; + } else { + x_249 = tree[x_243_save].leftIndex; + x_224_phi = x_249; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + } else { + const int x_235_save = x_223; + const int x_236 = tree[x_235_save].rightIndex; + if ((x_236 == -1)) { + tree[x_235_save].rightIndex = 6; + const BST tint_symbol_13 = {2, -1, -1}; + tree[6] = tint_symbol_13; + x_251_phi = true; + break; + } else { + x_241 = tree[x_235_save].rightIndex; + x_224_phi = x_241; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + } + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + } + if (x_251_phi) { + break; + } + } while (false); + int x_256_phi = 0; + bool x_284_phi = false; + 0u; + do { + x_256_phi = 0; + [loop] while (true) { + int x_282 = 0; + int x_274 = 0; + int x_257 = 0; + int x_257_phi = 0; + const int x_256 = x_256_phi; + x_284_phi = false; + if ((x_256 <= 7)) { + } else { + break; + } + const int x_263 = tree[x_256].data; + if ((6 <= x_263)) { + const int x_276_save = x_256; + const int x_277 = tree[x_276_save].leftIndex; + if ((x_277 == -1)) { + tree[x_276_save].leftIndex = 7; + const BST tint_symbol_14 = {6, -1, -1}; + tree[7] = tint_symbol_14; + x_284_phi = true; + break; + } else { + x_282 = tree[x_276_save].leftIndex; + x_257_phi = x_282; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + } else { + const int x_268_save = x_256; + const int x_269 = tree[x_268_save].rightIndex; + if ((x_269 == -1)) { + tree[x_268_save].rightIndex = 7; + const BST tint_symbol_15 = {6, -1, -1}; + tree[7] = tint_symbol_15; + x_284_phi = true; + break; + } else { + x_274 = tree[x_268_save].rightIndex; + x_257_phi = x_274; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + } + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + } + if (x_284_phi) { + break; + } + } while (false); + int x_289_phi = 0; + bool x_317_phi = false; + 0u; + do { + x_289_phi = 0; + [loop] while (true) { + int x_315 = 0; + int x_307 = 0; + int x_290 = 0; + int x_290_phi = 0; + const int x_289 = x_289_phi; + x_317_phi = false; + if ((x_289 <= 8)) { + } else { + break; + } + const int x_296 = tree[x_289].data; + if ((17 <= x_296)) { + const int x_309_save = x_289; + const int x_310 = tree[x_309_save].leftIndex; + if ((x_310 == -1)) { + tree[x_309_save].leftIndex = 8; + const BST tint_symbol_16 = {17, -1, -1}; + tree[8] = tint_symbol_16; + x_317_phi = true; + break; + } else { + x_315 = tree[x_309_save].leftIndex; + x_290_phi = x_315; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + } else { + const int x_301_save = x_289; + const int x_302 = tree[x_301_save].rightIndex; + if ((x_302 == -1)) { + tree[x_301_save].rightIndex = 8; + const BST tint_symbol_17 = {17, -1, -1}; + tree[8] = tint_symbol_17; + x_317_phi = true; + break; + } else { + x_307 = tree[x_301_save].rightIndex; + x_290_phi = x_307; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + } + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + } + if (x_317_phi) { + break; + } + } while (false); + int x_322_phi = 0; + bool x_350_phi = false; + 0u; + do { + x_322_phi = 0; + [loop] while (true) { + int x_348 = 0; + int x_340 = 0; + int x_323 = 0; + int x_323_phi = 0; + const int x_322 = x_322_phi; + x_350_phi = false; + if ((x_322 <= 9)) { + } else { + break; + } + const int x_329 = tree[x_322].data; + if ((13 <= x_329)) { + const int x_342_save = x_322; + const int x_343 = tree[x_342_save].leftIndex; + if ((x_343 == -1)) { + tree[x_342_save].leftIndex = 9; + const BST tint_symbol_18 = {13, -1, -1}; + tree[9] = tint_symbol_18; + x_350_phi = true; + break; + } else { + x_348 = tree[x_342_save].leftIndex; + x_323_phi = x_348; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + } else { + const int x_334_save = x_322; + const int x_335 = tree[x_334_save].rightIndex; + if ((x_335 == -1)) { + tree[x_334_save].rightIndex = 9; + const BST tint_symbol_19 = {13, -1, -1}; + tree[9] = tint_symbol_19; + x_350_phi = true; + break; + } else { + x_340 = tree[x_334_save].rightIndex; + x_323_phi = x_340; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + } + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + } + if (x_350_phi) { + break; + } + } while (false); + x_353_phi = 0; + x_356_phi = 0; + x_358_phi = 0; + [loop] while (true) { + int x_381 = 0; + int x_391 = 0; + int x_396 = 0; + int x_359 = 0; + int x_354_phi = 0; + int x_357_phi = 0; + const int x_353 = x_353_phi; + x_356 = x_356_phi; + const int x_358 = x_358_phi; + if ((x_358 < 20)) { + } else { + break; + } + int x_366_phi = 0; + int x_381_phi = 0; + bool x_382_phi = false; + 0u; + do { + x_366_phi = 0; + [loop] while (true) { + const int x_366 = x_366_phi; + x_381_phi = x_353; + x_382_phi = false; + if ((x_366 != -1)) { + } else { + break; + } + const BST x_373 = tree[x_366]; + const int x_374 = x_373.data; + const int x_375 = x_373.leftIndex; + const int x_376 = x_373.rightIndex; + if ((x_374 == x_358)) { + x_381_phi = x_358; + x_382_phi = true; + break; + } + { + x_366_phi = ((x_358 > x_374) ? x_376 : x_375); + } + } + x_381 = x_381_phi; + const bool x_382 = x_382_phi; + x_354_phi = x_381; + if (x_382) { + break; + } + x_354_phi = -1; + } while (false); + int x_354 = 0; + int x_390 = 0; + int x_395 = 0; + int x_391_phi = 0; + int x_396_phi = 0; + x_354 = x_354_phi; + switch(x_358) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_391_phi = x_356; + if ((x_354 == asint(x_358))) { + x_390 = asint((x_356 + asint(1))); + x_391_phi = x_390; + } + x_391 = x_391_phi; + x_357_phi = x_391; + break; + } + default: { + x_396_phi = x_356; + if ((x_354 == asint(-1))) { + x_395 = asint((x_356 + asint(1))); + x_396_phi = x_395; + } + x_396 = x_396_phi; + x_357_phi = x_396; + break; + } + } + const int x_357 = x_357_phi; + { + x_359 = (x_358 + 1); + x_353_phi = x_354; + x_356_phi = x_357; + x_358_phi = x_359; + } + } + if ((x_356 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_20 = {x_GLF_color}; + return tint_symbol_20; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl deleted file mode 100644 index 7ac5f6908a..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl +++ /dev/null @@ -1,857 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:46:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:60:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:62:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:105:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:119:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:121:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:164:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:178:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:180:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:223:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:237:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:239:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:282:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:296:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:298:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:341:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:355:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:357:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:400:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:414:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:416:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:459:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:473:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:475:9 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:518:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:532:11 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:534:9 warning: code is unreachable - return; - ^^^^^^ - -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - BST tree[10] = (BST[10])0; - int x_356 = 0; - int x_58_phi = 0; - bool x_86_phi = false; - int x_353_phi = 0; - int x_356_phi = 0; - int x_358_phi = 0; - const BST tint_symbol_1 = {9, -1, -1}; - tree[0] = tint_symbol_1; - 0u; - do { - x_58_phi = 0; - [loop] while (true) { - int x_84 = 0; - int x_76 = 0; - int x_59 = 0; - int x_59_phi = 0; - const int x_58 = x_58_phi; - x_86_phi = false; - if ((x_58 <= 1)) { - } else { - break; - } - const int x_65 = tree[x_58].data; - if ((5 <= x_65)) { - const int x_78_save = x_58; - const int x_79 = tree[x_78_save].leftIndex; - if ((x_79 == -1)) { - tree[x_78_save].leftIndex = 1; - const BST tint_symbol_2 = {5, -1, -1}; - tree[1] = tint_symbol_2; - x_86_phi = true; - break; - } else { - x_84 = tree[x_78_save].leftIndex; - x_59_phi = x_84; - { - x_59 = x_59_phi; - x_58_phi = x_59; - } - continue; - } - return; - } else { - const int x_70_save = x_58; - const int x_71 = tree[x_70_save].rightIndex; - if ((x_71 == -1)) { - tree[x_70_save].rightIndex = 1; - const BST tint_symbol_3 = {5, -1, -1}; - tree[1] = tint_symbol_3; - x_86_phi = true; - break; - } else { - x_76 = tree[x_70_save].rightIndex; - x_59_phi = x_76; - { - x_59 = x_59_phi; - x_58_phi = x_59; - } - continue; - } - return; - } - return; - { - x_59 = x_59_phi; - x_58_phi = x_59; - } - } - if (x_86_phi) { - break; - } - } while (false); - int x_91_phi = 0; - bool x_119_phi = false; - 0u; - do { - x_91_phi = 0; - [loop] while (true) { - int x_117 = 0; - int x_109 = 0; - int x_92 = 0; - int x_92_phi = 0; - const int x_91 = x_91_phi; - x_119_phi = false; - if ((x_91 <= 2)) { - } else { - break; - } - const int x_98 = tree[x_91].data; - if ((12 <= x_98)) { - const int x_111_save = x_91; - const int x_112 = tree[x_111_save].leftIndex; - if ((x_112 == -1)) { - tree[x_111_save].leftIndex = 2; - const BST tint_symbol_4 = {12, -1, -1}; - tree[2] = tint_symbol_4; - x_119_phi = true; - break; - } else { - x_117 = tree[x_111_save].leftIndex; - x_92_phi = x_117; - { - x_92 = x_92_phi; - x_91_phi = x_92; - } - continue; - } - return; - } else { - const int x_103_save = x_91; - const int x_104 = tree[x_103_save].rightIndex; - if ((x_104 == -1)) { - tree[x_103_save].rightIndex = 2; - const BST tint_symbol_5 = {12, -1, -1}; - tree[2] = tint_symbol_5; - x_119_phi = true; - break; - } else { - x_109 = tree[x_103_save].rightIndex; - x_92_phi = x_109; - { - x_92 = x_92_phi; - x_91_phi = x_92; - } - continue; - } - return; - } - return; - { - x_92 = x_92_phi; - x_91_phi = x_92; - } - } - if (x_119_phi) { - break; - } - } while (false); - int x_124_phi = 0; - bool x_152_phi = false; - 0u; - do { - x_124_phi = 0; - [loop] while (true) { - int x_150 = 0; - int x_142 = 0; - int x_125 = 0; - int x_125_phi = 0; - const int x_124 = x_124_phi; - x_152_phi = false; - if ((x_124 <= 3)) { - } else { - break; - } - const int x_131 = tree[x_124].data; - if ((15 <= x_131)) { - const int x_144_save = x_124; - const int x_145 = tree[x_144_save].leftIndex; - if ((x_145 == -1)) { - tree[x_144_save].leftIndex = 3; - const BST tint_symbol_6 = {15, -1, -1}; - tree[3] = tint_symbol_6; - x_152_phi = true; - break; - } else { - x_150 = tree[x_144_save].leftIndex; - x_125_phi = x_150; - { - x_125 = x_125_phi; - x_124_phi = x_125; - } - continue; - } - return; - } else { - const int x_136_save = x_124; - const int x_137 = tree[x_136_save].rightIndex; - if ((x_137 == -1)) { - tree[x_136_save].rightIndex = 3; - const BST tint_symbol_7 = {15, -1, -1}; - tree[3] = tint_symbol_7; - x_152_phi = true; - break; - } else { - x_142 = tree[x_136_save].rightIndex; - x_125_phi = x_142; - { - x_125 = x_125_phi; - x_124_phi = x_125; - } - continue; - } - return; - } - return; - { - x_125 = x_125_phi; - x_124_phi = x_125; - } - } - if (x_152_phi) { - break; - } - } while (false); - int x_157_phi = 0; - bool x_185_phi = false; - 0u; - do { - x_157_phi = 0; - [loop] while (true) { - int x_183 = 0; - int x_175 = 0; - int x_158 = 0; - int x_158_phi = 0; - const int x_157 = x_157_phi; - x_185_phi = false; - if ((x_157 <= 4)) { - } else { - break; - } - const int x_164 = tree[x_157].data; - if ((7 <= x_164)) { - const int x_177_save = x_157; - const int x_178 = tree[x_177_save].leftIndex; - if ((x_178 == -1)) { - tree[x_177_save].leftIndex = 4; - const BST tint_symbol_8 = {7, -1, -1}; - tree[4] = tint_symbol_8; - x_185_phi = true; - break; - } else { - x_183 = tree[x_177_save].leftIndex; - x_158_phi = x_183; - { - x_158 = x_158_phi; - x_157_phi = x_158; - } - continue; - } - return; - } else { - const int x_169_save = x_157; - const int x_170 = tree[x_169_save].rightIndex; - if ((x_170 == -1)) { - tree[x_169_save].rightIndex = 4; - const BST tint_symbol_9 = {7, -1, -1}; - tree[4] = tint_symbol_9; - x_185_phi = true; - break; - } else { - x_175 = tree[x_169_save].rightIndex; - x_158_phi = x_175; - { - x_158 = x_158_phi; - x_157_phi = x_158; - } - continue; - } - return; - } - return; - { - x_158 = x_158_phi; - x_157_phi = x_158; - } - } - if (x_185_phi) { - break; - } - } while (false); - int x_190_phi = 0; - bool x_218_phi = false; - 0u; - do { - x_190_phi = 0; - [loop] while (true) { - int x_216 = 0; - int x_208 = 0; - int x_191 = 0; - int x_191_phi = 0; - const int x_190 = x_190_phi; - x_218_phi = false; - if ((x_190 <= 5)) { - } else { - break; - } - const int x_197 = tree[x_190].data; - if ((8 <= x_197)) { - const int x_210_save = x_190; - const int x_211 = tree[x_210_save].leftIndex; - if ((x_211 == -1)) { - tree[x_210_save].leftIndex = 5; - const BST tint_symbol_10 = {8, -1, -1}; - tree[5] = tint_symbol_10; - x_218_phi = true; - break; - } else { - x_216 = tree[x_210_save].leftIndex; - x_191_phi = x_216; - { - x_191 = x_191_phi; - x_190_phi = x_191; - } - continue; - } - return; - } else { - const int x_202_save = x_190; - const int x_203 = tree[x_202_save].rightIndex; - if ((x_203 == -1)) { - tree[x_202_save].rightIndex = 5; - const BST tint_symbol_11 = {8, -1, -1}; - tree[5] = tint_symbol_11; - x_218_phi = true; - break; - } else { - x_208 = tree[x_202_save].rightIndex; - x_191_phi = x_208; - { - x_191 = x_191_phi; - x_190_phi = x_191; - } - continue; - } - return; - } - return; - { - x_191 = x_191_phi; - x_190_phi = x_191; - } - } - if (x_218_phi) { - break; - } - } while (false); - int x_223_phi = 0; - bool x_251_phi = false; - 0u; - do { - x_223_phi = 0; - [loop] while (true) { - int x_249 = 0; - int x_241 = 0; - int x_224 = 0; - int x_224_phi = 0; - const int x_223 = x_223_phi; - x_251_phi = false; - if ((x_223 <= 6)) { - } else { - break; - } - const int x_230 = tree[x_223].data; - if ((2 <= x_230)) { - const int x_243_save = x_223; - const int x_244 = tree[x_243_save].leftIndex; - if ((x_244 == -1)) { - tree[x_243_save].leftIndex = 6; - const BST tint_symbol_12 = {2, -1, -1}; - tree[6] = tint_symbol_12; - x_251_phi = true; - break; - } else { - x_249 = tree[x_243_save].leftIndex; - x_224_phi = x_249; - { - x_224 = x_224_phi; - x_223_phi = x_224; - } - continue; - } - return; - } else { - const int x_235_save = x_223; - const int x_236 = tree[x_235_save].rightIndex; - if ((x_236 == -1)) { - tree[x_235_save].rightIndex = 6; - const BST tint_symbol_13 = {2, -1, -1}; - tree[6] = tint_symbol_13; - x_251_phi = true; - break; - } else { - x_241 = tree[x_235_save].rightIndex; - x_224_phi = x_241; - { - x_224 = x_224_phi; - x_223_phi = x_224; - } - continue; - } - return; - } - return; - { - x_224 = x_224_phi; - x_223_phi = x_224; - } - } - if (x_251_phi) { - break; - } - } while (false); - int x_256_phi = 0; - bool x_284_phi = false; - 0u; - do { - x_256_phi = 0; - [loop] while (true) { - int x_282 = 0; - int x_274 = 0; - int x_257 = 0; - int x_257_phi = 0; - const int x_256 = x_256_phi; - x_284_phi = false; - if ((x_256 <= 7)) { - } else { - break; - } - const int x_263 = tree[x_256].data; - if ((6 <= x_263)) { - const int x_276_save = x_256; - const int x_277 = tree[x_276_save].leftIndex; - if ((x_277 == -1)) { - tree[x_276_save].leftIndex = 7; - const BST tint_symbol_14 = {6, -1, -1}; - tree[7] = tint_symbol_14; - x_284_phi = true; - break; - } else { - x_282 = tree[x_276_save].leftIndex; - x_257_phi = x_282; - { - x_257 = x_257_phi; - x_256_phi = x_257; - } - continue; - } - return; - } else { - const int x_268_save = x_256; - const int x_269 = tree[x_268_save].rightIndex; - if ((x_269 == -1)) { - tree[x_268_save].rightIndex = 7; - const BST tint_symbol_15 = {6, -1, -1}; - tree[7] = tint_symbol_15; - x_284_phi = true; - break; - } else { - x_274 = tree[x_268_save].rightIndex; - x_257_phi = x_274; - { - x_257 = x_257_phi; - x_256_phi = x_257; - } - continue; - } - return; - } - return; - { - x_257 = x_257_phi; - x_256_phi = x_257; - } - } - if (x_284_phi) { - break; - } - } while (false); - int x_289_phi = 0; - bool x_317_phi = false; - 0u; - do { - x_289_phi = 0; - [loop] while (true) { - int x_315 = 0; - int x_307 = 0; - int x_290 = 0; - int x_290_phi = 0; - const int x_289 = x_289_phi; - x_317_phi = false; - if ((x_289 <= 8)) { - } else { - break; - } - const int x_296 = tree[x_289].data; - if ((17 <= x_296)) { - const int x_309_save = x_289; - const int x_310 = tree[x_309_save].leftIndex; - if ((x_310 == -1)) { - tree[x_309_save].leftIndex = 8; - const BST tint_symbol_16 = {17, -1, -1}; - tree[8] = tint_symbol_16; - x_317_phi = true; - break; - } else { - x_315 = tree[x_309_save].leftIndex; - x_290_phi = x_315; - { - x_290 = x_290_phi; - x_289_phi = x_290; - } - continue; - } - return; - } else { - const int x_301_save = x_289; - const int x_302 = tree[x_301_save].rightIndex; - if ((x_302 == -1)) { - tree[x_301_save].rightIndex = 8; - const BST tint_symbol_17 = {17, -1, -1}; - tree[8] = tint_symbol_17; - x_317_phi = true; - break; - } else { - x_307 = tree[x_301_save].rightIndex; - x_290_phi = x_307; - { - x_290 = x_290_phi; - x_289_phi = x_290; - } - continue; - } - return; - } - return; - { - x_290 = x_290_phi; - x_289_phi = x_290; - } - } - if (x_317_phi) { - break; - } - } while (false); - int x_322_phi = 0; - bool x_350_phi = false; - 0u; - do { - x_322_phi = 0; - [loop] while (true) { - int x_348 = 0; - int x_340 = 0; - int x_323 = 0; - int x_323_phi = 0; - const int x_322 = x_322_phi; - x_350_phi = false; - if ((x_322 <= 9)) { - } else { - break; - } - const int x_329 = tree[x_322].data; - if ((13 <= x_329)) { - const int x_342_save = x_322; - const int x_343 = tree[x_342_save].leftIndex; - if ((x_343 == -1)) { - tree[x_342_save].leftIndex = 9; - const BST tint_symbol_18 = {13, -1, -1}; - tree[9] = tint_symbol_18; - x_350_phi = true; - break; - } else { - x_348 = tree[x_342_save].leftIndex; - x_323_phi = x_348; - { - x_323 = x_323_phi; - x_322_phi = x_323; - } - continue; - } - return; - } else { - const int x_334_save = x_322; - const int x_335 = tree[x_334_save].rightIndex; - if ((x_335 == -1)) { - tree[x_334_save].rightIndex = 9; - const BST tint_symbol_19 = {13, -1, -1}; - tree[9] = tint_symbol_19; - x_350_phi = true; - break; - } else { - x_340 = tree[x_334_save].rightIndex; - x_323_phi = x_340; - { - x_323 = x_323_phi; - x_322_phi = x_323; - } - continue; - } - return; - } - return; - { - x_323 = x_323_phi; - x_322_phi = x_323; - } - } - if (x_350_phi) { - break; - } - } while (false); - x_353_phi = 0; - x_356_phi = 0; - x_358_phi = 0; - [loop] while (true) { - int x_381 = 0; - int x_391 = 0; - int x_396 = 0; - int x_359 = 0; - int x_354_phi = 0; - int x_357_phi = 0; - const int x_353 = x_353_phi; - x_356 = x_356_phi; - const int x_358 = x_358_phi; - if ((x_358 < 20)) { - } else { - break; - } - int x_366_phi = 0; - int x_381_phi = 0; - bool x_382_phi = false; - 0u; - do { - x_366_phi = 0; - [loop] while (true) { - const int x_366 = x_366_phi; - x_381_phi = x_353; - x_382_phi = false; - if ((x_366 != -1)) { - } else { - break; - } - const BST x_373 = tree[x_366]; - const int x_374 = x_373.data; - const int x_375 = x_373.leftIndex; - const int x_376 = x_373.rightIndex; - if ((x_374 == x_358)) { - x_381_phi = x_358; - x_382_phi = true; - break; - } - { - x_366_phi = ((x_358 > x_374) ? x_376 : x_375); - } - } - x_381 = x_381_phi; - const bool x_382 = x_382_phi; - x_354_phi = x_381; - if (x_382) { - break; - } - x_354_phi = -1; - } while (false); - int x_354 = 0; - int x_390 = 0; - int x_395 = 0; - int x_391_phi = 0; - int x_396_phi = 0; - x_354 = x_354_phi; - switch(x_358) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - x_391_phi = x_356; - if ((x_354 == asint(x_358))) { - x_390 = asint((x_356 + asint(1))); - x_391_phi = x_390; - } - x_391 = x_391_phi; - x_357_phi = x_391; - break; - } - default: { - x_396_phi = x_356; - if ((x_354 == asint(-1))) { - x_395 = asint((x_356 + asint(1))); - x_396_phi = x_395; - } - x_396 = x_396_phi; - x_357_phi = x_396; - break; - } - } - const int x_357 = x_357_phi; - { - x_359 = (x_358 + 1); - x_353_phi = x_354; - x_356_phi = x_357; - x_358_phi = x_359; - } - } - if ((x_356 == asint(20))) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_20 = {x_GLF_color}; - return tint_symbol_20; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000001F23007A140(82,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F23007A140(22,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x000001F23007A140(148,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F23007A140(214,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F23007A140(280,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F23007A140(346,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F23007A140(412,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F23007A140(478,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F23007A140(544,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F23007A140(610,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -C:\src\tint\test\Shader@0x000001F23007A140(662,7-19): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl index 68ea6e3cbe..8fe63eff80 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl @@ -950,7 +950,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..45ce82783a --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.fxc.hlsl @@ -0,0 +1,237 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_158 = data; + tree.data = x_158; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + [loop] while (true) { + const int x_167 = baseIndex; + const int x_168 = treeIndex; + if ((x_167 <= x_168)) { + } else { + break; + } + const int x_171 = data_1; + const int x_174 = tree_1[baseIndex].data; + if ((x_171 <= x_174)) { + const int x_181 = tree_1[baseIndex].leftIndex; + if ((x_181 == -1)) { + const int x_186 = baseIndex; + const int x_187 = treeIndex; + tree_1[x_186].leftIndex = x_187; + const int x_189 = treeIndex; + const BST x_191 = tree_1[x_189]; + param = x_191; + const int x_192 = data_1; + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_189] = param; + return; + } else { + const int x_198 = tree_1[baseIndex].leftIndex; + baseIndex = x_198; + continue; + } + } else { + const int x_201 = tree_1[baseIndex].rightIndex; + if ((x_201 == -1)) { + const int x_206 = baseIndex; + const int x_207 = treeIndex; + tree_1[x_206].rightIndex = x_207; + const int x_209 = treeIndex; + const BST x_211 = tree_1[x_209]; + param_2 = x_211; + const int x_212 = data_1; + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_209] = param_2; + return; + } else { + const int x_218 = tree_1[baseIndex].rightIndex; + baseIndex = x_218; + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_220 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_230 = tree_1[index]; + currentNode = x_230; + const int x_232 = currentNode.data; + const int x_233 = target; + if ((x_232 == x_233)) { + const int x_237 = target; + return x_237; + } + const int x_238 = target; + const int x_240 = currentNode.data; + if ((x_238 > x_240)) { + const int x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + const int x_248 = currentNode.leftIndex; + x_220 = x_248; + } + index = x_220; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_84 = tree_1[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + [loop] for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_132 = search_i1_(param_24); + result = x_132; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl deleted file mode 100644 index ccdf9a6b75..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl +++ /dev/null @@ -1,246 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static BST tree_1[10] = (BST[10])0; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { - const int x_158 = data; - tree.data = x_158; - tree.leftIndex = -1; - tree.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - baseIndex = 0; - [loop] while (true) { - const int x_167 = baseIndex; - const int x_168 = treeIndex; - if ((x_167 <= x_168)) { - } else { - break; - } - const int x_171 = data_1; - const int x_174 = tree_1[baseIndex].data; - if ((x_171 <= x_174)) { - const int x_181 = tree_1[baseIndex].leftIndex; - if ((x_181 == -1)) { - const int x_186 = baseIndex; - const int x_187 = treeIndex; - tree_1[x_186].leftIndex = x_187; - const int x_189 = treeIndex; - const BST x_191 = tree_1[x_189]; - param = x_191; - const int x_192 = data_1; - param_1 = x_192; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree_1[x_189] = param; - return; - } else { - const int x_198 = tree_1[baseIndex].leftIndex; - baseIndex = x_198; - continue; - } - return; - } else { - const int x_201 = tree_1[baseIndex].rightIndex; - if ((x_201 == -1)) { - const int x_206 = baseIndex; - const int x_207 = treeIndex; - tree_1[x_206].rightIndex = x_207; - const int x_209 = treeIndex; - const BST x_211 = tree_1[x_209]; - param_2 = x_211; - const int x_212 = data_1; - param_3 = x_212; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree_1[x_209] = param_2; - return; - } else { - const int x_218 = tree_1[baseIndex].rightIndex; - baseIndex = x_218; - continue; - } - return; - } - return; - } - return; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_220 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_230 = tree_1[index]; - currentNode = x_230; - const int x_232 = currentNode.data; - const int x_233 = target; - if ((x_232 == x_233)) { - const int x_237 = target; - return x_237; - } - const int x_238 = target; - const int x_240 = currentNode.data; - if ((x_238 > x_240)) { - const int x_246 = currentNode.rightIndex; - x_220 = x_246; - } else { - const int x_248 = currentNode.leftIndex; - x_220 = x_248; - } - index = x_220; - } - return -1; -} - -void main_1() { - int treeIndex_1 = 0; - BST param_4 = (BST)0; - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - int param_8 = 0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int count = 0; - int i = 0; - int result = 0; - int param_24 = 0; - treeIndex_1 = 0; - const BST x_84 = tree_1[0]; - param_4 = x_84; - param_5 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); - tree_1[0] = param_4; - treeIndex_1 = (treeIndex_1 + 1); - param_6 = treeIndex_1; - param_7 = 5; - insert_i1_i1_(param_6, param_7); - treeIndex_1 = (treeIndex_1 + 1); - param_8 = treeIndex_1; - param_9 = 12; - insert_i1_i1_(param_8, param_9); - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 15; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - param_12 = treeIndex_1; - param_13 = 7; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 8; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 2; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 6; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 17; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 13; - insert_i1_i1_(param_22, param_23); - count = 0; - i = 0; - { - [loop] for(; (i < 20); i = (i + 1)) { - param_24 = i; - const int x_132 = search_i1_(param_24); - result = x_132; - switch(i) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - if ((result == i)) { - count = (count + 1); - } - break; - } - default: { - if ((result == -1)) { - count = (count + 1); - } - break; - } - } - } - } - if ((count == 20)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {x_GLF_color}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000002912962B080(25,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl index 60e52909da..39ff0922bb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl @@ -254,7 +254,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fef3a806fc --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.fxc.hlsl @@ -0,0 +1,241 @@ +SKIP: FAILED + +vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl:85:15 warning: use of deprecated language feature: 'target' is a reserved keyword +fn search_i1_(target : ptr) -> i32 { + ^^^^^^ + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_158 = data; + tree.data = x_158; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + [loop] while (true) { + const int x_167 = baseIndex; + const int x_168 = treeIndex; + if ((x_167 <= x_168)) { + } else { + break; + } + const int x_171 = data_1; + const int x_174 = tree_1[baseIndex].data; + if ((x_171 <= x_174)) { + const int x_181 = tree_1[baseIndex].leftIndex; + if ((x_181 == -1)) { + const int x_186 = baseIndex; + const int x_187 = treeIndex; + tree_1[x_186].leftIndex = x_187; + const int x_189 = treeIndex; + const BST x_191 = tree_1[x_189]; + param = x_191; + const int x_192 = data_1; + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_189] = param; + return; + } else { + const int x_198 = tree_1[baseIndex].leftIndex; + baseIndex = x_198; + continue; + } + } else { + const int x_201 = tree_1[baseIndex].rightIndex; + if ((x_201 == -1)) { + const int x_206 = baseIndex; + const int x_207 = treeIndex; + tree_1[x_206].rightIndex = x_207; + const int x_209 = treeIndex; + const BST x_211 = tree_1[x_209]; + param_2 = x_211; + const int x_212 = data_1; + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_209] = param_2; + return; + } else { + const int x_218 = tree_1[baseIndex].rightIndex; + baseIndex = x_218; + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_220 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_230 = tree_1[index]; + currentNode = x_230; + const int x_232 = currentNode.data; + const int x_233 = target; + if ((x_232 == x_233)) { + const int x_237 = target; + return x_237; + } + const int x_238 = target; + const int x_240 = currentNode.data; + if ((x_238 > x_240)) { + const int x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + const int x_248 = currentNode.leftIndex; + x_220 = x_248; + } + index = x_220; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_84 = tree_1[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + [loop] for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_132 = search_i1_(param_24); + result = x_132; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl deleted file mode 100644 index ec6bef4f07..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl +++ /dev/null @@ -1,255 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl:58:7 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl:81:7 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl:83:5 warning: code is unreachable - return; - ^^^^^^ - -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static BST tree_1[10] = (BST[10])0; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { - const int x_158 = data; - tree.data = x_158; - tree.leftIndex = -1; - tree.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - baseIndex = 0; - [loop] while (true) { - const int x_167 = baseIndex; - const int x_168 = treeIndex; - if ((x_167 <= x_168)) { - } else { - break; - } - const int x_171 = data_1; - const int x_174 = tree_1[baseIndex].data; - if ((x_171 <= x_174)) { - const int x_181 = tree_1[baseIndex].leftIndex; - if ((x_181 == -1)) { - const int x_186 = baseIndex; - const int x_187 = treeIndex; - tree_1[x_186].leftIndex = x_187; - const int x_189 = treeIndex; - const BST x_191 = tree_1[x_189]; - param = x_191; - const int x_192 = data_1; - param_1 = x_192; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree_1[x_189] = param; - return; - } else { - const int x_198 = tree_1[baseIndex].leftIndex; - baseIndex = x_198; - continue; - } - return; - } else { - const int x_201 = tree_1[baseIndex].rightIndex; - if ((x_201 == -1)) { - const int x_206 = baseIndex; - const int x_207 = treeIndex; - tree_1[x_206].rightIndex = x_207; - const int x_209 = treeIndex; - const BST x_211 = tree_1[x_209]; - param_2 = x_211; - const int x_212 = data_1; - param_3 = x_212; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree_1[x_209] = param_2; - return; - } else { - const int x_218 = tree_1[baseIndex].rightIndex; - baseIndex = x_218; - continue; - } - return; - } - return; - } - return; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_220 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_230 = tree_1[index]; - currentNode = x_230; - const int x_232 = currentNode.data; - const int x_233 = target; - if ((x_232 == x_233)) { - const int x_237 = target; - return x_237; - } - const int x_238 = target; - const int x_240 = currentNode.data; - if ((x_238 > x_240)) { - const int x_246 = currentNode.rightIndex; - x_220 = x_246; - } else { - const int x_248 = currentNode.leftIndex; - x_220 = x_248; - } - index = x_220; - } - return -1; -} - -void main_1() { - int treeIndex_1 = 0; - BST param_4 = (BST)0; - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - int param_8 = 0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int count = 0; - int i = 0; - int result = 0; - int param_24 = 0; - treeIndex_1 = 0; - const BST x_84 = tree_1[0]; - param_4 = x_84; - param_5 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); - tree_1[0] = param_4; - treeIndex_1 = (treeIndex_1 + 1); - param_6 = treeIndex_1; - param_7 = 5; - insert_i1_i1_(param_6, param_7); - treeIndex_1 = (treeIndex_1 + 1); - param_8 = treeIndex_1; - param_9 = 12; - insert_i1_i1_(param_8, param_9); - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 15; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - param_12 = treeIndex_1; - param_13 = 7; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 8; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 2; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 6; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 17; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 13; - insert_i1_i1_(param_22, param_23); - count = 0; - i = 0; - { - [loop] for(; (i < 20); i = (i + 1)) { - param_24 = i; - const int x_132 = search_i1_(param_24); - result = x_132; - switch(i) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - if ((result == i)) { - count = (count + 1); - } - break; - } - default: { - if ((result == -1)) { - count = (count + 1); - } - break; - } - } - } - } - if ((count == 20)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {x_GLF_color}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000001CA0D820F20(25,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..99177d42a4 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.fxc.hlsl @@ -0,0 +1,251 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_169 = data; + tree.data = x_169; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + [loop] while (true) { + const int x_178 = baseIndex; + const int x_179 = treeIndex; + if ((x_178 <= x_179)) { + } else { + break; + } + const int x_182 = data_1; + const int x_185 = tree_1[baseIndex].data; + if ((x_182 <= x_185)) { + const int x_192 = tree_1[baseIndex].leftIndex; + if ((x_192 == -1)) { + const int x_197 = baseIndex; + const int x_198 = treeIndex; + tree_1[x_197].leftIndex = x_198; + const int x_200 = treeIndex; + const BST x_202 = tree_1[x_200]; + param = x_202; + const int x_203 = data_1; + param_1 = x_203; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_200] = param; + return; + } else { + const int x_209 = tree_1[baseIndex].leftIndex; + baseIndex = x_209; + continue; + } + } else { + const int x_212 = tree_1[baseIndex].rightIndex; + if ((x_212 == -1)) { + const int x_217 = baseIndex; + const int x_218 = treeIndex; + tree_1[x_217].rightIndex = x_218; + const int x_220 = treeIndex; + const BST x_222 = tree_1[x_220]; + param_2 = x_222; + const int x_223 = data_1; + param_3 = x_223; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_220] = param_2; + return; + } else { + const int x_229 = tree_1[baseIndex].rightIndex; + baseIndex = x_229; + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_231 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_241 = tree_1[index]; + currentNode = x_241; + const int x_243 = currentNode.data; + const int x_244 = target; + if ((x_243 == x_244)) { + const int x_248 = target; + return x_248; + } + const int x_249 = target; + const int x_251 = currentNode.data; + if ((x_249 > x_251)) { + const int x_257 = currentNode.rightIndex; + x_231 = x_257; + } else { + const int x_259 = currentNode.leftIndex; + x_231 = x_259; + } + index = x_231; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_88 = tree_1[0]; + param_4 = x_88; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + [loop] for(; (i < 20); i = (i + 1)) { + bool x_155 = false; + bool x_156_phi = false; + param_24 = i; + const int x_136 = search_i1_(param_24); + result = x_136; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + const bool x_149 = (result == i); + x_156_phi = x_149; + if (!(x_149)) { + const float x_154 = gl_FragCoord.x; + x_155 = (x_154 < 0.0f); + x_156_phi = x_155; + } + if (x_156_phi) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + return tint_symbol_3; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl deleted file mode 100644 index 0a769d2bcf..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl +++ /dev/null @@ -1,260 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static BST tree_1[10] = (BST[10])0; -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { - const int x_169 = data; - tree.data = x_169; - tree.leftIndex = -1; - tree.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - baseIndex = 0; - [loop] while (true) { - const int x_178 = baseIndex; - const int x_179 = treeIndex; - if ((x_178 <= x_179)) { - } else { - break; - } - const int x_182 = data_1; - const int x_185 = tree_1[baseIndex].data; - if ((x_182 <= x_185)) { - const int x_192 = tree_1[baseIndex].leftIndex; - if ((x_192 == -1)) { - const int x_197 = baseIndex; - const int x_198 = treeIndex; - tree_1[x_197].leftIndex = x_198; - const int x_200 = treeIndex; - const BST x_202 = tree_1[x_200]; - param = x_202; - const int x_203 = data_1; - param_1 = x_203; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree_1[x_200] = param; - return; - } else { - const int x_209 = tree_1[baseIndex].leftIndex; - baseIndex = x_209; - continue; - } - return; - } else { - const int x_212 = tree_1[baseIndex].rightIndex; - if ((x_212 == -1)) { - const int x_217 = baseIndex; - const int x_218 = treeIndex; - tree_1[x_217].rightIndex = x_218; - const int x_220 = treeIndex; - const BST x_222 = tree_1[x_220]; - param_2 = x_222; - const int x_223 = data_1; - param_3 = x_223; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree_1[x_220] = param_2; - return; - } else { - const int x_229 = tree_1[baseIndex].rightIndex; - baseIndex = x_229; - continue; - } - return; - } - return; - } - return; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_231 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_241 = tree_1[index]; - currentNode = x_241; - const int x_243 = currentNode.data; - const int x_244 = target; - if ((x_243 == x_244)) { - const int x_248 = target; - return x_248; - } - const int x_249 = target; - const int x_251 = currentNode.data; - if ((x_249 > x_251)) { - const int x_257 = currentNode.rightIndex; - x_231 = x_257; - } else { - const int x_259 = currentNode.leftIndex; - x_231 = x_259; - } - index = x_231; - } - return -1; -} - -void main_1() { - int treeIndex_1 = 0; - BST param_4 = (BST)0; - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - int param_8 = 0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int count = 0; - int i = 0; - int result = 0; - int param_24 = 0; - treeIndex_1 = 0; - const BST x_88 = tree_1[0]; - param_4 = x_88; - param_5 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); - tree_1[0] = param_4; - treeIndex_1 = (treeIndex_1 + 1); - param_6 = treeIndex_1; - param_7 = 5; - insert_i1_i1_(param_6, param_7); - treeIndex_1 = (treeIndex_1 + 1); - param_8 = treeIndex_1; - param_9 = 12; - insert_i1_i1_(param_8, param_9); - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 15; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - param_12 = treeIndex_1; - param_13 = 7; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 8; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 2; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 6; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 17; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 13; - insert_i1_i1_(param_22, param_23); - count = 0; - i = 0; - { - [loop] for(; (i < 20); i = (i + 1)) { - bool x_155 = false; - bool x_156_phi = false; - param_24 = i; - const int x_136 = search_i1_(param_24); - result = x_136; - switch(i) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - const bool x_149 = (result == i); - x_156_phi = x_149; - if (!(x_149)) { - const float x_154 = gl_FragCoord.x; - x_155 = (x_154 < 0.0f); - x_156_phi = x_155; - } - if (x_156_phi) { - count = (count + 1); - } - break; - } - default: { - if ((result == -1)) { - count = (count + 1); - } - break; - } - } - } - } - if ((count == 20)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_3 = {x_GLF_color}; - return tint_symbol_3; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000002A8C1306820(26,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl index e690b001af..cafa4d239c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl @@ -266,7 +266,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..78f51174c9 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.fxc.hlsl @@ -0,0 +1,255 @@ +SKIP: FAILED + +vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl:87:15 warning: use of deprecated language feature: 'target' is a reserved keyword +fn search_i1_(target : ptr) -> i32 { + ^^^^^^ + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_169 = data; + tree.data = x_169; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + [loop] while (true) { + const int x_178 = baseIndex; + const int x_179 = treeIndex; + if ((x_178 <= x_179)) { + } else { + break; + } + const int x_182 = data_1; + const int x_185 = tree_1[baseIndex].data; + if ((x_182 <= x_185)) { + const int x_192 = tree_1[baseIndex].leftIndex; + if ((x_192 == -1)) { + const int x_197 = baseIndex; + const int x_198 = treeIndex; + tree_1[x_197].leftIndex = x_198; + const int x_200 = treeIndex; + const BST x_202 = tree_1[x_200]; + param = x_202; + const int x_203 = data_1; + param_1 = x_203; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_200] = param; + return; + } else { + const int x_209 = tree_1[baseIndex].leftIndex; + baseIndex = x_209; + continue; + } + } else { + const int x_212 = tree_1[baseIndex].rightIndex; + if ((x_212 == -1)) { + const int x_217 = baseIndex; + const int x_218 = treeIndex; + tree_1[x_217].rightIndex = x_218; + const int x_220 = treeIndex; + const BST x_222 = tree_1[x_220]; + param_2 = x_222; + const int x_223 = data_1; + param_3 = x_223; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_220] = param_2; + return; + } else { + const int x_229 = tree_1[baseIndex].rightIndex; + baseIndex = x_229; + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_231 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_241 = tree_1[index]; + currentNode = x_241; + const int x_243 = currentNode.data; + const int x_244 = target; + if ((x_243 == x_244)) { + const int x_248 = target; + return x_248; + } + const int x_249 = target; + const int x_251 = currentNode.data; + if ((x_249 > x_251)) { + const int x_257 = currentNode.rightIndex; + x_231 = x_257; + } else { + const int x_259 = currentNode.leftIndex; + x_231 = x_259; + } + index = x_231; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_88 = tree_1[0]; + param_4 = x_88; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + [loop] for(; (i < 20); i = (i + 1)) { + bool x_155 = false; + bool x_156_phi = false; + param_24 = i; + const int x_136 = search_i1_(param_24); + result = x_136; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + const bool x_149 = (result == i); + x_156_phi = x_149; + if (!(x_149)) { + const float x_154 = gl_FragCoord.x; + x_155 = (x_154 < 0.0f); + x_156_phi = x_155; + } + if (x_156_phi) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + return tint_symbol_3; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl deleted file mode 100644 index 79c1046631..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl +++ /dev/null @@ -1,269 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl:60:7 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl:83:7 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl:85:5 warning: code is unreachable - return; - ^^^^^^ - -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static BST tree_1[10] = (BST[10])0; -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { - const int x_169 = data; - tree.data = x_169; - tree.leftIndex = -1; - tree.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - baseIndex = 0; - [loop] while (true) { - const int x_178 = baseIndex; - const int x_179 = treeIndex; - if ((x_178 <= x_179)) { - } else { - break; - } - const int x_182 = data_1; - const int x_185 = tree_1[baseIndex].data; - if ((x_182 <= x_185)) { - const int x_192 = tree_1[baseIndex].leftIndex; - if ((x_192 == -1)) { - const int x_197 = baseIndex; - const int x_198 = treeIndex; - tree_1[x_197].leftIndex = x_198; - const int x_200 = treeIndex; - const BST x_202 = tree_1[x_200]; - param = x_202; - const int x_203 = data_1; - param_1 = x_203; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree_1[x_200] = param; - return; - } else { - const int x_209 = tree_1[baseIndex].leftIndex; - baseIndex = x_209; - continue; - } - return; - } else { - const int x_212 = tree_1[baseIndex].rightIndex; - if ((x_212 == -1)) { - const int x_217 = baseIndex; - const int x_218 = treeIndex; - tree_1[x_217].rightIndex = x_218; - const int x_220 = treeIndex; - const BST x_222 = tree_1[x_220]; - param_2 = x_222; - const int x_223 = data_1; - param_3 = x_223; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree_1[x_220] = param_2; - return; - } else { - const int x_229 = tree_1[baseIndex].rightIndex; - baseIndex = x_229; - continue; - } - return; - } - return; - } - return; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_231 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_241 = tree_1[index]; - currentNode = x_241; - const int x_243 = currentNode.data; - const int x_244 = target; - if ((x_243 == x_244)) { - const int x_248 = target; - return x_248; - } - const int x_249 = target; - const int x_251 = currentNode.data; - if ((x_249 > x_251)) { - const int x_257 = currentNode.rightIndex; - x_231 = x_257; - } else { - const int x_259 = currentNode.leftIndex; - x_231 = x_259; - } - index = x_231; - } - return -1; -} - -void main_1() { - int treeIndex_1 = 0; - BST param_4 = (BST)0; - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - int param_8 = 0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int count = 0; - int i = 0; - int result = 0; - int param_24 = 0; - treeIndex_1 = 0; - const BST x_88 = tree_1[0]; - param_4 = x_88; - param_5 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); - tree_1[0] = param_4; - treeIndex_1 = (treeIndex_1 + 1); - param_6 = treeIndex_1; - param_7 = 5; - insert_i1_i1_(param_6, param_7); - treeIndex_1 = (treeIndex_1 + 1); - param_8 = treeIndex_1; - param_9 = 12; - insert_i1_i1_(param_8, param_9); - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 15; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - param_12 = treeIndex_1; - param_13 = 7; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 8; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 2; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 6; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 17; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 13; - insert_i1_i1_(param_22, param_23); - count = 0; - i = 0; - { - [loop] for(; (i < 20); i = (i + 1)) { - bool x_155 = false; - bool x_156_phi = false; - param_24 = i; - const int x_136 = search_i1_(param_24); - result = x_136; - switch(i) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - const bool x_149 = (result == i); - x_156_phi = x_149; - if (!(x_149)) { - const float x_154 = gl_FragCoord.x; - x_155 = (x_154 < 0.0f); - x_156_phi = x_155; - } - if (x_156_phi) { - count = (count + 1); - } - break; - } - default: { - if ((result == -1)) { - count = (count + 1); - } - break; - } - } - } - } - if ((count == 20)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_1 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_3 = {x_GLF_color}; - return tint_symbol_3; -} - -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000001BE36107D80(26,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl index ec9d97fd00..0bd3cb85cb 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl @@ -284,7 +284,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..e8e3b26b21 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,237 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree[10] = (BST[10])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { + const int x_158 = data; + node.data = x_158; + node.leftIndex = -1; + node.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + [loop] while (true) { + const int x_167 = baseIndex; + const int x_168 = treeIndex; + if ((x_167 <= x_168)) { + } else { + break; + } + const int x_171 = data_1; + const int x_174 = tree[baseIndex].data; + if ((x_171 <= x_174)) { + const int x_181 = tree[baseIndex].leftIndex; + if ((x_181 == -1)) { + const int x_186 = baseIndex; + const int x_187 = treeIndex; + tree[x_186].leftIndex = x_187; + const int x_189 = treeIndex; + const BST x_191 = tree[x_189]; + param = x_191; + const int x_192 = data_1; + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree[x_189] = param; + return; + } else { + const int x_198 = tree[baseIndex].leftIndex; + baseIndex = x_198; + continue; + } + } else { + const int x_201 = tree[baseIndex].rightIndex; + if ((x_201 == -1)) { + const int x_206 = baseIndex; + const int x_207 = treeIndex; + tree[x_206].rightIndex = x_207; + const int x_209 = treeIndex; + const BST x_211 = tree[x_209]; + param_2 = x_211; + const int x_212 = data_1; + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree[x_209] = param_2; + return; + } else { + const int x_218 = tree[baseIndex].rightIndex; + baseIndex = x_218; + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_220 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_230 = tree[index]; + currentNode = x_230; + const int x_232 = currentNode.data; + const int x_233 = target; + if ((x_232 == x_233)) { + const int x_237 = target; + return x_237; + } + const int x_238 = target; + const int x_240 = currentNode.data; + if ((x_238 > x_240)) { + const int x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + const int x_248 = currentNode.leftIndex; + x_220 = x_248; + } + index = x_220; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_84 = tree[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + [loop] for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_132 = search_i1_(param_24); + result = x_132; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl deleted file mode 100644 index cacbb8cbc1..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,246 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static BST tree[10] = (BST[10])0; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { - const int x_158 = data; - node.data = x_158; - node.leftIndex = -1; - node.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - baseIndex = 0; - [loop] while (true) { - const int x_167 = baseIndex; - const int x_168 = treeIndex; - if ((x_167 <= x_168)) { - } else { - break; - } - const int x_171 = data_1; - const int x_174 = tree[baseIndex].data; - if ((x_171 <= x_174)) { - const int x_181 = tree[baseIndex].leftIndex; - if ((x_181 == -1)) { - const int x_186 = baseIndex; - const int x_187 = treeIndex; - tree[x_186].leftIndex = x_187; - const int x_189 = treeIndex; - const BST x_191 = tree[x_189]; - param = x_191; - const int x_192 = data_1; - param_1 = x_192; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree[x_189] = param; - return; - } else { - const int x_198 = tree[baseIndex].leftIndex; - baseIndex = x_198; - continue; - } - return; - } else { - const int x_201 = tree[baseIndex].rightIndex; - if ((x_201 == -1)) { - const int x_206 = baseIndex; - const int x_207 = treeIndex; - tree[x_206].rightIndex = x_207; - const int x_209 = treeIndex; - const BST x_211 = tree[x_209]; - param_2 = x_211; - const int x_212 = data_1; - param_3 = x_212; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree[x_209] = param_2; - return; - } else { - const int x_218 = tree[baseIndex].rightIndex; - baseIndex = x_218; - continue; - } - return; - } - return; - } - return; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_220 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_230 = tree[index]; - currentNode = x_230; - const int x_232 = currentNode.data; - const int x_233 = target; - if ((x_232 == x_233)) { - const int x_237 = target; - return x_237; - } - const int x_238 = target; - const int x_240 = currentNode.data; - if ((x_238 > x_240)) { - const int x_246 = currentNode.rightIndex; - x_220 = x_246; - } else { - const int x_248 = currentNode.leftIndex; - x_220 = x_248; - } - index = x_220; - } - return -1; -} - -void main_1() { - int treeIndex_1 = 0; - BST param_4 = (BST)0; - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - int param_8 = 0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int count = 0; - int i = 0; - int result = 0; - int param_24 = 0; - treeIndex_1 = 0; - const BST x_84 = tree[0]; - param_4 = x_84; - param_5 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); - tree[0] = param_4; - treeIndex_1 = (treeIndex_1 + 1); - param_6 = treeIndex_1; - param_7 = 5; - insert_i1_i1_(param_6, param_7); - treeIndex_1 = (treeIndex_1 + 1); - param_8 = treeIndex_1; - param_9 = 12; - insert_i1_i1_(param_8, param_9); - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 15; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - param_12 = treeIndex_1; - param_13 = 7; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 8; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 2; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 6; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 17; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 13; - insert_i1_i1_(param_22, param_23); - count = 0; - i = 0; - { - [loop] for(; (i < 20); i = (i + 1)) { - param_24 = i; - const int x_132 = search_i1_(param_24); - result = x_132; - switch(i) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - if ((result == i)) { - count = (count + 1); - } - break; - } - default: { - if ((result == -1)) { - count = (count + 1); - } - break; - } - } - } - } - if ((count == 20)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {x_GLF_color}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x0000025CD445EF60(25,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl index e6989481e7..5bd37fe4c2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl @@ -254,7 +254,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..03552a837b --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,241 @@ +SKIP: FAILED + +vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl:85:15 warning: use of deprecated language feature: 'target' is a reserved keyword +fn search_i1_(target : ptr) -> i32 { + ^^^^^^ + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree[10] = (BST[10])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { + const int x_158 = data; + node.data = x_158; + node.leftIndex = -1; + node.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + [loop] while (true) { + const int x_167 = baseIndex; + const int x_168 = treeIndex; + if ((x_167 <= x_168)) { + } else { + break; + } + const int x_171 = data_1; + const int x_174 = tree[baseIndex].data; + if ((x_171 <= x_174)) { + const int x_181 = tree[baseIndex].leftIndex; + if ((x_181 == -1)) { + const int x_186 = baseIndex; + const int x_187 = treeIndex; + tree[x_186].leftIndex = x_187; + const int x_189 = treeIndex; + const BST x_191 = tree[x_189]; + param = x_191; + const int x_192 = data_1; + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree[x_189] = param; + return; + } else { + const int x_198 = tree[baseIndex].leftIndex; + baseIndex = x_198; + continue; + } + } else { + const int x_201 = tree[baseIndex].rightIndex; + if ((x_201 == -1)) { + const int x_206 = baseIndex; + const int x_207 = treeIndex; + tree[x_206].rightIndex = x_207; + const int x_209 = treeIndex; + const BST x_211 = tree[x_209]; + param_2 = x_211; + const int x_212 = data_1; + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree[x_209] = param_2; + return; + } else { + const int x_218 = tree[baseIndex].rightIndex; + baseIndex = x_218; + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_220 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_230 = tree[index]; + currentNode = x_230; + const int x_232 = currentNode.data; + const int x_233 = target; + if ((x_232 == x_233)) { + const int x_237 = target; + return x_237; + } + const int x_238 = target; + const int x_240 = currentNode.data; + if ((x_238 > x_240)) { + const int x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + const int x_248 = currentNode.leftIndex; + x_220 = x_248; + } + index = x_220; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_84 = tree[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + [loop] for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_132 = search_i1_(param_24); + result = x_132; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + return tint_symbol_1; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl deleted file mode 100644 index ece967e204..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,255 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl:58:7 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl:81:7 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl:83:5 warning: code is unreachable - return; - ^^^^^^ - -struct BST { - int data; - int leftIndex; - int rightIndex; -}; - -static BST tree[10] = (BST[10])0; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { - const int x_158 = data; - node.data = x_158; - node.leftIndex = -1; - node.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - baseIndex = 0; - [loop] while (true) { - const int x_167 = baseIndex; - const int x_168 = treeIndex; - if ((x_167 <= x_168)) { - } else { - break; - } - const int x_171 = data_1; - const int x_174 = tree[baseIndex].data; - if ((x_171 <= x_174)) { - const int x_181 = tree[baseIndex].leftIndex; - if ((x_181 == -1)) { - const int x_186 = baseIndex; - const int x_187 = treeIndex; - tree[x_186].leftIndex = x_187; - const int x_189 = treeIndex; - const BST x_191 = tree[x_189]; - param = x_191; - const int x_192 = data_1; - param_1 = x_192; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree[x_189] = param; - return; - } else { - const int x_198 = tree[baseIndex].leftIndex; - baseIndex = x_198; - continue; - } - return; - } else { - const int x_201 = tree[baseIndex].rightIndex; - if ((x_201 == -1)) { - const int x_206 = baseIndex; - const int x_207 = treeIndex; - tree[x_206].rightIndex = x_207; - const int x_209 = treeIndex; - const BST x_211 = tree[x_209]; - param_2 = x_211; - const int x_212 = data_1; - param_3 = x_212; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree[x_209] = param_2; - return; - } else { - const int x_218 = tree[baseIndex].rightIndex; - baseIndex = x_218; - continue; - } - return; - } - return; - } - return; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_220 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_230 = tree[index]; - currentNode = x_230; - const int x_232 = currentNode.data; - const int x_233 = target; - if ((x_232 == x_233)) { - const int x_237 = target; - return x_237; - } - const int x_238 = target; - const int x_240 = currentNode.data; - if ((x_238 > x_240)) { - const int x_246 = currentNode.rightIndex; - x_220 = x_246; - } else { - const int x_248 = currentNode.leftIndex; - x_220 = x_248; - } - index = x_220; - } - return -1; -} - -void main_1() { - int treeIndex_1 = 0; - BST param_4 = (BST)0; - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - int param_8 = 0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int count = 0; - int i = 0; - int result = 0; - int param_24 = 0; - treeIndex_1 = 0; - const BST x_84 = tree[0]; - param_4 = x_84; - param_5 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); - tree[0] = param_4; - treeIndex_1 = (treeIndex_1 + 1); - param_6 = treeIndex_1; - param_7 = 5; - insert_i1_i1_(param_6, param_7); - treeIndex_1 = (treeIndex_1 + 1); - param_8 = treeIndex_1; - param_9 = 12; - insert_i1_i1_(param_8, param_9); - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 15; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - param_12 = treeIndex_1; - param_13 = 7; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 8; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 2; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 6; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 17; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 13; - insert_i1_i1_(param_22, param_23); - count = 0; - i = 0; - { - [loop] for(; (i < 20); i = (i + 1)) { - param_24 = i; - const int x_132 = search_i1_(param_24); - result = x_132; - switch(i) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - if ((result == i)) { - count = (count + 1); - } - break; - } - default: { - if ((result == -1)) { - count = (count + 1); - } - break; - } - } - } - } - if ((count == 20)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {x_GLF_color}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000001737220A3A0(25,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..7ccd78fa26 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.fxc.hlsl @@ -0,0 +1,280 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static BST tree[10] = (BST[10])0; +cbuffer cbuffer_x_50 : register(b0, space0) { + uint4 x_50[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { + const int x_208 = data; + node.data = x_208; + node.leftIndex = -1; + node.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + [loop] while (true) { + const int x_217 = baseIndex; + const int x_218 = treeIndex; + if ((x_217 <= x_218)) { + } else { + break; + } + const int x_221 = data_1; + const int x_224 = tree[baseIndex].data; + if ((x_221 <= x_224)) { + const int x_231 = tree[baseIndex].leftIndex; + if ((x_231 == -1)) { + const int x_236 = baseIndex; + const int x_237 = treeIndex; + tree[x_236].leftIndex = x_237; + const int x_239 = treeIndex; + const BST x_241 = tree[x_239]; + param = x_241; + const int x_242 = data_1; + param_1 = x_242; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree[x_239] = param; + return; + } else { + const int x_248 = tree[baseIndex].leftIndex; + baseIndex = x_248; + continue; + } + } else { + const int x_251 = tree[baseIndex].rightIndex; + if ((x_251 == -1)) { + const int x_256 = baseIndex; + const int x_257 = treeIndex; + tree[x_256].rightIndex = x_257; + const int x_259 = treeIndex; + const BST x_261 = tree[x_259]; + param_2 = x_261; + const int x_262 = data_1; + param_3 = x_262; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree[x_259] = param_2; + return; + } else { + const int x_268 = tree[baseIndex].rightIndex; + baseIndex = x_268; + continue; + } + } + } + return; +} + +int identity_i1_(inout int a) { + const int x_202 = a; + const int x_203 = a; + { + int tint_symbol_1[10] = obj.numbers; + tint_symbol_1[x_202] = x_203; + obj.numbers = tint_symbol_1; + } + const int x_206 = obj.numbers[2]; + return x_206; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_270 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_280 = tree[index]; + currentNode = x_280; + const int x_282 = currentNode.data; + const int x_283 = target; + if ((x_282 == x_283)) { + const int x_287 = target; + return x_287; + } + const int x_288 = target; + const int x_290 = currentNode.data; + if ((x_288 > x_290)) { + const int x_296 = currentNode.rightIndex; + x_270 = x_296; + } else { + const int x_298 = currentNode.leftIndex; + x_270 = x_298; + } + index = x_270; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int pp = 0; + int looplimiter0 = 0; + int i = 0; + int param_24 = 0; + int count = 0; + int i_1 = 0; + int result = 0; + int param_25 = 0; + treeIndex_1 = 0; + const BST x_101 = tree[0]; + param_4 = x_101; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + pp = 0; + looplimiter0 = 0; + i = 0; + { + [loop] for(; (i < 10000); i = (i + 1)) { + const int x_148 = looplimiter0; + const float x_150 = asfloat(x_50[0].y); + if ((x_148 >= int(x_150))) { + const float x_156 = asfloat(x_50[0].y); + param_24 = (1 + int(x_156)); + const int x_159 = identity_i1_(param_24); + pp = x_159; + break; + } + looplimiter0 = (looplimiter0 + 1); + } + } + if ((pp != 2)) { + return; + } + count = 0; + i_1 = 0; + { + [loop] for(; (i_1 < 20); i_1 = (i_1 + 1)) { + param_25 = i_1; + const int x_176 = search_i1_(param_25); + result = x_176; + switch(i_1) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i_1)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main() { + const main_out inner_result = main_inner(); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl deleted file mode 100644 index ade30345d3..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl +++ /dev/null @@ -1,289 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -warning: code is unreachable -warning: code is unreachable -warning: code is unreachable -struct BST { - int data; - int leftIndex; - int rightIndex; -}; -struct QuicksortObject { - int numbers[10]; -}; - -static QuicksortObject obj = (QuicksortObject)0; -static BST tree[10] = (BST[10])0; -cbuffer cbuffer_x_50 : register(b0, space0) { - uint4 x_50[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { - const int x_208 = data; - node.data = x_208; - node.leftIndex = -1; - node.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - baseIndex = 0; - [loop] while (true) { - const int x_217 = baseIndex; - const int x_218 = treeIndex; - if ((x_217 <= x_218)) { - } else { - break; - } - const int x_221 = data_1; - const int x_224 = tree[baseIndex].data; - if ((x_221 <= x_224)) { - const int x_231 = tree[baseIndex].leftIndex; - if ((x_231 == -1)) { - const int x_236 = baseIndex; - const int x_237 = treeIndex; - tree[x_236].leftIndex = x_237; - const int x_239 = treeIndex; - const BST x_241 = tree[x_239]; - param = x_241; - const int x_242 = data_1; - param_1 = x_242; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree[x_239] = param; - return; - } else { - const int x_248 = tree[baseIndex].leftIndex; - baseIndex = x_248; - continue; - } - return; - } else { - const int x_251 = tree[baseIndex].rightIndex; - if ((x_251 == -1)) { - const int x_256 = baseIndex; - const int x_257 = treeIndex; - tree[x_256].rightIndex = x_257; - const int x_259 = treeIndex; - const BST x_261 = tree[x_259]; - param_2 = x_261; - const int x_262 = data_1; - param_3 = x_262; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree[x_259] = param_2; - return; - } else { - const int x_268 = tree[baseIndex].rightIndex; - baseIndex = x_268; - continue; - } - return; - } - return; - } - return; -} - -int identity_i1_(inout int a) { - const int x_202 = a; - const int x_203 = a; - { - int tint_symbol_1[10] = obj.numbers; - tint_symbol_1[x_202] = x_203; - obj.numbers = tint_symbol_1; - } - const int x_206 = obj.numbers[2]; - return x_206; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_270 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_280 = tree[index]; - currentNode = x_280; - const int x_282 = currentNode.data; - const int x_283 = target; - if ((x_282 == x_283)) { - const int x_287 = target; - return x_287; - } - const int x_288 = target; - const int x_290 = currentNode.data; - if ((x_288 > x_290)) { - const int x_296 = currentNode.rightIndex; - x_270 = x_296; - } else { - const int x_298 = currentNode.leftIndex; - x_270 = x_298; - } - index = x_270; - } - return -1; -} - -void main_1() { - int treeIndex_1 = 0; - BST param_4 = (BST)0; - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - int param_8 = 0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int pp = 0; - int looplimiter0 = 0; - int i = 0; - int param_24 = 0; - int count = 0; - int i_1 = 0; - int result = 0; - int param_25 = 0; - treeIndex_1 = 0; - const BST x_101 = tree[0]; - param_4 = x_101; - param_5 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); - tree[0] = param_4; - treeIndex_1 = (treeIndex_1 + 1); - param_6 = treeIndex_1; - param_7 = 5; - insert_i1_i1_(param_6, param_7); - treeIndex_1 = (treeIndex_1 + 1); - param_8 = treeIndex_1; - param_9 = 12; - insert_i1_i1_(param_8, param_9); - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 15; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - param_12 = treeIndex_1; - param_13 = 7; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 8; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 2; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 6; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 17; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 13; - insert_i1_i1_(param_22, param_23); - pp = 0; - looplimiter0 = 0; - i = 0; - { - [loop] for(; (i < 10000); i = (i + 1)) { - const int x_148 = looplimiter0; - const float x_150 = asfloat(x_50[0].y); - if ((x_148 >= int(x_150))) { - const float x_156 = asfloat(x_50[0].y); - param_24 = (1 + int(x_156)); - const int x_159 = identity_i1_(param_24); - pp = x_159; - break; - } - looplimiter0 = (looplimiter0 + 1); - } - } - if ((pp != 2)) { - return; - } - count = 0; - i_1 = 0; - { - [loop] for(; (i_1 < 20); i_1 = (i_1 + 1)) { - param_25 = i_1; - const int x_176 = search_i1_(param_25); - result = x_176; - switch(i_1) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - if ((result == i_1)) { - count = (count + 1); - } - break; - } - default: { - if ((result == -1)) { - count = (count + 1); - } - break; - } - } - } - } - if ((count == 20)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main() { - const main_out inner_result = main_inner(); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x0000019568397DE0(32,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl index c1f21a43dd..576d845e6c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl @@ -308,7 +308,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..482ab2b4bb --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.fxc.hlsl @@ -0,0 +1,284 @@ +SKIP: FAILED + +vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:105:15 warning: use of deprecated language feature: 'target' is a reserved keyword +fn search_i1_(target : ptr) -> i32 { + ^^^^^^ + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static BST tree[10] = (BST[10])0; +cbuffer cbuffer_x_50 : register(b0, space0) { + uint4 x_50[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { + const int x_208 = data; + node.data = x_208; + node.leftIndex = -1; + node.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + [loop] while (true) { + const int x_217 = baseIndex; + const int x_218 = treeIndex; + if ((x_217 <= x_218)) { + } else { + break; + } + const int x_221 = data_1; + const int x_224 = tree[baseIndex].data; + if ((x_221 <= x_224)) { + const int x_231 = tree[baseIndex].leftIndex; + if ((x_231 == -1)) { + const int x_236 = baseIndex; + const int x_237 = treeIndex; + tree[x_236].leftIndex = x_237; + const int x_239 = treeIndex; + const BST x_241 = tree[x_239]; + param = x_241; + const int x_242 = data_1; + param_1 = x_242; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree[x_239] = param; + return; + } else { + const int x_248 = tree[baseIndex].leftIndex; + baseIndex = x_248; + continue; + } + } else { + const int x_251 = tree[baseIndex].rightIndex; + if ((x_251 == -1)) { + const int x_256 = baseIndex; + const int x_257 = treeIndex; + tree[x_256].rightIndex = x_257; + const int x_259 = treeIndex; + const BST x_261 = tree[x_259]; + param_2 = x_261; + const int x_262 = data_1; + param_3 = x_262; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree[x_259] = param_2; + return; + } else { + const int x_268 = tree[baseIndex].rightIndex; + baseIndex = x_268; + continue; + } + } + } + return; +} + +int identity_i1_(inout int a) { + const int x_202 = a; + const int x_203 = a; + { + int tint_symbol_1[10] = obj.numbers; + tint_symbol_1[x_202] = x_203; + obj.numbers = tint_symbol_1; + } + const int x_206 = obj.numbers[2]; + return x_206; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_270 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_280 = tree[index]; + currentNode = x_280; + const int x_282 = currentNode.data; + const int x_283 = target; + if ((x_282 == x_283)) { + const int x_287 = target; + return x_287; + } + const int x_288 = target; + const int x_290 = currentNode.data; + if ((x_288 > x_290)) { + const int x_296 = currentNode.rightIndex; + x_270 = x_296; + } else { + const int x_298 = currentNode.leftIndex; + x_270 = x_298; + } + index = x_270; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int pp = 0; + int looplimiter0 = 0; + int i = 0; + int param_24 = 0; + int count = 0; + int i_1 = 0; + int result = 0; + int param_25 = 0; + treeIndex_1 = 0; + const BST x_101 = tree[0]; + param_4 = x_101; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + pp = 0; + looplimiter0 = 0; + i = 0; + { + [loop] for(; (i < 10000); i = (i + 1)) { + const int x_148 = looplimiter0; + const float x_150 = asfloat(x_50[0].y); + if ((x_148 >= int(x_150))) { + const float x_156 = asfloat(x_50[0].y); + param_24 = (1 + int(x_156)); + const int x_159 = identity_i1_(param_24); + pp = x_159; + break; + } + looplimiter0 = (looplimiter0 + 1); + } + } + if ((pp != 2)) { + return; + } + count = 0; + i_1 = 0; + { + [loop] for(; (i_1 < 20); i_1 = (i_1 + 1)) { + param_25 = i_1; + const int x_176 = search_i1_(param_25); + result = x_176; + switch(i_1) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i_1)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_4 = {x_GLF_color}; + return tint_symbol_4; +} + +tint_symbol_2 main() { + const main_out inner_result = main_inner(); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl deleted file mode 100644 index f44372ebd4..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl +++ /dev/null @@ -1,298 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:70:7 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:93:7 warning: code is unreachable - return; - ^^^^^^ - -vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:95:5 warning: code is unreachable - return; - ^^^^^^ - -struct BST { - int data; - int leftIndex; - int rightIndex; -}; -struct QuicksortObject { - int numbers[10]; -}; - -static QuicksortObject obj = (QuicksortObject)0; -static BST tree[10] = (BST[10])0; -cbuffer cbuffer_x_50 : register(b0, space0) { - uint4 x_50[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { - const int x_208 = data; - node.data = x_208; - node.leftIndex = -1; - node.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - baseIndex = 0; - [loop] while (true) { - const int x_217 = baseIndex; - const int x_218 = treeIndex; - if ((x_217 <= x_218)) { - } else { - break; - } - const int x_221 = data_1; - const int x_224 = tree[baseIndex].data; - if ((x_221 <= x_224)) { - const int x_231 = tree[baseIndex].leftIndex; - if ((x_231 == -1)) { - const int x_236 = baseIndex; - const int x_237 = treeIndex; - tree[x_236].leftIndex = x_237; - const int x_239 = treeIndex; - const BST x_241 = tree[x_239]; - param = x_241; - const int x_242 = data_1; - param_1 = x_242; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree[x_239] = param; - return; - } else { - const int x_248 = tree[baseIndex].leftIndex; - baseIndex = x_248; - continue; - } - return; - } else { - const int x_251 = tree[baseIndex].rightIndex; - if ((x_251 == -1)) { - const int x_256 = baseIndex; - const int x_257 = treeIndex; - tree[x_256].rightIndex = x_257; - const int x_259 = treeIndex; - const BST x_261 = tree[x_259]; - param_2 = x_261; - const int x_262 = data_1; - param_3 = x_262; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree[x_259] = param_2; - return; - } else { - const int x_268 = tree[baseIndex].rightIndex; - baseIndex = x_268; - continue; - } - return; - } - return; - } - return; -} - -int identity_i1_(inout int a) { - const int x_202 = a; - const int x_203 = a; - { - int tint_symbol_1[10] = obj.numbers; - tint_symbol_1[x_202] = x_203; - obj.numbers = tint_symbol_1; - } - const int x_206 = obj.numbers[2]; - return x_206; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_270 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_280 = tree[index]; - currentNode = x_280; - const int x_282 = currentNode.data; - const int x_283 = target; - if ((x_282 == x_283)) { - const int x_287 = target; - return x_287; - } - const int x_288 = target; - const int x_290 = currentNode.data; - if ((x_288 > x_290)) { - const int x_296 = currentNode.rightIndex; - x_270 = x_296; - } else { - const int x_298 = currentNode.leftIndex; - x_270 = x_298; - } - index = x_270; - } - return -1; -} - -void main_1() { - int treeIndex_1 = 0; - BST param_4 = (BST)0; - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - int param_8 = 0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int pp = 0; - int looplimiter0 = 0; - int i = 0; - int param_24 = 0; - int count = 0; - int i_1 = 0; - int result = 0; - int param_25 = 0; - treeIndex_1 = 0; - const BST x_101 = tree[0]; - param_4 = x_101; - param_5 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); - tree[0] = param_4; - treeIndex_1 = (treeIndex_1 + 1); - param_6 = treeIndex_1; - param_7 = 5; - insert_i1_i1_(param_6, param_7); - treeIndex_1 = (treeIndex_1 + 1); - param_8 = treeIndex_1; - param_9 = 12; - insert_i1_i1_(param_8, param_9); - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 15; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - param_12 = treeIndex_1; - param_13 = 7; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 8; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 2; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 6; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 17; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 13; - insert_i1_i1_(param_22, param_23); - pp = 0; - looplimiter0 = 0; - i = 0; - { - [loop] for(; (i < 10000); i = (i + 1)) { - const int x_148 = looplimiter0; - const float x_150 = asfloat(x_50[0].y); - if ((x_148 >= int(x_150))) { - const float x_156 = asfloat(x_50[0].y); - param_24 = (1 + int(x_156)); - const int x_159 = identity_i1_(param_24); - pp = x_159; - break; - } - looplimiter0 = (looplimiter0 + 1); - } - } - if ((pp != 2)) { - return; - } - count = 0; - i_1 = 0; - { - [loop] for(; (i_1 < 20); i_1 = (i_1 + 1)) { - param_25 = i_1; - const int x_176 = search_i1_(param_25); - result = x_176; - switch(i_1) { - case 2: - case 5: - case 6: - case 7: - case 8: - case 9: - case 12: - case 13: - case 15: - case 17: { - if ((result == i_1)) { - count = (count + 1); - } - break; - } - default: { - if ((result == -1)) { - count = (count + 1); - } - break; - } - } - } - } - if ((count == 20)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } else { - x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_2 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_4 = {x_GLF_color}; - return tint_symbol_4; -} - -tint_symbol_2 main() { - const main_out inner_result = main_inner(); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x0000016D6EA06C40(32,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl index 7b48be9242..6a560bbe0b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl @@ -59,7 +59,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl index 3a8aca003a..3fcd20f7df 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl @@ -209,7 +209,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl index 594f9f8995..f612661914 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl @@ -107,7 +107,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl index 14441ba014..5882e5ba53 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl @@ -123,7 +123,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl index 0013539784..d8b4269431 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl @@ -110,7 +110,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl index 81e620c736..bdbe598496 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl @@ -124,7 +124,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl index c2c1977c59..e149872449 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl @@ -139,7 +139,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl index b324fbff29..8ae40e00ac 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl @@ -112,7 +112,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl index 1c47a912e9..5ce31cab5f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl @@ -331,7 +331,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl index 0cd476e5bd..803c0719ab 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl @@ -335,7 +335,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl index bdd78d3aad..41563d7cef 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl @@ -307,7 +307,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl index 5e852c6fda..2c4ecdc01c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl @@ -271,7 +271,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl index 046de74739..a84e86bf8e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl @@ -255,7 +255,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) x_GLF_pos_param : vec4) -> main_out { x_GLF_pos = x_GLF_pos_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl index 206c4d1197..fab590f1de 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl @@ -13,7 +13,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@location(0) frag_color_param : vec4) -> main_out { frag_color = frag_color_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl index 692a93a320..e2ba710443 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl @@ -266,7 +266,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) x_GLF_pos_param : vec4) -> main_out { x_GLF_pos = x_GLF_pos_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl index 1a71e0ca2f..c920db8845 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl @@ -253,7 +253,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) x_GLF_pos_param : vec4) -> main_out { x_GLF_pos = x_GLF_pos_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl index c3d618504d..4c787cd9aa 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl @@ -259,7 +259,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) x_GLF_pos_param : vec4) -> main_out { x_GLF_pos = x_GLF_pos_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl index 64489a9a9e..7dbd3fc4f2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl @@ -264,7 +264,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) x_GLF_pos_param : vec4) -> main_out { x_GLF_pos = x_GLF_pos_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl index a3c48021fd..1f9f0749b5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl @@ -117,7 +117,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl index d74e2b4cfa..776e91571d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl @@ -134,7 +134,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl index ba05600951..e531c8b319 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl @@ -125,7 +125,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl index 09c4afbdb6..0d8b91a350 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl @@ -154,7 +154,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl index 00375d4ffe..79dd9067df 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl @@ -125,7 +125,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl index febe37b955..373fca2210 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl @@ -119,7 +119,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl index 9dfb23450d..b491c61d09 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl @@ -163,7 +163,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl index bf21950372..753ce4fe33 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl @@ -43,7 +43,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl index 9c94b7e573..d7ed97dc33 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl @@ -44,7 +44,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl index aed459635d..56f0b19489 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl @@ -24,7 +24,7 @@ struct main_out { x_3_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_3); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl index ee8dc03b93..931939d2b4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl @@ -28,7 +28,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl index d87c600cc5..cdddf1fc52 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl @@ -47,7 +47,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl index 0290964feb..41e5cfeaad 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl @@ -66,7 +66,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl index 68b1a0e28a..05be13b4b2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl @@ -18,7 +18,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl index 349f964f53..44c1c317a9 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl @@ -66,7 +66,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl index c1f5d4a802..33f736c71b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl @@ -33,7 +33,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl index 787c25f0fa..dde0affa7f 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl @@ -101,7 +101,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl index dbcb808465..56be7c38dd 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl @@ -91,7 +91,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 18, 6) +@compute @workgroup_size(1, 18, 6) fn main() { main_1(); } diff --git a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl index dbd9c5a602..01508b734a 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl @@ -61,7 +61,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl index 3603274fb9..ab3430f273 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl @@ -71,7 +71,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl index 6ce6f521a4..309d5e12f5 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl @@ -60,7 +60,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl index dd12134989..1dc822f95d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl @@ -84,7 +84,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl index 060017b39c..d07a278cd7 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl @@ -55,7 +55,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { main_1(); } diff --git a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.dxc.hlsl new file mode 100755 index 0000000000..0f5cc33a5f --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.dxc.hlsl @@ -0,0 +1,56 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int GLF_dead6index = 0; + int GLF_dead6currentNode = 0; + int donor_replacementGLF_dead6tree[1] = (int[1])0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + GLF_dead6index = 0; + const float x_34 = asfloat(x_6[0].y); + if ((x_34 < 0.0f)) { + [loop] while (true) { + if (true) { + } else { + break; + } + const int x_10 = donor_replacementGLF_dead6tree[GLF_dead6index]; + GLF_dead6currentNode = x_10; + GLF_dead6index = GLF_dead6currentNode; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:40: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.fxc.hlsl new file mode 100755 index 0000000000..bea15f81e7 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int GLF_dead6index = 0; + int GLF_dead6currentNode = 0; + int donor_replacementGLF_dead6tree[1] = (int[1])0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + GLF_dead6index = 0; + const float x_34 = asfloat(x_6[0].y); + if ((x_34 < 0.0f)) { + [loop] while (true) { + if (true) { + } else { + break; + } + const int x_10 = donor_replacementGLF_dead6tree[GLF_dead6index]; + GLF_dead6currentNode = x_10; + GLF_dead6index = GLF_dead6currentNode; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl deleted file mode 100755 index 033e5654eb..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl +++ /dev/null @@ -1,53 +0,0 @@ -SKIP: FAILED - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_6 : register(b0, space0) { - uint4 x_6[1]; -}; - -void main_1() { - int GLF_dead6index = 0; - int GLF_dead6currentNode = 0; - int donor_replacementGLF_dead6tree[1] = (int[1])0; - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - GLF_dead6index = 0; - const float x_34 = asfloat(x_6[0].y); - if ((x_34 < 0.0f)) { - [loop] while (true) { - if (true) { - } else { - break; - } - const int x_10 = donor_replacementGLF_dead6tree[GLF_dead6index]; - GLF_dead6currentNode = x_10; - GLF_dead6index = GLF_dead6currentNode; - } - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\u11r8.0:40: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl index 5f7d58cbfa..289004ed56 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl @@ -34,7 +34,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.dxc.hlsl new file mode 100755 index 0000000000..0f5cc33a5f --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.dxc.hlsl @@ -0,0 +1,56 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int GLF_dead6index = 0; + int GLF_dead6currentNode = 0; + int donor_replacementGLF_dead6tree[1] = (int[1])0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + GLF_dead6index = 0; + const float x_34 = asfloat(x_6[0].y); + if ((x_34 < 0.0f)) { + [loop] while (true) { + if (true) { + } else { + break; + } + const int x_10 = donor_replacementGLF_dead6tree[GLF_dead6index]; + GLF_dead6currentNode = x_10; + GLF_dead6index = GLF_dead6currentNode; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:40: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.fxc.hlsl new file mode 100755 index 0000000000..bea15f81e7 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.fxc.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int GLF_dead6index = 0; + int GLF_dead6currentNode = 0; + int donor_replacementGLF_dead6tree[1] = (int[1])0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + GLF_dead6index = 0; + const float x_34 = asfloat(x_6[0].y); + if ((x_34 < 0.0f)) { + [loop] while (true) { + if (true) { + } else { + break; + } + const int x_10 = donor_replacementGLF_dead6tree[GLF_dead6index]; + GLF_dead6currentNode = x_10; + GLF_dead6index = GLF_dead6currentNode; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl deleted file mode 100755 index 6c8fdc5770..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl +++ /dev/null @@ -1,53 +0,0 @@ -SKIP: FAILED - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_6 : register(b0, space0) { - uint4 x_6[1]; -}; - -void main_1() { - int GLF_dead6index = 0; - int GLF_dead6currentNode = 0; - int donor_replacementGLF_dead6tree[1] = (int[1])0; - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - GLF_dead6index = 0; - const float x_34 = asfloat(x_6[0].y); - if ((x_34 < 0.0f)) { - [loop] while (true) { - if (true) { - } else { - break; - } - const int x_10 = donor_replacementGLF_dead6tree[GLF_dead6index]; - GLF_dead6currentNode = x_10; - GLF_dead6index = GLF_dead6currentNode; - } - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\u1v50.0:40: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl index 7e36aeec07..3cadb54354 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl @@ -62,7 +62,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl index 9af2e55c54..435e54e38d 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl @@ -35,7 +35,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl index a577af6c9b..c9198f6d0e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl @@ -26,7 +26,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl index 29fc08524c..c3bc1bf4c2 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl @@ -135,7 +135,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) gl_GlobalInvocationID_param : vec3) { gl_GlobalInvocationID = gl_GlobalInvocationID_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl index 28a95e6ef1..c9d84922ba 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl @@ -34,7 +34,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl index 2ce27b5cb0..f656b91286 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl @@ -39,7 +39,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl index 7edecc2e96..5b160e165c 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl @@ -56,7 +56,7 @@ struct main_out { x_GLF_color_1 : vec4, }; -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.dxc.hlsl new file mode 100755 index 0000000000..675a4fb17c --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.dxc.hlsl @@ -0,0 +1,61 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int m = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = asfloat(x_5[0].x); + const float x_32 = asfloat(x_5[0].y); + if ((x_30 > x_32)) { + [loop] while (true) { + { + if (false) { + } else { + break; + } + } + } + m = 1; + [loop] while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:45: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.fxc.hlsl new file mode 100755 index 0000000000..212c426ab2 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,52 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int m = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = asfloat(x_5[0].x); + const float x_32 = asfloat(x_5[0].y); + if ((x_30 > x_32)) { + [loop] while (true) { + { + if (false) { + } else { + break; + } + } + } + m = 1; + [loop] while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl deleted file mode 100755 index 8e7733c31d..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,58 +0,0 @@ -SKIP: FAILED - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_5 : register(b0, space0) { - uint4 x_5[1]; -}; - -void main_1() { - int m = 0; - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - const float x_30 = asfloat(x_5[0].x); - const float x_32 = asfloat(x_5[0].y); - if ((x_30 > x_32)) { - [loop] while (true) { - { - if (false) { - } else { - break; - } - } - } - m = 1; - [loop] while (true) { - if (true) { - } else { - break; - } - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\u1f84.0:45: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl index d983488595..dafad00011 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl @@ -38,7 +38,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.dxc.hlsl new file mode 100755 index 0000000000..675a4fb17c --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.dxc.hlsl @@ -0,0 +1,61 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int m = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = asfloat(x_5[0].x); + const float x_32 = asfloat(x_5[0].y); + if ((x_30 > x_32)) { + [loop] while (true) { + { + if (false) { + } else { + break; + } + } + } + m = 1; + [loop] while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:45: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.fxc.hlsl new file mode 100755 index 0000000000..212c426ab2 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,52 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int m = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = asfloat(x_5[0].x); + const float x_32 = asfloat(x_5[0].y); + if ((x_30 > x_32)) { + [loop] while (true) { + { + if (false) { + } else { + break; + } + } + } + m = 1; + [loop] while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl deleted file mode 100755 index f6f72ef944..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,58 +0,0 @@ -SKIP: FAILED - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); -cbuffer cbuffer_x_5 : register(b0, space0) { - uint4 x_5[1]; -}; - -void main_1() { - int m = 0; - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - const float x_30 = asfloat(x_5[0].x); - const float x_32 = asfloat(x_5[0].y); - if ((x_30 > x_32)) { - [loop] while (true) { - { - if (false) { - } else { - break; - } - } - } - m = 1; - [loop] while (true) { - if (true) { - } else { - break; - } - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - } - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\uk3k.0:45: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl deleted file mode 100755 index 21a25c091f..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl +++ /dev/null @@ -1,58 +0,0 @@ -SKIP: FAILED - see https://github.com/microsoft/DirectXShaderCompiler/issues/4422 - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - bool x_21_phi = false; - x_21_phi = false; - [loop] while (true) { - bool x_25 = false; - bool x_25_phi = false; - bool x_30_phi = false; - x_25_phi = x_21_phi; - [loop] while (true) { - x_25 = x_25_phi; - x_30_phi = x_25; - if ((1 < 0)) { - } else { - break; - } - x_30_phi = true; - break; - { - x_25_phi = false; - } - } - if (x_30_phi) { - break; - } - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - break; - { - x_21_phi = false; - } - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {x_GLF_color}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl index 27ea484d1b..f7afe65bc6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl @@ -42,7 +42,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl deleted file mode 100755 index d3d70bc41b..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl +++ /dev/null @@ -1,58 +0,0 @@ -SKIP: FAILED - see https://github.com/microsoft/DirectXShaderCompiler/issues/4422SKIP: FAILED - see https://github.com/microsoft/DirectXShaderCompiler/issues/4422 - -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - bool x_21_phi = false; - x_21_phi = false; - [loop] while (true) { - bool x_25 = false; - bool x_25_phi = false; - bool x_30_phi = false; - x_25_phi = x_21_phi; - [loop] while (true) { - x_25 = x_25_phi; - x_30_phi = x_25; - if ((1 < 0)) { - } else { - break; - } - x_30_phi = true; - break; - { - x_25_phi = false; - } - } - if (x_30_phi) { - break; - } - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - break; - { - x_21_phi = false; - } - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_1 = {x_GLF_color}; - return tint_symbol_1; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl index aae7862023..4633c8ce60 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl @@ -41,7 +41,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl index 243b48ba28..3038a6850b 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl @@ -102,7 +102,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl index a7f241950e..e24cb0a1ee 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl @@ -33,7 +33,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl index e46dd74617..317778e686 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl @@ -39,7 +39,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.dxc.hlsl new file mode 100755 index 0000000000..ce7d5c2d40 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.dxc.hlsl @@ -0,0 +1,109 @@ +SKIP: FAILED + +void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + case 3: + mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; + break; + } +} + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int idx = 0; + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_1 = 0; + int GLF_live6rows = 0; + int z = 0; + int ll_2 = 0; + int ctr = 0; + float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_3 = 0; + int c = 0; + int d = 0; + float GLF_live6sums[9] = (float[9])0; + idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), (0.0f).xxx); + ll_1 = 0; + GLF_live6rows = 2; + [loop] while (true) { + const int x_18 = ll_1; + const int x_19 = asint(x_9[0].x); + if ((x_18 >= x_19)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + ll_1 = (ll_1 + 1); + const int x_22 = asint(x_9[0].x); + z = x_22; + ll_2 = 0; + ctr = 0; + { + [loop] for(; (ctr < 1); ctr = (ctr + 1)) { + const int x_24 = ll_2; + const int x_25 = asint(x_9[0].x); + if ((x_24 >= x_25)) { + break; + } + ll_2 = (ll_2 + 1); + tempm43 = m43; + ll_3 = 0; + c = 0; + { + [loop] for(; (1 < z); c = (c + 1)) { + d = 0; + set_scalar_float4x3(tempm43, (((d >= 0) & (d < 3)) ? d : 0), (((c >= 0) & (c < 4)) ? c : 0), 1.0f); + } + } + const int x_117 = (((idx >= 0) & (idx < 9)) ? idx : 0); + const float x_119 = m43[ctr].y; + const float x_121 = GLF_live6sums[x_117]; + GLF_live6sums[x_117] = (x_121 + x_119); + } + } + idx = (idx + 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:93: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.fxc.hlsl new file mode 100755 index 0000000000..284b42dbec --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,100 @@ +SKIP: FAILED + +void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + case 3: + mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; + break; + } +} + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int idx = 0; + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_1 = 0; + int GLF_live6rows = 0; + int z = 0; + int ll_2 = 0; + int ctr = 0; + float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_3 = 0; + int c = 0; + int d = 0; + float GLF_live6sums[9] = (float[9])0; + idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), (0.0f).xxx); + ll_1 = 0; + GLF_live6rows = 2; + [loop] while (true) { + const int x_18 = ll_1; + const int x_19 = asint(x_9[0].x); + if ((x_18 >= x_19)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + ll_1 = (ll_1 + 1); + const int x_22 = asint(x_9[0].x); + z = x_22; + ll_2 = 0; + ctr = 0; + { + [loop] for(; (ctr < 1); ctr = (ctr + 1)) { + const int x_24 = ll_2; + const int x_25 = asint(x_9[0].x); + if ((x_24 >= x_25)) { + break; + } + ll_2 = (ll_2 + 1); + tempm43 = m43; + ll_3 = 0; + c = 0; + { + [loop] for(; (1 < z); c = (c + 1)) { + d = 0; + set_scalar_float4x3(tempm43, (((d >= 0) & (d < 3)) ? d : 0), (((c >= 0) & (c < 4)) ? c : 0), 1.0f); + } + } + const int x_117 = (((idx >= 0) & (idx < 9)) ? idx : 0); + const float x_119 = m43[ctr].y; + const float x_121 = GLF_live6sums[x_117]; + GLF_live6sums[x_117] = (x_121 + x_119); + } + } + idx = (idx + 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl deleted file mode 100755 index 71191e1266..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,106 +0,0 @@ -SKIP: FAILED - -void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - case 2: - mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; - break; - case 3: - mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; - break; - } -} - -cbuffer cbuffer_x_9 : register(b0, space0) { - uint4 x_9[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - int idx = 0; - float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - int ll_1 = 0; - int GLF_live6rows = 0; - int z = 0; - int ll_2 = 0; - int ctr = 0; - float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - int ll_3 = 0; - int c = 0; - int d = 0; - float GLF_live6sums[9] = (float[9])0; - idx = 0; - m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); - ll_1 = 0; - GLF_live6rows = 2; - [loop] while (true) { - const int x_18 = ll_1; - const int x_19 = asint(x_9[0].x); - if ((x_18 >= x_19)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - break; - } - ll_1 = (ll_1 + 1); - const int x_22 = asint(x_9[0].x); - z = x_22; - ll_2 = 0; - ctr = 0; - { - [loop] for(; (ctr < 1); ctr = (ctr + 1)) { - const int x_24 = ll_2; - const int x_25 = asint(x_9[0].x); - if ((x_24 >= x_25)) { - break; - } - ll_2 = (ll_2 + 1); - tempm43 = m43; - ll_3 = 0; - c = 0; - { - [loop] for(; (1 < z); c = (c + 1)) { - d = 0; - set_scalar_float4x3(tempm43, (((d >= 0) & (d < 3)) ? d : 0), (((c >= 0) & (c < 4)) ? c : 0), 1.0f); - } - } - const int x_117 = (((idx >= 0) & (idx < 9)) ? idx : 0); - const float x_119 = m43[ctr].y; - const float x_121 = GLF_live6sums[x_117]; - GLF_live6sums[x_117] = (x_121 + x_119); - } - } - idx = (idx + 1); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\umdw.0:93: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl index b33f560e75..32082a5bd4 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl @@ -98,7 +98,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.dxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.dxc.hlsl new file mode 100755 index 0000000000..ce7d5c2d40 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.dxc.hlsl @@ -0,0 +1,109 @@ +SKIP: FAILED + +void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + case 3: + mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; + break; + } +} + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int idx = 0; + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_1 = 0; + int GLF_live6rows = 0; + int z = 0; + int ll_2 = 0; + int ctr = 0; + float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_3 = 0; + int c = 0; + int d = 0; + float GLF_live6sums[9] = (float[9])0; + idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), (0.0f).xxx); + ll_1 = 0; + GLF_live6rows = 2; + [loop] while (true) { + const int x_18 = ll_1; + const int x_19 = asint(x_9[0].x); + if ((x_18 >= x_19)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + ll_1 = (ll_1 + 1); + const int x_22 = asint(x_9[0].x); + z = x_22; + ll_2 = 0; + ctr = 0; + { + [loop] for(; (ctr < 1); ctr = (ctr + 1)) { + const int x_24 = ll_2; + const int x_25 = asint(x_9[0].x); + if ((x_24 >= x_25)) { + break; + } + ll_2 = (ll_2 + 1); + tempm43 = m43; + ll_3 = 0; + c = 0; + { + [loop] for(; (1 < z); c = (c + 1)) { + d = 0; + set_scalar_float4x3(tempm43, (((d >= 0) & (d < 3)) ? d : 0), (((c >= 0) & (c < 4)) ? c : 0), 1.0f); + } + } + const int x_117 = (((idx >= 0) & (idx < 9)) ? idx : 0); + const float x_119 = m43[ctr].y; + const float x_121 = GLF_live6sums[x_117]; + GLF_live6sums[x_117] = (x_121 + x_119); + } + } + idx = (idx + 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} +DXC validation failure: +warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. + +error: validation errors +shader.hlsl:93: error: Loop must have break. +Validation failed. + + + diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.fxc.hlsl new file mode 100755 index 0000000000..284b42dbec --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,100 @@ +SKIP: FAILED + +void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { + switch (col) { + case 0: + mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; + break; + case 1: + mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; + break; + case 2: + mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; + break; + case 3: + mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; + break; + } +} + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int idx = 0; + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_1 = 0; + int GLF_live6rows = 0; + int z = 0; + int ll_2 = 0; + int ctr = 0; + float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_3 = 0; + int c = 0; + int d = 0; + float GLF_live6sums[9] = (float[9])0; + idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), (0.0f).xxx); + ll_1 = 0; + GLF_live6rows = 2; + [loop] while (true) { + const int x_18 = ll_1; + const int x_19 = asint(x_9[0].x); + if ((x_18 >= x_19)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + ll_1 = (ll_1 + 1); + const int x_22 = asint(x_9[0].x); + z = x_22; + ll_2 = 0; + ctr = 0; + { + [loop] for(; (ctr < 1); ctr = (ctr + 1)) { + const int x_24 = ll_2; + const int x_25 = asint(x_9[0].x); + if ((x_24 >= x_25)) { + break; + } + ll_2 = (ll_2 + 1); + tempm43 = m43; + ll_3 = 0; + c = 0; + { + [loop] for(; (1 < z); c = (c + 1)) { + d = 0; + set_scalar_float4x3(tempm43, (((d >= 0) & (d < 3)) ? d : 0), (((c >= 0) & (c < 4)) ? c : 0), 1.0f); + } + } + const int x_117 = (((idx >= 0) & (idx < 9)) ? idx : 0); + const float x_119 = m43[ctr].y; + const float x_121 = GLF_live6sums[x_117]; + GLF_live6sums[x_117] = (x_121 + x_119); + } + } + idx = (idx + 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner() { + main_1(); + const main_out tint_symbol_2 = {x_GLF_color}; + return tint_symbol_2; +} + +tint_symbol main() { + const main_out inner_result = main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl deleted file mode 100755 index e51bffee8b..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,118 +0,0 @@ -SKIP: FAILED - -void set_scalar_float4x3(inout float4x3 mat, int col, int row, float val) { - switch (col) { - case 0: - mat[0] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[0]; - break; - case 1: - mat[1] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[1]; - break; - case 2: - mat[2] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[2]; - break; - case 3: - mat[3] = (row.xxx == int3(0, 1, 2)) ? val.xxx : mat[3]; - break; - } -} - -cbuffer cbuffer_x_9 : register(b0, space0) { - uint4 x_9[1]; -}; -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void main_1() { - int idx = 0; - float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - int ll_1 = 0; - int GLF_live6rows = 0; - int z = 0; - int ll_2 = 0; - int ctr = 0; - float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - int ll_3 = 0; - int c = 0; - int d = 0; - float GLF_live6sums[9] = (float[9])0; - idx = 0; - m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); - ll_1 = 0; - GLF_live6rows = 2; - [loop] while (true) { - const int x_18 = ll_1; - const int x_19 = asint(x_9[0].x); - if ((x_18 >= x_19)) { - x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); - break; - } - ll_1 = (ll_1 + 1); - const int x_22 = asint(x_9[0].x); - z = x_22; - ll_2 = 0; - ctr = 0; - { - [loop] for(; (ctr < 1); ctr = (ctr + 1)) { - const int x_24 = ll_2; - const int x_25 = asint(x_9[0].x); - if ((x_24 >= x_25)) { - break; - } - ll_2 = (ll_2 + 1); - tempm43 = m43; - ll_3 = 0; - c = 0; - { - [loop] for(; (1 < z); c = (c + 1)) { - d = 0; - bool tint_tmp = (d >= 0); - if (tint_tmp) { - tint_tmp = (d < 3); - } - bool tint_tmp_1 = (c >= 0); - if (tint_tmp_1) { - tint_tmp_1 = (c < 4); - } - set_scalar_float4x3(tempm43, ((tint_tmp) ? d : 0), ((tint_tmp_1) ? c : 0), 1.0f); - } - } - bool tint_tmp_2 = (idx >= 0); - if (tint_tmp_2) { - tint_tmp_2 = (idx < 9); - } - const int x_117 = ((tint_tmp_2) ? idx : 0); - const float x_119 = m43[ctr].y; - const float x_121 = GLF_live6sums[x_117]; - GLF_live6sums[x_117] = (x_121 + x_119); - } - } - idx = (idx + 1); - } - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner() { - main_1(); - const main_out tint_symbol_2 = {x_GLF_color}; - return tint_symbol_2; -} - -tint_symbol main() { - const main_out inner_result = main_inner(); - tint_symbol wrapper_result = (tint_symbol)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -error: validation errors -C:\src\temp\u1tig.0:105: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.fxc.hlsl new file mode 100644 index 0000000000..364fa17705 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.fxc.hlsl @@ -0,0 +1,370 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct Obj { + float odd_numbers[10]; + float even_numbers[10]; +}; + +static BST tree_1[10] = (BST[10])0; +cbuffer cbuffer_x_27 : register(b0, space0) { + uint4 x_27[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_74 = data; + tree.data = x_74; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + int GLF_live8i = 0; + float GLF_live8A[50] = (float[50])0; + baseIndex = 0; + [loop] while (true) { + const int x_75 = baseIndex; + const int x_76 = treeIndex; + if ((x_75 <= x_76)) { + } else { + break; + } + const int x_77 = data_1; + const int x_79 = tree_1[baseIndex].data; + if ((x_77 <= x_79)) { + const int x_81 = tree_1[baseIndex].leftIndex; + if ((x_81 == -1)) { + const int x_82 = baseIndex; + const int x_83 = treeIndex; + tree_1[x_82].leftIndex = x_83; + const int x_84 = treeIndex; + const BST x_350 = tree_1[x_84]; + param = x_350; + const int x_85 = data_1; + param_1 = x_85; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_84] = param; + return; + } else { + const int x_87 = tree_1[baseIndex].leftIndex; + baseIndex = x_87; + continue; + } + } else { + const int x_89 = tree_1[baseIndex].rightIndex; + if ((x_89 == -1)) { + const int x_90 = baseIndex; + const int x_91 = treeIndex; + tree_1[x_90].rightIndex = x_91; + const int x_92 = treeIndex; + const BST x_362 = tree_1[x_92]; + param_2 = x_362; + const int x_93 = data_1; + param_3 = x_93; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_92] = param_2; + return; + } else { + GLF_live8i = 1; + const int x_369 = (((GLF_live8i >= 0) & (GLF_live8i < 50)) ? GLF_live8i : 0); + const float x_371 = GLF_live8A[0]; + const float x_373 = GLF_live8A[x_369]; + GLF_live8A[x_369] = (x_373 + x_371); + [loop] while (true) { + const int x_98 = tree_1[baseIndex].rightIndex; + baseIndex = x_98; + { + const float x_382 = asfloat(x_27[0].x); + const float x_384 = asfloat(x_27[0].y); + if ((x_382 > x_384)) { + } else { + break; + } + } + } + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_387 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_395 = tree_1[index]; + currentNode = x_395; + const int x_101 = currentNode.data; + const int x_102 = target; + if ((x_101 == x_102)) { + const int x_103 = target; + return x_103; + } + const int x_104 = target; + const int x_105 = currentNode.data; + if ((x_104 > x_105)) { + const int x_106 = currentNode.rightIndex; + x_387 = x_106; + } else { + const int x_107 = currentNode.leftIndex; + x_387 = x_107; + } + index = x_387; + } + return -1; +} + +float makeFrame_f1_(inout float v) { + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + const float x_418 = v; + v = (x_418 * 6.5f); + const float x_420 = v; + if ((x_420 < 1.5f)) { + param_5 = 100; + const int x_110 = search_i1_(param_5); + return float(x_110); + } + const float x_425 = v; + if ((x_425 < 4.0f)) { + return 0.0f; + } + const float x_429 = v; + param_6 = 6; + const int x_111 = search_i1_(param_6); + if ((x_429 < float(x_111))) { + return 1.0f; + } + param_7 = 30; + const int x_112 = search_i1_(param_7); + return (10.0f + float(x_112)); +} + +float3 hueColor_f1_(inout float angle) { + float nodeData = 0.0f; + int param_4 = 0; + param_4 = 15; + const int x_109 = search_i1_(param_4); + nodeData = float(x_109); + const float x_409 = angle; + return (((30.0f).xxx + (float3(1.0f, 5.0f, nodeData) * x_409)) / (50.0f).xxx); +} + +void main_1() { + int treeIndex_1 = 0; + BST param_8 = (BST)0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int GLF_live1_looplimiter2 = 0; + int GLF_live1i = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int GLF_live4_looplimiter3 = 0; + int GLF_live4i = 0; + int GLF_live4index = 0; + Obj GLF_live4obj = (Obj)0; + int param_24 = 0; + int param_25 = 0; + int param_26 = 0; + int param_27 = 0; + float2 z = float2(0.0f, 0.0f); + float x_1 = 0.0f; + float param_28 = 0.0f; + float y_1 = 0.0f; + float param_29 = 0.0f; + int sum = 0; + int target_1 = 0; + int result = 0; + int param_30 = 0; + float a = 0.0f; + float3 x_235 = float3(0.0f, 0.0f, 0.0f); + float param_31 = 0.0f; + treeIndex_1 = 0; + const BST x_237 = tree_1[0]; + param_8 = x_237; + param_9 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_8, param_9); + tree_1[0] = param_8; + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 5; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + GLF_live1_looplimiter2 = 0; + GLF_live1i = 0; + { + [loop] for(; true; GLF_live1i = (GLF_live1i + 1)) { + if ((GLF_live1_looplimiter2 >= 7)) { + break; + } + GLF_live1_looplimiter2 = (GLF_live1_looplimiter2 + 1); + } + } + param_12 = treeIndex_1; + param_13 = 12; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 15; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 7; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 8; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 2; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 6; + insert_i1_i1_(param_22, param_23); + treeIndex_1 = (treeIndex_1 + 1); + GLF_live4_looplimiter3 = 0; + GLF_live4i = 0; + { + [loop] for(; true; GLF_live4i = (GLF_live4i + 1)) { + if ((GLF_live4_looplimiter3 >= 3)) { + break; + } + GLF_live4_looplimiter3 = (GLF_live4_looplimiter3 + 1); + GLF_live4index = 1; + const int x_144 = GLF_live4index; + const int x_145 = GLF_live4index; + const int x_146 = GLF_live4index; + const float x_269 = GLF_live4obj.even_numbers[1]; + { + float tint_symbol_1[10] = GLF_live4obj.even_numbers; + tint_symbol_1[(((x_144 >= 0) & (x_145 < 10)) ? x_146 : 0)] = x_269; + GLF_live4obj.even_numbers = tint_symbol_1; + } + const int x_147 = GLF_live4i; + const int x_148 = GLF_live4i; + const int x_149 = GLF_live4i; + { + float tint_symbol_3[10] = GLF_live4obj.even_numbers; + tint_symbol_3[(((x_147 >= 0) & (x_148 < 10)) ? x_149 : 0)] = 1.0f; + GLF_live4obj.even_numbers = tint_symbol_3; + } + } + } + param_24 = treeIndex_1; + param_25 = 17; + insert_i1_i1_(param_24, param_25); + const float x_278 = asfloat(x_27[0].x); + const float x_280 = asfloat(x_27[0].y); + if ((x_278 > x_280)) { + return; + } + treeIndex_1 = (treeIndex_1 + 1); + param_26 = treeIndex_1; + param_27 = 13; + insert_i1_i1_(param_26, param_27); + const float4 x_285 = gl_FragCoord; + z = (float2(x_285.y, x_285.x) / (256.0f).xx); + const float x_289 = z.x; + param_28 = x_289; + const float x_290 = makeFrame_f1_(param_28); + x_1 = x_290; + const float x_292 = z.y; + param_29 = x_292; + const float x_293 = makeFrame_f1_(param_29); + y_1 = x_293; + sum = -100; + target_1 = 0; + { + [loop] for(; (target_1 < 20); target_1 = (target_1 + 1)) { + param_30 = target_1; + const int x_158 = search_i1_(param_30); + result = x_158; + if ((result > 0)) { + } else { + switch(result) { + case 0: { + return; + break; + } + case -1: { + sum = (sum + 1); + break; + } + default: { + break; + } + } + } + } + } + a = (x_1 + (y_1 * float(sum))); + const float x_313 = asfloat(x_27[0].x); + const float x_315 = asfloat(x_27[0].y); + if ((x_313 < x_315)) { + x_235 = float3(1.0f, 0.0f, 0.0f); + } else { + param_31 = a; + const float3 x_321 = hueColor_f1_(param_31); + x_235 = x_321; + } + const float3 x_322 = x_235; + x_GLF_color = float4(x_322.x, x_322.y, x_322.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_5 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_6 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_8 = {x_GLF_color}; + return tint_symbol_8; +} + +tint_symbol_6 main(tint_symbol_5 tint_symbol_4) { + const main_out inner_result = main_inner(tint_symbol_4.gl_FragCoord_param); + tint_symbol_6 wrapper_result = (tint_symbol_6)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl deleted file mode 100644 index d3e42091d7..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl +++ /dev/null @@ -1,374 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -struct BST { - int data; - int leftIndex; - int rightIndex; -}; -struct Obj { - float odd_numbers[10]; - float even_numbers[10]; -}; - -static BST tree_1[10] = (BST[10])0; -cbuffer cbuffer_x_27 : register(b0, space0) { - uint4 x_27[1]; -}; -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { - const int x_74 = data; - tree.data = x_74; - tree.leftIndex = -1; - tree.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - int GLF_live8i = 0; - float GLF_live8A[50] = (float[50])0; - baseIndex = 0; - [loop] while (true) { - const int x_75 = baseIndex; - const int x_76 = treeIndex; - if ((x_75 <= x_76)) { - } else { - break; - } - const int x_77 = data_1; - const int x_79 = tree_1[baseIndex].data; - if ((x_77 <= x_79)) { - const int x_81 = tree_1[baseIndex].leftIndex; - if ((x_81 == -1)) { - const int x_82 = baseIndex; - const int x_83 = treeIndex; - tree_1[x_82].leftIndex = x_83; - const int x_84 = treeIndex; - const BST x_350 = tree_1[x_84]; - param = x_350; - const int x_85 = data_1; - param_1 = x_85; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree_1[x_84] = param; - return; - } else { - const int x_87 = tree_1[baseIndex].leftIndex; - baseIndex = x_87; - continue; - } - } else { - const int x_89 = tree_1[baseIndex].rightIndex; - if ((x_89 == -1)) { - const int x_90 = baseIndex; - const int x_91 = treeIndex; - tree_1[x_90].rightIndex = x_91; - const int x_92 = treeIndex; - const BST x_362 = tree_1[x_92]; - param_2 = x_362; - const int x_93 = data_1; - param_3 = x_93; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree_1[x_92] = param_2; - return; - } else { - GLF_live8i = 1; - const int x_369 = (((GLF_live8i >= 0) & (GLF_live8i < 50)) ? GLF_live8i : 0); - const float x_371 = GLF_live8A[0]; - const float x_373 = GLF_live8A[x_369]; - GLF_live8A[x_369] = (x_373 + x_371); - [loop] while (true) { - const int x_98 = tree_1[baseIndex].rightIndex; - baseIndex = x_98; - { - const float x_382 = asfloat(x_27[0].x); - const float x_384 = asfloat(x_27[0].y); - if ((x_382 > x_384)) { - } else { - break; - } - } - } - continue; - } - } - } - return; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_387 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_395 = tree_1[index]; - currentNode = x_395; - const int x_101 = currentNode.data; - const int x_102 = target; - if ((x_101 == x_102)) { - const int x_103 = target; - return x_103; - } - const int x_104 = target; - const int x_105 = currentNode.data; - if ((x_104 > x_105)) { - const int x_106 = currentNode.rightIndex; - x_387 = x_106; - } else { - const int x_107 = currentNode.leftIndex; - x_387 = x_107; - } - index = x_387; - } - return -1; -} - -float makeFrame_f1_(inout float v) { - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - const float x_418 = v; - v = (x_418 * 6.5f); - const float x_420 = v; - if ((x_420 < 1.5f)) { - param_5 = 100; - const int x_110 = search_i1_(param_5); - return float(x_110); - } - const float x_425 = v; - if ((x_425 < 4.0f)) { - return 0.0f; - } - const float x_429 = v; - param_6 = 6; - const int x_111 = search_i1_(param_6); - if ((x_429 < float(x_111))) { - return 1.0f; - } - param_7 = 30; - const int x_112 = search_i1_(param_7); - return (10.0f + float(x_112)); -} - -float3 hueColor_f1_(inout float angle) { - float nodeData = 0.0f; - int param_4 = 0; - param_4 = 15; - const int x_109 = search_i1_(param_4); - nodeData = float(x_109); - const float x_409 = angle; - return ((float3(30.0f, 30.0f, 30.0f) + (float3(1.0f, 5.0f, nodeData) * x_409)) / float3(50.0f, 50.0f, 50.0f)); -} - -void main_1() { - int treeIndex_1 = 0; - BST param_8 = (BST)0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int GLF_live1_looplimiter2 = 0; - int GLF_live1i = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int GLF_live4_looplimiter3 = 0; - int GLF_live4i = 0; - int GLF_live4index = 0; - Obj GLF_live4obj = (Obj)0; - int param_24 = 0; - int param_25 = 0; - int param_26 = 0; - int param_27 = 0; - float2 z = float2(0.0f, 0.0f); - float x_1 = 0.0f; - float param_28 = 0.0f; - float y_1 = 0.0f; - float param_29 = 0.0f; - int sum = 0; - int target_1 = 0; - int result = 0; - int param_30 = 0; - float a = 0.0f; - float3 x_235 = float3(0.0f, 0.0f, 0.0f); - float param_31 = 0.0f; - treeIndex_1 = 0; - const BST x_237 = tree_1[0]; - param_8 = x_237; - param_9 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_8, param_9); - tree_1[0] = param_8; - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 5; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - GLF_live1_looplimiter2 = 0; - GLF_live1i = 0; - { - [loop] for(; true; GLF_live1i = (GLF_live1i + 1)) { - if ((GLF_live1_looplimiter2 >= 7)) { - break; - } - GLF_live1_looplimiter2 = (GLF_live1_looplimiter2 + 1); - } - } - param_12 = treeIndex_1; - param_13 = 12; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 15; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 7; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 8; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 2; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 6; - insert_i1_i1_(param_22, param_23); - treeIndex_1 = (treeIndex_1 + 1); - GLF_live4_looplimiter3 = 0; - GLF_live4i = 0; - { - [loop] for(; true; GLF_live4i = (GLF_live4i + 1)) { - if ((GLF_live4_looplimiter3 >= 3)) { - break; - } - GLF_live4_looplimiter3 = (GLF_live4_looplimiter3 + 1); - GLF_live4index = 1; - const int x_144 = GLF_live4index; - const int x_145 = GLF_live4index; - const int x_146 = GLF_live4index; - const float x_269 = GLF_live4obj.even_numbers[1]; - { - float tint_symbol_1[10] = GLF_live4obj.even_numbers; - tint_symbol_1[(((x_144 >= 0) & (x_145 < 10)) ? x_146 : 0)] = x_269; - GLF_live4obj.even_numbers = tint_symbol_1; - } - const int x_147 = GLF_live4i; - const int x_148 = GLF_live4i; - const int x_149 = GLF_live4i; - { - float tint_symbol_3[10] = GLF_live4obj.even_numbers; - tint_symbol_3[(((x_147 >= 0) & (x_148 < 10)) ? x_149 : 0)] = 1.0f; - GLF_live4obj.even_numbers = tint_symbol_3; - } - } - } - param_24 = treeIndex_1; - param_25 = 17; - insert_i1_i1_(param_24, param_25); - const float x_278 = asfloat(x_27[0].x); - const float x_280 = asfloat(x_27[0].y); - if ((x_278 > x_280)) { - return; - } - treeIndex_1 = (treeIndex_1 + 1); - param_26 = treeIndex_1; - param_27 = 13; - insert_i1_i1_(param_26, param_27); - const float4 x_285 = gl_FragCoord; - z = (float2(x_285.y, x_285.x) / float2(256.0f, 256.0f)); - const float x_289 = z.x; - param_28 = x_289; - const float x_290 = makeFrame_f1_(param_28); - x_1 = x_290; - const float x_292 = z.y; - param_29 = x_292; - const float x_293 = makeFrame_f1_(param_29); - y_1 = x_293; - sum = -100; - target_1 = 0; - { - [loop] for(; (target_1 < 20); target_1 = (target_1 + 1)) { - param_30 = target_1; - const int x_158 = search_i1_(param_30); - result = x_158; - if ((result > 0)) { - } else { - switch(result) { - case 0: { - return; - break; - } - case -1: { - sum = (sum + 1); - break; - } - default: { - break; - } - } - } - } - } - a = (x_1 + (y_1 * float(sum))); - const float x_313 = asfloat(x_27[0].x); - const float x_315 = asfloat(x_27[0].y); - if ((x_313 < x_315)) { - x_235 = float3(1.0f, 0.0f, 0.0f); - } else { - param_31 = a; - const float3 x_321 = hueColor_f1_(param_31); - x_235 = x_321; - } - const float3 x_322 = x_235; - x_GLF_color = float4(x_322.x, x_322.y, x_322.z, 1.0f); - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_5 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_6 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_8 = {x_GLF_color}; - return tint_symbol_8; -} - -tint_symbol_6 main(tint_symbol_5 tint_symbol_4) { - const main_out inner_result = main_inner(tint_symbol_4.gl_FragCoord_param); - tint_symbol_6 wrapper_result = (tint_symbol_6)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000001F7677BB400(35,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x000001F7677BB400(145,3): warning X4000: use of potentially uninitialized variable (makeFrame_f1_) -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl index d4ea4f9273..11d42f382e 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl @@ -411,7 +411,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.fxc.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7377385d44 --- /dev/null +++ b/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.fxc.hlsl @@ -0,0 +1,374 @@ +SKIP: FAILED + +vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl:119:15 warning: use of deprecated language feature: 'target' is a reserved keyword +fn search_i1_(target : ptr) -> i32 { + ^^^^^^ + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct Obj { + float odd_numbers[10]; + float even_numbers[10]; +}; + +static BST tree_1[10] = (BST[10])0; +cbuffer cbuffer_x_27 : register(b0, space0) { + uint4 x_27[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_74 = data; + tree.data = x_74; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + int GLF_live8i = 0; + float GLF_live8A[50] = (float[50])0; + baseIndex = 0; + [loop] while (true) { + const int x_75 = baseIndex; + const int x_76 = treeIndex; + if ((x_75 <= x_76)) { + } else { + break; + } + const int x_77 = data_1; + const int x_79 = tree_1[baseIndex].data; + if ((x_77 <= x_79)) { + const int x_81 = tree_1[baseIndex].leftIndex; + if ((x_81 == -1)) { + const int x_82 = baseIndex; + const int x_83 = treeIndex; + tree_1[x_82].leftIndex = x_83; + const int x_84 = treeIndex; + const BST x_350 = tree_1[x_84]; + param = x_350; + const int x_85 = data_1; + param_1 = x_85; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_84] = param; + return; + } else { + const int x_87 = tree_1[baseIndex].leftIndex; + baseIndex = x_87; + continue; + } + } else { + const int x_89 = tree_1[baseIndex].rightIndex; + if ((x_89 == -1)) { + const int x_90 = baseIndex; + const int x_91 = treeIndex; + tree_1[x_90].rightIndex = x_91; + const int x_92 = treeIndex; + const BST x_362 = tree_1[x_92]; + param_2 = x_362; + const int x_93 = data_1; + param_3 = x_93; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_92] = param_2; + return; + } else { + GLF_live8i = 1; + const int x_369 = (((GLF_live8i >= 0) & (GLF_live8i < 50)) ? GLF_live8i : 0); + const float x_371 = GLF_live8A[0]; + const float x_373 = GLF_live8A[x_369]; + GLF_live8A[x_369] = (x_373 + x_371); + [loop] while (true) { + const int x_98 = tree_1[baseIndex].rightIndex; + baseIndex = x_98; + { + const float x_382 = asfloat(x_27[0].x); + const float x_384 = asfloat(x_27[0].y); + if ((x_382 > x_384)) { + } else { + break; + } + } + } + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_387 = 0; + index = 0; + [loop] while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_395 = tree_1[index]; + currentNode = x_395; + const int x_101 = currentNode.data; + const int x_102 = target; + if ((x_101 == x_102)) { + const int x_103 = target; + return x_103; + } + const int x_104 = target; + const int x_105 = currentNode.data; + if ((x_104 > x_105)) { + const int x_106 = currentNode.rightIndex; + x_387 = x_106; + } else { + const int x_107 = currentNode.leftIndex; + x_387 = x_107; + } + index = x_387; + } + return -1; +} + +float makeFrame_f1_(inout float v) { + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + const float x_418 = v; + v = (x_418 * 6.5f); + const float x_420 = v; + if ((x_420 < 1.5f)) { + param_5 = 100; + const int x_110 = search_i1_(param_5); + return float(x_110); + } + const float x_425 = v; + if ((x_425 < 4.0f)) { + return 0.0f; + } + const float x_429 = v; + param_6 = 6; + const int x_111 = search_i1_(param_6); + if ((x_429 < float(x_111))) { + return 1.0f; + } + param_7 = 30; + const int x_112 = search_i1_(param_7); + return (10.0f + float(x_112)); +} + +float3 hueColor_f1_(inout float angle) { + float nodeData = 0.0f; + int param_4 = 0; + param_4 = 15; + const int x_109 = search_i1_(param_4); + nodeData = float(x_109); + const float x_409 = angle; + return (((30.0f).xxx + (float3(1.0f, 5.0f, nodeData) * x_409)) / (50.0f).xxx); +} + +void main_1() { + int treeIndex_1 = 0; + BST param_8 = (BST)0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int GLF_live1_looplimiter2 = 0; + int GLF_live1i = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int GLF_live4_looplimiter3 = 0; + int GLF_live4i = 0; + int GLF_live4index = 0; + Obj GLF_live4obj = (Obj)0; + int param_24 = 0; + int param_25 = 0; + int param_26 = 0; + int param_27 = 0; + float2 z = float2(0.0f, 0.0f); + float x_1 = 0.0f; + float param_28 = 0.0f; + float y_1 = 0.0f; + float param_29 = 0.0f; + int sum = 0; + int target_1 = 0; + int result = 0; + int param_30 = 0; + float a = 0.0f; + float3 x_235 = float3(0.0f, 0.0f, 0.0f); + float param_31 = 0.0f; + treeIndex_1 = 0; + const BST x_237 = tree_1[0]; + param_8 = x_237; + param_9 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_8, param_9); + tree_1[0] = param_8; + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 5; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + GLF_live1_looplimiter2 = 0; + GLF_live1i = 0; + { + [loop] for(; true; GLF_live1i = (GLF_live1i + 1)) { + if ((GLF_live1_looplimiter2 >= 7)) { + break; + } + GLF_live1_looplimiter2 = (GLF_live1_looplimiter2 + 1); + } + } + param_12 = treeIndex_1; + param_13 = 12; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 15; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 7; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 8; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 2; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 6; + insert_i1_i1_(param_22, param_23); + treeIndex_1 = (treeIndex_1 + 1); + GLF_live4_looplimiter3 = 0; + GLF_live4i = 0; + { + [loop] for(; true; GLF_live4i = (GLF_live4i + 1)) { + if ((GLF_live4_looplimiter3 >= 3)) { + break; + } + GLF_live4_looplimiter3 = (GLF_live4_looplimiter3 + 1); + GLF_live4index = 1; + const int x_144 = GLF_live4index; + const int x_145 = GLF_live4index; + const int x_146 = GLF_live4index; + const float x_269 = GLF_live4obj.even_numbers[1]; + { + float tint_symbol_1[10] = GLF_live4obj.even_numbers; + tint_symbol_1[(((x_144 >= 0) & (x_145 < 10)) ? x_146 : 0)] = x_269; + GLF_live4obj.even_numbers = tint_symbol_1; + } + const int x_147 = GLF_live4i; + const int x_148 = GLF_live4i; + const int x_149 = GLF_live4i; + { + float tint_symbol_3[10] = GLF_live4obj.even_numbers; + tint_symbol_3[(((x_147 >= 0) & (x_148 < 10)) ? x_149 : 0)] = 1.0f; + GLF_live4obj.even_numbers = tint_symbol_3; + } + } + } + param_24 = treeIndex_1; + param_25 = 17; + insert_i1_i1_(param_24, param_25); + const float x_278 = asfloat(x_27[0].x); + const float x_280 = asfloat(x_27[0].y); + if ((x_278 > x_280)) { + return; + } + treeIndex_1 = (treeIndex_1 + 1); + param_26 = treeIndex_1; + param_27 = 13; + insert_i1_i1_(param_26, param_27); + const float4 x_285 = gl_FragCoord; + z = (float2(x_285.y, x_285.x) / (256.0f).xx); + const float x_289 = z.x; + param_28 = x_289; + const float x_290 = makeFrame_f1_(param_28); + x_1 = x_290; + const float x_292 = z.y; + param_29 = x_292; + const float x_293 = makeFrame_f1_(param_29); + y_1 = x_293; + sum = -100; + target_1 = 0; + { + [loop] for(; (target_1 < 20); target_1 = (target_1 + 1)) { + param_30 = target_1; + const int x_158 = search_i1_(param_30); + result = x_158; + if ((result > 0)) { + } else { + switch(result) { + case 0: { + return; + break; + } + case -1: { + sum = (sum + 1); + break; + } + default: { + break; + } + } + } + } + } + a = (x_1 + (y_1 * float(sum))); + const float x_313 = asfloat(x_27[0].x); + const float x_315 = asfloat(x_27[0].y); + if ((x_313 < x_315)) { + x_235 = float3(1.0f, 0.0f, 0.0f); + } else { + param_31 = a; + const float3 x_321 = hueColor_f1_(param_31); + x_235 = x_321; + } + const float3 x_322 = x_235; + x_GLF_color = float4(x_322.x, x_322.y, x_322.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_5 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_6 { + float4 x_GLF_color_1 : SV_Target0; +}; + +main_out main_inner(float4 gl_FragCoord_param) { + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_8 = {x_GLF_color}; + return tint_symbol_8; +} + +tint_symbol_6 main(tint_symbol_5 tint_symbol_4) { + const main_out inner_result = main_inner(tint_symbol_4.gl_FragCoord_param); + tint_symbol_6 wrapper_result = (tint_symbol_6)0; + wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; + return wrapper_result; +} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl b/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl deleted file mode 100644 index b17f3450c4..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl +++ /dev/null @@ -1,386 +0,0 @@ -SKIP: FAILED https://crbug.com/tint/1522 - -struct BST { - int data; - int leftIndex; - int rightIndex; -}; -struct Obj { - float odd_numbers[10]; - float even_numbers[10]; -}; - -static BST tree_1[10] = (BST[10])0; -cbuffer cbuffer_x_27 : register(b0, space0) { - uint4 x_27[1]; -}; -static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); -static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); - -void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { - const int x_74 = data; - tree.data = x_74; - tree.leftIndex = -1; - tree.rightIndex = -1; - return; -} - -void insert_i1_i1_(inout int treeIndex, inout int data_1) { - int baseIndex = 0; - BST param = (BST)0; - int param_1 = 0; - BST param_2 = (BST)0; - int param_3 = 0; - int GLF_live8i = 0; - float GLF_live8A[50] = (float[50])0; - baseIndex = 0; - [loop] while (true) { - const int x_75 = baseIndex; - const int x_76 = treeIndex; - if ((x_75 <= x_76)) { - } else { - break; - } - const int x_77 = data_1; - const int x_79 = tree_1[baseIndex].data; - if ((x_77 <= x_79)) { - const int x_81 = tree_1[baseIndex].leftIndex; - if ((x_81 == -1)) { - const int x_82 = baseIndex; - const int x_83 = treeIndex; - tree_1[x_82].leftIndex = x_83; - const int x_84 = treeIndex; - const BST x_350 = tree_1[x_84]; - param = x_350; - const int x_85 = data_1; - param_1 = x_85; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); - tree_1[x_84] = param; - return; - } else { - const int x_87 = tree_1[baseIndex].leftIndex; - baseIndex = x_87; - continue; - } - } else { - const int x_89 = tree_1[baseIndex].rightIndex; - if ((x_89 == -1)) { - const int x_90 = baseIndex; - const int x_91 = treeIndex; - tree_1[x_90].rightIndex = x_91; - const int x_92 = treeIndex; - const BST x_362 = tree_1[x_92]; - param_2 = x_362; - const int x_93 = data_1; - param_3 = x_93; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); - tree_1[x_92] = param_2; - return; - } else { - GLF_live8i = 1; - bool tint_tmp = (GLF_live8i >= 0); - if (tint_tmp) { - tint_tmp = (GLF_live8i < 50); - } - const int x_369 = ((tint_tmp) ? GLF_live8i : 0); - const float x_371 = GLF_live8A[0]; - const float x_373 = GLF_live8A[x_369]; - GLF_live8A[x_369] = (x_373 + x_371); - [loop] while (true) { - const int x_98 = tree_1[baseIndex].rightIndex; - baseIndex = x_98; - { - const float x_382 = asfloat(x_27[0].x); - const float x_384 = asfloat(x_27[0].y); - if ((x_382 > x_384)) { - } else { - break; - } - } - } - continue; - } - } - } - return; -} - -int search_i1_(inout int target) { - int index = 0; - BST currentNode = (BST)0; - int x_387 = 0; - index = 0; - [loop] while (true) { - if ((index != -1)) { - } else { - break; - } - const BST x_395 = tree_1[index]; - currentNode = x_395; - const int x_101 = currentNode.data; - const int x_102 = target; - if ((x_101 == x_102)) { - const int x_103 = target; - return x_103; - } - const int x_104 = target; - const int x_105 = currentNode.data; - if ((x_104 > x_105)) { - const int x_106 = currentNode.rightIndex; - x_387 = x_106; - } else { - const int x_107 = currentNode.leftIndex; - x_387 = x_107; - } - index = x_387; - } - return -1; -} - -float makeFrame_f1_(inout float v) { - int param_5 = 0; - int param_6 = 0; - int param_7 = 0; - const float x_418 = v; - v = (x_418 * 6.5f); - const float x_420 = v; - if ((x_420 < 1.5f)) { - param_5 = 100; - const int x_110 = search_i1_(param_5); - return float(x_110); - } - const float x_425 = v; - if ((x_425 < 4.0f)) { - return 0.0f; - } - const float x_429 = v; - param_6 = 6; - const int x_111 = search_i1_(param_6); - if ((x_429 < float(x_111))) { - return 1.0f; - } - param_7 = 30; - const int x_112 = search_i1_(param_7); - return (10.0f + float(x_112)); -} - -float3 hueColor_f1_(inout float angle) { - float nodeData = 0.0f; - int param_4 = 0; - param_4 = 15; - const int x_109 = search_i1_(param_4); - nodeData = float(x_109); - const float x_409 = angle; - return ((float3(30.0f, 30.0f, 30.0f) + (float3(1.0f, 5.0f, nodeData) * x_409)) / float3(50.0f, 50.0f, 50.0f)); -} - -void main_1() { - int treeIndex_1 = 0; - BST param_8 = (BST)0; - int param_9 = 0; - int param_10 = 0; - int param_11 = 0; - int GLF_live1_looplimiter2 = 0; - int GLF_live1i = 0; - int param_12 = 0; - int param_13 = 0; - int param_14 = 0; - int param_15 = 0; - int param_16 = 0; - int param_17 = 0; - int param_18 = 0; - int param_19 = 0; - int param_20 = 0; - int param_21 = 0; - int param_22 = 0; - int param_23 = 0; - int GLF_live4_looplimiter3 = 0; - int GLF_live4i = 0; - int GLF_live4index = 0; - Obj GLF_live4obj = (Obj)0; - int param_24 = 0; - int param_25 = 0; - int param_26 = 0; - int param_27 = 0; - float2 z = float2(0.0f, 0.0f); - float x_1 = 0.0f; - float param_28 = 0.0f; - float y_1 = 0.0f; - float param_29 = 0.0f; - int sum = 0; - int target_1 = 0; - int result = 0; - int param_30 = 0; - float a = 0.0f; - float3 x_235 = float3(0.0f, 0.0f, 0.0f); - float param_31 = 0.0f; - treeIndex_1 = 0; - const BST x_237 = tree_1[0]; - param_8 = x_237; - param_9 = 9; - makeTreeNode_struct_BST_i1_i1_i11_i1_(param_8, param_9); - tree_1[0] = param_8; - treeIndex_1 = (treeIndex_1 + 1); - param_10 = treeIndex_1; - param_11 = 5; - insert_i1_i1_(param_10, param_11); - treeIndex_1 = (treeIndex_1 + 1); - GLF_live1_looplimiter2 = 0; - GLF_live1i = 0; - { - [loop] for(; true; GLF_live1i = (GLF_live1i + 1)) { - if ((GLF_live1_looplimiter2 >= 7)) { - break; - } - GLF_live1_looplimiter2 = (GLF_live1_looplimiter2 + 1); - } - } - param_12 = treeIndex_1; - param_13 = 12; - insert_i1_i1_(param_12, param_13); - treeIndex_1 = (treeIndex_1 + 1); - param_14 = treeIndex_1; - param_15 = 15; - insert_i1_i1_(param_14, param_15); - treeIndex_1 = (treeIndex_1 + 1); - param_16 = treeIndex_1; - param_17 = 7; - insert_i1_i1_(param_16, param_17); - treeIndex_1 = (treeIndex_1 + 1); - param_18 = treeIndex_1; - param_19 = 8; - insert_i1_i1_(param_18, param_19); - treeIndex_1 = (treeIndex_1 + 1); - param_20 = treeIndex_1; - param_21 = 2; - insert_i1_i1_(param_20, param_21); - treeIndex_1 = (treeIndex_1 + 1); - param_22 = treeIndex_1; - param_23 = 6; - insert_i1_i1_(param_22, param_23); - treeIndex_1 = (treeIndex_1 + 1); - GLF_live4_looplimiter3 = 0; - GLF_live4i = 0; - { - [loop] for(; true; GLF_live4i = (GLF_live4i + 1)) { - if ((GLF_live4_looplimiter3 >= 3)) { - break; - } - GLF_live4_looplimiter3 = (GLF_live4_looplimiter3 + 1); - GLF_live4index = 1; - const int x_144 = GLF_live4index; - const int x_145 = GLF_live4index; - const int x_146 = GLF_live4index; - const float x_269 = GLF_live4obj.even_numbers[1]; - { - float tint_symbol_1[10] = GLF_live4obj.even_numbers; - bool tint_tmp_1 = (x_144 >= 0); - if (tint_tmp_1) { - tint_tmp_1 = (x_145 < 10); - } - tint_symbol_1[((tint_tmp_1) ? x_146 : 0)] = x_269; - GLF_live4obj.even_numbers = tint_symbol_1; - } - const int x_147 = GLF_live4i; - const int x_148 = GLF_live4i; - const int x_149 = GLF_live4i; - { - float tint_symbol_3[10] = GLF_live4obj.even_numbers; - bool tint_tmp_2 = (x_147 >= 0); - if (tint_tmp_2) { - tint_tmp_2 = (x_148 < 10); - } - tint_symbol_3[((tint_tmp_2) ? x_149 : 0)] = 1.0f; - GLF_live4obj.even_numbers = tint_symbol_3; - } - } - } - param_24 = treeIndex_1; - param_25 = 17; - insert_i1_i1_(param_24, param_25); - const float x_278 = asfloat(x_27[0].x); - const float x_280 = asfloat(x_27[0].y); - if ((x_278 > x_280)) { - return; - } - treeIndex_1 = (treeIndex_1 + 1); - param_26 = treeIndex_1; - param_27 = 13; - insert_i1_i1_(param_26, param_27); - const float4 x_285 = gl_FragCoord; - z = (float2(x_285.y, x_285.x) / float2(256.0f, 256.0f)); - const float x_289 = z.x; - param_28 = x_289; - const float x_290 = makeFrame_f1_(param_28); - x_1 = x_290; - const float x_292 = z.y; - param_29 = x_292; - const float x_293 = makeFrame_f1_(param_29); - y_1 = x_293; - sum = -100; - target_1 = 0; - { - [loop] for(; (target_1 < 20); target_1 = (target_1 + 1)) { - param_30 = target_1; - const int x_158 = search_i1_(param_30); - result = x_158; - if ((result > 0)) { - } else { - switch(result) { - case 0: { - return; - break; - } - case -1: { - sum = (sum + 1); - break; - } - default: { - break; - } - } - } - } - } - a = (x_1 + (y_1 * float(sum))); - const float x_313 = asfloat(x_27[0].x); - const float x_315 = asfloat(x_27[0].y); - if ((x_313 < x_315)) { - x_235 = float3(1.0f, 0.0f, 0.0f); - } else { - param_31 = a; - const float3 x_321 = hueColor_f1_(param_31); - x_235 = x_321; - } - const float3 x_322 = x_235; - x_GLF_color = float4(x_322.x, x_322.y, x_322.z, 1.0f); - return; -} - -struct main_out { - float4 x_GLF_color_1; -}; -struct tint_symbol_5 { - float4 gl_FragCoord_param : SV_Position; -}; -struct tint_symbol_6 { - float4 x_GLF_color_1 : SV_Target0; -}; - -main_out main_inner(float4 gl_FragCoord_param) { - gl_FragCoord = gl_FragCoord_param; - main_1(); - const main_out tint_symbol_8 = {x_GLF_color}; - return tint_symbol_8; -} - -tint_symbol_6 main(tint_symbol_5 tint_symbol_4) { - const main_out inner_result = main_inner(tint_symbol_4.gl_FragCoord_param); - tint_symbol_6 wrapper_result = (tint_symbol_6)0; - wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; - return wrapper_result; -} -C:\src\tint\test\Shader@0x000001C9889DF080(35,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop] -C:\src\tint\test\Shader@0x000001C9889DF080(149,3): warning X4000: use of potentially uninitialized variable (makeFrame_f1_) -internal error: compilation aborted unexpectedly - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl index 772af1d08e..b9456746d6 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl @@ -91,7 +91,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl index 13f20fff8c..2ed7214f18 100644 --- a/test/tint/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl +++ b/test/tint/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl @@ -23,7 +23,7 @@ struct main_out { x_GLF_color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(x_GLF_color); diff --git a/test/tint/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl b/test/tint/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl index 89672bde16..b516363169 100644 --- a/test/tint/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl +++ b/test/tint/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl @@ -109,7 +109,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(4, 1, 1) +@compute @workgroup_size(4, 1, 1) fn main(@builtin(workgroup_id) gl_WorkGroupID_param : vec3) { gl_WorkGroupID = gl_WorkGroupID_param; main_1(); diff --git a/test/tint/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl b/test/tint/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl index d373a8456c..5e8bbe1c9f 100644 --- a/test/tint/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl +++ b/test/tint/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl @@ -109,7 +109,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(4, 1, 1) +@compute @workgroup_size(4, 1, 1) fn main(@builtin(workgroup_id) gl_WorkGroupID_param : vec3) { gl_WorkGroupID = gl_WorkGroupID_param; main_1(); diff --git a/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl b/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl index 08343e5c0c..5ac3080718 100644 --- a/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl +++ b/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl @@ -10,7 +10,7 @@ struct main_out { color_1 : vec4, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(color); diff --git a/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl b/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl index adc5669523..ed844c0f1a 100644 --- a/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl +++ b/test/tint/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl @@ -16,7 +16,7 @@ struct main_out { color_out_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl index 70d0754122..a78ae2c7bd 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl @@ -37,7 +37,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main() { main_1(); } diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl index cb066eea27..b36391115f 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl @@ -20,7 +20,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_2_param : vec3) { x_2 = x_2_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl index 733a1f044c..bae81f9320 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl @@ -20,7 +20,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_2_param : vec3) { x_2 = x_2_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl index c6ad43c225..56061a7ff0 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl @@ -20,7 +20,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_2_param : vec3) { x_2 = x_2_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl index 5ccc2a7a30..fefb524e8e 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl @@ -20,7 +20,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_2_param : vec3) { x_2 = x_2_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl index d7b159fdf4..c2904871c0 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl @@ -23,7 +23,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_3_param : vec3) { x_3 = x_3_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl index a8ef5a22e1..b33c53b40b 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl @@ -17,7 +17,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_3_param : vec3) { x_3 = x_3_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl index 5943d91d3f..8817e33dc0 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl @@ -23,7 +23,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_3_param : vec3) { x_3 = x_3_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl index 2a2b3bdb40..e86ba627da 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl @@ -20,7 +20,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_3_param : vec3) { x_3 = x_3_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl index e1a9836b1a..eade541d21 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl @@ -20,7 +20,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_3_param : vec3) { x_3 = x_3_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl index 293a48cfcf..7958835b31 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl @@ -20,7 +20,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_2_param : vec3) { x_2 = x_2_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl index 08ebc654c8..7f3aca0740 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl @@ -17,7 +17,7 @@ fn main_1() { return; } -@stage(compute) @workgroup_size(1, 1, 1) +@compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) x_2_param : vec3) { x_2 = x_2_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl index 47dac83ef8..6fd10fa07d 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl @@ -20,7 +20,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) x_3_param : vec2) -> main_out { x_3 = x_3_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl index 5fafe44dd9..b3544f7ca5 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl @@ -14,7 +14,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec4) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl index 48f911ce2e..5a82d347e2 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl @@ -15,7 +15,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(color_out, gl_FragDepth); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl index 4301036fdc..811fe594dd 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl @@ -14,7 +14,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec4) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl index 4b7784719d..8b3efb2635 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl @@ -15,7 +15,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(color_out, gl_FragDepth); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl index 8535066d33..ddc27e71db 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl @@ -14,7 +14,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec4) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl index b4531a7f3c..e5ece0c751 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl @@ -15,7 +15,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(color_out, gl_FragDepth); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl index 95d7f54e8d..396a887959 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl @@ -14,7 +14,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec4) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl index 6d7e13db23..bae4d1a85d 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl @@ -15,7 +15,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(color_out, gl_FragDepth); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl index ad8f4af8d6..868da48119 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl @@ -14,7 +14,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec4) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl index 20e02acba1..e59c3fc75a 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl @@ -14,7 +14,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec4) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl index 9f3a0ac409..f2a67fb39f 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl @@ -15,7 +15,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(outColor, gl_FragDepth); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl index ff8fc9aa96..cf4b64c986 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl @@ -15,7 +15,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(outColor, gl_FragDepth); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl index 7039723a78..d68db5f286 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl @@ -15,7 +15,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(outColor, gl_FragDepth); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl index 7d01c21591..adf7699fd9 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl @@ -18,7 +18,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl index 2a68cc41db..e07220e686 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl @@ -15,7 +15,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(outColor, gl_FragDepth); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl index e7b8508fc7..944535159d 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl @@ -15,7 +15,7 @@ struct main_out { gl_FragDepth_1 : f32, } -@stage(fragment) +@fragment fn main() -> main_out { main_1(); return main_out(outColor, gl_FragDepth); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl index cf79af0536..330cec1d57 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl @@ -18,7 +18,7 @@ struct main_out { pos_1 : u32, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec4) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.glsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.glsl deleted file mode 100644 index cfcb39e9a4..0000000000 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.glsl +++ /dev/null @@ -1,46 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(location = 0) in vec3 x_2_param_1; -layout(location = 1) flat in int x_3_param_1; -layout(location = 0) flat out int x_4_1_1; -vec3 x_2 = vec3(0.0f, 0.0f, 0.0f); -int x_3 = 0; -int x_4 = 0; -vec4 tint_symbol = vec4(0.0f, 0.0f, 0.0f, 0.0f); -void main_1() { - tint_symbol = vec4(x_2, 1.0f); - x_4 = x_3; - return; -} - -struct main_out { - int x_4_1; - vec4 tint_symbol; -}; - -main_out tint_symbol_1(vec3 x_2_param, int x_3_param) { - x_2 = x_2_param; - x_3 = x_3_param; - main_1(); - main_out tint_symbol_2 = main_out(x_4, tint_symbol); - return tint_symbol_2; -} - -void main() { - gl_PointSize = 1.0; - main_out inner_result = tint_symbol_1(x_2_param_1, x_3_param_1); - x_4_1_1 = inner_result.x_4_1; - gl_Position = inner_result.tint_symbol; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: '' : vertex input cannot be further qualified -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl index dbe9cdea6e..c9840715b2 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl @@ -20,7 +20,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) x_2_param : vec3, @location(1) @interpolate(flat) x_3_param : i32) -> main_out { x_2 = x_2_param; x_3 = x_3_param; diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.glsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.glsl deleted file mode 100644 index cfcb39e9a4..0000000000 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.glsl +++ /dev/null @@ -1,46 +0,0 @@ -SKIP: FAILED - -#version 310 es - -layout(location = 0) in vec3 x_2_param_1; -layout(location = 1) flat in int x_3_param_1; -layout(location = 0) flat out int x_4_1_1; -vec3 x_2 = vec3(0.0f, 0.0f, 0.0f); -int x_3 = 0; -int x_4 = 0; -vec4 tint_symbol = vec4(0.0f, 0.0f, 0.0f, 0.0f); -void main_1() { - tint_symbol = vec4(x_2, 1.0f); - x_4 = x_3; - return; -} - -struct main_out { - int x_4_1; - vec4 tint_symbol; -}; - -main_out tint_symbol_1(vec3 x_2_param, int x_3_param) { - x_2 = x_2_param; - x_3 = x_3_param; - main_1(); - main_out tint_symbol_2 = main_out(x_4, tint_symbol); - return tint_symbol_2; -} - -void main() { - gl_PointSize = 1.0; - main_out inner_result = tint_symbol_1(x_2_param_1, x_3_param_1); - x_4_1_1 = inner_result.x_4_1; - gl_Position = inner_result.tint_symbol; - gl_Position.y = -(gl_Position.y); - gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); - return; -} -Error parsing GLSL shader: -ERROR: 0:4: '' : vertex input cannot be further qualified -ERROR: 0:4: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl index a4d22f28f6..59e367d4da 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl @@ -23,7 +23,7 @@ struct main_out { x_4_1 : i32, } -@stage(fragment) +@fragment fn main(@builtin(position) x_2_param : vec4, @location(0) @interpolate(flat) x_3_param : i32) -> main_out { x_2 = x_2_param; x_3 = x_3_param; diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl index 18d4b52682..2cfa888904 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl @@ -18,7 +18,7 @@ struct main_out { x_4_1 : i32, } -@stage(fragment) +@fragment fn main(@builtin(position) x_2_param : vec4, @location(0) @interpolate(flat) x_3_param : i32) -> main_out { x_2 = x_2_param; x_3 = x_3_param; diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl index 88ebe31465..9790cbd5ff 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl @@ -20,7 +20,7 @@ struct main_out { out_data_1 : i32, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl index 1c90d21dc1..c8c5fd14f7 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl @@ -18,7 +18,7 @@ struct main_out { x_4_1 : i32, } -@stage(fragment) +@fragment fn main(@builtin(position) x_2_param : vec4, @location(0) @interpolate(flat) x_3_param : i32) -> main_out { x_2 = x_2_param; x_3 = x_3_param; diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl index c57b47631c..472f453158 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl @@ -29,7 +29,7 @@ struct main_out { x_4_1 : i32, } -@stage(fragment) +@fragment fn main(@builtin(position) x_2_param : vec4, @location(0) @interpolate(flat) x_3_param : i32) -> main_out { x_2 = x_2_param; x_3 = x_3_param; diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl index 1db1c34f5b..2cdb543b3d 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl @@ -29,7 +29,7 @@ struct main_out { x_4_1 : i32, } -@stage(fragment) +@fragment fn main(@builtin(position) x_2_param : vec4, @location(0) @interpolate(flat) x_3_param : i32) -> main_out { x_2 = x_2_param; x_3 = x_3_param; diff --git a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl index c1412bdca5..5701f86f7f 100644 --- a/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl +++ b/test/tint/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl @@ -33,7 +33,7 @@ struct main_out { x_4_1 : i32, } -@stage(fragment) +@fragment fn main(@builtin(position) x_2_param : vec4, @location(0) @interpolate(flat) x_3_param : i32) -> main_out { x_2 = x_2_param; x_3 = x_3_param; diff --git a/test/tint/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl b/test/tint/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl index 97fb1ae72e..162c7151c1 100644 --- a/test/tint/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl +++ b/test/tint/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl @@ -13,7 +13,7 @@ struct main_out { gl_Position : vec4, } -@stage(vertex) +@vertex fn main(@location(0) position_param : vec3) -> main_out { position = position_param; main_1(); diff --git a/test/tint/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl b/test/tint/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl index 63fb5d0c29..325436a8bc 100644 --- a/test/tint/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl +++ b/test/tint/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl @@ -26,7 +26,7 @@ struct main_out { expect_1 : i32, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/test/tint/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl b/test/tint/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl index 964f60ce91..9aad59efa4 100644 --- a/test/tint/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl +++ b/test/tint/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl @@ -13,7 +13,7 @@ struct main_out { color_out_1 : vec4, } -@stage(fragment) +@fragment fn main(@location(0) color_in_param : vec4) -> main_out { color_in = color_in_param; main_1(); diff --git a/test/tint/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl b/test/tint/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl index 777eb67ac9..277b8f277d 100644 --- a/test/tint/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl +++ b/test/tint/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl @@ -14,7 +14,7 @@ struct main_out { result_1 : vec4, } -@stage(fragment) +@fragment fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { gl_FragCoord = gl_FragCoord_param; main_1(); diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index d516352adc..a8dcf80227 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -23,24 +23,12 @@ if (NOT TARGET SPIRV-Headers) add_subdirectory(${DAWN_SPIRV_HEADERS_DIR} "${CMAKE_CURRENT_BINARY_DIR}/spirv-headers") endif() -if(${TINT_BUILD_GLSL_WRITER}) - if(${TINT_BUILD_SAMPLES}) - add_subdirectory("${DAWN_THIRD_PARTY_DIR}/vulkan-deps/glslang/src" "${CMAKE_CURRENT_BINARY_DIR}/glslang" EXCLUDE_FROM_ALL) - endif() -endif() - # Needs to come before SPIR-V Tools if ((${TINT_BUILD_SPIRV_TOOLS_FUZZER} OR ${TINT_BUILD_AST_FUZZER}) AND - (NOT TARGET protobuf::libprotobuf OR NOT TARGET protobuf::protoc)) - set(protobuf_BUILD_TESTS OFF CACHE BOOL "Controls whether protobuf tests are built" FORCE) - set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Controls whether a protobuf static runtime is built" FORCE) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/protobuf/cmake) -endif() - -if(${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER}) - if (NOT IS_DIRECTORY "${SPIRV-Headers_SOURCE_DIR}") - set(SPIRV-Headers_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers CACHE STRING "Source directory for SPIR-V headers") - endif() + (NOT TARGET protobuf::libprotobuf OR NOT TARGET protobuf::protoc)) + set(protobuf_BUILD_TESTS OFF CACHE BOOL "Controls whether protobuf tests are built" FORCE) + set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Controls whether a protobuf static runtime is built" FORCE) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/protobuf/cmake) endif() if (NOT TARGET SPIRV-Tools) @@ -49,17 +37,22 @@ if (NOT TARGET SPIRV-Tools) set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "" FORCE) if(${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER}) - set(SPIRV_SKIP_TESTS ON CACHE BOOL "Controls whether SPIR-V tests are run" FORCE) - set(SPIRV_WERROR OFF CACHE BOOL OFF FORCE) - if (${TINT_BUILD_SPIRV_TOOLS_FUZZER}) - set(SPIRV_BUILD_FUZZER ON CACHE BOOL "Controls whether spirv-fuzz is built" FORCE) - endif() + set(SPIRV_SKIP_TESTS ON CACHE BOOL "Controls whether SPIR-V tests are run" FORCE) + set(SPIRV_WERROR OFF CACHE BOOL OFF FORCE) + if (${TINT_BUILD_SPIRV_TOOLS_FUZZER}) + set(SPIRV_BUILD_FUZZER ON CACHE BOOL "Controls whether spirv-fuzz is built" FORCE) + endif() endif() message(STATUS "Dawn: using SPIRV-Tools at ${DAWN_SPIRV_TOOLS_DIR}") add_subdirectory(${DAWN_SPIRV_TOOLS_DIR} "${CMAKE_CURRENT_BINARY_DIR}/spirv-tools" EXCLUDE_FROM_ALL) endif() +if(NOT TARGET glslang AND ${TINT_BUILD_GLSL_WRITER} AND ${TINT_BUILD_SAMPLES}) + set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "" FORCE) + add_subdirectory("${DAWN_THIRD_PARTY_DIR}/vulkan-deps/glslang/src" "${CMAKE_CURRENT_BINARY_DIR}/glslang" EXCLUDE_FROM_ALL) +endif() + if (NOT TARGET glfw) set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) @@ -96,7 +89,7 @@ target_sources(dawn_vulkan_headers INTERFACE ) target_include_directories(dawn_vulkan_headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos") -if (${DAWN_ENABLE_SWIFTSHADER} AND NOT TARGET vk_swiftshader) +if (NOT TARGET vk_swiftshader AND ${DAWN_ENABLE_SWIFTSHADER}) set(SWIFTSHADER_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(SWIFTSHADER_BUILD_BENCHMARKS OFF CACHE BOOL "" FORCE) @@ -105,11 +98,11 @@ if (${DAWN_ENABLE_SWIFTSHADER} AND NOT TARGET vk_swiftshader) endif() if (${TINT_BUILD_BENCHMARKS}) - set(BENCHMARK_ENABLE_TESTING FALSE CACHE BOOL FALSE FORCE) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark EXCLUDE_FROM_ALL) + set(BENCHMARK_ENABLE_TESTING FALSE CACHE BOOL FALSE FORCE) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark EXCLUDE_FROM_ALL) endif() -if (${TINT_BUILD_TESTS} AND NOT TARGET gmock) - set(gtest_force_shared_crt ON CACHE BOOL "Controls whether a shared run-time library should be used even when Google Test is built as static library" FORCE) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest EXCLUDE_FROM_ALL) +if (NOT TARGET gmock AND ${TINT_BUILD_TESTS}) + set(gtest_force_shared_crt ON CACHE BOOL "Controls whether a shared run-time library should be used even when Google Test is built as static library" FORCE) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest EXCLUDE_FROM_ALL) endif() diff --git a/third_party/gn/glfw/BUILD.gn b/third_party/gn/glfw/BUILD.gn index b592b4d2c4..1c00094c13 100644 --- a/third_party/gn/glfw/BUILD.gn +++ b/third_party/gn/glfw/BUILD.gn @@ -25,23 +25,6 @@ glfw_dir = dawn_glfw_dir config("glfw_public") { include_dirs = [ "${glfw_dir}/include" ] - - if (is_win) { - defines = [ "_GLFW_WIN32" ] - } - - if (is_mac) { - defines = [ "_GLFW_COCOA" ] - } - - if (is_linux) { - # ANGLE builds only libEGL.so, so tell GLFW to load that instead of - # the default libEGL.so.1. - defines = [ - "_GLFW_X11", - "_GLFW_EGL_LIBRARY=\"libEGL.so\"", - ] - } } static_library("glfw") { @@ -59,56 +42,79 @@ static_library("glfw") { cflags_c = [ "-Wno-sign-compare", "-Wno-missing-field-initializers", + "-Wno-macro-redefined", ] } + defines = [] + libs = [] + + # Common sources. sources = [ "${glfw_dir}/include/GLFW/glfw3.h", "${glfw_dir}/include/GLFW/glfw3native.h", "${glfw_dir}/src/context.c", "${glfw_dir}/src/egl_context.c", - "${glfw_dir}/src/egl_context.h", "${glfw_dir}/src/init.c", "${glfw_dir}/src/input.c", "${glfw_dir}/src/internal.h", + "${glfw_dir}/src/mappings.h", "${glfw_dir}/src/monitor.c", + "${glfw_dir}/src/null_init.c", + "${glfw_dir}/src/null_joystick.c", + "${glfw_dir}/src/null_joystick.h", + "${glfw_dir}/src/null_monitor.c", + "${glfw_dir}/src/null_platform.h", + "${glfw_dir}/src/null_window.c", "${glfw_dir}/src/osmesa_context.c", - "${glfw_dir}/src/osmesa_context.h", + "${glfw_dir}/src/platform.c", + "${glfw_dir}/src/platform.h", "${glfw_dir}/src/vulkan.c", "${glfw_dir}/src/window.c", ] - libs = [] - if (is_win) { + # Code shared by all backends on an OS. + if (is_linux) { + defines += [ "_GLFW_EGL_LIBRARY=\"libEGL.so\"" ] sources += [ - "${glfw_dir}/src/wgl_context.c", - "${glfw_dir}/src/wgl_context.h", - "${glfw_dir}/src/win32_init.c", - "${glfw_dir}/src/win32_joystick.c", - "${glfw_dir}/src/win32_joystick.h", - "${glfw_dir}/src/win32_monitor.c", - "${glfw_dir}/src/win32_platform.h", - "${glfw_dir}/src/win32_thread.c", - "${glfw_dir}/src/win32_time.c", - "${glfw_dir}/src/win32_window.c", + "${glfw_dir}/src/posix_module.c", + "${glfw_dir}/src/posix_thread.c", + "${glfw_dir}/src/posix_thread.h", + "${glfw_dir}/src/posix_time.c", + "${glfw_dir}/src/posix_time.h", + ] + libs += [ + "m", + "rt", + "dl", ] } - if (is_linux || is_mac) { + if (is_mac) { sources += [ + "${glfw_dir}/src/cocoa_time.c", + "${glfw_dir}/src/cocoa_time.h", + "${glfw_dir}/src/posix_module.c", "${glfw_dir}/src/posix_thread.c", "${glfw_dir}/src/posix_thread.h", ] } - if (is_linux) { + if (is_win) { + sources += [ + "${glfw_dir}/src/win32_module.c", + "${glfw_dir}/src/win32_thread.c", + "${glfw_dir}/src/win32_thread.h", + "${glfw_dir}/src/win32_time.c", + "${glfw_dir}/src/win32_time.h", + ] + } + + # Per-backend code. + if (dawn_use_x11) { + defines += [ "_GLFW_X11" ] sources += [ "${glfw_dir}/src/glx_context.c", - "${glfw_dir}/src/glx_context.h", - "${glfw_dir}/src/linux_joystick.c", - "${glfw_dir}/src/linux_joystick.h", - "${glfw_dir}/src/posix_time.c", - "${glfw_dir}/src/posix_time.h", "${glfw_dir}/src/x11_init.c", "${glfw_dir}/src/x11_monitor.c", "${glfw_dir}/src/x11_platform.h", @@ -116,34 +122,44 @@ static_library("glfw") { "${glfw_dir}/src/xkb_unicode.c", "${glfw_dir}/src/xkb_unicode.h", ] - libs += [ - "rt", - "dl", "X11", + "Xi", "Xcursor", "Xinerama", "Xrandr", ] } + # No wayland support for GLFW in GN builds. + if (dawn_use_x11) { + if (is_linux) { + sources += [ + "${glfw_dir}/src/linux_joystick.c", + "${glfw_dir}/src/linux_joystick.h", + ] + } + sources += [ + "${glfw_dir}/src/posix_poll.c", + "${glfw_dir}/src/posix_poll.h", + ] + } if (is_mac) { + defines += [ "_GLFW_COCOA" ] sources += [ "${glfw_dir}/src/cocoa_init.m", "${glfw_dir}/src/cocoa_joystick.h", "${glfw_dir}/src/cocoa_joystick.m", "${glfw_dir}/src/cocoa_monitor.m", "${glfw_dir}/src/cocoa_platform.h", - "${glfw_dir}/src/cocoa_time.c", "${glfw_dir}/src/cocoa_window.m", - "${glfw_dir}/src/nsgl_context.h", "${glfw_dir}/src/nsgl_context.m", ] + frameworks = [ "Cocoa.framework", "IOKit.framework", "CoreFoundation.framework", - "CoreVideo.framework", ] cflags_objc = [ "-Wno-sign-compare", @@ -151,4 +167,17 @@ static_library("glfw") { "-Wno-objc-multiple-method-names", ] } + + if (is_win) { + defines += [ "_GLFW_WIN32" ] + sources += [ + "${glfw_dir}/src/wgl_context.c", + "${glfw_dir}/src/win32_init.c", + "${glfw_dir}/src/win32_joystick.c", + "${glfw_dir}/src/win32_joystick.h", + "${glfw_dir}/src/win32_monitor.c", + "${glfw_dir}/src/win32_platform.h", + "${glfw_dir}/src/win32_window.c", + ] + } } diff --git a/third_party/gn/webgpu-cts/BUILD.gn b/third_party/gn/webgpu-cts/BUILD.gn index 3582bc27e8..43742d6a90 100644 --- a/third_party/gn/webgpu-cts/BUILD.gn +++ b/third_party/gn/webgpu-cts/BUILD.gn @@ -24,6 +24,7 @@ group("webgpu-cts") { ":copy_resources", ":verify_gen_ts_dep_list", ] + data = [ "test_list.txt" ] } list_from_ts_sources_txt = read_file("ts_sources.txt", "list lines") diff --git a/third_party/gn/webgpu-cts/resource_files.txt b/third_party/gn/webgpu-cts/resource_files.txt index 812c137c6d..f9b6c360b3 100644 --- a/third_party/gn/webgpu-cts/resource_files.txt +++ b/third_party/gn/webgpu-cts/resource_files.txt @@ -1,6 +1,8 @@ Di-3d.png README.md +red-green.bt2020.vp9.webm red-green.bt601.vp9.webm +red-green.bt709.vp9.webm red-green.mp4 red-green.theora.ogv red-green.webmvp8.webm diff --git a/third_party/gn/webgpu-cts/test_list.txt b/third_party/gn/webgpu-cts/test_list.txt new file mode 100644 index 0000000000..974778a08a --- /dev/null +++ b/third_party/gn/webgpu-cts/test_list.txt @@ -0,0 +1,35696 @@ +webgpu:api,operation,adapter,requestAdapterInfo:adapter_info: +webgpu:api,operation,adapter,requestAdapterInfo:adapter_info_with_hints: +webgpu:api,operation,adapter,requestDevice:request_default_after_error: +webgpu:api,operation,adapter,requestDevice_limits:unknown_limits: +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxTextureDimension1D" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxTextureDimension2D" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxTextureDimension3D" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxTextureArrayLayers" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxBindGroups" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxDynamicUniformBuffersPerPipelineLayout" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxDynamicStorageBuffersPerPipelineLayout" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxSampledTexturesPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxSamplersPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxStorageBuffersPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxStorageTexturesPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxUniformBuffersPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxUniformBufferBindingSize" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxStorageBufferBindingSize" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="minUniformBufferOffsetAlignment" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="minStorageBufferOffsetAlignment" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxVertexBuffers" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxVertexAttributes" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxVertexBufferArrayStride" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxInterStageShaderComponents" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxComputeWorkgroupStorageSize" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxComputeInvocationsPerWorkgroup" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxComputeWorkgroupSizeX" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxComputeWorkgroupSizeY" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxComputeWorkgroupSizeZ" +webgpu:api,operation,adapter,requestDevice_limits:supported_limits:limit="maxComputeWorkgroupsPerDimension" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxTextureDimension1D" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxTextureDimension2D" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxTextureDimension3D" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxTextureArrayLayers" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxBindGroups" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxDynamicUniformBuffersPerPipelineLayout" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxDynamicStorageBuffersPerPipelineLayout" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxSampledTexturesPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxSamplersPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxStorageBuffersPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxStorageTexturesPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxUniformBuffersPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxUniformBufferBindingSize" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxStorageBufferBindingSize" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="minUniformBufferOffsetAlignment" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="minStorageBufferOffsetAlignment" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxVertexBuffers" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxVertexAttributes" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxVertexBufferArrayStride" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxInterStageShaderComponents" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxComputeWorkgroupStorageSize" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxComputeInvocationsPerWorkgroup" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxComputeWorkgroupSizeX" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxComputeWorkgroupSizeY" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxComputeWorkgroupSizeZ" +webgpu:api,operation,adapter,requestDevice_limits:better_than_supported:limit="maxComputeWorkgroupsPerDimension" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxTextureDimension1D" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxTextureDimension2D" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxTextureDimension3D" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxTextureArrayLayers" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxBindGroups" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxDynamicUniformBuffersPerPipelineLayout" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxDynamicStorageBuffersPerPipelineLayout" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxSampledTexturesPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxSamplersPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxStorageBuffersPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxStorageTexturesPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxUniformBuffersPerShaderStage" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxUniformBufferBindingSize" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxStorageBufferBindingSize" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="minUniformBufferOffsetAlignment" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="minStorageBufferOffsetAlignment" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxVertexBuffers" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxVertexAttributes" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxVertexBufferArrayStride" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxInterStageShaderComponents" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxComputeWorkgroupStorageSize" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxComputeInvocationsPerWorkgroup" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxComputeWorkgroupSizeX" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxComputeWorkgroupSizeY" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxComputeWorkgroupSizeZ" +webgpu:api,operation,adapter,requestDevice_limits:worse_than_default:limit="maxComputeWorkgroupsPerDimension" +webgpu:api,operation,buffers,map:mapAsync,write:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:mapAsync,write:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:mapAsync,write:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:mapAsync,write:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:mapAsync,write:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:mapAsync,write:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:mapAsync,write:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:mapAsync,write:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:mapAsync,write:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:mapAsync,write,unchanged_ranges_preserved: +webgpu:api,operation,buffers,map:mapAsync,read:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:mapAsync,read:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:mapAsync,read:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:mapAsync,read:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:mapAsync,read:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:mapAsync,read:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:mapAsync,read:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:mapAsync,read:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:mapAsync,read:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:mappedAtCreation:mappable=false +webgpu:api,operation,buffers,map:mappedAtCreation:mappable=true +webgpu:api,operation,buffers,map:remapped_for_write:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:remapped_for_write:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:remapped_for_write:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:remapped_for_write:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:remapped_for_write:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:remapped_for_write:mapAsyncRegionLeft="explicit-expand";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map:remapped_for_write:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="default-expand" +webgpu:api,operation,buffers,map:remapped_for_write:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="explicit-expand" +webgpu:api,operation,buffers,map:remapped_for_write:mapAsyncRegionLeft="minimal";mapAsyncRegionRight="minimal" +webgpu:api,operation,buffers,map_ArrayBuffer:postMessage:transfer=false;mapMode="READ" +webgpu:api,operation,buffers,map_ArrayBuffer:postMessage:transfer=false;mapMode="WRITE" +webgpu:api,operation,buffers,map_ArrayBuffer:postMessage:transfer=true;mapMode="READ" +webgpu:api,operation,buffers,map_ArrayBuffer:postMessage:transfer=true;mapMode="WRITE" +webgpu:api,operation,buffers,map_detach:while_mapped: +webgpu:api,operation,buffers,map_oom:mapAsync:oom=false;size=16 +webgpu:api,operation,buffers,map_oom:mapAsync:oom=true;size=9007199254740984 +webgpu:api,operation,buffers,map_oom:mapAsync:oom=true;size=137438953472 +webgpu:api,operation,buffers,map_oom:mappedAtCreation,full_getMappedRange:oom=false;size=16 +webgpu:api,operation,buffers,map_oom:mappedAtCreation,full_getMappedRange:oom=true;size=9007199254740984 +webgpu:api,operation,buffers,map_oom:mappedAtCreation,full_getMappedRange:oom=true;size=137438953472 +webgpu:api,operation,buffers,map_oom:mappedAtCreation,smaller_getMappedRange:oom=false;size=16 +webgpu:api,operation,buffers,map_oom:mappedAtCreation,smaller_getMappedRange:oom=true;size=9007199254740984 +webgpu:api,operation,buffers,map_oom:mappedAtCreation,smaller_getMappedRange:oom=true;size=137438953472 +webgpu:api,operation,buffers,threading:serialize: +webgpu:api,operation,buffers,threading:destroyed: +webgpu:api,operation,command_buffer,basic:empty: +webgpu:api,operation,command_buffer,basic:b2t2b: +webgpu:api,operation,command_buffer,basic:b2t2t2b: +webgpu:api,operation,command_buffer,clearBuffer:clear: +webgpu:api,operation,command_buffer,copyBufferToBuffer:single: +webgpu:api,operation,command_buffer,copyBufferToBuffer:state_transitions: +webgpu:api,operation,command_buffer,copyBufferToBuffer:copy_order: +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8unorm";dstFormat="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8unorm";dstFormat="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8unorm";dstFormat="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8snorm";dstFormat="r8snorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8snorm";dstFormat="r8snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8snorm";dstFormat="r8snorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8uint";dstFormat="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8uint";dstFormat="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8uint";dstFormat="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8sint";dstFormat="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8sint";dstFormat="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r8sint";dstFormat="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r16uint";dstFormat="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r16uint";dstFormat="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r16uint";dstFormat="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r16sint";dstFormat="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r16sint";dstFormat="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r16sint";dstFormat="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r16float";dstFormat="r16float";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r16float";dstFormat="r16float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r16float";dstFormat="r16float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8unorm";dstFormat="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8unorm";dstFormat="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8unorm";dstFormat="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8snorm";dstFormat="rg8snorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8snorm";dstFormat="rg8snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8snorm";dstFormat="rg8snorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8uint";dstFormat="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8uint";dstFormat="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8uint";dstFormat="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8sint";dstFormat="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8sint";dstFormat="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg8sint";dstFormat="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r32uint";dstFormat="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r32uint";dstFormat="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r32uint";dstFormat="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r32sint";dstFormat="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r32sint";dstFormat="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r32sint";dstFormat="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r32float";dstFormat="r32float";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r32float";dstFormat="r32float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="r32float";dstFormat="r32float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg16uint";dstFormat="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg16uint";dstFormat="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg16uint";dstFormat="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg16sint";dstFormat="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg16sint";dstFormat="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg16sint";dstFormat="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg16float";dstFormat="rg16float";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg16float";dstFormat="rg16float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg16float";dstFormat="rg16float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm";dstFormat="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm";dstFormat="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm";dstFormat="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm";dstFormat="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm";dstFormat="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm";dstFormat="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8snorm";dstFormat="rgba8snorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8snorm";dstFormat="rgba8snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8snorm";dstFormat="rgba8snorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8uint";dstFormat="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8uint";dstFormat="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8uint";dstFormat="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8sint";dstFormat="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8sint";dstFormat="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba8sint";dstFormat="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm";dstFormat="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm";dstFormat="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm";dstFormat="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm";dstFormat="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm";dstFormat="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm";dstFormat="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgb10a2unorm";dstFormat="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgb10a2unorm";dstFormat="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgb10a2unorm";dstFormat="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg11b10ufloat";dstFormat="rg11b10ufloat";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg11b10ufloat";dstFormat="rg11b10ufloat";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg11b10ufloat";dstFormat="rg11b10ufloat";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgb9e5ufloat";dstFormat="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgb9e5ufloat";dstFormat="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgb9e5ufloat";dstFormat="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg32uint";dstFormat="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg32uint";dstFormat="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg32uint";dstFormat="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg32sint";dstFormat="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg32sint";dstFormat="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg32sint";dstFormat="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg32float";dstFormat="rg32float";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg32float";dstFormat="rg32float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rg32float";dstFormat="rg32float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba16uint";dstFormat="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba16uint";dstFormat="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba16uint";dstFormat="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba16sint";dstFormat="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba16sint";dstFormat="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba16sint";dstFormat="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba16float";dstFormat="rgba16float";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba16float";dstFormat="rgba16float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba16float";dstFormat="rgba16float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba32uint";dstFormat="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba32uint";dstFormat="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba32uint";dstFormat="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba32sint";dstFormat="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba32sint";dstFormat="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba32sint";dstFormat="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba32float";dstFormat="rgba32float";dimension="1d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba32float";dstFormat="rgba32float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,non_array:srcFormat="rgba32float";dstFormat="rgba32float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r8unorm";dstFormat="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r8unorm";dstFormat="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r8snorm";dstFormat="r8snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r8snorm";dstFormat="r8snorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r8uint";dstFormat="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r8uint";dstFormat="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r8sint";dstFormat="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r8sint";dstFormat="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r16uint";dstFormat="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r16uint";dstFormat="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r16sint";dstFormat="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r16sint";dstFormat="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r16float";dstFormat="r16float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r16float";dstFormat="r16float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg8unorm";dstFormat="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg8unorm";dstFormat="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg8snorm";dstFormat="rg8snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg8snorm";dstFormat="rg8snorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg8uint";dstFormat="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg8uint";dstFormat="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg8sint";dstFormat="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg8sint";dstFormat="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r32uint";dstFormat="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r32uint";dstFormat="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r32sint";dstFormat="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r32sint";dstFormat="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r32float";dstFormat="r32float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="r32float";dstFormat="r32float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg16uint";dstFormat="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg16uint";dstFormat="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg16sint";dstFormat="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg16sint";dstFormat="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg16float";dstFormat="rg16float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg16float";dstFormat="rg16float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8unorm";dstFormat="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8unorm";dstFormat="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8unorm";dstFormat="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8unorm";dstFormat="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8unorm-srgb";dstFormat="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8snorm";dstFormat="rgba8snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8snorm";dstFormat="rgba8snorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8uint";dstFormat="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8uint";dstFormat="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8sint";dstFormat="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba8sint";dstFormat="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="bgra8unorm";dstFormat="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="bgra8unorm";dstFormat="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="bgra8unorm";dstFormat="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="bgra8unorm";dstFormat="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="bgra8unorm-srgb";dstFormat="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgb10a2unorm";dstFormat="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgb10a2unorm";dstFormat="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg11b10ufloat";dstFormat="rg11b10ufloat";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg11b10ufloat";dstFormat="rg11b10ufloat";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgb9e5ufloat";dstFormat="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgb9e5ufloat";dstFormat="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg32uint";dstFormat="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg32uint";dstFormat="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg32sint";dstFormat="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg32sint";dstFormat="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg32float";dstFormat="rg32float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rg32float";dstFormat="rg32float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba16uint";dstFormat="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba16uint";dstFormat="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba16sint";dstFormat="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba16sint";dstFormat="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba16float";dstFormat="rgba16float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba16float";dstFormat="rgba16float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba32uint";dstFormat="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba32uint";dstFormat="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba32sint";dstFormat="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba32sint";dstFormat="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba32float";dstFormat="rgba32float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,non_compressed,array:srcFormat="rgba32float";dstFormat="rgba32float";dimension="3d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc1-rgba-unorm";dstFormat="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc1-rgba-unorm";dstFormat="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc1-rgba-unorm-srgb";dstFormat="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc1-rgba-unorm-srgb";dstFormat="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc2-rgba-unorm";dstFormat="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc2-rgba-unorm";dstFormat="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc2-rgba-unorm-srgb";dstFormat="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc2-rgba-unorm-srgb";dstFormat="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc3-rgba-unorm";dstFormat="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc3-rgba-unorm";dstFormat="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc3-rgba-unorm-srgb";dstFormat="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc3-rgba-unorm-srgb";dstFormat="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc4-r-unorm";dstFormat="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc4-r-snorm";dstFormat="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc5-rg-unorm";dstFormat="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc5-rg-snorm";dstFormat="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc6h-rgb-ufloat";dstFormat="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc6h-rgb-float";dstFormat="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc7-rgba-unorm";dstFormat="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc7-rgba-unorm";dstFormat="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc7-rgba-unorm-srgb";dstFormat="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc7-rgba-unorm-srgb";dstFormat="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgb8unorm";dstFormat="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgb8unorm";dstFormat="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgb8unorm-srgb";dstFormat="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgb8unorm-srgb";dstFormat="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgb8a1unorm";dstFormat="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgb8a1unorm";dstFormat="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgb8a1unorm-srgb";dstFormat="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgb8a1unorm-srgb";dstFormat="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgba8unorm";dstFormat="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgba8unorm";dstFormat="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgba8unorm-srgb";dstFormat="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="etc2-rgba8unorm-srgb";dstFormat="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="eac-r11unorm";dstFormat="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="eac-r11snorm";dstFormat="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="eac-rg11unorm";dstFormat="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="eac-rg11snorm";dstFormat="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-4x4-unorm";dstFormat="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-4x4-unorm";dstFormat="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-4x4-unorm-srgb";dstFormat="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-4x4-unorm-srgb";dstFormat="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-5x4-unorm";dstFormat="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-5x4-unorm";dstFormat="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-5x4-unorm-srgb";dstFormat="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-5x4-unorm-srgb";dstFormat="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-5x5-unorm";dstFormat="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-5x5-unorm";dstFormat="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-5x5-unorm-srgb";dstFormat="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-5x5-unorm-srgb";dstFormat="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-6x5-unorm";dstFormat="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-6x5-unorm";dstFormat="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-6x5-unorm-srgb";dstFormat="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-6x5-unorm-srgb";dstFormat="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-6x6-unorm";dstFormat="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-6x6-unorm";dstFormat="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-6x6-unorm-srgb";dstFormat="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-6x6-unorm-srgb";dstFormat="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x5-unorm";dstFormat="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x5-unorm";dstFormat="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x5-unorm-srgb";dstFormat="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x5-unorm-srgb";dstFormat="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x6-unorm";dstFormat="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x6-unorm";dstFormat="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x6-unorm-srgb";dstFormat="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x6-unorm-srgb";dstFormat="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x8-unorm";dstFormat="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x8-unorm";dstFormat="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x8-unorm-srgb";dstFormat="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-8x8-unorm-srgb";dstFormat="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x5-unorm";dstFormat="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x5-unorm";dstFormat="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x5-unorm-srgb";dstFormat="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x5-unorm-srgb";dstFormat="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x6-unorm";dstFormat="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x6-unorm";dstFormat="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x6-unorm-srgb";dstFormat="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x6-unorm-srgb";dstFormat="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x8-unorm";dstFormat="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x8-unorm";dstFormat="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x8-unorm-srgb";dstFormat="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x8-unorm-srgb";dstFormat="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x10-unorm";dstFormat="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x10-unorm";dstFormat="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x10-unorm-srgb";dstFormat="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-10x10-unorm-srgb";dstFormat="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-12x10-unorm";dstFormat="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-12x10-unorm";dstFormat="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-12x10-unorm-srgb";dstFormat="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-12x10-unorm-srgb";dstFormat="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-12x12-unorm";dstFormat="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-12x12-unorm";dstFormat="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-12x12-unorm-srgb";dstFormat="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="astc-12x12-unorm-srgb";dstFormat="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc1-rgba-unorm";dstFormat="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc1-rgba-unorm";dstFormat="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc1-rgba-unorm-srgb";dstFormat="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc1-rgba-unorm-srgb";dstFormat="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc2-rgba-unorm";dstFormat="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc2-rgba-unorm";dstFormat="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc2-rgba-unorm-srgb";dstFormat="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc2-rgba-unorm-srgb";dstFormat="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc3-rgba-unorm";dstFormat="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc3-rgba-unorm";dstFormat="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc3-rgba-unorm-srgb";dstFormat="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc3-rgba-unorm-srgb";dstFormat="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc4-r-unorm";dstFormat="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc4-r-snorm";dstFormat="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc5-rg-unorm";dstFormat="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc5-rg-snorm";dstFormat="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc6h-rgb-ufloat";dstFormat="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc6h-rgb-float";dstFormat="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc7-rgba-unorm";dstFormat="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc7-rgba-unorm";dstFormat="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc7-rgba-unorm-srgb";dstFormat="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc7-rgba-unorm-srgb";dstFormat="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgb8unorm";dstFormat="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgb8unorm";dstFormat="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgb8unorm-srgb";dstFormat="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgb8unorm-srgb";dstFormat="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgb8a1unorm";dstFormat="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgb8a1unorm";dstFormat="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgb8a1unorm-srgb";dstFormat="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgb8a1unorm-srgb";dstFormat="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgba8unorm";dstFormat="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgba8unorm";dstFormat="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgba8unorm-srgb";dstFormat="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="etc2-rgba8unorm-srgb";dstFormat="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="eac-r11unorm";dstFormat="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="eac-r11snorm";dstFormat="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="eac-rg11unorm";dstFormat="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="eac-rg11snorm";dstFormat="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-4x4-unorm";dstFormat="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-4x4-unorm";dstFormat="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-4x4-unorm-srgb";dstFormat="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-4x4-unorm-srgb";dstFormat="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-5x4-unorm";dstFormat="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-5x4-unorm";dstFormat="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-5x4-unorm-srgb";dstFormat="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-5x4-unorm-srgb";dstFormat="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-5x5-unorm";dstFormat="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-5x5-unorm";dstFormat="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-5x5-unorm-srgb";dstFormat="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-5x5-unorm-srgb";dstFormat="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-6x5-unorm";dstFormat="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-6x5-unorm";dstFormat="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-6x5-unorm-srgb";dstFormat="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-6x5-unorm-srgb";dstFormat="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-6x6-unorm";dstFormat="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-6x6-unorm";dstFormat="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-6x6-unorm-srgb";dstFormat="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-6x6-unorm-srgb";dstFormat="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x5-unorm";dstFormat="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x5-unorm";dstFormat="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x5-unorm-srgb";dstFormat="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x5-unorm-srgb";dstFormat="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x6-unorm";dstFormat="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x6-unorm";dstFormat="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x6-unorm-srgb";dstFormat="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x6-unorm-srgb";dstFormat="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x8-unorm";dstFormat="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x8-unorm";dstFormat="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x8-unorm-srgb";dstFormat="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-8x8-unorm-srgb";dstFormat="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x5-unorm";dstFormat="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x5-unorm";dstFormat="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x5-unorm-srgb";dstFormat="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x5-unorm-srgb";dstFormat="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x6-unorm";dstFormat="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x6-unorm";dstFormat="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x6-unorm-srgb";dstFormat="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x6-unorm-srgb";dstFormat="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x8-unorm";dstFormat="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x8-unorm";dstFormat="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x8-unorm-srgb";dstFormat="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x8-unorm-srgb";dstFormat="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x10-unorm";dstFormat="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x10-unorm";dstFormat="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x10-unorm-srgb";dstFormat="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-10x10-unorm-srgb";dstFormat="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-12x10-unorm";dstFormat="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-12x10-unorm";dstFormat="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-12x10-unorm-srgb";dstFormat="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-12x10-unorm-srgb";dstFormat="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-12x12-unorm";dstFormat="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-12x12-unorm";dstFormat="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-12x12-unorm-srgb";dstFormat="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="astc-12x12-unorm-srgb";dstFormat="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,copyTextureToTexture:zero_sized: +webgpu:api,operation,command_buffer,copyTextureToTexture:copy_depth_stencil:format="depth32float" +webgpu:api,operation,command_buffer,copyTextureToTexture:copy_depth_stencil:format="depth16unorm" +webgpu:api,operation,command_buffer,copyTextureToTexture:copy_depth_stencil:format="stencil8" +webgpu:api,operation,command_buffer,copyTextureToTexture:copy_depth_stencil:format="depth24plus" +webgpu:api,operation,command_buffer,copyTextureToTexture:copy_depth_stencil:format="depth24plus-stencil8" +webgpu:api,operation,command_buffer,copyTextureToTexture:copy_depth_stencil:format="depth32float-stencil8" +webgpu:api,operation,command_buffer,copyTextureToTexture:copy_multisampled_color: +webgpu:api,operation,command_buffer,copyTextureToTexture:copy_multisampled_depth: +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:origins_and_extents:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="FullCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="WriteTexture";checkMethod="PartialCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r16float";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="r32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rg32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:mip_levels:initMethod="CopyB2T";checkMethod="FullCopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:undefined_params:initMethod="WriteTexture";checkMethod="FullCopyT2B";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:undefined_params:initMethod="WriteTexture";checkMethod="FullCopyT2B";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:undefined_params:initMethod="WriteTexture";checkMethod="FullCopyT2B";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:undefined_params:initMethod="WriteTexture";checkMethod="PartialCopyT2B";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:undefined_params:initMethod="WriteTexture";checkMethod="PartialCopyT2B";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:undefined_params:initMethod="WriteTexture";checkMethod="PartialCopyT2B";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:undefined_params:initMethod="CopyB2T";checkMethod="FullCopyT2B";dimension="1d" +webgpu:api,operation,command_buffer,image_copy:undefined_params:initMethod="CopyB2T";checkMethod="FullCopyT2B";dimension="2d" +webgpu:api,operation,command_buffer,image_copy:undefined_params:initMethod="CopyB2T";checkMethod="FullCopyT2B";dimension="3d" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="depth32float";copyMethod="CopyT2B";aspect="depth-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="depth16unorm";copyMethod="CopyT2B";aspect="depth-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="stencil8";copyMethod="WriteTexture";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="stencil8";copyMethod="CopyB2T";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="stencil8";copyMethod="CopyT2B";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="depth24plus-stencil8";copyMethod="WriteTexture";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="depth24plus-stencil8";copyMethod="CopyB2T";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="depth24plus-stencil8";copyMethod="CopyT2B";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="depth32float-stencil8";copyMethod="WriteTexture";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="depth32float-stencil8";copyMethod="CopyB2T";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="depth32float-stencil8";copyMethod="CopyT2B";aspect="depth-only" +webgpu:api,operation,command_buffer,image_copy:rowsPerImage_and_bytesPerRow_depth_stencil:format="depth32float-stencil8";copyMethod="CopyT2B";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="depth32float";copyMethod="CopyT2B";aspect="depth-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="depth16unorm";copyMethod="CopyT2B";aspect="depth-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="stencil8";copyMethod="WriteTexture";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="stencil8";copyMethod="CopyB2T";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="stencil8";copyMethod="CopyT2B";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="depth24plus-stencil8";copyMethod="WriteTexture";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="depth24plus-stencil8";copyMethod="CopyB2T";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="depth24plus-stencil8";copyMethod="CopyT2B";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="depth32float-stencil8";copyMethod="WriteTexture";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="depth32float-stencil8";copyMethod="CopyB2T";aspect="stencil-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="depth32float-stencil8";copyMethod="CopyT2B";aspect="depth-only" +webgpu:api,operation,command_buffer,image_copy:offsets_and_sizes_copy_depth_stencil:format="depth32float-stencil8";copyMethod="CopyT2B";aspect="stencil-only" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_indices:encoderType="compute%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_indices:encoderType="render%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_indices:encoderType="render%20bundle" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_order:encoderType="compute%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_order:encoderType="render%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_order:encoderType="render%20bundle" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_before_pipeline:encoderType="compute%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_before_pipeline:encoderType="render%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_before_pipeline:encoderType="render%20bundle" +webgpu:api,operation,command_buffer,programmable,state_tracking:one_bind_group_multiple_slots:encoderType="compute%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:one_bind_group_multiple_slots:encoderType="render%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:one_bind_group_multiple_slots:encoderType="render%20bundle" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_multiple_sets:encoderType="compute%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_multiple_sets:encoderType="render%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:bind_group_multiple_sets:encoderType="render%20bundle" +webgpu:api,operation,command_buffer,programmable,state_tracking:compatible_pipelines:encoderType="compute%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:compatible_pipelines:encoderType="render%20pass" +webgpu:api,operation,command_buffer,programmable,state_tracking:compatible_pipelines:encoderType="render%20bundle" +webgpu:api,operation,command_buffer,render,state_tracking:set_index_buffer_without_changing_buffer: +webgpu:api,operation,command_buffer,render,state_tracking:set_vertex_buffer_without_changing_buffer: +webgpu:api,operation,command_buffer,render,state_tracking:change_pipeline_before_and_after_vertex_buffer: +webgpu:api,operation,command_buffer,render,state_tracking:set_vertex_buffer_but_not_used_in_draw: +webgpu:api,operation,command_buffer,render,state_tracking:set_index_buffer_before_non_indexed_draw: +webgpu:api,operation,compute,basic:memcpy: +webgpu:api,operation,compute,basic:large_dispatch:dispatchSize=256 +webgpu:api,operation,compute,basic:large_dispatch:dispatchSize=2048 +webgpu:api,operation,compute,basic:large_dispatch:dispatchSize=315 +webgpu:api,operation,compute,basic:large_dispatch:dispatchSize=628 +webgpu:api,operation,compute,basic:large_dispatch:dispatchSize=2179 +webgpu:api,operation,compute,basic:large_dispatch:dispatchSize=65535 +webgpu:api,operation,device,lost:not_lost_on_gc: +webgpu:api,operation,device,lost:lost_on_destroy: +webgpu:api,operation,device,lost:same_object: +webgpu:api,operation,labels:object_has_descriptor_label: +webgpu:api,operation,memory_sync,buffer,multiple_buffers:rw: +webgpu:api,operation,memory_sync,buffer,multiple_buffers:wr: +webgpu:api,operation,memory_sync,buffer,multiple_buffers:ww: +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="compute-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="compute-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="compute-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="storage-read";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-vertex";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-vertex";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-vertex";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-index";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-index";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-index";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-index";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-index";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-index";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="queue-op";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="storage-read";readContext="compute-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="storage-read";readContext="compute-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="storage-read";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="storage-read";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="storage-read";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="storage-read";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="storage-read";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-vertex";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-vertex";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-index";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-index";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-index";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-index";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="command-buffer";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="pass";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="pass";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="pass";readOp="storage-read";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="dispatch";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:rw:boundary="dispatch";readOp="storage-read";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="compute-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="compute-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="compute-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="storage-read";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-vertex";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-vertex";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-vertex";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-index";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-index";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-index";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-index";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-index";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-index";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="write-buffer";writeContext="queue" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="queue-op";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2b-copy";readContext="command-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="b2t-copy";readContext="command-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-bundle-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="storage-read";readContext="compute-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="storage-read";readContext="compute-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="storage-read";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="storage-read";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="storage-read";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="storage-read";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="storage-read";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-vertex";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-vertex";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-vertex";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-index";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-index";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-index";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-index";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect-index";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="input-indirect-index";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="constant-uniform";readContext="render-pass-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="b2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="command-buffer";readOp="constant-uniform";readContext="render-bundle-encoder";writeOp="t2b-copy";writeContext="command-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="pass";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="pass";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="render-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="pass";readOp="storage-read";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="dispatch";readOp="input-indirect-dispatch";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:wr:boundary="dispatch";readOp="storage-read";readContext="compute-pass-encoder";writeOp="storage";writeContext="compute-pass-encoder" +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["write-buffer","write-buffer"];contexts=["queue","queue"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["write-buffer","b2b-copy"];contexts=["queue","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["write-buffer","t2b-copy"];contexts=["queue","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["write-buffer","storage"];contexts=["queue","compute-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["write-buffer","storage"];contexts=["queue","render-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["write-buffer","storage"];contexts=["queue","render-bundle-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["b2b-copy","write-buffer"];contexts=["command-encoder","queue"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["t2b-copy","write-buffer"];contexts=["command-encoder","queue"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["b2b-copy","b2b-copy"];contexts=["command-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["b2b-copy","t2b-copy"];contexts=["command-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["t2b-copy","b2b-copy"];contexts=["command-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["t2b-copy","t2b-copy"];contexts=["command-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["b2b-copy","storage"];contexts=["command-encoder","compute-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["b2b-copy","storage"];contexts=["command-encoder","render-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["b2b-copy","storage"];contexts=["command-encoder","render-bundle-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["t2b-copy","storage"];contexts=["command-encoder","compute-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["t2b-copy","storage"];contexts=["command-encoder","render-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["t2b-copy","storage"];contexts=["command-encoder","render-bundle-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","write-buffer"];contexts=["compute-pass-encoder","queue"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","write-buffer"];contexts=["render-pass-encoder","queue"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","write-buffer"];contexts=["render-bundle-encoder","queue"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","b2b-copy"];contexts=["compute-pass-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","b2b-copy"];contexts=["render-pass-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","b2b-copy"];contexts=["render-bundle-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","t2b-copy"];contexts=["compute-pass-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","t2b-copy"];contexts=["render-pass-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","t2b-copy"];contexts=["render-bundle-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="queue-op";writeOps=["storage","storage"];contexts=["compute-pass-encoder","compute-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["b2b-copy","b2b-copy"];contexts=["command-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["b2b-copy","t2b-copy"];contexts=["command-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["t2b-copy","b2b-copy"];contexts=["command-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["t2b-copy","t2b-copy"];contexts=["command-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["b2b-copy","storage"];contexts=["command-encoder","compute-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["b2b-copy","storage"];contexts=["command-encoder","render-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["b2b-copy","storage"];contexts=["command-encoder","render-bundle-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["t2b-copy","storage"];contexts=["command-encoder","compute-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["t2b-copy","storage"];contexts=["command-encoder","render-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["t2b-copy","storage"];contexts=["command-encoder","render-bundle-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["storage","b2b-copy"];contexts=["compute-pass-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["storage","b2b-copy"];contexts=["render-pass-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["storage","b2b-copy"];contexts=["render-bundle-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["storage","t2b-copy"];contexts=["compute-pass-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["storage","t2b-copy"];contexts=["render-pass-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["storage","t2b-copy"];contexts=["render-bundle-encoder","command-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="command-buffer";writeOps=["storage","storage"];contexts=["compute-pass-encoder","compute-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="pass";writeOps=["storage","storage"];contexts=["compute-pass-encoder","compute-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:ww:boundary="dispatch";writeOps=["storage","storage"];contexts=["compute-pass-encoder","compute-pass-encoder"] +webgpu:api,operation,memory_sync,buffer,single_buffer:two_draws_in_the_same_render_pass: +webgpu:api,operation,memory_sync,buffer,single_buffer:two_draws_in_the_same_render_bundle: +webgpu:api,operation,memory_sync,buffer,single_buffer:two_dispatches_in_the_same_compute_pass: +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"storage","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"storage","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"storage","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"storage","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"render-pass-encoder"};write={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"render-pass-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"render-pass-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"render-bundle-encoder"};write={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"render-bundle-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="queue-op";read={"op":"sample","in":"render-bundle-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"storage","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2b-copy","in":"command-encoder"};write={"op":"storage","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"storage","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"t2t-copy","in":"command-encoder"};write={"op":"storage","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"sample","in":"render-pass-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"sample","in":"render-pass-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"sample","in":"render-bundle-encoder"};write={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="command-buffer";read={"op":"sample","in":"render-bundle-encoder"};write={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="pass";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw:boundary="dispatch";read={"op":"sample","in":"compute-pass-encoder"};write={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:rw,single_pass,load_store: +webgpu:api,operation,memory_sync,texture,same_subresource:rw,single_pass,load_resolve: +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"write-texture","in":"queue"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"write-texture","in":"queue"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"write-texture","in":"queue"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"write-texture","in":"queue"};read={"op":"sample","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"write-texture","in":"queue"};read={"op":"sample","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"sample","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"sample","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"sample","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"sample","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"attachment-store","in":"command-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"attachment-store","in":"command-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"attachment-store","in":"command-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"attachment-resolve","in":"command-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"attachment-resolve","in":"command-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"attachment-resolve","in":"command-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"storage","in":"compute-pass-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"storage","in":"compute-pass-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"storage","in":"compute-pass-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"storage","in":"render-pass-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"storage","in":"render-pass-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"storage","in":"render-bundle-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="queue-op";write={"op":"storage","in":"render-bundle-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"sample","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"b2t-copy","in":"command-encoder"};read={"op":"sample","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"sample","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"t2t-copy","in":"command-encoder"};read={"op":"sample","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"attachment-store","in":"command-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"attachment-store","in":"command-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"attachment-store","in":"command-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"attachment-resolve","in":"command-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"attachment-resolve","in":"command-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"attachment-resolve","in":"command-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"storage","in":"compute-pass-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"storage","in":"compute-pass-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"storage","in":"compute-pass-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"storage","in":"render-pass-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"storage","in":"render-pass-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"storage","in":"render-bundle-encoder"};read={"op":"t2b-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="command-buffer";write={"op":"storage","in":"render-bundle-encoder"};read={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="pass";write={"op":"storage","in":"compute-pass-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:wr:boundary="dispatch";write={"op":"storage","in":"compute-pass-encoder"};read={"op":"sample","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"write-texture","in":"queue"};second={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"write-texture","in":"queue"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"write-texture","in":"queue"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"write-texture","in":"queue"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"write-texture","in":"queue"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"write-texture","in":"queue"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"write-texture","in":"queue"};second={"op":"storage","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"write-texture","in":"queue"};second={"op":"storage","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"storage","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"storage","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"storage","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"storage","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-store","in":"command-encoder"};second={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-store","in":"command-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-store","in":"command-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-store","in":"command-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-store","in":"command-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-store","in":"command-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"render-pass-encoder"};second={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"render-pass-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"render-pass-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"render-bundle-encoder"};second={"op":"write-texture","in":"queue"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"render-bundle-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="queue-op";first={"op":"storage","in":"render-bundle-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"storage","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"b2t-copy","in":"command-encoder"};second={"op":"storage","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"storage","in":"render-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"t2t-copy","in":"command-encoder"};second={"op":"storage","in":"render-bundle-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-store","in":"command-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-store","in":"command-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-store","in":"command-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-store","in":"command-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-store","in":"command-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"attachment-resolve","in":"command-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"attachment-store","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"attachment-resolve","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"storage","in":"render-pass-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"storage","in":"render-pass-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"storage","in":"render-bundle-encoder"};second={"op":"b2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="command-buffer";first={"op":"storage","in":"render-bundle-encoder"};second={"op":"t2t-copy","in":"command-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="pass";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="dispatch";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"storage","in":"compute-pass-encoder"} +webgpu:api,operation,onSubmittedWorkDone:without_work: +webgpu:api,operation,onSubmittedWorkDone:with_work: +webgpu:api,operation,onSubmittedWorkDone:many,serial: +webgpu:api,operation,onSubmittedWorkDone:many,parallel: +webgpu:api,operation,onSubmittedWorkDone:many,parallel_order: +webgpu:api,operation,pipeline,default_layout:getBindGroupLayout_js_object: +webgpu:api,operation,pipeline,default_layout:incompatible_with_explicit: +webgpu:api,operation,pipeline,default_layout:layout: +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Uint8Array";useArrayBuffer=false +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Uint8Array";useArrayBuffer=true +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Uint16Array";useArrayBuffer=false +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Uint16Array";useArrayBuffer=true +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Uint32Array";useArrayBuffer=false +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Uint32Array";useArrayBuffer=true +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Int8Array";useArrayBuffer=false +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Int8Array";useArrayBuffer=true +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Int16Array";useArrayBuffer=false +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Int16Array";useArrayBuffer=true +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Int32Array";useArrayBuffer=false +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Int32Array";useArrayBuffer=true +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Float32Array";useArrayBuffer=false +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Float32Array";useArrayBuffer=true +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Float64Array";useArrayBuffer=false +webgpu:api,operation,queue,writeBuffer:array_types:arrayType="Float64Array";useArrayBuffer=true +webgpu:api,operation,queue,writeBuffer:multiple_writes_at_different_offsets_and_sizes: +webgpu:api,operation,reflection:buffer_reflection_attributes: +webgpu:api,operation,reflection:texture_reflection_attributes: +webgpu:api,operation,reflection:query_set_reflection_attributes: +webgpu:api,operation,render_pass,clear_value:stored: +webgpu:api,operation,render_pass,clear_value:loaded: +webgpu:api,operation,render_pass,clear_value:srgb: +webgpu:api,operation,render_pass,clear_value:layout: +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth24plus-stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=0;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=1;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=255;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=258;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=true +webgpu:api,operation,render_pass,clear_value:stencil_clear_value:stencilFormat="depth32float-stencil8";stencilClearValue=65539;applyStencilClearValueAsStencilReferenceValue=false +webgpu:api,operation,render_pass,resolve:render_pass_resolve:storeOperation="discard" +webgpu:api,operation,render_pass,resolve:render_pass_resolve:storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_with_depth_stencil_attachment:colorStoreOperation="discard";depthStencilStoreOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_with_depth_stencil_attachment:colorStoreOperation="discard";depthStencilStoreOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_with_depth_stencil_attachment:colorStoreOperation="store";depthStencilStoreOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_with_depth_stencil_attachment:colorStoreOperation="store";depthStencilStoreOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r8unorm";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r8unorm";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r8uint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r8uint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r8sint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r8sint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r16uint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r16uint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r16sint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r16sint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r16float";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r16float";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg8unorm";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg8unorm";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg8uint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg8uint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg8sint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg8sint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r32uint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r32uint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r32sint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r32sint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r32float";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="r32float";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg16uint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg16uint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg16sint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg16sint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg16float";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg16float";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba8unorm";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba8unorm";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba8unorm-srgb";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba8unorm-srgb";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba8uint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba8uint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba8sint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba8sint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="bgra8unorm";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="bgra8unorm";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="bgra8unorm-srgb";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="bgra8unorm-srgb";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgb10a2unorm";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgb10a2unorm";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg32uint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg32uint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg32sint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg32sint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg32float";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rg32float";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba16uint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba16uint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba16sint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba16sint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba16float";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba16float";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba32uint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba32uint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba32sint";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba32sint";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba32float";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:colorFormat="rgba32float";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,multiple_color_attachments:storeOperation1="discard";storeOperation2="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,multiple_color_attachments:storeOperation1="discard";storeOperation2="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,multiple_color_attachments:storeOperation1="store";storeOperation2="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,multiple_color_attachments:storeOperation1="store";storeOperation2="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,depth_stencil_attachment_only:depthStencilFormat="depth32float";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,depth_stencil_attachment_only:depthStencilFormat="depth32float";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,depth_stencil_attachment_only:depthStencilFormat="depth16unorm";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,depth_stencil_attachment_only:depthStencilFormat="depth16unorm";storeOperation="store" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,depth_stencil_attachment_only:depthStencilFormat="stencil8";storeOperation="discard" +webgpu:api,operation,render_pass,storeOp:render_pass_store_op,depth_stencil_attachment_only:depthStencilFormat="stencil8";storeOperation="store" +webgpu:api,operation,render_pass,storeop2:storeOp_controls_whether_1x1_drawn_quad_is_stored:storeOp="store" +webgpu:api,operation,render_pass,storeop2:storeOp_controls_whether_1x1_drawn_quad_is_stored:storeOp="discard" +webgpu:api,operation,render_pipeline,culling_tests:culling:frontFace="ccw";cullMode="none" +webgpu:api,operation,render_pipeline,culling_tests:culling:frontFace="ccw";cullMode="front" +webgpu:api,operation,render_pipeline,culling_tests:culling:frontFace="ccw";cullMode="back" +webgpu:api,operation,render_pipeline,culling_tests:culling:frontFace="cw";cullMode="none" +webgpu:api,operation,render_pipeline,culling_tests:culling:frontFace="cw";cullMode="front" +webgpu:api,operation,render_pipeline,culling_tests:culling:frontFace="cw";cullMode="back" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="r8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="r8uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="r8sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="r16uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="r16sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="r16float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rg8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rg8uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rg8sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="r32uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="r32sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="r32float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rg16uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rg16sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rg16float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba8unorm-srgb" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba8uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba8sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="bgra8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="bgra8unorm-srgb" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgb10a2unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rg32uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rg32sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rg32float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba16uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba16sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba16float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba32uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba32sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,attachments:format="rgba32float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="r8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="r8uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="r8sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="r16uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="r16sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="r16float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rg8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rg8uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rg8sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="r32uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="r32sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="r32float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rg16uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rg16sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rg16float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba8unorm-srgb" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba8uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba8sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="bgra8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="bgra8unorm-srgb" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgb10a2unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rg32uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rg32sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rg32float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba16uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba16sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba16float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba32uint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba32sint" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count:format="rgba32float" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count,blend:format="r8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count,blend:format="rg8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count,blend:format="rgba8unorm" +webgpu:api,operation,render_pipeline,pipeline_output_targets:color,component_count,blend:format="bgra8unorm" +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="point-list";indirect=false;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="point-list";indirect=true;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="line-list";indirect=false;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="line-list";indirect=true;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="line-strip";indirect=false;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="line-strip";indirect=false;primitiveRestart=true +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="line-strip";indirect=true;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="line-strip";indirect=true;primitiveRestart=true +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="triangle-list";indirect=false;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="triangle-list";indirect=true;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="triangle-strip";indirect=false;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="triangle-strip";indirect=false;primitiveRestart=true +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="triangle-strip";indirect=true;primitiveRestart=false +webgpu:api,operation,render_pipeline,primitive_topology:basic:topology="triangle-strip";indirect=true;primitiveRestart=true +webgpu:api,operation,render_pipeline,primitive_topology:unaligned_vertex_count:topology="line-list";indirect=false;drawCount=5 +webgpu:api,operation,render_pipeline,primitive_topology:unaligned_vertex_count:topology="line-list";indirect=true;drawCount=5 +webgpu:api,operation,render_pipeline,primitive_topology:unaligned_vertex_count:topology="triangle-list";indirect=false;drawCount=5 +webgpu:api,operation,render_pipeline,primitive_topology:unaligned_vertex_count:topology="triangle-list";indirect=false;drawCount=4 +webgpu:api,operation,render_pipeline,primitive_topology:unaligned_vertex_count:topology="triangle-list";indirect=true;drawCount=5 +webgpu:api,operation,render_pipeline,primitive_topology:unaligned_vertex_count:topology="triangle-list";indirect=true;drawCount=4 +webgpu:api,operation,render_pipeline,vertex_only_render_pipeline:draw_depth_and_stencil_with_vertex_only_pipeline: +webgpu:api,operation,rendering,basic:clear: +webgpu:api,operation,rendering,basic:fullscreen_quad: +webgpu:api,operation,rendering,basic:large_draw:indexed=true;indirect=true +webgpu:api,operation,rendering,basic:large_draw:indexed=true;indirect=false +webgpu:api,operation,rendering,basic:large_draw:indexed=false;indirect=true +webgpu:api,operation,rendering,basic:large_draw:indexed=false;indirect=false +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="zero";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one";operation="min" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one";operation="max" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-src-alpha";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="dst-alpha";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="src-alpha-saturated";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="constant";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="color";srcFactor="one-minus-constant";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="zero";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one";operation="min" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one";operation="max" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-src-alpha";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="dst-alpha";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-dst-alpha";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="src-alpha-saturated";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="constant";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="zero";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="zero";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="zero";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-src";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-src";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-src";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-src-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-src-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-src-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-dst";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-dst";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-dst";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-dst-alpha";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-dst-alpha";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-dst-alpha";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="src-alpha-saturated";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="src-alpha-saturated";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="src-alpha-saturated";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-constant";operation="add" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-constant";operation="subtract" +webgpu:api,operation,rendering,blending:GPUBlendComponent:component="alpha";srcFactor="one-minus-constant";dstFactor="one-minus-constant";operation="reverse-subtract" +webgpu:api,operation,rendering,blending:formats: +webgpu:api,operation,rendering,blending:clamp,blend_factor: +webgpu:api,operation,rendering,blending:clamp,blend_color: +webgpu:api,operation,rendering,blending:clamp,blend_result: +webgpu:api,operation,rendering,depth:depth_bias: +webgpu:api,operation,rendering,depth:depth_disabled: +webgpu:api,operation,rendering,depth:depth_write_disabled: +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="never";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="never";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="never";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="less";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="less";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="less";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="less-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="less-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="less-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="not-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="not-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="not-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="greater-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="greater-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="greater-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="greater";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="greater";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="greater";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="always";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="always";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float";depthCompare="always";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="never";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="never";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="never";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="less";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="less";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="less";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="less-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="less-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="less-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="not-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="not-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="not-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="greater-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="greater-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="greater-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="greater";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="greater";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="greater";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="always";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="always";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth16unorm";depthCompare="always";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="never";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="never";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="never";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="less";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="less";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="less";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="less-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="less-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="less-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="not-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="not-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="not-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="greater-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="greater-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="greater-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="greater";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="greater";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="greater";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="always";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="always";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus";depthCompare="always";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="never";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="never";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="never";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="less";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="less";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="less";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="less-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="less-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="less-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="not-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="not-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="not-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="greater-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="greater-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="greater-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="greater";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="greater";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="greater";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="always";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="always";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth24plus-stencil8";depthCompare="always";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="never";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="never";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="never";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="less";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="less";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="less";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="less-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="less-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="less-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="not-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="not-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="not-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="greater-equal";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="greater-equal";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="greater-equal";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="greater";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="greater";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="greater";depthClearValue=0 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="always";depthClearValue=1 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="always";depthClearValue=0.5001 +webgpu:api,operation,rendering,depth:depth_compare_func:format="depth32float-stencil8";depthCompare="always";depthClearValue=0 +webgpu:api,operation,rendering,depth:reverse_depth:reversed=false +webgpu:api,operation,rendering,depth:reverse_depth:reversed=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth="_undef_";writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth="_undef_";writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth="_undef_";writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth="_undef_";writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth=false;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth=false;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth=false;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth=false;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth=true;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth=true;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth=true;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float";unclippedDepth=true;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth="_undef_";writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth="_undef_";writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth="_undef_";writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth="_undef_";writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth=false;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth=false;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth=false;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth=false;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth=true;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth=true;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth=true;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth16unorm";unclippedDepth=true;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth="_undef_";writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth="_undef_";writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth="_undef_";writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth="_undef_";writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth=false;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth=false;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth=false;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth=false;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth=true;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth=true;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth=true;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus";unclippedDepth=true;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth="_undef_";writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth="_undef_";writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth="_undef_";writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth="_undef_";writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth=false;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth=false;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth=false;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth=false;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth=true;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth=true;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth=true;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth24plus-stencil8";unclippedDepth=true;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth="_undef_";writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth="_undef_";writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth="_undef_";writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth="_undef_";writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth=false;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth=false;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth=false;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth=false;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth=true;writeDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth=true;writeDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth=true;writeDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_clamp_and_clip:format="depth32float-stencil8";unclippedDepth=true;writeDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth32float";unclippedDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth32float";unclippedDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth32float";unclippedDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth32float";unclippedDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth16unorm";unclippedDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth16unorm";unclippedDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth16unorm";unclippedDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth16unorm";unclippedDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth24plus";unclippedDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth24plus";unclippedDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth24plus";unclippedDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth24plus";unclippedDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth24plus-stencil8";unclippedDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth24plus-stencil8";unclippedDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth24plus-stencil8";unclippedDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth24plus-stencil8";unclippedDepth=true;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth32float-stencil8";unclippedDepth=false;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth32float-stencil8";unclippedDepth=false;multisampled=true +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth32float-stencil8";unclippedDepth=true;multisampled=false +webgpu:api,operation,rendering,depth_clip_clamp:depth_test_input_clamped:format="depth32float-stencil8";unclippedDepth=true;multisampled=true +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=0;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=0;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=3;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=0;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=0;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=1;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=false;indirect=false;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=0;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=false;indirect=true;vertex_buffer_offset=32;index_buffer_offset="_undef_";base_vertex="_undef_" +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=false;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=0;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=0;base_vertex=9 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=0 +webgpu:api,operation,rendering,draw:arguments:first=3;count=6;first_instance=2;instance_count=4;indexed=true;indirect=true;vertex_buffer_offset=32;index_buffer_offset=16;base_vertex=9 +webgpu:api,operation,rendering,draw:default_arguments: +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=1;vertex_buffer_count=1;vertex_format="uint32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=1;vertex_buffer_count=1;vertex_format="uint32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=1;vertex_buffer_count=1;vertex_format="uint32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=1;vertex_buffer_count=1;vertex_format="float32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=1;vertex_buffer_count=1;vertex_format="float32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=1;vertex_buffer_count=1;vertex_format="float32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=1;vertex_format="uint32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=1;vertex_format="uint32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=1;vertex_format="uint32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=1;vertex_format="float32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=1;vertex_format="float32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=1;vertex_format="float32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=4;vertex_format="uint32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=4;vertex_format="uint32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=4;vertex_format="uint32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=4;vertex_format="uint32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=4;vertex_format="float32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=4;vertex_format="float32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=4;vertex_format="float32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=4;vertex_buffer_count=4;vertex_format="float32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=1;vertex_format="uint32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=1;vertex_format="uint32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=1;vertex_format="uint32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=1;vertex_format="float32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=1;vertex_format="float32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=1;vertex_format="float32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=4;vertex_format="uint32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=4;vertex_format="uint32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=4;vertex_format="uint32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=4;vertex_format="uint32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=4;vertex_format="float32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=4;vertex_format="float32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=4;vertex_format="float32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=4;vertex_format="float32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=8;vertex_format="uint32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=8;vertex_format="uint32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=8;vertex_format="uint32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=8;vertex_format="uint32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=8;vertex_format="float32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=8;vertex_format="float32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=8;vertex_format="float32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=8;vertex_buffer_count=8;vertex_format="float32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=1;vertex_format="uint32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=1;vertex_format="uint32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=1;vertex_format="uint32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=1;vertex_format="float32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=1;vertex_format="float32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=1;vertex_format="float32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=4;vertex_format="uint32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=4;vertex_format="uint32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=4;vertex_format="uint32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=4;vertex_format="uint32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=4;vertex_format="float32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=4;vertex_format="float32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=4;vertex_format="float32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=4;vertex_format="float32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=8;vertex_format="uint32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=8;vertex_format="uint32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=8;vertex_format="uint32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=8;vertex_format="uint32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=8;vertex_format="float32";step_mode="_undef_" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=8;vertex_format="float32";step_mode="vertex" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=8;vertex_format="float32";step_mode="instance" +webgpu:api,operation,rendering,draw:vertex_attributes,basic:vertex_attribute_count=16;vertex_buffer_count=8;vertex_format="float32";step_mode="mixed" +webgpu:api,operation,rendering,draw:vertex_attributes,formats: +webgpu:api,operation,rendering,draw:largeish_buffer: +webgpu:api,operation,rendering,indirect_draw:basics:isIndexed=true +webgpu:api,operation,rendering,indirect_draw:basics:isIndexed=false +webgpu:api,operation,resource_init,buffer:partial_write_buffer: +webgpu:api,operation,resource_init,buffer:map_whole_buffer:mapMode=1 +webgpu:api,operation,resource_init,buffer:map_whole_buffer:mapMode=2 +webgpu:api,operation,resource_init,buffer:map_partial_buffer:mapMode=1 +webgpu:api,operation,resource_init,buffer:map_partial_buffer:mapMode=2 +webgpu:api,operation,resource_init,buffer:mapped_at_creation_whole_buffer:bufferUsage=9 +webgpu:api,operation,resource_init,buffer:mapped_at_creation_whole_buffer:bufferUsage=6 +webgpu:api,operation,resource_init,buffer:mapped_at_creation_whole_buffer:bufferUsage=4 +webgpu:api,operation,resource_init,buffer:mapped_at_creation_partial_buffer:bufferUsage=9 +webgpu:api,operation,resource_init,buffer:mapped_at_creation_partial_buffer:bufferUsage=6 +webgpu:api,operation,resource_init,buffer:mapped_at_creation_partial_buffer:bufferUsage=4 +webgpu:api,operation,resource_init,buffer:copy_buffer_to_buffer_copy_source: +webgpu:api,operation,resource_init,buffer:copy_buffer_to_texture: +webgpu:api,operation,resource_init,buffer:resolve_query_set_to_partial_buffer: +webgpu:api,operation,resource_init,buffer:copy_texture_to_partial_buffer: +webgpu:api,operation,resource_init,buffer:uniform_buffer: +webgpu:api,operation,resource_init,buffer:readonly_storage_buffer: +webgpu:api,operation,resource_init,buffer:storage_buffer: +webgpu:api,operation,resource_init,buffer:vertex_buffer: +webgpu:api,operation,resource_init,buffer:index_buffer: +webgpu:api,operation,resource_init,buffer:indirect_buffer_for_draw_indirect:test_indexed_draw=true +webgpu:api,operation,resource_init,buffer:indirect_buffer_for_draw_indirect:test_indexed_draw=false +webgpu:api,operation,resource_init,buffer:indirect_buffer_for_dispatch_indirect: +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="r32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="bgra8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="bgra8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgb10a2unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg11b10ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgb9e5ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rg32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToBuffer";format="rgba32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="r32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="bgra8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="bgra8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgb10a2unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg11b10ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgb9e5ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rg32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="CopyToTexture";format="rgba32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="r32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="bgra8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="bgra8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgb10a2unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg11b10ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgb9e5ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rg32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="1d";readMethod="Sample";format="rgba32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="r32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="bgra8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="bgra8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgb10a2unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg11b10ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgb9e5ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rg32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="rgba32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="depth32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="depth16unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="stencil8" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToBuffer";format="depth32float-stencil8" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="r32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="bgra8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="bgra8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgb10a2unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg11b10ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgb9e5ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rg32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="rgba32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="depth32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="depth16unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="stencil8" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="CopyToTexture";format="depth32float-stencil8" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="r32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="bgra8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="bgra8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgb10a2unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg11b10ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgb9e5ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rg32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="Sample";format="rgba32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="DepthTest";format="depth32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="DepthTest";format="depth16unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="DepthTest";format="depth24plus" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="DepthTest";format="depth24plus-stencil8" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="DepthTest";format="depth32float-stencil8" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="StencilTest";format="stencil8" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="StencilTest";format="depth24plus-stencil8" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="2d";readMethod="StencilTest";format="depth32float-stencil8" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="r32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="bgra8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="bgra8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgb10a2unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg11b10ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgb9e5ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rg32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToBuffer";format="rgba32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="r32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="bgra8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="bgra8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgb10a2unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg11b10ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgb9e5ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rg32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="CopyToTexture";format="rgba32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="r32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba8snorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba8uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba8sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="bgra8unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="bgra8unorm-srgb" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgb10a2unorm" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg11b10ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgb9e5ufloat" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rg32float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba16uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba16sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba16float" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba32uint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba32sint" +webgpu:api,operation,resource_init,texture_zero:uninitialized_texture_is_zero:dimension="3d";readMethod="Sample";format="rgba32float" +webgpu:api,operation,sampling,anisotropy:anisotropic_filter_checkerboard: +webgpu:api,operation,sampling,anisotropy:anisotropic_filter_mipmap_color:maxAnisotropy=1 +webgpu:api,operation,sampling,anisotropy:anisotropic_filter_mipmap_color:maxAnisotropy=4 +webgpu:api,operation,shader_module,compilation_info:compilationInfo_returns:valid=true;unicode=false +webgpu:api,operation,shader_module,compilation_info:compilationInfo_returns:valid=true;unicode=true +webgpu:api,operation,shader_module,compilation_info:compilationInfo_returns:valid=false;unicode=false +webgpu:api,operation,shader_module,compilation_info:compilationInfo_returns:valid=false;unicode=true +webgpu:api,operation,shader_module,compilation_info:line_number_and_position:valid=false;unicode=false +webgpu:api,operation,shader_module,compilation_info:line_number_and_position:valid=false;unicode=true +webgpu:api,operation,shader_module,compilation_info:offset_and_length:valid=true;unicode=false +webgpu:api,operation,shader_module,compilation_info:offset_and_length:valid=true;unicode=true +webgpu:api,operation,shader_module,compilation_info:offset_and_length:valid=false;unicode=false +webgpu:api,operation,shader_module,compilation_info:offset_and_length:valid=false;unicode=true +webgpu:api,operation,texture_view,format_reinterpretation:texture_binding:format="rgba8unorm";viewFormat="rgba8unorm-srgb" +webgpu:api,operation,texture_view,format_reinterpretation:texture_binding:format="rgba8unorm-srgb";viewFormat="rgba8unorm" +webgpu:api,operation,texture_view,format_reinterpretation:texture_binding:format="bgra8unorm";viewFormat="bgra8unorm-srgb" +webgpu:api,operation,texture_view,format_reinterpretation:texture_binding:format="bgra8unorm-srgb";viewFormat="bgra8unorm" +webgpu:api,operation,texture_view,format_reinterpretation:render_and_resolve_attachment:format="rgba8unorm";viewFormat="rgba8unorm-srgb";sampleCount=1 +webgpu:api,operation,texture_view,format_reinterpretation:render_and_resolve_attachment:format="rgba8unorm";viewFormat="rgba8unorm-srgb";sampleCount=4 +webgpu:api,operation,texture_view,format_reinterpretation:render_and_resolve_attachment:format="rgba8unorm-srgb";viewFormat="rgba8unorm";sampleCount=1 +webgpu:api,operation,texture_view,format_reinterpretation:render_and_resolve_attachment:format="rgba8unorm-srgb";viewFormat="rgba8unorm";sampleCount=4 +webgpu:api,operation,texture_view,format_reinterpretation:render_and_resolve_attachment:format="bgra8unorm";viewFormat="bgra8unorm-srgb";sampleCount=1 +webgpu:api,operation,texture_view,format_reinterpretation:render_and_resolve_attachment:format="bgra8unorm";viewFormat="bgra8unorm-srgb";sampleCount=4 +webgpu:api,operation,texture_view,format_reinterpretation:render_and_resolve_attachment:format="bgra8unorm-srgb";viewFormat="bgra8unorm";sampleCount=1 +webgpu:api,operation,texture_view,format_reinterpretation:render_and_resolve_attachment:format="bgra8unorm-srgb";viewFormat="bgra8unorm";sampleCount=4 +webgpu:api,operation,texture_view,read:format: +webgpu:api,operation,texture_view,read:dimension: +webgpu:api,operation,texture_view,read:aspect: +webgpu:api,operation,texture_view,write:format: +webgpu:api,operation,texture_view,write:dimension: +webgpu:api,operation,texture_view,write:aspect: +webgpu:api,operation,uncapturederror:constructor: +webgpu:api,operation,uncapturederror:iff_uncaptured: +webgpu:api,operation,uncapturederror:only_original_device_is_event_target: +webgpu:api,operation,uncapturederror:uncapturederror_from_non_originating_thread: +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint8x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint8x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint8x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint8x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint8x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint8x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint8x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint8x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint8x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint8x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint8x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint8x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint8x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint8x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint8x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint8x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm8x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm8x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm8x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm8x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm8x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm8x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm8x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm8x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm8x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm8x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm8x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm8x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm8x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm8x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm8x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm8x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint16x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint16x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint16x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint16x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint16x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint16x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint16x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint16x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint16x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint16x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint16x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint16x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint16x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint16x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint16x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint16x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm16x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm16x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm16x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm16x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm16x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm16x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm16x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="unorm16x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm16x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm16x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm16x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm16x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm16x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm16x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm16x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="snorm16x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float16x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float16x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float16x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float16x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float16x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float16x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float16x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float16x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x3";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x3";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x3";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x3";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="float32x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x3";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x3";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x3";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x3";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="uint32x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x2";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x2";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x2";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x2";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x3";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x3";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x3";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x3";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x4";shaderComponentCount=1 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x4";shaderComponentCount=2 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x4";shaderComponentCount=3 +webgpu:api,operation,vertex_state,correctness:vertex_format_to_shader_format_conversion:format="sint32x4";shaderComponentCount=4 +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="uint8x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="uint8x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint8x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint8x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="unorm8x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="unorm8x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="snorm8x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="snorm8x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="uint16x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="uint16x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint16x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint16x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="unorm16x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="unorm16x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="snorm16x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="snorm16x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="float16x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="float16x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="float32" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="float32x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="float32x3" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="float32x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="uint32" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="uint32x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="uint32x3" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="uint32x4" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint32" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint32x2" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint32x3" +webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint32x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="uint8x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="uint8x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="sint8x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="sint8x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="unorm8x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="unorm8x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="snorm8x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="snorm8x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="uint16x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="uint16x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="sint16x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="sint16x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="unorm16x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="unorm16x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="snorm16x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="snorm16x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="float16x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="float16x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="float32" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="float32x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="float32x3" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="float32x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="uint32" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="uint32x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="uint32x3" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="uint32x4" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="sint32" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="sint32x2" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="sint32x3" +webgpu:api,operation,vertex_state,correctness:non_zero_array_stride_and_attribute_offset:format="sint32x4" +webgpu:api,operation,vertex_state,correctness:buffers_with_varying_step_mode: +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="uint8x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="uint8x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="sint8x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="sint8x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="unorm8x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="unorm8x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="snorm8x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="snorm8x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="uint16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="uint16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="sint16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="sint16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="unorm16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="unorm16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="snorm16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="snorm16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="float16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="float16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="float32" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="float32x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="float32x3" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="float32x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="uint32" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="uint32x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="uint32x3" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="uint32x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="sint32" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="sint32x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="sint32x3" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_overlapped:format="sint32x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="uint8x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="uint8x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="sint8x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="sint8x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="unorm8x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="unorm8x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="snorm8x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="snorm8x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="uint16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="uint16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="sint16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="sint16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="unorm16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="unorm16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="snorm16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="snorm16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="float16x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="float16x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="float32" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="float32x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="float32x3" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="float32x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="uint32" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="uint32x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="uint32x3" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="uint32x4" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="sint32" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="sint32x2" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="sint32x3" +webgpu:api,operation,vertex_state,correctness:vertex_buffer_used_multiple_times_interleaved:format="sint32x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="uint8x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="uint8x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="sint8x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="sint8x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="unorm8x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="unorm8x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="snorm8x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="snorm8x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="uint16x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="uint16x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="sint16x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="sint16x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="unorm16x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="unorm16x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="snorm16x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="snorm16x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="float16x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="float16x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="float32" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="float32x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="float32x3" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="float32x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="uint32" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="uint32x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="uint32x3" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="uint32x4" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="sint32" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="sint32x2" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="sint32x3" +webgpu:api,operation,vertex_state,correctness:max_buffers_and_attribs:format="sint32x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="uint8x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="uint8x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="sint8x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="sint8x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="unorm8x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="unorm8x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="snorm8x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="snorm8x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="uint16x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="uint16x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="sint16x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="sint16x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="unorm16x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="unorm16x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="snorm16x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="snorm16x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="float16x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="float16x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="float32" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="float32x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="float32x3" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="float32x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="uint32" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="uint32x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="uint32x3" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="uint32x4" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="sint32" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="sint32x2" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="sint32x3" +webgpu:api,operation,vertex_state,correctness:array_stride_zero:format="sint32x4" +webgpu:api,operation,vertex_state,correctness:discontiguous_location_and_attribs: +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="uint8x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="uint8x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="sint8x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="sint8x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="unorm8x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="unorm8x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="snorm8x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="snorm8x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="uint16x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="uint16x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="sint16x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="sint16x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="unorm16x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="unorm16x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="snorm16x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="snorm16x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="float16x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="float16x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="float32" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="float32x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="float32x3" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="float32x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="uint32" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="uint32x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="uint32x3" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="uint32x4" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="sint32" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="sint32x2" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="sint32x3" +webgpu:api,operation,vertex_state,correctness:overlapping_attributes:format="sint32x4" +webgpu:api,operation,vertex_state,index_format:index_format,uint16: +webgpu:api,operation,vertex_state,index_format:index_format,uint32: +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint16";primitiveTopology="point-list" +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint16";primitiveTopology="line-list" +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint16";primitiveTopology="line-strip" +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint16";primitiveTopology="triangle-list" +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint16";primitiveTopology="triangle-strip" +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint32";primitiveTopology="point-list" +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint32";primitiveTopology="line-list" +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint32";primitiveTopology="line-strip" +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint32";primitiveTopology="triangle-list" +webgpu:api,operation,vertex_state,index_format:primitive_restart:indexFormat="uint32";primitiveTopology="triangle-strip" +webgpu:api,validation,buffer,create:size:mappedAtCreation=false +webgpu:api,validation,buffer,create:size:mappedAtCreation=true +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=0;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=1;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=2;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=4;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=8;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=16;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=32;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=64;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=128;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=256;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=512;usage2=32768 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=0 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=1 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=2 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=4 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=8 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=16 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=32 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=64 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=128 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=256 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=512 +webgpu:api,validation,buffer,create:usage:usage1=32768;usage2=32768 +webgpu:api,validation,buffer,create:createBuffer_invalid_and_oom: +webgpu:api,validation,buffer,destroy:all_usages: +webgpu:api,validation,buffer,destroy:error_buffer: +webgpu:api,validation,buffer,destroy:twice: +webgpu:api,validation,buffer,destroy:while_mapped: +webgpu:api,validation,buffer,mapping:mapAsync,usage: +webgpu:api,validation,buffer,mapping:mapAsync,invalidBuffer: +webgpu:api,validation,buffer,mapping:mapAsync,state,destroyed: +webgpu:api,validation,buffer,mapping:mapAsync,state,mappedAtCreation: +webgpu:api,validation,buffer,mapping:mapAsync,state,mapped: +webgpu:api,validation,buffer,mapping:mapAsync,state,mappingPending: +webgpu:api,validation,buffer,mapping:mapAsync,sizeUnspecifiedOOB: +webgpu:api,validation,buffer,mapping:mapAsync,offsetAndSizeAlignment: +webgpu:api,validation,buffer,mapping:mapAsync,offsetAndSizeOOB: +webgpu:api,validation,buffer,mapping:getMappedRange,state,mapped: +webgpu:api,validation,buffer,mapping:getMappedRange,state,mappedAtCreation: +webgpu:api,validation,buffer,mapping:getMappedRange,state,invalid_mappedAtCreation: +webgpu:api,validation,buffer,mapping:getMappedRange,state,mappedAgain: +webgpu:api,validation,buffer,mapping:getMappedRange,state,unmapped: +webgpu:api,validation,buffer,mapping:getMappedRange,state,destroyed: +webgpu:api,validation,buffer,mapping:getMappedRange,state,mappingPending: +webgpu:api,validation,buffer,mapping:getMappedRange,subrange,mapped:mapMode=1 +webgpu:api,validation,buffer,mapping:getMappedRange,subrange,mapped:mapMode=2 +webgpu:api,validation,buffer,mapping:getMappedRange,subrange,mappedAtCreation: +webgpu:api,validation,buffer,mapping:getMappedRange,offsetAndSizeAlignment,mapped:mapMode=1 +webgpu:api,validation,buffer,mapping:getMappedRange,offsetAndSizeAlignment,mapped:mapMode=2 +webgpu:api,validation,buffer,mapping:getMappedRange,offsetAndSizeAlignment,mappedAtCreation: +webgpu:api,validation,buffer,mapping:getMappedRange,sizeAndOffsetOOB,mappedAtCreation: +webgpu:api,validation,buffer,mapping:getMappedRange,sizeAndOffsetOOB,mapped: +webgpu:api,validation,buffer,mapping:getMappedRange,disjointRanges: +webgpu:api,validation,buffer,mapping:getMappedRange,disjoinRanges_many: +webgpu:api,validation,buffer,mapping:unmap,state,unmapped: +webgpu:api,validation,buffer,mapping:unmap,state,destroyed: +webgpu:api,validation,buffer,mapping:unmap,state,mappedAtCreation: +webgpu:api,validation,buffer,mapping:unmap,state,mapped: +webgpu:api,validation,buffer,mapping:unmap,state,mappingPending: +webgpu:api,validation,buffer,mapping:gc_behavior,mappedAtCreation: +webgpu:api,validation,buffer,mapping:gc_behavior,mapAsync: +webgpu:api,validation,capability_checks,features,query_types:createQuerySet:type="occlusion";featureContainsTimestampQuery=false +webgpu:api,validation,capability_checks,features,query_types:createQuerySet:type="occlusion";featureContainsTimestampQuery=true +webgpu:api,validation,capability_checks,features,query_types:createQuerySet:type="timestamp";featureContainsTimestampQuery=false +webgpu:api,validation,capability_checks,features,query_types:createQuerySet:type="timestamp";featureContainsTimestampQuery=true +webgpu:api,validation,capability_checks,features,query_types:writeTimestamp:featureContainsTimestampQuery=false +webgpu:api,validation,capability_checks,features,query_types:writeTimestamp:featureContainsTimestampQuery=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="depth32float-stencil8";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="depth32float-stencil8";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc1-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc1-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc1-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc1-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc2-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc2-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc2-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc2-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc3-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc3-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc3-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc3-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc4-r-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc4-r-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc4-r-snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc4-r-snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc5-rg-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc5-rg-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc5-rg-snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc5-rg-snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc6h-rgb-ufloat";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc6h-rgb-ufloat";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc6h-rgb-float";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc6h-rgb-float";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc7-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc7-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc7-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="bc7-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgb8unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgb8unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgb8unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgb8unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgb8a1unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgb8a1unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgb8a1unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgb8a1unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgba8unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgba8unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgba8unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="etc2-rgba8unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="eac-r11unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="eac-r11unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="eac-r11snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="eac-r11snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="eac-rg11unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="eac-rg11unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="eac-rg11snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="eac-rg11snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-4x4-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-4x4-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-4x4-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-4x4-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-5x4-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-5x4-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-5x4-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-5x4-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-5x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-5x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-5x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-5x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-6x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-6x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-6x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-6x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-6x6-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-6x6-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-6x6-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-6x6-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x6-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x6-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x6-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x6-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x8-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x8-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x8-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-8x8-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x6-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x6-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x6-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x6-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x8-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x8-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x8-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x8-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x10-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x10-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x10-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-10x10-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-12x10-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-12x10-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-12x10-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-12x10-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-12x12-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-12x12-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-12x12-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:format="astc-12x12-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="depth32float-stencil8";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="depth32float-stencil8";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc1-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc1-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc1-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc1-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc2-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc2-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc2-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc2-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc3-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc3-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc3-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc3-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc4-r-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc4-r-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc4-r-snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc4-r-snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc5-rg-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc5-rg-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc5-rg-snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc5-rg-snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc6h-rgb-ufloat";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc6h-rgb-ufloat";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc6h-rgb-float";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc6h-rgb-float";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc7-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc7-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc7-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="bc7-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgb8unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgb8unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgb8unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgb8unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgb8a1unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgb8a1unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgb8a1unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgb8a1unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgba8unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgba8unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgba8unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="etc2-rgba8unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="eac-r11unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="eac-r11unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="eac-r11snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="eac-r11snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="eac-rg11unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="eac-rg11unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="eac-rg11snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="eac-rg11snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-4x4-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-4x4-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-4x4-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-4x4-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-5x4-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-5x4-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-5x4-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-5x4-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-5x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-5x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-5x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-5x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-6x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-6x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-6x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-6x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-6x6-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-6x6-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-6x6-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-6x6-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x6-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x6-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x6-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x6-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x8-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x8-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x8-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-8x8-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x6-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x6-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x6-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x6-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x8-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x8-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x8-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x8-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x10-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x10-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x10-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-10x10-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-12x10-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-12x10-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-12x10-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-12x10-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-12x12-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-12x12-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-12x12-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor_view_formats:format="astc-12x12-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="depth32float-stencil8";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="depth32float-stencil8";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc1-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc1-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc1-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc1-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc2-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc2-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc2-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc2-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc3-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc3-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc3-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc3-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc4-r-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc4-r-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc4-r-snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc4-r-snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc5-rg-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc5-rg-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc5-rg-snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc5-rg-snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc6h-rgb-ufloat";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc6h-rgb-ufloat";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc6h-rgb-float";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc6h-rgb-float";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc7-rgba-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc7-rgba-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc7-rgba-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="bc7-rgba-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgb8unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgb8unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgb8unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgb8unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgb8a1unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgb8a1unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgb8a1unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgb8a1unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgba8unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgba8unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgba8unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="etc2-rgba8unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="eac-r11unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="eac-r11unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="eac-r11snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="eac-r11snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="eac-rg11unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="eac-rg11unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="eac-rg11snorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="eac-rg11snorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-4x4-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-4x4-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-4x4-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-4x4-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-5x4-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-5x4-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-5x4-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-5x4-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-5x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-5x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-5x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-5x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-6x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-6x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-6x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-6x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-6x6-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-6x6-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-6x6-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-6x6-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x6-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x6-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x6-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x6-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x8-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x8-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x8-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-8x8-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x5-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x5-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x5-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x5-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x6-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x6-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x6-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x6-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x8-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x8-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x8-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x8-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x10-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x10-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x10-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-10x10-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-12x10-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-12x10-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-12x10-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-12x10-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-12x12-unorm";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-12x12-unorm";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-12x12-unorm-srgb";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:texture_view_descriptor:format="astc-12x12-unorm-srgb";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="depth32float-stencil8";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="depth32float-stencil8";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="depth32float-stencil8";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="depth32float-stencil8";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc1-rgba-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc1-rgba-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc1-rgba-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc1-rgba-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc1-rgba-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc1-rgba-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc1-rgba-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc1-rgba-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc2-rgba-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc2-rgba-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc2-rgba-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc2-rgba-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc2-rgba-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc2-rgba-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc2-rgba-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc2-rgba-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc3-rgba-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc3-rgba-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc3-rgba-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc3-rgba-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc3-rgba-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc3-rgba-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc3-rgba-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc3-rgba-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc4-r-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc4-r-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc4-r-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc4-r-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc4-r-snorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc4-r-snorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc4-r-snorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc4-r-snorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc5-rg-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc5-rg-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc5-rg-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc5-rg-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc5-rg-snorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc5-rg-snorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc5-rg-snorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc5-rg-snorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc6h-rgb-ufloat";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc6h-rgb-ufloat";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc6h-rgb-ufloat";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc6h-rgb-ufloat";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc6h-rgb-float";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc6h-rgb-float";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc6h-rgb-float";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc6h-rgb-float";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc7-rgba-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc7-rgba-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc7-rgba-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc7-rgba-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc7-rgba-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc7-rgba-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc7-rgba-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="bc7-rgba-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8a1unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8a1unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8a1unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8a1unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8a1unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8a1unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8a1unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgb8a1unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgba8unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgba8unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgba8unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgba8unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgba8unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgba8unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgba8unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="etc2-rgba8unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-r11unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-r11unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-r11unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-r11unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-r11snorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-r11snorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-r11snorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-r11snorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-rg11unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-rg11unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-rg11unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-rg11unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-rg11snorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-rg11snorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-rg11snorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="eac-rg11snorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-4x4-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-4x4-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-4x4-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-4x4-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-4x4-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-4x4-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-4x4-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-4x4-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x4-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x4-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x4-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x4-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x4-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x4-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x4-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x4-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x5-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x5-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x5-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x5-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x5-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x5-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x5-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-5x5-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x5-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x5-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x5-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x5-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x5-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x5-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x5-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x5-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x6-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x6-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x6-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x6-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x6-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x6-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x6-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-6x6-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x5-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x5-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x5-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x5-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x5-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x5-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x5-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x5-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x6-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x6-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x6-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x6-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x6-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x6-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x6-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x6-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x8-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x8-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x8-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x8-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x8-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x8-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x8-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-8x8-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x5-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x5-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x5-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x5-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x5-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x5-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x5-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x5-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x6-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x6-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x6-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x6-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x6-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x6-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x6-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x6-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x8-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x8-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x8-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x8-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x8-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x8-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x8-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x8-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x10-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x10-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x10-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x10-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x10-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x10-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x10-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-10x10-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x10-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x10-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x10-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x10-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x10-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x10-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x10-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x10-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x12-unorm";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x12-unorm";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x12-unorm";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x12-unorm";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x12-unorm-srgb";canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x12-unorm-srgb";canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x12-unorm-srgb";canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:format="astc-12x12-unorm-srgb";canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["depth32float-stencil8"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["depth32float-stencil8"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["depth32float-stencil8"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["depth32float-stencil8"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc2-rgba-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc2-rgba-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc2-rgba-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc2-rgba-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc2-rgba-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc2-rgba-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc2-rgba-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc2-rgba-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc3-rgba-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc3-rgba-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc3-rgba-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc3-rgba-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc3-rgba-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc3-rgba-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc3-rgba-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc3-rgba-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc4-r-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc4-r-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc4-r-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc4-r-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc4-r-snorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc4-r-snorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc4-r-snorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc4-r-snorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc5-rg-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc5-rg-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc5-rg-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc5-rg-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc5-rg-snorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc5-rg-snorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc5-rg-snorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc5-rg-snorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc6h-rgb-ufloat"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc6h-rgb-ufloat"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc6h-rgb-ufloat"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc6h-rgb-ufloat"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc6h-rgb-float"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc6h-rgb-float"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc6h-rgb-float"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc6h-rgb-float"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc7-rgba-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc7-rgba-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc7-rgba-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc7-rgba-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc7-rgba-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc7-rgba-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc7-rgba-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc7-rgba-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8a1unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8a1unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8a1unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8a1unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8a1unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8a1unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8a1unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgb8a1unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgba8unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgba8unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgba8unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgba8unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgba8unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgba8unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgba8unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["etc2-rgba8unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-r11unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-r11unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-r11unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-r11unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-r11snorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-r11snorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-r11snorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-r11snorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-rg11unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-rg11unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-rg11unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-rg11unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-rg11snorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-rg11snorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-rg11snorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["eac-rg11snorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-4x4-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-4x4-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-4x4-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-4x4-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-4x4-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-4x4-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-4x4-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-4x4-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x4-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x4-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x4-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x4-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x4-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x4-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x4-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x4-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x5-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x5-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x5-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x5-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x5-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x5-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x5-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-5x5-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x5-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x5-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x5-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x5-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x5-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x5-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x5-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x5-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x6-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x6-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x6-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x6-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x6-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x6-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x6-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-6x6-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x5-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x5-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x5-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x5-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x5-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x5-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x5-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x5-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x6-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x6-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x6-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x6-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x6-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x6-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x6-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x6-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x8-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x8-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x8-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x8-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x8-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x8-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x8-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-8x8-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x5-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x5-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x5-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x5-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x5-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x5-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x5-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x5-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x6-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x6-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x6-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x6-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x6-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x6-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x6-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x6-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x8-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x8-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x8-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x8-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x8-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x8-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x8-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x8-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x10-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x10-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x10-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x10-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x10-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x10-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x10-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-10x10-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x10-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x10-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x10-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x10-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x10-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x10-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x10-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x10-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x12-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x12-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x12-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x12-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x12-unorm-srgb"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x12-unorm-srgb"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x12-unorm-srgb"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["astc-12x12-unorm-srgb"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bgra8unorm","bc1-rgba-unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bgra8unorm","bc1-rgba-unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bgra8unorm","bc1-rgba-unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bgra8unorm","bc1-rgba-unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm","bgra8unorm"];canvasType="onscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm","bgra8unorm"];canvasType="onscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm","bgra8unorm"];canvasType="offscreen";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:viewFormats=["bc1-rgba-unorm","bgra8unorm"];canvasType="offscreen";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:depth_stencil_state:format="depth32float-stencil8";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:depth_stencil_state:format="depth32float-stencil8";enable_required_feature=false +webgpu:api,validation,capability_checks,features,texture_formats:render_bundle_encoder_descriptor_depth_stencil_format:format="depth32float-stencil8";enable_required_feature=true +webgpu:api,validation,capability_checks,features,texture_formats:render_bundle_encoder_descriptor_depth_stencil_format:format="depth32float-stencil8";enable_required_feature=false +webgpu:api,validation,compute_pipeline:basic:isAsync=true +webgpu:api,validation,compute_pipeline:basic:isAsync=false +webgpu:api,validation,compute_pipeline:shader_module,invalid:isAsync=true +webgpu:api,validation,compute_pipeline:shader_module,invalid:isAsync=false +webgpu:api,validation,compute_pipeline:shader_module,compute:isAsync=true;shaderModuleStage="compute" +webgpu:api,validation,compute_pipeline:shader_module,compute:isAsync=true;shaderModuleStage="vertex" +webgpu:api,validation,compute_pipeline:shader_module,compute:isAsync=true;shaderModuleStage="fragment" +webgpu:api,validation,compute_pipeline:shader_module,compute:isAsync=false;shaderModuleStage="compute" +webgpu:api,validation,compute_pipeline:shader_module,compute:isAsync=false;shaderModuleStage="vertex" +webgpu:api,validation,compute_pipeline:shader_module,compute:isAsync=false;shaderModuleStage="fragment" +webgpu:api,validation,compute_pipeline:shader_module,device_mismatch: +webgpu:api,validation,compute_pipeline:pipeline_layout,device_mismatch: +webgpu:api,validation,compute_pipeline:limits,workgroup_storage_size:isAsync=true;type="vec4%3Cf32%3E" +webgpu:api,validation,compute_pipeline:limits,workgroup_storage_size:isAsync=true;type="mat4x4%3Cf32%3E" +webgpu:api,validation,compute_pipeline:limits,workgroup_storage_size:isAsync=false;type="vec4%3Cf32%3E" +webgpu:api,validation,compute_pipeline:limits,workgroup_storage_size:isAsync=false;type="mat4x4%3Cf32%3E" +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=true;size=[128,1,2] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=true;size=[129,1,2] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=true;size=[2,128,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=true;size=[2,129,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=true;size=[1,8,32] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=true;size=[1,8,33] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=false;size=[128,1,2] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=false;size=[129,1,2] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=false;size=[2,128,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=false;size=[2,129,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=false;size=[1,8,32] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup:isAsync=false;size=[1,8,33] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=true;size=[64] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=true;size=[256,1,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=true;size=[257,1,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=true;size=[1,256,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=true;size=[1,257,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=true;size=[1,1,63] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=true;size=[1,1,64] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=true;size=[1,1,65] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=false;size=[64] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=false;size=[256,1,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=false;size=[257,1,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=false;size=[1,256,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=false;size=[1,257,1] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=false;size=[1,1,63] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=false;size=[1,1,64] +webgpu:api,validation,compute_pipeline:limits,invocations_per_workgroup,each_component:isAsync=false;size=[1,1,65] +webgpu:api,validation,createBindGroup:binding_count_mismatch: +webgpu:api,validation,createBindGroup:binding_must_be_present_in_layout: +webgpu:api,validation,createBindGroup:binding_must_contain_resource_defined_in_layout: +webgpu:api,validation,createBindGroup:texture_binding_must_have_correct_usage: +webgpu:api,validation,createBindGroup:texture_must_have_correct_component_type:sampleType="float" +webgpu:api,validation,createBindGroup:texture_must_have_correct_component_type:sampleType="sint" +webgpu:api,validation,createBindGroup:texture_must_have_correct_component_type:sampleType="uint" +webgpu:api,validation,createBindGroup:texture_must_have_correct_dimension:viewDimension="1d" +webgpu:api,validation,createBindGroup:texture_must_have_correct_dimension:viewDimension="2d" +webgpu:api,validation,createBindGroup:texture_must_have_correct_dimension:viewDimension="2d-array" +webgpu:api,validation,createBindGroup:texture_must_have_correct_dimension:viewDimension="cube" +webgpu:api,validation,createBindGroup:texture_must_have_correct_dimension:viewDimension="cube-array" +webgpu:api,validation,createBindGroup:texture_must_have_correct_dimension:viewDimension="3d" +webgpu:api,validation,createBindGroup:buffer_offset_and_size_for_bind_groups_match: +webgpu:api,validation,createBindGroup:minBindingSize: +webgpu:api,validation,createBindGroup:buffer,resource_state: +webgpu:api,validation,createBindGroup:texture,resource_state: +webgpu:api,validation,createBindGroup:bind_group_layout,device_mismatch: +webgpu:api,validation,createBindGroup:binding_resources,device_mismatch:entry={"buffer":{"type":"storage"}} +webgpu:api,validation,createBindGroup:binding_resources,device_mismatch:entry={"sampler":{"type":"filtering"}} +webgpu:api,validation,createBindGroup:binding_resources,device_mismatch:entry={"texture":{"multisampled":false}} +webgpu:api,validation,createBindGroup:binding_resources,device_mismatch:entry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,createBindGroupLayout:duplicate_bindings: +webgpu:api,validation,createBindGroupLayout:maximum_binding_limit: +webgpu:api,validation,createBindGroupLayout:visibility:visibility=0 +webgpu:api,validation,createBindGroupLayout:visibility:visibility=1 +webgpu:api,validation,createBindGroupLayout:visibility:visibility=2 +webgpu:api,validation,createBindGroupLayout:visibility:visibility=3 +webgpu:api,validation,createBindGroupLayout:visibility:visibility=4 +webgpu:api,validation,createBindGroupLayout:visibility:visibility=5 +webgpu:api,validation,createBindGroupLayout:visibility:visibility=6 +webgpu:api,validation,createBindGroupLayout:visibility:visibility=7 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_buffer_type:shaderStage=0 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_buffer_type:shaderStage=1 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_buffer_type:shaderStage=2 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_buffer_type:shaderStage=3 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_buffer_type:shaderStage=4 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_buffer_type:shaderStage=5 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_buffer_type:shaderStage=6 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_buffer_type:shaderStage=7 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_storage_texture_access:shaderStage=0 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_storage_texture_access:shaderStage=1 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_storage_texture_access:shaderStage=2 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_storage_texture_access:shaderStage=3 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_storage_texture_access:shaderStage=4 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_storage_texture_access:shaderStage=5 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_storage_texture_access:shaderStage=6 +webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_storage_texture_access:shaderStage=7 +webgpu:api,validation,createBindGroupLayout:multisampled_validation: +webgpu:api,validation,createBindGroupLayout:max_dynamic_buffers:type="uniform" +webgpu:api,validation,createBindGroupLayout:max_dynamic_buffers:type="storage" +webgpu:api,validation,createBindGroupLayout:max_dynamic_buffers:type="read-only-storage" +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:maxedEntry={"buffer":{"type":"uniform"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:maxedEntry={"buffer":{"type":"storage"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:maxedEntry={"buffer":{"type":"read-only-storage"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:maxedEntry={"sampler":{"type":"comparison"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:maxedEntry={"sampler":{"type":"filtering"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:maxedEntry={"sampler":{"type":"non-filtering"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:maxedEntry={"texture":{"multisampled":false}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:maxedEntry={"texture":{"multisampled":true}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:maxedEntry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"buffer":{"type":"uniform"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"buffer":{"type":"storage"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"buffer":{"type":"read-only-storage"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"sampler":{"type":"comparison"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"sampler":{"type":"filtering"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"sampler":{"type":"non-filtering"}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"texture":{"multisampled":false}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"texture":{"multisampled":true}} +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,createBindGroupLayout:storage_texture,layout_dimension:viewDimension="_undef_" +webgpu:api,validation,createBindGroupLayout:storage_texture,layout_dimension:viewDimension="1d" +webgpu:api,validation,createBindGroupLayout:storage_texture,layout_dimension:viewDimension="2d" +webgpu:api,validation,createBindGroupLayout:storage_texture,layout_dimension:viewDimension="2d-array" +webgpu:api,validation,createBindGroupLayout:storage_texture,layout_dimension:viewDimension="cube" +webgpu:api,validation,createBindGroupLayout:storage_texture,layout_dimension:viewDimension="cube-array" +webgpu:api,validation,createBindGroupLayout:storage_texture,layout_dimension:viewDimension="3d" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r8unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r8snorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r8uint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r8sint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r16uint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r16sint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r16float" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg8unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg8snorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg8uint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg8sint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r32uint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r32sint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="r32float" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg16uint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg16sint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg16float" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba8unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba8unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba8snorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba8uint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba8sint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bgra8unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bgra8unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgb10a2unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg11b10ufloat" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgb9e5ufloat" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg32uint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg32sint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rg32float" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba16uint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba16sint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba16float" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba32uint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba32sint" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="rgba32float" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="depth32float" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="depth16unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="stencil8" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="depth24plus" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="depth24plus-stencil8" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="depth32float-stencil8" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc1-rgba-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc2-rgba-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc3-rgba-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc4-r-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc4-r-snorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc5-rg-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc5-rg-snorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc6h-rgb-ufloat" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc6h-rgb-float" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc7-rgba-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="etc2-rgb8unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="etc2-rgb8a1unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="etc2-rgba8unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="eac-r11unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="eac-r11snorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="eac-rg11unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="eac-rg11snorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-4x4-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-4x4-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-5x4-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-5x4-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-5x5-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-5x5-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-6x5-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-6x5-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-6x6-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-6x6-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-8x5-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-8x5-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-8x6-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-8x6-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-8x8-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-8x8-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-10x5-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-10x5-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-10x6-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-10x6-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-10x8-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-10x8-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-10x10-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-10x10-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-12x10-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-12x10-unorm-srgb" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-12x12-unorm" +webgpu:api,validation,createBindGroupLayout:storage_texture,formats:format="astc-12x12-unorm-srgb" +webgpu:api,validation,createPipelineLayout:number_of_dynamic_buffers_exceeds_the_maximum_value: +webgpu:api,validation,createPipelineLayout:number_of_bind_group_layouts_exceeds_the_maximum_value: +webgpu:api,validation,createPipelineLayout:bind_group_layouts,device_mismatch: +webgpu:api,validation,createSampler:lodMinAndMaxClamp: +webgpu:api,validation,createSampler:maxAnisotropy: +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="_undef_";format="rgba8unorm" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="_undef_";format="rgb10a2unorm" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="_undef_";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="_undef_";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="1d";format="rgba8unorm" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="1d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="2d";format="rgba8unorm" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="2d";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="3d";format="rgba8unorm" +webgpu:api,validation,createTexture:zero_size_and_usage:dimension="3d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="r32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bgra8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgb10a2unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg11b10ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rg32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="rgba32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="depth32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="depth16unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="depth24plus" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="depth32float-stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc4-r-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc4-r-snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="eac-r11unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="eac-r11snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="eac-rg11unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="eac-rg11snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="_undef_";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="r32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bgra8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rg32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="rgba32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="depth32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="depth16unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="depth24plus" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="depth32float-stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc4-r-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc4-r-snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="eac-r11unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="eac-r11snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="eac-rg11unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="eac-rg11snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="1d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="r32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bgra8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rg32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="rgba32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="depth32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="depth16unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="depth24plus" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="depth32float-stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="eac-r11unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="eac-r11snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="r32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba8snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba8uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba8sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bgra8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rg32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba16uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba16sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba16float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba32uint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba32sint" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="rgba32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="depth32float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="depth16unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="depth24plus" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="depth32float-stencil8" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc4-r-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc4-r-snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="eac-r11unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="eac-r11snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="eac-rg11unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="eac-rg11snorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:dimension_type_and_format_compatibility:dimension="3d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="r32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bgra8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgb10a2unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg11b10ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rg32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="rgba32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="depth32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="depth16unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="stencil8" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="depth24plus" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="depth32float-stencil8" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc4-r-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc4-r-snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="eac-r11unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="eac-r11snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="eac-rg11unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="eac-rg11snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="_undef_";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="r32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="bgra8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rg32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="1d";format="rgba32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="r32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bgra8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rg32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="rgba32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="depth32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="depth16unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="stencil8" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="depth24plus" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="depth32float-stencil8" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="eac-r11unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="eac-r11snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="r32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba8snorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba8uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba8sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="bgra8unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rg32float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba16uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba16sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba16float" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba32uint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba32sint" +webgpu:api,validation,createTexture:mipLevelCount,format:dimension="3d";format="rgba32float" +webgpu:api,validation,createTexture:mipLevelCount,bound_check:format="rgba8unorm" +webgpu:api,validation,createTexture:mipLevelCount,bound_check:format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:mipLevelCount,bound_check,bigger_than_integer_bit_width: +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r8snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r8uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r8sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r16uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r16sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r16float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg8snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg8uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg8sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r32uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r32sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="r32float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg16uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg16sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg16float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba8snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba8uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba8sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bgra8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgb10a2unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg11b10ufloat" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg32uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg32sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rg32float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba16uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba16sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba16float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba32uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba32sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="rgba32float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="depth32float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="depth16unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="stencil8" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="depth24plus" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="depth32float-stencil8" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc4-r-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc4-r-snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="eac-r11unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="eac-r11snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="eac-rg11unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="eac-rg11snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="_undef_";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r8snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r8uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r8sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r16uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r16sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r16float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg8snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg8uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg8sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r32uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r32sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="r32float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg16uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg16sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg16float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba8snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba8uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba8sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bgra8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg32uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg32sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rg32float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba16uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba16sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba16float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba32uint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba32sint" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="rgba32float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="depth32float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="depth16unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="stencil8" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="depth24plus" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="depth32float-stencil8" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="eac-r11unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="eac-r11snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:sampleCount,various_sampleCount_with_all_formats:dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="r32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bgra8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgb10a2unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg11b10ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rg32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="rgba32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="depth32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="depth16unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="stencil8" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="depth24plus" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="depth32float-stencil8" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc4-r-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc4-r-snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="eac-r11unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="eac-r11snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="eac-rg11unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="eac-rg11snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="_undef_";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="r32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="bgra8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rg32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="1d";format="rgba32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="r32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bgra8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rg32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="rgba32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="depth32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="depth16unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="stencil8" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="depth24plus" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="depth32float-stencil8" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="eac-r11unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="eac-r11snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="r32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba8snorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba8uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba8sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="bgra8unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rg32float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba16uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba16sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba16float" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba32uint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba32sint" +webgpu:api,validation,createTexture:sampleCount,valid_sampleCount_with_other_parameter_varies:dimension="3d";format="rgba32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="r32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="bgra8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rg32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="rgba32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="depth32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="depth16unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="stencil8" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="depth24plus" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="_undef_";format="depth32float-stencil8" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="r32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="bgra8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rg32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="1d";format="rgba32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="r32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="bgra8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rg32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="rgba32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="depth32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="depth16unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="stencil8" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="depth24plus" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="2d";format="depth32float-stencil8" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="r32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba8snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba8uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba8sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="bgra8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rg32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba16uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba16sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba16float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba32uint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba32sint" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,uncompressed_format:dimension="3d";format="rgba32float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc4-r-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc4-r-snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="eac-r11unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="eac-r11snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="eac-rg11unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="eac-rg11snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="eac-r11unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="eac-r11snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:texture_size,default_value_and_smallest_size,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r8unorm" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r8snorm" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r8uint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r8sint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r16uint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r16sint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r16float" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg8unorm" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg8snorm" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg8uint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg8sint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r32uint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r32sint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="r32float" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg16uint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg16sint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg16float" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba8unorm" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba8snorm" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba8uint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba8sint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="bgra8unorm" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg32uint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg32sint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rg32float" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba16uint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba16sint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba16float" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba32uint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba32sint" +webgpu:api,validation,createTexture:texture_size,1d_texture:format="rgba32float" +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r8sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r16float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg8sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="r32float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg16float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba8sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="bgra8unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb10a2unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb10a2unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb10a2unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb10a2unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb10a2unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb10a2unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb10a2unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb10a2unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb10a2unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg11b10ufloat";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg11b10ufloat";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg11b10ufloat";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg11b10ufloat";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg11b10ufloat";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg11b10ufloat";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg11b10ufloat";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg11b10ufloat";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg11b10ufloat";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgb9e5ufloat";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rg32float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba16float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="rgba32float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth16unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth16unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth16unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth16unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth16unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth16unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth16unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth16unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth16unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="stencil8";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="stencil8";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="stencil8";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="stencil8";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="stencil8";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="stencil8";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="stencil8";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="stencil8";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="stencil8";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth24plus-stencil8";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float-stencil8";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float-stencil8";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float-stencil8";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float-stencil8";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float-stencil8";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float-stencil8";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float-stencil8";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float-stencil8";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="_undef_";format="depth32float-stencil8";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r8sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r16float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg8sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="r32float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg16float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba8sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="bgra8unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb10a2unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb10a2unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb10a2unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb10a2unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb10a2unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb10a2unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb10a2unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb10a2unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb10a2unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg11b10ufloat";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg11b10ufloat";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg11b10ufloat";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg11b10ufloat";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg11b10ufloat";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg11b10ufloat";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg11b10ufloat";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg11b10ufloat";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg11b10ufloat";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb9e5ufloat";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb9e5ufloat";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb9e5ufloat";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb9e5ufloat";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb9e5ufloat";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb9e5ufloat";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb9e5ufloat";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb9e5ufloat";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgb9e5ufloat";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rg32float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba16float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32uint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32uint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32uint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32uint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32uint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32uint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32uint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32uint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32uint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32sint";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32sint";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32sint";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32sint";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32sint";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32sint";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32sint";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32sint";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32sint";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="rgba32float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth16unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth16unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth16unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth16unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth16unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth16unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth16unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth16unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth16unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="stencil8";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="stencil8";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="stencil8";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="stencil8";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="stencil8";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="stencil8";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="stencil8";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="stencil8";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="stencil8";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus-stencil8";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus-stencil8";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus-stencil8";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus-stencil8";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus-stencil8";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus-stencil8";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus-stencil8";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus-stencil8";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth24plus-stencil8";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float-stencil8";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float-stencil8";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float-stencil8";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float-stencil8";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float-stencil8";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float-stencil8";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float-stencil8";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float-stencil8";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,uncompressed_format:dimension="2d";format="depth32float-stencil8";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc1-rgba-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc2-rgba-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc3-rgba-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc4-r-snorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc5-rg-snorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-ufloat";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc6h-rgb-float";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="bc7-rgba-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgb8a1unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="etc2-rgba8unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-r11snorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="eac-rg11snorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-4x4-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[8187,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[8187,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[8197,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[8197,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[5,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[5,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[5,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[5,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[5,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[5,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[5,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[5,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm";size=[5,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[8187,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[8187,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[8197,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[8197,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[5,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[5,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[5,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[5,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[5,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[5,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[5,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[5,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x4-unorm-srgb";size=[5,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[8187,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[8187,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[8197,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[8197,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[5,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[5,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[5,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[5,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[5,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[5,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[5,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[5,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm";size=[5,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[8187,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[8187,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[8197,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[8197,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[5,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[5,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[5,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[5,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[5,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[5,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[5,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[5,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-5x5-unorm-srgb";size=[5,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[8186,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[8186,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[8198,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[8198,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[6,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[6,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[6,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[6,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[6,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[6,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[6,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[6,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm";size=[6,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[8186,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[8186,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[8198,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[8198,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[6,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[6,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[6,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[6,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[6,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[6,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[6,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[6,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x5-unorm-srgb";size=[6,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[8186,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[8186,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[8198,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[8198,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[6,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[6,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[6,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[6,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[6,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[6,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[6,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[6,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm";size=[6,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[8186,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[8186,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[8198,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[8198,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[6,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[6,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[6,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[6,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[6,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[6,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[6,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[6,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-6x6-unorm-srgb";size=[6,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8184,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8200,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm";size=[8,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8184,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8200,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x5-unorm-srgb";size=[8,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8184,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8200,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm";size=[8,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8184,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8200,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x6-unorm-srgb";size=[8,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8184,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8192,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8200,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[1,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm";size=[8,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8184,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8192,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8200,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[1,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-8x8-unorm-srgb";size=[8,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[8182,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[8202,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[10,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[10,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[10,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[10,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm";size=[10,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[8182,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[8202,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[10,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[10,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[10,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[10,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x5-unorm-srgb";size=[10,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[8182,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[8202,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[10,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[10,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[10,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[10,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm";size=[10,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[8182,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[8202,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[10,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[10,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[10,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[10,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x6-unorm-srgb";size=[10,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[8182,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[8192,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[8202,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[10,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[10,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[10,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[10,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[1,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm";size=[10,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[8182,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[8192,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[8202,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[10,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[10,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[10,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[10,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[1,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x8-unorm-srgb";size=[10,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[8182,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[8192,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[8202,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[10,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[10,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[10,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[10,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[1,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm";size=[10,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[8182,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[8192,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[8202,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[10,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[10,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[10,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[10,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[1,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-10x10-unorm-srgb";size=[10,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[8180,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[8180,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[8192,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[8204,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[8204,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[12,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[12,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[12,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[12,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[12,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[12,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[12,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[12,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[1,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm";size=[12,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[8180,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[8180,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[8192,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[8204,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[8204,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[12,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[12,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[12,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[12,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[12,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[12,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[12,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[12,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[1,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x10-unorm-srgb";size=[12,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[8180,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[8180,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[8192,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[8204,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[8204,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,8180,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[12,8180,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[12,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[12,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[12,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,12,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[12,12,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[12,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,12,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[12,12,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[12,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[1,12,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm";size=[12,12,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[8180,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[8180,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[8192,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[8204,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[8204,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,8180,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[12,8180,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[12,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[12,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[12,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,12,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[12,12,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[12,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,12,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[12,12,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[12,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[1,12,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="_undef_";format="astc-12x12-unorm-srgb";size=[12,12,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc1-rgba-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc2-rgba-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc3-rgba-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc4-r-snorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc5-rg-snorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-ufloat";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc6h-rgb-float";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="bc7-rgba-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgb8a1unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="etc2-rgba8unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-r11snorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="eac-rg11snorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[8188,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[8188,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[8196,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[8196,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[4,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[4,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[4,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[4,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[4,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[4,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[4,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[4,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-4x4-unorm-srgb";size=[4,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[8187,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[8187,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[8197,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[8197,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[5,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[5,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[5,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[5,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[5,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[5,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[5,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[5,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm";size=[5,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[8187,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[8187,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[8192,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[8197,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[8197,4,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[5,8188,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[5,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[5,8196,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[5,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[5,4,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[5,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[5,4,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[5,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[1,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x4-unorm-srgb";size=[5,4,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[8187,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[8187,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[8197,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[8197,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[5,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[5,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[5,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[5,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[5,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[5,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[5,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[5,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm";size=[5,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[8187,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[8187,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[8197,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[8197,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[5,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[5,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[5,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[5,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[5,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[5,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[5,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[5,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-5x5-unorm-srgb";size=[5,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[8186,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[8186,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[8198,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[8198,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[6,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[6,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[6,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[6,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[6,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[6,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[6,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[6,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm";size=[6,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[8186,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[8186,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[8198,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[8198,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[6,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[6,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[6,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[6,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[6,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[6,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[6,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[6,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x5-unorm-srgb";size=[6,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[8186,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[8186,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[8198,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[8198,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[6,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[6,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[6,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[6,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[6,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[6,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[6,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[6,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm";size=[6,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[8186,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[8186,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[8198,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[8198,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[6,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[6,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[6,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[6,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[6,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[6,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[6,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[6,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-6x6-unorm-srgb";size=[6,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8184,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8200,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm";size=[8,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8184,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8200,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x5-unorm-srgb";size=[8,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8184,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8200,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm";size=[8,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8184,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8200,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x6-unorm-srgb";size=[8,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8184,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8192,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8200,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[1,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm";size=[8,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8184,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8184,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8192,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8200,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8200,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[1,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-8x8-unorm-srgb";size=[8,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[8182,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[8202,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[10,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[10,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[10,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[10,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm";size=[10,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[8182,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[8192,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[8202,5,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[10,8187,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[10,8197,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[10,5,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[10,5,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[1,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x5-unorm-srgb";size=[10,5,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[8182,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[8202,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[10,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[10,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[10,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[10,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm";size=[10,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[8182,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[8192,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[8202,6,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[10,8186,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[10,8198,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[10,6,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[10,6,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[1,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x6-unorm-srgb";size=[10,6,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[8182,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[8192,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[8202,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[10,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[10,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[10,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[10,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[1,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm";size=[10,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[8182,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[8192,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[8202,8,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[10,8184,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[10,8200,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[10,8,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[10,8,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[1,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x8-unorm-srgb";size=[10,8,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[8182,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[8192,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[8202,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[10,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[10,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[10,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[10,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[1,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm";size=[10,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[8182,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[8182,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[8192,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[8202,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[8202,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[10,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[10,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[10,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[10,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[10,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[10,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[10,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[10,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[1,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-10x10-unorm-srgb";size=[10,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[8180,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[8180,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[8192,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[8204,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[8204,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[12,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[12,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[12,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[12,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[12,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[12,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[12,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[12,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[1,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm";size=[12,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[8180,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[8180,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[8192,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[8204,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[8204,10,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[12,8182,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[12,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[12,8202,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[12,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[12,10,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[12,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[12,10,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[12,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[1,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x10-unorm-srgb";size=[12,10,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[8180,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[8180,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[8192,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[8204,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[8204,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,8180,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[12,8180,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[12,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[12,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[12,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,12,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[12,12,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[12,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,12,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[12,12,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[12,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[1,12,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm";size=[12,12,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[8191,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[8180,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[8180,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[8192,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[8192,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[8193,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[8204,1,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[8204,12,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,8191,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,8180,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[12,8180,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[12,8192,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,8193,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[12,8204,1] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[12,1,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,12,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[12,12,255] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[12,1,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,12,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[12,12,256] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[12,1,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[1,12,257] +webgpu:api,validation,createTexture:texture_size,2d_texture,compressed_format:dimension="2d";format="astc-12x12-unorm-srgb";size=[12,12,257] +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r8unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r8snorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r8uint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r8sint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r16uint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r16sint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r16float" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg8unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg8snorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg8uint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg8sint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r32uint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r32sint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="r32float" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg16uint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg16sint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg16float" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba8unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba8snorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba8uint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba8sint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="bgra8unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg32uint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg32sint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rg32float" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba16uint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba16sint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba16float" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba32uint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba32sint" +webgpu:api,validation,createTexture:texture_size,3d_texture,uncompressed_format:format="rgba32float" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc4-r-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc4-r-snorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc5-rg-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc5-rg-snorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc6h-rgb-float" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="eac-r11unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="eac-r11snorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="eac-rg11unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="eac-rg11snorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-4x4-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-5x4-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-5x5-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-6x5-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-6x6-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-8x5-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-8x6-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-8x8-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-10x5-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-10x6-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-10x8-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-10x10-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-12x10-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-12x12-unorm" +webgpu:api,validation,createTexture:texture_size,3d_texture,compressed_format:format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r16float" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="r32float" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg16float" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bgra8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rg32float" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba16float" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="rgba32float" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="depth32float" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="depth16unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="stencil8" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="depth24plus" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="depth32float-stencil8" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc4-r-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc4-r-snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="eac-r11unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="eac-r11snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="eac-rg11unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="eac-rg11snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="_undef_";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r16float" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="r32float" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg16float" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="bgra8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rg32float" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba16float" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="1d";format="rgba32float" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r16float" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="r32float" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg16float" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bgra8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rg32float" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba16float" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="rgba32float" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="depth32float" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="depth16unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="stencil8" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="depth24plus" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="depth24plus-stencil8" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="depth32float-stencil8" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="eac-r11unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="eac-r11snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r16float" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="r32float" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg16float" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba8snorm" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba8uint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba8sint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="bgra8unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="bgra8unorm-srgb" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgb10a2unorm" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg11b10ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgb9e5ufloat" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rg32float" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba16uint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba16sint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba16float" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba32uint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba32sint" +webgpu:api,validation,createTexture:texture_usage:dimension="3d";format="rgba32float" +webgpu:api,validation,createTexture:viewFormats:formatFeature="_undef_";viewFormatFeature="_undef_" +webgpu:api,validation,createTexture:viewFormats:formatFeature="_undef_";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createTexture:viewFormats:formatFeature="_undef_";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createTexture:viewFormats:formatFeature="_undef_";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createTexture:viewFormats:formatFeature="_undef_";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createTexture:viewFormats:formatFeature="depth32float-stencil8";viewFormatFeature="_undef_" +webgpu:api,validation,createTexture:viewFormats:formatFeature="depth32float-stencil8";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createTexture:viewFormats:formatFeature="depth32float-stencil8";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createTexture:viewFormats:formatFeature="depth32float-stencil8";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createTexture:viewFormats:formatFeature="depth32float-stencil8";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-bc";viewFormatFeature="_undef_" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-bc";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-bc";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-bc";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-bc";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-etc2";viewFormatFeature="_undef_" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-etc2";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-etc2";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-etc2";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-etc2";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-astc";viewFormatFeature="_undef_" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-astc";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-astc";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-astc";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createTexture:viewFormats:formatFeature="texture-compression-astc";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createView:format:textureFormatFeature="_undef_";viewFormatFeature="_undef_" +webgpu:api,validation,createView:format:textureFormatFeature="_undef_";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createView:format:textureFormatFeature="_undef_";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createView:format:textureFormatFeature="_undef_";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createView:format:textureFormatFeature="_undef_";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createView:format:textureFormatFeature="depth32float-stencil8";viewFormatFeature="_undef_" +webgpu:api,validation,createView:format:textureFormatFeature="depth32float-stencil8";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createView:format:textureFormatFeature="depth32float-stencil8";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createView:format:textureFormatFeature="depth32float-stencil8";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createView:format:textureFormatFeature="depth32float-stencil8";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-bc";viewFormatFeature="_undef_" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-bc";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-bc";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-bc";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-bc";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-etc2";viewFormatFeature="_undef_" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-etc2";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-etc2";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-etc2";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-etc2";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-astc";viewFormatFeature="_undef_" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-astc";viewFormatFeature="depth32float-stencil8" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-astc";viewFormatFeature="texture-compression-bc" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-astc";viewFormatFeature="texture-compression-etc2" +webgpu:api,validation,createView:format:textureFormatFeature="texture-compression-astc";viewFormatFeature="texture-compression-astc" +webgpu:api,validation,createView:dimension:textureDimension="1d";viewDimension="1d" +webgpu:api,validation,createView:dimension:textureDimension="1d";viewDimension="2d" +webgpu:api,validation,createView:dimension:textureDimension="1d";viewDimension="2d-array" +webgpu:api,validation,createView:dimension:textureDimension="1d";viewDimension="cube" +webgpu:api,validation,createView:dimension:textureDimension="1d";viewDimension="cube-array" +webgpu:api,validation,createView:dimension:textureDimension="1d";viewDimension="3d" +webgpu:api,validation,createView:dimension:textureDimension="1d";viewDimension="_undef_" +webgpu:api,validation,createView:dimension:textureDimension="2d";viewDimension="1d" +webgpu:api,validation,createView:dimension:textureDimension="2d";viewDimension="2d" +webgpu:api,validation,createView:dimension:textureDimension="2d";viewDimension="2d-array" +webgpu:api,validation,createView:dimension:textureDimension="2d";viewDimension="cube" +webgpu:api,validation,createView:dimension:textureDimension="2d";viewDimension="cube-array" +webgpu:api,validation,createView:dimension:textureDimension="2d";viewDimension="3d" +webgpu:api,validation,createView:dimension:textureDimension="2d";viewDimension="_undef_" +webgpu:api,validation,createView:dimension:textureDimension="3d";viewDimension="1d" +webgpu:api,validation,createView:dimension:textureDimension="3d";viewDimension="2d" +webgpu:api,validation,createView:dimension:textureDimension="3d";viewDimension="2d-array" +webgpu:api,validation,createView:dimension:textureDimension="3d";viewDimension="cube" +webgpu:api,validation,createView:dimension:textureDimension="3d";viewDimension="cube-array" +webgpu:api,validation,createView:dimension:textureDimension="3d";viewDimension="3d" +webgpu:api,validation,createView:dimension:textureDimension="3d";viewDimension="_undef_" +webgpu:api,validation,createView:aspect:format="r8unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="r8unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r8unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="r8snorm";aspect="all" +webgpu:api,validation,createView:aspect:format="r8snorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r8snorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="r8uint";aspect="all" +webgpu:api,validation,createView:aspect:format="r8uint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r8uint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="r8sint";aspect="all" +webgpu:api,validation,createView:aspect:format="r8sint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r8sint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="r16uint";aspect="all" +webgpu:api,validation,createView:aspect:format="r16uint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r16uint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="r16sint";aspect="all" +webgpu:api,validation,createView:aspect:format="r16sint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r16sint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="r16float";aspect="all" +webgpu:api,validation,createView:aspect:format="r16float";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r16float";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg8unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="rg8unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg8unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg8snorm";aspect="all" +webgpu:api,validation,createView:aspect:format="rg8snorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg8snorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg8uint";aspect="all" +webgpu:api,validation,createView:aspect:format="rg8uint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg8uint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg8sint";aspect="all" +webgpu:api,validation,createView:aspect:format="rg8sint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg8sint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="r32uint";aspect="all" +webgpu:api,validation,createView:aspect:format="r32uint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r32uint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="r32sint";aspect="all" +webgpu:api,validation,createView:aspect:format="r32sint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r32sint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="r32float";aspect="all" +webgpu:api,validation,createView:aspect:format="r32float";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="r32float";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg16uint";aspect="all" +webgpu:api,validation,createView:aspect:format="rg16uint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg16uint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg16sint";aspect="all" +webgpu:api,validation,createView:aspect:format="rg16sint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg16sint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg16float";aspect="all" +webgpu:api,validation,createView:aspect:format="rg16float";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg16float";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba8unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba8unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba8unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba8unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba8unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba8unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba8snorm";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba8snorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba8snorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba8uint";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba8uint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba8uint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba8sint";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba8sint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba8sint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bgra8unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="bgra8unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bgra8unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bgra8unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="bgra8unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bgra8unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgb10a2unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="rgb10a2unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgb10a2unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg11b10ufloat";aspect="all" +webgpu:api,validation,createView:aspect:format="rg11b10ufloat";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg11b10ufloat";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgb9e5ufloat";aspect="all" +webgpu:api,validation,createView:aspect:format="rgb9e5ufloat";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgb9e5ufloat";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg32uint";aspect="all" +webgpu:api,validation,createView:aspect:format="rg32uint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg32uint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg32sint";aspect="all" +webgpu:api,validation,createView:aspect:format="rg32sint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg32sint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rg32float";aspect="all" +webgpu:api,validation,createView:aspect:format="rg32float";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rg32float";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba16uint";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba16uint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba16uint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba16sint";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba16sint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba16sint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba16float";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba16float";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba16float";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba32uint";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba32uint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba32uint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba32sint";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba32sint";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba32sint";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="rgba32float";aspect="all" +webgpu:api,validation,createView:aspect:format="rgba32float";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="rgba32float";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="depth32float";aspect="all" +webgpu:api,validation,createView:aspect:format="depth32float";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="depth32float";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="depth16unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="depth16unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="depth16unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="stencil8";aspect="all" +webgpu:api,validation,createView:aspect:format="stencil8";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="stencil8";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="depth24plus";aspect="all" +webgpu:api,validation,createView:aspect:format="depth24plus";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="depth24plus";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="depth24plus-stencil8";aspect="all" +webgpu:api,validation,createView:aspect:format="depth24plus-stencil8";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="depth24plus-stencil8";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="depth32float-stencil8";aspect="all" +webgpu:api,validation,createView:aspect:format="depth32float-stencil8";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="depth32float-stencil8";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc1-rgba-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="bc1-rgba-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc1-rgba-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc1-rgba-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="bc1-rgba-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc1-rgba-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc2-rgba-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="bc2-rgba-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc2-rgba-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc2-rgba-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="bc2-rgba-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc2-rgba-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc3-rgba-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="bc3-rgba-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc3-rgba-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc3-rgba-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="bc3-rgba-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc3-rgba-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc4-r-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="bc4-r-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc4-r-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc4-r-snorm";aspect="all" +webgpu:api,validation,createView:aspect:format="bc4-r-snorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc4-r-snorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc5-rg-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="bc5-rg-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc5-rg-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc5-rg-snorm";aspect="all" +webgpu:api,validation,createView:aspect:format="bc5-rg-snorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc5-rg-snorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc6h-rgb-ufloat";aspect="all" +webgpu:api,validation,createView:aspect:format="bc6h-rgb-ufloat";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc6h-rgb-ufloat";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc6h-rgb-float";aspect="all" +webgpu:api,validation,createView:aspect:format="bc6h-rgb-float";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc6h-rgb-float";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc7-rgba-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="bc7-rgba-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc7-rgba-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="bc7-rgba-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="bc7-rgba-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="bc7-rgba-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="etc2-rgb8unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="etc2-rgb8unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="etc2-rgb8unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="etc2-rgb8unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="etc2-rgb8unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="etc2-rgb8unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="etc2-rgb8a1unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="etc2-rgb8a1unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="etc2-rgb8a1unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="etc2-rgb8a1unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="etc2-rgb8a1unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="etc2-rgb8a1unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="etc2-rgba8unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="etc2-rgba8unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="etc2-rgba8unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="etc2-rgba8unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="etc2-rgba8unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="etc2-rgba8unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="eac-r11unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="eac-r11unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="eac-r11unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="eac-r11snorm";aspect="all" +webgpu:api,validation,createView:aspect:format="eac-r11snorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="eac-r11snorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="eac-rg11unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="eac-rg11unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="eac-rg11unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="eac-rg11snorm";aspect="all" +webgpu:api,validation,createView:aspect:format="eac-rg11snorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="eac-rg11snorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-4x4-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-4x4-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-4x4-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-4x4-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-4x4-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-4x4-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-5x4-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-5x4-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-5x4-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-5x4-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-5x4-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-5x4-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-5x5-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-5x5-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-5x5-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-5x5-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-5x5-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-5x5-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-6x5-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-6x5-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-6x5-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-6x5-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-6x5-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-6x5-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-6x6-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-6x6-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-6x6-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-6x6-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-6x6-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-6x6-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-8x5-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-8x5-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-8x5-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-8x5-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-8x5-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-8x5-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-8x6-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-8x6-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-8x6-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-8x6-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-8x6-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-8x6-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-8x8-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-8x8-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-8x8-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-8x8-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-8x8-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-8x8-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-10x5-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-10x5-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-10x5-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-10x5-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-10x5-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-10x5-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-10x6-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-10x6-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-10x6-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-10x6-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-10x6-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-10x6-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-10x8-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-10x8-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-10x8-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-10x8-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-10x8-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-10x8-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-10x10-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-10x10-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-10x10-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-10x10-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-10x10-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-10x10-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-12x10-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-12x10-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-12x10-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-12x10-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-12x10-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-12x10-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-12x12-unorm";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-12x12-unorm";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-12x12-unorm";aspect="stencil-only" +webgpu:api,validation,createView:aspect:format="astc-12x12-unorm-srgb";aspect="all" +webgpu:api,validation,createView:aspect:format="astc-12x12-unorm-srgb";aspect="depth-only" +webgpu:api,validation,createView:aspect:format="astc-12x12-unorm-srgb";aspect="stencil-only" +webgpu:api,validation,createView:array_layers:textureDimension="1d";viewDimension="_undef_" +webgpu:api,validation,createView:array_layers:textureDimension="1d";viewDimension="1d" +webgpu:api,validation,createView:array_layers:textureDimension="2d";viewDimension="_undef_" +webgpu:api,validation,createView:array_layers:textureDimension="2d";viewDimension="2d" +webgpu:api,validation,createView:array_layers:textureDimension="2d";viewDimension="2d-array" +webgpu:api,validation,createView:array_layers:textureDimension="2d";viewDimension="cube" +webgpu:api,validation,createView:array_layers:textureDimension="2d";viewDimension="cube-array" +webgpu:api,validation,createView:array_layers:textureDimension="3d";viewDimension="_undef_" +webgpu:api,validation,createView:array_layers:textureDimension="3d";viewDimension="3d" +webgpu:api,validation,createView:mip_levels:textureDimension="1d";viewDimension="_undef_" +webgpu:api,validation,createView:mip_levels:textureDimension="1d";viewDimension="1d" +webgpu:api,validation,createView:mip_levels:textureDimension="2d";viewDimension="_undef_" +webgpu:api,validation,createView:mip_levels:textureDimension="2d";viewDimension="2d" +webgpu:api,validation,createView:mip_levels:textureDimension="2d";viewDimension="2d-array" +webgpu:api,validation,createView:mip_levels:textureDimension="2d";viewDimension="cube" +webgpu:api,validation,createView:mip_levels:textureDimension="2d";viewDimension="cube-array" +webgpu:api,validation,createView:mip_levels:textureDimension="3d";viewDimension="_undef_" +webgpu:api,validation,createView:mip_levels:textureDimension="3d";viewDimension="3d" +webgpu:api,validation,createView:cube_faces_square:dimension="2d";size=[4,4,6] +webgpu:api,validation,createView:cube_faces_square:dimension="2d";size=[5,5,6] +webgpu:api,validation,createView:cube_faces_square:dimension="2d";size=[4,5,6] +webgpu:api,validation,createView:cube_faces_square:dimension="2d";size=[4,8,6] +webgpu:api,validation,createView:cube_faces_square:dimension="2d";size=[8,4,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube";size=[4,4,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube";size=[5,5,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube";size=[4,5,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube";size=[4,8,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube";size=[8,4,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube-array";size=[4,4,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube-array";size=[5,5,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube-array";size=[4,5,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube-array";size=[4,8,6] +webgpu:api,validation,createView:cube_faces_square:dimension="cube-array";size=[8,4,6] +webgpu:api,validation,createView:texture_state: +webgpu:api,validation,encoding,beginComputePass:timestampWrites,same_location:locationA="beginning";locationB="beginning" +webgpu:api,validation,encoding,beginComputePass:timestampWrites,same_location:locationA="beginning";locationB="end" +webgpu:api,validation,encoding,beginComputePass:timestampWrites,same_location:locationA="end";locationB="beginning" +webgpu:api,validation,encoding,beginComputePass:timestampWrites,same_location:locationA="end";locationB="end" +webgpu:api,validation,encoding,beginComputePass:timestampWrites,query_set_type:queryTypeA="occlusion";queryTypeB="occlusion" +webgpu:api,validation,encoding,beginComputePass:timestampWrites,query_set_type:queryTypeA="occlusion";queryTypeB="timestamp" +webgpu:api,validation,encoding,beginComputePass:timestampWrites,query_set_type:queryTypeA="timestamp";queryTypeB="occlusion" +webgpu:api,validation,encoding,beginComputePass:timestampWrites,query_set_type:queryTypeA="timestamp";queryTypeB="timestamp" +webgpu:api,validation,encoding,beginComputePass:timestampWrites,query_index_count:queryIndex=0 +webgpu:api,validation,encoding,beginComputePass:timestampWrites,query_index_count:queryIndex=1 +webgpu:api,validation,encoding,beginComputePass:timestampWrites,query_index_count:queryIndex=2 +webgpu:api,validation,encoding,beginComputePass:timestampWrites,query_index_count:queryIndex=3 +webgpu:api,validation,encoding,beginComputePass:timestamp_query_set,device_mismatch:mismatched=true +webgpu:api,validation,encoding,beginComputePass:timestamp_query_set,device_mismatch:mismatched=false +webgpu:api,validation,encoding,beginRenderPass:color_attachments,device_mismatch: +webgpu:api,validation,encoding,beginRenderPass:depth_stencil_attachment,device_mismatch: +webgpu:api,validation,encoding,beginRenderPass:occlusion_query_set,device_mismatch: +webgpu:api,validation,encoding,beginRenderPass:timestamp_query_set,device_mismatch:mismatched=true +webgpu:api,validation,encoding,beginRenderPass:timestamp_query_set,device_mismatch:mismatched=false +webgpu:api,validation,encoding,cmds,clearBuffer:buffer_state:bufferState="valid" +webgpu:api,validation,encoding,cmds,clearBuffer:buffer_state:bufferState="invalid" +webgpu:api,validation,encoding,cmds,clearBuffer:buffer_state:bufferState="destroyed" +webgpu:api,validation,encoding,cmds,clearBuffer:buffer,device_mismatch: +webgpu:api,validation,encoding,cmds,clearBuffer:default_args: +webgpu:api,validation,encoding,cmds,clearBuffer:buffer_usage: +webgpu:api,validation,encoding,cmds,clearBuffer:size_alignment: +webgpu:api,validation,encoding,cmds,clearBuffer:offset_alignment: +webgpu:api,validation,encoding,cmds,clearBuffer:overflow: +webgpu:api,validation,encoding,cmds,clearBuffer:out_of_bounds: +webgpu:api,validation,encoding,cmds,compute_pass:set_pipeline: +webgpu:api,validation,encoding,cmds,compute_pass:pipeline,device_mismatch: +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="direct";largeDimValue=0 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="direct";largeDimValue=1 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="direct";largeDimValue=65535 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="direct";largeDimValue=65536 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="direct";largeDimValue=2147483647 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="direct";largeDimValue=4294967295 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="indirect";largeDimValue=0 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="indirect";largeDimValue=1 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="indirect";largeDimValue=65535 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="indirect";largeDimValue=65536 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="indirect";largeDimValue=2147483647 +webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:dispatchType="indirect";largeDimValue=4294967295 +webgpu:api,validation,encoding,cmds,compute_pass:indirect_dispatch_buffer_state: +webgpu:api,validation,encoding,cmds,compute_pass:indirect_dispatch_buffer,device_mismatch: +webgpu:api,validation,encoding,cmds,compute_pass:indirect_dispatch_buffer,usage: +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_state:srcBufferState="valid";dstBufferState="valid" +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_state:srcBufferState="valid";dstBufferState="invalid" +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_state:srcBufferState="valid";dstBufferState="destroyed" +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_state:srcBufferState="invalid";dstBufferState="valid" +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_state:srcBufferState="invalid";dstBufferState="invalid" +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_state:srcBufferState="invalid";dstBufferState="destroyed" +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_state:srcBufferState="destroyed";dstBufferState="valid" +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_state:srcBufferState="destroyed";dstBufferState="invalid" +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_state:srcBufferState="destroyed";dstBufferState="destroyed" +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer,device_mismatch: +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:buffer_usage: +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:copy_size_alignment: +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:copy_offset_alignment: +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:copy_overflow: +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:copy_out_of_bounds: +webgpu:api,validation,encoding,cmds,copyBufferToBuffer:copy_within_same_buffer: +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_with_invalid_or_destroyed_texture: +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture,device_mismatch: +webgpu:api,validation,encoding,cmds,copyTextureToTexture:mipmap_level:dimension="1d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:mipmap_level:dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:mipmap_level:dimension="3d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_usage: +webgpu:api,validation,encoding,cmds,copyTextureToTexture:sample_count: +webgpu:api,validation,encoding,cmds,copyTextureToTexture:multisampled_copy_restrictions: +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="_undef_";dstFormatFeature="_undef_" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="_undef_";dstFormatFeature="depth32float-stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="_undef_";dstFormatFeature="texture-compression-bc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="_undef_";dstFormatFeature="texture-compression-etc2" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="_undef_";dstFormatFeature="texture-compression-astc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="depth32float-stencil8";dstFormatFeature="_undef_" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="depth32float-stencil8";dstFormatFeature="depth32float-stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="depth32float-stencil8";dstFormatFeature="texture-compression-bc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="depth32float-stencil8";dstFormatFeature="texture-compression-etc2" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="depth32float-stencil8";dstFormatFeature="texture-compression-astc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-bc";dstFormatFeature="_undef_" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-bc";dstFormatFeature="depth32float-stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-bc";dstFormatFeature="texture-compression-bc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-bc";dstFormatFeature="texture-compression-etc2" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-bc";dstFormatFeature="texture-compression-astc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-etc2";dstFormatFeature="_undef_" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-etc2";dstFormatFeature="depth32float-stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-etc2";dstFormatFeature="texture-compression-bc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-etc2";dstFormatFeature="texture-compression-etc2" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-etc2";dstFormatFeature="texture-compression-astc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-astc";dstFormatFeature="_undef_" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-astc";dstFormatFeature="depth32float-stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-astc";dstFormatFeature="texture-compression-bc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-astc";dstFormatFeature="texture-compression-etc2" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:texture_format_compatibility:srcFormatFeature="texture-compression-astc";dstFormatFeature="texture-compression-astc" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:depth_stencil_copy_restrictions:format="depth32float" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:depth_stencil_copy_restrictions:format="depth16unorm" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:depth_stencil_copy_restrictions:format="stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:depth_stencil_copy_restrictions:format="depth24plus" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:depth_stencil_copy_restrictions:format="depth24plus-stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:depth_stencil_copy_restrictions:format="depth32float-stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="1d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="2d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":1,"y":0,"z":0,"width":-1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":1,"z":0,"width":0,"height":-1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":1,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":1,"height":0,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":1,"depthOrArrayLayers":-2};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":1};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":0,"width":0,"height":0,"depthOrArrayLayers":0};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":1,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=0;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=1;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=0 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=1 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges:dimension="3d";copyBoxOffsets={"x":0,"y":0,"z":2,"width":0,"height":0,"depthOrArrayLayers":-1};srcCopyLevel=3;dstCopyLevel=3 +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_within_same_texture: +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_aspects:format="rgba8unorm" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_aspects:format="depth32float" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_aspects:format="depth16unorm" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_aspects:format="stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_aspects:format="depth24plus" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_aspects:format="depth24plus-stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_aspects:format="depth32float-stencil8" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="eac-r11unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="eac-r11snorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,encoding,cmds,copyTextureToTexture:copy_ranges_with_compressed_texture_formats:format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,encoding,cmds,debug:debug_group_balanced:encoderType="non-pass" +webgpu:api,validation,encoding,cmds,debug:debug_group_balanced:encoderType="compute%20pass" +webgpu:api,validation,encoding,cmds,debug:debug_group_balanced:encoderType="render%20pass" +webgpu:api,validation,encoding,cmds,debug:debug_group_balanced:encoderType="render%20bundle" +webgpu:api,validation,encoding,cmds,debug:debug_group:encoderType="non-pass" +webgpu:api,validation,encoding,cmds,debug:debug_group:encoderType="compute%20pass" +webgpu:api,validation,encoding,cmds,debug:debug_group:encoderType="render%20pass" +webgpu:api,validation,encoding,cmds,debug:debug_group:encoderType="render%20bundle" +webgpu:api,validation,encoding,cmds,debug:debug_marker:encoderType="non-pass" +webgpu:api,validation,encoding,cmds,debug:debug_marker:encoderType="compute%20pass" +webgpu:api,validation,encoding,cmds,debug:debug_marker:encoderType="render%20pass" +webgpu:api,validation,encoding,cmds,debug:debug_marker:encoderType="render%20bundle" +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=6;firstIndex=0;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=6;firstIndex=0;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=6;firstIndex=1;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=6;firstIndex=1;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=6;firstIndex=10000;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=6;firstIndex=10000;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=5;firstIndex=1;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=5;firstIndex=1;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=1;firstIndex=5;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=1;firstIndex=5;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=1;firstIndex=6;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=1;firstIndex=6;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=0;firstIndex=6;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=0;firstIndex=6;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=0;firstIndex=7;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=0;firstIndex=7;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=7;firstIndex=0;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=7;firstIndex=0;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=10000;firstIndex=0;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=10000;firstIndex=0;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=4294967295;firstIndex=4294967295;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=4294967295;firstIndex=4294967295;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=4294967295;firstIndex=2;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=4294967295;firstIndex=2;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=2;firstIndex=4294967295;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds:indexCount=2;firstIndex=4294967295;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds_zero_sized_index_buffer:indexCount=3;firstIndex=1;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds_zero_sized_index_buffer:indexCount=3;firstIndex=1;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds_zero_sized_index_buffer:indexCount=3;firstIndex=0;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds_zero_sized_index_buffer:indexCount=3;firstIndex=0;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds_zero_sized_index_buffer:indexCount=0;firstIndex=1;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds_zero_sized_index_buffer:indexCount=0;firstIndex=1;instanceCount=10000 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds_zero_sized_index_buffer:indexCount=0;firstIndex=0;instanceCount=1 +webgpu:api,validation,encoding,cmds,index_access:out_of_bounds_zero_sized_index_buffer:indexCount=0;firstIndex=0;instanceCount=10000 +webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:smallIndexBuffer=false;smallVertexBuffer=false;smallInstanceBuffer=false +webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:smallIndexBuffer=false;smallVertexBuffer=false;smallInstanceBuffer=true +webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:smallIndexBuffer=false;smallVertexBuffer=true;smallInstanceBuffer=false +webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:smallIndexBuffer=false;smallVertexBuffer=true;smallInstanceBuffer=true +webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:smallIndexBuffer=true;smallVertexBuffer=false;smallInstanceBuffer=false +webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:smallIndexBuffer=true;smallVertexBuffer=false;smallInstanceBuffer=true +webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:smallIndexBuffer=true;smallVertexBuffer=true;smallInstanceBuffer=false +webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:smallIndexBuffer=true;smallVertexBuffer=true;smallInstanceBuffer=true +webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:bufferSizeInElements=10;bindingSizeInElements=10;drawIndexCount=10;drawType="drawIndexed" +webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:bufferSizeInElements=10;bindingSizeInElements=10;drawIndexCount=10;drawType="drawIndexedIndirect" +webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:bufferSizeInElements=10;bindingSizeInElements=10;drawIndexCount=11;drawType="drawIndexed" +webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:bufferSizeInElements=10;bindingSizeInElements=10;drawIndexCount=11;drawType="drawIndexedIndirect" +webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:bufferSizeInElements=100;bindingSizeInElements=10;drawIndexCount=10;drawType="drawIndexed" +webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:bufferSizeInElements=100;bindingSizeInElements=10;drawIndexCount=10;drawType="drawIndexedIndirect" +webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:bufferSizeInElements=100;bindingSizeInElements=10;drawIndexCount=11;drawType="drawIndexed" +webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:bufferSizeInElements=100;bindingSizeInElements=10;drawIndexCount=11;drawType="drawIndexedIndirect" +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="draw";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexed";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="zero";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="exile";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="zero";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="exile";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=false;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=false;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="zero";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="exact";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=0 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=1 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=2 +webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:type="drawIndexedIndirect";VBSize="enough";IBSize="enough";VStride0=true;IStride0=true;AStride="oversize";offset=7 +webgpu:api,validation,encoding,cmds,render,draw:buffer_binding_overlap:drawType="draw" +webgpu:api,validation,encoding,cmds,render,draw:buffer_binding_overlap:drawType="drawIndexed" +webgpu:api,validation,encoding,cmds,render,draw:buffer_binding_overlap:drawType="drawIndirect" +webgpu:api,validation,encoding,cmds,render,draw:buffer_binding_overlap:drawType="drawIndexedIndirect" +webgpu:api,validation,encoding,cmds,render,draw:last_buffer_setting_take_account: +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=false;bundleSecondHalf=false;maxDrawCount=0 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=false;bundleSecondHalf=false;maxDrawCount=1 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=false;bundleSecondHalf=false;maxDrawCount=4 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=false;bundleSecondHalf=false;maxDrawCount=16 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=false;bundleSecondHalf=true;maxDrawCount=0 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=false;bundleSecondHalf=true;maxDrawCount=1 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=false;bundleSecondHalf=true;maxDrawCount=4 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=false;bundleSecondHalf=true;maxDrawCount=16 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=true;bundleSecondHalf=false;maxDrawCount=0 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=true;bundleSecondHalf=false;maxDrawCount=1 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=true;bundleSecondHalf=false;maxDrawCount=4 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=true;bundleSecondHalf=false;maxDrawCount=16 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=true;bundleSecondHalf=true;maxDrawCount=0 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=true;bundleSecondHalf=true;maxDrawCount=1 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=true;bundleSecondHalf=true;maxDrawCount=4 +webgpu:api,validation,encoding,cmds,render,draw:max_draw_count:bundleFirstHalf=true;bundleSecondHalf=true;maxDrawCount=16 +webgpu:api,validation,encoding,cmds,render,dynamic_state:setViewport,x_y_width_height_nonnegative: +webgpu:api,validation,encoding,cmds,render,dynamic_state:setViewport,xy_rect_contained_in_attachment: +webgpu:api,validation,encoding,cmds,render,dynamic_state:setViewport,depth_rangeAndOrder: +webgpu:api,validation,encoding,cmds,render,dynamic_state:setScissorRect,x_y_width_height_nonnegative: +webgpu:api,validation,encoding,cmds,render,dynamic_state:setScissorRect,xy_rect_contained_in_attachment: +webgpu:api,validation,encoding,cmds,render,dynamic_state:setBlendConstant: +webgpu:api,validation,encoding,cmds,render,dynamic_state:setStencilReference: +webgpu:api,validation,encoding,cmds,render,indirect_draw:indirect_buffer_state: +webgpu:api,validation,encoding,cmds,render,indirect_draw:indirect_buffer,device_mismatch: +webgpu:api,validation,encoding,cmds,render,indirect_draw:indirect_buffer_usage: +webgpu:api,validation,encoding,cmds,render,indirect_draw:indirect_offset_alignment: +webgpu:api,validation,encoding,cmds,render,indirect_draw:indirect_offset_oob: +webgpu:api,validation,encoding,cmds,render,setIndexBuffer:index_buffer_state: +webgpu:api,validation,encoding,cmds,render,setIndexBuffer:index_buffer,device_mismatch: +webgpu:api,validation,encoding,cmds,render,setIndexBuffer:index_buffer_usage: +webgpu:api,validation,encoding,cmds,render,setIndexBuffer:offset_alignment: +webgpu:api,validation,encoding,cmds,render,setIndexBuffer:offset_and_size_oob: +webgpu:api,validation,encoding,cmds,render,setPipeline:invalid_pipeline: +webgpu:api,validation,encoding,cmds,render,setPipeline:pipeline,device_mismatch: +webgpu:api,validation,encoding,cmds,render,setVertexBuffer:slot: +webgpu:api,validation,encoding,cmds,render,setVertexBuffer:vertex_buffer_state: +webgpu:api,validation,encoding,cmds,render,setVertexBuffer:vertex_buffer,device_mismatch: +webgpu:api,validation,encoding,cmds,render,setVertexBuffer:vertex_buffer_usage: +webgpu:api,validation,encoding,cmds,render,setVertexBuffer:offset_alignment: +webgpu:api,validation,encoding,cmds,render,setVertexBuffer:offset_and_size_oob: +webgpu:api,validation,encoding,cmds,render,state_tracking:all_needed_vertex_buffer_should_be_bound: +webgpu:api,validation,encoding,cmds,render,state_tracking:all_needed_index_buffer_should_be_bound: +webgpu:api,validation,encoding,cmds,render,state_tracking:vertex_buffers_inherit_from_previous_pipeline: +webgpu:api,validation,encoding,cmds,render,state_tracking:vertex_buffers_do_not_inherit_between_render_passes: +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="compute%20pass";state="valid";resourceType="buffer" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="compute%20pass";state="valid";resourceType="texture" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="compute%20pass";state="invalid";resourceType="buffer" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="compute%20pass";state="invalid";resourceType="texture" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="compute%20pass";state="destroyed";resourceType="buffer" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="compute%20pass";state="destroyed";resourceType="texture" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20pass";state="valid";resourceType="buffer" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20pass";state="valid";resourceType="texture" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20pass";state="invalid";resourceType="buffer" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20pass";state="invalid";resourceType="texture" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20pass";state="destroyed";resourceType="buffer" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20pass";state="destroyed";resourceType="texture" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20bundle";state="valid";resourceType="buffer" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20bundle";state="valid";resourceType="texture" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20bundle";state="invalid";resourceType="buffer" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20bundle";state="invalid";resourceType="texture" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20bundle";state="destroyed";resourceType="buffer" +webgpu:api,validation,encoding,cmds,setBindGroup:state_and_binding_index:encoderType="render%20bundle";state="destroyed";resourceType="texture" +webgpu:api,validation,encoding,cmds,setBindGroup:bind_group,device_mismatch:encoderType="compute%20pass" +webgpu:api,validation,encoding,cmds,setBindGroup:bind_group,device_mismatch:encoderType="render%20pass" +webgpu:api,validation,encoding,cmds,setBindGroup:bind_group,device_mismatch:encoderType="render%20bundle" +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_passed_but_not_expected:encoderType="compute%20pass" +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_passed_but_not_expected:encoderType="render%20pass" +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_passed_but_not_expected:encoderType="render%20bundle" +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[256,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[256,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[1,2];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[1,2];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[256,0,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[256,0,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[256];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[256];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[512,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[512,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[1024,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[1024,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[4294967295,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[4294967295,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[0,512];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[0,512];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[0,1024];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[0,1024];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[0,4294967295];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="compute%20pass";dynamicOffsets=[0,4294967295];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[256,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[256,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[1,2];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[1,2];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[256,0,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[256,0,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[256];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[256];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[512,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[512,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[1024,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[1024,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[4294967295,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[4294967295,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[0,512];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[0,512];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[0,1024];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[0,1024];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[0,4294967295];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20pass";dynamicOffsets=[0,4294967295];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[256,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[256,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[1,2];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[1,2];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[256,0,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[256,0,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[256];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[256];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[512,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[512,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[1024,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[1024,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[4294967295,0];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[4294967295,0];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[0,512];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[0,512];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[0,1024];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[0,1024];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[0,4294967295];useU32array=false +webgpu:api,validation,encoding,cmds,setBindGroup:dynamic_offsets_match_expectations_in_pass_encoder:encoderType="render%20bundle";dynamicOffsets=[0,4294967295];useU32array=true +webgpu:api,validation,encoding,cmds,setBindGroup:u32array_start_and_length: +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=0 +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=1 +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=2 +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=3 +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=4 +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=5 +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=6 +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=7 +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=8 +webgpu:api,validation,encoding,createRenderBundleEncoder:attachment_state:colorFormatCount=9 +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r8unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r8snorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r8uint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r8sint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r16uint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r16sint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r16float" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg8unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg8snorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg8uint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg8sint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r32uint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r32sint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="r32float" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg16uint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg16sint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg16float" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba8unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba8unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba8snorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba8uint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba8sint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bgra8unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bgra8unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgb10a2unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg11b10ufloat" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgb9e5ufloat" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg32uint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg32sint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rg32float" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba16uint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba16sint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba16float" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba32uint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba32sint" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="rgba32float" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="depth32float" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="depth16unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="stencil8" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="depth24plus" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="depth24plus-stencil8" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="depth32float-stencil8" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc1-rgba-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc1-rgba-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc2-rgba-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc2-rgba-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc3-rgba-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc3-rgba-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc4-r-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc4-r-snorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc5-rg-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc5-rg-snorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc6h-rgb-ufloat" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc6h-rgb-float" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc7-rgba-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="bc7-rgba-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="etc2-rgb8unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="etc2-rgb8unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="etc2-rgb8a1unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="etc2-rgba8unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="etc2-rgba8unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="eac-r11unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="eac-r11snorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="eac-rg11unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="eac-rg11snorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-4x4-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-4x4-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-5x4-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-5x4-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-5x5-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-5x5-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-6x5-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-6x5-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-6x6-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-6x6-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-8x5-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-8x5-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-8x6-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-8x6-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-8x8-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-8x8-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-10x5-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-10x5-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-10x6-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-10x6-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-10x8-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-10x8-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-10x10-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-10x10-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-12x10-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-12x10-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-12x12-unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:valid_texture_formats:format="astc-12x12-unorm-srgb" +webgpu:api,validation,encoding,createRenderBundleEncoder:depth_stencil_readonly:depthStencilFormat="depth32float" +webgpu:api,validation,encoding,createRenderBundleEncoder:depth_stencil_readonly:depthStencilFormat="depth16unorm" +webgpu:api,validation,encoding,createRenderBundleEncoder:depth_stencil_readonly:depthStencilFormat="stencil8" +webgpu:api,validation,encoding,createRenderBundleEncoder:depth_stencil_readonly:depthStencilFormat="depth24plus" +webgpu:api,validation,encoding,createRenderBundleEncoder:depth_stencil_readonly:depthStencilFormat="depth24plus-stencil8" +webgpu:api,validation,encoding,createRenderBundleEncoder:depth_stencil_readonly:depthStencilFormat="depth32float-stencil8" +webgpu:api,validation,encoding,createRenderBundleEncoder:depth_stencil_readonly_with_undefined_depth: +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="compute%20pass";call="dispatch";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="compute%20pass";call="dispatch";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="compute%20pass";call="dispatchIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="compute%20pass";call="dispatchIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";call="draw";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";call="draw";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";call="drawIndexed";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";call="drawIndexed";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";call="drawIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";call="drawIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";call="drawIndexedIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";call="drawIndexedIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20bundle";call="draw";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20bundle";call="draw";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20bundle";call="drawIndexed";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20bundle";call="drawIndexed";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20bundle";call="drawIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20bundle";call="drawIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20bundle";call="drawIndexedIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20bundle";call="drawIndexedIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:buffer_binding,render_pipeline:type="uniform" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:buffer_binding,render_pipeline:type="storage" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:buffer_binding,render_pipeline:type="read-only-storage" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:bglType="filtering";bgType="filtering" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:bglType="filtering";bgType="non-filtering" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:bglType="filtering";bgType="comparison" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:bglType="non-filtering";bgType="filtering" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:bglType="non-filtering";bgType="non-filtering" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:bglType="non-filtering";bgType="comparison" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:bglType="comparison";bgType="filtering" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:bglType="comparison";bgType="non-filtering" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:bglType="comparison";bgType="comparison" +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="compute%20pass";call="dispatch";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="compute%20pass";call="dispatch";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="compute%20pass";call="dispatchIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="compute%20pass";call="dispatchIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20pass";call="draw";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20pass";call="draw";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20pass";call="drawIndexed";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20pass";call="drawIndexed";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20pass";call="drawIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20pass";call="drawIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20pass";call="drawIndexedIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20pass";call="drawIndexedIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20bundle";call="draw";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20bundle";call="draw";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20bundle";call="drawIndexed";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20bundle";call="drawIndexed";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20bundle";call="drawIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20bundle";call="drawIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20bundle";call="drawIndexedIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20bundle";call="drawIndexedIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="compute%20pass";call="dispatch";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="compute%20pass";call="dispatch";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="compute%20pass";call="dispatchIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="compute%20pass";call="dispatchIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20pass";call="draw";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20pass";call="draw";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20pass";call="drawIndexed";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20pass";call="drawIndexed";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20pass";call="drawIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20pass";call="drawIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20pass";call="drawIndexedIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20pass";call="drawIndexedIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20bundle";call="draw";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20bundle";call="draw";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20bundle";call="drawIndexed";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20bundle";call="drawIndexed";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20bundle";call="drawIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20bundle";call="drawIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20bundle";call="drawIndexedIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20bundle";call="drawIndexedIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="compute%20pass";call="dispatch";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="compute%20pass";call="dispatch";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="compute%20pass";call="dispatchIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="compute%20pass";call="dispatchIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20pass";call="draw";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20pass";call="draw";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20pass";call="drawIndexed";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20pass";call="drawIndexed";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20pass";call="drawIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20pass";call="drawIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20pass";call="drawIndexedIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20pass";call="drawIndexedIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20bundle";call="draw";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20bundle";call="draw";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20bundle";call="drawIndexed";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20bundle";call="drawIndexed";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20bundle";call="drawIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20bundle";call="drawIndirect";callWithZero=false +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20bundle";call="drawIndexedIndirect";callWithZero=true +webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20bundle";call="drawIndexedIndirect";callWithZero=false +webgpu:api,validation,encoding,queries,begin_end:occlusion_query,begin_end_balance: +webgpu:api,validation,encoding,queries,begin_end:occlusion_query,begin_end_invalid_nesting: +webgpu:api,validation,encoding,queries,begin_end:occlusion_query,disjoint_queries_with_same_query_index: +webgpu:api,validation,encoding,queries,begin_end:nesting: +webgpu:api,validation,encoding,queries,general:occlusion_query,query_type:type="_undef_" +webgpu:api,validation,encoding,queries,general:occlusion_query,query_type:type="occlusion" +webgpu:api,validation,encoding,queries,general:occlusion_query,query_type:type="timestamp" +webgpu:api,validation,encoding,queries,general:occlusion_query,invalid_query_set: +webgpu:api,validation,encoding,queries,general:occlusion_query,query_index: +webgpu:api,validation,encoding,queries,general:timestamp_query,query_type_and_index:type="occlusion" +webgpu:api,validation,encoding,queries,general:timestamp_query,query_type_and_index:type="timestamp" +webgpu:api,validation,encoding,queries,general:timestamp_query,invalid_query_set: +webgpu:api,validation,encoding,queries,general:timestamp_query,device_mismatch: +webgpu:api,validation,encoding,queries,resolveQuerySet:queryset_and_destination_buffer_state:querySetState="valid";destinationState="valid" +webgpu:api,validation,encoding,queries,resolveQuerySet:queryset_and_destination_buffer_state:querySetState="valid";destinationState="invalid" +webgpu:api,validation,encoding,queries,resolveQuerySet:queryset_and_destination_buffer_state:querySetState="valid";destinationState="destroyed" +webgpu:api,validation,encoding,queries,resolveQuerySet:queryset_and_destination_buffer_state:querySetState="invalid";destinationState="valid" +webgpu:api,validation,encoding,queries,resolveQuerySet:queryset_and_destination_buffer_state:querySetState="invalid";destinationState="invalid" +webgpu:api,validation,encoding,queries,resolveQuerySet:queryset_and_destination_buffer_state:querySetState="invalid";destinationState="destroyed" +webgpu:api,validation,encoding,queries,resolveQuerySet:queryset_and_destination_buffer_state:querySetState="destroyed";destinationState="valid" +webgpu:api,validation,encoding,queries,resolveQuerySet:queryset_and_destination_buffer_state:querySetState="destroyed";destinationState="invalid" +webgpu:api,validation,encoding,queries,resolveQuerySet:queryset_and_destination_buffer_state:querySetState="destroyed";destinationState="destroyed" +webgpu:api,validation,encoding,queries,resolveQuerySet:first_query_and_query_count: +webgpu:api,validation,encoding,queries,resolveQuerySet:destination_buffer_usage: +webgpu:api,validation,encoding,queries,resolveQuerySet:destination_offset_alignment: +webgpu:api,validation,encoding,queries,resolveQuerySet:resolve_buffer_oob: +webgpu:api,validation,encoding,queries,resolveQuerySet:query_set_buffer,device_mismatch: +webgpu:api,validation,encoding,render_bundle:empty_bundle_list: +webgpu:api,validation,encoding,render_bundle:device_mismatch: +webgpu:api,validation,encoding,render_bundle:color_formats_mismatch:bundleFormats=["bgra8unorm","rg8unorm"];passFormats=["bgra8unorm","rg8unorm"] +webgpu:api,validation,encoding,render_bundle:color_formats_mismatch:bundleFormats=["bgra8unorm","rg8unorm"];passFormats=["bgra8unorm","bgra8unorm"] +webgpu:api,validation,encoding,render_bundle:color_formats_mismatch:bundleFormats=["bgra8unorm","rg8unorm"];passFormats=["rg8unorm","bgra8unorm"] +webgpu:api,validation,encoding,render_bundle:color_formats_mismatch:bundleFormats=["bgra8unorm","rg8unorm"];passFormats=["rg8unorm","bgra8unorm","rgba8unorm"] +webgpu:api,validation,encoding,render_bundle:color_formats_mismatch:bundleFormats=["bgra8unorm","rg8unorm","rgba8unorm"];passFormats=["rg8unorm","bgra8unorm"] +webgpu:api,validation,encoding,render_bundle:depth_stencil_formats_mismatch:bundleFormat="depth24plus";passFormat="depth24plus" +webgpu:api,validation,encoding,render_bundle:depth_stencil_formats_mismatch:bundleFormat="depth24plus";passFormat="depth16unorm" +webgpu:api,validation,encoding,render_bundle:depth_stencil_formats_mismatch:bundleFormat="depth24plus";passFormat="depth24plus-stencil8" +webgpu:api,validation,encoding,render_bundle:depth_stencil_formats_mismatch:bundleFormat="stencil8";passFormat="depth24plus-stencil8" +webgpu:api,validation,encoding,render_bundle:depth_stencil_readonly_mismatch:depthStencilFormat="depth32float" +webgpu:api,validation,encoding,render_bundle:depth_stencil_readonly_mismatch:depthStencilFormat="depth16unorm" +webgpu:api,validation,encoding,render_bundle:depth_stencil_readonly_mismatch:depthStencilFormat="stencil8" +webgpu:api,validation,encoding,render_bundle:depth_stencil_readonly_mismatch:depthStencilFormat="depth24plus" +webgpu:api,validation,encoding,render_bundle:depth_stencil_readonly_mismatch:depthStencilFormat="depth24plus-stencil8" +webgpu:api,validation,encoding,render_bundle:depth_stencil_readonly_mismatch:depthStencilFormat="depth32float-stencil8" +webgpu:api,validation,encoding,render_bundle:sample_count_mismatch:bundleSamples=1;passSamples=1 +webgpu:api,validation,encoding,render_bundle:sample_count_mismatch:bundleSamples=4;passSamples=4 +webgpu:api,validation,encoding,render_bundle:sample_count_mismatch:bundleFormat=4;passFormat=1 +webgpu:api,validation,encoding,render_bundle:sample_count_mismatch:bundleFormat=1;passFormat=4 +webgpu:api,validation,error_scope:simple:errorType="out-of-memory";errorFilter="out-of-memory" +webgpu:api,validation,error_scope:simple:errorType="out-of-memory";errorFilter="validation" +webgpu:api,validation,error_scope:simple:errorType="validation";errorFilter="out-of-memory" +webgpu:api,validation,error_scope:simple:errorType="validation";errorFilter="validation" +webgpu:api,validation,error_scope:empty: +webgpu:api,validation,error_scope:parent_scope:errorFilter="out-of-memory";stackDepth=1 +webgpu:api,validation,error_scope:parent_scope:errorFilter="out-of-memory";stackDepth=10 +webgpu:api,validation,error_scope:parent_scope:errorFilter="out-of-memory";stackDepth=100 +webgpu:api,validation,error_scope:parent_scope:errorFilter="out-of-memory";stackDepth=1000 +webgpu:api,validation,error_scope:parent_scope:errorFilter="validation";stackDepth=1 +webgpu:api,validation,error_scope:parent_scope:errorFilter="validation";stackDepth=10 +webgpu:api,validation,error_scope:parent_scope:errorFilter="validation";stackDepth=100 +webgpu:api,validation,error_scope:parent_scope:errorFilter="validation";stackDepth=1000 +webgpu:api,validation,error_scope:current_scope:errorFilter="out-of-memory";stackDepth=1 +webgpu:api,validation,error_scope:current_scope:errorFilter="out-of-memory";stackDepth=10 +webgpu:api,validation,error_scope:current_scope:errorFilter="out-of-memory";stackDepth=100 +webgpu:api,validation,error_scope:current_scope:errorFilter="out-of-memory";stackDepth=1000 +webgpu:api,validation,error_scope:current_scope:errorFilter="out-of-memory";stackDepth=100000 +webgpu:api,validation,error_scope:current_scope:errorFilter="validation";stackDepth=1 +webgpu:api,validation,error_scope:current_scope:errorFilter="validation";stackDepth=10 +webgpu:api,validation,error_scope:current_scope:errorFilter="validation";stackDepth=100 +webgpu:api,validation,error_scope:current_scope:errorFilter="validation";stackDepth=1000 +webgpu:api,validation,error_scope:current_scope:errorFilter="validation";stackDepth=100000 +webgpu:api,validation,error_scope:balanced_siblings:errorFilter="out-of-memory";numErrors=1 +webgpu:api,validation,error_scope:balanced_siblings:errorFilter="out-of-memory";numErrors=10 +webgpu:api,validation,error_scope:balanced_siblings:errorFilter="out-of-memory";numErrors=100 +webgpu:api,validation,error_scope:balanced_siblings:errorFilter="out-of-memory";numErrors=1000 +webgpu:api,validation,error_scope:balanced_siblings:errorFilter="validation";numErrors=1 +webgpu:api,validation,error_scope:balanced_siblings:errorFilter="validation";numErrors=10 +webgpu:api,validation,error_scope:balanced_siblings:errorFilter="validation";numErrors=100 +webgpu:api,validation,error_scope:balanced_siblings:errorFilter="validation";numErrors=1000 +webgpu:api,validation,error_scope:balanced_nesting:errorFilter="out-of-memory";numErrors=1 +webgpu:api,validation,error_scope:balanced_nesting:errorFilter="out-of-memory";numErrors=10 +webgpu:api,validation,error_scope:balanced_nesting:errorFilter="out-of-memory";numErrors=100 +webgpu:api,validation,error_scope:balanced_nesting:errorFilter="out-of-memory";numErrors=1000 +webgpu:api,validation,error_scope:balanced_nesting:errorFilter="validation";numErrors=1 +webgpu:api,validation,error_scope:balanced_nesting:errorFilter="validation";numErrors=10 +webgpu:api,validation,error_scope:balanced_nesting:errorFilter="validation";numErrors=100 +webgpu:api,validation,error_scope:balanced_nesting:errorFilter="validation";numErrors=1000 +webgpu:api,validation,image_copy,buffer_related:buffer_state:method="CopyB2T";state="valid" +webgpu:api,validation,image_copy,buffer_related:buffer_state:method="CopyB2T";state="invalid" +webgpu:api,validation,image_copy,buffer_related:buffer_state:method="CopyB2T";state="destroyed" +webgpu:api,validation,image_copy,buffer_related:buffer_state:method="CopyT2B";state="valid" +webgpu:api,validation,image_copy,buffer_related:buffer_state:method="CopyT2B";state="invalid" +webgpu:api,validation,image_copy,buffer_related:buffer_state:method="CopyT2B";state="destroyed" +webgpu:api,validation,image_copy,buffer_related:buffer,device_mismatch: +webgpu:api,validation,image_copy,buffer_related:usage:method="CopyB2T" +webgpu:api,validation,image_copy,buffer_related:usage:method="CopyT2B" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="WriteTexture";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyB2T";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="depth32float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,buffer_related:bytes_per_row_alignment:method="CopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_usage_and_aspect:format="depth32float" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_usage_and_aspect:format="depth16unorm" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_usage_and_aspect:format="stencil8" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_usage_and_aspect:format="depth24plus" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_usage_and_aspect:format="depth24plus-stencil8" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_usage_and_aspect:format="depth32float-stencil8" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth32float";aspect="depth-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth16unorm";aspect="depth-only";copyType="CopyB2T" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth16unorm";aspect="depth-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth16unorm";aspect="depth-only";copyType="WriteTexture" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="stencil8";aspect="stencil-only";copyType="CopyB2T" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="stencil8";aspect="stencil-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="stencil8";aspect="stencil-only";copyType="WriteTexture" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth24plus-stencil8";aspect="stencil-only";copyType="CopyB2T" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth24plus-stencil8";aspect="stencil-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth24plus-stencil8";aspect="stencil-only";copyType="WriteTexture" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth32float-stencil8";aspect="depth-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth32float-stencil8";aspect="stencil-only";copyType="CopyB2T" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth32float-stencil8";aspect="stencil-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_size:format="depth32float-stencil8";aspect="stencil-only";copyType="WriteTexture" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth32float";aspect="depth-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth16unorm";aspect="depth-only";copyType="CopyB2T" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth16unorm";aspect="depth-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth16unorm";aspect="depth-only";copyType="WriteTexture" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="stencil8";aspect="stencil-only";copyType="CopyB2T" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="stencil8";aspect="stencil-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="stencil8";aspect="stencil-only";copyType="WriteTexture" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth24plus-stencil8";aspect="stencil-only";copyType="CopyB2T" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth24plus-stencil8";aspect="stencil-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth24plus-stencil8";aspect="stencil-only";copyType="WriteTexture" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth32float-stencil8";aspect="depth-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth32float-stencil8";aspect="stencil-only";copyType="CopyB2T" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth32float-stencil8";aspect="stencil-only";copyType="CopyT2B" +webgpu:api,validation,image_copy,buffer_texture_copies:depth_stencil_format,copy_buffer_offset:format="depth32float-stencil8";aspect="stencil-only";copyType="WriteTexture" +webgpu:api,validation,image_copy,buffer_texture_copies:sample_count:copyType="CopyB2T" +webgpu:api,validation,image_copy,buffer_texture_copies:sample_count:copyType="CopyT2B" +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="WriteTexture";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="WriteTexture";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="WriteTexture";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="WriteTexture";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="CopyB2T";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="CopyB2T";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="CopyB2T";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="CopyB2T";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="CopyT2B";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="CopyT2B";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="CopyT2B";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,layout_related:bound_on_rows_per_image:method="CopyT2B";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,layout_related:copy_end_overflows_u64:method="WriteTexture" +webgpu:api,validation,image_copy,layout_related:copy_end_overflows_u64:method="CopyB2T" +webgpu:api,validation,image_copy,layout_related:copy_end_overflows_u64:method="CopyT2B" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="WriteTexture";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyB2T";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="depth32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:method="CopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="WriteTexture";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyB2T";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="depth32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:rows_per_image_alignment:method="CopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="WriteTexture";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyB2T";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="depth32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:offset_alignment:method="CopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="WriteTexture";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyB2T";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="depth32float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="depth16unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="stencil8";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_bytes_per_row:method="CopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,layout_related:bound_on_offset:method="WriteTexture" +webgpu:api,validation,image_copy,layout_related:bound_on_offset:method="CopyB2T" +webgpu:api,validation,image_copy,layout_related:bound_on_offset:method="CopyT2B" +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="valid";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="valid";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="valid";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="valid";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="invalid";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="invalid";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="invalid";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="invalid";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="destroyed";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="destroyed";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="destroyed";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="WriteTexture";textureState="destroyed";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="valid";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="valid";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="valid";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="valid";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="invalid";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="invalid";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="invalid";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="invalid";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="destroyed";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="destroyed";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="destroyed";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyB2T";textureState="destroyed";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="valid";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="valid";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="valid";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="valid";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="invalid";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="invalid";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="invalid";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="invalid";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="destroyed";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="destroyed";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="destroyed";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:valid:method="CopyT2B";textureState="destroyed";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:texture,device_mismatch: +webgpu:api,validation,image_copy,texture_related:usage:method="WriteTexture";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:usage:method="WriteTexture";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:usage:method="WriteTexture";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:usage:method="WriteTexture";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:usage:method="CopyB2T";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:usage:method="CopyB2T";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:usage:method="CopyB2T";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:usage:method="CopyB2T";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:usage:method="CopyT2B";dimension="1d";size=[4,1,1] +webgpu:api,validation,image_copy,texture_related:usage:method="CopyT2B";dimension="2d";size=[4,4,1] +webgpu:api,validation,image_copy,texture_related:usage:method="CopyT2B";dimension="2d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:usage:method="CopyT2B";dimension="3d";size=[4,4,3] +webgpu:api,validation,image_copy,texture_related:sample_count:method="WriteTexture" +webgpu:api,validation,image_copy,texture_related:sample_count:method="CopyB2T" +webgpu:api,validation,image_copy,texture_related:sample_count:method="CopyT2B" +webgpu:api,validation,image_copy,texture_related:mip_level:method="WriteTexture";dimension="1d";size=[32,1,1] +webgpu:api,validation,image_copy,texture_related:mip_level:method="WriteTexture";dimension="2d";size=[32,32,1] +webgpu:api,validation,image_copy,texture_related:mip_level:method="WriteTexture";dimension="2d";size=[32,32,3] +webgpu:api,validation,image_copy,texture_related:mip_level:method="WriteTexture";dimension="3d";size=[32,32,3] +webgpu:api,validation,image_copy,texture_related:mip_level:method="CopyB2T";dimension="1d";size=[32,1,1] +webgpu:api,validation,image_copy,texture_related:mip_level:method="CopyB2T";dimension="2d";size=[32,32,1] +webgpu:api,validation,image_copy,texture_related:mip_level:method="CopyB2T";dimension="2d";size=[32,32,3] +webgpu:api,validation,image_copy,texture_related:mip_level:method="CopyB2T";dimension="3d";size=[32,32,3] +webgpu:api,validation,image_copy,texture_related:mip_level:method="CopyT2B";dimension="1d";size=[32,1,1] +webgpu:api,validation,image_copy,texture_related:mip_level:method="CopyT2B";dimension="2d";size=[32,32,1] +webgpu:api,validation,image_copy,texture_related:mip_level:method="CopyT2B";dimension="2d";size=[32,32,3] +webgpu:api,validation,image_copy,texture_related:mip_level:method="CopyT2B";dimension="3d";size=[32,32,3] +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="1d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="depth16unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="stencil8" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="eac-r11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="eac-r11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=1;dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="depth16unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="stencil8" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="eac-r11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="eac-r11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=3;dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="WriteTexture";depthOrArrayLayers=32;dimension="3d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="1d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="depth16unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="stencil8" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="eac-r11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="eac-r11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=1;dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="depth16unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="stencil8" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="eac-r11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="eac-r11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=3;dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyB2T";depthOrArrayLayers=32;dimension="3d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="1d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="depth32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="depth16unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="stencil8" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="eac-r11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="eac-r11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=1;dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="depth32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="depth16unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="stencil8" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc1-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc1-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc2-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc2-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc3-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc3-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc4-r-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc4-r-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc5-rg-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc5-rg-snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc6h-rgb-ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc6h-rgb-float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc7-rgba-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="bc7-rgba-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8a1unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="etc2-rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="etc2-rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="eac-r11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="eac-r11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="eac-rg11unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="eac-rg11snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-4x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-4x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-5x4-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-5x4-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-5x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-5x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-6x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-6x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-6x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-6x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-8x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-8x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-8x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-8x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-8x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-8x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-10x5-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-10x5-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-10x6-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-10x6-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-10x8-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-10x8-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-10x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-10x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-12x10-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-12x10-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-12x12-unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=3;dimension="2d";format="astc-12x12-unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="r32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba8snorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba8uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba8sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="bgra8unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="bgra8unorm-srgb" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgb10a2unorm" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg11b10ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgb9e5ufloat" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rg32float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba16uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba16sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba16float" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba32uint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba32sint" +webgpu:api,validation,image_copy,texture_related:format:method="CopyT2B";depthOrArrayLayers=32;dimension="3d";format="rgba32float" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8snorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8snorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r8sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r16float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8snorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8snorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg8sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="r32float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg16float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8unorm-srgb";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8unorm-srgb";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8snorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8snorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba8sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bgra8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bgra8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bgra8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bgra8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bgra8unorm-srgb";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bgra8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bgra8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bgra8unorm-srgb";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgb10a2unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgb10a2unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgb10a2unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgb10a2unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg11b10ufloat";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg11b10ufloat";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg11b10ufloat";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg11b10ufloat";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgb9e5ufloat";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgb9e5ufloat";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgb9e5ufloat";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgb9e5ufloat";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rg32float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba16float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="rgba32float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc1-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc1-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc1-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc1-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc2-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc2-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc2-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc2-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc3-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc3-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc3-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc3-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc4-r-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc4-r-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc4-r-snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc4-r-snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc5-rg-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc5-rg-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc5-rg-snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc5-rg-snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc6h-rgb-ufloat";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc6h-rgb-ufloat";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc6h-rgb-float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc6h-rgb-float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc7-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc7-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc7-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="bc7-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgb8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgb8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgb8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgb8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgb8a1unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgb8a1unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgb8a1unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgb8a1unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgba8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgba8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgba8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="etc2-rgba8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="eac-r11unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="eac-r11unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="eac-r11snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="eac-r11snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="eac-rg11unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="eac-rg11unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="eac-rg11snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="eac-rg11snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-4x4-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-4x4-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-4x4-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-4x4-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-5x4-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-5x4-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-5x4-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-5x4-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-5x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-5x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-5x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-5x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-6x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-6x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-6x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-6x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-6x6-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-6x6-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-6x6-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-6x6-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x6-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x6-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x6-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x6-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x8-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x8-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x8-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-8x8-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x6-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x6-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x6-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x6-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x8-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x8-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x8-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x8-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x10-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x10-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x10-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-10x10-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-12x10-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-12x10-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-12x10-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-12x10-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-12x12-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-12x12-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-12x12-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="WriteTexture";format="astc-12x12-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8snorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8snorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r8sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r16float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8snorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8snorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg8sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="r32float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg16float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8unorm-srgb";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8unorm-srgb";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8snorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8snorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba8sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bgra8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bgra8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bgra8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bgra8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bgra8unorm-srgb";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bgra8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bgra8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bgra8unorm-srgb";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgb10a2unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgb10a2unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgb10a2unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgb10a2unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg11b10ufloat";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg11b10ufloat";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg11b10ufloat";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg11b10ufloat";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgb9e5ufloat";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgb9e5ufloat";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgb9e5ufloat";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgb9e5ufloat";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rg32float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba16float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="rgba32float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc1-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc1-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc1-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc1-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc2-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc2-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc2-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc2-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc3-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc3-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc3-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc3-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc4-r-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc4-r-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc4-r-snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc4-r-snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc5-rg-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc5-rg-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc5-rg-snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc5-rg-snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc6h-rgb-ufloat";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc6h-rgb-ufloat";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc6h-rgb-float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc6h-rgb-float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc7-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc7-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc7-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="bc7-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgb8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgb8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgb8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgb8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgb8a1unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgb8a1unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgb8a1unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgb8a1unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgba8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgba8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgba8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="etc2-rgba8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="eac-r11unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="eac-r11unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="eac-r11snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="eac-r11snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="eac-rg11unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="eac-rg11unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="eac-rg11snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="eac-rg11snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-4x4-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-4x4-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-4x4-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-4x4-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-5x4-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-5x4-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-5x4-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-5x4-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-5x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-5x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-5x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-5x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-6x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-6x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-6x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-6x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-6x6-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-6x6-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-6x6-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-6x6-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x6-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x6-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x6-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x6-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x8-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x8-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x8-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-8x8-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x6-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x6-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x6-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x6-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x8-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x8-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x8-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x8-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x10-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x10-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x10-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-10x10-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-12x10-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-12x10-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-12x10-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-12x10-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-12x12-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-12x12-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-12x12-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyB2T";format="astc-12x12-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8snorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8snorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r8sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r16float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8snorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8snorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg8sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="r32float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg16float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8unorm-srgb";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8unorm-srgb";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8snorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8snorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba8sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bgra8unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bgra8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bgra8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bgra8unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bgra8unorm-srgb";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bgra8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bgra8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bgra8unorm-srgb";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgb10a2unorm";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgb10a2unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgb10a2unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgb10a2unorm";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg11b10ufloat";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg11b10ufloat";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg11b10ufloat";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg11b10ufloat";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgb9e5ufloat";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgb9e5ufloat";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgb9e5ufloat";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgb9e5ufloat";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rg32float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba16float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32uint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32uint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32uint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32uint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32sint";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32sint";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32sint";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32sint";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32float";depthOrArrayLayers=1;dimension="1d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="rgba32float";depthOrArrayLayers=3;dimension="3d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc1-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc1-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc1-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc1-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc2-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc2-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc2-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc2-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc3-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc3-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc3-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc3-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc4-r-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc4-r-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc4-r-snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc4-r-snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc5-rg-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc5-rg-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc5-rg-snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc5-rg-snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc6h-rgb-ufloat";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc6h-rgb-ufloat";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc6h-rgb-float";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc6h-rgb-float";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc7-rgba-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc7-rgba-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc7-rgba-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="bc7-rgba-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgb8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgb8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgb8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgb8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgb8a1unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgb8a1unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgb8a1unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgb8a1unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgba8unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgba8unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgba8unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="etc2-rgba8unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="eac-r11unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="eac-r11unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="eac-r11snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="eac-r11snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="eac-rg11unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="eac-rg11unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="eac-rg11snorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="eac-rg11snorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-4x4-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-4x4-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-4x4-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-4x4-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-5x4-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-5x4-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-5x4-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-5x4-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-5x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-5x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-5x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-5x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-6x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-6x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-6x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-6x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-6x6-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-6x6-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-6x6-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-6x6-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x6-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x6-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x6-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x6-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x8-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x8-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x8-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-8x8-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x5-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x5-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x5-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x5-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x6-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x6-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x6-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x6-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x8-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x8-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x8-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x8-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x10-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x10-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x10-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-10x10-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-12x10-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-12x10-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-12x10-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-12x10-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-12x12-unorm";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-12x12-unorm";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-12x12-unorm-srgb";depthOrArrayLayers=1;dimension="2d" +webgpu:api,validation,image_copy,texture_related:origin_alignment:method="CopyT2B";format="astc-12x12-unorm-srgb";depthOrArrayLayers=3;dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="WriteTexture";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyB2T";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8snorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8snorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r8sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r16uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r16uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r16uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r16sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r16sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r16sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r16float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r16float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r16float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8snorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8snorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg8sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r32uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r32uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r32uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r32sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r32sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r32sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r32float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r32float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="r32float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg16uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg16uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg16uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg16sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg16sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg16sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg16float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg16float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg16float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8snorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8snorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba8sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bgra8unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bgra8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bgra8unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bgra8unorm-srgb";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgb10a2unorm";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg11b10ufloat";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgb9e5ufloat";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg32uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg32uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg32uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg32sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg32sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg32sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg32float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg32float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rg32float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba16uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba16uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba16uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba16sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba16sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba16sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba16float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba16float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba16float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba32uint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba32uint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba32uint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba32sint";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba32sint";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba32sint";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba32float";dimension="1d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba32float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="rgba32float";dimension="3d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc1-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc1-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc2-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc2-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc3-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc3-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc4-r-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc4-r-snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc5-rg-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc5-rg-snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc6h-rgb-ufloat";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc6h-rgb-float";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc7-rgba-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="bc7-rgba-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="etc2-rgb8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="etc2-rgb8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="etc2-rgb8a1unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="etc2-rgb8a1unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="etc2-rgba8unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="etc2-rgba8unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="eac-r11unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="eac-r11snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="eac-rg11unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="eac-rg11snorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-4x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-4x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-5x4-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-5x4-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-5x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-5x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-6x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-6x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-6x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-6x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-8x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-8x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-8x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-8x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-8x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-8x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-10x5-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-10x5-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-10x6-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-10x6-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-10x8-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-10x8-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-10x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-10x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-12x10-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-12x10-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-12x12-unorm";dimension="2d" +webgpu:api,validation,image_copy,texture_related:size_alignment:method="CopyT2B";format="astc-12x12-unorm-srgb";dimension="2d" +webgpu:api,validation,image_copy,texture_related:copy_rectangle:method="WriteTexture";dimension="1d" +webgpu:api,validation,image_copy,texture_related:copy_rectangle:method="WriteTexture";dimension="2d" +webgpu:api,validation,image_copy,texture_related:copy_rectangle:method="WriteTexture";dimension="3d" +webgpu:api,validation,image_copy,texture_related:copy_rectangle:method="CopyB2T";dimension="1d" +webgpu:api,validation,image_copy,texture_related:copy_rectangle:method="CopyB2T";dimension="2d" +webgpu:api,validation,image_copy,texture_related:copy_rectangle:method="CopyB2T";dimension="3d" +webgpu:api,validation,image_copy,texture_related:copy_rectangle:method="CopyT2B";dimension="1d" +webgpu:api,validation,image_copy,texture_related:copy_rectangle:method="CopyT2B";dimension="2d" +webgpu:api,validation,image_copy,texture_related:copy_rectangle:method="CopyT2B";dimension="3d" +webgpu:api,validation,initialization,requestDevice:features,nonexistent: +webgpu:api,validation,initialization,requestDevice:features,known_but_unavailable: +webgpu:api,validation,initialization,requestDevice:limits: +webgpu:api,validation,query_set,create:count:type="occlusion" +webgpu:api,validation,query_set,create:count:type="timestamp" +webgpu:api,validation,query_set,destroy:twice: +webgpu:api,validation,queue,buffer_mapped:writeBuffer: +webgpu:api,validation,queue,buffer_mapped:copyBufferToBuffer: +webgpu:api,validation,queue,buffer_mapped:copyBufferToTexture: +webgpu:api,validation,queue,buffer_mapped:copyTextureToBuffer: +webgpu:api,validation,queue,buffer_mapped:map_command_recording_order: +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,contexts:contextType="2d" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,contexts:contextType="bitmaprenderer" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,contexts:contextType="webgl" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,contexts:contextType="webgl2" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,contexts:contextType="webgpu" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,state:state="nocontext" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,state:state="placeholder-nocontext" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,state:state="placeholder-hascontext" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,state:state="valid" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_offscreenCanvas,contexts:contextType="2d" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_offscreenCanvas,contexts:contextType="bitmaprenderer" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_offscreenCanvas,contexts:contextType="webgl" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_offscreenCanvas,contexts:contextType="webgl2" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_offscreenCanvas,contexts:contextType="webgpu" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_offscreenCanvas,state:state="nocontext" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_offscreenCanvas,state:state="detached-nocontext" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_offscreenCanvas,state:state="detached-hascontext" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_offscreenCanvas,state:state="valid" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_image,crossOrigin:sourceImage="canvas";isOriginClean=true +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_image,crossOrigin:sourceImage="canvas";isOriginClean=false +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_image,crossOrigin:sourceImage="offscreenCanvas";isOriginClean=true +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_image,crossOrigin:sourceImage="offscreenCanvas";isOriginClean=false +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_image,crossOrigin:sourceImage="imageBitmap";isOriginClean=true +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_image,crossOrigin:sourceImage="imageBitmap";isOriginClean=false +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_imageBitmap,state:closed=false +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_imageBitmap,state:closed=true +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,state:state="valid" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,state:state="invalid" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,state:state="destroyed" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,device_mismatch: +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,usage:usage=1 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,usage:usage=2 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,usage:usage=4 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,usage:usage=8 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,usage:usage=16 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,sample_count:sampleCount=1 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,sample_count:sampleCount=4 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,dimension:dimension="1d" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,dimension:dimension="2d" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,dimension:dimension="3d" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,mipLevel:mipLevel=0 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,mipLevel:mipLevel=5 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,mipLevel:mipLevel=6 +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r8unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r8snorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r8uint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r8sint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r16uint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r16sint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r16float" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg8unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg8snorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg8uint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg8sint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r32uint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r32sint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="r32float" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg16uint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg16sint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg16float" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba8unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba8unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba8snorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba8uint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba8sint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bgra8unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bgra8unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgb10a2unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg11b10ufloat" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgb9e5ufloat" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg32uint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg32sint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rg32float" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba16uint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba16sint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba16float" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba32uint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba32sint" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="rgba32float" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="depth32float" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="depth16unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="stencil8" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="depth24plus" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="depth24plus-stencil8" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="depth32float-stencil8" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc1-rgba-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc1-rgba-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc2-rgba-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc2-rgba-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc3-rgba-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc3-rgba-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc4-r-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc4-r-snorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc5-rg-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc5-rg-snorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc6h-rgb-ufloat" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc6h-rgb-float" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc7-rgba-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="bc7-rgba-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="etc2-rgb8unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="etc2-rgb8unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="etc2-rgb8a1unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="etc2-rgba8unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="etc2-rgba8unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="eac-r11unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="eac-r11snorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="eac-rg11unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="eac-rg11snorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-4x4-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-4x4-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-5x4-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-5x4-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-5x5-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-5x5-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-6x5-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-6x5-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-6x6-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-6x6-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-8x5-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-8x5-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-8x6-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-8x6-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-8x8-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-8x8-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-10x5-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-10x5-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-10x6-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-10x6-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-10x8-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-10x8-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-10x10-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-10x10-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-12x10-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-12x10-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-12x12-unorm" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:destination_texture,format:format="astc-12x12-unorm-srgb" +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:OOB,source: +webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:OOB,destination: +webgpu:api,validation,queue,destroyed,query_set:beginOcclusionQuery: +webgpu:api,validation,queue,destroyed,query_set:writeTimestamp: +webgpu:api,validation,queue,destroyed,query_set:resolveQuerySet: +webgpu:api,validation,queue,submit:command_buffer,device_mismatch: +webgpu:api,validation,queue,writeBuffer:buffer_state:bufferState="valid" +webgpu:api,validation,queue,writeBuffer:buffer_state:bufferState="invalid" +webgpu:api,validation,queue,writeBuffer:buffer_state:bufferState="destroyed" +webgpu:api,validation,queue,writeBuffer:ranges: +webgpu:api,validation,queue,writeBuffer:usages: +webgpu:api,validation,queue,writeBuffer:buffer,device_mismatch: +webgpu:api,validation,queue,writeTexture:texture_state:textureState="valid" +webgpu:api,validation,queue,writeTexture:texture_state:textureState="invalid" +webgpu:api,validation,queue,writeTexture:texture_state:textureState="destroyed" +webgpu:api,validation,queue,writeTexture:usages: +webgpu:api,validation,queue,writeTexture:sample_count:sampleCount=1 +webgpu:api,validation,queue,writeTexture:sample_count:sampleCount=4 +webgpu:api,validation,queue,writeTexture:texture,device_mismatch:mismatched=true +webgpu:api,validation,queue,writeTexture:texture,device_mismatch:mismatched=false +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_format: +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_count: +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_sparse:attachmentCount=1 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_sparse:attachmentCount=2 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_sparse:attachmentCount=3 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_sparse:attachmentCount=4 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_sparse:attachmentCount=5 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_sparse:attachmentCount=6 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_sparse:attachmentCount=7 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,color_sparse:attachmentCount=8 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,depth_format:passFeature="_undef_";bundleFeature="_undef_" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,depth_format:passFeature="_undef_";bundleFeature="depth32float-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,depth_format:passFeature="depth32float-stencil8";bundleFeature="_undef_" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,depth_format:passFeature="depth32float-stencil8";bundleFeature="depth32float-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_and_bundle,sample_count: +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_format:encoderType="render%20pass" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_format:encoderType="render%20bundle" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_count:encoderType="render%20pass" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_count:encoderType="render%20bundle" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20pass";attachmentCount=1 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20pass";attachmentCount=2 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20pass";attachmentCount=3 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20pass";attachmentCount=4 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20pass";attachmentCount=5 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20pass";attachmentCount=6 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20pass";attachmentCount=7 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20pass";attachmentCount=8 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20bundle";attachmentCount=1 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20bundle";attachmentCount=2 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20bundle";attachmentCount=3 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20bundle";attachmentCount=4 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20bundle";attachmentCount=5 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20bundle";attachmentCount=6 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20bundle";attachmentCount=7 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,color_sparse:encoderType="render%20bundle";attachmentCount=8 +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_format:encoderType="render%20pass";encoderFormatFeature="_undef_";pipelineFormatFeature="_undef_" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_format:encoderType="render%20pass";encoderFormatFeature="_undef_";pipelineFormatFeature="depth32float-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_format:encoderType="render%20pass";encoderFormatFeature="depth32float-stencil8";pipelineFormatFeature="_undef_" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_format:encoderType="render%20pass";encoderFormatFeature="depth32float-stencil8";pipelineFormatFeature="depth32float-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_format:encoderType="render%20bundle";encoderFormatFeature="_undef_";pipelineFormatFeature="_undef_" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_format:encoderType="render%20bundle";encoderFormatFeature="_undef_";pipelineFormatFeature="depth32float-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_format:encoderType="render%20bundle";encoderFormatFeature="depth32float-stencil8";pipelineFormatFeature="_undef_" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_format:encoderType="render%20bundle";encoderFormatFeature="depth32float-stencil8";pipelineFormatFeature="depth32float-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20pass";format="_undef_" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20pass";format="depth32float" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20pass";format="depth16unorm" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20pass";format="stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20pass";format="depth24plus" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20pass";format="depth24plus-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20pass";format="depth32float-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20bundle";format="_undef_" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20bundle";format="depth32float" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20bundle";format="depth16unorm" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20bundle";format="stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20bundle";format="depth24plus" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20bundle";format="depth24plus-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,depth_stencil_read_only_write_state:encoderType="render%20bundle";format="depth32float-stencil8" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,sample_count:encoderType="render%20pass";attachmentType="color" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,sample_count:encoderType="render%20pass";attachmentType="depthstencil" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,sample_count:encoderType="render%20bundle";attachmentType="color" +webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,sample_count:encoderType="render%20bundle";attachmentType="depthstencil" +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,one_color_attachment: +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,one_depth_stencil_attachment: +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,same_size: +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,color_depth_mismatch: +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,layer_count:arrayLayerCount=5;baseArrayLayer=0 +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,layer_count:arrayLayerCount=1;baseArrayLayer=0 +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,layer_count:arrayLayerCount=1;baseArrayLayer=9 +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,mip_level_count:mipLevelCount=2;baseMipLevel=0 +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,mip_level_count:mipLevelCount=1;baseMipLevel=0 +webgpu:api,validation,render_pass,render_pass_descriptor:attachments,mip_level_count:mipLevelCount=1;baseMipLevel=3 +webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,empty: +webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,out_of_bounds:colorAttachmentsCount=8 +webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,out_of_bounds:colorAttachmentsCount=9 +webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,non_multisampled: +webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,sample_count: +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,sample_count: +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,array_layer_count: +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,mipmap_level_count: +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,usage:usage=3 +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,usage:usage=12 +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,usage:usage=8 +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,usage:usage=20 +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,error_state: +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,single_sample_count: +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,different_format: +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,different_size: +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="r8unorm" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="r8uint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="r8sint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="r16uint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="r16sint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="r16float" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rg8unorm" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rg8uint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rg8sint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="r32float" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rg16uint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rg16sint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rg16float" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rgba8unorm" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rgba8unorm-srgb" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rgba8uint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rgba8sint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="bgra8unorm" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="bgra8unorm-srgb" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rgb10a2unorm" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rgba16uint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rgba16sint" +webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,format_supports_resolve:format="rgba16float" +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,sample_counts_mismatch: +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment:format="depth32float" +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment:format="depth16unorm" +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment:format="stencil8" +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment:format="depth24plus" +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment:format="depth24plus-stencil8" +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment:format="depth32float-stencil8" +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="load";depthClearValue=-1 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="load";depthClearValue=0 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="load";depthClearValue=0.5 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="load";depthClearValue=1 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="load";depthClearValue=1.5 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="clear";depthClearValue=-1 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="clear";depthClearValue=0 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="clear";depthClearValue=0.5 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="clear";depthClearValue=1 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="clear";depthClearValue=1.5 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="_undef_";depthClearValue=-1 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="_undef_";depthClearValue=0 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="_undef_";depthClearValue=0.5 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="_undef_";depthClearValue=1 +webgpu:api,validation,render_pass,render_pass_descriptor:depth_stencil_attachment,depth_clear_value:depthLoadOp="_undef_";depthClearValue=1.5 +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrites,query_set_type:queryTypeA="occlusion";queryTypeB="occlusion" +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrites,query_set_type:queryTypeA="occlusion";queryTypeB="timestamp" +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrites,query_set_type:queryTypeA="timestamp";queryTypeB="occlusion" +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrites,query_set_type:queryTypeA="timestamp";queryTypeB="timestamp" +webgpu:api,validation,render_pass,render_pass_descriptor:timestamp_writes_location:locationA="beginning";locationB="beginning" +webgpu:api,validation,render_pass,render_pass_descriptor:timestamp_writes_location:locationA="beginning";locationB="end" +webgpu:api,validation,render_pass,render_pass_descriptor:timestamp_writes_location:locationA="end";locationB="beginning" +webgpu:api,validation,render_pass,render_pass_descriptor:timestamp_writes_location:locationA="end";locationB="end" +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,query_index:queryIndex=0 +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,query_index:queryIndex=1 +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,query_index:queryIndex=2 +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,query_index:queryIndex=3 +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,same_query_index:queryIndexA=0;queryIndexB=0 +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,same_query_index:queryIndexA=0;queryIndexB=1 +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,same_query_index:queryIndexA=1;queryIndexB=0 +webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,same_query_index:queryIndexA=1;queryIndexB=1 +webgpu:api,validation,render_pass,render_pass_descriptor:occlusionQuerySet,query_set_type:queryType="occlusion" +webgpu:api,validation,render_pass,render_pass_descriptor:occlusionQuerySet,query_set_type:queryType="timestamp" +webgpu:api,validation,render_pass,resolve:resolve_attachment: +webgpu:api,validation,render_pass,resolve:resolve_attachment:colorAttachmentSamples=1 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetSamples=4 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetUsage=1 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetViewBaseMipLevel=1;resolveTargetHeight=4;resolveTargetWidth=4 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetViewBaseMipLevel=1;resolveTargetViewMipCount=2;resolveTargetHeight=4;resolveTargetWidth=4 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetInvalid=true +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetViewMipCount=2 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetViewBaseArrayLayer=1 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetViewBaseArrayLayer=1;resolveTargetViewArrayLayerCount=2 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetViewArrayLayerCount=2 +webgpu:api,validation,render_pass,resolve:resolve_attachment:otherAttachmentFormat="bgra8unorm" +webgpu:api,validation,render_pass,resolve:resolve_attachment:colorAttachmentFormat="bgra8unorm" +webgpu:api,validation,render_pass,resolve:resolve_attachment:colorAttachmentFormat="rgba8unorm-srgb" +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetFormat="bgra8unorm" +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetFormat="rgba8unorm-srgb" +webgpu:api,validation,render_pass,resolve:resolve_attachment:colorAttachmentHeight=4 +webgpu:api,validation,render_pass,resolve:resolve_attachment:colorAttachmentWidth=4 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetHeight=4 +webgpu:api,validation,render_pass,resolve:resolve_attachment:resolveTargetWidth=4 +webgpu:api,validation,render_pass,storeOp:store_op_and_read_only:readonly=true +webgpu:api,validation,render_pass,storeOp:store_op_and_read_only:readonly=true;depthStoreOp="discard" +webgpu:api,validation,render_pass,storeOp:store_op_and_read_only:readonly=true;stencilStoreOp="discard" +webgpu:api,validation,render_pass,storeOp:store_op_and_read_only:readonly=false +webgpu:api,validation,render_pass,storeOp:store_op_and_read_only:readonly=false;depthReadOnly=true +webgpu:api,validation,render_pass,storeOp:store_op_and_read_only:readonly=false;stencilReadOnly=true +webgpu:api,validation,render_pass,storeOp:store_op_and_read_only:readonly="_undef_" +webgpu:api,validation,render_pass,storeOp:store_op_and_read_only:readonly="_undef_";depthReadOnly=true +webgpu:api,validation,render_pass,storeOp:store_op_and_read_only:readonly="_undef_";stencilReadOnly=true +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r8snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r8uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r8sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r16uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r16sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r16float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg8snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg8uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg8sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r32uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r32sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="r32float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg16uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg16sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg16float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba8snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba8uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba8sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bgra8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg11b10ufloat" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgb9e5ufloat" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg32uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg32sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rg32float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba16uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba16sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba16float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba32uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba32sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="rgba32float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="depth32float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="depth16unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="stencil8" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="depth24plus" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="depth24plus-stencil8" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="depth32float-stencil8" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc1-rgba-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc1-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc2-rgba-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc2-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc3-rgba-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc3-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc4-r-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc4-r-snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc5-rg-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc5-rg-snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc6h-rgb-ufloat" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc6h-rgb-float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc7-rgba-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="bc7-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="etc2-rgb8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="etc2-rgb8unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="etc2-rgb8a1unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="etc2-rgba8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="etc2-rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="eac-r11unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="eac-r11snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="eac-rg11unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="eac-rg11snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-4x4-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-4x4-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-5x4-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-5x4-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-5x5-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-5x5-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-6x5-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-6x5-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-6x6-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-6x6-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-8x5-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-8x5-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-8x6-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-8x6-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-8x8-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-8x8-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-10x5-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-10x5-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-10x6-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-10x6-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-10x8-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-10x8-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-10x10-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-10x10-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-12x10-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-12x10-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-12x12-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=false;format="astc-12x12-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r8snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r8uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r8sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r16uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r16sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r16float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg8snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg8uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg8sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r32uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r32sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="r32float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg16uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg16sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg16float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba8snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba8uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba8sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bgra8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg11b10ufloat" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgb9e5ufloat" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg32uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg32sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rg32float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba16uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba16sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba16float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba32uint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba32sint" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="rgba32float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="depth32float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="depth16unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="stencil8" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="depth24plus" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="depth24plus-stencil8" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="depth32float-stencil8" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc1-rgba-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc1-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc2-rgba-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc2-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc3-rgba-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc3-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc4-r-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc4-r-snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc5-rg-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc5-rg-snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc6h-rgb-ufloat" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc6h-rgb-float" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc7-rgba-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="bc7-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="etc2-rgb8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="etc2-rgb8unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="etc2-rgb8a1unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="etc2-rgba8unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="etc2-rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="eac-r11unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="eac-r11snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="eac-rg11unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="eac-rg11snorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-4x4-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-4x4-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-5x4-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-5x4-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-5x5-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-5x5-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-6x5-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-6x5-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-6x6-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-6x6-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-8x5-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-8x5-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-8x6-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-8x6-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-8x8-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-8x8-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-10x5-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-10x5-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-10x6-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-10x6-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-10x8-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-10x8-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-10x10-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-10x10-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-12x10-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-12x10-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-12x12-unorm" +webgpu:api,validation,render_pipeline,depth_stencil_state:format:isAsync=true;format="astc-12x12-unorm-srgb" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth16unorm";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth16unorm";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth16unorm";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth16unorm";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth16unorm";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth16unorm";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth16unorm";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth16unorm";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth16unorm";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="stencil8";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="stencil8";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="stencil8";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="stencil8";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="stencil8";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="stencil8";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="stencil8";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="stencil8";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="stencil8";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus-stencil8";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus-stencil8";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus-stencil8";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus-stencil8";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus-stencil8";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus-stencil8";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus-stencil8";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus-stencil8";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth24plus-stencil8";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float-stencil8";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float-stencil8";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float-stencil8";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float-stencil8";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float-stencil8";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float-stencil8";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float-stencil8";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float-stencil8";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=false;format="depth32float-stencil8";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth16unorm";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth16unorm";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth16unorm";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth16unorm";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth16unorm";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth16unorm";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth16unorm";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth16unorm";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth16unorm";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="stencil8";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="stencil8";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="stencil8";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="stencil8";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="stencil8";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="stencil8";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="stencil8";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="stencil8";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="stencil8";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus-stencil8";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus-stencil8";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus-stencil8";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus-stencil8";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus-stencil8";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus-stencil8";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus-stencil8";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus-stencil8";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth24plus-stencil8";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float-stencil8";depthCompare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float-stencil8";depthCompare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float-stencil8";depthCompare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float-stencil8";depthCompare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float-stencil8";depthCompare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float-stencil8";depthCompare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float-stencil8";depthCompare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float-stencil8";depthCompare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:isAsync=true;format="depth32float-stencil8";depthCompare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth32float";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth32float";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth16unorm";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth16unorm";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="stencil8";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="stencil8";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth24plus";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth24plus";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth24plus-stencil8";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth24plus-stencil8";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth32float-stencil8";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=false;format="depth32float-stencil8";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth32float";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth32float";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth16unorm";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth16unorm";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="stencil8";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="stencil8";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth24plus";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth24plus";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth24plus-stencil8";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth24plus-stencil8";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth32float-stencil8";depthWriteEnabled=false +webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:isAsync=true;format="depth32float-stencil8";depthWriteEnabled=true +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth16unorm";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="stencil8";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth24plus-stencil8";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=false;format="depth32float-stencil8";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth16unorm";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="stencil8";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth24plus-stencil8";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="front";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="front";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="front";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="front";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="front";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="front";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="front";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="front";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="front";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="back";compare="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="back";compare="never" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="back";compare="less" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="back";compare="equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="back";compare="less-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="back";compare="greater" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="back";compare="not-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="back";compare="greater-equal" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:isAsync=true;format="depth32float-stencil8";face="back";compare="always" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth16unorm";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="stencil8";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=false;format="depth32float-stencil8";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth16unorm";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="stencil8";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth24plus-stencil8";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="frontPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backDepthFailOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backPassOp";op="_undef_" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backPassOp";op="keep" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backPassOp";op="zero" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backPassOp";op="replace" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backPassOp";op="invert" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backPassOp";op="increment-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backPassOp";op="decrement-clamp" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backPassOp";op="increment-wrap" +webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:isAsync=true;format="depth32float-stencil8";faceAndOpType="backPassOp";op="decrement-wrap" +webgpu:api,validation,render_pipeline,fragment_state:color_target_exists:isAsync=false +webgpu:api,validation,render_pipeline,fragment_state:color_target_exists:isAsync=true +webgpu:api,validation,render_pipeline,fragment_state:max_color_attachments_limit:isAsync=false;targetsLength=8 +webgpu:api,validation,render_pipeline,fragment_state:max_color_attachments_limit:isAsync=false;targetsLength=9 +webgpu:api,validation,render_pipeline,fragment_state:max_color_attachments_limit:isAsync=true;targetsLength=8 +webgpu:api,validation,render_pipeline,fragment_state:max_color_attachments_limit:isAsync=true;targetsLength=9 +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r8snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg8snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba8snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg11b10ufloat" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgb9e5ufloat" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="depth32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="depth16unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="stencil8" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="depth24plus" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="depth24plus-stencil8" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="depth32float-stencil8" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc1-rgba-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc1-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc2-rgba-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc2-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc3-rgba-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc3-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc4-r-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc4-r-snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc5-rg-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc5-rg-snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc6h-rgb-ufloat" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc6h-rgb-float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc7-rgba-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="bc7-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="etc2-rgb8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="etc2-rgb8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="etc2-rgb8a1unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="etc2-rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="etc2-rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="eac-r11unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="eac-r11snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="eac-rg11unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="eac-rg11snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-4x4-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-4x4-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-5x4-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-5x4-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-5x5-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-5x5-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-6x5-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-6x5-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-6x6-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-6x6-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-8x5-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-8x5-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-8x6-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-8x6-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-8x8-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-8x8-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-10x5-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-10x5-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-10x6-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-10x6-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-10x8-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-10x8-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-10x10-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-10x10-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-12x10-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-12x10-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-12x12-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=false;format="astc-12x12-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r8snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg8snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba8snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg11b10ufloat" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgb9e5ufloat" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="depth32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="depth16unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="stencil8" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="depth24plus" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="depth24plus-stencil8" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="depth32float-stencil8" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc1-rgba-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc1-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc2-rgba-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc2-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc3-rgba-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc3-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc4-r-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc4-r-snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc5-rg-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc5-rg-snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc6h-rgb-ufloat" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc6h-rgb-float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc7-rgba-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="bc7-rgba-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="etc2-rgb8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="etc2-rgb8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="etc2-rgb8a1unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="etc2-rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="etc2-rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="eac-r11unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="eac-r11snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="eac-rg11unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="eac-rg11snorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-4x4-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-4x4-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-5x4-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-5x4-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-5x5-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-5x5-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-6x5-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-6x5-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-6x6-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-6x6-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-8x5-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-8x5-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-8x6-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-8x6-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-8x8-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-8x8-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-10x5-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-10x5-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-10x6-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-10x6-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-10x8-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-10x8-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-10x10-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-10x10-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-12x10-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-12x10-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-12x12-unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_renderable:isAsync=true;format="astc-12x12-unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=false;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:targets_format_filterable:isAsync=true;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:targets_blend:isAsync=false;component="color" +webgpu:api,validation,render_pipeline,fragment_state:targets_blend:isAsync=false;component="alpha" +webgpu:api,validation,render_pipeline,fragment_state:targets_blend:isAsync=true;component="color" +webgpu:api,validation,render_pipeline,fragment_state:targets_blend:isAsync=true;component="alpha" +webgpu:api,validation,render_pipeline,fragment_state:targets_write_mask:isAsync=false;writeMask=0 +webgpu:api,validation,render_pipeline,fragment_state:targets_write_mask:isAsync=false;writeMask=15 +webgpu:api,validation,render_pipeline,fragment_state:targets_write_mask:isAsync=false;writeMask=16 +webgpu:api,validation,render_pipeline,fragment_state:targets_write_mask:isAsync=false;writeMask=2147483649 +webgpu:api,validation,render_pipeline,fragment_state:targets_write_mask:isAsync=true;writeMask=0 +webgpu:api,validation,render_pipeline,fragment_state:targets_write_mask:isAsync=true;writeMask=15 +webgpu:api,validation,render_pipeline,fragment_state:targets_write_mask:isAsync=true;writeMask=16 +webgpu:api,validation,render_pipeline,fragment_state:targets_write_mask:isAsync=true;writeMask=2147483649 +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=0;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=1;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=2;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=4;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=8;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=false;writeMask=15;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=0;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=1;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=2;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=4;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=8;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="_undef_" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="r8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="r8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="r16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="r16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="r16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rg8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rg8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="r32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="r32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="r32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rg16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rg16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rg16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba8uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba8sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="bgra8unorm-srgb" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgb10a2unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rg32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rg32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rg32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba16uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba16sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba16float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba32uint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba32sint" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets:isAsync=true;writeMask=15;format="rgba32float" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets,blend:isAsync=false;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets,blend:isAsync=false;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets,blend:isAsync=false;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets,blend:isAsync=false;format="bgra8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets,blend:isAsync=true;format="r8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets,blend:isAsync=true;format="rg8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets,blend:isAsync=true;format="rgba8unorm" +webgpu:api,validation,render_pipeline,fragment_state:pipeline_output_targets,blend:isAsync=true;format="bgra8unorm" +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=false;outputs=["%40location(0)%20__:%20f32"];inputs=["%40location(0)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=false;outputs=["%40location(0)%20__:%20f32"];inputs=["%40location(1)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=false;outputs=["%40location(1)%20__:%20f32"];inputs=["%40location(0)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=false;outputs=["%40location(0)%20__:%20f32","%40location(1)%20__:%20f32"];inputs=["%40location(1)%20__:%20f32","%40location(0)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=false;outputs=["%40location(1)%20__:%20f32","%40location(0)%20__:%20f32"];inputs=["%40location(0)%20__:%20f32","%40location(1)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=true;outputs=["%40location(0)%20__:%20f32"];inputs=["%40location(0)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=true;outputs=["%40location(0)%20__:%20f32"];inputs=["%40location(1)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=true;outputs=["%40location(1)%20__:%20f32"];inputs=["%40location(0)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=true;outputs=["%40location(0)%20__:%20f32","%40location(1)%20__:%20f32"];inputs=["%40location(1)%20__:%20f32","%40location(0)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,mismatch:isAsync=true;outputs=["%40location(1)%20__:%20f32","%40location(0)%20__:%20f32"];inputs=["%40location(0)%20__:%20f32","%40location(1)%20__:%20f32"] +webgpu:api,validation,render_pipeline,inter_stage:location,superset: +webgpu:api,validation,render_pipeline,inter_stage:location,subset:isAsync=false +webgpu:api,validation,render_pipeline,inter_stage:location,subset:isAsync=true +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="f32";input="f32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="f32";input="vec2%3Cf32%3E" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="i32";input="f32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="i32";input="u32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="u32";input="f32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="u32";input="i32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="vec2%3Cf32%3E";input="vec2%3Cf32%3E" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="vec2%3Cf32%3E";input="vec3%3Cf32%3E" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="vec2%3Cf32%3E";input="f32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=false;output="vec3%3Cf32%3E";input="vec2%3Cf32%3E" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="f32";input="f32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="f32";input="vec2%3Cf32%3E" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="i32";input="f32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="i32";input="u32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="u32";input="f32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="u32";input="i32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="vec2%3Cf32%3E";input="vec2%3Cf32%3E" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="vec2%3Cf32%3E";input="vec3%3Cf32%3E" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="vec2%3Cf32%3E";input="f32" +webgpu:api,validation,render_pipeline,inter_stage:type:isAsync=true;output="vec3%3Cf32%3E";input="vec2%3Cf32%3E" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="";input="" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="";input="%40interpolate(perspective,%20center)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="";input="%40interpolate(linear)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="%40interpolate(perspective)";input="" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="%40interpolate(perspective)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="%40interpolate(linear)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="%40interpolate(linear)";input="%40interpolate(flat)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="%40interpolate(flat)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=false;output="%40interpolate(linear,%20center)";input="%40interpolate(linear,%20center)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="";input="" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="";input="%40interpolate(perspective,%20center)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="";input="%40interpolate(linear)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="%40interpolate(perspective)";input="" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="%40interpolate(perspective)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="%40interpolate(linear)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="%40interpolate(linear)";input="%40interpolate(flat)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="%40interpolate(flat)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_type:isAsync=true;output="%40interpolate(linear,%20center)";input="%40interpolate(linear,%20center)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=false;output="%40interpolate(perspective)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=false;output="%40interpolate(perspective)";input="%40interpolate(perspective,%20center)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=false;output="%40interpolate(perspective)";input="%40interpolate(perspective,%20sample)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=false;output="%40interpolate(linear,%20center)";input="%40interpolate(linear)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=false;output="%40interpolate(flat)";input="%40interpolate(flat)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=false;output="%40interpolate(perspective,%20center)";input="%40interpolate(perspective,%20sample)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=false;output="%40interpolate(perspective,%20center)";input="%40interpolate(perspective,%20centroid)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=false;output="%40interpolate(perspective,%20centroid)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=true;output="%40interpolate(perspective)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=true;output="%40interpolate(perspective)";input="%40interpolate(perspective,%20center)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=true;output="%40interpolate(perspective)";input="%40interpolate(perspective,%20sample)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=true;output="%40interpolate(linear,%20center)";input="%40interpolate(linear)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=true;output="%40interpolate(flat)";input="%40interpolate(flat)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=true;output="%40interpolate(perspective,%20center)";input="%40interpolate(perspective,%20sample)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=true;output="%40interpolate(perspective,%20center)";input="%40interpolate(perspective,%20centroid)" +webgpu:api,validation,render_pipeline,inter_stage:interpolation_sampling:isAsync=true;output="%40interpolate(perspective,%20centroid)";input="%40interpolate(perspective)" +webgpu:api,validation,render_pipeline,inter_stage:max_shader_variable_location:isAsync=false;locationDelta=0 +webgpu:api,validation,render_pipeline,inter_stage:max_shader_variable_location:isAsync=false;locationDelta=-1 +webgpu:api,validation,render_pipeline,inter_stage:max_shader_variable_location:isAsync=false;locationDelta=-2 +webgpu:api,validation,render_pipeline,inter_stage:max_shader_variable_location:isAsync=true;locationDelta=0 +webgpu:api,validation,render_pipeline,inter_stage:max_shader_variable_location:isAsync=true;locationDelta=-1 +webgpu:api,validation,render_pipeline,inter_stage:max_shader_variable_location:isAsync=true;locationDelta=-2 +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,output:isAsync=false;numScalarDelta=0;topology="triangle-list" +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,output:isAsync=false;numScalarDelta=0;topology="point-list" +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,output:isAsync=false;numScalarDelta=1;topology="triangle-list" +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,output:isAsync=false;numScalarDelta=-1;topology="point-list" +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,output:isAsync=true;numScalarDelta=0;topology="triangle-list" +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,output:isAsync=true;numScalarDelta=0;topology="point-list" +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,output:isAsync=true;numScalarDelta=1;topology="triangle-list" +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,output:isAsync=true;numScalarDelta=-1;topology="point-list" +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=false;numScalarDelta=0;useExtraBuiltinInputs=false +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=false;numScalarDelta=0;useExtraBuiltinInputs=true +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=false;numScalarDelta=1;useExtraBuiltinInputs=false +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=false;numScalarDelta=-3;useExtraBuiltinInputs=true +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=false;numScalarDelta=-2;useExtraBuiltinInputs=true +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=true;numScalarDelta=0;useExtraBuiltinInputs=false +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=true;numScalarDelta=0;useExtraBuiltinInputs=true +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=true;numScalarDelta=1;useExtraBuiltinInputs=false +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=true;numScalarDelta=-3;useExtraBuiltinInputs=true +webgpu:api,validation,render_pipeline,inter_stage:max_components_count,input:isAsync=true;numScalarDelta=-2;useExtraBuiltinInputs=true +webgpu:api,validation,render_pipeline,misc:basic:isAsync=false +webgpu:api,validation,render_pipeline,misc:basic:isAsync=true +webgpu:api,validation,render_pipeline,misc:vertex_state_only:isAsync=false +webgpu:api,validation,render_pipeline,misc:vertex_state_only:isAsync=true +webgpu:api,validation,render_pipeline,misc:pipeline_layout,device_mismatch: +webgpu:api,validation,render_pipeline,multisample_state:count:isAsync=false +webgpu:api,validation,render_pipeline,multisample_state:count:isAsync=true +webgpu:api,validation,render_pipeline,multisample_state:alpha_to_coverage,count:isAsync=false;alphaToCoverageEnabled=false +webgpu:api,validation,render_pipeline,multisample_state:alpha_to_coverage,count:isAsync=false;alphaToCoverageEnabled=true +webgpu:api,validation,render_pipeline,multisample_state:alpha_to_coverage,count:isAsync=true;alphaToCoverageEnabled=false +webgpu:api,validation,render_pipeline,multisample_state:alpha_to_coverage,count:isAsync=true;alphaToCoverageEnabled=true +webgpu:api,validation,render_pipeline,multisample_state:alpha_to_coverage,sample_mask:isAsync=false;alphaToCoverageEnabled=false +webgpu:api,validation,render_pipeline,multisample_state:alpha_to_coverage,sample_mask:isAsync=false;alphaToCoverageEnabled=true +webgpu:api,validation,render_pipeline,multisample_state:alpha_to_coverage,sample_mask:isAsync=true;alphaToCoverageEnabled=false +webgpu:api,validation,render_pipeline,multisample_state:alpha_to_coverage,sample_mask:isAsync=true;alphaToCoverageEnabled=true +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="_undef_";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="_undef_";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="_undef_";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="point-list";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="point-list";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="point-list";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="line-list";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="line-list";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="line-list";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="line-strip";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="line-strip";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="line-strip";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="triangle-list";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="triangle-list";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="triangle-list";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="triangle-strip";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="triangle-strip";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=false;topology="triangle-strip";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="_undef_";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="_undef_";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="_undef_";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="point-list";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="point-list";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="point-list";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="line-list";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="line-list";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="line-list";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="line-strip";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="line-strip";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="line-strip";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="triangle-list";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="triangle-list";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="triangle-list";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="triangle-strip";stripIndexFormat="_undef_" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="triangle-strip";stripIndexFormat="uint16" +webgpu:api,validation,render_pipeline,primitive_state:strip_index_format:isAsync=true;topology="triangle-strip";stripIndexFormat="uint32" +webgpu:api,validation,render_pipeline,primitive_state:unclipped_depth:isAsync=false;unclippedDepth=false +webgpu:api,validation,render_pipeline,primitive_state:unclipped_depth:isAsync=false;unclippedDepth=true +webgpu:api,validation,render_pipeline,primitive_state:unclipped_depth:isAsync=true;unclippedDepth=false +webgpu:api,validation,render_pipeline,primitive_state:unclipped_depth:isAsync=true;unclippedDepth=true +webgpu:api,validation,render_pipeline,shader_module:device_mismatch: +webgpu:api,validation,render_pipeline,shader_module:invalid,vertex:isAsync=true;isVertexShaderValid=true +webgpu:api,validation,render_pipeline,shader_module:invalid,vertex:isAsync=true;isVertexShaderValid=false +webgpu:api,validation,render_pipeline,shader_module:invalid,vertex:isAsync=false;isVertexShaderValid=true +webgpu:api,validation,render_pipeline,shader_module:invalid,vertex:isAsync=false;isVertexShaderValid=false +webgpu:api,validation,render_pipeline,shader_module:invalid,fragment:isAsync=true;isFragmentShaderValid=true +webgpu:api,validation,render_pipeline,shader_module:invalid,fragment:isAsync=true;isFragmentShaderValid=false +webgpu:api,validation,render_pipeline,shader_module:invalid,fragment:isAsync=false;isFragmentShaderValid=true +webgpu:api,validation,render_pipeline,shader_module:invalid,fragment:isAsync=false;isFragmentShaderValid=false +webgpu:api,validation,render_pipeline,vertex_state:max_vertex_buffer_limit: +webgpu:api,validation,render_pipeline,vertex_state:max_vertex_attribute_limit: +webgpu:api,validation,render_pipeline,vertex_state:max_vertex_buffer_array_stride_limit: +webgpu:api,validation,render_pipeline,vertex_state:vertex_buffer_array_stride_limit_alignment: +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_shaderLocation_limit: +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_shaderLocation_unique: +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_input_location_limit: +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_input_location_in_vertex_state: +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="uint8x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="uint8x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="sint8x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="sint8x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="unorm8x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="unorm8x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="snorm8x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="snorm8x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="uint16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="uint16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="sint16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="sint16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="unorm16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="unorm16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="snorm16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="snorm16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="float16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="float16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="float32" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="float32x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="float32x3" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="float32x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="uint32" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="uint32x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="uint32x3" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="uint32x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="sint32" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="sint32x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="sint32x3" +webgpu:api,validation,render_pipeline,vertex_state:vertex_shader_type_matches_attribute_format:format="sint32x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=256;offset=1 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=256;offset=254 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=256;offset=253 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=2048;offset=1 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=2048;offset=2046 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=2048;offset=2045 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x2";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint8x4";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=256;offset=1 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=256;offset=254 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=256;offset=253 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=2048;offset=1 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=2048;offset=2046 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=2048;offset=2045 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x2";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint8x4";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=256;offset=1 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=256;offset=254 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=256;offset=253 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=2048;offset=1 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=2048;offset=2046 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=2048;offset=2045 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x2";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm8x4";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=256;offset=1 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=256;offset=254 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=256;offset=253 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=2048;offset=1 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=2048;offset=2046 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=2048;offset=2045 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x2";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm8x4";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x2";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=256;offset=246 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint16x4";arrayStride=2048;offset=2038 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x2";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=256;offset=246 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint16x4";arrayStride=2048;offset=2038 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x2";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=256;offset=246 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="unorm16x4";arrayStride=2048;offset=2038 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x2";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=256;offset=246 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="snorm16x4";arrayStride=2048;offset=2038 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x2";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=256;offset=246 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float16x4";arrayStride=2048;offset=2038 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=256;offset=246 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x2";arrayStride=2048;offset=2038 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=256;offset=6 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=256;offset=12 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=256;offset=238 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=256;offset=240 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=256;offset=242 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=2048;offset=6 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=2048;offset=12 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=2048;offset=2030 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=2048;offset=2032 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x3";arrayStride=2048;offset=2034 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=256;offset=16 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=256;offset=240 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=256;offset=232 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=256;offset=236 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=256;offset=238 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=2048;offset=16 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=2048;offset=2032 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=2048;offset=2024 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=2048;offset=2028 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="float32x4";arrayStride=2048;offset=2030 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=256;offset=246 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x2";arrayStride=2048;offset=2038 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=256;offset=6 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=256;offset=12 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=256;offset=238 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=256;offset=240 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=256;offset=242 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=2048;offset=6 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=2048;offset=12 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=2048;offset=2030 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=2048;offset=2032 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x3";arrayStride=2048;offset=2034 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=256;offset=16 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=256;offset=240 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=256;offset=232 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=256;offset=236 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=256;offset=238 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=2048;offset=16 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=2048;offset=2032 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=2048;offset=2024 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=2048;offset=2028 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="uint32x4";arrayStride=2048;offset=2030 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=256;offset=252 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=256;offset=250 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=2048;offset=2044 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=2048;offset=2042 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=256;offset=248 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=256;offset=246 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=2048;offset=2040 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x2";arrayStride=2048;offset=2038 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=256;offset=6 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=256;offset=12 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=256;offset=244 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=256;offset=238 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=256;offset=240 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=256;offset=242 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=2048;offset=6 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=2048;offset=12 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=2048;offset=2036 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=2048;offset=2030 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=2048;offset=2032 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x3";arrayStride=2048;offset=2034 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=256;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=256;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=256;offset=16 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=256;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=256;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=256;offset=240 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=256;offset=232 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=256;offset=236 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=256;offset=238 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=2048;offset=0 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=2048;offset=8 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=2048;offset=16 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=2048;offset=2 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=2048;offset=4 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=2048;offset=2032 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=2048;offset=2024 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=2048;offset=2028 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_offset_alignment:format="sint32x4";arrayStride=2048;offset=2030 +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="uint8x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="uint8x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="sint8x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="sint8x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="unorm8x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="unorm8x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="snorm8x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="snorm8x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="uint16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="uint16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="sint16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="sint16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="unorm16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="unorm16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="snorm16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="snorm16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="float16x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="float16x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="float32" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="float32x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="float32x3" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="float32x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="uint32" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="uint32x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="uint32x3" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="uint32x4" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="sint32" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="sint32x2" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="sint32x3" +webgpu:api,validation,render_pipeline,vertex_state:vertex_attribute_contained_in_stride:format="sint32x4" +webgpu:api,validation,render_pipeline,vertex_state:many_attributes_overlapping: +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_no_dispatch:usage0="uniform";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_no_dispatch:usage0="uniform";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_no_dispatch:usage0="uniform";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_no_dispatch:usage0="storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_no_dispatch:usage0="storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_no_dispatch:usage0="storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_no_dispatch:usage0="read-only-storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_no_dispatch:usage0="read-only-storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_no_dispatch:usage0="read-only-storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_one_dispatch:usage0AccessibleInDispatch=true;usage1AccessibleInDispatch=true;dispatchBeforeUsage1=false +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_one_dispatch:usage0AccessibleInDispatch=true;usage1AccessibleInDispatch=false;dispatchBeforeUsage1=true +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_one_dispatch:usage0AccessibleInDispatch=true;usage1AccessibleInDispatch=false;dispatchBeforeUsage1=false +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_one_dispatch:usage0AccessibleInDispatch=false;usage1AccessibleInDispatch=true;dispatchBeforeUsage1=false +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_one_dispatch:usage0AccessibleInDispatch=false;usage1AccessibleInDispatch=false;dispatchBeforeUsage1=true +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_compute_pass_with_one_dispatch:usage0AccessibleInDispatch=false;usage1AccessibleInDispatch=false;dispatchBeforeUsage1=false +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="uniform";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="uniform";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="uniform";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="uniform";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="read-only-storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="read-only-storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="read-only-storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="read-only-storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="indirect";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="indirect";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="indirect";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_compute_pass_with_two_dispatches:usage0="indirect";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="uniform";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="uniform";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="uniform";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="uniform";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="uniform";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="storage";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="storage";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="read-only-storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="read-only-storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="read-only-storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="read-only-storage";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="read-only-storage";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="vertex";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="vertex";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="vertex";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="vertex";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="vertex";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="index";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="index";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="index";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="index";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_no_draw:usage0="index";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="uniform";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="uniform";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="uniform";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="uniform";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="uniform";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="uniform";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="uniform";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="storage";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="storage";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="storage";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="read-only-storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="read-only-storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="read-only-storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="read-only-storage";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="read-only-storage";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="read-only-storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="read-only-storage";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="vertex";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="vertex";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="vertex";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="vertex";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="vertex";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="vertex";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="vertex";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="index";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="index";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="index";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="index";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="index";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="index";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="index";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indirect";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indirect";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indirect";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indirect";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indirect";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indexedIndirect";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indexedIndirect";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indexedIndirect";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indexedIndirect";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_one_draw:usage0="indexedIndirect";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="uniform";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="uniform";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="uniform";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="uniform";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="uniform";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="uniform";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="uniform";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="storage";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="storage";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="storage";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="read-only-storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="read-only-storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="read-only-storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="read-only-storage";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="read-only-storage";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="read-only-storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="read-only-storage";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="vertex";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="vertex";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="vertex";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="vertex";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="vertex";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="vertex";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="vertex";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="index";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="index";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="index";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="index";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="index";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="index";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="index";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indirect";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indirect";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indirect";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indirect";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indirect";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indirect";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indirect";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indexedIndirect";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indexedIndirect";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indexedIndirect";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indexedIndirect";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indexedIndirect";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indexedIndirect";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_encoder:subresources,buffer_usage_in_one_render_pass_with_two_draws:usage0="indexedIndirect";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="uniform";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="uniform";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="uniform";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="uniform";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="read-only-storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="read-only-storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="read-only-storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_dispatch:usage0="read-only-storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="uniform";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="uniform";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="uniform";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="uniform";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="uniform";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="uniform";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="uniform";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="storage";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="storage";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="storage";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="read-only-storage";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="read-only-storage";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="read-only-storage";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="read-only-storage";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="read-only-storage";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="read-only-storage";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="read-only-storage";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="vertex";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="vertex";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="vertex";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="vertex";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="vertex";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="vertex";usage1="indirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="vertex";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="index";usage1="uniform" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="index";usage1="storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="index";usage1="read-only-storage" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="index";usage1="vertex" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="index";usage1="index" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,reset_buffer_usage_before_draw:usage0="index";usage1="indexedIndirect" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="copy-src";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="copy-dst";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="uniform";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="uniform";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="storage";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="storage";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="read-only-storage";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="read-only-storage";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="vertex";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="index";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="indirect";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="indirect";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-src";usage1="indexedIndirect";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="copy-src";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="copy-dst";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="uniform";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="uniform";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="storage";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="storage";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="read-only-storage";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="read-only-storage";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="vertex";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="index";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="indirect";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="indirect";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="copy-dst";usage1="indexedIndirect";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="uniform";usage1="copy-src";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="uniform";usage1="copy-src";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="uniform";usage1="copy-dst";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="uniform";usage1="copy-dst";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="storage";usage1="copy-src";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="storage";usage1="copy-src";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="storage";usage1="copy-dst";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="storage";usage1="copy-dst";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="read-only-storage";usage1="copy-src";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="read-only-storage";usage1="copy-src";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="read-only-storage";usage1="copy-dst";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="read-only-storage";usage1="copy-dst";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="vertex";usage1="copy-src";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="vertex";usage1="copy-dst";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="index";usage1="copy-src";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="index";usage1="copy-dst";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="indirect";usage1="copy-src";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="indirect";usage1="copy-src";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="indirect";usage1="copy-dst";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="indirect";usage1="copy-dst";pass="compute" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="indexedIndirect";usage1="copy-src";pass="render" +webgpu:api,validation,resource_usages,buffer,in_pass_misc:subresources,buffer_usages_in_copy_and_pass:usage0="indexedIndirect";usage1="copy-dst";pass="render" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_color:compute=false;type0="sampled-texture";type1="sampled-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_color:compute=false;type0="sampled-texture";type1="writeonly-storage-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_color:compute=false;type0="sampled-texture";type1="render-target" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_color:compute=false;type0="writeonly-storage-texture";type1="writeonly-storage-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_color:compute=false;type0="writeonly-storage-texture";type1="render-target" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_color:compute=false;type0="render-target";type1="render-target" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_color:compute=true;type0="sampled-texture";type1="sampled-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_color:compute=true;type0="sampled-texture";type1="writeonly-storage-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_color:compute=true;type0="writeonly-storage-texture";type1="writeonly-storage-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=false;format="depth32float" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=false;format="depth16unorm" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=false;format="stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=false;format="depth24plus" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=false;format="depth24plus-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=false;format="depth32float-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=true;format="depth32float" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=true;format="depth16unorm" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=true;format="stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=true;format="depth24plus" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=true;format="depth24plus-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=false;binding1InBundle=true;format="depth32float-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=false;format="depth32float" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=false;format="depth16unorm" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=false;format="stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=false;format="depth24plus" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=false;format="depth24plus-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=false;format="depth32float-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=true;format="depth32float" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=true;format="depth16unorm" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=true;format="stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=true;format="depth24plus" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=true;format="depth24plus-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=false;binding0InBundle=true;binding1InBundle=true;format="depth32float-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=true;binding0InBundle=false;binding1InBundle=false;format="depth32float" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=true;binding0InBundle=false;binding1InBundle=false;format="depth16unorm" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=true;binding0InBundle=false;binding1InBundle=false;format="stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=true;binding0InBundle=false;binding1InBundle=false;format="depth24plus" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=true;binding0InBundle=false;binding1InBundle=false;format="depth24plus-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:subresources_and_binding_types_combination_for_aspect:compute=true;binding0InBundle=false;binding1InBundle=false;format="depth32float-stencil8" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:shader_stages_and_visibility,storage_write:compute=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:shader_stages_and_visibility,storage_write:compute=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:shader_stages_and_visibility,attachment_write: +webgpu:api,validation,resource_usages,texture,in_pass_encoder:replaced_binding:compute=false;callDrawOrDispatch=false;entry={"texture":{}} +webgpu:api,validation,resource_usages,texture,in_pass_encoder:replaced_binding:compute=false;callDrawOrDispatch=false;entry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,resource_usages,texture,in_pass_encoder:replaced_binding:compute=false;callDrawOrDispatch=true;entry={"texture":{}} +webgpu:api,validation,resource_usages,texture,in_pass_encoder:replaced_binding:compute=false;callDrawOrDispatch=true;entry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,resource_usages,texture,in_pass_encoder:replaced_binding:compute=true;callDrawOrDispatch=false;entry={"texture":{}} +webgpu:api,validation,resource_usages,texture,in_pass_encoder:replaced_binding:compute=true;callDrawOrDispatch=false;entry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,resource_usages,texture,in_pass_encoder:replaced_binding:compute=true;callDrawOrDispatch=true;entry={"texture":{}} +webgpu:api,validation,resource_usages,texture,in_pass_encoder:replaced_binding:compute=true;callDrawOrDispatch=true;entry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="render-target";type1="sampled-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="render-target";type1="multisampled-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="render-target";type1="writeonly-storage-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="sampled-texture";type1="render-target" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="sampled-texture";type1="sampled-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="sampled-texture";type1="writeonly-storage-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="multisampled-texture";type1="render-target" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="multisampled-texture";type1="multisampled-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="writeonly-storage-texture";type1="render-target" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="writeonly-storage-texture";type1="sampled-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:bindings_in_bundle:type0="writeonly-storage-texture";type1="writeonly-storage-texture" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=false;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=false;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=false;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="common";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="before";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="middle";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="after";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=false +webgpu:api,validation,resource_usages,texture,in_pass_encoder:unused_bindings_in_pipeline:compute=true;useBindGroup0=true;useBindGroup1=true;setBindGroupsOrder="reversed";setPipeline="none";callDrawOrDispatch=true +webgpu:api,validation,resource_usages,texture,in_pass_encoder:scope,dispatch:dispatch="none" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:scope,dispatch:dispatch="direct" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:scope,dispatch:dispatch="indirect" +webgpu:api,validation,resource_usages,texture,in_pass_encoder:scope,basic,render: +webgpu:api,validation,resource_usages,texture,in_pass_encoder:scope,pass_boundary,compute: +webgpu:api,validation,resource_usages,texture,in_pass_encoder:scope,pass_boundary,render: +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=0;layer1=0;level1=0;inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=0;layer1=0;level1=0;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=0;layer1=0;level1=1;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=0;layer1=1;level1=0;inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=0;layer1=1;level1=0;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=0;layer1=1;level1=1;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=1;layer1=0;level1=0;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=1;layer1=0;level1=1;inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=1;layer1=0;level1=1;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=1;layer1=1;level1=0;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=1;layer1=1;level1=1;inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=0;level0=1;layer1=1;level1=1;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=0;layer1=0;level1=0;inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=0;layer1=0;level1=0;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=0;layer1=0;level1=1;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=0;layer1=1;level1=0;inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=0;layer1=1;level1=0;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=0;layer1=1;level1=1;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=1;layer1=0;level1=0;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=1;layer1=0;level1=1;inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=1;layer1=0;level1=1;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=1;layer1=1;level1=0;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=1;layer1=1;level1=1;inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachments:layer0=1;level0=1;layer1=1;level1=1;inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=0;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;bgUsage="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,color_attachment_and_bind_group:colorAttachmentLevel=1;colorAttachmentLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;bgUsage="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=true;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_attachment_and_bind_group:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2;dsReadOnly=false;bgAspect="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":0,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":1};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="storage";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":0,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":1};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":0,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":1};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="storage";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":0,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":1};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,multiple_bind_groups:bg0Levels={"base":1,"count":2};bg0Layers={"base":1,"count":2};bg1Levels={"base":1,"count":2};bg1Layers={"base":1,"count":2};bgUsage0="texture";bgUsage1="texture";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":0,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":1};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":0,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":1};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":0,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":1};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":0,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":1};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="depth-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="depth-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=true +webgpu:api,validation,resource_usages,texture,in_render_common:subresources,depth_stencil_texture_in_bind_groups:view0Levels={"base":1,"count":2};view0Layers={"base":1,"count":2};view1Levels={"base":1,"count":2};view1Layers={"base":1,"count":2};aspect0="stencil-only";aspect1="stencil-only";inSamePass=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=true;baseLayer2=0;view2Binding="texture";hasConflict=true +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=true;baseLayer2=0;view2Binding="texture";hasConflict=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=false;baseLayer2=0;view2Binding="texture";hasConflict=true +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=false;baseLayer2=0;view2Binding="texture";hasConflict=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=false;baseLayer2=0;view2Binding="storage";hasConflict=true +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=false;baseLayer2=0;view2Binding="storage";hasConflict=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=false;baseLayer2=1;view2Binding="texture";hasConflict=true +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=false;baseLayer2=1;view2Binding="texture";hasConflict=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=false;baseLayer2=1;view2Binding="storage";hasConflict=true +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_color_texture:useDifferentTextureAsTexture2=false;baseLayer2=1;view2Binding="storage";hasConflict=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_depth_stencil_texture:bindAspect="depth-only";depthStencilReadOnly=true +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_depth_stencil_texture:bindAspect="depth-only";depthStencilReadOnly=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_depth_stencil_texture:bindAspect="stencil-only";depthStencilReadOnly=true +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_depth_stencil_texture:bindAspect="stencil-only";depthStencilReadOnly=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_unused_bind_group:inRenderPass=true;hasConflict=true +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_unused_bind_group:inRenderPass=true;hasConflict=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_unused_bind_group:inRenderPass=false;hasConflict=true +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_unused_bind_group:inRenderPass=false;hasConflict=false +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-src";usage1="copy-src" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-src";usage1="copy-dst" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-src";usage1="texture" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-src";usage1="storage" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-src";usage1="color-attachment" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-dst";usage1="copy-src" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-dst";usage1="copy-dst" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-dst";usage1="texture" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-dst";usage1="storage" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="copy-dst";usage1="color-attachment" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="texture";usage1="copy-src" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="texture";usage1="copy-dst" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="storage";usage1="copy-src" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="storage";usage1="copy-dst" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="color-attachment";usage1="copy-src" +webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:usage0="color-attachment";usage1="copy-dst" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000a" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%20" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="ma%20in" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cn" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="mian";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="mian";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="mainmain";stageEntryPoint="mainmain" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="mainmain";stageEntryPoint="foo" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V3" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V5" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="_main_t12V3" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="s%C3%A9quen%C3%A7age" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=true;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="sequencage" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000a" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%20" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="ma%20in" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cn" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="mian";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="mian";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="mainmain";stageEntryPoint="mainmain" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="mainmain";stageEntryPoint="foo" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V3" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V5" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="_main_t12V3" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="s%C3%A9quen%C3%A7age" +webgpu:api,validation,shader_module,entry_point:compute:isAsync=false;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="sequencage" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000a" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%20" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="ma%20in" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cn" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="mian";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="mian";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="mainmain";stageEntryPoint="mainmain" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="mainmain";stageEntryPoint="foo" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V3" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V5" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="_main_t12V3" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="s%C3%A9quen%C3%A7age" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=true;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="sequencage" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000a" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%20" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="ma%20in" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cn" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="mian";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="mian";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="mainmain";stageEntryPoint="mainmain" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="mainmain";stageEntryPoint="foo" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V3" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V5" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="_main_t12V3" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="s%C3%A9quen%C3%A7age" +webgpu:api,validation,shader_module,entry_point:vertex:isAsync=false;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="sequencage" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000a" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%20" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="ma%20in" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cn" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="mian";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="mian";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="mainmain";stageEntryPoint="mainmain" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="mainmain";stageEntryPoint="foo" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V3" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V5" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="_main_t12V3" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="s%C3%A9quen%C3%A7age" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=true;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="sequencage" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cu0000a" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%20" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="ma%20in" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main";stageEntryPoint="main%5Cn" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="mian";stageEntryPoint="mian" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="mian";stageEntryPoint="main" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="mainmain";stageEntryPoint="mainmain" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="mainmain";stageEntryPoint="foo" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V3" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="main_t12V5" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="main_t12V3";stageEntryPoint="_main_t12V3" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="s%C3%A9quen%C3%A7age" +webgpu:api,validation,shader_module,entry_point:fragment:isAsync=false;shaderModuleEntryPoint="s%C3%A9quen%C3%A7age";stageEntryPoint="sequencage" +webgpu:api,validation,state,device_lost,destroy:createBuffer:usageType="MAP_READ" +webgpu:api,validation,state,device_lost,destroy:createBuffer:usageType="MAP_WRITE" +webgpu:api,validation,state,device_lost,destroy:createBuffer:usageType="INDEX" +webgpu:api,validation,state,device_lost,destroy:createBuffer:usageType="VERTEX" +webgpu:api,validation,state,device_lost,destroy:createBuffer:usageType="UNIFORM" +webgpu:api,validation,state,device_lost,destroy:createBuffer:usageType="STORAGE" +webgpu:api,validation,state,device_lost,destroy:createBuffer:usageType="INDIRECT" +webgpu:api,validation,state,device_lost,destroy:createBuffer:usageType="QUERY_RESOLVE" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r8unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r8snorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r8uint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r8sint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r16uint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r16sint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r16float" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg8unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg8snorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg8uint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg8sint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r32uint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r32sint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="r32float" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg16uint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg16sint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg16float" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba8unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba8snorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba8uint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba8sint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="bgra8unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="bgra8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgb10a2unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg11b10ufloat" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgb9e5ufloat" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg32uint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg32sint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rg32float" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba16uint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba16sint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba16float" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba32uint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba32sint" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:format="rgba32float" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc1-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc1-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc2-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc2-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc3-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc3-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc4-r-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc4-r-snorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc5-rg-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc5-rg-snorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc6h-rgb-ufloat" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc6h-rgb-float" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc7-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="bc7-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="etc2-rgb8unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="etc2-rgb8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="etc2-rgb8a1unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="etc2-rgba8unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="etc2-rgba8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="eac-r11unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="eac-r11snorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="eac-rg11unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="eac-rg11snorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-4x4-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-4x4-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-5x4-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-5x4-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-5x5-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-5x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-6x5-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-6x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-6x6-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-6x6-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-8x5-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-8x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-8x6-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-8x6-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-8x8-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-8x8-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-10x5-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-10x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-10x6-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-10x6-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-10x8-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-10x8-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-10x10-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-10x10-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-12x10-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-12x10-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-12x12-unorm" +webgpu:api,validation,state,device_lost,destroy:createTexture,2d,compressed_format:format="astc-12x12-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r8unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r8snorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r8uint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r8sint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r16uint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r16sint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r16float" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg8unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg8snorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg8uint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg8sint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r32uint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r32sint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="r32float" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg16uint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg16sint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg16float" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba8unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba8snorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba8uint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba8sint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="bgra8unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="bgra8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgb10a2unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg11b10ufloat" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgb9e5ufloat" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg32uint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg32sint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rg32float" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba16uint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba16sint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba16float" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba32uint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba32sint" +webgpu:api,validation,state,device_lost,destroy:createView,2d,uncompressed_format:format="rgba32float" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc1-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc1-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc2-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc2-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc3-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc3-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc4-r-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc4-r-snorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc5-rg-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc5-rg-snorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc6h-rgb-ufloat" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc6h-rgb-float" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc7-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="bc7-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="etc2-rgb8unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="etc2-rgb8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="etc2-rgb8a1unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="etc2-rgba8unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="etc2-rgba8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="eac-r11unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="eac-r11snorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="eac-rg11unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="eac-rg11snorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-4x4-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-4x4-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-5x4-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-5x4-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-5x5-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-5x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-6x5-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-6x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-6x6-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-6x6-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-8x5-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-8x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-8x6-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-8x6-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-8x8-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-8x8-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-10x5-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-10x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-10x6-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-10x6-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-10x8-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-10x8-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-10x10-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-10x10-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-12x10-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-12x10-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-12x12-unorm" +webgpu:api,validation,state,device_lost,destroy:createView,2d,compressed_format:format="astc-12x12-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createSampler: +webgpu:api,validation,state,device_lost,destroy:createBindGroupLayout:entry={"buffer":{"type":"uniform"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroupLayout:entry={"buffer":{"type":"storage"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroupLayout:entry={"buffer":{"type":"read-only-storage"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroupLayout:entry={"sampler":{"type":"comparison"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroupLayout:entry={"sampler":{"type":"filtering"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroupLayout:entry={"sampler":{"type":"non-filtering"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroupLayout:entry={"texture":{"multisampled":false}} +webgpu:api,validation,state,device_lost,destroy:createBindGroupLayout:entry={"texture":{"multisampled":true}} +webgpu:api,validation,state,device_lost,destroy:createBindGroupLayout:entry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="uniformBuf";entry={"buffer":{"type":"uniform"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="storageBuf";entry={"buffer":{"type":"storage"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="storageBuf";entry={"buffer":{"type":"read-only-storage"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="filtSamp";entry={"sampler":{"type":"filtering"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="nonFiltSamp";entry={"sampler":{"type":"filtering"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="nonFiltSamp";entry={"sampler":{"type":"non-filtering"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="compareSamp";entry={"sampler":{"type":"comparison"}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="sampledTex";entry={"texture":{"multisampled":false}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="sampledTexMS";entry={"texture":{"multisampled":true}} +webgpu:api,validation,state,device_lost,destroy:createBindGroup:resourceType="storageTex";entry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,state,device_lost,destroy:createPipelineLayout:entry={"buffer":{"type":"uniform"}} +webgpu:api,validation,state,device_lost,destroy:createPipelineLayout:entry={"buffer":{"type":"storage"}} +webgpu:api,validation,state,device_lost,destroy:createPipelineLayout:entry={"buffer":{"type":"read-only-storage"}} +webgpu:api,validation,state,device_lost,destroy:createPipelineLayout:entry={"sampler":{"type":"comparison"}} +webgpu:api,validation,state,device_lost,destroy:createPipelineLayout:entry={"sampler":{"type":"filtering"}} +webgpu:api,validation,state,device_lost,destroy:createPipelineLayout:entry={"sampler":{"type":"non-filtering"}} +webgpu:api,validation,state,device_lost,destroy:createPipelineLayout:entry={"texture":{"multisampled":false}} +webgpu:api,validation,state,device_lost,destroy:createPipelineLayout:entry={"texture":{"multisampled":true}} +webgpu:api,validation,state,device_lost,destroy:createPipelineLayout:entry={"storageTexture":{"access":"write-only","format":"rgba8unorm"}} +webgpu:api,validation,state,device_lost,destroy:createShaderModule:stage="VERTEX" +webgpu:api,validation,state,device_lost,destroy:createShaderModule:stage="FRAGMENT" +webgpu:api,validation,state,device_lost,destroy:createShaderModule:stage="COMPUTE" +webgpu:api,validation,state,device_lost,destroy:createComputePipeline: +webgpu:api,validation,state,device_lost,destroy:createRenderPipeline: +webgpu:api,validation,state,device_lost,destroy:createCommandEncoder: +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="r8unorm" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="r8uint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="r8sint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="r16uint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="r16sint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="r16float" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rg8unorm" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rg8uint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rg8sint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="r32uint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="r32sint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="r32float" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rg16uint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rg16sint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rg16float" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba8unorm" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba8uint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba8sint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="bgra8unorm" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="bgra8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgb10a2unorm" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rg32uint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rg32sint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rg32float" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba16uint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba16sint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba16float" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba32uint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba32sint" +webgpu:api,validation,state,device_lost,destroy:createRenderBundleEncoder:format="rgba32float" +webgpu:api,validation,state,device_lost,destroy:createQuerySet:type="occlusion" +webgpu:api,validation,state,device_lost,destroy:createQuerySet:type="timestamp" +webgpu:api,validation,state,device_lost,destroy:command,copyBufferToBuffer: +webgpu:api,validation,state,device_lost,destroy:command,copyBufferToTexture: +webgpu:api,validation,state,device_lost,destroy:command,copyTextureToBuffer: +webgpu:api,validation,state,device_lost,destroy:command,copyTextureToTexture: +webgpu:api,validation,state,device_lost,destroy:command,clearBuffer: +webgpu:api,validation,state,device_lost,destroy:command,writeTimestamp:type="occlusion" +webgpu:api,validation,state,device_lost,destroy:command,writeTimestamp:type="timestamp" +webgpu:api,validation,state,device_lost,destroy:command,resolveQuerySet: +webgpu:api,validation,state,device_lost,destroy:command,computePass,dispatch: +webgpu:api,validation,state,device_lost,destroy:command,renderPass,draw: +webgpu:api,validation,state,device_lost,destroy:command,renderPass,renderBundle: +webgpu:api,validation,state,device_lost,destroy:queue,writeBuffer:numElements=4 +webgpu:api,validation,state,device_lost,destroy:queue,writeBuffer:numElements=8 +webgpu:api,validation,state,device_lost,destroy:queue,writeBuffer:numElements=16 +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r8unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r8snorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r8uint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r8sint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r16uint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r16sint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r16float" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg8unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg8snorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg8uint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg8sint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r32uint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r32sint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="r32float" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg16uint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg16sint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg16float" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba8unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba8snorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba8uint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba8sint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="bgra8unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="bgra8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgb10a2unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg11b10ufloat" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgb9e5ufloat" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg32uint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg32sint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rg32float" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba16uint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba16sint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba16float" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba32uint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba32sint" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,uncompressed_format:format="rgba32float" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc1-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc1-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc2-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc2-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc3-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc3-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc4-r-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc4-r-snorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc5-rg-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc5-rg-snorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc6h-rgb-ufloat" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc6h-rgb-float" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc7-rgba-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="bc7-rgba-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="etc2-rgb8unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="etc2-rgb8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="etc2-rgb8a1unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="etc2-rgb8a1unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="etc2-rgba8unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="etc2-rgba8unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="eac-r11unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="eac-r11snorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="eac-rg11unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="eac-rg11snorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-4x4-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-4x4-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-5x4-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-5x4-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-5x5-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-5x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-6x5-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-6x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-6x6-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-6x6-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-8x5-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-8x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-8x6-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-8x6-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-8x8-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-8x8-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-10x5-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-10x5-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-10x6-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-10x6-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-10x8-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-10x8-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-10x10-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-10x10-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-12x10-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-12x10-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-12x12-unorm" +webgpu:api,validation,state,device_lost,destroy:queue,writeTexture,2d,compressed_format:format="astc-12x12-unorm-srgb" +webgpu:api,validation,state,device_lost,destroy:queue,copyExternalImageToTexture,canvas:canvasType="onscreen";contextType="2d" +webgpu:api,validation,state,device_lost,destroy:queue,copyExternalImageToTexture,canvas:canvasType="onscreen";contextType="webgl" +webgpu:api,validation,state,device_lost,destroy:queue,copyExternalImageToTexture,canvas:canvasType="onscreen";contextType="webgl2" +webgpu:api,validation,state,device_lost,destroy:queue,copyExternalImageToTexture,canvas:canvasType="onscreen";contextType="webgpu" +webgpu:api,validation,state,device_lost,destroy:queue,copyExternalImageToTexture,canvas:canvasType="offscreen";contextType="2d" +webgpu:api,validation,state,device_lost,destroy:queue,copyExternalImageToTexture,canvas:canvasType="offscreen";contextType="webgl" +webgpu:api,validation,state,device_lost,destroy:queue,copyExternalImageToTexture,canvas:canvasType="offscreen";contextType="webgl2" +webgpu:api,validation,state,device_lost,destroy:queue,copyExternalImageToTexture,canvas:canvasType="offscreen";contextType="webgpu" +webgpu:api,validation,state,device_lost,destroy:queue,copyExternalImageToTexture,imageBitmap: +webgpu:api,validation,texture,destroy:base: +webgpu:api,validation,texture,destroy:twice: +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="all";colorTextureState="valid";depthStencilTextureState="valid" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="all";colorTextureState="valid";depthStencilTextureState="destroyedBeforeEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="all";colorTextureState="valid";depthStencilTextureState="destroyedAfterEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="all";colorTextureState="destroyedBeforeEncode";depthStencilTextureState="valid" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="all";colorTextureState="destroyedBeforeEncode";depthStencilTextureState="destroyedBeforeEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="all";colorTextureState="destroyedBeforeEncode";depthStencilTextureState="destroyedAfterEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="all";colorTextureState="destroyedAfterEncode";depthStencilTextureState="valid" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="all";colorTextureState="destroyedAfterEncode";depthStencilTextureState="destroyedBeforeEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="all";colorTextureState="destroyedAfterEncode";depthStencilTextureState="destroyedAfterEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="depth-only";colorTextureState="valid";depthStencilTextureState="valid" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="depth-only";colorTextureState="valid";depthStencilTextureState="destroyedBeforeEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="depth-only";colorTextureState="valid";depthStencilTextureState="destroyedAfterEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="depth-only";colorTextureState="destroyedBeforeEncode";depthStencilTextureState="valid" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="depth-only";colorTextureState="destroyedBeforeEncode";depthStencilTextureState="destroyedBeforeEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="depth-only";colorTextureState="destroyedBeforeEncode";depthStencilTextureState="destroyedAfterEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="depth-only";colorTextureState="destroyedAfterEncode";depthStencilTextureState="valid" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="depth-only";colorTextureState="destroyedAfterEncode";depthStencilTextureState="destroyedBeforeEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="depth-only";colorTextureState="destroyedAfterEncode";depthStencilTextureState="destroyedAfterEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="stencil-only";colorTextureState="valid";depthStencilTextureState="valid" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="stencil-only";colorTextureState="valid";depthStencilTextureState="destroyedBeforeEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="stencil-only";colorTextureState="valid";depthStencilTextureState="destroyedAfterEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="stencil-only";colorTextureState="destroyedBeforeEncode";depthStencilTextureState="valid" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="stencil-only";colorTextureState="destroyedBeforeEncode";depthStencilTextureState="destroyedBeforeEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="stencil-only";colorTextureState="destroyedBeforeEncode";depthStencilTextureState="destroyedAfterEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="stencil-only";colorTextureState="destroyedAfterEncode";depthStencilTextureState="valid" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="stencil-only";colorTextureState="destroyedAfterEncode";depthStencilTextureState="destroyedBeforeEncode" +webgpu:api,validation,texture,destroy:submit_a_destroyed_texture_as_attachment:depthStencilTextureAspect="stencil-only";colorTextureState="destroyedAfterEncode";depthStencilTextureState="destroyedAfterEncode" +webgpu:examples:test_name: +webgpu:examples:not_implemented_yet,without_plan: +webgpu:examples:not_implemented_yet,with_plan: +webgpu:examples:basic: +webgpu:examples:basic,async: +webgpu:examples:basic,plain_cases:x=2;y=2 +webgpu:examples:basic,plain_cases:x=-10;y=-10 +webgpu:examples:basic,plain_cases_private:x=2;y=4 +webgpu:examples:basic,plain_cases_private:x=-10;y=18 +webgpu:examples:basic,builder_cases:x=1;y=1 +webgpu:examples:basic,builder_cases:x=1;y=2 +webgpu:examples:basic,builder_cases:x=2;y=1 +webgpu:examples:basic,builder_cases:x=2;y=2 +webgpu:examples:basic,builder_cases_subcases:x=1 +webgpu:examples:basic,builder_cases_subcases:x=2 +webgpu:examples:basic,builder_subcases: +webgpu:examples:basic,builder_subcases_short: +webgpu:examples:gpu,async: +webgpu:examples:gpu,buffers: +webgpu:examples:gpu,with_texture_compression,bc:textureCompressionBC=false +webgpu:examples:gpu,with_texture_compression,bc:textureCompressionBC=true +webgpu:examples:gpu,with_texture_compression,etc2:textureCompressionETC2=false +webgpu:examples:gpu,with_texture_compression,etc2:textureCompressionETC2=true +webgpu:idl,constants,flags:BufferUsage,count: +webgpu:idl,constants,flags:BufferUsage,values:key="MAP_READ" +webgpu:idl,constants,flags:BufferUsage,values:key="MAP_WRITE" +webgpu:idl,constants,flags:BufferUsage,values:key="COPY_SRC" +webgpu:idl,constants,flags:BufferUsage,values:key="COPY_DST" +webgpu:idl,constants,flags:BufferUsage,values:key="INDEX" +webgpu:idl,constants,flags:BufferUsage,values:key="VERTEX" +webgpu:idl,constants,flags:BufferUsage,values:key="UNIFORM" +webgpu:idl,constants,flags:BufferUsage,values:key="STORAGE" +webgpu:idl,constants,flags:BufferUsage,values:key="INDIRECT" +webgpu:idl,constants,flags:BufferUsage,values:key="QUERY_RESOLVE" +webgpu:idl,constants,flags:TextureUsage,count: +webgpu:idl,constants,flags:TextureUsage,values:key="COPY_SRC" +webgpu:idl,constants,flags:TextureUsage,values:key="COPY_DST" +webgpu:idl,constants,flags:TextureUsage,values:key="TEXTURE_BINDING" +webgpu:idl,constants,flags:TextureUsage,values:key="STORAGE_BINDING" +webgpu:idl,constants,flags:TextureUsage,values:key="RENDER_ATTACHMENT" +webgpu:idl,constants,flags:ColorWrite,count: +webgpu:idl,constants,flags:ColorWrite,values:key="RED" +webgpu:idl,constants,flags:ColorWrite,values:key="GREEN" +webgpu:idl,constants,flags:ColorWrite,values:key="BLUE" +webgpu:idl,constants,flags:ColorWrite,values:key="ALPHA" +webgpu:idl,constants,flags:ColorWrite,values:key="ALL" +webgpu:idl,constants,flags:ShaderStage,count: +webgpu:idl,constants,flags:ShaderStage,values:key="VERTEX" +webgpu:idl,constants,flags:ShaderStage,values:key="FRAGMENT" +webgpu:idl,constants,flags:ShaderStage,values:key="COMPUTE" +webgpu:shader,execution,evaluation_order:binary_arith:name="BothSE" +webgpu:shader,execution,evaluation_order:binary_arith:name="LeftSE" +webgpu:shader,execution,evaluation_order:binary_arith:name="RightSE" +webgpu:shader,execution,evaluation_order:binary_arith:name="ThreeSE" +webgpu:shader,execution,evaluation_order:binary_arith:name="LeftmostSE" +webgpu:shader,execution,evaluation_order:binary_arith:name="RightmostSE" +webgpu:shader,execution,evaluation_order:binary_arith:name="MiddleSE" +webgpu:shader,execution,evaluation_order:binary_arith:name="LiteralAndSEAndVar" +webgpu:shader,execution,evaluation_order:binary_arith:name="VarAndSEAndLiteral" +webgpu:shader,execution,evaluation_order:binary_arith:name="SEAndVarAndLiteral" +webgpu:shader,execution,evaluation_order:binary_arith:name="VarAndLiteralAndSE" +webgpu:shader,execution,evaluation_order:binary_arith:name="MemberAccessAndSE" +webgpu:shader,execution,evaluation_order:binary_arith:name="SEAndMemberAccess" +webgpu:shader,execution,evaluation_order:binary_logical:name="BothSE" +webgpu:shader,execution,evaluation_order:binary_logical:name="LeftSE" +webgpu:shader,execution,evaluation_order:binary_logical:name="RightSE" +webgpu:shader,execution,evaluation_order:binary_logical:name="LeftmostSE" +webgpu:shader,execution,evaluation_order:binary_logical:name="RightmostSE" +webgpu:shader,execution,evaluation_order:binary_logical:name="MiddleSE" +webgpu:shader,execution,evaluation_order:binary_logical:name="ShortCircuit_And_LhsOnly" +webgpu:shader,execution,evaluation_order:binary_logical:name="ShortCircuit_And_LhsAndRhs" +webgpu:shader,execution,evaluation_order:binary_logical:name="ShortCircuit_Or_LhsOnly" +webgpu:shader,execution,evaluation_order:binary_logical:name="ShortCircuit_Or_LhsAndRhs" +webgpu:shader,execution,evaluation_order:binary_mixed:name="ArithAndLogical" +webgpu:shader,execution,evaluation_order:binary_mixed:name="LogicalAndArith" +webgpu:shader,execution,evaluation_order:binary_mixed:name="ArithAndLogical_ShortCircuit" +webgpu:shader,execution,evaluation_order:binary_mixed:name="LogicalAndArith_ShortCircuit" +webgpu:shader,execution,evaluation_order:call:name="OneSE" +webgpu:shader,execution,evaluation_order:call:name="AllSE" +webgpu:shader,execution,evaluation_order:call:name="MiddleNotSE" +webgpu:shader,execution,evaluation_order:index_accessor:name="LeftSE" +webgpu:shader,execution,evaluation_order:index_accessor:name="RightSE" +webgpu:shader,execution,evaluation_order:index_accessor:name="BothSE" +webgpu:shader,execution,evaluation_order:assignment:name="ToArray1D" +webgpu:shader,execution,evaluation_order:assignment:name="ToArray2D" +webgpu:shader,execution,evaluation_order:assignment:name="ToArrayFromArray" +webgpu:shader,execution,evaluation_order:assignment:name="ToArrayIndexedByArrayIndexedBySE" +webgpu:shader,execution,evaluation_order:assignment:name="ToVec_BothSE" +webgpu:shader,execution,evaluation_order:assignment:name="ToVec_LeftSE" +webgpu:shader,execution,evaluation_order:assignment:name="ToVec_RightSE" +webgpu:shader,execution,evaluation_order:type_constructor:name="Struct" +webgpu:shader,execution,evaluation_order:type_constructor:name="Array1D" +webgpu:shader,execution,evaluation_order:type_constructor:name="Array2D" +webgpu:shader,execution,evaluation_order:member_accessor:name="Vec" +webgpu:shader,execution,evaluation_order:member_accessor:name="Struct" +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="i32";inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_or:type="u32";inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="i32";inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_and:type="u32";inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="i32";inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,bitwise:bitwise_exclusive_or:type="u32";inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:addition:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:subtraction:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:multiplication:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:division:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_arithmetic:remainder:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:equals:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:not_equals:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:less_than:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:less_equals:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:greater_than:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,binary,f32_logical:greater_equals:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:abstract_int:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,abs:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acos:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,acosh:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="const";overload="scalar" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="const";overload="vec2" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="const";overload="vec3" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="const";overload="vec4" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="uniform";overload="scalar" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="uniform";overload="vec2" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="uniform";overload="vec3" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="uniform";overload="vec4" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="storage_r";overload="scalar" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="storage_r";overload="vec2" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="storage_r";overload="vec3" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="storage_r";overload="vec4" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="storage_rw";overload="scalar" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="storage_rw";overload="vec2" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="storage_rw";overload="vec3" +webgpu:shader,execution,expression,call,builtin,all:bool:inputSource="storage_rw";overload="vec4" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="const";overload="scalar" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="const";overload="vec2" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="const";overload="vec3" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="const";overload="vec4" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="uniform";overload="scalar" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="uniform";overload="vec2" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="uniform";overload="vec3" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="uniform";overload="vec4" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="storage_r";overload="scalar" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="storage_r";overload="vec2" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="storage_r";overload="vec3" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="storage_r";overload="vec4" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="storage_rw";overload="scalar" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="storage_rw";overload="vec2" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="storage_rw";overload="vec3" +webgpu:shader,execution,expression,call,builtin,any:bool:inputSource="storage_rw";overload="vec4" +webgpu:shader,execution,expression,call,builtin,arrayLength:array: +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asin:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,asinh:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atan2:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,atanh:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,atomicAdd:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicAdd:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicAdd:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicAdd:add:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicAdd:add:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicAdd:add:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicAdd:add:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicAnd:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicAnd:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicAnd:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicAnd:and:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicAnd:and:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicAnd:and:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicAnd:and:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicCompareExchangeWeak:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicCompareExchangeWeak:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicCompareExchangeWeak:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicCompareExchangeWeak:exchange:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicCompareExchangeWeak:exchange:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicCompareExchangeWeak:exchange:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicCompareExchangeWeak:exchange:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicExchange:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicExchange:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicExchange:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicExchange:exchange:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicExchange:exchange:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicExchange:exchange:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicExchange:exchange:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicLoad:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicLoad:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicLoad:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicLoad:load:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicLoad:load:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicLoad:load:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicLoad:load:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicMax:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicMax:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicMax:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicMax:max:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicMax:max:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicMax:max:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicMax:max:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicMin:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicMin:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicMin:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicMin:min:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicMin:min:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicMin:min:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicMin:min:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicOr:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicOr:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicOr:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicOr:or:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicOr:or:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicOr:or:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicOr:or:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicStore:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicStore:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicStore:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicStore:store:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicStore:store:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicStore:store:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicStore:store:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicSub:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicSub:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicSub:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicSub:sub:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicSub:sub:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicSub:sub:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicSub:sub:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicXor:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,atomicXor:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,atomicXor:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,atomicXor:xor:SC="storage";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicXor:xor:SC="storage";T="u32" +webgpu:shader,execution,expression,call,builtin,atomicXor:xor:SC="uniform";T="i32" +webgpu:shader,execution,expression,call,builtin,atomicXor:xor:SC="uniform";T="u32" +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ceil:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_int:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,clamp:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cos:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,cosh:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countLeadingZeros:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countOneBits:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countOneBits:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,countTrailingZeros:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,cross:abstract_float:inputSource="const" +webgpu:shader,execution,expression,call,builtin,cross:abstract_float:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,cross:abstract_float:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,cross:abstract_float:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,cross:f32:inputSource="const" +webgpu:shader,execution,expression,call,builtin,cross:f32:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,cross:f32:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,cross:f32:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,cross:f16:inputSource="const" +webgpu:shader,execution,expression,call,builtin,cross:f16:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,cross:f16:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,cross:f16:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,degrees:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="const";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="const";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="const";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="uniform";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="uniform";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="uniform";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="storage_r";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="storage_r";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="storage_r";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="storage_rw";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="storage_rw";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:abstract_float:inputSource="storage_rw";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="const";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="const";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="const";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="uniform";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="uniform";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="uniform";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="storage_r";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="storage_r";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="storage_r";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="storage_rw";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="storage_rw";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:f32:inputSource="storage_rw";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="const";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="const";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="const";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="uniform";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="uniform";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="uniform";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="storage_r";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="storage_r";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="storage_r";dimension=4 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="storage_rw";dimension=2 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="storage_rw";dimension=3 +webgpu:shader,execution,expression,call,builtin,determinant:f16:inputSource="storage_rw";dimension=4 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,distance:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dot:abstract_int:inputSource="const" +webgpu:shader,execution,expression,call,builtin,dot:abstract_int:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,dot:abstract_int:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,dot:abstract_int:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,dot:i32:inputSource="const" +webgpu:shader,execution,expression,call,builtin,dot:i32:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,dot:i32:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,dot:i32:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,dot:u32:inputSource="const" +webgpu:shader,execution,expression,call,builtin,dot:u32:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,dot:u32:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,dot:u32:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,dot:abstract_float:inputSource="const" +webgpu:shader,execution,expression,call,builtin,dot:abstract_float:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,dot:abstract_float:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,dot:abstract_float:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec2:inputSource="const" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec2:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec2:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec2:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec3:inputSource="const" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec3:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec3:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec3:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec4:inputSource="const" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec4:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec4:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,dot:f32_vec4:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,dot:f16:inputSource="const" +webgpu:shader,execution,expression,call,builtin,dot:f16:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,dot:f16:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,dot:f16:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdx:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdxCoarse:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdxFine:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdy:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdyCoarse:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,dpdyFine:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,exp2:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="const";width=1 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="const";width=2 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="const";width=3 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="const";width=4 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="uniform";width=1 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="uniform";width=2 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="uniform";width=3 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="uniform";width=4 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="storage_r";width=1 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="storage_r";width=2 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="storage_r";width=3 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="storage_r";width=4 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="storage_rw";width=1 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="storage_rw";width=2 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="storage_rw";width=3 +webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="storage_rw";width=4 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="const";width=1 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="const";width=2 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="const";width=3 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="const";width=4 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="uniform";width=1 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="uniform";width=2 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="uniform";width=3 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="uniform";width=4 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="storage_r";width=1 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="storage_r";width=2 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="storage_r";width=3 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="storage_r";width=4 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="storage_rw";width=1 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="storage_rw";width=2 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="storage_rw";width=3 +webgpu:shader,execution,expression,call,builtin,extractBits:i32:inputSource="storage_rw";width=4 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,faceForward:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,floor:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fma:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fract:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,frexp:scalar_f32:inputSource="const" +webgpu:shader,execution,expression,call,builtin,frexp:scalar_f32:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,frexp:scalar_f32:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,frexp:scalar_f32:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,frexp:scalar_f16:inputSource="const" +webgpu:shader,execution,expression,call,builtin,frexp:scalar_f16:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,frexp:scalar_f16:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,frexp:scalar_f16:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,frexp:vector_f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidth:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidthCoarse:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="const";signed=false;width=1 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="const";signed=false;width=2 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="const";signed=false;width=3 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="const";signed=false;width=4 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="const";signed=true;width=1 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="const";signed=true;width=2 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="const";signed=true;width=3 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="const";signed=true;width=4 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="uniform";signed=false;width=1 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="uniform";signed=false;width=2 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="uniform";signed=false;width=3 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="uniform";signed=false;width=4 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="uniform";signed=true;width=1 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="uniform";signed=true;width=2 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="uniform";signed=true;width=3 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="uniform";signed=true;width=4 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_r";signed=false;width=1 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_r";signed=false;width=2 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_r";signed=false;width=3 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_r";signed=false;width=4 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_r";signed=true;width=1 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_r";signed=true;width=2 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_r";signed=true;width=3 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_r";signed=true;width=4 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_rw";signed=false;width=1 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_rw";signed=false;width=2 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_rw";signed=false;width=3 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_rw";signed=false;width=4 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_rw";signed=true;width=1 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_rw";signed=true;width=2 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_rw";signed=true;width=3 +webgpu:shader,execution,expression,call,builtin,insertBits:integer:inputSource="storage_rw";signed=true;width=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,inversesqrt:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,ldexp:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,length:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,log2:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:abstract_int:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,max:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:abstract_int:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,min:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:matching_f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:nonmatching_f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,mix:monmatching_f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,modf:scalar_f32:inputSource="const" +webgpu:shader,execution,expression,call,builtin,modf:scalar_f32:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,modf:scalar_f32:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,modf:scalar_f32:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,modf:scalar_f16:inputSource="const" +webgpu:shader,execution,expression,call,builtin,modf:scalar_f16:inputSource="uniform" +webgpu:shader,execution,expression,call,builtin,modf:scalar_f16:inputSource="storage_r" +webgpu:shader,execution,expression,call,builtin,modf:scalar_f16:inputSource="storage_rw" +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,modf:vector_f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,modf:vector_f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,normalize:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pack2x16float:pack: +webgpu:shader,execution,expression,call,builtin,pack2x16snorm:pack: +webgpu:shader,execution,expression,call,builtin,pack2x16unorm:pack: +webgpu:shader,execution,expression,call,builtin,pack4x8snorm:pack: +webgpu:shader,execution,expression,call,builtin,pack4x8unorm:pack: +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,pow:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,quantizeToF16:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,radians:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reflect:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,refract:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reverseBits:u32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,reverseBits:i32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,round:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,saturate:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="b";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="b";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="b";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="b";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="f";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="f";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="f";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="f";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="i";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="i";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="i";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="i";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="u";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="u";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="u";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="const";component="u";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="b";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="b";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="b";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="b";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="f";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="f";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="f";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="f";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="i";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="i";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="i";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="i";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="u";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="u";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="u";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="uniform";component="u";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="b";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="b";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="b";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="b";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="f";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="f";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="f";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="f";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="i";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="i";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="i";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="i";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="u";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="u";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="u";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_r";component="u";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="b";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="b";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="b";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="b";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="f";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="f";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="f";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="f";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="i";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="i";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="i";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="i";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="u";overload="scalar" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="u";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="u";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:scalar:inputSource="storage_rw";component="u";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="b";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="b";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="b";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="f";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="f";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="f";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="i";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="i";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="i";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="u";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="u";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="const";component="u";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="b";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="b";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="b";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="f";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="f";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="f";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="i";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="i";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="i";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="u";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="u";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="uniform";component="u";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="b";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="b";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="b";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="f";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="f";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="f";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="i";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="i";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="i";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="u";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="u";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_r";component="u";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="b";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="b";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="b";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="f";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="f";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="f";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="i";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="i";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="i";overload="vec4" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="u";overload="vec2" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="u";overload="vec3" +webgpu:shader,execution,expression,call,builtin,select:vector:inputSource="storage_rw";component="u";overload="vec4" +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sign:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sin:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sinh:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,smoothstep:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,sqrt:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,step:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,storageBarrier:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,storageBarrier:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,storageBarrier:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,storageBarrier:barrier: +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tan:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,tanh:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,textureDimension:sampled:texture_type="texture_1d" +webgpu:shader,execution,expression,call,builtin,textureDimension:sampled:texture_type="texture_2d" +webgpu:shader,execution,expression,call,builtin,textureDimension:sampled:texture_type="texture_2d_array" +webgpu:shader,execution,expression,call,builtin,textureDimension:sampled:texture_type="texture_3d" +webgpu:shader,execution,expression,call,builtin,textureDimension:sampled:texture_type="texture_cube" +webgpu:shader,execution,expression,call,builtin,textureDimension:sampled:texture_type="texture_cube_array" +webgpu:shader,execution,expression,call,builtin,textureDimension:sampled:texture_type="texture_multisampled_2d" +webgpu:shader,execution,expression,call,builtin,textureDimension:depth:texture_type="texture_depth_2d" +webgpu:shader,execution,expression,call,builtin,textureDimension:depth:texture_type="texture_depth_2d_array" +webgpu:shader,execution,expression,call,builtin,textureDimension:depth:texture_type="texture_depth_cube" +webgpu:shader,execution,expression,call,builtin,textureDimension:depth:texture_type="texture_depth_cube_array" +webgpu:shader,execution,expression,call,builtin,textureDimension:depth:texture_type="texture_depth_multisampled_2d" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba8unorm" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba8snorm" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba8uint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba8sint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba16uint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba16sint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba16float" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="r32uint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="r32sint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="r32float" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rg32uint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rg32sint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rg32float" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba32uint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba32sint" +webgpu:shader,execution,expression,call,builtin,textureDimension:storage:texel_format="rgba32float" +webgpu:shader,execution,expression,call,builtin,textureDimension:external: +webgpu:shader,execution,expression,call,builtin,textureGather:sampled_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureGather:sampled_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureGather:sampled_array_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureGather:sampled_array_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureGather:depth_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureGather:depth_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureGather:depth_array_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureGather:depth_array_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureGatherCompare:array_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureGatherCompare:array_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureGatherCompare:sampled_array_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureGatherCompare:sampled_array_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="in-bounds";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="in-bounds";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="in-bounds";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="in-bounds";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="i32";coords="x-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="in-bounds";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="in-bounds";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="in-bounds";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="in-bounds";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_1d:C="u32";coords="x-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="in-bounds";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="in-bounds";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="in-bounds";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="in-bounds";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="x-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="i32";coords="y-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="in-bounds";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="in-bounds";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="in-bounds";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="in-bounds";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="x-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_2d:C="u32";coords="y-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="in-bounds";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="in-bounds";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="in-bounds";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="in-bounds";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="x-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="y-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="i32";coords="z-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="in-bounds";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="in-bounds";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="in-bounds";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="in-bounds";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="x-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="y-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-min-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-min-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-min-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-min-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-min-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-min-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-min-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-min-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-max-wrap";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-max-wrap";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-max-wrap";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-max-wrap";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-max-boundary";level=-1 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-max-boundary";level=0 +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-max-boundary";level="numlevels-1" +webgpu:shader,execution,expression,call,builtin,textureLoad:sampled_3d:C="u32";coords="z-max-boundary";level="numlevels" +webgpu:shader,execution,expression,call,builtin,textureLoad:multisampled:texture_type="texture_multisampled_2d" +webgpu:shader,execution,expression,call,builtin,textureLoad:multisampled:texture_type="texture_depth_multisampled_2d" +webgpu:shader,execution,expression,call,builtin,textureLoad:depth: +webgpu:shader,execution,expression,call,builtin,textureLoad:external: +webgpu:shader,execution,expression,call,builtin,textureLoad:arrayed:texture_type="texture_2d_array" +webgpu:shader,execution,expression,call,builtin,textureLoad:arrayed:texture_type="texture_depth_2d_array" +webgpu:shader,execution,expression,call,builtin,textureNumLayers:sampled:texture_type="texture_2d_array" +webgpu:shader,execution,expression,call,builtin,textureNumLayers:sampled:texture_type="texture_cube_array" +webgpu:shader,execution,expression,call,builtin,textureNumLayers:arrayed:texture_type="texture_depth_2d_array" +webgpu:shader,execution,expression,call,builtin,textureNumLayers:arrayed:texture_type="texture_depth_cube_array" +webgpu:shader,execution,expression,call,builtin,textureNumLayers:storage: +webgpu:shader,execution,expression,call,builtin,textureNumLevels:sampled:texture_type="texture_1d" +webgpu:shader,execution,expression,call,builtin,textureNumLevels:sampled:texture_type="texture_2d" +webgpu:shader,execution,expression,call,builtin,textureNumLevels:sampled:texture_type="texture_2d_array" +webgpu:shader,execution,expression,call,builtin,textureNumLevels:sampled:texture_type="texture_3d" +webgpu:shader,execution,expression,call,builtin,textureNumLevels:sampled:texture_type="texture_cube" +webgpu:shader,execution,expression,call,builtin,textureNumLevels:sampled:texture_type="texture_cube_array%60" +webgpu:shader,execution,expression,call,builtin,textureNumLevels:depth:texture_type="texture_depth_2d" +webgpu:shader,execution,expression,call,builtin,textureNumLevels:depth:texture_type="texture_depth_2d_array" +webgpu:shader,execution,expression,call,builtin,textureNumLevels:depth:texture_type="texture_depth_cube" +webgpu:shader,execution,expression,call,builtin,textureNumLevels:depth:texture_type="texture_depth_cube_array" +webgpu:shader,execution,expression,call,builtin,textureNumSamples:sampled: +webgpu:shader,execution,expression,call,builtin,textureNumSamples:depth: +webgpu:shader,execution,expression,call,builtin,textureSample:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,textureSample:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,textureSample:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,textureSample:control_flow:stage="fragment" +webgpu:shader,execution,expression,call,builtin,textureSample:control_flow:stage="vertex" +webgpu:shader,execution,expression,call,builtin,textureSample:control_flow:stage="compute" +webgpu:shader,execution,expression,call,builtin,textureSample:sampled_1d_coords: +webgpu:shader,execution,expression,call,builtin,textureSample:sampled_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSample:sampled_3d_coords:texture_type="texture_3d" +webgpu:shader,execution,expression,call,builtin,textureSample:sampled_3d_coords:texture_type="texture_cube" +webgpu:shader,execution,expression,call,builtin,textureSample:depth_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSample:sampled_array_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSample:sampled_array_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSample:depth_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSample:depth_array_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSample:depth_array_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleBias:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,textureSampleBias:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,textureSampleBias:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,textureSampleBias:control_flow:stage="fragment" +webgpu:shader,execution,expression,call,builtin,textureSampleBias:control_flow:stage="vertex" +webgpu:shader,execution,expression,call,builtin,textureSampleBias:control_flow:stage="compute" +webgpu:shader,execution,expression,call,builtin,textureSampleBias:sampled_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleBias:sampled_3d_coords:texture_type="texture_3d" +webgpu:shader,execution,expression,call,builtin,textureSampleBias:sampled_3d_coords:texture_type="texture_cube" +webgpu:shader,execution,expression,call,builtin,textureSampleBias:arrayed_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleBias:arrayed_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:control_flow:stage="fragment" +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:control_flow:stage="vertex" +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:control_flow:stage="compute" +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:arrayed_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleCompare:arrayed_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:control_flow:stage="fragment" +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:control_flow:stage="vertex" +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:control_flow:stage="compute" +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:arrayed_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleCompareLevel:arrayed_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleGrad:sampled_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleGrad:sampled_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleGrad:sampled_array_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleGrad:sampled_array_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:sampled_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:sampled_array_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:sampled_3d_coords:texture_type="texture_3d" +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:sampled_3d_coords:texture_type="texture_cube" +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:sampled_array_3d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:depth_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:depth_array_2d_coords: +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:depth_3d_coords:texture_type="texture_depth_cube" +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:depth_3d_coords:texture_type="texture_depth_cube_array" +webgpu:shader,execution,expression,call,builtin,textureSampleLevel:external: +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba8unorm" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba8snorm" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba8uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba8sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba16uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba16sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba16float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="r32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="r32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="r32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rg32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rg32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rg32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_1d_coords:format="rgba32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba8unorm" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba8snorm" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba8uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba8sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba16uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba16sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba16float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="r32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="r32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="r32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rg32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rg32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rg32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_2d_coords:format="rgba32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba8unorm" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba8snorm" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba8uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba8sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba16uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba16sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba16float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="r32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="r32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="r32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rg32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rg32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rg32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_array_2d_coords:format="rgba32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba8unorm" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba8snorm" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba8uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba8sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba16uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba16sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba16float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="r32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="r32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="r32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rg32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rg32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rg32float" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba32uint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba32sint" +webgpu:shader,execution,expression,call,builtin,textureStore:store_3d_coords:format="rgba32float" +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="const";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="const";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="const";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="const";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="const";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="const";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="const";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="const";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="const";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="uniform";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="uniform";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="uniform";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="uniform";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="uniform";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="uniform";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="uniform";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="uniform";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="uniform";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_r";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_r";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_r";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_r";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_r";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_r";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_r";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_r";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_r";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_rw";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_rw";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_rw";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_rw";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_rw";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_rw";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_rw";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_rw";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:abstract_float:inputSource="storage_rw";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="const";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="const";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="const";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="const";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="const";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="const";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="const";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="const";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="const";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="uniform";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="uniform";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="uniform";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="uniform";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="uniform";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="uniform";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="uniform";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="uniform";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="uniform";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_r";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_r";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_r";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_r";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_r";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_r";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_r";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_r";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_r";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_rw";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_rw";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_rw";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_rw";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_rw";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_rw";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_rw";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_rw";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f32:inputSource="storage_rw";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="const";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="const";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="const";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="const";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="const";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="const";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="const";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="const";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="const";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="uniform";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="uniform";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="uniform";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="uniform";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="uniform";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="uniform";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="uniform";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="uniform";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="uniform";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_r";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_r";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_r";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_r";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_r";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_r";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_r";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_r";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_r";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_rw";rows=2;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_rw";rows=2;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_rw";rows=2;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_rw";rows=3;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_rw";rows=3;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_rw";rows=3;cols=4 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_rw";rows=4;cols=2 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_rw";rows=4;cols=3 +webgpu:shader,execution,expression,call,builtin,transpose:f16:inputSource="storage_rw";rows=4;cols=4 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:abstract_float:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:f32:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,call,builtin,trunc:f16:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,expression,call,builtin,unpack2x16float:unpack: +webgpu:shader,execution,expression,call,builtin,unpack2x16snorm:unpack: +webgpu:shader,execution,expression,call,builtin,unpack2x16unorm:unpack: +webgpu:shader,execution,expression,call,builtin,unpack4x8snorm:unpack: +webgpu:shader,execution,expression,call,builtin,unpack4x8unorm:unpack: +webgpu:shader,execution,expression,call,builtin,workgroupBarrier:stage:stage="vertex" +webgpu:shader,execution,expression,call,builtin,workgroupBarrier:stage:stage="fragment" +webgpu:shader,execution,expression,call,builtin,workgroupBarrier:stage:stage="compute" +webgpu:shader,execution,expression,call,builtin,workgroupBarrier:barrier: +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="const";vectorize="_undef_" +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="const";vectorize=2 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="const";vectorize=3 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="const";vectorize=4 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="uniform";vectorize="_undef_" +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="uniform";vectorize=2 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="uniform";vectorize=3 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="uniform";vectorize=4 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="storage_r";vectorize="_undef_" +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="storage_r";vectorize=2 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="storage_r";vectorize=3 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="storage_r";vectorize=4 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="storage_rw";vectorize="_undef_" +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="storage_rw";vectorize=2 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="storage_rw";vectorize=3 +webgpu:shader,execution,expression,unary,f32_arithmetic:negation:inputSource="storage_rw";vectorize=4 +webgpu:shader,execution,memory_model,atomicity:atomicity:memType="atomic_storage";testType="inter_workgroup" +webgpu:shader,execution,memory_model,atomicity:atomicity:memType="atomic_storage";testType="intra_workgroup" +webgpu:shader,execution,memory_model,atomicity:atomicity:memType="atomic_workgroup";testType="intra_workgroup" +webgpu:shader,execution,memory_model,barrier:workgroup_barrier_store_load:memType="non_atomic_storage" +webgpu:shader,execution,memory_model,barrier:workgroup_barrier_store_load:memType="non_atomic_workgroup" +webgpu:shader,execution,memory_model,barrier:workgroup_barrier_load_store:memType="non_atomic_storage" +webgpu:shader,execution,memory_model,barrier:workgroup_barrier_load_store:memType="non_atomic_workgroup" +webgpu:shader,execution,memory_model,barrier:workgroup_barrier_store_store:memType="non_atomic_storage" +webgpu:shader,execution,memory_model,barrier:workgroup_barrier_store_store:memType="non_atomic_workgroup" +webgpu:shader,execution,memory_model,coherence:corr:memType="atomic_storage";testType="inter_workgroup" +webgpu:shader,execution,memory_model,coherence:corr:memType="atomic_storage";testType="inter_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:corr:memType="atomic_storage";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:corr:memType="atomic_storage";testType="intra_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:corr:memType="atomic_workgroup";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:corr:memType="atomic_workgroup";testType="intra_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:coww:memType="atomic_storage";testType="inter_workgroup" +webgpu:shader,execution,memory_model,coherence:coww:memType="atomic_storage";testType="inter_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:coww:memType="atomic_storage";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:coww:memType="atomic_storage";testType="intra_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:coww:memType="atomic_workgroup";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:coww:memType="atomic_workgroup";testType="intra_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:cowr:memType="atomic_storage";testType="inter_workgroup" +webgpu:shader,execution,memory_model,coherence:cowr:memType="atomic_storage";testType="inter_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:cowr:memType="atomic_storage";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:cowr:memType="atomic_storage";testType="intra_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:cowr:memType="atomic_workgroup";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:cowr:memType="atomic_workgroup";testType="intra_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:corw1:memType="atomic_storage";testType="inter_workgroup" +webgpu:shader,execution,memory_model,coherence:corw1:memType="atomic_storage";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:corw1:memType="atomic_workgroup";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:corw2:memType="atomic_storage";testType="inter_workgroup" +webgpu:shader,execution,memory_model,coherence:corw2:memType="atomic_storage";testType="inter_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:corw2:memType="atomic_storage";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:corw2:memType="atomic_storage";testType="intra_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,coherence:corw2:memType="atomic_workgroup";testType="intra_workgroup" +webgpu:shader,execution,memory_model,coherence:corw2:memType="atomic_workgroup";testType="intra_workgroup";extraFlags="rmw_variant" +webgpu:shader,execution,memory_model,weak:message_passing:memType="atomic_workgroup" +webgpu:shader,execution,memory_model,weak:message_passing:memType="atomic_storage" +webgpu:shader,execution,memory_model,weak:store:memType="atomic_workgroup" +webgpu:shader,execution,memory_model,weak:store:memType="atomic_storage" +webgpu:shader,execution,memory_model,weak:load_buffer:memType="atomic_workgroup" +webgpu:shader,execution,memory_model,weak:load_buffer:memType="atomic_storage" +webgpu:shader,execution,memory_model,weak:read:memType="atomic_workgroup" +webgpu:shader,execution,memory_model,weak:read:memType="atomic_storage" +webgpu:shader,execution,memory_model,weak:store_buffer:memType="atomic_workgroup" +webgpu:shader,execution,memory_model,weak:store_buffer:memType="atomic_storage" +webgpu:shader,execution,memory_model,weak:2_plus_2_write:memType="atomic_workgroup" +webgpu:shader,execution,memory_model,weak:2_plus_2_write:memType="atomic_storage" +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read";access="read";dynamicOffset=false;containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read";access="read";dynamicOffset=false;containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read";access="read";dynamicOffset=false;containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read";access="read";dynamicOffset=true;containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read";access="read";dynamicOffset=true;containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read";access="read";dynamicOffset=true;containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="read";dynamicOffset=false;containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="read";dynamicOffset=false;containerType="array";isAtomic=true +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="read";dynamicOffset=false;containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="read";dynamicOffset=false;containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="read";dynamicOffset=true;containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="read";dynamicOffset=true;containerType="array";isAtomic=true +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="read";dynamicOffset=true;containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="read";dynamicOffset=true;containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="write";dynamicOffset=false;containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="write";dynamicOffset=false;containerType="array";isAtomic=true +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="write";dynamicOffset=false;containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="write";dynamicOffset=false;containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="write";dynamicOffset=true;containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="write";dynamicOffset=true;containerType="array";isAtomic=true +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="write";dynamicOffset=true;containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="write";dynamicOffset=true;containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="uniform";access="read";dynamicOffset=false;containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="uniform";access="read";dynamicOffset=false;containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="uniform";access="read";dynamicOffset=false;containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="uniform";access="read";dynamicOffset=true;containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="uniform";access="read";dynamicOffset=true;containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="uniform";access="read";dynamicOffset=true;containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="private";access="read";containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="private";access="read";containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="private";access="read";containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="private";access="write";containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="private";access="write";containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="private";access="write";containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="function";access="read";containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="function";access="read";containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="function";access="read";containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="function";access="write";containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="function";access="write";containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="function";access="write";containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="workgroup";access="read";containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="workgroup";access="read";containerType="array";isAtomic=true +webgpu:shader,execution,robust_access:linear_memory:storageClass="workgroup";access="read";containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="workgroup";access="read";containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="workgroup";access="write";containerType="array";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="workgroup";access="write";containerType="array";isAtomic=true +webgpu:shader,execution,robust_access:linear_memory:storageClass="workgroup";access="write";containerType="matrix";isAtomic=false +webgpu:shader,execution,robust_access:linear_memory:storageClass="workgroup";access="write";containerType="vector";isAtomic=false +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="vertexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=false;indirect=true;drawCallTestParameter="firstVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=false;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="baseVertex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="vertexCountInIndexBuffer";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="indexCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="instanceCount";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x2";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x3";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=0;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=false;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=false;errorScale=1000000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=0 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=4 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=100 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=10000 +webgpu:shader,execution,robust_access_vertex:vertex_buffer_access:indexed=true;indirect=true;drawCallTestParameter="firstIndex";type="float32x4";additionalBuffers=4;partialLastNumber=true;offsetVertexBuffer=true;errorScale=1000000 +webgpu:shader,execution,sampling,gradients_in_varying_loop:derivative_in_varying_loop:iterations=1 +webgpu:shader,execution,sampling,gradients_in_varying_loop:derivative_in_varying_loop:iterations=2 +webgpu:shader,execution,sampling,gradients_in_varying_loop:derivative_in_varying_loop:iterations=3 +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="param";dispatch="direct";groupSize={"x":1,"y":1,"z":1};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="param";dispatch="direct";groupSize={"x":1,"y":1,"z":1};numGroups={"x":8,"y":4,"z":2} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="param";dispatch="direct";groupSize={"x":8,"y":4,"z":2};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="param";dispatch="direct";groupSize={"x":3,"y":7,"z":5};numGroups={"x":13,"y":9,"z":11} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="param";dispatch="indirect";groupSize={"x":1,"y":1,"z":1};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="param";dispatch="indirect";groupSize={"x":1,"y":1,"z":1};numGroups={"x":8,"y":4,"z":2} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="param";dispatch="indirect";groupSize={"x":8,"y":4,"z":2};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="param";dispatch="indirect";groupSize={"x":3,"y":7,"z":5};numGroups={"x":13,"y":9,"z":11} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="struct";dispatch="direct";groupSize={"x":1,"y":1,"z":1};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="struct";dispatch="direct";groupSize={"x":1,"y":1,"z":1};numGroups={"x":8,"y":4,"z":2} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="struct";dispatch="direct";groupSize={"x":8,"y":4,"z":2};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="struct";dispatch="direct";groupSize={"x":3,"y":7,"z":5};numGroups={"x":13,"y":9,"z":11} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="struct";dispatch="indirect";groupSize={"x":1,"y":1,"z":1};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="struct";dispatch="indirect";groupSize={"x":1,"y":1,"z":1};numGroups={"x":8,"y":4,"z":2} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="struct";dispatch="indirect";groupSize={"x":8,"y":4,"z":2};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="struct";dispatch="indirect";groupSize={"x":3,"y":7,"z":5};numGroups={"x":13,"y":9,"z":11} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="mixed";dispatch="direct";groupSize={"x":1,"y":1,"z":1};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="mixed";dispatch="direct";groupSize={"x":1,"y":1,"z":1};numGroups={"x":8,"y":4,"z":2} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="mixed";dispatch="direct";groupSize={"x":8,"y":4,"z":2};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="mixed";dispatch="direct";groupSize={"x":3,"y":7,"z":5};numGroups={"x":13,"y":9,"z":11} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="mixed";dispatch="indirect";groupSize={"x":1,"y":1,"z":1};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="mixed";dispatch="indirect";groupSize={"x":1,"y":1,"z":1};numGroups={"x":8,"y":4,"z":2} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="mixed";dispatch="indirect";groupSize={"x":8,"y":4,"z":2};numGroups={"x":1,"y":1,"z":1} +webgpu:shader,execution,shader_io,compute_builtins:inputs:method="mixed";dispatch="indirect";groupSize={"x":3,"y":7,"z":5};numGroups={"x":13,"y":9,"z":11} +webgpu:shader,execution,shader_io,shared_structs:shared_with_buffer: +webgpu:shader,execution,shader_io,shared_structs:shared_between_stages: +webgpu:shader,execution,shader_io,shared_structs:shared_with_non_entry_point_function: +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=30 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,1];batch__=31 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=30 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,32,1];batch__=31 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=30 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[64,1,1];batch__=31 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=30 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,48];batch__=31 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=30 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,47,1];batch__=31 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=30 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[33,1,1];batch__=31 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=30 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[1,1,63];batch__=31 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=30 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[8,8,2];batch__=31 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=30 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="workgroup";workgroupSize=[7,7,3];batch__=31 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="private";workgroupSize=[1,1,1];batch__=29 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=0 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=1 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=2 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=3 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=4 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=5 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=6 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=7 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=8 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=9 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=10 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=11 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=12 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=13 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=14 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=15 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=16 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=17 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=18 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=19 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=20 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=21 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=22 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=23 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=24 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=25 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=26 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=27 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=28 +webgpu:shader,execution,zero_init:compute,zero_init:storageClass="function";workgroupSize=[1,1,1];batch__=29 +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(1)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(4)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(4i)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(0x4)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(4,)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(1073741824)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40%5Ctalign%5Ct(4)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40%2F%5Ecomment%5E%2Falign%2F%5Ecomment%5E%2F(4)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40malign(4)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align()" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align%204)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(4" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(4,%202)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(3)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(val)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(1.0)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(4u)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(4f)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(4h)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(0)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(-4)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(2147483646)" +webgpu:shader,validation,parse,align:missing_attribute_on_param_struct:align="%40align(2147483648)" +webgpu:shader,validation,parse,blankspace:null_characters:contains_null=true;placement="comment" +webgpu:shader,validation,parse,blankspace:null_characters:contains_null=true;placement="delimiter" +webgpu:shader,validation,parse,blankspace:null_characters:contains_null=true;placement="eol" +webgpu:shader,validation,parse,blankspace:null_characters:contains_null=false;placement="comment" +webgpu:shader,validation,parse,blankspace:null_characters:contains_null=false;placement="delimiter" +webgpu:shader,validation,parse,blankspace:null_characters:contains_null=false;placement="eol" +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%20","space"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%5Ct","horizontal_tab"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%5Cn","line_feed"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%5Cu000b","vertical_tab"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%5Cf","form_feed"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%5Cr","carriage_return"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%C2%85","next_line"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%E2%80%8E","left_to_right_mark"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%E2%80%8F","right_to_left_mark"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%E2%80%A8","line_separator"] +webgpu:shader,validation,parse,blankspace:blankspace:blankspace=["%E2%80%A9","paragraph_separator"] +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin(position)" +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin(position,)" +webgpu:shader,validation,parse,builtin:parse:builtin="%40%20%5Cn%20builtin(position)" +webgpu:shader,validation,parse,builtin:parse:builtin="%40%2F%5E%20comment%20%5E%2Fbuiltin%2F%5E%20comment%20%5E%2F%5Cn%5Cn(%5Ct%2F%5Ecomment%5E%2Fposition%2F%5Ecomment%5E%2F)" +webgpu:shader,validation,parse,builtin:parse:builtin="%40abuiltin(position)" +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin" +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin()" +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin%20position" +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin%20position)" +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin(position" +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin(position,%20frag_depth)" +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin(identifier)" +webgpu:shader,validation,parse,builtin:parse:builtin="%40builtin(2)" +webgpu:shader,validation,parse,comments:comments: +webgpu:shader,validation,parse,comments:line_comment_eof: +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%20","space"] +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%5Ct","tab"] +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%5Cn","line_feed"] +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%5Cu000b","vertical_tab"] +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%5Cf","form_feed"] +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%5Cr","carriage_return"] +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%5Cr%5Cn","carriage_return_line_feed"] +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%C2%85","next_line"] +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%E2%80%A8","line_separator"] +webgpu:shader,validation,parse,comments:line_comment_terminators:blankspace=["%E2%80%A9","paragraph_separator"] +webgpu:shader,validation,parse,comments:unterminated_block_comment:terminated=true +webgpu:shader,validation,parse,comments:unterminated_block_comment:terminated=false +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Foo" +webgpu:shader,validation,parse,identifiers:identifiers:ident="FOO" +webgpu:shader,validation,parse,identifiers:identifiers:ident="_0" +webgpu:shader,validation,parse,identifiers:identifiers:ident="_foo0" +webgpu:shader,validation,parse,identifiers:identifiers:ident="_0foo" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo__0" +webgpu:shader,validation,parse,identifiers:identifiers:ident="%CE%94%CE%AD%CE%BB%CF%84%CE%B1" +webgpu:shader,validation,parse,identifiers:identifiers:ident="r%C3%A9flexion" +webgpu:shader,validation,parse,identifiers:identifiers:ident="%D0%9A%D1%8B%D0%B7%D1%8B%D0%BB" +webgpu:shader,validation,parse,identifiers:identifiers:ident="%F0%90%B0%93%F0%90%B0%8F%F0%90%B0%87" +webgpu:shader,validation,parse,identifiers:identifiers:ident="%E6%9C%9D%E7%84%BC%E3%81%91" +webgpu:shader,validation,parse,identifiers:identifiers:ident="%D8%B3%D9%84%D8%A7%D9%85" +webgpu:shader,validation,parse,identifiers:identifiers:ident="%EA%B2%80%EC%A0%95" +webgpu:shader,validation,parse,identifiers:identifiers:ident="%D7%A9%D6%B8%D7%81%D7%9C%D7%95%D6%B9%D7%9D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="%E0%A4%97%E0%A5%81%E0%A4%B2%E0%A4%BE%E0%A4%AC%E0%A5%80" +webgpu:shader,validation,parse,identifiers:identifiers:ident="%D6%83%D5%AB%D6%80%D5%B8%D6%82%D5%A6" +webgpu:shader,validation,parse,identifiers:identifiers:ident="_" +webgpu:shader,validation,parse,identifiers:identifiers:ident="__" +webgpu:shader,validation,parse,identifiers:identifiers:ident="__foo" +webgpu:shader,validation,parse,identifiers:identifiers:ident="0foo" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo.bar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo-bar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo%2Bbar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo%23bar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo!bar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo%5C%5Cbar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo%2Fbar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo,bar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo%40bar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="foo::bar" +webgpu:shader,validation,parse,identifiers:identifiers:ident="array" +webgpu:shader,validation,parse,identifiers:identifiers:ident="atomic" +webgpu:shader,validation,parse,identifiers:identifiers:ident="bool" +webgpu:shader,validation,parse,identifiers:identifiers:ident="f32" +webgpu:shader,validation,parse,identifiers:identifiers:ident="f16" +webgpu:shader,validation,parse,identifiers:identifiers:ident="i32" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat2x2" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat2x3" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat2x4" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat3x2" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat3x3" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat3x4" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat4x2" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat4x3" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat4x4" +webgpu:shader,validation,parse,identifiers:identifiers:ident="override" +webgpu:shader,validation,parse,identifiers:identifiers:ident="ptr" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler_comparison" +webgpu:shader,validation,parse,identifiers:identifiers:ident="struct" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_1d" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_2d" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_2d_array" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_3d" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_cube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_cube_array" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_multisampled_2d" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_storage_1d" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_storage_2d" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_storage_2d_array" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_storage_3d" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_depth_2d" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_depth_2d_array" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_depth_cube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_depth_cube_array" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture_depth_multisampled_2d" +webgpu:shader,validation,parse,identifiers:identifiers:ident="u32" +webgpu:shader,validation,parse,identifiers:identifiers:ident="vec2" +webgpu:shader,validation,parse,identifiers:identifiers:ident="vec3" +webgpu:shader,validation,parse,identifiers:identifiers:ident="vec4" +webgpu:shader,validation,parse,identifiers:identifiers:ident="bitcast" +webgpu:shader,validation,parse,identifiers:identifiers:ident="break" +webgpu:shader,validation,parse,identifiers:identifiers:ident="case" +webgpu:shader,validation,parse,identifiers:identifiers:ident="const" +webgpu:shader,validation,parse,identifiers:identifiers:ident="continue" +webgpu:shader,validation,parse,identifiers:identifiers:ident="continuing" +webgpu:shader,validation,parse,identifiers:identifiers:ident="default" +webgpu:shader,validation,parse,identifiers:identifiers:ident="discard" +webgpu:shader,validation,parse,identifiers:identifiers:ident="else" +webgpu:shader,validation,parse,identifiers:identifiers:ident="enable" +webgpu:shader,validation,parse,identifiers:identifiers:ident="fallthrough" +webgpu:shader,validation,parse,identifiers:identifiers:ident="false" +webgpu:shader,validation,parse,identifiers:identifiers:ident="fn" +webgpu:shader,validation,parse,identifiers:identifiers:ident="for" +webgpu:shader,validation,parse,identifiers:identifiers:ident="function" +webgpu:shader,validation,parse,identifiers:identifiers:ident="if" +webgpu:shader,validation,parse,identifiers:identifiers:ident="let" +webgpu:shader,validation,parse,identifiers:identifiers:ident="loop" +webgpu:shader,validation,parse,identifiers:identifiers:ident="private" +webgpu:shader,validation,parse,identifiers:identifiers:ident="return" +webgpu:shader,validation,parse,identifiers:identifiers:ident="storage" +webgpu:shader,validation,parse,identifiers:identifiers:ident="switch" +webgpu:shader,validation,parse,identifiers:identifiers:ident="true" +webgpu:shader,validation,parse,identifiers:identifiers:ident="type" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uniform" +webgpu:shader,validation,parse,identifiers:identifiers:ident="var" +webgpu:shader,validation,parse,identifiers:identifiers:ident="while" +webgpu:shader,validation,parse,identifiers:identifiers:ident="workgroup" +webgpu:shader,validation,parse,identifiers:identifiers:ident="AppendStructuredBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="BlendState" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Buffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="ByteAddressBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="CompileShader" +webgpu:shader,validation,parse,identifiers:identifiers:ident="ComputeShader" +webgpu:shader,validation,parse,identifiers:identifiers:ident="ConsumeStructuredBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="DepthStencilState" +webgpu:shader,validation,parse,identifiers:identifiers:ident="DepthStencilView" +webgpu:shader,validation,parse,identifiers:identifiers:ident="DomainShader" +webgpu:shader,validation,parse,identifiers:identifiers:ident="GeometryShader" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Hullshader" +webgpu:shader,validation,parse,identifiers:identifiers:ident="InputPatch" +webgpu:shader,validation,parse,identifiers:identifiers:ident="LineStream" +webgpu:shader,validation,parse,identifiers:identifiers:ident="NULL" +webgpu:shader,validation,parse,identifiers:identifiers:ident="OutputPatch" +webgpu:shader,validation,parse,identifiers:identifiers:ident="PixelShader" +webgpu:shader,validation,parse,identifiers:identifiers:ident="PointStream" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RWBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RWByteAddressBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RWStructuredBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RWTexture1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RWTexture1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RWTexture2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RWTexture2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RWTexture3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RasterizerState" +webgpu:shader,validation,parse,identifiers:identifiers:ident="RenderTargetView" +webgpu:shader,validation,parse,identifiers:identifiers:ident="SamplerComparisonState" +webgpu:shader,validation,parse,identifiers:identifiers:ident="SamplerState" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Self" +webgpu:shader,validation,parse,identifiers:identifiers:ident="StructuredBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Texture1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Texture1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Texture2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Texture2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Texture2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Texture2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="Texture3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="TextureCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="TextureCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="TriangleStream" +webgpu:shader,validation,parse,identifiers:identifiers:ident="VertexShader" +webgpu:shader,validation,parse,identifiers:identifiers:ident="abstract" +webgpu:shader,validation,parse,identifiers:identifiers:ident="active" +webgpu:shader,validation,parse,identifiers:identifiers:ident="alignas" +webgpu:shader,validation,parse,identifiers:identifiers:ident="alignof" +webgpu:shader,validation,parse,identifiers:identifiers:ident="as" +webgpu:shader,validation,parse,identifiers:identifiers:ident="asm" +webgpu:shader,validation,parse,identifiers:identifiers:ident="asm_fragment" +webgpu:shader,validation,parse,identifiers:identifiers:ident="async" +webgpu:shader,validation,parse,identifiers:identifiers:ident="atomic_uint" +webgpu:shader,validation,parse,identifiers:identifiers:ident="attribute" +webgpu:shader,validation,parse,identifiers:identifiers:ident="auto" +webgpu:shader,validation,parse,identifiers:identifiers:ident="await" +webgpu:shader,validation,parse,identifiers:identifiers:ident="become" +webgpu:shader,validation,parse,identifiers:identifiers:ident="bf16" +webgpu:shader,validation,parse,identifiers:identifiers:ident="binding_array" +webgpu:shader,validation,parse,identifiers:identifiers:ident="cast" +webgpu:shader,validation,parse,identifiers:identifiers:ident="catch" +webgpu:shader,validation,parse,identifiers:identifiers:ident="cbuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="centroid" +webgpu:shader,validation,parse,identifiers:identifiers:ident="char" +webgpu:shader,validation,parse,identifiers:identifiers:ident="class" +webgpu:shader,validation,parse,identifiers:identifiers:ident="co_await" +webgpu:shader,validation,parse,identifiers:identifiers:ident="co_return" +webgpu:shader,validation,parse,identifiers:identifiers:ident="co_yield" +webgpu:shader,validation,parse,identifiers:identifiers:ident="coherent" +webgpu:shader,validation,parse,identifiers:identifiers:ident="column_major" +webgpu:shader,validation,parse,identifiers:identifiers:ident="common" +webgpu:shader,validation,parse,identifiers:identifiers:ident="compile" +webgpu:shader,validation,parse,identifiers:identifiers:ident="compile_fragment" +webgpu:shader,validation,parse,identifiers:identifiers:ident="concept" +webgpu:shader,validation,parse,identifiers:identifiers:ident="const_cast" +webgpu:shader,validation,parse,identifiers:identifiers:ident="consteval" +webgpu:shader,validation,parse,identifiers:identifiers:ident="constexpr" +webgpu:shader,validation,parse,identifiers:identifiers:ident="constinit" +webgpu:shader,validation,parse,identifiers:identifiers:ident="crate" +webgpu:shader,validation,parse,identifiers:identifiers:ident="debugger" +webgpu:shader,validation,parse,identifiers:identifiers:ident="decltype" +webgpu:shader,validation,parse,identifiers:identifiers:ident="delete" +webgpu:shader,validation,parse,identifiers:identifiers:ident="demote" +webgpu:shader,validation,parse,identifiers:identifiers:ident="demote_to_helper" +webgpu:shader,validation,parse,identifiers:identifiers:ident="do" +webgpu:shader,validation,parse,identifiers:identifiers:ident="dword" +webgpu:shader,validation,parse,identifiers:identifiers:ident="dynamic_cast" +webgpu:shader,validation,parse,identifiers:identifiers:ident="enum" +webgpu:shader,validation,parse,identifiers:identifiers:ident="explicit" +webgpu:shader,validation,parse,identifiers:identifiers:ident="export" +webgpu:shader,validation,parse,identifiers:identifiers:ident="extends" +webgpu:shader,validation,parse,identifiers:identifiers:ident="extern" +webgpu:shader,validation,parse,identifiers:identifiers:ident="external" +webgpu:shader,validation,parse,identifiers:identifiers:ident="f64" +webgpu:shader,validation,parse,identifiers:identifiers:ident="filter" +webgpu:shader,validation,parse,identifiers:identifiers:ident="final" +webgpu:shader,validation,parse,identifiers:identifiers:ident="finally" +webgpu:shader,validation,parse,identifiers:identifiers:ident="fixed" +webgpu:shader,validation,parse,identifiers:identifiers:ident="flat" +webgpu:shader,validation,parse,identifiers:identifiers:ident="friend" +webgpu:shader,validation,parse,identifiers:identifiers:ident="from" +webgpu:shader,validation,parse,identifiers:identifiers:ident="fvec2" +webgpu:shader,validation,parse,identifiers:identifiers:ident="fvec3" +webgpu:shader,validation,parse,identifiers:identifiers:ident="fvec4" +webgpu:shader,validation,parse,identifiers:identifiers:ident="fxgroup" +webgpu:shader,validation,parse,identifiers:identifiers:ident="get" +webgpu:shader,validation,parse,identifiers:identifiers:ident="goto" +webgpu:shader,validation,parse,identifiers:identifiers:ident="groupshared" +webgpu:shader,validation,parse,identifiers:identifiers:ident="handle" +webgpu:shader,validation,parse,identifiers:identifiers:ident="highp" +webgpu:shader,validation,parse,identifiers:identifiers:ident="hvec2" +webgpu:shader,validation,parse,identifiers:identifiers:ident="hvec3" +webgpu:shader,validation,parse,identifiers:identifiers:ident="hvec4" +webgpu:shader,validation,parse,identifiers:identifiers:ident="i16" +webgpu:shader,validation,parse,identifiers:identifiers:ident="i64" +webgpu:shader,validation,parse,identifiers:identifiers:ident="i8" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimage1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimage1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimage2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimage2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimage2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimage2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimage2DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimage3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimageBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimageCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="iimageCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="image1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="image1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="image2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="image2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="image2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="image2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="image2DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="image3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="imageBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="imageCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="imageCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="impl" +webgpu:shader,validation,parse,identifiers:identifiers:ident="implements" +webgpu:shader,validation,parse,identifiers:identifiers:ident="import" +webgpu:shader,validation,parse,identifiers:identifiers:ident="inline" +webgpu:shader,validation,parse,identifiers:identifiers:ident="inout" +webgpu:shader,validation,parse,identifiers:identifiers:ident="instanceof" +webgpu:shader,validation,parse,identifiers:identifiers:ident="interface" +webgpu:shader,validation,parse,identifiers:identifiers:ident="invariant" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isampler1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isampler1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isampler2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isampler2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isampler2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isampler2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isampler2DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isampler3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isamplerBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isamplerCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isamplerCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isubpassInput" +webgpu:shader,validation,parse,identifiers:identifiers:ident="isubpassInputMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itexture1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itexture1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itexture2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itexture2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itexture2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itexture2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itexture2DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itexture3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itextureBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itextureCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="itextureCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="layout" +webgpu:shader,validation,parse,identifiers:identifiers:ident="line" +webgpu:shader,validation,parse,identifiers:identifiers:ident="lineadj" +webgpu:shader,validation,parse,identifiers:identifiers:ident="linear" +webgpu:shader,validation,parse,identifiers:identifiers:ident="lowp" +webgpu:shader,validation,parse,identifiers:identifiers:ident="macro" +webgpu:shader,validation,parse,identifiers:identifiers:ident="macro_rules" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mat" +webgpu:shader,validation,parse,identifiers:identifiers:ident="match" +webgpu:shader,validation,parse,identifiers:identifiers:ident="matrix" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mediump" +webgpu:shader,validation,parse,identifiers:identifiers:ident="meta" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mod" +webgpu:shader,validation,parse,identifiers:identifiers:ident="module" +webgpu:shader,validation,parse,identifiers:identifiers:ident="move" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mut" +webgpu:shader,validation,parse,identifiers:identifiers:ident="mutable" +webgpu:shader,validation,parse,identifiers:identifiers:ident="namespace" +webgpu:shader,validation,parse,identifiers:identifiers:ident="new" +webgpu:shader,validation,parse,identifiers:identifiers:ident="nil" +webgpu:shader,validation,parse,identifiers:identifiers:ident="noexcept" +webgpu:shader,validation,parse,identifiers:identifiers:ident="noinline" +webgpu:shader,validation,parse,identifiers:identifiers:ident="nointerpolation" +webgpu:shader,validation,parse,identifiers:identifiers:ident="noperspective" +webgpu:shader,validation,parse,identifiers:identifiers:ident="null" +webgpu:shader,validation,parse,identifiers:identifiers:ident="nullptr" +webgpu:shader,validation,parse,identifiers:identifiers:ident="of" +webgpu:shader,validation,parse,identifiers:identifiers:ident="operator" +webgpu:shader,validation,parse,identifiers:identifiers:ident="package" +webgpu:shader,validation,parse,identifiers:identifiers:ident="packoffset" +webgpu:shader,validation,parse,identifiers:identifiers:ident="partition" +webgpu:shader,validation,parse,identifiers:identifiers:ident="pass" +webgpu:shader,validation,parse,identifiers:identifiers:ident="patch" +webgpu:shader,validation,parse,identifiers:identifiers:ident="pixelfragment" +webgpu:shader,validation,parse,identifiers:identifiers:ident="point" +webgpu:shader,validation,parse,identifiers:identifiers:ident="precise" +webgpu:shader,validation,parse,identifiers:identifiers:ident="precision" +webgpu:shader,validation,parse,identifiers:identifiers:ident="premerge" +webgpu:shader,validation,parse,identifiers:identifiers:ident="priv" +webgpu:shader,validation,parse,identifiers:identifiers:ident="protected" +webgpu:shader,validation,parse,identifiers:identifiers:ident="pub" +webgpu:shader,validation,parse,identifiers:identifiers:ident="public" +webgpu:shader,validation,parse,identifiers:identifiers:ident="readonly" +webgpu:shader,validation,parse,identifiers:identifiers:ident="ref" +webgpu:shader,validation,parse,identifiers:identifiers:ident="regardless" +webgpu:shader,validation,parse,identifiers:identifiers:ident="register" +webgpu:shader,validation,parse,identifiers:identifiers:ident="reinterpret_cast" +webgpu:shader,validation,parse,identifiers:identifiers:ident="requires" +webgpu:shader,validation,parse,identifiers:identifiers:ident="resource" +webgpu:shader,validation,parse,identifiers:identifiers:ident="restrict" +webgpu:shader,validation,parse,identifiers:identifiers:ident="row_major" +webgpu:shader,validation,parse,identifiers:identifiers:ident="samper" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sample" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler1DArrayShadow" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler1DShadow" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler2DArrayShadow" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler2DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler2DRectShadow" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler2DShadow" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sampler3DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="samplerBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="samplerCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="samplerCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="samplerCubeArrayShadow" +webgpu:shader,validation,parse,identifiers:identifiers:ident="samplerCubeShadow" +webgpu:shader,validation,parse,identifiers:identifiers:ident="samplerShadow" +webgpu:shader,validation,parse,identifiers:identifiers:ident="self" +webgpu:shader,validation,parse,identifiers:identifiers:ident="set" +webgpu:shader,validation,parse,identifiers:identifiers:ident="shared" +webgpu:shader,validation,parse,identifiers:identifiers:ident="signed" +webgpu:shader,validation,parse,identifiers:identifiers:ident="sizeof" +webgpu:shader,validation,parse,identifiers:identifiers:ident="smooth" +webgpu:shader,validation,parse,identifiers:identifiers:ident="snorm" +webgpu:shader,validation,parse,identifiers:identifiers:ident="stateblock" +webgpu:shader,validation,parse,identifiers:identifiers:ident="stateblock_state" +webgpu:shader,validation,parse,identifiers:identifiers:ident="static" +webgpu:shader,validation,parse,identifiers:identifiers:ident="static_assert" +webgpu:shader,validation,parse,identifiers:identifiers:ident="static_cast" +webgpu:shader,validation,parse,identifiers:identifiers:ident="std" +webgpu:shader,validation,parse,identifiers:identifiers:ident="string" +webgpu:shader,validation,parse,identifiers:identifiers:ident="subpassInput" +webgpu:shader,validation,parse,identifiers:identifiers:ident="subpassInputMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="subroutine" +webgpu:shader,validation,parse,identifiers:identifiers:ident="super" +webgpu:shader,validation,parse,identifiers:identifiers:ident="superp" +webgpu:shader,validation,parse,identifiers:identifiers:ident="target" +webgpu:shader,validation,parse,identifiers:identifiers:ident="tbuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="technique" +webgpu:shader,validation,parse,identifiers:identifiers:ident="technique10" +webgpu:shader,validation,parse,identifiers:identifiers:ident="technique11" +webgpu:shader,validation,parse,identifiers:identifiers:ident="template" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture2DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="texture3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="textureBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="textureCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="textureCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="this" +webgpu:shader,validation,parse,identifiers:identifiers:ident="thread_local" +webgpu:shader,validation,parse,identifiers:identifiers:ident="throw" +webgpu:shader,validation,parse,identifiers:identifiers:ident="trait" +webgpu:shader,validation,parse,identifiers:identifiers:ident="triangle" +webgpu:shader,validation,parse,identifiers:identifiers:ident="triangleadj" +webgpu:shader,validation,parse,identifiers:identifiers:ident="try" +webgpu:shader,validation,parse,identifiers:identifiers:ident="typedef" +webgpu:shader,validation,parse,identifiers:identifiers:ident="typeid" +webgpu:shader,validation,parse,identifiers:identifiers:ident="typename" +webgpu:shader,validation,parse,identifiers:identifiers:ident="typeof" +webgpu:shader,validation,parse,identifiers:identifiers:ident="u16" +webgpu:shader,validation,parse,identifiers:identifiers:ident="u64" +webgpu:shader,validation,parse,identifiers:identifiers:ident="u8" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimage1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimage1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimage2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimage2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimage2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimage2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimage2DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimage3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimageBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimageCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="uimageCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="union" +webgpu:shader,validation,parse,identifiers:identifiers:ident="unless" +webgpu:shader,validation,parse,identifiers:identifiers:ident="unorm" +webgpu:shader,validation,parse,identifiers:identifiers:ident="unsafe" +webgpu:shader,validation,parse,identifiers:identifiers:ident="unsigned" +webgpu:shader,validation,parse,identifiers:identifiers:ident="unsized" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usampler1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usampler1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usampler2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usampler2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usampler2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usampler2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usampler2DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usampler3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usamplerBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usamplerCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usamplerCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="use" +webgpu:shader,validation,parse,identifiers:identifiers:ident="using" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usubpassInput" +webgpu:shader,validation,parse,identifiers:identifiers:ident="usubpassInputMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utexture1D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utexture1DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utexture2D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utexture2DArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utexture2DMS" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utexture2DMSArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utexture2DRect" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utexture3D" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utextureBuffer" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utextureCube" +webgpu:shader,validation,parse,identifiers:identifiers:ident="utextureCubeArray" +webgpu:shader,validation,parse,identifiers:identifiers:ident="varying" +webgpu:shader,validation,parse,identifiers:identifiers:ident="vec" +webgpu:shader,validation,parse,identifiers:identifiers:ident="vector" +webgpu:shader,validation,parse,identifiers:identifiers:ident="vertexfragment" +webgpu:shader,validation,parse,identifiers:identifiers:ident="virtual" +webgpu:shader,validation,parse,identifiers:identifiers:ident="void" +webgpu:shader,validation,parse,identifiers:identifiers:ident="volatile" +webgpu:shader,validation,parse,identifiers:identifiers:ident="wchar_t" +webgpu:shader,validation,parse,identifiers:identifiers:ident="wgsl" +webgpu:shader,validation,parse,identifiers:identifiers:ident="where" +webgpu:shader,validation,parse,identifiers:identifiers:ident="with" +webgpu:shader,validation,parse,identifiers:identifiers:ident="writeonly" +webgpu:shader,validation,parse,identifiers:identifiers:ident="yield" +webgpu:shader,validation,parse,identifiers:non_normalized: +webgpu:shader,validation,parse,literal:bools:val="true" +webgpu:shader,validation,parse,literal:bools:val="false" +webgpu:shader,validation,parse,literal:abstract_int:val="0x123" +webgpu:shader,validation,parse,literal:abstract_int:val="123" +webgpu:shader,validation,parse,literal:abstract_int:val="0" +webgpu:shader,validation,parse,literal:abstract_int:val="0x3f" +webgpu:shader,validation,parse,literal:abstract_int:val="2147483647" +webgpu:shader,validation,parse,literal:abstract_int:val="-0x123" +webgpu:shader,validation,parse,literal:abstract_int:val="-123" +webgpu:shader,validation,parse,literal:abstract_int:val="-0x3f" +webgpu:shader,validation,parse,literal:abstract_int:val="-2147483647" +webgpu:shader,validation,parse,literal:abstract_int:val="-2147483648" +webgpu:shader,validation,parse,literal:abstract_int:val="94i" +webgpu:shader,validation,parse,literal:abstract_int:val="2147483647i" +webgpu:shader,validation,parse,literal:abstract_int:val="-2147483648i" +webgpu:shader,validation,parse,literal:abstract_int:val="42u" +webgpu:shader,validation,parse,literal:abstract_int:val="0u" +webgpu:shader,validation,parse,literal:abstract_int:val="4294967295u" +webgpu:shader,validation,parse,literal:abstract_int:val="0123" +webgpu:shader,validation,parse,literal:abstract_int:val="2147483648i" +webgpu:shader,validation,parse,literal:abstract_int:val="-2147483649i" +webgpu:shader,validation,parse,literal:abstract_int:val="4294967295" +webgpu:shader,validation,parse,literal:abstract_int:val="4294967295i" +webgpu:shader,validation,parse,literal:abstract_int:val="4294967296u" +webgpu:shader,validation,parse,literal:abstract_int:val="-1u" +webgpu:shader,validation,parse,literal:i32:val="0x123" +webgpu:shader,validation,parse,literal:i32:val="123" +webgpu:shader,validation,parse,literal:i32:val="0" +webgpu:shader,validation,parse,literal:i32:val="0x3f" +webgpu:shader,validation,parse,literal:i32:val="2147483647" +webgpu:shader,validation,parse,literal:i32:val="-0x123" +webgpu:shader,validation,parse,literal:i32:val="-123" +webgpu:shader,validation,parse,literal:i32:val="-0x3f" +webgpu:shader,validation,parse,literal:i32:val="-2147483647" +webgpu:shader,validation,parse,literal:i32:val="-2147483648" +webgpu:shader,validation,parse,literal:i32:val="94i" +webgpu:shader,validation,parse,literal:i32:val="2147483647i" +webgpu:shader,validation,parse,literal:i32:val="-2147483648i" +webgpu:shader,validation,parse,literal:i32:val="42u" +webgpu:shader,validation,parse,literal:i32:val="0u" +webgpu:shader,validation,parse,literal:i32:val="4294967295u" +webgpu:shader,validation,parse,literal:i32:val="2147483648" +webgpu:shader,validation,parse,literal:i32:val="2147483648i" +webgpu:shader,validation,parse,literal:i32:val="-2147483649" +webgpu:shader,validation,parse,literal:i32:val="-2147483649i" +webgpu:shader,validation,parse,literal:i32:val="1.0" +webgpu:shader,validation,parse,literal:i32:val="1.0f" +webgpu:shader,validation,parse,literal:i32:val="1.0h" +webgpu:shader,validation,parse,literal:u32:val="0x123" +webgpu:shader,validation,parse,literal:u32:val="123" +webgpu:shader,validation,parse,literal:u32:val="0" +webgpu:shader,validation,parse,literal:u32:val="0x3f" +webgpu:shader,validation,parse,literal:u32:val="2147483647" +webgpu:shader,validation,parse,literal:u32:val="42u" +webgpu:shader,validation,parse,literal:u32:val="0u" +webgpu:shader,validation,parse,literal:u32:val="4294967295u" +webgpu:shader,validation,parse,literal:u32:val="4294967295" +webgpu:shader,validation,parse,literal:u32:val="-0x123" +webgpu:shader,validation,parse,literal:u32:val="-123" +webgpu:shader,validation,parse,literal:u32:val="-0x3f" +webgpu:shader,validation,parse,literal:u32:val="-2147483647" +webgpu:shader,validation,parse,literal:u32:val="-2147483648" +webgpu:shader,validation,parse,literal:u32:val="94i" +webgpu:shader,validation,parse,literal:u32:val="2147483647i" +webgpu:shader,validation,parse,literal:u32:val="-2147483648i" +webgpu:shader,validation,parse,literal:u32:val="4294967296" +webgpu:shader,validation,parse,literal:u32:val="4294967296u" +webgpu:shader,validation,parse,literal:u32:val="-1" +webgpu:shader,validation,parse,literal:u32:val="1.0" +webgpu:shader,validation,parse,literal:u32:val="1.0f" +webgpu:shader,validation,parse,literal:u32:val="1.0h" +webgpu:shader,validation,parse,literal:abstract_float:val="0f" +webgpu:shader,validation,parse,literal:abstract_float:val="0.0f" +webgpu:shader,validation,parse,literal:abstract_float:val="12.223f" +webgpu:shader,validation,parse,literal:abstract_float:val="12.f" +webgpu:shader,validation,parse,literal:abstract_float:val=".12f" +webgpu:shader,validation,parse,literal:abstract_float:val="2.4e%2B4f" +webgpu:shader,validation,parse,literal:abstract_float:val="2.4e-2f" +webgpu:shader,validation,parse,literal:abstract_float:val="2.e%2B4f" +webgpu:shader,validation,parse,literal:abstract_float:val="1e-4f" +webgpu:shader,validation,parse,literal:abstract_float:val="0x1P%2B4f" +webgpu:shader,validation,parse,literal:abstract_float:val="0h" +webgpu:shader,validation,parse,literal:abstract_float:val="1h" +webgpu:shader,validation,parse,literal:abstract_float:val=".1h" +webgpu:shader,validation,parse,literal:abstract_float:val="1.1e2h" +webgpu:shader,validation,parse,literal:abstract_float:val="1.1E%2B2h" +webgpu:shader,validation,parse,literal:abstract_float:val="2.4e-2h" +webgpu:shader,validation,parse,literal:abstract_float:val="0X3h" +webgpu:shader,validation,parse,literal:abstract_float:val="0xep2h" +webgpu:shader,validation,parse,literal:abstract_float:val="0xEp-2h" +webgpu:shader,validation,parse,literal:abstract_float:val="0x3p%2B2h" +webgpu:shader,validation,parse,literal:abstract_float:val="0x3.2p%2B2h" +webgpu:shader,validation,parse,literal:abstract_float:val="0.0" +webgpu:shader,validation,parse,literal:abstract_float:val=".0" +webgpu:shader,validation,parse,literal:abstract_float:val="12." +webgpu:shader,validation,parse,literal:abstract_float:val="00012." +webgpu:shader,validation,parse,literal:abstract_float:val=".12" +webgpu:shader,validation,parse,literal:abstract_float:val="1.2e2" +webgpu:shader,validation,parse,literal:abstract_float:val="1.2E2" +webgpu:shader,validation,parse,literal:abstract_float:val="1.2e%2B2" +webgpu:shader,validation,parse,literal:abstract_float:val="2.4e-2" +webgpu:shader,validation,parse,literal:abstract_float:val=".1e-2" +webgpu:shader,validation,parse,literal:abstract_float:val="0x.3" +webgpu:shader,validation,parse,literal:abstract_float:val="0X.3" +webgpu:shader,validation,parse,literal:abstract_float:val="0xa.fp%2B2" +webgpu:shader,validation,parse,literal:abstract_float:val="0xa.fP%2B2" +webgpu:shader,validation,parse,literal:abstract_float:val="0xE.fp%2B2" +webgpu:shader,validation,parse,literal:abstract_float:val="0X1.fp-4" +webgpu:shader,validation,parse,literal:abstract_float:val=".f" +webgpu:shader,validation,parse,literal:abstract_float:val=".e-2" +webgpu:shader,validation,parse,literal:abstract_float:val="1.e%262f" +webgpu:shader,validation,parse,literal:abstract_float:val="1.ef" +webgpu:shader,validation,parse,literal:abstract_float:val="1.e%2Bf" +webgpu:shader,validation,parse,literal:abstract_float:val="0x.p2" +webgpu:shader,validation,parse,literal:abstract_float:val="0x1p" +webgpu:shader,validation,parse,literal:abstract_float:val="0x1p%5E" +webgpu:shader,validation,parse,literal:abstract_float:val="1.0e%2B999999999999f" +webgpu:shader,validation,parse,literal:abstract_float:val="0x1.0p%2B999999999999f" +webgpu:shader,validation,parse,literal:abstract_float:val="0x1.00000001pf0" +webgpu:shader,validation,parse,literal:abstract_float:val="1.1eh" +webgpu:shader,validation,parse,literal:abstract_float:val="1.1e%252h" +webgpu:shader,validation,parse,literal:abstract_float:val="1.1e%2Bh" +webgpu:shader,validation,parse,literal:abstract_float:val="1.0e%2B999999h" +webgpu:shader,validation,parse,literal:abstract_float:val="0x1.0p%2B999999h" +webgpu:shader,validation,parse,literal:f32:val="0f" +webgpu:shader,validation,parse,literal:f32:val="0.0f" +webgpu:shader,validation,parse,literal:f32:val="12.223f" +webgpu:shader,validation,parse,literal:f32:val="12.f" +webgpu:shader,validation,parse,literal:f32:val=".12f" +webgpu:shader,validation,parse,literal:f32:val="2.4e%2B4f" +webgpu:shader,validation,parse,literal:f32:val="2.4e-2f" +webgpu:shader,validation,parse,literal:f32:val="2.e%2B4f" +webgpu:shader,validation,parse,literal:f32:val="1e-4f" +webgpu:shader,validation,parse,literal:f32:val="0x1P%2B4f" +webgpu:shader,validation,parse,literal:f32:val="0.0" +webgpu:shader,validation,parse,literal:f32:val=".0" +webgpu:shader,validation,parse,literal:f32:val="12." +webgpu:shader,validation,parse,literal:f32:val="00012." +webgpu:shader,validation,parse,literal:f32:val=".12" +webgpu:shader,validation,parse,literal:f32:val="1.2e2" +webgpu:shader,validation,parse,literal:f32:val="1.2E2" +webgpu:shader,validation,parse,literal:f32:val="1.2e%2B2" +webgpu:shader,validation,parse,literal:f32:val="2.4e-2" +webgpu:shader,validation,parse,literal:f32:val=".1e-2" +webgpu:shader,validation,parse,literal:f32:val="0x.3" +webgpu:shader,validation,parse,literal:f32:val="0X.3" +webgpu:shader,validation,parse,literal:f32:val="0xa.fp%2B2" +webgpu:shader,validation,parse,literal:f32:val="0xa.fP%2B2" +webgpu:shader,validation,parse,literal:f32:val="0xE.fp%2B2" +webgpu:shader,validation,parse,literal:f32:val="0X1.fp-4" +webgpu:shader,validation,parse,literal:f32:val="1" +webgpu:shader,validation,parse,literal:f32:val="-1" +webgpu:shader,validation,parse,literal:f32:val="0h" +webgpu:shader,validation,parse,literal:f32:val="1h" +webgpu:shader,validation,parse,literal:f32:val=".1h" +webgpu:shader,validation,parse,literal:f32:val="1.1e2h" +webgpu:shader,validation,parse,literal:f32:val="1.1E%2B2h" +webgpu:shader,validation,parse,literal:f32:val="2.4e-2h" +webgpu:shader,validation,parse,literal:f32:val="0X3h" +webgpu:shader,validation,parse,literal:f32:val="0xep2h" +webgpu:shader,validation,parse,literal:f32:val="0xEp-2h" +webgpu:shader,validation,parse,literal:f32:val="0x3p%2B2h" +webgpu:shader,validation,parse,literal:f32:val="0x3.2p%2B2h" +webgpu:shader,validation,parse,literal:f32:val="1u" +webgpu:shader,validation,parse,literal:f32:val="1i" +webgpu:shader,validation,parse,literal:f32:val=".f" +webgpu:shader,validation,parse,literal:f32:val=".e-2" +webgpu:shader,validation,parse,literal:f32:val="1.e%262f" +webgpu:shader,validation,parse,literal:f32:val="1.ef" +webgpu:shader,validation,parse,literal:f32:val="1.e%2Bf" +webgpu:shader,validation,parse,literal:f32:val="0x.p2" +webgpu:shader,validation,parse,literal:f32:val="0x1p" +webgpu:shader,validation,parse,literal:f32:val="0x1p%5E" +webgpu:shader,validation,parse,literal:f32:val="1.0e%2B999999999999f" +webgpu:shader,validation,parse,literal:f32:val="0x1.0p%2B999999999999f" +webgpu:shader,validation,parse,literal:f32:val="0x1.00000001pf0" +webgpu:shader,validation,parse,literal:f16:val="0h" +webgpu:shader,validation,parse,literal:f16:val="1h" +webgpu:shader,validation,parse,literal:f16:val=".1h" +webgpu:shader,validation,parse,literal:f16:val="1.1e2h" +webgpu:shader,validation,parse,literal:f16:val="1.1E%2B2h" +webgpu:shader,validation,parse,literal:f16:val="2.4e-2h" +webgpu:shader,validation,parse,literal:f16:val="0X3h" +webgpu:shader,validation,parse,literal:f16:val="0xep2h" +webgpu:shader,validation,parse,literal:f16:val="0xEp-2h" +webgpu:shader,validation,parse,literal:f16:val="0x3p%2B2h" +webgpu:shader,validation,parse,literal:f16:val="0x3.2p%2B2h" +webgpu:shader,validation,parse,literal:f16:val="0.0" +webgpu:shader,validation,parse,literal:f16:val=".0" +webgpu:shader,validation,parse,literal:f16:val="12." +webgpu:shader,validation,parse,literal:f16:val="00012." +webgpu:shader,validation,parse,literal:f16:val=".12" +webgpu:shader,validation,parse,literal:f16:val="1.2e2" +webgpu:shader,validation,parse,literal:f16:val="1.2E2" +webgpu:shader,validation,parse,literal:f16:val="1.2e%2B2" +webgpu:shader,validation,parse,literal:f16:val="2.4e-2" +webgpu:shader,validation,parse,literal:f16:val=".1e-2" +webgpu:shader,validation,parse,literal:f16:val="0x.3" +webgpu:shader,validation,parse,literal:f16:val="0X.3" +webgpu:shader,validation,parse,literal:f16:val="0xa.fp%2B2" +webgpu:shader,validation,parse,literal:f16:val="0xa.fP%2B2" +webgpu:shader,validation,parse,literal:f16:val="0xE.fp%2B2" +webgpu:shader,validation,parse,literal:f16:val="0X1.fp-4" +webgpu:shader,validation,parse,literal:f16:val="1" +webgpu:shader,validation,parse,literal:f16:val="-1" +webgpu:shader,validation,parse,literal:f16:val="0f" +webgpu:shader,validation,parse,literal:f16:val="0.0f" +webgpu:shader,validation,parse,literal:f16:val="12.223f" +webgpu:shader,validation,parse,literal:f16:val="12.f" +webgpu:shader,validation,parse,literal:f16:val=".12f" +webgpu:shader,validation,parse,literal:f16:val="2.4e%2B4f" +webgpu:shader,validation,parse,literal:f16:val="2.4e-2f" +webgpu:shader,validation,parse,literal:f16:val="2.e%2B4f" +webgpu:shader,validation,parse,literal:f16:val="1e-4f" +webgpu:shader,validation,parse,literal:f16:val="0x1P%2B4f" +webgpu:shader,validation,parse,literal:f16:val="1i" +webgpu:shader,validation,parse,literal:f16:val="1u" +webgpu:shader,validation,parse,literal:f16:val="1f" +webgpu:shader,validation,parse,literal:f16:val="1.1eh" +webgpu:shader,validation,parse,literal:f16:val="1.1e%252h" +webgpu:shader,validation,parse,literal:f16:val="1.1e%2Bh" +webgpu:shader,validation,parse,literal:f16:val="1.0e%2B999999h" +webgpu:shader,validation,parse,literal:f16:val="0x1.0p%2B999999h" +webgpu:shader,validation,parse,source:valid_source: +webgpu:shader,validation,parse,source:empty: +webgpu:shader,validation,parse,source:invalid_source: +webgpu:shader,validation,parse,var_and_let:initializer_type:variableOrConstant="var" +webgpu:shader,validation,parse,var_and_let:initializer_type:variableOrConstant="let" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,builtins:stage_inout:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="bool" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="u32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="i32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="f32" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,builtins:type:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;target_type="MyStruct" +webgpu:shader,validation,shader_io,builtins:nesting:target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,builtins:nesting:target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,builtins:nesting:target_stage="";target_io="in" +webgpu:shader,validation,shader_io,builtins:nesting:target_stage="";target_io="out" +webgpu:shader,validation,shader_io,builtins:duplicates:first="p1";second="p2" +webgpu:shader,validation,shader_io,builtins:duplicates:first="p1";second="s1b" +webgpu:shader,validation,shader_io,builtins:duplicates:first="p1";second="s2b" +webgpu:shader,validation,shader_io,builtins:duplicates:first="p1";second="rb" +webgpu:shader,validation,shader_io,builtins:duplicates:first="s1a";second="p2" +webgpu:shader,validation,shader_io,builtins:duplicates:first="s1a";second="s1b" +webgpu:shader,validation,shader_io,builtins:duplicates:first="s1a";second="s2b" +webgpu:shader,validation,shader_io,builtins:duplicates:first="s1a";second="rb" +webgpu:shader,validation,shader_io,builtins:duplicates:first="s2a";second="p2" +webgpu:shader,validation,shader_io,builtins:duplicates:first="s2a";second="s1b" +webgpu:shader,validation,shader_io,builtins:duplicates:first="s2a";second="s2b" +webgpu:shader,validation,shader_io,builtins:duplicates:first="s2a";second="rb" +webgpu:shader,validation,shader_io,builtins:duplicates:first="ra";second="p2" +webgpu:shader,validation,shader_io,builtins:duplicates:first="ra";second="s1b" +webgpu:shader,validation,shader_io,builtins:duplicates:first="ra";second="s2b" +webgpu:shader,validation,shader_io,builtins:duplicates:first="ra";second="rb" +webgpu:shader,validation,shader_io,builtins:missing_vertex_position:use_struct=true;attribute="%40builtin(position)" +webgpu:shader,validation,shader_io,builtins:missing_vertex_position:use_struct=true;attribute="%40location(0)" +webgpu:shader,validation,shader_io,builtins:missing_vertex_position:use_struct=false;attribute="%40builtin(position)" +webgpu:shader,validation,shader_io,builtins:missing_vertex_position:use_struct=false;attribute="%40location(0)" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="vertex_index";stage="vertex";io="in";type="u32";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="vertex_index";stage="vertex";io="in";type="u32";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="vertex_index";stage="vertex";io="in";type="u32";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="vertex_index";stage="vertex";io="in";type="u32";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="vertex_index";stage="vertex";io="in";type="u32";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="instance_index";stage="vertex";io="in";type="u32";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="instance_index";stage="vertex";io="in";type="u32";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="instance_index";stage="vertex";io="in";type="u32";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="instance_index";stage="vertex";io="in";type="u32";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="instance_index";stage="vertex";io="in";type="u32";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="front_facing";stage="fragment";io="in";type="bool";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="front_facing";stage="fragment";io="in";type="bool";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="front_facing";stage="fragment";io="in";type="bool";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="front_facing";stage="fragment";io="in";type="bool";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="front_facing";stage="fragment";io="in";type="bool";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="frag_depth";stage="fragment";io="out";type="f32";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="frag_depth";stage="fragment";io="out";type="f32";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="frag_depth";stage="fragment";io="out";type="f32";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="frag_depth";stage="fragment";io="out";type="f32";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="frag_depth";stage="fragment";io="out";type="f32";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_index";stage="compute";io="in";type="u32";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_index";stage="compute";io="in";type="u32";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_index";stage="compute";io="in";type="u32";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_index";stage="compute";io="in";type="u32";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="local_invocation_index";stage="compute";io="in";type="u32";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_index";stage="fragment";io="in";type="u32";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_index";stage="fragment";io="in";type="u32";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_index";stage="fragment";io="in";type="u32";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_index";stage="fragment";io="in";type="u32";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_index";stage="fragment";io="in";type="u32";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="in";type="u32";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="in";type="u32";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="in";type="u32";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="in";type="u32";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="in";type="u32";use="function-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="out";type="u32";use="type_name" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="out";type="u32";use="struct" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="out";type="u32";use="function" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="out";type="u32";use="module-var" +webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:name="sample_mask";stage="fragment";io="out";type="u32";use="function-var" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_param:target_stage="" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_param:target_stage="vertex" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_param:target_stage="fragment" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_param:target_stage="compute" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_param_struct:target_stage="" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_param_struct:target_stage="vertex" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_param_struct:target_stage="fragment" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_param_struct:target_stage="compute" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_return_type:target_stage="" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_return_type:target_stage="vertex" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_return_type:target_stage="fragment" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_return_type_struct:target_stage="" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_return_type_struct:target_stage="vertex" +webgpu:shader,validation,shader_io,entry_point:missing_attribute_on_return_type_struct:target_stage="fragment" +webgpu:shader,validation,shader_io,entry_point:no_entry_point_provided: +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="flat";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="flat";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="flat";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="flat";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="flat";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="flat";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="flat";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="perspective";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="perspective";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="perspective";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="perspective";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="perspective";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="perspective";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="perspective";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="linear";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="linear";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="linear";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="linear";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="linear";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="linear";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="linear";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="center";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="center";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="center";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="center";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="center";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="center";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="center";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="centroid";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="centroid";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="centroid";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="centroid";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="centroid";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="centroid";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="centroid";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="sample";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="sample";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="sample";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="sample";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="sample";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="sample";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=true;type="sample";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="flat";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="flat";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="flat";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="flat";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="flat";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="flat";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="flat";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="perspective";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="perspective";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="perspective";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="perspective";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="perspective";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="perspective";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="perspective";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="linear";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="linear";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="linear";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="linear";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="linear";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="linear";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="linear";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="center";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="center";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="center";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="center";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="center";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="center";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="center";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="centroid";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="centroid";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="centroid";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="centroid";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="centroid";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="centroid";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="centroid";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="sample";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="sample";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="sample";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="sample";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="sample";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="sample";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="in";use_struct=false;type="sample";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="flat";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="flat";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="flat";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="flat";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="flat";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="flat";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="flat";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="perspective";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="perspective";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="perspective";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="perspective";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="perspective";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="perspective";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="perspective";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="linear";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="linear";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="linear";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="linear";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="linear";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="linear";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="linear";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="center";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="center";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="center";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="center";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="center";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="center";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="center";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="centroid";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="centroid";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="centroid";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="centroid";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="centroid";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="centroid";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="centroid";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="sample";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="sample";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="sample";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="sample";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="sample";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="sample";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=true;type="sample";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="flat";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="flat";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="flat";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="flat";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="flat";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="flat";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="flat";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="perspective";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="perspective";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="perspective";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="perspective";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="perspective";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="perspective";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="perspective";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="linear";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="linear";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="linear";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="linear";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="linear";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="linear";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="linear";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="center";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="center";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="center";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="center";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="center";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="center";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="center";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="centroid";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="centroid";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="centroid";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="centroid";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="centroid";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="centroid";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="centroid";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="sample";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="sample";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="sample";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="sample";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="sample";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="sample";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="vertex";io="out";use_struct=false;type="sample";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="flat";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="flat";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="flat";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="flat";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="flat";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="flat";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="flat";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="perspective";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="perspective";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="perspective";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="perspective";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="perspective";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="perspective";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="perspective";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="linear";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="linear";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="linear";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="linear";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="linear";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="linear";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="linear";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="center";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="center";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="center";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="center";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="center";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="center";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="center";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="centroid";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="centroid";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="centroid";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="centroid";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="centroid";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="centroid";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="centroid";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="sample";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="sample";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="sample";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="sample";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="sample";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="sample";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=true;type="sample";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="flat";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="flat";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="flat";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="flat";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="flat";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="flat";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="flat";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="perspective";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="perspective";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="perspective";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="perspective";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="perspective";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="perspective";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="perspective";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="linear";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="linear";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="linear";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="linear";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="linear";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="linear";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="linear";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="center";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="center";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="center";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="center";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="center";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="center";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="center";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="centroid";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="centroid";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="centroid";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="centroid";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="centroid";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="centroid";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="centroid";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="sample";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="sample";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="sample";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="sample";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="sample";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="sample";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="in";use_struct=false;type="sample";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="flat";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="flat";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="flat";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="flat";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="flat";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="flat";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="flat";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="perspective";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="perspective";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="perspective";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="perspective";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="perspective";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="perspective";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="perspective";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="linear";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="linear";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="linear";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="linear";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="linear";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="linear";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="linear";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="center";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="center";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="center";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="center";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="center";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="center";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="center";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="centroid";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="centroid";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="centroid";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="centroid";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="centroid";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="centroid";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="centroid";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="sample";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="sample";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="sample";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="sample";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="sample";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="sample";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=true;type="sample";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="flat";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="flat";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="flat";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="flat";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="flat";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="flat";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="flat";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="perspective";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="perspective";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="perspective";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="perspective";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="perspective";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="perspective";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="perspective";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="linear";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="linear";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="linear";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="linear";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="linear";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="linear";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="linear";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="center";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="center";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="center";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="center";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="center";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="center";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="center";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="centroid";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="centroid";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="centroid";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="centroid";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="centroid";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="centroid";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="centroid";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="sample";sampling="" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="sample";sampling="center" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="sample";sampling="centroid" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="sample";sampling="sample" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="sample";sampling="flat" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="sample";sampling="perspective" +webgpu:shader,validation,shader_io,interpolate:type_and_sampling:stage="fragment";io="out";use_struct=false;type="sample";sampling="linear" +webgpu:shader,validation,shader_io,interpolate:require_location:stage="vertex";attribute="%40location(0)";use_struct=true +webgpu:shader,validation,shader_io,interpolate:require_location:stage="vertex";attribute="%40location(0)";use_struct=false +webgpu:shader,validation,shader_io,interpolate:require_location:stage="vertex";attribute="%40builtin(position)";use_struct=true +webgpu:shader,validation,shader_io,interpolate:require_location:stage="vertex";attribute="%40builtin(position)";use_struct=false +webgpu:shader,validation,shader_io,interpolate:require_location:stage="fragment";attribute="%40location(0)";use_struct=true +webgpu:shader,validation,shader_io,interpolate:require_location:stage="fragment";attribute="%40location(0)";use_struct=false +webgpu:shader,validation,shader_io,interpolate:require_location:stage="fragment";attribute="%40builtin(position)";use_struct=true +webgpu:shader,validation,shader_io,interpolate:require_location:stage="fragment";attribute="%40builtin(position)";use_struct=false +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=true;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="i32";use_struct=false;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=true;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="u32";use_struct=false;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="vertex";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=true;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="i32";use_struct=false;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=true;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="u32";use_struct=false;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=true;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec2%3Ci32%3E";use_struct=false;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=true;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(flat)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(perspective)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(perspective,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(perspective,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(perspective,%20sample)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(linear)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(linear,%20center)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(linear,%20centroid)" +webgpu:shader,validation,shader_io,interpolate:integral_types:stage="fragment";type="vec4%3Cu32%3E";use_struct=false;attribute="%40interpolate(linear,%20sample)" +webgpu:shader,validation,shader_io,interpolate:duplicate:attr="" +webgpu:shader,validation,shader_io,interpolate:duplicate:attr="%40interpolate(flat)" +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true +webgpu:shader,validation,shader_io,invariant:valid_only_with_vertex_position_builtin:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false +webgpu:shader,validation,shader_io,invariant:not_valid_on_user_defined_io:use_invariant=true +webgpu:shader,validation,shader_io,invariant:not_valid_on_user_defined_io:use_invariant=false +webgpu:shader,validation,shader_io,invariant:invalid_use_of_parameters:suffix="" +webgpu:shader,validation,shader_io,invariant:invalid_use_of_parameters:suffix="()" +webgpu:shader,validation,shader_io,invariant:invalid_use_of_parameters:suffix="(0)" +webgpu:shader,validation,shader_io,invariant:duplicate:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="vertex_index";stage="vertex";io="in";type="u32";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="instance_index";stage="vertex";io="in";type="u32";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="instance_index";stage="vertex";io="in";type="u32";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="position";stage="vertex";io="out";type="vec4%3Cf32%3E";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="position";stage="fragment";io="in";type="vec4%3Cf32%3E";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="front_facing";stage="fragment";io="in";type="bool";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="front_facing";stage="fragment";io="in";type="bool";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="frag_depth";stage="fragment";io="out";type="f32";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="local_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="local_invocation_index";stage="compute";io="in";type="u32";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="global_invocation_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="workgroup_id";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="num_workgroups";stage="compute";io="in";type="vec3%3Cu32%3E";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_index";stage="fragment";io="in";type="u32";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_index";stage="fragment";io="in";type="u32";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_mask";stage="fragment";io="in";type="u32";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=true;attr="%40invariant" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;attr="" +webgpu:shader,validation,shader_io,invariant:duplicate:name="sample_mask";stage="fragment";io="out";type="u32";use_struct=false;attr="%40invariant" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=true;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=true;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=true;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=true;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=true;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=true;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=false;target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=false;target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=false;target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=false;target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=false;target_stage="compute";target_io="in" +webgpu:shader,validation,shader_io,locations:stage_inout:use_struct=false;target_stage="compute";target_io="out" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="bool" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="u32" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="i32" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="f32" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=true;type="MyStruct" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="bool" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="u32" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="i32" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="f32" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="atomic%3Cu32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="atomic%3Ci32%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="array%3Cbool,4%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="array%3Cu32,4%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="array%3Ci32,4%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="array%3Cf32,4%3E" +webgpu:shader,validation,shader_io,locations:type:use_struct=false;type="MyStruct" +webgpu:shader,validation,shader_io,locations:nesting:target_stage="vertex";target_io="in" +webgpu:shader,validation,shader_io,locations:nesting:target_stage="vertex";target_io="out" +webgpu:shader,validation,shader_io,locations:nesting:target_stage="fragment";target_io="in" +webgpu:shader,validation,shader_io,locations:nesting:target_stage="fragment";target_io="out" +webgpu:shader,validation,shader_io,locations:nesting:target_stage="";target_io="in" +webgpu:shader,validation,shader_io,locations:nesting:target_stage="";target_io="out" +webgpu:shader,validation,shader_io,locations:duplicates:first="p1";second="p2" +webgpu:shader,validation,shader_io,locations:duplicates:first="p1";second="s1b" +webgpu:shader,validation,shader_io,locations:duplicates:first="p1";second="s2b" +webgpu:shader,validation,shader_io,locations:duplicates:first="p1";second="rb" +webgpu:shader,validation,shader_io,locations:duplicates:first="s1a";second="p2" +webgpu:shader,validation,shader_io,locations:duplicates:first="s1a";second="s1b" +webgpu:shader,validation,shader_io,locations:duplicates:first="s1a";second="s2b" +webgpu:shader,validation,shader_io,locations:duplicates:first="s1a";second="rb" +webgpu:shader,validation,shader_io,locations:duplicates:first="s2a";second="p2" +webgpu:shader,validation,shader_io,locations:duplicates:first="s2a";second="s1b" +webgpu:shader,validation,shader_io,locations:duplicates:first="s2a";second="s2b" +webgpu:shader,validation,shader_io,locations:duplicates:first="s2a";second="rb" +webgpu:shader,validation,shader_io,locations:duplicates:first="ra";second="p2" +webgpu:shader,validation,shader_io,locations:duplicates:first="ra";second="s1b" +webgpu:shader,validation,shader_io,locations:duplicates:first="ra";second="s2b" +webgpu:shader,validation,shader_io,locations:duplicates:first="ra";second="rb" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="f32" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="i32" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="u32" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="bool" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="array%3Cf32,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="array%3Ci32,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="array%3Cu32,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="in";type="array%3Cbool,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="f32" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="i32" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="u32" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="bool" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="array%3Cf32,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="array%3Ci32,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="array%3Cu32,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="out";type="array%3Cbool,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="f32" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="i32" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="u32" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="bool" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec2%3Ci32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec2%3Cu32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec2%3Cbool%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec3%3Ci32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec3%3Cu32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec3%3Cbool%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec4%3Ci32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec4%3Cu32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="vec4%3Cbool%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="mat2x2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="mat2x3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="mat2x4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="mat3x2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="mat3x3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="mat3x4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="mat4x2%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="mat4x3%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="mat4x4%3Cf32%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="array%3Cf32,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="array%3Ci32,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="array%3Cu32,%2012%3E" +webgpu:shader,validation,shader_io,shareable_types:io_shareable_type:storageClass="private";type="array%3Cbool,%2012%3E" +webgpu:util,texture,texel_data:unorm_texel_data_in_shader:format="r8unorm" +webgpu:util,texture,texel_data:unorm_texel_data_in_shader:format="rg8unorm" +webgpu:util,texture,texel_data:unorm_texel_data_in_shader:format="rgba8unorm" +webgpu:util,texture,texel_data:unorm_texel_data_in_shader:format="rgba8unorm-srgb" +webgpu:util,texture,texel_data:unorm_texel_data_in_shader:format="bgra8unorm" +webgpu:util,texture,texel_data:unorm_texel_data_in_shader:format="bgra8unorm-srgb" +webgpu:util,texture,texel_data:unorm_texel_data_in_shader:format="rgb10a2unorm" +webgpu:util,texture,texel_data:snorm_texel_data_in_shader:format="r8snorm" +webgpu:util,texture,texel_data:snorm_texel_data_in_shader:format="rg8snorm" +webgpu:util,texture,texel_data:snorm_texel_data_in_shader:format="rgba8snorm" +webgpu:util,texture,texel_data:uint_texel_data_in_shader:format="r8uint" +webgpu:util,texture,texel_data:uint_texel_data_in_shader:format="r16uint" +webgpu:util,texture,texel_data:uint_texel_data_in_shader:format="rg8uint" +webgpu:util,texture,texel_data:uint_texel_data_in_shader:format="r32uint" +webgpu:util,texture,texel_data:uint_texel_data_in_shader:format="rg16uint" +webgpu:util,texture,texel_data:uint_texel_data_in_shader:format="rgba8uint" +webgpu:util,texture,texel_data:uint_texel_data_in_shader:format="rg32uint" +webgpu:util,texture,texel_data:uint_texel_data_in_shader:format="rgba16uint" +webgpu:util,texture,texel_data:uint_texel_data_in_shader:format="rgba32uint" +webgpu:util,texture,texel_data:sint_texel_data_in_shader:format="r8sint" +webgpu:util,texture,texel_data:sint_texel_data_in_shader:format="r16sint" +webgpu:util,texture,texel_data:sint_texel_data_in_shader:format="rg8sint" +webgpu:util,texture,texel_data:sint_texel_data_in_shader:format="r32sint" +webgpu:util,texture,texel_data:sint_texel_data_in_shader:format="rg16sint" +webgpu:util,texture,texel_data:sint_texel_data_in_shader:format="rgba8sint" +webgpu:util,texture,texel_data:sint_texel_data_in_shader:format="rg32sint" +webgpu:util,texture,texel_data:sint_texel_data_in_shader:format="rgba16sint" +webgpu:util,texture,texel_data:sint_texel_data_in_shader:format="rgba32sint" +webgpu:util,texture,texel_data:float_texel_data_in_shader:format="r16float" +webgpu:util,texture,texel_data:float_texel_data_in_shader:format="r32float" +webgpu:util,texture,texel_data:float_texel_data_in_shader:format="rg16float" +webgpu:util,texture,texel_data:float_texel_data_in_shader:format="rg32float" +webgpu:util,texture,texel_data:float_texel_data_in_shader:format="rgba16float" +webgpu:util,texture,texel_data:float_texel_data_in_shader:format="rgba32float" +webgpu:util,texture,texel_data:ufloat_texel_data_in_shader:format="rg11b10ufloat" +webgpu:util,texture,texel_data:ufloat_texel_data_in_shader:format="rgb9e5ufloat" +webgpu:util,texture,texture_ok:float32:format="rgba32float" +webgpu:util,texture,texture_ok:float32:format="rg32float" +webgpu:util,texture,texture_ok:norm:mode="bytes";format="r8unorm" +webgpu:util,texture,texture_ok:norm:mode="bytes";format="r8snorm" +webgpu:util,texture,texture_ok:norm:mode="colors";format="r8unorm" +webgpu:util,texture,texture_ok:norm:mode="colors";format="r8snorm" +webgpu:util,texture,texture_ok:snorm_min:mode="bytes";format="r8snorm" +webgpu:util,texture,texture_ok:snorm_min:mode="colors";format="r8snorm" +webgpu:web_platform,canvas,configure:defaults:canvasType="onscreen" +webgpu:web_platform,canvas,configure:defaults:canvasType="offscreen" +webgpu:web_platform,canvas,configure:device:canvasType="onscreen" +webgpu:web_platform,canvas,configure:device:canvasType="offscreen" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r8snorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r8uint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r8sint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r16uint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r16sint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r16float" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg8snorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg8uint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg8sint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r32uint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r32sint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="r32float" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg16uint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg16sint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg16float" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba8unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba8snorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba8uint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba8sint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bgra8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bgra8unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgb10a2unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg11b10ufloat" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgb9e5ufloat" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg32uint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg32sint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rg32float" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba16uint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba16sint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba16float" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba32uint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba32sint" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="rgba32float" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="depth32float" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="depth16unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="stencil8" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="depth24plus" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="depth24plus-stencil8" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="depth32float-stencil8" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc1-rgba-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc1-rgba-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc2-rgba-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc2-rgba-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc3-rgba-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc3-rgba-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc4-r-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc4-r-snorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc5-rg-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc5-rg-snorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc6h-rgb-ufloat" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc6h-rgb-float" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc7-rgba-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="bc7-rgba-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="etc2-rgb8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="etc2-rgb8unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="etc2-rgb8a1unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="etc2-rgb8a1unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="etc2-rgba8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="etc2-rgba8unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="eac-r11unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="eac-r11snorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="eac-rg11unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="eac-rg11snorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-4x4-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-4x4-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-5x4-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-5x4-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-5x5-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-5x5-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-6x5-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-6x5-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-6x6-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-6x6-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-8x5-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-8x5-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-8x6-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-8x6-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-8x8-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-8x8-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-10x5-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-10x5-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-10x6-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-10x6-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-10x8-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-10x8-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-10x10-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-10x10-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-12x10-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-12x10-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-12x12-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="onscreen";format="astc-12x12-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r8snorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r8uint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r8sint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r16uint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r16sint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r16float" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg8snorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg8uint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg8sint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r32uint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r32sint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="r32float" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg16uint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg16sint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg16float" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba8unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba8snorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba8uint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba8sint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bgra8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bgra8unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgb10a2unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg11b10ufloat" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgb9e5ufloat" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg32uint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg32sint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rg32float" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba16uint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba16sint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba16float" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba32uint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba32sint" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="rgba32float" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="depth32float" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="depth16unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="stencil8" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="depth24plus" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="depth24plus-stencil8" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="depth32float-stencil8" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc1-rgba-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc1-rgba-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc2-rgba-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc2-rgba-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc3-rgba-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc3-rgba-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc4-r-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc4-r-snorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc5-rg-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc5-rg-snorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc6h-rgb-ufloat" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc6h-rgb-float" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc7-rgba-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="bc7-rgba-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="etc2-rgb8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="etc2-rgb8unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="etc2-rgb8a1unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="etc2-rgb8a1unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="etc2-rgba8unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="etc2-rgba8unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="eac-r11unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="eac-r11snorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="eac-rg11unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="eac-rg11snorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-4x4-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-4x4-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-5x4-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-5x4-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-5x5-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-5x5-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-6x5-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-6x5-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-6x6-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-6x6-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-8x5-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-8x5-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-8x6-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-8x6-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-8x8-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-8x8-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-10x5-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-10x5-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-10x6-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-10x6-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-10x8-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-10x8-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-10x10-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-10x10-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-12x10-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-12x10-unorm-srgb" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-12x12-unorm" +webgpu:web_platform,canvas,configure:format:canvasType="offscreen";format="astc-12x12-unorm-srgb" +webgpu:web_platform,canvas,configure:usage:canvasType="onscreen" +webgpu:web_platform,canvas,configure:usage:canvasType="offscreen" +webgpu:web_platform,canvas,configure:alpha_mode:canvasType="onscreen" +webgpu:web_platform,canvas,configure:alpha_mode:canvasType="offscreen" +webgpu:web_platform,canvas,context_creation:return_type:offscreen=false +webgpu:web_platform,canvas,context_creation:return_type:offscreen=true +webgpu:web_platform,canvas,getCurrentTexture:configured:canvasType="onscreen" +webgpu:web_platform,canvas,getCurrentTexture:configured:canvasType="offscreen" +webgpu:web_platform,canvas,getCurrentTexture:single_frames:canvasType="onscreen" +webgpu:web_platform,canvas,getCurrentTexture:single_frames:canvasType="offscreen" +webgpu:web_platform,canvas,getCurrentTexture:multiple_frames:canvasType="onscreen" +webgpu:web_platform,canvas,getCurrentTexture:multiple_frames:canvasType="offscreen" +webgpu:web_platform,canvas,getCurrentTexture:resize:canvasType="onscreen" +webgpu:web_platform,canvas,getCurrentTexture:resize:canvasType="offscreen" +webgpu:web_platform,canvas,getPreferredCanvasFormat:value: +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="bgra8unorm";alphaMode="opaque";snapshotType="toDataURL" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="bgra8unorm";alphaMode="opaque";snapshotType="toBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="bgra8unorm";alphaMode="opaque";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="bgra8unorm";alphaMode="premultiplied";snapshotType="toDataURL" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="bgra8unorm";alphaMode="premultiplied";snapshotType="toBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="bgra8unorm";alphaMode="premultiplied";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba8unorm";alphaMode="opaque";snapshotType="toDataURL" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba8unorm";alphaMode="opaque";snapshotType="toBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba8unorm";alphaMode="opaque";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba8unorm";alphaMode="premultiplied";snapshotType="toDataURL" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba8unorm";alphaMode="premultiplied";snapshotType="toBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba8unorm";alphaMode="premultiplied";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba16float";alphaMode="opaque";snapshotType="toDataURL" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba16float";alphaMode="opaque";snapshotType="toBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba16float";alphaMode="opaque";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba16float";alphaMode="premultiplied";snapshotType="toDataURL" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba16float";alphaMode="premultiplied";snapshotType="toBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba16float";alphaMode="premultiplied";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="bgra8unorm";alphaMode="opaque";webgl="webgl";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="bgra8unorm";alphaMode="opaque";webgl="webgl";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="bgra8unorm";alphaMode="opaque";webgl="webgl2";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="bgra8unorm";alphaMode="opaque";webgl="webgl2";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="bgra8unorm";alphaMode="premultiplied";webgl="webgl";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="bgra8unorm";alphaMode="premultiplied";webgl="webgl";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="bgra8unorm";alphaMode="premultiplied";webgl="webgl2";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="bgra8unorm";alphaMode="premultiplied";webgl="webgl2";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba8unorm";alphaMode="opaque";webgl="webgl";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba8unorm";alphaMode="opaque";webgl="webgl";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba8unorm";alphaMode="opaque";webgl="webgl2";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba8unorm";alphaMode="opaque";webgl="webgl2";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba8unorm";alphaMode="premultiplied";webgl="webgl";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba8unorm";alphaMode="premultiplied";webgl="webgl";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba8unorm";alphaMode="premultiplied";webgl="webgl2";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba8unorm";alphaMode="premultiplied";webgl="webgl2";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba16float";alphaMode="opaque";webgl="webgl";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba16float";alphaMode="opaque";webgl="webgl";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba16float";alphaMode="opaque";webgl="webgl2";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba16float";alphaMode="opaque";webgl="webgl2";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba16float";alphaMode="premultiplied";webgl="webgl";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba16float";alphaMode="premultiplied";webgl="webgl";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba16float";alphaMode="premultiplied";webgl="webgl2";upload="texImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="rgba16float";alphaMode="premultiplied";webgl="webgl2";upload="texSubImage2D" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="bgra8unorm";alphaMode="opaque";snapshotType="convertToBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="bgra8unorm";alphaMode="opaque";snapshotType="transferToImageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="bgra8unorm";alphaMode="opaque";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="bgra8unorm";alphaMode="premultiplied";snapshotType="convertToBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="bgra8unorm";alphaMode="premultiplied";snapshotType="transferToImageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="bgra8unorm";alphaMode="premultiplied";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba8unorm";alphaMode="opaque";snapshotType="convertToBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba8unorm";alphaMode="opaque";snapshotType="transferToImageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba8unorm";alphaMode="opaque";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba8unorm";alphaMode="premultiplied";snapshotType="convertToBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba8unorm";alphaMode="premultiplied";snapshotType="transferToImageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba8unorm";alphaMode="premultiplied";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba16float";alphaMode="opaque";snapshotType="convertToBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba16float";alphaMode="opaque";snapshotType="transferToImageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba16float";alphaMode="opaque";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba16float";alphaMode="premultiplied";snapshotType="convertToBlob" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba16float";alphaMode="premultiplied";snapshotType="transferToImageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:offscreenCanvas,snapshot:format="rgba16float";alphaMode="premultiplied";snapshotType="imageBitmap" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="bgra8unorm";alphaMode="opaque";webgpuCanvasType="onscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="bgra8unorm";alphaMode="opaque";webgpuCanvasType="onscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="bgra8unorm";alphaMode="opaque";webgpuCanvasType="offscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="bgra8unorm";alphaMode="opaque";webgpuCanvasType="offscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="bgra8unorm";alphaMode="premultiplied";webgpuCanvasType="onscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="bgra8unorm";alphaMode="premultiplied";webgpuCanvasType="onscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="bgra8unorm";alphaMode="premultiplied";webgpuCanvasType="offscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="bgra8unorm";alphaMode="premultiplied";webgpuCanvasType="offscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba8unorm";alphaMode="opaque";webgpuCanvasType="onscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba8unorm";alphaMode="opaque";webgpuCanvasType="onscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba8unorm";alphaMode="opaque";webgpuCanvasType="offscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba8unorm";alphaMode="opaque";webgpuCanvasType="offscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba8unorm";alphaMode="premultiplied";webgpuCanvasType="onscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba8unorm";alphaMode="premultiplied";webgpuCanvasType="onscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba8unorm";alphaMode="premultiplied";webgpuCanvasType="offscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba8unorm";alphaMode="premultiplied";webgpuCanvasType="offscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba16float";alphaMode="opaque";webgpuCanvasType="onscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba16float";alphaMode="opaque";webgpuCanvasType="onscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba16float";alphaMode="opaque";webgpuCanvasType="offscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba16float";alphaMode="opaque";webgpuCanvasType="offscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba16float";alphaMode="premultiplied";webgpuCanvasType="onscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba16float";alphaMode="premultiplied";webgpuCanvasType="onscreen";canvas2DType="offscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba16float";alphaMode="premultiplied";webgpuCanvasType="offscreen";canvas2DType="onscreen" +webgpu:web_platform,canvas,readbackFromWebGPUCanvas:drawTo2DCanvas:format="rgba16float";alphaMode="premultiplied";webgpuCanvasType="offscreen";canvas2DType="offscreen" +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="none";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha="premultiply";orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="none";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=true;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="r32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rg32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgb10a2unorm";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba16float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=true +webgpu:web_platform,copyToTexture,ImageBitmap:from_canvas:orientation="flipY";srcDoFlipYDuringCopy=false;dstColorFormat="rgba32float";dstPremultiplied=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="r32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rg32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba8unorm-srgb";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba8unorm-srgb";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba8unorm-srgb";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba8unorm-srgb";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="bgra8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="bgra8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="bgra8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="bgra8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="bgra8unorm-srgb";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="bgra8unorm-srgb";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="bgra8unorm-srgb";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="bgra8unorm-srgb";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgb10a2unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgb10a2unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgb10a2unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgb10a2unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="onscreen";dstColorFormat="rgba32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="r32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rg32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba8unorm-srgb";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba8unorm-srgb";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba8unorm-srgb";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba8unorm-srgb";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="bgra8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="bgra8unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="bgra8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="bgra8unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="bgra8unorm-srgb";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="bgra8unorm-srgb";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="bgra8unorm-srgb";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="bgra8unorm-srgb";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgb10a2unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgb10a2unorm";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgb10a2unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgb10a2unorm";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba16float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba16float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba32float";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_2d_context_canvas:canvasType="offscreen";dstColorFormat="rgba32float";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="onscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="r32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rg32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="bgra8unorm-srgb";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgb10a2unorm";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba16float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=true;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gl_context_canvas:canvasType="offscreen";contextName="webgl2";dstColorFormat="rgba32float";srcPremultiplied=false;dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="onscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=true;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="r32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rg32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="bgra8unorm-srgb";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgb10a2unorm";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba16float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="opaque";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:copy_contents_from_gpu_context_canvas:canvasType="offscreen";srcAndDstInSameGPUDevice=false;dstColorFormat="rgba32float";srcAlphaMode="premultiplied";dstAlphaMode="premultiplied";srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r16float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r16float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r16float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r16float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r32float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r32float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r32float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="r32float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg16float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg16float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg16float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg16float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg32float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg32float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg32float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rg32float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="bgra8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="bgra8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="bgra8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="bgra8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgb10a2unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgb10a2unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgb10a2unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgb10a2unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba16float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba16float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba16float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba16float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba32float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba32float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba32float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="srgb";dstColorSpace="srgb";dstColorFormat="rgba32float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r16float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r16float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r16float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r16float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r32float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r32float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r32float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="r32float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg16float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg16float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg16float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg16float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg32float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg32float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg32float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rg32float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba8unorm-srgb";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba8unorm-srgb";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="bgra8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="bgra8unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="bgra8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="bgra8unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="bgra8unorm-srgb";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="bgra8unorm-srgb";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgb10a2unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgb10a2unorm";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgb10a2unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgb10a2unorm";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba16float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba16float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba16float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba16float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba32float";dstPremultiplied=true;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba32float";dstPremultiplied=true;srcDoFlipYDuringCopy=false +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba32float";dstPremultiplied=false;srcDoFlipYDuringCopy=true +webgpu:web_platform,copyToTexture,canvas:color_space_conversion:srcColorSpace="display-p3";dstColorSpace="srgb";dstColorFormat="rgba32float";dstPremultiplied=false;srcDoFlipYDuringCopy=false +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoElement";videoName="red-green.webmvp8.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoElement";videoName="red-green.theora.ogv" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoElement";videoName="red-green.mp4" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoElement";videoName="red-green.bt601.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoElement";videoName="red-green.bt709.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoElement";videoName="red-green.bt2020.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoFrame";videoName="red-green.webmvp8.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoFrame";videoName="red-green.theora.ogv" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoFrame";videoName="red-green.mp4" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoFrame";videoName="red-green.bt601.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoFrame";videoName="red-green.bt709.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,sample:sourceType="VideoFrame";videoName="red-green.bt2020.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,expired:sourceType="VideoElement" +webgpu:web_platform,external_texture,video:importExternalTexture,expired:sourceType="VideoFrame" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoElement";videoName="red-green.webmvp8.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoElement";videoName="red-green.theora.ogv" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoElement";videoName="red-green.mp4" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoElement";videoName="red-green.bt601.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoElement";videoName="red-green.bt709.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoElement";videoName="red-green.bt2020.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoFrame";videoName="red-green.webmvp8.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoFrame";videoName="red-green.theora.ogv" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoFrame";videoName="red-green.mp4" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoFrame";videoName="red-green.bt601.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoFrame";videoName="red-green.bt709.vp9.webm" +webgpu:web_platform,external_texture,video:importExternalTexture,compute:sourceType="VideoFrame";videoName="red-green.bt2020.vp9.webm" +webgpu:web_platform,worker,worker:worker: diff --git a/third_party/gn/webgpu-cts/ts_sources.txt b/third_party/gn/webgpu-cts/ts_sources.txt index 7bd40aff05..a6aa26d04f 100644 --- a/third_party/gn/webgpu-cts/ts_sources.txt +++ b/third_party/gn/webgpu-cts/ts_sources.txt @@ -1,3 +1,4 @@ +src/common/framework/test_config.ts src/common/internal/version.ts src/common/internal/stack.ts src/common/internal/logging/log_message.ts @@ -103,6 +104,8 @@ src/unittests/async_expectations.spec.ts src/unittests/basic.spec.ts src/unittests/check_contents.spec.ts src/unittests/conversion.spec.ts +src/webgpu/util/f32_interval.ts +src/unittests/f32_interval.spec.ts src/unittests/getStackTrace.spec.ts src/unittests/listing.ts src/unittests/loaders_and_trees.spec.ts @@ -119,7 +122,9 @@ src/webgpu/examples.spec.ts src/webgpu/listing.ts src/webgpu/api/operation/labels.spec.ts src/webgpu/api/operation/onSubmittedWorkDone.spec.ts +src/webgpu/api/operation/reflection.spec.ts src/webgpu/api/operation/uncapturederror.spec.ts +src/webgpu/api/operation/adapter/requestAdapterInfo.spec.ts src/webgpu/api/operation/adapter/requestDevice.spec.ts src/webgpu/api/operation/adapter/requestDevice_limits.spec.ts src/webgpu/api/operation/buffers/mapping_test.ts @@ -131,6 +136,7 @@ src/webgpu/api/operation/buffers/threading.spec.ts src/webgpu/api/operation/command_buffer/basic.spec.ts src/webgpu/api/operation/command_buffer/clearBuffer.spec.ts src/webgpu/api/operation/command_buffer/copyBufferToBuffer.spec.ts +src/webgpu/util/texture/data_generation.ts src/webgpu/api/operation/command_buffer/copyTextureToTexture.spec.ts src/webgpu/api/operation/command_buffer/image_copy.spec.ts src/webgpu/api/operation/command_buffer/programmable/programmable_state_test.ts @@ -154,7 +160,7 @@ src/webgpu/api/operation/render_pass/storeOp.spec.ts src/webgpu/api/operation/render_pass/storeop2.spec.ts src/webgpu/api/operation/render_pipeline/alpha_to_coverage.spec.ts src/webgpu/api/operation/render_pipeline/culling_tests.spec.ts -src/webgpu/api/operation/render_pipeline/entry_point_name.spec.ts +src/webgpu/util/shader.ts src/webgpu/util/texture/texture_ok.ts src/webgpu/api/operation/render_pipeline/pipeline_output_targets.spec.ts src/webgpu/api/operation/render_pipeline/primitive_topology.spec.ts @@ -183,32 +189,27 @@ src/webgpu/api/operation/texture_view/write.spec.ts src/webgpu/api/operation/vertex_state/correctness.spec.ts src/webgpu/api/operation/vertex_state/index_format.spec.ts src/webgpu/api/validation/validation_test.ts -src/webgpu/api/validation/attachment_compatibility.spec.ts +src/webgpu/api/validation/compute_pipeline.spec.ts src/webgpu/api/validation/createBindGroup.spec.ts src/webgpu/api/validation/createBindGroupLayout.spec.ts -src/webgpu/api/validation/createComputePipeline.spec.ts src/webgpu/api/validation/createPipelineLayout.spec.ts -src/webgpu/api/validation/createRenderPipeline.spec.ts src/webgpu/api/validation/createSampler.spec.ts src/webgpu/api/validation/createTexture.spec.ts src/webgpu/api/validation/createView.spec.ts -src/webgpu/api/validation/create_pipeline.spec.ts src/webgpu/api/validation/error_scope.spec.ts src/webgpu/api/validation/layout_shader_compat.spec.ts -src/webgpu/api/validation/render_pass_descriptor.spec.ts -src/webgpu/api/validation/vertex_state.spec.ts src/webgpu/api/validation/buffer/create.spec.ts src/webgpu/api/validation/buffer/destroy.spec.ts src/webgpu/api/validation/buffer/mapping.spec.ts src/webgpu/api/validation/buffer/threading.spec.ts -src/webgpu/api/validation/capability_checks/features/depth_clip_control.spec.ts src/webgpu/api/validation/capability_checks/features/query_types.spec.ts +src/webgpu/util/create_elements.ts src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts +src/webgpu/api/validation/encoding/beginComputePass.spec.ts src/webgpu/api/validation/encoding/beginRenderPass.spec.ts src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts src/webgpu/api/validation/encoding/encoder_state.spec.ts src/webgpu/api/validation/encoding/render_bundle.spec.ts -src/webgpu/api/validation/encoding/cmds/buffer_texture_copies.spec.ts src/webgpu/api/validation/encoding/cmds/clearBuffer.spec.ts src/webgpu/api/validation/encoding/cmds/compute_pass.spec.ts src/webgpu/api/validation/encoding/cmds/copyBufferToBuffer.spec.ts @@ -233,6 +234,7 @@ src/webgpu/api/validation/encoding/queries/pipeline_statistics.spec.ts src/webgpu/api/validation/encoding/queries/resolveQuerySet.spec.ts src/webgpu/api/validation/image_copy/image_copy.ts src/webgpu/api/validation/image_copy/buffer_related.spec.ts +src/webgpu/api/validation/image_copy/buffer_texture_copies.spec.ts src/webgpu/api/validation/image_copy/layout_related.spec.ts src/webgpu/api/validation/image_copy/texture_related.spec.ts src/webgpu/api/validation/initialization/requestDevice.spec.ts @@ -241,15 +243,28 @@ src/webgpu/api/validation/query_set/destroy.spec.ts src/webgpu/api/validation/queue/buffer_mapped.spec.ts src/webgpu/api/validation/queue/submit.spec.ts src/webgpu/api/validation/queue/writeBuffer.spec.ts -src/webgpu/util/create_elements.ts +src/webgpu/api/validation/queue/writeTexture.spec.ts src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts src/webgpu/api/validation/queue/destroyed/query_set.spec.ts +src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts +src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts src/webgpu/api/validation/render_pass/resolve.spec.ts src/webgpu/api/validation/render_pass/storeOp.spec.ts +src/webgpu/api/validation/render_pipeline/common.ts +src/webgpu/api/validation/render_pipeline/depth_stencil_state.spec.ts +src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts +src/webgpu/api/validation/render_pipeline/inter_stage.spec.ts +src/webgpu/api/validation/render_pipeline/misc.spec.ts +src/webgpu/api/validation/render_pipeline/multisample_state.spec.ts +src/webgpu/api/validation/render_pipeline/primitive_state.spec.ts +src/webgpu/api/validation/render_pipeline/shader_module.spec.ts +src/webgpu/api/validation/render_pipeline/vertex_state.spec.ts src/webgpu/api/validation/resource_usages/buffer/in_pass_encoder.spec.ts +src/webgpu/api/validation/resource_usages/buffer/in_pass_misc.spec.ts src/webgpu/api/validation/resource_usages/texture/in_pass_encoder.spec.ts src/webgpu/api/validation/resource_usages/texture/in_render_common.spec.ts src/webgpu/api/validation/resource_usages/texture/in_render_misc.spec.ts +src/webgpu/api/validation/shader_module/entry_point.spec.ts src/webgpu/api/validation/state/device_lost/destroy.spec.ts src/webgpu/api/validation/texture/destroy.spec.ts src/webgpu/idl/exposed.html.ts @@ -279,6 +294,17 @@ src/webgpu/shader/execution/expression/call/builtin/asinh.spec.ts src/webgpu/shader/execution/expression/call/builtin/atan.spec.ts src/webgpu/shader/execution/expression/call/builtin/atan2.spec.ts src/webgpu/shader/execution/expression/call/builtin/atanh.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicAdd.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicAnd.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicCompareExchangeWeak.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicExchange.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicLoad.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicMax.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicMin.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicOr.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicStore.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicSub.spec.ts +src/webgpu/shader/execution/expression/call/builtin/atomicXor.spec.ts src/webgpu/shader/execution/expression/call/builtin/ceil.spec.ts src/webgpu/shader/execution/expression/call/builtin/clamp.spec.ts src/webgpu/shader/execution/expression/call/builtin/cos.spec.ts @@ -321,6 +347,11 @@ src/webgpu/shader/execution/expression/call/builtin/min.spec.ts src/webgpu/shader/execution/expression/call/builtin/mix.spec.ts src/webgpu/shader/execution/expression/call/builtin/modf.spec.ts src/webgpu/shader/execution/expression/call/builtin/normalize.spec.ts +src/webgpu/shader/execution/expression/call/builtin/pack2x16float.spec.ts +src/webgpu/shader/execution/expression/call/builtin/pack2x16snorm.spec.ts +src/webgpu/shader/execution/expression/call/builtin/pack2x16unorm.spec.ts +src/webgpu/shader/execution/expression/call/builtin/pack4x8snorm.spec.ts +src/webgpu/shader/execution/expression/call/builtin/pack4x8unorm.spec.ts src/webgpu/shader/execution/expression/call/builtin/pow.spec.ts src/webgpu/shader/execution/expression/call/builtin/quantizeToF16.spec.ts src/webgpu/shader/execution/expression/call/builtin/radians.spec.ts @@ -328,6 +359,7 @@ src/webgpu/shader/execution/expression/call/builtin/reflect.spec.ts src/webgpu/shader/execution/expression/call/builtin/refract.spec.ts src/webgpu/shader/execution/expression/call/builtin/reverseBits.spec.ts src/webgpu/shader/execution/expression/call/builtin/round.spec.ts +src/webgpu/shader/execution/expression/call/builtin/saturate.spec.ts src/webgpu/shader/execution/expression/call/builtin/select.spec.ts src/webgpu/shader/execution/expression/call/builtin/sign.spec.ts src/webgpu/shader/execution/expression/call/builtin/sin.spec.ts @@ -335,10 +367,32 @@ src/webgpu/shader/execution/expression/call/builtin/sinh.spec.ts src/webgpu/shader/execution/expression/call/builtin/smoothstep.spec.ts src/webgpu/shader/execution/expression/call/builtin/sqrt.spec.ts src/webgpu/shader/execution/expression/call/builtin/step.spec.ts +src/webgpu/shader/execution/expression/call/builtin/storageBarrier.spec.ts src/webgpu/shader/execution/expression/call/builtin/tan.spec.ts src/webgpu/shader/execution/expression/call/builtin/tanh.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureDimension.spec.ts +src/webgpu/shader/execution/expression/call/builtin/utils.ts +src/webgpu/shader/execution/expression/call/builtin/textureGather.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureGatherCompare.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureNumLayers.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureNumLevels.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureNumSamples.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureSample.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureSampleBias.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureSampleCompare.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureSampleCompareLevel.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureSampleGrad.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureSampleLevel.spec.ts +src/webgpu/shader/execution/expression/call/builtin/textureStore.spec.ts src/webgpu/shader/execution/expression/call/builtin/transpose.spec.ts src/webgpu/shader/execution/expression/call/builtin/trunc.spec.ts +src/webgpu/shader/execution/expression/call/builtin/unpack2x16float.spec.ts +src/webgpu/shader/execution/expression/call/builtin/unpack2x16snorm.spec.ts +src/webgpu/shader/execution/expression/call/builtin/unpack2x16unorm.spec.ts +src/webgpu/shader/execution/expression/call/builtin/unpack4x8snorm.spec.ts +src/webgpu/shader/execution/expression/call/builtin/unpack4x8unorm.spec.ts +src/webgpu/shader/execution/expression/call/builtin/workgroupBarrier.spec.ts src/webgpu/shader/execution/expression/unary/unary.ts src/webgpu/shader/execution/expression/unary/f32_arithmetic.spec.ts src/webgpu/shader/execution/memory_model/memory_model_setup.ts @@ -350,7 +404,9 @@ src/webgpu/shader/execution/sampling/gradients_in_varying_loop.spec.ts src/webgpu/shader/execution/shader_io/compute_builtins.spec.ts src/webgpu/shader/execution/shader_io/shared_structs.spec.ts src/webgpu/shader/validation/shader_validation_test.ts +src/webgpu/shader/validation/parse/align.spec.ts src/webgpu/shader/validation/parse/blankspace.spec.ts +src/webgpu/shader/validation/parse/builtin.spec.ts src/webgpu/shader/validation/parse/comments.spec.ts src/webgpu/shader/validation/parse/identifiers.spec.ts src/webgpu/shader/validation/parse/literal.spec.ts @@ -358,7 +414,7 @@ src/webgpu/shader/validation/parse/source.spec.ts src/webgpu/shader/validation/parse/var_and_let.spec.ts src/webgpu/shader/validation/shader_io/util.ts src/webgpu/shader/validation/shader_io/builtins.spec.ts -src/webgpu/shader/validation/shader_io/entry_point.ts +src/webgpu/shader/validation/shader_io/entry_point.spec.ts src/webgpu/shader/validation/shader_io/interpolate.spec.ts src/webgpu/shader/validation/shader_io/invariant.spec.ts src/webgpu/shader/validation/shader_io/locations.spec.ts @@ -371,7 +427,7 @@ src/webgpu/web_platform/util.ts src/webgpu/web_platform/canvas/configure.spec.ts src/webgpu/web_platform/canvas/context_creation.spec.ts src/webgpu/web_platform/canvas/getCurrentTexture.spec.ts -src/webgpu/web_platform/canvas/getPreferredFormat.spec.ts +src/webgpu/web_platform/canvas/getPreferredCanvasFormat.spec.ts src/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.ts src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts src/webgpu/web_platform/copyToTexture/canvas.spec.ts diff --git a/third_party/khronos/EGL/egl.h b/third_party/khronos/EGL/egl.h new file mode 100644 index 0000000000..97d0878cc7 --- /dev/null +++ b/third_party/khronos/EGL/egl.h @@ -0,0 +1,342 @@ +#ifndef __egl_h_ +#define __egl_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: Apache-2.0 +** +** This header is generated from the Khronos EGL XML API Registry. +** The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.khronos.org/registry/egl +** +** Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ +*/ + +#include + +#ifndef EGL_EGL_PROTOTYPES +#define EGL_EGL_PROTOTYPES 1 +#endif + +/* Generated on date 20220525 */ + +/* Generated C header for: + * API: egl + * Versions considered: .* + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef EGL_VERSION_1_0 +#define EGL_VERSION_1_0 1 +typedef unsigned int EGLBoolean; +typedef void *EGLDisplay; +#include +#include +typedef void *EGLConfig; +typedef void *EGLSurface; +typedef void *EGLContext; +typedef void (*__eglMustCastToProperFunctionPointerType)(void); +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_BLUE_SIZE 0x3022 +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_CORE_NATIVE_ENGINE 0x305B +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_DONT_CARE EGL_CAST(EGLint,-1) +#define EGL_DRAW 0x3059 +#define EGL_EXTENSIONS 0x3055 +#define EGL_FALSE 0 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_HEIGHT 0x3056 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +#define EGL_NONE 0x3038 +#define EGL_NON_CONFORMANT_CONFIG 0x3051 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0) +#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0) +#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0) +#define EGL_PBUFFER_BIT 0x0001 +#define EGL_PIXMAP_BIT 0x0002 +#define EGL_READ 0x305A +#define EGL_RED_SIZE 0x3024 +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SLOW_CONFIG 0x3050 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_SUCCESS 0x3000 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_TRANSPARENT_RGB 0x3052 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRUE 1 +#define EGL_VENDOR 0x3053 +#define EGL_VERSION 0x3054 +#define EGL_WIDTH 0x3057 +#define EGL_WINDOW_BIT 0x0004 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSECONFIGPROC) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); +typedef EGLContext (EGLAPIENTRYP PFNEGLCREATECONTEXTPROC) (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERSURFACEPROC) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGATTRIBPROC) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGSPROC) (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETCURRENTDISPLAYPROC) (void); +typedef EGLSurface (EGLAPIENTRYP PFNEGLGETCURRENTSURFACEPROC) (EGLint readdraw); +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDISPLAYPROC) (EGLNativeDisplayType display_id); +typedef EGLint (EGLAPIENTRYP PFNEGLGETERRORPROC) (void); +typedef __eglMustCastToProperFunctionPointerType (EGLAPIENTRYP PFNEGLGETPROCADDRESSPROC) (const char *procname); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLINITIALIZEPROC) (EGLDisplay dpy, EGLint *major, EGLint *minor); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLMAKECURRENTPROC) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGPROC) (EGLDisplay dpy, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLTERMINATEPROC) (EGLDisplay dpy); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITGLPROC) (void); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITNATIVEPROC) (EGLint engine); +#if EGL_EGL_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); +EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void); +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw); +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id); +EGLAPI EGLint EGLAPIENTRY eglGetError (void); +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); +EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); +#endif +#endif /* EGL_VERSION_1_0 */ + +#ifndef EGL_VERSION_1_1 +#define EGL_VERSION_1_1 1 +#define EGL_BACK_BUFFER 0x3084 +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_CONTEXT_LOST 0x300E +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C +#define EGL_MIPMAP_TEXTURE 0x3082 +#define EGL_MIPMAP_LEVEL 0x3083 +#define EGL_NO_TEXTURE 0x305C +#define EGL_TEXTURE_2D 0x305F +#define EGL_TEXTURE_FORMAT 0x3080 +#define EGL_TEXTURE_RGB 0x305D +#define EGL_TEXTURE_RGBA 0x305E +#define EGL_TEXTURE_TARGET 0x3081 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDTEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSURFACEATTRIBPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPINTERVALPROC) (EGLDisplay dpy, EGLint interval); +#if EGL_EGL_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); +#endif +#endif /* EGL_VERSION_1_1 */ + +#ifndef EGL_VERSION_1_2 +#define EGL_VERSION_1_2 1 +typedef unsigned int EGLenum; +typedef void *EGLClientBuffer; +#define EGL_ALPHA_FORMAT 0x3088 +#define EGL_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_ALPHA_FORMAT_PRE 0x308C +#define EGL_ALPHA_MASK_SIZE 0x303E +#define EGL_BUFFER_PRESERVED 0x3094 +#define EGL_BUFFER_DESTROYED 0x3095 +#define EGL_CLIENT_APIS 0x308D +#define EGL_COLORSPACE 0x3087 +#define EGL_COLORSPACE_sRGB 0x3089 +#define EGL_COLORSPACE_LINEAR 0x308A +#define EGL_COLOR_BUFFER_TYPE 0x303F +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 +#define EGL_DISPLAY_SCALING 10000 +#define EGL_HORIZONTAL_RESOLUTION 0x3090 +#define EGL_LUMINANCE_BUFFER 0x308F +#define EGL_LUMINANCE_SIZE 0x303D +#define EGL_OPENGL_ES_BIT 0x0001 +#define EGL_OPENVG_BIT 0x0002 +#define EGL_OPENGL_ES_API 0x30A0 +#define EGL_OPENVG_API 0x30A1 +#define EGL_OPENVG_IMAGE 0x3096 +#define EGL_PIXEL_ASPECT_RATIO 0x3092 +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_RGB_BUFFER 0x308E +#define EGL_SINGLE_BUFFER 0x3085 +#define EGL_SWAP_BEHAVIOR 0x3093 +#define EGL_UNKNOWN EGL_CAST(EGLint,-1) +#define EGL_VERTICAL_RESOLUTION 0x3091 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDAPIPROC) (EGLenum api); +typedef EGLenum (EGLAPIENTRYP PFNEGLQUERYAPIPROC) (void); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETHREADPROC) (void); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITCLIENTPROC) (void); +#if EGL_EGL_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); +#endif +#endif /* EGL_VERSION_1_2 */ + +#ifndef EGL_VERSION_1_3 +#define EGL_VERSION_1_3 1 +#define EGL_CONFORMANT 0x3042 +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 +#define EGL_OPENGL_ES2_BIT 0x0004 +#define EGL_VG_ALPHA_FORMAT 0x3088 +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 +#define EGL_VG_COLORSPACE 0x3087 +#define EGL_VG_COLORSPACE_sRGB 0x3089 +#define EGL_VG_COLORSPACE_LINEAR 0x308A +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 +#endif /* EGL_VERSION_1_3 */ + +#ifndef EGL_VERSION_1_4 +#define EGL_VERSION_1_4 1 +#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0) +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 +#define EGL_MULTISAMPLE_RESOLVE 0x3099 +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B +#define EGL_OPENGL_API 0x30A2 +#define EGL_OPENGL_BIT 0x0008 +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 +typedef EGLContext (EGLAPIENTRYP PFNEGLGETCURRENTCONTEXTPROC) (void); +#if EGL_EGL_PROTOTYPES +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); +#endif +#endif /* EGL_VERSION_1_4 */ + +#ifndef EGL_VERSION_1_5 +#define EGL_VERSION_1_5 1 +typedef void *EGLSync; +typedef intptr_t EGLAttrib; +typedef khronos_utime_nanoseconds_t EGLTime; +typedef void *EGLImage; +#define EGL_CONTEXT_MAJOR_VERSION 0x3098 +#define EGL_CONTEXT_MINOR_VERSION 0x30FB +#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD +#define EGL_NO_RESET_NOTIFICATION 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2 +#define EGL_OPENGL_ES3_BIT 0x00000040 +#define EGL_CL_EVENT_HANDLE 0x309C +#define EGL_SYNC_CL_EVENT 0x30FE +#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0 +#define EGL_SYNC_TYPE 0x30F7 +#define EGL_SYNC_STATUS 0x30F1 +#define EGL_SYNC_CONDITION 0x30F8 +#define EGL_SIGNALED 0x30F2 +#define EGL_UNSIGNALED 0x30F3 +#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001 +#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull +#define EGL_TIMEOUT_EXPIRED 0x30F5 +#define EGL_CONDITION_SATISFIED 0x30F6 +#define EGL_NO_SYNC EGL_CAST(EGLSync,0) +#define EGL_SYNC_FENCE 0x30F9 +#define EGL_GL_COLORSPACE 0x309D +#define EGL_GL_COLORSPACE_SRGB 0x3089 +#define EGL_GL_COLORSPACE_LINEAR 0x308A +#define EGL_GL_RENDERBUFFER 0x30B9 +#define EGL_GL_TEXTURE_2D 0x30B1 +#define EGL_GL_TEXTURE_LEVEL 0x30BC +#define EGL_GL_TEXTURE_3D 0x30B2 +#define EGL_GL_TEXTURE_ZOFFSET 0x30BD +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 +#define EGL_IMAGE_PRESERVED 0x30D2 +#define EGL_NO_IMAGE EGL_CAST(EGLImage,0) +typedef EGLSync (EGLAPIENTRYP PFNEGLCREATESYNCPROC) (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCPROC) (EGLDisplay dpy, EGLSync sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBPROC) (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); +typedef EGLImage (EGLAPIENTRYP PFNEGLCREATEIMAGEPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEPROC) (EGLDisplay dpy, EGLImage image); +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYPROC) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags); +#if EGL_EGL_PROTOTYPES +EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); +EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image); +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); +#endif +#endif /* EGL_VERSION_1_5 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third_party/khronos/EGL/eglplatform.h b/third_party/khronos/EGL/eglplatform.h new file mode 100644 index 0000000000..99362a23de --- /dev/null +++ b/third_party/khronos/EGL/eglplatform.h @@ -0,0 +1,169 @@ +#ifndef __eglplatform_h_ +#define __eglplatform_h_ + +/* +** Copyright 2007-2020 The Khronos Group Inc. +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* Platform-specific types and definitions for egl.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by filing an issue or pull request on the public Khronos EGL Registry, at + * https://www.github.com/KhronosGroup/EGL-Registry/ + */ + +#include + +/* Macros used in EGL function prototype declarations. + * + * EGL functions should be prototyped as: + * + * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); + * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); + * + * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h + */ + +#ifndef EGLAPI +#define EGLAPI KHRONOS_APICALL +#endif + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY KHRONOS_APIENTRY +#endif +#define EGLAPIENTRYP EGLAPIENTRY* + +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType + * are aliases of window-system-dependent types, such as X Display * or + * Windows Device Context. They must be defined in platform-specific + * code below. The EGL-prefixed versions of Native*Type are the same + * types, renamed in EGL 1.3 so all types in the API start with "EGL". + * + * Khronos STRONGLY RECOMMENDS that you use the default definitions + * provided below, since these changes affect both binary and source + * portability of applications using EGL running on different EGL + * implementations. + */ + +#if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES) + +typedef void *EGLNativeDisplayType; +typedef void *EGLNativePixmapType; +typedef void *EGLNativeWindowType; + +#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include + +typedef HDC EGLNativeDisplayType; +typedef HBITMAP EGLNativePixmapType; +typedef HWND EGLNativeWindowType; + +#elif defined(__EMSCRIPTEN__) + +typedef int EGLNativeDisplayType; +typedef int EGLNativePixmapType; +typedef int EGLNativeWindowType; + +#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ + +typedef int EGLNativeDisplayType; +typedef void *EGLNativePixmapType; +typedef void *EGLNativeWindowType; + +#elif defined(WL_EGL_PLATFORM) + +typedef struct wl_display *EGLNativeDisplayType; +typedef struct wl_egl_pixmap *EGLNativePixmapType; +typedef struct wl_egl_window *EGLNativeWindowType; + +#elif defined(__GBM__) + +typedef struct gbm_device *EGLNativeDisplayType; +typedef struct gbm_bo *EGLNativePixmapType; +typedef void *EGLNativeWindowType; + +#elif defined(__ANDROID__) || defined(ANDROID) + +struct ANativeWindow; +struct egl_native_pixmap_t; + +typedef void* EGLNativeDisplayType; +typedef struct egl_native_pixmap_t* EGLNativePixmapType; +typedef struct ANativeWindow* EGLNativeWindowType; + +#elif defined(USE_OZONE) + +typedef intptr_t EGLNativeDisplayType; +typedef intptr_t EGLNativePixmapType; +typedef intptr_t EGLNativeWindowType; + +#elif defined(USE_X11) + +/* X11 (tentative) */ +#include +#include + +typedef Display *EGLNativeDisplayType; +typedef Pixmap EGLNativePixmapType; +typedef Window EGLNativeWindowType; + +#elif defined(__unix__) + +typedef void *EGLNativeDisplayType; +typedef khronos_uintptr_t EGLNativePixmapType; +typedef khronos_uintptr_t EGLNativeWindowType; + +#elif defined(__APPLE__) + +typedef int EGLNativeDisplayType; +typedef void *EGLNativePixmapType; +typedef void *EGLNativeWindowType; + +#elif defined(__HAIKU__) + +#include + +typedef void *EGLNativeDisplayType; +typedef khronos_uintptr_t EGLNativePixmapType; +typedef khronos_uintptr_t EGLNativeWindowType; + +#elif defined(__Fuchsia__) + +typedef void *EGLNativeDisplayType; +typedef khronos_uintptr_t EGLNativePixmapType; +typedef khronos_uintptr_t EGLNativeWindowType; + +#else +#error "Platform not recognized" +#endif + +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +typedef EGLNativeDisplayType NativeDisplayType; +typedef EGLNativePixmapType NativePixmapType; +typedef EGLNativeWindowType NativeWindowType; + + +/* Define EGLint. This must be a signed integral type large enough to contain + * all legal attribute names and values passed into and out of EGL, whether + * their type is boolean, bitmask, enumerant (symbolic constant), integer, + * handle, or other. While in general a 32-bit integer will suffice, if + * handles are 64 bit types, then EGLint should be defined as a signed 64-bit + * integer type. + */ +typedef khronos_int32_t EGLint; + + +/* C++ / C typecast macros for special EGL handle values */ +#if defined(__cplusplus) +#define EGL_CAST(type, value) (static_cast(value)) +#else +#define EGL_CAST(type, value) ((type) (value)) +#endif + +#endif /* __eglplatform_h */ diff --git a/third_party/khronos/LICENSE b/third_party/khronos/LICENSE new file mode 100644 index 0000000000..f3edea4165 --- /dev/null +++ b/third_party/khronos/LICENSE @@ -0,0 +1,36 @@ +Copyright 2013-2020 The Khronos Group Inc. +SPDX-License-Identifier: Apache-2.0 + +This header is generated from the Khronos EGL XML API Registry. +The current version of the Registry, generator scripts +used to make the header, and the header can be found at + http://www.khronos.org/registry/egl + +Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ + + +Copyright 2007-2020 The Khronos Group Inc. +SPDX-License-Identifier: Apache-2.0 + +Platform-specific types and definitions for egl.h + +Adopters may modify khrplatform.h and this file to suit their platform. +You are encouraged to submit all modifications to the Khronos group so that +they can be included in future versions of this file. Please submit changes +by filing an issue or pull request on the public Khronos EGL Registry, at +https://www.github.com/KhronosGroup/EGL-Registry/ + + +Copyright (c) 2013-2018 The Khronos Group Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/tint_overrides_with_defaults.gni b/tint_overrides_with_defaults.gni index 9680e353aa..9e39248310 100644 --- a/tint_overrides_with_defaults.gni +++ b/tint_overrides_with_defaults.gni @@ -71,4 +71,9 @@ declare_args() { if (!defined(tint_build_glsl_writer)) { tint_build_glsl_writer = true } + + # Build unittests + if (!defined(tint_build_unittests)) { + tint_build_unittests = true + } } diff --git a/tools/cfi/ignores.txt b/tools/cfi/ignores.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tools/setup-build b/tools/setup-build index 49ecc6cf96..76ec76c5b9 100755 --- a/tools/setup-build +++ b/tools/setup-build @@ -46,7 +46,7 @@ case $BUILD_SYSTEM in generate "gn gen out/active --args=is_debug=true" ;; "release") - generate "gn gen out/active" + generate "gn gen out/active --args=is_debug=false" ;; *) echo "invalid build type '${BUILD_TYPE}'" diff --git a/tools/src/cmd/check-spec-examples/main.go b/tools/src/cmd/check-spec-examples/main.go index 0b891266d3..b641dc9e9e 100644 --- a/tools/src/cmd/check-spec-examples/main.go +++ b/tools/src/cmd/check-spec-examples/main.go @@ -203,7 +203,7 @@ type example struct { func tryCompile(compiler, wd string, e example) error { code := e.code if e.functionScope { - code = "\n@stage(vertex) fn main() -> @builtin(position) vec4 {\n" + code + " return vec4();}\n" + code = "\n@vertex fn main() -> @builtin(position) vec4 {\n" + code + " return vec4();}\n" } addedStubFunction := false @@ -214,7 +214,7 @@ func tryCompile(compiler, wd string, e example) error { } if !addedStubFunction { - code += "\n@stage(vertex) fn main() {}\n" + code += "\n@vertex fn main() {}\n" addedStubFunction = true continue } diff --git a/tools/src/cmd/cts/common/build.go b/tools/src/cmd/cts/common/build.go index ca4985c11f..99ce99d791 100644 --- a/tools/src/cmd/cts/common/build.go +++ b/tools/src/cmd/cts/common/build.go @@ -137,9 +137,20 @@ func GetOrStartBuildsAndWait( } } + // Returns true if the build should be re-kicked + shouldKick := func(build buildbucket.Build) bool { + switch build.Status { + case buildbucket.StatusUnknown, + buildbucket.StatusInfraFailure, + buildbucket.StatusCanceled: + return true + } + return false + } + // Kick any missing builds for name, builder := range cfg.Builders { - if _, existing := builds[name]; !existing { + if build, found := builds[name]; !found || shouldKick(build) { build, err := bb.StartBuild(ctx, ps, builder, retest) if err != nil { return nil, err diff --git a/tools/src/cmd/cts/common/config.go b/tools/src/cmd/cts/common/config.go index c37699bc26..84393c5a16 100644 --- a/tools/src/cmd/cts/common/config.go +++ b/tools/src/cmd/cts/common/config.go @@ -55,10 +55,6 @@ type Config struct { Builders map[string]buildbucket.Builder // Tags holds configuration data for cleaning result tags before processing Tag struct { - // TagAliases is a list of tags which are treated as equivalent. - // For example, some GPUs are similar enough to be considered equivalent. - // See crbug.com/dawn/1387 for more information. - Aliases [][]string // Remove holds tags that should be removed before processing. // See crbug.com/dawn/1401 for more information. Remove []string diff --git a/tools/src/cmd/cts/common/results.go b/tools/src/cmd/cts/common/results.go index 095106a753..da761471b9 100644 --- a/tools/src/cmd/cts/common/results.go +++ b/tools/src/cmd/cts/common/results.go @@ -218,13 +218,20 @@ func GetResults( status := toStatus(rpb.Status) tags := result.NewTags() + duration := rpb.GetDuration().AsDuration() + for _, sp := range rpb.Tags { if sp.Key == "typ_tag" { tags.Add(sp.Value) } + if sp.Key == "javascript_duration" { + var err error + if duration, err = time.ParseDuration(sp.Value); err != nil { + return err + } + } } - duration := rpb.GetDuration().AsDuration() if status == result.Pass && duration > cfg.Test.SlowThreshold { status = result.Slow } @@ -324,26 +331,16 @@ func MostRecentResultsForChange( return nil, gerrit.Patchset{}, fmt.Errorf("no builds found for change %v", change) } -// CleanTags modifies each result so that tags which are found in -// cfg.TagAliases are expanded to include all the tag aliases. -// Tags in cfg.Tag.Remove are also removed. -// Finally, duplicate results are removed by erring towards Failure. +// CleanTags modifies each result so that tags in cfg.Tag.Remove are removed and +// duplicate results are removed by erring towards Failure. // See: crbug.com/dawn/1387, crbug.com/dawn/1401 func CleanTags(cfg Config, results *result.List) { + // Remove any tags found in cfg.Tag.Remove remove := result.NewTags(cfg.Tag.Remove...) - aliases := make([]result.Tags, len(cfg.Tag.Aliases)) - for i, l := range cfg.Tag.Aliases { - aliases[i] = result.NewTags(l...) - } - // Expand the result tags for the aliased tag sets for _, r := range *results { - for _, set := range aliases { - if r.Tags.ContainsAny(set) { - r.Tags.AddAll(set) - } - } r.Tags.RemoveAll(remove) } + // Clean up duplicate results *results = results.ReplaceDuplicates(func(s result.Statuses) result.Status { // If all results have the same status, then use that. if len(s) == 1 { @@ -355,6 +352,10 @@ func CleanTags(cfg Config, results *result.List) { return result.Crash case s.Contains(result.Abort): return result.Abort + case s.Contains(result.Failure): + return result.Failure + case s.Contains(result.Slow): + return result.Slow } return result.Failure }) diff --git a/tools/src/cmd/cts/config.json b/tools/src/cmd/cts/config.json index 30a73ee610..c2b16fd4a8 100644 --- a/tools/src/cmd/cts/config.json +++ b/tools/src/cmd/cts/config.json @@ -40,16 +40,12 @@ } }, "Tag": { - "Aliases": [ - [ - // crbug.com/dawn/1387 - "intel-0x5912", - "intel-0x3e92" - ] - ], "Remove": [ // crbug.com/dawn/1401 - "release-x64" + "release-x64", + // crbug.com/dawn/1387, crbug.com/dawn/1444 + "intel-0x5912", + "intel-0x3e92" ], }, "Sheets": { diff --git a/tools/src/cmd/cts/format/format.go b/tools/src/cmd/cts/format/format.go index 823e1bea1c..bb2aa702de 100644 --- a/tools/src/cmd/cts/format/format.go +++ b/tools/src/cmd/cts/format/format.go @@ -51,5 +51,11 @@ func (c *cmd) Run(ctx context.Context, cfg common.Config) error { if err != nil { return err } + + // Sort the expectations in each chunk. + for _, chunk := range ex.Chunks { + chunk.Expectations.Sort() + } + return ex.Save(c.flags.expectations) } diff --git a/tools/src/cmd/cts/roll/roll.go b/tools/src/cmd/cts/roll/roll.go index 98cc5e62c7..69bebd1f6c 100644 --- a/tools/src/cmd/cts/roll/roll.go +++ b/tools/src/cmd/cts/roll/roll.go @@ -15,6 +15,7 @@ package roll import ( + "bytes" "context" "flag" "fmt" @@ -25,6 +26,7 @@ import ( "sort" "strconv" "strings" + "sync" "text/tabwriter" "time" @@ -33,12 +35,15 @@ import ( "dawn.googlesource.com/dawn/tools/src/container" "dawn.googlesource.com/dawn/tools/src/cts/expectations" "dawn.googlesource.com/dawn/tools/src/cts/result" + "dawn.googlesource.com/dawn/tools/src/fileutils" "dawn.googlesource.com/dawn/tools/src/gerrit" "dawn.googlesource.com/dawn/tools/src/git" "dawn.googlesource.com/dawn/tools/src/gitiles" "dawn.googlesource.com/dawn/tools/src/resultsdb" "go.chromium.org/luci/auth" "go.chromium.org/luci/auth/client/authcli" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) func init() { @@ -46,15 +51,19 @@ func init() { } const ( - depsRelPath = "DEPS" - tsSourcesRelPath = "third_party/gn/webgpu-cts/ts_sources.txt" - refMain = "refs/heads/main" - noExpectations = `# Clear all expectations to obtain full list of results` + depsRelPath = "DEPS" + tsSourcesRelPath = "third_party/gn/webgpu-cts/ts_sources.txt" + testListRelPath = "third_party/gn/webgpu-cts/test_list.txt" + resourceFilesRelPath = "third_party/gn/webgpu-cts/resource_files.txt" + webTestsPath = "webgpu-cts/webtests" + refMain = "refs/heads/main" + noExpectations = `# Clear all expectations to obtain full list of results` ) type rollerFlags struct { gitPath string - tscPath string + npmPath string + nodePath string auth authcli.Flags cacheDir string force bool // Create a new roll, even if CTS is up to date @@ -76,10 +85,12 @@ func (cmd) Desc() string { func (c *cmd) RegisterFlags(ctx context.Context, cfg common.Config) ([]string, error) { gitPath, _ := exec.LookPath("git") - tscPath, _ := exec.LookPath("tsc") + npmPath, _ := exec.LookPath("npm") + nodePath, _ := exec.LookPath("node") c.flags.auth.Register(flag.CommandLine, common.DefaultAuthOptions()) flag.StringVar(&c.flags.gitPath, "git", gitPath, "path to git") - flag.StringVar(&c.flags.tscPath, "tsc", tscPath, "path to tsc") + flag.StringVar(&c.flags.npmPath, "npm", npmPath, "path to npm") + flag.StringVar(&c.flags.nodePath, "node", nodePath, "path to node") flag.StringVar(&c.flags.cacheDir, "cache", common.DefaultCacheDir, "path to the results cache") flag.BoolVar(&c.flags.force, "force", false, "create a new roll, even if CTS is up to date") flag.BoolVar(&c.flags.rebuild, "rebuild", false, "rebuild the expectation file from scratch") @@ -97,13 +108,14 @@ func (c *cmd) Run(ctx context.Context, cfg common.Config) error { // Check tools can be found for _, tool := range []struct { - name, path string + name, path, hint string }{ {name: "git", path: c.flags.gitPath}, - {name: "tsc", path: c.flags.tscPath}, + {name: "npm", path: c.flags.npmPath}, + {name: "node", path: c.flags.nodePath}, } { if _, err := os.Stat(tool.path); err != nil { - return fmt.Errorf("failed to find path to %v: %v", tool.name, err) + return fmt.Errorf("failed to find path to %v: %v. %v", tool.name, err, tool.hint) } } @@ -229,10 +241,29 @@ func (r *roller) roll(ctx context.Context) error { ex = rebuilt } - // Regenerate the typescript dependency list - tsSources, err := r.genTSDepList(ctx) + generatedFiles, err := r.generateFiles(ctx) if err != nil { - return fmt.Errorf("failed to generate ts_sources.txt: %v", err) + return err + } + + deletedFiles := []string{} + if currentWebTestFiles, err := r.dawn.ListFiles(ctx, dawnHash, webTestsPath); err != nil { + // If there's an error, allow NotFound. It means the directory did not exist, so no files + // need to be deleted. + if e, ok := status.FromError(err); !ok || e.Code() != codes.NotFound { + return fmt.Errorf("listing current web tests failed: %v", err) + } + + for _, f := range currentWebTestFiles { + // If the file is not generated in this revision, and it is an .html file, + // mark it for deletion. + if !strings.HasSuffix(f, ".html") { + continue + } + if _, exists := generatedFiles[f]; !exists { + deletedFiles = append(deletedFiles, f) + } + } } // Look for an existing gerrit change to update @@ -261,22 +292,19 @@ func (r *roller) roll(ctx context.Context) error { return err } changeID = change.ID - log.Printf("created gerrit change %v...", change.Number) + log.Printf("created gerrit change %v (%v)...", change.Number, change.URL) } else { changeID = existingRolls[0].ID - log.Printf("reusing existing gerrit change %v...", existingRolls[0].Number) + log.Printf("reusing existing gerrit change %v (%v)...", existingRolls[0].Number, existingRolls[0].URL) } - // Update the DEPS, and ts-sources file. - // Update the expectations with the re-formatted content, and updated - //timestamp. + // Update the DEPS, expectations, and other generated files. updateExpectationUpdateTimestamp(&ex) + generatedFiles[depsRelPath] = updatedDEPS + generatedFiles[common.RelativeExpectationsPath] = ex.String() + msg := r.rollCommitMessage(oldCTSHash, newCTSHash, ctsLog, changeID) - ps, err := r.gerrit.EditFiles(changeID, msg, map[string]string{ - depsRelPath: updatedDEPS, - common.RelativeExpectationsPath: ex.String(), - tsSourcesRelPath: tsSources, - }) + ps, err := r.gerrit.EditFiles(changeID, msg, generatedFiles, deletedFiles) if err != nil { return fmt.Errorf("failed to update change '%v': %v", changeID, err) } @@ -341,7 +369,7 @@ func (r *roller) roll(ctx context.Context) error { updateExpectationUpdateTimestamp(&newExpectations) ps, err = r.gerrit.EditFiles(changeID, msg, map[string]string{ common.RelativeExpectationsPath: newExpectations.String(), - }) + }, nil) if err != nil { return fmt.Errorf("failed to update change '%v': %v", changeID, err) } @@ -408,7 +436,11 @@ func (r *roller) rollCommitMessage( msg.WriteString(" commits)") } msg.WriteString("\n\n") - msg.WriteString("Update expectations and ts_sources") + msg.WriteString("Update:\n") + msg.WriteString(" - expectations.txt\n") + msg.WriteString(" - ts_sources.txt\n") + msg.WriteString(" - resource_files.txt\n") + msg.WriteString(" - webtest .html files\n") msg.WriteString("\n\n") msg.WriteString("https://chromium.googlesource.com/external/github.com/gpuweb/cts/+log/") msg.WriteString(oldCTSHash[:12]) @@ -459,11 +491,20 @@ func (r *roller) rollCommitMessage( func (r *roller) postComments(ps gerrit.Patchset, diags []expectations.Diagnostic, results result.List) error { fc := make([]gerrit.FileComment, len(diags)) for i, d := range diags { + var prefix string + switch d.Severity { + case expectations.Error: + prefix = "🟥" + case expectations.Warning: + prefix = "🟨" + case expectations.Note: + prefix = "🟦" + } fc[i] = gerrit.FileComment{ Path: common.RelativeExpectationsPath, Side: gerrit.Left, Line: d.Line, - Message: fmt.Sprintf("%v: %v", d.Severity, d.Message), + Message: fmt.Sprintf("%v %v: %v", prefix, d.Severity, d.Message), } } @@ -549,6 +590,80 @@ func (r *roller) checkout(project, dir, host, hash string) (*git.Repository, err return repo, nil } +// Call 'npm ci' in the CTS directory, and generates a map of project-relative +// file path to file content for the CTS roll's change. This includes: +// * type-script source files +// * CTS test list +// * resource file list +// * webtest file sources +func (r *roller) generateFiles(ctx context.Context) (map[string]string, error) { + // Run 'npm ci' to fetch modules and tsc + { + log.Printf("fetching npm modules with 'npm ci'...") + cmd := exec.CommandContext(ctx, r.flags.npmPath, "ci") + cmd.Dir = r.ctsDir + out, err := cmd.CombinedOutput() + if err != nil { + return nil, fmt.Errorf("failed to run 'npm ci': %w\n%v", err, string(out)) + } + } + + log.Printf("generating files for changelist...") + + // Run the below concurrently + mutex := sync.Mutex{} + files := map[string]string{} // guarded by mutex + wg := sync.WaitGroup{} + + errs := make(chan error, 8) + + // Generate web tests HTML files + wg.Add(1) + go func() { + defer wg.Done() + if out, err := r.genWebTestSources(ctx); err == nil { + mutex.Lock() + defer mutex.Unlock() + for file, content := range out { + files[file] = content + } + } else { + errs <- fmt.Errorf("failed to generate web tests: %v", err) + } + }() + + // Generate typescript sources list, test list, resources file list. + for relPath, generator := range map[string]func(context.Context) (string, error){ + tsSourcesRelPath: r.genTSDepList, + testListRelPath: r.genTestList, + resourceFilesRelPath: r.genResourceFilesList, + } { + relPath, generator := relPath, generator // Capture values, not iterators + wg.Add(1) + go func() { + defer wg.Done() + if out, err := generator(ctx); err == nil { + mutex.Lock() + defer mutex.Unlock() + files[relPath] = out + } else { + errs <- fmt.Errorf("failed to generate %v: %v", relPath, err) + } + }() + } + + // Wait for all the above to complete + wg.Wait() + close(errs) + + // Check for errors + for err := range errs { + return nil, err + } + + return files, nil +} + // updateDEPS fetches and updates the Dawn DEPS file at 'dawnRef' so that all // CTS hashes are changed to the latest CTS hash. func (r *roller) updateDEPS(ctx context.Context, dawnRef string) (newDEPS, newCTSHash, oldCTSHash string, err error) { @@ -570,12 +685,21 @@ func (r *roller) updateDEPS(ctx context.Context, dawnRef string) (newDEPS, newCT // genTSDepList returns a list of source files, for the CTS checkout at r.ctsDir // This list can be used to populate the ts_sources.txt file. +// Requires tsc to be found at './node_modules/.bin/tsc' in the CTS directory +// (e.g. must be called post 'npm ci') func (r *roller) genTSDepList(ctx context.Context) (string, error) { - cmd := exec.CommandContext(ctx, r.flags.tscPath, "--project", + tscPath := filepath.Join(r.ctsDir, "node_modules/.bin/tsc") + if !fileutils.IsExe(tscPath) { + return "", fmt.Errorf("tsc not found at '%v'", tscPath) + } + + cmd := exec.CommandContext(ctx, tscPath, "--project", filepath.Join(r.ctsDir, "tsconfig.json"), "--listFiles", "--declaration", "false", "--sourceMap", "false") + + // Note: we're ignoring the error for this as tsc typically returns status 2. out, _ := cmd.Output() prefix := filepath.ToSlash(r.ctsDir) + "/" @@ -592,3 +716,94 @@ func (r *roller) genTSDepList(ctx context.Context) (string, error) { return strings.Join(deps, "\n") + "\n", nil } + +// genTestList returns the newline delimited list of test names, for the CTS checkout at r.ctsDir +func (r *roller) genTestList(ctx context.Context) (string, error) { + // Run 'src/common/runtime/cmdline.ts' to obtain the full test list + cmd := exec.CommandContext(ctx, r.flags.nodePath, + "-e", "require('./src/common/tools/setup-ts-in-node.js');require('./src/common/runtime/cmdline.ts');", + "--", // Start of arguments + // src/common/runtime/helper/sys.ts expects 'node file.js ' + // and slices away the first two arguments. When running with '-e', args + // start at 1, so just inject a placeholder argument. + "placeholder-arg", + "--list", + "webgpu:*", + ) + cmd.Dir = r.ctsDir + + stderr := bytes.Buffer{} + cmd.Stderr = &stderr + + out, err := cmd.Output() + if err != nil { + return "", fmt.Errorf("failed to generate test list: %w\n%v", err, stderr.String()) + } + + tests := []string{} + for _, test := range strings.Split(string(out), "\n") { + if test != "" { + tests = append(tests, test) + } + } + + return strings.Join(tests, "\n"), nil +} + +// genResourceFilesList returns a list of resource files, for the CTS checkout at r.ctsDir +// This list can be used to populate the resource_files.txt file. +func (r *roller) genResourceFilesList(ctx context.Context) (string, error) { + dir := filepath.Join(r.ctsDir, "src", "resources") + files, err := filepath.Glob(filepath.Join(dir, "*")) + if err != nil { + return "", err + } + for i, file := range files { + file, err := filepath.Rel(dir, file) + if err != nil { + return "", err + } + files[i] = file + } + return strings.Join(files, "\n") + "\n", nil +} + +// genWebTestSources returns a map of generated webtest file names to contents, for the CTS checkout at r.ctsDir +func (r *roller) genWebTestSources(ctx context.Context) (map[string]string, error) { + generatedFiles := map[string]string{} + htmlSearchDir := filepath.Join(r.ctsDir, "src", "webgpu") + err := filepath.Walk(htmlSearchDir, + func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if !strings.HasSuffix(info.Name(), ".html") || info.IsDir() { + return nil + } + relPath, err := filepath.Rel(htmlSearchDir, path) + if err != nil { + return err + } + + data, err := os.ReadFile(path) + if err != nil { + return err + } + contents := string(data) + + // Find the index after the starting html tag. + i := strings.Index(contents, "") + i = i + 1 + + // Insert a base tag so the fetched resources will come from the generated CTS JavaScript sources. + contents = contents[:i] + "\n" + ` ` + contents[i:] + + generatedFiles[filepath.Join(webTestsPath, relPath)] = contents + return nil + }) + if err != nil { + return nil, err + } + return generatedFiles, nil +} diff --git a/tools/src/cmd/cts/roll/roll_test.go b/tools/src/cmd/cts/roll/roll_test.go index b7ba0540ca..ad715db995 100644 --- a/tools/src/cmd/cts/roll/roll_test.go +++ b/tools/src/cmd/cts/roll/roll_test.go @@ -58,7 +58,12 @@ func TestRollCommitMessage(t *testing.T) { ) expect := `Roll third_party/webgpu-cts/ d5e605a55..29275672e (2 commits) -Update expectations and ts_sources +Update: + - expectations.txt + - ts_sources.txt + - resource_files.txt + - webtest .html files + https://chromium.googlesource.com/external/github.com/gpuweb/cts/+log/d5e605a55640..29275672eefe - d5e605 Added thing A diff --git a/tools/src/cmd/cts/time/time.go b/tools/src/cmd/cts/time/time.go index 7bcb682a06..f96da47a62 100644 --- a/tools/src/cmd/cts/time/time.go +++ b/tools/src/cmd/cts/time/time.go @@ -23,6 +23,7 @@ import ( "time" "dawn.googlesource.com/dawn/tools/src/cmd/cts/common" + "dawn.googlesource.com/dawn/tools/src/cts/query" "dawn.googlesource.com/dawn/tools/src/cts/result" "dawn.googlesource.com/dawn/tools/src/subcmd" "go.chromium.org/luci/auth/client/authcli" @@ -37,6 +38,8 @@ type cmd struct { source common.ResultSource auth authcli.Flags tags string + query string + aggregate bool topN int histogram bool } @@ -55,7 +58,9 @@ func (c *cmd) RegisterFlags(ctx context.Context, cfg common.Config) ([]string, e c.flags.auth.Register(flag.CommandLine, common.DefaultAuthOptions()) flag.IntVar(&c.flags.topN, "top", 0, "print the top N slowest tests") flag.BoolVar(&c.flags.histogram, "histogram", false, "print a histogram of test timings") + flag.StringVar(&c.flags.query, "query", "", "test query to filter results") flag.StringVar(&c.flags.tags, "tags", "", "comma-separated list of tags to filter results") + flag.BoolVar(&c.flags.aggregate, "aggregate", false, "aggregate times by test") return nil, nil } @@ -84,6 +89,51 @@ func (c *cmd) Run(ctx context.Context, cfg common.Config) error { } } + if c.flags.query != "" { + results = results.FilterByQuery(query.Parse(c.flags.query)) + if len(results) == 0 { + return fmt.Errorf("no results after filtering by test query") + } + } + + if c.flags.aggregate { + type Key struct { + Query query.Query + Status result.Status + Tags string + } + merged := map[Key]result.Result{} + for _, r := range results { + k := Key{ + Query: query.Query{ + Suite: r.Query.Suite, + Files: r.Query.Files, + Tests: r.Query.Tests, + Cases: "*", + }, + Status: r.Status, + Tags: result.TagsToString(r.Tags), + } + entry, exists := merged[k] + if exists { + entry.Duration += r.Duration + } else { + entry = result.Result{ + Query: k.Query, + Duration: r.Duration, + Status: r.Status, + Tags: r.Tags, + } + } + merged[k] = entry + } + + results = result.List{} + for _, r := range merged { + results = append(results, r) + } + } + // Sort the results with longest duration first sort.Slice(results, func(i, j int) bool { return results[i].Duration > results[j].Duration diff --git a/tools/src/cmd/gen/main.go b/tools/src/cmd/gen/main.go new file mode 100644 index 0000000000..595f77c337 --- /dev/null +++ b/tools/src/cmd/gen/main.go @@ -0,0 +1,539 @@ +// Copyright 2021 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// gen parses the /src/tint/intrinsics.def file, then scans the +// project directory for '.tmpl' files, to produce source code files. +package main + +import ( + "flag" + "fmt" + "io" + "io/ioutil" + "math/rand" + "os" + "os/exec" + "path/filepath" + "reflect" + "regexp" + "runtime" + "strconv" + "strings" + "text/template" + "time" + "unicode" + + "dawn.googlesource.com/dawn/tools/src/container" + "dawn.googlesource.com/dawn/tools/src/fileutils" + "dawn.googlesource.com/dawn/tools/src/glob" + "dawn.googlesource.com/dawn/tools/src/tint/intrinsic/gen" + "dawn.googlesource.com/dawn/tools/src/tint/intrinsic/parser" + "dawn.googlesource.com/dawn/tools/src/tint/intrinsic/resolver" + "dawn.googlesource.com/dawn/tools/src/tint/intrinsic/sem" +) + +const defProjectRelPath = "src/tint/intrinsics.def" + +func main() { + if err := run(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +func showUsage() { + fmt.Println(` +gen generates the templated code for the Tint compiler + +gen scans the project directory for '.tmpl' files, to produce source code +files. + +If the templates use the 'IntrinsicTable' function then gen will parse and +resolve the /src/tint/intrinsics.def file. + +usage: + gen + +optional flags:`) + flag.PrintDefaults() + fmt.Println(``) + os.Exit(1) +} + +func run() error { + projectRoot := fileutils.ProjectRoot() + + // Find clang-format + clangFormatPath := findClangFormat(projectRoot) + if clangFormatPath == "" { + return fmt.Errorf("cannot find clang-format in /buildtools nor PATH") + } + + // Recursively find all the template files in the /src directory + files, err := glob.Scan(projectRoot, glob.MustParseConfig(`{ + "paths": [{"include": [ + "src/tint/**.tmpl", + "test/tint/**.tmpl" + ]}] + }`)) + if err != nil { + return err + } + + cache := &genCache{} + + // For each template file... + for _, relTmplPath := range files { + // Make tmplPath absolute + tmplPath := filepath.Join(projectRoot, relTmplPath) + + // Read the template file + tmpl, err := ioutil.ReadFile(tmplPath) + if err != nil { + return fmt.Errorf("failed to open '%v': %w", tmplPath, err) + } + + // Create or update the file at relpath if the file content has changed, + // preserving the copyright year in the header. + // relpath is a path relative to the template + writeFile := func(relpath, body string) error { + abspath := filepath.Join(filepath.Dir(tmplPath), relpath) + + copyrightYear := time.Now().Year() + + // Load the old file + existing, err := ioutil.ReadFile(abspath) + if err == nil { + // Look for the existing copyright year + if match := copyrightRegex.FindStringSubmatch(string(existing)); len(match) == 2 { + if year, err := strconv.Atoi(match[1]); err == nil { + copyrightYear = year + } + } + } + + // Write the common file header + sb := strings.Builder{} + sb.WriteString(fmt.Sprintf(header, copyrightYear, filepath.ToSlash(relTmplPath))) + sb.WriteString(body) + content := sb.String() + return writeFileIfChanged(abspath, content, string(existing)) + } + + // Write the content generated using the template and semantic info + sb := strings.Builder{} + if err := generate(string(tmpl), cache, &sb, writeFile); err != nil { + return fmt.Errorf("while processing '%v': %w", tmplPath, err) + } + + if body := sb.String(); body != "" { + _, tmplFileName := filepath.Split(tmplPath) + outFileName := strings.TrimSuffix(tmplFileName, ".tmpl") + + switch filepath.Ext(outFileName) { + case ".cc", ".h", ".inl": + body, err = clangFormat(body, clangFormatPath) + if err != nil { + return err + } + } + + if err := writeFile(outFileName, body); err != nil { + return err + } + } + } + + return nil +} + +// Cache for objects that are expensive to build, and can be reused between templates. +type genCache struct { + cached struct { + sem *sem.Sem // lazily built by sem() + intrinsicTable *gen.IntrinsicTable // lazily built by intrinsicTable() + permuter *gen.Permuter // lazily built by permute() + } +} + +// sem lazily parses and resolves the intrinsic.def file, returning the semantic info. +func (g *genCache) sem() (*sem.Sem, error) { + if g.cached.sem == nil { + // Load the builtins definition file + defPath := filepath.Join(fileutils.ProjectRoot(), defProjectRelPath) + + defSource, err := ioutil.ReadFile(defPath) + if err != nil { + return nil, err + } + + // Parse the definition file to produce an AST + ast, err := parser.Parse(string(defSource), defProjectRelPath) + if err != nil { + return nil, err + } + + // Resolve the AST to produce the semantic info + sem, err := resolver.Resolve(ast) + if err != nil { + return nil, err + } + + g.cached.sem = sem + } + return g.cached.sem, nil +} + +// intrinsicTable lazily calls and returns the result of buildIntrinsicTable(), +// caching the result for repeated calls. +func (g *genCache) intrinsicTable() (*gen.IntrinsicTable, error) { + if g.cached.intrinsicTable == nil { + sem, err := g.sem() + if err != nil { + return nil, err + } + g.cached.intrinsicTable, err = gen.BuildIntrinsicTable(sem) + if err != nil { + return nil, err + } + } + return g.cached.intrinsicTable, nil +} + +// permute lazily calls buildPermuter(), caching the result for repeated +// calls, then passes the argument to Permutator.Permute() +func (g *genCache) permute(overload *sem.Overload) ([]gen.Permutation, error) { + if g.cached.permuter == nil { + sem, err := g.sem() + if err != nil { + return nil, err + } + g.cached.permuter, err = gen.NewPermuter(sem) + if err != nil { + return nil, err + } + } + return g.cached.permuter.Permute(overload) +} + +// writes content to path if the file has changed +func writeFileIfChanged(path, newContent, oldContent string) error { + if oldContent == newContent { + return nil // Not changed + } + if err := os.MkdirAll(filepath.Dir(path), 0777); err != nil { + return fmt.Errorf("failed to create directory for '%v': %w", path, err) + } + if err := ioutil.WriteFile(path, []byte(newContent), 0666); err != nil { + return fmt.Errorf("failed to write file '%v': %w", path, err) + } + return nil +} + +var copyrightRegex = regexp.MustCompile(`// Copyright (\d+) The`) + +const header = `// Copyright %v The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// %v +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + +` + +type generator struct { + template *template.Template + cache *genCache + writeFile WriteFile + rnd *rand.Rand +} + +// WriteFile is a function that Generate() may call to emit a new file from a +// template. +// relpath is the relative path from the currently executing template. +// content is the file content to write. +type WriteFile func(relpath, content string) error + +// generate executes the template tmpl, writing the output to w. +// See https://golang.org/pkg/text/template/ for documentation on the template +// syntax. +func generate(tmpl string, cache *genCache, w io.Writer, writeFile WriteFile) error { + g := generator{ + template: template.New("